From: Andrea Bianco Date: Tue, 18 Aug 2020 11:58:02 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.1 X-Git-Tag: 2.5.1 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=dfacf7f441a092a1e235cb444060bf10fa72e39a;p=motion2.git Built motion from commit (unavailable).|2.5.1 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index bcfe1ef..21e4ff3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.5.0", + "version": "2.5.1", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-08-18T08:22:12.678Z", + "time": "2020-08-18T11:49:29.205Z", "url": "http://apidocjs.com", "version": "0.20.1" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 62c9aa2..5bce2c8 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.5.0", + "version": "2.5.1", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-08-18T08:22:12.678Z", + "time": "2020-08-18T11:49:29.205Z", "url": "http://apidocjs.com", "version": "0.20.1" } diff --git a/package.json b/package.json index 87837ef..c4ca8bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.5.0", + "version": "2.5.1", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { @@ -112,6 +112,7 @@ "twilio": "^3.9.0", "umzug": "^2.0.1", "user-agent-parser": "^0.6.0", + "uuid": "3.3.2", "validate": "^3.0.1", "winston": "^2.2.0", "ws": "4.1.0", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 8e9a479..8a61b8c 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 _0x0d34=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','action','STRING','contactManager','integration','motionbar','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x53e39d,_0x3240ce){var _0x3d8a29=function(_0x2d339c){while(--_0x2d339c){_0x53e39d['push'](_0x53e39d['shift']());}};_0x3d8a29(++_0x3240ce);}(_0x0d34,0x1d7));var _0x40d3=function(_0x42d0f5,_0x208bcb){_0x42d0f5=_0x42d0f5-0x0;var _0x34efcd=_0x0d34[_0x42d0f5];return _0x34efcd;};'use strict';var Sequelize=require(_0x40d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x40d3('0x1')],'get':function(_0x10151e){return this['getDataValue'](_0x40d3('0x2'));}},'action':{'type':Sequelize[_0x40d3('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x40d3('0x4'),_0x40d3('0x5'),_0x40d3('0x6'),'jscripty',_0x40d3('0x7'),'browser','bot','script']],'msg':_0x40d3('0x8')}},'comment':_0x40d3('0x8')},'data1':{'type':Sequelize[_0x40d3('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x40d3('0x3')](0x1000),'comment':_0x40d3('0x9')},'data3':{'type':Sequelize[_0x40d3('0x3')](0x1000),'comment':_0x40d3('0xa')},'data4':{'type':Sequelize[_0x40d3('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x40d3('0x3')]},'data7':{'type':Sequelize[_0x40d3('0xb')]}}; \ No newline at end of file +var _0xa409=['contactManager','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x1b6556,_0x2d6f52){var _0x3342d5=function(_0x5d6752){while(--_0x5d6752){_0x1b6556['push'](_0x1b6556['shift']());}};_0x3342d5(++_0x2d6f52);}(_0xa409,0x79));var _0x9a40=function(_0x809aaf,_0x311d59){_0x809aaf=_0x809aaf-0x0;var _0x8512b4=_0xa409[_0x809aaf];return _0x8512b4;};'use strict';var Sequelize=require('sequelize');module[_0x9a40('0x0')]={'name':{'type':Sequelize[_0x9a40('0x1')],'get':function(_0x920d5a){return this[_0x9a40('0x2')](_0x9a40('0x3'));}},'action':{'type':Sequelize[_0x9a40('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9a40('0x5'),'integration',_0x9a40('0x6'),'jscripty',_0x9a40('0x7'),'browser',_0x9a40('0x8'),_0x9a40('0x9')]],'msg':_0x9a40('0xa')}},'comment':_0x9a40('0xa')},'data1':{'type':Sequelize[_0x9a40('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x9a40('0x4')](0x1000),'comment':_0x9a40('0xb')},'data3':{'type':Sequelize[_0x9a40('0x4')](0x1000),'comment':_0x9a40('0xc')},'data4':{'type':Sequelize[_0x9a40('0x4')](0x1000)},'data5':{'type':Sequelize[_0x9a40('0x4')](0x1000)},'data6':{'type':Sequelize[_0x9a40('0x4')]},'data7':{'type':Sequelize[_0x9a40('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 90daaba..5f28637 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 _0xbd6f=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','body','Action','find','params','catch','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0xbd6f,0x161));var _0xfbd6=function(_0xa61bff,_0x1dd784){_0xa61bff=_0xa61bff-0x0;var _0x7cf1ae=_0xbd6f[_0xa61bff];return _0x7cf1ae;};'use strict';var pdf=require(_0xfbd6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfbd6('0x1'));var zipdir=require(_0xfbd6('0x2'));var jsonpatch=require(_0xfbd6('0x3'));var rp=require(_0xfbd6('0x4'));var moment=require(_0xfbd6('0x5'));var BPromise=require(_0xfbd6('0x6'));var Mustache=require('mustache');var util=require(_0xfbd6('0x7'));var path=require(_0xfbd6('0x8'));var sox=require(_0xfbd6('0x9'));var csv=require(_0xfbd6('0xa'));var ejs=require(_0xfbd6('0xb'));var fs=require('fs');var _=require(_0xfbd6('0xc'));var squel=require(_0xfbd6('0xd'));var crypto=require('crypto');var jsforce=require(_0xfbd6('0xe'));var deskjs=require(_0xfbd6('0xf'));var toCsv=require(_0xfbd6('0xa'));var querystring=require(_0xfbd6('0x10'));var Papa=require(_0xfbd6('0x11'));var Redis=require(_0xfbd6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfbd6('0x13'));var as=require(_0xfbd6('0x14'));var hardwareService=require(_0xfbd6('0x15'));var logger=require(_0xfbd6('0x16'))(_0xfbd6('0x17'));var utils=require(_0xfbd6('0x18'));var config=require(_0xfbd6('0x19'));var db=require(_0xfbd6('0x1a'))['db'];function respondWithStatusCode(_0x23f6c0,_0x162dd8){_0x162dd8=_0x162dd8||0xcc;return function(_0xdf7f04){if(_0xdf7f04){return _0x23f6c0[_0xfbd6('0x1b')](_0x162dd8);}return _0x23f6c0['status'](_0x162dd8)['end']();};}function respondWithResult(_0x36b54f,_0xbcecac){_0xbcecac=_0xbcecac||0xc8;return function(_0x6d272f){if(_0x6d272f){return _0x36b54f[_0xfbd6('0x1c')](_0xbcecac)[_0xfbd6('0x1d')](_0x6d272f);}};}function respondWithFilteredResult(_0x228e4d,_0x234c5a){return function(_0x4e3868){if(_0x4e3868){var _0x9dfcc7=_0x4e3868[_0xfbd6('0x1e')],_0x38fe11=_0x234c5a[_0xfbd6('0x1f')],_0x58961f=_0x234c5a[_0xfbd6('0x1f')]+_0x234c5a[_0xfbd6('0x20')],_0x32d482;if(_0x58961f>=_0x9dfcc7){_0x58961f=_0x9dfcc7;_0x32d482=0xc8;}else{_0x32d482=0xce;}_0x228e4d['status'](_0x32d482);return _0x228e4d[_0xfbd6('0x21')](_0xfbd6('0x22'),_0x38fe11+'-'+_0x58961f+'/'+_0x9dfcc7)[_0xfbd6('0x1d')](_0x4e3868);}return null;};}function patchUpdates(_0x5c0c49){return function(_0x134f27){try{jsonpatch[_0xfbd6('0x23')](_0x134f27,_0x5c0c49,!![]);}catch(_0x147411){return BPromise[_0xfbd6('0x24')](_0x147411);}return _0x134f27[_0xfbd6('0x25')]();};}function saveUpdates(_0x584c62,_0x24ca13){return function(_0x2b347d){if(_0x2b347d){return _0x2b347d[_0xfbd6('0x26')](_0x584c62)[_0xfbd6('0x27')](function(_0x1e4fb3){return _0x1e4fb3;});}return null;};}function removeEntity(_0x164190,_0x499aa6){return function(_0x55e03e){if(_0x55e03e){return _0x55e03e[_0xfbd6('0x28')]()[_0xfbd6('0x27')](function(){_0x164190[_0xfbd6('0x1c')](0xcc)[_0xfbd6('0x29')]();});}};}function handleEntityNotFound(_0xb0214c,_0x3e0f89){return function(_0x30335a){if(!_0x30335a){_0xb0214c[_0xfbd6('0x1b')](0x194);}return _0x30335a;};}function handleError(_0x3a8723,_0x2a8f89){_0x2a8f89=_0x2a8f89||0x1f4;return function(_0x17b59b){logger[_0xfbd6('0x2a')](_0x17b59b[_0xfbd6('0x2b')]);if(_0x17b59b[_0xfbd6('0x2c')]){delete _0x17b59b[_0xfbd6('0x2c')];}_0x3a8723[_0xfbd6('0x1c')](_0x2a8f89)[_0xfbd6('0x2d')](_0x17b59b);};}exports['update']=function(_0x195781,_0x387996){if(_0x195781[_0xfbd6('0x2e')]['id']){delete _0x195781[_0xfbd6('0x2e')]['id'];}return db[_0xfbd6('0x2f')][_0xfbd6('0x30')]({'where':{'id':_0x195781[_0xfbd6('0x31')]['id']}})[_0xfbd6('0x27')](handleEntityNotFound(_0x387996,null))['then'](saveUpdates(_0x195781[_0xfbd6('0x2e')],null))[_0xfbd6('0x27')](respondWithResult(_0x387996,null))[_0xfbd6('0x32')](handleError(_0x387996,null));};exports['destroy']=function(_0x3f362e,_0x1d4333){return db['Action'][_0xfbd6('0x30')]({'where':{'id':_0x3f362e[_0xfbd6('0x31')]['id']}})[_0xfbd6('0x27')](handleEntityNotFound(_0x1d4333,null))[_0xfbd6('0x27')](removeEntity(_0x1d4333,null))[_0xfbd6('0x32')](handleError(_0x1d4333,null));}; \ No newline at end of file +var _0xc80d=['find','params','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body'];(function(_0x3fed7e,_0x5712a4){var _0x545629=function(_0x2823a9){while(--_0x2823a9){_0x3fed7e['push'](_0x3fed7e['shift']());}};_0x545629(++_0x5712a4);}(_0xc80d,0x123));var _0xdc80=function(_0x3cbb9d,_0x30a26f){_0x3cbb9d=_0x3cbb9d-0x0;var _0x10d66e=_0xc80d[_0x3cbb9d];return _0x10d66e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc80('0x0'));var rimraf=require(_0xdc80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc80('0x2'));var rp=require(_0xdc80('0x3'));var moment=require('moment');var BPromise=require(_0xdc80('0x4'));var Mustache=require(_0xdc80('0x5'));var util=require(_0xdc80('0x6'));var path=require(_0xdc80('0x7'));var sox=require('sox');var csv=require(_0xdc80('0x8'));var ejs=require(_0xdc80('0x9'));var fs=require('fs');var _=require(_0xdc80('0xa'));var squel=require('squel');var crypto=require(_0xdc80('0xb'));var jsforce=require(_0xdc80('0xc'));var deskjs=require(_0xdc80('0xd'));var toCsv=require(_0xdc80('0x8'));var querystring=require(_0xdc80('0xe'));var Papa=require('papaparse');var Redis=require(_0xdc80('0xf'));var authService=require(_0xdc80('0x10'));var qs=require(_0xdc80('0x11'));var as=require(_0xdc80('0x12'));var hardwareService=require(_0xdc80('0x13'));var logger=require(_0xdc80('0x14'))(_0xdc80('0x15'));var utils=require(_0xdc80('0x16'));var config=require(_0xdc80('0x17'));var db=require(_0xdc80('0x18'))['db'];function respondWithStatusCode(_0x373539,_0x45fa62){_0x45fa62=_0x45fa62||0xcc;return function(_0x18627a){if(_0x18627a){return _0x373539[_0xdc80('0x19')](_0x45fa62);}return _0x373539[_0xdc80('0x1a')](_0x45fa62)[_0xdc80('0x1b')]();};}function respondWithResult(_0xd3c0ea,_0x259ca9){_0x259ca9=_0x259ca9||0xc8;return function(_0x51900c){if(_0x51900c){return _0xd3c0ea['status'](_0x259ca9)[_0xdc80('0x1c')](_0x51900c);}};}function respondWithFilteredResult(_0x3609e1,_0x574c08){return function(_0xdbf850){if(_0xdbf850){var _0x2eb96e=_0xdbf850[_0xdc80('0x1d')],_0x30b8b0=_0x574c08[_0xdc80('0x1e')],_0x3f4a2d=_0x574c08[_0xdc80('0x1e')]+_0x574c08[_0xdc80('0x1f')],_0x14fe35;if(_0x3f4a2d>=_0x2eb96e){_0x3f4a2d=_0x2eb96e;_0x14fe35=0xc8;}else{_0x14fe35=0xce;}_0x3609e1[_0xdc80('0x1a')](_0x14fe35);return _0x3609e1[_0xdc80('0x20')](_0xdc80('0x21'),_0x30b8b0+'-'+_0x3f4a2d+'/'+_0x2eb96e)[_0xdc80('0x1c')](_0xdbf850);}return null;};}function patchUpdates(_0x44c2d5){return function(_0x4cff83){try{jsonpatch[_0xdc80('0x22')](_0x4cff83,_0x44c2d5,!![]);}catch(_0x29c669){return BPromise[_0xdc80('0x23')](_0x29c669);}return _0x4cff83[_0xdc80('0x24')]();};}function saveUpdates(_0x1297f6,_0x1b095d){return function(_0xa44c83){if(_0xa44c83){return _0xa44c83[_0xdc80('0x25')](_0x1297f6)[_0xdc80('0x26')](function(_0x53dd70){return _0x53dd70;});}return null;};}function removeEntity(_0x2f141,_0x10f6b6){return function(_0x348b60){if(_0x348b60){return _0x348b60[_0xdc80('0x27')]()[_0xdc80('0x26')](function(){_0x2f141['status'](0xcc)[_0xdc80('0x1b')]();});}};}function handleEntityNotFound(_0x278df1,_0x4fb6d0){return function(_0x5e8c00){if(!_0x5e8c00){_0x278df1[_0xdc80('0x19')](0x194);}return _0x5e8c00;};}function handleError(_0x16e4cb,_0x933a8c){_0x933a8c=_0x933a8c||0x1f4;return function(_0x88c0){logger[_0xdc80('0x28')](_0x88c0[_0xdc80('0x29')]);if(_0x88c0[_0xdc80('0x2a')]){delete _0x88c0[_0xdc80('0x2a')];}_0x16e4cb[_0xdc80('0x1a')](_0x933a8c)[_0xdc80('0x2b')](_0x88c0);};}exports['update']=function(_0x5867b,_0x48c3d2){if(_0x5867b[_0xdc80('0x2c')]['id']){delete _0x5867b[_0xdc80('0x2c')]['id'];}return db['Action'][_0xdc80('0x2d')]({'where':{'id':_0x5867b[_0xdc80('0x2e')]['id']}})[_0xdc80('0x26')](handleEntityNotFound(_0x48c3d2,null))[_0xdc80('0x26')](saveUpdates(_0x5867b['body'],null))[_0xdc80('0x26')](respondWithResult(_0x48c3d2,null))[_0xdc80('0x2f')](handleError(_0x48c3d2,null));};exports[_0xdc80('0x27')]=function(_0x4ff779,_0x42f191){return db['Action'][_0xdc80('0x2d')]({'where':{'id':_0x4ff779[_0xdc80('0x2e')]['id']}})[_0xdc80('0x26')](handleEntityNotFound(_0x42f191,null))['then'](removeEntity(_0x42f191,null))[_0xdc80('0x2f')](handleError(_0x42f191,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c3410c3..c11875c 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 _0x81a1=['request-promise','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x81a1,0x15b));var _0x181a=function(_0x265cf2,_0x1a3bde){_0x265cf2=_0x265cf2-0x0;var _0x32b771=_0x81a1[_0x265cf2];return _0x32b771;};'use strict';var _=require(_0x181a('0x0'));var util=require('util');var logger=require(_0x181a('0x1'))(_0x181a('0x2'));var moment=require(_0x181a('0x3'));var BPromise=require(_0x181a('0x4'));var rp=require(_0x181a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x181a('0x6'));var attributes=require(_0x181a('0x7'));module[_0x181a('0x8')]=function(_0x3b19dd,_0x5cec76){return _0x3b19dd['define'](_0x181a('0x9'),attributes,{'tableName':_0x181a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd04b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0xd04b,0x1ec));var _0xbd04=function(_0x4a9cf4,_0x2fd87e){_0x4a9cf4=_0x4a9cf4-0x0;var _0x11a04a=_0xd04b[_0x4a9cf4];return _0x11a04a;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('api');var moment=require(_0xbd04('0x3'));var BPromise=require(_0xbd04('0x4'));var rp=require(_0xbd04('0x5'));var fs=require('fs');var path=require(_0xbd04('0x6'));var rimraf=require(_0xbd04('0x7'));var config=require(_0xbd04('0x8'));var attributes=require(_0xbd04('0x9'));module[_0xbd04('0xa')]=function(_0x356449,_0x504508){return _0x356449[_0xbd04('0xb')](_0xbd04('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 2cccff1..500b8a0 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1d3e3f,_0x495ec1){var _0x3879fa=function(_0x12e542){while(--_0x12e542){_0x1d3e3f['push'](_0x1d3e3f['shift']());}};_0x3879fa(++_0x495ec1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3ced90,_0xf1aad1){var _0x5b9d75=function(_0x287333){while(--_0x287333){_0x3ced90['push'](_0x3ced90['shift']());}};_0x5b9d75(++_0xf1aad1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f1c942c..0e52c12 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 _0x466d=['exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./action.controller','/:id','delete','destroy'];(function(_0x2237d3,_0x10ef8e){var _0xd91644=function(_0x42b4cb){while(--_0x42b4cb){_0x2237d3['push'](_0x2237d3['shift']());}};_0xd91644(++_0x10ef8e);}(_0x466d,0x1ae));var _0xd466=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x466d[_0x33c9f8];return _0x2d7004;};'use strict';var multer=require('multer');var util=require(_0xd466('0x0'));var path=require(_0xd466('0x1'));var timeout=require('connect-timeout');var express=require(_0xd466('0x2'));var router=express[_0xd466('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd466('0x4'));var config=require(_0xd466('0x5'));var controller=require(_0xd466('0x6'));router['put'](_0xd466('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xd466('0x8')](_0xd466('0x7'),auth['isAuthenticated'](),controller[_0xd466('0x9')]);module[_0xd466('0xa')]=router; \ No newline at end of file +var _0x194d=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x194d,0x136));var _0xd194=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x194d[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xd194('0x0'));var util=require(_0xd194('0x1'));var path=require('path');var timeout=require(_0xd194('0x2'));var express=require('express');var router=express[_0xd194('0x3')]();var auth=require(_0xd194('0x4'));var interaction=require(_0xd194('0x5'));var config=require(_0xd194('0x6'));var controller=require(_0xd194('0x7'));router[_0xd194('0x8')]('/:id',auth[_0xd194('0x9')](),controller[_0xd194('0xa')]);router[_0xd194('0xb')]('/:id',auth[_0xd194('0x9')](),controller[_0xd194('0xc')]);module[_0xd194('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1f6d9c1..19d04b0 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 _0xd167=['STRING','TEXT','exports'];(function(_0x2f4929,_0x1c5f71){var _0x5e434a=function(_0xa41953){while(--_0xa41953){_0x2f4929['push'](_0x2f4929['shift']());}};_0x5e434a(++_0x1c5f71);}(_0xd167,0xa1));var _0x7d16=function(_0x16899f,_0x5d81c3){_0x16899f=_0x16899f-0x0;var _0xeff058=_0xd167[_0x16899f];return _0xeff058;};'use strict';var Sequelize=require('sequelize');module[_0x7d16('0x0')]={'name':{'type':Sequelize[_0x7d16('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7d16('0x1')]},'parent':{'type':Sequelize[_0x7d16('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x7d16('0x2')]}}; \ No newline at end of file +var _0xf6b8=['STRING','TEXT','sequelize','exports'];(function(_0x51a126,_0x331e0a){var _0x177d6d=function(_0x3606f3){while(--_0x3606f3){_0x51a126['push'](_0x51a126['shift']());}};_0x177d6d(++_0x331e0a);}(_0xf6b8,0xc6));var _0x8f6b=function(_0x1f0cff,_0x5a97d5){_0x1f0cff=_0x1f0cff-0x0;var _0xfe5909=_0xf6b8[_0x1f0cff];return _0xfe5909;};'use strict';var Sequelize=require(_0x8f6b('0x0'));module[_0x8f6b('0x1')]={'name':{'type':Sequelize[_0x8f6b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8f6b('0x2')]},'parent':{'type':Sequelize[_0x8f6b('0x2')]},'table':{'type':Sequelize[_0x8f6b('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8f6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f95d86f..9558216 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 _0x9f62=['cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','SUM(%s)','DESC','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','merge','type','filter','options','count','includeAll','include','findAll','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','find','autoAssociation','catch','update','destroy','join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','order','orderBy','alias','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','parse','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','right_join','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','getFields','groupBy','foreignTable','Limited\x20Query:','Sequelize','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport'];(function(_0xf820ff,_0x165958){var _0xa14bc1=function(_0x61e876){while(--_0x61e876){_0xf820ff['push'](_0xf820ff['shift']());}};_0xa14bc1(++_0x165958);}(_0x9f62,0x154));var _0x29f6=function(_0x4d7a29,_0x4547eb){_0x4d7a29=_0x4d7a29-0x0;var _0x1c6c08=_0x9f62[_0x4d7a29];return _0x1c6c08;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x1'));var jsonpatch=require(_0x29f6('0x2'));var rp=require(_0x29f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29f6('0x4'));var util=require(_0x29f6('0x5'));var path=require(_0x29f6('0x6'));var sox=require(_0x29f6('0x7'));var csv=require('to-csv');var ejs=require(_0x29f6('0x8'));var fs=require('fs');var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x57b2d2,_0x2ae0e4){_0x2ae0e4=_0x2ae0e4||0xcc;return function(_0x55cf4){if(_0x55cf4){return _0x57b2d2[_0x29f6('0x13')](_0x2ae0e4);}return _0x57b2d2[_0x29f6('0x14')](_0x2ae0e4)[_0x29f6('0x15')]();};}function respondWithResult(_0x156c96,_0x35d2e2){_0x35d2e2=_0x35d2e2||0xc8;return function(_0x2418ee){if(_0x2418ee){return _0x156c96[_0x29f6('0x14')](_0x35d2e2)[_0x29f6('0x16')](_0x2418ee);}};}function respondWithFilteredResult(_0x28d314,_0x370484){return function(_0x1dde97){if(_0x1dde97){var _0x3a75d0=_0x1dde97['count'],_0x25e5a2=_0x370484['offset'],_0x14dd56=_0x370484[_0x29f6('0x17')]+_0x370484[_0x29f6('0x18')],_0x3584a1;if(_0x14dd56>=_0x3a75d0){_0x14dd56=_0x3a75d0;_0x3584a1=0xc8;}else{_0x3584a1=0xce;}_0x28d314[_0x29f6('0x14')](_0x3584a1);return _0x28d314['set'](_0x29f6('0x19'),_0x25e5a2+'-'+_0x14dd56+'/'+_0x3a75d0)[_0x29f6('0x16')](_0x1dde97);}return null;};}function patchUpdates(_0x49252f){return function(_0x159227){try{jsonpatch[_0x29f6('0x1a')](_0x159227,_0x49252f,!![]);}catch(_0x42a8fa){return BPromise[_0x29f6('0x1b')](_0x42a8fa);}return _0x159227[_0x29f6('0x1c')]();};}function saveUpdates(_0x2bfb3d,_0x5673c8){return function(_0xfb8fd2){if(_0xfb8fd2){return _0xfb8fd2['update'](_0x2bfb3d)['then'](function(_0x470019){return _0x470019;});}return null;};}function removeEntity(_0x1fa159,_0x39c6b3){return function(_0xafb5dd){if(_0xafb5dd){return _0xafb5dd['destroy']()[_0x29f6('0x1d')](function(){var _0x49f67d=_0xafb5dd[_0x29f6('0x1e')]({'plain':!![]});var _0xcce041=_0x29f6('0x1f');return db[_0x29f6('0x20')]['destroy']({'where':{'type':_0xcce041,'resourceId':_0x49f67d['id']}})[_0x29f6('0x1d')](function(){return _0xafb5dd;});})[_0x29f6('0x1d')](function(){_0x1fa159['status'](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0x45f792,_0x2519ac){return function(_0x342038){if(!_0x342038){_0x45f792[_0x29f6('0x13')](0x194);}return _0x342038;};}function handleError(_0x4333bc,_0x23c630){_0x23c630=_0x23c630||0x1f4;return function(_0x50cdd2){logger[_0x29f6('0x21')](_0x50cdd2[_0x29f6('0x22')]);if(_0x50cdd2[_0x29f6('0x23')]){delete _0x50cdd2[_0x29f6('0x23')];}_0x4333bc[_0x29f6('0x14')](_0x23c630)[_0x29f6('0x24')](_0x50cdd2);};}exports[_0x29f6('0x25')]=function(_0x17b2f2,_0x3d88db){var _0x13a3a2={},_0x2915bc={},_0x1c3f0b={'count':0x0,'rows':[]};var _0x40c830=_[_0x29f6('0x26')](db[_0x29f6('0x27')][_0x29f6('0x28')],function(_0x3a7249){return{'name':_0x3a7249['fieldName'],'type':_0x3a7249['type'][_0x29f6('0x29')]};});_0x2915bc['model']=_[_0x29f6('0x26')](_0x40c830,_0x29f6('0x23'));_0x2915bc[_0x29f6('0x2a')]=_[_0x29f6('0x2b')](_0x17b2f2['query']);_0x2915bc['filters']=_[_0x29f6('0x2c')](_0x2915bc[_0x29f6('0x2d')],_0x2915bc[_0x29f6('0x2a')]);_0x13a3a2[_0x29f6('0x2e')]=_[_0x29f6('0x2c')](_0x2915bc[_0x29f6('0x2d')],qs[_0x29f6('0x2f')](_0x17b2f2[_0x29f6('0x2a')][_0x29f6('0x2f')]));_0x13a3a2[_0x29f6('0x2e')]=_0x13a3a2[_0x29f6('0x2e')][_0x29f6('0x30')]?_0x13a3a2[_0x29f6('0x2e')]:_0x2915bc[_0x29f6('0x2d')];if(!_0x17b2f2['query']['hasOwnProperty'](_0x29f6('0x31'))){_0x13a3a2[_0x29f6('0x18')]=qs[_0x29f6('0x18')](_0x17b2f2['query'][_0x29f6('0x18')]);_0x13a3a2[_0x29f6('0x17')]=qs[_0x29f6('0x17')](_0x17b2f2[_0x29f6('0x2a')][_0x29f6('0x17')]);}_0x13a3a2['order']=qs[_0x29f6('0x32')](_0x17b2f2[_0x29f6('0x2a')][_0x29f6('0x32')]);_0x13a3a2[_0x29f6('0x33')]=qs['filters'](_[_0x29f6('0x34')](_0x17b2f2[_0x29f6('0x2a')],_0x2915bc[_0x29f6('0x35')]),_0x40c830);if(_0x17b2f2[_0x29f6('0x2a')]['filter']){_0x13a3a2['where']=_[_0x29f6('0x36')](_0x13a3a2['where'],{'$or':_[_0x29f6('0x26')](_0x40c830,function(_0x551411){if(_0x551411[_0x29f6('0x37')]!=='VIRTUAL'){var _0x34b1ea={};_0x34b1ea[_0x551411[_0x29f6('0x23')]]={'$like':'%'+_0x17b2f2['query'][_0x29f6('0x38')]+'%'};return _0x34b1ea;}})});}_0x13a3a2=_['merge']({},_0x13a3a2,_0x17b2f2[_0x29f6('0x39')]);var _0x10b4c0={'where':_0x13a3a2['where']};return db[_0x29f6('0x27')][_0x29f6('0x3a')](_0x10b4c0)[_0x29f6('0x1d')](function(_0x1e9d5a){_0x1c3f0b['count']=_0x1e9d5a;if(_0x17b2f2[_0x29f6('0x2a')][_0x29f6('0x3b')]){_0x13a3a2[_0x29f6('0x3c')]=[{'all':!![]}];}return db[_0x29f6('0x27')][_0x29f6('0x3d')](_0x13a3a2);})['then'](function(_0xb5f2b1){_0x1c3f0b['rows']=_0xb5f2b1;return _0x1c3f0b;})[_0x29f6('0x1d')](respondWithFilteredResult(_0x3d88db,_0x13a3a2))['catch'](handleError(_0x3d88db,null));};exports[_0x29f6('0x3e')]=function(_0x3a8a12,_0x4b1524){var _0x28046c={'raw':![],'where':{'id':_0x3a8a12[_0x29f6('0x3f')]['id']}},_0x2c371f={};_0x2c371f[_0x29f6('0x2d')]=_['keys'](db[_0x29f6('0x27')][_0x29f6('0x28')]);_0x2c371f[_0x29f6('0x2a')]=_['keys'](_0x3a8a12[_0x29f6('0x2a')]);_0x2c371f['filters']=_[_0x29f6('0x2c')](_0x2c371f['model'],_0x2c371f['query']);_0x28046c['attributes']=_[_0x29f6('0x2c')](_0x2c371f[_0x29f6('0x2d')],qs[_0x29f6('0x2f')](_0x3a8a12[_0x29f6('0x2a')][_0x29f6('0x2f')]));_0x28046c[_0x29f6('0x2e')]=_0x28046c[_0x29f6('0x2e')][_0x29f6('0x30')]?_0x28046c[_0x29f6('0x2e')]:_0x2c371f[_0x29f6('0x2d')];if(_0x3a8a12['query']['includeAll']){_0x28046c[_0x29f6('0x3c')]=[{'all':!![]}];}_0x28046c=_[_0x29f6('0x36')]({},_0x28046c,_0x3a8a12[_0x29f6('0x39')]);return db[_0x29f6('0x27')]['find'](_0x28046c)[_0x29f6('0x1d')](handleEntityNotFound(_0x4b1524,null))[_0x29f6('0x1d')](respondWithResult(_0x4b1524,null))['catch'](handleError(_0x4b1524,null));};exports[_0x29f6('0x40')]=function(_0xd8514a,_0x123e2f){return db[_0x29f6('0x27')][_0x29f6('0x40')](_0xd8514a[_0x29f6('0x41')],{})[_0x29f6('0x1d')](function(_0x1f03b6){var _0x2ca712=_0xd8514a[_0x29f6('0x42')][_0x29f6('0x1e')]({'plain':!![]});if(!_0x2ca712)throw new Error(_0x29f6('0x43'));if(_0x2ca712['role']===_0x29f6('0x42')){var _0x463551=_0x1f03b6[_0x29f6('0x1e')]({'plain':!![]});var _0x314e9b=_0x29f6('0x44');return db['UserProfileSection'][_0x29f6('0x45')]({'where':{'name':_0x314e9b,'userProfileId':_0x2ca712['userProfileId']},'raw':!![]})['then'](function(_0x9dfc77){if(_0x9dfc77&&_0x9dfc77[_0x29f6('0x46')]===0x0){return db[_0x29f6('0x20')][_0x29f6('0x40')]({'name':_0x463551[_0x29f6('0x23')],'resourceId':_0x463551['id'],'type':'CustomReports','sectionId':_0x9dfc77['id']},{})[_0x29f6('0x1d')](function(){return _0x1f03b6;});}else{return _0x1f03b6;}})[_0x29f6('0x47')](function(_0x5f42f3){logger[_0x29f6('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f42f3);throw _0x5f42f3;});}return _0x1f03b6;})[_0x29f6('0x1d')](respondWithResult(_0x123e2f,0xc9))[_0x29f6('0x47')](handleError(_0x123e2f,null));};exports[_0x29f6('0x48')]=function(_0x292567,_0x5c9113){if(_0x292567[_0x29f6('0x41')]['id']){delete _0x292567[_0x29f6('0x41')]['id'];}return db[_0x29f6('0x27')][_0x29f6('0x45')]({'where':{'id':_0x292567[_0x29f6('0x3f')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x5c9113,null))[_0x29f6('0x1d')](saveUpdates(_0x292567['body'],null))[_0x29f6('0x1d')](respondWithResult(_0x5c9113,null))[_0x29f6('0x47')](handleError(_0x5c9113,null));};exports[_0x29f6('0x49')]=function(_0xdbfc0f,_0x36e52c){return db[_0x29f6('0x27')][_0x29f6('0x45')]({'where':{'id':_0xdbfc0f[_0x29f6('0x3f')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x36e52c,null))[_0x29f6('0x1d')](removeEntity(_0x36e52c,null))['catch'](handleError(_0x36e52c,null));};exports['preview']=function(_0x29f210,_0xf609d0){var _0x31c91e=0xa;var _0x5ab84e=[_0x29f6('0x4a'),'left_join','right_join',_0x29f6('0x4b')];var _0x234d30={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x29f6('0x4c'),'MAX':_0x29f6('0x4d'),'MIN':_0x29f6('0x4e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x29f6('0x4f'),'GROUP_CONCAT ASC':_0x29f6('0x50'),'GROUP_CONCAT DESC':_0x29f6('0x51')};var _0x41143a={'SEC_TO_TIME':_0x29f6('0x52'),'DATE':_0x29f6('0x53'),'HOUR':_0x29f6('0x54'),'ROUND':_0x29f6('0x55'),'UNIX_TIMESTAMP':_0x29f6('0x56')};var _0x192525=function(_0x2d4c8d){return!_[_0x29f6('0x57')]([_0x29f6('0x58'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x29f6('0x59')],_0x2d4c8d);};var _0x54cd1a=function(_0x1a5220){if(!_0x1a5220||!_0x1a5220[_0x29f6('0x5a')][_0x29f6('0x30')]){return'';}for(var _0x40b4d7='(',_0x2f757b=0x0;_0x2f757b<_0x1a5220['rules'][_0x29f6('0x30')];_0x2f757b+=0x1){_0x2f757b>0x0&&(_0x40b4d7+='\x20'+_0x1a5220[_0x29f6('0x5b')]+'\x20');_0x40b4d7+=_0x1a5220[_0x29f6('0x5a')][_0x2f757b][_0x29f6('0x5c')]?_0x54cd1a(_0x1a5220[_0x29f6('0x5a')][_0x2f757b]['group']):_0x1a5220[_0x29f6('0x5a')][_0x2f757b]['field']+'\x20'+_0x1a5220['rules'][_0x2f757b][_0x29f6('0x5d')]+(_0x192525(_0x1a5220[_0x29f6('0x5a')][_0x2f757b]['condition'])?'\x20'+_0x1a5220[_0x29f6('0x5a')][_0x2f757b][_0x29f6('0x5e')]:'');}return _0x40b4d7+')';};var _0x58bdf4={'where':{'id':_0x29f210[_0x29f6('0x3f')]['id']}},_0x44b3ee,_0x2ba44c,_0x94de9c,_0x2f54eb,_0xf3c5f1;_0x58bdf4=_[_0x29f6('0x36')]({},_0x58bdf4,_0x29f210['options']);return db[_0x29f6('0x27')]['find'](_0x58bdf4)[_0x29f6('0x1d')](function(_0x4f35ad){if(_0x4f35ad){_0x44b3ee=_0x4f35ad;return _0x4f35ad['getFields']();}return null;})[_0x29f6('0x1d')](function(_0x68b47f){if(_0x68b47f){if(!_0x68b47f[_0x29f6('0x30')]){throw new db['Sequelize'][(_0x29f6('0x5f'))](_0x29f6('0x60'),0x193);}_0x2ba44c=_0x68b47f;return db[_0x29f6('0x61')]['findAll']({'raw':!![]});}return null;})[_0x29f6('0x1d')](function(_0x35623a){if(_0x35623a){_0x94de9c=_[_0x29f6('0x62')](_0x35623a,'id');var _0xc50331;var _0x1f9a9d=squel[_0x29f6('0x63')]();_0x1f9a9d[_0x29f6('0x64')](_0x44b3ee[_0x29f6('0x65')]);for(var _0x56f3cb=0x0;_0x56f3cb<_0x2ba44c[_0x29f6('0x30')];_0x56f3cb+=0x1){_0xc50331=_0x2ba44c[_0x56f3cb][_0x29f6('0x66')]?_0x94de9c[_0x2ba44c[_0x56f3cb][_0x29f6('0x66')]][_0x29f6('0x67')]:_0x2ba44c[_0x56f3cb][_0x29f6('0x68')];_0xc50331=_0x2ba44c[_0x56f3cb][_0x29f6('0x69')]?_[_0x29f6('0x6a')](_0x234d30[_0x2ba44c[_0x56f3cb][_0x29f6('0x69')]],'%s',_0xc50331):_0xc50331;_0xc50331=_0x2ba44c[_0x56f3cb]['format']?_[_0x29f6('0x6a')](_0x41143a[_0x2ba44c[_0x56f3cb][_0x29f6('0x6b')]],'%s',_0xc50331):_0xc50331;if(_0x2ba44c[_0x56f3cb]['groupBy']){_0x1f9a9d[_0x29f6('0x5c')](_0xc50331);}_0x2ba44c[_0x56f3cb]['orderBy']&&_0x1f9a9d[_0x29f6('0x6c')](_0xc50331,_0x2ba44c[_0x56f3cb][_0x29f6('0x6d')]==='DESC'?![]:!![]);_0x1f9a9d[_0x29f6('0x68')](_0xc50331,_0x2ba44c[_0x56f3cb][_0x29f6('0x6e')]||_0xc50331);}if(_0x44b3ee['joins']){_0x44b3ee['joins']=JSON['parse'](_0x44b3ee[_0x29f6('0x6f')]);for(var _0x1da0ea=0x0;_0x1da0ea<_0x44b3ee[_0x29f6('0x6f')][_0x29f6('0x30')];_0x1da0ea+=0x1){if(_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea][_0x29f6('0x37')]&&_[_0x29f6('0x57')](_0x5ab84e,_0x44b3ee['joins'][_0x1da0ea][_0x29f6('0x37')])&&_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea][_0x29f6('0x70')]&&_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea]['foreignTable']&&_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea][_0x29f6('0x71')]){_0x1f9a9d[_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea][_0x29f6('0x37')]](_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea]['foreignTable'],null,util[_0x29f6('0x6b')](_0x29f6('0x72'),_0x44b3ee[_0x29f6('0x65')],_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea][_0x29f6('0x70')],_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea]['foreignTable'],_0x44b3ee[_0x29f6('0x6f')][_0x1da0ea]['foreignKey']));}}}if(_0x44b3ee['conditions']){_0x44b3ee['conditions']=JSON[_0x29f6('0x73')](_0x44b3ee['conditions']);_0x1f9a9d[_0x29f6('0x33')](_0x54cd1a(_0x44b3ee[_0x29f6('0x74')][_0x29f6('0x5c')]));}_0xf3c5f1=_0x1f9a9d[_0x29f6('0x75')]();_0x1f9a9d[_0x29f6('0x18')](_0x31c91e);_0x1f9a9d[_0x29f6('0x17')](0x0);logger[_0x29f6('0x76')]('Limited\x20Query:',_0x1f9a9d[_0x29f6('0x77')]());return db['sequelize'][_0x29f6('0x2a')](_0x1f9a9d[_0x29f6('0x77')](),{'type':db[_0x29f6('0x78')][_0x29f6('0x79')][_0x29f6('0x7a')]});}})[_0x29f6('0x1d')](respondWithResult(_0xf609d0,null))[_0x29f6('0x47')](handleError(_0xf609d0,null));};function runReport(_0x1735c3,_0x18a470,_0xe14459){var _0x276ca5=_0x18a470[_0x29f6('0x23')];var _0x565c20=0xa;var _0x4eb7c9=['join',_0x29f6('0x7b'),_0x29f6('0x7c'),'cross_join'];var _0xf18d73={'SUM':'SUM(%s)','COUNT':_0x29f6('0x7d'),'COUNT DISTINCT':_0x29f6('0x4c'),'MAX':_0x29f6('0x4d'),'MIN':_0x29f6('0x4e'),'AVG':_0x29f6('0x7e'),'GROUP_CONCAT':_0x29f6('0x4f'),'GROUP_CONCAT ASC':_0x29f6('0x50'),'GROUP_CONCAT DESC':_0x29f6('0x51')};var _0x43c051={'SEC_TO_TIME':_0x29f6('0x52'),'DATE':'DATE(%s)','HOUR':_0x29f6('0x54'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x29f6('0x56')};var _0x144d8c=function(_0x2f4b68){return!_[_0x29f6('0x57')]([_0x29f6('0x58'),_0x29f6('0x7f'),_0x29f6('0x80'),_0x29f6('0x59')],_0x2f4b68);};var _0x546e14=function(_0x21bcee){if(!_0x21bcee||!_0x21bcee[_0x29f6('0x5a')]['length']){return'';}for(var _0x4bb53f='(',_0x216f51=0x0;_0x216f51<_0x21bcee[_0x29f6('0x5a')][_0x29f6('0x30')];_0x216f51+=0x1){_0x216f51>0x0&&(_0x4bb53f+='\x20'+_0x21bcee[_0x29f6('0x5b')]+'\x20');_0x4bb53f+=_0x21bcee[_0x29f6('0x5a')][_0x216f51][_0x29f6('0x5c')]?_0x546e14(_0x21bcee[_0x29f6('0x5a')][_0x216f51][_0x29f6('0x5c')]):_0x21bcee[_0x29f6('0x5a')][_0x216f51][_0x29f6('0x68')]+'\x20'+_0x21bcee[_0x29f6('0x5a')][_0x216f51][_0x29f6('0x5d')]+(_0x144d8c(_0x21bcee['rules'][_0x216f51]['condition'])?'\x20'+_0x21bcee[_0x29f6('0x5a')][_0x216f51][_0x29f6('0x5e')]:'');}return _0x4bb53f+')';};var _0x5063b6={'where':{'id':_0x1735c3['id']}},_0x98db35,_0x128384,_0x41fd08,_0x7056e6,_0x3ec8ce;_0x5063b6=_[_0x29f6('0x36')]({},_0x5063b6,_0xe14459);return db[_0x29f6('0x27')]['find'](_0x5063b6)[_0x29f6('0x1d')](function(_0x1b44e2){if(_0x1b44e2){_0x98db35=_0x1b44e2;return _0x1b44e2[_0x29f6('0x81')]();}return null;})['then'](function(_0x131fa9){if(_0x131fa9){if(!_0x131fa9[_0x29f6('0x30')]){throw new db['Sequelize'][(_0x29f6('0x5f'))](_0x29f6('0x60'),0x193);}_0x128384=_0x131fa9;return db['AnalyticMetric'][_0x29f6('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x405124){if(_0x405124){_0x41fd08=_[_0x29f6('0x62')](_0x405124,'id');var _0x286fdd;var _0x3a7064=squel[_0x29f6('0x63')]();_0x3a7064[_0x29f6('0x64')](_0x98db35['table']);for(var _0x4e0bd5=0x0;_0x4e0bd5<_0x128384[_0x29f6('0x30')];_0x4e0bd5+=0x1){_0x286fdd=_0x128384[_0x4e0bd5][_0x29f6('0x66')]?_0x41fd08[_0x128384[_0x4e0bd5]['MetricId']][_0x29f6('0x67')]:_0x128384[_0x4e0bd5]['field'];_0x286fdd=_0x128384[_0x4e0bd5][_0x29f6('0x69')]?_[_0x29f6('0x6a')](_0xf18d73[_0x128384[_0x4e0bd5][_0x29f6('0x69')]],'%s',_0x286fdd):_0x286fdd;_0x286fdd=_0x128384[_0x4e0bd5][_0x29f6('0x6b')]?_[_0x29f6('0x6a')](_0x43c051[_0x128384[_0x4e0bd5][_0x29f6('0x6b')]],'%s',_0x286fdd):_0x286fdd;if(_0x128384[_0x4e0bd5][_0x29f6('0x82')]){_0x3a7064['group'](_0x286fdd);}_0x128384[_0x4e0bd5][_0x29f6('0x6d')]&&_0x3a7064[_0x29f6('0x6c')](_0x286fdd,_0x128384[_0x4e0bd5][_0x29f6('0x6d')]==='DESC'?![]:!![]);_0x3a7064['field'](_0x286fdd,_0x128384[_0x4e0bd5]['alias']||_0x286fdd);}if(_0x98db35['joins']){_0x98db35[_0x29f6('0x6f')]=JSON['parse'](_0x98db35['joins']);for(var _0x4ef1d4=0x0;_0x4ef1d4<_0x98db35[_0x29f6('0x6f')][_0x29f6('0x30')];_0x4ef1d4+=0x1){if(_0x98db35[_0x29f6('0x6f')][_0x4ef1d4][_0x29f6('0x37')]&&_[_0x29f6('0x57')](_0x4eb7c9,_0x98db35['joins'][_0x4ef1d4][_0x29f6('0x37')])&&_0x98db35['joins'][_0x4ef1d4][_0x29f6('0x70')]&&_0x98db35[_0x29f6('0x6f')][_0x4ef1d4][_0x29f6('0x83')]&&_0x98db35[_0x29f6('0x6f')][_0x4ef1d4]['foreignKey']){_0x3a7064[_0x98db35['joins'][_0x4ef1d4][_0x29f6('0x37')]](_0x98db35[_0x29f6('0x6f')][_0x4ef1d4][_0x29f6('0x83')],null,util['format'](_0x29f6('0x72'),_0x98db35[_0x29f6('0x65')],_0x98db35['joins'][_0x4ef1d4][_0x29f6('0x70')],_0x98db35[_0x29f6('0x6f')][_0x4ef1d4][_0x29f6('0x83')],_0x98db35[_0x29f6('0x6f')][_0x4ef1d4][_0x29f6('0x71')]));}}}if(_0x98db35[_0x29f6('0x74')]){_0x98db35[_0x29f6('0x74')]=JSON[_0x29f6('0x73')](_0x98db35[_0x29f6('0x74')]);_0x3a7064[_0x29f6('0x33')](_0x546e14(_0x98db35['conditions'][_0x29f6('0x5c')]));}_0x3ec8ce=_0x3a7064['clone']();_0x3a7064['limit'](_0x565c20);_0x3a7064['offset'](0x0);logger[_0x29f6('0x76')](_0x29f6('0x84'),_0x3a7064['toString']());return db['sequelize'][_0x29f6('0x2a')](_0x3a7064[_0x29f6('0x77')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})['then'](function(_0x22da5b){if(!_0x22da5b['length']){throw new db[(_0x29f6('0x85'))][(_0x29f6('0x5f'))]('No\x20available\x20data',0xcc);}if(_0x18a470[_0x29f6('0x86')]===_0x29f6('0x87')){return null;}var _0x50f7f2=_[_0x29f6('0x36')](_0x18a470,{'name':_0x18a470[_0x29f6('0x88')]||_0x18a470[_0x29f6('0x23')]||_0x98db35[_0x29f6('0x23')],'basename':_0x276ca5,'savename':util[_0x29f6('0x6b')](_0x29f6('0x89'),_0x18a470[_0x29f6('0x23')]||_0x98db35[_0x29f6('0x23')],require(_0x29f6('0x8a'))[_0x29f6('0x8b')](0x4),_0x18a470[_0x29f6('0x86')]||_0x29f6('0x8c')),'reportId':_0x98db35['id'],'reportType':_0x29f6('0x8d')});return db[_0x29f6('0x8e')]['create'](_0x50f7f2,{'raw':!![]});})[_0x29f6('0x1d')](function(_0x252bab){if(_0x98db35[_0x29f6('0x65')]===_0x29f6('0x8f')){_0x3ec8ce[_0x29f6('0x33')](_0x98db35[_0x29f6('0x65')]+_0x29f6('0x90'),_0x18a470['startDate'],_0x18a470[_0x29f6('0x91')]);}else{_0x3ec8ce['where'](_0x98db35[_0x29f6('0x65')]+_0x29f6('0x92'),_0x18a470[_0x29f6('0x93')],_0x18a470[_0x29f6('0x91')]);}if(_0x252bab){logger[_0x29f6('0x94')](_0x29f6('0x95'),_0x3ec8ce[_0x29f6('0x77')]());require(_0x29f6('0x96'))[_0x29f6('0x97')](path['join'](__dirname,_0x29f6('0x98'),_0x252bab[_0x29f6('0x86')]),[_0x252bab['id'],_0x3ec8ce['toString'](),path['join'](__dirname,_0x29f6('0x99'),_0x252bab[_0x29f6('0x9a')]),_0x276ca5]);return _0x252bab;}else{var _0x217580=squel[_0x29f6('0x63')]();_0x217580['from']('('+_0x3ec8ce[_0x29f6('0x77')]()+')',_0x29f6('0x9b'));_0x217580['field'](_0x29f6('0x9c'),_0x29f6('0x3a'));_0x3ec8ce[_0x29f6('0x18')](_0x18a470[_0x29f6('0x18')]||_0x565c20);_0x3ec8ce[_0x29f6('0x17')](_0x18a470[_0x29f6('0x17')]||0x0);return dbH[_0x29f6('0x78')][_0x29f6('0x2a')](_0x217580[_0x29f6('0x77')](),{'type':dbH[_0x29f6('0x78')][_0x29f6('0x79')][_0x29f6('0x7a')]})[_0x29f6('0x1d')](function(_0x5bda8d){if(!_0x5bda8d[_0x29f6('0x30')]){_0x7056e6=0x0;}else{_0x7056e6=_0x5bda8d[0x0][_0x29f6('0x3a')]||0x0;}return dbH[_0x29f6('0x78')][_0x29f6('0x2a')](_0x3ec8ce['toString'](),{'type':dbH[_0x29f6('0x78')][_0x29f6('0x79')][_0x29f6('0x7a')]});})['then'](function(_0x1b955e){return{'rows':_0x1b955e||[],'count':_0x7056e6};});}});}exports[_0x29f6('0x9d')]=function(_0x4d02ae,_0x377c7e){return runReport(_0x4d02ae[_0x29f6('0x3f')],_0x4d02ae[_0x29f6('0x2a')],_0x4d02ae[_0x29f6('0x39')])[_0x29f6('0x1d')](respondWithResult(_0x377c7e,null))[_0x29f6('0x47')](handleError(_0x377c7e,null));};exports[_0x29f6('0x9e')]=runReport;exports[_0x29f6('0x2a')]=function(_0xcf8b37,_0x303732){var _0x1dfd8a=0xa;var _0x5bc6df=['join',_0x29f6('0x7b'),_0x29f6('0x7c'),_0x29f6('0x4b')];var _0x1f0e72={'SUM':_0x29f6('0x9f'),'COUNT':_0x29f6('0x7d'),'COUNT DISTINCT':_0x29f6('0x4c'),'MAX':_0x29f6('0x4d'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x29f6('0x50'),'GROUP_CONCAT DESC':_0x29f6('0x51')};var _0x30ac42={'SEC_TO_TIME':_0x29f6('0x52'),'DATE':'DATE(%s)','HOUR':_0x29f6('0x54'),'ROUND':_0x29f6('0x55'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ef540=function(_0x5a51c0){return!_[_0x29f6('0x57')]([_0x29f6('0x58'),_0x29f6('0x7f'),_0x29f6('0x80'),'IS\x20NOT\x20EMPTY'],_0x5a51c0);};var _0x15312a=function(_0x47bb32){if(!_0x47bb32||!_0x47bb32[_0x29f6('0x5a')][_0x29f6('0x30')]){return'';}for(var _0x22f2d7='(',_0x82ce51=0x0;_0x82ce51<_0x47bb32[_0x29f6('0x5a')][_0x29f6('0x30')];_0x82ce51+=0x1){_0x82ce51>0x0&&(_0x22f2d7+='\x20'+_0x47bb32['operator']+'\x20');_0x22f2d7+=_0x47bb32['rules'][_0x82ce51][_0x29f6('0x5c')]?_0x15312a(_0x47bb32['rules'][_0x82ce51]['group']):_0x47bb32[_0x29f6('0x5a')][_0x82ce51]['field']+'\x20'+_0x47bb32[_0x29f6('0x5a')][_0x82ce51][_0x29f6('0x5d')]+(_0x1ef540(_0x47bb32[_0x29f6('0x5a')][_0x82ce51][_0x29f6('0x5d')])?'\x20'+_0x47bb32[_0x29f6('0x5a')][_0x82ce51][_0x29f6('0x5e')]:'');}return _0x22f2d7+')';};var _0x4b3a84={'where':{'id':_0xcf8b37[_0x29f6('0x3f')]['id']}},_0x4290af,_0xcf0cdd,_0x3698a9,_0x3b2594,_0xa941e6;_0x4b3a84=_[_0x29f6('0x36')]({},_0x4b3a84,_0xcf8b37[_0x29f6('0x39')]);return db[_0x29f6('0x27')][_0x29f6('0x45')](_0x4b3a84)[_0x29f6('0x1d')](function(_0x578519){if(_0x578519){_0x4290af=_0x578519;return _0x578519[_0x29f6('0x81')]();}return null;})[_0x29f6('0x1d')](function(_0x585d51){if(_0x585d51){if(!_0x585d51[_0x29f6('0x30')]){throw new db[(_0x29f6('0x85'))][(_0x29f6('0x5f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xcf0cdd=_0x585d51;return db['AnalyticMetric'][_0x29f6('0x3d')]({'raw':!![]});}return null;})[_0x29f6('0x1d')](function(_0x289095){if(_0x289095){_0x3698a9=_[_0x29f6('0x62')](_0x289095,'id');var _0x2b6357;var _0x1b0e6d=squel['select']();_0x1b0e6d[_0x29f6('0x64')](_0x4290af[_0x29f6('0x65')]);for(var _0x5e3e19=0x0;_0x5e3e19<_0xcf0cdd['length'];_0x5e3e19+=0x1){_0x2b6357=_0xcf0cdd[_0x5e3e19]['MetricId']?_0x3698a9[_0xcf0cdd[_0x5e3e19][_0x29f6('0x66')]]['metric']:_0xcf0cdd[_0x5e3e19][_0x29f6('0x68')];_0x2b6357=_0xcf0cdd[_0x5e3e19]['function']?_[_0x29f6('0x6a')](_0x1f0e72[_0xcf0cdd[_0x5e3e19][_0x29f6('0x69')]],'%s',_0x2b6357):_0x2b6357;_0x2b6357=_0xcf0cdd[_0x5e3e19][_0x29f6('0x6b')]?_[_0x29f6('0x6a')](_0x30ac42[_0xcf0cdd[_0x5e3e19][_0x29f6('0x6b')]],'%s',_0x2b6357):_0x2b6357;if(_0xcf0cdd[_0x5e3e19]['groupBy']){_0x1b0e6d[_0x29f6('0x5c')](_0x2b6357);}_0xcf0cdd[_0x5e3e19]['orderBy']&&_0x1b0e6d[_0x29f6('0x6c')](_0x2b6357,_0xcf0cdd[_0x5e3e19][_0x29f6('0x6d')]===_0x29f6('0xa0')?![]:!![]);_0x1b0e6d[_0x29f6('0x68')](_0x2b6357,_0xcf0cdd[_0x5e3e19][_0x29f6('0x6e')]||_0x2b6357);}if(_0x4290af[_0x29f6('0x6f')]){_0x4290af[_0x29f6('0x6f')]=JSON[_0x29f6('0x73')](_0x4290af['joins']);for(var _0x116b9c=0x0;_0x116b9c<_0x4290af['joins'][_0x29f6('0x30')];_0x116b9c+=0x1){if(_0x4290af[_0x29f6('0x6f')][_0x116b9c]['type']&&_[_0x29f6('0x57')](_0x5bc6df,_0x4290af['joins'][_0x116b9c][_0x29f6('0x37')])&&_0x4290af[_0x29f6('0x6f')][_0x116b9c]['parentKey']&&_0x4290af[_0x29f6('0x6f')][_0x116b9c][_0x29f6('0x83')]&&_0x4290af['joins'][_0x116b9c][_0x29f6('0x71')]){_0x1b0e6d[_0x4290af[_0x29f6('0x6f')][_0x116b9c][_0x29f6('0x37')]](_0x4290af[_0x29f6('0x6f')][_0x116b9c][_0x29f6('0x83')],null,util[_0x29f6('0x6b')](_0x29f6('0x72'),_0x4290af[_0x29f6('0x65')],_0x4290af['joins'][_0x116b9c][_0x29f6('0x70')],_0x4290af[_0x29f6('0x6f')][_0x116b9c][_0x29f6('0x83')],_0x4290af[_0x29f6('0x6f')][_0x116b9c]['foreignKey']));}}}if(_0x4290af[_0x29f6('0x74')]){_0x4290af[_0x29f6('0x74')]=JSON[_0x29f6('0x73')](_0x4290af[_0x29f6('0x74')]);_0x1b0e6d[_0x29f6('0x33')](_0x15312a(_0x4290af['conditions']['group']));}_0xa941e6=_0x1b0e6d[_0x29f6('0x75')]();_0x1b0e6d[_0x29f6('0x18')](_0x1dfd8a);_0x1b0e6d['offset'](0x0);logger[_0x29f6('0x76')]('Limited\x20Query:',_0x1b0e6d['toString']());return db[_0x29f6('0x78')]['query'](_0x1b0e6d[_0x29f6('0x77')](),{'type':db[_0x29f6('0x78')][_0x29f6('0x79')][_0x29f6('0x7a')]});}})['then'](function(){return{'sql':_0xa941e6[_0x29f6('0x77')]()};})[_0x29f6('0x1d')](respondWithResult(_0x303732,null))[_0x29f6('0x47')](handleError(_0x303732,null));}; \ No newline at end of file +var _0x32c0=['COUNT(*)','run','runReport','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','get','CustomReports','UserProfileResource','then','sendStatus','error','stack','name','send','index','AnalyticCustomReport','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','preview','join','left_join','right_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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','toString','QueryTypes','cross_join','MIN(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','alias','debug','Limited\x20Query:','sequelize','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','savename','countTable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32c0,0x1f3));var _0x032c=function(_0x1d175,_0x460805){_0x1d175=_0x1d175-0x0;var _0x58997c=_0x32c0[_0x1d175];return _0x58997c;};'use strict';var pdf=require(_0x032c('0x0'));var emlformat=require(_0x032c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x032c('0x2'));var jsonpatch=require(_0x032c('0x3'));var rp=require('request-promise');var moment=require(_0x032c('0x4'));var BPromise=require(_0x032c('0x5'));var Mustache=require(_0x032c('0x6'));var util=require(_0x032c('0x7'));var path=require('path');var sox=require(_0x032c('0x8'));var csv=require(_0x032c('0x9'));var ejs=require(_0x032c('0xa'));var fs=require('fs');var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var db=require(_0x032c('0x15'))['db'];var dbH=require('../../mysqldb')[_0x032c('0x16')];function respondWithStatusCode(_0xc88e78,_0x364605){_0x364605=_0x364605||0xcc;return function(_0x40aea5){if(_0x40aea5){return _0xc88e78['sendStatus'](_0x364605);}return _0xc88e78[_0x032c('0x17')](_0x364605)[_0x032c('0x18')]();};}function respondWithResult(_0x1ec9d8,_0x216984){_0x216984=_0x216984||0xc8;return function(_0x3a1863){if(_0x3a1863){return _0x1ec9d8[_0x032c('0x17')](_0x216984)['json'](_0x3a1863);}};}function respondWithFilteredResult(_0xb678d5,_0x15ddb8){return function(_0x3ebda8){if(_0x3ebda8){var _0x3f6f4d=_0x3ebda8[_0x032c('0x19')],_0x3ccbd5=_0x15ddb8[_0x032c('0x1a')],_0x46cbd2=_0x15ddb8[_0x032c('0x1a')]+_0x15ddb8[_0x032c('0x1b')],_0x49c770;if(_0x46cbd2>=_0x3f6f4d){_0x46cbd2=_0x3f6f4d;_0x49c770=0xc8;}else{_0x49c770=0xce;}_0xb678d5[_0x032c('0x17')](_0x49c770);return _0xb678d5[_0x032c('0x1c')](_0x032c('0x1d'),_0x3ccbd5+'-'+_0x46cbd2+'/'+_0x3f6f4d)[_0x032c('0x1e')](_0x3ebda8);}return null;};}function patchUpdates(_0x3a6f71){return function(_0x415419){try{jsonpatch[_0x032c('0x1f')](_0x415419,_0x3a6f71,!![]);}catch(_0x3457a3){return BPromise[_0x032c('0x20')](_0x3457a3);}return _0x415419['save']();};}function saveUpdates(_0x8a8f30,_0x5a33ad){return function(_0x5341e6){if(_0x5341e6){return _0x5341e6['update'](_0x8a8f30)['then'](function(_0x2a24f7){return _0x2a24f7;});}return null;};}function removeEntity(_0x4c0c4b,_0x2ce758){return function(_0x29309b){if(_0x29309b){return _0x29309b[_0x032c('0x21')]()['then'](function(){var _0x135612=_0x29309b[_0x032c('0x22')]({'plain':!![]});var _0x28ae24=_0x032c('0x23');return db[_0x032c('0x24')][_0x032c('0x21')]({'where':{'type':_0x28ae24,'resourceId':_0x135612['id']}})[_0x032c('0x25')](function(){return _0x29309b;});})['then'](function(){_0x4c0c4b[_0x032c('0x17')](0xcc)[_0x032c('0x18')]();});}};}function handleEntityNotFound(_0x1d1cd5,_0x56d20d){return function(_0x1350d1){if(!_0x1350d1){_0x1d1cd5[_0x032c('0x26')](0x194);}return _0x1350d1;};}function handleError(_0x15c368,_0x12e3df){_0x12e3df=_0x12e3df||0x1f4;return function(_0x58de77){logger[_0x032c('0x27')](_0x58de77[_0x032c('0x28')]);if(_0x58de77[_0x032c('0x29')]){delete _0x58de77[_0x032c('0x29')];}_0x15c368['status'](_0x12e3df)[_0x032c('0x2a')](_0x58de77);};}exports[_0x032c('0x2b')]=function(_0x5cdd90,_0x659bbf){var _0x306935={},_0x4508ab={},_0x42730d={'count':0x0,'rows':[]};var _0x5a2297=_['map'](db[_0x032c('0x2c')]['rawAttributes'],function(_0x6f72ba){return{'name':_0x6f72ba[_0x032c('0x2d')],'type':_0x6f72ba['type'][_0x032c('0x2e')]};});_0x4508ab[_0x032c('0x2f')]=_[_0x032c('0x30')](_0x5a2297,_0x032c('0x29'));_0x4508ab['query']=_[_0x032c('0x31')](_0x5cdd90[_0x032c('0x32')]);_0x4508ab['filters']=_[_0x032c('0x33')](_0x4508ab[_0x032c('0x2f')],_0x4508ab[_0x032c('0x32')]);_0x306935[_0x032c('0x34')]=_[_0x032c('0x33')](_0x4508ab['model'],qs[_0x032c('0x35')](_0x5cdd90['query'][_0x032c('0x35')]));_0x306935['attributes']=_0x306935[_0x032c('0x34')][_0x032c('0x36')]?_0x306935[_0x032c('0x34')]:_0x4508ab[_0x032c('0x2f')];if(!_0x5cdd90[_0x032c('0x32')][_0x032c('0x37')]('nolimit')){_0x306935[_0x032c('0x1b')]=qs[_0x032c('0x1b')](_0x5cdd90['query'][_0x032c('0x1b')]);_0x306935[_0x032c('0x1a')]=qs[_0x032c('0x1a')](_0x5cdd90['query'][_0x032c('0x1a')]);}_0x306935[_0x032c('0x38')]=qs[_0x032c('0x39')](_0x5cdd90[_0x032c('0x32')][_0x032c('0x39')]);_0x306935[_0x032c('0x3a')]=qs[_0x032c('0x3b')](_['pick'](_0x5cdd90[_0x032c('0x32')],_0x4508ab[_0x032c('0x3b')]),_0x5a2297);if(_0x5cdd90[_0x032c('0x32')][_0x032c('0x3c')]){_0x306935[_0x032c('0x3a')]=_[_0x032c('0x3d')](_0x306935[_0x032c('0x3a')],{'$or':_[_0x032c('0x30')](_0x5a2297,function(_0x4bba77){if(_0x4bba77[_0x032c('0x3e')]!=='VIRTUAL'){var _0x2c9a1c={};_0x2c9a1c[_0x4bba77['name']]={'$like':'%'+_0x5cdd90['query'][_0x032c('0x3c')]+'%'};return _0x2c9a1c;}})});}_0x306935=_[_0x032c('0x3d')]({},_0x306935,_0x5cdd90['options']);var _0x57bc40={'where':_0x306935[_0x032c('0x3a')]};return db['AnalyticCustomReport']['count'](_0x57bc40)[_0x032c('0x25')](function(_0x6a9676){_0x42730d[_0x032c('0x19')]=_0x6a9676;if(_0x5cdd90[_0x032c('0x32')][_0x032c('0x3f')]){_0x306935[_0x032c('0x40')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x032c('0x41')](_0x306935);})['then'](function(_0x5b3e62){_0x42730d[_0x032c('0x42')]=_0x5b3e62;return _0x42730d;})[_0x032c('0x25')](respondWithFilteredResult(_0x659bbf,_0x306935))[_0x032c('0x43')](handleError(_0x659bbf,null));};exports[_0x032c('0x44')]=function(_0x47360a,_0x4d64eb){var _0x481f1e={'raw':![],'where':{'id':_0x47360a['params']['id']}},_0x1e5dae={};_0x1e5dae[_0x032c('0x2f')]=_[_0x032c('0x31')](db[_0x032c('0x2c')][_0x032c('0x45')]);_0x1e5dae[_0x032c('0x32')]=_[_0x032c('0x31')](_0x47360a[_0x032c('0x32')]);_0x1e5dae[_0x032c('0x3b')]=_[_0x032c('0x33')](_0x1e5dae['model'],_0x1e5dae[_0x032c('0x32')]);_0x481f1e['attributes']=_['intersection'](_0x1e5dae[_0x032c('0x2f')],qs[_0x032c('0x35')](_0x47360a[_0x032c('0x32')][_0x032c('0x35')]));_0x481f1e[_0x032c('0x34')]=_0x481f1e['attributes']['length']?_0x481f1e['attributes']:_0x1e5dae[_0x032c('0x2f')];if(_0x47360a['query'][_0x032c('0x3f')]){_0x481f1e[_0x032c('0x40')]=[{'all':!![]}];}_0x481f1e=_['merge']({},_0x481f1e,_0x47360a[_0x032c('0x46')]);return db[_0x032c('0x2c')][_0x032c('0x47')](_0x481f1e)[_0x032c('0x25')](handleEntityNotFound(_0x4d64eb,null))[_0x032c('0x25')](respondWithResult(_0x4d64eb,null))[_0x032c('0x43')](handleError(_0x4d64eb,null));};exports[_0x032c('0x48')]=function(_0x5daa2b,_0x34b631){return db['AnalyticCustomReport'][_0x032c('0x48')](_0x5daa2b['body'],{})[_0x032c('0x25')](function(_0x13f1a7){var _0x1f6341=_0x5daa2b[_0x032c('0x49')][_0x032c('0x22')]({'plain':!![]});if(!_0x1f6341)throw new Error(_0x032c('0x4a'));if(_0x1f6341[_0x032c('0x4b')]===_0x032c('0x49')){var _0x36581c=_0x13f1a7['get']({'plain':!![]});var _0x3f4fd3='Reports';return db[_0x032c('0x4c')][_0x032c('0x47')]({'where':{'name':_0x3f4fd3,'userProfileId':_0x1f6341['userProfileId']},'raw':!![]})[_0x032c('0x25')](function(_0x754a96){if(_0x754a96&&_0x754a96['autoAssociation']===0x0){return db[_0x032c('0x24')][_0x032c('0x48')]({'name':_0x36581c[_0x032c('0x29')],'resourceId':_0x36581c['id'],'type':'CustomReports','sectionId':_0x754a96['id']},{})[_0x032c('0x25')](function(){return _0x13f1a7;});}else{return _0x13f1a7;}})[_0x032c('0x43')](function(_0x45cc0e){logger[_0x032c('0x27')](_0x032c('0x4d'),_0x45cc0e);throw _0x45cc0e;});}return _0x13f1a7;})[_0x032c('0x25')](respondWithResult(_0x34b631,0xc9))[_0x032c('0x43')](handleError(_0x34b631,null));};exports[_0x032c('0x4e')]=function(_0x3e3001,_0x38fb02){if(_0x3e3001['body']['id']){delete _0x3e3001[_0x032c('0x4f')]['id'];}return db[_0x032c('0x2c')][_0x032c('0x47')]({'where':{'id':_0x3e3001[_0x032c('0x50')]['id']}})[_0x032c('0x25')](handleEntityNotFound(_0x38fb02,null))[_0x032c('0x25')](saveUpdates(_0x3e3001[_0x032c('0x4f')],null))[_0x032c('0x25')](respondWithResult(_0x38fb02,null))['catch'](handleError(_0x38fb02,null));};exports[_0x032c('0x21')]=function(_0x305184,_0x12136b){return db[_0x032c('0x2c')][_0x032c('0x47')]({'where':{'id':_0x305184['params']['id']}})[_0x032c('0x25')](handleEntityNotFound(_0x12136b,null))[_0x032c('0x25')](removeEntity(_0x12136b,null))[_0x032c('0x43')](handleError(_0x12136b,null));};exports[_0x032c('0x51')]=function(_0x41312a,_0xf2e968){var _0x1bff7d=0xa;var _0x350107=[_0x032c('0x52'),_0x032c('0x53'),_0x032c('0x54'),'cross_join'];var _0x4ea4fe={'SUM':_0x032c('0x55'),'COUNT':_0x032c('0x56'),'COUNT DISTINCT':_0x032c('0x57'),'MAX':_0x032c('0x58'),'MIN':'MIN(%s)','AVG':_0x032c('0x59'),'GROUP_CONCAT':_0x032c('0x5a'),'GROUP_CONCAT ASC':_0x032c('0x5b'),'GROUP_CONCAT DESC':_0x032c('0x5c')};var _0xc29446={'SEC_TO_TIME':_0x032c('0x5d'),'DATE':_0x032c('0x5e'),'HOUR':_0x032c('0x5f'),'ROUND':_0x032c('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd71d10=function(_0x1951a0){return!_[_0x032c('0x61')]([_0x032c('0x62'),'IS\x20NOT\x20NULL',_0x032c('0x63'),_0x032c('0x64')],_0x1951a0);};var _0x2b8c32=function(_0x3542aa){if(!_0x3542aa||!_0x3542aa[_0x032c('0x65')]['length']){return'';}for(var _0x190fdc='(',_0xd0d761=0x0;_0xd0d761<_0x3542aa[_0x032c('0x65')][_0x032c('0x36')];_0xd0d761+=0x1){_0xd0d761>0x0&&(_0x190fdc+='\x20'+_0x3542aa[_0x032c('0x66')]+'\x20');_0x190fdc+=_0x3542aa[_0x032c('0x65')][_0xd0d761][_0x032c('0x67')]?_0x2b8c32(_0x3542aa[_0x032c('0x65')][_0xd0d761]['group']):_0x3542aa['rules'][_0xd0d761][_0x032c('0x68')]+'\x20'+_0x3542aa['rules'][_0xd0d761][_0x032c('0x69')]+(_0xd71d10(_0x3542aa['rules'][_0xd0d761][_0x032c('0x69')])?'\x20'+_0x3542aa[_0x032c('0x65')][_0xd0d761][_0x032c('0x6a')]:'');}return _0x190fdc+')';};var _0x200538={'where':{'id':_0x41312a[_0x032c('0x50')]['id']}},_0x260d72,_0x513a42,_0x22aa6c,_0x3c7917,_0x5cfe69;_0x200538=_[_0x032c('0x3d')]({},_0x200538,_0x41312a[_0x032c('0x46')]);return db['AnalyticCustomReport'][_0x032c('0x47')](_0x200538)[_0x032c('0x25')](function(_0x4d6d38){if(_0x4d6d38){_0x260d72=_0x4d6d38;return _0x4d6d38[_0x032c('0x6b')]();}return null;})[_0x032c('0x25')](function(_0x160100){if(_0x160100){if(!_0x160100[_0x032c('0x36')]){throw new db[(_0x032c('0x6c'))][(_0x032c('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x513a42=_0x160100;return db[_0x032c('0x6e')][_0x032c('0x41')]({'raw':!![]});}return null;})[_0x032c('0x25')](function(_0x170bcd){if(_0x170bcd){_0x22aa6c=_[_0x032c('0x6f')](_0x170bcd,'id');var _0x436382;var _0x37cd74=squel[_0x032c('0x70')]();_0x37cd74[_0x032c('0x71')](_0x260d72['table']);for(var _0x470c65=0x0;_0x470c65<_0x513a42[_0x032c('0x36')];_0x470c65+=0x1){_0x436382=_0x513a42[_0x470c65][_0x032c('0x72')]?_0x22aa6c[_0x513a42[_0x470c65][_0x032c('0x72')]][_0x032c('0x73')]:_0x513a42[_0x470c65][_0x032c('0x68')];_0x436382=_0x513a42[_0x470c65][_0x032c('0x74')]?_[_0x032c('0x75')](_0x4ea4fe[_0x513a42[_0x470c65][_0x032c('0x74')]],'%s',_0x436382):_0x436382;_0x436382=_0x513a42[_0x470c65][_0x032c('0x76')]?_[_0x032c('0x75')](_0xc29446[_0x513a42[_0x470c65][_0x032c('0x76')]],'%s',_0x436382):_0x436382;if(_0x513a42[_0x470c65][_0x032c('0x77')]){_0x37cd74[_0x032c('0x67')](_0x436382);}_0x513a42[_0x470c65][_0x032c('0x78')]&&_0x37cd74[_0x032c('0x38')](_0x436382,_0x513a42[_0x470c65][_0x032c('0x78')]===_0x032c('0x79')?![]:!![]);_0x37cd74[_0x032c('0x68')](_0x436382,_0x513a42[_0x470c65]['alias']||_0x436382);}if(_0x260d72['joins']){_0x260d72['joins']=JSON[_0x032c('0x7a')](_0x260d72['joins']);for(var _0x408816=0x0;_0x408816<_0x260d72[_0x032c('0x7b')][_0x032c('0x36')];_0x408816+=0x1){if(_0x260d72['joins'][_0x408816][_0x032c('0x3e')]&&_[_0x032c('0x61')](_0x350107,_0x260d72[_0x032c('0x7b')][_0x408816][_0x032c('0x3e')])&&_0x260d72[_0x032c('0x7b')][_0x408816][_0x032c('0x7c')]&&_0x260d72[_0x032c('0x7b')][_0x408816][_0x032c('0x7d')]&&_0x260d72['joins'][_0x408816][_0x032c('0x7e')]){_0x37cd74[_0x260d72['joins'][_0x408816][_0x032c('0x3e')]](_0x260d72[_0x032c('0x7b')][_0x408816][_0x032c('0x7d')],null,util[_0x032c('0x76')](_0x032c('0x7f'),_0x260d72[_0x032c('0x80')],_0x260d72[_0x032c('0x7b')][_0x408816]['parentKey'],_0x260d72['joins'][_0x408816][_0x032c('0x7d')],_0x260d72[_0x032c('0x7b')][_0x408816]['foreignKey']));}}}if(_0x260d72[_0x032c('0x81')]){_0x260d72[_0x032c('0x81')]=JSON['parse'](_0x260d72[_0x032c('0x81')]);_0x37cd74[_0x032c('0x3a')](_0x2b8c32(_0x260d72['conditions']['group']));}_0x5cfe69=_0x37cd74[_0x032c('0x82')]();_0x37cd74[_0x032c('0x1b')](_0x1bff7d);_0x37cd74[_0x032c('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x37cd74['toString']());return db['sequelize']['query'](_0x37cd74[_0x032c('0x83')](),{'type':db['sequelize'][_0x032c('0x84')]['SELECT']});}})[_0x032c('0x25')](respondWithResult(_0xf2e968,null))[_0x032c('0x43')](handleError(_0xf2e968,null));};function runReport(_0x4fa350,_0x515274,_0x2ce6d4){var _0xf89085=_0x515274[_0x032c('0x29')];var _0x1b9e55=0xa;var _0x5e233e=[_0x032c('0x52'),_0x032c('0x53'),'right_join',_0x032c('0x85')];var _0x927b33={'SUM':_0x032c('0x55'),'COUNT':_0x032c('0x56'),'COUNT DISTINCT':_0x032c('0x57'),'MAX':_0x032c('0x58'),'MIN':_0x032c('0x86'),'AVG':_0x032c('0x59'),'GROUP_CONCAT':_0x032c('0x5a'),'GROUP_CONCAT ASC':_0x032c('0x5b'),'GROUP_CONCAT DESC':_0x032c('0x5c')};var _0x54d770={'SEC_TO_TIME':_0x032c('0x5d'),'DATE':'DATE(%s)','HOUR':_0x032c('0x5f'),'ROUND':_0x032c('0x60'),'UNIX_TIMESTAMP':_0x032c('0x87')};var _0x4c92e0=function(_0xc4c1de){return!_['includes'](['IS\x20NULL',_0x032c('0x88'),_0x032c('0x63'),_0x032c('0x64')],_0xc4c1de);};var _0x3431a1=function(_0x96d99d){if(!_0x96d99d||!_0x96d99d[_0x032c('0x65')][_0x032c('0x36')]){return'';}for(var _0x4033d6='(',_0x512ddf=0x0;_0x512ddf<_0x96d99d[_0x032c('0x65')][_0x032c('0x36')];_0x512ddf+=0x1){_0x512ddf>0x0&&(_0x4033d6+='\x20'+_0x96d99d[_0x032c('0x66')]+'\x20');_0x4033d6+=_0x96d99d[_0x032c('0x65')][_0x512ddf]['group']?_0x3431a1(_0x96d99d[_0x032c('0x65')][_0x512ddf][_0x032c('0x67')]):_0x96d99d[_0x032c('0x65')][_0x512ddf][_0x032c('0x68')]+'\x20'+_0x96d99d[_0x032c('0x65')][_0x512ddf][_0x032c('0x69')]+(_0x4c92e0(_0x96d99d[_0x032c('0x65')][_0x512ddf]['condition'])?'\x20'+_0x96d99d[_0x032c('0x65')][_0x512ddf][_0x032c('0x6a')]:'');}return _0x4033d6+')';};var _0x13fc01={'where':{'id':_0x4fa350['id']}},_0x29b122,_0x220955,_0x442693,_0xe945f6,_0x506460;_0x13fc01=_[_0x032c('0x3d')]({},_0x13fc01,_0x2ce6d4);return db[_0x032c('0x2c')][_0x032c('0x47')](_0x13fc01)[_0x032c('0x25')](function(_0x7391af){if(_0x7391af){_0x29b122=_0x7391af;return _0x7391af['getFields']();}return null;})[_0x032c('0x25')](function(_0x1c21ef){if(_0x1c21ef){if(!_0x1c21ef['length']){throw new db[(_0x032c('0x6c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x220955=_0x1c21ef;return db[_0x032c('0x6e')]['findAll']({'raw':!![]});}return null;})['then'](function(_0xca0b7){if(_0xca0b7){_0x442693=_[_0x032c('0x6f')](_0xca0b7,'id');var _0x4f4f1d;var _0x5baf44=squel[_0x032c('0x70')]();_0x5baf44[_0x032c('0x71')](_0x29b122[_0x032c('0x80')]);for(var _0x595566=0x0;_0x595566<_0x220955[_0x032c('0x36')];_0x595566+=0x1){_0x4f4f1d=_0x220955[_0x595566][_0x032c('0x72')]?_0x442693[_0x220955[_0x595566][_0x032c('0x72')]][_0x032c('0x73')]:_0x220955[_0x595566][_0x032c('0x68')];_0x4f4f1d=_0x220955[_0x595566]['function']?_[_0x032c('0x75')](_0x927b33[_0x220955[_0x595566]['function']],'%s',_0x4f4f1d):_0x4f4f1d;_0x4f4f1d=_0x220955[_0x595566]['format']?_[_0x032c('0x75')](_0x54d770[_0x220955[_0x595566][_0x032c('0x76')]],'%s',_0x4f4f1d):_0x4f4f1d;if(_0x220955[_0x595566][_0x032c('0x77')]){_0x5baf44['group'](_0x4f4f1d);}_0x220955[_0x595566][_0x032c('0x78')]&&_0x5baf44[_0x032c('0x38')](_0x4f4f1d,_0x220955[_0x595566][_0x032c('0x78')]===_0x032c('0x79')?![]:!![]);_0x5baf44[_0x032c('0x68')](_0x4f4f1d,_0x220955[_0x595566][_0x032c('0x89')]||_0x4f4f1d);}if(_0x29b122[_0x032c('0x7b')]){_0x29b122[_0x032c('0x7b')]=JSON[_0x032c('0x7a')](_0x29b122['joins']);for(var _0x25911f=0x0;_0x25911f<_0x29b122[_0x032c('0x7b')][_0x032c('0x36')];_0x25911f+=0x1){if(_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x3e')]&&_[_0x032c('0x61')](_0x5e233e,_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x3e')])&&_0x29b122['joins'][_0x25911f][_0x032c('0x7c')]&&_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x7d')]&&_0x29b122['joins'][_0x25911f][_0x032c('0x7e')]){_0x5baf44[_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x3e')]](_0x29b122['joins'][_0x25911f][_0x032c('0x7d')],null,util[_0x032c('0x76')]('%s.%s\x20=\x20%s.%s',_0x29b122['table'],_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x7c')],_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x7d')],_0x29b122[_0x032c('0x7b')][_0x25911f][_0x032c('0x7e')]));}}}if(_0x29b122[_0x032c('0x81')]){_0x29b122['conditions']=JSON[_0x032c('0x7a')](_0x29b122[_0x032c('0x81')]);_0x5baf44['where'](_0x3431a1(_0x29b122['conditions']['group']));}_0x506460=_0x5baf44['clone']();_0x5baf44[_0x032c('0x1b')](_0x1b9e55);_0x5baf44[_0x032c('0x1a')](0x0);logger[_0x032c('0x8a')](_0x032c('0x8b'),_0x5baf44[_0x032c('0x83')]());return db[_0x032c('0x8c')][_0x032c('0x32')](_0x5baf44[_0x032c('0x83')](),{'type':db['sequelize'][_0x032c('0x84')][_0x032c('0x8d')]});}})['then'](function(_0x510eca){if(!_0x510eca['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x032c('0x8e'),0xcc);}if(_0x515274[_0x032c('0x8f')]===_0x032c('0x90')){return null;}var _0x1974d3=_[_0x032c('0x3d')](_0x515274,{'name':_0x515274[_0x032c('0x91')]||_0x515274['name']||_0x29b122[_0x032c('0x29')],'basename':_0xf89085,'savename':util['format'](_0x032c('0x92'),_0x515274[_0x032c('0x29')]||_0x29b122[_0x032c('0x29')],require(_0x032c('0x93'))[_0x032c('0x94')](0x4),_0x515274[_0x032c('0x8f')]||_0x032c('0x95')),'reportId':_0x29b122['id'],'reportType':'custom'});return db[_0x032c('0x96')][_0x032c('0x48')](_0x1974d3,{'raw':!![]});})[_0x032c('0x25')](function(_0x5efd05){if(_0x29b122['table']==='cdr'){_0x506460[_0x032c('0x3a')](_0x29b122[_0x032c('0x80')]+_0x032c('0x97'),_0x515274[_0x032c('0x98')],_0x515274[_0x032c('0x99')]);}else{_0x506460[_0x032c('0x3a')](_0x29b122['table']+_0x032c('0x9a'),_0x515274[_0x032c('0x98')],_0x515274[_0x032c('0x99')]);}if(_0x5efd05){logger[_0x032c('0x9b')](_0x032c('0x9c'),_0x506460[_0x032c('0x83')]());require('child_process')[_0x032c('0x9d')](path[_0x032c('0x52')](__dirname,_0x032c('0x9e'),_0x5efd05[_0x032c('0x8f')]),[_0x5efd05['id'],_0x506460[_0x032c('0x83')](),path[_0x032c('0x52')](__dirname,'../../files/reports',_0x5efd05[_0x032c('0x9f')]),_0xf89085]);return _0x5efd05;}else{var _0x5da7fc=squel[_0x032c('0x70')]();_0x5da7fc[_0x032c('0x71')]('('+_0x506460[_0x032c('0x83')]()+')',_0x032c('0xa0'));_0x5da7fc[_0x032c('0x68')](_0x032c('0xa1'),_0x032c('0x19'));_0x506460[_0x032c('0x1b')](_0x515274['limit']||_0x1b9e55);_0x506460[_0x032c('0x1a')](_0x515274[_0x032c('0x1a')]||0x0);return dbH[_0x032c('0x8c')][_0x032c('0x32')](_0x5da7fc[_0x032c('0x83')](),{'type':dbH['sequelize'][_0x032c('0x84')]['SELECT']})[_0x032c('0x25')](function(_0x28e28c){if(!_0x28e28c[_0x032c('0x36')]){_0xe945f6=0x0;}else{_0xe945f6=_0x28e28c[0x0]['count']||0x0;}return dbH[_0x032c('0x8c')][_0x032c('0x32')](_0x506460['toString'](),{'type':dbH[_0x032c('0x8c')]['QueryTypes'][_0x032c('0x8d')]});})[_0x032c('0x25')](function(_0x564589){return{'rows':_0x564589||[],'count':_0xe945f6};});}});}exports[_0x032c('0xa2')]=function(_0x477706,_0x1f7394){return runReport(_0x477706[_0x032c('0x50')],_0x477706[_0x032c('0x32')],_0x477706[_0x032c('0x46')])[_0x032c('0x25')](respondWithResult(_0x1f7394,null))[_0x032c('0x43')](handleError(_0x1f7394,null));};exports[_0x032c('0xa3')]=runReport;exports[_0x032c('0x32')]=function(_0x4d64af,_0x2ec8ec){var _0x15fc2c=0xa;var _0x12add0=[_0x032c('0x52'),_0x032c('0x53'),_0x032c('0x54'),_0x032c('0x85')];var _0x122c2c={'SUM':_0x032c('0x55'),'COUNT':_0x032c('0x56'),'COUNT DISTINCT':_0x032c('0x57'),'MAX':_0x032c('0x58'),'MIN':_0x032c('0x86'),'AVG':_0x032c('0x59'),'GROUP_CONCAT':_0x032c('0x5a'),'GROUP_CONCAT ASC':_0x032c('0x5b'),'GROUP_CONCAT DESC':_0x032c('0x5c')};var _0x2ef6a4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x032c('0x5e'),'HOUR':_0x032c('0x5f'),'ROUND':_0x032c('0x60'),'UNIX_TIMESTAMP':_0x032c('0x87')};var _0x4e3e6f=function(_0x11e935){return!_[_0x032c('0x61')]([_0x032c('0x62'),_0x032c('0x88'),_0x032c('0x63'),'IS\x20NOT\x20EMPTY'],_0x11e935);};var _0xe78ab5=function(_0x2eec00){if(!_0x2eec00||!_0x2eec00[_0x032c('0x65')][_0x032c('0x36')]){return'';}for(var _0x6d335c='(',_0x155593=0x0;_0x155593<_0x2eec00[_0x032c('0x65')][_0x032c('0x36')];_0x155593+=0x1){_0x155593>0x0&&(_0x6d335c+='\x20'+_0x2eec00[_0x032c('0x66')]+'\x20');_0x6d335c+=_0x2eec00[_0x032c('0x65')][_0x155593][_0x032c('0x67')]?_0xe78ab5(_0x2eec00['rules'][_0x155593][_0x032c('0x67')]):_0x2eec00[_0x032c('0x65')][_0x155593][_0x032c('0x68')]+'\x20'+_0x2eec00[_0x032c('0x65')][_0x155593][_0x032c('0x69')]+(_0x4e3e6f(_0x2eec00[_0x032c('0x65')][_0x155593][_0x032c('0x69')])?'\x20'+_0x2eec00[_0x032c('0x65')][_0x155593][_0x032c('0x6a')]:'');}return _0x6d335c+')';};var _0x2a998f={'where':{'id':_0x4d64af[_0x032c('0x50')]['id']}},_0x5617e2,_0x9c3c8e,_0x2edc39,_0x3cf15a,_0x18aa24;_0x2a998f=_[_0x032c('0x3d')]({},_0x2a998f,_0x4d64af['options']);return db[_0x032c('0x2c')][_0x032c('0x47')](_0x2a998f)[_0x032c('0x25')](function(_0x2e0b3d){if(_0x2e0b3d){_0x5617e2=_0x2e0b3d;return _0x2e0b3d['getFields']();}return null;})[_0x032c('0x25')](function(_0x38e22d){if(_0x38e22d){if(!_0x38e22d['length']){throw new db[(_0x032c('0x6c'))]['ValidationErrorItem'](_0x032c('0xa4'),0x193);}_0x9c3c8e=_0x38e22d;return db[_0x032c('0x6e')][_0x032c('0x41')]({'raw':!![]});}return null;})[_0x032c('0x25')](function(_0x430bc5){if(_0x430bc5){_0x2edc39=_[_0x032c('0x6f')](_0x430bc5,'id');var _0x5c23f6;var _0x10129f=squel[_0x032c('0x70')]();_0x10129f[_0x032c('0x71')](_0x5617e2['table']);for(var _0x3da605=0x0;_0x3da605<_0x9c3c8e[_0x032c('0x36')];_0x3da605+=0x1){_0x5c23f6=_0x9c3c8e[_0x3da605][_0x032c('0x72')]?_0x2edc39[_0x9c3c8e[_0x3da605]['MetricId']][_0x032c('0x73')]:_0x9c3c8e[_0x3da605][_0x032c('0x68')];_0x5c23f6=_0x9c3c8e[_0x3da605][_0x032c('0x74')]?_[_0x032c('0x75')](_0x122c2c[_0x9c3c8e[_0x3da605][_0x032c('0x74')]],'%s',_0x5c23f6):_0x5c23f6;_0x5c23f6=_0x9c3c8e[_0x3da605][_0x032c('0x76')]?_[_0x032c('0x75')](_0x2ef6a4[_0x9c3c8e[_0x3da605]['format']],'%s',_0x5c23f6):_0x5c23f6;if(_0x9c3c8e[_0x3da605][_0x032c('0x77')]){_0x10129f['group'](_0x5c23f6);}_0x9c3c8e[_0x3da605][_0x032c('0x78')]&&_0x10129f[_0x032c('0x38')](_0x5c23f6,_0x9c3c8e[_0x3da605][_0x032c('0x78')]==='DESC'?![]:!![]);_0x10129f[_0x032c('0x68')](_0x5c23f6,_0x9c3c8e[_0x3da605][_0x032c('0x89')]||_0x5c23f6);}if(_0x5617e2[_0x032c('0x7b')]){_0x5617e2[_0x032c('0x7b')]=JSON[_0x032c('0x7a')](_0x5617e2[_0x032c('0x7b')]);for(var _0x4d6157=0x0;_0x4d6157<_0x5617e2[_0x032c('0x7b')][_0x032c('0x36')];_0x4d6157+=0x1){if(_0x5617e2['joins'][_0x4d6157][_0x032c('0x3e')]&&_['includes'](_0x12add0,_0x5617e2['joins'][_0x4d6157]['type'])&&_0x5617e2['joins'][_0x4d6157]['parentKey']&&_0x5617e2[_0x032c('0x7b')][_0x4d6157]['foreignTable']&&_0x5617e2[_0x032c('0x7b')][_0x4d6157][_0x032c('0x7e')]){_0x10129f[_0x5617e2['joins'][_0x4d6157]['type']](_0x5617e2[_0x032c('0x7b')][_0x4d6157][_0x032c('0x7d')],null,util[_0x032c('0x76')]('%s.%s\x20=\x20%s.%s',_0x5617e2[_0x032c('0x80')],_0x5617e2[_0x032c('0x7b')][_0x4d6157]['parentKey'],_0x5617e2[_0x032c('0x7b')][_0x4d6157][_0x032c('0x7d')],_0x5617e2[_0x032c('0x7b')][_0x4d6157][_0x032c('0x7e')]));}}}if(_0x5617e2[_0x032c('0x81')]){_0x5617e2['conditions']=JSON[_0x032c('0x7a')](_0x5617e2['conditions']);_0x10129f[_0x032c('0x3a')](_0xe78ab5(_0x5617e2[_0x032c('0x81')]['group']));}_0x18aa24=_0x10129f[_0x032c('0x82')]();_0x10129f[_0x032c('0x1b')](_0x15fc2c);_0x10129f[_0x032c('0x1a')](0x0);logger[_0x032c('0x8a')](_0x032c('0x8b'),_0x10129f[_0x032c('0x83')]());return db[_0x032c('0x8c')]['query'](_0x10129f[_0x032c('0x83')](),{'type':db[_0x032c('0x8c')][_0x032c('0x84')][_0x032c('0x8d')]});}})[_0x032c('0x25')](function(){return{'sql':_0x18aa24['toString']()};})[_0x032c('0x25')](respondWithResult(_0x2ec8ec,null))[_0x032c('0x43')](handleError(_0x2ec8ec,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 840f71a..c8c35de 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 _0xa2aa=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','moment','bluebird','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2aa,0xef));var _0xaa2a=function(_0x3dc09e,_0x4e1942){_0x3dc09e=_0x3dc09e-0x0;var _0x124712=_0xa2aa[_0x3dc09e];return _0x124712;};'use strict';var _=require(_0xaa2a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xaa2a('0x1'));var BPromise=require(_0xaa2a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa2a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa2a('0x4'));module[_0xaa2a('0x5')]=function(_0x3b6da8,_0x7e6574){return _0x3b6da8[_0xaa2a('0x6')](_0xaa2a('0x7'),attributes,{'tableName':_0xaa2a('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09fe=['util','../../config/logger','api','bluebird','rimraf','exports','AnalyticCustomReport'];(function(_0x1ab797,_0x38a3f0){var _0x52e635=function(_0x4842e6){while(--_0x4842e6){_0x1ab797['push'](_0x1ab797['shift']());}};_0x52e635(++_0x38a3f0);}(_0x09fe,0x13b));var _0xe09f=function(_0x11c271,_0x3051f3){_0x11c271=_0x11c271-0x0;var _0x549ef2=_0x09fe[_0x11c271];return _0x549ef2;};'use strict';var _=require('lodash');var util=require(_0xe09f('0x0'));var logger=require(_0xe09f('0x1'))(_0xe09f('0x2'));var moment=require('moment');var BPromise=require(_0xe09f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe09f('0x4'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xe09f('0x5')]=function(_0x1f7934,_0x3d04e7){return _0x1f7934['define'](_0xe09f('0x6'),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 b9b79b8..7376067 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 _0x6fc1=['client','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x6fc1,0x118));var _0x16fc=function(_0x1453ac,_0x527326){_0x1453ac=_0x1453ac-0x0;var _0xc6427a=_0x6fc1[_0x1453ac];return _0xc6427a;};'use strict';var _=require(_0x16fc('0x0'));var util=require(_0x16fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16fc('0x2'));var fs=require('fs');var Redis=require(_0x16fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16fc('0x4'))(_0x16fc('0x5'));var config=require(_0x16fc('0x6'));var jayson=require(_0x16fc('0x7'));var client=jayson[_0x16fc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21c0fd,_0x22cebb,_0xc734ec){return new BPromise(function(_0x30cf26,_0x318d92){return client[_0x16fc('0x9')](_0x21c0fd,_0xc734ec)[_0x16fc('0xa')](function(_0x1665ca){logger['info'](_0x16fc('0xb'),_0x22cebb,_0x16fc('0xc'));logger['debug'](_0x16fc('0xd'),_0x22cebb,_0x16fc('0xc'),JSON[_0x16fc('0xe')](_0x1665ca));if(_0x1665ca[_0x16fc('0xf')]){if(_0x1665ca['error']['code']===0x1f4){logger[_0x16fc('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x22cebb,_0x1665ca[_0x16fc('0xf')]['message']);return _0x318d92(_0x1665ca['error'][_0x16fc('0x10')]);}logger[_0x16fc('0xf')](_0x16fc('0xb'),_0x22cebb,_0x1665ca[_0x16fc('0xf')][_0x16fc('0x10')]);return _0x30cf26(_0x1665ca[_0x16fc('0xf')][_0x16fc('0x10')]);}else{logger['info'](_0x16fc('0xb'),_0x22cebb,_0x16fc('0xc'));_0x30cf26(_0x1665ca['result'][_0x16fc('0x10')]);}})[_0x16fc('0x11')](function(_0x48fd90){logger[_0x16fc('0xf')](_0x16fc('0xb'),_0x22cebb,_0x48fd90);_0x318d92(_0x48fd90);});});} \ No newline at end of file +var _0xc09b=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc09b,0x1aa));var _0xbc09=function(_0x388d68,_0x24cf7f){_0x388d68=_0x388d68-0x0;var _0xcdaef2=_0xc09b[_0x388d68];return _0xcdaef2;};'use strict';var _=require(_0xbc09('0x0'));var util=require(_0xbc09('0x1'));var moment=require('moment');var BPromise=require(_0xbc09('0x2'));var rs=require(_0xbc09('0x3'));var fs=require('fs');var Redis=require(_0xbc09('0x4'));var db=require(_0xbc09('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbc09('0x6'));var config=require(_0xbc09('0x7'));var jayson=require(_0xbc09('0x8'));var client=jayson[_0xbc09('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa165,_0x1a4a9d,_0x4743bf){return new BPromise(function(_0x4b7dc3,_0x55a87e){return client[_0xbc09('0xa')](_0x5aa165,_0x4743bf)[_0xbc09('0xb')](function(_0x2ab099){logger[_0xbc09('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1a4a9d,_0xbc09('0xd'));logger[_0xbc09('0xe')](_0xbc09('0xf'),_0x1a4a9d,_0xbc09('0xd'),JSON[_0xbc09('0x10')](_0x2ab099));if(_0x2ab099[_0xbc09('0x11')]){if(_0x2ab099[_0xbc09('0x11')][_0xbc09('0x12')]===0x1f4){logger[_0xbc09('0x11')](_0xbc09('0x13'),_0x1a4a9d,_0x2ab099[_0xbc09('0x11')][_0xbc09('0x14')]);return _0x55a87e(_0x2ab099[_0xbc09('0x11')][_0xbc09('0x14')]);}logger['error'](_0xbc09('0x13'),_0x1a4a9d,_0x2ab099[_0xbc09('0x11')]['message']);return _0x4b7dc3(_0x2ab099['error'][_0xbc09('0x14')]);}else{logger[_0xbc09('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1a4a9d,_0xbc09('0xd'));_0x4b7dc3(_0x2ab099[_0xbc09('0x15')][_0xbc09('0x14')]);}})['catch'](function(_0x6e35cf){logger[_0xbc09('0x11')](_0xbc09('0x13'),_0x1a4a9d,_0x6e35cf);_0x55a87e(_0x6e35cf);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index baa8b0d..74eeed0 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 _0xdb62=['post','create','put','update','delete','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x3142fb,_0x5369cb){var _0x402061=function(_0x67fecc){while(--_0x67fecc){_0x3142fb['push'](_0x3142fb['shift']());}};_0x402061(++_0x5369cb);}(_0xdb62,0x103));var _0x2db6=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xdb62[_0x31991b];return _0x307304;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2db6('0x0'));var timeout=require('connect-timeout');var express=require(_0x2db6('0x1'));var router=express['Router']();var auth=require(_0x2db6('0x2'));var interaction=require(_0x2db6('0x3'));var config=require(_0x2db6('0x4'));var controller=require(_0x2db6('0x5'));router[_0x2db6('0x6')]('/',auth[_0x2db6('0x7')](),controller[_0x2db6('0x8')]);router[_0x2db6('0x6')](_0x2db6('0x9'),auth[_0x2db6('0x7')](),controller[_0x2db6('0xa')]);router[_0x2db6('0x6')](_0x2db6('0xb'),auth[_0x2db6('0x7')](),controller[_0x2db6('0xc')]);router[_0x2db6('0x6')](_0x2db6('0xd'),auth[_0x2db6('0x7')](),controller[_0x2db6('0xe')]);router[_0x2db6('0x6')](_0x2db6('0xf'),auth['isAuthenticated'](),controller[_0x2db6('0x10')]);router[_0x2db6('0x11')]('/',auth[_0x2db6('0x7')](),controller[_0x2db6('0x12')]);router[_0x2db6('0x13')](_0x2db6('0x9'),auth[_0x2db6('0x7')](),controller[_0x2db6('0x14')]);router[_0x2db6('0x15')](_0x2db6('0x9'),auth[_0x2db6('0x7')](),controller['destroy']);module[_0x2db6('0x16')]=router; \ No newline at end of file +var _0x4b9c=['util','express','Router','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5bf4fa,_0xc0399f){var _0x519465=function(_0x57f937){while(--_0x57f937){_0x5bf4fa['push'](_0x5bf4fa['shift']());}};_0x519465(++_0xc0399f);}(_0x4b9c,0x1b8));var _0xc4b9=function(_0x1b095d,_0x165325){_0x1b095d=_0x1b095d-0x0;var _0x3b3480=_0x4b9c[_0x1b095d];return _0x3b3480;};'use strict';var multer=require(_0xc4b9('0x0'));var util=require(_0xc4b9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4b9('0x2'));var router=express[_0xc4b9('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc4b9('0x4'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xc4b9('0x5')](),controller[_0xc4b9('0x6')]);router[_0xc4b9('0x7')](_0xc4b9('0x8'),auth[_0xc4b9('0x5')](),controller[_0xc4b9('0x9')]);router[_0xc4b9('0x7')]('/:id/preview',auth[_0xc4b9('0x5')](),controller['preview']);router[_0xc4b9('0x7')](_0xc4b9('0xa'),auth['isAuthenticated'](),controller[_0xc4b9('0xb')]);router[_0xc4b9('0x7')](_0xc4b9('0xc'),auth[_0xc4b9('0x5')](),controller[_0xc4b9('0xd')]);router[_0xc4b9('0xe')]('/',auth[_0xc4b9('0x5')](),controller[_0xc4b9('0xf')]);router[_0xc4b9('0x10')](_0xc4b9('0x8'),auth['isAuthenticated'](),controller[_0xc4b9('0x11')]);router[_0xc4b9('0x12')](_0xc4b9('0x8'),auth[_0xc4b9('0x5')](),controller[_0xc4b9('0x13')]);module[_0xc4b9('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 b2ed91c..b1d14b2 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 _0xe292=['STRING','TEXT','sequelize','exports'];(function(_0x4fd89d,_0xdc4524){var _0x5f3b98=function(_0x513788){while(--_0x513788){_0x4fd89d['push'](_0x4fd89d['shift']());}};_0x5f3b98(++_0xdc4524);}(_0xe292,0x152));var _0x2e29=function(_0x5212b1,_0x5a4f2d){_0x5212b1=_0x5212b1-0x0;var _0x11f69f=_0xe292[_0x5212b1];return _0x11f69f;};'use strict';var Sequelize=require(_0x2e29('0x0'));module[_0x2e29('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2e29('0x2')]},'parent':{'type':Sequelize[_0x2e29('0x2')]},'table':{'type':Sequelize[_0x2e29('0x2')]},'conditions':{'type':Sequelize[_0x2e29('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb477=['STRING','TEXT'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb477,0x138));var _0x7b47=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb477[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b47('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x7b47('0x0')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7b47('0x0')]},'conditions':{'type':Sequelize[_0x7b47('0x1')]},'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 2761b59..0a732f0 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 _0x60bf=['Limited\x20Query:','toString','sequelize','QueryTypes','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','debug','output','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','MIN(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','fields','create','user','Reports','find','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','group','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x60bf,0x165));var _0xf60b=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x60bf[_0x173441];return _0x2423a8;};'use strict';var pdf=require(_0xf60b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf60b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf60b('0x2'));var rp=require(_0xf60b('0x3'));var moment=require(_0xf60b('0x4'));var BPromise=require(_0xf60b('0x5'));var Mustache=require(_0xf60b('0x6'));var util=require(_0xf60b('0x7'));var path=require(_0xf60b('0x8'));var sox=require('sox');var csv=require(_0xf60b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf60b('0xa'));var squel=require(_0xf60b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf60b('0xc'));var deskjs=require(_0xf60b('0xd'));var toCsv=require(_0xf60b('0x9'));var querystring=require(_0xf60b('0xe'));var Papa=require(_0xf60b('0xf'));var Redis=require('ioredis');var authService=require(_0xf60b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf60b('0x11'));var hardwareService=require(_0xf60b('0x12'));var logger=require(_0xf60b('0x13'))(_0xf60b('0x14'));var utils=require('../../config/utils');var config=require(_0xf60b('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf60b('0x16'))[_0xf60b('0x17')];function respondWithStatusCode(_0x147a93,_0x34698b){_0x34698b=_0x34698b||0xcc;return function(_0x2a276c){if(_0x2a276c){return _0x147a93[_0xf60b('0x18')](_0x34698b);}return _0x147a93[_0xf60b('0x19')](_0x34698b)[_0xf60b('0x1a')]();};}function respondWithResult(_0x1b7aeb,_0x2af102){_0x2af102=_0x2af102||0xc8;return function(_0x337909){if(_0x337909){return _0x1b7aeb['status'](_0x2af102)[_0xf60b('0x1b')](_0x337909);}};}function respondWithFilteredResult(_0x14dcf7,_0x4a8cef){return function(_0x2e7f22){if(_0x2e7f22){var _0x3d1f09=_0x2e7f22[_0xf60b('0x1c')],_0x4c4933=_0x4a8cef[_0xf60b('0x1d')],_0x560c85=_0x4a8cef[_0xf60b('0x1d')]+_0x4a8cef[_0xf60b('0x1e')],_0x5c8e5a;if(_0x560c85>=_0x3d1f09){_0x560c85=_0x3d1f09;_0x5c8e5a=0xc8;}else{_0x5c8e5a=0xce;}_0x14dcf7[_0xf60b('0x19')](_0x5c8e5a);return _0x14dcf7[_0xf60b('0x1f')]('Content-Range',_0x4c4933+'-'+_0x560c85+'/'+_0x3d1f09)[_0xf60b('0x1b')](_0x2e7f22);}return null;};}function patchUpdates(_0x4fede1){return function(_0x15e890){try{jsonpatch[_0xf60b('0x20')](_0x15e890,_0x4fede1,!![]);}catch(_0x3e5793){return BPromise[_0xf60b('0x21')](_0x3e5793);}return _0x15e890[_0xf60b('0x22')]();};}function saveUpdates(_0x3af5b9,_0x1d30ff){return function(_0x4be0b1){if(_0x4be0b1){return _0x4be0b1[_0xf60b('0x23')](_0x3af5b9)[_0xf60b('0x24')](function(_0x122c04){return _0x122c04;});}return null;};}function removeEntity(_0x17dc7e,_0x1cf454){return function(_0x9bdba5){if(_0x9bdba5){return _0x9bdba5['destroy']()['then'](function(){var _0xa162cd=_0x9bdba5[_0xf60b('0x25')]({'plain':!![]});var _0x34aec7='DefaultReports';return db[_0xf60b('0x26')][_0xf60b('0x27')]({'where':{'type':_0x34aec7,'resourceId':_0xa162cd['id']}})[_0xf60b('0x24')](function(){return _0x9bdba5;});})[_0xf60b('0x24')](function(){_0x17dc7e[_0xf60b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b070d,_0x5baef8){return function(_0x1b72e5){if(!_0x1b72e5){_0x5b070d[_0xf60b('0x18')](0x194);}return _0x1b72e5;};}function handleError(_0x1d5ebc,_0x314725){_0x314725=_0x314725||0x1f4;return function(_0x2aec77){logger[_0xf60b('0x28')](_0x2aec77[_0xf60b('0x29')]);if(_0x2aec77[_0xf60b('0x2a')]){delete _0x2aec77[_0xf60b('0x2a')];}_0x1d5ebc[_0xf60b('0x19')](_0x314725)[_0xf60b('0x2b')](_0x2aec77);};}exports[_0xf60b('0x2c')]=function(_0x7285ce,_0x300a53){var _0xeccb29={},_0x71f183={},_0x5e1e8d={'count':0x0,'rows':[]};var _0x504194=_[_0xf60b('0x2d')](db[_0xf60b('0x2e')]['rawAttributes'],function(_0x410bb7){return{'name':_0x410bb7[_0xf60b('0x2f')],'type':_0x410bb7['type'][_0xf60b('0x30')]};});_0x71f183[_0xf60b('0x31')]=_[_0xf60b('0x2d')](_0x504194,_0xf60b('0x2a'));_0x71f183[_0xf60b('0x32')]=_[_0xf60b('0x33')](_0x7285ce[_0xf60b('0x32')]);_0x71f183[_0xf60b('0x34')]=_[_0xf60b('0x35')](_0x71f183[_0xf60b('0x31')],_0x71f183[_0xf60b('0x32')]);_0xeccb29[_0xf60b('0x36')]=_[_0xf60b('0x35')](_0x71f183[_0xf60b('0x31')],qs['fields'](_0x7285ce['query']['fields']));_0xeccb29[_0xf60b('0x36')]=_0xeccb29[_0xf60b('0x36')][_0xf60b('0x37')]?_0xeccb29['attributes']:_0x71f183[_0xf60b('0x31')];if(!_0x7285ce[_0xf60b('0x32')][_0xf60b('0x38')](_0xf60b('0x39'))){_0xeccb29['limit']=qs[_0xf60b('0x1e')](_0x7285ce[_0xf60b('0x32')]['limit']);_0xeccb29[_0xf60b('0x1d')]=qs[_0xf60b('0x1d')](_0x7285ce[_0xf60b('0x32')][_0xf60b('0x1d')]);}_0xeccb29['order']=qs[_0xf60b('0x3a')](_0x7285ce['query'][_0xf60b('0x3a')]);_0xeccb29[_0xf60b('0x3b')]=qs[_0xf60b('0x34')](_[_0xf60b('0x3c')](_0x7285ce[_0xf60b('0x32')],_0x71f183[_0xf60b('0x34')]),_0x504194);if(_0x7285ce['query'][_0xf60b('0x3d')]){_0xeccb29['where']=_[_0xf60b('0x3e')](_0xeccb29[_0xf60b('0x3b')],{'$or':_[_0xf60b('0x2d')](_0x504194,function(_0x24bd31){if(_0x24bd31[_0xf60b('0x3f')]!==_0xf60b('0x40')){var _0x54e9a4={};_0x54e9a4[_0x24bd31[_0xf60b('0x2a')]]={'$like':'%'+_0x7285ce[_0xf60b('0x32')]['filter']+'%'};return _0x54e9a4;}})});}_0xeccb29=_['merge']({},_0xeccb29,_0x7285ce[_0xf60b('0x41')]);var _0x2fda88={'where':_0xeccb29[_0xf60b('0x3b')]};return db[_0xf60b('0x2e')]['count'](_0x2fda88)[_0xf60b('0x24')](function(_0x541384){_0x5e1e8d[_0xf60b('0x1c')]=_0x541384;if(_0x7285ce[_0xf60b('0x32')][_0xf60b('0x42')]){_0xeccb29['include']=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0xeccb29);})[_0xf60b('0x24')](function(_0x5d0fba){_0x5e1e8d[_0xf60b('0x43')]=_0x5d0fba;return _0x5e1e8d;})['then'](respondWithFilteredResult(_0x300a53,_0xeccb29))[_0xf60b('0x44')](handleError(_0x300a53,null));};exports['show']=function(_0x43f989,_0x569814){var _0x1e3d42={'raw':!![],'where':{'id':_0x43f989[_0xf60b('0x45')]['id']}},_0x4310da={};_0x4310da[_0xf60b('0x31')]=_[_0xf60b('0x33')](db[_0xf60b('0x2e')][_0xf60b('0x46')]);_0x4310da[_0xf60b('0x32')]=_[_0xf60b('0x33')](_0x43f989[_0xf60b('0x32')]);_0x4310da[_0xf60b('0x34')]=_[_0xf60b('0x35')](_0x4310da['model'],_0x4310da['query']);_0x1e3d42[_0xf60b('0x36')]=_['intersection'](_0x4310da[_0xf60b('0x31')],qs[_0xf60b('0x47')](_0x43f989[_0xf60b('0x32')][_0xf60b('0x47')]));_0x1e3d42['attributes']=_0x1e3d42[_0xf60b('0x36')][_0xf60b('0x37')]?_0x1e3d42[_0xf60b('0x36')]:_0x4310da['model'];if(_0x43f989[_0xf60b('0x32')][_0xf60b('0x42')]){_0x1e3d42['include']=[{'all':!![]}];}_0x1e3d42=_[_0xf60b('0x3e')]({},_0x1e3d42,_0x43f989[_0xf60b('0x41')]);return db['AnalyticDefaultReport']['find'](_0x1e3d42)[_0xf60b('0x24')](handleEntityNotFound(_0x569814,null))[_0xf60b('0x24')](respondWithResult(_0x569814,null))[_0xf60b('0x44')](handleError(_0x569814,null));};exports[_0xf60b('0x48')]=function(_0x348f71,_0x3e8f88){return db[_0xf60b('0x2e')]['create'](_0x348f71['body'],{})['then'](function(_0xaa3012){var _0x19beae=_0x348f71[_0xf60b('0x49')][_0xf60b('0x25')]({'plain':!![]});if(!_0x19beae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19beae['role']===_0xf60b('0x49')){var _0x2fa53a=_0xaa3012[_0xf60b('0x25')]({'plain':!![]});var _0x3d5a1e=_0xf60b('0x4a');return db['UserProfileSection'][_0xf60b('0x4b')]({'where':{'name':_0x3d5a1e,'userProfileId':_0x19beae['userProfileId']},'raw':!![]})[_0xf60b('0x24')](function(_0x3f7657){if(_0x3f7657&&_0x3f7657[_0xf60b('0x4c')]===0x0){return db[_0xf60b('0x26')][_0xf60b('0x48')]({'name':_0x2fa53a[_0xf60b('0x2a')],'resourceId':_0x2fa53a['id'],'type':_0xf60b('0x4d'),'sectionId':_0x3f7657['id']},{})['then'](function(){return _0xaa3012;});}else{return _0xaa3012;}})[_0xf60b('0x44')](function(_0x2b60dc){logger[_0xf60b('0x28')](_0xf60b('0x4e'),_0x2b60dc);throw _0x2b60dc;});}return _0xaa3012;})[_0xf60b('0x24')](respondWithResult(_0x3e8f88,0xc9))['catch'](handleError(_0x3e8f88,null));};exports['update']=function(_0xd4e6de,_0x3d40f6){if(_0xd4e6de[_0xf60b('0x4f')]['id']){delete _0xd4e6de[_0xf60b('0x4f')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0xd4e6de['params']['id']}})['then'](handleEntityNotFound(_0x3d40f6,null))['then'](saveUpdates(_0xd4e6de['body'],null))[_0xf60b('0x24')](respondWithResult(_0x3d40f6,null))[_0xf60b('0x44')](handleError(_0x3d40f6,null));};exports[_0xf60b('0x27')]=function(_0x30009a,_0x1279e5){return db[_0xf60b('0x2e')][_0xf60b('0x4b')]({'where':{'id':_0x30009a[_0xf60b('0x45')]['id']}})[_0xf60b('0x24')](handleEntityNotFound(_0x1279e5,null))[_0xf60b('0x24')](removeEntity(_0x1279e5,null))[_0xf60b('0x44')](handleError(_0x1279e5,null));};exports[_0xf60b('0x50')]=function(_0x20fee5,_0x587bf0){var _0x16bc0f=0xa;var _0x4aa885=[_0xf60b('0x51'),_0xf60b('0x52'),_0xf60b('0x53'),_0xf60b('0x54')];var _0x74ef73={'SUM':_0xf60b('0x55'),'COUNT':_0xf60b('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf60b('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xf60b('0x58'),'GROUP_CONCAT ASC':_0xf60b('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3521e0={'SEC_TO_TIME':_0xf60b('0x5a'),'DATE':_0xf60b('0x5b'),'HOUR':_0xf60b('0x5c'),'ROUND':_0xf60b('0x5d'),'UNIX_TIMESTAMP':_0xf60b('0x5e')};var _0x108d06=function(_0x376ed2){return!_[_0xf60b('0x5f')]([_0xf60b('0x60'),_0xf60b('0x61'),_0xf60b('0x62'),_0xf60b('0x63')],_0x376ed2);};var _0x181653=function(_0x114034){if(!_0x114034||!_0x114034['rules']['length']){return'';}for(var _0xbfe5f4='(',_0x5c405b=0x0;_0x5c405b<_0x114034[_0xf60b('0x64')]['length'];_0x5c405b+=0x1){_0x5c405b>0x0&&(_0xbfe5f4+='\x20'+_0x114034[_0xf60b('0x65')]+'\x20');_0xbfe5f4+=_0x114034['rules'][_0x5c405b]['group']?_0x181653(_0x114034[_0xf60b('0x64')][_0x5c405b]['group']):_0x114034[_0xf60b('0x64')][_0x5c405b][_0xf60b('0x66')]+'\x20'+_0x114034['rules'][_0x5c405b][_0xf60b('0x67')]+(_0x108d06(_0x114034['rules'][_0x5c405b][_0xf60b('0x67')])?'\x20'+_0x114034[_0xf60b('0x64')][_0x5c405b][_0xf60b('0x68')]:'');}return _0xbfe5f4+')';};var _0x182569={'where':{'id':_0x20fee5['params']['id']}},_0x570e0c,_0x419b6f,_0x128fef,_0x39d2a7,_0x13b3c3;_0x182569=_[_0xf60b('0x3e')]({},_0x182569,_0x20fee5[_0xf60b('0x41')]);return db[_0xf60b('0x2e')][_0xf60b('0x4b')](_0x182569)[_0xf60b('0x24')](function(_0x506a34){if(_0x506a34){_0x570e0c=_0x506a34;return _0x506a34['getFields']();}return null;})[_0xf60b('0x24')](function(_0x44a98c){if(_0x44a98c){if(!_0x44a98c[_0xf60b('0x37')]){throw new db[(_0xf60b('0x69'))][(_0xf60b('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x419b6f=_0x44a98c;return db[_0xf60b('0x6b')][_0xf60b('0x6c')]({'raw':!![]});}return null;})[_0xf60b('0x24')](function(_0x355fd8){if(_0x355fd8){_0x128fef=_[_0xf60b('0x6d')](_0x355fd8,'id');var _0x18ca08;var _0x55e418=squel[_0xf60b('0x6e')]();_0x55e418[_0xf60b('0x6f')](_0x570e0c[_0xf60b('0x70')]);for(var _0x3b861a=0x0;_0x3b861a<_0x419b6f[_0xf60b('0x37')];_0x3b861a+=0x1){_0x18ca08=_0x419b6f[_0x3b861a][_0xf60b('0x71')]?_0x128fef[_0x419b6f[_0x3b861a][_0xf60b('0x71')]][_0xf60b('0x72')]:_0x419b6f[_0x3b861a][_0xf60b('0x66')];_0x18ca08=_0x419b6f[_0x3b861a][_0xf60b('0x73')]?_[_0xf60b('0x74')](_0x74ef73[_0x419b6f[_0x3b861a][_0xf60b('0x73')]],'%s',_0x18ca08):_0x18ca08;_0x18ca08=_0x419b6f[_0x3b861a][_0xf60b('0x75')]?_[_0xf60b('0x74')](_0x3521e0[_0x419b6f[_0x3b861a][_0xf60b('0x75')]],'%s',_0x18ca08):_0x18ca08;if(_0x419b6f[_0x3b861a][_0xf60b('0x76')]){_0x55e418[_0xf60b('0x77')](_0x18ca08);}_0x419b6f[_0x3b861a][_0xf60b('0x78')]&&_0x55e418[_0xf60b('0x79')](_0x18ca08,_0x419b6f[_0x3b861a][_0xf60b('0x78')]===_0xf60b('0x7a')?![]:!![]);_0x55e418[_0xf60b('0x66')](_0x18ca08,_0x419b6f[_0x3b861a][_0xf60b('0x7b')]||_0x18ca08);}if(_0x570e0c[_0xf60b('0x7c')]){_0x570e0c[_0xf60b('0x7c')]=JSON[_0xf60b('0x7d')](_0x570e0c[_0xf60b('0x7c')]);for(var _0x4a6dcd=0x0;_0x4a6dcd<_0x570e0c[_0xf60b('0x7c')][_0xf60b('0x37')];_0x4a6dcd+=0x1){if(_0x570e0c['joins'][_0x4a6dcd][_0xf60b('0x3f')]&&_['includes'](_0x4aa885,_0x570e0c[_0xf60b('0x7c')][_0x4a6dcd][_0xf60b('0x3f')])&&_0x570e0c['joins'][_0x4a6dcd][_0xf60b('0x7e')]&&_0x570e0c[_0xf60b('0x7c')][_0x4a6dcd][_0xf60b('0x7f')]&&_0x570e0c[_0xf60b('0x7c')][_0x4a6dcd]['foreignKey']){_0x55e418[_0x570e0c[_0xf60b('0x7c')][_0x4a6dcd][_0xf60b('0x3f')]](_0x570e0c[_0xf60b('0x7c')][_0x4a6dcd][_0xf60b('0x7f')],null,util['format'](_0xf60b('0x80'),_0x570e0c[_0xf60b('0x70')],_0x570e0c['joins'][_0x4a6dcd][_0xf60b('0x7e')],_0x570e0c['joins'][_0x4a6dcd][_0xf60b('0x7f')],_0x570e0c[_0xf60b('0x7c')][_0x4a6dcd][_0xf60b('0x81')]));}}}if(_0x570e0c[_0xf60b('0x82')]){_0x570e0c['conditions']=JSON[_0xf60b('0x7d')](_0x570e0c[_0xf60b('0x82')]);_0x55e418[_0xf60b('0x3b')](_0x181653(_0x570e0c['conditions'][_0xf60b('0x77')]));}_0x13b3c3=_0x55e418[_0xf60b('0x83')]();_0x55e418['limit'](_0x16bc0f);_0x55e418[_0xf60b('0x1d')](0x0);logger['debug'](_0xf60b('0x84'),_0x55e418[_0xf60b('0x85')]());return db[_0xf60b('0x86')][_0xf60b('0x32')](_0x55e418['toString'](),{'type':db[_0xf60b('0x86')][_0xf60b('0x87')]['SELECT']});}})[_0xf60b('0x24')](respondWithResult(_0x587bf0,null))[_0xf60b('0x44')](handleError(_0x587bf0,null));};function runReport(_0x3c9d65,_0x4385cf,_0x1d8815){var _0xfdf827=_0x4385cf[_0xf60b('0x2a')];var _0x13365f=0xa;var _0x1c994d=[_0xf60b('0x51'),_0xf60b('0x52'),_0xf60b('0x53'),'cross_join'];var _0x570dd5={'SUM':_0xf60b('0x55'),'COUNT':_0xf60b('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf60b('0x57'),'MIN':'MIN(%s)','AVG':_0xf60b('0x88'),'GROUP_CONCAT':_0xf60b('0x58'),'GROUP_CONCAT ASC':_0xf60b('0x59'),'GROUP_CONCAT DESC':_0xf60b('0x89')};var _0x3614d5={'SEC_TO_TIME':_0xf60b('0x5a'),'DATE':_0xf60b('0x5b'),'HOUR':_0xf60b('0x5c'),'ROUND':_0xf60b('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x40ff39=function(_0x326b0d){return!_[_0xf60b('0x5f')]([_0xf60b('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xf60b('0x63')],_0x326b0d);};var _0x106538=function(_0x53412b){if(!_0x53412b||!_0x53412b[_0xf60b('0x64')][_0xf60b('0x37')]){return'';}for(var _0x1c5ebb='(',_0xfe61e7=0x0;_0xfe61e7<_0x53412b[_0xf60b('0x64')][_0xf60b('0x37')];_0xfe61e7+=0x1){_0xfe61e7>0x0&&(_0x1c5ebb+='\x20'+_0x53412b[_0xf60b('0x65')]+'\x20');_0x1c5ebb+=_0x53412b[_0xf60b('0x64')][_0xfe61e7]['group']?_0x106538(_0x53412b[_0xf60b('0x64')][_0xfe61e7][_0xf60b('0x77')]):_0x53412b[_0xf60b('0x64')][_0xfe61e7][_0xf60b('0x66')]+'\x20'+_0x53412b[_0xf60b('0x64')][_0xfe61e7]['condition']+(_0x40ff39(_0x53412b[_0xf60b('0x64')][_0xfe61e7][_0xf60b('0x67')])?'\x20'+_0x53412b['rules'][_0xfe61e7]['value']:'');}return _0x1c5ebb+')';};var _0x2b4cfa={'where':{'id':_0x3c9d65['id']}},_0x412253,_0x1de59e,_0x21f00b,_0x13bb75,_0x7c30c1;_0x2b4cfa=_[_0xf60b('0x3e')]({},_0x2b4cfa,_0x1d8815);return db['AnalyticDefaultReport']['find'](_0x2b4cfa)[_0xf60b('0x24')](function(_0x115a5c){if(_0x115a5c){_0x412253=_0x115a5c;return _0x115a5c['getFields']();}return null;})[_0xf60b('0x24')](function(_0x1a9e90){if(_0x1a9e90){if(!_0x1a9e90[_0xf60b('0x37')]){throw new db[(_0xf60b('0x69'))][(_0xf60b('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1de59e=_0x1a9e90;return db[_0xf60b('0x6b')][_0xf60b('0x6c')]({'raw':!![]});}return null;})[_0xf60b('0x24')](function(_0x5883b7){if(_0x5883b7){_0x21f00b=_[_0xf60b('0x6d')](_0x5883b7,'id');var _0x4d825f;var _0x4dc816=squel[_0xf60b('0x6e')]();_0x4dc816[_0xf60b('0x6f')](_0x412253[_0xf60b('0x70')]);for(var _0x3faecf=0x0;_0x3faecf<_0x1de59e[_0xf60b('0x37')];_0x3faecf+=0x1){_0x4d825f=_0x1de59e[_0x3faecf]['MetricId']?_0x21f00b[_0x1de59e[_0x3faecf][_0xf60b('0x71')]][_0xf60b('0x72')]:_0x1de59e[_0x3faecf][_0xf60b('0x66')];_0x4d825f=_0x1de59e[_0x3faecf][_0xf60b('0x73')]?_[_0xf60b('0x74')](_0x570dd5[_0x1de59e[_0x3faecf][_0xf60b('0x73')]],'%s',_0x4d825f):_0x4d825f;_0x4d825f=_0x1de59e[_0x3faecf][_0xf60b('0x75')]?_[_0xf60b('0x74')](_0x3614d5[_0x1de59e[_0x3faecf]['format']],'%s',_0x4d825f):_0x4d825f;if(_0x1de59e[_0x3faecf][_0xf60b('0x76')]){_0x4dc816[_0xf60b('0x77')](_0x4d825f);}_0x1de59e[_0x3faecf][_0xf60b('0x78')]&&_0x4dc816[_0xf60b('0x79')](_0x4d825f,_0x1de59e[_0x3faecf][_0xf60b('0x78')]==='DESC'?![]:!![]);_0x4dc816[_0xf60b('0x66')](_0x4d825f,_0x1de59e[_0x3faecf][_0xf60b('0x7b')]||_0x4d825f);}if(_0x412253['joins']){_0x412253[_0xf60b('0x7c')]=JSON[_0xf60b('0x7d')](_0x412253[_0xf60b('0x7c')]);for(var _0x400f31=0x0;_0x400f31<_0x412253[_0xf60b('0x7c')]['length'];_0x400f31+=0x1){if(_0x412253['joins'][_0x400f31]['type']&&_[_0xf60b('0x5f')](_0x1c994d,_0x412253['joins'][_0x400f31][_0xf60b('0x3f')])&&_0x412253['joins'][_0x400f31][_0xf60b('0x7e')]&&_0x412253[_0xf60b('0x7c')][_0x400f31]['foreignTable']&&_0x412253[_0xf60b('0x7c')][_0x400f31][_0xf60b('0x81')]){_0x4dc816[_0x412253[_0xf60b('0x7c')][_0x400f31][_0xf60b('0x3f')]](_0x412253[_0xf60b('0x7c')][_0x400f31][_0xf60b('0x7f')],null,util['format'](_0xf60b('0x80'),_0x412253[_0xf60b('0x70')],_0x412253['joins'][_0x400f31]['parentKey'],_0x412253[_0xf60b('0x7c')][_0x400f31][_0xf60b('0x7f')],_0x412253['joins'][_0x400f31]['foreignKey']));}}}if(_0x412253[_0xf60b('0x82')]){_0x412253['conditions']=JSON['parse'](_0x412253[_0xf60b('0x82')]);_0x4dc816['where'](_0x106538(_0x412253[_0xf60b('0x82')][_0xf60b('0x77')]));}_0x7c30c1=_0x4dc816[_0xf60b('0x83')]();_0x4dc816[_0xf60b('0x1e')](_0x13365f);_0x4dc816[_0xf60b('0x1d')](0x0);logger[_0xf60b('0x8a')](_0xf60b('0x84'),_0x4dc816[_0xf60b('0x85')]());return db[_0xf60b('0x86')][_0xf60b('0x32')](_0x4dc816['toString'](),{'type':db[_0xf60b('0x86')][_0xf60b('0x87')]['SELECT']});}})[_0xf60b('0x24')](function(_0x264c8c){if(!_0x264c8c['length']){throw new db[(_0xf60b('0x69'))][(_0xf60b('0x6a'))]('No\x20available\x20data',0xcc);}if(_0x4385cf[_0xf60b('0x8b')]==='web'){return null;}var _0x558ced=_[_0xf60b('0x3e')](_0x4385cf,{'name':_0x4385cf[_0xf60b('0x8c')]||_0x4385cf[_0xf60b('0x2a')]||_0x412253[_0xf60b('0x2a')],'basename':_0xfdf827,'savename':util['format'](_0xf60b('0x8d'),_0x4385cf[_0xf60b('0x2a')]||_0x412253[_0xf60b('0x2a')],require(_0xf60b('0x8e'))['generate'](0x4),_0x4385cf[_0xf60b('0x8b')]||'csv'),'reportId':_0x412253['id'],'reportType':_0xf60b('0x8f')});return db[_0xf60b('0x90')][_0xf60b('0x48')](_0x558ced,{'raw':!![]});})[_0xf60b('0x24')](function(_0x5dc9a5){if(_0x412253[_0xf60b('0x70')]===_0xf60b('0x91')){_0x7c30c1[_0xf60b('0x3b')](_0x412253[_0xf60b('0x70')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4385cf[_0xf60b('0x92')],_0x4385cf[_0xf60b('0x93')]);}else{_0x7c30c1[_0xf60b('0x3b')](_0x412253[_0xf60b('0x70')]+_0xf60b('0x94'),_0x4385cf[_0xf60b('0x92')],_0x4385cf[_0xf60b('0x93')]);}if(_0x5dc9a5){logger[_0xf60b('0x95')](_0xf60b('0x96'),_0x7c30c1[_0xf60b('0x85')]());require(_0xf60b('0x97'))[_0xf60b('0x98')](path[_0xf60b('0x51')](__dirname,_0xf60b('0x99'),_0x5dc9a5[_0xf60b('0x8b')]),[_0x5dc9a5['id'],_0x7c30c1[_0xf60b('0x85')](),path[_0xf60b('0x51')](__dirname,_0xf60b('0x9a'),_0x5dc9a5[_0xf60b('0x9b')]),_0xfdf827]);return _0x5dc9a5;}else{var _0x382bcd=squel[_0xf60b('0x6e')]();_0x382bcd[_0xf60b('0x6f')]('('+_0x7c30c1[_0xf60b('0x85')]()+')',_0xf60b('0x9c'));_0x382bcd[_0xf60b('0x66')](_0xf60b('0x9d'),_0xf60b('0x1c'));_0x7c30c1['limit'](_0x4385cf[_0xf60b('0x1e')]||_0x13365f);_0x7c30c1[_0xf60b('0x1d')](_0x4385cf['offset']||0x0);return dbH[_0xf60b('0x86')]['query'](_0x382bcd[_0xf60b('0x85')](),{'type':dbH['sequelize'][_0xf60b('0x87')][_0xf60b('0x9e')]})[_0xf60b('0x24')](function(_0x3d1d34){if(!_0x3d1d34[_0xf60b('0x37')]){_0x13bb75=0x0;}else{_0x13bb75=_0x3d1d34[0x0]['count']||0x0;}return dbH[_0xf60b('0x86')][_0xf60b('0x32')](_0x7c30c1[_0xf60b('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0xf60b('0x9e')]});})['then'](function(_0xfb7262){return{'rows':_0xfb7262||[],'count':_0x13bb75};});}});}exports['run']=function(_0x1fd7e6,_0x207833){return runReport(_0x1fd7e6[_0xf60b('0x45')],_0x1fd7e6[_0xf60b('0x32')],_0x1fd7e6['options'])[_0xf60b('0x24')](respondWithResult(_0x207833,null))[_0xf60b('0x44')](handleError(_0x207833,null));};exports[_0xf60b('0x9f')]=runReport;exports[_0xf60b('0x32')]=function(_0x1f64d9,_0x23d9a2){var _0x55c87e=0xa;var _0x5815c4=[_0xf60b('0x51'),_0xf60b('0x52'),_0xf60b('0x53'),'cross_join'];var _0x12cc5c={'SUM':_0xf60b('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf60b('0xa0'),'AVG':_0xf60b('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf60b('0x59'),'GROUP_CONCAT DESC':_0xf60b('0x89')};var _0x30f6dc={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf60b('0x5b'),'HOUR':_0xf60b('0x5c'),'ROUND':_0xf60b('0x5d'),'UNIX_TIMESTAMP':_0xf60b('0x5e')};var _0x156e7e=function(_0x3e7a29){return!_[_0xf60b('0x5f')]([_0xf60b('0x60'),_0xf60b('0x61'),_0xf60b('0x62'),_0xf60b('0x63')],_0x3e7a29);};var _0x10b457=function(_0x1cbaa5){if(!_0x1cbaa5||!_0x1cbaa5[_0xf60b('0x64')][_0xf60b('0x37')]){return'';}for(var _0x3fc2a5='(',_0x27b7e8=0x0;_0x27b7e8<_0x1cbaa5[_0xf60b('0x64')][_0xf60b('0x37')];_0x27b7e8+=0x1){_0x27b7e8>0x0&&(_0x3fc2a5+='\x20'+_0x1cbaa5[_0xf60b('0x65')]+'\x20');_0x3fc2a5+=_0x1cbaa5['rules'][_0x27b7e8][_0xf60b('0x77')]?_0x10b457(_0x1cbaa5['rules'][_0x27b7e8][_0xf60b('0x77')]):_0x1cbaa5['rules'][_0x27b7e8][_0xf60b('0x66')]+'\x20'+_0x1cbaa5['rules'][_0x27b7e8]['condition']+(_0x156e7e(_0x1cbaa5[_0xf60b('0x64')][_0x27b7e8][_0xf60b('0x67')])?'\x20'+_0x1cbaa5['rules'][_0x27b7e8][_0xf60b('0x68')]:'');}return _0x3fc2a5+')';};var _0x34419c={'where':{'id':_0x1f64d9[_0xf60b('0x45')]['id']}},_0x10f75e,_0xcf1d5c,_0x44b042,_0x53ae4f,_0x2987cb;_0x34419c=_[_0xf60b('0x3e')]({},_0x34419c,_0x1f64d9['options']);return db[_0xf60b('0x2e')][_0xf60b('0x4b')](_0x34419c)[_0xf60b('0x24')](function(_0x1c6fdc){if(_0x1c6fdc){_0x10f75e=_0x1c6fdc;return _0x1c6fdc[_0xf60b('0xa1')]();}return null;})[_0xf60b('0x24')](function(_0x3aadc6){if(_0x3aadc6){if(!_0x3aadc6['length']){throw new db[(_0xf60b('0x69'))][(_0xf60b('0x6a'))](_0xf60b('0xa2'),0x193);}_0xcf1d5c=_0x3aadc6;return db[_0xf60b('0x6b')][_0xf60b('0x6c')]({'raw':!![]});}return null;})[_0xf60b('0x24')](function(_0x2091f4){if(_0x2091f4){_0x44b042=_['keyBy'](_0x2091f4,'id');var _0x13f6bf;var _0x44d9e6=squel[_0xf60b('0x6e')]();_0x44d9e6['from'](_0x10f75e[_0xf60b('0x70')]);for(var _0x20841d=0x0;_0x20841d<_0xcf1d5c[_0xf60b('0x37')];_0x20841d+=0x1){_0x13f6bf=_0xcf1d5c[_0x20841d][_0xf60b('0x71')]?_0x44b042[_0xcf1d5c[_0x20841d][_0xf60b('0x71')]]['metric']:_0xcf1d5c[_0x20841d]['field'];_0x13f6bf=_0xcf1d5c[_0x20841d][_0xf60b('0x73')]?_[_0xf60b('0x74')](_0x12cc5c[_0xcf1d5c[_0x20841d][_0xf60b('0x73')]],'%s',_0x13f6bf):_0x13f6bf;_0x13f6bf=_0xcf1d5c[_0x20841d][_0xf60b('0x75')]?_['replace'](_0x30f6dc[_0xcf1d5c[_0x20841d][_0xf60b('0x75')]],'%s',_0x13f6bf):_0x13f6bf;if(_0xcf1d5c[_0x20841d][_0xf60b('0x76')]){_0x44d9e6[_0xf60b('0x77')](_0x13f6bf);}_0xcf1d5c[_0x20841d][_0xf60b('0x78')]&&_0x44d9e6[_0xf60b('0x79')](_0x13f6bf,_0xcf1d5c[_0x20841d][_0xf60b('0x78')]===_0xf60b('0x7a')?![]:!![]);_0x44d9e6['field'](_0x13f6bf,_0xcf1d5c[_0x20841d][_0xf60b('0x7b')]||_0x13f6bf);}if(_0x10f75e['joins']){_0x10f75e[_0xf60b('0x7c')]=JSON[_0xf60b('0x7d')](_0x10f75e[_0xf60b('0x7c')]);for(var _0x9737b4=0x0;_0x9737b4<_0x10f75e[_0xf60b('0x7c')][_0xf60b('0x37')];_0x9737b4+=0x1){if(_0x10f75e['joins'][_0x9737b4][_0xf60b('0x3f')]&&_[_0xf60b('0x5f')](_0x5815c4,_0x10f75e['joins'][_0x9737b4][_0xf60b('0x3f')])&&_0x10f75e[_0xf60b('0x7c')][_0x9737b4][_0xf60b('0x7e')]&&_0x10f75e['joins'][_0x9737b4][_0xf60b('0x7f')]&&_0x10f75e['joins'][_0x9737b4]['foreignKey']){_0x44d9e6[_0x10f75e[_0xf60b('0x7c')][_0x9737b4]['type']](_0x10f75e[_0xf60b('0x7c')][_0x9737b4][_0xf60b('0x7f')],null,util[_0xf60b('0x75')]('%s.%s\x20=\x20%s.%s',_0x10f75e[_0xf60b('0x70')],_0x10f75e[_0xf60b('0x7c')][_0x9737b4][_0xf60b('0x7e')],_0x10f75e['joins'][_0x9737b4][_0xf60b('0x7f')],_0x10f75e[_0xf60b('0x7c')][_0x9737b4][_0xf60b('0x81')]));}}}if(_0x10f75e[_0xf60b('0x82')]){_0x10f75e[_0xf60b('0x82')]=JSON[_0xf60b('0x7d')](_0x10f75e[_0xf60b('0x82')]);_0x44d9e6['where'](_0x10b457(_0x10f75e[_0xf60b('0x82')][_0xf60b('0x77')]));}_0x2987cb=_0x44d9e6['clone']();_0x44d9e6[_0xf60b('0x1e')](_0x55c87e);_0x44d9e6[_0xf60b('0x1d')](0x0);logger[_0xf60b('0x8a')](_0xf60b('0x84'),_0x44d9e6[_0xf60b('0x85')]());return db[_0xf60b('0x86')][_0xf60b('0x32')](_0x44d9e6[_0xf60b('0x85')](),{'type':db[_0xf60b('0x86')][_0xf60b('0x87')][_0xf60b('0x9e')]});}})['then'](function(){return{'sql':_0x2987cb['toString']()};})['then'](respondWithResult(_0x23d9a2,null))[_0xf60b('0x44')](handleError(_0x23d9a2,null));}; \ No newline at end of file +var _0xb5a3=['options','AnalyticDefaultReport','includeAll','include','findAll','catch','show','keys','rawAttributes','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','table','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','Please\x20insert\x20at\x20least\x20one\x20field','select','metric','order','debug','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','from','alias','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','dbH','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','map','type','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','merge','filter'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0xb5a3,0x70));var _0x3b5a=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0xb5a3[_0x3d27ba];return _0xf01885;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b5a('0x0'));var rimraf=require(_0x3b5a('0x1'));var zipdir=require(_0x3b5a('0x2'));var jsonpatch=require(_0x3b5a('0x3'));var rp=require(_0x3b5a('0x4'));var moment=require(_0x3b5a('0x5'));var BPromise=require(_0x3b5a('0x6'));var Mustache=require('mustache');var util=require(_0x3b5a('0x7'));var path=require(_0x3b5a('0x8'));var sox=require(_0x3b5a('0x9'));var csv=require(_0x3b5a('0xa'));var ejs=require(_0x3b5a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3b5a('0xc'));var crypto=require(_0x3b5a('0xd'));var jsforce=require(_0x3b5a('0xe'));var deskjs=require(_0x3b5a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3b5a('0x10'));var Papa=require(_0x3b5a('0x11'));var Redis=require(_0x3b5a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3b5a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b5a('0x14'));var logger=require(_0x3b5a('0x15'))('api');var utils=require(_0x3b5a('0x16'));var config=require(_0x3b5a('0x17'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x3b5a('0x18')];function respondWithStatusCode(_0x43d412,_0x16c30e){_0x16c30e=_0x16c30e||0xcc;return function(_0x489887){if(_0x489887){return _0x43d412['sendStatus'](_0x16c30e);}return _0x43d412[_0x3b5a('0x19')](_0x16c30e)[_0x3b5a('0x1a')]();};}function respondWithResult(_0x309a58,_0x5f1a7c){_0x5f1a7c=_0x5f1a7c||0xc8;return function(_0x167b29){if(_0x167b29){return _0x309a58[_0x3b5a('0x19')](_0x5f1a7c)['json'](_0x167b29);}};}function respondWithFilteredResult(_0x14a273,_0x24dc9d){return function(_0xc6e615){if(_0xc6e615){var _0xef6107=_0xc6e615[_0x3b5a('0x1b')],_0x584c09=_0x24dc9d['offset'],_0x4c1ca3=_0x24dc9d[_0x3b5a('0x1c')]+_0x24dc9d[_0x3b5a('0x1d')],_0x22c080;if(_0x4c1ca3>=_0xef6107){_0x4c1ca3=_0xef6107;_0x22c080=0xc8;}else{_0x22c080=0xce;}_0x14a273[_0x3b5a('0x19')](_0x22c080);return _0x14a273[_0x3b5a('0x1e')](_0x3b5a('0x1f'),_0x584c09+'-'+_0x4c1ca3+'/'+_0xef6107)[_0x3b5a('0x20')](_0xc6e615);}return null;};}function patchUpdates(_0x4bf988){return function(_0x48b8b0){try{jsonpatch[_0x3b5a('0x21')](_0x48b8b0,_0x4bf988,!![]);}catch(_0xce56a7){return BPromise[_0x3b5a('0x22')](_0xce56a7);}return _0x48b8b0[_0x3b5a('0x23')]();};}function saveUpdates(_0xdf56be,_0x382479){return function(_0x565ef3){if(_0x565ef3){return _0x565ef3[_0x3b5a('0x24')](_0xdf56be)[_0x3b5a('0x25')](function(_0x5eefdb){return _0x5eefdb;});}return null;};}function removeEntity(_0x410608,_0x2ecb7e){return function(_0x56d9c8){if(_0x56d9c8){return _0x56d9c8[_0x3b5a('0x26')]()['then'](function(){var _0x8729b7=_0x56d9c8['get']({'plain':!![]});var _0x39f1ca='DefaultReports';return db[_0x3b5a('0x27')][_0x3b5a('0x26')]({'where':{'type':_0x39f1ca,'resourceId':_0x8729b7['id']}})[_0x3b5a('0x25')](function(){return _0x56d9c8;});})[_0x3b5a('0x25')](function(){_0x410608[_0x3b5a('0x19')](0xcc)[_0x3b5a('0x1a')]();});}};}function handleEntityNotFound(_0x35f31a,_0x4a7c96){return function(_0x465a1b){if(!_0x465a1b){_0x35f31a['sendStatus'](0x194);}return _0x465a1b;};}function handleError(_0x49e2ed,_0x5dd028){_0x5dd028=_0x5dd028||0x1f4;return function(_0x5a4ea4){logger[_0x3b5a('0x28')](_0x5a4ea4[_0x3b5a('0x29')]);if(_0x5a4ea4[_0x3b5a('0x2a')]){delete _0x5a4ea4[_0x3b5a('0x2a')];}_0x49e2ed[_0x3b5a('0x19')](_0x5dd028)['send'](_0x5a4ea4);};}exports['index']=function(_0x2be42b,_0x1e9ea5){var _0x5913e0={},_0x47ea9e={},_0x295ee3={'count':0x0,'rows':[]};var _0x16a25b=_[_0x3b5a('0x2b')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x4da800){return{'name':_0x4da800['fieldName'],'type':_0x4da800[_0x3b5a('0x2c')][_0x3b5a('0x2d')]};});_0x47ea9e[_0x3b5a('0x2e')]=_[_0x3b5a('0x2b')](_0x16a25b,_0x3b5a('0x2a'));_0x47ea9e[_0x3b5a('0x2f')]=_['keys'](_0x2be42b[_0x3b5a('0x2f')]);_0x47ea9e['filters']=_[_0x3b5a('0x30')](_0x47ea9e['model'],_0x47ea9e[_0x3b5a('0x2f')]);_0x5913e0[_0x3b5a('0x31')]=_[_0x3b5a('0x30')](_0x47ea9e[_0x3b5a('0x2e')],qs[_0x3b5a('0x32')](_0x2be42b[_0x3b5a('0x2f')][_0x3b5a('0x32')]));_0x5913e0[_0x3b5a('0x31')]=_0x5913e0['attributes']['length']?_0x5913e0[_0x3b5a('0x31')]:_0x47ea9e[_0x3b5a('0x2e')];if(!_0x2be42b[_0x3b5a('0x2f')]['hasOwnProperty'](_0x3b5a('0x33'))){_0x5913e0[_0x3b5a('0x1d')]=qs[_0x3b5a('0x1d')](_0x2be42b[_0x3b5a('0x2f')]['limit']);_0x5913e0[_0x3b5a('0x1c')]=qs[_0x3b5a('0x1c')](_0x2be42b[_0x3b5a('0x2f')]['offset']);}_0x5913e0['order']=qs[_0x3b5a('0x34')](_0x2be42b[_0x3b5a('0x2f')][_0x3b5a('0x34')]);_0x5913e0[_0x3b5a('0x35')]=qs[_0x3b5a('0x36')](_['pick'](_0x2be42b[_0x3b5a('0x2f')],_0x47ea9e[_0x3b5a('0x36')]),_0x16a25b);if(_0x2be42b[_0x3b5a('0x2f')]['filter']){_0x5913e0[_0x3b5a('0x35')]=_[_0x3b5a('0x37')](_0x5913e0[_0x3b5a('0x35')],{'$or':_['map'](_0x16a25b,function(_0x4aaa20){if(_0x4aaa20[_0x3b5a('0x2c')]!=='VIRTUAL'){var _0x1aa709={};_0x1aa709[_0x4aaa20[_0x3b5a('0x2a')]]={'$like':'%'+_0x2be42b[_0x3b5a('0x2f')][_0x3b5a('0x38')]+'%'};return _0x1aa709;}})});}_0x5913e0=_['merge']({},_0x5913e0,_0x2be42b[_0x3b5a('0x39')]);var _0x3a6b65={'where':_0x5913e0['where']};return db[_0x3b5a('0x3a')][_0x3b5a('0x1b')](_0x3a6b65)[_0x3b5a('0x25')](function(_0x40bf2c){_0x295ee3['count']=_0x40bf2c;if(_0x2be42b['query'][_0x3b5a('0x3b')]){_0x5913e0[_0x3b5a('0x3c')]=[{'all':!![]}];}return db[_0x3b5a('0x3a')][_0x3b5a('0x3d')](_0x5913e0);})[_0x3b5a('0x25')](function(_0x5d7a6c){_0x295ee3['rows']=_0x5d7a6c;return _0x295ee3;})[_0x3b5a('0x25')](respondWithFilteredResult(_0x1e9ea5,_0x5913e0))[_0x3b5a('0x3e')](handleError(_0x1e9ea5,null));};exports[_0x3b5a('0x3f')]=function(_0x1f52b5,_0x1cd8be){var _0x50e567={'raw':!![],'where':{'id':_0x1f52b5['params']['id']}},_0x14dc7f={};_0x14dc7f['model']=_[_0x3b5a('0x40')](db['AnalyticDefaultReport'][_0x3b5a('0x41')]);_0x14dc7f[_0x3b5a('0x2f')]=_[_0x3b5a('0x40')](_0x1f52b5[_0x3b5a('0x2f')]);_0x14dc7f[_0x3b5a('0x36')]=_['intersection'](_0x14dc7f[_0x3b5a('0x2e')],_0x14dc7f['query']);_0x50e567['attributes']=_[_0x3b5a('0x30')](_0x14dc7f[_0x3b5a('0x2e')],qs[_0x3b5a('0x32')](_0x1f52b5[_0x3b5a('0x2f')][_0x3b5a('0x32')]));_0x50e567['attributes']=_0x50e567[_0x3b5a('0x31')][_0x3b5a('0x42')]?_0x50e567[_0x3b5a('0x31')]:_0x14dc7f[_0x3b5a('0x2e')];if(_0x1f52b5[_0x3b5a('0x2f')][_0x3b5a('0x3b')]){_0x50e567[_0x3b5a('0x3c')]=[{'all':!![]}];}_0x50e567=_[_0x3b5a('0x37')]({},_0x50e567,_0x1f52b5[_0x3b5a('0x39')]);return db[_0x3b5a('0x3a')][_0x3b5a('0x43')](_0x50e567)[_0x3b5a('0x25')](handleEntityNotFound(_0x1cd8be,null))[_0x3b5a('0x25')](respondWithResult(_0x1cd8be,null))['catch'](handleError(_0x1cd8be,null));};exports[_0x3b5a('0x44')]=function(_0x6bacc4,_0x598eaf){return db[_0x3b5a('0x3a')][_0x3b5a('0x44')](_0x6bacc4[_0x3b5a('0x45')],{})[_0x3b5a('0x25')](function(_0x19fe89){var _0x5338e2=_0x6bacc4[_0x3b5a('0x46')][_0x3b5a('0x47')]({'plain':!![]});if(!_0x5338e2)throw new Error(_0x3b5a('0x48'));if(_0x5338e2[_0x3b5a('0x49')]===_0x3b5a('0x46')){var _0x2ca302=_0x19fe89[_0x3b5a('0x47')]({'plain':!![]});var _0x5ec442=_0x3b5a('0x4a');return db[_0x3b5a('0x4b')]['find']({'where':{'name':_0x5ec442,'userProfileId':_0x5338e2[_0x3b5a('0x4c')]},'raw':!![]})[_0x3b5a('0x25')](function(_0x260883){if(_0x260883&&_0x260883[_0x3b5a('0x4d')]===0x0){return db[_0x3b5a('0x27')][_0x3b5a('0x44')]({'name':_0x2ca302[_0x3b5a('0x2a')],'resourceId':_0x2ca302['id'],'type':_0x3b5a('0x4e'),'sectionId':_0x260883['id']},{})[_0x3b5a('0x25')](function(){return _0x19fe89;});}else{return _0x19fe89;}})[_0x3b5a('0x3e')](function(_0x175e7a){logger[_0x3b5a('0x28')](_0x3b5a('0x4f'),_0x175e7a);throw _0x175e7a;});}return _0x19fe89;})['then'](respondWithResult(_0x598eaf,0xc9))[_0x3b5a('0x3e')](handleError(_0x598eaf,null));};exports['update']=function(_0x2a9364,_0x1452f7){if(_0x2a9364[_0x3b5a('0x45')]['id']){delete _0x2a9364[_0x3b5a('0x45')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x2a9364['params']['id']}})[_0x3b5a('0x25')](handleEntityNotFound(_0x1452f7,null))[_0x3b5a('0x25')](saveUpdates(_0x2a9364['body'],null))[_0x3b5a('0x25')](respondWithResult(_0x1452f7,null))[_0x3b5a('0x3e')](handleError(_0x1452f7,null));};exports[_0x3b5a('0x26')]=function(_0x47e7bc,_0x4c3937){return db[_0x3b5a('0x3a')][_0x3b5a('0x43')]({'where':{'id':_0x47e7bc[_0x3b5a('0x50')]['id']}})[_0x3b5a('0x25')](handleEntityNotFound(_0x4c3937,null))['then'](removeEntity(_0x4c3937,null))[_0x3b5a('0x3e')](handleError(_0x4c3937,null));};exports[_0x3b5a('0x51')]=function(_0x26fd7e,_0x2ec20c){var _0x297a57=0xa;var _0x1cbcfb=[_0x3b5a('0x52'),_0x3b5a('0x53'),_0x3b5a('0x54'),_0x3b5a('0x55')];var _0x1333cb={'SUM':_0x3b5a('0x56'),'COUNT':_0x3b5a('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3b5a('0x58'),'MIN':_0x3b5a('0x59'),'AVG':_0x3b5a('0x5a'),'GROUP_CONCAT':_0x3b5a('0x5b'),'GROUP_CONCAT ASC':_0x3b5a('0x5c'),'GROUP_CONCAT DESC':_0x3b5a('0x5d')};var _0x95fb69={'SEC_TO_TIME':_0x3b5a('0x5e'),'DATE':_0x3b5a('0x5f'),'HOUR':_0x3b5a('0x60'),'ROUND':_0x3b5a('0x61'),'UNIX_TIMESTAMP':_0x3b5a('0x62')};var _0x240480=function(_0x23961f){return!_[_0x3b5a('0x63')]([_0x3b5a('0x64'),_0x3b5a('0x65'),_0x3b5a('0x66'),_0x3b5a('0x67')],_0x23961f);};var _0x2c87bf=function(_0x464162){if(!_0x464162||!_0x464162[_0x3b5a('0x68')][_0x3b5a('0x42')]){return'';}for(var _0x2814a9='(',_0x5ee76a=0x0;_0x5ee76a<_0x464162[_0x3b5a('0x68')][_0x3b5a('0x42')];_0x5ee76a+=0x1){_0x5ee76a>0x0&&(_0x2814a9+='\x20'+_0x464162[_0x3b5a('0x69')]+'\x20');_0x2814a9+=_0x464162[_0x3b5a('0x68')][_0x5ee76a][_0x3b5a('0x6a')]?_0x2c87bf(_0x464162[_0x3b5a('0x68')][_0x5ee76a]['group']):_0x464162[_0x3b5a('0x68')][_0x5ee76a][_0x3b5a('0x6b')]+'\x20'+_0x464162[_0x3b5a('0x68')][_0x5ee76a]['condition']+(_0x240480(_0x464162[_0x3b5a('0x68')][_0x5ee76a][_0x3b5a('0x6c')])?'\x20'+_0x464162[_0x3b5a('0x68')][_0x5ee76a][_0x3b5a('0x6d')]:'');}return _0x2814a9+')';};var _0x3fecb7={'where':{'id':_0x26fd7e[_0x3b5a('0x50')]['id']}},_0x14867b,_0x30e29e,_0xb31360,_0x1c06b4,_0x489d7a;_0x3fecb7=_[_0x3b5a('0x37')]({},_0x3fecb7,_0x26fd7e[_0x3b5a('0x39')]);return db['AnalyticDefaultReport']['find'](_0x3fecb7)[_0x3b5a('0x25')](function(_0x5312a8){if(_0x5312a8){_0x14867b=_0x5312a8;return _0x5312a8[_0x3b5a('0x6e')]();}return null;})['then'](function(_0x1c61b3){if(_0x1c61b3){if(!_0x1c61b3[_0x3b5a('0x42')]){throw new db[(_0x3b5a('0x6f'))][(_0x3b5a('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x30e29e=_0x1c61b3;return db[_0x3b5a('0x71')][_0x3b5a('0x3d')]({'raw':!![]});}return null;})[_0x3b5a('0x25')](function(_0x22bdd8){if(_0x22bdd8){_0xb31360=_[_0x3b5a('0x72')](_0x22bdd8,'id');var _0x27c246;var _0x4628b9=squel['select']();_0x4628b9['from'](_0x14867b[_0x3b5a('0x73')]);for(var _0x42185b=0x0;_0x42185b<_0x30e29e['length'];_0x42185b+=0x1){_0x27c246=_0x30e29e[_0x42185b][_0x3b5a('0x74')]?_0xb31360[_0x30e29e[_0x42185b][_0x3b5a('0x74')]]['metric']:_0x30e29e[_0x42185b][_0x3b5a('0x6b')];_0x27c246=_0x30e29e[_0x42185b][_0x3b5a('0x75')]?_[_0x3b5a('0x76')](_0x1333cb[_0x30e29e[_0x42185b][_0x3b5a('0x75')]],'%s',_0x27c246):_0x27c246;_0x27c246=_0x30e29e[_0x42185b][_0x3b5a('0x77')]?_[_0x3b5a('0x76')](_0x95fb69[_0x30e29e[_0x42185b]['format']],'%s',_0x27c246):_0x27c246;if(_0x30e29e[_0x42185b][_0x3b5a('0x78')]){_0x4628b9[_0x3b5a('0x6a')](_0x27c246);}_0x30e29e[_0x42185b][_0x3b5a('0x79')]&&_0x4628b9['order'](_0x27c246,_0x30e29e[_0x42185b][_0x3b5a('0x79')]===_0x3b5a('0x7a')?![]:!![]);_0x4628b9['field'](_0x27c246,_0x30e29e[_0x42185b]['alias']||_0x27c246);}if(_0x14867b[_0x3b5a('0x7b')]){_0x14867b[_0x3b5a('0x7b')]=JSON[_0x3b5a('0x7c')](_0x14867b[_0x3b5a('0x7b')]);for(var _0x568239=0x0;_0x568239<_0x14867b[_0x3b5a('0x7b')]['length'];_0x568239+=0x1){if(_0x14867b[_0x3b5a('0x7b')][_0x568239][_0x3b5a('0x2c')]&&_[_0x3b5a('0x63')](_0x1cbcfb,_0x14867b[_0x3b5a('0x7b')][_0x568239]['type'])&&_0x14867b[_0x3b5a('0x7b')][_0x568239]['parentKey']&&_0x14867b[_0x3b5a('0x7b')][_0x568239][_0x3b5a('0x7d')]&&_0x14867b['joins'][_0x568239][_0x3b5a('0x7e')]){_0x4628b9[_0x14867b[_0x3b5a('0x7b')][_0x568239][_0x3b5a('0x2c')]](_0x14867b[_0x3b5a('0x7b')][_0x568239]['foreignTable'],null,util[_0x3b5a('0x77')]('%s.%s\x20=\x20%s.%s',_0x14867b['table'],_0x14867b['joins'][_0x568239][_0x3b5a('0x7f')],_0x14867b['joins'][_0x568239][_0x3b5a('0x7d')],_0x14867b['joins'][_0x568239]['foreignKey']));}}}if(_0x14867b[_0x3b5a('0x80')]){_0x14867b['conditions']=JSON[_0x3b5a('0x7c')](_0x14867b['conditions']);_0x4628b9[_0x3b5a('0x35')](_0x2c87bf(_0x14867b[_0x3b5a('0x80')][_0x3b5a('0x6a')]));}_0x489d7a=_0x4628b9[_0x3b5a('0x81')]();_0x4628b9[_0x3b5a('0x1d')](_0x297a57);_0x4628b9[_0x3b5a('0x1c')](0x0);logger['debug'](_0x3b5a('0x82'),_0x4628b9[_0x3b5a('0x83')]());return db['sequelize'][_0x3b5a('0x2f')](_0x4628b9[_0x3b5a('0x83')](),{'type':db[_0x3b5a('0x84')][_0x3b5a('0x85')][_0x3b5a('0x86')]});}})['then'](respondWithResult(_0x2ec20c,null))[_0x3b5a('0x3e')](handleError(_0x2ec20c,null));};function runReport(_0x311e9e,_0x25e74b,_0x1b1342){var _0x2b2f1c=_0x25e74b[_0x3b5a('0x2a')];var _0x15dc26=0xa;var _0x518c1d=[_0x3b5a('0x52'),'left_join',_0x3b5a('0x54'),'cross_join'];var _0x16dbc6={'SUM':_0x3b5a('0x56'),'COUNT':_0x3b5a('0x57'),'COUNT DISTINCT':_0x3b5a('0x87'),'MAX':_0x3b5a('0x58'),'MIN':_0x3b5a('0x59'),'AVG':_0x3b5a('0x5a'),'GROUP_CONCAT':_0x3b5a('0x5b'),'GROUP_CONCAT ASC':_0x3b5a('0x5c'),'GROUP_CONCAT DESC':_0x3b5a('0x5d')};var _0x103946={'SEC_TO_TIME':_0x3b5a('0x5e'),'DATE':_0x3b5a('0x5f'),'HOUR':_0x3b5a('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3b5a('0x62')};var _0x43591d=function(_0x17d9fb){return!_[_0x3b5a('0x63')]([_0x3b5a('0x64'),_0x3b5a('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x17d9fb);};var _0x11dd9e=function(_0x519dca){if(!_0x519dca||!_0x519dca[_0x3b5a('0x68')][_0x3b5a('0x42')]){return'';}for(var _0xaf853c='(',_0xdf73c0=0x0;_0xdf73c0<_0x519dca[_0x3b5a('0x68')]['length'];_0xdf73c0+=0x1){_0xdf73c0>0x0&&(_0xaf853c+='\x20'+_0x519dca['operator']+'\x20');_0xaf853c+=_0x519dca[_0x3b5a('0x68')][_0xdf73c0][_0x3b5a('0x6a')]?_0x11dd9e(_0x519dca[_0x3b5a('0x68')][_0xdf73c0][_0x3b5a('0x6a')]):_0x519dca[_0x3b5a('0x68')][_0xdf73c0]['field']+'\x20'+_0x519dca[_0x3b5a('0x68')][_0xdf73c0][_0x3b5a('0x6c')]+(_0x43591d(_0x519dca[_0x3b5a('0x68')][_0xdf73c0][_0x3b5a('0x6c')])?'\x20'+_0x519dca[_0x3b5a('0x68')][_0xdf73c0][_0x3b5a('0x6d')]:'');}return _0xaf853c+')';};var _0x1c0fb5={'where':{'id':_0x311e9e['id']}},_0xc3e09d,_0x36f8a8,_0x509a5c,_0x114e4c,_0x11a583;_0x1c0fb5=_[_0x3b5a('0x37')]({},_0x1c0fb5,_0x1b1342);return db[_0x3b5a('0x3a')][_0x3b5a('0x43')](_0x1c0fb5)[_0x3b5a('0x25')](function(_0x2937dd){if(_0x2937dd){_0xc3e09d=_0x2937dd;return _0x2937dd['getFields']();}return null;})[_0x3b5a('0x25')](function(_0x569867){if(_0x569867){if(!_0x569867['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x3b5a('0x88'),0x193);}_0x36f8a8=_0x569867;return db[_0x3b5a('0x71')][_0x3b5a('0x3d')]({'raw':!![]});}return null;})[_0x3b5a('0x25')](function(_0x521135){if(_0x521135){_0x509a5c=_[_0x3b5a('0x72')](_0x521135,'id');var _0x273f53;var _0x377445=squel[_0x3b5a('0x89')]();_0x377445['from'](_0xc3e09d[_0x3b5a('0x73')]);for(var _0x4a8bae=0x0;_0x4a8bae<_0x36f8a8[_0x3b5a('0x42')];_0x4a8bae+=0x1){_0x273f53=_0x36f8a8[_0x4a8bae][_0x3b5a('0x74')]?_0x509a5c[_0x36f8a8[_0x4a8bae]['MetricId']][_0x3b5a('0x8a')]:_0x36f8a8[_0x4a8bae][_0x3b5a('0x6b')];_0x273f53=_0x36f8a8[_0x4a8bae][_0x3b5a('0x75')]?_[_0x3b5a('0x76')](_0x16dbc6[_0x36f8a8[_0x4a8bae][_0x3b5a('0x75')]],'%s',_0x273f53):_0x273f53;_0x273f53=_0x36f8a8[_0x4a8bae][_0x3b5a('0x77')]?_[_0x3b5a('0x76')](_0x103946[_0x36f8a8[_0x4a8bae]['format']],'%s',_0x273f53):_0x273f53;if(_0x36f8a8[_0x4a8bae][_0x3b5a('0x78')]){_0x377445[_0x3b5a('0x6a')](_0x273f53);}_0x36f8a8[_0x4a8bae][_0x3b5a('0x79')]&&_0x377445[_0x3b5a('0x8b')](_0x273f53,_0x36f8a8[_0x4a8bae][_0x3b5a('0x79')]===_0x3b5a('0x7a')?![]:!![]);_0x377445[_0x3b5a('0x6b')](_0x273f53,_0x36f8a8[_0x4a8bae]['alias']||_0x273f53);}if(_0xc3e09d['joins']){_0xc3e09d[_0x3b5a('0x7b')]=JSON[_0x3b5a('0x7c')](_0xc3e09d[_0x3b5a('0x7b')]);for(var _0x457565=0x0;_0x457565<_0xc3e09d[_0x3b5a('0x7b')]['length'];_0x457565+=0x1){if(_0xc3e09d[_0x3b5a('0x7b')][_0x457565][_0x3b5a('0x2c')]&&_['includes'](_0x518c1d,_0xc3e09d['joins'][_0x457565]['type'])&&_0xc3e09d[_0x3b5a('0x7b')][_0x457565]['parentKey']&&_0xc3e09d[_0x3b5a('0x7b')][_0x457565][_0x3b5a('0x7d')]&&_0xc3e09d[_0x3b5a('0x7b')][_0x457565][_0x3b5a('0x7e')]){_0x377445[_0xc3e09d[_0x3b5a('0x7b')][_0x457565]['type']](_0xc3e09d['joins'][_0x457565][_0x3b5a('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0xc3e09d[_0x3b5a('0x73')],_0xc3e09d[_0x3b5a('0x7b')][_0x457565][_0x3b5a('0x7f')],_0xc3e09d['joins'][_0x457565][_0x3b5a('0x7d')],_0xc3e09d[_0x3b5a('0x7b')][_0x457565][_0x3b5a('0x7e')]));}}}if(_0xc3e09d[_0x3b5a('0x80')]){_0xc3e09d[_0x3b5a('0x80')]=JSON[_0x3b5a('0x7c')](_0xc3e09d[_0x3b5a('0x80')]);_0x377445[_0x3b5a('0x35')](_0x11dd9e(_0xc3e09d[_0x3b5a('0x80')][_0x3b5a('0x6a')]));}_0x11a583=_0x377445['clone']();_0x377445[_0x3b5a('0x1d')](_0x15dc26);_0x377445[_0x3b5a('0x1c')](0x0);logger[_0x3b5a('0x8c')](_0x3b5a('0x82'),_0x377445[_0x3b5a('0x83')]());return db[_0x3b5a('0x84')][_0x3b5a('0x2f')](_0x377445[_0x3b5a('0x83')](),{'type':db[_0x3b5a('0x84')][_0x3b5a('0x85')][_0x3b5a('0x86')]});}})[_0x3b5a('0x25')](function(_0x3951f2){if(!_0x3951f2[_0x3b5a('0x42')]){throw new db[(_0x3b5a('0x6f'))][(_0x3b5a('0x70'))](_0x3b5a('0x8d'),0xcc);}if(_0x25e74b[_0x3b5a('0x8e')]===_0x3b5a('0x8f')){return null;}var _0x45e81f=_['merge'](_0x25e74b,{'name':_0x25e74b[_0x3b5a('0x90')]||_0x25e74b['name']||_0xc3e09d[_0x3b5a('0x2a')],'basename':_0x2b2f1c,'savename':util[_0x3b5a('0x77')](_0x3b5a('0x91'),_0x25e74b[_0x3b5a('0x2a')]||_0xc3e09d['name'],require(_0x3b5a('0x92'))[_0x3b5a('0x93')](0x4),_0x25e74b[_0x3b5a('0x8e')]||_0x3b5a('0x94')),'reportId':_0xc3e09d['id'],'reportType':_0x3b5a('0x95')});return db[_0x3b5a('0x96')]['create'](_0x45e81f,{'raw':!![]});})[_0x3b5a('0x25')](function(_0x3a7571){if(_0xc3e09d[_0x3b5a('0x73')]===_0x3b5a('0x97')){_0x11a583[_0x3b5a('0x35')](_0xc3e09d[_0x3b5a('0x73')]+_0x3b5a('0x98'),_0x25e74b['startDate'],_0x25e74b[_0x3b5a('0x99')]);}else{_0x11a583[_0x3b5a('0x35')](_0xc3e09d[_0x3b5a('0x73')]+_0x3b5a('0x9a'),_0x25e74b[_0x3b5a('0x9b')],_0x25e74b[_0x3b5a('0x99')]);}if(_0x3a7571){logger[_0x3b5a('0x9c')](_0x3b5a('0x9d'),_0x11a583[_0x3b5a('0x83')]());require(_0x3b5a('0x9e'))[_0x3b5a('0x9f')](path['join'](__dirname,_0x3b5a('0xa0'),_0x3a7571['output']),[_0x3a7571['id'],_0x11a583['toString'](),path[_0x3b5a('0x52')](__dirname,'../../files/reports',_0x3a7571[_0x3b5a('0xa1')]),_0x2b2f1c]);return _0x3a7571;}else{var _0x4dc5cc=squel[_0x3b5a('0x89')]();_0x4dc5cc['from']('('+_0x11a583[_0x3b5a('0x83')]()+')',_0x3b5a('0xa2'));_0x4dc5cc[_0x3b5a('0x6b')](_0x3b5a('0xa3'),_0x3b5a('0x1b'));_0x11a583[_0x3b5a('0x1d')](_0x25e74b[_0x3b5a('0x1d')]||_0x15dc26);_0x11a583['offset'](_0x25e74b[_0x3b5a('0x1c')]||0x0);return dbH[_0x3b5a('0x84')][_0x3b5a('0x2f')](_0x4dc5cc[_0x3b5a('0x83')](),{'type':dbH[_0x3b5a('0x84')]['QueryTypes'][_0x3b5a('0x86')]})[_0x3b5a('0x25')](function(_0x5adbed){if(!_0x5adbed[_0x3b5a('0x42')]){_0x114e4c=0x0;}else{_0x114e4c=_0x5adbed[0x0]['count']||0x0;}return dbH[_0x3b5a('0x84')][_0x3b5a('0x2f')](_0x11a583['toString'](),{'type':dbH[_0x3b5a('0x84')][_0x3b5a('0x85')][_0x3b5a('0x86')]});})[_0x3b5a('0x25')](function(_0x353a54){return{'rows':_0x353a54||[],'count':_0x114e4c};});}});}exports[_0x3b5a('0xa4')]=function(_0x3f143c,_0x1bdd9f){return runReport(_0x3f143c[_0x3b5a('0x50')],_0x3f143c['query'],_0x3f143c[_0x3b5a('0x39')])[_0x3b5a('0x25')](respondWithResult(_0x1bdd9f,null))['catch'](handleError(_0x1bdd9f,null));};exports[_0x3b5a('0xa5')]=runReport;exports['query']=function(_0x2b333e,_0x4fc43b){var _0x5d5855=0xa;var _0x5f2058=[_0x3b5a('0x52'),'left_join',_0x3b5a('0x54'),_0x3b5a('0x55')];var _0x39c44c={'SUM':_0x3b5a('0x56'),'COUNT':_0x3b5a('0x57'),'COUNT DISTINCT':_0x3b5a('0x87'),'MAX':_0x3b5a('0x58'),'MIN':_0x3b5a('0x59'),'AVG':_0x3b5a('0x5a'),'GROUP_CONCAT':_0x3b5a('0x5b'),'GROUP_CONCAT ASC':_0x3b5a('0x5c'),'GROUP_CONCAT DESC':_0x3b5a('0x5d')};var _0x21803e={'SEC_TO_TIME':_0x3b5a('0x5e'),'DATE':'DATE(%s)','HOUR':_0x3b5a('0x60'),'ROUND':_0x3b5a('0x61'),'UNIX_TIMESTAMP':_0x3b5a('0x62')};var _0x531b04=function(_0x129d2e){return!_['includes'](['IS\x20NULL',_0x3b5a('0x65'),_0x3b5a('0x66'),'IS\x20NOT\x20EMPTY'],_0x129d2e);};var _0x382c8e=function(_0x1c49e2){if(!_0x1c49e2||!_0x1c49e2['rules'][_0x3b5a('0x42')]){return'';}for(var _0x40c20a='(',_0x11aa2c=0x0;_0x11aa2c<_0x1c49e2[_0x3b5a('0x68')][_0x3b5a('0x42')];_0x11aa2c+=0x1){_0x11aa2c>0x0&&(_0x40c20a+='\x20'+_0x1c49e2['operator']+'\x20');_0x40c20a+=_0x1c49e2[_0x3b5a('0x68')][_0x11aa2c][_0x3b5a('0x6a')]?_0x382c8e(_0x1c49e2['rules'][_0x11aa2c][_0x3b5a('0x6a')]):_0x1c49e2[_0x3b5a('0x68')][_0x11aa2c][_0x3b5a('0x6b')]+'\x20'+_0x1c49e2['rules'][_0x11aa2c][_0x3b5a('0x6c')]+(_0x531b04(_0x1c49e2[_0x3b5a('0x68')][_0x11aa2c]['condition'])?'\x20'+_0x1c49e2['rules'][_0x11aa2c][_0x3b5a('0x6d')]:'');}return _0x40c20a+')';};var _0x3032cc={'where':{'id':_0x2b333e[_0x3b5a('0x50')]['id']}},_0x426934,_0x5cd80b,_0x2ebbf0,_0x3f4b0b,_0x329dcc;_0x3032cc=_[_0x3b5a('0x37')]({},_0x3032cc,_0x2b333e[_0x3b5a('0x39')]);return db['AnalyticDefaultReport'][_0x3b5a('0x43')](_0x3032cc)[_0x3b5a('0x25')](function(_0x3c4607){if(_0x3c4607){_0x426934=_0x3c4607;return _0x3c4607[_0x3b5a('0x6e')]();}return null;})[_0x3b5a('0x25')](function(_0x3c8ff4){if(_0x3c8ff4){if(!_0x3c8ff4[_0x3b5a('0x42')]){throw new db[(_0x3b5a('0x6f'))]['ValidationErrorItem'](_0x3b5a('0x88'),0x193);}_0x5cd80b=_0x3c8ff4;return db[_0x3b5a('0x71')][_0x3b5a('0x3d')]({'raw':!![]});}return null;})[_0x3b5a('0x25')](function(_0xa01a13){if(_0xa01a13){_0x2ebbf0=_[_0x3b5a('0x72')](_0xa01a13,'id');var _0x56f9b0;var _0x4ed91c=squel[_0x3b5a('0x89')]();_0x4ed91c[_0x3b5a('0xa6')](_0x426934[_0x3b5a('0x73')]);for(var _0x577846=0x0;_0x577846<_0x5cd80b[_0x3b5a('0x42')];_0x577846+=0x1){_0x56f9b0=_0x5cd80b[_0x577846][_0x3b5a('0x74')]?_0x2ebbf0[_0x5cd80b[_0x577846][_0x3b5a('0x74')]]['metric']:_0x5cd80b[_0x577846][_0x3b5a('0x6b')];_0x56f9b0=_0x5cd80b[_0x577846]['function']?_[_0x3b5a('0x76')](_0x39c44c[_0x5cd80b[_0x577846]['function']],'%s',_0x56f9b0):_0x56f9b0;_0x56f9b0=_0x5cd80b[_0x577846][_0x3b5a('0x77')]?_[_0x3b5a('0x76')](_0x21803e[_0x5cd80b[_0x577846][_0x3b5a('0x77')]],'%s',_0x56f9b0):_0x56f9b0;if(_0x5cd80b[_0x577846][_0x3b5a('0x78')]){_0x4ed91c[_0x3b5a('0x6a')](_0x56f9b0);}_0x5cd80b[_0x577846][_0x3b5a('0x79')]&&_0x4ed91c[_0x3b5a('0x8b')](_0x56f9b0,_0x5cd80b[_0x577846][_0x3b5a('0x79')]===_0x3b5a('0x7a')?![]:!![]);_0x4ed91c[_0x3b5a('0x6b')](_0x56f9b0,_0x5cd80b[_0x577846][_0x3b5a('0xa7')]||_0x56f9b0);}if(_0x426934[_0x3b5a('0x7b')]){_0x426934[_0x3b5a('0x7b')]=JSON[_0x3b5a('0x7c')](_0x426934['joins']);for(var _0x12fd84=0x0;_0x12fd84<_0x426934[_0x3b5a('0x7b')][_0x3b5a('0x42')];_0x12fd84+=0x1){if(_0x426934[_0x3b5a('0x7b')][_0x12fd84][_0x3b5a('0x2c')]&&_[_0x3b5a('0x63')](_0x5f2058,_0x426934[_0x3b5a('0x7b')][_0x12fd84]['type'])&&_0x426934[_0x3b5a('0x7b')][_0x12fd84]['parentKey']&&_0x426934[_0x3b5a('0x7b')][_0x12fd84]['foreignTable']&&_0x426934[_0x3b5a('0x7b')][_0x12fd84][_0x3b5a('0x7e')]){_0x4ed91c[_0x426934[_0x3b5a('0x7b')][_0x12fd84][_0x3b5a('0x2c')]](_0x426934[_0x3b5a('0x7b')][_0x12fd84][_0x3b5a('0x7d')],null,util[_0x3b5a('0x77')](_0x3b5a('0xa8'),_0x426934['table'],_0x426934[_0x3b5a('0x7b')][_0x12fd84]['parentKey'],_0x426934[_0x3b5a('0x7b')][_0x12fd84][_0x3b5a('0x7d')],_0x426934[_0x3b5a('0x7b')][_0x12fd84]['foreignKey']));}}}if(_0x426934[_0x3b5a('0x80')]){_0x426934[_0x3b5a('0x80')]=JSON[_0x3b5a('0x7c')](_0x426934[_0x3b5a('0x80')]);_0x4ed91c[_0x3b5a('0x35')](_0x382c8e(_0x426934[_0x3b5a('0x80')][_0x3b5a('0x6a')]));}_0x329dcc=_0x4ed91c[_0x3b5a('0x81')]();_0x4ed91c[_0x3b5a('0x1d')](_0x5d5855);_0x4ed91c['offset'](0x0);logger[_0x3b5a('0x8c')]('Limited\x20Query:',_0x4ed91c[_0x3b5a('0x83')]());return db['sequelize'][_0x3b5a('0x2f')](_0x4ed91c[_0x3b5a('0x83')](),{'type':db[_0x3b5a('0x84')][_0x3b5a('0x85')]['SELECT']});}})[_0x3b5a('0x25')](function(){return{'sql':_0x329dcc[_0x3b5a('0x83')]()};})[_0x3b5a('0x25')](respondWithResult(_0x4fc43b,null))['catch'](handleError(_0x4fc43b,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3dfb5f3..ef84070 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 _0x6836=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird'];(function(_0x1c1a3e,_0x1f2e52){var _0x1c683e=function(_0x433ba6){while(--_0x433ba6){_0x1c1a3e['push'](_0x1c1a3e['shift']());}};_0x1c683e(++_0x1f2e52);}(_0x6836,0x133));var _0x6683=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6836[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var logger=require('../../config/logger')(_0x6683('0x2'));var moment=require(_0x6683('0x3'));var BPromise=require(_0x6683('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6683('0x5'));var rimraf=require(_0x6683('0x6'));var config=require(_0x6683('0x7'));var attributes=require(_0x6683('0x8'));module[_0x6683('0x9')]=function(_0x51779a,_0x57649d){return _0x51779a[_0x6683('0xa')](_0x6683('0xb'),attributes,{'tableName':_0x6683('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe41f=['../../config/logger','api','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x1193eb,_0x2a1969){var _0x5507f2=function(_0x3bc111){while(--_0x3bc111){_0x1193eb['push'](_0x1193eb['shift']());}};_0x5507f2(++_0x2a1969);}(_0xe41f,0x13e));var _0xfe41=function(_0x470ce2,_0x56e10e){_0x470ce2=_0x470ce2-0x0;var _0x4b62ef=_0xe41f[_0x470ce2];return _0x4b62ef;};'use strict';var _=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var logger=require(_0xfe41('0x2'))(_0xfe41('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe41('0x4'));var rimraf=require(_0xfe41('0x5'));var config=require(_0xfe41('0x6'));var attributes=require(_0xfe41('0x7'));module['exports']=function(_0x52d56e,_0x2e8e86){return _0x52d56e['define'](_0xfe41('0x8'),attributes,{'tableName':_0xfe41('0x9'),'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 03a21ae..cc53909 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 _0xa74d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xa74d,0x1cf));var _0xda74=function(_0x3386ba,_0x572947){_0x3386ba=_0x3386ba-0x0;var _0x1763b0=_0xa74d[_0x3386ba];return _0x1763b0;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2113f2,_0x3fa4e7,_0x5da443){return new BPromise(function(_0x23d5f5,_0x517251){return client['request'](_0x2113f2,_0x5da443)[_0xda74('0xc')](function(_0x411790){logger['info'](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));logger[_0xda74('0xf')](_0xda74('0x10'),_0x3fa4e7,_0xda74('0xe'),JSON[_0xda74('0x11')](_0x411790));if(_0x411790[_0xda74('0x12')]){if(_0x411790[_0xda74('0x12')]['code']===0x1f4){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')]['message']);return _0x517251(_0x411790[_0xda74('0x12')][_0xda74('0x13')]);}logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')][_0xda74('0x13')]);return _0x23d5f5(_0x411790[_0xda74('0x12')]['message']);}else{logger[_0xda74('0x14')](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));_0x23d5f5(_0x411790[_0xda74('0x15')][_0xda74('0x13')]);}})['catch'](function(_0x1535d3){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x1535d3);_0x517251(_0x1535d3);});});} \ No newline at end of file +var _0xb240=['http','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb240,0x7e));var _0x0b24=function(_0x19077d,_0xc78ed3){_0x19077d=_0x19077d-0x0;var _0xa92eae=_0xb240[_0x19077d];return _0xa92eae;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var moment=require(_0x0b24('0x2'));var BPromise=require(_0x0b24('0x3'));var rs=require(_0x0b24('0x4'));var fs=require('fs');var Redis=require(_0x0b24('0x5'));var db=require(_0x0b24('0x6'))['db'];var utils=require(_0x0b24('0x7'));var logger=require(_0x0b24('0x8'))('rpc');var config=require(_0x0b24('0x9'));var jayson=require(_0x0b24('0xa'));var client=jayson[_0x0b24('0xb')][_0x0b24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162a50,_0x53526b,_0x238a19){return new BPromise(function(_0x34be24,_0x41b7b9){return client['request'](_0x162a50,_0x238a19)['then'](function(_0x2679d5){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x53526b,_0x0b24('0xd'));logger[_0x0b24('0xe')](_0x0b24('0xf'),_0x53526b,_0x0b24('0xd'),JSON[_0x0b24('0x10')](_0x2679d5));if(_0x2679d5[_0x0b24('0x11')]){if(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x12')]===0x1f4){logger['error'](_0x0b24('0x13'),_0x53526b,_0x2679d5[_0x0b24('0x11')]['message']);return _0x41b7b9(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x14')]);}logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x2679d5['error']['message']);return _0x34be24(_0x2679d5['error']['message']);}else{logger[_0x0b24('0x15')](_0x0b24('0x13'),_0x53526b,_0x0b24('0xd'));_0x34be24(_0x2679d5['result'][_0x0b24('0x14')]);}})[_0x0b24('0x16')](function(_0x1fd966){logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x1fd966);_0x41b7b9(_0x1fd966);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 52d6133..2ea4c96 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 _0xf985=['/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x5c832a,_0x557d78){var _0x30c4c9=function(_0x50f481){while(--_0x50f481){_0x5c832a['push'](_0x5c832a['shift']());}};_0x30c4c9(++_0x557d78);}(_0xf985,0x107));var _0x5f98=function(_0x2ee77d,_0x46871f){_0x2ee77d=_0x2ee77d-0x0;var _0x161346=_0xf985[_0x2ee77d];return _0x161346;};'use strict';var multer=require(_0x5f98('0x0'));var util=require(_0x5f98('0x1'));var path=require(_0x5f98('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f98('0x3'));var router=express[_0x5f98('0x4')]();var auth=require(_0x5f98('0x5'));var interaction=require(_0x5f98('0x6'));var config=require(_0x5f98('0x7'));var controller=require(_0x5f98('0x8'));router[_0x5f98('0x9')]('/',auth[_0x5f98('0xa')](),controller[_0x5f98('0xb')]);router[_0x5f98('0x9')](_0x5f98('0xc'),auth[_0x5f98('0xa')](),controller[_0x5f98('0xd')]);router['get'](_0x5f98('0xe'),auth[_0x5f98('0xa')](),controller[_0x5f98('0xf')]);router['get'](_0x5f98('0x10'),auth[_0x5f98('0xa')](),controller[_0x5f98('0x11')]);router['get'](_0x5f98('0x12'),auth[_0x5f98('0xa')](),controller[_0x5f98('0x13')]);router[_0x5f98('0x14')]('/',auth[_0x5f98('0xa')](),controller[_0x5f98('0x15')]);router[_0x5f98('0x16')](_0x5f98('0xc'),auth[_0x5f98('0xa')](),controller[_0x5f98('0x17')]);router['delete'](_0x5f98('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5f98('0x18')]=router; \ No newline at end of file +var _0xb4fd=['isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','query','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb4fd,0xfe));var _0xdb4f=function(_0x2dc15d,_0x3b17c4){_0x2dc15d=_0x2dc15d-0x0;var _0x2727c5=_0xb4fd[_0x2dc15d];return _0x2727c5;};'use strict';var multer=require(_0xdb4f('0x0'));var util=require(_0xdb4f('0x1'));var path=require(_0xdb4f('0x2'));var timeout=require(_0xdb4f('0x3'));var express=require(_0xdb4f('0x4'));var router=express[_0xdb4f('0x5')]();var auth=require(_0xdb4f('0x6'));var interaction=require(_0xdb4f('0x7'));var config=require(_0xdb4f('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0xdb4f('0x9')]('/',auth[_0xdb4f('0xa')](),controller[_0xdb4f('0xb')]);router['get'](_0xdb4f('0xc'),auth[_0xdb4f('0xa')](),controller[_0xdb4f('0xd')]);router[_0xdb4f('0x9')](_0xdb4f('0xe'),auth[_0xdb4f('0xa')](),controller['preview']);router['get']('/:id/run',auth[_0xdb4f('0xa')](),controller[_0xdb4f('0xf')]);router[_0xdb4f('0x9')](_0xdb4f('0x10'),auth[_0xdb4f('0xa')](),controller[_0xdb4f('0x11')]);router['post']('/',auth[_0xdb4f('0xa')](),controller['create']);router[_0xdb4f('0x12')](_0xdb4f('0xc'),auth[_0xdb4f('0xa')](),controller[_0xdb4f('0x13')]);router[_0xdb4f('0x14')](_0xdb4f('0xc'),auth[_0xdb4f('0xa')](),controller[_0xdb4f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 7db0c84..e8c41fe 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 _0xb2e7=['pdf','DATE','Loading','ENUM','scheduled','manual','INTEGER','moment','exports','STRING','csv'];(function(_0x29f55e,_0x548671){var _0x507762=function(_0x24f990){while(--_0x24f990){_0x29f55e['push'](_0x29f55e['shift']());}};_0x507762(++_0x548671);}(_0xb2e7,0x80));var _0x7b2e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb2e7[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7b2e('0x0'));module[_0x7b2e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x7b2e('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x7b2e('0x3'),_0x7b2e('0x4'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x7b2e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x7b2e('0x5')]},'status':{'type':Sequelize[_0x7b2e('0x2')],'defaultValue':_0x7b2e('0x6')},'type':{'type':Sequelize[_0x7b2e('0x7')]('manual',_0x7b2e('0x8')),'allowNull':![],'defaultValue':_0x7b2e('0x9')},'reportId':{'type':Sequelize[_0x7b2e('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7b2e('0x2')]}}; \ No newline at end of file +var _0x2d77=['UNSIGNED','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual','scheduled'];(function(_0x138fdd,_0x417b8b){var _0x38a9e6=function(_0x3fca29){while(--_0x3fca29){_0x138fdd['push'](_0x138fdd['shift']());}};_0x38a9e6(++_0x417b8b);}(_0x2d77,0x155));var _0x72d7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2d77[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x72d7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x72d7('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x72d7('0x2')](_0x72d7('0x3'),_0x72d7('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x72d7('0x3')},'savename':{'type':Sequelize[_0x72d7('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x72d7('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x72d7('0x6')},'type':{'type':Sequelize[_0x72d7('0x2')](_0x72d7('0x7'),_0x72d7('0x8')),'allowNull':![],'defaultValue':_0x72d7('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x72d7('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0a49290..c97a56a 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 _0x4a9b=['includeAll','include','findAll','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','update','then','get','end','sendStatus','stack','send','map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','AnalyticExtractedReport','count'];(function(_0x3c1981,_0xf6016c){var _0x199617=function(_0x46eca2){while(--_0x46eca2){_0x3c1981['push'](_0x3c1981['shift']());}};_0x199617(++_0xf6016c);}(_0x4a9b,0x137));var _0xb4a9=function(_0x37a042,_0x2c307a){_0x37a042=_0x37a042-0x0;var _0x19a727=_0x4a9b[_0x37a042];return _0x19a727;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb4a9('0x0'));var rimraf=require(_0xb4a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4a9('0x2'));var rp=require(_0xb4a9('0x3'));var moment=require('moment');var BPromise=require(_0xb4a9('0x4'));var Mustache=require(_0xb4a9('0x5'));var util=require(_0xb4a9('0x6'));var path=require(_0xb4a9('0x7'));var sox=require(_0xb4a9('0x8'));var csv=require(_0xb4a9('0x9'));var ejs=require(_0xb4a9('0xa'));var fs=require('fs');var _=require(_0xb4a9('0xb'));var squel=require(_0xb4a9('0xc'));var crypto=require(_0xb4a9('0xd'));var jsforce=require(_0xb4a9('0xe'));var deskjs=require(_0xb4a9('0xf'));var toCsv=require(_0xb4a9('0x9'));var querystring=require(_0xb4a9('0x10'));var Papa=require('papaparse');var Redis=require(_0xb4a9('0x11'));var authService=require(_0xb4a9('0x12'));var qs=require(_0xb4a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4a9('0x14'));var logger=require(_0xb4a9('0x15'))('api');var utils=require(_0xb4a9('0x16'));var config=require(_0xb4a9('0x17'));var db=require(_0xb4a9('0x18'))['db'];function respondWithStatusCode(_0x3d1739,_0x5aceba){_0x5aceba=_0x5aceba||0xcc;return function(_0x50d066){if(_0x50d066){return _0x3d1739['sendStatus'](_0x5aceba);}return _0x3d1739['status'](_0x5aceba)['end']();};}function respondWithResult(_0x3eade2,_0x4ab95a){_0x4ab95a=_0x4ab95a||0xc8;return function(_0xd8d9a0){if(_0xd8d9a0){return _0x3eade2[_0xb4a9('0x19')](_0x4ab95a)['json'](_0xd8d9a0);}};}function respondWithFilteredResult(_0x10c4d5,_0x575355){return function(_0x1a0d62){if(_0x1a0d62){var _0x161041=_0x1a0d62['count'],_0x24cddc=_0x575355[_0xb4a9('0x1a')],_0x315b4d=_0x575355[_0xb4a9('0x1a')]+_0x575355[_0xb4a9('0x1b')],_0x57be41;if(_0x315b4d>=_0x161041){_0x315b4d=_0x161041;_0x57be41=0xc8;}else{_0x57be41=0xce;}_0x10c4d5[_0xb4a9('0x19')](_0x57be41);return _0x10c4d5[_0xb4a9('0x1c')](_0xb4a9('0x1d'),_0x24cddc+'-'+_0x315b4d+'/'+_0x161041)[_0xb4a9('0x1e')](_0x1a0d62);}return null;};}function patchUpdates(_0x5c1749){return function(_0x267be4){try{jsonpatch[_0xb4a9('0x1f')](_0x267be4,_0x5c1749,!![]);}catch(_0x557d61){return BPromise['reject'](_0x557d61);}return _0x267be4['save']();};}function saveUpdates(_0x455ea0,_0x36f66b){return function(_0x528a06){if(_0x528a06){return _0x528a06[_0xb4a9('0x20')](_0x455ea0)[_0xb4a9('0x21')](function(_0x479a66){return _0x479a66;});}return null;};}function removeEntity(_0x3686a6,_0x2c13c7){return function(_0x49b87f){if(_0x49b87f){return _0x49b87f['destroy']()[_0xb4a9('0x21')](function(){var _0x312c7a=_0x49b87f[_0xb4a9('0x22')]({'plain':!![]});var _0x3284bc='ExtractedReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x3284bc,'resourceId':_0x312c7a['id']}})[_0xb4a9('0x21')](function(){return _0x49b87f;});})[_0xb4a9('0x21')](function(){_0x3686a6[_0xb4a9('0x19')](0xcc)[_0xb4a9('0x23')]();});}};}function handleEntityNotFound(_0x1a1dcf,_0x34b15b){return function(_0x460f5f){if(!_0x460f5f){_0x1a1dcf[_0xb4a9('0x24')](0x194);}return _0x460f5f;};}function handleError(_0x521e00,_0xd016e2){_0xd016e2=_0xd016e2||0x1f4;return function(_0x23e2b4){logger['error'](_0x23e2b4[_0xb4a9('0x25')]);if(_0x23e2b4['name']){delete _0x23e2b4['name'];}_0x521e00[_0xb4a9('0x19')](_0xd016e2)[_0xb4a9('0x26')](_0x23e2b4);};}exports['index']=function(_0x4a1b6c,_0x2f7403){var _0x246e99={},_0x5812e2={},_0x1673a1={'count':0x0,'rows':[]};var _0x345deb=_[_0xb4a9('0x27')](db['AnalyticExtractedReport'][_0xb4a9('0x28')],function(_0x15543d){return{'name':_0x15543d['fieldName'],'type':_0x15543d[_0xb4a9('0x29')][_0xb4a9('0x2a')]};});_0x5812e2['model']=_[_0xb4a9('0x27')](_0x345deb,'name');_0x5812e2[_0xb4a9('0x2b')]=_[_0xb4a9('0x2c')](_0x4a1b6c['query']);_0x5812e2['filters']=_[_0xb4a9('0x2d')](_0x5812e2[_0xb4a9('0x2e')],_0x5812e2['query']);_0x246e99['attributes']=_[_0xb4a9('0x2d')](_0x5812e2[_0xb4a9('0x2e')],qs[_0xb4a9('0x2f')](_0x4a1b6c['query'][_0xb4a9('0x2f')]));_0x246e99[_0xb4a9('0x30')]=_0x246e99[_0xb4a9('0x30')][_0xb4a9('0x31')]?_0x246e99[_0xb4a9('0x30')]:_0x5812e2[_0xb4a9('0x2e')];if(!_0x4a1b6c[_0xb4a9('0x2b')]['hasOwnProperty'](_0xb4a9('0x32'))){_0x246e99[_0xb4a9('0x1b')]=qs[_0xb4a9('0x1b')](_0x4a1b6c['query'][_0xb4a9('0x1b')]);_0x246e99[_0xb4a9('0x1a')]=qs[_0xb4a9('0x1a')](_0x4a1b6c[_0xb4a9('0x2b')][_0xb4a9('0x1a')]);}_0x246e99[_0xb4a9('0x33')]=qs[_0xb4a9('0x34')](_0x4a1b6c[_0xb4a9('0x2b')][_0xb4a9('0x34')]);_0x246e99[_0xb4a9('0x35')]=qs['filters'](_['pick'](_0x4a1b6c[_0xb4a9('0x2b')],_0x5812e2[_0xb4a9('0x36')]),_0x345deb);if(_0x4a1b6c[_0xb4a9('0x2b')]['filter']){_0x246e99[_0xb4a9('0x35')]=_[_0xb4a9('0x37')](_0x246e99[_0xb4a9('0x35')],{'$or':_[_0xb4a9('0x27')](_0x345deb,function(_0x3a75c8){if(_0x3a75c8[_0xb4a9('0x29')]!==_0xb4a9('0x38')){var _0x1e76fc={};_0x1e76fc[_0x3a75c8['name']]={'$like':'%'+_0x4a1b6c[_0xb4a9('0x2b')][_0xb4a9('0x39')]+'%'};return _0x1e76fc;}})});}_0x246e99=_['merge']({},_0x246e99,_0x4a1b6c[_0xb4a9('0x3a')]);var _0x249897={'where':_0x246e99[_0xb4a9('0x35')]};return db[_0xb4a9('0x3b')]['count'](_0x249897)[_0xb4a9('0x21')](function(_0x2d7f7e){_0x1673a1[_0xb4a9('0x3c')]=_0x2d7f7e;if(_0x4a1b6c[_0xb4a9('0x2b')][_0xb4a9('0x3d')]){_0x246e99[_0xb4a9('0x3e')]=[{'all':!![]}];}return db[_0xb4a9('0x3b')][_0xb4a9('0x3f')](_0x246e99);})[_0xb4a9('0x21')](function(_0xebac1a){_0x1673a1['rows']=_0xebac1a;return _0x1673a1;})['then'](respondWithFilteredResult(_0x2f7403,_0x246e99))['catch'](handleError(_0x2f7403,null));};exports['show']=function(_0x56ff7b,_0x40d8a5){var _0x2752c4={'raw':!![],'where':{'id':_0x56ff7b[_0xb4a9('0x40')]['id']}},_0x31354a={};_0x31354a[_0xb4a9('0x2e')]=_[_0xb4a9('0x2c')](db[_0xb4a9('0x3b')][_0xb4a9('0x28')]);_0x31354a[_0xb4a9('0x2b')]=_[_0xb4a9('0x2c')](_0x56ff7b[_0xb4a9('0x2b')]);_0x31354a[_0xb4a9('0x36')]=_[_0xb4a9('0x2d')](_0x31354a[_0xb4a9('0x2e')],_0x31354a[_0xb4a9('0x2b')]);_0x2752c4[_0xb4a9('0x30')]=_[_0xb4a9('0x2d')](_0x31354a[_0xb4a9('0x2e')],qs[_0xb4a9('0x2f')](_0x56ff7b[_0xb4a9('0x2b')][_0xb4a9('0x2f')]));_0x2752c4[_0xb4a9('0x30')]=_0x2752c4[_0xb4a9('0x30')][_0xb4a9('0x31')]?_0x2752c4[_0xb4a9('0x30')]:_0x31354a[_0xb4a9('0x2e')];if(_0x56ff7b[_0xb4a9('0x2b')][_0xb4a9('0x3d')]){_0x2752c4[_0xb4a9('0x3e')]=[{'all':!![]}];}_0x2752c4=_['merge']({},_0x2752c4,_0x56ff7b['options']);return db['AnalyticExtractedReport'][_0xb4a9('0x41')](_0x2752c4)[_0xb4a9('0x21')](handleEntityNotFound(_0x40d8a5,null))[_0xb4a9('0x21')](respondWithResult(_0x40d8a5,null))[_0xb4a9('0x42')](handleError(_0x40d8a5,null));};exports['create']=function(_0x55aae9,_0x1d69fb){return db[_0xb4a9('0x3b')][_0xb4a9('0x43')](_0x55aae9[_0xb4a9('0x44')],{})[_0xb4a9('0x21')](function(_0x857f7e){var _0x33dab5=_0x55aae9[_0xb4a9('0x45')][_0xb4a9('0x22')]({'plain':!![]});if(!_0x33dab5)throw new Error(_0xb4a9('0x46'));if(_0x33dab5['role']===_0xb4a9('0x45')){var _0x65d8ed=_0x857f7e['get']({'plain':!![]});var _0x1c3dc7='ExtractedReports';return db[_0xb4a9('0x47')][_0xb4a9('0x41')]({'where':{'name':_0x1c3dc7,'userProfileId':_0x33dab5[_0xb4a9('0x48')]},'raw':!![]})[_0xb4a9('0x21')](function(_0x1699bd){if(_0x1699bd&&_0x1699bd[_0xb4a9('0x49')]===0x0){return db[_0xb4a9('0x4a')][_0xb4a9('0x43')]({'name':_0x65d8ed['name'],'resourceId':_0x65d8ed['id'],'type':_0x1699bd[_0xb4a9('0x4b')],'sectionId':_0x1699bd['id']},{})[_0xb4a9('0x21')](function(){return _0x857f7e;});}else{return _0x857f7e;}})[_0xb4a9('0x42')](function(_0x543144){logger[_0xb4a9('0x4c')](_0xb4a9('0x4d'),_0x543144);throw _0x543144;});}return _0x857f7e;})['then'](respondWithResult(_0x1d69fb,0xc9))[_0xb4a9('0x42')](handleError(_0x1d69fb,null));};exports[_0xb4a9('0x20')]=function(_0x1a6cdf,_0x142772){if(_0x1a6cdf[_0xb4a9('0x44')]['id']){delete _0x1a6cdf[_0xb4a9('0x44')]['id'];}return db[_0xb4a9('0x3b')]['find']({'where':{'id':_0x1a6cdf['params']['id']}})[_0xb4a9('0x21')](handleEntityNotFound(_0x142772,null))['then'](saveUpdates(_0x1a6cdf[_0xb4a9('0x44')],null))['then'](respondWithResult(_0x142772,null))[_0xb4a9('0x42')](handleError(_0x142772,null));};exports[_0xb4a9('0x4e')]=function(_0x131e4d,_0x2722a6){return db[_0xb4a9('0x3b')][_0xb4a9('0x41')]({'where':{'id':_0x131e4d[_0xb4a9('0x40')]['id']}})[_0xb4a9('0x21')](handleEntityNotFound(_0x2722a6,null))[_0xb4a9('0x21')](removeEntity(_0x2722a6,null))['catch'](handleError(_0x2722a6,null));};exports[_0xb4a9('0x4f')]=function(_0x29057e,_0xf5f30,_0x2110c1){return db[_0xb4a9('0x3b')]['find']({'where':{'id':_0x29057e[_0xb4a9('0x40')]['id']},'attributes':['name',_0xb4a9('0x50'),_0xb4a9('0x51'),_0xb4a9('0x52')],'raw':!![]})[_0xb4a9('0x21')](handleEntityNotFound(_0xf5f30,null))[_0xb4a9('0x21')](function(_0x1ca007){if(_0x1ca007){if(!fs[_0xb4a9('0x53')](path[_0xb4a9('0x54')](config['root'],_0xb4a9('0x55'),_0x1ca007[_0xb4a9('0x51')]))){throw new db[(_0xb4a9('0x56'))][(_0xb4a9('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x29057e[_0xb4a9('0x2b')][_0xb4a9('0x58')]){return _0xf5f30['sendStatus'](0xc8);}return _0xf5f30[_0xb4a9('0x4f')](path[_0xb4a9('0x54')](config[_0xb4a9('0x59')],_0xb4a9('0x55'),_0x1ca007[_0xb4a9('0x51')]),util[_0xb4a9('0x5a')](_0xb4a9('0x5b'),_0x1ca007[_0xb4a9('0x50')]||_0x1ca007['name'],_0x1ca007['output'][_0xb4a9('0x5c')]()));}})[_0xb4a9('0x42')](handleError(_0xf5f30,null));}; \ No newline at end of file +var _0x3f8c=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','download','basename','savename','output','existsSync','join','root','Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','toLowerCase','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','UserProfileResource','error','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','nolimit','order','sort','where','filters','merge','options','include','show','fields','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation'];(function(_0x24ecf0,_0x561852){var _0x1f25f3=function(_0x1bf225){while(--_0x1bf225){_0x24ecf0['push'](_0x24ecf0['shift']());}};_0x1f25f3(++_0x561852);}(_0x3f8c,0x167));var _0xc3f8=function(_0x1b7777,_0x41ab78){_0x1b7777=_0x1b7777-0x0;var _0x2a1aa8=_0x3f8c[_0x1b7777];return _0x2a1aa8;};'use strict';var pdf=require(_0xc3f8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f8('0x2'));var rp=require(_0xc3f8('0x3'));var moment=require(_0xc3f8('0x4'));var BPromise=require(_0xc3f8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc3f8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc3f8('0x7'));var fs=require('fs');var _=require(_0xc3f8('0x8'));var squel=require(_0xc3f8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc3f8('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xc3f8('0xb'));var as=require(_0xc3f8('0xc'));var hardwareService=require(_0xc3f8('0xd'));var logger=require('../../config/logger')(_0xc3f8('0xe'));var utils=require(_0xc3f8('0xf'));var config=require(_0xc3f8('0x10'));var db=require(_0xc3f8('0x11'))['db'];function respondWithStatusCode(_0x2daf3f,_0x52ef61){_0x52ef61=_0x52ef61||0xcc;return function(_0x35392c){if(_0x35392c){return _0x2daf3f[_0xc3f8('0x12')](_0x52ef61);}return _0x2daf3f[_0xc3f8('0x13')](_0x52ef61)[_0xc3f8('0x14')]();};}function respondWithResult(_0x1e0df9,_0x488c58){_0x488c58=_0x488c58||0xc8;return function(_0x4aff47){if(_0x4aff47){return _0x1e0df9['status'](_0x488c58)['json'](_0x4aff47);}};}function respondWithFilteredResult(_0x12cb45,_0x3bf1b9){return function(_0x3b9a6d){if(_0x3b9a6d){var _0x31eb03=_0x3b9a6d[_0xc3f8('0x15')],_0x3c214c=_0x3bf1b9[_0xc3f8('0x16')],_0x19391b=_0x3bf1b9[_0xc3f8('0x16')]+_0x3bf1b9[_0xc3f8('0x17')],_0xbb641b;if(_0x19391b>=_0x31eb03){_0x19391b=_0x31eb03;_0xbb641b=0xc8;}else{_0xbb641b=0xce;}_0x12cb45[_0xc3f8('0x13')](_0xbb641b);return _0x12cb45[_0xc3f8('0x18')](_0xc3f8('0x19'),_0x3c214c+'-'+_0x19391b+'/'+_0x31eb03)[_0xc3f8('0x1a')](_0x3b9a6d);}return null;};}function patchUpdates(_0x39c6e7){return function(_0x146d92){try{jsonpatch[_0xc3f8('0x1b')](_0x146d92,_0x39c6e7,!![]);}catch(_0x10fb9d){return BPromise[_0xc3f8('0x1c')](_0x10fb9d);}return _0x146d92[_0xc3f8('0x1d')]();};}function saveUpdates(_0x145fa4,_0x1cdfc5){return function(_0x82a523){if(_0x82a523){return _0x82a523['update'](_0x145fa4)['then'](function(_0x2f6508){return _0x2f6508;});}return null;};}function removeEntity(_0xab16d3,_0x393b69){return function(_0x81368c){if(_0x81368c){return _0x81368c[_0xc3f8('0x1e')]()[_0xc3f8('0x1f')](function(){var _0x1d5817=_0x81368c[_0xc3f8('0x20')]({'plain':!![]});var _0x26f8a3='ExtractedReports';return db[_0xc3f8('0x21')][_0xc3f8('0x1e')]({'where':{'type':_0x26f8a3,'resourceId':_0x1d5817['id']}})[_0xc3f8('0x1f')](function(){return _0x81368c;});})['then'](function(){_0xab16d3[_0xc3f8('0x13')](0xcc)[_0xc3f8('0x14')]();});}};}function handleEntityNotFound(_0x158834,_0x574f64){return function(_0x4897cf){if(!_0x4897cf){_0x158834[_0xc3f8('0x12')](0x194);}return _0x4897cf;};}function handleError(_0xb41ad2,_0x51ca06){_0x51ca06=_0x51ca06||0x1f4;return function(_0x1671f9){logger[_0xc3f8('0x22')](_0x1671f9['stack']);if(_0x1671f9['name']){delete _0x1671f9[_0xc3f8('0x23')];}_0xb41ad2['status'](_0x51ca06)[_0xc3f8('0x24')](_0x1671f9);};}exports[_0xc3f8('0x25')]=function(_0x23fdb8,_0x98ab53){var _0x5579dd={},_0x244f80={},_0x4e2329={'count':0x0,'rows':[]};var _0x184858=_['map'](db[_0xc3f8('0x26')][_0xc3f8('0x27')],function(_0x33e3a5){return{'name':_0x33e3a5[_0xc3f8('0x28')],'type':_0x33e3a5[_0xc3f8('0x29')][_0xc3f8('0x2a')]};});_0x244f80[_0xc3f8('0x2b')]=_[_0xc3f8('0x2c')](_0x184858,'name');_0x244f80[_0xc3f8('0x2d')]=_[_0xc3f8('0x2e')](_0x23fdb8[_0xc3f8('0x2d')]);_0x244f80['filters']=_[_0xc3f8('0x2f')](_0x244f80['model'],_0x244f80[_0xc3f8('0x2d')]);_0x5579dd[_0xc3f8('0x30')]=_[_0xc3f8('0x2f')](_0x244f80[_0xc3f8('0x2b')],qs['fields'](_0x23fdb8[_0xc3f8('0x2d')]['fields']));_0x5579dd[_0xc3f8('0x30')]=_0x5579dd[_0xc3f8('0x30')]['length']?_0x5579dd['attributes']:_0x244f80[_0xc3f8('0x2b')];if(!_0x23fdb8[_0xc3f8('0x2d')]['hasOwnProperty'](_0xc3f8('0x31'))){_0x5579dd[_0xc3f8('0x17')]=qs['limit'](_0x23fdb8['query'][_0xc3f8('0x17')]);_0x5579dd[_0xc3f8('0x16')]=qs[_0xc3f8('0x16')](_0x23fdb8[_0xc3f8('0x2d')]['offset']);}_0x5579dd[_0xc3f8('0x32')]=qs[_0xc3f8('0x33')](_0x23fdb8[_0xc3f8('0x2d')][_0xc3f8('0x33')]);_0x5579dd[_0xc3f8('0x34')]=qs[_0xc3f8('0x35')](_['pick'](_0x23fdb8[_0xc3f8('0x2d')],_0x244f80[_0xc3f8('0x35')]),_0x184858);if(_0x23fdb8[_0xc3f8('0x2d')]['filter']){_0x5579dd[_0xc3f8('0x34')]=_[_0xc3f8('0x36')](_0x5579dd['where'],{'$or':_['map'](_0x184858,function(_0x3f4065){if(_0x3f4065[_0xc3f8('0x29')]!=='VIRTUAL'){var _0x15d19e={};_0x15d19e[_0x3f4065[_0xc3f8('0x23')]]={'$like':'%'+_0x23fdb8[_0xc3f8('0x2d')]['filter']+'%'};return _0x15d19e;}})});}_0x5579dd=_[_0xc3f8('0x36')]({},_0x5579dd,_0x23fdb8[_0xc3f8('0x37')]);var _0x5d448d={'where':_0x5579dd['where']};return db[_0xc3f8('0x26')][_0xc3f8('0x15')](_0x5d448d)[_0xc3f8('0x1f')](function(_0x54914b){_0x4e2329['count']=_0x54914b;if(_0x23fdb8[_0xc3f8('0x2d')]['includeAll']){_0x5579dd[_0xc3f8('0x38')]=[{'all':!![]}];}return db[_0xc3f8('0x26')]['findAll'](_0x5579dd);})['then'](function(_0x407f30){_0x4e2329['rows']=_0x407f30;return _0x4e2329;})[_0xc3f8('0x1f')](respondWithFilteredResult(_0x98ab53,_0x5579dd))['catch'](handleError(_0x98ab53,null));};exports[_0xc3f8('0x39')]=function(_0x71660b,_0x3f0ae4){var _0x45d461={'raw':!![],'where':{'id':_0x71660b['params']['id']}},_0x301b79={};_0x301b79[_0xc3f8('0x2b')]=_[_0xc3f8('0x2e')](db[_0xc3f8('0x26')][_0xc3f8('0x27')]);_0x301b79[_0xc3f8('0x2d')]=_[_0xc3f8('0x2e')](_0x71660b[_0xc3f8('0x2d')]);_0x301b79[_0xc3f8('0x35')]=_[_0xc3f8('0x2f')](_0x301b79[_0xc3f8('0x2b')],_0x301b79[_0xc3f8('0x2d')]);_0x45d461[_0xc3f8('0x30')]=_['intersection'](_0x301b79[_0xc3f8('0x2b')],qs[_0xc3f8('0x3a')](_0x71660b[_0xc3f8('0x2d')][_0xc3f8('0x3a')]));_0x45d461[_0xc3f8('0x30')]=_0x45d461['attributes']['length']?_0x45d461[_0xc3f8('0x30')]:_0x301b79['model'];if(_0x71660b[_0xc3f8('0x2d')][_0xc3f8('0x3b')]){_0x45d461[_0xc3f8('0x38')]=[{'all':!![]}];}_0x45d461=_[_0xc3f8('0x36')]({},_0x45d461,_0x71660b[_0xc3f8('0x37')]);return db[_0xc3f8('0x26')][_0xc3f8('0x3c')](_0x45d461)[_0xc3f8('0x1f')](handleEntityNotFound(_0x3f0ae4,null))[_0xc3f8('0x1f')](respondWithResult(_0x3f0ae4,null))[_0xc3f8('0x3d')](handleError(_0x3f0ae4,null));};exports['create']=function(_0x39b079,_0x39e831){return db[_0xc3f8('0x26')][_0xc3f8('0x3e')](_0x39b079[_0xc3f8('0x3f')],{})[_0xc3f8('0x1f')](function(_0x190243){var _0x4fd321=_0x39b079[_0xc3f8('0x40')]['get']({'plain':!![]});if(!_0x4fd321)throw new Error(_0xc3f8('0x41'));if(_0x4fd321[_0xc3f8('0x42')]===_0xc3f8('0x40')){var _0x7d5eaf=_0x190243[_0xc3f8('0x20')]({'plain':!![]});var _0x54095d=_0xc3f8('0x43');return db[_0xc3f8('0x44')][_0xc3f8('0x3c')]({'where':{'name':_0x54095d,'userProfileId':_0x4fd321[_0xc3f8('0x45')]},'raw':!![]})[_0xc3f8('0x1f')](function(_0x1e704e){if(_0x1e704e&&_0x1e704e[_0xc3f8('0x46')]===0x0){return db[_0xc3f8('0x21')][_0xc3f8('0x3e')]({'name':_0x7d5eaf['name'],'resourceId':_0x7d5eaf['id'],'type':_0x1e704e[_0xc3f8('0x23')],'sectionId':_0x1e704e['id']},{})[_0xc3f8('0x1f')](function(){return _0x190243;});}else{return _0x190243;}})[_0xc3f8('0x3d')](function(_0x49c76c){logger[_0xc3f8('0x22')](_0xc3f8('0x47'),_0x49c76c);throw _0x49c76c;});}return _0x190243;})[_0xc3f8('0x1f')](respondWithResult(_0x39e831,0xc9))[_0xc3f8('0x3d')](handleError(_0x39e831,null));};exports[_0xc3f8('0x48')]=function(_0x4edbe2,_0x56b4ff){if(_0x4edbe2[_0xc3f8('0x3f')]['id']){delete _0x4edbe2[_0xc3f8('0x3f')]['id'];}return db[_0xc3f8('0x26')][_0xc3f8('0x3c')]({'where':{'id':_0x4edbe2[_0xc3f8('0x49')]['id']}})[_0xc3f8('0x1f')](handleEntityNotFound(_0x56b4ff,null))[_0xc3f8('0x1f')](saveUpdates(_0x4edbe2[_0xc3f8('0x3f')],null))[_0xc3f8('0x1f')](respondWithResult(_0x56b4ff,null))[_0xc3f8('0x3d')](handleError(_0x56b4ff,null));};exports[_0xc3f8('0x1e')]=function(_0x1e810e,_0x272cc3){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1e810e[_0xc3f8('0x49')]['id']}})[_0xc3f8('0x1f')](handleEntityNotFound(_0x272cc3,null))[_0xc3f8('0x1f')](removeEntity(_0x272cc3,null))[_0xc3f8('0x3d')](handleError(_0x272cc3,null));};exports[_0xc3f8('0x4a')]=function(_0xc06a9f,_0x2cfd75,_0x573833){return db[_0xc3f8('0x26')][_0xc3f8('0x3c')]({'where':{'id':_0xc06a9f['params']['id']},'attributes':[_0xc3f8('0x23'),_0xc3f8('0x4b'),_0xc3f8('0x4c'),_0xc3f8('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x2cfd75,null))[_0xc3f8('0x1f')](function(_0x213ab8){if(_0x213ab8){if(!fs[_0xc3f8('0x4e')](path[_0xc3f8('0x4f')](config[_0xc3f8('0x50')],'server/files/reports',_0x213ab8[_0xc3f8('0x4c')]))){throw new db['Sequelize']['ValidationError'](_0xc3f8('0x51'));}if(_0xc06a9f[_0xc3f8('0x2d')]['exists']){return _0x2cfd75[_0xc3f8('0x12')](0xc8);}return _0x2cfd75['download'](path['join'](config[_0xc3f8('0x50')],_0xc3f8('0x52'),_0x213ab8[_0xc3f8('0x4c')]),util[_0xc3f8('0x53')](_0xc3f8('0x54'),_0x213ab8[_0xc3f8('0x4b')]||_0x213ab8[_0xc3f8('0x23')],_0x213ab8[_0xc3f8('0x4d')][_0xc3f8('0x55')]()));}})[_0xc3f8('0x3d')](handleError(_0x2cfd75,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 97baa4b..538eb0b 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 _0xf5fc=['moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','define','lodash','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf5fc,0x1f1));var _0xcf5f=function(_0x365371,_0x2dbe84){_0x365371=_0x365371-0x0;var _0x4c07e0=_0xf5fc[_0x365371];return _0x4c07e0;};'use strict';var _=require(_0xcf5f('0x0'));var util=require('util');var logger=require(_0xcf5f('0x1'))(_0xcf5f('0x2'));var moment=require(_0xcf5f('0x3'));var BPromise=require(_0xcf5f('0x4'));var rp=require(_0xcf5f('0x5'));var fs=require('fs');var path=require(_0xcf5f('0x6'));var rimraf=require('rimraf');var config=require(_0xcf5f('0x7'));var attributes=require(_0xcf5f('0x8'));module['exports']=function(_0x5ebc18,_0x37d385){return _0x5ebc18[_0xcf5f('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a45=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3c23aa,_0x6bace9){var _0x1f6b52=function(_0x43a114){while(--_0x43a114){_0x3c23aa['push'](_0x3c23aa['shift']());}};_0x1f6b52(++_0x6bace9);}(_0x3a45,0xfd));var _0x53a4=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x3a45[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x53a4('0x0'));var util=require(_0x53a4('0x1'));var logger=require('../../config/logger')(_0x53a4('0x2'));var moment=require(_0x53a4('0x3'));var BPromise=require(_0x53a4('0x4'));var rp=require(_0x53a4('0x5'));var fs=require('fs');var path=require(_0x53a4('0x6'));var rimraf=require(_0x53a4('0x7'));var config=require(_0x53a4('0x8'));var attributes=require(_0x53a4('0x9'));module[_0x53a4('0xa')]=function(_0x3c84c8,_0x2331e1){return _0x3c84c8[_0x53a4('0xb')](_0x53a4('0xc'),attributes,{'tableName':'analytics_extracted_reports','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 c5fe599..51f019e 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 _0xee4f=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','ioredis'];(function(_0x21f880,_0x2df370){var _0x3ffdf1=function(_0x26232c){while(--_0x26232c){_0x21f880['push'](_0x21f880['shift']());}};_0x3ffdf1(++_0x2df370);}(_0xee4f,0x1ae));var _0xfee4=function(_0x2ad8c6,_0x2f1975){_0x2ad8c6=_0x2ad8c6-0x0;var _0x11f93c=_0xee4f[_0x2ad8c6];return _0x11f93c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfee4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfee4('0x1'));var db=require(_0xfee4('0x2'))['db'];var utils=require(_0xfee4('0x3'));var logger=require(_0xfee4('0x4'))(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')][_0xfee4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x355276,_0x3eace4,_0x7bcc87){return new BPromise(function(_0x9c2fa6,_0x142dca){return client['request'](_0x355276,_0x7bcc87)[_0xfee4('0x8')](function(_0x5800b7){logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x3eace4,_0xfee4('0xb'));logger[_0xfee4('0xc')](_0xfee4('0xd'),_0x3eace4,_0xfee4('0xb'),JSON[_0xfee4('0xe')](_0x5800b7));if(_0x5800b7['error']){if(_0x5800b7['error']['code']===0x1f4){logger[_0xfee4('0xf')](_0xfee4('0xa'),_0x3eace4,_0x5800b7[_0xfee4('0xf')][_0xfee4('0x10')]);return _0x142dca(_0x5800b7[_0xfee4('0xf')][_0xfee4('0x10')]);}logger['error'](_0xfee4('0xa'),_0x3eace4,_0x5800b7[_0xfee4('0xf')][_0xfee4('0x10')]);return _0x9c2fa6(_0x5800b7[_0xfee4('0xf')][_0xfee4('0x10')]);}else{logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x3eace4,_0xfee4('0xb'));_0x9c2fa6(_0x5800b7['result'][_0xfee4('0x10')]);}})[_0xfee4('0x11')](function(_0x49432f){logger[_0xfee4('0xf')](_0xfee4('0xa'),_0x3eace4,_0x49432f);_0x142dca(_0x49432f);});});} \ No newline at end of file +var _0xed78=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x12dfa9,_0x4a3b7a){var _0x577537=function(_0x527e7e){while(--_0x527e7e){_0x12dfa9['push'](_0x12dfa9['shift']());}};_0x577537(++_0x4a3b7a);}(_0xed78,0x7d));var _0x8ed7=function(_0x189a63,_0x5cb364){_0x189a63=_0x189a63-0x0;var _0x586683=_0xed78[_0x189a63];return _0x586683;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var moment=require(_0x8ed7('0x2'));var BPromise=require(_0x8ed7('0x3'));var rs=require(_0x8ed7('0x4'));var fs=require('fs');var Redis=require(_0x8ed7('0x5'));var db=require(_0x8ed7('0x6'))['db'];var utils=require(_0x8ed7('0x7'));var logger=require(_0x8ed7('0x8'))(_0x8ed7('0x9'));var config=require(_0x8ed7('0xa'));var jayson=require(_0x8ed7('0xb'));var client=jayson[_0x8ed7('0xc')][_0x8ed7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c3de4,_0xdda2db,_0x4a258b){return new BPromise(function(_0x274dee,_0x34784e){return client[_0x8ed7('0xe')](_0x3c3de4,_0x4a258b)[_0x8ed7('0xf')](function(_0x54b1ee){logger[_0x8ed7('0x10')](_0x8ed7('0x11'),_0xdda2db,_0x8ed7('0x12'));logger[_0x8ed7('0x13')](_0x8ed7('0x14'),_0xdda2db,_0x8ed7('0x12'),JSON[_0x8ed7('0x15')](_0x54b1ee));if(_0x54b1ee[_0x8ed7('0x16')]){if(_0x54b1ee[_0x8ed7('0x16')][_0x8ed7('0x17')]===0x1f4){logger['error'](_0x8ed7('0x11'),_0xdda2db,_0x54b1ee['error'][_0x8ed7('0x18')]);return _0x34784e(_0x54b1ee['error']['message']);}logger[_0x8ed7('0x16')](_0x8ed7('0x11'),_0xdda2db,_0x54b1ee['error']['message']);return _0x274dee(_0x54b1ee[_0x8ed7('0x16')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0xdda2db,'request\x20sent');_0x274dee(_0x54b1ee['result'][_0x8ed7('0x18')]);}})[_0x8ed7('0x19')](function(_0xfc032f){logger[_0x8ed7('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xdda2db,_0xfc032f);_0x34784e(_0xfc032f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 67f5ca0..025bbc0 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 _0x82cf=['create','put','/:id','update','destroy','util','path','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','download','post'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x82cf,0xc8));var _0xf82c=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x82cf[_0x16a637];return _0x25126d;};'use strict';var multer=require('multer');var util=require(_0xf82c('0x0'));var path=require(_0xf82c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf82c('0x2')]();var auth=require(_0xf82c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf82c('0x4'));var controller=require(_0xf82c('0x5'));router[_0xf82c('0x6')]('/',auth[_0xf82c('0x7')](),controller['index']);router['get']('/:id',auth[_0xf82c('0x7')](),controller['show']);router[_0xf82c('0x6')]('/:id/download',auth[_0xf82c('0x7')](),controller[_0xf82c('0x8')]);router[_0xf82c('0x9')]('/',auth[_0xf82c('0x7')](),controller[_0xf82c('0xa')]);router[_0xf82c('0xb')](_0xf82c('0xc'),auth[_0xf82c('0x7')](),controller[_0xf82c('0xd')]);router['delete'](_0xf82c('0xc'),auth[_0xf82c('0x7')](),controller[_0xf82c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcd92=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer'];(function(_0x21ca29,_0x83e0d8){var _0x4eb445=function(_0x3a0936){while(--_0x3a0936){_0x21ca29['push'](_0x21ca29['shift']());}};_0x4eb445(++_0x83e0d8);}(_0xcd92,0xb3));var _0x2cd9=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xcd92[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x2cd9('0x0'));var util=require(_0x2cd9('0x1'));var path=require(_0x2cd9('0x2'));var timeout=require(_0x2cd9('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2cd9('0x4'));var interaction=require(_0x2cd9('0x5'));var config=require(_0x2cd9('0x6'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x2cd9('0x7')](),controller['index']);router[_0x2cd9('0x8')](_0x2cd9('0x9'),auth[_0x2cd9('0x7')](),controller[_0x2cd9('0xa')]);router['get'](_0x2cd9('0xb'),auth['isAuthenticated'](),controller[_0x2cd9('0xc')]);router[_0x2cd9('0xd')]('/',auth['isAuthenticated'](),controller[_0x2cd9('0xe')]);router[_0x2cd9('0xf')](_0x2cd9('0x9'),auth[_0x2cd9('0x7')](),controller[_0x2cd9('0x10')]);router[_0x2cd9('0x11')]('/:id',auth[_0x2cd9('0x7')](),controller[_0x2cd9('0x12')]);module[_0x2cd9('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 501dc86..ddb2a07 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x16b30e,_0x421536){var _0x27107c=function(_0x123c7c){while(--_0x123c7c){_0x16b30e['push'](_0x16b30e['shift']());}};_0x27107c(++_0x421536);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x5fc3[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x207774,_0xf89969){var _0x211cc0=function(_0x4a236b){while(--_0x4a236b){_0x207774['push'](_0x207774['shift']());}};_0x211cc0(++_0xf89969);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5fc3[_0x3ceb54];return _0x26d8a6;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index c0b6c57..8d8be30 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 _0x637e=['sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','error','send','map','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','include','findAll','rows','catch','params','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','destroy','CustomReportId','zip-dir','fast-json-patch','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3167a8,_0x4d5006){var _0x20073f=function(_0x5b7216){while(--_0x5b7216){_0x3167a8['push'](_0x3167a8['shift']());}};_0x20073f(++_0x4d5006);}(_0x637e,0xcc));var _0xe637=function(_0x131aac,_0x20f54c){_0x131aac=_0x131aac-0x0;var _0x240ff8=_0x637e[_0x131aac];return _0x240ff8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe637('0x0'));var jsonpatch=require(_0xe637('0x1'));var rp=require('request-promise');var moment=require(_0xe637('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe637('0x3'));var sox=require('sox');var csv=require(_0xe637('0x4'));var ejs=require(_0xe637('0x5'));var fs=require('fs');var _=require(_0xe637('0x6'));var squel=require(_0xe637('0x7'));var crypto=require(_0xe637('0x8'));var jsforce=require(_0xe637('0x9'));var deskjs=require(_0xe637('0xa'));var toCsv=require(_0xe637('0x4'));var querystring=require(_0xe637('0xb'));var Papa=require('papaparse');var Redis=require(_0xe637('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe637('0xd'));var as=require(_0xe637('0xe'));var hardwareService=require(_0xe637('0xf'));var logger=require(_0xe637('0x10'))(_0xe637('0x11'));var utils=require(_0xe637('0x12'));var config=require(_0xe637('0x13'));var db=require(_0xe637('0x14'))['db'];function respondWithStatusCode(_0xf63d98,_0x517d19){_0x517d19=_0x517d19||0xcc;return function(_0x1b0f1f){if(_0x1b0f1f){return _0xf63d98[_0xe637('0x15')](_0x517d19);}return _0xf63d98[_0xe637('0x16')](_0x517d19)[_0xe637('0x17')]();};}function respondWithResult(_0x3f76b4,_0x2578f9){_0x2578f9=_0x2578f9||0xc8;return function(_0x377af1){if(_0x377af1){return _0x3f76b4[_0xe637('0x16')](_0x2578f9)[_0xe637('0x18')](_0x377af1);}};}function respondWithFilteredResult(_0x271884,_0x3982f4){return function(_0x1cf3d2){if(_0x1cf3d2){var _0x2dc1e8=_0x1cf3d2[_0xe637('0x19')],_0x453b47=_0x3982f4[_0xe637('0x1a')],_0x440e64=_0x3982f4['offset']+_0x3982f4['limit'],_0x5de76b;if(_0x440e64>=_0x2dc1e8){_0x440e64=_0x2dc1e8;_0x5de76b=0xc8;}else{_0x5de76b=0xce;}_0x271884[_0xe637('0x16')](_0x5de76b);return _0x271884[_0xe637('0x1b')]('Content-Range',_0x453b47+'-'+_0x440e64+'/'+_0x2dc1e8)['json'](_0x1cf3d2);}return null;};}function patchUpdates(_0x5b81de){return function(_0x388f58){try{jsonpatch[_0xe637('0x1c')](_0x388f58,_0x5b81de,!![]);}catch(_0x2f572f){return BPromise[_0xe637('0x1d')](_0x2f572f);}return _0x388f58[_0xe637('0x1e')]();};}function saveUpdates(_0x54438c,_0x218266){return function(_0x31fb70){if(_0x31fb70){return _0x31fb70[_0xe637('0x1f')](_0x54438c)[_0xe637('0x20')](function(_0x47504c){return _0x47504c;});}return null;};}function removeEntity(_0x48b9b6,_0x57fb07){return function(_0x80c8b8){if(_0x80c8b8){return _0x80c8b8['destroy']()[_0xe637('0x20')](function(){_0x48b9b6[_0xe637('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19c489,_0x1b344e){return function(_0x8d44a1){if(!_0x8d44a1){_0x19c489[_0xe637('0x15')](0x194);}return _0x8d44a1;};}function handleError(_0x1e9162,_0x18b82b){_0x18b82b=_0x18b82b||0x1f4;return function(_0x4628d6){logger[_0xe637('0x21')](_0x4628d6['stack']);if(_0x4628d6['name']){delete _0x4628d6['name'];}_0x1e9162[_0xe637('0x16')](_0x18b82b)[_0xe637('0x22')](_0x4628d6);};}exports['index']=function(_0x387745,_0x1f3f9e){var _0x2e9dcb={},_0x3d8f23={},_0x38c2dd={'count':0x0,'rows':[]};var _0xdf0a38=_[_0xe637('0x23')](db['AnalyticFieldReport'][_0xe637('0x24')],function(_0x467fc8){return{'name':_0x467fc8[_0xe637('0x25')],'type':_0x467fc8['type']['key']};});_0x3d8f23[_0xe637('0x26')]=_['map'](_0xdf0a38,_0xe637('0x27'));_0x3d8f23[_0xe637('0x28')]=_[_0xe637('0x29')](_0x387745[_0xe637('0x28')]);_0x3d8f23[_0xe637('0x2a')]=_[_0xe637('0x2b')](_0x3d8f23[_0xe637('0x26')],_0x3d8f23[_0xe637('0x28')]);_0x2e9dcb[_0xe637('0x2c')]=_[_0xe637('0x2b')](_0x3d8f23[_0xe637('0x26')],qs[_0xe637('0x2d')](_0x387745[_0xe637('0x28')][_0xe637('0x2d')]));_0x2e9dcb[_0xe637('0x2c')]=_0x2e9dcb[_0xe637('0x2c')][_0xe637('0x2e')]?_0x2e9dcb[_0xe637('0x2c')]:_0x3d8f23[_0xe637('0x26')];if(!_0x387745[_0xe637('0x28')]['hasOwnProperty'](_0xe637('0x2f'))){_0x2e9dcb[_0xe637('0x30')]=qs['limit'](_0x387745[_0xe637('0x28')]['limit']);_0x2e9dcb[_0xe637('0x1a')]=qs[_0xe637('0x1a')](_0x387745['query'][_0xe637('0x1a')]);}_0x2e9dcb[_0xe637('0x31')]=qs['sort'](_0x387745[_0xe637('0x28')][_0xe637('0x32')]);_0x2e9dcb[_0xe637('0x33')]=qs[_0xe637('0x2a')](_[_0xe637('0x34')](_0x387745['query'],_0x3d8f23[_0xe637('0x2a')]),_0xdf0a38);if(_0x387745[_0xe637('0x28')][_0xe637('0x35')]){_0x2e9dcb[_0xe637('0x33')]=_[_0xe637('0x36')](_0x2e9dcb[_0xe637('0x33')],{'$or':_[_0xe637('0x23')](_0xdf0a38,function(_0x2f5229){if(_0x2f5229['type']!==_0xe637('0x37')){var _0x19b935={};_0x19b935[_0x2f5229[_0xe637('0x27')]]={'$like':'%'+_0x387745['query'][_0xe637('0x35')]+'%'};return _0x19b935;}})});}_0x2e9dcb=_[_0xe637('0x36')]({},_0x2e9dcb,_0x387745[_0xe637('0x38')]);var _0x30ff25={'where':_0x2e9dcb[_0xe637('0x33')]};return db[_0xe637('0x39')][_0xe637('0x19')](_0x30ff25)[_0xe637('0x20')](function(_0x4db487){_0x38c2dd[_0xe637('0x19')]=_0x4db487;if(_0x387745[_0xe637('0x28')]['includeAll']){_0x2e9dcb[_0xe637('0x3a')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xe637('0x3b')](_0x2e9dcb);})[_0xe637('0x20')](function(_0x169ac2){_0x38c2dd[_0xe637('0x3c')]=_0x169ac2;return _0x38c2dd;})[_0xe637('0x20')](respondWithFilteredResult(_0x1f3f9e,_0x2e9dcb))[_0xe637('0x3d')](handleError(_0x1f3f9e,null));};exports['show']=function(_0x1420f0,_0x3561db){var _0x3a04dd={'raw':![],'where':{'id':_0x1420f0[_0xe637('0x3e')]['id']}},_0x5a6913={};_0x5a6913[_0xe637('0x26')]=_[_0xe637('0x29')](db['AnalyticFieldReport'][_0xe637('0x24')]);_0x5a6913[_0xe637('0x28')]=_[_0xe637('0x29')](_0x1420f0['query']);_0x5a6913[_0xe637('0x2a')]=_['intersection'](_0x5a6913['model'],_0x5a6913[_0xe637('0x28')]);_0x3a04dd[_0xe637('0x2c')]=_['intersection'](_0x5a6913['model'],qs[_0xe637('0x2d')](_0x1420f0[_0xe637('0x28')][_0xe637('0x2d')]));_0x3a04dd[_0xe637('0x2c')]=_0x3a04dd[_0xe637('0x2c')][_0xe637('0x2e')]?_0x3a04dd[_0xe637('0x2c')]:_0x5a6913['model'];if(_0x1420f0[_0xe637('0x28')][_0xe637('0x3f')]){_0x3a04dd[_0xe637('0x3a')]=[{'all':!![]}];}_0x3a04dd=_[_0xe637('0x36')]({},_0x3a04dd,_0x1420f0[_0xe637('0x38')]);return db[_0xe637('0x39')][_0xe637('0x40')](_0x3a04dd)[_0xe637('0x20')](handleEntityNotFound(_0x3561db,null))['then'](respondWithResult(_0x3561db,null))[_0xe637('0x3d')](handleError(_0x3561db,null));};exports[_0xe637('0x41')]=function(_0x17fe46,_0x31d102){return db[_0xe637('0x39')]['create'](_0x17fe46[_0xe637('0x42')],{})[_0xe637('0x20')](respondWithResult(_0x31d102,0xc9))['catch'](handleError(_0x31d102,null));};exports[_0xe637('0x43')]=function(_0x4fa534,_0x4ecc77){return db[_0xe637('0x39')][_0xe637('0x43')](_0x4fa534['body'],{'raw':![],'individualHooks':!![]})[_0xe637('0x20')](respondWithResult(_0x4ecc77,0xc9))['catch'](handleError(_0x4ecc77,null));};exports[_0xe637('0x1f')]=function(_0x2a1eda,_0x115855){if(_0x2a1eda[_0xe637('0x42')]['id']){delete _0x2a1eda['body']['id'];}return db[_0xe637('0x39')]['find']({'where':{'id':_0x2a1eda[_0xe637('0x3e')]['id']}})[_0xe637('0x20')](handleEntityNotFound(_0x115855,null))['then'](saveUpdates(_0x2a1eda['body'],null))[_0xe637('0x20')](respondWithResult(_0x115855,null))[_0xe637('0x3d')](handleError(_0x115855,null));};exports['destroy']=function(_0x59e9fd,_0xdcec84){return db['AnalyticFieldReport'][_0xe637('0x40')]({'where':{'id':_0x59e9fd[_0xe637('0x3e')]['id']}})[_0xe637('0x20')](handleEntityNotFound(_0xdcec84,null))[_0xe637('0x20')](removeEntity(_0xdcec84,null))[_0xe637('0x3d')](handleError(_0xdcec84,null));};exports[_0xe637('0x44')]=function(_0x3c4ad5,_0x4de117){return db[_0xe637('0x39')]['destroy']({'where':{'id':_0x3c4ad5['query'][_0xe637('0x45')]||[]},'raw':![],'individualHooks':!![]})[_0xe637('0x20')](respondWithResult(_0x4de117,0xcc))[_0xe637('0x3d')](handleError(_0x4de117,null));};exports['addFields']=function(_0x234e36,_0x49a426,_0x39341c){return db[_0xe637('0x46')][_0xe637('0x47')]({'where':{'id':_0x234e36[_0xe637('0x3e')]['id']}})[_0xe637('0x20')](handleEntityNotFound(_0x49a426,null))[_0xe637('0x20')](function(_0x1b3c20){if(_0x1b3c20){return db[_0xe637('0x48')]['transaction'](function(_0xdbf9e3){return db[_0xe637('0x39')][_0xe637('0x49')]({'where':{'CustomReportId':_0x234e36[_0xe637('0x3e')]['id']},'transaction':_0xdbf9e3})[_0xe637('0x20')](function(_0x5774a4){var _0x26801e=_[_0xe637('0x23')](_0x234e36[_0xe637('0x42')],function(_0x36e734){delete _0x36e734['id'];_0x36e734[_0xe637('0x4a')]=_0x234e36[_0xe637('0x3e')]['id'];return _0x36e734;});return db[_0xe637('0x39')][_0xe637('0x43')](_0x26801e,{'transaction':_0xdbf9e3});});})[_0xe637('0x20')](function(){return db[_0xe637('0x39')][_0xe637('0x3b')]({'where':{'CustomReportId':_0x234e36[_0xe637('0x3e')]['id']}});});}})[_0xe637('0x20')](respondWithResult(_0x49a426,null))[_0xe637('0x3d')](handleError(_0x49a426,null));}; \ No newline at end of file +var _0xcb57=['find','catch','create','body','bulkCreate','update','params','addFields','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','includeAll'];(function(_0x51f145,_0xd7b709){var _0x463121=function(_0x2557a9){while(--_0x2557a9){_0x51f145['push'](_0x51f145['shift']());}};_0x463121(++_0xd7b709);}(_0xcb57,0xa1));var _0x7cb5=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xcb57[_0x4ae6ef];return _0x3cbb4e;};'use strict';var pdf=require(_0x7cb5('0x0'));var emlformat=require(_0x7cb5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7cb5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cb5('0x3'));var moment=require('moment');var BPromise=require(_0x7cb5('0x4'));var Mustache=require(_0x7cb5('0x5'));var util=require('util');var path=require(_0x7cb5('0x6'));var sox=require(_0x7cb5('0x7'));var csv=require(_0x7cb5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7cb5('0x9'));var squel=require(_0x7cb5('0xa'));var crypto=require(_0x7cb5('0xb'));var jsforce=require(_0x7cb5('0xc'));var deskjs=require(_0x7cb5('0xd'));var toCsv=require(_0x7cb5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7cb5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7cb5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cb5('0x10'))(_0x7cb5('0x11'));var utils=require(_0x7cb5('0x12'));var config=require(_0x7cb5('0x13'));var db=require(_0x7cb5('0x14'))['db'];function respondWithStatusCode(_0x2a1e06,_0x14efa5){_0x14efa5=_0x14efa5||0xcc;return function(_0x3e230e){if(_0x3e230e){return _0x2a1e06[_0x7cb5('0x15')](_0x14efa5);}return _0x2a1e06[_0x7cb5('0x16')](_0x14efa5)[_0x7cb5('0x17')]();};}function respondWithResult(_0x27d634,_0xc5ddf1){_0xc5ddf1=_0xc5ddf1||0xc8;return function(_0x3648cb){if(_0x3648cb){return _0x27d634['status'](_0xc5ddf1)['json'](_0x3648cb);}};}function respondWithFilteredResult(_0x34c88d,_0x30ba6a){return function(_0x579d58){if(_0x579d58){var _0x2774f4=_0x579d58['count'],_0x268d3d=_0x30ba6a[_0x7cb5('0x18')],_0x238fb4=_0x30ba6a[_0x7cb5('0x18')]+_0x30ba6a[_0x7cb5('0x19')],_0x509a7f;if(_0x238fb4>=_0x2774f4){_0x238fb4=_0x2774f4;_0x509a7f=0xc8;}else{_0x509a7f=0xce;}_0x34c88d['status'](_0x509a7f);return _0x34c88d[_0x7cb5('0x1a')](_0x7cb5('0x1b'),_0x268d3d+'-'+_0x238fb4+'/'+_0x2774f4)[_0x7cb5('0x1c')](_0x579d58);}return null;};}function patchUpdates(_0x190032){return function(_0x776e1c){try{jsonpatch[_0x7cb5('0x1d')](_0x776e1c,_0x190032,!![]);}catch(_0x3c3951){return BPromise[_0x7cb5('0x1e')](_0x3c3951);}return _0x776e1c['save']();};}function saveUpdates(_0x208277,_0x3f2860){return function(_0x43341d){if(_0x43341d){return _0x43341d['update'](_0x208277)[_0x7cb5('0x1f')](function(_0x4c7d72){return _0x4c7d72;});}return null;};}function removeEntity(_0x1435e1,_0x23d623){return function(_0x5932cc){if(_0x5932cc){return _0x5932cc[_0x7cb5('0x20')]()[_0x7cb5('0x1f')](function(){_0x1435e1[_0x7cb5('0x16')](0xcc)[_0x7cb5('0x17')]();});}};}function handleEntityNotFound(_0x2c6846,_0x279f78){return function(_0x2d34b3){if(!_0x2d34b3){_0x2c6846[_0x7cb5('0x15')](0x194);}return _0x2d34b3;};}function handleError(_0x464d37,_0xfd36ef){_0xfd36ef=_0xfd36ef||0x1f4;return function(_0x5c4fb1){logger[_0x7cb5('0x21')](_0x5c4fb1['stack']);if(_0x5c4fb1['name']){delete _0x5c4fb1[_0x7cb5('0x22')];}_0x464d37[_0x7cb5('0x16')](_0xfd36ef)['send'](_0x5c4fb1);};}exports[_0x7cb5('0x23')]=function(_0x1c0791,_0x35fbf0){var _0x43fa9d={},_0x1e5e89={},_0x3c465b={'count':0x0,'rows':[]};var _0x198510=_[_0x7cb5('0x24')](db[_0x7cb5('0x25')][_0x7cb5('0x26')],function(_0x6eb07){return{'name':_0x6eb07[_0x7cb5('0x27')],'type':_0x6eb07[_0x7cb5('0x28')][_0x7cb5('0x29')]};});_0x1e5e89[_0x7cb5('0x2a')]=_['map'](_0x198510,_0x7cb5('0x22'));_0x1e5e89[_0x7cb5('0x2b')]=_[_0x7cb5('0x2c')](_0x1c0791[_0x7cb5('0x2b')]);_0x1e5e89[_0x7cb5('0x2d')]=_['intersection'](_0x1e5e89[_0x7cb5('0x2a')],_0x1e5e89[_0x7cb5('0x2b')]);_0x43fa9d[_0x7cb5('0x2e')]=_[_0x7cb5('0x2f')](_0x1e5e89[_0x7cb5('0x2a')],qs[_0x7cb5('0x30')](_0x1c0791[_0x7cb5('0x2b')][_0x7cb5('0x30')]));_0x43fa9d['attributes']=_0x43fa9d[_0x7cb5('0x2e')][_0x7cb5('0x31')]?_0x43fa9d['attributes']:_0x1e5e89[_0x7cb5('0x2a')];if(!_0x1c0791['query'][_0x7cb5('0x32')](_0x7cb5('0x33'))){_0x43fa9d['limit']=qs[_0x7cb5('0x19')](_0x1c0791[_0x7cb5('0x2b')]['limit']);_0x43fa9d[_0x7cb5('0x18')]=qs[_0x7cb5('0x18')](_0x1c0791[_0x7cb5('0x2b')][_0x7cb5('0x18')]);}_0x43fa9d[_0x7cb5('0x34')]=qs['sort'](_0x1c0791[_0x7cb5('0x2b')][_0x7cb5('0x35')]);_0x43fa9d['where']=qs['filters'](_['pick'](_0x1c0791[_0x7cb5('0x2b')],_0x1e5e89[_0x7cb5('0x2d')]),_0x198510);if(_0x1c0791[_0x7cb5('0x2b')][_0x7cb5('0x36')]){_0x43fa9d['where']=_[_0x7cb5('0x37')](_0x43fa9d[_0x7cb5('0x38')],{'$or':_[_0x7cb5('0x24')](_0x198510,function(_0x4d7d83){if(_0x4d7d83[_0x7cb5('0x28')]!==_0x7cb5('0x39')){var _0x17711e={};_0x17711e[_0x4d7d83[_0x7cb5('0x22')]]={'$like':'%'+_0x1c0791[_0x7cb5('0x2b')][_0x7cb5('0x36')]+'%'};return _0x17711e;}})});}_0x43fa9d=_[_0x7cb5('0x37')]({},_0x43fa9d,_0x1c0791[_0x7cb5('0x3a')]);var _0x3a5507={'where':_0x43fa9d[_0x7cb5('0x38')]};return db[_0x7cb5('0x25')][_0x7cb5('0x3b')](_0x3a5507)[_0x7cb5('0x1f')](function(_0x58f661){_0x3c465b['count']=_0x58f661;if(_0x1c0791[_0x7cb5('0x2b')]['includeAll']){_0x43fa9d[_0x7cb5('0x3c')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x7cb5('0x3d')](_0x43fa9d);})[_0x7cb5('0x1f')](function(_0x52e636){_0x3c465b[_0x7cb5('0x3e')]=_0x52e636;return _0x3c465b;})[_0x7cb5('0x1f')](respondWithFilteredResult(_0x35fbf0,_0x43fa9d))['catch'](handleError(_0x35fbf0,null));};exports['show']=function(_0x53f99e,_0x439aab){var _0x3eab39={'raw':![],'where':{'id':_0x53f99e['params']['id']}},_0x5e9fab={};_0x5e9fab['model']=_[_0x7cb5('0x2c')](db[_0x7cb5('0x25')][_0x7cb5('0x26')]);_0x5e9fab[_0x7cb5('0x2b')]=_[_0x7cb5('0x2c')](_0x53f99e['query']);_0x5e9fab['filters']=_['intersection'](_0x5e9fab[_0x7cb5('0x2a')],_0x5e9fab[_0x7cb5('0x2b')]);_0x3eab39[_0x7cb5('0x2e')]=_['intersection'](_0x5e9fab['model'],qs[_0x7cb5('0x30')](_0x53f99e['query'][_0x7cb5('0x30')]));_0x3eab39[_0x7cb5('0x2e')]=_0x3eab39[_0x7cb5('0x2e')][_0x7cb5('0x31')]?_0x3eab39['attributes']:_0x5e9fab[_0x7cb5('0x2a')];if(_0x53f99e[_0x7cb5('0x2b')][_0x7cb5('0x3f')]){_0x3eab39['include']=[{'all':!![]}];}_0x3eab39=_[_0x7cb5('0x37')]({},_0x3eab39,_0x53f99e[_0x7cb5('0x3a')]);return db[_0x7cb5('0x25')][_0x7cb5('0x40')](_0x3eab39)[_0x7cb5('0x1f')](handleEntityNotFound(_0x439aab,null))[_0x7cb5('0x1f')](respondWithResult(_0x439aab,null))[_0x7cb5('0x41')](handleError(_0x439aab,null));};exports[_0x7cb5('0x42')]=function(_0x1d2d06,_0x1b4b4a){return db[_0x7cb5('0x25')]['create'](_0x1d2d06[_0x7cb5('0x43')],{})[_0x7cb5('0x1f')](respondWithResult(_0x1b4b4a,0xc9))['catch'](handleError(_0x1b4b4a,null));};exports[_0x7cb5('0x44')]=function(_0x28222d,_0xd3acad){return db[_0x7cb5('0x25')][_0x7cb5('0x44')](_0x28222d[_0x7cb5('0x43')],{'raw':![],'individualHooks':!![]})[_0x7cb5('0x1f')](respondWithResult(_0xd3acad,0xc9))[_0x7cb5('0x41')](handleError(_0xd3acad,null));};exports[_0x7cb5('0x45')]=function(_0x562da0,_0x1325c2){if(_0x562da0[_0x7cb5('0x43')]['id']){delete _0x562da0[_0x7cb5('0x43')]['id'];}return db[_0x7cb5('0x25')][_0x7cb5('0x40')]({'where':{'id':_0x562da0[_0x7cb5('0x46')]['id']}})[_0x7cb5('0x1f')](handleEntityNotFound(_0x1325c2,null))[_0x7cb5('0x1f')](saveUpdates(_0x562da0[_0x7cb5('0x43')],null))['then'](respondWithResult(_0x1325c2,null))['catch'](handleError(_0x1325c2,null));};exports[_0x7cb5('0x20')]=function(_0x53a682,_0x3f8739){return db[_0x7cb5('0x25')]['find']({'where':{'id':_0x53a682['params']['id']}})[_0x7cb5('0x1f')](handleEntityNotFound(_0x3f8739,null))[_0x7cb5('0x1f')](removeEntity(_0x3f8739,null))[_0x7cb5('0x41')](handleError(_0x3f8739,null));};exports['bulkDestroy']=function(_0x475094,_0x1bfa74){return db[_0x7cb5('0x25')][_0x7cb5('0x20')]({'where':{'id':_0x475094[_0x7cb5('0x2b')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1bfa74,0xcc))[_0x7cb5('0x41')](handleError(_0x1bfa74,null));};exports[_0x7cb5('0x47')]=function(_0x3cf8a6,_0x532fcb,_0x14d456){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x3cf8a6[_0x7cb5('0x46')]['id']}})['then'](handleEntityNotFound(_0x532fcb,null))[_0x7cb5('0x1f')](function(_0x1f5288){if(_0x1f5288){return db[_0x7cb5('0x48')][_0x7cb5('0x49')](function(_0x4d81c3){return db[_0x7cb5('0x25')][_0x7cb5('0x20')]({'where':{'CustomReportId':_0x3cf8a6['params']['id']},'transaction':_0x4d81c3})['then'](function(_0x2271a6){var _0x5429a2=_[_0x7cb5('0x24')](_0x3cf8a6[_0x7cb5('0x43')],function(_0xf7eaba){delete _0xf7eaba['id'];_0xf7eaba[_0x7cb5('0x4a')]=_0x3cf8a6[_0x7cb5('0x46')]['id'];return _0xf7eaba;});return db[_0x7cb5('0x25')][_0x7cb5('0x44')](_0x5429a2,{'transaction':_0x4d81c3});});})[_0x7cb5('0x1f')](function(){return db['AnalyticFieldReport'][_0x7cb5('0x3d')]({'where':{'CustomReportId':_0x3cf8a6[_0x7cb5('0x46')]['id']}});});}})[_0x7cb5('0x1f')](respondWithResult(_0x532fcb,null))[_0x7cb5('0x41')](handleError(_0x532fcb,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index df57637..17b6217 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 _0x6ec0=['request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x6ec0,0x7c));var _0x06ec=function(_0x509263,_0x15528f){_0x509263=_0x509263-0x0;var _0x2e85ab=_0x6ec0[_0x509263];return _0x2e85ab;};'use strict';var _=require(_0x06ec('0x0'));var util=require(_0x06ec('0x1'));var logger=require(_0x06ec('0x2'))(_0x06ec('0x3'));var moment=require(_0x06ec('0x4'));var BPromise=require(_0x06ec('0x5'));var rp=require(_0x06ec('0x6'));var fs=require('fs');var path=require(_0x06ec('0x7'));var rimraf=require(_0x06ec('0x8'));var config=require('../../config/environment');var attributes=require(_0x06ec('0x9'));module[_0x06ec('0xa')]=function(_0x4448c4,_0x3ef9f0){return _0x4448c4[_0x06ec('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0x06ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd457=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x56a0ea,_0x513e71){var _0x49dde5=function(_0x485b43){while(--_0x485b43){_0x56a0ea['push'](_0x56a0ea['shift']());}};_0x49dde5(++_0x513e71);}(_0xd457,0x1e1));var _0x7d45=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xd457[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x7d45('0x0'));var util=require(_0x7d45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7d45('0x2'));var BPromise=require(_0x7d45('0x3'));var rp=require(_0x7d45('0x4'));var fs=require('fs');var path=require(_0x7d45('0x5'));var rimraf=require(_0x7d45('0x6'));var config=require(_0x7d45('0x7'));var attributes=require(_0x7d45('0x8'));module[_0x7d45('0x9')]=function(_0x295b69,_0x380c1b){return _0x295b69[_0x7d45('0xa')](_0x7d45('0xb'),attributes,{'tableName':_0x7d45('0xc'),'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 7bdc3c7..1ef565e 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 _0x8d57=['error','message','info','result','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2bf5f4,_0x369192){var _0x38cbcf=function(_0x3234e9){while(--_0x3234e9){_0x2bf5f4['push'](_0x2bf5f4['shift']());}};_0x38cbcf(++_0x369192);}(_0x8d57,0xaf));var _0x78d5=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x8d57[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x78d5('0x0'));var util=require(_0x78d5('0x1'));var moment=require('moment');var BPromise=require(_0x78d5('0x2'));var rs=require(_0x78d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x78d5('0x4'));var logger=require('../../config/logger')(_0x78d5('0x5'));var config=require(_0x78d5('0x6'));var jayson=require(_0x78d5('0x7'));var client=jayson[_0x78d5('0x8')][_0x78d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d4e9,_0xf2e912,_0x339aa9){return new BPromise(function(_0x5beaa7,_0x208b1f){return client[_0x78d5('0xa')](_0x3d4e9,_0x339aa9)['then'](function(_0x1d9786){logger['info'](_0x78d5('0xb'),_0xf2e912,_0x78d5('0xc'));logger[_0x78d5('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xf2e912,'request\x20sent',JSON[_0x78d5('0xe')](_0x1d9786));if(_0x1d9786[_0x78d5('0xf')]){if(_0x1d9786['error']['code']===0x1f4){logger[_0x78d5('0xf')](_0x78d5('0xb'),_0xf2e912,_0x1d9786[_0x78d5('0xf')][_0x78d5('0x10')]);return _0x208b1f(_0x1d9786['error'][_0x78d5('0x10')]);}logger['error'](_0x78d5('0xb'),_0xf2e912,_0x1d9786[_0x78d5('0xf')][_0x78d5('0x10')]);return _0x5beaa7(_0x1d9786[_0x78d5('0xf')][_0x78d5('0x10')]);}else{logger[_0x78d5('0x11')](_0x78d5('0xb'),_0xf2e912,'request\x20sent');_0x5beaa7(_0x1d9786[_0x78d5('0x12')][_0x78d5('0x10')]);}})['catch'](function(_0x240e5e){logger[_0x78d5('0xf')](_0x78d5('0xb'),_0xf2e912,_0x240e5e);_0x208b1f(_0x240e5e);});});} \ No newline at end of file +var _0xa65f=['client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x581cad,_0x355b2e){var _0x1a9f4b=function(_0x5c8461){while(--_0x5c8461){_0x581cad['push'](_0x581cad['shift']());}};_0x1a9f4b(++_0x355b2e);}(_0xa65f,0xf9));var _0xfa65=function(_0x4279b6,_0x6dbf0d){_0x4279b6=_0x4279b6-0x0;var _0x5a5fe6=_0xa65f[_0x4279b6];return _0x5a5fe6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfa65('0x0'));var rs=require(_0xfa65('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfa65('0x2'));var logger=require(_0xfa65('0x3'))(_0xfa65('0x4'));var config=require(_0xfa65('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfa65('0x6')][_0xfa65('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e49dd,_0x44d495,_0x2975ce){return new BPromise(function(_0x5c12d0,_0x41f4f0){return client[_0xfa65('0x8')](_0x5e49dd,_0x2975ce)[_0xfa65('0x9')](function(_0x3d58aa){logger[_0xfa65('0xa')](_0xfa65('0xb'),_0x44d495,_0xfa65('0xc'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x44d495,_0xfa65('0xc'),JSON['stringify'](_0x3d58aa));if(_0x3d58aa['error']){if(_0x3d58aa[_0xfa65('0xd')]['code']===0x1f4){logger['error'](_0xfa65('0xb'),_0x44d495,_0x3d58aa['error'][_0xfa65('0xe')]);return _0x41f4f0(_0x3d58aa[_0xfa65('0xd')][_0xfa65('0xe')]);}logger[_0xfa65('0xd')](_0xfa65('0xb'),_0x44d495,_0x3d58aa['error'][_0xfa65('0xe')]);return _0x5c12d0(_0x3d58aa[_0xfa65('0xd')][_0xfa65('0xe')]);}else{logger[_0xfa65('0xa')](_0xfa65('0xb'),_0x44d495,'request\x20sent');_0x5c12d0(_0x3d58aa[_0xfa65('0xf')][_0xfa65('0xe')]);}})[_0xfa65('0x10')](function(_0x54b18c){logger[_0xfa65('0xd')](_0xfa65('0xb'),_0x44d495,_0x54b18c);_0x41f4f0(_0x54b18c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 6330245..aa76b60 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x208272,_0x10287){var _0x5d2503=function(_0x5250ea){while(--_0x5250ea){_0x208272['push'](_0x208272['shift']());}};_0x5d2503(++_0x10287);}(_0x5fc3,0xa8));var _0x35fc=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x5fc3[_0x305486];return _0xa04940;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('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 bece681..f2ee15c 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 _0x6215=['sequelize','exports','STRING','TEXT'];(function(_0x1bf89a,_0x2a2949){var _0x198910=function(_0x171142){while(--_0x171142){_0x1bf89a['push'](_0x1bf89a['shift']());}};_0x198910(++_0x2a2949);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5621('0x0'));module[_0x5621('0x1')]={'name':{'type':Sequelize[_0x5621('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x5621('0x2')]},'metric':{'type':Sequelize[_0x5621('0x3')]},'description':{'type':Sequelize[_0x5621('0x2')]}}; \ No newline at end of file +var _0x85f8=['sequelize','exports','STRING','name','TEXT'];(function(_0x4a4a43,_0x115ccf){var _0x5893a6=function(_0x14c914){while(--_0x14c914){_0x4a4a43['push'](_0x4a4a43['shift']());}};_0x5893a6(++_0x115ccf);}(_0x85f8,0xd7));var _0x885f=function(_0x3eebdd,_0x2931d0){_0x3eebdd=_0x3eebdd-0x0;var _0x401213=_0x85f8[_0x3eebdd];return _0x401213;};'use strict';var Sequelize=require(_0x885f('0x0'));module[_0x885f('0x1')]={'name':{'type':Sequelize[_0x885f('0x2')],'allowNull':![],'unique':_0x885f('0x3')},'table':{'type':Sequelize[_0x885f('0x2')]},'metric':{'type':Sequelize[_0x885f('0x4')]},'description':{'type':Sequelize[_0x885f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fb268fc..bc03f15 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 _0x087b=['error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','sendStatus'];(function(_0x52b206,_0x65faf2){var _0x5ecabd=function(_0x55cfa3){while(--_0x55cfa3){_0x52b206['push'](_0x52b206['shift']());}};_0x5ecabd(++_0x65faf2);}(_0x087b,0x11a));var _0xb087=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x087b[_0x4e9d3c];return _0x2d0825;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x189e2b,_0x31f977){_0x31f977=_0x31f977||0xcc;return function(_0x323656){if(_0x323656){return _0x189e2b['sendStatus'](_0x31f977);}return _0x189e2b[_0xb087('0x1a')](_0x31f977)[_0xb087('0x1b')]();};}function respondWithResult(_0x43f136,_0x46410b){_0x46410b=_0x46410b||0xc8;return function(_0x11784c){if(_0x11784c){return _0x43f136[_0xb087('0x1a')](_0x46410b)[_0xb087('0x1c')](_0x11784c);}};}function respondWithFilteredResult(_0x5147e3,_0x24e1a3){return function(_0x16d0b7){if(_0x16d0b7){var _0x5193a4=_0x16d0b7[_0xb087('0x1d')],_0x43e576=_0x24e1a3[_0xb087('0x1e')],_0x412b48=_0x24e1a3[_0xb087('0x1e')]+_0x24e1a3['limit'],_0x597478;if(_0x412b48>=_0x5193a4){_0x412b48=_0x5193a4;_0x597478=0xc8;}else{_0x597478=0xce;}_0x5147e3[_0xb087('0x1a')](_0x597478);return _0x5147e3[_0xb087('0x1f')](_0xb087('0x20'),_0x43e576+'-'+_0x412b48+'/'+_0x5193a4)[_0xb087('0x1c')](_0x16d0b7);}return null;};}function patchUpdates(_0x4e333b){return function(_0x13d534){try{jsonpatch[_0xb087('0x21')](_0x13d534,_0x4e333b,!![]);}catch(_0x10bb5b){return BPromise[_0xb087('0x22')](_0x10bb5b);}return _0x13d534['save']();};}function saveUpdates(_0x5aeab1,_0x5ea3dc){return function(_0x49450a){if(_0x49450a){return _0x49450a[_0xb087('0x23')](_0x5aeab1)[_0xb087('0x24')](function(_0x3d0f57){return _0x3d0f57;});}return null;};}function removeEntity(_0x1f3c0e,_0x1fb765){return function(_0x258b4c){if(_0x258b4c){return _0x258b4c[_0xb087('0x25')]()['then'](function(){var _0x1d1424=_0x258b4c[_0xb087('0x26')]({'plain':!![]});var _0x1de654=_0xb087('0x27');return db[_0xb087('0x28')]['destroy']({'where':{'type':_0x1de654,'resourceId':_0x1d1424['id']}})[_0xb087('0x24')](function(){return _0x258b4c;});})[_0xb087('0x24')](function(){_0x1f3c0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(!_0x5a4ee0){_0x50745a[_0xb087('0x29')](0x194);}return _0x5a4ee0;};}function handleError(_0x45685d,_0x1d124f){_0x1d124f=_0x1d124f||0x1f4;return function(_0x3ca2df){logger[_0xb087('0x2a')](_0x3ca2df[_0xb087('0x2b')]);if(_0x3ca2df[_0xb087('0x2c')]){delete _0x3ca2df[_0xb087('0x2c')];}_0x45685d[_0xb087('0x1a')](_0x1d124f)[_0xb087('0x2d')](_0x3ca2df);};}exports[_0xb087('0x2e')]=function(_0x31e3e6,_0xb0baf6){var _0x263259={},_0x593b78={},_0x37393a={'count':0x0,'rows':[]};var _0x1335d9=_[_0xb087('0x2f')](db[_0xb087('0x30')][_0xb087('0x31')],function(_0xa6d90c){return{'name':_0xa6d90c[_0xb087('0x32')],'type':_0xa6d90c[_0xb087('0x33')]['key']};});_0x593b78['model']=_[_0xb087('0x2f')](_0x1335d9,_0xb087('0x2c'));_0x593b78['query']=_[_0xb087('0x34')](_0x31e3e6[_0xb087('0x35')]);_0x593b78[_0xb087('0x36')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],_0x593b78[_0xb087('0x35')]);_0x263259[_0xb087('0x39')]=_[_0xb087('0x37')](_0x593b78[_0xb087('0x38')],qs[_0xb087('0x3a')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x3a')]));_0x263259['attributes']=_0x263259[_0xb087('0x39')]['length']?_0x263259[_0xb087('0x39')]:_0x593b78[_0xb087('0x38')];if(!_0x31e3e6[_0xb087('0x35')][_0xb087('0x3b')](_0xb087('0x3c'))){_0x263259[_0xb087('0x3d')]=qs[_0xb087('0x3d')](_0x31e3e6[_0xb087('0x35')][_0xb087('0x3d')]);_0x263259['offset']=qs['offset'](_0x31e3e6[_0xb087('0x35')][_0xb087('0x1e')]);}_0x263259[_0xb087('0x3e')]=qs[_0xb087('0x3f')](_0x31e3e6[_0xb087('0x35')]['sort']);_0x263259[_0xb087('0x40')]=qs[_0xb087('0x36')](_['pick'](_0x31e3e6['query'],_0x593b78[_0xb087('0x36')]),_0x1335d9);if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x41')]){_0x263259['where']=_[_0xb087('0x42')](_0x263259[_0xb087('0x40')],{'$or':_[_0xb087('0x2f')](_0x1335d9,function(_0x1ed2c9){if(_0x1ed2c9[_0xb087('0x33')]!=='VIRTUAL'){var _0x7e1315={};_0x7e1315[_0x1ed2c9['name']]={'$like':'%'+_0x31e3e6[_0xb087('0x35')]['filter']+'%'};return _0x7e1315;}})});}_0x263259=_[_0xb087('0x42')]({},_0x263259,_0x31e3e6[_0xb087('0x43')]);var _0x513332={'where':_0x263259[_0xb087('0x40')]};return db['AnalyticMetric'][_0xb087('0x1d')](_0x513332)['then'](function(_0x2d2c74){_0x37393a[_0xb087('0x1d')]=_0x2d2c74;if(_0x31e3e6[_0xb087('0x35')][_0xb087('0x44')]){_0x263259[_0xb087('0x45')]=[{'all':!![]}];}return db[_0xb087('0x30')][_0xb087('0x46')](_0x263259);})['then'](function(_0x1625f6){_0x37393a['rows']=_0x1625f6;return _0x37393a;})[_0xb087('0x24')](respondWithFilteredResult(_0xb0baf6,_0x263259))[_0xb087('0x47')](handleError(_0xb0baf6,null));};exports['show']=function(_0xb662bf,_0x45dc6f){var _0x7650c5={'raw':!![],'where':{'id':_0xb662bf[_0xb087('0x48')]['id']}},_0x4c33cc={};_0x4c33cc['model']=_[_0xb087('0x34')](db[_0xb087('0x30')]['rawAttributes']);_0x4c33cc[_0xb087('0x35')]=_[_0xb087('0x34')](_0xb662bf['query']);_0x4c33cc[_0xb087('0x36')]=_[_0xb087('0x37')](_0x4c33cc['model'],_0x4c33cc[_0xb087('0x35')]);_0x7650c5[_0xb087('0x39')]=_[_0xb087('0x37')](_0x4c33cc[_0xb087('0x38')],qs['fields'](_0xb662bf['query'][_0xb087('0x3a')]));_0x7650c5[_0xb087('0x39')]=_0x7650c5[_0xb087('0x39')][_0xb087('0x49')]?_0x7650c5[_0xb087('0x39')]:_0x4c33cc[_0xb087('0x38')];if(_0xb662bf['query']['includeAll']){_0x7650c5[_0xb087('0x45')]=[{'all':!![]}];}_0x7650c5=_['merge']({},_0x7650c5,_0xb662bf[_0xb087('0x43')]);return db[_0xb087('0x30')][_0xb087('0x4a')](_0x7650c5)[_0xb087('0x24')](handleEntityNotFound(_0x45dc6f,null))['then'](respondWithResult(_0x45dc6f,null))[_0xb087('0x47')](handleError(_0x45dc6f,null));};exports['create']=function(_0x2fe8a0,_0x73413b){return db[_0xb087('0x30')][_0xb087('0x4b')](_0x2fe8a0[_0xb087('0x4c')],{})['then'](function(_0x21506f){var _0xb15e28=_0x2fe8a0[_0xb087('0x4d')]['get']({'plain':!![]});if(!_0xb15e28)throw new Error(_0xb087('0x4e'));if(_0xb15e28['role']==='user'){var _0x1c9f8f=_0x21506f[_0xb087('0x26')]({'plain':!![]});var _0x5eacf3=_0xb087('0x27');return db[_0xb087('0x4f')][_0xb087('0x4a')]({'where':{'name':_0x5eacf3,'userProfileId':_0xb15e28['userProfileId']},'raw':!![]})['then'](function(_0x30cc83){if(_0x30cc83&&_0x30cc83['autoAssociation']===0x0){return db['UserProfileResource'][_0xb087('0x4b')]({'name':_0x1c9f8f[_0xb087('0x2c')],'resourceId':_0x1c9f8f['id'],'type':_0x30cc83[_0xb087('0x2c')],'sectionId':_0x30cc83['id']},{})[_0xb087('0x24')](function(){return _0x21506f;});}else{return _0x21506f;}})[_0xb087('0x47')](function(_0x148642){logger[_0xb087('0x2a')](_0xb087('0x50'),_0x148642);throw _0x148642;});}return _0x21506f;})[_0xb087('0x24')](respondWithResult(_0x73413b,0xc9))[_0xb087('0x47')](handleError(_0x73413b,null));};exports[_0xb087('0x23')]=function(_0x2cfc44,_0x55e653){if(_0x2cfc44[_0xb087('0x4c')]['id']){delete _0x2cfc44[_0xb087('0x4c')]['id'];}return db['AnalyticMetric'][_0xb087('0x4a')]({'where':{'id':_0x2cfc44[_0xb087('0x48')]['id']}})[_0xb087('0x24')](handleEntityNotFound(_0x55e653,null))[_0xb087('0x24')](saveUpdates(_0x2cfc44[_0xb087('0x4c')],null))[_0xb087('0x24')](respondWithResult(_0x55e653,null))[_0xb087('0x47')](handleError(_0x55e653,null));};exports[_0xb087('0x25')]=function(_0x2b4f9e,_0x357616){return db[_0xb087('0x30')]['find']({'where':{'id':_0x2b4f9e[_0xb087('0x48')]['id']}})['then'](handleEntityNotFound(_0x357616,null))[_0xb087('0x24')](removeEntity(_0x357616,null))['catch'](handleError(_0x357616,null));}; \ No newline at end of file +var _0x3de3=['index','map','AnalyticMetric','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','UserProfileResource','error','stack','name','send'];(function(_0xaddcbc,_0x1d59d3){var _0xadecbd=function(_0x31122e){while(--_0x31122e){_0xaddcbc['push'](_0xaddcbc['shift']());}};_0xadecbd(++_0x1d59d3);}(_0x3de3,0x1ce));var _0x33de=function(_0x5f5aaa,_0x290bf7){_0x5f5aaa=_0x5f5aaa-0x0;var _0x313b02=_0x3de3[_0x5f5aaa];return _0x313b02;};'use strict';var pdf=require(_0x33de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33de('0x1'));var zipdir=require(_0x33de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33de('0x3'));var moment=require(_0x33de('0x4'));var BPromise=require(_0x33de('0x5'));var Mustache=require(_0x33de('0x6'));var util=require('util');var path=require(_0x33de('0x7'));var sox=require(_0x33de('0x8'));var csv=require('to-csv');var ejs=require(_0x33de('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0xd'));var querystring=require(_0x33de('0xe'));var Papa=require(_0x33de('0xf'));var Redis=require('ioredis');var authService=require(_0x33de('0x10'));var qs=require(_0x33de('0x11'));var as=require(_0x33de('0x12'));var hardwareService=require(_0x33de('0x13'));var logger=require(_0x33de('0x14'))(_0x33de('0x15'));var utils=require(_0x33de('0x16'));var config=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x306efc,_0x27d1d8){_0x27d1d8=_0x27d1d8||0xcc;return function(_0x5170ad){if(_0x5170ad){return _0x306efc[_0x33de('0x19')](_0x27d1d8);}return _0x306efc[_0x33de('0x1a')](_0x27d1d8)['end']();};}function respondWithResult(_0x5392c0,_0x4164ab){_0x4164ab=_0x4164ab||0xc8;return function(_0x22bda8){if(_0x22bda8){return _0x5392c0[_0x33de('0x1a')](_0x4164ab)[_0x33de('0x1b')](_0x22bda8);}};}function respondWithFilteredResult(_0x57aa73,_0x11e6b5){return function(_0x1b1166){if(_0x1b1166){var _0x522ba0=_0x1b1166[_0x33de('0x1c')],_0x4ff69f=_0x11e6b5['offset'],_0x185849=_0x11e6b5[_0x33de('0x1d')]+_0x11e6b5[_0x33de('0x1e')],_0x16c050;if(_0x185849>=_0x522ba0){_0x185849=_0x522ba0;_0x16c050=0xc8;}else{_0x16c050=0xce;}_0x57aa73['status'](_0x16c050);return _0x57aa73[_0x33de('0x1f')](_0x33de('0x20'),_0x4ff69f+'-'+_0x185849+'/'+_0x522ba0)['json'](_0x1b1166);}return null;};}function patchUpdates(_0x5bb74e){return function(_0x1cf3dd){try{jsonpatch['apply'](_0x1cf3dd,_0x5bb74e,!![]);}catch(_0x16255f){return BPromise[_0x33de('0x21')](_0x16255f);}return _0x1cf3dd[_0x33de('0x22')]();};}function saveUpdates(_0x315c9b,_0xc4f1a4){return function(_0x40a8e6){if(_0x40a8e6){return _0x40a8e6[_0x33de('0x23')](_0x315c9b)['then'](function(_0x571086){return _0x571086;});}return null;};}function removeEntity(_0x34e7ef,_0x5af3fa){return function(_0x8acd8d){if(_0x8acd8d){return _0x8acd8d['destroy']()[_0x33de('0x24')](function(){var _0x194a83=_0x8acd8d['get']({'plain':!![]});var _0x2dbcf2='Metrics';return db[_0x33de('0x25')]['destroy']({'where':{'type':_0x2dbcf2,'resourceId':_0x194a83['id']}})[_0x33de('0x24')](function(){return _0x8acd8d;});})[_0x33de('0x24')](function(){_0x34e7ef[_0x33de('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdba4,_0x2d206b){return function(_0x140979){if(!_0x140979){_0x3bdba4['sendStatus'](0x194);}return _0x140979;};}function handleError(_0x34fba3,_0x5585a2){_0x5585a2=_0x5585a2||0x1f4;return function(_0x566373){logger[_0x33de('0x26')](_0x566373[_0x33de('0x27')]);if(_0x566373[_0x33de('0x28')]){delete _0x566373[_0x33de('0x28')];}_0x34fba3[_0x33de('0x1a')](_0x5585a2)[_0x33de('0x29')](_0x566373);};}exports[_0x33de('0x2a')]=function(_0x1b4703,_0x59bc3b){var _0x5ae0e8={},_0x2755e6={},_0x1420d2={'count':0x0,'rows':[]};var _0xaeaec5=_[_0x33de('0x2b')](db[_0x33de('0x2c')][_0x33de('0x2d')],function(_0x427e82){return{'name':_0x427e82['fieldName'],'type':_0x427e82[_0x33de('0x2e')][_0x33de('0x2f')]};});_0x2755e6[_0x33de('0x30')]=_[_0x33de('0x2b')](_0xaeaec5,'name');_0x2755e6[_0x33de('0x31')]=_[_0x33de('0x32')](_0x1b4703['query']);_0x2755e6['filters']=_['intersection'](_0x2755e6[_0x33de('0x30')],_0x2755e6[_0x33de('0x31')]);_0x5ae0e8['attributes']=_[_0x33de('0x33')](_0x2755e6['model'],qs['fields'](_0x1b4703[_0x33de('0x31')][_0x33de('0x34')]));_0x5ae0e8[_0x33de('0x35')]=_0x5ae0e8[_0x33de('0x35')][_0x33de('0x36')]?_0x5ae0e8[_0x33de('0x35')]:_0x2755e6[_0x33de('0x30')];if(!_0x1b4703[_0x33de('0x31')]['hasOwnProperty'](_0x33de('0x37'))){_0x5ae0e8['limit']=qs[_0x33de('0x1e')](_0x1b4703['query']['limit']);_0x5ae0e8[_0x33de('0x1d')]=qs[_0x33de('0x1d')](_0x1b4703[_0x33de('0x31')][_0x33de('0x1d')]);}_0x5ae0e8[_0x33de('0x38')]=qs[_0x33de('0x39')](_0x1b4703['query'][_0x33de('0x39')]);_0x5ae0e8[_0x33de('0x3a')]=qs[_0x33de('0x3b')](_[_0x33de('0x3c')](_0x1b4703[_0x33de('0x31')],_0x2755e6[_0x33de('0x3b')]),_0xaeaec5);if(_0x1b4703[_0x33de('0x31')]['filter']){_0x5ae0e8[_0x33de('0x3a')]=_[_0x33de('0x3d')](_0x5ae0e8[_0x33de('0x3a')],{'$or':_[_0x33de('0x2b')](_0xaeaec5,function(_0x46ddfe){if(_0x46ddfe[_0x33de('0x2e')]!==_0x33de('0x3e')){var _0x511691={};_0x511691[_0x46ddfe[_0x33de('0x28')]]={'$like':'%'+_0x1b4703[_0x33de('0x31')][_0x33de('0x3f')]+'%'};return _0x511691;}})});}_0x5ae0e8=_[_0x33de('0x3d')]({},_0x5ae0e8,_0x1b4703[_0x33de('0x40')]);var _0x640136={'where':_0x5ae0e8['where']};return db[_0x33de('0x2c')]['count'](_0x640136)[_0x33de('0x24')](function(_0x66897c){_0x1420d2['count']=_0x66897c;if(_0x1b4703[_0x33de('0x31')][_0x33de('0x41')]){_0x5ae0e8[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2c')][_0x33de('0x43')](_0x5ae0e8);})[_0x33de('0x24')](function(_0x22518d){_0x1420d2[_0x33de('0x44')]=_0x22518d;return _0x1420d2;})[_0x33de('0x24')](respondWithFilteredResult(_0x59bc3b,_0x5ae0e8))['catch'](handleError(_0x59bc3b,null));};exports['show']=function(_0x417d9b,_0x1f75f7){var _0x20d04f={'raw':!![],'where':{'id':_0x417d9b['params']['id']}},_0x376c55={};_0x376c55[_0x33de('0x30')]=_['keys'](db['AnalyticMetric'][_0x33de('0x2d')]);_0x376c55[_0x33de('0x31')]=_[_0x33de('0x32')](_0x417d9b[_0x33de('0x31')]);_0x376c55[_0x33de('0x3b')]=_[_0x33de('0x33')](_0x376c55[_0x33de('0x30')],_0x376c55['query']);_0x20d04f[_0x33de('0x35')]=_['intersection'](_0x376c55[_0x33de('0x30')],qs['fields'](_0x417d9b[_0x33de('0x31')][_0x33de('0x34')]));_0x20d04f['attributes']=_0x20d04f[_0x33de('0x35')][_0x33de('0x36')]?_0x20d04f[_0x33de('0x35')]:_0x376c55['model'];if(_0x417d9b['query'][_0x33de('0x41')]){_0x20d04f[_0x33de('0x42')]=[{'all':!![]}];}_0x20d04f=_['merge']({},_0x20d04f,_0x417d9b['options']);return db[_0x33de('0x2c')]['find'](_0x20d04f)['then'](handleEntityNotFound(_0x1f75f7,null))['then'](respondWithResult(_0x1f75f7,null))[_0x33de('0x45')](handleError(_0x1f75f7,null));};exports[_0x33de('0x46')]=function(_0x9a816c,_0xce6079){return db['AnalyticMetric']['create'](_0x9a816c[_0x33de('0x47')],{})[_0x33de('0x24')](function(_0x5684f8){var _0x1d016b=_0x9a816c[_0x33de('0x48')][_0x33de('0x49')]({'plain':!![]});if(!_0x1d016b)throw new Error(_0x33de('0x4a'));if(_0x1d016b[_0x33de('0x4b')]==='user'){var _0x185e5f=_0x5684f8[_0x33de('0x49')]({'plain':!![]});var _0x4fe3a2=_0x33de('0x4c');return db[_0x33de('0x4d')][_0x33de('0x4e')]({'where':{'name':_0x4fe3a2,'userProfileId':_0x1d016b[_0x33de('0x4f')]},'raw':!![]})[_0x33de('0x24')](function(_0x40f1b7){if(_0x40f1b7&&_0x40f1b7[_0x33de('0x50')]===0x0){return db[_0x33de('0x25')][_0x33de('0x46')]({'name':_0x185e5f[_0x33de('0x28')],'resourceId':_0x185e5f['id'],'type':_0x40f1b7['name'],'sectionId':_0x40f1b7['id']},{})[_0x33de('0x24')](function(){return _0x5684f8;});}else{return _0x5684f8;}})[_0x33de('0x45')](function(_0x2e2cd7){logger[_0x33de('0x26')](_0x33de('0x51'),_0x2e2cd7);throw _0x2e2cd7;});}return _0x5684f8;})[_0x33de('0x24')](respondWithResult(_0xce6079,0xc9))[_0x33de('0x45')](handleError(_0xce6079,null));};exports['update']=function(_0x109ec5,_0x32042e){if(_0x109ec5[_0x33de('0x47')]['id']){delete _0x109ec5['body']['id'];}return db[_0x33de('0x2c')][_0x33de('0x4e')]({'where':{'id':_0x109ec5[_0x33de('0x52')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0x32042e,null))['then'](saveUpdates(_0x109ec5['body'],null))[_0x33de('0x24')](respondWithResult(_0x32042e,null))[_0x33de('0x45')](handleError(_0x32042e,null));};exports[_0x33de('0x53')]=function(_0x29a13b,_0x379784){return db['AnalyticMetric']['find']({'where':{'id':_0x29a13b[_0x33de('0x52')]['id']}})[_0x33de('0x24')](handleEntityNotFound(_0x379784,null))[_0x33de('0x24')](removeEntity(_0x379784,null))[_0x33de('0x45')](handleError(_0x379784,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d65ce34..f2c57a1 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 _0xc10f=['rimraf','../../config/environment','exports','AnalyticMetric','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dc9bc,_0x77bc87){var _0x23a813=function(_0x166ab9){while(--_0x166ab9){_0x3dc9bc['push'](_0x3dc9bc['shift']());}};_0x23a813(++_0x77bc87);}(_0xc10f,0x124));var _0xfc10=function(_0x346b28,_0x5e0181){_0x346b28=_0x346b28-0x0;var _0x406ddd=_0xc10f[_0x346b28];return _0x406ddd;};'use strict';var _=require(_0xfc10('0x0'));var util=require(_0xfc10('0x1'));var logger=require(_0xfc10('0x2'))(_0xfc10('0x3'));var moment=require(_0xfc10('0x4'));var BPromise=require(_0xfc10('0x5'));var rp=require(_0xfc10('0x6'));var fs=require('fs');var path=require(_0xfc10('0x7'));var rimraf=require(_0xfc10('0x8'));var config=require(_0xfc10('0x9'));var attributes=require('./analyticMetric.attributes');module[_0xfc10('0xa')]=function(_0x7dc590,_0x5ed8a9){return _0x7dc590['define'](_0xfc10('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e4d=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x27ef2d,_0x352030){var _0x7063cc=function(_0x52ec69){while(--_0x52ec69){_0x27ef2d['push'](_0x27ef2d['shift']());}};_0x7063cc(++_0x352030);}(_0x1e4d,0xc6));var _0xd1e4=function(_0x58ea51,_0x506d1b){_0x58ea51=_0x58ea51-0x0;var _0x2a88ab=_0x1e4d[_0x58ea51];return _0x2a88ab;};'use strict';var _=require(_0xd1e4('0x0'));var util=require(_0xd1e4('0x1'));var logger=require(_0xd1e4('0x2'))('api');var moment=require(_0xd1e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1e4('0x4'));var rimraf=require(_0xd1e4('0x5'));var config=require(_0xd1e4('0x6'));var attributes=require(_0xd1e4('0x7'));module[_0xd1e4('0x8')]=function(_0x10184e,_0x38f843){return _0x10184e[_0xd1e4('0x9')](_0xd1e4('0xa'),attributes,{'tableName':_0xd1e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 3193e29..dac512a 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 _0x32a3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x35cdbf,_0x133e7e){var _0x389a88=function(_0x5924bd){while(--_0x5924bd){_0x35cdbf['push'](_0x35cdbf['shift']());}};_0x389a88(++_0x133e7e);}(_0x32a3,0x1b5));var _0x332a=function(_0x343336,_0x566e42){_0x343336=_0x343336-0x0;var _0x566a1e=_0x32a3[_0x343336];return _0x566a1e;};'use strict';var _=require(_0x332a('0x0'));var util=require(_0x332a('0x1'));var moment=require(_0x332a('0x2'));var BPromise=require('bluebird');var rs=require(_0x332a('0x3'));var fs=require('fs');var Redis=require(_0x332a('0x4'));var db=require(_0x332a('0x5'))['db'];var utils=require(_0x332a('0x6'));var logger=require(_0x332a('0x7'))('rpc');var config=require(_0x332a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x332a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x299df7,_0x2cee9f,_0x5a35cc){return new BPromise(function(_0xa4ca6f,_0x1b2a68){return client['request'](_0x299df7,_0x5a35cc)[_0x332a('0xa')](function(_0x45ef16){logger[_0x332a('0xb')](_0x332a('0xc'),_0x2cee9f,_0x332a('0xd'));logger['debug'](_0x332a('0xe'),_0x2cee9f,_0x332a('0xd'),JSON[_0x332a('0xf')](_0x45ef16));if(_0x45ef16[_0x332a('0x10')]){if(_0x45ef16[_0x332a('0x10')][_0x332a('0x11')]===0x1f4){logger['error'](_0x332a('0xc'),_0x2cee9f,_0x45ef16[_0x332a('0x10')][_0x332a('0x12')]);return _0x1b2a68(_0x45ef16[_0x332a('0x10')]['message']);}logger[_0x332a('0x10')](_0x332a('0xc'),_0x2cee9f,_0x45ef16[_0x332a('0x10')][_0x332a('0x12')]);return _0xa4ca6f(_0x45ef16[_0x332a('0x10')][_0x332a('0x12')]);}else{logger[_0x332a('0xb')](_0x332a('0xc'),_0x2cee9f,_0x332a('0xd'));_0xa4ca6f(_0x45ef16[_0x332a('0x13')][_0x332a('0x12')]);}})[_0x332a('0x14')](function(_0x8dea1d){logger[_0x332a('0x10')](_0x332a('0xc'),_0x2cee9f,_0x8dea1d);_0x1b2a68(_0x8dea1d);});});} \ No newline at end of file +var _0x6bb7=['AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6bb7,0xd9));var _0x76bb=function(_0x3aa4dc,_0x540ed3){_0x3aa4dc=_0x3aa4dc-0x0;var _0x2e07b6=_0x6bb7[_0x3aa4dc];return _0x2e07b6;};'use strict';var _=require('lodash');var util=require(_0x76bb('0x0'));var moment=require(_0x76bb('0x1'));var BPromise=require(_0x76bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x76bb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x76bb('0x5'));var client=jayson[_0x76bb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34e254,_0x4fe9fc,_0x283b86){return new BPromise(function(_0x59af64,_0x44d318){return client['request'](_0x34e254,_0x283b86)['then'](function(_0x56abab){logger['info'](_0x76bb('0x7'),_0x4fe9fc,'request\x20sent');logger[_0x76bb('0x8')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4fe9fc,_0x76bb('0x9'),JSON[_0x76bb('0xa')](_0x56abab));if(_0x56abab[_0x76bb('0xb')]){if(_0x56abab[_0x76bb('0xb')]['code']===0x1f4){logger['error'](_0x76bb('0x7'),_0x4fe9fc,_0x56abab[_0x76bb('0xb')]['message']);return _0x44d318(_0x56abab[_0x76bb('0xb')][_0x76bb('0xc')]);}logger[_0x76bb('0xb')](_0x76bb('0x7'),_0x4fe9fc,_0x56abab[_0x76bb('0xb')][_0x76bb('0xc')]);return _0x59af64(_0x56abab[_0x76bb('0xb')]['message']);}else{logger[_0x76bb('0xd')](_0x76bb('0x7'),_0x4fe9fc,_0x76bb('0x9'));_0x59af64(_0x56abab['result'][_0x76bb('0xc')]);}})['catch'](function(_0x36207b){logger[_0x76bb('0xb')](_0x76bb('0x7'),_0x4fe9fc,_0x36207b);_0x44d318(_0x36207b);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 99e3c27..2de2397 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 _0x4137=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5ed413,_0x4f26c0){var _0x3cca33=function(_0x214afe){while(--_0x214afe){_0x5ed413['push'](_0x5ed413['shift']());}};_0x3cca33(++_0x4f26c0);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var auth=require(_0x7413('0x6'));var interaction=require(_0x7413('0x7'));var config=require(_0x7413('0x8'));var controller=require(_0x7413('0x9'));router[_0x7413('0xa')]('/',auth[_0x7413('0xb')](),controller['index']);router[_0x7413('0xa')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0xd')]);router['post']('/',auth[_0x7413('0xb')](),controller[_0x7413('0xe')]);router['put'](_0x7413('0xc'),auth[_0x7413('0xb')](),controller['update']);router[_0x7413('0xf')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0x10')]);module[_0x7413('0x11')]=router; \ No newline at end of file +var _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x26926f,_0x31ec81){var _0x2991e7=function(_0x1af95c){while(--_0x1af95c){_0x26926f['push'](_0x26926f['shift']());}};_0x2991e7(++_0x31ec81);}(_0x187d,0x93));var _0xd187=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x187d[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 596bc09..5a7293d 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 _0x59c2=['exports','TEXT'];(function(_0x2d9259,_0x42a805){var _0xe4c0df=function(_0x5151cc){while(--_0x5151cc){_0x2d9259['push'](_0x2d9259['shift']());}};_0xe4c0df(++_0x42a805);}(_0x59c2,0x78));var _0x259c=function(_0x57b3df,_0x445081){_0x57b3df=_0x57b3df-0x0;var _0x206656=_0x59c2[_0x57b3df];return _0x206656;};'use strict';var Sequelize=require('sequelize');module[_0x259c('0x0')]={'tree':{'type':Sequelize[_0x259c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9f79=['TEXT','sequelize'];(function(_0xe9df05,_0x2a301b){var _0x2e210c=function(_0x3ee8af){while(--_0x3ee8af){_0xe9df05['push'](_0xe9df05['shift']());}};_0x2e210c(++_0x2a301b);}(_0x9f79,0x18b));var _0x99f7=function(_0x5896d6,_0x42e430){_0x5896d6=_0x5896d6-0x0;var _0x13c41f=_0x9f79[_0x5896d6];return _0x13c41f;};'use strict';var Sequelize=require(_0x99f7('0x0'));module['exports']={'tree':{'type':Sequelize[_0x99f7('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7510019..1919891 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 _0xb918=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','json','offset','Content-Range','apply','reject','save','destroy','end','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','count','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x14506b,_0x2aa81a){var _0x62dbf7=function(_0x3e8428){while(--_0x3e8428){_0x14506b['push'](_0x14506b['shift']());}};_0x62dbf7(++_0x2aa81a);}(_0xb918,0x7c));var _0x8b91=function(_0x14f109,_0x47866a){_0x14f109=_0x14f109-0x0;var _0x7d66dc=_0xb918[_0x14f109];return _0x7d66dc;};'use strict';var pdf=require(_0x8b91('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b91('0x1'));var zipdir=require(_0x8b91('0x2'));var jsonpatch=require(_0x8b91('0x3'));var rp=require('request-promise');var moment=require(_0x8b91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b91('0x5'));var util=require('util');var path=require(_0x8b91('0x6'));var sox=require(_0x8b91('0x7'));var csv=require(_0x8b91('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b91('0x9'));var squel=require('squel');var crypto=require(_0x8b91('0xa'));var jsforce=require(_0x8b91('0xb'));var deskjs=require(_0x8b91('0xc'));var toCsv=require(_0x8b91('0x8'));var querystring=require(_0x8b91('0xd'));var Papa=require(_0x8b91('0xe'));var Redis=require(_0x8b91('0xf'));var authService=require(_0x8b91('0x10'));var qs=require(_0x8b91('0x11'));var as=require(_0x8b91('0x12'));var hardwareService=require(_0x8b91('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8b91('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c6503,_0xf0dee6){_0xf0dee6=_0xf0dee6||0xcc;return function(_0x5dc154){if(_0x5dc154){return _0x5c6503[_0x8b91('0x15')](_0xf0dee6);}return _0x5c6503['status'](_0xf0dee6)['end']();};}function respondWithResult(_0x231c97,_0x370e5f){_0x370e5f=_0x370e5f||0xc8;return function(_0x568568){if(_0x568568){return _0x231c97[_0x8b91('0x16')](_0x370e5f)[_0x8b91('0x17')](_0x568568);}};}function respondWithFilteredResult(_0x13cafe,_0x29b968){return function(_0x421281){if(_0x421281){var _0x26cc8b=_0x421281['count'],_0x229a2d=_0x29b968[_0x8b91('0x18')],_0x54f889=_0x29b968['offset']+_0x29b968['limit'],_0x1e999b;if(_0x54f889>=_0x26cc8b){_0x54f889=_0x26cc8b;_0x1e999b=0xc8;}else{_0x1e999b=0xce;}_0x13cafe[_0x8b91('0x16')](_0x1e999b);return _0x13cafe['set'](_0x8b91('0x19'),_0x229a2d+'-'+_0x54f889+'/'+_0x26cc8b)[_0x8b91('0x17')](_0x421281);}return null;};}function patchUpdates(_0x1ad02a){return function(_0x310b5b){try{jsonpatch[_0x8b91('0x1a')](_0x310b5b,_0x1ad02a,!![]);}catch(_0x369f37){return BPromise[_0x8b91('0x1b')](_0x369f37);}return _0x310b5b[_0x8b91('0x1c')]();};}function saveUpdates(_0xea6634,_0x1f7dcb){return function(_0x108490){if(_0x108490){return _0x108490['update'](_0xea6634)['then'](function(_0x542210){return _0x542210;});}return null;};}function removeEntity(_0x2e0a92,_0x2cf84f){return function(_0x436d1b){if(_0x436d1b){return _0x436d1b[_0x8b91('0x1d')]()['then'](function(){_0x2e0a92[_0x8b91('0x16')](0xcc)[_0x8b91('0x1e')]();});}};}function handleEntityNotFound(_0x3acf1f,_0x2d3300){return function(_0x2c66d1){if(!_0x2c66d1){_0x3acf1f[_0x8b91('0x15')](0x194);}return _0x2c66d1;};}function handleError(_0x3eaa89,_0x18717a){_0x18717a=_0x18717a||0x1f4;return function(_0x3fc329){logger[_0x8b91('0x1f')](_0x3fc329['stack']);if(_0x3fc329['name']){delete _0x3fc329[_0x8b91('0x20')];}_0x3eaa89[_0x8b91('0x16')](_0x18717a)[_0x8b91('0x21')](_0x3fc329);};}exports[_0x8b91('0x22')]=function(_0x54f593,_0x8b9720){var _0xd2444b={},_0x41a381={},_0x4d3bfb={'count':0x0,'rows':[]};var _0x194ac1=_[_0x8b91('0x23')](db[_0x8b91('0x24')][_0x8b91('0x25')],function(_0x15c936){return{'name':_0x15c936[_0x8b91('0x26')],'type':_0x15c936['type'][_0x8b91('0x27')]};});_0x41a381[_0x8b91('0x28')]=_['map'](_0x194ac1,_0x8b91('0x20'));_0x41a381['query']=_[_0x8b91('0x29')](_0x54f593['query']);_0x41a381[_0x8b91('0x2a')]=_[_0x8b91('0x2b')](_0x41a381['model'],_0x41a381[_0x8b91('0x2c')]);_0xd2444b[_0x8b91('0x2d')]=_[_0x8b91('0x2b')](_0x41a381[_0x8b91('0x28')],qs[_0x8b91('0x2e')](_0x54f593[_0x8b91('0x2c')][_0x8b91('0x2e')]));_0xd2444b['attributes']=_0xd2444b[_0x8b91('0x2d')][_0x8b91('0x2f')]?_0xd2444b['attributes']:_0x41a381['model'];if(!_0x54f593[_0x8b91('0x2c')][_0x8b91('0x30')](_0x8b91('0x31'))){_0xd2444b[_0x8b91('0x32')]=qs[_0x8b91('0x32')](_0x54f593['query'][_0x8b91('0x32')]);_0xd2444b[_0x8b91('0x18')]=qs[_0x8b91('0x18')](_0x54f593[_0x8b91('0x2c')][_0x8b91('0x18')]);}_0xd2444b[_0x8b91('0x33')]=qs[_0x8b91('0x34')](_0x54f593['query'][_0x8b91('0x34')]);_0xd2444b[_0x8b91('0x35')]=qs[_0x8b91('0x2a')](_['pick'](_0x54f593['query'],_0x41a381[_0x8b91('0x2a')]),_0x194ac1);if(_0x54f593[_0x8b91('0x2c')][_0x8b91('0x36')]){_0xd2444b[_0x8b91('0x35')]=_['merge'](_0xd2444b[_0x8b91('0x35')],{'$or':_[_0x8b91('0x23')](_0x194ac1,function(_0x3c2ffb){if(_0x3c2ffb['type']!==_0x8b91('0x37')){var _0x3c6ac2={};_0x3c6ac2[_0x3c2ffb['name']]={'$like':'%'+_0x54f593['query']['filter']+'%'};return _0x3c6ac2;}})});}_0xd2444b=_[_0x8b91('0x38')]({},_0xd2444b,_0x54f593[_0x8b91('0x39')]);var _0x4ba15a={'where':_0xd2444b[_0x8b91('0x35')]};return db['AnalyticTreeReport'][_0x8b91('0x3a')](_0x4ba15a)[_0x8b91('0x3b')](function(_0x3186a7){_0x4d3bfb[_0x8b91('0x3a')]=_0x3186a7;if(_0x54f593[_0x8b91('0x2c')][_0x8b91('0x3c')]){_0xd2444b[_0x8b91('0x3d')]=[{'all':!![]}];}return db[_0x8b91('0x24')][_0x8b91('0x3e')](_0xd2444b);})['then'](function(_0x1bc9ab){_0x4d3bfb[_0x8b91('0x3f')]=_0x1bc9ab;return _0x4d3bfb;})[_0x8b91('0x3b')](respondWithFilteredResult(_0x8b9720,_0xd2444b))[_0x8b91('0x40')](handleError(_0x8b9720,null));};exports[_0x8b91('0x41')]=function(_0x37c706,_0x553e61){var _0x38abfb={'raw':!![],'where':{'id':_0x37c706[_0x8b91('0x42')]['id']}},_0x4929e5={};_0x4929e5[_0x8b91('0x28')]=_[_0x8b91('0x29')](db[_0x8b91('0x24')]['rawAttributes']);_0x4929e5[_0x8b91('0x2c')]=_[_0x8b91('0x29')](_0x37c706[_0x8b91('0x2c')]);_0x4929e5['filters']=_[_0x8b91('0x2b')](_0x4929e5[_0x8b91('0x28')],_0x4929e5['query']);_0x38abfb['attributes']=_[_0x8b91('0x2b')](_0x4929e5[_0x8b91('0x28')],qs['fields'](_0x37c706[_0x8b91('0x2c')]['fields']));_0x38abfb['attributes']=_0x38abfb[_0x8b91('0x2d')][_0x8b91('0x2f')]?_0x38abfb['attributes']:_0x4929e5[_0x8b91('0x28')];if(_0x37c706['query'][_0x8b91('0x3c')]){_0x38abfb[_0x8b91('0x3d')]=[{'all':!![]}];}_0x38abfb=_[_0x8b91('0x38')]({},_0x38abfb,_0x37c706[_0x8b91('0x39')]);return db[_0x8b91('0x24')][_0x8b91('0x43')](_0x38abfb)[_0x8b91('0x3b')](handleEntityNotFound(_0x553e61,null))[_0x8b91('0x3b')](respondWithResult(_0x553e61,null))[_0x8b91('0x40')](handleError(_0x553e61,null));};exports['create']=function(_0x493bd9,_0x42ea68){return db[_0x8b91('0x24')][_0x8b91('0x44')](_0x493bd9[_0x8b91('0x45')],{})[_0x8b91('0x3b')](respondWithResult(_0x42ea68,0xc9))[_0x8b91('0x40')](handleError(_0x42ea68,null));};exports[_0x8b91('0x46')]=function(_0x412692,_0xfe058){if(_0x412692['body']['id']){delete _0x412692[_0x8b91('0x45')]['id'];}return db[_0x8b91('0x24')][_0x8b91('0x43')]({'where':{'id':_0x412692[_0x8b91('0x42')]['id']}})['then'](handleEntityNotFound(_0xfe058,null))[_0x8b91('0x3b')](saveUpdates(_0x412692[_0x8b91('0x45')],null))[_0x8b91('0x3b')](respondWithResult(_0xfe058,null))['catch'](handleError(_0xfe058,null));};exports[_0x8b91('0x1d')]=function(_0x248284,_0x4318c2){return db[_0x8b91('0x24')]['find']({'where':{'id':_0x248284['params']['id']}})[_0x8b91('0x3b')](handleEntityNotFound(_0x4318c2,null))[_0x8b91('0x3b')](removeEntity(_0x4318c2,null))[_0x8b91('0x40')](handleError(_0x4318c2,null));}; \ No newline at end of file +var _0x32eb=['then','destroy','end','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','update'];(function(_0x3da966,_0xdc1228){var _0x1f84dc=function(_0x5ea46f){while(--_0x5ea46f){_0x3da966['push'](_0x3da966['shift']());}};_0x1f84dc(++_0xdc1228);}(_0x32eb,0xb2));var _0xb32e=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x32eb[_0x4f9b18];return _0x29f20c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb32e('0x0'));var rimraf=require(_0xb32e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb32e('0x2'));var rp=require(_0xb32e('0x3'));var moment=require('moment');var BPromise=require(_0xb32e('0x4'));var Mustache=require(_0xb32e('0x5'));var util=require('util');var path=require(_0xb32e('0x6'));var sox=require(_0xb32e('0x7'));var csv=require(_0xb32e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb32e('0x9'));var squel=require(_0xb32e('0xa'));var crypto=require('crypto');var jsforce=require(_0xb32e('0xb'));var deskjs=require(_0xb32e('0xc'));var toCsv=require(_0xb32e('0x8'));var querystring=require(_0xb32e('0xd'));var Papa=require('papaparse');var Redis=require(_0xb32e('0xe'));var authService=require(_0xb32e('0xf'));var qs=require(_0xb32e('0x10'));var as=require(_0xb32e('0x11'));var hardwareService=require(_0xb32e('0x12'));var logger=require(_0xb32e('0x13'))(_0xb32e('0x14'));var utils=require(_0xb32e('0x15'));var config=require('../../config/environment');var db=require(_0xb32e('0x16'))['db'];function respondWithStatusCode(_0x244b0a,_0x52123b){_0x52123b=_0x52123b||0xcc;return function(_0x2b9374){if(_0x2b9374){return _0x244b0a[_0xb32e('0x17')](_0x52123b);}return _0x244b0a[_0xb32e('0x18')](_0x52123b)['end']();};}function respondWithResult(_0x410e78,_0x4d7b19){_0x4d7b19=_0x4d7b19||0xc8;return function(_0xe6ee06){if(_0xe6ee06){return _0x410e78['status'](_0x4d7b19)[_0xb32e('0x19')](_0xe6ee06);}};}function respondWithFilteredResult(_0x239524,_0x3ea20c){return function(_0x16df29){if(_0x16df29){var _0x3f1168=_0x16df29['count'],_0x378aee=_0x3ea20c[_0xb32e('0x1a')],_0x2a8f4c=_0x3ea20c[_0xb32e('0x1a')]+_0x3ea20c[_0xb32e('0x1b')],_0x1fba7e;if(_0x2a8f4c>=_0x3f1168){_0x2a8f4c=_0x3f1168;_0x1fba7e=0xc8;}else{_0x1fba7e=0xce;}_0x239524[_0xb32e('0x18')](_0x1fba7e);return _0x239524[_0xb32e('0x1c')]('Content-Range',_0x378aee+'-'+_0x2a8f4c+'/'+_0x3f1168)[_0xb32e('0x19')](_0x16df29);}return null;};}function patchUpdates(_0x2209ff){return function(_0x4022de){try{jsonpatch['apply'](_0x4022de,_0x2209ff,!![]);}catch(_0x49321f){return BPromise[_0xb32e('0x1d')](_0x49321f);}return _0x4022de[_0xb32e('0x1e')]();};}function saveUpdates(_0x149865,_0x594e58){return function(_0x2afe1f){if(_0x2afe1f){return _0x2afe1f[_0xb32e('0x1f')](_0x149865)[_0xb32e('0x20')](function(_0x48db2d){return _0x48db2d;});}return null;};}function removeEntity(_0x3df742,_0x500202){return function(_0x25a7b0){if(_0x25a7b0){return _0x25a7b0[_0xb32e('0x21')]()[_0xb32e('0x20')](function(){_0x3df742[_0xb32e('0x18')](0xcc)[_0xb32e('0x22')]();});}};}function handleEntityNotFound(_0x5bd583,_0x5cc8d1){return function(_0x4cdd7e){if(!_0x4cdd7e){_0x5bd583[_0xb32e('0x17')](0x194);}return _0x4cdd7e;};}function handleError(_0x2c6640,_0x3dd0a0){_0x3dd0a0=_0x3dd0a0||0x1f4;return function(_0x20f18d){logger[_0xb32e('0x23')](_0x20f18d[_0xb32e('0x24')]);if(_0x20f18d[_0xb32e('0x25')]){delete _0x20f18d[_0xb32e('0x25')];}_0x2c6640[_0xb32e('0x18')](_0x3dd0a0)['send'](_0x20f18d);};}exports[_0xb32e('0x26')]=function(_0x3de18f,_0x6a8c04){var _0x3bbcc6={},_0x14372d={},_0x3ce593={'count':0x0,'rows':[]};var _0x49dee7=_[_0xb32e('0x27')](db[_0xb32e('0x28')][_0xb32e('0x29')],function(_0x8eeac6){return{'name':_0x8eeac6[_0xb32e('0x2a')],'type':_0x8eeac6[_0xb32e('0x2b')]['key']};});_0x14372d['model']=_[_0xb32e('0x27')](_0x49dee7,_0xb32e('0x25'));_0x14372d[_0xb32e('0x2c')]=_['keys'](_0x3de18f[_0xb32e('0x2c')]);_0x14372d['filters']=_['intersection'](_0x14372d[_0xb32e('0x2d')],_0x14372d['query']);_0x3bbcc6[_0xb32e('0x2e')]=_[_0xb32e('0x2f')](_0x14372d[_0xb32e('0x2d')],qs[_0xb32e('0x30')](_0x3de18f[_0xb32e('0x2c')][_0xb32e('0x30')]));_0x3bbcc6[_0xb32e('0x2e')]=_0x3bbcc6[_0xb32e('0x2e')][_0xb32e('0x31')]?_0x3bbcc6[_0xb32e('0x2e')]:_0x14372d[_0xb32e('0x2d')];if(!_0x3de18f[_0xb32e('0x2c')][_0xb32e('0x32')]('nolimit')){_0x3bbcc6[_0xb32e('0x1b')]=qs[_0xb32e('0x1b')](_0x3de18f[_0xb32e('0x2c')][_0xb32e('0x1b')]);_0x3bbcc6[_0xb32e('0x1a')]=qs['offset'](_0x3de18f['query'][_0xb32e('0x1a')]);}_0x3bbcc6['order']=qs[_0xb32e('0x33')](_0x3de18f['query'][_0xb32e('0x33')]);_0x3bbcc6[_0xb32e('0x34')]=qs['filters'](_[_0xb32e('0x35')](_0x3de18f['query'],_0x14372d[_0xb32e('0x36')]),_0x49dee7);if(_0x3de18f[_0xb32e('0x2c')][_0xb32e('0x37')]){_0x3bbcc6[_0xb32e('0x34')]=_['merge'](_0x3bbcc6[_0xb32e('0x34')],{'$or':_['map'](_0x49dee7,function(_0x5d9990){if(_0x5d9990[_0xb32e('0x2b')]!==_0xb32e('0x38')){var _0x2c4c24={};_0x2c4c24[_0x5d9990['name']]={'$like':'%'+_0x3de18f['query'][_0xb32e('0x37')]+'%'};return _0x2c4c24;}})});}_0x3bbcc6=_[_0xb32e('0x39')]({},_0x3bbcc6,_0x3de18f['options']);var _0x53051e={'where':_0x3bbcc6[_0xb32e('0x34')]};return db['AnalyticTreeReport'][_0xb32e('0x3a')](_0x53051e)[_0xb32e('0x20')](function(_0x272aa3){_0x3ce593['count']=_0x272aa3;if(_0x3de18f[_0xb32e('0x2c')][_0xb32e('0x3b')]){_0x3bbcc6[_0xb32e('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb32e('0x3d')](_0x3bbcc6);})[_0xb32e('0x20')](function(_0x1921ad){_0x3ce593[_0xb32e('0x3e')]=_0x1921ad;return _0x3ce593;})['then'](respondWithFilteredResult(_0x6a8c04,_0x3bbcc6))[_0xb32e('0x3f')](handleError(_0x6a8c04,null));};exports[_0xb32e('0x40')]=function(_0x33fa3d,_0x54cefb){var _0x4f18cf={'raw':!![],'where':{'id':_0x33fa3d['params']['id']}},_0x32bb24={};_0x32bb24['model']=_[_0xb32e('0x41')](db[_0xb32e('0x28')]['rawAttributes']);_0x32bb24['query']=_[_0xb32e('0x41')](_0x33fa3d[_0xb32e('0x2c')]);_0x32bb24[_0xb32e('0x36')]=_[_0xb32e('0x2f')](_0x32bb24['model'],_0x32bb24[_0xb32e('0x2c')]);_0x4f18cf[_0xb32e('0x2e')]=_['intersection'](_0x32bb24[_0xb32e('0x2d')],qs['fields'](_0x33fa3d['query'][_0xb32e('0x30')]));_0x4f18cf[_0xb32e('0x2e')]=_0x4f18cf[_0xb32e('0x2e')][_0xb32e('0x31')]?_0x4f18cf[_0xb32e('0x2e')]:_0x32bb24[_0xb32e('0x2d')];if(_0x33fa3d['query'][_0xb32e('0x3b')]){_0x4f18cf[_0xb32e('0x3c')]=[{'all':!![]}];}_0x4f18cf=_[_0xb32e('0x39')]({},_0x4f18cf,_0x33fa3d['options']);return db[_0xb32e('0x28')][_0xb32e('0x42')](_0x4f18cf)[_0xb32e('0x20')](handleEntityNotFound(_0x54cefb,null))[_0xb32e('0x20')](respondWithResult(_0x54cefb,null))[_0xb32e('0x3f')](handleError(_0x54cefb,null));};exports['create']=function(_0x1b2b66,_0x26f480){return db[_0xb32e('0x28')][_0xb32e('0x43')](_0x1b2b66['body'],{})[_0xb32e('0x20')](respondWithResult(_0x26f480,0xc9))[_0xb32e('0x3f')](handleError(_0x26f480,null));};exports[_0xb32e('0x1f')]=function(_0x528ab6,_0x1a8a9a){if(_0x528ab6['body']['id']){delete _0x528ab6[_0xb32e('0x44')]['id'];}return db[_0xb32e('0x28')][_0xb32e('0x42')]({'where':{'id':_0x528ab6[_0xb32e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a8a9a,null))['then'](saveUpdates(_0x528ab6[_0xb32e('0x44')],null))[_0xb32e('0x20')](respondWithResult(_0x1a8a9a,null))[_0xb32e('0x3f')](handleError(_0x1a8a9a,null));};exports[_0xb32e('0x21')]=function(_0x3f1e58,_0x1b70a2){return db[_0xb32e('0x28')][_0xb32e('0x42')]({'where':{'id':_0x3f1e58[_0xb32e('0x45')]['id']}})[_0xb32e('0x20')](handleEntityNotFound(_0x1b70a2,null))[_0xb32e('0x20')](removeEntity(_0x1b70a2,null))[_0xb32e('0x3f')](handleError(_0x1b70a2,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8f74c4e..d6f69d0 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 _0xdb7e=['bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xdb7e,0x11a));var _0xedb7=function(_0x241d2f,_0x327dae){_0x241d2f=_0x241d2f-0x0;var _0x20ebff=_0xdb7e[_0x241d2f];return _0x20ebff;};'use strict';var _=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var logger=require(_0xedb7('0x2'))('api');var moment=require(_0xedb7('0x3'));var BPromise=require(_0xedb7('0x4'));var rp=require(_0xedb7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedb7('0x6'));var config=require(_0xedb7('0x7'));var attributes=require(_0xedb7('0x8'));module[_0xedb7('0x9')]=function(_0xea2925,_0x153a3a){return _0xea2925[_0xedb7('0xa')](_0xedb7('0xb'),attributes,{'tableName':_0xedb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7409=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xb7951e,_0x92f5c7){var _0x2b42c4=function(_0x4dff42){while(--_0x4dff42){_0xb7951e['push'](_0xb7951e['shift']());}};_0x2b42c4(++_0x92f5c7);}(_0x7409,0x6e));var _0x9740=function(_0x14612f,_0x1c3389){_0x14612f=_0x14612f-0x0;var _0x3c41ad=_0x7409[_0x14612f];return _0x3c41ad;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var logger=require('../../config/logger')(_0x9740('0x2'));var moment=require(_0x9740('0x3'));var BPromise=require(_0x9740('0x4'));var rp=require(_0x9740('0x5'));var fs=require('fs');var path=require(_0x9740('0x6'));var rimraf=require(_0x9740('0x7'));var config=require(_0x9740('0x8'));var attributes=require(_0x9740('0x9'));module[_0x9740('0xa')]=function(_0x547490,_0x19865c){return _0x547490[_0x9740('0xb')](_0x9740('0xc'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index ff548ea..dd24f32 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 _0x2971=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x255315,_0x1551db){var _0x5874c4=function(_0x13a8cc){while(--_0x13a8cc){_0x255315['push'](_0x255315['shift']());}};_0x5874c4(++_0x1551db);}(_0x2971,0xee));var _0x1297=function(_0x2de5f5,_0x2fc330){_0x2de5f5=_0x2de5f5-0x0;var _0x3b38ee=_0x2971[_0x2de5f5];return _0x3b38ee;};'use strict';var _=require(_0x1297('0x0'));var util=require(_0x1297('0x1'));var moment=require(_0x1297('0x2'));var BPromise=require(_0x1297('0x3'));var rs=require(_0x1297('0x4'));var fs=require('fs');var Redis=require(_0x1297('0x5'));var db=require(_0x1297('0x6'))['db'];var utils=require(_0x1297('0x7'));var logger=require(_0x1297('0x8'))(_0x1297('0x9'));var config=require(_0x1297('0xa'));var jayson=require(_0x1297('0xb'));var client=jayson[_0x1297('0xc')][_0x1297('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3841fc,_0x1a7751,_0x1f25b4){return new BPromise(function(_0xe2ccfe,_0x1de2ac){return client[_0x1297('0xe')](_0x3841fc,_0x1f25b4)[_0x1297('0xf')](function(_0x54f79d){logger['info'](_0x1297('0x10'),_0x1a7751,_0x1297('0x11'));logger[_0x1297('0x12')](_0x1297('0x13'),_0x1a7751,_0x1297('0x11'),JSON[_0x1297('0x14')](_0x54f79d));if(_0x54f79d[_0x1297('0x15')]){if(_0x54f79d[_0x1297('0x15')][_0x1297('0x16')]===0x1f4){logger[_0x1297('0x15')](_0x1297('0x10'),_0x1a7751,_0x54f79d[_0x1297('0x15')]['message']);return _0x1de2ac(_0x54f79d['error'][_0x1297('0x17')]);}logger[_0x1297('0x15')](_0x1297('0x10'),_0x1a7751,_0x54f79d[_0x1297('0x15')][_0x1297('0x17')]);return _0xe2ccfe(_0x54f79d[_0x1297('0x15')][_0x1297('0x17')]);}else{logger[_0x1297('0x18')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1a7751,_0x1297('0x11'));_0xe2ccfe(_0x54f79d[_0x1297('0x19')][_0x1297('0x17')]);}})[_0x1297('0x1a')](function(_0x7b8f7f){logger[_0x1297('0x15')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1a7751,_0x7b8f7f);_0x1de2ac(_0x7b8f7f);});});} \ No newline at end of file +var _0x1909=['http','request','then','info','request\x20sent','debug','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4dbc0d,_0x37508c){var _0x36e682=function(_0x2bd0fc){while(--_0x2bd0fc){_0x4dbc0d['push'](_0x4dbc0d['shift']());}};_0x36e682(++_0x37508c);}(_0x1909,0x1b0));var _0x9190=function(_0x4e2bcb,_0x41984e){_0x4e2bcb=_0x4e2bcb-0x0;var _0x146a86=_0x1909[_0x4e2bcb];return _0x146a86;};'use strict';var _=require(_0x9190('0x0'));var util=require(_0x9190('0x1'));var moment=require(_0x9190('0x2'));var BPromise=require(_0x9190('0x3'));var rs=require(_0x9190('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9190('0x5'));var logger=require(_0x9190('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9190('0x7'));var client=jayson['client'][_0x9190('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27bbc1,_0x4b4aac,_0xd6e9cb){return new BPromise(function(_0x54a5df,_0x36032a){return client[_0x9190('0x9')](_0x27bbc1,_0xd6e9cb)[_0x9190('0xa')](function(_0x6eaaf5){logger[_0x9190('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4b4aac,_0x9190('0xc'));logger[_0x9190('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x4b4aac,_0x9190('0xc'),JSON[_0x9190('0xe')](_0x6eaaf5));if(_0x6eaaf5[_0x9190('0xf')]){if(_0x6eaaf5['error'][_0x9190('0x10')]===0x1f4){logger[_0x9190('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4b4aac,_0x6eaaf5[_0x9190('0xf')][_0x9190('0x11')]);return _0x36032a(_0x6eaaf5[_0x9190('0xf')][_0x9190('0x11')]);}logger['error'](_0x9190('0x12'),_0x4b4aac,_0x6eaaf5['error'][_0x9190('0x11')]);return _0x54a5df(_0x6eaaf5[_0x9190('0xf')]['message']);}else{logger[_0x9190('0xb')](_0x9190('0x12'),_0x4b4aac,_0x9190('0xc'));_0x54a5df(_0x6eaaf5['result'][_0x9190('0x11')]);}})[_0x9190('0x13')](function(_0x4b0226){logger[_0x9190('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4b4aac,_0x4b0226);_0x36032a(_0x4b0226);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 04dab56..14f9116 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 _0x1449=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x484c44,_0x240fdb){var _0x3f4d3a=function(_0x2b9cf3){while(--_0x2b9cf3){_0x484c44['push'](_0x484c44['shift']());}};_0x3f4d3a(++_0x240fdb);}(_0x1449,0xf3));var _0x9144=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x1449[_0x3c4f1f];return _0x19cb69;};'use strict';var multer=require(_0x9144('0x0'));var util=require(_0x9144('0x1'));var path=require(_0x9144('0x2'));var timeout=require(_0x9144('0x3'));var express=require(_0x9144('0x4'));var router=express[_0x9144('0x5')]();var auth=require(_0x9144('0x6'));var interaction=require(_0x9144('0x7'));var config=require(_0x9144('0x8'));var controller=require(_0x9144('0x9'));router[_0x9144('0xa')]('/',auth[_0x9144('0xb')](),controller[_0x9144('0xc')]);router[_0x9144('0xa')](_0x9144('0xd'),auth[_0x9144('0xb')](),controller[_0x9144('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9144('0xf')]);router['delete'](_0x9144('0xd'),auth[_0x9144('0xb')](),controller[_0x9144('0x10')]);module[_0x9144('0x11')]=router; \ No newline at end of file +var _0x2f7e=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x439987,_0x1776e7){var _0x2f15db=function(_0x4e7d97){while(--_0x4e7d97){_0x439987['push'](_0x439987['shift']());}};_0x2f15db(++_0x1776e7);}(_0x2f7e,0x170));var _0xe2f7=function(_0x5d9561,_0x239461){_0x5d9561=_0x5d9561-0x0;var _0x32054a=_0x2f7e[_0x5d9561];return _0x32054a;};'use strict';var multer=require(_0xe2f7('0x0'));var util=require(_0xe2f7('0x1'));var path=require(_0xe2f7('0x2'));var timeout=require(_0xe2f7('0x3'));var express=require(_0xe2f7('0x4'));var router=express[_0xe2f7('0x5')]();var auth=require(_0xe2f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe2f7('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xe2f7('0x8')]('/',auth[_0xe2f7('0x9')](),controller[_0xe2f7('0xa')]);router[_0xe2f7('0x8')](_0xe2f7('0xb'),auth[_0xe2f7('0x9')](),controller[_0xe2f7('0xc')]);router[_0xe2f7('0xd')]('/',auth[_0xe2f7('0x9')](),controller[_0xe2f7('0xe')]);router['put'](_0xe2f7('0xb'),auth[_0xe2f7('0x9')](),controller[_0xe2f7('0xf')]);router[_0xe2f7('0x10')](_0xe2f7('0xb'),auth[_0xe2f7('0x9')](),controller[_0xe2f7('0x11')]);module[_0xe2f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a9453fa..ce1d05e 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 _0x6456=['sequelize','STRING'];(function(_0x257280,_0x2921df){var _0xc4550e=function(_0x35bcfd){while(--_0x35bcfd){_0x257280['push'](_0x257280['shift']());}};_0xc4550e(++_0x2921df);}(_0x6456,0x68));var _0x6645=function(_0x574b9a,_0x103545){_0x574b9a=_0x574b9a-0x0;var _0x8cc50e=_0x6456[_0x574b9a];return _0x8cc50e;};'use strict';var Sequelize=require(_0x6645('0x0'));module['exports']={'name':{'type':Sequelize[_0x6645('0x1')]},'basename':{'type':Sequelize[_0x6645('0x1')]},'type':{'type':Sequelize[_0x6645('0x1')]}}; \ No newline at end of file +var _0x7b5c=['STRING','exports'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x7b5c,0x167));var _0xc7b5=function(_0x2a2542,_0x23ea86){_0x2a2542=_0x2a2542-0x0;var _0x389b2f=_0x7b5c[_0x2a2542];return _0x389b2f;};'use strict';var Sequelize=require('sequelize');module[_0xc7b5('0x0')]={'name':{'type':Sequelize[_0xc7b5('0x1')]},'basename':{'type':Sequelize[_0xc7b5('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d876242..f9e2c86 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 _0x9da9=['moment','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','clone','get','omit','createdAt','updatedAt','body','file','originalname','basename','filename','mimetype','create','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9da9,0xa9));var _0x99da=function(_0x2b9d54,_0x4ad9ee){_0x2b9d54=_0x2b9d54-0x0;var _0x3edc0e=_0x9da9[_0x2b9d54];return _0x3edc0e;};'use strict';var pdf=require(_0x99da('0x0'));var emlformat=require(_0x99da('0x1'));var rimraf=require(_0x99da('0x2'));var zipdir=require(_0x99da('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99da('0x4'));var moment=require(_0x99da('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x99da('0x6'));var sox=require(_0x99da('0x7'));var csv=require(_0x99da('0x8'));var ejs=require(_0x99da('0x9'));var fs=require('fs');var _=require(_0x99da('0xa'));var squel=require(_0x99da('0xb'));var crypto=require(_0x99da('0xc'));var jsforce=require(_0x99da('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x99da('0xe'));var Redis=require(_0x99da('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x99da('0x10'));var as=require(_0x99da('0x11'));var hardwareService=require(_0x99da('0x12'));var logger=require(_0x99da('0x13'))(_0x99da('0x14'));var utils=require(_0x99da('0x15'));var config=require(_0x99da('0x16'));var db=require(_0x99da('0x17'))['db'];function respondWithStatusCode(_0x5eec27,_0x26c436){_0x26c436=_0x26c436||0xcc;return function(_0x10f88e){if(_0x10f88e){return _0x5eec27[_0x99da('0x18')](_0x26c436);}return _0x5eec27[_0x99da('0x19')](_0x26c436)[_0x99da('0x1a')]();};}function respondWithResult(_0x5b6ccf,_0x59fb76){_0x59fb76=_0x59fb76||0xc8;return function(_0x3655aa){if(_0x3655aa){return _0x5b6ccf[_0x99da('0x19')](_0x59fb76)[_0x99da('0x1b')](_0x3655aa);}};}function respondWithFilteredResult(_0x385275,_0x59ce62){return function(_0x2b5b84){if(_0x2b5b84){var _0x237d18=_0x2b5b84[_0x99da('0x1c')],_0x261a28=_0x59ce62[_0x99da('0x1d')],_0x1c720c=_0x59ce62[_0x99da('0x1d')]+_0x59ce62[_0x99da('0x1e')],_0x1968c3;if(_0x1c720c>=_0x237d18){_0x1c720c=_0x237d18;_0x1968c3=0xc8;}else{_0x1968c3=0xce;}_0x385275[_0x99da('0x19')](_0x1968c3);return _0x385275['set']('Content-Range',_0x261a28+'-'+_0x1c720c+'/'+_0x237d18)[_0x99da('0x1b')](_0x2b5b84);}return null;};}function patchUpdates(_0x3823cd){return function(_0xea7409){try{jsonpatch[_0x99da('0x1f')](_0xea7409,_0x3823cd,!![]);}catch(_0x4dfdf5){return BPromise['reject'](_0x4dfdf5);}return _0xea7409[_0x99da('0x20')]();};}function saveUpdates(_0x3afc15,_0x35a3d7){return function(_0x57c9c4){if(_0x57c9c4){return _0x57c9c4[_0x99da('0x21')](_0x3afc15)[_0x99da('0x22')](function(_0x3a1b6b){return _0x3a1b6b;});}return null;};}function removeEntity(_0x56d596,_0x5af1d2){return function(_0x729a92){if(_0x729a92){return _0x729a92[_0x99da('0x23')]()['then'](function(){_0x56d596[_0x99da('0x19')](0xcc)[_0x99da('0x1a')]();});}};}function handleEntityNotFound(_0x26e701,_0x180260){return function(_0x9795e){if(!_0x9795e){_0x26e701[_0x99da('0x18')](0x194);}return _0x9795e;};}function handleError(_0x42a433,_0x41c729){_0x41c729=_0x41c729||0x1f4;return function(_0xc8119){logger[_0x99da('0x24')](_0xc8119[_0x99da('0x25')]);if(_0xc8119[_0x99da('0x26')]){delete _0xc8119['name'];}_0x42a433[_0x99da('0x19')](_0x41c729)[_0x99da('0x27')](_0xc8119);};}exports[_0x99da('0x28')]=function(_0x24d5d5,_0xc13808){var _0x5d63c7={},_0x34b0b2={},_0x24927e={'count':0x0,'rows':[]};var _0x21f034=_[_0x99da('0x29')](db[_0x99da('0x2a')][_0x99da('0x2b')],function(_0x4c8d93){return{'name':_0x4c8d93[_0x99da('0x2c')],'type':_0x4c8d93[_0x99da('0x2d')]['key']};});_0x34b0b2[_0x99da('0x2e')]=_[_0x99da('0x29')](_0x21f034,_0x99da('0x26'));_0x34b0b2[_0x99da('0x2f')]=_[_0x99da('0x30')](_0x24d5d5['query']);_0x34b0b2[_0x99da('0x31')]=_[_0x99da('0x32')](_0x34b0b2[_0x99da('0x2e')],_0x34b0b2[_0x99da('0x2f')]);_0x5d63c7[_0x99da('0x33')]=_[_0x99da('0x32')](_0x34b0b2[_0x99da('0x2e')],qs[_0x99da('0x34')](_0x24d5d5[_0x99da('0x2f')][_0x99da('0x34')]));_0x5d63c7[_0x99da('0x33')]=_0x5d63c7[_0x99da('0x33')][_0x99da('0x35')]?_0x5d63c7[_0x99da('0x33')]:_0x34b0b2[_0x99da('0x2e')];if(!_0x24d5d5['query'][_0x99da('0x36')]('nolimit')){_0x5d63c7['limit']=qs['limit'](_0x24d5d5[_0x99da('0x2f')]['limit']);_0x5d63c7[_0x99da('0x1d')]=qs[_0x99da('0x1d')](_0x24d5d5[_0x99da('0x2f')][_0x99da('0x1d')]);}_0x5d63c7[_0x99da('0x37')]=qs[_0x99da('0x38')](_0x24d5d5['query'][_0x99da('0x38')]);_0x5d63c7[_0x99da('0x39')]=qs[_0x99da('0x31')](_[_0x99da('0x3a')](_0x24d5d5[_0x99da('0x2f')],_0x34b0b2[_0x99da('0x31')]),_0x21f034);if(_0x24d5d5[_0x99da('0x2f')][_0x99da('0x3b')]){_0x5d63c7[_0x99da('0x39')]=_[_0x99da('0x3c')](_0x5d63c7['where'],{'$or':_[_0x99da('0x29')](_0x21f034,function(_0x35aedd){if(_0x35aedd[_0x99da('0x2d')]!==_0x99da('0x3d')){var _0x499aa6={};_0x499aa6[_0x35aedd[_0x99da('0x26')]]={'$like':'%'+_0x24d5d5['query'][_0x99da('0x3b')]+'%'};return _0x499aa6;}})});}_0x5d63c7=_[_0x99da('0x3c')]({},_0x5d63c7,_0x24d5d5['options']);var _0x312cf1={'where':_0x5d63c7[_0x99da('0x39')]};return db[_0x99da('0x2a')]['count'](_0x312cf1)[_0x99da('0x22')](function(_0x14d8ef){_0x24927e['count']=_0x14d8ef;if(_0x24d5d5[_0x99da('0x2f')]['includeAll']){_0x5d63c7[_0x99da('0x3e')]=[{'all':!![]}];}return db[_0x99da('0x2a')][_0x99da('0x3f')](_0x5d63c7);})[_0x99da('0x22')](function(_0x27be9d){_0x24927e[_0x99da('0x40')]=_0x27be9d;return _0x24927e;})[_0x99da('0x22')](respondWithFilteredResult(_0xc13808,_0x5d63c7))['catch'](handleError(_0xc13808,null));};exports[_0x99da('0x41')]=function(_0x140585,_0x39bf7b){var _0x4d3fed={'raw':!![],'where':{'id':_0x140585[_0x99da('0x42')]['id']}},_0x337fa6={};_0x337fa6['model']=_[_0x99da('0x30')](db[_0x99da('0x2a')][_0x99da('0x2b')]);_0x337fa6[_0x99da('0x2f')]=_[_0x99da('0x30')](_0x140585[_0x99da('0x2f')]);_0x337fa6[_0x99da('0x31')]=_[_0x99da('0x32')](_0x337fa6[_0x99da('0x2e')],_0x337fa6[_0x99da('0x2f')]);_0x4d3fed[_0x99da('0x33')]=_['intersection'](_0x337fa6[_0x99da('0x2e')],qs[_0x99da('0x34')](_0x140585[_0x99da('0x2f')]['fields']));_0x4d3fed[_0x99da('0x33')]=_0x4d3fed[_0x99da('0x33')][_0x99da('0x35')]?_0x4d3fed['attributes']:_0x337fa6[_0x99da('0x2e')];if(_0x140585[_0x99da('0x2f')][_0x99da('0x43')]){_0x4d3fed['include']=[{'all':!![]}];}_0x4d3fed=_[_0x99da('0x3c')]({},_0x4d3fed,_0x140585[_0x99da('0x44')]);return db[_0x99da('0x2a')][_0x99da('0x45')](_0x4d3fed)['then'](handleEntityNotFound(_0x39bf7b,null))[_0x99da('0x22')](respondWithResult(_0x39bf7b,null))[_0x99da('0x46')](handleError(_0x39bf7b,null));};exports[_0x99da('0x47')]=function(_0x199f42,_0x37656f){var _0x44ac02={'where':{'id':_0x199f42[_0x99da('0x42')]['id']}},_0x316224={};_0x316224[_0x99da('0x2e')]=_['keys'](db[_0x99da('0x2a')][_0x99da('0x2b')]);_0x44ac02['attributes']=_[_0x99da('0x32')](_0x316224[_0x99da('0x2e')],qs['fields'](_0x199f42[_0x99da('0x2f')][_0x99da('0x34')]));_0x44ac02[_0x99da('0x33')]=_0x44ac02['attributes']['length']?_0x44ac02['attributes']:_0x316224[_0x99da('0x2e')];if(_0x199f42[_0x99da('0x2f')][_0x99da('0x43')]){_0x44ac02[_0x99da('0x3e')]=[{'all':!![]}];}_0x44ac02=_['merge']({},_0x44ac02,_0x199f42['options']);return db[_0x99da('0x2a')]['find'](_0x44ac02)[_0x99da('0x22')](handleEntityNotFound(_0x37656f,null))['then'](function(_0x320a86){if(_0x320a86){var _0x337509=_0x320a86[_0x99da('0x48')]({'plain':!![]});_0x337509=qs[_0x99da('0x49')](_0x337509,['id',_0x99da('0x4a'),_0x99da('0x4b')]);_0x199f42[_0x99da('0x4c')]=_[_0x99da('0x49')](_0x199f42[_0x99da('0x4c')],['id','createdAt',_0x99da('0x4b')]);return db[_0x99da('0x2a')]['create'](_[_0x99da('0x3c')](_0x337509,_0x199f42[_0x99da('0x4c')]),{'include':_0x199f42[_0x99da('0x2f')][_0x99da('0x43')]?[{'all':!![]}]:undefined});}})[_0x99da('0x22')](respondWithResult(_0x37656f,0xc9))['catch'](handleError(_0x37656f,null));};exports[_0x99da('0x21')]=function(_0x4b316d,_0x12780d){if(_0x4b316d[_0x99da('0x4c')]['id']){delete _0x4b316d[_0x99da('0x4c')]['id'];}return db[_0x99da('0x2a')]['find']({'where':{'id':_0x4b316d[_0x99da('0x42')]['id']}})[_0x99da('0x22')](handleEntityNotFound(_0x12780d,null))[_0x99da('0x22')](saveUpdates(_0x4b316d['body'],null))[_0x99da('0x22')](respondWithResult(_0x12780d,null))[_0x99da('0x46')](handleError(_0x12780d,null));};exports[_0x99da('0x23')]=function(_0x422114,_0x4dc3de){return db['Attachment'][_0x99da('0x45')]({'where':{'id':_0x422114['params']['id']}})[_0x99da('0x22')](handleEntityNotFound(_0x4dc3de,null))['then'](removeEntity(_0x4dc3de,null))['catch'](handleError(_0x4dc3de,null));};exports['create']=function(_0x36e722,_0xe672b4,_0xbc85f5){_0x36e722[_0x99da('0x4c')]['name']=_0x36e722[_0x99da('0x4d')][_0x99da('0x4e')];_0x36e722[_0x99da('0x4c')][_0x99da('0x4f')]=_0x36e722[_0x99da('0x4d')][_0x99da('0x50')];_0x36e722['body'][_0x99da('0x2d')]=_0x36e722[_0x99da('0x4d')][_0x99da('0x51')];return db[_0x99da('0x2a')][_0x99da('0x52')](_0x36e722['body'])[_0x99da('0x22')](respondWithResult(_0xe672b4,0xc9))[_0x99da('0x46')](handleError(_0xe672b4,null));};exports[_0x99da('0x53')]=function(_0x90d04e,_0x1de444,_0x227210){return db[_0x99da('0x2a')]['findOne']({'where':{'id':_0x90d04e[_0x99da('0x42')]['id']},'raw':!![]})[_0x99da('0x22')](handleEntityNotFound(_0x1de444,null))[_0x99da('0x22')](function(_0x10836c){if(_0x10836c){return _0x1de444[_0x99da('0x53')](path[_0x99da('0x54')](config[_0x99da('0x55')],_0x99da('0x56'),_0x10836c[_0x99da('0x4f')]));}})['catch'](handleError(_0x1de444,null));}; \ No newline at end of file +var _0x62e6=['squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','catch','show','params','find','clone','get','createdAt','updatedAt','body','omit','create','basename','file','filename','download','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x277bd4,_0x18b5ff){var _0x5aaac1=function(_0x1db79a){while(--_0x1db79a){_0x277bd4['push'](_0x277bd4['shift']());}};_0x5aaac1(++_0x18b5ff);}(_0x62e6,0xfe));var _0x662e=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0x62e6[_0x22c684];return _0x39fcbb;};'use strict';var pdf=require(_0x662e('0x0'));var emlformat=require(_0x662e('0x1'));var rimraf=require(_0x662e('0x2'));var zipdir=require(_0x662e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x662e('0x4'));var BPromise=require(_0x662e('0x5'));var Mustache=require(_0x662e('0x6'));var util=require(_0x662e('0x7'));var path=require(_0x662e('0x8'));var sox=require(_0x662e('0x9'));var csv=require(_0x662e('0xa'));var ejs=require(_0x662e('0xb'));var fs=require('fs');var _=require(_0x662e('0xc'));var squel=require(_0x662e('0xd'));var crypto=require('crypto');var jsforce=require(_0x662e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x662e('0xa'));var querystring=require(_0x662e('0xf'));var Papa=require('papaparse');var Redis=require(_0x662e('0x10'));var authService=require(_0x662e('0x11'));var qs=require(_0x662e('0x12'));var as=require(_0x662e('0x13'));var hardwareService=require(_0x662e('0x14'));var logger=require(_0x662e('0x15'))(_0x662e('0x16'));var utils=require(_0x662e('0x17'));var config=require(_0x662e('0x18'));var db=require(_0x662e('0x19'))['db'];function respondWithStatusCode(_0x4f75dd,_0x402dc6){_0x402dc6=_0x402dc6||0xcc;return function(_0x271c8d){if(_0x271c8d){return _0x4f75dd['sendStatus'](_0x402dc6);}return _0x4f75dd[_0x662e('0x1a')](_0x402dc6)[_0x662e('0x1b')]();};}function respondWithResult(_0x4ac868,_0x142ec2){_0x142ec2=_0x142ec2||0xc8;return function(_0xa75b0){if(_0xa75b0){return _0x4ac868[_0x662e('0x1a')](_0x142ec2)[_0x662e('0x1c')](_0xa75b0);}};}function respondWithFilteredResult(_0x3b9e18,_0x21ff10){return function(_0x4c6789){if(_0x4c6789){var _0x4b2472=_0x4c6789['count'],_0x4f4de5=_0x21ff10[_0x662e('0x1d')],_0x54181d=_0x21ff10[_0x662e('0x1d')]+_0x21ff10[_0x662e('0x1e')],_0x39cb60;if(_0x54181d>=_0x4b2472){_0x54181d=_0x4b2472;_0x39cb60=0xc8;}else{_0x39cb60=0xce;}_0x3b9e18[_0x662e('0x1a')](_0x39cb60);return _0x3b9e18[_0x662e('0x1f')]('Content-Range',_0x4f4de5+'-'+_0x54181d+'/'+_0x4b2472)[_0x662e('0x1c')](_0x4c6789);}return null;};}function patchUpdates(_0x597403){return function(_0x1e7405){try{jsonpatch[_0x662e('0x20')](_0x1e7405,_0x597403,!![]);}catch(_0x190be9){return BPromise[_0x662e('0x21')](_0x190be9);}return _0x1e7405[_0x662e('0x22')]();};}function saveUpdates(_0x814f3a,_0x55111a){return function(_0x25da55){if(_0x25da55){return _0x25da55[_0x662e('0x23')](_0x814f3a)[_0x662e('0x24')](function(_0x281c77){return _0x281c77;});}return null;};}function removeEntity(_0x49550b,_0x139807){return function(_0x4c4cc8){if(_0x4c4cc8){return _0x4c4cc8[_0x662e('0x25')]()['then'](function(){_0x49550b[_0x662e('0x1a')](0xcc)[_0x662e('0x1b')]();});}};}function handleEntityNotFound(_0x40f3ba,_0xb700dc){return function(_0xc568ce){if(!_0xc568ce){_0x40f3ba[_0x662e('0x26')](0x194);}return _0xc568ce;};}function handleError(_0x34dee0,_0x5f46e5){_0x5f46e5=_0x5f46e5||0x1f4;return function(_0x947b2){logger[_0x662e('0x27')](_0x947b2[_0x662e('0x28')]);if(_0x947b2[_0x662e('0x29')]){delete _0x947b2[_0x662e('0x29')];}_0x34dee0[_0x662e('0x1a')](_0x5f46e5)[_0x662e('0x2a')](_0x947b2);};}exports[_0x662e('0x2b')]=function(_0x5cad96,_0x68e48){var _0x75160c={},_0x187b0e={},_0xdf3ef4={'count':0x0,'rows':[]};var _0x5a4fef=_[_0x662e('0x2c')](db[_0x662e('0x2d')][_0x662e('0x2e')],function(_0x355263){return{'name':_0x355263[_0x662e('0x2f')],'type':_0x355263[_0x662e('0x30')][_0x662e('0x31')]};});_0x187b0e[_0x662e('0x32')]=_['map'](_0x5a4fef,_0x662e('0x29'));_0x187b0e[_0x662e('0x33')]=_[_0x662e('0x34')](_0x5cad96[_0x662e('0x33')]);_0x187b0e[_0x662e('0x35')]=_[_0x662e('0x36')](_0x187b0e[_0x662e('0x32')],_0x187b0e['query']);_0x75160c[_0x662e('0x37')]=_['intersection'](_0x187b0e['model'],qs[_0x662e('0x38')](_0x5cad96[_0x662e('0x33')][_0x662e('0x38')]));_0x75160c[_0x662e('0x37')]=_0x75160c[_0x662e('0x37')][_0x662e('0x39')]?_0x75160c[_0x662e('0x37')]:_0x187b0e['model'];if(!_0x5cad96[_0x662e('0x33')][_0x662e('0x3a')](_0x662e('0x3b'))){_0x75160c[_0x662e('0x1e')]=qs[_0x662e('0x1e')](_0x5cad96[_0x662e('0x33')][_0x662e('0x1e')]);_0x75160c['offset']=qs['offset'](_0x5cad96['query']['offset']);}_0x75160c[_0x662e('0x3c')]=qs['sort'](_0x5cad96['query'][_0x662e('0x3d')]);_0x75160c['where']=qs[_0x662e('0x35')](_[_0x662e('0x3e')](_0x5cad96[_0x662e('0x33')],_0x187b0e['filters']),_0x5a4fef);if(_0x5cad96[_0x662e('0x33')]['filter']){_0x75160c[_0x662e('0x3f')]=_['merge'](_0x75160c[_0x662e('0x3f')],{'$or':_[_0x662e('0x2c')](_0x5a4fef,function(_0x4ad63e){if(_0x4ad63e[_0x662e('0x30')]!==_0x662e('0x40')){var _0x13fb37={};_0x13fb37[_0x4ad63e[_0x662e('0x29')]]={'$like':'%'+_0x5cad96[_0x662e('0x33')][_0x662e('0x41')]+'%'};return _0x13fb37;}})});}_0x75160c=_[_0x662e('0x42')]({},_0x75160c,_0x5cad96[_0x662e('0x43')]);var _0x5af038={'where':_0x75160c[_0x662e('0x3f')]};return db[_0x662e('0x2d')][_0x662e('0x44')](_0x5af038)[_0x662e('0x24')](function(_0x289fc7){_0xdf3ef4['count']=_0x289fc7;if(_0x5cad96[_0x662e('0x33')][_0x662e('0x45')]){_0x75160c[_0x662e('0x46')]=[{'all':!![]}];}return db[_0x662e('0x2d')][_0x662e('0x47')](_0x75160c);})[_0x662e('0x24')](function(_0x229b66){_0xdf3ef4['rows']=_0x229b66;return _0xdf3ef4;})[_0x662e('0x24')](respondWithFilteredResult(_0x68e48,_0x75160c))[_0x662e('0x48')](handleError(_0x68e48,null));};exports[_0x662e('0x49')]=function(_0x195ea5,_0x413de4){var _0x2f3a51={'raw':!![],'where':{'id':_0x195ea5[_0x662e('0x4a')]['id']}},_0x3adf44={};_0x3adf44[_0x662e('0x32')]=_[_0x662e('0x34')](db['Attachment'][_0x662e('0x2e')]);_0x3adf44[_0x662e('0x33')]=_[_0x662e('0x34')](_0x195ea5[_0x662e('0x33')]);_0x3adf44[_0x662e('0x35')]=_[_0x662e('0x36')](_0x3adf44[_0x662e('0x32')],_0x3adf44[_0x662e('0x33')]);_0x2f3a51[_0x662e('0x37')]=_[_0x662e('0x36')](_0x3adf44[_0x662e('0x32')],qs[_0x662e('0x38')](_0x195ea5[_0x662e('0x33')]['fields']));_0x2f3a51['attributes']=_0x2f3a51[_0x662e('0x37')][_0x662e('0x39')]?_0x2f3a51[_0x662e('0x37')]:_0x3adf44['model'];if(_0x195ea5[_0x662e('0x33')][_0x662e('0x45')]){_0x2f3a51[_0x662e('0x46')]=[{'all':!![]}];}_0x2f3a51=_[_0x662e('0x42')]({},_0x2f3a51,_0x195ea5[_0x662e('0x43')]);return db[_0x662e('0x2d')][_0x662e('0x4b')](_0x2f3a51)[_0x662e('0x24')](handleEntityNotFound(_0x413de4,null))[_0x662e('0x24')](respondWithResult(_0x413de4,null))['catch'](handleError(_0x413de4,null));};exports[_0x662e('0x4c')]=function(_0x45aba1,_0x4f00af){var _0x1be2ac={'where':{'id':_0x45aba1[_0x662e('0x4a')]['id']}},_0x4a11ad={};_0x4a11ad['model']=_[_0x662e('0x34')](db['Attachment']['rawAttributes']);_0x1be2ac['attributes']=_['intersection'](_0x4a11ad[_0x662e('0x32')],qs[_0x662e('0x38')](_0x45aba1[_0x662e('0x33')][_0x662e('0x38')]));_0x1be2ac['attributes']=_0x1be2ac[_0x662e('0x37')]['length']?_0x1be2ac['attributes']:_0x4a11ad[_0x662e('0x32')];if(_0x45aba1[_0x662e('0x33')][_0x662e('0x45')]){_0x1be2ac[_0x662e('0x46')]=[{'all':!![]}];}_0x1be2ac=_['merge']({},_0x1be2ac,_0x45aba1[_0x662e('0x43')]);return db['Attachment']['find'](_0x1be2ac)[_0x662e('0x24')](handleEntityNotFound(_0x4f00af,null))[_0x662e('0x24')](function(_0x4d8f87){if(_0x4d8f87){var _0x8a41cc=_0x4d8f87[_0x662e('0x4d')]({'plain':!![]});_0x8a41cc=qs['omit'](_0x8a41cc,['id',_0x662e('0x4e'),_0x662e('0x4f')]);_0x45aba1[_0x662e('0x50')]=_[_0x662e('0x51')](_0x45aba1['body'],['id',_0x662e('0x4e'),'updatedAt']);return db[_0x662e('0x2d')][_0x662e('0x52')](_[_0x662e('0x42')](_0x8a41cc,_0x45aba1[_0x662e('0x50')]),{'include':_0x45aba1[_0x662e('0x33')][_0x662e('0x45')]?[{'all':!![]}]:undefined});}})[_0x662e('0x24')](respondWithResult(_0x4f00af,0xc9))[_0x662e('0x48')](handleError(_0x4f00af,null));};exports[_0x662e('0x23')]=function(_0x40a608,_0x2066aa){if(_0x40a608[_0x662e('0x50')]['id']){delete _0x40a608[_0x662e('0x50')]['id'];}return db[_0x662e('0x2d')]['find']({'where':{'id':_0x40a608[_0x662e('0x4a')]['id']}})[_0x662e('0x24')](handleEntityNotFound(_0x2066aa,null))['then'](saveUpdates(_0x40a608[_0x662e('0x50')],null))[_0x662e('0x24')](respondWithResult(_0x2066aa,null))[_0x662e('0x48')](handleError(_0x2066aa,null));};exports['destroy']=function(_0x891c98,_0x22099f){return db[_0x662e('0x2d')][_0x662e('0x4b')]({'where':{'id':_0x891c98['params']['id']}})[_0x662e('0x24')](handleEntityNotFound(_0x22099f,null))['then'](removeEntity(_0x22099f,null))[_0x662e('0x48')](handleError(_0x22099f,null));};exports[_0x662e('0x52')]=function(_0x346d69,_0x379b20,_0x3d62a7){_0x346d69['body'][_0x662e('0x29')]=_0x346d69['file']['originalname'];_0x346d69[_0x662e('0x50')][_0x662e('0x53')]=_0x346d69[_0x662e('0x54')][_0x662e('0x55')];_0x346d69['body'][_0x662e('0x30')]=_0x346d69[_0x662e('0x54')]['mimetype'];return db[_0x662e('0x2d')][_0x662e('0x52')](_0x346d69['body'])[_0x662e('0x24')](respondWithResult(_0x379b20,0xc9))[_0x662e('0x48')](handleError(_0x379b20,null));};exports[_0x662e('0x56')]=function(_0x175f74,_0x1d78d0,_0x4019cc){return db['Attachment']['findOne']({'where':{'id':_0x175f74[_0x662e('0x4a')]['id']},'raw':!![]})[_0x662e('0x24')](handleEntityNotFound(_0x1d78d0,null))['then'](function(_0x39f35b){if(_0x39f35b){return _0x1d78d0[_0x662e('0x56')](path[_0x662e('0x57')](config['root'],_0x662e('0x58'),_0x39f35b[_0x662e('0x53')]));}})[_0x662e('0x48')](handleError(_0x1d78d0,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8386f20..97d0bc9 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 _0x9c00=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4c060b,_0x4c5e75){_0x4c060b=_0x4c060b-0x0;var _0x5b9790=_0x9c00[_0x4c060b];return _0x5b9790;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d0=['rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','../../config/logger','api','bluebird','path'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x61d0,0x187));var _0x061d=function(_0xefb4e,_0xe56689){_0xefb4e=_0xefb4e-0x0;var _0x36c78c=_0x61d0[_0xefb4e];return _0x36c78c;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'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 49fe8b2..3c20315 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 _0xa60c=['create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment'];(function(_0x31e177,_0x2fce90){var _0x1f14fc=function(_0x215f40){while(--_0x215f40){_0x31e177['push'](_0x31e177['shift']());}};_0x1f14fc(++_0x2fce90);}(_0xa60c,0xdd));var _0xca60=function(_0xaf0e3,_0x102a52){_0xaf0e3=_0xaf0e3-0x0;var _0x512b5f=_0xa60c[_0xaf0e3];return _0x512b5f;};'use strict';var _=require(_0xca60('0x0'));var util=require(_0xca60('0x1'));var moment=require(_0xca60('0x2'));var BPromise=require('bluebird');var rs=require(_0xca60('0x3'));var fs=require('fs');var Redis=require(_0xca60('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xca60('0x5'));var logger=require(_0xca60('0x6'))(_0xca60('0x7'));var config=require(_0xca60('0x8'));var jayson=require(_0xca60('0x9'));var client=jayson[_0xca60('0xa')][_0xca60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ee8c4,_0x52f51c,_0x4a366c){return new BPromise(function(_0x4c12d4,_0x597f94){return client[_0xca60('0xc')](_0x1ee8c4,_0x4a366c)[_0xca60('0xd')](function(_0x58a318){logger[_0xca60('0xe')]('Attachment,\x20%s,\x20%s',_0x52f51c,_0xca60('0xf'));logger[_0xca60('0x10')](_0xca60('0x11'),_0x52f51c,'request\x20sent',JSON[_0xca60('0x12')](_0x58a318));if(_0x58a318[_0xca60('0x13')]){if(_0x58a318[_0xca60('0x13')][_0xca60('0x14')]===0x1f4){logger[_0xca60('0x13')]('Attachment,\x20%s,\x20%s',_0x52f51c,_0x58a318[_0xca60('0x13')][_0xca60('0x15')]);return _0x597f94(_0x58a318['error']['message']);}logger['error'](_0xca60('0x16'),_0x52f51c,_0x58a318['error'][_0xca60('0x15')]);return _0x4c12d4(_0x58a318[_0xca60('0x13')][_0xca60('0x15')]);}else{logger[_0xca60('0xe')](_0xca60('0x16'),_0x52f51c,_0xca60('0xf'));_0x4c12d4(_0x58a318[_0xca60('0x17')]['message']);}})[_0xca60('0x18')](function(_0x588eed){logger[_0xca60('0x13')](_0xca60('0x16'),_0x52f51c,_0x588eed);_0x597f94(_0x588eed);});});}exports[_0xca60('0x19')]=function(_0xbdd62d){var _0x5da492=this;return new Promise(function(_0x1c9360,_0x138ae2){return db[_0xca60('0x1a')][_0xca60('0x1b')](_0xbdd62d[_0xca60('0x1c')],{'raw':_0xbdd62d[_0xca60('0x1d')]?_0xbdd62d[_0xca60('0x1d')][_0xca60('0x1e')]===undefined?!![]:![]:!![]})[_0xca60('0xd')](function(_0x1407a1){logger['info'](_0xca60('0x19'),_0xbdd62d);logger[_0xca60('0x10')]('CreateAttachment',_0xbdd62d,JSON[_0xca60('0x12')](_0x1407a1));_0x1c9360(_0x1407a1);})[_0xca60('0x18')](function(_0x25e27e){logger[_0xca60('0x13')]('CreateAttachment',_0x25e27e['message'],_0xbdd62d);_0x138ae2(_0x5da492['error'](0x1f4,_0x25e27e[_0xca60('0x15')]));});});}; \ No newline at end of file +var _0xee62=['CreateAttachment','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','body','options','raw'];(function(_0x5d0818,_0x188411){var _0x37fcdb=function(_0x10c95a){while(--_0x10c95a){_0x5d0818['push'](_0x5d0818['shift']());}};_0x37fcdb(++_0x188411);}(_0xee62,0xf9));var _0x2ee6=function(_0x1176c4,_0x19f13a){_0x1176c4=_0x1176c4-0x0;var _0x3101d4=_0xee62[_0x1176c4];return _0x3101d4;};'use strict';var _=require(_0x2ee6('0x0'));var util=require('util');var moment=require(_0x2ee6('0x1'));var BPromise=require(_0x2ee6('0x2'));var rs=require(_0x2ee6('0x3'));var fs=require('fs');var Redis=require(_0x2ee6('0x4'));var db=require(_0x2ee6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ee6('0x6'))(_0x2ee6('0x7'));var config=require(_0x2ee6('0x8'));var jayson=require(_0x2ee6('0x9'));var client=jayson[_0x2ee6('0xa')][_0x2ee6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc66522,_0x54a43a,_0x5628c7){return new BPromise(function(_0x14e791,_0x13a1b4){return client[_0x2ee6('0xc')](_0xc66522,_0x5628c7)[_0x2ee6('0xd')](function(_0x318ac2){logger[_0x2ee6('0xe')](_0x2ee6('0xf'),_0x54a43a,_0x2ee6('0x10'));logger[_0x2ee6('0x11')](_0x2ee6('0x12'),_0x54a43a,_0x2ee6('0x10'),JSON[_0x2ee6('0x13')](_0x318ac2));if(_0x318ac2[_0x2ee6('0x14')]){if(_0x318ac2[_0x2ee6('0x14')][_0x2ee6('0x15')]===0x1f4){logger[_0x2ee6('0x14')](_0x2ee6('0xf'),_0x54a43a,_0x318ac2[_0x2ee6('0x14')][_0x2ee6('0x16')]);return _0x13a1b4(_0x318ac2[_0x2ee6('0x14')][_0x2ee6('0x16')]);}logger['error'](_0x2ee6('0xf'),_0x54a43a,_0x318ac2[_0x2ee6('0x14')]['message']);return _0x14e791(_0x318ac2[_0x2ee6('0x14')][_0x2ee6('0x16')]);}else{logger[_0x2ee6('0xe')](_0x2ee6('0xf'),_0x54a43a,'request\x20sent');_0x14e791(_0x318ac2[_0x2ee6('0x17')][_0x2ee6('0x16')]);}})[_0x2ee6('0x18')](function(_0x3b1e9e){logger[_0x2ee6('0x14')](_0x2ee6('0xf'),_0x54a43a,_0x3b1e9e);_0x13a1b4(_0x3b1e9e);});});}exports['CreateAttachment']=function(_0x82dc40){var _0x2b4206=this;return new Promise(function(_0x2a2b73,_0x489c17){return db[_0x2ee6('0x19')][_0x2ee6('0x1a')](_0x82dc40[_0x2ee6('0x1b')],{'raw':_0x82dc40['options']?_0x82dc40[_0x2ee6('0x1c')][_0x2ee6('0x1d')]===undefined?!![]:![]:!![]})[_0x2ee6('0xd')](function(_0x3981d6){logger[_0x2ee6('0xe')](_0x2ee6('0x1e'),_0x82dc40);logger['debug'](_0x2ee6('0x1e'),_0x82dc40,JSON[_0x2ee6('0x13')](_0x3981d6));_0x2a2b73(_0x3981d6);})[_0x2ee6('0x18')](function(_0xf590c9){logger[_0x2ee6('0x14')](_0x2ee6('0x1e'),_0xf590c9[_0x2ee6('0x16')],_0x82dc40);_0x489c17(_0x2b4206[_0x2ee6('0x14')](0x1f4,_0xf590c9['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8629e4c..5f24e97 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 _0x0137=['./attachment.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','/:id/clone','diskStorage','join','root','format','%s-%s','now','originalname','replace','single','file','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0137,0x1d8));var _0x7013=function(_0x48317f,_0x12895a){_0x48317f=_0x48317f-0x0;var _0x4d1cce=_0x0137[_0x48317f];return _0x4d1cce;};'use strict';var multer=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var path=require(_0x7013('0x2'));var timeout=require(_0x7013('0x3'));var express=require(_0x7013('0x4'));var router=express['Router']();var auth=require(_0x7013('0x5'));var interaction=require(_0x7013('0x6'));var config=require(_0x7013('0x7'));var controller=require(_0x7013('0x8'));router[_0x7013('0x9')]('/',auth[_0x7013('0xa')](),controller['index']);router[_0x7013('0x9')](_0x7013('0xb'),auth['isAuthenticated'](),controller[_0x7013('0xc')]);router[_0x7013('0x9')](_0x7013('0xd'),auth['isAuthenticated'](),controller[_0x7013('0xe')]);router[_0x7013('0xf')](_0x7013('0x10'),auth[_0x7013('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x7013('0x11')]({'destination':function(_0x2b74b3,_0x1a8995,_0x2f629d){_0x2f629d(null,path[_0x7013('0x12')](config[_0x7013('0x13')],'server/files/attachments/'));},'filename':function(_0x17a466,_0x3ea7f0,_0x2a91b8){_0x2a91b8(null,util[_0x7013('0x14')](_0x7013('0x15'),Date[_0x7013('0x16')](),_0x3ea7f0[_0x7013('0x17')][_0x7013('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7013('0xf')]('/',upload[_0x7013('0x19')](_0x7013('0x1a')),controller['create']);router['put'](_0x7013('0xb'),auth[_0x7013('0xa')](),controller[_0x7013('0x1b')]);router[_0x7013('0x1c')](_0x7013('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7013('0x1d')]=router; \ No newline at end of file +var _0x85e6=['download','/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post','single','create','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x85e6,0x1a5));var _0x685e=function(_0x2ff8b4,_0x1544d0){_0x2ff8b4=_0x2ff8b4-0x0;var _0x5ef90a=_0x85e6[_0x2ff8b4];return _0x5ef90a;};'use strict';var multer=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var path=require('path');var timeout=require(_0x685e('0x2'));var express=require(_0x685e('0x3'));var router=express['Router']();var auth=require(_0x685e('0x4'));var interaction=require(_0x685e('0x5'));var config=require(_0x685e('0x6'));var controller=require('./attachment.controller');router[_0x685e('0x7')]('/',auth['isAuthenticated'](),controller[_0x685e('0x8')]);router[_0x685e('0x7')](_0x685e('0x9'),auth['isAuthenticated'](),controller[_0x685e('0xa')]);router[_0x685e('0x7')](_0x685e('0xb'),auth[_0x685e('0xc')](),controller[_0x685e('0xd')]);router['post'](_0x685e('0xe'),auth['isAuthenticated'](),controller[_0x685e('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x344cbb,_0xfc5a40,_0xf74e3b){_0xf74e3b(null,path[_0x685e('0x10')](config[_0x685e('0x11')],_0x685e('0x12')));},'filename':function(_0x200716,_0x2d28ca,_0x11401c){_0x11401c(null,util[_0x685e('0x13')](_0x685e('0x14'),Date[_0x685e('0x15')](),_0x2d28ca[_0x685e('0x16')][_0x685e('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x685e('0x18')]('/',upload[_0x685e('0x19')]('file'),controller[_0x685e('0x1a')]);router[_0x685e('0x1b')](_0x685e('0x9'),auth[_0x685e('0xc')](),controller[_0x685e('0x1c')]);router['delete'](_0x685e('0x9'),auth[_0x685e('0xc')](),controller[_0x685e('0x1d')]);module[_0x685e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 57625c8..01cdd49 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 _0xd7b8=['../../config/environment','signToken','../../config/utils','login','authenticate','/login','email','callback','google','use','clientID','clientSecret','Setting','findOne','allowedLoginAttempts','blockDuration','find','map','emails','value','admin','user','agent','then','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd7b8,0x1e4));var _0x8d7b=function(_0x1834b3,_0x5d7607){_0x1834b3=_0x1834b3-0x0;var _0x396b1c=_0xd7b8[_0x1834b3];return _0x396b1c;};'use strict';var _=require(_0x8d7b('0x0'));var passport=require(_0x8d7b('0x1'));var GoogleStrategy=require(_0x8d7b('0x2'))[_0x8d7b('0x3')];var moment=require(_0x8d7b('0x4'));var db=require(_0x8d7b('0x5'))['db'];var config=require(_0x8d7b('0x6'));var signToken=require('../../components/auth/service')[_0x8d7b('0x7')];var utils=require(_0x8d7b('0x8'));exports[_0x8d7b('0x9')]=passport[_0x8d7b('0xa')]('google',{'failureRedirect':_0x8d7b('0xb'),'scope':['profile',_0x8d7b('0xc')],'session':![]});exports[_0x8d7b('0xd')]=passport[_0x8d7b('0xa')](_0x8d7b('0xe'),{'failureRedirect':_0x8d7b('0xb'),'session':![]});passport[_0x8d7b('0xf')](new GoogleStrategy({'clientID':config[_0x8d7b('0xe')]?config['google'][_0x8d7b('0x10')]:'id','clientSecret':config[_0x8d7b('0xe')]?config[_0x8d7b('0xe')][_0x8d7b('0x11')]:'secret','callbackURL':config[_0x8d7b('0xe')]?config[_0x8d7b('0xe')]['callbackURL']:''},function(_0x29d009,_0x1ea06b,_0x596968,_0x142d88){var _0x3ce3e8,_0x4a6b74;return db[_0x8d7b('0x12')][_0x8d7b('0x13')]({'where':{'id':0x1},'attributes':[_0x8d7b('0x14'),_0x8d7b('0x15')],'raw':!![]})['then'](function(_0x39e4ba){_0x3ce3e8=_0x39e4ba;return db['User'][_0x8d7b('0x16')]({'where':{'email':_[_0x8d7b('0x17')](_0x596968[_0x8d7b('0x18')],_0x8d7b('0x19')),'role':{'$or':[_0x8d7b('0x1a'),_0x8d7b('0x1b'),_0x8d7b('0x1c')]}}});})[_0x8d7b('0x1d')](function(_0x231242){_0x4a6b74=_0x231242;if(_0x4a6b74){if(_0x4a6b74['disabled']){return _0x142d88('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x3ce3e8[_0x8d7b('0x15')]>0x0){if(_0x4a6b74['blocked']){if(moment(_0x4a6b74['blockedAt'])[_0x8d7b('0x1e')](_0x3ce3e8[_0x8d7b('0x15')],'minutes')>moment()){return _0x142d88(_0x8d7b('0x1f'));}else{return utils[_0x8d7b('0x20')](_0x4a6b74,0x0,![],null)[_0x8d7b('0x1d')](function(){return utils[_0x8d7b('0x21')](_0x4a6b74);})[_0x8d7b('0x1d')](function(){return _0x142d88(null,_0x4a6b74);});}}else{return utils[_0x8d7b('0x21')](_0x4a6b74)[_0x8d7b('0x1d')](function(){return _0x142d88(null,_0x4a6b74);});}}else{return utils[_0x8d7b('0x21')](_0x4a6b74)[_0x8d7b('0x1d')](function(){return _0x142d88(null,_0x4a6b74);});}}return _0x142d88(_0x8d7b('0x1f'));})[_0x8d7b('0x22')](function(_0xac93){_0x142d88(_0xac93);});})); \ No newline at end of file +var _0xdac3=['admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','getLicense','catch','passport','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','/login','profile','use','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails'];(function(_0x5945bb,_0x49a992){var _0x2b4b3d=function(_0x1505ec){while(--_0x1505ec){_0x5945bb['push'](_0x5945bb['shift']());}};_0x2b4b3d(++_0x49a992);}(_0xdac3,0x1e6));var _0x3dac=function(_0x19e166,_0x4cc641){_0x19e166=_0x19e166-0x0;var _0x5e6bed=_0xdac3[_0x19e166];return _0x5e6bed;};'use strict';var _=require('lodash');var passport=require(_0x3dac('0x0'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x3dac('0x1'));var db=require(_0x3dac('0x2'))['db'];var config=require(_0x3dac('0x3'));var signToken=require(_0x3dac('0x4'))[_0x3dac('0x5')];var utils=require(_0x3dac('0x6'));exports['login']=passport[_0x3dac('0x7')](_0x3dac('0x8'),{'failureRedirect':_0x3dac('0x9'),'scope':[_0x3dac('0xa'),'email'],'session':![]});exports['callback']=passport[_0x3dac('0x7')](_0x3dac('0x8'),{'failureRedirect':_0x3dac('0x9'),'session':![]});passport[_0x3dac('0xb')](new GoogleStrategy({'clientID':config[_0x3dac('0x8')]?config['google'][_0x3dac('0xc')]:'id','clientSecret':config[_0x3dac('0x8')]?config[_0x3dac('0x8')][_0x3dac('0xd')]:_0x3dac('0xe'),'callbackURL':config[_0x3dac('0x8')]?config[_0x3dac('0x8')][_0x3dac('0xf')]:''},function(_0x2df55b,_0x56d299,_0x31e325,_0x41c4b7){var _0x44f074,_0x5b233a;return db['Setting'][_0x3dac('0x10')]({'where':{'id':0x1},'attributes':[_0x3dac('0x11'),_0x3dac('0x12')],'raw':!![]})[_0x3dac('0x13')](function(_0xbe25bc){_0x44f074=_0xbe25bc;return db[_0x3dac('0x14')][_0x3dac('0x15')]({'where':{'email':_[_0x3dac('0x16')](_0x31e325[_0x3dac('0x17')],'value'),'role':{'$or':[_0x3dac('0x18'),_0x3dac('0x19'),_0x3dac('0x1a')]}}});})[_0x3dac('0x13')](function(_0x12e88d){_0x5b233a=_0x12e88d;if(_0x5b233a){if(_0x5b233a[_0x3dac('0x1b')]){return _0x41c4b7(_0x3dac('0x1c'));}else if(_0x44f074[_0x3dac('0x12')]>0x0){if(_0x5b233a[_0x3dac('0x1d')]){if(moment(_0x5b233a[_0x3dac('0x1e')])['add'](_0x44f074[_0x3dac('0x12')],_0x3dac('0x1f'))>moment()){return _0x41c4b7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x5b233a,0x0,![],null)[_0x3dac('0x13')](function(){return utils['getLicense'](_0x5b233a);})['then'](function(){return _0x41c4b7(null,_0x5b233a);});}}else{return utils[_0x3dac('0x20')](_0x5b233a)[_0x3dac('0x13')](function(){return _0x41c4b7(null,_0x5b233a);});}}else{return utils[_0x3dac('0x20')](_0x5b233a)['then'](function(){return _0x41c4b7(null,_0x5b233a);});}}return _0x41c4b7(_0x3dac('0x1c'));})[_0x3dac('0x21')](function(_0x354bb6){_0x41c4b7(_0x354bb6);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 404406d..0a58bb0 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 _0x5309=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','setTokenCookie','exports','express','passport','Router'];(function(_0x57a6ce,_0x3d7316){var _0x38de7e=function(_0x18499b){while(--_0x18499b){_0x57a6ce['push'](_0x57a6ce['shift']());}};_0x38de7e(++_0x3d7316);}(_0x5309,0x1aa));var _0x9530=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x5309[_0x4bc65f];return _0x44f85f;};'use strict';var express=require(_0x9530('0x0'));var passport=require(_0x9530('0x1'));var router=express[_0x9530('0x2')]();var controller=require(_0x9530('0x3'));var userController=require(_0x9530('0x4'));var authService=require(_0x9530('0x5'));router[_0x9530('0x6')]('/',controller[_0x9530('0x7')]);router[_0x9530('0x6')](_0x9530('0x8'),controller['callback'],authService['isMiddleware'],userController[_0x9530('0x7')],authService[_0x9530('0x9')]);module[_0x9530('0xa')]=router; \ No newline at end of file +var _0x8c99=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8c99,0x1a8));var _0x98c9=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x8c99[_0xfb0281];return _0x408dd3;};'use strict';var express=require(_0x98c9('0x0'));var passport=require(_0x98c9('0x1'));var router=express[_0x98c9('0x2')]();var controller=require(_0x98c9('0x3'));var userController=require(_0x98c9('0x4'));var authService=require(_0x98c9('0x5'));router[_0x98c9('0x6')]('/',controller[_0x98c9('0x7')]);router[_0x98c9('0x6')](_0x98c9('0x8'),controller[_0x98c9('0x9')],authService[_0x98c9('0xa')],userController['login'],authService[_0x98c9('0xb')]);module[_0x98c9('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f58d7d9..e0bd996 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 _0x5b45=['port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','body','Email\x20parameter\x20is\x20missing','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','loginAttempts','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','clearBlockUser','disabled','add','getLicense','catch','find','email','MailServerOut','Smtp','service','host'];(function(_0xf0ae38,_0x546028){var _0x402e4a=function(_0x108c65){while(--_0x108c65){_0xf0ae38['push'](_0xf0ae38['shift']());}};_0x402e4a(++_0x546028);}(_0x5b45,0x114));var _0x55b4=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x5b45[_0x3a78a0];return _0x48e917;};'use strict';var util=require(_0x55b4('0x0'));var passport=require(_0x55b4('0x1'));var LocalStrategy=require(_0x55b4('0x2'))[_0x55b4('0x3')];var jayson=require(_0x55b4('0x4'));var _=require(_0x55b4('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x55b4('0x6'));var utils=require(_0x55b4('0x7'));var client=jayson['client'][_0x55b4('0x8')]({'port':0x232b});function localAuthenticate(_0x4808c4,_0x2b296e,_0x464555,_0x1defdc){var _0x16237d,_0xbe56a;return db[_0x55b4('0x9')][_0x55b4('0xa')]({'where':{'id':0x1},'attributes':[_0x55b4('0xb'),_0x55b4('0xc')],'raw':!![]})[_0x55b4('0xd')](function(_0x5b9f04){_0x16237d=_0x5b9f04;return _0x4808c4[_0x55b4('0xa')]({'attributes':['id',_0x55b4('0xe'),'password',_0x55b4('0xf'),_0x55b4('0x10'),'disabled',_0x55b4('0x11'),'blockedAt',_0x55b4('0x12')],'where':{'name':_0x2b296e,'role':{'$or':['admin',_0x55b4('0x13'),_0x55b4('0x14')]}}});})[_0x55b4('0xd')](function(_0x53d792){if(!_0x53d792||_0x53d792&&_0x53d792['name']!==_0x2b296e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xbe56a=_0x53d792;return _0xbe56a;}})['then'](function(){_0xbe56a[_0x55b4('0x15')](_0x464555,function(_0x2e83a8,_0x5d1c94){var _0x610af8=_0xbe56a['loginAttempts']+0x1;if(_0x2e83a8){return _0x1defdc(_0x2e83a8);}else if(!_0x5d1c94){if(_0xbe56a['disabled']){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});}else if(_0x16237d['allowedLoginAttempts']>0x0){if(_0xbe56a[_0x55b4('0x11')]){if(_0x16237d['blockDuration']>0x0){if(moment(_0xbe56a[_0x55b4('0x17')])['add'](_0x16237d['blockDuration'],_0x55b4('0x18'))>moment()){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});}else{return utils['clearBlockUser'](_0xbe56a,_0x610af8,![],null)[_0x55b4('0xd')](function(){return _0x1defdc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1defdc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x610af8>=_0x16237d[_0x55b4('0xb')]){return utils['clearBlockUser'](_0xbe56a,0x0,!![],moment())[_0x55b4('0xd')](function(){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});});}else{return utils[_0x55b4('0x19')](_0xbe56a,_0x610af8,![],null)[_0x55b4('0xd')](function(){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});});}}}else{return _0x1defdc(null,![],{'message':_0x55b4('0x16')});}}else{if(_0xbe56a[_0x55b4('0x1a')]){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});}else if(_0x16237d['allowedLoginAttempts']>0x0){if(_0xbe56a['blocked']){if(_0x16237d[_0x55b4('0xc')]>0x0){if(moment(_0xbe56a[_0x55b4('0x17')])[_0x55b4('0x1b')](_0x16237d[_0x55b4('0xc')],_0x55b4('0x18'))>moment()){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});}else{return utils[_0x55b4('0x19')](_0xbe56a,0x0,![],null)[_0x55b4('0xd')](function(){return utils[_0x55b4('0x1c')](_0xbe56a);})['then'](function(){return _0x1defdc(null,_0xbe56a);});}}else{return _0x1defdc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x55b4('0x19')](_0xbe56a,0x0,![],null)[_0x55b4('0xd')](function(){return utils[_0x55b4('0x1c')](_0xbe56a);})[_0x55b4('0xd')](function(){return _0x1defdc(null,_0xbe56a);})[_0x55b4('0x1d')](function(_0x4f8a3b){return _0x1defdc(null,![],_0x4f8a3b);});}}else{if(_0xbe56a[_0x55b4('0x11')]){return _0x1defdc(null,![],{'message':_0x55b4('0x16')});}else{return utils[_0x55b4('0x1c')](_0xbe56a)[_0x55b4('0xd')](function(){return _0x1defdc(null,_0xbe56a);});}}}});})[_0x55b4('0x1d')](function(_0x4a8361){return _0x1defdc(null,![],_0x4a8361);});}function sendServiceMail(_0x3dec02){return db['MailAccount'][_0x55b4('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x55b4('0xe'),_0x55b4('0x1f')],'include':[{'model':db[_0x55b4('0x20')],'as':_0x55b4('0x21')}]})[_0x55b4('0xd')](function(_0x46ebea){if(!_0x46ebea){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x52b000={'tls':{'rejectUnauthorized':![]}};if(_0x46ebea[_0x55b4('0x21')][_0x55b4('0x22')]){_0x52b000['service']=_0x46ebea[_0x55b4('0x21')][_0x55b4('0x22')];}else{_0x52b000[_0x55b4('0x23')]=_0x46ebea['Smtp'][_0x55b4('0x23')];_0x52b000['port']=_0x46ebea[_0x55b4('0x21')][_0x55b4('0x24')];_0x52b000['secure']=_0x46ebea[_0x55b4('0x21')][_0x55b4('0x25')];}if(_0x46ebea[_0x55b4('0x21')][_0x55b4('0x26')]){_0x52b000[_0x55b4('0x27')]={'user':_0x46ebea[_0x55b4('0x21')][_0x55b4('0x13')],'pass':_0x46ebea[_0x55b4('0x21')][_0x55b4('0x28')]};}var _0x42f4c8={'account':_0x52b000,'message':_['merge']({'from':util[_0x55b4('0x29')](_0x55b4('0x2a'),_0x46ebea['name'],_0x46ebea[_0x55b4('0x1f')]||_0x46ebea[_0x55b4('0x21')][_0x55b4('0x13')])},_0x3dec02)};return client['request'](_0x55b4('0x2b'),_0x42f4c8);})[_0x55b4('0xd')](function(_0x198dbb){if(_0x198dbb[_0x55b4('0x2c')]){throw new Error(util[_0x55b4('0x29')](_0x55b4('0x2d'),_0x198dbb['error'][_0x55b4('0x2e')]||JSON[_0x55b4('0x2f')](_0x198dbb[_0x55b4('0x2c')])));}return!![];});}function handleError(_0x50e086,_0x4faf46,_0x1b600d){return _0x50e086[_0x55b4('0x30')](_0x4faf46||0x1f4)[_0x55b4('0x31')]({'message':_0x1b600d?_0x1b600d[_0x55b4('0x2e')]||_0x1b600d:''});}function checkPasswordPattern(_0x28fbba,_0x248e19,_0x131981){if(_0x131981){var _0x14579e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14579e[_0x55b4('0x32')](_0x248e19)){return _0x28fbba;}else{throw new Error(_0x55b4('0x33'));}}else{return _0x28fbba;}}exports[_0x55b4('0x34')]=function(_0x32803d,_0x18e27f,_0x4261e1){passport['authenticate'](_0x55b4('0x35'),function(_0x22449d,_0x4f61da,_0x4d663f){var _0x5f3d7a=_0x22449d||_0x4d663f;if(_0x5f3d7a){return handleError(_0x18e27f,0x191,_0x5f3d7a);}if(!_0x4f61da){return handleError(_0x18e27f,0x194,{'message':_0x55b4('0x36')});}else{var _0x471256={'payload':{'id':_0x4f61da['id'],'role':_0x4f61da['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x471256)[_0x55b4('0xd')](function(_0x23828c){_0x18e27f['json']({'id':_0x4f61da['id'],'token':_0x23828c,'statusCall':'','isAlreadyLogged':_0x4f61da[_0x55b4('0x37')]});});}})(_0x32803d,_0x18e27f,_0x4261e1);};exports['forgot']=function(_0x13c304,_0x407767,_0x1e2395){if(!_0x13c304[_0x55b4('0x38')][_0x55b4('0x1f')]){return handleError(_0x407767,0x1f4,{'message':_0x55b4('0x39')});}var _0x280f53=rs['generate']();_0x13c304[_0x55b4('0x38')][_0x55b4('0x1f')]=_0x13c304[_0x55b4('0x38')][_0x55b4('0x1f')][_0x55b4('0x3a')]()['toLowerCase']();var _0x20f815;return db[_0x55b4('0x9')][_0x55b4('0xa')]({'where':{'id':0x1},'attributes':[_0x55b4('0xb'),_0x55b4('0xc')],'raw':!![]})[_0x55b4('0xd')](function(_0xa0c0e1){_0x20f815=_0xa0c0e1;return db[_0x55b4('0x3b')]['find']({'where':{'email':_0x13c304['body'][_0x55b4('0x1f')]}});})[_0x55b4('0xd')](function(_0x2f8046){if(!_0x2f8046){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2f8046[_0x55b4('0x1a')]){throw new Error(_0x55b4('0x3c'));}if(_0x2f8046[_0x55b4('0x11')]){if(moment(_0x2f8046['blockedAt'])[_0x55b4('0x1b')](_0x20f815[_0x55b4('0xc')],_0x55b4('0x18'))>moment()){throw new Error(_0x55b4('0x3d'));}else{_0x2f8046[_0x55b4('0x11')]=![];_0x2f8046['blockedAt']=null;}}_0x2f8046[_0x55b4('0x3e')]=_0x280f53;_0x2f8046['resetPasswordExpires']=Date[_0x55b4('0x3f')]()+0x36ee80;return _0x2f8046['save']();})[_0x55b4('0xd')](function(){return sendServiceMail({'to':_0x13c304[_0x55b4('0x38')][_0x55b4('0x1f')],'subject':_0x55b4('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x55b4('0x41')+_0x55b4('0x42')+_0x13c304[_0x55b4('0x43')][_0x55b4('0x23')]+_0x55b4('0x44')+_0x280f53+'\x0a\x0a'+_0x55b4('0x45')});})['then'](function(){_0x407767[_0x55b4('0x30')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x55b4('0x1d')](function(_0x2bf367){return handleError(_0x407767,0x1f4,_0x2bf367);});};exports[_0x55b4('0x46')]=function(_0x4aafeb,_0xe9c96a,_0x35acfa){var _0x3898d7;return db[_0x55b4('0x3b')][_0x55b4('0x1e')]({'where':{'resetPasswordToken':_0x4aafeb[_0x55b4('0x47')][_0x55b4('0x48')],'resetPasswordExpires':{'$gt':Date[_0x55b4('0x3f')]()}}})[_0x55b4('0xd')](function(_0x297e5d){_0x3898d7=_0x297e5d;if(!_0x3898d7){throw new Error(_0x55b4('0x49'));}return db['Setting'][_0x55b4('0xa')]({'attributes':['id','securePassword']});})[_0x55b4('0xd')](function(_0x3c4ba9){return checkPasswordPattern(_0x3c4ba9,_0x4aafeb[_0x55b4('0x38')][_0x55b4('0x4a')],_0x3c4ba9['securePassword']);})['then'](function(){_0x3898d7['password']=_0x4aafeb[_0x55b4('0x38')][_0x55b4('0x4a')];_0x3898d7['resetPasswordToken']=null;_0x3898d7['resetPasswordExpires']=null;return _0x3898d7[_0x55b4('0x4b')]();})['then'](function(){_0xe9c96a[_0x55b4('0x30')](0xc8)[_0x55b4('0x31')]({'message':_0x55b4('0x4c')});})[_0x55b4('0x1d')](function(_0x18df21){return handleError(_0xe9c96a,0x1f4,_0x18df21);});};passport[_0x55b4('0x4d')](new LocalStrategy({'usernameField':'name','passwordField':_0x55b4('0x4a')},function(_0x578040,_0x5ef6af,_0x4fd0b4){return localAuthenticate(db[_0x55b4('0x3b')],_0x578040,_0x5ef6af,_0x4fd0b4);})); \ No newline at end of file +var _0x1c59=['catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\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','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','blocked','blockedAt','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','minutes','clearBlockUser','add','getLicense'];(function(_0x4ddc58,_0x10912c){var _0x34de9f=function(_0x5e57fa){while(--_0x5e57fa){_0x4ddc58['push'](_0x4ddc58['shift']());}};_0x34de9f(++_0x10912c);}(_0x1c59,0x18e));var _0x91c5=function(_0x39ea5f,_0xad7c1c){_0x39ea5f=_0x39ea5f-0x0;var _0x41d0c4=_0x1c59[_0x39ea5f];return _0x41d0c4;};'use strict';var util=require(_0x91c5('0x0'));var passport=require(_0x91c5('0x1'));var LocalStrategy=require(_0x91c5('0x2'))[_0x91c5('0x3')];var jayson=require(_0x91c5('0x4'));var _=require(_0x91c5('0x5'));var rs=require('randomstring');var moment=require(_0x91c5('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x91c5('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x135d6b,_0x3a9b48,_0x49f7f8,_0x580c32){var _0x1754b5,_0x1660a4;return db[_0x91c5('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x91c5('0x9'),_0x91c5('0xa')],'raw':!![]})[_0x91c5('0xb')](function(_0x3b27d5){_0x1754b5=_0x3b27d5;return _0x135d6b[_0x91c5('0xc')]({'attributes':['id',_0x91c5('0xd'),'password',_0x91c5('0xe'),'role','disabled',_0x91c5('0xf'),_0x91c5('0x10'),'loginAttempts'],'where':{'name':_0x3a9b48,'role':{'$or':[_0x91c5('0x11'),'user',_0x91c5('0x12')]}}});})[_0x91c5('0xb')](function(_0x4db24d){if(!_0x4db24d||_0x4db24d&&_0x4db24d['name']!==_0x3a9b48){throw new Error(_0x91c5('0x13'));}else{_0x1660a4=_0x4db24d;return _0x1660a4;}})[_0x91c5('0xb')](function(){_0x1660a4[_0x91c5('0x14')](_0x49f7f8,function(_0x2b6747,_0x5f297b){var _0xf31b9e=_0x1660a4[_0x91c5('0x15')]+0x1;if(_0x2b6747){return _0x580c32(_0x2b6747);}else if(!_0x5f297b){if(_0x1660a4[_0x91c5('0x16')]){return _0x580c32(null,![],{'message':_0x91c5('0x13')});}else if(_0x1754b5[_0x91c5('0x9')]>0x0){if(_0x1660a4['blocked']){if(_0x1754b5[_0x91c5('0xa')]>0x0){if(moment(_0x1660a4['blockedAt'])['add'](_0x1754b5[_0x91c5('0xa')],_0x91c5('0x17'))>moment()){return _0x580c32(null,![],{'message':_0x91c5('0x13')});}else{return utils['clearBlockUser'](_0x1660a4,_0xf31b9e,![],null)['then'](function(){return _0x580c32(null,![],{'message':_0x91c5('0x13')});});}}else{return _0x580c32(null,![],{'message':_0x91c5('0x13')});}}else{if(_0xf31b9e>=_0x1754b5[_0x91c5('0x9')]){return utils[_0x91c5('0x18')](_0x1660a4,0x0,!![],moment())[_0x91c5('0xb')](function(){return _0x580c32(null,![],{'message':_0x91c5('0x13')});});}else{return utils[_0x91c5('0x18')](_0x1660a4,_0xf31b9e,![],null)[_0x91c5('0xb')](function(){return _0x580c32(null,![],{'message':_0x91c5('0x13')});});}}}else{return _0x580c32(null,![],{'message':_0x91c5('0x13')});}}else{if(_0x1660a4['disabled']){return _0x580c32(null,![],{'message':_0x91c5('0x13')});}else if(_0x1754b5[_0x91c5('0x9')]>0x0){if(_0x1660a4[_0x91c5('0xf')]){if(_0x1754b5[_0x91c5('0xa')]>0x0){if(moment(_0x1660a4[_0x91c5('0x10')])[_0x91c5('0x19')](_0x1754b5[_0x91c5('0xa')],_0x91c5('0x17'))>moment()){return _0x580c32(null,![],{'message':_0x91c5('0x13')});}else{return utils[_0x91c5('0x18')](_0x1660a4,0x0,![],null)[_0x91c5('0xb')](function(){return utils['getLicense'](_0x1660a4);})[_0x91c5('0xb')](function(){return _0x580c32(null,_0x1660a4);});}}else{return _0x580c32(null,![],{'message':_0x91c5('0x13')});}}else{return utils['clearBlockUser'](_0x1660a4,0x0,![],null)['then'](function(){return utils[_0x91c5('0x1a')](_0x1660a4);})['then'](function(){return _0x580c32(null,_0x1660a4);})[_0x91c5('0x1b')](function(_0x4a6655){return _0x580c32(null,![],_0x4a6655);});}}else{if(_0x1660a4[_0x91c5('0xf')]){return _0x580c32(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x1660a4)[_0x91c5('0xb')](function(){return _0x580c32(null,_0x1660a4);});}}}});})['catch'](function(_0x9923f8){return _0x580c32(null,![],_0x9923f8);});}function sendServiceMail(_0x189ad5){return db[_0x91c5('0x1c')][_0x91c5('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x91c5('0xd'),_0x91c5('0x1e')],'include':[{'model':db[_0x91c5('0x1f')],'as':_0x91c5('0x20')}]})['then'](function(_0x2843fb){if(!_0x2843fb){throw new Error(_0x91c5('0x21'));}var _0x48b721={'tls':{'rejectUnauthorized':![]}};if(_0x2843fb[_0x91c5('0x20')][_0x91c5('0x22')]){_0x48b721[_0x91c5('0x22')]=_0x2843fb[_0x91c5('0x20')][_0x91c5('0x22')];}else{_0x48b721[_0x91c5('0x23')]=_0x2843fb[_0x91c5('0x20')][_0x91c5('0x23')];_0x48b721[_0x91c5('0x24')]=_0x2843fb['Smtp'][_0x91c5('0x24')];_0x48b721[_0x91c5('0x25')]=_0x2843fb[_0x91c5('0x20')]['secure'];}if(_0x2843fb[_0x91c5('0x20')][_0x91c5('0x26')]){_0x48b721[_0x91c5('0x27')]={'user':_0x2843fb['Smtp'][_0x91c5('0x28')],'pass':_0x2843fb[_0x91c5('0x20')][_0x91c5('0x29')]};}var _0x5742c7={'account':_0x48b721,'message':_[_0x91c5('0x2a')]({'from':util[_0x91c5('0x2b')](_0x91c5('0x2c'),_0x2843fb['name'],_0x2843fb[_0x91c5('0x1e')]||_0x2843fb['Smtp'][_0x91c5('0x28')])},_0x189ad5)};return client[_0x91c5('0x2d')]('SendMail',_0x5742c7);})[_0x91c5('0xb')](function(_0x29521b){if(_0x29521b[_0x91c5('0x2e')]){throw new Error(util[_0x91c5('0x2b')](_0x91c5('0x2f'),_0x29521b[_0x91c5('0x2e')][_0x91c5('0x30')]||JSON['stringify'](_0x29521b[_0x91c5('0x2e')])));}return!![];});}function handleError(_0x21d115,_0xa8ad7c,_0x4b9908){return _0x21d115[_0x91c5('0x31')](_0xa8ad7c||0x1f4)[_0x91c5('0x32')]({'message':_0x4b9908?_0x4b9908[_0x91c5('0x30')]||_0x4b9908:''});}function checkPasswordPattern(_0xc82d7c,_0x4a6b48,_0x334f99){if(_0x334f99){var _0x51bc8e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51bc8e[_0x91c5('0x33')](_0x4a6b48)){return _0xc82d7c;}else{throw new Error(_0x91c5('0x34'));}}else{return _0xc82d7c;}}exports['login']=function(_0x522c31,_0x116db6,_0x529cfe){passport[_0x91c5('0x14')](_0x91c5('0x35'),function(_0x4ac3f2,_0xe4e63c,_0x5a1600){var _0x235ccd=_0x4ac3f2||_0x5a1600;if(_0x235ccd){return handleError(_0x116db6,0x191,_0x235ccd);}if(!_0xe4e63c){return handleError(_0x116db6,0x194,{'message':_0x91c5('0x36')});}else{var _0x16362a={'payload':{'id':_0xe4e63c['id'],'role':_0xe4e63c[_0x91c5('0x37')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x16362a)[_0x91c5('0xb')](function(_0x36d5f9){_0x116db6[_0x91c5('0x38')]({'id':_0xe4e63c['id'],'token':_0x36d5f9,'statusCall':'','isAlreadyLogged':_0xe4e63c[_0x91c5('0x39')]});});}})(_0x522c31,_0x116db6,_0x529cfe);};exports[_0x91c5('0x3a')]=function(_0x480163,_0x12aea2,_0x22e8d5){if(!_0x480163['body'][_0x91c5('0x1e')]){return handleError(_0x12aea2,0x1f4,{'message':_0x91c5('0x3b')});}var _0x246b8e=rs[_0x91c5('0x3c')]();_0x480163[_0x91c5('0x3d')][_0x91c5('0x1e')]=_0x480163['body']['email'][_0x91c5('0x3e')]()[_0x91c5('0x3f')]();var _0x3f85be;return db[_0x91c5('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x91c5('0x9'),_0x91c5('0xa')],'raw':!![]})[_0x91c5('0xb')](function(_0x1e648b){_0x3f85be=_0x1e648b;return db[_0x91c5('0x40')][_0x91c5('0x1d')]({'where':{'email':_0x480163['body'][_0x91c5('0x1e')]}});})['then'](function(_0x337ee2){if(!_0x337ee2){throw new Error(_0x91c5('0x41'));}if(_0x337ee2[_0x91c5('0x16')]){throw new Error(_0x91c5('0x42'));}if(_0x337ee2['blocked']){if(moment(_0x337ee2[_0x91c5('0x10')])[_0x91c5('0x19')](_0x3f85be['blockDuration'],_0x91c5('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x337ee2[_0x91c5('0xf')]=![];_0x337ee2['blockedAt']=null;}}_0x337ee2[_0x91c5('0x43')]=_0x246b8e;_0x337ee2[_0x91c5('0x44')]=Date[_0x91c5('0x45')]()+0x36ee80;return _0x337ee2[_0x91c5('0x46')]();})[_0x91c5('0xb')](function(){return sendServiceMail({'to':_0x480163[_0x91c5('0x3d')][_0x91c5('0x1e')],'subject':_0x91c5('0x47'),'text':_0x91c5('0x48')+_0x91c5('0x49')+_0x91c5('0x4a')+_0x480163['headers'][_0x91c5('0x23')]+_0x91c5('0x4b')+_0x246b8e+'\x0a\x0a'+_0x91c5('0x4c')});})[_0x91c5('0xb')](function(){_0x12aea2[_0x91c5('0x31')](0xc8)[_0x91c5('0x32')]({'message':_0x91c5('0x4d')});})[_0x91c5('0x1b')](function(_0x238124){return handleError(_0x12aea2,0x1f4,_0x238124);});};exports['reset']=function(_0x329734,_0x534901,_0x118d26){var _0x25eb75;return db[_0x91c5('0x40')]['find']({'where':{'resetPasswordToken':_0x329734[_0x91c5('0x4e')][_0x91c5('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x91c5('0x45')]()}}})[_0x91c5('0xb')](function(_0x32bc2b){_0x25eb75=_0x32bc2b;if(!_0x25eb75){throw new Error(_0x91c5('0x50'));}return db[_0x91c5('0x8')][_0x91c5('0xc')]({'attributes':['id','securePassword']});})[_0x91c5('0xb')](function(_0x30ee81){return checkPasswordPattern(_0x30ee81,_0x329734[_0x91c5('0x3d')]['password'],_0x30ee81[_0x91c5('0x51')]);})['then'](function(){_0x25eb75[_0x91c5('0x52')]=_0x329734[_0x91c5('0x3d')]['password'];_0x25eb75[_0x91c5('0x43')]=null;_0x25eb75[_0x91c5('0x44')]=null;return _0x25eb75['save']();})[_0x91c5('0xb')](function(){_0x534901[_0x91c5('0x31')](0xc8)[_0x91c5('0x32')]({'message':_0x91c5('0x53')});})[_0x91c5('0x1b')](function(_0x9f929b){return handleError(_0x534901,0x1f4,_0x9f929b);});};passport[_0x91c5('0x54')](new LocalStrategy({'usernameField':_0x91c5('0xd'),'passwordField':'password'},function(_0x24a2c2,_0xa6453c,_0x7a5c1e){return localAuthenticate(db[_0x91c5('0x40')],_0x24a2c2,_0xa6453c,_0x7a5c1e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index bcc7bd1..9c8af80 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 _0x4223=['/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login'];(function(_0x105c50,_0x29ba3e){var _0x570327=function(_0x3fa438){while(--_0x3fa438){_0x105c50['push'](_0x105c50['shift']());}};_0x570327(++_0x29ba3e);}(_0x4223,0xff));var _0x3422=function(_0x48581f,_0x21135a){_0x48581f=_0x48581f-0x0;var _0x47d4e4=_0x4223[_0x48581f];return _0x47d4e4;};'use strict';var express=require(_0x3422('0x0'));var router=express[_0x3422('0x1')]();var controller=require(_0x3422('0x2'));router[_0x3422('0x3')]('/',controller[_0x3422('0x4')]);router[_0x3422('0x3')](_0x3422('0x5'),controller[_0x3422('0x6')]);router[_0x3422('0x3')](_0x3422('0x7'),controller[_0x3422('0x8')]);module[_0x3422('0x9')]=router; \ No newline at end of file +var _0x914c=['reset','exports','express','./authLocal.controller','post','login','forgot','/reset/:token'];(function(_0xee4852,_0x3dc9a8){var _0x92078a=function(_0x873f5c){while(--_0x873f5c){_0xee4852['push'](_0xee4852['shift']());}};_0x92078a(++_0x3dc9a8);}(_0x914c,0x132));var _0xc914=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x914c[_0x1b6186];return _0x186121;};'use strict';var express=require(_0xc914('0x0'));var router=express['Router']();var controller=require(_0xc914('0x1'));router[_0xc914('0x2')]('/',controller[_0xc914('0x3')]);router[_0xc914('0x2')]('/forgot',controller[_0xc914('0x4')]);router[_0xc914('0x2')](_0xc914('0x5'),controller[_0xc914('0x6')]);module[_0xc914('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index cd0446c..1263194 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 _0x82f8=['STRING','BOOLEAN','INTEGER','exports'];(function(_0xa4c45a,_0x288d02){var _0x44e92f=function(_0x32aed6){while(--_0x32aed6){_0xa4c45a['push'](_0xa4c45a['shift']());}};_0x44e92f(++_0x288d02);}(_0x82f8,0xc3));var _0x882f=function(_0x206616,_0x343ab4){_0x206616=_0x206616-0x0;var _0x3551c7=_0x82f8[_0x206616];return _0x3551c7;};'use strict';var Sequelize=require('sequelize');module[_0x882f('0x0')]={'name':{'type':Sequelize[_0x882f('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x882f('0x1')]},'description':{'type':Sequelize[_0x882f('0x1')]},'status':{'type':Sequelize[_0x882f('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x882f('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7907=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x7907,0x1e3));var _0x7790=function(_0x57b358,_0xa160b7){_0x57b358=_0x57b358-0x0;var _0x29d852=_0x7907[_0x57b358];return _0x29d852;};'use strict';var Sequelize=require(_0x7790('0x0'));module[_0x7790('0x1')]={'name':{'type':Sequelize[_0x7790('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7790('0x2')]},'status':{'type':Sequelize[_0x7790('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fe17f37..8a3a62b 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 _0x9441=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','Automation','includeAll','include','findAll','rows','catch','show','keys','length','create','body','params','addConditions','find','ids','omit','getConditions','Condition','order','addActions','getActions','findOne','Action','pick','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x4f153b,_0x39818f){var _0x4e0cf8=function(_0x5a2236){while(--_0x5a2236){_0x4f153b['push'](_0x4f153b['shift']());}};_0x4e0cf8(++_0x39818f);}(_0x9441,0xd8));var _0x1944=function(_0x52febb,_0x2b0f2f){_0x52febb=_0x52febb-0x0;var _0x359ca8=_0x9441[_0x52febb];return _0x359ca8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1944('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1944('0x1'));var jsonpatch=require(_0x1944('0x2'));var rp=require(_0x1944('0x3'));var moment=require('moment');var BPromise=require(_0x1944('0x4'));var Mustache=require(_0x1944('0x5'));var util=require(_0x1944('0x6'));var path=require('path');var sox=require(_0x1944('0x7'));var csv=require(_0x1944('0x8'));var ejs=require(_0x1944('0x9'));var fs=require('fs');var _=require(_0x1944('0xa'));var squel=require(_0x1944('0xb'));var crypto=require(_0x1944('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1944('0xd'));var toCsv=require(_0x1944('0x8'));var querystring=require('querystring');var Papa=require(_0x1944('0xe'));var Redis=require(_0x1944('0xf'));var authService=require(_0x1944('0x10'));var qs=require(_0x1944('0x11'));var as=require(_0x1944('0x12'));var hardwareService=require(_0x1944('0x13'));var logger=require('../../config/logger')(_0x1944('0x14'));var utils=require(_0x1944('0x15'));var config=require(_0x1944('0x16'));var db=require(_0x1944('0x17'))['db'];function respondWithStatusCode(_0x165e01,_0x1c42da){_0x1c42da=_0x1c42da||0xcc;return function(_0x5ceb7b){if(_0x5ceb7b){return _0x165e01[_0x1944('0x18')](_0x1c42da);}return _0x165e01[_0x1944('0x19')](_0x1c42da)[_0x1944('0x1a')]();};}function respondWithResult(_0x298c90,_0x53fdf6){_0x53fdf6=_0x53fdf6||0xc8;return function(_0x293a0d){if(_0x293a0d){return _0x298c90[_0x1944('0x19')](_0x53fdf6)[_0x1944('0x1b')](_0x293a0d);}};}function respondWithFilteredResult(_0x928624,_0x4891d2){return function(_0x5e6d6b){if(_0x5e6d6b){var _0x108bb2=_0x5e6d6b[_0x1944('0x1c')],_0x3a0bd9=_0x4891d2[_0x1944('0x1d')],_0x5845fb=_0x4891d2[_0x1944('0x1d')]+_0x4891d2[_0x1944('0x1e')],_0x392b7b;if(_0x5845fb>=_0x108bb2){_0x5845fb=_0x108bb2;_0x392b7b=0xc8;}else{_0x392b7b=0xce;}_0x928624[_0x1944('0x19')](_0x392b7b);return _0x928624[_0x1944('0x1f')]('Content-Range',_0x3a0bd9+'-'+_0x5845fb+'/'+_0x108bb2)[_0x1944('0x1b')](_0x5e6d6b);}return null;};}function patchUpdates(_0x109166){return function(_0x36ebcc){try{jsonpatch[_0x1944('0x20')](_0x36ebcc,_0x109166,!![]);}catch(_0x44a986){return BPromise[_0x1944('0x21')](_0x44a986);}return _0x36ebcc[_0x1944('0x22')]();};}function saveUpdates(_0xd6d1ab,_0x2f45cc){return function(_0x3ac2a6){if(_0x3ac2a6){return _0x3ac2a6[_0x1944('0x23')](_0xd6d1ab)[_0x1944('0x24')](function(_0x1cd51f){return _0x1cd51f;});}return null;};}function removeEntity(_0x23563b,_0x1d3290){return function(_0x175337){if(_0x175337){return _0x175337[_0x1944('0x25')]()[_0x1944('0x24')](function(){_0x23563b[_0x1944('0x19')](0xcc)[_0x1944('0x1a')]();});}};}function handleEntityNotFound(_0x49a417,_0x5248c3){return function(_0x5d8de2){if(!_0x5d8de2){_0x49a417['sendStatus'](0x194);}return _0x5d8de2;};}function handleError(_0x54b01d,_0x541350){_0x541350=_0x541350||0x1f4;return function(_0x4fc1fc){logger[_0x1944('0x26')](_0x4fc1fc[_0x1944('0x27')]);if(_0x4fc1fc[_0x1944('0x28')]){delete _0x4fc1fc[_0x1944('0x28')];}_0x54b01d[_0x1944('0x19')](_0x541350)[_0x1944('0x29')](_0x4fc1fc);};}exports[_0x1944('0x2a')]=function(_0x2926e9,_0x3c4968){var _0x1e5574={},_0x3b43ab={},_0x2c45e6={'count':0x0,'rows':[]};var _0x4551dd=_[_0x1944('0x2b')](db['Automation'][_0x1944('0x2c')],function(_0xf3a1d3){return{'name':_0xf3a1d3[_0x1944('0x2d')],'type':_0xf3a1d3[_0x1944('0x2e')]['key']};});_0x3b43ab[_0x1944('0x2f')]=_[_0x1944('0x2b')](_0x4551dd,_0x1944('0x28'));_0x3b43ab[_0x1944('0x30')]=_['keys'](_0x2926e9[_0x1944('0x30')]);_0x3b43ab[_0x1944('0x31')]=_[_0x1944('0x32')](_0x3b43ab[_0x1944('0x2f')],_0x3b43ab[_0x1944('0x30')]);_0x1e5574[_0x1944('0x33')]=_[_0x1944('0x32')](_0x3b43ab[_0x1944('0x2f')],qs[_0x1944('0x34')](_0x2926e9['query'][_0x1944('0x34')]));_0x1e5574['attributes']=_0x1e5574[_0x1944('0x33')]['length']?_0x1e5574[_0x1944('0x33')]:_0x3b43ab[_0x1944('0x2f')];if(!_0x2926e9[_0x1944('0x30')][_0x1944('0x35')](_0x1944('0x36'))){_0x1e5574['limit']=qs[_0x1944('0x1e')](_0x2926e9[_0x1944('0x30')][_0x1944('0x1e')]);_0x1e5574[_0x1944('0x1d')]=qs[_0x1944('0x1d')](_0x2926e9['query']['offset']);}_0x1e5574['order']=qs[_0x1944('0x37')](_0x2926e9[_0x1944('0x30')]['sort']);_0x1e5574[_0x1944('0x38')]=qs[_0x1944('0x31')](_['pick'](_0x2926e9[_0x1944('0x30')],_0x3b43ab[_0x1944('0x31')]),_0x4551dd);if(_0x2926e9[_0x1944('0x30')][_0x1944('0x39')]){_0x1e5574['where']=_[_0x1944('0x3a')](_0x1e5574[_0x1944('0x38')],{'$or':_[_0x1944('0x2b')](_0x4551dd,function(_0x4f6b04){if(_0x4f6b04[_0x1944('0x2e')]!=='VIRTUAL'){var _0x1a3f5b={};_0x1a3f5b[_0x4f6b04['name']]={'$like':'%'+_0x2926e9[_0x1944('0x30')][_0x1944('0x39')]+'%'};return _0x1a3f5b;}})});}_0x1e5574=_['merge']({},_0x1e5574,_0x2926e9[_0x1944('0x3b')]);var _0x48a525={'where':_0x1e5574['where']};return db[_0x1944('0x3c')]['count'](_0x48a525)[_0x1944('0x24')](function(_0x213d94){_0x2c45e6['count']=_0x213d94;if(_0x2926e9[_0x1944('0x30')][_0x1944('0x3d')]){_0x1e5574[_0x1944('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x1944('0x3f')](_0x1e5574);})[_0x1944('0x24')](function(_0x2be2c2){_0x2c45e6[_0x1944('0x40')]=_0x2be2c2;return _0x2c45e6;})[_0x1944('0x24')](respondWithFilteredResult(_0x3c4968,_0x1e5574))[_0x1944('0x41')](handleError(_0x3c4968,null));};exports[_0x1944('0x42')]=function(_0x396eca,_0x51c322){var _0x4db2c4={'raw':![],'where':{'id':_0x396eca['params']['id']}},_0x49aa2d={};_0x49aa2d[_0x1944('0x2f')]=_[_0x1944('0x43')](db[_0x1944('0x3c')]['rawAttributes']);_0x49aa2d[_0x1944('0x30')]=_[_0x1944('0x43')](_0x396eca['query']);_0x49aa2d[_0x1944('0x31')]=_[_0x1944('0x32')](_0x49aa2d[_0x1944('0x2f')],_0x49aa2d[_0x1944('0x30')]);_0x4db2c4[_0x1944('0x33')]=_[_0x1944('0x32')](_0x49aa2d[_0x1944('0x2f')],qs[_0x1944('0x34')](_0x396eca[_0x1944('0x30')][_0x1944('0x34')]));_0x4db2c4[_0x1944('0x33')]=_0x4db2c4[_0x1944('0x33')][_0x1944('0x44')]?_0x4db2c4[_0x1944('0x33')]:_0x49aa2d[_0x1944('0x2f')];if(_0x396eca[_0x1944('0x30')][_0x1944('0x3d')]){_0x4db2c4[_0x1944('0x3e')]=[{'all':!![]}];}_0x4db2c4=_[_0x1944('0x3a')]({},_0x4db2c4,_0x396eca[_0x1944('0x3b')]);return db[_0x1944('0x3c')]['find'](_0x4db2c4)[_0x1944('0x24')](handleEntityNotFound(_0x51c322,null))[_0x1944('0x24')](respondWithResult(_0x51c322,null))[_0x1944('0x41')](handleError(_0x51c322,null));};exports[_0x1944('0x45')]=function(_0x88b203,_0x211fb8){return db[_0x1944('0x3c')][_0x1944('0x45')](_0x88b203['body'],{})[_0x1944('0x24')](respondWithResult(_0x211fb8,0xc9))[_0x1944('0x41')](handleError(_0x211fb8,null));};exports[_0x1944('0x23')]=function(_0x4c990b,_0x5331e0){if(_0x4c990b[_0x1944('0x46')]['id']){delete _0x4c990b['body']['id'];}return db[_0x1944('0x3c')]['find']({'where':{'id':_0x4c990b['params']['id']}})[_0x1944('0x24')](handleEntityNotFound(_0x5331e0,null))['then'](saveUpdates(_0x4c990b[_0x1944('0x46')],null))['then'](respondWithResult(_0x5331e0,null))[_0x1944('0x41')](handleError(_0x5331e0,null));};exports[_0x1944('0x25')]=function(_0x4edb0b,_0x172241){return db['Automation']['find']({'where':{'id':_0x4edb0b[_0x1944('0x47')]['id']}})[_0x1944('0x24')](handleEntityNotFound(_0x172241,null))[_0x1944('0x24')](removeEntity(_0x172241,null))[_0x1944('0x41')](handleError(_0x172241,null));};exports[_0x1944('0x48')]=function(_0x17df75,_0x23c415,_0x488a8b){return db['Condition'][_0x1944('0x49')]({'where':{'id':_0x17df75[_0x1944('0x47')]['id']}})[_0x1944('0x24')](handleEntityNotFound(_0x23c415,null))['then'](function(_0x30141c){if(_0x30141c){return _0x30141c[_0x1944('0x48')](_0x17df75[_0x1944('0x46')][_0x1944('0x4a')],_[_0x1944('0x4b')](_0x17df75[_0x1944('0x46')],[_0x1944('0x4a'),'id'])||{});}})[_0x1944('0x24')](respondWithResult(_0x23c415,null))[_0x1944('0x41')](handleError(_0x23c415,null));};exports[_0x1944('0x4c')]=function(_0x4f443f,_0xc7b566,_0x1fcd38){var _0xfe79ea={};var _0x9de07c={};var _0x3b6992;var _0x10c817;return db['Automation']['findOne']({'where':{'id':_0x4f443f[_0x1944('0x47')]['id']}})[_0x1944('0x24')](handleEntityNotFound(_0xc7b566,null))[_0x1944('0x24')](function(_0x5631d1){if(_0x5631d1){_0x3b6992=_0x5631d1;_0x9de07c[_0x1944('0x2f')]=_[_0x1944('0x43')](db[_0x1944('0x4d')][_0x1944('0x2c')]);_0x9de07c[_0x1944('0x30')]=_[_0x1944('0x43')](_0x4f443f['query']);_0x9de07c[_0x1944('0x31')]=_[_0x1944('0x32')](_0x9de07c['model'],_0x9de07c['query']);_0xfe79ea['attributes']=_[_0x1944('0x32')](_0x9de07c[_0x1944('0x2f')],qs[_0x1944('0x34')](_0x4f443f[_0x1944('0x30')][_0x1944('0x34')]));_0xfe79ea[_0x1944('0x33')]=_0xfe79ea['attributes'][_0x1944('0x44')]?_0xfe79ea[_0x1944('0x33')]:_0x9de07c[_0x1944('0x2f')];_0xfe79ea[_0x1944('0x4e')]=qs['sort'](_0x4f443f['query'][_0x1944('0x37')]);_0xfe79ea[_0x1944('0x38')]=qs[_0x1944('0x31')](_['pick'](_0x4f443f[_0x1944('0x30')],_0x9de07c[_0x1944('0x31')]));if(_0x4f443f[_0x1944('0x30')][_0x1944('0x39')]){_0xfe79ea[_0x1944('0x38')]=_[_0x1944('0x3a')](_0xfe79ea[_0x1944('0x38')],{'$or':_[_0x1944('0x2b')](_0xfe79ea[_0x1944('0x33')],function(_0x464d20){var _0x26cbff={};_0x26cbff[_0x464d20]={'$like':'%'+_0x4f443f['query'][_0x1944('0x39')]+'%'};return _0x26cbff;})});}_0xfe79ea=_[_0x1944('0x3a')]({},_0xfe79ea,_0x4f443f['options']);return _0x3b6992[_0x1944('0x4c')](_0xfe79ea);}})[_0x1944('0x24')](function(_0x245ad9){if(_0x245ad9){_0x10c817=_0x245ad9[_0x1944('0x44')];if(!_0x4f443f[_0x1944('0x30')][_0x1944('0x35')](_0x1944('0x36'))){_0xfe79ea[_0x1944('0x1e')]=qs[_0x1944('0x1e')](_0x4f443f[_0x1944('0x30')][_0x1944('0x1e')]);_0xfe79ea[_0x1944('0x1d')]=qs[_0x1944('0x1d')](_0x4f443f[_0x1944('0x30')][_0x1944('0x1d')]);}return _0x3b6992[_0x1944('0x4c')](_0xfe79ea);}})[_0x1944('0x24')](function(_0x5338f8){if(_0x5338f8){return _0x5338f8?{'count':_0x10c817,'rows':_0x5338f8}:null;}})[_0x1944('0x24')](respondWithResult(_0xc7b566,null))[_0x1944('0x41')](handleError(_0xc7b566,null));};exports[_0x1944('0x4f')]=function(_0x1748d0,_0x504de4,_0x1def5a){return db['Action'][_0x1944('0x49')]({'where':{'id':_0x1748d0[_0x1944('0x47')]['id']}})['then'](handleEntityNotFound(_0x504de4,null))[_0x1944('0x24')](function(_0x43af2d){if(_0x43af2d){return _0x43af2d['addActions'](_0x1748d0[_0x1944('0x46')][_0x1944('0x4a')],_[_0x1944('0x4b')](_0x1748d0[_0x1944('0x46')],[_0x1944('0x4a'),'id'])||{});}})[_0x1944('0x24')](respondWithResult(_0x504de4,null))[_0x1944('0x41')](handleError(_0x504de4,null));};exports[_0x1944('0x50')]=function(_0x5ceb53,_0x3c2a4f,_0x2f30f0){var _0xa35480={};var _0x3b7b5b={};var _0x574139;var _0xcdac13;return db[_0x1944('0x3c')][_0x1944('0x51')]({'where':{'id':_0x5ceb53[_0x1944('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c2a4f,null))['then'](function(_0x2bebd0){if(_0x2bebd0){_0x574139=_0x2bebd0;_0x3b7b5b[_0x1944('0x2f')]=_['keys'](db[_0x1944('0x52')]['rawAttributes']);_0x3b7b5b[_0x1944('0x30')]=_[_0x1944('0x43')](_0x5ceb53['query']);_0x3b7b5b[_0x1944('0x31')]=_['intersection'](_0x3b7b5b[_0x1944('0x2f')],_0x3b7b5b[_0x1944('0x30')]);_0xa35480[_0x1944('0x33')]=_['intersection'](_0x3b7b5b[_0x1944('0x2f')],qs[_0x1944('0x34')](_0x5ceb53[_0x1944('0x30')][_0x1944('0x34')]));_0xa35480['attributes']=_0xa35480[_0x1944('0x33')][_0x1944('0x44')]?_0xa35480[_0x1944('0x33')]:_0x3b7b5b[_0x1944('0x2f')];_0xa35480[_0x1944('0x4e')]=qs[_0x1944('0x37')](_0x5ceb53[_0x1944('0x30')][_0x1944('0x37')]);_0xa35480[_0x1944('0x38')]=qs[_0x1944('0x31')](_[_0x1944('0x53')](_0x5ceb53[_0x1944('0x30')],_0x3b7b5b[_0x1944('0x31')]));if(_0x5ceb53[_0x1944('0x30')][_0x1944('0x39')]){_0xa35480[_0x1944('0x38')]=_[_0x1944('0x3a')](_0xa35480[_0x1944('0x38')],{'$or':_[_0x1944('0x2b')](_0xa35480[_0x1944('0x33')],function(_0x4a8106){var _0x88392={};_0x88392[_0x4a8106]={'$like':'%'+_0x5ceb53[_0x1944('0x30')]['filter']+'%'};return _0x88392;})});}_0xa35480=_[_0x1944('0x3a')]({},_0xa35480,_0x5ceb53[_0x1944('0x3b')]);return _0x574139[_0x1944('0x50')](_0xa35480);}})[_0x1944('0x24')](function(_0x4517a7){if(_0x4517a7){_0xcdac13=_0x4517a7[_0x1944('0x44')];if(!_0x5ceb53[_0x1944('0x30')][_0x1944('0x35')]('nolimit')){_0xa35480[_0x1944('0x1e')]=qs[_0x1944('0x1e')](_0x5ceb53[_0x1944('0x30')][_0x1944('0x1e')]);_0xa35480[_0x1944('0x1d')]=qs['offset'](_0x5ceb53[_0x1944('0x30')][_0x1944('0x1d')]);}return _0x574139[_0x1944('0x50')](_0xa35480);}})['then'](function(_0x41c0da){if(_0x41c0da){return _0x41c0da?{'count':_0xcdac13,'rows':_0x41c0da}:null;}})['then'](respondWithResult(_0x3c2a4f,null))[_0x1944('0x41')](handleError(_0x3c2a4f,null));}; \ No newline at end of file +var _0x770a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','send','index','map','Automation','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','Action','addActions','getActions','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x34be61,_0x1a036f){var _0x245301=function(_0x5dfdc2){while(--_0x5dfdc2){_0x34be61['push'](_0x34be61['shift']());}};_0x245301(++_0x1a036f);}(_0x770a,0x8f));var _0xa770=function(_0xc2529,_0x49ad1c){_0xc2529=_0xc2529-0x0;var _0x3fb932=_0x770a[_0xc2529];return _0x3fb932;};'use strict';var pdf=require(_0xa770('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa770('0x1'));var jsonpatch=require(_0xa770('0x2'));var rp=require(_0xa770('0x3'));var moment=require(_0xa770('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa770('0x5'));var util=require('util');var path=require(_0xa770('0x6'));var sox=require(_0xa770('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa770('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa770('0x9'));var toCsv=require(_0xa770('0xa'));var querystring=require(_0xa770('0xb'));var Papa=require(_0xa770('0xc'));var Redis=require(_0xa770('0xd'));var authService=require(_0xa770('0xe'));var qs=require(_0xa770('0xf'));var as=require(_0xa770('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa770('0x11'))(_0xa770('0x12'));var utils=require('../../config/utils');var config=require(_0xa770('0x13'));var db=require(_0xa770('0x14'))['db'];function respondWithStatusCode(_0x10190a,_0x10dc2d){_0x10dc2d=_0x10dc2d||0xcc;return function(_0x32b0df){if(_0x32b0df){return _0x10190a[_0xa770('0x15')](_0x10dc2d);}return _0x10190a[_0xa770('0x16')](_0x10dc2d)[_0xa770('0x17')]();};}function respondWithResult(_0x48d932,_0x3a013b){_0x3a013b=_0x3a013b||0xc8;return function(_0x472952){if(_0x472952){return _0x48d932[_0xa770('0x16')](_0x3a013b)[_0xa770('0x18')](_0x472952);}};}function respondWithFilteredResult(_0x52f840,_0x15ee29){return function(_0x2933d0){if(_0x2933d0){var _0x1653f2=_0x2933d0[_0xa770('0x19')],_0x59f0a0=_0x15ee29[_0xa770('0x1a')],_0x2f5986=_0x15ee29['offset']+_0x15ee29[_0xa770('0x1b')],_0x41efcf;if(_0x2f5986>=_0x1653f2){_0x2f5986=_0x1653f2;_0x41efcf=0xc8;}else{_0x41efcf=0xce;}_0x52f840['status'](_0x41efcf);return _0x52f840[_0xa770('0x1c')]('Content-Range',_0x59f0a0+'-'+_0x2f5986+'/'+_0x1653f2)[_0xa770('0x18')](_0x2933d0);}return null;};}function patchUpdates(_0x2f1978){return function(_0x555d1a){try{jsonpatch[_0xa770('0x1d')](_0x555d1a,_0x2f1978,!![]);}catch(_0x2d4ac4){return BPromise['reject'](_0x2d4ac4);}return _0x555d1a[_0xa770('0x1e')]();};}function saveUpdates(_0x1b06fc,_0x11a77d){return function(_0x1b4377){if(_0x1b4377){return _0x1b4377[_0xa770('0x1f')](_0x1b06fc)[_0xa770('0x20')](function(_0x5a1b1d){return _0x5a1b1d;});}return null;};}function removeEntity(_0x593378,_0x211ab6){return function(_0x4c248d){if(_0x4c248d){return _0x4c248d[_0xa770('0x21')]()[_0xa770('0x20')](function(){_0x593378[_0xa770('0x16')](0xcc)[_0xa770('0x17')]();});}};}function handleEntityNotFound(_0x2daf5f,_0x31079f){return function(_0x28f3c6){if(!_0x28f3c6){_0x2daf5f[_0xa770('0x15')](0x194);}return _0x28f3c6;};}function handleError(_0x128419,_0x1b747d){_0x1b747d=_0x1b747d||0x1f4;return function(_0x8132d5){logger[_0xa770('0x22')](_0x8132d5['stack']);if(_0x8132d5['name']){delete _0x8132d5['name'];}_0x128419['status'](_0x1b747d)[_0xa770('0x23')](_0x8132d5);};}exports[_0xa770('0x24')]=function(_0x57dc4b,_0x511a76){var _0x1cf44e={},_0x34c4e2={},_0x436cc3={'count':0x0,'rows':[]};var _0x36e869=_[_0xa770('0x25')](db[_0xa770('0x26')]['rawAttributes'],function(_0x228bde){return{'name':_0x228bde['fieldName'],'type':_0x228bde[_0xa770('0x27')][_0xa770('0x28')]};});_0x34c4e2[_0xa770('0x29')]=_['map'](_0x36e869,_0xa770('0x2a'));_0x34c4e2[_0xa770('0x2b')]=_[_0xa770('0x2c')](_0x57dc4b[_0xa770('0x2b')]);_0x34c4e2['filters']=_[_0xa770('0x2d')](_0x34c4e2[_0xa770('0x29')],_0x34c4e2[_0xa770('0x2b')]);_0x1cf44e[_0xa770('0x2e')]=_[_0xa770('0x2d')](_0x34c4e2[_0xa770('0x29')],qs[_0xa770('0x2f')](_0x57dc4b[_0xa770('0x2b')][_0xa770('0x2f')]));_0x1cf44e['attributes']=_0x1cf44e[_0xa770('0x2e')][_0xa770('0x30')]?_0x1cf44e[_0xa770('0x2e')]:_0x34c4e2[_0xa770('0x29')];if(!_0x57dc4b[_0xa770('0x2b')][_0xa770('0x31')](_0xa770('0x32'))){_0x1cf44e[_0xa770('0x1b')]=qs[_0xa770('0x1b')](_0x57dc4b[_0xa770('0x2b')][_0xa770('0x1b')]);_0x1cf44e[_0xa770('0x1a')]=qs[_0xa770('0x1a')](_0x57dc4b[_0xa770('0x2b')][_0xa770('0x1a')]);}_0x1cf44e[_0xa770('0x33')]=qs[_0xa770('0x34')](_0x57dc4b[_0xa770('0x2b')][_0xa770('0x34')]);_0x1cf44e[_0xa770('0x35')]=qs[_0xa770('0x36')](_[_0xa770('0x37')](_0x57dc4b[_0xa770('0x2b')],_0x34c4e2[_0xa770('0x36')]),_0x36e869);if(_0x57dc4b[_0xa770('0x2b')][_0xa770('0x38')]){_0x1cf44e[_0xa770('0x35')]=_[_0xa770('0x39')](_0x1cf44e[_0xa770('0x35')],{'$or':_[_0xa770('0x25')](_0x36e869,function(_0x1563ff){if(_0x1563ff['type']!==_0xa770('0x3a')){var _0x4680c1={};_0x4680c1[_0x1563ff[_0xa770('0x2a')]]={'$like':'%'+_0x57dc4b[_0xa770('0x2b')][_0xa770('0x38')]+'%'};return _0x4680c1;}})});}_0x1cf44e=_[_0xa770('0x39')]({},_0x1cf44e,_0x57dc4b[_0xa770('0x3b')]);var _0x495154={'where':_0x1cf44e[_0xa770('0x35')]};return db['Automation']['count'](_0x495154)[_0xa770('0x20')](function(_0x1c848f){_0x436cc3[_0xa770('0x19')]=_0x1c848f;if(_0x57dc4b[_0xa770('0x2b')][_0xa770('0x3c')]){_0x1cf44e['include']=[{'all':!![]}];}return db['Automation'][_0xa770('0x3d')](_0x1cf44e);})['then'](function(_0x283fa9){_0x436cc3[_0xa770('0x3e')]=_0x283fa9;return _0x436cc3;})[_0xa770('0x20')](respondWithFilteredResult(_0x511a76,_0x1cf44e))[_0xa770('0x3f')](handleError(_0x511a76,null));};exports['show']=function(_0x4a44ae,_0x2908db){var _0x3b64c4={'raw':![],'where':{'id':_0x4a44ae[_0xa770('0x40')]['id']}},_0x418d69={};_0x418d69[_0xa770('0x29')]=_[_0xa770('0x2c')](db['Automation'][_0xa770('0x41')]);_0x418d69[_0xa770('0x2b')]=_[_0xa770('0x2c')](_0x4a44ae[_0xa770('0x2b')]);_0x418d69['filters']=_['intersection'](_0x418d69['model'],_0x418d69[_0xa770('0x2b')]);_0x3b64c4[_0xa770('0x2e')]=_[_0xa770('0x2d')](_0x418d69[_0xa770('0x29')],qs[_0xa770('0x2f')](_0x4a44ae[_0xa770('0x2b')][_0xa770('0x2f')]));_0x3b64c4[_0xa770('0x2e')]=_0x3b64c4['attributes']['length']?_0x3b64c4[_0xa770('0x2e')]:_0x418d69[_0xa770('0x29')];if(_0x4a44ae[_0xa770('0x2b')]['includeAll']){_0x3b64c4[_0xa770('0x42')]=[{'all':!![]}];}_0x3b64c4=_[_0xa770('0x39')]({},_0x3b64c4,_0x4a44ae['options']);return db[_0xa770('0x26')][_0xa770('0x43')](_0x3b64c4)[_0xa770('0x20')](handleEntityNotFound(_0x2908db,null))[_0xa770('0x20')](respondWithResult(_0x2908db,null))['catch'](handleError(_0x2908db,null));};exports[_0xa770('0x44')]=function(_0x42f25a,_0x2d7adb){return db[_0xa770('0x26')]['create'](_0x42f25a[_0xa770('0x45')],{})[_0xa770('0x20')](respondWithResult(_0x2d7adb,0xc9))[_0xa770('0x3f')](handleError(_0x2d7adb,null));};exports[_0xa770('0x1f')]=function(_0x321e5d,_0x5921f8){if(_0x321e5d[_0xa770('0x45')]['id']){delete _0x321e5d['body']['id'];}return db['Automation'][_0xa770('0x43')]({'where':{'id':_0x321e5d[_0xa770('0x40')]['id']}})[_0xa770('0x20')](handleEntityNotFound(_0x5921f8,null))['then'](saveUpdates(_0x321e5d[_0xa770('0x45')],null))[_0xa770('0x20')](respondWithResult(_0x5921f8,null))[_0xa770('0x3f')](handleError(_0x5921f8,null));};exports[_0xa770('0x21')]=function(_0x11ede4,_0xe050e3){return db[_0xa770('0x26')][_0xa770('0x43')]({'where':{'id':_0x11ede4[_0xa770('0x40')]['id']}})['then'](handleEntityNotFound(_0xe050e3,null))[_0xa770('0x20')](removeEntity(_0xe050e3,null))[_0xa770('0x3f')](handleError(_0xe050e3,null));};exports[_0xa770('0x46')]=function(_0x2a2a94,_0x2274b1,_0x247052){return db[_0xa770('0x47')]['find']({'where':{'id':_0x2a2a94[_0xa770('0x40')]['id']}})[_0xa770('0x20')](handleEntityNotFound(_0x2274b1,null))[_0xa770('0x20')](function(_0x3fa8c8){if(_0x3fa8c8){return _0x3fa8c8[_0xa770('0x46')](_0x2a2a94[_0xa770('0x45')][_0xa770('0x48')],_[_0xa770('0x49')](_0x2a2a94[_0xa770('0x45')],[_0xa770('0x48'),'id'])||{});}})['then'](respondWithResult(_0x2274b1,null))[_0xa770('0x3f')](handleError(_0x2274b1,null));};exports['getConditions']=function(_0x98f9f7,_0x1a248d,_0xacbc06){var _0x279b2a={};var _0x4098b0={};var _0x3ccd7b;var _0x28d0a6;return db[_0xa770('0x26')][_0xa770('0x4a')]({'where':{'id':_0x98f9f7[_0xa770('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a248d,null))[_0xa770('0x20')](function(_0x3fe1f8){if(_0x3fe1f8){_0x3ccd7b=_0x3fe1f8;_0x4098b0['model']=_[_0xa770('0x2c')](db['Condition']['rawAttributes']);_0x4098b0['query']=_[_0xa770('0x2c')](_0x98f9f7['query']);_0x4098b0['filters']=_[_0xa770('0x2d')](_0x4098b0[_0xa770('0x29')],_0x4098b0[_0xa770('0x2b')]);_0x279b2a[_0xa770('0x2e')]=_[_0xa770('0x2d')](_0x4098b0['model'],qs[_0xa770('0x2f')](_0x98f9f7['query'][_0xa770('0x2f')]));_0x279b2a['attributes']=_0x279b2a[_0xa770('0x2e')][_0xa770('0x30')]?_0x279b2a[_0xa770('0x2e')]:_0x4098b0[_0xa770('0x29')];_0x279b2a['order']=qs['sort'](_0x98f9f7[_0xa770('0x2b')]['sort']);_0x279b2a['where']=qs[_0xa770('0x36')](_[_0xa770('0x37')](_0x98f9f7[_0xa770('0x2b')],_0x4098b0[_0xa770('0x36')]));if(_0x98f9f7[_0xa770('0x2b')][_0xa770('0x38')]){_0x279b2a[_0xa770('0x35')]=_[_0xa770('0x39')](_0x279b2a[_0xa770('0x35')],{'$or':_[_0xa770('0x25')](_0x279b2a[_0xa770('0x2e')],function(_0x4dd6f0){var _0x3be426={};_0x3be426[_0x4dd6f0]={'$like':'%'+_0x98f9f7[_0xa770('0x2b')][_0xa770('0x38')]+'%'};return _0x3be426;})});}_0x279b2a=_['merge']({},_0x279b2a,_0x98f9f7['options']);return _0x3ccd7b[_0xa770('0x4b')](_0x279b2a);}})[_0xa770('0x20')](function(_0x328d8d){if(_0x328d8d){_0x28d0a6=_0x328d8d[_0xa770('0x30')];if(!_0x98f9f7[_0xa770('0x2b')][_0xa770('0x31')](_0xa770('0x32'))){_0x279b2a['limit']=qs[_0xa770('0x1b')](_0x98f9f7[_0xa770('0x2b')]['limit']);_0x279b2a['offset']=qs['offset'](_0x98f9f7[_0xa770('0x2b')][_0xa770('0x1a')]);}return _0x3ccd7b[_0xa770('0x4b')](_0x279b2a);}})[_0xa770('0x20')](function(_0x161dee){if(_0x161dee){return _0x161dee?{'count':_0x28d0a6,'rows':_0x161dee}:null;}})[_0xa770('0x20')](respondWithResult(_0x1a248d,null))[_0xa770('0x3f')](handleError(_0x1a248d,null));};exports['addActions']=function(_0x2aeb93,_0x3f77fc,_0x10d0fb){return db[_0xa770('0x4c')]['find']({'where':{'id':_0x2aeb93[_0xa770('0x40')]['id']}})[_0xa770('0x20')](handleEntityNotFound(_0x3f77fc,null))['then'](function(_0xea0af7){if(_0xea0af7){return _0xea0af7[_0xa770('0x4d')](_0x2aeb93[_0xa770('0x45')][_0xa770('0x48')],_[_0xa770('0x49')](_0x2aeb93[_0xa770('0x45')],['ids','id'])||{});}})['then'](respondWithResult(_0x3f77fc,null))['catch'](handleError(_0x3f77fc,null));};exports['getActions']=function(_0x183c73,_0x2d48d0,_0x26e89b){var _0x364755={};var _0x4314fe={};var _0x41b108;var _0x17deb3;return db[_0xa770('0x26')]['findOne']({'where':{'id':_0x183c73[_0xa770('0x40')]['id']}})['then'](handleEntityNotFound(_0x2d48d0,null))[_0xa770('0x20')](function(_0x45c5bb){if(_0x45c5bb){_0x41b108=_0x45c5bb;_0x4314fe[_0xa770('0x29')]=_[_0xa770('0x2c')](db[_0xa770('0x4c')][_0xa770('0x41')]);_0x4314fe[_0xa770('0x2b')]=_['keys'](_0x183c73[_0xa770('0x2b')]);_0x4314fe[_0xa770('0x36')]=_['intersection'](_0x4314fe['model'],_0x4314fe[_0xa770('0x2b')]);_0x364755['attributes']=_['intersection'](_0x4314fe[_0xa770('0x29')],qs[_0xa770('0x2f')](_0x183c73[_0xa770('0x2b')][_0xa770('0x2f')]));_0x364755[_0xa770('0x2e')]=_0x364755[_0xa770('0x2e')][_0xa770('0x30')]?_0x364755[_0xa770('0x2e')]:_0x4314fe['model'];_0x364755[_0xa770('0x33')]=qs['sort'](_0x183c73[_0xa770('0x2b')][_0xa770('0x34')]);_0x364755[_0xa770('0x35')]=qs[_0xa770('0x36')](_['pick'](_0x183c73[_0xa770('0x2b')],_0x4314fe[_0xa770('0x36')]));if(_0x183c73['query'][_0xa770('0x38')]){_0x364755[_0xa770('0x35')]=_[_0xa770('0x39')](_0x364755[_0xa770('0x35')],{'$or':_[_0xa770('0x25')](_0x364755[_0xa770('0x2e')],function(_0xc07f5d){var _0x43da80={};_0x43da80[_0xc07f5d]={'$like':'%'+_0x183c73[_0xa770('0x2b')][_0xa770('0x38')]+'%'};return _0x43da80;})});}_0x364755=_[_0xa770('0x39')]({},_0x364755,_0x183c73[_0xa770('0x3b')]);return _0x41b108['getActions'](_0x364755);}})[_0xa770('0x20')](function(_0x37c016){if(_0x37c016){_0x17deb3=_0x37c016[_0xa770('0x30')];if(!_0x183c73[_0xa770('0x2b')][_0xa770('0x31')](_0xa770('0x32'))){_0x364755['limit']=qs[_0xa770('0x1b')](_0x183c73['query'][_0xa770('0x1b')]);_0x364755['offset']=qs[_0xa770('0x1a')](_0x183c73['query'][_0xa770('0x1a')]);}return _0x41b108[_0xa770('0x4e')](_0x364755);}})['then'](function(_0xd398d1){if(_0xd398d1){return _0xd398d1?{'count':_0x17deb3,'rows':_0xd398d1}:null;}})['then'](respondWithResult(_0x2d48d0,null))[_0xa770('0x3f')](handleError(_0x2d48d0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 9c11931..46d0c7d 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 _0xc859=['request-promise','path','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger','api','moment','bluebird'];(function(_0x8aec06,_0x3d5724){var _0x4c3613=function(_0x3c85da){while(--_0x3c85da){_0x8aec06['push'](_0x8aec06['shift']());}};_0x4c3613(++_0x3d5724);}(_0xc859,0x17b));var _0x9c85=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xc859[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x9c85('0x0'));var logger=require(_0x9c85('0x1'))(_0x9c85('0x2'));var moment=require(_0x9c85('0x3'));var BPromise=require(_0x9c85('0x4'));var rp=require(_0x9c85('0x5'));var fs=require('fs');var path=require(_0x9c85('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c85('0x7'));module[_0x9c85('0x8')]=function(_0x355518,_0x35c7af){return _0x355518[_0x9c85('0x9')](_0x9c85('0xa'),attributes,{'tableName':_0x9c85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a2=['rimraf','../../config/environment','define','tools_automations','api','moment','bluebird','path'];(function(_0x5d8804,_0x430429){var _0x1a4aeb=function(_0x10ae18){while(--_0x10ae18){_0x5d8804['push'](_0x5d8804['shift']());}};_0x1a4aeb(++_0x430429);}(_0xf9a2,0x124));var _0x2f9a=function(_0x15acc1,_0x55ea78){_0x15acc1=_0x15acc1-0x0;var _0x2f5599=_0xf9a2[_0x15acc1];return _0x2f5599;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2f9a('0x0'));var moment=require(_0x2f9a('0x1'));var BPromise=require(_0x2f9a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f9a('0x3'));var rimraf=require(_0x2f9a('0x4'));var config=require(_0x2f9a('0x5'));var attributes=require('./automation.attributes');module['exports']=function(_0x13decd,_0x3eb837){return _0x13decd[_0x2f9a('0x6')]('Automation',attributes,{'tableName':_0x2f9a('0x7'),'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 60a8161..547e762 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 _0xfba2=['catch','lodash','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5722ed,_0x2fb696){var _0x1b8933=function(_0x10a07b){while(--_0x10a07b){_0x5722ed['push'](_0x5722ed['shift']());}};_0x1b8933(++_0x2fb696);}(_0xfba2,0xbf));var _0x2fba=function(_0x25a778,_0x42d142){_0x25a778=_0x25a778-0x0;var _0x3abd14=_0xfba2[_0x25a778];return _0x3abd14;};'use strict';var _=require(_0x2fba('0x0'));var util=require('util');var moment=require(_0x2fba('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fba('0x2'))['db'];var utils=require(_0x2fba('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2fba('0x4'));var jayson=require(_0x2fba('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x133bfa,_0x1a370e,_0xa33432){return new BPromise(function(_0xfb9ff4,_0x28204c){return client[_0x2fba('0x6')](_0x133bfa,_0xa33432)[_0x2fba('0x7')](function(_0x175b29){logger[_0x2fba('0x8')](_0x2fba('0x9'),_0x1a370e,_0x2fba('0xa'));logger[_0x2fba('0xb')](_0x2fba('0xc'),_0x1a370e,_0x2fba('0xa'),JSON[_0x2fba('0xd')](_0x175b29));if(_0x175b29[_0x2fba('0xe')]){if(_0x175b29['error'][_0x2fba('0xf')]===0x1f4){logger[_0x2fba('0xe')](_0x2fba('0x9'),_0x1a370e,_0x175b29['error'][_0x2fba('0x10')]);return _0x28204c(_0x175b29[_0x2fba('0xe')][_0x2fba('0x10')]);}logger[_0x2fba('0xe')](_0x2fba('0x9'),_0x1a370e,_0x175b29[_0x2fba('0xe')]['message']);return _0xfb9ff4(_0x175b29[_0x2fba('0xe')]['message']);}else{logger['info'](_0x2fba('0x9'),_0x1a370e,'request\x20sent');_0xfb9ff4(_0x175b29[_0x2fba('0x11')][_0x2fba('0x10')]);}})[_0x2fba('0x12')](function(_0x115d5a){logger[_0x2fba('0xe')]('Automation,\x20%s,\x20%s',_0x1a370e,_0x115d5a);_0x28204c(_0x115d5a);});});} \ No newline at end of file +var _0xfe56=['result','catch','lodash','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e9764,_0x2c022f){var _0x431e3e=function(_0x5d1f68){while(--_0x5d1f68){_0x3e9764['push'](_0x3e9764['shift']());}};_0x431e3e(++_0x2c022f);}(_0xfe56,0x1d6));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6fe5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6fe5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe5('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6fe5('0x3'));var config=require(_0x6fe5('0x4'));var jayson=require(_0x6fe5('0x5'));var client=jayson[_0x6fe5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b77b1,_0x200633,_0x51c84f){return new BPromise(function(_0x2220b4,_0x510eca){return client[_0x6fe5('0x7')](_0x3b77b1,_0x51c84f)['then'](function(_0x494af7){logger[_0x6fe5('0x8')](_0x6fe5('0x9'),_0x200633,_0x6fe5('0xa'));logger['debug'](_0x6fe5('0xb'),_0x200633,_0x6fe5('0xa'),JSON[_0x6fe5('0xc')](_0x494af7));if(_0x494af7[_0x6fe5('0xd')]){if(_0x494af7['error'][_0x6fe5('0xe')]===0x1f4){logger[_0x6fe5('0xd')](_0x6fe5('0x9'),_0x200633,_0x494af7[_0x6fe5('0xd')]['message']);return _0x510eca(_0x494af7[_0x6fe5('0xd')]['message']);}logger[_0x6fe5('0xd')](_0x6fe5('0x9'),_0x200633,_0x494af7[_0x6fe5('0xd')][_0x6fe5('0xf')]);return _0x2220b4(_0x494af7[_0x6fe5('0xd')][_0x6fe5('0xf')]);}else{logger[_0x6fe5('0x8')](_0x6fe5('0x9'),_0x200633,'request\x20sent');_0x2220b4(_0x494af7[_0x6fe5('0x10')][_0x6fe5('0xf')]);}})[_0x6fe5('0x11')](function(_0x3de2f5){logger[_0x6fe5('0xd')]('Automation,\x20%s,\x20%s',_0x200633,_0x3de2f5);_0x510eca(_0x3de2f5);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6b8a711..bc69438 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 _0x8c06=['/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','getConditions','/:id/actions','getActions','post','create'];(function(_0x4c473c,_0x3048bd){var _0x3dea0f=function(_0x52337c){while(--_0x52337c){_0x4c473c['push'](_0x4c473c['shift']());}};_0x3dea0f(++_0x3048bd);}(_0x8c06,0x158));var _0x68c0=function(_0x210c92,_0x3ca7eb){_0x210c92=_0x210c92-0x0;var _0x1ceccc=_0x8c06[_0x210c92];return _0x1ceccc;};'use strict';var multer=require(_0x68c0('0x0'));var util=require(_0x68c0('0x1'));var path=require('path');var timeout=require(_0x68c0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x68c0('0x3'));var interaction=require(_0x68c0('0x4'));var config=require(_0x68c0('0x5'));var controller=require(_0x68c0('0x6'));router[_0x68c0('0x7')]('/',auth[_0x68c0('0x8')](),controller['index']);router[_0x68c0('0x7')](_0x68c0('0x9'),auth[_0x68c0('0x8')](),controller[_0x68c0('0xa')]);router[_0x68c0('0x7')]('/:id/conditions',auth[_0x68c0('0x8')](),controller[_0x68c0('0xb')]);router[_0x68c0('0x7')](_0x68c0('0xc'),auth[_0x68c0('0x8')](),controller[_0x68c0('0xd')]);router[_0x68c0('0xe')]('/',auth['isAuthenticated'](),controller[_0x68c0('0xf')]);router[_0x68c0('0xe')](_0x68c0('0x10'),auth[_0x68c0('0x8')](),controller[_0x68c0('0x11')]);router[_0x68c0('0xe')](_0x68c0('0xc'),auth[_0x68c0('0x8')](),controller[_0x68c0('0x12')]);router[_0x68c0('0x13')]('/:id',auth[_0x68c0('0x8')](),controller[_0x68c0('0x14')]);router[_0x68c0('0x15')]('/:id',auth[_0x68c0('0x8')](),controller[_0x68c0('0x16')]);module[_0x68c0('0x17')]=router; \ No newline at end of file +var _0x8a7b=['post','/:id/conditions','addConditions','addActions','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions'];(function(_0x454d07,_0x17aa08){var _0x4e0a61=function(_0x54dd3c){while(--_0x54dd3c){_0x454d07['push'](_0x454d07['shift']());}};_0x4e0a61(++_0x17aa08);}(_0x8a7b,0x188));var _0xb8a7=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0x8a7b[_0x4d3d50];return _0x175e6d;};'use strict';var multer=require(_0xb8a7('0x0'));var util=require(_0xb8a7('0x1'));var path=require('path');var timeout=require(_0xb8a7('0x2'));var express=require(_0xb8a7('0x3'));var router=express[_0xb8a7('0x4')]();var auth=require(_0xb8a7('0x5'));var interaction=require(_0xb8a7('0x6'));var config=require(_0xb8a7('0x7'));var controller=require(_0xb8a7('0x8'));router[_0xb8a7('0x9')]('/',auth[_0xb8a7('0xa')](),controller[_0xb8a7('0xb')]);router['get'](_0xb8a7('0xc'),auth[_0xb8a7('0xa')](),controller[_0xb8a7('0xd')]);router[_0xb8a7('0x9')]('/:id/conditions',auth[_0xb8a7('0xa')](),controller[_0xb8a7('0xe')]);router[_0xb8a7('0x9')](_0xb8a7('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0xb8a7('0x10')]('/',auth[_0xb8a7('0xa')](),controller['create']);router[_0xb8a7('0x10')](_0xb8a7('0x11'),auth['isAuthenticated'](),controller[_0xb8a7('0x12')]);router[_0xb8a7('0x10')](_0xb8a7('0xf'),auth[_0xb8a7('0xa')](),controller[_0xb8a7('0x13')]);router['put'](_0xb8a7('0xc'),auth[_0xb8a7('0xa')](),controller[_0xb8a7('0x14')]);router[_0xb8a7('0x15')](_0xb8a7('0xc'),auth[_0xb8a7('0xa')](),controller[_0xb8a7('0x16')]);module[_0xb8a7('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 803b231..c370a0b 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 _0xb125=['ENUM','DESC','ASC','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x403282,_0x39ab19){var _0x41f290=function(_0x34f4c0){while(--_0x34f4c0){_0x403282['push'](_0x403282['shift']());}};_0x41f290(++_0x39ab19);}(_0xb125,0x77));var _0x5b12=function(_0x197a3d,_0x1af6b0){_0x197a3d=_0x197a3d-0x0;var _0x4f8ccd=_0xb125[_0x197a3d];return _0x4f8ccd;};'use strict';var Sequelize=require(_0x5b12('0x0'));module[_0x5b12('0x1')]={'name':{'type':Sequelize[_0x5b12('0x2')],'unique':_0x5b12('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5b12('0x4')),'allowNull':![],'defaultValue':_0x5b12('0x4')},'description':{'type':Sequelize[_0x5b12('0x2')]},'active':{'type':Sequelize[_0x5b12('0x5')],'defaultValue':0x0,'comment':_0x5b12('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5b12('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5b12('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5b12('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5b12('0x9')](0x3)[_0x5b12('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b12('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5b12('0x9')](0x3)[_0x5b12('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b12('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5b12('0x9')](0x5)[_0x5b12('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b12('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x5b12('0x9')](0x3)[_0x5b12('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b12('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b12('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5b12('0x9')](0x3)[_0x5b12('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5b12('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b12('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5b12('0x9')](0x3)[_0x5b12('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5b12('0xf')},'dialTimezone':{'type':Sequelize[_0x5b12('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5b12('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x5b12('0x10')),'defaultValue':_0x5b12('0x11')},'dialAMDActive':{'type':Sequelize[_0x5b12('0x5')],'defaultValue':0x0,'comment':_0x5b12('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x5b12('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5b12('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x5b12('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5b12('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5b12('0x9')](0x9)[_0x5b12('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5b12('0x9')](0x9)[_0x5b12('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5b12('0x9')](0x9)[_0x5b12('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5b12('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5b12('0x9')](0x9)[_0x5b12('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5b12('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5b12('0x9')](0x9)[_0x5b12('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5b12('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5b12('0x9')](0x5)[_0x5b12('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5b12('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5b12('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b12('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5b12('0x1a')](_0x5b12('0x1b'),_0x5b12('0x1c')),'defaultValue':_0x5b12('0x1b')},'dialPrefix':{'type':Sequelize[_0x5b12('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5b12('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x5b12('0x9')](0x3)[_0x5b12('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'}}; \ No newline at end of file +var _0x2b29=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length'];(function(_0x4bcd6b,_0x3d646b){var _0x2a28e9=function(_0xc8b8f8){while(--_0xc8b8f8){_0x4bcd6b['push'](_0x4bcd6b['shift']());}};_0x2a28e9(++_0x3d646b);}(_0x2b29,0x16f));var _0x92b2=function(_0x45d80e,_0x372213){_0x45d80e=_0x45d80e-0x0;var _0x59c93a=_0x2b29[_0x45d80e];return _0x59c93a;};'use strict';var Sequelize=require('sequelize');module[_0x92b2('0x0')]={'name':{'type':Sequelize[_0x92b2('0x1')],'unique':_0x92b2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x92b2('0x3')](_0x92b2('0x4')),'allowNull':![],'defaultValue':_0x92b2('0x4')},'description':{'type':Sequelize[_0x92b2('0x1')]},'active':{'type':Sequelize[_0x92b2('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x92b2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x92b2('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x92b2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x92b2('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x92b2('0x8')](0x3)[_0x92b2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x92b2('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x92b2('0x8')](0x3)[_0x92b2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x92b2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x92b2('0x8')](0x5)[_0x92b2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x92b2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x92b2('0x8')](0x3)[_0x92b2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x92b2('0x8')](0x5)[_0x92b2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x92b2('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x92b2('0x8')](0x3)[_0x92b2('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x92b2('0x8')](0x5)[_0x92b2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x92b2('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x92b2('0x8')](0x3)[_0x92b2('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x92b2('0xe')},'dialTimezone':{'type':Sequelize[_0x92b2('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x92b2('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x92b2('0x3')](_0x92b2('0x10'),_0x92b2('0x11'),_0x92b2('0x12')),'defaultValue':_0x92b2('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x92b2('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x92b2('0x8')](0x9)[_0x92b2('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x92b2('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x92b2('0x8')](0x9)[_0x92b2('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x92b2('0x8')](0x9)[_0x92b2('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x92b2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x92b2('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x92b2('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x92b2('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x92b2('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x92b2('0x8')](0x9)[_0x92b2('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x92b2('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x92b2('0x8')](0x5)[_0x92b2('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x92b2('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x92b2('0x8')](0x9)[_0x92b2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x92b2('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x92b2('0x1b'),_0x92b2('0x1c')),'defaultValue':_0x92b2('0x1b')},'dialPrefix':{'type':Sequelize[_0x92b2('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x92b2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x92b2('0x1d')},'dialCutDigit':{'type':Sequelize[_0x92b2('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 715141a..e45029b 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 _0xf5e8=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','Campaign','includeAll','catch','show','include','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','update','getHoppers','findOne','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','insert','ListId','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','push','sequelize','removeLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xf5e8,0xfa));var _0x8f5e=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xf5e8[_0x257b0e];return _0x27ac2a;};'use strict';var pdf=require(_0x8f5e('0x0'));var emlformat=require(_0x8f5e('0x1'));var rimraf=require(_0x8f5e('0x2'));var zipdir=require(_0x8f5e('0x3'));var jsonpatch=require(_0x8f5e('0x4'));var rp=require('request-promise');var moment=require(_0x8f5e('0x5'));var BPromise=require(_0x8f5e('0x6'));var Mustache=require('mustache');var util=require(_0x8f5e('0x7'));var path=require(_0x8f5e('0x8'));var sox=require(_0x8f5e('0x9'));var csv=require(_0x8f5e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8f5e('0xb'));var crypto=require(_0x8f5e('0xc'));var jsforce=require(_0x8f5e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8f5e('0xa'));var querystring=require(_0x8f5e('0xe'));var Papa=require(_0x8f5e('0xf'));var Redis=require(_0x8f5e('0x10'));var authService=require(_0x8f5e('0x11'));var qs=require(_0x8f5e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f5e('0x13'));var logger=require(_0x8f5e('0x14'))(_0x8f5e('0x15'));var utils=require(_0x8f5e('0x16'));var config=require(_0x8f5e('0x17'));var db=require(_0x8f5e('0x18'))['db'];function respondWithStatusCode(_0x13fb2b,_0x44b8fe){_0x44b8fe=_0x44b8fe||0xcc;return function(_0x516c04){if(_0x516c04){return _0x13fb2b[_0x8f5e('0x19')](_0x44b8fe);}return _0x13fb2b[_0x8f5e('0x1a')](_0x44b8fe)[_0x8f5e('0x1b')]();};}function respondWithResult(_0x13cfe1,_0x3879ad){_0x3879ad=_0x3879ad||0xc8;return function(_0x4cc268){if(_0x4cc268){return _0x13cfe1[_0x8f5e('0x1a')](_0x3879ad)[_0x8f5e('0x1c')](_0x4cc268);}};}function respondWithFilteredResult(_0x21f48e,_0x1a297e){return function(_0x3efc37){if(_0x3efc37){var _0x40dae1=_0x3efc37[_0x8f5e('0x1d')],_0x48c72a=_0x1a297e[_0x8f5e('0x1e')],_0x2feb82=_0x1a297e[_0x8f5e('0x1e')]+_0x1a297e[_0x8f5e('0x1f')],_0x59b585;if(_0x2feb82>=_0x40dae1){_0x2feb82=_0x40dae1;_0x59b585=0xc8;}else{_0x59b585=0xce;}_0x21f48e['status'](_0x59b585);return _0x21f48e['set'](_0x8f5e('0x20'),_0x48c72a+'-'+_0x2feb82+'/'+_0x40dae1)[_0x8f5e('0x1c')](_0x3efc37);}return null;};}function patchUpdates(_0x3f707a){return function(_0x436465){try{jsonpatch[_0x8f5e('0x21')](_0x436465,_0x3f707a,!![]);}catch(_0x1b6750){return BPromise['reject'](_0x1b6750);}return _0x436465[_0x8f5e('0x22')]();};}function saveUpdates(_0x214084,_0x1322d8){return function(_0x5105fa){if(_0x5105fa){return _0x5105fa['update'](_0x214084)[_0x8f5e('0x23')](function(_0x561b25){return _0x561b25;});}return null;};}function removeEntity(_0x123c9b,_0x53c3dc){return function(_0x1488f0){if(_0x1488f0){return _0x1488f0[_0x8f5e('0x24')]()[_0x8f5e('0x23')](function(){var _0x2fdcda=_0x1488f0[_0x8f5e('0x25')]({'plain':!![]});var _0x3a2d60=_0x8f5e('0x26');return db[_0x8f5e('0x27')][_0x8f5e('0x24')]({'where':{'type':_0x3a2d60,'resourceId':_0x2fdcda['id']}})[_0x8f5e('0x23')](function(){return _0x1488f0;});})[_0x8f5e('0x23')](function(){_0x123c9b[_0x8f5e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2a58,_0x47cef3){return function(_0x51adf5){if(!_0x51adf5){_0x5b2a58['sendStatus'](0x194);}return _0x51adf5;};}function handleError(_0x17e7c0,_0x2c3ea8){_0x2c3ea8=_0x2c3ea8||0x1f4;return function(_0x24c75b){logger[_0x8f5e('0x28')](_0x24c75b[_0x8f5e('0x29')]);if(_0x24c75b[_0x8f5e('0x2a')]){delete _0x24c75b[_0x8f5e('0x2a')];}_0x17e7c0[_0x8f5e('0x1a')](_0x2c3ea8)['send'](_0x24c75b);};}exports[_0x8f5e('0x2b')]=function(_0x498e5d,_0x42d76f){var _0x21a301={},_0x1a0b72={},_0x2430e5={'count':0x0,'rows':[]};var _0x34359f=_[_0x8f5e('0x2c')](db['Campaign'][_0x8f5e('0x2d')],function(_0x1f6a74){return{'name':_0x1f6a74[_0x8f5e('0x2e')],'type':_0x1f6a74[_0x8f5e('0x2f')][_0x8f5e('0x30')]};});_0x1a0b72['model']=_['map'](_0x34359f,'name');_0x1a0b72[_0x8f5e('0x31')]=_[_0x8f5e('0x32')](_0x498e5d[_0x8f5e('0x31')]);_0x1a0b72[_0x8f5e('0x33')]=_[_0x8f5e('0x34')](_0x1a0b72[_0x8f5e('0x35')],_0x1a0b72[_0x8f5e('0x31')]);_0x21a301[_0x8f5e('0x36')]=_['intersection'](_0x1a0b72[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x37')]));_0x21a301[_0x8f5e('0x36')]=_0x21a301[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0x21a301[_0x8f5e('0x36')]:_0x1a0b72[_0x8f5e('0x35')];if(!_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x39')](_0x8f5e('0x3a'))){_0x21a301['limit']=qs[_0x8f5e('0x1f')](_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x1f')]);_0x21a301[_0x8f5e('0x1e')]=qs[_0x8f5e('0x1e')](_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x1e')]);}_0x21a301[_0x8f5e('0x3b')]=qs[_0x8f5e('0x3c')](_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x3c')]);_0x21a301['where']=qs[_0x8f5e('0x33')](_[_0x8f5e('0x3d')](_0x498e5d[_0x8f5e('0x31')],_0x1a0b72[_0x8f5e('0x33')]),_0x34359f);if(_0x498e5d[_0x8f5e('0x31')]['filter']){_0x21a301[_0x8f5e('0x3e')]=_[_0x8f5e('0x3f')](_0x21a301[_0x8f5e('0x3e')],{'$or':_[_0x8f5e('0x2c')](_0x34359f,function(_0x1c57e8){if(_0x1c57e8[_0x8f5e('0x2f')]!==_0x8f5e('0x40')){var _0x318cbb={};_0x318cbb[_0x1c57e8['name']]={'$like':'%'+_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x41')]+'%'};return _0x318cbb;}})});}_0x21a301=_[_0x8f5e('0x3f')]({},_0x21a301,_0x498e5d[_0x8f5e('0x42')]);var _0x2a007f={'where':_0x21a301[_0x8f5e('0x3e')]};return db[_0x8f5e('0x43')][_0x8f5e('0x1d')](_0x2a007f)[_0x8f5e('0x23')](function(_0x4adf87){_0x2430e5[_0x8f5e('0x1d')]=_0x4adf87;if(_0x498e5d[_0x8f5e('0x31')][_0x8f5e('0x44')]){_0x21a301['include']=[{'all':!![]}];}return db[_0x8f5e('0x43')]['findAll'](_0x21a301);})[_0x8f5e('0x23')](function(_0x42dae0){_0x2430e5['rows']=_0x42dae0;return _0x2430e5;})[_0x8f5e('0x23')](respondWithFilteredResult(_0x42d76f,_0x21a301))[_0x8f5e('0x45')](handleError(_0x42d76f,null));};exports[_0x8f5e('0x46')]=function(_0x41729c,_0x57e12c){var _0x26eebd={'raw':![],'where':{'id':_0x41729c['params']['id']}},_0x17f346={};_0x17f346['model']=_['keys'](db[_0x8f5e('0x43')][_0x8f5e('0x2d')]);_0x17f346[_0x8f5e('0x31')]=_['keys'](_0x41729c[_0x8f5e('0x31')]);_0x17f346[_0x8f5e('0x33')]=_[_0x8f5e('0x34')](_0x17f346['model'],_0x17f346['query']);_0x26eebd[_0x8f5e('0x36')]=_['intersection'](_0x17f346['model'],qs['fields'](_0x41729c[_0x8f5e('0x31')]['fields']));_0x26eebd[_0x8f5e('0x36')]=_0x26eebd[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0x26eebd['attributes']:_0x17f346[_0x8f5e('0x35')];if(_0x41729c[_0x8f5e('0x31')]['includeAll']){_0x26eebd[_0x8f5e('0x47')]=[{'all':!![]}];}_0x26eebd=_['merge']({},_0x26eebd,_0x41729c[_0x8f5e('0x42')]);return db['Campaign'][_0x8f5e('0x48')](_0x26eebd)[_0x8f5e('0x23')](handleEntityNotFound(_0x57e12c,null))['then'](respondWithResult(_0x57e12c,null))[_0x8f5e('0x45')](handleError(_0x57e12c,null));};exports[_0x8f5e('0x49')]=function(_0x5c572b,_0x4e7aee){return db[_0x8f5e('0x43')][_0x8f5e('0x49')](_0x5c572b[_0x8f5e('0x4a')],{})[_0x8f5e('0x23')](function(_0x38b27d){var _0x51e385=_0x5c572b['user'][_0x8f5e('0x25')]({'plain':!![]});if(!_0x51e385)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51e385[_0x8f5e('0x4b')]==='user'){var _0x3d0a58=_0x38b27d[_0x8f5e('0x25')]({'plain':!![]});var _0x17d3b3=_0x8f5e('0x26');return db[_0x8f5e('0x4c')][_0x8f5e('0x48')]({'where':{'name':_0x17d3b3,'userProfileId':_0x51e385[_0x8f5e('0x4d')]},'raw':!![]})[_0x8f5e('0x23')](function(_0x3a73a1){if(_0x3a73a1&&_0x3a73a1[_0x8f5e('0x4e')]===0x0){return db[_0x8f5e('0x27')]['create']({'name':_0x3d0a58[_0x8f5e('0x2a')],'resourceId':_0x3d0a58['id'],'type':_0x3a73a1['name'],'sectionId':_0x3a73a1['id']},{})[_0x8f5e('0x23')](function(){return _0x38b27d;});}else{return _0x38b27d;}})[_0x8f5e('0x45')](function(_0x1a2b18){logger[_0x8f5e('0x28')](_0x8f5e('0x4f'),_0x1a2b18);throw _0x1a2b18;});}return _0x38b27d;})[_0x8f5e('0x23')](respondWithResult(_0x4e7aee,0xc9))['catch'](handleError(_0x4e7aee,null));};exports[_0x8f5e('0x50')]=function(_0x442dcc,_0x261d2e){var _0xdef78f={'where':{'id':_0x442dcc[_0x8f5e('0x51')]['id']}},_0x543c0b={};_0x543c0b[_0x8f5e('0x35')]=_[_0x8f5e('0x32')](db[_0x8f5e('0x43')][_0x8f5e('0x2d')]);_0xdef78f[_0x8f5e('0x36')]=_[_0x8f5e('0x34')](_0x543c0b[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0x442dcc['query'][_0x8f5e('0x37')]));_0xdef78f['attributes']=_0xdef78f[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0xdef78f[_0x8f5e('0x36')]:_0x543c0b[_0x8f5e('0x35')];if(_0x442dcc['query'][_0x8f5e('0x44')]){_0xdef78f[_0x8f5e('0x47')]=[{'all':!![]}];}_0xdef78f=_[_0x8f5e('0x3f')]({},_0xdef78f,_0x442dcc[_0x8f5e('0x42')]);return db[_0x8f5e('0x43')][_0x8f5e('0x48')](_0xdef78f)[_0x8f5e('0x23')](handleEntityNotFound(_0x261d2e,null))[_0x8f5e('0x23')](function(_0x25f3dd){if(_0x25f3dd){var _0x51acc0=_0x25f3dd[_0x8f5e('0x25')]({'plain':!![]});_0x51acc0=qs['omit'](_0x51acc0,['id','createdAt',_0x8f5e('0x52')]);_0x442dcc[_0x8f5e('0x4a')]=_[_0x8f5e('0x53')](_0x442dcc[_0x8f5e('0x4a')],['id',_0x8f5e('0x54'),_0x8f5e('0x52')]);return db[_0x8f5e('0x43')][_0x8f5e('0x49')](_[_0x8f5e('0x3f')](_0x51acc0,_0x442dcc['body']),{'include':_0x442dcc[_0x8f5e('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x8f5e('0x23')](function(_0x4d808a){var _0x459393=_0x442dcc['user'][_0x8f5e('0x25')]({'plain':!![]});if(!_0x459393)throw new Error(_0x8f5e('0x55'));if(_0x459393['role']===_0x8f5e('0x56')){var _0x49064c=_0x4d808a[_0x8f5e('0x25')]({'plain':!![]});var _0x1f2ebb=_0x8f5e('0x26');return db[_0x8f5e('0x4c')][_0x8f5e('0x48')]({'where':{'name':_0x1f2ebb,'userProfileId':_0x459393[_0x8f5e('0x4d')]},'raw':!![]})[_0x8f5e('0x23')](function(_0xaaf841){if(_0xaaf841&&_0xaaf841['autoAssociation']===0x0){return db[_0x8f5e('0x27')][_0x8f5e('0x49')]({'name':_0x49064c[_0x8f5e('0x2a')],'resourceId':_0x49064c['id'],'type':_0xaaf841[_0x8f5e('0x2a')],'sectionId':_0xaaf841['id']},{})[_0x8f5e('0x23')](function(){return _0x4d808a;});}else{return _0x4d808a;}})[_0x8f5e('0x45')](function(_0x3e8a37){logger[_0x8f5e('0x28')](_0x8f5e('0x4f'),_0x3e8a37);throw _0x3e8a37;});}return _0x4d808a;});}})[_0x8f5e('0x23')](respondWithResult(_0x261d2e,0xc9))[_0x8f5e('0x45')](handleError(_0x261d2e,null));};exports[_0x8f5e('0x57')]=function(_0x3c4c3d,_0x303602){if(_0x3c4c3d[_0x8f5e('0x4a')]['id']){delete _0x3c4c3d[_0x8f5e('0x4a')]['id'];}return db[_0x8f5e('0x43')][_0x8f5e('0x48')]({'where':{'id':_0x3c4c3d[_0x8f5e('0x51')]['id']}})['then'](handleEntityNotFound(_0x303602,null))[_0x8f5e('0x23')](saveUpdates(_0x3c4c3d[_0x8f5e('0x4a')],null))['then'](respondWithResult(_0x303602,null))[_0x8f5e('0x45')](handleError(_0x303602,null));};exports[_0x8f5e('0x24')]=function(_0x4a2659,_0x4439e1){return db[_0x8f5e('0x43')][_0x8f5e('0x48')]({'where':{'id':_0x4a2659[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x4439e1,null))[_0x8f5e('0x23')](removeEntity(_0x4439e1,null))[_0x8f5e('0x45')](handleError(_0x4439e1,null));};exports[_0x8f5e('0x58')]=function(_0x110742,_0x51fa6b,_0x5816e4){var _0xb9523d={'raw':!![],'where':{}};var _0x5b50a8={};var _0x26c32e={'count':0x0,'rows':[]};return db[_0x8f5e('0x43')][_0x8f5e('0x59')]({'where':{'id':_0x110742[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x51fa6b,null))[_0x8f5e('0x23')](function(_0x42b3c1){if(_0x42b3c1){_0x5b50a8[_0x8f5e('0x35')]=_[_0x8f5e('0x32')](db[_0x8f5e('0x5a')][_0x8f5e('0x2d')]);_0x5b50a8[_0x8f5e('0x31')]=_['keys'](_0x110742[_0x8f5e('0x31')]);_0x5b50a8[_0x8f5e('0x33')]=_[_0x8f5e('0x34')](_0x5b50a8[_0x8f5e('0x35')],_0x5b50a8[_0x8f5e('0x31')]);_0xb9523d[_0x8f5e('0x36')]=_['intersection'](_0x5b50a8[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0x110742[_0x8f5e('0x31')][_0x8f5e('0x37')]));_0xb9523d[_0x8f5e('0x36')]=_0xb9523d[_0x8f5e('0x36')]['length']?_0xb9523d[_0x8f5e('0x36')]:_0x5b50a8[_0x8f5e('0x35')];if(!_0x110742['query'][_0x8f5e('0x39')](_0x8f5e('0x3a'))){_0xb9523d[_0x8f5e('0x1f')]=qs[_0x8f5e('0x1f')](_0x110742[_0x8f5e('0x31')][_0x8f5e('0x1f')]);_0xb9523d['offset']=qs['offset'](_0x110742['query']['offset']);}_0xb9523d[_0x8f5e('0x3b')]=qs['sort'](_0x110742['query']['sort']);_0xb9523d['where']=qs[_0x8f5e('0x33')](_['pick'](_0x110742['query'],_0x5b50a8[_0x8f5e('0x33')]));_0xb9523d[_0x8f5e('0x3e')]['CampaignId']=_0x42b3c1['id'];if(_0x110742[_0x8f5e('0x31')][_0x8f5e('0x41')]){_0xb9523d[_0x8f5e('0x3e')]=_['merge'](_0xb9523d[_0x8f5e('0x3e')],{'$or':_[_0x8f5e('0x2c')](_0xb9523d[_0x8f5e('0x36')],function(_0x79baba){var _0x4130e9={};_0x4130e9[_0x79baba]={'$like':'%'+_0x110742['query'][_0x8f5e('0x41')]+'%'};return _0x4130e9;})});}_0xb9523d=_[_0x8f5e('0x3f')]({},_0xb9523d,_0x110742[_0x8f5e('0x42')]);return db[_0x8f5e('0x5a')][_0x8f5e('0x1d')]({'where':_0xb9523d[_0x8f5e('0x3e')]})[_0x8f5e('0x23')](function(_0x48953e){_0x26c32e[_0x8f5e('0x1d')]=_0x48953e;if(_0x110742['query'][_0x8f5e('0x44')]){_0xb9523d[_0x8f5e('0x47')]=[{'all':!![]}];}return db[_0x8f5e('0x5a')][_0x8f5e('0x5b')](_0xb9523d);})[_0x8f5e('0x23')](function(_0x5f1b41){_0x26c32e[_0x8f5e('0x5c')]=_0x5f1b41;return _0x26c32e;});}})['then'](respondWithFilteredResult(_0x51fa6b,_0xb9523d))['catch'](handleError(_0x51fa6b,null));};exports[_0x8f5e('0x5d')]=function(_0x5e1b8e,_0x44c1b7,_0x277d73){var _0x5640cb={'raw':!![],'where':{}};var _0xf9b1b5={};var _0x58d832={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x5e1b8e[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x44c1b7,null))[_0x8f5e('0x23')](function(_0x5b13f9){if(_0x5b13f9){_0xf9b1b5['model']=_['keys'](db['CmHopperHistory'][_0x8f5e('0x2d')]);_0xf9b1b5[_0x8f5e('0x31')]=_[_0x8f5e('0x32')](_0x5e1b8e['query']);_0xf9b1b5['filters']=_[_0x8f5e('0x34')](_0xf9b1b5[_0x8f5e('0x35')],_0xf9b1b5[_0x8f5e('0x31')]);_0x5640cb['attributes']=_[_0x8f5e('0x34')](_0xf9b1b5[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0x5e1b8e[_0x8f5e('0x31')]['fields']));_0x5640cb[_0x8f5e('0x36')]=_0x5640cb[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0x5640cb['attributes']:_0xf9b1b5[_0x8f5e('0x35')];if(!_0x5e1b8e['query'][_0x8f5e('0x39')](_0x8f5e('0x3a'))){_0x5640cb[_0x8f5e('0x1f')]=qs['limit'](_0x5e1b8e['query']['limit']);_0x5640cb['offset']=qs[_0x8f5e('0x1e')](_0x5e1b8e[_0x8f5e('0x31')]['offset']);}_0x5640cb[_0x8f5e('0x3b')]=qs[_0x8f5e('0x3c')](_0x5e1b8e[_0x8f5e('0x31')]['sort']);_0x5640cb[_0x8f5e('0x3e')]=qs[_0x8f5e('0x33')](_[_0x8f5e('0x3d')](_0x5e1b8e['query'],_0xf9b1b5[_0x8f5e('0x33')]));_0x5640cb[_0x8f5e('0x3e')]['CampaignId']=_0x5b13f9['id'];if(_0x5e1b8e[_0x8f5e('0x31')][_0x8f5e('0x41')]){_0x5640cb[_0x8f5e('0x3e')]=_[_0x8f5e('0x3f')](_0x5640cb[_0x8f5e('0x3e')],{'$or':_['map'](_0x5640cb[_0x8f5e('0x36')],function(_0x5e7c2f){var _0x18c5f2={};_0x18c5f2[_0x5e7c2f]={'$like':'%'+_0x5e1b8e[_0x8f5e('0x31')][_0x8f5e('0x41')]+'%'};return _0x18c5f2;})});}_0x5640cb=_[_0x8f5e('0x3f')]({},_0x5640cb,_0x5e1b8e['options']);return db[_0x8f5e('0x5e')][_0x8f5e('0x1d')]({'where':_0x5640cb[_0x8f5e('0x3e')]})['then'](function(_0x35f3b2){_0x58d832[_0x8f5e('0x1d')]=_0x35f3b2;if(_0x5e1b8e[_0x8f5e('0x31')][_0x8f5e('0x44')]){_0x5640cb[_0x8f5e('0x47')]=[{'all':!![]}];}return db[_0x8f5e('0x5e')][_0x8f5e('0x5b')](_0x5640cb);})[_0x8f5e('0x23')](function(_0x2531a1){_0x58d832[_0x8f5e('0x5c')]=_0x2531a1;return _0x58d832;});}})[_0x8f5e('0x23')](respondWithFilteredResult(_0x44c1b7,_0x5640cb))[_0x8f5e('0x45')](handleError(_0x44c1b7,null));};exports['getHopperFinals']=function(_0xf7538e,_0x154078,_0x3e105a){var _0x3d05ee={'raw':!![],'where':{}};var _0x2f7f53={};var _0x16f302={'count':0x0,'rows':[]};return db[_0x8f5e('0x43')][_0x8f5e('0x59')]({'where':{'id':_0xf7538e[_0x8f5e('0x51')]['id']}})['then'](handleEntityNotFound(_0x154078,null))['then'](function(_0xbd6915){if(_0xbd6915){_0x2f7f53[_0x8f5e('0x35')]=_[_0x8f5e('0x32')](db['CmHopperFinal'][_0x8f5e('0x2d')]);_0x2f7f53['query']=_[_0x8f5e('0x32')](_0xf7538e[_0x8f5e('0x31')]);_0x2f7f53['filters']=_[_0x8f5e('0x34')](_0x2f7f53[_0x8f5e('0x35')],_0x2f7f53[_0x8f5e('0x31')]);_0x3d05ee[_0x8f5e('0x36')]=_[_0x8f5e('0x34')](_0x2f7f53[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x37')]));_0x3d05ee[_0x8f5e('0x36')]=_0x3d05ee[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0x3d05ee['attributes']:_0x2f7f53['model'];if(!_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x39')](_0x8f5e('0x3a'))){_0x3d05ee[_0x8f5e('0x1f')]=qs[_0x8f5e('0x1f')](_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x1f')]);_0x3d05ee[_0x8f5e('0x1e')]=qs[_0x8f5e('0x1e')](_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x1e')]);}_0x3d05ee[_0x8f5e('0x3b')]=qs[_0x8f5e('0x3c')](_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x3c')]);_0x3d05ee['where']=qs[_0x8f5e('0x33')](_[_0x8f5e('0x3d')](_0xf7538e[_0x8f5e('0x31')],_0x2f7f53[_0x8f5e('0x33')]));_0x3d05ee[_0x8f5e('0x3e')][_0x8f5e('0x5f')]=_0xbd6915['id'];if(_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x41')]){_0x3d05ee[_0x8f5e('0x3e')]=_[_0x8f5e('0x3f')](_0x3d05ee[_0x8f5e('0x3e')],{'$or':_[_0x8f5e('0x2c')](_0x3d05ee['attributes'],function(_0x2ea16a){var _0x3f813c={};_0x3f813c[_0x2ea16a]={'$like':'%'+_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x41')]+'%'};return _0x3f813c;})});}_0x3d05ee=_[_0x8f5e('0x3f')]({},_0x3d05ee,_0xf7538e[_0x8f5e('0x42')]);return db['CmHopperFinal'][_0x8f5e('0x1d')]({'where':_0x3d05ee[_0x8f5e('0x3e')]})[_0x8f5e('0x23')](function(_0xd35f00){_0x16f302[_0x8f5e('0x1d')]=_0xd35f00;if(_0xf7538e[_0x8f5e('0x31')][_0x8f5e('0x44')]){_0x3d05ee['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x8f5e('0x5b')](_0x3d05ee);})[_0x8f5e('0x23')](function(_0x25bdd7){_0x16f302[_0x8f5e('0x5c')]=_0x25bdd7;return _0x16f302;});}})['then'](respondWithFilteredResult(_0x154078,_0x3d05ee))['catch'](handleError(_0x154078,null));};exports[_0x8f5e('0x60')]=function(_0x5969bc,_0x28f915,_0x3f7980){var _0x4c394f={'raw':!![],'where':{}};var _0x3fca80={};var _0x314683={'count':0x0,'rows':[]};return db[_0x8f5e('0x43')][_0x8f5e('0x59')]({'where':{'id':_0x5969bc[_0x8f5e('0x51')]['id']}})['then'](handleEntityNotFound(_0x28f915,null))[_0x8f5e('0x23')](function(_0x433c36){if(_0x433c36){_0x3fca80[_0x8f5e('0x35')]=_[_0x8f5e('0x32')](db[_0x8f5e('0x61')][_0x8f5e('0x2d')]);_0x3fca80['query']=_[_0x8f5e('0x32')](_0x5969bc[_0x8f5e('0x31')]);_0x3fca80['filters']=_[_0x8f5e('0x34')](_0x3fca80['model'],_0x3fca80[_0x8f5e('0x31')]);_0x4c394f[_0x8f5e('0x36')]=_['intersection'](_0x3fca80[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0x5969bc[_0x8f5e('0x31')]['fields']));_0x4c394f[_0x8f5e('0x36')]=_0x4c394f[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0x4c394f[_0x8f5e('0x36')]:_0x3fca80[_0x8f5e('0x35')];if(!_0x5969bc['query'][_0x8f5e('0x39')]('nolimit')){_0x4c394f[_0x8f5e('0x1f')]=qs[_0x8f5e('0x1f')](_0x5969bc[_0x8f5e('0x31')]['limit']);_0x4c394f[_0x8f5e('0x1e')]=qs[_0x8f5e('0x1e')](_0x5969bc['query'][_0x8f5e('0x1e')]);}_0x4c394f[_0x8f5e('0x3b')]=qs[_0x8f5e('0x3c')](_0x5969bc[_0x8f5e('0x31')]['sort']);_0x4c394f[_0x8f5e('0x3e')]=qs[_0x8f5e('0x33')](_[_0x8f5e('0x3d')](_0x5969bc['query'],_0x3fca80[_0x8f5e('0x33')]));_0x4c394f[_0x8f5e('0x3e')][_0x8f5e('0x5f')]=_0x433c36['id'];if(_0x5969bc[_0x8f5e('0x31')][_0x8f5e('0x41')]){_0x4c394f[_0x8f5e('0x3e')]=_[_0x8f5e('0x3f')](_0x4c394f['where'],{'$or':_['map'](_0x4c394f[_0x8f5e('0x36')],function(_0x1bdcde){var _0x3905ee={};_0x3905ee[_0x1bdcde]={'$like':'%'+_0x5969bc[_0x8f5e('0x31')][_0x8f5e('0x41')]+'%'};return _0x3905ee;})});}_0x4c394f=_[_0x8f5e('0x3f')]({},_0x4c394f,_0x5969bc[_0x8f5e('0x42')]);return db[_0x8f5e('0x61')][_0x8f5e('0x1d')]({'where':_0x4c394f[_0x8f5e('0x3e')]})[_0x8f5e('0x23')](function(_0x5a3f75){_0x314683[_0x8f5e('0x1d')]=_0x5a3f75;if(_0x5969bc[_0x8f5e('0x31')]['includeAll']){_0x4c394f[_0x8f5e('0x47')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8f5e('0x5b')](_0x4c394f);})[_0x8f5e('0x23')](function(_0x4fc8b4){_0x314683[_0x8f5e('0x5c')]=_0x4fc8b4;return _0x314683;});}})[_0x8f5e('0x23')](respondWithFilteredResult(_0x28f915,_0x4c394f))[_0x8f5e('0x45')](handleError(_0x28f915,null));};exports[_0x8f5e('0x62')]=function(_0x5c1e64,_0x3c1705,_0x33e6d1){var _0x1e7f03={};var _0x3ace53={};var _0x1ce9a;var _0x1f3c0a;return db[_0x8f5e('0x43')]['findOne']({'where':{'id':_0x5c1e64[_0x8f5e('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c1705,null))[_0x8f5e('0x23')](function(_0x491ccd){if(_0x491ccd){_0x1ce9a=_0x491ccd;_0x3ace53[_0x8f5e('0x35')]=_[_0x8f5e('0x32')](db[_0x8f5e('0x63')][_0x8f5e('0x2d')]);_0x3ace53[_0x8f5e('0x31')]=_['keys'](_0x5c1e64[_0x8f5e('0x31')]);_0x3ace53[_0x8f5e('0x33')]=_['intersection'](_0x3ace53[_0x8f5e('0x35')],_0x3ace53[_0x8f5e('0x31')]);_0x1e7f03[_0x8f5e('0x36')]=_[_0x8f5e('0x34')](_0x3ace53[_0x8f5e('0x35')],qs['fields'](_0x5c1e64[_0x8f5e('0x31')][_0x8f5e('0x37')]));_0x1e7f03[_0x8f5e('0x36')]=_0x1e7f03[_0x8f5e('0x36')][_0x8f5e('0x38')]?_0x1e7f03[_0x8f5e('0x36')]:_0x3ace53[_0x8f5e('0x35')];_0x1e7f03['order']=qs[_0x8f5e('0x3c')](_0x5c1e64[_0x8f5e('0x31')][_0x8f5e('0x3c')]);_0x1e7f03['where']=qs[_0x8f5e('0x33')](_[_0x8f5e('0x3d')](_0x5c1e64[_0x8f5e('0x31')],_0x3ace53[_0x8f5e('0x33')]));if(_0x5c1e64[_0x8f5e('0x31')]['filter']){_0x1e7f03[_0x8f5e('0x3e')]=_[_0x8f5e('0x3f')](_0x1e7f03['where'],{'$or':_[_0x8f5e('0x2c')](_0x1e7f03[_0x8f5e('0x36')],function(_0x30d928){var _0x41a961={};_0x41a961[_0x30d928]={'$like':'%'+_0x5c1e64[_0x8f5e('0x31')][_0x8f5e('0x41')]+'%'};return _0x41a961;})});}_0x1e7f03=_[_0x8f5e('0x3f')]({},_0x1e7f03,_0x5c1e64[_0x8f5e('0x42')]);return _0x1ce9a['getLists'](_0x1e7f03);}})[_0x8f5e('0x23')](function(_0x287dc4){if(_0x287dc4){_0x1f3c0a=_0x287dc4[_0x8f5e('0x38')];if(!_0x5c1e64[_0x8f5e('0x31')]['hasOwnProperty'](_0x8f5e('0x3a'))){_0x1e7f03[_0x8f5e('0x1f')]=qs[_0x8f5e('0x1f')](_0x5c1e64[_0x8f5e('0x31')][_0x8f5e('0x1f')]);_0x1e7f03[_0x8f5e('0x1e')]=qs[_0x8f5e('0x1e')](_0x5c1e64['query'][_0x8f5e('0x1e')]);}return _0x1ce9a['getLists'](_0x1e7f03);}})['then'](function(_0x2b53a5){if(_0x2b53a5){return _0x2b53a5?{'count':_0x1f3c0a,'rows':_0x2b53a5}:null;}})[_0x8f5e('0x23')](respondWithResult(_0x3c1705,null))['catch'](handleError(_0x3c1705,null));};exports[_0x8f5e('0x64')]=function(_0x34b119,_0x36090d,_0x129db3){var _0x449ab3,_0x34484c;return db[_0x8f5e('0x43')][_0x8f5e('0x48')]({'where':{'id':_0x34b119['params']['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x36090d,null))[_0x8f5e('0x23')](function(_0x1ca0ee){if(_0x1ca0ee){_0x34484c=_0x1ca0ee;return _0x1ca0ee['addLists'](_0x34b119[_0x8f5e('0x4a')]['ids'],_['omit'](_0x34b119[_0x8f5e('0x4a')],[_0x8f5e('0x65'),'id'])||{});}return null;})[_0x8f5e('0x66')](function(_0x14bbee){var _0xe4f777;_0x449ab3=_0x14bbee||[];var _0x297a04=[];if(_0x14bbee){for(var _0x8fcd97=0x0;_0x8fcd97<_0x14bbee[_0x8f5e('0x38')];_0x8fcd97+=0x1){var _0x29699e=_0x14bbee[_0x8fcd97]['get']({'plain':!![]});_0x34484c[_0x8f5e('0x67')]=_0x34b119[_0x8f5e('0x4a')][_0x8f5e('0x67')]?_0x34b119['body'][_0x8f5e('0x67')]:_0x34484c['dialCheckDuplicateType'];switch(_0x34484c[_0x8f5e('0x67')]){case _0x8f5e('0x68'):_0xe4f777=squel['insert']()[_0x8f5e('0x69')](_0x8f5e('0x6a'))[_0x8f5e('0x6b')]([_0x8f5e('0x6c'),_0x8f5e('0x6d'),'ContactId','ListId',_0x8f5e('0x5f'),_0x8f5e('0x54'),_0x8f5e('0x52')],squel['select']()['field'](_0x8f5e('0x6c'),_0x8f5e('0x6c'))[_0x8f5e('0x6e')](_0x8f5e('0x6f'),'scheduledAt')[_0x8f5e('0x6e')]('id',_0x8f5e('0x70'))[_0x8f5e('0x6e')](_0x29699e[_0x8f5e('0x71')][_0x8f5e('0x72')](),'ListId')['field'](_0x34b119['params']['id'][_0x8f5e('0x72')](),'CampaignId')[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x54'))[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x52'))[_0x8f5e('0x73')](_0x8f5e('0x74'))[_0x8f5e('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x8f5e('0x75'),_0x29699e[_0x8f5e('0x71')][_0x8f5e('0x72')]())['where'](_0x8f5e('0x76'))[_0x8f5e('0x3e')](_0x8f5e('0x77'),squel['select']()['field'](_0x8f5e('0x78'))[_0x8f5e('0x73')](_0x8f5e('0x79'))['where'](_0x8f5e('0x7a'),_0x34b119[_0x8f5e('0x51')]['id'][_0x8f5e('0x72')]()))[_0x8f5e('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8f5e('0x7b')]()[_0x8f5e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x8f5e('0x73')](_0x8f5e('0x6a'))[_0x8f5e('0x3e')](_0x8f5e('0x7a'),_0x34b119[_0x8f5e('0x51')]['id'][_0x8f5e('0x72')]())))[_0x8f5e('0x72')]();break;case'onlyIfOpen':_0xe4f777=squel[_0x8f5e('0x7c')]()['into']('cm_hopper')[_0x8f5e('0x6b')]([_0x8f5e('0x6c'),_0x8f5e('0x6d'),_0x8f5e('0x70'),_0x8f5e('0x7d'),_0x8f5e('0x5f'),_0x8f5e('0x54'),'updatedAt'],squel['select']()[_0x8f5e('0x6e')](_0x8f5e('0x6c'),_0x8f5e('0x6c'))[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x6d'))['field']('id',_0x8f5e('0x70'))[_0x8f5e('0x6e')](_0x29699e['CmListId']['toString'](),_0x8f5e('0x7d'))[_0x8f5e('0x6e')](_0x34b119[_0x8f5e('0x51')]['id'][_0x8f5e('0x72')](),'CampaignId')[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x54'))[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x52'))[_0x8f5e('0x73')](_0x8f5e('0x74'))[_0x8f5e('0x3e')](_0x8f5e('0x7e'))[_0x8f5e('0x3e')]('ListId\x20=\x20?',_0x29699e[_0x8f5e('0x71')][_0x8f5e('0x72')]())[_0x8f5e('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x8f5e('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8f5e('0x7b')]()['field'](_0x8f5e('0x7f'))['from'](_0x8f5e('0x6a'))[_0x8f5e('0x3e')](_0x8f5e('0x7a'),_0x34b119[_0x8f5e('0x51')]['id'][_0x8f5e('0x72')]())))['toString']();break;default:_0xe4f777=squel['insert']()[_0x8f5e('0x69')]('cm_hopper')[_0x8f5e('0x6b')]([_0x8f5e('0x6c'),_0x8f5e('0x6d'),_0x8f5e('0x70'),_0x8f5e('0x7d'),_0x8f5e('0x5f'),_0x8f5e('0x54'),'updatedAt'],squel[_0x8f5e('0x7b')]()[_0x8f5e('0x6e')](_0x8f5e('0x6c'),_0x8f5e('0x6c'))[_0x8f5e('0x6e')]('NOW()','scheduledAt')[_0x8f5e('0x6e')]('id','ContactId')[_0x8f5e('0x6e')](_0x29699e[_0x8f5e('0x71')][_0x8f5e('0x72')](),'ListId')[_0x8f5e('0x6e')](_0x34b119[_0x8f5e('0x51')]['id'][_0x8f5e('0x72')](),_0x8f5e('0x5f'))[_0x8f5e('0x6e')]('NOW()','createdAt')['field'](_0x8f5e('0x6f'),'updatedAt')[_0x8f5e('0x73')](_0x8f5e('0x74'))[_0x8f5e('0x3e')]('deletedAt\x20IS\x20NULL')[_0x8f5e('0x3e')]('ListId\x20=\x20?',_0x29699e['CmListId'][_0x8f5e('0x72')]())['where'](_0x8f5e('0x76')))[_0x8f5e('0x72')]();}_0x297a04[_0x8f5e('0x80')](db[_0x8f5e('0x81')][_0x8f5e('0x31')](_0xe4f777));}return BPromise['all'](_0x297a04);}})[_0x8f5e('0x23')](function(){return _0x449ab3;})[_0x8f5e('0x23')](respondWithResult(_0x36090d,null))['catch'](handleError(_0x36090d,null));};exports[_0x8f5e('0x82')]=function(_0x4772e9,_0x4dc27b,_0x3aefbd){return db[_0x8f5e('0x43')][_0x8f5e('0x48')]({'where':{'id':_0x4772e9['params']['id']}})['then'](handleEntityNotFound(_0x4dc27b,null))[_0x8f5e('0x23')](function(_0x5243cc){if(_0x5243cc){return _0x5243cc[_0x8f5e('0x82')](_0x4772e9[_0x8f5e('0x31')][_0x8f5e('0x65')]);}})[_0x8f5e('0x23')](function(_0x58ba79){if(_0x58ba79){return db['CmHopper']['destroy']({'where':{'ListId':_0x4772e9[_0x8f5e('0x31')]['ids'],'CampaignId':_0x4772e9[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](function(){return _0x58ba79;});}})[_0x8f5e('0x23')](respondWithStatusCode(_0x4dc27b,null))[_0x8f5e('0x45')](handleError(_0x4dc27b,null));};exports['getBlackLists']=function(_0x37b01e,_0x377ad6,_0x4a75dd){var _0x20f888={'raw':!![],'where':{}};var _0x4033ec={};var _0x1f5946={'count':0x0,'rows':[]};return db[_0x8f5e('0x43')][_0x8f5e('0x59')]({'where':{'id':_0x37b01e[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x377ad6,null))[_0x8f5e('0x23')](function(_0x31df5b){if(_0x31df5b){_0x4033ec[_0x8f5e('0x35')]=_[_0x8f5e('0x32')](db['CmList'][_0x8f5e('0x2d')]);_0x4033ec[_0x8f5e('0x31')]=_[_0x8f5e('0x32')](_0x37b01e[_0x8f5e('0x31')]);_0x4033ec[_0x8f5e('0x33')]=_[_0x8f5e('0x34')](_0x4033ec['model'],_0x4033ec[_0x8f5e('0x31')]);_0x20f888[_0x8f5e('0x36')]=_[_0x8f5e('0x34')](_0x4033ec[_0x8f5e('0x35')],qs[_0x8f5e('0x37')](_0x37b01e[_0x8f5e('0x31')]['fields']));_0x20f888[_0x8f5e('0x36')]=_0x20f888['attributes']['length']?_0x20f888[_0x8f5e('0x36')]:_0x4033ec[_0x8f5e('0x35')];if(!_0x37b01e[_0x8f5e('0x31')][_0x8f5e('0x39')](_0x8f5e('0x3a'))){_0x20f888['limit']=qs[_0x8f5e('0x1f')](_0x37b01e['query'][_0x8f5e('0x1f')]);_0x20f888[_0x8f5e('0x1e')]=qs[_0x8f5e('0x1e')](_0x37b01e['query'][_0x8f5e('0x1e')]);}_0x20f888[_0x8f5e('0x3b')]=qs[_0x8f5e('0x3c')](_0x37b01e['query'][_0x8f5e('0x3c')]);_0x20f888[_0x8f5e('0x3e')]=qs[_0x8f5e('0x33')](_[_0x8f5e('0x3d')](_0x37b01e[_0x8f5e('0x31')],_0x4033ec['filters']));_0x20f888['where']['CampaignId']=_0x31df5b['id'];if(_0x37b01e[_0x8f5e('0x31')][_0x8f5e('0x41')]){_0x20f888[_0x8f5e('0x3e')]=_[_0x8f5e('0x3f')](_0x20f888[_0x8f5e('0x3e')],{'$or':_[_0x8f5e('0x2c')](_0x20f888[_0x8f5e('0x36')],function(_0x2790ea){var _0x453972={};_0x453972[_0x2790ea]={'$like':'%'+_0x37b01e['query']['filter']+'%'};return _0x453972;})});}_0x20f888=_[_0x8f5e('0x3f')]({},_0x20f888,_0x37b01e[_0x8f5e('0x42')]);return db['CmList']['count']({'where':_0x20f888[_0x8f5e('0x3e')]})[_0x8f5e('0x23')](function(_0x43edcf){_0x1f5946[_0x8f5e('0x1d')]=_0x43edcf;if(_0x37b01e[_0x8f5e('0x31')][_0x8f5e('0x44')]){_0x20f888['include']=[{'all':!![]}];}return db[_0x8f5e('0x63')][_0x8f5e('0x5b')](_0x20f888);})['then'](function(_0x491fd3){_0x1f5946['rows']=_0x491fd3;return _0x1f5946;});}})['then'](respondWithFilteredResult(_0x377ad6,_0x20f888))[_0x8f5e('0x45')](handleError(_0x377ad6,null));};exports[_0x8f5e('0x83')]=function(_0x5629f1,_0x58f11e,_0x3f34e6){var _0x501a54,_0x3563d9;return db[_0x8f5e('0x43')][_0x8f5e('0x48')]({'where':{'id':_0x5629f1[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x58f11e,null))[_0x8f5e('0x23')](function(_0x12c2c3){if(_0x12c2c3){_0x3563d9=_0x12c2c3;return _0x12c2c3[_0x8f5e('0x83')](_0x5629f1[_0x8f5e('0x4a')][_0x8f5e('0x65')],_[_0x8f5e('0x53')](_0x5629f1['body'],[_0x8f5e('0x65'),'id'])||{});}return null;})[_0x8f5e('0x66')](function(_0x3c7044){var _0x2bbfe5;_0x501a54=_0x3c7044||[];var _0x2c1654=[];if(_0x3c7044){for(var _0x300dec=0x0;_0x300dec<_0x3c7044[_0x8f5e('0x38')];_0x300dec+=0x1){var _0x3c2016=_0x3c7044[_0x300dec][_0x8f5e('0x25')]({'plain':!![]});_0x2bbfe5=squel[_0x8f5e('0x7c')]()[_0x8f5e('0x69')](_0x8f5e('0x84'))['fromQuery'](['phone',_0x8f5e('0x70'),'ListId','CampaignId',_0x8f5e('0x54'),_0x8f5e('0x52')],squel[_0x8f5e('0x7b')]()[_0x8f5e('0x6e')]('phone',_0x8f5e('0x6c'))[_0x8f5e('0x6e')]('id','ContactId')[_0x8f5e('0x6e')](_0x3c2016[_0x8f5e('0x71')][_0x8f5e('0x72')](),_0x8f5e('0x7d'))[_0x8f5e('0x6e')](_0x5629f1[_0x8f5e('0x51')]['id']['toString'](),_0x8f5e('0x5f'))[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x54'))[_0x8f5e('0x6e')](_0x8f5e('0x6f'),_0x8f5e('0x52'))[_0x8f5e('0x73')](_0x8f5e('0x74'))['where'](_0x8f5e('0x7e'))[_0x8f5e('0x3e')](_0x8f5e('0x75'),_0x3c2016[_0x8f5e('0x71')][_0x8f5e('0x72')]())['where'](_0x8f5e('0x76')))[_0x8f5e('0x72')]();_0x2c1654[_0x8f5e('0x80')](db[_0x8f5e('0x81')]['query'](_0x2bbfe5));}return BPromise[_0x8f5e('0x85')](_0x2c1654);}})[_0x8f5e('0x23')](function(){return _0x501a54;})[_0x8f5e('0x23')](respondWithResult(_0x58f11e,null))[_0x8f5e('0x45')](handleError(_0x58f11e,null));};exports[_0x8f5e('0x86')]=function(_0x48faf6,_0x472b83,_0xd68d3d){return db[_0x8f5e('0x43')][_0x8f5e('0x48')]({'where':{'id':_0x48faf6[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](handleEntityNotFound(_0x472b83,null))['then'](function(_0x594fcf){if(_0x594fcf){return _0x594fcf['removeBlackLists'](_0x48faf6[_0x8f5e('0x31')][_0x8f5e('0x65')]);}})[_0x8f5e('0x23')](function(_0x2fb808){if(_0x2fb808){return db[_0x8f5e('0x61')][_0x8f5e('0x24')]({'where':{'ListId':_0x48faf6['query'][_0x8f5e('0x65')],'CampaignId':_0x48faf6[_0x8f5e('0x51')]['id']}})[_0x8f5e('0x23')](function(){return _0x2fb808;});}})['then'](respondWithStatusCode(_0x472b83,null))['catch'](handleError(_0x472b83,null));}; \ No newline at end of file +var _0x3886=['create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','createdAt','updatedAt','body','omit','role','UserProfileSection','getHoppers','findOne','order','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','error','name','index','map','Campaign','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation'];(function(_0x21fc07,_0x16c1c4){var _0x16ead9=function(_0x474a9a){while(--_0x474a9a){_0x21fc07['push'](_0x21fc07['shift']());}};_0x16ead9(++_0x16c1c4);}(_0x3886,0xc2));var _0x6388=function(_0x529de8,_0x51c48c){_0x529de8=_0x529de8-0x0;var _0x37163e=_0x3886[_0x529de8];return _0x37163e;};'use strict';var pdf=require(_0x6388('0x0'));var emlformat=require(_0x6388('0x1'));var rimraf=require(_0x6388('0x2'));var zipdir=require(_0x6388('0x3'));var jsonpatch=require(_0x6388('0x4'));var rp=require(_0x6388('0x5'));var moment=require(_0x6388('0x6'));var BPromise=require(_0x6388('0x7'));var Mustache=require('mustache');var util=require(_0x6388('0x8'));var path=require('path');var sox=require(_0x6388('0x9'));var csv=require('to-csv');var ejs=require(_0x6388('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6388('0xb'));var crypto=require(_0x6388('0xc'));var jsforce=require(_0x6388('0xd'));var deskjs=require(_0x6388('0xe'));var toCsv=require(_0x6388('0xf'));var querystring=require(_0x6388('0x10'));var Papa=require(_0x6388('0x11'));var Redis=require(_0x6388('0x12'));var authService=require(_0x6388('0x13'));var qs=require(_0x6388('0x14'));var as=require(_0x6388('0x15'));var hardwareService=require(_0x6388('0x16'));var logger=require('../../config/logger')(_0x6388('0x17'));var utils=require(_0x6388('0x18'));var config=require(_0x6388('0x19'));var db=require(_0x6388('0x1a'))['db'];function respondWithStatusCode(_0xae44eb,_0x3ed419){_0x3ed419=_0x3ed419||0xcc;return function(_0xe77770){if(_0xe77770){return _0xae44eb[_0x6388('0x1b')](_0x3ed419);}return _0xae44eb['status'](_0x3ed419)['end']();};}function respondWithResult(_0x51bc0a,_0x4de61a){_0x4de61a=_0x4de61a||0xc8;return function(_0x3b12a2){if(_0x3b12a2){return _0x51bc0a['status'](_0x4de61a)[_0x6388('0x1c')](_0x3b12a2);}};}function respondWithFilteredResult(_0x35cfb9,_0x5bef5e){return function(_0x21f816){if(_0x21f816){var _0x12da5d=_0x21f816[_0x6388('0x1d')],_0x8bc036=_0x5bef5e[_0x6388('0x1e')],_0x2d8d02=_0x5bef5e[_0x6388('0x1e')]+_0x5bef5e['limit'],_0x479275;if(_0x2d8d02>=_0x12da5d){_0x2d8d02=_0x12da5d;_0x479275=0xc8;}else{_0x479275=0xce;}_0x35cfb9[_0x6388('0x1f')](_0x479275);return _0x35cfb9[_0x6388('0x20')](_0x6388('0x21'),_0x8bc036+'-'+_0x2d8d02+'/'+_0x12da5d)['json'](_0x21f816);}return null;};}function patchUpdates(_0x2d2522){return function(_0x196c35){try{jsonpatch[_0x6388('0x22')](_0x196c35,_0x2d2522,!![]);}catch(_0x392834){return BPromise[_0x6388('0x23')](_0x392834);}return _0x196c35['save']();};}function saveUpdates(_0x2fbc6f,_0x1405e2){return function(_0x46994f){if(_0x46994f){return _0x46994f[_0x6388('0x24')](_0x2fbc6f)['then'](function(_0x4dd8ec){return _0x4dd8ec;});}return null;};}function removeEntity(_0x10a893,_0xd0af7e){return function(_0xb7431d){if(_0xb7431d){return _0xb7431d[_0x6388('0x25')]()[_0x6388('0x26')](function(){var _0x4f9db7=_0xb7431d[_0x6388('0x27')]({'plain':!![]});var _0x4addde=_0x6388('0x28');return db[_0x6388('0x29')][_0x6388('0x25')]({'where':{'type':_0x4addde,'resourceId':_0x4f9db7['id']}})[_0x6388('0x26')](function(){return _0xb7431d;});})[_0x6388('0x26')](function(){_0x10a893['status'](0xcc)[_0x6388('0x2a')]();});}};}function handleEntityNotFound(_0x70eaf8,_0x264016){return function(_0x490f6e){if(!_0x490f6e){_0x70eaf8['sendStatus'](0x194);}return _0x490f6e;};}function handleError(_0x1845ea,_0x539996){_0x539996=_0x539996||0x1f4;return function(_0x3fb95b){logger[_0x6388('0x2b')](_0x3fb95b['stack']);if(_0x3fb95b[_0x6388('0x2c')]){delete _0x3fb95b[_0x6388('0x2c')];}_0x1845ea[_0x6388('0x1f')](_0x539996)['send'](_0x3fb95b);};}exports[_0x6388('0x2d')]=function(_0xc36f51,_0x2b251a){var _0x35a24e={},_0x3b4bf5={},_0x1b1b2b={'count':0x0,'rows':[]};var _0x14bb17=_[_0x6388('0x2e')](db[_0x6388('0x2f')]['rawAttributes'],function(_0x29ade4){return{'name':_0x29ade4[_0x6388('0x30')],'type':_0x29ade4['type'][_0x6388('0x31')]};});_0x3b4bf5[_0x6388('0x32')]=_[_0x6388('0x2e')](_0x14bb17,'name');_0x3b4bf5[_0x6388('0x33')]=_[_0x6388('0x34')](_0xc36f51['query']);_0x3b4bf5[_0x6388('0x35')]=_[_0x6388('0x36')](_0x3b4bf5[_0x6388('0x32')],_0x3b4bf5[_0x6388('0x33')]);_0x35a24e[_0x6388('0x37')]=_['intersection'](_0x3b4bf5[_0x6388('0x32')],qs['fields'](_0xc36f51[_0x6388('0x33')]['fields']));_0x35a24e[_0x6388('0x37')]=_0x35a24e[_0x6388('0x37')][_0x6388('0x38')]?_0x35a24e['attributes']:_0x3b4bf5[_0x6388('0x32')];if(!_0xc36f51['query'][_0x6388('0x39')](_0x6388('0x3a'))){_0x35a24e[_0x6388('0x3b')]=qs[_0x6388('0x3b')](_0xc36f51[_0x6388('0x33')]['limit']);_0x35a24e[_0x6388('0x1e')]=qs['offset'](_0xc36f51[_0x6388('0x33')][_0x6388('0x1e')]);}_0x35a24e['order']=qs[_0x6388('0x3c')](_0xc36f51[_0x6388('0x33')][_0x6388('0x3c')]);_0x35a24e[_0x6388('0x3d')]=qs[_0x6388('0x35')](_[_0x6388('0x3e')](_0xc36f51['query'],_0x3b4bf5['filters']),_0x14bb17);if(_0xc36f51[_0x6388('0x33')][_0x6388('0x3f')]){_0x35a24e[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x35a24e[_0x6388('0x3d')],{'$or':_[_0x6388('0x2e')](_0x14bb17,function(_0x300ef8){if(_0x300ef8['type']!==_0x6388('0x41')){var _0x5cb584={};_0x5cb584[_0x300ef8['name']]={'$like':'%'+_0xc36f51[_0x6388('0x33')][_0x6388('0x3f')]+'%'};return _0x5cb584;}})});}_0x35a24e=_[_0x6388('0x40')]({},_0x35a24e,_0xc36f51['options']);var _0x2304c0={'where':_0x35a24e['where']};return db[_0x6388('0x2f')][_0x6388('0x1d')](_0x2304c0)[_0x6388('0x26')](function(_0x5a3b3f){_0x1b1b2b[_0x6388('0x1d')]=_0x5a3b3f;if(_0xc36f51[_0x6388('0x33')][_0x6388('0x42')]){_0x35a24e[_0x6388('0x43')]=[{'all':!![]}];}return db[_0x6388('0x2f')][_0x6388('0x44')](_0x35a24e);})[_0x6388('0x26')](function(_0x223379){_0x1b1b2b[_0x6388('0x45')]=_0x223379;return _0x1b1b2b;})[_0x6388('0x26')](respondWithFilteredResult(_0x2b251a,_0x35a24e))[_0x6388('0x46')](handleError(_0x2b251a,null));};exports['show']=function(_0xabf50e,_0x2ee5b8){var _0x130401={'raw':![],'where':{'id':_0xabf50e[_0x6388('0x47')]['id']}},_0x9aad8b={};_0x9aad8b[_0x6388('0x32')]=_[_0x6388('0x34')](db[_0x6388('0x2f')]['rawAttributes']);_0x9aad8b[_0x6388('0x33')]=_[_0x6388('0x34')](_0xabf50e[_0x6388('0x33')]);_0x9aad8b[_0x6388('0x35')]=_[_0x6388('0x36')](_0x9aad8b[_0x6388('0x32')],_0x9aad8b[_0x6388('0x33')]);_0x130401[_0x6388('0x37')]=_['intersection'](_0x9aad8b['model'],qs[_0x6388('0x48')](_0xabf50e['query']['fields']));_0x130401[_0x6388('0x37')]=_0x130401['attributes']['length']?_0x130401[_0x6388('0x37')]:_0x9aad8b[_0x6388('0x32')];if(_0xabf50e[_0x6388('0x33')][_0x6388('0x42')]){_0x130401['include']=[{'all':!![]}];}_0x130401=_['merge']({},_0x130401,_0xabf50e[_0x6388('0x49')]);return db[_0x6388('0x2f')][_0x6388('0x4a')](_0x130401)['then'](handleEntityNotFound(_0x2ee5b8,null))['then'](respondWithResult(_0x2ee5b8,null))[_0x6388('0x46')](handleError(_0x2ee5b8,null));};exports['create']=function(_0x47735b,_0x569c47){return db[_0x6388('0x2f')]['create'](_0x47735b['body'],{})['then'](function(_0x5f0d16){var _0x2ac690=_0x47735b[_0x6388('0x4b')]['get']({'plain':!![]});if(!_0x2ac690)throw new Error(_0x6388('0x4c'));if(_0x2ac690['role']===_0x6388('0x4b')){var _0x5c85cf=_0x5f0d16['get']({'plain':!![]});var _0x7fa384=_0x6388('0x28');return db['UserProfileSection'][_0x6388('0x4a')]({'where':{'name':_0x7fa384,'userProfileId':_0x2ac690['userProfileId']},'raw':!![]})[_0x6388('0x26')](function(_0x5ad451){if(_0x5ad451&&_0x5ad451[_0x6388('0x4d')]===0x0){return db[_0x6388('0x29')][_0x6388('0x4e')]({'name':_0x5c85cf[_0x6388('0x2c')],'resourceId':_0x5c85cf['id'],'type':_0x5ad451[_0x6388('0x2c')],'sectionId':_0x5ad451['id']},{})['then'](function(){return _0x5f0d16;});}else{return _0x5f0d16;}})[_0x6388('0x46')](function(_0x1bfdca){logger[_0x6388('0x2b')](_0x6388('0x4f'),_0x1bfdca);throw _0x1bfdca;});}return _0x5f0d16;})[_0x6388('0x26')](respondWithResult(_0x569c47,0xc9))[_0x6388('0x46')](handleError(_0x569c47,null));};exports['clone']=function(_0x4c95c8,_0x5273c3){var _0x50fbfe={'where':{'id':_0x4c95c8[_0x6388('0x47')]['id']}},_0x3aacd4={};_0x3aacd4['model']=_[_0x6388('0x34')](db[_0x6388('0x2f')][_0x6388('0x50')]);_0x50fbfe[_0x6388('0x37')]=_['intersection'](_0x3aacd4[_0x6388('0x32')],qs['fields'](_0x4c95c8['query'][_0x6388('0x48')]));_0x50fbfe[_0x6388('0x37')]=_0x50fbfe[_0x6388('0x37')][_0x6388('0x38')]?_0x50fbfe[_0x6388('0x37')]:_0x3aacd4[_0x6388('0x32')];if(_0x4c95c8[_0x6388('0x33')][_0x6388('0x42')]){_0x50fbfe[_0x6388('0x43')]=[{'all':!![]}];}_0x50fbfe=_[_0x6388('0x40')]({},_0x50fbfe,_0x4c95c8[_0x6388('0x49')]);return db[_0x6388('0x2f')][_0x6388('0x4a')](_0x50fbfe)[_0x6388('0x26')](handleEntityNotFound(_0x5273c3,null))[_0x6388('0x26')](function(_0x3eb93a){if(_0x3eb93a){var _0x4d351e=_0x3eb93a['get']({'plain':!![]});_0x4d351e=qs['omit'](_0x4d351e,['id',_0x6388('0x51'),_0x6388('0x52')]);_0x4c95c8[_0x6388('0x53')]=_[_0x6388('0x54')](_0x4c95c8['body'],['id',_0x6388('0x51'),_0x6388('0x52')]);return db[_0x6388('0x2f')][_0x6388('0x4e')](_[_0x6388('0x40')](_0x4d351e,_0x4c95c8[_0x6388('0x53')]),{'include':_0x4c95c8['query'][_0x6388('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x1b8a81){var _0x5f97ca=_0x4c95c8[_0x6388('0x4b')]['get']({'plain':!![]});if(!_0x5f97ca)throw new Error(_0x6388('0x4c'));if(_0x5f97ca[_0x6388('0x55')]===_0x6388('0x4b')){var _0xf9a497=_0x1b8a81[_0x6388('0x27')]({'plain':!![]});var _0x24fc0b=_0x6388('0x28');return db[_0x6388('0x56')][_0x6388('0x4a')]({'where':{'name':_0x24fc0b,'userProfileId':_0x5f97ca['userProfileId']},'raw':!![]})[_0x6388('0x26')](function(_0x26f9ba){if(_0x26f9ba&&_0x26f9ba['autoAssociation']===0x0){return db['UserProfileResource'][_0x6388('0x4e')]({'name':_0xf9a497[_0x6388('0x2c')],'resourceId':_0xf9a497['id'],'type':_0x26f9ba[_0x6388('0x2c')],'sectionId':_0x26f9ba['id']},{})['then'](function(){return _0x1b8a81;});}else{return _0x1b8a81;}})[_0x6388('0x46')](function(_0x508300){logger['error'](_0x6388('0x4f'),_0x508300);throw _0x508300;});}return _0x1b8a81;});}})[_0x6388('0x26')](respondWithResult(_0x5273c3,0xc9))['catch'](handleError(_0x5273c3,null));};exports[_0x6388('0x24')]=function(_0x5d1d70,_0x168eab){if(_0x5d1d70['body']['id']){delete _0x5d1d70['body']['id'];}return db[_0x6388('0x2f')]['find']({'where':{'id':_0x5d1d70[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x168eab,null))['then'](saveUpdates(_0x5d1d70[_0x6388('0x53')],null))[_0x6388('0x26')](respondWithResult(_0x168eab,null))['catch'](handleError(_0x168eab,null));};exports['destroy']=function(_0x2566c2,_0x39d28d){return db[_0x6388('0x2f')][_0x6388('0x4a')]({'where':{'id':_0x2566c2[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x39d28d,null))['then'](removeEntity(_0x39d28d,null))[_0x6388('0x46')](handleError(_0x39d28d,null));};exports[_0x6388('0x57')]=function(_0x480461,_0x55a45d,_0x106985){var _0x50f3a3={'raw':!![],'where':{}};var _0x5d3a02={};var _0x2ff9a4={'count':0x0,'rows':[]};return db['Campaign'][_0x6388('0x58')]({'where':{'id':_0x480461[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x55a45d,null))[_0x6388('0x26')](function(_0x203694){if(_0x203694){_0x5d3a02[_0x6388('0x32')]=_[_0x6388('0x34')](db['CmHopper'][_0x6388('0x50')]);_0x5d3a02[_0x6388('0x33')]=_[_0x6388('0x34')](_0x480461[_0x6388('0x33')]);_0x5d3a02[_0x6388('0x35')]=_[_0x6388('0x36')](_0x5d3a02['model'],_0x5d3a02[_0x6388('0x33')]);_0x50f3a3[_0x6388('0x37')]=_['intersection'](_0x5d3a02[_0x6388('0x32')],qs[_0x6388('0x48')](_0x480461[_0x6388('0x33')][_0x6388('0x48')]));_0x50f3a3[_0x6388('0x37')]=_0x50f3a3[_0x6388('0x37')]['length']?_0x50f3a3['attributes']:_0x5d3a02[_0x6388('0x32')];if(!_0x480461[_0x6388('0x33')][_0x6388('0x39')](_0x6388('0x3a'))){_0x50f3a3[_0x6388('0x3b')]=qs[_0x6388('0x3b')](_0x480461['query'][_0x6388('0x3b')]);_0x50f3a3[_0x6388('0x1e')]=qs[_0x6388('0x1e')](_0x480461[_0x6388('0x33')][_0x6388('0x1e')]);}_0x50f3a3[_0x6388('0x59')]=qs[_0x6388('0x3c')](_0x480461['query'][_0x6388('0x3c')]);_0x50f3a3[_0x6388('0x3d')]=qs['filters'](_[_0x6388('0x3e')](_0x480461[_0x6388('0x33')],_0x5d3a02[_0x6388('0x35')]));_0x50f3a3[_0x6388('0x3d')][_0x6388('0x5a')]=_0x203694['id'];if(_0x480461[_0x6388('0x33')]['filter']){_0x50f3a3[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x50f3a3['where'],{'$or':_[_0x6388('0x2e')](_0x50f3a3[_0x6388('0x37')],function(_0x37bb7f){var _0x5eb107={};_0x5eb107[_0x37bb7f]={'$like':'%'+_0x480461[_0x6388('0x33')][_0x6388('0x3f')]+'%'};return _0x5eb107;})});}_0x50f3a3=_[_0x6388('0x40')]({},_0x50f3a3,_0x480461['options']);return db[_0x6388('0x5b')]['count']({'where':_0x50f3a3[_0x6388('0x3d')]})[_0x6388('0x26')](function(_0xa2cfc3){_0x2ff9a4[_0x6388('0x1d')]=_0xa2cfc3;if(_0x480461[_0x6388('0x33')]['includeAll']){_0x50f3a3[_0x6388('0x43')]=[{'all':!![]}];}return db[_0x6388('0x5b')]['findAll'](_0x50f3a3);})[_0x6388('0x26')](function(_0xae86b8){_0x2ff9a4[_0x6388('0x45')]=_0xae86b8;return _0x2ff9a4;});}})[_0x6388('0x26')](respondWithFilteredResult(_0x55a45d,_0x50f3a3))[_0x6388('0x46')](handleError(_0x55a45d,null));};exports[_0x6388('0x5c')]=function(_0x137f27,_0x9bcc40,_0x33de8b){var _0x49ca16={'raw':!![],'where':{}};var _0x30be3c={};var _0x3d49d1={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x137f27['params']['id']}})['then'](handleEntityNotFound(_0x9bcc40,null))[_0x6388('0x26')](function(_0x1255b7){if(_0x1255b7){_0x30be3c['model']=_[_0x6388('0x34')](db[_0x6388('0x5d')]['rawAttributes']);_0x30be3c['query']=_[_0x6388('0x34')](_0x137f27[_0x6388('0x33')]);_0x30be3c[_0x6388('0x35')]=_[_0x6388('0x36')](_0x30be3c['model'],_0x30be3c['query']);_0x49ca16['attributes']=_['intersection'](_0x30be3c['model'],qs['fields'](_0x137f27[_0x6388('0x33')]['fields']));_0x49ca16[_0x6388('0x37')]=_0x49ca16[_0x6388('0x37')][_0x6388('0x38')]?_0x49ca16[_0x6388('0x37')]:_0x30be3c[_0x6388('0x32')];if(!_0x137f27[_0x6388('0x33')][_0x6388('0x39')](_0x6388('0x3a'))){_0x49ca16[_0x6388('0x3b')]=qs[_0x6388('0x3b')](_0x137f27[_0x6388('0x33')][_0x6388('0x3b')]);_0x49ca16[_0x6388('0x1e')]=qs['offset'](_0x137f27[_0x6388('0x33')][_0x6388('0x1e')]);}_0x49ca16[_0x6388('0x59')]=qs[_0x6388('0x3c')](_0x137f27[_0x6388('0x33')][_0x6388('0x3c')]);_0x49ca16[_0x6388('0x3d')]=qs[_0x6388('0x35')](_[_0x6388('0x3e')](_0x137f27[_0x6388('0x33')],_0x30be3c[_0x6388('0x35')]));_0x49ca16[_0x6388('0x3d')]['CampaignId']=_0x1255b7['id'];if(_0x137f27[_0x6388('0x33')][_0x6388('0x3f')]){_0x49ca16[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x49ca16[_0x6388('0x3d')],{'$or':_[_0x6388('0x2e')](_0x49ca16[_0x6388('0x37')],function(_0x1f50d3){var _0x5f8e9d={};_0x5f8e9d[_0x1f50d3]={'$like':'%'+_0x137f27[_0x6388('0x33')][_0x6388('0x3f')]+'%'};return _0x5f8e9d;})});}_0x49ca16=_[_0x6388('0x40')]({},_0x49ca16,_0x137f27[_0x6388('0x49')]);return db[_0x6388('0x5d')][_0x6388('0x1d')]({'where':_0x49ca16['where']})[_0x6388('0x26')](function(_0x44a8d5){_0x3d49d1[_0x6388('0x1d')]=_0x44a8d5;if(_0x137f27['query'][_0x6388('0x42')]){_0x49ca16[_0x6388('0x43')]=[{'all':!![]}];}return db[_0x6388('0x5d')]['findAll'](_0x49ca16);})[_0x6388('0x26')](function(_0x2c7a5a){_0x3d49d1[_0x6388('0x45')]=_0x2c7a5a;return _0x3d49d1;});}})[_0x6388('0x26')](respondWithFilteredResult(_0x9bcc40,_0x49ca16))[_0x6388('0x46')](handleError(_0x9bcc40,null));};exports[_0x6388('0x5e')]=function(_0x4ce639,_0x104d6a,_0x5e53ee){var _0x2d2503={'raw':!![],'where':{}};var _0x4a80e7={};var _0x5dfde6={'count':0x0,'rows':[]};return db[_0x6388('0x2f')][_0x6388('0x58')]({'where':{'id':_0x4ce639[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x104d6a,null))[_0x6388('0x26')](function(_0x72cd4e){if(_0x72cd4e){_0x4a80e7['model']=_[_0x6388('0x34')](db['CmHopperFinal'][_0x6388('0x50')]);_0x4a80e7[_0x6388('0x33')]=_[_0x6388('0x34')](_0x4ce639[_0x6388('0x33')]);_0x4a80e7[_0x6388('0x35')]=_['intersection'](_0x4a80e7[_0x6388('0x32')],_0x4a80e7[_0x6388('0x33')]);_0x2d2503['attributes']=_[_0x6388('0x36')](_0x4a80e7['model'],qs[_0x6388('0x48')](_0x4ce639[_0x6388('0x33')][_0x6388('0x48')]));_0x2d2503[_0x6388('0x37')]=_0x2d2503[_0x6388('0x37')][_0x6388('0x38')]?_0x2d2503['attributes']:_0x4a80e7[_0x6388('0x32')];if(!_0x4ce639['query']['hasOwnProperty'](_0x6388('0x3a'))){_0x2d2503['limit']=qs[_0x6388('0x3b')](_0x4ce639['query'][_0x6388('0x3b')]);_0x2d2503['offset']=qs[_0x6388('0x1e')](_0x4ce639['query'][_0x6388('0x1e')]);}_0x2d2503['order']=qs[_0x6388('0x3c')](_0x4ce639[_0x6388('0x33')]['sort']);_0x2d2503['where']=qs[_0x6388('0x35')](_['pick'](_0x4ce639[_0x6388('0x33')],_0x4a80e7['filters']));_0x2d2503['where'][_0x6388('0x5a')]=_0x72cd4e['id'];if(_0x4ce639['query'][_0x6388('0x3f')]){_0x2d2503[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x2d2503[_0x6388('0x3d')],{'$or':_[_0x6388('0x2e')](_0x2d2503[_0x6388('0x37')],function(_0x30503c){var _0x39a2e9={};_0x39a2e9[_0x30503c]={'$like':'%'+_0x4ce639[_0x6388('0x33')][_0x6388('0x3f')]+'%'};return _0x39a2e9;})});}_0x2d2503=_['merge']({},_0x2d2503,_0x4ce639[_0x6388('0x49')]);return db['CmHopperFinal'][_0x6388('0x1d')]({'where':_0x2d2503[_0x6388('0x3d')]})[_0x6388('0x26')](function(_0x34c537){_0x5dfde6[_0x6388('0x1d')]=_0x34c537;if(_0x4ce639[_0x6388('0x33')][_0x6388('0x42')]){_0x2d2503[_0x6388('0x43')]=[{'all':!![]}];}return db[_0x6388('0x5f')][_0x6388('0x44')](_0x2d2503);})[_0x6388('0x26')](function(_0x54d7aa){_0x5dfde6[_0x6388('0x45')]=_0x54d7aa;return _0x5dfde6;});}})['then'](respondWithFilteredResult(_0x104d6a,_0x2d2503))[_0x6388('0x46')](handleError(_0x104d6a,null));};exports[_0x6388('0x60')]=function(_0x20ef25,_0x302b8a,_0x4b39a6){var _0x328f10={'raw':!![],'where':{}};var _0xfea90e={};var _0x4ff3c4={'count':0x0,'rows':[]};return db[_0x6388('0x2f')][_0x6388('0x58')]({'where':{'id':_0x20ef25[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x302b8a,null))[_0x6388('0x26')](function(_0x36ebbd){if(_0x36ebbd){_0xfea90e['model']=_['keys'](db[_0x6388('0x61')][_0x6388('0x50')]);_0xfea90e[_0x6388('0x33')]=_[_0x6388('0x34')](_0x20ef25[_0x6388('0x33')]);_0xfea90e['filters']=_[_0x6388('0x36')](_0xfea90e['model'],_0xfea90e[_0x6388('0x33')]);_0x328f10[_0x6388('0x37')]=_['intersection'](_0xfea90e[_0x6388('0x32')],qs['fields'](_0x20ef25[_0x6388('0x33')][_0x6388('0x48')]));_0x328f10['attributes']=_0x328f10[_0x6388('0x37')][_0x6388('0x38')]?_0x328f10[_0x6388('0x37')]:_0xfea90e[_0x6388('0x32')];if(!_0x20ef25['query']['hasOwnProperty'](_0x6388('0x3a'))){_0x328f10[_0x6388('0x3b')]=qs[_0x6388('0x3b')](_0x20ef25[_0x6388('0x33')][_0x6388('0x3b')]);_0x328f10[_0x6388('0x1e')]=qs['offset'](_0x20ef25[_0x6388('0x33')][_0x6388('0x1e')]);}_0x328f10[_0x6388('0x59')]=qs[_0x6388('0x3c')](_0x20ef25[_0x6388('0x33')][_0x6388('0x3c')]);_0x328f10[_0x6388('0x3d')]=qs['filters'](_[_0x6388('0x3e')](_0x20ef25[_0x6388('0x33')],_0xfea90e[_0x6388('0x35')]));_0x328f10[_0x6388('0x3d')]['CampaignId']=_0x36ebbd['id'];if(_0x20ef25[_0x6388('0x33')]['filter']){_0x328f10[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x328f10['where'],{'$or':_[_0x6388('0x2e')](_0x328f10[_0x6388('0x37')],function(_0x161eba){var _0x2ad106={};_0x2ad106[_0x161eba]={'$like':'%'+_0x20ef25[_0x6388('0x33')][_0x6388('0x3f')]+'%'};return _0x2ad106;})});}_0x328f10=_['merge']({},_0x328f10,_0x20ef25[_0x6388('0x49')]);return db[_0x6388('0x61')][_0x6388('0x1d')]({'where':_0x328f10[_0x6388('0x3d')]})['then'](function(_0x179938){_0x4ff3c4['count']=_0x179938;if(_0x20ef25[_0x6388('0x33')]['includeAll']){_0x328f10[_0x6388('0x43')]=[{'all':!![]}];}return db[_0x6388('0x61')]['findAll'](_0x328f10);})['then'](function(_0x35f7ac){_0x4ff3c4[_0x6388('0x45')]=_0x35f7ac;return _0x4ff3c4;});}})[_0x6388('0x26')](respondWithFilteredResult(_0x302b8a,_0x328f10))[_0x6388('0x46')](handleError(_0x302b8a,null));};exports[_0x6388('0x62')]=function(_0x28aa1e,_0x398db5,_0x4c2adc){var _0x485bb9={};var _0x1d1917={};var _0x56d6b0;var _0x529b92;return db['Campaign'][_0x6388('0x58')]({'where':{'id':_0x28aa1e[_0x6388('0x47')]['id']}})['then'](handleEntityNotFound(_0x398db5,null))[_0x6388('0x26')](function(_0x25006d){if(_0x25006d){_0x56d6b0=_0x25006d;_0x1d1917['model']=_[_0x6388('0x34')](db[_0x6388('0x63')]['rawAttributes']);_0x1d1917[_0x6388('0x33')]=_[_0x6388('0x34')](_0x28aa1e[_0x6388('0x33')]);_0x1d1917['filters']=_[_0x6388('0x36')](_0x1d1917['model'],_0x1d1917[_0x6388('0x33')]);_0x485bb9[_0x6388('0x37')]=_[_0x6388('0x36')](_0x1d1917[_0x6388('0x32')],qs[_0x6388('0x48')](_0x28aa1e[_0x6388('0x33')][_0x6388('0x48')]));_0x485bb9['attributes']=_0x485bb9[_0x6388('0x37')][_0x6388('0x38')]?_0x485bb9['attributes']:_0x1d1917[_0x6388('0x32')];_0x485bb9[_0x6388('0x59')]=qs[_0x6388('0x3c')](_0x28aa1e[_0x6388('0x33')][_0x6388('0x3c')]);_0x485bb9[_0x6388('0x3d')]=qs[_0x6388('0x35')](_[_0x6388('0x3e')](_0x28aa1e[_0x6388('0x33')],_0x1d1917[_0x6388('0x35')]));if(_0x28aa1e[_0x6388('0x33')][_0x6388('0x3f')]){_0x485bb9[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x485bb9['where'],{'$or':_[_0x6388('0x2e')](_0x485bb9[_0x6388('0x37')],function(_0x352b98){var _0x3c1641={};_0x3c1641[_0x352b98]={'$like':'%'+_0x28aa1e['query'][_0x6388('0x3f')]+'%'};return _0x3c1641;})});}_0x485bb9=_[_0x6388('0x40')]({},_0x485bb9,_0x28aa1e[_0x6388('0x49')]);return _0x56d6b0[_0x6388('0x62')](_0x485bb9);}})[_0x6388('0x26')](function(_0x545ac5){if(_0x545ac5){_0x529b92=_0x545ac5['length'];if(!_0x28aa1e[_0x6388('0x33')][_0x6388('0x39')](_0x6388('0x3a'))){_0x485bb9[_0x6388('0x3b')]=qs[_0x6388('0x3b')](_0x28aa1e['query'][_0x6388('0x3b')]);_0x485bb9[_0x6388('0x1e')]=qs[_0x6388('0x1e')](_0x28aa1e[_0x6388('0x33')]['offset']);}return _0x56d6b0[_0x6388('0x62')](_0x485bb9);}})['then'](function(_0x26e53b){if(_0x26e53b){return _0x26e53b?{'count':_0x529b92,'rows':_0x26e53b}:null;}})['then'](respondWithResult(_0x398db5,null))[_0x6388('0x46')](handleError(_0x398db5,null));};exports[_0x6388('0x64')]=function(_0x3dec0d,_0x506638,_0x25c766){var _0x2dc06d,_0x18767e;return db[_0x6388('0x2f')][_0x6388('0x4a')]({'where':{'id':_0x3dec0d[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x506638,null))[_0x6388('0x26')](function(_0x5efd55){if(_0x5efd55){_0x18767e=_0x5efd55;return _0x5efd55[_0x6388('0x64')](_0x3dec0d['body']['ids'],_['omit'](_0x3dec0d[_0x6388('0x53')],[_0x6388('0x65'),'id'])||{});}return null;})[_0x6388('0x66')](function(_0x281713){var _0x5d30ab;_0x2dc06d=_0x281713||[];var _0x2dd77a=[];if(_0x281713){for(var _0x584b45=0x0;_0x584b45<_0x281713[_0x6388('0x38')];_0x584b45+=0x1){var _0x5a64f9=_0x281713[_0x584b45][_0x6388('0x27')]({'plain':!![]});_0x18767e[_0x6388('0x67')]=_0x3dec0d[_0x6388('0x53')]['dialCheckDuplicateType']?_0x3dec0d[_0x6388('0x53')][_0x6388('0x67')]:_0x18767e['dialCheckDuplicateType'];switch(_0x18767e['dialCheckDuplicateType']){case'always':_0x5d30ab=squel[_0x6388('0x68')]()[_0x6388('0x69')](_0x6388('0x6a'))[_0x6388('0x6b')]([_0x6388('0x6c'),_0x6388('0x6d'),_0x6388('0x6e'),_0x6388('0x6f'),_0x6388('0x5a'),_0x6388('0x51'),'updatedAt'],squel[_0x6388('0x70')]()['field'](_0x6388('0x6c'),'phone')[_0x6388('0x71')](_0x6388('0x72'),_0x6388('0x6d'))[_0x6388('0x71')]('id',_0x6388('0x6e'))['field'](_0x5a64f9['CmListId'][_0x6388('0x73')](),_0x6388('0x6f'))[_0x6388('0x71')](_0x3dec0d['params']['id'][_0x6388('0x73')](),'CampaignId')[_0x6388('0x71')](_0x6388('0x72'),'createdAt')['field'](_0x6388('0x72'),_0x6388('0x52'))[_0x6388('0x74')](_0x6388('0x75'))['where'](_0x6388('0x76'))[_0x6388('0x3d')](_0x6388('0x77'),_0x5a64f9[_0x6388('0x78')][_0x6388('0x73')]())['where'](_0x6388('0x79'))['where'](_0x6388('0x7a'),squel['select']()[_0x6388('0x71')](_0x6388('0x7b'))[_0x6388('0x74')](_0x6388('0x7c'))[_0x6388('0x3d')](_0x6388('0x7d'),_0x3dec0d[_0x6388('0x47')]['id'][_0x6388('0x73')]()))[_0x6388('0x3d')](_0x6388('0x7a'),squel[_0x6388('0x70')]()[_0x6388('0x71')](_0x6388('0x7e'))[_0x6388('0x74')](_0x6388('0x6a'))['where']('CampaignId\x20=\x20?',_0x3dec0d[_0x6388('0x47')]['id'][_0x6388('0x73')]())))[_0x6388('0x73')]();break;case _0x6388('0x7f'):_0x5d30ab=squel[_0x6388('0x68')]()[_0x6388('0x69')](_0x6388('0x6a'))[_0x6388('0x6b')](['phone',_0x6388('0x6d'),_0x6388('0x6e'),_0x6388('0x6f'),_0x6388('0x5a'),_0x6388('0x51'),'updatedAt'],squel[_0x6388('0x70')]()[_0x6388('0x71')](_0x6388('0x6c'),'phone')[_0x6388('0x71')](_0x6388('0x72'),_0x6388('0x6d'))[_0x6388('0x71')]('id',_0x6388('0x6e'))[_0x6388('0x71')](_0x5a64f9[_0x6388('0x78')]['toString'](),_0x6388('0x6f'))[_0x6388('0x71')](_0x3dec0d[_0x6388('0x47')]['id']['toString'](),_0x6388('0x5a'))['field'](_0x6388('0x72'),_0x6388('0x51'))[_0x6388('0x71')](_0x6388('0x72'),'updatedAt')[_0x6388('0x74')](_0x6388('0x75'))[_0x6388('0x3d')]('deletedAt\x20IS\x20NULL')[_0x6388('0x3d')](_0x6388('0x77'),_0x5a64f9[_0x6388('0x78')][_0x6388('0x73')]())['where'](_0x6388('0x79'))[_0x6388('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6388('0x70')]()[_0x6388('0x71')](_0x6388('0x7e'))[_0x6388('0x74')](_0x6388('0x6a'))[_0x6388('0x3d')](_0x6388('0x7d'),_0x3dec0d['params']['id']['toString']())))[_0x6388('0x73')]();break;default:_0x5d30ab=squel[_0x6388('0x68')]()[_0x6388('0x69')](_0x6388('0x6a'))[_0x6388('0x6b')]([_0x6388('0x6c'),_0x6388('0x6d'),'ContactId',_0x6388('0x6f'),_0x6388('0x5a'),_0x6388('0x51'),_0x6388('0x52')],squel['select']()[_0x6388('0x71')](_0x6388('0x6c'),_0x6388('0x6c'))['field'](_0x6388('0x72'),_0x6388('0x6d'))['field']('id','ContactId')[_0x6388('0x71')](_0x5a64f9[_0x6388('0x78')][_0x6388('0x73')](),_0x6388('0x6f'))['field'](_0x3dec0d['params']['id'][_0x6388('0x73')](),_0x6388('0x5a'))[_0x6388('0x71')]('NOW()','createdAt')[_0x6388('0x71')]('NOW()','updatedAt')[_0x6388('0x74')](_0x6388('0x75'))[_0x6388('0x3d')]('deletedAt\x20IS\x20NULL')['where'](_0x6388('0x77'),_0x5a64f9[_0x6388('0x78')][_0x6388('0x73')]())[_0x6388('0x3d')](_0x6388('0x79')))['toString']();}_0x2dd77a[_0x6388('0x80')](db[_0x6388('0x81')]['query'](_0x5d30ab));}return BPromise[_0x6388('0x82')](_0x2dd77a);}})[_0x6388('0x26')](function(){return _0x2dc06d;})[_0x6388('0x26')](respondWithResult(_0x506638,null))[_0x6388('0x46')](handleError(_0x506638,null));};exports[_0x6388('0x83')]=function(_0x10f407,_0x5a5442,_0x143efa){return db['Campaign']['find']({'where':{'id':_0x10f407['params']['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x5a5442,null))[_0x6388('0x26')](function(_0x12c654){if(_0x12c654){return _0x12c654[_0x6388('0x83')](_0x10f407[_0x6388('0x33')][_0x6388('0x65')]);}})[_0x6388('0x26')](function(_0x18f379){if(_0x18f379){return db[_0x6388('0x5b')][_0x6388('0x25')]({'where':{'ListId':_0x10f407[_0x6388('0x33')][_0x6388('0x65')],'CampaignId':_0x10f407[_0x6388('0x47')]['id']}})[_0x6388('0x26')](function(){return _0x18f379;});}})[_0x6388('0x26')](respondWithStatusCode(_0x5a5442,null))['catch'](handleError(_0x5a5442,null));};exports[_0x6388('0x84')]=function(_0x41d808,_0x35423c,_0xef6687){var _0x255b10={'raw':!![],'where':{}};var _0x251f84={};var _0x40722b={'count':0x0,'rows':[]};return db[_0x6388('0x2f')]['findOne']({'where':{'id':_0x41d808[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x35423c,null))[_0x6388('0x26')](function(_0x2b35ae){if(_0x2b35ae){_0x251f84[_0x6388('0x32')]=_[_0x6388('0x34')](db['CmList']['rawAttributes']);_0x251f84[_0x6388('0x33')]=_[_0x6388('0x34')](_0x41d808['query']);_0x251f84[_0x6388('0x35')]=_[_0x6388('0x36')](_0x251f84[_0x6388('0x32')],_0x251f84[_0x6388('0x33')]);_0x255b10[_0x6388('0x37')]=_['intersection'](_0x251f84['model'],qs[_0x6388('0x48')](_0x41d808['query']['fields']));_0x255b10['attributes']=_0x255b10[_0x6388('0x37')][_0x6388('0x38')]?_0x255b10[_0x6388('0x37')]:_0x251f84['model'];if(!_0x41d808[_0x6388('0x33')][_0x6388('0x39')](_0x6388('0x3a'))){_0x255b10[_0x6388('0x3b')]=qs[_0x6388('0x3b')](_0x41d808['query'][_0x6388('0x3b')]);_0x255b10[_0x6388('0x1e')]=qs[_0x6388('0x1e')](_0x41d808[_0x6388('0x33')][_0x6388('0x1e')]);}_0x255b10[_0x6388('0x59')]=qs[_0x6388('0x3c')](_0x41d808[_0x6388('0x33')][_0x6388('0x3c')]);_0x255b10[_0x6388('0x3d')]=qs[_0x6388('0x35')](_[_0x6388('0x3e')](_0x41d808[_0x6388('0x33')],_0x251f84[_0x6388('0x35')]));_0x255b10[_0x6388('0x3d')][_0x6388('0x5a')]=_0x2b35ae['id'];if(_0x41d808[_0x6388('0x33')][_0x6388('0x3f')]){_0x255b10[_0x6388('0x3d')]=_[_0x6388('0x40')](_0x255b10[_0x6388('0x3d')],{'$or':_[_0x6388('0x2e')](_0x255b10[_0x6388('0x37')],function(_0x4726d1){var _0x2b3ec9={};_0x2b3ec9[_0x4726d1]={'$like':'%'+_0x41d808[_0x6388('0x33')][_0x6388('0x3f')]+'%'};return _0x2b3ec9;})});}_0x255b10=_[_0x6388('0x40')]({},_0x255b10,_0x41d808['options']);return db[_0x6388('0x63')][_0x6388('0x1d')]({'where':_0x255b10['where']})[_0x6388('0x26')](function(_0x23d71a){_0x40722b[_0x6388('0x1d')]=_0x23d71a;if(_0x41d808[_0x6388('0x33')][_0x6388('0x42')]){_0x255b10[_0x6388('0x43')]=[{'all':!![]}];}return db['CmList'][_0x6388('0x44')](_0x255b10);})[_0x6388('0x26')](function(_0xbeda80){_0x40722b[_0x6388('0x45')]=_0xbeda80;return _0x40722b;});}})[_0x6388('0x26')](respondWithFilteredResult(_0x35423c,_0x255b10))['catch'](handleError(_0x35423c,null));};exports[_0x6388('0x85')]=function(_0x3e5ceb,_0x590dac,_0x11addb){var _0x205eaf,_0x3945d3;return db[_0x6388('0x2f')]['find']({'where':{'id':_0x3e5ceb['params']['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x590dac,null))['then'](function(_0xfe9d5d){if(_0xfe9d5d){_0x3945d3=_0xfe9d5d;return _0xfe9d5d['addBlackLists'](_0x3e5ceb['body'][_0x6388('0x65')],_['omit'](_0x3e5ceb[_0x6388('0x53')],[_0x6388('0x65'),'id'])||{});}return null;})[_0x6388('0x66')](function(_0x51d89f){var _0x4f60a5;_0x205eaf=_0x51d89f||[];var _0x4cd57f=[];if(_0x51d89f){for(var _0x56cd62=0x0;_0x56cd62<_0x51d89f[_0x6388('0x38')];_0x56cd62+=0x1){var _0x32ab51=_0x51d89f[_0x56cd62]['get']({'plain':!![]});_0x4f60a5=squel[_0x6388('0x68')]()[_0x6388('0x69')](_0x6388('0x86'))[_0x6388('0x6b')](['phone',_0x6388('0x6e'),_0x6388('0x6f'),_0x6388('0x5a'),'createdAt','updatedAt'],squel[_0x6388('0x70')]()[_0x6388('0x71')](_0x6388('0x6c'),_0x6388('0x6c'))[_0x6388('0x71')]('id','ContactId')[_0x6388('0x71')](_0x32ab51[_0x6388('0x78')][_0x6388('0x73')](),_0x6388('0x6f'))[_0x6388('0x71')](_0x3e5ceb[_0x6388('0x47')]['id'][_0x6388('0x73')](),'CampaignId')['field'](_0x6388('0x72'),'createdAt')[_0x6388('0x71')](_0x6388('0x72'),_0x6388('0x52'))[_0x6388('0x74')]('cm_contacts')[_0x6388('0x3d')](_0x6388('0x76'))[_0x6388('0x3d')](_0x6388('0x77'),_0x32ab51[_0x6388('0x78')][_0x6388('0x73')]())['where'](_0x6388('0x79')))[_0x6388('0x73')]();_0x4cd57f[_0x6388('0x80')](db[_0x6388('0x81')][_0x6388('0x33')](_0x4f60a5));}return BPromise[_0x6388('0x82')](_0x4cd57f);}})['then'](function(){return _0x205eaf;})[_0x6388('0x26')](respondWithResult(_0x590dac,null))[_0x6388('0x46')](handleError(_0x590dac,null));};exports[_0x6388('0x87')]=function(_0x1b5fed,_0x1dc16e,_0x32dda8){return db[_0x6388('0x2f')][_0x6388('0x4a')]({'where':{'id':_0x1b5fed[_0x6388('0x47')]['id']}})[_0x6388('0x26')](handleEntityNotFound(_0x1dc16e,null))['then'](function(_0x5d5e04){if(_0x5d5e04){return _0x5d5e04[_0x6388('0x87')](_0x1b5fed[_0x6388('0x33')][_0x6388('0x65')]);}})[_0x6388('0x26')](function(_0x550605){if(_0x550605){return db[_0x6388('0x61')][_0x6388('0x25')]({'where':{'ListId':_0x1b5fed[_0x6388('0x33')][_0x6388('0x65')],'CampaignId':_0x1b5fed['params']['id']}})[_0x6388('0x26')](function(){return _0x550605;});}})[_0x6388('0x26')](respondWithStatusCode(_0x1dc16e,null))[_0x6388('0x46')](handleError(_0x1dc16e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d2f86a2..e9035e9 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 _0xd114=['api','request-promise','path','rimraf','../../config/environment','exports','define','Campaign','lodash','../../config/logger'];(function(_0x131c81,_0x12fe63){var _0x241e7a=function(_0x3e48b7){while(--_0x3e48b7){_0x131c81['push'](_0x131c81['shift']());}};_0x241e7a(++_0x12fe63);}(_0xd114,0x1ca));var _0x4d11=function(_0x595d61,_0x2c2a0a){_0x595d61=_0x595d61-0x0;var _0x269de5=_0xd114[_0x595d61];return _0x269de5;};'use strict';var _=require(_0x4d11('0x0'));var util=require('util');var logger=require(_0x4d11('0x1'))(_0x4d11('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d11('0x3'));var fs=require('fs');var path=require(_0x4d11('0x4'));var rimraf=require(_0x4d11('0x5'));var config=require(_0x4d11('0x6'));var attributes=require('./campaign.attributes');module[_0x4d11('0x7')]=function(_0x84b86a,_0xf3897d){return _0x84b86a[_0x4d11('0x8')](_0x4d11('0x9'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd312=['moment','bluebird','path','../../config/environment','./campaign.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xd312,0x1bf));var _0x2d31=function(_0x5d3e9e,_0x105f57){_0x5d3e9e=_0x5d3e9e-0x0;var _0x2de319=_0xd312[_0x5d3e9e];return _0x2de319;};'use strict';var _=require(_0x2d31('0x0'));var util=require(_0x2d31('0x1'));var logger=require(_0x2d31('0x2'))(_0x2d31('0x3'));var moment=require(_0x2d31('0x4'));var BPromise=require(_0x2d31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d31('0x6'));var rimraf=require('rimraf');var config=require(_0x2d31('0x7'));var attributes=require(_0x2d31('0x8'));module[_0x2d31('0x9')]=function(_0xf61f9f,_0x509a76){return _0xf61f9f[_0x2d31('0xa')]('Campaign',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 8fa8ff0..19739ea 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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x28cc96,_0x2bd849){var _0x3414f4=function(_0x4a5123){while(--_0x4a5123){_0x28cc96['push'](_0x28cc96['shift']());}};_0x3414f4(++_0x2bd849);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 38a0fc8..55dc1d1 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 _0xc38e=['put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists'];(function(_0xd95b05,_0x46018d){var _0x109df8=function(_0x1747b3){while(--_0x1747b3){_0xd95b05['push'](_0xd95b05['shift']());}};_0x109df8(++_0x46018d);}(_0xc38e,0x19e));var _0xec38=function(_0x346def,_0x526e5b){_0x346def=_0x346def-0x0;var _0x565a7d=_0xc38e[_0x346def];return _0x565a7d;};'use strict';var multer=require(_0xec38('0x0'));var util=require(_0xec38('0x1'));var path=require(_0xec38('0x2'));var timeout=require('connect-timeout');var express=require(_0xec38('0x3'));var router=express[_0xec38('0x4')]();var auth=require(_0xec38('0x5'));var interaction=require(_0xec38('0x6'));var config=require('../../config/environment');var controller=require(_0xec38('0x7'));router[_0xec38('0x8')]('/',auth[_0xec38('0x9')](),controller[_0xec38('0xa')]);router[_0xec38('0x8')](_0xec38('0xb'),auth['isAuthenticated'](),controller[_0xec38('0xc')]);router[_0xec38('0x8')](_0xec38('0xd'),auth[_0xec38('0x9')](),controller[_0xec38('0xe')]);router[_0xec38('0x8')](_0xec38('0xf'),auth['isAuthenticated'](),controller[_0xec38('0x10')]);router[_0xec38('0x8')](_0xec38('0x11'),auth[_0xec38('0x9')](),controller[_0xec38('0x12')]);router[_0xec38('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xec38('0x8')](_0xec38('0x13'),auth[_0xec38('0x9')](),controller[_0xec38('0x14')]);router[_0xec38('0x8')]('/:id/blacklists',auth[_0xec38('0x9')](),controller[_0xec38('0x15')]);router[_0xec38('0x16')]('/',auth[_0xec38('0x9')](),controller[_0xec38('0x17')]);router[_0xec38('0x16')](_0xec38('0x18'),auth[_0xec38('0x9')](),controller[_0xec38('0x19')]);router[_0xec38('0x16')]('/:id/lists',auth[_0xec38('0x9')](),controller[_0xec38('0x1a')]);router[_0xec38('0x16')](_0xec38('0x1b'),auth[_0xec38('0x9')](),controller['addBlackLists']);router[_0xec38('0x1c')](_0xec38('0xb'),auth[_0xec38('0x9')](),controller['update']);router[_0xec38('0x1d')](_0xec38('0xb'),auth[_0xec38('0x9')](),controller[_0xec38('0x1e')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0xec38('0x1f')]);router[_0xec38('0x1d')](_0xec38('0x1b'),auth[_0xec38('0x9')](),controller[_0xec38('0x20')]);module[_0xec38('0x21')]=router; \ No newline at end of file +var _0x78e2=['removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','update','destroy','delete','/:id/lists'];(function(_0x5406ab,_0x10ddda){var _0x47e633=function(_0x116721){while(--_0x116721){_0x5406ab['push'](_0x5406ab['shift']());}};_0x47e633(++_0x10ddda);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x278e('0x0'));var util=require(_0x278e('0x1'));var path=require(_0x278e('0x2'));var timeout=require(_0x278e('0x3'));var express=require(_0x278e('0x4'));var router=express['Router']();var auth=require(_0x278e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x278e('0x6'));var controller=require(_0x278e('0x7'));router[_0x278e('0x8')]('/',auth[_0x278e('0x9')](),controller[_0x278e('0xa')]);router[_0x278e('0x8')](_0x278e('0xb'),auth[_0x278e('0x9')](),controller[_0x278e('0xc')]);router[_0x278e('0x8')](_0x278e('0xd'),auth[_0x278e('0x9')](),controller[_0x278e('0xe')]);router[_0x278e('0x8')](_0x278e('0xf'),auth['isAuthenticated'](),controller[_0x278e('0x10')]);router[_0x278e('0x8')](_0x278e('0x11'),auth[_0x278e('0x9')](),controller[_0x278e('0x12')]);router[_0x278e('0x8')](_0x278e('0x13'),auth['isAuthenticated'](),controller[_0x278e('0x14')]);router[_0x278e('0x8')]('/:id/lists',auth[_0x278e('0x9')](),controller['getLists']);router[_0x278e('0x8')]('/:id/blacklists',auth[_0x278e('0x9')](),controller[_0x278e('0x15')]);router[_0x278e('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x278e('0x16')](_0x278e('0x17'),auth['isAuthenticated'](),controller[_0x278e('0x18')]);router[_0x278e('0x16')]('/:id/lists',auth[_0x278e('0x9')](),controller[_0x278e('0x19')]);router[_0x278e('0x16')]('/:id/blacklists',auth[_0x278e('0x9')](),controller[_0x278e('0x1a')]);router['put'](_0x278e('0xb'),auth[_0x278e('0x9')](),controller[_0x278e('0x1b')]);router['delete'](_0x278e('0xb'),auth[_0x278e('0x9')](),controller[_0x278e('0x1c')]);router[_0x278e('0x1d')](_0x278e('0x1e'),auth[_0x278e('0x9')](),controller[_0x278e('0x1f')]);router['delete'](_0x278e('0x20'),auth[_0x278e('0x9')](),controller[_0x278e('0x21')]);module[_0x278e('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c2a9f4c..1abb658 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 _0x1969=['STRING','VIRTUAL','getDataValue','key'];(function(_0x4e0112,_0x5a15c5){var _0x35bd7b=function(_0x14882f){while(--_0x14882f){_0x4e0112['push'](_0x4e0112['shift']());}};_0x35bd7b(++_0x5a15c5);}(_0x1969,0xf8));var _0x9196=function(_0x3f1429,_0x4b8b36){_0x3f1429=_0x3f1429-0x0;var _0x5da482=_0x1969[_0x3f1429];return _0x5da482;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x9196('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x9196('0x0')]},'name':{'type':Sequelize[_0x9196('0x1')],'get':function(){return this[_0x9196('0x2')](_0x9196('0x3'));}}}; \ No newline at end of file +var _0x1268=['VIRTUAL','getDataValue','sequelize','exports','TEXT'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x1268,0xde));var _0x8126=function(_0x127576,_0x1308c6){_0x127576=_0x127576-0x0;var _0x5e87eb=_0x1268[_0x127576];return _0x5e87eb;};'use strict';var Sequelize=require(_0x8126('0x0'));module[_0x8126('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8126('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8126('0x3')],'get':function(){return this[_0x8126('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 672ca87..409cfbc 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 _0xfbf4=['hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','count','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','CannedAnswers','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf4,0x186));var _0x4fbf=function(_0x57c3a1,_0x3e9b2a){_0x57c3a1=_0x57c3a1-0x0;var _0x1e0084=_0xfbf4[_0x57c3a1];return _0x1e0084;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4fbf('0x0'));var rimraf=require(_0x4fbf('0x1'));var zipdir=require(_0x4fbf('0x2'));var jsonpatch=require(_0x4fbf('0x3'));var rp=require('request-promise');var moment=require(_0x4fbf('0x4'));var BPromise=require(_0x4fbf('0x5'));var Mustache=require('mustache');var util=require(_0x4fbf('0x6'));var path=require(_0x4fbf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4fbf('0x8'));var fs=require('fs');var _=require(_0x4fbf('0x9'));var squel=require(_0x4fbf('0xa'));var crypto=require(_0x4fbf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4fbf('0xc'));var toCsv=require(_0x4fbf('0xd'));var querystring=require(_0x4fbf('0xe'));var Papa=require(_0x4fbf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4fbf('0x10'));var as=require(_0x4fbf('0x11'));var hardwareService=require(_0x4fbf('0x12'));var logger=require(_0x4fbf('0x13'))(_0x4fbf('0x14'));var utils=require(_0x4fbf('0x15'));var config=require('../../config/environment');var db=require(_0x4fbf('0x16'))['db'];function respondWithStatusCode(_0x51093b,_0x5ddfa2){_0x5ddfa2=_0x5ddfa2||0xcc;return function(_0x588178){if(_0x588178){return _0x51093b[_0x4fbf('0x17')](_0x5ddfa2);}return _0x51093b[_0x4fbf('0x18')](_0x5ddfa2)[_0x4fbf('0x19')]();};}function respondWithResult(_0x78b43e,_0x1ee996){_0x1ee996=_0x1ee996||0xc8;return function(_0x4216ac){if(_0x4216ac){return _0x78b43e[_0x4fbf('0x18')](_0x1ee996)[_0x4fbf('0x1a')](_0x4216ac);}};}function respondWithFilteredResult(_0x485cb6,_0x402744){return function(_0x483be2){if(_0x483be2){var _0x584e22=_0x483be2['count'],_0x132deb=_0x402744['offset'],_0x44480d=_0x402744[_0x4fbf('0x1b')]+_0x402744[_0x4fbf('0x1c')],_0x5c1bfb;if(_0x44480d>=_0x584e22){_0x44480d=_0x584e22;_0x5c1bfb=0xc8;}else{_0x5c1bfb=0xce;}_0x485cb6['status'](_0x5c1bfb);return _0x485cb6[_0x4fbf('0x1d')](_0x4fbf('0x1e'),_0x132deb+'-'+_0x44480d+'/'+_0x584e22)[_0x4fbf('0x1a')](_0x483be2);}return null;};}function patchUpdates(_0x472f55){return function(_0x1e2c62){try{jsonpatch[_0x4fbf('0x1f')](_0x1e2c62,_0x472f55,!![]);}catch(_0x19234d){return BPromise[_0x4fbf('0x20')](_0x19234d);}return _0x1e2c62['save']();};}function saveUpdates(_0x1bdfd0,_0x33136b){return function(_0xc2b74a){if(_0xc2b74a){return _0xc2b74a[_0x4fbf('0x21')](_0x1bdfd0)[_0x4fbf('0x22')](function(_0x5ddbbf){return _0x5ddbbf;});}return null;};}function removeEntity(_0x391689,_0x3a6a5b){return function(_0x2d967c){if(_0x2d967c){return _0x2d967c[_0x4fbf('0x23')]()[_0x4fbf('0x22')](function(){var _0x360f03=_0x2d967c['get']({'plain':!![]});var _0x20c6de=_0x4fbf('0x24');return db['UserProfileResource'][_0x4fbf('0x23')]({'where':{'type':_0x20c6de,'resourceId':_0x360f03['id']}})[_0x4fbf('0x22')](function(){return _0x2d967c;});})[_0x4fbf('0x22')](function(){_0x391689['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e15a,_0x49ce1c){return function(_0x3066c9){if(!_0x3066c9){_0x59e15a[_0x4fbf('0x17')](0x194);}return _0x3066c9;};}function handleError(_0x15be35,_0x5538b8){_0x5538b8=_0x5538b8||0x1f4;return function(_0x308674){logger[_0x4fbf('0x25')](_0x308674[_0x4fbf('0x26')]);if(_0x308674['name']){delete _0x308674[_0x4fbf('0x27')];}_0x15be35['status'](_0x5538b8)[_0x4fbf('0x28')](_0x308674);};}exports[_0x4fbf('0x29')]=function(_0x342437,_0x319f4f){var _0x4ab43f={},_0xee333a={},_0x436682={'count':0x0,'rows':[]};var _0x2e6e3a=_['map'](db[_0x4fbf('0x2a')][_0x4fbf('0x2b')],function(_0x2d7217){return{'name':_0x2d7217[_0x4fbf('0x2c')],'type':_0x2d7217[_0x4fbf('0x2d')][_0x4fbf('0x2e')]};});_0xee333a[_0x4fbf('0x2f')]=_['map'](_0x2e6e3a,_0x4fbf('0x27'));_0xee333a[_0x4fbf('0x30')]=_[_0x4fbf('0x31')](_0x342437[_0x4fbf('0x30')]);_0xee333a[_0x4fbf('0x32')]=_[_0x4fbf('0x33')](_0xee333a['model'],_0xee333a[_0x4fbf('0x30')]);_0x4ab43f[_0x4fbf('0x34')]=_[_0x4fbf('0x33')](_0xee333a['model'],qs[_0x4fbf('0x35')](_0x342437[_0x4fbf('0x30')][_0x4fbf('0x35')]));_0x4ab43f[_0x4fbf('0x34')]=_0x4ab43f[_0x4fbf('0x34')][_0x4fbf('0x36')]?_0x4ab43f['attributes']:_0xee333a['model'];if(!_0x342437['query'][_0x4fbf('0x37')](_0x4fbf('0x38'))){_0x4ab43f[_0x4fbf('0x1c')]=qs[_0x4fbf('0x1c')](_0x342437['query'][_0x4fbf('0x1c')]);_0x4ab43f['offset']=qs[_0x4fbf('0x1b')](_0x342437['query']['offset']);}_0x4ab43f[_0x4fbf('0x39')]=qs['sort'](_0x342437[_0x4fbf('0x30')]['sort']);_0x4ab43f[_0x4fbf('0x3a')]=qs[_0x4fbf('0x32')](_[_0x4fbf('0x3b')](_0x342437[_0x4fbf('0x30')],_0xee333a[_0x4fbf('0x32')]),_0x2e6e3a);if(_0x342437[_0x4fbf('0x30')][_0x4fbf('0x3c')]){_0x4ab43f['where']=_[_0x4fbf('0x3d')](_0x4ab43f['where'],{'$or':_[_0x4fbf('0x3e')](_0x2e6e3a,function(_0xa9e1d7){if(_0xa9e1d7[_0x4fbf('0x2d')]!==_0x4fbf('0x3f')){var _0x47bdba={};_0x47bdba[_0xa9e1d7[_0x4fbf('0x27')]]={'$like':'%'+_0x342437[_0x4fbf('0x30')]['filter']+'%'};return _0x47bdba;}})});}_0x4ab43f=_['merge']({},_0x4ab43f,_0x342437[_0x4fbf('0x40')]);var _0x33762d={'where':_0x4ab43f['where']};return db[_0x4fbf('0x2a')][_0x4fbf('0x41')](_0x33762d)['then'](function(_0x291fa4){_0x436682[_0x4fbf('0x41')]=_0x291fa4;if(_0x342437[_0x4fbf('0x30')]['includeAll']){_0x4ab43f[_0x4fbf('0x42')]=[{'all':!![]}];}return db[_0x4fbf('0x2a')][_0x4fbf('0x43')](_0x4ab43f);})[_0x4fbf('0x22')](function(_0x69ea7){_0x436682[_0x4fbf('0x44')]=_0x69ea7;return _0x436682;})[_0x4fbf('0x22')](respondWithFilteredResult(_0x319f4f,_0x4ab43f))[_0x4fbf('0x45')](handleError(_0x319f4f,null));};exports[_0x4fbf('0x46')]=function(_0x58ef81,_0x50559f){var _0x883075={'raw':!![],'where':{'id':_0x58ef81[_0x4fbf('0x47')]['id']}},_0x58f333={};_0x58f333[_0x4fbf('0x2f')]=_[_0x4fbf('0x31')](db[_0x4fbf('0x2a')][_0x4fbf('0x2b')]);_0x58f333['query']=_[_0x4fbf('0x31')](_0x58ef81['query']);_0x58f333[_0x4fbf('0x32')]=_['intersection'](_0x58f333[_0x4fbf('0x2f')],_0x58f333[_0x4fbf('0x30')]);_0x883075[_0x4fbf('0x34')]=_[_0x4fbf('0x33')](_0x58f333[_0x4fbf('0x2f')],qs['fields'](_0x58ef81[_0x4fbf('0x30')][_0x4fbf('0x35')]));_0x883075[_0x4fbf('0x34')]=_0x883075['attributes'][_0x4fbf('0x36')]?_0x883075[_0x4fbf('0x34')]:_0x58f333[_0x4fbf('0x2f')];if(_0x58ef81[_0x4fbf('0x30')]['includeAll']){_0x883075['include']=[{'all':!![]}];}_0x883075=_[_0x4fbf('0x3d')]({},_0x883075,_0x58ef81['options']);return db['CannedAnswer'][_0x4fbf('0x48')](_0x883075)[_0x4fbf('0x22')](handleEntityNotFound(_0x50559f,null))[_0x4fbf('0x22')](respondWithResult(_0x50559f,null))[_0x4fbf('0x45')](handleError(_0x50559f,null));};exports[_0x4fbf('0x21')]=function(_0x2457b6,_0x269fa7){if(_0x2457b6[_0x4fbf('0x49')]['id']){delete _0x2457b6[_0x4fbf('0x49')]['id'];}return db['CannedAnswer'][_0x4fbf('0x48')]({'where':{'id':_0x2457b6[_0x4fbf('0x47')]['id']}})[_0x4fbf('0x22')](handleEntityNotFound(_0x269fa7,null))['then'](saveUpdates(_0x2457b6[_0x4fbf('0x49')],null))[_0x4fbf('0x22')](respondWithResult(_0x269fa7,null))[_0x4fbf('0x45')](handleError(_0x269fa7,null));};exports[_0x4fbf('0x23')]=function(_0x35ea78,_0x1dbcc0){return db['CannedAnswer'][_0x4fbf('0x48')]({'where':{'id':_0x35ea78['params']['id']}})['then'](handleEntityNotFound(_0x1dbcc0,null))[_0x4fbf('0x22')](removeEntity(_0x1dbcc0,null))[_0x4fbf('0x45')](handleError(_0x1dbcc0,null));};exports[_0x4fbf('0x4a')]=function(_0x372c77,_0x3c5a8c){var _0xc46ace={'key':_0x372c77['body'][_0x4fbf('0x2e')]};if(_0x372c77[_0x4fbf('0x49')][_0x4fbf('0x4b')]){_0xc46ace[_0x4fbf('0x4b')]=_0x372c77[_0x4fbf('0x49')][_0x4fbf('0x4b')];}else if(_0x372c77[_0x4fbf('0x49')][_0x4fbf('0x4c')]){_0xc46ace[_0x4fbf('0x4c')]=_0x372c77[_0x4fbf('0x49')]['SmsAccountId'];}else if(_0x372c77[_0x4fbf('0x49')]['OpenchannelAccountId']){_0xc46ace[_0x4fbf('0x4d')]=_0x372c77[_0x4fbf('0x49')][_0x4fbf('0x4d')];}else if(_0x372c77[_0x4fbf('0x49')][_0x4fbf('0x4e')]){_0xc46ace[_0x4fbf('0x4e')]=_0x372c77[_0x4fbf('0x49')][_0x4fbf('0x4e')];}return db[_0x4fbf('0x2a')][_0x4fbf('0x48')]({'where':_0xc46ace})[_0x4fbf('0x22')](function(_0x267281){if(_0x267281){throw new db[(_0x4fbf('0x4f'))][(_0x4fbf('0x50'))](_0x4fbf('0x51'));}return db[_0x4fbf('0x2a')][_0x4fbf('0x4a')](_0x372c77[_0x4fbf('0x49')]);})[_0x4fbf('0x22')](function(_0x28f8ce){var _0x5e8174=_0x372c77[_0x4fbf('0x52')][_0x4fbf('0x53')]({'plain':!![]});if(!_0x5e8174)throw new Error(_0x4fbf('0x54'));if(_0x5e8174['role']===_0x4fbf('0x52')){var _0x4c16f6=_0x28f8ce[_0x4fbf('0x53')]({'plain':!![]});return db['UserProfileSection'][_0x4fbf('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x5e8174[_0x4fbf('0x55')]},'raw':!![]})['then'](function(_0x2acf48){if(_0x2acf48&&_0x2acf48[_0x4fbf('0x56')]===0x0){return db[_0x4fbf('0x57')][_0x4fbf('0x4a')]({'name':_0x4c16f6['name'],'resourceId':_0x4c16f6['id'],'type':_0x2acf48[_0x4fbf('0x27')],'sectionId':_0x2acf48['id']},{})[_0x4fbf('0x22')](function(){return _0x28f8ce;});}else{return _0x28f8ce;}})[_0x4fbf('0x45')](function(_0x2f54a1){logger[_0x4fbf('0x25')](_0x4fbf('0x58'),_0x2f54a1);throw _0x2f54a1;});}return _0x28f8ce;})[_0x4fbf('0x22')](respondWithResult(_0x3c5a8c,0xc9))['catch'](handleError(_0x3c5a8c,null));}; \ No newline at end of file +var _0xa9d7=['userProfileId','autoAssociation','UserProfileResource','error','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','get','CannedAnswers','destroy','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','findAll','then','catch','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','create','user','role','UserProfileSection'];(function(_0x1b35b1,_0xbd38a3){var _0x44a7f1=function(_0xe6fcc2){while(--_0xe6fcc2){_0x1b35b1['push'](_0x1b35b1['shift']());}};_0x44a7f1(++_0xbd38a3);}(_0xa9d7,0xf7));var _0x7a9d=function(_0x585c00,_0x543bee){_0x585c00=_0x585c00-0x0;var _0x306546=_0xa9d7[_0x585c00];return _0x306546;};'use strict';var pdf=require(_0x7a9d('0x0'));var emlformat=require(_0x7a9d('0x1'));var rimraf=require(_0x7a9d('0x2'));var zipdir=require(_0x7a9d('0x3'));var jsonpatch=require(_0x7a9d('0x4'));var rp=require(_0x7a9d('0x5'));var moment=require(_0x7a9d('0x6'));var BPromise=require(_0x7a9d('0x7'));var Mustache=require('mustache');var util=require(_0x7a9d('0x8'));var path=require(_0x7a9d('0x9'));var sox=require(_0x7a9d('0xa'));var csv=require(_0x7a9d('0xb'));var ejs=require(_0x7a9d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7a9d('0xd'));var crypto=require(_0x7a9d('0xe'));var jsforce=require(_0x7a9d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a9d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a9d('0x11'));var qs=require(_0x7a9d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a9d('0x13'));var logger=require('../../config/logger')(_0x7a9d('0x14'));var utils=require(_0x7a9d('0x15'));var config=require(_0x7a9d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6a03e,_0x5594e7){_0x5594e7=_0x5594e7||0xcc;return function(_0x3dd327){if(_0x3dd327){return _0x6a03e[_0x7a9d('0x17')](_0x5594e7);}return _0x6a03e[_0x7a9d('0x18')](_0x5594e7)[_0x7a9d('0x19')]();};}function respondWithResult(_0x1aad98,_0x416467){_0x416467=_0x416467||0xc8;return function(_0x180818){if(_0x180818){return _0x1aad98[_0x7a9d('0x18')](_0x416467)[_0x7a9d('0x1a')](_0x180818);}};}function respondWithFilteredResult(_0x1d5878,_0x132885){return function(_0x2be5){if(_0x2be5){var _0x152b1a=_0x2be5[_0x7a9d('0x1b')],_0x4b6fd0=_0x132885[_0x7a9d('0x1c')],_0x20665f=_0x132885[_0x7a9d('0x1c')]+_0x132885[_0x7a9d('0x1d')],_0x32d87c;if(_0x20665f>=_0x152b1a){_0x20665f=_0x152b1a;_0x32d87c=0xc8;}else{_0x32d87c=0xce;}_0x1d5878['status'](_0x32d87c);return _0x1d5878[_0x7a9d('0x1e')](_0x7a9d('0x1f'),_0x4b6fd0+'-'+_0x20665f+'/'+_0x152b1a)[_0x7a9d('0x1a')](_0x2be5);}return null;};}function patchUpdates(_0x2d9b70){return function(_0x430596){try{jsonpatch[_0x7a9d('0x20')](_0x430596,_0x2d9b70,!![]);}catch(_0x18c205){return BPromise[_0x7a9d('0x21')](_0x18c205);}return _0x430596['save']();};}function saveUpdates(_0x2b7555,_0x58a403){return function(_0x38021b){if(_0x38021b){return _0x38021b[_0x7a9d('0x22')](_0x2b7555)['then'](function(_0x1f3af5){return _0x1f3af5;});}return null;};}function removeEntity(_0x13f6f2,_0xb68928){return function(_0xc8c627){if(_0xc8c627){return _0xc8c627['destroy']()['then'](function(){var _0x4f71b0=_0xc8c627[_0x7a9d('0x23')]({'plain':!![]});var _0x21d39a=_0x7a9d('0x24');return db['UserProfileResource'][_0x7a9d('0x25')]({'where':{'type':_0x21d39a,'resourceId':_0x4f71b0['id']}})['then'](function(){return _0xc8c627;});})['then'](function(){_0x13f6f2[_0x7a9d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x962141,_0x50ac2a){return function(_0x2de1c0){if(!_0x2de1c0){_0x962141['sendStatus'](0x194);}return _0x2de1c0;};}function handleError(_0x4f9564,_0x255fd9){_0x255fd9=_0x255fd9||0x1f4;return function(_0x173a22){logger['error'](_0x173a22[_0x7a9d('0x26')]);if(_0x173a22[_0x7a9d('0x27')]){delete _0x173a22[_0x7a9d('0x27')];}_0x4f9564[_0x7a9d('0x18')](_0x255fd9)[_0x7a9d('0x28')](_0x173a22);};}exports['index']=function(_0x30cd95,_0x4b42de){var _0x10b877={},_0x184589={},_0x1d39db={'count':0x0,'rows':[]};var _0x463847=_[_0x7a9d('0x29')](db[_0x7a9d('0x2a')][_0x7a9d('0x2b')],function(_0x3c524d){return{'name':_0x3c524d[_0x7a9d('0x2c')],'type':_0x3c524d[_0x7a9d('0x2d')][_0x7a9d('0x2e')]};});_0x184589[_0x7a9d('0x2f')]=_['map'](_0x463847,_0x7a9d('0x27'));_0x184589[_0x7a9d('0x30')]=_[_0x7a9d('0x31')](_0x30cd95['query']);_0x184589['filters']=_['intersection'](_0x184589[_0x7a9d('0x2f')],_0x184589[_0x7a9d('0x30')]);_0x10b877[_0x7a9d('0x32')]=_[_0x7a9d('0x33')](_0x184589[_0x7a9d('0x2f')],qs[_0x7a9d('0x34')](_0x30cd95['query'][_0x7a9d('0x34')]));_0x10b877[_0x7a9d('0x32')]=_0x10b877['attributes'][_0x7a9d('0x35')]?_0x10b877['attributes']:_0x184589[_0x7a9d('0x2f')];if(!_0x30cd95[_0x7a9d('0x30')]['hasOwnProperty'](_0x7a9d('0x36'))){_0x10b877['limit']=qs[_0x7a9d('0x1d')](_0x30cd95[_0x7a9d('0x30')][_0x7a9d('0x1d')]);_0x10b877[_0x7a9d('0x1c')]=qs[_0x7a9d('0x1c')](_0x30cd95[_0x7a9d('0x30')]['offset']);}_0x10b877['order']=qs[_0x7a9d('0x37')](_0x30cd95[_0x7a9d('0x30')][_0x7a9d('0x37')]);_0x10b877[_0x7a9d('0x38')]=qs[_0x7a9d('0x39')](_['pick'](_0x30cd95[_0x7a9d('0x30')],_0x184589[_0x7a9d('0x39')]),_0x463847);if(_0x30cd95[_0x7a9d('0x30')][_0x7a9d('0x3a')]){_0x10b877[_0x7a9d('0x38')]=_['merge'](_0x10b877[_0x7a9d('0x38')],{'$or':_[_0x7a9d('0x29')](_0x463847,function(_0x3157f8){if(_0x3157f8['type']!=='VIRTUAL'){var _0xa502ed={};_0xa502ed[_0x3157f8[_0x7a9d('0x27')]]={'$like':'%'+_0x30cd95[_0x7a9d('0x30')][_0x7a9d('0x3a')]+'%'};return _0xa502ed;}})});}_0x10b877=_[_0x7a9d('0x3b')]({},_0x10b877,_0x30cd95[_0x7a9d('0x3c')]);var _0x143a82={'where':_0x10b877['where']};return db[_0x7a9d('0x2a')][_0x7a9d('0x1b')](_0x143a82)['then'](function(_0x169c52){_0x1d39db[_0x7a9d('0x1b')]=_0x169c52;if(_0x30cd95[_0x7a9d('0x30')][_0x7a9d('0x3d')]){_0x10b877['include']=[{'all':!![]}];}return db[_0x7a9d('0x2a')][_0x7a9d('0x3e')](_0x10b877);})[_0x7a9d('0x3f')](function(_0xd60d50){_0x1d39db['rows']=_0xd60d50;return _0x1d39db;})[_0x7a9d('0x3f')](respondWithFilteredResult(_0x4b42de,_0x10b877))[_0x7a9d('0x40')](handleError(_0x4b42de,null));};exports['show']=function(_0xa3cfad,_0x14ff20){var _0x3b4150={'raw':!![],'where':{'id':_0xa3cfad['params']['id']}},_0x166f63={};_0x166f63[_0x7a9d('0x2f')]=_['keys'](db[_0x7a9d('0x2a')][_0x7a9d('0x2b')]);_0x166f63['query']=_['keys'](_0xa3cfad['query']);_0x166f63['filters']=_[_0x7a9d('0x33')](_0x166f63['model'],_0x166f63[_0x7a9d('0x30')]);_0x3b4150[_0x7a9d('0x32')]=_['intersection'](_0x166f63[_0x7a9d('0x2f')],qs['fields'](_0xa3cfad[_0x7a9d('0x30')][_0x7a9d('0x34')]));_0x3b4150[_0x7a9d('0x32')]=_0x3b4150['attributes'][_0x7a9d('0x35')]?_0x3b4150[_0x7a9d('0x32')]:_0x166f63[_0x7a9d('0x2f')];if(_0xa3cfad[_0x7a9d('0x30')][_0x7a9d('0x3d')]){_0x3b4150['include']=[{'all':!![]}];}_0x3b4150=_['merge']({},_0x3b4150,_0xa3cfad['options']);return db[_0x7a9d('0x2a')][_0x7a9d('0x41')](_0x3b4150)['then'](handleEntityNotFound(_0x14ff20,null))[_0x7a9d('0x3f')](respondWithResult(_0x14ff20,null))[_0x7a9d('0x40')](handleError(_0x14ff20,null));};exports[_0x7a9d('0x22')]=function(_0x53e723,_0x425ae4){if(_0x53e723[_0x7a9d('0x42')]['id']){delete _0x53e723[_0x7a9d('0x42')]['id'];}return db['CannedAnswer'][_0x7a9d('0x41')]({'where':{'id':_0x53e723[_0x7a9d('0x43')]['id']}})[_0x7a9d('0x3f')](handleEntityNotFound(_0x425ae4,null))[_0x7a9d('0x3f')](saveUpdates(_0x53e723[_0x7a9d('0x42')],null))[_0x7a9d('0x3f')](respondWithResult(_0x425ae4,null))['catch'](handleError(_0x425ae4,null));};exports[_0x7a9d('0x25')]=function(_0x33af29,_0x1b7dc2){return db[_0x7a9d('0x2a')][_0x7a9d('0x41')]({'where':{'id':_0x33af29['params']['id']}})['then'](handleEntityNotFound(_0x1b7dc2,null))[_0x7a9d('0x3f')](removeEntity(_0x1b7dc2,null))[_0x7a9d('0x40')](handleError(_0x1b7dc2,null));};exports['create']=function(_0x239e98,_0x531ddf){var _0x653f0d={'key':_0x239e98[_0x7a9d('0x42')][_0x7a9d('0x2e')]};if(_0x239e98['body'][_0x7a9d('0x44')]){_0x653f0d[_0x7a9d('0x44')]=_0x239e98['body']['MailAccountId'];}else if(_0x239e98['body'][_0x7a9d('0x45')]){_0x653f0d['SmsAccountId']=_0x239e98[_0x7a9d('0x42')][_0x7a9d('0x45')];}else if(_0x239e98[_0x7a9d('0x42')]['OpenchannelAccountId']){_0x653f0d[_0x7a9d('0x46')]=_0x239e98[_0x7a9d('0x42')][_0x7a9d('0x46')];}else if(_0x239e98[_0x7a9d('0x42')][_0x7a9d('0x47')]){_0x653f0d['ChatWebsiteId']=_0x239e98['body']['ChatWebsiteId'];}return db[_0x7a9d('0x2a')][_0x7a9d('0x41')]({'where':_0x653f0d})[_0x7a9d('0x3f')](function(_0x4ff743){if(_0x4ff743){throw new db['Sequelize'][(_0x7a9d('0x48'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x7a9d('0x2a')][_0x7a9d('0x49')](_0x239e98[_0x7a9d('0x42')]);})[_0x7a9d('0x3f')](function(_0xb0662c){var _0x5d550d=_0x239e98[_0x7a9d('0x4a')][_0x7a9d('0x23')]({'plain':!![]});if(!_0x5d550d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d550d[_0x7a9d('0x4b')]===_0x7a9d('0x4a')){var _0x51d3f8=_0xb0662c['get']({'plain':!![]});return db[_0x7a9d('0x4c')]['find']({'where':{'name':_0x7a9d('0x24'),'userProfileId':_0x5d550d[_0x7a9d('0x4d')]},'raw':!![]})[_0x7a9d('0x3f')](function(_0x10853c){if(_0x10853c&&_0x10853c[_0x7a9d('0x4e')]===0x0){return db[_0x7a9d('0x4f')]['create']({'name':_0x51d3f8['name'],'resourceId':_0x51d3f8['id'],'type':_0x10853c[_0x7a9d('0x27')],'sectionId':_0x10853c['id']},{})['then'](function(){return _0xb0662c;});}else{return _0xb0662c;}})[_0x7a9d('0x40')](function(_0x5cba00){logger[_0x7a9d('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cba00);throw _0x5cba00;});}return _0xb0662c;})[_0x7a9d('0x3f')](respondWithResult(_0x531ddf,0xc9))['catch'](handleError(_0x531ddf,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7089379..f31daac 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 _0x3bb3=['CannedAnswer','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define'];(function(_0x21a563,_0x162159){var _0x3dd060=function(_0x148b27){while(--_0x148b27){_0x21a563['push'](_0x21a563['shift']());}};_0x3dd060(++_0x162159);}(_0x3bb3,0x9e));var _0x33bb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3bb3[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x33bb('0x0'));var util=require(_0x33bb('0x1'));var logger=require(_0x33bb('0x2'))(_0x33bb('0x3'));var moment=require(_0x33bb('0x4'));var BPromise=require(_0x33bb('0x5'));var rp=require(_0x33bb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33bb('0x7'));var config=require(_0x33bb('0x8'));var attributes=require(_0x33bb('0x9'));module['exports']=function(_0xc8304f,_0x8592e5){return _0xc8304f[_0x33bb('0xa')](_0x33bb('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x33bb('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xee17=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4_unicode_ci'];(function(_0x36bf52,_0x5491b3){var _0x114711=function(_0x2492dd){while(--_0x2492dd){_0x36bf52['push'](_0x36bf52['shift']());}};_0x114711(++_0x5491b3);}(_0xee17,0x1c7));var _0x7ee1=function(_0x3719d0,_0x185d9c){_0x3719d0=_0x3719d0-0x0;var _0x3155e9=_0xee17[_0x3719d0];return _0x3155e9;};'use strict';var _=require(_0x7ee1('0x0'));var util=require(_0x7ee1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7ee1('0x2'));var BPromise=require(_0x7ee1('0x3'));var rp=require(_0x7ee1('0x4'));var fs=require('fs');var path=require(_0x7ee1('0x5'));var rimraf=require(_0x7ee1('0x6'));var config=require(_0x7ee1('0x7'));var attributes=require(_0x7ee1('0x8'));module[_0x7ee1('0x9')]=function(_0x14c927,_0x1e7ee4){return _0x14c927[_0x7ee1('0xa')](_0x7ee1('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7ee1('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 1f6fc05..6e9018a 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 _0xef86=['jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x30f325,_0x552d86){var _0x2617a7=function(_0x4d41bc){while(--_0x4d41bc){_0x30f325['push'](_0x30f325['shift']());}};_0x2617a7(++_0x552d86);}(_0xef86,0x121));var _0x6ef8=function(_0x3f3fc3,_0x406b23){_0x3f3fc3=_0x3f3fc3-0x0;var _0x5e6de6=_0xef86[_0x3f3fc3];return _0x5e6de6;};'use strict';var _=require('lodash');var util=require(_0x6ef8('0x0'));var moment=require(_0x6ef8('0x1'));var BPromise=require(_0x6ef8('0x2'));var rs=require(_0x6ef8('0x3'));var fs=require('fs');var Redis=require(_0x6ef8('0x4'));var db=require(_0x6ef8('0x5'))['db'];var utils=require(_0x6ef8('0x6'));var logger=require(_0x6ef8('0x7'))(_0x6ef8('0x8'));var config=require(_0x6ef8('0x9'));var jayson=require(_0x6ef8('0xa'));var client=jayson['client'][_0x6ef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2109eb,_0x3d50be,_0x1dce53){return new BPromise(function(_0x4ad815,_0x1cd743){return client[_0x6ef8('0xc')](_0x2109eb,_0x1dce53)[_0x6ef8('0xd')](function(_0x13ab57){logger[_0x6ef8('0xe')](_0x6ef8('0xf'),_0x3d50be,_0x6ef8('0x10'));logger[_0x6ef8('0x11')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x3d50be,'request\x20sent',JSON[_0x6ef8('0x12')](_0x13ab57));if(_0x13ab57['error']){if(_0x13ab57[_0x6ef8('0x13')][_0x6ef8('0x14')]===0x1f4){logger[_0x6ef8('0x13')](_0x6ef8('0xf'),_0x3d50be,_0x13ab57[_0x6ef8('0x13')][_0x6ef8('0x15')]);return _0x1cd743(_0x13ab57[_0x6ef8('0x13')][_0x6ef8('0x15')]);}logger[_0x6ef8('0x13')](_0x6ef8('0xf'),_0x3d50be,_0x13ab57['error'][_0x6ef8('0x15')]);return _0x4ad815(_0x13ab57[_0x6ef8('0x13')][_0x6ef8('0x15')]);}else{logger[_0x6ef8('0xe')](_0x6ef8('0xf'),_0x3d50be,_0x6ef8('0x10'));_0x4ad815(_0x13ab57[_0x6ef8('0x16')][_0x6ef8('0x15')]);}})['catch'](function(_0x411a65){logger[_0x6ef8('0x13')](_0x6ef8('0xf'),_0x3d50be,_0x411a65);_0x1cd743(_0x411a65);});});} \ No newline at end of file +var _0x8f40=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring'];(function(_0x3f4568,_0x9eb0ee){var _0xee2340=function(_0xdefabb){while(--_0xdefabb){_0x3f4568['push'](_0x3f4568['shift']());}};_0xee2340(++_0x9eb0ee);}(_0x8f40,0xec));var _0x08f4=function(_0x32c5d8,_0x6004b7){_0x32c5d8=_0x32c5d8-0x0;var _0x5973b9=_0x8f40[_0x32c5d8];return _0x5973b9;};'use strict';var _=require('lodash');var util=require(_0x08f4('0x0'));var moment=require(_0x08f4('0x1'));var BPromise=require(_0x08f4('0x2'));var rs=require(_0x08f4('0x3'));var fs=require('fs');var Redis=require(_0x08f4('0x4'));var db=require(_0x08f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x08f4('0x6'))('rpc');var config=require(_0x08f4('0x7'));var jayson=require(_0x08f4('0x8'));var client=jayson[_0x08f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aeb6d,_0x5352c3,_0x3f493c){return new BPromise(function(_0x502785,_0x35b532){return client[_0x08f4('0xa')](_0x2aeb6d,_0x3f493c)[_0x08f4('0xb')](function(_0x2b2862){logger['info'](_0x08f4('0xc'),_0x5352c3,_0x08f4('0xd'));logger['debug'](_0x08f4('0xe'),_0x5352c3,_0x08f4('0xd'),JSON[_0x08f4('0xf')](_0x2b2862));if(_0x2b2862['error']){if(_0x2b2862[_0x08f4('0x10')][_0x08f4('0x11')]===0x1f4){logger['error'](_0x08f4('0xc'),_0x5352c3,_0x2b2862[_0x08f4('0x10')][_0x08f4('0x12')]);return _0x35b532(_0x2b2862[_0x08f4('0x10')]['message']);}logger['error']('CannedAnswer,\x20%s,\x20%s',_0x5352c3,_0x2b2862['error'][_0x08f4('0x12')]);return _0x502785(_0x2b2862[_0x08f4('0x10')][_0x08f4('0x12')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x5352c3,_0x08f4('0xd'));_0x502785(_0x2b2862['result'][_0x08f4('0x12')]);}})[_0x08f4('0x13')](function(_0x1d01a1){logger[_0x08f4('0x10')](_0x08f4('0xc'),_0x5352c3,_0x1d01a1);_0x35b532(_0x1d01a1);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 729ca65..21b3cdb 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 _0xc885=['multer','util','path','express','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3d3a0f,_0x40c20b){var _0x13f997=function(_0x397718){while(--_0x397718){_0x3d3a0f['push'](_0x3d3a0f['shift']());}};_0x13f997(++_0x40c20b);}(_0xc885,0xfc));var _0x5c88=function(_0x5779f3,_0x3cee1f){_0x5779f3=_0x5779f3-0x0;var _0x4441fb=_0xc885[_0x5779f3];return _0x4441fb;};'use strict';var multer=require(_0x5c88('0x0'));var util=require(_0x5c88('0x1'));var path=require(_0x5c88('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c88('0x3'));var router=express['Router']();var auth=require(_0x5c88('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c88('0x5'));var controller=require(_0x5c88('0x6'));router[_0x5c88('0x7')]('/',auth[_0x5c88('0x8')](),controller['index']);router['get'](_0x5c88('0x9'),auth['isAuthenticated'](),controller[_0x5c88('0xa')]);router[_0x5c88('0xb')]('/',auth['isAuthenticated'](),controller[_0x5c88('0xc')]);router[_0x5c88('0xd')](_0x5c88('0x9'),auth[_0x5c88('0x8')](),controller[_0x5c88('0xe')]);router[_0x5c88('0xf')]('/:id',auth[_0x5c88('0x8')](),controller[_0x5c88('0x10')]);module[_0x5c88('0x11')]=router; \ No newline at end of file +var _0x264c=['../../config/environment','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x423276,_0x251663){var _0x2ba550=function(_0x216ddb){while(--_0x216ddb){_0x423276['push'](_0x423276['shift']());}};_0x2ba550(++_0x251663);}(_0x264c,0x119));var _0xc264=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x264c[_0x36feb2];return _0x292b43;};'use strict';var multer=require(_0xc264('0x0'));var util=require(_0xc264('0x1'));var path=require(_0xc264('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc264('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc264('0x4'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xc264('0x5')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc264('0x6')]);router[_0xc264('0x7')]('/',auth['isAuthenticated'](),controller[_0xc264('0x8')]);router[_0xc264('0x9')](_0xc264('0xa'),auth[_0xc264('0x5')](),controller[_0xc264('0xb')]);router[_0xc264('0xc')](_0xc264('0xa'),auth[_0xc264('0x5')](),controller[_0xc264('0xd')]);module[_0xc264('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c869c45..6a3bfb6 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 _0x62de=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x4d9437,_0x20e3a0){var _0x3f8756=function(_0x2f17a0){while(--_0x2f17a0){_0x4d9437['push'](_0x4d9437['shift']());}};_0x3f8756(++_0x20e3a0);}(_0x62de,0x11d));var _0xe62d=function(_0x3f32ab,_0x400a4c){_0x3f32ab=_0x3f32ab-0x0;var _0x521e71=_0x62de[_0x3f32ab];return _0x521e71;};'use strict';var Sequelize=require(_0xe62d('0x0'));module[_0xe62d('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xe62d('0x2')},'clid':{'type':Sequelize[_0xe62d('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xe62d('0x3')]},'dcontext':{'type':Sequelize[_0xe62d('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xe62d('0x3')]},'lastapp':{'type':Sequelize[_0xe62d('0x3')]},'lastdata':{'type':Sequelize[_0xe62d('0x3')]},'duration':{'type':Sequelize[_0xe62d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe62d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe62d('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe62d('0x3')]},'userfield':{'type':Sequelize[_0xe62d('0x3')]},'uniqueid':{'type':Sequelize[_0xe62d('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe62d('0x3')]},'peeraccount':{'type':Sequelize[_0xe62d('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe62d('0x3')]}}; \ No newline at end of file +var _0xb04d=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x284998,_0x4c8733){var _0x1db6d6=function(_0x8718ac){while(--_0x8718ac){_0x284998['push'](_0x284998['shift']());}};_0x1db6d6(++_0x4c8733);}(_0xb04d,0xb2));var _0xdb04=function(_0x1cd14c,_0x523a2a){_0x1cd14c=_0x1cd14c-0x0;var _0x2ea0e3=_0xb04d[_0x1cd14c];return _0x2ea0e3;};'use strict';var Sequelize=require(_0xdb04('0x0'));module[_0xdb04('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xdb04('0x2')},'clid':{'type':Sequelize[_0xdb04('0x3')]},'src':{'type':Sequelize[_0xdb04('0x3')]},'dst':{'type':Sequelize[_0xdb04('0x3')]},'dcontext':{'type':Sequelize[_0xdb04('0x3')]},'channel':{'type':Sequelize[_0xdb04('0x3')]},'dstchannel':{'type':Sequelize[_0xdb04('0x3')]},'lastapp':{'type':Sequelize[_0xdb04('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdb04('0x3')]},'amaflags':{'type':Sequelize[_0xdb04('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdb04('0x3')]},'userfield':{'type':Sequelize[_0xdb04('0x3')]},'uniqueid':{'type':Sequelize[_0xdb04('0x3')]},'linkedid':{'type':Sequelize[_0xdb04('0x3')]},'sequence':{'type':Sequelize[_0xdb04('0x3')]},'peeraccount':{'type':Sequelize[_0xdb04('0x3')]},'type':{'type':Sequelize[_0xdb04('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0f6983b..19eecbf 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 _0xb165=['map','keys','filters','intersection','query','fields','attributes','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','show','length','includeAll','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Cdr','type','key','model'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xb165,0xaf));var _0x5b16=function(_0x2736d2,_0x51a76f){_0x2736d2=_0x2736d2-0x0;var _0x271ea5=_0xb165[_0x2736d2];return _0x271ea5;};'use strict';var pdf=require(_0x5b16('0x0'));var emlformat=require(_0x5b16('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5b16('0x2'));var jsonpatch=require(_0x5b16('0x3'));var rp=require(_0x5b16('0x4'));var moment=require(_0x5b16('0x5'));var BPromise=require(_0x5b16('0x6'));var Mustache=require(_0x5b16('0x7'));var util=require(_0x5b16('0x8'));var path=require(_0x5b16('0x9'));var sox=require(_0x5b16('0xa'));var csv=require(_0x5b16('0xb'));var ejs=require(_0x5b16('0xc'));var fs=require('fs');var _=require(_0x5b16('0xd'));var squel=require('squel');var crypto=require(_0x5b16('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5b16('0xf'));var toCsv=require(_0x5b16('0xb'));var querystring=require(_0x5b16('0x10'));var Papa=require('papaparse');var Redis=require(_0x5b16('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b16('0x12'));var as=require(_0x5b16('0x13'));var hardwareService=require(_0x5b16('0x14'));var logger=require(_0x5b16('0x15'))(_0x5b16('0x16'));var utils=require(_0x5b16('0x17'));var config=require(_0x5b16('0x18'));var db=require(_0x5b16('0x19'))['db'];function respondWithStatusCode(_0xc31a1c,_0x281513){_0x281513=_0x281513||0xcc;return function(_0x3b48cb){if(_0x3b48cb){return _0xc31a1c[_0x5b16('0x1a')](_0x281513);}return _0xc31a1c[_0x5b16('0x1b')](_0x281513)[_0x5b16('0x1c')]();};}function respondWithResult(_0x4ae807,_0x1bca0d){_0x1bca0d=_0x1bca0d||0xc8;return function(_0x42624d){if(_0x42624d){return _0x4ae807[_0x5b16('0x1b')](_0x1bca0d)[_0x5b16('0x1d')](_0x42624d);}};}function respondWithFilteredResult(_0x1d34ee,_0x4abe04){return function(_0x13bf97){if(_0x13bf97){var _0x4cf763=_0x13bf97['count'],_0x800556=_0x4abe04['offset'],_0x6b0043=_0x4abe04[_0x5b16('0x1e')]+_0x4abe04['limit'],_0x26466d;if(_0x6b0043>=_0x4cf763){_0x6b0043=_0x4cf763;_0x26466d=0xc8;}else{_0x26466d=0xce;}_0x1d34ee[_0x5b16('0x1b')](_0x26466d);return _0x1d34ee[_0x5b16('0x1f')](_0x5b16('0x20'),_0x800556+'-'+_0x6b0043+'/'+_0x4cf763)[_0x5b16('0x1d')](_0x13bf97);}return null;};}function patchUpdates(_0x441e91){return function(_0x1197b5){try{jsonpatch[_0x5b16('0x21')](_0x1197b5,_0x441e91,!![]);}catch(_0x3d9149){return BPromise[_0x5b16('0x22')](_0x3d9149);}return _0x1197b5[_0x5b16('0x23')]();};}function saveUpdates(_0x123488,_0x5c5afe){return function(_0x35cd6b){if(_0x35cd6b){return _0x35cd6b[_0x5b16('0x24')](_0x123488)[_0x5b16('0x25')](function(_0x47b29d){return _0x47b29d;});}return null;};}function removeEntity(_0x419555,_0x3455a0){return function(_0x439739){if(_0x439739){return _0x439739[_0x5b16('0x26')]()[_0x5b16('0x25')](function(){_0x419555[_0x5b16('0x1b')](0xcc)[_0x5b16('0x1c')]();});}};}function handleEntityNotFound(_0xbe25ce,_0x3bf59c){return function(_0x36df10){if(!_0x36df10){_0xbe25ce[_0x5b16('0x1a')](0x194);}return _0x36df10;};}function handleError(_0x4fe0d1,_0x13ad15){_0x13ad15=_0x13ad15||0x1f4;return function(_0x311980){logger[_0x5b16('0x27')](_0x311980[_0x5b16('0x28')]);if(_0x311980[_0x5b16('0x29')]){delete _0x311980[_0x5b16('0x29')];}_0x4fe0d1['status'](_0x13ad15)[_0x5b16('0x2a')](_0x311980);};}exports['index']=function(_0x3edb91,_0x31ff9b){var _0x832c7c={},_0x1c6cae={},_0x1628ee={'count':0x0,'rows':[]};var _0x10bc3f=_['map'](db[_0x5b16('0x2b')]['rawAttributes'],function(_0x102a74){return{'name':_0x102a74['fieldName'],'type':_0x102a74[_0x5b16('0x2c')][_0x5b16('0x2d')]};});_0x1c6cae[_0x5b16('0x2e')]=_[_0x5b16('0x2f')](_0x10bc3f,_0x5b16('0x29'));_0x1c6cae['query']=_[_0x5b16('0x30')](_0x3edb91['query']);_0x1c6cae[_0x5b16('0x31')]=_[_0x5b16('0x32')](_0x1c6cae['model'],_0x1c6cae[_0x5b16('0x33')]);_0x832c7c['attributes']=_[_0x5b16('0x32')](_0x1c6cae['model'],qs['fields'](_0x3edb91[_0x5b16('0x33')][_0x5b16('0x34')]));_0x832c7c[_0x5b16('0x35')]=_0x832c7c[_0x5b16('0x35')]['length']?_0x832c7c[_0x5b16('0x35')]:_0x1c6cae[_0x5b16('0x2e')];if(!_0x3edb91[_0x5b16('0x33')][_0x5b16('0x36')]('nolimit')){_0x832c7c['limit']=qs[_0x5b16('0x37')](_0x3edb91[_0x5b16('0x33')][_0x5b16('0x37')]);_0x832c7c[_0x5b16('0x1e')]=qs[_0x5b16('0x1e')](_0x3edb91[_0x5b16('0x33')][_0x5b16('0x1e')]);}_0x832c7c['order']=qs[_0x5b16('0x38')](_0x3edb91[_0x5b16('0x33')][_0x5b16('0x38')]);_0x832c7c[_0x5b16('0x39')]=qs['filters'](_[_0x5b16('0x3a')](_0x3edb91[_0x5b16('0x33')],_0x1c6cae[_0x5b16('0x31')]),_0x10bc3f);if(_0x3edb91['query']['filter']){_0x832c7c[_0x5b16('0x39')]=_[_0x5b16('0x3b')](_0x832c7c['where'],{'$or':_[_0x5b16('0x2f')](_0x10bc3f,function(_0xb3356e){if(_0xb3356e[_0x5b16('0x2c')]!==_0x5b16('0x3c')){var _0x13ee25={};_0x13ee25[_0xb3356e['name']]={'$like':'%'+_0x3edb91[_0x5b16('0x33')][_0x5b16('0x3d')]+'%'};return _0x13ee25;}})});}_0x832c7c=_[_0x5b16('0x3b')]({},_0x832c7c,_0x3edb91[_0x5b16('0x3e')]);var _0x250ce4={'where':_0x832c7c[_0x5b16('0x39')]};return db['Cdr'][_0x5b16('0x3f')](_0x250ce4)[_0x5b16('0x25')](function(_0x143747){_0x1628ee[_0x5b16('0x3f')]=_0x143747;if(_0x3edb91[_0x5b16('0x33')]['includeAll']){_0x832c7c[_0x5b16('0x40')]=[{'all':!![]}];}return db[_0x5b16('0x2b')][_0x5b16('0x41')](_0x832c7c);})[_0x5b16('0x25')](function(_0x3cfe61){_0x1628ee['rows']=_0x3cfe61;return _0x1628ee;})[_0x5b16('0x25')](respondWithFilteredResult(_0x31ff9b,_0x832c7c))['catch'](handleError(_0x31ff9b,null));};exports[_0x5b16('0x42')]=function(_0x15ab23,_0x51e961){var _0x38c10d={'raw':!![],'where':{'id':_0x15ab23['params']['id']}},_0x1e22fb={};_0x1e22fb[_0x5b16('0x2e')]=_[_0x5b16('0x30')](db[_0x5b16('0x2b')]['rawAttributes']);_0x1e22fb[_0x5b16('0x33')]=_['keys'](_0x15ab23[_0x5b16('0x33')]);_0x1e22fb[_0x5b16('0x31')]=_[_0x5b16('0x32')](_0x1e22fb[_0x5b16('0x2e')],_0x1e22fb['query']);_0x38c10d[_0x5b16('0x35')]=_[_0x5b16('0x32')](_0x1e22fb[_0x5b16('0x2e')],qs[_0x5b16('0x34')](_0x15ab23['query'][_0x5b16('0x34')]));_0x38c10d['attributes']=_0x38c10d[_0x5b16('0x35')][_0x5b16('0x43')]?_0x38c10d[_0x5b16('0x35')]:_0x1e22fb[_0x5b16('0x2e')];if(_0x15ab23['query'][_0x5b16('0x44')]){_0x38c10d[_0x5b16('0x40')]=[{'all':!![]}];}_0x38c10d=_[_0x5b16('0x3b')]({},_0x38c10d,_0x15ab23[_0x5b16('0x3e')]);return db['Cdr']['find'](_0x38c10d)['then'](handleEntityNotFound(_0x51e961,null))[_0x5b16('0x25')](respondWithResult(_0x51e961,null))[_0x5b16('0x45')](handleError(_0x51e961,null));};exports[_0x5b16('0x46')]=function(_0x4ba068,_0x5712ff){return db['Cdr'][_0x5b16('0x46')](_0x4ba068[_0x5b16('0x47')],{})[_0x5b16('0x25')](respondWithResult(_0x5712ff,0xc9))[_0x5b16('0x45')](handleError(_0x5712ff,null));};exports[_0x5b16('0x24')]=function(_0x4fc660,_0x260354){if(_0x4fc660['body']['id']){delete _0x4fc660[_0x5b16('0x47')]['id'];}return db[_0x5b16('0x2b')]['find']({'where':{'id':_0x4fc660[_0x5b16('0x48')]['id']}})['then'](handleEntityNotFound(_0x260354,null))['then'](saveUpdates(_0x4fc660[_0x5b16('0x47')],null))['then'](respondWithResult(_0x260354,null))['catch'](handleError(_0x260354,null));};exports[_0x5b16('0x26')]=function(_0x4e6a98,_0x686bf0){return db[_0x5b16('0x2b')]['find']({'where':{'id':_0x4e6a98[_0x5b16('0x48')]['id']}})[_0x5b16('0x25')](handleEntityNotFound(_0x686bf0,null))[_0x5b16('0x25')](removeEntity(_0x686bf0,null))['catch'](handleError(_0x686bf0,null));};exports[_0x5b16('0x49')]=function(_0x5527f6,_0xd450ff){return db[_0x5b16('0x2b')][_0x5b16('0x49')]()[_0x5b16('0x25')](respondWithResult(_0xd450ff,null))[_0x5b16('0x45')](handleError(_0xd450ff,null));}; \ No newline at end of file +var _0x6e0b=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','intersection','create','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0xeeb156,_0x5392f4){var _0x4b7c74=function(_0x5705bb){while(--_0x5705bb){_0xeeb156['push'](_0xeeb156['shift']());}};_0x4b7c74(++_0x5392f4);}(_0x6e0b,0x10a));var _0xb6e0=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6e0b[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require(_0xb6e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb6e0('0x1'));var zipdir=require(_0xb6e0('0x2'));var jsonpatch=require(_0xb6e0('0x3'));var rp=require(_0xb6e0('0x4'));var moment=require('moment');var BPromise=require(_0xb6e0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb6e0('0x6'));var sox=require(_0xb6e0('0x7'));var csv=require('to-csv');var ejs=require(_0xb6e0('0x8'));var fs=require('fs');var _=require(_0xb6e0('0x9'));var squel=require(_0xb6e0('0xa'));var crypto=require(_0xb6e0('0xb'));var jsforce=require(_0xb6e0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb6e0('0xd'));var querystring=require(_0xb6e0('0xe'));var Papa=require('papaparse');var Redis=require(_0xb6e0('0xf'));var authService=require(_0xb6e0('0x10'));var qs=require(_0xb6e0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6e0('0x12'))(_0xb6e0('0x13'));var utils=require(_0xb6e0('0x14'));var config=require('../../config/environment');var db=require(_0xb6e0('0x15'))['db'];function respondWithStatusCode(_0xb264ed,_0x39e127){_0x39e127=_0x39e127||0xcc;return function(_0x29624a){if(_0x29624a){return _0xb264ed[_0xb6e0('0x16')](_0x39e127);}return _0xb264ed['status'](_0x39e127)[_0xb6e0('0x17')]();};}function respondWithResult(_0x320ed5,_0xdfae9b){_0xdfae9b=_0xdfae9b||0xc8;return function(_0xe34546){if(_0xe34546){return _0x320ed5[_0xb6e0('0x18')](_0xdfae9b)[_0xb6e0('0x19')](_0xe34546);}};}function respondWithFilteredResult(_0x2220ef,_0xd84e54){return function(_0x514b07){if(_0x514b07){var _0x1604b8=_0x514b07[_0xb6e0('0x1a')],_0x5ba9a1=_0xd84e54[_0xb6e0('0x1b')],_0x1d2425=_0xd84e54['offset']+_0xd84e54[_0xb6e0('0x1c')],_0x45f01d;if(_0x1d2425>=_0x1604b8){_0x1d2425=_0x1604b8;_0x45f01d=0xc8;}else{_0x45f01d=0xce;}_0x2220ef[_0xb6e0('0x18')](_0x45f01d);return _0x2220ef[_0xb6e0('0x1d')](_0xb6e0('0x1e'),_0x5ba9a1+'-'+_0x1d2425+'/'+_0x1604b8)[_0xb6e0('0x19')](_0x514b07);}return null;};}function patchUpdates(_0x45bc8f){return function(_0x27dbb6){try{jsonpatch['apply'](_0x27dbb6,_0x45bc8f,!![]);}catch(_0x383398){return BPromise['reject'](_0x383398);}return _0x27dbb6[_0xb6e0('0x1f')]();};}function saveUpdates(_0x4c5914,_0x2ca033){return function(_0x18ec8c){if(_0x18ec8c){return _0x18ec8c[_0xb6e0('0x20')](_0x4c5914)[_0xb6e0('0x21')](function(_0x5227dd){return _0x5227dd;});}return null;};}function removeEntity(_0x470a43,_0x38bf77){return function(_0x4488e5){if(_0x4488e5){return _0x4488e5[_0xb6e0('0x22')]()[_0xb6e0('0x21')](function(){_0x470a43[_0xb6e0('0x18')](0xcc)[_0xb6e0('0x17')]();});}};}function handleEntityNotFound(_0x3f0eb3,_0x92c927){return function(_0x2075cb){if(!_0x2075cb){_0x3f0eb3[_0xb6e0('0x16')](0x194);}return _0x2075cb;};}function handleError(_0x2c8a8f,_0x1f0d7d){_0x1f0d7d=_0x1f0d7d||0x1f4;return function(_0x4ae605){logger[_0xb6e0('0x23')](_0x4ae605[_0xb6e0('0x24')]);if(_0x4ae605[_0xb6e0('0x25')]){delete _0x4ae605['name'];}_0x2c8a8f[_0xb6e0('0x18')](_0x1f0d7d)['send'](_0x4ae605);};}exports[_0xb6e0('0x26')]=function(_0x37108f,_0x315fd9){var _0x36e243={},_0x131f89={},_0x3ca48c={'count':0x0,'rows':[]};var _0x58d272=_[_0xb6e0('0x27')](db[_0xb6e0('0x28')][_0xb6e0('0x29')],function(_0x5c639b){return{'name':_0x5c639b[_0xb6e0('0x2a')],'type':_0x5c639b['type'][_0xb6e0('0x2b')]};});_0x131f89['model']=_[_0xb6e0('0x27')](_0x58d272,_0xb6e0('0x25'));_0x131f89['query']=_[_0xb6e0('0x2c')](_0x37108f[_0xb6e0('0x2d')]);_0x131f89[_0xb6e0('0x2e')]=_['intersection'](_0x131f89[_0xb6e0('0x2f')],_0x131f89['query']);_0x36e243[_0xb6e0('0x30')]=_['intersection'](_0x131f89[_0xb6e0('0x2f')],qs[_0xb6e0('0x31')](_0x37108f[_0xb6e0('0x2d')][_0xb6e0('0x31')]));_0x36e243[_0xb6e0('0x30')]=_0x36e243[_0xb6e0('0x30')][_0xb6e0('0x32')]?_0x36e243[_0xb6e0('0x30')]:_0x131f89['model'];if(!_0x37108f[_0xb6e0('0x2d')][_0xb6e0('0x33')](_0xb6e0('0x34'))){_0x36e243[_0xb6e0('0x1c')]=qs['limit'](_0x37108f[_0xb6e0('0x2d')][_0xb6e0('0x1c')]);_0x36e243[_0xb6e0('0x1b')]=qs[_0xb6e0('0x1b')](_0x37108f[_0xb6e0('0x2d')][_0xb6e0('0x1b')]);}_0x36e243[_0xb6e0('0x35')]=qs[_0xb6e0('0x36')](_0x37108f[_0xb6e0('0x2d')][_0xb6e0('0x36')]);_0x36e243['where']=qs['filters'](_['pick'](_0x37108f[_0xb6e0('0x2d')],_0x131f89['filters']),_0x58d272);if(_0x37108f[_0xb6e0('0x2d')]['filter']){_0x36e243[_0xb6e0('0x37')]=_[_0xb6e0('0x38')](_0x36e243[_0xb6e0('0x37')],{'$or':_[_0xb6e0('0x27')](_0x58d272,function(_0x47afbc){if(_0x47afbc[_0xb6e0('0x39')]!==_0xb6e0('0x3a')){var _0x166da4={};_0x166da4[_0x47afbc[_0xb6e0('0x25')]]={'$like':'%'+_0x37108f[_0xb6e0('0x2d')]['filter']+'%'};return _0x166da4;}})});}_0x36e243=_[_0xb6e0('0x38')]({},_0x36e243,_0x37108f[_0xb6e0('0x3b')]);var _0x29e081={'where':_0x36e243[_0xb6e0('0x37')]};return db[_0xb6e0('0x28')][_0xb6e0('0x1a')](_0x29e081)[_0xb6e0('0x21')](function(_0x4e77f7){_0x3ca48c[_0xb6e0('0x1a')]=_0x4e77f7;if(_0x37108f[_0xb6e0('0x2d')][_0xb6e0('0x3c')]){_0x36e243[_0xb6e0('0x3d')]=[{'all':!![]}];}return db[_0xb6e0('0x28')]['findAll'](_0x36e243);})['then'](function(_0x1e90d5){_0x3ca48c[_0xb6e0('0x3e')]=_0x1e90d5;return _0x3ca48c;})[_0xb6e0('0x21')](respondWithFilteredResult(_0x315fd9,_0x36e243))[_0xb6e0('0x3f')](handleError(_0x315fd9,null));};exports['show']=function(_0x48cf96,_0x52efcd){var _0x4fd329={'raw':!![],'where':{'id':_0x48cf96['params']['id']}},_0x566176={};_0x566176[_0xb6e0('0x2f')]=_[_0xb6e0('0x2c')](db[_0xb6e0('0x28')][_0xb6e0('0x29')]);_0x566176[_0xb6e0('0x2d')]=_[_0xb6e0('0x2c')](_0x48cf96[_0xb6e0('0x2d')]);_0x566176[_0xb6e0('0x2e')]=_[_0xb6e0('0x40')](_0x566176[_0xb6e0('0x2f')],_0x566176['query']);_0x4fd329['attributes']=_[_0xb6e0('0x40')](_0x566176[_0xb6e0('0x2f')],qs[_0xb6e0('0x31')](_0x48cf96[_0xb6e0('0x2d')]['fields']));_0x4fd329[_0xb6e0('0x30')]=_0x4fd329[_0xb6e0('0x30')][_0xb6e0('0x32')]?_0x4fd329['attributes']:_0x566176[_0xb6e0('0x2f')];if(_0x48cf96[_0xb6e0('0x2d')][_0xb6e0('0x3c')]){_0x4fd329['include']=[{'all':!![]}];}_0x4fd329=_['merge']({},_0x4fd329,_0x48cf96[_0xb6e0('0x3b')]);return db[_0xb6e0('0x28')]['find'](_0x4fd329)[_0xb6e0('0x21')](handleEntityNotFound(_0x52efcd,null))[_0xb6e0('0x21')](respondWithResult(_0x52efcd,null))[_0xb6e0('0x3f')](handleError(_0x52efcd,null));};exports[_0xb6e0('0x41')]=function(_0x177b2f,_0x3a1f7e){return db[_0xb6e0('0x28')][_0xb6e0('0x41')](_0x177b2f[_0xb6e0('0x42')],{})['then'](respondWithResult(_0x3a1f7e,0xc9))[_0xb6e0('0x3f')](handleError(_0x3a1f7e,null));};exports['update']=function(_0x2a441b,_0x327af0){if(_0x2a441b[_0xb6e0('0x42')]['id']){delete _0x2a441b['body']['id'];}return db[_0xb6e0('0x28')]['find']({'where':{'id':_0x2a441b['params']['id']}})['then'](handleEntityNotFound(_0x327af0,null))[_0xb6e0('0x21')](saveUpdates(_0x2a441b[_0xb6e0('0x42')],null))[_0xb6e0('0x21')](respondWithResult(_0x327af0,null))[_0xb6e0('0x3f')](handleError(_0x327af0,null));};exports[_0xb6e0('0x22')]=function(_0x1b3cab,_0x569726){return db[_0xb6e0('0x28')][_0xb6e0('0x43')]({'where':{'id':_0x1b3cab[_0xb6e0('0x44')]['id']}})[_0xb6e0('0x21')](handleEntityNotFound(_0x569726,null))[_0xb6e0('0x21')](removeEntity(_0x569726,null))[_0xb6e0('0x3f')](handleError(_0x569726,null));};exports[_0xb6e0('0x45')]=function(_0x4a1e93,_0x555bb5){return db['Cdr'][_0xb6e0('0x45')]()['then'](respondWithResult(_0x555bb5,null))[_0xb6e0('0x3f')](handleError(_0x555bb5,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index aa44369..8b07902 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cdr.attributes','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x59880e,_0x2afff7){var _0x3cf134=function(_0x269c75){while(--_0x269c75){_0x59880e['push'](_0x59880e['shift']());}};_0x3cf134(++_0x2afff7);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x583e98,_0x5534f5){_0x583e98=_0x583e98-0x0;var _0x84cc30=_0xfdbd[_0x583e98];return _0x84cc30;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('Cdr',attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'calldate','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('0xc')]},{'name':_0xdfdb('0xd'),'fields':[_0xdfdb('0xd')]},{'name':_0xdfdb('0xe'),'fields':[_0xdfdb('0xe')]},{'name':'uniqueid','fields':[_0xdfdb('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash'];(function(_0x55584e,_0x3f1f4b){var _0x11fb8c=function(_0x59f8df){while(--_0x59f8df){_0x55584e['push'](_0x55584e['shift']());}};_0x11fb8c(++_0x3f1f4b);}(_0x5496,0x175));var _0x6549=function(_0x31e71d,_0xe57ed6){_0x31e71d=_0x31e71d-0x0;var _0x47adc5=_0x5496[_0x31e71d];return _0x47adc5;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('Cdr',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'calldate','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]},{'name':_0x6549('0xe'),'fields':[_0x6549('0xe')]},{'name':_0x6549('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x6549('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 33d981c..96f9ae1 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 _0x20d0=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Cdr,\x20%s,\x20%s'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x20d0,0x71));var _0x020d=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x20d0[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0x020d('0x0'));var util=require(_0x020d('0x1'));var moment=require(_0x020d('0x2'));var BPromise=require('bluebird');var rs=require(_0x020d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x020d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x020d('0x5'))(_0x020d('0x6'));var config=require(_0x020d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x020d('0x8')][_0x020d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336d58,_0x30a70a,_0x3fb250){return new BPromise(function(_0x3a4c29,_0x2ae261){return client[_0x020d('0xa')](_0x336d58,_0x3fb250)['then'](function(_0x59355b){logger[_0x020d('0xb')]('Cdr,\x20%s,\x20%s',_0x30a70a,'request\x20sent');logger[_0x020d('0xc')](_0x020d('0xd'),_0x30a70a,_0x020d('0xe'),JSON[_0x020d('0xf')](_0x59355b));if(_0x59355b[_0x020d('0x10')]){if(_0x59355b[_0x020d('0x10')][_0x020d('0x11')]===0x1f4){logger[_0x020d('0x10')](_0x020d('0x12'),_0x30a70a,_0x59355b['error'][_0x020d('0x13')]);return _0x2ae261(_0x59355b[_0x020d('0x10')][_0x020d('0x13')]);}logger['error'](_0x020d('0x12'),_0x30a70a,_0x59355b['error'][_0x020d('0x13')]);return _0x3a4c29(_0x59355b[_0x020d('0x10')][_0x020d('0x13')]);}else{logger[_0x020d('0xb')](_0x020d('0x12'),_0x30a70a,_0x020d('0xe'));_0x3a4c29(_0x59355b[_0x020d('0x14')][_0x020d('0x13')]);}})[_0x020d('0x15')](function(_0x296379){logger[_0x020d('0x10')]('Cdr,\x20%s,\x20%s',_0x30a70a,_0x296379);_0x2ae261(_0x296379);});});} \ No newline at end of file +var _0x80e4=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x1b996f,_0x13dc91){var _0x3df3f8=function(_0x428b54){while(--_0x428b54){_0x1b996f['push'](_0x1b996f['shift']());}};_0x3df3f8(++_0x13dc91);}(_0x80e4,0x1aa));var _0x480e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x80e4[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x480e('0x0'));var moment=require('moment');var BPromise=require(_0x480e('0x1'));var rs=require(_0x480e('0x2'));var fs=require('fs');var Redis=require(_0x480e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x480e('0x4'));var logger=require(_0x480e('0x5'))(_0x480e('0x6'));var config=require(_0x480e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x480e('0x8')][_0x480e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba819,_0x37b0a2,_0x5a1abf){return new BPromise(function(_0x3689fe,_0xb6aba0){return client['request'](_0x1ba819,_0x5a1abf)[_0x480e('0xa')](function(_0x4edc17){logger[_0x480e('0xb')](_0x480e('0xc'),_0x37b0a2,_0x480e('0xd'));logger['debug'](_0x480e('0xe'),_0x37b0a2,_0x480e('0xd'),JSON[_0x480e('0xf')](_0x4edc17));if(_0x4edc17[_0x480e('0x10')]){if(_0x4edc17[_0x480e('0x10')][_0x480e('0x11')]===0x1f4){logger[_0x480e('0x10')]('Cdr,\x20%s,\x20%s',_0x37b0a2,_0x4edc17['error'][_0x480e('0x12')]);return _0xb6aba0(_0x4edc17[_0x480e('0x10')]['message']);}logger[_0x480e('0x10')](_0x480e('0xc'),_0x37b0a2,_0x4edc17['error'][_0x480e('0x12')]);return _0x3689fe(_0x4edc17['error'][_0x480e('0x12')]);}else{logger[_0x480e('0xb')](_0x480e('0xc'),_0x37b0a2,_0x480e('0xd'));_0x3689fe(_0x4edc17[_0x480e('0x13')]['message']);}})['catch'](function(_0x489243){logger[_0x480e('0x10')](_0x480e('0xc'),_0x37b0a2,_0x489243);_0xb6aba0(_0x489243);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 052c525..ab4fbd0 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 _0x9022=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe','/:id','show','post','put','delete','destroy'];(function(_0x503605,_0x182c66){var _0x56fa7d=function(_0x5e45bb){while(--_0x5e45bb){_0x503605['push'](_0x503605['shift']());}};_0x56fa7d(++_0x182c66);}(_0x9022,0xa1));var _0x2902=function(_0x1612d6,_0x5577bf){_0x1612d6=_0x1612d6-0x0;var _0x27a583=_0x9022[_0x1612d6];return _0x27a583;};'use strict';var multer=require(_0x2902('0x0'));var util=require(_0x2902('0x1'));var path=require(_0x2902('0x2'));var timeout=require(_0x2902('0x3'));var express=require(_0x2902('0x4'));var router=express[_0x2902('0x5')]();var auth=require(_0x2902('0x6'));var interaction=require(_0x2902('0x7'));var config=require(_0x2902('0x8'));var controller=require(_0x2902('0x9'));router[_0x2902('0xa')]('/',auth[_0x2902('0xb')](),controller['index']);router['get'](_0x2902('0xc'),auth[_0x2902('0xb')](),controller['describe']);router['get'](_0x2902('0xd'),auth[_0x2902('0xb')](),controller[_0x2902('0xe')]);router[_0x2902('0xf')]('/',auth[_0x2902('0xb')](),controller['create']);router[_0x2902('0x10')](_0x2902('0xd'),auth[_0x2902('0xb')](),controller['update']);router[_0x2902('0x11')](_0x2902('0xd'),auth['isAuthenticated'](),controller[_0x2902('0x12')]);module[_0x2902('0x13')]=router; \ No newline at end of file +var _0xde83=['./cdr.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d69a4,_0x32935e){var _0xe0705b=function(_0x2a9344){while(--_0x2a9344){_0x2d69a4['push'](_0x2d69a4['shift']());}};_0xe0705b(++_0x32935e);}(_0xde83,0x1e8));var _0x3de8=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0xde83[_0xd67723];return _0x53b62b;};'use strict';var multer=require('multer');var util=require(_0x3de8('0x0'));var path=require(_0x3de8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3de8('0x2')]();var auth=require(_0x3de8('0x3'));var interaction=require(_0x3de8('0x4'));var config=require('../../config/environment');var controller=require(_0x3de8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3de8('0x6')](_0x3de8('0x7'),auth[_0x3de8('0x8')](),controller[_0x3de8('0x9')]);router[_0x3de8('0x6')](_0x3de8('0xa'),auth[_0x3de8('0x8')](),controller[_0x3de8('0xb')]);router[_0x3de8('0xc')]('/',auth[_0x3de8('0x8')](),controller['create']);router[_0x3de8('0xd')](_0x3de8('0xa'),auth[_0x3de8('0x8')](),controller[_0x3de8('0xe')]);router[_0x3de8('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3de8('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 96739b2..ae7cafd 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 _0x8517=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x8517,0x112));var _0x7851=function(_0x4834b6,_0xf8ba05){_0x4834b6=_0x4834b6-0x0;var _0xc332ab=_0x8517[_0x4834b6];return _0xc332ab;};'use strict';var Sequelize=require(_0x7851('0x0'));module[_0x7851('0x1')]={'priority':{'type':Sequelize[_0x7851('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7851('0x3')],'allowNull':![],'defaultValue':_0x7851('0x4')},'appdata':{'type':Sequelize[_0x7851('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7851('0x3')],'defaultValue':_0x7851('0x6')}}; \ No newline at end of file +var _0x339d=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x42c876,_0xbc454b){var _0x3d46ef=function(_0x298f17){while(--_0x298f17){_0x42c876['push'](_0x42c876['shift']());}};_0x3d46ef(++_0xbc454b);}(_0x339d,0x81));var _0xd339=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0x339d[_0x3b5049];return _0x12454e;};'use strict';var Sequelize=require(_0xd339('0x0'));module[_0xd339('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd339('0x2')],'allowNull':![],'defaultValue':_0xd339('0x3')},'appdata':{'type':Sequelize[_0xd339('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd339('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e7e1ea6..001b904 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 _0xeb36=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','show','model','keys','ChatApplication','query','intersection','fields','includeAll','include','merge','catch','update','body','params','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x9731b4,_0x26aac3){var _0x3d7a66=function(_0x4be24c){while(--_0x4be24c){_0x9731b4['push'](_0x9731b4['shift']());}};_0x3d7a66(++_0x26aac3);}(_0xeb36,0x182));var _0x6eb3=function(_0xffa1a3,_0x24bbfd){_0xffa1a3=_0xffa1a3-0x0;var _0x2eaf16=_0xeb36[_0xffa1a3];return _0x2eaf16;};'use strict';var pdf=require(_0x6eb3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6eb3('0x1'));var zipdir=require(_0x6eb3('0x2'));var jsonpatch=require(_0x6eb3('0x3'));var rp=require(_0x6eb3('0x4'));var moment=require(_0x6eb3('0x5'));var BPromise=require(_0x6eb3('0x6'));var Mustache=require(_0x6eb3('0x7'));var util=require('util');var path=require(_0x6eb3('0x8'));var sox=require(_0x6eb3('0x9'));var csv=require(_0x6eb3('0xa'));var ejs=require(_0x6eb3('0xb'));var fs=require('fs');var _=require(_0x6eb3('0xc'));var squel=require(_0x6eb3('0xd'));var crypto=require(_0x6eb3('0xe'));var jsforce=require(_0x6eb3('0xf'));var deskjs=require(_0x6eb3('0x10'));var toCsv=require(_0x6eb3('0xa'));var querystring=require(_0x6eb3('0x11'));var Papa=require(_0x6eb3('0x12'));var Redis=require(_0x6eb3('0x13'));var authService=require(_0x6eb3('0x14'));var qs=require(_0x6eb3('0x15'));var as=require(_0x6eb3('0x16'));var hardwareService=require(_0x6eb3('0x17'));var logger=require('../../config/logger')(_0x6eb3('0x18'));var utils=require(_0x6eb3('0x19'));var config=require(_0x6eb3('0x1a'));var db=require(_0x6eb3('0x1b'))['db'];function respondWithStatusCode(_0x14ad1f,_0x4f09b3){_0x4f09b3=_0x4f09b3||0xcc;return function(_0x1b30ac){if(_0x1b30ac){return _0x14ad1f[_0x6eb3('0x1c')](_0x4f09b3);}return _0x14ad1f[_0x6eb3('0x1d')](_0x4f09b3)[_0x6eb3('0x1e')]();};}function respondWithResult(_0x3d0316,_0x3ed747){_0x3ed747=_0x3ed747||0xc8;return function(_0x520a1d){if(_0x520a1d){return _0x3d0316['status'](_0x3ed747)[_0x6eb3('0x1f')](_0x520a1d);}};}function respondWithFilteredResult(_0x4c2912,_0x3bb8d0){return function(_0x4326c1){if(_0x4326c1){var _0x35d665=_0x4326c1['count'],_0x563f18=_0x3bb8d0[_0x6eb3('0x20')],_0x138be7=_0x3bb8d0[_0x6eb3('0x20')]+_0x3bb8d0['limit'],_0x181ecf;if(_0x138be7>=_0x35d665){_0x138be7=_0x35d665;_0x181ecf=0xc8;}else{_0x181ecf=0xce;}_0x4c2912[_0x6eb3('0x1d')](_0x181ecf);return _0x4c2912[_0x6eb3('0x21')](_0x6eb3('0x22'),_0x563f18+'-'+_0x138be7+'/'+_0x35d665)['json'](_0x4326c1);}return null;};}function patchUpdates(_0x2cbf85){return function(_0x30e69c){try{jsonpatch[_0x6eb3('0x23')](_0x30e69c,_0x2cbf85,!![]);}catch(_0x4d800e){return BPromise[_0x6eb3('0x24')](_0x4d800e);}return _0x30e69c[_0x6eb3('0x25')]();};}function saveUpdates(_0x3a940e,_0x33aa9e){return function(_0x259d1d){if(_0x259d1d){return _0x259d1d['update'](_0x3a940e)[_0x6eb3('0x26')](function(_0x4a1890){return _0x4a1890;});}return null;};}function removeEntity(_0x4c6c12,_0x3c6c7c){return function(_0x1bb645){if(_0x1bb645){return _0x1bb645[_0x6eb3('0x27')]()[_0x6eb3('0x26')](function(){_0x4c6c12[_0x6eb3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dedf0,_0x4ed2b2){return function(_0x5515de){if(!_0x5515de){_0x3dedf0['sendStatus'](0x194);}return _0x5515de;};}function handleError(_0x4f8a4b,_0x5e36a2){_0x5e36a2=_0x5e36a2||0x1f4;return function(_0x4963f6){logger[_0x6eb3('0x28')](_0x4963f6['stack']);if(_0x4963f6[_0x6eb3('0x29')]){delete _0x4963f6[_0x6eb3('0x29')];}_0x4f8a4b[_0x6eb3('0x1d')](_0x5e36a2)[_0x6eb3('0x2a')](_0x4963f6);};}exports[_0x6eb3('0x2b')]=function(_0x4128e0,_0x454ed0){var _0x3ad878={'raw':!![],'where':{'id':_0x4128e0['params']['id']}},_0x49ac3f={};_0x49ac3f[_0x6eb3('0x2c')]=_[_0x6eb3('0x2d')](db[_0x6eb3('0x2e')]['rawAttributes']);_0x49ac3f['query']=_['keys'](_0x4128e0[_0x6eb3('0x2f')]);_0x49ac3f['filters']=_[_0x6eb3('0x30')](_0x49ac3f[_0x6eb3('0x2c')],_0x49ac3f['query']);_0x3ad878['attributes']=_[_0x6eb3('0x30')](_0x49ac3f[_0x6eb3('0x2c')],qs['fields'](_0x4128e0[_0x6eb3('0x2f')][_0x6eb3('0x31')]));_0x3ad878['attributes']=_0x3ad878['attributes']['length']?_0x3ad878['attributes']:_0x49ac3f[_0x6eb3('0x2c')];if(_0x4128e0['query'][_0x6eb3('0x32')]){_0x3ad878[_0x6eb3('0x33')]=[{'all':!![]}];}_0x3ad878=_[_0x6eb3('0x34')]({},_0x3ad878,_0x4128e0['options']);return db[_0x6eb3('0x2e')]['find'](_0x3ad878)[_0x6eb3('0x26')](handleEntityNotFound(_0x454ed0,null))['then'](respondWithResult(_0x454ed0,null))[_0x6eb3('0x35')](handleError(_0x454ed0,null));};exports[_0x6eb3('0x36')]=function(_0x386279,_0x47c394){if(_0x386279[_0x6eb3('0x37')]['id']){delete _0x386279[_0x6eb3('0x37')]['id'];}return db[_0x6eb3('0x2e')]['find']({'where':{'id':_0x386279[_0x6eb3('0x38')]['id']}})['then'](handleEntityNotFound(_0x47c394,null))['then'](saveUpdates(_0x386279['body'],null))[_0x6eb3('0x26')](respondWithResult(_0x47c394,null))['catch'](handleError(_0x47c394,null));};exports['destroy']=function(_0x4fff9e,_0x3962f3){return db[_0x6eb3('0x2e')][_0x6eb3('0x39')]({'where':{'id':_0x4fff9e['params']['id']}})['then'](handleEntityNotFound(_0x3962f3,null))[_0x6eb3('0x26')](removeEntity(_0x3962f3,null))[_0x6eb3('0x35')](handleError(_0x3962f3,null));}; \ No newline at end of file +var _0x3039=['offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','catch','body','params','find','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x3039,0x167));var _0x9303=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3039[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9303('0x0'));var zipdir=require(_0x9303('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9303('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9303('0x3'));var util=require(_0x9303('0x4'));var path=require(_0x9303('0x5'));var sox=require(_0x9303('0x6'));var csv=require(_0x9303('0x7'));var ejs=require(_0x9303('0x8'));var fs=require('fs');var _=require(_0x9303('0x9'));var squel=require('squel');var crypto=require(_0x9303('0xa'));var jsforce=require(_0x9303('0xb'));var deskjs=require(_0x9303('0xc'));var toCsv=require(_0x9303('0x7'));var querystring=require(_0x9303('0xd'));var Papa=require(_0x9303('0xe'));var Redis=require('ioredis');var authService=require(_0x9303('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9303('0x10'));var logger=require(_0x9303('0x11'))(_0x9303('0x12'));var utils=require(_0x9303('0x13'));var config=require(_0x9303('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d89b5,_0x2c2a3a){_0x2c2a3a=_0x2c2a3a||0xcc;return function(_0x522b0d){if(_0x522b0d){return _0x5d89b5[_0x9303('0x15')](_0x2c2a3a);}return _0x5d89b5[_0x9303('0x16')](_0x2c2a3a)[_0x9303('0x17')]();};}function respondWithResult(_0x1cebe9,_0x4ae70c){_0x4ae70c=_0x4ae70c||0xc8;return function(_0x1e336a){if(_0x1e336a){return _0x1cebe9[_0x9303('0x16')](_0x4ae70c)[_0x9303('0x18')](_0x1e336a);}};}function respondWithFilteredResult(_0x4ac4e6,_0xec9453){return function(_0x168aea){if(_0x168aea){var _0x37023c=_0x168aea[_0x9303('0x19')],_0x2946e5=_0xec9453[_0x9303('0x1a')],_0xe36c15=_0xec9453[_0x9303('0x1a')]+_0xec9453['limit'],_0x1eadf0;if(_0xe36c15>=_0x37023c){_0xe36c15=_0x37023c;_0x1eadf0=0xc8;}else{_0x1eadf0=0xce;}_0x4ac4e6[_0x9303('0x16')](_0x1eadf0);return _0x4ac4e6[_0x9303('0x1b')](_0x9303('0x1c'),_0x2946e5+'-'+_0xe36c15+'/'+_0x37023c)[_0x9303('0x18')](_0x168aea);}return null;};}function patchUpdates(_0x4ac898){return function(_0x352497){try{jsonpatch['apply'](_0x352497,_0x4ac898,!![]);}catch(_0x196bda){return BPromise[_0x9303('0x1d')](_0x196bda);}return _0x352497['save']();};}function saveUpdates(_0x134791,_0x55735e){return function(_0x11f72b){if(_0x11f72b){return _0x11f72b[_0x9303('0x1e')](_0x134791)[_0x9303('0x1f')](function(_0x3db47e){return _0x3db47e;});}return null;};}function removeEntity(_0x394ed1,_0x3765ed){return function(_0x3dd2ce){if(_0x3dd2ce){return _0x3dd2ce[_0x9303('0x20')]()['then'](function(){_0x394ed1[_0x9303('0x16')](0xcc)[_0x9303('0x17')]();});}};}function handleEntityNotFound(_0x467892,_0x2b5e9a){return function(_0x4bdc15){if(!_0x4bdc15){_0x467892[_0x9303('0x15')](0x194);}return _0x4bdc15;};}function handleError(_0x2775c9,_0x3bd33c){_0x3bd33c=_0x3bd33c||0x1f4;return function(_0x28aae3){logger[_0x9303('0x21')](_0x28aae3[_0x9303('0x22')]);if(_0x28aae3[_0x9303('0x23')]){delete _0x28aae3['name'];}_0x2775c9['status'](_0x3bd33c)[_0x9303('0x24')](_0x28aae3);};}exports[_0x9303('0x25')]=function(_0x20d52b,_0x460f75){var _0x3597ef={'raw':!![],'where':{'id':_0x20d52b['params']['id']}},_0x447240={};_0x447240[_0x9303('0x26')]=_[_0x9303('0x27')](db[_0x9303('0x28')][_0x9303('0x29')]);_0x447240[_0x9303('0x2a')]=_[_0x9303('0x27')](_0x20d52b[_0x9303('0x2a')]);_0x447240[_0x9303('0x2b')]=_['intersection'](_0x447240[_0x9303('0x26')],_0x447240[_0x9303('0x2a')]);_0x3597ef[_0x9303('0x2c')]=_[_0x9303('0x2d')](_0x447240[_0x9303('0x26')],qs['fields'](_0x20d52b['query'][_0x9303('0x2e')]));_0x3597ef[_0x9303('0x2c')]=_0x3597ef[_0x9303('0x2c')][_0x9303('0x2f')]?_0x3597ef[_0x9303('0x2c')]:_0x447240[_0x9303('0x26')];if(_0x20d52b[_0x9303('0x2a')][_0x9303('0x30')]){_0x3597ef[_0x9303('0x31')]=[{'all':!![]}];}_0x3597ef=_[_0x9303('0x32')]({},_0x3597ef,_0x20d52b['options']);return db[_0x9303('0x28')]['find'](_0x3597ef)['then'](handleEntityNotFound(_0x460f75,null))[_0x9303('0x1f')](respondWithResult(_0x460f75,null))[_0x9303('0x33')](handleError(_0x460f75,null));};exports[_0x9303('0x1e')]=function(_0x307f84,_0x3bf4b9){if(_0x307f84[_0x9303('0x34')]['id']){delete _0x307f84[_0x9303('0x34')]['id'];}return db[_0x9303('0x28')]['find']({'where':{'id':_0x307f84[_0x9303('0x35')]['id']}})[_0x9303('0x1f')](handleEntityNotFound(_0x3bf4b9,null))[_0x9303('0x1f')](saveUpdates(_0x307f84[_0x9303('0x34')],null))[_0x9303('0x1f')](respondWithResult(_0x3bf4b9,null))['catch'](handleError(_0x3bf4b9,null));};exports['destroy']=function(_0x1c2664,_0x2b16cf){return db[_0x9303('0x28')][_0x9303('0x36')]({'where':{'id':_0x1c2664[_0x9303('0x35')]['id']}})['then'](handleEntityNotFound(_0x2b16cf,null))['then'](removeEntity(_0x2b16cf,null))[_0x9303('0x33')](handleError(_0x2b16cf,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4e8fc46..e10768e 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9656e6f..d3ae051 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 _0x7707=['jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x7707,0xce));var _0x7770=function(_0x551ced,_0x27952e){_0x551ced=_0x551ced-0x0;var _0xa673db=_0x7707[_0x551ced];return _0xa673db;};'use strict';var _=require(_0x7770('0x0'));var util=require(_0x7770('0x1'));var moment=require(_0x7770('0x2'));var BPromise=require(_0x7770('0x3'));var rs=require(_0x7770('0x4'));var fs=require('fs');var Redis=require(_0x7770('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7770('0x6'));var logger=require(_0x7770('0x7'))(_0x7770('0x8'));var config=require(_0x7770('0x9'));var jayson=require(_0x7770('0xa'));var client=jayson[_0x7770('0xb')][_0x7770('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x352708,_0x3a3cd5,_0x23dae0){return new BPromise(function(_0x270bfe,_0x14a025){return client[_0x7770('0xd')](_0x352708,_0x23dae0)[_0x7770('0xe')](function(_0xd79d4d){logger['info'](_0x7770('0xf'),_0x3a3cd5,_0x7770('0x10'));logger['debug'](_0x7770('0x11'),_0x3a3cd5,'request\x20sent',JSON[_0x7770('0x12')](_0xd79d4d));if(_0xd79d4d['error']){if(_0xd79d4d[_0x7770('0x13')][_0x7770('0x14')]===0x1f4){logger[_0x7770('0x13')](_0x7770('0xf'),_0x3a3cd5,_0xd79d4d[_0x7770('0x13')][_0x7770('0x15')]);return _0x14a025(_0xd79d4d['error'][_0x7770('0x15')]);}logger[_0x7770('0x13')](_0x7770('0xf'),_0x3a3cd5,_0xd79d4d[_0x7770('0x13')]['message']);return _0x270bfe(_0xd79d4d[_0x7770('0x13')]['message']);}else{logger[_0x7770('0x16')](_0x7770('0xf'),_0x3a3cd5,_0x7770('0x10'));_0x270bfe(_0xd79d4d[_0x7770('0x17')][_0x7770('0x15')]);}})['catch'](function(_0x102702){logger[_0x7770('0x13')](_0x7770('0xf'),_0x3a3cd5,_0x102702);_0x14a025(_0x102702);});});} \ No newline at end of file +var _0x7647=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error'];(function(_0x36d081,_0x4ac187){var _0x4436f9=function(_0x43f7d4){while(--_0x43f7d4){_0x36d081['push'](_0x36d081['shift']());}};_0x4436f9(++_0x4ac187);}(_0x7647,0x95));var _0x7764=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7647[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7764('0x0'));var util=require(_0x7764('0x1'));var moment=require(_0x7764('0x2'));var BPromise=require(_0x7764('0x3'));var rs=require(_0x7764('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7764('0x5'))['db'];var utils=require(_0x7764('0x6'));var logger=require(_0x7764('0x7'))(_0x7764('0x8'));var config=require(_0x7764('0x9'));var jayson=require(_0x7764('0xa'));var client=jayson[_0x7764('0xb')][_0x7764('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x639a89,_0x3d76fb,_0x1c5c13){return new BPromise(function(_0x4a5cde,_0x1c4506){return client[_0x7764('0xd')](_0x639a89,_0x1c5c13)[_0x7764('0xe')](function(_0x284329){logger[_0x7764('0xf')](_0x7764('0x10'),_0x3d76fb,_0x7764('0x11'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3d76fb,_0x7764('0x11'),JSON['stringify'](_0x284329));if(_0x284329[_0x7764('0x12')]){if(_0x284329[_0x7764('0x12')]['code']===0x1f4){logger['error'](_0x7764('0x10'),_0x3d76fb,_0x284329[_0x7764('0x12')][_0x7764('0x13')]);return _0x1c4506(_0x284329['error']['message']);}logger[_0x7764('0x12')](_0x7764('0x10'),_0x3d76fb,_0x284329[_0x7764('0x12')][_0x7764('0x13')]);return _0x4a5cde(_0x284329[_0x7764('0x12')]['message']);}else{logger[_0x7764('0xf')](_0x7764('0x10'),_0x3d76fb,'request\x20sent');_0x4a5cde(_0x284329['result'][_0x7764('0x13')]);}})[_0x7764('0x14')](function(_0xd4d5b7){logger[_0x7764('0x12')](_0x7764('0x10'),_0x3d76fb,_0xd4d5b7);_0x1c4506(_0xd4d5b7);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 87ddace..f5c0607 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 _0x7d17=['Router','../../components/interaction/service','get','/:id','show','put','isAuthenticated','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x7d17,0x8c));var _0x77d1=function(_0x512281,_0x38d7a2){_0x512281=_0x512281-0x0;var _0x1341d4=_0x7d17[_0x512281];return _0x1341d4;};'use strict';var multer=require(_0x77d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77d1('0x1'));var express=require(_0x77d1('0x2'));var router=express[_0x77d1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x77d1('0x4'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x77d1('0x5')](_0x77d1('0x6'),auth['isAuthenticated'](),controller[_0x77d1('0x7')]);router[_0x77d1('0x8')](_0x77d1('0x6'),auth[_0x77d1('0x9')](),controller['update']);router[_0x77d1('0xa')](_0x77d1('0x6'),auth['isAuthenticated'](),controller[_0x77d1('0xb')]);module[_0x77d1('0xc')]=router; \ No newline at end of file +var _0xb1a9=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xb1a9,0x170));var _0x9b1a=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xb1a9[_0x4b5c23];return _0x262cfd;};'use strict';var multer=require(_0x9b1a('0x0'));var util=require(_0x9b1a('0x1'));var path=require(_0x9b1a('0x2'));var timeout=require(_0x9b1a('0x3'));var express=require('express');var router=express[_0x9b1a('0x4')]();var auth=require(_0x9b1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9b1a('0x6'));var controller=require(_0x9b1a('0x7'));router[_0x9b1a('0x8')]('/:id',auth[_0x9b1a('0x9')](),controller[_0x9b1a('0xa')]);router[_0x9b1a('0xb')](_0x9b1a('0xc'),auth['isAuthenticated'](),controller[_0x9b1a('0xd')]);router[_0x9b1a('0xe')](_0x9b1a('0xc'),auth['isAuthenticated'](),controller[_0x9b1a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f0f8a86..2ceab33 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 _0x63fe=['sequelize','STRING','BOOLEAN'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x63fe,0x1a1));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe63f('0x0'));module['exports']={'name':{'type':Sequelize[_0xe63f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe63f('0x1')]},'write':{'type':Sequelize[_0xe63f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc04c=['STRING','BOOLEAN','sequelize'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xc04c,0x1b2));var _0xcc04=function(_0xcc7a7f,_0x3eb308){_0xcc7a7f=_0xcc7a7f-0x0;var _0x947178=_0xc04c[_0xcc7a7f];return _0x947178;};'use strict';var Sequelize=require(_0xcc04('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc04('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xcc04('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index badba1e..074cc0a 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 _0xa03e=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','map','ChatGroup','rawAttributes','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','order','filter','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x1600fd,_0x454a95){var _0x3cd96c=function(_0x1ddaea){while(--_0x1ddaea){_0x1600fd['push'](_0x1600fd['shift']());}};_0x3cd96c(++_0x454a95);}(_0xa03e,0x13c));var _0xea03=function(_0x52236b,_0xa85d0b){_0x52236b=_0x52236b-0x0;var _0x3714b1=_0xa03e[_0x52236b];return _0x3714b1;};'use strict';var pdf=require(_0xea03('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xea03('0x1'));var zipdir=require(_0xea03('0x2'));var jsonpatch=require(_0xea03('0x3'));var rp=require(_0xea03('0x4'));var moment=require(_0xea03('0x5'));var BPromise=require(_0xea03('0x6'));var Mustache=require(_0xea03('0x7'));var util=require(_0xea03('0x8'));var path=require('path');var sox=require(_0xea03('0x9'));var csv=require(_0xea03('0xa'));var ejs=require(_0xea03('0xb'));var fs=require('fs');var _=require(_0xea03('0xc'));var squel=require(_0xea03('0xd'));var crypto=require('crypto');var jsforce=require(_0xea03('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xea03('0xa'));var querystring=require(_0xea03('0xf'));var Papa=require(_0xea03('0x10'));var Redis=require(_0xea03('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xea03('0x12'));var as=require(_0xea03('0x13'));var hardwareService=require(_0xea03('0x14'));var logger=require(_0xea03('0x15'))(_0xea03('0x16'));var utils=require(_0xea03('0x17'));var config=require('../../config/environment');var db=require(_0xea03('0x18'))['db'];config[_0xea03('0x19')]=_[_0xea03('0x1a')](config['redis'],{'host':_0xea03('0x1b'),'port':0x18eb});var socket=require(_0xea03('0x1c'))(new Redis(config['redis']));require(_0xea03('0x1d'))[_0xea03('0x1e')](socket);var jayson=require(_0xea03('0x1f'));var client=jayson[_0xea03('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x848b10,_0x34d991,_0x2d335a){if(_0x2d335a){var _0x3371fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3371fd[_0xea03('0x21')](_0x34d991)){return _0x848b10;}else{throw new db[(_0xea03('0x22'))]['ValidationError'](_0xea03('0x23'));}}else{return _0x848b10;}}function respondWithRpcPromise(_0x43a1ce,_0x3f7677,_0x532b0e,_0xc2c26d){return new BPromise(function(_0x18746e,_0xde7018){var _0x3dae18=_0xc2c26d||client;return _0x3dae18[_0xea03('0x24')](_0x43a1ce,_0x532b0e)[_0xea03('0x25')](function(_0x4bbac7){logger[_0xea03('0x26')](_0xea03('0x27'),_0x3f7677,_0xea03('0x28'));logger[_0xea03('0x29')](_0xea03('0x2a'),_0x3f7677,_0xea03('0x28'),JSON[_0xea03('0x2b')](_0x4bbac7));if(_0x4bbac7[_0xea03('0x2c')]){if(_0x4bbac7[_0xea03('0x2c')][_0xea03('0x2d')]===0x1f4){logger[_0xea03('0x2c')](_0xea03('0x27'),_0x3f7677,_0x4bbac7[_0xea03('0x2c')][_0xea03('0x2e')]);return _0xde7018(_0x4bbac7['error'][_0xea03('0x2e')]);}logger[_0xea03('0x2c')]('ChatGroup,\x20%s,\x20%s',_0x3f7677,_0x4bbac7['error'][_0xea03('0x2e')]);return _0x18746e(_0x4bbac7[_0xea03('0x2c')][_0xea03('0x2e')]);}else{logger[_0xea03('0x26')]('ChatGroup,\x20%s,\x20%s',_0x3f7677,_0xea03('0x28'));_0x18746e(_0x4bbac7['result'][_0xea03('0x2e')]);}})['catch'](function(_0x469681){logger[_0xea03('0x2c')](_0xea03('0x27'),_0x3f7677,_0x469681);_0xde7018(_0x469681);});});}function respondWithStatusCode(_0x78517a,_0x4805ed){_0x4805ed=_0x4805ed||0xcc;return function(_0x22e2f1){if(_0x22e2f1){return _0x78517a[_0xea03('0x2f')](_0x4805ed);}return _0x78517a[_0xea03('0x30')](_0x4805ed)[_0xea03('0x31')]();};}function respondWithResult(_0x5358a1,_0x55f862){_0x55f862=_0x55f862||0xc8;return function(_0xe5b4fc){if(_0xe5b4fc){return _0x5358a1[_0xea03('0x30')](_0x55f862)[_0xea03('0x32')](_0xe5b4fc);}};}function respondWithFilteredResult(_0xe5eab6,_0x4afaf0){return function(_0x117c46){if(_0x117c46){var _0x42a19a=_0x117c46[_0xea03('0x33')],_0x3248b4=_0x4afaf0[_0xea03('0x34')],_0x348bd3=_0x4afaf0['offset']+_0x4afaf0['limit'],_0x2dfb61;if(_0x348bd3>=_0x42a19a){_0x348bd3=_0x42a19a;_0x2dfb61=0xc8;}else{_0x2dfb61=0xce;}_0xe5eab6[_0xea03('0x30')](_0x2dfb61);return _0xe5eab6[_0xea03('0x35')](_0xea03('0x36'),_0x3248b4+'-'+_0x348bd3+'/'+_0x42a19a)[_0xea03('0x32')](_0x117c46);}return null;};}function patchUpdates(_0x14ad72){return function(_0x49bce1){try{jsonpatch[_0xea03('0x37')](_0x49bce1,_0x14ad72,!![]);}catch(_0x67ca8e){return BPromise[_0xea03('0x38')](_0x67ca8e);}return _0x49bce1[_0xea03('0x39')]();};}function saveUpdates(_0x410468,_0x181cce){return function(_0x5b0dec){if(_0x5b0dec){return _0x5b0dec[_0xea03('0x3a')](_0x410468)[_0xea03('0x25')](function(_0xff2396){return _0xff2396;});}return null;};}function removeEntity(_0x3308e8,_0xa34ba1){return function(_0xf6489a){if(_0xf6489a){return _0xf6489a[_0xea03('0x3b')]()[_0xea03('0x25')](function(){_0x3308e8[_0xea03('0x30')](0xcc)[_0xea03('0x31')]();});}};}function handleEntityNotFound(_0x4d8c2e,_0x30be1e){return function(_0x4dc6f9){if(!_0x4dc6f9){_0x4d8c2e[_0xea03('0x2f')](0x194);}return _0x4dc6f9;};}function handleError(_0x20b7e5,_0x1218d3){_0x1218d3=_0x1218d3||0x1f4;return function(_0x1dbd4b){logger[_0xea03('0x2c')](_0x1dbd4b['stack']);if(_0x1dbd4b[_0xea03('0x3c')]){delete _0x1dbd4b[_0xea03('0x3c')];}_0x20b7e5[_0xea03('0x30')](_0x1218d3)[_0xea03('0x3d')](_0x1dbd4b);};}exports['index']=function(_0x1b778a,_0x39a8bb){var _0x55b6d0={},_0x2e18aa={},_0x189b8f={'count':0x0,'rows':[]};var _0x57b18d=_[_0xea03('0x3e')](db[_0xea03('0x3f')][_0xea03('0x40')],function(_0xc5fd6b){return{'name':_0xc5fd6b['fieldName'],'type':_0xc5fd6b['type']['key']};});_0x2e18aa['model']=_[_0xea03('0x3e')](_0x57b18d,_0xea03('0x3c'));_0x2e18aa[_0xea03('0x41')]=_[_0xea03('0x42')](_0x1b778a['query']);_0x2e18aa[_0xea03('0x43')]=_['intersection'](_0x2e18aa[_0xea03('0x44')],_0x2e18aa[_0xea03('0x41')]);_0x55b6d0[_0xea03('0x45')]=_['intersection'](_0x2e18aa[_0xea03('0x44')],qs[_0xea03('0x46')](_0x1b778a[_0xea03('0x41')][_0xea03('0x46')]));_0x55b6d0[_0xea03('0x45')]=_0x55b6d0[_0xea03('0x45')][_0xea03('0x47')]?_0x55b6d0[_0xea03('0x45')]:_0x2e18aa['model'];if(!_0x1b778a[_0xea03('0x41')][_0xea03('0x48')](_0xea03('0x49'))){_0x55b6d0[_0xea03('0x4a')]=qs[_0xea03('0x4a')](_0x1b778a[_0xea03('0x41')][_0xea03('0x4a')]);_0x55b6d0[_0xea03('0x34')]=qs['offset'](_0x1b778a[_0xea03('0x41')][_0xea03('0x34')]);}_0x55b6d0['order']=qs[_0xea03('0x4b')](_0x1b778a['query'][_0xea03('0x4b')]);_0x55b6d0[_0xea03('0x4c')]=qs[_0xea03('0x43')](_[_0xea03('0x4d')](_0x1b778a[_0xea03('0x41')],_0x2e18aa[_0xea03('0x43')]),_0x57b18d);if(_0x1b778a[_0xea03('0x41')]['filter']){_0x55b6d0['where']=_[_0xea03('0x4e')](_0x55b6d0['where'],{'$or':_[_0xea03('0x3e')](_0x57b18d,function(_0x34f0ca){if(_0x34f0ca['type']!==_0xea03('0x4f')){var _0x33cde6={};_0x33cde6[_0x34f0ca[_0xea03('0x3c')]]={'$like':'%'+_0x1b778a['query']['filter']+'%'};return _0x33cde6;}})});}_0x55b6d0=_['merge']({},_0x55b6d0,_0x1b778a[_0xea03('0x50')]);var _0x1fbd20={'where':_0x55b6d0[_0xea03('0x4c')]};return db[_0xea03('0x3f')][_0xea03('0x33')](_0x1fbd20)['then'](function(_0x39f36c){_0x189b8f[_0xea03('0x33')]=_0x39f36c;if(_0x1b778a[_0xea03('0x41')][_0xea03('0x51')]){_0x55b6d0[_0xea03('0x52')]=[{'all':!![]}];}return db[_0xea03('0x3f')][_0xea03('0x53')](_0x55b6d0);})[_0xea03('0x25')](function(_0x390ddc){_0x189b8f[_0xea03('0x54')]=_0x390ddc;return _0x189b8f;})['then'](respondWithFilteredResult(_0x39a8bb,_0x55b6d0))[_0xea03('0x55')](handleError(_0x39a8bb,null));};exports[_0xea03('0x56')]=function(_0x1cc5a8,_0x5d0bd2){var _0x4b274={'raw':!![],'where':{'id':_0x1cc5a8[_0xea03('0x57')]['id']}},_0x24a06e={};_0x24a06e['model']=_['keys'](db[_0xea03('0x3f')][_0xea03('0x40')]);_0x24a06e[_0xea03('0x41')]=_[_0xea03('0x42')](_0x1cc5a8[_0xea03('0x41')]);_0x24a06e[_0xea03('0x43')]=_[_0xea03('0x58')](_0x24a06e[_0xea03('0x44')],_0x24a06e[_0xea03('0x41')]);_0x4b274[_0xea03('0x45')]=_[_0xea03('0x58')](_0x24a06e[_0xea03('0x44')],qs[_0xea03('0x46')](_0x1cc5a8[_0xea03('0x41')]['fields']));_0x4b274[_0xea03('0x45')]=_0x4b274[_0xea03('0x45')][_0xea03('0x47')]?_0x4b274[_0xea03('0x45')]:_0x24a06e[_0xea03('0x44')];if(_0x1cc5a8[_0xea03('0x41')][_0xea03('0x51')]){_0x4b274[_0xea03('0x52')]=[{'all':!![]}];}_0x4b274=_['merge']({},_0x4b274,_0x1cc5a8[_0xea03('0x50')]);return db[_0xea03('0x3f')][_0xea03('0x59')](_0x4b274)[_0xea03('0x25')](handleEntityNotFound(_0x5d0bd2,null))[_0xea03('0x25')](respondWithResult(_0x5d0bd2,null))['catch'](handleError(_0x5d0bd2,null));};exports['create']=function(_0x1f6bb0,_0x28b2e8){return db['ChatGroup'][_0xea03('0x5a')](_0x1f6bb0[_0xea03('0x5b')],{})[_0xea03('0x25')](respondWithResult(_0x28b2e8,0xc9))['catch'](handleError(_0x28b2e8,null));};exports[_0xea03('0x3a')]=function(_0x5bd1fd,_0x3fd3b1){if(_0x5bd1fd['body']['id']){delete _0x5bd1fd[_0xea03('0x5b')]['id'];}return db[_0xea03('0x3f')][_0xea03('0x59')]({'where':{'id':_0x5bd1fd[_0xea03('0x57')]['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x3fd3b1,null))[_0xea03('0x25')](saveUpdates(_0x5bd1fd[_0xea03('0x5b')],null))[_0xea03('0x25')](respondWithResult(_0x3fd3b1,null))['catch'](handleError(_0x3fd3b1,null));};exports['destroy']=function(_0x572139,_0x59f5fe){return db['ChatGroup'][_0xea03('0x59')]({'where':{'id':_0x572139['params']['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x59f5fe,null))[_0xea03('0x25')](removeEntity(_0x59f5fe,null))[_0xea03('0x55')](handleError(_0x59f5fe,null));};exports[_0xea03('0x5c')]=function(_0x22da3a,_0x3b7fc2){return db[_0xea03('0x3f')][_0xea03('0x5c')]()[_0xea03('0x25')](respondWithResult(_0x3b7fc2,null))[_0xea03('0x55')](handleError(_0x3b7fc2,null));};exports['getUnread']=function(_0x28f35e,_0x45f030,_0x51943f){return db[_0xea03('0x5d')][_0xea03('0x33')]({'where':{'ChatGroupId':_0x28f35e[_0xea03('0x57')]['id'],'ToId':_0x28f35e[_0xea03('0x5e')]['id'],'read':![]}})[_0xea03('0x25')](function(_0xc7c9c8){return{'id':_['toInteger'](_0x28f35e[_0xea03('0x57')]['id']),'count':_0xc7c9c8};})[_0xea03('0x25')](respondWithResult(_0x45f030,null))[_0xea03('0x55')](handleError(_0x45f030,null));};exports[_0xea03('0x5f')]=function(_0x5c91da,_0x2abbfb,_0x233d59){return db['ChatGroup']['find']({'where':{'id':_0x5c91da[_0xea03('0x57')]['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x2abbfb,null))[_0xea03('0x25')](function(_0xd9314f){if(_0xd9314f){return _0xd9314f[_0xea03('0x5f')](_0x5c91da[_0xea03('0x5b')][_0xea03('0x60')],_[_0xea03('0x61')](_0x5c91da[_0xea03('0x5b')],[_0xea03('0x60'),'id'])||{});}})[_0xea03('0x25')](respondWithResult(_0x2abbfb,null))[_0xea03('0x55')](handleError(_0x2abbfb,null));};exports[_0xea03('0x62')]=function(_0x2a3ceb,_0x1e2bc7,_0x1fae19){var _0x4e174f={};var _0x398503={};var _0x5e6a8e;var _0x16e1d7;return db[_0xea03('0x3f')]['findOne']({'where':{'id':_0x2a3ceb['params']['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x1e2bc7,null))['then'](function(_0x303900){if(_0x303900){_0x5e6a8e=_0x303900;_0x398503[_0xea03('0x44')]=_[_0xea03('0x42')](db[_0xea03('0x63')][_0xea03('0x40')]);_0x398503['query']=_[_0xea03('0x42')](_0x2a3ceb['query']);_0x398503[_0xea03('0x43')]=_[_0xea03('0x58')](_0x398503[_0xea03('0x44')],_0x398503[_0xea03('0x41')]);_0x4e174f['attributes']=_['intersection'](_0x398503[_0xea03('0x44')],qs[_0xea03('0x46')](_0x2a3ceb[_0xea03('0x41')][_0xea03('0x46')]));_0x4e174f[_0xea03('0x45')]=_0x4e174f[_0xea03('0x45')]['length']?_0x4e174f['attributes']:_0x398503[_0xea03('0x44')];_0x4e174f[_0xea03('0x64')]=qs[_0xea03('0x4b')](_0x2a3ceb['query'][_0xea03('0x4b')]);_0x4e174f[_0xea03('0x4c')]=qs[_0xea03('0x43')](_[_0xea03('0x4d')](_0x2a3ceb[_0xea03('0x41')],_0x398503['filters']));if(_0x2a3ceb[_0xea03('0x41')][_0xea03('0x65')]){_0x4e174f['where']=_[_0xea03('0x4e')](_0x4e174f[_0xea03('0x4c')],{'$or':_[_0xea03('0x3e')](_0x4e174f['attributes'],function(_0x40ab64){var _0x494ca9={};_0x494ca9[_0x40ab64]={'$like':'%'+_0x2a3ceb[_0xea03('0x41')][_0xea03('0x65')]+'%'};return _0x494ca9;})});}_0x4e174f=_[_0xea03('0x4e')]({},_0x4e174f,_0x2a3ceb[_0xea03('0x50')]);return _0x5e6a8e['getMembers'](_0x4e174f);}})[_0xea03('0x25')](function(_0x2a46c3){if(_0x2a46c3){_0x16e1d7=_0x2a46c3['length'];if(!_0x2a3ceb[_0xea03('0x41')][_0xea03('0x48')](_0xea03('0x49'))){_0x4e174f[_0xea03('0x4a')]=qs[_0xea03('0x4a')](_0x2a3ceb['query']['limit']);_0x4e174f[_0xea03('0x34')]=qs[_0xea03('0x34')](_0x2a3ceb['query']['offset']);}return _0x5e6a8e[_0xea03('0x62')](_0x4e174f);}})[_0xea03('0x25')](function(_0x27b5b1){if(_0x27b5b1){return _0x27b5b1?{'count':_0x16e1d7,'rows':_0x27b5b1}:null;}})[_0xea03('0x25')](respondWithResult(_0x1e2bc7,null))[_0xea03('0x55')](handleError(_0x1e2bc7,null));};exports['removeMembers']=function(_0x87c571,_0x19d09c,_0x5f2a9e){return db[_0xea03('0x3f')]['find']({'where':{'id':_0x87c571[_0xea03('0x57')]['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x19d09c,null))[_0xea03('0x25')](function(_0x3f1669){if(_0x3f1669){return _0x3f1669[_0xea03('0x66')](_0x87c571[_0xea03('0x41')][_0xea03('0x60')]);}})[_0xea03('0x25')](respondWithStatusCode(_0x19d09c,null))[_0xea03('0x55')](handleError(_0x19d09c,null));};exports[_0xea03('0x67')]=function(_0x5878e0,_0x181056,_0x16258c){if(_0x5878e0['body']['id']){delete _0x5878e0['body']['id'];}return db['ChatGroup'][_0xea03('0x59')]({'where':{'id':_0x5878e0[_0xea03('0x57')]['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x181056,null))['then'](function(_0x21b7f3){if(_0x21b7f3){_0x5878e0[_0xea03('0x5b')][_0xea03('0x68')]=_0x21b7f3['id'];return db['ChatInternalMessage']['create'](_0x5878e0[_0xea03('0x5b')]);}})[_0xea03('0x25')](respondWithResult(_0x181056,null))[_0xea03('0x55')](handleError(_0x181056,null));};exports[_0xea03('0x69')]=function(_0x227b5d,_0x1580b3,_0x4ee5dc){var _0x308c79={};var _0x149740={};var _0x5a1c66;var _0x49a679;return db[_0xea03('0x3f')]['findOne']({'where':{'id':_0x227b5d[_0xea03('0x57')]['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x1580b3,null))['then'](function(_0x15e445){if(_0x15e445){_0x5a1c66=_0x15e445;_0x149740[_0xea03('0x44')]=_[_0xea03('0x42')](db[_0xea03('0x5d')][_0xea03('0x40')]);_0x149740['query']=_[_0xea03('0x42')](_0x227b5d['query']);_0x149740['filters']=_['intersection'](_0x149740[_0xea03('0x44')],_0x149740[_0xea03('0x41')]);_0x308c79[_0xea03('0x45')]=_[_0xea03('0x58')](_0x149740[_0xea03('0x44')],qs[_0xea03('0x46')](_0x227b5d[_0xea03('0x41')][_0xea03('0x46')]));_0x308c79['attributes']=_0x308c79[_0xea03('0x45')][_0xea03('0x47')]?_0x308c79['attributes']:_0x149740[_0xea03('0x44')];_0x308c79[_0xea03('0x64')]=qs[_0xea03('0x4b')](_0x227b5d[_0xea03('0x41')][_0xea03('0x4b')]);_0x308c79[_0xea03('0x4c')]=qs[_0xea03('0x43')](_['pick'](_0x227b5d[_0xea03('0x41')],_0x149740[_0xea03('0x43')]));if(_0x227b5d['query'][_0xea03('0x65')]){_0x308c79[_0xea03('0x4c')]=_[_0xea03('0x4e')](_0x308c79[_0xea03('0x4c')],{'$or':_[_0xea03('0x3e')](_0x308c79[_0xea03('0x45')],function(_0x591da4){var _0x262b95={};_0x262b95[_0x591da4]={'$like':'%'+_0x227b5d[_0xea03('0x41')][_0xea03('0x65')]+'%'};return _0x262b95;})});}if(_0x227b5d[_0xea03('0x41')][_0xea03('0x6a')]){var _0xadaac4=_0x227b5d[_0xea03('0x41')][_0xea03('0x6a')][_0xea03('0x6b')](',');var _0x561482={};_0x561482[_0xadaac4[0x0]]={'$gte':moment(_0xadaac4[0x1])[_0xea03('0x6c')](_0xea03('0x6d'))};_0x308c79[_0xea03('0x4c')]=_[_0xea03('0x4e')](_0x308c79[_0xea03('0x4c')],_0x561482);}_0x308c79=_['merge']({},_0x308c79,_0x227b5d[_0xea03('0x50')]);return _0x5a1c66[_0xea03('0x69')](_0x308c79);}})[_0xea03('0x25')](function(_0x2d8ec3){if(_0x2d8ec3){_0x49a679=_0x2d8ec3[_0xea03('0x47')];if(!_0x227b5d[_0xea03('0x41')][_0xea03('0x48')]('nolimit')){_0x308c79[_0xea03('0x4a')]=qs[_0xea03('0x4a')](_0x227b5d[_0xea03('0x41')][_0xea03('0x4a')]);_0x308c79[_0xea03('0x34')]=qs[_0xea03('0x34')](_0x227b5d[_0xea03('0x41')][_0xea03('0x34')]);}return _0x5a1c66[_0xea03('0x69')](_0x308c79);}})[_0xea03('0x25')](function(_0x1d961a){if(_0x1d961a){return _0x1d961a?{'count':_0x49a679,'rows':_0x1d961a}:null;}})[_0xea03('0x25')](respondWithResult(_0x1580b3,null))[_0xea03('0x55')](handleError(_0x1580b3,null));}; \ No newline at end of file +var _0xba8c=['request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','code','error','message','result','sendStatus','end','status','json','count','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','options','catch','body','destroy','find','describe','getUnread','params','toInteger','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatGroup.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xba8c,0x19d));var _0xcba8=function(_0x28c473,_0x5b403b){_0x28c473=_0x28c473-0x0;var _0x3d45d7=_0xba8c[_0x28c473];return _0x3d45d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcba8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcba8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcba8('0x2'));var moment=require(_0xcba8('0x3'));var BPromise=require(_0xcba8('0x4'));var Mustache=require(_0xcba8('0x5'));var util=require(_0xcba8('0x6'));var path=require(_0xcba8('0x7'));var sox=require('sox');var csv=require(_0xcba8('0x8'));var ejs=require(_0xcba8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcba8('0xa'));var crypto=require(_0xcba8('0xb'));var jsforce=require(_0xcba8('0xc'));var deskjs=require(_0xcba8('0xd'));var toCsv=require(_0xcba8('0x8'));var querystring=require(_0xcba8('0xe'));var Papa=require(_0xcba8('0xf'));var Redis=require(_0xcba8('0x10'));var authService=require(_0xcba8('0x11'));var qs=require(_0xcba8('0x12'));var as=require(_0xcba8('0x13'));var hardwareService=require(_0xcba8('0x14'));var logger=require(_0xcba8('0x15'))(_0xcba8('0x16'));var utils=require(_0xcba8('0x17'));var config=require(_0xcba8('0x18'));var db=require(_0xcba8('0x19'))['db'];config[_0xcba8('0x1a')]=_['defaults'](config['redis'],{'host':_0xcba8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcba8('0x1a')]));require(_0xcba8('0x1c'))['register'](socket);var jayson=require(_0xcba8('0x1d'));var client=jayson[_0xcba8('0x1e')][_0xcba8('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x2842d1,_0x2df7a1,_0x3798da){if(_0x3798da){var _0x4a8ff8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a8ff8[_0xcba8('0x20')](_0x2df7a1)){return _0x2842d1;}else{throw new db['Sequelize'][(_0xcba8('0x21'))](_0xcba8('0x22'));}}else{return _0x2842d1;}}function respondWithRpcPromise(_0x1f7063,_0x89da42,_0x23f380,_0x59baf2){return new BPromise(function(_0x1ce780,_0x5b39e6){var _0x5b1735=_0x59baf2||client;return _0x5b1735[_0xcba8('0x23')](_0x1f7063,_0x23f380)[_0xcba8('0x24')](function(_0x16269c){logger[_0xcba8('0x25')](_0xcba8('0x26'),_0x89da42,_0xcba8('0x27'));logger[_0xcba8('0x28')](_0xcba8('0x29'),_0x89da42,_0xcba8('0x27'),JSON['stringify'](_0x16269c));if(_0x16269c['error']){if(_0x16269c['error'][_0xcba8('0x2a')]===0x1f4){logger[_0xcba8('0x2b')](_0xcba8('0x26'),_0x89da42,_0x16269c[_0xcba8('0x2b')][_0xcba8('0x2c')]);return _0x5b39e6(_0x16269c[_0xcba8('0x2b')][_0xcba8('0x2c')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x89da42,_0x16269c[_0xcba8('0x2b')][_0xcba8('0x2c')]);return _0x1ce780(_0x16269c['error'][_0xcba8('0x2c')]);}else{logger[_0xcba8('0x25')](_0xcba8('0x26'),_0x89da42,_0xcba8('0x27'));_0x1ce780(_0x16269c[_0xcba8('0x2d')]['message']);}})['catch'](function(_0x11670f){logger[_0xcba8('0x2b')](_0xcba8('0x26'),_0x89da42,_0x11670f);_0x5b39e6(_0x11670f);});});}function respondWithStatusCode(_0x42e7f2,_0x58f457){_0x58f457=_0x58f457||0xcc;return function(_0xdd8014){if(_0xdd8014){return _0x42e7f2[_0xcba8('0x2e')](_0x58f457);}return _0x42e7f2['status'](_0x58f457)[_0xcba8('0x2f')]();};}function respondWithResult(_0x53dba3,_0x27fd8b){_0x27fd8b=_0x27fd8b||0xc8;return function(_0xbcefa9){if(_0xbcefa9){return _0x53dba3[_0xcba8('0x30')](_0x27fd8b)[_0xcba8('0x31')](_0xbcefa9);}};}function respondWithFilteredResult(_0x567b29,_0x2edf6e){return function(_0x5ecd7b){if(_0x5ecd7b){var _0x39b8b1=_0x5ecd7b[_0xcba8('0x32')],_0x4b514d=_0x2edf6e['offset'],_0x1a6319=_0x2edf6e['offset']+_0x2edf6e[_0xcba8('0x33')],_0x3c2909;if(_0x1a6319>=_0x39b8b1){_0x1a6319=_0x39b8b1;_0x3c2909=0xc8;}else{_0x3c2909=0xce;}_0x567b29[_0xcba8('0x30')](_0x3c2909);return _0x567b29[_0xcba8('0x34')](_0xcba8('0x35'),_0x4b514d+'-'+_0x1a6319+'/'+_0x39b8b1)[_0xcba8('0x31')](_0x5ecd7b);}return null;};}function patchUpdates(_0x5403b7){return function(_0x39bd54){try{jsonpatch[_0xcba8('0x36')](_0x39bd54,_0x5403b7,!![]);}catch(_0xbe42c4){return BPromise[_0xcba8('0x37')](_0xbe42c4);}return _0x39bd54[_0xcba8('0x38')]();};}function saveUpdates(_0x4aaa85,_0x29c9b4){return function(_0x3584e4){if(_0x3584e4){return _0x3584e4[_0xcba8('0x39')](_0x4aaa85)[_0xcba8('0x24')](function(_0x2bd957){return _0x2bd957;});}return null;};}function removeEntity(_0x2bf334,_0x41bae9){return function(_0x43b935){if(_0x43b935){return _0x43b935['destroy']()[_0xcba8('0x24')](function(){_0x2bf334[_0xcba8('0x30')](0xcc)[_0xcba8('0x2f')]();});}};}function handleEntityNotFound(_0x368005,_0x2a1cf0){return function(_0x2d3fef){if(!_0x2d3fef){_0x368005[_0xcba8('0x2e')](0x194);}return _0x2d3fef;};}function handleError(_0x431ce8,_0x2c1a22){_0x2c1a22=_0x2c1a22||0x1f4;return function(_0x468ad2){logger[_0xcba8('0x2b')](_0x468ad2[_0xcba8('0x3a')]);if(_0x468ad2[_0xcba8('0x3b')]){delete _0x468ad2[_0xcba8('0x3b')];}_0x431ce8[_0xcba8('0x30')](_0x2c1a22)['send'](_0x468ad2);};}exports[_0xcba8('0x3c')]=function(_0x25f178,_0x43e91a){var _0x1807a1={},_0x151533={},_0x1952e5={'count':0x0,'rows':[]};var _0x84277f=_[_0xcba8('0x3d')](db[_0xcba8('0x3e')][_0xcba8('0x3f')],function(_0x100de7){return{'name':_0x100de7[_0xcba8('0x40')],'type':_0x100de7[_0xcba8('0x41')][_0xcba8('0x42')]};});_0x151533[_0xcba8('0x43')]=_[_0xcba8('0x3d')](_0x84277f,_0xcba8('0x3b'));_0x151533[_0xcba8('0x44')]=_[_0xcba8('0x45')](_0x25f178[_0xcba8('0x44')]);_0x151533[_0xcba8('0x46')]=_[_0xcba8('0x47')](_0x151533[_0xcba8('0x43')],_0x151533[_0xcba8('0x44')]);_0x1807a1[_0xcba8('0x48')]=_['intersection'](_0x151533['model'],qs[_0xcba8('0x49')](_0x25f178['query'][_0xcba8('0x49')]));_0x1807a1[_0xcba8('0x48')]=_0x1807a1[_0xcba8('0x48')][_0xcba8('0x4a')]?_0x1807a1[_0xcba8('0x48')]:_0x151533[_0xcba8('0x43')];if(!_0x25f178[_0xcba8('0x44')]['hasOwnProperty'](_0xcba8('0x4b'))){_0x1807a1[_0xcba8('0x33')]=qs['limit'](_0x25f178[_0xcba8('0x44')][_0xcba8('0x33')]);_0x1807a1['offset']=qs[_0xcba8('0x4c')](_0x25f178[_0xcba8('0x44')]['offset']);}_0x1807a1[_0xcba8('0x4d')]=qs[_0xcba8('0x4e')](_0x25f178[_0xcba8('0x44')][_0xcba8('0x4e')]);_0x1807a1[_0xcba8('0x4f')]=qs[_0xcba8('0x46')](_[_0xcba8('0x50')](_0x25f178[_0xcba8('0x44')],_0x151533[_0xcba8('0x46')]),_0x84277f);if(_0x25f178['query']['filter']){_0x1807a1[_0xcba8('0x4f')]=_[_0xcba8('0x51')](_0x1807a1[_0xcba8('0x4f')],{'$or':_['map'](_0x84277f,function(_0x436bb2){if(_0x436bb2[_0xcba8('0x41')]!==_0xcba8('0x52')){var _0x2af564={};_0x2af564[_0x436bb2['name']]={'$like':'%'+_0x25f178[_0xcba8('0x44')][_0xcba8('0x53')]+'%'};return _0x2af564;}})});}_0x1807a1=_['merge']({},_0x1807a1,_0x25f178['options']);var _0x388629={'where':_0x1807a1[_0xcba8('0x4f')]};return db['ChatGroup']['count'](_0x388629)[_0xcba8('0x24')](function(_0x577a23){_0x1952e5[_0xcba8('0x32')]=_0x577a23;if(_0x25f178[_0xcba8('0x44')][_0xcba8('0x54')]){_0x1807a1[_0xcba8('0x55')]=[{'all':!![]}];}return db[_0xcba8('0x3e')][_0xcba8('0x56')](_0x1807a1);})[_0xcba8('0x24')](function(_0x24c2f7){_0x1952e5[_0xcba8('0x57')]=_0x24c2f7;return _0x1952e5;})[_0xcba8('0x24')](respondWithFilteredResult(_0x43e91a,_0x1807a1))['catch'](handleError(_0x43e91a,null));};exports[_0xcba8('0x58')]=function(_0x5d32b4,_0x2f2f4c){var _0x4fa5dc={'raw':!![],'where':{'id':_0x5d32b4['params']['id']}},_0x283428={};_0x283428[_0xcba8('0x43')]=_['keys'](db[_0xcba8('0x3e')][_0xcba8('0x3f')]);_0x283428[_0xcba8('0x44')]=_[_0xcba8('0x45')](_0x5d32b4[_0xcba8('0x44')]);_0x283428[_0xcba8('0x46')]=_['intersection'](_0x283428[_0xcba8('0x43')],_0x283428['query']);_0x4fa5dc['attributes']=_[_0xcba8('0x47')](_0x283428[_0xcba8('0x43')],qs['fields'](_0x5d32b4[_0xcba8('0x44')][_0xcba8('0x49')]));_0x4fa5dc[_0xcba8('0x48')]=_0x4fa5dc[_0xcba8('0x48')]['length']?_0x4fa5dc['attributes']:_0x283428[_0xcba8('0x43')];if(_0x5d32b4[_0xcba8('0x44')][_0xcba8('0x54')]){_0x4fa5dc[_0xcba8('0x55')]=[{'all':!![]}];}_0x4fa5dc=_[_0xcba8('0x51')]({},_0x4fa5dc,_0x5d32b4[_0xcba8('0x59')]);return db[_0xcba8('0x3e')]['find'](_0x4fa5dc)[_0xcba8('0x24')](handleEntityNotFound(_0x2f2f4c,null))['then'](respondWithResult(_0x2f2f4c,null))[_0xcba8('0x5a')](handleError(_0x2f2f4c,null));};exports['create']=function(_0x4efa1b,_0x4676ee){return db[_0xcba8('0x3e')]['create'](_0x4efa1b[_0xcba8('0x5b')],{})[_0xcba8('0x24')](respondWithResult(_0x4676ee,0xc9))['catch'](handleError(_0x4676ee,null));};exports[_0xcba8('0x39')]=function(_0x5992ba,_0xb826bd){if(_0x5992ba[_0xcba8('0x5b')]['id']){delete _0x5992ba[_0xcba8('0x5b')]['id'];}return db[_0xcba8('0x3e')]['find']({'where':{'id':_0x5992ba['params']['id']}})[_0xcba8('0x24')](handleEntityNotFound(_0xb826bd,null))[_0xcba8('0x24')](saveUpdates(_0x5992ba[_0xcba8('0x5b')],null))['then'](respondWithResult(_0xb826bd,null))[_0xcba8('0x5a')](handleError(_0xb826bd,null));};exports[_0xcba8('0x5c')]=function(_0x484faf,_0x2b144c){return db[_0xcba8('0x3e')][_0xcba8('0x5d')]({'where':{'id':_0x484faf['params']['id']}})[_0xcba8('0x24')](handleEntityNotFound(_0x2b144c,null))[_0xcba8('0x24')](removeEntity(_0x2b144c,null))[_0xcba8('0x5a')](handleError(_0x2b144c,null));};exports[_0xcba8('0x5e')]=function(_0x4092a5,_0x5c93ea){return db[_0xcba8('0x3e')][_0xcba8('0x5e')]()[_0xcba8('0x24')](respondWithResult(_0x5c93ea,null))[_0xcba8('0x5a')](handleError(_0x5c93ea,null));};exports[_0xcba8('0x5f')]=function(_0x319476,_0x32da39,_0x1cfad4){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x319476[_0xcba8('0x60')]['id'],'ToId':_0x319476['user']['id'],'read':![]}})[_0xcba8('0x24')](function(_0x193d7d){return{'id':_[_0xcba8('0x61')](_0x319476['params']['id']),'count':_0x193d7d};})[_0xcba8('0x24')](respondWithResult(_0x32da39,null))['catch'](handleError(_0x32da39,null));};exports[_0xcba8('0x62')]=function(_0x14a482,_0x1fa286,_0x4977b7){return db['ChatGroup'][_0xcba8('0x5d')]({'where':{'id':_0x14a482[_0xcba8('0x60')]['id']}})['then'](handleEntityNotFound(_0x1fa286,null))['then'](function(_0xf34303){if(_0xf34303){return _0xf34303['addMembers'](_0x14a482[_0xcba8('0x5b')][_0xcba8('0x63')],_[_0xcba8('0x64')](_0x14a482[_0xcba8('0x5b')],[_0xcba8('0x63'),'id'])||{});}})['then'](respondWithResult(_0x1fa286,null))['catch'](handleError(_0x1fa286,null));};exports['getMembers']=function(_0x1f7f8a,_0x4867f8,_0x3b8c2a){var _0x4d65da={};var _0x377351={};var _0x567ef3;var _0x59e01f;return db[_0xcba8('0x3e')][_0xcba8('0x65')]({'where':{'id':_0x1f7f8a[_0xcba8('0x60')]['id']}})[_0xcba8('0x24')](handleEntityNotFound(_0x4867f8,null))[_0xcba8('0x24')](function(_0x472902){if(_0x472902){_0x567ef3=_0x472902;_0x377351['model']=_['keys'](db[_0xcba8('0x66')][_0xcba8('0x3f')]);_0x377351[_0xcba8('0x44')]=_[_0xcba8('0x45')](_0x1f7f8a[_0xcba8('0x44')]);_0x377351[_0xcba8('0x46')]=_[_0xcba8('0x47')](_0x377351['model'],_0x377351[_0xcba8('0x44')]);_0x4d65da[_0xcba8('0x48')]=_[_0xcba8('0x47')](_0x377351[_0xcba8('0x43')],qs[_0xcba8('0x49')](_0x1f7f8a['query']['fields']));_0x4d65da[_0xcba8('0x48')]=_0x4d65da[_0xcba8('0x48')][_0xcba8('0x4a')]?_0x4d65da['attributes']:_0x377351['model'];_0x4d65da[_0xcba8('0x4d')]=qs[_0xcba8('0x4e')](_0x1f7f8a[_0xcba8('0x44')][_0xcba8('0x4e')]);_0x4d65da['where']=qs[_0xcba8('0x46')](_[_0xcba8('0x50')](_0x1f7f8a[_0xcba8('0x44')],_0x377351[_0xcba8('0x46')]));if(_0x1f7f8a[_0xcba8('0x44')]['filter']){_0x4d65da[_0xcba8('0x4f')]=_[_0xcba8('0x51')](_0x4d65da['where'],{'$or':_[_0xcba8('0x3d')](_0x4d65da[_0xcba8('0x48')],function(_0x31d439){var _0x25077f={};_0x25077f[_0x31d439]={'$like':'%'+_0x1f7f8a['query'][_0xcba8('0x53')]+'%'};return _0x25077f;})});}_0x4d65da=_[_0xcba8('0x51')]({},_0x4d65da,_0x1f7f8a[_0xcba8('0x59')]);return _0x567ef3[_0xcba8('0x67')](_0x4d65da);}})['then'](function(_0x491ef0){if(_0x491ef0){_0x59e01f=_0x491ef0['length'];if(!_0x1f7f8a[_0xcba8('0x44')][_0xcba8('0x68')](_0xcba8('0x4b'))){_0x4d65da[_0xcba8('0x33')]=qs[_0xcba8('0x33')](_0x1f7f8a[_0xcba8('0x44')]['limit']);_0x4d65da[_0xcba8('0x4c')]=qs[_0xcba8('0x4c')](_0x1f7f8a[_0xcba8('0x44')][_0xcba8('0x4c')]);}return _0x567ef3[_0xcba8('0x67')](_0x4d65da);}})[_0xcba8('0x24')](function(_0x7f8c81){if(_0x7f8c81){return _0x7f8c81?{'count':_0x59e01f,'rows':_0x7f8c81}:null;}})[_0xcba8('0x24')](respondWithResult(_0x4867f8,null))[_0xcba8('0x5a')](handleError(_0x4867f8,null));};exports['removeMembers']=function(_0x272a7f,_0x161ca,_0x16d67e){return db[_0xcba8('0x3e')]['find']({'where':{'id':_0x272a7f['params']['id']}})['then'](handleEntityNotFound(_0x161ca,null))[_0xcba8('0x24')](function(_0x1d41d5){if(_0x1d41d5){return _0x1d41d5[_0xcba8('0x69')](_0x272a7f[_0xcba8('0x44')][_0xcba8('0x63')]);}})['then'](respondWithStatusCode(_0x161ca,null))[_0xcba8('0x5a')](handleError(_0x161ca,null));};exports[_0xcba8('0x6a')]=function(_0x5dc69a,_0x3caae4,_0x1105e8){if(_0x5dc69a[_0xcba8('0x5b')]['id']){delete _0x5dc69a[_0xcba8('0x5b')]['id'];}return db['ChatGroup'][_0xcba8('0x5d')]({'where':{'id':_0x5dc69a[_0xcba8('0x60')]['id']}})[_0xcba8('0x24')](handleEntityNotFound(_0x3caae4,null))[_0xcba8('0x24')](function(_0x410423){if(_0x410423){_0x5dc69a[_0xcba8('0x5b')][_0xcba8('0x6b')]=_0x410423['id'];return db[_0xcba8('0x6c')]['create'](_0x5dc69a['body']);}})[_0xcba8('0x24')](respondWithResult(_0x3caae4,null))['catch'](handleError(_0x3caae4,null));};exports[_0xcba8('0x6d')]=function(_0x333ad8,_0x3a5bef,_0x1fd61e){var _0x987cc8={};var _0x43a36c={};var _0x3be2b8;var _0x261724;return db[_0xcba8('0x3e')][_0xcba8('0x65')]({'where':{'id':_0x333ad8[_0xcba8('0x60')]['id']}})[_0xcba8('0x24')](handleEntityNotFound(_0x3a5bef,null))[_0xcba8('0x24')](function(_0xf614e9){if(_0xf614e9){_0x3be2b8=_0xf614e9;_0x43a36c[_0xcba8('0x43')]=_[_0xcba8('0x45')](db[_0xcba8('0x6c')][_0xcba8('0x3f')]);_0x43a36c[_0xcba8('0x44')]=_[_0xcba8('0x45')](_0x333ad8[_0xcba8('0x44')]);_0x43a36c[_0xcba8('0x46')]=_['intersection'](_0x43a36c['model'],_0x43a36c[_0xcba8('0x44')]);_0x987cc8[_0xcba8('0x48')]=_[_0xcba8('0x47')](_0x43a36c[_0xcba8('0x43')],qs[_0xcba8('0x49')](_0x333ad8[_0xcba8('0x44')][_0xcba8('0x49')]));_0x987cc8[_0xcba8('0x48')]=_0x987cc8[_0xcba8('0x48')][_0xcba8('0x4a')]?_0x987cc8[_0xcba8('0x48')]:_0x43a36c['model'];_0x987cc8[_0xcba8('0x4d')]=qs[_0xcba8('0x4e')](_0x333ad8[_0xcba8('0x44')][_0xcba8('0x4e')]);_0x987cc8[_0xcba8('0x4f')]=qs['filters'](_[_0xcba8('0x50')](_0x333ad8[_0xcba8('0x44')],_0x43a36c[_0xcba8('0x46')]));if(_0x333ad8[_0xcba8('0x44')][_0xcba8('0x53')]){_0x987cc8[_0xcba8('0x4f')]=_[_0xcba8('0x51')](_0x987cc8[_0xcba8('0x4f')],{'$or':_['map'](_0x987cc8[_0xcba8('0x48')],function(_0x370092){var _0xd3b137={};_0xd3b137[_0x370092]={'$like':'%'+_0x333ad8[_0xcba8('0x44')][_0xcba8('0x53')]+'%'};return _0xd3b137;})});}if(_0x333ad8[_0xcba8('0x44')]['$gte']){var _0x4730ff=_0x333ad8[_0xcba8('0x44')][_0xcba8('0x6e')]['split'](',');var _0x3af364={};_0x3af364[_0x4730ff[0x0]]={'$gte':moment(_0x4730ff[0x1])['format'](_0xcba8('0x6f'))};_0x987cc8[_0xcba8('0x4f')]=_[_0xcba8('0x51')](_0x987cc8['where'],_0x3af364);}_0x987cc8=_[_0xcba8('0x51')]({},_0x987cc8,_0x333ad8[_0xcba8('0x59')]);return _0x3be2b8[_0xcba8('0x6d')](_0x987cc8);}})[_0xcba8('0x24')](function(_0x56cf6b){if(_0x56cf6b){_0x261724=_0x56cf6b[_0xcba8('0x4a')];if(!_0x333ad8['query'][_0xcba8('0x68')](_0xcba8('0x4b'))){_0x987cc8[_0xcba8('0x33')]=qs[_0xcba8('0x33')](_0x333ad8[_0xcba8('0x44')][_0xcba8('0x33')]);_0x987cc8[_0xcba8('0x4c')]=qs[_0xcba8('0x4c')](_0x333ad8['query'][_0xcba8('0x4c')]);}return _0x3be2b8['getMessages'](_0x987cc8);}})[_0xcba8('0x24')](function(_0x6f2f4e){if(_0x6f2f4e){return _0x6f2f4e?{'count':_0x261724,'rows':_0x6f2f4e}:null;}})['then'](respondWithResult(_0x3a5bef,null))[_0xcba8('0x5a')](handleError(_0x3a5bef,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 1a4fd8f..7c23cb7 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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x2032,0xd9));var _0x2203=function(_0x3c0af0,_0x32321e){_0x3c0af0=_0x3c0af0-0x0;var _0x46cf9f=_0x2032[_0x3c0af0];return _0x46cf9f;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x30a4e8,_0x512def){var _0x183b1b=function(_0x3e8dfd){while(--_0x3e8dfd){_0x30a4e8['push'](_0x30a4e8['shift']());}};_0x183b1b(++_0x512def);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1af655,_0x28b928){_0x1af655=_0x1af655-0x0;var _0x29da01=_0x0b0e[_0x1af655];return _0x29da01;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d4e37dc..b1cbb2e 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 _0x3435=['api','moment','bluebird','path','rimraf','exports','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x3435,0xfa));var _0x5343=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x3435[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5343('0x6'));var rimraf=require(_0x5343('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x5343('0x8')]=function(_0x28f0f3,_0x4d26b5){return _0x28f0f3['define'](_0x5343('0x9'),attributes,{'tableName':_0x5343('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ba0=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x2b551e,_0x28680f){_0x2b551e=_0x2b551e-0x0;var _0x230318=_0x8ba0[_0x2b551e];return _0x230318;};'use strict';var _=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var logger=require(_0x08ba('0x2'))(_0x08ba('0x3'));var moment=require(_0x08ba('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08ba('0x5'));var rimraf=require(_0x08ba('0x6'));var config=require(_0x08ba('0x7'));var attributes=require(_0x08ba('0x8'));module[_0x08ba('0x9')]=function(_0x161a9d,_0x5f29fa){return _0x161a9d[_0x08ba('0xa')](_0x08ba('0xb'),attributes,{'tableName':_0x08ba('0xc'),'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 766449b..740a5dd 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 _0x20ff=['defaults','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','code','error','message','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x381478,_0x5dfc86){var _0x5743d5=function(_0x57f242){while(--_0x57f242){_0x381478['push'](_0x381478['shift']());}};_0x5743d5(++_0x5dfc86);}(_0x20ff,0x166));var _0xf20f=function(_0x4f3b4b,_0x590f08){_0x4f3b4b=_0x4f3b4b-0x0;var _0x1249e0=_0x20ff[_0x4f3b4b];return _0x1249e0;};'use strict';var _=require('lodash');var util=require(_0xf20f('0x0'));var moment=require('moment');var BPromise=require(_0xf20f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf20f('0x3'));var logger=require(_0xf20f('0x4'))(_0xf20f('0x5'));var config=require(_0xf20f('0x6'));var jayson=require(_0xf20f('0x7'));var client=jayson['client'][_0xf20f('0x8')]({'port':0x232a});config[_0xf20f('0x9')]=_[_0xf20f('0xa')](config['redis'],{'host':_0xf20f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf20f('0xc'))[_0xf20f('0xd')](socket);function respondWithRpcPromise(_0x2519d8,_0x55603e,_0x92590c){return new BPromise(function(_0x56dcc7,_0x231e2b){return client['request'](_0x2519d8,_0x92590c)[_0xf20f('0xe')](function(_0x5a80b3){logger[_0xf20f('0xf')](_0xf20f('0x10'),_0x55603e,_0xf20f('0x11'));logger[_0xf20f('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x55603e,_0xf20f('0x11'),JSON['stringify'](_0x5a80b3));if(_0x5a80b3['error']){if(_0x5a80b3['error'][_0xf20f('0x13')]===0x1f4){logger[_0xf20f('0x14')](_0xf20f('0x10'),_0x55603e,_0x5a80b3[_0xf20f('0x14')][_0xf20f('0x15')]);return _0x231e2b(_0x5a80b3[_0xf20f('0x14')]['message']);}logger[_0xf20f('0x14')](_0xf20f('0x10'),_0x55603e,_0x5a80b3[_0xf20f('0x14')][_0xf20f('0x15')]);return _0x56dcc7(_0x5a80b3[_0xf20f('0x14')]['message']);}else{logger[_0xf20f('0xf')]('ChatGroup,\x20%s,\x20%s',_0x55603e,'request\x20sent');_0x56dcc7(_0x5a80b3['result']['message']);}})[_0xf20f('0x16')](function(_0x179c89){logger[_0xf20f('0x14')](_0xf20f('0x10'),_0x55603e,_0x179c89);_0x231e2b(_0x179c89);});});} \ No newline at end of file +var _0xdf1c=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xdf1c,0x1d0));var _0xcdf1=function(_0x4e78b9,_0x3d93f4){_0x4e78b9=_0x4e78b9-0x0;var _0x426e38=_0xdf1c[_0x4e78b9];return _0x426e38;};'use strict';var _=require(_0xcdf1('0x0'));var util=require('util');var moment=require(_0xcdf1('0x1'));var BPromise=require(_0xcdf1('0x2'));var rs=require(_0xcdf1('0x3'));var fs=require('fs');var Redis=require(_0xcdf1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdf1('0x5'));var logger=require(_0xcdf1('0x6'))(_0xcdf1('0x7'));var config=require('../../config/environment');var jayson=require(_0xcdf1('0x8'));var client=jayson['client'][_0xcdf1('0x9')]({'port':0x232a});config[_0xcdf1('0xa')]=_[_0xcdf1('0xb')](config[_0xcdf1('0xa')],{'host':_0xcdf1('0xc'),'port':0x18eb});var socket=require(_0xcdf1('0xd'))(new Redis(config['redis']));require(_0xcdf1('0xe'))[_0xcdf1('0xf')](socket);function respondWithRpcPromise(_0x3a08cd,_0xf92784,_0xea87fb){return new BPromise(function(_0x34e07b,_0x366ba2){return client[_0xcdf1('0x10')](_0x3a08cd,_0xea87fb)[_0xcdf1('0x11')](function(_0x50db3b){logger['info'](_0xcdf1('0x12'),_0xf92784,'request\x20sent');logger[_0xcdf1('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xf92784,_0xcdf1('0x14'),JSON[_0xcdf1('0x15')](_0x50db3b));if(_0x50db3b[_0xcdf1('0x16')]){if(_0x50db3b[_0xcdf1('0x16')][_0xcdf1('0x17')]===0x1f4){logger['error'](_0xcdf1('0x12'),_0xf92784,_0x50db3b[_0xcdf1('0x16')]['message']);return _0x366ba2(_0x50db3b[_0xcdf1('0x16')][_0xcdf1('0x18')]);}logger[_0xcdf1('0x16')](_0xcdf1('0x12'),_0xf92784,_0x50db3b[_0xcdf1('0x16')][_0xcdf1('0x18')]);return _0x34e07b(_0x50db3b['error'][_0xcdf1('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0xf92784,_0xcdf1('0x14'));_0x34e07b(_0x50db3b[_0xcdf1('0x19')]['message']);}})[_0xcdf1('0x1a')](function(_0x545388){logger[_0xcdf1('0x16')](_0xcdf1('0x12'),_0xf92784,_0x545388);_0x366ba2(_0x545388);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 40ae898..8dc3766 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 _0x4c39=['./chatGroup.events','save','update','emit','removeListener','register','chatGroup:'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x4c39,0x134));var _0x94c3=function(_0x577f3d,_0x43ab79){_0x577f3d=_0x577f3d-0x0;var _0x3b11f6=_0x4c39[_0x577f3d];return _0x3b11f6;};'use strict';var ChatGroupEvents=require(_0x94c3('0x0'));var events=[_0x94c3('0x1'),'remove',_0x94c3('0x2')];function createListener(_0xb5b577,_0x5d1ff0){return function(_0x10b9be){_0x5d1ff0[_0x94c3('0x3')](_0xb5b577,_0x10b9be);};}function removeListener(_0x13fb47,_0x60ca2a){return function(){ChatGroupEvents[_0x94c3('0x4')](_0x13fb47,_0x60ca2a);};}exports[_0x94c3('0x5')]=function(_0x25d5ee){for(var _0x24691b=0x0,_0x175b71=events['length'];_0x24691b<_0x175b71;_0x24691b++){var _0x3cbabd=events[_0x24691b];var _0x397dba=createListener(_0x94c3('0x6')+_0x3cbabd,_0x25d5ee);ChatGroupEvents['on'](_0x3cbabd,_0x397dba);}}; \ No newline at end of file +var _0x74b1=['emit','register','save'];(function(_0xbd9b37,_0x174462){var _0x74117=function(_0x19f1e3){while(--_0x19f1e3){_0xbd9b37['push'](_0xbd9b37['shift']());}};_0x74117(++_0x174462);}(_0x74b1,0x19d));var _0x174b=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x74b1[_0x587693];return _0x510a1a;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x174b('0x0'),'remove','update'];function createListener(_0x3c6dae,_0x560339){return function(_0x4cda5f){_0x560339[_0x174b('0x1')](_0x3c6dae,_0x4cda5f);};}function removeListener(_0x453bc5,_0x37b5e2){return function(){ChatGroupEvents['removeListener'](_0x453bc5,_0x37b5e2);};}exports[_0x174b('0x2')]=function(_0x5890ca){for(var _0x3cd09b=0x0,_0x40f271=events['length'];_0x3cd09b<_0x40f271;_0x3cd09b++){var _0x4fc525=events[_0x3cd09b];var _0x5a9488=createListener('chatGroup:'+_0x4fc525,_0x5890ca);ChatGroupEvents['on'](_0x4fc525,_0x5a9488);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4ee4123..56d45f0 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 _0x7cec=['post','/:id/members','addMembers','addMessage','/:id','update','delete','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','get','/describe','describe','show','/:id/unread','getUnread','/:id/messages','create'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7cec,0xa4));var _0xc7ce=function(_0x286f47,_0x3dbf71){_0x286f47=_0x286f47-0x0;var _0x55fa63=_0x7cec[_0x286f47];return _0x55fa63;};'use strict';var multer=require(_0xc7ce('0x0'));var util=require(_0xc7ce('0x1'));var path=require(_0xc7ce('0x2'));var timeout=require(_0xc7ce('0x3'));var express=require(_0xc7ce('0x4'));var router=express[_0xc7ce('0x5')]();var auth=require(_0xc7ce('0x6'));var interaction=require(_0xc7ce('0x7'));var config=require('../../config/environment');var controller=require(_0xc7ce('0x8'));router['get']('/',auth[_0xc7ce('0x9')](),controller['index']);router[_0xc7ce('0xa')](_0xc7ce('0xb'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0xc')]);router[_0xc7ce('0xa')]('/:id',auth[_0xc7ce('0x9')](),controller[_0xc7ce('0xd')]);router[_0xc7ce('0xa')](_0xc7ce('0xe'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0xf')]);router[_0xc7ce('0xa')]('/:id/members',auth[_0xc7ce('0x9')](),controller['getMembers']);router[_0xc7ce('0xa')](_0xc7ce('0x10'),auth[_0xc7ce('0x9')](),controller['getMessages']);router['post']('/',auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x11')]);router[_0xc7ce('0x12')](_0xc7ce('0x13'),auth['isAuthenticated'](),controller[_0xc7ce('0x14')]);router[_0xc7ce('0x12')](_0xc7ce('0x10'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x15')]);router['put'](_0xc7ce('0x16'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x17')]);router[_0xc7ce('0x18')](_0xc7ce('0x16'),auth[_0xc7ce('0x9')](),controller['destroy']);router[_0xc7ce('0x18')](_0xc7ce('0x13'),auth[_0xc7ce('0x9')](),controller[_0xc7ce('0x19')]);module['exports']=router; \ No newline at end of file +var _0x414c=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','destroy','delete','removeMembers','exports','multer'];(function(_0x3e3882,_0x2a1650){var _0x1b4fa0=function(_0x582583){while(--_0x582583){_0x3e3882['push'](_0x3e3882['shift']());}};_0x1b4fa0(++_0x2a1650);}(_0x414c,0xb9));var _0xc414=function(_0x37174b,_0xb00258){_0x37174b=_0x37174b-0x0;var _0x1ed114=_0x414c[_0x37174b];return _0x1ed114;};'use strict';var multer=require(_0xc414('0x0'));var util=require(_0xc414('0x1'));var path=require(_0xc414('0x2'));var timeout=require('connect-timeout');var express=require(_0xc414('0x3'));var router=express[_0xc414('0x4')]();var auth=require(_0xc414('0x5'));var interaction=require(_0xc414('0x6'));var config=require(_0xc414('0x7'));var controller=require(_0xc414('0x8'));router['get']('/',auth[_0xc414('0x9')](),controller[_0xc414('0xa')]);router[_0xc414('0xb')]('/describe',auth[_0xc414('0x9')](),controller[_0xc414('0xc')]);router[_0xc414('0xb')](_0xc414('0xd'),auth[_0xc414('0x9')](),controller[_0xc414('0xe')]);router[_0xc414('0xb')](_0xc414('0xf'),auth['isAuthenticated'](),controller[_0xc414('0x10')]);router[_0xc414('0xb')](_0xc414('0x11'),auth[_0xc414('0x9')](),controller[_0xc414('0x12')]);router[_0xc414('0xb')](_0xc414('0x13'),auth[_0xc414('0x9')](),controller[_0xc414('0x14')]);router[_0xc414('0x15')]('/',auth[_0xc414('0x9')](),controller[_0xc414('0x16')]);router[_0xc414('0x15')](_0xc414('0x11'),auth['isAuthenticated'](),controller[_0xc414('0x17')]);router[_0xc414('0x15')]('/:id/messages',auth[_0xc414('0x9')](),controller[_0xc414('0x18')]);router[_0xc414('0x19')](_0xc414('0xd'),auth[_0xc414('0x9')](),controller[_0xc414('0x1a')]);router['delete']('/:id',auth[_0xc414('0x9')](),controller[_0xc414('0x1b')]);router[_0xc414('0x1c')](_0xc414('0x11'),auth['isAuthenticated'](),controller[_0xc414('0x1d')]);module[_0xc414('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a6e7104..0c1b225 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 _0xa7bf=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long'];(function(_0x5ad20e,_0x138f09){var _0x4f618d=function(_0xf92595){while(--_0xf92595){_0x5ad20e['push'](_0x5ad20e['shift']());}};_0x4f618d(++_0x138f09);}(_0xa7bf,0xf0));var _0xfa7b=function(_0x373a3f,_0x1491ce){_0x373a3f=_0x373a3f-0x0;var _0x355666=_0xa7bf[_0x373a3f];return _0x355666;};'use strict';var Sequelize=require(_0xfa7b('0x0'));module[_0xfa7b('0x1')]={'closed':{'type':Sequelize[_0xfa7b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfa7b('0x3')]},'ratingType':{'type':Sequelize[_0xfa7b('0x4')]('star','thumb'),'defaultValue':_0xfa7b('0x5')},'ratingMessage':{'type':Sequelize[_0xfa7b('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xfa7b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfa7b('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfa7b('0x7')]},'browserName':{'type':Sequelize[_0xfa7b('0x7')]},'browserVersion':{'type':Sequelize[_0xfa7b('0x7')]},'osName':{'type':Sequelize[_0xfa7b('0x7')]},'osVersion':{'type':Sequelize[_0xfa7b('0x7')]},'deviceModel':{'type':Sequelize[_0xfa7b('0x7')]},'deviceVendor':{'type':Sequelize[_0xfa7b('0x7')]},'deviceType':{'type':Sequelize[_0xfa7b('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xfa7b('0x7')]},'formData':{'type':Sequelize[_0xfa7b('0x6')](_0xfa7b('0x9'))},'read1stAt':{'type':Sequelize[_0xfa7b('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfa7b('0x7')]},'customerPort':{'type':Sequelize[_0xfa7b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xfa7b('0x6')]}}; \ No newline at end of file +var _0x6edf=['ENUM','star','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x19dbac,_0x14d339){var _0x528f86=function(_0x28d580){while(--_0x28d580){_0x19dbac['push'](_0x19dbac['shift']());}};_0x528f86(++_0x14d339);}(_0x6edf,0x1a0));var _0xf6ed=function(_0x420deb,_0x2ffb5a){_0x420deb=_0x420deb-0x0;var _0x49f794=_0x6edf[_0x420deb];return _0x49f794;};'use strict';var Sequelize=require(_0xf6ed('0x0'));module[_0xf6ed('0x1')]={'closed':{'type':Sequelize[_0xf6ed('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf6ed('0x3')]},'ratingType':{'type':Sequelize[_0xf6ed('0x4')](_0xf6ed('0x5'),'thumb'),'defaultValue':_0xf6ed('0x5')},'ratingMessage':{'type':Sequelize[_0xf6ed('0x6')]},'pathTranscript':{'type':Sequelize[_0xf6ed('0x6')]},'mailTranscript':{'type':Sequelize[_0xf6ed('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf6ed('0x8')]},'disposition':{'type':Sequelize[_0xf6ed('0x7')]},'note':{'type':Sequelize[_0xf6ed('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xf6ed('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xf6ed('0x7')]},'deviceModel':{'type':Sequelize[_0xf6ed('0x7')]},'deviceVendor':{'type':Sequelize[_0xf6ed('0x7')]},'deviceType':{'type':Sequelize[_0xf6ed('0x7')]},'referer':{'type':Sequelize[_0xf6ed('0x6')]},'customerIp':{'type':Sequelize[_0xf6ed('0x7')]},'formData':{'type':Sequelize[_0xf6ed('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xf6ed('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf6ed('0x4')]('in',_0xf6ed('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf6ed('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xf6ed('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index afc7f36..a05ac7e 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 _0xa456=['Owner','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatInteraction.socket','client','http','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~!@#$%^&-_=+[{]}.','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','index','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','hasOwnProperty','limit','sort','where','pick','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','clone','order','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','ChatInteraction','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','merge','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Sequelize','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','Attachment','attachmentDownload','download','root','server/files/attachments/','close','mailTranscript','join','format','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','nolimit','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD'];(function(_0x10e3ed,_0x23af0e){var _0x8f5c5f=function(_0x148c27){while(--_0x148c27){_0x10e3ed['push'](_0x10e3ed['shift']());}};_0x8f5c5f(++_0x23af0e);}(_0xa456,0x142));var _0x6a45=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa456[_0x39096d];return _0x13da4f;};'use strict';var pdf=require(_0x6a45('0x0'));var emlformat=require(_0x6a45('0x1'));var rimraf=require(_0x6a45('0x2'));var zipdir=require(_0x6a45('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a45('0x4'));var moment=require(_0x6a45('0x5'));var BPromise=require(_0x6a45('0x6'));var Mustache=require('mustache');var util=require(_0x6a45('0x7'));var path=require(_0x6a45('0x8'));var sox=require(_0x6a45('0x9'));var csv=require(_0x6a45('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6a45('0x18')],{'host':_0x6a45('0x19'),'port':0x18eb});var socket=require(_0x6a45('0x1a'))(new Redis(config[_0x6a45('0x18')]));require(_0x6a45('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6a45('0x1c')][_0x6a45('0x1d')]({'port':0x232b});var client9004=jayson['client'][_0x6a45('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x171176,_0x3fab82,_0x13adc0){if(_0x13adc0){var _0x548634=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x548634['test'](_0x3fab82)){return _0x171176;}else{throw new db['Sequelize'][(_0x6a45('0x1e'))](_0x6a45('0x1f'));}}else{return _0x171176;}}function respondWithRpcPromise(_0x360b7f,_0x52a055,_0x379c22,_0x102981){return new BPromise(function(_0x3439c8,_0x49fc10){var _0x52e7bf=_0x102981||client;return _0x52e7bf['request'](_0x360b7f,_0x379c22)[_0x6a45('0x20')](function(_0x2ed1e5){logger['info'](_0x6a45('0x21'),_0x52a055,_0x6a45('0x22'));logger['debug'](_0x6a45('0x23'),_0x52a055,_0x6a45('0x22'),JSON[_0x6a45('0x24')](_0x2ed1e5));if(_0x2ed1e5[_0x6a45('0x25')]){if(_0x2ed1e5[_0x6a45('0x25')]['code']===0x1f4){logger['error'](_0x6a45('0x21'),_0x52a055,_0x2ed1e5[_0x6a45('0x25')][_0x6a45('0x26')]);return _0x49fc10(_0x2ed1e5[_0x6a45('0x25')][_0x6a45('0x26')]);}logger[_0x6a45('0x25')](_0x6a45('0x21'),_0x52a055,_0x2ed1e5[_0x6a45('0x25')][_0x6a45('0x26')]);return _0x3439c8(_0x2ed1e5[_0x6a45('0x25')][_0x6a45('0x26')]);}else{logger[_0x6a45('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x52a055,_0x6a45('0x22'));_0x3439c8(_0x2ed1e5['result'][_0x6a45('0x26')]);}})[_0x6a45('0x28')](function(_0x28bdf0){logger[_0x6a45('0x25')](_0x6a45('0x21'),_0x52a055,_0x28bdf0);_0x49fc10(_0x28bdf0);});});}function respondWithStatusCode(_0x526062,_0x2b8cc8){_0x2b8cc8=_0x2b8cc8||0xcc;return function(_0x308003){if(_0x308003){return _0x526062[_0x6a45('0x29')](_0x2b8cc8);}return _0x526062[_0x6a45('0x2a')](_0x2b8cc8)[_0x6a45('0x2b')]();};}function respondWithResult(_0x227b6f,_0x3fac9b){_0x3fac9b=_0x3fac9b||0xc8;return function(_0x313c13){if(_0x313c13){return _0x227b6f['status'](_0x3fac9b)[_0x6a45('0x2c')](_0x313c13);}};}function respondWithFilteredResult(_0x1eedbe,_0x22b320){return function(_0x201369){if(_0x201369){var _0x3b07a1=_0x201369[_0x6a45('0x2d')],_0x5dc288=_0x22b320[_0x6a45('0x2e')],_0x1f95d4=_0x22b320['offset']+_0x22b320['limit'],_0x1f96bf;if(_0x1f95d4>=_0x3b07a1){_0x1f95d4=_0x3b07a1;_0x1f96bf=0xc8;}else{_0x1f96bf=0xce;}_0x1eedbe[_0x6a45('0x2a')](_0x1f96bf);return _0x1eedbe['set'](_0x6a45('0x2f'),_0x5dc288+'-'+_0x1f95d4+'/'+_0x3b07a1)['json'](_0x201369);}return null;};}function patchUpdates(_0x3dcddf){return function(_0x101a0f){try{jsonpatch[_0x6a45('0x30')](_0x101a0f,_0x3dcddf,!![]);}catch(_0x203727){return BPromise[_0x6a45('0x31')](_0x203727);}return _0x101a0f[_0x6a45('0x32')]();};}function saveUpdates(_0x351e70,_0x2b6cc5){return function(_0x8c8cc3){if(_0x8c8cc3){return _0x8c8cc3[_0x6a45('0x33')](_0x351e70)[_0x6a45('0x20')](function(_0x1893b9){return _0x1893b9;});}return null;};}function removeEntity(_0x44c1cc,_0x483b00){return function(_0x2bc67b){if(_0x2bc67b){return _0x2bc67b['destroy']()[_0x6a45('0x20')](function(){_0x44c1cc[_0x6a45('0x2a')](0xcc)[_0x6a45('0x2b')]();});}};}function handleEntityNotFound(_0x2b052e,_0x462d1f){return function(_0x2199c1){if(!_0x2199c1){_0x2b052e['sendStatus'](0x194);}return _0x2199c1;};}function handleError(_0x2030a2,_0x2abd19){_0x2abd19=_0x2abd19||0x1f4;return function(_0x2b75f6){logger[_0x6a45('0x25')](_0x2b75f6[_0x6a45('0x34')]);if(_0x2b75f6[_0x6a45('0x35')]){delete _0x2b75f6['name'];}_0x2030a2[_0x6a45('0x2a')](_0x2abd19)[_0x6a45('0x36')](_0x2b75f6);};}function getInteractionUsers(_0x5c76bd,_0xb99ba3){return new BPromise(function(_0x32f014,_0x10cb71){try{if(_0xb99ba3[_0x5c76bd['id']]){_0x5c76bd[_0x6a45('0x37')]=_[_0x6a45('0x38')](_0xb99ba3[_0x5c76bd['id']],function(_0x50ebe0){return{'id':_0x50ebe0['id'],'fullname':_0x50ebe0[_0x6a45('0x39')]};});}}catch(_0xca32dd){_0x10cb71(_0xca32dd);}_0x32f014(_0x5c76bd);});}function getInteractionTags(_0x205afd,_0x405093){return new BPromise(function(_0x2e781b,_0x35c9dc){try{if(_0x205afd[_0x6a45('0x3a')]){_0x205afd['Tags']=[];_0x205afd[_0x6a45('0x3a')]['split'](',')[_0x6a45('0x3b')](function(_0x402d7f){_0x205afd[_0x6a45('0x3c')][_0x6a45('0x3d')](_0x405093[_0x402d7f]);});}delete _0x205afd['TagIds'];}catch(_0x4805dd){_0x35c9dc(_0x4805dd);}_0x2e781b(_0x205afd);});}function updateChatInteraction(_0x4736c9,_0x21d951,_0x51bc51){return new BPromise(function(_0x39331b,_0x3d8513){return getInteractionUsers(_0x4736c9,_0x51bc51)[_0x6a45('0x20')](function(_0x33347b){return getInteractionTags(_0x33347b,_0x21d951);})['then'](function(_0x508cdc){_0x39331b(_0x508cdc);})['catch'](function(_0x5b9798){_0x3d8513(_0x5b9798);});});}exports[_0x6a45('0x3e')]=function(_0xb5d191,_0x328d9f){var _0xcf722b={},_0x2a0eac={},_0x26d9b7={'count':0x0,'rows':[]};var _0x1114eb=_[_0x6a45('0x38')](db['ChatInteraction'][_0x6a45('0x3f')],function(_0x575ab9){return{'name':_0x575ab9['fieldName'],'type':_0x575ab9[_0x6a45('0x40')][_0x6a45('0x41')]};});_0x2a0eac['model']=_[_0x6a45('0x38')](_0x1114eb,'name');_0x2a0eac[_0x6a45('0x42')]=_[_0x6a45('0x43')](_0xb5d191[_0x6a45('0x42')]);_0x2a0eac[_0x6a45('0x44')]=_['intersection'](_0x2a0eac[_0x6a45('0x45')],_0x2a0eac[_0x6a45('0x42')]);_0xcf722b[_0x6a45('0x46')]=_[_0x6a45('0x47')](_0x2a0eac[_0x6a45('0x45')],qs['fields'](_0xb5d191[_0x6a45('0x42')]['fields']));_0xcf722b[_0x6a45('0x46')]=_0xcf722b[_0x6a45('0x46')]['length']?_0xcf722b[_0x6a45('0x46')]:_0x2a0eac[_0x6a45('0x45')];if(!_0xb5d191[_0x6a45('0x42')][_0x6a45('0x48')]('nolimit')){_0xcf722b[_0x6a45('0x49')]=qs['limit'](_0xb5d191[_0x6a45('0x42')]['limit']);_0xcf722b[_0x6a45('0x2e')]=qs[_0x6a45('0x2e')](_0xb5d191[_0x6a45('0x42')][_0x6a45('0x2e')]);}_0xcf722b['order']=qs[_0x6a45('0x4a')](_0xb5d191[_0x6a45('0x42')][_0x6a45('0x4a')]);_0xcf722b[_0x6a45('0x4b')]=qs[_0x6a45('0x44')](_[_0x6a45('0x4c')](_0xb5d191[_0x6a45('0x42')],_0x2a0eac[_0x6a45('0x44')]),_0x1114eb);var _0x134ace=[];var _0x265fa1=squel['select']()[_0x6a45('0x4d')]('id')[_0x6a45('0x4d')](_0x6a45('0x35'))[_0x6a45('0x4d')]('color')[_0x6a45('0x4e')](_0x6a45('0x4f'));var _0x3f3639=squel['select']()['field']('u.id')[_0x6a45('0x4d')](_0x6a45('0x50'))[_0x6a45('0x4d')](_0x6a45('0x51'))['from'](_0x6a45('0x52'),'ui')[_0x6a45('0x53')](_0x6a45('0x54'),'u',_0x6a45('0x55'));var _0x562c0d=squel[_0x6a45('0x56')]()[_0x6a45('0x4e')](_0x6a45('0x57'),'i')['left_join']('cm_contacts','c',_0x6a45('0x58'))[_0x6a45('0x53')]('users','o',_0x6a45('0x59'))[_0x6a45('0x53')](_0x6a45('0x5a'),'a',_0x6a45('0x5b'))[_0x6a45('0x53')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x6a45('0x53')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0x6a45('0x4f'),'t',_0x6a45('0x5c'));var _0x1a8604=squel[_0x6a45('0x5d')]();var _0x52e50d=[];var _0x4f3309=squel[_0x6a45('0x5d')]();var _0x5f6158;if(_0xb5d191[_0x6a45('0x42')][_0x6a45('0x5e')]){_0x5f6158=as[_0x6a45('0x5f')](_0xb5d191['query'][_0x6a45('0x5e')]);var _0x162cff=_0x5f6158[_0x6a45('0x60')];for(var _0x3dd06f=0x0;_0x3dd06f<_0x5f6158[_0x6a45('0x61')][_0x6a45('0x62')];_0x3dd06f++){var _0x1e4a91=_0x5f6158[_0x6a45('0x61')][_0x3dd06f];var _0x141546='i';var _0x4a6f4c=_[_0x6a45('0x63')](_0x1114eb,[_0x6a45('0x35'),_0x1e4a91[_0x6a45('0x4d')]]);if(!_0x4a6f4c){switch(_0x1e4a91['field']){case _0x6a45('0x64'):if(_0x1e4a91['value']==0x1){_0x562c0d[_0x6a45('0x65')]('`'+_0x1e4a91[_0x6a45('0x4d')]+'`\x20=\x200');}else{_0x562c0d[_0x6a45('0x65')]('`'+_0x1e4a91[_0x6a45('0x4d')]+'`\x20>\x200');}break;case _0x6a45('0x66'):if(_0x1e4a91[_0x6a45('0x67')]==='$substring'){if(_0x1e4a91['value'][_0x6a45('0x68')]('\x20')[_0x6a45('0x62')]>0x1){_0x1a8604[_0x162cff](_0x6a45('0x69'),qs[_0x6a45('0x6a')](_0x1e4a91[_0x6a45('0x6b')]),null);}else{var _0x482b3e='%'+_0x1e4a91['value']+'%';_0x1a8604[_0x162cff](_0x6a45('0x6c'),_0x482b3e,_0x482b3e,_0x482b3e);}}else{_0x4a6f4c=_[_0x6a45('0x63')](_0x1114eb,['name',_0x6a45('0x6d')]);_0x1e4a91[_0x6a45('0x4d')]=_0x6a45('0x6d');_0x1cef70=as[_0x6a45('0x6e')](_0x141546,_0x4a6f4c['type'],_0x1e4a91);_0x1a8604[_0x162cff](_0x1cef70[_0x6a45('0x6f')],_0x1cef70[_0x6a45('0x6b')][_0x6a45('0x70')],_0x1cef70[_0x6a45('0x6b')][_0x6a45('0x2b')]);}break;case _0x6a45('0x71'):var _0x3a87bf=_0x1e4a91[_0x6a45('0x6b')][_0x6a45('0x68')](',')[_0x6a45('0x38')](function(_0x403711){return Number(_0x403711);});_0x3a87bf[_0x6a45('0x3b')](function(_0x66285d){_0x4f3309['or'](_0x6a45('0x72'),'%,'+_0x66285d+',%');});_0x52e50d=_[_0x6a45('0x73')](_0x52e50d,_0x3a87bf);break;case _0x6a45('0x74'):if(_0x1e4a91[_0x6a45('0x67')]===_0x6a45('0x75')){_0x1a8604[_0x162cff]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1e4a91[_0x6a45('0x6b')]+'%',null);}else{_0x4a6f4c=_['find'](_0x1114eb,[_0x6a45('0x35'),'UserId']);_0x1e4a91[_0x6a45('0x4d')]=_0x6a45('0x76');_0x1cef70=as[_0x6a45('0x6e')](_0x141546,_0x4a6f4c[_0x6a45('0x40')],_0x1e4a91);_0x1a8604[_0x162cff](_0x1cef70[_0x6a45('0x6f')],_0x1cef70[_0x6a45('0x6b')][_0x6a45('0x70')],_0x1cef70[_0x6a45('0x6b')][_0x6a45('0x2b')]);}break;case'body':_0x1cef70=as[_0x6a45('0x6e')]('me',null,_0x1e4a91);_0x1a8604[_0x162cff](_0x1cef70['text'],_0x1cef70[_0x6a45('0x6b')][_0x6a45('0x70')],_0x1cef70[_0x6a45('0x6b')]['end']);break;}}else{var _0x1cef70=as[_0x6a45('0x6e')](_0x141546,_0x4a6f4c[_0x6a45('0x40')],_0x1e4a91);_0x1a8604[_0x162cff](_0x1cef70[_0x6a45('0x6f')],_0x1cef70[_0x6a45('0x6b')][_0x6a45('0x70')],_0x1cef70[_0x6a45('0x6b')]['end']);}}}else{var _0x5c6ded=_(_0xb5d191[_0x6a45('0x42')])[_0x6a45('0x43')]()[_0x6a45('0x38')](function(_0xf3ba74){return _[_0x6a45('0x77')](_0x1114eb,[_0x6a45('0x35'),_0xf3ba74])?_0xf3ba74:undefined;})['compact']()[_0x6a45('0x6b')]();if(!_[_0x6a45('0x78')](_0x5c6ded)){_0x5c6ded['forEach'](function(_0x3173ce){if(_0x3173ce==='ChatWebsiteId'){_0x562c0d['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x6a45('0x79')](_0xb5d191[_0x6a45('0x42')][_0x3173ce]));}else if(_0x3173ce===_0x6a45('0x7a')){var _0x4dea29=JSON[_0x6a45('0x7b')](_0xb5d191[_0x6a45('0x42')][_0x3173ce])[_0x6a45('0x7c')];var _0x197c3a=JSON[_0x6a45('0x7b')](_0xb5d191[_0x6a45('0x42')][_0x3173ce])[_0x6a45('0x7d')];_0x562c0d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4dea29,_0x197c3a);}else{if(_0xb5d191[_0x6a45('0x42')][_0x3173ce]===_0x6a45('0x7e')){_0x562c0d[_0x6a45('0x4b')]('i.'+_0x3173ce+_0x6a45('0x7f'));}else{_0x562c0d[_0x6a45('0x4b')]('i.'+_0x3173ce+'\x20=\x20?',_0xb5d191[_0x6a45('0x42')][_0x3173ce]);}}});}if(_0xb5d191[_0x6a45('0x42')][_0x6a45('0x80')]){if(_0xb5d191[_0x6a45('0x42')][_0x6a45('0x80')]==0x1){_0x562c0d[_0x6a45('0x65')](_0x6a45('0x81'));}else{_0x562c0d['having'](_0x6a45('0x82'));}}if(_0xb5d191[_0x6a45('0x42')]['tag']){_0x52e50d=_[_0x6a45('0x83')](_0xb5d191[_0x6a45('0x42')][_0x6a45('0x84')])?_0xb5d191[_0x6a45('0x42')]['tag']:new Array(_0xb5d191[_0x6a45('0x42')][_0x6a45('0x84')]);_0x52e50d['forEach'](function(_0x45f49f){_0x4f3309['or'](_0x6a45('0x72'),'%,'+_0x45f49f+',%');});}if(_0xb5d191[_0x6a45('0x42')]['filter']){var _0x275cdf=_0xb5d191[_0x6a45('0x42')][_0x6a45('0x85')][_0x6a45('0x86')]('\x5c','\x5c\x5c')[_0x6a45('0x86')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x6a45('0x87')](_0x275cdf)){_0x1a8604['or'](_0x6a45('0x88'),_0x275cdf+'%');}else{_0x1a8604['or'](_0x6a45('0x89'),qs[_0x6a45('0x6a')](_0x275cdf))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x275cdf+'%');}}}_0x562c0d[_0x6a45('0x4b')](_0x1a8604);_0x562c0d[_0x6a45('0x8a')](_0x6a45('0x8b'));var _0x50c92b={'type':db['Sequelize'][_0x6a45('0x8c')]['SELECT'],'raw':!![]};var _0x203108=_0x562c0d[_0x6a45('0x8d')]();_0x203108[_0x6a45('0x4d')]('i.id');_0x203108['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6a45('0x64'));if(_0xcf722b[_0x6a45('0x8e')]){_0xcf722b[_0x6a45('0x8e')][_0x6a45('0x3b')](function(_0x3cfa02){_0x562c0d['order']('i.'+_0x3cfa02[0x0],_0x3cfa02[0x1]===_0x6a45('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x52e50d)){_0x562c0d['having'](_0x4f3309);_0x203108[_0x6a45('0x4b')](_0x6a45('0x90'),_0x52e50d);}BPromise[_0x6a45('0x91')]()[_0x6a45('0x20')](function(){if(!_0x5f6158){if(_0xb5d191['query'][_0x6a45('0x92')]||_0xb5d191['query'][_0x6a45('0x93')])return;_0x203108[_0x6a45('0x4b')](_0x6a45('0x94'));_0x562c0d[_0x6a45('0x4b')](_0x6a45('0x94'));return;}return _0xb5d191[_0x6a45('0x95')][_0x6a45('0x96')]({'attributes':['id'],'raw':!![]})[_0x6a45('0x20')](function(_0xc6b82b){if(_[_0x6a45('0x78')](_0xc6b82b)){_0x203108[_0x6a45('0x4b')](_0x6a45('0x97'));_0x562c0d[_0x6a45('0x4b')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x203108['where'](_0x6a45('0x98'),_['map'](_0xc6b82b,'id'));_0x562c0d[_0x6a45('0x4b')](_0x6a45('0x98'),_[_0x6a45('0x38')](_0xc6b82b,'id'));}});})[_0x6a45('0x20')](function(){db[_0x6a45('0x99')][_0x6a45('0x42')](_0x203108[_0x6a45('0x9a')](),_0x50c92b)[_0x6a45('0x20')](function(_0x57a61e){_0x26d9b7[_0x6a45('0x2d')]=_0x57a61e['length'];if(_0x26d9b7['count']===0x0)return[];return db['sequelize'][_0x6a45('0x42')](_0x265fa1[_0x6a45('0x9a')](),_0x50c92b)[_0x6a45('0x20')](function(_0x1e6a12){_0x134ace=_[_0x6a45('0x9b')](_0x1e6a12,'id');_0x50c92b=_['merge'](_0x50c92b,{'model':db[_0x6a45('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb5d191[_0x6a45('0x42')][_0x6a45('0x9d')]){_0xcf722b[_0x6a45('0x46')][_0x6a45('0x3b')](function(_0x637030){_0x562c0d[_0x6a45('0x4d')]('i.'+_0x637030);});}else{_0x562c0d[_0x6a45('0x4d')](_0x6a45('0x9e'),'unreadMessages');_0x562c0d['field']('a.key',_0x6a45('0x9f'));_0x562c0d[_0x6a45('0x4d')](_0x6a45('0xa0'),_0x6a45('0xa1'));_0x562c0d['field']('i.*');_0x562c0d['field'](_0x6a45('0xa2'),'Contact.firstName');_0x562c0d['field']('c.lastName',_0x6a45('0xa3'));_0x562c0d[_0x6a45('0x4d')](_0x6a45('0xa4'),_0x6a45('0xa5'));_0x562c0d[_0x6a45('0x4d')]('c.phone',_0x6a45('0xa6'));_0x562c0d['field'](_0x6a45('0xa7'),_0x6a45('0xa8'));_0x562c0d[_0x6a45('0x4d')](_0x6a45('0xa9'),_0x6a45('0xaa'));_0x562c0d['field']('o.fullname','Owner.fullname');_0x562c0d[_0x6a45('0x4d')](_0x6a45('0xab'),_0x6a45('0xac'));_0x562c0d[_0x6a45('0x4d')](_0x6a45('0xad'),_0x6a45('0x3a'));}if(_0xcf722b[_0x6a45('0x49')])_0x562c0d[_0x6a45('0x49')](_0xcf722b[_0x6a45('0x49')]);if(_0xcf722b['offset'])_0x562c0d[_0x6a45('0x2e')](_0xcf722b[_0x6a45('0x2e')]);return db[_0x6a45('0x99')]['query'](_0x562c0d[_0x6a45('0x9a')](),_0x50c92b);})['then'](function(_0x204203){_0x3f3639[_0x6a45('0x4b')](_0x6a45('0xae'),_[_0x6a45('0x38')](_0x204203,'id'));return db[_0x6a45('0x99')]['query'](_0x3f3639[_0x6a45('0x9a')](),_0x50c92b)['then'](function(_0x3d39be){var _0x75e646=_[_0x6a45('0xaf')](_0x3d39be,_0x6a45('0xb0'));var _0x2b0379=[];_0x204203[_0x6a45('0x3b')](function(_0x4436a9){_0x2b0379[_0x6a45('0x3d')](updateChatInteraction(_0x4436a9,_0x134ace,_0x75e646));});return BPromise[_0x6a45('0xb1')](_0x2b0379);});});})[_0x6a45('0x20')](function(_0x4b473e){_0x26d9b7[_0x6a45('0xb2')]=_0x4b473e;return _0x26d9b7;})[_0x6a45('0x20')](respondWithFilteredResult(_0x328d9f,_0xcf722b));})[_0x6a45('0x28')](handleError(_0x328d9f,null));};exports['show']=function(_0x46a541,_0x27ebe8){var _0x3da0a3={'raw':![],'where':{'id':_0x46a541[_0x6a45('0xb3')]['id']}},_0x3834ad={};_0x3834ad['model']=_[_0x6a45('0x43')](db[_0x6a45('0x9c')]['rawAttributes']);_0x3834ad[_0x6a45('0x42')]=_[_0x6a45('0x43')](_0x46a541[_0x6a45('0x42')]);_0x3834ad[_0x6a45('0x44')]=_['intersection'](_0x3834ad['model'],_0x3834ad['query']);_0x3da0a3['attributes']=_['intersection'](_0x3834ad['model'],qs['fields'](_0x46a541[_0x6a45('0x42')][_0x6a45('0x9d')]));_0x3da0a3['attributes']=_0x3da0a3[_0x6a45('0x46')][_0x6a45('0x62')]?_0x3da0a3[_0x6a45('0x46')]:_0x3834ad[_0x6a45('0x45')];if(_0x46a541[_0x6a45('0x42')][_0x6a45('0xb4')]){_0x3da0a3['include']=[{'all':!![]}];}_0x3da0a3=_[_0x6a45('0xb5')]({},_0x3da0a3,_0x46a541[_0x6a45('0xb6')]);return db[_0x6a45('0x9c')][_0x6a45('0x63')](_0x3da0a3)[_0x6a45('0x20')](handleEntityNotFound(_0x27ebe8,null))[_0x6a45('0x20')](respondWithResult(_0x27ebe8,null))['catch'](handleError(_0x27ebe8,null));};exports[_0x6a45('0xb7')]=function(_0x40992d,_0x2fd06d){return db['ChatInteraction'][_0x6a45('0xb7')](_0x40992d['body'],{})['then'](respondWithResult(_0x2fd06d,0xc9))[_0x6a45('0x28')](handleError(_0x2fd06d,null));};exports['update']=function(_0x3d30bb,_0x414d90){if(_0x3d30bb[_0x6a45('0xb8')]['id']){delete _0x3d30bb[_0x6a45('0xb8')]['id'];}return db[_0x6a45('0x9c')][_0x6a45('0x63')]({'where':{'id':_0x3d30bb[_0x6a45('0xb3')]['id']}})[_0x6a45('0x20')](handleEntityNotFound(_0x414d90,null))['then'](saveUpdates(_0x3d30bb[_0x6a45('0xb8')],null))[_0x6a45('0x20')](respondWithResult(_0x414d90,null))[_0x6a45('0x28')](handleError(_0x414d90,null));};exports['destroy']=function(_0x50f589,_0x5a8b49){return db[_0x6a45('0x9c')][_0x6a45('0x63')]({'where':{'id':_0x50f589['params']['id']}})[_0x6a45('0x20')](handleEntityNotFound(_0x5a8b49,null))['then'](removeEntity(_0x5a8b49,null))[_0x6a45('0x28')](handleError(_0x5a8b49,null));};exports[_0x6a45('0xb9')]=function(_0x3d3d51,_0x306602){return db[_0x6a45('0x9c')][_0x6a45('0xb9')]()[_0x6a45('0x20')](respondWithResult(_0x306602,null))['catch'](handleError(_0x306602,null));};exports[_0x6a45('0xba')]=function(_0x5423be,_0x203c41){var _0xd7f425=_0x5423be['params']['id'];var _0x5a157f;var _0x5020fe;var _0x48f416;return db[_0x6a45('0x9c')][_0x6a45('0xbb')]({'where':{'id':_0xd7f425}})[_0x6a45('0x20')](function(_0x4f2083){_0x5a157f=_0x4f2083;return db[_0x6a45('0xbc')]['findOne']({'where':{'id':_0x4f2083[_0x6a45('0x92')]},'attributes':['id','vidaooApiKey','vidaooEscalation'],'raw':!![]});})[_0x6a45('0x20')](function(_0x5d7a17){if(_0x5d7a17&&_0x5d7a17[_0x6a45('0xbd')]&&_0x5d7a17[_0x6a45('0xbe')]){_0x5020fe=_0x5d7a17;var _0x460bce={'rejectUnauthorized':![],'method':_0x6a45('0xbf'),'uri':_0x6a45('0xc0'),'headers':{'X-APIKEY':_0x5d7a17['vidaooApiKey']},'body':{'name':_0x6a45('0xc1')+_0xd7f425},'redirect':_0x6a45('0xc2'),'json':!![]};return rp(_0x460bce);}else{throw new db[(_0x6a45('0xc3'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x6a45('0x20')](function(_0x4e2bc1){_0x48f416=_0x4e2bc1;if(_0x48f416['id']){var _0x5ae627={'body':_0x48f416['join_url'],'ChatWebsiteId':_0x5020fe['id'],'ChatInteractionId':_0x5a157f['id'],'direction':'out','UserId':_0x5423be[_0x6a45('0x95')]['id']};return db[_0x6a45('0xc4')][_0x6a45('0xb7')](_0x5ae627,{});}else{throw new db[(_0x6a45('0xc3'))][(_0x6a45('0x1e'))](_0x6a45('0xc5'));}})[_0x6a45('0x20')](function(){return _0x5a157f[_0x6a45('0xc6')]({'vidaooSessionId':_0x48f416['id']});})[_0x6a45('0x20')](respondWithResult(_0x203c41,null))[_0x6a45('0x28')](handleError(_0x203c41,null));};exports['customUpdate']=function(_0x439b03,_0x389e0a){if(_0x439b03[_0x6a45('0xb8')]['id']){delete _0x439b03[_0x6a45('0xb8')]['id'];}return db[_0x6a45('0x9c')][_0x6a45('0x63')]({'where':{'id':_0x439b03[_0x6a45('0xb3')]['id']}})['then'](handleEntityNotFound(_0x389e0a,null))[_0x6a45('0x20')](saveUpdates(_0x439b03['body'],null))[_0x6a45('0x20')](respondWithResult(_0x389e0a,null))[_0x6a45('0x28')](handleError(_0x389e0a,null));};exports[_0x6a45('0xc7')]=function(_0x4edfc9,_0x28890c,_0x9ba680){if(_0x4edfc9[_0x6a45('0xb8')]['id']){delete _0x4edfc9['body']['id'];}return db[_0x6a45('0x9c')][_0x6a45('0x63')]({'where':{'id':_0x4edfc9[_0x6a45('0xb3')]['id']}})[_0x6a45('0x20')](function(_0xf628d6){if(!_0xf628d6){logger[_0x6a45('0x25')](_0x6a45('0xc8'),'abandon',0x194,_0x6a45('0xc9'));_0x28890c['sendStatus'](0x194);}else{if(_0xf628d6[_0x6a45('0x76')]){throw new db['Sequelize'][(_0x6a45('0x1e'))](_0x6a45('0xca'));}}return _0xf628d6;})[_0x6a45('0x20')](function(_0x3d7252){if(_0x3d7252){return _0x3d7252[_0x6a45('0x33')]({'closed':_0x4edfc9[_0x6a45('0xb8')][_0x6a45('0xcb')],'disposition':_0x4edfc9[_0x6a45('0xb8')][_0x6a45('0xcc')]})[_0x6a45('0x20')](function(_0x1b92a6){return _0x1b92a6;});}})[_0x6a45('0x20')](function(_0xa71ee9){return respondWithRpcPromise(_0x6a45('0xcd'),_0x6a45('0xc7'),_0x4edfc9['body'],client9004);})['then'](respondWithResult(_0x28890c,null))[_0x6a45('0x28')](handleError(_0x28890c,null));};exports[_0x6a45('0xce')]=function(_0x9417a4,_0x40bc80,_0x26729d){_0x9417a4[_0x6a45('0xb8')][_0x6a45('0x35')]=_0x9417a4['file'][_0x6a45('0xcf')];_0x9417a4[_0x6a45('0xb8')][_0x6a45('0xd0')]=_0x9417a4[_0x6a45('0xd1')][_0x6a45('0xd2')];_0x9417a4['body'][_0x6a45('0x40')]=_0x9417a4[_0x6a45('0xd1')]['mimetype'];return db[_0x6a45('0xd3')][_0x6a45('0xb7')](_0x9417a4[_0x6a45('0xb8')])[_0x6a45('0x20')](respondWithResult(_0x40bc80,0xc9))[_0x6a45('0x28')](handleError(_0x40bc80,null));};exports[_0x6a45('0xd4')]=function(_0x47fd9a,_0x422252,_0x39c5e8){return db[_0x6a45('0x9c')][_0x6a45('0xbb')]({'where':{'id':_0x47fd9a[_0x6a45('0xb3')]['id']},'raw':!![]})[_0x6a45('0x20')](handleEntityNotFound(_0x422252,null))['then'](function(_0x40d467){if(_0x40d467){if(_0x40d467['closed']){return _0x422252[_0x6a45('0x2a')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x6a45('0xd3')][_0x6a45('0xbb')]({'where':{'id':_0x47fd9a[_0x6a45('0x42')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x422252,null));}})[_0x6a45('0x20')](function(_0x14de7a){if(_0x14de7a){return _0x422252[_0x6a45('0xd5')](path['join'](config[_0x6a45('0xd6')],_0x6a45('0xd7'),_0x14de7a[_0x6a45('0xd0')]));}})[_0x6a45('0x28')](handleError(_0x422252,null));};exports[_0x6a45('0xd8')]=function(_0x1213c4,_0x57e72e){var _0x5acf10=null;var _0x5336d2=null;var _0x1a180d=null;var _0x832862=null;if(_0x1213c4[_0x6a45('0xb8')]['id']){delete _0x1213c4[_0x6a45('0xb8')]['id'];}if(_0x1213c4[_0x6a45('0xb8')][_0x6a45('0xd9')]){_0x832862=path[_0x6a45('0xda')](config['root'],'server/files/chat/upload/',util[_0x6a45('0xdb')](_0x6a45('0xdc'),Date['now']()));_0x1213c4[_0x6a45('0xb8')][_0x6a45('0xdd')]=_0x832862;}return db[_0x6a45('0x9c')]['find']({'where':{'id':_0x1213c4[_0x6a45('0xb3')]['id']},'include':[{'model':db[_0x6a45('0xc4')],'as':_0x6a45('0xde'),'include':[{'model':db['User'],'as':_0x6a45('0x74')}]}]})[_0x6a45('0x20')](handleEntityNotFound(_0x57e72e,null))['then'](saveUpdates(_0x1213c4['body'],null))[_0x6a45('0x20')](function(_0x40e8d8){if(_0x40e8d8){_0x5acf10=_0x40e8d8;return db[_0x6a45('0xbc')][_0x6a45('0x63')]({'where':{'id':_0x5acf10['ChatWebsiteId']}});}})[_0x6a45('0x20')](function(_0x33d6fc){if(_0x33d6fc){_0x1a180d=_0x33d6fc;return db[_0x6a45('0xdf')][_0x6a45('0x63')]({'where':{'id':_0x5acf10[_0x6a45('0x6d')]}});}})[_0x6a45('0x20')](function(_0x2c17b5){if(_0x2c17b5){_0x5336d2=_0x2c17b5;if(_0x832862){var _0xabba0d=null;for(var _0x250c6d=0x1;_0x250c6d<_0x5acf10['Messages'][_0x6a45('0x62')];++_0x250c6d){_0xabba0d=_0x5acf10['Messages'][_0x250c6d];var _0x3708d7=_0xabba0d[_0x6a45('0x76')]?util[_0x6a45('0xdb')](_0x6a45('0xe0'),_0x1a180d['agentAlias'],_0xabba0d['UserId']):_0x6a45('0xe1');var _0x17603d=_0x1213c4[_0x6a45('0xb8')][_0x6a45('0xe2')]||util[_0x6a45('0xdb')](_0x6a45('0xe0'),_0x6a45('0xe3'),_0xabba0d[_0x6a45('0x6d')]);switch(_0x1a180d[_0x6a45('0xe4')]){case _0x6a45('0xe5'):_0x3708d7=_0xabba0d['UserId']?util[_0x6a45('0xdb')](_0x6a45('0xe0'),_0x1a180d[_0x6a45('0xe6')],_0xabba0d[_0x6a45('0x76')]):_0x6a45('0xe1');break;case _0x6a45('0xe7'):_0x3708d7=_0xabba0d[_0x6a45('0x76')]?_0xabba0d[_0x6a45('0x74')][_0x6a45('0xe8')]||_0xabba0d['User']['fullname']:'System';break;case _0x6a45('0xe9'):_0x3708d7=_0xabba0d[_0x6a45('0x76')]?_0xabba0d[_0x6a45('0x74')][_0x6a45('0x39')]:_0x6a45('0xe1');break;default:_0x3708d7=_0xabba0d[_0x6a45('0x76')]?util['format']('%s%d',_0x1a180d[_0x6a45('0xe6')],_0xabba0d[_0x6a45('0x76')]):_0x6a45('0xe1');}var _0x307d95=util[_0x6a45('0xdb')]('[%s]\x20%s:\x20%s\x0a',moment(_0xabba0d[_0x6a45('0x7a')])[_0x6a45('0xdb')](_0x6a45('0xea')),_0xabba0d[_0x6a45('0xeb')]==='in'?_0x17603d:_0x3708d7,_0xabba0d[_0x6a45('0xb8')]);if(!_0xabba0d[_0x6a45('0xec')]){fs[_0x6a45('0xed')](_0x832862,_0x307d95);}}return db[_0x6a45('0xee')][_0x6a45('0xbb')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x6a45('0xef'),'raw':!![]}]});}}})[_0x6a45('0x20')](function(_0x404650){if(_0x404650&&_0x404650['Smtp']&&_0x1213c4[_0x6a45('0xb8')]){var _0x141f55={'tls':{'rejectUnauthorized':![]}};if(_0x404650['Smtp']['service']){_0x141f55[_0x6a45('0xf0')]=_0x404650[_0x6a45('0xef')][_0x6a45('0xf0')];}else{_0x141f55[_0x6a45('0xf1')]=_0x404650[_0x6a45('0xef')][_0x6a45('0xf1')];_0x141f55[_0x6a45('0xf2')]=_0x404650['Smtp'][_0x6a45('0xf2')];_0x141f55[_0x6a45('0xf3')]=_0x404650[_0x6a45('0xef')]['secure'];}if(_0x404650[_0x6a45('0xef')]['authentication']){_0x141f55[_0x6a45('0xf4')]={'user':_0x404650[_0x6a45('0xef')]['user'],'pass':_0x404650['Smtp'][_0x6a45('0xf5')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x141f55,'message':{'from':util[_0x6a45('0xdb')](_0x6a45('0xf6'),_0x404650['name'],_0x404650[_0x6a45('0xf7')]||_0x404650['Smtp'][_0x6a45('0x95')]),'to':_0x1213c4[_0x6a45('0xb8')]['mailTranscript'],'subject':_0x6a45('0xf8'),'text':util['format'](_0x6a45('0xf9'),_0x1213c4[_0x6a45('0xb8')][_0x6a45('0xd9')]),'attachments':[{'path':_0x832862}]}})['then'](function(){return _0x5acf10;})[_0x6a45('0x28')](function(_0x475dda){console[_0x6a45('0x25')](_0x475dda);});}else{return _0x5acf10;}})['then'](respondWithStatusCode(_0x57e72e,0xc8))['catch'](handleError(_0x57e72e,null));};exports[_0x6a45('0xfa')]=function(_0x42b7ea,_0x30de7c,_0x89bcd6){return db[_0x6a45('0xc4')][_0x6a45('0x63')]({'where':{'id':_0x42b7ea['params']['id']}})[_0x6a45('0x20')](handleEntityNotFound(_0x30de7c,null))[_0x6a45('0x20')](function(_0x2c6696){if(_0x2c6696){return _0x2c6696[_0x6a45('0xfa')](_0x42b7ea[_0x6a45('0xb8')][_0x6a45('0xfb')],_[_0x6a45('0xfc')](_0x42b7ea[_0x6a45('0xb8')],[_0x6a45('0xfb'),'id'])||{});}})[_0x6a45('0x20')](respondWithResult(_0x30de7c,null))['catch'](handleError(_0x30de7c,null));};exports['getMessages']=function(_0x29ae99,_0xdf0d3a,_0x352102){var _0x5951a1={'raw':![],'where':{}};var _0x27f5a2={};var _0x18b3b4={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x29ae99[_0x6a45('0xb3')]['id']}})[_0x6a45('0x20')](handleEntityNotFound(_0xdf0d3a,null))['then'](function(_0x980678){if(_0x980678){_0x27f5a2[_0x6a45('0x45')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x27f5a2[_0x6a45('0x42')]=_['keys'](_0x29ae99[_0x6a45('0x42')]);_0x27f5a2[_0x6a45('0x44')]=_[_0x6a45('0x47')](_0x27f5a2[_0x6a45('0x45')],_0x27f5a2[_0x6a45('0x42')]);_0x5951a1[_0x6a45('0x46')]=_['intersection'](_0x27f5a2[_0x6a45('0x45')],qs[_0x6a45('0x9d')](_0x29ae99['query'][_0x6a45('0x9d')]));_0x5951a1[_0x6a45('0x46')]=_0x5951a1[_0x6a45('0x46')][_0x6a45('0x62')]?_0x5951a1[_0x6a45('0x46')]:_0x27f5a2[_0x6a45('0x45')];if(!_0x29ae99[_0x6a45('0x42')][_0x6a45('0x48')]('nolimit')){_0x5951a1['limit']=qs[_0x6a45('0x49')](_0x29ae99[_0x6a45('0x42')]['limit']);_0x5951a1[_0x6a45('0x2e')]=qs['offset'](_0x29ae99[_0x6a45('0x42')][_0x6a45('0x2e')]);}_0x5951a1['order']=qs[_0x6a45('0x4a')](_0x29ae99[_0x6a45('0x42')]['sort']);_0x5951a1[_0x6a45('0x4b')]=qs[_0x6a45('0x44')](_['pick'](_0x29ae99[_0x6a45('0x42')],_0x27f5a2[_0x6a45('0x44')]));_0x5951a1[_0x6a45('0x4b')]['ChatInteractionId']=_0x980678['id'];if(_0x29ae99[_0x6a45('0x42')][_0x6a45('0x85')]){_0x5951a1[_0x6a45('0x4b')]=_['merge'](_0x5951a1['where'],{'$or':_[_0x6a45('0x38')](_0x5951a1['attributes'],function(_0x17bd18){var _0x308201={};_0x308201[_0x17bd18]={'$like':'%'+_0x29ae99[_0x6a45('0x42')][_0x6a45('0x85')]+'%'};return _0x308201;})});}if(_0x29ae99['query']['$gte']){var _0x9ce2b9=_0x29ae99['query'][_0x6a45('0x7c')][_0x6a45('0x68')](',');var _0xd1d978={};_0xd1d978[_0x9ce2b9[0x0]]={'$gte':moment(_0x9ce2b9[0x1])[_0x6a45('0xdb')](_0x6a45('0xfd'))};_0x5951a1[_0x6a45('0x4b')]=_['merge'](_0x5951a1[_0x6a45('0x4b')],_0xd1d978);}_0x5951a1=_[_0x6a45('0xb5')]({},_0x5951a1,_0x29ae99['options']);return db[_0x6a45('0xc4')][_0x6a45('0x2d')]({'where':_0x5951a1[_0x6a45('0x4b')]})[_0x6a45('0x20')](function(_0x5e60b1){_0x18b3b4['count']=_0x5e60b1;if(_0x29ae99['query']['includeAll']){_0x5951a1[_0x6a45('0xfe')]=[{'all':!![]}];}return db[_0x6a45('0xc4')][_0x6a45('0xff')](_0x5951a1);})[_0x6a45('0x20')](function(_0x32d9a0){_0x18b3b4[_0x6a45('0xb2')]=_0x32d9a0;return _0x18b3b4;});}})[_0x6a45('0x20')](respondWithFilteredResult(_0xdf0d3a,_0x5951a1))[_0x6a45('0x28')](handleError(_0xdf0d3a,null));};exports[_0x6a45('0x100')]=function(_0x169c2e,_0x64041a,_0x1c469b){var _0x3af792={'where':{}},_0x4d5976={},_0x24be7d={'count':0x0,'rows':[]};return db[_0x6a45('0x9c')]['findOne']({'where':{'id':_0x169c2e[_0x6a45('0xb3')]['id']}})['then'](handleEntityNotFound(_0x64041a,null))[_0x6a45('0x20')](function(_0x2d4f24){if(_0x2d4f24){_0x4d5976['model']=_[_0x6a45('0x43')](db[_0x6a45('0xc4')][_0x6a45('0x3f')]);_0x4d5976[_0x6a45('0x42')]=_['keys'](_0x169c2e['query']);_0x4d5976['filters']=_[_0x6a45('0x47')](_0x4d5976[_0x6a45('0x45')],_0x4d5976['query']);_0x3af792['attributes']=_[_0x6a45('0x47')](_0x4d5976[_0x6a45('0x45')],qs[_0x6a45('0x9d')](_0x169c2e[_0x6a45('0x42')][_0x6a45('0x9d')]));_0x3af792[_0x6a45('0x46')]=_0x3af792[_0x6a45('0x46')]['length']?_0x3af792['attributes']:_0x4d5976[_0x6a45('0x45')];if(!_0x169c2e['query'][_0x6a45('0x48')](_0x6a45('0x101'))){_0x3af792['limit']=qs[_0x6a45('0x49')](_0x169c2e[_0x6a45('0x42')]['limit']);_0x3af792[_0x6a45('0x2e')]=qs['offset'](_0x169c2e[_0x6a45('0x42')][_0x6a45('0x2e')]);}_0x3af792[_0x6a45('0x8e')]=qs[_0x6a45('0x4a')](_0x169c2e[_0x6a45('0x42')][_0x6a45('0x4a')]);_0x3af792[_0x6a45('0x4b')]=qs['filters'](_[_0x6a45('0x4c')](_0x169c2e[_0x6a45('0x42')],_0x4d5976['filters']));_0x3af792['where'][_0x6a45('0xb0')]=_0x2d4f24['id'];if(_0x169c2e[_0x6a45('0x42')]['filter']){_0x3af792[_0x6a45('0x4b')]=_[_0x6a45('0xb5')](_0x3af792[_0x6a45('0x4b')],{'$or':_['map'](_0x3af792[_0x6a45('0x46')],function(_0x3b00f7){var _0x2eedb1={};_0x2eedb1[_0x3b00f7]={'$like':'%'+_0x169c2e[_0x6a45('0x42')][_0x6a45('0x85')]+'%'};return _0x2eedb1;})});}_0x3af792['where'][_0x6a45('0xec')]=![];if(_0x169c2e[_0x6a45('0x42')]['id']){_0x3af792['where']['id']={'$gt':_0x169c2e[_0x6a45('0x42')]['id']};}_0x3af792=_[_0x6a45('0xb5')]({},_0x3af792,_0x169c2e[_0x6a45('0xb6')]);return db['ChatMessage'][_0x6a45('0x2d')]({'where':_0x3af792[_0x6a45('0x4b')]})[_0x6a45('0x20')](function(_0x402b1b){_0x24be7d[_0x6a45('0x2d')]=_0x402b1b;_0x3af792[_0x6a45('0xfe')]=[];if(_0x169c2e['query']['includeAgent']){_0x3af792[_0x6a45('0xfe')][_0x6a45('0x3d')]({'model':db[_0x6a45('0x74')],'as':_0x6a45('0x74'),'attributes':['id',_0x6a45('0x39'),_0x6a45('0xe8')]});}if(_0x169c2e[_0x6a45('0x42')][_0x6a45('0xb4')]){_0x3af792[_0x6a45('0xfe')]=[{'all':!![]}];}return db[_0x6a45('0xc4')][_0x6a45('0xff')](_0x3af792);})[_0x6a45('0x20')](function(_0xca41aa){_0x24be7d[_0x6a45('0xb2')]=_0xca41aa;return _0x24be7d;});}})[_0x6a45('0x20')](respondWithFilteredResult(_0x64041a,_0x3af792))['catch'](handleError(_0x64041a,null));};exports[_0x6a45('0x102')]=function(_0x55d538,_0x37406a,_0x77507f){return db['ChatInteraction'][_0x6a45('0x63')]({'where':{'id':_0x55d538[_0x6a45('0xb3')]['id']}})[_0x6a45('0x20')](handleEntityNotFound(_0x37406a,null))['then'](function(_0x534bd3){if(_0x534bd3){return _0x534bd3[_0x6a45('0x103')](_0x55d538['body'][_0x6a45('0xfb')],_[_0x6a45('0xfc')](_0x55d538[_0x6a45('0xb8')],[_0x6a45('0xfb'),'id'])||{})[_0x6a45('0x104')](function(){return db[_0x6a45('0x71')][_0x6a45('0xff')]({'attributes':['id','name',_0x6a45('0x105')],'where':{'id':_0x55d538[_0x6a45('0xb8')][_0x6a45('0xfb')]}});})[_0x6a45('0x20')](function(_0x5b6951){socket[_0x6a45('0x106')](_0x6a45('0x107'),{'id':Number(_0x55d538[_0x6a45('0xb3')]['id']),'tags':_0x5b6951||[]});return{'id':Number(_0x55d538[_0x6a45('0xb3')]['id']),'tags':_0x5b6951||[]};});}})[_0x6a45('0x20')](respondWithResult(_0x37406a,null))[_0x6a45('0x28')](handleError(_0x37406a,null));};exports[_0x6a45('0x108')]=function(_0x3d810c,_0x450fe2,_0x463413){return db[_0x6a45('0x9c')][_0x6a45('0x63')]({'where':{'id':_0x3d810c[_0x6a45('0xb3')]['id']}})[_0x6a45('0x20')](handleEntityNotFound(_0x450fe2,null))[_0x6a45('0x20')](function(_0x3c4255){if(_0x3c4255){return _0x3c4255[_0x6a45('0x108')](_0x3d810c[_0x6a45('0x42')][_0x6a45('0xfb')]);}})[_0x6a45('0x20')](respondWithStatusCode(_0x450fe2,null))[_0x6a45('0x28')](handleError(_0x450fe2,null));};exports['download']=function(_0x115e18,_0x350fc9){var _0x98971f=moment()['unix']()[_0x6a45('0x9a')]();var _0x4568c3=path['join'](config[_0x6a45('0xd6')],_0x6a45('0x109'),_0x6a45('0x10a'),_0x6a45('0x10b'));var _0x18fc14=path[_0x6a45('0xda')](config['root'],_0x6a45('0x109'),_0x6a45('0x10a'),_0x6a45('0x10c'));var _0x49f56b=path['join'](_0x4568c3,_0x98971f);var _0xac2eee=util[_0x6a45('0xdb')](_0x6a45('0x10d'),_0x115e18['params']['id'],_0x98971f);var _0x4abd75=path[_0x6a45('0xda')](_0x4568c3,_0xac2eee);var _0x340481=[];_0x340481[_0x6a45('0x3d')]({'model':db['User'],'as':_0x6a45('0x74'),'attributes':['id','fullname'],'raw':!![]});_0x340481[_0x6a45('0x3d')]({'model':db[_0x6a45('0xdf')],'as':_0x6a45('0x66'),'attributes':['id',_0x6a45('0x10e'),_0x6a45('0x10f')],'raw':!![]});if(_0x115e18['query'][_0x6a45('0x10c')]){_0x340481[_0x6a45('0x3d')]({'model':db[_0x6a45('0xd3')],'as':'Attachment','raw':!![]});}var _0x4b14d4=[{'model':db[_0x6a45('0xc4')],'as':_0x6a45('0xde'),'attributes':['id',_0x6a45('0xb8'),_0x6a45('0x7a'),_0x6a45('0xeb'),_0x6a45('0xec'),'read'],'include':_0x340481}];_0x4b14d4[_0x6a45('0x3d')]({'model':db[_0x6a45('0xbc')],'as':_0x6a45('0x110'),'attributes':['id','name']});_0x4b14d4[_0x6a45('0x3d')]({'model':db[_0x6a45('0x74')],'as':'Owner','attributes':['id','fullname']});return db[_0x6a45('0x9c')][_0x6a45('0x63')]({'where':{'id':_0x115e18['params']['id']},'include':_0x4b14d4})[_0x6a45('0x20')](handleEntityNotFound(_0x350fc9,null))[_0x6a45('0x20')](function(_0x20e6b6){if(_0x20e6b6){var _0x6112b4=_0x20e6b6[_0x6a45('0x111')]({'plain':!![]});fs[_0x6a45('0x112')](_0x49f56b);var _0x19207c={'format':'A4','border':'10px','header':{'height':_0x6a45('0x113'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x6a45('0x114'),'contents':{'default':util[_0x6a45('0xdb')](_0x6a45('0x115'),util[_0x6a45('0xdb')]('%s\x20#%d',_0x6a45('0x116'),_0x6112b4['id']),moment()[_0x6a45('0xdb')](_0x6a45('0x117'))[_0x6a45('0x9a')]())}}};var _0x306314={'channel':_0x6a45('0x116'),'account':_0x6112b4['Account'][_0x6a45('0x35')],'agent':_0x6112b4[_0x6a45('0x118')]?_0x6112b4['Owner'][_0x6a45('0x39')]:'N.A.','createdAt':moment(_0x6112b4[_0x6a45('0x7a')])[_0x6a45('0xdb')](_0x6a45('0xfd'))['toString'](),'closedAt':_0x6112b4[_0x6a45('0xcb')]?moment(_0x6112b4[_0x6a45('0x119')])[_0x6a45('0xdb')](_0x6a45('0xfd'))['toString']():'','disposition':_0x6112b4[_0x6a45('0xcc')],'chatInfo':{'browser':_0x6112b4[_0x6a45('0x11a')],'os':_0x6112b4[_0x6a45('0x11b')],'referer':_0x6112b4[_0x6a45('0x11c')],'customerIp':_0x6112b4[_0x6a45('0x11d')],'customerPort':_0x6112b4[_0x6a45('0x11e')]?_0x6112b4[_0x6a45('0x11e')]:_0x6a45('0x11f')},'messages':_(_0x6112b4[_0x6a45('0xde')])[_0x6a45('0x120')]()[_0x6a45('0x85')]({'secret':![]})['map'](function(_0x422cfb){if(_0x422cfb[_0x6a45('0xd3')]){var _0x22fd7d=path['join'](_0x18fc14,_0x422cfb['Attachment'][_0x6a45('0xd0')]);if(fs[_0x6a45('0x121')](_0x22fd7d)){fs[_0x6a45('0x122')](_0x22fd7d)['pipe'](fs[_0x6a45('0x123')](path[_0x6a45('0xda')](_0x49f56b,_0x422cfb[_0x6a45('0xd3')][_0x6a45('0xd0')])));}}return{'date':moment(_0x422cfb[_0x6a45('0x7a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6a45('0x9a')](),'sender':_0x422cfb['direction']===_0x6a45('0x124')?_0x422cfb[_0x6a45('0x74')]?_0x422cfb[_0x6a45('0x74')][_0x6a45('0x39')]:_0x6a45('0xe1'):_0x422cfb[_0x6a45('0x66')][_0x6a45('0x10e')]+(_0x422cfb[_0x6a45('0x66')][_0x6a45('0x10f')]?'\x20'+_0x422cfb['Contact'][_0x6a45('0x10f')]:''),'body':_0x422cfb[_0x6a45('0xd3')]?_0x422cfb['Attachment']['basename']:_0x422cfb[_0x6a45('0xb8')],'direction':_0x422cfb[_0x6a45('0xeb')]===_0x6a45('0x124')?'A':'C','secret':_0x422cfb['secret'],'read':_0x422cfb[_0x6a45('0x80')],'attachment':_0x422cfb[_0x6a45('0xd3')]};})[_0x6a45('0x6b')]()};return ejs[_0x6a45('0x125')](path[_0x6a45('0xda')](config[_0x6a45('0xd6')],_0x6a45('0x109'),_0x6a45('0x126'),_0x6a45('0x127')),{'interaction':_0x306314})[_0x6a45('0x20')](function(_0x2570c8){return new BPromise(function(_0xedcdff,_0x1cea00){pdf[_0x6a45('0xb7')](_0x2570c8,_0x19207c)[_0x6a45('0x128')](path[_0x6a45('0xda')](_0x49f56b,'transcript-'+_0x6112b4['id']+'-'+_0x98971f+_0x6a45('0x129')),function(_0x25373f,_0x162071){if(_0x25373f)return _0x1cea00(_0x25373f);_0xedcdff(_0x162071);});});})[_0x6a45('0x20')](function(){return new BPromise(function(_0x2f10a5,_0x3587a0){zipdir(_0x49f56b,{'saveTo':_0x4abd75},function(_0x285d69,_0x17ef90){if(_0x285d69)return _0x3587a0(_0x285d69);return _0x2f10a5(_0x17ef90);});})['then'](function(){return new BPromise(function(_0x49bdbf,_0x4b6bc3){rimraf(_0x49f56b,function(_0x303a6c){if(_0x303a6c)_0x4b6bc3(_0x303a6c);return _0x49bdbf();});});})[_0x6a45('0x20')](function(){return _0x350fc9['download'](_0x4abd75,_0xac2eee,function(_0x4a7818){if(_0x4a7818){console[_0x6a45('0x12a')](_0x6a45('0x12b'),_0x4a7818);}else{fs[_0x6a45('0x12c')](_0x4abd75);}});});});}else{return _0x350fc9['sendStatus'](0xc8);}})[_0x6a45('0x28')](handleError(_0x350fc9,null));}; \ No newline at end of file +var _0x5430=['error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','update','destroy','stack','name','Users','map','fullname','TagIds','split','forEach','push','ChatInteraction','rawAttributes','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','type','compact','isEmpty','ChatWebsiteId','where','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','journey','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','sequelize','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','show','intersection','includeAll','options','create','params','describe','findOne','ChatWebsite','vidaooApiKey','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','updateAttributes','customUpdate','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','basename','filename','mimetype','Attachment','Unauthorized','attachId','root','server/files/attachments/','close','mailTranscript','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','%s%d','System','customer','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','format','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','getMyMessages','includeAgent','addTags','setTags','omit','spread','emit','removeTags','download','join','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','browserName','osName','referer','customerIp','customerPort','N.A.','tail','createReadStream','createWriteStream','out','renderFile','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5726fb,_0x9b7517){var _0x166dc1=function(_0xb40137){while(--_0xb40137){_0x5726fb['push'](_0x5726fb['shift']());}};_0x166dc1(++_0x9b7517);}(_0x5430,0x10c));var _0x0543=function(_0x46acbb,_0x517e14){_0x46acbb=_0x46acbb-0x0;var _0x3bd947=_0x5430[_0x46acbb];return _0x3bd947;};'use strict';var pdf=require(_0x0543('0x0'));var emlformat=require(_0x0543('0x1'));var rimraf=require(_0x0543('0x2'));var zipdir=require(_0x0543('0x3'));var jsonpatch=require(_0x0543('0x4'));var rp=require(_0x0543('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0543('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0543('0x7'));var csv=require(_0x0543('0x8'));var ejs=require(_0x0543('0x9'));var fs=require('fs');var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x8'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var db=require(_0x0543('0x17'))['db'];config[_0x0543('0x18')]=_[_0x0543('0x19')](config[_0x0543('0x18')],{'host':_0x0543('0x1a'),'port':0x18eb});var socket=require(_0x0543('0x1b'))(new Redis(config[_0x0543('0x18')]));require(_0x0543('0x1c'))['register'](socket);var jayson=require(_0x0543('0x1d'));var client=jayson[_0x0543('0x1e')]['http']({'port':0x232b});var client9004=jayson['client'][_0x0543('0x1f')]({'port':0x232c});function checkPasswordPattern(_0x40fb03,_0x1dff7d,_0x1cfadf){if(_0x1cfadf){var _0x38a32e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38a32e['test'](_0x1dff7d)){return _0x40fb03;}else{throw new db[(_0x0543('0x20'))][(_0x0543('0x21'))](_0x0543('0x22'));}}else{return _0x40fb03;}}function respondWithRpcPromise(_0x25254e,_0x20b396,_0x285080,_0x577cf0){return new BPromise(function(_0x5eb03e,_0x37b084){var _0x5362cb=_0x577cf0||client;return _0x5362cb['request'](_0x25254e,_0x285080)[_0x0543('0x23')](function(_0x419913){logger[_0x0543('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x20b396,_0x0543('0x25'));logger['debug'](_0x0543('0x26'),_0x20b396,_0x0543('0x25'),JSON['stringify'](_0x419913));if(_0x419913[_0x0543('0x27')]){if(_0x419913[_0x0543('0x27')][_0x0543('0x28')]===0x1f4){logger[_0x0543('0x27')](_0x0543('0x29'),_0x20b396,_0x419913[_0x0543('0x27')]['message']);return _0x37b084(_0x419913['error']['message']);}logger[_0x0543('0x27')](_0x0543('0x29'),_0x20b396,_0x419913[_0x0543('0x27')][_0x0543('0x2a')]);return _0x5eb03e(_0x419913[_0x0543('0x27')][_0x0543('0x2a')]);}else{logger[_0x0543('0x24')](_0x0543('0x29'),_0x20b396,_0x0543('0x25'));_0x5eb03e(_0x419913[_0x0543('0x2b')][_0x0543('0x2a')]);}})[_0x0543('0x2c')](function(_0x547a88){logger[_0x0543('0x27')](_0x0543('0x29'),_0x20b396,_0x547a88);_0x37b084(_0x547a88);});});}function respondWithStatusCode(_0x30ad9e,_0x4f2592){_0x4f2592=_0x4f2592||0xcc;return function(_0x9c7e34){if(_0x9c7e34){return _0x30ad9e[_0x0543('0x2d')](_0x4f2592);}return _0x30ad9e[_0x0543('0x2e')](_0x4f2592)[_0x0543('0x2f')]();};}function respondWithResult(_0x5dd789,_0x1732be){_0x1732be=_0x1732be||0xc8;return function(_0x10b9f3){if(_0x10b9f3){return _0x5dd789['status'](_0x1732be)['json'](_0x10b9f3);}};}function respondWithFilteredResult(_0x3b71f0,_0x16165c){return function(_0x51d49d){if(_0x51d49d){var _0x3b879b=_0x51d49d[_0x0543('0x30')],_0x2e03d1=_0x16165c[_0x0543('0x31')],_0x931ccc=_0x16165c[_0x0543('0x31')]+_0x16165c['limit'],_0x2bd6ce;if(_0x931ccc>=_0x3b879b){_0x931ccc=_0x3b879b;_0x2bd6ce=0xc8;}else{_0x2bd6ce=0xce;}_0x3b71f0[_0x0543('0x2e')](_0x2bd6ce);return _0x3b71f0['set'](_0x0543('0x32'),_0x2e03d1+'-'+_0x931ccc+'/'+_0x3b879b)[_0x0543('0x33')](_0x51d49d);}return null;};}function patchUpdates(_0x3b8da0){return function(_0x237af4){try{jsonpatch[_0x0543('0x34')](_0x237af4,_0x3b8da0,!![]);}catch(_0x57aaa2){return BPromise[_0x0543('0x35')](_0x57aaa2);}return _0x237af4['save']();};}function saveUpdates(_0x11a53c,_0x13d7c8){return function(_0x39e96c){if(_0x39e96c){return _0x39e96c[_0x0543('0x36')](_0x11a53c)['then'](function(_0x23ef2c){return _0x23ef2c;});}return null;};}function removeEntity(_0x5e0b4f,_0x6ec1c2){return function(_0x44d4ca){if(_0x44d4ca){return _0x44d4ca[_0x0543('0x37')]()[_0x0543('0x23')](function(){_0x5e0b4f[_0x0543('0x2e')](0xcc)[_0x0543('0x2f')]();});}};}function handleEntityNotFound(_0x2a1e4f,_0x44c771){return function(_0x8ef4d4){if(!_0x8ef4d4){_0x2a1e4f[_0x0543('0x2d')](0x194);}return _0x8ef4d4;};}function handleError(_0x55eeba,_0x2bd920){_0x2bd920=_0x2bd920||0x1f4;return function(_0x2d76d6){logger['error'](_0x2d76d6[_0x0543('0x38')]);if(_0x2d76d6['name']){delete _0x2d76d6[_0x0543('0x39')];}_0x55eeba[_0x0543('0x2e')](_0x2bd920)['send'](_0x2d76d6);};}function getInteractionUsers(_0x5e8800,_0x22210d){return new BPromise(function(_0xd153df,_0x4ca572){try{if(_0x22210d[_0x5e8800['id']]){_0x5e8800[_0x0543('0x3a')]=_[_0x0543('0x3b')](_0x22210d[_0x5e8800['id']],function(_0x54543f){return{'id':_0x54543f['id'],'fullname':_0x54543f[_0x0543('0x3c')]};});}}catch(_0x2896b9){_0x4ca572(_0x2896b9);}_0xd153df(_0x5e8800);});}function getInteractionTags(_0x3ecd70,_0x117982){return new BPromise(function(_0x1c3bc5,_0x4b78c3){try{if(_0x3ecd70['TagIds']){_0x3ecd70['Tags']=[];_0x3ecd70[_0x0543('0x3d')][_0x0543('0x3e')](',')[_0x0543('0x3f')](function(_0x34f88a){_0x3ecd70['Tags'][_0x0543('0x40')](_0x117982[_0x34f88a]);});}delete _0x3ecd70[_0x0543('0x3d')];}catch(_0xe3936f){_0x4b78c3(_0xe3936f);}_0x1c3bc5(_0x3ecd70);});}function updateChatInteraction(_0x222765,_0x713d96,_0x714fa8){return new BPromise(function(_0x40f941,_0x58e779){return getInteractionUsers(_0x222765,_0x714fa8)[_0x0543('0x23')](function(_0x32d031){return getInteractionTags(_0x32d031,_0x713d96);})[_0x0543('0x23')](function(_0x1b38bc){_0x40f941(_0x1b38bc);})[_0x0543('0x2c')](function(_0x43b7e8){_0x58e779(_0x43b7e8);});});}exports['index']=function(_0x53dfb8,_0x44116a){var _0x30556f={},_0x1e4818={},_0x11e376={'count':0x0,'rows':[]};var _0x29aada=_[_0x0543('0x3b')](db[_0x0543('0x41')][_0x0543('0x42')],function(_0x1df75e){return{'name':_0x1df75e['fieldName'],'type':_0x1df75e['type'][_0x0543('0x43')]};});_0x1e4818[_0x0543('0x44')]=_['map'](_0x29aada,'name');_0x1e4818[_0x0543('0x45')]=_[_0x0543('0x46')](_0x53dfb8['query']);_0x1e4818[_0x0543('0x47')]=_['intersection'](_0x1e4818[_0x0543('0x44')],_0x1e4818[_0x0543('0x45')]);_0x30556f['attributes']=_['intersection'](_0x1e4818[_0x0543('0x44')],qs['fields'](_0x53dfb8[_0x0543('0x45')][_0x0543('0x48')]));_0x30556f[_0x0543('0x49')]=_0x30556f[_0x0543('0x49')][_0x0543('0x4a')]?_0x30556f[_0x0543('0x49')]:_0x1e4818['model'];if(!_0x53dfb8[_0x0543('0x45')][_0x0543('0x4b')](_0x0543('0x4c'))){_0x30556f[_0x0543('0x4d')]=qs[_0x0543('0x4d')](_0x53dfb8['query'][_0x0543('0x4d')]);_0x30556f['offset']=qs[_0x0543('0x31')](_0x53dfb8[_0x0543('0x45')][_0x0543('0x31')]);}_0x30556f[_0x0543('0x4e')]=qs[_0x0543('0x4f')](_0x53dfb8[_0x0543('0x45')]['sort']);_0x30556f['where']=qs['filters'](_[_0x0543('0x50')](_0x53dfb8[_0x0543('0x45')],_0x1e4818['filters']),_0x29aada);var _0x188bfd=[];var _0x1d9432=squel[_0x0543('0x51')]()[_0x0543('0x52')]('id')[_0x0543('0x52')](_0x0543('0x39'))['field'](_0x0543('0x53'))[_0x0543('0x54')](_0x0543('0x55'));var _0x416ae0=squel[_0x0543('0x51')]()[_0x0543('0x52')](_0x0543('0x56'))[_0x0543('0x52')](_0x0543('0x57'))[_0x0543('0x52')](_0x0543('0x58'))[_0x0543('0x54')](_0x0543('0x59'),'ui')[_0x0543('0x5a')]('users','u',_0x0543('0x5b'));var _0x3c5acc=squel[_0x0543('0x51')]()[_0x0543('0x54')](_0x0543('0x5c'),'i')[_0x0543('0x5a')](_0x0543('0x5d'),'c',_0x0543('0x5e'))[_0x0543('0x5a')](_0x0543('0x5f'),'o',_0x0543('0x60'))[_0x0543('0x5a')](_0x0543('0x61'),'a',_0x0543('0x62'))[_0x0543('0x5a')]('chat_messages','me',_0x0543('0x63'))[_0x0543('0x5a')]('chat_interaction_has_tags','it',_0x0543('0x64'))[_0x0543('0x5a')](_0x0543('0x55'),'t','t.id\x20=\x20it.TagId');var _0x190e43=squel['expr']();var _0x294a38=[];var _0x4f58a4=squel[_0x0543('0x65')]();var _0x588fca;if(_0x53dfb8[_0x0543('0x45')][_0x0543('0x66')]){_0x588fca=as[_0x0543('0x67')](_0x53dfb8['query'][_0x0543('0x66')]);var _0x1a569b=_0x588fca[_0x0543('0x68')];for(var _0xf46956=0x0;_0xf46956<_0x588fca[_0x0543('0x69')][_0x0543('0x4a')];_0xf46956++){var _0x20aac8=_0x588fca[_0x0543('0x69')][_0xf46956];var _0x2bf1f9='i';var _0x21ec88=_[_0x0543('0x6a')](_0x29aada,[_0x0543('0x39'),_0x20aac8[_0x0543('0x52')]]);if(!_0x21ec88){switch(_0x20aac8[_0x0543('0x52')]){case _0x0543('0x6b'):if(_0x20aac8['value']==0x1){_0x3c5acc['having']('`'+_0x20aac8[_0x0543('0x52')]+_0x0543('0x6c'));}else{_0x3c5acc[_0x0543('0x6d')]('`'+_0x20aac8[_0x0543('0x52')]+_0x0543('0x6e'));}break;case _0x0543('0x6f'):if(_0x20aac8[_0x0543('0x70')]===_0x0543('0x71')){if(_0x20aac8[_0x0543('0x72')]['split']('\x20')[_0x0543('0x4a')]>0x1){_0x190e43[_0x1a569b](_0x0543('0x73'),qs[_0x0543('0x74')](_0x20aac8[_0x0543('0x72')]),null);}else{var _0x5d7b59='%'+_0x20aac8[_0x0543('0x72')]+'%';_0x190e43[_0x1a569b](_0x0543('0x75'),_0x5d7b59,_0x5d7b59,_0x5d7b59);}}else{_0x21ec88=_[_0x0543('0x6a')](_0x29aada,['name','ContactId']);_0x20aac8[_0x0543('0x52')]=_0x0543('0x76');_0x338c62=as[_0x0543('0x77')](_0x2bf1f9,_0x21ec88['type'],_0x20aac8);_0x190e43[_0x1a569b](_0x338c62[_0x0543('0x78')],_0x338c62[_0x0543('0x72')][_0x0543('0x79')],_0x338c62['value'][_0x0543('0x2f')]);}break;case _0x0543('0x7a'):var _0x274254=_0x20aac8[_0x0543('0x72')][_0x0543('0x3e')](',')[_0x0543('0x3b')](function(_0x16da76){return Number(_0x16da76);});_0x274254[_0x0543('0x3f')](function(_0x41cac7){_0x4f58a4['or'](_0x0543('0x7b'),'%,'+_0x41cac7+',%');});_0x294a38=_[_0x0543('0x7c')](_0x294a38,_0x274254);break;case _0x0543('0x7d'):if(_0x20aac8[_0x0543('0x70')]===_0x0543('0x71')){_0x190e43[_0x1a569b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x20aac8['value']+'%',null);}else{_0x21ec88=_[_0x0543('0x6a')](_0x29aada,[_0x0543('0x39'),_0x0543('0x7e')]);_0x20aac8[_0x0543('0x52')]='UserId';_0x338c62=as[_0x0543('0x77')](_0x2bf1f9,_0x21ec88['type'],_0x20aac8);_0x190e43[_0x1a569b](_0x338c62[_0x0543('0x78')],_0x338c62[_0x0543('0x72')][_0x0543('0x79')],_0x338c62['value']['end']);}break;case _0x0543('0x7f'):_0x338c62=as['buildExpression']('me',null,_0x20aac8);_0x190e43[_0x1a569b](_0x338c62['text'],_0x338c62[_0x0543('0x72')][_0x0543('0x79')],_0x338c62[_0x0543('0x72')][_0x0543('0x2f')]);break;}}else{var _0x338c62=as[_0x0543('0x77')](_0x2bf1f9,_0x21ec88[_0x0543('0x80')],_0x20aac8);_0x190e43[_0x1a569b](_0x338c62[_0x0543('0x78')],_0x338c62[_0x0543('0x72')]['start'],_0x338c62[_0x0543('0x72')][_0x0543('0x2f')]);}}}else{var _0xe3fccd=_(_0x53dfb8[_0x0543('0x45')])[_0x0543('0x46')]()['map'](function(_0x3feaba){return _['some'](_0x29aada,[_0x0543('0x39'),_0x3feaba])?_0x3feaba:undefined;})[_0x0543('0x81')]()[_0x0543('0x72')]();if(!_[_0x0543('0x82')](_0xe3fccd)){_0xe3fccd['forEach'](function(_0x3c2010){if(_0x3c2010===_0x0543('0x83')){_0x3c5acc[_0x0543('0x84')]('i.ChatWebsiteId\x20IN\x20?',[][_0x0543('0x85')](_0x53dfb8['query'][_0x3c2010]));}else if(_0x3c2010===_0x0543('0x86')){var _0x3f8fb5=JSON[_0x0543('0x87')](_0x53dfb8[_0x0543('0x45')][_0x3c2010])[_0x0543('0x88')];var _0x21c920=JSON['parse'](_0x53dfb8['query'][_0x3c2010])['$lte'];_0x3c5acc[_0x0543('0x84')](_0x0543('0x89'),_0x3f8fb5,_0x21c920);}else{if(_0x53dfb8[_0x0543('0x45')][_0x3c2010]===_0x0543('0x8a')){_0x3c5acc[_0x0543('0x84')]('i.'+_0x3c2010+_0x0543('0x8b'));}else{_0x3c5acc[_0x0543('0x84')]('i.'+_0x3c2010+_0x0543('0x8c'),_0x53dfb8['query'][_0x3c2010]);}}});}if(_0x53dfb8['query'][_0x0543('0x8d')]){if(_0x53dfb8[_0x0543('0x45')]['read']==0x1){_0x3c5acc[_0x0543('0x6d')]('`unreadMessages`\x20=\x200');}else{_0x3c5acc[_0x0543('0x6d')](_0x0543('0x8e'));}}if(_0x53dfb8[_0x0543('0x45')][_0x0543('0x8f')]){_0x294a38=_[_0x0543('0x90')](_0x53dfb8['query'][_0x0543('0x8f')])?_0x53dfb8[_0x0543('0x45')]['tag']:new Array(_0x53dfb8[_0x0543('0x45')][_0x0543('0x8f')]);_0x294a38[_0x0543('0x3f')](function(_0x510654){_0x4f58a4['or'](_0x0543('0x7b'),'%,'+_0x510654+',%');});}if(_0x53dfb8[_0x0543('0x45')][_0x0543('0x91')]){var _0x4abf55=_0x53dfb8[_0x0543('0x45')][_0x0543('0x91')][_0x0543('0x92')]('\x5c','\x5c\x5c')[_0x0543('0x92')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x0543('0x93')](_0x4abf55)){_0x190e43['or'](_0x0543('0x94'),_0x4abf55+'%');}else{_0x190e43['or'](_0x0543('0x95'),qs[_0x0543('0x74')](_0x4abf55))['or'](_0x0543('0x96'),_0x4abf55+'%');}}}_0x3c5acc[_0x0543('0x84')](_0x190e43);_0x3c5acc[_0x0543('0x97')](_0x0543('0x98'));var _0x420b02={'type':db[_0x0543('0x20')][_0x0543('0x99')][_0x0543('0x9a')],'raw':!![]};var _0x18a84d=_0x3c5acc[_0x0543('0x9b')]();_0x18a84d[_0x0543('0x52')](_0x0543('0x98'));_0x18a84d[_0x0543('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0543('0x6b'));if(_0x30556f[_0x0543('0x4e')]){_0x30556f[_0x0543('0x4e')][_0x0543('0x3f')](function(_0x185765){_0x3c5acc[_0x0543('0x4e')]('i.'+_0x185765[0x0],_0x185765[0x1]===_0x0543('0x9c')?![]:!![]);});}if(!_[_0x0543('0x82')](_0x294a38)){_0x3c5acc[_0x0543('0x6d')](_0x4f58a4);_0x18a84d[_0x0543('0x84')](_0x0543('0x9d'),_0x294a38);}BPromise['resolve']()[_0x0543('0x23')](function(){if(!_0x588fca){if(_0x53dfb8[_0x0543('0x45')][_0x0543('0x83')]||_0x53dfb8['query'][_0x0543('0x9e')])return;_0x18a84d['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3c5acc[_0x0543('0x84')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x53dfb8[_0x0543('0x9f')][_0x0543('0xa0')]({'attributes':['id'],'raw':!![]})[_0x0543('0x23')](function(_0x43a607){if(_['isEmpty'](_0x43a607)){_0x18a84d['where'](_0x0543('0xa1'));_0x3c5acc[_0x0543('0x84')](_0x0543('0xa1'));}else{_0x18a84d['where'](_0x0543('0xa2'),_[_0x0543('0x3b')](_0x43a607,'id'));_0x3c5acc['where'](_0x0543('0xa2'),_[_0x0543('0x3b')](_0x43a607,'id'));}});})['then'](function(){db['sequelize'][_0x0543('0x45')](_0x18a84d[_0x0543('0xa3')](),_0x420b02)[_0x0543('0x23')](function(_0x4e4ec2){_0x11e376[_0x0543('0x30')]=_0x4e4ec2[_0x0543('0x4a')];if(_0x11e376[_0x0543('0x30')]===0x0)return[];return db['sequelize']['query'](_0x1d9432[_0x0543('0xa3')](),_0x420b02)[_0x0543('0x23')](function(_0xc75d33){_0x188bfd=_['keyBy'](_0xc75d33,'id');_0x420b02=_[_0x0543('0xa4')](_0x420b02,{'model':db[_0x0543('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53dfb8[_0x0543('0x45')][_0x0543('0x48')]){_0x30556f[_0x0543('0x49')][_0x0543('0x3f')](function(_0x190b81){_0x3c5acc[_0x0543('0x52')]('i.'+_0x190b81);});}else{_0x3c5acc[_0x0543('0x52')](_0x0543('0xa5'),_0x0543('0x6b'));_0x3c5acc[_0x0543('0x52')](_0x0543('0xa6'),_0x0543('0xa7'));_0x3c5acc[_0x0543('0x52')](_0x0543('0xa8'),_0x0543('0xa9'));_0x3c5acc['field'](_0x0543('0xaa'));_0x3c5acc[_0x0543('0x52')](_0x0543('0xab'),_0x0543('0xac'));_0x3c5acc['field'](_0x0543('0xad'),_0x0543('0xae'));_0x3c5acc[_0x0543('0x52')](_0x0543('0xaf'),'Contact.email');_0x3c5acc[_0x0543('0x52')](_0x0543('0xb0'),'Contact.phone');_0x3c5acc[_0x0543('0x52')](_0x0543('0xb1'),_0x0543('0xb2'));_0x3c5acc[_0x0543('0x52')]('c.fax',_0x0543('0xb3'));_0x3c5acc[_0x0543('0x52')](_0x0543('0xb4'),_0x0543('0xb5'));_0x3c5acc[_0x0543('0x52')]('o.internal',_0x0543('0xb6'));_0x3c5acc[_0x0543('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0543('0x3d'));}if(_0x30556f['limit'])_0x3c5acc[_0x0543('0x4d')](_0x30556f[_0x0543('0x4d')]);if(_0x30556f[_0x0543('0x31')])_0x3c5acc[_0x0543('0x31')](_0x30556f['offset']);return db[_0x0543('0xb7')]['query'](_0x3c5acc[_0x0543('0xa3')](),_0x420b02);})[_0x0543('0x23')](function(_0x2f8936){_0x416ae0[_0x0543('0x84')](_0x0543('0xb8'),_[_0x0543('0x3b')](_0x2f8936,'id'));return db[_0x0543('0xb7')][_0x0543('0x45')](_0x416ae0[_0x0543('0xa3')](),_0x420b02)[_0x0543('0x23')](function(_0x3be402){var _0x57aa7e=_[_0x0543('0xb9')](_0x3be402,_0x0543('0xba'));var _0x461bf2=[];_0x2f8936['forEach'](function(_0x40f1f1){_0x461bf2['push'](updateChatInteraction(_0x40f1f1,_0x188bfd,_0x57aa7e));});return BPromise['all'](_0x461bf2);});});})[_0x0543('0x23')](function(_0x485933){_0x11e376['rows']=_0x485933;return _0x11e376;})[_0x0543('0x23')](respondWithFilteredResult(_0x44116a,_0x30556f));})[_0x0543('0x2c')](handleError(_0x44116a,null));};exports[_0x0543('0xbb')]=function(_0x3450ad,_0x389c0d){var _0x375666={'raw':![],'where':{'id':_0x3450ad['params']['id']}},_0x567f8e={};_0x567f8e['model']=_['keys'](db[_0x0543('0x41')][_0x0543('0x42')]);_0x567f8e[_0x0543('0x45')]=_[_0x0543('0x46')](_0x3450ad['query']);_0x567f8e[_0x0543('0x47')]=_[_0x0543('0xbc')](_0x567f8e[_0x0543('0x44')],_0x567f8e[_0x0543('0x45')]);_0x375666[_0x0543('0x49')]=_[_0x0543('0xbc')](_0x567f8e[_0x0543('0x44')],qs[_0x0543('0x48')](_0x3450ad[_0x0543('0x45')][_0x0543('0x48')]));_0x375666['attributes']=_0x375666[_0x0543('0x49')][_0x0543('0x4a')]?_0x375666[_0x0543('0x49')]:_0x567f8e[_0x0543('0x44')];if(_0x3450ad[_0x0543('0x45')][_0x0543('0xbd')]){_0x375666['include']=[{'all':!![]}];}_0x375666=_[_0x0543('0xa4')]({},_0x375666,_0x3450ad[_0x0543('0xbe')]);return db['ChatInteraction']['find'](_0x375666)[_0x0543('0x23')](handleEntityNotFound(_0x389c0d,null))[_0x0543('0x23')](respondWithResult(_0x389c0d,null))[_0x0543('0x2c')](handleError(_0x389c0d,null));};exports['create']=function(_0x3f5813,_0x5db2e5){return db['ChatInteraction'][_0x0543('0xbf')](_0x3f5813['body'],{})[_0x0543('0x23')](respondWithResult(_0x5db2e5,0xc9))[_0x0543('0x2c')](handleError(_0x5db2e5,null));};exports['update']=function(_0x347404,_0x55bd20){if(_0x347404[_0x0543('0x7f')]['id']){delete _0x347404[_0x0543('0x7f')]['id'];}return db[_0x0543('0x41')]['find']({'where':{'id':_0x347404[_0x0543('0xc0')]['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x55bd20,null))[_0x0543('0x23')](saveUpdates(_0x347404[_0x0543('0x7f')],null))['then'](respondWithResult(_0x55bd20,null))[_0x0543('0x2c')](handleError(_0x55bd20,null));};exports[_0x0543('0x37')]=function(_0x405466,_0x4ceb5c){return db['ChatInteraction'][_0x0543('0x6a')]({'where':{'id':_0x405466['params']['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x4ceb5c,null))[_0x0543('0x23')](removeEntity(_0x4ceb5c,null))[_0x0543('0x2c')](handleError(_0x4ceb5c,null));};exports[_0x0543('0xc1')]=function(_0x4fdf33,_0x96626f){return db['ChatInteraction'][_0x0543('0xc1')]()[_0x0543('0x23')](respondWithResult(_0x96626f,null))[_0x0543('0x2c')](handleError(_0x96626f,null));};exports['createVidaooSession']=function(_0x2c1663,_0x3c8b96){var _0x4b33d2=_0x2c1663[_0x0543('0xc0')]['id'];var _0x5574f5;var _0x1c00f7;var _0x11337c;return db[_0x0543('0x41')][_0x0543('0xc2')]({'where':{'id':_0x4b33d2}})['then'](function(_0x33e034){_0x5574f5=_0x33e034;return db[_0x0543('0xc3')][_0x0543('0xc2')]({'where':{'id':_0x33e034[_0x0543('0x83')]},'attributes':['id',_0x0543('0xc4'),'vidaooEscalation'],'raw':!![]});})[_0x0543('0x23')](function(_0x3a07f6){if(_0x3a07f6&&_0x3a07f6['vidaooApiKey']&&_0x3a07f6['vidaooEscalation']){_0x1c00f7=_0x3a07f6;var _0x172c0f={'rejectUnauthorized':![],'method':'POST','uri':_0x0543('0xc5'),'headers':{'X-APIKEY':_0x3a07f6[_0x0543('0xc4')]},'body':{'name':_0x0543('0xc6')+_0x4b33d2},'redirect':_0x0543('0xc7'),'json':!![]};return rp(_0x172c0f);}else{throw new db['Sequelize'][(_0x0543('0x21'))](_0x0543('0xc8'));}})[_0x0543('0x23')](function(_0x3718dd){_0x11337c=_0x3718dd;if(_0x11337c['id']){var _0x5ca920={'body':_0x11337c['join_url'],'ChatWebsiteId':_0x1c00f7['id'],'ChatInteractionId':_0x5574f5['id'],'direction':'out','UserId':_0x2c1663[_0x0543('0x9f')]['id']};return db['ChatMessage'][_0x0543('0xbf')](_0x5ca920,{});}else{throw new db[(_0x0543('0x20'))][(_0x0543('0x21'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x0543('0x23')](function(){return _0x5574f5[_0x0543('0xc9')]({'vidaooSessionId':_0x11337c['id']});})[_0x0543('0x23')](respondWithResult(_0x3c8b96,null))['catch'](handleError(_0x3c8b96,null));};exports[_0x0543('0xca')]=function(_0x9e51cf,_0x46d1a4){if(_0x9e51cf[_0x0543('0x7f')]['id']){delete _0x9e51cf['body']['id'];}return db[_0x0543('0x41')]['find']({'where':{'id':_0x9e51cf[_0x0543('0xc0')]['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x46d1a4,null))[_0x0543('0x23')](saveUpdates(_0x9e51cf[_0x0543('0x7f')],null))[_0x0543('0x23')](respondWithResult(_0x46d1a4,null))[_0x0543('0x2c')](handleError(_0x46d1a4,null));};exports['abandon']=function(_0x48acca,_0x33babc,_0x1673f7){if(_0x48acca[_0x0543('0x7f')]['id']){delete _0x48acca[_0x0543('0x7f')]['id'];}return db[_0x0543('0x41')][_0x0543('0x6a')]({'where':{'id':_0x48acca[_0x0543('0xc0')]['id']}})[_0x0543('0x23')](function(_0x383b70){if(!_0x383b70){logger[_0x0543('0x27')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x0543('0xcb'));_0x33babc[_0x0543('0x2d')](0x194);}else{if(_0x383b70['UserId']){throw new db[(_0x0543('0x20'))][(_0x0543('0x21'))](_0x0543('0xcc'));}}return _0x383b70;})[_0x0543('0x23')](function(_0x56bec0){if(_0x56bec0){return _0x56bec0[_0x0543('0x36')]({'closed':_0x48acca[_0x0543('0x7f')][_0x0543('0xcd')],'disposition':_0x48acca[_0x0543('0x7f')][_0x0543('0xce')]})[_0x0543('0x23')](function(_0x2c5e8b){return _0x2c5e8b;});}})[_0x0543('0x23')](function(_0xfb1aa5){return respondWithRpcPromise(_0x0543('0xcf'),_0x0543('0xd0'),_0x48acca[_0x0543('0x7f')],client9004);})[_0x0543('0x23')](respondWithResult(_0x33babc,null))[_0x0543('0x2c')](handleError(_0x33babc,null));};exports[_0x0543('0xd1')]=function(_0x315d10,_0x132caa,_0x395102){_0x315d10[_0x0543('0x7f')][_0x0543('0x39')]=_0x315d10[_0x0543('0xd2')]['originalname'];_0x315d10[_0x0543('0x7f')][_0x0543('0xd3')]=_0x315d10['file'][_0x0543('0xd4')];_0x315d10['body'][_0x0543('0x80')]=_0x315d10[_0x0543('0xd2')][_0x0543('0xd5')];return db[_0x0543('0xd6')][_0x0543('0xbf')](_0x315d10[_0x0543('0x7f')])[_0x0543('0x23')](respondWithResult(_0x132caa,0xc9))['catch'](handleError(_0x132caa,null));};exports['attachmentDownload']=function(_0x5938a4,_0x2eec95,_0x5e6cb6){return db[_0x0543('0x41')][_0x0543('0xc2')]({'where':{'id':_0x5938a4['params']['id']},'raw':!![]})[_0x0543('0x23')](handleEntityNotFound(_0x2eec95,null))[_0x0543('0x23')](function(_0x1fb6c6){if(_0x1fb6c6){if(_0x1fb6c6[_0x0543('0xcd')]){return _0x2eec95[_0x0543('0x2e')](0x193)['json']({'status':0x193,'message':_0x0543('0xd7')});}return db[_0x0543('0xd6')][_0x0543('0xc2')]({'where':{'id':_0x5938a4[_0x0543('0x45')][_0x0543('0xd8')]},'raw':!![]})[_0x0543('0x23')](handleEntityNotFound(_0x2eec95,null));}})[_0x0543('0x23')](function(_0x115150){if(_0x115150){return _0x2eec95['download'](path['join'](config[_0x0543('0xd9')],_0x0543('0xda'),_0x115150['basename']));}})['catch'](handleError(_0x2eec95,null));};exports[_0x0543('0xdb')]=function(_0x1f4bee,_0x421b7e){var _0x4cbb87=null;var _0x3fbd9e=null;var _0x24fa8e=null;var _0x1108d7=null;if(_0x1f4bee['body']['id']){delete _0x1f4bee[_0x0543('0x7f')]['id'];}if(_0x1f4bee[_0x0543('0x7f')][_0x0543('0xdc')]){_0x1108d7=path['join'](config[_0x0543('0xd9')],'server/files/chat/upload/',util['format'](_0x0543('0xdd'),Date[_0x0543('0xde')]()));_0x1f4bee[_0x0543('0x7f')][_0x0543('0xdf')]=_0x1108d7;}return db[_0x0543('0x41')][_0x0543('0x6a')]({'where':{'id':_0x1f4bee[_0x0543('0xc0')]['id']},'include':[{'model':db[_0x0543('0xe0')],'as':_0x0543('0xe1'),'include':[{'model':db[_0x0543('0x7d')],'as':_0x0543('0x7d')}]}]})[_0x0543('0x23')](handleEntityNotFound(_0x421b7e,null))[_0x0543('0x23')](saveUpdates(_0x1f4bee[_0x0543('0x7f')],null))['then'](function(_0x8c93b0){if(_0x8c93b0){_0x4cbb87=_0x8c93b0;return db[_0x0543('0xc3')][_0x0543('0x6a')]({'where':{'id':_0x4cbb87[_0x0543('0x83')]}});}})[_0x0543('0x23')](function(_0x29960b){if(_0x29960b){_0x24fa8e=_0x29960b;return db[_0x0543('0xe2')][_0x0543('0x6a')]({'where':{'id':_0x4cbb87[_0x0543('0x76')]}});}})[_0x0543('0x23')](function(_0xc5f169){if(_0xc5f169){_0x3fbd9e=_0xc5f169;if(_0x1108d7){var _0x3f389e=null;for(var _0x2bdbce=0x1;_0x2bdbce<_0x4cbb87['Messages']['length'];++_0x2bdbce){_0x3f389e=_0x4cbb87[_0x0543('0xe1')][_0x2bdbce];var _0x1d0147=_0x3f389e[_0x0543('0x7e')]?util['format'](_0x0543('0xe3'),_0x24fa8e['agentAlias'],_0x3f389e[_0x0543('0x7e')]):_0x0543('0xe4');var _0x39a0d4=_0x1f4bee[_0x0543('0x7f')][_0x0543('0xe5')]||util['format'](_0x0543('0xe3'),'Visitor',_0x3f389e[_0x0543('0x76')]);switch(_0x24fa8e[_0x0543('0xe6')]){case _0x0543('0xe7'):_0x1d0147=_0x3f389e[_0x0543('0x7e')]?util['format']('%s%d',_0x24fa8e[_0x0543('0xe8')],_0x3f389e[_0x0543('0x7e')]):'System';break;case _0x0543('0xe9'):_0x1d0147=_0x3f389e['UserId']?_0x3f389e['User'][_0x0543('0xea')]||_0x3f389e['User'][_0x0543('0x3c')]:_0x0543('0xe4');break;case _0x0543('0xeb'):_0x1d0147=_0x3f389e[_0x0543('0x7e')]?_0x3f389e['User'][_0x0543('0x3c')]:_0x0543('0xe4');break;default:_0x1d0147=_0x3f389e[_0x0543('0x7e')]?util[_0x0543('0xec')]('%s%d',_0x24fa8e[_0x0543('0xe8')],_0x3f389e[_0x0543('0x7e')]):_0x0543('0xe4');}var _0x1b47e6=util['format'](_0x0543('0xed'),moment(_0x3f389e[_0x0543('0x86')])[_0x0543('0xec')](_0x0543('0xee')),_0x3f389e[_0x0543('0xef')]==='in'?_0x39a0d4:_0x1d0147,_0x3f389e[_0x0543('0x7f')]);if(!_0x3f389e[_0x0543('0xf0')]){fs[_0x0543('0xf1')](_0x1108d7,_0x1b47e6);}}return db[_0x0543('0xf2')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x0543('0xf3')],'as':_0x0543('0xf4'),'raw':!![]}]});}}})[_0x0543('0x23')](function(_0x514579){if(_0x514579&&_0x514579[_0x0543('0xf4')]&&_0x1f4bee[_0x0543('0x7f')]){var _0x343090={'tls':{'rejectUnauthorized':![]}};if(_0x514579['Smtp'][_0x0543('0xf5')]){_0x343090[_0x0543('0xf5')]=_0x514579['Smtp'][_0x0543('0xf5')];}else{_0x343090[_0x0543('0xf6')]=_0x514579['Smtp']['host'];_0x343090[_0x0543('0xf7')]=_0x514579[_0x0543('0xf4')][_0x0543('0xf7')];_0x343090[_0x0543('0xf8')]=_0x514579[_0x0543('0xf4')][_0x0543('0xf8')];}if(_0x514579[_0x0543('0xf4')][_0x0543('0xf9')]){_0x343090['auth']={'user':_0x514579[_0x0543('0xf4')]['user'],'pass':_0x514579[_0x0543('0xf4')][_0x0543('0xfa')]};}return respondWithRpcPromise(_0x0543('0xfb'),'sendMail',{'account':_0x343090,'message':{'from':util[_0x0543('0xec')]('\x22%s\x22\x20<%s>',_0x514579['name'],_0x514579[_0x0543('0xfc')]||_0x514579[_0x0543('0xf4')][_0x0543('0x9f')]),'to':_0x1f4bee[_0x0543('0x7f')][_0x0543('0xdc')],'subject':_0x0543('0xfd'),'text':util[_0x0543('0xec')](_0x0543('0xfe'),_0x1f4bee['body'][_0x0543('0xdc')]),'attachments':[{'path':_0x1108d7}]}})[_0x0543('0x23')](function(){return _0x4cbb87;})[_0x0543('0x2c')](function(_0x15b11b){console['error'](_0x15b11b);});}else{return _0x4cbb87;}})[_0x0543('0x23')](respondWithStatusCode(_0x421b7e,0xc8))[_0x0543('0x2c')](handleError(_0x421b7e,null));};exports[_0x0543('0xff')]=function(_0x1c82bc,_0x279e63,_0x444520){return db['ChatMessage'][_0x0543('0x6a')]({'where':{'id':_0x1c82bc['params']['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x279e63,null))[_0x0543('0x23')](function(_0x14d797){if(_0x14d797){return _0x14d797[_0x0543('0xff')](_0x1c82bc[_0x0543('0x7f')][_0x0543('0x100')],_['omit'](_0x1c82bc[_0x0543('0x7f')],[_0x0543('0x100'),'id'])||{});}})[_0x0543('0x23')](respondWithResult(_0x279e63,null))[_0x0543('0x2c')](handleError(_0x279e63,null));};exports[_0x0543('0x101')]=function(_0xf391b,_0x319d82,_0x114170){var _0x37f76f={'raw':![],'where':{}};var _0x3e00ed={};var _0x1d65b2={'count':0x0,'rows':[]};return db[_0x0543('0x41')][_0x0543('0xc2')]({'where':{'id':_0xf391b[_0x0543('0xc0')]['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x319d82,null))[_0x0543('0x23')](function(_0x358c5d){if(_0x358c5d){_0x3e00ed[_0x0543('0x44')]=_[_0x0543('0x46')](db[_0x0543('0xe0')][_0x0543('0x42')]);_0x3e00ed['query']=_[_0x0543('0x46')](_0xf391b[_0x0543('0x45')]);_0x3e00ed[_0x0543('0x47')]=_[_0x0543('0xbc')](_0x3e00ed[_0x0543('0x44')],_0x3e00ed['query']);_0x37f76f[_0x0543('0x49')]=_[_0x0543('0xbc')](_0x3e00ed[_0x0543('0x44')],qs[_0x0543('0x48')](_0xf391b['query'][_0x0543('0x48')]));_0x37f76f['attributes']=_0x37f76f[_0x0543('0x49')][_0x0543('0x4a')]?_0x37f76f['attributes']:_0x3e00ed[_0x0543('0x44')];if(!_0xf391b[_0x0543('0x45')][_0x0543('0x4b')](_0x0543('0x4c'))){_0x37f76f[_0x0543('0x4d')]=qs[_0x0543('0x4d')](_0xf391b['query'][_0x0543('0x4d')]);_0x37f76f[_0x0543('0x31')]=qs[_0x0543('0x31')](_0xf391b[_0x0543('0x45')][_0x0543('0x31')]);}_0x37f76f['order']=qs[_0x0543('0x4f')](_0xf391b[_0x0543('0x45')]['sort']);_0x37f76f[_0x0543('0x84')]=qs[_0x0543('0x47')](_[_0x0543('0x50')](_0xf391b[_0x0543('0x45')],_0x3e00ed['filters']));_0x37f76f['where']['ChatInteractionId']=_0x358c5d['id'];if(_0xf391b[_0x0543('0x45')][_0x0543('0x91')]){_0x37f76f[_0x0543('0x84')]=_[_0x0543('0xa4')](_0x37f76f[_0x0543('0x84')],{'$or':_[_0x0543('0x3b')](_0x37f76f[_0x0543('0x49')],function(_0x2a9fd8){var _0x56d9c2={};_0x56d9c2[_0x2a9fd8]={'$like':'%'+_0xf391b[_0x0543('0x45')][_0x0543('0x91')]+'%'};return _0x56d9c2;})});}if(_0xf391b[_0x0543('0x45')]['$gte']){var _0x14bef2=_0xf391b[_0x0543('0x45')][_0x0543('0x88')][_0x0543('0x3e')](',');var _0x2e1ee1={};_0x2e1ee1[_0x14bef2[0x0]]={'$gte':moment(_0x14bef2[0x1])[_0x0543('0xec')](_0x0543('0x102'))};_0x37f76f['where']=_['merge'](_0x37f76f[_0x0543('0x84')],_0x2e1ee1);}_0x37f76f=_[_0x0543('0xa4')]({},_0x37f76f,_0xf391b['options']);return db[_0x0543('0xe0')][_0x0543('0x30')]({'where':_0x37f76f[_0x0543('0x84')]})[_0x0543('0x23')](function(_0x238669){_0x1d65b2[_0x0543('0x30')]=_0x238669;if(_0xf391b[_0x0543('0x45')][_0x0543('0xbd')]){_0x37f76f[_0x0543('0x103')]=[{'all':!![]}];}return db[_0x0543('0xe0')][_0x0543('0x104')](_0x37f76f);})[_0x0543('0x23')](function(_0x12bd98){_0x1d65b2[_0x0543('0x105')]=_0x12bd98;return _0x1d65b2;});}})['then'](respondWithFilteredResult(_0x319d82,_0x37f76f))[_0x0543('0x2c')](handleError(_0x319d82,null));};exports[_0x0543('0x106')]=function(_0x42a0b3,_0x242365,_0x2bdda7){var _0xcdabbc={'where':{}},_0x4d1bfe={},_0x1b36e4={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x42a0b3[_0x0543('0xc0')]['id']}})['then'](handleEntityNotFound(_0x242365,null))[_0x0543('0x23')](function(_0x3ba209){if(_0x3ba209){_0x4d1bfe['model']=_[_0x0543('0x46')](db[_0x0543('0xe0')][_0x0543('0x42')]);_0x4d1bfe[_0x0543('0x45')]=_[_0x0543('0x46')](_0x42a0b3[_0x0543('0x45')]);_0x4d1bfe[_0x0543('0x47')]=_[_0x0543('0xbc')](_0x4d1bfe[_0x0543('0x44')],_0x4d1bfe[_0x0543('0x45')]);_0xcdabbc['attributes']=_[_0x0543('0xbc')](_0x4d1bfe[_0x0543('0x44')],qs[_0x0543('0x48')](_0x42a0b3[_0x0543('0x45')]['fields']));_0xcdabbc[_0x0543('0x49')]=_0xcdabbc['attributes'][_0x0543('0x4a')]?_0xcdabbc['attributes']:_0x4d1bfe['model'];if(!_0x42a0b3['query'][_0x0543('0x4b')](_0x0543('0x4c'))){_0xcdabbc['limit']=qs[_0x0543('0x4d')](_0x42a0b3[_0x0543('0x45')][_0x0543('0x4d')]);_0xcdabbc['offset']=qs[_0x0543('0x31')](_0x42a0b3['query'][_0x0543('0x31')]);}_0xcdabbc[_0x0543('0x4e')]=qs['sort'](_0x42a0b3['query'][_0x0543('0x4f')]);_0xcdabbc[_0x0543('0x84')]=qs[_0x0543('0x47')](_[_0x0543('0x50')](_0x42a0b3[_0x0543('0x45')],_0x4d1bfe[_0x0543('0x47')]));_0xcdabbc[_0x0543('0x84')][_0x0543('0xba')]=_0x3ba209['id'];if(_0x42a0b3[_0x0543('0x45')]['filter']){_0xcdabbc[_0x0543('0x84')]=_[_0x0543('0xa4')](_0xcdabbc['where'],{'$or':_[_0x0543('0x3b')](_0xcdabbc[_0x0543('0x49')],function(_0x46b253){var _0x267a94={};_0x267a94[_0x46b253]={'$like':'%'+_0x42a0b3[_0x0543('0x45')][_0x0543('0x91')]+'%'};return _0x267a94;})});}_0xcdabbc[_0x0543('0x84')][_0x0543('0xf0')]=![];if(_0x42a0b3[_0x0543('0x45')]['id']){_0xcdabbc[_0x0543('0x84')]['id']={'$gt':_0x42a0b3['query']['id']};}_0xcdabbc=_['merge']({},_0xcdabbc,_0x42a0b3[_0x0543('0xbe')]);return db[_0x0543('0xe0')][_0x0543('0x30')]({'where':_0xcdabbc[_0x0543('0x84')]})[_0x0543('0x23')](function(_0x3e41a6){_0x1b36e4['count']=_0x3e41a6;_0xcdabbc[_0x0543('0x103')]=[];if(_0x42a0b3[_0x0543('0x45')][_0x0543('0x107')]){_0xcdabbc[_0x0543('0x103')][_0x0543('0x40')]({'model':db['User'],'as':'User','attributes':['id',_0x0543('0x3c'),'alias']});}if(_0x42a0b3['query']['includeAll']){_0xcdabbc[_0x0543('0x103')]=[{'all':!![]}];}return db[_0x0543('0xe0')][_0x0543('0x104')](_0xcdabbc);})[_0x0543('0x23')](function(_0x592a01){_0x1b36e4[_0x0543('0x105')]=_0x592a01;return _0x1b36e4;});}})[_0x0543('0x23')](respondWithFilteredResult(_0x242365,_0xcdabbc))[_0x0543('0x2c')](handleError(_0x242365,null));};exports[_0x0543('0x108')]=function(_0x53e915,_0x59cae9,_0x2d0b22){return db['ChatInteraction'][_0x0543('0x6a')]({'where':{'id':_0x53e915[_0x0543('0xc0')]['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x59cae9,null))[_0x0543('0x23')](function(_0x5e4cae){if(_0x5e4cae){return _0x5e4cae[_0x0543('0x109')](_0x53e915['body'][_0x0543('0x100')],_[_0x0543('0x10a')](_0x53e915[_0x0543('0x7f')],['ids','id'])||{})[_0x0543('0x10b')](function(){return db['Tag'][_0x0543('0x104')]({'attributes':['id',_0x0543('0x39'),_0x0543('0x53')],'where':{'id':_0x53e915['body']['ids']}});})['then'](function(_0x2e00f7){socket[_0x0543('0x10c')]('chatInteractionTags:save',{'id':Number(_0x53e915[_0x0543('0xc0')]['id']),'tags':_0x2e00f7||[]});return{'id':Number(_0x53e915[_0x0543('0xc0')]['id']),'tags':_0x2e00f7||[]};});}})[_0x0543('0x23')](respondWithResult(_0x59cae9,null))['catch'](handleError(_0x59cae9,null));};exports['removeTags']=function(_0x13657b,_0x5d68ef,_0x558b00){return db[_0x0543('0x41')][_0x0543('0x6a')]({'where':{'id':_0x13657b['params']['id']}})[_0x0543('0x23')](handleEntityNotFound(_0x5d68ef,null))[_0x0543('0x23')](function(_0x4faf41){if(_0x4faf41){return _0x4faf41[_0x0543('0x10d')](_0x13657b[_0x0543('0x45')][_0x0543('0x100')]);}})[_0x0543('0x23')](respondWithStatusCode(_0x5d68ef,null))[_0x0543('0x2c')](handleError(_0x5d68ef,null));};exports[_0x0543('0x10e')]=function(_0xdb00dd,_0x58eda4){var _0x62e053=moment()['unix']()[_0x0543('0xa3')]();var _0x342a89=path[_0x0543('0x10f')](config[_0x0543('0xd9')],_0x0543('0x110'),_0x0543('0x111'),_0x0543('0x112'));var _0x233c86=path[_0x0543('0x10f')](config[_0x0543('0xd9')],_0x0543('0x110'),_0x0543('0x111'),'attachments');var _0x2aafe9=path[_0x0543('0x10f')](_0x342a89,_0x62e053);var _0x23b58d=util[_0x0543('0xec')](_0x0543('0x113'),_0xdb00dd['params']['id'],_0x62e053);var _0x5d3b8f=path[_0x0543('0x10f')](_0x342a89,_0x23b58d);var _0x41ea08=[];_0x41ea08[_0x0543('0x40')]({'model':db[_0x0543('0x7d')],'as':_0x0543('0x7d'),'attributes':['id',_0x0543('0x3c')],'raw':!![]});_0x41ea08[_0x0543('0x40')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x0543('0x114'),_0x0543('0x115')],'raw':!![]});if(_0xdb00dd['query'][_0x0543('0x116')]){_0x41ea08[_0x0543('0x40')]({'model':db['Attachment'],'as':_0x0543('0xd6'),'raw':!![]});}var _0x1bde09=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x0543('0x7f'),_0x0543('0x86'),_0x0543('0xef'),_0x0543('0xf0'),'read'],'include':_0x41ea08}];_0x1bde09['push']({'model':db[_0x0543('0xc3')],'as':_0x0543('0x117'),'attributes':['id',_0x0543('0x39')]});_0x1bde09[_0x0543('0x40')]({'model':db[_0x0543('0x7d')],'as':_0x0543('0x118'),'attributes':['id',_0x0543('0x3c')]});return db[_0x0543('0x41')][_0x0543('0x6a')]({'where':{'id':_0xdb00dd[_0x0543('0xc0')]['id']},'include':_0x1bde09})['then'](handleEntityNotFound(_0x58eda4,null))[_0x0543('0x23')](function(_0x2aa827){if(_0x2aa827){var _0x5106a5=_0x2aa827[_0x0543('0x119')]({'plain':!![]});fs[_0x0543('0x11a')](_0x2aafe9);var _0x263a74={'format':'A4','border':_0x0543('0x11b'),'header':{'height':_0x0543('0x11c'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x0543('0x11d'),'contents':{'default':util[_0x0543('0xec')](_0x0543('0x11e'),util[_0x0543('0xec')](_0x0543('0x11f'),_0x0543('0x120'),_0x5106a5['id']),moment()[_0x0543('0xec')](_0x0543('0x121'))['toString']())}}};var _0x34bdfd={'channel':_0x0543('0x120'),'account':_0x5106a5[_0x0543('0x117')][_0x0543('0x39')],'agent':_0x5106a5[_0x0543('0x118')]?_0x5106a5[_0x0543('0x118')][_0x0543('0x3c')]:'N.A.','createdAt':moment(_0x5106a5[_0x0543('0x86')])[_0x0543('0xec')](_0x0543('0x102'))[_0x0543('0xa3')](),'closedAt':_0x5106a5['closed']?moment(_0x5106a5['closedAt'])[_0x0543('0xec')](_0x0543('0x102'))[_0x0543('0xa3')]():'','disposition':_0x5106a5[_0x0543('0xce')],'chatInfo':{'browser':_0x5106a5[_0x0543('0x122')],'os':_0x5106a5[_0x0543('0x123')],'referer':_0x5106a5[_0x0543('0x124')],'customerIp':_0x5106a5[_0x0543('0x125')],'customerPort':_0x5106a5[_0x0543('0x126')]?_0x5106a5[_0x0543('0x126')]:_0x0543('0x127')},'messages':_(_0x5106a5[_0x0543('0xe1')])[_0x0543('0x128')]()[_0x0543('0x91')]({'secret':![]})[_0x0543('0x3b')](function(_0x66fa4e){if(_0x66fa4e[_0x0543('0xd6')]){var _0x15f76b=path['join'](_0x233c86,_0x66fa4e[_0x0543('0xd6')][_0x0543('0xd3')]);if(fs['existsSync'](_0x15f76b)){fs[_0x0543('0x129')](_0x15f76b)['pipe'](fs[_0x0543('0x12a')](path['join'](_0x2aafe9,_0x66fa4e['Attachment'][_0x0543('0xd3')])));}}return{'date':moment(_0x66fa4e['createdAt'])[_0x0543('0xec')](_0x0543('0x102'))[_0x0543('0xa3')](),'sender':_0x66fa4e[_0x0543('0xef')]===_0x0543('0x12b')?_0x66fa4e[_0x0543('0x7d')]?_0x66fa4e[_0x0543('0x7d')][_0x0543('0x3c')]:_0x0543('0xe4'):_0x66fa4e[_0x0543('0x6f')][_0x0543('0x114')]+(_0x66fa4e[_0x0543('0x6f')]['lastName']?'\x20'+_0x66fa4e['Contact']['lastName']:''),'body':_0x66fa4e[_0x0543('0xd6')]?_0x66fa4e['Attachment'][_0x0543('0xd3')]:_0x66fa4e['body'],'direction':_0x66fa4e[_0x0543('0xef')]===_0x0543('0x12b')?'A':'C','secret':_0x66fa4e[_0x0543('0xf0')],'read':_0x66fa4e[_0x0543('0x8d')],'attachment':_0x66fa4e[_0x0543('0xd6')]};})['value']()};return ejs[_0x0543('0x12c')](path[_0x0543('0x10f')](config[_0x0543('0xd9')],'server','views','downloadInteraction.html'),{'interaction':_0x34bdfd})['then'](function(_0x2c2364){return new BPromise(function(_0x42f85f,_0x43f835){pdf[_0x0543('0xbf')](_0x2c2364,_0x263a74)[_0x0543('0x12d')](path['join'](_0x2aafe9,_0x0543('0x12e')+_0x5106a5['id']+'-'+_0x62e053+_0x0543('0x12f')),function(_0x1f92bb,_0x37963e){if(_0x1f92bb)return _0x43f835(_0x1f92bb);_0x42f85f(_0x37963e);});});})[_0x0543('0x23')](function(){return new BPromise(function(_0x46f53c,_0x151de6){zipdir(_0x2aafe9,{'saveTo':_0x5d3b8f},function(_0x6edd9,_0x342066){if(_0x6edd9)return _0x151de6(_0x6edd9);return _0x46f53c(_0x342066);});})[_0x0543('0x23')](function(){return new BPromise(function(_0x13c3f2,_0x1153a9){rimraf(_0x2aafe9,function(_0x411825){if(_0x411825)_0x1153a9(_0x411825);return _0x13c3f2();});});})[_0x0543('0x23')](function(){return _0x58eda4['download'](_0x5d3b8f,_0x23b58d,function(_0x395a2a){if(_0x395a2a){console[_0x0543('0x130')](_0x0543('0x131'),_0x395a2a);}else{fs[_0x0543('0x132')](_0x5d3b8f);}});});});}else{return _0x58eda4[_0x0543('0x2d')](0xc8);}})['catch'](handleError(_0x58eda4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ba8ba43..ced62d1 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 _0xb94c=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save','remove','then','setDataValue','Users','map','findAll'];(function(_0x18e0ab,_0x614f99){var _0x364247=function(_0x3d2f59){while(--_0x3d2f59){_0x18e0ab['push'](_0x18e0ab['shift']());}};_0x364247(++_0x614f99);}(_0xb94c,0x176));var _0xcb94=function(_0xe2afe1,_0x41b94f){_0xe2afe1=_0xe2afe1-0x0;var _0x3219b3=_0xb94c[_0xe2afe1];return _0x3219b3;};'use strict';var EventEmitter=require(_0xcb94('0x0'));var ChatInteraction=require(_0xcb94('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xcb94('0x1'))['db'][_0xcb94('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb94('0x3'),'afterUpdate':'update','afterDestroy':_0xcb94('0x4')};function emitEvent(_0xbbe00c){return function(_0x2cf8a9,_0xa19e6b,_0x6092bd){_0x2cf8a9['getUsers']({'attributes':['id'],'raw':!![]})[_0xcb94('0x5')](function(_0x27441c){_0x2cf8a9[_0xcb94('0x6')](_0xcb94('0x7'),_0x27441c[_0xcb94('0x8')](function(_0x484be2){return{'id':_0x484be2['id']};}));return ChatMessage[_0xcb94('0x9')]({'where':{'ChatInteractionId':_0x2cf8a9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcb94('0x5')](function(_0x4374ea){_0x2cf8a9[_0xcb94('0x6')]('unreadMessages',_0x4374ea[_0xcb94('0xa')]);ChatInteractionEvents[_0xcb94('0xb')](_0xbbe00c+':'+_0x2cf8a9['id'],_0x2cf8a9);ChatInteractionEvents[_0xcb94('0xb')](_0xbbe00c,_0x2cf8a9);_0x6092bd(null);})[_0xcb94('0xc')](_0x6092bd(null));};}for(var e in events){if(events[_0xcb94('0xd')](e)){var event=events[e];ChatInteraction[_0xcb94('0xe')](e,emitEvent(event));}}module[_0xcb94('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xddd2=['save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners'];(function(_0x45aa7d,_0x7d48da){var _0x4cb03b=function(_0x546d51){while(--_0x546d51){_0x45aa7d['push'](_0x45aa7d['shift']());}};_0x4cb03b(++_0x7d48da);}(_0xddd2,0x1e2));var _0x2ddd=function(_0x70b273,_0x34c5a0){_0x70b273=_0x70b273-0x0;var _0x72ac98=_0xddd2[_0x70b273];return _0x72ac98;};'use strict';var EventEmitter=require(_0x2ddd('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x2ddd('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x2ddd('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2ddd('0x3')](0x0);var events={'afterCreate':_0x2ddd('0x4'),'afterUpdate':_0x2ddd('0x5'),'afterDestroy':_0x2ddd('0x6')};function emitEvent(_0x44befd){return function(_0x2cbc62,_0x508c79,_0x46c62d){_0x2cbc62[_0x2ddd('0x7')]({'attributes':['id'],'raw':!![]})[_0x2ddd('0x8')](function(_0x2a6721){_0x2cbc62[_0x2ddd('0x9')](_0x2ddd('0xa'),_0x2a6721['map'](function(_0x36972f){return{'id':_0x36972f['id']};}));return ChatMessage[_0x2ddd('0xb')]({'where':{'ChatInteractionId':_0x2cbc62['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2ddd('0x8')](function(_0x82de11){_0x2cbc62[_0x2ddd('0x9')](_0x2ddd('0xc'),_0x82de11[_0x2ddd('0xd')]);ChatInteractionEvents[_0x2ddd('0xe')](_0x44befd+':'+_0x2cbc62['id'],_0x2cbc62);ChatInteractionEvents[_0x2ddd('0xe')](_0x44befd,_0x2cbc62);_0x46c62d(null);})[_0x2ddd('0xf')](_0x46c62d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x2ddd('0x10')](e,emitEvent(event));}}module[_0x2ddd('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ad1d811..d1dca76 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 _0x1f28=['ChatInteraction','chat_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5742d0,_0x2496b3){var _0x5265fc=function(_0x1f8144){while(--_0x1f8144){_0x5742d0['push'](_0x5742d0['shift']());}};_0x5265fc(++_0x2496b3);}(_0x1f28,0x1af));var _0x81f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f28[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x81f2('0x0'));var logger=require(_0x81f2('0x1'))(_0x81f2('0x2'));var moment=require(_0x81f2('0x3'));var BPromise=require(_0x81f2('0x4'));var rp=require(_0x81f2('0x5'));var fs=require('fs');var path=require(_0x81f2('0x6'));var rimraf=require(_0x81f2('0x7'));var config=require(_0x81f2('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x81f2('0x9')]=function(_0x2612fd,_0x363619){return _0x2612fd[_0x81f2('0xa')](_0x81f2('0xb'),attributes,{'tableName':_0x81f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10fbf2,_0xa8f0b7,_0x306385){if(_0x10fbf2[_0x81f2('0xd')](_0x81f2('0xe'))){_0x10fbf2['closedAt']=moment()['format'](_0x81f2('0xf'));}_0x306385(null,_0x10fbf2);}},'charset':_0x81f2('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc2b8=['path','rimraf','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x59f0ff,_0x2b9d67){var _0x28e782=function(_0x437e09){while(--_0x437e09){_0x59f0ff['push'](_0x59f0ff['shift']());}};_0x28e782(++_0x2b9d67);}(_0xc2b8,0x184));var _0x8c2b=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xc2b8[_0x22dac7];return _0x3e6cfa;};'use strict';var _=require(_0x8c2b('0x0'));var util=require('util');var logger=require(_0x8c2b('0x1'))(_0x8c2b('0x2'));var moment=require(_0x8c2b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c2b('0x4'));var rimraf=require(_0x8c2b('0x5'));var config=require(_0x8c2b('0x6'));var attributes=require(_0x8c2b('0x7'));module[_0x8c2b('0x8')]=function(_0x2be235,_0x247ed3){return _0x2be235['define']('ChatInteraction',attributes,{'tableName':_0x8c2b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xde4e89,_0x6663e1,_0x3ec6fe){if(_0xde4e89['changed'](_0x8c2b('0xa'))){_0xde4e89['closedAt']=moment()['format'](_0x8c2b('0xb'));}_0x3ec6fe(null,_0xde4e89);}},'charset':_0x8c2b('0xc'),'collate':_0x8c2b('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index f256da6..2e53e59 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 _0x44a3=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','ids','omit','spread','AddTags'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x44a3,0x126));var _0x344a=function(_0x459b3e,_0x5a0c7a){_0x459b3e=_0x459b3e-0x0;var _0xaf15e4=_0x44a3[_0x459b3e];return _0xaf15e4;};'use strict';var _=require(_0x344a('0x0'));var util=require('util');var moment=require(_0x344a('0x1'));var BPromise=require(_0x344a('0x2'));var rs=require(_0x344a('0x3'));var fs=require('fs');var Redis=require(_0x344a('0x4'));var db=require(_0x344a('0x5'))['db'];var utils=require(_0x344a('0x6'));var logger=require('../../config/logger')(_0x344a('0x7'));var config=require(_0x344a('0x8'));var jayson=require(_0x344a('0x9'));var client=jayson[_0x344a('0xa')][_0x344a('0xb')]({'port':0x232a});config[_0x344a('0xc')]=_[_0x344a('0xd')](config[_0x344a('0xc')],{'host':_0x344a('0xe'),'port':0x18eb});var socket=require(_0x344a('0xf'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2e8e18,_0x41c401,_0x13653c){return new BPromise(function(_0x5c31e4,_0x3d48e4){return client['request'](_0x2e8e18,_0x13653c)[_0x344a('0x10')](function(_0x5bc071){logger['info'](_0x344a('0x11'),_0x41c401,_0x344a('0x12'));logger[_0x344a('0x13')](_0x344a('0x14'),_0x41c401,_0x344a('0x12'),JSON[_0x344a('0x15')](_0x5bc071));if(_0x5bc071[_0x344a('0x16')]){if(_0x5bc071['error'][_0x344a('0x17')]===0x1f4){logger[_0x344a('0x16')](_0x344a('0x11'),_0x41c401,_0x5bc071[_0x344a('0x16')][_0x344a('0x18')]);return _0x3d48e4(_0x5bc071[_0x344a('0x16')][_0x344a('0x18')]);}logger[_0x344a('0x16')](_0x344a('0x11'),_0x41c401,_0x5bc071[_0x344a('0x16')][_0x344a('0x18')]);return _0x5c31e4(_0x5bc071[_0x344a('0x16')][_0x344a('0x18')]);}else{logger[_0x344a('0x19')](_0x344a('0x11'),_0x41c401,_0x344a('0x12'));_0x5c31e4(_0x5bc071[_0x344a('0x1a')][_0x344a('0x18')]);}})[_0x344a('0x1b')](function(_0x174693){logger[_0x344a('0x16')](_0x344a('0x11'),_0x41c401,_0x174693);_0x3d48e4(_0x174693);});});}exports[_0x344a('0x1c')]=function(_0x264006){var _0x3758b1=this;return new Promise(function(_0x54686a,_0xee6d18){return db['ChatInteraction']['update'](_0x264006[_0x344a('0x1d')],{'raw':_0x264006[_0x344a('0x1e')]?_0x264006[_0x344a('0x1e')][_0x344a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x264006[_0x344a('0x1e')]?_0x264006[_0x344a('0x1e')][_0x344a('0x20')]||null:null,'attributes':_0x264006[_0x344a('0x1e')]?_0x264006[_0x344a('0x1e')][_0x344a('0x21')]||null:null,'limit':_0x264006[_0x344a('0x1e')]?_0x264006[_0x344a('0x1e')][_0x344a('0x22')]||null:null})[_0x344a('0x10')](function(_0x1b9ef0){logger[_0x344a('0x19')](_0x344a('0x1c'),_0x264006);logger[_0x344a('0x13')](_0x344a('0x1c'),_0x264006,JSON[_0x344a('0x15')](_0x1b9ef0));_0x54686a(_0x1b9ef0);})[_0x344a('0x1b')](function(_0x4e91a2){logger[_0x344a('0x16')]('UpdateChatInteraction',_0x4e91a2[_0x344a('0x18')],_0x264006);_0xee6d18(_0x3758b1[_0x344a('0x16')](0x1f4,_0x4e91a2[_0x344a('0x18')]));});});};exports[_0x344a('0x23')]=function(_0x428c56){return new Promise(function(_0x4c6c70,_0x511708){return db[_0x344a('0x24')][_0x344a('0x25')]({'where':_0x428c56[_0x344a('0x1e')]?_0x428c56['options'][_0x344a('0x20')]||null:null})['then'](function(_0x378253){if(_0x378253){return _0x378253['addTags'](_0x428c56[_0x344a('0x1d')][_0x344a('0x26')],_[_0x344a('0x27')](_0x428c56[_0x344a('0x1d')],[_0x344a('0x26'),'id'])||{});}})[_0x344a('0x28')](function(_0x463c82){logger[_0x344a('0x19')](_0x344a('0x29'),_0x428c56);logger['debug'](_0x344a('0x29'),_0x428c56,JSON[_0x344a('0x15')](_0x463c82));_0x4c6c70(_0x463c82);})[_0x344a('0x1b')](function(_0x2d6cf4){logger[_0x344a('0x16')]('AddTags',_0x2d6cf4[_0x344a('0x18')],_0x428c56);_0x511708(_this[_0x344a('0x16')](0x1f4,_0x2d6cf4[_0x344a('0x18')]));});});}; \ No newline at end of file +var _0x4ef2=['UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','spread','catch','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ChatInteraction','update','body','options','where','then'];(function(_0x57ca3d,_0x2fd391){var _0x43dbf=function(_0x3addc5){while(--_0x3addc5){_0x57ca3d['push'](_0x57ca3d['shift']());}};_0x43dbf(++_0x2fd391);}(_0x4ef2,0x158));var _0x24ef=function(_0x264fc5,_0xfa1bfc){_0x264fc5=_0x264fc5-0x0;var _0x134209=_0x4ef2[_0x264fc5];return _0x134209;};'use strict';var _=require(_0x24ef('0x0'));var util=require('util');var moment=require(_0x24ef('0x1'));var BPromise=require(_0x24ef('0x2'));var rs=require(_0x24ef('0x3'));var fs=require('fs');var Redis=require(_0x24ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x24ef('0x5'));var logger=require(_0x24ef('0x6'))(_0x24ef('0x7'));var config=require(_0x24ef('0x8'));var jayson=require(_0x24ef('0x9'));var client=jayson[_0x24ef('0xa')][_0x24ef('0xb')]({'port':0x232a});config[_0x24ef('0xc')]=_[_0x24ef('0xd')](config[_0x24ef('0xc')],{'host':_0x24ef('0xe'),'port':0x18eb});var socket=require(_0x24ef('0xf'))(new Redis(config[_0x24ef('0xc')]));require(_0x24ef('0x10'))[_0x24ef('0x11')](socket);function respondWithRpcPromise(_0x424110,_0xaa67f4,_0x2406da){return new BPromise(function(_0xa64c6b,_0xbe2d56){return client[_0x24ef('0x12')](_0x424110,_0x2406da)['then'](function(_0x1802ca){logger[_0x24ef('0x13')](_0x24ef('0x14'),_0xaa67f4,_0x24ef('0x15'));logger[_0x24ef('0x16')](_0x24ef('0x17'),_0xaa67f4,_0x24ef('0x15'),JSON[_0x24ef('0x18')](_0x1802ca));if(_0x1802ca[_0x24ef('0x19')]){if(_0x1802ca['error']['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xaa67f4,_0x1802ca[_0x24ef('0x19')][_0x24ef('0x1a')]);return _0xbe2d56(_0x1802ca[_0x24ef('0x19')][_0x24ef('0x1a')]);}logger[_0x24ef('0x19')](_0x24ef('0x14'),_0xaa67f4,_0x1802ca['error']['message']);return _0xa64c6b(_0x1802ca[_0x24ef('0x19')][_0x24ef('0x1a')]);}else{logger[_0x24ef('0x13')](_0x24ef('0x14'),_0xaa67f4,_0x24ef('0x15'));_0xa64c6b(_0x1802ca[_0x24ef('0x1b')]['message']);}})['catch'](function(_0x2e4263){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xaa67f4,_0x2e4263);_0xbe2d56(_0x2e4263);});});}exports['UpdateChatInteraction']=function(_0x51e586){var _0x134942=this;return new Promise(function(_0x1ffb94,_0x5caa36){return db[_0x24ef('0x1c')][_0x24ef('0x1d')](_0x51e586[_0x24ef('0x1e')],{'raw':_0x51e586[_0x24ef('0x1f')]?_0x51e586['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51e586[_0x24ef('0x1f')]?_0x51e586[_0x24ef('0x1f')][_0x24ef('0x20')]||null:null,'attributes':_0x51e586['options']?_0x51e586['options']['attributes']||null:null,'limit':_0x51e586[_0x24ef('0x1f')]?_0x51e586[_0x24ef('0x1f')]['limit']||null:null})[_0x24ef('0x21')](function(_0x9b8a73){logger[_0x24ef('0x13')]('UpdateChatInteraction',_0x51e586);logger[_0x24ef('0x16')](_0x24ef('0x22'),_0x51e586,JSON[_0x24ef('0x18')](_0x9b8a73));_0x1ffb94(_0x9b8a73);})['catch'](function(_0x38fc2f){logger[_0x24ef('0x19')]('UpdateChatInteraction',_0x38fc2f[_0x24ef('0x1a')],_0x51e586);_0x5caa36(_0x134942[_0x24ef('0x19')](0x1f4,_0x38fc2f[_0x24ef('0x1a')]));});});};exports[_0x24ef('0x23')]=function(_0x10dccc){return new Promise(function(_0x3385b9,_0x32df54){return db[_0x24ef('0x1c')][_0x24ef('0x24')]({'where':_0x10dccc[_0x24ef('0x1f')]?_0x10dccc[_0x24ef('0x1f')]['where']||null:null})[_0x24ef('0x21')](function(_0x21bf5a){if(_0x21bf5a){return _0x21bf5a[_0x24ef('0x25')](_0x10dccc['body'][_0x24ef('0x26')],_['omit'](_0x10dccc[_0x24ef('0x1e')],[_0x24ef('0x26'),'id'])||{});}})[_0x24ef('0x27')](function(_0x51fb29){logger[_0x24ef('0x13')]('AddTags',_0x10dccc);logger[_0x24ef('0x16')]('AddTags',_0x10dccc,JSON[_0x24ef('0x18')](_0x51fb29));_0x3385b9(_0x51fb29);})[_0x24ef('0x28')](function(_0x124485){logger[_0x24ef('0x19')](_0x24ef('0x29'),_0x124485['message'],_0x10dccc);_0x32df54(_this[_0x24ef('0x19')](0x1f4,_0x124485[_0x24ef('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 98b948b..e40c1fa 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 _0x3b81=['./chatInteraction.events','save','remove','update','emit','register','length','chatInteraction:'];(function(_0x1585c7,_0xb076ff){var _0x418a8d=function(_0x494ff2){while(--_0x494ff2){_0x1585c7['push'](_0x1585c7['shift']());}};_0x418a8d(++_0xb076ff);}(_0x3b81,0x98));var _0x13b8=function(_0x4028ac,_0x24b74a){_0x4028ac=_0x4028ac-0x0;var _0x4b9b3a=_0x3b81[_0x4028ac];return _0x4b9b3a;};'use strict';var ChatInteractionEvents=require(_0x13b8('0x0'));var events=[_0x13b8('0x1'),_0x13b8('0x2'),_0x13b8('0x3')];function createListener(_0x105078,_0x4a8a53){return function(_0x41b891){_0x4a8a53[_0x13b8('0x4')](_0x105078,_0x41b891);};}function removeListener(_0x4ac1dd,_0x5bba0d){return function(){ChatInteractionEvents['removeListener'](_0x4ac1dd,_0x5bba0d);};}exports[_0x13b8('0x5')]=function(_0x2dc245){for(var _0x324810=0x0,_0x5cd159=events[_0x13b8('0x6')];_0x324810<_0x5cd159;_0x324810++){var _0x4e8faa=events[_0x324810];var _0x38fa31=createListener(_0x13b8('0x7')+_0x4e8faa,_0x2dc245);ChatInteractionEvents['on'](_0x4e8faa,_0x38fa31);}}; \ No newline at end of file +var _0x72dd=['update','removeListener','register','length','./chatInteraction.events','save'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_0x72dd,0xee));var _0xd72d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x72dd[_0x1facfa];return _0x9ec701;};'use strict';var ChatInteractionEvents=require(_0xd72d('0x0'));var events=[_0xd72d('0x1'),'remove',_0xd72d('0x2')];function createListener(_0x4c5239,_0x1f3b82){return function(_0x398734){_0x1f3b82['emit'](_0x4c5239,_0x398734);};}function removeListener(_0x3d06fb,_0x2a9844){return function(){ChatInteractionEvents[_0xd72d('0x3')](_0x3d06fb,_0x2a9844);};}exports[_0xd72d('0x4')]=function(_0x33aaf7){for(var _0x491894=0x0,_0x13c4f4=events[_0xd72d('0x5')];_0x491894<_0x13c4f4;_0x491894++){var _0x4f107d=events[_0x491894];var _0x523494=createListener('chatInteraction:'+_0x4f107d,_0x33aaf7);ChatInteractionEvents['on'](_0x4f107d,_0x523494);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c88218b..c624a41 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 _0x3da6=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','describe','/:id','show','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','removeTags'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x3da6,0xc1));var _0x63da=function(_0x1ae78f,_0x122ed2){_0x1ae78f=_0x1ae78f-0x0;var _0x5baf80=_0x3da6[_0x1ae78f];return _0x5baf80;};'use strict';var multer=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var path=require(_0x63da('0x2'));var timeout=require(_0x63da('0x3'));var express=require(_0x63da('0x4'));var router=express[_0x63da('0x5')]();var auth=require(_0x63da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x63da('0x7'));var controller=require(_0x63da('0x8'));router['get']('/',auth[_0x63da('0x9')](),controller['index']);router[_0x63da('0xa')]('/describe',auth[_0x63da('0x9')](),controller[_0x63da('0xb')]);router[_0x63da('0xa')](_0x63da('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x63da('0xd')]);router[_0x63da('0xa')]('/:id/attachment_download',auth[_0x63da('0xe')](),controller['attachmentDownload']);router[_0x63da('0xa')](_0x63da('0xf'),auth[_0x63da('0x9')](),controller[_0x63da('0x10')]);router[_0x63da('0xa')]('/:id/my_messages',auth[_0x63da('0xe')](),controller['getMyMessages']);router[_0x63da('0xa')](_0x63da('0x11'),auth[_0x63da('0x9')](),controller[_0x63da('0x12')]);router[_0x63da('0x13')]('/',auth[_0x63da('0x9')](),controller[_0x63da('0x14')]);router[_0x63da('0x13')](_0x63da('0x15'),auth[_0x63da('0x9')](),controller[_0x63da('0x16')]);var upload=multer({'storage':multer[_0x63da('0x17')]({'destination':function(_0x2be621,_0x4e6084,_0x48ac11){_0x48ac11(null,path[_0x63da('0x18')](config['root'],_0x63da('0x19')));},'filename':function(_0xe8c774,_0x329ef4,_0x3128cd){_0x3128cd(null,util[_0x63da('0x1a')]('%s-%s',Date[_0x63da('0x1b')](),_0x329ef4['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x63da('0x13')]('/:id/attachment_upload',upload[_0x63da('0x1c')](_0x63da('0x1d')),controller[_0x63da('0x1e')]);router['post'](_0x63da('0xf'),auth[_0x63da('0xe')](),controller['addMessage']);router[_0x63da('0x13')](_0x63da('0x1f'),auth[_0x63da('0x9')](),interaction[_0x63da('0x20')](_0x63da('0x21'),_0x63da('0x22')),controller[_0x63da('0x23')]);router[_0x63da('0x24')](_0x63da('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x63da('0x21'),_0x63da('0x25')),controller[_0x63da('0x26')]);router[_0x63da('0x24')](_0x63da('0x27'),controller[_0x63da('0x28')]);router['put'](_0x63da('0x29'),auth[_0x63da('0xe')](),controller[_0x63da('0x2a')]);router[_0x63da('0x24')]('/:id/close',controller[_0x63da('0x2b')]);router[_0x63da('0x2c')](_0x63da('0xc'),auth[_0x63da('0x9')](),interaction[_0x63da('0x20')](_0x63da('0x21'),_0x63da('0x2d')),controller['destroy']);router['delete'](_0x63da('0x1f'),auth[_0x63da('0x9')](),controller[_0x63da('0x2e')]);module[_0x63da('0x2f')]=router; \ No newline at end of file +var _0x74fd=['isChatInteractionAuthorized','show','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','/:id/tags','chat','chatinteraction:addtags','tracked','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','/describe','describe','/:id'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x74fd,0x8f));var _0xd74f=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x74fd[_0xb301d4];return _0x3b5bde;};'use strict';var multer=require(_0xd74f('0x0'));var util=require('util');var path=require(_0xd74f('0x1'));var timeout=require(_0xd74f('0x2'));var express=require(_0xd74f('0x3'));var router=express[_0xd74f('0x4')]();var auth=require(_0xd74f('0x5'));var interaction=require(_0xd74f('0x6'));var config=require(_0xd74f('0x7'));var controller=require(_0xd74f('0x8'));router[_0xd74f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd74f('0x9')](_0xd74f('0xa'),auth['isAuthenticated'](),controller[_0xd74f('0xb')]);router[_0xd74f('0x9')](_0xd74f('0xc'),auth[_0xd74f('0xd')](),controller[_0xd74f('0xe')]);router['get']('/:id/attachment_download',auth[_0xd74f('0xd')](),controller['attachmentDownload']);router['get'](_0xd74f('0xf'),auth[_0xd74f('0x10')](),controller[_0xd74f('0x11')]);router[_0xd74f('0x9')](_0xd74f('0x12'),auth[_0xd74f('0xd')](),controller[_0xd74f('0x13')]);router[_0xd74f('0x9')](_0xd74f('0x14'),auth['isAuthenticated'](),controller[_0xd74f('0x15')]);router[_0xd74f('0x16')]('/',auth[_0xd74f('0x10')](),controller[_0xd74f('0x17')]);router[_0xd74f('0x16')]('/:id/vidaoo',auth[_0xd74f('0x10')](),controller[_0xd74f('0x18')]);var upload=multer({'storage':multer[_0xd74f('0x19')]({'destination':function(_0x53207a,_0x267d4d,_0x297477){_0x297477(null,path['join'](config[_0xd74f('0x1a')],_0xd74f('0x1b')));},'filename':function(_0x37e2aa,_0x2be0c4,_0x299c99){_0x299c99(null,util[_0xd74f('0x1c')](_0xd74f('0x1d'),Date['now'](),_0x2be0c4[_0xd74f('0x1e')][_0xd74f('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xd74f('0x20'),upload[_0xd74f('0x21')](_0xd74f('0x22')),controller['attachmentUpload']);router['post'](_0xd74f('0xf'),auth[_0xd74f('0xd')](),controller['addMessage']);router['post'](_0xd74f('0x23'),auth[_0xd74f('0x10')](),interaction['tracked'](_0xd74f('0x24'),_0xd74f('0x25')),controller['addTags']);router['put'](_0xd74f('0xc'),auth[_0xd74f('0x10')](),interaction[_0xd74f('0x26')](_0xd74f('0x24'),_0xd74f('0x27')),controller[_0xd74f('0x28')]);router[_0xd74f('0x29')](_0xd74f('0x2a'),controller[_0xd74f('0x2b')]);router[_0xd74f('0x29')](_0xd74f('0x2c'),auth[_0xd74f('0xd')](),controller[_0xd74f('0x2d')]);router[_0xd74f('0x29')](_0xd74f('0x2e'),controller['close']);router['delete']('/:id',auth[_0xd74f('0x10')](),interaction[_0xd74f('0x26')](_0xd74f('0x24'),_0xd74f('0x2f')),controller[_0xd74f('0x30')]);router[_0xd74f('0x31')](_0xd74f('0x23'),auth[_0xd74f('0x10')](),controller[_0xd74f('0x32')]);module[_0xd74f('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 350eef1..8772897 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 _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x97d017,_0xde9c25){var _0x330b0d=function(_0x1be86d){while(--_0x1be86d){_0x97d017['push'](_0x97d017['shift']());}};_0x330b0d(++_0xde9c25);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c03b9,_0x260d10){_0x3c03b9=_0x3c03b9-0x0;var _0x2fc086=_0x2ef3[_0x3c03b9];return _0x2fc086;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file +var _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0xcb71f9,_0x4a3d82){var _0xced6b1=function(_0x2f7bc2){while(--_0x2f7bc2){_0xcb71f9['push'](_0xcb71f9['shift']());}};_0xced6b1(++_0x4a3d82);}(_0x66fa,0x117));var _0xa66f=function(_0x2544b4,_0x4f5ab1){_0x2544b4=_0x2544b4-0x0;var _0x5c2716=_0x66fa[_0x2544b4];return _0x5c2716;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e407126..6725dac 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 _0xb292=['fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','role','userpic','internal','online','allowmessenger','showWebBar','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','ToId','read','-createdAt','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','name','send','map','rawAttributes','type','key','query','keys','intersection','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb292,0x164));var _0x2b29=function(_0x137fdc,_0x350ef5){_0x137fdc=_0x137fdc-0x0;var _0x4594b8=_0xb292[_0x137fdc];return _0x4594b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2b29('0x0'));var rimraf=require(_0x2b29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b29('0x2'));var rp=require(_0x2b29('0x3'));var moment=require(_0x2b29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b29('0x5'));var util=require(_0x2b29('0x6'));var path=require(_0x2b29('0x7'));var sox=require(_0x2b29('0x8'));var csv=require(_0x2b29('0x9'));var ejs=require(_0x2b29('0xa'));var fs=require('fs');var _=require(_0x2b29('0xb'));var squel=require(_0x2b29('0xc'));var crypto=require(_0x2b29('0xd'));var jsforce=require(_0x2b29('0xe'));var deskjs=require(_0x2b29('0xf'));var toCsv=require(_0x2b29('0x9'));var querystring=require(_0x2b29('0x10'));var Papa=require(_0x2b29('0x11'));var Redis=require('ioredis');var authService=require(_0x2b29('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b29('0x13'))(_0x2b29('0x14'));var utils=require(_0x2b29('0x15'));var config=require('../../config/environment');var db=require(_0x2b29('0x16'))['db'];config[_0x2b29('0x17')]=_[_0x2b29('0x18')](config[_0x2b29('0x17')],{'host':_0x2b29('0x19'),'port':0x18eb});var socket=require(_0x2b29('0x1a'))(new Redis(config[_0x2b29('0x17')]));require(_0x2b29('0x1b'))[_0x2b29('0x1c')](socket);function respondWithStatusCode(_0x500abd,_0x17f291){_0x17f291=_0x17f291||0xcc;return function(_0xe546da){if(_0xe546da){return _0x500abd[_0x2b29('0x1d')](_0x17f291);}return _0x500abd['status'](_0x17f291)[_0x2b29('0x1e')]();};}function respondWithResult(_0x2ebeae,_0x35c1d1){_0x35c1d1=_0x35c1d1||0xc8;return function(_0x1870b6){if(_0x1870b6){return _0x2ebeae[_0x2b29('0x1f')](_0x35c1d1)['json'](_0x1870b6);}};}function respondWithFilteredResult(_0x5eefa7,_0x3dba8c){return function(_0x3b5cae){if(_0x3b5cae){var _0x1a7bfb=_0x3b5cae[_0x2b29('0x20')],_0x52d9db=_0x3dba8c[_0x2b29('0x21')],_0x5bb354=_0x3dba8c[_0x2b29('0x21')]+_0x3dba8c[_0x2b29('0x22')],_0x1efb1b;if(_0x5bb354>=_0x1a7bfb){_0x5bb354=_0x1a7bfb;_0x1efb1b=0xc8;}else{_0x1efb1b=0xce;}_0x5eefa7[_0x2b29('0x1f')](_0x1efb1b);return _0x5eefa7['set'](_0x2b29('0x23'),_0x52d9db+'-'+_0x5bb354+'/'+_0x1a7bfb)[_0x2b29('0x24')](_0x3b5cae);}return null;};}function patchUpdates(_0x35c7a4){return function(_0x370432){try{jsonpatch[_0x2b29('0x25')](_0x370432,_0x35c7a4,!![]);}catch(_0x554ac0){return BPromise[_0x2b29('0x26')](_0x554ac0);}return _0x370432['save']();};}function saveUpdates(_0x247626,_0x44722e){return function(_0x1d40ba){if(_0x1d40ba){return _0x1d40ba[_0x2b29('0x27')](_0x247626)[_0x2b29('0x28')](function(_0x3a222c){return _0x3a222c;});}return null;};}function removeEntity(_0x42164a,_0x2f9590){return function(_0x5db3fe){if(_0x5db3fe){return _0x5db3fe[_0x2b29('0x29')]()[_0x2b29('0x28')](function(){_0x42164a[_0x2b29('0x1f')](0xcc)[_0x2b29('0x1e')]();});}};}function handleEntityNotFound(_0x74545d,_0x18d5ce){return function(_0x2eb089){if(!_0x2eb089){_0x74545d[_0x2b29('0x1d')](0x194);}return _0x2eb089;};}function handleError(_0x32b83a,_0x4998cb){_0x4998cb=_0x4998cb||0x1f4;return function(_0x19b38d){logger['error'](_0x19b38d['stack']);if(_0x19b38d['name']){delete _0x19b38d[_0x2b29('0x2a')];}_0x32b83a[_0x2b29('0x1f')](_0x4998cb)[_0x2b29('0x2b')](_0x19b38d);};}exports['index']=function(_0x503238,_0x17084b){var _0x4fbc4d={},_0x52d4f2={},_0x354e43={'count':0x0,'rows':[]};var _0x453aa1=_[_0x2b29('0x2c')](db['ChatInternalMessage'][_0x2b29('0x2d')],function(_0x30cd15){return{'name':_0x30cd15['fieldName'],'type':_0x30cd15[_0x2b29('0x2e')][_0x2b29('0x2f')]};});_0x52d4f2['model']=_[_0x2b29('0x2c')](_0x453aa1,_0x2b29('0x2a'));_0x52d4f2[_0x2b29('0x30')]=_[_0x2b29('0x31')](_0x503238[_0x2b29('0x30')]);_0x52d4f2['filters']=_[_0x2b29('0x32')](_0x52d4f2[_0x2b29('0x33')],_0x52d4f2[_0x2b29('0x30')]);_0x4fbc4d['attributes']=_[_0x2b29('0x32')](_0x52d4f2[_0x2b29('0x33')],qs[_0x2b29('0x34')](_0x503238[_0x2b29('0x30')][_0x2b29('0x34')]));_0x4fbc4d[_0x2b29('0x35')]=_0x4fbc4d[_0x2b29('0x35')][_0x2b29('0x36')]?_0x4fbc4d[_0x2b29('0x35')]:_0x52d4f2[_0x2b29('0x33')];if(!_0x503238[_0x2b29('0x30')]['hasOwnProperty'](_0x2b29('0x37'))){_0x4fbc4d[_0x2b29('0x22')]=qs['limit'](_0x503238[_0x2b29('0x30')][_0x2b29('0x22')]);_0x4fbc4d[_0x2b29('0x21')]=qs[_0x2b29('0x21')](_0x503238['query'][_0x2b29('0x21')]);}_0x4fbc4d[_0x2b29('0x38')]=qs[_0x2b29('0x39')](_0x503238[_0x2b29('0x30')]['sort']);_0x4fbc4d['where']=qs['filters'](_[_0x2b29('0x3a')](_0x503238['query'],_0x52d4f2[_0x2b29('0x3b')]),_0x453aa1);if(_0x503238[_0x2b29('0x30')][_0x2b29('0x3c')]){_0x4fbc4d[_0x2b29('0x3d')]=_[_0x2b29('0x3e')](_0x4fbc4d['where'],{'$or':_['map'](_0x453aa1,function(_0x1cf346){if(_0x1cf346[_0x2b29('0x2e')]!==_0x2b29('0x3f')){var _0x5631cd={};_0x5631cd[_0x1cf346[_0x2b29('0x2a')]]={'$like':'%'+_0x503238['query'][_0x2b29('0x3c')]+'%'};return _0x5631cd;}})});}_0x4fbc4d=_[_0x2b29('0x3e')]({},_0x4fbc4d,_0x503238[_0x2b29('0x40')]);var _0x160b74={'where':_0x4fbc4d['where']};return db[_0x2b29('0x41')][_0x2b29('0x20')](_0x160b74)[_0x2b29('0x28')](function(_0x7aefd8){_0x354e43['count']=_0x7aefd8;if(_0x503238[_0x2b29('0x30')][_0x2b29('0x42')]){_0x4fbc4d[_0x2b29('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4fbc4d);})[_0x2b29('0x28')](function(_0x4201a6){_0x354e43['rows']=_0x4201a6;return _0x354e43;})['then'](respondWithFilteredResult(_0x17084b,_0x4fbc4d))[_0x2b29('0x44')](handleError(_0x17084b,null));};exports[_0x2b29('0x45')]=function(_0x42d09c,_0x47f9a7){var _0x24c3b4={'raw':!![],'where':{'id':_0x42d09c[_0x2b29('0x46')]['id']}},_0x423ed6={};_0x423ed6[_0x2b29('0x33')]=_[_0x2b29('0x31')](db[_0x2b29('0x41')][_0x2b29('0x2d')]);_0x423ed6[_0x2b29('0x30')]=_[_0x2b29('0x31')](_0x42d09c['query']);_0x423ed6['filters']=_[_0x2b29('0x32')](_0x423ed6[_0x2b29('0x33')],_0x423ed6[_0x2b29('0x30')]);_0x24c3b4['attributes']=_[_0x2b29('0x32')](_0x423ed6[_0x2b29('0x33')],qs[_0x2b29('0x34')](_0x42d09c[_0x2b29('0x30')]['fields']));_0x24c3b4[_0x2b29('0x35')]=_0x24c3b4[_0x2b29('0x35')][_0x2b29('0x36')]?_0x24c3b4[_0x2b29('0x35')]:_0x423ed6[_0x2b29('0x33')];if(_0x42d09c[_0x2b29('0x30')][_0x2b29('0x42')]){_0x24c3b4[_0x2b29('0x43')]=[{'all':!![]}];}_0x24c3b4=_['merge']({},_0x24c3b4,_0x42d09c[_0x2b29('0x40')]);return db[_0x2b29('0x41')][_0x2b29('0x47')](_0x24c3b4)[_0x2b29('0x28')](handleEntityNotFound(_0x47f9a7,null))[_0x2b29('0x28')](respondWithResult(_0x47f9a7,null))['catch'](handleError(_0x47f9a7,null));};exports[_0x2b29('0x48')]=function(_0x2e5d4b,_0xa868cf){return db['ChatInternalMessage']['create'](_0x2e5d4b[_0x2b29('0x49')],{})[_0x2b29('0x28')](respondWithResult(_0xa868cf,0xc9))[_0x2b29('0x44')](handleError(_0xa868cf,null));};exports[_0x2b29('0x27')]=function(_0x251573,_0x10a9b3){if(_0x251573[_0x2b29('0x49')]['id']){delete _0x251573[_0x2b29('0x49')]['id'];}return db[_0x2b29('0x41')][_0x2b29('0x47')]({'where':{'id':_0x251573['params']['id']}})[_0x2b29('0x28')](handleEntityNotFound(_0x10a9b3,null))[_0x2b29('0x28')](saveUpdates(_0x251573[_0x2b29('0x49')],null))[_0x2b29('0x28')](respondWithResult(_0x10a9b3,null))[_0x2b29('0x44')](handleError(_0x10a9b3,null));};exports[_0x2b29('0x29')]=function(_0x42ab8f,_0x17def8){return db[_0x2b29('0x41')][_0x2b29('0x47')]({'where':{'id':_0x42ab8f[_0x2b29('0x46')]['id']}})[_0x2b29('0x28')](handleEntityNotFound(_0x17def8,null))['then'](removeEntity(_0x17def8,null))['catch'](handleError(_0x17def8,null));};exports[_0x2b29('0x4a')]=function(_0x244c26,_0xeebfc1){return db[_0x2b29('0x41')]['describe']()[_0x2b29('0x28')](respondWithResult(_0xeebfc1,null))[_0x2b29('0x44')](handleError(_0xeebfc1,null));};function wrapUser(_0x31a88c){return function(_0xfd5918){var _0x5086e0=_0x31a88c[_0x2b29('0x4b')]({'plain':!![]});_0x5086e0[_0x2b29('0x4c')]=[];if(_0xfd5918){_0x5086e0[_0x2b29('0x4d')]=_0xfd5918['createdAt'];_0x5086e0[_0x2b29('0x4e')]=_0xfd5918;}else{_0x5086e0[_0x2b29('0x4d')]=moment(0x0)[_0x2b29('0x4f')](_0x2b29('0x50'));_0x5086e0['lastMessage']={};}return _0x5086e0;};}exports[_0x2b29('0x51')]=function(_0x2ea19a,_0x31ecee,_0x1b9d08){var _0xbf32b4=[];return db['User'][_0x2b29('0x52')]({'where':{'role':[_0x2b29('0x53'),'admin','user']},'attributes':['id','fullname',_0x2b29('0x2a'),_0x2b29('0x54'),_0x2b29('0x55'),_0x2b29('0x56'),_0x2b29('0x57'),'lastLoginAt',_0x2b29('0x58'),_0x2b29('0x59')],'order':qs[_0x2b29('0x39')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x2b29('0x2a'),_0x2b29('0x2e')],'through':{'attributes':[]}}]})[_0x2b29('0x28')](function(_0x3ad64f){if(_0x3ad64f){var _0x39d0e5=_0x2ea19a[_0x2b29('0x5a')]['get']({'plain':!![]});if(!_0x39d0e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39d0e5[_0x2b29('0x54')]===_0x2b29('0x5a')){return db[_0x2b29('0x5b')][_0x2b29('0x47')]({'where':{'name':'Agents','userProfileId':_0x39d0e5[_0x2b29('0x5c')]},'raw':!![]})[_0x2b29('0x28')](function(_0x47ba0d){if(_0x47ba0d){if(_0x47ba0d[_0x2b29('0x5d')]===0x0){return db[_0x2b29('0x5e')]['findAll']({'where':{'sectionId':_0x47ba0d['id']},'raw':!![]})['then'](function(_0x4e7558){var _0x3f2376=[];if(_[_0x2b29('0x5f')](_0x4e7558)){_0x3f2376=_[_0x2b29('0x3c')](_0x3ad64f,function(_0x262c1b){if(_0x262c1b['role']!==_0x2b29('0x53')){return _0x262c1b;}});return _0x3f2376;}else{for(var _0x1d8387=0x0;_0x1d8387<_0x3ad64f[_0x2b29('0x36')];_0x1d8387++){var _0x319dbf=_0x3ad64f[_0x1d8387];if(_0x319dbf[_0x2b29('0x54')]==='agent'){var _0x4ae7ec=_['find'](_0x4e7558,function(_0x424dd9){return _0x424dd9[_0x2b29('0x60')]===_0x319dbf['id'];});if(_0x4ae7ec)_0x3f2376[_0x2b29('0x61')](_0x319dbf);}else{_0x3f2376[_0x2b29('0x61')](_0x319dbf);}}return _0x3f2376;}});}else{return _0x3ad64f;}}else{var _0x176dee=_[_0x2b29('0x3c')](_0x3ad64f,function(_0x4cdbca){if(_0x4cdbca[_0x2b29('0x54')]!=='agent'){return _0x4cdbca;}});return _0x176dee;}});}else{return _0x3ad64f;}}})['then'](function(_0x142615){var _0x123645=[];if(_0x142615){_0xbf32b4=_0x142615;for(var _0x52ae56=0x0;_0x52ae56<_0x142615[_0x2b29('0x36')];_0x52ae56+=0x1){_0xbf32b4[_0x52ae56][_0x2b29('0x4c')]=[];_0x123645[_0x2b29('0x61')](db[_0x2b29('0x41')][_0x2b29('0x47')]({'where':{'FromId':[_0x2ea19a[_0x2b29('0x5a')]['id'],_0x142615[_0x52ae56]['id']],'ToId':[_0x2ea19a[_0x2b29('0x5a')]['id'],_0x142615[_0x52ae56]['id']],'ChatGroupId':null},'attributes':['id',_0x2b29('0x62'),'FromId',_0x2b29('0x63'),_0x2b29('0x64'),_0x2b29('0x49')],'order':qs[_0x2b29('0x39')](_0x2b29('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x142615[_0x52ae56])));}return BPromise['all'](_0x123645);}return[];})['then'](function(_0x299cc5){return{'rows':_0x299cc5,'count':_0x299cc5[_0x2b29('0x36')]};})[_0x2b29('0x28')](respondWithResult(_0x31ecee,null))[_0x2b29('0x44')](handleError(_0x31ecee,null));}; \ No newline at end of file +var _0x5024=['update','destroy','then','error','stack','name','map','ChatInternalMessage','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save'];(function(_0x5e75ee,_0x5cd598){var _0x534367=function(_0x53da5e){while(--_0x53da5e){_0x5e75ee['push'](_0x5e75ee['shift']());}};_0x534367(++_0x5cd598);}(_0x5024,0x118));var _0x4502=function(_0x2ed2c6,_0x45847c){_0x2ed2c6=_0x2ed2c6-0x0;var _0x2142c7=_0x5024[_0x2ed2c6];return _0x2142c7;};'use strict';var pdf=require(_0x4502('0x0'));var emlformat=require(_0x4502('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4502('0x2'));var moment=require(_0x4502('0x3'));var BPromise=require(_0x4502('0x4'));var Mustache=require(_0x4502('0x5'));var util=require(_0x4502('0x6'));var path=require(_0x4502('0x7'));var sox=require(_0x4502('0x8'));var csv=require(_0x4502('0x9'));var ejs=require(_0x4502('0xa'));var fs=require('fs');var _=require(_0x4502('0xb'));var squel=require('squel');var crypto=require(_0x4502('0xc'));var jsforce=require(_0x4502('0xd'));var deskjs=require(_0x4502('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4502('0xf'));var Redis=require('ioredis');var authService=require(_0x4502('0x10'));var qs=require(_0x4502('0x11'));var as=require(_0x4502('0x12'));var hardwareService=require(_0x4502('0x13'));var logger=require('../../config/logger')(_0x4502('0x14'));var utils=require(_0x4502('0x15'));var config=require(_0x4502('0x16'));var db=require(_0x4502('0x17'))['db'];config[_0x4502('0x18')]=_['defaults'](config[_0x4502('0x18')],{'host':_0x4502('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4502('0x18')]));require('./chatInternalMessage.socket')[_0x4502('0x1a')](socket);function respondWithStatusCode(_0x335ef9,_0x3fd5a6){_0x3fd5a6=_0x3fd5a6||0xcc;return function(_0x2f124f){if(_0x2f124f){return _0x335ef9[_0x4502('0x1b')](_0x3fd5a6);}return _0x335ef9['status'](_0x3fd5a6)[_0x4502('0x1c')]();};}function respondWithResult(_0x334453,_0x2e41fc){_0x2e41fc=_0x2e41fc||0xc8;return function(_0x1c9ac4){if(_0x1c9ac4){return _0x334453[_0x4502('0x1d')](_0x2e41fc)['json'](_0x1c9ac4);}};}function respondWithFilteredResult(_0x3ba340,_0x46f474){return function(_0x23894e){if(_0x23894e){var _0x24e061=_0x23894e[_0x4502('0x1e')],_0x5817ae=_0x46f474[_0x4502('0x1f')],_0x372969=_0x46f474['offset']+_0x46f474[_0x4502('0x20')],_0x4e5731;if(_0x372969>=_0x24e061){_0x372969=_0x24e061;_0x4e5731=0xc8;}else{_0x4e5731=0xce;}_0x3ba340[_0x4502('0x1d')](_0x4e5731);return _0x3ba340[_0x4502('0x21')]('Content-Range',_0x5817ae+'-'+_0x372969+'/'+_0x24e061)[_0x4502('0x22')](_0x23894e);}return null;};}function patchUpdates(_0xadcd72){return function(_0x3b26b0){try{jsonpatch[_0x4502('0x23')](_0x3b26b0,_0xadcd72,!![]);}catch(_0x3613bf){return BPromise[_0x4502('0x24')](_0x3613bf);}return _0x3b26b0[_0x4502('0x25')]();};}function saveUpdates(_0x196eb6,_0xa2c78){return function(_0x37effe){if(_0x37effe){return _0x37effe[_0x4502('0x26')](_0x196eb6)['then'](function(_0x443db8){return _0x443db8;});}return null;};}function removeEntity(_0xea14ce,_0x3212eb){return function(_0x1ba101){if(_0x1ba101){return _0x1ba101[_0x4502('0x27')]()[_0x4502('0x28')](function(){_0xea14ce[_0x4502('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ee8c,_0xe96b77){return function(_0x4b57de){if(!_0x4b57de){_0x55ee8c[_0x4502('0x1b')](0x194);}return _0x4b57de;};}function handleError(_0x28c24b,_0x1de5ab){_0x1de5ab=_0x1de5ab||0x1f4;return function(_0x449d75){logger[_0x4502('0x29')](_0x449d75[_0x4502('0x2a')]);if(_0x449d75[_0x4502('0x2b')]){delete _0x449d75[_0x4502('0x2b')];}_0x28c24b[_0x4502('0x1d')](_0x1de5ab)['send'](_0x449d75);};}exports['index']=function(_0x1fd8f8,_0x1d5276){var _0x4db3ef={},_0x3eb2ec={},_0x2f3c41={'count':0x0,'rows':[]};var _0x5632be=_[_0x4502('0x2c')](db[_0x4502('0x2d')]['rawAttributes'],function(_0x40a737){return{'name':_0x40a737[_0x4502('0x2e')],'type':_0x40a737[_0x4502('0x2f')]['key']};});_0x3eb2ec[_0x4502('0x30')]=_[_0x4502('0x2c')](_0x5632be,_0x4502('0x2b'));_0x3eb2ec[_0x4502('0x31')]=_['keys'](_0x1fd8f8[_0x4502('0x31')]);_0x3eb2ec[_0x4502('0x32')]=_[_0x4502('0x33')](_0x3eb2ec['model'],_0x3eb2ec[_0x4502('0x31')]);_0x4db3ef[_0x4502('0x34')]=_[_0x4502('0x33')](_0x3eb2ec['model'],qs['fields'](_0x1fd8f8[_0x4502('0x31')][_0x4502('0x35')]));_0x4db3ef['attributes']=_0x4db3ef['attributes'][_0x4502('0x36')]?_0x4db3ef[_0x4502('0x34')]:_0x3eb2ec[_0x4502('0x30')];if(!_0x1fd8f8['query'][_0x4502('0x37')](_0x4502('0x38'))){_0x4db3ef['limit']=qs[_0x4502('0x20')](_0x1fd8f8[_0x4502('0x31')][_0x4502('0x20')]);_0x4db3ef[_0x4502('0x1f')]=qs[_0x4502('0x1f')](_0x1fd8f8[_0x4502('0x31')][_0x4502('0x1f')]);}_0x4db3ef[_0x4502('0x39')]=qs[_0x4502('0x3a')](_0x1fd8f8[_0x4502('0x31')]['sort']);_0x4db3ef['where']=qs['filters'](_['pick'](_0x1fd8f8['query'],_0x3eb2ec['filters']),_0x5632be);if(_0x1fd8f8[_0x4502('0x31')][_0x4502('0x3b')]){_0x4db3ef['where']=_['merge'](_0x4db3ef[_0x4502('0x3c')],{'$or':_[_0x4502('0x2c')](_0x5632be,function(_0x5d5bbd){if(_0x5d5bbd[_0x4502('0x2f')]!=='VIRTUAL'){var _0x2ba508={};_0x2ba508[_0x5d5bbd[_0x4502('0x2b')]]={'$like':'%'+_0x1fd8f8[_0x4502('0x31')][_0x4502('0x3b')]+'%'};return _0x2ba508;}})});}_0x4db3ef=_['merge']({},_0x4db3ef,_0x1fd8f8[_0x4502('0x3d')]);var _0x4156e6={'where':_0x4db3ef[_0x4502('0x3c')]};return db[_0x4502('0x2d')]['count'](_0x4156e6)[_0x4502('0x28')](function(_0x393c70){_0x2f3c41[_0x4502('0x1e')]=_0x393c70;if(_0x1fd8f8['query'][_0x4502('0x3e')]){_0x4db3ef['include']=[{'all':!![]}];}return db[_0x4502('0x2d')][_0x4502('0x3f')](_0x4db3ef);})[_0x4502('0x28')](function(_0x2bad34){_0x2f3c41[_0x4502('0x40')]=_0x2bad34;return _0x2f3c41;})[_0x4502('0x28')](respondWithFilteredResult(_0x1d5276,_0x4db3ef))[_0x4502('0x41')](handleError(_0x1d5276,null));};exports[_0x4502('0x42')]=function(_0x54ed48,_0x2f878b){var _0x4a363e={'raw':!![],'where':{'id':_0x54ed48[_0x4502('0x43')]['id']}},_0x224678={};_0x224678[_0x4502('0x30')]=_[_0x4502('0x44')](db['ChatInternalMessage'][_0x4502('0x45')]);_0x224678['query']=_[_0x4502('0x44')](_0x54ed48[_0x4502('0x31')]);_0x224678[_0x4502('0x32')]=_[_0x4502('0x33')](_0x224678[_0x4502('0x30')],_0x224678[_0x4502('0x31')]);_0x4a363e['attributes']=_[_0x4502('0x33')](_0x224678['model'],qs[_0x4502('0x35')](_0x54ed48[_0x4502('0x31')][_0x4502('0x35')]));_0x4a363e[_0x4502('0x34')]=_0x4a363e[_0x4502('0x34')][_0x4502('0x36')]?_0x4a363e[_0x4502('0x34')]:_0x224678[_0x4502('0x30')];if(_0x54ed48['query'][_0x4502('0x3e')]){_0x4a363e[_0x4502('0x46')]=[{'all':!![]}];}_0x4a363e=_['merge']({},_0x4a363e,_0x54ed48[_0x4502('0x3d')]);return db['ChatInternalMessage'][_0x4502('0x47')](_0x4a363e)[_0x4502('0x28')](handleEntityNotFound(_0x2f878b,null))[_0x4502('0x28')](respondWithResult(_0x2f878b,null))[_0x4502('0x41')](handleError(_0x2f878b,null));};exports['create']=function(_0x2d6584,_0xf7cafd){return db[_0x4502('0x2d')][_0x4502('0x48')](_0x2d6584[_0x4502('0x49')],{})[_0x4502('0x28')](respondWithResult(_0xf7cafd,0xc9))['catch'](handleError(_0xf7cafd,null));};exports[_0x4502('0x26')]=function(_0x261a1d,_0x28e877){if(_0x261a1d[_0x4502('0x49')]['id']){delete _0x261a1d['body']['id'];}return db[_0x4502('0x2d')]['find']({'where':{'id':_0x261a1d[_0x4502('0x43')]['id']}})[_0x4502('0x28')](handleEntityNotFound(_0x28e877,null))[_0x4502('0x28')](saveUpdates(_0x261a1d[_0x4502('0x49')],null))[_0x4502('0x28')](respondWithResult(_0x28e877,null))[_0x4502('0x41')](handleError(_0x28e877,null));};exports[_0x4502('0x27')]=function(_0x21bd3e,_0x5d1f81){return db[_0x4502('0x2d')]['find']({'where':{'id':_0x21bd3e[_0x4502('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d1f81,null))[_0x4502('0x28')](removeEntity(_0x5d1f81,null))[_0x4502('0x41')](handleError(_0x5d1f81,null));};exports[_0x4502('0x4a')]=function(_0xbe847c,_0x184df3){return db[_0x4502('0x2d')][_0x4502('0x4a')]()[_0x4502('0x28')](respondWithResult(_0x184df3,null))['catch'](handleError(_0x184df3,null));};function wrapUser(_0x18d818){return function(_0x352e12){var _0x55d704=_0x18d818[_0x4502('0x4b')]({'plain':!![]});_0x55d704[_0x4502('0x4c')]=[];if(_0x352e12){_0x55d704['lastMessageAt']=_0x352e12[_0x4502('0x4d')];_0x55d704[_0x4502('0x4e')]=_0x352e12;}else{_0x55d704[_0x4502('0x4f')]=moment(0x0)[_0x4502('0x50')](_0x4502('0x51'));_0x55d704[_0x4502('0x4e')]={};}return _0x55d704;};}exports['getUsers']=function(_0x1527ae,_0x191d7d,_0x52777b){var _0x3c17f7=[];return db[_0x4502('0x52')][_0x4502('0x3f')]({'where':{'role':['agent',_0x4502('0x53'),_0x4502('0x54')]},'attributes':['id','fullname',_0x4502('0x2b'),_0x4502('0x55'),_0x4502('0x56'),_0x4502('0x57'),_0x4502('0x58'),_0x4502('0x59'),_0x4502('0x5a'),_0x4502('0x5b')],'order':qs['sort']('-online'),'include':[{'model':db[_0x4502('0x5c')],'as':'VoiceQueues','attributes':['id',_0x4502('0x2b'),_0x4502('0x2f')],'through':{'attributes':[]}}]})[_0x4502('0x28')](function(_0x431946){if(_0x431946){var _0x2860eb=_0x1527ae['user']['get']({'plain':!![]});if(!_0x2860eb)throw new Error(_0x4502('0x5d'));if(_0x2860eb[_0x4502('0x55')]===_0x4502('0x54')){return db[_0x4502('0x5e')]['find']({'where':{'name':_0x4502('0x5f'),'userProfileId':_0x2860eb['userProfileId']},'raw':!![]})['then'](function(_0x4ec901){if(_0x4ec901){if(_0x4ec901[_0x4502('0x60')]===0x0){return db[_0x4502('0x61')][_0x4502('0x3f')]({'where':{'sectionId':_0x4ec901['id']},'raw':!![]})[_0x4502('0x28')](function(_0x58f83a){var _0x5204bf=[];if(_[_0x4502('0x62')](_0x58f83a)){_0x5204bf=_['filter'](_0x431946,function(_0x1ee661){if(_0x1ee661[_0x4502('0x55')]!==_0x4502('0x63')){return _0x1ee661;}});return _0x5204bf;}else{for(var _0x211247=0x0;_0x211247<_0x431946['length'];_0x211247++){var _0x5b6a3b=_0x431946[_0x211247];if(_0x5b6a3b['role']===_0x4502('0x63')){var _0x5f7771=_['find'](_0x58f83a,function(_0x4d9f79){return _0x4d9f79[_0x4502('0x64')]===_0x5b6a3b['id'];});if(_0x5f7771)_0x5204bf[_0x4502('0x65')](_0x5b6a3b);}else{_0x5204bf[_0x4502('0x65')](_0x5b6a3b);}}return _0x5204bf;}});}else{return _0x431946;}}else{var _0x14206b=_[_0x4502('0x3b')](_0x431946,function(_0x20e59b){if(_0x20e59b[_0x4502('0x55')]!==_0x4502('0x63')){return _0x20e59b;}});return _0x14206b;}});}else{return _0x431946;}}})[_0x4502('0x28')](function(_0x523ed1){var _0x5319d3=[];if(_0x523ed1){_0x3c17f7=_0x523ed1;for(var _0x1bbd6b=0x0;_0x1bbd6b<_0x523ed1[_0x4502('0x36')];_0x1bbd6b+=0x1){_0x3c17f7[_0x1bbd6b][_0x4502('0x4c')]=[];_0x5319d3[_0x4502('0x65')](db['ChatInternalMessage'][_0x4502('0x47')]({'where':{'FromId':[_0x1527ae[_0x4502('0x54')]['id'],_0x523ed1[_0x1bbd6b]['id']],'ToId':[_0x1527ae[_0x4502('0x54')]['id'],_0x523ed1[_0x1bbd6b]['id']],'ChatGroupId':null},'attributes':['id',_0x4502('0x4d'),_0x4502('0x66'),_0x4502('0x67'),_0x4502('0x68'),_0x4502('0x49')],'order':qs[_0x4502('0x3a')](_0x4502('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4502('0x28')](wrapUser(_0x523ed1[_0x1bbd6b])));}return BPromise['all'](_0x5319d3);}return[];})[_0x4502('0x28')](function(_0x2f0a55){return{'rows':_0x2f0a55,'count':_0x2f0a55[_0x4502('0x36')]};})[_0x4502('0x28')](respondWithResult(_0x191d7d,null))[_0x4502('0x41')](handleError(_0x191d7d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3bf35ec..e6839ff 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 _0x6f2d=['hook','exports','events','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x6f2d,0x182));var _0xd6f2=function(_0x130fab,_0x24c62b){_0x130fab=_0x130fab-0x0;var _0xe31030=_0x6f2d[_0x130fab];return _0xe31030;};'use strict';var EventEmitter=require(_0xd6f2('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd6f2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd6f2('0x2'),'afterDestroy':_0xd6f2('0x3')};function emitEvent(_0x3c0aa8){return function(_0x13ab05,_0x35057e,_0x1e013d){ChatInternalMessageEvents[_0xd6f2('0x4')](_0x3c0aa8+':'+_0x13ab05['id'],_0x13ab05);ChatInternalMessageEvents[_0xd6f2('0x4')](_0x3c0aa8,_0x13ab05);_0x1e013d(null);};}for(var e in events){if(events[_0xd6f2('0x5')](e)){var event=events[e];ChatInternalMessage[_0xd6f2('0x6')](e,emitEvent(event));}}module[_0xd6f2('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3c2a=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x10034c,_0x346318){var _0x48e0b8=function(_0x124b39){while(--_0x124b39){_0x10034c['push'](_0x10034c['shift']());}};_0x48e0b8(++_0x346318);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x5b7b76,_0x455847){_0x5b7b76=_0x5b7b76-0x0;var _0x463a38=_0x3c2a[_0x5b7b76];return _0x463a38;};'use strict';var EventEmitter=require(_0xa3c2('0x0'));var ChatInternalMessage=require(_0xa3c2('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa3c2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3c2('0x3'),'afterDestroy':_0xa3c2('0x4')};function emitEvent(_0x10c557){return function(_0x43db8e,_0x3ddc59,_0x2eb9c4){ChatInternalMessageEvents[_0xa3c2('0x5')](_0x10c557+':'+_0x43db8e['id'],_0x43db8e);ChatInternalMessageEvents[_0xa3c2('0x5')](_0x10c557,_0x43db8e);_0x2eb9c4(null);};}for(var e in events){if(events[_0xa3c2('0x6')](e)){var event=events[e];ChatInternalMessage[_0xa3c2('0x7')](e,emitEvent(event));}}module[_0xa3c2('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b5bd662..6551584 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 _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file +var _0x9ffd=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x4f699a,_0x53b6f2){var _0x465ea5=function(_0x4ac032){while(--_0x4ac032){_0x4f699a['push'](_0x4f699a['shift']());}};_0x465ea5(++_0x53b6f2);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1836cf,_0x3864fe){_0x1836cf=_0x1836cf-0x0;var _0x4dd2c1=_0x9ffd[_0x1836cf];return _0x4dd2c1;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9ff('0xc'),'collate':_0xd9ff('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6187cb3..0f6ba5e 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 _0x803d=['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','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x529302,_0x3c8e00){var _0x5010f5=function(_0x552895){while(--_0x552895){_0x529302['push'](_0x529302['shift']());}};_0x5010f5(++_0x3c8e00);}(_0x803d,0x7a));var _0xd803=function(_0x2a3b01,_0x233d9a){_0x2a3b01=_0x2a3b01-0x0;var _0x53d325=_0x803d[_0x2a3b01];return _0x53d325;};'use strict';var _=require(_0xd803('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd803('0x1'));var rs=require(_0xd803('0x2'));var fs=require('fs');var Redis=require(_0xd803('0x3'));var db=require(_0xd803('0x4'))['db'];var utils=require(_0xd803('0x5'));var logger=require(_0xd803('0x6'))(_0xd803('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd803('0x8')]['http']({'port':0x232a});config[_0xd803('0x9')]=_[_0xd803('0xa')](config[_0xd803('0x9')],{'host':_0xd803('0xb'),'port':0x18eb});var socket=require(_0xd803('0xc'))(new Redis(config[_0xd803('0x9')]));require('./chatInternalMessage.socket')[_0xd803('0xd')](socket);function respondWithRpcPromise(_0xc5f35f,_0x306ff5,_0x47dcf1){return new BPromise(function(_0x51efe4,_0x4ffc2c){return client[_0xd803('0xe')](_0xc5f35f,_0x47dcf1)[_0xd803('0xf')](function(_0x4cb7f8){logger[_0xd803('0x10')](_0xd803('0x11'),_0x306ff5,_0xd803('0x12'));logger[_0xd803('0x13')](_0xd803('0x14'),_0x306ff5,_0xd803('0x12'),JSON[_0xd803('0x15')](_0x4cb7f8));if(_0x4cb7f8[_0xd803('0x16')]){if(_0x4cb7f8[_0xd803('0x16')][_0xd803('0x17')]===0x1f4){logger['error'](_0xd803('0x11'),_0x306ff5,_0x4cb7f8[_0xd803('0x16')][_0xd803('0x18')]);return _0x4ffc2c(_0x4cb7f8[_0xd803('0x16')][_0xd803('0x18')]);}logger['error'](_0xd803('0x11'),_0x306ff5,_0x4cb7f8[_0xd803('0x16')][_0xd803('0x18')]);return _0x51efe4(_0x4cb7f8['error'][_0xd803('0x18')]);}else{logger['info'](_0xd803('0x11'),_0x306ff5,'request\x20sent');_0x51efe4(_0x4cb7f8[_0xd803('0x19')][_0xd803('0x18')]);}})[_0xd803('0x1a')](function(_0x218ec0){logger['error'](_0xd803('0x11'),_0x306ff5,_0x218ec0);_0x4ffc2c(_0x218ec0);});});} \ No newline at end of file +var _0x2ea9=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x345a5b,_0x2e883f){var _0x256180=function(_0x674a46){while(--_0x674a46){_0x345a5b['push'](_0x345a5b['shift']());}};_0x256180(++_0x2e883f);}(_0x2ea9,0x110));var _0x92ea=function(_0x118230,_0x4cbc09){_0x118230=_0x118230-0x0;var _0x24e95d=_0x2ea9[_0x118230];return _0x24e95d;};'use strict';var _=require(_0x92ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x92ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92ea('0x2'));var db=require(_0x92ea('0x3'))['db'];var utils=require(_0x92ea('0x4'));var logger=require(_0x92ea('0x5'))(_0x92ea('0x6'));var config=require(_0x92ea('0x7'));var jayson=require(_0x92ea('0x8'));var client=jayson[_0x92ea('0x9')][_0x92ea('0xa')]({'port':0x232a});config[_0x92ea('0xb')]=_['defaults'](config[_0x92ea('0xb')],{'host':_0x92ea('0xc'),'port':0x18eb});var socket=require(_0x92ea('0xd'))(new Redis(config[_0x92ea('0xb')]));require(_0x92ea('0xe'))[_0x92ea('0xf')](socket);function respondWithRpcPromise(_0x16ee34,_0x3ca10f,_0x480bc0){return new BPromise(function(_0x3c6b9b,_0x4e9e79){return client[_0x92ea('0x10')](_0x16ee34,_0x480bc0)[_0x92ea('0x11')](function(_0x1347b1){logger[_0x92ea('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ca10f,_0x92ea('0x13'));logger[_0x92ea('0x14')](_0x92ea('0x15'),_0x3ca10f,_0x92ea('0x13'),JSON[_0x92ea('0x16')](_0x1347b1));if(_0x1347b1[_0x92ea('0x17')]){if(_0x1347b1[_0x92ea('0x17')][_0x92ea('0x18')]===0x1f4){logger[_0x92ea('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ca10f,_0x1347b1[_0x92ea('0x17')][_0x92ea('0x19')]);return _0x4e9e79(_0x1347b1['error'][_0x92ea('0x19')]);}logger[_0x92ea('0x17')](_0x92ea('0x1a'),_0x3ca10f,_0x1347b1[_0x92ea('0x17')][_0x92ea('0x19')]);return _0x3c6b9b(_0x1347b1['error'][_0x92ea('0x19')]);}else{logger[_0x92ea('0x12')](_0x92ea('0x1a'),_0x3ca10f,_0x92ea('0x13'));_0x3c6b9b(_0x1347b1['result'][_0x92ea('0x19')]);}})[_0x92ea('0x1b')](function(_0x14b34a){logger[_0x92ea('0x17')](_0x92ea('0x1a'),_0x3ca10f,_0x14b34a);_0x4e9e79(_0x14b34a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 647d901..00c5914 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 _0x2621=['register','length','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x5e292e,_0x5beade){var _0x39896f=function(_0x4f6692){while(--_0x4f6692){_0x5e292e['push'](_0x5e292e['shift']());}};_0x39896f(++_0x5beade);}(_0x2621,0x1d2));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require(_0x1262('0x0'));var events=[_0x1262('0x1'),_0x1262('0x2'),_0x1262('0x3')];function createListener(_0x1e5b47,_0x44878a){return function(_0x2dfe65){_0x44878a[_0x1262('0x4')](_0x1e5b47,_0x2dfe65);};}function removeListener(_0x192339,_0x3a6d7f){return function(){ChatInternalMessageEvents[_0x1262('0x5')](_0x192339,_0x3a6d7f);};}exports[_0x1262('0x6')]=function(_0x421716){for(var _0x16075c=0x0,_0x4d4535=events[_0x1262('0x7')];_0x16075c<_0x4d4535;_0x16075c++){var _0x52af34=events[_0x16075c];var _0xaa3c86=createListener('chatInternalMessage:'+_0x52af34,_0x421716);ChatInternalMessageEvents['on'](_0x52af34,_0xaa3c86);}}; \ No newline at end of file +var _0x097c=['save','remove','emit','register','./chatInternalMessage.events'];(function(_0x3d3179,_0x30e686){var _0x14ae96=function(_0x4c58dc){while(--_0x4c58dc){_0x3d3179['push'](_0x3d3179['shift']());}};_0x14ae96(++_0x30e686);}(_0x097c,0x1d5));var _0xc097=function(_0x4cfe67,_0x9483f7){_0x4cfe67=_0x4cfe67-0x0;var _0x28d26d=_0x097c[_0x4cfe67];return _0x28d26d;};'use strict';var ChatInternalMessageEvents=require(_0xc097('0x0'));var events=[_0xc097('0x1'),_0xc097('0x2'),'update'];function createListener(_0x1eb862,_0x5b478f){return function(_0x23e66a){_0x5b478f[_0xc097('0x3')](_0x1eb862,_0x23e66a);};}function removeListener(_0x5aa3c1,_0x265284){return function(){ChatInternalMessageEvents['removeListener'](_0x5aa3c1,_0x265284);};}exports[_0xc097('0x4')]=function(_0x3c9603){for(var _0x31bc9a=0x0,_0x32493e=events['length'];_0x31bc9a<_0x32493e;_0x31bc9a++){var _0x3f67a4=events[_0x31bc9a];var _0x4d95d9=createListener('chatInternalMessage:'+_0x3f67a4,_0x3c9603);ChatInternalMessageEvents['on'](_0x3f67a4,_0x4d95d9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3030e9d..5490aa8 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x55c7ca,_0x139d8f){var _0x2b8417=function(_0xa4774f){while(--_0xa4774f){_0x55c7ca['push'](_0x55c7ca['shift']());}};_0x2b8417(++_0x139d8f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x344ae7,_0x5b6188){var _0xf111a6=function(_0x1baa18){while(--_0x1baa18){_0x344ae7['push'](_0x344ae7['shift']());}};_0xf111a6(++_0x5b6188);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 79076d3..c10ccc1 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 _0x588f=['DATE','exports','medium','BOOLEAN'];(function(_0x3947bc,_0x3a4060){var _0x349b2c=function(_0x24d5e0){while(--_0x24d5e0){_0x3947bc['push'](_0x3947bc['shift']());}};_0x349b2c(++_0x3a4060);}(_0x588f,0x14d));var _0xf588=function(_0x5ccf30,_0x2a3e67){_0x5ccf30=_0x5ccf30-0x0;var _0x1d3f0c=_0x588f[_0x5ccf30];return _0x1d3f0c;};'use strict';var Sequelize=require('sequelize');module[_0xf588('0x0')]={'body':{'type':Sequelize['TEXT'](_0xf588('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xf588('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf588('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf588('0x3')]}}; \ No newline at end of file +var _0xddd1=['out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x24c2da,_0x8d4f7f){var _0x1ef32b=function(_0x812f6c){while(--_0x812f6c){_0x24c2da['push'](_0x24c2da['shift']());}};_0x1ef32b(++_0x8d4f7f);}(_0xddd1,0xc1));var _0x1ddd=function(_0x3d8607,_0xac45ee){_0x3d8607=_0x3d8607-0x0;var _0x5d0d3b=_0xddd1[_0x3d8607];return _0x5d0d3b;};'use strict';var Sequelize=require(_0x1ddd('0x0'));module[_0x1ddd('0x1')]={'body':{'type':Sequelize[_0x1ddd('0x2')](_0x1ddd('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1ddd('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1ddd('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x1ddd('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 31dad5b..c607b00 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 _0xd1b2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','ChatMessage,\x20%s,\x20%s','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xd1b2,0x6c));var _0x2d1b=function(_0x391ef5,_0x8cfaad){_0x391ef5=_0x391ef5-0x0;var _0x4b9faf=_0xd1b2[_0x391ef5];return _0x4b9faf;};'use strict';var pdf=require(_0x2d1b('0x0'));var emlformat=require(_0x2d1b('0x1'));var rimraf=require(_0x2d1b('0x2'));var zipdir=require(_0x2d1b('0x3'));var jsonpatch=require(_0x2d1b('0x4'));var rp=require(_0x2d1b('0x5'));var moment=require('moment');var BPromise=require(_0x2d1b('0x6'));var Mustache=require(_0x2d1b('0x7'));var util=require(_0x2d1b('0x8'));var path=require(_0x2d1b('0x9'));var sox=require(_0x2d1b('0xa'));var csv=require('to-csv');var ejs=require(_0x2d1b('0xb'));var fs=require('fs');var _=require(_0x2d1b('0xc'));var squel=require('squel');var crypto=require(_0x2d1b('0xd'));var jsforce=require(_0x2d1b('0xe'));var deskjs=require(_0x2d1b('0xf'));var toCsv=require(_0x2d1b('0x10'));var querystring=require(_0x2d1b('0x11'));var Papa=require(_0x2d1b('0x12'));var Redis=require('ioredis');var authService=require(_0x2d1b('0x13'));var qs=require(_0x2d1b('0x14'));var as=require(_0x2d1b('0x15'));var hardwareService=require(_0x2d1b('0x16'));var logger=require(_0x2d1b('0x17'))(_0x2d1b('0x18'));var utils=require(_0x2d1b('0x19'));var config=require(_0x2d1b('0x1a'));var db=require(_0x2d1b('0x1b'))['db'];config[_0x2d1b('0x1c')]=_['defaults'](config[_0x2d1b('0x1c')],{'host':_0x2d1b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d1b('0x1c')]));require('./chatMessage.socket')[_0x2d1b('0x1e')](socket);var jayson=require(_0x2d1b('0x1f'));var client=jayson[_0x2d1b('0x20')][_0x2d1b('0x21')]({'port':0x232c});var client9002=jayson[_0x2d1b('0x20')][_0x2d1b('0x21')]({'port':0x232a});function checkPasswordPattern(_0x11f88c,_0x376cc8,_0x5b87a5){if(_0x5b87a5){var _0x490131=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x490131[_0x2d1b('0x22')](_0x376cc8)){return _0x11f88c;}else{throw new db[(_0x2d1b('0x23'))][(_0x2d1b('0x24'))](_0x2d1b('0x25'));}}else{return _0x11f88c;}}function respondWithRpcPromise(_0x2c9537,_0x116f75,_0x4d66ce,_0x21450d){return new BPromise(function(_0x575e83,_0x4344d2){var _0x4292c9=_0x21450d||client;return _0x4292c9[_0x2d1b('0x26')](_0x2c9537,_0x4d66ce)['then'](function(_0x4ebb64){logger[_0x2d1b('0x27')]('ChatMessage,\x20%s,\x20%s',_0x116f75,_0x2d1b('0x28'));logger['debug'](_0x2d1b('0x29'),_0x116f75,_0x2d1b('0x28'),JSON['stringify'](_0x4ebb64));if(_0x4ebb64[_0x2d1b('0x2a')]){if(_0x4ebb64[_0x2d1b('0x2a')][_0x2d1b('0x2b')]===0x1f4){logger[_0x2d1b('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x116f75,_0x4ebb64[_0x2d1b('0x2a')][_0x2d1b('0x2c')]);return _0x4344d2(_0x4ebb64[_0x2d1b('0x2a')][_0x2d1b('0x2c')]);}logger['error'](_0x2d1b('0x2d'),_0x116f75,_0x4ebb64[_0x2d1b('0x2a')][_0x2d1b('0x2c')]);return _0x575e83(_0x4ebb64['error'][_0x2d1b('0x2c')]);}else{logger[_0x2d1b('0x27')](_0x2d1b('0x2d'),_0x116f75,_0x2d1b('0x28'));_0x575e83(_0x4ebb64['result'][_0x2d1b('0x2c')]);}})['catch'](function(_0x5e26d5){logger[_0x2d1b('0x2a')](_0x2d1b('0x2d'),_0x116f75,_0x5e26d5);_0x4344d2(_0x5e26d5);});});}function respondWithStatusCode(_0x5980eb,_0x2550da){_0x2550da=_0x2550da||0xcc;return function(_0x2eb917){if(_0x2eb917){return _0x5980eb[_0x2d1b('0x2e')](_0x2550da);}return _0x5980eb[_0x2d1b('0x2f')](_0x2550da)[_0x2d1b('0x30')]();};}function respondWithResult(_0x4b6a10,_0x5bc8fb){_0x5bc8fb=_0x5bc8fb||0xc8;return function(_0xdf99a){if(_0xdf99a){return _0x4b6a10[_0x2d1b('0x2f')](_0x5bc8fb)[_0x2d1b('0x31')](_0xdf99a);}};}function respondWithFilteredResult(_0x483f08,_0x54306d){return function(_0x413ba4){if(_0x413ba4){var _0x12423c=_0x413ba4['count'],_0x43b5c1=_0x54306d[_0x2d1b('0x32')],_0x1be65c=_0x54306d[_0x2d1b('0x32')]+_0x54306d[_0x2d1b('0x33')],_0x1ca1bf;if(_0x1be65c>=_0x12423c){_0x1be65c=_0x12423c;_0x1ca1bf=0xc8;}else{_0x1ca1bf=0xce;}_0x483f08['status'](_0x1ca1bf);return _0x483f08['set'](_0x2d1b('0x34'),_0x43b5c1+'-'+_0x1be65c+'/'+_0x12423c)[_0x2d1b('0x31')](_0x413ba4);}return null;};}function patchUpdates(_0x50f1b6){return function(_0x5070ee){try{jsonpatch[_0x2d1b('0x35')](_0x5070ee,_0x50f1b6,!![]);}catch(_0x46c502){return BPromise[_0x2d1b('0x36')](_0x46c502);}return _0x5070ee[_0x2d1b('0x37')]();};}function saveUpdates(_0x3e6578,_0x46b14e){return function(_0x37ae8){if(_0x37ae8){return _0x37ae8[_0x2d1b('0x38')](_0x3e6578)[_0x2d1b('0x39')](function(_0x40b5fa){return _0x40b5fa;});}return null;};}function removeEntity(_0x1b07b2,_0x15332b){return function(_0x5c5391){if(_0x5c5391){return _0x5c5391['destroy']()[_0x2d1b('0x39')](function(){_0x1b07b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x439754,_0x291a44){return function(_0x7d42){if(!_0x7d42){_0x439754[_0x2d1b('0x2e')](0x194);}return _0x7d42;};}function handleError(_0x2b80b6,_0x3e1dea){_0x3e1dea=_0x3e1dea||0x1f4;return function(_0x4a3bad){logger['error'](_0x4a3bad[_0x2d1b('0x3a')]);if(_0x4a3bad[_0x2d1b('0x3b')]){delete _0x4a3bad[_0x2d1b('0x3b')];}_0x2b80b6[_0x2d1b('0x2f')](_0x3e1dea)[_0x2d1b('0x3c')](_0x4a3bad);};}exports[_0x2d1b('0x3d')]=function(_0x48f8b6,_0xb3f60){var _0x33fb2e={},_0xc1239e={},_0x50e08b={'count':0x0,'rows':[]};var _0x4a4fad=_[_0x2d1b('0x3e')](db[_0x2d1b('0x3f')]['rawAttributes'],function(_0x3ba0f2){return{'name':_0x3ba0f2[_0x2d1b('0x40')],'type':_0x3ba0f2[_0x2d1b('0x41')][_0x2d1b('0x42')]};});_0xc1239e[_0x2d1b('0x43')]=_[_0x2d1b('0x3e')](_0x4a4fad,_0x2d1b('0x3b'));_0xc1239e[_0x2d1b('0x44')]=_[_0x2d1b('0x45')](_0x48f8b6[_0x2d1b('0x44')]);_0xc1239e['filters']=_[_0x2d1b('0x46')](_0xc1239e[_0x2d1b('0x43')],_0xc1239e[_0x2d1b('0x44')]);_0x33fb2e[_0x2d1b('0x47')]=_['intersection'](_0xc1239e[_0x2d1b('0x43')],qs['fields'](_0x48f8b6['query'][_0x2d1b('0x48')]));_0x33fb2e[_0x2d1b('0x47')]=_0x33fb2e['attributes'][_0x2d1b('0x49')]?_0x33fb2e[_0x2d1b('0x47')]:_0xc1239e[_0x2d1b('0x43')];if(!_0x48f8b6['query'][_0x2d1b('0x4a')](_0x2d1b('0x4b'))){_0x33fb2e[_0x2d1b('0x33')]=qs[_0x2d1b('0x33')](_0x48f8b6['query'][_0x2d1b('0x33')]);_0x33fb2e[_0x2d1b('0x32')]=qs[_0x2d1b('0x32')](_0x48f8b6[_0x2d1b('0x44')][_0x2d1b('0x32')]);}_0x33fb2e[_0x2d1b('0x4c')]=qs[_0x2d1b('0x4d')](_0x48f8b6[_0x2d1b('0x44')][_0x2d1b('0x4d')]);_0x33fb2e['where']=qs['filters'](_[_0x2d1b('0x4e')](_0x48f8b6[_0x2d1b('0x44')],_0xc1239e[_0x2d1b('0x4f')]),_0x4a4fad);if(_0x48f8b6[_0x2d1b('0x44')][_0x2d1b('0x50')]){_0x33fb2e[_0x2d1b('0x51')]=_[_0x2d1b('0x52')](_0x33fb2e['where'],{'$or':_[_0x2d1b('0x3e')](_0x4a4fad,function(_0x2f297d){if(_0x2f297d[_0x2d1b('0x41')]!==_0x2d1b('0x53')){var _0x3b166e={};_0x3b166e[_0x2f297d['name']]={'$like':'%'+_0x48f8b6[_0x2d1b('0x44')][_0x2d1b('0x50')]+'%'};return _0x3b166e;}})});}_0x33fb2e=_['merge']({},_0x33fb2e,_0x48f8b6[_0x2d1b('0x54')]);var _0x1f9410={'where':_0x33fb2e[_0x2d1b('0x51')]};return db[_0x2d1b('0x3f')]['count'](_0x1f9410)[_0x2d1b('0x39')](function(_0x22538b){_0x50e08b[_0x2d1b('0x55')]=_0x22538b;if(_0x48f8b6[_0x2d1b('0x44')][_0x2d1b('0x56')]){_0x33fb2e[_0x2d1b('0x57')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x33fb2e);})['then'](function(_0x4c106d){_0x50e08b[_0x2d1b('0x58')]=_0x4c106d;return _0x50e08b;})['then'](respondWithFilteredResult(_0xb3f60,_0x33fb2e))[_0x2d1b('0x59')](handleError(_0xb3f60,null));};exports['show']=function(_0x12b137,_0x187d50){var _0xecb2fc={'raw':!![],'where':{'id':_0x12b137[_0x2d1b('0x5a')]['id']}},_0x596b2e={};_0x596b2e[_0x2d1b('0x43')]=_[_0x2d1b('0x45')](db[_0x2d1b('0x3f')]['rawAttributes']);_0x596b2e['query']=_[_0x2d1b('0x45')](_0x12b137['query']);_0x596b2e[_0x2d1b('0x4f')]=_['intersection'](_0x596b2e[_0x2d1b('0x43')],_0x596b2e[_0x2d1b('0x44')]);_0xecb2fc[_0x2d1b('0x47')]=_[_0x2d1b('0x46')](_0x596b2e['model'],qs[_0x2d1b('0x48')](_0x12b137[_0x2d1b('0x44')]['fields']));_0xecb2fc[_0x2d1b('0x47')]=_0xecb2fc[_0x2d1b('0x47')][_0x2d1b('0x49')]?_0xecb2fc[_0x2d1b('0x47')]:_0x596b2e[_0x2d1b('0x43')];if(_0x12b137[_0x2d1b('0x44')][_0x2d1b('0x56')]){_0xecb2fc[_0x2d1b('0x57')]=[{'all':!![]}];}_0xecb2fc=_[_0x2d1b('0x52')]({},_0xecb2fc,_0x12b137[_0x2d1b('0x54')]);return db[_0x2d1b('0x3f')][_0x2d1b('0x5b')](_0xecb2fc)['then'](handleEntityNotFound(_0x187d50,null))['then'](respondWithResult(_0x187d50,null))[_0x2d1b('0x59')](handleError(_0x187d50,null));};exports[_0x2d1b('0x5c')]=function(_0x11a277,_0x32854f){return db[_0x2d1b('0x3f')][_0x2d1b('0x5c')](_0x11a277[_0x2d1b('0x5d')],{})['then'](respondWithResult(_0x32854f,0xc9))[_0x2d1b('0x59')](handleError(_0x32854f,null));};exports[_0x2d1b('0x38')]=function(_0x42b311,_0x1563f5){if(_0x42b311[_0x2d1b('0x5d')]['id']){delete _0x42b311[_0x2d1b('0x5d')]['id'];}return db[_0x2d1b('0x3f')][_0x2d1b('0x5b')]({'where':{'id':_0x42b311[_0x2d1b('0x5a')]['id']}})[_0x2d1b('0x39')](handleEntityNotFound(_0x1563f5,null))['then'](saveUpdates(_0x42b311['body'],null))['then'](respondWithResult(_0x1563f5,null))[_0x2d1b('0x59')](handleError(_0x1563f5,null));};exports[_0x2d1b('0x5e')]=function(_0x4ab57c,_0x35f490){return db[_0x2d1b('0x3f')]['find']({'where':{'id':_0x4ab57c[_0x2d1b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x35f490,null))['then'](removeEntity(_0x35f490,null))[_0x2d1b('0x59')](handleError(_0x35f490,null));};exports[_0x2d1b('0x5f')]=function(_0x2a21cd,_0x3263d6){return db['ChatMessage'][_0x2d1b('0x5f')]()['then'](respondWithResult(_0x3263d6,null))[_0x2d1b('0x59')](handleError(_0x3263d6,null));};var interaction_log=require('../../config/logger')(_0x2d1b('0x60'));exports[_0x2d1b('0x61')]=function(_0x4305c8,_0x58bcf0,_0x320a6d){var _0x4fbe45={'channel':_0x2d1b('0x62')};if(_0x4305c8[_0x2d1b('0x5d')]['id']){delete _0x4305c8[_0x2d1b('0x5d')]['id'];}_0x4305c8[_0x2d1b('0x5d')][_0x2d1b('0x63')]=!![];_0x4305c8[_0x2d1b('0x5d')][_0x2d1b('0x64')]=moment()[_0x2d1b('0x65')](_0x2d1b('0x66'));_0x4305c8[_0x2d1b('0x5d')][_0x2d1b('0x67')]=_0x4305c8[_0x2d1b('0x5d')][_0x2d1b('0x67')]||_0x4305c8[_0x2d1b('0x68')]['id'];return db[_0x2d1b('0x3f')]['find']({'where':{'id':_0x4305c8['params']['id'],'UserId':null},'include':[{'model':db[_0x2d1b('0x69')],'as':_0x2d1b('0x6a')}]})[_0x2d1b('0x39')](handleEntityNotFound(_0x58bcf0,null))[_0x2d1b('0x39')](saveUpdates(_0x4305c8[_0x2d1b('0x5d')],null))[_0x2d1b('0x39')](function(_0x3743a3){if(_0x3743a3){_0x4fbe45[_0x2d1b('0x2c')]=_0x3743a3[_0x2d1b('0x6b')]({'plain':!![]});return db[_0x2d1b('0x6c')]['find']({'where':{'id':_0x3743a3[_0x2d1b('0x6d')]}});}return null;})[_0x2d1b('0x39')](handleEntityNotFound(_0x58bcf0,null))[_0x2d1b('0x39')](function(_0x19dd57){if(_0x19dd57){return _0x19dd57['update']({'UserId':_0x4305c8[_0x2d1b('0x5d')]['UserId'],'read1stAt':_[_0x2d1b('0x6e')](_0x19dd57['read1stAt'])?moment()['format'](_0x2d1b('0x66')):undefined});}return null;})['then'](function(_0x53a57c){if(_0x53a57c){_0x4fbe45[_0x2d1b('0x6f')]=_0x53a57c[_0x2d1b('0x6b')]({'plain':!![]});interaction_log[_0x2d1b('0x27')](_0x2d1b('0x70'),_0x4305c8[_0x2d1b('0x68')]['id'],_0x4305c8[_0x2d1b('0x68')][_0x2d1b('0x3b')],_0x4305c8[_0x2d1b('0x68')]['role'],_0x4fbe45[_0x2d1b('0x6f')]['id'],_0x4305c8['body']?JSON[_0x2d1b('0x71')](_0x4305c8[_0x2d1b('0x5d')]):'null');return respondWithRpcPromise('AcceptMessage',_0x2d1b('0x72'),_0x4fbe45);}return null;})[_0x2d1b('0x39')](function(_0x171287){if(_0x171287){if(_0x4305c8[_0x2d1b('0x5d')][_0x2d1b('0x73')]){_0x4fbe45['message'][_0x2d1b('0x74')]=util[_0x2d1b('0x65')](_0x2d1b('0x75'),_0x4305c8[_0x2d1b('0x68')][_0x2d1b('0x3b')]);_0x4fbe45['message'][_0x2d1b('0x76')]=_0x4fbe45[_0x2d1b('0x76')];_0x4fbe45[_0x2d1b('0x2c')][_0x2d1b('0x77')]=_0x2d1b('0x61');return respondWithRpcPromise(_0x2d1b('0x78'),_0x2d1b('0x78'),{'event':_0x2d1b('0x79'),'message':_['merge'](_0x4fbe45[_0x2d1b('0x2c')],JSON[_0x2d1b('0x7a')](_0x4fbe45[_0x2d1b('0x6f')]['formData']))},client9002)[_0x2d1b('0x39')](function(){return _0x4fbe45;});}return _0x4fbe45;}return null;})[_0x2d1b('0x39')](respondWithResult(_0x58bcf0,null))[_0x2d1b('0x59')](handleError(_0x58bcf0,null));};var interaction_log=require(_0x2d1b('0x17'))(_0x2d1b('0x60'));exports[_0x2d1b('0x36')]=function(_0x2f3b2d,_0x14347c,_0x4832bb){var _0xa1465a={'agent':{},'channel':'chat'};if(_0x2f3b2d[_0x2d1b('0x5d')]['id']){delete _0x2f3b2d[_0x2d1b('0x5d')]['id'];}_0x2f3b2d[_0x2d1b('0x5d')][_0x2d1b('0x67')]=_0x2f3b2d[_0x2d1b('0x5d')][_0x2d1b('0x67')]||_0x2f3b2d[_0x2d1b('0x68')]['id'];_0xa1465a[_0x2d1b('0x7b')]['id']=_0x2f3b2d[_0x2d1b('0x5d')][_0x2d1b('0x67')];return db[_0x2d1b('0x3f')][_0x2d1b('0x5b')]({'where':{'id':_0x2f3b2d[_0x2d1b('0x5a')]['id'],'UserId':null}})[_0x2d1b('0x39')](handleEntityNotFound(_0x14347c,null))[_0x2d1b('0x39')](function(_0x2d9742){if(_0x2d9742){_0xa1465a[_0x2d1b('0x2c')]=_0x2d9742[_0x2d1b('0x6b')]({'plain':!![]});return db[_0x2d1b('0x6c')][_0x2d1b('0x5b')]({'where':{'id':_0x2d9742[_0x2d1b('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x14347c,null))[_0x2d1b('0x39')](function(_0x20d99f){if(_0x20d99f){_0xa1465a['interaction']=_0x20d99f[_0x2d1b('0x6b')]({'plain':!![]});interaction_log[_0x2d1b('0x27')](_0x2d1b('0x7c'),_0x2f3b2d[_0x2d1b('0x68')]['id'],_0x2f3b2d[_0x2d1b('0x68')][_0x2d1b('0x3b')],_0x2f3b2d[_0x2d1b('0x68')][_0x2d1b('0x7d')],_0xa1465a[_0x2d1b('0x6f')]['id'],_0x2f3b2d['body']?JSON[_0x2d1b('0x71')](_0x2f3b2d[_0x2d1b('0x5d')]):_0x2d1b('0x7e'));return respondWithRpcPromise('RejectMessage',_0x2d1b('0x7f'),_0xa1465a);}return null;})[_0x2d1b('0x39')](function(_0x1fa8a5){if(_0x1fa8a5){_0x1fa8a5[_0x2d1b('0x2c')][_0x2d1b('0x74')]=util['format']('SIP/%s',_0x2f3b2d['user'][_0x2d1b('0x3b')]);_0x1fa8a5['message'][_0x2d1b('0x76')]=_0xa1465a[_0x2d1b('0x76')];_0x1fa8a5[_0x2d1b('0x2c')]['event']=_0x2d1b('0x36');respondWithRpcPromise(_0x2d1b('0x78'),_0x2d1b('0x78'),{'event':_0x2d1b('0x80'),'message':_0x1fa8a5['message']},client9002);return _0xa1465a;}return null;})[_0x2d1b('0x39')](respondWithResult(_0x14347c,null))[_0x2d1b('0x59')](handleError(_0x14347c,null));}; \ No newline at end of file +var _0x1291=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','intersection','find','create','body','params','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','agent','rejectmessage','html-pdf'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x1291,0x7c));var _0x1129=function(_0x208271,_0x2060c3){_0x208271=_0x208271-0x0;var _0x3c831f=_0x1291[_0x208271];return _0x3c831f;};'use strict';var pdf=require(_0x1129('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1129('0x1'));var zipdir=require(_0x1129('0x2'));var jsonpatch=require(_0x1129('0x3'));var rp=require(_0x1129('0x4'));var moment=require('moment');var BPromise=require(_0x1129('0x5'));var Mustache=require(_0x1129('0x6'));var util=require(_0x1129('0x7'));var path=require(_0x1129('0x8'));var sox=require('sox');var csv=require(_0x1129('0x9'));var ejs=require(_0x1129('0xa'));var fs=require('fs');var _=require(_0x1129('0xb'));var squel=require(_0x1129('0xc'));var crypto=require(_0x1129('0xd'));var jsforce=require(_0x1129('0xe'));var deskjs=require(_0x1129('0xf'));var toCsv=require(_0x1129('0x9'));var querystring=require(_0x1129('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1129('0x11'));var qs=require(_0x1129('0x12'));var as=require(_0x1129('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1129('0x14'))(_0x1129('0x15'));var utils=require(_0x1129('0x16'));var config=require(_0x1129('0x17'));var db=require(_0x1129('0x18'))['db'];config[_0x1129('0x19')]=_[_0x1129('0x1a')](config[_0x1129('0x19')],{'host':_0x1129('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1129('0x19')]));require(_0x1129('0x1c'))[_0x1129('0x1d')](socket);var jayson=require(_0x1129('0x1e'));var client=jayson[_0x1129('0x1f')][_0x1129('0x20')]({'port':0x232c});var client9002=jayson[_0x1129('0x1f')][_0x1129('0x20')]({'port':0x232a});function checkPasswordPattern(_0x8d241,_0xa7414d,_0x5eeeba){if(_0x5eeeba){var _0x5b2203=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b2203[_0x1129('0x21')](_0xa7414d)){return _0x8d241;}else{throw new db[(_0x1129('0x22'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x8d241;}}function respondWithRpcPromise(_0xc8f30e,_0x1c2368,_0x3f3172,_0x2d7fb2){return new BPromise(function(_0x1139b9,_0x5639ce){var _0x38b043=_0x2d7fb2||client;return _0x38b043[_0x1129('0x23')](_0xc8f30e,_0x3f3172)[_0x1129('0x24')](function(_0x5a59e5){logger[_0x1129('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1c2368,_0x1129('0x26'));logger[_0x1129('0x27')](_0x1129('0x28'),_0x1c2368,_0x1129('0x26'),JSON['stringify'](_0x5a59e5));if(_0x5a59e5['error']){if(_0x5a59e5[_0x1129('0x29')][_0x1129('0x2a')]===0x1f4){logger[_0x1129('0x29')](_0x1129('0x2b'),_0x1c2368,_0x5a59e5[_0x1129('0x29')][_0x1129('0x2c')]);return _0x5639ce(_0x5a59e5[_0x1129('0x29')]['message']);}logger[_0x1129('0x29')](_0x1129('0x2b'),_0x1c2368,_0x5a59e5[_0x1129('0x29')][_0x1129('0x2c')]);return _0x1139b9(_0x5a59e5[_0x1129('0x29')]['message']);}else{logger[_0x1129('0x25')](_0x1129('0x2b'),_0x1c2368,_0x1129('0x26'));_0x1139b9(_0x5a59e5[_0x1129('0x2d')][_0x1129('0x2c')]);}})[_0x1129('0x2e')](function(_0xe533eb){logger[_0x1129('0x29')]('ChatMessage,\x20%s,\x20%s',_0x1c2368,_0xe533eb);_0x5639ce(_0xe533eb);});});}function respondWithStatusCode(_0x4474f7,_0x2442ad){_0x2442ad=_0x2442ad||0xcc;return function(_0x6d587f){if(_0x6d587f){return _0x4474f7[_0x1129('0x2f')](_0x2442ad);}return _0x4474f7[_0x1129('0x30')](_0x2442ad)[_0x1129('0x31')]();};}function respondWithResult(_0x494119,_0x2a5508){_0x2a5508=_0x2a5508||0xc8;return function(_0x528a37){if(_0x528a37){return _0x494119['status'](_0x2a5508)['json'](_0x528a37);}};}function respondWithFilteredResult(_0x152236,_0x19e05f){return function(_0x1240bf){if(_0x1240bf){var _0x1f1200=_0x1240bf['count'],_0x29f215=_0x19e05f[_0x1129('0x32')],_0x3972c8=_0x19e05f[_0x1129('0x32')]+_0x19e05f['limit'],_0x2a4403;if(_0x3972c8>=_0x1f1200){_0x3972c8=_0x1f1200;_0x2a4403=0xc8;}else{_0x2a4403=0xce;}_0x152236[_0x1129('0x30')](_0x2a4403);return _0x152236[_0x1129('0x33')](_0x1129('0x34'),_0x29f215+'-'+_0x3972c8+'/'+_0x1f1200)[_0x1129('0x35')](_0x1240bf);}return null;};}function patchUpdates(_0x3e735f){return function(_0x1e252e){try{jsonpatch[_0x1129('0x36')](_0x1e252e,_0x3e735f,!![]);}catch(_0xf08996){return BPromise[_0x1129('0x37')](_0xf08996);}return _0x1e252e[_0x1129('0x38')]();};}function saveUpdates(_0x1d9e17,_0x463db2){return function(_0x28c711){if(_0x28c711){return _0x28c711[_0x1129('0x39')](_0x1d9e17)[_0x1129('0x24')](function(_0x3e11c6){return _0x3e11c6;});}return null;};}function removeEntity(_0x4087f3,_0x320260){return function(_0x15e160){if(_0x15e160){return _0x15e160[_0x1129('0x3a')]()['then'](function(){_0x4087f3[_0x1129('0x30')](0xcc)[_0x1129('0x31')]();});}};}function handleEntityNotFound(_0x256136,_0x30869b){return function(_0x801813){if(!_0x801813){_0x256136[_0x1129('0x2f')](0x194);}return _0x801813;};}function handleError(_0x3f64fc,_0x3f57bb){_0x3f57bb=_0x3f57bb||0x1f4;return function(_0x5650ab){logger['error'](_0x5650ab[_0x1129('0x3b')]);if(_0x5650ab[_0x1129('0x3c')]){delete _0x5650ab[_0x1129('0x3c')];}_0x3f64fc[_0x1129('0x30')](_0x3f57bb)['send'](_0x5650ab);};}exports[_0x1129('0x3d')]=function(_0x1429a0,_0x3c7fb0){var _0x2a3dad={},_0x1873b3={},_0x1540f1={'count':0x0,'rows':[]};var _0x1215b2=_[_0x1129('0x3e')](db[_0x1129('0x3f')][_0x1129('0x40')],function(_0xa79c63){return{'name':_0xa79c63[_0x1129('0x41')],'type':_0xa79c63[_0x1129('0x42')][_0x1129('0x43')]};});_0x1873b3[_0x1129('0x44')]=_[_0x1129('0x3e')](_0x1215b2,_0x1129('0x3c'));_0x1873b3[_0x1129('0x45')]=_[_0x1129('0x46')](_0x1429a0[_0x1129('0x45')]);_0x1873b3[_0x1129('0x47')]=_['intersection'](_0x1873b3[_0x1129('0x44')],_0x1873b3[_0x1129('0x45')]);_0x2a3dad[_0x1129('0x48')]=_['intersection'](_0x1873b3['model'],qs[_0x1129('0x49')](_0x1429a0['query'][_0x1129('0x49')]));_0x2a3dad[_0x1129('0x48')]=_0x2a3dad['attributes']['length']?_0x2a3dad[_0x1129('0x48')]:_0x1873b3[_0x1129('0x44')];if(!_0x1429a0[_0x1129('0x45')][_0x1129('0x4a')]('nolimit')){_0x2a3dad[_0x1129('0x4b')]=qs[_0x1129('0x4b')](_0x1429a0[_0x1129('0x45')]['limit']);_0x2a3dad[_0x1129('0x32')]=qs['offset'](_0x1429a0[_0x1129('0x45')]['offset']);}_0x2a3dad['order']=qs[_0x1129('0x4c')](_0x1429a0[_0x1129('0x45')][_0x1129('0x4c')]);_0x2a3dad[_0x1129('0x4d')]=qs[_0x1129('0x47')](_[_0x1129('0x4e')](_0x1429a0[_0x1129('0x45')],_0x1873b3[_0x1129('0x47')]),_0x1215b2);if(_0x1429a0['query'][_0x1129('0x4f')]){_0x2a3dad[_0x1129('0x4d')]=_['merge'](_0x2a3dad['where'],{'$or':_[_0x1129('0x3e')](_0x1215b2,function(_0x677505){if(_0x677505['type']!==_0x1129('0x50')){var _0x5a27c6={};_0x5a27c6[_0x677505[_0x1129('0x3c')]]={'$like':'%'+_0x1429a0[_0x1129('0x45')][_0x1129('0x4f')]+'%'};return _0x5a27c6;}})});}_0x2a3dad=_[_0x1129('0x51')]({},_0x2a3dad,_0x1429a0[_0x1129('0x52')]);var _0x4a3109={'where':_0x2a3dad['where']};return db['ChatMessage'][_0x1129('0x53')](_0x4a3109)[_0x1129('0x24')](function(_0x2aa330){_0x1540f1[_0x1129('0x53')]=_0x2aa330;if(_0x1429a0[_0x1129('0x45')][_0x1129('0x54')]){_0x2a3dad[_0x1129('0x55')]=[{'all':!![]}];}return db[_0x1129('0x3f')][_0x1129('0x56')](_0x2a3dad);})[_0x1129('0x24')](function(_0x27b088){_0x1540f1[_0x1129('0x57')]=_0x27b088;return _0x1540f1;})[_0x1129('0x24')](respondWithFilteredResult(_0x3c7fb0,_0x2a3dad))['catch'](handleError(_0x3c7fb0,null));};exports[_0x1129('0x58')]=function(_0x333bbe,_0x291d16){var _0x65cd85={'raw':!![],'where':{'id':_0x333bbe['params']['id']}},_0x56659d={};_0x56659d[_0x1129('0x44')]=_[_0x1129('0x46')](db[_0x1129('0x3f')][_0x1129('0x40')]);_0x56659d[_0x1129('0x45')]=_[_0x1129('0x46')](_0x333bbe[_0x1129('0x45')]);_0x56659d[_0x1129('0x47')]=_[_0x1129('0x59')](_0x56659d[_0x1129('0x44')],_0x56659d['query']);_0x65cd85[_0x1129('0x48')]=_['intersection'](_0x56659d[_0x1129('0x44')],qs[_0x1129('0x49')](_0x333bbe['query'][_0x1129('0x49')]));_0x65cd85[_0x1129('0x48')]=_0x65cd85['attributes']['length']?_0x65cd85[_0x1129('0x48')]:_0x56659d['model'];if(_0x333bbe[_0x1129('0x45')][_0x1129('0x54')]){_0x65cd85[_0x1129('0x55')]=[{'all':!![]}];}_0x65cd85=_['merge']({},_0x65cd85,_0x333bbe[_0x1129('0x52')]);return db['ChatMessage'][_0x1129('0x5a')](_0x65cd85)['then'](handleEntityNotFound(_0x291d16,null))[_0x1129('0x24')](respondWithResult(_0x291d16,null))[_0x1129('0x2e')](handleError(_0x291d16,null));};exports[_0x1129('0x5b')]=function(_0x41472d,_0x9be90b){return db[_0x1129('0x3f')][_0x1129('0x5b')](_0x41472d[_0x1129('0x5c')],{})['then'](respondWithResult(_0x9be90b,0xc9))[_0x1129('0x2e')](handleError(_0x9be90b,null));};exports['update']=function(_0x420cba,_0x284da4){if(_0x420cba['body']['id']){delete _0x420cba[_0x1129('0x5c')]['id'];}return db[_0x1129('0x3f')]['find']({'where':{'id':_0x420cba[_0x1129('0x5d')]['id']}})['then'](handleEntityNotFound(_0x284da4,null))[_0x1129('0x24')](saveUpdates(_0x420cba[_0x1129('0x5c')],null))[_0x1129('0x24')](respondWithResult(_0x284da4,null))[_0x1129('0x2e')](handleError(_0x284da4,null));};exports[_0x1129('0x3a')]=function(_0x4f1bda,_0x290b23){return db[_0x1129('0x3f')][_0x1129('0x5a')]({'where':{'id':_0x4f1bda['params']['id']}})[_0x1129('0x24')](handleEntityNotFound(_0x290b23,null))[_0x1129('0x24')](removeEntity(_0x290b23,null))[_0x1129('0x2e')](handleError(_0x290b23,null));};exports['describe']=function(_0x537816,_0x16723e){return db[_0x1129('0x3f')]['describe']()[_0x1129('0x24')](respondWithResult(_0x16723e,null))[_0x1129('0x2e')](handleError(_0x16723e,null));};var interaction_log=require(_0x1129('0x14'))('chat-interactions');exports[_0x1129('0x5e')]=function(_0x261945,_0x43a17c,_0x58c97c){var _0x503046={'channel':_0x1129('0x5f')};if(_0x261945[_0x1129('0x5c')]['id']){delete _0x261945['body']['id'];}_0x261945[_0x1129('0x5c')]['read']=!![];_0x261945[_0x1129('0x5c')][_0x1129('0x60')]=moment()['format'](_0x1129('0x61'));_0x261945[_0x1129('0x5c')][_0x1129('0x62')]=_0x261945[_0x1129('0x5c')]['UserId']||_0x261945['user']['id'];return db[_0x1129('0x3f')][_0x1129('0x5a')]({'where':{'id':_0x261945[_0x1129('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0x1129('0x63')],'as':_0x1129('0x64')}]})[_0x1129('0x24')](handleEntityNotFound(_0x43a17c,null))[_0x1129('0x24')](saveUpdates(_0x261945[_0x1129('0x5c')],null))['then'](function(_0x324d55){if(_0x324d55){_0x503046['message']=_0x324d55[_0x1129('0x65')]({'plain':!![]});return db[_0x1129('0x66')][_0x1129('0x5a')]({'where':{'id':_0x324d55[_0x1129('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x43a17c,null))[_0x1129('0x24')](function(_0x37ca63){if(_0x37ca63){return _0x37ca63[_0x1129('0x39')]({'UserId':_0x261945[_0x1129('0x5c')][_0x1129('0x62')],'read1stAt':_[_0x1129('0x68')](_0x37ca63[_0x1129('0x69')])?moment()[_0x1129('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1129('0x24')](function(_0x44bb8b){if(_0x44bb8b){_0x503046[_0x1129('0x6b')]=_0x44bb8b[_0x1129('0x65')]({'plain':!![]});interaction_log[_0x1129('0x25')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x261945[_0x1129('0x6c')]['id'],_0x261945[_0x1129('0x6c')][_0x1129('0x3c')],_0x261945[_0x1129('0x6c')][_0x1129('0x6d')],_0x503046[_0x1129('0x6b')]['id'],_0x261945['body']?JSON[_0x1129('0x6e')](_0x261945['body']):_0x1129('0x6f'));return respondWithRpcPromise(_0x1129('0x70'),_0x1129('0x71'),_0x503046);}return null;})[_0x1129('0x24')](function(_0x70a7d4){if(_0x70a7d4){if(_0x261945[_0x1129('0x5c')]['manual']){_0x503046[_0x1129('0x2c')][_0x1129('0x72')]=util['format'](_0x1129('0x73'),_0x261945[_0x1129('0x6c')]['name']);_0x503046[_0x1129('0x2c')][_0x1129('0x74')]=_0x503046[_0x1129('0x74')];_0x503046[_0x1129('0x2c')][_0x1129('0x75')]='accept';return respondWithRpcPromise(_0x1129('0x76'),_0x1129('0x76'),{'event':_0x1129('0x77'),'message':_[_0x1129('0x51')](_0x503046[_0x1129('0x2c')],JSON[_0x1129('0x78')](_0x503046['interaction'][_0x1129('0x79')]))},client9002)[_0x1129('0x24')](function(){return _0x503046;});}return _0x503046;}return null;})[_0x1129('0x24')](respondWithResult(_0x43a17c,null))[_0x1129('0x2e')](handleError(_0x43a17c,null));};var interaction_log=require('../../config/logger')(_0x1129('0x7a'));exports[_0x1129('0x37')]=function(_0xb038e9,_0x126fe2,_0x5ad002){var _0x532659={'agent':{},'channel':_0x1129('0x5f')};if(_0xb038e9[_0x1129('0x5c')]['id']){delete _0xb038e9[_0x1129('0x5c')]['id'];}_0xb038e9[_0x1129('0x5c')]['UserId']=_0xb038e9[_0x1129('0x5c')][_0x1129('0x62')]||_0xb038e9[_0x1129('0x6c')]['id'];_0x532659[_0x1129('0x7b')]['id']=_0xb038e9['body'][_0x1129('0x62')];return db[_0x1129('0x3f')][_0x1129('0x5a')]({'where':{'id':_0xb038e9[_0x1129('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x126fe2,null))[_0x1129('0x24')](function(_0x508ffe){if(_0x508ffe){_0x532659[_0x1129('0x2c')]=_0x508ffe[_0x1129('0x65')]({'plain':!![]});return db[_0x1129('0x66')][_0x1129('0x5a')]({'where':{'id':_0x508ffe[_0x1129('0x67')]}});}return null;})[_0x1129('0x24')](handleEntityNotFound(_0x126fe2,null))[_0x1129('0x24')](function(_0x1f357a){if(_0x1f357a){_0x532659['interaction']=_0x1f357a[_0x1129('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb038e9[_0x1129('0x6c')]['id'],_0xb038e9['user'][_0x1129('0x3c')],_0xb038e9[_0x1129('0x6c')][_0x1129('0x6d')],_0x532659[_0x1129('0x6b')]['id'],_0xb038e9[_0x1129('0x5c')]?JSON['stringify'](_0xb038e9[_0x1129('0x5c')]):_0x1129('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x532659);}return null;})[_0x1129('0x24')](function(_0x5c117d){if(_0x5c117d){_0x5c117d[_0x1129('0x2c')]['interface']=util['format']('SIP/%s',_0xb038e9[_0x1129('0x6c')][_0x1129('0x3c')]);_0x5c117d[_0x1129('0x2c')][_0x1129('0x74')]=_0x532659[_0x1129('0x74')];_0x5c117d[_0x1129('0x2c')]['event']=_0x1129('0x37');respondWithRpcPromise(_0x1129('0x76'),_0x1129('0x76'),{'event':_0x1129('0x7c'),'message':_0x5c117d[_0x1129('0x2c')]},client9002);return _0x532659;}return null;})[_0x1129('0x24')](respondWithResult(_0x126fe2,null))[_0x1129('0x2e')](handleError(_0x126fe2,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5c18886..1eca5d0 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 _0x53e8=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d98b4,_0x297e31){var _0x403358=function(_0x388760){while(--_0x388760){_0x1d98b4['push'](_0x1d98b4['shift']());}};_0x403358(++_0x297e31);}(_0x53e8,0x10f));var _0x853e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x53e8[_0x341e0f];return _0x59555a;};'use strict';var EventEmitter=require(_0x853e('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x853e('0x1')](0x0);var events={'afterCreate':_0x853e('0x2'),'afterUpdate':_0x853e('0x3'),'afterDestroy':_0x853e('0x4')};function emitEvent(_0x256f22){return function(_0x58d155,_0x134f17,_0x4e236d){ChatMessageEvents[_0x853e('0x5')](_0x256f22+':'+_0x58d155['id'],_0x58d155);ChatMessageEvents[_0x853e('0x5')](_0x256f22,_0x58d155);_0x4e236d(null);};}for(var e in events){if(events[_0x853e('0x6')](e)){var event=events[e];ChatMessage[_0x853e('0x7')](e,emitEvent(event));}}module[_0x853e('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xe956=['hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit'];(function(_0x206a78,_0x14ec75){var _0x10c1b7=function(_0x50cbaf){while(--_0x50cbaf){_0x206a78['push'](_0x206a78['shift']());}};_0x10c1b7(++_0x14ec75);}(_0xe956,0xc9));var _0x6e95=function(_0x3dd1ca,_0x664799){_0x3dd1ca=_0x3dd1ca-0x0;var _0x229cec=_0xe956[_0x3dd1ca];return _0x229cec;};'use strict';var EventEmitter=require(_0x6e95('0x0'));var ChatMessage=require(_0x6e95('0x1'))['db'][_0x6e95('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6e95('0x3')](0x0);var events={'afterCreate':_0x6e95('0x4'),'afterUpdate':_0x6e95('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1d6fd7){return function(_0x530a1c,_0x40cf7b,_0x12ca37){ChatMessageEvents[_0x6e95('0x6')](_0x1d6fd7+':'+_0x530a1c['id'],_0x530a1c);ChatMessageEvents[_0x6e95('0x6')](_0x1d6fd7,_0x530a1c);_0x12ca37(null);};}for(var e in events){if(events[_0x6e95('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 01a9a56..f08abca 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 _0x0992=['direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','models','get'];(function(_0x458bd0,_0x5f54ad){var _0x1f5916=function(_0xc412ff){while(--_0xc412ff){_0x458bd0['push'](_0x458bd0['shift']());}};_0x1f5916(++_0x5f54ad);}(_0x0992,0xe0));var _0x2099=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x0992[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x2099('0x0'));var util=require(_0x2099('0x1'));var logger=require(_0x2099('0x2'))(_0x2099('0x3'));var moment=require(_0x2099('0x4'));var BPromise=require(_0x2099('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2099('0x6'));var rimraf=require(_0x2099('0x7'));var config=require(_0x2099('0x8'));var attributes=require(_0x2099('0x9'));module['exports']=function(_0x383c75,_0x22df2f){return _0x383c75[_0x2099('0xa')]('ChatMessage',attributes,{'tableName':_0x2099('0xb'),'paranoid':![],'indexes':[{'name':_0x2099('0xc'),'fields':[_0x2099('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8441c0,_0x5bef89,_0x3dd561){var _0x30c3da=_0x383c75[_0x2099('0xe')];var _0x1439d7=_0x8441c0[_0x2099('0xf')]({'plain':!![]});if(_0x1439d7[_0x2099('0x10')]['toLowerCase']()==='in'||_0x1439d7['direction'][_0x2099('0x11')]()===_0x2099('0x12')&&!_0x1439d7[_0x2099('0x13')]&&!_['isNil'](_0x1439d7[_0x2099('0x14')])){_0x30c3da[_0x2099('0x15')][_0x2099('0x16')]({'where':{'id':_0x1439d7['ChatInteractionId']}})[_0x2099('0x17')](function(_0x543312){if(_0x543312){_0x543312[_0x2099('0x18')]({'lastMsgAt':_0x1439d7[_0x2099('0x19')],'lastMsgDirection':_0x1439d7[_0x2099('0x10')][_0x2099('0x11')]()});}})[_0x2099('0x1a')](function(_0x1ac657){console[_0x2099('0x1b')](_0x1ac657);});}_0x3dd561();}},'charset':_0x2099('0x1c'),'collate':_0x2099('0x1d')});}; \ No newline at end of file +var _0x4552=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x4552,0x1bc));var _0x2455=function(_0x361a39,_0x425da9){_0x361a39=_0x361a39-0x0;var _0x4a3154=_0x4552[_0x361a39];return _0x4a3154;};'use strict';var _=require(_0x2455('0x0'));var util=require(_0x2455('0x1'));var logger=require(_0x2455('0x2'))(_0x2455('0x3'));var moment=require(_0x2455('0x4'));var BPromise=require(_0x2455('0x5'));var rp=require(_0x2455('0x6'));var fs=require('fs');var path=require(_0x2455('0x7'));var rimraf=require(_0x2455('0x8'));var config=require(_0x2455('0x9'));var attributes=require(_0x2455('0xa'));module[_0x2455('0xb')]=function(_0x56cb7e,_0x1b1921){return _0x56cb7e['define'](_0x2455('0xc'),attributes,{'tableName':_0x2455('0xd'),'paranoid':![],'indexes':[{'name':_0x2455('0xe'),'fields':[_0x2455('0xf')],'type':_0x2455('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x278b4b,_0x165659,_0x2f5247){var _0x225fb3=_0x56cb7e[_0x2455('0x11')];var _0x23c9db=_0x278b4b[_0x2455('0x12')]({'plain':!![]});if(_0x23c9db[_0x2455('0x13')]['toLowerCase']()==='in'||_0x23c9db[_0x2455('0x13')][_0x2455('0x14')]()===_0x2455('0x15')&&!_0x23c9db[_0x2455('0x16')]&&!_[_0x2455('0x17')](_0x23c9db['UserId'])){_0x225fb3[_0x2455('0x18')][_0x2455('0x19')]({'where':{'id':_0x23c9db[_0x2455('0x1a')]}})[_0x2455('0x1b')](function(_0x229e8a){if(_0x229e8a){_0x229e8a[_0x2455('0x1c')]({'lastMsgAt':_0x23c9db[_0x2455('0x1d')],'lastMsgDirection':_0x23c9db['direction'][_0x2455('0x14')]()});}})[_0x2455('0x1e')](function(_0x5e47e2){console[_0x2455('0x1f')](_0x5e47e2);});}_0x2f5247();}},'charset':_0x2455('0x20'),'collate':_0x2455('0x21')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index dc50396..aaefc2b 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 _0x9988=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9988,0xe1));var _0x8998=function(_0x16c314,_0x4bcd8e){_0x16c314=_0x16c314-0x0;var _0x1b0580=_0x9988[_0x16c314];return _0x1b0580;};'use strict';var _=require(_0x8998('0x0'));var util=require('util');var moment=require(_0x8998('0x1'));var BPromise=require(_0x8998('0x2'));var rs=require(_0x8998('0x3'));var fs=require('fs');var Redis=require(_0x8998('0x4'));var db=require(_0x8998('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8998('0x6'))(_0x8998('0x7'));var config=require(_0x8998('0x8'));var jayson=require(_0x8998('0x9'));var client=jayson['client'][_0x8998('0xa')]({'port':0x232a});config[_0x8998('0xb')]=_[_0x8998('0xc')](config['redis'],{'host':_0x8998('0xd'),'port':0x18eb});var socket=require(_0x8998('0xe'))(new Redis(config[_0x8998('0xb')]));require(_0x8998('0xf'))['register'](socket);function respondWithRpcPromise(_0xfa02a8,_0x566d25,_0x3e51a1){return new BPromise(function(_0x5950b6,_0x47d4d9){return client[_0x8998('0x10')](_0xfa02a8,_0x3e51a1)['then'](function(_0x4a2890){logger[_0x8998('0x11')](_0x8998('0x12'),_0x566d25,_0x8998('0x13'));logger[_0x8998('0x14')](_0x8998('0x15'),_0x566d25,'request\x20sent',JSON[_0x8998('0x16')](_0x4a2890));if(_0x4a2890[_0x8998('0x17')]){if(_0x4a2890['error'][_0x8998('0x18')]===0x1f4){logger[_0x8998('0x17')]('ChatMessage,\x20%s,\x20%s',_0x566d25,_0x4a2890['error']['message']);return _0x47d4d9(_0x4a2890['error'][_0x8998('0x19')]);}logger['error'](_0x8998('0x12'),_0x566d25,_0x4a2890['error'][_0x8998('0x19')]);return _0x5950b6(_0x4a2890['error'][_0x8998('0x19')]);}else{logger[_0x8998('0x11')](_0x8998('0x12'),_0x566d25,_0x8998('0x13'));_0x5950b6(_0x4a2890[_0x8998('0x1a')][_0x8998('0x19')]);}})[_0x8998('0x1b')](function(_0x229f85){logger[_0x8998('0x17')](_0x8998('0x12'),_0x566d25,_0x229f85);_0x47d4d9(_0x229f85);});});}exports['CreateChatMessage']=function(_0x1a9ad8){var _0x2e07c8=this;return new Promise(function(_0x1d63a7,_0x5346ed){return db[_0x8998('0x1c')][_0x8998('0x1d')](_0x1a9ad8[_0x8998('0x1e')],{'raw':_0x1a9ad8[_0x8998('0x1f')]?_0x1a9ad8[_0x8998('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2cee7b){logger[_0x8998('0x11')]('CreateChatMessage',_0x1a9ad8);logger[_0x8998('0x14')](_0x8998('0x20'),_0x1a9ad8,JSON[_0x8998('0x16')](_0x2cee7b));_0x1d63a7(_0x2cee7b);})['catch'](function(_0xdb9548){logger['error'](_0x8998('0x20'),_0xdb9548[_0x8998('0x19')],_0x1a9ad8);_0x5346ed(_0x2e07c8[_0x8998('0x17')](0x1f4,_0xdb9548[_0x8998('0x19')]));});});}; \ No newline at end of file +var _0xc41d=['raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','options'];(function(_0xabf9a7,_0x15e853){var _0x2263a3=function(_0x39a98f){while(--_0x39a98f){_0xabf9a7['push'](_0xabf9a7['shift']());}};_0x2263a3(++_0x15e853);}(_0xc41d,0x86));var _0xdc41=function(_0x58f689,_0x22ff0e){_0x58f689=_0x58f689-0x0;var _0x1fefa5=_0xc41d[_0x58f689];return _0x1fefa5;};'use strict';var _=require(_0xdc41('0x0'));var util=require(_0xdc41('0x1'));var moment=require(_0xdc41('0x2'));var BPromise=require(_0xdc41('0x3'));var rs=require(_0xdc41('0x4'));var fs=require('fs');var Redis=require(_0xdc41('0x5'));var db=require(_0xdc41('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc41('0x7'));var config=require(_0xdc41('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdc41('0x9')]['http']({'port':0x232a});config[_0xdc41('0xa')]=_[_0xdc41('0xb')](config[_0xdc41('0xa')],{'host':_0xdc41('0xc'),'port':0x18eb});var socket=require(_0xdc41('0xd'))(new Redis(config['redis']));require(_0xdc41('0xe'))[_0xdc41('0xf')](socket);function respondWithRpcPromise(_0x4bc1db,_0xb99135,_0x4b7331){return new BPromise(function(_0x15b5af,_0x55c3f9){return client[_0xdc41('0x10')](_0x4bc1db,_0x4b7331)[_0xdc41('0x11')](function(_0x1637e2){logger[_0xdc41('0x12')](_0xdc41('0x13'),_0xb99135,_0xdc41('0x14'));logger['debug'](_0xdc41('0x15'),_0xb99135,_0xdc41('0x14'),JSON[_0xdc41('0x16')](_0x1637e2));if(_0x1637e2[_0xdc41('0x17')]){if(_0x1637e2['error'][_0xdc41('0x18')]===0x1f4){logger[_0xdc41('0x17')]('ChatMessage,\x20%s,\x20%s',_0xb99135,_0x1637e2[_0xdc41('0x17')][_0xdc41('0x19')]);return _0x55c3f9(_0x1637e2[_0xdc41('0x17')][_0xdc41('0x19')]);}logger['error'](_0xdc41('0x13'),_0xb99135,_0x1637e2['error'][_0xdc41('0x19')]);return _0x15b5af(_0x1637e2[_0xdc41('0x17')][_0xdc41('0x19')]);}else{logger[_0xdc41('0x12')](_0xdc41('0x13'),_0xb99135,_0xdc41('0x14'));_0x15b5af(_0x1637e2['result'][_0xdc41('0x19')]);}})[_0xdc41('0x1a')](function(_0x278f43){logger['error'](_0xdc41('0x13'),_0xb99135,_0x278f43);_0x55c3f9(_0x278f43);});});}exports[_0xdc41('0x1b')]=function(_0x3bedd7){var _0x8477cc=this;return new Promise(function(_0x22af20,_0x31e40f){return db[_0xdc41('0x1c')][_0xdc41('0x1d')](_0x3bedd7['body'],{'raw':_0x3bedd7[_0xdc41('0x1e')]?_0x3bedd7[_0xdc41('0x1e')][_0xdc41('0x1f')]===undefined?!![]:![]:!![]})[_0xdc41('0x11')](function(_0x396b0c){logger[_0xdc41('0x12')](_0xdc41('0x1b'),_0x3bedd7);logger[_0xdc41('0x20')](_0xdc41('0x1b'),_0x3bedd7,JSON[_0xdc41('0x16')](_0x396b0c));_0x22af20(_0x396b0c);})[_0xdc41('0x1a')](function(_0x3d4a67){logger['error'](_0xdc41('0x1b'),_0x3d4a67[_0xdc41('0x19')],_0x3bedd7);_0x31e40f(_0x8477cc['error'](0x1f4,_0x3d4a67[_0xdc41('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e709af2..b1cedd1 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 _0x9f0e=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x21ccb4,_0x5593be){var _0x2889b4=function(_0x42f537){while(--_0x42f537){_0x21ccb4['push'](_0x21ccb4['shift']());}};_0x2889b4(++_0x5593be);}(_0x9f0e,0x116));var _0xe9f0=function(_0x395805,_0xc1633e){_0x395805=_0x395805-0x0;var _0x554a32=_0x9f0e[_0x395805];return _0x554a32;};'use strict';var ChatMessageEvents=require(_0xe9f0('0x0'));var events=[_0xe9f0('0x1'),_0xe9f0('0x2'),_0xe9f0('0x3')];function createListener(_0x146ad8,_0x4a1a30){return function(_0x5856dc){_0x4a1a30[_0xe9f0('0x4')](_0x146ad8,_0x5856dc);};}function removeListener(_0x150a03,_0x3c589d){return function(){ChatMessageEvents[_0xe9f0('0x5')](_0x150a03,_0x3c589d);};}exports[_0xe9f0('0x6')]=function(_0x50313d){for(var _0x5b87c1=0x0,_0x3a17b3=events[_0xe9f0('0x7')];_0x5b87c1<_0x3a17b3;_0x5b87c1++){var _0xe64a79=events[_0x5b87c1];var _0x4be6a6=createListener(_0xe9f0('0x8')+_0xe64a79,_0x50313d);ChatMessageEvents['on'](_0xe64a79,_0x4be6a6);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./chatMessage.events'];(function(_0x2b1130,_0x51bdfd){var _0x92e0ad=function(_0xe93513){while(--_0xe93513){_0x2b1130['push'](_0x2b1130['shift']());}};_0x92e0ad(++_0x51bdfd);}(_0x326f,0xd1));var _0xf326=function(_0x3e24fb,_0x348080){_0x3e24fb=_0x3e24fb-0x0;var _0x44a442=_0x326f[_0x3e24fb];return _0x44a442;};'use strict';var ChatMessageEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){ChatMessageEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('chatMessage:'+_0x165f95,_0x3ace29);ChatMessageEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 86faeb8..9a04720 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 _0xefd8=['put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','tracked','create'];(function(_0x346411,_0x583228){var _0x13a18e=function(_0x5e4361){while(--_0x5e4361){_0x346411['push'](_0x346411['shift']());}};_0x13a18e(++_0x583228);}(_0xefd8,0x1e8));var _0x8efd=function(_0x486338,_0x2ab3f9){_0x486338=_0x486338-0x0;var _0x4c8298=_0xefd8[_0x486338];return _0x4c8298;};'use strict';var multer=require(_0x8efd('0x0'));var util=require('util');var path=require(_0x8efd('0x1'));var timeout=require(_0x8efd('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8efd('0x3'));var interaction=require(_0x8efd('0x4'));var config=require('../../config/environment');var controller=require(_0x8efd('0x5'));router[_0x8efd('0x6')]('/',auth[_0x8efd('0x7')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8efd('0x8')]);router[_0x8efd('0x6')](_0x8efd('0x9'),auth[_0x8efd('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x8efd('0xa')]('chat','chatmessage:create'),controller[_0x8efd('0xb')]);router[_0x8efd('0xc')](_0x8efd('0x9'),controller[_0x8efd('0xd')]);router['put'](_0x8efd('0xe'),auth['isAuthenticated'](),controller[_0x8efd('0xf')]);router[_0x8efd('0xc')](_0x8efd('0x10'),auth['isAuthenticated'](),controller[_0x8efd('0x11')]);router[_0x8efd('0x12')](_0x8efd('0x9'),auth[_0x8efd('0x7')](),controller['destroy']);module[_0x8efd('0x13')]=router; \ No newline at end of file +var _0x8a82=['Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','accept','put','reject','delete','destroy','multer','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a82,0x70));var _0x28a8=function(_0x46ea74,_0x148f26){_0x46ea74=_0x46ea74-0x0;var _0x35c2c0=_0x8a82[_0x46ea74];return _0x35c2c0;};'use strict';var multer=require(_0x28a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x28a8('0x1'));var express=require(_0x28a8('0x2'));var router=express[_0x28a8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x28a8('0x4'));var controller=require('./chatMessage.controller');router[_0x28a8('0x5')]('/',auth[_0x28a8('0x6')](),controller[_0x28a8('0x7')]);router[_0x28a8('0x5')](_0x28a8('0x8'),auth[_0x28a8('0x6')](),controller[_0x28a8('0x9')]);router[_0x28a8('0x5')](_0x28a8('0xa'),auth[_0x28a8('0x6')](),controller[_0x28a8('0xb')]);router[_0x28a8('0xc')]('/',auth[_0x28a8('0x6')](),interaction[_0x28a8('0xd')](_0x28a8('0xe'),_0x28a8('0xf')),controller[_0x28a8('0x10')]);router['put'](_0x28a8('0xa'),controller[_0x28a8('0x11')]);router['put']('/:id/accept',auth[_0x28a8('0x6')](),controller[_0x28a8('0x12')]);router[_0x28a8('0x13')]('/:id/reject',auth[_0x28a8('0x6')](),controller[_0x28a8('0x14')]);router[_0x28a8('0x15')](_0x28a8('0xa'),auth[_0x28a8('0x6')](),controller[_0x28a8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 18232eb..9411bdb 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 _0x3499=['sequelize','exports','TEXT'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3499,0xd2));var _0x9349=function(_0x34a32e,_0x26f089){_0x34a32e=_0x34a32e-0x0;var _0x24ca9b=_0x3499[_0x34a32e];return _0x24ca9b;};'use strict';var Sequelize=require(_0x9349('0x0'));module[_0x9349('0x1')]={'body':{'type':Sequelize[_0x9349('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x51e8=['sequelize','exports'];(function(_0x548349,_0x33a0b1){var _0x509785=function(_0x18e567){while(--_0x18e567){_0x548349['push'](_0x548349['shift']());}};_0x509785(++_0x33a0b1);}(_0x51e8,0x6e));var _0x851e=function(_0xcfc566,_0x138610){_0xcfc566=_0xcfc566-0x0;var _0x506632=_0x51e8[_0xcfc566];return _0x506632;};'use strict';var Sequelize=require(_0x851e('0x0'));module[_0x851e('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2f0adc0..b29469c 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 _0x6c7b=['limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ChatOfflineMessage','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','find','catch','create','body','params','destroy','describe','html-pdf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5d1d99,_0x10ca23){var _0x2957ec=function(_0x4f4ba){while(--_0x4f4ba){_0x5d1d99['push'](_0x5d1d99['shift']());}};_0x2957ec(++_0x10ca23);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x9097e4,_0x1b0349){_0x9097e4=_0x9097e4-0x0;var _0x2aad48=_0x6c7b[_0x9097e4];return _0x2aad48;};'use strict';var pdf=require(_0xb6c7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6c7('0x1'));var rp=require('request-promise');var moment=require(_0xb6c7('0x2'));var BPromise=require(_0xb6c7('0x3'));var Mustache=require(_0xb6c7('0x4'));var util=require('util');var path=require(_0xb6c7('0x5'));var sox=require(_0xb6c7('0x6'));var csv=require(_0xb6c7('0x7'));var ejs=require(_0xb6c7('0x8'));var fs=require('fs');var _=require(_0xb6c7('0x9'));var squel=require('squel');var crypto=require(_0xb6c7('0xa'));var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x7'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6c7('0x11'));var logger=require(_0xb6c7('0x12'))(_0xb6c7('0x13'));var utils=require(_0xb6c7('0x14'));var config=require(_0xb6c7('0x15'));var db=require(_0xb6c7('0x16'))['db'];function respondWithStatusCode(_0x1b5199,_0x50c2de){_0x50c2de=_0x50c2de||0xcc;return function(_0x9b32b7){if(_0x9b32b7){return _0x1b5199[_0xb6c7('0x17')](_0x50c2de);}return _0x1b5199[_0xb6c7('0x18')](_0x50c2de)[_0xb6c7('0x19')]();};}function respondWithResult(_0x4086a1,_0x383ac5){_0x383ac5=_0x383ac5||0xc8;return function(_0x147e4a){if(_0x147e4a){return _0x4086a1['status'](_0x383ac5)[_0xb6c7('0x1a')](_0x147e4a);}};}function respondWithFilteredResult(_0x4e4c3f,_0x480d9a){return function(_0x5d5428){if(_0x5d5428){var _0x19c145=_0x5d5428[_0xb6c7('0x1b')],_0x48b7ec=_0x480d9a[_0xb6c7('0x1c')],_0x45f1a3=_0x480d9a[_0xb6c7('0x1c')]+_0x480d9a[_0xb6c7('0x1d')],_0x1a2bc9;if(_0x45f1a3>=_0x19c145){_0x45f1a3=_0x19c145;_0x1a2bc9=0xc8;}else{_0x1a2bc9=0xce;}_0x4e4c3f[_0xb6c7('0x18')](_0x1a2bc9);return _0x4e4c3f[_0xb6c7('0x1e')](_0xb6c7('0x1f'),_0x48b7ec+'-'+_0x45f1a3+'/'+_0x19c145)[_0xb6c7('0x1a')](_0x5d5428);}return null;};}function patchUpdates(_0xef5eb1){return function(_0x3f133f){try{jsonpatch[_0xb6c7('0x20')](_0x3f133f,_0xef5eb1,!![]);}catch(_0x5b5022){return BPromise[_0xb6c7('0x21')](_0x5b5022);}return _0x3f133f[_0xb6c7('0x22')]();};}function saveUpdates(_0x599b49,_0x25ca5d){return function(_0x5a1c0a){if(_0x5a1c0a){return _0x5a1c0a[_0xb6c7('0x23')](_0x599b49)['then'](function(_0x141db2){return _0x141db2;});}return null;};}function removeEntity(_0x4f2960,_0x24c0b3){return function(_0x146dd4){if(_0x146dd4){return _0x146dd4['destroy']()[_0xb6c7('0x24')](function(){_0x4f2960[_0xb6c7('0x18')](0xcc)[_0xb6c7('0x19')]();});}};}function handleEntityNotFound(_0x4232b6,_0xd33675){return function(_0x1ee45d){if(!_0x1ee45d){_0x4232b6['sendStatus'](0x194);}return _0x1ee45d;};}function handleError(_0x4109c3,_0x1f4e06){_0x1f4e06=_0x1f4e06||0x1f4;return function(_0x209a21){logger[_0xb6c7('0x25')](_0x209a21['stack']);if(_0x209a21[_0xb6c7('0x26')]){delete _0x209a21[_0xb6c7('0x26')];}_0x4109c3['status'](_0x1f4e06)[_0xb6c7('0x27')](_0x209a21);};}exports[_0xb6c7('0x28')]=function(_0x1de00f,_0x32cd6b){var _0x4fb79f={},_0x30eeb4={},_0x54373f={'count':0x0,'rows':[]};var _0x31e014=_[_0xb6c7('0x29')](db[_0xb6c7('0x2a')]['rawAttributes'],function(_0x47acab){return{'name':_0x47acab['fieldName'],'type':_0x47acab[_0xb6c7('0x2b')][_0xb6c7('0x2c')]};});_0x30eeb4[_0xb6c7('0x2d')]=_[_0xb6c7('0x29')](_0x31e014,_0xb6c7('0x26'));_0x30eeb4[_0xb6c7('0x2e')]=_[_0xb6c7('0x2f')](_0x1de00f[_0xb6c7('0x2e')]);_0x30eeb4[_0xb6c7('0x30')]=_[_0xb6c7('0x31')](_0x30eeb4['model'],_0x30eeb4[_0xb6c7('0x2e')]);_0x4fb79f['attributes']=_[_0xb6c7('0x31')](_0x30eeb4[_0xb6c7('0x2d')],qs[_0xb6c7('0x32')](_0x1de00f[_0xb6c7('0x2e')][_0xb6c7('0x32')]));_0x4fb79f['attributes']=_0x4fb79f['attributes']['length']?_0x4fb79f[_0xb6c7('0x33')]:_0x30eeb4[_0xb6c7('0x2d')];if(!_0x1de00f['query'][_0xb6c7('0x34')](_0xb6c7('0x35'))){_0x4fb79f['limit']=qs[_0xb6c7('0x1d')](_0x1de00f[_0xb6c7('0x2e')][_0xb6c7('0x1d')]);_0x4fb79f[_0xb6c7('0x1c')]=qs[_0xb6c7('0x1c')](_0x1de00f[_0xb6c7('0x2e')]['offset']);}_0x4fb79f[_0xb6c7('0x36')]=qs[_0xb6c7('0x37')](_0x1de00f[_0xb6c7('0x2e')][_0xb6c7('0x37')]);_0x4fb79f[_0xb6c7('0x38')]=qs[_0xb6c7('0x30')](_[_0xb6c7('0x39')](_0x1de00f['query'],_0x30eeb4['filters']),_0x31e014);if(_0x1de00f[_0xb6c7('0x2e')][_0xb6c7('0x3a')]){_0x4fb79f[_0xb6c7('0x38')]=_[_0xb6c7('0x3b')](_0x4fb79f[_0xb6c7('0x38')],{'$or':_[_0xb6c7('0x29')](_0x31e014,function(_0x170965){if(_0x170965[_0xb6c7('0x2b')]!==_0xb6c7('0x3c')){var _0x2f6193={};_0x2f6193[_0x170965['name']]={'$like':'%'+_0x1de00f[_0xb6c7('0x2e')]['filter']+'%'};return _0x2f6193;}})});}_0x4fb79f=_['merge']({},_0x4fb79f,_0x1de00f[_0xb6c7('0x3d')]);var _0x527c7e={'where':_0x4fb79f[_0xb6c7('0x38')]};return db[_0xb6c7('0x2a')]['count'](_0x527c7e)[_0xb6c7('0x24')](function(_0x22f5b2){_0x54373f[_0xb6c7('0x1b')]=_0x22f5b2;if(_0x1de00f[_0xb6c7('0x2e')][_0xb6c7('0x3e')]){_0x4fb79f['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xb6c7('0x3f')](_0x4fb79f);})[_0xb6c7('0x24')](function(_0xb7f85b){_0x54373f[_0xb6c7('0x40')]=_0xb7f85b;return _0x54373f;})['then'](respondWithFilteredResult(_0x32cd6b,_0x4fb79f))['catch'](handleError(_0x32cd6b,null));};exports[_0xb6c7('0x41')]=function(_0x4019c,_0x205301){var _0x214d04={'raw':!![],'where':{'id':_0x4019c['params']['id']}},_0x793060={};_0x793060['model']=_['keys'](db[_0xb6c7('0x2a')][_0xb6c7('0x42')]);_0x793060[_0xb6c7('0x2e')]=_['keys'](_0x4019c[_0xb6c7('0x2e')]);_0x793060[_0xb6c7('0x30')]=_['intersection'](_0x793060[_0xb6c7('0x2d')],_0x793060[_0xb6c7('0x2e')]);_0x214d04[_0xb6c7('0x33')]=_[_0xb6c7('0x31')](_0x793060[_0xb6c7('0x2d')],qs['fields'](_0x4019c[_0xb6c7('0x2e')][_0xb6c7('0x32')]));_0x214d04[_0xb6c7('0x33')]=_0x214d04['attributes']['length']?_0x214d04[_0xb6c7('0x33')]:_0x793060[_0xb6c7('0x2d')];if(_0x4019c[_0xb6c7('0x2e')]['includeAll']){_0x214d04['include']=[{'all':!![]}];}_0x214d04=_['merge']({},_0x214d04,_0x4019c[_0xb6c7('0x3d')]);return db[_0xb6c7('0x2a')][_0xb6c7('0x43')](_0x214d04)[_0xb6c7('0x24')](handleEntityNotFound(_0x205301,null))[_0xb6c7('0x24')](respondWithResult(_0x205301,null))[_0xb6c7('0x44')](handleError(_0x205301,null));};exports[_0xb6c7('0x45')]=function(_0x594207,_0x22b21b){return db[_0xb6c7('0x2a')][_0xb6c7('0x45')](_0x594207[_0xb6c7('0x46')],{})[_0xb6c7('0x24')](respondWithResult(_0x22b21b,0xc9))['catch'](handleError(_0x22b21b,null));};exports[_0xb6c7('0x23')]=function(_0x40bbff,_0x40292c){if(_0x40bbff[_0xb6c7('0x46')]['id']){delete _0x40bbff[_0xb6c7('0x46')]['id'];}return db[_0xb6c7('0x2a')]['find']({'where':{'id':_0x40bbff[_0xb6c7('0x47')]['id']}})[_0xb6c7('0x24')](handleEntityNotFound(_0x40292c,null))[_0xb6c7('0x24')](saveUpdates(_0x40bbff[_0xb6c7('0x46')],null))[_0xb6c7('0x24')](respondWithResult(_0x40292c,null))[_0xb6c7('0x44')](handleError(_0x40292c,null));};exports[_0xb6c7('0x48')]=function(_0x4cc0f6,_0x5218af){return db['ChatOfflineMessage'][_0xb6c7('0x43')]({'where':{'id':_0x4cc0f6[_0xb6c7('0x47')]['id']}})[_0xb6c7('0x24')](handleEntityNotFound(_0x5218af,null))[_0xb6c7('0x24')](removeEntity(_0x5218af,null))[_0xb6c7('0x44')](handleError(_0x5218af,null));};exports[_0xb6c7('0x49')]=function(_0x581da8,_0x4f5c99){return db[_0xb6c7('0x2a')]['describe']()[_0xb6c7('0x24')](respondWithResult(_0x4f5c99,null))[_0xb6c7('0x44')](handleError(_0x4f5c99,null));}; \ No newline at end of file +var _0x4c60=['papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','error','name','send','index','map','ChatOfflineMessage','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x4c60,0xc1));var _0x04c6=function(_0x467c4e,_0x3aa27a){_0x467c4e=_0x467c4e-0x0;var _0x471c5a=_0x4c60[_0x467c4e];return _0x471c5a;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');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('0x7'));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 db=require(_0x04c6('0x13'))['db'];function respondWithStatusCode(_0x119187,_0x4e5e6){_0x4e5e6=_0x4e5e6||0xcc;return function(_0x52cdcf){if(_0x52cdcf){return _0x119187[_0x04c6('0x14')](_0x4e5e6);}return _0x119187[_0x04c6('0x15')](_0x4e5e6)[_0x04c6('0x16')]();};}function respondWithResult(_0x56422a,_0x12d1c5){_0x12d1c5=_0x12d1c5||0xc8;return function(_0x15cbe0){if(_0x15cbe0){return _0x56422a[_0x04c6('0x15')](_0x12d1c5)[_0x04c6('0x17')](_0x15cbe0);}};}function respondWithFilteredResult(_0x4760f8,_0x19a26f){return function(_0x1cd963){if(_0x1cd963){var _0x3d46a9=_0x1cd963[_0x04c6('0x18')],_0x5a5a66=_0x19a26f[_0x04c6('0x19')],_0x31edf9=_0x19a26f[_0x04c6('0x19')]+_0x19a26f[_0x04c6('0x1a')],_0xa2bc92;if(_0x31edf9>=_0x3d46a9){_0x31edf9=_0x3d46a9;_0xa2bc92=0xc8;}else{_0xa2bc92=0xce;}_0x4760f8[_0x04c6('0x15')](_0xa2bc92);return _0x4760f8[_0x04c6('0x1b')]('Content-Range',_0x5a5a66+'-'+_0x31edf9+'/'+_0x3d46a9)[_0x04c6('0x17')](_0x1cd963);}return null;};}function patchUpdates(_0x13e472){return function(_0xa70fd2){try{jsonpatch['apply'](_0xa70fd2,_0x13e472,!![]);}catch(_0x4cef4e){return BPromise['reject'](_0x4cef4e);}return _0xa70fd2[_0x04c6('0x1c')]();};}function saveUpdates(_0xb997e0,_0x50dd61){return function(_0x5a5e9e){if(_0x5a5e9e){return _0x5a5e9e[_0x04c6('0x1d')](_0xb997e0)[_0x04c6('0x1e')](function(_0x3cd448){return _0x3cd448;});}return null;};}function removeEntity(_0x5daa22,_0x33a0f7){return function(_0x13f2dc){if(_0x13f2dc){return _0x13f2dc[_0x04c6('0x1f')]()['then'](function(){_0x5daa22[_0x04c6('0x15')](0xcc)[_0x04c6('0x16')]();});}};}function handleEntityNotFound(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(!_0x4c8d72){_0x562491[_0x04c6('0x14')](0x194);}return _0x4c8d72;};}function handleError(_0x3a2014,_0xd5828d){_0xd5828d=_0xd5828d||0x1f4;return function(_0x115e35){logger[_0x04c6('0x20')](_0x115e35['stack']);if(_0x115e35['name']){delete _0x115e35[_0x04c6('0x21')];}_0x3a2014[_0x04c6('0x15')](_0xd5828d)[_0x04c6('0x22')](_0x115e35);};}exports[_0x04c6('0x23')]=function(_0x4f256f,_0x1f5aaf){var _0x47c69a={},_0x1d0d3f={},_0x165cb5={'count':0x0,'rows':[]};var _0x4e00fe=_[_0x04c6('0x24')](db[_0x04c6('0x25')]['rawAttributes'],function(_0x5c9003){return{'name':_0x5c9003[_0x04c6('0x26')],'type':_0x5c9003[_0x04c6('0x27')][_0x04c6('0x28')]};});_0x1d0d3f[_0x04c6('0x29')]=_[_0x04c6('0x24')](_0x4e00fe,_0x04c6('0x21'));_0x1d0d3f['query']=_['keys'](_0x4f256f['query']);_0x1d0d3f[_0x04c6('0x2a')]=_['intersection'](_0x1d0d3f[_0x04c6('0x29')],_0x1d0d3f[_0x04c6('0x2b')]);_0x47c69a['attributes']=_[_0x04c6('0x2c')](_0x1d0d3f[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x4f256f[_0x04c6('0x2b')]['fields']));_0x47c69a[_0x04c6('0x2e')]=_0x47c69a[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x47c69a[_0x04c6('0x2e')]:_0x1d0d3f[_0x04c6('0x29')];if(!_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x30')](_0x04c6('0x31'))){_0x47c69a[_0x04c6('0x1a')]=qs[_0x04c6('0x1a')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x47c69a[_0x04c6('0x19')]=qs[_0x04c6('0x19')](_0x4f256f[_0x04c6('0x2b')]['offset']);}_0x47c69a[_0x04c6('0x32')]=qs[_0x04c6('0x33')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x33')]);_0x47c69a['where']=qs[_0x04c6('0x2a')](_[_0x04c6('0x34')](_0x4f256f['query'],_0x1d0d3f['filters']),_0x4e00fe);if(_0x4f256f['query'][_0x04c6('0x35')]){_0x47c69a[_0x04c6('0x36')]=_['merge'](_0x47c69a[_0x04c6('0x36')],{'$or':_['map'](_0x4e00fe,function(_0x15c270){if(_0x15c270[_0x04c6('0x27')]!==_0x04c6('0x37')){var _0x2b28cd={};_0x2b28cd[_0x15c270['name']]={'$like':'%'+_0x4f256f['query'][_0x04c6('0x35')]+'%'};return _0x2b28cd;}})});}_0x47c69a=_[_0x04c6('0x38')]({},_0x47c69a,_0x4f256f['options']);var _0x3f4fad={'where':_0x47c69a['where']};return db['ChatOfflineMessage'][_0x04c6('0x18')](_0x3f4fad)['then'](function(_0x181d3f){_0x165cb5[_0x04c6('0x18')]=_0x181d3f;if(_0x4f256f['query'][_0x04c6('0x39')]){_0x47c69a['include']=[{'all':!![]}];}return db[_0x04c6('0x25')][_0x04c6('0x3a')](_0x47c69a);})[_0x04c6('0x1e')](function(_0x120238){_0x165cb5[_0x04c6('0x3b')]=_0x120238;return _0x165cb5;})['then'](respondWithFilteredResult(_0x1f5aaf,_0x47c69a))[_0x04c6('0x3c')](handleError(_0x1f5aaf,null));};exports['show']=function(_0x74f1d1,_0x533608){var _0x1f7ead={'raw':!![],'where':{'id':_0x74f1d1[_0x04c6('0x3d')]['id']}},_0xc31731={};_0xc31731[_0x04c6('0x29')]=_[_0x04c6('0x3e')](db[_0x04c6('0x25')][_0x04c6('0x3f')]);_0xc31731['query']=_[_0x04c6('0x3e')](_0x74f1d1['query']);_0xc31731[_0x04c6('0x2a')]=_['intersection'](_0xc31731['model'],_0xc31731[_0x04c6('0x2b')]);_0x1f7ead['attributes']=_[_0x04c6('0x2c')](_0xc31731[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x74f1d1['query'][_0x04c6('0x2d')]));_0x1f7ead[_0x04c6('0x2e')]=_0x1f7ead[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x1f7ead[_0x04c6('0x2e')]:_0xc31731[_0x04c6('0x29')];if(_0x74f1d1[_0x04c6('0x2b')]['includeAll']){_0x1f7ead['include']=[{'all':!![]}];}_0x1f7ead=_[_0x04c6('0x38')]({},_0x1f7ead,_0x74f1d1[_0x04c6('0x40')]);return db[_0x04c6('0x25')]['find'](_0x1f7ead)[_0x04c6('0x1e')](handleEntityNotFound(_0x533608,null))[_0x04c6('0x1e')](respondWithResult(_0x533608,null))[_0x04c6('0x3c')](handleError(_0x533608,null));};exports['create']=function(_0x4c9942,_0x56c7e6){return db[_0x04c6('0x25')][_0x04c6('0x41')](_0x4c9942['body'],{})[_0x04c6('0x1e')](respondWithResult(_0x56c7e6,0xc9))[_0x04c6('0x3c')](handleError(_0x56c7e6,null));};exports[_0x04c6('0x1d')]=function(_0x4ef366,_0x392983){if(_0x4ef366[_0x04c6('0x42')]['id']){delete _0x4ef366['body']['id'];}return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x4ef366[_0x04c6('0x3d')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x392983,null))['then'](saveUpdates(_0x4ef366[_0x04c6('0x42')],null))[_0x04c6('0x1e')](respondWithResult(_0x392983,null))[_0x04c6('0x3c')](handleError(_0x392983,null));};exports[_0x04c6('0x1f')]=function(_0x5155aa,_0x192437){return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x5155aa[_0x04c6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x192437,null))[_0x04c6('0x1e')](removeEntity(_0x192437,null))[_0x04c6('0x3c')](handleError(_0x192437,null));};exports[_0x04c6('0x44')]=function(_0x489361,_0x3119f0){return db[_0x04c6('0x25')][_0x04c6('0x44')]()[_0x04c6('0x1e')](respondWithResult(_0x3119f0,null))[_0x04c6('0x3c')](handleError(_0x3119f0,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 101211c..65b1e79 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 _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x18f9cd,_0x21ff40){var _0x392a13=function(_0x3c9db7){while(--_0x3c9db7){_0x18f9cd['push'](_0x18f9cd['shift']());}};_0x392a13(++_0x21ff40);}(_0x008c,0x188));var _0xc008=function(_0x3fd9d8,_0x9a1892){_0x3fd9d8=_0x3fd9d8-0x0;var _0x181131=_0x008c[_0x3fd9d8];return _0x181131;};'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')]('ChatOfflineMessage',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc008('0xd')});}; \ No newline at end of file +var _0xd6d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x357c00,_0x57c3ac){var _0x56d297=function(_0x542234){while(--_0x542234){_0x357c00['push'](_0x357c00['shift']());}};_0x56d297(++_0x57c3ac);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x310f3a,_0x344334){_0x310f3a=_0x310f3a-0x0;var _0x55cea3=_0xd6d6[_0x310f3a];return _0x55cea3;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d6d('0xe'),'collate':_0x6d6d('0xf')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8b412bf..211a8ed 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 _0x4032=['../../config/logger','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','bluebird','randomstring','../../mysqldb'];(function(_0x3bf208,_0x1e94f0){var _0x4b1769=function(_0x2f3607){while(--_0x2f3607){_0x3bf208['push'](_0x3bf208['shift']());}};_0x4b1769(++_0x1e94f0);}(_0x4032,0x153));var _0x2403=function(_0x5e598f,_0x11bd70){_0x5e598f=_0x5e598f-0x0;var _0x2d098f=_0x4032[_0x5e598f];return _0x2d098f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2403('0x0'));var rs=require(_0x2403('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2403('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2403('0x3'))(_0x2403('0x4'));var config=require(_0x2403('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2403('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6740,_0x42655d,_0x40d292){return new BPromise(function(_0x4f5c37,_0x5b1444){return client[_0x2403('0x7')](_0x1b6740,_0x40d292)[_0x2403('0x8')](function(_0x58dd74){logger[_0x2403('0x9')](_0x2403('0xa'),_0x42655d,_0x2403('0xb'));logger[_0x2403('0xc')](_0x2403('0xd'),_0x42655d,_0x2403('0xb'),JSON[_0x2403('0xe')](_0x58dd74));if(_0x58dd74['error']){if(_0x58dd74['error'][_0x2403('0xf')]===0x1f4){logger[_0x2403('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42655d,_0x58dd74['error'][_0x2403('0x11')]);return _0x5b1444(_0x58dd74[_0x2403('0x10')][_0x2403('0x11')]);}logger[_0x2403('0x10')](_0x2403('0xa'),_0x42655d,_0x58dd74['error'][_0x2403('0x11')]);return _0x4f5c37(_0x58dd74[_0x2403('0x10')][_0x2403('0x11')]);}else{logger[_0x2403('0x9')](_0x2403('0xa'),_0x42655d,_0x2403('0xb'));_0x4f5c37(_0x58dd74[_0x2403('0x12')][_0x2403('0x11')]);}})['catch'](function(_0x418bad){logger['error'](_0x2403('0xa'),_0x42655d,_0x418bad);_0x5b1444(_0x418bad);});});} \ No newline at end of file +var _0x5b97=['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','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x59a018,_0x32b6fd){var _0x5dc1e3=function(_0x4378cb){while(--_0x4378cb){_0x59a018['push'](_0x59a018['shift']());}};_0x5dc1e3(++_0x32b6fd);}(_0x5b97,0xd7));var _0x75b9=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x5b97[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0x75b9('0x0'));var util=require(_0x75b9('0x1'));var moment=require('moment');var BPromise=require(_0x75b9('0x2'));var rs=require(_0x75b9('0x3'));var fs=require('fs');var Redis=require(_0x75b9('0x4'));var db=require(_0x75b9('0x5'))['db'];var utils=require(_0x75b9('0x6'));var logger=require('../../config/logger')(_0x75b9('0x7'));var config=require(_0x75b9('0x8'));var jayson=require(_0x75b9('0x9'));var client=jayson[_0x75b9('0xa')][_0x75b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d10a5,_0x4c3b78,_0x1624c4){return new BPromise(function(_0x152089,_0x3e5ef6){return client[_0x75b9('0xc')](_0x2d10a5,_0x1624c4)[_0x75b9('0xd')](function(_0x4abef1){logger[_0x75b9('0xe')](_0x75b9('0xf'),_0x4c3b78,_0x75b9('0x10'));logger[_0x75b9('0x11')](_0x75b9('0x12'),_0x4c3b78,'request\x20sent',JSON[_0x75b9('0x13')](_0x4abef1));if(_0x4abef1[_0x75b9('0x14')]){if(_0x4abef1['error'][_0x75b9('0x15')]===0x1f4){logger[_0x75b9('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4c3b78,_0x4abef1[_0x75b9('0x14')][_0x75b9('0x16')]);return _0x3e5ef6(_0x4abef1[_0x75b9('0x14')][_0x75b9('0x16')]);}logger[_0x75b9('0x14')](_0x75b9('0xf'),_0x4c3b78,_0x4abef1['error'][_0x75b9('0x16')]);return _0x152089(_0x4abef1[_0x75b9('0x14')]['message']);}else{logger['info'](_0x75b9('0xf'),_0x4c3b78,_0x75b9('0x10'));_0x152089(_0x4abef1[_0x75b9('0x17')][_0x75b9('0x16')]);}})[_0x75b9('0x18')](function(_0x4a1a93){logger['error'](_0x75b9('0xf'),_0x4c3b78,_0x4a1a93);_0x3e5ef6(_0x4a1a93);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 8826a5e..52f26c4 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 _0x4c27=['Router','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x631574,_0x5b0259){var _0x31dabf=function(_0x25e5f1){while(--_0x25e5f1){_0x631574['push'](_0x631574['shift']());}};_0x31dabf(++_0x5b0259);}(_0x4c27,0x1c3));var _0x74c2=function(_0xf01bb1,_0x34dbe){_0xf01bb1=_0xf01bb1-0x0;var _0x5e8de0=_0x4c27[_0xf01bb1];return _0x5e8de0;};'use strict';var multer=require(_0x74c2('0x0'));var util=require(_0x74c2('0x1'));var path=require(_0x74c2('0x2'));var timeout=require(_0x74c2('0x3'));var express=require(_0x74c2('0x4'));var router=express[_0x74c2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x74c2('0x6')]('/',auth[_0x74c2('0x7')](),controller[_0x74c2('0x8')]);router[_0x74c2('0x6')](_0x74c2('0x9'),auth[_0x74c2('0x7')](),controller[_0x74c2('0xa')]);router['get']('/:id',auth[_0x74c2('0x7')](),controller[_0x74c2('0xb')]);router[_0x74c2('0xc')]('/',auth[_0x74c2('0x7')](),controller[_0x74c2('0xd')]);router['put'](_0x74c2('0xe'),auth[_0x74c2('0x7')](),controller[_0x74c2('0xf')]);router[_0x74c2('0x10')](_0x74c2('0xe'),auth['isAuthenticated'](),controller[_0x74c2('0x11')]);module[_0x74c2('0x12')]=router; \ No newline at end of file +var _0xdf72=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x403e08,_0x475d8b){var _0x26cb04=function(_0x5e4ed8){while(--_0x5e4ed8){_0x403e08['push'](_0x403e08['shift']());}};_0x26cb04(++_0x475d8b);}(_0xdf72,0x1d8));var _0x2df7=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0xdf72[_0x68a0b0];return _0x4b4ee6;};'use strict';var multer=require('multer');var util=require(_0x2df7('0x0'));var path=require(_0x2df7('0x1'));var timeout=require('connect-timeout');var express=require(_0x2df7('0x2'));var router=express[_0x2df7('0x3')]();var auth=require(_0x2df7('0x4'));var interaction=require(_0x2df7('0x5'));var config=require(_0x2df7('0x6'));var controller=require(_0x2df7('0x7'));router[_0x2df7('0x8')]('/',auth[_0x2df7('0x9')](),controller[_0x2df7('0xa')]);router[_0x2df7('0x8')](_0x2df7('0xb'),auth[_0x2df7('0x9')](),controller[_0x2df7('0xc')]);router[_0x2df7('0x8')](_0x2df7('0xd'),auth[_0x2df7('0x9')](),controller[_0x2df7('0xe')]);router['post']('/',auth[_0x2df7('0x9')](),controller[_0x2df7('0xf')]);router[_0x2df7('0x10')]('/:id',auth[_0x2df7('0x9')](),controller[_0x2df7('0x11')]);router[_0x2df7('0x12')](_0x2df7('0xd'),auth['isAuthenticated'](),controller[_0x2df7('0x13')]);module[_0x2df7('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1120e6d..86180de 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 _0x574f=['STRING','INTEGER','sequelize','exports','ENUM','timeout','mouseOver'];(function(_0xabca41,_0xbfdf4a){var _0x404ccb=function(_0x11644b){while(--_0x11644b){_0xabca41['push'](_0xabca41['shift']());}};_0x404ccb(++_0xbfdf4a);}(_0x574f,0xdb));var _0xf574=function(_0x16cdfb,_0x476512){_0x16cdfb=_0x16cdfb-0x0;var _0x3df19c=_0x574f[_0x16cdfb];return _0x3df19c;};'use strict';var Sequelize=require(_0xf574('0x0'));module[_0xf574('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf574('0x2')]('mouseOver',_0xf574('0x3')),'defaultValue':_0xf574('0x4')},'selector':{'type':Sequelize[_0xf574('0x5')]},'timeout':{'type':Sequelize[_0xf574('0x6')]}}; \ No newline at end of file +var _0x8140=['mouseOver','timeout','sequelize','ENUM'];(function(_0x2709f9,_0x2c9b2e){var _0x51da75=function(_0x427a85){while(--_0x427a85){_0x2709f9['push'](_0x2709f9['shift']());}};_0x51da75(++_0x2c9b2e);}(_0x8140,0x15e));var _0x0814=function(_0x2c8d24,_0x4ee19b){_0x2c8d24=_0x2c8d24-0x0;var _0x11a67a=_0x8140[_0x2c8d24];return _0x11a67a;};'use strict';var Sequelize=require(_0x0814('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0814('0x1')](_0x0814('0x2'),_0x0814('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fc637bb..ae3775f 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 _0xedd9=['offset','limit','Content-Range','reject','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','catch','create','ChatProactiveAction','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xedd9,0xfc));var _0x9edd=function(_0x17c624,_0x2c6f74){_0x17c624=_0x17c624-0x0;var _0x24c927=_0xedd9[_0x17c624];return _0x24c927;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={'raw':!![],'where':{'id':_0x25e135[_0x9edd('0x27')]['id']}},_0x57a2cc={};_0x57a2cc[_0x9edd('0x28')]=_[_0x9edd('0x29')](db['ChatProactiveAction'][_0x9edd('0x2a')]);_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x29')](_0x25e135[_0x9edd('0x2b')]);_0x57a2cc['filters']=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],_0x57a2cc[_0x9edd('0x2b')]);_0x4fe471[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],qs[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2b')][_0x9edd('0x2e')]));_0x4fe471[_0x9edd('0x2d')]=_0x4fe471[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x4fe471[_0x9edd('0x2d')]:_0x57a2cc[_0x9edd('0x28')];if(_0x25e135[_0x9edd('0x2b')]['includeAll']){_0x4fe471[_0x9edd('0x30')]=[{'all':!![]}];}_0x4fe471=_[_0x9edd('0x31')]({},_0x4fe471,_0x25e135[_0x9edd('0x32')]);return db['ChatProactiveAction'][_0x9edd('0x33')](_0x4fe471)[_0x9edd('0x21')](handleEntityNotFound(_0x3c2227,null))[_0x9edd('0x21')](respondWithResult(_0x3c2227,null))[_0x9edd('0x34')](handleError(_0x3c2227,null));};exports[_0x9edd('0x35')]=function(_0x2bc4ed,_0x473068){return db[_0x9edd('0x36')][_0x9edd('0x35')](_0x2bc4ed[_0x9edd('0x37')],{})[_0x9edd('0x21')](respondWithResult(_0x473068,0xc9))[_0x9edd('0x34')](handleError(_0x473068,null));};exports[_0x9edd('0x20')]=function(_0x14f780,_0x5757fc){if(_0x14f780[_0x9edd('0x37')]['id']){delete _0x14f780['body']['id'];}return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x14f780[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x5757fc,null))[_0x9edd('0x21')](saveUpdates(_0x14f780['body'],null))[_0x9edd('0x21')](respondWithResult(_0x5757fc,null))[_0x9edd('0x34')](handleError(_0x5757fc,null));};exports[_0x9edd('0x22')]=function(_0x38e9be,_0x1be77f){return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x38e9be[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x1be77f,null))[_0x9edd('0x21')](removeEntity(_0x1be77f,null))['catch'](handleError(_0x1be77f,null));}; \ No newline at end of file +var _0xe706=['../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','ChatProactiveAction','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x25428f,_0x3e4c19){var _0xda115a=function(_0xa55544){while(--_0xa55544){_0x25428f['push'](_0x25428f['shift']());}};_0xda115a(++_0x3e4c19);}(_0xe706,0xa3));var _0x6e70=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0xe706[_0x188a93];return _0x23b40d;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={'raw':!![],'where':{'id':_0x4a67ac[_0x6e70('0x2c')]['id']}},_0x3af17f={};_0x3af17f[_0x6e70('0x2d')]=_[_0x6e70('0x2e')](db['ChatProactiveAction'][_0x6e70('0x2f')]);_0x3af17f[_0x6e70('0x30')]=_[_0x6e70('0x2e')](_0x4a67ac[_0x6e70('0x30')]);_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x3af17f[_0x6e70('0x2d')],_0x3af17f[_0x6e70('0x30')]);_0x2c4d37[_0x6e70('0x33')]=_[_0x6e70('0x32')](_0x3af17f['model'],qs[_0x6e70('0x34')](_0x4a67ac['query'][_0x6e70('0x34')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x33')][_0x6e70('0x35')]?_0x2c4d37[_0x6e70('0x33')]:_0x3af17f['model'];if(_0x4a67ac[_0x6e70('0x30')][_0x6e70('0x36')]){_0x2c4d37['include']=[{'all':!![]}];}_0x2c4d37=_[_0x6e70('0x37')]({},_0x2c4d37,_0x4a67ac[_0x6e70('0x38')]);return db['ChatProactiveAction'][_0x6e70('0x39')](_0x2c4d37)[_0x6e70('0x27')](handleEntityNotFound(_0x54a5fe,null))[_0x6e70('0x27')](respondWithResult(_0x54a5fe,null))[_0x6e70('0x3a')](handleError(_0x54a5fe,null));};exports[_0x6e70('0x3b')]=function(_0x1e3e76,_0x44b19d){return db[_0x6e70('0x3c')][_0x6e70('0x3b')](_0x1e3e76[_0x6e70('0x3d')],{})['then'](respondWithResult(_0x44b19d,0xc9))[_0x6e70('0x3a')](handleError(_0x44b19d,null));};exports['update']=function(_0x23cd1a,_0x3222a2){if(_0x23cd1a[_0x6e70('0x3d')]['id']){delete _0x23cd1a[_0x6e70('0x3d')]['id'];}return db[_0x6e70('0x3c')][_0x6e70('0x39')]({'where':{'id':_0x23cd1a[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x3222a2,null))[_0x6e70('0x27')](saveUpdates(_0x23cd1a[_0x6e70('0x3d')],null))[_0x6e70('0x27')](respondWithResult(_0x3222a2,null))[_0x6e70('0x3a')](handleError(_0x3222a2,null));};exports[_0x6e70('0x3e')]=function(_0x501b53,_0x5446a2){return db['ChatProactiveAction'][_0x6e70('0x39')]({'where':{'id':_0x501b53[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x5446a2,null))[_0x6e70('0x27')](removeEntity(_0x5446a2,null))[_0x6e70('0x3a')](handleError(_0x5446a2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f83496d..feb7233 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 _0xca61=['define','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xca61,0xd2));var _0x1ca6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca61[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x1ca6('0x0'));var logger=require(_0x1ca6('0x1'))(_0x1ca6('0x2'));var moment=require(_0x1ca6('0x3'));var BPromise=require(_0x1ca6('0x4'));var rp=require(_0x1ca6('0x5'));var fs=require('fs');var path=require(_0x1ca6('0x6'));var rimraf=require(_0x1ca6('0x7'));var config=require(_0x1ca6('0x8'));var attributes=require(_0x1ca6('0x9'));module[_0x1ca6('0xa')]=function(_0x3484b9,_0x190a4c){return _0x3484b9[_0x1ca6('0xb')]('ChatProactiveAction',attributes,{'tableName':_0x1ca6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2555=['bluebird','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','api'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x2555,0x10b));var _0x5255=function(_0x28e63c,_0x3553da){_0x28e63c=_0x28e63c-0x0;var _0x47caff=_0x2555[_0x28e63c];return _0x47caff;};'use strict';var _=require(_0x5255('0x0'));var util=require(_0x5255('0x1'));var logger=require('../../config/logger')(_0x5255('0x2'));var moment=require('moment');var BPromise=require(_0x5255('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5255('0x4'));var rimraf=require('rimraf');var config=require(_0x5255('0x5'));var attributes=require(_0x5255('0x6'));module[_0x5255('0x7')]=function(_0x536a88,_0x45a6af){return _0x536a88[_0x5255('0x8')](_0x5255('0x9'),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 49d7c09..fa1e1de 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 _0x31ed=['bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x31ed,0x1c5));var _0xd31e=function(_0x10ac8c,_0x21fa56){_0x10ac8c=_0x10ac8c-0x0;var _0x3208d4=_0x31ed[_0x10ac8c];return _0x3208d4;};'use strict';var _=require(_0xd31e('0x0'));var util=require(_0xd31e('0x1'));var moment=require(_0xd31e('0x2'));var BPromise=require(_0xd31e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd31e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd31e('0x5'));var logger=require('../../config/logger')(_0xd31e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd31e('0x7'));var client=jayson['client'][_0xd31e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24fc0e,_0x1fd846,_0x1fe9f9){return new BPromise(function(_0x437bb2,_0x6998c4){return client['request'](_0x24fc0e,_0x1fe9f9)['then'](function(_0x413d72){logger[_0xd31e('0x9')](_0xd31e('0xa'),_0x1fd846,_0xd31e('0xb'));logger[_0xd31e('0xc')](_0xd31e('0xd'),_0x1fd846,_0xd31e('0xb'),JSON[_0xd31e('0xe')](_0x413d72));if(_0x413d72[_0xd31e('0xf')]){if(_0x413d72['error'][_0xd31e('0x10')]===0x1f4){logger[_0xd31e('0xf')](_0xd31e('0xa'),_0x1fd846,_0x413d72[_0xd31e('0xf')][_0xd31e('0x11')]);return _0x6998c4(_0x413d72[_0xd31e('0xf')][_0xd31e('0x11')]);}logger[_0xd31e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1fd846,_0x413d72['error'][_0xd31e('0x11')]);return _0x437bb2(_0x413d72[_0xd31e('0xf')][_0xd31e('0x11')]);}else{logger[_0xd31e('0x9')](_0xd31e('0xa'),_0x1fd846,_0xd31e('0xb'));_0x437bb2(_0x413d72['result'][_0xd31e('0x11')]);}})[_0xd31e('0x12')](function(_0x1b68c4){logger['error'](_0xd31e('0xa'),_0x1fd846,_0x1b68c4);_0x6998c4(_0x1b68c4);});});} \ No newline at end of file +var _0x649b=['stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','debug'];(function(_0x5a7e37,_0x4cea71){var _0x2f6bf3=function(_0x9eb21a){while(--_0x9eb21a){_0x5a7e37['push'](_0x5a7e37['shift']());}};_0x2f6bf3(++_0x4cea71);}(_0x649b,0xeb));var _0xb649=function(_0x10cda9,_0x1bca9a){_0x10cda9=_0x10cda9-0x0;var _0xbacdd=_0x649b[_0x10cda9];return _0xbacdd;};'use strict';var _=require(_0xb649('0x0'));var util=require(_0xb649('0x1'));var moment=require('moment');var BPromise=require(_0xb649('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb649('0x3'))['db'];var utils=require(_0xb649('0x4'));var logger=require(_0xb649('0x5'))(_0xb649('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb649('0x7')][_0xb649('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53b7d4,_0x173cac,_0x5f177f){return new BPromise(function(_0x51f3a0,_0x191ab9){return client[_0xb649('0x9')](_0x53b7d4,_0x5f177f)['then'](function(_0x528cfb){logger[_0xb649('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x173cac,'request\x20sent');logger[_0xb649('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x173cac,'request\x20sent',JSON[_0xb649('0xc')](_0x528cfb));if(_0x528cfb[_0xb649('0xd')]){if(_0x528cfb[_0xb649('0xd')][_0xb649('0xe')]===0x1f4){logger[_0xb649('0xd')](_0xb649('0xf'),_0x173cac,_0x528cfb['error'][_0xb649('0x10')]);return _0x191ab9(_0x528cfb[_0xb649('0xd')][_0xb649('0x10')]);}logger[_0xb649('0xd')](_0xb649('0xf'),_0x173cac,_0x528cfb[_0xb649('0xd')][_0xb649('0x10')]);return _0x51f3a0(_0x528cfb[_0xb649('0xd')][_0xb649('0x10')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x173cac,_0xb649('0x11'));_0x51f3a0(_0x528cfb[_0xb649('0x12')][_0xb649('0x10')]);}})['catch'](function(_0x4c65bd){logger['error'](_0xb649('0xf'),_0x173cac,_0x4c65bd);_0x191ab9(_0x4c65bd);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8a4ed7d..8ebcfb2 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 _0xaba8=['connect-timeout','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x48eecb,_0x4cc6cd){var _0x21caa9=function(_0x529e7c){while(--_0x529e7c){_0x48eecb['push'](_0x48eecb['shift']());}};_0x21caa9(++_0x4cc6cd);}(_0xaba8,0x8d));var _0x8aba=function(_0x2375af,_0x2181b7){_0x2375af=_0x2375af-0x0;var _0xfe4236=_0xaba8[_0x2375af];return _0xfe4236;};'use strict';var multer=require(_0x8aba('0x0'));var util=require(_0x8aba('0x1'));var path=require(_0x8aba('0x2'));var timeout=require(_0x8aba('0x3'));var express=require(_0x8aba('0x4'));var router=express['Router']();var auth=require(_0x8aba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8aba('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x8aba('0x7')](_0x8aba('0x8'),auth[_0x8aba('0x9')](),controller[_0x8aba('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8aba('0xb')]('/:id',auth[_0x8aba('0x9')](),controller[_0x8aba('0xc')]);router[_0x8aba('0xd')](_0x8aba('0x8'),auth[_0x8aba('0x9')](),controller[_0x8aba('0xe')]);module[_0x8aba('0xf')]=router; \ No newline at end of file +var _0xb1a3=['../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','delete','destroy','multer','util','path','express','../../components/interaction/service'];(function(_0x49d2db,_0x5388c5){var _0x5efabf=function(_0x381b64){while(--_0x381b64){_0x49d2db['push'](_0x49d2db['shift']());}};_0x5efabf(++_0x5388c5);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xb1a3[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var path=require(_0x3b1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b1a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3b1a('0x4'));var config=require(_0x3b1a('0x5'));var controller=require(_0x3b1a('0x6'));router[_0x3b1a('0x7')](_0x3b1a('0x8'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xa')]);router['post']('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xb')]);router[_0x3b1a('0xc')](_0x3b1a('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3b1a('0xd')](_0x3b1a('0x8'),auth['isAuthenticated'](),controller[_0x3b1a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 173d855..df38ec6 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 _0xb4ac=['rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x538c09,_0x26e85a){var _0x28f0ca=function(_0x2ab36b){while(--_0x2ab36b){_0x538c09['push'](_0x538c09['shift']());}};_0x28f0ca(++_0x26e85a);}(_0xb4ac,0x19a));var _0xcb4a=function(_0x46bc0a,_0x41b6c6){_0x46bc0a=_0x46bc0a-0x0;var _0x5e649c=_0xb4ac[_0x46bc0a];return _0x5e649c;};'use strict';var Sequelize=require(_0xcb4a('0x0'));module[_0xcb4a('0x1')]={'name':{'type':Sequelize[_0xcb4a('0x2')],'unique':_0xcb4a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcb4a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcb4a('0x4'),'beepall',_0xcb4a('0x5'))}}; \ No newline at end of file +var _0x43de=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0xdb6588,_0x33363a){var _0x32e0b9=function(_0x5e071b){while(--_0x5e071b){_0xdb6588['push'](_0xdb6588['shift']());}};_0x32e0b9(++_0x33363a);}(_0x43de,0x1ee));var _0xe43d=function(_0x5c526e,_0x494a78){_0x5c526e=_0x5c526e-0x0;var _0x213eca=_0x43de[_0x5c526e];return _0x213eca;};'use strict';var Sequelize=require(_0xe43d('0x0'));module[_0xe43d('0x1')]={'name':{'type':Sequelize[_0xe43d('0x2')],'unique':_0xe43d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe43d('0x2')]},'timeout':{'type':Sequelize[_0xe43d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe43d('0x5')](_0xe43d('0x6'),_0xe43d('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index cde9258..85b8d17 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 _0x9de1=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','compact','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x24ff13,_0x27f278){var _0x4e2ea2=function(_0x4613fe){while(--_0x4613fe){_0x24ff13['push'](_0x24ff13['shift']());}};_0x4e2ea2(++_0x27f278);}(_0x9de1,0x178));var _0x19de=function(_0x216f34,_0x108f08){_0x216f34=_0x216f34-0x0;var _0x44a641=_0x9de1[_0x216f34];return _0x44a641;};'use strict';var pdf=require(_0x19de('0x0'));var emlformat=require(_0x19de('0x1'));var rimraf=require(_0x19de('0x2'));var zipdir=require(_0x19de('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19de('0x4'));var moment=require('moment');var BPromise=require(_0x19de('0x5'));var Mustache=require(_0x19de('0x6'));var util=require(_0x19de('0x7'));var path=require(_0x19de('0x8'));var sox=require(_0x19de('0x9'));var csv=require(_0x19de('0xa'));var ejs=require(_0x19de('0xb'));var fs=require('fs');var _=require(_0x19de('0xc'));var squel=require(_0x19de('0xd'));var crypto=require('crypto');var jsforce=require(_0x19de('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x19de('0xa'));var querystring=require(_0x19de('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x19de('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x19de('0x11'));var hardwareService=require(_0x19de('0x12'));var logger=require(_0x19de('0x13'))(_0x19de('0x14'));var utils=require(_0x19de('0x15'));var config=require(_0x19de('0x16'));var db=require('../../mysqldb')['db'];config[_0x19de('0x17')]=_[_0x19de('0x18')](config[_0x19de('0x17')],{'host':_0x19de('0x19'),'port':0x18eb});var socket=require(_0x19de('0x1a'))(new Redis(config[_0x19de('0x17')]));require('./chatQueue.socket')[_0x19de('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x19de('0x1c')][_0x19de('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xf706b8,_0x359d66,_0x23f164){if(_0x23f164){var _0x2b141b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b141b[_0x19de('0x1e')](_0x359d66)){return _0xf706b8;}else{throw new db[(_0x19de('0x1f'))][(_0x19de('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xf706b8;}}function respondWithRpcPromise(_0x4ce0a8,_0x37b1ef,_0x127265,_0x1939c5){return new BPromise(function(_0x2fe902,_0x43af89){var _0x21387b=_0x1939c5||client;return _0x21387b['request'](_0x4ce0a8,_0x127265)['then'](function(_0x144fdb){logger[_0x19de('0x21')](_0x19de('0x22'),_0x37b1ef,'request\x20sent');logger['debug'](_0x19de('0x23'),_0x37b1ef,_0x19de('0x24'),JSON['stringify'](_0x144fdb));if(_0x144fdb[_0x19de('0x25')]){if(_0x144fdb[_0x19de('0x25')]['code']===0x1f4){logger[_0x19de('0x25')](_0x19de('0x22'),_0x37b1ef,_0x144fdb[_0x19de('0x25')][_0x19de('0x26')]);return _0x43af89(_0x144fdb[_0x19de('0x25')]['message']);}logger[_0x19de('0x25')]('ChatQueue,\x20%s,\x20%s',_0x37b1ef,_0x144fdb[_0x19de('0x25')][_0x19de('0x26')]);return _0x2fe902(_0x144fdb[_0x19de('0x25')]['message']);}else{logger[_0x19de('0x21')](_0x19de('0x22'),_0x37b1ef,_0x19de('0x24'));_0x2fe902(_0x144fdb[_0x19de('0x27')]['message']);}})['catch'](function(_0x1d26b1){logger['error'](_0x19de('0x22'),_0x37b1ef,_0x1d26b1);_0x43af89(_0x1d26b1);});});}function respondWithStatusCode(_0x5e5c7a,_0x25efc7){_0x25efc7=_0x25efc7||0xcc;return function(_0x39c2bd){if(_0x39c2bd){return _0x5e5c7a[_0x19de('0x28')](_0x25efc7);}return _0x5e5c7a['status'](_0x25efc7)[_0x19de('0x29')]();};}function respondWithResult(_0x1b48d5,_0x285f20){_0x285f20=_0x285f20||0xc8;return function(_0x450342){if(_0x450342){return _0x1b48d5[_0x19de('0x2a')](_0x285f20)[_0x19de('0x2b')](_0x450342);}};}function respondWithFilteredResult(_0x5a05dd,_0x1b4dc9){return function(_0x7a730e){if(_0x7a730e){var _0x6408e8=_0x7a730e['count'],_0x21aa96=_0x1b4dc9['offset'],_0x525239=_0x1b4dc9[_0x19de('0x2c')]+_0x1b4dc9[_0x19de('0x2d')],_0x351635;if(_0x525239>=_0x6408e8){_0x525239=_0x6408e8;_0x351635=0xc8;}else{_0x351635=0xce;}_0x5a05dd[_0x19de('0x2a')](_0x351635);return _0x5a05dd[_0x19de('0x2e')](_0x19de('0x2f'),_0x21aa96+'-'+_0x525239+'/'+_0x6408e8)['json'](_0x7a730e);}return null;};}function patchUpdates(_0x5c40a8){return function(_0x4e870d){try{jsonpatch['apply'](_0x4e870d,_0x5c40a8,!![]);}catch(_0x35696f){return BPromise[_0x19de('0x30')](_0x35696f);}return _0x4e870d[_0x19de('0x31')]();};}function saveUpdates(_0x8abfa5,_0x37c56e){return function(_0x1e4d64){if(_0x1e4d64){return _0x1e4d64[_0x19de('0x32')](_0x8abfa5)[_0x19de('0x33')](function(_0x52b06e){return _0x52b06e;});}return null;};}function removeEntity(_0xb5a0bd,_0x306348){return function(_0x20939e){if(_0x20939e){return _0x20939e[_0x19de('0x34')]()['then'](function(){var _0x508b66=_0x20939e[_0x19de('0x35')]({'plain':!![]});var _0x56dd0f=_0x19de('0x36');return db[_0x19de('0x37')][_0x19de('0x34')]({'where':{'type':_0x56dd0f,'resourceId':_0x508b66['id']}})[_0x19de('0x33')](function(){return _0x20939e;});})[_0x19de('0x33')](function(){_0xb5a0bd[_0x19de('0x2a')](0xcc)[_0x19de('0x29')]();});}};}function handleEntityNotFound(_0x5d9b76,_0x5763e9){return function(_0x401c5e){if(!_0x401c5e){_0x5d9b76[_0x19de('0x28')](0x194);}return _0x401c5e;};}function handleError(_0x2f7239,_0x885f53){_0x885f53=_0x885f53||0x1f4;return function(_0x5c73cf){logger['error'](_0x5c73cf[_0x19de('0x38')]);if(_0x5c73cf[_0x19de('0x39')]){delete _0x5c73cf['name'];}_0x2f7239['status'](_0x885f53)[_0x19de('0x3a')](_0x5c73cf);};}exports[_0x19de('0x3b')]=function(_0x2c9328,_0x29cfb5){var _0x56b54e={},_0x1a7bae={},_0x5e8cb8={'count':0x0,'rows':[]};var _0x5f22ce=_['map'](db[_0x19de('0x3c')][_0x19de('0x3d')],function(_0x20a78b){return{'name':_0x20a78b[_0x19de('0x3e')],'type':_0x20a78b[_0x19de('0x3f')][_0x19de('0x40')]};});_0x1a7bae[_0x19de('0x41')]=_[_0x19de('0x42')](_0x5f22ce,_0x19de('0x39'));_0x1a7bae[_0x19de('0x43')]=_[_0x19de('0x44')](_0x2c9328[_0x19de('0x43')]);_0x1a7bae[_0x19de('0x45')]=_[_0x19de('0x46')](_0x1a7bae[_0x19de('0x41')],_0x1a7bae[_0x19de('0x43')]);_0x56b54e[_0x19de('0x47')]=_[_0x19de('0x46')](_0x1a7bae[_0x19de('0x41')],qs[_0x19de('0x48')](_0x2c9328[_0x19de('0x43')][_0x19de('0x48')]));_0x56b54e[_0x19de('0x47')]=_0x56b54e[_0x19de('0x47')][_0x19de('0x49')]?_0x56b54e[_0x19de('0x47')]:_0x1a7bae[_0x19de('0x41')];if(!_0x2c9328[_0x19de('0x43')]['hasOwnProperty'](_0x19de('0x4a'))){_0x56b54e['limit']=qs[_0x19de('0x2d')](_0x2c9328[_0x19de('0x43')][_0x19de('0x2d')]);_0x56b54e[_0x19de('0x2c')]=qs[_0x19de('0x2c')](_0x2c9328[_0x19de('0x43')][_0x19de('0x2c')]);}_0x56b54e[_0x19de('0x4b')]=qs[_0x19de('0x4c')](_0x2c9328[_0x19de('0x43')]['sort']);_0x56b54e[_0x19de('0x4d')]=qs[_0x19de('0x45')](_['pick'](_0x2c9328['query'],_0x1a7bae['filters']),_0x5f22ce);if(_0x2c9328[_0x19de('0x43')][_0x19de('0x4e')]){_0x56b54e[_0x19de('0x4d')]=_[_0x19de('0x4f')](_0x56b54e[_0x19de('0x4d')],{'$or':_['map'](_0x5f22ce,function(_0x39c17a){if(_0x39c17a[_0x19de('0x3f')]!==_0x19de('0x50')){var _0x3c701f={};_0x3c701f[_0x39c17a[_0x19de('0x39')]]={'$like':'%'+_0x2c9328[_0x19de('0x43')]['filter']+'%'};return _0x3c701f;}})});}_0x56b54e=_[_0x19de('0x4f')]({},_0x56b54e,_0x2c9328[_0x19de('0x51')]);var _0x242bcc={'where':_0x56b54e[_0x19de('0x4d')]};return db[_0x19de('0x3c')]['count'](_0x242bcc)[_0x19de('0x33')](function(_0x323a0e){_0x5e8cb8[_0x19de('0x52')]=_0x323a0e;if(_0x2c9328[_0x19de('0x43')][_0x19de('0x53')]){_0x56b54e[_0x19de('0x54')]=[{'all':!![]}];}return db[_0x19de('0x3c')]['findAll'](_0x56b54e);})[_0x19de('0x33')](function(_0x108c9a){_0x5e8cb8['rows']=_0x108c9a;return _0x5e8cb8;})[_0x19de('0x33')](respondWithFilteredResult(_0x29cfb5,_0x56b54e))['catch'](handleError(_0x29cfb5,null));};exports['show']=function(_0x48c9b4,_0x4d9f79){var _0x3b6ab5={'raw':!![],'where':{'id':_0x48c9b4[_0x19de('0x55')]['id']}},_0x10b297={};_0x10b297['model']=_['keys'](db[_0x19de('0x3c')][_0x19de('0x3d')]);_0x10b297[_0x19de('0x43')]=_[_0x19de('0x44')](_0x48c9b4[_0x19de('0x43')]);_0x10b297[_0x19de('0x45')]=_[_0x19de('0x46')](_0x10b297[_0x19de('0x41')],_0x10b297[_0x19de('0x43')]);_0x3b6ab5['attributes']=_[_0x19de('0x46')](_0x10b297[_0x19de('0x41')],qs[_0x19de('0x48')](_0x48c9b4[_0x19de('0x43')][_0x19de('0x48')]));_0x3b6ab5['attributes']=_0x3b6ab5['attributes'][_0x19de('0x49')]?_0x3b6ab5[_0x19de('0x47')]:_0x10b297[_0x19de('0x41')];if(_0x48c9b4['query']['includeAll']){_0x3b6ab5['include']=[{'all':!![]}];}_0x3b6ab5=_[_0x19de('0x4f')]({},_0x3b6ab5,_0x48c9b4[_0x19de('0x51')]);return db['ChatQueue'][_0x19de('0x56')](_0x3b6ab5)['then'](handleEntityNotFound(_0x4d9f79,null))[_0x19de('0x33')](respondWithResult(_0x4d9f79,null))['catch'](handleError(_0x4d9f79,null));};exports['create']=function(_0x18e362,_0x40ebd5){return db[_0x19de('0x3c')][_0x19de('0x57')](_0x18e362[_0x19de('0x58')],{})[_0x19de('0x33')](function(_0x55d85a){var _0x4b5e94=_0x18e362[_0x19de('0x59')][_0x19de('0x35')]({'plain':!![]});if(!_0x4b5e94)throw new Error(_0x19de('0x5a'));if(_0x4b5e94['role']===_0x19de('0x59')){var _0x28027d=_0x55d85a[_0x19de('0x35')]({'plain':!![]});var _0x41d98e=_0x19de('0x36');return db[_0x19de('0x5b')][_0x19de('0x56')]({'where':{'name':_0x41d98e,'userProfileId':_0x4b5e94['userProfileId']},'raw':!![]})[_0x19de('0x33')](function(_0x26f512){if(_0x26f512&&_0x26f512[_0x19de('0x5c')]===0x0){return db[_0x19de('0x37')][_0x19de('0x57')]({'name':_0x28027d[_0x19de('0x39')],'resourceId':_0x28027d['id'],'type':_0x26f512[_0x19de('0x39')],'sectionId':_0x26f512['id']},{})[_0x19de('0x33')](function(){return _0x55d85a;});}else{return _0x55d85a;}})[_0x19de('0x5d')](function(_0x3471e7){logger[_0x19de('0x25')](_0x19de('0x5e'),_0x3471e7);throw _0x3471e7;});}return _0x55d85a;})[_0x19de('0x33')](respondWithResult(_0x40ebd5,0xc9))[_0x19de('0x5d')](handleError(_0x40ebd5,null));};exports[_0x19de('0x32')]=function(_0x447abc,_0x5737ee){if(_0x447abc[_0x19de('0x58')]['id']){delete _0x447abc['body']['id'];}return db['ChatQueue'][_0x19de('0x56')]({'where':{'id':_0x447abc['params']['id']}})['then'](handleEntityNotFound(_0x5737ee,null))[_0x19de('0x33')](saveUpdates(_0x447abc[_0x19de('0x58')],null))['then'](respondWithResult(_0x5737ee,null))[_0x19de('0x5d')](handleError(_0x5737ee,null));};exports[_0x19de('0x34')]=function(_0x1c506d,_0x2b982a){return db[_0x19de('0x3c')]['find']({'where':{'id':_0x1c506d[_0x19de('0x55')]['id']}})[_0x19de('0x33')](handleEntityNotFound(_0x2b982a,null))['then'](removeEntity(_0x2b982a,null))[_0x19de('0x5d')](handleError(_0x2b982a,null));};exports[_0x19de('0x5f')]=function(_0x4c1feb,_0x1f5bb0){return db[_0x19de('0x3c')][_0x19de('0x5f')]()['then'](respondWithResult(_0x1f5bb0,null))[_0x19de('0x5d')](handleError(_0x1f5bb0,null));};exports[_0x19de('0x60')]=function(_0x3e2bea,_0x3aaa05,_0xa75d03){var _0x175b7d={'raw':!![],'where':{}},_0xcbcc16={},_0x3f3b4d;return db[_0x19de('0x3c')][_0x19de('0x61')]({'where':{'id':_0x3e2bea[_0x19de('0x55')]['id']}})['then'](handleEntityNotFound(_0x3aaa05,null))['then'](function(_0x4d4b65){if(_0x4d4b65){_0x3f3b4d=_0x4d4b65[_0x19de('0x35')]({'plain':!![]});_0xcbcc16[_0x19de('0x41')]=_[_0x19de('0x44')](db[_0x19de('0x62')][_0x19de('0x3d')]);_0xcbcc16[_0x19de('0x43')]=_[_0x19de('0x44')](_0x3e2bea[_0x19de('0x43')]);_0xcbcc16['filters']=_[_0x19de('0x46')](_0xcbcc16[_0x19de('0x41')],_0xcbcc16[_0x19de('0x43')]);_0x175b7d['attributes']=_['intersection'](_0xcbcc16[_0x19de('0x41')],qs['fields'](_0x3e2bea['query'][_0x19de('0x48')]));_0x175b7d[_0x19de('0x47')]=_0x175b7d[_0x19de('0x47')][_0x19de('0x49')]?_0x175b7d[_0x19de('0x47')]:_0xcbcc16[_0x19de('0x41')];if(!_0x3e2bea[_0x19de('0x43')]['hasOwnProperty'](_0x19de('0x4a'))){_0x175b7d[_0x19de('0x2d')]=qs['limit'](_0x3e2bea[_0x19de('0x43')][_0x19de('0x2d')]);_0x175b7d[_0x19de('0x2c')]=qs[_0x19de('0x2c')](_0x3e2bea[_0x19de('0x43')][_0x19de('0x2c')]);}_0x175b7d['order']=qs['sort'](_0x3e2bea[_0x19de('0x43')]['sort']);_0x175b7d[_0x19de('0x4d')]=qs[_0x19de('0x45')](_[_0x19de('0x63')](_0x3e2bea[_0x19de('0x43')],_0xcbcc16[_0x19de('0x45')]));_0x175b7d[_0x19de('0x4d')][_0x19de('0x64')]=_0x4d4b65['id'];if(_0x3e2bea[_0x19de('0x43')][_0x19de('0x4e')]){_0x175b7d[_0x19de('0x4d')]=_[_0x19de('0x4f')](_0x175b7d[_0x19de('0x4d')],{'$or':_[_0x19de('0x42')](_0x175b7d[_0x19de('0x47')],function(_0xde7415){var _0x2a9388={};_0x2a9388[_0xde7415]={'$like':'%'+_0x3e2bea['query']['filter']+'%'};return _0x2a9388;})});}_0x175b7d=_[_0x19de('0x4f')]({},_0x175b7d,_0x3e2bea[_0x19de('0x51')]);return db[_0x19de('0x62')]['findAll'](_0x175b7d);}})[_0x19de('0x33')](function(_0x46b3f1){if(_0x46b3f1){return db[_0x19de('0x65')]['findAndCountAll']({'where':{'id':_[_0x19de('0x42')](_0x46b3f1,_0x19de('0x66')),'role':'agent'},'attributes':['id',_0x19de('0x39'),_0x19de('0x67'),_0x19de('0x68'),_0x19de('0x69')]});}})[_0x19de('0x33')](function(_0x20ad6a){if(_0x20ad6a){return{'count':_0x20ad6a[_0x19de('0x52')],'rows':_[_0x19de('0x42')](_0x20ad6a['rows'],function(_0x21cc1f){return{'membername':_0x21cc1f[_0x19de('0x39')],'UserId':_0x21cc1f['id'],'queue_name':_0x3f3b4d[_0x19de('0x39')],'ChatQueueId':_0x3f3b4d['id'],'interface':util[_0x19de('0x6a')](_0x19de('0x6b'),_0x19de('0x6c'),_0x21cc1f[_0x19de('0x39')]),'penalty':0x0,'paused':_0x21cc1f[_0x19de('0x67')],'createdAt':_0x21cc1f[_0x19de('0x69')],'updatedAt':_0x21cc1f[_0x19de('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x19de('0x33')](respondWithFilteredResult(_0x3aaa05,_0x175b7d))[_0x19de('0x5d')](handleError(_0x3aaa05,null));};exports[_0x19de('0x6d')]=function(_0x2559bc,_0x5a3762,_0x590765){var _0x4d94a1={};var _0x1bc15c={};var _0x26ce51;var _0x1a870f;return db[_0x19de('0x3c')][_0x19de('0x61')]({'where':{'id':_0x2559bc[_0x19de('0x55')]['id']}})[_0x19de('0x33')](handleEntityNotFound(_0x5a3762,null))[_0x19de('0x33')](function(_0x30cf86){if(_0x30cf86){_0x26ce51=_0x30cf86;_0x1bc15c['model']=_[_0x19de('0x44')](db[_0x19de('0x6e')][_0x19de('0x3d')]);_0x1bc15c['query']=_[_0x19de('0x44')](_0x2559bc['query']);_0x1bc15c['filters']=_[_0x19de('0x46')](_0x1bc15c['model'],_0x1bc15c[_0x19de('0x43')]);_0x4d94a1[_0x19de('0x47')]=_[_0x19de('0x46')](_0x1bc15c[_0x19de('0x41')],qs[_0x19de('0x48')](_0x2559bc[_0x19de('0x43')]['fields']));_0x4d94a1['attributes']=_0x4d94a1[_0x19de('0x47')][_0x19de('0x49')]?_0x4d94a1[_0x19de('0x47')]:_0x1bc15c[_0x19de('0x41')];_0x4d94a1['order']=qs[_0x19de('0x4c')](_0x2559bc[_0x19de('0x43')]['sort']);_0x4d94a1[_0x19de('0x4d')]=qs[_0x19de('0x45')](_['pick'](_0x2559bc['query'],_0x1bc15c[_0x19de('0x45')]));if(_0x2559bc[_0x19de('0x43')][_0x19de('0x4e')]){_0x4d94a1['where']=_[_0x19de('0x4f')](_0x4d94a1['where'],{'$or':_[_0x19de('0x42')](_0x4d94a1['attributes'],function(_0x8d6f5a){var _0xaae0db={};_0xaae0db[_0x8d6f5a]={'$like':'%'+_0x2559bc[_0x19de('0x43')]['filter']+'%'};return _0xaae0db;})});}_0x4d94a1=_['merge']({},_0x4d94a1,_0x2559bc['options']);return _0x26ce51[_0x19de('0x6d')](_0x4d94a1);}})[_0x19de('0x33')](function(_0x2d8326){if(_0x2d8326){_0x1a870f=_0x2d8326[_0x19de('0x49')];if(!_0x2559bc[_0x19de('0x43')][_0x19de('0x6f')](_0x19de('0x4a'))){_0x4d94a1[_0x19de('0x2d')]=qs[_0x19de('0x2d')](_0x2559bc[_0x19de('0x43')]['limit']);_0x4d94a1[_0x19de('0x2c')]=qs[_0x19de('0x2c')](_0x2559bc[_0x19de('0x43')][_0x19de('0x2c')]);}return _0x26ce51[_0x19de('0x6d')](_0x4d94a1);}})[_0x19de('0x33')](function(_0x1890ed){if(_0x1890ed){return _0x1890ed?{'count':_0x1a870f,'rows':_0x1890ed}:null;}})['then'](respondWithResult(_0x5a3762,null))['catch'](handleError(_0x5a3762,null));};exports['addTeams']=function(_0x47aa5c,_0x564c3e,_0x4ac2a1){var _0x4d673f=_0x47aa5c[_0x19de('0x58')][_0x19de('0x70')];return db[_0x19de('0x6e')]['findAll']({'where':{'id':_0x4d673f},'attributes':['id'],'include':[{'model':db[_0x19de('0x65')],'as':'Agents','attributes':['id',_0x19de('0x39'),_0x19de('0x71'),_0x19de('0x72'),_0x19de('0x73')],'raw':!![]}]})[_0x19de('0x33')](function(_0x555455){if(_0x555455){var _0x3376f9=_[_0x19de('0x74')](_0x555455,function(_0x241ab1){var _0x5dba31=_0x241ab1[_0x19de('0x35')]({'plain':!![]});return _0x5dba31['Agents'];});return db[_0x19de('0x3c')][_0x19de('0x56')]({'where':{'id':_0x47aa5c[_0x19de('0x55')]['id']}})[_0x19de('0x33')](function(_0x59c490){return db[_0x19de('0x75')][_0x19de('0x76')](function(_0x4098cd){return _0x59c490['addTeams'](_0x4d673f,{'transaction':_0x4098cd})[_0x19de('0x33')](function(){return BPromise[_0x19de('0x77')](_0x3376f9,function(_0x3a6acc){return db[_0x19de('0x62')][_0x19de('0x78')]({'where':{'UserId':_0x3a6acc['id'],'ChatQueueId':_0x47aa5c[_0x19de('0x55')]['id']},'transaction':_0x4098cd});});})['then'](function(){_0x3376f9[_0x19de('0x79')](function(_0x559c37){socket['emit'](_0x19de('0x7a'),{'UserId':_0x559c37['id'],'ChatQueueId':_0x59c490['id']});});});});});}})['then'](respondWithStatusCode(_0x564c3e,null))[_0x19de('0x5d')](handleError(_0x564c3e,null));};exports[_0x19de('0x7b')]=function(_0x1c497,_0x43115a,_0x2bfa6c){return db[_0x19de('0x6e')]['findAll']({'where':{'id':_0x1c497[_0x19de('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x19de('0x65')],'as':_0x19de('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x19de('0x33')](handleEntityNotFound(_0x43115a,null))[_0x19de('0x33')](function(_0x4f99df){var _0x197649=_[_0x19de('0x42')](_0x4f99df,'id');var _0x2aa8cf=[];var _0x31bf34=[];var _0x3588bc=squel[_0x19de('0x7d')]();_0x3588bc[_0x19de('0x7e')](_0x19de('0x7f'))[_0x19de('0x80')](_0x19de('0x81'),'tq')[_0x19de('0x82')](_0x19de('0x83'),'ut',_0x19de('0x84'))[_0x19de('0x4d')]('ChatQueueId\x20=\x20?',_0x1c497[_0x19de('0x55')]['id']);for(var _0x87a45c=0x0;_0x87a45c<_0x4f99df[_0x19de('0x49')];_0x87a45c+=0x1){let _0x46fa32=_0x4f99df[_0x87a45c];for(var _0x3baabb=0x0;_0x3baabb<_0x46fa32['Agents'][_0x19de('0x49')];_0x3baabb+=0x1){let _0x241e20=_0x46fa32['Agents'][_0x3baabb];var _0x53fedc=_0x3588bc['clone']();_0x53fedc[_0x19de('0x4d')](_0x19de('0x85'),_0x241e20['id']);_0x31bf34[_0x19de('0x86')](db['sequelize'][_0x19de('0x43')](_0x53fedc['toString'](),{'type':db['sequelize'][_0x19de('0x87')]['SELECT']})[_0x19de('0x33')](function(_0x5e6a73){if(_0x5e6a73['length']===0x1){return _0x241e20['id'];}else{var _0x26f543=_[_0x19de('0x88')](_[_0x19de('0x42')](_0x5e6a73,_0x19de('0x89')),function(_0x33802c){return _['includes'](_0x197649,_0x33802c);});if(_0x26f543){return _0x241e20['id'];}}}));}}return BPromise['all'](_0x31bf34)['then'](function(_0x383509){_0x2aa8cf=_(_0x2aa8cf)[_0x19de('0x8a')](_0x383509)[_0x19de('0x8b')]()['value']();return db[_0x19de('0x3c')]['find']({'where':{'id':_0x1c497['params']['id']}})['then'](function(_0x2e2f6c){return db['sequelize'][_0x19de('0x76')](function(_0x1d9739){return _0x2e2f6c['removeTeams'](_0x1c497[_0x19de('0x43')][_0x19de('0x70')],{'transaction':_0x1d9739})['then'](function(){if(!_['isEmpty'](_0x2aa8cf)){return _0x2e2f6c[_0x19de('0x8c')](_0x2aa8cf,{'transaction':_0x1d9739});}})[_0x19de('0x33')](function(){_0x2aa8cf[_0x19de('0x79')](function(_0x1a6a0b){socket[_0x19de('0x8d')](_0x19de('0x8e'),{'UserId':_0x1a6a0b,'ChatQueueId':_0x2e2f6c['id']});});});});});});})[_0x19de('0x33')](respondWithStatusCode(_0x43115a,null))[_0x19de('0x5d')](handleError(_0x43115a,null));};exports[_0x19de('0x8f')]=function(_0x4129f3,_0x55932a,_0x25851e){return db[_0x19de('0x3c')][_0x19de('0x56')]({'where':{'id':_0x4129f3[_0x19de('0x55')]['id']}})[_0x19de('0x33')](handleEntityNotFound(_0x55932a,null))[_0x19de('0x33')](function(_0x2b9911){if(_0x2b9911){return _0x2b9911[_0x19de('0x8f')](_0x4129f3[_0x19de('0x58')][_0x19de('0x70')],_[_0x19de('0x90')](_0x4129f3[_0x19de('0x58')],[_0x19de('0x70'),'id'])||{})[_0x19de('0x91')](function(_0x3241d4){for(var _0x36b379=0x0;_0x36b379<_0x4129f3[_0x19de('0x58')]['ids'][_0x19de('0x49')];_0x36b379+=0x1){socket['emit'](_0x19de('0x7a'),{'UserId':_0x4129f3[_0x19de('0x58')][_0x19de('0x70')][_0x36b379],'ChatQueueId':_0x4129f3[_0x19de('0x55')]['id']});}return _0x3241d4;});}})[_0x19de('0x33')](respondWithResult(_0x55932a,null))[_0x19de('0x5d')](handleError(_0x55932a,null));};exports['removeAgents']=function(_0x3f41da,_0x3d0c1c,_0x37c76f){return db['ChatQueue'][_0x19de('0x56')]({'where':{'id':_0x3f41da[_0x19de('0x55')]['id']}})[_0x19de('0x33')](handleEntityNotFound(_0x3d0c1c,null))['then'](function(_0x15969b){if(_0x15969b){return _0x15969b[_0x19de('0x8c')](_0x3f41da[_0x19de('0x43')][_0x19de('0x70')])['then'](function(){if(_[_0x19de('0x92')](_0x3f41da[_0x19de('0x43')][_0x19de('0x70')])){for(var _0x2c74d7=0x0;_0x2c74d7<_0x3f41da[_0x19de('0x43')][_0x19de('0x70')]['length'];_0x2c74d7+=0x1){socket[_0x19de('0x8d')]('userChatQueue:remove',{'UserId':Number(_0x3f41da[_0x19de('0x43')][_0x19de('0x70')][_0x2c74d7]),'ChatQueueId':Number(_0x3f41da['params']['id'])});}}else{socket[_0x19de('0x8d')](_0x19de('0x8e'),{'UserId':Number(_0x3f41da[_0x19de('0x43')][_0x19de('0x70')]),'ChatQueueId':Number(_0x3f41da[_0x19de('0x55')]['id'])});}});}})[_0x19de('0x33')](respondWithStatusCode(_0x3d0c1c,null))[_0x19de('0x5d')](handleError(_0x3d0c1c,null));};exports[_0x19de('0x93')]=function(_0x5004b6,_0x1752a2,_0x4f4f35){var _0x4233ac={};var _0x3afaaa={};var _0x400de5;var _0x5e64d9;return db[_0x19de('0x3c')][_0x19de('0x61')]({'where':{'id':_0x5004b6['params']['id']}})[_0x19de('0x33')](handleEntityNotFound(_0x1752a2,null))[_0x19de('0x33')](function(_0x165cf5){if(_0x165cf5){_0x400de5=_0x165cf5;_0x3afaaa[_0x19de('0x41')]=_[_0x19de('0x44')](db['User'][_0x19de('0x3d')]);_0x3afaaa[_0x19de('0x43')]=_[_0x19de('0x44')](_0x5004b6[_0x19de('0x43')]);_0x3afaaa[_0x19de('0x45')]=_['intersection'](_0x3afaaa[_0x19de('0x41')],_0x3afaaa['query']);_0x4233ac[_0x19de('0x47')]=_['intersection'](_0x3afaaa[_0x19de('0x41')],qs[_0x19de('0x48')](_0x5004b6['query'][_0x19de('0x48')]));_0x4233ac['attributes']=_0x4233ac[_0x19de('0x47')][_0x19de('0x49')]?_0x4233ac[_0x19de('0x47')]:_0x3afaaa['model'];_0x4233ac[_0x19de('0x4b')]=qs[_0x19de('0x4c')](_0x5004b6[_0x19de('0x43')][_0x19de('0x4c')]);_0x4233ac['where']=qs[_0x19de('0x45')](_['pick'](_0x5004b6[_0x19de('0x43')],_0x3afaaa['filters']));if(_0x5004b6['query'][_0x19de('0x4e')]){_0x4233ac[_0x19de('0x4d')]=_[_0x19de('0x4f')](_0x4233ac[_0x19de('0x4d')],{'$or':_[_0x19de('0x42')](_0x4233ac['attributes'],function(_0x409fb7){var _0x1ec336={};_0x1ec336[_0x409fb7]={'$like':'%'+_0x5004b6[_0x19de('0x43')][_0x19de('0x4e')]+'%'};return _0x1ec336;})});}_0x4233ac=_[_0x19de('0x4f')]({},_0x4233ac,_0x5004b6[_0x19de('0x51')]);return _0x400de5[_0x19de('0x93')](_0x4233ac);}})['then'](function(_0x227c26){if(_0x227c26){_0x5e64d9=_0x227c26[_0x19de('0x49')];if(!_0x5004b6[_0x19de('0x43')][_0x19de('0x6f')](_0x19de('0x4a'))){_0x4233ac['limit']=qs['limit'](_0x5004b6[_0x19de('0x43')][_0x19de('0x2d')]);_0x4233ac[_0x19de('0x2c')]=qs[_0x19de('0x2c')](_0x5004b6['query'][_0x19de('0x2c')]);}return _0x400de5[_0x19de('0x93')](_0x4233ac);}})['then'](function(_0x21e07a){if(_0x21e07a){return _0x21e07a?{'count':_0x5e64d9,'rows':_0x21e07a}:null;}})['then'](respondWithResult(_0x1752a2,null))['catch'](handleError(_0x1752a2,null));}; \ No newline at end of file +var _0x173f=['register','jayson/promise','client','http','test','Sequelize','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','rows','show','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','chatPause','Team','getTeams','ids','Agents','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','includes','all','compact','value','removeAgents','forEach','emit','userChatQueue:remove','addAgents','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x4146b4,_0x274b03){var _0x5133de=function(_0x12c37e){while(--_0x12c37e){_0x4146b4['push'](_0x4146b4['shift']());}};_0x5133de(++_0x274b03);}(_0x173f,0x19b));var _0xf173=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x173f[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf173('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf173('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf173('0x2'));var moment=require(_0xf173('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf173('0x4'));var util=require(_0xf173('0x5'));var path=require('path');var sox=require(_0xf173('0x6'));var csv=require(_0xf173('0x7'));var ejs=require(_0xf173('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf173('0x9'));var deskjs=require(_0xf173('0xa'));var toCsv=require(_0xf173('0x7'));var querystring=require(_0xf173('0xb'));var Papa=require('papaparse');var Redis=require(_0xf173('0xc'));var authService=require(_0xf173('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf173('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xf173('0xf'));var db=require(_0xf173('0x10'))['db'];config[_0xf173('0x11')]=_[_0xf173('0x12')](config['redis'],{'host':_0xf173('0x13'),'port':0x18eb});var socket=require(_0xf173('0x14'))(new Redis(config[_0xf173('0x11')]));require('./chatQueue.socket')[_0xf173('0x15')](socket);var jayson=require(_0xf173('0x16'));var client=jayson[_0xf173('0x17')][_0xf173('0x18')]({'port':0x232a});function checkPasswordPattern(_0x28d1e5,_0xcb07db,_0x52b763){if(_0x52b763){var _0x3f4269=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f4269[_0xf173('0x19')](_0xcb07db)){return _0x28d1e5;}else{throw new db[(_0xf173('0x1a'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x28d1e5;}}function respondWithRpcPromise(_0x21efe1,_0x2db2e4,_0x230262,_0x335dbd){return new BPromise(function(_0x353338,_0x2438ce){var _0x159278=_0x335dbd||client;return _0x159278[_0xf173('0x1b')](_0x21efe1,_0x230262)[_0xf173('0x1c')](function(_0x43f603){logger[_0xf173('0x1d')](_0xf173('0x1e'),_0x2db2e4,_0xf173('0x1f'));logger['debug'](_0xf173('0x20'),_0x2db2e4,_0xf173('0x1f'),JSON[_0xf173('0x21')](_0x43f603));if(_0x43f603[_0xf173('0x22')]){if(_0x43f603[_0xf173('0x22')]['code']===0x1f4){logger[_0xf173('0x22')](_0xf173('0x1e'),_0x2db2e4,_0x43f603[_0xf173('0x22')][_0xf173('0x23')]);return _0x2438ce(_0x43f603[_0xf173('0x22')][_0xf173('0x23')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2db2e4,_0x43f603['error'][_0xf173('0x23')]);return _0x353338(_0x43f603[_0xf173('0x22')]['message']);}else{logger[_0xf173('0x1d')](_0xf173('0x1e'),_0x2db2e4,_0xf173('0x1f'));_0x353338(_0x43f603[_0xf173('0x24')][_0xf173('0x23')]);}})[_0xf173('0x25')](function(_0x573e43){logger[_0xf173('0x22')]('ChatQueue,\x20%s,\x20%s',_0x2db2e4,_0x573e43);_0x2438ce(_0x573e43);});});}function respondWithStatusCode(_0x317d91,_0x5ab8ef){_0x5ab8ef=_0x5ab8ef||0xcc;return function(_0x57be37){if(_0x57be37){return _0x317d91[_0xf173('0x26')](_0x5ab8ef);}return _0x317d91[_0xf173('0x27')](_0x5ab8ef)[_0xf173('0x28')]();};}function respondWithResult(_0x4103c8,_0x3b07ca){_0x3b07ca=_0x3b07ca||0xc8;return function(_0x4a3a1a){if(_0x4a3a1a){return _0x4103c8[_0xf173('0x27')](_0x3b07ca)[_0xf173('0x29')](_0x4a3a1a);}};}function respondWithFilteredResult(_0xc96af5,_0xaee760){return function(_0x37d97d){if(_0x37d97d){var _0xa0b406=_0x37d97d[_0xf173('0x2a')],_0x32a2fe=_0xaee760[_0xf173('0x2b')],_0x56854a=_0xaee760[_0xf173('0x2b')]+_0xaee760[_0xf173('0x2c')],_0x2cc2c7;if(_0x56854a>=_0xa0b406){_0x56854a=_0xa0b406;_0x2cc2c7=0xc8;}else{_0x2cc2c7=0xce;}_0xc96af5['status'](_0x2cc2c7);return _0xc96af5[_0xf173('0x2d')]('Content-Range',_0x32a2fe+'-'+_0x56854a+'/'+_0xa0b406)['json'](_0x37d97d);}return null;};}function patchUpdates(_0x2b35ba){return function(_0x415f52){try{jsonpatch[_0xf173('0x2e')](_0x415f52,_0x2b35ba,!![]);}catch(_0x18fd56){return BPromise['reject'](_0x18fd56);}return _0x415f52[_0xf173('0x2f')]();};}function saveUpdates(_0x1195f9,_0x1b78ae){return function(_0x2765c3){if(_0x2765c3){return _0x2765c3['update'](_0x1195f9)[_0xf173('0x1c')](function(_0x4fff7c){return _0x4fff7c;});}return null;};}function removeEntity(_0xef0d36,_0x2e476b){return function(_0x2f4f60){if(_0x2f4f60){return _0x2f4f60['destroy']()['then'](function(){var _0x47c569=_0x2f4f60['get']({'plain':!![]});var _0x3fc4e4='ChatQueues';return db[_0xf173('0x30')][_0xf173('0x31')]({'where':{'type':_0x3fc4e4,'resourceId':_0x47c569['id']}})[_0xf173('0x1c')](function(){return _0x2f4f60;});})[_0xf173('0x1c')](function(){_0xef0d36['status'](0xcc)[_0xf173('0x28')]();});}};}function handleEntityNotFound(_0x4eda49,_0x5d1ef7){return function(_0x1896d2){if(!_0x1896d2){_0x4eda49[_0xf173('0x26')](0x194);}return _0x1896d2;};}function handleError(_0x430603,_0x1c9a0d){_0x1c9a0d=_0x1c9a0d||0x1f4;return function(_0x34952e){logger[_0xf173('0x22')](_0x34952e[_0xf173('0x32')]);if(_0x34952e[_0xf173('0x33')]){delete _0x34952e[_0xf173('0x33')];}_0x430603[_0xf173('0x27')](_0x1c9a0d)[_0xf173('0x34')](_0x34952e);};}exports[_0xf173('0x35')]=function(_0x3f5972,_0x58e33d){var _0x3f3002={},_0x413feb={},_0x291458={'count':0x0,'rows':[]};var _0x5cde5f=_[_0xf173('0x36')](db[_0xf173('0x37')]['rawAttributes'],function(_0x1c4cd8){return{'name':_0x1c4cd8['fieldName'],'type':_0x1c4cd8['type'][_0xf173('0x38')]};});_0x413feb[_0xf173('0x39')]=_['map'](_0x5cde5f,_0xf173('0x33'));_0x413feb[_0xf173('0x3a')]=_[_0xf173('0x3b')](_0x3f5972[_0xf173('0x3a')]);_0x413feb[_0xf173('0x3c')]=_[_0xf173('0x3d')](_0x413feb[_0xf173('0x39')],_0x413feb['query']);_0x3f3002[_0xf173('0x3e')]=_[_0xf173('0x3d')](_0x413feb[_0xf173('0x39')],qs[_0xf173('0x3f')](_0x3f5972[_0xf173('0x3a')]['fields']));_0x3f3002[_0xf173('0x3e')]=_0x3f3002[_0xf173('0x3e')][_0xf173('0x40')]?_0x3f3002[_0xf173('0x3e')]:_0x413feb[_0xf173('0x39')];if(!_0x3f5972[_0xf173('0x3a')][_0xf173('0x41')](_0xf173('0x42'))){_0x3f3002[_0xf173('0x2c')]=qs[_0xf173('0x2c')](_0x3f5972['query'][_0xf173('0x2c')]);_0x3f3002[_0xf173('0x2b')]=qs[_0xf173('0x2b')](_0x3f5972['query'][_0xf173('0x2b')]);}_0x3f3002[_0xf173('0x43')]=qs[_0xf173('0x44')](_0x3f5972[_0xf173('0x3a')][_0xf173('0x44')]);_0x3f3002[_0xf173('0x45')]=qs[_0xf173('0x3c')](_[_0xf173('0x46')](_0x3f5972['query'],_0x413feb['filters']),_0x5cde5f);if(_0x3f5972[_0xf173('0x3a')][_0xf173('0x47')]){_0x3f3002[_0xf173('0x45')]=_['merge'](_0x3f3002[_0xf173('0x45')],{'$or':_[_0xf173('0x36')](_0x5cde5f,function(_0x4001a9){if(_0x4001a9[_0xf173('0x48')]!==_0xf173('0x49')){var _0x25cb6a={};_0x25cb6a[_0x4001a9['name']]={'$like':'%'+_0x3f5972[_0xf173('0x3a')][_0xf173('0x47')]+'%'};return _0x25cb6a;}})});}_0x3f3002=_[_0xf173('0x4a')]({},_0x3f3002,_0x3f5972['options']);var _0x541bc1={'where':_0x3f3002['where']};return db[_0xf173('0x37')][_0xf173('0x2a')](_0x541bc1)[_0xf173('0x1c')](function(_0x1ca7f6){_0x291458['count']=_0x1ca7f6;if(_0x3f5972[_0xf173('0x3a')][_0xf173('0x4b')]){_0x3f3002[_0xf173('0x4c')]=[{'all':!![]}];}return db[_0xf173('0x37')]['findAll'](_0x3f3002);})['then'](function(_0x4856a1){_0x291458[_0xf173('0x4d')]=_0x4856a1;return _0x291458;})[_0xf173('0x1c')](respondWithFilteredResult(_0x58e33d,_0x3f3002))['catch'](handleError(_0x58e33d,null));};exports[_0xf173('0x4e')]=function(_0x5dfbd2,_0x26f537){var _0x3706a2={'raw':!![],'where':{'id':_0x5dfbd2['params']['id']}},_0x47ad3d={};_0x47ad3d[_0xf173('0x39')]=_[_0xf173('0x3b')](db[_0xf173('0x37')][_0xf173('0x4f')]);_0x47ad3d[_0xf173('0x3a')]=_[_0xf173('0x3b')](_0x5dfbd2['query']);_0x47ad3d[_0xf173('0x3c')]=_[_0xf173('0x3d')](_0x47ad3d[_0xf173('0x39')],_0x47ad3d[_0xf173('0x3a')]);_0x3706a2[_0xf173('0x3e')]=_['intersection'](_0x47ad3d[_0xf173('0x39')],qs[_0xf173('0x3f')](_0x5dfbd2[_0xf173('0x3a')][_0xf173('0x3f')]));_0x3706a2[_0xf173('0x3e')]=_0x3706a2[_0xf173('0x3e')]['length']?_0x3706a2[_0xf173('0x3e')]:_0x47ad3d[_0xf173('0x39')];if(_0x5dfbd2[_0xf173('0x3a')][_0xf173('0x4b')]){_0x3706a2[_0xf173('0x4c')]=[{'all':!![]}];}_0x3706a2=_[_0xf173('0x4a')]({},_0x3706a2,_0x5dfbd2[_0xf173('0x50')]);return db['ChatQueue'][_0xf173('0x51')](_0x3706a2)[_0xf173('0x1c')](handleEntityNotFound(_0x26f537,null))[_0xf173('0x1c')](respondWithResult(_0x26f537,null))[_0xf173('0x25')](handleError(_0x26f537,null));};exports[_0xf173('0x52')]=function(_0x3b059d,_0x478d56){return db[_0xf173('0x37')][_0xf173('0x52')](_0x3b059d[_0xf173('0x53')],{})[_0xf173('0x1c')](function(_0x214d4a){var _0x3484ee=_0x3b059d['user'][_0xf173('0x54')]({'plain':!![]});if(!_0x3484ee)throw new Error(_0xf173('0x55'));if(_0x3484ee[_0xf173('0x56')]===_0xf173('0x57')){var _0x2407a2=_0x214d4a[_0xf173('0x54')]({'plain':!![]});var _0x4e9546=_0xf173('0x58');return db['UserProfileSection'][_0xf173('0x51')]({'where':{'name':_0x4e9546,'userProfileId':_0x3484ee['userProfileId']},'raw':!![]})[_0xf173('0x1c')](function(_0x398ac8){if(_0x398ac8&&_0x398ac8[_0xf173('0x59')]===0x0){return db[_0xf173('0x30')][_0xf173('0x52')]({'name':_0x2407a2[_0xf173('0x33')],'resourceId':_0x2407a2['id'],'type':_0x398ac8['name'],'sectionId':_0x398ac8['id']},{})['then'](function(){return _0x214d4a;});}else{return _0x214d4a;}})[_0xf173('0x25')](function(_0xb5a9ef){logger[_0xf173('0x22')](_0xf173('0x5a'),_0xb5a9ef);throw _0xb5a9ef;});}return _0x214d4a;})[_0xf173('0x1c')](respondWithResult(_0x478d56,0xc9))[_0xf173('0x25')](handleError(_0x478d56,null));};exports[_0xf173('0x5b')]=function(_0x47b54d,_0x3c9d68){if(_0x47b54d[_0xf173('0x53')]['id']){delete _0x47b54d[_0xf173('0x53')]['id'];}return db['ChatQueue'][_0xf173('0x51')]({'where':{'id':_0x47b54d[_0xf173('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c9d68,null))['then'](saveUpdates(_0x47b54d[_0xf173('0x53')],null))[_0xf173('0x1c')](respondWithResult(_0x3c9d68,null))['catch'](handleError(_0x3c9d68,null));};exports['destroy']=function(_0x5ed73b,_0x26788a){return db[_0xf173('0x37')][_0xf173('0x51')]({'where':{'id':_0x5ed73b['params']['id']}})[_0xf173('0x1c')](handleEntityNotFound(_0x26788a,null))['then'](removeEntity(_0x26788a,null))['catch'](handleError(_0x26788a,null));};exports[_0xf173('0x5d')]=function(_0x1516b3,_0xf47e80){return db[_0xf173('0x37')]['describe']()[_0xf173('0x1c')](respondWithResult(_0xf47e80,null))['catch'](handleError(_0xf47e80,null));};exports['getMembers']=function(_0x4a3201,_0x476830,_0x3de514){var _0x4ccb6a={'raw':!![],'where':{}},_0x37165d={},_0x202557;return db['ChatQueue'][_0xf173('0x5e')]({'where':{'id':_0x4a3201[_0xf173('0x5c')]['id']}})[_0xf173('0x1c')](handleEntityNotFound(_0x476830,null))[_0xf173('0x1c')](function(_0x3d4b08){if(_0x3d4b08){_0x202557=_0x3d4b08['get']({'plain':!![]});_0x37165d[_0xf173('0x39')]=_['keys'](db[_0xf173('0x5f')]['rawAttributes']);_0x37165d[_0xf173('0x3a')]=_[_0xf173('0x3b')](_0x4a3201[_0xf173('0x3a')]);_0x37165d['filters']=_['intersection'](_0x37165d[_0xf173('0x39')],_0x37165d[_0xf173('0x3a')]);_0x4ccb6a['attributes']=_[_0xf173('0x3d')](_0x37165d[_0xf173('0x39')],qs[_0xf173('0x3f')](_0x4a3201[_0xf173('0x3a')][_0xf173('0x3f')]));_0x4ccb6a[_0xf173('0x3e')]=_0x4ccb6a['attributes']['length']?_0x4ccb6a[_0xf173('0x3e')]:_0x37165d[_0xf173('0x39')];if(!_0x4a3201[_0xf173('0x3a')][_0xf173('0x41')](_0xf173('0x42'))){_0x4ccb6a[_0xf173('0x2c')]=qs['limit'](_0x4a3201[_0xf173('0x3a')][_0xf173('0x2c')]);_0x4ccb6a[_0xf173('0x2b')]=qs[_0xf173('0x2b')](_0x4a3201[_0xf173('0x3a')][_0xf173('0x2b')]);}_0x4ccb6a[_0xf173('0x43')]=qs['sort'](_0x4a3201[_0xf173('0x3a')]['sort']);_0x4ccb6a[_0xf173('0x45')]=qs['filters'](_[_0xf173('0x46')](_0x4a3201[_0xf173('0x3a')],_0x37165d[_0xf173('0x3c')]));_0x4ccb6a[_0xf173('0x45')][_0xf173('0x60')]=_0x3d4b08['id'];if(_0x4a3201[_0xf173('0x3a')][_0xf173('0x47')]){_0x4ccb6a[_0xf173('0x45')]=_[_0xf173('0x4a')](_0x4ccb6a[_0xf173('0x45')],{'$or':_[_0xf173('0x36')](_0x4ccb6a['attributes'],function(_0x3cc0da){var _0x2e37df={};_0x2e37df[_0x3cc0da]={'$like':'%'+_0x4a3201['query']['filter']+'%'};return _0x2e37df;})});}_0x4ccb6a=_[_0xf173('0x4a')]({},_0x4ccb6a,_0x4a3201[_0xf173('0x50')]);return db[_0xf173('0x5f')][_0xf173('0x61')](_0x4ccb6a);}})[_0xf173('0x1c')](function(_0x369f38){if(_0x369f38){return db[_0xf173('0x62')][_0xf173('0x63')]({'where':{'id':_['map'](_0x369f38,_0xf173('0x64')),'role':'agent'},'attributes':['id',_0xf173('0x33'),'chatPause',_0xf173('0x65'),_0xf173('0x66')]});}})[_0xf173('0x1c')](function(_0x28064c){if(_0x28064c){return{'count':_0x28064c['count'],'rows':_[_0xf173('0x36')](_0x28064c['rows'],function(_0x41f948){return{'membername':_0x41f948[_0xf173('0x33')],'UserId':_0x41f948['id'],'queue_name':_0x202557[_0xf173('0x33')],'ChatQueueId':_0x202557['id'],'interface':util[_0xf173('0x67')](_0xf173('0x68'),_0xf173('0x69'),_0x41f948[_0xf173('0x33')]),'penalty':0x0,'paused':_0x41f948[_0xf173('0x6a')],'createdAt':_0x41f948[_0xf173('0x66')],'updatedAt':_0x41f948[_0xf173('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf173('0x1c')](respondWithFilteredResult(_0x476830,_0x4ccb6a))[_0xf173('0x25')](handleError(_0x476830,null));};exports['getTeams']=function(_0x941fa8,_0x74e19c,_0xffc10a){var _0xaa29f7={};var _0x172b30={};var _0x2bf823;var _0x32d416;return db[_0xf173('0x37')][_0xf173('0x5e')]({'where':{'id':_0x941fa8[_0xf173('0x5c')]['id']}})[_0xf173('0x1c')](handleEntityNotFound(_0x74e19c,null))[_0xf173('0x1c')](function(_0x4b93c8){if(_0x4b93c8){_0x2bf823=_0x4b93c8;_0x172b30[_0xf173('0x39')]=_[_0xf173('0x3b')](db[_0xf173('0x6b')][_0xf173('0x4f')]);_0x172b30['query']=_[_0xf173('0x3b')](_0x941fa8['query']);_0x172b30['filters']=_[_0xf173('0x3d')](_0x172b30[_0xf173('0x39')],_0x172b30[_0xf173('0x3a')]);_0xaa29f7[_0xf173('0x3e')]=_[_0xf173('0x3d')](_0x172b30[_0xf173('0x39')],qs[_0xf173('0x3f')](_0x941fa8[_0xf173('0x3a')][_0xf173('0x3f')]));_0xaa29f7[_0xf173('0x3e')]=_0xaa29f7['attributes'][_0xf173('0x40')]?_0xaa29f7[_0xf173('0x3e')]:_0x172b30[_0xf173('0x39')];_0xaa29f7[_0xf173('0x43')]=qs[_0xf173('0x44')](_0x941fa8[_0xf173('0x3a')][_0xf173('0x44')]);_0xaa29f7[_0xf173('0x45')]=qs[_0xf173('0x3c')](_[_0xf173('0x46')](_0x941fa8[_0xf173('0x3a')],_0x172b30[_0xf173('0x3c')]));if(_0x941fa8['query'][_0xf173('0x47')]){_0xaa29f7['where']=_[_0xf173('0x4a')](_0xaa29f7['where'],{'$or':_[_0xf173('0x36')](_0xaa29f7[_0xf173('0x3e')],function(_0x29ad1a){var _0x3c66d9={};_0x3c66d9[_0x29ad1a]={'$like':'%'+_0x941fa8[_0xf173('0x3a')][_0xf173('0x47')]+'%'};return _0x3c66d9;})});}_0xaa29f7=_[_0xf173('0x4a')]({},_0xaa29f7,_0x941fa8[_0xf173('0x50')]);return _0x2bf823[_0xf173('0x6c')](_0xaa29f7);}})[_0xf173('0x1c')](function(_0x453bef){if(_0x453bef){_0x32d416=_0x453bef[_0xf173('0x40')];if(!_0x941fa8[_0xf173('0x3a')]['hasOwnProperty'](_0xf173('0x42'))){_0xaa29f7[_0xf173('0x2c')]=qs[_0xf173('0x2c')](_0x941fa8[_0xf173('0x3a')][_0xf173('0x2c')]);_0xaa29f7[_0xf173('0x2b')]=qs['offset'](_0x941fa8[_0xf173('0x3a')]['offset']);}return _0x2bf823[_0xf173('0x6c')](_0xaa29f7);}})['then'](function(_0x3202e2){if(_0x3202e2){return _0x3202e2?{'count':_0x32d416,'rows':_0x3202e2}:null;}})[_0xf173('0x1c')](respondWithResult(_0x74e19c,null))[_0xf173('0x25')](handleError(_0x74e19c,null));};exports['addTeams']=function(_0x1be031,_0x50de82,_0x475b46){var _0x2ad2d1=_0x1be031[_0xf173('0x53')][_0xf173('0x6d')];return db[_0xf173('0x6b')][_0xf173('0x61')]({'where':{'id':_0x2ad2d1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf173('0x6e'),'attributes':['id',_0xf173('0x33'),'online',_0xf173('0x6f'),_0xf173('0x70')],'raw':!![]}]})['then'](function(_0x9cb5ce){if(_0x9cb5ce){var _0xb00c7f=_[_0xf173('0x71')](_0x9cb5ce,function(_0x542002){var _0x3485ab=_0x542002['get']({'plain':!![]});return _0x3485ab['Agents'];});return db[_0xf173('0x37')][_0xf173('0x51')]({'where':{'id':_0x1be031[_0xf173('0x5c')]['id']}})['then'](function(_0x3e9c7a){return db['sequelize'][_0xf173('0x72')](function(_0x56c7cf){return _0x3e9c7a[_0xf173('0x73')](_0x2ad2d1,{'transaction':_0x56c7cf})[_0xf173('0x1c')](function(){return BPromise[_0xf173('0x74')](_0xb00c7f,function(_0x2d773c){return db[_0xf173('0x5f')][_0xf173('0x75')]({'where':{'UserId':_0x2d773c['id'],'ChatQueueId':_0x1be031[_0xf173('0x5c')]['id']},'transaction':_0x56c7cf});});})[_0xf173('0x1c')](function(){_0xb00c7f['forEach'](function(_0x52e5b7){socket['emit'](_0xf173('0x76'),{'UserId':_0x52e5b7['id'],'ChatQueueId':_0x3e9c7a['id']});});});});});}})[_0xf173('0x1c')](respondWithStatusCode(_0x50de82,null))[_0xf173('0x25')](handleError(_0x50de82,null));};exports[_0xf173('0x77')]=function(_0x20327e,_0x246b1b,_0xd5f277){return db['Team'][_0xf173('0x61')]({'where':{'id':_0x20327e[_0xf173('0x3a')][_0xf173('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xf173('0x62')],'as':_0xf173('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x246b1b,null))['then'](function(_0x3b92b6){var _0x48cbb0=_['map'](_0x3b92b6,'id');var _0x44500e=[];var _0x5940ac=[];var _0x2f9ab6=squel[_0xf173('0x78')]();_0x2f9ab6[_0xf173('0x79')](_0xf173('0x7a'))['from'](_0xf173('0x7b'),'tq')[_0xf173('0x7c')](_0xf173('0x7d'),'ut',_0xf173('0x7e'))[_0xf173('0x45')]('ChatQueueId\x20=\x20?',_0x20327e['params']['id']);for(var _0xb86386=0x0;_0xb86386<_0x3b92b6[_0xf173('0x40')];_0xb86386+=0x1){let _0x504f47=_0x3b92b6[_0xb86386];for(var _0x579015=0x0;_0x579015<_0x504f47[_0xf173('0x6e')][_0xf173('0x40')];_0x579015+=0x1){let _0x5e08ff=_0x504f47['Agents'][_0x579015];var _0x1a463c=_0x2f9ab6[_0xf173('0x7f')]();_0x1a463c[_0xf173('0x45')](_0xf173('0x80'),_0x5e08ff['id']);_0x5940ac[_0xf173('0x81')](db[_0xf173('0x82')][_0xf173('0x3a')](_0x1a463c[_0xf173('0x83')](),{'type':db[_0xf173('0x82')]['QueryTypes']['SELECT']})['then'](function(_0x3a5101){if(_0x3a5101[_0xf173('0x40')]===0x1){return _0x5e08ff['id'];}else{var _0x4ef5ec=_[_0xf173('0x84')](_['map'](_0x3a5101,_0xf173('0x85')),function(_0x4d265f){return _[_0xf173('0x86')](_0x48cbb0,_0x4d265f);});if(_0x4ef5ec){return _0x5e08ff['id'];}}}));}}return BPromise[_0xf173('0x87')](_0x5940ac)[_0xf173('0x1c')](function(_0x3d00b4){_0x44500e=_(_0x44500e)['union'](_0x3d00b4)[_0xf173('0x88')]()[_0xf173('0x89')]();return db[_0xf173('0x37')][_0xf173('0x51')]({'where':{'id':_0x20327e[_0xf173('0x5c')]['id']}})[_0xf173('0x1c')](function(_0x3392c1){return db[_0xf173('0x82')]['transaction'](function(_0x173070){return _0x3392c1[_0xf173('0x77')](_0x20327e[_0xf173('0x3a')]['ids'],{'transaction':_0x173070})[_0xf173('0x1c')](function(){if(!_['isEmpty'](_0x44500e)){return _0x3392c1[_0xf173('0x8a')](_0x44500e,{'transaction':_0x173070});}})[_0xf173('0x1c')](function(){_0x44500e[_0xf173('0x8b')](function(_0x3deea3){socket[_0xf173('0x8c')](_0xf173('0x8d'),{'UserId':_0x3deea3,'ChatQueueId':_0x3392c1['id']});});});});});});})[_0xf173('0x1c')](respondWithStatusCode(_0x246b1b,null))[_0xf173('0x25')](handleError(_0x246b1b,null));};exports[_0xf173('0x8e')]=function(_0x657807,_0x4e7679,_0x522c2d){return db[_0xf173('0x37')][_0xf173('0x51')]({'where':{'id':_0x657807[_0xf173('0x5c')]['id']}})[_0xf173('0x1c')](handleEntityNotFound(_0x4e7679,null))[_0xf173('0x1c')](function(_0x4830a4){if(_0x4830a4){return _0x4830a4['addAgents'](_0x657807[_0xf173('0x53')][_0xf173('0x6d')],_['omit'](_0x657807[_0xf173('0x53')],[_0xf173('0x6d'),'id'])||{})['spread'](function(_0x20cbc5){for(var _0x421885=0x0;_0x421885<_0x657807[_0xf173('0x53')][_0xf173('0x6d')][_0xf173('0x40')];_0x421885+=0x1){socket['emit'](_0xf173('0x76'),{'UserId':_0x657807[_0xf173('0x53')][_0xf173('0x6d')][_0x421885],'ChatQueueId':_0x657807['params']['id']});}return _0x20cbc5;});}})[_0xf173('0x1c')](respondWithResult(_0x4e7679,null))[_0xf173('0x25')](handleError(_0x4e7679,null));};exports[_0xf173('0x8a')]=function(_0x379d59,_0x192a7b,_0x146f44){return db[_0xf173('0x37')][_0xf173('0x51')]({'where':{'id':_0x379d59[_0xf173('0x5c')]['id']}})[_0xf173('0x1c')](handleEntityNotFound(_0x192a7b,null))['then'](function(_0x412421){if(_0x412421){return _0x412421[_0xf173('0x8a')](_0x379d59['query'][_0xf173('0x6d')])[_0xf173('0x1c')](function(){if(_['isArray'](_0x379d59[_0xf173('0x3a')][_0xf173('0x6d')])){for(var _0x55910e=0x0;_0x55910e<_0x379d59[_0xf173('0x3a')][_0xf173('0x6d')][_0xf173('0x40')];_0x55910e+=0x1){socket[_0xf173('0x8c')](_0xf173('0x8d'),{'UserId':Number(_0x379d59[_0xf173('0x3a')]['ids'][_0x55910e]),'ChatQueueId':Number(_0x379d59[_0xf173('0x5c')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x379d59[_0xf173('0x3a')][_0xf173('0x6d')]),'ChatQueueId':Number(_0x379d59[_0xf173('0x5c')]['id'])});}});}})[_0xf173('0x1c')](respondWithStatusCode(_0x192a7b,null))[_0xf173('0x25')](handleError(_0x192a7b,null));};exports['getAgents']=function(_0x4ae11c,_0x511720,_0x4df1b6){var _0x51d26b={};var _0x28e4a3={};var _0x1c240d;var _0x1b49df;return db[_0xf173('0x37')][_0xf173('0x5e')]({'where':{'id':_0x4ae11c[_0xf173('0x5c')]['id']}})[_0xf173('0x1c')](handleEntityNotFound(_0x511720,null))[_0xf173('0x1c')](function(_0x332233){if(_0x332233){_0x1c240d=_0x332233;_0x28e4a3['model']=_[_0xf173('0x3b')](db['User']['rawAttributes']);_0x28e4a3[_0xf173('0x3a')]=_[_0xf173('0x3b')](_0x4ae11c[_0xf173('0x3a')]);_0x28e4a3[_0xf173('0x3c')]=_[_0xf173('0x3d')](_0x28e4a3[_0xf173('0x39')],_0x28e4a3['query']);_0x51d26b[_0xf173('0x3e')]=_[_0xf173('0x3d')](_0x28e4a3[_0xf173('0x39')],qs[_0xf173('0x3f')](_0x4ae11c['query'][_0xf173('0x3f')]));_0x51d26b[_0xf173('0x3e')]=_0x51d26b[_0xf173('0x3e')][_0xf173('0x40')]?_0x51d26b['attributes']:_0x28e4a3[_0xf173('0x39')];_0x51d26b[_0xf173('0x43')]=qs[_0xf173('0x44')](_0x4ae11c[_0xf173('0x3a')][_0xf173('0x44')]);_0x51d26b[_0xf173('0x45')]=qs[_0xf173('0x3c')](_['pick'](_0x4ae11c[_0xf173('0x3a')],_0x28e4a3[_0xf173('0x3c')]));if(_0x4ae11c['query'][_0xf173('0x47')]){_0x51d26b[_0xf173('0x45')]=_[_0xf173('0x4a')](_0x51d26b['where'],{'$or':_[_0xf173('0x36')](_0x51d26b[_0xf173('0x3e')],function(_0x11b2a0){var _0x18f63b={};_0x18f63b[_0x11b2a0]={'$like':'%'+_0x4ae11c[_0xf173('0x3a')][_0xf173('0x47')]+'%'};return _0x18f63b;})});}_0x51d26b=_['merge']({},_0x51d26b,_0x4ae11c['options']);return _0x1c240d[_0xf173('0x8f')](_0x51d26b);}})['then'](function(_0x3f1cd8){if(_0x3f1cd8){_0x1b49df=_0x3f1cd8['length'];if(!_0x4ae11c['query'][_0xf173('0x41')](_0xf173('0x42'))){_0x51d26b[_0xf173('0x2c')]=qs['limit'](_0x4ae11c['query'][_0xf173('0x2c')]);_0x51d26b[_0xf173('0x2b')]=qs[_0xf173('0x2b')](_0x4ae11c[_0xf173('0x3a')][_0xf173('0x2b')]);}return _0x1c240d[_0xf173('0x8f')](_0x51d26b);}})[_0xf173('0x1c')](function(_0x912cfa){if(_0x912cfa){return _0x912cfa?{'count':_0x1b49df,'rows':_0x912cfa}:null;}})[_0xf173('0x1c')](respondWithResult(_0x511720,null))[_0xf173('0x25')](handleError(_0x511720,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 735abc6..22ec2dc 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x401352,_0x165ba6){var _0x2276bc=function(_0x4af32e){while(--_0x4af32e){_0x401352['push'](_0x401352['shift']());}};_0x2276bc(++_0x165ba6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x230ad7,_0x5f5151){_0x230ad7=_0x230ad7-0x0;var _0x4c9286=_0x5f2f[_0x230ad7];return _0x4c9286;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1d8399,_0x1c6580){var _0x40bf6c=function(_0x47d141){while(--_0x47d141){_0x1d8399['push'](_0x1d8399['shift']());}};_0x40bf6c(++_0x1c6580);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0x0b0e[_0x27c068];return _0xe5a67f;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a41835c..bd63232 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 _0x4205=['api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','chat_queues','lodash','../../config/logger'];(function(_0x31e60f,_0x39e1bc){var _0x4bcaab=function(_0xa37cb6){while(--_0xa37cb6){_0x31e60f['push'](_0x31e60f['shift']());}};_0x4bcaab(++_0x39e1bc);}(_0x4205,0x1b6));var _0x5420=function(_0x25bdce,_0x201092){_0x25bdce=_0x25bdce-0x0;var _0x19785b=_0x4205[_0x25bdce];return _0x19785b;};'use strict';var _=require(_0x5420('0x0'));var util=require('util');var logger=require(_0x5420('0x1'))(_0x5420('0x2'));var moment=require(_0x5420('0x3'));var BPromise=require(_0x5420('0x4'));var rp=require(_0x5420('0x5'));var fs=require('fs');var path=require(_0x5420('0x6'));var rimraf=require(_0x5420('0x7'));var config=require('../../config/environment');var attributes=require(_0x5420('0x8'));module['exports']=function(_0x3427be,_0x1a850d){return _0x3427be[_0x5420('0x9')]('ChatQueue',attributes,{'tableName':_0x5420('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bbe=['define','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x17e597,_0x2843bd){var _0x329bf4=function(_0x1d5892){while(--_0x1d5892){_0x17e597['push'](_0x17e597['shift']());}};_0x329bf4(++_0x2843bd);}(_0x2bbe,0xa1));var _0xe2bb=function(_0x573fbd,_0x4278f6){_0x573fbd=_0x573fbd-0x0;var _0x5477a6=_0x2bbe[_0x573fbd];return _0x5477a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe2bb('0x0'))('api');var moment=require(_0xe2bb('0x1'));var BPromise=require(_0xe2bb('0x2'));var rp=require(_0xe2bb('0x3'));var fs=require('fs');var path=require(_0xe2bb('0x4'));var rimraf=require(_0xe2bb('0x5'));var config=require(_0xe2bb('0x6'));var attributes=require(_0xe2bb('0x7'));module[_0xe2bb('0x8')]=function(_0x232892,_0x2897ef){return _0x232892[_0xe2bb('0x9')]('ChatQueue',attributes,{'tableName':'chat_queues','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 c882143..8c5b6b0 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 _0x7348=['model','ShowChatQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','options','raw','where','limit','include','map','attributes'];(function(_0x338f87,_0x1555ad){var _0xbe44bd=function(_0x56e3f6){while(--_0x56e3f6){_0x338f87['push'](_0x338f87['shift']());}};_0xbe44bd(++_0x1555ad);}(_0x7348,0x16b));var _0x8734=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7348[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x8734('0x0'));var moment=require(_0x8734('0x1'));var BPromise=require('bluebird');var rs=require(_0x8734('0x2'));var fs=require('fs');var Redis=require(_0x8734('0x3'));var db=require(_0x8734('0x4'))['db'];var utils=require(_0x8734('0x5'));var logger=require(_0x8734('0x6'))('rpc');var config=require(_0x8734('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8734('0x8')]['http']({'port':0x232a});config[_0x8734('0x9')]=_[_0x8734('0xa')](config[_0x8734('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8734('0xb'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x8734('0xc')](socket);function respondWithRpcPromise(_0x4e01c3,_0x44a670,_0x513096){return new BPromise(function(_0x222bb8,_0x398e71){return client[_0x8734('0xd')](_0x4e01c3,_0x513096)[_0x8734('0xe')](function(_0x4c9715){logger[_0x8734('0xf')](_0x8734('0x10'),_0x44a670,_0x8734('0x11'));logger[_0x8734('0x12')](_0x8734('0x13'),_0x44a670,_0x8734('0x11'),JSON[_0x8734('0x14')](_0x4c9715));if(_0x4c9715['error']){if(_0x4c9715[_0x8734('0x15')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x44a670,_0x4c9715[_0x8734('0x15')][_0x8734('0x16')]);return _0x398e71(_0x4c9715[_0x8734('0x15')][_0x8734('0x16')]);}logger[_0x8734('0x15')]('ChatQueue,\x20%s,\x20%s',_0x44a670,_0x4c9715[_0x8734('0x15')][_0x8734('0x16')]);return _0x222bb8(_0x4c9715['error'][_0x8734('0x16')]);}else{logger[_0x8734('0xf')](_0x8734('0x10'),_0x44a670,_0x8734('0x11'));_0x222bb8(_0x4c9715[_0x8734('0x17')][_0x8734('0x16')]);}})[_0x8734('0x18')](function(_0x548f22){logger['error'](_0x8734('0x10'),_0x44a670,_0x548f22);_0x398e71(_0x548f22);});});}exports[_0x8734('0x19')]=function(_0x363393){var _0x380097=this;return new Promise(function(_0x3e010c,_0xdf974b){return db['ChatQueue']['findAll']({'raw':_0x363393['options']?_0x363393[_0x8734('0x1a')][_0x8734('0x1b')]===undefined?!![]:![]:!![],'where':_0x363393['options']?_0x363393[_0x8734('0x1a')][_0x8734('0x1c')]||null:null,'attributes':_0x363393[_0x8734('0x1a')]?_0x363393[_0x8734('0x1a')]['attributes']||null:null,'limit':_0x363393[_0x8734('0x1a')]?_0x363393['options'][_0x8734('0x1d')]||null:null,'include':_0x363393[_0x8734('0x1a')]?_0x363393[_0x8734('0x1a')][_0x8734('0x1e')]?_[_0x8734('0x1f')](_0x363393[_0x8734('0x1a')][_0x8734('0x1e')],function(_0x3aa566){return{'model':db[_0x3aa566['model']],'as':_0x3aa566['as'],'attributes':_0x3aa566[_0x8734('0x20')],'include':_0x3aa566[_0x8734('0x1e')]?_[_0x8734('0x1f')](_0x3aa566[_0x8734('0x1e')],function(_0x14ea87){return{'model':db[_0x14ea87[_0x8734('0x21')]],'as':_0x14ea87['as'],'attributes':_0x14ea87[_0x8734('0x20')],'include':_0x14ea87[_0x8734('0x1e')]?_['map'](_0x14ea87[_0x8734('0x1e')],function(_0x6676f7){return{'model':db[_0x6676f7[_0x8734('0x21')]],'as':_0x6676f7['as'],'attributes':_0x6676f7[_0x8734('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8734('0xe')](function(_0x3f2079){logger['info'](_0x8734('0x19'),_0x363393);logger[_0x8734('0x12')]('GetChatQueue',_0x363393,JSON[_0x8734('0x14')](_0x3f2079));_0x3e010c(_0x3f2079);})['catch'](function(_0x3be5da){logger[_0x8734('0x15')](_0x8734('0x19'),_0x3be5da[_0x8734('0x16')],_0x363393);_0xdf974b(_0x380097[_0x8734('0x15')](0x1f4,_0x3be5da[_0x8734('0x16')]));});});};exports[_0x8734('0x22')]=function(_0x588d84){var _0x3c41ea=this;return new Promise(function(_0x2f7e02,_0x33f791){return db['ChatQueue'][_0x8734('0x23')]({'raw':_0x588d84[_0x8734('0x1a')]?_0x588d84[_0x8734('0x1a')][_0x8734('0x1b')]===undefined?!![]:![]:!![],'where':_0x588d84[_0x8734('0x1a')]?_0x588d84[_0x8734('0x1a')][_0x8734('0x1c')]||null:null,'attributes':_0x588d84['options']?_0x588d84['options']['attributes']||null:null,'include':_0x588d84[_0x8734('0x1a')]?_0x588d84[_0x8734('0x1a')][_0x8734('0x1e')]?_[_0x8734('0x1f')](_0x588d84['options'][_0x8734('0x1e')],function(_0x4abee3){return{'model':db[_0x4abee3[_0x8734('0x21')]],'as':_0x4abee3['as'],'attributes':_0x4abee3[_0x8734('0x20')],'include':_0x4abee3[_0x8734('0x1e')]?_[_0x8734('0x1f')](_0x4abee3['include'],function(_0x2a485e){return{'model':db[_0x2a485e['model']],'as':_0x2a485e['as'],'attributes':_0x2a485e['attributes'],'include':_0x2a485e['include']?_[_0x8734('0x1f')](_0x2a485e[_0x8734('0x1e')],function(_0x308f6b){return{'model':db[_0x308f6b[_0x8734('0x21')]],'as':_0x308f6b['as'],'attributes':_0x308f6b[_0x8734('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8734('0xe')](function(_0x361d4c){logger[_0x8734('0xf')]('ShowChatQueue',_0x588d84);logger[_0x8734('0x12')]('ShowChatQueue',_0x588d84,JSON[_0x8734('0x14')](_0x361d4c));_0x2f7e02(_0x361d4c);})[_0x8734('0x18')](function(_0x578508){logger[_0x8734('0x15')]('ShowChatQueue',_0x578508[_0x8734('0x16')],_0x588d84);_0x33f791(_0x3c41ea[_0x8734('0x15')](0x1f4,_0x578508[_0x8734('0x16')]));});});}; \ No newline at end of file +var _0x3ace=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','map','include','model','find','ShowChatQueue','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','request','then'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3ace,0xda));var _0xe3ac=function(_0x5781a9,_0x52a49a){_0x5781a9=_0x5781a9-0x0;var _0x957258=_0x3ace[_0x5781a9];return _0x957258;};'use strict';var _=require('lodash');var util=require(_0xe3ac('0x0'));var moment=require(_0xe3ac('0x1'));var BPromise=require(_0xe3ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3ac('0x3'))['db'];var utils=require(_0xe3ac('0x4'));var logger=require(_0xe3ac('0x5'))('rpc');var config=require(_0xe3ac('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe3ac('0x7')]({'port':0x232a});config['redis']=_[_0xe3ac('0x8')](config['redis'],{'host':_0xe3ac('0x9'),'port':0x18eb});var socket=require(_0xe3ac('0xa'))(new Redis(config[_0xe3ac('0xb')]));require(_0xe3ac('0xc'))[_0xe3ac('0xd')](socket);function respondWithRpcPromise(_0x4fc0b7,_0x184032,_0x2678ae){return new BPromise(function(_0x1000f8,_0x50fbee){return client[_0xe3ac('0xe')](_0x4fc0b7,_0x2678ae)[_0xe3ac('0xf')](function(_0x471294){logger[_0xe3ac('0x10')](_0xe3ac('0x11'),_0x184032,_0xe3ac('0x12'));logger[_0xe3ac('0x13')](_0xe3ac('0x14'),_0x184032,_0xe3ac('0x12'),JSON[_0xe3ac('0x15')](_0x471294));if(_0x471294[_0xe3ac('0x16')]){if(_0x471294[_0xe3ac('0x16')][_0xe3ac('0x17')]===0x1f4){logger[_0xe3ac('0x16')](_0xe3ac('0x11'),_0x184032,_0x471294[_0xe3ac('0x16')][_0xe3ac('0x18')]);return _0x50fbee(_0x471294['error'][_0xe3ac('0x18')]);}logger[_0xe3ac('0x16')](_0xe3ac('0x11'),_0x184032,_0x471294['error']['message']);return _0x1000f8(_0x471294[_0xe3ac('0x16')]['message']);}else{logger[_0xe3ac('0x10')](_0xe3ac('0x11'),_0x184032,'request\x20sent');_0x1000f8(_0x471294[_0xe3ac('0x19')]['message']);}})[_0xe3ac('0x1a')](function(_0x488981){logger[_0xe3ac('0x16')](_0xe3ac('0x11'),_0x184032,_0x488981);_0x50fbee(_0x488981);});});}exports[_0xe3ac('0x1b')]=function(_0x1eabfb){var _0x3834f9=this;return new Promise(function(_0xbc852e,_0x5635b7){return db[_0xe3ac('0x1c')][_0xe3ac('0x1d')]({'raw':_0x1eabfb['options']?_0x1eabfb[_0xe3ac('0x1e')][_0xe3ac('0x1f')]===undefined?!![]:![]:!![],'where':_0x1eabfb[_0xe3ac('0x1e')]?_0x1eabfb[_0xe3ac('0x1e')][_0xe3ac('0x20')]||null:null,'attributes':_0x1eabfb['options']?_0x1eabfb[_0xe3ac('0x1e')][_0xe3ac('0x21')]||null:null,'limit':_0x1eabfb[_0xe3ac('0x1e')]?_0x1eabfb[_0xe3ac('0x1e')]['limit']||null:null,'include':_0x1eabfb[_0xe3ac('0x1e')]?_0x1eabfb[_0xe3ac('0x1e')]['include']?_[_0xe3ac('0x22')](_0x1eabfb['options'][_0xe3ac('0x23')],function(_0x382171){return{'model':db[_0x382171[_0xe3ac('0x24')]],'as':_0x382171['as'],'attributes':_0x382171[_0xe3ac('0x21')],'include':_0x382171[_0xe3ac('0x23')]?_[_0xe3ac('0x22')](_0x382171['include'],function(_0x2ce196){return{'model':db[_0x2ce196['model']],'as':_0x2ce196['as'],'attributes':_0x2ce196[_0xe3ac('0x21')],'include':_0x2ce196[_0xe3ac('0x23')]?_[_0xe3ac('0x22')](_0x2ce196['include'],function(_0x48caa4){return{'model':db[_0x48caa4[_0xe3ac('0x24')]],'as':_0x48caa4['as'],'attributes':_0x48caa4[_0xe3ac('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe3ac('0xf')](function(_0x2fbe11){logger['info'](_0xe3ac('0x1b'),_0x1eabfb);logger[_0xe3ac('0x13')](_0xe3ac('0x1b'),_0x1eabfb,JSON['stringify'](_0x2fbe11));_0xbc852e(_0x2fbe11);})[_0xe3ac('0x1a')](function(_0x11d515){logger['error'](_0xe3ac('0x1b'),_0x11d515[_0xe3ac('0x18')],_0x1eabfb);_0x5635b7(_0x3834f9[_0xe3ac('0x16')](0x1f4,_0x11d515['message']));});});};exports['ShowChatQueue']=function(_0x3a8d8f){var _0x4008b6=this;return new Promise(function(_0x45c6c6,_0x2a86f9){return db[_0xe3ac('0x1c')][_0xe3ac('0x25')]({'raw':_0x3a8d8f[_0xe3ac('0x1e')]?_0x3a8d8f[_0xe3ac('0x1e')][_0xe3ac('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a8d8f['options']?_0x3a8d8f[_0xe3ac('0x1e')][_0xe3ac('0x20')]||null:null,'attributes':_0x3a8d8f[_0xe3ac('0x1e')]?_0x3a8d8f[_0xe3ac('0x1e')][_0xe3ac('0x21')]||null:null,'include':_0x3a8d8f[_0xe3ac('0x1e')]?_0x3a8d8f['options'][_0xe3ac('0x23')]?_[_0xe3ac('0x22')](_0x3a8d8f[_0xe3ac('0x1e')][_0xe3ac('0x23')],function(_0x12dffb){return{'model':db[_0x12dffb[_0xe3ac('0x24')]],'as':_0x12dffb['as'],'attributes':_0x12dffb[_0xe3ac('0x21')],'include':_0x12dffb['include']?_[_0xe3ac('0x22')](_0x12dffb[_0xe3ac('0x23')],function(_0x90b2c7){return{'model':db[_0x90b2c7['model']],'as':_0x90b2c7['as'],'attributes':_0x90b2c7[_0xe3ac('0x21')],'include':_0x90b2c7[_0xe3ac('0x23')]?_[_0xe3ac('0x22')](_0x90b2c7[_0xe3ac('0x23')],function(_0x3a891e){return{'model':db[_0x3a891e['model']],'as':_0x3a891e['as'],'attributes':_0x3a891e[_0xe3ac('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x68a477){logger[_0xe3ac('0x10')](_0xe3ac('0x26'),_0x3a8d8f);logger[_0xe3ac('0x13')](_0xe3ac('0x26'),_0x3a8d8f,JSON[_0xe3ac('0x15')](_0x68a477));_0x45c6c6(_0x68a477);})[_0xe3ac('0x1a')](function(_0x47c937){logger[_0xe3ac('0x16')](_0xe3ac('0x26'),_0x47c937['message'],_0x3a8d8f);_0x2a86f9(_0x4008b6[_0xe3ac('0x16')](0x1f4,_0x47c937[_0xe3ac('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c750105..c708ec2 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c62ab,_0x33f23d){_0x3c62ab=_0x3c62ab-0x0;var _0x536970=_0xb10b[_0x3c62ab];return _0x536970;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x3401ed,_0x346737){var _0x590ed4=function(_0x546e3c){while(--_0x546e3c){_0x3401ed['push'](_0x3401ed['shift']());}};_0x590ed4(++_0x346737);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a3730e0..f47beeb 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 _0x6114=['post','create','addTeams','addAgents','put','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','../../config/environment','./chatQueue.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x3853a4,_0x3f14ef){var _0x59b4e4=function(_0x30223d){while(--_0x30223d){_0x3853a4['push'](_0x3853a4['shift']());}};_0x59b4e4(++_0x3f14ef);}(_0x6114,0x7f));var _0x4611=function(_0x26a515,_0x286339){_0x26a515=_0x26a515-0x0;var _0x314682=_0x6114[_0x26a515];return _0x314682;};'use strict';var multer=require(_0x4611('0x0'));var util=require(_0x4611('0x1'));var path=require('path');var timeout=require(_0x4611('0x2'));var express=require(_0x4611('0x3'));var router=express[_0x4611('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4611('0x5'));var controller=require(_0x4611('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4611('0x7')]);router[_0x4611('0x8')](_0x4611('0x9'),auth[_0x4611('0xa')](),controller['describe']);router[_0x4611('0x8')](_0x4611('0xb'),auth['isAuthenticated'](),controller[_0x4611('0xc')]);router[_0x4611('0x8')](_0x4611('0xd'),auth['isAuthenticated'](),controller[_0x4611('0xe')]);router['get'](_0x4611('0xf'),auth[_0x4611('0xa')](),controller[_0x4611('0x10')]);router[_0x4611('0x8')]('/:id/users',auth[_0x4611('0xa')](),controller[_0x4611('0x11')]);router[_0x4611('0x12')]('/',auth[_0x4611('0xa')](),controller[_0x4611('0x13')]);router[_0x4611('0x12')](_0x4611('0xf'),auth[_0x4611('0xa')](),controller[_0x4611('0x14')]);router['post']('/:id/users',auth[_0x4611('0xa')](),controller[_0x4611('0x15')]);router[_0x4611('0x16')](_0x4611('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4611('0xa')](),controller[_0x4611('0x17')]);router[_0x4611('0x18')](_0x4611('0xf'),auth[_0x4611('0xa')](),controller[_0x4611('0x19')]);router[_0x4611('0x18')](_0x4611('0x1a'),auth[_0x4611('0xa')](),controller[_0x4611('0x1b')]);module[_0x4611('0x1c')]=router; \ No newline at end of file +var _0x4055=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express'];(function(_0x4ce048,_0x27a6fd){var _0x4c6524=function(_0x3319e8){while(--_0x3319e8){_0x4ce048['push'](_0x4ce048['shift']());}};_0x4c6524(++_0x27a6fd);}(_0x4055,0xc7));var _0x5405=function(_0x312931,_0x22e92b){_0x312931=_0x312931-0x0;var _0xdf26e5=_0x4055[_0x312931];return _0xdf26e5;};'use strict';var multer=require('multer');var util=require(_0x5405('0x0'));var path=require(_0x5405('0x1'));var timeout=require(_0x5405('0x2'));var express=require(_0x5405('0x3'));var router=express[_0x5405('0x4')]();var auth=require(_0x5405('0x5'));var interaction=require(_0x5405('0x6'));var config=require(_0x5405('0x7'));var controller=require('./chatQueue.controller');router[_0x5405('0x8')]('/',auth[_0x5405('0x9')](),controller['index']);router[_0x5405('0x8')]('/describe',auth[_0x5405('0x9')](),controller[_0x5405('0xa')]);router[_0x5405('0x8')](_0x5405('0xb'),auth[_0x5405('0x9')](),controller[_0x5405('0xc')]);router[_0x5405('0x8')](_0x5405('0xd'),auth['isAuthenticated'](),controller[_0x5405('0xe')]);router[_0x5405('0x8')](_0x5405('0xf'),auth[_0x5405('0x9')](),controller[_0x5405('0x10')]);router['get'](_0x5405('0x11'),auth['isAuthenticated'](),controller[_0x5405('0x12')]);router['post']('/',auth[_0x5405('0x9')](),controller[_0x5405('0x13')]);router[_0x5405('0x14')](_0x5405('0xf'),auth[_0x5405('0x9')](),controller[_0x5405('0x15')]);router[_0x5405('0x14')](_0x5405('0x11'),auth[_0x5405('0x9')](),controller[_0x5405('0x16')]);router[_0x5405('0x17')](_0x5405('0xb'),auth[_0x5405('0x9')](),controller[_0x5405('0x18')]);router[_0x5405('0x19')](_0x5405('0xb'),auth['isAuthenticated'](),controller[_0x5405('0x1a')]);router[_0x5405('0x19')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x5405('0x19')](_0x5405('0x11'),auth[_0x5405('0x9')](),controller[_0x5405('0x1b')]);module[_0x5405('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 564ece9..4e46726 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 _0x46d5=['DATE','sequelize','STRING'];(function(_0x23ce8f,_0x5ddafa){var _0x183256=function(_0x1d381d){while(--_0x1d381d){_0x23ce8f['push'](_0x23ce8f['shift']());}};_0x183256(++_0x5ddafa);}(_0x46d5,0x160));var _0x546d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x46d5[_0x3bf83f];return _0x22c4a9;};'use strict';var moment=require('moment');var Sequelize=require(_0x546d('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x546d('0x1')]},'joinAt':{'type':Sequelize[_0x546d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x546d('0x2')]},'exitAt':{'type':Sequelize[_0x546d('0x2')]},'reason':{'type':Sequelize[_0x546d('0x1')]}}; \ No newline at end of file +var _0x5f6e=['sequelize','STRING','DATE'];(function(_0x21cf80,_0x1fb0a1){var _0x5c6bed=function(_0x3492c3){while(--_0x3492c3){_0x21cf80['push'](_0x21cf80['shift']());}};_0x5c6bed(++_0x1fb0a1);}(_0x5f6e,0x6f));var _0xe5f6=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0x5f6e[_0x239b31];return _0x41c8be;};'use strict';var moment=require('moment');var Sequelize=require(_0xe5f6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe5f6('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe5f6('0x1')]},'joinAt':{'type':Sequelize[_0xe5f6('0x2')]},'leaveAt':{'type':Sequelize[_0xe5f6('0x2')]},'acceptAt':{'type':Sequelize[_0xe5f6('0x2')]},'exitAt':{'type':Sequelize[_0xe5f6('0x2')]},'reason':{'type':Sequelize[_0xe5f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index fa73589..04a6598 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 _0xbaf0=['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','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x374b71,_0x44ff5e){var _0x2b8701=function(_0x3bb754){while(--_0x3bb754){_0x374b71['push'](_0x374b71['shift']());}};_0x2b8701(++_0x44ff5e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3d81bb,_0x5627a0){var _0xdbebe4=function(_0x7a09b0){while(--_0x7a09b0){_0x3d81bb['push'](_0x3d81bb['shift']());}};_0xdbebe4(++_0x5627a0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');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('0x9'));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 db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['ChatQueueReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['ChatQueueReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e8ab598..b75c3fd 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 _0x5644=['exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueueReport.attributes'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x5644,0x15e));var _0x4564=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x5644[_0x27dba4];return _0x35ec9d;};'use strict';var _=require(_0x4564('0x0'));var util=require(_0x4564('0x1'));var logger=require(_0x4564('0x2'))(_0x4564('0x3'));var moment=require(_0x4564('0x4'));var BPromise=require(_0x4564('0x5'));var rp=require(_0x4564('0x6'));var fs=require('fs');var path=require(_0x4564('0x7'));var rimraf=require(_0x4564('0x8'));var config=require('../../config/environment');var attributes=require(_0x4564('0x9'));module[_0x4564('0xa')]=function(_0x1f8281,_0x1fc9a3){return _0x1f8281[_0x4564('0xb')](_0x4564('0xc'),attributes,{'tableName':_0x4564('0xd'),'paranoid':![],'indexes':[{'name':_0x4564('0xe'),'fields':[_0x4564('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe933=['rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xe933,0xea));var _0x3e93=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xe933[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require(_0x3e93('0x0'));var logger=require(_0x3e93('0x1'))(_0x3e93('0x2'));var moment=require('moment');var BPromise=require(_0x3e93('0x3'));var rp=require(_0x3e93('0x4'));var fs=require('fs');var path=require(_0x3e93('0x5'));var rimraf=require(_0x3e93('0x6'));var config=require(_0x3e93('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0x3e93('0x8')]=function(_0x4fd459,_0x37f842){return _0x4fd459[_0x3e93('0x9')](_0x3e93('0xa'),attributes,{'tableName':_0x3e93('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 79fd7e3..48e35a5 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 _0x04ae=['http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','body','raw','UpdateChatQueueReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x04ae,0x148));var _0xe04a=function(_0x1c3fdf,_0x4a581a){_0x1c3fdf=_0x1c3fdf-0x0;var _0x25bd18=_0x04ae[_0x1c3fdf];return _0x25bd18;};'use strict';var _=require(_0xe04a('0x0'));var util=require(_0xe04a('0x1'));var moment=require(_0xe04a('0x2'));var BPromise=require(_0xe04a('0x3'));var rs=require(_0xe04a('0x4'));var fs=require('fs');var Redis=require(_0xe04a('0x5'));var db=require(_0xe04a('0x6'))['db'];var utils=require(_0xe04a('0x7'));var logger=require(_0xe04a('0x8'))(_0xe04a('0x9'));var config=require(_0xe04a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe04a('0xb')][_0xe04a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5854c6,_0x1bc336,_0x5561de){return new BPromise(function(_0x193844,_0x47b666){return client['request'](_0x5854c6,_0x5561de)[_0xe04a('0xd')](function(_0x2004f8){logger['info'](_0xe04a('0xe'),_0x1bc336,_0xe04a('0xf'));logger[_0xe04a('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1bc336,'request\x20sent',JSON[_0xe04a('0x11')](_0x2004f8));if(_0x2004f8['error']){if(_0x2004f8['error'][_0xe04a('0x12')]===0x1f4){logger[_0xe04a('0x13')](_0xe04a('0xe'),_0x1bc336,_0x2004f8[_0xe04a('0x13')]['message']);return _0x47b666(_0x2004f8[_0xe04a('0x13')][_0xe04a('0x14')]);}logger[_0xe04a('0x13')](_0xe04a('0xe'),_0x1bc336,_0x2004f8[_0xe04a('0x13')][_0xe04a('0x14')]);return _0x193844(_0x2004f8['error'][_0xe04a('0x14')]);}else{logger[_0xe04a('0x15')](_0xe04a('0xe'),_0x1bc336,_0xe04a('0xf'));_0x193844(_0x2004f8['result'][_0xe04a('0x14')]);}})[_0xe04a('0x16')](function(_0x22cc5b){logger[_0xe04a('0x13')](_0xe04a('0xe'),_0x1bc336,_0x22cc5b);_0x47b666(_0x22cc5b);});});}exports[_0xe04a('0x17')]=function(_0xdfb98f){var _0x2f39cc=this;return new Promise(function(_0x185a84,_0x2c5004){return db[_0xe04a('0x18')][_0xe04a('0x19')](_0xdfb98f[_0xe04a('0x1a')],{'raw':_0xdfb98f['options']?_0xdfb98f['options'][_0xe04a('0x1b')]===undefined?!![]:![]:!![]})[_0xe04a('0xd')](function(_0x20861d){logger[_0xe04a('0x15')](_0xe04a('0x17'),_0xdfb98f);logger['debug'](_0xe04a('0x17'),_0xdfb98f,JSON['stringify'](_0x20861d));_0x185a84(_0x20861d);})[_0xe04a('0x16')](function(_0x47c6a5){logger[_0xe04a('0x13')](_0xe04a('0x17'),_0x47c6a5[_0xe04a('0x14')],_0xdfb98f);_0x2c5004(_0x2f39cc[_0xe04a('0x13')](0x1f4,_0x47c6a5[_0xe04a('0x14')]));});});};exports[_0xe04a('0x1c')]=function(_0x3e2ebf){var _0x1ada2a=this;return new Promise(function(_0x5b179a,_0x575a36){return db[_0xe04a('0x18')][_0xe04a('0x1d')](_0x3e2ebf[_0xe04a('0x1a')],{'raw':_0x3e2ebf[_0xe04a('0x1e')]?_0x3e2ebf[_0xe04a('0x1e')][_0xe04a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e2ebf[_0xe04a('0x1e')]?_0x3e2ebf['options'][_0xe04a('0x1f')]||null:null,'attributes':_0x3e2ebf['options']?_0x3e2ebf[_0xe04a('0x1e')][_0xe04a('0x20')]||null:null,'limit':_0x3e2ebf[_0xe04a('0x1e')]?_0x3e2ebf[_0xe04a('0x1e')][_0xe04a('0x21')]||null:null})[_0xe04a('0xd')](function(_0x1e7deb){logger[_0xe04a('0x15')](_0xe04a('0x1c'),_0x3e2ebf);logger[_0xe04a('0x10')](_0xe04a('0x1c'),_0x3e2ebf,JSON[_0xe04a('0x11')](_0x1e7deb));_0x5b179a(_0x1e7deb);})[_0xe04a('0x16')](function(_0x253b74){logger[_0xe04a('0x13')](_0xe04a('0x1c'),_0x253b74[_0xe04a('0x14')],_0x3e2ebf);_0x575a36(_0x1ada2a['error'](0x1f4,_0x253b74[_0xe04a('0x14')]));});});}; \ No newline at end of file +var _0xfb1b=['result','catch','ChatQueueReport','create','options','then','CreateChatQueueReport','body','raw','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ab0cb,_0x261197){var _0x4bb07a=function(_0x4d22a4){while(--_0x4d22a4){_0x1ab0cb['push'](_0x1ab0cb['shift']());}};_0x4bb07a(++_0x261197);}(_0xfb1b,0x90));var _0xbfb1=function(_0x5ee1d1,_0xbbadea){_0x5ee1d1=_0x5ee1d1-0x0;var _0x5ce987=_0xfb1b[_0x5ee1d1];return _0x5ce987;};'use strict';var _=require(_0xbfb1('0x0'));var util=require(_0xbfb1('0x1'));var moment=require(_0xbfb1('0x2'));var BPromise=require(_0xbfb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfb1('0x4'));var db=require(_0xbfb1('0x5'))['db'];var utils=require(_0xbfb1('0x6'));var logger=require('../../config/logger')(_0xbfb1('0x7'));var config=require(_0xbfb1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfb1('0x9')][_0xbfb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc4a371,_0x2f5faf,_0x31f8bc){return new BPromise(function(_0x5546e8,_0x33c621){return client[_0xbfb1('0xb')](_0xc4a371,_0x31f8bc)['then'](function(_0x37f81e){logger[_0xbfb1('0xc')](_0xbfb1('0xd'),_0x2f5faf,_0xbfb1('0xe'));logger[_0xbfb1('0xf')](_0xbfb1('0x10'),_0x2f5faf,_0xbfb1('0xe'),JSON[_0xbfb1('0x11')](_0x37f81e));if(_0x37f81e[_0xbfb1('0x12')]){if(_0x37f81e[_0xbfb1('0x12')][_0xbfb1('0x13')]===0x1f4){logger['error'](_0xbfb1('0xd'),_0x2f5faf,_0x37f81e[_0xbfb1('0x12')]['message']);return _0x33c621(_0x37f81e[_0xbfb1('0x12')]['message']);}logger[_0xbfb1('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2f5faf,_0x37f81e[_0xbfb1('0x12')][_0xbfb1('0x14')]);return _0x5546e8(_0x37f81e[_0xbfb1('0x12')]['message']);}else{logger[_0xbfb1('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x2f5faf,'request\x20sent');_0x5546e8(_0x37f81e[_0xbfb1('0x15')]['message']);}})[_0xbfb1('0x16')](function(_0x29b1bb){logger[_0xbfb1('0x12')](_0xbfb1('0xd'),_0x2f5faf,_0x29b1bb);_0x33c621(_0x29b1bb);});});}exports['CreateChatQueueReport']=function(_0x1e744d){var _0x634a36=this;return new Promise(function(_0x5c4ecd,_0x49dbde){return db[_0xbfb1('0x17')][_0xbfb1('0x18')](_0x1e744d['body'],{'raw':_0x1e744d[_0xbfb1('0x19')]?_0x1e744d[_0xbfb1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfb1('0x1a')](function(_0x32e4af){logger[_0xbfb1('0xc')](_0xbfb1('0x1b'),_0x1e744d);logger[_0xbfb1('0xf')]('CreateChatQueueReport',_0x1e744d,JSON[_0xbfb1('0x11')](_0x32e4af));_0x5c4ecd(_0x32e4af);})[_0xbfb1('0x16')](function(_0x860e98){logger['error'](_0xbfb1('0x1b'),_0x860e98[_0xbfb1('0x14')],_0x1e744d);_0x49dbde(_0x634a36[_0xbfb1('0x12')](0x1f4,_0x860e98['message']));});});};exports['UpdateChatQueueReport']=function(_0x1d2123){var _0x11afdd=this;return new Promise(function(_0x2751d8,_0x382327){return db[_0xbfb1('0x17')]['update'](_0x1d2123[_0xbfb1('0x1c')],{'raw':_0x1d2123[_0xbfb1('0x19')]?_0x1d2123[_0xbfb1('0x19')][_0xbfb1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d2123[_0xbfb1('0x19')]?_0x1d2123['options']['where']||null:null,'attributes':_0x1d2123[_0xbfb1('0x19')]?_0x1d2123[_0xbfb1('0x19')][_0xbfb1('0x1e')]||null:null,'limit':_0x1d2123[_0xbfb1('0x19')]?_0x1d2123[_0xbfb1('0x19')][_0xbfb1('0x1f')]||null:null})[_0xbfb1('0x1a')](function(_0xcd9edc){logger[_0xbfb1('0xc')](_0xbfb1('0x20'),_0x1d2123);logger[_0xbfb1('0xf')]('UpdateChatQueueReport',_0x1d2123,JSON[_0xbfb1('0x11')](_0xcd9edc));_0x2751d8(_0xcd9edc);})[_0xbfb1('0x16')](function(_0x115616){logger['error'](_0xbfb1('0x20'),_0x115616['message'],_0x1d2123);_0x382327(_0x11afdd['error'](0x1f4,_0x115616[_0xbfb1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5c13e7c..fc8c42d 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 _0x74a2=['index','/describe','describe','show','post','create','delete','/:id','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x28f4f2,_0x1910c7){var _0x2e8567=function(_0x354018){while(--_0x354018){_0x28f4f2['push'](_0x28f4f2['shift']());}};_0x2e8567(++_0x1910c7);}(_0x74a2,0x15e));var _0x274a=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x74a2[_0xc55d64];return _0x4194f6;};'use strict';var multer=require('multer');var util=require(_0x274a('0x0'));var path=require(_0x274a('0x1'));var timeout=require(_0x274a('0x2'));var express=require('express');var router=express[_0x274a('0x3')]();var auth=require(_0x274a('0x4'));var interaction=require(_0x274a('0x5'));var config=require(_0x274a('0x6'));var controller=require(_0x274a('0x7'));router[_0x274a('0x8')]('/',auth[_0x274a('0x9')](),controller[_0x274a('0xa')]);router[_0x274a('0x8')](_0x274a('0xb'),auth['isAuthenticated'](),controller[_0x274a('0xc')]);router[_0x274a('0x8')]('/:id',auth[_0x274a('0x9')](),controller[_0x274a('0xd')]);router[_0x274a('0xe')]('/',auth[_0x274a('0x9')](),controller[_0x274a('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x274a('0x10')](_0x274a('0x11'),auth[_0x274a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3393=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3393,0x1df));var _0x3339=function(_0xa821ab,_0x2aa1c0){_0xa821ab=_0xa821ab-0x0;var _0xffcb04=_0x3393[_0xa821ab];return _0xffcb04;};'use strict';var multer=require(_0x3339('0x0'));var util=require(_0x3339('0x1'));var path=require(_0x3339('0x2'));var timeout=require('connect-timeout');var express=require(_0x3339('0x3'));var router=express['Router']();var auth=require(_0x3339('0x4'));var interaction=require(_0x3339('0x5'));var config=require(_0x3339('0x6'));var controller=require(_0x3339('0x7'));router[_0x3339('0x8')]('/',auth[_0x3339('0x9')](),controller[_0x3339('0xa')]);router[_0x3339('0x8')](_0x3339('0xb'),auth[_0x3339('0x9')](),controller[_0x3339('0xc')]);router[_0x3339('0x8')](_0x3339('0xd'),auth[_0x3339('0x9')](),controller['show']);router[_0x3339('0xe')]('/',auth[_0x3339('0x9')](),controller[_0x3339('0xf')]);router['put'](_0x3339('0xd'),auth[_0x3339('0x9')](),controller['update']);router['delete']('/:id',auth[_0x3339('0x9')](),controller[_0x3339('0x10')]);module[_0x3339('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index aef6b4b..7f3d668 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 _0x5239=['exports','STRING','account','agent','queue','NOW','moment','sequelize'];(function(_0x38b6f7,_0x35d6ec){var _0x4874af=function(_0x38b92d){while(--_0x38b92d){_0x38b6f7['push'](_0x38b6f7['shift']());}};_0x4874af(++_0x35d6ec);}(_0x5239,0xfe));var _0x9523=function(_0x339373,_0x21a409){_0x339373=_0x339373-0x0;var _0x571fab=_0x5239[_0x339373];return _0x571fab;};'use strict';var moment=require(_0x9523('0x0'));var Sequelize=require(_0x9523('0x1'));module[_0x9523('0x2')]={'uniqueid':{'type':Sequelize[_0x9523('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9523('0x4'),_0x9523('0x5'),_0x9523('0x6')),'allowNull':![],'defaultValue':_0x9523('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9523('0x7')]}}; \ No newline at end of file +var _0x27c0=['agent','DATE','moment','sequelize','STRING'];(function(_0x2bf193,_0x1aad50){var _0x360f65=function(_0x5009da){while(--_0x5009da){_0x2bf193['push'](_0x2bf193['shift']());}};_0x360f65(++_0x1aad50);}(_0x27c0,0x174));var _0x027c=function(_0xe56733,_0x5a63c9){_0xe56733=_0xe56733-0x0;var _0x269420=_0x27c0[_0xe56733];return _0x269420;};'use strict';var moment=require(_0x027c('0x0'));var Sequelize=require(_0x027c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x027c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x027c('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x027c('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 16473b0..7b107b9 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 _0x5b89=['includeAll','include','findAll','rows','catch','params','create','body','find','html-pdf','eml-format','zip-dir','request-promise','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','ChatTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x5b89,0x121));var _0x95b8=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0x5b89[_0x58ceb9];return _0x3d0ff5;};'use strict';var pdf=require(_0x95b8('0x0'));var emlformat=require(_0x95b8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x95b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95b8('0x4'));var util=require(_0x95b8('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x95b8('0x6'));var ejs=require(_0x95b8('0x7'));var fs=require('fs');var _=require(_0x95b8('0x8'));var squel=require('squel');var crypto=require(_0x95b8('0x9'));var jsforce=require(_0x95b8('0xa'));var deskjs=require(_0x95b8('0xb'));var toCsv=require(_0x95b8('0x6'));var querystring=require(_0x95b8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x95b8('0xd'));var qs=require(_0x95b8('0xe'));var as=require(_0x95b8('0xf'));var hardwareService=require(_0x95b8('0x10'));var logger=require(_0x95b8('0x11'))(_0x95b8('0x12'));var utils=require('../../config/utils');var config=require(_0x95b8('0x13'));var db=require(_0x95b8('0x14'))['db'];function respondWithStatusCode(_0x312c36,_0x1d3c27){_0x1d3c27=_0x1d3c27||0xcc;return function(_0x5a8619){if(_0x5a8619){return _0x312c36[_0x95b8('0x15')](_0x1d3c27);}return _0x312c36['status'](_0x1d3c27)[_0x95b8('0x16')]();};}function respondWithResult(_0x2c4710,_0x24984b){_0x24984b=_0x24984b||0xc8;return function(_0x29c820){if(_0x29c820){return _0x2c4710['status'](_0x24984b)['json'](_0x29c820);}};}function respondWithFilteredResult(_0xe8c6e6,_0x48939e){return function(_0x160c9c){if(_0x160c9c){var _0x368c9f=_0x160c9c[_0x95b8('0x17')],_0x4ea567=_0x48939e[_0x95b8('0x18')],_0xe87f30=_0x48939e[_0x95b8('0x18')]+_0x48939e[_0x95b8('0x19')],_0x201c7f;if(_0xe87f30>=_0x368c9f){_0xe87f30=_0x368c9f;_0x201c7f=0xc8;}else{_0x201c7f=0xce;}_0xe8c6e6[_0x95b8('0x1a')](_0x201c7f);return _0xe8c6e6[_0x95b8('0x1b')]('Content-Range',_0x4ea567+'-'+_0xe87f30+'/'+_0x368c9f)[_0x95b8('0x1c')](_0x160c9c);}return null;};}function patchUpdates(_0x2069bb){return function(_0x6f8a5c){try{jsonpatch[_0x95b8('0x1d')](_0x6f8a5c,_0x2069bb,!![]);}catch(_0x12eed3){return BPromise[_0x95b8('0x1e')](_0x12eed3);}return _0x6f8a5c[_0x95b8('0x1f')]();};}function saveUpdates(_0x1cb658,_0x389385){return function(_0x1040e7){if(_0x1040e7){return _0x1040e7[_0x95b8('0x20')](_0x1cb658)[_0x95b8('0x21')](function(_0x36f4da){return _0x36f4da;});}return null;};}function removeEntity(_0x3a310f,_0x56705b){return function(_0x32ae5e){if(_0x32ae5e){return _0x32ae5e[_0x95b8('0x22')]()['then'](function(){_0x3a310f[_0x95b8('0x1a')](0xcc)[_0x95b8('0x16')]();});}};}function handleEntityNotFound(_0x3e49af,_0x3786b2){return function(_0x3e7dc7){if(!_0x3e7dc7){_0x3e49af[_0x95b8('0x15')](0x194);}return _0x3e7dc7;};}function handleError(_0x377be0,_0x5bc3d5){_0x5bc3d5=_0x5bc3d5||0x1f4;return function(_0x920e75){logger[_0x95b8('0x23')](_0x920e75[_0x95b8('0x24')]);if(_0x920e75[_0x95b8('0x25')]){delete _0x920e75[_0x95b8('0x25')];}_0x377be0[_0x95b8('0x1a')](_0x5bc3d5)['send'](_0x920e75);};}exports[_0x95b8('0x26')]=function(_0x4e4a97,_0x2c8d46){var _0x1c7512={},_0x32638b={},_0x64bd80={'count':0x0,'rows':[]};var _0x26e749=_['map'](db[_0x95b8('0x27')][_0x95b8('0x28')],function(_0x52e4cf){return{'name':_0x52e4cf['fieldName'],'type':_0x52e4cf[_0x95b8('0x29')][_0x95b8('0x2a')]};});_0x32638b[_0x95b8('0x2b')]=_[_0x95b8('0x2c')](_0x26e749,_0x95b8('0x25'));_0x32638b[_0x95b8('0x2d')]=_[_0x95b8('0x2e')](_0x4e4a97[_0x95b8('0x2d')]);_0x32638b[_0x95b8('0x2f')]=_[_0x95b8('0x30')](_0x32638b[_0x95b8('0x2b')],_0x32638b[_0x95b8('0x2d')]);_0x1c7512[_0x95b8('0x31')]=_[_0x95b8('0x30')](_0x32638b['model'],qs[_0x95b8('0x32')](_0x4e4a97['query']['fields']));_0x1c7512[_0x95b8('0x31')]=_0x1c7512[_0x95b8('0x31')][_0x95b8('0x33')]?_0x1c7512[_0x95b8('0x31')]:_0x32638b['model'];if(!_0x4e4a97['query'][_0x95b8('0x34')](_0x95b8('0x35'))){_0x1c7512['limit']=qs[_0x95b8('0x19')](_0x4e4a97[_0x95b8('0x2d')][_0x95b8('0x19')]);_0x1c7512['offset']=qs[_0x95b8('0x18')](_0x4e4a97[_0x95b8('0x2d')][_0x95b8('0x18')]);}_0x1c7512['order']=qs[_0x95b8('0x36')](_0x4e4a97[_0x95b8('0x2d')]['sort']);_0x1c7512[_0x95b8('0x37')]=qs[_0x95b8('0x2f')](_[_0x95b8('0x38')](_0x4e4a97['query'],_0x32638b['filters']),_0x26e749);if(_0x4e4a97[_0x95b8('0x2d')][_0x95b8('0x39')]){_0x1c7512[_0x95b8('0x37')]=_['merge'](_0x1c7512[_0x95b8('0x37')],{'$or':_[_0x95b8('0x2c')](_0x26e749,function(_0x1c59c8){if(_0x1c59c8['type']!==_0x95b8('0x3a')){var _0x4183cf={};_0x4183cf[_0x1c59c8[_0x95b8('0x25')]]={'$like':'%'+_0x4e4a97['query'][_0x95b8('0x39')]+'%'};return _0x4183cf;}})});}_0x1c7512=_[_0x95b8('0x3b')]({},_0x1c7512,_0x4e4a97[_0x95b8('0x3c')]);var _0x31db66={'where':_0x1c7512[_0x95b8('0x37')]};return db[_0x95b8('0x27')]['count'](_0x31db66)[_0x95b8('0x21')](function(_0xad434a){_0x64bd80['count']=_0xad434a;if(_0x4e4a97['query'][_0x95b8('0x3d')]){_0x1c7512[_0x95b8('0x3e')]=[{'all':!![]}];}return db[_0x95b8('0x27')][_0x95b8('0x3f')](_0x1c7512);})['then'](function(_0x3fc8d7){_0x64bd80[_0x95b8('0x40')]=_0x3fc8d7;return _0x64bd80;})[_0x95b8('0x21')](respondWithFilteredResult(_0x2c8d46,_0x1c7512))[_0x95b8('0x41')](handleError(_0x2c8d46,null));};exports['show']=function(_0x3438a7,_0x3f3c42){var _0x44bc2b={'raw':!![],'where':{'id':_0x3438a7[_0x95b8('0x42')]['id']}},_0xb92a19={};_0xb92a19[_0x95b8('0x2b')]=_[_0x95b8('0x2e')](db[_0x95b8('0x27')][_0x95b8('0x28')]);_0xb92a19[_0x95b8('0x2d')]=_[_0x95b8('0x2e')](_0x3438a7['query']);_0xb92a19[_0x95b8('0x2f')]=_[_0x95b8('0x30')](_0xb92a19['model'],_0xb92a19[_0x95b8('0x2d')]);_0x44bc2b[_0x95b8('0x31')]=_[_0x95b8('0x30')](_0xb92a19[_0x95b8('0x2b')],qs[_0x95b8('0x32')](_0x3438a7[_0x95b8('0x2d')][_0x95b8('0x32')]));_0x44bc2b[_0x95b8('0x31')]=_0x44bc2b[_0x95b8('0x31')][_0x95b8('0x33')]?_0x44bc2b[_0x95b8('0x31')]:_0xb92a19['model'];if(_0x3438a7[_0x95b8('0x2d')][_0x95b8('0x3d')]){_0x44bc2b[_0x95b8('0x3e')]=[{'all':!![]}];}_0x44bc2b=_['merge']({},_0x44bc2b,_0x3438a7[_0x95b8('0x3c')]);return db[_0x95b8('0x27')]['find'](_0x44bc2b)[_0x95b8('0x21')](handleEntityNotFound(_0x3f3c42,null))['then'](respondWithResult(_0x3f3c42,null))['catch'](handleError(_0x3f3c42,null));};exports[_0x95b8('0x43')]=function(_0x1ca164,_0x2c2b62){return db[_0x95b8('0x27')][_0x95b8('0x43')](_0x1ca164['body'],{})[_0x95b8('0x21')](respondWithResult(_0x2c2b62,0xc9))[_0x95b8('0x41')](handleError(_0x2c2b62,null));};exports['update']=function(_0x1d13c8,_0x2d70a9){if(_0x1d13c8[_0x95b8('0x44')]['id']){delete _0x1d13c8[_0x95b8('0x44')]['id'];}return db[_0x95b8('0x27')][_0x95b8('0x45')]({'where':{'id':_0x1d13c8[_0x95b8('0x42')]['id']}})[_0x95b8('0x21')](handleEntityNotFound(_0x2d70a9,null))[_0x95b8('0x21')](saveUpdates(_0x1d13c8[_0x95b8('0x44')],null))['then'](respondWithResult(_0x2d70a9,null))[_0x95b8('0x41')](handleError(_0x2d70a9,null));};exports['destroy']=function(_0x198c03,_0x29ea6d){return db['ChatTransferReport'][_0x95b8('0x45')]({'where':{'id':_0x198c03[_0x95b8('0x42')]['id']}})[_0x95b8('0x21')](handleEntityNotFound(_0x29ea6d,null))[_0x95b8('0x21')](removeEntity(_0x29ea6d,null))['catch'](handleError(_0x29ea6d,null));};exports['describe']=function(_0x109eac,_0x3daeb0){return db[_0x95b8('0x27')]['describe']()[_0x95b8('0x21')](respondWithResult(_0x3daeb0,null))[_0x95b8('0x41')](handleError(_0x3daeb0,null));}; \ No newline at end of file +var _0x5591=['findAll','rows','includeAll','include','find','create','body','catch','describe','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','update','destroy','error','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','count','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5591,0x158));var _0x1559=function(_0x52b746,_0x43d29a){_0x52b746=_0x52b746-0x0;var _0x56a505=_0x5591[_0x52b746];return _0x56a505;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1559('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1559('0x1'));var moment=require(_0x1559('0x2'));var BPromise=require(_0x1559('0x3'));var Mustache=require(_0x1559('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1559('0x5'));var csv=require(_0x1559('0x6'));var ejs=require(_0x1559('0x7'));var fs=require('fs');var _=require(_0x1559('0x8'));var squel=require(_0x1559('0x9'));var crypto=require('crypto');var jsforce=require(_0x1559('0xa'));var deskjs=require(_0x1559('0xb'));var toCsv=require(_0x1559('0x6'));var querystring=require(_0x1559('0xc'));var Papa=require(_0x1559('0xd'));var Redis=require(_0x1559('0xe'));var authService=require(_0x1559('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1559('0x10'));var hardwareService=require(_0x1559('0x11'));var logger=require(_0x1559('0x12'))(_0x1559('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1559('0x14'))['db'];function respondWithStatusCode(_0x418b5c,_0x1c6745){_0x1c6745=_0x1c6745||0xcc;return function(_0x34a70a){if(_0x34a70a){return _0x418b5c[_0x1559('0x15')](_0x1c6745);}return _0x418b5c[_0x1559('0x16')](_0x1c6745)[_0x1559('0x17')]();};}function respondWithResult(_0x19657c,_0x11021a){_0x11021a=_0x11021a||0xc8;return function(_0x15099c){if(_0x15099c){return _0x19657c[_0x1559('0x16')](_0x11021a)[_0x1559('0x18')](_0x15099c);}};}function respondWithFilteredResult(_0x392ace,_0x584211){return function(_0x28a79a){if(_0x28a79a){var _0x217e5a=_0x28a79a['count'],_0x48515f=_0x584211[_0x1559('0x19')],_0x55077d=_0x584211[_0x1559('0x19')]+_0x584211['limit'],_0x6534cd;if(_0x55077d>=_0x217e5a){_0x55077d=_0x217e5a;_0x6534cd=0xc8;}else{_0x6534cd=0xce;}_0x392ace[_0x1559('0x16')](_0x6534cd);return _0x392ace[_0x1559('0x1a')]('Content-Range',_0x48515f+'-'+_0x55077d+'/'+_0x217e5a)[_0x1559('0x18')](_0x28a79a);}return null;};}function patchUpdates(_0x5b3089){return function(_0x3a0067){try{jsonpatch[_0x1559('0x1b')](_0x3a0067,_0x5b3089,!![]);}catch(_0x329abf){return BPromise[_0x1559('0x1c')](_0x329abf);}return _0x3a0067['save']();};}function saveUpdates(_0x256740,_0x3cc528){return function(_0x446118){if(_0x446118){return _0x446118[_0x1559('0x1d')](_0x256740)['then'](function(_0x2487ae){return _0x2487ae;});}return null;};}function removeEntity(_0x2d364d,_0x826e3b){return function(_0x3f6902){if(_0x3f6902){return _0x3f6902[_0x1559('0x1e')]()['then'](function(){_0x2d364d['status'](0xcc)[_0x1559('0x17')]();});}};}function handleEntityNotFound(_0x5edcf3,_0x46fbdc){return function(_0x296ea8){if(!_0x296ea8){_0x5edcf3[_0x1559('0x15')](0x194);}return _0x296ea8;};}function handleError(_0xaf36cf,_0x36913e){_0x36913e=_0x36913e||0x1f4;return function(_0x389f88){logger[_0x1559('0x1f')](_0x389f88[_0x1559('0x20')]);if(_0x389f88[_0x1559('0x21')]){delete _0x389f88[_0x1559('0x21')];}_0xaf36cf[_0x1559('0x16')](_0x36913e)[_0x1559('0x22')](_0x389f88);};}exports['index']=function(_0x3ed5c5,_0xdd8f52){var _0x51eb8a={},_0x1ee96d={},_0x4a47d5={'count':0x0,'rows':[]};var _0x27bb01=_['map'](db[_0x1559('0x23')][_0x1559('0x24')],function(_0x70a871){return{'name':_0x70a871[_0x1559('0x25')],'type':_0x70a871[_0x1559('0x26')]['key']};});_0x1ee96d[_0x1559('0x27')]=_['map'](_0x27bb01,_0x1559('0x21'));_0x1ee96d['query']=_[_0x1559('0x28')](_0x3ed5c5[_0x1559('0x29')]);_0x1ee96d[_0x1559('0x2a')]=_[_0x1559('0x2b')](_0x1ee96d[_0x1559('0x27')],_0x1ee96d['query']);_0x51eb8a[_0x1559('0x2c')]=_[_0x1559('0x2b')](_0x1ee96d[_0x1559('0x27')],qs[_0x1559('0x2d')](_0x3ed5c5[_0x1559('0x29')][_0x1559('0x2d')]));_0x51eb8a[_0x1559('0x2c')]=_0x51eb8a[_0x1559('0x2c')][_0x1559('0x2e')]?_0x51eb8a[_0x1559('0x2c')]:_0x1ee96d[_0x1559('0x27')];if(!_0x3ed5c5[_0x1559('0x29')][_0x1559('0x2f')](_0x1559('0x30'))){_0x51eb8a[_0x1559('0x31')]=qs[_0x1559('0x31')](_0x3ed5c5['query'][_0x1559('0x31')]);_0x51eb8a['offset']=qs[_0x1559('0x19')](_0x3ed5c5[_0x1559('0x29')][_0x1559('0x19')]);}_0x51eb8a[_0x1559('0x32')]=qs[_0x1559('0x33')](_0x3ed5c5[_0x1559('0x29')][_0x1559('0x33')]);_0x51eb8a[_0x1559('0x34')]=qs[_0x1559('0x2a')](_['pick'](_0x3ed5c5['query'],_0x1ee96d[_0x1559('0x2a')]),_0x27bb01);if(_0x3ed5c5[_0x1559('0x29')][_0x1559('0x35')]){_0x51eb8a[_0x1559('0x34')]=_['merge'](_0x51eb8a[_0x1559('0x34')],{'$or':_['map'](_0x27bb01,function(_0x44568f){if(_0x44568f[_0x1559('0x26')]!=='VIRTUAL'){var _0x51bdec={};_0x51bdec[_0x44568f[_0x1559('0x21')]]={'$like':'%'+_0x3ed5c5[_0x1559('0x29')][_0x1559('0x35')]+'%'};return _0x51bdec;}})});}_0x51eb8a=_[_0x1559('0x36')]({},_0x51eb8a,_0x3ed5c5[_0x1559('0x37')]);var _0x283b40={'where':_0x51eb8a[_0x1559('0x34')]};return db['ChatTransferReport'][_0x1559('0x38')](_0x283b40)[_0x1559('0x39')](function(_0x2b2af5){_0x4a47d5[_0x1559('0x38')]=_0x2b2af5;if(_0x3ed5c5['query']['includeAll']){_0x51eb8a['include']=[{'all':!![]}];}return db[_0x1559('0x23')][_0x1559('0x3a')](_0x51eb8a);})['then'](function(_0xc303dc){_0x4a47d5[_0x1559('0x3b')]=_0xc303dc;return _0x4a47d5;})[_0x1559('0x39')](respondWithFilteredResult(_0xdd8f52,_0x51eb8a))['catch'](handleError(_0xdd8f52,null));};exports['show']=function(_0x9e47e0,_0x51bc19){var _0x45885c={'raw':!![],'where':{'id':_0x9e47e0['params']['id']}},_0x58d876={};_0x58d876[_0x1559('0x27')]=_[_0x1559('0x28')](db['ChatTransferReport'][_0x1559('0x24')]);_0x58d876[_0x1559('0x29')]=_[_0x1559('0x28')](_0x9e47e0[_0x1559('0x29')]);_0x58d876[_0x1559('0x2a')]=_['intersection'](_0x58d876[_0x1559('0x27')],_0x58d876['query']);_0x45885c[_0x1559('0x2c')]=_[_0x1559('0x2b')](_0x58d876[_0x1559('0x27')],qs[_0x1559('0x2d')](_0x9e47e0[_0x1559('0x29')]['fields']));_0x45885c[_0x1559('0x2c')]=_0x45885c[_0x1559('0x2c')][_0x1559('0x2e')]?_0x45885c[_0x1559('0x2c')]:_0x58d876[_0x1559('0x27')];if(_0x9e47e0[_0x1559('0x29')][_0x1559('0x3c')]){_0x45885c[_0x1559('0x3d')]=[{'all':!![]}];}_0x45885c=_[_0x1559('0x36')]({},_0x45885c,_0x9e47e0['options']);return db['ChatTransferReport'][_0x1559('0x3e')](_0x45885c)[_0x1559('0x39')](handleEntityNotFound(_0x51bc19,null))['then'](respondWithResult(_0x51bc19,null))['catch'](handleError(_0x51bc19,null));};exports['create']=function(_0xbd98da,_0x2a7b08){return db[_0x1559('0x23')][_0x1559('0x3f')](_0xbd98da[_0x1559('0x40')],{})[_0x1559('0x39')](respondWithResult(_0x2a7b08,0xc9))[_0x1559('0x41')](handleError(_0x2a7b08,null));};exports[_0x1559('0x1d')]=function(_0x5626bf,_0x269ffe){if(_0x5626bf[_0x1559('0x40')]['id']){delete _0x5626bf['body']['id'];}return db[_0x1559('0x23')][_0x1559('0x3e')]({'where':{'id':_0x5626bf['params']['id']}})['then'](handleEntityNotFound(_0x269ffe,null))[_0x1559('0x39')](saveUpdates(_0x5626bf[_0x1559('0x40')],null))['then'](respondWithResult(_0x269ffe,null))[_0x1559('0x41')](handleError(_0x269ffe,null));};exports[_0x1559('0x1e')]=function(_0x12f118,_0x36a281){return db[_0x1559('0x23')]['find']({'where':{'id':_0x12f118['params']['id']}})[_0x1559('0x39')](handleEntityNotFound(_0x36a281,null))[_0x1559('0x39')](removeEntity(_0x36a281,null))[_0x1559('0x41')](handleError(_0x36a281,null));};exports[_0x1559('0x42')]=function(_0x535fbc,_0x4f39a9){return db[_0x1559('0x23')][_0x1559('0x42')]()[_0x1559('0x39')](respondWithResult(_0x4f39a9,null))[_0x1559('0x41')](handleError(_0x4f39a9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c6e1de1..624b4dc 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 _0xe1a8=['request-promise','path','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3aba65,_0x39f28c){var _0x5a6589=function(_0x5cb07d){while(--_0x5cb07d){_0x3aba65['push'](_0x3aba65['shift']());}};_0x5a6589(++_0x39f28c);}(_0xe1a8,0x6f));var _0x8e1a=function(_0x4805fe,_0x51711e){_0x4805fe=_0x4805fe-0x0;var _0x40de4c=_0xe1a8[_0x4805fe];return _0x40de4c;};'use strict';var _=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var logger=require(_0x8e1a('0x2'))(_0x8e1a('0x3'));var moment=require(_0x8e1a('0x4'));var BPromise=require(_0x8e1a('0x5'));var rp=require(_0x8e1a('0x6'));var fs=require('fs');var path=require(_0x8e1a('0x7'));var rimraf=require('rimraf');var config=require(_0x8e1a('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x8e1a('0x9')]=function(_0x494007,_0x8de75){return _0x494007['define'](_0x8e1a('0xa'),attributes,{'tableName':_0x8e1a('0xb'),'paranoid':![],'indexes':[{'name':_0x8e1a('0xc'),'fields':[_0x8e1a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd594=['define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x28a338,_0x69a8eb){var _0x17453f=function(_0x4634aa){while(--_0x4634aa){_0x28a338['push'](_0x28a338['shift']());}};_0x17453f(++_0x69a8eb);}(_0xd594,0xab));var _0x4d59=function(_0x429202,_0x3dbad7){_0x429202=_0x429202-0x0;var _0x3f7b7a=_0xd594[_0x429202];return _0x3f7b7a;};'use strict';var _=require(_0x4d59('0x0'));var util=require(_0x4d59('0x1'));var logger=require(_0x4d59('0x2'))('api');var moment=require(_0x4d59('0x3'));var BPromise=require(_0x4d59('0x4'));var rp=require(_0x4d59('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d59('0x6'));var config=require(_0x4d59('0x7'));var attributes=require(_0x4d59('0x8'));module['exports']=function(_0x449634,_0x20433b){return _0x449634[_0x4d59('0x9')](_0x4d59('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4d59('0xb'),'fields':[_0x4d59('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 65183a1..316a999 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 _0xe9b4=['../../config/environment','jayson/promise','client','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x410001,_0x4705c1){var _0x2781cf=function(_0x693562){while(--_0x693562){_0x410001['push'](_0x410001['shift']());}};_0x2781cf(++_0x4705c1);}(_0xe9b4,0x1f1));var _0x4e9b=function(_0x4f9d25,_0x619f56){_0x4f9d25=_0x4f9d25-0x0;var _0x3aa11b=_0xe9b4[_0x4f9d25];return _0x3aa11b;};'use strict';var _=require('lodash');var util=require(_0x4e9b('0x0'));var moment=require(_0x4e9b('0x1'));var BPromise=require(_0x4e9b('0x2'));var rs=require(_0x4e9b('0x3'));var fs=require('fs');var Redis=require(_0x4e9b('0x4'));var db=require(_0x4e9b('0x5'))['db'];var utils=require(_0x4e9b('0x6'));var logger=require(_0x4e9b('0x7'))(_0x4e9b('0x8'));var config=require(_0x4e9b('0x9'));var jayson=require(_0x4e9b('0xa'));var client=jayson[_0x4e9b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d863a,_0x17295a,_0x3d95b8){return new BPromise(function(_0x564242,_0x461a59){return client[_0x4e9b('0xc')](_0x5d863a,_0x3d95b8)['then'](function(_0x1c0536){logger['info'](_0x4e9b('0xd'),_0x17295a,_0x4e9b('0xe'));logger[_0x4e9b('0xf')](_0x4e9b('0x10'),_0x17295a,_0x4e9b('0xe'),JSON[_0x4e9b('0x11')](_0x1c0536));if(_0x1c0536[_0x4e9b('0x12')]){if(_0x1c0536[_0x4e9b('0x12')][_0x4e9b('0x13')]===0x1f4){logger[_0x4e9b('0x12')](_0x4e9b('0xd'),_0x17295a,_0x1c0536[_0x4e9b('0x12')][_0x4e9b('0x14')]);return _0x461a59(_0x1c0536['error']['message']);}logger[_0x4e9b('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x17295a,_0x1c0536[_0x4e9b('0x12')][_0x4e9b('0x14')]);return _0x564242(_0x1c0536[_0x4e9b('0x12')][_0x4e9b('0x14')]);}else{logger[_0x4e9b('0x15')](_0x4e9b('0xd'),_0x17295a,_0x4e9b('0xe'));_0x564242(_0x1c0536[_0x4e9b('0x16')][_0x4e9b('0x14')]);}})['catch'](function(_0x403d8a){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x17295a,_0x403d8a);_0x461a59(_0x403d8a);});});} \ No newline at end of file +var _0x8e92=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x1faf5f,_0x4e157d){var _0xa10013=function(_0x57abcf){while(--_0x57abcf){_0x1faf5f['push'](_0x1faf5f['shift']());}};_0xa10013(++_0x4e157d);}(_0x8e92,0x158));var _0x28e9=function(_0x436492,_0x703551){_0x436492=_0x436492-0x0;var _0xc887fd=_0x8e92[_0x436492];return _0xc887fd;};'use strict';var _=require('lodash');var util=require(_0x28e9('0x0'));var moment=require(_0x28e9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28e9('0x2'));var db=require(_0x28e9('0x3'))['db'];var utils=require(_0x28e9('0x4'));var logger=require(_0x28e9('0x5'))('rpc');var config=require(_0x28e9('0x6'));var jayson=require(_0x28e9('0x7'));var client=jayson[_0x28e9('0x8')][_0x28e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb1dd,_0x39318b,_0x4e1263){return new BPromise(function(_0x19dbe3,_0x17a1e0){return client[_0x28e9('0xa')](_0x5eb1dd,_0x4e1263)[_0x28e9('0xb')](function(_0x2328f4){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x39318b,_0x28e9('0xc'));logger[_0x28e9('0xd')](_0x28e9('0xe'),_0x39318b,'request\x20sent',JSON[_0x28e9('0xf')](_0x2328f4));if(_0x2328f4[_0x28e9('0x10')]){if(_0x2328f4[_0x28e9('0x10')][_0x28e9('0x11')]===0x1f4){logger[_0x28e9('0x10')](_0x28e9('0x12'),_0x39318b,_0x2328f4['error']['message']);return _0x17a1e0(_0x2328f4[_0x28e9('0x10')][_0x28e9('0x13')]);}logger['error'](_0x28e9('0x12'),_0x39318b,_0x2328f4[_0x28e9('0x10')][_0x28e9('0x13')]);return _0x19dbe3(_0x2328f4[_0x28e9('0x10')][_0x28e9('0x13')]);}else{logger[_0x28e9('0x14')](_0x28e9('0x12'),_0x39318b,_0x28e9('0xc'));_0x19dbe3(_0x2328f4[_0x28e9('0x15')]['message']);}})[_0x28e9('0x16')](function(_0x5f4c55){logger[_0x28e9('0x10')](_0x28e9('0x12'),_0x39318b,_0x5f4c55);_0x17a1e0(_0x5f4c55);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c84713b..23b30dc 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0x757a,0xde));var _0xa757=function(_0x426107,_0xaa2e90){_0x426107=_0x426107-0x0;var _0xfa4794=_0x757a[_0x426107];return _0xfa4794;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2a46d3,_0x466787){var _0xfb49e4=function(_0x5b3b51){while(--_0x5b3b51){_0x2a46d3['push'](_0x2a46d3['shift']());}};_0xfb49e4(++_0x466787);}(_0x2032,0xd9));var _0x2203=function(_0x3085f8,_0x2d2638){_0x3085f8=_0x3085f8-0x0;var _0x38a5c4=_0x2032[_0x3085f8];return _0x38a5c4;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6bbd3af..d0192e9 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 _0xc82f=['randomstring','exports','STRING','address','email','#9f946a','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','star','thumb','input','name','onlineForm','getDataValue','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition'];(function(_0xa7b401,_0x3f9109){var _0x5326ef=function(_0x5daa3c){while(--_0x5daa3c){_0xa7b401['push'](_0xa7b401['shift']());}};_0x5326ef(++_0x3f9109);}(_0xc82f,0x84));var _0xfc82=function(_0x3caf66,_0x3b3374){_0x3caf66=_0x3caf66-0x0;var _0x134621=_0xc82f[_0x3caf66];return _0x134621;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfc82('0x0'));module[_0xfc82('0x1')]={'name':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![],'unique':_0xfc82('0x3')},'description':{'type':Sequelize[_0xfc82('0x2')]},'mapKey':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x4')},'mapKeyOffline':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x4')},'key':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![],'defaultValue':_0xfc82('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![],'defaultValue':_0xfc82('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![],'defaultValue':_0xfc82('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfc82('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xfc82('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfc82('0x8')]('rounded','squared'),'defaultValue':_0xfc82('0x9')},'header_online':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfc82('0xb')},'header_offline':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0xc')},'download_transcript':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xfc82('0xe')]},'closingQuestion':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xfc82('0x12')},'placeholderMessage':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x13')},'closingMessage':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xfc82('0x14')},'conditionAgreement':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xfc82('0x8')](_0xfc82('0x15'),_0xfc82('0x16')),'defaultValue':_0xfc82('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xfc82('0x17'),'variable':null,'config':{'placeholder':_0xfc82('0x18'),'type':'text','required':!![]},'props':{'title':_0xfc82('0x18'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xfc82('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xfc82('0x19'))?JSON['parse'](this[_0xfc82('0x1a')](_0xfc82('0x19'))):{};},'set':function(_0x475893){return this[_0xfc82('0x1b')](_0xfc82('0x19'),JSON[_0xfc82('0x1c')](_0x475893));}},'offlineForm':{'type':Sequelize[_0xfc82('0xe')],'defaultValue':function(){return JSON[_0xfc82('0x1c')]({'items':[{'type':_0xfc82('0x17'),'props':{'title':_0xfc82('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xfc82('0x4'),'type':_0xfc82('0x4')},'variable':null},{'type':_0xfc82('0x1d'),'config':{'placeholder':_0xfc82('0x1e')},'props':{'title':_0xfc82('0x1e'),'helpText':_0xfc82('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xfc82('0x1a')](_0xfc82('0x20'))?JSON[_0xfc82('0x21')](this[_0xfc82('0x1a')](_0xfc82('0x20'))):{};},'set':function(_0x1ffecc){return this['setDataValue'](_0xfc82('0x20'),JSON['stringify'](_0x1ffecc));}},'token':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfc82('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x22')},'waitingMessage':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x23')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xfc82('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x25')},'skipUnmanaged':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xfc82('0x2')]},'notificationTemplate':{'type':Sequelize[_0xfc82('0xe')],'defaultValue':function(){return _0xfc82('0x26');}},'notificationSound':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xfc82('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x27')},'verticalAlignment':{'type':Sequelize[_0xfc82('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfc82('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfc82('0x2')],'allowNull':![],'defaultValue':_0xfc82('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfc82('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfc82('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':_0xfc82('0x29')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfc82('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xfc82('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xd24553){if(!_0xd24553)this[_0xfc82('0x1b')]('mandatoryDispositionPauseId',null);this[_0xfc82('0x1b')](_0xfc82('0x2b'),_0xd24553);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xfc82('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4bd=['sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Skip','Feedback','ENUM','thumb','star','TEXT','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xd4bd,0x190));var _0xdd4b=function(_0x321985,_0x15180c){_0x321985=_0x321985-0x0;var _0x1f09f5=_0xd4bd[_0x321985];return _0x1f09f5;};'use strict';var Sequelize=require(_0xdd4b('0x0'));var rs=require(_0xdd4b('0x1'));module[_0xdd4b('0x2')]={'name':{'type':Sequelize[_0xdd4b('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdd4b('0x4')},'description':{'type':Sequelize[_0xdd4b('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xdd4b('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xdd4b('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x6')},'customerAlias':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdd4b('0x3')],'allowNull':![],'defaultValue':_0xdd4b('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdd4b('0x3')],'allowNull':![],'defaultValue':_0xdd4b('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdd4b('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xdd4b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdd4b('0x3')]},'animation':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xdd4b('0xa'),'squared'),'defaultValue':_0xdd4b('0xa')},'header_online':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0xb')},'start_chat_button':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0xc')},'offline_chat_button':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdd4b('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xdd4b('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x11')},'placeholderMessage':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x12')},'closingMessage':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xdd4b('0x13')},'conditionAgreement':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x14')},'ratingType':{'type':Sequelize[_0xdd4b('0x15')]('star',_0xdd4b('0x16')),'defaultValue':_0xdd4b('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xdd4b('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdd4b('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xdd4b('0x19'),'variable':null,'config':{'placeholder':_0xdd4b('0x1a'),'type':_0xdd4b('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xdd4b('0x19'),'props':{'title':_0xdd4b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdd4b('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdd4b('0x1c')](_0xdd4b('0x1d'))?JSON[_0xdd4b('0x1e')](this['getDataValue'](_0xdd4b('0x1d'))):{};},'set':function(_0x1ac6f0){return this[_0xdd4b('0x1f')](_0xdd4b('0x1d'),JSON['stringify'](_0x1ac6f0));}},'offlineForm':{'type':Sequelize[_0xdd4b('0x18')],'defaultValue':function(){return JSON[_0xdd4b('0x20')]({'items':[{'type':_0xdd4b('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xdd4b('0x5'),'type':_0xdd4b('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xdd4b('0x21')},'props':{'title':_0xdd4b('0x21'),'helpText':_0xdd4b('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xdd4b('0x1c')](_0xdd4b('0x23'))?JSON[_0xdd4b('0x1e')](this['getDataValue'](_0xdd4b('0x23'))):{};},'set':function(_0x1eec4c){return this[_0xdd4b('0x1f')](_0xdd4b('0x23'),JSON[_0xdd4b('0x20')](_0x1eec4c));}},'token':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':function(){return rs[_0xdd4b('0x24')]();}},'autoclose':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdd4b('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdd4b('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xdd4b('0x25')},'waitingMessage':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x27')},'offlineMessageBody':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xdd4b('0x13')},'sendUnmanaged':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdd4b('0x18')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdd4b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdd4b('0x18')],'defaultValue':function(){return _0xdd4b('0x2a');}},'notificationSound':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xdd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x2c')},'verticalAlignment':{'type':Sequelize[_0xdd4b('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x2d')},'defaultTitle':{'type':Sequelize[_0xdd4b('0x3')]},'customerAvatar':{'type':Sequelize[_0xdd4b('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdd4b('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdd4b('0x3')],'allowNull':![],'defaultValue':_0xdd4b('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd4b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':_0xdd4b('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xdd4b('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5e5674){if(!_0x5e5674)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xdd4b('0x1f')](_0xdd4b('0x31'),_0x5e5674);}},'vidaooEscalation':{'type':Sequelize[_0xdd4b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdd4b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index fadbd97..f13b76b 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 _0xa979=['device','%s\x20%s\x20%s','threadId','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','render','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','service','host','port','secure','auth','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','ChatInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','OFFLINE','No\x20timezone','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','readFileSync','server/files/chat/iframe.js','utf8','stringify','x-real-ip','connection','replace','alignment','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','status','count','offset','limit','set','json','apply','save','update','destroy','ChatWebsites','UserProfileResource','end','stack','name','send','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','Pause','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','findOne','filter','options','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','ChatApplication','List','applications','Applications','list','orderBy','priority','asc','account','defaults','ListId','CmContact','contact','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown'];(function(_0x46462e,_0x4e79ba){var _0x5537b9=function(_0x2361cf){while(--_0x2361cf){_0x46462e['push'](_0x46462e['shift']());}};_0x5537b9(++_0x4e79ba);}(_0xa979,0x188));var _0x9a97=function(_0x5f1431,_0x49bea0){_0x5f1431=_0x5f1431-0x0;var _0x165500=_0xa979[_0x5f1431];return _0x165500;};'use strict';var pdf=require(_0x9a97('0x0'));var emlformat=require(_0x9a97('0x1'));var rimraf=require(_0x9a97('0x2'));var zipdir=require(_0x9a97('0x3'));var jsonpatch=require(_0x9a97('0x4'));var rp=require(_0x9a97('0x5'));var moment=require(_0x9a97('0x6'));var BPromise=require(_0x9a97('0x7'));var Mustache=require(_0x9a97('0x8'));var util=require(_0x9a97('0x9'));var path=require('path');var sox=require(_0x9a97('0xa'));var csv=require(_0x9a97('0xb'));var ejs=require(_0x9a97('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a97('0xd'));var crypto=require(_0x9a97('0xe'));var jsforce=require(_0x9a97('0xf'));var deskjs=require(_0x9a97('0x10'));var toCsv=require(_0x9a97('0xb'));var querystring=require(_0x9a97('0x11'));var Papa=require('papaparse');var Redis=require(_0x9a97('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a97('0x13'));var hardwareService=require(_0x9a97('0x14'));var logger=require(_0x9a97('0x15'))(_0x9a97('0x16'));var utils=require(_0x9a97('0x17'));var config=require('../../config/environment');var db=require(_0x9a97('0x18'))['db'];config[_0x9a97('0x19')]=_['defaults'](config[_0x9a97('0x19')],{'host':_0x9a97('0x1a'),'port':0x18eb});var socket=require(_0x9a97('0x1b'))(new Redis(config['redis']));require(_0x9a97('0x1c'))[_0x9a97('0x1d')](socket);var jayson=require(_0x9a97('0x1e'));var client=jayson[_0x9a97('0x1f')][_0x9a97('0x20')]({'port':0x232c});var client9002=jayson[_0x9a97('0x1f')][_0x9a97('0x20')]({'port':0x232a});var client9003=jayson['client'][_0x9a97('0x20')]({'port':0x232b});function checkPasswordPattern(_0x460fd1,_0x34f66f,_0x9824c6){if(_0x9824c6){var _0x31bd52=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31bd52[_0x9a97('0x21')](_0x34f66f)){return _0x460fd1;}else{throw new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x24'));}}else{return _0x460fd1;}}function respondWithRpcPromise(_0x38ce19,_0x44d5e9,_0x1931ea,_0x3c6f04){return new BPromise(function(_0x3b5a66,_0xf618e3){var _0x112229=_0x3c6f04||client;return _0x112229[_0x9a97('0x25')](_0x38ce19,_0x1931ea)[_0x9a97('0x26')](function(_0x36a2c6){logger[_0x9a97('0x27')](_0x9a97('0x28'),_0x44d5e9,'request\x20sent');logger[_0x9a97('0x29')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x44d5e9,_0x9a97('0x2a'),JSON['stringify'](_0x36a2c6));if(_0x36a2c6[_0x9a97('0x2b')]){if(_0x36a2c6[_0x9a97('0x2b')]['code']===0x1f4){logger[_0x9a97('0x2b')](_0x9a97('0x28'),_0x44d5e9,_0x36a2c6[_0x9a97('0x2b')][_0x9a97('0x2c')]);return _0xf618e3(_0x36a2c6[_0x9a97('0x2b')]['message']);}logger[_0x9a97('0x2b')](_0x9a97('0x28'),_0x44d5e9,_0x36a2c6[_0x9a97('0x2b')][_0x9a97('0x2c')]);return _0x3b5a66(_0x36a2c6[_0x9a97('0x2b')]['message']);}else{logger[_0x9a97('0x27')](_0x9a97('0x28'),_0x44d5e9,_0x9a97('0x2a'));_0x3b5a66(_0x36a2c6[_0x9a97('0x2d')][_0x9a97('0x2c')]);}})[_0x9a97('0x2e')](function(_0x5ad3a6){logger[_0x9a97('0x2b')]('ChatWebsite,\x20%s,\x20%s',_0x44d5e9,_0x5ad3a6);_0xf618e3(_0x5ad3a6);});});}function respondWithStatusCode(_0xd1a789,_0x160dae){_0x160dae=_0x160dae||0xcc;return function(_0x4868b5){if(_0x4868b5){return _0xd1a789[_0x9a97('0x2f')](_0x160dae);}return _0xd1a789[_0x9a97('0x30')](_0x160dae)['end']();};}function respondWithResult(_0x4c9273,_0x17d4d2){_0x17d4d2=_0x17d4d2||0xc8;return function(_0x14306e){if(_0x14306e){return _0x4c9273[_0x9a97('0x30')](_0x17d4d2)['json'](_0x14306e);}};}function respondWithFilteredResult(_0x5758af,_0x3ad668){return function(_0x171be3){if(_0x171be3){var _0x2679a4=_0x171be3[_0x9a97('0x31')],_0x211167=_0x3ad668[_0x9a97('0x32')],_0x23a0e8=_0x3ad668[_0x9a97('0x32')]+_0x3ad668[_0x9a97('0x33')],_0x291b8e;if(_0x23a0e8>=_0x2679a4){_0x23a0e8=_0x2679a4;_0x291b8e=0xc8;}else{_0x291b8e=0xce;}_0x5758af[_0x9a97('0x30')](_0x291b8e);return _0x5758af[_0x9a97('0x34')]('Content-Range',_0x211167+'-'+_0x23a0e8+'/'+_0x2679a4)[_0x9a97('0x35')](_0x171be3);}return null;};}function patchUpdates(_0x33516d){return function(_0x37041f){try{jsonpatch[_0x9a97('0x36')](_0x37041f,_0x33516d,!![]);}catch(_0x33b269){return BPromise['reject'](_0x33b269);}return _0x37041f[_0x9a97('0x37')]();};}function saveUpdates(_0x1d0b47,_0x134e05){return function(_0x47f8e9){if(_0x47f8e9){return _0x47f8e9[_0x9a97('0x38')](_0x1d0b47)[_0x9a97('0x26')](function(_0x4dbc6b){return _0x4dbc6b;});}return null;};}function removeEntity(_0x3f8986,_0x4f9252){return function(_0x30b30b){if(_0x30b30b){return _0x30b30b[_0x9a97('0x39')]()['then'](function(){var _0x54258e=_0x30b30b['get']({'plain':!![]});var _0xbd2ec0=_0x9a97('0x3a');return db[_0x9a97('0x3b')][_0x9a97('0x39')]({'where':{'type':_0xbd2ec0,'resourceId':_0x54258e['id']}})[_0x9a97('0x26')](function(){return _0x30b30b;});})[_0x9a97('0x26')](function(){_0x3f8986[_0x9a97('0x30')](0xcc)[_0x9a97('0x3c')]();});}};}function handleEntityNotFound(_0x57532b,_0x3dd3be){return function(_0x2ff9c3){if(!_0x2ff9c3){_0x57532b['sendStatus'](0x194);}return _0x2ff9c3;};}function handleError(_0xcde104,_0x237f9e){_0x237f9e=_0x237f9e||0x1f4;return function(_0x333a41){logger[_0x9a97('0x2b')](_0x333a41[_0x9a97('0x3d')]);if(_0x333a41[_0x9a97('0x3e')]){delete _0x333a41['name'];}_0xcde104['status'](_0x237f9e)[_0x9a97('0x3f')](_0x333a41);};}exports['index']=function(_0x38b9fe,_0x5a10de){var _0x3d8ff3={'include':[{'model':db['Pause'],'as':_0x9a97('0x40')}]},_0x41bd97={},_0x50eeb3={'count':0x0,'rows':[]};var _0x2988e8=_[_0x9a97('0x41')](db[_0x9a97('0x42')][_0x9a97('0x43')],function(_0x3079e7){return{'name':_0x3079e7[_0x9a97('0x44')],'type':_0x3079e7[_0x9a97('0x45')]['key']};});_0x41bd97[_0x9a97('0x46')]=_['map'](_0x2988e8,_0x9a97('0x3e'));_0x41bd97['query']=_['keys'](_0x38b9fe[_0x9a97('0x47')]);_0x41bd97[_0x9a97('0x48')]=_[_0x9a97('0x49')](_0x41bd97[_0x9a97('0x46')],_0x41bd97[_0x9a97('0x47')]);_0x3d8ff3[_0x9a97('0x4a')]=_[_0x9a97('0x49')](_0x41bd97[_0x9a97('0x46')],qs[_0x9a97('0x4b')](_0x38b9fe['query']['fields']));_0x3d8ff3[_0x9a97('0x4a')]=_0x3d8ff3['attributes'][_0x9a97('0x4c')]?_0x3d8ff3[_0x9a97('0x4a')]:_0x41bd97['model'];if(!_0x38b9fe[_0x9a97('0x47')]['hasOwnProperty'](_0x9a97('0x4d'))){_0x3d8ff3[_0x9a97('0x33')]=qs[_0x9a97('0x33')](_0x38b9fe[_0x9a97('0x47')][_0x9a97('0x33')]);_0x3d8ff3['offset']=qs[_0x9a97('0x32')](_0x38b9fe['query'][_0x9a97('0x32')]);}_0x3d8ff3[_0x9a97('0x4e')]=qs[_0x9a97('0x4f')](_0x38b9fe[_0x9a97('0x47')][_0x9a97('0x4f')]);_0x3d8ff3[_0x9a97('0x50')]=qs['filters'](_[_0x9a97('0x51')](_0x38b9fe[_0x9a97('0x47')],_0x41bd97[_0x9a97('0x48')]),_0x2988e8);if(_0x38b9fe[_0x9a97('0x47')]['filter']){_0x3d8ff3[_0x9a97('0x50')]=_[_0x9a97('0x52')](_0x3d8ff3[_0x9a97('0x50')],{'$or':_[_0x9a97('0x41')](_0x2988e8,function(_0x781eec){if(_0x781eec[_0x9a97('0x45')]!==_0x9a97('0x53')){var _0x2ed002={};_0x2ed002[_0x781eec[_0x9a97('0x3e')]]={'$like':'%'+_0x38b9fe[_0x9a97('0x47')]['filter']+'%'};return _0x2ed002;}})});}_0x3d8ff3=_['merge']({},_0x3d8ff3,_0x38b9fe['options']);var _0x5053e9={'where':_0x3d8ff3[_0x9a97('0x50')]};return db[_0x9a97('0x42')][_0x9a97('0x31')](_0x5053e9)[_0x9a97('0x26')](function(_0x24f42e){_0x50eeb3['count']=_0x24f42e;if(_0x38b9fe[_0x9a97('0x47')][_0x9a97('0x54')]){_0x3d8ff3[_0x9a97('0x55')]=[{'all':!![]}];}return db[_0x9a97('0x42')][_0x9a97('0x56')](_0x3d8ff3);})[_0x9a97('0x26')](function(_0x1c8fc8){_0x50eeb3[_0x9a97('0x57')]=_0x1c8fc8;return _0x50eeb3;})[_0x9a97('0x26')](respondWithFilteredResult(_0x5a10de,_0x3d8ff3))[_0x9a97('0x2e')](handleError(_0x5a10de,null));};exports[_0x9a97('0x58')]=function(_0x50121d,_0x41b997){var _0x23784b={'raw':![],'where':{'id':_0x50121d['params']['id']},'include':[{'model':db[_0x9a97('0x59')],'as':_0x9a97('0x40')}]},_0x3fbb6c={};_0x3fbb6c[_0x9a97('0x46')]=_['keys'](db[_0x9a97('0x42')][_0x9a97('0x43')]);_0x3fbb6c[_0x9a97('0x47')]=_[_0x9a97('0x5a')](_0x50121d[_0x9a97('0x47')]);_0x3fbb6c[_0x9a97('0x48')]=_[_0x9a97('0x49')](_0x3fbb6c[_0x9a97('0x46')],_0x3fbb6c[_0x9a97('0x47')]);_0x23784b[_0x9a97('0x4a')]=_[_0x9a97('0x49')](_0x3fbb6c[_0x9a97('0x46')],qs[_0x9a97('0x4b')](_0x50121d[_0x9a97('0x47')]['fields']));_0x23784b[_0x9a97('0x4a')]=_0x23784b[_0x9a97('0x4a')]['length']?_0x23784b[_0x9a97('0x4a')]:_0x3fbb6c[_0x9a97('0x46')];if(_0x50121d[_0x9a97('0x47')][_0x9a97('0x54')]){_0x23784b[_0x9a97('0x55')]=[{'all':!![]}];}_0x23784b=_['merge']({},_0x23784b,_0x50121d['options']);return db[_0x9a97('0x42')][_0x9a97('0x5b')](_0x23784b)[_0x9a97('0x26')](handleEntityNotFound(_0x41b997,null))[_0x9a97('0x26')](respondWithResult(_0x41b997,null))[_0x9a97('0x2e')](handleError(_0x41b997,null));};exports[_0x9a97('0x5c')]=function(_0x21642f,_0x35543d){return db[_0x9a97('0x42')][_0x9a97('0x5c')](_0x21642f[_0x9a97('0x5d')],{})[_0x9a97('0x26')](function(_0x274e1c){var _0x4230c1=_0x21642f[_0x9a97('0x5e')][_0x9a97('0x5f')]({'plain':!![]});if(!_0x4230c1)throw new Error(_0x9a97('0x60'));if(_0x4230c1[_0x9a97('0x61')]==='user'){var _0x381b25=_0x274e1c[_0x9a97('0x5f')]({'plain':!![]});var _0x36c542=_0x9a97('0x3a');return db['UserProfileSection'][_0x9a97('0x5b')]({'where':{'name':_0x36c542,'userProfileId':_0x4230c1[_0x9a97('0x62')]},'raw':!![]})[_0x9a97('0x26')](function(_0x2d0ec2){if(_0x2d0ec2&&_0x2d0ec2[_0x9a97('0x63')]===0x0){return db[_0x9a97('0x3b')][_0x9a97('0x5c')]({'name':_0x381b25[_0x9a97('0x3e')],'resourceId':_0x381b25['id'],'type':_0x2d0ec2[_0x9a97('0x3e')],'sectionId':_0x2d0ec2['id']},{})['then'](function(){return _0x274e1c;});}else{return _0x274e1c;}})[_0x9a97('0x2e')](function(_0xea8cf2){logger['error'](_0x9a97('0x64'),_0xea8cf2);throw _0xea8cf2;});}return _0x274e1c;})[_0x9a97('0x26')](respondWithResult(_0x35543d,0xc9))['catch'](handleError(_0x35543d,null));};exports[_0x9a97('0x38')]=function(_0x51affe,_0x2b2cc4){if(_0x51affe[_0x9a97('0x5d')]['id']){delete _0x51affe[_0x9a97('0x5d')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x51affe[_0x9a97('0x65')]['id']},'include':[{'model':db[_0x9a97('0x59')],'as':_0x9a97('0x40')}]})['then'](handleEntityNotFound(_0x2b2cc4,null))[_0x9a97('0x26')](saveUpdates(_0x51affe[_0x9a97('0x5d')],null))['then'](respondWithResult(_0x2b2cc4,null))[_0x9a97('0x2e')](handleError(_0x2b2cc4,null));};exports[_0x9a97('0x39')]=function(_0x4ac265,_0x1558e7){return db['ChatWebsite'][_0x9a97('0x5b')]({'where':{'id':_0x4ac265[_0x9a97('0x65')]['id']}})['then'](handleEntityNotFound(_0x1558e7,null))[_0x9a97('0x26')](removeEntity(_0x1558e7,null))[_0x9a97('0x2e')](handleError(_0x1558e7,null));};exports[_0x9a97('0x66')]=function(_0x2d71be,_0xb06ef0){return db['ChatWebsite'][_0x9a97('0x66')]()[_0x9a97('0x26')](respondWithResult(_0xb06ef0,null))[_0x9a97('0x2e')](handleError(_0xb06ef0,null));};exports[_0x9a97('0x67')]=function(_0x4febe6,_0x26619f,_0x4ce7d1){if(_0x4febe6['body']['id']){delete _0x4febe6['body']['id'];}return db[_0x9a97('0x42')][_0x9a97('0x5b')]({'where':{'id':_0x4febe6['params']['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x26619f,null))[_0x9a97('0x26')](function(_0x34332f){if(_0x34332f){_0x4febe6['body'][_0x9a97('0x68')]=_0x34332f['id'];return db[_0x9a97('0x69')]['create'](_0x4febe6[_0x9a97('0x5d')]);}})[_0x9a97('0x26')](respondWithResult(_0x26619f,null))[_0x9a97('0x2e')](handleError(_0x26619f,null));};exports['getDispositions']=function(_0x436b7b,_0x335fbe,_0x547613){var _0x1f351b={'raw':![],'where':{}};var _0x380fba={};var _0xb6bd3f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9a97('0x6a')]({'where':{'id':_0x436b7b[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x335fbe,null))['then'](function(_0x47cd05){if(_0x47cd05){_0x380fba[_0x9a97('0x46')]=_['keys'](db['Disposition'][_0x9a97('0x43')]);_0x380fba['query']=_[_0x9a97('0x5a')](_0x436b7b['query']);_0x380fba['filters']=_[_0x9a97('0x49')](_0x380fba[_0x9a97('0x46')],_0x380fba[_0x9a97('0x47')]);_0x1f351b[_0x9a97('0x4a')]=_[_0x9a97('0x49')](_0x380fba['model'],qs[_0x9a97('0x4b')](_0x436b7b[_0x9a97('0x47')][_0x9a97('0x4b')]));_0x1f351b[_0x9a97('0x4a')]=_0x1f351b[_0x9a97('0x4a')]['length']?_0x1f351b['attributes']:_0x380fba[_0x9a97('0x46')];if(!_0x436b7b[_0x9a97('0x47')]['hasOwnProperty'](_0x9a97('0x4d'))){_0x1f351b[_0x9a97('0x33')]=qs['limit'](_0x436b7b[_0x9a97('0x47')][_0x9a97('0x33')]);_0x1f351b[_0x9a97('0x32')]=qs[_0x9a97('0x32')](_0x436b7b[_0x9a97('0x47')][_0x9a97('0x32')]);}_0x1f351b[_0x9a97('0x4e')]=qs['sort'](_0x436b7b[_0x9a97('0x47')][_0x9a97('0x4f')]);_0x1f351b[_0x9a97('0x50')]=qs[_0x9a97('0x48')](_[_0x9a97('0x51')](_0x436b7b[_0x9a97('0x47')],_0x380fba['filters']));_0x1f351b[_0x9a97('0x50')]['ChatWebsiteId']=_0x47cd05['id'];if(_0x436b7b[_0x9a97('0x47')][_0x9a97('0x6b')]){_0x1f351b[_0x9a97('0x50')]=_[_0x9a97('0x52')](_0x1f351b[_0x9a97('0x50')],{'$or':_[_0x9a97('0x41')](_0x1f351b['attributes'],function(_0x494ef6){var _0x5e802c={};_0x5e802c[_0x494ef6]={'$like':'%'+_0x436b7b[_0x9a97('0x47')][_0x9a97('0x6b')]+'%'};return _0x5e802c;})});}_0x1f351b=_['merge']({},_0x1f351b,_0x436b7b[_0x9a97('0x6c')]);return db[_0x9a97('0x69')][_0x9a97('0x31')]({'where':_0x1f351b[_0x9a97('0x50')]})['then'](function(_0x1e5311){_0xb6bd3f[_0x9a97('0x31')]=_0x1e5311;if(_0x436b7b[_0x9a97('0x47')][_0x9a97('0x54')]){_0x1f351b[_0x9a97('0x55')]=[{'all':!![]}];}return db[_0x9a97('0x69')]['findAll'](_0x1f351b);})[_0x9a97('0x26')](function(_0x231865){_0xb6bd3f[_0x9a97('0x57')]=_0x231865;return _0xb6bd3f;});}})[_0x9a97('0x26')](respondWithFilteredResult(_0x335fbe,_0x1f351b))[_0x9a97('0x2e')](handleError(_0x335fbe,null));};exports[_0x9a97('0x6d')]=function(_0x2ab75c,_0x3587c5,_0x363893){return db['ChatWebsite']['find']({'where':{'id':_0x2ab75c[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x3587c5,null))[_0x9a97('0x26')](function(_0x3896d7){if(_0x3896d7){return _0x3896d7[_0x9a97('0x6d')](_0x2ab75c[_0x9a97('0x47')][_0x9a97('0x6e')]);}})[_0x9a97('0x26')](respondWithStatusCode(_0x3587c5,null))['catch'](handleError(_0x3587c5,null));};exports[_0x9a97('0x6f')]=function(_0x42b9c3,_0x4da5da,_0x1cba2a){if(_0x42b9c3[_0x9a97('0x5d')]['id']){delete _0x42b9c3['body']['id'];}return db[_0x9a97('0x42')][_0x9a97('0x5b')]({'where':{'id':_0x42b9c3[_0x9a97('0x65')]['id']}})['then'](handleEntityNotFound(_0x4da5da,null))[_0x9a97('0x26')](function(_0x412ac2){if(_0x412ac2){_0x42b9c3['body'][_0x9a97('0x68')]=_0x412ac2['id'];return db[_0x9a97('0x70')][_0x9a97('0x5c')](_0x42b9c3[_0x9a97('0x5d')]);}})[_0x9a97('0x26')](respondWithResult(_0x4da5da,null))[_0x9a97('0x2e')](handleError(_0x4da5da,null));};exports['getAnswers']=function(_0x44a46a,_0x19dc6c,_0x4713cb){var _0xff08bb={'raw':![],'where':{}};var _0x404f42={};var _0x13a277={'count':0x0,'rows':[]};return db[_0x9a97('0x42')][_0x9a97('0x6a')]({'where':{'id':_0x44a46a[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x19dc6c,null))['then'](function(_0x11d2b9){if(_0x11d2b9){_0x404f42['model']=_['keys'](db[_0x9a97('0x70')][_0x9a97('0x43')]);_0x404f42[_0x9a97('0x47')]=_[_0x9a97('0x5a')](_0x44a46a[_0x9a97('0x47')]);_0x404f42['filters']=_[_0x9a97('0x49')](_0x404f42[_0x9a97('0x46')],_0x404f42[_0x9a97('0x47')]);_0xff08bb[_0x9a97('0x4a')]=_['intersection'](_0x404f42['model'],qs[_0x9a97('0x4b')](_0x44a46a['query'][_0x9a97('0x4b')]));_0xff08bb[_0x9a97('0x4a')]=_0xff08bb[_0x9a97('0x4a')][_0x9a97('0x4c')]?_0xff08bb['attributes']:_0x404f42['model'];if(!_0x44a46a[_0x9a97('0x47')][_0x9a97('0x71')](_0x9a97('0x4d'))){_0xff08bb[_0x9a97('0x33')]=qs[_0x9a97('0x33')](_0x44a46a['query'][_0x9a97('0x33')]);_0xff08bb[_0x9a97('0x32')]=qs[_0x9a97('0x32')](_0x44a46a[_0x9a97('0x47')]['offset']);}_0xff08bb['order']=qs[_0x9a97('0x4f')](_0x44a46a[_0x9a97('0x47')][_0x9a97('0x4f')]);_0xff08bb[_0x9a97('0x50')]=qs[_0x9a97('0x48')](_[_0x9a97('0x51')](_0x44a46a[_0x9a97('0x47')],_0x404f42[_0x9a97('0x48')]));_0xff08bb[_0x9a97('0x50')]['ChatWebsiteId']=_0x11d2b9['id'];if(_0x44a46a[_0x9a97('0x47')][_0x9a97('0x6b')]){_0xff08bb[_0x9a97('0x50')]=_[_0x9a97('0x52')](_0xff08bb[_0x9a97('0x50')],{'$or':_[_0x9a97('0x41')](_0xff08bb['attributes'],function(_0x25c53d){var _0x546509={};_0x546509[_0x25c53d]={'$like':'%'+_0x44a46a[_0x9a97('0x47')][_0x9a97('0x6b')]+'%'};return _0x546509;})});}_0xff08bb=_[_0x9a97('0x52')]({},_0xff08bb,_0x44a46a['options']);return db['CannedAnswer']['count']({'where':_0xff08bb[_0x9a97('0x50')]})[_0x9a97('0x26')](function(_0x4e8b66){_0x13a277[_0x9a97('0x31')]=_0x4e8b66;if(_0x44a46a[_0x9a97('0x47')][_0x9a97('0x54')]){_0xff08bb['include']=[{'all':!![]}];}return db[_0x9a97('0x70')][_0x9a97('0x56')](_0xff08bb);})[_0x9a97('0x26')](function(_0x366c6a){_0x13a277[_0x9a97('0x57')]=_0x366c6a;return _0x13a277;});}})['then'](respondWithFilteredResult(_0x19dc6c,_0xff08bb))[_0x9a97('0x2e')](handleError(_0x19dc6c,null));};exports['removeAnswers']=function(_0x558676,_0x55a5f7,_0x39c598){return db['ChatWebsite'][_0x9a97('0x5b')]({'where':{'id':_0x558676[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x55a5f7,null))['then'](function(_0x4b9cb4){if(_0x4b9cb4){return _0x4b9cb4[_0x9a97('0x72')](_0x558676[_0x9a97('0x47')][_0x9a97('0x6e')]);}})[_0x9a97('0x26')](respondWithStatusCode(_0x55a5f7,null))[_0x9a97('0x2e')](handleError(_0x55a5f7,null));};exports[_0x9a97('0x73')]=function(_0x341d92,_0x503a74,_0x4a0fff){_0x341d92[_0x9a97('0x5d')][_0x9a97('0x74')]=_0x341d92[_0x9a97('0x75')][_0x9a97('0x76')];return db[_0x9a97('0x42')][_0x9a97('0x5b')]({'where':{'id':_0x341d92['params']['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x503a74,null))[_0x9a97('0x26')](saveUpdates(_0x341d92['body'],null))[_0x9a97('0x26')](respondWithResult(_0x503a74,null))[_0x9a97('0x2e')](handleError(_0x503a74,null));};exports['addAvatar']=function(_0x229e70,_0x44ca94,_0x496495){_0x229e70[_0x9a97('0x5d')][_0x9a97('0x77')]=_0x229e70[_0x9a97('0x75')][_0x9a97('0x76')];return db['ChatWebsite'][_0x9a97('0x5b')]({'where':{'id':_0x229e70[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x44ca94,null))[_0x9a97('0x26')](saveUpdates(_0x229e70[_0x9a97('0x5d')],null))[_0x9a97('0x26')](respondWithResult(_0x44ca94,null))[_0x9a97('0x2e')](handleError(_0x44ca94,null));};exports[_0x9a97('0x78')]=function(_0x3d0590,_0x1409bf,_0x466d2f){_0x3d0590[_0x9a97('0x5d')][_0x9a97('0x79')]=_0x3d0590['file'][_0x9a97('0x76')];return db['ChatWebsite'][_0x9a97('0x5b')]({'where':{'id':_0x3d0590[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x1409bf,null))['then'](saveUpdates(_0x3d0590[_0x9a97('0x5d')],null))[_0x9a97('0x26')](respondWithResult(_0x1409bf,null))[_0x9a97('0x2e')](handleError(_0x1409bf,null));};exports['addSystemAvatar']=function(_0x16c74a,_0x4feeef,_0x27742c){_0x16c74a['body'][_0x9a97('0x7a')]=_0x16c74a['file']['filename'];return db[_0x9a97('0x42')]['find']({'where':{'id':_0x16c74a[_0x9a97('0x65')]['id']}})['then'](handleEntityNotFound(_0x4feeef,null))['then'](saveUpdates(_0x16c74a[_0x9a97('0x5d')],null))['then'](respondWithResult(_0x4feeef,null))[_0x9a97('0x2e')](handleError(_0x4feeef,null));};exports[_0x9a97('0x7b')]=function(_0x1e7e83,_0x468014,_0x13ef4c){var _0x546939=path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],_0x9a97('0x7e'));var _0x33b2bf={'where':{'id':_0x1e7e83[_0x9a97('0x65')]['id']},'attributes':['id',_0x9a97('0x74')],'raw':!![]};var _0x11d1e5=![];return require(_0x9a97('0x7f'))[_0x9a97('0x80')]()[_0x9a97('0x26')](function(_0x2478a2){if(_0x2478a2){_0x11d1e5=_0x2478a2[_0x9a97('0x81')];}})[_0x9a97('0x26')](function(){return db[_0x9a97('0x42')][_0x9a97('0x5b')](_0x33b2bf);})['then'](handleEntityNotFound(_0x468014,null))[_0x9a97('0x26')](function(_0xdf2c19){if(_0xdf2c19){if(!_['isNil'](_0xdf2c19[_0x9a97('0x74')])){if(fs[_0x9a97('0x82')](path['join'](config[_0x9a97('0x7d')],_0x9a97('0x83'),_0xdf2c19[_0x9a97('0x74')]))&&_0x11d1e5){_0x546939=path[_0x9a97('0x7c')](config['root'],_0x9a97('0x83'),_0xdf2c19[_0x9a97('0x74')]);}}return _0x468014[_0x9a97('0x84')](_0x546939);}})[_0x9a97('0x2e')](handleError(_0x468014,null));};exports[_0x9a97('0x85')]=function(_0x30a298,_0x152cac,_0x54d2d8){var _0x1dd9ac=path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],_0x9a97('0x86'));var _0x3c9198={'where':{'id':_0x30a298['params']['id']},'attributes':['id',_0x9a97('0x77')],'raw':!![]};return db[_0x9a97('0x42')][_0x9a97('0x5b')](_0x3c9198)[_0x9a97('0x26')](handleEntityNotFound(_0x152cac,null))[_0x9a97('0x26')](function(_0x22412b){if(_0x22412b){if(!_[_0x9a97('0x87')](_0x22412b[_0x9a97('0x77')])){if(fs[_0x9a97('0x82')](path['join'](config[_0x9a97('0x7d')],_0x9a97('0x88'),_0x22412b[_0x9a97('0x77')]))){_0x1dd9ac=path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],_0x9a97('0x88'),_0x22412b[_0x9a97('0x77')]);}}return _0x152cac['download'](_0x1dd9ac);}})['catch'](handleError(_0x152cac,null));};exports['getCustomerAvatar']=function(_0x3dcbaa,_0x2429ff,_0x13fcf6){var _0x431449=path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x5b23f8={'where':{'id':_0x3dcbaa[_0x9a97('0x65')]['id']},'attributes':['id','customerAvatar',_0x9a97('0x89')],'raw':!![]};return db[_0x9a97('0x42')][_0x9a97('0x5b')](_0x5b23f8)[_0x9a97('0x26')](handleEntityNotFound(_0x2429ff,null))[_0x9a97('0x26')](function(_0x1af283){if(_0x1af283){if(!_[_0x9a97('0x87')](_0x1af283[_0x9a97('0x79')])){if(fs[_0x9a97('0x82')](path[_0x9a97('0x7c')](config['root'],'server/files/images/avatars/',_0x1af283[_0x9a97('0x79')]))&&_0x1af283[_0x9a97('0x89')]){_0x431449=path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],_0x9a97('0x88'),_0x1af283[_0x9a97('0x79')]);}}return _0x2429ff[_0x9a97('0x84')](_0x431449);}})['catch'](handleError(_0x2429ff,null));};exports[_0x9a97('0x8a')]=function(_0x40a3e9,_0x5bf5fd,_0x51e6ee){var _0x54d448=path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],_0x9a97('0x8b'));var _0x2200f5={'where':{'id':_0x40a3e9['params']['id']},'attributes':['id',_0x9a97('0x7a')],'raw':!![]};return db[_0x9a97('0x42')][_0x9a97('0x5b')](_0x2200f5)[_0x9a97('0x26')](handleEntityNotFound(_0x5bf5fd,null))[_0x9a97('0x26')](function(_0x1bea7e){if(_0x1bea7e){if(!_[_0x9a97('0x87')](_0x1bea7e[_0x9a97('0x7a')])){if(fs[_0x9a97('0x82')](path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],'server/files/images/avatars/',_0x1bea7e[_0x9a97('0x7a')]))){_0x54d448=path[_0x9a97('0x7c')](config['root'],'server/files/images/avatars/',_0x1bea7e[_0x9a97('0x7a')]);}}return _0x5bf5fd['download'](_0x54d448);}})[_0x9a97('0x2e')](handleError(_0x5bf5fd,null));};exports[_0x9a97('0x8c')]=function(_0x1a3dc6,_0x5ee6cc,_0x378555){var _0x4f4684=require(_0x9a97('0x8d'));var _0x545f5d=new _0x4f4684();var _0x34653a=_0x545f5d[_0x9a97('0x8e')](_0x1a3dc6[_0x9a97('0x8f')][_0x9a97('0x90')])[_0x9a97('0x91')]();var _0x1638f7={'body':_0x1a3dc6['body'],'channel':_0x9a97('0x92')};var _0x2f812d=[];var _0x2ef12b=[];var _0x276a80={};var _0x4495c2=![];return db['CmContact'][_0x9a97('0x66')]()[_0x9a97('0x26')](function(_0x4fe631){if(!_0x4fe631){throw new db['Sequelize'][(_0x9a97('0x23'))](_0x9a97('0x93'));}_0x2f812d=_[_0x9a97('0x94')](_['keys'](_0x4fe631),['createdAt','updatedAt']);_0x2ef12b=_[_0x9a97('0x94')](_[_0x9a97('0x5a')](_0x4fe631),[_0x9a97('0x95'),_0x9a97('0x96'),_0x9a97('0x97'),'ListId']);if(_0x1a3dc6['body']['id']){delete _0x1a3dc6[_0x9a97('0x5d')]['id'];}if(_['isNil'](_0x1a3dc6['body'][_0x9a97('0x98')])){throw new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x99'));}if(_[_0x9a97('0x87')](_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0x5d')])||_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0x5d')]===''){throw new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x9a'));}if(_[_0x9a97('0x87')](_0x1a3dc6['body']['mapKey'])){throw new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x9b')+_0x2ef12b);}if(!_[_0x9a97('0x9c')](_0x2ef12b,_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0x9d')])){throw new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x9e')+_0x2ef12b);}_0x276a80[_0x1a3dc6[_0x9a97('0x5d')]['mapKey']]=_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0x98')];})[_0x9a97('0x26')](function(){return db[_0x9a97('0x42')][_0x9a97('0x5b')]({'where':{'id':_0x1a3dc6['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x9a97('0x9f'),'where':_0x276a80,'limit':0x1,'order':[[_0x9a97('0x96'),_0x9a97('0xa0')]]}]},{'model':db[_0x9a97('0xa1')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x5ee6cc,null))['then'](function(_0x502af0){if(_0x502af0&&_0x502af0[_0x9a97('0xa2')]){_0x1638f7['account']=_0x502af0;_0x1638f7[_0x9a97('0xa3')]=_0x502af0[_0x9a97('0xa4')];_0x1638f7[_0x9a97('0xa5')]=_0x502af0[_0x9a97('0xa2')];_0x1638f7[_0x9a97('0xa3')]=_[_0x9a97('0xa6')](_0x1638f7[_0x9a97('0xa3')],[_0x9a97('0xa7')],[_0x9a97('0xa8')]);if(_0x1638f7[_0x9a97('0xa9')]['Applications']){delete _0x1638f7[_0x9a97('0xa9')][_0x9a97('0xa4')];}if(_0x1638f7['account']['List']&&_0x1638f7[_0x9a97('0xa9')][_0x9a97('0xa2')][_0x9a97('0x9f')]['length']){return _0x1638f7[_0x9a97('0xa9')]['List']['Contacts'][0x0];}var _0x5c32d3=_[_0x9a97('0xaa')](_0x1a3dc6[_0x9a97('0x5d')],{'firstName':_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0x98')],'ListId':_0x502af0[_0x9a97('0xab')]});_0x5c32d3[_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0x9d')]]=_0x1a3dc6['body'][_0x9a97('0x98')];return db[_0x9a97('0xac')][_0x9a97('0x5c')](_0x5c32d3,{'fields':_0x2f812d,'raw':!![]});}})[_0x9a97('0x26')](handleEntityNotFound(_0x5ee6cc,null))[_0x9a97('0x26')](function(_0x5a90da){_0x1638f7[_0x9a97('0xad')]=_0x5a90da;var _0x2beda9=_0x1a3dc6[_0x9a97('0x5d')]['customerIp'];if(_0x1a3dc6['headers'][_0x9a97('0xae')]){_0x2beda9=_0x1a3dc6[_0x9a97('0x8f')][_0x9a97('0xae')];}else if(_0x1a3dc6[_0x9a97('0x8f')][_0x9a97('0xaf')]){_0x2beda9=_[_0x9a97('0xb0')](_0x1a3dc6[_0x9a97('0x8f')][_0x9a97('0xaf')][_0x9a97('0xb1')](','));}if(_0x5a90da){var _0x3fd676={'ContactId':_0x5a90da['id'],'ChatWebsiteId':_0x1a3dc6['params']['id'],'from':(_0x5a90da['firstName']||'')+'\x20'+(_0x5a90da[_0x9a97('0xb2')]||''),'customerIp':_0x2beda9,'customerPort':_0x1a3dc6['headers'][_0x9a97('0xb3')]?_0x1a3dc6[_0x9a97('0x8f')][_0x9a97('0xb3')]:null,'referer':_0x1a3dc6['body'][_0x9a97('0xb4')],'browserName':_0x34653a[_0x9a97('0xb5')]['name']&&_0x34653a['browser'][_0x9a97('0xb6')]?util[_0x9a97('0xb7')](_0x9a97('0xb8'),_0x34653a[_0x9a97('0xb5')][_0x9a97('0x3e')],_0x34653a[_0x9a97('0xb5')][_0x9a97('0xb6')]):_0x9a97('0xb9'),'browserVersion':_0x34653a['browser'][_0x9a97('0xb6')]||'unknown','osName':util['format'](_0x9a97('0xb8'),_0x34653a['os'][_0x9a97('0x3e')],_0x34653a['os'][_0x9a97('0xb6')]),'osVersion':_0x34653a['os'][_0x9a97('0xb6')],'deviceModel':_0x34653a[_0x9a97('0xba')][_0x9a97('0x46')]&&_0x34653a[_0x9a97('0xba')]['vendor']?util['format'](_0x9a97('0xbb'),_0x34653a[_0x9a97('0xba')][_0x9a97('0x46')],_0x34653a[_0x9a97('0xba')]['vendor'],_0x34653a[_0x9a97('0xba')]['type']):null,'deviceVendor':_0x34653a['device']['vendor'],'deviceType':_0x34653a[_0x9a97('0xba')]['type'],'formData':JSON['stringify'](_0x1a3dc6['body'])};var _0x5b08fb={'ChatWebsiteId':_0x1a3dc6[_0x9a97('0x65')]['id'],'closed':![]};if(_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xbc')]){_0x5b08fb[_0x9a97('0xbc')]=_0x1a3dc6['body'][_0x9a97('0xbc')];return db['ChatInteraction'][_0x9a97('0x5b')]({'where':_0x5b08fb})[_0x9a97('0x26')](function(_0xb5aef7){if(_0xb5aef7){return[_0xb5aef7,![]];}_0x3fd676[_0x9a97('0xbc')]=_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xbc')];_0x3fd676[_0x9a97('0xbd')]=_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xbd')];return db['ChatInteraction'][_0x9a97('0x5c')](_0x3fd676)[_0x9a97('0x26')](function(_0x992be2){return[_0x992be2,!![]];});});}_0x5b08fb[_0x9a97('0xbe')]=_0x5a90da['id'];if(_0x1a3dc6['body'][_0x9a97('0xbf')]&&_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xbf')]['id']){_0x5b08fb['id']=_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xbf')]['id'];return db['ChatInteraction']['find']({'where':_0x5b08fb})['then'](function(_0x3d121c){if(_0x3d121c){return[_0x3d121c,![]];}return db['ChatInteraction'][_0x9a97('0x5c')](_0x3fd676)[_0x9a97('0x26')](function(_0x4e154f){return[_0x4e154f,!![]];});});}return db['ChatInteraction']['create'](_0x3fd676)[_0x9a97('0x26')](function(_0x1689a6){return[_0x1689a6,!![]];});}})[_0x9a97('0xc0')](function(_0x4d37ba,_0x52b8c5){if(_0x4d37ba){_0x4495c2=_0x52b8c5;if(!_0x52b8c5){var _0x137db3={'from':(_0x1638f7[_0x9a97('0xad')][_0x9a97('0xc1')]||'')+'\x20'+(_0x1638f7[_0x9a97('0xad')]['lastName']||'')};if(_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xbc')]&&_0x1a3dc6[_0x9a97('0x5d')][_0x9a97('0xc2')]&&_0x1a3dc6[_0x9a97('0x5d')]['threadId']!=_0x1a3dc6[_0x9a97('0x5d')]['messageId']){_0x137db3[_0x9a97('0xbc')]=_0x1a3dc6[_0x9a97('0x5d')]['messageId'];}return _0x4d37ba[_0x9a97('0x38')](_0x137db3);}else{return _0x4d37ba;}}})['then'](function(_0xa1364c){_0x1638f7[_0x9a97('0xbf')]=_0xa1364c[_0x9a97('0x5f')]({'plain':!![]});_0x1638f7[_0x9a97('0xbf')][_0x9a97('0xc3')]=_0x4495c2;if(_0x1638f7[_0x9a97('0xbf')][_0x9a97('0xc3')]){if(_0x1638f7[_0x9a97('0xa9')][_0x9a97('0xc4')]){_0x1638f7['applications'][_0x9a97('0xc5')]({'id':0x0,'priority':_0x1638f7[_0x9a97('0xa3')][_0x9a97('0x4c')]+0x1,'app':_0x9a97('0xc6'),'appdata':_0x9a97('0xc7'),'interval':_0x9a97('0xc8')});}}return db[_0x9a97('0xc9')][_0x9a97('0x5c')]({'body':_0x1a3dc6['body']['body'],'ChatWebsiteId':_0x1a3dc6[_0x9a97('0x65')]['id'],'ChatInteractionId':_0xa1364c['id'],'direction':'in','ContactId':_0x1638f7['contact']['id'],'AttachmentId':_0x1a3dc6[_0x9a97('0x5d')]['AttachmentId']});})[_0x9a97('0x26')](function(_0x454b26){_0x1638f7[_0x9a97('0x2c')]=_0x454b26;if(_0x1638f7['interaction']['UserId']){return db['User'][_0x9a97('0x5b')]({'attributes':['id',_0x9a97('0x3e')],'where':{'id':_0x1638f7[_0x9a97('0xbf')][_0x9a97('0xca')]}})[_0x9a97('0x26')](function(_0x41fbad){if(_0x41fbad){_0x1638f7[_0x9a97('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9a97('0xcb'),'appdata':_0x41fbad['name']+','+(_0x1638f7[_0x9a97('0xa9')][_0x9a97('0xcc')]||0xa),'interval':_0x9a97('0xc8')});_0x1638f7[_0x9a97('0xcd')]=!![];}return respondWithRpcPromise(_0x9a97('0xce'),_0x9a97('0xcf'),_0x1638f7);});}return respondWithRpcPromise(_0x9a97('0xce'),_0x9a97('0xcf'),_0x1638f7);})[_0x9a97('0x26')](function(_0x3fb490){respondWithRpcPromise(_0x9a97('0xd0'),_0x9a97('0xd0'),{'event':_0x9a97('0x8c'),'message':_0x3fb490},client9002);return _0x3fb490;})[_0x9a97('0x26')](respondWithResult(_0x5ee6cc,null))[_0x9a97('0x2e')](handleError(_0x5ee6cc,null));};exports[_0x9a97('0xd1')]=function(_0x32f535,_0x377445,_0x396260){var _0x51dc04,_0x22ee40,_0x1855f3;var _0x49a0d3=[];var _0x163230=[];var _0x1d1421={};return db[_0x9a97('0xac')]['describe']()[_0x9a97('0x26')](function(_0x4e8dc9){if(!_0x4e8dc9){throw new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x93'));}_0x163230=_[_0x9a97('0x94')](_[_0x9a97('0x5a')](_0x4e8dc9),[_0x9a97('0x95'),_0x9a97('0x96')]);_0x49a0d3=_[_0x9a97('0x94')](_['keys'](_0x4e8dc9),[_0x9a97('0x95'),_0x9a97('0x96'),_0x9a97('0x97'),'ListId']);if(_0x32f535[_0x9a97('0x5d')]['id']){delete _0x32f535[_0x9a97('0x5d')]['id'];}if(_[_0x9a97('0x87')](_0x32f535[_0x9a97('0x5d')][_0x9a97('0x98')])){throw _0x377445[_0x9a97('0x30')](0x1f4)['send'](new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))](_0x9a97('0x99')));}if(_[_0x9a97('0x87')](_0x32f535[_0x9a97('0x5d')][_0x9a97('0x5d')])||_0x32f535[_0x9a97('0x5d')][_0x9a97('0x5d')]===''){throw _0x377445[_0x9a97('0x30')](0x1f4)[_0x9a97('0x3f')](new db[(_0x9a97('0x22'))][(_0x9a97('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x9a97('0x87')](_0x32f535[_0x9a97('0x5d')][_0x9a97('0xd2')])){throw _0x377445['status'](0x1f4)[_0x9a97('0x3f')](new db['Sequelize'][(_0x9a97('0x23'))](_0x9a97('0xd3')+_0x49a0d3));}if(!_[_0x9a97('0x9c')](_0x49a0d3,_0x32f535['body']['mapKeyOffline'])){throw _0x377445['status'](0x1f4)['send'](new db[(_0x9a97('0x22'))]['ValidationError'](_0x9a97('0xd4')+_0x49a0d3));}_0x1d1421[_0x32f535[_0x9a97('0x5d')][_0x9a97('0xd2')]]=_0x32f535[_0x9a97('0x5d')]['from'];})[_0x9a97('0x26')](function(){return db[_0x9a97('0x42')]['find']({'where':{'id':_0x32f535['params']['id']},'include':[{'model':db[_0x9a97('0xd5')],'as':_0x9a97('0xa2')}]});})['then'](handleEntityNotFound(_0x377445,null))['then'](function(_0xcb0e2a){if(_0xcb0e2a&&_0xcb0e2a[_0x9a97('0xa2')]){_0x22ee40=_0xcb0e2a;var _0xf09c67=_[_0x9a97('0xaa')](_0x32f535[_0x9a97('0x5d')],{'firstName':_0x32f535[_0x9a97('0x5d')][_0x9a97('0x98')],'phone':_0x32f535[_0x9a97('0x5d')][_0x9a97('0x98')],'ListId':_0xcb0e2a['ListId']});_0xf09c67[_0x32f535[_0x9a97('0x5d')][_0x9a97('0xd2')]]=_0x32f535[_0x9a97('0x5d')][_0x9a97('0x98')];return db[_0x9a97('0xac')][_0x9a97('0xd6')]({'where':_0x1d1421,'defaults':_0xf09c67});}})[_0x9a97('0xc0')](function(_0x3a46e3){if(_0x3a46e3){_0x1855f3=_0x3a46e3;var _0x3ef36f=fs['readFileSync'](path[_0x9a97('0x7c')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x2a429f=ejs[_0x9a97('0xd7')](_0x3ef36f,{'body':_[_0x9a97('0xd8')](_0x32f535['body'][_0x9a97('0x5d')]),'bodyTitle':_0x22ee40[_0x9a97('0xd9')]});return db[_0x9a97('0xda')][_0x9a97('0x5c')]({'body':_0x2a429f,'ContactId':_0x3a46e3['id'],'ChatWebsiteId':_0x22ee40['id']});}})['then'](function(_0x44170c){if(_0x44170c){_0x51dc04=_0x44170c;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x9a97('0xdb'),'raw':!![]}]});}})[_0x9a97('0x26')](function(_0x2bb9af){if(_0x2bb9af&&_0x2bb9af[_0x9a97('0xdb')]&&_0x22ee40['forwardOfflineAddress']){var _0xfad5bc={'tls':{'rejectUnauthorized':![]}};if(_0x2bb9af[_0x9a97('0xdb')][_0x9a97('0xdc')]){_0xfad5bc[_0x9a97('0xdc')]=_0x2bb9af[_0x9a97('0xdb')][_0x9a97('0xdc')];}else{_0xfad5bc['host']=_0x2bb9af[_0x9a97('0xdb')][_0x9a97('0xdd')];_0xfad5bc[_0x9a97('0xde')]=_0x2bb9af['Smtp'][_0x9a97('0xde')];_0xfad5bc[_0x9a97('0xdf')]=_0x2bb9af[_0x9a97('0xdb')][_0x9a97('0xdf')];}if(_0x2bb9af[_0x9a97('0xdb')]['authentication']){_0xfad5bc[_0x9a97('0xe0')]={'user':_0x2bb9af['Smtp']['user'],'pass':_0x2bb9af['Smtp']['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0xfad5bc,'message':{'from':util[_0x9a97('0xb7')](_0x9a97('0xe1'),_0x2bb9af[_0x9a97('0x3e')],_0x2bb9af[_0x9a97('0xe2')]||_0x2bb9af[_0x9a97('0xdb')]['user']),'to':_0x22ee40[_0x9a97('0xe3')],'subject':_0x22ee40[_0x9a97('0xe4')],'text':_0x51dc04[_0x9a97('0x5d')]}},client9003)[_0x9a97('0x26')](function(){return _0x51dc04;})[_0x9a97('0x2e')](function(_0x43dd1f){console[_0x9a97('0x2b')](_0x43dd1f);});}})['then'](function(){if(_0x51dc04){return _0x51dc04;}})[_0x9a97('0x26')](respondWithResult(_0x377445,null))[_0x9a97('0x2e')](handleError(_0x377445,null));};exports[_0x9a97('0xe5')]=function(_0x38f0fa,_0x312930,_0x1b9014){return db[_0x9a97('0xe6')][_0x9a97('0x5b')]({'where':{'id':_0x38f0fa[_0x9a97('0x65')]['id']}})['then'](handleEntityNotFound(_0x312930,null))[_0x9a97('0x26')](function(_0x245c48){if(_0x245c48){return _0x245c48['addInteraction'](_0x38f0fa[_0x9a97('0x5d')][_0x9a97('0x6e')],_[_0x9a97('0xe7')](_0x38f0fa[_0x9a97('0x5d')],['ids','id'])||{});}})[_0x9a97('0x26')](respondWithResult(_0x312930,null))[_0x9a97('0x2e')](handleError(_0x312930,null));};exports[_0x9a97('0xe8')]=function(_0x2f8a3b,_0x4fd3fe,_0xd13380){var _0x34054e={'raw':![],'where':{}};var _0x4670a0={};var _0x24c373={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9a97('0x6a')]({'where':{'id':_0x2f8a3b['params']['id']}})['then'](handleEntityNotFound(_0x4fd3fe,null))['then'](function(_0x3bb690){if(_0x3bb690){_0x4670a0['model']=_[_0x9a97('0x5a')](db['ChatInteraction'][_0x9a97('0x43')]);_0x4670a0[_0x9a97('0x47')]=_[_0x9a97('0x5a')](_0x2f8a3b[_0x9a97('0x47')]);_0x4670a0[_0x9a97('0x48')]=_[_0x9a97('0x49')](_0x4670a0[_0x9a97('0x46')],_0x4670a0[_0x9a97('0x47')]);_0x34054e[_0x9a97('0x4a')]=_[_0x9a97('0x49')](_0x4670a0[_0x9a97('0x46')],qs['fields'](_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0x4b')]));_0x34054e['attributes']=_0x34054e['attributes']['length']?_0x34054e[_0x9a97('0x4a')]:_0x4670a0[_0x9a97('0x46')];if(!_0x2f8a3b['query'][_0x9a97('0x71')]('nolimit')){_0x34054e[_0x9a97('0x33')]=qs[_0x9a97('0x33')](_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0x33')]);_0x34054e['offset']=qs[_0x9a97('0x32')](_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0x32')]);}_0x34054e[_0x9a97('0x4e')]=qs[_0x9a97('0x4f')](_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0x4f')]);_0x34054e[_0x9a97('0x50')]=qs[_0x9a97('0x48')](_[_0x9a97('0x51')](_0x2f8a3b[_0x9a97('0x47')],_0x4670a0['filters']));_0x34054e[_0x9a97('0x50')][_0x9a97('0x68')]=_0x3bb690['id'];if(_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0x6b')]){_0x34054e['where']=_[_0x9a97('0x52')](_0x34054e[_0x9a97('0x50')],{'$or':_[_0x9a97('0x41')](_0x34054e[_0x9a97('0x4a')],function(_0x281d27){var _0x28c816={};_0x28c816[_0x281d27]={'$like':'%'+_0x2f8a3b['query']['filter']+'%'};return _0x28c816;})});}_0x34054e=_['merge']({},_0x34054e,_0x2f8a3b[_0x9a97('0x6c')]);return db[_0x9a97('0xe6')][_0x9a97('0x31')]({'where':_0x34054e[_0x9a97('0x50')]})['then'](function(_0x12b5e7){_0x24c373[_0x9a97('0x31')]=_0x12b5e7;if(_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0x54')]){_0x34054e['include']=[{'model':db[_0x9a97('0xac')],'as':'Contact','required':![]},{'model':db[_0x9a97('0xe9')],'as':_0x9a97('0xea'),'attributes':[_0x9a97('0x3e'),_0x9a97('0xeb'),_0x9a97('0xec')],'required':![]},{'model':db[_0x9a97('0xed')],'as':_0x9a97('0xee'),'attributes':['id',_0x9a97('0x3e'),_0x9a97('0xef')],'where':_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0xf0')]?{'id':_0x2f8a3b[_0x9a97('0x47')]['tag']}:undefined,'required':_0x2f8a3b[_0x9a97('0x47')][_0x9a97('0xf0')]?!![]:![]}];}return db['ChatInteraction'][_0x9a97('0x56')](_0x34054e);})[_0x9a97('0x26')](function(_0x4b90f7){_0x24c373['rows']=_0x4b90f7;return _0x24c373;});}})[_0x9a97('0x26')](respondWithFilteredResult(_0x4fd3fe,_0x34054e))[_0x9a97('0x2e')](handleError(_0x4fd3fe,null));};function iftimePromise(_0x2aec18,_0x81c541){return respondWithRpcPromise(_0x9a97('0xf1'),_0x9a97('0xf2'),{'command':_0x81c541[_0x9a97('0xf3')]?util[_0x9a97('0xb7')](_0x9a97('0xf4'),_0x2aec18['interval'],_0x81c541[_0x9a97('0xf3')]):util[_0x9a97('0xb7')](_0x9a97('0xf5'),_0x2aec18['interval'])},client9002)[_0x9a97('0x26')](function(_0x3866f6){var _0x15a7af=_0x3866f6&&_0x3866f6[_0x9a97('0xf6')]('true')>=0x0?!![]:![];logger[_0x9a97('0x27')](_0x9a97('0xf7'),_0x81c541['id'],_0x2aec18['id'],_0x2aec18[_0x9a97('0xf8')],_0x15a7af?'ONLINE':_0x9a97('0xf9'),_0x81c541['timezone']?_0x81c541[_0x9a97('0xf3')]:_0x9a97('0xfa'));return _0x15a7af;})[_0x9a97('0x2e')](function(_0x2023cd){logger[_0x9a97('0x2b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x81c541['id'],_0x2aec18['id'],_0x2aec18[_0x9a97('0xf8')],util['inspect'](_0x2023cd,{'showHidden':![],'depth':null}),_0x81c541['timezone']?_0x81c541[_0x9a97('0xf3')]:_0x9a97('0xfa'));return![];});}exports[_0x9a97('0xf2')]=function(_0x816533,_0x794294,_0x4d3ed6){var _0x23e0a4=0x0;var _0x45511a=0x0;var _0x11cb78=![];var _0x56c745;var _0x7635d5;return db[_0x9a97('0x42')][_0x9a97('0x5b')]({'where':{'id':_0x816533[_0x9a97('0x65')]['id']},'include':[{'model':db[_0x9a97('0xfb')],'as':_0x9a97('0xfb'),'include':[{'model':db[_0x9a97('0xfb')],'as':'Intervals','attributes':['id',_0x9a97('0xf8')],'raw':!![]}]}]})[_0x9a97('0x26')](handleEntityNotFound(_0x794294,null))['then'](function(_0x1156e2){if(_0x1156e2){_0x56c745=_0x1156e2;return _0x1156e2[_0x9a97('0xfc')]({'raw':!![]});}})[_0x9a97('0x26')](function(_0x126f6a){if(_0x56c745){if(_0x126f6a){_0x7635d5=_0x126f6a;}}return require(_0x9a97('0x7f'))[_0x9a97('0x80')]();})[_0x9a97('0x26')](function(_0x4c9d4a){if(_0x4c9d4a){_0x45511a=_0x4c9d4a[_0x9a97('0xfd')];_0x11cb78=_0x4c9d4a[_0x9a97('0x81')];}})[_0x9a97('0x26')](function(){return db[_0x9a97('0xe6')][_0x9a97('0x31')]({'where':{'closed':![]}});})['then'](function(_0x8ac6b1){_0x23e0a4=_0x8ac6b1;if(_0x45511a&&_0x8ac6b1>_0x45511a){return db[_0x9a97('0xfe')][_0x9a97('0x6a')]({'where':{'id':0x1}})[_0x9a97('0x26')](function(_0x5669cf){if(_0x5669cf){_0x5669cf[_0x9a97('0xff')](_0x9a97('0x100'));}});}})[_0x9a97('0x26')](function(){if(_0x56c745[_0x9a97('0xfb')]&&_0x56c745['Interval'][_0x9a97('0x101')]){var _0x480ec7=[];for(var _0x40d6b0=0x0;_0x40d6b0<_0x56c745[_0x9a97('0xfb')][_0x9a97('0x101')][_0x9a97('0x4c')];_0x40d6b0++){var _0x3c8a35=_0x56c745[_0x9a97('0xfb')][_0x9a97('0x101')][_0x40d6b0][_0x9a97('0x5f')]({'plain':!![]});_0x480ec7[_0x9a97('0xc5')](iftimePromise(_0x3c8a35,_0x56c745));}return BPromise[_0x9a97('0x102')](_0x480ec7)[_0x9a97('0x26')](function(_0x31cbc9){return _[_0x9a97('0x103')](_0x31cbc9);});}else{return!![];}})[_0x9a97('0x26')](function(_0x205503){var _0x48730f=fs[_0x9a97('0x104')](path[_0x9a97('0x7c')](config[_0x9a97('0x7d')],_0x9a97('0x105')),_0x9a97('0x106'));var _0x21a3e6={'remote':_0x56c745['remote'],'query':querystring[_0x9a97('0x107')](_[_0x9a97('0x52')](_0x56c745[_0x9a97('0x5f')]({'plain':!![]}),{'customerIp':_0x816533[_0x9a97('0x8f')][_0x9a97('0xaf')]||_0x816533['headers'][_0x9a97('0x108')]||_0x816533[_0x9a97('0x109')]['remoteAddress']||_0x816533['ip'],'referer':_0x816533[_0x9a97('0x8f')][_0x9a97('0xb4')],'openedInteractions':_0x23e0a4,'maxInteractions':_0x45511a,'virtual':_0x11cb78[_0x9a97('0xfd')],'online':_0x205503,'custom':_0x11cb78}))[_0x9a97('0x10a')](/'/g,'\x5c\x27')};_0x794294['send'](ejs[_0x9a97('0xd7')](Mustache[_0x9a97('0xd7')](_0x48730f,_0x21a3e6),{'proactiveActions':_0x7635d5,'alignment':_0x56c745[_0x9a97('0x10b')],'verticalAlignment':_0x56c745['verticalAlignment'],'div_color':_0x56c745[_0x9a97('0xef')],'text_color':_0x56c745['textColor']}));})['catch'](handleError(_0x794294,null));};exports['addApplications']=function(_0x31b41b,_0x277475,_0x17c8a4){return db[_0x9a97('0x42')][_0x9a97('0x6a')]({'where':{'id':_0x31b41b['params']['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x277475,null))[_0x9a97('0x26')](function(_0x1804a5){if(_0x1804a5){return db[_0x9a97('0x10c')][_0x9a97('0x10d')](function(_0x4adcdd){return db[_0x9a97('0xa1')][_0x9a97('0x39')]({'where':{'ChatWebsiteId':_0x31b41b[_0x9a97('0x65')]['id']},'transaction':_0x4adcdd})[_0x9a97('0x26')](function(_0xaef4ba){var _0x393b1e=_[_0x9a97('0x41')](_0x31b41b['body'],function(_0x5e77b1){_0x5e77b1[_0x9a97('0x68')]=_0x31b41b[_0x9a97('0x65')]['id'];return _0x5e77b1;});return db[_0x9a97('0xa1')][_0x9a97('0x10e')](_0x393b1e,{'transaction':_0x4adcdd});});})['then'](function(){return db[_0x9a97('0xa1')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x31b41b[_0x9a97('0x65')]['id']},'order':'priority'});});}})[_0x9a97('0x26')](respondWithResult(_0x277475,null))['catch'](handleError(_0x277475,null));};exports[_0x9a97('0x10f')]=function(_0x4b1043,_0x4eb083,_0x4cbcd3){var _0x28e001={};var _0x3ca67f={};var _0x1da232;var _0x52fdfd;return db['ChatWebsite']['findOne']({'where':{'id':_0x4b1043[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x4eb083,null))[_0x9a97('0x26')](function(_0x13679a){if(_0x13679a){_0x1da232=_0x13679a;_0x3ca67f[_0x9a97('0x46')]=_[_0x9a97('0x5a')](db[_0x9a97('0xa1')][_0x9a97('0x43')]);_0x3ca67f[_0x9a97('0x47')]=_['keys'](_0x4b1043[_0x9a97('0x47')]);_0x3ca67f[_0x9a97('0x48')]=_[_0x9a97('0x49')](_0x3ca67f[_0x9a97('0x46')],_0x3ca67f[_0x9a97('0x47')]);_0x28e001[_0x9a97('0x4a')]=_['intersection'](_0x3ca67f[_0x9a97('0x46')],qs[_0x9a97('0x4b')](_0x4b1043[_0x9a97('0x47')]['fields']));_0x28e001[_0x9a97('0x4a')]=_0x28e001[_0x9a97('0x4a')][_0x9a97('0x4c')]?_0x28e001[_0x9a97('0x4a')]:_0x3ca67f[_0x9a97('0x46')];_0x28e001['order']=qs['sort'](_0x4b1043[_0x9a97('0x47')][_0x9a97('0x4f')]);_0x28e001[_0x9a97('0x50')]=qs[_0x9a97('0x48')](_[_0x9a97('0x51')](_0x4b1043[_0x9a97('0x47')],_0x3ca67f[_0x9a97('0x48')]));if(_0x4b1043[_0x9a97('0x47')][_0x9a97('0x6b')]){_0x28e001[_0x9a97('0x50')]=_[_0x9a97('0x52')](_0x28e001[_0x9a97('0x50')],{'$or':_[_0x9a97('0x41')](_0x28e001[_0x9a97('0x4a')],function(_0x3839b3){var _0x11c84d={};_0x11c84d[_0x3839b3]={'$like':'%'+_0x4b1043[_0x9a97('0x47')][_0x9a97('0x6b')]+'%'};return _0x11c84d;})});}_0x28e001=_['merge']({},_0x28e001,_0x4b1043[_0x9a97('0x6c')]);return _0x1da232[_0x9a97('0x10f')](_0x28e001);}})[_0x9a97('0x26')](function(_0x5f0ada){if(_0x5f0ada){_0x52fdfd=_0x5f0ada[_0x9a97('0x4c')];if(!_0x4b1043[_0x9a97('0x47')]['hasOwnProperty']('nolimit')){_0x28e001[_0x9a97('0x33')]=qs['limit'](_0x4b1043['query']['limit']);_0x28e001[_0x9a97('0x32')]=qs[_0x9a97('0x32')](_0x4b1043['query'][_0x9a97('0x32')]);}return _0x1da232[_0x9a97('0x10f')](_0x28e001);}})[_0x9a97('0x26')](function(_0x1963b5){if(_0x1963b5){return _0x1963b5?{'count':_0x52fdfd,'rows':_0x1963b5}:null;}})[_0x9a97('0x26')](respondWithResult(_0x4eb083,null))[_0x9a97('0x2e')](handleError(_0x4eb083,null));};exports[_0x9a97('0x110')]=function(_0x52594f,_0x5cb2ac,_0x3fa722){return db[_0x9a97('0x111')][_0x9a97('0x5b')]({'where':{'id':_0x52594f[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x5cb2ac,null))[_0x9a97('0x26')](function(_0xa8fc33){if(_0xa8fc33){return _0xa8fc33['addProactiveActions'](_0x52594f[_0x9a97('0x5d')][_0x9a97('0x6e')],_[_0x9a97('0xe7')](_0x52594f[_0x9a97('0x5d')],[_0x9a97('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x5cb2ac,null))[_0x9a97('0x2e')](handleError(_0x5cb2ac,null));};exports[_0x9a97('0xfc')]=function(_0x4cdd28,_0x5e477d,_0x3ce764){var _0x1ab9e2={};var _0x15f728={};var _0x27ad4e;var _0x462f07;return db['ChatWebsite']['findOne']({'where':{'id':_0x4cdd28[_0x9a97('0x65')]['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x5e477d,null))[_0x9a97('0x26')](function(_0x1e3b08){if(_0x1e3b08){_0x27ad4e=_0x1e3b08;_0x15f728['model']=_[_0x9a97('0x5a')](db['ChatProactiveAction'][_0x9a97('0x43')]);_0x15f728[_0x9a97('0x47')]=_[_0x9a97('0x5a')](_0x4cdd28[_0x9a97('0x47')]);_0x15f728[_0x9a97('0x48')]=_[_0x9a97('0x49')](_0x15f728[_0x9a97('0x46')],_0x15f728[_0x9a97('0x47')]);_0x1ab9e2['attributes']=_[_0x9a97('0x49')](_0x15f728[_0x9a97('0x46')],qs[_0x9a97('0x4b')](_0x4cdd28['query'][_0x9a97('0x4b')]));_0x1ab9e2[_0x9a97('0x4a')]=_0x1ab9e2[_0x9a97('0x4a')][_0x9a97('0x4c')]?_0x1ab9e2[_0x9a97('0x4a')]:_0x15f728['model'];_0x1ab9e2['order']=qs[_0x9a97('0x4f')](_0x4cdd28[_0x9a97('0x47')][_0x9a97('0x4f')]);_0x1ab9e2['where']=qs['filters'](_['pick'](_0x4cdd28[_0x9a97('0x47')],_0x15f728[_0x9a97('0x48')]));if(_0x4cdd28['query'][_0x9a97('0x6b')]){_0x1ab9e2[_0x9a97('0x50')]=_['merge'](_0x1ab9e2['where'],{'$or':_[_0x9a97('0x41')](_0x1ab9e2['attributes'],function(_0x56d605){var _0xc8b5c7={};_0xc8b5c7[_0x56d605]={'$like':'%'+_0x4cdd28['query'][_0x9a97('0x6b')]+'%'};return _0xc8b5c7;})});}_0x1ab9e2=_[_0x9a97('0x52')]({},_0x1ab9e2,_0x4cdd28[_0x9a97('0x6c')]);return _0x27ad4e[_0x9a97('0xfc')](_0x1ab9e2);}})[_0x9a97('0x26')](function(_0xdedae7){if(_0xdedae7){_0x462f07=_0xdedae7[_0x9a97('0x4c')];if(!_0x4cdd28[_0x9a97('0x47')][_0x9a97('0x71')](_0x9a97('0x4d'))){_0x1ab9e2['limit']=qs[_0x9a97('0x33')](_0x4cdd28[_0x9a97('0x47')][_0x9a97('0x33')]);_0x1ab9e2[_0x9a97('0x32')]=qs[_0x9a97('0x32')](_0x4cdd28['query']['offset']);}return _0x27ad4e[_0x9a97('0xfc')](_0x1ab9e2);}})[_0x9a97('0x26')](function(_0x5734b7){if(_0x5734b7){return _0x5734b7?{'count':_0x462f07,'rows':_0x5734b7}:null;}})[_0x9a97('0x26')](respondWithResult(_0x5e477d,null))[_0x9a97('0x2e')](handleError(_0x5e477d,null));};exports[_0x9a97('0x112')]=function(_0x90668d,_0x327b7f,_0x206b4f){var _0xb405f=_0x90668d['query'][_0x9a97('0x113')]===_0x9a97('0x114')?_0x9a97('0x115'):_0x9a97('0x116');return db[_0x9a97('0x42')]['find']({'attributes':['id',_0xb405f],'where':{'id':_0x90668d['params']['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x327b7f,null))[_0x9a97('0x26')](function(_0x596762){if(_0x596762){var _0x559bfa=_0x596762[_0xb405f];var _0x2a4725=_0x559bfa&&_0x559bfa[_0x9a97('0x117')]?_0x559bfa['items']:[];_0x327b7f[_0x9a97('0x3f')]({'fromKey':_['isNil'](_0x559bfa[_0x9a97('0x118')])?undefined:_0x559bfa['fromKey'],'count':_0x2a4725[_0x9a97('0x4c')],'rows':_0x2a4725});}})[_0x9a97('0x2e')](handleError(_0x327b7f,null));};exports[_0x9a97('0x119')]=function(_0x528def,_0x419dfd,_0xd0a79){var _0xb86a53={'raw':![],'where':{}};var _0x5caf64={};var _0x438289={'count':0x0,'rows':[]};return db[_0x9a97('0x42')][_0x9a97('0x6a')]({'where':{'id':_0x528def['params']['id']}})['then'](handleEntityNotFound(_0x419dfd,null))[_0x9a97('0x26')](function(_0x24bd9e){if(_0x24bd9e){_0x5caf64[_0x9a97('0x46')]=_[_0x9a97('0x5a')](db[_0x9a97('0xda')][_0x9a97('0x43')]);_0x5caf64[_0x9a97('0x47')]=_[_0x9a97('0x5a')](_0x528def[_0x9a97('0x47')]);_0x5caf64[_0x9a97('0x48')]=_[_0x9a97('0x49')](_0x5caf64[_0x9a97('0x46')],_0x5caf64['query']);_0xb86a53[_0x9a97('0x4a')]=_['intersection'](_0x5caf64[_0x9a97('0x46')],qs[_0x9a97('0x4b')](_0x528def[_0x9a97('0x47')][_0x9a97('0x4b')]));_0xb86a53[_0x9a97('0x4a')]=_0xb86a53[_0x9a97('0x4a')][_0x9a97('0x4c')]?_0xb86a53[_0x9a97('0x4a')]:_0x5caf64['model'];if(!_0x528def[_0x9a97('0x47')]['hasOwnProperty']('nolimit')){_0xb86a53[_0x9a97('0x33')]=qs[_0x9a97('0x33')](_0x528def[_0x9a97('0x47')][_0x9a97('0x33')]);_0xb86a53['offset']=qs[_0x9a97('0x32')](_0x528def[_0x9a97('0x47')][_0x9a97('0x32')]);}_0xb86a53[_0x9a97('0x4e')]=qs[_0x9a97('0x4f')](_0x528def[_0x9a97('0x47')]['sort']);_0xb86a53[_0x9a97('0x50')]=qs['filters'](_[_0x9a97('0x51')](_0x528def['query'],_0x5caf64[_0x9a97('0x48')]));_0xb86a53[_0x9a97('0x50')][_0x9a97('0x68')]=_0x24bd9e['id'];if(_0x528def[_0x9a97('0x47')][_0x9a97('0x6b')]){_0xb86a53['where']=_[_0x9a97('0x52')](_0xb86a53['where'],{'$or':_['map'](_0xb86a53[_0x9a97('0x4a')],function(_0x508e9e){var _0x57944a={};_0x57944a[_0x508e9e]={'$like':'%'+_0x528def[_0x9a97('0x47')]['filter']+'%'};return _0x57944a;})});}_0xb86a53=_[_0x9a97('0x52')]({},_0xb86a53,_0x528def[_0x9a97('0x6c')]);return db['ChatOfflineMessage']['count']({'where':_0xb86a53[_0x9a97('0x50')]})['then'](function(_0x3858c3){_0x438289[_0x9a97('0x31')]=_0x3858c3;if(_0x528def['query'][_0x9a97('0x54')]){_0xb86a53[_0x9a97('0x55')]=[{'all':!![]}];}else{_0xb86a53[_0x9a97('0x55')]=[{'model':db[_0x9a97('0xac')],'as':'Contact','required':![]}];}return db['ChatOfflineMessage'][_0x9a97('0x56')](_0xb86a53);})[_0x9a97('0x26')](function(_0x1b41e6){_0x438289[_0x9a97('0x57')]=_0x1b41e6;return _0x438289;});}})[_0x9a97('0x26')](respondWithFilteredResult(_0x419dfd,_0xb86a53))[_0x9a97('0x2e')](handleError(_0x419dfd,null));};exports[_0x9a97('0x11a')]=function(_0x19ae9d,_0xc8fa48,_0x378978){return db['ChatWebsite'][_0x9a97('0x5b')]({'where':{'id':_0x19ae9d['params']['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0xc8fa48,null))['then'](function(_0x172096){if(_0x172096){return _0x172096[_0x9a97('0x11a')](_0x19ae9d[_0x9a97('0x5d')][_0x9a97('0x6e')],_[_0x9a97('0xe7')](_0x19ae9d[_0x9a97('0x5d')],[_0x9a97('0x6e'),'id'])||{})['spread'](function(_0x3768c7){for(var _0x5033b6=0x0;_0x5033b6<_0x19ae9d[_0x9a97('0x5d')][_0x9a97('0x6e')][_0x9a97('0x4c')];_0x5033b6+=0x1){socket[_0x9a97('0x11b')](_0x9a97('0x11c'),{'UserId':_0x19ae9d[_0x9a97('0x5d')]['ids'][_0x5033b6],'ChatWebsiteId':_0x19ae9d[_0x9a97('0x65')]['id']});}return _0x3768c7;});}})[_0x9a97('0x26')](respondWithResult(_0xc8fa48,null))['catch'](handleError(_0xc8fa48,null));};exports[_0x9a97('0x11d')]=function(_0x4b6d44,_0x4282b4,_0x23cca1){return db[_0x9a97('0x42')][_0x9a97('0x5b')]({'where':{'id':_0x4b6d44['params']['id']}})[_0x9a97('0x26')](handleEntityNotFound(_0x4282b4,null))['then'](function(_0x2742a4){if(_0x2742a4){return _0x2742a4[_0x9a97('0x11d')](_0x4b6d44[_0x9a97('0x47')][_0x9a97('0x6e')])[_0x9a97('0x26')](function(){if(_[_0x9a97('0x11e')](_0x4b6d44[_0x9a97('0x47')][_0x9a97('0x6e')])){for(var _0x41c577=0x0;_0x41c577<_0x4b6d44[_0x9a97('0x47')][_0x9a97('0x6e')][_0x9a97('0x4c')];_0x41c577+=0x1){socket['emit'](_0x9a97('0x11f'),{'UserId':Number(_0x4b6d44[_0x9a97('0x47')]['ids'][_0x41c577]),'ChatWebsiteId':Number(_0x4b6d44[_0x9a97('0x65')]['id'])});}}else{socket[_0x9a97('0x11b')](_0x9a97('0x11f'),{'UserId':Number(_0x4b6d44[_0x9a97('0x47')][_0x9a97('0x6e')]),'ChatWebsiteId':Number(_0x4b6d44[_0x9a97('0x65')]['id'])});}});}})[_0x9a97('0x26')](respondWithStatusCode(_0x4282b4,null))[_0x9a97('0x2e')](handleError(_0x4282b4,null));};exports[_0x9a97('0x120')]=function(_0x565159,_0x4dfb8b,_0x5b9733){var _0x2cddfa={};var _0x14722d={};var _0x142452;var _0x495af4;return db[_0x9a97('0x42')]['findOne']({'where':{'id':_0x565159[_0x9a97('0x65')]['id']}})['then'](handleEntityNotFound(_0x4dfb8b,null))['then'](function(_0x3491e2){if(_0x3491e2){_0x142452=_0x3491e2;_0x14722d[_0x9a97('0x46')]=_[_0x9a97('0x5a')](db[_0x9a97('0xe9')][_0x9a97('0x43')]);_0x14722d[_0x9a97('0x47')]=_[_0x9a97('0x5a')](_0x565159[_0x9a97('0x47')]);_0x14722d[_0x9a97('0x48')]=_['intersection'](_0x14722d[_0x9a97('0x46')],_0x14722d[_0x9a97('0x47')]);_0x2cddfa[_0x9a97('0x4a')]=_['intersection'](_0x14722d['model'],qs['fields'](_0x565159[_0x9a97('0x47')][_0x9a97('0x4b')]));_0x2cddfa[_0x9a97('0x4a')]=_0x2cddfa[_0x9a97('0x4a')][_0x9a97('0x4c')]?_0x2cddfa[_0x9a97('0x4a')]:_0x14722d[_0x9a97('0x46')];_0x2cddfa[_0x9a97('0x4e')]=qs[_0x9a97('0x4f')](_0x565159['query'][_0x9a97('0x4f')]);_0x2cddfa[_0x9a97('0x50')]=qs[_0x9a97('0x48')](_['pick'](_0x565159[_0x9a97('0x47')],_0x14722d[_0x9a97('0x48')]));if(_0x565159[_0x9a97('0x47')]['filter']){_0x2cddfa['where']=_['merge'](_0x2cddfa[_0x9a97('0x50')],{'$or':_[_0x9a97('0x41')](_0x2cddfa[_0x9a97('0x4a')],function(_0x390137){var _0xfa2d18={};_0xfa2d18[_0x390137]={'$like':'%'+_0x565159[_0x9a97('0x47')][_0x9a97('0x6b')]+'%'};return _0xfa2d18;})});}_0x2cddfa=_[_0x9a97('0x52')]({},_0x2cddfa,_0x565159[_0x9a97('0x6c')]);return _0x142452[_0x9a97('0x120')](_0x2cddfa);}})[_0x9a97('0x26')](function(_0x50ac4a){if(_0x50ac4a){_0x495af4=_0x50ac4a[_0x9a97('0x4c')];if(!_0x565159[_0x9a97('0x47')][_0x9a97('0x71')]('nolimit')){_0x2cddfa[_0x9a97('0x33')]=qs[_0x9a97('0x33')](_0x565159[_0x9a97('0x47')]['limit']);_0x2cddfa['offset']=qs[_0x9a97('0x32')](_0x565159[_0x9a97('0x47')][_0x9a97('0x32')]);}return _0x142452[_0x9a97('0x120')](_0x2cddfa);}})[_0x9a97('0x26')](function(_0x3dd7ef){if(_0x3dd7ef){return _0x3dd7ef?{'count':_0x495af4,'rows':_0x3dd7ef}:null;}})[_0x9a97('0x26')](respondWithResult(_0x4dfb8b,null))['catch'](handleError(_0x4dfb8b,null));}; \ No newline at end of file +var _0x7c85=['push','*,*,*,*','ChatMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','createdAt','mapKeyOffline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','utf8','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','internal','color','tag','Command','timezone','iftime\x20%s','interval','indexOf','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','virtual','License','increment','some','readFileSync','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','addApplications','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','zip-dir','fast-json-patch','moment','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatWebsite.socket','register','http','client','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~!@#$%^&-_=+[{]}.','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','name','Pause','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatWebsite','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','../../config/license/util','getLicense','custom','isNil','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c85,0x170));var _0x57c8=function(_0x2688d5,_0x45db72){_0x2688d5=_0x2688d5-0x0;var _0x372637=_0x7c85[_0x2688d5];return _0x372637;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x57c8('0x0'));var jsonpatch=require(_0x57c8('0x1'));var rp=require('request-promise');var moment=require(_0x57c8('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x57c8('0x3'));var ejs=require(_0x57c8('0x4'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57c8('0x5'));var deskjs=require('desk.js');var toCsv=require(_0x57c8('0x3'));var querystring=require(_0x57c8('0x6'));var Papa=require(_0x57c8('0x7'));var Redis=require(_0x57c8('0x8'));var authService=require('../../components/auth/service');var qs=require(_0x57c8('0x9'));var as=require(_0x57c8('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x57c8('0xb'));var config=require(_0x57c8('0xc'));var db=require(_0x57c8('0xd'))['db'];config['redis']=_[_0x57c8('0xe')](config[_0x57c8('0xf')],{'host':_0x57c8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57c8('0xf')]));require(_0x57c8('0x11'))[_0x57c8('0x12')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x57c8('0x13')]({'port':0x232c});var client9002=jayson[_0x57c8('0x14')]['http']({'port':0x232a});var client9003=jayson['client'][_0x57c8('0x13')]({'port':0x232b});function checkPasswordPattern(_0x3e7df7,_0x1488f3,_0x3a6dd0){if(_0x3a6dd0){var _0xc0e827=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc0e827['test'](_0x1488f3)){return _0x3e7df7;}else{throw new db[(_0x57c8('0x15'))][(_0x57c8('0x16'))](_0x57c8('0x17'));}}else{return _0x3e7df7;}}function respondWithRpcPromise(_0x430f3f,_0x2b2253,_0x8b3e39,_0x23d403){return new BPromise(function(_0x3da556,_0x324d10){var _0x2eacc4=_0x23d403||client;return _0x2eacc4[_0x57c8('0x18')](_0x430f3f,_0x8b3e39)['then'](function(_0x1626aa){logger[_0x57c8('0x19')](_0x57c8('0x1a'),_0x2b2253,'request\x20sent');logger[_0x57c8('0x1b')](_0x57c8('0x1c'),_0x2b2253,_0x57c8('0x1d'),JSON[_0x57c8('0x1e')](_0x1626aa));if(_0x1626aa[_0x57c8('0x1f')]){if(_0x1626aa[_0x57c8('0x1f')][_0x57c8('0x20')]===0x1f4){logger[_0x57c8('0x1f')](_0x57c8('0x1a'),_0x2b2253,_0x1626aa[_0x57c8('0x1f')]['message']);return _0x324d10(_0x1626aa['error'][_0x57c8('0x21')]);}logger[_0x57c8('0x1f')](_0x57c8('0x1a'),_0x2b2253,_0x1626aa[_0x57c8('0x1f')][_0x57c8('0x21')]);return _0x3da556(_0x1626aa[_0x57c8('0x1f')][_0x57c8('0x21')]);}else{logger[_0x57c8('0x19')](_0x57c8('0x1a'),_0x2b2253,_0x57c8('0x1d'));_0x3da556(_0x1626aa[_0x57c8('0x22')]['message']);}})[_0x57c8('0x23')](function(_0x526f87){logger[_0x57c8('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x2b2253,_0x526f87);_0x324d10(_0x526f87);});});}function respondWithStatusCode(_0xbab046,_0x198260){_0x198260=_0x198260||0xcc;return function(_0x38e87a){if(_0x38e87a){return _0xbab046['sendStatus'](_0x198260);}return _0xbab046[_0x57c8('0x24')](_0x198260)[_0x57c8('0x25')]();};}function respondWithResult(_0x404ed6,_0x3736d0){_0x3736d0=_0x3736d0||0xc8;return function(_0x3892c5){if(_0x3892c5){return _0x404ed6[_0x57c8('0x24')](_0x3736d0)[_0x57c8('0x26')](_0x3892c5);}};}function respondWithFilteredResult(_0x5e4d34,_0x4992b9){return function(_0x3a8f9a){if(_0x3a8f9a){var _0x3d0194=_0x3a8f9a[_0x57c8('0x27')],_0x5dc55e=_0x4992b9[_0x57c8('0x28')],_0x3543d2=_0x4992b9[_0x57c8('0x28')]+_0x4992b9[_0x57c8('0x29')],_0x596644;if(_0x3543d2>=_0x3d0194){_0x3543d2=_0x3d0194;_0x596644=0xc8;}else{_0x596644=0xce;}_0x5e4d34[_0x57c8('0x24')](_0x596644);return _0x5e4d34[_0x57c8('0x2a')](_0x57c8('0x2b'),_0x5dc55e+'-'+_0x3543d2+'/'+_0x3d0194)['json'](_0x3a8f9a);}return null;};}function patchUpdates(_0x3eda73){return function(_0x15ed51){try{jsonpatch[_0x57c8('0x2c')](_0x15ed51,_0x3eda73,!![]);}catch(_0x4703a4){return BPromise[_0x57c8('0x2d')](_0x4703a4);}return _0x15ed51[_0x57c8('0x2e')]();};}function saveUpdates(_0x1ba0f3,_0x152da5){return function(_0x4bfefe){if(_0x4bfefe){return _0x4bfefe['update'](_0x1ba0f3)[_0x57c8('0x2f')](function(_0x1857c6){return _0x1857c6;});}return null;};}function removeEntity(_0x2a4d7c,_0x2a3150){return function(_0x369e29){if(_0x369e29){return _0x369e29[_0x57c8('0x30')]()[_0x57c8('0x2f')](function(){var _0x3c9b5e=_0x369e29[_0x57c8('0x31')]({'plain':!![]});var _0x3631a6='ChatWebsites';return db[_0x57c8('0x32')][_0x57c8('0x30')]({'where':{'type':_0x3631a6,'resourceId':_0x3c9b5e['id']}})[_0x57c8('0x2f')](function(){return _0x369e29;});})[_0x57c8('0x2f')](function(){_0x2a4d7c[_0x57c8('0x24')](0xcc)[_0x57c8('0x25')]();});}};}function handleEntityNotFound(_0x4d42fd,_0x430c1d){return function(_0xa45751){if(!_0xa45751){_0x4d42fd[_0x57c8('0x33')](0x194);}return _0xa45751;};}function handleError(_0x196740,_0x3ca460){_0x3ca460=_0x3ca460||0x1f4;return function(_0x276931){logger[_0x57c8('0x1f')](_0x276931['stack']);if(_0x276931[_0x57c8('0x34')]){delete _0x276931[_0x57c8('0x34')];}_0x196740['status'](_0x3ca460)['send'](_0x276931);};}exports['index']=function(_0x427e75,_0x4d2529){var _0x5ccacf={'include':[{'model':db[_0x57c8('0x35')],'as':'mandatoryDispositionPause'}]},_0x1dc2b5={},_0x17e322={'count':0x0,'rows':[]};var _0x358aa9=_[_0x57c8('0x36')](db['ChatWebsite'][_0x57c8('0x37')],function(_0x553f9f){return{'name':_0x553f9f['fieldName'],'type':_0x553f9f[_0x57c8('0x38')][_0x57c8('0x39')]};});_0x1dc2b5[_0x57c8('0x3a')]=_[_0x57c8('0x36')](_0x358aa9,_0x57c8('0x34'));_0x1dc2b5[_0x57c8('0x3b')]=_[_0x57c8('0x3c')](_0x427e75[_0x57c8('0x3b')]);_0x1dc2b5[_0x57c8('0x3d')]=_[_0x57c8('0x3e')](_0x1dc2b5[_0x57c8('0x3a')],_0x1dc2b5['query']);_0x5ccacf['attributes']=_[_0x57c8('0x3e')](_0x1dc2b5[_0x57c8('0x3a')],qs['fields'](_0x427e75['query'][_0x57c8('0x3f')]));_0x5ccacf['attributes']=_0x5ccacf[_0x57c8('0x40')][_0x57c8('0x41')]?_0x5ccacf[_0x57c8('0x40')]:_0x1dc2b5[_0x57c8('0x3a')];if(!_0x427e75[_0x57c8('0x3b')][_0x57c8('0x42')](_0x57c8('0x43'))){_0x5ccacf[_0x57c8('0x29')]=qs[_0x57c8('0x29')](_0x427e75[_0x57c8('0x3b')]['limit']);_0x5ccacf[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x427e75[_0x57c8('0x3b')][_0x57c8('0x28')]);}_0x5ccacf[_0x57c8('0x44')]=qs[_0x57c8('0x45')](_0x427e75[_0x57c8('0x3b')][_0x57c8('0x45')]);_0x5ccacf['where']=qs[_0x57c8('0x3d')](_[_0x57c8('0x46')](_0x427e75[_0x57c8('0x3b')],_0x1dc2b5['filters']),_0x358aa9);if(_0x427e75[_0x57c8('0x3b')][_0x57c8('0x47')]){_0x5ccacf[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0x5ccacf['where'],{'$or':_[_0x57c8('0x36')](_0x358aa9,function(_0x268034){if(_0x268034[_0x57c8('0x38')]!=='VIRTUAL'){var _0x2030c9={};_0x2030c9[_0x268034[_0x57c8('0x34')]]={'$like':'%'+_0x427e75['query'][_0x57c8('0x47')]+'%'};return _0x2030c9;}})});}_0x5ccacf=_[_0x57c8('0x49')]({},_0x5ccacf,_0x427e75[_0x57c8('0x4a')]);var _0x23654f={'where':_0x5ccacf[_0x57c8('0x48')]};return db[_0x57c8('0x4b')][_0x57c8('0x27')](_0x23654f)[_0x57c8('0x2f')](function(_0x579898){_0x17e322[_0x57c8('0x27')]=_0x579898;if(_0x427e75[_0x57c8('0x3b')][_0x57c8('0x4c')]){_0x5ccacf[_0x57c8('0x4d')]=[{'all':!![]}];}return db[_0x57c8('0x4b')][_0x57c8('0x4e')](_0x5ccacf);})[_0x57c8('0x2f')](function(_0x49331d){_0x17e322[_0x57c8('0x4f')]=_0x49331d;return _0x17e322;})[_0x57c8('0x2f')](respondWithFilteredResult(_0x4d2529,_0x5ccacf))['catch'](handleError(_0x4d2529,null));};exports[_0x57c8('0x50')]=function(_0x49acad,_0x3fdd0f){var _0xb32c16={'raw':![],'where':{'id':_0x49acad[_0x57c8('0x51')]['id']},'include':[{'model':db[_0x57c8('0x35')],'as':_0x57c8('0x52')}]},_0x4dcef5={};_0x4dcef5[_0x57c8('0x3a')]=_[_0x57c8('0x3c')](db['ChatWebsite'][_0x57c8('0x37')]);_0x4dcef5['query']=_[_0x57c8('0x3c')](_0x49acad[_0x57c8('0x3b')]);_0x4dcef5[_0x57c8('0x3d')]=_['intersection'](_0x4dcef5[_0x57c8('0x3a')],_0x4dcef5['query']);_0xb32c16[_0x57c8('0x40')]=_[_0x57c8('0x3e')](_0x4dcef5[_0x57c8('0x3a')],qs['fields'](_0x49acad[_0x57c8('0x3b')][_0x57c8('0x3f')]));_0xb32c16[_0x57c8('0x40')]=_0xb32c16['attributes']['length']?_0xb32c16['attributes']:_0x4dcef5[_0x57c8('0x3a')];if(_0x49acad[_0x57c8('0x3b')][_0x57c8('0x4c')]){_0xb32c16[_0x57c8('0x4d')]=[{'all':!![]}];}_0xb32c16=_[_0x57c8('0x49')]({},_0xb32c16,_0x49acad[_0x57c8('0x4a')]);return db[_0x57c8('0x4b')][_0x57c8('0x53')](_0xb32c16)[_0x57c8('0x2f')](handleEntityNotFound(_0x3fdd0f,null))[_0x57c8('0x2f')](respondWithResult(_0x3fdd0f,null))[_0x57c8('0x23')](handleError(_0x3fdd0f,null));};exports[_0x57c8('0x54')]=function(_0x8870e2,_0x38de92){return db['ChatWebsite'][_0x57c8('0x54')](_0x8870e2['body'],{})['then'](function(_0x30afe2){var _0x2a1009=_0x8870e2[_0x57c8('0x55')]['get']({'plain':!![]});if(!_0x2a1009)throw new Error(_0x57c8('0x56'));if(_0x2a1009['role']==='user'){var _0x384ea1=_0x30afe2['get']({'plain':!![]});var _0x3f0918=_0x57c8('0x57');return db[_0x57c8('0x58')]['find']({'where':{'name':_0x3f0918,'userProfileId':_0x2a1009['userProfileId']},'raw':!![]})[_0x57c8('0x2f')](function(_0x535e09){if(_0x535e09&&_0x535e09[_0x57c8('0x59')]===0x0){return db[_0x57c8('0x32')]['create']({'name':_0x384ea1[_0x57c8('0x34')],'resourceId':_0x384ea1['id'],'type':_0x535e09['name'],'sectionId':_0x535e09['id']},{})[_0x57c8('0x2f')](function(){return _0x30afe2;});}else{return _0x30afe2;}})['catch'](function(_0x4f681e){logger[_0x57c8('0x1f')](_0x57c8('0x5a'),_0x4f681e);throw _0x4f681e;});}return _0x30afe2;})[_0x57c8('0x2f')](respondWithResult(_0x38de92,0xc9))[_0x57c8('0x23')](handleError(_0x38de92,null));};exports[_0x57c8('0x5b')]=function(_0x552cef,_0x1b3ae2){if(_0x552cef[_0x57c8('0x5c')]['id']){delete _0x552cef['body']['id'];}return db[_0x57c8('0x4b')]['find']({'where':{'id':_0x552cef[_0x57c8('0x51')]['id']},'include':[{'model':db[_0x57c8('0x35')],'as':_0x57c8('0x52')}]})[_0x57c8('0x2f')](handleEntityNotFound(_0x1b3ae2,null))['then'](saveUpdates(_0x552cef[_0x57c8('0x5c')],null))[_0x57c8('0x2f')](respondWithResult(_0x1b3ae2,null))['catch'](handleError(_0x1b3ae2,null));};exports['destroy']=function(_0x3a580e,_0x53a1ba){return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x3a580e[_0x57c8('0x51')]['id']}})['then'](handleEntityNotFound(_0x53a1ba,null))[_0x57c8('0x2f')](removeEntity(_0x53a1ba,null))['catch'](handleError(_0x53a1ba,null));};exports[_0x57c8('0x5d')]=function(_0x36f372,_0x37a7ec){return db[_0x57c8('0x4b')][_0x57c8('0x5d')]()['then'](respondWithResult(_0x37a7ec,null))[_0x57c8('0x23')](handleError(_0x37a7ec,null));};exports[_0x57c8('0x5e')]=function(_0x49c5ad,_0x1eb41e,_0x195222){if(_0x49c5ad[_0x57c8('0x5c')]['id']){delete _0x49c5ad['body']['id'];}return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x49c5ad[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x1eb41e,null))[_0x57c8('0x2f')](function(_0xe2129b){if(_0xe2129b){_0x49c5ad[_0x57c8('0x5c')][_0x57c8('0x5f')]=_0xe2129b['id'];return db[_0x57c8('0x60')][_0x57c8('0x54')](_0x49c5ad['body']);}})[_0x57c8('0x2f')](respondWithResult(_0x1eb41e,null))[_0x57c8('0x23')](handleError(_0x1eb41e,null));};exports[_0x57c8('0x61')]=function(_0x48a901,_0x3cde79,_0x5a954f){var _0xee2218={'raw':![],'where':{}};var _0x2b9bb7={};var _0x2a1dfe={'count':0x0,'rows':[]};return db[_0x57c8('0x4b')][_0x57c8('0x62')]({'where':{'id':_0x48a901['params']['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x3cde79,null))[_0x57c8('0x2f')](function(_0x227433){if(_0x227433){_0x2b9bb7[_0x57c8('0x3a')]=_[_0x57c8('0x3c')](db['Disposition'][_0x57c8('0x37')]);_0x2b9bb7[_0x57c8('0x3b')]=_[_0x57c8('0x3c')](_0x48a901['query']);_0x2b9bb7['filters']=_[_0x57c8('0x3e')](_0x2b9bb7['model'],_0x2b9bb7[_0x57c8('0x3b')]);_0xee2218[_0x57c8('0x40')]=_[_0x57c8('0x3e')](_0x2b9bb7[_0x57c8('0x3a')],qs['fields'](_0x48a901['query'][_0x57c8('0x3f')]));_0xee2218[_0x57c8('0x40')]=_0xee2218[_0x57c8('0x40')][_0x57c8('0x41')]?_0xee2218[_0x57c8('0x40')]:_0x2b9bb7[_0x57c8('0x3a')];if(!_0x48a901['query'][_0x57c8('0x42')](_0x57c8('0x43'))){_0xee2218[_0x57c8('0x29')]=qs['limit'](_0x48a901['query'][_0x57c8('0x29')]);_0xee2218[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x48a901[_0x57c8('0x3b')][_0x57c8('0x28')]);}_0xee2218[_0x57c8('0x44')]=qs[_0x57c8('0x45')](_0x48a901['query'][_0x57c8('0x45')]);_0xee2218[_0x57c8('0x48')]=qs[_0x57c8('0x3d')](_[_0x57c8('0x46')](_0x48a901[_0x57c8('0x3b')],_0x2b9bb7['filters']));_0xee2218[_0x57c8('0x48')][_0x57c8('0x5f')]=_0x227433['id'];if(_0x48a901[_0x57c8('0x3b')][_0x57c8('0x47')]){_0xee2218[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0xee2218[_0x57c8('0x48')],{'$or':_[_0x57c8('0x36')](_0xee2218['attributes'],function(_0x1b073d){var _0x323600={};_0x323600[_0x1b073d]={'$like':'%'+_0x48a901['query'][_0x57c8('0x47')]+'%'};return _0x323600;})});}_0xee2218=_['merge']({},_0xee2218,_0x48a901[_0x57c8('0x4a')]);return db['Disposition'][_0x57c8('0x27')]({'where':_0xee2218[_0x57c8('0x48')]})[_0x57c8('0x2f')](function(_0x789493){_0x2a1dfe[_0x57c8('0x27')]=_0x789493;if(_0x48a901[_0x57c8('0x3b')][_0x57c8('0x4c')]){_0xee2218[_0x57c8('0x4d')]=[{'all':!![]}];}return db[_0x57c8('0x60')][_0x57c8('0x4e')](_0xee2218);})[_0x57c8('0x2f')](function(_0x136b25){_0x2a1dfe[_0x57c8('0x4f')]=_0x136b25;return _0x2a1dfe;});}})[_0x57c8('0x2f')](respondWithFilteredResult(_0x3cde79,_0xee2218))[_0x57c8('0x23')](handleError(_0x3cde79,null));};exports[_0x57c8('0x63')]=function(_0x47fe48,_0x403a83,_0x2efbb5){return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x47fe48[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x403a83,null))[_0x57c8('0x2f')](function(_0x47695d){if(_0x47695d){return _0x47695d[_0x57c8('0x63')](_0x47fe48[_0x57c8('0x3b')][_0x57c8('0x64')]);}})[_0x57c8('0x2f')](respondWithStatusCode(_0x403a83,null))[_0x57c8('0x23')](handleError(_0x403a83,null));};exports[_0x57c8('0x65')]=function(_0x49a538,_0x1e27e4,_0x287fdb){if(_0x49a538[_0x57c8('0x5c')]['id']){delete _0x49a538[_0x57c8('0x5c')]['id'];}return db[_0x57c8('0x4b')]['find']({'where':{'id':_0x49a538[_0x57c8('0x51')]['id']}})['then'](handleEntityNotFound(_0x1e27e4,null))['then'](function(_0x1e9612){if(_0x1e9612){_0x49a538['body']['ChatWebsiteId']=_0x1e9612['id'];return db[_0x57c8('0x66')]['create'](_0x49a538[_0x57c8('0x5c')]);}})['then'](respondWithResult(_0x1e27e4,null))[_0x57c8('0x23')](handleError(_0x1e27e4,null));};exports[_0x57c8('0x67')]=function(_0x3020b3,_0x43faf3,_0x1d1970){var _0xc699bb={'raw':![],'where':{}};var _0x5da4cd={};var _0x3c8633={'count':0x0,'rows':[]};return db[_0x57c8('0x4b')][_0x57c8('0x62')]({'where':{'id':_0x3020b3[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x43faf3,null))[_0x57c8('0x2f')](function(_0x566318){if(_0x566318){_0x5da4cd[_0x57c8('0x3a')]=_[_0x57c8('0x3c')](db['CannedAnswer'][_0x57c8('0x37')]);_0x5da4cd[_0x57c8('0x3b')]=_[_0x57c8('0x3c')](_0x3020b3[_0x57c8('0x3b')]);_0x5da4cd[_0x57c8('0x3d')]=_[_0x57c8('0x3e')](_0x5da4cd[_0x57c8('0x3a')],_0x5da4cd[_0x57c8('0x3b')]);_0xc699bb[_0x57c8('0x40')]=_[_0x57c8('0x3e')](_0x5da4cd[_0x57c8('0x3a')],qs[_0x57c8('0x3f')](_0x3020b3[_0x57c8('0x3b')][_0x57c8('0x3f')]));_0xc699bb[_0x57c8('0x40')]=_0xc699bb['attributes'][_0x57c8('0x41')]?_0xc699bb[_0x57c8('0x40')]:_0x5da4cd['model'];if(!_0x3020b3[_0x57c8('0x3b')][_0x57c8('0x42')](_0x57c8('0x43'))){_0xc699bb[_0x57c8('0x29')]=qs[_0x57c8('0x29')](_0x3020b3['query'][_0x57c8('0x29')]);_0xc699bb[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x3020b3[_0x57c8('0x3b')]['offset']);}_0xc699bb[_0x57c8('0x44')]=qs['sort'](_0x3020b3[_0x57c8('0x3b')][_0x57c8('0x45')]);_0xc699bb[_0x57c8('0x48')]=qs['filters'](_[_0x57c8('0x46')](_0x3020b3[_0x57c8('0x3b')],_0x5da4cd[_0x57c8('0x3d')]));_0xc699bb[_0x57c8('0x48')]['ChatWebsiteId']=_0x566318['id'];if(_0x3020b3[_0x57c8('0x3b')]['filter']){_0xc699bb[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0xc699bb[_0x57c8('0x48')],{'$or':_[_0x57c8('0x36')](_0xc699bb[_0x57c8('0x40')],function(_0x53acbb){var _0x4f1484={};_0x4f1484[_0x53acbb]={'$like':'%'+_0x3020b3[_0x57c8('0x3b')]['filter']+'%'};return _0x4f1484;})});}_0xc699bb=_['merge']({},_0xc699bb,_0x3020b3['options']);return db[_0x57c8('0x66')][_0x57c8('0x27')]({'where':_0xc699bb[_0x57c8('0x48')]})[_0x57c8('0x2f')](function(_0x29a2c1){_0x3c8633[_0x57c8('0x27')]=_0x29a2c1;if(_0x3020b3[_0x57c8('0x3b')][_0x57c8('0x4c')]){_0xc699bb[_0x57c8('0x4d')]=[{'all':!![]}];}return db[_0x57c8('0x66')][_0x57c8('0x4e')](_0xc699bb);})['then'](function(_0x6b1ed5){_0x3c8633[_0x57c8('0x4f')]=_0x6b1ed5;return _0x3c8633;});}})[_0x57c8('0x2f')](respondWithFilteredResult(_0x43faf3,_0xc699bb))[_0x57c8('0x23')](handleError(_0x43faf3,null));};exports[_0x57c8('0x68')]=function(_0x366dfa,_0x41d2f3,_0x53aa6c){return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x366dfa[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x41d2f3,null))['then'](function(_0x308b12){if(_0x308b12){return _0x308b12[_0x57c8('0x68')](_0x366dfa[_0x57c8('0x3b')][_0x57c8('0x64')]);}})[_0x57c8('0x2f')](respondWithStatusCode(_0x41d2f3,null))[_0x57c8('0x23')](handleError(_0x41d2f3,null));};exports['addLogo']=function(_0x501254,_0x502770,_0x4db8af){_0x501254[_0x57c8('0x5c')][_0x57c8('0x69')]=_0x501254[_0x57c8('0x6a')][_0x57c8('0x6b')];return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x501254['params']['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x502770,null))[_0x57c8('0x2f')](saveUpdates(_0x501254[_0x57c8('0x5c')],null))['then'](respondWithResult(_0x502770,null))[_0x57c8('0x23')](handleError(_0x502770,null));};exports[_0x57c8('0x6c')]=function(_0x20f2db,_0x412abe,_0x5802f4){_0x20f2db[_0x57c8('0x5c')]['agentAvatar']=_0x20f2db['file'][_0x57c8('0x6b')];return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x20f2db[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x412abe,null))[_0x57c8('0x2f')](saveUpdates(_0x20f2db[_0x57c8('0x5c')],null))[_0x57c8('0x2f')](respondWithResult(_0x412abe,null))[_0x57c8('0x23')](handleError(_0x412abe,null));};exports['addCustomerAvatar']=function(_0x34a779,_0x40f7be,_0xe8d5fb){_0x34a779[_0x57c8('0x5c')][_0x57c8('0x6d')]=_0x34a779[_0x57c8('0x6a')][_0x57c8('0x6b')];return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x34a779[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x40f7be,null))[_0x57c8('0x2f')](saveUpdates(_0x34a779[_0x57c8('0x5c')],null))[_0x57c8('0x2f')](respondWithResult(_0x40f7be,null))['catch'](handleError(_0x40f7be,null));};exports[_0x57c8('0x6e')]=function(_0x19102e,_0x24efc2,_0x948130){_0x19102e[_0x57c8('0x5c')][_0x57c8('0x6f')]=_0x19102e[_0x57c8('0x6a')][_0x57c8('0x6b')];return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x19102e['params']['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x24efc2,null))[_0x57c8('0x2f')](saveUpdates(_0x19102e[_0x57c8('0x5c')],null))[_0x57c8('0x2f')](respondWithResult(_0x24efc2,null))[_0x57c8('0x23')](handleError(_0x24efc2,null));};exports[_0x57c8('0x70')]=function(_0x40a29e,_0x10da4e,_0x286f72){var _0x23a580=path['join'](config['root'],'server/files/images/logos/default_logo.png');var _0x133ae4={'where':{'id':_0x40a29e[_0x57c8('0x51')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x130ec0=![];return require(_0x57c8('0x71'))[_0x57c8('0x72')]()[_0x57c8('0x2f')](function(_0x1d5a70){if(_0x1d5a70){_0x130ec0=_0x1d5a70[_0x57c8('0x73')];}})['then'](function(){return db[_0x57c8('0x4b')][_0x57c8('0x53')](_0x133ae4);})[_0x57c8('0x2f')](handleEntityNotFound(_0x10da4e,null))[_0x57c8('0x2f')](function(_0x587f54){if(_0x587f54){if(!_[_0x57c8('0x74')](_0x587f54[_0x57c8('0x69')])){if(fs[_0x57c8('0x75')](path[_0x57c8('0x76')](config[_0x57c8('0x77')],_0x57c8('0x78'),_0x587f54[_0x57c8('0x69')]))&&_0x130ec0){_0x23a580=path[_0x57c8('0x76')](config[_0x57c8('0x77')],_0x57c8('0x78'),_0x587f54[_0x57c8('0x69')]);}}return _0x10da4e[_0x57c8('0x79')](_0x23a580);}})['catch'](handleError(_0x10da4e,null));};exports[_0x57c8('0x7a')]=function(_0x1bc81a,_0x128e7e,_0x880d1c){var _0x21688a=path['join'](config[_0x57c8('0x77')],_0x57c8('0x7b'));var _0x3a3d1d={'where':{'id':_0x1bc81a[_0x57c8('0x51')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x57c8('0x4b')][_0x57c8('0x53')](_0x3a3d1d)[_0x57c8('0x2f')](handleEntityNotFound(_0x128e7e,null))[_0x57c8('0x2f')](function(_0x165ddb){if(_0x165ddb){if(!_[_0x57c8('0x74')](_0x165ddb[_0x57c8('0x7c')])){if(fs[_0x57c8('0x75')](path['join'](config['root'],_0x57c8('0x7d'),_0x165ddb['agentAvatar']))){_0x21688a=path['join'](config[_0x57c8('0x77')],'server/files/images/avatars/',_0x165ddb[_0x57c8('0x7c')]);}}return _0x128e7e[_0x57c8('0x79')](_0x21688a);}})['catch'](handleError(_0x128e7e,null));};exports[_0x57c8('0x7e')]=function(_0x50ac9f,_0x58855e,_0x355cdc){var _0x4e2164=path[_0x57c8('0x76')](config[_0x57c8('0x77')],_0x57c8('0x7f'));var _0x180ed3={'where':{'id':_0x50ac9f[_0x57c8('0x51')]['id']},'attributes':['id','customerAvatar',_0x57c8('0x80')],'raw':!![]};return db[_0x57c8('0x4b')]['find'](_0x180ed3)[_0x57c8('0x2f')](handleEntityNotFound(_0x58855e,null))['then'](function(_0x55f915){if(_0x55f915){if(!_[_0x57c8('0x74')](_0x55f915[_0x57c8('0x6d')])){if(fs['existsSync'](path[_0x57c8('0x76')](config[_0x57c8('0x77')],'server/files/images/avatars/',_0x55f915['customerAvatar']))&&_0x55f915['showCustomerAvatar']){_0x4e2164=path['join'](config[_0x57c8('0x77')],_0x57c8('0x7d'),_0x55f915[_0x57c8('0x6d')]);}}return _0x58855e[_0x57c8('0x79')](_0x4e2164);}})[_0x57c8('0x23')](handleError(_0x58855e,null));};exports[_0x57c8('0x81')]=function(_0x420170,_0x1acfe3,_0x5b260b){var _0x202b7a=path[_0x57c8('0x76')](config['root'],_0x57c8('0x82'));var _0x43b1c8={'where':{'id':_0x420170[_0x57c8('0x51')]['id']},'attributes':['id',_0x57c8('0x6f')],'raw':!![]};return db[_0x57c8('0x4b')][_0x57c8('0x53')](_0x43b1c8)[_0x57c8('0x2f')](handleEntityNotFound(_0x1acfe3,null))['then'](function(_0x42bfa7){if(_0x42bfa7){if(!_['isNil'](_0x42bfa7[_0x57c8('0x6f')])){if(fs[_0x57c8('0x75')](path[_0x57c8('0x76')](config[_0x57c8('0x77')],_0x57c8('0x7d'),_0x42bfa7[_0x57c8('0x6f')]))){_0x202b7a=path[_0x57c8('0x76')](config[_0x57c8('0x77')],_0x57c8('0x7d'),_0x42bfa7[_0x57c8('0x6f')]);}}return _0x1acfe3[_0x57c8('0x79')](_0x202b7a);}})[_0x57c8('0x23')](handleError(_0x1acfe3,null));};exports[_0x57c8('0x83')]=function(_0x1fa7b1,_0x34541f,_0x1aa34d){var _0x286784=require(_0x57c8('0x84'));var _0x4ad615=new _0x286784();var _0x262c4c=_0x4ad615[_0x57c8('0x85')](_0x1fa7b1['headers'][_0x57c8('0x86')])[_0x57c8('0x87')]();var _0x43c782={'body':_0x1fa7b1[_0x57c8('0x5c')],'channel':_0x57c8('0x88')};var _0x22ddd2=[];var _0x30b0f9=[];var _0x19c2dd={};var _0xe6f95c=![];return db[_0x57c8('0x89')][_0x57c8('0x5d')]()['then'](function(_0xae5da9){if(!_0xae5da9){throw new db[(_0x57c8('0x15'))]['ValidationError'](_0x57c8('0x8a'));}_0x22ddd2=_[_0x57c8('0x8b')](_['keys'](_0xae5da9),['createdAt',_0x57c8('0x8c')]);_0x30b0f9=_[_0x57c8('0x8b')](_[_0x57c8('0x3c')](_0xae5da9),['createdAt','updatedAt',_0x57c8('0x8d'),_0x57c8('0x8e')]);if(_0x1fa7b1[_0x57c8('0x5c')]['id']){delete _0x1fa7b1[_0x57c8('0x5c')]['id'];}if(_['isNil'](_0x1fa7b1['body'][_0x57c8('0x8f')])){throw new db[(_0x57c8('0x15'))][(_0x57c8('0x16'))](_0x57c8('0x90'));}if(_[_0x57c8('0x74')](_0x1fa7b1[_0x57c8('0x5c')]['body'])||_0x1fa7b1[_0x57c8('0x5c')]['body']===''){throw new db['Sequelize'][(_0x57c8('0x16'))](_0x57c8('0x91'));}if(_[_0x57c8('0x74')](_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0x92')])){throw new db[(_0x57c8('0x15'))][(_0x57c8('0x16'))](_0x57c8('0x93')+_0x30b0f9);}if(!_['includes'](_0x30b0f9,_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0x92')])){throw new db[(_0x57c8('0x15'))][(_0x57c8('0x16'))](_0x57c8('0x94')+_0x30b0f9);}_0x19c2dd[_0x1fa7b1['body']['mapKey']]=_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0x8f')];})[_0x57c8('0x2f')](function(){return db['ChatWebsite'][_0x57c8('0x53')]({'where':{'id':_0x1fa7b1[_0x57c8('0x51')]['id']},'include':[{'model':db[_0x57c8('0x95')],'as':_0x57c8('0x96'),'include':[{'model':db['CmContact'],'as':_0x57c8('0x97'),'where':_0x19c2dd,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x57c8('0x98')],'as':_0x57c8('0x99')}]});})[_0x57c8('0x2f')](handleEntityNotFound(_0x34541f,null))[_0x57c8('0x2f')](function(_0x5bed28){if(_0x5bed28&&_0x5bed28[_0x57c8('0x96')]){_0x43c782['account']=_0x5bed28;_0x43c782[_0x57c8('0x9a')]=_0x5bed28[_0x57c8('0x99')];_0x43c782[_0x57c8('0x9b')]=_0x5bed28['List'];_0x43c782[_0x57c8('0x9a')]=_[_0x57c8('0x9c')](_0x43c782[_0x57c8('0x9a')],[_0x57c8('0x9d')],[_0x57c8('0x9e')]);if(_0x43c782[_0x57c8('0x9f')]['Applications']){delete _0x43c782[_0x57c8('0x9f')][_0x57c8('0x99')];}if(_0x43c782['account'][_0x57c8('0x96')]&&_0x43c782[_0x57c8('0x9f')][_0x57c8('0x96')][_0x57c8('0x97')]['length']){return _0x43c782[_0x57c8('0x9f')]['List'][_0x57c8('0x97')][0x0];}var _0xd71f79=_[_0x57c8('0xe')](_0x1fa7b1[_0x57c8('0x5c')],{'firstName':_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0x8f')],'ListId':_0x5bed28[_0x57c8('0x8e')]});_0xd71f79[_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0x92')]]=_0x1fa7b1[_0x57c8('0x5c')]['from'];return db[_0x57c8('0x89')][_0x57c8('0x54')](_0xd71f79,{'fields':_0x22ddd2,'raw':!![]});}})[_0x57c8('0x2f')](handleEntityNotFound(_0x34541f,null))[_0x57c8('0x2f')](function(_0x38819f){_0x43c782[_0x57c8('0xa0')]=_0x38819f;var _0x5dfaaf=_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xa1')];if(_0x1fa7b1['headers']['cf-connecting-ip']){_0x5dfaaf=_0x1fa7b1[_0x57c8('0xa2')][_0x57c8('0xa3')];}else if(_0x1fa7b1[_0x57c8('0xa2')][_0x57c8('0xa4')]){_0x5dfaaf=_['first'](_0x1fa7b1[_0x57c8('0xa2')][_0x57c8('0xa4')][_0x57c8('0xa5')](','));}if(_0x38819f){var _0x2fa839={'ContactId':_0x38819f['id'],'ChatWebsiteId':_0x1fa7b1['params']['id'],'from':(_0x38819f[_0x57c8('0xa6')]||'')+'\x20'+(_0x38819f[_0x57c8('0xa7')]||''),'customerIp':_0x5dfaaf,'customerPort':_0x1fa7b1['headers'][_0x57c8('0xa8')]?_0x1fa7b1[_0x57c8('0xa2')][_0x57c8('0xa8')]:null,'referer':_0x1fa7b1[_0x57c8('0x5c')]['referer'],'browserName':_0x262c4c[_0x57c8('0xa9')][_0x57c8('0x34')]&&_0x262c4c[_0x57c8('0xa9')][_0x57c8('0xaa')]?util[_0x57c8('0xab')](_0x57c8('0xac'),_0x262c4c[_0x57c8('0xa9')][_0x57c8('0x34')],_0x262c4c['browser'][_0x57c8('0xaa')]):'unknown','browserVersion':_0x262c4c[_0x57c8('0xa9')][_0x57c8('0xaa')]||_0x57c8('0xad'),'osName':util[_0x57c8('0xab')]('%s\x20%s',_0x262c4c['os'][_0x57c8('0x34')],_0x262c4c['os'][_0x57c8('0xaa')]),'osVersion':_0x262c4c['os']['version'],'deviceModel':_0x262c4c['device']['model']&&_0x262c4c[_0x57c8('0xae')][_0x57c8('0xaf')]?util['format'](_0x57c8('0xb0'),_0x262c4c['device']['model'],_0x262c4c['device'][_0x57c8('0xaf')],_0x262c4c[_0x57c8('0xae')][_0x57c8('0x38')]):null,'deviceVendor':_0x262c4c[_0x57c8('0xae')][_0x57c8('0xaf')],'deviceType':_0x262c4c[_0x57c8('0xae')]['type'],'formData':JSON['stringify'](_0x1fa7b1['body'])};var _0x4a72c8={'ChatWebsiteId':_0x1fa7b1[_0x57c8('0x51')]['id'],'closed':![]};if(_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb1')]){_0x4a72c8[_0x57c8('0xb1')]=_0x1fa7b1['body'][_0x57c8('0xb1')];return db[_0x57c8('0xb2')]['find']({'where':_0x4a72c8})['then'](function(_0x409bee){if(_0x409bee){return[_0x409bee,![]];}_0x2fa839['threadId']=_0x1fa7b1[_0x57c8('0x5c')]['threadId'];_0x2fa839[_0x57c8('0xb3')]=_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb3')];return db[_0x57c8('0xb2')][_0x57c8('0x54')](_0x2fa839)[_0x57c8('0x2f')](function(_0xbc6eeb){return[_0xbc6eeb,!![]];});});}_0x4a72c8[_0x57c8('0xb4')]=_0x38819f['id'];if(_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb5')]&&_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb5')]['id']){_0x4a72c8['id']=_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb5')]['id'];return db[_0x57c8('0xb2')][_0x57c8('0x53')]({'where':_0x4a72c8})['then'](function(_0x3b7dd7){if(_0x3b7dd7){return[_0x3b7dd7,![]];}return db[_0x57c8('0xb2')]['create'](_0x2fa839)['then'](function(_0x35559a){return[_0x35559a,!![]];});});}return db['ChatInteraction'][_0x57c8('0x54')](_0x2fa839)[_0x57c8('0x2f')](function(_0x4d4bf5){return[_0x4d4bf5,!![]];});}})[_0x57c8('0xb6')](function(_0x44410a,_0x110c5f){if(_0x44410a){_0xe6f95c=_0x110c5f;if(!_0x110c5f){var _0x3d6f4e={'from':(_0x43c782['contact'][_0x57c8('0xa6')]||'')+'\x20'+(_0x43c782[_0x57c8('0xa0')][_0x57c8('0xa7')]||'')};if(_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb1')]&&_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb7')]&&_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb1')]!=_0x1fa7b1[_0x57c8('0x5c')]['messageId']){_0x3d6f4e[_0x57c8('0xb1')]=_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xb7')];}return _0x44410a[_0x57c8('0x5b')](_0x3d6f4e);}else{return _0x44410a;}}})['then'](function(_0x58c635){_0x43c782[_0x57c8('0xb5')]=_0x58c635[_0x57c8('0x31')]({'plain':!![]});_0x43c782[_0x57c8('0xb5')]['created']=_0xe6f95c;if(_0x43c782[_0x57c8('0xb5')][_0x57c8('0xb8')]){if(_0x43c782[_0x57c8('0x9f')][_0x57c8('0xb9')]){_0x43c782['applications'][_0x57c8('0xba')]({'id':0x0,'priority':_0x43c782[_0x57c8('0x9a')][_0x57c8('0x41')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x57c8('0xbb')});}}return db[_0x57c8('0xbc')][_0x57c8('0x54')]({'body':_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0x5c')],'ChatWebsiteId':_0x1fa7b1[_0x57c8('0x51')]['id'],'ChatInteractionId':_0x58c635['id'],'direction':'in','ContactId':_0x43c782[_0x57c8('0xa0')]['id'],'AttachmentId':_0x1fa7b1[_0x57c8('0x5c')][_0x57c8('0xbd')]});})[_0x57c8('0x2f')](function(_0x34edf7){_0x43c782['message']=_0x34edf7;if(_0x43c782[_0x57c8('0xb5')]['UserId']){return db[_0x57c8('0xbe')]['find']({'attributes':['id',_0x57c8('0x34')],'where':{'id':_0x43c782['interaction'][_0x57c8('0xbf')]}})[_0x57c8('0x2f')](function(_0xba966e){if(_0xba966e){_0x43c782[_0x57c8('0x9a')]['unshift']({'id':0x0,'priority':0x0,'app':_0x57c8('0xc0'),'appdata':_0xba966e[_0x57c8('0x34')]+','+(_0x43c782[_0x57c8('0x9f')][_0x57c8('0xc1')]||0xa),'interval':_0x57c8('0xbb')});_0x43c782['forcedOwnership']=!![];}return respondWithRpcPromise(_0x57c8('0xc2'),_0x57c8('0xc3'),_0x43c782);});}return respondWithRpcPromise(_0x57c8('0xc2'),_0x57c8('0xc3'),_0x43c782);})[_0x57c8('0x2f')](function(_0x2e0f51){respondWithRpcPromise(_0x57c8('0xc4'),'EventManager',{'event':_0x57c8('0x83'),'message':_0x2e0f51},client9002);return _0x2e0f51;})[_0x57c8('0x2f')](respondWithResult(_0x34541f,null))[_0x57c8('0x23')](handleError(_0x34541f,null));};exports[_0x57c8('0xc5')]=function(_0x17d064,_0x12d927,_0x55e8bc){var _0x4f19c6,_0x18873b,_0x271756;var _0x411c09=[];var _0xf2456a=[];var _0x3798aa={};return db['CmContact'][_0x57c8('0x5d')]()[_0x57c8('0x2f')](function(_0x453491){if(!_0x453491){throw new db[(_0x57c8('0x15'))][(_0x57c8('0x16'))](_0x57c8('0x8a'));}_0xf2456a=_['difference'](_[_0x57c8('0x3c')](_0x453491),[_0x57c8('0xc6'),_0x57c8('0x8c')]);_0x411c09=_[_0x57c8('0x8b')](_[_0x57c8('0x3c')](_0x453491),[_0x57c8('0xc6'),_0x57c8('0x8c'),_0x57c8('0x8d'),_0x57c8('0x8e')]);if(_0x17d064['body']['id']){delete _0x17d064[_0x57c8('0x5c')]['id'];}if(_[_0x57c8('0x74')](_0x17d064[_0x57c8('0x5c')][_0x57c8('0x8f')])){throw _0x12d927[_0x57c8('0x24')](0x1f4)['send'](new db['Sequelize'][(_0x57c8('0x16'))]('from\x20is\x20mandatory'));}if(_[_0x57c8('0x74')](_0x17d064[_0x57c8('0x5c')][_0x57c8('0x5c')])||_0x17d064['body'][_0x57c8('0x5c')]===''){throw _0x12d927['status'](0x1f4)['send'](new db['Sequelize'][(_0x57c8('0x16'))](_0x57c8('0x91')));}if(_[_0x57c8('0x74')](_0x17d064[_0x57c8('0x5c')][_0x57c8('0xc7')])){throw _0x12d927[_0x57c8('0x24')](0x1f4)[_0x57c8('0xc8')](new db[(_0x57c8('0x15'))]['ValidationError'](_0x57c8('0xc9')+_0x411c09));}if(!_[_0x57c8('0xca')](_0x411c09,_0x17d064['body'][_0x57c8('0xc7')])){throw _0x12d927[_0x57c8('0x24')](0x1f4)[_0x57c8('0xc8')](new db['Sequelize'][(_0x57c8('0x16'))](_0x57c8('0xcb')+_0x411c09));}_0x3798aa[_0x17d064[_0x57c8('0x5c')][_0x57c8('0xc7')]]=_0x17d064[_0x57c8('0x5c')][_0x57c8('0x8f')];})[_0x57c8('0x2f')](function(){return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x17d064[_0x57c8('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x57c8('0x96')}]});})['then'](handleEntityNotFound(_0x12d927,null))[_0x57c8('0x2f')](function(_0x298b32){if(_0x298b32&&_0x298b32[_0x57c8('0x96')]){_0x18873b=_0x298b32;var _0x16bd09=_[_0x57c8('0xe')](_0x17d064[_0x57c8('0x5c')],{'firstName':_0x17d064['body'][_0x57c8('0x8f')],'phone':_0x17d064[_0x57c8('0x5c')]['from'],'ListId':_0x298b32[_0x57c8('0x8e')]});_0x16bd09[_0x17d064[_0x57c8('0x5c')][_0x57c8('0xc7')]]=_0x17d064[_0x57c8('0x5c')]['from'];return db['CmContact'][_0x57c8('0xcc')]({'where':_0x3798aa,'defaults':_0x16bd09});}})[_0x57c8('0xb6')](function(_0x4a4f3f){if(_0x4a4f3f){_0x271756=_0x4a4f3f;var _0x3263b3=fs['readFileSync'](path[_0x57c8('0x76')](config[_0x57c8('0x77')],'server/files/templates/chatOfflineMessage.ejs'),_0x57c8('0xcd'));var _0x2ebbc6=ejs[_0x57c8('0xce')](_0x3263b3,{'body':_[_0x57c8('0xcf')](_0x17d064[_0x57c8('0x5c')][_0x57c8('0x5c')]),'bodyTitle':_0x18873b[_0x57c8('0xd0')]});return db['ChatOfflineMessage']['create']({'body':_0x2ebbc6,'ContactId':_0x4a4f3f['id'],'ChatWebsiteId':_0x18873b['id']});}})[_0x57c8('0x2f')](function(_0x1d8212){if(_0x1d8212){_0x4f19c6=_0x1d8212;return db[_0x57c8('0xd1')][_0x57c8('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x57c8('0xd2')],'as':'Smtp','raw':!![]}]});}})[_0x57c8('0x2f')](function(_0x206962){if(_0x206962&&_0x206962[_0x57c8('0xd3')]&&_0x18873b[_0x57c8('0xd4')]){var _0xede113={'tls':{'rejectUnauthorized':![]}};if(_0x206962[_0x57c8('0xd3')][_0x57c8('0xd5')]){_0xede113[_0x57c8('0xd5')]=_0x206962[_0x57c8('0xd3')][_0x57c8('0xd5')];}else{_0xede113['host']=_0x206962[_0x57c8('0xd3')][_0x57c8('0xd6')];_0xede113['port']=_0x206962[_0x57c8('0xd3')][_0x57c8('0xd7')];_0xede113['secure']=_0x206962[_0x57c8('0xd3')]['secure'];}if(_0x206962[_0x57c8('0xd3')][_0x57c8('0xd8')]){_0xede113[_0x57c8('0xd9')]={'user':_0x206962[_0x57c8('0xd3')][_0x57c8('0x55')],'pass':_0x206962['Smtp'][_0x57c8('0xda')]};}return respondWithRpcPromise(_0x57c8('0xdb'),_0x57c8('0xdc'),{'account':_0xede113,'message':{'from':util[_0x57c8('0xab')](_0x57c8('0xdd'),_0x206962['name'],_0x206962[_0x57c8('0xde')]||_0x206962['Smtp']['user']),'to':_0x18873b[_0x57c8('0xd4')],'subject':_0x18873b[_0x57c8('0xdf')],'text':_0x4f19c6[_0x57c8('0x5c')]}},client9003)[_0x57c8('0x2f')](function(){return _0x4f19c6;})[_0x57c8('0x23')](function(_0x3e1dd6){console[_0x57c8('0x1f')](_0x3e1dd6);});}})[_0x57c8('0x2f')](function(){if(_0x4f19c6){return _0x4f19c6;}})[_0x57c8('0x2f')](respondWithResult(_0x12d927,null))[_0x57c8('0x23')](handleError(_0x12d927,null));};exports[_0x57c8('0xe0')]=function(_0x2b14ea,_0x37b23b,_0x3452ba){return db['ChatInteraction'][_0x57c8('0x53')]({'where':{'id':_0x2b14ea['params']['id']}})['then'](handleEntityNotFound(_0x37b23b,null))[_0x57c8('0x2f')](function(_0x35ed71){if(_0x35ed71){return _0x35ed71[_0x57c8('0xe0')](_0x2b14ea[_0x57c8('0x5c')][_0x57c8('0x64')],_[_0x57c8('0xe1')](_0x2b14ea[_0x57c8('0x5c')],[_0x57c8('0x64'),'id'])||{});}})[_0x57c8('0x2f')](respondWithResult(_0x37b23b,null))[_0x57c8('0x23')](handleError(_0x37b23b,null));};exports['getInteractions']=function(_0x3b07d9,_0x2d9c08,_0x480532){var _0xf12059={'raw':![],'where':{}};var _0x239b3f={};var _0xeef5b0={'count':0x0,'rows':[]};return db[_0x57c8('0x4b')]['findOne']({'where':{'id':_0x3b07d9[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x2d9c08,null))['then'](function(_0x2aa759){if(_0x2aa759){_0x239b3f[_0x57c8('0x3a')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x239b3f[_0x57c8('0x3b')]=_[_0x57c8('0x3c')](_0x3b07d9['query']);_0x239b3f[_0x57c8('0x3d')]=_[_0x57c8('0x3e')](_0x239b3f[_0x57c8('0x3a')],_0x239b3f[_0x57c8('0x3b')]);_0xf12059['attributes']=_[_0x57c8('0x3e')](_0x239b3f[_0x57c8('0x3a')],qs[_0x57c8('0x3f')](_0x3b07d9[_0x57c8('0x3b')]['fields']));_0xf12059['attributes']=_0xf12059['attributes'][_0x57c8('0x41')]?_0xf12059['attributes']:_0x239b3f[_0x57c8('0x3a')];if(!_0x3b07d9['query']['hasOwnProperty'](_0x57c8('0x43'))){_0xf12059[_0x57c8('0x29')]=qs[_0x57c8('0x29')](_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0x29')]);_0xf12059[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0x28')]);}_0xf12059['order']=qs['sort'](_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0x45')]);_0xf12059[_0x57c8('0x48')]=qs['filters'](_[_0x57c8('0x46')](_0x3b07d9[_0x57c8('0x3b')],_0x239b3f[_0x57c8('0x3d')]));_0xf12059[_0x57c8('0x48')]['ChatWebsiteId']=_0x2aa759['id'];if(_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0x47')]){_0xf12059[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0xf12059[_0x57c8('0x48')],{'$or':_[_0x57c8('0x36')](_0xf12059[_0x57c8('0x40')],function(_0x556f30){var _0x224bc4={};_0x224bc4[_0x556f30]={'$like':'%'+_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0x47')]+'%'};return _0x224bc4;})});}_0xf12059=_[_0x57c8('0x49')]({},_0xf12059,_0x3b07d9[_0x57c8('0x4a')]);return db[_0x57c8('0xb2')][_0x57c8('0x27')]({'where':_0xf12059['where']})[_0x57c8('0x2f')](function(_0x565575){_0xeef5b0[_0x57c8('0x27')]=_0x565575;if(_0x3b07d9['query'][_0x57c8('0x4c')]){_0xf12059[_0x57c8('0x4d')]=[{'model':db[_0x57c8('0x89')],'as':_0x57c8('0xe2'),'required':![]},{'model':db[_0x57c8('0xbe')],'as':_0x57c8('0xe3'),'attributes':[_0x57c8('0x34'),_0x57c8('0xe4'),_0x57c8('0xe5')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x57c8('0xe6')],'where':_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0xe7')]?{'id':_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0xe7')]}:undefined,'required':_0x3b07d9[_0x57c8('0x3b')][_0x57c8('0xe7')]?!![]:![]}];}return db[_0x57c8('0xb2')]['findAll'](_0xf12059);})[_0x57c8('0x2f')](function(_0x4d960c){_0xeef5b0['rows']=_0x4d960c;return _0xeef5b0;});}})[_0x57c8('0x2f')](respondWithFilteredResult(_0x2d9c08,_0xf12059))[_0x57c8('0x23')](handleError(_0x2d9c08,null));};function iftimePromise(_0x54f0d1,_0x59e061){return respondWithRpcPromise(_0x57c8('0xe8'),'getSnippet',{'command':_0x59e061[_0x57c8('0xe9')]?util[_0x57c8('0xab')]('iftime\x20%s,%s',_0x54f0d1['interval'],_0x59e061[_0x57c8('0xe9')]):util[_0x57c8('0xab')](_0x57c8('0xea'),_0x54f0d1[_0x57c8('0xeb')])},client9002)[_0x57c8('0x2f')](function(_0x4536f5){var _0xb7308c=_0x4536f5&&_0x4536f5[_0x57c8('0xec')](_0x57c8('0xed'))>=0x0?!![]:![];logger[_0x57c8('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x59e061['id'],_0x54f0d1['id'],_0x54f0d1['interval'],_0xb7308c?_0x57c8('0xee'):'OFFLINE',_0x59e061[_0x57c8('0xe9')]?_0x59e061['timezone']:_0x57c8('0xef'));return _0xb7308c;})['catch'](function(_0x58912d){logger[_0x57c8('0x1f')](_0x57c8('0xf0'),_0x59e061['id'],_0x54f0d1['id'],_0x54f0d1['interval'],util['inspect'](_0x58912d,{'showHidden':![],'depth':null}),_0x59e061[_0x57c8('0xe9')]?_0x59e061[_0x57c8('0xe9')]:_0x57c8('0xef'));return![];});}exports['getSnippet']=function(_0x272fee,_0x1bbd16,_0x4a0805){var _0x3e47b5=0x0;var _0x235d38=0x0;var _0x4f00e0=![];var _0x1b5817;var _0x57c3e0;return db[_0x57c8('0x4b')]['find']({'where':{'id':_0x272fee[_0x57c8('0x51')]['id']},'include':[{'model':db['Interval'],'as':_0x57c8('0xf1'),'include':[{'model':db['Interval'],'as':_0x57c8('0xf2'),'attributes':['id',_0x57c8('0xeb')],'raw':!![]}]}]})[_0x57c8('0x2f')](handleEntityNotFound(_0x1bbd16,null))[_0x57c8('0x2f')](function(_0x543e15){if(_0x543e15){_0x1b5817=_0x543e15;return _0x543e15['getProactiveActions']({'raw':!![]});}})[_0x57c8('0x2f')](function(_0x408ae5){if(_0x1b5817){if(_0x408ae5){_0x57c3e0=_0x408ae5;}}return require('../../config/license/util')[_0x57c8('0x72')]();})['then'](function(_0x44fa08){if(_0x44fa08){_0x235d38=_0x44fa08[_0x57c8('0xf3')];_0x4f00e0=_0x44fa08['custom'];}})[_0x57c8('0x2f')](function(){return db[_0x57c8('0xb2')][_0x57c8('0x27')]({'where':{'closed':![]}});})[_0x57c8('0x2f')](function(_0x1d3db4){_0x3e47b5=_0x1d3db4;if(_0x235d38&&_0x1d3db4>_0x235d38){return db[_0x57c8('0xf4')][_0x57c8('0x62')]({'where':{'id':0x1}})[_0x57c8('0x2f')](function(_0xba48c9){if(_0xba48c9){_0xba48c9[_0x57c8('0xf5')]('chatLicenseExceeded');}});}})[_0x57c8('0x2f')](function(){if(_0x1b5817['Interval']&&_0x1b5817[_0x57c8('0xf1')][_0x57c8('0xf2')]){var _0x22fdd2=[];for(var _0x230e13=0x0;_0x230e13<_0x1b5817[_0x57c8('0xf1')][_0x57c8('0xf2')][_0x57c8('0x41')];_0x230e13++){var _0x68f394=_0x1b5817['Interval'][_0x57c8('0xf2')][_0x230e13][_0x57c8('0x31')]({'plain':!![]});_0x22fdd2[_0x57c8('0xba')](iftimePromise(_0x68f394,_0x1b5817));}return BPromise['all'](_0x22fdd2)[_0x57c8('0x2f')](function(_0x3cd533){return _[_0x57c8('0xf6')](_0x3cd533);});}else{return!![];}})[_0x57c8('0x2f')](function(_0x4c4efc){var _0x54ae4e=fs[_0x57c8('0xf7')](path[_0x57c8('0x76')](config['root'],_0x57c8('0xf8')),_0x57c8('0xcd'));var _0x477444={'remote':_0x1b5817['remote'],'query':querystring[_0x57c8('0x1e')](_[_0x57c8('0x49')](_0x1b5817['get']({'plain':!![]}),{'customerIp':_0x272fee[_0x57c8('0xa2')][_0x57c8('0xa4')]||_0x272fee[_0x57c8('0xa2')][_0x57c8('0xf9')]||_0x272fee[_0x57c8('0xfa')][_0x57c8('0xfb')]||_0x272fee['ip'],'referer':_0x272fee[_0x57c8('0xa2')][_0x57c8('0xfc')],'openedInteractions':_0x3e47b5,'maxInteractions':_0x235d38,'virtual':_0x4f00e0[_0x57c8('0xf3')],'online':_0x4c4efc,'custom':_0x4f00e0}))[_0x57c8('0xfd')](/'/g,'\x5c\x27')};_0x1bbd16['send'](ejs[_0x57c8('0xce')](Mustache[_0x57c8('0xce')](_0x54ae4e,_0x477444),{'proactiveActions':_0x57c3e0,'alignment':_0x1b5817[_0x57c8('0xfe')],'verticalAlignment':_0x1b5817[_0x57c8('0xff')],'div_color':_0x1b5817['color'],'text_color':_0x1b5817[_0x57c8('0x100')]}));})[_0x57c8('0x23')](handleError(_0x1bbd16,null));};exports[_0x57c8('0x101')]=function(_0x52c1a8,_0x36abec,_0x3b5882){return db['ChatWebsite'][_0x57c8('0x62')]({'where':{'id':_0x52c1a8[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x36abec,null))[_0x57c8('0x2f')](function(_0x299553){if(_0x299553){return db['sequelize']['transaction'](function(_0x270cd1){return db[_0x57c8('0x98')][_0x57c8('0x30')]({'where':{'ChatWebsiteId':_0x52c1a8[_0x57c8('0x51')]['id']},'transaction':_0x270cd1})[_0x57c8('0x2f')](function(_0xd72d73){var _0x377895=_[_0x57c8('0x36')](_0x52c1a8[_0x57c8('0x5c')],function(_0x7a2a81){_0x7a2a81[_0x57c8('0x5f')]=_0x52c1a8[_0x57c8('0x51')]['id'];return _0x7a2a81;});return db[_0x57c8('0x98')][_0x57c8('0x102')](_0x377895,{'transaction':_0x270cd1});});})[_0x57c8('0x2f')](function(){return db[_0x57c8('0x98')][_0x57c8('0x103')]({'where':{'ChatWebsiteId':_0x52c1a8[_0x57c8('0x51')]['id']},'order':_0x57c8('0x9d')});});}})['then'](respondWithResult(_0x36abec,null))[_0x57c8('0x23')](handleError(_0x36abec,null));};exports[_0x57c8('0x104')]=function(_0x585500,_0x461dbb,_0x2b720d){var _0x1f3000={};var _0x3cc599={};var _0x7fd9d1;var _0x16adb8;return db[_0x57c8('0x4b')]['findOne']({'where':{'id':_0x585500['params']['id']}})['then'](handleEntityNotFound(_0x461dbb,null))[_0x57c8('0x2f')](function(_0x2e75a0){if(_0x2e75a0){_0x7fd9d1=_0x2e75a0;_0x3cc599[_0x57c8('0x3a')]=_['keys'](db['ChatApplication'][_0x57c8('0x37')]);_0x3cc599[_0x57c8('0x3b')]=_[_0x57c8('0x3c')](_0x585500['query']);_0x3cc599['filters']=_[_0x57c8('0x3e')](_0x3cc599[_0x57c8('0x3a')],_0x3cc599[_0x57c8('0x3b')]);_0x1f3000[_0x57c8('0x40')]=_[_0x57c8('0x3e')](_0x3cc599[_0x57c8('0x3a')],qs[_0x57c8('0x3f')](_0x585500['query'][_0x57c8('0x3f')]));_0x1f3000[_0x57c8('0x40')]=_0x1f3000[_0x57c8('0x40')][_0x57c8('0x41')]?_0x1f3000[_0x57c8('0x40')]:_0x3cc599[_0x57c8('0x3a')];_0x1f3000['order']=qs[_0x57c8('0x45')](_0x585500[_0x57c8('0x3b')][_0x57c8('0x45')]);_0x1f3000[_0x57c8('0x48')]=qs['filters'](_['pick'](_0x585500['query'],_0x3cc599[_0x57c8('0x3d')]));if(_0x585500[_0x57c8('0x3b')][_0x57c8('0x47')]){_0x1f3000[_0x57c8('0x48')]=_['merge'](_0x1f3000['where'],{'$or':_[_0x57c8('0x36')](_0x1f3000['attributes'],function(_0x530809){var _0xafcffa={};_0xafcffa[_0x530809]={'$like':'%'+_0x585500[_0x57c8('0x3b')][_0x57c8('0x47')]+'%'};return _0xafcffa;})});}_0x1f3000=_[_0x57c8('0x49')]({},_0x1f3000,_0x585500[_0x57c8('0x4a')]);return _0x7fd9d1['getApplications'](_0x1f3000);}})[_0x57c8('0x2f')](function(_0x452aea){if(_0x452aea){_0x16adb8=_0x452aea['length'];if(!_0x585500[_0x57c8('0x3b')][_0x57c8('0x42')](_0x57c8('0x43'))){_0x1f3000[_0x57c8('0x29')]=qs[_0x57c8('0x29')](_0x585500['query']['limit']);_0x1f3000[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x585500[_0x57c8('0x3b')]['offset']);}return _0x7fd9d1[_0x57c8('0x104')](_0x1f3000);}})[_0x57c8('0x2f')](function(_0x20101f){if(_0x20101f){return _0x20101f?{'count':_0x16adb8,'rows':_0x20101f}:null;}})[_0x57c8('0x2f')](respondWithResult(_0x461dbb,null))['catch'](handleError(_0x461dbb,null));};exports[_0x57c8('0x105')]=function(_0x56e0b8,_0x38e258,_0x41231a){return db[_0x57c8('0x106')][_0x57c8('0x53')]({'where':{'id':_0x56e0b8[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x38e258,null))[_0x57c8('0x2f')](function(_0x34f450){if(_0x34f450){return _0x34f450[_0x57c8('0x105')](_0x56e0b8[_0x57c8('0x5c')][_0x57c8('0x64')],_[_0x57c8('0xe1')](_0x56e0b8['body'],[_0x57c8('0x64'),'id'])||{});}})['then'](respondWithResult(_0x38e258,null))['catch'](handleError(_0x38e258,null));};exports[_0x57c8('0x107')]=function(_0x3fa686,_0x54fc6d,_0x303079){var _0x29d5c5={};var _0x15e309={};var _0x2514a9;var _0x41aef7;return db[_0x57c8('0x4b')]['findOne']({'where':{'id':_0x3fa686[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x54fc6d,null))[_0x57c8('0x2f')](function(_0x14dc1d){if(_0x14dc1d){_0x2514a9=_0x14dc1d;_0x15e309[_0x57c8('0x3a')]=_[_0x57c8('0x3c')](db[_0x57c8('0x108')]['rawAttributes']);_0x15e309['query']=_['keys'](_0x3fa686['query']);_0x15e309['filters']=_[_0x57c8('0x3e')](_0x15e309['model'],_0x15e309[_0x57c8('0x3b')]);_0x29d5c5[_0x57c8('0x40')]=_[_0x57c8('0x3e')](_0x15e309['model'],qs['fields'](_0x3fa686['query'][_0x57c8('0x3f')]));_0x29d5c5[_0x57c8('0x40')]=_0x29d5c5['attributes'][_0x57c8('0x41')]?_0x29d5c5[_0x57c8('0x40')]:_0x15e309[_0x57c8('0x3a')];_0x29d5c5[_0x57c8('0x44')]=qs[_0x57c8('0x45')](_0x3fa686[_0x57c8('0x3b')][_0x57c8('0x45')]);_0x29d5c5[_0x57c8('0x48')]=qs[_0x57c8('0x3d')](_[_0x57c8('0x46')](_0x3fa686[_0x57c8('0x3b')],_0x15e309[_0x57c8('0x3d')]));if(_0x3fa686[_0x57c8('0x3b')][_0x57c8('0x47')]){_0x29d5c5[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0x29d5c5['where'],{'$or':_['map'](_0x29d5c5[_0x57c8('0x40')],function(_0x19d2f3){var _0x4aef20={};_0x4aef20[_0x19d2f3]={'$like':'%'+_0x3fa686['query'][_0x57c8('0x47')]+'%'};return _0x4aef20;})});}_0x29d5c5=_[_0x57c8('0x49')]({},_0x29d5c5,_0x3fa686[_0x57c8('0x4a')]);return _0x2514a9[_0x57c8('0x107')](_0x29d5c5);}})[_0x57c8('0x2f')](function(_0x40a0df){if(_0x40a0df){_0x41aef7=_0x40a0df[_0x57c8('0x41')];if(!_0x3fa686[_0x57c8('0x3b')][_0x57c8('0x42')](_0x57c8('0x43'))){_0x29d5c5['limit']=qs['limit'](_0x3fa686[_0x57c8('0x3b')][_0x57c8('0x29')]);_0x29d5c5[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x3fa686[_0x57c8('0x3b')]['offset']);}return _0x2514a9[_0x57c8('0x107')](_0x29d5c5);}})[_0x57c8('0x2f')](function(_0x19a56b){if(_0x19a56b){return _0x19a56b?{'count':_0x41aef7,'rows':_0x19a56b}:null;}})[_0x57c8('0x2f')](respondWithResult(_0x54fc6d,null))[_0x57c8('0x23')](handleError(_0x54fc6d,null));};exports['getFields']=function(_0x52dc54,_0xefebef,_0x2a8c60){var _0x1a769f=_0x52dc54[_0x57c8('0x3b')][_0x57c8('0x109')]===_0x57c8('0x10a')?'offlineForm':_0x57c8('0x10b');return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'attributes':['id',_0x1a769f],'where':{'id':_0x52dc54[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0xefebef,null))[_0x57c8('0x2f')](function(_0x15c02a){if(_0x15c02a){var _0x29cab5=_0x15c02a[_0x1a769f];var _0x14b621=_0x29cab5&&_0x29cab5['items']?_0x29cab5[_0x57c8('0x10c')]:[];_0xefebef[_0x57c8('0xc8')]({'fromKey':_[_0x57c8('0x74')](_0x29cab5['fromKey'])?undefined:_0x29cab5[_0x57c8('0x10d')],'count':_0x14b621[_0x57c8('0x41')],'rows':_0x14b621});}})[_0x57c8('0x23')](handleError(_0xefebef,null));};exports[_0x57c8('0x10e')]=function(_0x43b828,_0x1fde2d,_0x4327af){var _0x5e572e={'raw':![],'where':{}};var _0x5ba288={};var _0x58a516={'count':0x0,'rows':[]};return db[_0x57c8('0x4b')][_0x57c8('0x62')]({'where':{'id':_0x43b828[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x1fde2d,null))[_0x57c8('0x2f')](function(_0x4bc597){if(_0x4bc597){_0x5ba288[_0x57c8('0x3a')]=_['keys'](db['ChatOfflineMessage'][_0x57c8('0x37')]);_0x5ba288[_0x57c8('0x3b')]=_['keys'](_0x43b828[_0x57c8('0x3b')]);_0x5ba288['filters']=_[_0x57c8('0x3e')](_0x5ba288[_0x57c8('0x3a')],_0x5ba288[_0x57c8('0x3b')]);_0x5e572e['attributes']=_[_0x57c8('0x3e')](_0x5ba288[_0x57c8('0x3a')],qs['fields'](_0x43b828['query'][_0x57c8('0x3f')]));_0x5e572e[_0x57c8('0x40')]=_0x5e572e[_0x57c8('0x40')][_0x57c8('0x41')]?_0x5e572e[_0x57c8('0x40')]:_0x5ba288['model'];if(!_0x43b828[_0x57c8('0x3b')][_0x57c8('0x42')](_0x57c8('0x43'))){_0x5e572e['limit']=qs[_0x57c8('0x29')](_0x43b828[_0x57c8('0x3b')][_0x57c8('0x29')]);_0x5e572e[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x43b828[_0x57c8('0x3b')][_0x57c8('0x28')]);}_0x5e572e[_0x57c8('0x44')]=qs['sort'](_0x43b828['query'][_0x57c8('0x45')]);_0x5e572e[_0x57c8('0x48')]=qs['filters'](_[_0x57c8('0x46')](_0x43b828[_0x57c8('0x3b')],_0x5ba288[_0x57c8('0x3d')]));_0x5e572e[_0x57c8('0x48')][_0x57c8('0x5f')]=_0x4bc597['id'];if(_0x43b828[_0x57c8('0x3b')][_0x57c8('0x47')]){_0x5e572e[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0x5e572e[_0x57c8('0x48')],{'$or':_[_0x57c8('0x36')](_0x5e572e[_0x57c8('0x40')],function(_0x5dfe7b){var _0xa68e1f={};_0xa68e1f[_0x5dfe7b]={'$like':'%'+_0x43b828['query'][_0x57c8('0x47')]+'%'};return _0xa68e1f;})});}_0x5e572e=_[_0x57c8('0x49')]({},_0x5e572e,_0x43b828['options']);return db['ChatOfflineMessage'][_0x57c8('0x27')]({'where':_0x5e572e[_0x57c8('0x48')]})['then'](function(_0x5a8477){_0x58a516['count']=_0x5a8477;if(_0x43b828[_0x57c8('0x3b')][_0x57c8('0x4c')]){_0x5e572e[_0x57c8('0x4d')]=[{'all':!![]}];}else{_0x5e572e[_0x57c8('0x4d')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x5e572e);})[_0x57c8('0x2f')](function(_0x7b9005){_0x58a516[_0x57c8('0x4f')]=_0x7b9005;return _0x58a516;});}})[_0x57c8('0x2f')](respondWithFilteredResult(_0x1fde2d,_0x5e572e))[_0x57c8('0x23')](handleError(_0x1fde2d,null));};exports[_0x57c8('0x10f')]=function(_0x405853,_0x35b4fe,_0x3f718f){return db[_0x57c8('0x4b')][_0x57c8('0x53')]({'where':{'id':_0x405853['params']['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0x35b4fe,null))[_0x57c8('0x2f')](function(_0x449793){if(_0x449793){return _0x449793[_0x57c8('0x10f')](_0x405853[_0x57c8('0x5c')][_0x57c8('0x64')],_[_0x57c8('0xe1')](_0x405853[_0x57c8('0x5c')],[_0x57c8('0x64'),'id'])||{})['spread'](function(_0x23a356){for(var _0x38b477=0x0;_0x38b477<_0x405853['body'][_0x57c8('0x64')][_0x57c8('0x41')];_0x38b477+=0x1){socket[_0x57c8('0x110')](_0x57c8('0x111'),{'UserId':_0x405853[_0x57c8('0x5c')]['ids'][_0x38b477],'ChatWebsiteId':_0x405853[_0x57c8('0x51')]['id']});}return _0x23a356;});}})[_0x57c8('0x2f')](respondWithResult(_0x35b4fe,null))[_0x57c8('0x23')](handleError(_0x35b4fe,null));};exports['removeAgents']=function(_0x1a1c53,_0x46f22a,_0x4adae0){return db['ChatWebsite'][_0x57c8('0x53')]({'where':{'id':_0x1a1c53[_0x57c8('0x51')]['id']}})['then'](handleEntityNotFound(_0x46f22a,null))[_0x57c8('0x2f')](function(_0x1a91dc){if(_0x1a91dc){return _0x1a91dc[_0x57c8('0x112')](_0x1a1c53[_0x57c8('0x3b')][_0x57c8('0x64')])[_0x57c8('0x2f')](function(){if(_['isArray'](_0x1a1c53[_0x57c8('0x3b')]['ids'])){for(var _0x34ec1a=0x0;_0x34ec1a<_0x1a1c53['query'][_0x57c8('0x64')]['length'];_0x34ec1a+=0x1){socket['emit'](_0x57c8('0x113'),{'UserId':Number(_0x1a1c53[_0x57c8('0x3b')]['ids'][_0x34ec1a]),'ChatWebsiteId':Number(_0x1a1c53[_0x57c8('0x51')]['id'])});}}else{socket['emit'](_0x57c8('0x113'),{'UserId':Number(_0x1a1c53['query'][_0x57c8('0x64')]),'ChatWebsiteId':Number(_0x1a1c53[_0x57c8('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x46f22a,null))[_0x57c8('0x23')](handleError(_0x46f22a,null));};exports[_0x57c8('0x114')]=function(_0x1d805e,_0xddaaa7,_0x40890a){var _0x550aac={};var _0x23db46={};var _0x574694;var _0x21493a;return db['ChatWebsite'][_0x57c8('0x62')]({'where':{'id':_0x1d805e[_0x57c8('0x51')]['id']}})[_0x57c8('0x2f')](handleEntityNotFound(_0xddaaa7,null))[_0x57c8('0x2f')](function(_0x1f8207){if(_0x1f8207){_0x574694=_0x1f8207;_0x23db46['model']=_[_0x57c8('0x3c')](db[_0x57c8('0xbe')][_0x57c8('0x37')]);_0x23db46[_0x57c8('0x3b')]=_[_0x57c8('0x3c')](_0x1d805e[_0x57c8('0x3b')]);_0x23db46['filters']=_[_0x57c8('0x3e')](_0x23db46[_0x57c8('0x3a')],_0x23db46[_0x57c8('0x3b')]);_0x550aac[_0x57c8('0x40')]=_[_0x57c8('0x3e')](_0x23db46[_0x57c8('0x3a')],qs[_0x57c8('0x3f')](_0x1d805e['query'][_0x57c8('0x3f')]));_0x550aac[_0x57c8('0x40')]=_0x550aac[_0x57c8('0x40')][_0x57c8('0x41')]?_0x550aac[_0x57c8('0x40')]:_0x23db46[_0x57c8('0x3a')];_0x550aac[_0x57c8('0x44')]=qs[_0x57c8('0x45')](_0x1d805e[_0x57c8('0x3b')][_0x57c8('0x45')]);_0x550aac[_0x57c8('0x48')]=qs[_0x57c8('0x3d')](_[_0x57c8('0x46')](_0x1d805e[_0x57c8('0x3b')],_0x23db46[_0x57c8('0x3d')]));if(_0x1d805e[_0x57c8('0x3b')]['filter']){_0x550aac[_0x57c8('0x48')]=_[_0x57c8('0x49')](_0x550aac[_0x57c8('0x48')],{'$or':_['map'](_0x550aac[_0x57c8('0x40')],function(_0x2117f8){var _0x3bf4a9={};_0x3bf4a9[_0x2117f8]={'$like':'%'+_0x1d805e[_0x57c8('0x3b')][_0x57c8('0x47')]+'%'};return _0x3bf4a9;})});}_0x550aac=_['merge']({},_0x550aac,_0x1d805e[_0x57c8('0x4a')]);return _0x574694[_0x57c8('0x114')](_0x550aac);}})[_0x57c8('0x2f')](function(_0x456574){if(_0x456574){_0x21493a=_0x456574[_0x57c8('0x41')];if(!_0x1d805e['query']['hasOwnProperty'](_0x57c8('0x43'))){_0x550aac[_0x57c8('0x29')]=qs['limit'](_0x1d805e[_0x57c8('0x3b')]['limit']);_0x550aac[_0x57c8('0x28')]=qs[_0x57c8('0x28')](_0x1d805e['query'][_0x57c8('0x28')]);}return _0x574694[_0x57c8('0x114')](_0x550aac);}})[_0x57c8('0x2f')](function(_0xf6223f){if(_0xf6223f){return _0xf6223f?{'count':_0x21493a,'rows':_0xf6223f}:null;}})[_0x57c8('0x2f')](respondWithResult(_0xddaaa7,null))[_0x57c8('0x23')](handleError(_0xddaaa7,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index adde17d..3a4d616 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 _0x46cb=['update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0xc0f7e2,_0x354007){var _0xf95000=function(_0x248727){while(--_0x248727){_0xc0f7e2['push'](_0xc0f7e2['shift']());}};_0xf95000(++_0x354007);}(_0x46cb,0xd6));var _0xb46c=function(_0x40c58d,_0xca539f){_0x40c58d=_0x40c58d-0x0;var _0x2a8381=_0x46cb[_0x40c58d];return _0x2a8381;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb46c('0x0')](0x0);var events={'afterCreate':_0xb46c('0x1'),'afterUpdate':_0xb46c('0x2'),'afterDestroy':_0xb46c('0x3')};function emitEvent(_0x409dfd){return function(_0x2aab0a,_0x2a6e97,_0x65e78a){ChatWebsiteEvents[_0xb46c('0x4')](_0x409dfd+':'+_0x2aab0a['id'],_0x2aab0a);ChatWebsiteEvents[_0xb46c('0x4')](_0x409dfd,_0x2aab0a);_0x65e78a(null);};}for(var e in events){if(events[_0xb46c('0x5')](e)){var event=events[e];ChatWebsite[_0xb46c('0x6')](e,emitEvent(event));}}module[_0xb46c('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x2234=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x56c313,_0x4acb15){var _0x12987d=function(_0x597e84){while(--_0x597e84){_0x56c313['push'](_0x56c313['shift']());}};_0x12987d(++_0x4acb15);}(_0x2234,0x16e));var _0x4223=function(_0x12baed,_0x45a719){_0x12baed=_0x12baed-0x0;var _0x630772=_0x2234[_0x12baed];return _0x630772;};'use strict';var EventEmitter=require(_0x4223('0x0'));var ChatWebsite=require(_0x4223('0x1'))['db'][_0x4223('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4223('0x3')](0x0);var events={'afterCreate':_0x4223('0x4'),'afterUpdate':_0x4223('0x5'),'afterDestroy':_0x4223('0x6')};function emitEvent(_0x327b86){return function(_0x253080,_0x32956f,_0x57bdea){ChatWebsiteEvents[_0x4223('0x7')](_0x327b86+':'+_0x253080['id'],_0x253080);ChatWebsiteEvents['emit'](_0x327b86,_0x253080);_0x57bdea(null);};}for(var e in events){if(events[_0x4223('0x8')](e)){var event=events[e];ChatWebsite[_0x4223('0x9')](e,emitEvent(event));}}module[_0x4223('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ed4d49f..feef758 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 _0x49e9=['bluebird','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api','moment'];(function(_0x3aa8d5,_0x537c3d){var _0x491d65=function(_0x1ab049){while(--_0x1ab049){_0x3aa8d5['push'](_0x3aa8d5['shift']());}};_0x491d65(++_0x537c3d);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var logger=require('../../config/logger')(_0x949e('0x2'));var moment=require(_0x949e('0x3'));var BPromise=require(_0x949e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x949e('0x5'));var config=require('../../config/environment');var attributes=require(_0x949e('0x6'));module[_0x949e('0x7')]=function(_0x360308,_0x56c7b2){return _0x360308[_0x949e('0x8')](_0x949e('0x9'),attributes,{'tableName':_0x949e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','ChatWebsite','chat_websites','lodash'];(function(_0xd26a98,_0xefcf03){var _0x49be9f=function(_0x19a30a){while(--_0x19a30a){_0xd26a98['push'](_0xd26a98['shift']());}};_0x49be9f(++_0xefcf03);}(_0xaa88,0x137));var _0x8aa8=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0xaa88[_0x3a0863];return _0x85c557;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('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 da8f63e..1413400 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 _0xb016=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0xe4b9a8,_0x149fac){var _0x2c5904=function(_0x2c091a){while(--_0x2c091a){_0xe4b9a8['push'](_0xe4b9a8['shift']());}};_0x2c5904(++_0x149fac);}(_0xb016,0x159));var _0x6b01=function(_0x21d4a6,_0x3216f4){_0x21d4a6=_0x21d4a6-0x0;var _0x1c5efa=_0xb016[_0x21d4a6];return _0x1c5efa;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6b01('0xa')],{'host':_0x6b01('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b01('0xc'))[_0x6b01('0xd')](socket);function respondWithRpcPromise(_0x2c4e48,_0x242394,_0xab37c){return new BPromise(function(_0x5bed15,_0x4b4a4d){return client[_0x6b01('0xe')](_0x2c4e48,_0xab37c)[_0x6b01('0xf')](function(_0x2660c7){logger['info'](_0x6b01('0x10'),_0x242394,'request\x20sent');logger['debug'](_0x6b01('0x11'),_0x242394,'request\x20sent',JSON[_0x6b01('0x12')](_0x2660c7));if(_0x2660c7[_0x6b01('0x13')]){if(_0x2660c7['error'][_0x6b01('0x14')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x242394,_0x2660c7['error'][_0x6b01('0x15')]);return _0x4b4a4d(_0x2660c7['error']['message']);}logger[_0x6b01('0x13')](_0x6b01('0x10'),_0x242394,_0x2660c7[_0x6b01('0x13')][_0x6b01('0x15')]);return _0x5bed15(_0x2660c7[_0x6b01('0x13')][_0x6b01('0x15')]);}else{logger[_0x6b01('0x16')](_0x6b01('0x10'),_0x242394,_0x6b01('0x17'));_0x5bed15(_0x2660c7[_0x6b01('0x18')][_0x6b01('0x15')]);}})['catch'](function(_0x2c5f29){logger[_0x6b01('0x13')](_0x6b01('0x10'),_0x242394,_0x2c5f29);_0x4b4a4d(_0x2c5f29);});});} \ No newline at end of file +var _0xc6ac=['http','defaults','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x423170,_0x270d24){_0x423170=_0x423170-0x0;var _0x308abb=_0xc6ac[_0x423170];return _0x308abb;};'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});config['redis']=_[_0xcc6a('0xe')](config[_0xcc6a('0xf')],{'host':_0xcc6a('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc6a('0xf')]));require(_0xcc6a('0x11'))[_0xcc6a('0x12')](socket);function respondWithRpcPromise(_0x463ebb,_0x3eb04a,_0x5e91a2){return new BPromise(function(_0x30a004,_0x290119){return client[_0xcc6a('0x13')](_0x463ebb,_0x5e91a2)['then'](function(_0x1d91a5){logger[_0xcc6a('0x14')](_0xcc6a('0x15'),_0x3eb04a,'request\x20sent');logger['debug'](_0xcc6a('0x16'),_0x3eb04a,_0xcc6a('0x17'),JSON[_0xcc6a('0x18')](_0x1d91a5));if(_0x1d91a5['error']){if(_0x1d91a5['error'][_0xcc6a('0x19')]===0x1f4){logger[_0xcc6a('0x1a')](_0xcc6a('0x15'),_0x3eb04a,_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);return _0x290119(_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);}logger[_0xcc6a('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x3eb04a,_0x1d91a5['error']['message']);return _0x30a004(_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);}else{logger[_0xcc6a('0x14')](_0xcc6a('0x15'),_0x3eb04a,_0xcc6a('0x17'));_0x30a004(_0x1d91a5[_0xcc6a('0x1c')][_0xcc6a('0x1b')]);}})[_0xcc6a('0x1d')](function(_0x374e51){logger[_0xcc6a('0x1a')](_0xcc6a('0x15'),_0x3eb04a,_0x374e51);_0x290119(_0x374e51);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0fa8584..5593da7 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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x215305,_0x51ad5d){var _0x543f3e=function(_0x15aae6){while(--_0x15aae6){_0x215305['push'](_0x215305['shift']());}};_0x543f3e(++_0x51ad5d);}(_0x7a54,0x106));var _0x47a5=function(_0x268a8e,_0x4b7ccb){_0x268a8e=_0x268a8e-0x0;var _0x3953f9=_0x7a54[_0x268a8e];return _0x3953f9;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d7332,_0x15e723){_0x2d7332=_0x2d7332-0x0;var _0x5212fb=_0x5f2f[_0x2d7332];return _0x5212fb;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e34efe4..fdcb42d 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 _0x6646=['join','root','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','addAvatar','addSystemAvatar','/:id/notify','/:id/offline','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','/:id/offline_messages','getOfflineMessages','post','create','/:id/dispositions','addAnswer','diskStorage'];(function(_0x5cc776,_0x34a6de){var _0x2dc65e=function(_0x50f404){while(--_0x50f404){_0x5cc776['push'](_0x5cc776['shift']());}};_0x2dc65e(++_0x34a6de);}(_0x6646,0x183));var _0x6664=function(_0x5af3b3,_0x214479){_0x5af3b3=_0x5af3b3-0x0;var _0x1c023c=_0x6646[_0x5af3b3];return _0x1c023c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6664('0x0'));var timeout=require(_0x6664('0x1'));var express=require(_0x6664('0x2'));var router=express['Router']();var auth=require(_0x6664('0x3'));var interaction=require(_0x6664('0x4'));var config=require(_0x6664('0x5'));var controller=require(_0x6664('0x6'));router[_0x6664('0x7')]('/',auth[_0x6664('0x8')](),controller['index']);router[_0x6664('0x7')]('/describe',auth[_0x6664('0x8')](),controller[_0x6664('0x9')]);router['get'](_0x6664('0xa'),auth[_0x6664('0x8')](),controller['show']);router['get']('/:id/dispositions',auth[_0x6664('0x8')](),controller[_0x6664('0xb')]);router['get'](_0x6664('0xc'),auth[_0x6664('0x8')](),controller[_0x6664('0xd')]);router[_0x6664('0x7')](_0x6664('0xe'),controller[_0x6664('0xf')]);router['get'](_0x6664('0x10'),controller['getAvatar']);router[_0x6664('0x7')](_0x6664('0x11'),controller[_0x6664('0x12')]);router[_0x6664('0x7')](_0x6664('0x13'),controller[_0x6664('0x14')]);router[_0x6664('0x7')](_0x6664('0x15'),auth[_0x6664('0x8')](),controller['getInteractions']);router[_0x6664('0x7')](_0x6664('0x16'),controller[_0x6664('0x17')]);router[_0x6664('0x7')]('/:id/applications',auth[_0x6664('0x8')](),controller[_0x6664('0x18')]);router['get'](_0x6664('0x19'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x6664('0x7')]('/:id/fields',controller['getFields']);router['get'](_0x6664('0x1a'),auth[_0x6664('0x8')](),controller[_0x6664('0x1b')]);router[_0x6664('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x6664('0x1c')]('/',auth[_0x6664('0x8')](),controller[_0x6664('0x1d')]);router[_0x6664('0x1c')](_0x6664('0x1e'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x6664('0x8')](),controller[_0x6664('0x1f')]);var upload=multer({'storage':multer[_0x6664('0x20')]({'destination':function(_0x648ca9,_0x203a3e,_0x2070be){_0x2070be(null,path[_0x6664('0x21')](config[_0x6664('0x22')],'server/files/images/logos/'));},'filename':function(_0x55b9f4,_0x3c323d,_0x4a5ea5){_0x4a5ea5(null,util['format'](_0x6664('0x23'),Date[_0x6664('0x24')](),_0x3c323d[_0x6664('0x25')]));}})});router['post']('/:id/logo',upload[_0x6664('0x26')](_0x6664('0x27')),controller[_0x6664('0x28')]);var upload=multer({'storage':multer[_0x6664('0x20')]({'destination':function(_0x2d2006,_0x524a1a,_0x285e01){_0x285e01(null,path['join'](config[_0x6664('0x22')],_0x6664('0x29')));},'filename':function(_0x23112e,_0x3685e0,_0x3bee88){_0x3bee88(null,util[_0x6664('0x2a')]('%s-%s',Date['now'](),_0x3685e0[_0x6664('0x25')]));}})});router[_0x6664('0x1c')](_0x6664('0x10'),upload[_0x6664('0x26')]('file'),controller[_0x6664('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3059b3,_0x5a2197,_0x42c62e){_0x42c62e(null,path[_0x6664('0x21')](config[_0x6664('0x22')],_0x6664('0x29')));},'filename':function(_0x8314b9,_0xc4b372,_0x28c9ee){_0x28c9ee(null,util['format'](_0x6664('0x23'),Date[_0x6664('0x24')](),_0xc4b372['originalname']));}})});router[_0x6664('0x1c')](_0x6664('0x11'),upload['single'](_0x6664('0x27')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42a6e2,_0x34704f,_0x1606c0){_0x1606c0(null,path[_0x6664('0x21')](config['root'],_0x6664('0x29')));},'filename':function(_0x48d41d,_0x40853d,_0x29f80a){_0x29f80a(null,util[_0x6664('0x2a')](_0x6664('0x23'),Date['now'](),_0x40853d[_0x6664('0x25')]));}})});router['post'](_0x6664('0x13'),upload[_0x6664('0x26')](_0x6664('0x27')),controller[_0x6664('0x2c')]);router[_0x6664('0x1c')](_0x6664('0x2d'),controller['notify']);router[_0x6664('0x1c')](_0x6664('0x2e'),controller['offline']);router['post']('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0x6664('0x1c')](_0x6664('0x2f'),auth[_0x6664('0x8')](),controller[_0x6664('0x30')]);router['post'](_0x6664('0x19'),auth[_0x6664('0x8')](),controller[_0x6664('0x31')]);router[_0x6664('0x1c')](_0x6664('0x32'),auth[_0x6664('0x8')](),controller[_0x6664('0x33')]);router[_0x6664('0x34')](_0x6664('0xa'),auth['isAuthenticated'](),controller[_0x6664('0x35')]);router[_0x6664('0x36')](_0x6664('0xa'),auth[_0x6664('0x8')](),controller[_0x6664('0x37')]);router[_0x6664('0x36')]('/:id/dispositions',auth[_0x6664('0x8')](),controller[_0x6664('0x38')]);router[_0x6664('0x36')](_0x6664('0xc'),auth[_0x6664('0x8')](),controller[_0x6664('0x39')]);router['delete'](_0x6664('0x32'),auth[_0x6664('0x8')](),controller[_0x6664('0x3a')]);module[_0x6664('0x3b')]=router; \ No newline at end of file +var _0x6d7e=['removeAnswers','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions'];(function(_0x17afca,_0x5d6455){var _0x4691c9=function(_0x218099){while(--_0x218099){_0x17afca['push'](_0x17afca['shift']());}};_0x4691c9(++_0x5d6455);}(_0x6d7e,0x18e));var _0xe6d7=function(_0x1ce790,_0x2e6589){_0x1ce790=_0x1ce790-0x0;var _0xfe5e6c=_0x6d7e[_0x1ce790];return _0xfe5e6c;};'use strict';var multer=require(_0xe6d7('0x0'));var util=require(_0xe6d7('0x1'));var path=require(_0xe6d7('0x2'));var timeout=require(_0xe6d7('0x3'));var express=require(_0xe6d7('0x4'));var router=express['Router']();var auth=require(_0xe6d7('0x5'));var interaction=require(_0xe6d7('0x6'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xe6d7('0x7')]('/',auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x9')]);router[_0xe6d7('0x7')](_0xe6d7('0xa'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0xb')]);router[_0xe6d7('0x7')](_0xe6d7('0xc'),auth[_0xe6d7('0x8')](),controller['show']);router[_0xe6d7('0x7')](_0xe6d7('0xd'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0xe')]);router[_0xe6d7('0x7')](_0xe6d7('0xf'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x10')]);router['get'](_0xe6d7('0x11'),controller[_0xe6d7('0x12')]);router[_0xe6d7('0x7')](_0xe6d7('0x13'),controller['getAvatar']);router[_0xe6d7('0x7')](_0xe6d7('0x14'),controller['getCustomerAvatar']);router[_0xe6d7('0x7')](_0xe6d7('0x15'),controller['getSystemAvatar']);router[_0xe6d7('0x7')](_0xe6d7('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xe6d7('0x17'),controller[_0xe6d7('0x18')]);router['get'](_0xe6d7('0x19'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x1a')]);router['get'](_0xe6d7('0x1b'),auth[_0xe6d7('0x8')](),controller['getProactiveActions']);router['get'](_0xe6d7('0x1c'),controller['getFields']);router[_0xe6d7('0x7')](_0xe6d7('0x1d'),auth['isAuthenticated'](),controller[_0xe6d7('0x1e')]);router['get'](_0xe6d7('0x1f'),auth['isAuthenticated'](),controller[_0xe6d7('0x20')]);router[_0xe6d7('0x21')]('/',auth['isAuthenticated'](),controller[_0xe6d7('0x22')]);router[_0xe6d7('0x21')](_0xe6d7('0xd'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x23')]);router[_0xe6d7('0x21')](_0xe6d7('0xf'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x24')]);var upload=multer({'storage':multer[_0xe6d7('0x25')]({'destination':function(_0x4a9bd6,_0x353d08,_0x3fcd57){_0x3fcd57(null,path['join'](config[_0xe6d7('0x26')],_0xe6d7('0x27')));},'filename':function(_0x4150f1,_0x415480,_0x4b8576){_0x4b8576(null,util[_0xe6d7('0x28')](_0xe6d7('0x29'),Date[_0xe6d7('0x2a')](),_0x415480[_0xe6d7('0x2b')]));}})});router[_0xe6d7('0x21')]('/:id/logo',upload[_0xe6d7('0x2c')](_0xe6d7('0x2d')),controller[_0xe6d7('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf1927b,_0x142d11,_0x4f6799){_0x4f6799(null,path[_0xe6d7('0x2f')](config[_0xe6d7('0x26')],_0xe6d7('0x30')));},'filename':function(_0xd4e908,_0x44c319,_0x5a0182){_0x5a0182(null,util[_0xe6d7('0x28')](_0xe6d7('0x29'),Date[_0xe6d7('0x2a')](),_0x44c319[_0xe6d7('0x2b')]));}})});router[_0xe6d7('0x21')](_0xe6d7('0x13'),upload['single'](_0xe6d7('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1162d9,_0x2a5715,_0x2d2004){_0x2d2004(null,path[_0xe6d7('0x2f')](config[_0xe6d7('0x26')],'server/files/images/avatars/'));},'filename':function(_0x4f3da6,_0x56aeec,_0x5be1c9){_0x5be1c9(null,util['format'](_0xe6d7('0x29'),Date[_0xe6d7('0x2a')](),_0x56aeec[_0xe6d7('0x2b')]));}})});router['post'](_0xe6d7('0x14'),upload[_0xe6d7('0x2c')](_0xe6d7('0x2d')),controller[_0xe6d7('0x31')]);var upload=multer({'storage':multer[_0xe6d7('0x25')]({'destination':function(_0x200813,_0x34f7a7,_0x1d0e93){_0x1d0e93(null,path[_0xe6d7('0x2f')](config['root'],_0xe6d7('0x30')));},'filename':function(_0x1e383f,_0x2f7c5f,_0x332ac9){_0x332ac9(null,util[_0xe6d7('0x28')](_0xe6d7('0x29'),Date[_0xe6d7('0x2a')](),_0x2f7c5f[_0xe6d7('0x2b')]));}})});router[_0xe6d7('0x21')]('/:id/system_avatar',upload['single']('file'),controller[_0xe6d7('0x32')]);router[_0xe6d7('0x21')](_0xe6d7('0x33'),controller[_0xe6d7('0x34')]);router[_0xe6d7('0x21')](_0xe6d7('0x35'),controller[_0xe6d7('0x36')]);router[_0xe6d7('0x21')]('/:id/interactions',auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x37')]);router[_0xe6d7('0x21')](_0xe6d7('0x19'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x38')]);router[_0xe6d7('0x21')]('/:id/proactive_actions',auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x39')]);router[_0xe6d7('0x21')](_0xe6d7('0x1f'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x3a')]);router[_0xe6d7('0x3b')](_0xe6d7('0xc'),auth['isAuthenticated'](),controller[_0xe6d7('0x3c')]);router['delete'](_0xe6d7('0xc'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x3d')]);router[_0xe6d7('0x3e')]('/:id/dispositions',auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x3f')]);router[_0xe6d7('0x3e')](_0xe6d7('0xf'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x40')]);router[_0xe6d7('0x3e')](_0xe6d7('0x1f'),auth[_0xe6d7('0x8')](),controller[_0xe6d7('0x41')]);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 2ca2743..01839b5 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 _0x814b=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x349ffc,_0x5c270d){var _0x17baa8=function(_0x146f93){while(--_0x146f93){_0x349ffc['push'](_0x349ffc['shift']());}};_0x17baa8(++_0x5c270d);}(_0x814b,0x1a2));var _0xb814=function(_0x208961,_0x5e6cf6){_0x208961=_0x208961-0x0;var _0x4236f5=_0x814b[_0x208961];return _0x4236f5;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb814('0x3')](_0xb814('0x4'),_0xb814('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xb814('0x2')]}}; \ No newline at end of file +var _0x16a6=['sequelize','exports','ENUM','AmazonAWS','Google','STRING'];(function(_0x22b9f7,_0x396019){var _0x3b9286=function(_0x452f73){while(--_0x452f73){_0x22b9f7['push'](_0x22b9f7['shift']());}};_0x3b9286(++_0x396019);}(_0x16a6,0x15c));var _0x616a=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x16a6[_0x1fd675];return _0x16b554;};'use strict';var Sequelize=require(_0x616a('0x0'));module[_0x616a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x616a('0x2')](_0x616a('0x3'),_0x616a('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x616a('0x5')]},'data2':{'type':Sequelize[_0x616a('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 76585e5..f8dff3a 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 _0x4281=['send','index','map','CloudProvider','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','create','body','find','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','json','reject','save','update','destroy','then','end','error','name'];(function(_0xc14bf4,_0x4248d6){var _0x347925=function(_0x2c7a5){while(--_0x2c7a5){_0xc14bf4['push'](_0xc14bf4['shift']());}};_0x347925(++_0x4248d6);}(_0x4281,0xf1));var _0x1428=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x4281[_0x45f111];return _0x483508;};'use strict';var pdf=require(_0x1428('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1428('0x1'));var jsonpatch=require(_0x1428('0x2'));var rp=require('request-promise');var moment=require(_0x1428('0x3'));var BPromise=require(_0x1428('0x4'));var Mustache=require(_0x1428('0x5'));var util=require(_0x1428('0x6'));var path=require(_0x1428('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1428('0x8'));var fs=require('fs');var _=require(_0x1428('0x9'));var squel=require('squel');var crypto=require(_0x1428('0xa'));var jsforce=require(_0x1428('0xb'));var deskjs=require(_0x1428('0xc'));var toCsv=require(_0x1428('0xd'));var querystring=require(_0x1428('0xe'));var Papa=require(_0x1428('0xf'));var Redis=require('ioredis');var authService=require(_0x1428('0x10'));var qs=require(_0x1428('0x11'));var as=require(_0x1428('0x12'));var hardwareService=require(_0x1428('0x13'));var logger=require(_0x1428('0x14'))(_0x1428('0x15'));var utils=require(_0x1428('0x16'));var config=require(_0x1428('0x17'));var db=require(_0x1428('0x18'))['db'];function respondWithStatusCode(_0x1ac9bd,_0x4ce35b){_0x4ce35b=_0x4ce35b||0xcc;return function(_0xb35428){if(_0xb35428){return _0x1ac9bd[_0x1428('0x19')](_0x4ce35b);}return _0x1ac9bd[_0x1428('0x1a')](_0x4ce35b)['end']();};}function respondWithResult(_0xe1437d,_0x3e3ac0){_0x3e3ac0=_0x3e3ac0||0xc8;return function(_0x326e25){if(_0x326e25){return _0xe1437d[_0x1428('0x1a')](_0x3e3ac0)['json'](_0x326e25);}};}function respondWithFilteredResult(_0x3b92b2,_0x1ce359){return function(_0x195948){if(_0x195948){var _0x3a933b=_0x195948[_0x1428('0x1b')],_0x560abe=_0x1ce359[_0x1428('0x1c')],_0xf3137=_0x1ce359[_0x1428('0x1c')]+_0x1ce359[_0x1428('0x1d')],_0x34623c;if(_0xf3137>=_0x3a933b){_0xf3137=_0x3a933b;_0x34623c=0xc8;}else{_0x34623c=0xce;}_0x3b92b2[_0x1428('0x1a')](_0x34623c);return _0x3b92b2['set']('Content-Range',_0x560abe+'-'+_0xf3137+'/'+_0x3a933b)[_0x1428('0x1e')](_0x195948);}return null;};}function patchUpdates(_0x2f4ee9){return function(_0x110b0b){try{jsonpatch['apply'](_0x110b0b,_0x2f4ee9,!![]);}catch(_0x3378da){return BPromise[_0x1428('0x1f')](_0x3378da);}return _0x110b0b[_0x1428('0x20')]();};}function saveUpdates(_0x13d2dd,_0x55277e){return function(_0x18b428){if(_0x18b428){return _0x18b428[_0x1428('0x21')](_0x13d2dd)['then'](function(_0x2aa7b6){return _0x2aa7b6;});}return null;};}function removeEntity(_0x4e8c8c,_0x4dd09d){return function(_0x2b776e){if(_0x2b776e){return _0x2b776e[_0x1428('0x22')]()[_0x1428('0x23')](function(){_0x4e8c8c[_0x1428('0x1a')](0xcc)[_0x1428('0x24')]();});}};}function handleEntityNotFound(_0x59c08f,_0x540df9){return function(_0x5ae633){if(!_0x5ae633){_0x59c08f[_0x1428('0x19')](0x194);}return _0x5ae633;};}function handleError(_0x4d7a78,_0x443cab){_0x443cab=_0x443cab||0x1f4;return function(_0x172216){logger[_0x1428('0x25')](_0x172216['stack']);if(_0x172216['name']){delete _0x172216[_0x1428('0x26')];}_0x4d7a78[_0x1428('0x1a')](_0x443cab)[_0x1428('0x27')](_0x172216);};}exports[_0x1428('0x28')]=function(_0x496a0d,_0x433ee3){var _0x147493={},_0x695108={},_0x5c1129={'count':0x0,'rows':[]};var _0x19bcc=_[_0x1428('0x29')](db[_0x1428('0x2a')]['rawAttributes'],function(_0x30748c){return{'name':_0x30748c['fieldName'],'type':_0x30748c[_0x1428('0x2b')]['key']};});_0x695108[_0x1428('0x2c')]=_[_0x1428('0x29')](_0x19bcc,_0x1428('0x26'));_0x695108[_0x1428('0x2d')]=_[_0x1428('0x2e')](_0x496a0d[_0x1428('0x2d')]);_0x695108[_0x1428('0x2f')]=_[_0x1428('0x30')](_0x695108[_0x1428('0x2c')],_0x695108['query']);_0x147493[_0x1428('0x31')]=_['intersection'](_0x695108[_0x1428('0x2c')],qs['fields'](_0x496a0d[_0x1428('0x2d')][_0x1428('0x32')]));_0x147493['attributes']=_0x147493[_0x1428('0x31')][_0x1428('0x33')]?_0x147493[_0x1428('0x31')]:_0x695108[_0x1428('0x2c')];if(!_0x496a0d[_0x1428('0x2d')]['hasOwnProperty'](_0x1428('0x34'))){_0x147493[_0x1428('0x1d')]=qs['limit'](_0x496a0d['query'][_0x1428('0x1d')]);_0x147493[_0x1428('0x1c')]=qs['offset'](_0x496a0d[_0x1428('0x2d')][_0x1428('0x1c')]);}_0x147493[_0x1428('0x35')]=qs[_0x1428('0x36')](_0x496a0d[_0x1428('0x2d')][_0x1428('0x36')]);_0x147493[_0x1428('0x37')]=qs['filters'](_['pick'](_0x496a0d[_0x1428('0x2d')],_0x695108[_0x1428('0x2f')]),_0x19bcc);if(_0x496a0d[_0x1428('0x2d')][_0x1428('0x38')]){_0x147493['where']=_['merge'](_0x147493[_0x1428('0x37')],{'$or':_[_0x1428('0x29')](_0x19bcc,function(_0x498bef){if(_0x498bef[_0x1428('0x2b')]!=='VIRTUAL'){var _0x4bf59e={};_0x4bf59e[_0x498bef[_0x1428('0x26')]]={'$like':'%'+_0x496a0d[_0x1428('0x2d')]['filter']+'%'};return _0x4bf59e;}})});}_0x147493=_['merge']({},_0x147493,_0x496a0d[_0x1428('0x39')]);var _0x53aa1a={'where':_0x147493[_0x1428('0x37')]};return db[_0x1428('0x2a')][_0x1428('0x1b')](_0x53aa1a)[_0x1428('0x23')](function(_0x385ce7){_0x5c1129[_0x1428('0x1b')]=_0x385ce7;if(_0x496a0d['query'][_0x1428('0x3a')]){_0x147493['include']=[{'all':!![]}];}return db[_0x1428('0x2a')][_0x1428('0x3b')](_0x147493);})[_0x1428('0x23')](function(_0x3a1dd3){_0x5c1129[_0x1428('0x3c')]=_0x3a1dd3;return _0x5c1129;})[_0x1428('0x23')](respondWithFilteredResult(_0x433ee3,_0x147493))[_0x1428('0x3d')](handleError(_0x433ee3,null));};exports[_0x1428('0x3e')]=function(_0x5f1167,_0x35d653){var _0x251bea={'raw':!![],'where':{'id':_0x5f1167[_0x1428('0x3f')]['id']}},_0x4fd128={};_0x4fd128['model']=_[_0x1428('0x2e')](db[_0x1428('0x2a')][_0x1428('0x40')]);_0x4fd128[_0x1428('0x2d')]=_['keys'](_0x5f1167['query']);_0x4fd128['filters']=_['intersection'](_0x4fd128[_0x1428('0x2c')],_0x4fd128['query']);_0x251bea[_0x1428('0x31')]=_[_0x1428('0x30')](_0x4fd128[_0x1428('0x2c')],qs['fields'](_0x5f1167[_0x1428('0x2d')][_0x1428('0x32')]));_0x251bea['attributes']=_0x251bea[_0x1428('0x31')][_0x1428('0x33')]?_0x251bea[_0x1428('0x31')]:_0x4fd128[_0x1428('0x2c')];if(_0x5f1167[_0x1428('0x2d')][_0x1428('0x3a')]){_0x251bea[_0x1428('0x41')]=[{'all':!![]}];}_0x251bea=_[_0x1428('0x42')]({},_0x251bea,_0x5f1167[_0x1428('0x39')]);return db['CloudProvider']['find'](_0x251bea)['then'](handleEntityNotFound(_0x35d653,null))[_0x1428('0x23')](respondWithResult(_0x35d653,null))['catch'](handleError(_0x35d653,null));};exports[_0x1428('0x43')]=function(_0x44f0d6,_0x52dd2b){return db[_0x1428('0x2a')][_0x1428('0x43')](_0x44f0d6[_0x1428('0x44')],{})[_0x1428('0x23')](respondWithResult(_0x52dd2b,0xc9))[_0x1428('0x3d')](handleError(_0x52dd2b,null));};exports['update']=function(_0x1f97ea,_0x4bfe23){if(_0x1f97ea['body']['id']){delete _0x1f97ea['body']['id'];}return db[_0x1428('0x2a')][_0x1428('0x45')]({'where':{'id':_0x1f97ea[_0x1428('0x3f')]['id']}})[_0x1428('0x23')](handleEntityNotFound(_0x4bfe23,null))[_0x1428('0x23')](saveUpdates(_0x1f97ea[_0x1428('0x44')],null))['then'](respondWithResult(_0x4bfe23,null))[_0x1428('0x3d')](handleError(_0x4bfe23,null));};exports[_0x1428('0x22')]=function(_0x5dcbe1,_0x3550ef){return db[_0x1428('0x2a')][_0x1428('0x45')]({'where':{'id':_0x5dcbe1['params']['id']}})['then'](handleEntityNotFound(_0x3550ef,null))[_0x1428('0x23')](removeEntity(_0x3550ef,null))[_0x1428('0x3d')](handleError(_0x3550ef,null));}; \ No newline at end of file +var _0xb6c1=['apply','reject','save','update','then','destroy','error','stack','name','index','map','CloudProvider','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','include','findAll','rows','catch','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x1a49b7,_0x23ebc0){var _0x50c937=function(_0x4e5a00){while(--_0x4e5a00){_0x1a49b7['push'](_0x1a49b7['shift']());}};_0x50c937(++_0x23ebc0);}(_0xb6c1,0xfe));var _0x1b6c=function(_0x1212d4,_0x1322d6){_0x1212d4=_0x1212d4-0x0;var _0x373869=_0xb6c1[_0x1212d4];return _0x373869;};'use strict';var pdf=require(_0x1b6c('0x0'));var emlformat=require(_0x1b6c('0x1'));var rimraf=require(_0x1b6c('0x2'));var zipdir=require(_0x1b6c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b6c('0x4'));var moment=require(_0x1b6c('0x5'));var BPromise=require(_0x1b6c('0x6'));var Mustache=require(_0x1b6c('0x7'));var util=require('util');var path=require(_0x1b6c('0x8'));var sox=require(_0x1b6c('0x9'));var csv=require(_0x1b6c('0xa'));var ejs=require(_0x1b6c('0xb'));var fs=require('fs');var _=require(_0x1b6c('0xc'));var squel=require(_0x1b6c('0xd'));var crypto=require('crypto');var jsforce=require(_0x1b6c('0xe'));var deskjs=require(_0x1b6c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1b6c('0x10'));var Papa=require('papaparse');var Redis=require(_0x1b6c('0x11'));var authService=require(_0x1b6c('0x12'));var qs=require(_0x1b6c('0x13'));var as=require(_0x1b6c('0x14'));var hardwareService=require(_0x1b6c('0x15'));var logger=require(_0x1b6c('0x16'))(_0x1b6c('0x17'));var utils=require('../../config/utils');var config=require(_0x1b6c('0x18'));var db=require(_0x1b6c('0x19'))['db'];function respondWithStatusCode(_0x25c4ac,_0x11e8f1){_0x11e8f1=_0x11e8f1||0xcc;return function(_0x41cd6f){if(_0x41cd6f){return _0x25c4ac[_0x1b6c('0x1a')](_0x11e8f1);}return _0x25c4ac[_0x1b6c('0x1b')](_0x11e8f1)[_0x1b6c('0x1c')]();};}function respondWithResult(_0x4b31d4,_0x1cb067){_0x1cb067=_0x1cb067||0xc8;return function(_0x503016){if(_0x503016){return _0x4b31d4[_0x1b6c('0x1b')](_0x1cb067)[_0x1b6c('0x1d')](_0x503016);}};}function respondWithFilteredResult(_0x58ade8,_0x450bbd){return function(_0x4d60e7){if(_0x4d60e7){var _0x58ddbb=_0x4d60e7[_0x1b6c('0x1e')],_0x17cfa2=_0x450bbd[_0x1b6c('0x1f')],_0x57bdd2=_0x450bbd[_0x1b6c('0x1f')]+_0x450bbd['limit'],_0xb2e665;if(_0x57bdd2>=_0x58ddbb){_0x57bdd2=_0x58ddbb;_0xb2e665=0xc8;}else{_0xb2e665=0xce;}_0x58ade8['status'](_0xb2e665);return _0x58ade8[_0x1b6c('0x20')](_0x1b6c('0x21'),_0x17cfa2+'-'+_0x57bdd2+'/'+_0x58ddbb)[_0x1b6c('0x1d')](_0x4d60e7);}return null;};}function patchUpdates(_0x2a78a0){return function(_0x2b5e93){try{jsonpatch[_0x1b6c('0x22')](_0x2b5e93,_0x2a78a0,!![]);}catch(_0x59555f){return BPromise[_0x1b6c('0x23')](_0x59555f);}return _0x2b5e93[_0x1b6c('0x24')]();};}function saveUpdates(_0x1d16f5,_0x3ddd03){return function(_0xf9e730){if(_0xf9e730){return _0xf9e730[_0x1b6c('0x25')](_0x1d16f5)[_0x1b6c('0x26')](function(_0x277802){return _0x277802;});}return null;};}function removeEntity(_0xec3dfa,_0x459dd6){return function(_0x509571){if(_0x509571){return _0x509571[_0x1b6c('0x27')]()[_0x1b6c('0x26')](function(){_0xec3dfa['status'](0xcc)[_0x1b6c('0x1c')]();});}};}function handleEntityNotFound(_0x315b85,_0x4823ea){return function(_0x5ebcaa){if(!_0x5ebcaa){_0x315b85['sendStatus'](0x194);}return _0x5ebcaa;};}function handleError(_0x418adf,_0x3f01a0){_0x3f01a0=_0x3f01a0||0x1f4;return function(_0x14adaf){logger[_0x1b6c('0x28')](_0x14adaf[_0x1b6c('0x29')]);if(_0x14adaf[_0x1b6c('0x2a')]){delete _0x14adaf['name'];}_0x418adf[_0x1b6c('0x1b')](_0x3f01a0)['send'](_0x14adaf);};}exports[_0x1b6c('0x2b')]=function(_0x2d1037,_0x227a1c){var _0x1df619={},_0x1ff9e8={},_0x217118={'count':0x0,'rows':[]};var _0x7577a7=_[_0x1b6c('0x2c')](db[_0x1b6c('0x2d')]['rawAttributes'],function(_0x55c6de){return{'name':_0x55c6de['fieldName'],'type':_0x55c6de['type'][_0x1b6c('0x2e')]};});_0x1ff9e8[_0x1b6c('0x2f')]=_['map'](_0x7577a7,_0x1b6c('0x2a'));_0x1ff9e8[_0x1b6c('0x30')]=_['keys'](_0x2d1037[_0x1b6c('0x30')]);_0x1ff9e8[_0x1b6c('0x31')]=_[_0x1b6c('0x32')](_0x1ff9e8[_0x1b6c('0x2f')],_0x1ff9e8['query']);_0x1df619[_0x1b6c('0x33')]=_[_0x1b6c('0x32')](_0x1ff9e8[_0x1b6c('0x2f')],qs[_0x1b6c('0x34')](_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x34')]));_0x1df619[_0x1b6c('0x33')]=_0x1df619[_0x1b6c('0x33')][_0x1b6c('0x35')]?_0x1df619['attributes']:_0x1ff9e8[_0x1b6c('0x2f')];if(!_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x36')](_0x1b6c('0x37'))){_0x1df619[_0x1b6c('0x38')]=qs[_0x1b6c('0x38')](_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x38')]);_0x1df619[_0x1b6c('0x1f')]=qs[_0x1b6c('0x1f')](_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x1f')]);}_0x1df619[_0x1b6c('0x39')]=qs['sort'](_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x3a')]);_0x1df619[_0x1b6c('0x3b')]=qs[_0x1b6c('0x31')](_['pick'](_0x2d1037['query'],_0x1ff9e8[_0x1b6c('0x31')]),_0x7577a7);if(_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x3c')]){_0x1df619['where']=_[_0x1b6c('0x3d')](_0x1df619['where'],{'$or':_[_0x1b6c('0x2c')](_0x7577a7,function(_0x12990e){if(_0x12990e['type']!=='VIRTUAL'){var _0x11accc={};_0x11accc[_0x12990e['name']]={'$like':'%'+_0x2d1037[_0x1b6c('0x30')][_0x1b6c('0x3c')]+'%'};return _0x11accc;}})});}_0x1df619=_[_0x1b6c('0x3d')]({},_0x1df619,_0x2d1037['options']);var _0x1bb7cc={'where':_0x1df619[_0x1b6c('0x3b')]};return db[_0x1b6c('0x2d')][_0x1b6c('0x1e')](_0x1bb7cc)[_0x1b6c('0x26')](function(_0x1ef703){_0x217118['count']=_0x1ef703;if(_0x2d1037[_0x1b6c('0x30')]['includeAll']){_0x1df619[_0x1b6c('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0x1b6c('0x3f')](_0x1df619);})[_0x1b6c('0x26')](function(_0x48491a){_0x217118[_0x1b6c('0x40')]=_0x48491a;return _0x217118;})['then'](respondWithFilteredResult(_0x227a1c,_0x1df619))[_0x1b6c('0x41')](handleError(_0x227a1c,null));};exports['show']=function(_0x305a28,_0xca649b){var _0x4e08d0={'raw':!![],'where':{'id':_0x305a28[_0x1b6c('0x42')]['id']}},_0x5382bf={};_0x5382bf[_0x1b6c('0x2f')]=_[_0x1b6c('0x43')](db[_0x1b6c('0x2d')]['rawAttributes']);_0x5382bf[_0x1b6c('0x30')]=_[_0x1b6c('0x43')](_0x305a28[_0x1b6c('0x30')]);_0x5382bf[_0x1b6c('0x31')]=_[_0x1b6c('0x32')](_0x5382bf[_0x1b6c('0x2f')],_0x5382bf[_0x1b6c('0x30')]);_0x4e08d0[_0x1b6c('0x33')]=_[_0x1b6c('0x32')](_0x5382bf[_0x1b6c('0x2f')],qs['fields'](_0x305a28[_0x1b6c('0x30')][_0x1b6c('0x34')]));_0x4e08d0[_0x1b6c('0x33')]=_0x4e08d0[_0x1b6c('0x33')][_0x1b6c('0x35')]?_0x4e08d0['attributes']:_0x5382bf[_0x1b6c('0x2f')];if(_0x305a28[_0x1b6c('0x30')]['includeAll']){_0x4e08d0[_0x1b6c('0x3e')]=[{'all':!![]}];}_0x4e08d0=_[_0x1b6c('0x3d')]({},_0x4e08d0,_0x305a28[_0x1b6c('0x44')]);return db['CloudProvider'][_0x1b6c('0x45')](_0x4e08d0)[_0x1b6c('0x26')](handleEntityNotFound(_0xca649b,null))[_0x1b6c('0x26')](respondWithResult(_0xca649b,null))[_0x1b6c('0x41')](handleError(_0xca649b,null));};exports[_0x1b6c('0x46')]=function(_0x9e416d,_0x2ba9fb){return db[_0x1b6c('0x2d')][_0x1b6c('0x46')](_0x9e416d[_0x1b6c('0x47')],{})[_0x1b6c('0x26')](respondWithResult(_0x2ba9fb,0xc9))[_0x1b6c('0x41')](handleError(_0x2ba9fb,null));};exports[_0x1b6c('0x25')]=function(_0x58020d,_0x2f6962){if(_0x58020d['body']['id']){delete _0x58020d[_0x1b6c('0x47')]['id'];}return db['CloudProvider'][_0x1b6c('0x45')]({'where':{'id':_0x58020d[_0x1b6c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f6962,null))[_0x1b6c('0x26')](saveUpdates(_0x58020d[_0x1b6c('0x47')],null))['then'](respondWithResult(_0x2f6962,null))[_0x1b6c('0x41')](handleError(_0x2f6962,null));};exports[_0x1b6c('0x27')]=function(_0x44c0c4,_0x414853){return db[_0x1b6c('0x2d')]['find']({'where':{'id':_0x44c0c4['params']['id']}})[_0x1b6c('0x26')](handleEntityNotFound(_0x414853,null))[_0x1b6c('0x26')](removeEntity(_0x414853,null))[_0x1b6c('0x41')](handleError(_0x414853,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 21bcdea..8a037e6 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 _0xbc19=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','moment','bluebird','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbc19,0x7f));var _0x9bc1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbc19[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x9bc1('0x0'));var util=require(_0x9bc1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9bc1('0x2'));var BPromise=require(_0x9bc1('0x3'));var rp=require(_0x9bc1('0x4'));var fs=require('fs');var path=require(_0x9bc1('0x5'));var rimraf=require(_0x9bc1('0x6'));var config=require(_0x9bc1('0x7'));var attributes=require(_0x9bc1('0x8'));module[_0x9bc1('0x9')]=function(_0xa3713d,_0x43e59c){return _0xa3713d[_0x9bc1('0xa')]('CloudProvider',attributes,{'tableName':_0x9bc1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x100d=['cloud_providers','lodash','util','api','bluebird','path','rimraf','../../config/environment','define'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x100d,0x17b));var _0xd100=function(_0x54683e,_0x1d3ed0){_0x54683e=_0x54683e-0x0;var _0x42517e=_0x100d[_0x54683e];return _0x42517e;};'use strict';var _=require(_0xd100('0x0'));var util=require(_0xd100('0x1'));var logger=require('../../config/logger')(_0xd100('0x2'));var moment=require('moment');var BPromise=require(_0xd100('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd100('0x4'));var rimraf=require(_0xd100('0x5'));var config=require(_0xd100('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x46076b,_0x293879){return _0x46076b[_0xd100('0x7')]('CloudProvider',attributes,{'tableName':_0xd100('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 3bdf4e6..601dd72 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 _0xfde3=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x319d14,_0x370013){var _0x3ff3b3=function(_0x1dd259){while(--_0x1dd259){_0x319d14['push'](_0x319d14['shift']());}};_0x3ff3b3(++_0x370013);}(_0xfde3,0x13b));var _0x3fde=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfde3[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x3fde('0x0'));var util=require(_0x3fde('0x1'));var moment=require(_0x3fde('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fde('0x3'));var fs=require('fs');var Redis=require(_0x3fde('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fde('0x5'));var logger=require('../../config/logger')(_0x3fde('0x6'));var config=require(_0x3fde('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3fde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e19ed,_0x3050a5,_0x594210){return new BPromise(function(_0x520a1e,_0xb823f){return client[_0x3fde('0x9')](_0x2e19ed,_0x594210)[_0x3fde('0xa')](function(_0x4ac77f){logger['info'](_0x3fde('0xb'),_0x3050a5,_0x3fde('0xc'));logger[_0x3fde('0xd')](_0x3fde('0xe'),_0x3050a5,'request\x20sent',JSON[_0x3fde('0xf')](_0x4ac77f));if(_0x4ac77f[_0x3fde('0x10')]){if(_0x4ac77f[_0x3fde('0x10')][_0x3fde('0x11')]===0x1f4){logger['error'](_0x3fde('0xb'),_0x3050a5,_0x4ac77f[_0x3fde('0x10')][_0x3fde('0x12')]);return _0xb823f(_0x4ac77f['error'][_0x3fde('0x12')]);}logger[_0x3fde('0x10')](_0x3fde('0xb'),_0x3050a5,_0x4ac77f[_0x3fde('0x10')][_0x3fde('0x12')]);return _0x520a1e(_0x4ac77f['error']['message']);}else{logger['info'](_0x3fde('0xb'),_0x3050a5,_0x3fde('0xc'));_0x520a1e(_0x4ac77f[_0x3fde('0x13')][_0x3fde('0x12')]);}})[_0x3fde('0x14')](function(_0x5b04f4){logger[_0x3fde('0x10')](_0x3fde('0xb'),_0x3050a5,_0x5b04f4);_0xb823f(_0x5b04f4);});});} \ No newline at end of file +var _0xbff4=['http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1ccbec,_0x54e26c){var _0x5346c6=function(_0xc65ff6){while(--_0xc65ff6){_0x1ccbec['push'](_0x1ccbec['shift']());}};_0x5346c6(++_0x54e26c);}(_0xbff4,0x15e));var _0x4bff=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0xbff4[_0x2d4065];return _0xef6016;};'use strict';var _=require(_0x4bff('0x0'));var util=require(_0x4bff('0x1'));var moment=require(_0x4bff('0x2'));var BPromise=require(_0x4bff('0x3'));var rs=require(_0x4bff('0x4'));var fs=require('fs');var Redis=require(_0x4bff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4bff('0x6'));var logger=require(_0x4bff('0x7'))(_0x4bff('0x8'));var config=require('../../config/environment');var jayson=require(_0x4bff('0x9'));var client=jayson['client'][_0x4bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c09bf,_0x258b61,_0x2994da){return new BPromise(function(_0x48fbc8,_0x54c553){return client[_0x4bff('0xb')](_0x5c09bf,_0x2994da)[_0x4bff('0xc')](function(_0x5efa0f){logger[_0x4bff('0xd')](_0x4bff('0xe'),_0x258b61,'request\x20sent');logger[_0x4bff('0xf')](_0x4bff('0x10'),_0x258b61,_0x4bff('0x11'),JSON[_0x4bff('0x12')](_0x5efa0f));if(_0x5efa0f[_0x4bff('0x13')]){if(_0x5efa0f[_0x4bff('0x13')][_0x4bff('0x14')]===0x1f4){logger['error'](_0x4bff('0xe'),_0x258b61,_0x5efa0f[_0x4bff('0x13')][_0x4bff('0x15')]);return _0x54c553(_0x5efa0f['error'][_0x4bff('0x15')]);}logger[_0x4bff('0x13')](_0x4bff('0xe'),_0x258b61,_0x5efa0f['error'][_0x4bff('0x15')]);return _0x48fbc8(_0x5efa0f['error'][_0x4bff('0x15')]);}else{logger[_0x4bff('0xd')](_0x4bff('0xe'),_0x258b61,_0x4bff('0x11'));_0x48fbc8(_0x5efa0f[_0x4bff('0x16')][_0x4bff('0x15')]);}})[_0x4bff('0x17')](function(_0x54c8d4){logger[_0x4bff('0x13')](_0x4bff('0xe'),_0x258b61,_0x54c8d4);_0x54c553(_0x54c8d4);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index be754fa..5d78d52 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 _0x5e01=['post','create','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x5e01,0xe9));var _0x15e0=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x5e01[_0xc8db6b];return _0x12cb81;};'use strict';var multer=require(_0x15e0('0x0'));var util=require('util');var path=require(_0x15e0('0x1'));var timeout=require(_0x15e0('0x2'));var express=require(_0x15e0('0x3'));var router=express[_0x15e0('0x4')]();var auth=require(_0x15e0('0x5'));var interaction=require(_0x15e0('0x6'));var config=require(_0x15e0('0x7'));var controller=require(_0x15e0('0x8'));router[_0x15e0('0x9')]('/',auth[_0x15e0('0xa')](),controller[_0x15e0('0xb')]);router[_0x15e0('0x9')](_0x15e0('0xc'),auth[_0x15e0('0xa')](),controller[_0x15e0('0xd')]);router[_0x15e0('0xe')]('/',auth['isAuthenticated'](),controller[_0x15e0('0xf')]);router['put'](_0x15e0('0xc'),auth[_0x15e0('0xa')](),controller[_0x15e0('0x10')]);router['delete'](_0x15e0('0xc'),auth['isAuthenticated'](),controller[_0x15e0('0x11')]);module[_0x15e0('0x12')]=router; \ No newline at end of file +var _0x2d5c=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x4a256b,_0x43fbf9){var _0x13cbfd=function(_0x39a336){while(--_0x39a336){_0x4a256b['push'](_0x4a256b['shift']());}};_0x13cbfd(++_0x43fbf9);}(_0x2d5c,0x13b));var _0xc2d5=function(_0x399933,_0x30f759){_0x399933=_0x399933-0x0;var _0x31819b=_0x2d5c[_0x399933];return _0x31819b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc2d5('0x0'));var express=require('express');var router=express[_0xc2d5('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xc2d5('0x2'));var config=require(_0xc2d5('0x3'));var controller=require(_0xc2d5('0x4'));router[_0xc2d5('0x5')]('/',auth[_0xc2d5('0x6')](),controller[_0xc2d5('0x7')]);router[_0xc2d5('0x5')](_0xc2d5('0x8'),auth[_0xc2d5('0x6')](),controller['show']);router[_0xc2d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2d5('0xa')]);router[_0xc2d5('0xb')](_0xc2d5('0x8'),auth[_0xc2d5('0x6')](),controller[_0xc2d5('0xc')]);router[_0xc2d5('0xd')]('/:id',auth[_0xc2d5('0x6')](),controller[_0xc2d5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 843af4f..a1e3dee 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 _0x7970=['sequelize','exports','name','STRING'];(function(_0x373bb7,_0x51d65c){var _0x5ab49b=function(_0x186ff1){while(--_0x186ff1){_0x373bb7['push'](_0x373bb7['shift']());}};_0x5ab49b(++_0x51d65c);}(_0x7970,0x134));var _0x0797=function(_0x294c83,_0x48414a){_0x294c83=_0x294c83-0x0;var _0x7adc3b=_0x7970[_0x294c83];return _0x7adc3b;};'use strict';var Sequelize=require(_0x0797('0x0'));module[_0x0797('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0797('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0797('0x3')]},'companyId':{'type':Sequelize[_0x0797('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0797('0x3')]},'type':{'type':Sequelize[_0x0797('0x3')]},'street':{'type':Sequelize[_0x0797('0x3')]},'postalCode':{'type':Sequelize[_0x0797('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0797('0x3')]},'email':{'type':Sequelize[_0x0797('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x0797('0x3')]},'sPostalCode':{'type':Sequelize[_0x0797('0x3')]},'sCity':{'type':Sequelize[_0x0797('0x3')]},'sCountry':{'type':Sequelize[_0x0797('0x3')]},'description':{'type':Sequelize[_0x0797('0x3')]}}; \ No newline at end of file +var _0xfe6b=['STRING','name','exports'];(function(_0x277f36,_0xd758d1){var _0x2902c5=function(_0x22b4cb){while(--_0x22b4cb){_0x277f36['push'](_0x277f36['shift']());}};_0x2902c5(++_0xd758d1);}(_0xfe6b,0x179));var _0xbfe6=function(_0x5cb7a8,_0x269783){_0x5cb7a8=_0x5cb7a8-0x0;var _0x2a26df=_0xfe6b[_0x5cb7a8];return _0x2a26df;};'use strict';var Sequelize=require('sequelize');module[_0xbfe6('0x0')]={'name':{'type':Sequelize[_0xbfe6('0x1')],'unique':_0xbfe6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xbfe6('0x1')]},'website':{'type':Sequelize[_0xbfe6('0x1')]},'phone':{'type':Sequelize[_0xbfe6('0x1')]},'fax':{'type':Sequelize[_0xbfe6('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbfe6('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xbfe6('0x1')]},'country':{'type':Sequelize[_0xbfe6('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xbfe6('0x1')]},'sPostalCode':{'type':Sequelize[_0xbfe6('0x1')]},'sCity':{'type':Sequelize[_0xbfe6('0x1')]},'sCountry':{'type':Sequelize[_0xbfe6('0x1')]},'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 fb5961b..aada854 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 _0xb5cd=['stack','send','CmCompany','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','count','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','user','role','Companies','UserProfileSection','autoAssociation','name','params','addContacts','ids','omit','getContacts','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x326f1b,_0x47a0c9){var _0x5e9a3d=function(_0x1f6e63){while(--_0x1f6e63){_0x326f1b['push'](_0x326f1b['shift']());}};_0x5e9a3d(++_0x47a0c9);}(_0xb5cd,0x7b));var _0xdb5c=function(_0x678675,_0x3c3872){_0x678675=_0x678675-0x0;var _0x334525=_0xb5cd[_0x678675];return _0x334525;};'use strict';var pdf=require(_0xdb5c('0x0'));var emlformat=require(_0xdb5c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdb5c('0x2'));var jsonpatch=require(_0xdb5c('0x3'));var rp=require(_0xdb5c('0x4'));var moment=require(_0xdb5c('0x5'));var BPromise=require(_0xdb5c('0x6'));var Mustache=require('mustache');var util=require(_0xdb5c('0x7'));var path=require(_0xdb5c('0x8'));var sox=require(_0xdb5c('0x9'));var csv=require(_0xdb5c('0xa'));var ejs=require(_0xdb5c('0xb'));var fs=require('fs');var _=require(_0xdb5c('0xc'));var squel=require(_0xdb5c('0xd'));var crypto=require(_0xdb5c('0xe'));var jsforce=require(_0xdb5c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb5c('0x10'));var Papa=require(_0xdb5c('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb5c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb5c('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb5c('0x14'));var db=require(_0xdb5c('0x15'))['db'];function respondWithStatusCode(_0x36539a,_0x3a20cf){_0x3a20cf=_0x3a20cf||0xcc;return function(_0x1d558e){if(_0x1d558e){return _0x36539a[_0xdb5c('0x16')](_0x3a20cf);}return _0x36539a[_0xdb5c('0x17')](_0x3a20cf)[_0xdb5c('0x18')]();};}function respondWithResult(_0x1b4ea9,_0x344e1d){_0x344e1d=_0x344e1d||0xc8;return function(_0x5e584e){if(_0x5e584e){return _0x1b4ea9[_0xdb5c('0x17')](_0x344e1d)[_0xdb5c('0x19')](_0x5e584e);}};}function respondWithFilteredResult(_0xcba7c7,_0x4a966b){return function(_0x1b2448){if(_0x1b2448){var _0x51feda=_0x1b2448['count'],_0x2a8291=_0x4a966b[_0xdb5c('0x1a')],_0xb92f6d=_0x4a966b[_0xdb5c('0x1a')]+_0x4a966b[_0xdb5c('0x1b')],_0x2ef0ef;if(_0xb92f6d>=_0x51feda){_0xb92f6d=_0x51feda;_0x2ef0ef=0xc8;}else{_0x2ef0ef=0xce;}_0xcba7c7[_0xdb5c('0x17')](_0x2ef0ef);return _0xcba7c7[_0xdb5c('0x1c')](_0xdb5c('0x1d'),_0x2a8291+'-'+_0xb92f6d+'/'+_0x51feda)[_0xdb5c('0x19')](_0x1b2448);}return null;};}function patchUpdates(_0x50b9ae){return function(_0x4fffc8){try{jsonpatch[_0xdb5c('0x1e')](_0x4fffc8,_0x50b9ae,!![]);}catch(_0x316719){return BPromise[_0xdb5c('0x1f')](_0x316719);}return _0x4fffc8[_0xdb5c('0x20')]();};}function saveUpdates(_0x234ce4,_0x48c939){return function(_0x2a5b3e){if(_0x2a5b3e){return _0x2a5b3e[_0xdb5c('0x21')](_0x234ce4)[_0xdb5c('0x22')](function(_0x215919){return _0x215919;});}return null;};}function removeEntity(_0x3c543d,_0x28f994){return function(_0x2e4a4f){if(_0x2e4a4f){return _0x2e4a4f[_0xdb5c('0x23')]()[_0xdb5c('0x22')](function(){var _0x1a7c0d=_0x2e4a4f[_0xdb5c('0x24')]({'plain':!![]});var _0x11be3c='Companies';return db[_0xdb5c('0x25')]['destroy']({'where':{'type':_0x11be3c,'resourceId':_0x1a7c0d['id']}})['then'](function(){return _0x2e4a4f;});})[_0xdb5c('0x22')](function(){_0x3c543d[_0xdb5c('0x17')](0xcc)[_0xdb5c('0x18')]();});}};}function handleEntityNotFound(_0x5f128e,_0x5d66bb){return function(_0x3aa1eb){if(!_0x3aa1eb){_0x5f128e[_0xdb5c('0x16')](0x194);}return _0x3aa1eb;};}function handleError(_0x3e5cba,_0x8cd861){_0x8cd861=_0x8cd861||0x1f4;return function(_0x2beb1f){logger[_0xdb5c('0x26')](_0x2beb1f[_0xdb5c('0x27')]);if(_0x2beb1f['name']){delete _0x2beb1f['name'];}_0x3e5cba['status'](_0x8cd861)[_0xdb5c('0x28')](_0x2beb1f);};}exports['index']=function(_0x1e00a3,_0x2d4865){var _0x2ead7f={},_0xf33b5a={},_0x51c170={'count':0x0,'rows':[]};return db[_0xdb5c('0x29')]['describe']()[_0xdb5c('0x22')](function(_0x203ff1){_0xf33b5a[_0xdb5c('0x2a')]=_['keys'](_0x203ff1);_0xf33b5a[_0xdb5c('0x2b')]=_[_0xdb5c('0x2c')](_0x1e00a3[_0xdb5c('0x2b')]);_0xf33b5a[_0xdb5c('0x2d')]=_[_0xdb5c('0x2e')](_0xf33b5a[_0xdb5c('0x2a')],_0xf33b5a[_0xdb5c('0x2b')]);_0x2ead7f['attributes']=_[_0xdb5c('0x2e')](_0xf33b5a[_0xdb5c('0x2a')],qs[_0xdb5c('0x2f')](_0x1e00a3[_0xdb5c('0x2b')][_0xdb5c('0x2f')]));_0x2ead7f[_0xdb5c('0x30')]=_0x2ead7f[_0xdb5c('0x30')][_0xdb5c('0x31')]?_0x2ead7f['attributes']:_0xf33b5a[_0xdb5c('0x2a')];if(!_0x1e00a3['query'][_0xdb5c('0x32')](_0xdb5c('0x33'))){_0x2ead7f[_0xdb5c('0x1b')]=qs[_0xdb5c('0x1b')](_0x1e00a3[_0xdb5c('0x2b')][_0xdb5c('0x1b')]);_0x2ead7f[_0xdb5c('0x1a')]=qs[_0xdb5c('0x1a')](_0x1e00a3[_0xdb5c('0x2b')][_0xdb5c('0x1a')]);}_0x2ead7f[_0xdb5c('0x34')]=qs[_0xdb5c('0x35')](_0x1e00a3[_0xdb5c('0x2b')][_0xdb5c('0x35')]);_0x2ead7f['where']=qs[_0xdb5c('0x2d')](_[_0xdb5c('0x36')](_0x1e00a3[_0xdb5c('0x2b')],_0xf33b5a[_0xdb5c('0x2d')]),_0x203ff1);if(_0x1e00a3[_0xdb5c('0x2b')]['filter']){_0x2ead7f['where']=_[_0xdb5c('0x37')](_0x2ead7f[_0xdb5c('0x38')],{'$or':_[_0xdb5c('0x39')](_0x2ead7f[_0xdb5c('0x30')],function(_0x193cdb){var _0x51b1b6={};_0x51b1b6[_0x193cdb]={'$like':'%'+_0x1e00a3['query']['filter']+'%'};return _0x51b1b6;})});}_0x2ead7f=_[_0xdb5c('0x37')]({},_0x2ead7f,_0x1e00a3['options']);var _0x4d57f4={'where':_0x2ead7f[_0xdb5c('0x38')]};return db[_0xdb5c('0x29')]['count'](_0x4d57f4)[_0xdb5c('0x22')](function(_0x57f374){_0x51c170[_0xdb5c('0x3a')]=_0x57f374;if(_0x1e00a3[_0xdb5c('0x2b')][_0xdb5c('0x3b')]){_0x2ead7f[_0xdb5c('0x3c')]=[{'all':!![]}];}return db[_0xdb5c('0x29')][_0xdb5c('0x3d')](_0x2ead7f);})[_0xdb5c('0x22')](function(_0x459682){_0x51c170['rows']=_0x459682;return _0x51c170;})['then'](respondWithFilteredResult(_0x2d4865,_0x2ead7f))[_0xdb5c('0x3e')](handleError(_0x2d4865,null));})['catch'](handleError(_0x2d4865,null));};exports[_0xdb5c('0x3f')]=function(_0x265278,_0x2ad4a5){var _0x1b574f={'raw':![],'where':{'id':_0x265278['params']['id']}},_0x942019={};_0x942019[_0xdb5c('0x2a')]=_[_0xdb5c('0x2c')](db['CmCompany'][_0xdb5c('0x40')]);_0x942019['query']=_[_0xdb5c('0x2c')](_0x265278[_0xdb5c('0x2b')]);_0x942019[_0xdb5c('0x2d')]=_[_0xdb5c('0x2e')](_0x942019[_0xdb5c('0x2a')],_0x942019[_0xdb5c('0x2b')]);_0x1b574f[_0xdb5c('0x30')]=_[_0xdb5c('0x2e')](_0x942019['model'],qs[_0xdb5c('0x2f')](_0x265278['query'][_0xdb5c('0x2f')]));_0x1b574f['attributes']=_0x1b574f['attributes']['length']?_0x1b574f['attributes']:_0x942019[_0xdb5c('0x2a')];if(_0x265278['query'][_0xdb5c('0x3b')]){_0x1b574f[_0xdb5c('0x3c')]=[{'all':!![]}];}_0x1b574f=_[_0xdb5c('0x37')]({},_0x1b574f,_0x265278[_0xdb5c('0x41')]);return db[_0xdb5c('0x29')][_0xdb5c('0x42')](_0x1b574f)[_0xdb5c('0x22')](handleEntityNotFound(_0x2ad4a5,null))[_0xdb5c('0x22')](respondWithResult(_0x2ad4a5,null))[_0xdb5c('0x3e')](handleError(_0x2ad4a5,null));};exports[_0xdb5c('0x43')]=function(_0x437f41,_0x5ddb08){return db[_0xdb5c('0x29')][_0xdb5c('0x43')](_0x437f41[_0xdb5c('0x44')],{})['then'](function(_0x5f700b){var _0x263bac=_0x437f41[_0xdb5c('0x45')][_0xdb5c('0x24')]({'plain':!![]});if(!_0x263bac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x263bac[_0xdb5c('0x46')]==='user'){var _0xff5ef=_0x5f700b[_0xdb5c('0x24')]({'plain':!![]});var _0x4f0784=_0xdb5c('0x47');return db[_0xdb5c('0x48')][_0xdb5c('0x42')]({'where':{'name':_0x4f0784,'userProfileId':_0x263bac['userProfileId']},'raw':!![]})['then'](function(_0x13b5f7){if(_0x13b5f7&&_0x13b5f7[_0xdb5c('0x49')]===0x0){return db[_0xdb5c('0x25')]['create']({'name':_0xff5ef[_0xdb5c('0x4a')],'resourceId':_0xff5ef['id'],'type':_0x13b5f7[_0xdb5c('0x4a')],'sectionId':_0x13b5f7['id']},{})[_0xdb5c('0x22')](function(){return _0x5f700b;});}else{return _0x5f700b;}})[_0xdb5c('0x3e')](function(_0x2908dd){logger[_0xdb5c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2908dd);throw _0x2908dd;});}return _0x5f700b;})['then'](respondWithResult(_0x5ddb08,0xc9))[_0xdb5c('0x3e')](handleError(_0x5ddb08,null));};exports[_0xdb5c('0x21')]=function(_0x264e76,_0x4e325e){if(_0x264e76[_0xdb5c('0x44')]['id']){delete _0x264e76['body']['id'];}return db[_0xdb5c('0x29')][_0xdb5c('0x42')]({'where':{'id':_0x264e76[_0xdb5c('0x4b')]['id']}})[_0xdb5c('0x22')](handleEntityNotFound(_0x4e325e,null))['then'](saveUpdates(_0x264e76[_0xdb5c('0x44')],null))['then'](respondWithResult(_0x4e325e,null))[_0xdb5c('0x3e')](handleError(_0x4e325e,null));};exports[_0xdb5c('0x23')]=function(_0x4cccc7,_0x1c6230){return db[_0xdb5c('0x29')][_0xdb5c('0x42')]({'where':{'id':_0x4cccc7[_0xdb5c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c6230,null))[_0xdb5c('0x22')](removeEntity(_0x1c6230,null))['catch'](handleError(_0x1c6230,null));};exports['describe']=function(_0x1374d6,_0x33c48c){return db[_0xdb5c('0x29')]['describe']()[_0xdb5c('0x22')](respondWithResult(_0x33c48c,null))[_0xdb5c('0x3e')](handleError(_0x33c48c,null));};exports[_0xdb5c('0x4c')]=function(_0x3677e1,_0x527f7f,_0x19d676){return db['CmContact'][_0xdb5c('0x42')]({'where':{'id':_0x3677e1[_0xdb5c('0x4b')]['id']}})[_0xdb5c('0x22')](handleEntityNotFound(_0x527f7f,null))[_0xdb5c('0x22')](function(_0x2ec268){if(_0x2ec268){return _0x2ec268[_0xdb5c('0x4c')](_0x3677e1[_0xdb5c('0x44')][_0xdb5c('0x4d')],_[_0xdb5c('0x4e')](_0x3677e1[_0xdb5c('0x44')],[_0xdb5c('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x527f7f,null))['catch'](handleError(_0x527f7f,null));};exports[_0xdb5c('0x4f')]=function(_0x576c95,_0x41139f,_0x25e2f6){var _0x979ac1={};var _0x37d300={};var _0x208723;var _0x22dd48;return db[_0xdb5c('0x29')]['findOne']({'where':{'id':_0x576c95[_0xdb5c('0x4b')]['id']}})[_0xdb5c('0x22')](handleEntityNotFound(_0x41139f,null))[_0xdb5c('0x22')](function(_0x411326){if(_0x411326){_0x208723=_0x411326;_0x37d300[_0xdb5c('0x2a')]=_[_0xdb5c('0x2c')](db['CmContact']['rawAttributes']);_0x37d300['query']=_[_0xdb5c('0x2c')](_0x576c95[_0xdb5c('0x2b')]);_0x37d300[_0xdb5c('0x2d')]=_[_0xdb5c('0x2e')](_0x37d300[_0xdb5c('0x2a')],_0x37d300[_0xdb5c('0x2b')]);_0x979ac1[_0xdb5c('0x30')]=_['intersection'](_0x37d300[_0xdb5c('0x2a')],qs[_0xdb5c('0x2f')](_0x576c95[_0xdb5c('0x2b')][_0xdb5c('0x2f')]));_0x979ac1['attributes']=_0x979ac1['attributes'][_0xdb5c('0x31')]?_0x979ac1[_0xdb5c('0x30')]:_0x37d300['model'];_0x979ac1[_0xdb5c('0x34')]=qs['sort'](_0x576c95[_0xdb5c('0x2b')]['sort']);_0x979ac1['where']=qs[_0xdb5c('0x2d')](_[_0xdb5c('0x36')](_0x576c95[_0xdb5c('0x2b')],_0x37d300[_0xdb5c('0x2d')]));if(_0x576c95[_0xdb5c('0x2b')][_0xdb5c('0x50')]){_0x979ac1[_0xdb5c('0x38')]=_[_0xdb5c('0x37')](_0x979ac1[_0xdb5c('0x38')],{'$or':_[_0xdb5c('0x39')](_0x979ac1[_0xdb5c('0x30')],function(_0x2c6925){var _0x2c5dc3={};_0x2c5dc3[_0x2c6925]={'$like':'%'+_0x576c95[_0xdb5c('0x2b')]['filter']+'%'};return _0x2c5dc3;})});}_0x979ac1=_['merge']({},_0x979ac1,_0x576c95[_0xdb5c('0x41')]);return _0x208723[_0xdb5c('0x4f')](_0x979ac1);}})[_0xdb5c('0x22')](function(_0xdedf97){if(_0xdedf97){_0x22dd48=_0xdedf97[_0xdb5c('0x31')];if(!_0x576c95[_0xdb5c('0x2b')][_0xdb5c('0x32')](_0xdb5c('0x33'))){_0x979ac1[_0xdb5c('0x1b')]=qs['limit'](_0x576c95[_0xdb5c('0x2b')]['limit']);_0x979ac1['offset']=qs[_0xdb5c('0x1a')](_0x576c95[_0xdb5c('0x2b')][_0xdb5c('0x1a')]);}return _0x208723['getContacts'](_0x979ac1);}})['then'](function(_0x5a460c){if(_0x5a460c){return _0x5a460c?{'count':_0x22dd48,'rows':_0x5a460c}:null;}})[_0xdb5c('0x22')](respondWithResult(_0x41139f,null))['catch'](handleError(_0x41139f,null));}; \ No newline at end of file +var _0xb5e1=['length','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','CmCompany','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','findOne','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xb5e1,0xc5));var _0x1b5e=function(_0x2a8483,_0x41009a){_0x2a8483=_0x2a8483-0x0;var _0x54880f=_0xb5e1[_0x2a8483];return _0x54880f;};'use strict';var pdf=require(_0x1b5e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b5e('0x1'));var jsonpatch=require(_0x1b5e('0x2'));var rp=require(_0x1b5e('0x3'));var moment=require('moment');var BPromise=require(_0x1b5e('0x4'));var Mustache=require(_0x1b5e('0x5'));var util=require(_0x1b5e('0x6'));var path=require(_0x1b5e('0x7'));var sox=require(_0x1b5e('0x8'));var csv=require(_0x1b5e('0x9'));var ejs=require(_0x1b5e('0xa'));var fs=require('fs');var _=require(_0x1b5e('0xb'));var squel=require(_0x1b5e('0xc'));var crypto=require(_0x1b5e('0xd'));var jsforce=require(_0x1b5e('0xe'));var deskjs=require(_0x1b5e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b5e('0x10'));var authService=require(_0x1b5e('0x11'));var qs=require(_0x1b5e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b5e('0x13'));var logger=require(_0x1b5e('0x14'))(_0x1b5e('0x15'));var utils=require(_0x1b5e('0x16'));var config=require(_0x1b5e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x101857,_0x3b500e){_0x3b500e=_0x3b500e||0xcc;return function(_0x26e4c6){if(_0x26e4c6){return _0x101857[_0x1b5e('0x18')](_0x3b500e);}return _0x101857['status'](_0x3b500e)[_0x1b5e('0x19')]();};}function respondWithResult(_0x3cd7f1,_0x3413b1){_0x3413b1=_0x3413b1||0xc8;return function(_0x57cef5){if(_0x57cef5){return _0x3cd7f1[_0x1b5e('0x1a')](_0x3413b1)[_0x1b5e('0x1b')](_0x57cef5);}};}function respondWithFilteredResult(_0x5a1524,_0x228ce5){return function(_0x558451){if(_0x558451){var _0x105780=_0x558451[_0x1b5e('0x1c')],_0x2000c8=_0x228ce5[_0x1b5e('0x1d')],_0x5c6e61=_0x228ce5[_0x1b5e('0x1d')]+_0x228ce5[_0x1b5e('0x1e')],_0x4887dd;if(_0x5c6e61>=_0x105780){_0x5c6e61=_0x105780;_0x4887dd=0xc8;}else{_0x4887dd=0xce;}_0x5a1524[_0x1b5e('0x1a')](_0x4887dd);return _0x5a1524[_0x1b5e('0x1f')]('Content-Range',_0x2000c8+'-'+_0x5c6e61+'/'+_0x105780)[_0x1b5e('0x1b')](_0x558451);}return null;};}function patchUpdates(_0x538d23){return function(_0x3e8b9c){try{jsonpatch[_0x1b5e('0x20')](_0x3e8b9c,_0x538d23,!![]);}catch(_0x40b07a){return BPromise['reject'](_0x40b07a);}return _0x3e8b9c[_0x1b5e('0x21')]();};}function saveUpdates(_0x173ac8,_0x474e3a){return function(_0x32905e){if(_0x32905e){return _0x32905e['update'](_0x173ac8)[_0x1b5e('0x22')](function(_0x3c64f2){return _0x3c64f2;});}return null;};}function removeEntity(_0x345aca,_0x36973e){return function(_0xf7a9f3){if(_0xf7a9f3){return _0xf7a9f3[_0x1b5e('0x23')]()[_0x1b5e('0x22')](function(){var _0x2ba114=_0xf7a9f3[_0x1b5e('0x24')]({'plain':!![]});var _0x5a19a2=_0x1b5e('0x25');return db[_0x1b5e('0x26')][_0x1b5e('0x23')]({'where':{'type':_0x5a19a2,'resourceId':_0x2ba114['id']}})[_0x1b5e('0x22')](function(){return _0xf7a9f3;});})[_0x1b5e('0x22')](function(){_0x345aca[_0x1b5e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43da9f,_0x57913c){return function(_0x4304cd){if(!_0x4304cd){_0x43da9f['sendStatus'](0x194);}return _0x4304cd;};}function handleError(_0x25d980,_0x45105c){_0x45105c=_0x45105c||0x1f4;return function(_0x1a7670){logger[_0x1b5e('0x27')](_0x1a7670[_0x1b5e('0x28')]);if(_0x1a7670['name']){delete _0x1a7670[_0x1b5e('0x29')];}_0x25d980[_0x1b5e('0x1a')](_0x45105c)[_0x1b5e('0x2a')](_0x1a7670);};}exports[_0x1b5e('0x2b')]=function(_0x1774ca,_0x20f802){var _0x11cae4={},_0x816857={},_0x521e20={'count':0x0,'rows':[]};return db['CmCompany'][_0x1b5e('0x2c')]()['then'](function(_0x462fd0){_0x816857[_0x1b5e('0x2d')]=_[_0x1b5e('0x2e')](_0x462fd0);_0x816857[_0x1b5e('0x2f')]=_[_0x1b5e('0x2e')](_0x1774ca[_0x1b5e('0x2f')]);_0x816857[_0x1b5e('0x30')]=_[_0x1b5e('0x31')](_0x816857[_0x1b5e('0x2d')],_0x816857[_0x1b5e('0x2f')]);_0x11cae4[_0x1b5e('0x32')]=_[_0x1b5e('0x31')](_0x816857['model'],qs[_0x1b5e('0x33')](_0x1774ca[_0x1b5e('0x2f')][_0x1b5e('0x33')]));_0x11cae4['attributes']=_0x11cae4[_0x1b5e('0x32')][_0x1b5e('0x34')]?_0x11cae4[_0x1b5e('0x32')]:_0x816857[_0x1b5e('0x2d')];if(!_0x1774ca[_0x1b5e('0x2f')][_0x1b5e('0x35')](_0x1b5e('0x36'))){_0x11cae4['limit']=qs[_0x1b5e('0x1e')](_0x1774ca['query']['limit']);_0x11cae4[_0x1b5e('0x1d')]=qs[_0x1b5e('0x1d')](_0x1774ca[_0x1b5e('0x2f')][_0x1b5e('0x1d')]);}_0x11cae4[_0x1b5e('0x37')]=qs[_0x1b5e('0x38')](_0x1774ca[_0x1b5e('0x2f')][_0x1b5e('0x38')]);_0x11cae4['where']=qs[_0x1b5e('0x30')](_['pick'](_0x1774ca[_0x1b5e('0x2f')],_0x816857[_0x1b5e('0x30')]),_0x462fd0);if(_0x1774ca[_0x1b5e('0x2f')]['filter']){_0x11cae4[_0x1b5e('0x39')]=_[_0x1b5e('0x3a')](_0x11cae4['where'],{'$or':_[_0x1b5e('0x3b')](_0x11cae4[_0x1b5e('0x32')],function(_0x10975){var _0x570402={};_0x570402[_0x10975]={'$like':'%'+_0x1774ca[_0x1b5e('0x2f')][_0x1b5e('0x3c')]+'%'};return _0x570402;})});}_0x11cae4=_[_0x1b5e('0x3a')]({},_0x11cae4,_0x1774ca['options']);var _0x4113d5={'where':_0x11cae4[_0x1b5e('0x39')]};return db[_0x1b5e('0x3d')]['count'](_0x4113d5)[_0x1b5e('0x22')](function(_0x1dddd0){_0x521e20[_0x1b5e('0x1c')]=_0x1dddd0;if(_0x1774ca[_0x1b5e('0x2f')]['includeAll']){_0x11cae4[_0x1b5e('0x3e')]=[{'all':!![]}];}return db[_0x1b5e('0x3d')][_0x1b5e('0x3f')](_0x11cae4);})['then'](function(_0xabd991){_0x521e20['rows']=_0xabd991;return _0x521e20;})[_0x1b5e('0x22')](respondWithFilteredResult(_0x20f802,_0x11cae4))['catch'](handleError(_0x20f802,null));})[_0x1b5e('0x40')](handleError(_0x20f802,null));};exports[_0x1b5e('0x41')]=function(_0x3b33b6,_0x35fd50){var _0x2db7ec={'raw':![],'where':{'id':_0x3b33b6[_0x1b5e('0x42')]['id']}},_0x18fdb9={};_0x18fdb9[_0x1b5e('0x2d')]=_[_0x1b5e('0x2e')](db[_0x1b5e('0x3d')]['rawAttributes']);_0x18fdb9['query']=_[_0x1b5e('0x2e')](_0x3b33b6[_0x1b5e('0x2f')]);_0x18fdb9['filters']=_[_0x1b5e('0x31')](_0x18fdb9[_0x1b5e('0x2d')],_0x18fdb9[_0x1b5e('0x2f')]);_0x2db7ec['attributes']=_['intersection'](_0x18fdb9[_0x1b5e('0x2d')],qs[_0x1b5e('0x33')](_0x3b33b6[_0x1b5e('0x2f')][_0x1b5e('0x33')]));_0x2db7ec['attributes']=_0x2db7ec[_0x1b5e('0x32')][_0x1b5e('0x34')]?_0x2db7ec[_0x1b5e('0x32')]:_0x18fdb9[_0x1b5e('0x2d')];if(_0x3b33b6[_0x1b5e('0x2f')]['includeAll']){_0x2db7ec[_0x1b5e('0x3e')]=[{'all':!![]}];}_0x2db7ec=_[_0x1b5e('0x3a')]({},_0x2db7ec,_0x3b33b6[_0x1b5e('0x43')]);return db[_0x1b5e('0x3d')][_0x1b5e('0x44')](_0x2db7ec)['then'](handleEntityNotFound(_0x35fd50,null))[_0x1b5e('0x22')](respondWithResult(_0x35fd50,null))['catch'](handleError(_0x35fd50,null));};exports[_0x1b5e('0x45')]=function(_0x24c269,_0x48efc1){return db[_0x1b5e('0x3d')][_0x1b5e('0x45')](_0x24c269[_0x1b5e('0x46')],{})['then'](function(_0x374a9a){var _0x1d14e8=_0x24c269[_0x1b5e('0x47')]['get']({'plain':!![]});if(!_0x1d14e8)throw new Error(_0x1b5e('0x48'));if(_0x1d14e8['role']===_0x1b5e('0x47')){var _0x2e0603=_0x374a9a['get']({'plain':!![]});var _0x39b582=_0x1b5e('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x39b582,'userProfileId':_0x1d14e8[_0x1b5e('0x49')]},'raw':!![]})[_0x1b5e('0x22')](function(_0xa0acae){if(_0xa0acae&&_0xa0acae[_0x1b5e('0x4a')]===0x0){return db[_0x1b5e('0x26')][_0x1b5e('0x45')]({'name':_0x2e0603[_0x1b5e('0x29')],'resourceId':_0x2e0603['id'],'type':_0xa0acae[_0x1b5e('0x29')],'sectionId':_0xa0acae['id']},{})[_0x1b5e('0x22')](function(){return _0x374a9a;});}else{return _0x374a9a;}})[_0x1b5e('0x40')](function(_0x43f387){logger['error'](_0x1b5e('0x4b'),_0x43f387);throw _0x43f387;});}return _0x374a9a;})[_0x1b5e('0x22')](respondWithResult(_0x48efc1,0xc9))[_0x1b5e('0x40')](handleError(_0x48efc1,null));};exports[_0x1b5e('0x4c')]=function(_0x4c4d88,_0x38e2d1){if(_0x4c4d88[_0x1b5e('0x46')]['id']){delete _0x4c4d88[_0x1b5e('0x46')]['id'];}return db['CmCompany'][_0x1b5e('0x44')]({'where':{'id':_0x4c4d88[_0x1b5e('0x42')]['id']}})[_0x1b5e('0x22')](handleEntityNotFound(_0x38e2d1,null))[_0x1b5e('0x22')](saveUpdates(_0x4c4d88[_0x1b5e('0x46')],null))[_0x1b5e('0x22')](respondWithResult(_0x38e2d1,null))[_0x1b5e('0x40')](handleError(_0x38e2d1,null));};exports[_0x1b5e('0x23')]=function(_0x23e5ec,_0x5b193d){return db['CmCompany'][_0x1b5e('0x44')]({'where':{'id':_0x23e5ec['params']['id']}})['then'](handleEntityNotFound(_0x5b193d,null))[_0x1b5e('0x22')](removeEntity(_0x5b193d,null))[_0x1b5e('0x40')](handleError(_0x5b193d,null));};exports[_0x1b5e('0x2c')]=function(_0x5a0154,_0xf26505){return db['CmCompany'][_0x1b5e('0x2c')]()['then'](respondWithResult(_0xf26505,null))['catch'](handleError(_0xf26505,null));};exports[_0x1b5e('0x4d')]=function(_0x3862ac,_0x5a2107,_0x4c20c1){return db[_0x1b5e('0x4e')][_0x1b5e('0x44')]({'where':{'id':_0x3862ac[_0x1b5e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a2107,null))[_0x1b5e('0x22')](function(_0x2ee17e){if(_0x2ee17e){return _0x2ee17e[_0x1b5e('0x4d')](_0x3862ac[_0x1b5e('0x46')][_0x1b5e('0x4f')],_[_0x1b5e('0x50')](_0x3862ac[_0x1b5e('0x46')],[_0x1b5e('0x4f'),'id'])||{});}})[_0x1b5e('0x22')](respondWithResult(_0x5a2107,null))[_0x1b5e('0x40')](handleError(_0x5a2107,null));};exports[_0x1b5e('0x51')]=function(_0x191248,_0x17dc21,_0x20e44b){var _0x1702de={};var _0x2421b7={};var _0xae63c1;var _0x46512d;return db['CmCompany'][_0x1b5e('0x52')]({'where':{'id':_0x191248[_0x1b5e('0x42')]['id']}})['then'](handleEntityNotFound(_0x17dc21,null))['then'](function(_0x371833){if(_0x371833){_0xae63c1=_0x371833;_0x2421b7[_0x1b5e('0x2d')]=_['keys'](db[_0x1b5e('0x4e')]['rawAttributes']);_0x2421b7['query']=_['keys'](_0x191248['query']);_0x2421b7[_0x1b5e('0x30')]=_['intersection'](_0x2421b7[_0x1b5e('0x2d')],_0x2421b7[_0x1b5e('0x2f')]);_0x1702de['attributes']=_['intersection'](_0x2421b7[_0x1b5e('0x2d')],qs[_0x1b5e('0x33')](_0x191248[_0x1b5e('0x2f')][_0x1b5e('0x33')]));_0x1702de['attributes']=_0x1702de[_0x1b5e('0x32')][_0x1b5e('0x34')]?_0x1702de[_0x1b5e('0x32')]:_0x2421b7[_0x1b5e('0x2d')];_0x1702de[_0x1b5e('0x37')]=qs[_0x1b5e('0x38')](_0x191248['query'][_0x1b5e('0x38')]);_0x1702de[_0x1b5e('0x39')]=qs['filters'](_['pick'](_0x191248[_0x1b5e('0x2f')],_0x2421b7['filters']));if(_0x191248[_0x1b5e('0x2f')][_0x1b5e('0x3c')]){_0x1702de['where']=_['merge'](_0x1702de[_0x1b5e('0x39')],{'$or':_[_0x1b5e('0x3b')](_0x1702de[_0x1b5e('0x32')],function(_0x4d180d){var _0x19abee={};_0x19abee[_0x4d180d]={'$like':'%'+_0x191248[_0x1b5e('0x2f')]['filter']+'%'};return _0x19abee;})});}_0x1702de=_[_0x1b5e('0x3a')]({},_0x1702de,_0x191248['options']);return _0xae63c1[_0x1b5e('0x51')](_0x1702de);}})['then'](function(_0x15ecc5){if(_0x15ecc5){_0x46512d=_0x15ecc5[_0x1b5e('0x34')];if(!_0x191248[_0x1b5e('0x2f')][_0x1b5e('0x35')](_0x1b5e('0x36'))){_0x1702de[_0x1b5e('0x1e')]=qs[_0x1b5e('0x1e')](_0x191248[_0x1b5e('0x2f')]['limit']);_0x1702de['offset']=qs[_0x1b5e('0x1d')](_0x191248[_0x1b5e('0x2f')][_0x1b5e('0x1d')]);}return _0xae63c1[_0x1b5e('0x51')](_0x1702de);}})[_0x1b5e('0x22')](function(_0xec1504){if(_0xec1504){return _0xec1504?{'count':_0x46512d,'rows':_0xec1504}:null;}})[_0x1b5e('0x22')](respondWithResult(_0x17dc21,null))[_0x1b5e('0x40')](handleError(_0x17dc21,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a3d8838..5cc4154 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 _0x2029=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','lodash','util','api'];(function(_0x30cbf7,_0x2c40c7){var _0x3ad677=function(_0x49b4eb){while(--_0x49b4eb){_0x30cbf7['push'](_0x30cbf7['shift']());}};_0x3ad677(++_0x2c40c7);}(_0x2029,0x171));var _0x9202=function(_0xa13487,_0xdbaa6e){_0xa13487=_0xa13487-0x0;var _0x3f8ae8=_0x2029[_0xa13487];return _0x3f8ae8;};'use strict';var _=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var logger=require('../../config/logger')(_0x9202('0x2'));var moment=require(_0x9202('0x3'));var BPromise=require(_0x9202('0x4'));var rp=require(_0x9202('0x5'));var fs=require('fs');var path=require(_0x9202('0x6'));var rimraf=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var attributes=require(_0x9202('0x9'));module[_0x9202('0xa')]=function(_0x299c13,_0x2f33bb){return _0x299c13[_0x9202('0xb')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bff=['api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bff,0xa6));var _0xf6bf=function(_0x52ea82,_0xf5852b){_0x52ea82=_0x52ea82-0x0;var _0x22b22a=_0x6bff[_0x52ea82];return _0x22b22a;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var moment=require('moment');var BPromise=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var fs=require('fs');var path=require(_0xf6bf('0x5'));var rimraf=require(_0xf6bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6bf('0x7'));module[_0xf6bf('0x8')]=function(_0x27cdda,_0x239d17){return _0x27cdda[_0xf6bf('0x9')](_0xf6bf('0xa'),attributes,{'tableName':_0xf6bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index b80b634..f38b18f 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 _0x8d4e=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4d4a75,_0x513936){var _0x28a512=function(_0x5de1a1){while(--_0x5de1a1){_0x4d4a75['push'](_0x4d4a75['shift']());}};_0x28a512(++_0x513936);}(_0x8d4e,0x17f));var _0xe8d4=function(_0x47c979,_0x3364f7){_0x47c979=_0x47c979-0x0;var _0x1822b8=_0x8d4e[_0x47c979];return _0x1822b8;};'use strict';var _=require(_0xe8d4('0x0'));var util=require('util');var moment=require(_0xe8d4('0x1'));var BPromise=require(_0xe8d4('0x2'));var rs=require(_0xe8d4('0x3'));var fs=require('fs');var Redis=require(_0xe8d4('0x4'));var db=require(_0xe8d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8d4('0x6'))(_0xe8d4('0x7'));var config=require('../../config/environment');var jayson=require(_0xe8d4('0x8'));var client=jayson['client'][_0xe8d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x64f7ae,_0xaeceb2,_0x51d83c){return new BPromise(function(_0x5def6d,_0x1471d1){return client[_0xe8d4('0xa')](_0x64f7ae,_0x51d83c)['then'](function(_0x368475){logger[_0xe8d4('0xb')](_0xe8d4('0xc'),_0xaeceb2,'request\x20sent');logger[_0xe8d4('0xd')](_0xe8d4('0xe'),_0xaeceb2,_0xe8d4('0xf'),JSON['stringify'](_0x368475));if(_0x368475[_0xe8d4('0x10')]){if(_0x368475[_0xe8d4('0x10')]['code']===0x1f4){logger[_0xe8d4('0x10')]('CmCompany,\x20%s,\x20%s',_0xaeceb2,_0x368475[_0xe8d4('0x10')][_0xe8d4('0x11')]);return _0x1471d1(_0x368475[_0xe8d4('0x10')][_0xe8d4('0x11')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0xaeceb2,_0x368475['error'][_0xe8d4('0x11')]);return _0x5def6d(_0x368475[_0xe8d4('0x10')][_0xe8d4('0x11')]);}else{logger[_0xe8d4('0xb')]('CmCompany,\x20%s,\x20%s',_0xaeceb2,_0xe8d4('0xf'));_0x5def6d(_0x368475[_0xe8d4('0x12')][_0xe8d4('0x11')]);}})[_0xe8d4('0x13')](function(_0x12db58){logger[_0xe8d4('0x10')]('CmCompany,\x20%s,\x20%s',_0xaeceb2,_0x12db58);_0x1471d1(_0x12db58);});});} \ No newline at end of file +var _0x6fd8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis'];(function(_0x4e1f46,_0x28cdd3){var _0x26622f=function(_0x25cdf1){while(--_0x25cdf1){_0x4e1f46['push'](_0x4e1f46['shift']());}};_0x26622f(++_0x28cdd3);}(_0x6fd8,0x14c));var _0x86fd=function(_0x1a46fe,_0x1b7ac6){_0x1a46fe=_0x1a46fe-0x0;var _0x5987bb=_0x6fd8[_0x1a46fe];return _0x5987bb;};'use strict';var _=require(_0x86fd('0x0'));var util=require(_0x86fd('0x1'));var moment=require('moment');var BPromise=require(_0x86fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86fd('0x4'));var logger=require(_0x86fd('0x5'))(_0x86fd('0x6'));var config=require(_0x86fd('0x7'));var jayson=require(_0x86fd('0x8'));var client=jayson['client'][_0x86fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2128da,_0x50998b,_0x2ffe27){return new BPromise(function(_0xb1f41e,_0xb3a397){return client['request'](_0x2128da,_0x2ffe27)[_0x86fd('0xa')](function(_0x2e3835){logger[_0x86fd('0xb')](_0x86fd('0xc'),_0x50998b,'request\x20sent');logger[_0x86fd('0xd')](_0x86fd('0xe'),_0x50998b,_0x86fd('0xf'),JSON[_0x86fd('0x10')](_0x2e3835));if(_0x2e3835['error']){if(_0x2e3835[_0x86fd('0x11')][_0x86fd('0x12')]===0x1f4){logger[_0x86fd('0x11')]('CmCompany,\x20%s,\x20%s',_0x50998b,_0x2e3835[_0x86fd('0x11')][_0x86fd('0x13')]);return _0xb3a397(_0x2e3835['error'][_0x86fd('0x13')]);}logger[_0x86fd('0x11')]('CmCompany,\x20%s,\x20%s',_0x50998b,_0x2e3835['error']['message']);return _0xb1f41e(_0x2e3835[_0x86fd('0x11')]['message']);}else{logger['info'](_0x86fd('0xc'),_0x50998b,'request\x20sent');_0xb1f41e(_0x2e3835['result'][_0x86fd('0x13')]);}})[_0x86fd('0x14')](function(_0x1615da){logger[_0x86fd('0x11')](_0x86fd('0xc'),_0x50998b,_0x1615da);_0xb3a397(_0x1615da);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index be79e06..205ef67 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 _0xa456=['update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post'];(function(_0x1ad981,_0x5dcf23){var _0x5cf347=function(_0x3ccebf){while(--_0x3ccebf){_0x1ad981['push'](_0x1ad981['shift']());}};_0x5cf347(++_0x5dcf23);}(_0xa456,0x142));var _0x6a45=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xa456[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var auth=require(_0x6a45('0x5'));var interaction=require(_0x6a45('0x6'));var config=require('../../config/environment');var controller=require(_0x6a45('0x7'));router[_0x6a45('0x8')]('/',auth[_0x6a45('0x9')](),controller[_0x6a45('0xa')]);router['get'](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x8')](_0x6a45('0xd'),auth['isAuthenticated'](),controller[_0x6a45('0xe')]);router['get'](_0x6a45('0xf'),auth[_0x6a45('0x9')](),controller[_0x6a45('0x10')]);router[_0x6a45('0x11')]('/',auth[_0x6a45('0x9')](),controller['create']);router['post'](_0x6a45('0xf'),auth[_0x6a45('0x9')](),controller['addContacts']);router['put']('/:id',auth[_0x6a45('0x9')](),controller[_0x6a45('0x12')]);router[_0x6a45('0x13')](_0x6a45('0xd'),auth[_0x6a45('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d04=['/:id/contacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/:id','show','getContacts','create','post'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var auth=require(_0x43d0('0x6'));var interaction=require(_0x43d0('0x7'));var config=require('../../config/environment');var controller=require(_0x43d0('0x8'));router[_0x43d0('0x9')]('/',auth[_0x43d0('0xa')](),controller[_0x43d0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x43d0('0x9')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0xd')]);router[_0x43d0('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43d0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router[_0x43d0('0x10')](_0x43d0('0x11'),auth[_0x43d0('0xa')](),controller['addContacts']);router[_0x43d0('0x12')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x13')]);router[_0x43d0('0x14')](_0x43d0('0xc'),auth['isAuthenticated'](),controller[_0x43d0('0x15')]);module[_0x43d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c83970b..a5b13aa 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 _0x8543=['NOW','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x8543,0x13c));var _0x3854=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8543[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var Sequelize=require(_0x3854('0x0'));module[_0x3854('0x1')]={'firstName':{'type':Sequelize[_0x3854('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3854('0x2')]},'street':{'type':Sequelize[_0x3854('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3854('0x2')]},'country':{'type':Sequelize[_0x3854('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x3854('0x2')]},'mobile':{'type':Sequelize[_0x3854('0x2')]},'fax':{'type':Sequelize[_0x3854('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x3854('0x2')]},'facebook':{'type':Sequelize[_0x3854('0x2')]},'fb_data':{'type':Sequelize[_0x3854('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x3854('0x2')]},'teams':{'type':Sequelize[_0x3854('0x2')]},'viber':{'type':Sequelize[_0x3854('0x2')]},'line':{'type':Sequelize[_0x3854('0x2')]},'wechat':{'type':Sequelize[_0x3854('0x2')]},'telegram':{'type':Sequelize[_0x3854('0x2')]},'UserId':{'type':Sequelize[_0x3854('0x3')]},'priority':{'type':Sequelize[_0x3854('0x3')](0x2)[_0x3854('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3854('0x5')],'defaultValue':Sequelize[_0x3854('0x6')]}}; \ No newline at end of file +var _0xc1f5=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x21ac9f,_0x162d96){var _0x47748d=function(_0x554211){while(--_0x554211){_0x21ac9f['push'](_0x21ac9f['shift']());}};_0x47748d(++_0x162d96);}(_0xc1f5,0xc3));var _0x5c1f=function(_0x3d77e1,_0x12ac74){_0x3d77e1=_0x3d77e1-0x0;var _0x1d28ea=_0xc1f5[_0x3d77e1];return _0x1d28ea;};'use strict';var _=require(_0x5c1f('0x0'));var Sequelize=require(_0x5c1f('0x1'));module[_0x5c1f('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x5c1f('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5c1f('0x3')]},'city':{'type':Sequelize[_0x5c1f('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x5c1f('0x3')]},'description':{'type':Sequelize[_0x5c1f('0x4')]},'phone':{'type':Sequelize[_0x5c1f('0x3')]},'mobile':{'type':Sequelize[_0x5c1f('0x3')]},'fax':{'type':Sequelize[_0x5c1f('0x3')]},'email':{'type':Sequelize[_0x5c1f('0x3')]},'url':{'type':Sequelize[_0x5c1f('0x3')]},'facebook':{'type':Sequelize[_0x5c1f('0x3')]},'fb_data':{'type':Sequelize[_0x5c1f('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x5c1f('0x3')]},'viber':{'type':Sequelize[_0x5c1f('0x3')]},'line':{'type':Sequelize[_0x5c1f('0x3')]},'wechat':{'type':Sequelize[_0x5c1f('0x3')]},'telegram':{'type':Sequelize[_0x5c1f('0x3')]},'UserId':{'type':Sequelize[_0x5c1f('0x5')]},'priority':{'type':Sequelize[_0x5c1f('0x5')](0x2)[_0x5c1f('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5c1f('0x7')],'defaultValue':Sequelize[_0x5c1f('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d9e2e00..a96997f 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 _0x6856=['nolimit','limit','order','sort','where','select','field','from','tools_tags','cm_contacts','cm_user_has_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','fieldType','castTo','DATE','buildExpression','type','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','catch','destroy','CmContact','params','describe','tags','columnName','displayName','findAll','custom','get','mergeWith','join','info','body','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','duplicates','$or','findOrCreate','Tags','$and','omit','format','table','setFields','id\x20=\x20?','toParam','values','phone','CmHopper','rawAttributes','getTags','setTags','getHoppers','pick','ContactId','options','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','binding_values','CompanyId','socket_timestamp','pid','send','createReadStream','parse','meta','agent','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','eml-format','rimraf','zip-dir','request-promise','moment','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','keys','length','cf_','push','CmCustomField','findOne','trimStart','query','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x4b043b,_0x598b17){var _0x398f5a=function(_0x59bea2){while(--_0x59bea2){_0x4b043b['push'](_0x4b043b['shift']());}};_0x398f5a(++_0x598b17);}(_0x6856,0xaf));var _0x6685=function(_0x1768ee,_0xe4e350){_0x1768ee=_0x1768ee-0x0;var _0x440826=_0x6856[_0x1768ee];return _0x440826;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6685('0x0'));var rimraf=require(_0x6685('0x1'));var zipdir=require(_0x6685('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6685('0x3'));var moment=require(_0x6685('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6685('0x5'));var csv=require('to-csv');var ejs=require(_0x6685('0x6'));var fs=require('fs');var _=require(_0x6685('0x7'));var squel=require('squel');var crypto=require(_0x6685('0x8'));var jsforce=require(_0x6685('0x9'));var deskjs=require(_0x6685('0xa'));var toCsv=require(_0x6685('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6685('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6685('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6685('0xe'));var logger=require('../../config/logger')(_0x6685('0xf'));var utils=require(_0x6685('0x10'));var config=require('../../config/environment');var db=require(_0x6685('0x11'))['db'];config[_0x6685('0x12')]=_['defaults'](config['redis'],{'host':_0x6685('0x13'),'port':0x18eb});var socket=require(_0x6685('0x14'))(new Redis(config[_0x6685('0x12')]));require(_0x6685('0x15'))[_0x6685('0x16')](socket);function respondWithStatusCode(_0x3a80cc,_0x7278d){_0x7278d=_0x7278d||0xcc;return function(_0x17d68f){if(_0x17d68f){return _0x3a80cc[_0x6685('0x17')](_0x7278d);}return _0x3a80cc[_0x6685('0x18')](_0x7278d)[_0x6685('0x19')]();};}function respondWithResult(_0x340535,_0x4d52dd){_0x4d52dd=_0x4d52dd||0xc8;return function(_0x3f8e2b){if(_0x3f8e2b){return _0x340535[_0x6685('0x18')](_0x4d52dd)[_0x6685('0x1a')](_0x3f8e2b);}};}function respondWithFilteredResult(_0x2da3bd,_0x231580){return function(_0x222393){if(_0x222393){var _0x153614=_0x222393[_0x6685('0x1b')],_0x3a88a4=_0x231580['offset'],_0x569860=_0x231580[_0x6685('0x1c')]+_0x231580['limit'],_0x309c69;if(_0x569860>=_0x153614){_0x569860=_0x153614;_0x309c69=0xc8;}else{_0x309c69=0xce;}_0x2da3bd['status'](_0x309c69);return _0x2da3bd[_0x6685('0x1d')](_0x6685('0x1e'),_0x3a88a4+'-'+_0x569860+'/'+_0x153614)[_0x6685('0x1a')](_0x222393);}return null;};}function patchUpdates(_0x3d3928){return function(_0x33d817){try{jsonpatch[_0x6685('0x1f')](_0x33d817,_0x3d3928,!![]);}catch(_0x45e2b9){return BPromise[_0x6685('0x20')](_0x45e2b9);}return _0x33d817[_0x6685('0x21')]();};}function saveUpdates(_0x457282,_0x20db55){return function(_0x32f47b){if(_0x32f47b){return _0x32f47b['update'](_0x457282)[_0x6685('0x22')](function(_0x1ac5e9){return _0x1ac5e9;});}return null;};}function removeEntity(_0x5bcf13,_0x302dc5){return function(_0x28559c){if(_0x28559c){return _0x28559c['destroy']()['then'](function(){_0x5bcf13[_0x6685('0x18')](0xcc)[_0x6685('0x19')]();});}};}function handleEntityNotFound(_0x15d0de,_0x3124a0){return function(_0x34623e){if(!_0x34623e){_0x15d0de[_0x6685('0x17')](0x194);}return _0x34623e;};}function handleError(_0x4919ba,_0x4e9347){_0x4e9347=_0x4e9347||0x1f4;return function(_0x4886f0){logger[_0x6685('0x23')](_0x4886f0[_0x6685('0x24')]);if(_0x4886f0[_0x6685('0x25')]){delete _0x4886f0[_0x6685('0x25')];}_0x4919ba[_0x6685('0x18')](_0x4e9347)['send'](_0x4886f0);};}exports['index']=function(_0x4b562e,_0x56f455){var _0x59d609={},_0xeb0b64={},_0x1c3062={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x6685('0x22')](function(_0x4fa680){var _0x11b47d=[];for(var _0x1ba75e=0x0;_0x1ba75e0x1){_0x538579['or'](_0x6685('0x66'),qs[_0x6685('0x67')](_0x55e278),null);}else{if(qs[_0x6685('0x68')](_0x55e278)){_0x538579['or'](_0x6685('0x69'),_0x55e278+'%');_0x538579['or'](_0x6685('0x6a'),_0x55e278+'%');_0x538579['or']('c.mobile\x20LIKE\x20?',_0x55e278+'%');_0x538579['or']('c.fax\x20LIKE\x20?',_0x55e278+'%');}else if(qs['isEmail'](_0x55e278)){_0x538579['or']('c.email\x20LIKE\x20?',_0x55e278+'%');}else{_0x538579['or'](_0x6685('0x6b'),'%'+_0x55e278+'%');_0x538579['or'](_0x6685('0x6c'),'%'+_0x55e278+'%');_0x538579['or'](_0x6685('0x6d'),'%'+_0x55e278+'%');}}}}_0x15115c[_0x6685('0x38')](_0x538579);_0x15115c[_0x6685('0x6e')](_0x6685('0x6f'));var _0x5a02c4={'type':db['Sequelize'][_0x6685('0x70')][_0x6685('0x71')],'raw':!![]};var _0x46f465=_0x15115c['clone']()[_0x6685('0x3a')](_0x6685('0x6f'));if(_0x59d609[_0x6685('0x36')]){_0x59d609[_0x6685('0x36')][_0x6685('0x4d')](function(_0x4504d4){_0x15115c[_0x6685('0x36')]('c.'+_0x4504d4[0x0],_0x4504d4[0x1]===_0x6685('0x72')?![]:!![]);});}if(!_[_0x6685('0x73')](_0x538c87)){_0x15115c[_0x6685('0x74')](_0x138614);_0x46f465['where'](_0x6685('0x75'),_0x538c87);}BPromise[_0x6685('0x76')]()[_0x6685('0x22')](function(){if(_0x59a8fa&&!_[_0x6685('0x77')](_0x59a8fa[_0x6685('0x47')],[_0x6685('0x3a'),'User'])){return _0x4b562e[_0x6685('0x78')][_0x6685('0x79')]({'attributes':['id'],'raw':!![]})[_0x6685('0x22')](function(_0x27f8d8){if(_[_0x6685('0x73')](_0x27f8d8)){_0x46f465[_0x6685('0x38')](_0x6685('0x7a'));_0x15115c['where']('c.ListId\x20IS\x20NULL');}else{_0x46f465[_0x6685('0x38')](_0x6685('0x5d'),_[_0x6685('0x4c')](_0x27f8d8,'id'));_0x15115c[_0x6685('0x38')](_0x6685('0x5d'),_[_0x6685('0x4c')](_0x27f8d8,'id'));}});}else{return;}})['then'](function(){db[_0x6685('0x7b')][_0x6685('0x2d')](_0x46f465['toString'](),_0x5a02c4)[_0x6685('0x22')](function(_0x1cec02){_0x1c3062['count']=_0x1cec02[_0x6685('0x27')];if(_0x1c3062[_0x6685('0x1b')]===0x0)return[];return db['sequelize'][_0x6685('0x2d')](_0x577f24[_0x6685('0x7c')](),_0x5a02c4);})['then'](function(_0x5e234d){_0x1b84f9=_[_0x6685('0x7d')](_0x5e234d,'id');_0x5a02c4=_[_0x6685('0x7e')](_0x5a02c4,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b562e[_0x6685('0x2d')][_0x6685('0x32')]){_0x59d609[_0x6685('0x31')][_0x6685('0x4d')](function(_0x3cdd56){_0x15115c['field']('c.'+_0x3cdd56);});}else{_0x15115c[_0x6685('0x3a')](_0x6685('0x6f'));_0x15115c['field'](_0x6685('0x7f'));_0x15115c[_0x6685('0x3a')](_0x6685('0x80'));_0x15115c['field'](_0x6685('0x81'));_0x15115c[_0x6685('0x3a')]('c.mobile');_0x15115c[_0x6685('0x3a')](_0x6685('0x82'));_0x15115c[_0x6685('0x3a')](_0x6685('0x83'));_0x15115c['field'](_0x6685('0x84'));_0x15115c['field']('c.deletedAt');_0x15115c[_0x6685('0x3a')](_0x6685('0x85'),_0x6685('0x86'));}if(_0x59d609[_0x6685('0x35')])_0x15115c[_0x6685('0x35')](_0x59d609[_0x6685('0x35')]);if(_0x59d609[_0x6685('0x1c')])_0x15115c[_0x6685('0x1c')](_0x59d609[_0x6685('0x1c')]);return db['sequelize'][_0x6685('0x2d')](_0x15115c['toString'](),_0x5a02c4);})['then'](function(_0x5bc8b9){_0x5bc8b9[_0x6685('0x4d')](function(_0x3ff576){if(_0x3ff576['TagIds']){_0x3ff576['Tags']=[];_0x3ff576[_0x6685('0x86')][_0x6685('0x4b')](',')[_0x6685('0x4d')](function(_0x457899){_0x3ff576['Tags'][_0x6685('0x29')](_0x1b84f9[_0x457899]);});}delete _0x3ff576[_0x6685('0x86')];});_0x1c3062['rows']=_0x5bc8b9;return _0x1c3062;})[_0x6685('0x22')](respondWithFilteredResult(_0x56f455,_0x59d609));});})[_0x6685('0x87')](handleError(_0x56f455,null));};exports[_0x6685('0x88')]=function(_0x79632b,_0x3cdea4){return db[_0x6685('0x89')][_0x6685('0x48')]({'where':{'id':_0x79632b[_0x6685('0x8a')]['id']}})[_0x6685('0x22')](handleEntityNotFound(_0x3cdea4,null))[_0x6685('0x22')](removeEntity(_0x3cdea4,null))[_0x6685('0x87')](handleError(_0x3cdea4,null));};exports['describe']=function(_0x5b85f3,_0x322436){return db[_0x6685('0x89')][_0x6685('0x8b')]()[_0x6685('0x22')](function(_0x233d92){delete _0x233d92[_0x6685('0x8c')];for(var _0xa16358=0x0;_0xa16358=_0x383a01){_0x5d459d=_0x383a01;_0x411dcd=0xc8;}else{_0x411dcd=0xce;}_0x146a71[_0xe4d7('0x1e')](_0x411dcd);return _0x146a71[_0xe4d7('0x24')](_0xe4d7('0x25'),_0x22f105+'-'+_0x5d459d+'/'+_0x383a01)[_0xe4d7('0x20')](_0x387515);}return null;};}function patchUpdates(_0x5f5bf3){return function(_0x43ed9d){try{jsonpatch[_0xe4d7('0x26')](_0x43ed9d,_0x5f5bf3,!![]);}catch(_0x2acc52){return BPromise[_0xe4d7('0x27')](_0x2acc52);}return _0x43ed9d[_0xe4d7('0x28')]();};}function saveUpdates(_0x349e44,_0x1ff8e8){return function(_0x653a73){if(_0x653a73){return _0x653a73[_0xe4d7('0x29')](_0x349e44)[_0xe4d7('0x2a')](function(_0x8219ca){return _0x8219ca;});}return null;};}function removeEntity(_0x284b44,_0x2b8757){return function(_0x5dc95b){if(_0x5dc95b){return _0x5dc95b['destroy']()[_0xe4d7('0x2a')](function(){_0x284b44[_0xe4d7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2368e6,_0x4ae3b6){return function(_0x58fe8f){if(!_0x58fe8f){_0x2368e6[_0xe4d7('0x2b')](0x194);}return _0x58fe8f;};}function handleError(_0x3db1b3,_0x5a3b6b){_0x5a3b6b=_0x5a3b6b||0x1f4;return function(_0x36f512){logger[_0xe4d7('0x2c')](_0x36f512[_0xe4d7('0x2d')]);if(_0x36f512[_0xe4d7('0x2e')]){delete _0x36f512['name'];}_0x3db1b3['status'](_0x5a3b6b)['send'](_0x36f512);};}exports[_0xe4d7('0x2f')]=function(_0x4e4910,_0x5ea48b){var _0x362bde={},_0x540b25={},_0x427020={'count':0x0,'rows':[]};return db[_0xe4d7('0x30')]['describe']()[_0xe4d7('0x2a')](function(_0x58eaa6){var _0x3dc8a7=[];for(var _0x439884=0x0;_0x4398840x1){_0x5c95b9['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe4d7('0x6c')](_0xe84b35),null);}else{if(qs[_0xe4d7('0x6d')](_0xe84b35)){_0x5c95b9['or'](_0xe4d7('0x6e'),_0xe84b35+'%');_0x5c95b9['or'](_0xe4d7('0x6f'),_0xe84b35+'%');_0x5c95b9['or'](_0xe4d7('0x70'),_0xe84b35+'%');_0x5c95b9['or']('c.fax\x20LIKE\x20?',_0xe84b35+'%');}else if(qs[_0xe4d7('0x71')](_0xe84b35)){_0x5c95b9['or'](_0xe4d7('0x72'),_0xe84b35+'%');}else{_0x5c95b9['or']('c.firstName\x20LIKE\x20?','%'+_0xe84b35+'%');_0x5c95b9['or'](_0xe4d7('0x73'),'%'+_0xe84b35+'%');_0x5c95b9['or'](_0xe4d7('0x72'),'%'+_0xe84b35+'%');}}}}_0x547370[_0xe4d7('0x42')](_0x5c95b9);_0x547370['group'](_0xe4d7('0x74'));var _0x2ed6db={'type':db[_0xe4d7('0x75')][_0xe4d7('0x76')][_0xe4d7('0x77')],'raw':!![]};var _0x542dea=_0x547370[_0xe4d7('0x78')]()['field'](_0xe4d7('0x74'));if(_0x362bde[_0xe4d7('0x79')]){_0x362bde[_0xe4d7('0x79')][_0xe4d7('0x54')](function(_0x4bb7bd){_0x547370[_0xe4d7('0x79')]('c.'+_0x4bb7bd[0x0],_0x4bb7bd[0x1]===_0xe4d7('0x7a')?![]:!![]);});}if(!_[_0xe4d7('0x63')](_0x3f6bb4)){_0x547370['having'](_0x24b503);_0x542dea[_0xe4d7('0x42')](_0xe4d7('0x7b'),_0x3f6bb4);}BPromise['resolve']()[_0xe4d7('0x2a')](function(){if(_0x2e17b5&&!_[_0xe4d7('0x7c')](_0x2e17b5[_0xe4d7('0x51')],['field','User'])){return _0x4e4910['user']['getLists']({'attributes':['id'],'raw':!![]})[_0xe4d7('0x2a')](function(_0x23dd32){if(_['isEmpty'](_0x23dd32)){_0x542dea['where']('c.ListId\x20IS\x20NULL');_0x547370['where'](_0xe4d7('0x7d'));}else{_0x542dea[_0xe4d7('0x42')]('c.ListId\x20IN\x20?',_['map'](_0x23dd32,'id'));_0x547370[_0xe4d7('0x42')](_0xe4d7('0x7e'),_[_0xe4d7('0x60')](_0x23dd32,'id'));}});}else{return;}})['then'](function(){db[_0xe4d7('0x7f')][_0xe4d7('0x3a')](_0x542dea[_0xe4d7('0x80')](),_0x2ed6db)[_0xe4d7('0x2a')](function(_0x40c68a){_0x427020[_0xe4d7('0x21')]=_0x40c68a['length'];if(_0x427020[_0xe4d7('0x21')]===0x0)return[];return db[_0xe4d7('0x7f')][_0xe4d7('0x3a')](_0x420dd6[_0xe4d7('0x80')](),_0x2ed6db);})[_0xe4d7('0x2a')](function(_0xc97d5f){_0x3839fe=_['keyBy'](_0xc97d5f,'id');_0x2ed6db=_['merge'](_0x2ed6db,{'model':db[_0xe4d7('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e4910[_0xe4d7('0x3a')][_0xe4d7('0x3e')]){_0x362bde['attributes']['forEach'](function(_0x2d8943){_0x547370[_0xe4d7('0x44')]('c.'+_0x2d8943);});}else{_0x547370[_0xe4d7('0x44')](_0xe4d7('0x74'));_0x547370[_0xe4d7('0x44')](_0xe4d7('0x81'));_0x547370['field']('c.lastName');_0x547370['field']('c.phone');_0x547370[_0xe4d7('0x44')](_0xe4d7('0x82'));_0x547370[_0xe4d7('0x44')](_0xe4d7('0x83'));_0x547370[_0xe4d7('0x44')](_0xe4d7('0x84'));_0x547370[_0xe4d7('0x44')](_0xe4d7('0x85'));_0x547370[_0xe4d7('0x44')]('c.deletedAt');_0x547370[_0xe4d7('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe4d7('0x86'));}if(_0x362bde[_0xe4d7('0x23')])_0x547370[_0xe4d7('0x23')](_0x362bde[_0xe4d7('0x23')]);if(_0x362bde[_0xe4d7('0x22')])_0x547370['offset'](_0x362bde['offset']);return db[_0xe4d7('0x7f')][_0xe4d7('0x3a')](_0x547370['toString'](),_0x2ed6db);})[_0xe4d7('0x2a')](function(_0x5c0418){_0x5c0418[_0xe4d7('0x54')](function(_0xef5bc4){if(_0xef5bc4[_0xe4d7('0x86')]){_0xef5bc4[_0xe4d7('0x87')]=[];_0xef5bc4[_0xe4d7('0x86')][_0xe4d7('0x6b')](',')[_0xe4d7('0x54')](function(_0x4e92db){_0xef5bc4['Tags'][_0xe4d7('0x34')](_0x3839fe[_0x4e92db]);});}delete _0xef5bc4['TagIds'];});_0x427020['rows']=_0x5c0418;return _0x427020;})[_0xe4d7('0x2a')](respondWithFilteredResult(_0x5ea48b,_0x362bde));});})[_0xe4d7('0x88')](handleError(_0x5ea48b,null));};exports[_0xe4d7('0x89')]=function(_0x3beeae,_0x1db0c2){return db[_0xe4d7('0x30')]['find']({'where':{'id':_0x3beeae[_0xe4d7('0x8a')]['id']}})['then'](handleEntityNotFound(_0x1db0c2,null))['then'](removeEntity(_0x1db0c2,null))[_0xe4d7('0x88')](handleError(_0x1db0c2,null));};exports[_0xe4d7('0x8b')]=function(_0x5b5359,_0x1642c8){return db['CmContact'][_0xe4d7('0x8b')]()['then'](function(_0x5346d1){delete _0x5346d1['tags'];for(var _0x4a5828=0x0;_0x4a5828{}\s\\|]/g,'-');_0x225e33(null,util[_0xd7df('0x23')]('%s-%s%s',path[_0xd7df('0x24')](_0x5aecbb['originalname'],path[_0xd7df('0x25')](_0x5aecbb[_0xd7df('0x21')])),Date[_0xd7df('0x26')](),path[_0xd7df('0x25')](_0x5aecbb[_0xd7df('0x21')])));}})});router[_0xd7df('0x18')](_0xd7df('0x27'),upload['single']('file'),controller[_0xd7df('0x28')]);var upload=multer({'storage':multer[_0xd7df('0x1e')]({'destination':function(_0x26047f,_0x459f11,_0x13f190){_0x13f190(null,path[_0xd7df('0x1f')](config[_0xd7df('0x20')],_0xd7df('0x29')));},'filename':function(_0x163904,_0x5c4d17,_0xe53f53){_0x5c4d17[_0xd7df('0x21')]=_0x5c4d17[_0xd7df('0x21')][_0xd7df('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe53f53(null,util[_0xd7df('0x23')](_0xd7df('0x2a'),path[_0xd7df('0x24')](_0x5c4d17[_0xd7df('0x21')],path['extname'](_0x5c4d17['originalname'])),Date['now'](),path['extname'](_0x5c4d17['originalname'])));}})});router[_0xd7df('0x18')]('/upload',upload[_0xd7df('0x2b')](_0xd7df('0x2c')),controller['upload']);router[_0xd7df('0x18')](_0xd7df('0x2d'),auth['isAuthenticated'](),controller[_0xd7df('0x2e')]);router[_0xd7df('0x2f')](_0xd7df('0xf'),auth[_0xd7df('0xb')](),controller[_0xd7df('0x30')]);router[_0xd7df('0x31')]('/:id',auth[_0xd7df('0xb')](),controller[_0xd7df('0x32')]);module[_0xd7df('0x33')]=router; \ No newline at end of file +var _0x33c5=['/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','replace','format','upload','/upload/:id','import','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','merge'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x33c5,0xe6));var _0x533c=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x33c5[_0x1e5cc3];return _0x15c596;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./cmContact.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0x7')](_0x533c('0xc'),auth[_0x533c('0x8')](),controller[_0x533c('0xd')]);router[_0x533c('0x7')](_0x533c('0xe'),auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x7')]('/:id/hoppers',auth[_0x533c('0x8')](),controller[_0x533c('0x10')]);router[_0x533c('0x7')](_0x533c('0x11'),auth[_0x533c('0x8')](),controller[_0x533c('0x12')]);router['get'](_0x533c('0x13'),auth[_0x533c('0x8')](),controller[_0x533c('0x14')]);router[_0x533c('0x7')](_0x533c('0x15'),auth[_0x533c('0x8')](),controller[_0x533c('0x16')]);router[_0x533c('0x17')]('/merge',auth[_0x533c('0x8')](),controller[_0x533c('0x18')]);router[_0x533c('0x17')]('/',auth[_0x533c('0x8')](),controller['create']);router[_0x533c('0x17')](_0x533c('0x19'),auth[_0x533c('0x8')](),controller[_0x533c('0x1a')]);router[_0x533c('0x17')](_0x533c('0xe'),auth[_0x533c('0x8')](),controller[_0x533c('0x1b')]);var upload=multer({'storage':multer[_0x533c('0x1c')]({'destination':function(_0x12e126,_0x287b9e,_0x2c41e9){_0x2c41e9(null,path[_0x533c('0x1d')](config[_0x533c('0x1e')],_0x533c('0x1f')));},'filename':function(_0x3de9fa,_0x1ded76,_0x2bc58f){_0x1ded76['originalname']=_0x1ded76[_0x533c('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2bc58f(null,util['format'](_0x533c('0x21'),path[_0x533c('0x22')](_0x1ded76['originalname'],path[_0x533c('0x23')](_0x1ded76[_0x533c('0x20')])),Date[_0x533c('0x24')](),path[_0x533c('0x23')](_0x1ded76['originalname'])));}})});router[_0x533c('0x17')](_0x533c('0x25'),upload[_0x533c('0x26')](_0x533c('0x27')),controller[_0x533c('0x28')]);var upload=multer({'storage':multer[_0x533c('0x1c')]({'destination':function(_0xb51a5,_0x43f669,_0xb1c937){_0xb1c937(null,path[_0x533c('0x1d')](config['root'],_0x533c('0x1f')));},'filename':function(_0xfab4da,_0x503c2e,_0x3caaa5){_0x503c2e['originalname']=_0x503c2e[_0x533c('0x20')][_0x533c('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3caaa5(null,util[_0x533c('0x2a')](_0x533c('0x21'),path[_0x533c('0x22')](_0x503c2e[_0x533c('0x20')],path[_0x533c('0x23')](_0x503c2e[_0x533c('0x20')])),Date[_0x533c('0x24')](),path[_0x533c('0x23')](_0x503c2e[_0x533c('0x20')])));}})});router[_0x533c('0x17')]('/upload',upload[_0x533c('0x26')]('file'),controller[_0x533c('0x2b')]);router[_0x533c('0x17')](_0x533c('0x2c'),auth[_0x533c('0x8')](),controller[_0x533c('0x2d')]);router[_0x533c('0x2e')](_0x533c('0xc'),auth[_0x533c('0x8')](),controller[_0x533c('0x2f')]);router[_0x533c('0x30')](_0x533c('0xc'),auth[_0x533c('0x8')](),controller[_0x533c('0x31')]);module[_0x533c('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 29a2763..0475b28 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 _0xdf98=['STRING','TEXT','type','select','values','isArray','stringify','BOOLEAN','exports','VIRTUAL','alias','setDataValue','getDataValue','name'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0xdf98,0xbe));var _0x8df9=function(_0x248a43,_0x59e52a){_0x248a43=_0x248a43-0x0;var _0x451379=_0xdf98[_0x248a43];return _0x451379;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x8df9('0x0')]={'name':{'type':Sequelize[_0x8df9('0x1')],'get':function(_0x5b5695){return this['getDataValue'](_0x8df9('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xd41535){this[_0x8df9('0x3')](_0x8df9('0x2'),_0xd41535?_0xd41535:this[_0x8df9('0x4')](_0x8df9('0x5')));}},'type':{'type':Sequelize[_0x8df9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x8df9('0x7')]('long'),'get':function(){if(this[_0x8df9('0x4')](_0x8df9('0x8'))===_0x8df9('0x9')){return JSON['parse'](this[_0x8df9('0x4')](_0x8df9('0xa')));}else{return this[_0x8df9('0x4')]('values');}},'set':function(_0x1a1a35){if(Array[_0x8df9('0xb')](_0x1a1a35)){this['setDataValue'](_0x8df9('0xa'),JSON[_0x8df9('0xc')](_0x1a1a35));}else{this[_0x8df9('0x3')]('values',_0x1a1a35);}}},'required':{'type':Sequelize[_0x8df9('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x1026=['BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','type','parse','values','isArray'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x1026,0x9b));var _0x6102=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x1026[_0x58fc2f];return _0x3a1312;};'use strict';var Sequelize=require(_0x6102('0x0'));var _=require(_0x6102('0x1'));module[_0x6102('0x2')]={'name':{'type':Sequelize[_0x6102('0x3')],'get':function(_0x133da0){return this[_0x6102('0x4')]('alias');}},'alias':{'type':Sequelize[_0x6102('0x5')],'allowNull':![],'set':function(_0x25c5e7){this[_0x6102('0x6')](_0x6102('0x7'),_0x25c5e7?_0x25c5e7:this[_0x6102('0x4')]('name'));}},'type':{'type':Sequelize[_0x6102('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x6102('0x8')]('long'),'get':function(){if(this[_0x6102('0x4')](_0x6102('0x9'))==='select'){return JSON[_0x6102('0xa')](this[_0x6102('0x4')](_0x6102('0xb')));}else{return this[_0x6102('0x4')](_0x6102('0xb'));}},'set':function(_0x45d007){if(Array[_0x6102('0xc')](_0x45d007)){this[_0x6102('0x6')](_0x6102('0xb'),JSON['stringify'](_0x45d007));}else{this['setDataValue']('values',_0x45d007);}}},'required':{'type':Sequelize[_0x6102('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4df5cb2..a2e7c88 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 _0x817a=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','fields','find','catch','body','params','create','text','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','then','error','stack','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','name','query','filters','attributes','intersection'];(function(_0x146443,_0x34d4df){var _0x5a550d=function(_0x191e11){while(--_0x191e11){_0x146443['push'](_0x146443['shift']());}};_0x5a550d(++_0x34d4df);}(_0x817a,0x124));var _0xa817=function(_0xbfbccf,_0x1f41f9){_0xbfbccf=_0xbfbccf-0x0;var _0x5b8daa=_0x817a[_0xbfbccf];return _0x5b8daa;};'use strict';var pdf=require(_0xa817('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa817('0x1'));var zipdir=require(_0xa817('0x2'));var jsonpatch=require(_0xa817('0x3'));var rp=require(_0xa817('0x4'));var moment=require('moment');var BPromise=require(_0xa817('0x5'));var Mustache=require(_0xa817('0x6'));var util=require('util');var path=require(_0xa817('0x7'));var sox=require('sox');var csv=require(_0xa817('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa817('0x9'));var crypto=require(_0xa817('0xa'));var jsforce=require(_0xa817('0xb'));var deskjs=require(_0xa817('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa817('0xd'));var Papa=require(_0xa817('0xe'));var Redis=require(_0xa817('0xf'));var authService=require(_0xa817('0x10'));var qs=require(_0xa817('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa817('0x12'));var logger=require(_0xa817('0x13'))(_0xa817('0x14'));var utils=require(_0xa817('0x15'));var config=require(_0xa817('0x16'));var db=require(_0xa817('0x17'))['db'];function respondWithStatusCode(_0x3e81d0,_0x4d0782){_0x4d0782=_0x4d0782||0xcc;return function(_0x5b136b){if(_0x5b136b){return _0x3e81d0[_0xa817('0x18')](_0x4d0782);}return _0x3e81d0[_0xa817('0x19')](_0x4d0782)[_0xa817('0x1a')]();};}function respondWithResult(_0xcd829e,_0x23b727){_0x23b727=_0x23b727||0xc8;return function(_0x5c67d0){if(_0x5c67d0){return _0xcd829e[_0xa817('0x19')](_0x23b727)[_0xa817('0x1b')](_0x5c67d0);}};}function respondWithFilteredResult(_0x807e18,_0x3dcd1a){return function(_0x1688df){if(_0x1688df){var _0x8e63f2=_0x1688df[_0xa817('0x1c')],_0x298a64=_0x3dcd1a[_0xa817('0x1d')],_0x16a8db=_0x3dcd1a[_0xa817('0x1d')]+_0x3dcd1a[_0xa817('0x1e')],_0x2bd5aa;if(_0x16a8db>=_0x8e63f2){_0x16a8db=_0x8e63f2;_0x2bd5aa=0xc8;}else{_0x2bd5aa=0xce;}_0x807e18[_0xa817('0x19')](_0x2bd5aa);return _0x807e18[_0xa817('0x1f')]('Content-Range',_0x298a64+'-'+_0x16a8db+'/'+_0x8e63f2)[_0xa817('0x1b')](_0x1688df);}return null;};}function patchUpdates(_0x48639a){return function(_0x5ea929){try{jsonpatch['apply'](_0x5ea929,_0x48639a,!![]);}catch(_0x49be0b){return BPromise[_0xa817('0x20')](_0x49be0b);}return _0x5ea929[_0xa817('0x21')]();};}function saveUpdates(_0x5e25ca,_0x12a60f){return function(_0x5949e6){if(_0x5949e6){return _0x5949e6['update'](_0x5e25ca)['then'](function(_0x5914ce){return _0x5914ce;});}return null;};}function removeEntity(_0x2636bf,_0x12c09f){return function(_0x192047){if(_0x192047){return _0x192047[_0xa817('0x22')]()[_0xa817('0x23')](function(){_0x2636bf[_0xa817('0x19')](0xcc)[_0xa817('0x1a')]();});}};}function handleEntityNotFound(_0x171864,_0x5dda00){return function(_0x20e9be){if(!_0x20e9be){_0x171864['sendStatus'](0x194);}return _0x20e9be;};}function handleError(_0x42caa4,_0x13d01d){_0x13d01d=_0x13d01d||0x1f4;return function(_0x5579d6){logger[_0xa817('0x24')](_0x5579d6[_0xa817('0x25')]);if(_0x5579d6['name']){delete _0x5579d6['name'];}_0x42caa4[_0xa817('0x19')](_0x13d01d)[_0xa817('0x26')](_0x5579d6);};}exports['index']=function(_0x13f7c0,_0x4f4c71){var _0x3bcb81={},_0x33deaa={},_0xe18559={'count':0x0,'rows':[]};var _0x5f3f62=_[_0xa817('0x27')](db[_0xa817('0x28')][_0xa817('0x29')],function(_0x7211dc){return{'name':_0x7211dc[_0xa817('0x2a')],'type':_0x7211dc[_0xa817('0x2b')][_0xa817('0x2c')]};});_0x33deaa[_0xa817('0x2d')]=_[_0xa817('0x2e')](_[_0xa817('0x27')](_0x5f3f62,_0xa817('0x2f')),[_0xa817('0x2f')]);_0x33deaa[_0xa817('0x30')]=_['keys'](_0x13f7c0['query']);_0x33deaa[_0xa817('0x31')]=_['intersection'](_0x33deaa['model'],_0x33deaa[_0xa817('0x30')]);_0x3bcb81[_0xa817('0x32')]=_[_0xa817('0x33')](_0x33deaa[_0xa817('0x2d')],qs['fields'](_0x13f7c0['query']['fields']));_0x3bcb81[_0xa817('0x32')]=_0x3bcb81[_0xa817('0x32')]['length']?_0x3bcb81[_0xa817('0x32')]:_0x33deaa[_0xa817('0x2d')];if(!_0x13f7c0[_0xa817('0x30')][_0xa817('0x34')](_0xa817('0x35'))){_0x3bcb81['limit']=qs[_0xa817('0x1e')](_0x13f7c0[_0xa817('0x30')][_0xa817('0x1e')]);_0x3bcb81[_0xa817('0x1d')]=qs[_0xa817('0x1d')](_0x13f7c0[_0xa817('0x30')][_0xa817('0x1d')]);}_0x3bcb81[_0xa817('0x36')]=qs[_0xa817('0x37')](_0x13f7c0[_0xa817('0x30')][_0xa817('0x37')]);_0x3bcb81[_0xa817('0x38')]=qs[_0xa817('0x31')](_[_0xa817('0x39')](_0x13f7c0[_0xa817('0x30')],_0x33deaa[_0xa817('0x31')]),_0x5f3f62);if(_0x13f7c0['query'][_0xa817('0x3a')]){_0x3bcb81['where']=_[_0xa817('0x3b')](_0x3bcb81[_0xa817('0x38')],{'$or':_[_0xa817('0x27')](_0x5f3f62,function(_0x20ff71){if(_0x20ff71[_0xa817('0x2b')]!==_0xa817('0x3c')){var _0x2ed102={};_0x2ed102[_0x20ff71['name']]={'$like':'%'+_0x13f7c0['query']['filter']+'%'};return _0x2ed102;}})});}_0x3bcb81=_[_0xa817('0x3b')]({},_0x3bcb81,_0x13f7c0[_0xa817('0x3d')]);var _0x5376f4={'where':_0x3bcb81[_0xa817('0x38')]};return db[_0xa817('0x28')]['count'](_0x5376f4)[_0xa817('0x23')](function(_0x5ab110){_0xe18559[_0xa817('0x1c')]=_0x5ab110;if(_0x13f7c0[_0xa817('0x30')][_0xa817('0x3e')]){_0x3bcb81[_0xa817('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0xa817('0x40')](_0x3bcb81);})['then'](function(_0x1acac0){_0xe18559[_0xa817('0x41')]=_0x1acac0;return _0xe18559;})[_0xa817('0x23')](respondWithFilteredResult(_0x4f4c71,_0x3bcb81))['catch'](handleError(_0x4f4c71,null));};exports[_0xa817('0x42')]=function(_0x3a9b5b,_0x4e24ad){var _0x5765ec={'raw':!![],'where':{'id':_0x3a9b5b['params']['id']}},_0x12dda7={};_0x12dda7[_0xa817('0x2d')]=_[_0xa817('0x43')](db['CmCustomField'][_0xa817('0x29')]);_0x12dda7[_0xa817('0x30')]=_['keys'](_0x3a9b5b['query']);_0x12dda7[_0xa817('0x31')]=_[_0xa817('0x33')](_0x12dda7[_0xa817('0x2d')],_0x12dda7[_0xa817('0x30')]);_0x5765ec['attributes']=_[_0xa817('0x33')](_0x12dda7['model'],qs[_0xa817('0x44')](_0x3a9b5b[_0xa817('0x30')][_0xa817('0x44')]));_0x5765ec[_0xa817('0x32')]=_0x5765ec['attributes']['length']?_0x5765ec[_0xa817('0x32')]:_0x12dda7[_0xa817('0x2d')];if(_0x3a9b5b['query'][_0xa817('0x3e')]){_0x5765ec[_0xa817('0x3f')]=[{'all':!![]}];}_0x5765ec=_[_0xa817('0x3b')]({},_0x5765ec,_0x3a9b5b[_0xa817('0x3d')]);return db[_0xa817('0x28')][_0xa817('0x45')](_0x5765ec)[_0xa817('0x23')](handleEntityNotFound(_0x4e24ad,null))['then'](respondWithResult(_0x4e24ad,null))[_0xa817('0x46')](handleError(_0x4e24ad,null));};exports['update']=function(_0x39a910,_0x2fc7b7){if(_0x39a910[_0xa817('0x47')]['id']){delete _0x39a910[_0xa817('0x47')]['id'];}return db[_0xa817('0x28')]['find']({'where':{'id':_0x39a910['params']['id']}})['then'](handleEntityNotFound(_0x2fc7b7,null))[_0xa817('0x23')](saveUpdates(_0x39a910[_0xa817('0x47')],null))[_0xa817('0x23')](respondWithResult(_0x2fc7b7,null))['catch'](handleError(_0x2fc7b7,null));};exports[_0xa817('0x22')]=function(_0x5f2c66,_0x12beec){return db[_0xa817('0x28')][_0xa817('0x45')]({'where':{'id':_0x5f2c66[_0xa817('0x48')]['id']}})[_0xa817('0x23')](handleEntityNotFound(_0x12beec,null))['then'](removeEntity(_0x12beec,null))[_0xa817('0x46')](handleError(_0x12beec,null));};exports[_0xa817('0x49')]=function(_0x2fdcd4,_0x142cdf){var _0x2b641b;return db['sequelize']['transaction'](function(_0x4d7a26){return db[_0xa817('0x28')]['create'](_0x2fdcd4[_0xa817('0x47')],{'transaction':_0x4d7a26})[_0xa817('0x23')](function(_0x345288){_0x2b641b=_0x345288;var _0x7d0857={'type':db['Sequelize']['TEXT'],'transaction':_0x4d7a26};switch(_0x2fdcd4[_0xa817('0x47')]['type']){case _0xa817('0x4a'):_0x7d0857['type']=db[_0xa817('0x4b')][_0xa817('0x4c')];break;case'number':_0x7d0857['type']=db['Sequelize'][_0xa817('0x4d')];break;case _0xa817('0x4e'):_0x7d0857[_0xa817('0x2b')]=db[_0xa817('0x4b')][_0xa817('0x4f')];_0x7d0857[_0xa817('0x50')]=![];break;default:}return db[_0xa817('0x51')][_0xa817('0x52')][_0xa817('0x53')](_0xa817('0x54'),util[_0xa817('0x55')]('cf_%d',_0x2b641b['id']),_0x7d0857);})['then'](function(){return _0x2b641b;});})['then'](respondWithResult(_0x142cdf,0xc9))[_0xa817('0x46')](handleError(_0x142cdf,null));}; \ No newline at end of file +var _0x0464=['findAll','rows','show','params','options','find','catch','update','body','create','sequelize','transaction','text','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include'];(function(_0x31a503,_0x17154c){var _0x2188c6=function(_0x5e2f03){while(--_0x5e2f03){_0x31a503['push'](_0x31a503['shift']());}};_0x2188c6(++_0x17154c);}(_0x0464,0x6c));var _0x4046=function(_0x53f112,_0x5e04c1){_0x53f112=_0x53f112-0x0;var _0x27478f=_0x0464[_0x53f112];return _0x27478f;};'use strict';var pdf=require(_0x4046('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4046('0x1'));var jsonpatch=require(_0x4046('0x2'));var rp=require(_0x4046('0x3'));var moment=require(_0x4046('0x4'));var BPromise=require(_0x4046('0x5'));var Mustache=require(_0x4046('0x6'));var util=require(_0x4046('0x7'));var path=require(_0x4046('0x8'));var sox=require('sox');var csv=require(_0x4046('0x9'));var ejs=require(_0x4046('0xa'));var fs=require('fs');var _=require(_0x4046('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4046('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4046('0xd'));var Papa=require(_0x4046('0xe'));var Redis=require(_0x4046('0xf'));var authService=require(_0x4046('0x10'));var qs=require(_0x4046('0x11'));var as=require(_0x4046('0x12'));var hardwareService=require(_0x4046('0x13'));var logger=require(_0x4046('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4046('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5284c6,_0x2e0193){_0x2e0193=_0x2e0193||0xcc;return function(_0x17632d){if(_0x17632d){return _0x5284c6[_0x4046('0x16')](_0x2e0193);}return _0x5284c6[_0x4046('0x17')](_0x2e0193)[_0x4046('0x18')]();};}function respondWithResult(_0x52f4db,_0x3aa09e){_0x3aa09e=_0x3aa09e||0xc8;return function(_0x5a4b08){if(_0x5a4b08){return _0x52f4db['status'](_0x3aa09e)[_0x4046('0x19')](_0x5a4b08);}};}function respondWithFilteredResult(_0xd2a4e6,_0x297edb){return function(_0x58adb0){if(_0x58adb0){var _0x80db8e=_0x58adb0['count'],_0xd6c4f1=_0x297edb[_0x4046('0x1a')],_0x28b857=_0x297edb[_0x4046('0x1a')]+_0x297edb[_0x4046('0x1b')],_0x412d3f;if(_0x28b857>=_0x80db8e){_0x28b857=_0x80db8e;_0x412d3f=0xc8;}else{_0x412d3f=0xce;}_0xd2a4e6[_0x4046('0x17')](_0x412d3f);return _0xd2a4e6[_0x4046('0x1c')](_0x4046('0x1d'),_0xd6c4f1+'-'+_0x28b857+'/'+_0x80db8e)[_0x4046('0x19')](_0x58adb0);}return null;};}function patchUpdates(_0x1c2374){return function(_0x4a85f9){try{jsonpatch[_0x4046('0x1e')](_0x4a85f9,_0x1c2374,!![]);}catch(_0x2932c5){return BPromise[_0x4046('0x1f')](_0x2932c5);}return _0x4a85f9[_0x4046('0x20')]();};}function saveUpdates(_0x19fcfe,_0x8517){return function(_0x2d9195){if(_0x2d9195){return _0x2d9195['update'](_0x19fcfe)[_0x4046('0x21')](function(_0x3300db){return _0x3300db;});}return null;};}function removeEntity(_0x31f0b4,_0x3edb33){return function(_0x1e78db){if(_0x1e78db){return _0x1e78db[_0x4046('0x22')]()['then'](function(){_0x31f0b4[_0x4046('0x17')](0xcc)[_0x4046('0x18')]();});}};}function handleEntityNotFound(_0x293993,_0x53e832){return function(_0x24628c){if(!_0x24628c){_0x293993[_0x4046('0x16')](0x194);}return _0x24628c;};}function handleError(_0x575653,_0x25fd97){_0x25fd97=_0x25fd97||0x1f4;return function(_0x55a966){logger[_0x4046('0x23')](_0x55a966['stack']);if(_0x55a966[_0x4046('0x24')]){delete _0x55a966['name'];}_0x575653[_0x4046('0x17')](_0x25fd97)[_0x4046('0x25')](_0x55a966);};}exports[_0x4046('0x26')]=function(_0x48bc25,_0x4dac40){var _0x423d70={},_0x21d727={},_0x271bbf={'count':0x0,'rows':[]};var _0x3c3678=_[_0x4046('0x27')](db[_0x4046('0x28')][_0x4046('0x29')],function(_0x1006e5){return{'name':_0x1006e5[_0x4046('0x2a')],'type':_0x1006e5[_0x4046('0x2b')]['key']};});_0x21d727[_0x4046('0x2c')]=_['differenceBy'](_[_0x4046('0x27')](_0x3c3678,_0x4046('0x24')),[_0x4046('0x24')]);_0x21d727['query']=_[_0x4046('0x2d')](_0x48bc25[_0x4046('0x2e')]);_0x21d727['filters']=_[_0x4046('0x2f')](_0x21d727[_0x4046('0x2c')],_0x21d727[_0x4046('0x2e')]);_0x423d70['attributes']=_[_0x4046('0x2f')](_0x21d727[_0x4046('0x2c')],qs[_0x4046('0x30')](_0x48bc25[_0x4046('0x2e')][_0x4046('0x30')]));_0x423d70[_0x4046('0x31')]=_0x423d70[_0x4046('0x31')][_0x4046('0x32')]?_0x423d70['attributes']:_0x21d727[_0x4046('0x2c')];if(!_0x48bc25['query'][_0x4046('0x33')](_0x4046('0x34'))){_0x423d70[_0x4046('0x1b')]=qs[_0x4046('0x1b')](_0x48bc25[_0x4046('0x2e')][_0x4046('0x1b')]);_0x423d70[_0x4046('0x1a')]=qs[_0x4046('0x1a')](_0x48bc25[_0x4046('0x2e')][_0x4046('0x1a')]);}_0x423d70[_0x4046('0x35')]=qs['sort'](_0x48bc25[_0x4046('0x2e')][_0x4046('0x36')]);_0x423d70[_0x4046('0x37')]=qs[_0x4046('0x38')](_[_0x4046('0x39')](_0x48bc25['query'],_0x21d727['filters']),_0x3c3678);if(_0x48bc25[_0x4046('0x2e')][_0x4046('0x3a')]){_0x423d70[_0x4046('0x37')]=_[_0x4046('0x3b')](_0x423d70['where'],{'$or':_[_0x4046('0x27')](_0x3c3678,function(_0x1e6eeb){if(_0x1e6eeb[_0x4046('0x2b')]!==_0x4046('0x3c')){var _0x54f027={};_0x54f027[_0x1e6eeb['name']]={'$like':'%'+_0x48bc25['query'][_0x4046('0x3a')]+'%'};return _0x54f027;}})});}_0x423d70=_[_0x4046('0x3b')]({},_0x423d70,_0x48bc25['options']);var _0x5f23df={'where':_0x423d70[_0x4046('0x37')]};return db[_0x4046('0x28')][_0x4046('0x3d')](_0x5f23df)[_0x4046('0x21')](function(_0x5521b9){_0x271bbf[_0x4046('0x3d')]=_0x5521b9;if(_0x48bc25[_0x4046('0x2e')][_0x4046('0x3e')]){_0x423d70[_0x4046('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x4046('0x40')](_0x423d70);})['then'](function(_0x27644f){_0x271bbf[_0x4046('0x41')]=_0x27644f;return _0x271bbf;})[_0x4046('0x21')](respondWithFilteredResult(_0x4dac40,_0x423d70))['catch'](handleError(_0x4dac40,null));};exports[_0x4046('0x42')]=function(_0x7389d9,_0x459002){var _0x460d27={'raw':!![],'where':{'id':_0x7389d9[_0x4046('0x43')]['id']}},_0x5af849={};_0x5af849[_0x4046('0x2c')]=_[_0x4046('0x2d')](db[_0x4046('0x28')][_0x4046('0x29')]);_0x5af849[_0x4046('0x2e')]=_[_0x4046('0x2d')](_0x7389d9[_0x4046('0x2e')]);_0x5af849[_0x4046('0x38')]=_[_0x4046('0x2f')](_0x5af849[_0x4046('0x2c')],_0x5af849[_0x4046('0x2e')]);_0x460d27[_0x4046('0x31')]=_[_0x4046('0x2f')](_0x5af849[_0x4046('0x2c')],qs['fields'](_0x7389d9[_0x4046('0x2e')][_0x4046('0x30')]));_0x460d27[_0x4046('0x31')]=_0x460d27[_0x4046('0x31')]['length']?_0x460d27[_0x4046('0x31')]:_0x5af849[_0x4046('0x2c')];if(_0x7389d9[_0x4046('0x2e')][_0x4046('0x3e')]){_0x460d27['include']=[{'all':!![]}];}_0x460d27=_[_0x4046('0x3b')]({},_0x460d27,_0x7389d9[_0x4046('0x44')]);return db[_0x4046('0x28')][_0x4046('0x45')](_0x460d27)[_0x4046('0x21')](handleEntityNotFound(_0x459002,null))[_0x4046('0x21')](respondWithResult(_0x459002,null))[_0x4046('0x46')](handleError(_0x459002,null));};exports[_0x4046('0x47')]=function(_0x382e4d,_0x1f02a3){if(_0x382e4d[_0x4046('0x48')]['id']){delete _0x382e4d[_0x4046('0x48')]['id'];}return db['CmCustomField'][_0x4046('0x45')]({'where':{'id':_0x382e4d[_0x4046('0x43')]['id']}})[_0x4046('0x21')](handleEntityNotFound(_0x1f02a3,null))[_0x4046('0x21')](saveUpdates(_0x382e4d['body'],null))[_0x4046('0x21')](respondWithResult(_0x1f02a3,null))['catch'](handleError(_0x1f02a3,null));};exports['destroy']=function(_0x463016,_0x298ec6){return db[_0x4046('0x28')][_0x4046('0x45')]({'where':{'id':_0x463016[_0x4046('0x43')]['id']}})['then'](handleEntityNotFound(_0x298ec6,null))['then'](removeEntity(_0x298ec6,null))[_0x4046('0x46')](handleError(_0x298ec6,null));};exports[_0x4046('0x49')]=function(_0x27fc29,_0x3d7866){var _0x6aa5a7;return db[_0x4046('0x4a')][_0x4046('0x4b')](function(_0x3654f3){return db[_0x4046('0x28')][_0x4046('0x49')](_0x27fc29[_0x4046('0x48')],{'transaction':_0x3654f3})[_0x4046('0x21')](function(_0x525f35){_0x6aa5a7=_0x525f35;var _0x50e753={'type':db['Sequelize']['TEXT'],'transaction':_0x3654f3};switch(_0x27fc29[_0x4046('0x48')][_0x4046('0x2b')]){case _0x4046('0x4c'):_0x50e753[_0x4046('0x2b')]=db[_0x4046('0x4d')][_0x4046('0x4e')];break;case _0x4046('0x4f'):_0x50e753[_0x4046('0x2b')]=db[_0x4046('0x4d')]['INTEGER'];break;case'switch':_0x50e753['type']=db[_0x4046('0x4d')][_0x4046('0x50')];_0x50e753[_0x4046('0x51')]=![];break;default:}return db['sequelize'][_0x4046('0x52')][_0x4046('0x53')]('cm_contacts',util[_0x4046('0x54')](_0x4046('0x55'),_0x6aa5a7['id']),_0x50e753);})['then'](function(){return _0x6aa5a7;});})[_0x4046('0x21')](respondWithResult(_0x3d7866,0xc9))['catch'](handleError(_0x3d7866,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e70e0b1..e6f3679 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 _0x5c51=['util','api','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash'];(function(_0x2d63f9,_0x8b4758){var _0x226c61=function(_0x35d87f){while(--_0x35d87f){_0x2d63f9['push'](_0x2d63f9['shift']());}};_0x226c61(++_0x8b4758);}(_0x5c51,0xe3));var _0x15c5=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x5c51[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require(_0x15c5('0x0'));var util=require(_0x15c5('0x1'));var logger=require('../../config/logger')(_0x15c5('0x2'));var moment=require(_0x15c5('0x3'));var BPromise=require(_0x15c5('0x4'));var rp=require(_0x15c5('0x5'));var fs=require('fs');var path=require(_0x15c5('0x6'));var rimraf=require('rimraf');var config=require(_0x15c5('0x7'));var attributes=require(_0x15c5('0x8'));module[_0x15c5('0x9')]=function(_0x4bd8cc,_0x5c8560){return _0x4bd8cc['define'](_0x15c5('0xa'),attributes,{'tableName':_0x15c5('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22c3=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x22c3,0x96));var _0x322c=function(_0x30c4e0,_0x530b62){_0x30c4e0=_0x30c4e0-0x0;var _0x39f35a=_0x22c3[_0x30c4e0];return _0x39f35a;};'use strict';var _=require(_0x322c('0x0'));var util=require(_0x322c('0x1'));var logger=require(_0x322c('0x2'))(_0x322c('0x3'));var moment=require(_0x322c('0x4'));var BPromise=require(_0x322c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x322c('0x6'));var config=require(_0x322c('0x7'));var attributes=require(_0x322c('0x8'));module[_0x322c('0x9')]=function(_0xe2fe19,_0x2ff10f){return _0xe2fe19[_0x322c('0xa')](_0x322c('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index cdc5d7f..120d44b 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 _0x5636=['code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x4f1e51,_0x3995c6){_0x4f1e51=_0x4f1e51-0x0;var _0x54098e=_0x5636[_0x4f1e51];return _0x54098e;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('CmCustomField,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('CmCustomField,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('CmCustomField,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file +var _0xe13a=['code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x26a41b,_0x5b3582){var _0x4a1e72=function(_0x3d75e9){while(--_0x3d75e9){_0x26a41b['push'](_0x26a41b['shift']());}};_0x4a1e72(++_0x5b3582);}(_0xe13a,0x178));var _0xae13=function(_0xe66627,_0x5b94e7){_0xe66627=_0xe66627-0x0;var _0x5aa5d1=_0xe13a[_0xe66627];return _0x5aa5d1;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('CmCustomField,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1127d5f..fdeb3a5 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 _0x8d75=['Router','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xc62c17,_0x4ad1f9){var _0x2d214b=function(_0x1569dc){while(--_0x1569dc){_0xc62c17['push'](_0xc62c17['shift']());}};_0x2d214b(++_0x4ad1f9);}(_0x8d75,0x6d));var _0x58d7=function(_0x2addaf,_0x5cf912){_0x2addaf=_0x2addaf-0x0;var _0x26b50a=_0x8d75[_0x2addaf];return _0x26b50a;};'use strict';var multer=require(_0x58d7('0x0'));var util=require(_0x58d7('0x1'));var path=require(_0x58d7('0x2'));var timeout=require(_0x58d7('0x3'));var express=require(_0x58d7('0x4'));var router=express[_0x58d7('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x58d7('0x6'));var controller=require(_0x58d7('0x7'));router[_0x58d7('0x8')]('/',auth[_0x58d7('0x9')](),controller[_0x58d7('0xa')]);router['get']('/:id',auth[_0x58d7('0x9')](),controller[_0x58d7('0xb')]);router[_0x58d7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x58d7('0xd')]('/:id',auth[_0x58d7('0x9')](),controller[_0x58d7('0xe')]);router[_0x58d7('0xf')](_0x58d7('0x10'),auth[_0x58d7('0x9')](),controller[_0x58d7('0x11')]);module[_0x58d7('0x12')]=router; \ No newline at end of file +var _0x76d5=['isAuthenticated','show','post','update','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id'];(function(_0x2aa37d,_0x22bcd8){var _0x230586=function(_0x33968b){while(--_0x33968b){_0x2aa37d['push'](_0x2aa37d['shift']());}};_0x230586(++_0x22bcd8);}(_0x76d5,0x19b));var _0x576d=function(_0x5aff36,_0x10d93f){_0x5aff36=_0x5aff36-0x0;var _0x3efadb=_0x76d5[_0x5aff36];return _0x3efadb;};'use strict';var multer=require(_0x576d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x576d('0x1'));var express=require(_0x576d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x576d('0x3'));var config=require(_0x576d('0x4'));var controller=require(_0x576d('0x5'));router[_0x576d('0x6')]('/',auth['isAuthenticated'](),controller[_0x576d('0x7')]);router[_0x576d('0x6')](_0x576d('0x8'),auth[_0x576d('0x9')](),controller[_0x576d('0xa')]);router[_0x576d('0xb')]('/',auth[_0x576d('0x9')](),controller['create']);router['put'](_0x576d('0x8'),auth[_0x576d('0x9')](),controller[_0x576d('0xc')]);router['delete'](_0x576d('0x8'),auth[_0x576d('0x9')](),controller['destroy']);module[_0x576d('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index b1d12e9..38e81be 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 _0x11cf=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x11cf,0x10b));var _0xf11c=function(_0x56a862,_0x57e8ce){_0x56a862=_0x56a862-0x0;var _0x1a9219=_0x11cf[_0x56a862];return _0x1a9219;};'use strict';var moment=require(_0xf11c('0x0'));var Sequelize=require(_0xf11c('0x1'));module[_0xf11c('0x2')]={'phone':{'type':Sequelize[_0xf11c('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xf11c('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf11c('0x5')],'defaultValue':moment()[_0xf11c('0x6')](_0xf11c('0x7'))},'countbusyretry':{'type':Sequelize[_0xf11c('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf11c('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf11c('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf11c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf11c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf11c('0x5')]},'priority':{'type':Sequelize[_0xf11c('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf11c('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xf11c('0x9')},'ListId':{'type':Sequelize[_0xf11c('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf11c('0x9')},'CampaignId':{'type':Sequelize[_0xf11c('0x8')]}}; \ No newline at end of file +var _0xac21=['contactListQueue','sequelize','exports','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','UNSIGNED'];(function(_0x274050,_0x24aecf){var _0x1573ab=function(_0x1fbc47){while(--_0x1fbc47){_0x274050['push'](_0x274050['shift']());}};_0x1573ab(++_0x24aecf);}(_0xac21,0x1af));var _0x1ac2=function(_0x3c861f,_0x435be3){_0x3c861f=_0x3c861f-0x0;var _0x29ee44=_0xac21[_0x3c861f];return _0x29ee44;};'use strict';var moment=require('moment');var Sequelize=require(_0x1ac2('0x0'));module[_0x1ac2('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x1ac2('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x1ac2('0x3')](_0x1ac2('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1ac2('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1ac2('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1ac2('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1ac2('0x7')]},'priority':{'type':Sequelize[_0x1ac2('0x5')](0x2)[_0x1ac2('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1ac2('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1ac2('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1ac2('0x5')],'unique':_0x1ac2('0x9')},'UserId':{'type':Sequelize[_0x1ac2('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x1ac2('0x5')],'unique':_0x1ac2('0x9')},'CampaignId':{'type':Sequelize[_0x1ac2('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e8454cb..fea1678 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 _0x0352=['name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','concat','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notLike','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmHopper','then','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','phone','campaigntype','ivr','CmContact','firstName','lastName','isNil','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','CmList','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','error','stack'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x0352,0xf1));var _0x2035=function(_0x41827f,_0x21a9ec){_0x41827f=_0x41827f-0x0;var _0x5860c2=_0x0352[_0x41827f];return _0x5860c2;};'use strict';var pdf=require(_0x2035('0x0'));var emlformat=require(_0x2035('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2035('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2035('0x3'));var moment=require(_0x2035('0x4'));var BPromise=require(_0x2035('0x5'));var Mustache=require(_0x2035('0x6'));var util=require(_0x2035('0x7'));var path=require(_0x2035('0x8'));var sox=require(_0x2035('0x9'));var csv=require(_0x2035('0xa'));var ejs=require(_0x2035('0xb'));var fs=require('fs');var _=require(_0x2035('0xc'));var squel=require(_0x2035('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2035('0xe'));var toCsv=require(_0x2035('0xa'));var querystring=require(_0x2035('0xf'));var Papa=require(_0x2035('0x10'));var Redis=require(_0x2035('0x11'));var authService=require(_0x2035('0x12'));var qs=require(_0x2035('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2035('0x14'));var logger=require(_0x2035('0x15'))('api');var utils=require(_0x2035('0x16'));var config=require(_0x2035('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23d6eb,_0x5a3772){_0x5a3772=_0x5a3772||0xcc;return function(_0x38fc95){if(_0x38fc95){return _0x23d6eb[_0x2035('0x18')](_0x5a3772);}return _0x23d6eb[_0x2035('0x19')](_0x5a3772)[_0x2035('0x1a')]();};}function respondWithResult(_0x2e4dbe,_0x22c002){_0x22c002=_0x22c002||0xc8;return function(_0x180dea){if(_0x180dea){return _0x2e4dbe[_0x2035('0x19')](_0x22c002)[_0x2035('0x1b')](_0x180dea);}};}function respondWithFilteredResult(_0x3e5a37,_0x3a9ac6){return function(_0x824e6b){if(_0x824e6b){var _0x4cc234=_0x824e6b[_0x2035('0x1c')],_0x4d897f=_0x3a9ac6[_0x2035('0x1d')],_0x2dfc0c=_0x3a9ac6[_0x2035('0x1d')]+_0x3a9ac6[_0x2035('0x1e')],_0x499a5d;if(_0x2dfc0c>=_0x4cc234){_0x2dfc0c=_0x4cc234;_0x499a5d=0xc8;}else{_0x499a5d=0xce;}_0x3e5a37[_0x2035('0x19')](_0x499a5d);return _0x3e5a37[_0x2035('0x1f')]('Content-Range',_0x4d897f+'-'+_0x2dfc0c+'/'+_0x4cc234)[_0x2035('0x1b')](_0x824e6b);}return null;};}function patchUpdates(_0x4751ca){return function(_0x8b61e4){try{jsonpatch[_0x2035('0x20')](_0x8b61e4,_0x4751ca,!![]);}catch(_0x24dc48){return BPromise[_0x2035('0x21')](_0x24dc48);}return _0x8b61e4[_0x2035('0x22')]();};}function saveUpdates(_0x501963,_0x3e6b80){return function(_0x513f94){if(_0x513f94){return _0x513f94[_0x2035('0x23')](_0x501963)['then'](function(_0xbf0045){return _0xbf0045;});}return null;};}function removeEntity(_0x44c961,_0x1742fe){return function(_0x235250){if(_0x235250){return _0x235250[_0x2035('0x24')]()['then'](function(){_0x44c961[_0x2035('0x19')](0xcc)[_0x2035('0x1a')]();});}};}function handleEntityNotFound(_0x39d60d,_0x2daf1b){return function(_0x304551){if(!_0x304551){_0x39d60d[_0x2035('0x18')](0x194);}return _0x304551;};}function handleError(_0x583ac0,_0x41b4eb){_0x41b4eb=_0x41b4eb||0x1f4;return function(_0xda61c0){logger[_0x2035('0x25')](_0xda61c0[_0x2035('0x26')]);if(_0xda61c0[_0x2035('0x27')]){delete _0xda61c0['name'];}_0x583ac0[_0x2035('0x19')](_0x41b4eb)[_0x2035('0x28')](_0xda61c0);};}exports[_0x2035('0x29')]=function(_0x3edef7,_0x39547d){var _0x21fe20={},_0x5aa978={},_0x3236bb={'count':0x0,'rows':[]};var _0x29a42b=_[_0x2035('0x2a')](db['CmHopper'][_0x2035('0x2b')],function(_0x25c694){return{'name':_0x25c694['fieldName'],'type':_0x25c694[_0x2035('0x2c')][_0x2035('0x2d')]};});_0x5aa978['model']=_['map'](_0x29a42b,_0x2035('0x27'));_0x5aa978[_0x2035('0x2e')]=_['keys'](_0x3edef7['query']);_0x5aa978[_0x2035('0x2f')]=_[_0x2035('0x30')](_0x5aa978[_0x2035('0x31')],_0x5aa978['query']);_0x5aa978['filters']=_[_0x2035('0x32')](_0x5aa978['filters'],[_0x2035('0x33'),'$or',_0x2035('0x34'),_0x2035('0x35'),_0x2035('0x36'),_0x2035('0x37'),_0x2035('0x38'),'$eq',_0x2035('0x39'),_0x2035('0x3a'),'$notBetween','$in','$notIn','$like',_0x2035('0x3b'),'$iLike',_0x2035('0x3c'),'$like','$overlap',_0x2035('0x3d'),'$contained',_0x2035('0x3e')]);_0x21fe20[_0x2035('0x3f')]=_[_0x2035('0x30')](_0x5aa978[_0x2035('0x31')],qs[_0x2035('0x40')](_0x3edef7['query'][_0x2035('0x40')]));_0x21fe20[_0x2035('0x3f')]=_0x21fe20[_0x2035('0x3f')][_0x2035('0x41')]?_0x21fe20['attributes']:_0x5aa978['model'];if(!_0x3edef7[_0x2035('0x2e')][_0x2035('0x42')](_0x2035('0x43'))){_0x21fe20[_0x2035('0x1e')]=qs[_0x2035('0x1e')](_0x3edef7[_0x2035('0x2e')][_0x2035('0x1e')]);_0x21fe20[_0x2035('0x1d')]=qs[_0x2035('0x1d')](_0x3edef7[_0x2035('0x2e')]['offset']);}_0x21fe20['order']=qs['sort'](_0x3edef7['query'][_0x2035('0x44')]);_0x21fe20[_0x2035('0x45')]=qs[_0x2035('0x2f')](_[_0x2035('0x46')](_0x3edef7[_0x2035('0x2e')],_0x5aa978[_0x2035('0x2f')]),_0x29a42b);if(_0x3edef7[_0x2035('0x2e')][_0x2035('0x47')]){_0x21fe20[_0x2035('0x45')]=_['merge'](_0x21fe20[_0x2035('0x45')],{'$or':_['map'](_0x29a42b,function(_0x2401f3){if(_0x2401f3['type']!=='VIRTUAL'){var _0x78394a={};_0x78394a[_0x2401f3[_0x2035('0x27')]]={'$like':'%'+_0x3edef7['query'][_0x2035('0x47')]+'%'};return _0x78394a;}})});}_0x21fe20=_[_0x2035('0x48')]({},_0x21fe20,_0x3edef7[_0x2035('0x49')]);var _0x41ad5d={'where':_0x21fe20[_0x2035('0x45')]};return db[_0x2035('0x4a')][_0x2035('0x1c')](_0x41ad5d)[_0x2035('0x4b')](function(_0x177334){_0x3236bb[_0x2035('0x1c')]=_0x177334;if(_0x3edef7['query'][_0x2035('0x4c')]){_0x21fe20[_0x2035('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0x2035('0x4e')](_0x21fe20);})[_0x2035('0x4b')](function(_0x47ab57){_0x3236bb[_0x2035('0x4f')]=_0x47ab57;return _0x3236bb;})['then'](respondWithFilteredResult(_0x39547d,_0x21fe20))[_0x2035('0x50')](handleError(_0x39547d,null));};exports['show']=function(_0x38d140,_0x5f4267){var _0x2cb4b7={'raw':!![],'where':{'id':_0x38d140[_0x2035('0x51')]['id']}},_0x5c65f5={};_0x5c65f5['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x5c65f5[_0x2035('0x2e')]=_[_0x2035('0x52')](_0x38d140[_0x2035('0x2e')]);_0x5c65f5[_0x2035('0x2f')]=_[_0x2035('0x30')](_0x5c65f5['model'],_0x5c65f5[_0x2035('0x2e')]);_0x2cb4b7[_0x2035('0x3f')]=_[_0x2035('0x30')](_0x5c65f5[_0x2035('0x31')],qs[_0x2035('0x40')](_0x38d140[_0x2035('0x2e')][_0x2035('0x40')]));_0x2cb4b7[_0x2035('0x3f')]=_0x2cb4b7['attributes']['length']?_0x2cb4b7['attributes']:_0x5c65f5[_0x2035('0x31')];if(_0x38d140['query'][_0x2035('0x4c')]){_0x2cb4b7['include']=[{'all':!![]}];}_0x2cb4b7=_[_0x2035('0x48')]({},_0x2cb4b7,_0x38d140['options']);return db['CmHopper'][_0x2035('0x53')](_0x2cb4b7)[_0x2035('0x4b')](handleEntityNotFound(_0x5f4267,null))[_0x2035('0x4b')](respondWithResult(_0x5f4267,null))['catch'](handleError(_0x5f4267,null));};exports[_0x2035('0x54')]=function(_0x3c2cd6,_0x1ae202){return db[_0x2035('0x4a')]['create'](_0x3c2cd6[_0x2035('0x55')],{})[_0x2035('0x4b')](respondWithResult(_0x1ae202,0xc9))[_0x2035('0x50')](handleError(_0x1ae202,null));};exports[_0x2035('0x23')]=function(_0x532048,_0x57ffc1){if(_0x532048[_0x2035('0x55')]['id']){delete _0x532048[_0x2035('0x55')]['id'];}return db[_0x2035('0x4a')][_0x2035('0x53')]({'where':{'id':_0x532048[_0x2035('0x51')]['id']}})['then'](handleEntityNotFound(_0x57ffc1,null))['then'](saveUpdates(_0x532048[_0x2035('0x55')],null))[_0x2035('0x4b')](respondWithResult(_0x57ffc1,null))[_0x2035('0x50')](handleError(_0x57ffc1,null));};exports[_0x2035('0x56')]=function(_0x4c0e06,_0x39e984){return db[_0x2035('0x4a')][_0x2035('0x56')]()['then'](respondWithResult(_0x39e984,null))[_0x2035('0x50')](handleError(_0x39e984,null));};exports[_0x2035('0x24')]=function(_0x4247ba,_0x5a0240){var _0x322498;return db[_0x2035('0x4a')][_0x2035('0x53')]({'where':{'id':_0x4247ba[_0x2035('0x51')]['id']}})[_0x2035('0x4b')](handleEntityNotFound(_0x5a0240,null))[_0x2035('0x4b')](function(_0x5e0b58){if(_0x5e0b58){return _0x5e0b58[_0x2035('0x24')]()[_0x2035('0x4b')](function(_0x1a4ed5){return _0x1a4ed5;});}})[_0x2035('0x4b')](function(_0x307856){_0x322498=_0x307856;if(_0x307856){if(_0x307856['VoiceQueueId']||_0x307856[_0x2035('0x57')]){return db[_0x307856[_0x2035('0x58')]?_0x2035('0x59'):_0x2035('0x5a')][_0x2035('0x53')]({'where':{'id':_0x307856[_0x2035('0x58')]?_0x307856[_0x2035('0x58')]:_0x307856[_0x2035('0x57')]},'attributes':['id',_0x2035('0x27')],'raw':!![]});}}})[_0x2035('0x4b')](function(_0x1b25d7){var _0x246abe={};if(_0x1b25d7){_[_0x2035('0x48')](_0x246abe,_[_0x2035('0x5b')](_0x322498[_0x2035('0x5c')],[_0x2035('0x5d'),_0x2035('0x5e'),'id']));_0x246abe['state']=0x15;_0x246abe[_0x2035('0x5f')]=_0x2035('0x60');_0x246abe[_0x2035('0x61')]=_0x1b25d7[_0x2035('0x27')];_0x246abe[_0x2035('0x62')]=_0x4247ba[_0x2035('0x63')]['name'];_0x246abe[_0x2035('0x64')]=_0x4247ba[_0x2035('0x63')]['id'];_0x246abe['deleted']=!![];_0x246abe['deletedat']=moment()[_0x2035('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x246abe[_0x2035('0x66')]=_0x322498[_0x2035('0x67')];_0x246abe[_0x2035('0x68')]=_0x322498['VoiceQueueId']?'queue':_0x2035('0x69');return db[_0x2035('0x6a')][_0x2035('0x53')]({'where':{'id':_0x246abe['ContactId']},'attributes':[_0x2035('0x6b'),_0x2035('0x6c')]})[_0x2035('0x4b')](function(_0x408bc1){if(!_[_0x2035('0x6d')](_0x5a0240)&&!_['isNil'](_0x408bc1[_0x2035('0x6b')])){_0x246abe['calleridname']=_0x408bc1[_0x2035('0x6b')];if(!_[_0x2035('0x6d')](_0x408bc1[_0x2035('0x6c')])){_0x246abe['calleridname']+='\x20'+_0x408bc1['lastName'];}}})[_0x2035('0x6e')](function(){return db[_0x2035('0x6f')][_0x2035('0x54')](_0x246abe);});}})[_0x2035('0x4b')](function(){return _0x5a0240[_0x2035('0x19')](0xcc)[_0x2035('0x1a')]();})[_0x2035('0x50')](handleError(_0x5a0240,null));};exports[_0x2035('0x70')]=function(_0x47324f,_0x2b92d9,_0x154638){var _0x507af9=[];return db[_0x2035('0x6a')][_0x2035('0x56')]()[_0x2035('0x4b')](function(_0x32e12b){_0x507af9=_[_0x2035('0x52')](_0x32e12b);return _0x47324f[_0x2035('0x63')][_0x2035('0x71')]({'where':{'type':_0x2035('0x72'),'dialActive':!![],'dialMethod':_0x2035('0x73')},'attributes':['id',_0x2035('0x74')],'raw':!![]});})[_0x2035('0x4b')](function(_0x102c75){if(_0x102c75&&_0x102c75[_0x2035('0x41')]){return db[_0x2035('0x75')][_0x2035('0x76')](function(_0xe0b27b){var _0x3cd2dd={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2035('0x65')](_0x2035('0x77'))},'VoiceQueueId':{'$in':_[_0x2035('0x2a')](_0x102c75,'id')},'$or':[{'UserId':null},{'UserId':_0x47324f[_0x2035('0x63')]['id']}]};var _0x240518=[];if(_0x47324f[_0x2035('0x55')][_0x2035('0x78')]&&_0x47324f[_0x2035('0x55')]['direction']===_0x2035('0x79')){if(!_[_0x2035('0x7a')](_0x47324f[_0x2035('0x55')][_0x2035('0x7b')])){_0x3cd2dd['id']={'$in':_0x47324f[_0x2035('0x55')][_0x2035('0x7b')]};}_0x240518=[[_0x2035('0x7c'),_0x2035('0x7d')],['scheduledAt',_0x102c75[0x0]['dialOrderByScheduledAt']===_0x2035('0x7d')?_0x2035('0x7e'):_0x2035('0x7d')],db[_0x2035('0x75')][_0x2035('0x7f')](_0x2035('0x80')),['id',_0x2035('0x7e')]];}else{if(!_[_0x2035('0x7a')](_0x47324f[_0x2035('0x55')][_0x2035('0x7b')])){_0x3cd2dd['id']={'$notIn':_0x47324f[_0x2035('0x55')][_0x2035('0x7b')]};}_0x240518=[['priority',_0x2035('0x7e')],['scheduledAt',_0x102c75[0x0]['dialOrderByScheduledAt']],db[_0x2035('0x75')][_0x2035('0x7f')](_0x2035('0x81')),['id',_0x2035('0x7d')]];}return db[_0x2035('0x4a')]['findOne']({'attributes':['id',_0x2035('0x82')],'where':_0x3cd2dd,'order':_0x240518,'transaction':_0xe0b27b,'lock':_0xe0b27b[_0x2035('0x83')][_0x2035('0x84')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x507af9,'include':[{'model':db[_0x2035('0x85')],'as':'Company','attributes':['id',_0x2035('0x27')]}]},{'model':db[_0x2035('0x86')],'as':_0x2035('0x87'),'attributes':['id',_0x2035('0x27')]},{'model':db[_0x2035('0x59')],'as':_0x2035('0x88'),'attributes':['id',_0x2035('0x27'),'dialActive']}]})[_0x2035('0x4b')](function(_0x1f2317){if(_0x1f2317){return _0x1f2317[_0x2035('0x23')]({'UserId':_0x47324f['user']['id']},{'transaction':_0xe0b27b});}});});}})['then'](handleEntityNotFound(_0x2b92d9,null))[_0x2035('0x4b')](respondWithResult(_0x2b92d9,null))[_0x2035('0x50')](handleError(_0x2b92d9,null));};exports[_0x2035('0x89')]=function(_0x53a379,_0x167c43,_0x3e96a1){return _0x53a379['user'][_0x2035('0x71')]({'where':{'type':_0x2035('0x72'),'dialActive':!![],'dialMethod':_0x2035('0x73')},'attributes':['id'],'raw':!![]})['then'](function(_0x33d102){if(_0x33d102&&_0x33d102['length']){return db[_0x2035('0x4a')][_0x2035('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2035('0x65')](_0x2035('0x77'))},'VoiceQueueId':{'$in':_[_0x2035('0x2a')](_0x33d102,'id')},'$or':[{'UserId':null},{'UserId':_0x53a379[_0x2035('0x63')]['id']}]}});}return 0x0;})['then'](function(_0x51a47a){if(!_['isNil'](_0x51a47a)&&_[_0x2035('0x8a')](_0x51a47a)){return _0x167c43[_0x2035('0x19')](0xc8)['json']({'contacts':_0x51a47a});}else{logger[_0x2035('0x25')](_0x2035('0x8b'),_0x2035('0x89'),0x194,'entity\x20not\x20found');_0x167c43[_0x2035('0x18')](0x194);}})[_0x2035('0x50')](handleError(_0x167c43,null));}; \ No newline at end of file +var _0x6539=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','update','destroy','then','error','stack','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','$and','$gte','$lt','$lte','$eq','$in','$notIn','$like','$notLike','$iLike','$notILike','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','length','include','find','create','body','describe','VoiceQueueId','VoiceQueue','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','calleridname','isNil','finally','CmHopperFinal','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmContact','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf'];(function(_0x4683f2,_0x5ac7aa){var _0x1662f3=function(_0xb897a6){while(--_0xb897a6){_0x4683f2['push'](_0x4683f2['shift']());}};_0x1662f3(++_0x5ac7aa);}(_0x6539,0x1b8));var _0x9653=function(_0x5dacfa,_0x382fc8){_0x5dacfa=_0x5dacfa-0x0;var _0xe348e4=_0x6539[_0x5dacfa];return _0xe348e4;};'use strict';var pdf=require(_0x9653('0x0'));var emlformat=require(_0x9653('0x1'));var rimraf=require(_0x9653('0x2'));var zipdir=require(_0x9653('0x3'));var jsonpatch=require(_0x9653('0x4'));var rp=require('request-promise');var moment=require(_0x9653('0x5'));var BPromise=require(_0x9653('0x6'));var Mustache=require(_0x9653('0x7'));var util=require(_0x9653('0x8'));var path=require(_0x9653('0x9'));var sox=require(_0x9653('0xa'));var csv=require(_0x9653('0xb'));var ejs=require(_0x9653('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9653('0xd'));var crypto=require(_0x9653('0xe'));var jsforce=require(_0x9653('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9653('0xb'));var querystring=require(_0x9653('0x10'));var Papa=require(_0x9653('0x11'));var Redis=require(_0x9653('0x12'));var authService=require(_0x9653('0x13'));var qs=require(_0x9653('0x14'));var as=require(_0x9653('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9653('0x16'))(_0x9653('0x17'));var utils=require('../../config/utils');var config=require(_0x9653('0x18'));var db=require(_0x9653('0x19'))['db'];function respondWithStatusCode(_0x25f856,_0x759b94){_0x759b94=_0x759b94||0xcc;return function(_0x206bfb){if(_0x206bfb){return _0x25f856[_0x9653('0x1a')](_0x759b94);}return _0x25f856[_0x9653('0x1b')](_0x759b94)[_0x9653('0x1c')]();};}function respondWithResult(_0x3d0d29,_0x2a00e3){_0x2a00e3=_0x2a00e3||0xc8;return function(_0x148042){if(_0x148042){return _0x3d0d29[_0x9653('0x1b')](_0x2a00e3)[_0x9653('0x1d')](_0x148042);}};}function respondWithFilteredResult(_0x1fb590,_0x2a8f91){return function(_0x51845a){if(_0x51845a){var _0x3a73b0=_0x51845a['count'],_0x4affb0=_0x2a8f91['offset'],_0x1d852e=_0x2a8f91[_0x9653('0x1e')]+_0x2a8f91[_0x9653('0x1f')],_0x4bfc7d;if(_0x1d852e>=_0x3a73b0){_0x1d852e=_0x3a73b0;_0x4bfc7d=0xc8;}else{_0x4bfc7d=0xce;}_0x1fb590[_0x9653('0x1b')](_0x4bfc7d);return _0x1fb590[_0x9653('0x20')]('Content-Range',_0x4affb0+'-'+_0x1d852e+'/'+_0x3a73b0)[_0x9653('0x1d')](_0x51845a);}return null;};}function patchUpdates(_0x133b69){return function(_0x4d539f){try{jsonpatch['apply'](_0x4d539f,_0x133b69,!![]);}catch(_0x301f59){return BPromise[_0x9653('0x21')](_0x301f59);}return _0x4d539f[_0x9653('0x22')]();};}function saveUpdates(_0x534e90,_0x465158){return function(_0x15f1f0){if(_0x15f1f0){return _0x15f1f0[_0x9653('0x23')](_0x534e90)['then'](function(_0x442873){return _0x442873;});}return null;};}function removeEntity(_0x41fd3d,_0x52a25a){return function(_0x4916d6){if(_0x4916d6){return _0x4916d6[_0x9653('0x24')]()[_0x9653('0x25')](function(){_0x41fd3d['status'](0xcc)[_0x9653('0x1c')]();});}};}function handleEntityNotFound(_0x19e747,_0x441c6e){return function(_0x1ecfe4){if(!_0x1ecfe4){_0x19e747['sendStatus'](0x194);}return _0x1ecfe4;};}function handleError(_0x24953e,_0x509ac5){_0x509ac5=_0x509ac5||0x1f4;return function(_0xe30749){logger[_0x9653('0x26')](_0xe30749[_0x9653('0x27')]);if(_0xe30749['name']){delete _0xe30749['name'];}_0x24953e[_0x9653('0x1b')](_0x509ac5)[_0x9653('0x28')](_0xe30749);};}exports[_0x9653('0x29')]=function(_0x5f3e0b,_0x40c5ba){var _0x5c533f={},_0x5578dc={},_0x55f750={'count':0x0,'rows':[]};var _0x5b6da2=_['map'](db[_0x9653('0x2a')][_0x9653('0x2b')],function(_0x93f601){return{'name':_0x93f601[_0x9653('0x2c')],'type':_0x93f601[_0x9653('0x2d')][_0x9653('0x2e')]};});_0x5578dc[_0x9653('0x2f')]=_[_0x9653('0x30')](_0x5b6da2,_0x9653('0x31'));_0x5578dc['query']=_[_0x9653('0x32')](_0x5f3e0b[_0x9653('0x33')]);_0x5578dc[_0x9653('0x34')]=_[_0x9653('0x35')](_0x5578dc['model'],_0x5578dc[_0x9653('0x33')]);_0x5578dc[_0x9653('0x34')]=_['concat'](_0x5578dc[_0x9653('0x34')],[_0x9653('0x36'),'$or','$gt',_0x9653('0x37'),_0x9653('0x38'),_0x9653('0x39'),'$ne',_0x9653('0x3a'),'$not','$between','$notBetween',_0x9653('0x3b'),_0x9653('0x3c'),_0x9653('0x3d'),_0x9653('0x3e'),_0x9653('0x3f'),_0x9653('0x40'),_0x9653('0x3d'),'$overlap','$contains',_0x9653('0x41'),_0x9653('0x42')]);_0x5c533f[_0x9653('0x43')]=_[_0x9653('0x35')](_0x5578dc[_0x9653('0x2f')],qs[_0x9653('0x44')](_0x5f3e0b[_0x9653('0x33')][_0x9653('0x44')]));_0x5c533f[_0x9653('0x43')]=_0x5c533f[_0x9653('0x43')]['length']?_0x5c533f[_0x9653('0x43')]:_0x5578dc['model'];if(!_0x5f3e0b[_0x9653('0x33')][_0x9653('0x45')](_0x9653('0x46'))){_0x5c533f['limit']=qs['limit'](_0x5f3e0b['query'][_0x9653('0x1f')]);_0x5c533f[_0x9653('0x1e')]=qs['offset'](_0x5f3e0b[_0x9653('0x33')]['offset']);}_0x5c533f[_0x9653('0x47')]=qs['sort'](_0x5f3e0b[_0x9653('0x33')][_0x9653('0x48')]);_0x5c533f[_0x9653('0x49')]=qs[_0x9653('0x34')](_[_0x9653('0x4a')](_0x5f3e0b[_0x9653('0x33')],_0x5578dc['filters']),_0x5b6da2);if(_0x5f3e0b[_0x9653('0x33')][_0x9653('0x4b')]){_0x5c533f[_0x9653('0x49')]=_[_0x9653('0x4c')](_0x5c533f[_0x9653('0x49')],{'$or':_[_0x9653('0x30')](_0x5b6da2,function(_0x30e472){if(_0x30e472[_0x9653('0x2d')]!==_0x9653('0x4d')){var _0x165d5f={};_0x165d5f[_0x30e472[_0x9653('0x31')]]={'$like':'%'+_0x5f3e0b[_0x9653('0x33')]['filter']+'%'};return _0x165d5f;}})});}_0x5c533f=_['merge']({},_0x5c533f,_0x5f3e0b[_0x9653('0x4e')]);var _0x4d9f78={'where':_0x5c533f[_0x9653('0x49')]};return db['CmHopper'][_0x9653('0x4f')](_0x4d9f78)['then'](function(_0x244781){_0x55f750[_0x9653('0x4f')]=_0x244781;if(_0x5f3e0b[_0x9653('0x33')][_0x9653('0x50')]){_0x5c533f['include']=[{'all':!![]}];}return db[_0x9653('0x2a')]['findAll'](_0x5c533f);})[_0x9653('0x25')](function(_0x30de0d){_0x55f750[_0x9653('0x51')]=_0x30de0d;return _0x55f750;})[_0x9653('0x25')](respondWithFilteredResult(_0x40c5ba,_0x5c533f))[_0x9653('0x52')](handleError(_0x40c5ba,null));};exports[_0x9653('0x53')]=function(_0x1e50e2,_0x46537e){var _0xc60996={'raw':!![],'where':{'id':_0x1e50e2['params']['id']}},_0x165386={};_0x165386['model']=_['keys'](db['CmHopper'][_0x9653('0x2b')]);_0x165386[_0x9653('0x33')]=_[_0x9653('0x32')](_0x1e50e2[_0x9653('0x33')]);_0x165386[_0x9653('0x34')]=_[_0x9653('0x35')](_0x165386[_0x9653('0x2f')],_0x165386['query']);_0xc60996[_0x9653('0x43')]=_['intersection'](_0x165386[_0x9653('0x2f')],qs[_0x9653('0x44')](_0x1e50e2[_0x9653('0x33')][_0x9653('0x44')]));_0xc60996[_0x9653('0x43')]=_0xc60996[_0x9653('0x43')][_0x9653('0x54')]?_0xc60996[_0x9653('0x43')]:_0x165386[_0x9653('0x2f')];if(_0x1e50e2['query'][_0x9653('0x50')]){_0xc60996[_0x9653('0x55')]=[{'all':!![]}];}_0xc60996=_[_0x9653('0x4c')]({},_0xc60996,_0x1e50e2['options']);return db[_0x9653('0x2a')][_0x9653('0x56')](_0xc60996)['then'](handleEntityNotFound(_0x46537e,null))['then'](respondWithResult(_0x46537e,null))[_0x9653('0x52')](handleError(_0x46537e,null));};exports[_0x9653('0x57')]=function(_0x103add,_0x335dbe){return db[_0x9653('0x2a')]['create'](_0x103add['body'],{})[_0x9653('0x25')](respondWithResult(_0x335dbe,0xc9))[_0x9653('0x52')](handleError(_0x335dbe,null));};exports[_0x9653('0x23')]=function(_0x2649dd,_0x44e2d9){if(_0x2649dd[_0x9653('0x58')]['id']){delete _0x2649dd['body']['id'];}return db[_0x9653('0x2a')][_0x9653('0x56')]({'where':{'id':_0x2649dd['params']['id']}})['then'](handleEntityNotFound(_0x44e2d9,null))[_0x9653('0x25')](saveUpdates(_0x2649dd[_0x9653('0x58')],null))[_0x9653('0x25')](respondWithResult(_0x44e2d9,null))[_0x9653('0x52')](handleError(_0x44e2d9,null));};exports[_0x9653('0x59')]=function(_0x53ca6a,_0x4adeba){return db[_0x9653('0x2a')][_0x9653('0x59')]()['then'](respondWithResult(_0x4adeba,null))[_0x9653('0x52')](handleError(_0x4adeba,null));};exports[_0x9653('0x24')]=function(_0x11189c,_0x913f24){var _0x4fb1d4;return db[_0x9653('0x2a')][_0x9653('0x56')]({'where':{'id':_0x11189c['params']['id']}})[_0x9653('0x25')](handleEntityNotFound(_0x913f24,null))[_0x9653('0x25')](function(_0x372264){if(_0x372264){return _0x372264['destroy']()['then'](function(_0x551936){return _0x551936;});}})[_0x9653('0x25')](function(_0x405629){_0x4fb1d4=_0x405629;if(_0x405629){if(_0x405629[_0x9653('0x5a')]||_0x405629['CampaignId']){return db[_0x405629[_0x9653('0x5a')]?_0x9653('0x5b'):'Campaign']['find']({'where':{'id':_0x405629[_0x9653('0x5a')]?_0x405629[_0x9653('0x5a')]:_0x405629['CampaignId']},'attributes':['id',_0x9653('0x31')],'raw':!![]});}}})[_0x9653('0x25')](function(_0x4eded9){var _0x3614bd={};if(_0x4eded9){_[_0x9653('0x4c')](_0x3614bd,_[_0x9653('0x5c')](_0x4fb1d4[_0x9653('0x5d')],['createdAt',_0x9653('0x5e'),'id']));_0x3614bd[_0x9653('0x5f')]=0x15;_0x3614bd[_0x9653('0x60')]=_0x9653('0x61');_0x3614bd[_0x9653('0x62')]=_0x4eded9['name'];_0x3614bd[_0x9653('0x63')]=_0x11189c[_0x9653('0x64')][_0x9653('0x31')];_0x3614bd[_0x9653('0x65')]=_0x11189c[_0x9653('0x64')]['id'];_0x3614bd[_0x9653('0x61')]=!![];_0x3614bd[_0x9653('0x66')]=moment()[_0x9653('0x67')](_0x9653('0x68'));_0x3614bd[_0x9653('0x69')]=_0x4fb1d4[_0x9653('0x6a')];_0x3614bd[_0x9653('0x6b')]=_0x4fb1d4[_0x9653('0x5a')]?'queue':_0x9653('0x6c');return db['CmContact'][_0x9653('0x56')]({'where':{'id':_0x3614bd[_0x9653('0x6d')]},'attributes':[_0x9653('0x6e'),_0x9653('0x6f')]})[_0x9653('0x25')](function(_0x1b0e0b){if(!_['isNil'](_0x913f24)&&!_['isNil'](_0x1b0e0b['firstName'])){_0x3614bd[_0x9653('0x70')]=_0x1b0e0b[_0x9653('0x6e')];if(!_[_0x9653('0x71')](_0x1b0e0b['lastName'])){_0x3614bd[_0x9653('0x70')]+='\x20'+_0x1b0e0b['lastName'];}}})[_0x9653('0x72')](function(){return db[_0x9653('0x73')][_0x9653('0x57')](_0x3614bd);});}})[_0x9653('0x25')](function(){return _0x913f24[_0x9653('0x1b')](0xcc)[_0x9653('0x1c')]();})[_0x9653('0x52')](handleError(_0x913f24,null));};exports[_0x9653('0x74')]=function(_0x36cfe4,_0x515fad,_0x19bcac){var _0xa66d3b=[];return db['CmContact'][_0x9653('0x59')]()[_0x9653('0x25')](function(_0x8e67a1){_0xa66d3b=_['keys'](_0x8e67a1);return _0x36cfe4[_0x9653('0x64')][_0x9653('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x9653('0x76')},'attributes':['id',_0x9653('0x77')],'raw':!![]});})['then'](function(_0x461f22){if(_0x461f22&&_0x461f22[_0x9653('0x54')]){return db[_0x9653('0x78')][_0x9653('0x79')](function(_0x393ce6){var _0x3426df={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9653('0x68'))},'VoiceQueueId':{'$in':_[_0x9653('0x30')](_0x461f22,'id')},'$or':[{'UserId':null},{'UserId':_0x36cfe4[_0x9653('0x64')]['id']}]};var _0x2fd203=[];if(_0x36cfe4['body'][_0x9653('0x7a')]&&_0x36cfe4[_0x9653('0x58')][_0x9653('0x7a')]===_0x9653('0x7b')){if(!_[_0x9653('0x7c')](_0x36cfe4[_0x9653('0x58')]['hopperIds'])){_0x3426df['id']={'$in':_0x36cfe4[_0x9653('0x58')][_0x9653('0x7d')]};}_0x2fd203=[[_0x9653('0x7e'),'ASC'],[_0x9653('0x7f'),_0x461f22[0x0][_0x9653('0x77')]===_0x9653('0x80')?_0x9653('0x81'):_0x9653('0x80')],db[_0x9653('0x78')][_0x9653('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x9653('0x81')]];}else{if(!_['isEmpty'](_0x36cfe4[_0x9653('0x58')]['hopperIds'])){_0x3426df['id']={'$notIn':_0x36cfe4['body'][_0x9653('0x7d')]};}_0x2fd203=[[_0x9653('0x7e'),_0x9653('0x81')],[_0x9653('0x7f'),_0x461f22[0x0][_0x9653('0x77')]],db[_0x9653('0x78')][_0x9653('0x82')](_0x9653('0x83')),['id','ASC']];}return db[_0x9653('0x2a')][_0x9653('0x84')]({'attributes':['id',_0x9653('0x85')],'where':_0x3426df,'order':_0x2fd203,'transaction':_0x393ce6,'lock':_0x393ce6['LOCK'][_0x9653('0x86')],'include':[{'model':db[_0x9653('0x87')],'as':_0x9653('0x88'),'attributes':_0xa66d3b,'include':[{'model':db[_0x9653('0x89')],'as':_0x9653('0x8a'),'attributes':['id','name']}]},{'model':db[_0x9653('0x8b')],'as':'List','attributes':['id','name']},{'model':db[_0x9653('0x5b')],'as':_0x9653('0x8c'),'attributes':['id','name',_0x9653('0x8d')]}]})[_0x9653('0x25')](function(_0x240ec5){if(_0x240ec5){return _0x240ec5['update']({'UserId':_0x36cfe4['user']['id']},{'transaction':_0x393ce6});}});});}})['then'](handleEntityNotFound(_0x515fad,null))['then'](respondWithResult(_0x515fad,null))['catch'](handleError(_0x515fad,null));};exports[_0x9653('0x8e')]=function(_0x3cf16c,_0x507261,_0x440cf7){return _0x3cf16c[_0x9653('0x64')][_0x9653('0x75')]({'where':{'type':_0x9653('0x8f'),'dialActive':!![],'dialMethod':_0x9653('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x17c9b5){if(_0x17c9b5&&_0x17c9b5[_0x9653('0x54')]){return db[_0x9653('0x2a')][_0x9653('0x4f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9653('0x30')](_0x17c9b5,'id')},'$or':[{'UserId':null},{'UserId':_0x3cf16c[_0x9653('0x64')]['id']}]}});}return 0x0;})['then'](function(_0x104516){if(!_[_0x9653('0x71')](_0x104516)&&_[_0x9653('0x90')](_0x104516)){return _0x507261['status'](0xc8)[_0x9653('0x1d')]({'contacts':_0x104516});}else{logger[_0x9653('0x26')](_0x9653('0x91'),'getOpenContacts',0x194,_0x9653('0x92'));_0x507261['sendStatus'](0x194);}})[_0x9653('0x52')](handleError(_0x507261,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 700b2db..97befb9 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 _0x7174=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x12146a,_0x53215a){var _0xf97bba=function(_0x209d4c){while(--_0x209d4c){_0x12146a['push'](_0x12146a['shift']());}};_0xf97bba(++_0x53215a);}(_0x7174,0xd6));var _0x4717=function(_0x3ffa9d,_0x34ca03){_0x3ffa9d=_0x3ffa9d-0x0;var _0x399117=_0x7174[_0x3ffa9d];return _0x399117;};'use strict';var _=require('lodash');var util=require(_0x4717('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4717('0x1'));var rp=require(_0x4717('0x2'));var fs=require('fs');var path=require(_0x4717('0x3'));var rimraf=require(_0x4717('0x4'));var config=require('../../config/environment');var attributes=require(_0x4717('0x5'));module[_0x4717('0x6')]=function(_0x3dffc4,_0xc500c3){return _0x3dffc4[_0x4717('0x7')](_0x4717('0x8'),attributes,{'tableName':_0x4717('0x9'),'paranoid':![],'indexes':[{'name':_0x4717('0xa'),'fields':['scheduledat']},{'name':_0x4717('0xb'),'fields':[_0x4717('0xb')]},{'name':_0x4717('0xc'),'fields':[_0x4717('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9eb=['cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper'];(function(_0xc25ff3,_0x344727){var _0x150f83=function(_0x2a28b5){while(--_0x2a28b5){_0xc25ff3['push'](_0xc25ff3['shift']());}};_0x150f83(++_0x344727);}(_0xc9eb,0x18b));var _0xbc9e=function(_0x267ce2,_0x16d394){_0x267ce2=_0x267ce2-0x0;var _0xcefe7=_0xc9eb[_0x267ce2];return _0xcefe7;};'use strict';var _=require(_0xbc9e('0x0'));var util=require(_0xbc9e('0x1'));var logger=require(_0xbc9e('0x2'))(_0xbc9e('0x3'));var moment=require('moment');var BPromise=require(_0xbc9e('0x4'));var rp=require(_0xbc9e('0x5'));var fs=require('fs');var path=require(_0xbc9e('0x6'));var rimraf=require(_0xbc9e('0x7'));var config=require(_0xbc9e('0x8'));var attributes=require(_0xbc9e('0x9'));module[_0xbc9e('0xa')]=function(_0x20dfac,_0x19c9ae){return _0x20dfac[_0xbc9e('0xb')](_0xbc9e('0xc'),attributes,{'tableName':_0xbc9e('0xd'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xbc9e('0xe')]},{'name':_0xbc9e('0xf'),'fields':[_0xbc9e('0xf')]},{'name':_0xbc9e('0x10'),'fields':[_0xbc9e('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8981a65..47ab3ca 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 _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb10b,0x12a));var _0xbb10=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xb10b[_0x305c31];return _0x17f39f;};'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,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file +var _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bf5bd,_0x120787){_0x2bf5bd=_0x2bf5bd-0x0;var _0xc810c0=_0xb10b[_0x2bf5bd];return _0xc810c0;};'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,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ffef9bc..a4d1c20 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 _0xa226=['isAuthenticated','index','/describe','getOpenContacts','/:id','show','post','create','/preview','getPreview','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xa226,0xf4));var _0x6a22=function(_0xf37faf,_0x45ad87){_0xf37faf=_0xf37faf-0x0;var _0x4f29f4=_0xa226[_0xf37faf];return _0x4f29f4;};'use strict';var multer=require(_0x6a22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a22('0x1'));var express=require(_0x6a22('0x2'));var router=express[_0x6a22('0x3')]();var auth=require(_0x6a22('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6a22('0x5'));var controller=require(_0x6a22('0x6'));router[_0x6a22('0x7')]('/',auth[_0x6a22('0x8')](),controller[_0x6a22('0x9')]);router[_0x6a22('0x7')](_0x6a22('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6a22('0x7')]('/opencontacts',auth[_0x6a22('0x8')](),controller[_0x6a22('0xb')]);router[_0x6a22('0x7')](_0x6a22('0xc'),auth[_0x6a22('0x8')](),controller[_0x6a22('0xd')]);router[_0x6a22('0xe')]('/',auth['isAuthenticated'](),controller[_0x6a22('0xf')]);router[_0x6a22('0xe')](_0x6a22('0x10'),auth[_0x6a22('0x8')](),controller[_0x6a22('0x11')]);router['put'](_0x6a22('0xc'),auth[_0x6a22('0x8')](),controller[_0x6a22('0x12')]);router['delete'](_0x6a22('0xc'),auth[_0x6a22('0x8')](),controller[_0x6a22('0x13')]);module[_0x6a22('0x14')]=router; \ No newline at end of file +var _0x2721=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','/:id','post','create','/preview','getPreview','put','update','destroy','exports'];(function(_0x17ec07,_0xe3ca90){var _0x5a6c45=function(_0x59b715){while(--_0x59b715){_0x17ec07['push'](_0x17ec07['shift']());}};_0x5a6c45(++_0xe3ca90);}(_0x2721,0xb0));var _0x1272=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x2721[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x1272('0x0'));var util=require(_0x1272('0x1'));var path=require('path');var timeout=require(_0x1272('0x2'));var express=require(_0x1272('0x3'));var router=express[_0x1272('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1272('0x5'));var config=require(_0x1272('0x6'));var controller=require(_0x1272('0x7'));router[_0x1272('0x8')]('/',auth[_0x1272('0x9')](),controller[_0x1272('0xa')]);router['get']('/describe',auth[_0x1272('0x9')](),controller[_0x1272('0xb')]);router[_0x1272('0x8')](_0x1272('0xc'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x1272('0x8')](_0x1272('0xd'),auth[_0x1272('0x9')](),controller['show']);router[_0x1272('0xe')]('/',auth['isAuthenticated'](),controller[_0x1272('0xf')]);router[_0x1272('0xe')](_0x1272('0x10'),auth[_0x1272('0x9')](),controller[_0x1272('0x11')]);router[_0x1272('0x12')](_0x1272('0xd'),auth['isAuthenticated'](),controller[_0x1272('0x13')]);router['delete']('/:id',auth[_0x1272('0x9')](),controller[_0x1272('0x14')]);module[_0x1272('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 218cd29..c29c169 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 _0x1b83=['exports','contactListQueue','INTEGER','moment'];(function(_0x8a7eda,_0x214d5d){var _0x2a5352=function(_0x45441f){while(--_0x45441f){_0x8a7eda['push'](_0x8a7eda['shift']());}};_0x2a5352(++_0x214d5d);}(_0x1b83,0x19b));var _0x31b8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1b83[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0x31b8('0x0'));var Sequelize=require('sequelize');module[_0x31b8('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x31b8('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x31b8('0x2')},'VoiceQueueId':{'type':Sequelize[_0x31b8('0x3')],'unique':_0x31b8('0x2')}}; \ No newline at end of file +var _0x1948=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x37cc4c,_0x288c26){var _0x425695=function(_0x355c09){while(--_0x355c09){_0x37cc4c['push'](_0x37cc4c['shift']());}};_0x425695(++_0x288c26);}(_0x1948,0x1ce));var _0x8194=function(_0x5591e3,_0x170f5b){_0x5591e3=_0x5591e3-0x0;var _0x3971eb=_0x1948[_0x5591e3];return _0x3971eb;};'use strict';var moment=require(_0x8194('0x0'));var Sequelize=require(_0x8194('0x1'));module[_0x8194('0x2')]={'phone':{'type':Sequelize[_0x8194('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8194('0x4')],'unique':_0x8194('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8194('0x5')},'VoiceQueueId':{'type':Sequelize[_0x8194('0x4')],'unique':_0x8194('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4ff904a..4c765b5 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x383fa5,_0xe0ca56){var _0x2f8fa4=function(_0x23c4fb){while(--_0x23c4fb){_0x383fa5['push'](_0x383fa5['shift']());}};_0x2f8fa4(++_0xe0ca56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1616af,_0x4ac1e9){var _0x2f66dd=function(_0x35bd07){while(--_0x35bd07){_0x1616af['push'](_0x1616af['shift']());}};_0x2f66dd(++_0x4ac1e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 341d266..c9eb684 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 _0x5d85=['./cmHopperBlack.attributes','exports','CmHopperBlack','lodash','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x3c90d6,_0x41eb61){var _0x480355=function(_0x45b958){while(--_0x45b958){_0x3c90d6['push'](_0x3c90d6['shift']());}};_0x480355(++_0x41eb61);}(_0x5d85,0x198));var _0x55d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d85[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x55d8('0x0'));var util=require(_0x55d8('0x1'));var logger=require(_0x55d8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x55d8('0x3'));var rimraf=require(_0x55d8('0x4'));var config=require(_0x55d8('0x5'));var attributes=require(_0x55d8('0x6'));module[_0x55d8('0x7')]=function(_0x59b1eb,_0x10faa5){return _0x59b1eb['define'](_0x55d8('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58c5=['define','CmHopperBlack','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58c5,0x1d8));var _0x558c=function(_0xf123a,_0x243bc0){_0xf123a=_0xf123a-0x0;var _0x72f421=_0x58c5[_0xf123a];return _0x72f421;};'use strict';var _=require(_0x558c('0x0'));var util=require('util');var logger=require(_0x558c('0x1'))(_0x558c('0x2'));var moment=require(_0x558c('0x3'));var BPromise=require(_0x558c('0x4'));var rp=require(_0x558c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x558c('0x6'));var config=require(_0x558c('0x7'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xb7ddc7,_0x4d55a5){return _0xb7ddc7[_0x558c('0x8')](_0x558c('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 250ac3e..d66eb39 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 _0x4cc3=['CmHopperBlack','options','raw','where','limit','map','include','model','attributes','GetCmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4cc3,0x1eb));var _0x34cc=function(_0x3c0321,_0x4d86db){_0x3c0321=_0x3c0321-0x0;var _0xdf2ba8=_0x4cc3[_0x3c0321];return _0xdf2ba8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x34cc('0x0'));var BPromise=require('bluebird');var rs=require(_0x34cc('0x1'));var fs=require('fs');var Redis=require(_0x34cc('0x2'));var db=require(_0x34cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x34cc('0x4'))(_0x34cc('0x5'));var config=require(_0x34cc('0x6'));var jayson=require(_0x34cc('0x7'));var client=jayson['client'][_0x34cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x588cea,_0x251387,_0x468169){return new BPromise(function(_0x330936,_0x18fde7){return client['request'](_0x588cea,_0x468169)[_0x34cc('0x9')](function(_0x4e70cd){logger[_0x34cc('0xa')](_0x34cc('0xb'),_0x251387,_0x34cc('0xc'));logger[_0x34cc('0xd')](_0x34cc('0xe'),_0x251387,_0x34cc('0xc'),JSON[_0x34cc('0xf')](_0x4e70cd));if(_0x4e70cd[_0x34cc('0x10')]){if(_0x4e70cd['error']['code']===0x1f4){logger[_0x34cc('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x251387,_0x4e70cd[_0x34cc('0x10')][_0x34cc('0x11')]);return _0x18fde7(_0x4e70cd[_0x34cc('0x10')][_0x34cc('0x11')]);}logger['error'](_0x34cc('0xb'),_0x251387,_0x4e70cd['error']['message']);return _0x330936(_0x4e70cd['error']['message']);}else{logger[_0x34cc('0xa')](_0x34cc('0xb'),_0x251387,_0x34cc('0xc'));_0x330936(_0x4e70cd['result'][_0x34cc('0x11')]);}})[_0x34cc('0x12')](function(_0x1e24b1){logger['error'](_0x34cc('0xb'),_0x251387,_0x1e24b1);_0x18fde7(_0x1e24b1);});});}exports['GetCmHopperBlack']=function(_0x35b326){var _0xdb8780=this;return new Promise(function(_0x2d4631,_0x21ffc0){return db[_0x34cc('0x13')]['findAll']({'raw':_0x35b326['options']?_0x35b326[_0x34cc('0x14')][_0x34cc('0x15')]===undefined?!![]:![]:!![],'where':_0x35b326['options']?_0x35b326[_0x34cc('0x14')][_0x34cc('0x16')]||null:null,'attributes':_0x35b326[_0x34cc('0x14')]?_0x35b326[_0x34cc('0x14')]['attributes']||null:null,'limit':_0x35b326[_0x34cc('0x14')]?_0x35b326[_0x34cc('0x14')][_0x34cc('0x17')]||null:null,'include':_0x35b326['options']?_0x35b326[_0x34cc('0x14')]['include']?_[_0x34cc('0x18')](_0x35b326[_0x34cc('0x14')][_0x34cc('0x19')],function(_0x2bd37a){return{'model':db[_0x2bd37a['model']],'as':_0x2bd37a['as'],'attributes':_0x2bd37a['attributes'],'include':_0x2bd37a['include']?_['map'](_0x2bd37a[_0x34cc('0x19')],function(_0x268de4){return{'model':db[_0x268de4[_0x34cc('0x1a')]],'as':_0x268de4['as'],'attributes':_0x268de4[_0x34cc('0x1b')],'include':_0x268de4[_0x34cc('0x19')]?_[_0x34cc('0x18')](_0x268de4[_0x34cc('0x19')],function(_0x2468ba){return{'model':db[_0x2468ba[_0x34cc('0x1a')]],'as':_0x2468ba['as'],'attributes':_0x2468ba[_0x34cc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1911e9){logger['info'](_0x34cc('0x1c'),_0x35b326);logger['debug'](_0x34cc('0x1c'),_0x35b326,JSON[_0x34cc('0xf')](_0x1911e9));_0x2d4631(_0x1911e9);})[_0x34cc('0x12')](function(_0x38bd72){logger['error'](_0x34cc('0x1c'),_0x38bd72[_0x34cc('0x11')],_0x35b326);_0x21ffc0(_0xdb8780[_0x34cc('0x10')](0x1f4,_0x38bd72[_0x34cc('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x7d3022){var _0xa4faf8=this;return new Promise(function(_0x3ffa0c,_0x8dad19){return db['CmHopperBlack'][_0x34cc('0x1d')](_0x7d3022[_0x34cc('0x1e')],{'raw':_0x7d3022['options']?_0x7d3022[_0x34cc('0x14')][_0x34cc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d3022[_0x34cc('0x14')]?_0x7d3022[_0x34cc('0x14')][_0x34cc('0x16')]||null:null,'attributes':_0x7d3022[_0x34cc('0x14')]?_0x7d3022['options'][_0x34cc('0x1b')]||null:null,'limit':_0x7d3022[_0x34cc('0x14')]?_0x7d3022['options'][_0x34cc('0x17')]||null:null})[_0x34cc('0x9')](function(_0x514650){logger[_0x34cc('0xa')]('UpdateCmHopperBlack',_0x7d3022);logger[_0x34cc('0xd')](_0x34cc('0x1f'),_0x7d3022,JSON[_0x34cc('0xf')](_0x514650));_0x3ffa0c(_0x514650);})[_0x34cc('0x12')](function(_0x5b7a0d){logger[_0x34cc('0x10')](_0x34cc('0x1f'),_0x5b7a0d['message'],_0x7d3022);_0x8dad19(_0xa4faf8[_0x34cc('0x10')](0x1f4,_0x5b7a0d['message']));});});};exports[_0x34cc('0x20')]=function(_0x4d0ec8){var _0x2bf066=this;return new Promise(function(_0x5d8790,_0x1262b6){return db[_0x34cc('0x13')][_0x34cc('0x21')]({'where':_0x4d0ec8[_0x34cc('0x14')]?_0x4d0ec8[_0x34cc('0x14')][_0x34cc('0x16')]||null:null})['then'](function(_0x3f0062){logger[_0x34cc('0xa')](_0x34cc('0x20'),_0x4d0ec8);logger[_0x34cc('0xd')](_0x34cc('0x20'),_0x4d0ec8,JSON[_0x34cc('0xf')](_0x3f0062));_0x5d8790(_0x3f0062);})[_0x34cc('0x12')](function(_0x424b6d){logger[_0x34cc('0x10')](_0x34cc('0x20'),_0x424b6d[_0x34cc('0x11')],_0x4d0ec8);_0x1262b6(_0x2bf066[_0x34cc('0x10')](0x1f4,_0x424b6d[_0x34cc('0x11')]));});});}; \ No newline at end of file +var _0x06eb=['where','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x06eb,0xe9));var _0xb06e=function(_0x49239c,_0xd89663){_0x49239c=_0x49239c-0x0;var _0x2ed991=_0x06eb[_0x49239c];return _0x2ed991;};'use strict';var _=require(_0xb06e('0x0'));var util=require(_0xb06e('0x1'));var moment=require(_0xb06e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb06e('0x3'));var fs=require('fs');var Redis=require(_0xb06e('0x4'));var db=require(_0xb06e('0x5'))['db'];var utils=require(_0xb06e('0x6'));var logger=require(_0xb06e('0x7'))('rpc');var config=require(_0xb06e('0x8'));var jayson=require(_0xb06e('0x9'));var client=jayson[_0xb06e('0xa')][_0xb06e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x235d82,_0x572d98,_0x39323e){return new BPromise(function(_0x530462,_0x162bb0){return client[_0xb06e('0xc')](_0x235d82,_0x39323e)[_0xb06e('0xd')](function(_0x1a6be8){logger[_0xb06e('0xe')](_0xb06e('0xf'),_0x572d98,'request\x20sent');logger['debug'](_0xb06e('0x10'),_0x572d98,'request\x20sent',JSON[_0xb06e('0x11')](_0x1a6be8));if(_0x1a6be8[_0xb06e('0x12')]){if(_0x1a6be8[_0xb06e('0x12')]['code']===0x1f4){logger[_0xb06e('0x12')](_0xb06e('0xf'),_0x572d98,_0x1a6be8[_0xb06e('0x12')][_0xb06e('0x13')]);return _0x162bb0(_0x1a6be8[_0xb06e('0x12')]['message']);}logger[_0xb06e('0x12')](_0xb06e('0xf'),_0x572d98,_0x1a6be8[_0xb06e('0x12')][_0xb06e('0x13')]);return _0x530462(_0x1a6be8[_0xb06e('0x12')]['message']);}else{logger[_0xb06e('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x572d98,'request\x20sent');_0x530462(_0x1a6be8[_0xb06e('0x14')][_0xb06e('0x13')]);}})[_0xb06e('0x15')](function(_0x385e29){logger['error'](_0xb06e('0xf'),_0x572d98,_0x385e29);_0x162bb0(_0x385e29);});});}exports[_0xb06e('0x16')]=function(_0xc5eda4){var _0x230d90=this;return new Promise(function(_0x6e580d,_0xe29ea1){return db[_0xb06e('0x17')]['findAll']({'raw':_0xc5eda4[_0xb06e('0x18')]?_0xc5eda4[_0xb06e('0x18')][_0xb06e('0x19')]===undefined?!![]:![]:!![],'where':_0xc5eda4[_0xb06e('0x18')]?_0xc5eda4[_0xb06e('0x18')][_0xb06e('0x1a')]||null:null,'attributes':_0xc5eda4[_0xb06e('0x18')]?_0xc5eda4['options'][_0xb06e('0x1b')]||null:null,'limit':_0xc5eda4['options']?_0xc5eda4[_0xb06e('0x18')][_0xb06e('0x1c')]||null:null,'include':_0xc5eda4[_0xb06e('0x18')]?_0xc5eda4[_0xb06e('0x18')][_0xb06e('0x1d')]?_[_0xb06e('0x1e')](_0xc5eda4['options'][_0xb06e('0x1d')],function(_0x17af6d){return{'model':db[_0x17af6d['model']],'as':_0x17af6d['as'],'attributes':_0x17af6d['attributes'],'include':_0x17af6d[_0xb06e('0x1d')]?_[_0xb06e('0x1e')](_0x17af6d[_0xb06e('0x1d')],function(_0x4d561f){return{'model':db[_0x4d561f[_0xb06e('0x1f')]],'as':_0x4d561f['as'],'attributes':_0x4d561f[_0xb06e('0x1b')],'include':_0x4d561f['include']?_[_0xb06e('0x1e')](_0x4d561f[_0xb06e('0x1d')],function(_0x4ade6a){return{'model':db[_0x4ade6a[_0xb06e('0x1f')]],'as':_0x4ade6a['as'],'attributes':_0x4ade6a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c8221){logger['info']('GetCmHopperBlack',_0xc5eda4);logger[_0xb06e('0x20')](_0xb06e('0x16'),_0xc5eda4,JSON['stringify'](_0x5c8221));_0x6e580d(_0x5c8221);})[_0xb06e('0x15')](function(_0x580504){logger['error'](_0xb06e('0x16'),_0x580504[_0xb06e('0x13')],_0xc5eda4);_0xe29ea1(_0x230d90[_0xb06e('0x12')](0x1f4,_0x580504[_0xb06e('0x13')]));});});};exports[_0xb06e('0x21')]=function(_0x768c06){var _0x11dfbd=this;return new Promise(function(_0x5ed8da,_0xb703c7){return db[_0xb06e('0x17')][_0xb06e('0x22')](_0x768c06[_0xb06e('0x23')],{'raw':_0x768c06['options']?_0x768c06[_0xb06e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x768c06[_0xb06e('0x18')]?_0x768c06[_0xb06e('0x18')][_0xb06e('0x1a')]||null:null,'attributes':_0x768c06[_0xb06e('0x18')]?_0x768c06[_0xb06e('0x18')][_0xb06e('0x1b')]||null:null,'limit':_0x768c06['options']?_0x768c06[_0xb06e('0x18')]['limit']||null:null})[_0xb06e('0xd')](function(_0x1fd1bf){logger['info']('UpdateCmHopperBlack',_0x768c06);logger['debug'](_0xb06e('0x21'),_0x768c06,JSON[_0xb06e('0x11')](_0x1fd1bf));_0x5ed8da(_0x1fd1bf);})[_0xb06e('0x15')](function(_0x1bc438){logger[_0xb06e('0x12')]('UpdateCmHopperBlack',_0x1bc438[_0xb06e('0x13')],_0x768c06);_0xb703c7(_0x11dfbd['error'](0x1f4,_0x1bc438[_0xb06e('0x13')]));});});};exports[_0xb06e('0x24')]=function(_0x5b51b7){var _0x5168a=this;return new Promise(function(_0x1e0224,_0x5dabd0){return db['CmHopperBlack']['destroy']({'where':_0x5b51b7[_0xb06e('0x18')]?_0x5b51b7[_0xb06e('0x18')][_0xb06e('0x1a')]||null:null})[_0xb06e('0xd')](function(_0x4bbe2e){logger[_0xb06e('0xe')](_0xb06e('0x24'),_0x5b51b7);logger['debug']('DestroyCmHopperBlack',_0x5b51b7,JSON[_0xb06e('0x11')](_0x4bbe2e));_0x1e0224(_0x4bbe2e);})['catch'](function(_0x52ff0a){logger['error'](_0xb06e('0x24'),_0x52ff0a[_0xb06e('0x13')],_0x5b51b7);_0x5dabd0(_0x5168a[_0xb06e('0x12')](0x1f4,_0x52ff0a[_0xb06e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ae8cbfa..634ddc1 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 _0x17ba=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0x17ba,0xab));var _0xa17b=function(_0x30a6ba,_0x1d70da){_0x30a6ba=_0x30a6ba-0x0;var _0x156008=_0x17ba[_0x30a6ba];return _0x156008;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var auth=require(_0xa17b('0x5'));var interaction=require(_0xa17b('0x6'));var config=require(_0xa17b('0x7'));var controller=require(_0xa17b('0x8'));router[_0xa17b('0x9')]('/',auth[_0xa17b('0xa')](),controller[_0xa17b('0xb')]);router[_0xa17b('0x9')](_0xa17b('0xc'),auth[_0xa17b('0xa')](),controller[_0xa17b('0xd')]);router[_0xa17b('0x9')](_0xa17b('0xe'),auth[_0xa17b('0xa')](),controller[_0xa17b('0xf')]);router[_0xa17b('0x10')]('/:id',auth[_0xa17b('0xa')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xe'),auth[_0xa17b('0xa')](),controller[_0xa17b('0x13')]);module[_0xa17b('0x14')]=router; \ No newline at end of file +var _0x17ba=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x17ba,0xab));var _0xa17b=function(_0x4b37c8,_0x3d160d){_0x4b37c8=_0x4b37c8-0x0;var _0x547ae8=_0x17ba[_0x4b37c8];return _0x547ae8;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var auth=require(_0xa17b('0x5'));var interaction=require(_0xa17b('0x6'));var config=require(_0xa17b('0x7'));var controller=require(_0xa17b('0x8'));router[_0xa17b('0x9')]('/',auth[_0xa17b('0xa')](),controller[_0xa17b('0xb')]);router[_0xa17b('0x9')](_0xa17b('0xc'),auth[_0xa17b('0xa')](),controller[_0xa17b('0xd')]);router[_0xa17b('0x9')](_0xa17b('0xe'),auth[_0xa17b('0xa')](),controller[_0xa17b('0xf')]);router[_0xa17b('0x10')]('/:id',auth[_0xa17b('0xa')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xe'),auth[_0xa17b('0xa')](),controller[_0xa17b('0x13')]);module[_0xa17b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2553f7d..340edea 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 _0x10f9=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x10f9,0x69));var _0x910f=function(_0x37ed0e,_0x3a4540){_0x37ed0e=_0x37ed0e-0x0;var _0x43546b=_0x10f9[_0x37ed0e];return _0x43546b;};'use strict';var Sequelize=require(_0x910f('0x0'));var moment=require(_0x910f('0x1'));module[_0x910f('0x2')]={'state':{'type':Sequelize[_0x910f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x910f('0x4')]},'scheduledat':{'type':Sequelize[_0x910f('0x5')]},'countbusyretry':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x910f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x910f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x910f('0x4')]},'calleridnum':{'type':Sequelize[_0x910f('0x4')]},'calleridname':{'type':Sequelize[_0x910f('0x4')]},'starttime':{'type':Sequelize[_0x910f('0x5')]},'responsetime':{'type':Sequelize[_0x910f('0x5')]},'answertime':{'type':Sequelize[_0x910f('0x5')]},'droptime':{'type':Sequelize[_0x910f('0x5')]},'endtime':{'type':Sequelize[_0x910f('0x5')]},'ringtime':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x910f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x910f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x910f('0x4')]},'membername':{'type':Sequelize[_0x910f('0x4')]},'reason':{'type':Sequelize[_0x910f('0x4')]},'disposition':{'type':Sequelize[_0x910f('0x4')]},'dispositionat':{'type':Sequelize[_0x910f('0x5')],'set':function(_0x48f829){var _0x1072d1=this[_0x910f('0x6')](_0x910f('0x7'));if(_0x1072d1&&_0x48f829){this[_0x910f('0x8')](_0x910f('0x9'),moment(_0x48f829)[_0x910f('0xa')](moment(_0x1072d1),'seconds'));}return this[_0x910f('0x8')]('dispositionat',_0x48f829);}},'amd':{'type':Sequelize[_0x910f('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x910f('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x910f('0x5')]},'callback':{'type':Sequelize[_0x910f('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x910f('0x5')]},'deleted':{'type':Sequelize[_0x910f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x910f('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf981=['dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','diff','seconds','setDataValue'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf981,0xe6));var _0x1f98=function(_0x3533f6,_0x2ec3f9){_0x3533f6=_0x3533f6-0x0;var _0x1ca10c=_0xf981[_0x3533f6];return _0x1ca10c;};'use strict';var Sequelize=require(_0x1f98('0x0'));var moment=require(_0x1f98('0x1'));module[_0x1f98('0x2')]={'state':{'type':Sequelize[_0x1f98('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x1f98('0x4')]},'scheduledat':{'type':Sequelize[_0x1f98('0x5')]},'countbusyretry':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1f98('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x1f98('0x4')]},'originatecalleridname':{'type':Sequelize[_0x1f98('0x4')]},'calleridnum':{'type':Sequelize[_0x1f98('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1f98('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1f98('0x5')]},'endtime':{'type':Sequelize[_0x1f98('0x5')]},'ringtime':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1f98('0x4')]},'campaign':{'type':Sequelize[_0x1f98('0x4')]},'campaigntype':{'type':Sequelize[_0x1f98('0x4')]},'membername':{'type':Sequelize[_0x1f98('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1f98('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4398ea){var _0x4dddb4=this[_0x1f98('0x6')]('endtime');if(_0x4dddb4&&_0x4398ea){this['setDataValue']('followuptime',moment(_0x4398ea)[_0x1f98('0x7')](moment(_0x4dddb4),_0x1f98('0x8')));}return this[_0x1f98('0x9')](_0x1f98('0xa'),_0x4398ea);}},'amd':{'type':Sequelize[_0x1f98('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1f98('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1f98('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1f98('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1f98('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x1f98('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1f98('0x5')]},'recallme':{'type':Sequelize[_0x1f98('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1f98('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d990d61..f4de3ed 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 _0xb4b6=['CampaignId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','CmHopperFinal','then','includeAll','findAll','rows','catch','show','params','include','options','describe','update','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','CmHopper','findOne'];(function(_0x52d54a,_0x53ab37){var _0x3ec2d3=function(_0x1ca4ea){while(--_0x1ca4ea){_0x52d54a['push'](_0x52d54a['shift']());}};_0x3ec2d3(++_0x53ab37);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x1bbe7b,_0x5926cd){_0x1bbe7b=_0x1bbe7b-0x0;var _0x3310d0=_0xb4b6[_0x1bbe7b];return _0x3310d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b4b('0x0'));var rimraf=require(_0x6b4b('0x1'));var zipdir=require(_0x6b4b('0x2'));var jsonpatch=require(_0x6b4b('0x3'));var rp=require(_0x6b4b('0x4'));var moment=require(_0x6b4b('0x5'));var BPromise=require(_0x6b4b('0x6'));var Mustache=require(_0x6b4b('0x7'));var util=require(_0x6b4b('0x8'));var path=require('path');var sox=require(_0x6b4b('0x9'));var csv=require('to-csv');var ejs=require(_0x6b4b('0xa'));var fs=require('fs');var _=require(_0x6b4b('0xb'));var squel=require(_0x6b4b('0xc'));var crypto=require(_0x6b4b('0xd'));var jsforce=require(_0x6b4b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b4b('0xf'));var querystring=require(_0x6b4b('0x10'));var Papa=require(_0x6b4b('0x11'));var Redis=require(_0x6b4b('0x12'));var authService=require(_0x6b4b('0x13'));var qs=require(_0x6b4b('0x14'));var as=require(_0x6b4b('0x15'));var hardwareService=require(_0x6b4b('0x16'));var logger=require('../../config/logger')(_0x6b4b('0x17'));var utils=require('../../config/utils');var config=require(_0x6b4b('0x18'));var db=require(_0x6b4b('0x19'))['db'];function respondWithStatusCode(_0x45eaa4,_0x2ba8a0){_0x2ba8a0=_0x2ba8a0||0xcc;return function(_0x476d20){if(_0x476d20){return _0x45eaa4[_0x6b4b('0x1a')](_0x2ba8a0);}return _0x45eaa4[_0x6b4b('0x1b')](_0x2ba8a0)['end']();};}function respondWithResult(_0x38c40f,_0x2acc64){_0x2acc64=_0x2acc64||0xc8;return function(_0x3b99db){if(_0x3b99db){return _0x38c40f['status'](_0x2acc64)['json'](_0x3b99db);}};}function respondWithFilteredResult(_0x39390c,_0x2bf3fe){return function(_0x5bf378){if(_0x5bf378){var _0x21ab38=_0x5bf378[_0x6b4b('0x1c')],_0x3842a6=_0x2bf3fe[_0x6b4b('0x1d')],_0x26ac10=_0x2bf3fe[_0x6b4b('0x1d')]+_0x2bf3fe[_0x6b4b('0x1e')],_0x3954d9;if(_0x26ac10>=_0x21ab38){_0x26ac10=_0x21ab38;_0x3954d9=0xc8;}else{_0x3954d9=0xce;}_0x39390c[_0x6b4b('0x1b')](_0x3954d9);return _0x39390c['set']('Content-Range',_0x3842a6+'-'+_0x26ac10+'/'+_0x21ab38)[_0x6b4b('0x1f')](_0x5bf378);}return null;};}function patchUpdates(_0x5b37ce){return function(_0x22f142){try{jsonpatch[_0x6b4b('0x20')](_0x22f142,_0x5b37ce,!![]);}catch(_0x475072){return BPromise[_0x6b4b('0x21')](_0x475072);}return _0x22f142['save']();};}function saveUpdates(_0x35d70b,_0x6235eb){return function(_0x5f2224){if(_0x5f2224){return _0x5f2224['update'](_0x35d70b)['then'](function(_0x4735eb){return _0x4735eb;});}return null;};}function removeEntity(_0x42d10d,_0x203f2a){return function(_0x222e23){if(_0x222e23){return _0x222e23[_0x6b4b('0x22')]()['then'](function(){_0x42d10d[_0x6b4b('0x1b')](0xcc)[_0x6b4b('0x23')]();});}};}function handleEntityNotFound(_0x3a0376,_0xef64c9){return function(_0x595f33){if(!_0x595f33){_0x3a0376['sendStatus'](0x194);}return _0x595f33;};}function handleError(_0x524ac4,_0x4c4ecc){_0x4c4ecc=_0x4c4ecc||0x1f4;return function(_0x17f017){logger['error'](_0x17f017['stack']);if(_0x17f017[_0x6b4b('0x24')]){delete _0x17f017[_0x6b4b('0x24')];}_0x524ac4[_0x6b4b('0x1b')](_0x4c4ecc)[_0x6b4b('0x25')](_0x17f017);};}exports['index']=function(_0x4eff56,_0x19f977){var _0x3ce6b8={},_0x2973f={},_0x17a0c1={'count':0x0,'rows':[]};var _0x5e7c75=_[_0x6b4b('0x26')](db['CmHopperFinal'][_0x6b4b('0x27')],function(_0x1ab47c){return{'name':_0x1ab47c[_0x6b4b('0x28')],'type':_0x1ab47c['type'][_0x6b4b('0x29')]};});_0x2973f[_0x6b4b('0x2a')]=_[_0x6b4b('0x26')](_0x5e7c75,_0x6b4b('0x24'));_0x2973f[_0x6b4b('0x2b')]=_[_0x6b4b('0x2c')](_0x4eff56['query']);_0x2973f['filters']=_['intersection'](_0x2973f[_0x6b4b('0x2a')],_0x2973f[_0x6b4b('0x2b')]);_0x3ce6b8[_0x6b4b('0x2d')]=_[_0x6b4b('0x2e')](_0x2973f[_0x6b4b('0x2a')],qs[_0x6b4b('0x2f')](_0x4eff56['query']['fields']));_0x3ce6b8['attributes']=_0x3ce6b8[_0x6b4b('0x2d')]['length']?_0x3ce6b8[_0x6b4b('0x2d')]:_0x2973f['model'];if(!_0x4eff56['query']['hasOwnProperty'](_0x6b4b('0x30'))){_0x3ce6b8[_0x6b4b('0x1e')]=qs[_0x6b4b('0x1e')](_0x4eff56[_0x6b4b('0x2b')][_0x6b4b('0x1e')]);_0x3ce6b8['offset']=qs[_0x6b4b('0x1d')](_0x4eff56['query'][_0x6b4b('0x1d')]);}_0x3ce6b8['order']=qs[_0x6b4b('0x31')](_0x4eff56[_0x6b4b('0x2b')][_0x6b4b('0x31')]);_0x3ce6b8['where']=qs[_0x6b4b('0x32')](_[_0x6b4b('0x33')](_0x4eff56[_0x6b4b('0x2b')],_0x2973f['filters']),_0x5e7c75);if(_0x4eff56['query'][_0x6b4b('0x34')]){_0x3ce6b8[_0x6b4b('0x35')]=_[_0x6b4b('0x36')](_0x3ce6b8[_0x6b4b('0x35')],{'$or':_[_0x6b4b('0x26')](_0x5e7c75,function(_0x2ff8c2){if(_0x2ff8c2['type']!==_0x6b4b('0x37')){var _0x4cfaf0={};_0x4cfaf0[_0x2ff8c2[_0x6b4b('0x24')]]={'$like':'%'+_0x4eff56[_0x6b4b('0x2b')]['filter']+'%'};return _0x4cfaf0;}})});}_0x3ce6b8=_['merge']({},_0x3ce6b8,_0x4eff56['options']);var _0x3f4016={'where':_0x3ce6b8[_0x6b4b('0x35')]};return db[_0x6b4b('0x38')][_0x6b4b('0x1c')](_0x3f4016)[_0x6b4b('0x39')](function(_0x3089a0){_0x17a0c1[_0x6b4b('0x1c')]=_0x3089a0;if(_0x4eff56[_0x6b4b('0x2b')][_0x6b4b('0x3a')]){_0x3ce6b8['include']=[{'all':!![]}];}return db[_0x6b4b('0x38')][_0x6b4b('0x3b')](_0x3ce6b8);})['then'](function(_0x5ead0d){_0x17a0c1[_0x6b4b('0x3c')]=_0x5ead0d;return _0x17a0c1;})[_0x6b4b('0x39')](respondWithFilteredResult(_0x19f977,_0x3ce6b8))[_0x6b4b('0x3d')](handleError(_0x19f977,null));};exports[_0x6b4b('0x3e')]=function(_0x11dfed,_0x28ca5b){var _0x561716={'raw':!![],'where':{'id':_0x11dfed[_0x6b4b('0x3f')]['id']}},_0x55cd0f={};_0x55cd0f[_0x6b4b('0x2a')]=_[_0x6b4b('0x2c')](db[_0x6b4b('0x38')][_0x6b4b('0x27')]);_0x55cd0f[_0x6b4b('0x2b')]=_['keys'](_0x11dfed[_0x6b4b('0x2b')]);_0x55cd0f[_0x6b4b('0x32')]=_[_0x6b4b('0x2e')](_0x55cd0f[_0x6b4b('0x2a')],_0x55cd0f[_0x6b4b('0x2b')]);_0x561716[_0x6b4b('0x2d')]=_[_0x6b4b('0x2e')](_0x55cd0f[_0x6b4b('0x2a')],qs['fields'](_0x11dfed[_0x6b4b('0x2b')][_0x6b4b('0x2f')]));_0x561716[_0x6b4b('0x2d')]=_0x561716['attributes']['length']?_0x561716[_0x6b4b('0x2d')]:_0x55cd0f[_0x6b4b('0x2a')];if(_0x11dfed[_0x6b4b('0x2b')]['includeAll']){_0x561716[_0x6b4b('0x40')]=[{'all':!![]}];}_0x561716=_['merge']({},_0x561716,_0x11dfed[_0x6b4b('0x41')]);return db[_0x6b4b('0x38')]['find'](_0x561716)[_0x6b4b('0x39')](handleEntityNotFound(_0x28ca5b,null))['then'](respondWithResult(_0x28ca5b,null))[_0x6b4b('0x3d')](handleError(_0x28ca5b,null));};exports['describe']=function(_0x5adc64,_0xab4836){return db[_0x6b4b('0x38')][_0x6b4b('0x42')]()[_0x6b4b('0x39')](respondWithResult(_0xab4836,null))['catch'](handleError(_0xab4836,null));};exports[_0x6b4b('0x43')]=function(_0x136785,_0x2f58d3){if(_0x136785['body']['uniqueid']){delete _0x136785[_0x6b4b('0x44')]['uniqueid'];}return db['CmHopperFinal'][_0x6b4b('0x45')]({'where':{'uniqueid':_0x136785[_0x6b4b('0x3f')]['id']}})[_0x6b4b('0x39')](handleEntityNotFound(_0x2f58d3,null))[_0x6b4b('0x39')](saveUpdates(_0x136785['body'],null))[_0x6b4b('0x39')](respondWithResult(_0x2f58d3,null))[_0x6b4b('0x3d')](handleError(_0x2f58d3,null));};exports[_0x6b4b('0x46')]=function(_0x3a5424,_0x2e8009,_0x387702){return db[_0x6b4b('0x38')][_0x6b4b('0x3b')]({'raw':![],'where':{'VoiceQueueId':_0x3a5424[_0x6b4b('0x3f')]['id']},'attributes':[[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db['sequelize'][_0x6b4b('0x49')](_0x6b4b('0x4a')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')][_0x6b4b('0x49')](_0x6b4b('0x4b')))),_0x6b4b('0x4c')],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db['sequelize']['fn']('IF',db[_0x6b4b('0x47')]['literal'](_0x6b4b('0x4d')))),'busyContacts'],[db[_0x6b4b('0x47')]['fn']('COUNT',db[_0x6b4b('0x47')]['fn']('IF',db['sequelize'][_0x6b4b('0x49')](_0x6b4b('0x4e')))),_0x6b4b('0x4f')],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')]['literal'](_0x6b4b('0x50')))),'dropContacts'],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db['sequelize'][_0x6b4b('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b4b('0x51')],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db['sequelize']['literal'](_0x6b4b('0x52')))),'reCallContacts'],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db['sequelize']['fn']('IF',db[_0x6b4b('0x47')][_0x6b4b('0x49')](_0x6b4b('0x53')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x2e8009,null))['then'](respondWithResult(_0x2e8009,null))[_0x6b4b('0x3d')](handleError(_0x2e8009,null));};exports[_0x6b4b('0x54')]=function(_0x3978aa,_0x9a8237,_0x59c37f){return db[_0x6b4b('0x38')][_0x6b4b('0x3b')]({'raw':![],'where':{'CampaignId':_0x3978aa[_0x6b4b('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b4b('0x48'),db['sequelize']['fn']('IF',db[_0x6b4b('0x47')][_0x6b4b('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x6b4b('0x55')],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')][_0x6b4b('0x49')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')][_0x6b4b('0x49')](_0x6b4b('0x4d')))),_0x6b4b('0x56')],[db['sequelize']['fn']('COUNT',db[_0x6b4b('0x47')]['fn']('IF',db['sequelize'][_0x6b4b('0x49')](_0x6b4b('0x4e')))),_0x6b4b('0x4f')],[db[_0x6b4b('0x47')]['fn']('COUNT',db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')]['literal'](_0x6b4b('0x50')))),'dropContacts'],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db['sequelize'][_0x6b4b('0x49')](_0x6b4b('0x57')))),_0x6b4b('0x51')],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6b4b('0x58')],[db[_0x6b4b('0x47')]['fn'](_0x6b4b('0x48'),db[_0x6b4b('0x47')]['fn']('IF',db[_0x6b4b('0x47')][_0x6b4b('0x49')](_0x6b4b('0x53')))),_0x6b4b('0x59')]]})[_0x6b4b('0x39')](handleEntityNotFound(_0x9a8237,null))['then'](respondWithResult(_0x9a8237,null))[_0x6b4b('0x3d')](handleError(_0x9a8237,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3492cd,_0x106013,_0x5e9214){return db[_0x6b4b('0x5a')][_0x6b4b('0x45')]({'where':{'id':_0x3492cd[_0x6b4b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x106013,null))[_0x6b4b('0x39')](function(_0x498073){var _0xf04bd3;if(_0x498073){_0xf04bd3=squel[_0x6b4b('0x5b')]()[_0x6b4b('0x5c')](_0x6b4b('0x5d'))['fromQuery']([_0x6b4b('0x5e'),_0x6b4b('0x5f'),_0x6b4b('0x60'),'ListId',_0x6b4b('0x61'),'createdAt','updatedAt'],squel[_0x6b4b('0x62')]()[_0x6b4b('0x63')](_0x6b4b('0x64'),_0x6b4b('0x5e'))[_0x6b4b('0x63')](_0x6b4b('0x65'),_0x6b4b('0x5f'))[_0x6b4b('0x63')](_0x6b4b('0x66'),'ContactId')['field'](_0x6b4b('0x67'),_0x6b4b('0x68'))[_0x6b4b('0x63')](_0x6b4b('0x69'),_0x6b4b('0x61'))[_0x6b4b('0x63')](_0x6b4b('0x65'),_0x6b4b('0x6a'))[_0x6b4b('0x63')]('NOW()',_0x6b4b('0x6b'))[_0x6b4b('0x6c')](_0x6b4b('0x6d'))[_0x6b4b('0x35')](_0x6b4b('0x6e'),_0x3492cd[_0x6b4b('0x3f')]['id'][_0x6b4b('0x6f')]())['where']('state\x20=\x20?',_0x3492cd[_0x6b4b('0x44')][_0x6b4b('0x70')][_0x6b4b('0x6f')]())['where'](_0x6b4b('0x71'))[_0x6b4b('0x35')](_0x6b4b('0x72'),squel[_0x6b4b('0x62')]()[_0x6b4b('0x63')](_0x6b4b('0x5e'))[_0x6b4b('0x6c')](_0x6b4b('0x5d'))['where'](_0x6b4b('0x6e'),_0x3492cd[_0x6b4b('0x3f')]['id']['toString']()))[_0x6b4b('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b4b('0x62')]()[_0x6b4b('0x63')](_0x6b4b('0x73'))[_0x6b4b('0x6c')](_0x6b4b('0x6d'))['where']('VoiceQueueId\x20=\x20?',_0x3492cd['params']['id'][_0x6b4b('0x6f')]())[_0x6b4b('0x35')]('state\x20=\x204'))[_0x6b4b('0x74')]('ContactId'))[_0x6b4b('0x6f')]();return db[_0x6b4b('0x47')][_0x6b4b('0x2b')](_0xf04bd3);}return[];})['then'](respondWithResult(_0x106013,null))['catch'](handleError(_0x106013,null));};exports[_0x6b4b('0x75')]=function(_0x42ba01,_0x186f72,_0x307dc5){return db[_0x6b4b('0x76')]['find']({'where':{'id':_0x42ba01[_0x6b4b('0x3f')]['id']}})[_0x6b4b('0x39')](handleEntityNotFound(_0x186f72,null))[_0x6b4b('0x39')](function(_0x17dced){var _0x14b8dd;if(_0x17dced){_0x14b8dd=squel[_0x6b4b('0x5b')]()['into'](_0x6b4b('0x5d'))['fromQuery']([_0x6b4b('0x5e'),'scheduledAt','ContactId',_0x6b4b('0x68'),'CampaignId',_0x6b4b('0x6a'),'updatedAt'],squel[_0x6b4b('0x62')]()[_0x6b4b('0x63')](_0x6b4b('0x64'),_0x6b4b('0x5e'))['field'](_0x6b4b('0x65'),_0x6b4b('0x5f'))[_0x6b4b('0x63')](_0x6b4b('0x66'),_0x6b4b('0x60'))[_0x6b4b('0x63')](_0x6b4b('0x67'),'ListId')['field'](_0x6b4b('0x77'),'CampaignId')[_0x6b4b('0x63')]('NOW()','createdAt')['field'](_0x6b4b('0x65'),_0x6b4b('0x6b'))[_0x6b4b('0x6c')](_0x6b4b('0x6d'))[_0x6b4b('0x35')]('CampaignId\x20=\x20?',_0x42ba01[_0x6b4b('0x3f')]['id']['toString']())['where'](_0x6b4b('0x78'),_0x42ba01[_0x6b4b('0x44')][_0x6b4b('0x70')][_0x6b4b('0x6f')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x6b4b('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b4b('0x62')]()['field'](_0x6b4b('0x5e'))['from'](_0x6b4b('0x5d'))[_0x6b4b('0x35')](_0x6b4b('0x79'),_0x42ba01['params']['id'][_0x6b4b('0x6f')]()))[_0x6b4b('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b4b('0x62')]()['field'](_0x6b4b('0x73'))[_0x6b4b('0x6c')](_0x6b4b('0x6d'))[_0x6b4b('0x35')](_0x6b4b('0x79'),_0x42ba01[_0x6b4b('0x3f')]['id']['toString']())[_0x6b4b('0x35')]('state\x20=\x204'))[_0x6b4b('0x74')](_0x6b4b('0x60')))[_0x6b4b('0x6f')]();return db[_0x6b4b('0x47')][_0x6b4b('0x2b')](_0x14b8dd);}return[];})[_0x6b4b('0x39')](respondWithResult(_0x186f72,null))[_0x6b4b('0x3d')](handleError(_0x186f72,null));};exports['checkContactHopper']=function(_0x48de53,_0x3a6e35,_0x3db8cb){return db[_0x6b4b('0x7a')][_0x6b4b('0x7b')]({'where':{'VoiceQueueId':_0x48de53[_0x6b4b('0x44')][_0x6b4b('0x61')],'CampaignId':_0x48de53[_0x6b4b('0x44')][_0x6b4b('0x7c')],'ContactId':_0x48de53[_0x6b4b('0x44')][_0x6b4b('0x60')]}})[_0x6b4b('0x39')](handleEntityNotFound(_0x3a6e35,null))[_0x6b4b('0x39')](function(_0x2e815e){if(_0x2e815e){return _0x2e815e;}return null;})[_0x6b4b('0x39')](respondWithResult(_0x3a6e35,null))[_0x6b4b('0x3d')](handleError(_0x3a6e35,null));}; \ No newline at end of file +var _0xd1ca=['where','filters','pick','filter','merge','count','includeAll','include','catch','show','params','keys','options','find','describe','body','uniqueid','findAll','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','reCallContacts','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','from','cm_hopper_final','state\x20=\x20?','toString','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','state','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0xd0a839,_0x46e8de){var _0x3fc69f=function(_0x4b2f9d){while(--_0x4b2f9d){_0xd0a839['push'](_0xd0a839['shift']());}};_0x3fc69f(++_0x46e8de);}(_0xd1ca,0x140));var _0xad1c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd1ca[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xad1c('0x0'));var emlformat=require(_0xad1c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xad1c('0x2'));var moment=require(_0xad1c('0x3'));var BPromise=require(_0xad1c('0x4'));var Mustache=require('mustache');var util=require(_0xad1c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xad1c('0x6'));var ejs=require(_0xad1c('0x7'));var fs=require('fs');var _=require(_0xad1c('0x8'));var squel=require('squel');var crypto=require(_0xad1c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad1c('0xa'));var toCsv=require(_0xad1c('0x6'));var querystring=require(_0xad1c('0xb'));var Papa=require(_0xad1c('0xc'));var Redis=require(_0xad1c('0xd'));var authService=require(_0xad1c('0xe'));var qs=require(_0xad1c('0xf'));var as=require(_0xad1c('0x10'));var hardwareService=require(_0xad1c('0x11'));var logger=require(_0xad1c('0x12'))('api');var utils=require(_0xad1c('0x13'));var config=require(_0xad1c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4615a4,_0x7494c3){_0x7494c3=_0x7494c3||0xcc;return function(_0xd5bdd7){if(_0xd5bdd7){return _0x4615a4[_0xad1c('0x15')](_0x7494c3);}return _0x4615a4[_0xad1c('0x16')](_0x7494c3)[_0xad1c('0x17')]();};}function respondWithResult(_0xeebfde,_0x4ce86e){_0x4ce86e=_0x4ce86e||0xc8;return function(_0x324030){if(_0x324030){return _0xeebfde[_0xad1c('0x16')](_0x4ce86e)[_0xad1c('0x18')](_0x324030);}};}function respondWithFilteredResult(_0x5b6015,_0x210eba){return function(_0x494b59){if(_0x494b59){var _0x4194c0=_0x494b59['count'],_0x48c651=_0x210eba[_0xad1c('0x19')],_0x2173e5=_0x210eba['offset']+_0x210eba[_0xad1c('0x1a')],_0x8420de;if(_0x2173e5>=_0x4194c0){_0x2173e5=_0x4194c0;_0x8420de=0xc8;}else{_0x8420de=0xce;}_0x5b6015[_0xad1c('0x16')](_0x8420de);return _0x5b6015['set']('Content-Range',_0x48c651+'-'+_0x2173e5+'/'+_0x4194c0)[_0xad1c('0x18')](_0x494b59);}return null;};}function patchUpdates(_0xa353d8){return function(_0x20850d){try{jsonpatch[_0xad1c('0x1b')](_0x20850d,_0xa353d8,!![]);}catch(_0x519d1b){return BPromise[_0xad1c('0x1c')](_0x519d1b);}return _0x20850d[_0xad1c('0x1d')]();};}function saveUpdates(_0xa80469,_0x51d25c){return function(_0x5e2d17){if(_0x5e2d17){return _0x5e2d17[_0xad1c('0x1e')](_0xa80469)[_0xad1c('0x1f')](function(_0x328b63){return _0x328b63;});}return null;};}function removeEntity(_0x2b23eb,_0x1008c3){return function(_0x16f940){if(_0x16f940){return _0x16f940[_0xad1c('0x20')]()['then'](function(){_0x2b23eb[_0xad1c('0x16')](0xcc)[_0xad1c('0x17')]();});}};}function handleEntityNotFound(_0x2b33ab,_0x509c13){return function(_0x42e527){if(!_0x42e527){_0x2b33ab[_0xad1c('0x15')](0x194);}return _0x42e527;};}function handleError(_0x518a14,_0x3b3bf3){_0x3b3bf3=_0x3b3bf3||0x1f4;return function(_0x58b727){logger[_0xad1c('0x21')](_0x58b727[_0xad1c('0x22')]);if(_0x58b727[_0xad1c('0x23')]){delete _0x58b727[_0xad1c('0x23')];}_0x518a14['status'](_0x3b3bf3)[_0xad1c('0x24')](_0x58b727);};}exports[_0xad1c('0x25')]=function(_0x44a938,_0x345174){var _0x30abaa={},_0x5c1203={},_0x2a26c0={'count':0x0,'rows':[]};var _0x5518e0=_[_0xad1c('0x26')](db[_0xad1c('0x27')]['rawAttributes'],function(_0x35406d){return{'name':_0x35406d[_0xad1c('0x28')],'type':_0x35406d[_0xad1c('0x29')]['key']};});_0x5c1203['model']=_[_0xad1c('0x26')](_0x5518e0,'name');_0x5c1203[_0xad1c('0x2a')]=_['keys'](_0x44a938[_0xad1c('0x2a')]);_0x5c1203['filters']=_[_0xad1c('0x2b')](_0x5c1203[_0xad1c('0x2c')],_0x5c1203[_0xad1c('0x2a')]);_0x30abaa[_0xad1c('0x2d')]=_[_0xad1c('0x2b')](_0x5c1203[_0xad1c('0x2c')],qs[_0xad1c('0x2e')](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x2e')]));_0x30abaa[_0xad1c('0x2d')]=_0x30abaa['attributes'][_0xad1c('0x2f')]?_0x30abaa[_0xad1c('0x2d')]:_0x5c1203['model'];if(!_0x44a938[_0xad1c('0x2a')][_0xad1c('0x30')](_0xad1c('0x31'))){_0x30abaa['limit']=qs['limit'](_0x44a938[_0xad1c('0x2a')]['limit']);_0x30abaa[_0xad1c('0x19')]=qs[_0xad1c('0x19')](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x19')]);}_0x30abaa[_0xad1c('0x32')]=qs['sort'](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x33')]);_0x30abaa[_0xad1c('0x34')]=qs[_0xad1c('0x35')](_[_0xad1c('0x36')](_0x44a938['query'],_0x5c1203[_0xad1c('0x35')]),_0x5518e0);if(_0x44a938[_0xad1c('0x2a')][_0xad1c('0x37')]){_0x30abaa[_0xad1c('0x34')]=_[_0xad1c('0x38')](_0x30abaa[_0xad1c('0x34')],{'$or':_[_0xad1c('0x26')](_0x5518e0,function(_0x28c80e){if(_0x28c80e[_0xad1c('0x29')]!=='VIRTUAL'){var _0x1c44c7={};_0x1c44c7[_0x28c80e[_0xad1c('0x23')]]={'$like':'%'+_0x44a938[_0xad1c('0x2a')]['filter']+'%'};return _0x1c44c7;}})});}_0x30abaa=_[_0xad1c('0x38')]({},_0x30abaa,_0x44a938['options']);var _0x562ceb={'where':_0x30abaa[_0xad1c('0x34')]};return db[_0xad1c('0x27')][_0xad1c('0x39')](_0x562ceb)[_0xad1c('0x1f')](function(_0x36f821){_0x2a26c0[_0xad1c('0x39')]=_0x36f821;if(_0x44a938['query'][_0xad1c('0x3a')]){_0x30abaa[_0xad1c('0x3b')]=[{'all':!![]}];}return db[_0xad1c('0x27')]['findAll'](_0x30abaa);})['then'](function(_0xaf9013){_0x2a26c0['rows']=_0xaf9013;return _0x2a26c0;})[_0xad1c('0x1f')](respondWithFilteredResult(_0x345174,_0x30abaa))[_0xad1c('0x3c')](handleError(_0x345174,null));};exports[_0xad1c('0x3d')]=function(_0x6ad690,_0x5a2301){var _0x1b5a1a={'raw':!![],'where':{'id':_0x6ad690[_0xad1c('0x3e')]['id']}},_0x1f91d4={};_0x1f91d4[_0xad1c('0x2c')]=_[_0xad1c('0x3f')](db['CmHopperFinal']['rawAttributes']);_0x1f91d4['query']=_[_0xad1c('0x3f')](_0x6ad690[_0xad1c('0x2a')]);_0x1f91d4[_0xad1c('0x35')]=_[_0xad1c('0x2b')](_0x1f91d4[_0xad1c('0x2c')],_0x1f91d4[_0xad1c('0x2a')]);_0x1b5a1a[_0xad1c('0x2d')]=_[_0xad1c('0x2b')](_0x1f91d4[_0xad1c('0x2c')],qs[_0xad1c('0x2e')](_0x6ad690[_0xad1c('0x2a')][_0xad1c('0x2e')]));_0x1b5a1a[_0xad1c('0x2d')]=_0x1b5a1a[_0xad1c('0x2d')][_0xad1c('0x2f')]?_0x1b5a1a['attributes']:_0x1f91d4[_0xad1c('0x2c')];if(_0x6ad690['query'][_0xad1c('0x3a')]){_0x1b5a1a[_0xad1c('0x3b')]=[{'all':!![]}];}_0x1b5a1a=_[_0xad1c('0x38')]({},_0x1b5a1a,_0x6ad690[_0xad1c('0x40')]);return db[_0xad1c('0x27')][_0xad1c('0x41')](_0x1b5a1a)[_0xad1c('0x1f')](handleEntityNotFound(_0x5a2301,null))['then'](respondWithResult(_0x5a2301,null))['catch'](handleError(_0x5a2301,null));};exports[_0xad1c('0x42')]=function(_0x233a1b,_0x2d97af){return db['CmHopperFinal'][_0xad1c('0x42')]()['then'](respondWithResult(_0x2d97af,null))['catch'](handleError(_0x2d97af,null));};exports[_0xad1c('0x1e')]=function(_0x1d4e86,_0x39d597){if(_0x1d4e86[_0xad1c('0x43')][_0xad1c('0x44')]){delete _0x1d4e86[_0xad1c('0x43')][_0xad1c('0x44')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x1d4e86[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x39d597,null))[_0xad1c('0x1f')](saveUpdates(_0x1d4e86[_0xad1c('0x43')],null))[_0xad1c('0x1f')](respondWithResult(_0x39d597,null))[_0xad1c('0x3c')](handleError(_0x39d597,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x19cd6f,_0x357c21,_0x222049){return db[_0xad1c('0x27')][_0xad1c('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x19cd6f[_0xad1c('0x3e')]['id']},'attributes':[[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db['sequelize']['fn']('IF',db[_0xad1c('0x46')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xad1c('0x48')],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4a')))),_0xad1c('0x4b')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4c')))),'busyContacts'],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4d')))),_0xad1c('0x4e')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal'](_0xad1c('0x4f')))),_0xad1c('0x50')],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize'][_0xad1c('0x49')](_0xad1c('0x51')))),_0xad1c('0x52')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x53')))),'reCallContacts'],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x357c21,null))[_0xad1c('0x1f')](respondWithResult(_0x357c21,null))[_0xad1c('0x3c')](handleError(_0x357c21,null));};exports[_0xad1c('0x55')]=function(_0xb12705,_0x3b98f7,_0x19c879){return db[_0xad1c('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0xb12705['params']['id']},'attributes':[[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize']['literal'](_0xad1c('0x56')))),_0xad1c('0x48')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4a')))),_0xad1c('0x4b')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4c')))),_0xad1c('0x57')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize'][_0xad1c('0x49')](_0xad1c('0x4d')))),_0xad1c('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xad1c('0x50')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db['sequelize']['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x51')))),_0xad1c('0x52')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x53')))),_0xad1c('0x58')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal'](_0xad1c('0x54')))),_0xad1c('0x59')]]})[_0xad1c('0x1f')](handleEntityNotFound(_0x3b98f7,null))[_0xad1c('0x1f')](respondWithResult(_0x3b98f7,null))['catch'](handleError(_0x3b98f7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2dd27a,_0x2940af,_0x5df53a){return db[_0xad1c('0x5a')]['find']({'where':{'id':_0x2dd27a[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x2940af,null))[_0xad1c('0x1f')](function(_0x1eea0f){var _0x46a365;if(_0x1eea0f){_0x46a365=squel[_0xad1c('0x5b')]()[_0xad1c('0x5c')](_0xad1c('0x5d'))[_0xad1c('0x5e')]([_0xad1c('0x5f'),_0xad1c('0x60'),_0xad1c('0x61'),_0xad1c('0x62'),_0xad1c('0x63'),_0xad1c('0x64'),_0xad1c('0x65')],squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x68'),_0xad1c('0x5f'))[_0xad1c('0x67')]('NOW()',_0xad1c('0x60'))['field']('ANY_VALUE(ContactId)',_0xad1c('0x61'))[_0xad1c('0x67')]('ANY_VALUE(ListId)',_0xad1c('0x62'))[_0xad1c('0x67')]('ANY_VALUE(VoiceQueueId)',_0xad1c('0x63'))['field']('NOW()',_0xad1c('0x64'))['field'](_0xad1c('0x69'),_0xad1c('0x65'))[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('VoiceQueueId\x20=\x20?',_0x2dd27a['params']['id']['toString']())[_0xad1c('0x34')](_0xad1c('0x6c'),_0x2dd27a['body']['state'][_0xad1c('0x6d')]())[_0xad1c('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x5f'))[_0xad1c('0x6a')](_0xad1c('0x5d'))[_0xad1c('0x34')](_0xad1c('0x6f'),_0x2dd27a[_0xad1c('0x3e')]['id']['toString']()))[_0xad1c('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('calleridnum')[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')](_0xad1c('0x6f'),_0x2dd27a['params']['id'][_0xad1c('0x6d')]())[_0xad1c('0x34')](_0xad1c('0x70')))[_0xad1c('0x71')]('ContactId'))['toString']();return db[_0xad1c('0x46')][_0xad1c('0x2a')](_0x46a365);}return[];})['then'](respondWithResult(_0x2940af,null))[_0xad1c('0x3c')](handleError(_0x2940af,null));};exports[_0xad1c('0x72')]=function(_0x2db5c8,_0x7b7f7b,_0xf5f219){return db[_0xad1c('0x73')][_0xad1c('0x41')]({'where':{'id':_0x2db5c8[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x7b7f7b,null))[_0xad1c('0x1f')](function(_0x565a15){var _0x39911f;if(_0x565a15){_0x39911f=squel[_0xad1c('0x5b')]()[_0xad1c('0x5c')]('cm_hopper')['fromQuery']([_0xad1c('0x5f'),'scheduledAt',_0xad1c('0x61'),_0xad1c('0x62'),'CampaignId',_0xad1c('0x64'),_0xad1c('0x65')],squel[_0xad1c('0x66')]()[_0xad1c('0x67')]('ANY_VALUE(calleridnum)',_0xad1c('0x5f'))[_0xad1c('0x67')](_0xad1c('0x69'),_0xad1c('0x60'))[_0xad1c('0x67')]('ANY_VALUE(ContactId)',_0xad1c('0x61'))[_0xad1c('0x67')](_0xad1c('0x74'),_0xad1c('0x62'))['field'](_0xad1c('0x75'),_0xad1c('0x76'))['field']('NOW()',_0xad1c('0x64'))['field'](_0xad1c('0x69'),_0xad1c('0x65'))[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8[_0xad1c('0x3e')]['id'][_0xad1c('0x6d')]())['where']('state\x20=\x20?',_0x2db5c8['body'][_0xad1c('0x77')][_0xad1c('0x6d')]())[_0xad1c('0x34')](_0xad1c('0x78'))[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x5f'))['from'](_0xad1c('0x5d'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8['params']['id'][_0xad1c('0x6d')]()))[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()['field']('calleridnum')[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8[_0xad1c('0x3e')]['id'][_0xad1c('0x6d')]())[_0xad1c('0x34')]('state\x20=\x204'))[_0xad1c('0x71')]('ContactId'))['toString']();return db['sequelize']['query'](_0x39911f);}return[];})[_0xad1c('0x1f')](respondWithResult(_0x7b7f7b,null))[_0xad1c('0x3c')](handleError(_0x7b7f7b,null));};exports[_0xad1c('0x79')]=function(_0x1203d2,_0x1df7e9,_0x32e3b4){return db[_0xad1c('0x7a')][_0xad1c('0x7b')]({'where':{'VoiceQueueId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x63')],'CampaignId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x76')],'ContactId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x61')]}})['then'](handleEntityNotFound(_0x1df7e9,null))[_0xad1c('0x1f')](function(_0x3c8941){if(_0x3c8941){return _0x3c8941;}return null;})[_0xad1c('0x1f')](respondWithResult(_0x1df7e9,null))[_0xad1c('0x3c')](handleError(_0x1df7e9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d202fa2..8780ec3 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 _0x395a=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger'];(function(_0x55a511,_0x2ec93d){var _0x52dc79=function(_0x1425bb){while(--_0x1425bb){_0x55a511['push'](_0x55a511['shift']());}};_0x52dc79(++_0x2ec93d);}(_0x395a,0x83));var _0xa395=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x395a[_0x1e3671];return _0x48d5f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa395('0x0'))(_0xa395('0x1'));var moment=require('moment');var BPromise=require(_0xa395('0x2'));var rp=require(_0xa395('0x3'));var fs=require('fs');var path=require(_0xa395('0x4'));var rimraf=require(_0xa395('0x5'));var config=require(_0xa395('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0xa395('0x7')]=function(_0x5bd0f9,_0x11270b){return _0x5bd0f9['define'](_0xa395('0x8'),attributes,{'tableName':_0xa395('0x9'),'paranoid':![],'indexes':[{'name':_0xa395('0xa'),'fields':['calleridnum']},{'name':_0xa395('0xb'),'fields':[_0xa395('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe54f=['util','../../config/logger','moment','bluebird','request-promise','rimraf','CmHopperFinal','calleridnum','uniqueid','lodash'];(function(_0x375760,_0x187023){var _0x5d2cb1=function(_0x8a2d38){while(--_0x8a2d38){_0x375760['push'](_0x375760['shift']());}};_0x5d2cb1(++_0x187023);}(_0xe54f,0x95));var _0xfe54=function(_0x64e3c1,_0x14da00){_0x64e3c1=_0x64e3c1-0x0;var _0x44adc8=_0xe54f[_0x64e3c1];return _0x44adc8;};'use strict';var _=require(_0xfe54('0x0'));var util=require(_0xfe54('0x1'));var logger=require(_0xfe54('0x2'))('api');var moment=require(_0xfe54('0x3'));var BPromise=require(_0xfe54('0x4'));var rp=require(_0xfe54('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe54('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x23d946,_0x222a24){return _0x23d946['define'](_0xfe54('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xfe54('0x8'),'fields':[_0xfe54('0x8')]},{'name':_0xfe54('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1c2541d..2f70460 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 _0x92e0=['message','result','CreateCmHopperFinal','CmHopperFinal','create','body','options','then','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ddc52,_0x300392){var _0x1fd749=function(_0x2ea81b){while(--_0x2ea81b){_0x3ddc52['push'](_0x3ddc52['shift']());}};_0x1fd749(++_0x300392);}(_0x92e0,0x167));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x092e('0x0'));var BPromise=require('bluebird');var rs=require(_0x092e('0x1'));var fs=require('fs');var Redis=require(_0x092e('0x2'));var db=require(_0x092e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x092e('0x4'))(_0x092e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x092e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9fede8,_0x23ab97,_0x36e5b8){return new BPromise(function(_0x511d40,_0x3edfb8){return client[_0x092e('0x7')](_0x9fede8,_0x36e5b8)['then'](function(_0x398b71){logger[_0x092e('0x8')](_0x092e('0x9'),_0x23ab97,_0x092e('0xa'));logger[_0x092e('0xb')](_0x092e('0xc'),_0x23ab97,_0x092e('0xa'),JSON[_0x092e('0xd')](_0x398b71));if(_0x398b71['error']){if(_0x398b71[_0x092e('0xe')][_0x092e('0xf')]===0x1f4){logger['error'](_0x092e('0x9'),_0x23ab97,_0x398b71[_0x092e('0xe')][_0x092e('0x10')]);return _0x3edfb8(_0x398b71['error'][_0x092e('0x10')]);}logger['error'](_0x092e('0x9'),_0x23ab97,_0x398b71['error'][_0x092e('0x10')]);return _0x511d40(_0x398b71[_0x092e('0xe')][_0x092e('0x10')]);}else{logger[_0x092e('0x8')](_0x092e('0x9'),_0x23ab97,_0x092e('0xa'));_0x511d40(_0x398b71[_0x092e('0x11')][_0x092e('0x10')]);}})['catch'](function(_0x4bf481){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x23ab97,_0x4bf481);_0x3edfb8(_0x4bf481);});});}exports[_0x092e('0x12')]=function(_0x34f3f1){var _0x5c8bc1=this;return new Promise(function(_0x2f4b6c,_0x873daa){return db[_0x092e('0x13')][_0x092e('0x14')](_0x34f3f1[_0x092e('0x15')],{'raw':_0x34f3f1[_0x092e('0x16')]?_0x34f3f1[_0x092e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x092e('0x17')](function(_0x4c42d5){logger['info'](_0x092e('0x12'),_0x34f3f1);logger['debug'](_0x092e('0x12'),_0x34f3f1,JSON[_0x092e('0xd')](_0x4c42d5));_0x2f4b6c(_0x4c42d5);})[_0x092e('0x18')](function(_0x4e3e26){logger['error'](_0x092e('0x12'),_0x4e3e26[_0x092e('0x10')],_0x34f3f1);_0x873daa(_0x5c8bc1['error'](0x1f4,_0x4e3e26[_0x092e('0x10')]));});});}; \ No newline at end of file +var _0x655d=['jayson/promise','client','http','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperFinal','create','options','CreateCmHopperFinal','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x655d,0x172));var _0xd655=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x655d[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd655('0x0'));var util=require('util');var moment=require(_0xd655('0x1'));var BPromise=require(_0xd655('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd655('0x3'));var db=require(_0xd655('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd655('0x5'))(_0xd655('0x6'));var config=require(_0xd655('0x7'));var jayson=require(_0xd655('0x8'));var client=jayson[_0xd655('0x9')][_0xd655('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ceead,_0x33bd1d,_0x3f49b4){return new BPromise(function(_0x46dd2c,_0x251dd8){return client['request'](_0x2ceead,_0x3f49b4)[_0xd655('0xb')](function(_0x4dbcc9){logger[_0xd655('0xc')](_0xd655('0xd'),_0x33bd1d,_0xd655('0xe'));logger[_0xd655('0xf')](_0xd655('0x10'),_0x33bd1d,_0xd655('0xe'),JSON[_0xd655('0x11')](_0x4dbcc9));if(_0x4dbcc9[_0xd655('0x12')]){if(_0x4dbcc9[_0xd655('0x12')][_0xd655('0x13')]===0x1f4){logger[_0xd655('0x12')](_0xd655('0xd'),_0x33bd1d,_0x4dbcc9[_0xd655('0x12')][_0xd655('0x14')]);return _0x251dd8(_0x4dbcc9['error'][_0xd655('0x14')]);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x33bd1d,_0x4dbcc9[_0xd655('0x12')][_0xd655('0x14')]);return _0x46dd2c(_0x4dbcc9[_0xd655('0x12')][_0xd655('0x14')]);}else{logger[_0xd655('0xc')](_0xd655('0xd'),_0x33bd1d,'request\x20sent');_0x46dd2c(_0x4dbcc9[_0xd655('0x15')][_0xd655('0x14')]);}})[_0xd655('0x16')](function(_0x517fba){logger['error'](_0xd655('0xd'),_0x33bd1d,_0x517fba);_0x251dd8(_0x517fba);});});}exports['CreateCmHopperFinal']=function(_0x54235a){var _0x3008e6=this;return new Promise(function(_0x4ac7ca,_0x4b5eac){return db[_0xd655('0x17')][_0xd655('0x18')](_0x54235a['body'],{'raw':_0x54235a[_0xd655('0x19')]?_0x54235a['options']['raw']===undefined?!![]:![]:!![]})[_0xd655('0xb')](function(_0x525c3b){logger[_0xd655('0xc')](_0xd655('0x1a'),_0x54235a);logger[_0xd655('0xf')]('CreateCmHopperFinal',_0x54235a,JSON['stringify'](_0x525c3b));_0x4ac7ca(_0x525c3b);})[_0xd655('0x16')](function(_0x3921c0){logger[_0xd655('0x12')](_0xd655('0x1a'),_0x3921c0[_0xd655('0x14')],_0x54235a);_0x4b5eac(_0x3008e6['error'](0x1f4,_0x3921c0['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e535ac9..6c7d24e 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 _0xc59a=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','exports'];(function(_0x8e0075,_0x401880){var _0x376d13=function(_0x1e99d3){while(--_0x1e99d3){_0x8e0075['push'](_0x8e0075['shift']());}};_0x376d13(++_0x401880);}(_0xc59a,0xb8));var _0xac59=function(_0x5db0f7,_0x5e5893){_0x5db0f7=_0x5db0f7-0x0;var _0x56afaa=_0xc59a[_0x5db0f7];return _0x56afaa;};'use strict';var multer=require(_0xac59('0x0'));var util=require(_0xac59('0x1'));var path=require(_0xac59('0x2'));var timeout=require('connect-timeout');var express=require(_0xac59('0x3'));var router=express[_0xac59('0x4')]();var auth=require(_0xac59('0x5'));var interaction=require(_0xac59('0x6'));var config=require(_0xac59('0x7'));var controller=require(_0xac59('0x8'));router[_0xac59('0x9')]('/',auth[_0xac59('0xa')](),controller[_0xac59('0xb')]);router[_0xac59('0x9')](_0xac59('0xc'),auth[_0xac59('0xa')](),controller[_0xac59('0xd')]);router[_0xac59('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xac59('0xe')]);router[_0xac59('0x9')]('/voice/queue/countAttributes/:id',auth[_0xac59('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xac59('0x9')]('/campaign/countAttributes/:id',auth[_0xac59('0xa')](),controller[_0xac59('0xf')]);router[_0xac59('0x10')]('/voice/queue/moveContacts/:id',auth[_0xac59('0xa')](),controller[_0xac59('0x11')]);router[_0xac59('0x10')]('/voice/campaign/moveContacts/:id',auth[_0xac59('0xa')](),controller[_0xac59('0x12')]);router['post'](_0xac59('0x13'),auth['isAuthenticated'](),controller[_0xac59('0x14')]);router['put'](_0xac59('0x15'),auth['isAuthenticated'](),controller['update']);module[_0xac59('0x16')]=router; \ No newline at end of file +var _0xa638=['util','express','Router','../../config/environment','./cmHopperFinal.controller','get','index','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer'];(function(_0x56ac9f,_0x34875a){var _0x3fc3a7=function(_0x161a32){while(--_0x161a32){_0x56ac9f['push'](_0x56ac9f['shift']());}};_0x3fc3a7(++_0x34875a);}(_0xa638,0x72));var _0x8a63=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xa638[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x8a63('0x0'));var util=require(_0x8a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a63('0x2'));var router=express[_0x8a63('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a63('0x4'));var controller=require(_0x8a63('0x5'));router[_0x8a63('0x6')]('/',auth['isAuthenticated'](),controller[_0x8a63('0x7')]);router[_0x8a63('0x6')]('/describe',auth[_0x8a63('0x8')](),controller[_0x8a63('0x9')]);router[_0x8a63('0x6')](_0x8a63('0xa'),auth[_0x8a63('0x8')](),controller['show']);router[_0x8a63('0x6')](_0x8a63('0xb'),auth[_0x8a63('0x8')](),controller[_0x8a63('0xc')]);router[_0x8a63('0x6')](_0x8a63('0xd'),auth[_0x8a63('0x8')](),controller[_0x8a63('0xe')]);router[_0x8a63('0xf')](_0x8a63('0x10'),auth[_0x8a63('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x8a63('0xf')](_0x8a63('0x11'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8a63('0xf')](_0x8a63('0x12'),auth[_0x8a63('0x8')](),controller[_0x8a63('0x13')]);router[_0x8a63('0x14')]('/:id',auth[_0x8a63('0x8')](),controller[_0x8a63('0x15')]);module[_0x8a63('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index aac5af9..360376c 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 _0x7d44=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1cfacc,_0x167cca){var _0x5e8766=function(_0x49819e){while(--_0x49819e){_0x1cfacc['push'](_0x1cfacc['shift']());}};_0x5e8766(++_0x167cca);}(_0x7d44,0x123));var _0x47d4=function(_0xad2aa7,_0x580d60){_0xad2aa7=_0xad2aa7-0x0;var _0x5acdab=_0x7d44[_0xad2aa7];return _0x5acdab;};'use strict';var Sequelize=require(_0x47d4('0x0'));module[_0x47d4('0x1')]={'state':{'type':Sequelize[_0x47d4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x47d4('0x3')]},'scheduledat':{'type':Sequelize[_0x47d4('0x4')]},'countbusyretry':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x47d4('0x3')]},'originatecalleridname':{'type':Sequelize[_0x47d4('0x3')]},'calleridnum':{'type':Sequelize[_0x47d4('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x47d4('0x4')]},'responsetime':{'type':Sequelize[_0x47d4('0x4')]},'answertime':{'type':Sequelize[_0x47d4('0x4')]},'droptime':{'type':Sequelize[_0x47d4('0x4')]},'endtime':{'type':Sequelize[_0x47d4('0x4')]},'ringtime':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x47d4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x47d4('0x3')]},'campaign':{'type':Sequelize[_0x47d4('0x3')]},'campaigntype':{'type':Sequelize[_0x47d4('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x47d4('0x3')]},'amd':{'type':Sequelize[_0x47d4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x47d4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x47d4('0x4')]},'recallme':{'type':Sequelize[_0x47d4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x47d4('0x4')]},'edited':{'type':Sequelize[_0x47d4('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1f5f=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x173034,_0x9c11b8){var _0x2cec39=function(_0x5f1d4a){while(--_0x5f1d4a){_0x173034['push'](_0x173034['shift']());}};_0x2cec39(++_0x9c11b8);}(_0x1f5f,0x147));var _0xf1f5=function(_0x5d0eb1,_0x431576){_0x5d0eb1=_0x5d0eb1-0x0;var _0x58217b=_0x1f5f[_0x5d0eb1];return _0x58217b;};'use strict';var Sequelize=require(_0xf1f5('0x0'));module[_0xf1f5('0x1')]={'state':{'type':Sequelize[_0xf1f5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf1f5('0x3')]},'scheduledat':{'type':Sequelize[_0xf1f5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf1f5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf1f5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf1f5('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf1f5('0x3')]},'calleridnum':{'type':Sequelize[_0xf1f5('0x3')]},'calleridname':{'type':Sequelize[_0xf1f5('0x3')]},'starttime':{'type':Sequelize[_0xf1f5('0x4')]},'responsetime':{'type':Sequelize[_0xf1f5('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf1f5('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf1f5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf1f5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf1f5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf1f5('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf1f5('0x3')]},'reason':{'type':Sequelize[_0xf1f5('0x3')]},'amd':{'type':Sequelize[_0xf1f5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf1f5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf1f5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf1f5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf1f5('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 7272a66..66323a9 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 _0xbb3d=['where','merge','VIRTUAL','options','CmHopperHistory','then','includeAll','findAll','rows','catch','params','include','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','save','update','error','stack','name','send','index','rawAttributes','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x429e27,_0x104ecd){var _0x3acdaf=function(_0x57cf62){while(--_0x57cf62){_0x429e27['push'](_0x429e27['shift']());}};_0x3acdaf(++_0x104ecd);}(_0xbb3d,0x18d));var _0xdbb3=function(_0x4db7c1,_0x40baeb){_0x4db7c1=_0x4db7c1-0x0;var _0x41fa35=_0xbb3d[_0x4db7c1];return _0x41fa35;};'use strict';var pdf=require(_0xdbb3('0x0'));var emlformat=require(_0xdbb3('0x1'));var rimraf=require(_0xdbb3('0x2'));var zipdir=require(_0xdbb3('0x3'));var jsonpatch=require(_0xdbb3('0x4'));var rp=require('request-promise');var moment=require(_0xdbb3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbb3('0x6'));var util=require(_0xdbb3('0x7'));var path=require(_0xdbb3('0x8'));var sox=require('sox');var csv=require(_0xdbb3('0x9'));var ejs=require(_0xdbb3('0xa'));var fs=require('fs');var _=require(_0xdbb3('0xb'));var squel=require(_0xdbb3('0xc'));var crypto=require(_0xdbb3('0xd'));var jsforce=require(_0xdbb3('0xe'));var deskjs=require(_0xdbb3('0xf'));var toCsv=require(_0xdbb3('0x9'));var querystring=require('querystring');var Papa=require(_0xdbb3('0x10'));var Redis=require('ioredis');var authService=require(_0xdbb3('0x11'));var qs=require(_0xdbb3('0x12'));var as=require(_0xdbb3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbb3('0x14'))(_0xdbb3('0x15'));var utils=require(_0xdbb3('0x16'));var config=require(_0xdbb3('0x17'));var db=require(_0xdbb3('0x18'))['db'];function respondWithStatusCode(_0x48f440,_0x4e8696){_0x4e8696=_0x4e8696||0xcc;return function(_0x2af007){if(_0x2af007){return _0x48f440[_0xdbb3('0x19')](_0x4e8696);}return _0x48f440['status'](_0x4e8696)[_0xdbb3('0x1a')]();};}function respondWithResult(_0x17053f,_0x51a767){_0x51a767=_0x51a767||0xc8;return function(_0x47632b){if(_0x47632b){return _0x17053f[_0xdbb3('0x1b')](_0x51a767)['json'](_0x47632b);}};}function respondWithFilteredResult(_0xf5eea4,_0x3d31b2){return function(_0x3b6162){if(_0x3b6162){var _0x379038=_0x3b6162[_0xdbb3('0x1c')],_0x4138a6=_0x3d31b2[_0xdbb3('0x1d')],_0x375c91=_0x3d31b2[_0xdbb3('0x1d')]+_0x3d31b2[_0xdbb3('0x1e')],_0xd31f5e;if(_0x375c91>=_0x379038){_0x375c91=_0x379038;_0xd31f5e=0xc8;}else{_0xd31f5e=0xce;}_0xf5eea4[_0xdbb3('0x1b')](_0xd31f5e);return _0xf5eea4[_0xdbb3('0x1f')](_0xdbb3('0x20'),_0x4138a6+'-'+_0x375c91+'/'+_0x379038)['json'](_0x3b6162);}return null;};}function patchUpdates(_0x4d4a20){return function(_0x2e9734){try{jsonpatch[_0xdbb3('0x21')](_0x2e9734,_0x4d4a20,!![]);}catch(_0x3ce0e8){return BPromise['reject'](_0x3ce0e8);}return _0x2e9734[_0xdbb3('0x22')]();};}function saveUpdates(_0x2d9173,_0x49179a){return function(_0x1421fa){if(_0x1421fa){return _0x1421fa[_0xdbb3('0x23')](_0x2d9173)['then'](function(_0x1a65aa){return _0x1a65aa;});}return null;};}function removeEntity(_0xd39617,_0x37a6b4){return function(_0x2adc8f){if(_0x2adc8f){return _0x2adc8f['destroy']()['then'](function(){_0xd39617[_0xdbb3('0x1b')](0xcc)[_0xdbb3('0x1a')]();});}};}function handleEntityNotFound(_0x107f2d,_0xf4dd00){return function(_0x1f3c44){if(!_0x1f3c44){_0x107f2d[_0xdbb3('0x19')](0x194);}return _0x1f3c44;};}function handleError(_0xcbce9e,_0x16b42d){_0x16b42d=_0x16b42d||0x1f4;return function(_0x2d838d){logger[_0xdbb3('0x24')](_0x2d838d[_0xdbb3('0x25')]);if(_0x2d838d[_0xdbb3('0x26')]){delete _0x2d838d[_0xdbb3('0x26')];}_0xcbce9e[_0xdbb3('0x1b')](_0x16b42d)[_0xdbb3('0x27')](_0x2d838d);};}exports[_0xdbb3('0x28')]=function(_0x52f33f,_0x24aa16){var _0x43f49a={},_0x16b289={},_0x563976={'count':0x0,'rows':[]};var _0x538abc=_['map'](db['CmHopperHistory'][_0xdbb3('0x29')],function(_0x3711a0){return{'name':_0x3711a0['fieldName'],'type':_0x3711a0[_0xdbb3('0x2a')][_0xdbb3('0x2b')]};});_0x16b289['model']=_[_0xdbb3('0x2c')](_0x538abc,'name');_0x16b289['query']=_[_0xdbb3('0x2d')](_0x52f33f[_0xdbb3('0x2e')]);_0x16b289[_0xdbb3('0x2f')]=_[_0xdbb3('0x30')](_0x16b289[_0xdbb3('0x31')],_0x16b289['query']);_0x43f49a['attributes']=_['intersection'](_0x16b289['model'],qs[_0xdbb3('0x32')](_0x52f33f[_0xdbb3('0x2e')]['fields']));_0x43f49a[_0xdbb3('0x33')]=_0x43f49a[_0xdbb3('0x33')][_0xdbb3('0x34')]?_0x43f49a[_0xdbb3('0x33')]:_0x16b289[_0xdbb3('0x31')];if(!_0x52f33f['query'][_0xdbb3('0x35')](_0xdbb3('0x36'))){_0x43f49a[_0xdbb3('0x1e')]=qs['limit'](_0x52f33f[_0xdbb3('0x2e')]['limit']);_0x43f49a['offset']=qs[_0xdbb3('0x1d')](_0x52f33f['query'][_0xdbb3('0x1d')]);}_0x43f49a[_0xdbb3('0x37')]=qs[_0xdbb3('0x38')](_0x52f33f['query'][_0xdbb3('0x38')]);_0x43f49a['where']=qs[_0xdbb3('0x2f')](_[_0xdbb3('0x39')](_0x52f33f['query'],_0x16b289[_0xdbb3('0x2f')]),_0x538abc);if(_0x52f33f[_0xdbb3('0x2e')][_0xdbb3('0x3a')]){_0x43f49a[_0xdbb3('0x3b')]=_[_0xdbb3('0x3c')](_0x43f49a[_0xdbb3('0x3b')],{'$or':_[_0xdbb3('0x2c')](_0x538abc,function(_0x5b939a){if(_0x5b939a[_0xdbb3('0x2a')]!==_0xdbb3('0x3d')){var _0x1ae850={};_0x1ae850[_0x5b939a[_0xdbb3('0x26')]]={'$like':'%'+_0x52f33f['query']['filter']+'%'};return _0x1ae850;}})});}_0x43f49a=_[_0xdbb3('0x3c')]({},_0x43f49a,_0x52f33f[_0xdbb3('0x3e')]);var _0x22c25a={'where':_0x43f49a['where']};return db[_0xdbb3('0x3f')]['count'](_0x22c25a)[_0xdbb3('0x40')](function(_0x1c5282){_0x563976[_0xdbb3('0x1c')]=_0x1c5282;if(_0x52f33f[_0xdbb3('0x2e')][_0xdbb3('0x41')]){_0x43f49a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xdbb3('0x42')](_0x43f49a);})[_0xdbb3('0x40')](function(_0x57fdbd){_0x563976[_0xdbb3('0x43')]=_0x57fdbd;return _0x563976;})['then'](respondWithFilteredResult(_0x24aa16,_0x43f49a))[_0xdbb3('0x44')](handleError(_0x24aa16,null));};exports['show']=function(_0x193201,_0x540ec3){var _0x322d8a={'raw':!![],'where':{'id':_0x193201[_0xdbb3('0x45')]['id']}},_0xc1c44c={};_0xc1c44c[_0xdbb3('0x31')]=_['keys'](db[_0xdbb3('0x3f')][_0xdbb3('0x29')]);_0xc1c44c[_0xdbb3('0x2e')]=_[_0xdbb3('0x2d')](_0x193201[_0xdbb3('0x2e')]);_0xc1c44c[_0xdbb3('0x2f')]=_['intersection'](_0xc1c44c[_0xdbb3('0x31')],_0xc1c44c[_0xdbb3('0x2e')]);_0x322d8a[_0xdbb3('0x33')]=_[_0xdbb3('0x30')](_0xc1c44c[_0xdbb3('0x31')],qs['fields'](_0x193201['query'][_0xdbb3('0x32')]));_0x322d8a[_0xdbb3('0x33')]=_0x322d8a[_0xdbb3('0x33')][_0xdbb3('0x34')]?_0x322d8a[_0xdbb3('0x33')]:_0xc1c44c[_0xdbb3('0x31')];if(_0x193201[_0xdbb3('0x2e')][_0xdbb3('0x41')]){_0x322d8a[_0xdbb3('0x46')]=[{'all':!![]}];}_0x322d8a=_[_0xdbb3('0x3c')]({},_0x322d8a,_0x193201[_0xdbb3('0x3e')]);return db[_0xdbb3('0x3f')][_0xdbb3('0x47')](_0x322d8a)['then'](handleEntityNotFound(_0x540ec3,null))[_0xdbb3('0x40')](respondWithResult(_0x540ec3,null))['catch'](handleError(_0x540ec3,null));};exports['create']=function(_0x11896f,_0x59ea4e){return db[_0xdbb3('0x3f')][_0xdbb3('0x48')](_0x11896f[_0xdbb3('0x49')],{})[_0xdbb3('0x40')](respondWithResult(_0x59ea4e,0xc9))[_0xdbb3('0x44')](handleError(_0x59ea4e,null));};exports[_0xdbb3('0x4a')]=function(_0x44be6d,_0x211b9){return db[_0xdbb3('0x3f')][_0xdbb3('0x4a')]()[_0xdbb3('0x40')](respondWithResult(_0x211b9,null))[_0xdbb3('0x44')](handleError(_0x211b9,null));};exports[_0xdbb3('0x23')]=function(_0x125841,_0x3c8ba1){if(_0x125841[_0xdbb3('0x49')][_0xdbb3('0x4b')]){delete _0x125841['body']['uniqueid'];}return db[_0xdbb3('0x3f')][_0xdbb3('0x47')]({'where':{'uniqueid':_0x125841[_0xdbb3('0x45')]['id']}})[_0xdbb3('0x40')](handleEntityNotFound(_0x3c8ba1,null))[_0xdbb3('0x40')](saveUpdates(_0x125841[_0xdbb3('0x49')],null))[_0xdbb3('0x40')](respondWithResult(_0x3c8ba1,null))[_0xdbb3('0x44')](handleError(_0x3c8ba1,null));}; \ No newline at end of file +var _0x0870=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','status','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','find','create','describe','uniqueid','body','params','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc5b3f5,_0x40786d){var _0x309252=function(_0x3407c3){while(--_0x3407c3){_0xc5b3f5['push'](_0xc5b3f5['shift']());}};_0x309252(++_0x40786d);}(_0x0870,0x1e2));var _0x0087=function(_0x5a7c88,_0x303ffb){_0x5a7c88=_0x5a7c88-0x0;var _0x5687f0=_0x0870[_0x5a7c88];return _0x5687f0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0087('0x0'));var jsonpatch=require(_0x0087('0x1'));var rp=require(_0x0087('0x2'));var moment=require(_0x0087('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0087('0x4'));var sox=require(_0x0087('0x5'));var csv=require(_0x0087('0x6'));var ejs=require(_0x0087('0x7'));var fs=require('fs');var _=require(_0x0087('0x8'));var squel=require('squel');var crypto=require(_0x0087('0x9'));var jsforce=require(_0x0087('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0087('0x6'));var querystring=require(_0x0087('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0087('0xc'));var as=require(_0x0087('0xd'));var hardwareService=require(_0x0087('0xe'));var logger=require(_0x0087('0xf'))(_0x0087('0x10'));var utils=require(_0x0087('0x11'));var config=require(_0x0087('0x12'));var db=require(_0x0087('0x13'))['db'];function respondWithStatusCode(_0x43a34c,_0x411dad){_0x411dad=_0x411dad||0xcc;return function(_0x28ee0c){if(_0x28ee0c){return _0x43a34c[_0x0087('0x14')](_0x411dad);}return _0x43a34c['status'](_0x411dad)['end']();};}function respondWithResult(_0x2b7fd7,_0x1cbe1d){_0x1cbe1d=_0x1cbe1d||0xc8;return function(_0x2467a5){if(_0x2467a5){return _0x2b7fd7['status'](_0x1cbe1d)['json'](_0x2467a5);}};}function respondWithFilteredResult(_0x458b09,_0x18177d){return function(_0x423012){if(_0x423012){var _0x9ad4ac=_0x423012[_0x0087('0x15')],_0x17003f=_0x18177d[_0x0087('0x16')],_0x48e385=_0x18177d[_0x0087('0x16')]+_0x18177d['limit'],_0x1a4908;if(_0x48e385>=_0x9ad4ac){_0x48e385=_0x9ad4ac;_0x1a4908=0xc8;}else{_0x1a4908=0xce;}_0x458b09['status'](_0x1a4908);return _0x458b09[_0x0087('0x17')]('Content-Range',_0x17003f+'-'+_0x48e385+'/'+_0x9ad4ac)[_0x0087('0x18')](_0x423012);}return null;};}function patchUpdates(_0x4fabb6){return function(_0x5b648e){try{jsonpatch[_0x0087('0x19')](_0x5b648e,_0x4fabb6,!![]);}catch(_0x576278){return BPromise[_0x0087('0x1a')](_0x576278);}return _0x5b648e[_0x0087('0x1b')]();};}function saveUpdates(_0x22c846,_0x32b163){return function(_0x18d027){if(_0x18d027){return _0x18d027[_0x0087('0x1c')](_0x22c846)[_0x0087('0x1d')](function(_0x1e79f4){return _0x1e79f4;});}return null;};}function removeEntity(_0x539c0d,_0x19dfe3){return function(_0x181c0c){if(_0x181c0c){return _0x181c0c[_0x0087('0x1e')]()[_0x0087('0x1d')](function(){_0x539c0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x538283,_0x45830e){return function(_0x18b4cd){if(!_0x18b4cd){_0x538283[_0x0087('0x14')](0x194);}return _0x18b4cd;};}function handleError(_0x3f8648,_0x5f3e8f){_0x5f3e8f=_0x5f3e8f||0x1f4;return function(_0x52e694){logger[_0x0087('0x1f')](_0x52e694[_0x0087('0x20')]);if(_0x52e694[_0x0087('0x21')]){delete _0x52e694[_0x0087('0x21')];}_0x3f8648[_0x0087('0x22')](_0x5f3e8f)[_0x0087('0x23')](_0x52e694);};}exports[_0x0087('0x24')]=function(_0x1f971d,_0x1c0b0d){var _0xc16225={},_0x46dce3={},_0x1ad5a7={'count':0x0,'rows':[]};var _0x4bef80=_[_0x0087('0x25')](db[_0x0087('0x26')][_0x0087('0x27')],function(_0x1fed19){return{'name':_0x1fed19[_0x0087('0x28')],'type':_0x1fed19[_0x0087('0x29')][_0x0087('0x2a')]};});_0x46dce3[_0x0087('0x2b')]=_[_0x0087('0x25')](_0x4bef80,_0x0087('0x21'));_0x46dce3[_0x0087('0x2c')]=_[_0x0087('0x2d')](_0x1f971d[_0x0087('0x2c')]);_0x46dce3[_0x0087('0x2e')]=_[_0x0087('0x2f')](_0x46dce3[_0x0087('0x2b')],_0x46dce3[_0x0087('0x2c')]);_0xc16225['attributes']=_[_0x0087('0x2f')](_0x46dce3[_0x0087('0x2b')],qs[_0x0087('0x30')](_0x1f971d[_0x0087('0x2c')]['fields']));_0xc16225[_0x0087('0x31')]=_0xc16225[_0x0087('0x31')][_0x0087('0x32')]?_0xc16225[_0x0087('0x31')]:_0x46dce3[_0x0087('0x2b')];if(!_0x1f971d[_0x0087('0x2c')][_0x0087('0x33')](_0x0087('0x34'))){_0xc16225[_0x0087('0x35')]=qs[_0x0087('0x35')](_0x1f971d[_0x0087('0x2c')][_0x0087('0x35')]);_0xc16225['offset']=qs['offset'](_0x1f971d[_0x0087('0x2c')][_0x0087('0x16')]);}_0xc16225['order']=qs[_0x0087('0x36')](_0x1f971d['query']['sort']);_0xc16225[_0x0087('0x37')]=qs[_0x0087('0x2e')](_[_0x0087('0x38')](_0x1f971d[_0x0087('0x2c')],_0x46dce3['filters']),_0x4bef80);if(_0x1f971d['query'][_0x0087('0x39')]){_0xc16225[_0x0087('0x37')]=_[_0x0087('0x3a')](_0xc16225[_0x0087('0x37')],{'$or':_[_0x0087('0x25')](_0x4bef80,function(_0x246804){if(_0x246804[_0x0087('0x29')]!==_0x0087('0x3b')){var _0x5201af={};_0x5201af[_0x246804['name']]={'$like':'%'+_0x1f971d[_0x0087('0x2c')]['filter']+'%'};return _0x5201af;}})});}_0xc16225=_[_0x0087('0x3a')]({},_0xc16225,_0x1f971d[_0x0087('0x3c')]);var _0x2b069e={'where':_0xc16225[_0x0087('0x37')]};return db[_0x0087('0x26')][_0x0087('0x15')](_0x2b069e)['then'](function(_0x3f0127){_0x1ad5a7[_0x0087('0x15')]=_0x3f0127;if(_0x1f971d['query']['includeAll']){_0xc16225[_0x0087('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0087('0x3e')](_0xc16225);})[_0x0087('0x1d')](function(_0xccd9a9){_0x1ad5a7[_0x0087('0x3f')]=_0xccd9a9;return _0x1ad5a7;})[_0x0087('0x1d')](respondWithFilteredResult(_0x1c0b0d,_0xc16225))[_0x0087('0x40')](handleError(_0x1c0b0d,null));};exports['show']=function(_0xad4715,_0x4c2780){var _0x3874c0={'raw':!![],'where':{'id':_0xad4715['params']['id']}},_0x17afa5={};_0x17afa5[_0x0087('0x2b')]=_['keys'](db[_0x0087('0x26')][_0x0087('0x27')]);_0x17afa5[_0x0087('0x2c')]=_[_0x0087('0x2d')](_0xad4715['query']);_0x17afa5[_0x0087('0x2e')]=_[_0x0087('0x2f')](_0x17afa5[_0x0087('0x2b')],_0x17afa5[_0x0087('0x2c')]);_0x3874c0[_0x0087('0x31')]=_['intersection'](_0x17afa5['model'],qs[_0x0087('0x30')](_0xad4715[_0x0087('0x2c')][_0x0087('0x30')]));_0x3874c0[_0x0087('0x31')]=_0x3874c0[_0x0087('0x31')][_0x0087('0x32')]?_0x3874c0[_0x0087('0x31')]:_0x17afa5[_0x0087('0x2b')];if(_0xad4715[_0x0087('0x2c')]['includeAll']){_0x3874c0['include']=[{'all':!![]}];}_0x3874c0=_[_0x0087('0x3a')]({},_0x3874c0,_0xad4715[_0x0087('0x3c')]);return db[_0x0087('0x26')][_0x0087('0x41')](_0x3874c0)[_0x0087('0x1d')](handleEntityNotFound(_0x4c2780,null))['then'](respondWithResult(_0x4c2780,null))[_0x0087('0x40')](handleError(_0x4c2780,null));};exports['create']=function(_0x2db06e,_0x18209b){return db[_0x0087('0x26')][_0x0087('0x42')](_0x2db06e['body'],{})['then'](respondWithResult(_0x18209b,0xc9))[_0x0087('0x40')](handleError(_0x18209b,null));};exports[_0x0087('0x43')]=function(_0x514032,_0x5087e4){return db[_0x0087('0x26')][_0x0087('0x43')]()[_0x0087('0x1d')](respondWithResult(_0x5087e4,null))[_0x0087('0x40')](handleError(_0x5087e4,null));};exports[_0x0087('0x1c')]=function(_0x22308e,_0x4ff328){if(_0x22308e['body'][_0x0087('0x44')]){delete _0x22308e[_0x0087('0x45')][_0x0087('0x44')];}return db[_0x0087('0x26')]['find']({'where':{'uniqueid':_0x22308e[_0x0087('0x46')]['id']}})[_0x0087('0x1d')](handleEntityNotFound(_0x4ff328,null))[_0x0087('0x1d')](saveUpdates(_0x22308e[_0x0087('0x45')],null))[_0x0087('0x1d')](respondWithResult(_0x4ff328,null))['catch'](handleError(_0x4ff328,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9b5d589..de94939 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 _0xba38=['api','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','CmHopperHistory','uniqueid','lodash','util','../../config/logger'];(function(_0x1ea502,_0x25b11e){var _0x12b237=function(_0x3d0ffd){while(--_0x3d0ffd){_0x1ea502['push'](_0x1ea502['shift']());}};_0x12b237(++_0x25b11e);}(_0xba38,0x8c));var _0x8ba3=function(_0x4e6f4e,_0x584be0){_0x4e6f4e=_0x4e6f4e-0x0;var _0x2d8b29=_0xba38[_0x4e6f4e];return _0x2d8b29;};'use strict';var _=require(_0x8ba3('0x0'));var util=require(_0x8ba3('0x1'));var logger=require(_0x8ba3('0x2'))(_0x8ba3('0x3'));var moment=require(_0x8ba3('0x4'));var BPromise=require(_0x8ba3('0x5'));var rp=require(_0x8ba3('0x6'));var fs=require('fs');var path=require(_0x8ba3('0x7'));var rimraf=require(_0x8ba3('0x8'));var config=require('../../config/environment');var attributes=require(_0x8ba3('0x9'));module[_0x8ba3('0xa')]=function(_0x5bd879,_0xfff20c){return _0x5bd879['define'](_0x8ba3('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0x8ba3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2874=['request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x17c2ce,_0x14d5ad){var _0x373c0b=function(_0x38a189){while(--_0x38a189){_0x17c2ce['push'](_0x17c2ce['shift']());}};_0x373c0b(++_0x14d5ad);}(_0x2874,0xf8));var _0x4287=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x2874[_0x430459];return _0x3a2439;};'use strict';var _=require(_0x4287('0x0'));var util=require('util');var logger=require(_0x4287('0x1'))(_0x4287('0x2'));var moment=require(_0x4287('0x3'));var BPromise=require('bluebird');var rp=require(_0x4287('0x4'));var fs=require('fs');var path=require(_0x4287('0x5'));var rimraf=require(_0x4287('0x6'));var config=require(_0x4287('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x4287('0x8')]=function(_0x12b030,_0xe800ab){return _0x12b030[_0x4287('0x9')](_0x4287('0xa'),attributes,{'tableName':_0x4287('0xb'),'paranoid':![],'indexes':[{'name':_0x4287('0xc'),'fields':[_0x4287('0xc')]},{'name':_0x4287('0xd'),'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 d3863fb..b10a9b0 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 _0x6324=['client','http','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','result','catch','CreateCmHopperHistory','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6324,0x142));var _0x4632=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0x6324[_0x5eb1a8];return _0x14c11c;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});}exports[_0x4632('0x16')]=function(_0x1a94c0){var _0x5b28b7=this;return new Promise(function(_0x3cddfa,_0x1894bb){return db['CmHopperHistory']['create'](_0x1a94c0[_0x4632('0x17')],{'raw':_0x1a94c0[_0x4632('0x18')]?_0x1a94c0[_0x4632('0x18')][_0x4632('0x19')]===undefined?!![]:![]:!![]})[_0x4632('0xa')](function(_0x3d2d23){logger[_0x4632('0x13')](_0x4632('0x16'),_0x1a94c0);logger[_0x4632('0xc')](_0x4632('0x16'),_0x1a94c0,JSON[_0x4632('0xe')](_0x3d2d23));_0x3cddfa(_0x3d2d23);})[_0x4632('0x15')](function(_0x2ca6a5){logger[_0x4632('0xf')](_0x4632('0x16'),_0x2ca6a5[_0x4632('0x12')],_0x1a94c0);_0x1894bb(_0x5b28b7[_0x4632('0xf')](0x1f4,_0x2ca6a5[_0x4632('0x12')]));});});};exports[_0x4632('0x1a')]=function(_0x1e1b86){var _0x38cbbc=this;return new Promise(function(_0x4455ef,_0x3b0823){return db[_0x4632('0x1b')][_0x4632('0x1c')]({'raw':_0x1e1b86[_0x4632('0x18')]?_0x1e1b86[_0x4632('0x18')][_0x4632('0x19')]===undefined?!![]:![]:!![],'where':_0x1e1b86[_0x4632('0x18')]?_0x1e1b86[_0x4632('0x18')][_0x4632('0x1d')]||null:null,'attributes':[[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['col']('id')),_0x4632('0x20')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x4632('0x24')],[db[_0x4632('0x1e')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x4632('0x25')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x26'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x27')))),_0x4632('0x28')]]})['then'](function(_0x5f4f24){logger[_0x4632('0x13')]('AvgHandleTime',_0x1e1b86);logger['debug'](_0x4632('0x1a'),_0x1e1b86,JSON['stringify'](_0x5f4f24));_0x4455ef(_0x5f4f24);})[_0x4632('0x15')](function(_0x468735){logger[_0x4632('0xf')]('AvgHandleTime',_0x468735[_0x4632('0x12')],_0x1e1b86);_0x3b0823(_0x38cbbc[_0x4632('0xf')](0x1f4,_0x468735[_0x4632('0x12')]));});});};exports[_0x4632('0x29')]=function(_0x37c4d0){var _0x5d20f9=this;return new Promise(function(_0x486f6c,_0x3114c4){return db[_0x4632('0x1b')][_0x4632('0x1c')]({'raw':_0x37c4d0['options']?_0x37c4d0['options']['raw']===undefined?!![]:![]:!![],'where':_0x37c4d0[_0x4632('0x18')]?_0x37c4d0[_0x4632('0x18')]['where']||null:null,'attributes':[[_0x4632('0x2a'),_0x4632('0x2b')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x2c')))),_0x4632('0x2d')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db['sequelize'][_0x4632('0x21')](_0x4632('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x22')))),_0x4632('0x2f')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x30')))),_0x4632('0x31')],[db['sequelize']['fn']('COUNT',db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0x4632('0x32')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x34')))),_0x4632('0x35')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db['sequelize'][_0x4632('0x21')](_0x4632('0x36')))),_0x4632('0x37')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x38')))),_0x4632('0x39')],[db[_0x4632('0x1e')]['fn']('COUNT',db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4632('0x3a')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x3b')))),_0x4632('0x3c')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x4632('0x3a')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x3d')))),_0x4632('0x3e')]],'group':[_0x4632('0x2a')]})[_0x4632('0xa')](function(_0x3e66d8){logger[_0x4632('0x13')](_0x4632('0x29'),_0x37c4d0);logger[_0x4632('0xc')](_0x4632('0x29'),_0x37c4d0,JSON[_0x4632('0xe')](_0x3e66d8));_0x486f6c(_0x3e66d8);})[_0x4632('0x15')](function(_0x6c2864){logger[_0x4632('0xf')](_0x4632('0x29'),_0x6c2864['message'],_0x37c4d0);_0x3114c4(_0x5d20f9[_0x4632('0xf')](0x1f4,_0x6c2864[_0x4632('0x12')]));});});};exports[_0x4632('0x3f')]=function(_0x150bfa){var _0x2e2353=this;return new Promise(function(_0x33ad25,_0x5d2cbb){return db[_0x4632('0x1b')][_0x4632('0x1c')]({'raw':_0x150bfa[_0x4632('0x18')]?_0x150bfa['options'][_0x4632('0x19')]===undefined?!![]:![]:!![],'where':_0x150bfa[_0x4632('0x18')]?_0x150bfa['options'][_0x4632('0x1d')]||null:null,'attributes':[[_0x4632('0x2a'),_0x4632('0x2b')],[db['sequelize']['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')][_0x4632('0x40')]('id')),_0x4632('0x41')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x22')))),'ivrAnswerCallsDay']],'group':[_0x4632('0x2a')]})[_0x4632('0xa')](function(_0x556bec){logger[_0x4632('0x13')]('GetCampaignHopperHistory',_0x150bfa);logger['debug'](_0x4632('0x3f'),_0x150bfa,JSON[_0x4632('0xe')](_0x556bec));_0x33ad25(_0x556bec);})[_0x4632('0x15')](function(_0xd89124){logger[_0x4632('0xf')](_0x4632('0x3f'),_0xd89124[_0x4632('0x12')],_0x150bfa);_0x5d2cbb(_0x2e2353[_0x4632('0xf')](0x1f4,_0xd89124[_0x4632('0x12')]));});});}; \ No newline at end of file +var _0x0bb5=['predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','body','options','raw','CreateCmHopperHistory','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null'];(function(_0x2cd4f2,_0x5350d6){var _0x2c024e=function(_0x29b2c2){while(--_0x29b2c2){_0x2cd4f2['push'](_0x2cd4f2['shift']());}};_0x2c024e(++_0x5350d6);}(_0x0bb5,0x148));var _0x50bb=function(_0x132ef8,_0x3496bd){_0x132ef8=_0x132ef8-0x0;var _0xc8473d=_0x0bb5[_0x132ef8];return _0xc8473d;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['CreateCmHopperHistory']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['CmHopperHistory']['create'](_0x24ba19[_0x50bb('0x16')],{'raw':_0x24ba19[_0x50bb('0x17')]?_0x24ba19[_0x50bb('0x17')][_0x50bb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x19dc5d){logger[_0x50bb('0xb')](_0x50bb('0x19'),_0x24ba19);logger['debug'](_0x50bb('0x19'),_0x24ba19,JSON[_0x50bb('0x10')](_0x19dc5d));_0x301f61(_0x19dc5d);})[_0x50bb('0x15')](function(_0x4825f8){logger[_0x50bb('0x11')]('CreateCmHopperHistory',_0x4825f8[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4825f8[_0x50bb('0x13')]));});});};exports[_0x50bb('0x1a')]=function(_0x846311){var _0x342078=this;return new Promise(function(_0x4f7f73,_0xad17ac){return db[_0x50bb('0x1b')][_0x50bb('0x1c')]({'raw':_0x846311[_0x50bb('0x17')]?_0x846311['options'][_0x50bb('0x18')]===undefined?!![]:![]:!![],'where':_0x846311['options']?_0x846311['options'][_0x50bb('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x50bb('0x1e')][_0x50bb('0x1f')]('id')),_0x50bb('0x20')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x50bb('0x23')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db['sequelize'][_0x50bb('0x22')](_0x50bb('0x24')))),_0x50bb('0x25')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x26')))),_0x50bb('0x27')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x28'),db['sequelize']['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x29')))),_0x50bb('0x2a')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x28'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x2b')))),_0x50bb('0x2c')]]})['then'](function(_0x364ea0){logger[_0x50bb('0xb')](_0x50bb('0x1a'),_0x846311);logger[_0x50bb('0xd')](_0x50bb('0x1a'),_0x846311,JSON[_0x50bb('0x10')](_0x364ea0));_0x4f7f73(_0x364ea0);})['catch'](function(_0x527b4a){logger[_0x50bb('0x11')]('AvgHandleTime',_0x527b4a[_0x50bb('0x13')],_0x846311);_0xad17ac(_0x342078[_0x50bb('0x11')](0x1f4,_0x527b4a[_0x50bb('0x13')]));});});};exports[_0x50bb('0x2d')]=function(_0x4ba9f9){var _0x48f4de=this;return new Promise(function(_0x3a5f09,_0x4acf2e){return db[_0x50bb('0x1b')][_0x50bb('0x1c')]({'raw':_0x4ba9f9[_0x50bb('0x17')]?_0x4ba9f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ba9f9[_0x50bb('0x17')]?_0x4ba9f9[_0x50bb('0x17')][_0x50bb('0x1d')]||null:null,'attributes':[[_0x50bb('0x2e'),'name'],[db[_0x50bb('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x50bb('0x1e')]['literal'](_0x50bb('0x2f')))),_0x50bb('0x30')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x31')))),_0x50bb('0x32')],[db[_0x50bb('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x33')))),_0x50bb('0x34')],[db['sequelize']['fn'](_0x50bb('0x21'),db['sequelize']['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x35')))),_0x50bb('0x36')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x37')))),_0x50bb('0x38')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x50bb('0x39')],[db['sequelize']['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x3a')))),_0x50bb('0x3b')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x3c')))),_0x50bb('0x3d')],[db[_0x50bb('0x1e')]['fn']('COUNT',db[_0x50bb('0x1e')]['fn']('IF',db['sequelize'][_0x50bb('0x22')](_0x50bb('0x3e')))),_0x50bb('0x3f')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0x50bb('0x40')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')]['literal'](_0x50bb('0x41')))),_0x50bb('0x42')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db[_0x50bb('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x50bb('0x43')))),'outboundAnswerAgiCallsDay'],[db[_0x50bb('0x1e')]['fn']('COUNT',db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x50bb('0x42')],[db[_0x50bb('0x1e')]['fn']('COUNT',db[_0x50bb('0x1e')]['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x44')))),'outboundReCallsDay']],'group':[_0x50bb('0x2e')]})[_0x50bb('0xa')](function(_0x2e0032){logger[_0x50bb('0xb')](_0x50bb('0x2d'),_0x4ba9f9);logger['debug'](_0x50bb('0x2d'),_0x4ba9f9,JSON['stringify'](_0x2e0032));_0x3a5f09(_0x2e0032);})[_0x50bb('0x15')](function(_0x50216f){logger['error'](_0x50bb('0x2d'),_0x50216f['message'],_0x4ba9f9);_0x4acf2e(_0x48f4de['error'](0x1f4,_0x50216f[_0x50bb('0x13')]));});});};exports[_0x50bb('0x45')]=function(_0x33ef5a){var _0x1bbebc=this;return new Promise(function(_0x3ef5d8,_0x3b78bd){return db[_0x50bb('0x1b')][_0x50bb('0x1c')]({'raw':_0x33ef5a['options']?_0x33ef5a['options'][_0x50bb('0x18')]===undefined?!![]:![]:!![],'where':_0x33ef5a[_0x50bb('0x17')]?_0x33ef5a[_0x50bb('0x17')][_0x50bb('0x1d')]||null:null,'attributes':[[_0x50bb('0x2e'),_0x50bb('0x46')],[db[_0x50bb('0x1e')]['fn']('COUNT',db[_0x50bb('0x1e')][_0x50bb('0x1f')]('id')),_0x50bb('0x47')],[db[_0x50bb('0x1e')]['fn'](_0x50bb('0x21'),db['sequelize']['fn']('IF',db[_0x50bb('0x1e')][_0x50bb('0x22')](_0x50bb('0x33')))),_0x50bb('0x48')]],'group':[_0x50bb('0x2e')]})['then'](function(_0x261bf5){logger['info']('GetCampaignHopperHistory',_0x33ef5a);logger[_0x50bb('0xd')](_0x50bb('0x45'),_0x33ef5a,JSON[_0x50bb('0x10')](_0x261bf5));_0x3ef5d8(_0x261bf5);})[_0x50bb('0x15')](function(_0x431d71){logger[_0x50bb('0x11')](_0x50bb('0x45'),_0x431d71[_0x50bb('0x13')],_0x33ef5a);_0x3b78bd(_0x1bbebc[_0x50bb('0x11')](0x1f4,_0x431d71[_0x50bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9e8b792..0a37a73 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 _0xd8ff=['get','isAuthenticated','/describe','describe','/:id','post','create','put','update','multer','path','express','../../components/auth/service','../../config/environment'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xd8ff,0x13d));var _0xfd8f=function(_0x397dd0,_0x58a7a8){_0x397dd0=_0x397dd0-0x0;var _0x4188b2=_0xd8ff[_0x397dd0];return _0x4188b2;};'use strict';var multer=require(_0xfd8f('0x0'));var util=require('util');var path=require(_0xfd8f('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd8f('0x2'));var router=express['Router']();var auth=require(_0xfd8f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfd8f('0x4'));var controller=require('./cmHopperHistory.controller');router[_0xfd8f('0x5')]('/',auth[_0xfd8f('0x6')](),controller['index']);router[_0xfd8f('0x5')](_0xfd8f('0x7'),auth[_0xfd8f('0x6')](),controller[_0xfd8f('0x8')]);router[_0xfd8f('0x5')](_0xfd8f('0x9'),auth[_0xfd8f('0x6')](),controller['show']);router[_0xfd8f('0xa')]('/',auth[_0xfd8f('0x6')](),controller[_0xfd8f('0xb')]);router[_0xfd8f('0xc')]('/:id',auth[_0xfd8f('0x6')](),controller[_0xfd8f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x1a21=['../../config/environment','get','isAuthenticated','index','/describe','/:id','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x494a42,_0x1f2103){var _0x254792=function(_0x5f1c1d){while(--_0x5f1c1d){_0x494a42['push'](_0x494a42['shift']());}};_0x254792(++_0x1f2103);}(_0x1a21,0xb9));var _0x11a2=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x1a21[_0x291f8b];return _0x275171;};'use strict';var multer=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var path=require(_0x11a2('0x2'));var timeout=require(_0x11a2('0x3'));var express=require(_0x11a2('0x4'));var router=express[_0x11a2('0x5')]();var auth=require(_0x11a2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x11a2('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x11a2('0x8')]('/',auth[_0x11a2('0x9')](),controller[_0x11a2('0xa')]);router[_0x11a2('0x8')](_0x11a2('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x11a2('0x8')](_0x11a2('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x11a2('0x9')](),controller[_0x11a2('0xd')]);router[_0x11a2('0xe')](_0x11a2('0xc'),auth['isAuthenticated'](),controller[_0x11a2('0xf')]);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 981ec89..24f4119 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 _0x114c=['exports','STRING','sequelize'];(function(_0x807ced,_0x124c67){var _0x1c67de=function(_0x15ac1b){while(--_0x15ac1b){_0x807ced['push'](_0x807ced['shift']());}};_0x1c67de(++_0x124c67);}(_0x114c,0x107));var _0xc114=function(_0x5f5270,_0x20d689){_0x5f5270=_0x5f5270-0x0;var _0xc24108=_0x114c[_0x5f5270];return _0xc24108;};'use strict';var Sequelize=require(_0xc114('0x0'));module[_0xc114('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc114('0x2')]},'dialPrefix':{'type':Sequelize[_0xc114('0x2')]}}; \ No newline at end of file +var _0xd8f2=['exports','STRING','sequelize'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xd8f2,0xce));var _0x2d8f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd8f2[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x2d8f('0x0'));module[_0x2d8f('0x1')]={'name':{'type':Sequelize[_0x2d8f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x2d8f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d62d34d..3e1c581 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 _0xa820=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','get','Lists','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','CmList','rawAttributes','type','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','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','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','addContacts','CmContact','tags','isArray','push','each','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','TEXT','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0xa820,0x113));var _0x0a82=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xa820[_0xb0de07];return _0x4633d8;};'use strict';var pdf=require(_0x0a82('0x0'));var emlformat=require(_0x0a82('0x1'));var rimraf=require(_0x0a82('0x2'));var zipdir=require(_0x0a82('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a82('0x4'));var moment=require(_0x0a82('0x5'));var BPromise=require(_0x0a82('0x6'));var Mustache=require(_0x0a82('0x7'));var util=require(_0x0a82('0x8'));var path=require(_0x0a82('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a82('0xa'));var squel=require(_0x0a82('0xb'));var crypto=require(_0x0a82('0xc'));var jsforce=require(_0x0a82('0xd'));var deskjs=require(_0x0a82('0xe'));var toCsv=require(_0x0a82('0xf'));var querystring=require('querystring');var Papa=require(_0x0a82('0x10'));var Redis=require(_0x0a82('0x11'));var authService=require(_0x0a82('0x12'));var qs=require(_0x0a82('0x13'));var as=require(_0x0a82('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a82('0x15'))(_0x0a82('0x16'));var utils=require('../../config/utils');var config=require(_0x0a82('0x17'));var db=require(_0x0a82('0x18'))['db'];config[_0x0a82('0x19')]=_[_0x0a82('0x1a')](config[_0x0a82('0x19')],{'host':_0x0a82('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a82('0x1c'))[_0x0a82('0x1d')](socket);function respondWithStatusCode(_0x52ac1a,_0x38ce0e){_0x38ce0e=_0x38ce0e||0xcc;return function(_0x2e08a2){if(_0x2e08a2){return _0x52ac1a['sendStatus'](_0x38ce0e);}return _0x52ac1a[_0x0a82('0x1e')](_0x38ce0e)[_0x0a82('0x1f')]();};}function respondWithResult(_0x43d65a,_0x45d5f3){_0x45d5f3=_0x45d5f3||0xc8;return function(_0x45da07){if(_0x45da07){return _0x43d65a[_0x0a82('0x1e')](_0x45d5f3)[_0x0a82('0x20')](_0x45da07);}};}function respondWithFilteredResult(_0x38880f,_0x471dff){return function(_0x289497){if(_0x289497){var _0x57db98=_0x289497[_0x0a82('0x21')],_0x40bf22=_0x471dff[_0x0a82('0x22')],_0xe0712f=_0x471dff[_0x0a82('0x22')]+_0x471dff[_0x0a82('0x23')],_0x410ff2;if(_0xe0712f>=_0x57db98){_0xe0712f=_0x57db98;_0x410ff2=0xc8;}else{_0x410ff2=0xce;}_0x38880f[_0x0a82('0x1e')](_0x410ff2);return _0x38880f[_0x0a82('0x24')](_0x0a82('0x25'),_0x40bf22+'-'+_0xe0712f+'/'+_0x57db98)[_0x0a82('0x20')](_0x289497);}return null;};}function patchUpdates(_0x37e11f){return function(_0x5989ff){try{jsonpatch['apply'](_0x5989ff,_0x37e11f,!![]);}catch(_0x509cf3){return BPromise[_0x0a82('0x26')](_0x509cf3);}return _0x5989ff['save']();};}function saveUpdates(_0x509623,_0x9f734d){return function(_0x3412a8){if(_0x3412a8){return _0x3412a8[_0x0a82('0x27')](_0x509623)['then'](function(_0x79f115){return _0x79f115;});}return null;};}function removeEntity(_0x37428e,_0x309788){return function(_0x53be12){if(_0x53be12){return _0x53be12['destroy']()[_0x0a82('0x28')](function(){var _0x4442f5=_0x53be12[_0x0a82('0x29')]({'plain':!![]});var _0x401bc4=_0x0a82('0x2a');return db[_0x0a82('0x2b')][_0x0a82('0x2c')]({'where':{'type':_0x401bc4,'resourceId':_0x4442f5['id']}})[_0x0a82('0x28')](function(){return _0x53be12;});})[_0x0a82('0x28')](function(){_0x37428e['status'](0xcc)[_0x0a82('0x1f')]();});}};}function handleEntityNotFound(_0x30b119,_0x26859e){return function(_0x27c2d0){if(!_0x27c2d0){_0x30b119[_0x0a82('0x2d')](0x194);}return _0x27c2d0;};}function handleError(_0x5778ff,_0x147e3a){_0x147e3a=_0x147e3a||0x1f4;return function(_0x3b6cdd){logger[_0x0a82('0x2e')](_0x3b6cdd[_0x0a82('0x2f')]);if(_0x3b6cdd[_0x0a82('0x30')]){delete _0x3b6cdd[_0x0a82('0x30')];}_0x5778ff[_0x0a82('0x1e')](_0x147e3a)['send'](_0x3b6cdd);};}exports[_0x0a82('0x31')]=function(_0x5dac86,_0x5776bc){var _0x5eeb7d={},_0x9f3e25={},_0x13fb17={'count':0x0,'rows':[]};var _0x40c1dd=_[_0x0a82('0x32')](db[_0x0a82('0x33')][_0x0a82('0x34')],function(_0xb2cd17){return{'name':_0xb2cd17['fieldName'],'type':_0xb2cd17[_0x0a82('0x35')][_0x0a82('0x36')]};});_0x9f3e25[_0x0a82('0x37')]=_[_0x0a82('0x32')](_0x40c1dd,_0x0a82('0x30'));_0x9f3e25['query']=_[_0x0a82('0x38')](_0x5dac86['query']);_0x9f3e25[_0x0a82('0x39')]=_[_0x0a82('0x3a')](_0x9f3e25[_0x0a82('0x37')],_0x9f3e25['query']);_0x5eeb7d[_0x0a82('0x3b')]=_[_0x0a82('0x3a')](_0x9f3e25['model'],qs['fields'](_0x5dac86[_0x0a82('0x3c')][_0x0a82('0x3d')]));_0x5eeb7d[_0x0a82('0x3b')]=_0x5eeb7d['attributes'][_0x0a82('0x3e')]?_0x5eeb7d[_0x0a82('0x3b')]:_0x9f3e25['model'];if(!_0x5dac86[_0x0a82('0x3c')][_0x0a82('0x3f')](_0x0a82('0x40'))){_0x5eeb7d[_0x0a82('0x23')]=qs[_0x0a82('0x23')](_0x5dac86[_0x0a82('0x3c')][_0x0a82('0x23')]);_0x5eeb7d[_0x0a82('0x22')]=qs[_0x0a82('0x22')](_0x5dac86['query'][_0x0a82('0x22')]);}_0x5eeb7d[_0x0a82('0x41')]=qs['sort'](_0x5dac86[_0x0a82('0x3c')][_0x0a82('0x42')]);_0x5eeb7d[_0x0a82('0x43')]=qs['filters'](_[_0x0a82('0x44')](_0x5dac86['query'],_0x9f3e25['filters']),_0x40c1dd);if(_0x5dac86[_0x0a82('0x3c')][_0x0a82('0x45')]){_0x5eeb7d[_0x0a82('0x43')]=_['merge'](_0x5eeb7d['where'],{'$or':_[_0x0a82('0x32')](_0x40c1dd,function(_0x396d98){if(_0x396d98[_0x0a82('0x35')]!=='VIRTUAL'){var _0x241b58={};_0x241b58[_0x396d98['name']]={'$like':'%'+_0x5dac86['query'][_0x0a82('0x45')]+'%'};return _0x241b58;}})});}_0x5eeb7d=_[_0x0a82('0x46')]({},_0x5eeb7d,_0x5dac86[_0x0a82('0x47')]);var _0x4c83f4={'where':_0x5eeb7d[_0x0a82('0x43')]};return db[_0x0a82('0x33')][_0x0a82('0x21')](_0x4c83f4)[_0x0a82('0x28')](function(_0x4941a9){_0x13fb17[_0x0a82('0x21')]=_0x4941a9;if(_0x5dac86[_0x0a82('0x3c')][_0x0a82('0x48')]){_0x5eeb7d[_0x0a82('0x49')]=[{'all':!![]}];}return db[_0x0a82('0x33')][_0x0a82('0x4a')](_0x5eeb7d);})[_0x0a82('0x28')](function(_0x46ef82){_0x13fb17[_0x0a82('0x4b')]=_0x46ef82;return _0x13fb17;})['then'](respondWithFilteredResult(_0x5776bc,_0x5eeb7d))[_0x0a82('0x4c')](handleError(_0x5776bc,null));};exports['show']=function(_0x30f1e9,_0x5238b4){var _0x1121a9={'raw':![],'where':{'id':_0x30f1e9['params']['id']}},_0x5b40f4={};_0x5b40f4[_0x0a82('0x37')]=_[_0x0a82('0x38')](db[_0x0a82('0x33')][_0x0a82('0x34')]);_0x5b40f4[_0x0a82('0x3c')]=_[_0x0a82('0x38')](_0x30f1e9[_0x0a82('0x3c')]);_0x5b40f4[_0x0a82('0x39')]=_[_0x0a82('0x3a')](_0x5b40f4[_0x0a82('0x37')],_0x5b40f4[_0x0a82('0x3c')]);_0x1121a9[_0x0a82('0x3b')]=_[_0x0a82('0x3a')](_0x5b40f4[_0x0a82('0x37')],qs[_0x0a82('0x3d')](_0x30f1e9[_0x0a82('0x3c')]['fields']));_0x1121a9[_0x0a82('0x3b')]=_0x1121a9['attributes'][_0x0a82('0x3e')]?_0x1121a9[_0x0a82('0x3b')]:_0x5b40f4['model'];if(_0x30f1e9[_0x0a82('0x3c')][_0x0a82('0x48')]){_0x1121a9[_0x0a82('0x49')]=[{'all':!![]}];}_0x1121a9=_[_0x0a82('0x46')]({},_0x1121a9,_0x30f1e9[_0x0a82('0x47')]);return db[_0x0a82('0x33')][_0x0a82('0x4d')](_0x1121a9)[_0x0a82('0x28')](handleEntityNotFound(_0x5238b4,null))[_0x0a82('0x28')](respondWithResult(_0x5238b4,null))['catch'](handleError(_0x5238b4,null));};exports['create']=function(_0x4096cc,_0x34ffd9){return db[_0x0a82('0x33')][_0x0a82('0x4e')](_0x4096cc[_0x0a82('0x4f')],{})[_0x0a82('0x28')](function(_0x3483c6){var _0x170f47=_0x4096cc['user'][_0x0a82('0x29')]({'plain':!![]});if(!_0x170f47)throw new Error(_0x0a82('0x50'));if(_0x170f47[_0x0a82('0x51')]===_0x0a82('0x52')){var _0x3310cb=_0x3483c6[_0x0a82('0x29')]({'plain':!![]});var _0xa0d93c=_0x0a82('0x2a');return db[_0x0a82('0x53')][_0x0a82('0x4d')]({'where':{'name':_0xa0d93c,'userProfileId':_0x170f47[_0x0a82('0x54')]},'raw':!![]})[_0x0a82('0x28')](function(_0x199f1b){if(_0x199f1b&&_0x199f1b[_0x0a82('0x55')]===0x0){return db[_0x0a82('0x2b')][_0x0a82('0x4e')]({'name':_0x3310cb['name'],'resourceId':_0x3310cb['id'],'type':_0x199f1b[_0x0a82('0x30')],'sectionId':_0x199f1b['id']},{})['then'](function(){return _0x3483c6;});}else{return _0x3483c6;}})['catch'](function(_0x21bb1b){logger[_0x0a82('0x2e')](_0x0a82('0x56'),_0x21bb1b);throw _0x21bb1b;});}return _0x3483c6;})[_0x0a82('0x28')](respondWithResult(_0x34ffd9,0xc9))[_0x0a82('0x4c')](handleError(_0x34ffd9,null));};exports[_0x0a82('0x27')]=function(_0x408934,_0x45e2c3){if(_0x408934['body']['id']){delete _0x408934[_0x0a82('0x4f')]['id'];}return db[_0x0a82('0x33')][_0x0a82('0x4d')]({'where':{'id':_0x408934[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x45e2c3,null))[_0x0a82('0x28')](saveUpdates(_0x408934['body'],null))[_0x0a82('0x28')](respondWithResult(_0x45e2c3,null))[_0x0a82('0x4c')](handleError(_0x45e2c3,null));};exports[_0x0a82('0x2c')]=function(_0x29bce0,_0x31c144){return db[_0x0a82('0x33')][_0x0a82('0x4d')]({'where':{'id':_0x29bce0[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x31c144,null))[_0x0a82('0x28')](removeEntity(_0x31c144,null))['catch'](handleError(_0x31c144,null));};exports[_0x0a82('0x58')]=function(_0x41bf43,_0x1c3524){return db['CmList'][_0x0a82('0x58')]()['then'](respondWithResult(_0x1c3524,null))[_0x0a82('0x4c')](handleError(_0x1c3524,null));};exports[_0x0a82('0x59')]=function(_0x249f5c,_0x10427d,_0x300871){if(_0x249f5c[_0x0a82('0x4f')]['id']){delete _0x249f5c[_0x0a82('0x4f')]['id'];}return db[_0x0a82('0x33')][_0x0a82('0x4d')]({'where':{'id':_0x249f5c[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x10427d,null))[_0x0a82('0x28')](function(_0x305eed){if(_0x305eed){_0x249f5c['body'][_0x0a82('0x5a')]=_0x305eed['id'];return db[_0x0a82('0x5b')][_0x0a82('0x4e')](_0x249f5c[_0x0a82('0x4f')]);}})[_0x0a82('0x28')](respondWithResult(_0x10427d,null))['catch'](handleError(_0x10427d,null));};exports[_0x0a82('0x5c')]=function(_0x253815,_0x389974,_0x54ab6c){var _0x5dde01={'raw':![],'where':{}};var _0x577aae={};var _0x25fd81={'count':0x0,'rows':[]};return db[_0x0a82('0x33')][_0x0a82('0x5d')]({'where':{'id':_0x253815[_0x0a82('0x57')]['id']}})['then'](handleEntityNotFound(_0x389974,null))[_0x0a82('0x28')](function(_0x403f33){if(_0x403f33){_0x577aae[_0x0a82('0x37')]=_['keys'](db[_0x0a82('0x5b')]['rawAttributes']);_0x577aae[_0x0a82('0x3c')]=_['keys'](_0x253815[_0x0a82('0x3c')]);_0x577aae[_0x0a82('0x39')]=_[_0x0a82('0x3a')](_0x577aae[_0x0a82('0x37')],_0x577aae[_0x0a82('0x3c')]);_0x5dde01[_0x0a82('0x3b')]=_['intersection'](_0x577aae['model'],qs['fields'](_0x253815[_0x0a82('0x3c')][_0x0a82('0x3d')]));_0x5dde01[_0x0a82('0x3b')]=_0x5dde01[_0x0a82('0x3b')][_0x0a82('0x3e')]?_0x5dde01[_0x0a82('0x3b')]:_0x577aae[_0x0a82('0x37')];if(!_0x253815[_0x0a82('0x3c')][_0x0a82('0x3f')]('nolimit')){_0x5dde01['limit']=qs['limit'](_0x253815[_0x0a82('0x3c')]['limit']);_0x5dde01[_0x0a82('0x22')]=qs[_0x0a82('0x22')](_0x253815[_0x0a82('0x3c')]['offset']);}_0x5dde01[_0x0a82('0x41')]=qs[_0x0a82('0x42')](_0x253815[_0x0a82('0x3c')][_0x0a82('0x42')]);_0x5dde01['where']=qs[_0x0a82('0x39')](_['pick'](_0x253815[_0x0a82('0x3c')],_0x577aae[_0x0a82('0x39')]));_0x5dde01[_0x0a82('0x43')][_0x0a82('0x5a')]=_0x403f33['id'];if(_0x253815[_0x0a82('0x3c')]['filter']){_0x5dde01[_0x0a82('0x43')]=_[_0x0a82('0x46')](_0x5dde01['where'],{'$or':_[_0x0a82('0x32')](_0x5dde01[_0x0a82('0x3b')],function(_0x5162a1){var _0x3e90b7={};_0x3e90b7[_0x5162a1]={'$like':'%'+_0x253815['query'][_0x0a82('0x45')]+'%'};return _0x3e90b7;})});}_0x5dde01=_['merge']({},_0x5dde01,_0x253815[_0x0a82('0x47')]);return db[_0x0a82('0x5b')][_0x0a82('0x21')]({'where':_0x5dde01[_0x0a82('0x43')]})[_0x0a82('0x28')](function(_0x258e4e){_0x25fd81[_0x0a82('0x21')]=_0x258e4e;if(_0x253815[_0x0a82('0x3c')][_0x0a82('0x48')]){_0x5dde01[_0x0a82('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x0a82('0x4a')](_0x5dde01);})[_0x0a82('0x28')](function(_0x5213ac){_0x25fd81[_0x0a82('0x4b')]=_0x5213ac;return _0x25fd81;});}})[_0x0a82('0x28')](respondWithFilteredResult(_0x389974,_0x5dde01))[_0x0a82('0x4c')](handleError(_0x389974,null));};exports['removeDispositions']=function(_0x28895d,_0x4046e4,_0x2cf584){return db['CmList'][_0x0a82('0x4d')]({'where':{'id':_0x28895d[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x4046e4,null))['then'](function(_0x1c50df){if(_0x1c50df){return _0x1c50df[_0x0a82('0x5e')](_0x28895d[_0x0a82('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x4046e4,null))[_0x0a82('0x4c')](handleError(_0x4046e4,null));};exports[_0x0a82('0x5f')]=function(_0x322aad,_0x371035,_0x3ac331){return db['CmList']['find']({'where':{'id':_0x322aad[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x371035,null))[_0x0a82('0x28')](function(_0x5f3cfc){if(_0x5f3cfc){var _0x1dd262=[];var _0x223c14={'success':[],'errors':[]};return db[_0x0a82('0x60')]['describe']()[_0x0a82('0x28')](function(_0x2d4462){if(_0x322aad['body'][_0x0a82('0x61')]&&_['isArray'](_0x322aad[_0x0a82('0x4f')]['tags'])){if(_0x322aad[_0x0a82('0x4f')][_0x0a82('0x61')][_0x0a82('0x3e')]){_0x322aad['body'][_0x0a82('0x61')]=_0x322aad[_0x0a82('0x4f')][_0x0a82('0x61')]['join'](';')+';';}else{_0x322aad['body']['tags']=null;}}else{_0x322aad[_0x0a82('0x4f')][_0x0a82('0x61')]=null;}if(_0x322aad['body']&&_[_0x0a82('0x62')](_0x322aad[_0x0a82('0x4f')])){for(var _0x59959d=0x0;_0x59959d<_0x322aad[_0x0a82('0x4f')][_0x0a82('0x3e')];_0x59959d+=0x1){_0x322aad[_0x0a82('0x4f')][_0x59959d][_0x0a82('0x5a')]=_0x322aad[_0x0a82('0x57')]['id'];_0x1dd262[_0x0a82('0x63')](_0x322aad[_0x0a82('0x4f')][_0x59959d]);}return BPromise[_0x0a82('0x64')](_0x1dd262,function(_0x1ac7ef){return db['CmContact']['create'](_[_0x0a82('0x65')](_0x1ac7ef,[_0x0a82('0x66'),'id'])||{},{'fields':_['keys'](_0x2d4462),'raw':!![]})[_0x0a82('0x28')](function(_0x20b26e){_0x223c14[_0x0a82('0x67')][_0x0a82('0x63')](_0x20b26e[_0x0a82('0x68')]);})[_0x0a82('0x4c')](function(_0xb79141){_0x223c14['errors'][_0x0a82('0x63')]({'data':_0x1ac7ef,'error':_0xb79141[_0x0a82('0x69')]});});})[_0x0a82('0x28')](function(_0x1437e6){return _0x223c14;})['catch'](function(_0x232847){return _0x232847;});}else{_0x371035[_0x0a82('0x1e')](0x190)['json']({'message':_0x0a82('0x6a')});}});}})[_0x0a82('0x28')](respondWithResult(_0x371035,null))['catch'](handleError(_0x371035,null));};exports['getContacts']=function(_0x22d4a0,_0x30d1f9,_0x218316){var _0x135bb8;return db[_0x0a82('0x33')]['find']({'where':{'id':_0x22d4a0[_0x0a82('0x57')]['id']},'include':[{'model':db[_0x0a82('0x6b')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x30d1f9,null))[_0x0a82('0x28')](function(_0x346db7){if(_0x346db7){_0x135bb8=_0x346db7;return db[_0x0a82('0x60')][_0x0a82('0x34')];}})[_0x0a82('0x28')](function(_0x63b23e){if(_0x63b23e){var _0x5c5458={};var _0x3cd466={};_0x3cd466[_0x0a82('0x37')]=_[_0x0a82('0x6c')](_[_0x0a82('0x38')](_0x63b23e),_['map'](_0x135bb8[_0x0a82('0x6d')],function(_0x45a9ef){return util[_0x0a82('0x6e')](_0x0a82('0x6f'),_0x45a9ef['id']);}));_0x3cd466[_0x0a82('0x3c')]=_[_0x0a82('0x38')](_0x22d4a0[_0x0a82('0x3c')]);_0x3cd466[_0x0a82('0x39')]=_['intersection'](_0x3cd466[_0x0a82('0x37')],_0x3cd466['query']);_0x5c5458['attributes']=_['intersection'](_0x3cd466['model'],qs[_0x0a82('0x3d')](_0x22d4a0['query'][_0x0a82('0x3d')]));_0x5c5458[_0x0a82('0x3b')]=_0x5c5458[_0x0a82('0x3b')][_0x0a82('0x3e')]?_0x5c5458['attributes']:_0x3cd466['model'];if(!_0x22d4a0[_0x0a82('0x3c')][_0x0a82('0x3f')](_0x0a82('0x40'))){_0x5c5458[_0x0a82('0x23')]=qs['limit'](_0x22d4a0[_0x0a82('0x3c')][_0x0a82('0x23')]);_0x5c5458[_0x0a82('0x22')]=qs[_0x0a82('0x22')](_0x22d4a0['query'][_0x0a82('0x22')]);}_0x5c5458[_0x0a82('0x41')]=qs[_0x0a82('0x42')](_0x22d4a0[_0x0a82('0x3c')]['sort']);_0x5c5458[_0x0a82('0x43')]=qs[_0x0a82('0x39')](_[_0x0a82('0x44')](_0x22d4a0[_0x0a82('0x3c')],_0x3cd466['filters']));_0x5c5458[_0x0a82('0x70')]=!![];if(_0x22d4a0[_0x0a82('0x3c')]['filter']){_0x5c5458['where']=_[_0x0a82('0x46')](_0x5c5458['where'],{'$or':_['map'](_0x5c5458[_0x0a82('0x3b')],function(_0x136088){var _0x28d7fd={};_0x28d7fd[_0x136088]={'$like':'%'+_0x22d4a0['query'][_0x0a82('0x45')]+'%'};return _0x28d7fd;})});}_0x5c5458=_['merge']({},_0x5c5458,_0x22d4a0[_0x0a82('0x47')]);return _0x135bb8['getContacts'](_0x5c5458);}})[_0x0a82('0x28')](respondWithResult(_0x30d1f9,null))[_0x0a82('0x4c')](handleError(_0x30d1f9,null));};exports[_0x0a82('0x71')]=function(_0x436f12,_0x53abf3,_0x38886f){var _0x318aa9;return db[_0x0a82('0x33')][_0x0a82('0x4d')]({'where':{'id':_0x436f12[_0x0a82('0x57')]['id']},'include':[{'model':db[_0x0a82('0x6b')],'as':'CustomFields'}]})[_0x0a82('0x28')](handleEntityNotFound(_0x53abf3,null))[_0x0a82('0x28')](function(_0x2985f4){if(_0x2985f4){_0x318aa9=_0x2985f4;return db[_0x0a82('0x60')][_0x0a82('0x34')];}})[_0x0a82('0x28')](function(_0x23f863){if(_0x23f863){var _0x57ef3d={};var _0x24bd94={};_0x24bd94['model']=_[_0x0a82('0x6c')](_['keys'](_0x23f863),_[_0x0a82('0x32')](_0x318aa9['CustomFields'],function(_0x450820){return util[_0x0a82('0x6e')](_0x0a82('0x6f'),_0x450820['id']);}));_0x24bd94[_0x0a82('0x3c')]=_[_0x0a82('0x38')](_0x436f12['query']);_0x24bd94[_0x0a82('0x39')]=_[_0x0a82('0x3a')](_0x24bd94['model'],_0x24bd94[_0x0a82('0x3c')]);_0x57ef3d['attributes']=_[_0x0a82('0x3a')](_0x24bd94[_0x0a82('0x37')],qs[_0x0a82('0x3d')](_0x436f12['query'][_0x0a82('0x3d')]));_0x57ef3d[_0x0a82('0x3b')]=_0x57ef3d['attributes'][_0x0a82('0x3e')]?_0x57ef3d[_0x0a82('0x3b')]:_0x24bd94[_0x0a82('0x37')];if(!_0x436f12[_0x0a82('0x3c')][_0x0a82('0x3f')](_0x0a82('0x40'))){_0x57ef3d['limit']=qs[_0x0a82('0x23')](_0x436f12[_0x0a82('0x3c')][_0x0a82('0x23')]);_0x57ef3d[_0x0a82('0x22')]=qs['offset'](_0x436f12['query'][_0x0a82('0x22')]);}_0x57ef3d[_0x0a82('0x41')]=qs[_0x0a82('0x42')](_0x436f12['query']['sort']);_0x57ef3d[_0x0a82('0x43')]=qs[_0x0a82('0x39')](_[_0x0a82('0x44')](_0x436f12[_0x0a82('0x3c')],_0x24bd94[_0x0a82('0x39')]));_0x57ef3d[_0x0a82('0x70')]=!![];if(_0x436f12[_0x0a82('0x3c')][_0x0a82('0x45')]){_0x57ef3d[_0x0a82('0x43')]=_[_0x0a82('0x46')](_0x57ef3d[_0x0a82('0x43')],{'$or':_[_0x0a82('0x32')](_0x57ef3d[_0x0a82('0x3b')],function(_0x27ba2f){var _0x31d395={};_0x31d395[_0x27ba2f]={'$like':'%'+_0x436f12[_0x0a82('0x3c')][_0x0a82('0x45')]+'%'};return _0x31d395;})});}_0x57ef3d=_[_0x0a82('0x46')]({},_0x57ef3d,_0x436f12[_0x0a82('0x47')]);return _0x318aa9[_0x0a82('0x72')](_0x57ef3d);}})[_0x0a82('0x28')](function(_0x3e5796){if(!_[_0x0a82('0x73')](_0x3e5796)){var _0x1bbc87=toCsv(_0x3e5796);var _0x1d03c3=Date[_0x0a82('0x74')]();fs[_0x0a82('0x75')](util[_0x0a82('0x6e')](_0x0a82('0x76'),_0x318aa9['id'],_0x1d03c3),_0x1bbc87);_0x53abf3[_0x0a82('0x77')]('Content-disposition',_0x0a82('0x78')+util[_0x0a82('0x6e')](_0x0a82('0x79'),_0x318aa9['id'],_0x1d03c3));_0x53abf3[_0x0a82('0x77')]('Content-type',_0x0a82('0x7a'));return _0x53abf3[_0x0a82('0x7b')](util['format'](_0x0a82('0x76'),_0x318aa9['id'],_0x1d03c3));}else{return _0x53abf3['sendStatus'](0xcc);}})[_0x0a82('0x4c')](handleError(_0x53abf3,null));};exports[_0x0a82('0x7c')]=function(_0x55a4df,_0x4efc8b,_0x301814){var _0xfd6ad4;delete _0x55a4df[_0x0a82('0x4f')]['id'];return db[_0x0a82('0x33')]['findOne']({'where':{'id':_0x55a4df['params']['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x4efc8b,null))[_0x0a82('0x28')](function(_0x425f19){if(_0x425f19){return db[_0x0a82('0x7d')][_0x0a82('0x7e')](function(_0x463ac2){return db[_0x0a82('0x6b')][_0x0a82('0x4e')](_0x55a4df[_0x0a82('0x4f')],{'transaction':_0x463ac2})[_0x0a82('0x28')](function(_0x20c155){_0xfd6ad4=_0x20c155;return _0x425f19['addCustomFields'](_0x20c155,{'transaction':_0x463ac2});})[_0x0a82('0x28')](function(){var _0x4e086a={'type':db['Sequelize'][_0x0a82('0x7f')],'transaction':_0x463ac2};switch(_0x55a4df[_0x0a82('0x4f')][_0x0a82('0x35')]){case _0x0a82('0x80'):_0x4e086a['type']=db[_0x0a82('0x81')][_0x0a82('0x7f')];break;case _0x0a82('0x82'):_0x4e086a[_0x0a82('0x35')]=db[_0x0a82('0x81')]['INTEGER'];break;case _0x0a82('0x83'):_0x4e086a[_0x0a82('0x35')]=db['Sequelize'][_0x0a82('0x84')];_0x4e086a[_0x0a82('0x85')]=![];break;default:}return db[_0x0a82('0x7d')][_0x0a82('0x86')][_0x0a82('0x87')]('cm_contacts',util[_0x0a82('0x6e')]('cf_%s',_0xfd6ad4['id']),_0x4e086a);})['then'](function(){return _0xfd6ad4;});});}})[_0x0a82('0x28')](respondWithResult(_0x4efc8b,null))[_0x0a82('0x4c')](handleError(_0x4efc8b,null));};exports[_0x0a82('0x88')]=function(_0x3fa812,_0x1bd6ac,_0x27e8d0){var _0x4df072={};var _0x1a8790={};var _0x146f89;var _0x1cd9cf;return db[_0x0a82('0x33')][_0x0a82('0x5d')]({'where':{'id':_0x3fa812[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x1bd6ac,null))[_0x0a82('0x28')](function(_0x4c8e5c){if(_0x4c8e5c){_0x146f89=_0x4c8e5c;_0x1a8790[_0x0a82('0x37')]=_[_0x0a82('0x38')](db[_0x0a82('0x6b')][_0x0a82('0x34')]);_0x1a8790[_0x0a82('0x3c')]=_['keys'](_0x3fa812['query']);_0x1a8790[_0x0a82('0x39')]=_['intersection'](_0x1a8790['model'],_0x1a8790[_0x0a82('0x3c')]);_0x4df072[_0x0a82('0x3b')]=_[_0x0a82('0x3a')](_0x1a8790['model'],qs['fields'](_0x3fa812[_0x0a82('0x3c')][_0x0a82('0x3d')]));_0x4df072[_0x0a82('0x3b')]=_0x4df072[_0x0a82('0x3b')][_0x0a82('0x3e')]?_0x4df072[_0x0a82('0x3b')]:_0x1a8790[_0x0a82('0x37')];_0x4df072[_0x0a82('0x41')]=qs[_0x0a82('0x42')](_0x3fa812[_0x0a82('0x3c')][_0x0a82('0x42')]);_0x4df072[_0x0a82('0x43')]=qs[_0x0a82('0x39')](_[_0x0a82('0x44')](_0x3fa812[_0x0a82('0x3c')],_0x1a8790[_0x0a82('0x39')]));_0x4df072['where']=_[_0x0a82('0x46')](_0x4df072['where'],{'$or':[{'ListId':_0x4c8e5c['id']},{'ListId':null}]});if(_0x3fa812[_0x0a82('0x3c')][_0x0a82('0x45')]){_0x4df072[_0x0a82('0x43')]=_['merge'](_0x4df072[_0x0a82('0x43')],{'$or':_[_0x0a82('0x32')](_0x4df072['attributes'],function(_0x4a361d){var _0x2ff894={};_0x2ff894[_0x4a361d]={'$like':'%'+_0x3fa812[_0x0a82('0x3c')][_0x0a82('0x45')]+'%'};return _0x2ff894;})});}_0x4df072=_[_0x0a82('0x46')]({},_0x4df072,_0x3fa812[_0x0a82('0x47')]);return db['CmCustomField'][_0x0a82('0x89')](_0x4df072);}})[_0x0a82('0x28')](respondWithResult(_0x1bd6ac,null))['catch'](handleError(_0x1bd6ac,null));};exports[_0x0a82('0x8a')]=function(_0x437b51,_0x106116,_0x1f72d8){return db['CmList'][_0x0a82('0x4d')]({'where':{'id':_0x437b51[_0x0a82('0x57')]['id']}})['then'](handleEntityNotFound(_0x106116,null))[_0x0a82('0x28')](function(_0x43327c){if(_0x43327c){return _0x43327c['addAgents'](_0x437b51[_0x0a82('0x4f')][_0x0a82('0x66')],_['omit'](_0x437b51[_0x0a82('0x4f')],[_0x0a82('0x66'),'id'])||{})[_0x0a82('0x8b')](function(_0x8ee0b2){for(var _0x5083ed=0x0;_0x5083ed<_0x437b51[_0x0a82('0x4f')][_0x0a82('0x66')][_0x0a82('0x3e')];_0x5083ed+=0x1){socket[_0x0a82('0x8c')]('userCmList:save',{'UserId':_0x437b51['body'][_0x0a82('0x66')][_0x5083ed],'CmListId':_0x437b51[_0x0a82('0x57')]['id']});}return _0x8ee0b2;});}})[_0x0a82('0x28')](respondWithResult(_0x106116,null))['catch'](handleError(_0x106116,null));};exports[_0x0a82('0x8d')]=function(_0x2e5eaf,_0x182aa5,_0x23a0d1){return db['CmList'][_0x0a82('0x4d')]({'where':{'id':_0x2e5eaf[_0x0a82('0x57')]['id']}})[_0x0a82('0x28')](handleEntityNotFound(_0x182aa5,null))[_0x0a82('0x28')](function(_0x1a1601){if(_0x1a1601){return _0x1a1601[_0x0a82('0x8d')](_0x2e5eaf[_0x0a82('0x3c')][_0x0a82('0x66')])[_0x0a82('0x28')](function(){if(_[_0x0a82('0x62')](_0x2e5eaf['query'][_0x0a82('0x66')])){for(var _0x28a087=0x0;_0x28a087<_0x2e5eaf[_0x0a82('0x3c')]['ids']['length'];_0x28a087+=0x1){socket[_0x0a82('0x8c')](_0x0a82('0x8e'),{'UserId':Number(_0x2e5eaf[_0x0a82('0x3c')][_0x0a82('0x66')][_0x28a087]),'CmListId':Number(_0x2e5eaf[_0x0a82('0x57')]['id'])});}}else{socket['emit'](_0x0a82('0x8e'),{'UserId':Number(_0x2e5eaf[_0x0a82('0x3c')][_0x0a82('0x66')]),'CmListId':Number(_0x2e5eaf[_0x0a82('0x57')]['id'])});}});}})[_0x0a82('0x28')](respondWithStatusCode(_0x182aa5,null))[_0x0a82('0x4c')](handleError(_0x182aa5,null));};exports[_0x0a82('0x8f')]=function(_0x17bb55,_0x4ff572,_0x55ab69){var _0xbf52a3={};var _0x286c65={};var _0x56a473;var _0x458520;return db['CmList'][_0x0a82('0x5d')]({'where':{'id':_0x17bb55['params']['id']}})['then'](handleEntityNotFound(_0x4ff572,null))[_0x0a82('0x28')](function(_0xfcb92f){if(_0xfcb92f){_0x56a473=_0xfcb92f;_0x286c65[_0x0a82('0x37')]=_[_0x0a82('0x38')](db[_0x0a82('0x90')]['rawAttributes']);_0x286c65[_0x0a82('0x3c')]=_['keys'](_0x17bb55[_0x0a82('0x3c')]);_0x286c65[_0x0a82('0x39')]=_[_0x0a82('0x3a')](_0x286c65['model'],_0x286c65['query']);_0xbf52a3['attributes']=_['intersection'](_0x286c65['model'],qs[_0x0a82('0x3d')](_0x17bb55['query'][_0x0a82('0x3d')]));_0xbf52a3[_0x0a82('0x3b')]=_0xbf52a3['attributes'][_0x0a82('0x3e')]?_0xbf52a3[_0x0a82('0x3b')]:_0x286c65[_0x0a82('0x37')];_0xbf52a3['order']=qs[_0x0a82('0x42')](_0x17bb55[_0x0a82('0x3c')][_0x0a82('0x42')]);_0xbf52a3[_0x0a82('0x43')]=qs[_0x0a82('0x39')](_[_0x0a82('0x44')](_0x17bb55[_0x0a82('0x3c')],_0x286c65[_0x0a82('0x39')]));if(_0x17bb55[_0x0a82('0x3c')][_0x0a82('0x45')]){_0xbf52a3[_0x0a82('0x43')]=_[_0x0a82('0x46')](_0xbf52a3[_0x0a82('0x43')],{'$or':_[_0x0a82('0x32')](_0xbf52a3[_0x0a82('0x3b')],function(_0x3ae7d8){var _0x59854f={};_0x59854f[_0x3ae7d8]={'$like':'%'+_0x17bb55[_0x0a82('0x3c')]['filter']+'%'};return _0x59854f;})});}_0xbf52a3=_[_0x0a82('0x46')]({},_0xbf52a3,_0x17bb55['options']);return _0x56a473[_0x0a82('0x8f')](_0xbf52a3);}})['then'](function(_0x46472b){if(_0x46472b){_0x458520=_0x46472b[_0x0a82('0x3e')];if(!_0x17bb55[_0x0a82('0x3c')][_0x0a82('0x3f')]('nolimit')){_0xbf52a3['limit']=qs[_0x0a82('0x23')](_0x17bb55['query'][_0x0a82('0x23')]);_0xbf52a3[_0x0a82('0x22')]=qs[_0x0a82('0x22')](_0x17bb55[_0x0a82('0x3c')]['offset']);}return _0x56a473[_0x0a82('0x8f')](_0xbf52a3);}})['then'](function(_0x584570){if(_0x584570){return _0x584570?{'count':_0x458520,'rows':_0x584570}:null;}})[_0x0a82('0x28')](respondWithResult(_0x4ff572,null))['catch'](handleError(_0x4ff572,null));}; \ No newline at end of file +var _0x7c3a=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','params','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','omit','ids','push','dataValues','errors','message','json','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','getContacts','format','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','count','offset','set','Content-Range','reject','save','then','destroy','get','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','catch','show','length','includeAll','find','create','body','user','role','Lists','UserProfileSection','userProfileId'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x7c3a,0xd3));var _0xa7c3=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x7c3a[_0x40d8d7];return _0x3454cc;};'use strict';var pdf=require(_0xa7c3('0x0'));var emlformat=require(_0xa7c3('0x1'));var rimraf=require(_0xa7c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7c3('0x3'));var rp=require(_0xa7c3('0x4'));var moment=require('moment');var BPromise=require(_0xa7c3('0x5'));var Mustache=require(_0xa7c3('0x6'));var util=require(_0xa7c3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa7c3('0x8'));var ejs=require(_0xa7c3('0x9'));var fs=require('fs');var _=require(_0xa7c3('0xa'));var squel=require(_0xa7c3('0xb'));var crypto=require(_0xa7c3('0xc'));var jsforce=require(_0xa7c3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa7c3('0x8'));var querystring=require(_0xa7c3('0xe'));var Papa=require(_0xa7c3('0xf'));var Redis=require(_0xa7c3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c3('0x11'));var logger=require(_0xa7c3('0x12'))(_0xa7c3('0x13'));var utils=require(_0xa7c3('0x14'));var config=require('../../config/environment');var db=require(_0xa7c3('0x15'))['db'];config[_0xa7c3('0x16')]=_[_0xa7c3('0x17')](config[_0xa7c3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7c3('0x18'))(new Redis(config[_0xa7c3('0x16')]));require(_0xa7c3('0x19'))[_0xa7c3('0x1a')](socket);function respondWithStatusCode(_0x18756e,_0x2ebf99){_0x2ebf99=_0x2ebf99||0xcc;return function(_0x283c19){if(_0x283c19){return _0x18756e[_0xa7c3('0x1b')](_0x2ebf99);}return _0x18756e[_0xa7c3('0x1c')](_0x2ebf99)['end']();};}function respondWithResult(_0x26e0f8,_0x3c0ca2){_0x3c0ca2=_0x3c0ca2||0xc8;return function(_0x487682){if(_0x487682){return _0x26e0f8[_0xa7c3('0x1c')](_0x3c0ca2)['json'](_0x487682);}};}function respondWithFilteredResult(_0x53a23b,_0x3f61f1){return function(_0x646b92){if(_0x646b92){var _0xe57085=_0x646b92[_0xa7c3('0x1d')],_0x2c7415=_0x3f61f1[_0xa7c3('0x1e')],_0x107f4c=_0x3f61f1['offset']+_0x3f61f1['limit'],_0xb793b9;if(_0x107f4c>=_0xe57085){_0x107f4c=_0xe57085;_0xb793b9=0xc8;}else{_0xb793b9=0xce;}_0x53a23b[_0xa7c3('0x1c')](_0xb793b9);return _0x53a23b[_0xa7c3('0x1f')](_0xa7c3('0x20'),_0x2c7415+'-'+_0x107f4c+'/'+_0xe57085)['json'](_0x646b92);}return null;};}function patchUpdates(_0x265609){return function(_0x23b4fe){try{jsonpatch['apply'](_0x23b4fe,_0x265609,!![]);}catch(_0x3a053b){return BPromise[_0xa7c3('0x21')](_0x3a053b);}return _0x23b4fe[_0xa7c3('0x22')]();};}function saveUpdates(_0x3ba182,_0x2c6cd5){return function(_0xcb14b8){if(_0xcb14b8){return _0xcb14b8['update'](_0x3ba182)[_0xa7c3('0x23')](function(_0x52eafe){return _0x52eafe;});}return null;};}function removeEntity(_0x24777a,_0x998828){return function(_0x8e9e96){if(_0x8e9e96){return _0x8e9e96[_0xa7c3('0x24')]()[_0xa7c3('0x23')](function(){var _0x3dd6c8=_0x8e9e96[_0xa7c3('0x25')]({'plain':!![]});var _0x1df4f1='Lists';return db['UserProfileResource'][_0xa7c3('0x24')]({'where':{'type':_0x1df4f1,'resourceId':_0x3dd6c8['id']}})['then'](function(){return _0x8e9e96;});})[_0xa7c3('0x23')](function(){_0x24777a['status'](0xcc)[_0xa7c3('0x26')]();});}};}function handleEntityNotFound(_0x3cd92f,_0x355cf7){return function(_0xbbf233){if(!_0xbbf233){_0x3cd92f[_0xa7c3('0x1b')](0x194);}return _0xbbf233;};}function handleError(_0x11e314,_0xa83d9a){_0xa83d9a=_0xa83d9a||0x1f4;return function(_0x207506){logger[_0xa7c3('0x27')](_0x207506[_0xa7c3('0x28')]);if(_0x207506['name']){delete _0x207506[_0xa7c3('0x29')];}_0x11e314['status'](_0xa83d9a)[_0xa7c3('0x2a')](_0x207506);};}exports[_0xa7c3('0x2b')]=function(_0x181762,_0x4a224a){var _0x2b5059={},_0x5d9893={},_0x47992c={'count':0x0,'rows':[]};var _0x29e02e=_[_0xa7c3('0x2c')](db[_0xa7c3('0x2d')][_0xa7c3('0x2e')],function(_0x30dfa5){return{'name':_0x30dfa5[_0xa7c3('0x2f')],'type':_0x30dfa5[_0xa7c3('0x30')][_0xa7c3('0x31')]};});_0x5d9893[_0xa7c3('0x32')]=_['map'](_0x29e02e,_0xa7c3('0x29'));_0x5d9893[_0xa7c3('0x33')]=_[_0xa7c3('0x34')](_0x181762[_0xa7c3('0x33')]);_0x5d9893['filters']=_[_0xa7c3('0x35')](_0x5d9893[_0xa7c3('0x32')],_0x5d9893['query']);_0x2b5059['attributes']=_[_0xa7c3('0x35')](_0x5d9893['model'],qs[_0xa7c3('0x36')](_0x181762[_0xa7c3('0x33')][_0xa7c3('0x36')]));_0x2b5059[_0xa7c3('0x37')]=_0x2b5059[_0xa7c3('0x37')]['length']?_0x2b5059[_0xa7c3('0x37')]:_0x5d9893['model'];if(!_0x181762[_0xa7c3('0x33')][_0xa7c3('0x38')](_0xa7c3('0x39'))){_0x2b5059[_0xa7c3('0x3a')]=qs[_0xa7c3('0x3a')](_0x181762[_0xa7c3('0x33')][_0xa7c3('0x3a')]);_0x2b5059['offset']=qs[_0xa7c3('0x1e')](_0x181762['query']['offset']);}_0x2b5059[_0xa7c3('0x3b')]=qs['sort'](_0x181762[_0xa7c3('0x33')][_0xa7c3('0x3c')]);_0x2b5059['where']=qs[_0xa7c3('0x3d')](_[_0xa7c3('0x3e')](_0x181762[_0xa7c3('0x33')],_0x5d9893[_0xa7c3('0x3d')]),_0x29e02e);if(_0x181762[_0xa7c3('0x33')][_0xa7c3('0x3f')]){_0x2b5059[_0xa7c3('0x40')]=_[_0xa7c3('0x41')](_0x2b5059[_0xa7c3('0x40')],{'$or':_['map'](_0x29e02e,function(_0x2ff7cd){if(_0x2ff7cd[_0xa7c3('0x30')]!==_0xa7c3('0x42')){var _0x525ccc={};_0x525ccc[_0x2ff7cd[_0xa7c3('0x29')]]={'$like':'%'+_0x181762[_0xa7c3('0x33')][_0xa7c3('0x3f')]+'%'};return _0x525ccc;}})});}_0x2b5059=_[_0xa7c3('0x41')]({},_0x2b5059,_0x181762[_0xa7c3('0x43')]);var _0x1adf3a={'where':_0x2b5059[_0xa7c3('0x40')]};return db[_0xa7c3('0x2d')][_0xa7c3('0x1d')](_0x1adf3a)[_0xa7c3('0x23')](function(_0x5ae844){_0x47992c[_0xa7c3('0x1d')]=_0x5ae844;if(_0x181762['query']['includeAll']){_0x2b5059[_0xa7c3('0x44')]=[{'all':!![]}];}return db[_0xa7c3('0x2d')]['findAll'](_0x2b5059);})[_0xa7c3('0x23')](function(_0x39903b){_0x47992c['rows']=_0x39903b;return _0x47992c;})[_0xa7c3('0x23')](respondWithFilteredResult(_0x4a224a,_0x2b5059))[_0xa7c3('0x45')](handleError(_0x4a224a,null));};exports[_0xa7c3('0x46')]=function(_0x5a337b,_0x3aaeeb){var _0x282e04={'raw':![],'where':{'id':_0x5a337b['params']['id']}},_0x48ac1d={};_0x48ac1d[_0xa7c3('0x32')]=_[_0xa7c3('0x34')](db[_0xa7c3('0x2d')]['rawAttributes']);_0x48ac1d[_0xa7c3('0x33')]=_[_0xa7c3('0x34')](_0x5a337b[_0xa7c3('0x33')]);_0x48ac1d['filters']=_[_0xa7c3('0x35')](_0x48ac1d[_0xa7c3('0x32')],_0x48ac1d[_0xa7c3('0x33')]);_0x282e04['attributes']=_[_0xa7c3('0x35')](_0x48ac1d['model'],qs[_0xa7c3('0x36')](_0x5a337b[_0xa7c3('0x33')][_0xa7c3('0x36')]));_0x282e04['attributes']=_0x282e04[_0xa7c3('0x37')][_0xa7c3('0x47')]?_0x282e04[_0xa7c3('0x37')]:_0x48ac1d[_0xa7c3('0x32')];if(_0x5a337b['query'][_0xa7c3('0x48')]){_0x282e04[_0xa7c3('0x44')]=[{'all':!![]}];}_0x282e04=_[_0xa7c3('0x41')]({},_0x282e04,_0x5a337b[_0xa7c3('0x43')]);return db[_0xa7c3('0x2d')][_0xa7c3('0x49')](_0x282e04)[_0xa7c3('0x23')](handleEntityNotFound(_0x3aaeeb,null))['then'](respondWithResult(_0x3aaeeb,null))['catch'](handleError(_0x3aaeeb,null));};exports[_0xa7c3('0x4a')]=function(_0xba62ae,_0x5ce701){return db[_0xa7c3('0x2d')][_0xa7c3('0x4a')](_0xba62ae[_0xa7c3('0x4b')],{})[_0xa7c3('0x23')](function(_0x5b6146){var _0x427240=_0xba62ae[_0xa7c3('0x4c')][_0xa7c3('0x25')]({'plain':!![]});if(!_0x427240)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x427240[_0xa7c3('0x4d')]===_0xa7c3('0x4c')){var _0x1c9c70=_0x5b6146[_0xa7c3('0x25')]({'plain':!![]});var _0x544bd7=_0xa7c3('0x4e');return db[_0xa7c3('0x4f')][_0xa7c3('0x49')]({'where':{'name':_0x544bd7,'userProfileId':_0x427240[_0xa7c3('0x50')]},'raw':!![]})['then'](function(_0x579374){if(_0x579374&&_0x579374[_0xa7c3('0x51')]===0x0){return db[_0xa7c3('0x52')][_0xa7c3('0x4a')]({'name':_0x1c9c70['name'],'resourceId':_0x1c9c70['id'],'type':_0x579374[_0xa7c3('0x29')],'sectionId':_0x579374['id']},{})['then'](function(){return _0x5b6146;});}else{return _0x5b6146;}})[_0xa7c3('0x45')](function(_0x5a63ae){logger[_0xa7c3('0x27')](_0xa7c3('0x53'),_0x5a63ae);throw _0x5a63ae;});}return _0x5b6146;})[_0xa7c3('0x23')](respondWithResult(_0x5ce701,0xc9))[_0xa7c3('0x45')](handleError(_0x5ce701,null));};exports[_0xa7c3('0x54')]=function(_0x5b1ce1,_0xb271d3){if(_0x5b1ce1['body']['id']){delete _0x5b1ce1[_0xa7c3('0x4b')]['id'];}return db[_0xa7c3('0x2d')][_0xa7c3('0x49')]({'where':{'id':_0x5b1ce1['params']['id']}})[_0xa7c3('0x23')](handleEntityNotFound(_0xb271d3,null))[_0xa7c3('0x23')](saveUpdates(_0x5b1ce1[_0xa7c3('0x4b')],null))[_0xa7c3('0x23')](respondWithResult(_0xb271d3,null))[_0xa7c3('0x45')](handleError(_0xb271d3,null));};exports[_0xa7c3('0x24')]=function(_0x3c36db,_0x1a40a7){return db[_0xa7c3('0x2d')][_0xa7c3('0x49')]({'where':{'id':_0x3c36db['params']['id']}})['then'](handleEntityNotFound(_0x1a40a7,null))[_0xa7c3('0x23')](removeEntity(_0x1a40a7,null))[_0xa7c3('0x45')](handleError(_0x1a40a7,null));};exports[_0xa7c3('0x55')]=function(_0x1f6fda,_0x3355d1){return db['CmList']['describe']()['then'](respondWithResult(_0x3355d1,null))[_0xa7c3('0x45')](handleError(_0x3355d1,null));};exports[_0xa7c3('0x56')]=function(_0x9bf857,_0x36d721,_0x2218fe){if(_0x9bf857[_0xa7c3('0x4b')]['id']){delete _0x9bf857[_0xa7c3('0x4b')]['id'];}return db[_0xa7c3('0x2d')]['find']({'where':{'id':_0x9bf857['params']['id']}})['then'](handleEntityNotFound(_0x36d721,null))[_0xa7c3('0x23')](function(_0x27bd80){if(_0x27bd80){_0x9bf857[_0xa7c3('0x4b')][_0xa7c3('0x57')]=_0x27bd80['id'];return db[_0xa7c3('0x58')][_0xa7c3('0x4a')](_0x9bf857[_0xa7c3('0x4b')]);}})[_0xa7c3('0x23')](respondWithResult(_0x36d721,null))['catch'](handleError(_0x36d721,null));};exports[_0xa7c3('0x59')]=function(_0x3e556b,_0x5c6861,_0x4f6ad0){var _0x1565d1={'raw':![],'where':{}};var _0x4c63a0={};var _0x408a00={'count':0x0,'rows':[]};return db[_0xa7c3('0x2d')][_0xa7c3('0x5a')]({'where':{'id':_0x3e556b[_0xa7c3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5c6861,null))[_0xa7c3('0x23')](function(_0x5eb9b8){if(_0x5eb9b8){_0x4c63a0[_0xa7c3('0x32')]=_[_0xa7c3('0x34')](db['Disposition'][_0xa7c3('0x2e')]);_0x4c63a0[_0xa7c3('0x33')]=_[_0xa7c3('0x34')](_0x3e556b['query']);_0x4c63a0[_0xa7c3('0x3d')]=_[_0xa7c3('0x35')](_0x4c63a0[_0xa7c3('0x32')],_0x4c63a0[_0xa7c3('0x33')]);_0x1565d1[_0xa7c3('0x37')]=_['intersection'](_0x4c63a0[_0xa7c3('0x32')],qs[_0xa7c3('0x36')](_0x3e556b['query']['fields']));_0x1565d1[_0xa7c3('0x37')]=_0x1565d1[_0xa7c3('0x37')][_0xa7c3('0x47')]?_0x1565d1[_0xa7c3('0x37')]:_0x4c63a0[_0xa7c3('0x32')];if(!_0x3e556b[_0xa7c3('0x33')]['hasOwnProperty'](_0xa7c3('0x39'))){_0x1565d1['limit']=qs[_0xa7c3('0x3a')](_0x3e556b[_0xa7c3('0x33')][_0xa7c3('0x3a')]);_0x1565d1[_0xa7c3('0x1e')]=qs[_0xa7c3('0x1e')](_0x3e556b[_0xa7c3('0x33')][_0xa7c3('0x1e')]);}_0x1565d1[_0xa7c3('0x3b')]=qs['sort'](_0x3e556b['query'][_0xa7c3('0x3c')]);_0x1565d1[_0xa7c3('0x40')]=qs[_0xa7c3('0x3d')](_['pick'](_0x3e556b[_0xa7c3('0x33')],_0x4c63a0[_0xa7c3('0x3d')]));_0x1565d1['where'][_0xa7c3('0x57')]=_0x5eb9b8['id'];if(_0x3e556b['query'][_0xa7c3('0x3f')]){_0x1565d1[_0xa7c3('0x40')]=_[_0xa7c3('0x41')](_0x1565d1[_0xa7c3('0x40')],{'$or':_[_0xa7c3('0x2c')](_0x1565d1['attributes'],function(_0x54fc8b){var _0x5f04a1={};_0x5f04a1[_0x54fc8b]={'$like':'%'+_0x3e556b[_0xa7c3('0x33')][_0xa7c3('0x3f')]+'%'};return _0x5f04a1;})});}_0x1565d1=_[_0xa7c3('0x41')]({},_0x1565d1,_0x3e556b[_0xa7c3('0x43')]);return db[_0xa7c3('0x58')]['count']({'where':_0x1565d1[_0xa7c3('0x40')]})[_0xa7c3('0x23')](function(_0x5c0558){_0x408a00[_0xa7c3('0x1d')]=_0x5c0558;if(_0x3e556b[_0xa7c3('0x33')][_0xa7c3('0x48')]){_0x1565d1[_0xa7c3('0x44')]=[{'all':!![]}];}return db[_0xa7c3('0x58')]['findAll'](_0x1565d1);})[_0xa7c3('0x23')](function(_0x17a6fa){_0x408a00[_0xa7c3('0x5c')]=_0x17a6fa;return _0x408a00;});}})[_0xa7c3('0x23')](respondWithFilteredResult(_0x5c6861,_0x1565d1))['catch'](handleError(_0x5c6861,null));};exports[_0xa7c3('0x5d')]=function(_0x384c7b,_0x3a03a0,_0x4a9ecf){return db['CmList'][_0xa7c3('0x49')]({'where':{'id':_0x384c7b[_0xa7c3('0x5b')]['id']}})[_0xa7c3('0x23')](handleEntityNotFound(_0x3a03a0,null))['then'](function(_0x5265fb){if(_0x5265fb){return _0x5265fb[_0xa7c3('0x5d')](_0x384c7b[_0xa7c3('0x33')]['ids']);}})[_0xa7c3('0x23')](respondWithStatusCode(_0x3a03a0,null))[_0xa7c3('0x45')](handleError(_0x3a03a0,null));};exports[_0xa7c3('0x5e')]=function(_0x39a995,_0x10d326,_0x29a278){return db['CmList']['find']({'where':{'id':_0x39a995[_0xa7c3('0x5b')]['id']}})[_0xa7c3('0x23')](handleEntityNotFound(_0x10d326,null))[_0xa7c3('0x23')](function(_0x3ee3af){if(_0x3ee3af){var _0x3f2cb3=[];var _0x40d188={'success':[],'errors':[]};return db[_0xa7c3('0x5f')][_0xa7c3('0x55')]()[_0xa7c3('0x23')](function(_0x16802a){if(_0x39a995[_0xa7c3('0x4b')][_0xa7c3('0x60')]&&_[_0xa7c3('0x61')](_0x39a995[_0xa7c3('0x4b')][_0xa7c3('0x60')])){if(_0x39a995['body'][_0xa7c3('0x60')][_0xa7c3('0x47')]){_0x39a995[_0xa7c3('0x4b')]['tags']=_0x39a995[_0xa7c3('0x4b')][_0xa7c3('0x60')][_0xa7c3('0x62')](';')+';';}else{_0x39a995['body'][_0xa7c3('0x60')]=null;}}else{_0x39a995[_0xa7c3('0x4b')]['tags']=null;}if(_0x39a995[_0xa7c3('0x4b')]&&_[_0xa7c3('0x61')](_0x39a995[_0xa7c3('0x4b')])){for(var _0x710c46=0x0;_0x710c46<_0x39a995[_0xa7c3('0x4b')][_0xa7c3('0x47')];_0x710c46+=0x1){_0x39a995[_0xa7c3('0x4b')][_0x710c46][_0xa7c3('0x57')]=_0x39a995[_0xa7c3('0x5b')]['id'];_0x3f2cb3['push'](_0x39a995[_0xa7c3('0x4b')][_0x710c46]);}return BPromise['each'](_0x3f2cb3,function(_0x1b911c){return db[_0xa7c3('0x5f')]['create'](_[_0xa7c3('0x63')](_0x1b911c,[_0xa7c3('0x64'),'id'])||{},{'fields':_[_0xa7c3('0x34')](_0x16802a),'raw':!![]})[_0xa7c3('0x23')](function(_0x38c267){_0x40d188['success'][_0xa7c3('0x65')](_0x38c267[_0xa7c3('0x66')]);})[_0xa7c3('0x45')](function(_0x48ba03){_0x40d188[_0xa7c3('0x67')][_0xa7c3('0x65')]({'data':_0x1b911c,'error':_0x48ba03[_0xa7c3('0x68')]});});})[_0xa7c3('0x23')](function(_0x1bf98e){return _0x40d188;})[_0xa7c3('0x45')](function(_0x1ace48){return _0x1ace48;});}else{_0x10d326[_0xa7c3('0x1c')](0x190)[_0xa7c3('0x69')]({'message':_0xa7c3('0x6a')});}});}})['then'](respondWithResult(_0x10d326,null))[_0xa7c3('0x45')](handleError(_0x10d326,null));};exports['getContacts']=function(_0x12221d,_0x219613,_0x2010c5){var _0x30b303;return db[_0xa7c3('0x2d')][_0xa7c3('0x49')]({'where':{'id':_0x12221d[_0xa7c3('0x5b')]['id']},'include':[{'model':db[_0xa7c3('0x6b')],'as':_0xa7c3('0x6c')}]})[_0xa7c3('0x23')](handleEntityNotFound(_0x219613,null))['then'](function(_0x24de45){if(_0x24de45){_0x30b303=_0x24de45;return db[_0xa7c3('0x5f')][_0xa7c3('0x2e')];}})[_0xa7c3('0x23')](function(_0x14e596){if(_0x14e596){var _0x272686={};var _0x161c1e={};_0x161c1e[_0xa7c3('0x32')]=_[_0xa7c3('0x6d')](_[_0xa7c3('0x34')](_0x14e596),_[_0xa7c3('0x2c')](_0x30b303['CustomFields'],function(_0x4d1d){return util['format'](_0xa7c3('0x6e'),_0x4d1d['id']);}));_0x161c1e['query']=_[_0xa7c3('0x34')](_0x12221d['query']);_0x161c1e[_0xa7c3('0x3d')]=_[_0xa7c3('0x35')](_0x161c1e[_0xa7c3('0x32')],_0x161c1e[_0xa7c3('0x33')]);_0x272686[_0xa7c3('0x37')]=_[_0xa7c3('0x35')](_0x161c1e['model'],qs[_0xa7c3('0x36')](_0x12221d[_0xa7c3('0x33')][_0xa7c3('0x36')]));_0x272686[_0xa7c3('0x37')]=_0x272686['attributes'][_0xa7c3('0x47')]?_0x272686['attributes']:_0x161c1e[_0xa7c3('0x32')];if(!_0x12221d[_0xa7c3('0x33')]['hasOwnProperty']('nolimit')){_0x272686['limit']=qs[_0xa7c3('0x3a')](_0x12221d[_0xa7c3('0x33')][_0xa7c3('0x3a')]);_0x272686[_0xa7c3('0x1e')]=qs[_0xa7c3('0x1e')](_0x12221d[_0xa7c3('0x33')][_0xa7c3('0x1e')]);}_0x272686[_0xa7c3('0x3b')]=qs[_0xa7c3('0x3c')](_0x12221d[_0xa7c3('0x33')][_0xa7c3('0x3c')]);_0x272686[_0xa7c3('0x40')]=qs[_0xa7c3('0x3d')](_['pick'](_0x12221d[_0xa7c3('0x33')],_0x161c1e[_0xa7c3('0x3d')]));_0x272686['raw']=!![];if(_0x12221d[_0xa7c3('0x33')][_0xa7c3('0x3f')]){_0x272686['where']=_['merge'](_0x272686['where'],{'$or':_['map'](_0x272686[_0xa7c3('0x37')],function(_0x12ce48){var _0x1640b7={};_0x1640b7[_0x12ce48]={'$like':'%'+_0x12221d[_0xa7c3('0x33')][_0xa7c3('0x3f')]+'%'};return _0x1640b7;})});}_0x272686=_[_0xa7c3('0x41')]({},_0x272686,_0x12221d[_0xa7c3('0x43')]);return _0x30b303[_0xa7c3('0x6f')](_0x272686);}})[_0xa7c3('0x23')](respondWithResult(_0x219613,null))['catch'](handleError(_0x219613,null));};exports['getContactsCsv']=function(_0x3c229d,_0xb13d8b,_0x4433b1){var _0x5d1343;return db['CmList'][_0xa7c3('0x49')]({'where':{'id':_0x3c229d[_0xa7c3('0x5b')]['id']},'include':[{'model':db[_0xa7c3('0x6b')],'as':_0xa7c3('0x6c')}]})[_0xa7c3('0x23')](handleEntityNotFound(_0xb13d8b,null))[_0xa7c3('0x23')](function(_0x492ab1){if(_0x492ab1){_0x5d1343=_0x492ab1;return db['CmContact']['rawAttributes'];}})[_0xa7c3('0x23')](function(_0x544b03){if(_0x544b03){var _0x3d0ff1={};var _0x130ac3={};_0x130ac3[_0xa7c3('0x32')]=_['concat'](_[_0xa7c3('0x34')](_0x544b03),_['map'](_0x5d1343[_0xa7c3('0x6c')],function(_0x1daab2){return util[_0xa7c3('0x70')](_0xa7c3('0x6e'),_0x1daab2['id']);}));_0x130ac3[_0xa7c3('0x33')]=_[_0xa7c3('0x34')](_0x3c229d['query']);_0x130ac3[_0xa7c3('0x3d')]=_[_0xa7c3('0x35')](_0x130ac3[_0xa7c3('0x32')],_0x130ac3['query']);_0x3d0ff1['attributes']=_[_0xa7c3('0x35')](_0x130ac3[_0xa7c3('0x32')],qs[_0xa7c3('0x36')](_0x3c229d['query']['fields']));_0x3d0ff1[_0xa7c3('0x37')]=_0x3d0ff1[_0xa7c3('0x37')][_0xa7c3('0x47')]?_0x3d0ff1['attributes']:_0x130ac3[_0xa7c3('0x32')];if(!_0x3c229d['query'][_0xa7c3('0x38')](_0xa7c3('0x39'))){_0x3d0ff1[_0xa7c3('0x3a')]=qs[_0xa7c3('0x3a')](_0x3c229d[_0xa7c3('0x33')]['limit']);_0x3d0ff1[_0xa7c3('0x1e')]=qs[_0xa7c3('0x1e')](_0x3c229d[_0xa7c3('0x33')][_0xa7c3('0x1e')]);}_0x3d0ff1[_0xa7c3('0x3b')]=qs[_0xa7c3('0x3c')](_0x3c229d['query'][_0xa7c3('0x3c')]);_0x3d0ff1[_0xa7c3('0x40')]=qs[_0xa7c3('0x3d')](_[_0xa7c3('0x3e')](_0x3c229d['query'],_0x130ac3['filters']));_0x3d0ff1['raw']=!![];if(_0x3c229d[_0xa7c3('0x33')][_0xa7c3('0x3f')]){_0x3d0ff1['where']=_[_0xa7c3('0x41')](_0x3d0ff1[_0xa7c3('0x40')],{'$or':_[_0xa7c3('0x2c')](_0x3d0ff1['attributes'],function(_0x3ad962){var _0x2926c4={};_0x2926c4[_0x3ad962]={'$like':'%'+_0x3c229d[_0xa7c3('0x33')][_0xa7c3('0x3f')]+'%'};return _0x2926c4;})});}_0x3d0ff1=_[_0xa7c3('0x41')]({},_0x3d0ff1,_0x3c229d['options']);return _0x5d1343[_0xa7c3('0x6f')](_0x3d0ff1);}})[_0xa7c3('0x23')](function(_0x445035){if(!_[_0xa7c3('0x71')](_0x445035)){var _0xf1ad03=toCsv(_0x445035);var _0x4cd99f=Date[_0xa7c3('0x72')]();fs[_0xa7c3('0x73')](util[_0xa7c3('0x70')]('/tmp/list_%d_%s.csv',_0x5d1343['id'],_0x4cd99f),_0xf1ad03);_0xb13d8b[_0xa7c3('0x74')]('Content-disposition',_0xa7c3('0x75')+util[_0xa7c3('0x70')](_0xa7c3('0x76'),_0x5d1343['id'],_0x4cd99f));_0xb13d8b[_0xa7c3('0x74')](_0xa7c3('0x77'),'text/csv');return _0xb13d8b[_0xa7c3('0x78')](util[_0xa7c3('0x70')](_0xa7c3('0x79'),_0x5d1343['id'],_0x4cd99f));}else{return _0xb13d8b['sendStatus'](0xcc);}})[_0xa7c3('0x45')](handleError(_0xb13d8b,null));};exports[_0xa7c3('0x7a')]=function(_0x1ece3f,_0x5ae0ef,_0x74ca96){var _0x203cec;delete _0x1ece3f[_0xa7c3('0x4b')]['id'];return db[_0xa7c3('0x2d')][_0xa7c3('0x5a')]({'where':{'id':_0x1ece3f[_0xa7c3('0x5b')]['id']}})[_0xa7c3('0x23')](handleEntityNotFound(_0x5ae0ef,null))[_0xa7c3('0x23')](function(_0x3ee513){if(_0x3ee513){return db[_0xa7c3('0x7b')][_0xa7c3('0x7c')](function(_0x51c8b7){return db['CmCustomField'][_0xa7c3('0x4a')](_0x1ece3f[_0xa7c3('0x4b')],{'transaction':_0x51c8b7})[_0xa7c3('0x23')](function(_0x3f0749){_0x203cec=_0x3f0749;return _0x3ee513[_0xa7c3('0x7d')](_0x3f0749,{'transaction':_0x51c8b7});})[_0xa7c3('0x23')](function(){var _0x42789b={'type':db[_0xa7c3('0x7e')][_0xa7c3('0x7f')],'transaction':_0x51c8b7};switch(_0x1ece3f[_0xa7c3('0x4b')][_0xa7c3('0x30')]){case _0xa7c3('0x80'):_0x42789b[_0xa7c3('0x30')]=db[_0xa7c3('0x7e')][_0xa7c3('0x7f')];break;case _0xa7c3('0x81'):_0x42789b[_0xa7c3('0x30')]=db['Sequelize'][_0xa7c3('0x82')];break;case _0xa7c3('0x83'):_0x42789b[_0xa7c3('0x30')]=db[_0xa7c3('0x7e')][_0xa7c3('0x84')];_0x42789b[_0xa7c3('0x85')]=![];break;default:}return db[_0xa7c3('0x7b')][_0xa7c3('0x86')]['addColumn']('cm_contacts',util['format'](_0xa7c3('0x87'),_0x203cec['id']),_0x42789b);})[_0xa7c3('0x23')](function(){return _0x203cec;});});}})[_0xa7c3('0x23')](respondWithResult(_0x5ae0ef,null))[_0xa7c3('0x45')](handleError(_0x5ae0ef,null));};exports[_0xa7c3('0x88')]=function(_0x26a1ef,_0x3b6661,_0x31fa98){var _0x367dfe={};var _0x23bdf5={};var _0x5d6b69;var _0x1d4739;return db[_0xa7c3('0x2d')][_0xa7c3('0x5a')]({'where':{'id':_0x26a1ef['params']['id']}})['then'](handleEntityNotFound(_0x3b6661,null))[_0xa7c3('0x23')](function(_0x590046){if(_0x590046){_0x5d6b69=_0x590046;_0x23bdf5[_0xa7c3('0x32')]=_['keys'](db[_0xa7c3('0x6b')][_0xa7c3('0x2e')]);_0x23bdf5[_0xa7c3('0x33')]=_[_0xa7c3('0x34')](_0x26a1ef[_0xa7c3('0x33')]);_0x23bdf5[_0xa7c3('0x3d')]=_['intersection'](_0x23bdf5['model'],_0x23bdf5[_0xa7c3('0x33')]);_0x367dfe[_0xa7c3('0x37')]=_[_0xa7c3('0x35')](_0x23bdf5['model'],qs[_0xa7c3('0x36')](_0x26a1ef[_0xa7c3('0x33')][_0xa7c3('0x36')]));_0x367dfe[_0xa7c3('0x37')]=_0x367dfe['attributes']['length']?_0x367dfe['attributes']:_0x23bdf5[_0xa7c3('0x32')];_0x367dfe['order']=qs[_0xa7c3('0x3c')](_0x26a1ef[_0xa7c3('0x33')][_0xa7c3('0x3c')]);_0x367dfe['where']=qs[_0xa7c3('0x3d')](_[_0xa7c3('0x3e')](_0x26a1ef[_0xa7c3('0x33')],_0x23bdf5['filters']));_0x367dfe['where']=_[_0xa7c3('0x41')](_0x367dfe['where'],{'$or':[{'ListId':_0x590046['id']},{'ListId':null}]});if(_0x26a1ef[_0xa7c3('0x33')][_0xa7c3('0x3f')]){_0x367dfe[_0xa7c3('0x40')]=_[_0xa7c3('0x41')](_0x367dfe[_0xa7c3('0x40')],{'$or':_[_0xa7c3('0x2c')](_0x367dfe[_0xa7c3('0x37')],function(_0xb15784){var _0x320f85={};_0x320f85[_0xb15784]={'$like':'%'+_0x26a1ef['query']['filter']+'%'};return _0x320f85;})});}_0x367dfe=_[_0xa7c3('0x41')]({},_0x367dfe,_0x26a1ef['options']);return db[_0xa7c3('0x6b')][_0xa7c3('0x89')](_0x367dfe);}})[_0xa7c3('0x23')](respondWithResult(_0x3b6661,null))[_0xa7c3('0x45')](handleError(_0x3b6661,null));};exports[_0xa7c3('0x8a')]=function(_0x16f419,_0x19f078,_0x4e6a42){return db[_0xa7c3('0x2d')][_0xa7c3('0x49')]({'where':{'id':_0x16f419[_0xa7c3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x19f078,null))[_0xa7c3('0x23')](function(_0x1bc9c4){if(_0x1bc9c4){return _0x1bc9c4[_0xa7c3('0x8a')](_0x16f419['body'][_0xa7c3('0x64')],_['omit'](_0x16f419[_0xa7c3('0x4b')],['ids','id'])||{})[_0xa7c3('0x8b')](function(_0x4d3c02){for(var _0x5c4912=0x0;_0x5c4912<_0x16f419[_0xa7c3('0x4b')][_0xa7c3('0x64')][_0xa7c3('0x47')];_0x5c4912+=0x1){socket[_0xa7c3('0x8c')](_0xa7c3('0x8d'),{'UserId':_0x16f419[_0xa7c3('0x4b')]['ids'][_0x5c4912],'CmListId':_0x16f419['params']['id']});}return _0x4d3c02;});}})[_0xa7c3('0x23')](respondWithResult(_0x19f078,null))[_0xa7c3('0x45')](handleError(_0x19f078,null));};exports[_0xa7c3('0x8e')]=function(_0x3d40d9,_0x2c5b15,_0x166d44){return db[_0xa7c3('0x2d')][_0xa7c3('0x49')]({'where':{'id':_0x3d40d9[_0xa7c3('0x5b')]['id']}})[_0xa7c3('0x23')](handleEntityNotFound(_0x2c5b15,null))[_0xa7c3('0x23')](function(_0x4470f6){if(_0x4470f6){return _0x4470f6[_0xa7c3('0x8e')](_0x3d40d9[_0xa7c3('0x33')][_0xa7c3('0x64')])[_0xa7c3('0x23')](function(){if(_['isArray'](_0x3d40d9['query']['ids'])){for(var _0xbcd7e8=0x0;_0xbcd7e8<_0x3d40d9[_0xa7c3('0x33')][_0xa7c3('0x64')][_0xa7c3('0x47')];_0xbcd7e8+=0x1){socket[_0xa7c3('0x8c')](_0xa7c3('0x8f'),{'UserId':Number(_0x3d40d9[_0xa7c3('0x33')][_0xa7c3('0x64')][_0xbcd7e8]),'CmListId':Number(_0x3d40d9[_0xa7c3('0x5b')]['id'])});}}else{socket[_0xa7c3('0x8c')](_0xa7c3('0x8f'),{'UserId':Number(_0x3d40d9[_0xa7c3('0x33')][_0xa7c3('0x64')]),'CmListId':Number(_0x3d40d9[_0xa7c3('0x5b')]['id'])});}});}})[_0xa7c3('0x23')](respondWithStatusCode(_0x2c5b15,null))[_0xa7c3('0x45')](handleError(_0x2c5b15,null));};exports['getAgents']=function(_0x3a2a35,_0x208a64,_0x20c9fa){var _0x3931a1={};var _0x216431={};var _0x490871;var _0x12d5f1;return db[_0xa7c3('0x2d')][_0xa7c3('0x5a')]({'where':{'id':_0x3a2a35[_0xa7c3('0x5b')]['id']}})[_0xa7c3('0x23')](handleEntityNotFound(_0x208a64,null))[_0xa7c3('0x23')](function(_0x5a8349){if(_0x5a8349){_0x490871=_0x5a8349;_0x216431[_0xa7c3('0x32')]=_[_0xa7c3('0x34')](db[_0xa7c3('0x90')][_0xa7c3('0x2e')]);_0x216431[_0xa7c3('0x33')]=_[_0xa7c3('0x34')](_0x3a2a35[_0xa7c3('0x33')]);_0x216431[_0xa7c3('0x3d')]=_['intersection'](_0x216431[_0xa7c3('0x32')],_0x216431[_0xa7c3('0x33')]);_0x3931a1[_0xa7c3('0x37')]=_[_0xa7c3('0x35')](_0x216431[_0xa7c3('0x32')],qs[_0xa7c3('0x36')](_0x3a2a35[_0xa7c3('0x33')]['fields']));_0x3931a1[_0xa7c3('0x37')]=_0x3931a1[_0xa7c3('0x37')]['length']?_0x3931a1[_0xa7c3('0x37')]:_0x216431[_0xa7c3('0x32')];_0x3931a1[_0xa7c3('0x3b')]=qs[_0xa7c3('0x3c')](_0x3a2a35[_0xa7c3('0x33')][_0xa7c3('0x3c')]);_0x3931a1[_0xa7c3('0x40')]=qs[_0xa7c3('0x3d')](_['pick'](_0x3a2a35['query'],_0x216431[_0xa7c3('0x3d')]));if(_0x3a2a35[_0xa7c3('0x33')][_0xa7c3('0x3f')]){_0x3931a1[_0xa7c3('0x40')]=_[_0xa7c3('0x41')](_0x3931a1['where'],{'$or':_['map'](_0x3931a1[_0xa7c3('0x37')],function(_0x418bc6){var _0x13ef71={};_0x13ef71[_0x418bc6]={'$like':'%'+_0x3a2a35[_0xa7c3('0x33')][_0xa7c3('0x3f')]+'%'};return _0x13ef71;})});}_0x3931a1=_[_0xa7c3('0x41')]({},_0x3931a1,_0x3a2a35[_0xa7c3('0x43')]);return _0x490871[_0xa7c3('0x91')](_0x3931a1);}})[_0xa7c3('0x23')](function(_0x3bca07){if(_0x3bca07){_0x12d5f1=_0x3bca07['length'];if(!_0x3a2a35[_0xa7c3('0x33')][_0xa7c3('0x38')]('nolimit')){_0x3931a1[_0xa7c3('0x3a')]=qs[_0xa7c3('0x3a')](_0x3a2a35[_0xa7c3('0x33')][_0xa7c3('0x3a')]);_0x3931a1['offset']=qs['offset'](_0x3a2a35[_0xa7c3('0x33')][_0xa7c3('0x1e')]);}return _0x490871['getAgents'](_0x3931a1);}})[_0xa7c3('0x23')](function(_0x2a44ab){if(_0x2a44ab){return _0x2a44ab?{'count':_0x12d5f1,'rows':_0x2a44ab}:null;}})[_0xa7c3('0x23')](respondWithResult(_0x208a64,null))[_0xa7c3('0x45')](handleError(_0x208a64,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index bd178d1..49d6c59 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 _0x988f=['update','remove','emit','../../mysqldb','setMaxListeners'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x988f,0xb7));var _0xf988=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x988f[_0x5e3b04];return _0x1fc44d;};'use strict';var EventEmitter=require('events');var CmList=require(_0xf988('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf988('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf988('0x2'),'afterDestroy':_0xf988('0x3')};function emitEvent(_0x41829d){return function(_0x17c30c,_0x6bf9ab,_0xacd2fd){CmListEvents[_0xf988('0x4')](_0x41829d+':'+_0x17c30c['id'],_0x17c30c);CmListEvents[_0xf988('0x4')](_0x41829d,_0x17c30c);_0xacd2fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xc5dc=['hook','exports','../../mysqldb','CmList','save','update','remove','emit','hasOwnProperty'];(function(_0xaac198,_0x3fcd91){var _0x577872=function(_0x1d7074){while(--_0x1d7074){_0xaac198['push'](_0xaac198['shift']());}};_0x577872(++_0x3fcd91);}(_0xc5dc,0x158));var _0xcc5d=function(_0x1dd5bd,_0x2d9e99){_0x1dd5bd=_0x1dd5bd-0x0;var _0xd60a7c=_0xc5dc[_0x1dd5bd];return _0xd60a7c;};'use strict';var EventEmitter=require('events');var CmList=require(_0xcc5d('0x0'))['db'][_0xcc5d('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc5d('0x2'),'afterUpdate':_0xcc5d('0x3'),'afterDestroy':_0xcc5d('0x4')};function emitEvent(_0x56611b){return function(_0x310359,_0x293d3e,_0x1123c5){CmListEvents[_0xcc5d('0x5')](_0x56611b+':'+_0x310359['id'],_0x310359);CmListEvents[_0xcc5d('0x5')](_0x56611b,_0x310359);_0x1123c5(null);};}for(var e in events){if(events[_0xcc5d('0x6')](e)){var event=events[e];CmList[_0xcc5d('0x7')](e,emitEvent(event));}}module[_0xcc5d('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 c1e8400..d49a113 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 _0x635f=['define','CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1bb1e0,_0x4a62c0){var _0x174693=function(_0x369803){while(--_0x369803){_0x1bb1e0['push'](_0x1bb1e0['shift']());}};_0x174693(++_0x4a62c0);}(_0x635f,0x19b));var _0xf635=function(_0x3ee105,_0x1a0955){_0x3ee105=_0x3ee105-0x0;var _0xe39aad=_0x635f[_0x3ee105];return _0xe39aad;};'use strict';var _=require(_0xf635('0x0'));var util=require(_0xf635('0x1'));var logger=require(_0xf635('0x2'))(_0xf635('0x3'));var moment=require('moment');var BPromise=require(_0xf635('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf635('0x5'));var rimraf=require(_0xf635('0x6'));var config=require(_0xf635('0x7'));var attributes=require('./cmList.attributes');module[_0xf635('0x8')]=function(_0x196a4a,_0x50507b){return _0x196a4a[_0xf635('0x9')](_0xf635('0xa'),attributes,{'tableName':_0xf635('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b6=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xd9b6,0x193));var _0x6d9b=function(_0x55d7b0,_0x2a82dc){_0x55d7b0=_0x55d7b0-0x0;var _0x2a376c=_0xd9b6[_0x55d7b0];return _0x2a376c;};'use strict';var _=require(_0x6d9b('0x0'));var util=require(_0x6d9b('0x1'));var logger=require(_0x6d9b('0x2'))(_0x6d9b('0x3'));var moment=require(_0x6d9b('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d9b('0x5'));var fs=require('fs');var path=require(_0x6d9b('0x6'));var rimraf=require(_0x6d9b('0x7'));var config=require('../../config/environment');var attributes=require(_0x6d9b('0x8'));module[_0x6d9b('0x9')]=function(_0x134cb8,_0x2881be){return _0x134cb8[_0x6d9b('0xa')](_0x6d9b('0xb'),attributes,{'tableName':_0x6d9b('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 a6e6c3b..2f00e7a 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 _0xb1a7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','info','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1a7,0x133));var _0x7b1a=function(_0xead2b9,_0x4460b5){_0xead2b9=_0xead2b9-0x0;var _0x2496b3=_0xb1a7[_0xead2b9];return _0x2496b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b1a('0x0'));var BPromise=require('bluebird');var rs=require(_0x7b1a('0x1'));var fs=require('fs');var Redis=require(_0x7b1a('0x2'));var db=require(_0x7b1a('0x3'))['db'];var utils=require(_0x7b1a('0x4'));var logger=require(_0x7b1a('0x5'))(_0x7b1a('0x6'));var config=require(_0x7b1a('0x7'));var jayson=require(_0x7b1a('0x8'));var client=jayson[_0x7b1a('0x9')][_0x7b1a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7b1a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7b1a('0xc'))['register'](socket);function respondWithRpcPromise(_0x38f9ee,_0x3add9a,_0x3b5340){return new BPromise(function(_0x1a88b6,_0x4ed464){return client[_0x7b1a('0xd')](_0x38f9ee,_0x3b5340)[_0x7b1a('0xe')](function(_0x3243cb){logger['info'](_0x7b1a('0xf'),_0x3add9a,_0x7b1a('0x10'));logger[_0x7b1a('0x11')](_0x7b1a('0x12'),_0x3add9a,'request\x20sent',JSON['stringify'](_0x3243cb));if(_0x3243cb[_0x7b1a('0x13')]){if(_0x3243cb[_0x7b1a('0x13')][_0x7b1a('0x14')]===0x1f4){logger[_0x7b1a('0x13')](_0x7b1a('0xf'),_0x3add9a,_0x3243cb[_0x7b1a('0x13')][_0x7b1a('0x15')]);return _0x4ed464(_0x3243cb[_0x7b1a('0x13')]['message']);}logger[_0x7b1a('0x13')](_0x7b1a('0xf'),_0x3add9a,_0x3243cb[_0x7b1a('0x13')][_0x7b1a('0x15')]);return _0x1a88b6(_0x3243cb[_0x7b1a('0x13')][_0x7b1a('0x15')]);}else{logger[_0x7b1a('0x16')](_0x7b1a('0xf'),_0x3add9a,'request\x20sent');_0x1a88b6(_0x3243cb[_0x7b1a('0x17')]['message']);}})['catch'](function(_0x404a01){logger[_0x7b1a('0x13')]('CmList,\x20%s,\x20%s',_0x3add9a,_0x404a01);_0x4ed464(_0x404a01);});});} \ No newline at end of file +var _0xf3c2=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49f513,_0x1d17c3){var _0x402307=function(_0x540f3f){while(--_0x540f3f){_0x49f513['push'](_0x49f513['shift']());}};_0x402307(++_0x1d17c3);}(_0xf3c2,0x1b5));var _0x2f3c=function(_0x27c17f,_0x3e0cff){_0x27c17f=_0x27c17f-0x0;var _0x26e161=_0xf3c2[_0x27c17f];return _0x26e161;};'use strict';var _=require(_0x2f3c('0x0'));var util=require(_0x2f3c('0x1'));var moment=require(_0x2f3c('0x2'));var BPromise=require(_0x2f3c('0x3'));var rs=require(_0x2f3c('0x4'));var fs=require('fs');var Redis=require(_0x2f3c('0x5'));var db=require(_0x2f3c('0x6'))['db'];var utils=require(_0x2f3c('0x7'));var logger=require(_0x2f3c('0x8'))(_0x2f3c('0x9'));var config=require(_0x2f3c('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2f3c('0xb')]=_[_0x2f3c('0xc')](config[_0x2f3c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f3c('0xd'))['register'](socket);function respondWithRpcPromise(_0x3cf1c0,_0x2301b6,_0x4990ae){return new BPromise(function(_0x2e850f,_0x2a8815){return client[_0x2f3c('0xe')](_0x3cf1c0,_0x4990ae)[_0x2f3c('0xf')](function(_0x597ed1){logger['info'](_0x2f3c('0x10'),_0x2301b6,_0x2f3c('0x11'));logger[_0x2f3c('0x12')](_0x2f3c('0x13'),_0x2301b6,_0x2f3c('0x11'),JSON[_0x2f3c('0x14')](_0x597ed1));if(_0x597ed1[_0x2f3c('0x15')]){if(_0x597ed1[_0x2f3c('0x15')][_0x2f3c('0x16')]===0x1f4){logger['error'](_0x2f3c('0x10'),_0x2301b6,_0x597ed1[_0x2f3c('0x15')][_0x2f3c('0x17')]);return _0x2a8815(_0x597ed1[_0x2f3c('0x15')]['message']);}logger[_0x2f3c('0x15')]('CmList,\x20%s,\x20%s',_0x2301b6,_0x597ed1[_0x2f3c('0x15')][_0x2f3c('0x17')]);return _0x2e850f(_0x597ed1['error']['message']);}else{logger[_0x2f3c('0x18')](_0x2f3c('0x10'),_0x2301b6,'request\x20sent');_0x2e850f(_0x597ed1[_0x2f3c('0x19')][_0x2f3c('0x17')]);}})[_0x2f3c('0x1a')](function(_0x5c9612){logger[_0x2f3c('0x15')](_0x2f3c('0x10'),_0x2301b6,_0x5c9612);_0x2a8815(_0x5c9612);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a488f2d..f384452 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 _0x4c9d=['removeListener','register','length','cmList:','./cmList.events','save','remove','emit'];(function(_0x1cb73e,_0xce62f4){var _0x5c1e4c=function(_0x5cf8e3){while(--_0x5cf8e3){_0x1cb73e['push'](_0x1cb73e['shift']());}};_0x5c1e4c(++_0xce62f4);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4c9d[_0x2dafbe];return _0x58a45a;};'use strict';var CmListEvents=require(_0xd4c9('0x0'));var events=[_0xd4c9('0x1'),_0xd4c9('0x2'),'update'];function createListener(_0x11e4e7,_0x13c911){return function(_0x173031){_0x13c911[_0xd4c9('0x3')](_0x11e4e7,_0x173031);};}function removeListener(_0x102345,_0x2b30d0){return function(){CmListEvents[_0xd4c9('0x4')](_0x102345,_0x2b30d0);};}exports[_0xd4c9('0x5')]=function(_0x2c81cb){for(var _0x5980e0=0x0,_0x48b511=events[_0xd4c9('0x6')];_0x5980e0<_0x48b511;_0x5980e0++){var _0x37b94e=events[_0x5980e0];var _0x3f9d50=createListener(_0xd4c9('0x7')+_0x37b94e,_0x2c81cb);CmListEvents['on'](_0x37b94e,_0x3f9d50);}}; \ No newline at end of file +var _0xe292=['remove','update','emit','removeListener','length','cmList:'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xe292,0x19e));var _0x2e29=function(_0x2b8422,_0x48b099){_0x2b8422=_0x2b8422-0x0;var _0x133c72=_0xe292[_0x2b8422];return _0x133c72;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x2e29('0x0'),_0x2e29('0x1')];function createListener(_0x56d796,_0x575f18){return function(_0x1d2c2a){_0x575f18[_0x2e29('0x2')](_0x56d796,_0x1d2c2a);};}function removeListener(_0x4fec69,_0x59d723){return function(){CmListEvents[_0x2e29('0x3')](_0x4fec69,_0x59d723);};}exports['register']=function(_0x5bd6cc){for(var _0xcdccd7=0x0,_0x422679=events[_0x2e29('0x4')];_0xcdccd7<_0x422679;_0xcdccd7++){var _0x39f1ee=events[_0xcdccd7];var _0x1e7c81=createListener(_0x2e29('0x5')+_0x39f1ee,_0x5bd6cc);CmListEvents['on'](_0x39f1ee,_0x1e7c81);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5f11ad6..896fb2b 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 _0x254b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','/:id/contacts','addContacts','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout'];(function(_0x1513f8,_0x5c646f){var _0x588c30=function(_0x13217c){while(--_0x13217c){_0x1513f8['push'](_0x1513f8['shift']());}};_0x588c30(++_0x5c646f);}(_0x254b,0xeb));var _0xb254=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x254b[_0x4af01e];return _0x178c11;};'use strict';var multer=require(_0xb254('0x0'));var util=require(_0xb254('0x1'));var path=require('path');var timeout=require(_0xb254('0x2'));var express=require(_0xb254('0x3'));var router=express[_0xb254('0x4')]();var auth=require(_0xb254('0x5'));var interaction=require(_0xb254('0x6'));var config=require(_0xb254('0x7'));var controller=require(_0xb254('0x8'));router[_0xb254('0x9')]('/',auth['isAuthenticated'](),controller[_0xb254('0xa')]);router[_0xb254('0x9')](_0xb254('0xb'),auth[_0xb254('0xc')](),controller[_0xb254('0xd')]);router['get']('/:id',auth[_0xb254('0xc')](),controller['show']);router['get'](_0xb254('0xe'),auth[_0xb254('0xc')](),controller['getDispositions']);router[_0xb254('0x9')]('/:id/contacts',auth[_0xb254('0xc')](),controller[_0xb254('0xf')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xb254('0x10')]);router[_0xb254('0x9')](_0xb254('0x11'),auth[_0xb254('0xc')](),controller[_0xb254('0x12')]);router[_0xb254('0x9')](_0xb254('0x13'),auth['isAuthenticated'](),controller[_0xb254('0x14')]);router['post']('/',auth[_0xb254('0xc')](),controller[_0xb254('0x15')]);router[_0xb254('0x16')](_0xb254('0xe'),auth[_0xb254('0xc')](),controller[_0xb254('0x17')]);router[_0xb254('0x16')](_0xb254('0x18'),auth[_0xb254('0xc')](),controller[_0xb254('0x19')]);router['post']('/:id/fields',auth[_0xb254('0xc')](),controller['addCustomField']);router[_0xb254('0x16')]('/:id/users',auth[_0xb254('0xc')](),controller[_0xb254('0x1a')]);router[_0xb254('0x1b')](_0xb254('0x1c'),auth[_0xb254('0xc')](),controller[_0xb254('0x1d')]);router[_0xb254('0x1e')](_0xb254('0x1c'),auth[_0xb254('0xc')](),controller['destroy']);router['delete'](_0xb254('0xe'),auth[_0xb254('0xc')](),controller[_0xb254('0x1f')]);router[_0xb254('0x1e')](_0xb254('0x13'),auth['isAuthenticated'](),controller[_0xb254('0x20')]);module[_0xb254('0x21')]=router; \ No newline at end of file +var _0xc9f6=['addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','/:id/users','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0xc9f6,0x8e));var _0x6c9f=function(_0x523400,_0x5ce864){_0x523400=_0x523400-0x0;var _0xbf1546=_0xc9f6[_0x523400];return _0xbf1546;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c9f('0x0'));var timeout=require(_0x6c9f('0x1'));var express=require(_0x6c9f('0x2'));var router=express[_0x6c9f('0x3')]();var auth=require(_0x6c9f('0x4'));var interaction=require(_0x6c9f('0x5'));var config=require(_0x6c9f('0x6'));var controller=require(_0x6c9f('0x7'));router[_0x6c9f('0x8')]('/',auth[_0x6c9f('0x9')](),controller[_0x6c9f('0xa')]);router['get']('/describe',auth[_0x6c9f('0x9')](),controller[_0x6c9f('0xb')]);router[_0x6c9f('0x8')](_0x6c9f('0xc'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0xd')]);router[_0x6c9f('0x8')](_0x6c9f('0xe'),auth[_0x6c9f('0x9')](),controller['getDispositions']);router[_0x6c9f('0x8')](_0x6c9f('0xf'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x10')]);router['get'](_0x6c9f('0x11'),auth['isAuthenticated'](),controller[_0x6c9f('0x12')]);router[_0x6c9f('0x8')](_0x6c9f('0x13'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x14')]);router[_0x6c9f('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x6c9f('0x15')]('/',auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x16')]);router[_0x6c9f('0x15')](_0x6c9f('0xe'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x17')]);router[_0x6c9f('0x15')]('/:id/contacts',auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x18')]);router[_0x6c9f('0x15')](_0x6c9f('0x13'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x19')]);router[_0x6c9f('0x15')]('/:id/users',auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x1a')]);router['put'](_0x6c9f('0xc'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x1b')]);router[_0x6c9f('0x1c')](_0x6c9f('0xc'),auth['isAuthenticated'](),controller[_0x6c9f('0x1d')]);router[_0x6c9f('0x1c')](_0x6c9f('0xe'),auth['isAuthenticated'](),controller[_0x6c9f('0x1e')]);router[_0x6c9f('0x1c')](_0x6c9f('0x1f'),auth[_0x6c9f('0x9')](),controller[_0x6c9f('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a1298fc..6a42f8c 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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x205e1e,_0x9c2a21){var _0x1b5929=function(_0x344b68){while(--_0x344b68){_0x205e1e['push'](_0x205e1e['shift']());}};_0x1b5929(++_0x9c2a21);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x212102,_0x5b9742){var _0x4a2ea3=function(_0x25f7be){while(--_0x25f7be){_0x212102['push'](_0x212102['shift']());}};_0x4a2ea3(++_0x5b9742);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 5a24823..600f8ff 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 _0xf777=['moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','body','Condition','params','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1d603a,_0x2b814e){var _0x4b76b4=function(_0x2ac4d1){while(--_0x2ac4d1){_0x1d603a['push'](_0x1d603a['shift']());}};_0x4b76b4(++_0x2b814e);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7f77('0x0'));var emlformat=require(_0x7f77('0x1'));var rimraf=require(_0x7f77('0x2'));var zipdir=require(_0x7f77('0x3'));var jsonpatch=require(_0x7f77('0x4'));var rp=require(_0x7f77('0x5'));var moment=require(_0x7f77('0x6'));var BPromise=require(_0x7f77('0x7'));var Mustache=require(_0x7f77('0x8'));var util=require('util');var path=require(_0x7f77('0x9'));var sox=require(_0x7f77('0xa'));var csv=require('to-csv');var ejs=require(_0x7f77('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f77('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f77('0xd'));var deskjs=require(_0x7f77('0xe'));var toCsv=require(_0x7f77('0xf'));var querystring=require(_0x7f77('0x10'));var Papa=require(_0x7f77('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f77('0x12'));var as=require(_0x7f77('0x13'));var hardwareService=require(_0x7f77('0x14'));var logger=require(_0x7f77('0x15'))(_0x7f77('0x16'));var utils=require('../../config/utils');var config=require(_0x7f77('0x17'));var db=require(_0x7f77('0x18'))['db'];function respondWithStatusCode(_0x1640e9,_0x2ab82d){_0x2ab82d=_0x2ab82d||0xcc;return function(_0xd625fb){if(_0xd625fb){return _0x1640e9['sendStatus'](_0x2ab82d);}return _0x1640e9['status'](_0x2ab82d)[_0x7f77('0x19')]();};}function respondWithResult(_0x18f698,_0x3f7a60){_0x3f7a60=_0x3f7a60||0xc8;return function(_0x3f99e2){if(_0x3f99e2){return _0x18f698[_0x7f77('0x1a')](_0x3f7a60)[_0x7f77('0x1b')](_0x3f99e2);}};}function respondWithFilteredResult(_0x1f0729,_0x2efdd1){return function(_0x13e9a1){if(_0x13e9a1){var _0x3d8a45=_0x13e9a1[_0x7f77('0x1c')],_0x2c104a=_0x2efdd1[_0x7f77('0x1d')],_0x29d2cb=_0x2efdd1[_0x7f77('0x1d')]+_0x2efdd1['limit'],_0x186f7a;if(_0x29d2cb>=_0x3d8a45){_0x29d2cb=_0x3d8a45;_0x186f7a=0xc8;}else{_0x186f7a=0xce;}_0x1f0729['status'](_0x186f7a);return _0x1f0729[_0x7f77('0x1e')]('Content-Range',_0x2c104a+'-'+_0x29d2cb+'/'+_0x3d8a45)[_0x7f77('0x1b')](_0x13e9a1);}return null;};}function patchUpdates(_0x50eb96){return function(_0x23b8b0){try{jsonpatch[_0x7f77('0x1f')](_0x23b8b0,_0x50eb96,!![]);}catch(_0x359f63){return BPromise['reject'](_0x359f63);}return _0x23b8b0[_0x7f77('0x20')]();};}function saveUpdates(_0x3d91f8,_0x4d7283){return function(_0x175e9c){if(_0x175e9c){return _0x175e9c[_0x7f77('0x21')](_0x3d91f8)[_0x7f77('0x22')](function(_0x48647f){return _0x48647f;});}return null;};}function removeEntity(_0x24fac0,_0x5b869c){return function(_0x5c4049){if(_0x5c4049){return _0x5c4049[_0x7f77('0x23')]()[_0x7f77('0x22')](function(){_0x24fac0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2493a0,_0x87e6b6){return function(_0x1d8fe3){if(!_0x1d8fe3){_0x2493a0['sendStatus'](0x194);}return _0x1d8fe3;};}function handleError(_0x5e03a3,_0x13662c){_0x13662c=_0x13662c||0x1f4;return function(_0x8cf65b){logger[_0x7f77('0x24')](_0x8cf65b[_0x7f77('0x25')]);if(_0x8cf65b[_0x7f77('0x26')]){delete _0x8cf65b[_0x7f77('0x26')];}_0x5e03a3['status'](_0x13662c)[_0x7f77('0x27')](_0x8cf65b);};}exports['update']=function(_0x3c2ece,_0x29f31b){if(_0x3c2ece['body']['id']){delete _0x3c2ece[_0x7f77('0x28')]['id'];}return db[_0x7f77('0x29')]['find']({'where':{'id':_0x3c2ece[_0x7f77('0x2a')]['id']}})['then'](handleEntityNotFound(_0x29f31b,null))[_0x7f77('0x22')](saveUpdates(_0x3c2ece[_0x7f77('0x28')],null))[_0x7f77('0x22')](respondWithResult(_0x29f31b,null))[_0x7f77('0x2b')](handleError(_0x29f31b,null));};exports[_0x7f77('0x23')]=function(_0xed30ce,_0x92493e){return db['Condition'][_0x7f77('0x2c')]({'where':{'id':_0xed30ce[_0x7f77('0x2a')]['id']}})[_0x7f77('0x22')](handleEntityNotFound(_0x92493e,null))[_0x7f77('0x22')](removeEntity(_0x92493e,null))[_0x7f77('0x2b')](handleError(_0x92493e,null));}; \ No newline at end of file +var _0x58b6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','params','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x203164,_0x3f5274){var _0x569cb5=function(_0x28a128){while(--_0x28a128){_0x203164['push'](_0x203164['shift']());}};_0x569cb5(++_0x3f5274);}(_0x58b6,0x103));var _0x658b=function(_0x3737ef,_0x40bd69){_0x3737ef=_0x3737ef-0x0;var _0x167c7b=_0x58b6[_0x3737ef];return _0x167c7b;};'use strict';var pdf=require(_0x658b('0x0'));var emlformat=require(_0x658b('0x1'));var rimraf=require(_0x658b('0x2'));var zipdir=require(_0x658b('0x3'));var jsonpatch=require(_0x658b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x658b('0x5'));var Mustache=require(_0x658b('0x6'));var util=require(_0x658b('0x7'));var path=require('path');var sox=require(_0x658b('0x8'));var csv=require(_0x658b('0x9'));var ejs=require(_0x658b('0xa'));var fs=require('fs');var _=require(_0x658b('0xb'));var squel=require(_0x658b('0xc'));var crypto=require(_0x658b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x658b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x658b('0xf'));var Papa=require(_0x658b('0x10'));var Redis=require('ioredis');var authService=require(_0x658b('0x11'));var qs=require(_0x658b('0x12'));var as=require(_0x658b('0x13'));var hardwareService=require(_0x658b('0x14'));var logger=require(_0x658b('0x15'))('api');var utils=require(_0x658b('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c4de0,_0xc4e081){_0xc4e081=_0xc4e081||0xcc;return function(_0x2301b0){if(_0x2301b0){return _0x1c4de0[_0x658b('0x17')](_0xc4e081);}return _0x1c4de0['status'](_0xc4e081)[_0x658b('0x18')]();};}function respondWithResult(_0x437c90,_0x21a161){_0x21a161=_0x21a161||0xc8;return function(_0x24823e){if(_0x24823e){return _0x437c90[_0x658b('0x19')](_0x21a161)[_0x658b('0x1a')](_0x24823e);}};}function respondWithFilteredResult(_0x1271f9,_0x52924a){return function(_0x533e54){if(_0x533e54){var _0x4a7f52=_0x533e54[_0x658b('0x1b')],_0x2cb592=_0x52924a[_0x658b('0x1c')],_0x55d31a=_0x52924a[_0x658b('0x1c')]+_0x52924a[_0x658b('0x1d')],_0x2179bb;if(_0x55d31a>=_0x4a7f52){_0x55d31a=_0x4a7f52;_0x2179bb=0xc8;}else{_0x2179bb=0xce;}_0x1271f9[_0x658b('0x19')](_0x2179bb);return _0x1271f9[_0x658b('0x1e')]('Content-Range',_0x2cb592+'-'+_0x55d31a+'/'+_0x4a7f52)[_0x658b('0x1a')](_0x533e54);}return null;};}function patchUpdates(_0x6e1bd7){return function(_0x4f8b93){try{jsonpatch[_0x658b('0x1f')](_0x4f8b93,_0x6e1bd7,!![]);}catch(_0x972c0){return BPromise[_0x658b('0x20')](_0x972c0);}return _0x4f8b93[_0x658b('0x21')]();};}function saveUpdates(_0x304883,_0x5a032e){return function(_0x192915){if(_0x192915){return _0x192915[_0x658b('0x22')](_0x304883)[_0x658b('0x23')](function(_0x568cf8){return _0x568cf8;});}return null;};}function removeEntity(_0xd66a5e,_0x5dd711){return function(_0x2b226e){if(_0x2b226e){return _0x2b226e[_0x658b('0x24')]()[_0x658b('0x23')](function(){_0xd66a5e[_0x658b('0x19')](0xcc)[_0x658b('0x18')]();});}};}function handleEntityNotFound(_0x135586,_0x369624){return function(_0x1a66be){if(!_0x1a66be){_0x135586['sendStatus'](0x194);}return _0x1a66be;};}function handleError(_0x4085e1,_0x3cbc7f){_0x3cbc7f=_0x3cbc7f||0x1f4;return function(_0x52ecde){logger[_0x658b('0x25')](_0x52ecde[_0x658b('0x26')]);if(_0x52ecde[_0x658b('0x27')]){delete _0x52ecde['name'];}_0x4085e1['status'](_0x3cbc7f)[_0x658b('0x28')](_0x52ecde);};}exports[_0x658b('0x22')]=function(_0x10b677,_0x13652b){if(_0x10b677[_0x658b('0x29')]['id']){delete _0x10b677[_0x658b('0x29')]['id'];}return db[_0x658b('0x2a')]['find']({'where':{'id':_0x10b677[_0x658b('0x2b')]['id']}})[_0x658b('0x23')](handleEntityNotFound(_0x13652b,null))[_0x658b('0x23')](saveUpdates(_0x10b677[_0x658b('0x29')],null))[_0x658b('0x23')](respondWithResult(_0x13652b,null))[_0x658b('0x2c')](handleError(_0x13652b,null));};exports[_0x658b('0x24')]=function(_0x5bf490,_0x9a7c3a){return db[_0x658b('0x2a')][_0x658b('0x2d')]({'where':{'id':_0x5bf490['params']['id']}})[_0x658b('0x23')](handleEntityNotFound(_0x9a7c3a,null))['then'](removeEntity(_0x9a7c3a,null))['catch'](handleError(_0x9a7c3a,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5a28f83..1a62cf1 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 _0x6900=['api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x52406e,_0x5675d6){var _0x230989=function(_0x2f0478){while(--_0x2f0478){_0x52406e['push'](_0x52406e['shift']());}};_0x230989(++_0x5675d6);}(_0x6900,0x17e));var _0x0690=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x6900[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x0690('0x0'));var util=require(_0x0690('0x1'));var logger=require('../../config/logger')(_0x0690('0x2'));var moment=require(_0x0690('0x3'));var BPromise=require('bluebird');var rp=require(_0x0690('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0690('0x5'));var config=require(_0x0690('0x6'));var attributes=require(_0x0690('0x7'));module[_0x0690('0x8')]=function(_0x49a2ba,_0x291e64){return _0x49a2ba[_0x0690('0x9')](_0x0690('0xa'),attributes,{'tableName':_0x0690('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70f4=['../../config/logger','request-promise','path','rimraf','../../config/environment','define','tools_conditions','lodash','util'];(function(_0x467f47,_0x49565c){var _0x4a0868=function(_0x3b7c40){while(--_0x3b7c40){_0x467f47['push'](_0x467f47['shift']());}};_0x4a0868(++_0x49565c);}(_0x70f4,0x142));var _0x470f=function(_0x4b60ae,_0x4ea45c){_0x4b60ae=_0x4b60ae-0x0;var _0x11ddbe=_0x70f4[_0x4b60ae];return _0x11ddbe;};'use strict';var _=require(_0x470f('0x0'));var util=require(_0x470f('0x1'));var logger=require(_0x470f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x470f('0x3'));var fs=require('fs');var path=require(_0x470f('0x4'));var rimraf=require(_0x470f('0x5'));var config=require(_0x470f('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x4894a0,_0xa6152d){return _0x4894a0[_0x470f('0x7')]('Condition',attributes,{'tableName':_0x470f('0x8'),'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 dd178b2..b8a88c1 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 _0x5c76=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x597232,_0x53c4b9){var _0x15126f=function(_0x48fc64){while(--_0x48fc64){_0x597232['push'](_0x597232['shift']());}};_0x15126f(++_0x53c4b9);}(_0x5c76,0x153));var _0x65c7=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x5c76[_0x4e93a9];return _0x43013c;};'use strict';var _=require(_0x65c7('0x0'));var util=require(_0x65c7('0x1'));var moment=require(_0x65c7('0x2'));var BPromise=require(_0x65c7('0x3'));var rs=require(_0x65c7('0x4'));var fs=require('fs');var Redis=require(_0x65c7('0x5'));var db=require(_0x65c7('0x6'))['db'];var utils=require(_0x65c7('0x7'));var logger=require(_0x65c7('0x8'))(_0x65c7('0x9'));var config=require('../../config/environment');var jayson=require(_0x65c7('0xa'));var client=jayson[_0x65c7('0xb')][_0x65c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x543cd2,_0x23db73,_0x840648){return new BPromise(function(_0x30cdf7,_0x329937){return client[_0x65c7('0xd')](_0x543cd2,_0x840648)[_0x65c7('0xe')](function(_0x197d87){logger['info'](_0x65c7('0xf'),_0x23db73,_0x65c7('0x10'));logger[_0x65c7('0x11')](_0x65c7('0x12'),_0x23db73,_0x65c7('0x10'),JSON[_0x65c7('0x13')](_0x197d87));if(_0x197d87['error']){if(_0x197d87['error'][_0x65c7('0x14')]===0x1f4){logger['error'](_0x65c7('0xf'),_0x23db73,_0x197d87[_0x65c7('0x15')][_0x65c7('0x16')]);return _0x329937(_0x197d87[_0x65c7('0x15')][_0x65c7('0x16')]);}logger['error'](_0x65c7('0xf'),_0x23db73,_0x197d87[_0x65c7('0x15')][_0x65c7('0x16')]);return _0x30cdf7(_0x197d87[_0x65c7('0x15')][_0x65c7('0x16')]);}else{logger[_0x65c7('0x17')](_0x65c7('0xf'),_0x23db73,'request\x20sent');_0x30cdf7(_0x197d87[_0x65c7('0x18')]['message']);}})[_0x65c7('0x19')](function(_0x1c47fa){logger[_0x65c7('0x15')](_0x65c7('0xf'),_0x23db73,_0x1c47fa);_0x329937(_0x1c47fa);});});} \ No newline at end of file +var _0xf927=['then','info','request\x20sent','debug','stringify','error','code','message','Condition,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x494eab,_0x513478){var _0x2e9e71=function(_0x213159){while(--_0x213159){_0x494eab['push'](_0x494eab['shift']());}};_0x2e9e71(++_0x513478);}(_0xf927,0x191));var _0x7f92=function(_0x400aa0,_0x3be5cd){_0x400aa0=_0x400aa0-0x0;var _0x38ff10=_0xf927[_0x400aa0];return _0x38ff10;};'use strict';var _=require(_0x7f92('0x0'));var util=require(_0x7f92('0x1'));var moment=require(_0x7f92('0x2'));var BPromise=require(_0x7f92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f92('0x4'));var db=require(_0x7f92('0x5'))['db'];var utils=require(_0x7f92('0x6'));var logger=require(_0x7f92('0x7'))(_0x7f92('0x8'));var config=require(_0x7f92('0x9'));var jayson=require(_0x7f92('0xa'));var client=jayson[_0x7f92('0xb')][_0x7f92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x498193,_0x5d631b,_0x1fa4ca){return new BPromise(function(_0x2de0d6,_0x47da51){return client['request'](_0x498193,_0x1fa4ca)[_0x7f92('0xd')](function(_0x204624){logger[_0x7f92('0xe')]('Condition,\x20%s,\x20%s',_0x5d631b,_0x7f92('0xf'));logger[_0x7f92('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x5d631b,_0x7f92('0xf'),JSON[_0x7f92('0x11')](_0x204624));if(_0x204624[_0x7f92('0x12')]){if(_0x204624[_0x7f92('0x12')][_0x7f92('0x13')]===0x1f4){logger[_0x7f92('0x12')]('Condition,\x20%s,\x20%s',_0x5d631b,_0x204624[_0x7f92('0x12')][_0x7f92('0x14')]);return _0x47da51(_0x204624['error'][_0x7f92('0x14')]);}logger[_0x7f92('0x12')](_0x7f92('0x15'),_0x5d631b,_0x204624['error']['message']);return _0x2de0d6(_0x204624[_0x7f92('0x12')][_0x7f92('0x14')]);}else{logger[_0x7f92('0xe')](_0x7f92('0x15'),_0x5d631b,'request\x20sent');_0x2de0d6(_0x204624[_0x7f92('0x16')][_0x7f92('0x14')]);}})['catch'](function(_0x542d54){logger['error'](_0x7f92('0x15'),_0x5d631b,_0x542d54);_0x47da51(_0x542d54);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7350746..df8989d 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 _0x0067=['/:id','isAuthenticated','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17238b,_0xd19486){var _0x3f31f9=function(_0x3c527a){while(--_0x3c527a){_0x17238b['push'](_0x17238b['shift']());}};_0x3f31f9(++_0xd19486);}(_0x0067,0x185));var _0x7006=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0x0067[_0x5f50b5];return _0x54c383;};'use strict';var multer=require(_0x7006('0x0'));var util=require(_0x7006('0x1'));var path=require(_0x7006('0x2'));var timeout=require('connect-timeout');var express=require(_0x7006('0x3'));var router=express[_0x7006('0x4')]();var auth=require(_0x7006('0x5'));var interaction=require(_0x7006('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router['put'](_0x7006('0x7'),auth[_0x7006('0x8')](),controller[_0x7006('0x9')]);router[_0x7006('0xa')](_0x7006('0x7'),auth[_0x7006('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbe2d=['express','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xbe2d,0xa5));var _0xdbe2=function(_0x5645d9,_0x1b50c5){_0x5645d9=_0x5645d9-0x0;var _0x256d5f=_0xbe2d[_0x5645d9];return _0x256d5f;};'use strict';var multer=require('multer');var util=require(_0xdbe2('0x0'));var path=require(_0xdbe2('0x1'));var timeout=require(_0xdbe2('0x2'));var express=require(_0xdbe2('0x3'));var router=express['Router']();var auth=require(_0xdbe2('0x4'));var interaction=require(_0xdbe2('0x5'));var config=require('../../config/environment');var controller=require(_0xdbe2('0x6'));router[_0xdbe2('0x7')](_0xdbe2('0x8'),auth[_0xdbe2('0x9')](),controller[_0xdbe2('0xa')]);router[_0xdbe2('0xb')](_0xdbe2('0x8'),auth[_0xdbe2('0x9')](),controller[_0xdbe2('0xc')]);module[_0xdbe2('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d502d8f..ff52217 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 _0x0b9b=['sequelize','exports','STRING'];(function(_0x608409,_0x4a4afc){var _0x4c66cc=function(_0x4b0d17){while(--_0x4b0d17){_0x608409['push'](_0x608409['shift']());}};_0x4c66cc(++_0x4a4afc);}(_0x0b9b,0x1b9));var _0xb0b9=function(_0x59609f,_0x2055a8){_0x59609f=_0x59609f-0x0;var _0x35040a=_0x0b9b[_0x59609f];return _0x35040a;};'use strict';var Sequelize=require(_0xb0b9('0x0'));module[_0xb0b9('0x1')]={'name':{'type':Sequelize[_0xb0b9('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xb0b9('0x2')]}}; \ No newline at end of file +var _0xeb5d=['sequelize','exports','STRING','name'];(function(_0x30fe46,_0x2c21d0){var _0xa598d6=function(_0x5d3653){while(--_0x5d3653){_0x30fe46['push'](_0x30fe46['shift']());}};_0xa598d6(++_0x2c21d0);}(_0xeb5d,0x174));var _0xdeb5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xeb5d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xdeb5('0x0'));module[_0xdeb5('0x1')]={'name':{'type':Sequelize[_0xdeb5('0x2')],'allowNull':![],'unique':_0xdeb5('0x3')},'description':{'type':Sequelize[_0xdeb5('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 716039b..a5c21c4 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 _0x7962=['total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','length','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','Dashboard','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','catch','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','clone','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize'];(function(_0x2ee27c,_0x364355){var _0x2688cf=function(_0x1a235f){while(--_0x1a235f){_0x2ee27c['push'](_0x2ee27c['shift']());}};_0x2688cf(++_0x364355);}(_0x7962,0x84));var _0x2796=function(_0x34df17,_0x5831f9){_0x34df17=_0x34df17-0x0;var _0x213098=_0x7962[_0x34df17];return _0x213098;};'use strict';var pdf=require(_0x2796('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2796('0x1'));var zipdir=require(_0x2796('0x2'));var jsonpatch=require(_0x2796('0x3'));var rp=require(_0x2796('0x4'));var moment=require(_0x2796('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2796('0x6'));var util=require(_0x2796('0x7'));var path=require(_0x2796('0x8'));var sox=require(_0x2796('0x9'));var csv=require(_0x2796('0xa'));var ejs=require(_0x2796('0xb'));var fs=require('fs');var _=require(_0x2796('0xc'));var squel=require(_0x2796('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2796('0xe'));var toCsv=require(_0x2796('0xa'));var querystring=require(_0x2796('0xf'));var Papa=require(_0x2796('0x10'));var Redis=require('ioredis');var authService=require(_0x2796('0x11'));var qs=require(_0x2796('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2796('0x13'));var logger=require(_0x2796('0x14'))(_0x2796('0x15'));var utils=require(_0x2796('0x16'));var config=require('../../config/environment');var db=require(_0x2796('0x17'))['db'];config[_0x2796('0x18')]=_[_0x2796('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2796('0x1a'))(new Redis(config['redis']));require(_0x2796('0x1b'))[_0x2796('0x1c')](socket);function respondWithStatusCode(_0x496d18,_0xcf6ade){_0xcf6ade=_0xcf6ade||0xcc;return function(_0x2a1b24){if(_0x2a1b24){return _0x496d18['sendStatus'](_0xcf6ade);}return _0x496d18[_0x2796('0x1d')](_0xcf6ade)[_0x2796('0x1e')]();};}function respondWithResult(_0x4a0ef1,_0xc87573){_0xc87573=_0xc87573||0xc8;return function(_0x4c0968){if(_0x4c0968){return _0x4a0ef1[_0x2796('0x1d')](_0xc87573)[_0x2796('0x1f')](_0x4c0968);}};}function respondWithFilteredResult(_0x2adfea,_0x37b5e0){return function(_0x5de800){if(_0x5de800){var _0x106a6e=_0x5de800['count'],_0x574be9=_0x37b5e0[_0x2796('0x20')],_0x1d31e9=_0x37b5e0[_0x2796('0x20')]+_0x37b5e0[_0x2796('0x21')],_0x350032;if(_0x1d31e9>=_0x106a6e){_0x1d31e9=_0x106a6e;_0x350032=0xc8;}else{_0x350032=0xce;}_0x2adfea[_0x2796('0x1d')](_0x350032);return _0x2adfea[_0x2796('0x22')](_0x2796('0x23'),_0x574be9+'-'+_0x1d31e9+'/'+_0x106a6e)['json'](_0x5de800);}return null;};}function patchUpdates(_0x14256b){return function(_0x545058){try{jsonpatch['apply'](_0x545058,_0x14256b,!![]);}catch(_0x29fa70){return BPromise[_0x2796('0x24')](_0x29fa70);}return _0x545058[_0x2796('0x25')]();};}function saveUpdates(_0x1fb1be,_0x431423){return function(_0x238e2f){if(_0x238e2f){return _0x238e2f[_0x2796('0x26')](_0x1fb1be)[_0x2796('0x27')](function(_0xee61aa){return _0xee61aa;});}return null;};}function removeEntity(_0x50ef2c,_0x5a9f15){return function(_0x49400b){if(_0x49400b){return _0x49400b[_0x2796('0x28')]()[_0x2796('0x27')](function(){var _0x1b61e4=_0x49400b['get']({'plain':!![]});var _0x5018a9='CustomDashboards';return db[_0x2796('0x29')][_0x2796('0x28')]({'where':{'type':_0x5018a9,'resourceId':_0x1b61e4['id']}})[_0x2796('0x27')](function(){return _0x49400b;});})[_0x2796('0x27')](function(){_0x50ef2c[_0x2796('0x1d')](0xcc)[_0x2796('0x1e')]();});}};}function handleEntityNotFound(_0x3c1a85,_0xa7070f){return function(_0x55b0db){if(!_0x55b0db){_0x3c1a85[_0x2796('0x2a')](0x194);}return _0x55b0db;};}function handleError(_0x34c47f,_0xa34b2d){_0xa34b2d=_0xa34b2d||0x1f4;return function(_0x5a7ab3){logger[_0x2796('0x2b')](_0x5a7ab3[_0x2796('0x2c')]);if(_0x5a7ab3[_0x2796('0x2d')]){delete _0x5a7ab3[_0x2796('0x2d')];}_0x34c47f['status'](_0xa34b2d)[_0x2796('0x2e')](_0x5a7ab3);};}exports['index']=function(_0x333eef,_0x326cda){var _0x3765fe={},_0x1110ad={},_0x5f1cef={'count':0x0,'rows':[]};var _0x48094b=_['map'](db[_0x2796('0x2f')]['rawAttributes'],function(_0x80d97e){return{'name':_0x80d97e[_0x2796('0x30')],'type':_0x80d97e[_0x2796('0x31')]['key']};});_0x1110ad['model']=_['map'](_0x48094b,_0x2796('0x2d'));_0x1110ad[_0x2796('0x32')]=_[_0x2796('0x33')](_0x333eef[_0x2796('0x32')]);_0x1110ad['filters']=_[_0x2796('0x34')](_0x1110ad[_0x2796('0x35')],_0x1110ad[_0x2796('0x32')]);_0x3765fe[_0x2796('0x36')]=_[_0x2796('0x34')](_0x1110ad[_0x2796('0x35')],qs[_0x2796('0x37')](_0x333eef[_0x2796('0x32')][_0x2796('0x37')]));_0x3765fe[_0x2796('0x36')]=_0x3765fe[_0x2796('0x36')]['length']?_0x3765fe[_0x2796('0x36')]:_0x1110ad[_0x2796('0x35')];if(!_0x333eef['query'][_0x2796('0x38')]('nolimit')){_0x3765fe['limit']=qs[_0x2796('0x21')](_0x333eef[_0x2796('0x32')][_0x2796('0x21')]);_0x3765fe['offset']=qs[_0x2796('0x20')](_0x333eef[_0x2796('0x32')]['offset']);}_0x3765fe[_0x2796('0x39')]=qs['sort'](_0x333eef[_0x2796('0x32')][_0x2796('0x3a')]);_0x3765fe[_0x2796('0x3b')]=qs[_0x2796('0x3c')](_[_0x2796('0x3d')](_0x333eef[_0x2796('0x32')],_0x1110ad[_0x2796('0x3c')]),_0x48094b);if(_0x333eef[_0x2796('0x32')][_0x2796('0x3e')]){_0x3765fe['where']=_[_0x2796('0x3f')](_0x3765fe[_0x2796('0x3b')],{'$or':_[_0x2796('0x40')](_0x48094b,function(_0x99b5d){if(_0x99b5d['type']!==_0x2796('0x41')){var _0x9e9acc={};_0x9e9acc[_0x99b5d['name']]={'$like':'%'+_0x333eef[_0x2796('0x32')]['filter']+'%'};return _0x9e9acc;}})});}_0x3765fe=_['merge']({},_0x3765fe,_0x333eef[_0x2796('0x42')]);var _0x3ff2ed={'where':_0x3765fe[_0x2796('0x3b')]};return db[_0x2796('0x2f')][_0x2796('0x43')](_0x3ff2ed)['then'](function(_0x499d13){_0x5f1cef['count']=_0x499d13;if(_0x333eef[_0x2796('0x32')][_0x2796('0x44')]){_0x3765fe[_0x2796('0x45')]=[{'all':!![]}];}return db[_0x2796('0x2f')]['findAll'](_0x3765fe);})[_0x2796('0x27')](function(_0x37f674){_0x5f1cef['rows']=_0x37f674;return _0x5f1cef;})[_0x2796('0x27')](respondWithFilteredResult(_0x326cda,_0x3765fe))[_0x2796('0x46')](handleError(_0x326cda,null));};exports['show']=function(_0x518b60,_0x74008){var _0x5243ea={'raw':![],'where':{'id':_0x518b60['params']['id']}},_0x22adc6={};_0x22adc6['model']=_['keys'](db['Dashboard'][_0x2796('0x47')]);_0x22adc6[_0x2796('0x32')]=_[_0x2796('0x33')](_0x518b60[_0x2796('0x32')]);_0x22adc6[_0x2796('0x3c')]=_[_0x2796('0x34')](_0x22adc6[_0x2796('0x35')],_0x22adc6[_0x2796('0x32')]);_0x5243ea[_0x2796('0x36')]=_[_0x2796('0x34')](_0x22adc6[_0x2796('0x35')],qs[_0x2796('0x37')](_0x518b60[_0x2796('0x32')][_0x2796('0x37')]));_0x5243ea['attributes']=_0x5243ea['attributes']['length']?_0x5243ea['attributes']:_0x22adc6['model'];if(_0x518b60[_0x2796('0x32')][_0x2796('0x44')]){_0x5243ea[_0x2796('0x45')]=[{'all':!![]}];}_0x5243ea=_[_0x2796('0x3f')]({},_0x5243ea,_0x518b60[_0x2796('0x42')]);return db[_0x2796('0x2f')]['find'](_0x5243ea)[_0x2796('0x27')](handleEntityNotFound(_0x74008,null))[_0x2796('0x27')](respondWithResult(_0x74008,null))['catch'](handleError(_0x74008,null));};exports[_0x2796('0x48')]=function(_0xd3c3a0,_0x4b5ebc){return db[_0x2796('0x2f')][_0x2796('0x48')](_0xd3c3a0[_0x2796('0x49')],{})['then'](function(_0x35c6bf){var _0x2c656e=_0xd3c3a0['user'][_0x2796('0x4a')]({'plain':!![]});if(!_0x2c656e)throw new Error(_0x2796('0x4b'));if(_0x2c656e['role']===_0x2796('0x4c')){var _0x4a717d=_0x35c6bf[_0x2796('0x4a')]({'plain':!![]});var _0x59da77=_0x2796('0x4d');return db[_0x2796('0x4e')][_0x2796('0x4f')]({'where':{'name':_0x59da77,'userProfileId':_0x2c656e[_0x2796('0x50')]},'raw':!![]})['then'](function(_0x24d028){if(_0x24d028&&_0x24d028[_0x2796('0x51')]===0x0){return db[_0x2796('0x29')][_0x2796('0x48')]({'name':_0x4a717d[_0x2796('0x2d')],'resourceId':_0x4a717d['id'],'type':_0x24d028[_0x2796('0x2d')],'sectionId':_0x24d028['id']},{})['then'](function(){return _0x35c6bf;});}else{return _0x35c6bf;}})[_0x2796('0x46')](function(_0x25d7eb){logger[_0x2796('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25d7eb);throw _0x25d7eb;});}return _0x35c6bf;})[_0x2796('0x27')](respondWithResult(_0x4b5ebc,0xc9))[_0x2796('0x46')](handleError(_0x4b5ebc,null));};exports[_0x2796('0x52')]=function(_0x25a948,_0x1cc220){var _0x28ba25={'where':{'id':_0x25a948['params']['id']}},_0x386a86={};_0x386a86[_0x2796('0x35')]=_[_0x2796('0x33')](db[_0x2796('0x2f')][_0x2796('0x47')]);_0x28ba25[_0x2796('0x36')]=_['intersection'](_0x386a86[_0x2796('0x35')],qs[_0x2796('0x37')](_0x25a948[_0x2796('0x32')][_0x2796('0x37')]));_0x28ba25[_0x2796('0x36')]=_0x28ba25[_0x2796('0x36')]['length']?_0x28ba25[_0x2796('0x36')]:_0x386a86[_0x2796('0x35')];if(_0x25a948[_0x2796('0x32')][_0x2796('0x44')]){_0x28ba25['include']=[{'all':!![]}];}_0x28ba25=_[_0x2796('0x3f')]({},_0x28ba25,_0x25a948[_0x2796('0x42')]);return db[_0x2796('0x2f')][_0x2796('0x4f')](_0x28ba25)[_0x2796('0x27')](handleEntityNotFound(_0x1cc220,null))['then'](function(_0x33ecd1){if(_0x33ecd1){var _0x33a42f=_0x33ecd1[_0x2796('0x4a')]({'plain':!![]});_0x33a42f=qs['omit'](_0x33a42f,['id',_0x2796('0x53'),'updatedAt']);_0x25a948[_0x2796('0x49')]=_['omit'](_0x25a948[_0x2796('0x49')],['id','createdAt',_0x2796('0x54')]);return db[_0x2796('0x2f')][_0x2796('0x48')](_[_0x2796('0x3f')](_0x33a42f,_0x25a948['body']),{'include':_0x25a948[_0x2796('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x2796('0x27')](function(_0x21f601){var _0xd2a65a=_0x25a948['user'][_0x2796('0x4a')]({'plain':!![]});if(!_0xd2a65a)throw new Error(_0x2796('0x4b'));if(_0xd2a65a['role']===_0x2796('0x4c')){var _0x3135a2=_0x21f601[_0x2796('0x4a')]({'plain':!![]});var _0x4dec3b=_0x2796('0x4d');return db[_0x2796('0x4e')][_0x2796('0x4f')]({'where':{'name':_0x4dec3b,'userProfileId':_0xd2a65a[_0x2796('0x50')]},'raw':!![]})['then'](function(_0x3664ce){if(_0x3664ce&&_0x3664ce['autoAssociation']===0x0){return db['UserProfileResource'][_0x2796('0x48')]({'name':_0x3135a2['name'],'resourceId':_0x3135a2['id'],'type':_0x3664ce[_0x2796('0x2d')],'sectionId':_0x3664ce['id']},{})[_0x2796('0x27')](function(){return _0x21f601;});}else{return _0x21f601;}})[_0x2796('0x46')](function(_0x5ccd31){logger['error'](_0x2796('0x55'),_0x5ccd31);throw _0x5ccd31;});}return _0x21f601;});}})[_0x2796('0x27')](respondWithResult(_0x1cc220,0xc9))[_0x2796('0x46')](handleError(_0x1cc220,null));};exports[_0x2796('0x26')]=function(_0x4ba488,_0x42e2ea){if(_0x4ba488[_0x2796('0x49')]['id']){delete _0x4ba488[_0x2796('0x49')]['id'];}return db[_0x2796('0x2f')][_0x2796('0x4f')]({'where':{'id':_0x4ba488[_0x2796('0x56')]['id']}})[_0x2796('0x27')](handleEntityNotFound(_0x42e2ea,null))[_0x2796('0x27')](saveUpdates(_0x4ba488[_0x2796('0x49')],null))[_0x2796('0x27')](respondWithResult(_0x42e2ea,null))[_0x2796('0x46')](handleError(_0x42e2ea,null));};exports[_0x2796('0x28')]=function(_0x19c98e,_0x50f97b){return db['Dashboard'][_0x2796('0x4f')]({'where':{'id':_0x19c98e[_0x2796('0x56')]['id']}})[_0x2796('0x27')](handleEntityNotFound(_0x50f97b,null))['then'](removeEntity(_0x50f97b,null))['catch'](handleError(_0x50f97b,null));};function widgetAttributes(_0x39536a){try{switch(_0x39536a['type']){case _0x2796('0x57'):return[{'name':_0x2796('0x58'),'value':_0x39536a[_0x2796('0x58')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a[_0x2796('0x59')][0x0][_0x2796('0x5a')]:undefined)||_0x2796('0x5b')}];case _0x2796('0x5c'):return[{'name':_0x2796('0x5d'),'value':_0x39536a['attrPath']||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a[_0x2796('0x59')][0x0][_0x2796('0x5a')]:undefined)||''}];case _0x2796('0x5e'):return[{'name':_0x2796('0x5f'),'value':_0x39536a[_0x2796('0x5f')]||(_0x39536a['attrs']&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a['attrs'][0x0][_0x2796('0x5a')]:undefined)||_0x2796('0x60')},{'name':_0x2796('0x61'),'value':_0x39536a[_0x2796('0x61')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x1]?_0x39536a[_0x2796('0x59')][0x1]['value']:undefined)||_0x2796('0x62')},{'name':_0x2796('0x63'),'value':_0x39536a[_0x2796('0x63')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x2]?_0x39536a[_0x2796('0x59')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x39536a['attrMetric']||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a[_0x2796('0x59')][0x0][_0x2796('0x5a')]:undefined)||_0x2796('0x64')},{'name':'attrVoiceQueues','value':_0x39536a['attrVoiceQueues']||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x1]?_0x39536a[_0x2796('0x59')][0x1][_0x2796('0x5a')]:undefined)||[]},{'name':_0x2796('0x63'),'value':_0x39536a[_0x2796('0x63')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x2]?_0x39536a['attrs'][0x2][_0x2796('0x5a')]:undefined)||0x14}];case _0x2796('0x65'):case _0x2796('0x66'):return[{'name':_0x2796('0x67'),'value':_0x39536a['attrSerie1']||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x2796('0x68'),'value':_0x39536a[_0x2796('0x68')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x1]?_0x39536a[_0x2796('0x59')][0x1][_0x2796('0x5a')]:undefined)||null},{'name':_0x2796('0x69'),'value':_0x39536a['attrSerie3']||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x2]?_0x39536a[_0x2796('0x59')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x39536a[_0x2796('0x6a')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x3]?_0x39536a['attrs'][0x3][_0x2796('0x5a')]:undefined)||[]}];case _0x2796('0x6b'):return[{'name':_0x2796('0x6c'),'type':_0x39536a[_0x2796('0x6d')]||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a[_0x2796('0x59')][0x0]['type']:undefined)||null,'value':_0x39536a['attrReport']||(_0x39536a[_0x2796('0x59')]&&_0x39536a[_0x2796('0x59')][0x0]?_0x39536a[_0x2796('0x59')][0x0][_0x2796('0x5a')]:undefined)||null},{'name':'attrRefresh','value':_0x39536a['attrRefresh']||(_0x39536a['attrs']&&_0x39536a['attrs'][0x1]?_0x39536a['attrs'][0x1][_0x2796('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x3b828a){logger['error'](_0x2796('0x6e'),JSON['stringify'](_0x3b828a));return[];}}exports[_0x2796('0x6f')]=function(_0x5a0771,_0x3feef0,_0x307d1c){if(_0x5a0771[_0x2796('0x49')]['id']){delete _0x5a0771['body']['id'];}return db[_0x2796('0x2f')][_0x2796('0x4f')]({'where':{'id':_0x5a0771[_0x2796('0x56')]['id']}})['then'](handleEntityNotFound(_0x3feef0,null))['then'](function(_0xb2cbdd){if(_0xb2cbdd){_0x5a0771['body']['DashboardId']=_0xb2cbdd['id'];_0x5a0771[_0x2796('0x49')][_0x2796('0x59')]=widgetAttributes(_0x5a0771['body']);return db[_0x2796('0x70')][_0x2796('0x48')](_0x5a0771[_0x2796('0x49')]);}})['then'](respondWithResult(_0x3feef0,null))['catch'](handleError(_0x3feef0,null));};exports[_0x2796('0x71')]=function(_0x3fd0e3,_0x10ed90,_0x24d8b5){var _0x51a78f={};var _0x42d506={};var _0x5712ef;var _0x420a0e;return db[_0x2796('0x2f')][_0x2796('0x72')]({'where':{'id':_0x3fd0e3[_0x2796('0x56')]['id']}})['then'](handleEntityNotFound(_0x10ed90,null))['then'](function(_0x2df944){if(_0x2df944){_0x5712ef=_0x2df944;_0x42d506[_0x2796('0x35')]=_['keys'](db[_0x2796('0x70')][_0x2796('0x47')]);_0x42d506[_0x2796('0x32')]=_[_0x2796('0x33')](_0x3fd0e3[_0x2796('0x32')]);_0x42d506[_0x2796('0x3c')]=_[_0x2796('0x34')](_0x42d506[_0x2796('0x35')],_0x42d506[_0x2796('0x32')]);_0x51a78f[_0x2796('0x36')]=_[_0x2796('0x34')](_0x42d506[_0x2796('0x35')],qs['fields'](_0x3fd0e3[_0x2796('0x32')][_0x2796('0x37')]));_0x51a78f[_0x2796('0x36')]=_0x51a78f['attributes'][_0x2796('0x73')]?_0x51a78f[_0x2796('0x36')]:_0x42d506[_0x2796('0x35')];_0x51a78f[_0x2796('0x39')]=qs[_0x2796('0x3a')](_0x3fd0e3[_0x2796('0x32')][_0x2796('0x3a')]);_0x51a78f[_0x2796('0x3b')]=qs[_0x2796('0x3c')](_[_0x2796('0x3d')](_0x3fd0e3[_0x2796('0x32')],_0x42d506[_0x2796('0x3c')]));if(_0x3fd0e3[_0x2796('0x32')][_0x2796('0x3e')]){_0x51a78f[_0x2796('0x3b')]=_[_0x2796('0x3f')](_0x51a78f[_0x2796('0x3b')],{'$or':_[_0x2796('0x40')](_0x51a78f[_0x2796('0x36')],function(_0x9e16ce){var _0x23d5b8={};_0x23d5b8[_0x9e16ce]={'$like':'%'+_0x3fd0e3[_0x2796('0x32')][_0x2796('0x3e')]+'%'};return _0x23d5b8;})});}_0x51a78f=_[_0x2796('0x3f')]({},_0x51a78f,_0x3fd0e3[_0x2796('0x42')]);return _0x5712ef[_0x2796('0x71')](_0x51a78f);}})['then'](function(_0x413424){if(_0x413424){_0x420a0e=_0x413424[_0x2796('0x73')];if(!_0x3fd0e3['query']['hasOwnProperty']('nolimit')){_0x51a78f[_0x2796('0x21')]=qs[_0x2796('0x21')](_0x3fd0e3[_0x2796('0x32')][_0x2796('0x21')]);_0x51a78f['offset']=qs[_0x2796('0x20')](_0x3fd0e3[_0x2796('0x32')]['offset']);}return _0x5712ef['getItems'](_0x51a78f);}})['then'](function(_0x5ad044){if(_0x5ad044){return _0x5ad044?{'count':_0x420a0e,'rows':_0x5ad044}:null;}})[_0x2796('0x27')](respondWithResult(_0x10ed90,null))[_0x2796('0x46')](handleError(_0x10ed90,null));}; \ No newline at end of file +var _0x186e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Dashboard','include','findAll','rows','catch','show','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','autoAssociation','includeAll','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x186e,0x65));var _0xe186=function(_0x318201,_0x2c580c){_0x318201=_0x318201-0x0;var _0x22d52f=_0x186e[_0x318201];return _0x22d52f;};'use strict';var pdf=require(_0xe186('0x0'));var emlformat=require(_0xe186('0x1'));var rimraf=require(_0xe186('0x2'));var zipdir=require(_0xe186('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe186('0x4'));var Mustache=require(_0xe186('0x5'));var util=require('util');var path=require(_0xe186('0x6'));var sox=require(_0xe186('0x7'));var csv=require(_0xe186('0x8'));var ejs=require(_0xe186('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe186('0xa'));var crypto=require('crypto');var jsforce=require(_0xe186('0xb'));var deskjs=require(_0xe186('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe186('0xd'));var Papa=require('papaparse');var Redis=require(_0xe186('0xe'));var authService=require(_0xe186('0xf'));var qs=require(_0xe186('0x10'));var as=require(_0xe186('0x11'));var hardwareService=require(_0xe186('0x12'));var logger=require(_0xe186('0x13'))('api');var utils=require(_0xe186('0x14'));var config=require(_0xe186('0x15'));var db=require('../../mysqldb')['db'];config[_0xe186('0x16')]=_[_0xe186('0x17')](config[_0xe186('0x16')],{'host':_0xe186('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe186('0x16')]));require('./dashboard.socket')[_0xe186('0x19')](socket);function respondWithStatusCode(_0x5ac5b5,_0x1216a2){_0x1216a2=_0x1216a2||0xcc;return function(_0x2e0540){if(_0x2e0540){return _0x5ac5b5['sendStatus'](_0x1216a2);}return _0x5ac5b5['status'](_0x1216a2)[_0xe186('0x1a')]();};}function respondWithResult(_0x482521,_0x44aedf){_0x44aedf=_0x44aedf||0xc8;return function(_0x397b74){if(_0x397b74){return _0x482521[_0xe186('0x1b')](_0x44aedf)[_0xe186('0x1c')](_0x397b74);}};}function respondWithFilteredResult(_0x2884e6,_0x4a7a4d){return function(_0x266ce2){if(_0x266ce2){var _0x248a38=_0x266ce2[_0xe186('0x1d')],_0x557231=_0x4a7a4d['offset'],_0xc0474c=_0x4a7a4d[_0xe186('0x1e')]+_0x4a7a4d[_0xe186('0x1f')],_0x34f44c;if(_0xc0474c>=_0x248a38){_0xc0474c=_0x248a38;_0x34f44c=0xc8;}else{_0x34f44c=0xce;}_0x2884e6[_0xe186('0x1b')](_0x34f44c);return _0x2884e6[_0xe186('0x20')](_0xe186('0x21'),_0x557231+'-'+_0xc0474c+'/'+_0x248a38)['json'](_0x266ce2);}return null;};}function patchUpdates(_0x203da5){return function(_0x22298e){try{jsonpatch[_0xe186('0x22')](_0x22298e,_0x203da5,!![]);}catch(_0x2b7659){return BPromise[_0xe186('0x23')](_0x2b7659);}return _0x22298e['save']();};}function saveUpdates(_0x45e64,_0x1b34ca){return function(_0x5a06ba){if(_0x5a06ba){return _0x5a06ba[_0xe186('0x24')](_0x45e64)[_0xe186('0x25')](function(_0x1ce809){return _0x1ce809;});}return null;};}function removeEntity(_0x43e608,_0x5e3cc5){return function(_0x1cfda5){if(_0x1cfda5){return _0x1cfda5[_0xe186('0x26')]()[_0xe186('0x25')](function(){var _0x54566a=_0x1cfda5[_0xe186('0x27')]({'plain':!![]});var _0x3a87ef='CustomDashboards';return db[_0xe186('0x28')][_0xe186('0x26')]({'where':{'type':_0x3a87ef,'resourceId':_0x54566a['id']}})[_0xe186('0x25')](function(){return _0x1cfda5;});})[_0xe186('0x25')](function(){_0x43e608[_0xe186('0x1b')](0xcc)[_0xe186('0x1a')]();});}};}function handleEntityNotFound(_0x3d7fae,_0x937eb8){return function(_0x441b78){if(!_0x441b78){_0x3d7fae[_0xe186('0x29')](0x194);}return _0x441b78;};}function handleError(_0x2da440,_0x3ffaf7){_0x3ffaf7=_0x3ffaf7||0x1f4;return function(_0x3a1d58){logger[_0xe186('0x2a')](_0x3a1d58['stack']);if(_0x3a1d58[_0xe186('0x2b')]){delete _0x3a1d58[_0xe186('0x2b')];}_0x2da440[_0xe186('0x1b')](_0x3ffaf7)[_0xe186('0x2c')](_0x3a1d58);};}exports['index']=function(_0x9bb9dd,_0x10b8f2){var _0x4ddd08={},_0x3a3ddd={},_0x55da05={'count':0x0,'rows':[]};var _0x599a2a=_[_0xe186('0x2d')](db['Dashboard'][_0xe186('0x2e')],function(_0x242532){return{'name':_0x242532[_0xe186('0x2f')],'type':_0x242532['type'][_0xe186('0x30')]};});_0x3a3ddd[_0xe186('0x31')]=_[_0xe186('0x2d')](_0x599a2a,_0xe186('0x2b'));_0x3a3ddd[_0xe186('0x32')]=_[_0xe186('0x33')](_0x9bb9dd[_0xe186('0x32')]);_0x3a3ddd[_0xe186('0x34')]=_['intersection'](_0x3a3ddd[_0xe186('0x31')],_0x3a3ddd[_0xe186('0x32')]);_0x4ddd08[_0xe186('0x35')]=_[_0xe186('0x36')](_0x3a3ddd[_0xe186('0x31')],qs[_0xe186('0x37')](_0x9bb9dd[_0xe186('0x32')][_0xe186('0x37')]));_0x4ddd08[_0xe186('0x35')]=_0x4ddd08[_0xe186('0x35')]['length']?_0x4ddd08[_0xe186('0x35')]:_0x3a3ddd[_0xe186('0x31')];if(!_0x9bb9dd[_0xe186('0x32')][_0xe186('0x38')](_0xe186('0x39'))){_0x4ddd08['limit']=qs['limit'](_0x9bb9dd['query'][_0xe186('0x1f')]);_0x4ddd08[_0xe186('0x1e')]=qs[_0xe186('0x1e')](_0x9bb9dd['query']['offset']);}_0x4ddd08[_0xe186('0x3a')]=qs[_0xe186('0x3b')](_0x9bb9dd[_0xe186('0x32')]['sort']);_0x4ddd08[_0xe186('0x3c')]=qs[_0xe186('0x34')](_[_0xe186('0x3d')](_0x9bb9dd['query'],_0x3a3ddd[_0xe186('0x34')]),_0x599a2a);if(_0x9bb9dd['query']['filter']){_0x4ddd08['where']=_[_0xe186('0x3e')](_0x4ddd08[_0xe186('0x3c')],{'$or':_[_0xe186('0x2d')](_0x599a2a,function(_0xef7092){if(_0xef7092[_0xe186('0x3f')]!==_0xe186('0x40')){var _0x2a72ea={};_0x2a72ea[_0xef7092[_0xe186('0x2b')]]={'$like':'%'+_0x9bb9dd[_0xe186('0x32')][_0xe186('0x41')]+'%'};return _0x2a72ea;}})});}_0x4ddd08=_['merge']({},_0x4ddd08,_0x9bb9dd[_0xe186('0x42')]);var _0x4b8974={'where':_0x4ddd08[_0xe186('0x3c')]};return db[_0xe186('0x43')][_0xe186('0x1d')](_0x4b8974)['then'](function(_0x11106a){_0x55da05[_0xe186('0x1d')]=_0x11106a;if(_0x9bb9dd[_0xe186('0x32')]['includeAll']){_0x4ddd08[_0xe186('0x44')]=[{'all':!![]}];}return db[_0xe186('0x43')][_0xe186('0x45')](_0x4ddd08);})['then'](function(_0x83258e){_0x55da05[_0xe186('0x46')]=_0x83258e;return _0x55da05;})['then'](respondWithFilteredResult(_0x10b8f2,_0x4ddd08))[_0xe186('0x47')](handleError(_0x10b8f2,null));};exports[_0xe186('0x48')]=function(_0x1349a1,_0x1064d5){var _0x9dcfe={'raw':![],'where':{'id':_0x1349a1[_0xe186('0x49')]['id']}},_0x3632a7={};_0x3632a7[_0xe186('0x31')]=_[_0xe186('0x33')](db[_0xe186('0x43')][_0xe186('0x2e')]);_0x3632a7[_0xe186('0x32')]=_[_0xe186('0x33')](_0x1349a1['query']);_0x3632a7[_0xe186('0x34')]=_['intersection'](_0x3632a7[_0xe186('0x31')],_0x3632a7[_0xe186('0x32')]);_0x9dcfe[_0xe186('0x35')]=_[_0xe186('0x36')](_0x3632a7[_0xe186('0x31')],qs[_0xe186('0x37')](_0x1349a1['query'][_0xe186('0x37')]));_0x9dcfe[_0xe186('0x35')]=_0x9dcfe['attributes'][_0xe186('0x4a')]?_0x9dcfe['attributes']:_0x3632a7['model'];if(_0x1349a1[_0xe186('0x32')]['includeAll']){_0x9dcfe[_0xe186('0x44')]=[{'all':!![]}];}_0x9dcfe=_[_0xe186('0x3e')]({},_0x9dcfe,_0x1349a1[_0xe186('0x42')]);return db['Dashboard'][_0xe186('0x4b')](_0x9dcfe)[_0xe186('0x25')](handleEntityNotFound(_0x1064d5,null))[_0xe186('0x25')](respondWithResult(_0x1064d5,null))[_0xe186('0x47')](handleError(_0x1064d5,null));};exports[_0xe186('0x4c')]=function(_0x38b53b,_0x47f139){return db[_0xe186('0x43')][_0xe186('0x4c')](_0x38b53b['body'],{})[_0xe186('0x25')](function(_0xc2f7bb){var _0x1e3530=_0x38b53b['user'][_0xe186('0x27')]({'plain':!![]});if(!_0x1e3530)throw new Error(_0xe186('0x4d'));if(_0x1e3530[_0xe186('0x4e')]===_0xe186('0x4f')){var _0x257c64=_0xc2f7bb['get']({'plain':!![]});var _0x3ebbea=_0xe186('0x50');return db[_0xe186('0x51')][_0xe186('0x4b')]({'where':{'name':_0x3ebbea,'userProfileId':_0x1e3530['userProfileId']},'raw':!![]})[_0xe186('0x25')](function(_0x42519b){if(_0x42519b&&_0x42519b[_0xe186('0x52')]===0x0){return db['UserProfileResource'][_0xe186('0x4c')]({'name':_0x257c64[_0xe186('0x2b')],'resourceId':_0x257c64['id'],'type':_0x42519b[_0xe186('0x2b')],'sectionId':_0x42519b['id']},{})[_0xe186('0x25')](function(){return _0xc2f7bb;});}else{return _0xc2f7bb;}})[_0xe186('0x47')](function(_0x4c2810){logger[_0xe186('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c2810);throw _0x4c2810;});}return _0xc2f7bb;})[_0xe186('0x25')](respondWithResult(_0x47f139,0xc9))['catch'](handleError(_0x47f139,null));};exports['clone']=function(_0x52827f,_0x29ff2c){var _0x44088a={'where':{'id':_0x52827f['params']['id']}},_0x2733d5={};_0x2733d5['model']=_['keys'](db[_0xe186('0x43')][_0xe186('0x2e')]);_0x44088a['attributes']=_['intersection'](_0x2733d5[_0xe186('0x31')],qs[_0xe186('0x37')](_0x52827f[_0xe186('0x32')][_0xe186('0x37')]));_0x44088a['attributes']=_0x44088a[_0xe186('0x35')]['length']?_0x44088a['attributes']:_0x2733d5[_0xe186('0x31')];if(_0x52827f[_0xe186('0x32')][_0xe186('0x53')]){_0x44088a[_0xe186('0x44')]=[{'all':!![]}];}_0x44088a=_['merge']({},_0x44088a,_0x52827f[_0xe186('0x42')]);return db['Dashboard'][_0xe186('0x4b')](_0x44088a)[_0xe186('0x25')](handleEntityNotFound(_0x29ff2c,null))[_0xe186('0x25')](function(_0x541740){if(_0x541740){var _0x204d46=_0x541740['get']({'plain':!![]});_0x204d46=qs[_0xe186('0x54')](_0x204d46,['id',_0xe186('0x55'),_0xe186('0x56')]);_0x52827f[_0xe186('0x57')]=_[_0xe186('0x54')](_0x52827f[_0xe186('0x57')],['id','createdAt',_0xe186('0x56')]);return db[_0xe186('0x43')][_0xe186('0x4c')](_[_0xe186('0x3e')](_0x204d46,_0x52827f[_0xe186('0x57')]),{'include':_0x52827f[_0xe186('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4a565c){var _0x59c607=_0x52827f[_0xe186('0x4f')][_0xe186('0x27')]({'plain':!![]});if(!_0x59c607)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59c607[_0xe186('0x4e')]==='user'){var _0x3e5429=_0x4a565c[_0xe186('0x27')]({'plain':!![]});var _0x2060aa=_0xe186('0x50');return db[_0xe186('0x51')][_0xe186('0x4b')]({'where':{'name':_0x2060aa,'userProfileId':_0x59c607['userProfileId']},'raw':!![]})[_0xe186('0x25')](function(_0x45068d){if(_0x45068d&&_0x45068d[_0xe186('0x52')]===0x0){return db[_0xe186('0x28')][_0xe186('0x4c')]({'name':_0x3e5429[_0xe186('0x2b')],'resourceId':_0x3e5429['id'],'type':_0x45068d['name'],'sectionId':_0x45068d['id']},{})[_0xe186('0x25')](function(){return _0x4a565c;});}else{return _0x4a565c;}})[_0xe186('0x47')](function(_0x8482a4){logger[_0xe186('0x2a')](_0xe186('0x58'),_0x8482a4);throw _0x8482a4;});}return _0x4a565c;});}})['then'](respondWithResult(_0x29ff2c,0xc9))[_0xe186('0x47')](handleError(_0x29ff2c,null));};exports[_0xe186('0x24')]=function(_0x42117d,_0x542159){if(_0x42117d['body']['id']){delete _0x42117d[_0xe186('0x57')]['id'];}return db[_0xe186('0x43')][_0xe186('0x4b')]({'where':{'id':_0x42117d[_0xe186('0x49')]['id']}})['then'](handleEntityNotFound(_0x542159,null))['then'](saveUpdates(_0x42117d[_0xe186('0x57')],null))[_0xe186('0x25')](respondWithResult(_0x542159,null))[_0xe186('0x47')](handleError(_0x542159,null));};exports[_0xe186('0x26')]=function(_0x2b29ba,_0x396ca4){return db[_0xe186('0x43')]['find']({'where':{'id':_0x2b29ba[_0xe186('0x49')]['id']}})['then'](handleEntityNotFound(_0x396ca4,null))[_0xe186('0x25')](removeEntity(_0x396ca4,null))['catch'](handleError(_0x396ca4,null));};function widgetAttributes(_0x36289d){try{switch(_0x36289d['type']){case'iframe':return[{'name':'attrUrl','value':_0x36289d[_0xe186('0x59')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x0]?_0x36289d['attrs'][0x0][_0xe186('0x5b')]:undefined)||_0xe186('0x5c')}];case _0xe186('0x5d'):return[{'name':_0xe186('0x5e'),'value':_0x36289d[_0xe186('0x5e')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x0]?_0x36289d['attrs'][0x0][_0xe186('0x5b')]:undefined)||''}];case _0xe186('0x5f'):return[{'name':_0xe186('0x60'),'value':_0x36289d[_0xe186('0x60')]||(_0x36289d['attrs']&&_0x36289d['attrs'][0x0]?_0x36289d[_0xe186('0x5a')][0x0][_0xe186('0x5b')]:undefined)||_0xe186('0x61')},{'name':'attrTimezone','value':_0x36289d[_0xe186('0x62')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x1]?_0x36289d[_0xe186('0x5a')][0x1]['value']:undefined)||_0xe186('0x63')},{'name':'attrFontSize','value':_0x36289d[_0xe186('0x64')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x2]?_0x36289d[_0xe186('0x5a')][0x2][_0xe186('0x5b')]:undefined)||0xc}];case _0xe186('0x65'):return[{'name':_0xe186('0x66'),'value':_0x36289d[_0xe186('0x66')]||(_0x36289d['attrs']&&_0x36289d[_0xe186('0x5a')][0x0]?_0x36289d[_0xe186('0x5a')][0x0]['value']:undefined)||_0xe186('0x67')},{'name':_0xe186('0x68'),'value':_0x36289d['attrVoiceQueues']||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x1]?_0x36289d[_0xe186('0x5a')][0x1][_0xe186('0x5b')]:undefined)||[]},{'name':_0xe186('0x64'),'value':_0x36289d[_0xe186('0x64')]||(_0x36289d['attrs']&&_0x36289d[_0xe186('0x5a')][0x2]?_0x36289d[_0xe186('0x5a')][0x2][_0xe186('0x5b')]:undefined)||0x14}];case _0xe186('0x69'):case _0xe186('0x6a'):return[{'name':'attrSerie1','value':_0x36289d[_0xe186('0x6b')]||(_0x36289d['attrs']&&_0x36289d['attrs'][0x0]?_0x36289d[_0xe186('0x5a')][0x0][_0xe186('0x5b')]:undefined)||_0xe186('0x67')},{'name':'attrSerie2','value':_0x36289d[_0xe186('0x6c')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x1]?_0x36289d[_0xe186('0x5a')][0x1][_0xe186('0x5b')]:undefined)||null},{'name':'attrSerie3','value':_0x36289d[_0xe186('0x6d')]||(_0x36289d['attrs']&&_0x36289d[_0xe186('0x5a')][0x2]?_0x36289d['attrs'][0x2]['value']:undefined)||null},{'name':_0xe186('0x68'),'value':_0x36289d[_0xe186('0x68')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d['attrs'][0x3]?_0x36289d[_0xe186('0x5a')][0x3][_0xe186('0x5b')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x36289d['reportType']||(_0x36289d[_0xe186('0x5a')]&&_0x36289d['attrs'][0x0]?_0x36289d[_0xe186('0x5a')][0x0][_0xe186('0x3f')]:undefined)||null,'value':_0x36289d[_0xe186('0x6e')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d[_0xe186('0x5a')][0x0]?_0x36289d[_0xe186('0x5a')][0x0][_0xe186('0x5b')]:undefined)||null},{'name':_0xe186('0x6f'),'value':_0x36289d[_0xe186('0x6f')]||(_0x36289d[_0xe186('0x5a')]&&_0x36289d['attrs'][0x1]?_0x36289d[_0xe186('0x5a')][0x1][_0xe186('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0xbd284e){logger['error'](_0xe186('0x70'),JSON[_0xe186('0x71')](_0xbd284e));return[];}}exports[_0xe186('0x72')]=function(_0x5d9fdd,_0x334858,_0xf3794c){if(_0x5d9fdd[_0xe186('0x57')]['id']){delete _0x5d9fdd['body']['id'];}return db['Dashboard'][_0xe186('0x4b')]({'where':{'id':_0x5d9fdd[_0xe186('0x49')]['id']}})['then'](handleEntityNotFound(_0x334858,null))[_0xe186('0x25')](function(_0x4ae2fe){if(_0x4ae2fe){_0x5d9fdd[_0xe186('0x57')][_0xe186('0x73')]=_0x4ae2fe['id'];_0x5d9fdd[_0xe186('0x57')][_0xe186('0x5a')]=widgetAttributes(_0x5d9fdd['body']);return db[_0xe186('0x74')]['create'](_0x5d9fdd['body']);}})[_0xe186('0x25')](respondWithResult(_0x334858,null))[_0xe186('0x47')](handleError(_0x334858,null));};exports[_0xe186('0x75')]=function(_0x371ccf,_0x3fe76e,_0x347ef3){var _0x27ca79={};var _0x28d628={};var _0x30a195;var _0x3a083a;return db[_0xe186('0x43')]['findOne']({'where':{'id':_0x371ccf[_0xe186('0x49')]['id']}})[_0xe186('0x25')](handleEntityNotFound(_0x3fe76e,null))[_0xe186('0x25')](function(_0x576d2e){if(_0x576d2e){_0x30a195=_0x576d2e;_0x28d628['model']=_[_0xe186('0x33')](db[_0xe186('0x74')][_0xe186('0x2e')]);_0x28d628['query']=_[_0xe186('0x33')](_0x371ccf[_0xe186('0x32')]);_0x28d628[_0xe186('0x34')]=_[_0xe186('0x36')](_0x28d628['model'],_0x28d628[_0xe186('0x32')]);_0x27ca79[_0xe186('0x35')]=_[_0xe186('0x36')](_0x28d628[_0xe186('0x31')],qs[_0xe186('0x37')](_0x371ccf[_0xe186('0x32')][_0xe186('0x37')]));_0x27ca79[_0xe186('0x35')]=_0x27ca79[_0xe186('0x35')][_0xe186('0x4a')]?_0x27ca79[_0xe186('0x35')]:_0x28d628[_0xe186('0x31')];_0x27ca79[_0xe186('0x3a')]=qs[_0xe186('0x3b')](_0x371ccf[_0xe186('0x32')][_0xe186('0x3b')]);_0x27ca79['where']=qs[_0xe186('0x34')](_['pick'](_0x371ccf['query'],_0x28d628['filters']));if(_0x371ccf[_0xe186('0x32')][_0xe186('0x41')]){_0x27ca79[_0xe186('0x3c')]=_[_0xe186('0x3e')](_0x27ca79[_0xe186('0x3c')],{'$or':_[_0xe186('0x2d')](_0x27ca79[_0xe186('0x35')],function(_0x42f3fc){var _0x7dcdc5={};_0x7dcdc5[_0x42f3fc]={'$like':'%'+_0x371ccf[_0xe186('0x32')][_0xe186('0x41')]+'%'};return _0x7dcdc5;})});}_0x27ca79=_['merge']({},_0x27ca79,_0x371ccf[_0xe186('0x42')]);return _0x30a195[_0xe186('0x75')](_0x27ca79);}})['then'](function(_0x2bdc16){if(_0x2bdc16){_0x3a083a=_0x2bdc16[_0xe186('0x4a')];if(!_0x371ccf[_0xe186('0x32')][_0xe186('0x38')](_0xe186('0x39'))){_0x27ca79[_0xe186('0x1f')]=qs[_0xe186('0x1f')](_0x371ccf['query'][_0xe186('0x1f')]);_0x27ca79[_0xe186('0x1e')]=qs[_0xe186('0x1e')](_0x371ccf['query'][_0xe186('0x1e')]);}return _0x30a195[_0xe186('0x75')](_0x27ca79);}})[_0xe186('0x25')](function(_0x7b44b4){if(_0x7b44b4){return _0x7b44b4?{'count':_0x3a083a,'rows':_0x7b44b4}:null;}})[_0xe186('0x25')](respondWithResult(_0x3fe76e,null))[_0xe186('0x47')](handleError(_0x3fe76e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index cbd164b..21ab5dc 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 _0x21ca=['exports','events','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0xf05c4d,_0x140378){var _0x14030b=function(_0x4e0fe9){while(--_0x4e0fe9){_0xf05c4d['push'](_0xf05c4d['shift']());}};_0x14030b(++_0x140378);}(_0x21ca,0x1e7));var _0xa21c=function(_0x36605d,_0xb6d23a){_0x36605d=_0x36605d-0x0;var _0x1df398=_0x21ca[_0x36605d];return _0x1df398;};'use strict';var EventEmitter=require(_0xa21c('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa21c('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa21c('0x2')](0x0);var events={'afterCreate':_0xa21c('0x3'),'afterUpdate':'update','afterDestroy':_0xa21c('0x4')};function emitEvent(_0x13bada){return function(_0x5a6a25,_0x1b2dd7,_0x3f96b7){DashboardEvents[_0xa21c('0x5')](_0x13bada+':'+_0x5a6a25['id'],_0x5a6a25);DashboardEvents['emit'](_0x13bada,_0x5a6a25);_0x3f96b7(null);};}for(var e in events){if(events[_0xa21c('0x6')](e)){var event=events[e];Dashboard[_0xa21c('0x7')](e,emitEvent(event));}}module[_0xa21c('0x8')]=DashboardEvents; \ No newline at end of file +var _0xed04=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x483530,_0x270111){var _0xb9516d=function(_0x10b408){while(--_0x10b408){_0x483530['push'](_0x483530['shift']());}};_0xb9516d(++_0x270111);}(_0xed04,0x1ec));var _0x4ed0=function(_0x5ae864,_0x1c816c){_0x5ae864=_0x5ae864-0x0;var _0x48902b=_0xed04[_0x5ae864];return _0x48902b;};'use strict';var EventEmitter=require(_0x4ed0('0x0'));var Dashboard=require(_0x4ed0('0x1'))['db'][_0x4ed0('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4ed0('0x3')](0x0);var events={'afterCreate':_0x4ed0('0x4'),'afterUpdate':'update','afterDestroy':_0x4ed0('0x5')};function emitEvent(_0x3f24a0){return function(_0x361c8b,_0x2495d4,_0x5b0c80){DashboardEvents[_0x4ed0('0x6')](_0x3f24a0+':'+_0x361c8b['id'],_0x361c8b);DashboardEvents[_0x4ed0('0x6')](_0x3f24a0,_0x361c8b);_0x5b0c80(null);};}for(var e in events){if(events[_0x4ed0('0x7')](e)){var event=events[e];Dashboard[_0x4ed0('0x8')](e,emitEvent(event));}}module[_0x4ed0('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a254a5e..ddd7cd4 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 _0x021c=['../../config/environment','./dashboard.attributes','define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x021c,0xa9));var _0xc021=function(_0x4753f3,_0xfa186e){_0x4753f3=_0x4753f3-0x0;var _0x124353=_0x021c[_0x4753f3];return _0x124353;};'use strict';var _=require(_0xc021('0x0'));var util=require(_0xc021('0x1'));var logger=require(_0xc021('0x2'))(_0xc021('0x3'));var moment=require(_0xc021('0x4'));var BPromise=require(_0xc021('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc021('0x6'));var rimraf=require('rimraf');var config=require(_0xc021('0x7'));var attributes=require(_0xc021('0x8'));module['exports']=function(_0x2c74bb,_0x1d53b7){return _0x2c74bb[_0xc021('0x9')](_0xc021('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34b0=['rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xf369d4,_0x4dff0d){var _0x44fb45=function(_0x1479dd){while(--_0x1479dd){_0xf369d4['push'](_0xf369d4['shift']());}};_0x44fb45(++_0x4dff0d);}(_0x34b0,0xf4));var _0x034b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34b0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x034b('0x0'));var util=require(_0x034b('0x1'));var logger=require(_0x034b('0x2'))(_0x034b('0x3'));var moment=require(_0x034b('0x4'));var BPromise=require(_0x034b('0x5'));var rp=require(_0x034b('0x6'));var fs=require('fs');var path=require(_0x034b('0x7'));var rimraf=require(_0x034b('0x8'));var config=require(_0x034b('0x9'));var attributes=require(_0x034b('0xa'));module['exports']=function(_0x4743ec,_0x2aa6fe){return _0x4743ec[_0x034b('0xb')](_0x034b('0xc'),attributes,{'tableName':_0x034b('0xd'),'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 e052d17..1275788 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 _0x8b4d=['socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost'];(function(_0x485f62,_0xd898d8){var _0x520f12=function(_0x7079ea){while(--_0x7079ea){_0x485f62['push'](_0x485f62['shift']());}};_0x520f12(++_0xd898d8);}(_0x8b4d,0x11d));var _0xd8b4=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x8b4d[_0x3b3cc6];return _0x1161e4;};'use strict';var _=require(_0xd8b4('0x0'));var util=require(_0xd8b4('0x1'));var moment=require(_0xd8b4('0x2'));var BPromise=require(_0xd8b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8b4('0x4'));var db=require(_0xd8b4('0x5'))['db'];var utils=require(_0xd8b4('0x6'));var logger=require(_0xd8b4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd8b4('0x8'));var client=jayson[_0xd8b4('0x9')]['http']({'port':0x232a});config[_0xd8b4('0xa')]=_['defaults'](config['redis'],{'host':_0xd8b4('0xb'),'port':0x18eb});var socket=require(_0xd8b4('0xc'))(new Redis(config[_0xd8b4('0xa')]));require('./dashboard.socket')[_0xd8b4('0xd')](socket);function respondWithRpcPromise(_0x4d03e3,_0x818fbe,_0x413a75){return new BPromise(function(_0x53dc8a,_0x589296){return client[_0xd8b4('0xe')](_0x4d03e3,_0x413a75)[_0xd8b4('0xf')](function(_0x1da18f){logger[_0xd8b4('0x10')](_0xd8b4('0x11'),_0x818fbe,_0xd8b4('0x12'));logger[_0xd8b4('0x13')](_0xd8b4('0x14'),_0x818fbe,_0xd8b4('0x12'),JSON[_0xd8b4('0x15')](_0x1da18f));if(_0x1da18f['error']){if(_0x1da18f['error'][_0xd8b4('0x16')]===0x1f4){logger[_0xd8b4('0x17')](_0xd8b4('0x11'),_0x818fbe,_0x1da18f[_0xd8b4('0x17')][_0xd8b4('0x18')]);return _0x589296(_0x1da18f['error'][_0xd8b4('0x18')]);}logger['error'](_0xd8b4('0x11'),_0x818fbe,_0x1da18f[_0xd8b4('0x17')][_0xd8b4('0x18')]);return _0x53dc8a(_0x1da18f[_0xd8b4('0x17')][_0xd8b4('0x18')]);}else{logger[_0xd8b4('0x10')]('Dashboard,\x20%s,\x20%s',_0x818fbe,'request\x20sent');_0x53dc8a(_0x1da18f[_0xd8b4('0x19')][_0xd8b4('0x18')]);}})[_0xd8b4('0x1a')](function(_0x5b0033){logger[_0xd8b4('0x17')](_0xd8b4('0x11'),_0x818fbe,_0x5b0033);_0x589296(_0x5b0033);});});} \ No newline at end of file +var _0xa96d=['debug','stringify','error','code','message','Dashboard,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./dashboard.socket','register','request','then','request\x20sent'];(function(_0xeaa3bd,_0x166691){var _0x2e1174=function(_0x310580){while(--_0x310580){_0xeaa3bd['push'](_0xeaa3bd['shift']());}};_0x2e1174(++_0x166691);}(_0xa96d,0x8a));var _0xda96=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0xa96d[_0x4d03d6];return _0x22752e;};'use strict';var _=require(_0xda96('0x0'));var util=require(_0xda96('0x1'));var moment=require(_0xda96('0x2'));var BPromise=require(_0xda96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda96('0x4'))['db'];var utils=require(_0xda96('0x5'));var logger=require(_0xda96('0x6'))(_0xda96('0x7'));var config=require('../../config/environment');var jayson=require(_0xda96('0x8'));var client=jayson[_0xda96('0x9')][_0xda96('0xa')]({'port':0x232a});config[_0xda96('0xb')]=_[_0xda96('0xc')](config[_0xda96('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda96('0xd'))[_0xda96('0xe')](socket);function respondWithRpcPromise(_0x25d6d7,_0x37dbc1,_0xecfc1d){return new BPromise(function(_0x1bf3bd,_0x358777){return client[_0xda96('0xf')](_0x25d6d7,_0xecfc1d)[_0xda96('0x10')](function(_0x275173){logger['info']('Dashboard,\x20%s,\x20%s',_0x37dbc1,_0xda96('0x11'));logger[_0xda96('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x37dbc1,_0xda96('0x11'),JSON[_0xda96('0x13')](_0x275173));if(_0x275173[_0xda96('0x14')]){if(_0x275173[_0xda96('0x14')][_0xda96('0x15')]===0x1f4){logger[_0xda96('0x14')]('Dashboard,\x20%s,\x20%s',_0x37dbc1,_0x275173[_0xda96('0x14')][_0xda96('0x16')]);return _0x358777(_0x275173[_0xda96('0x14')][_0xda96('0x16')]);}logger[_0xda96('0x14')](_0xda96('0x17'),_0x37dbc1,_0x275173[_0xda96('0x14')][_0xda96('0x16')]);return _0x1bf3bd(_0x275173['error']['message']);}else{logger[_0xda96('0x18')](_0xda96('0x17'),_0x37dbc1,_0xda96('0x11'));_0x1bf3bd(_0x275173['result'][_0xda96('0x16')]);}})[_0xda96('0x19')](function(_0x2caaf9){logger['error'](_0xda96('0x17'),_0x37dbc1,_0x2caaf9);_0x358777(_0x2caaf9);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5d1f165..465d9bf 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 _0x2e0c=['remove','removeListener','length','dashboard:','./dashboard.events','save'];(function(_0x296588,_0x49f98d){var _0x2f6d92=function(_0x3f424c){while(--_0x3f424c){_0x296588['push'](_0x296588['shift']());}};_0x2f6d92(++_0x49f98d);}(_0x2e0c,0xb8));var _0xc2e0=function(_0x299b0b,_0x1e5b52){_0x299b0b=_0x299b0b-0x0;var _0x249e7b=_0x2e0c[_0x299b0b];return _0x249e7b;};'use strict';var DashboardEvents=require(_0xc2e0('0x0'));var events=[_0xc2e0('0x1'),_0xc2e0('0x2'),'update'];function createListener(_0x41675d,_0x53191d){return function(_0xfaea9a){_0x53191d['emit'](_0x41675d,_0xfaea9a);};}function removeListener(_0x43b8fe,_0x2a815d){return function(){DashboardEvents[_0xc2e0('0x3')](_0x43b8fe,_0x2a815d);};}exports['register']=function(_0x2f6e38){for(var _0x2acbef=0x0,_0x3bf43a=events[_0xc2e0('0x4')];_0x2acbef<_0x3bf43a;_0x2acbef++){var _0x3b426f=events[_0x2acbef];var _0x5f5013=createListener(_0xc2e0('0x5')+_0x3b426f,_0x2f6e38);DashboardEvents['on'](_0x3b426f,_0x5f5013);}}; \ No newline at end of file +var _0x0060=['register','dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0060,0x12a));var _0x0006=function(_0x2af53e,_0x2222e5){_0x2af53e=_0x2af53e-0x0;var _0x4ed385=_0x0060[_0x2af53e];return _0x4ed385;};'use strict';var DashboardEvents=require(_0x0006('0x0'));var events=[_0x0006('0x1'),_0x0006('0x2'),_0x0006('0x3')];function createListener(_0x454ffe,_0x29bbad){return function(_0x1130bc){_0x29bbad[_0x0006('0x4')](_0x454ffe,_0x1130bc);};}function removeListener(_0x3b331e,_0x4cc8ba){return function(){DashboardEvents[_0x0006('0x5')](_0x3b331e,_0x4cc8ba);};}exports[_0x0006('0x6')]=function(_0xaa7e74){for(var _0x60238f=0x0,_0x2e1999=events['length'];_0x60238f<_0x2e1999;_0x60238f++){var _0x49e405=events[_0x60238f];var _0x34bf3b=createListener(_0x0006('0x7')+_0x49e405,_0xaa7e74);DashboardEvents['on'](_0x49e405,_0x34bf3b);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 51a98c9..a236b2d 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x15c606,_0xf2c1d1){var _0x3666f6=function(_0x515110){while(--_0x515110){_0x15c606['push'](_0x15c606['shift']());}};_0x3666f6(++_0xf2c1d1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x229920,_0x417b31){var _0x1034da=function(_0x4c187d){while(--_0x4c187d){_0x229920['push'](_0x229920['shift']());}};_0x1034da(++_0x417b31);}(_0x70e0,0x17b));var _0x070e=function(_0x490117,_0x5e3b9d){_0x490117=_0x490117-0x0;var _0x55713c=_0x70e0[_0x490117];return _0x55713c;};'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 auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4dacd42..5de0197 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 _0x0d30=['setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse'];(function(_0x58e2a5,_0x4e822c){var _0x440ba0=function(_0x375d68){while(--_0x375d68){_0x58e2a5['push'](_0x58e2a5['shift']());}};_0x440ba0(++_0x4e822c);}(_0x0d30,0xe3));var _0x00d3=function(_0x2d595f,_0xdfdb46){_0x2d595f=_0x2d595f-0x0;var _0x1e26a2=_0x0d30[_0x2d595f];return _0x1e26a2;};'use strict';var Sequelize=require(_0x00d3('0x0'));var squel=require(_0x00d3('0x1'));var _=require(_0x00d3('0x2'));module[_0x00d3('0x3')]={'title':{'type':Sequelize[_0x00d3('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x00d3('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x00d3('0x5')]('long'),'get':function(){try{return JSON[_0x00d3('0x6')](this['getDataValue']('attrs'));}catch(_0x2f8fe3){return[];}},'set':function(_0x9d8bb2){try{this[_0x00d3('0x7')](_0x00d3('0x8'),JSON['stringify'](_0x9d8bb2));}catch(_0x5dd55d){this['setDataValue'](_0x00d3('0x8'),JSON[_0x00d3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x00d3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x00d3('0xa')]},'col':{'type':Sequelize[_0x00d3('0xa')]},'background':{'type':Sequelize[_0x00d3('0x4')],'allowNull':![],'defaultValue':_0x00d3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x00d3('0x4')],'allowNull':![],'defaultValue':_0x00d3('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x00d3('0x4')]}}; \ No newline at end of file +var _0xc0b9=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','attrs'];(function(_0x72586e,_0x48bfc1){var _0x59ed4d=function(_0x4d00b1){while(--_0x4d00b1){_0x72586e['push'](_0x72586e['shift']());}};_0x59ed4d(++_0x48bfc1);}(_0xc0b9,0x72));var _0x9c0b=function(_0x4d8d36,_0xd9cb7b){_0x4d8d36=_0x4d8d36-0x0;var _0x53906d=_0xc0b9[_0x4d8d36];return _0x53906d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9c0b('0x0'));var _=require('lodash');module[_0x9c0b('0x1')]={'title':{'type':Sequelize[_0x9c0b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9c0b('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9c0b('0x3')](_0x9c0b('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x9c0b('0x5')));}catch(_0x460944){return[];}},'set':function(_0x429486){try{this[_0x9c0b('0x6')](_0x9c0b('0x5'),JSON['stringify'](_0x429486));}catch(_0x2d14b2){this[_0x9c0b('0x6')](_0x9c0b('0x5'),JSON[_0x9c0b('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x9c0b('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9c0b('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x9c0b('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x9c0b('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9c0b('0x2')],'allowNull':![],'defaultValue':_0x9c0b('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9c0b('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index d4bcd1b..df1e2d1 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 _0x2a09=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','length','attributes','model','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2a09,0xa4));var _0x92a0=function(_0xb64a42,_0x52ab68){_0xb64a42=_0xb64a42-0x0;var _0x49123b=_0x2a09[_0xb64a42];return _0x49123b;};'use strict';var pdf=require(_0x92a0('0x0'));var emlformat=require(_0x92a0('0x1'));var rimraf=require(_0x92a0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x92a0('0x3'));var moment=require(_0x92a0('0x4'));var BPromise=require(_0x92a0('0x5'));var Mustache=require(_0x92a0('0x6'));var util=require(_0x92a0('0x7'));var path=require('path');var sox=require(_0x92a0('0x8'));var csv=require(_0x92a0('0x9'));var ejs=require(_0x92a0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92a0('0x9'));var querystring=require(_0x92a0('0xb'));var Papa=require(_0x92a0('0xc'));var Redis=require(_0x92a0('0xd'));var authService=require(_0x92a0('0xe'));var qs=require(_0x92a0('0xf'));var as=require(_0x92a0('0x10'));var hardwareService=require(_0x92a0('0x11'));var logger=require(_0x92a0('0x12'))(_0x92a0('0x13'));var utils=require(_0x92a0('0x14'));var config=require(_0x92a0('0x15'));var db=require(_0x92a0('0x16'))['db'];config[_0x92a0('0x17')]=_[_0x92a0('0x18')](config['redis'],{'host':_0x92a0('0x19'),'port':0x18eb});var socket=require(_0x92a0('0x1a'))(new Redis(config[_0x92a0('0x17')]));require(_0x92a0('0x1b'))['register'](socket);function respondWithStatusCode(_0xd39a51,_0x238177){_0x238177=_0x238177||0xcc;return function(_0x5e3d1a){if(_0x5e3d1a){return _0xd39a51[_0x92a0('0x1c')](_0x238177);}return _0xd39a51[_0x92a0('0x1d')](_0x238177)[_0x92a0('0x1e')]();};}function respondWithResult(_0x2e67d8,_0x1d3bae){_0x1d3bae=_0x1d3bae||0xc8;return function(_0x435479){if(_0x435479){return _0x2e67d8[_0x92a0('0x1d')](_0x1d3bae)[_0x92a0('0x1f')](_0x435479);}};}function respondWithFilteredResult(_0x54bfe8,_0x39336b){return function(_0x1d8ac1){if(_0x1d8ac1){var _0x4d3ea4=_0x1d8ac1[_0x92a0('0x20')],_0x1daec6=_0x39336b[_0x92a0('0x21')],_0x3062ab=_0x39336b['offset']+_0x39336b[_0x92a0('0x22')],_0x5a3e2a;if(_0x3062ab>=_0x4d3ea4){_0x3062ab=_0x4d3ea4;_0x5a3e2a=0xc8;}else{_0x5a3e2a=0xce;}_0x54bfe8['status'](_0x5a3e2a);return _0x54bfe8[_0x92a0('0x23')](_0x92a0('0x24'),_0x1daec6+'-'+_0x3062ab+'/'+_0x4d3ea4)[_0x92a0('0x1f')](_0x1d8ac1);}return null;};}function patchUpdates(_0x4b184e){return function(_0x5961d6){try{jsonpatch[_0x92a0('0x25')](_0x5961d6,_0x4b184e,!![]);}catch(_0x43ac0c){return BPromise[_0x92a0('0x26')](_0x43ac0c);}return _0x5961d6[_0x92a0('0x27')]();};}function saveUpdates(_0x1d4a19,_0x5548df){return function(_0x2c02eb){if(_0x2c02eb){return _0x2c02eb[_0x92a0('0x28')](_0x1d4a19)['then'](function(_0x17b290){return _0x17b290;});}return null;};}function removeEntity(_0x210a17,_0x55068b){return function(_0x1cbb63){if(_0x1cbb63){return _0x1cbb63[_0x92a0('0x29')]()[_0x92a0('0x2a')](function(){_0x210a17['status'](0xcc)[_0x92a0('0x1e')]();});}};}function handleEntityNotFound(_0x146d7a,_0x317985){return function(_0x2e61e4){if(!_0x2e61e4){_0x146d7a[_0x92a0('0x1c')](0x194);}return _0x2e61e4;};}function handleError(_0x44652c,_0x500775){_0x500775=_0x500775||0x1f4;return function(_0x52c868){logger['error'](_0x52c868[_0x92a0('0x2b')]);if(_0x52c868[_0x92a0('0x2c')]){delete _0x52c868[_0x92a0('0x2c')];}_0x44652c[_0x92a0('0x1d')](_0x500775)['send'](_0x52c868);};}exports[_0x92a0('0x2d')]=function(_0x30168a,_0x19d051){var _0x245737={'raw':![],'where':{'id':_0x30168a[_0x92a0('0x2e')]['id']}},_0x578b09={};_0x578b09['model']=_[_0x92a0('0x2f')](db[_0x92a0('0x30')][_0x92a0('0x31')]);_0x578b09[_0x92a0('0x32')]=_[_0x92a0('0x2f')](_0x30168a[_0x92a0('0x32')]);_0x578b09[_0x92a0('0x33')]=_[_0x92a0('0x34')](_0x578b09['model'],_0x578b09[_0x92a0('0x32')]);_0x245737['attributes']=_['intersection'](_0x578b09['model'],qs[_0x92a0('0x35')](_0x30168a[_0x92a0('0x32')][_0x92a0('0x35')]));_0x245737['attributes']=_0x245737['attributes'][_0x92a0('0x36')]?_0x245737[_0x92a0('0x37')]:_0x578b09[_0x92a0('0x38')];if(_0x30168a[_0x92a0('0x32')][_0x92a0('0x39')]){_0x245737[_0x92a0('0x3a')]=[{'all':!![]}];}_0x245737=_[_0x92a0('0x3b')]({},_0x245737,_0x30168a[_0x92a0('0x3c')]);return db[_0x92a0('0x30')][_0x92a0('0x3d')](_0x245737)[_0x92a0('0x2a')](handleEntityNotFound(_0x19d051,null))['then'](respondWithResult(_0x19d051,null))['catch'](handleError(_0x19d051,null));};exports[_0x92a0('0x29')]=function(_0x24a364,_0x10010c){return db[_0x92a0('0x30')]['find']({'where':{'id':_0x24a364[_0x92a0('0x2e')]['id']}})[_0x92a0('0x2a')](handleEntityNotFound(_0x10010c,null))[_0x92a0('0x2a')](removeEntity(_0x10010c,null))[_0x92a0('0x3e')](handleError(_0x10010c,null));};function widgetAttributes(_0x24af90){try{switch(_0x24af90[_0x92a0('0x3f')]){case _0x92a0('0x40'):return[{'name':_0x92a0('0x41'),'value':_0x24af90['attrUrl']||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x0]?_0x24af90[_0x92a0('0x42')][0x0][_0x92a0('0x43')]:undefined)||_0x92a0('0x44')}];case _0x92a0('0x45'):return[{'name':'attrPath','value':_0x24af90[_0x92a0('0x46')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90['attrs'][0x0]?_0x24af90[_0x92a0('0x42')][0x0][_0x92a0('0x43')]:undefined)||''}];case _0x92a0('0x47'):return[{'name':_0x92a0('0x48'),'value':_0x24af90['attrHourFormat']||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x0]?_0x24af90['attrs'][0x0]['value']:undefined)||_0x92a0('0x49')},{'name':_0x92a0('0x4a'),'value':_0x24af90['attrTimezone']||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x1]?_0x24af90[_0x92a0('0x42')][0x1][_0x92a0('0x43')]:undefined)||_0x92a0('0x4b')},{'name':_0x92a0('0x4c'),'value':_0x24af90[_0x92a0('0x4c')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x2]?_0x24af90[_0x92a0('0x42')][0x2][_0x92a0('0x43')]:undefined)||0xc}];case _0x92a0('0x4d'):return[{'name':_0x92a0('0x4e'),'value':_0x24af90[_0x92a0('0x4e')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x0]?_0x24af90['attrs'][0x0][_0x92a0('0x43')]:undefined)||_0x92a0('0x4f')},{'name':_0x92a0('0x50'),'value':_0x24af90[_0x92a0('0x50')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x1]?_0x24af90[_0x92a0('0x42')][0x1][_0x92a0('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x24af90[_0x92a0('0x4c')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x2]?_0x24af90[_0x92a0('0x42')][0x2][_0x92a0('0x43')]:undefined)||0x14}];case'multibar-chart':case _0x92a0('0x51'):return[{'name':'attrSerie1','value':_0x24af90[_0x92a0('0x52')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90['attrs'][0x0]?_0x24af90['attrs'][0x0][_0x92a0('0x43')]:undefined)||_0x92a0('0x4f')},{'name':_0x92a0('0x53'),'value':_0x24af90[_0x92a0('0x53')]||(_0x24af90['attrs']&&_0x24af90[_0x92a0('0x42')][0x1]?_0x24af90[_0x92a0('0x42')][0x1]['value']:undefined)||null},{'name':_0x92a0('0x54'),'value':_0x24af90[_0x92a0('0x54')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x2]?_0x24af90['attrs'][0x2][_0x92a0('0x43')]:undefined)||null},{'name':_0x92a0('0x50'),'value':_0x24af90[_0x92a0('0x50')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x3]?_0x24af90['attrs'][0x3][_0x92a0('0x43')]:undefined)||[]}];case _0x92a0('0x55'):return[{'name':_0x92a0('0x56'),'type':_0x24af90[_0x92a0('0x57')]||(_0x24af90['attrs']&&_0x24af90[_0x92a0('0x42')][0x0]?_0x24af90['attrs'][0x0][_0x92a0('0x3f')]:undefined)||null,'value':_0x24af90[_0x92a0('0x56')]||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x0]?_0x24af90[_0x92a0('0x42')][0x0][_0x92a0('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x24af90['attrRefresh']||(_0x24af90[_0x92a0('0x42')]&&_0x24af90[_0x92a0('0x42')][0x1]?_0x24af90[_0x92a0('0x42')][0x1][_0x92a0('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x25ab2a){logger['error'](_0x92a0('0x58'),JSON[_0x92a0('0x59')](_0x25ab2a));return[];}}exports[_0x92a0('0x5a')]=function(_0xd887ec,_0x678e5f){if(_0xd887ec[_0x92a0('0x5b')]){_0xd887ec[_0x92a0('0x5b')][_0x92a0('0x42')]=widgetAttributes(_0xd887ec[_0x92a0('0x5b')]);}return db['DashboardItem'][_0x92a0('0x5a')](_0xd887ec[_0x92a0('0x5b')],{})[_0x92a0('0x2a')](respondWithResult(_0x678e5f,0xc9))['catch'](handleError(_0x678e5f,null));};exports[_0x92a0('0x28')]=function(_0x3bcfe6,_0x44d802){if(_0x3bcfe6[_0x92a0('0x5b')]['id']){delete _0x3bcfe6[_0x92a0('0x5b')]['id'];}_0x3bcfe6[_0x92a0('0x5b')][_0x92a0('0x42')]=widgetAttributes(_0x3bcfe6[_0x92a0('0x5b')]);return db[_0x92a0('0x30')][_0x92a0('0x3d')]({'where':{'id':_0x3bcfe6['params']['id']}})[_0x92a0('0x2a')](handleEntityNotFound(_0x44d802,null))[_0x92a0('0x2a')](saveUpdates(_0x3bcfe6[_0x92a0('0x5b')],null))[_0x92a0('0x2a')](respondWithResult(_0x44d802,null))['catch'](handleError(_0x44d802,null));}; \ No newline at end of file +var _0xf515=['redis','defaults','socket.io-emitter','./dashboardItem.socket','register','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','error','name','send','show','model','keys','query','filters','attributes','intersection','fields','length','include','merge','options','DashboardItem','catch','find','params','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb'];(function(_0x39d92c,_0x5da592){var _0x47065f=function(_0x246a91){while(--_0x246a91){_0x39d92c['push'](_0x39d92c['shift']());}};_0x47065f(++_0x5da592);}(_0xf515,0x98));var _0x5f51=function(_0x2e5dc0,_0x33a556){_0x2e5dc0=_0x2e5dc0-0x0;var _0x11589b=_0xf515[_0x2e5dc0];return _0x11589b;};'use strict';var pdf=require(_0x5f51('0x0'));var emlformat=require(_0x5f51('0x1'));var rimraf=require(_0x5f51('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f51('0x3'));var rp=require(_0x5f51('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f51('0x5'));var util=require(_0x5f51('0x6'));var path=require(_0x5f51('0x7'));var sox=require(_0x5f51('0x8'));var csv=require(_0x5f51('0x9'));var ejs=require(_0x5f51('0xa'));var fs=require('fs');var _=require(_0x5f51('0xb'));var squel=require(_0x5f51('0xc'));var crypto=require(_0x5f51('0xd'));var jsforce=require(_0x5f51('0xe'));var deskjs=require(_0x5f51('0xf'));var toCsv=require(_0x5f51('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f51('0x10'));var authService=require(_0x5f51('0x11'));var qs=require(_0x5f51('0x12'));var as=require(_0x5f51('0x13'));var hardwareService=require(_0x5f51('0x14'));var logger=require(_0x5f51('0x15'))(_0x5f51('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5f51('0x17'))['db'];config[_0x5f51('0x18')]=_[_0x5f51('0x19')](config[_0x5f51('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f51('0x1a'))(new Redis(config[_0x5f51('0x18')]));require(_0x5f51('0x1b'))[_0x5f51('0x1c')](socket);function respondWithStatusCode(_0x5c4f71,_0x4335c1){_0x4335c1=_0x4335c1||0xcc;return function(_0x2b56fa){if(_0x2b56fa){return _0x5c4f71['sendStatus'](_0x4335c1);}return _0x5c4f71[_0x5f51('0x1d')](_0x4335c1)['end']();};}function respondWithResult(_0x583173,_0x4f60d4){_0x4f60d4=_0x4f60d4||0xc8;return function(_0x43a116){if(_0x43a116){return _0x583173[_0x5f51('0x1d')](_0x4f60d4)['json'](_0x43a116);}};}function respondWithFilteredResult(_0x31e771,_0x3fc378){return function(_0x1acd72){if(_0x1acd72){var _0x5eab6a=_0x1acd72[_0x5f51('0x1e')],_0x4c7fbb=_0x3fc378['offset'],_0x8a6c78=_0x3fc378[_0x5f51('0x1f')]+_0x3fc378[_0x5f51('0x20')],_0x33155a;if(_0x8a6c78>=_0x5eab6a){_0x8a6c78=_0x5eab6a;_0x33155a=0xc8;}else{_0x33155a=0xce;}_0x31e771['status'](_0x33155a);return _0x31e771['set'](_0x5f51('0x21'),_0x4c7fbb+'-'+_0x8a6c78+'/'+_0x5eab6a)[_0x5f51('0x22')](_0x1acd72);}return null;};}function patchUpdates(_0x3e5ec3){return function(_0x5c4fa3){try{jsonpatch[_0x5f51('0x23')](_0x5c4fa3,_0x3e5ec3,!![]);}catch(_0x69e8bb){return BPromise[_0x5f51('0x24')](_0x69e8bb);}return _0x5c4fa3['save']();};}function saveUpdates(_0x2d8954,_0x13a79d){return function(_0x2bba08){if(_0x2bba08){return _0x2bba08[_0x5f51('0x25')](_0x2d8954)[_0x5f51('0x26')](function(_0x546665){return _0x546665;});}return null;};}function removeEntity(_0x1318d6,_0x91b992){return function(_0x299dba){if(_0x299dba){return _0x299dba[_0x5f51('0x27')]()[_0x5f51('0x26')](function(){_0x1318d6['status'](0xcc)[_0x5f51('0x28')]();});}};}function handleEntityNotFound(_0x419bcd,_0x4ba588){return function(_0x1e7651){if(!_0x1e7651){_0x419bcd[_0x5f51('0x29')](0x194);}return _0x1e7651;};}function handleError(_0x2b1e8b,_0x1b3bbf){_0x1b3bbf=_0x1b3bbf||0x1f4;return function(_0x5d6eab){logger[_0x5f51('0x2a')](_0x5d6eab['stack']);if(_0x5d6eab[_0x5f51('0x2b')]){delete _0x5d6eab[_0x5f51('0x2b')];}_0x2b1e8b[_0x5f51('0x1d')](_0x1b3bbf)[_0x5f51('0x2c')](_0x5d6eab);};}exports[_0x5f51('0x2d')]=function(_0x19a525,_0x5bfeef){var _0x3cc1c1={'raw':![],'where':{'id':_0x19a525['params']['id']}},_0x48d024={};_0x48d024[_0x5f51('0x2e')]=_[_0x5f51('0x2f')](db['DashboardItem']['rawAttributes']);_0x48d024[_0x5f51('0x30')]=_[_0x5f51('0x2f')](_0x19a525[_0x5f51('0x30')]);_0x48d024[_0x5f51('0x31')]=_['intersection'](_0x48d024[_0x5f51('0x2e')],_0x48d024[_0x5f51('0x30')]);_0x3cc1c1[_0x5f51('0x32')]=_[_0x5f51('0x33')](_0x48d024[_0x5f51('0x2e')],qs[_0x5f51('0x34')](_0x19a525[_0x5f51('0x30')][_0x5f51('0x34')]));_0x3cc1c1[_0x5f51('0x32')]=_0x3cc1c1[_0x5f51('0x32')][_0x5f51('0x35')]?_0x3cc1c1[_0x5f51('0x32')]:_0x48d024[_0x5f51('0x2e')];if(_0x19a525[_0x5f51('0x30')]['includeAll']){_0x3cc1c1[_0x5f51('0x36')]=[{'all':!![]}];}_0x3cc1c1=_[_0x5f51('0x37')]({},_0x3cc1c1,_0x19a525[_0x5f51('0x38')]);return db[_0x5f51('0x39')]['find'](_0x3cc1c1)['then'](handleEntityNotFound(_0x5bfeef,null))[_0x5f51('0x26')](respondWithResult(_0x5bfeef,null))[_0x5f51('0x3a')](handleError(_0x5bfeef,null));};exports[_0x5f51('0x27')]=function(_0x5d1c88,_0x3f97dc){return db['DashboardItem'][_0x5f51('0x3b')]({'where':{'id':_0x5d1c88[_0x5f51('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3f97dc,null))[_0x5f51('0x26')](removeEntity(_0x3f97dc,null))['catch'](handleError(_0x3f97dc,null));};function widgetAttributes(_0x1c7b77){try{switch(_0x1c7b77[_0x5f51('0x3d')]){case _0x5f51('0x3e'):return[{'name':_0x5f51('0x3f'),'value':_0x1c7b77[_0x5f51('0x3f')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x0]?_0x1c7b77['attrs'][0x0][_0x5f51('0x41')]:undefined)||'https://'}];case'custom':return[{'name':_0x5f51('0x42'),'value':_0x1c7b77[_0x5f51('0x42')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x0]?_0x1c7b77[_0x5f51('0x40')][0x0][_0x5f51('0x41')]:undefined)||''}];case _0x5f51('0x43'):return[{'name':'attrHourFormat','value':_0x1c7b77[_0x5f51('0x44')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x0]?_0x1c7b77[_0x5f51('0x40')][0x0][_0x5f51('0x41')]:undefined)||_0x5f51('0x45')},{'name':_0x5f51('0x46'),'value':_0x1c7b77[_0x5f51('0x46')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x1]?_0x1c7b77[_0x5f51('0x40')][0x1][_0x5f51('0x41')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x1c7b77[_0x5f51('0x47')]||(_0x1c7b77['attrs']&&_0x1c7b77[_0x5f51('0x40')][0x2]?_0x1c7b77[_0x5f51('0x40')][0x2][_0x5f51('0x41')]:undefined)||0xc}];case _0x5f51('0x48'):return[{'name':_0x5f51('0x49'),'value':_0x1c7b77['attrMetric']||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x0]?_0x1c7b77['attrs'][0x0]['value']:undefined)||_0x5f51('0x4a')},{'name':_0x5f51('0x4b'),'value':_0x1c7b77['attrVoiceQueues']||(_0x1c7b77['attrs']&&_0x1c7b77[_0x5f51('0x40')][0x1]?_0x1c7b77['attrs'][0x1][_0x5f51('0x41')]:undefined)||[]},{'name':_0x5f51('0x47'),'value':_0x1c7b77[_0x5f51('0x47')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x2]?_0x1c7b77[_0x5f51('0x40')][0x2][_0x5f51('0x41')]:undefined)||0x14}];case _0x5f51('0x4c'):case _0x5f51('0x4d'):return[{'name':_0x5f51('0x4e'),'value':_0x1c7b77[_0x5f51('0x4e')]||(_0x1c7b77['attrs']&&_0x1c7b77[_0x5f51('0x40')][0x0]?_0x1c7b77['attrs'][0x0]['value']:undefined)||_0x5f51('0x4a')},{'name':_0x5f51('0x4f'),'value':_0x1c7b77[_0x5f51('0x4f')]||(_0x1c7b77['attrs']&&_0x1c7b77[_0x5f51('0x40')][0x1]?_0x1c7b77[_0x5f51('0x40')][0x1][_0x5f51('0x41')]:undefined)||null},{'name':_0x5f51('0x50'),'value':_0x1c7b77[_0x5f51('0x50')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x2]?_0x1c7b77[_0x5f51('0x40')][0x2]['value']:undefined)||null},{'name':_0x5f51('0x4b'),'value':_0x1c7b77[_0x5f51('0x4b')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x3]?_0x1c7b77[_0x5f51('0x40')][0x3][_0x5f51('0x41')]:undefined)||[]}];case _0x5f51('0x51'):return[{'name':_0x5f51('0x52'),'type':_0x1c7b77[_0x5f51('0x53')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77['attrs'][0x0]?_0x1c7b77['attrs'][0x0][_0x5f51('0x3d')]:undefined)||null,'value':_0x1c7b77['attrReport']||(_0x1c7b77['attrs']&&_0x1c7b77[_0x5f51('0x40')][0x0]?_0x1c7b77[_0x5f51('0x40')][0x0][_0x5f51('0x41')]:undefined)||null},{'name':_0x5f51('0x54'),'value':_0x1c7b77[_0x5f51('0x54')]||(_0x1c7b77[_0x5f51('0x40')]&&_0x1c7b77[_0x5f51('0x40')][0x1]?_0x1c7b77['attrs'][0x1][_0x5f51('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x5243e6){logger[_0x5f51('0x2a')]('widgetAttributes:\x20%s',JSON[_0x5f51('0x55')](_0x5243e6));return[];}}exports[_0x5f51('0x56')]=function(_0x2966a3,_0x105ef3){if(_0x2966a3[_0x5f51('0x57')]){_0x2966a3[_0x5f51('0x57')][_0x5f51('0x40')]=widgetAttributes(_0x2966a3[_0x5f51('0x57')]);}return db[_0x5f51('0x39')]['create'](_0x2966a3['body'],{})[_0x5f51('0x26')](respondWithResult(_0x105ef3,0xc9))[_0x5f51('0x3a')](handleError(_0x105ef3,null));};exports[_0x5f51('0x25')]=function(_0x50e16b,_0x1990da){if(_0x50e16b[_0x5f51('0x57')]['id']){delete _0x50e16b[_0x5f51('0x57')]['id'];}_0x50e16b[_0x5f51('0x57')][_0x5f51('0x40')]=widgetAttributes(_0x50e16b[_0x5f51('0x57')]);return db[_0x5f51('0x39')][_0x5f51('0x3b')]({'where':{'id':_0x50e16b[_0x5f51('0x3c')]['id']}})[_0x5f51('0x26')](handleEntityNotFound(_0x1990da,null))['then'](saveUpdates(_0x50e16b[_0x5f51('0x57')],null))['then'](respondWithResult(_0x1990da,null))[_0x5f51('0x3a')](handleError(_0x1990da,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0349e88..d891234 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 _0x4d23=['hasOwnProperty','hook','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d23,0x82));var _0x34d2=function(_0x2f148f,_0x2d20e0){_0x2f148f=_0x2f148f-0x0;var _0x11a1b5=_0x4d23[_0x2f148f];return _0x11a1b5;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x34d2('0x0'))['db'][_0x34d2('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x34d2('0x2')](0x0);var events={'afterCreate':_0x34d2('0x3'),'afterUpdate':_0x34d2('0x4'),'afterDestroy':_0x34d2('0x5')};function emitEvent(_0x416604){return function(_0x4035d9,_0x8a28cd,_0x321097){DashboardItemEvents['emit'](_0x416604+':'+_0x4035d9['id'],_0x4035d9);DashboardItemEvents['emit'](_0x416604,_0x4035d9);_0x321097(null);};}for(var e in events){if(events[_0x34d2('0x6')](e)){var event=events[e];DashboardItem[_0x34d2('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xf6ab=['hasOwnProperty','exports','DashboardItem','setMaxListeners','save','update','emit'];(function(_0x74a2cc,_0x183eb8){var _0x301d00=function(_0x2b0308){while(--_0x2b0308){_0x74a2cc['push'](_0x74a2cc['shift']());}};_0x301d00(++_0x183eb8);}(_0xf6ab,0xfe));var _0xbf6a=function(_0x123575,_0x3b6cb4){_0x123575=_0x123575-0x0;var _0x5e2f6b=_0xf6ab[_0x123575];return _0x5e2f6b;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xbf6a('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbf6a('0x1')](0x0);var events={'afterCreate':_0xbf6a('0x2'),'afterUpdate':_0xbf6a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x293bac){return function(_0x4e7eb9,_0x41af39,_0x32a714){DashboardItemEvents['emit'](_0x293bac+':'+_0x4e7eb9['id'],_0x4e7eb9);DashboardItemEvents[_0xbf6a('0x4')](_0x293bac,_0x4e7eb9);_0x32a714(null);};}for(var e in events){if(events[_0xbf6a('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xbf6a('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5f426e2..abce67e 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 _0x38d6=['../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1598fb,_0x29645f){var _0x4fae38=function(_0x29c828){while(--_0x29c828){_0x1598fb['push'](_0x1598fb['shift']());}};_0x4fae38(++_0x29645f);}(_0x38d6,0x1ef));var _0x638d=function(_0x5f7d79,_0x546143){_0x5f7d79=_0x5f7d79-0x0;var _0x577319=_0x38d6[_0x5f7d79];return _0x577319;};'use strict';var _=require(_0x638d('0x0'));var util=require(_0x638d('0x1'));var logger=require(_0x638d('0x2'))(_0x638d('0x3'));var moment=require(_0x638d('0x4'));var BPromise=require(_0x638d('0x5'));var rp=require(_0x638d('0x6'));var fs=require('fs');var path=require(_0x638d('0x7'));var rimraf=require(_0x638d('0x8'));var config=require(_0x638d('0x9'));var attributes=require(_0x638d('0xa'));module[_0x638d('0xb')]=function(_0x39df02,_0x39d230){return _0x39df02[_0x638d('0xc')](_0x638d('0xd'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10f=['bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10f,0x147));var _0xfb10=function(_0x1389aa,_0xa7f1fb){_0x1389aa=_0x1389aa-0x0;var _0x11e500=_0xb10f[_0x1389aa];return _0x11e500;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb10('0x0'))(_0xfb10('0x1'));var moment=require(_0xfb10('0x2'));var BPromise=require(_0xfb10('0x3'));var rp=require(_0xfb10('0x4'));var fs=require('fs');var path=require(_0xfb10('0x5'));var rimraf=require('rimraf');var config=require(_0xfb10('0x6'));var attributes=require(_0xfb10('0x7'));module[_0xfb10('0x8')]=function(_0x19e0ae,_0x494b1a){return _0x19e0ae[_0xfb10('0x9')]('DashboardItem',attributes,{'tableName':_0xfb10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 1a4aa87..17feea4 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 _0xda4b=['error','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','localhost','socket.io-emitter','redis','./dashboardItem.socket','request','then','info','request\x20sent','debug'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xda4b,0x65));var _0xbda4=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xda4b[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xbda4('0x0'));var util=require(_0xbda4('0x1'));var moment=require(_0xbda4('0x2'));var BPromise=require(_0xbda4('0x3'));var rs=require(_0xbda4('0x4'));var fs=require('fs');var Redis=require(_0xbda4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbda4('0x6'));var logger=require('../../config/logger')(_0xbda4('0x7'));var config=require('../../config/environment');var jayson=require(_0xbda4('0x8'));var client=jayson['client'][_0xbda4('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xbda4('0xa'),'port':0x18eb});var socket=require(_0xbda4('0xb'))(new Redis(config[_0xbda4('0xc')]));require(_0xbda4('0xd'))['register'](socket);function respondWithRpcPromise(_0x1c925c,_0x28fe07,_0x22ca39){return new BPromise(function(_0x2e3343,_0xbcf25d){return client[_0xbda4('0xe')](_0x1c925c,_0x22ca39)[_0xbda4('0xf')](function(_0x4fd644){logger[_0xbda4('0x10')]('DashboardItem,\x20%s,\x20%s',_0x28fe07,_0xbda4('0x11'));logger[_0xbda4('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x28fe07,_0xbda4('0x11'),JSON['stringify'](_0x4fd644));if(_0x4fd644[_0xbda4('0x13')]){if(_0x4fd644[_0xbda4('0x13')]['code']===0x1f4){logger[_0xbda4('0x13')]('DashboardItem,\x20%s,\x20%s',_0x28fe07,_0x4fd644[_0xbda4('0x13')][_0xbda4('0x14')]);return _0xbcf25d(_0x4fd644[_0xbda4('0x13')][_0xbda4('0x14')]);}logger[_0xbda4('0x13')](_0xbda4('0x15'),_0x28fe07,_0x4fd644[_0xbda4('0x13')][_0xbda4('0x14')]);return _0x2e3343(_0x4fd644[_0xbda4('0x13')][_0xbda4('0x14')]);}else{logger[_0xbda4('0x10')](_0xbda4('0x15'),_0x28fe07,_0xbda4('0x11'));_0x2e3343(_0x4fd644[_0xbda4('0x16')][_0xbda4('0x14')]);}})[_0xbda4('0x17')](function(_0x2cce84){logger['error'](_0xbda4('0x15'),_0x28fe07,_0x2cce84);_0xbcf25d(_0x2cce84);});});} \ No newline at end of file +var _0xdfb4=['randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xdfb4,0x1ad));var _0x4dfb=function(_0x2fc179,_0x5363c7){_0x2fc179=_0x2fc179-0x0;var _0x3fb02c=_0xdfb4[_0x2fc179];return _0x3fb02c;};'use strict';var _=require('lodash');var util=require(_0x4dfb('0x0'));var moment=require(_0x4dfb('0x1'));var BPromise=require(_0x4dfb('0x2'));var rs=require(_0x4dfb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4dfb('0x4'))(_0x4dfb('0x5'));var config=require(_0x4dfb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4dfb('0x7')][_0x4dfb('0x8')]({'port':0x232a});config[_0x4dfb('0x9')]=_['defaults'](config[_0x4dfb('0x9')],{'host':_0x4dfb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4dfb('0xb'))[_0x4dfb('0xc')](socket);function respondWithRpcPromise(_0xfa2b1c,_0x470ae2,_0x3b86ca){return new BPromise(function(_0x489ab3,_0x57f9f6){return client[_0x4dfb('0xd')](_0xfa2b1c,_0x3b86ca)['then'](function(_0x55ce78){logger[_0x4dfb('0xe')](_0x4dfb('0xf'),_0x470ae2,_0x4dfb('0x10'));logger[_0x4dfb('0x11')](_0x4dfb('0x12'),_0x470ae2,_0x4dfb('0x10'),JSON['stringify'](_0x55ce78));if(_0x55ce78[_0x4dfb('0x13')]){if(_0x55ce78['error'][_0x4dfb('0x14')]===0x1f4){logger[_0x4dfb('0x13')](_0x4dfb('0xf'),_0x470ae2,_0x55ce78[_0x4dfb('0x13')][_0x4dfb('0x15')]);return _0x57f9f6(_0x55ce78[_0x4dfb('0x13')][_0x4dfb('0x15')]);}logger[_0x4dfb('0x13')](_0x4dfb('0xf'),_0x470ae2,_0x55ce78['error'][_0x4dfb('0x15')]);return _0x489ab3(_0x55ce78[_0x4dfb('0x13')][_0x4dfb('0x15')]);}else{logger[_0x4dfb('0xe')](_0x4dfb('0xf'),_0x470ae2,'request\x20sent');_0x489ab3(_0x55ce78[_0x4dfb('0x16')][_0x4dfb('0x15')]);}})[_0x4dfb('0x17')](function(_0x217838){logger['error'](_0x4dfb('0xf'),_0x470ae2,_0x217838);_0x57f9f6(_0x217838);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5cf90c3..9490b75 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 _0xd085=['register','length','dashboardItem:','save','remove','update','emit','removeListener'];(function(_0x39cfed,_0xac6797){var _0x7ee7f1=function(_0x471887){while(--_0x471887){_0x39cfed['push'](_0x39cfed['shift']());}};_0x7ee7f1(++_0xac6797);}(_0xd085,0x17b));var _0x5d08=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0xd085[_0x4bb2b9];return _0x40e2a2;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x5d08('0x0'),_0x5d08('0x1'),_0x5d08('0x2')];function createListener(_0x245707,_0x51e00c){return function(_0x1c57e2){_0x51e00c[_0x5d08('0x3')](_0x245707,_0x1c57e2);};}function removeListener(_0xf3771d,_0x5d149b){return function(){DashboardItemEvents[_0x5d08('0x4')](_0xf3771d,_0x5d149b);};}exports[_0x5d08('0x5')]=function(_0x454304){for(var _0xc4ee58=0x0,_0x34ea50=events[_0x5d08('0x6')];_0xc4ee58<_0x34ea50;_0xc4ee58++){var _0x5002a3=events[_0xc4ee58];var _0x2350a6=createListener(_0x5d08('0x7')+_0x5002a3,_0x454304);DashboardItemEvents['on'](_0x5002a3,_0x2350a6);}}; \ No newline at end of file +var _0x4c89=['length','remove','emit','removeListener','register'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0x4c89,0xf6));var _0x94c8=function(_0x10894b,_0x21a68d){_0x10894b=_0x10894b-0x0;var _0x308464=_0x4c89[_0x10894b];return _0x308464;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x94c8('0x0'),'update'];function createListener(_0x20de11,_0x2bbeb8){return function(_0x13cc87){_0x2bbeb8[_0x94c8('0x1')](_0x20de11,_0x13cc87);};}function removeListener(_0x5cb6b4,_0x3b36dc){return function(){DashboardItemEvents[_0x94c8('0x2')](_0x5cb6b4,_0x3b36dc);};}exports[_0x94c8('0x3')]=function(_0x43cc78){for(var _0x4f7fb0=0x0,_0x51f303=events[_0x94c8('0x4')];_0x4f7fb0<_0x51f303;_0x4f7fb0++){var _0x479c19=events[_0x4f7fb0];var _0x15080d=createListener('dashboardItem:'+_0x479c19,_0x43cc78);DashboardItemEvents['on'](_0x479c19,_0x15080d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ed24133..59fa2a1 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 _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x11b4fb,_0x10c784){_0x11b4fb=_0x11b4fb-0x0;var _0x56cbb5=_0xf2ca[_0x11b4fb];return _0x56cbb5;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0xf494=['put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x2be60d,_0x2c6bb1){var _0x2291b8=function(_0x304125){while(--_0x304125){_0x2be60d['push'](_0x2be60d['shift']());}};_0x2291b8(++_0x2c6bb1);}(_0xf494,0x1c6));var _0x4f49=function(_0x27ce74,_0xab94f9){_0x27ce74=_0x27ce74-0x0;var _0x4fa468=_0xf494[_0x27ce74];return _0x4fa468;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')](_0x4f49('0xa'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0xe')](_0x4f49('0xa'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')](_0x4f49('0xa'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 82e56e6..631cc9b 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 _0xdb7a=['exports'];(function(_0x2c5e47,_0x60701d){var _0x5a3a3f=function(_0x1cb433){while(--_0x1cb433){_0x2c5e47['push'](_0x2c5e47['shift']());}};_0x5a3a3f(++_0x60701d);}(_0xdb7a,0xd3));var _0xadb7=function(_0x24567d,_0x5d9288){_0x24567d=_0x24567d-0x0;var _0x49f2bc=_0xdb7a[_0x24567d];return _0x49f2bc;};'use strict';var Sequelize=require('sequelize');module[_0xadb7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8d63=['STRING','exports'];(function(_0x5ce492,_0x16c44f){var _0x2c2c51=function(_0x48be5e){while(--_0x48be5e){_0x5ce492['push'](_0x5ce492['shift']());}};_0x2c2c51(++_0x16c44f);}(_0x8d63,0xc7));var _0x38d6=function(_0x786d5b,_0x54c7d6){_0x786d5b=_0x786d5b-0x0;var _0x20755a=_0x8d63[_0x786d5b];return _0x20755a;};'use strict';var Sequelize=require('sequelize');module[_0x38d6('0x0')]={'name':{'type':Sequelize[_0x38d6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c8bb2ee..4bfb884 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 _0x899a=['params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','offset','limit','set','json','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','Disposition','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show'];(function(_0x4cd544,_0x565c58){var _0x2bd004=function(_0x13abf2){while(--_0x13abf2){_0x4cd544['push'](_0x4cd544['shift']());}};_0x2bd004(++_0x565c58);}(_0x899a,0x64));var _0xa899=function(_0x5922c2,_0x3352cf){_0x5922c2=_0x5922c2-0x0;var _0x547209=_0x899a[_0x5922c2];return _0x547209;};'use strict';var pdf=require(_0xa899('0x0'));var emlformat=require(_0xa899('0x1'));var rimraf=require(_0xa899('0x2'));var zipdir=require(_0xa899('0x3'));var jsonpatch=require(_0xa899('0x4'));var rp=require(_0xa899('0x5'));var moment=require(_0xa899('0x6'));var BPromise=require(_0xa899('0x7'));var Mustache=require(_0xa899('0x8'));var util=require('util');var path=require(_0xa899('0x9'));var sox=require(_0xa899('0xa'));var csv=require(_0xa899('0xb'));var ejs=require(_0xa899('0xc'));var fs=require('fs');var _=require(_0xa899('0xd'));var squel=require(_0xa899('0xe'));var crypto=require('crypto');var jsforce=require(_0xa899('0xf'));var deskjs=require(_0xa899('0x10'));var toCsv=require(_0xa899('0xb'));var querystring=require('querystring');var Papa=require(_0xa899('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa899('0x12'));var as=require(_0xa899('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa899('0x14'))('api');var utils=require(_0xa899('0x15'));var config=require('../../config/environment');var db=require(_0xa899('0x16'))['db'];function respondWithStatusCode(_0x22170d,_0x2368f9){_0x2368f9=_0x2368f9||0xcc;return function(_0x1f453c){if(_0x1f453c){return _0x22170d['sendStatus'](_0x2368f9);}return _0x22170d[_0xa899('0x17')](_0x2368f9)[_0xa899('0x18')]();};}function respondWithResult(_0x54ee70,_0x137d40){_0x137d40=_0x137d40||0xc8;return function(_0x8d7af4){if(_0x8d7af4){return _0x54ee70['status'](_0x137d40)['json'](_0x8d7af4);}};}function respondWithFilteredResult(_0x3bfda5,_0x1fea1b){return function(_0x25e35c){if(_0x25e35c){var _0x9961ba=_0x25e35c['count'],_0x264118=_0x1fea1b[_0xa899('0x19')],_0x4ecaee=_0x1fea1b[_0xa899('0x19')]+_0x1fea1b[_0xa899('0x1a')],_0x470531;if(_0x4ecaee>=_0x9961ba){_0x4ecaee=_0x9961ba;_0x470531=0xc8;}else{_0x470531=0xce;}_0x3bfda5['status'](_0x470531);return _0x3bfda5[_0xa899('0x1b')]('Content-Range',_0x264118+'-'+_0x4ecaee+'/'+_0x9961ba)[_0xa899('0x1c')](_0x25e35c);}return null;};}function patchUpdates(_0x4fa7ca){return function(_0x5dae28){try{jsonpatch[_0xa899('0x1d')](_0x5dae28,_0x4fa7ca,!![]);}catch(_0x1bce64){return BPromise[_0xa899('0x1e')](_0x1bce64);}return _0x5dae28[_0xa899('0x1f')]();};}function saveUpdates(_0x4ad6bc,_0x522d58){return function(_0x5eaa7d){if(_0x5eaa7d){return _0x5eaa7d[_0xa899('0x20')](_0x4ad6bc)[_0xa899('0x21')](function(_0x53eda3){return _0x53eda3;});}return null;};}function removeEntity(_0x5d4b52,_0xfc64a7){return function(_0x13bb34){if(_0x13bb34){return _0x13bb34[_0xa899('0x22')]()[_0xa899('0x21')](function(){var _0x5c3c05=_0x13bb34[_0xa899('0x23')]({'plain':!![]});var _0x39fc59='Dispositions';return db['UserProfileResource'][_0xa899('0x22')]({'where':{'type':_0x39fc59,'resourceId':_0x5c3c05['id']}})[_0xa899('0x21')](function(){return _0x13bb34;});})['then'](function(){_0x5d4b52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bf24,_0x68508a){return function(_0x3afd48){if(!_0x3afd48){_0x47bf24[_0xa899('0x24')](0x194);}return _0x3afd48;};}function handleError(_0x570493,_0x53ad1f){_0x53ad1f=_0x53ad1f||0x1f4;return function(_0x326dff){logger['error'](_0x326dff[_0xa899('0x25')]);if(_0x326dff[_0xa899('0x26')]){delete _0x326dff[_0xa899('0x26')];}_0x570493[_0xa899('0x17')](_0x53ad1f)[_0xa899('0x27')](_0x326dff);};}exports[_0xa899('0x28')]=function(_0x131010,_0x372a95){var _0x25a06f={},_0x34b712={},_0x52e48a={'count':0x0,'rows':[]};var _0x3d59cf=_['map'](db[_0xa899('0x29')]['rawAttributes'],function(_0x2c26f6){return{'name':_0x2c26f6[_0xa899('0x2a')],'type':_0x2c26f6[_0xa899('0x2b')]['key']};});_0x34b712[_0xa899('0x2c')]=_[_0xa899('0x2d')](_0x3d59cf,_0xa899('0x26'));_0x34b712['query']=_[_0xa899('0x2e')](_0x131010[_0xa899('0x2f')]);_0x34b712[_0xa899('0x30')]=_[_0xa899('0x31')](_0x34b712['model'],_0x34b712[_0xa899('0x2f')]);_0x25a06f[_0xa899('0x32')]=_[_0xa899('0x31')](_0x34b712['model'],qs[_0xa899('0x33')](_0x131010[_0xa899('0x2f')][_0xa899('0x33')]));_0x25a06f[_0xa899('0x32')]=_0x25a06f[_0xa899('0x32')][_0xa899('0x34')]?_0x25a06f[_0xa899('0x32')]:_0x34b712[_0xa899('0x2c')];if(!_0x131010[_0xa899('0x2f')]['hasOwnProperty'](_0xa899('0x35'))){_0x25a06f['limit']=qs['limit'](_0x131010[_0xa899('0x2f')][_0xa899('0x1a')]);_0x25a06f[_0xa899('0x19')]=qs['offset'](_0x131010['query'][_0xa899('0x19')]);}_0x25a06f[_0xa899('0x36')]=qs['sort'](_0x131010[_0xa899('0x2f')][_0xa899('0x37')]);_0x25a06f[_0xa899('0x38')]=qs[_0xa899('0x30')](_[_0xa899('0x39')](_0x131010[_0xa899('0x2f')],_0x34b712['filters']),_0x3d59cf);if(_0x131010[_0xa899('0x2f')][_0xa899('0x3a')]){_0x25a06f[_0xa899('0x38')]=_[_0xa899('0x3b')](_0x25a06f[_0xa899('0x38')],{'$or':_[_0xa899('0x2d')](_0x3d59cf,function(_0x17057e){if(_0x17057e[_0xa899('0x2b')]!==_0xa899('0x3c')){var _0x1dddc6={};_0x1dddc6[_0x17057e[_0xa899('0x26')]]={'$like':'%'+_0x131010['query'][_0xa899('0x3a')]+'%'};return _0x1dddc6;}})});}_0x25a06f=_[_0xa899('0x3b')]({},_0x25a06f,_0x131010[_0xa899('0x3d')]);var _0xd60d55={'where':_0x25a06f[_0xa899('0x38')]};return db['Disposition'][_0xa899('0x3e')](_0xd60d55)[_0xa899('0x21')](function(_0x1842e7){_0x52e48a[_0xa899('0x3e')]=_0x1842e7;if(_0x131010[_0xa899('0x2f')][_0xa899('0x3f')]){_0x25a06f['include']=[{'all':!![]}];}return db[_0xa899('0x29')][_0xa899('0x40')](_0x25a06f);})[_0xa899('0x21')](function(_0x233b9f){_0x52e48a[_0xa899('0x41')]=_0x233b9f;return _0x52e48a;})[_0xa899('0x21')](respondWithFilteredResult(_0x372a95,_0x25a06f))[_0xa899('0x42')](handleError(_0x372a95,null));};exports[_0xa899('0x43')]=function(_0x1462d8,_0x4ac389){var _0x11a908={'raw':!![],'where':{'id':_0x1462d8[_0xa899('0x44')]['id']}},_0x322d87={};_0x322d87[_0xa899('0x2c')]=_['keys'](db[_0xa899('0x29')][_0xa899('0x45')]);_0x322d87[_0xa899('0x2f')]=_[_0xa899('0x2e')](_0x1462d8['query']);_0x322d87['filters']=_[_0xa899('0x31')](_0x322d87[_0xa899('0x2c')],_0x322d87[_0xa899('0x2f')]);_0x11a908[_0xa899('0x32')]=_[_0xa899('0x31')](_0x322d87[_0xa899('0x2c')],qs[_0xa899('0x33')](_0x1462d8[_0xa899('0x2f')][_0xa899('0x33')]));_0x11a908[_0xa899('0x32')]=_0x11a908[_0xa899('0x32')]['length']?_0x11a908[_0xa899('0x32')]:_0x322d87[_0xa899('0x2c')];if(_0x1462d8['query'][_0xa899('0x3f')]){_0x11a908[_0xa899('0x46')]=[{'all':!![]}];}_0x11a908=_[_0xa899('0x3b')]({},_0x11a908,_0x1462d8['options']);return db['Disposition'][_0xa899('0x47')](_0x11a908)[_0xa899('0x21')](handleEntityNotFound(_0x4ac389,null))[_0xa899('0x21')](respondWithResult(_0x4ac389,null))['catch'](handleError(_0x4ac389,null));};exports[_0xa899('0x48')]=function(_0x1d5009,_0x525177){return db[_0xa899('0x29')][_0xa899('0x48')](_0x1d5009[_0xa899('0x49')],{})[_0xa899('0x21')](function(_0x1528c2){var _0x3a1086=_0x1d5009[_0xa899('0x4a')][_0xa899('0x23')]({'plain':!![]});if(!_0x3a1086)throw new Error(_0xa899('0x4b'));if(_0x3a1086[_0xa899('0x4c')]===_0xa899('0x4a')){var _0x5a82fa=_0x1528c2['get']({'plain':!![]});var _0x2a37f6=_0xa899('0x4d');return db[_0xa899('0x4e')]['find']({'where':{'name':_0x2a37f6,'userProfileId':_0x3a1086[_0xa899('0x4f')]},'raw':!![]})['then'](function(_0x574e73){if(_0x574e73&&_0x574e73[_0xa899('0x50')]===0x0){return db[_0xa899('0x51')][_0xa899('0x48')]({'name':_0x5a82fa[_0xa899('0x26')],'resourceId':_0x5a82fa['id'],'type':_0x574e73[_0xa899('0x26')],'sectionId':_0x574e73['id']},{})[_0xa899('0x21')](function(){return _0x1528c2;});}else{return _0x1528c2;}})[_0xa899('0x42')](function(_0x19b6ef){logger[_0xa899('0x52')](_0xa899('0x53'),_0x19b6ef);throw _0x19b6ef;});}return _0x1528c2;})[_0xa899('0x21')](respondWithResult(_0x525177,0xc9))[_0xa899('0x42')](handleError(_0x525177,null));};exports[_0xa899('0x20')]=function(_0x5bda34,_0x2ad057){if(_0x5bda34[_0xa899('0x49')]['id']){delete _0x5bda34['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x5bda34[_0xa899('0x44')]['id']}})[_0xa899('0x21')](handleEntityNotFound(_0x2ad057,null))['then'](saveUpdates(_0x5bda34[_0xa899('0x49')],null))[_0xa899('0x21')](respondWithResult(_0x2ad057,null))[_0xa899('0x42')](handleError(_0x2ad057,null));};exports[_0xa899('0x22')]=function(_0xd2f3e5,_0x30de31){return db[_0xa899('0x29')][_0xa899('0x47')]({'where':{'id':_0xd2f3e5['params']['id']}})[_0xa899('0x21')](handleEntityNotFound(_0x30de31,null))[_0xa899('0x21')](removeEntity(_0x30de31,null))[_0xa899('0x42')](handleError(_0x30de31,null));}; \ No newline at end of file +var _0x2839=['UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions'];(function(_0x4603fe,_0x45efa6){var _0x5d4372=function(_0xf2979){while(--_0xf2979){_0x4603fe['push'](_0x4603fe['shift']());}};_0x5d4372(++_0x45efa6);}(_0x2839,0x141));var _0x9283=function(_0x39616c,_0x4ba20c){_0x39616c=_0x39616c-0x0;var _0x40feb2=_0x2839[_0x39616c];return _0x40feb2;};'use strict';var pdf=require(_0x9283('0x0'));var emlformat=require(_0x9283('0x1'));var rimraf=require(_0x9283('0x2'));var zipdir=require(_0x9283('0x3'));var jsonpatch=require(_0x9283('0x4'));var rp=require('request-promise');var moment=require(_0x9283('0x5'));var BPromise=require(_0x9283('0x6'));var Mustache=require('mustache');var util=require(_0x9283('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9283('0x8'));var fs=require('fs');var _=require(_0x9283('0x9'));var squel=require(_0x9283('0xa'));var crypto=require(_0x9283('0xb'));var jsforce=require(_0x9283('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9283('0xd'));var querystring=require(_0x9283('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9283('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9283('0x10'));var hardwareService=require(_0x9283('0x11'));var logger=require('../../config/logger')(_0x9283('0x12'));var utils=require(_0x9283('0x13'));var config=require(_0x9283('0x14'));var db=require(_0x9283('0x15'))['db'];function respondWithStatusCode(_0x383f4b,_0x3f5184){_0x3f5184=_0x3f5184||0xcc;return function(_0x1184b9){if(_0x1184b9){return _0x383f4b[_0x9283('0x16')](_0x3f5184);}return _0x383f4b[_0x9283('0x17')](_0x3f5184)[_0x9283('0x18')]();};}function respondWithResult(_0x5804ab,_0x3822aa){_0x3822aa=_0x3822aa||0xc8;return function(_0xa51df1){if(_0xa51df1){return _0x5804ab['status'](_0x3822aa)[_0x9283('0x19')](_0xa51df1);}};}function respondWithFilteredResult(_0x7e99ad,_0x1e14a3){return function(_0x4e01ae){if(_0x4e01ae){var _0x4595b4=_0x4e01ae[_0x9283('0x1a')],_0x56d636=_0x1e14a3[_0x9283('0x1b')],_0x1b07d8=_0x1e14a3[_0x9283('0x1b')]+_0x1e14a3['limit'],_0x17d056;if(_0x1b07d8>=_0x4595b4){_0x1b07d8=_0x4595b4;_0x17d056=0xc8;}else{_0x17d056=0xce;}_0x7e99ad[_0x9283('0x17')](_0x17d056);return _0x7e99ad['set'](_0x9283('0x1c'),_0x56d636+'-'+_0x1b07d8+'/'+_0x4595b4)[_0x9283('0x19')](_0x4e01ae);}return null;};}function patchUpdates(_0x5357da){return function(_0x11faaf){try{jsonpatch[_0x9283('0x1d')](_0x11faaf,_0x5357da,!![]);}catch(_0x91ba17){return BPromise[_0x9283('0x1e')](_0x91ba17);}return _0x11faaf['save']();};}function saveUpdates(_0x3d067c,_0x263af1){return function(_0x4fc8f3){if(_0x4fc8f3){return _0x4fc8f3[_0x9283('0x1f')](_0x3d067c)[_0x9283('0x20')](function(_0x2dfed3){return _0x2dfed3;});}return null;};}function removeEntity(_0x45b810,_0x406f0b){return function(_0x391f00){if(_0x391f00){return _0x391f00['destroy']()[_0x9283('0x20')](function(){var _0x3a5df4=_0x391f00['get']({'plain':!![]});var _0x307f02='Dispositions';return db[_0x9283('0x21')][_0x9283('0x22')]({'where':{'type':_0x307f02,'resourceId':_0x3a5df4['id']}})[_0x9283('0x20')](function(){return _0x391f00;});})[_0x9283('0x20')](function(){_0x45b810[_0x9283('0x17')](0xcc)[_0x9283('0x18')]();});}};}function handleEntityNotFound(_0x54989d,_0x492f68){return function(_0x4ae6d6){if(!_0x4ae6d6){_0x54989d[_0x9283('0x16')](0x194);}return _0x4ae6d6;};}function handleError(_0x1c34dd,_0xf1bb06){_0xf1bb06=_0xf1bb06||0x1f4;return function(_0x1fee5e){logger[_0x9283('0x23')](_0x1fee5e[_0x9283('0x24')]);if(_0x1fee5e[_0x9283('0x25')]){delete _0x1fee5e[_0x9283('0x25')];}_0x1c34dd[_0x9283('0x17')](_0xf1bb06)[_0x9283('0x26')](_0x1fee5e);};}exports[_0x9283('0x27')]=function(_0x5012c4,_0x5997c4){var _0x2b2a5c={},_0x5bf99f={},_0x40f4c7={'count':0x0,'rows':[]};var _0x3031e5=_[_0x9283('0x28')](db[_0x9283('0x29')][_0x9283('0x2a')],function(_0x52ab5f){return{'name':_0x52ab5f[_0x9283('0x2b')],'type':_0x52ab5f['type'][_0x9283('0x2c')]};});_0x5bf99f[_0x9283('0x2d')]=_[_0x9283('0x28')](_0x3031e5,_0x9283('0x25'));_0x5bf99f[_0x9283('0x2e')]=_[_0x9283('0x2f')](_0x5012c4[_0x9283('0x2e')]);_0x5bf99f[_0x9283('0x30')]=_[_0x9283('0x31')](_0x5bf99f[_0x9283('0x2d')],_0x5bf99f[_0x9283('0x2e')]);_0x2b2a5c[_0x9283('0x32')]=_['intersection'](_0x5bf99f['model'],qs[_0x9283('0x33')](_0x5012c4[_0x9283('0x2e')][_0x9283('0x33')]));_0x2b2a5c['attributes']=_0x2b2a5c[_0x9283('0x32')]['length']?_0x2b2a5c[_0x9283('0x32')]:_0x5bf99f[_0x9283('0x2d')];if(!_0x5012c4['query'][_0x9283('0x34')](_0x9283('0x35'))){_0x2b2a5c['limit']=qs[_0x9283('0x36')](_0x5012c4[_0x9283('0x2e')][_0x9283('0x36')]);_0x2b2a5c[_0x9283('0x1b')]=qs['offset'](_0x5012c4[_0x9283('0x2e')][_0x9283('0x1b')]);}_0x2b2a5c[_0x9283('0x37')]=qs[_0x9283('0x38')](_0x5012c4[_0x9283('0x2e')][_0x9283('0x38')]);_0x2b2a5c[_0x9283('0x39')]=qs[_0x9283('0x30')](_['pick'](_0x5012c4[_0x9283('0x2e')],_0x5bf99f['filters']),_0x3031e5);if(_0x5012c4[_0x9283('0x2e')][_0x9283('0x3a')]){_0x2b2a5c[_0x9283('0x39')]=_['merge'](_0x2b2a5c[_0x9283('0x39')],{'$or':_[_0x9283('0x28')](_0x3031e5,function(_0x4742df){if(_0x4742df[_0x9283('0x3b')]!==_0x9283('0x3c')){var _0x2251cc={};_0x2251cc[_0x4742df[_0x9283('0x25')]]={'$like':'%'+_0x5012c4[_0x9283('0x2e')][_0x9283('0x3a')]+'%'};return _0x2251cc;}})});}_0x2b2a5c=_[_0x9283('0x3d')]({},_0x2b2a5c,_0x5012c4[_0x9283('0x3e')]);var _0x56eb07={'where':_0x2b2a5c['where']};return db[_0x9283('0x29')]['count'](_0x56eb07)[_0x9283('0x20')](function(_0x1428d5){_0x40f4c7[_0x9283('0x1a')]=_0x1428d5;if(_0x5012c4['query'][_0x9283('0x3f')]){_0x2b2a5c[_0x9283('0x40')]=[{'all':!![]}];}return db[_0x9283('0x29')][_0x9283('0x41')](_0x2b2a5c);})[_0x9283('0x20')](function(_0x7fdf5d){_0x40f4c7['rows']=_0x7fdf5d;return _0x40f4c7;})[_0x9283('0x20')](respondWithFilteredResult(_0x5997c4,_0x2b2a5c))['catch'](handleError(_0x5997c4,null));};exports['show']=function(_0x4f33e4,_0x2548e8){var _0x57131a={'raw':!![],'where':{'id':_0x4f33e4['params']['id']}},_0x501139={};_0x501139[_0x9283('0x2d')]=_[_0x9283('0x2f')](db[_0x9283('0x29')][_0x9283('0x2a')]);_0x501139[_0x9283('0x2e')]=_[_0x9283('0x2f')](_0x4f33e4[_0x9283('0x2e')]);_0x501139[_0x9283('0x30')]=_[_0x9283('0x31')](_0x501139['model'],_0x501139['query']);_0x57131a[_0x9283('0x32')]=_[_0x9283('0x31')](_0x501139[_0x9283('0x2d')],qs[_0x9283('0x33')](_0x4f33e4[_0x9283('0x2e')]['fields']));_0x57131a[_0x9283('0x32')]=_0x57131a[_0x9283('0x32')][_0x9283('0x42')]?_0x57131a[_0x9283('0x32')]:_0x501139['model'];if(_0x4f33e4[_0x9283('0x2e')][_0x9283('0x3f')]){_0x57131a[_0x9283('0x40')]=[{'all':!![]}];}_0x57131a=_['merge']({},_0x57131a,_0x4f33e4['options']);return db[_0x9283('0x29')]['find'](_0x57131a)[_0x9283('0x20')](handleEntityNotFound(_0x2548e8,null))['then'](respondWithResult(_0x2548e8,null))[_0x9283('0x43')](handleError(_0x2548e8,null));};exports['create']=function(_0x530b09,_0x149063){return db[_0x9283('0x29')][_0x9283('0x44')](_0x530b09[_0x9283('0x45')],{})[_0x9283('0x20')](function(_0x309841){var _0x1b5774=_0x530b09[_0x9283('0x46')][_0x9283('0x47')]({'plain':!![]});if(!_0x1b5774)throw new Error(_0x9283('0x48'));if(_0x1b5774['role']===_0x9283('0x46')){var _0x470628=_0x309841['get']({'plain':!![]});var _0x265abb=_0x9283('0x49');return db[_0x9283('0x4a')][_0x9283('0x4b')]({'where':{'name':_0x265abb,'userProfileId':_0x1b5774[_0x9283('0x4c')]},'raw':!![]})['then'](function(_0x305a56){if(_0x305a56&&_0x305a56['autoAssociation']===0x0){return db[_0x9283('0x21')][_0x9283('0x44')]({'name':_0x470628['name'],'resourceId':_0x470628['id'],'type':_0x305a56['name'],'sectionId':_0x305a56['id']},{})[_0x9283('0x20')](function(){return _0x309841;});}else{return _0x309841;}})[_0x9283('0x43')](function(_0x56419f){logger[_0x9283('0x23')](_0x9283('0x4d'),_0x56419f);throw _0x56419f;});}return _0x309841;})[_0x9283('0x20')](respondWithResult(_0x149063,0xc9))[_0x9283('0x43')](handleError(_0x149063,null));};exports['update']=function(_0x4a5440,_0x40a28f){if(_0x4a5440['body']['id']){delete _0x4a5440['body']['id'];}return db['Disposition'][_0x9283('0x4b')]({'where':{'id':_0x4a5440[_0x9283('0x4e')]['id']}})['then'](handleEntityNotFound(_0x40a28f,null))[_0x9283('0x20')](saveUpdates(_0x4a5440[_0x9283('0x45')],null))[_0x9283('0x20')](respondWithResult(_0x40a28f,null))[_0x9283('0x43')](handleError(_0x40a28f,null));};exports[_0x9283('0x22')]=function(_0x26cb78,_0x4e409f){return db['Disposition'][_0x9283('0x4b')]({'where':{'id':_0x26cb78[_0x9283('0x4e')]['id']}})[_0x9283('0x20')](handleEntityNotFound(_0x4e409f,null))[_0x9283('0x20')](removeEntity(_0x4e409f,null))[_0x9283('0x43')](handleError(_0x4e409f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c247950..f6eef02 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 _0x960c=['rimraf','../../config/environment','define','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x353cd0,_0x568795){var _0x290fb6=function(_0x44eb7a){while(--_0x44eb7a){_0x353cd0['push'](_0x353cd0['shift']());}};_0x290fb6(++_0x568795);}(_0x960c,0x113));var _0xc960=function(_0x57270e,_0x1e16f6){_0x57270e=_0x57270e-0x0;var _0x9603b=_0x960c[_0x57270e];return _0x9603b;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var logger=require(_0xc960('0x1'))('api');var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rp=require(_0xc960('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x2bb9df,_0x2beb88){return _0x2bb9df[_0xc960('0x7')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xc960('0x8'),'fields':[_0xc960('0x9'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xc960('0x9'),_0xc960('0xa')]},{'unique':!![],'name':_0xc960('0xb'),'fields':[_0xc960('0x9'),_0xc960('0xc')]},{'unique':!![],'name':'name_sms','fields':[_0xc960('0x9'),_0xc960('0xd')]},{'unique':!![],'name':_0xc960('0xe'),'fields':[_0xc960('0x9'),_0xc960('0xf')]},{'unique':!![],'name':_0xc960('0x10'),'fields':[_0xc960('0x9'),_0xc960('0x11')]},{'unique':!![],'name':_0xc960('0x12'),'fields':[_0xc960('0x9'),_0xc960('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9120=['name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId'];(function(_0x5885a5,_0x2d6453){var _0x588eea=function(_0x2eae13){while(--_0x2eae13){_0x5885a5['push'](_0x5885a5['shift']());}};_0x588eea(++_0x2d6453);}(_0x9120,0x1b3));var _0x0912=function(_0x71d04f,_0x251be0){_0x71d04f=_0x71d04f-0x0;var _0x481507=_0x9120[_0x71d04f];return _0x481507;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var logger=require(_0x0912('0x2'))(_0x0912('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0912('0x4'));var fs=require('fs');var path=require(_0x0912('0x5'));var rimraf=require(_0x0912('0x6'));var config=require(_0x0912('0x7'));var attributes=require(_0x0912('0x8'));module[_0x0912('0x9')]=function(_0x4e7ddb,_0x42cb02){return _0x4e7ddb[_0x0912('0xa')](_0x0912('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x0912('0xc'),'fields':[_0x0912('0xd'),_0x0912('0xe')]},{'unique':!![],'name':_0x0912('0xf'),'fields':[_0x0912('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x0912('0x10'),'fields':[_0x0912('0xd'),_0x0912('0x11')]},{'unique':!![],'name':_0x0912('0x12'),'fields':['name',_0x0912('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0x0912('0xd'),_0x0912('0x14')]},{'unique':!![],'name':_0x0912('0x15'),'fields':[_0x0912('0xd'),_0x0912('0x16')]},{'unique':!![],'name':_0x0912('0x17'),'fields':[_0x0912('0xd'),_0x0912('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 49a230f..bbd423c 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 _0x0491=['jayson/promise','client','http','info','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s','message','request\x20sent','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d1cb6,_0x470d90){var _0x163dff=function(_0x513077){while(--_0x513077){_0x3d1cb6['push'](_0x3d1cb6['shift']());}};_0x163dff(++_0x470d90);}(_0x0491,0x171));var _0x1049=function(_0x1e44a5,_0x35a714){_0x1e44a5=_0x1e44a5-0x0;var _0x54a65e=_0x0491[_0x1e44a5];return _0x54a65e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1049('0x0'));var BPromise=require(_0x1049('0x1'));var rs=require(_0x1049('0x2'));var fs=require('fs');var Redis=require(_0x1049('0x3'));var db=require(_0x1049('0x4'))['db'];var utils=require(_0x1049('0x5'));var logger=require(_0x1049('0x6'))(_0x1049('0x7'));var config=require(_0x1049('0x8'));var jayson=require(_0x1049('0x9'));var client=jayson[_0x1049('0xa')][_0x1049('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47f9e9,_0x24c6fe,_0x2f1962){return new BPromise(function(_0x2e21b4,_0x5c74f1){return client['request'](_0x47f9e9,_0x2f1962)['then'](function(_0x522566){logger[_0x1049('0xc')]('Disposition,\x20%s,\x20%s',_0x24c6fe,'request\x20sent');logger['debug'](_0x1049('0xd'),_0x24c6fe,'request\x20sent',JSON[_0x1049('0xe')](_0x522566));if(_0x522566[_0x1049('0xf')]){if(_0x522566[_0x1049('0xf')][_0x1049('0x10')]===0x1f4){logger[_0x1049('0xf')](_0x1049('0x11'),_0x24c6fe,_0x522566[_0x1049('0xf')][_0x1049('0x12')]);return _0x5c74f1(_0x522566[_0x1049('0xf')]['message']);}logger['error'](_0x1049('0x11'),_0x24c6fe,_0x522566[_0x1049('0xf')]['message']);return _0x2e21b4(_0x522566['error'][_0x1049('0x12')]);}else{logger['info'](_0x1049('0x11'),_0x24c6fe,_0x1049('0x13'));_0x2e21b4(_0x522566['result'][_0x1049('0x12')]);}})[_0x1049('0x14')](function(_0x6041d3){logger[_0x1049('0xf')]('Disposition,\x20%s,\x20%s',_0x24c6fe,_0x6041d3);_0x5c74f1(_0x6041d3);});});} \ No newline at end of file +var _0x0544=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0544,0x1bb));var _0x4054=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x0544[_0x1d2bc8];return _0x1857e1;};'use strict';var _=require(_0x4054('0x0'));var util=require('util');var moment=require(_0x4054('0x1'));var BPromise=require(_0x4054('0x2'));var rs=require(_0x4054('0x3'));var fs=require('fs');var Redis=require(_0x4054('0x4'));var db=require(_0x4054('0x5'))['db'];var utils=require(_0x4054('0x6'));var logger=require(_0x4054('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4054('0x8'));var client=jayson['client'][_0x4054('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3108a1,_0x223663,_0x5e315e){return new BPromise(function(_0x2c317c,_0x28a393){return client[_0x4054('0xa')](_0x3108a1,_0x5e315e)[_0x4054('0xb')](function(_0x809d2d){logger['info'](_0x4054('0xc'),_0x223663,_0x4054('0xd'));logger['debug'](_0x4054('0xe'),_0x223663,_0x4054('0xd'),JSON['stringify'](_0x809d2d));if(_0x809d2d[_0x4054('0xf')]){if(_0x809d2d['error'][_0x4054('0x10')]===0x1f4){logger[_0x4054('0xf')](_0x4054('0xc'),_0x223663,_0x809d2d['error'][_0x4054('0x11')]);return _0x28a393(_0x809d2d[_0x4054('0xf')]['message']);}logger['error'](_0x4054('0xc'),_0x223663,_0x809d2d[_0x4054('0xf')][_0x4054('0x11')]);return _0x2c317c(_0x809d2d[_0x4054('0xf')][_0x4054('0x11')]);}else{logger[_0x4054('0x12')](_0x4054('0xc'),_0x223663,_0x4054('0xd'));_0x2c317c(_0x809d2d[_0x4054('0x13')]['message']);}})[_0x4054('0x14')](function(_0x3f361d){logger[_0x4054('0xf')]('Disposition,\x20%s,\x20%s',_0x223663,_0x3f361d);_0x28a393(_0x3f361d);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 50f31e5..2589be7 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 _0xbecf=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','create','put','destroy','exports','path','connect-timeout','express','Router'];(function(_0x3e305c,_0x2370d8){var _0x48f98a=function(_0x4bf08d){while(--_0x4bf08d){_0x3e305c['push'](_0x3e305c['shift']());}};_0x48f98a(++_0x2370d8);}(_0xbecf,0x15c));var _0xfbec=function(_0x1b8dd8,_0x6eb59f){_0x1b8dd8=_0x1b8dd8-0x0;var _0x43ed5c=_0xbecf[_0x1b8dd8];return _0x43ed5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfbec('0x0'));var timeout=require(_0xfbec('0x1'));var express=require(_0xfbec('0x2'));var router=express[_0xfbec('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfbec('0x4'));var config=require(_0xfbec('0x5'));var controller=require(_0xfbec('0x6'));router[_0xfbec('0x7')]('/',auth[_0xfbec('0x8')](),controller['index']);router[_0xfbec('0x7')](_0xfbec('0x9'),auth[_0xfbec('0x8')](),controller[_0xfbec('0xa')]);router[_0xfbec('0xb')]('/',auth[_0xfbec('0x8')](),controller[_0xfbec('0xc')]);router[_0xfbec('0xd')](_0xfbec('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfbec('0x9'),auth[_0xfbec('0x8')](),controller[_0xfbec('0xe')]);module[_0xfbec('0xf')]=router; \ No newline at end of file +var _0x2c16=['../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x269067,_0x297c49){var _0x294262=function(_0x3f1d09){while(--_0x3f1d09){_0x269067['push'](_0x269067['shift']());}};_0x294262(++_0x297c49);}(_0x2c16,0xf0));var _0x62c1=function(_0x111f0a,_0x34ce57){_0x111f0a=_0x111f0a-0x0;var _0x177d29=_0x2c16[_0x111f0a];return _0x177d29;};'use strict';var multer=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var path=require(_0x62c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x62c1('0x3'));var router=express[_0x62c1('0x4')]();var auth=require(_0x62c1('0x5'));var interaction=require(_0x62c1('0x6'));var config=require(_0x62c1('0x7'));var controller=require(_0x62c1('0x8'));router[_0x62c1('0x9')]('/',auth[_0x62c1('0xa')](),controller[_0x62c1('0xb')]);router[_0x62c1('0x9')]('/:id',auth[_0x62c1('0xa')](),controller[_0x62c1('0xc')]);router[_0x62c1('0xd')]('/',auth['isAuthenticated'](),controller[_0x62c1('0xe')]);router['put'](_0x62c1('0xf'),auth[_0x62c1('0xa')](),controller['update']);router[_0x62c1('0x10')]('/:id',auth[_0x62c1('0xa')](),controller[_0x62c1('0x11')]);module[_0x62c1('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f9c4f46..7bd33a4 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 _0x6ad6=['localstationid','4800','9600','12000','2400','7200','14400','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x31fddc,_0x405f87){var _0x370d1f=function(_0x342f1d){while(--_0x342f1d){_0x31fddc['push'](_0x31fddc['shift']());}};_0x370d1f(++_0x405f87);}(_0x6ad6,0xc3));var _0x66ad=function(_0x562dcc,_0x51a78e){_0x562dcc=_0x562dcc-0x0;var _0x2a9c03=_0x6ad6[_0x562dcc];return _0x2a9c03;};'use strict';var Sequelize=require('sequelize');module[_0x66ad('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x66ad('0x1')]},'ecm':{'type':Sequelize[_0x66ad('0x2')](_0x66ad('0x3'),'no'),'defaultValue':_0x66ad('0x3')},'headerinfo':{'type':Sequelize[_0x66ad('0x1')],'defaultValue':_0x66ad('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x66ad('0x5')},'minrate':{'type':Sequelize['ENUM']('2400',_0x66ad('0x6'),'7200',_0x66ad('0x7'),_0x66ad('0x8'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x66ad('0x9'),'4800',_0x66ad('0xa'),_0x66ad('0x7'),_0x66ad('0x8'),_0x66ad('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x66ad('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x66ad('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x66ad('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x66ad('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x66ad('0x2')](_0x66ad('0xd'),_0x66ad('0xe'),_0x66ad('0xf'),_0x66ad('0x10')),'defaultValue':_0x66ad('0xd')},'key':{'type':Sequelize[_0x66ad('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x66ad('0x11')],'defaultValue':function(){return _0x66ad('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x66ad('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66ad('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[_0x66ad('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x66ad('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x66ad('0x15'),'set':function(_0xdc93c3){if(!_0xdc93c3)this[_0x66ad('0x16')](_0x66ad('0x17'),null);this[_0x66ad('0x16')](_0x66ad('0x18'),_0xdc93c3);}}}; \ No newline at end of file +var _0x0f93=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','7200','9600','14400','2400','4800','12000','v17,v27,v29','INTEGER','IAX','DADHI','SIP','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f93,0x148));var _0x30f9=function(_0x210999,_0x510ca5){_0x210999=_0x210999-0x0;var _0x3a38b6=_0x0f93[_0x210999];return _0x3a38b6;};'use strict';var Sequelize=require(_0x30f9('0x0'));module[_0x30f9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x30f9('0x2')]},'ecm':{'type':Sequelize[_0x30f9('0x3')](_0x30f9('0x4'),'no'),'defaultValue':_0x30f9('0x4')},'headerinfo':{'type':Sequelize[_0x30f9('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x30f9('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x30f9('0x3')]('2400','4800',_0x30f9('0x5'),_0x30f9('0x6'),'12000',_0x30f9('0x7')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x30f9('0x8'),_0x30f9('0x9'),_0x30f9('0x5'),'9600',_0x30f9('0xa'),_0x30f9('0x7')),'defaultValue':_0x30f9('0x7')},'modem':{'type':Sequelize[_0x30f9('0x2')],'defaultValue':_0x30f9('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x30f9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x30f9('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x30f9('0x3')]('SIP',_0x30f9('0xd'),_0x30f9('0xe'),'KHOMP'),'defaultValue':_0x30f9('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x30f9('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x30f9('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x30f9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x30f9('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x30f9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x30f9('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x30f9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x30f9('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x30f9('0x13'),'set':function(_0x24a92a){if(!_0x24a92a)this[_0x30f9('0x14')](_0x30f9('0x15'),null);this['setDataValue'](_0x30f9('0x16'),_0x24a92a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3bec660..61a77ee 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 _0x6736=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','end','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','find','describe','FaxAccountId','getDispositions','findOne','Disposition','options','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','exten','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError'];(function(_0x21105f,_0xcc37ec){var _0xa692f6=function(_0x6712a0){while(--_0x6712a0){_0x21105f['push'](_0x21105f['shift']());}};_0xa692f6(++_0xcc37ec);}(_0x6736,0xa0));var _0x6673=function(_0x543375,_0x147f3a){_0x543375=_0x543375-0x0;var _0x4c2173=_0x6736[_0x543375];return _0x4c2173;};'use strict';var pdf=require(_0x6673('0x0'));var emlformat=require(_0x6673('0x1'));var rimraf=require(_0x6673('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6673('0x3'));var rp=require(_0x6673('0x4'));var moment=require(_0x6673('0x5'));var BPromise=require(_0x6673('0x6'));var Mustache=require(_0x6673('0x7'));var util=require(_0x6673('0x8'));var path=require('path');var sox=require(_0x6673('0x9'));var csv=require(_0x6673('0xa'));var ejs=require(_0x6673('0xb'));var fs=require('fs');var _=require(_0x6673('0xc'));var squel=require(_0x6673('0xd'));var crypto=require(_0x6673('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6673('0xf'));var Papa=require(_0x6673('0x10'));var Redis=require(_0x6673('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6673('0x12'));var hardwareService=require(_0x6673('0x13'));var logger=require(_0x6673('0x14'))(_0x6673('0x15'));var utils=require(_0x6673('0x16'));var config=require(_0x6673('0x17'));var db=require(_0x6673('0x18'))['db'];config[_0x6673('0x19')]=_[_0x6673('0x1a')](config[_0x6673('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6673('0x1b'))(new Redis(config[_0x6673('0x19')]));require(_0x6673('0x1c'))[_0x6673('0x1d')](socket);var jayson=require(_0x6673('0x1e'));var client=jayson[_0x6673('0x1f')][_0x6673('0x20')]({'port':0x232c});var client9002=jayson[_0x6673('0x1f')][_0x6673('0x20')]({'port':0x232a});function checkPasswordPattern(_0x27d6dc,_0x1f26c8,_0x2a05cd){if(_0x2a05cd){var _0x390980=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x390980[_0x6673('0x21')](_0x1f26c8)){return _0x27d6dc;}else{throw new db[(_0x6673('0x22'))][(_0x6673('0x23'))](_0x6673('0x24'));}}else{return _0x27d6dc;}}function respondWithRpcPromise(_0x3976c2,_0x364705,_0x2039b9,_0x2b3ee5){return new BPromise(function(_0x5f31ac,_0x517a6e){var _0x622fc5=_0x2b3ee5||client;return _0x622fc5[_0x6673('0x25')](_0x3976c2,_0x2039b9)['then'](function(_0x28370a){logger[_0x6673('0x26')](_0x6673('0x27'),_0x364705,'request\x20sent');logger[_0x6673('0x28')](_0x6673('0x29'),_0x364705,'request\x20sent',JSON[_0x6673('0x2a')](_0x28370a));if(_0x28370a[_0x6673('0x2b')]){if(_0x28370a[_0x6673('0x2b')]['code']===0x1f4){logger[_0x6673('0x2b')](_0x6673('0x27'),_0x364705,_0x28370a[_0x6673('0x2b')][_0x6673('0x2c')]);return _0x517a6e(_0x28370a[_0x6673('0x2b')]['message']);}logger[_0x6673('0x2b')](_0x6673('0x27'),_0x364705,_0x28370a[_0x6673('0x2b')][_0x6673('0x2c')]);return _0x5f31ac(_0x28370a['error'][_0x6673('0x2c')]);}else{logger[_0x6673('0x26')](_0x6673('0x27'),_0x364705,'request\x20sent');_0x5f31ac(_0x28370a['result']['message']);}})[_0x6673('0x2d')](function(_0x2d36d6){logger['error'](_0x6673('0x27'),_0x364705,_0x2d36d6);_0x517a6e(_0x2d36d6);});});}function respondWithStatusCode(_0x35dedd,_0x34373b){_0x34373b=_0x34373b||0xcc;return function(_0x1ca5f5){if(_0x1ca5f5){return _0x35dedd[_0x6673('0x2e')](_0x34373b);}return _0x35dedd[_0x6673('0x2f')](_0x34373b)['end']();};}function respondWithResult(_0x53ac40,_0x4ef691){_0x4ef691=_0x4ef691||0xc8;return function(_0x2f13a6){if(_0x2f13a6){return _0x53ac40['status'](_0x4ef691)[_0x6673('0x30')](_0x2f13a6);}};}function respondWithFilteredResult(_0x1b6a47,_0x48d456){return function(_0x42197d){if(_0x42197d){var _0x5ed3f8=_0x42197d[_0x6673('0x31')],_0x821b5b=_0x48d456[_0x6673('0x32')],_0x27a5bc=_0x48d456['offset']+_0x48d456['limit'],_0x4c597a;if(_0x27a5bc>=_0x5ed3f8){_0x27a5bc=_0x5ed3f8;_0x4c597a=0xc8;}else{_0x4c597a=0xce;}_0x1b6a47['status'](_0x4c597a);return _0x1b6a47[_0x6673('0x33')](_0x6673('0x34'),_0x821b5b+'-'+_0x27a5bc+'/'+_0x5ed3f8)[_0x6673('0x30')](_0x42197d);}return null;};}function patchUpdates(_0x579e2d){return function(_0x2b304d){try{jsonpatch['apply'](_0x2b304d,_0x579e2d,!![]);}catch(_0x15d9a5){return BPromise[_0x6673('0x35')](_0x15d9a5);}return _0x2b304d['save']();};}function saveUpdates(_0x327d84,_0x3ec3e6){return function(_0x1097c1){if(_0x1097c1){return _0x1097c1[_0x6673('0x36')](_0x327d84)[_0x6673('0x37')](function(_0x43d85c){return _0x43d85c;});}return null;};}function removeEntity(_0x4fcddb,_0x557400){return function(_0x28bfcf){if(_0x28bfcf){return _0x28bfcf['destroy']()[_0x6673('0x37')](function(){var _0x3ffd92=_0x28bfcf[_0x6673('0x38')]({'plain':!![]});var _0x1b6ab8='FaxAccounts';return db[_0x6673('0x39')][_0x6673('0x3a')]({'where':{'type':_0x1b6ab8,'resourceId':_0x3ffd92['id']}})[_0x6673('0x37')](function(){return _0x28bfcf;});})[_0x6673('0x37')](function(){_0x4fcddb[_0x6673('0x2f')](0xcc)[_0x6673('0x3b')]();});}};}function handleEntityNotFound(_0x1e5e8c,_0x33636a){return function(_0xc5eec){if(!_0xc5eec){_0x1e5e8c[_0x6673('0x2e')](0x194);}return _0xc5eec;};}function handleError(_0x933a2b,_0x749121){_0x749121=_0x749121||0x1f4;return function(_0x5b7d65){logger[_0x6673('0x2b')](_0x5b7d65[_0x6673('0x3c')]);if(_0x5b7d65[_0x6673('0x3d')]){delete _0x5b7d65[_0x6673('0x3d')];}_0x933a2b[_0x6673('0x2f')](_0x749121)['send'](_0x5b7d65);};}exports['index']=function(_0x362880,_0x4c90ae){var _0x609f47={'include':[{'model':db[_0x6673('0x3e')],'as':_0x6673('0x3f')}]},_0x55dde2={},_0x4ab558={'count':0x0,'rows':[]};var _0x774d75=_[_0x6673('0x40')](db[_0x6673('0x41')][_0x6673('0x42')],function(_0x1352f1){return{'name':_0x1352f1[_0x6673('0x43')],'type':_0x1352f1[_0x6673('0x44')][_0x6673('0x45')]};});_0x55dde2[_0x6673('0x46')]=_[_0x6673('0x40')](_0x774d75,_0x6673('0x3d'));_0x55dde2[_0x6673('0x47')]=_[_0x6673('0x48')](_0x362880[_0x6673('0x47')]);_0x55dde2[_0x6673('0x49')]=_['intersection'](_0x55dde2[_0x6673('0x46')],_0x55dde2[_0x6673('0x47')]);_0x609f47[_0x6673('0x4a')]=_[_0x6673('0x4b')](_0x55dde2['model'],qs['fields'](_0x362880['query'][_0x6673('0x4c')]));_0x609f47['attributes']=_0x609f47[_0x6673('0x4a')][_0x6673('0x4d')]?_0x609f47['attributes']:_0x55dde2[_0x6673('0x46')];if(!_0x362880['query'][_0x6673('0x4e')](_0x6673('0x4f'))){_0x609f47[_0x6673('0x50')]=qs[_0x6673('0x50')](_0x362880[_0x6673('0x47')][_0x6673('0x50')]);_0x609f47['offset']=qs[_0x6673('0x32')](_0x362880[_0x6673('0x47')][_0x6673('0x32')]);}_0x609f47[_0x6673('0x51')]=qs[_0x6673('0x52')](_0x362880[_0x6673('0x47')]['sort']);_0x609f47[_0x6673('0x53')]=qs[_0x6673('0x49')](_[_0x6673('0x54')](_0x362880[_0x6673('0x47')],_0x55dde2[_0x6673('0x49')]),_0x774d75);if(_0x362880['query'][_0x6673('0x55')]){_0x609f47[_0x6673('0x53')]=_[_0x6673('0x56')](_0x609f47[_0x6673('0x53')],{'$or':_['map'](_0x774d75,function(_0x4f6a33){if(_0x4f6a33['type']!==_0x6673('0x57')){var _0x9862cc={};_0x9862cc[_0x4f6a33[_0x6673('0x3d')]]={'$like':'%'+_0x362880[_0x6673('0x47')][_0x6673('0x55')]+'%'};return _0x9862cc;}})});}_0x609f47=_[_0x6673('0x56')]({},_0x609f47,_0x362880['options']);var _0x3167b6={'where':_0x609f47[_0x6673('0x53')]};return db[_0x6673('0x41')][_0x6673('0x31')](_0x3167b6)[_0x6673('0x37')](function(_0xa39685){_0x4ab558[_0x6673('0x31')]=_0xa39685;if(_0x362880[_0x6673('0x47')]['includeAll']){_0x609f47['include']=[{'all':!![]}];}return db[_0x6673('0x41')][_0x6673('0x58')](_0x609f47);})['then'](function(_0x54f8e5){_0x4ab558[_0x6673('0x59')]=_0x54f8e5;return _0x4ab558;})[_0x6673('0x37')](respondWithFilteredResult(_0x4c90ae,_0x609f47))[_0x6673('0x2d')](handleError(_0x4c90ae,null));};exports['show']=function(_0x1db1e4,_0x3dd7f6){var _0x2a2043={'raw':![],'where':{'id':_0x1db1e4['params']['id']},'include':[{'model':db[_0x6673('0x3e')],'as':'mandatoryDispositionPause'}]},_0x42eaa9={};_0x42eaa9[_0x6673('0x46')]=_[_0x6673('0x48')](db[_0x6673('0x41')][_0x6673('0x42')]);_0x42eaa9[_0x6673('0x47')]=_[_0x6673('0x48')](_0x1db1e4['query']);_0x42eaa9[_0x6673('0x49')]=_[_0x6673('0x4b')](_0x42eaa9[_0x6673('0x46')],_0x42eaa9[_0x6673('0x47')]);_0x2a2043[_0x6673('0x4a')]=_[_0x6673('0x4b')](_0x42eaa9['model'],qs[_0x6673('0x4c')](_0x1db1e4['query'][_0x6673('0x4c')]));_0x2a2043[_0x6673('0x4a')]=_0x2a2043[_0x6673('0x4a')][_0x6673('0x4d')]?_0x2a2043[_0x6673('0x4a')]:_0x42eaa9[_0x6673('0x46')];if(_0x1db1e4[_0x6673('0x47')]['includeAll']){_0x2a2043[_0x6673('0x5a')]=[{'all':!![]}];}_0x2a2043=_['merge']({},_0x2a2043,_0x1db1e4['options']);return db[_0x6673('0x41')]['find'](_0x2a2043)[_0x6673('0x37')](handleEntityNotFound(_0x3dd7f6,null))[_0x6673('0x37')](respondWithResult(_0x3dd7f6,null))[_0x6673('0x2d')](handleError(_0x3dd7f6,null));};exports[_0x6673('0x5b')]=function(_0x34c6b1,_0x2a92f5){return db[_0x6673('0x41')]['create'](_0x34c6b1['body'],{})[_0x6673('0x37')](function(_0x35fe96){var _0x5ebf79=_0x34c6b1[_0x6673('0x5c')]['get']({'plain':!![]});if(!_0x5ebf79)throw new Error(_0x6673('0x5d'));if(_0x5ebf79['role']===_0x6673('0x5c')){var _0x200deb=_0x35fe96[_0x6673('0x38')]({'plain':!![]});var _0x29173a='FaxAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x29173a,'userProfileId':_0x5ebf79['userProfileId']},'raw':!![]})[_0x6673('0x37')](function(_0x51f0a4){if(_0x51f0a4&&_0x51f0a4[_0x6673('0x5e')]===0x0){return db['UserProfileResource'][_0x6673('0x5b')]({'name':_0x200deb[_0x6673('0x3d')],'resourceId':_0x200deb['id'],'type':_0x51f0a4[_0x6673('0x3d')],'sectionId':_0x51f0a4['id']},{})['then'](function(){return _0x35fe96;});}else{return _0x35fe96;}})[_0x6673('0x2d')](function(_0x39df2b){logger[_0x6673('0x2b')](_0x6673('0x5f'),_0x39df2b);throw _0x39df2b;});}return _0x35fe96;})[_0x6673('0x37')](respondWithResult(_0x2a92f5,0xc9))[_0x6673('0x2d')](handleError(_0x2a92f5,null));};exports[_0x6673('0x36')]=function(_0x581e51,_0x11a49e){if(_0x581e51['body']['id']){delete _0x581e51['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x581e51[_0x6673('0x60')]['id']},'include':[{'model':db[_0x6673('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x6673('0x37')](handleEntityNotFound(_0x11a49e,null))[_0x6673('0x37')](saveUpdates(_0x581e51[_0x6673('0x61')],null))[_0x6673('0x37')](respondWithResult(_0x11a49e,null))[_0x6673('0x2d')](handleError(_0x11a49e,null));};exports[_0x6673('0x3a')]=function(_0x475acb,_0x31ec78){return db[_0x6673('0x41')][_0x6673('0x62')]({'where':{'id':_0x475acb[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x31ec78,null))[_0x6673('0x37')](removeEntity(_0x31ec78,null))[_0x6673('0x2d')](handleError(_0x31ec78,null));};exports['describe']=function(_0x1b26b9,_0x4cf187){return db[_0x6673('0x41')][_0x6673('0x63')]()[_0x6673('0x37')](respondWithResult(_0x4cf187,null))[_0x6673('0x2d')](handleError(_0x4cf187,null));};exports['addDisposition']=function(_0x1f8716,_0x48eba0,_0x24d61a){if(_0x1f8716[_0x6673('0x61')]['id']){delete _0x1f8716[_0x6673('0x61')]['id'];}return db[_0x6673('0x41')]['find']({'where':{'id':_0x1f8716[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x48eba0,null))[_0x6673('0x37')](function(_0x5d6114){if(_0x5d6114){_0x1f8716[_0x6673('0x61')][_0x6673('0x64')]=_0x5d6114['id'];return db['Disposition'][_0x6673('0x5b')](_0x1f8716[_0x6673('0x61')]);}})[_0x6673('0x37')](respondWithResult(_0x48eba0,null))[_0x6673('0x2d')](handleError(_0x48eba0,null));};exports[_0x6673('0x65')]=function(_0x2dbef1,_0x19a104,_0x27ee51){var _0x5ded97={'raw':![],'where':{}};var _0x44947={};var _0x4fe316={'count':0x0,'rows':[]};return db[_0x6673('0x41')][_0x6673('0x66')]({'where':{'id':_0x2dbef1[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x19a104,null))[_0x6673('0x37')](function(_0x5c84c3){if(_0x5c84c3){_0x44947['model']=_[_0x6673('0x48')](db[_0x6673('0x67')][_0x6673('0x42')]);_0x44947[_0x6673('0x47')]=_[_0x6673('0x48')](_0x2dbef1[_0x6673('0x47')]);_0x44947[_0x6673('0x49')]=_[_0x6673('0x4b')](_0x44947[_0x6673('0x46')],_0x44947[_0x6673('0x47')]);_0x5ded97[_0x6673('0x4a')]=_[_0x6673('0x4b')](_0x44947[_0x6673('0x46')],qs['fields'](_0x2dbef1['query'][_0x6673('0x4c')]));_0x5ded97['attributes']=_0x5ded97['attributes'][_0x6673('0x4d')]?_0x5ded97[_0x6673('0x4a')]:_0x44947['model'];if(!_0x2dbef1[_0x6673('0x47')][_0x6673('0x4e')](_0x6673('0x4f'))){_0x5ded97['limit']=qs[_0x6673('0x50')](_0x2dbef1[_0x6673('0x47')][_0x6673('0x50')]);_0x5ded97[_0x6673('0x32')]=qs[_0x6673('0x32')](_0x2dbef1[_0x6673('0x47')]['offset']);}_0x5ded97[_0x6673('0x51')]=qs[_0x6673('0x52')](_0x2dbef1['query']['sort']);_0x5ded97[_0x6673('0x53')]=qs['filters'](_[_0x6673('0x54')](_0x2dbef1[_0x6673('0x47')],_0x44947['filters']));_0x5ded97[_0x6673('0x53')]['FaxAccountId']=_0x5c84c3['id'];if(_0x2dbef1[_0x6673('0x47')]['filter']){_0x5ded97[_0x6673('0x53')]=_[_0x6673('0x56')](_0x5ded97[_0x6673('0x53')],{'$or':_[_0x6673('0x40')](_0x5ded97['attributes'],function(_0x1f25da){var _0x52c092={};_0x52c092[_0x1f25da]={'$like':'%'+_0x2dbef1[_0x6673('0x47')][_0x6673('0x55')]+'%'};return _0x52c092;})});}_0x5ded97=_[_0x6673('0x56')]({},_0x5ded97,_0x2dbef1[_0x6673('0x68')]);return db[_0x6673('0x67')]['count']({'where':_0x5ded97['where']})[_0x6673('0x37')](function(_0x17f171){_0x4fe316[_0x6673('0x31')]=_0x17f171;if(_0x2dbef1['query'][_0x6673('0x69')]){_0x5ded97['include']=[{'all':!![]}];}return db['Disposition'][_0x6673('0x58')](_0x5ded97);})[_0x6673('0x37')](function(_0x188a9c){_0x4fe316[_0x6673('0x59')]=_0x188a9c;return _0x4fe316;});}})['then'](respondWithFilteredResult(_0x19a104,_0x5ded97))[_0x6673('0x2d')](handleError(_0x19a104,null));};exports[_0x6673('0x6a')]=function(_0x2d2629,_0x9ac141,_0x23724e){return db[_0x6673('0x41')]['find']({'where':{'id':_0x2d2629[_0x6673('0x60')]['id']}})['then'](handleEntityNotFound(_0x9ac141,null))[_0x6673('0x37')](function(_0x195489){if(_0x195489){return _0x195489[_0x6673('0x6a')](_0x2d2629[_0x6673('0x47')][_0x6673('0x6b')]);}})[_0x6673('0x37')](respondWithStatusCode(_0x9ac141,null))[_0x6673('0x2d')](handleError(_0x9ac141,null));};exports[_0x6673('0x6c')]=function(_0x153ef2,_0x424638,_0x4d10b2){if(_0x153ef2[_0x6673('0x61')]['id']){delete _0x153ef2[_0x6673('0x61')]['id'];}return db[_0x6673('0x41')][_0x6673('0x62')]({'where':{'id':_0x153ef2[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x424638,null))['then'](function(_0x241ec5){if(_0x241ec5){_0x153ef2[_0x6673('0x61')][_0x6673('0x64')]=_0x241ec5['id'];return db['CannedAnswer'][_0x6673('0x5b')](_0x153ef2[_0x6673('0x61')]);}})[_0x6673('0x37')](respondWithResult(_0x424638,null))[_0x6673('0x2d')](handleError(_0x424638,null));};exports[_0x6673('0x6d')]=function(_0x801ff1,_0xcbb53,_0x1cc93a){var _0x350f36={'raw':![],'where':{}};var _0x461a94={};var _0x22fe9b={'count':0x0,'rows':[]};return db[_0x6673('0x41')][_0x6673('0x66')]({'where':{'id':_0x801ff1[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0xcbb53,null))[_0x6673('0x37')](function(_0x5dddf4){if(_0x5dddf4){_0x461a94[_0x6673('0x46')]=_[_0x6673('0x48')](db[_0x6673('0x6e')][_0x6673('0x42')]);_0x461a94['query']=_[_0x6673('0x48')](_0x801ff1[_0x6673('0x47')]);_0x461a94[_0x6673('0x49')]=_['intersection'](_0x461a94['model'],_0x461a94[_0x6673('0x47')]);_0x350f36['attributes']=_['intersection'](_0x461a94[_0x6673('0x46')],qs[_0x6673('0x4c')](_0x801ff1['query'][_0x6673('0x4c')]));_0x350f36[_0x6673('0x4a')]=_0x350f36[_0x6673('0x4a')][_0x6673('0x4d')]?_0x350f36[_0x6673('0x4a')]:_0x461a94[_0x6673('0x46')];if(!_0x801ff1[_0x6673('0x47')][_0x6673('0x4e')]('nolimit')){_0x350f36[_0x6673('0x50')]=qs['limit'](_0x801ff1[_0x6673('0x47')][_0x6673('0x50')]);_0x350f36['offset']=qs[_0x6673('0x32')](_0x801ff1[_0x6673('0x47')][_0x6673('0x32')]);}_0x350f36[_0x6673('0x51')]=qs[_0x6673('0x52')](_0x801ff1[_0x6673('0x47')]['sort']);_0x350f36['where']=qs[_0x6673('0x49')](_['pick'](_0x801ff1[_0x6673('0x47')],_0x461a94[_0x6673('0x49')]));_0x350f36[_0x6673('0x53')][_0x6673('0x64')]=_0x5dddf4['id'];if(_0x801ff1[_0x6673('0x47')][_0x6673('0x55')]){_0x350f36[_0x6673('0x53')]=_[_0x6673('0x56')](_0x350f36[_0x6673('0x53')],{'$or':_['map'](_0x350f36[_0x6673('0x4a')],function(_0x235a2c){var _0x65f07b={};_0x65f07b[_0x235a2c]={'$like':'%'+_0x801ff1[_0x6673('0x47')][_0x6673('0x55')]+'%'};return _0x65f07b;})});}_0x350f36=_['merge']({},_0x350f36,_0x801ff1[_0x6673('0x68')]);return db['CannedAnswer']['count']({'where':_0x350f36[_0x6673('0x53')]})[_0x6673('0x37')](function(_0x3554dc){_0x22fe9b[_0x6673('0x31')]=_0x3554dc;if(_0x801ff1[_0x6673('0x47')][_0x6673('0x69')]){_0x350f36[_0x6673('0x5a')]=[{'all':!![]}];}return db[_0x6673('0x6e')][_0x6673('0x58')](_0x350f36);})[_0x6673('0x37')](function(_0x3d53f4){_0x22fe9b['rows']=_0x3d53f4;return _0x22fe9b;});}})[_0x6673('0x37')](respondWithFilteredResult(_0xcbb53,_0x350f36))[_0x6673('0x2d')](handleError(_0xcbb53,null));};exports[_0x6673('0x6f')]=function(_0xe45e66,_0x34dd2c,_0x246639){return db['FaxAccount'][_0x6673('0x62')]({'where':{'id':_0xe45e66[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x34dd2c,null))[_0x6673('0x37')](function(_0x2c1ce6){if(_0x2c1ce6){return _0x2c1ce6['removeAnswers'](_0xe45e66['query']['ids']);}})['then'](respondWithStatusCode(_0x34dd2c,null))['catch'](handleError(_0x34dd2c,null));};exports['addInteraction']=function(_0x122c60,_0x1ccc8c,_0x1207ce){return db[_0x6673('0x70')][_0x6673('0x62')]({'where':{'id':_0x122c60[_0x6673('0x60')]['id']}})['then'](handleEntityNotFound(_0x1ccc8c,null))[_0x6673('0x37')](function(_0x464c5c){if(_0x464c5c){return _0x464c5c['addInteraction'](_0x122c60[_0x6673('0x61')][_0x6673('0x6b')],_[_0x6673('0x71')](_0x122c60[_0x6673('0x61')],['ids','id'])||{});}})[_0x6673('0x37')](respondWithResult(_0x1ccc8c,null))['catch'](handleError(_0x1ccc8c,null));};exports[_0x6673('0x72')]=function(_0x3ea36a,_0x1c3a8f,_0xac166b){var _0x3d6b87={'raw':![],'where':{}};var _0x4a6a96={};var _0x3ae20d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6673('0x66')]({'where':{'id':_0x3ea36a[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x1c3a8f,null))[_0x6673('0x37')](function(_0xfa1f57){if(_0xfa1f57){_0x4a6a96[_0x6673('0x46')]=_[_0x6673('0x48')](db[_0x6673('0x70')]['rawAttributes']);_0x4a6a96['query']=_[_0x6673('0x48')](_0x3ea36a[_0x6673('0x47')]);_0x4a6a96[_0x6673('0x49')]=_['intersection'](_0x4a6a96['model'],_0x4a6a96[_0x6673('0x47')]);_0x3d6b87['attributes']=_[_0x6673('0x4b')](_0x4a6a96['model'],qs[_0x6673('0x4c')](_0x3ea36a[_0x6673('0x47')][_0x6673('0x4c')]));_0x3d6b87[_0x6673('0x4a')]=_0x3d6b87[_0x6673('0x4a')][_0x6673('0x4d')]?_0x3d6b87['attributes']:_0x4a6a96[_0x6673('0x46')];if(!_0x3ea36a[_0x6673('0x47')][_0x6673('0x4e')](_0x6673('0x4f'))){_0x3d6b87[_0x6673('0x50')]=qs[_0x6673('0x50')](_0x3ea36a[_0x6673('0x47')][_0x6673('0x50')]);_0x3d6b87['offset']=qs[_0x6673('0x32')](_0x3ea36a[_0x6673('0x47')]['offset']);}_0x3d6b87[_0x6673('0x51')]=qs[_0x6673('0x52')](_0x3ea36a[_0x6673('0x47')][_0x6673('0x52')]);_0x3d6b87[_0x6673('0x53')]=qs[_0x6673('0x49')](_['pick'](_0x3ea36a['query'],_0x4a6a96[_0x6673('0x49')]));_0x3d6b87[_0x6673('0x53')][_0x6673('0x64')]=_0xfa1f57['id'];if(_0x3ea36a[_0x6673('0x47')][_0x6673('0x55')]){_0x3d6b87[_0x6673('0x53')]=_[_0x6673('0x56')](_0x3d6b87[_0x6673('0x53')],{'$or':_[_0x6673('0x40')](_0x3d6b87[_0x6673('0x4a')],function(_0x2ade5a){var _0x17ad49={};_0x17ad49[_0x2ade5a]={'$like':'%'+_0x3ea36a[_0x6673('0x47')][_0x6673('0x55')]+'%'};return _0x17ad49;})});}_0x3d6b87=_[_0x6673('0x56')]({},_0x3d6b87,_0x3ea36a[_0x6673('0x68')]);return db[_0x6673('0x70')][_0x6673('0x31')]({'where':_0x3d6b87[_0x6673('0x53')]})[_0x6673('0x37')](function(_0x353e64){_0x3ae20d[_0x6673('0x31')]=_0x353e64;if(_0x3ea36a[_0x6673('0x47')][_0x6673('0x69')]){_0x3d6b87['include']=[{'model':db[_0x6673('0x73')],'as':_0x6673('0x74'),'required':![]},{'model':db[_0x6673('0x75')],'as':_0x6673('0x76'),'attributes':[_0x6673('0x3d'),_0x6673('0x77'),_0x6673('0x78')],'required':![]},{'model':db[_0x6673('0x79')],'as':_0x6673('0x7a'),'attributes':['id',_0x6673('0x3d'),'color'],'where':_0x3ea36a[_0x6673('0x47')][_0x6673('0x7b')]?{'id':_0x3ea36a[_0x6673('0x47')][_0x6673('0x7b')]}:undefined,'required':_0x3ea36a['query']['tag']?!![]:![]}];}return db[_0x6673('0x70')][_0x6673('0x58')](_0x3d6b87);})[_0x6673('0x37')](function(_0x527fd1){_0x3ae20d[_0x6673('0x59')]=_0x527fd1;return _0x3ae20d;});}})[_0x6673('0x37')](respondWithFilteredResult(_0x1c3a8f,_0x3d6b87))['catch'](handleError(_0x1c3a8f,null));};exports['addApplications']=function(_0x1f753c,_0xf0c760,_0x34a443){return db[_0x6673('0x41')][_0x6673('0x66')]({'where':{'id':_0x1f753c[_0x6673('0x60')]['id']}})['then'](handleEntityNotFound(_0xf0c760,null))[_0x6673('0x37')](function(_0x29e10c){if(_0x29e10c){return db[_0x6673('0x7c')][_0x6673('0x7d')](function(_0xeb3628){return db['FaxApplication'][_0x6673('0x3a')]({'where':{'FaxAccountId':_0x1f753c[_0x6673('0x60')]['id']},'transaction':_0xeb3628})[_0x6673('0x37')](function(_0x5a90c1){var _0x2f1099=_[_0x6673('0x40')](_0x1f753c[_0x6673('0x61')],function(_0x574a08){_0x574a08['FaxAccountId']=_0x1f753c[_0x6673('0x60')]['id'];return _0x574a08;});return db[_0x6673('0x7e')][_0x6673('0x7f')](_0x2f1099,{'transaction':_0xeb3628});});})[_0x6673('0x37')](function(){return db[_0x6673('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x1f753c[_0x6673('0x60')]['id']},'order':_0x6673('0x80')});});}})[_0x6673('0x37')](respondWithResult(_0xf0c760,null))[_0x6673('0x2d')](handleError(_0xf0c760,null));};exports[_0x6673('0x81')]=function(_0x1321f5,_0x13fcc0,_0x5a16b3){var _0x506a43={};var _0x48106e={};var _0x278188;var _0x3404b7;return db[_0x6673('0x41')]['findOne']({'where':{'id':_0x1321f5['params']['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x13fcc0,null))[_0x6673('0x37')](function(_0x369244){if(_0x369244){_0x278188=_0x369244;_0x48106e[_0x6673('0x46')]=_[_0x6673('0x48')](db[_0x6673('0x7e')][_0x6673('0x42')]);_0x48106e[_0x6673('0x47')]=_['keys'](_0x1321f5['query']);_0x48106e[_0x6673('0x49')]=_['intersection'](_0x48106e['model'],_0x48106e[_0x6673('0x47')]);_0x506a43['attributes']=_[_0x6673('0x4b')](_0x48106e['model'],qs[_0x6673('0x4c')](_0x1321f5[_0x6673('0x47')]['fields']));_0x506a43[_0x6673('0x4a')]=_0x506a43[_0x6673('0x4a')]['length']?_0x506a43[_0x6673('0x4a')]:_0x48106e['model'];_0x506a43[_0x6673('0x51')]=qs[_0x6673('0x52')](_0x1321f5[_0x6673('0x47')]['sort']);_0x506a43[_0x6673('0x53')]=qs[_0x6673('0x49')](_[_0x6673('0x54')](_0x1321f5[_0x6673('0x47')],_0x48106e[_0x6673('0x49')]));if(_0x1321f5[_0x6673('0x47')][_0x6673('0x55')]){_0x506a43[_0x6673('0x53')]=_[_0x6673('0x56')](_0x506a43['where'],{'$or':_[_0x6673('0x40')](_0x506a43['attributes'],function(_0x2d01aa){var _0x351a7a={};_0x351a7a[_0x2d01aa]={'$like':'%'+_0x1321f5[_0x6673('0x47')][_0x6673('0x55')]+'%'};return _0x351a7a;})});}_0x506a43=_[_0x6673('0x56')]({},_0x506a43,_0x1321f5[_0x6673('0x68')]);return _0x278188['getApplications'](_0x506a43);}})[_0x6673('0x37')](function(_0x258bfc){if(_0x258bfc){_0x3404b7=_0x258bfc[_0x6673('0x4d')];if(!_0x1321f5[_0x6673('0x47')][_0x6673('0x4e')]('nolimit')){_0x506a43[_0x6673('0x50')]=qs['limit'](_0x1321f5[_0x6673('0x47')][_0x6673('0x50')]);_0x506a43[_0x6673('0x32')]=qs[_0x6673('0x32')](_0x1321f5[_0x6673('0x47')][_0x6673('0x32')]);}return _0x278188['getApplications'](_0x506a43);}})['then'](function(_0x5b2fed){if(_0x5b2fed){return _0x5b2fed?{'count':_0x3404b7,'rows':_0x5b2fed}:null;}})['then'](respondWithResult(_0x13fcc0,null))['catch'](handleError(_0x13fcc0,null));};function Extension(_0xfc23f1,_0x59de46,_0x21386c,_0x4454e9){this[_0x6673('0x82')]='from-voip-provider';this[_0x6673('0x83')]=_0xfc23f1['localstationid'];this[_0x6673('0x84')]=_0x4454e9;this['type']=_0x6673('0x85');this[_0x6673('0x86')]=_0x6673('0x87');this['FaxAccountId']=_0xfc23f1['id'];this[_0x6673('0x80')]=_0x59de46;this['appdata']=_0x21386c;}function createExtensionsReciveFax(_0x2120e6){var _0x5792f2=0x1;var _0x2e5b63=[];_0x2e5b63['push'](new Extension(_0x2120e6,_0x5792f2,'','Answer'));_0x5792f2+=0x1;_0x2e5b63[_0x6673('0x88')](new Extension(_0x2120e6,_0x5792f2,_0x6673('0x89'),_0x6673('0x8a')));_0x5792f2+=0x1;for(var _0x1085a8 in _0x2120e6){if(_0x2120e6[_0x6673('0x4e')](_0x1085a8)&&(_0x1085a8===_0x6673('0x8b')||_0x1085a8==='localstationid'||_0x1085a8===_0x6673('0x8c')||_0x1085a8===_0x6673('0x8d')||_0x1085a8===_0x6673('0x8e')||_0x1085a8===_0x6673('0x8f')||_0x1085a8===_0x6673('0x90')||_0x1085a8===_0x6673('0x91')||_0x1085a8===_0x6673('0x92'))){_0x2e5b63[_0x6673('0x88')](new Extension(_0x2120e6,_0x5792f2,_0x6673('0x93')+_0x1085a8+')='+_0x2120e6[_0x1085a8],_0x6673('0x8a')));_0x5792f2+=0x1;}}_0x2e5b63['push'](new Extension(_0x2120e6,_0x5792f2,'6',_0x6673('0x94')));_0x5792f2+=0x1;_0x2e5b63[_0x6673('0x88')](new Extension(_0x2120e6,_0x5792f2,_0x6673('0x95'),_0x6673('0x96')));_0x5792f2=0x0;return _0x2e5b63;}exports['addAccountApplications']=function(_0xd310ca,_0x4f1178,_0x5616b0){var _0x332973;return db[_0x6673('0x7c')][_0x6673('0x7d')](function(_0x53450b){return db['FaxAccount'][_0x6673('0x5b')](_0xd310ca[_0x6673('0x61')],{'transaction':_0x53450b})[_0x6673('0x37')](function(_0x719794){_0x332973=_0x719794[_0x6673('0x38')]({'plain':!![]});return db[_0x6673('0x97')][_0x6673('0x7f')](createExtensionsReciveFax(_0x332973),{'transaction':_0x53450b});});})[_0x6673('0x37')](function(){return _0x332973;})[_0x6673('0x37')](respondWithResult(_0x4f1178,null))[_0x6673('0x2d')](handleError(_0x4f1178,null));};exports[_0x6673('0x98')]=function(_0x4aae03,_0x23f1ff,_0x245e09){var _0x1afe73;return db[_0x6673('0x7c')][_0x6673('0x7d')](function(_0x3fd3d3){return db[_0x6673('0x41')][_0x6673('0x36')](_0x4aae03[_0x6673('0x61')],{'where':{'id':_0x4aae03[_0x6673('0x61')]['id']},'transaction':_0x3fd3d3})['then'](function(_0x454898){return db[_0x6673('0x97')]['destroy']({'where':{'FaxAccountId':_0x4aae03['body']['id']},'transaction':_0x3fd3d3})[_0x6673('0x37')](function(_0x347965){return db[_0x6673('0x97')][_0x6673('0x7f')](createExtensionsReciveFax(_[_0x6673('0x71')](_0x4aae03[_0x6673('0x61')],[_0x6673('0x99'),_0x6673('0x45'),_0x6673('0x9a'),_0x6673('0x9b'),_0x6673('0x9c'),'ListId'])),{'transaction':_0x3fd3d3});});});})[_0x6673('0x37')](function(){return db[_0x6673('0x41')][_0x6673('0x9d')](_0x4aae03['body']['id']);})[_0x6673('0x37')](respondWithResult(_0x23f1ff,null))[_0x6673('0x2d')](handleError(_0x23f1ff,null));};exports['getMessages']=function(_0x263ca4,_0x132bea,_0xdd5c60){var _0x5b4509={'raw':!![],'where':{}};var _0x14b1de={};var _0x1d5484={'count':0x0,'rows':[]};return db[_0x6673('0x41')]['findOne']({'where':{'id':_0x263ca4[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x132bea,null))['then'](function(_0x4663d9){if(_0x4663d9){_0x14b1de['model']=_['keys'](db[_0x6673('0x9e')]['rawAttributes']);_0x14b1de['query']=_['keys'](_0x263ca4['query']);_0x14b1de[_0x6673('0x49')]=_[_0x6673('0x4b')](_0x14b1de[_0x6673('0x46')],_0x14b1de[_0x6673('0x47')]);_0x5b4509[_0x6673('0x4a')]=_[_0x6673('0x4b')](_0x14b1de[_0x6673('0x46')],qs[_0x6673('0x4c')](_0x263ca4[_0x6673('0x47')][_0x6673('0x4c')]));_0x5b4509[_0x6673('0x4a')]=_0x5b4509[_0x6673('0x4a')][_0x6673('0x4d')]?_0x5b4509[_0x6673('0x4a')]:_0x14b1de[_0x6673('0x46')];if(!_0x263ca4['query'][_0x6673('0x4e')](_0x6673('0x4f'))){_0x5b4509[_0x6673('0x50')]=qs[_0x6673('0x50')](_0x263ca4['query'][_0x6673('0x50')]);_0x5b4509[_0x6673('0x32')]=qs[_0x6673('0x32')](_0x263ca4['query'][_0x6673('0x32')]);}_0x5b4509['order']=qs[_0x6673('0x52')](_0x263ca4[_0x6673('0x47')]['sort']);_0x5b4509[_0x6673('0x53')]=qs['filters'](_['pick'](_0x263ca4[_0x6673('0x47')],_0x14b1de['filters']));_0x5b4509['where'][_0x6673('0x64')]=_0x4663d9['id'];if(_0x263ca4[_0x6673('0x47')][_0x6673('0x55')]){_0x5b4509[_0x6673('0x53')]=_['merge'](_0x5b4509[_0x6673('0x53')],{'$or':_[_0x6673('0x40')](_0x5b4509[_0x6673('0x4a')],function(_0x5af8fc){var _0x5dcf84={};_0x5dcf84[_0x5af8fc]={'$like':'%'+_0x263ca4[_0x6673('0x47')]['filter']+'%'};return _0x5dcf84;})});}if(_0x263ca4[_0x6673('0x47')]['$gte']){var _0x451167=_0x263ca4[_0x6673('0x47')][_0x6673('0x9f')][_0x6673('0xa0')](',');var _0x565993={};_0x565993[_0x451167[0x0]]={'$gte':moment(_0x451167[0x1])['format'](_0x6673('0xa1'))};_0x5b4509[_0x6673('0x53')]=_[_0x6673('0x56')](_0x5b4509['where'],_0x565993);}_0x5b4509=_[_0x6673('0x56')]({},_0x5b4509,_0x263ca4[_0x6673('0x68')]);return db[_0x6673('0x9e')][_0x6673('0x31')]({'where':_0x5b4509[_0x6673('0x53')]})['then'](function(_0x487e4c){_0x1d5484[_0x6673('0x31')]=_0x487e4c;if(_0x263ca4[_0x6673('0x47')][_0x6673('0x69')]){_0x5b4509[_0x6673('0x5a')]=[{'all':!![]}];}return db[_0x6673('0x9e')][_0x6673('0x58')](_0x5b4509);})[_0x6673('0x37')](function(_0x43da9a){_0x1d5484['rows']=_0x43da9a;return _0x1d5484;});}})[_0x6673('0x37')](respondWithFilteredResult(_0x132bea,_0x5b4509))[_0x6673('0x2d')](handleError(_0x132bea,null));};exports[_0x6673('0xa2')]=function(_0x5ab093,_0x42adeb,_0x4194b8){var _0x4b60b3,_0x1d98eb={},_0x5ee8ea;if(_0x5ab093[_0x6673('0x61')]['to']){_0x5ee8ea=_0x5ab093[_0x6673('0x61')]['to'][0x0];}return db['FaxAccount'][_0x6673('0x62')]({'where':{'id':_0x5ab093[_0x6673('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x6673('0xa3'),'include':[{'model':db[_0x6673('0x73')],'as':_0x6673('0xa4'),'where':{'fax':_0x5ee8ea},'limit':0x1,'order':[['updatedAt',_0x6673('0xa5')]]}]}]})[_0x6673('0x37')](handleEntityNotFound(_0x42adeb,null))[_0x6673('0x37')](function(_0x5f4953){_0x4b60b3=_0x5f4953;if(_0x5ab093['body'][_0x6673('0xa6')]&&_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][_0x6673('0x4d')]){for(var _0xf210d7=0x0;_0xf210d7<_0x5ab093[_0x6673('0x61')]['attachments']['length'];_0xf210d7+=0x1){_0x5ab093['body'][_0x6673('0xa6')][_0xf210d7]={'filename':_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][_0xf210d7]['name'],'id':_0x5ab093['body']['attachments'][_0xf210d7]['id'],'path':path[_0x6673('0xa7')](config[_0x6673('0xa8')],_0x6673('0xa9'),_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][_0xf210d7][_0x6673('0xaa')])};}}return respondWithRpcPromise(_0x6673('0xab'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x5ab093[_0x6673('0x60')]['id'])?undefined:_0x5ab093[_0x6673('0x60')]['id'],'path':_['isNil'](_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][0x0][_0x6673('0xac')])?undefined:_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][0x0][_0x6673('0xac')],'fax':_[_0x6673('0xad')](_0x5ab093['body']['to'][0x0])?undefined:_0x5ab093[_0x6673('0x61')]['to'][0x0]},client9002);})['then'](function(){if(_0x4b60b3){if(_[_0x6673('0xad')](_0x5ab093[_0x6673('0x61')][_0x6673('0xae')])){_0x5ab093[_0x6673('0x61')][_0x6673('0xae')]=util[_0x6673('0xaf')](_0x6673('0xb0'),_0x4b60b3[_0x6673('0x3d')],_0x4b60b3[_0x6673('0xb1')]);}if(_0x4b60b3[_0x6673('0xa3')]){if(_0x4b60b3['List'][_0x6673('0xa4')][_0x6673('0x4d')]){return _0x4b60b3[_0x6673('0xa3')][_0x6673('0xa4')][0x0];}else{return db[_0x6673('0x73')][_0x6673('0x5b')](_[_0x6673('0x1a')](_0x5ab093[_0x6673('0x61')],{'firstName':_0x5ab093[_0x6673('0x61')]['to'][0x0],'phone':_0x5ab093['body']['to'][0x0],'fax':_0x5ab093[_0x6673('0x61')]['to'][0x0],'ListId':_0x4b60b3[_0x6673('0xb2')]}));}}else{throw new Error(_0x6673('0xb3'));}}else{throw new Error(_0x6673('0xb4'));}})[_0x6673('0x37')](function(_0x24fdc2){if(_0x24fdc2){return db['FaxInteraction'][_0x6673('0x62')]({'where':{'ContactId':_0x24fdc2['id'],'closed':![],'FaxAccountId':_0x4b60b3['id']}})[_0x6673('0x37')](function(_0x482f61){if(_0x482f61){return[_0x482f61,![]];}return db[_0x6673('0x70')][_0x6673('0x5b')]({'UserId':_0x5ab093[_0x6673('0x5c')]['id'],'ContactId':_0x24fdc2['id'],'FaxAccountId':_0x4b60b3['id'],'fax':_0x5ab093[_0x6673('0x61')]['to'][0x0],'firstMsgDirection':_0x6673('0xb5'),'Messages':[_[_0x6673('0x56')](_0x5ab093[_0x6673('0x61')],{'read':![],'body':_0x5ab093['body'][_0x6673('0xa6')][0x0][_0x6673('0xb6')],'FaxAccountId':_0x4b60b3['id'],'UserId':_0x5ab093[_0x6673('0x5c')]['id'],'ContactId':_0x24fdc2['id'],'AttachmentId':_0x5ab093[_0x6673('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x6673('0xb7')}]})['then'](function(_0x36b7be){return[_0x36b7be,!![]];});});}else{throw new Error(_0x6673('0xb8'));}})[_0x6673('0xb9')](function(_0x14dc79,_0x256cae){if(_0x256cae){return _0x14dc79;}return db[_0x6673('0x9e')][_0x6673('0x5b')]({'direction':_0x6673('0xb5'),'read':![],'body':_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][0x0][_0x6673('0xb6')],'FaxAccountId':_0x4b60b3['id'],'FaxInteractionId':_0x14dc79['id'],'UserId':_0x5ab093[_0x6673('0x5c')]['id'],'ContactId':_0x14dc79[_0x6673('0xba')],'AttachmentId':_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][0x0]['id']})[_0x6673('0x37')](function(_0x289acc){_0x14dc79[_0x6673('0xbb')][_0x6673('0xb7')]=[];_0x14dc79[_0x6673('0xbb')][_0x6673('0xb7')][_0x6673('0x88')](_0x289acc[_0x6673('0xbb')]);return _0x14dc79;});})[_0x6673('0x37')](function(_0x5d6fde){respondWithRpcPromise(_0x6673('0xbc'),'SendFax',{'FaxAccountId':_['isNil'](_0x5ab093[_0x6673('0x60')]['id'])?undefined:_0x5ab093['params']['id'],'path':_['isNil'](_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][0x0][_0x6673('0xac')])?undefined:_0x5ab093['body'][_0x6673('0xa6')][0x0]['path'],'fax':_[_0x6673('0xad')](_0x5ab093[_0x6673('0x61')]['to'][0x0])?undefined:_0x5ab093[_0x6673('0x61')]['to'][0x0],'AttachmentId':_0x5ab093[_0x6673('0x61')][_0x6673('0xa6')][0x0]['id']},client9002)['then'](function(_0x4c877f){logger['info'](_0x6673('0xbd'),_0x4c877f);})[_0x6673('0x2d')](function(_0x156cb2){logger[_0x6673('0x26')]('SendFaxRpc,\x20%s',_0x156cb2);});return _0x5d6fde;})['then'](respondWithResult(_0x42adeb,null))['catch'](handleError(_0x42adeb,null));};exports['addAgents']=function(_0x416d5a,_0x57b266,_0x1fea22){return db[_0x6673('0x41')][_0x6673('0x62')]({'where':{'id':_0x416d5a[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x57b266,null))[_0x6673('0x37')](function(_0x40c2c7){if(_0x40c2c7){return _0x40c2c7[_0x6673('0xbe')](_0x416d5a['body'][_0x6673('0x6b')],_[_0x6673('0x71')](_0x416d5a[_0x6673('0x61')],[_0x6673('0x6b'),'id'])||{})['spread'](function(_0x7a8f07){for(var _0x2f956c=0x0;_0x2f956c<_0x416d5a['body'][_0x6673('0x6b')][_0x6673('0x4d')];_0x2f956c+=0x1){socket['emit'](_0x6673('0xbf'),{'UserId':_0x416d5a[_0x6673('0x61')][_0x6673('0x6b')][_0x2f956c],'FaxAccountId':_0x416d5a[_0x6673('0x60')]['id']});}return _0x7a8f07;});}})[_0x6673('0x37')](respondWithResult(_0x57b266,null))[_0x6673('0x2d')](handleError(_0x57b266,null));};exports[_0x6673('0xc0')]=function(_0x3e4df0,_0x5f2c8a,_0x304c73){return db[_0x6673('0x41')][_0x6673('0x62')]({'where':{'id':_0x3e4df0['params']['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x5f2c8a,null))['then'](function(_0x47c57d){if(_0x47c57d){return _0x47c57d[_0x6673('0xc0')](_0x3e4df0[_0x6673('0x47')][_0x6673('0x6b')])[_0x6673('0x37')](function(){if(_['isArray'](_0x3e4df0[_0x6673('0x47')][_0x6673('0x6b')])){for(var _0x3eb444=0x0;_0x3eb444<_0x3e4df0[_0x6673('0x47')][_0x6673('0x6b')][_0x6673('0x4d')];_0x3eb444+=0x1){socket[_0x6673('0xc1')](_0x6673('0xc2'),{'UserId':Number(_0x3e4df0[_0x6673('0x47')][_0x6673('0x6b')][_0x3eb444]),'FaxAccountId':Number(_0x3e4df0[_0x6673('0x60')]['id'])});}}else{socket[_0x6673('0xc1')](_0x6673('0xc2'),{'UserId':Number(_0x3e4df0['query'][_0x6673('0x6b')]),'FaxAccountId':Number(_0x3e4df0[_0x6673('0x60')]['id'])});}});}})[_0x6673('0x37')](respondWithStatusCode(_0x5f2c8a,null))[_0x6673('0x2d')](handleError(_0x5f2c8a,null));};exports[_0x6673('0xc3')]=function(_0x3832ca,_0x1069e9,_0x4f18fd){var _0xb44e16={};var _0x5b127a={};var _0xaab5e1;var _0x4db7e9;return db[_0x6673('0x41')][_0x6673('0x66')]({'where':{'id':_0x3832ca[_0x6673('0x60')]['id']}})[_0x6673('0x37')](handleEntityNotFound(_0x1069e9,null))[_0x6673('0x37')](function(_0x4bb03f){if(_0x4bb03f){_0xaab5e1=_0x4bb03f;_0x5b127a[_0x6673('0x46')]=_[_0x6673('0x48')](db['User'][_0x6673('0x42')]);_0x5b127a[_0x6673('0x47')]=_[_0x6673('0x48')](_0x3832ca[_0x6673('0x47')]);_0x5b127a[_0x6673('0x49')]=_[_0x6673('0x4b')](_0x5b127a['model'],_0x5b127a[_0x6673('0x47')]);_0xb44e16[_0x6673('0x4a')]=_[_0x6673('0x4b')](_0x5b127a[_0x6673('0x46')],qs[_0x6673('0x4c')](_0x3832ca[_0x6673('0x47')]['fields']));_0xb44e16[_0x6673('0x4a')]=_0xb44e16[_0x6673('0x4a')]['length']?_0xb44e16[_0x6673('0x4a')]:_0x5b127a[_0x6673('0x46')];_0xb44e16[_0x6673('0x51')]=qs[_0x6673('0x52')](_0x3832ca[_0x6673('0x47')][_0x6673('0x52')]);_0xb44e16[_0x6673('0x53')]=qs['filters'](_[_0x6673('0x54')](_0x3832ca['query'],_0x5b127a['filters']));if(_0x3832ca[_0x6673('0x47')]['filter']){_0xb44e16[_0x6673('0x53')]=_['merge'](_0xb44e16[_0x6673('0x53')],{'$or':_[_0x6673('0x40')](_0xb44e16[_0x6673('0x4a')],function(_0x4272c3){var _0x28afa3={};_0x28afa3[_0x4272c3]={'$like':'%'+_0x3832ca['query'][_0x6673('0x55')]+'%'};return _0x28afa3;})});}_0xb44e16=_[_0x6673('0x56')]({},_0xb44e16,_0x3832ca['options']);return _0xaab5e1[_0x6673('0xc3')](_0xb44e16);}})['then'](function(_0x1ee420){if(_0x1ee420){_0x4db7e9=_0x1ee420['length'];if(!_0x3832ca[_0x6673('0x47')][_0x6673('0x4e')](_0x6673('0x4f'))){_0xb44e16['limit']=qs['limit'](_0x3832ca[_0x6673('0x47')][_0x6673('0x50')]);_0xb44e16[_0x6673('0x32')]=qs['offset'](_0x3832ca[_0x6673('0x47')]['offset']);}return _0xaab5e1[_0x6673('0xc3')](_0xb44e16);}})[_0x6673('0x37')](function(_0x577f81){if(_0x577f81){return _0x577f81?{'count':_0x4db7e9,'rows':_0x577f81}:null;}})['then'](respondWithResult(_0x1069e9,null))['catch'](handleError(_0x1069e9,null));}; \ No newline at end of file +var _0x5f2c=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','save','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','order','sort','filters','where','merge','options','includeAll','include','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','findOne','filter','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','pick','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','addAccountApplications','VoiceExtension','updateAccountApplications','transaction','tech','key','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel'];(function(_0x29e9e8,_0x5d30c0){var _0x218b87=function(_0x26ecf9){while(--_0x26ecf9){_0x29e9e8['push'](_0x29e9e8['shift']());}};_0x218b87(++_0x5d30c0);}(_0x5f2c,0x179));var _0xc5f2=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5f2c[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0xc5f2('0x0'));var emlformat=require(_0xc5f2('0x1'));var rimraf=require(_0xc5f2('0x2'));var zipdir=require(_0xc5f2('0x3'));var jsonpatch=require(_0xc5f2('0x4'));var rp=require('request-promise');var moment=require(_0xc5f2('0x5'));var BPromise=require(_0xc5f2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc5f2('0x7'));var sox=require('sox');var csv=require(_0xc5f2('0x8'));var ejs=require(_0xc5f2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc5f2('0xa'));var crypto=require(_0xc5f2('0xb'));var jsforce=require(_0xc5f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc5f2('0xd'));var Papa=require(_0xc5f2('0xe'));var Redis=require(_0xc5f2('0xf'));var authService=require(_0xc5f2('0x10'));var qs=require(_0xc5f2('0x11'));var as=require(_0xc5f2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5f2('0x13'))('api');var utils=require(_0xc5f2('0x14'));var config=require(_0xc5f2('0x15'));var db=require(_0xc5f2('0x16'))['db'];config[_0xc5f2('0x17')]=_[_0xc5f2('0x18')](config[_0xc5f2('0x17')],{'host':_0xc5f2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5f2('0x17')]));require('./faxAccount.socket')[_0xc5f2('0x1a')](socket);var jayson=require(_0xc5f2('0x1b'));var client=jayson[_0xc5f2('0x1c')][_0xc5f2('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xc5f2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3f3a32,_0x4ebf76,_0x1b0177){if(_0x1b0177){var _0x590a21=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x590a21[_0xc5f2('0x1e')](_0x4ebf76)){return _0x3f3a32;}else{throw new db[(_0xc5f2('0x1f'))]['ValidationError'](_0xc5f2('0x20'));}}else{return _0x3f3a32;}}function respondWithRpcPromise(_0x300b5a,_0x13496c,_0x2aa0e4,_0x5c6c06){return new BPromise(function(_0x1b49b0,_0x38eaa9){var _0xc9baa7=_0x5c6c06||client;return _0xc9baa7[_0xc5f2('0x21')](_0x300b5a,_0x2aa0e4)[_0xc5f2('0x22')](function(_0x4ec366){logger['info'](_0xc5f2('0x23'),_0x13496c,'request\x20sent');logger[_0xc5f2('0x24')](_0xc5f2('0x25'),_0x13496c,_0xc5f2('0x26'),JSON[_0xc5f2('0x27')](_0x4ec366));if(_0x4ec366[_0xc5f2('0x28')]){if(_0x4ec366['error']['code']===0x1f4){logger[_0xc5f2('0x28')](_0xc5f2('0x23'),_0x13496c,_0x4ec366[_0xc5f2('0x28')][_0xc5f2('0x29')]);return _0x38eaa9(_0x4ec366[_0xc5f2('0x28')][_0xc5f2('0x29')]);}logger[_0xc5f2('0x28')](_0xc5f2('0x23'),_0x13496c,_0x4ec366['error'][_0xc5f2('0x29')]);return _0x1b49b0(_0x4ec366['error']['message']);}else{logger[_0xc5f2('0x2a')](_0xc5f2('0x23'),_0x13496c,_0xc5f2('0x26'));_0x1b49b0(_0x4ec366[_0xc5f2('0x2b')][_0xc5f2('0x29')]);}})[_0xc5f2('0x2c')](function(_0x2b59b4){logger[_0xc5f2('0x28')](_0xc5f2('0x23'),_0x13496c,_0x2b59b4);_0x38eaa9(_0x2b59b4);});});}function respondWithStatusCode(_0x2625c9,_0x18aed3){_0x18aed3=_0x18aed3||0xcc;return function(_0x561fd6){if(_0x561fd6){return _0x2625c9[_0xc5f2('0x2d')](_0x18aed3);}return _0x2625c9['status'](_0x18aed3)['end']();};}function respondWithResult(_0x55203a,_0x391bd3){_0x391bd3=_0x391bd3||0xc8;return function(_0x1d4678){if(_0x1d4678){return _0x55203a['status'](_0x391bd3)[_0xc5f2('0x2e')](_0x1d4678);}};}function respondWithFilteredResult(_0x8e4529,_0x41e037){return function(_0x499e32){if(_0x499e32){var _0x56d9ac=_0x499e32[_0xc5f2('0x2f')],_0x165827=_0x41e037[_0xc5f2('0x30')],_0x25ee91=_0x41e037[_0xc5f2('0x30')]+_0x41e037[_0xc5f2('0x31')],_0xac948d;if(_0x25ee91>=_0x56d9ac){_0x25ee91=_0x56d9ac;_0xac948d=0xc8;}else{_0xac948d=0xce;}_0x8e4529[_0xc5f2('0x32')](_0xac948d);return _0x8e4529[_0xc5f2('0x33')](_0xc5f2('0x34'),_0x165827+'-'+_0x25ee91+'/'+_0x56d9ac)[_0xc5f2('0x2e')](_0x499e32);}return null;};}function patchUpdates(_0x361d88){return function(_0x47c329){try{jsonpatch[_0xc5f2('0x35')](_0x47c329,_0x361d88,!![]);}catch(_0xe742e8){return BPromise['reject'](_0xe742e8);}return _0x47c329[_0xc5f2('0x36')]();};}function saveUpdates(_0x2d0dd5,_0x5b4162){return function(_0x2c2edc){if(_0x2c2edc){return _0x2c2edc['update'](_0x2d0dd5)[_0xc5f2('0x22')](function(_0x4d8218){return _0x4d8218;});}return null;};}function removeEntity(_0x343b19,_0x29cfbc){return function(_0x283f64){if(_0x283f64){return _0x283f64['destroy']()[_0xc5f2('0x22')](function(){var _0x43ebd8=_0x283f64[_0xc5f2('0x37')]({'plain':!![]});var _0x21f506=_0xc5f2('0x38');return db[_0xc5f2('0x39')][_0xc5f2('0x3a')]({'where':{'type':_0x21f506,'resourceId':_0x43ebd8['id']}})['then'](function(){return _0x283f64;});})[_0xc5f2('0x22')](function(){_0x343b19['status'](0xcc)[_0xc5f2('0x3b')]();});}};}function handleEntityNotFound(_0x5bf874,_0x2e5946){return function(_0x40b4e8){if(!_0x40b4e8){_0x5bf874[_0xc5f2('0x2d')](0x194);}return _0x40b4e8;};}function handleError(_0x259c22,_0x342b75){_0x342b75=_0x342b75||0x1f4;return function(_0x37ae15){logger[_0xc5f2('0x28')](_0x37ae15[_0xc5f2('0x3c')]);if(_0x37ae15[_0xc5f2('0x3d')]){delete _0x37ae15[_0xc5f2('0x3d')];}_0x259c22['status'](_0x342b75)['send'](_0x37ae15);};}exports[_0xc5f2('0x3e')]=function(_0x3c208b,_0x573d92){var _0x18a9cb={'include':[{'model':db[_0xc5f2('0x3f')],'as':_0xc5f2('0x40')}]},_0x4aa0f7={},_0xaefd57={'count':0x0,'rows':[]};var _0x2837af=_[_0xc5f2('0x41')](db[_0xc5f2('0x42')][_0xc5f2('0x43')],function(_0x2ec071){return{'name':_0x2ec071[_0xc5f2('0x44')],'type':_0x2ec071[_0xc5f2('0x45')]['key']};});_0x4aa0f7['model']=_['map'](_0x2837af,_0xc5f2('0x3d'));_0x4aa0f7[_0xc5f2('0x46')]=_[_0xc5f2('0x47')](_0x3c208b[_0xc5f2('0x46')]);_0x4aa0f7['filters']=_[_0xc5f2('0x48')](_0x4aa0f7[_0xc5f2('0x49')],_0x4aa0f7[_0xc5f2('0x46')]);_0x18a9cb['attributes']=_[_0xc5f2('0x48')](_0x4aa0f7['model'],qs[_0xc5f2('0x4a')](_0x3c208b['query']['fields']));_0x18a9cb[_0xc5f2('0x4b')]=_0x18a9cb['attributes']['length']?_0x18a9cb['attributes']:_0x4aa0f7['model'];if(!_0x3c208b[_0xc5f2('0x46')]['hasOwnProperty'](_0xc5f2('0x4c'))){_0x18a9cb[_0xc5f2('0x31')]=qs[_0xc5f2('0x31')](_0x3c208b[_0xc5f2('0x46')]['limit']);_0x18a9cb[_0xc5f2('0x30')]=qs[_0xc5f2('0x30')](_0x3c208b[_0xc5f2('0x46')]['offset']);}_0x18a9cb[_0xc5f2('0x4d')]=qs['sort'](_0x3c208b[_0xc5f2('0x46')][_0xc5f2('0x4e')]);_0x18a9cb['where']=qs['filters'](_['pick'](_0x3c208b[_0xc5f2('0x46')],_0x4aa0f7[_0xc5f2('0x4f')]),_0x2837af);if(_0x3c208b[_0xc5f2('0x46')]['filter']){_0x18a9cb[_0xc5f2('0x50')]=_[_0xc5f2('0x51')](_0x18a9cb[_0xc5f2('0x50')],{'$or':_['map'](_0x2837af,function(_0x49292b){if(_0x49292b['type']!=='VIRTUAL'){var _0x1afb5a={};_0x1afb5a[_0x49292b[_0xc5f2('0x3d')]]={'$like':'%'+_0x3c208b[_0xc5f2('0x46')]['filter']+'%'};return _0x1afb5a;}})});}_0x18a9cb=_[_0xc5f2('0x51')]({},_0x18a9cb,_0x3c208b[_0xc5f2('0x52')]);var _0x1c61c4={'where':_0x18a9cb[_0xc5f2('0x50')]};return db[_0xc5f2('0x42')][_0xc5f2('0x2f')](_0x1c61c4)['then'](function(_0x233e44){_0xaefd57['count']=_0x233e44;if(_0x3c208b[_0xc5f2('0x46')][_0xc5f2('0x53')]){_0x18a9cb[_0xc5f2('0x54')]=[{'all':!![]}];}return db[_0xc5f2('0x42')]['findAll'](_0x18a9cb);})[_0xc5f2('0x22')](function(_0x249c4e){_0xaefd57['rows']=_0x249c4e;return _0xaefd57;})[_0xc5f2('0x22')](respondWithFilteredResult(_0x573d92,_0x18a9cb))[_0xc5f2('0x2c')](handleError(_0x573d92,null));};exports[_0xc5f2('0x55')]=function(_0x509166,_0x1251f2){var _0x3eaedf={'raw':![],'where':{'id':_0x509166[_0xc5f2('0x56')]['id']},'include':[{'model':db[_0xc5f2('0x3f')],'as':_0xc5f2('0x40')}]},_0x45d0aa={};_0x45d0aa[_0xc5f2('0x49')]=_[_0xc5f2('0x47')](db['FaxAccount'][_0xc5f2('0x43')]);_0x45d0aa[_0xc5f2('0x46')]=_[_0xc5f2('0x47')](_0x509166[_0xc5f2('0x46')]);_0x45d0aa['filters']=_[_0xc5f2('0x48')](_0x45d0aa[_0xc5f2('0x49')],_0x45d0aa[_0xc5f2('0x46')]);_0x3eaedf[_0xc5f2('0x4b')]=_[_0xc5f2('0x48')](_0x45d0aa[_0xc5f2('0x49')],qs[_0xc5f2('0x4a')](_0x509166['query'][_0xc5f2('0x4a')]));_0x3eaedf[_0xc5f2('0x4b')]=_0x3eaedf['attributes'][_0xc5f2('0x57')]?_0x3eaedf[_0xc5f2('0x4b')]:_0x45d0aa[_0xc5f2('0x49')];if(_0x509166[_0xc5f2('0x46')][_0xc5f2('0x53')]){_0x3eaedf[_0xc5f2('0x54')]=[{'all':!![]}];}_0x3eaedf=_['merge']({},_0x3eaedf,_0x509166[_0xc5f2('0x52')]);return db[_0xc5f2('0x42')][_0xc5f2('0x58')](_0x3eaedf)[_0xc5f2('0x22')](handleEntityNotFound(_0x1251f2,null))[_0xc5f2('0x22')](respondWithResult(_0x1251f2,null))[_0xc5f2('0x2c')](handleError(_0x1251f2,null));};exports[_0xc5f2('0x59')]=function(_0x4d7123,_0x4b8b79){return db[_0xc5f2('0x42')][_0xc5f2('0x59')](_0x4d7123[_0xc5f2('0x5a')],{})[_0xc5f2('0x22')](function(_0x144b4f){var _0x22d384=_0x4d7123[_0xc5f2('0x5b')]['get']({'plain':!![]});if(!_0x22d384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22d384[_0xc5f2('0x5c')]===_0xc5f2('0x5b')){var _0x4290e8=_0x144b4f[_0xc5f2('0x37')]({'plain':!![]});var _0xd6d350=_0xc5f2('0x38');return db[_0xc5f2('0x5d')][_0xc5f2('0x58')]({'where':{'name':_0xd6d350,'userProfileId':_0x22d384[_0xc5f2('0x5e')]},'raw':!![]})[_0xc5f2('0x22')](function(_0x51e6c2){if(_0x51e6c2&&_0x51e6c2[_0xc5f2('0x5f')]===0x0){return db[_0xc5f2('0x39')][_0xc5f2('0x59')]({'name':_0x4290e8[_0xc5f2('0x3d')],'resourceId':_0x4290e8['id'],'type':_0x51e6c2['name'],'sectionId':_0x51e6c2['id']},{})['then'](function(){return _0x144b4f;});}else{return _0x144b4f;}})[_0xc5f2('0x2c')](function(_0x5c8ef3){logger[_0xc5f2('0x28')](_0xc5f2('0x60'),_0x5c8ef3);throw _0x5c8ef3;});}return _0x144b4f;})[_0xc5f2('0x22')](respondWithResult(_0x4b8b79,0xc9))[_0xc5f2('0x2c')](handleError(_0x4b8b79,null));};exports[_0xc5f2('0x61')]=function(_0xc79db1,_0x5856a7){if(_0xc79db1[_0xc5f2('0x5a')]['id']){delete _0xc79db1[_0xc5f2('0x5a')]['id'];}return db[_0xc5f2('0x42')]['find']({'where':{'id':_0xc79db1[_0xc5f2('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc5f2('0x22')](handleEntityNotFound(_0x5856a7,null))[_0xc5f2('0x22')](saveUpdates(_0xc79db1[_0xc5f2('0x5a')],null))[_0xc5f2('0x22')](respondWithResult(_0x5856a7,null))[_0xc5f2('0x2c')](handleError(_0x5856a7,null));};exports[_0xc5f2('0x3a')]=function(_0x1e3bfe,_0x568f6e){return db[_0xc5f2('0x42')][_0xc5f2('0x58')]({'where':{'id':_0x1e3bfe[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x568f6e,null))[_0xc5f2('0x22')](removeEntity(_0x568f6e,null))[_0xc5f2('0x2c')](handleError(_0x568f6e,null));};exports[_0xc5f2('0x62')]=function(_0x174c14,_0xf7c411){return db['FaxAccount'][_0xc5f2('0x62')]()[_0xc5f2('0x22')](respondWithResult(_0xf7c411,null))[_0xc5f2('0x2c')](handleError(_0xf7c411,null));};exports[_0xc5f2('0x63')]=function(_0x51a342,_0x57fb85,_0x2ff122){if(_0x51a342[_0xc5f2('0x5a')]['id']){delete _0x51a342[_0xc5f2('0x5a')]['id'];}return db[_0xc5f2('0x42')][_0xc5f2('0x58')]({'where':{'id':_0x51a342['params']['id']}})['then'](handleEntityNotFound(_0x57fb85,null))['then'](function(_0x351ca8){if(_0x351ca8){_0x51a342[_0xc5f2('0x5a')][_0xc5f2('0x64')]=_0x351ca8['id'];return db[_0xc5f2('0x65')][_0xc5f2('0x59')](_0x51a342[_0xc5f2('0x5a')]);}})[_0xc5f2('0x22')](respondWithResult(_0x57fb85,null))['catch'](handleError(_0x57fb85,null));};exports['getDispositions']=function(_0xad919b,_0xaa45de,_0x553fc9){var _0x1d1d4f={'raw':![],'where':{}};var _0x49006c={};var _0x277e24={'count':0x0,'rows':[]};return db[_0xc5f2('0x42')][_0xc5f2('0x66')]({'where':{'id':_0xad919b[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0xaa45de,null))[_0xc5f2('0x22')](function(_0x29a112){if(_0x29a112){_0x49006c[_0xc5f2('0x49')]=_[_0xc5f2('0x47')](db[_0xc5f2('0x65')][_0xc5f2('0x43')]);_0x49006c['query']=_[_0xc5f2('0x47')](_0xad919b[_0xc5f2('0x46')]);_0x49006c[_0xc5f2('0x4f')]=_['intersection'](_0x49006c[_0xc5f2('0x49')],_0x49006c['query']);_0x1d1d4f[_0xc5f2('0x4b')]=_[_0xc5f2('0x48')](_0x49006c[_0xc5f2('0x49')],qs['fields'](_0xad919b[_0xc5f2('0x46')][_0xc5f2('0x4a')]));_0x1d1d4f[_0xc5f2('0x4b')]=_0x1d1d4f[_0xc5f2('0x4b')][_0xc5f2('0x57')]?_0x1d1d4f[_0xc5f2('0x4b')]:_0x49006c[_0xc5f2('0x49')];if(!_0xad919b['query']['hasOwnProperty']('nolimit')){_0x1d1d4f[_0xc5f2('0x31')]=qs[_0xc5f2('0x31')](_0xad919b['query'][_0xc5f2('0x31')]);_0x1d1d4f[_0xc5f2('0x30')]=qs['offset'](_0xad919b[_0xc5f2('0x46')][_0xc5f2('0x30')]);}_0x1d1d4f[_0xc5f2('0x4d')]=qs[_0xc5f2('0x4e')](_0xad919b[_0xc5f2('0x46')][_0xc5f2('0x4e')]);_0x1d1d4f['where']=qs[_0xc5f2('0x4f')](_['pick'](_0xad919b[_0xc5f2('0x46')],_0x49006c['filters']));_0x1d1d4f[_0xc5f2('0x50')]['FaxAccountId']=_0x29a112['id'];if(_0xad919b[_0xc5f2('0x46')][_0xc5f2('0x67')]){_0x1d1d4f['where']=_['merge'](_0x1d1d4f['where'],{'$or':_[_0xc5f2('0x41')](_0x1d1d4f[_0xc5f2('0x4b')],function(_0x3a5aee){var _0x23e135={};_0x23e135[_0x3a5aee]={'$like':'%'+_0xad919b[_0xc5f2('0x46')]['filter']+'%'};return _0x23e135;})});}_0x1d1d4f=_['merge']({},_0x1d1d4f,_0xad919b[_0xc5f2('0x52')]);return db[_0xc5f2('0x65')][_0xc5f2('0x2f')]({'where':_0x1d1d4f[_0xc5f2('0x50')]})[_0xc5f2('0x22')](function(_0x48965d){_0x277e24[_0xc5f2('0x2f')]=_0x48965d;if(_0xad919b[_0xc5f2('0x46')][_0xc5f2('0x53')]){_0x1d1d4f[_0xc5f2('0x54')]=[{'all':!![]}];}return db[_0xc5f2('0x65')][_0xc5f2('0x68')](_0x1d1d4f);})[_0xc5f2('0x22')](function(_0x3a619c){_0x277e24[_0xc5f2('0x69')]=_0x3a619c;return _0x277e24;});}})[_0xc5f2('0x22')](respondWithFilteredResult(_0xaa45de,_0x1d1d4f))['catch'](handleError(_0xaa45de,null));};exports[_0xc5f2('0x6a')]=function(_0x5ff060,_0x989b,_0x475382){return db[_0xc5f2('0x42')][_0xc5f2('0x58')]({'where':{'id':_0x5ff060[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x989b,null))[_0xc5f2('0x22')](function(_0x28ee4a){if(_0x28ee4a){return _0x28ee4a[_0xc5f2('0x6a')](_0x5ff060[_0xc5f2('0x46')][_0xc5f2('0x6b')]);}})[_0xc5f2('0x22')](respondWithStatusCode(_0x989b,null))[_0xc5f2('0x2c')](handleError(_0x989b,null));};exports[_0xc5f2('0x6c')]=function(_0x541821,_0xbed133,_0x47c8f0){if(_0x541821['body']['id']){delete _0x541821['body']['id'];}return db['FaxAccount'][_0xc5f2('0x58')]({'where':{'id':_0x541821[_0xc5f2('0x56')]['id']}})['then'](handleEntityNotFound(_0xbed133,null))[_0xc5f2('0x22')](function(_0x516bf4){if(_0x516bf4){_0x541821['body'][_0xc5f2('0x64')]=_0x516bf4['id'];return db[_0xc5f2('0x6d')][_0xc5f2('0x59')](_0x541821[_0xc5f2('0x5a')]);}})[_0xc5f2('0x22')](respondWithResult(_0xbed133,null))[_0xc5f2('0x2c')](handleError(_0xbed133,null));};exports['getAnswers']=function(_0x460f69,_0x129d48,_0x54ee03){var _0x48720a={'raw':![],'where':{}};var _0xf6983c={};var _0x2b5870={'count':0x0,'rows':[]};return db[_0xc5f2('0x42')][_0xc5f2('0x66')]({'where':{'id':_0x460f69[_0xc5f2('0x56')]['id']}})['then'](handleEntityNotFound(_0x129d48,null))[_0xc5f2('0x22')](function(_0xa339d){if(_0xa339d){_0xf6983c['model']=_['keys'](db[_0xc5f2('0x6d')][_0xc5f2('0x43')]);_0xf6983c[_0xc5f2('0x46')]=_['keys'](_0x460f69['query']);_0xf6983c[_0xc5f2('0x4f')]=_[_0xc5f2('0x48')](_0xf6983c[_0xc5f2('0x49')],_0xf6983c[_0xc5f2('0x46')]);_0x48720a[_0xc5f2('0x4b')]=_[_0xc5f2('0x48')](_0xf6983c['model'],qs[_0xc5f2('0x4a')](_0x460f69[_0xc5f2('0x46')][_0xc5f2('0x4a')]));_0x48720a[_0xc5f2('0x4b')]=_0x48720a[_0xc5f2('0x4b')][_0xc5f2('0x57')]?_0x48720a['attributes']:_0xf6983c['model'];if(!_0x460f69[_0xc5f2('0x46')][_0xc5f2('0x6e')](_0xc5f2('0x4c'))){_0x48720a[_0xc5f2('0x31')]=qs['limit'](_0x460f69['query'][_0xc5f2('0x31')]);_0x48720a['offset']=qs[_0xc5f2('0x30')](_0x460f69[_0xc5f2('0x46')][_0xc5f2('0x30')]);}_0x48720a[_0xc5f2('0x4d')]=qs['sort'](_0x460f69[_0xc5f2('0x46')][_0xc5f2('0x4e')]);_0x48720a['where']=qs[_0xc5f2('0x4f')](_[_0xc5f2('0x6f')](_0x460f69[_0xc5f2('0x46')],_0xf6983c[_0xc5f2('0x4f')]));_0x48720a[_0xc5f2('0x50')][_0xc5f2('0x64')]=_0xa339d['id'];if(_0x460f69['query']['filter']){_0x48720a[_0xc5f2('0x50')]=_[_0xc5f2('0x51')](_0x48720a[_0xc5f2('0x50')],{'$or':_['map'](_0x48720a[_0xc5f2('0x4b')],function(_0x9e7f6){var _0x113d4e={};_0x113d4e[_0x9e7f6]={'$like':'%'+_0x460f69['query']['filter']+'%'};return _0x113d4e;})});}_0x48720a=_['merge']({},_0x48720a,_0x460f69[_0xc5f2('0x52')]);return db[_0xc5f2('0x6d')][_0xc5f2('0x2f')]({'where':_0x48720a['where']})[_0xc5f2('0x22')](function(_0x194bbd){_0x2b5870[_0xc5f2('0x2f')]=_0x194bbd;if(_0x460f69['query'][_0xc5f2('0x53')]){_0x48720a[_0xc5f2('0x54')]=[{'all':!![]}];}return db[_0xc5f2('0x6d')][_0xc5f2('0x68')](_0x48720a);})[_0xc5f2('0x22')](function(_0x582c8c){_0x2b5870[_0xc5f2('0x69')]=_0x582c8c;return _0x2b5870;});}})[_0xc5f2('0x22')](respondWithFilteredResult(_0x129d48,_0x48720a))[_0xc5f2('0x2c')](handleError(_0x129d48,null));};exports[_0xc5f2('0x70')]=function(_0x361593,_0x383eb3,_0x40c10e){return db[_0xc5f2('0x42')]['find']({'where':{'id':_0x361593[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x383eb3,null))[_0xc5f2('0x22')](function(_0x26a0dc){if(_0x26a0dc){return _0x26a0dc[_0xc5f2('0x70')](_0x361593[_0xc5f2('0x46')]['ids']);}})[_0xc5f2('0x22')](respondWithStatusCode(_0x383eb3,null))[_0xc5f2('0x2c')](handleError(_0x383eb3,null));};exports[_0xc5f2('0x71')]=function(_0x436540,_0x3a6630,_0x292fa2){return db['FaxInteraction']['find']({'where':{'id':_0x436540[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x3a6630,null))[_0xc5f2('0x22')](function(_0x4f8f17){if(_0x4f8f17){return _0x4f8f17['addInteraction'](_0x436540['body'][_0xc5f2('0x6b')],_[_0xc5f2('0x72')](_0x436540[_0xc5f2('0x5a')],[_0xc5f2('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x3a6630,null))[_0xc5f2('0x2c')](handleError(_0x3a6630,null));};exports[_0xc5f2('0x73')]=function(_0x38a2bd,_0x4fcb77,_0x263044){var _0x28c2aa={'raw':![],'where':{}};var _0x5a6dfc={};var _0x58959c={'count':0x0,'rows':[]};return db[_0xc5f2('0x42')][_0xc5f2('0x66')]({'where':{'id':_0x38a2bd[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x4fcb77,null))[_0xc5f2('0x22')](function(_0x2e53df){if(_0x2e53df){_0x5a6dfc[_0xc5f2('0x49')]=_[_0xc5f2('0x47')](db['FaxInteraction'][_0xc5f2('0x43')]);_0x5a6dfc[_0xc5f2('0x46')]=_['keys'](_0x38a2bd[_0xc5f2('0x46')]);_0x5a6dfc[_0xc5f2('0x4f')]=_[_0xc5f2('0x48')](_0x5a6dfc[_0xc5f2('0x49')],_0x5a6dfc[_0xc5f2('0x46')]);_0x28c2aa[_0xc5f2('0x4b')]=_['intersection'](_0x5a6dfc[_0xc5f2('0x49')],qs[_0xc5f2('0x4a')](_0x38a2bd[_0xc5f2('0x46')]['fields']));_0x28c2aa['attributes']=_0x28c2aa[_0xc5f2('0x4b')][_0xc5f2('0x57')]?_0x28c2aa[_0xc5f2('0x4b')]:_0x5a6dfc['model'];if(!_0x38a2bd[_0xc5f2('0x46')]['hasOwnProperty'](_0xc5f2('0x4c'))){_0x28c2aa[_0xc5f2('0x31')]=qs[_0xc5f2('0x31')](_0x38a2bd[_0xc5f2('0x46')]['limit']);_0x28c2aa['offset']=qs['offset'](_0x38a2bd['query'][_0xc5f2('0x30')]);}_0x28c2aa['order']=qs[_0xc5f2('0x4e')](_0x38a2bd[_0xc5f2('0x46')]['sort']);_0x28c2aa[_0xc5f2('0x50')]=qs[_0xc5f2('0x4f')](_[_0xc5f2('0x6f')](_0x38a2bd[_0xc5f2('0x46')],_0x5a6dfc['filters']));_0x28c2aa[_0xc5f2('0x50')]['FaxAccountId']=_0x2e53df['id'];if(_0x38a2bd[_0xc5f2('0x46')][_0xc5f2('0x67')]){_0x28c2aa['where']=_[_0xc5f2('0x51')](_0x28c2aa['where'],{'$or':_[_0xc5f2('0x41')](_0x28c2aa[_0xc5f2('0x4b')],function(_0x30c2d0){var _0x567e6b={};_0x567e6b[_0x30c2d0]={'$like':'%'+_0x38a2bd[_0xc5f2('0x46')][_0xc5f2('0x67')]+'%'};return _0x567e6b;})});}_0x28c2aa=_['merge']({},_0x28c2aa,_0x38a2bd['options']);return db[_0xc5f2('0x74')][_0xc5f2('0x2f')]({'where':_0x28c2aa[_0xc5f2('0x50')]})[_0xc5f2('0x22')](function(_0x2de650){_0x58959c[_0xc5f2('0x2f')]=_0x2de650;if(_0x38a2bd['query']['includeAll']){_0x28c2aa['include']=[{'model':db[_0xc5f2('0x75')],'as':_0xc5f2('0x76'),'required':![]},{'model':db[_0xc5f2('0x77')],'as':_0xc5f2('0x78'),'attributes':[_0xc5f2('0x3d'),_0xc5f2('0x79'),_0xc5f2('0x7a')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xc5f2('0x3d'),_0xc5f2('0x7b')],'where':_0x38a2bd[_0xc5f2('0x46')][_0xc5f2('0x7c')]?{'id':_0x38a2bd[_0xc5f2('0x46')][_0xc5f2('0x7c')]}:undefined,'required':_0x38a2bd[_0xc5f2('0x46')][_0xc5f2('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0xc5f2('0x68')](_0x28c2aa);})[_0xc5f2('0x22')](function(_0x220348){_0x58959c[_0xc5f2('0x69')]=_0x220348;return _0x58959c;});}})[_0xc5f2('0x22')](respondWithFilteredResult(_0x4fcb77,_0x28c2aa))[_0xc5f2('0x2c')](handleError(_0x4fcb77,null));};exports[_0xc5f2('0x7d')]=function(_0x149af2,_0x12b02e,_0x2c7762){return db[_0xc5f2('0x42')][_0xc5f2('0x66')]({'where':{'id':_0x149af2[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x12b02e,null))['then'](function(_0x4693f3){if(_0x4693f3){return db[_0xc5f2('0x7e')]['transaction'](function(_0x22ab3b){return db[_0xc5f2('0x7f')]['destroy']({'where':{'FaxAccountId':_0x149af2['params']['id']},'transaction':_0x22ab3b})[_0xc5f2('0x22')](function(_0x1edbdc){var _0x7f8bf8=_[_0xc5f2('0x41')](_0x149af2[_0xc5f2('0x5a')],function(_0xe2ad19){_0xe2ad19['FaxAccountId']=_0x149af2[_0xc5f2('0x56')]['id'];return _0xe2ad19;});return db[_0xc5f2('0x7f')][_0xc5f2('0x80')](_0x7f8bf8,{'transaction':_0x22ab3b});});})[_0xc5f2('0x22')](function(){return db['FaxApplication'][_0xc5f2('0x81')]({'where':{'FaxAccountId':_0x149af2[_0xc5f2('0x56')]['id']},'order':'priority'});});}})[_0xc5f2('0x22')](respondWithResult(_0x12b02e,null))[_0xc5f2('0x2c')](handleError(_0x12b02e,null));};exports[_0xc5f2('0x82')]=function(_0xba89e1,_0x12b037,_0x43e0f4){var _0x1f6c6e={};var _0x4d10ba={};var _0x5b8470;var _0x174531;return db[_0xc5f2('0x42')][_0xc5f2('0x66')]({'where':{'id':_0xba89e1[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x12b037,null))[_0xc5f2('0x22')](function(_0x150ab9){if(_0x150ab9){_0x5b8470=_0x150ab9;_0x4d10ba[_0xc5f2('0x49')]=_[_0xc5f2('0x47')](db[_0xc5f2('0x7f')]['rawAttributes']);_0x4d10ba[_0xc5f2('0x46')]=_[_0xc5f2('0x47')](_0xba89e1[_0xc5f2('0x46')]);_0x4d10ba['filters']=_['intersection'](_0x4d10ba['model'],_0x4d10ba[_0xc5f2('0x46')]);_0x1f6c6e['attributes']=_['intersection'](_0x4d10ba[_0xc5f2('0x49')],qs[_0xc5f2('0x4a')](_0xba89e1['query'][_0xc5f2('0x4a')]));_0x1f6c6e['attributes']=_0x1f6c6e['attributes']['length']?_0x1f6c6e[_0xc5f2('0x4b')]:_0x4d10ba[_0xc5f2('0x49')];_0x1f6c6e['order']=qs['sort'](_0xba89e1[_0xc5f2('0x46')][_0xc5f2('0x4e')]);_0x1f6c6e[_0xc5f2('0x50')]=qs[_0xc5f2('0x4f')](_[_0xc5f2('0x6f')](_0xba89e1['query'],_0x4d10ba[_0xc5f2('0x4f')]));if(_0xba89e1[_0xc5f2('0x46')]['filter']){_0x1f6c6e['where']=_[_0xc5f2('0x51')](_0x1f6c6e['where'],{'$or':_[_0xc5f2('0x41')](_0x1f6c6e['attributes'],function(_0x3d2dd1){var _0x22d521={};_0x22d521[_0x3d2dd1]={'$like':'%'+_0xba89e1[_0xc5f2('0x46')][_0xc5f2('0x67')]+'%'};return _0x22d521;})});}_0x1f6c6e=_[_0xc5f2('0x51')]({},_0x1f6c6e,_0xba89e1[_0xc5f2('0x52')]);return _0x5b8470[_0xc5f2('0x82')](_0x1f6c6e);}})[_0xc5f2('0x22')](function(_0x1972cf){if(_0x1972cf){_0x174531=_0x1972cf[_0xc5f2('0x57')];if(!_0xba89e1['query'][_0xc5f2('0x6e')](_0xc5f2('0x4c'))){_0x1f6c6e[_0xc5f2('0x31')]=qs[_0xc5f2('0x31')](_0xba89e1[_0xc5f2('0x46')][_0xc5f2('0x31')]);_0x1f6c6e[_0xc5f2('0x30')]=qs[_0xc5f2('0x30')](_0xba89e1[_0xc5f2('0x46')]['offset']);}return _0x5b8470['getApplications'](_0x1f6c6e);}})['then'](function(_0x7d59e6){if(_0x7d59e6){return _0x7d59e6?{'count':_0x174531,'rows':_0x7d59e6}:null;}})[_0xc5f2('0x22')](respondWithResult(_0x12b037,null))[_0xc5f2('0x2c')](handleError(_0x12b037,null));};function Extension(_0x417175,_0x289cb1,_0x1dde15,_0x33fa08){this[_0xc5f2('0x83')]=_0xc5f2('0x84');this[_0xc5f2('0x85')]=_0x417175[_0xc5f2('0x86')];this[_0xc5f2('0x87')]=_0x33fa08;this['type']='system';this['description']=_0xc5f2('0x88');this['FaxAccountId']=_0x417175['id'];this[_0xc5f2('0x89')]=_0x289cb1;this[_0xc5f2('0x8a')]=_0x1dde15;}function createExtensionsReciveFax(_0x255504){var _0x45d922=0x1;var _0x3ee479=[];_0x3ee479[_0xc5f2('0x8b')](new Extension(_0x255504,_0x45d922,'',_0xc5f2('0x8c')));_0x45d922+=0x1;_0x3ee479[_0xc5f2('0x8b')](new Extension(_0x255504,_0x45d922,_0xc5f2('0x8d'),'Set'));_0x45d922+=0x1;for(var _0x41f6b4 in _0x255504){if(_0x255504['hasOwnProperty'](_0x41f6b4)&&(_0x41f6b4==='ecm'||_0x41f6b4==='localstationid'||_0x41f6b4===_0xc5f2('0x8e')||_0x41f6b4===_0xc5f2('0x8f')||_0x41f6b4===_0xc5f2('0x90')||_0x41f6b4===_0xc5f2('0x91')||_0x41f6b4==='minrate'||_0x41f6b4===_0xc5f2('0x92')||_0x41f6b4===_0xc5f2('0x93'))){_0x3ee479[_0xc5f2('0x8b')](new Extension(_0x255504,_0x45d922,_0xc5f2('0x94')+_0x41f6b4+')='+_0x255504[_0x41f6b4],'Set'));_0x45d922+=0x1;}}_0x3ee479['push'](new Extension(_0x255504,_0x45d922,'6',_0xc5f2('0x95')));_0x45d922+=0x1;_0x3ee479['push'](new Extension(_0x255504,_0x45d922,'/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'));_0x45d922=0x0;return _0x3ee479;}exports[_0xc5f2('0x96')]=function(_0x147224,_0x3f32c0,_0x5e606f){var _0x1c2ce2;return db[_0xc5f2('0x7e')]['transaction'](function(_0x304bfb){return db[_0xc5f2('0x42')][_0xc5f2('0x59')](_0x147224[_0xc5f2('0x5a')],{'transaction':_0x304bfb})['then'](function(_0x23d45a){_0x1c2ce2=_0x23d45a[_0xc5f2('0x37')]({'plain':!![]});return db[_0xc5f2('0x97')][_0xc5f2('0x80')](createExtensionsReciveFax(_0x1c2ce2),{'transaction':_0x304bfb});});})[_0xc5f2('0x22')](function(){return _0x1c2ce2;})['then'](respondWithResult(_0x3f32c0,null))[_0xc5f2('0x2c')](handleError(_0x3f32c0,null));};exports[_0xc5f2('0x98')]=function(_0x2542c4,_0x281675,_0x233b77){var _0x14e9e1;return db[_0xc5f2('0x7e')][_0xc5f2('0x99')](function(_0x334df4){return db[_0xc5f2('0x42')]['update'](_0x2542c4[_0xc5f2('0x5a')],{'where':{'id':_0x2542c4[_0xc5f2('0x5a')]['id']},'transaction':_0x334df4})['then'](function(_0x59c466){return db[_0xc5f2('0x97')]['destroy']({'where':{'FaxAccountId':_0x2542c4[_0xc5f2('0x5a')]['id']},'transaction':_0x334df4})['then'](function(_0x25eef6){return db[_0xc5f2('0x97')][_0xc5f2('0x80')](createExtensionsReciveFax(_[_0xc5f2('0x72')](_0x2542c4[_0xc5f2('0x5a')],[_0xc5f2('0x9a'),_0xc5f2('0x9b'),'createdAt',_0xc5f2('0x9c'),_0xc5f2('0x9d'),'ListId'])),{'transaction':_0x334df4});});});})[_0xc5f2('0x22')](function(){return db[_0xc5f2('0x42')]['findById'](_0x2542c4[_0xc5f2('0x5a')]['id']);})[_0xc5f2('0x22')](respondWithResult(_0x281675,null))[_0xc5f2('0x2c')](handleError(_0x281675,null));};exports[_0xc5f2('0x9e')]=function(_0x359440,_0x5974ff,_0x2adf5c){var _0x4de285={'raw':!![],'where':{}};var _0x34b20b={};var _0x4753bc={'count':0x0,'rows':[]};return db[_0xc5f2('0x42')]['findOne']({'where':{'id':_0x359440[_0xc5f2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5974ff,null))[_0xc5f2('0x22')](function(_0x94cc9c){if(_0x94cc9c){_0x34b20b['model']=_[_0xc5f2('0x47')](db[_0xc5f2('0x9f')][_0xc5f2('0x43')]);_0x34b20b['query']=_[_0xc5f2('0x47')](_0x359440[_0xc5f2('0x46')]);_0x34b20b['filters']=_[_0xc5f2('0x48')](_0x34b20b[_0xc5f2('0x49')],_0x34b20b[_0xc5f2('0x46')]);_0x4de285[_0xc5f2('0x4b')]=_[_0xc5f2('0x48')](_0x34b20b[_0xc5f2('0x49')],qs[_0xc5f2('0x4a')](_0x359440[_0xc5f2('0x46')]['fields']));_0x4de285['attributes']=_0x4de285['attributes'][_0xc5f2('0x57')]?_0x4de285[_0xc5f2('0x4b')]:_0x34b20b[_0xc5f2('0x49')];if(!_0x359440[_0xc5f2('0x46')]['hasOwnProperty'](_0xc5f2('0x4c'))){_0x4de285[_0xc5f2('0x31')]=qs[_0xc5f2('0x31')](_0x359440[_0xc5f2('0x46')][_0xc5f2('0x31')]);_0x4de285[_0xc5f2('0x30')]=qs[_0xc5f2('0x30')](_0x359440[_0xc5f2('0x46')][_0xc5f2('0x30')]);}_0x4de285['order']=qs['sort'](_0x359440[_0xc5f2('0x46')][_0xc5f2('0x4e')]);_0x4de285[_0xc5f2('0x50')]=qs['filters'](_['pick'](_0x359440['query'],_0x34b20b[_0xc5f2('0x4f')]));_0x4de285['where'][_0xc5f2('0x64')]=_0x94cc9c['id'];if(_0x359440[_0xc5f2('0x46')][_0xc5f2('0x67')]){_0x4de285[_0xc5f2('0x50')]=_['merge'](_0x4de285[_0xc5f2('0x50')],{'$or':_[_0xc5f2('0x41')](_0x4de285[_0xc5f2('0x4b')],function(_0x594d7a){var _0x2b8b23={};_0x2b8b23[_0x594d7a]={'$like':'%'+_0x359440[_0xc5f2('0x46')]['filter']+'%'};return _0x2b8b23;})});}if(_0x359440[_0xc5f2('0x46')]['$gte']){var _0xdcf9b1=_0x359440[_0xc5f2('0x46')][_0xc5f2('0xa0')][_0xc5f2('0xa1')](',');var _0x2ce35a={};_0x2ce35a[_0xdcf9b1[0x0]]={'$gte':moment(_0xdcf9b1[0x1])[_0xc5f2('0xa2')](_0xc5f2('0xa3'))};_0x4de285[_0xc5f2('0x50')]=_['merge'](_0x4de285[_0xc5f2('0x50')],_0x2ce35a);}_0x4de285=_[_0xc5f2('0x51')]({},_0x4de285,_0x359440[_0xc5f2('0x52')]);return db[_0xc5f2('0x9f')]['count']({'where':_0x4de285['where']})[_0xc5f2('0x22')](function(_0x908123){_0x4753bc['count']=_0x908123;if(_0x359440[_0xc5f2('0x46')]['includeAll']){_0x4de285['include']=[{'all':!![]}];}return db[_0xc5f2('0x9f')]['findAll'](_0x4de285);})['then'](function(_0xe6dcda){_0x4753bc['rows']=_0xe6dcda;return _0x4753bc;});}})[_0xc5f2('0x22')](respondWithFilteredResult(_0x5974ff,_0x4de285))[_0xc5f2('0x2c')](handleError(_0x5974ff,null));};exports[_0xc5f2('0xa4')]=function(_0x1d8181,_0x5dc6f3,_0x238b1a){var _0x3eb916,_0x4dea1a={},_0x27b399;if(_0x1d8181[_0xc5f2('0x5a')]['to']){_0x27b399=_0x1d8181[_0xc5f2('0x5a')]['to'][0x0];}return db[_0xc5f2('0x42')][_0xc5f2('0x58')]({'where':{'id':_0x1d8181[_0xc5f2('0x56')]['id']},'include':[{'model':db[_0xc5f2('0xa5')],'as':_0xc5f2('0xa6'),'include':[{'model':db['CmContact'],'as':_0xc5f2('0xa7'),'where':{'fax':_0x27b399},'limit':0x1,'order':[[_0xc5f2('0x9c'),_0xc5f2('0xa8')]]}]}]})[_0xc5f2('0x22')](handleEntityNotFound(_0x5dc6f3,null))[_0xc5f2('0x22')](function(_0x52c405){_0x3eb916=_0x52c405;if(_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')]&&_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')][_0xc5f2('0x57')]){for(var _0x52d3d5=0x0;_0x52d3d5<_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')]['length'];_0x52d3d5+=0x1){_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')][_0x52d3d5]={'filename':_0x1d8181['body'][_0xc5f2('0xa9')][_0x52d3d5][_0xc5f2('0x3d')],'id':_0x1d8181['body'][_0xc5f2('0xa9')][_0x52d3d5]['id'],'path':path['join'](config['root'],_0xc5f2('0xaa'),_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')][_0x52d3d5][_0xc5f2('0xab')])};}}return respondWithRpcPromise(_0xc5f2('0xac'),_0xc5f2('0xac'),{'FaxAccountId':_[_0xc5f2('0xad')](_0x1d8181['params']['id'])?undefined:_0x1d8181[_0xc5f2('0x56')]['id'],'path':_['isNil'](_0x1d8181[_0xc5f2('0x5a')]['attachments'][0x0][_0xc5f2('0x7')])?undefined:_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')][0x0][_0xc5f2('0x7')],'fax':_[_0xc5f2('0xad')](_0x1d8181['body']['to'][0x0])?undefined:_0x1d8181[_0xc5f2('0x5a')]['to'][0x0]},client9002);})[_0xc5f2('0x22')](function(){if(_0x3eb916){if(_[_0xc5f2('0xad')](_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xae')])){_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xae')]=util[_0xc5f2('0xa2')](_0xc5f2('0xaf'),_0x3eb916[_0xc5f2('0x3d')],_0x3eb916['fax']);}if(_0x3eb916['List']){if(_0x3eb916[_0xc5f2('0xa6')][_0xc5f2('0xa7')][_0xc5f2('0x57')]){return _0x3eb916[_0xc5f2('0xa6')][_0xc5f2('0xa7')][0x0];}else{return db[_0xc5f2('0x75')]['create'](_[_0xc5f2('0x18')](_0x1d8181[_0xc5f2('0x5a')],{'firstName':_0x1d8181['body']['to'][0x0],'phone':_0x1d8181['body']['to'][0x0],'fax':_0x1d8181[_0xc5f2('0x5a')]['to'][0x0],'ListId':_0x3eb916[_0xc5f2('0xb0')]}));}}else{throw new Error(_0xc5f2('0xb1'));}}else{throw new Error(_0xc5f2('0xb2'));}})['then'](function(_0x623525){if(_0x623525){return db['FaxInteraction']['find']({'where':{'ContactId':_0x623525['id'],'closed':![],'FaxAccountId':_0x3eb916['id']}})[_0xc5f2('0x22')](function(_0x412457){if(_0x412457){return[_0x412457,![]];}return db['FaxInteraction']['create']({'UserId':_0x1d8181[_0xc5f2('0x5b')]['id'],'ContactId':_0x623525['id'],'FaxAccountId':_0x3eb916['id'],'fax':_0x1d8181[_0xc5f2('0x5a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xc5f2('0x51')](_0x1d8181[_0xc5f2('0x5a')],{'read':![],'body':_0x1d8181['body'][_0xc5f2('0xa9')][0x0]['filename'],'FaxAccountId':_0x3eb916['id'],'UserId':_0x1d8181['user']['id'],'ContactId':_0x623525['id'],'AttachmentId':_0x1d8181['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xc5f2('0xb3')}]})[_0xc5f2('0x22')](function(_0x22972b){return[_0x22972b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc5f2('0xb4')](function(_0x5d671b,_0x5df3b6){if(_0x5df3b6){return _0x5d671b;}return db[_0xc5f2('0x9f')][_0xc5f2('0x59')]({'direction':_0xc5f2('0xb5'),'read':![],'body':_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')][0x0][_0xc5f2('0xb6')],'FaxAccountId':_0x3eb916['id'],'FaxInteractionId':_0x5d671b['id'],'UserId':_0x1d8181[_0xc5f2('0x5b')]['id'],'ContactId':_0x5d671b[_0xc5f2('0xb7')],'AttachmentId':_0x1d8181[_0xc5f2('0x5a')]['attachments'][0x0]['id']})[_0xc5f2('0x22')](function(_0x4f5d3a){_0x5d671b[_0xc5f2('0xb8')][_0xc5f2('0xb3')]=[];_0x5d671b[_0xc5f2('0xb8')]['Messages'][_0xc5f2('0x8b')](_0x4f5d3a[_0xc5f2('0xb8')]);return _0x5d671b;});})['then'](function(_0x4a1ac3){respondWithRpcPromise(_0xc5f2('0xb9'),_0xc5f2('0xb9'),{'FaxAccountId':_[_0xc5f2('0xad')](_0x1d8181[_0xc5f2('0x56')]['id'])?undefined:_0x1d8181[_0xc5f2('0x56')]['id'],'path':_[_0xc5f2('0xad')](_0x1d8181[_0xc5f2('0x5a')]['attachments'][0x0][_0xc5f2('0x7')])?undefined:_0x1d8181[_0xc5f2('0x5a')][_0xc5f2('0xa9')][0x0][_0xc5f2('0x7')],'fax':_[_0xc5f2('0xad')](_0x1d8181[_0xc5f2('0x5a')]['to'][0x0])?undefined:_0x1d8181[_0xc5f2('0x5a')]['to'][0x0],'AttachmentId':_0x1d8181['body']['attachments'][0x0]['id']},client9002)[_0xc5f2('0x22')](function(_0x1abd01){logger[_0xc5f2('0x2a')](_0xc5f2('0xba'),_0x1abd01);})[_0xc5f2('0x2c')](function(_0xcac402){logger[_0xc5f2('0x2a')]('SendFaxRpc,\x20%s',_0xcac402);});return _0x4a1ac3;})[_0xc5f2('0x22')](respondWithResult(_0x5dc6f3,null))[_0xc5f2('0x2c')](handleError(_0x5dc6f3,null));};exports[_0xc5f2('0xbb')]=function(_0x49b4cc,_0x486a44,_0x44d88e){return db[_0xc5f2('0x42')][_0xc5f2('0x58')]({'where':{'id':_0x49b4cc[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x486a44,null))[_0xc5f2('0x22')](function(_0x355824){if(_0x355824){return _0x355824[_0xc5f2('0xbb')](_0x49b4cc[_0xc5f2('0x5a')][_0xc5f2('0x6b')],_['omit'](_0x49b4cc['body'],[_0xc5f2('0x6b'),'id'])||{})[_0xc5f2('0xb4')](function(_0x1c4be1){for(var _0x2dc75e=0x0;_0x2dc75e<_0x49b4cc[_0xc5f2('0x5a')][_0xc5f2('0x6b')][_0xc5f2('0x57')];_0x2dc75e+=0x1){socket[_0xc5f2('0xbc')](_0xc5f2('0xbd'),{'UserId':_0x49b4cc[_0xc5f2('0x5a')][_0xc5f2('0x6b')][_0x2dc75e],'FaxAccountId':_0x49b4cc[_0xc5f2('0x56')]['id']});}return _0x1c4be1;});}})[_0xc5f2('0x22')](respondWithResult(_0x486a44,null))[_0xc5f2('0x2c')](handleError(_0x486a44,null));};exports[_0xc5f2('0xbe')]=function(_0x4d89b0,_0x59c012,_0x5f423c){return db[_0xc5f2('0x42')][_0xc5f2('0x58')]({'where':{'id':_0x4d89b0[_0xc5f2('0x56')]['id']}})[_0xc5f2('0x22')](handleEntityNotFound(_0x59c012,null))[_0xc5f2('0x22')](function(_0x57bf61){if(_0x57bf61){return _0x57bf61['removeAgents'](_0x4d89b0[_0xc5f2('0x46')][_0xc5f2('0x6b')])[_0xc5f2('0x22')](function(){if(_[_0xc5f2('0xbf')](_0x4d89b0[_0xc5f2('0x46')]['ids'])){for(var _0x1f7a9b=0x0;_0x1f7a9b<_0x4d89b0[_0xc5f2('0x46')][_0xc5f2('0x6b')][_0xc5f2('0x57')];_0x1f7a9b+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x4d89b0[_0xc5f2('0x46')][_0xc5f2('0x6b')][_0x1f7a9b]),'FaxAccountId':Number(_0x4d89b0[_0xc5f2('0x56')]['id'])});}}else{socket[_0xc5f2('0xbc')](_0xc5f2('0xc0'),{'UserId':Number(_0x4d89b0[_0xc5f2('0x46')][_0xc5f2('0x6b')]),'FaxAccountId':Number(_0x4d89b0[_0xc5f2('0x56')]['id'])});}});}})[_0xc5f2('0x22')](respondWithStatusCode(_0x59c012,null))[_0xc5f2('0x2c')](handleError(_0x59c012,null));};exports[_0xc5f2('0xc1')]=function(_0x1b9a41,_0x5a5752,_0x4811e3){var _0x185a92={};var _0x3887ed={};var _0x2fe64b;var _0x1a9428;return db[_0xc5f2('0x42')][_0xc5f2('0x66')]({'where':{'id':_0x1b9a41[_0xc5f2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a5752,null))['then'](function(_0x1bbe46){if(_0x1bbe46){_0x2fe64b=_0x1bbe46;_0x3887ed[_0xc5f2('0x49')]=_[_0xc5f2('0x47')](db[_0xc5f2('0x77')][_0xc5f2('0x43')]);_0x3887ed[_0xc5f2('0x46')]=_[_0xc5f2('0x47')](_0x1b9a41[_0xc5f2('0x46')]);_0x3887ed['filters']=_[_0xc5f2('0x48')](_0x3887ed[_0xc5f2('0x49')],_0x3887ed[_0xc5f2('0x46')]);_0x185a92[_0xc5f2('0x4b')]=_[_0xc5f2('0x48')](_0x3887ed['model'],qs['fields'](_0x1b9a41[_0xc5f2('0x46')][_0xc5f2('0x4a')]));_0x185a92[_0xc5f2('0x4b')]=_0x185a92[_0xc5f2('0x4b')][_0xc5f2('0x57')]?_0x185a92[_0xc5f2('0x4b')]:_0x3887ed[_0xc5f2('0x49')];_0x185a92[_0xc5f2('0x4d')]=qs[_0xc5f2('0x4e')](_0x1b9a41[_0xc5f2('0x46')][_0xc5f2('0x4e')]);_0x185a92['where']=qs[_0xc5f2('0x4f')](_[_0xc5f2('0x6f')](_0x1b9a41[_0xc5f2('0x46')],_0x3887ed[_0xc5f2('0x4f')]));if(_0x1b9a41[_0xc5f2('0x46')][_0xc5f2('0x67')]){_0x185a92[_0xc5f2('0x50')]=_[_0xc5f2('0x51')](_0x185a92[_0xc5f2('0x50')],{'$or':_['map'](_0x185a92[_0xc5f2('0x4b')],function(_0xcdd61e){var _0x5f528c={};_0x5f528c[_0xcdd61e]={'$like':'%'+_0x1b9a41[_0xc5f2('0x46')][_0xc5f2('0x67')]+'%'};return _0x5f528c;})});}_0x185a92=_['merge']({},_0x185a92,_0x1b9a41[_0xc5f2('0x52')]);return _0x2fe64b['getAgents'](_0x185a92);}})[_0xc5f2('0x22')](function(_0x29b9f3){if(_0x29b9f3){_0x1a9428=_0x29b9f3[_0xc5f2('0x57')];if(!_0x1b9a41[_0xc5f2('0x46')][_0xc5f2('0x6e')]('nolimit')){_0x185a92[_0xc5f2('0x31')]=qs['limit'](_0x1b9a41[_0xc5f2('0x46')][_0xc5f2('0x31')]);_0x185a92[_0xc5f2('0x30')]=qs[_0xc5f2('0x30')](_0x1b9a41['query'][_0xc5f2('0x30')]);}return _0x2fe64b[_0xc5f2('0xc1')](_0x185a92);}})[_0xc5f2('0x22')](function(_0x39ac29){if(_0x39ac29){return _0x39ac29?{'count':_0x1a9428,'rows':_0x39ac29}:null;}})[_0xc5f2('0x22')](respondWithResult(_0x5a5752,null))[_0xc5f2('0x2c')](handleError(_0x5a5752,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e090d44..fdb0ca4 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 _0xb616=['remove','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','update'];(function(_0x2733f3,_0x3ba41b){var _0x38a494=function(_0x1fbc01){while(--_0x1fbc01){_0x2733f3['push'](_0x2733f3['shift']());}};_0x38a494(++_0x3ba41b);}(_0xb616,0x9e));var _0x6b61=function(_0x3d56cf,_0x582be1){_0x3d56cf=_0x3d56cf-0x0;var _0x809387=_0xb616[_0x3d56cf];return _0x809387;};'use strict';var EventEmitter=require(_0x6b61('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x6b61('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x6b61('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b61('0x3'),'afterDestroy':_0x6b61('0x4')};function emitEvent(_0x1bb7b1){return function(_0x1cb564,_0xb34dc4,_0x212e1a){FaxAccountEvents[_0x6b61('0x5')](_0x1bb7b1+':'+_0x1cb564['id'],_0x1cb564);FaxAccountEvents[_0x6b61('0x5')](_0x1bb7b1,_0x1cb564);_0x212e1a(null);};}for(var e in events){if(events[_0x6b61('0x6')](e)){var event=events[e];FaxAccount[_0x6b61('0x7')](e,emitEvent(event));}}module[_0x6b61('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xa6a9=['hook','exports','events','FaxAccount','save','update','remove','emit'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xa6a9,0x1ea));var _0x9a6a=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xa6a9[_0x54de5d];return _0x1b349e;};'use strict';var EventEmitter=require(_0x9a6a('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x9a6a('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a6a('0x2'),'afterUpdate':_0x9a6a('0x3'),'afterDestroy':_0x9a6a('0x4')};function emitEvent(_0x48c16){return function(_0x336ee0,_0x3bacd6,_0x1405d4){FaxAccountEvents[_0x9a6a('0x5')](_0x48c16+':'+_0x336ee0['id'],_0x336ee0);FaxAccountEvents[_0x9a6a('0x5')](_0x48c16,_0x336ee0);_0x1405d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9a6a('0x6')](e,emitEvent(event));}}module[_0x9a6a('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9ed638c..4bbe40d 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 _0xa21c=['rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','util','../../config/logger','api','moment','bluebird','path'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xa21c,0x19c));var _0xca21=function(_0x443f05,_0x24e474){_0x443f05=_0x443f05-0x0;var _0x1f20e6=_0xa21c[_0x443f05];return _0x1f20e6;};'use strict';var _=require('lodash');var util=require(_0xca21('0x0'));var logger=require(_0xca21('0x1'))(_0xca21('0x2'));var moment=require(_0xca21('0x3'));var BPromise=require(_0xca21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca21('0x5'));var rimraf=require(_0xca21('0x6'));var config=require(_0xca21('0x7'));var attributes=require(_0xca21('0x8'));module['exports']=function(_0x594e2f,_0x4cff02){return _0x594e2f[_0xca21('0x9')](_0xca21('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf23=['define','FaxAccount','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x51d629,_0x171a80){var _0x1bb70e=function(_0x2e4624){while(--_0x2e4624){_0x51d629['push'](_0x51d629['shift']());}};_0x1bb70e(++_0x171a80);}(_0xdf23,0x70));var _0x3df2=function(_0x77c2b3,_0x3fd965){_0x77c2b3=_0x77c2b3-0x0;var _0x3744de=_0xdf23[_0x77c2b3];return _0x3744de;};'use strict';var _=require(_0x3df2('0x0'));var util=require(_0x3df2('0x1'));var logger=require(_0x3df2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3df2('0x3'));var fs=require('fs');var path=require(_0x3df2('0x4'));var rimraf=require(_0x3df2('0x5'));var config=require(_0x3df2('0x6'));var attributes=require(_0x3df2('0x7'));module[_0x3df2('0x8')]=function(_0xee1665,_0x5eac58){return _0xee1665[_0x3df2('0x9')](_0x3df2('0xa'),attributes,{'tableName':'fax_accounts','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 c76b496..920ca94 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 _0x28a8=['create','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','include','model','attributes','map','then','debug','body','CmContact','describe','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','asc','ListId'];(function(_0x591908,_0x703126){var _0x122d56=function(_0x4d3147){while(--_0x4d3147){_0x591908['push'](_0x591908['shift']());}};_0x122d56(++_0x703126);}(_0x28a8,0xb5));var _0x828a=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0x28a8[_0x534c8f];return _0x5a57f5;};'use strict';var _=require('lodash');var util=require(_0x828a('0x0'));var moment=require(_0x828a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x828a('0x2'))['db'];var utils=require(_0x828a('0x3'));var logger=require(_0x828a('0x4'))(_0x828a('0x5'));var config=require(_0x828a('0x6'));var jayson=require(_0x828a('0x7'));var client=jayson['client']['http']({'port':0x232c});config[_0x828a('0x8')]=_['defaults'](config[_0x828a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x828a('0x8')]));require(_0x828a('0x9'))[_0x828a('0xa')](socket);function respondWithRpcPromise(_0xe313d3,_0x402660,_0x388d57){return new BPromise(function(_0x7b8556,_0x5a6e22){return client[_0x828a('0xb')](_0xe313d3,_0x388d57)['then'](function(_0x24418c){logger[_0x828a('0xc')](_0x828a('0xd'),_0x402660,_0x828a('0xe'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x402660,_0x828a('0xe'),JSON[_0x828a('0xf')](_0x24418c));if(_0x24418c[_0x828a('0x10')]){if(_0x24418c['error'][_0x828a('0x11')]===0x1f4){logger[_0x828a('0x10')]('FaxAccount,\x20%s,\x20%s',_0x402660,_0x24418c[_0x828a('0x10')][_0x828a('0x12')]);return _0x5a6e22(_0x24418c[_0x828a('0x10')][_0x828a('0x12')]);}logger[_0x828a('0x10')](_0x828a('0xd'),_0x402660,_0x24418c[_0x828a('0x10')]['message']);return _0x7b8556(_0x24418c['error'][_0x828a('0x12')]);}else{logger['info'](_0x828a('0xd'),_0x402660,_0x828a('0xe'));_0x7b8556(_0x24418c[_0x828a('0x13')][_0x828a('0x12')]);}})[_0x828a('0x14')](function(_0x6e1faf){logger[_0x828a('0x10')](_0x828a('0xd'),_0x402660,_0x6e1faf);_0x5a6e22(_0x6e1faf);});});}exports[_0x828a('0x15')]=function(_0x48e35e){var _0x5b65b5=this;return new Promise(function(_0x5dc3b1,_0x42a483){return db[_0x828a('0x16')]['findAll']({'raw':_0x48e35e['options']?_0x48e35e[_0x828a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x48e35e['options']?_0x48e35e[_0x828a('0x17')]['where']||null:null,'attributes':_0x48e35e[_0x828a('0x17')]?_0x48e35e[_0x828a('0x17')]['attributes']||null:null,'limit':_0x48e35e[_0x828a('0x17')]?_0x48e35e[_0x828a('0x17')]['limit']||null:null,'include':_0x48e35e[_0x828a('0x17')]?_0x48e35e[_0x828a('0x17')][_0x828a('0x18')]?_['map'](_0x48e35e[_0x828a('0x17')][_0x828a('0x18')],function(_0x3a5cd5){return{'model':db[_0x3a5cd5[_0x828a('0x19')]],'as':_0x3a5cd5['as'],'attributes':_0x3a5cd5[_0x828a('0x1a')],'include':_0x3a5cd5[_0x828a('0x18')]?_[_0x828a('0x1b')](_0x3a5cd5[_0x828a('0x18')],function(_0xd5ebf3){return{'model':db[_0xd5ebf3[_0x828a('0x19')]],'as':_0xd5ebf3['as'],'attributes':_0xd5ebf3[_0x828a('0x1a')],'include':_0xd5ebf3[_0x828a('0x18')]?_[_0x828a('0x1b')](_0xd5ebf3[_0x828a('0x18')],function(_0x3535b1){return{'model':db[_0x3535b1[_0x828a('0x19')]],'as':_0x3535b1['as'],'attributes':_0x3535b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x828a('0x1c')](function(_0x3cde07){logger[_0x828a('0xc')](_0x828a('0x15'),_0x48e35e);logger[_0x828a('0x1d')](_0x828a('0x15'),_0x48e35e,JSON[_0x828a('0xf')](_0x3cde07));_0x5dc3b1(_0x3cde07);})['catch'](function(_0x4092c){logger[_0x828a('0x10')](_0x828a('0x15'),_0x4092c['message'],_0x48e35e);_0x42a483(_0x5b65b5[_0x828a('0x10')](0x1f4,_0x4092c[_0x828a('0x12')]));});});};exports['NotifyFaxAccount']=function(_0x2a1f8a,_0x3dbd03,_0x299cb6){var _0x169c31=this;return new Promise(function(_0xf31e84,_0x4f6098){var _0x269481={'body':_0x2a1f8a[_0x828a('0x1e')],'channel':'fax'};var _0x4df139=[];var _0x56d012=[];var _0x5dddb9={};return db[_0x828a('0x1f')][_0x828a('0x20')]()[_0x828a('0x1c')](function(_0x5de8e9){if(!_0x5de8e9){throw new db['Sequelize'][(_0x828a('0x21'))]('no\x20available\x20attributes');}_0x4df139=_[_0x828a('0x22')](_[_0x828a('0x23')](_0x5de8e9),[_0x828a('0x24'),_0x828a('0x25')]);_0x56d012=_['difference'](_[_0x828a('0x23')](_0x5de8e9),[_0x828a('0x24'),_0x828a('0x25'),_0x828a('0x26'),'ListId']);if(_0x2a1f8a['body']['id']){delete _0x2a1f8a[_0x828a('0x1e')]['id'];}if(_[_0x828a('0x27')](_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x28')])){throw new db[(_0x828a('0x29'))][(_0x828a('0x21'))](_0x828a('0x2a'));}if(_[_0x828a('0x27')](_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x1e')])||_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x1e')]===''){throw new db[(_0x828a('0x29'))][(_0x828a('0x21'))](_0x828a('0x2b'));}if(_[_0x828a('0x27')](_0x2a1f8a[_0x828a('0x1e')]['mapKey'])){throw new db[(_0x828a('0x29'))][(_0x828a('0x21'))](_0x828a('0x2c')+_0x56d012);}if(!_[_0x828a('0x2d')](_0x56d012,_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x2e')])){throw new db[(_0x828a('0x29'))]['ValidationError'](_0x828a('0x2f')+_0x56d012);}_0x5dddb9[_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x2e')]]=_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x28')];})[_0x828a('0x1c')](function(){return db['FaxAccount'][_0x828a('0x30')]({'where':{'id':_0x2a1f8a['account']['id']},'include':[{'model':db[_0x828a('0x31')],'as':_0x828a('0x32'),'include':[{'model':db['CmContact'],'as':_0x828a('0x33'),'where':_0x5dddb9,'limit':0x1,'order':[[_0x828a('0x25'),_0x828a('0x34')]]}]},{'model':db[_0x828a('0x35')],'as':_0x828a('0x36')}]});})[_0x828a('0x1c')](function(_0x50a789){if(_0x50a789&&_0x50a789[_0x828a('0x32')]){var _0x43ce7a=_0x50a789[_0x828a('0x37')]({'plain':!![]});_0x269481[_0x828a('0x38')]=_0x43ce7a;_0x269481[_0x828a('0x39')]=_0x43ce7a[_0x828a('0x36')];_0x269481[_0x828a('0x3a')]=_0x43ce7a[_0x828a('0x32')];_0x269481[_0x828a('0x39')]=_[_0x828a('0x3b')](_0x269481[_0x828a('0x39')],['priority'],[_0x828a('0x3c')]);if(_0x269481[_0x828a('0x38')][_0x828a('0x36')]){delete _0x269481[_0x828a('0x38')][_0x828a('0x36')];}if(_0x269481['account'][_0x828a('0x32')]&&_0x269481[_0x828a('0x38')]['List']['Contacts']['length']){return _0x269481[_0x828a('0x38')]['List']['Contacts'][0x0];}var _0x12a1c5=_['defaults'](_0x2a1f8a[_0x828a('0x1e')],{'firstName':_0x2a1f8a['body']['from'],'ListId':_0x43ce7a[_0x828a('0x3d')]});_0x12a1c5[_0x2a1f8a[_0x828a('0x1e')]['mapKey']]=_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x28')];return db[_0x828a('0x1f')][_0x828a('0x3e')](_0x12a1c5,{'fields':_0x4df139,'raw':!![]});}})['then'](function(_0x56032e){_0x269481['contact']=_0x56032e;if(_0x56032e){var _0x120bf2={'ContactId':_0x56032e['id'],'FaxAccountId':_0x2a1f8a[_0x828a('0x38')]['id'],'fax':_0x56032e[_0x828a('0x3f')]};return db[_0x828a('0x40')][_0x828a('0x30')]({'where':{'ContactId':_0x56032e['id'],'closed':![],'FaxAccountId':_0x2a1f8a[_0x828a('0x38')]['id']}})[_0x828a('0x1c')](function(_0x1473f9){if(_0x1473f9){return[_0x1473f9,![]];}return db[_0x828a('0x40')][_0x828a('0x3e')](_0x120bf2)[_0x828a('0x1c')](function(_0xd280d5){return[_0xd280d5,!![]];});});}else{throw new Error(_0x828a('0x41'));}})[_0x828a('0x42')](function(_0x3ae28b,_0x16874a){var _0x317357=_0x3ae28b[_0x828a('0x37')]({'plain':!![]});if(_0x16874a){if(_0x269481[_0x828a('0x38')][_0x828a('0x43')]){_0x269481[_0x828a('0x39')]['push']({'id':0x0,'priority':_0x269481[_0x828a('0x39')]['length']+0x1,'app':_0x828a('0x44'),'appdata':'unmanaged','interval':_0x828a('0x45')});}_0x317357[_0x828a('0x46')]=!![];}else{_0x317357['created']=![];}_0x269481[_0x828a('0x47')]=_0x317357;return db[_0x828a('0x48')][_0x828a('0x3e')]({'body':_0x2a1f8a['body'][_0x828a('0x1e')],'FaxAccountId':_0x2a1f8a['account']['id'],'FaxInteractionId':_0x3ae28b['id'],'direction':'in','ContactId':_0x3ae28b[_0x828a('0x49')],'AttachmentId':_0x2a1f8a[_0x828a('0x1e')][_0x828a('0x4a')]});})['then'](function(_0x3d9fc4){_0x269481[_0x828a('0x12')]=_0x3d9fc4;if(_0x269481[_0x828a('0x47')][_0x828a('0x4b')]){return db['User'][_0x828a('0x30')]({'attributes':['id',_0x828a('0x4c')],'where':{'id':_0x269481[_0x828a('0x47')][_0x828a('0x4b')]}})['then'](function(_0xe3918f){if(_0xe3918f){_0x269481[_0x828a('0x39')]['unshift']({'id':0x0,'priority':0x0,'app':_0x828a('0x4d'),'appdata':_0xe3918f[_0x828a('0x4c')]+','+(_0x269481['account'][_0x828a('0x4e')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x828a('0x4f'),_0x828a('0x50'),_0x269481);});}return respondWithRpcPromise(_0x828a('0x4f'),_0x828a('0x50'),_0x269481);})['then'](function(_0x317bcd){_0xf31e84(_0x317bcd);})[_0x828a('0x14')](function(_0x2d7a62){_0x4f6098(_0x169c31[_0x828a('0x10')](0x1f4,_0x2d7a62[_0x828a('0x12')]));});});}; \ No newline at end of file +var _0xf776=['defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','difference','keys','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','length','contact','FaxInteraction','create','Contact\x20not\x20found','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0xf776,0x104));var _0x6f77=function(_0x2538f3,_0x816601){_0x2538f3=_0x2538f3-0x0;var _0x18671c=_0xf776[_0x2538f3];return _0x18671c;};'use strict';var _=require(_0x6f77('0x0'));var util=require(_0x6f77('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f77('0x2'));var fs=require('fs');var Redis=require(_0x6f77('0x3'));var db=require(_0x6f77('0x4'))['db'];var utils=require(_0x6f77('0x5'));var logger=require('../../config/logger')(_0x6f77('0x6'));var config=require(_0x6f77('0x7'));var jayson=require(_0x6f77('0x8'));var client=jayson['client'][_0x6f77('0x9')]({'port':0x232c});config['redis']=_[_0x6f77('0xa')](config['redis'],{'host':_0x6f77('0xb'),'port':0x18eb});var socket=require(_0x6f77('0xc'))(new Redis(config[_0x6f77('0xd')]));require(_0x6f77('0xe'))[_0x6f77('0xf')](socket);function respondWithRpcPromise(_0x204e7b,_0x327f9b,_0x4fcf84){return new BPromise(function(_0x40625d,_0x45b04f){return client['request'](_0x204e7b,_0x4fcf84)[_0x6f77('0x10')](function(_0x357f42){logger[_0x6f77('0x11')](_0x6f77('0x12'),_0x327f9b,'request\x20sent');logger[_0x6f77('0x13')](_0x6f77('0x14'),_0x327f9b,_0x6f77('0x15'),JSON['stringify'](_0x357f42));if(_0x357f42['error']){if(_0x357f42['error'][_0x6f77('0x16')]===0x1f4){logger[_0x6f77('0x17')](_0x6f77('0x12'),_0x327f9b,_0x357f42['error'][_0x6f77('0x18')]);return _0x45b04f(_0x357f42[_0x6f77('0x17')]['message']);}logger[_0x6f77('0x17')](_0x6f77('0x12'),_0x327f9b,_0x357f42[_0x6f77('0x17')][_0x6f77('0x18')]);return _0x40625d(_0x357f42['error']['message']);}else{logger[_0x6f77('0x11')](_0x6f77('0x12'),_0x327f9b,_0x6f77('0x15'));_0x40625d(_0x357f42[_0x6f77('0x19')]['message']);}})['catch'](function(_0x57329a){logger[_0x6f77('0x17')](_0x6f77('0x12'),_0x327f9b,_0x57329a);_0x45b04f(_0x57329a);});});}exports[_0x6f77('0x1a')]=function(_0xbed6c3){var _0x48efa0=this;return new Promise(function(_0x3c3546,_0x1294ec){return db[_0x6f77('0x1b')][_0x6f77('0x1c')]({'raw':_0xbed6c3[_0x6f77('0x1d')]?_0xbed6c3[_0x6f77('0x1d')][_0x6f77('0x1e')]===undefined?!![]:![]:!![],'where':_0xbed6c3[_0x6f77('0x1d')]?_0xbed6c3[_0x6f77('0x1d')][_0x6f77('0x1f')]||null:null,'attributes':_0xbed6c3['options']?_0xbed6c3[_0x6f77('0x1d')][_0x6f77('0x20')]||null:null,'limit':_0xbed6c3[_0x6f77('0x1d')]?_0xbed6c3[_0x6f77('0x1d')][_0x6f77('0x21')]||null:null,'include':_0xbed6c3[_0x6f77('0x1d')]?_0xbed6c3['options']['include']?_[_0x6f77('0x22')](_0xbed6c3[_0x6f77('0x1d')][_0x6f77('0x23')],function(_0x11288a){return{'model':db[_0x11288a[_0x6f77('0x24')]],'as':_0x11288a['as'],'attributes':_0x11288a[_0x6f77('0x20')],'include':_0x11288a[_0x6f77('0x23')]?_['map'](_0x11288a[_0x6f77('0x23')],function(_0x4273a1){return{'model':db[_0x4273a1[_0x6f77('0x24')]],'as':_0x4273a1['as'],'attributes':_0x4273a1[_0x6f77('0x20')],'include':_0x4273a1[_0x6f77('0x23')]?_['map'](_0x4273a1['include'],function(_0xe83d05){return{'model':db[_0xe83d05['model']],'as':_0xe83d05['as'],'attributes':_0xe83d05[_0x6f77('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6f77('0x10')](function(_0x4ecd5e){logger['info'](_0x6f77('0x1a'),_0xbed6c3);logger[_0x6f77('0x13')](_0x6f77('0x1a'),_0xbed6c3,JSON[_0x6f77('0x25')](_0x4ecd5e));_0x3c3546(_0x4ecd5e);})['catch'](function(_0x5211df){logger[_0x6f77('0x17')]('GetFaxAccount',_0x5211df['message'],_0xbed6c3);_0x1294ec(_0x48efa0[_0x6f77('0x17')](0x1f4,_0x5211df['message']));});});};exports[_0x6f77('0x26')]=function(_0x910835,_0x535338,_0x54197d){var _0x4707bb=this;return new Promise(function(_0x165161,_0x34b1a5){var _0x143c1d={'body':_0x910835[_0x6f77('0x27')],'channel':_0x6f77('0x28')};var _0x3f284f=[];var _0xdc26e3=[];var _0x3cc113={};return db[_0x6f77('0x29')][_0x6f77('0x2a')]()[_0x6f77('0x10')](function(_0x4fbe2a){if(!_0x4fbe2a){throw new db[(_0x6f77('0x2b'))]['ValidationError'](_0x6f77('0x2c'));}_0x3f284f=_['difference'](_['keys'](_0x4fbe2a),[_0x6f77('0x2d'),'updatedAt']);_0xdc26e3=_[_0x6f77('0x2e')](_[_0x6f77('0x2f')](_0x4fbe2a),[_0x6f77('0x2d'),_0x6f77('0x30'),_0x6f77('0x31'),_0x6f77('0x32')]);if(_0x910835[_0x6f77('0x27')]['id']){delete _0x910835['body']['id'];}if(_[_0x6f77('0x33')](_0x910835[_0x6f77('0x27')][_0x6f77('0x34')])){throw new db['Sequelize'][(_0x6f77('0x35'))](_0x6f77('0x36'));}if(_[_0x6f77('0x33')](_0x910835[_0x6f77('0x27')][_0x6f77('0x27')])||_0x910835['body'][_0x6f77('0x27')]===''){throw new db[(_0x6f77('0x2b'))][(_0x6f77('0x35'))](_0x6f77('0x37'));}if(_[_0x6f77('0x33')](_0x910835['body']['mapKey'])){throw new db[(_0x6f77('0x2b'))][(_0x6f77('0x35'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xdc26e3);}if(!_['includes'](_0xdc26e3,_0x910835['body'][_0x6f77('0x38')])){throw new db[(_0x6f77('0x2b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xdc26e3);}_0x3cc113[_0x910835['body'][_0x6f77('0x38')]]=_0x910835[_0x6f77('0x27')][_0x6f77('0x34')];})[_0x6f77('0x10')](function(){return db['FaxAccount'][_0x6f77('0x39')]({'where':{'id':_0x910835[_0x6f77('0x3a')]['id']},'include':[{'model':db[_0x6f77('0x3b')],'as':_0x6f77('0x3c'),'include':[{'model':db['CmContact'],'as':_0x6f77('0x3d'),'where':_0x3cc113,'limit':0x1,'order':[[_0x6f77('0x30'),_0x6f77('0x3e')]]}]},{'model':db[_0x6f77('0x3f')],'as':_0x6f77('0x40')}]});})[_0x6f77('0x10')](function(_0x5e3e32){if(_0x5e3e32&&_0x5e3e32['List']){var _0x1eab77=_0x5e3e32[_0x6f77('0x41')]({'plain':!![]});_0x143c1d[_0x6f77('0x3a')]=_0x1eab77;_0x143c1d[_0x6f77('0x42')]=_0x1eab77[_0x6f77('0x40')];_0x143c1d[_0x6f77('0x43')]=_0x1eab77[_0x6f77('0x3c')];_0x143c1d[_0x6f77('0x42')]=_[_0x6f77('0x44')](_0x143c1d[_0x6f77('0x42')],['priority'],['asc']);if(_0x143c1d[_0x6f77('0x3a')][_0x6f77('0x40')]){delete _0x143c1d[_0x6f77('0x3a')][_0x6f77('0x40')];}if(_0x143c1d[_0x6f77('0x3a')]['List']&&_0x143c1d[_0x6f77('0x3a')][_0x6f77('0x3c')][_0x6f77('0x3d')][_0x6f77('0x45')]){return _0x143c1d[_0x6f77('0x3a')][_0x6f77('0x3c')][_0x6f77('0x3d')][0x0];}var _0x3f7437=_[_0x6f77('0xa')](_0x910835['body'],{'firstName':_0x910835[_0x6f77('0x27')][_0x6f77('0x34')],'ListId':_0x1eab77['ListId']});_0x3f7437[_0x910835[_0x6f77('0x27')][_0x6f77('0x38')]]=_0x910835[_0x6f77('0x27')][_0x6f77('0x34')];return db[_0x6f77('0x29')]['create'](_0x3f7437,{'fields':_0x3f284f,'raw':!![]});}})[_0x6f77('0x10')](function(_0xc4e36b){_0x143c1d[_0x6f77('0x46')]=_0xc4e36b;if(_0xc4e36b){var _0x4da381={'ContactId':_0xc4e36b['id'],'FaxAccountId':_0x910835[_0x6f77('0x3a')]['id'],'fax':_0xc4e36b[_0x6f77('0x28')]};return db[_0x6f77('0x47')][_0x6f77('0x39')]({'where':{'ContactId':_0xc4e36b['id'],'closed':![],'FaxAccountId':_0x910835[_0x6f77('0x3a')]['id']}})[_0x6f77('0x10')](function(_0x32b266){if(_0x32b266){return[_0x32b266,![]];}return db[_0x6f77('0x47')][_0x6f77('0x48')](_0x4da381)[_0x6f77('0x10')](function(_0xac29dc){return[_0xac29dc,!![]];});});}else{throw new Error(_0x6f77('0x49'));}})['spread'](function(_0xd2d0e0,_0x3336ce){var _0x3cedbc=_0xd2d0e0['get']({'plain':!![]});if(_0x3336ce){if(_0x143c1d[_0x6f77('0x3a')]['autoclose']){_0x143c1d['applications']['push']({'id':0x0,'priority':_0x143c1d['applications'][_0x6f77('0x45')]+0x1,'app':_0x6f77('0x4a'),'appdata':_0x6f77('0x4b'),'interval':_0x6f77('0x4c')});}_0x3cedbc[_0x6f77('0x4d')]=!![];}else{_0x3cedbc[_0x6f77('0x4d')]=![];}_0x143c1d[_0x6f77('0x4e')]=_0x3cedbc;return db[_0x6f77('0x4f')][_0x6f77('0x48')]({'body':_0x910835[_0x6f77('0x27')][_0x6f77('0x27')],'FaxAccountId':_0x910835[_0x6f77('0x3a')]['id'],'FaxInteractionId':_0xd2d0e0['id'],'direction':'in','ContactId':_0xd2d0e0['ContactId'],'AttachmentId':_0x910835[_0x6f77('0x27')][_0x6f77('0x50')]});})[_0x6f77('0x10')](function(_0x3afa74){_0x143c1d[_0x6f77('0x18')]=_0x3afa74;if(_0x143c1d['interaction']['UserId']){return db[_0x6f77('0x51')][_0x6f77('0x39')]({'attributes':['id','name'],'where':{'id':_0x143c1d[_0x6f77('0x4e')][_0x6f77('0x52')]}})['then'](function(_0x1a79b1){if(_0x1a79b1){_0x143c1d['applications'][_0x6f77('0x53')]({'id':0x0,'priority':0x0,'app':_0x6f77('0x54'),'appdata':_0x1a79b1[_0x6f77('0x55')]+','+(_0x143c1d[_0x6f77('0x3a')][_0x6f77('0x56')]||0xa),'interval':_0x6f77('0x4c')});}return respondWithRpcPromise(_0x6f77('0x57'),_0x6f77('0x58'),_0x143c1d);});}return respondWithRpcPromise('Start',_0x6f77('0x58'),_0x143c1d);})[_0x6f77('0x10')](function(_0x212371){_0x165161(_0x212371);})[_0x6f77('0x59')](function(_0x2c7a6e){_0x34b1a5(_0x4707bb[_0x6f77('0x17')](0x1f4,_0x2c7a6e[_0x6f77('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1cfd540..1654777 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 _0x2a07=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x19e67d,_0x2fdc51){var _0x56ecb7=function(_0xe8a1e5){while(--_0xe8a1e5){_0x19e67d['push'](_0x19e67d['shift']());}};_0x56ecb7(++_0x2fdc51);}(_0x2a07,0x74));var _0x72a0=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0x2a07[_0x7f5123];return _0x10a02a;};'use strict';var FaxAccountEvents=require(_0x72a0('0x0'));var events=[_0x72a0('0x1'),_0x72a0('0x2'),_0x72a0('0x3')];function createListener(_0x1cad29,_0x548164){return function(_0x335b7c){_0x548164[_0x72a0('0x4')](_0x1cad29,_0x335b7c);};}function removeListener(_0x135982,_0x45b155){return function(){FaxAccountEvents[_0x72a0('0x5')](_0x135982,_0x45b155);};}exports[_0x72a0('0x6')]=function(_0x3ccf6d){for(var _0x20dab9=0x0,_0x193e3b=events[_0x72a0('0x7')];_0x20dab9<_0x193e3b;_0x20dab9++){var _0x21c819=events[_0x20dab9];var _0x2c04eb=createListener(_0x72a0('0x8')+_0x21c819,_0x3ccf6d);FaxAccountEvents['on'](_0x21c819,_0x2c04eb);}}; \ No newline at end of file +var _0x82c4=['removeListener','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x423713,_0x3c5e44){var _0x1f1b8b=function(_0x1b5bcf){while(--_0x1b5bcf){_0x423713['push'](_0x423713['shift']());}};_0x1f1b8b(++_0x3c5e44);}(_0x82c4,0x1ca));var _0x482c=function(_0x481604,_0x276ff8){_0x481604=_0x481604-0x0;var _0x1ca4ed=_0x82c4[_0x481604];return _0x1ca4ed;};'use strict';var FaxAccountEvents=require(_0x482c('0x0'));var events=[_0x482c('0x1'),_0x482c('0x2'),_0x482c('0x3')];function createListener(_0x18d056,_0x69706f){return function(_0x863ea9){_0x69706f['emit'](_0x18d056,_0x863ea9);};}function removeListener(_0x16b0f8,_0x5f4dee){return function(){FaxAccountEvents[_0x482c('0x4')](_0x16b0f8,_0x5f4dee);};}exports['register']=function(_0x477cf4){for(var _0x5d7c76=0x0,_0xfdb92=events[_0x482c('0x5')];_0x5d7c76<_0xfdb92;_0x5d7c76++){var _0x35cdab=events[_0x5d7c76];var _0x1c10f2=createListener(_0x482c('0x6')+_0x35cdab,_0x477cf4);FaxAccountEvents['on'](_0x35cdab,_0x1c10f2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 77ab85c..136e9d9 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 _0xfc45=['/:id/messages','/:id/users','getAgents','post','addAnswer','/:id/interactions','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications'];(function(_0x5e6b76,_0x53a93e){var _0x11c216=function(_0x9b5767){while(--_0x9b5767){_0x5e6b76['push'](_0x5e6b76['shift']());}};_0x11c216(++_0x53a93e);}(_0xfc45,0x9e));var _0x5fc4=function(_0x524810,_0x393ec5){_0x524810=_0x524810-0x0;var _0x3889f8=_0xfc45[_0x524810];return _0x3889f8;};'use strict';var multer=require(_0x5fc4('0x0'));var util=require(_0x5fc4('0x1'));var path=require(_0x5fc4('0x2'));var timeout=require(_0x5fc4('0x3'));var express=require(_0x5fc4('0x4'));var router=express['Router']();var auth=require(_0x5fc4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x5fc4('0x6')]('/',auth[_0x5fc4('0x7')](),controller['index']);router[_0x5fc4('0x6')]('/describe',auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x8')]);router[_0x5fc4('0x6')](_0x5fc4('0x9'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0xa')]);router[_0x5fc4('0x6')](_0x5fc4('0xb'),auth[_0x5fc4('0x7')](),controller['getDispositions']);router[_0x5fc4('0x6')](_0x5fc4('0xc'),auth['isAuthenticated'](),controller[_0x5fc4('0xd')]);router['get']('/:id/interactions',auth[_0x5fc4('0x7')](),controller[_0x5fc4('0xe')]);router[_0x5fc4('0x6')](_0x5fc4('0xf'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x10')]);router['get'](_0x5fc4('0x11'),auth[_0x5fc4('0x7')](),controller['getMessages']);router[_0x5fc4('0x6')](_0x5fc4('0x12'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x13')]);router[_0x5fc4('0x14')]('/',auth[_0x5fc4('0x7')](),controller['create']);router[_0x5fc4('0x14')](_0x5fc4('0xb'),auth[_0x5fc4('0x7')](),controller['addDisposition']);router[_0x5fc4('0x14')](_0x5fc4('0xc'),auth['isAuthenticated'](),controller[_0x5fc4('0x15')]);router['post'](_0x5fc4('0x16'),auth[_0x5fc4('0x7')](),controller['addInteraction']);router['post'](_0x5fc4('0xf'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x17')]);router[_0x5fc4('0x14')](_0x5fc4('0x18'),auth[_0x5fc4('0x7')](),controller['addAccountApplications']);router[_0x5fc4('0x14')](_0x5fc4('0x19'),auth['isAuthenticated'](),controller[_0x5fc4('0x1a')]);router['post'](_0x5fc4('0x1b'),auth[_0x5fc4('0x7')](),controller['send']);router['post'](_0x5fc4('0x12'),auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x1c')]);router[_0x5fc4('0x1d')](_0x5fc4('0x9'),auth['isAuthenticated'](),controller[_0x5fc4('0x1e')]);router[_0x5fc4('0x1f')](_0x5fc4('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x5fc4('0x1f')](_0x5fc4('0xb'),auth[_0x5fc4('0x7')](),controller['removeDispositions']);router[_0x5fc4('0x1f')]('/:id/canned_answers',auth[_0x5fc4('0x7')](),controller[_0x5fc4('0x20')]);router[_0x5fc4('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x5fc4('0x21')]);module[_0x5fc4('0x22')]=router; \ No newline at end of file +var _0x59ab=['addAnswer','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','/:id','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','index','get','/describe','isAuthenticated','show','getDispositions','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition'];(function(_0x4a8ef3,_0x4c1529){var _0x55df4b=function(_0xb37d1e){while(--_0xb37d1e){_0x4a8ef3['push'](_0x4a8ef3['shift']());}};_0x55df4b(++_0x4c1529);}(_0x59ab,0x95));var _0xb59a=function(_0x23c23c,_0x5ee1ff){_0x23c23c=_0x23c23c-0x0;var _0xf99e32=_0x59ab[_0x23c23c];return _0xf99e32;};'use strict';var multer=require(_0xb59a('0x0'));var util=require(_0xb59a('0x1'));var path=require(_0xb59a('0x2'));var timeout=require(_0xb59a('0x3'));var express=require(_0xb59a('0x4'));var router=express[_0xb59a('0x5')]();var auth=require(_0xb59a('0x6'));var interaction=require(_0xb59a('0x7'));var config=require(_0xb59a('0x8'));var controller=require(_0xb59a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb59a('0xa')]);router[_0xb59a('0xb')](_0xb59a('0xc'),auth[_0xb59a('0xd')](),controller['describe']);router[_0xb59a('0xb')]('/:id',auth[_0xb59a('0xd')](),controller[_0xb59a('0xe')]);router[_0xb59a('0xb')]('/:id/dispositions',auth[_0xb59a('0xd')](),controller[_0xb59a('0xf')]);router[_0xb59a('0xb')]('/:id/canned_answers',auth[_0xb59a('0xd')](),controller['getAnswers']);router[_0xb59a('0xb')](_0xb59a('0x10'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x11')]);router[_0xb59a('0xb')]('/:id/applications',auth[_0xb59a('0xd')](),controller[_0xb59a('0x12')]);router[_0xb59a('0xb')](_0xb59a('0x13'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x14')]);router[_0xb59a('0xb')](_0xb59a('0x15'),auth['isAuthenticated'](),controller[_0xb59a('0x16')]);router[_0xb59a('0x17')]('/',auth[_0xb59a('0xd')](),controller[_0xb59a('0x18')]);router[_0xb59a('0x17')](_0xb59a('0x19'),auth['isAuthenticated'](),controller[_0xb59a('0x1a')]);router['post']('/:id/canned_answers',auth[_0xb59a('0xd')](),controller[_0xb59a('0x1b')]);router[_0xb59a('0x17')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0xb59a('0x17')](_0xb59a('0x1c'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x1d')]);router[_0xb59a('0x17')](_0xb59a('0x1e'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x1f')]);router[_0xb59a('0x17')]('/updateaccountapplications',auth[_0xb59a('0xd')](),controller[_0xb59a('0x20')]);router[_0xb59a('0x17')](_0xb59a('0x21'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x22')]);router[_0xb59a('0x17')](_0xb59a('0x15'),auth['isAuthenticated'](),controller[_0xb59a('0x23')]);router['put'](_0xb59a('0x24'),auth[_0xb59a('0xd')](),controller['update']);router[_0xb59a('0x25')](_0xb59a('0x24'),auth['isAuthenticated'](),controller[_0xb59a('0x26')]);router[_0xb59a('0x25')](_0xb59a('0x19'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x27')]);router['delete'](_0xb59a('0x28'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x29')]);router[_0xb59a('0x25')](_0xb59a('0x15'),auth[_0xb59a('0xd')](),controller[_0xb59a('0x2a')]);module[_0xb59a('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d52a6bd..c40ac14 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 _0xd819=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x4f5e90,_0x2c7670){var _0x8b6d99=function(_0x5740b7){while(--_0x5740b7){_0x4f5e90['push'](_0x4f5e90['shift']());}};_0x8b6d99(++_0x2c7670);}(_0xd819,0x181));var _0x9d81=function(_0x39d980,_0x15c127){_0x39d980=_0x39d980-0x0;var _0x33fcbc=_0xd819[_0x39d980];return _0x33fcbc;};'use strict';var Sequelize=require('sequelize');module[_0x9d81('0x0')]={'priority':{'type':Sequelize[_0x9d81('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9d81('0x2')],'allowNull':![],'defaultValue':_0x9d81('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9d81('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9d81('0x4')}}; \ No newline at end of file +var _0x3e4d=['*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x37d239,_0x9890dc){var _0x219891=function(_0xff7ebb){while(--_0xff7ebb){_0x37d239['push'](_0x37d239['shift']());}};_0x219891(++_0x9890dc);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x31a11a,_0x2a1979){_0x31a11a=_0x31a11a-0x0;var _0x5de31c=_0x3e4d[_0x31a11a];return _0x5de31c;};'use strict';var Sequelize=require(_0xd3e4('0x0'));module['exports']={'priority':{'type':Sequelize[_0xd3e4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd3e4('0x2')]},'interval':{'type':Sequelize[_0xd3e4('0x2')],'defaultValue':_0xd3e4('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 62d2fe2..fedabfd 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 _0x7217=['send','index','map','FaxApplication','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x5e19fa,_0x371705){var _0x57b039=function(_0x52c394){while(--_0x52c394){_0x5e19fa['push'](_0x5e19fa['shift']());}};_0x57b039(++_0x371705);}(_0x7217,0x19e));var _0x7721=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7217[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');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('0x9'));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 db=require(_0x7721('0x1a'))['db'];function respondWithStatusCode(_0x27b36b,_0x55b4ca){_0x55b4ca=_0x55b4ca||0xcc;return function(_0x2911ec){if(_0x2911ec){return _0x27b36b[_0x7721('0x1b')](_0x55b4ca);}return _0x27b36b['status'](_0x55b4ca)[_0x7721('0x1c')]();};}function respondWithResult(_0x30da54,_0x3f01c5){_0x3f01c5=_0x3f01c5||0xc8;return function(_0x2e9752){if(_0x2e9752){return _0x30da54['status'](_0x3f01c5)[_0x7721('0x1d')](_0x2e9752);}};}function respondWithFilteredResult(_0x25b1c0,_0x534f1b){return function(_0x4e199a){if(_0x4e199a){var _0x4b183e=_0x4e199a[_0x7721('0x1e')],_0x5ed54=_0x534f1b['offset'],_0x25a628=_0x534f1b[_0x7721('0x1f')]+_0x534f1b['limit'],_0x3cc909;if(_0x25a628>=_0x4b183e){_0x25a628=_0x4b183e;_0x3cc909=0xc8;}else{_0x3cc909=0xce;}_0x25b1c0[_0x7721('0x20')](_0x3cc909);return _0x25b1c0['set'](_0x7721('0x21'),_0x5ed54+'-'+_0x25a628+'/'+_0x4b183e)[_0x7721('0x1d')](_0x4e199a);}return null;};}function patchUpdates(_0x3ab5a5){return function(_0x3e140d){try{jsonpatch[_0x7721('0x22')](_0x3e140d,_0x3ab5a5,!![]);}catch(_0x40af90){return BPromise[_0x7721('0x23')](_0x40af90);}return _0x3e140d[_0x7721('0x24')]();};}function saveUpdates(_0x3b29ac,_0xaeccc4){return function(_0x4ce1db){if(_0x4ce1db){return _0x4ce1db[_0x7721('0x25')](_0x3b29ac)[_0x7721('0x26')](function(_0x3a053f){return _0x3a053f;});}return null;};}function removeEntity(_0xd8ad3c,_0x57140c){return function(_0x28f5a6){if(_0x28f5a6){return _0x28f5a6['destroy']()[_0x7721('0x26')](function(){_0xd8ad3c[_0x7721('0x20')](0xcc)[_0x7721('0x1c')]();});}};}function handleEntityNotFound(_0x1caad8,_0x121cc4){return function(_0x395b15){if(!_0x395b15){_0x1caad8[_0x7721('0x1b')](0x194);}return _0x395b15;};}function handleError(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0x1f4;return function(_0x1abedb){logger[_0x7721('0x27')](_0x1abedb[_0x7721('0x28')]);if(_0x1abedb[_0x7721('0x29')]){delete _0x1abedb[_0x7721('0x29')];}_0x5b4d74[_0x7721('0x20')](_0x216f20)[_0x7721('0x2a')](_0x1abedb);};}exports[_0x7721('0x2b')]=function(_0x52316e,_0x258ddf){var _0x5b0551={},_0x499b87={},_0x315202={'count':0x0,'rows':[]};var _0x343c19=_[_0x7721('0x2c')](db[_0x7721('0x2d')][_0x7721('0x2e')],function(_0x37b9f0){return{'name':_0x37b9f0[_0x7721('0x2f')],'type':_0x37b9f0[_0x7721('0x30')]['key']};});_0x499b87[_0x7721('0x31')]=_[_0x7721('0x2c')](_0x343c19,'name');_0x499b87['query']=_[_0x7721('0x32')](_0x52316e[_0x7721('0x33')]);_0x499b87['filters']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],_0x499b87[_0x7721('0x33')]);_0x5b0551['attributes']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52316e[_0x7721('0x33')][_0x7721('0x35')]));_0x5b0551['attributes']=_0x5b0551[_0x7721('0x36')][_0x7721('0x37')]?_0x5b0551[_0x7721('0x36')]:_0x499b87['model'];if(!_0x52316e[_0x7721('0x33')][_0x7721('0x38')]('nolimit')){_0x5b0551[_0x7721('0x39')]=qs['limit'](_0x52316e[_0x7721('0x33')][_0x7721('0x39')]);_0x5b0551[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x52316e[_0x7721('0x33')][_0x7721('0x1f')]);}_0x5b0551[_0x7721('0x3a')]=qs[_0x7721('0x3b')](_0x52316e[_0x7721('0x33')][_0x7721('0x3b')]);_0x5b0551[_0x7721('0x3c')]=qs['filters'](_[_0x7721('0x3d')](_0x52316e['query'],_0x499b87[_0x7721('0x3e')]),_0x343c19);if(_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]){_0x5b0551[_0x7721('0x3c')]=_[_0x7721('0x40')](_0x5b0551[_0x7721('0x3c')],{'$or':_['map'](_0x343c19,function(_0x557c34){if(_0x557c34['type']!=='VIRTUAL'){var _0x18001c={};_0x18001c[_0x557c34[_0x7721('0x29')]]={'$like':'%'+_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]+'%'};return _0x18001c;}})});}_0x5b0551=_['merge']({},_0x5b0551,_0x52316e[_0x7721('0x41')]);var _0x4cf659={'where':_0x5b0551[_0x7721('0x3c')]};return db[_0x7721('0x2d')]['count'](_0x4cf659)[_0x7721('0x26')](function(_0x3a47c8){_0x315202['count']=_0x3a47c8;if(_0x52316e['query'][_0x7721('0x42')]){_0x5b0551[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x2d')][_0x7721('0x44')](_0x5b0551);})['then'](function(_0x2db173){_0x315202[_0x7721('0x45')]=_0x2db173;return _0x315202;})[_0x7721('0x26')](respondWithFilteredResult(_0x258ddf,_0x5b0551))[_0x7721('0x46')](handleError(_0x258ddf,null));};exports[_0x7721('0x47')]=function(_0x52ab67,_0x490d4){var _0x4a2c28={'raw':!![],'where':{'id':_0x52ab67['params']['id']}},_0xaa3216={};_0xaa3216[_0x7721('0x31')]=_[_0x7721('0x32')](db[_0x7721('0x2d')]['rawAttributes']);_0xaa3216[_0x7721('0x33')]=_[_0x7721('0x32')](_0x52ab67[_0x7721('0x33')]);_0xaa3216['filters']=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],_0xaa3216[_0x7721('0x33')]);_0x4a2c28[_0x7721('0x36')]=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52ab67['query']['fields']));_0x4a2c28[_0x7721('0x36')]=_0x4a2c28[_0x7721('0x36')][_0x7721('0x37')]?_0x4a2c28[_0x7721('0x36')]:_0xaa3216[_0x7721('0x31')];if(_0x52ab67[_0x7721('0x33')][_0x7721('0x42')]){_0x4a2c28[_0x7721('0x43')]=[{'all':!![]}];}_0x4a2c28=_[_0x7721('0x40')]({},_0x4a2c28,_0x52ab67[_0x7721('0x41')]);return db['FaxApplication']['find'](_0x4a2c28)[_0x7721('0x26')](handleEntityNotFound(_0x490d4,null))[_0x7721('0x26')](respondWithResult(_0x490d4,null))[_0x7721('0x46')](handleError(_0x490d4,null));};exports[_0x7721('0x48')]=function(_0x589e95,_0x30107e){return db[_0x7721('0x2d')]['create'](_0x589e95[_0x7721('0x49')],{})['then'](respondWithResult(_0x30107e,0xc9))[_0x7721('0x46')](handleError(_0x30107e,null));};exports['update']=function(_0x334f23,_0x196be4){if(_0x334f23[_0x7721('0x49')]['id']){delete _0x334f23['body']['id'];}return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0x334f23['params']['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x196be4,null))[_0x7721('0x26')](saveUpdates(_0x334f23[_0x7721('0x49')],null))['then'](respondWithResult(_0x196be4,null))[_0x7721('0x46')](handleError(_0x196be4,null));};exports['destroy']=function(_0xdb1ca8,_0x310549){return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0xdb1ca8[_0x7721('0x4b')]['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x310549,null))[_0x7721('0x26')](removeEntity(_0x310549,null))[_0x7721('0x46')](handleError(_0x310549,null));}; \ No newline at end of file +var _0x814b=['destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','FaxApplication','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x414ce9,_0x24c38f){var _0x6b1c40=function(_0x44c8a9){while(--_0x44c8a9){_0x414ce9['push'](_0x414ce9['shift']());}};_0x6b1c40(++_0x24c38f);}(_0x814b,0x1a2));var _0xb814=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x814b[_0x2cfb48];return _0xc4594f;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['FaxApplication'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['FaxApplication'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 76bd668..eea4009 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 _0x3153=['api','moment','bluebird','request-promise','rimraf','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','lodash','util','../../config/logger'];(function(_0x26dd96,_0x1e70a6){var _0x1aa18f=function(_0x1e846){while(--_0x1e846){_0x26dd96['push'](_0x26dd96['shift']());}};_0x1aa18f(++_0x1e70a6);}(_0x3153,0xcd));var _0x3315=function(_0x2a8330,_0xfe4fb1){_0x2a8330=_0x2a8330-0x0;var _0x2b8065=_0x3153[_0x2a8330];return _0x2b8065;};'use strict';var _=require(_0x3315('0x0'));var util=require(_0x3315('0x1'));var logger=require(_0x3315('0x2'))(_0x3315('0x3'));var moment=require(_0x3315('0x4'));var BPromise=require(_0x3315('0x5'));var rp=require(_0x3315('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3315('0x7'));var config=require('../../config/environment');var attributes=require(_0x3315('0x8'));module[_0x3315('0x9')]=function(_0x7e033,_0x23ce19){return _0x7e033[_0x3315('0xa')](_0x3315('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3315('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa122=['util','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x292744,_0x2a9bb7){var _0x4b3563=function(_0x5e948e){while(--_0x5e948e){_0x292744['push'](_0x292744['shift']());}};_0x4b3563(++_0x2a9bb7);}(_0xa122,0x181));var _0x2a12=function(_0xe8693e,_0x3a4d71){_0xe8693e=_0xe8693e-0x0;var _0xcf8ab9=_0xa122[_0xe8693e];return _0xcf8ab9;};'use strict';var _=require('lodash');var util=require(_0x2a12('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a12('0x1'));var rp=require(_0x2a12('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a12('0x3'));var config=require(_0x2a12('0x4'));var attributes=require('./faxApplication.attributes');module[_0x2a12('0x5')]=function(_0x36d3f0,_0x1c1465){return _0x36d3f0[_0x2a12('0x6')](_0x2a12('0x7'),attributes,{'tableName':_0x2a12('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a12('0x9'),'collate':_0x2a12('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 597ce00..4dd08a4 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 _0x2099=['http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','FaxApplication,\x20%s,\x20%s','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3c3167,_0x44bf62){var _0xb104f6=function(_0x1010f5){while(--_0x1010f5){_0x3c3167['push'](_0x3c3167['shift']());}};_0xb104f6(++_0x44bf62);}(_0x2099,0x104));var _0x9209=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2099[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x9209('0x0'));var moment=require(_0x9209('0x1'));var BPromise=require(_0x9209('0x2'));var rs=require(_0x9209('0x3'));var fs=require('fs');var Redis=require(_0x9209('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9209('0x5'));var logger=require(_0x9209('0x6'))(_0x9209('0x7'));var config=require(_0x9209('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9209('0x9')][_0x9209('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x188acb,_0x139644,_0x252776){return new BPromise(function(_0x3288a1,_0x5d9971){return client[_0x9209('0xb')](_0x188acb,_0x252776)[_0x9209('0xc')](function(_0x4f886d){logger['info']('FaxApplication,\x20%s,\x20%s',_0x139644,_0x9209('0xd'));logger[_0x9209('0xe')](_0x9209('0xf'),_0x139644,_0x9209('0xd'),JSON['stringify'](_0x4f886d));if(_0x4f886d[_0x9209('0x10')]){if(_0x4f886d[_0x9209('0x10')]['code']===0x1f4){logger[_0x9209('0x10')](_0x9209('0x11'),_0x139644,_0x4f886d['error'][_0x9209('0x12')]);return _0x5d9971(_0x4f886d['error'][_0x9209('0x12')]);}logger[_0x9209('0x10')]('FaxApplication,\x20%s,\x20%s',_0x139644,_0x4f886d[_0x9209('0x10')][_0x9209('0x12')]);return _0x3288a1(_0x4f886d[_0x9209('0x10')][_0x9209('0x12')]);}else{logger[_0x9209('0x13')](_0x9209('0x11'),_0x139644,_0x9209('0xd'));_0x3288a1(_0x4f886d[_0x9209('0x14')][_0x9209('0x12')]);}})[_0x9209('0x15')](function(_0x3de0cd){logger[_0x9209('0x10')](_0x9209('0x11'),_0x139644,_0x3de0cd);_0x5d9971(_0x3de0cd);});});}exports[_0x9209('0x16')]=function(_0x1bbad1){var _0x2086cf=this;return new Promise(function(_0x1d474d,_0x3dd12c){return db[_0x9209('0x17')][_0x9209('0x18')](_0x1bbad1['body'],{'raw':_0x1bbad1[_0x9209('0x19')]?_0x1bbad1[_0x9209('0x19')][_0x9209('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bbad1[_0x9209('0x19')]?_0x1bbad1['options'][_0x9209('0x1b')]||null:null,'attributes':_0x1bbad1['options']?_0x1bbad1[_0x9209('0x19')][_0x9209('0x1c')]||null:null,'limit':_0x1bbad1['options']?_0x1bbad1[_0x9209('0x19')][_0x9209('0x1d')]||null:null})[_0x9209('0xc')](function(_0x18b8c2){logger[_0x9209('0x13')](_0x9209('0x16'),_0x1bbad1);logger[_0x9209('0xe')]('UpdateFaxApplication',_0x1bbad1,JSON['stringify'](_0x18b8c2));_0x1d474d(_0x18b8c2);})['catch'](function(_0x4fc207){logger[_0x9209('0x10')](_0x9209('0x16'),_0x4fc207[_0x9209('0x12')],_0x1bbad1);_0x3dd12c(_0x2086cf[_0x9209('0x10')](0x1f4,_0x4fc207[_0x9209('0x12')]));});});}; \ No newline at end of file +var _0xca35=['options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','update','body'];(function(_0x37b2ce,_0x5a6096){var _0x18e96a=function(_0x12282f){while(--_0x12282f){_0x37b2ce['push'](_0x37b2ce['shift']());}};_0x18e96a(++_0x5a6096);}(_0xca35,0xd4));var _0x5ca3=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0xca35[_0x4a7e98];return _0x27d10d;};'use strict';var _=require(_0x5ca3('0x0'));var util=require(_0x5ca3('0x1'));var moment=require(_0x5ca3('0x2'));var BPromise=require(_0x5ca3('0x3'));var rs=require(_0x5ca3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ca3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ca3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5ca3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc9760e,_0x2eeb64,_0x1c5925){return new BPromise(function(_0x121f4b,_0x2bd736){return client['request'](_0xc9760e,_0x1c5925)[_0x5ca3('0x8')](function(_0x91fb0e){logger[_0x5ca3('0x9')](_0x5ca3('0xa'),_0x2eeb64,_0x5ca3('0xb'));logger[_0x5ca3('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2eeb64,'request\x20sent',JSON[_0x5ca3('0xd')](_0x91fb0e));if(_0x91fb0e['error']){if(_0x91fb0e[_0x5ca3('0xe')][_0x5ca3('0xf')]===0x1f4){logger[_0x5ca3('0xe')](_0x5ca3('0xa'),_0x2eeb64,_0x91fb0e['error']['message']);return _0x2bd736(_0x91fb0e[_0x5ca3('0xe')][_0x5ca3('0x10')]);}logger['error'](_0x5ca3('0xa'),_0x2eeb64,_0x91fb0e[_0x5ca3('0xe')][_0x5ca3('0x10')]);return _0x121f4b(_0x91fb0e[_0x5ca3('0xe')]['message']);}else{logger[_0x5ca3('0x9')]('FaxApplication,\x20%s,\x20%s',_0x2eeb64,'request\x20sent');_0x121f4b(_0x91fb0e[_0x5ca3('0x11')][_0x5ca3('0x10')]);}})[_0x5ca3('0x12')](function(_0x31f252){logger[_0x5ca3('0xe')](_0x5ca3('0xa'),_0x2eeb64,_0x31f252);_0x2bd736(_0x31f252);});});}exports[_0x5ca3('0x13')]=function(_0x4b9444){var _0x216326=this;return new Promise(function(_0x3a72ab,_0x420a6e){return db['FaxApplication'][_0x5ca3('0x14')](_0x4b9444[_0x5ca3('0x15')],{'raw':_0x4b9444[_0x5ca3('0x16')]?_0x4b9444[_0x5ca3('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b9444[_0x5ca3('0x16')]?_0x4b9444[_0x5ca3('0x16')][_0x5ca3('0x17')]||null:null,'attributes':_0x4b9444[_0x5ca3('0x16')]?_0x4b9444[_0x5ca3('0x16')][_0x5ca3('0x18')]||null:null,'limit':_0x4b9444[_0x5ca3('0x16')]?_0x4b9444[_0x5ca3('0x16')][_0x5ca3('0x19')]||null:null})[_0x5ca3('0x8')](function(_0x106a37){logger['info'](_0x5ca3('0x13'),_0x4b9444);logger[_0x5ca3('0xc')](_0x5ca3('0x13'),_0x4b9444,JSON[_0x5ca3('0xd')](_0x106a37));_0x3a72ab(_0x106a37);})[_0x5ca3('0x12')](function(_0x4bda65){logger[_0x5ca3('0xe')](_0x5ca3('0x13'),_0x4bda65[_0x5ca3('0x10')],_0x4b9444);_0x420a6e(_0x216326[_0x5ca3('0xe')](0x1f4,_0x4bda65['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 43129b2..c98508a 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 _0xee14=['index','/:id','isAuthenticated','show','post','create','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x57e19e,_0x2302c2){var _0x44b80c=function(_0x14c48d){while(--_0x14c48d){_0x57e19e['push'](_0x57e19e['shift']());}};_0x44b80c(++_0x2302c2);}(_0xee14,0x13a));var _0x4ee1=function(_0x20f3b7,_0xa8b446){_0x20f3b7=_0x20f3b7-0x0;var _0x16b12c=_0xee14[_0x20f3b7];return _0x16b12c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var auth=require(_0x4ee1('0x4'));var interaction=require(_0x4ee1('0x5'));var config=require(_0x4ee1('0x6'));var controller=require(_0x4ee1('0x7'));router[_0x4ee1('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ee1('0x9')]);router['get'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xd')]('/',auth[_0x4ee1('0xb')](),controller[_0x4ee1('0xe')]);router['put'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller['update']);router[_0x4ee1('0xf')](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa630=['delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xa630,0xbe));var _0x0a63=function(_0x14b58a,_0x11b2f8){_0x14b58a=_0x14b58a-0x0;var _0x40f453=_0xa630[_0x14b58a];return _0x40f453;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var auth=require(_0x0a63('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a63('0x4'));var controller=require(_0x0a63('0x5'));router[_0x0a63('0x6')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0x8')]);router['get'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xa')]);router[_0x0a63('0xb')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0xc')]);router['put'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xd')]);router[_0x0a63('0xe')](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xf')]);module[_0x0a63('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 3d1fa31..71e6cb9 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 _0x677a=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x550eef,_0x5c79f6){var _0x5b8e7b=function(_0x444ba3){while(--_0x444ba3){_0x550eef['push'](_0x550eef['shift']());}};_0x5b8e7b(++_0x5c79f6);}(_0x677a,0xd8));var _0xa677=function(_0x196016,_0x17df83){_0x196016=_0x196016-0x0;var _0x4efd21=_0x677a[_0x196016];return _0x4efd21;};'use strict';var Sequelize=require(_0xa677('0x0'));module[_0xa677('0x1')]={'closed':{'type':Sequelize[_0xa677('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa677('0x3')]},'note':{'type':Sequelize[_0xa677('0x3')]},'read1stAt':{'type':Sequelize[_0xa677('0x4')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xa677('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa677('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc3e6=['BOOLEAN','DATE','STRING','ENUM','exports'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xc3e6,0x176));var _0x6c3e=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0xc3e6[_0x3a2e49];return _0x257140;};'use strict';var Sequelize=require('sequelize');module[_0x6c3e('0x0')]={'closed':{'type':Sequelize[_0x6c3e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6c3e('0x2')]},'disposition':{'type':Sequelize[_0x6c3e('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6c3e('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x6c3e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6c3e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6c3e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 1de4057..f1906df 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 _0x57f8=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','find','UserId','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','FaxInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','rows','rawAttributes','includeAll','merge','create','update','params','describe','addMessage','FaxMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','color','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','format','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x3a308f,_0x3b39b5){var _0x1eaf93=function(_0x48501c){while(--_0x48501c){_0x3a308f['push'](_0x3a308f['shift']());}};_0x1eaf93(++_0x3b39b5);}(_0x57f8,0x198));var _0x857f=function(_0x6f2ce5,_0x4231eb){_0x6f2ce5=_0x6f2ce5-0x0;var _0x28a54a=_0x57f8[_0x6f2ce5];return _0x28a54a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x857f('0x0'));var rimraf=require(_0x857f('0x1'));var zipdir=require(_0x857f('0x2'));var jsonpatch=require(_0x857f('0x3'));var rp=require(_0x857f('0x4'));var moment=require(_0x857f('0x5'));var BPromise=require(_0x857f('0x6'));var Mustache=require(_0x857f('0x7'));var util=require(_0x857f('0x8'));var path=require(_0x857f('0x9'));var sox=require(_0x857f('0xa'));var csv=require(_0x857f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xb'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var db=require(_0x857f('0x19'))['db'];config[_0x857f('0x1a')]=_['defaults'](config[_0x857f('0x1a')],{'host':_0x857f('0x1b'),'port':0x18eb});var socket=require(_0x857f('0x1c'))(new Redis(config[_0x857f('0x1a')]));require(_0x857f('0x1d'))['register'](socket);function respondWithStatusCode(_0x4bc590,_0x3b09d9){_0x3b09d9=_0x3b09d9||0xcc;return function(_0x5f27b2){if(_0x5f27b2){return _0x4bc590[_0x857f('0x1e')](_0x3b09d9);}return _0x4bc590['status'](_0x3b09d9)[_0x857f('0x1f')]();};}function respondWithResult(_0x134a4f,_0x5c3a69){_0x5c3a69=_0x5c3a69||0xc8;return function(_0x27e8f1){if(_0x27e8f1){return _0x134a4f[_0x857f('0x20')](_0x5c3a69)[_0x857f('0x21')](_0x27e8f1);}};}function respondWithFilteredResult(_0x10b547,_0x279e74){return function(_0x38a3c2){if(_0x38a3c2){var _0x1a9ef8=_0x38a3c2[_0x857f('0x22')],_0x429e23=_0x279e74['offset'],_0x1014ca=_0x279e74[_0x857f('0x23')]+_0x279e74[_0x857f('0x24')],_0x38a242;if(_0x1014ca>=_0x1a9ef8){_0x1014ca=_0x1a9ef8;_0x38a242=0xc8;}else{_0x38a242=0xce;}_0x10b547['status'](_0x38a242);return _0x10b547[_0x857f('0x25')](_0x857f('0x26'),_0x429e23+'-'+_0x1014ca+'/'+_0x1a9ef8)[_0x857f('0x21')](_0x38a3c2);}return null;};}function patchUpdates(_0x484035){return function(_0x57fa8b){try{jsonpatch[_0x857f('0x27')](_0x57fa8b,_0x484035,!![]);}catch(_0x8f278){return BPromise[_0x857f('0x28')](_0x8f278);}return _0x57fa8b['save']();};}function saveUpdates(_0x118237,_0x17a98e){return function(_0xdf8ac3){if(_0xdf8ac3){return _0xdf8ac3['update'](_0x118237)[_0x857f('0x29')](function(_0x14a8ce){return _0x14a8ce;});}return null;};}function removeEntity(_0x50bfb7,_0x3bc543){return function(_0x1a651f){if(_0x1a651f){return _0x1a651f[_0x857f('0x2a')]()[_0x857f('0x29')](function(){_0x50bfb7[_0x857f('0x20')](0xcc)[_0x857f('0x1f')]();});}};}function handleEntityNotFound(_0x233a68,_0x2a89ba){return function(_0x181a9e){if(!_0x181a9e){_0x233a68[_0x857f('0x1e')](0x194);}return _0x181a9e;};}function handleError(_0x72f0aa,_0x4782ab){_0x4782ab=_0x4782ab||0x1f4;return function(_0x250731){logger[_0x857f('0x2b')](_0x250731['stack']);if(_0x250731[_0x857f('0x2c')]){delete _0x250731[_0x857f('0x2c')];}_0x72f0aa[_0x857f('0x20')](_0x4782ab)[_0x857f('0x2d')](_0x250731);};}function getInteractionUsers(_0x58c2de,_0x40c306){return new BPromise(function(_0x57ceaa,_0x1b405a){try{if(_0x40c306[_0x58c2de['id']]){_0x58c2de[_0x857f('0x2e')]=_[_0x857f('0x2f')](_0x40c306[_0x58c2de['id']],function(_0x2ab814){return{'id':_0x2ab814['id'],'fullname':_0x2ab814[_0x857f('0x30')]};});}}catch(_0x464e8f){_0x1b405a(_0x464e8f);}_0x57ceaa(_0x58c2de);});}function getInteractionTags(_0x1c4fff,_0xe79241){return new BPromise(function(_0x17e7b6,_0x41f832){try{if(_0x1c4fff[_0x857f('0x31')]){_0x1c4fff[_0x857f('0x32')]=[];_0x1c4fff[_0x857f('0x31')]['split'](',')[_0x857f('0x33')](function(_0x24d370){_0x1c4fff['Tags'][_0x857f('0x34')](_0xe79241[_0x24d370]);});}delete _0x1c4fff[_0x857f('0x31')];}catch(_0x537ba1){_0x41f832(_0x537ba1);}_0x17e7b6(_0x1c4fff);});}function updateFaxInteraction(_0x2262c6,_0x3ee1f7,_0x4c9157){return new BPromise(function(_0x109f76,_0x3c9c75){return getInteractionUsers(_0x2262c6,_0x4c9157)[_0x857f('0x29')](function(_0x2cc74e){return getInteractionTags(_0x2cc74e,_0x3ee1f7);})['then'](function(_0x596b2f){_0x109f76(_0x596b2f);})[_0x857f('0x35')](function(_0x385d7b){_0x3c9c75(_0x385d7b);});});}exports['index']=function(_0x26d2b5,_0x4d3a87){var _0x1ff000={},_0x365bc2={},_0x677deb={'count':0x0,'rows':[]};var _0x438ff1=_[_0x857f('0x2f')](db['FaxInteraction']['rawAttributes'],function(_0x10f99d){return{'name':_0x10f99d['fieldName'],'type':_0x10f99d[_0x857f('0x36')][_0x857f('0x37')]};});_0x365bc2[_0x857f('0x38')]=_['map'](_0x438ff1,_0x857f('0x2c'));_0x365bc2[_0x857f('0x39')]=_[_0x857f('0x3a')](_0x26d2b5[_0x857f('0x39')]);_0x365bc2[_0x857f('0x3b')]=_[_0x857f('0x3c')](_0x365bc2[_0x857f('0x38')],_0x365bc2['query']);_0x1ff000[_0x857f('0x3d')]=_[_0x857f('0x3c')](_0x365bc2[_0x857f('0x38')],qs[_0x857f('0x3e')](_0x26d2b5[_0x857f('0x39')][_0x857f('0x3e')]));_0x1ff000[_0x857f('0x3d')]=_0x1ff000['attributes'][_0x857f('0x3f')]?_0x1ff000[_0x857f('0x3d')]:_0x365bc2[_0x857f('0x38')];if(!_0x26d2b5[_0x857f('0x39')][_0x857f('0x40')](_0x857f('0x41'))){_0x1ff000['limit']=qs[_0x857f('0x24')](_0x26d2b5[_0x857f('0x39')][_0x857f('0x24')]);_0x1ff000[_0x857f('0x23')]=qs[_0x857f('0x23')](_0x26d2b5[_0x857f('0x39')][_0x857f('0x23')]);}_0x1ff000[_0x857f('0x42')]=qs['sort'](_0x26d2b5[_0x857f('0x39')][_0x857f('0x43')]);_0x1ff000[_0x857f('0x44')]=qs[_0x857f('0x3b')](_[_0x857f('0x45')](_0x26d2b5[_0x857f('0x39')],_0x365bc2[_0x857f('0x3b')]),_0x438ff1);var _0x42d922=[];var _0xb4d7c2=squel[_0x857f('0x46')]()[_0x857f('0x47')]('id')[_0x857f('0x47')](_0x857f('0x2c'))[_0x857f('0x47')]('color')[_0x857f('0x48')]('tools_tags');var _0x2ce1c0=squel[_0x857f('0x46')]()[_0x857f('0x47')](_0x857f('0x49'))[_0x857f('0x47')](_0x857f('0x4a'))[_0x857f('0x47')](_0x857f('0x4b'))[_0x857f('0x48')](_0x857f('0x4c'),'ui')[_0x857f('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x865fc2=squel['select']()[_0x857f('0x48')]('fax_interactions','i')[_0x857f('0x4d')](_0x857f('0x4e'),'c',_0x857f('0x4f'))[_0x857f('0x4d')](_0x857f('0x50'),'o',_0x857f('0x51'))[_0x857f('0x4d')](_0x857f('0x52'),'a','a.id\x20=\x20i.FaxAccountId')[_0x857f('0x4d')](_0x857f('0x53'),'me',_0x857f('0x54'))[_0x857f('0x4d')]('fax_interaction_has_tags','it',_0x857f('0x55'))[_0x857f('0x4d')](_0x857f('0x56'),'t',_0x857f('0x57'));var _0x67563=squel['expr']();var _0x3d28d9=[];var _0x3c1b39=squel['expr']();var _0xfd1679;if(_0x26d2b5[_0x857f('0x39')]['search']){_0xfd1679=as[_0x857f('0x58')](_0x26d2b5['query'][_0x857f('0x59')]);var _0x12b62c=_0xfd1679[_0x857f('0x5a')];for(var _0x2008d5=0x0;_0x2008d5<_0xfd1679[_0x857f('0x5b')][_0x857f('0x3f')];_0x2008d5++){var _0x256347=_0xfd1679[_0x857f('0x5b')][_0x2008d5];var _0x1ac191='i';var _0x6e39f4=_['find'](_0x438ff1,[_0x857f('0x2c'),_0x256347[_0x857f('0x47')]]);if(!_0x6e39f4){switch(_0x256347[_0x857f('0x47')]){case _0x857f('0x5c'):if(_0x256347[_0x857f('0x5d')]==0x1){_0x865fc2[_0x857f('0x5e')]('`'+_0x256347[_0x857f('0x47')]+'`\x20=\x200');}else{_0x865fc2[_0x857f('0x5e')]('`'+_0x256347[_0x857f('0x47')]+_0x857f('0x5f'));}break;case _0x857f('0x60'):if(_0x256347[_0x857f('0x61')]===_0x857f('0x62')){if(_0x256347['value'][_0x857f('0x63')]('\x20')[_0x857f('0x3f')]>0x1){_0x67563[_0x12b62c](_0x857f('0x64'),qs[_0x857f('0x65')](_0x256347[_0x857f('0x5d')]),null);}else{var _0x658eb0='%'+_0x256347[_0x857f('0x5d')]+'%';_0x67563[_0x12b62c](_0x857f('0x66'),_0x658eb0,_0x658eb0,_0x658eb0);}}else{_0x6e39f4=_['find'](_0x438ff1,['name',_0x857f('0x67')]);_0x256347[_0x857f('0x47')]=_0x857f('0x67');_0x36d746=as[_0x857f('0x68')](_0x1ac191,_0x6e39f4[_0x857f('0x36')],_0x256347);_0x67563[_0x12b62c](_0x36d746[_0x857f('0x69')],_0x36d746['value'][_0x857f('0x6a')],_0x36d746[_0x857f('0x5d')]['end']);}break;case _0x857f('0x6b'):var _0x5e3759=_0x256347[_0x857f('0x5d')][_0x857f('0x63')](',')['map'](function(_0x3f5a6e){return Number(_0x3f5a6e);});_0x5e3759[_0x857f('0x33')](function(_0x3520d3){_0x3c1b39['or'](_0x857f('0x6c'),'%,'+_0x3520d3+',%');});_0x3d28d9=_[_0x857f('0x6d')](_0x3d28d9,_0x5e3759);break;case _0x857f('0x6e'):if(_0x256347[_0x857f('0x61')]===_0x857f('0x62')){_0x67563[_0x12b62c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x256347[_0x857f('0x5d')]+'%',null);}else{_0x6e39f4=_[_0x857f('0x6f')](_0x438ff1,[_0x857f('0x2c'),_0x857f('0x70')]);_0x256347[_0x857f('0x47')]=_0x857f('0x70');_0x36d746=as[_0x857f('0x68')](_0x1ac191,_0x6e39f4[_0x857f('0x36')],_0x256347);_0x67563[_0x12b62c](_0x36d746[_0x857f('0x69')],_0x36d746[_0x857f('0x5d')][_0x857f('0x6a')],_0x36d746['value'][_0x857f('0x1f')]);}break;case _0x857f('0x71'):_0x36d746=as[_0x857f('0x68')]('me',null,_0x256347);_0x67563[_0x12b62c](_0x36d746[_0x857f('0x69')],_0x36d746['value'][_0x857f('0x6a')],_0x36d746['value'][_0x857f('0x1f')]);break;}}else{var _0x36d746=as[_0x857f('0x68')](_0x1ac191,_0x6e39f4[_0x857f('0x36')],_0x256347);_0x67563[_0x12b62c](_0x36d746['text'],_0x36d746['value'][_0x857f('0x6a')],_0x36d746[_0x857f('0x5d')][_0x857f('0x1f')]);}}}else{var _0x49e7df=_(_0x26d2b5[_0x857f('0x39')])['keys']()[_0x857f('0x2f')](function(_0x1d6c1c){return _[_0x857f('0x72')](_0x438ff1,['name',_0x1d6c1c])?_0x1d6c1c:undefined;})['compact']()[_0x857f('0x5d')]();if(!_[_0x857f('0x73')](_0x49e7df)){_0x49e7df[_0x857f('0x33')](function(_0x570e3a){if(_0x570e3a===_0x857f('0x74')){_0x865fc2[_0x857f('0x44')](_0x857f('0x75'),[][_0x857f('0x76')](_0x26d2b5['query'][_0x570e3a]));}else if(_0x570e3a==='createdAt'){var _0x38c86b=JSON[_0x857f('0x77')](_0x26d2b5[_0x857f('0x39')][_0x570e3a])[_0x857f('0x78')];var _0x43ca9b=JSON[_0x857f('0x77')](_0x26d2b5['query'][_0x570e3a])[_0x857f('0x79')];_0x865fc2[_0x857f('0x44')](_0x857f('0x7a'),_0x38c86b,_0x43ca9b);}else{if(_0x26d2b5[_0x857f('0x39')][_0x570e3a]===_0x857f('0x7b')){_0x865fc2[_0x857f('0x44')]('i.'+_0x570e3a+_0x857f('0x7c'));}else{_0x865fc2[_0x857f('0x44')]('i.'+_0x570e3a+_0x857f('0x7d'),_0x26d2b5[_0x857f('0x39')][_0x570e3a]);}}});}if(_0x26d2b5['query'][_0x857f('0x7e')]){if(_0x26d2b5['query']['read']==0x1){_0x865fc2[_0x857f('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x865fc2['having'](_0x857f('0x7f'));}}if(_0x26d2b5['query'][_0x857f('0x80')]){_0x3d28d9=_['isArray'](_0x26d2b5[_0x857f('0x39')][_0x857f('0x80')])?_0x26d2b5[_0x857f('0x39')][_0x857f('0x80')]:new Array(_0x26d2b5['query'][_0x857f('0x80')]);_0x3d28d9[_0x857f('0x33')](function(_0x3100aa){_0x3c1b39['or'](_0x857f('0x6c'),'%,'+_0x3100aa+',%');});}if(_0x26d2b5[_0x857f('0x39')][_0x857f('0x81')]){var _0x195760=_0x26d2b5['query']['filter'][_0x857f('0x82')]('\x5c','\x5c\x5c')[_0x857f('0x82')]('\x27\x27',_0x857f('0x83'));if(qs[_0x857f('0x84')](_0x195760)){_0x67563['or'](_0x857f('0x85'),_0x195760+'%')['or'](_0x857f('0x86'),_0x195760+'%');}_0x67563['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x195760+'%');}}_0x865fc2[_0x857f('0x44')](_0x67563);_0x865fc2[_0x857f('0x87')](_0x857f('0x88'));var _0x4fa8a8={'type':db['Sequelize'][_0x857f('0x89')]['SELECT'],'raw':!![]};var _0x4b07c5=_0x865fc2[_0x857f('0x8a')]();_0x4b07c5[_0x857f('0x47')]('i.id');_0x4b07c5[_0x857f('0x47')](_0x857f('0x8b'),'unreadMessages');if(_0x1ff000[_0x857f('0x42')]){_0x1ff000[_0x857f('0x42')][_0x857f('0x33')](function(_0x2398df){_0x865fc2[_0x857f('0x42')]('i.'+_0x2398df[0x0],_0x2398df[0x1]===_0x857f('0x8c')?![]:!![]);});}if(!_[_0x857f('0x73')](_0x3d28d9)){_0x865fc2[_0x857f('0x5e')](_0x3c1b39);_0x4b07c5[_0x857f('0x44')](_0x857f('0x8d'),_0x3d28d9);}BPromise[_0x857f('0x8e')]()[_0x857f('0x29')](function(){if(!_0xfd1679){if(_0x26d2b5['query']['FaxAccountId']||_0x26d2b5['query'][_0x857f('0x8f')])return;_0x4b07c5[_0x857f('0x44')](_0x857f('0x90'));_0x865fc2[_0x857f('0x44')](_0x857f('0x90'));return;}return _0x26d2b5[_0x857f('0x91')][_0x857f('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40077e){if(_['isEmpty'](_0x40077e)){_0x4b07c5[_0x857f('0x44')]('i.FaxAccountId\x20IS\x20NULL');_0x865fc2['where'](_0x857f('0x93'));}else{_0x4b07c5['where'](_0x857f('0x75'),_[_0x857f('0x2f')](_0x40077e,'id'));_0x865fc2[_0x857f('0x44')]('i.FaxAccountId\x20IN\x20?',_[_0x857f('0x2f')](_0x40077e,'id'));}});})[_0x857f('0x29')](function(){db[_0x857f('0x94')][_0x857f('0x39')](_0x4b07c5[_0x857f('0x95')](),_0x4fa8a8)[_0x857f('0x29')](function(_0x11b818){_0x677deb[_0x857f('0x22')]=_0x11b818[_0x857f('0x3f')];if(_0x677deb['count']===0x0)return[];return db[_0x857f('0x94')][_0x857f('0x39')](_0xb4d7c2[_0x857f('0x95')](),_0x4fa8a8)[_0x857f('0x29')](function(_0x5d61f3){_0x42d922=_[_0x857f('0x96')](_0x5d61f3,'id');_0x4fa8a8=_['merge'](_0x4fa8a8,{'model':db[_0x857f('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x26d2b5[_0x857f('0x39')][_0x857f('0x3e')]){_0x1ff000[_0x857f('0x3d')]['forEach'](function(_0x372df1){_0x865fc2['field']('i.'+_0x372df1);});}else{_0x865fc2['field'](_0x857f('0x8b'),_0x857f('0x5c'));_0x865fc2['field']('a.key',_0x857f('0x98'));_0x865fc2[_0x857f('0x47')](_0x857f('0x99'),_0x857f('0x9a'));_0x865fc2['field'](_0x857f('0x9b'));_0x865fc2[_0x857f('0x47')](_0x857f('0x9c'),_0x857f('0x9d'));_0x865fc2[_0x857f('0x47')]('c.lastName','Contact.lastName');_0x865fc2[_0x857f('0x47')]('c.email','Contact.email');_0x865fc2[_0x857f('0x47')](_0x857f('0x9e'),_0x857f('0x9f'));_0x865fc2[_0x857f('0x47')](_0x857f('0xa0'),_0x857f('0xa1'));_0x865fc2[_0x857f('0x47')](_0x857f('0xa2'),_0x857f('0xa3'));_0x865fc2[_0x857f('0x47')](_0x857f('0xa4'),_0x857f('0xa5'));_0x865fc2[_0x857f('0x47')](_0x857f('0xa6'),_0x857f('0xa7'));_0x865fc2[_0x857f('0x47')](_0x857f('0xa8'),_0x857f('0x31'));}if(_0x1ff000[_0x857f('0x24')])_0x865fc2[_0x857f('0x24')](_0x1ff000[_0x857f('0x24')]);if(_0x1ff000[_0x857f('0x23')])_0x865fc2['offset'](_0x1ff000['offset']);return db['sequelize'][_0x857f('0x39')](_0x865fc2[_0x857f('0x95')](),_0x4fa8a8);})['then'](function(_0x411fee){_0x2ce1c0[_0x857f('0x44')]('ui.FaxInteractionId\x20IN\x20?',_[_0x857f('0x2f')](_0x411fee,'id'));return db['sequelize'][_0x857f('0x39')](_0x2ce1c0['toString'](),_0x4fa8a8)[_0x857f('0x29')](function(_0x1e858f){var _0x429a2b=_[_0x857f('0xa9')](_0x1e858f,_0x857f('0xaa'));var _0x1b761b=[];_0x411fee[_0x857f('0x33')](function(_0x18a010){_0x1b761b[_0x857f('0x34')](updateFaxInteraction(_0x18a010,_0x42d922,_0x429a2b));});return BPromise['all'](_0x1b761b);});});})[_0x857f('0x29')](function(_0x5242d3){_0x677deb[_0x857f('0xab')]=_0x5242d3;return _0x677deb;})[_0x857f('0x29')](respondWithFilteredResult(_0x4d3a87,_0x1ff000));})['catch'](handleError(_0x4d3a87,null));};exports['show']=function(_0x4d9c25,_0x14ba78){var _0x3347ec={'raw':![],'where':{'id':_0x4d9c25['params']['id']}},_0x6ae65={};_0x6ae65[_0x857f('0x38')]=_['keys'](db[_0x857f('0x97')][_0x857f('0xac')]);_0x6ae65[_0x857f('0x39')]=_[_0x857f('0x3a')](_0x4d9c25['query']);_0x6ae65[_0x857f('0x3b')]=_[_0x857f('0x3c')](_0x6ae65['model'],_0x6ae65[_0x857f('0x39')]);_0x3347ec['attributes']=_[_0x857f('0x3c')](_0x6ae65[_0x857f('0x38')],qs[_0x857f('0x3e')](_0x4d9c25[_0x857f('0x39')][_0x857f('0x3e')]));_0x3347ec[_0x857f('0x3d')]=_0x3347ec[_0x857f('0x3d')][_0x857f('0x3f')]?_0x3347ec[_0x857f('0x3d')]:_0x6ae65['model'];if(_0x4d9c25[_0x857f('0x39')][_0x857f('0xad')]){_0x3347ec['include']=[{'all':!![]}];}_0x3347ec=_[_0x857f('0xae')]({},_0x3347ec,_0x4d9c25['options']);return db[_0x857f('0x97')]['find'](_0x3347ec)[_0x857f('0x29')](handleEntityNotFound(_0x14ba78,null))['then'](respondWithResult(_0x14ba78,null))[_0x857f('0x35')](handleError(_0x14ba78,null));};exports[_0x857f('0xaf')]=function(_0xcf40fe,_0xb1240d){return db[_0x857f('0x97')][_0x857f('0xaf')](_0xcf40fe['body'],{})[_0x857f('0x29')](respondWithResult(_0xb1240d,0xc9))['catch'](handleError(_0xb1240d,null));};exports[_0x857f('0xb0')]=function(_0x9ae2e6,_0x4906e6){if(_0x9ae2e6[_0x857f('0x71')]['id']){delete _0x9ae2e6[_0x857f('0x71')]['id'];}return db[_0x857f('0x97')]['find']({'where':{'id':_0x9ae2e6[_0x857f('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4906e6,null))[_0x857f('0x29')](saveUpdates(_0x9ae2e6[_0x857f('0x71')],null))['then'](respondWithResult(_0x4906e6,null))[_0x857f('0x35')](handleError(_0x4906e6,null));};exports['destroy']=function(_0x2e349f,_0x333b8a){return db['FaxInteraction'][_0x857f('0x6f')]({'where':{'id':_0x2e349f[_0x857f('0xb1')]['id']}})[_0x857f('0x29')](handleEntityNotFound(_0x333b8a,null))['then'](removeEntity(_0x333b8a,null))[_0x857f('0x35')](handleError(_0x333b8a,null));};exports[_0x857f('0xb2')]=function(_0x42d10e,_0x1ea073){return db['FaxInteraction'][_0x857f('0xb2')]()[_0x857f('0x29')](respondWithResult(_0x1ea073,null))[_0x857f('0x35')](handleError(_0x1ea073,null));};exports[_0x857f('0xb3')]=function(_0x1ba225,_0x4f22d1,_0x5394a9){return db[_0x857f('0xb4')][_0x857f('0x6f')]({'where':{'id':_0x1ba225[_0x857f('0xb1')]['id']}})[_0x857f('0x29')](handleEntityNotFound(_0x4f22d1,null))[_0x857f('0x29')](function(_0x4f9468){if(_0x4f9468){return _0x4f9468['addMessage'](_0x1ba225[_0x857f('0x71')][_0x857f('0xb5')],_[_0x857f('0xb6')](_0x1ba225[_0x857f('0x71')],[_0x857f('0xb5'),'id'])||{});}})[_0x857f('0x29')](respondWithResult(_0x4f22d1,null))[_0x857f('0x35')](handleError(_0x4f22d1,null));};exports['getMessages']=function(_0x32f05c,_0x388d5c,_0x540d89){var _0xf69474={'raw':![],'where':{}};var _0x1d04e7={};var _0x548a34={'count':0x0,'rows':[]};return db[_0x857f('0x97')]['findOne']({'where':{'id':_0x32f05c[_0x857f('0xb1')]['id']}})[_0x857f('0x29')](handleEntityNotFound(_0x388d5c,null))[_0x857f('0x29')](function(_0x26f695){if(_0x26f695){_0x1d04e7[_0x857f('0x38')]=_['keys'](db[_0x857f('0xb4')][_0x857f('0xac')]);_0x1d04e7[_0x857f('0x39')]=_['keys'](_0x32f05c['query']);_0x1d04e7[_0x857f('0x3b')]=_[_0x857f('0x3c')](_0x1d04e7[_0x857f('0x38')],_0x1d04e7[_0x857f('0x39')]);_0xf69474[_0x857f('0x3d')]=_[_0x857f('0x3c')](_0x1d04e7['model'],qs['fields'](_0x32f05c['query']['fields']));_0xf69474[_0x857f('0x3d')]=_0xf69474[_0x857f('0x3d')][_0x857f('0x3f')]?_0xf69474[_0x857f('0x3d')]:_0x1d04e7[_0x857f('0x38')];if(!_0x32f05c[_0x857f('0x39')][_0x857f('0x40')]('nolimit')){_0xf69474[_0x857f('0x24')]=qs[_0x857f('0x24')](_0x32f05c[_0x857f('0x39')][_0x857f('0x24')]);_0xf69474['offset']=qs[_0x857f('0x23')](_0x32f05c[_0x857f('0x39')][_0x857f('0x23')]);}_0xf69474[_0x857f('0x42')]=qs[_0x857f('0x43')](_0x32f05c[_0x857f('0x39')][_0x857f('0x43')]);_0xf69474[_0x857f('0x44')]=qs['filters'](_[_0x857f('0x45')](_0x32f05c[_0x857f('0x39')],_0x1d04e7[_0x857f('0x3b')]));_0xf69474['where'][_0x857f('0xaa')]=_0x26f695['id'];if(_0x32f05c[_0x857f('0x39')][_0x857f('0x81')]){_0xf69474[_0x857f('0x44')]=_[_0x857f('0xae')](_0xf69474[_0x857f('0x44')],{'$or':_[_0x857f('0x2f')](_0xf69474[_0x857f('0x3d')],function(_0x5c5bf1){var _0x346906={};_0x346906[_0x5c5bf1]={'$like':'%'+_0x32f05c[_0x857f('0x39')]['filter']+'%'};return _0x346906;})});}if(_0x32f05c['query']['$gte']){var _0x2a43e2=_0x32f05c[_0x857f('0x39')][_0x857f('0x78')]['split'](',');var _0x3ca6b0={};_0x3ca6b0[_0x2a43e2[0x0]]={'$gte':moment(_0x2a43e2[0x1])['format'](_0x857f('0xb7'))};_0xf69474[_0x857f('0x44')]=_[_0x857f('0xae')](_0xf69474[_0x857f('0x44')],_0x3ca6b0);}_0xf69474=_[_0x857f('0xae')]({},_0xf69474,_0x32f05c[_0x857f('0xb8')]);return db['FaxMessage'][_0x857f('0x22')]({'where':_0xf69474[_0x857f('0x44')]})[_0x857f('0x29')](function(_0x1783d9){_0x548a34[_0x857f('0x22')]=_0x1783d9;if(_0x32f05c['query'][_0x857f('0xad')]){_0xf69474['include']=[{'all':!![]}];}return db[_0x857f('0xb4')][_0x857f('0xb9')](_0xf69474);})[_0x857f('0x29')](function(_0x2440f3){_0x548a34[_0x857f('0xab')]=_0x2440f3;return _0x548a34;});}})[_0x857f('0x29')](respondWithFilteredResult(_0x388d5c,_0xf69474))[_0x857f('0x35')](handleError(_0x388d5c,null));};exports[_0x857f('0xba')]=function(_0x16898b,_0x546e0e,_0x238041){return db[_0x857f('0x97')][_0x857f('0x6f')]({'where':{'id':_0x16898b[_0x857f('0xb1')]['id']}})[_0x857f('0x29')](handleEntityNotFound(_0x546e0e,null))['then'](function(_0x1df670){if(_0x1df670){return _0x1df670[_0x857f('0xbb')](_0x16898b[_0x857f('0x71')][_0x857f('0xb5')],_['omit'](_0x16898b[_0x857f('0x71')],[_0x857f('0xb5'),'id'])||{})[_0x857f('0xbc')](function(){return db['Tag'][_0x857f('0xb9')]({'attributes':['id',_0x857f('0x2c'),_0x857f('0xbd')],'where':{'id':_0x16898b[_0x857f('0x71')][_0x857f('0xb5')]}});})[_0x857f('0x29')](function(_0x178bfb){socket['emit'](_0x857f('0xbe'),{'id':Number(_0x16898b[_0x857f('0xb1')]['id']),'tags':_0x178bfb||[]});return{'id':Number(_0x16898b[_0x857f('0xb1')]['id']),'tags':_0x178bfb||[]};});}})[_0x857f('0x29')](respondWithResult(_0x546e0e,null))['catch'](handleError(_0x546e0e,null));};exports['removeTags']=function(_0x5e86c1,_0x58e14a,_0x2409b5){return db[_0x857f('0x97')]['find']({'where':{'id':_0x5e86c1[_0x857f('0xb1')]['id']}})[_0x857f('0x29')](handleEntityNotFound(_0x58e14a,null))[_0x857f('0x29')](function(_0x5c0183){if(_0x5c0183){return _0x5c0183[_0x857f('0xbf')](_0x5e86c1['query']['ids']);}})['then'](respondWithStatusCode(_0x58e14a,null))[_0x857f('0x35')](handleError(_0x58e14a,null));};exports['download']=function(_0x167f8a,_0x4c88a7){var _0x4b8b41=moment()[_0x857f('0xc0')]()[_0x857f('0x95')]();var _0x412ab5=path[_0x857f('0xc1')](config[_0x857f('0xc2')],_0x857f('0xc3'),_0x857f('0xc4'),_0x857f('0xc5'));var _0x4e40d7=path[_0x857f('0xc1')](config[_0x857f('0xc2')],_0x857f('0xc3'),_0x857f('0xc4'),'attachments');var _0x2fecee=path['join'](_0x412ab5,_0x4b8b41);var _0x38f34d=util[_0x857f('0xc6')](_0x857f('0xc7'),_0x167f8a[_0x857f('0xb1')]['id'],_0x4b8b41);var _0x4787e0=path[_0x857f('0xc1')](_0x412ab5,_0x38f34d);var _0xf9ccef=[];_0xf9ccef[_0x857f('0x34')]({'model':db[_0x857f('0xc8')],'as':_0x857f('0xc8'),'raw':!![]});var _0x4826a1=[{'model':db['FaxMessage'],'as':_0x857f('0xc9'),'attributes':['id',_0x857f('0x71'),'createdAt'],'include':_0xf9ccef}];return db[_0x857f('0x97')][_0x857f('0x6f')]({'where':{'id':_0x167f8a[_0x857f('0xb1')]['id']},'include':_0x4826a1})[_0x857f('0x29')](handleEntityNotFound(_0x4c88a7,null))[_0x857f('0x29')](function(_0x2fc56d){if(_0x2fc56d&&_0x2fc56d['Messages']){var _0x5724ef=_0x2fc56d[_0x857f('0xca')]({'plain':!![]});fs['mkdirSync'](_0x2fecee);for(var _0x49b297=0x0;_0x49b297<_0x5724ef['Messages'][_0x857f('0x3f')];_0x49b297++){var _0x54d2b7=_0x5724ef[_0x857f('0xc9')][_0x49b297][_0x857f('0xc8')];if(_0x54d2b7){var _0x6e9892=path[_0x857f('0xc1')](_0x4e40d7,_0x54d2b7[_0x857f('0xcb')]);if(fs[_0x857f('0xcc')](_0x6e9892)){fs[_0x857f('0xcd')](_0x6e9892)[_0x857f('0xce')](fs[_0x857f('0xcf')](path['join'](_0x2fecee,_0x54d2b7['basename'])));}}}return BPromise[_0x857f('0x8e')]()[_0x857f('0x29')](function(){return new BPromise(function(_0xfd5f8b,_0x188bb9){zipdir(_0x2fecee,{'saveTo':_0x4787e0},function(_0x5e3dca,_0x49e2ad){if(_0x5e3dca)return _0x188bb9(_0x5e3dca);return _0xfd5f8b(_0x49e2ad);});})[_0x857f('0x29')](function(){return new BPromise(function(_0x19e197,_0x502a32){rimraf(_0x2fecee,function(_0x401177){if(_0x401177)_0x502a32(_0x401177);return _0x19e197();});});})['then'](function(){return _0x4c88a7[_0x857f('0xd0')](_0x4787e0,_0x38f34d,function(_0x3ccb37){if(_0x3ccb37){console['log'](_0x857f('0xd1'),_0x3ccb37);}else{fs[_0x857f('0xd2')](_0x4787e0);}});});});}else{return _0x4c88a7['sendStatus'](0xc8);}})[_0x857f('0x35')](handleError(_0x4c88a7,null));}; \ No newline at end of file +var _0x3264=['fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','operator','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','body','start','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','include','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','color','removeTags','download','join','root','files','server','attachments','transcript-%d-%s.zip','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','sendStatus','end','status','json','count','offset','set','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x3264,0x7f));var _0x4326=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3264[_0x1694f5];return _0x5b4321;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4326('0x0'));var rimraf=require(_0x4326('0x1'));var zipdir=require(_0x4326('0x2'));var jsonpatch=require(_0x4326('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4326('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4326('0x5'));var sox=require(_0x4326('0x6'));var csv=require(_0x4326('0x7'));var ejs=require(_0x4326('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4326('0x9'));var crypto=require(_0x4326('0xa'));var jsforce=require(_0x4326('0xb'));var deskjs=require(_0x4326('0xc'));var toCsv=require(_0x4326('0x7'));var querystring=require(_0x4326('0xd'));var Papa=require(_0x4326('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4326('0xf'));var as=require(_0x4326('0x10'));var hardwareService=require(_0x4326('0x11'));var logger=require(_0x4326('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4326('0x13'));var db=require('../../mysqldb')['db'];config[_0x4326('0x14')]=_[_0x4326('0x15')](config[_0x4326('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4326('0x14')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b082c,_0x2c2232){_0x2c2232=_0x2c2232||0xcc;return function(_0xd376ca){if(_0xd376ca){return _0x1b082c[_0x4326('0x16')](_0x2c2232);}return _0x1b082c['status'](_0x2c2232)[_0x4326('0x17')]();};}function respondWithResult(_0x353204,_0x33112f){_0x33112f=_0x33112f||0xc8;return function(_0x5178a2){if(_0x5178a2){return _0x353204[_0x4326('0x18')](_0x33112f)[_0x4326('0x19')](_0x5178a2);}};}function respondWithFilteredResult(_0x14ce10,_0xba6964){return function(_0x5b6eaa){if(_0x5b6eaa){var _0x425897=_0x5b6eaa[_0x4326('0x1a')],_0x494d7b=_0xba6964[_0x4326('0x1b')],_0x312f6d=_0xba6964[_0x4326('0x1b')]+_0xba6964['limit'],_0x2b91b4;if(_0x312f6d>=_0x425897){_0x312f6d=_0x425897;_0x2b91b4=0xc8;}else{_0x2b91b4=0xce;}_0x14ce10[_0x4326('0x18')](_0x2b91b4);return _0x14ce10[_0x4326('0x1c')]('Content-Range',_0x494d7b+'-'+_0x312f6d+'/'+_0x425897)[_0x4326('0x19')](_0x5b6eaa);}return null;};}function patchUpdates(_0x835df7){return function(_0x2303c9){try{jsonpatch['apply'](_0x2303c9,_0x835df7,!![]);}catch(_0x1e9bb8){return BPromise[_0x4326('0x1d')](_0x1e9bb8);}return _0x2303c9[_0x4326('0x1e')]();};}function saveUpdates(_0x40012e,_0x21c448){return function(_0x13fa02){if(_0x13fa02){return _0x13fa02[_0x4326('0x1f')](_0x40012e)[_0x4326('0x20')](function(_0x54d81e){return _0x54d81e;});}return null;};}function removeEntity(_0x454565,_0x2b5c52){return function(_0x4dab78){if(_0x4dab78){return _0x4dab78[_0x4326('0x21')]()[_0x4326('0x20')](function(){_0x454565[_0x4326('0x18')](0xcc)[_0x4326('0x17')]();});}};}function handleEntityNotFound(_0x4744b1,_0x4b5e63){return function(_0x5551df){if(!_0x5551df){_0x4744b1[_0x4326('0x16')](0x194);}return _0x5551df;};}function handleError(_0x3fe54b,_0x44985b){_0x44985b=_0x44985b||0x1f4;return function(_0x251f25){logger['error'](_0x251f25[_0x4326('0x22')]);if(_0x251f25[_0x4326('0x23')]){delete _0x251f25[_0x4326('0x23')];}_0x3fe54b['status'](_0x44985b)[_0x4326('0x24')](_0x251f25);};}function getInteractionUsers(_0x5a1c44,_0x10509a){return new BPromise(function(_0x6b9f36,_0x5343b6){try{if(_0x10509a[_0x5a1c44['id']]){_0x5a1c44[_0x4326('0x25')]=_[_0x4326('0x26')](_0x10509a[_0x5a1c44['id']],function(_0x2afd8b){return{'id':_0x2afd8b['id'],'fullname':_0x2afd8b[_0x4326('0x27')]};});}}catch(_0x5baa56){_0x5343b6(_0x5baa56);}_0x6b9f36(_0x5a1c44);});}function getInteractionTags(_0x5209ec,_0x5e7e04){return new BPromise(function(_0x430f06,_0x371c96){try{if(_0x5209ec[_0x4326('0x28')]){_0x5209ec[_0x4326('0x29')]=[];_0x5209ec[_0x4326('0x28')][_0x4326('0x2a')](',')[_0x4326('0x2b')](function(_0xd54ee0){_0x5209ec[_0x4326('0x29')][_0x4326('0x2c')](_0x5e7e04[_0xd54ee0]);});}delete _0x5209ec['TagIds'];}catch(_0x20d43d){_0x371c96(_0x20d43d);}_0x430f06(_0x5209ec);});}function updateFaxInteraction(_0x2ba262,_0x15f147,_0x46ce){return new BPromise(function(_0x56ec11,_0x414924){return getInteractionUsers(_0x2ba262,_0x46ce)[_0x4326('0x20')](function(_0x387297){return getInteractionTags(_0x387297,_0x15f147);})[_0x4326('0x20')](function(_0x39ffa6){_0x56ec11(_0x39ffa6);})[_0x4326('0x2d')](function(_0x553eba){_0x414924(_0x553eba);});});}exports[_0x4326('0x2e')]=function(_0xad7767,_0x2f279d){var _0xa5c162={},_0x42411a={},_0x2138ed={'count':0x0,'rows':[]};var _0x192ff6=_['map'](db['FaxInteraction'][_0x4326('0x2f')],function(_0x49207c){return{'name':_0x49207c[_0x4326('0x30')],'type':_0x49207c[_0x4326('0x31')][_0x4326('0x32')]};});_0x42411a[_0x4326('0x33')]=_['map'](_0x192ff6,'name');_0x42411a[_0x4326('0x34')]=_[_0x4326('0x35')](_0xad7767['query']);_0x42411a[_0x4326('0x36')]=_[_0x4326('0x37')](_0x42411a[_0x4326('0x33')],_0x42411a[_0x4326('0x34')]);_0xa5c162[_0x4326('0x38')]=_[_0x4326('0x37')](_0x42411a[_0x4326('0x33')],qs[_0x4326('0x39')](_0xad7767[_0x4326('0x34')][_0x4326('0x39')]));_0xa5c162['attributes']=_0xa5c162['attributes']['length']?_0xa5c162[_0x4326('0x38')]:_0x42411a[_0x4326('0x33')];if(!_0xad7767['query'][_0x4326('0x3a')](_0x4326('0x3b'))){_0xa5c162[_0x4326('0x3c')]=qs[_0x4326('0x3c')](_0xad7767[_0x4326('0x34')]['limit']);_0xa5c162[_0x4326('0x1b')]=qs[_0x4326('0x1b')](_0xad7767[_0x4326('0x34')][_0x4326('0x1b')]);}_0xa5c162[_0x4326('0x3d')]=qs[_0x4326('0x3e')](_0xad7767[_0x4326('0x34')][_0x4326('0x3e')]);_0xa5c162[_0x4326('0x3f')]=qs['filters'](_[_0x4326('0x40')](_0xad7767[_0x4326('0x34')],_0x42411a[_0x4326('0x36')]),_0x192ff6);var _0x58c526=[];var _0x17485a=squel['select']()[_0x4326('0x41')]('id')[_0x4326('0x41')](_0x4326('0x23'))['field']('color')[_0x4326('0x42')](_0x4326('0x43'));var _0x29bf6b=squel['select']()[_0x4326('0x41')](_0x4326('0x44'))[_0x4326('0x41')](_0x4326('0x45'))[_0x4326('0x41')](_0x4326('0x46'))[_0x4326('0x42')]('user_has_fax_interactions','ui')[_0x4326('0x47')](_0x4326('0x48'),'u',_0x4326('0x49'));var _0x39bba1=squel['select']()['from'](_0x4326('0x4a'),'i')[_0x4326('0x47')]('cm_contacts','c',_0x4326('0x4b'))[_0x4326('0x47')](_0x4326('0x48'),'o',_0x4326('0x4c'))[_0x4326('0x47')](_0x4326('0x4d'),'a','a.id\x20=\x20i.FaxAccountId')[_0x4326('0x47')](_0x4326('0x4e'),'me',_0x4326('0x4f'))[_0x4326('0x47')](_0x4326('0x50'),'it',_0x4326('0x51'))[_0x4326('0x47')]('tools_tags','t',_0x4326('0x52'));var _0x25617a=squel[_0x4326('0x53')]();var _0x2cd1c9=[];var _0x43527e=squel['expr']();var _0x4d609d;if(_0xad7767[_0x4326('0x34')][_0x4326('0x54')]){_0x4d609d=as[_0x4326('0x55')](_0xad7767['query'][_0x4326('0x54')]);var _0x431280=_0x4d609d[_0x4326('0x56')];for(var _0x1785ef=0x0;_0x1785ef<_0x4d609d[_0x4326('0x57')]['length'];_0x1785ef++){var _0x35e326=_0x4d609d[_0x4326('0x57')][_0x1785ef];var _0x2621f9='i';var _0x3b5dd1=_['find'](_0x192ff6,['name',_0x35e326[_0x4326('0x41')]]);if(!_0x3b5dd1){switch(_0x35e326[_0x4326('0x41')]){case'unreadMessages':if(_0x35e326[_0x4326('0x58')]==0x1){_0x39bba1[_0x4326('0x59')]('`'+_0x35e326['field']+_0x4326('0x5a'));}else{_0x39bba1[_0x4326('0x59')]('`'+_0x35e326[_0x4326('0x41')]+_0x4326('0x5b'));}break;case'Contact':if(_0x35e326[_0x4326('0x5c')]==='$substring'){if(_0x35e326[_0x4326('0x58')][_0x4326('0x2a')]('\x20')[_0x4326('0x5d')]>0x1){_0x25617a[_0x431280](_0x4326('0x5e'),qs['getFullTextValue'](_0x35e326[_0x4326('0x58')]),null);}else{var _0x3c6487='%'+_0x35e326['value']+'%';_0x25617a[_0x431280](_0x4326('0x5f'),_0x3c6487,_0x3c6487,_0x3c6487);}}else{_0x3b5dd1=_['find'](_0x192ff6,[_0x4326('0x23'),_0x4326('0x60')]);_0x35e326[_0x4326('0x41')]=_0x4326('0x60');_0x37ec09=as[_0x4326('0x61')](_0x2621f9,_0x3b5dd1[_0x4326('0x31')],_0x35e326);_0x25617a[_0x431280](_0x37ec09['text'],_0x37ec09['value']['start'],_0x37ec09[_0x4326('0x58')][_0x4326('0x17')]);}break;case _0x4326('0x62'):var _0xd6e9b1=_0x35e326['value'][_0x4326('0x2a')](',')['map'](function(_0x1cb0a5){return Number(_0x1cb0a5);});_0xd6e9b1[_0x4326('0x2b')](function(_0x2a3c84){_0x43527e['or'](_0x4326('0x63'),'%,'+_0x2a3c84+',%');});_0x2cd1c9=_[_0x4326('0x64')](_0x2cd1c9,_0xd6e9b1);break;case _0x4326('0x65'):if(_0x35e326[_0x4326('0x5c')]===_0x4326('0x66')){_0x25617a[_0x431280](_0x4326('0x67'),'%'+_0x35e326['value']+'%',null);}else{_0x3b5dd1=_[_0x4326('0x68')](_0x192ff6,[_0x4326('0x23'),_0x4326('0x69')]);_0x35e326[_0x4326('0x41')]=_0x4326('0x69');_0x37ec09=as['buildExpression'](_0x2621f9,_0x3b5dd1[_0x4326('0x31')],_0x35e326);_0x25617a[_0x431280](_0x37ec09[_0x4326('0x6a')],_0x37ec09[_0x4326('0x58')]['start'],_0x37ec09[_0x4326('0x58')][_0x4326('0x17')]);}break;case _0x4326('0x6b'):_0x37ec09=as[_0x4326('0x61')]('me',null,_0x35e326);_0x25617a[_0x431280](_0x37ec09[_0x4326('0x6a')],_0x37ec09[_0x4326('0x58')]['start'],_0x37ec09[_0x4326('0x58')]['end']);break;}}else{var _0x37ec09=as['buildExpression'](_0x2621f9,_0x3b5dd1[_0x4326('0x31')],_0x35e326);_0x25617a[_0x431280](_0x37ec09[_0x4326('0x6a')],_0x37ec09[_0x4326('0x58')][_0x4326('0x6c')],_0x37ec09[_0x4326('0x58')][_0x4326('0x17')]);}}}else{var _0x3d7aaf=_(_0xad7767[_0x4326('0x34')])['keys']()[_0x4326('0x26')](function(_0x54917b){return _['some'](_0x192ff6,[_0x4326('0x23'),_0x54917b])?_0x54917b:undefined;})[_0x4326('0x6d')]()[_0x4326('0x58')]();if(!_[_0x4326('0x6e')](_0x3d7aaf)){_0x3d7aaf[_0x4326('0x2b')](function(_0x25c717){if(_0x25c717===_0x4326('0x6f')){_0x39bba1['where'](_0x4326('0x70'),[][_0x4326('0x71')](_0xad7767[_0x4326('0x34')][_0x25c717]));}else if(_0x25c717===_0x4326('0x72')){var _0x3cc7b9=JSON[_0x4326('0x73')](_0xad7767['query'][_0x25c717])[_0x4326('0x74')];var _0x4a9303=JSON[_0x4326('0x73')](_0xad7767['query'][_0x25c717])[_0x4326('0x75')];_0x39bba1[_0x4326('0x3f')](_0x4326('0x76'),_0x3cc7b9,_0x4a9303);}else{if(_0xad7767[_0x4326('0x34')][_0x25c717]==='null'){_0x39bba1['where']('i.'+_0x25c717+'\x20IS\x20NULL');}else{_0x39bba1['where']('i.'+_0x25c717+'\x20=\x20?',_0xad7767[_0x4326('0x34')][_0x25c717]);}}});}if(_0xad7767['query'][_0x4326('0x77')]){if(_0xad7767['query']['read']==0x1){_0x39bba1[_0x4326('0x59')](_0x4326('0x78'));}else{_0x39bba1[_0x4326('0x59')]('`unreadMessages`\x20>\x200');}}if(_0xad7767[_0x4326('0x34')][_0x4326('0x79')]){_0x2cd1c9=_[_0x4326('0x7a')](_0xad7767[_0x4326('0x34')][_0x4326('0x79')])?_0xad7767[_0x4326('0x34')][_0x4326('0x79')]:new Array(_0xad7767[_0x4326('0x34')]['tag']);_0x2cd1c9['forEach'](function(_0x1ea2e8){_0x43527e['or'](_0x4326('0x63'),'%,'+_0x1ea2e8+',%');});}if(_0xad7767[_0x4326('0x34')][_0x4326('0x7b')]){var _0x175329=_0xad7767[_0x4326('0x34')][_0x4326('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x4326('0x7c')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x4326('0x7d')](_0x175329)){_0x25617a['or']('i.id\x20LIKE\x20?',_0x175329+'%')['or'](_0x4326('0x7e'),_0x175329+'%');}_0x25617a['or'](_0x4326('0x7f'),_0x175329+'%');}}_0x39bba1[_0x4326('0x3f')](_0x25617a);_0x39bba1['group'](_0x4326('0x80'));var _0x426994={'type':db[_0x4326('0x81')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1f2884=_0x39bba1[_0x4326('0x82')]();_0x1f2884[_0x4326('0x41')](_0x4326('0x80'));_0x1f2884[_0x4326('0x41')](_0x4326('0x83'),_0x4326('0x84'));if(_0xa5c162[_0x4326('0x3d')]){_0xa5c162[_0x4326('0x3d')]['forEach'](function(_0x5004be){_0x39bba1['order']('i.'+_0x5004be[0x0],_0x5004be[0x1]===_0x4326('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x2cd1c9)){_0x39bba1[_0x4326('0x59')](_0x43527e);_0x1f2884[_0x4326('0x3f')](_0x4326('0x86'),_0x2cd1c9);}BPromise[_0x4326('0x87')]()[_0x4326('0x20')](function(){if(!_0x4d609d){if(_0xad7767[_0x4326('0x34')]['FaxAccountId']||_0xad7767[_0x4326('0x34')][_0x4326('0x88')])return;_0x1f2884[_0x4326('0x3f')](_0x4326('0x89'));_0x39bba1['where'](_0x4326('0x89'));return;}return _0xad7767[_0x4326('0x8a')][_0x4326('0x8b')]({'attributes':['id'],'raw':!![]})[_0x4326('0x20')](function(_0xc60ea){if(_[_0x4326('0x6e')](_0xc60ea)){_0x1f2884[_0x4326('0x3f')](_0x4326('0x8c'));_0x39bba1[_0x4326('0x3f')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x1f2884[_0x4326('0x3f')](_0x4326('0x70'),_['map'](_0xc60ea,'id'));_0x39bba1[_0x4326('0x3f')](_0x4326('0x70'),_[_0x4326('0x26')](_0xc60ea,'id'));}});})['then'](function(){db['sequelize']['query'](_0x1f2884['toString'](),_0x426994)['then'](function(_0x17d2d3){_0x2138ed[_0x4326('0x1a')]=_0x17d2d3['length'];if(_0x2138ed['count']===0x0)return[];return db[_0x4326('0x8d')][_0x4326('0x34')](_0x17485a[_0x4326('0x8e')](),_0x426994)[_0x4326('0x20')](function(_0x22b56e){_0x58c526=_[_0x4326('0x8f')](_0x22b56e,'id');_0x426994=_[_0x4326('0x90')](_0x426994,{'model':db[_0x4326('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xad7767[_0x4326('0x34')][_0x4326('0x39')]){_0xa5c162['attributes'][_0x4326('0x2b')](function(_0x3d679b){_0x39bba1[_0x4326('0x41')]('i.'+_0x3d679b);});}else{_0x39bba1[_0x4326('0x41')](_0x4326('0x83'),_0x4326('0x84'));_0x39bba1['field'](_0x4326('0x92'),_0x4326('0x93'));_0x39bba1['field'](_0x4326('0x94'),'Account.mandatoryDisposition');_0x39bba1[_0x4326('0x41')](_0x4326('0x95'));_0x39bba1[_0x4326('0x41')](_0x4326('0x96'),_0x4326('0x97'));_0x39bba1[_0x4326('0x41')](_0x4326('0x98'),_0x4326('0x99'));_0x39bba1[_0x4326('0x41')](_0x4326('0x9a'),_0x4326('0x9b'));_0x39bba1[_0x4326('0x41')](_0x4326('0x9c'),_0x4326('0x9d'));_0x39bba1['field'](_0x4326('0x9e'),'Contact.mobile');_0x39bba1[_0x4326('0x41')](_0x4326('0x9f'),'Contact.fax');_0x39bba1[_0x4326('0x41')]('o.fullname',_0x4326('0xa0'));_0x39bba1[_0x4326('0x41')]('o.internal',_0x4326('0xa1'));_0x39bba1['field'](_0x4326('0xa2'),_0x4326('0x28'));}if(_0xa5c162[_0x4326('0x3c')])_0x39bba1['limit'](_0xa5c162['limit']);if(_0xa5c162[_0x4326('0x1b')])_0x39bba1[_0x4326('0x1b')](_0xa5c162[_0x4326('0x1b')]);return db[_0x4326('0x8d')][_0x4326('0x34')](_0x39bba1[_0x4326('0x8e')](),_0x426994);})[_0x4326('0x20')](function(_0x42e646){_0x29bf6b[_0x4326('0x3f')](_0x4326('0xa3'),_[_0x4326('0x26')](_0x42e646,'id'));return db['sequelize'][_0x4326('0x34')](_0x29bf6b[_0x4326('0x8e')](),_0x426994)['then'](function(_0x1a1e31){var _0x2d96f0=_[_0x4326('0xa4')](_0x1a1e31,_0x4326('0xa5'));var _0x430ea4=[];_0x42e646[_0x4326('0x2b')](function(_0x5ac011){_0x430ea4[_0x4326('0x2c')](updateFaxInteraction(_0x5ac011,_0x58c526,_0x2d96f0));});return BPromise[_0x4326('0xa6')](_0x430ea4);});});})[_0x4326('0x20')](function(_0x1bacde){_0x2138ed[_0x4326('0xa7')]=_0x1bacde;return _0x2138ed;})[_0x4326('0x20')](respondWithFilteredResult(_0x2f279d,_0xa5c162));})['catch'](handleError(_0x2f279d,null));};exports['show']=function(_0xee3e72,_0x19bddd){var _0x596646={'raw':![],'where':{'id':_0xee3e72[_0x4326('0xa8')]['id']}},_0x29f15a={};_0x29f15a[_0x4326('0x33')]=_[_0x4326('0x35')](db[_0x4326('0x91')]['rawAttributes']);_0x29f15a[_0x4326('0x34')]=_[_0x4326('0x35')](_0xee3e72[_0x4326('0x34')]);_0x29f15a['filters']=_['intersection'](_0x29f15a[_0x4326('0x33')],_0x29f15a[_0x4326('0x34')]);_0x596646[_0x4326('0x38')]=_['intersection'](_0x29f15a['model'],qs[_0x4326('0x39')](_0xee3e72[_0x4326('0x34')]['fields']));_0x596646[_0x4326('0x38')]=_0x596646[_0x4326('0x38')][_0x4326('0x5d')]?_0x596646['attributes']:_0x29f15a[_0x4326('0x33')];if(_0xee3e72['query']['includeAll']){_0x596646[_0x4326('0xa9')]=[{'all':!![]}];}_0x596646=_[_0x4326('0x90')]({},_0x596646,_0xee3e72['options']);return db[_0x4326('0x91')][_0x4326('0x68')](_0x596646)[_0x4326('0x20')](handleEntityNotFound(_0x19bddd,null))[_0x4326('0x20')](respondWithResult(_0x19bddd,null))[_0x4326('0x2d')](handleError(_0x19bddd,null));};exports['create']=function(_0x1ff6ec,_0x5566dd){return db[_0x4326('0x91')]['create'](_0x1ff6ec[_0x4326('0x6b')],{})['then'](respondWithResult(_0x5566dd,0xc9))['catch'](handleError(_0x5566dd,null));};exports['update']=function(_0x140bad,_0x529a14){if(_0x140bad[_0x4326('0x6b')]['id']){delete _0x140bad['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x140bad[_0x4326('0xa8')]['id']}})['then'](handleEntityNotFound(_0x529a14,null))[_0x4326('0x20')](saveUpdates(_0x140bad['body'],null))[_0x4326('0x20')](respondWithResult(_0x529a14,null))['catch'](handleError(_0x529a14,null));};exports['destroy']=function(_0x5cceaa,_0x1e7f24){return db['FaxInteraction'][_0x4326('0x68')]({'where':{'id':_0x5cceaa['params']['id']}})[_0x4326('0x20')](handleEntityNotFound(_0x1e7f24,null))['then'](removeEntity(_0x1e7f24,null))[_0x4326('0x2d')](handleError(_0x1e7f24,null));};exports[_0x4326('0xaa')]=function(_0x5af0e7,_0x405f46){return db[_0x4326('0x91')][_0x4326('0xaa')]()['then'](respondWithResult(_0x405f46,null))[_0x4326('0x2d')](handleError(_0x405f46,null));};exports[_0x4326('0xab')]=function(_0x96dc17,_0x49e87c,_0x3e770a){return db[_0x4326('0xac')]['find']({'where':{'id':_0x96dc17['params']['id']}})[_0x4326('0x20')](handleEntityNotFound(_0x49e87c,null))[_0x4326('0x20')](function(_0x5ec649){if(_0x5ec649){return _0x5ec649[_0x4326('0xab')](_0x96dc17['body']['ids'],_[_0x4326('0xad')](_0x96dc17['body'],[_0x4326('0xae'),'id'])||{});}})['then'](respondWithResult(_0x49e87c,null))[_0x4326('0x2d')](handleError(_0x49e87c,null));};exports[_0x4326('0xaf')]=function(_0x59d033,_0x5bcb59,_0x4358eb){var _0x54213d={'raw':![],'where':{}};var _0x2f738a={};var _0x29a524={'count':0x0,'rows':[]};return db[_0x4326('0x91')][_0x4326('0xb0')]({'where':{'id':_0x59d033[_0x4326('0xa8')]['id']}})[_0x4326('0x20')](handleEntityNotFound(_0x5bcb59,null))[_0x4326('0x20')](function(_0x19021f){if(_0x19021f){_0x2f738a['model']=_['keys'](db['FaxMessage'][_0x4326('0x2f')]);_0x2f738a[_0x4326('0x34')]=_[_0x4326('0x35')](_0x59d033['query']);_0x2f738a[_0x4326('0x36')]=_['intersection'](_0x2f738a[_0x4326('0x33')],_0x2f738a['query']);_0x54213d[_0x4326('0x38')]=_[_0x4326('0x37')](_0x2f738a[_0x4326('0x33')],qs[_0x4326('0x39')](_0x59d033[_0x4326('0x34')][_0x4326('0x39')]));_0x54213d[_0x4326('0x38')]=_0x54213d[_0x4326('0x38')][_0x4326('0x5d')]?_0x54213d[_0x4326('0x38')]:_0x2f738a[_0x4326('0x33')];if(!_0x59d033['query'][_0x4326('0x3a')](_0x4326('0x3b'))){_0x54213d[_0x4326('0x3c')]=qs['limit'](_0x59d033[_0x4326('0x34')][_0x4326('0x3c')]);_0x54213d[_0x4326('0x1b')]=qs[_0x4326('0x1b')](_0x59d033[_0x4326('0x34')][_0x4326('0x1b')]);}_0x54213d['order']=qs['sort'](_0x59d033['query'][_0x4326('0x3e')]);_0x54213d[_0x4326('0x3f')]=qs[_0x4326('0x36')](_[_0x4326('0x40')](_0x59d033['query'],_0x2f738a['filters']));_0x54213d['where'][_0x4326('0xa5')]=_0x19021f['id'];if(_0x59d033[_0x4326('0x34')]['filter']){_0x54213d[_0x4326('0x3f')]=_['merge'](_0x54213d[_0x4326('0x3f')],{'$or':_[_0x4326('0x26')](_0x54213d[_0x4326('0x38')],function(_0x3c92a0){var _0x4e52fb={};_0x4e52fb[_0x3c92a0]={'$like':'%'+_0x59d033[_0x4326('0x34')][_0x4326('0x7b')]+'%'};return _0x4e52fb;})});}if(_0x59d033[_0x4326('0x34')][_0x4326('0x74')]){var _0x42cfca=_0x59d033[_0x4326('0x34')][_0x4326('0x74')][_0x4326('0x2a')](',');var _0x8248c0={};_0x8248c0[_0x42cfca[0x0]]={'$gte':moment(_0x42cfca[0x1])[_0x4326('0xb1')](_0x4326('0xb2'))};_0x54213d[_0x4326('0x3f')]=_[_0x4326('0x90')](_0x54213d[_0x4326('0x3f')],_0x8248c0);}_0x54213d=_[_0x4326('0x90')]({},_0x54213d,_0x59d033['options']);return db[_0x4326('0xac')][_0x4326('0x1a')]({'where':_0x54213d[_0x4326('0x3f')]})['then'](function(_0x18f055){_0x29a524['count']=_0x18f055;if(_0x59d033[_0x4326('0x34')][_0x4326('0xb3')]){_0x54213d[_0x4326('0xa9')]=[{'all':!![]}];}return db[_0x4326('0xac')][_0x4326('0xb4')](_0x54213d);})[_0x4326('0x20')](function(_0x22d1cf){_0x29a524[_0x4326('0xa7')]=_0x22d1cf;return _0x29a524;});}})[_0x4326('0x20')](respondWithFilteredResult(_0x5bcb59,_0x54213d))[_0x4326('0x2d')](handleError(_0x5bcb59,null));};exports[_0x4326('0xb5')]=function(_0x5f5ab5,_0x24bf0b,_0x4472c3){return db[_0x4326('0x91')][_0x4326('0x68')]({'where':{'id':_0x5f5ab5[_0x4326('0xa8')]['id']}})[_0x4326('0x20')](handleEntityNotFound(_0x24bf0b,null))[_0x4326('0x20')](function(_0x4a5518){if(_0x4a5518){return _0x4a5518['setTags'](_0x5f5ab5[_0x4326('0x6b')]['ids'],_['omit'](_0x5f5ab5[_0x4326('0x6b')],[_0x4326('0xae'),'id'])||{})['spread'](function(){return db[_0x4326('0x62')]['findAll']({'attributes':['id','name',_0x4326('0xb6')],'where':{'id':_0x5f5ab5[_0x4326('0x6b')]['ids']}});})['then'](function(_0x6908d3){socket['emit']('faxInteractionTags:save',{'id':Number(_0x5f5ab5[_0x4326('0xa8')]['id']),'tags':_0x6908d3||[]});return{'id':Number(_0x5f5ab5[_0x4326('0xa8')]['id']),'tags':_0x6908d3||[]};});}})[_0x4326('0x20')](respondWithResult(_0x24bf0b,null))[_0x4326('0x2d')](handleError(_0x24bf0b,null));};exports[_0x4326('0xb7')]=function(_0x3457dd,_0x6304d8,_0x51e3ec){return db['FaxInteraction'][_0x4326('0x68')]({'where':{'id':_0x3457dd[_0x4326('0xa8')]['id']}})['then'](handleEntityNotFound(_0x6304d8,null))[_0x4326('0x20')](function(_0x978376){if(_0x978376){return _0x978376[_0x4326('0xb7')](_0x3457dd[_0x4326('0x34')][_0x4326('0xae')]);}})[_0x4326('0x20')](respondWithStatusCode(_0x6304d8,null))['catch'](handleError(_0x6304d8,null));};exports[_0x4326('0xb8')]=function(_0x102a58,_0xa63acb){var _0x318c0c=moment()['unix']()[_0x4326('0x8e')]();var _0x1cdf85=path[_0x4326('0xb9')](config[_0x4326('0xba')],'server',_0x4326('0xbb'),'tmp');var _0x145648=path['join'](config[_0x4326('0xba')],_0x4326('0xbc'),_0x4326('0xbb'),_0x4326('0xbd'));var _0x1aaa44=path['join'](_0x1cdf85,_0x318c0c);var _0x141972=util['format'](_0x4326('0xbe'),_0x102a58['params']['id'],_0x318c0c);var _0x5ee34b=path[_0x4326('0xb9')](_0x1cdf85,_0x141972);var _0x17fe6f=[];_0x17fe6f[_0x4326('0x2c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x2856=[{'model':db['FaxMessage'],'as':_0x4326('0xbf'),'attributes':['id',_0x4326('0x6b'),_0x4326('0x72')],'include':_0x17fe6f}];return db[_0x4326('0x91')][_0x4326('0x68')]({'where':{'id':_0x102a58[_0x4326('0xa8')]['id']},'include':_0x2856})[_0x4326('0x20')](handleEntityNotFound(_0xa63acb,null))['then'](function(_0x44fda4){if(_0x44fda4&&_0x44fda4[_0x4326('0xbf')]){var _0x4167a8=_0x44fda4[_0x4326('0xc0')]({'plain':!![]});fs['mkdirSync'](_0x1aaa44);for(var _0x20bed2=0x0;_0x20bed2<_0x4167a8[_0x4326('0xbf')][_0x4326('0x5d')];_0x20bed2++){var _0x554369=_0x4167a8[_0x4326('0xbf')][_0x20bed2]['Attachment'];if(_0x554369){var _0x5395ae=path[_0x4326('0xb9')](_0x145648,_0x554369[_0x4326('0xc1')]);if(fs[_0x4326('0xc2')](_0x5395ae)){fs[_0x4326('0xc3')](_0x5395ae)[_0x4326('0xc4')](fs[_0x4326('0xc5')](path[_0x4326('0xb9')](_0x1aaa44,_0x554369[_0x4326('0xc1')])));}}}return BPromise[_0x4326('0x87')]()[_0x4326('0x20')](function(){return new BPromise(function(_0x264c9e,_0x1585a5){zipdir(_0x1aaa44,{'saveTo':_0x5ee34b},function(_0x5df28a,_0x39273f){if(_0x5df28a)return _0x1585a5(_0x5df28a);return _0x264c9e(_0x39273f);});})['then'](function(){return new BPromise(function(_0x5b8cd7,_0x4c186e){rimraf(_0x1aaa44,function(_0x24c691){if(_0x24c691)_0x4c186e(_0x24c691);return _0x5b8cd7();});});})['then'](function(){return _0xa63acb[_0x4326('0xb8')](_0x5ee34b,_0x141972,function(_0x3d0ea5){if(_0x3d0ea5){console[_0x4326('0xc6')](_0x4326('0xc7'),_0x3d0ea5);}else{fs[_0x4326('0xc8')](_0x5ee34b);}});});});}else{return _0xa63acb[_0x4326('0x16')](0xc8);}})[_0x4326('0x2d')](handleError(_0xa63acb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f66f484..c6db9b0 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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0xade50c,_0x25930b){_0xade50c=_0xade50c-0x0;var _0x529040=_0x2ef3[_0xade50c];return _0x529040;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x92ca9c,_0x20979e){_0x92ca9c=_0x92ca9c-0x0;var _0x1ce4a4=_0x2ef3[_0x92ca9c];return _0x1ce4a4;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 306b0b4..3544594 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 _0x97ae=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x291786,_0x1b2cce){var _0x27393a=function(_0x3f226d){while(--_0x3f226d){_0x291786['push'](_0x291786['shift']());}};_0x27393a(++_0x1b2cce);}(_0x97ae,0x90));var _0xe97a=function(_0x9c4282,_0x5f5b12){_0x9c4282=_0x9c4282-0x0;var _0x484dd4=_0x97ae[_0x9c4282];return _0x484dd4;};'use strict';var _=require('lodash');var util=require(_0xe97a('0x0'));var logger=require(_0xe97a('0x1'))(_0xe97a('0x2'));var moment=require(_0xe97a('0x3'));var BPromise=require(_0xe97a('0x4'));var rp=require(_0xe97a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe97a('0x6'));var config=require(_0xe97a('0x7'));var attributes=require(_0xe97a('0x8'));module[_0xe97a('0x9')]=function(_0x20d9f8,_0x5c58a2){return _0x20d9f8[_0xe97a('0xa')](_0xe97a('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e52d9,_0x571942,_0x433e6f){if(_0x1e52d9[_0xe97a('0xc')](_0xe97a('0xd'))){_0x1e52d9['closedAt']=moment()['format'](_0xe97a('0xe'));}_0x433e6f(null,_0x1e52d9);}}});}; \ No newline at end of file +var _0xbcc7=['rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3e284d,_0x42c938){var _0x278746=function(_0xde3859){while(--_0xde3859){_0x3e284d['push'](_0x3e284d['shift']());}};_0x278746(++_0x42c938);}(_0xbcc7,0x1e8));var _0x7bcc=function(_0x4e8abe,_0x3b8719){_0x4e8abe=_0x4e8abe-0x0;var _0x162e4a=_0xbcc7[_0x4e8abe];return _0x162e4a;};'use strict';var _=require(_0x7bcc('0x0'));var util=require(_0x7bcc('0x1'));var logger=require(_0x7bcc('0x2'))(_0x7bcc('0x3'));var moment=require(_0x7bcc('0x4'));var BPromise=require(_0x7bcc('0x5'));var rp=require(_0x7bcc('0x6'));var fs=require('fs');var path=require(_0x7bcc('0x7'));var rimraf=require(_0x7bcc('0x8'));var config=require(_0x7bcc('0x9'));var attributes=require(_0x7bcc('0xa'));module[_0x7bcc('0xb')]=function(_0x25d0ad,_0x532dd4){return _0x25d0ad['define'](_0x7bcc('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10ea62,_0x82b12b,_0x4db86d){if(_0x10ea62['changed']('closed')){_0x10ea62[_0x7bcc('0xd')]=moment()[_0x7bcc('0xe')](_0x7bcc('0xf'));}_0x4db86d(null,_0x10ea62);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index aee3eb3..f1f0499 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 _0xbbf5=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x58b0c0,_0x3be59d){var _0x34ca9d=function(_0x5d4f21){while(--_0x5d4f21){_0x58b0c0['push'](_0x58b0c0['shift']());}};_0x34ca9d(++_0x3be59d);}(_0xbbf5,0xe4));var _0x5bbf=function(_0x16b5cc,_0x19cac5){_0x16b5cc=_0x16b5cc-0x0;var _0x2ca476=_0xbbf5[_0x16b5cc];return _0x2ca476;};'use strict';var _=require(_0x5bbf('0x0'));var util=require(_0x5bbf('0x1'));var moment=require(_0x5bbf('0x2'));var BPromise=require(_0x5bbf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bbf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bbf('0x5'))('rpc');var config=require(_0x5bbf('0x6'));var jayson=require(_0x5bbf('0x7'));var client=jayson[_0x5bbf('0x8')]['http']({'port':0x232a});config[_0x5bbf('0x9')]=_[_0x5bbf('0xa')](config[_0x5bbf('0x9')],{'host':_0x5bbf('0xb'),'port':0x18eb});var socket=require(_0x5bbf('0xc'))(new Redis(config['redis']));require(_0x5bbf('0xd'))['register'](socket);function respondWithRpcPromise(_0x3dda53,_0x194c77,_0x211d4d){return new BPromise(function(_0x55f9c5,_0x450f19){return client['request'](_0x3dda53,_0x211d4d)[_0x5bbf('0xe')](function(_0x868f1e){logger['info'](_0x5bbf('0xf'),_0x194c77,_0x5bbf('0x10'));logger[_0x5bbf('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x194c77,_0x5bbf('0x10'),JSON[_0x5bbf('0x12')](_0x868f1e));if(_0x868f1e['error']){if(_0x868f1e['error']['code']===0x1f4){logger[_0x5bbf('0x13')](_0x5bbf('0xf'),_0x194c77,_0x868f1e['error'][_0x5bbf('0x14')]);return _0x450f19(_0x868f1e[_0x5bbf('0x13')][_0x5bbf('0x14')]);}logger[_0x5bbf('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x194c77,_0x868f1e[_0x5bbf('0x13')][_0x5bbf('0x14')]);return _0x55f9c5(_0x868f1e[_0x5bbf('0x13')][_0x5bbf('0x14')]);}else{logger[_0x5bbf('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x194c77,_0x5bbf('0x10'));_0x55f9c5(_0x868f1e[_0x5bbf('0x16')][_0x5bbf('0x14')]);}})[_0x5bbf('0x17')](function(_0x562bc9){logger[_0x5bbf('0x13')](_0x5bbf('0xf'),_0x194c77,_0x562bc9);_0x450f19(_0x562bc9);});});}exports[_0x5bbf('0x18')]=function(_0x402ae3){var _0x44294f=this;return new Promise(function(_0x55af17,_0x344592){return db[_0x5bbf('0x19')]['update'](_0x402ae3[_0x5bbf('0x1a')],{'raw':_0x402ae3[_0x5bbf('0x1b')]?_0x402ae3[_0x5bbf('0x1b')][_0x5bbf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x402ae3[_0x5bbf('0x1b')]?_0x402ae3[_0x5bbf('0x1b')][_0x5bbf('0x1d')]||null:null,'attributes':_0x402ae3[_0x5bbf('0x1b')]?_0x402ae3[_0x5bbf('0x1b')][_0x5bbf('0x1e')]||null:null,'limit':_0x402ae3[_0x5bbf('0x1b')]?_0x402ae3[_0x5bbf('0x1b')]['limit']||null:null})[_0x5bbf('0xe')](function(_0x293f38){logger[_0x5bbf('0x15')](_0x5bbf('0x18'),_0x402ae3);logger['debug'](_0x5bbf('0x18'),_0x402ae3,JSON['stringify'](_0x293f38));_0x55af17(_0x293f38);})[_0x5bbf('0x17')](function(_0x3b6466){logger['error'](_0x5bbf('0x18'),_0x3b6466[_0x5bbf('0x14')],_0x402ae3);_0x344592(_0x44294f[_0x5bbf('0x13')](0x1f4,_0x3b6466[_0x5bbf('0x14')]));});});};exports[_0x5bbf('0x1f')]=function(_0x21212a){return new Promise(function(_0x2cda84,_0x3d9e49){return db[_0x5bbf('0x19')][_0x5bbf('0x20')]({'where':_0x21212a[_0x5bbf('0x1b')]?_0x21212a[_0x5bbf('0x1b')][_0x5bbf('0x1d')]||null:null})['then'](function(_0x168a2b){if(_0x168a2b){return _0x168a2b[_0x5bbf('0x21')](_0x21212a[_0x5bbf('0x1a')][_0x5bbf('0x22')],_[_0x5bbf('0x23')](_0x21212a['body'],[_0x5bbf('0x22'),'id'])||{});}})[_0x5bbf('0x24')](function(_0x2c7444){logger[_0x5bbf('0x15')](_0x5bbf('0x25'),_0x21212a);logger[_0x5bbf('0x11')](_0x5bbf('0x25'),_0x21212a,JSON[_0x5bbf('0x12')](_0x2c7444));_0x2cda84(_0x2c7444);})[_0x5bbf('0x17')](function(_0x39ca81){logger['error'](_0x5bbf('0x25'),_0x39ca81[_0x5bbf('0x14')],_0x21212a);_0x3d9e49(_this[_0x5bbf('0x13')](0x1f4,_0x39ca81[_0x5bbf('0x14')]));});});}; \ No newline at end of file +var _0xa676=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FaxInteraction','update','body','options','raw','where','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','debug','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa676,0xef));var _0x6a67=function(_0x17144d,_0x2c8b50){_0x17144d=_0x17144d-0x0;var _0x4534fd=_0xa676[_0x17144d];return _0x4534fd;};'use strict';var _=require(_0x6a67('0x0'));var util=require(_0x6a67('0x1'));var moment=require(_0x6a67('0x2'));var BPromise=require(_0x6a67('0x3'));var rs=require(_0x6a67('0x4'));var fs=require('fs');var Redis=require(_0x6a67('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a67('0x6'))(_0x6a67('0x7'));var config=require(_0x6a67('0x8'));var jayson=require(_0x6a67('0x9'));var client=jayson[_0x6a67('0xa')][_0x6a67('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6a67('0xc'))(new Redis(config[_0x6a67('0xd')]));require(_0x6a67('0xe'))[_0x6a67('0xf')](socket);function respondWithRpcPromise(_0x23f6f0,_0x30d02e,_0xf44741){return new BPromise(function(_0x108352,_0x3862b1){return client[_0x6a67('0x10')](_0x23f6f0,_0xf44741)['then'](function(_0x39924b){logger[_0x6a67('0x11')](_0x6a67('0x12'),_0x30d02e,_0x6a67('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x30d02e,_0x6a67('0x13'),JSON[_0x6a67('0x14')](_0x39924b));if(_0x39924b['error']){if(_0x39924b[_0x6a67('0x15')][_0x6a67('0x16')]===0x1f4){logger[_0x6a67('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x30d02e,_0x39924b[_0x6a67('0x15')][_0x6a67('0x17')]);return _0x3862b1(_0x39924b[_0x6a67('0x15')]['message']);}logger[_0x6a67('0x15')](_0x6a67('0x12'),_0x30d02e,_0x39924b[_0x6a67('0x15')][_0x6a67('0x17')]);return _0x108352(_0x39924b[_0x6a67('0x15')][_0x6a67('0x17')]);}else{logger[_0x6a67('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x30d02e,'request\x20sent');_0x108352(_0x39924b['result']['message']);}})[_0x6a67('0x18')](function(_0x1e2afe){logger[_0x6a67('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x30d02e,_0x1e2afe);_0x3862b1(_0x1e2afe);});});}exports['UpdateFaxInteraction']=function(_0x5c6cb5){var _0x4fa442=this;return new Promise(function(_0x28a454,_0x261aff){return db[_0x6a67('0x19')][_0x6a67('0x1a')](_0x5c6cb5[_0x6a67('0x1b')],{'raw':_0x5c6cb5['options']?_0x5c6cb5[_0x6a67('0x1c')][_0x6a67('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6cb5[_0x6a67('0x1c')]?_0x5c6cb5[_0x6a67('0x1c')][_0x6a67('0x1e')]||null:null,'attributes':_0x5c6cb5[_0x6a67('0x1c')]?_0x5c6cb5[_0x6a67('0x1c')]['attributes']||null:null,'limit':_0x5c6cb5[_0x6a67('0x1c')]?_0x5c6cb5[_0x6a67('0x1c')][_0x6a67('0x1f')]||null:null})['then'](function(_0x1ddbc4){logger[_0x6a67('0x11')](_0x6a67('0x20'),_0x5c6cb5);logger['debug'](_0x6a67('0x20'),_0x5c6cb5,JSON[_0x6a67('0x14')](_0x1ddbc4));_0x28a454(_0x1ddbc4);})[_0x6a67('0x18')](function(_0x308aa2){logger[_0x6a67('0x15')](_0x6a67('0x20'),_0x308aa2['message'],_0x5c6cb5);_0x261aff(_0x4fa442[_0x6a67('0x15')](0x1f4,_0x308aa2['message']));});});};exports[_0x6a67('0x21')]=function(_0x285a2b){return new Promise(function(_0x2d5bf5,_0x117748){return db[_0x6a67('0x19')][_0x6a67('0x22')]({'where':_0x285a2b[_0x6a67('0x1c')]?_0x285a2b[_0x6a67('0x1c')][_0x6a67('0x1e')]||null:null})['then'](function(_0x59cc62){if(_0x59cc62){return _0x59cc62['addTags'](_0x285a2b[_0x6a67('0x1b')][_0x6a67('0x23')],_[_0x6a67('0x24')](_0x285a2b[_0x6a67('0x1b')],[_0x6a67('0x23'),'id'])||{});}})[_0x6a67('0x25')](function(_0x100b78){logger[_0x6a67('0x11')](_0x6a67('0x26'),_0x285a2b);logger[_0x6a67('0x27')](_0x6a67('0x26'),_0x285a2b,JSON[_0x6a67('0x14')](_0x100b78));_0x2d5bf5(_0x100b78);})[_0x6a67('0x18')](function(_0x40eaef){logger['error'](_0x6a67('0x26'),_0x40eaef[_0x6a67('0x17')],_0x285a2b);_0x117748(_this['error'](0x1f4,_0x40eaef[_0x6a67('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 7845b9c..c79cbe5 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 _0xddbf=['update','emit','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x7d5fcb,_0x33e247){var _0x221abc=function(_0x237e50){while(--_0x237e50){_0x7d5fcb['push'](_0x7d5fcb['shift']());}};_0x221abc(++_0x33e247);}(_0xddbf,0xca));var _0xfddb=function(_0x2c0abe,_0x2a14c4){_0x2c0abe=_0x2c0abe-0x0;var _0x1b0041=_0xddbf[_0x2c0abe];return _0x1b0041;};'use strict';var FaxInteractionEvents=require(_0xfddb('0x0'));var events=[_0xfddb('0x1'),'remove',_0xfddb('0x2')];function createListener(_0x373d1e,_0x1bf34b){return function(_0x59cc47){_0x1bf34b[_0xfddb('0x3')](_0x373d1e,_0x59cc47);};}function removeListener(_0x3c3008,_0x1621c8){return function(){FaxInteractionEvents['removeListener'](_0x3c3008,_0x1621c8);};}exports['register']=function(_0x57a8e2){for(var _0x4f4d98=0x0,_0x2a5b8d=events[_0xfddb('0x4')];_0x4f4d98<_0x2a5b8d;_0x4f4d98++){var _0x7691c6=events[_0x4f4d98];var _0x5d87f3=createListener(_0xfddb('0x5')+_0x7691c6,_0x57a8e2);FaxInteractionEvents['on'](_0x7691c6,_0x5d87f3);}}; \ No newline at end of file +var _0x3025=['register','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3025,0x142));var _0x5302=function(_0x5758c6,_0xd0d9ee){_0x5758c6=_0x5758c6-0x0;var _0x2abc4c=_0x3025[_0x5758c6];return _0x2abc4c;};'use strict';var FaxInteractionEvents=require(_0x5302('0x0'));var events=[_0x5302('0x1'),'remove',_0x5302('0x2')];function createListener(_0x537831,_0x34d305){return function(_0x5e943a){_0x34d305['emit'](_0x537831,_0x5e943a);};}function removeListener(_0x176e0a,_0x20d963){return function(){FaxInteractionEvents['removeListener'](_0x176e0a,_0x20d963);};}exports[_0x5302('0x3')]=function(_0x3750c7){for(var _0x142340=0x0,_0x50b301=events['length'];_0x142340<_0x50b301;_0x142340++){var _0x20f145=events[_0x142340];var _0x4ed47d=createListener(_0x5302('0x4')+_0x20f145,_0x3750c7);FaxInteractionEvents['on'](_0x20f145,_0x4ed47d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0dd1e2f..ef11ee2 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 _0x8073=['put','faxinteraction:update','update','destroy','delete','removeTags','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x41fe11,_0x17336f){var _0x22fd8d=function(_0x412156){while(--_0x412156){_0x41fe11['push'](_0x41fe11['shift']());}};_0x22fd8d(++_0x17336f);}(_0x8073,0x64));var _0x3807=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8073[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x3807('0x0'));var util=require(_0x3807('0x1'));var path=require('path');var timeout=require(_0x3807('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3807('0x3'));var interaction=require(_0x3807('0x4'));var config=require(_0x3807('0x5'));var controller=require(_0x3807('0x6'));router[_0x3807('0x7')]('/',auth[_0x3807('0x8')](),controller[_0x3807('0x9')]);router[_0x3807('0x7')]('/describe',auth[_0x3807('0x8')](),controller[_0x3807('0xa')]);router[_0x3807('0x7')](_0x3807('0xb'),auth[_0x3807('0x8')](),controller['show']);router['get'](_0x3807('0xc'),auth['isAuthenticated'](),controller[_0x3807('0xd')]);router[_0x3807('0x7')](_0x3807('0xe'),auth[_0x3807('0x8')](),controller[_0x3807('0xf')]);router[_0x3807('0x10')]('/',auth[_0x3807('0x8')](),controller[_0x3807('0x11')]);router[_0x3807('0x10')](_0x3807('0xc'),auth[_0x3807('0x8')](),controller[_0x3807('0x12')]);router[_0x3807('0x10')](_0x3807('0x13'),auth[_0x3807('0x8')](),interaction[_0x3807('0x14')](_0x3807('0x15'),_0x3807('0x16')),controller[_0x3807('0x17')]);router[_0x3807('0x18')](_0x3807('0xb'),auth[_0x3807('0x8')](),interaction['tracked'](_0x3807('0x15'),_0x3807('0x19')),controller[_0x3807('0x1a')]);router['delete'](_0x3807('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x3807('0x15'),'faxinteraction:destroy'),controller[_0x3807('0x1b')]);router[_0x3807('0x1c')](_0x3807('0x13'),auth[_0x3807('0x8')](),controller[_0x3807('0x1d')]);module[_0x3807('0x1e')]=router; \ No newline at end of file +var _0x4fd9=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','delete','destroy','removeTags'];(function(_0x5ccb80,_0x5d5e66){var _0x2ea884=function(_0x101b3c){while(--_0x101b3c){_0x5ccb80['push'](_0x5ccb80['shift']());}};_0x2ea884(++_0x5d5e66);}(_0x4fd9,0xf1));var _0x94fd=function(_0x371591,_0x2d9637){_0x371591=_0x371591-0x0;var _0x4298e1=_0x4fd9[_0x371591];return _0x4298e1;};'use strict';var multer=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));var path=require(_0x94fd('0x2'));var timeout=require(_0x94fd('0x3'));var express=require('express');var router=express[_0x94fd('0x4')]();var auth=require(_0x94fd('0x5'));var interaction=require(_0x94fd('0x6'));var config=require(_0x94fd('0x7'));var controller=require(_0x94fd('0x8'));router[_0x94fd('0x9')]('/',auth[_0x94fd('0xa')](),controller[_0x94fd('0xb')]);router[_0x94fd('0x9')](_0x94fd('0xc'),auth[_0x94fd('0xa')](),controller[_0x94fd('0xd')]);router['get']('/:id',auth[_0x94fd('0xa')](),controller['show']);router[_0x94fd('0x9')]('/:id/messages',auth[_0x94fd('0xa')](),controller['getMessages']);router[_0x94fd('0x9')](_0x94fd('0xe'),auth['isAuthenticated'](),controller[_0x94fd('0xf')]);router[_0x94fd('0x10')]('/',auth[_0x94fd('0xa')](),controller[_0x94fd('0x11')]);router[_0x94fd('0x10')]('/:id/messages',auth[_0x94fd('0xa')](),controller[_0x94fd('0x12')]);router[_0x94fd('0x10')](_0x94fd('0x13'),auth[_0x94fd('0xa')](),interaction[_0x94fd('0x14')](_0x94fd('0x15'),_0x94fd('0x16')),controller[_0x94fd('0x17')]);router['put'](_0x94fd('0x18'),auth[_0x94fd('0xa')](),interaction[_0x94fd('0x14')](_0x94fd('0x15'),_0x94fd('0x19')),controller['update']);router[_0x94fd('0x1a')](_0x94fd('0x18'),auth['isAuthenticated'](),interaction[_0x94fd('0x14')]('fax','faxinteraction:destroy'),controller[_0x94fd('0x1b')]);router[_0x94fd('0x1a')](_0x94fd('0x13'),auth[_0x94fd('0xa')](),controller[_0x94fd('0x1c')]);module[_0x94fd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4b8701e..70222cb 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 _0xe539=['ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x455c9a,_0x258756){var _0x533a1f=function(_0x635304){while(--_0x635304){_0x455c9a['push'](_0x455c9a['shift']());}};_0x533a1f(++_0x258756);}(_0xe539,0x6e));var _0x9e53=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xe539[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x9e53('0x0'));module[_0x9e53('0x1')]={'body':{'type':Sequelize[_0x9e53('0x2')](_0x9e53('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e53('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9e53('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e53('0x5')]}}; \ No newline at end of file +var _0xf933=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0x599758,_0x219573){var _0x341e37=function(_0x1a827c){while(--_0x1a827c){_0x599758['push'](_0x599758['shift']());}};_0x341e37(++_0x219573);}(_0xf933,0xc8));var _0x3f93=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0xf933[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require(_0x3f93('0x0'));module[_0x3f93('0x1')]={'body':{'type':Sequelize[_0x3f93('0x2')](_0x3f93('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3f93('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3f93('0x5')),'defaultValue':_0x3f93('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f0e4fe0..08f03b6 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 _0xc145=['save','update','destroy','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','intersection','fields','find','body','params','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','rejectmessage','create','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','count','offset','limit','set','reject'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc145,0x1d8));var _0x5c14=function(_0x3460fa,_0x2bb992){_0x3460fa=_0x3460fa-0x0;var _0x4d13fe=_0xc145[_0x3460fa];return _0x4d13fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c14('0x0'));var rimraf=require(_0x5c14('0x1'));var zipdir=require(_0x5c14('0x2'));var jsonpatch=require(_0x5c14('0x3'));var rp=require(_0x5c14('0x4'));var moment=require(_0x5c14('0x5'));var BPromise=require(_0x5c14('0x6'));var Mustache=require(_0x5c14('0x7'));var util=require(_0x5c14('0x8'));var path=require(_0x5c14('0x9'));var sox=require(_0x5c14('0xa'));var csv=require(_0x5c14('0xb'));var ejs=require(_0x5c14('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5c14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c14('0xb'));var querystring=require(_0x5c14('0xe'));var Papa=require(_0x5c14('0xf'));var Redis=require('ioredis');var authService=require(_0x5c14('0x10'));var qs=require(_0x5c14('0x11'));var as=require(_0x5c14('0x12'));var hardwareService=require(_0x5c14('0x13'));var logger=require(_0x5c14('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5c14('0x15'));var db=require(_0x5c14('0x16'))['db'];config[_0x5c14('0x17')]=_[_0x5c14('0x18')](config[_0x5c14('0x17')],{'host':_0x5c14('0x19'),'port':0x18eb});var socket=require(_0x5c14('0x1a'))(new Redis(config[_0x5c14('0x17')]));require('./faxMessage.socket')[_0x5c14('0x1b')](socket);var jayson=require(_0x5c14('0x1c'));var client=jayson[_0x5c14('0x1d')][_0x5c14('0x1e')]({'port':0x232c});var client9002=jayson[_0x5c14('0x1d')][_0x5c14('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x20fa97,_0x11297e,_0x486536){if(_0x486536){var _0x181f67=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x181f67['test'](_0x11297e)){return _0x20fa97;}else{throw new db['Sequelize'][(_0x5c14('0x1f'))](_0x5c14('0x20'));}}else{return _0x20fa97;}}function respondWithRpcPromise(_0x19fbb3,_0x195b70,_0x41e340,_0xcbf9b4){return new BPromise(function(_0x10bf4e,_0x152ad8){var _0x214f4d=_0xcbf9b4||client;return _0x214f4d[_0x5c14('0x21')](_0x19fbb3,_0x41e340)[_0x5c14('0x22')](function(_0x440f4c){logger['info']('FaxMessage,\x20%s,\x20%s',_0x195b70,_0x5c14('0x23'));logger['debug'](_0x5c14('0x24'),_0x195b70,'request\x20sent',JSON[_0x5c14('0x25')](_0x440f4c));if(_0x440f4c[_0x5c14('0x26')]){if(_0x440f4c[_0x5c14('0x26')]['code']===0x1f4){logger[_0x5c14('0x26')]('FaxMessage,\x20%s,\x20%s',_0x195b70,_0x440f4c[_0x5c14('0x26')][_0x5c14('0x27')]);return _0x152ad8(_0x440f4c['error'][_0x5c14('0x27')]);}logger[_0x5c14('0x26')](_0x5c14('0x28'),_0x195b70,_0x440f4c['error'][_0x5c14('0x27')]);return _0x10bf4e(_0x440f4c[_0x5c14('0x26')]['message']);}else{logger[_0x5c14('0x29')]('FaxMessage,\x20%s,\x20%s',_0x195b70,_0x5c14('0x23'));_0x10bf4e(_0x440f4c['result'][_0x5c14('0x27')]);}})[_0x5c14('0x2a')](function(_0x112696){logger[_0x5c14('0x26')](_0x5c14('0x28'),_0x195b70,_0x112696);_0x152ad8(_0x112696);});});}function respondWithStatusCode(_0x54180c,_0x2d857e){_0x2d857e=_0x2d857e||0xcc;return function(_0x25fd4c){if(_0x25fd4c){return _0x54180c[_0x5c14('0x2b')](_0x2d857e);}return _0x54180c[_0x5c14('0x2c')](_0x2d857e)[_0x5c14('0x2d')]();};}function respondWithResult(_0x241c85,_0xb58bac){_0xb58bac=_0xb58bac||0xc8;return function(_0x49a2f6){if(_0x49a2f6){return _0x241c85[_0x5c14('0x2c')](_0xb58bac)[_0x5c14('0x2e')](_0x49a2f6);}};}function respondWithFilteredResult(_0x377fb4,_0x46e361){return function(_0x3290d9){if(_0x3290d9){var _0x448877=_0x3290d9[_0x5c14('0x2f')],_0x1cdc69=_0x46e361[_0x5c14('0x30')],_0x55db5d=_0x46e361[_0x5c14('0x30')]+_0x46e361[_0x5c14('0x31')],_0xc5a5bc;if(_0x55db5d>=_0x448877){_0x55db5d=_0x448877;_0xc5a5bc=0xc8;}else{_0xc5a5bc=0xce;}_0x377fb4['status'](_0xc5a5bc);return _0x377fb4[_0x5c14('0x32')]('Content-Range',_0x1cdc69+'-'+_0x55db5d+'/'+_0x448877)['json'](_0x3290d9);}return null;};}function patchUpdates(_0x12695a){return function(_0x127588){try{jsonpatch['apply'](_0x127588,_0x12695a,!![]);}catch(_0x19b9c5){return BPromise[_0x5c14('0x33')](_0x19b9c5);}return _0x127588[_0x5c14('0x34')]();};}function saveUpdates(_0x42603b,_0x6a2bb2){return function(_0x54ac06){if(_0x54ac06){return _0x54ac06[_0x5c14('0x35')](_0x42603b)[_0x5c14('0x22')](function(_0xc993fb){return _0xc993fb;});}return null;};}function removeEntity(_0x5b8c5e,_0x39cd87){return function(_0x5c9e83){if(_0x5c9e83){return _0x5c9e83[_0x5c14('0x36')]()[_0x5c14('0x22')](function(){_0x5b8c5e['status'](0xcc)[_0x5c14('0x2d')]();});}};}function handleEntityNotFound(_0x50ad26,_0x3d2bbc){return function(_0x47bc06){if(!_0x47bc06){_0x50ad26[_0x5c14('0x2b')](0x194);}return _0x47bc06;};}function handleError(_0x302f60,_0x18ddce){_0x18ddce=_0x18ddce||0x1f4;return function(_0x9d1091){logger[_0x5c14('0x26')](_0x9d1091['stack']);if(_0x9d1091['name']){delete _0x9d1091[_0x5c14('0x37')];}_0x302f60[_0x5c14('0x2c')](_0x18ddce)[_0x5c14('0x38')](_0x9d1091);};}exports[_0x5c14('0x39')]=function(_0x1ae52e,_0x837957){var _0x47675a={},_0x591f2d={},_0x3cca05={'count':0x0,'rows':[]};var _0x5f3320=_[_0x5c14('0x3a')](db[_0x5c14('0x3b')][_0x5c14('0x3c')],function(_0x19f6c9){return{'name':_0x19f6c9[_0x5c14('0x3d')],'type':_0x19f6c9[_0x5c14('0x3e')][_0x5c14('0x3f')]};});_0x591f2d[_0x5c14('0x40')]=_['map'](_0x5f3320,_0x5c14('0x37'));_0x591f2d['query']=_[_0x5c14('0x41')](_0x1ae52e[_0x5c14('0x42')]);_0x591f2d[_0x5c14('0x43')]=_['intersection'](_0x591f2d[_0x5c14('0x40')],_0x591f2d[_0x5c14('0x42')]);_0x47675a[_0x5c14('0x44')]=_['intersection'](_0x591f2d['model'],qs['fields'](_0x1ae52e[_0x5c14('0x42')]['fields']));_0x47675a['attributes']=_0x47675a[_0x5c14('0x44')]['length']?_0x47675a[_0x5c14('0x44')]:_0x591f2d[_0x5c14('0x40')];if(!_0x1ae52e[_0x5c14('0x42')][_0x5c14('0x45')](_0x5c14('0x46'))){_0x47675a[_0x5c14('0x31')]=qs[_0x5c14('0x31')](_0x1ae52e[_0x5c14('0x42')][_0x5c14('0x31')]);_0x47675a[_0x5c14('0x30')]=qs[_0x5c14('0x30')](_0x1ae52e[_0x5c14('0x42')]['offset']);}_0x47675a[_0x5c14('0x47')]=qs[_0x5c14('0x48')](_0x1ae52e[_0x5c14('0x42')][_0x5c14('0x48')]);_0x47675a[_0x5c14('0x49')]=qs['filters'](_[_0x5c14('0x4a')](_0x1ae52e['query'],_0x591f2d['filters']),_0x5f3320);if(_0x1ae52e['query']['filter']){_0x47675a[_0x5c14('0x49')]=_[_0x5c14('0x4b')](_0x47675a[_0x5c14('0x49')],{'$or':_[_0x5c14('0x3a')](_0x5f3320,function(_0x5a7310){if(_0x5a7310[_0x5c14('0x3e')]!==_0x5c14('0x4c')){var _0x3747e1={};_0x3747e1[_0x5a7310[_0x5c14('0x37')]]={'$like':'%'+_0x1ae52e[_0x5c14('0x42')][_0x5c14('0x4d')]+'%'};return _0x3747e1;}})});}_0x47675a=_[_0x5c14('0x4b')]({},_0x47675a,_0x1ae52e[_0x5c14('0x4e')]);var _0x1abb05={'where':_0x47675a['where']};return db[_0x5c14('0x3b')]['count'](_0x1abb05)[_0x5c14('0x22')](function(_0xf0f756){_0x3cca05[_0x5c14('0x2f')]=_0xf0f756;if(_0x1ae52e['query'][_0x5c14('0x4f')]){_0x47675a['include']=[{'all':!![]}];}return db[_0x5c14('0x3b')][_0x5c14('0x50')](_0x47675a);})['then'](function(_0x320f49){_0x3cca05[_0x5c14('0x51')]=_0x320f49;return _0x3cca05;})['then'](respondWithFilteredResult(_0x837957,_0x47675a))[_0x5c14('0x2a')](handleError(_0x837957,null));};exports[_0x5c14('0x52')]=function(_0x10d347,_0x4fa88c){var _0xf7c104={'raw':!![],'where':{'id':_0x10d347['params']['id']}},_0x4d1cfc={};_0x4d1cfc[_0x5c14('0x40')]=_[_0x5c14('0x41')](db[_0x5c14('0x3b')][_0x5c14('0x3c')]);_0x4d1cfc[_0x5c14('0x42')]=_['keys'](_0x10d347['query']);_0x4d1cfc[_0x5c14('0x43')]=_[_0x5c14('0x53')](_0x4d1cfc[_0x5c14('0x40')],_0x4d1cfc[_0x5c14('0x42')]);_0xf7c104[_0x5c14('0x44')]=_[_0x5c14('0x53')](_0x4d1cfc[_0x5c14('0x40')],qs[_0x5c14('0x54')](_0x10d347[_0x5c14('0x42')][_0x5c14('0x54')]));_0xf7c104[_0x5c14('0x44')]=_0xf7c104[_0x5c14('0x44')]['length']?_0xf7c104[_0x5c14('0x44')]:_0x4d1cfc[_0x5c14('0x40')];if(_0x10d347[_0x5c14('0x42')][_0x5c14('0x4f')]){_0xf7c104['include']=[{'all':!![]}];}_0xf7c104=_[_0x5c14('0x4b')]({},_0xf7c104,_0x10d347['options']);return db[_0x5c14('0x3b')][_0x5c14('0x55')](_0xf7c104)[_0x5c14('0x22')](handleEntityNotFound(_0x4fa88c,null))[_0x5c14('0x22')](respondWithResult(_0x4fa88c,null))[_0x5c14('0x2a')](handleError(_0x4fa88c,null));};exports[_0x5c14('0x35')]=function(_0x9ea9c2,_0x487433){if(_0x9ea9c2[_0x5c14('0x56')]['id']){delete _0x9ea9c2[_0x5c14('0x56')]['id'];}return db[_0x5c14('0x3b')][_0x5c14('0x55')]({'where':{'id':_0x9ea9c2[_0x5c14('0x57')]['id']}})[_0x5c14('0x22')](handleEntityNotFound(_0x487433,null))[_0x5c14('0x22')](saveUpdates(_0x9ea9c2[_0x5c14('0x56')],null))[_0x5c14('0x22')](respondWithResult(_0x487433,null))[_0x5c14('0x2a')](handleError(_0x487433,null));};exports[_0x5c14('0x36')]=function(_0x5256ec,_0x10719f){return db[_0x5c14('0x3b')]['find']({'where':{'id':_0x5256ec[_0x5c14('0x57')]['id']}})[_0x5c14('0x22')](handleEntityNotFound(_0x10719f,null))['then'](removeEntity(_0x10719f,null))[_0x5c14('0x2a')](handleError(_0x10719f,null));};exports[_0x5c14('0x58')]=function(_0x5c48ee,_0x345c80){return db['FaxMessage'][_0x5c14('0x58')]()['then'](respondWithResult(_0x345c80,null))[_0x5c14('0x2a')](handleError(_0x345c80,null));};var interaction_log=require('../../config/logger')(_0x5c14('0x59'));exports[_0x5c14('0x5a')]=function(_0x32a31c,_0x18d7af,_0x582eeb){var _0x3d7445={'channel':_0x5c14('0x5b')};if(_0x32a31c['body']['id']){delete _0x32a31c[_0x5c14('0x56')]['id'];}_0x32a31c[_0x5c14('0x56')][_0x5c14('0x5c')]=!![];_0x32a31c[_0x5c14('0x56')]['readAt']=moment()[_0x5c14('0x5d')](_0x5c14('0x5e'));_0x32a31c[_0x5c14('0x56')][_0x5c14('0x5f')]=_0x32a31c[_0x5c14('0x56')]['UserId']||_0x32a31c[_0x5c14('0x60')]['id'];return db[_0x5c14('0x3b')][_0x5c14('0x55')]({'where':{'id':_0x32a31c[_0x5c14('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x5c14('0x61')],'as':'Contact'}]})[_0x5c14('0x22')](handleEntityNotFound(_0x18d7af,null))[_0x5c14('0x22')](saveUpdates(_0x32a31c['body'],null))[_0x5c14('0x22')](function(_0x45b951){if(_0x45b951){_0x3d7445[_0x5c14('0x27')]=_0x45b951[_0x5c14('0x62')]({'plain':!![]});return db[_0x5c14('0x63')]['find']({'where':{'id':_0x45b951[_0x5c14('0x64')]}});}return null;})[_0x5c14('0x22')](handleEntityNotFound(_0x18d7af,null))[_0x5c14('0x22')](function(_0x26b62c){if(_0x26b62c){return _0x26b62c['update']({'UserId':_0x32a31c[_0x5c14('0x56')][_0x5c14('0x5f')],'read1stAt':_[_0x5c14('0x65')](_0x26b62c[_0x5c14('0x66')])?moment()[_0x5c14('0x5d')](_0x5c14('0x5e')):undefined});}return null;})['then'](function(_0x5132b1){if(_0x5132b1){_0x3d7445['interaction']=_0x5132b1[_0x5c14('0x62')]({'plain':!![]});interaction_log[_0x5c14('0x29')](_0x5c14('0x67'),_0x32a31c[_0x5c14('0x60')]['id'],_0x32a31c[_0x5c14('0x60')][_0x5c14('0x37')],_0x32a31c[_0x5c14('0x60')]['role'],_0x3d7445['interaction']['id'],_0x32a31c[_0x5c14('0x56')]?JSON[_0x5c14('0x25')](_0x32a31c['body']):'null');return respondWithRpcPromise(_0x5c14('0x68'),_0x5c14('0x69'),_0x3d7445);}return null;})['then'](function(_0x48b4c3){if(_0x48b4c3){if(_0x32a31c[_0x5c14('0x56')][_0x5c14('0x6a')]){_0x3d7445[_0x5c14('0x27')][_0x5c14('0x6b')]=util[_0x5c14('0x5d')](_0x5c14('0x6c'),_0x32a31c['user']['name']);_0x3d7445[_0x5c14('0x27')][_0x5c14('0x6d')]=_0x3d7445['channel'];_0x3d7445[_0x5c14('0x27')][_0x5c14('0x6e')]=_0x5c14('0x5a');return respondWithRpcPromise(_0x5c14('0x6f'),_0x5c14('0x6f'),{'event':_0x5c14('0x70'),'message':_0x3d7445['message']},client9002)['then'](function(){return _0x3d7445;});}return _0x3d7445;}return null;})[_0x5c14('0x22')](respondWithResult(_0x18d7af,null))[_0x5c14('0x2a')](handleError(_0x18d7af,null));};var interaction_log=require(_0x5c14('0x14'))(_0x5c14('0x59'));exports[_0x5c14('0x33')]=function(_0x5087fc,_0x47f7fc,_0x5beed6){var _0x5f29ea={'agent':{},'channel':_0x5c14('0x5b')};if(_0x5087fc[_0x5c14('0x56')]['id']){delete _0x5087fc[_0x5c14('0x56')]['id'];}_0x5087fc[_0x5c14('0x56')][_0x5c14('0x5f')]=_0x5087fc['body'][_0x5c14('0x5f')]||_0x5087fc[_0x5c14('0x60')]['id'];_0x5f29ea['agent']['id']=_0x5087fc[_0x5c14('0x56')][_0x5c14('0x5f')];return db[_0x5c14('0x3b')][_0x5c14('0x55')]({'where':{'id':_0x5087fc[_0x5c14('0x57')]['id'],'UserId':null}})[_0x5c14('0x22')](handleEntityNotFound(_0x47f7fc,null))['then'](function(_0x15faab){if(_0x15faab){_0x5f29ea['message']=_0x15faab[_0x5c14('0x62')]({'plain':!![]});return db[_0x5c14('0x63')][_0x5c14('0x55')]({'where':{'id':_0x15faab[_0x5c14('0x64')]}});}return null;})[_0x5c14('0x22')](handleEntityNotFound(_0x47f7fc,null))['then'](function(_0x3f5d8a){if(_0x3f5d8a){_0x5f29ea[_0x5c14('0x71')]=_0x3f5d8a['get']({'plain':!![]});interaction_log[_0x5c14('0x29')](_0x5c14('0x72'),_0x5087fc[_0x5c14('0x60')]['id'],_0x5087fc[_0x5c14('0x60')][_0x5c14('0x37')],_0x5087fc[_0x5c14('0x60')][_0x5c14('0x73')],_0x5f29ea[_0x5c14('0x71')]['id'],_0x5087fc[_0x5c14('0x56')]?JSON[_0x5c14('0x25')](_0x5087fc['body']):_0x5c14('0x74'));return respondWithRpcPromise('RejectMessage',_0x5c14('0x75'),_0x5f29ea);}return null;})['then'](function(_0x231287){if(_0x231287){_0x231287[_0x5c14('0x27')]['interface']=util[_0x5c14('0x5d')](_0x5c14('0x6c'),_0x5087fc[_0x5c14('0x60')][_0x5c14('0x37')]);_0x231287['message'][_0x5c14('0x6d')]=_0x5f29ea[_0x5c14('0x6d')];_0x231287[_0x5c14('0x27')]['event']=_0x5c14('0x33');respondWithRpcPromise(_0x5c14('0x6f'),_0x5c14('0x6f'),{'event':_0x5c14('0x76'),'message':_0x231287[_0x5c14('0x27')]},client9002);return _0x5f29ea;}return null;})[_0x5c14('0x22')](respondWithResult(_0x47f7fc,null))[_0x5c14('0x2a')](handleError(_0x47f7fc,null));};exports[_0x5c14('0x77')]=function(_0x4751c3,_0x4e83a6){var _0xa5526f;return db[_0x5c14('0x3b')][_0x5c14('0x77')](_0x4751c3['body'],{})['then'](function(_0x524702){_0xa5526f=_0x524702;return db['CmContact']['findOne']({'where':{'id':_0xa5526f['ContactId']}});})['then'](function(_0x13f08b){if(_[_0x5c14('0x65')](_0x13f08b)){return;}else{_0xa5526f[_0x5c14('0x5b')]=_0x13f08b[_0x5c14('0x5b')];return db[_0x5c14('0x78')][_0x5c14('0x79')]({'where':{'id':_0xa5526f['AttachmentId']}});}})[_0x5c14('0x22')](function(_0x37392a){return respondWithRpcPromise('SendFax',_0x5c14('0x7a'),{'FaxAccountId':_[_0x5c14('0x65')](_0x4751c3[_0x5c14('0x56')])?undefined:_0x4751c3[_0x5c14('0x56')][_0x5c14('0x7b')],'path':_['isNil'](_0x37392a)?undefined:util[_0x5c14('0x5d')](_0x5c14('0x7c'),_0x37392a['basename']),'fax':_['isNil'](_0xa5526f[_0x5c14('0x5b')])?undefined:_0xa5526f['fax'],'AttachmentId':_0xa5526f['AttachmentId']},client9002);})[_0x5c14('0x22')](respondWithResult(_0x4e83a6,0xc9))[_0x5c14('0x2a')](handleError(_0x4e83a6,null));};exports[_0x5c14('0x7d')]=function(_0x1769a2,_0x5c60d9){var _0x1c1e1c=path[_0x5c14('0x7e')](config[_0x5c14('0x7f')],_0x5c14('0x80'),_0x5c14('0x81'),_0x5c14('0x82'));return db[_0x5c14('0x3b')][_0x5c14('0x55')]({'where':{'id':_0x1769a2[_0x5c14('0x57')]['id']},'include':[{'model':db[_0x5c14('0x78')],'as':_0x5c14('0x78')}]})[_0x5c14('0x22')](handleEntityNotFound(_0x5c60d9,null))[_0x5c14('0x22')](function(_0x26012e){if(_0x26012e){return _0x5c60d9['download'](path[_0x5c14('0x7e')](_0x1c1e1c,_0x26012e[_0x5c14('0x78')]['basename']));}})[_0x5c14('0x2a')](handleError(_0x5c60d9,null));}; \ No newline at end of file +var _0x0cd8=['includeAll','include','findAll','rows','catch','show','params','update','body','find','describe','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','get','FaxInteraction','FaxInteractionId','UserId','isNil','read1stAt','interaction','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','files','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','then','stack','name','FaxMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','type','VIRTUAL','merge','count'];(function(_0x24e867,_0x131116){var _0x5ab002=function(_0xa44e8b){while(--_0xa44e8b){_0x24e867['push'](_0x24e867['shift']());}};_0x5ab002(++_0x131116);}(_0x0cd8,0xbe));var _0x80cd=function(_0x37ba47,_0x44d3db){_0x37ba47=_0x37ba47-0x0;var _0x5e8974=_0x0cd8[_0x37ba47];return _0x5e8974;};'use strict';var pdf=require(_0x80cd('0x0'));var emlformat=require(_0x80cd('0x1'));var rimraf=require(_0x80cd('0x2'));var zipdir=require(_0x80cd('0x3'));var jsonpatch=require(_0x80cd('0x4'));var rp=require('request-promise');var moment=require(_0x80cd('0x5'));var BPromise=require(_0x80cd('0x6'));var Mustache=require(_0x80cd('0x7'));var util=require(_0x80cd('0x8'));var path=require('path');var sox=require(_0x80cd('0x9'));var csv=require(_0x80cd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x80cd('0xb'));var squel=require(_0x80cd('0xc'));var crypto=require(_0x80cd('0xd'));var jsforce=require(_0x80cd('0xe'));var deskjs=require(_0x80cd('0xf'));var toCsv=require(_0x80cd('0xa'));var querystring=require(_0x80cd('0x10'));var Papa=require(_0x80cd('0x11'));var Redis=require(_0x80cd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x80cd('0x13'));var as=require(_0x80cd('0x14'));var hardwareService=require(_0x80cd('0x15'));var logger=require(_0x80cd('0x16'))(_0x80cd('0x17'));var utils=require(_0x80cd('0x18'));var config=require(_0x80cd('0x19'));var db=require(_0x80cd('0x1a'))['db'];config['redis']=_['defaults'](config[_0x80cd('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x80cd('0x1c'))(new Redis(config[_0x80cd('0x1b')]));require('./faxMessage.socket')[_0x80cd('0x1d')](socket);var jayson=require(_0x80cd('0x1e'));var client=jayson['client'][_0x80cd('0x1f')]({'port':0x232c});var client9002=jayson[_0x80cd('0x20')]['http']({'port':0x232a});function checkPasswordPattern(_0x32ad3e,_0x406e15,_0x44c7d3){if(_0x44c7d3){var _0x4177a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4177a0[_0x80cd('0x21')](_0x406e15)){return _0x32ad3e;}else{throw new db[(_0x80cd('0x22'))][(_0x80cd('0x23'))](_0x80cd('0x24'));}}else{return _0x32ad3e;}}function respondWithRpcPromise(_0x37426b,_0x298ece,_0x286977,_0x5f2d79){return new BPromise(function(_0x20a950,_0x349ead){var _0x474883=_0x5f2d79||client;return _0x474883[_0x80cd('0x25')](_0x37426b,_0x286977)['then'](function(_0xc9a5e){logger[_0x80cd('0x26')](_0x80cd('0x27'),_0x298ece,'request\x20sent');logger[_0x80cd('0x28')](_0x80cd('0x29'),_0x298ece,_0x80cd('0x2a'),JSON[_0x80cd('0x2b')](_0xc9a5e));if(_0xc9a5e[_0x80cd('0x2c')]){if(_0xc9a5e[_0x80cd('0x2c')][_0x80cd('0x2d')]===0x1f4){logger[_0x80cd('0x2c')](_0x80cd('0x27'),_0x298ece,_0xc9a5e['error']['message']);return _0x349ead(_0xc9a5e[_0x80cd('0x2c')][_0x80cd('0x2e')]);}logger[_0x80cd('0x2c')](_0x80cd('0x27'),_0x298ece,_0xc9a5e[_0x80cd('0x2c')][_0x80cd('0x2e')]);return _0x20a950(_0xc9a5e[_0x80cd('0x2c')]['message']);}else{logger[_0x80cd('0x26')](_0x80cd('0x27'),_0x298ece,'request\x20sent');_0x20a950(_0xc9a5e['result'][_0x80cd('0x2e')]);}})['catch'](function(_0x297f15){logger[_0x80cd('0x2c')](_0x80cd('0x27'),_0x298ece,_0x297f15);_0x349ead(_0x297f15);});});}function respondWithStatusCode(_0x6b92b8,_0x44a1de){_0x44a1de=_0x44a1de||0xcc;return function(_0x49eca6){if(_0x49eca6){return _0x6b92b8[_0x80cd('0x2f')](_0x44a1de);}return _0x6b92b8[_0x80cd('0x30')](_0x44a1de)[_0x80cd('0x31')]();};}function respondWithResult(_0x1dad87,_0x17764c){_0x17764c=_0x17764c||0xc8;return function(_0x2c4fc3){if(_0x2c4fc3){return _0x1dad87[_0x80cd('0x30')](_0x17764c)['json'](_0x2c4fc3);}};}function respondWithFilteredResult(_0x567510,_0x255974){return function(_0x1d9c84){if(_0x1d9c84){var _0x1ec5e3=_0x1d9c84['count'],_0x50cb37=_0x255974['offset'],_0x489e08=_0x255974[_0x80cd('0x32')]+_0x255974['limit'],_0x12b546;if(_0x489e08>=_0x1ec5e3){_0x489e08=_0x1ec5e3;_0x12b546=0xc8;}else{_0x12b546=0xce;}_0x567510[_0x80cd('0x30')](_0x12b546);return _0x567510[_0x80cd('0x33')](_0x80cd('0x34'),_0x50cb37+'-'+_0x489e08+'/'+_0x1ec5e3)[_0x80cd('0x35')](_0x1d9c84);}return null;};}function patchUpdates(_0x14fa97){return function(_0x366816){try{jsonpatch[_0x80cd('0x36')](_0x366816,_0x14fa97,!![]);}catch(_0x1de945){return BPromise[_0x80cd('0x37')](_0x1de945);}return _0x366816['save']();};}function saveUpdates(_0x148cf1,_0x4f8874){return function(_0x40767d){if(_0x40767d){return _0x40767d['update'](_0x148cf1)[_0x80cd('0x38')](function(_0x1dd6f6){return _0x1dd6f6;});}return null;};}function removeEntity(_0x3fd51c,_0x9c5797){return function(_0x4937b4){if(_0x4937b4){return _0x4937b4['destroy']()['then'](function(){_0x3fd51c['status'](0xcc)[_0x80cd('0x31')]();});}};}function handleEntityNotFound(_0x2a17f8,_0x23015c){return function(_0x1be38d){if(!_0x1be38d){_0x2a17f8[_0x80cd('0x2f')](0x194);}return _0x1be38d;};}function handleError(_0x84a074,_0xf522ff){_0xf522ff=_0xf522ff||0x1f4;return function(_0x124bb3){logger['error'](_0x124bb3[_0x80cd('0x39')]);if(_0x124bb3[_0x80cd('0x3a')]){delete _0x124bb3['name'];}_0x84a074[_0x80cd('0x30')](_0xf522ff)['send'](_0x124bb3);};}exports['index']=function(_0x35f72f,_0x3fc6c3){var _0x5289dd={},_0x12d9ce={},_0x56946f={'count':0x0,'rows':[]};var _0x5ed0f8=_['map'](db[_0x80cd('0x3b')][_0x80cd('0x3c')],function(_0x5b06a6){return{'name':_0x5b06a6[_0x80cd('0x3d')],'type':_0x5b06a6['type'][_0x80cd('0x3e')]};});_0x12d9ce[_0x80cd('0x3f')]=_[_0x80cd('0x40')](_0x5ed0f8,_0x80cd('0x3a'));_0x12d9ce[_0x80cd('0x41')]=_[_0x80cd('0x42')](_0x35f72f[_0x80cd('0x41')]);_0x12d9ce[_0x80cd('0x43')]=_['intersection'](_0x12d9ce[_0x80cd('0x3f')],_0x12d9ce['query']);_0x5289dd['attributes']=_[_0x80cd('0x44')](_0x12d9ce[_0x80cd('0x3f')],qs[_0x80cd('0x45')](_0x35f72f[_0x80cd('0x41')][_0x80cd('0x45')]));_0x5289dd['attributes']=_0x5289dd[_0x80cd('0x46')]['length']?_0x5289dd[_0x80cd('0x46')]:_0x12d9ce[_0x80cd('0x3f')];if(!_0x35f72f[_0x80cd('0x41')][_0x80cd('0x47')](_0x80cd('0x48'))){_0x5289dd[_0x80cd('0x49')]=qs['limit'](_0x35f72f[_0x80cd('0x41')]['limit']);_0x5289dd[_0x80cd('0x32')]=qs[_0x80cd('0x32')](_0x35f72f['query'][_0x80cd('0x32')]);}_0x5289dd[_0x80cd('0x4a')]=qs['sort'](_0x35f72f['query'][_0x80cd('0x4b')]);_0x5289dd['where']=qs[_0x80cd('0x43')](_['pick'](_0x35f72f[_0x80cd('0x41')],_0x12d9ce[_0x80cd('0x43')]),_0x5ed0f8);if(_0x35f72f['query'][_0x80cd('0x4c')]){_0x5289dd[_0x80cd('0x4d')]=_['merge'](_0x5289dd[_0x80cd('0x4d')],{'$or':_[_0x80cd('0x40')](_0x5ed0f8,function(_0x14c73a){if(_0x14c73a[_0x80cd('0x4e')]!==_0x80cd('0x4f')){var _0xf91bf9={};_0xf91bf9[_0x14c73a[_0x80cd('0x3a')]]={'$like':'%'+_0x35f72f[_0x80cd('0x41')]['filter']+'%'};return _0xf91bf9;}})});}_0x5289dd=_[_0x80cd('0x50')]({},_0x5289dd,_0x35f72f['options']);var _0x5e4992={'where':_0x5289dd['where']};return db[_0x80cd('0x3b')][_0x80cd('0x51')](_0x5e4992)[_0x80cd('0x38')](function(_0x332f25){_0x56946f[_0x80cd('0x51')]=_0x332f25;if(_0x35f72f[_0x80cd('0x41')][_0x80cd('0x52')]){_0x5289dd[_0x80cd('0x53')]=[{'all':!![]}];}return db[_0x80cd('0x3b')][_0x80cd('0x54')](_0x5289dd);})[_0x80cd('0x38')](function(_0x9e4447){_0x56946f[_0x80cd('0x55')]=_0x9e4447;return _0x56946f;})[_0x80cd('0x38')](respondWithFilteredResult(_0x3fc6c3,_0x5289dd))[_0x80cd('0x56')](handleError(_0x3fc6c3,null));};exports[_0x80cd('0x57')]=function(_0x263b04,_0x9d6ced){var _0x29a59a={'raw':!![],'where':{'id':_0x263b04[_0x80cd('0x58')]['id']}},_0x395c09={};_0x395c09[_0x80cd('0x3f')]=_['keys'](db[_0x80cd('0x3b')][_0x80cd('0x3c')]);_0x395c09[_0x80cd('0x41')]=_[_0x80cd('0x42')](_0x263b04['query']);_0x395c09[_0x80cd('0x43')]=_[_0x80cd('0x44')](_0x395c09[_0x80cd('0x3f')],_0x395c09['query']);_0x29a59a[_0x80cd('0x46')]=_[_0x80cd('0x44')](_0x395c09[_0x80cd('0x3f')],qs[_0x80cd('0x45')](_0x263b04[_0x80cd('0x41')][_0x80cd('0x45')]));_0x29a59a[_0x80cd('0x46')]=_0x29a59a['attributes']['length']?_0x29a59a[_0x80cd('0x46')]:_0x395c09[_0x80cd('0x3f')];if(_0x263b04['query'][_0x80cd('0x52')]){_0x29a59a[_0x80cd('0x53')]=[{'all':!![]}];}_0x29a59a=_[_0x80cd('0x50')]({},_0x29a59a,_0x263b04['options']);return db[_0x80cd('0x3b')]['find'](_0x29a59a)[_0x80cd('0x38')](handleEntityNotFound(_0x9d6ced,null))[_0x80cd('0x38')](respondWithResult(_0x9d6ced,null))[_0x80cd('0x56')](handleError(_0x9d6ced,null));};exports[_0x80cd('0x59')]=function(_0x1b44d8,_0x55277a){if(_0x1b44d8[_0x80cd('0x5a')]['id']){delete _0x1b44d8[_0x80cd('0x5a')]['id'];}return db[_0x80cd('0x3b')]['find']({'where':{'id':_0x1b44d8[_0x80cd('0x58')]['id']}})[_0x80cd('0x38')](handleEntityNotFound(_0x55277a,null))['then'](saveUpdates(_0x1b44d8[_0x80cd('0x5a')],null))[_0x80cd('0x38')](respondWithResult(_0x55277a,null))['catch'](handleError(_0x55277a,null));};exports['destroy']=function(_0x233136,_0x35f52b){return db[_0x80cd('0x3b')][_0x80cd('0x5b')]({'where':{'id':_0x233136['params']['id']}})[_0x80cd('0x38')](handleEntityNotFound(_0x35f52b,null))[_0x80cd('0x38')](removeEntity(_0x35f52b,null))[_0x80cd('0x56')](handleError(_0x35f52b,null));};exports['describe']=function(_0x3d5aad,_0x48316f){return db['FaxMessage'][_0x80cd('0x5c')]()['then'](respondWithResult(_0x48316f,null))[_0x80cd('0x56')](handleError(_0x48316f,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x80cd('0x5d')]=function(_0x56038a,_0x3ec23f,_0x5ef507){var _0xfdccdf={'channel':_0x80cd('0x5e')};if(_0x56038a[_0x80cd('0x5a')]['id']){delete _0x56038a[_0x80cd('0x5a')]['id'];}_0x56038a[_0x80cd('0x5a')][_0x80cd('0x5f')]=!![];_0x56038a[_0x80cd('0x5a')]['readAt']=moment()[_0x80cd('0x60')](_0x80cd('0x61'));_0x56038a[_0x80cd('0x5a')]['UserId']=_0x56038a[_0x80cd('0x5a')]['UserId']||_0x56038a['user']['id'];return db[_0x80cd('0x3b')][_0x80cd('0x5b')]({'where':{'id':_0x56038a[_0x80cd('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x80cd('0x62')],'as':_0x80cd('0x63')}]})[_0x80cd('0x38')](handleEntityNotFound(_0x3ec23f,null))['then'](saveUpdates(_0x56038a['body'],null))[_0x80cd('0x38')](function(_0x2d94b0){if(_0x2d94b0){_0xfdccdf[_0x80cd('0x2e')]=_0x2d94b0[_0x80cd('0x64')]({'plain':!![]});return db[_0x80cd('0x65')][_0x80cd('0x5b')]({'where':{'id':_0x2d94b0[_0x80cd('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3ec23f,null))[_0x80cd('0x38')](function(_0x510f5c){if(_0x510f5c){return _0x510f5c[_0x80cd('0x59')]({'UserId':_0x56038a['body'][_0x80cd('0x67')],'read1stAt':_[_0x80cd('0x68')](_0x510f5c[_0x80cd('0x69')])?moment()[_0x80cd('0x60')](_0x80cd('0x61')):undefined});}return null;})[_0x80cd('0x38')](function(_0x2289af){if(_0x2289af){_0xfdccdf[_0x80cd('0x6a')]=_0x2289af[_0x80cd('0x64')]({'plain':!![]});interaction_log[_0x80cd('0x26')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56038a[_0x80cd('0x6b')]['id'],_0x56038a[_0x80cd('0x6b')][_0x80cd('0x3a')],_0x56038a[_0x80cd('0x6b')][_0x80cd('0x6c')],_0xfdccdf['interaction']['id'],_0x56038a[_0x80cd('0x5a')]?JSON['stringify'](_0x56038a[_0x80cd('0x5a')]):_0x80cd('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x80cd('0x6e'),_0xfdccdf);}return null;})['then'](function(_0x94d4ae){if(_0x94d4ae){if(_0x56038a['body'][_0x80cd('0x6f')]){_0xfdccdf[_0x80cd('0x2e')][_0x80cd('0x70')]=util['format'](_0x80cd('0x71'),_0x56038a['user'][_0x80cd('0x3a')]);_0xfdccdf[_0x80cd('0x2e')][_0x80cd('0x72')]=_0xfdccdf['channel'];_0xfdccdf[_0x80cd('0x2e')]['event']='accept';return respondWithRpcPromise(_0x80cd('0x73'),_0x80cd('0x73'),{'event':_0x80cd('0x74'),'message':_0xfdccdf['message']},client9002)['then'](function(){return _0xfdccdf;});}return _0xfdccdf;}return null;})[_0x80cd('0x38')](respondWithResult(_0x3ec23f,null))[_0x80cd('0x56')](handleError(_0x3ec23f,null));};var interaction_log=require(_0x80cd('0x16'))(_0x80cd('0x75'));exports['reject']=function(_0x2ca4ee,_0x4b0ab3,_0xd13f80){var _0x1e1d86={'agent':{},'channel':_0x80cd('0x5e')};if(_0x2ca4ee[_0x80cd('0x5a')]['id']){delete _0x2ca4ee[_0x80cd('0x5a')]['id'];}_0x2ca4ee['body'][_0x80cd('0x67')]=_0x2ca4ee[_0x80cd('0x5a')][_0x80cd('0x67')]||_0x2ca4ee[_0x80cd('0x6b')]['id'];_0x1e1d86['agent']['id']=_0x2ca4ee[_0x80cd('0x5a')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x2ca4ee['params']['id'],'UserId':null}})[_0x80cd('0x38')](handleEntityNotFound(_0x4b0ab3,null))['then'](function(_0x25b732){if(_0x25b732){_0x1e1d86[_0x80cd('0x2e')]=_0x25b732[_0x80cd('0x64')]({'plain':!![]});return db['FaxInteraction'][_0x80cd('0x5b')]({'where':{'id':_0x25b732['FaxInteractionId']}});}return null;})[_0x80cd('0x38')](handleEntityNotFound(_0x4b0ab3,null))[_0x80cd('0x38')](function(_0x5f0585){if(_0x5f0585){_0x1e1d86['interaction']=_0x5f0585['get']({'plain':!![]});interaction_log[_0x80cd('0x26')](_0x80cd('0x76'),_0x2ca4ee['user']['id'],_0x2ca4ee['user'][_0x80cd('0x3a')],_0x2ca4ee[_0x80cd('0x6b')]['role'],_0x1e1d86[_0x80cd('0x6a')]['id'],_0x2ca4ee[_0x80cd('0x5a')]?JSON[_0x80cd('0x2b')](_0x2ca4ee[_0x80cd('0x5a')]):_0x80cd('0x6d'));return respondWithRpcPromise(_0x80cd('0x77'),_0x80cd('0x78'),_0x1e1d86);}return null;})[_0x80cd('0x38')](function(_0x215c9c){if(_0x215c9c){_0x215c9c[_0x80cd('0x2e')][_0x80cd('0x70')]=util[_0x80cd('0x60')](_0x80cd('0x71'),_0x2ca4ee['user'][_0x80cd('0x3a')]);_0x215c9c[_0x80cd('0x2e')]['channel']=_0x1e1d86[_0x80cd('0x72')];_0x215c9c[_0x80cd('0x2e')][_0x80cd('0x79')]=_0x80cd('0x37');respondWithRpcPromise(_0x80cd('0x73'),_0x80cd('0x73'),{'event':_0x80cd('0x7a'),'message':_0x215c9c['message']},client9002);return _0x1e1d86;}return null;})[_0x80cd('0x38')](respondWithResult(_0x4b0ab3,null))[_0x80cd('0x56')](handleError(_0x4b0ab3,null));};exports['create']=function(_0x59d725,_0x56e706){var _0x52e27b;return db['FaxMessage'][_0x80cd('0x7b')](_0x59d725[_0x80cd('0x5a')],{})['then'](function(_0x2c8de){_0x52e27b=_0x2c8de;return db[_0x80cd('0x62')][_0x80cd('0x7c')]({'where':{'id':_0x52e27b[_0x80cd('0x7d')]}});})[_0x80cd('0x38')](function(_0x3422ca){if(_['isNil'](_0x3422ca)){return;}else{_0x52e27b[_0x80cd('0x5e')]=_0x3422ca[_0x80cd('0x5e')];return db[_0x80cd('0x7e')][_0x80cd('0x7c')]({'where':{'id':_0x52e27b['AttachmentId']}});}})['then'](function(_0x14ff7f){return respondWithRpcPromise(_0x80cd('0x7f'),_0x80cd('0x7f'),{'FaxAccountId':_[_0x80cd('0x68')](_0x59d725[_0x80cd('0x5a')])?undefined:_0x59d725[_0x80cd('0x5a')][_0x80cd('0x80')],'path':_[_0x80cd('0x68')](_0x14ff7f)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x14ff7f[_0x80cd('0x81')]),'fax':_[_0x80cd('0x68')](_0x52e27b[_0x80cd('0x5e')])?undefined:_0x52e27b[_0x80cd('0x5e')],'AttachmentId':_0x52e27b[_0x80cd('0x82')]},client9002);})['then'](respondWithResult(_0x56e706,0xc9))[_0x80cd('0x56')](handleError(_0x56e706,null));};exports[_0x80cd('0x83')]=function(_0x1a6edf,_0x1a8e7a){var _0x58100d=path[_0x80cd('0x84')](config[_0x80cd('0x85')],_0x80cd('0x86'),_0x80cd('0x87'),'attachments');return db[_0x80cd('0x3b')][_0x80cd('0x5b')]({'where':{'id':_0x1a6edf[_0x80cd('0x58')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x80cd('0x38')](handleEntityNotFound(_0x1a8e7a,null))[_0x80cd('0x38')](function(_0x3231f7){if(_0x3231f7){return _0x1a8e7a['download'](path['join'](_0x58100d,_0x3231f7[_0x80cd('0x7e')]['basename']));}})[_0x80cd('0x56')](handleError(_0x1a8e7a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0ad0187..769152f 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x533ca6,_0x4ed3fb){var _0x34f0bd=function(_0x2cc877){while(--_0x2cc877){_0x533ca6['push'](_0x533ca6['shift']());}};_0x34f0bd(++_0x4ed3fb);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x55ca,0x126));var _0xa55c=function(_0x1aa289,_0x47d758){_0x1aa289=_0x1aa289-0x0;var _0xb7f13f=_0x55ca[_0x1aa289];return _0xb7f13f;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4c3c7ef..9405dc6 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 _0x8c8b=['define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','util','bluebird','path','../../config/environment'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x8c8b,0x1c3));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb8c8('0x0'));var util=require(_0xb8c8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb8c8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8c8('0x3'));var rimraf=require('rimraf');var config=require(_0xb8c8('0x4'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x48ec29,_0x510fff){return _0x48ec29[_0xb8c8('0x5')](_0xb8c8('0x6'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb8c8('0x7'),'fields':[_0xb8c8('0x8')],'type':_0xb8c8('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1877fe,_0x5bd6c1,_0x453a63){var _0x2dba88=_0x48ec29[_0xb8c8('0xa')];var _0x5d2a0f=_0x1877fe[_0xb8c8('0xb')]({'plain':!![]});if(_0x5d2a0f[_0xb8c8('0xc')][_0xb8c8('0xd')]()==='in'||_0x5d2a0f[_0xb8c8('0xc')]['toLowerCase']()===_0xb8c8('0xe')&&!_0x5d2a0f['secret']&&!_[_0xb8c8('0xf')](_0x5d2a0f[_0xb8c8('0x10')])){_0x2dba88[_0xb8c8('0x11')][_0xb8c8('0x12')]({'where':{'id':_0x5d2a0f[_0xb8c8('0x13')]}})[_0xb8c8('0x14')](function(_0x10953d){if(_0x10953d){_0x10953d['update']({'lastMsgAt':_0x5d2a0f['createdAt'],'lastMsgDirection':_0x5d2a0f['direction'][_0xb8c8('0xd')]()});}})[_0xb8c8('0x15')](function(_0x2dba48){console[_0xb8c8('0x16')](_0x2dba48);});}_0x453a63();}},'charset':'utf8mb4','collate':_0xb8c8('0x17')});}; \ No newline at end of file +var _0x03ca=['exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes'];(function(_0x526dd5,_0x953fd){var _0x497ec4=function(_0x1c4dc7){while(--_0x1c4dc7){_0x526dd5['push'](_0x526dd5['shift']());}};_0x497ec4(++_0x953fd);}(_0x03ca,0x106));var _0xa03c=function(_0x2d14d5,_0x1ea4b2){_0x2d14d5=_0x2d14d5-0x0;var _0x4d89d9=_0x03ca[_0x2d14d5];return _0x4d89d9;};'use strict';var _=require('lodash');var util=require(_0xa03c('0x0'));var logger=require(_0xa03c('0x1'))(_0xa03c('0x2'));var moment=require(_0xa03c('0x3'));var BPromise=require(_0xa03c('0x4'));var rp=require(_0xa03c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa03c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa03c('0x7'));module[_0xa03c('0x8')]=function(_0x11cf74,_0x5c8dce){return _0x11cf74['define'](_0xa03c('0x9'),attributes,{'tableName':_0xa03c('0xa'),'paranoid':![],'indexes':[{'name':_0xa03c('0xb'),'fields':[_0xa03c('0xc')],'type':_0xa03c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x256ff3,_0x54c82b,_0x4ff827){var _0x3cee63=_0x11cf74[_0xa03c('0xe')];var _0x4f834f=_0x256ff3[_0xa03c('0xf')]({'plain':!![]});if(_0x4f834f['direction'][_0xa03c('0x10')]()==='in'||_0x4f834f[_0xa03c('0x11')][_0xa03c('0x10')]()===_0xa03c('0x12')&&!_0x4f834f['secret']&&!_[_0xa03c('0x13')](_0x4f834f[_0xa03c('0x14')])){_0x3cee63[_0xa03c('0x15')][_0xa03c('0x16')]({'where':{'id':_0x4f834f[_0xa03c('0x17')]}})['then'](function(_0x39713a){if(_0x39713a){_0x39713a[_0xa03c('0x18')]({'lastMsgAt':_0x4f834f[_0xa03c('0x19')],'lastMsgDirection':_0x4f834f[_0xa03c('0x11')][_0xa03c('0x10')]()});}})[_0xa03c('0x1a')](function(_0x4d0f83){console[_0xa03c('0x1b')](_0x4d0f83);});}_0x4ff827();}},'charset':_0xa03c('0x1c'),'collate':_0xa03c('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 65ec3c8..6a5adcb 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 _0xaea2=['catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaea2,0x12c));var _0x2aea=function(_0x12e6e5,_0x39855b){_0x12e6e5=_0x12e6e5-0x0;var _0x4ef6ce=_0xaea2[_0x12e6e5];return _0x4ef6ce;};'use strict';var _=require(_0x2aea('0x0'));var util=require(_0x2aea('0x1'));var moment=require(_0x2aea('0x2'));var BPromise=require(_0x2aea('0x3'));var rs=require(_0x2aea('0x4'));var fs=require('fs');var Redis=require(_0x2aea('0x5'));var db=require(_0x2aea('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2aea('0x7'));var client=jayson[_0x2aea('0x8')]['http']({'port':0x232a});config[_0x2aea('0x9')]=_[_0x2aea('0xa')](config[_0x2aea('0x9')],{'host':_0x2aea('0xb'),'port':0x18eb});var socket=require(_0x2aea('0xc'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x2aea('0xd')](socket);function respondWithRpcPromise(_0x5711ec,_0x480338,_0x3c5589){return new BPromise(function(_0x516784,_0x2cd969){return client['request'](_0x5711ec,_0x3c5589)[_0x2aea('0xe')](function(_0x4de8e0){logger[_0x2aea('0xf')](_0x2aea('0x10'),_0x480338,'request\x20sent');logger[_0x2aea('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x480338,_0x2aea('0x12'),JSON[_0x2aea('0x13')](_0x4de8e0));if(_0x4de8e0[_0x2aea('0x14')]){if(_0x4de8e0[_0x2aea('0x14')][_0x2aea('0x15')]===0x1f4){logger[_0x2aea('0x14')]('FaxMessage,\x20%s,\x20%s',_0x480338,_0x4de8e0[_0x2aea('0x14')][_0x2aea('0x16')]);return _0x2cd969(_0x4de8e0[_0x2aea('0x14')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x480338,_0x4de8e0['error']['message']);return _0x516784(_0x4de8e0[_0x2aea('0x14')][_0x2aea('0x16')]);}else{logger[_0x2aea('0xf')]('FaxMessage,\x20%s,\x20%s',_0x480338,'request\x20sent');_0x516784(_0x4de8e0[_0x2aea('0x17')][_0x2aea('0x16')]);}})[_0x2aea('0x18')](function(_0x8478bf){logger[_0x2aea('0x14')]('FaxMessage,\x20%s,\x20%s',_0x480338,_0x8478bf);_0x2cd969(_0x8478bf);});});}exports[_0x2aea('0x19')]=function(_0x4934b3){var _0xb72f41=this;return new Promise(function(_0x19f36e,_0x55947a){return db[_0x2aea('0x1a')][_0x2aea('0x1b')](_0x4934b3[_0x2aea('0x1c')],{'raw':_0x4934b3[_0x2aea('0x1d')]?_0x4934b3['options'][_0x2aea('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4ea5c4){logger['info'](_0x2aea('0x19'),_0x4934b3);logger['debug'](_0x2aea('0x19'),_0x4934b3,JSON[_0x2aea('0x13')](_0x4ea5c4));_0x19f36e(_0x4ea5c4);})[_0x2aea('0x18')](function(_0x303bbc){logger[_0x2aea('0x14')]('CreateFaxMessage',_0x303bbc[_0x2aea('0x16')],_0x4934b3);_0x55947a(_0xb72f41['error'](0x1f4,_0x303bbc['message']));});});};exports[_0x2aea('0x1f')]=function(_0x137769){var _0x9c9206=this;return new Promise(function(_0x15eb3f,_0x64081e){return db[_0x2aea('0x1a')][_0x2aea('0x20')](_0x137769['body'],{'raw':_0x137769[_0x2aea('0x1d')]?_0x137769[_0x2aea('0x1d')][_0x2aea('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137769[_0x2aea('0x1d')]?_0x137769[_0x2aea('0x1d')][_0x2aea('0x21')]||null:null,'attributes':_0x137769['options']?_0x137769[_0x2aea('0x1d')][_0x2aea('0x22')]||null:null,'limit':_0x137769[_0x2aea('0x1d')]?_0x137769[_0x2aea('0x1d')][_0x2aea('0x23')]||null:null})[_0x2aea('0xe')](function(_0x1b26e1){logger[_0x2aea('0xf')](_0x2aea('0x1f'),_0x137769);logger[_0x2aea('0x11')](_0x2aea('0x1f'),_0x137769,JSON[_0x2aea('0x13')](_0x1b26e1));_0x15eb3f(_0x1b26e1);})[_0x2aea('0x18')](function(_0x3bd866){logger[_0x2aea('0x14')](_0x2aea('0x1f'),_0x3bd866[_0x2aea('0x16')],_0x137769);_0x64081e(_0x9c9206[_0x2aea('0x14')](0x1f4,_0x3bd866[_0x2aea('0x16')]));});});}; \ No newline at end of file +var _0xda1c=['./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x462e50,_0x4bc60f){var _0x28fc57=function(_0x20683e){while(--_0x20683e){_0x462e50['push'](_0x462e50['shift']());}};_0x28fc57(++_0x4bc60f);}(_0xda1c,0x68));var _0xcda1=function(_0xa8a4bc,_0x5cda98){_0xa8a4bc=_0xa8a4bc-0x0;var _0x23b140=_0xda1c[_0xa8a4bc];return _0x23b140;};'use strict';var _=require(_0xcda1('0x0'));var util=require(_0xcda1('0x1'));var moment=require(_0xcda1('0x2'));var BPromise=require(_0xcda1('0x3'));var rs=require(_0xcda1('0x4'));var fs=require('fs');var Redis=require(_0xcda1('0x5'));var db=require(_0xcda1('0x6'))['db'];var utils=require(_0xcda1('0x7'));var logger=require(_0xcda1('0x8'))(_0xcda1('0x9'));var config=require(_0xcda1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcda1('0xb')][_0xcda1('0xc')]({'port':0x232a});config[_0xcda1('0xd')]=_[_0xcda1('0xe')](config[_0xcda1('0xd')],{'host':_0xcda1('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcda1('0xd')]));require(_0xcda1('0x10'))[_0xcda1('0x11')](socket);function respondWithRpcPromise(_0xb4c147,_0x88e4e8,_0x3b9202){return new BPromise(function(_0xc6f0c5,_0x1e8d34){return client[_0xcda1('0x12')](_0xb4c147,_0x3b9202)[_0xcda1('0x13')](function(_0x4c1ae0){logger[_0xcda1('0x14')](_0xcda1('0x15'),_0x88e4e8,_0xcda1('0x16'));logger[_0xcda1('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x88e4e8,'request\x20sent',JSON[_0xcda1('0x18')](_0x4c1ae0));if(_0x4c1ae0['error']){if(_0x4c1ae0['error'][_0xcda1('0x19')]===0x1f4){logger[_0xcda1('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x88e4e8,_0x4c1ae0[_0xcda1('0x1a')]['message']);return _0x1e8d34(_0x4c1ae0['error'][_0xcda1('0x1b')]);}logger[_0xcda1('0x1a')](_0xcda1('0x15'),_0x88e4e8,_0x4c1ae0[_0xcda1('0x1a')][_0xcda1('0x1b')]);return _0xc6f0c5(_0x4c1ae0['error'][_0xcda1('0x1b')]);}else{logger['info'](_0xcda1('0x15'),_0x88e4e8,_0xcda1('0x16'));_0xc6f0c5(_0x4c1ae0[_0xcda1('0x1c')][_0xcda1('0x1b')]);}})[_0xcda1('0x1d')](function(_0x2c2a35){logger[_0xcda1('0x1a')](_0xcda1('0x15'),_0x88e4e8,_0x2c2a35);_0x1e8d34(_0x2c2a35);});});}exports['CreateFaxMessage']=function(_0x56fb91){var _0x547510=this;return new Promise(function(_0x3802f8,_0x26ebd1){return db[_0xcda1('0x1e')][_0xcda1('0x1f')](_0x56fb91[_0xcda1('0x20')],{'raw':_0x56fb91[_0xcda1('0x21')]?_0x56fb91[_0xcda1('0x21')][_0xcda1('0x22')]===undefined?!![]:![]:!![]})[_0xcda1('0x13')](function(_0x1721b7){logger[_0xcda1('0x14')](_0xcda1('0x23'),_0x56fb91);logger[_0xcda1('0x17')]('CreateFaxMessage',_0x56fb91,JSON['stringify'](_0x1721b7));_0x3802f8(_0x1721b7);})['catch'](function(_0x2a1223){logger['error']('CreateFaxMessage',_0x2a1223[_0xcda1('0x1b')],_0x56fb91);_0x26ebd1(_0x547510[_0xcda1('0x1a')](0x1f4,_0x2a1223[_0xcda1('0x1b')]));});});};exports[_0xcda1('0x24')]=function(_0x49de3f){var _0x3b3203=this;return new Promise(function(_0x1bea21,_0x4e3466){return db['FaxMessage'][_0xcda1('0x25')](_0x49de3f[_0xcda1('0x20')],{'raw':_0x49de3f[_0xcda1('0x21')]?_0x49de3f[_0xcda1('0x21')][_0xcda1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49de3f[_0xcda1('0x21')]?_0x49de3f[_0xcda1('0x21')]['where']||null:null,'attributes':_0x49de3f[_0xcda1('0x21')]?_0x49de3f[_0xcda1('0x21')][_0xcda1('0x26')]||null:null,'limit':_0x49de3f[_0xcda1('0x21')]?_0x49de3f[_0xcda1('0x21')][_0xcda1('0x27')]||null:null})[_0xcda1('0x13')](function(_0x2f6ed3){logger['info'](_0xcda1('0x24'),_0x49de3f);logger['debug'](_0xcda1('0x24'),_0x49de3f,JSON['stringify'](_0x2f6ed3));_0x1bea21(_0x2f6ed3);})[_0xcda1('0x1d')](function(_0x1fd16a){logger[_0xcda1('0x1a')]('UpdateFaxMessage',_0x1fd16a['message'],_0x49de3f);_0x4e3466(_0x3b3203[_0xcda1('0x1a')](0x1f4,_0x1fd16a[_0xcda1('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c6c32f6..dcfa218 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0560851..9ee8b4e 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 _0xd892=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','util','path'];(function(_0x48ab29,_0x44f811){var _0x5257b4=function(_0x48f6f7){while(--_0x48f6f7){_0x48ab29['push'](_0x48ab29['shift']());}};_0x5257b4(++_0x44f811);}(_0xd892,0x193));var _0x2d89=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd892[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x2d89('0x0'));var path=require(_0x2d89('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2d89('0x2')]();var auth=require(_0x2d89('0x3'));var interaction=require(_0x2d89('0x4'));var config=require(_0x2d89('0x5'));var controller=require(_0x2d89('0x6'));router[_0x2d89('0x7')]('/',auth[_0x2d89('0x8')](),controller[_0x2d89('0x9')]);router[_0x2d89('0x7')]('/describe',auth[_0x2d89('0x8')](),controller[_0x2d89('0xa')]);router[_0x2d89('0x7')](_0x2d89('0xb'),auth[_0x2d89('0x8')](),controller[_0x2d89('0xc')]);router[_0x2d89('0x7')](_0x2d89('0xd'),auth['isAuthenticated'](),controller[_0x2d89('0xe')]);router[_0x2d89('0xf')]('/',auth['isAuthenticated'](),interaction[_0x2d89('0x10')](_0x2d89('0x11'),_0x2d89('0x12')),controller[_0x2d89('0x13')]);router[_0x2d89('0x14')]('/:id',auth[_0x2d89('0x8')](),controller[_0x2d89('0x15')]);router[_0x2d89('0x14')](_0x2d89('0x16'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0x2d89('0x8')](),controller[_0x2d89('0x17')]);router[_0x2d89('0x18')]('/:id',auth[_0x2d89('0x8')](),controller[_0x2d89('0x19')]);module[_0x2d89('0x1a')]=router; \ No newline at end of file +var _0xcca0=['post','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xcca0,0x1d3));var _0x0cca=function(_0x57a6f1,_0x282078){_0x57a6f1=_0x57a6f1-0x0;var _0x3559ae=_0xcca0[_0x57a6f1];return _0x3559ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0cca('0x0'));var timeout=require('connect-timeout');var express=require(_0x0cca('0x1'));var router=express[_0x0cca('0x2')]();var auth=require(_0x0cca('0x3'));var interaction=require(_0x0cca('0x4'));var config=require(_0x0cca('0x5'));var controller=require(_0x0cca('0x6'));router[_0x0cca('0x7')]('/',auth[_0x0cca('0x8')](),controller[_0x0cca('0x9')]);router[_0x0cca('0x7')]('/describe',auth[_0x0cca('0x8')](),controller[_0x0cca('0xa')]);router[_0x0cca('0x7')](_0x0cca('0xb'),auth['isAuthenticated'](),controller[_0x0cca('0xc')]);router['get']('/:id/download',auth[_0x0cca('0x8')](),controller['download']);router[_0x0cca('0xd')]('/',auth[_0x0cca('0x8')](),interaction['tracked'](_0x0cca('0xe'),_0x0cca('0xf')),controller[_0x0cca('0x10')]);router[_0x0cca('0x11')](_0x0cca('0xb'),auth['isAuthenticated'](),controller[_0x0cca('0x12')]);router['put']('/:id/accept',auth[_0x0cca('0x8')](),controller[_0x0cca('0x13')]);router[_0x0cca('0x11')](_0x0cca('0x14'),auth[_0x0cca('0x8')](),controller[_0x0cca('0x15')]);router[_0x0cca('0x16')](_0x0cca('0xb'),auth['isAuthenticated'](),controller[_0x0cca('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 4305f66..652190a 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 _0xb133=['roundrobin','INTEGER','sequelize','exports','name','STRING','ENUM','rrmemory','beepall'];(function(_0x6651c3,_0x13210f){var _0x3d1598=function(_0x53dc1c){while(--_0x53dc1c){_0x6651c3['push'](_0x6651c3['shift']());}};_0x3d1598(++_0x13210f);}(_0xb133,0x134));var _0x3b13=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xb133[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x3b13('0x0'));module[_0x3b13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3b13('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b13('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b13('0x4')](_0x3b13('0x5'),_0x3b13('0x6'),_0x3b13('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3b13('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9277=['STRING','name','INTEGER','beepall','roundrobin'];(function(_0x51e294,_0x40cf7b){var _0x2880f3=function(_0x100cff){while(--_0x100cff){_0x51e294['push'](_0x51e294['shift']());}};_0x2880f3(++_0x40cf7b);}(_0x9277,0x195));var _0x7927=function(_0x1a9782,_0x15760c){_0x1a9782=_0x1a9782-0x0;var _0x58b4d0=_0x9277[_0x1a9782];return _0x58b4d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7927('0x0')],'unique':_0x7927('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7927('0x0')]},'timeout':{'type':Sequelize[_0x7927('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7927('0x3'),_0x7927('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7927('0x2')],'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 b4e5fac..6a9f626 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 _0x6257=['catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','autoAssociation','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','sort','FaxQueueId','merge','options','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','value','isEmpty','emit','addAgents','omit','removeAgents','isArray','userFaxQueue:remove','getAgents','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','end','json','count','offset','set','reject','save','update','then','destroy','UserProfileResource','error','stack','name','status','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','pick','filter','where','includeAll','include','rows'];(function(_0xeab168,_0x30d561){var _0xbbf818=function(_0x40ed65){while(--_0x40ed65){_0xeab168['push'](_0xeab168['shift']());}};_0xbbf818(++_0x30d561);}(_0x6257,0x1d4));var _0x7625=function(_0x46ae16,_0x3644ad){_0x46ae16=_0x46ae16-0x0;var _0x5236f4=_0x6257[_0x46ae16];return _0x5236f4;};'use strict';var pdf=require(_0x7625('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7625('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7625('0x2'));var moment=require(_0x7625('0x3'));var BPromise=require(_0x7625('0x4'));var Mustache=require(_0x7625('0x5'));var util=require(_0x7625('0x6'));var path=require(_0x7625('0x7'));var sox=require(_0x7625('0x8'));var csv=require(_0x7625('0x9'));var ejs=require(_0x7625('0xa'));var fs=require('fs');var _=require(_0x7625('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7625('0xc'));var deskjs=require(_0x7625('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7625('0xe'));var Papa=require(_0x7625('0xf'));var Redis=require(_0x7625('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7625('0x11'));var as=require(_0x7625('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7625('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7625('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7625('0x15'),'port':0x18eb});var socket=require(_0x7625('0x16'))(new Redis(config[_0x7625('0x17')]));require(_0x7625('0x18'))[_0x7625('0x19')](socket);function respondWithStatusCode(_0x3dbc4b,_0x53a914){_0x53a914=_0x53a914||0xcc;return function(_0x50c5a1){if(_0x50c5a1){return _0x3dbc4b[_0x7625('0x1a')](_0x53a914);}return _0x3dbc4b['status'](_0x53a914)[_0x7625('0x1b')]();};}function respondWithResult(_0x1359ef,_0x27b598){_0x27b598=_0x27b598||0xc8;return function(_0x5a66fd){if(_0x5a66fd){return _0x1359ef['status'](_0x27b598)[_0x7625('0x1c')](_0x5a66fd);}};}function respondWithFilteredResult(_0x25e9bf,_0x125737){return function(_0x36cc19){if(_0x36cc19){var _0x6ca44e=_0x36cc19[_0x7625('0x1d')],_0x2c8013=_0x125737['offset'],_0x34e594=_0x125737[_0x7625('0x1e')]+_0x125737['limit'],_0x57ab0c;if(_0x34e594>=_0x6ca44e){_0x34e594=_0x6ca44e;_0x57ab0c=0xc8;}else{_0x57ab0c=0xce;}_0x25e9bf['status'](_0x57ab0c);return _0x25e9bf[_0x7625('0x1f')]('Content-Range',_0x2c8013+'-'+_0x34e594+'/'+_0x6ca44e)['json'](_0x36cc19);}return null;};}function patchUpdates(_0x2c79f7){return function(_0xb485b8){try{jsonpatch['apply'](_0xb485b8,_0x2c79f7,!![]);}catch(_0x1c9c5e){return BPromise[_0x7625('0x20')](_0x1c9c5e);}return _0xb485b8[_0x7625('0x21')]();};}function saveUpdates(_0x5b5269,_0x25b19c){return function(_0xfafa34){if(_0xfafa34){return _0xfafa34[_0x7625('0x22')](_0x5b5269)[_0x7625('0x23')](function(_0x3b1e83){return _0x3b1e83;});}return null;};}function removeEntity(_0xc8b3ae,_0x1514f7){return function(_0x1832e3){if(_0x1832e3){return _0x1832e3[_0x7625('0x24')]()['then'](function(){var _0x4e7569=_0x1832e3['get']({'plain':!![]});var _0x4ceba3='FaxQueues';return db[_0x7625('0x25')][_0x7625('0x24')]({'where':{'type':_0x4ceba3,'resourceId':_0x4e7569['id']}})['then'](function(){return _0x1832e3;});})[_0x7625('0x23')](function(){_0xc8b3ae['status'](0xcc)[_0x7625('0x1b')]();});}};}function handleEntityNotFound(_0x1dfdd1,_0x4a34b8){return function(_0x1271e0){if(!_0x1271e0){_0x1dfdd1['sendStatus'](0x194);}return _0x1271e0;};}function handleError(_0x22b8a6,_0x5a54f1){_0x5a54f1=_0x5a54f1||0x1f4;return function(_0x334d46){logger[_0x7625('0x26')](_0x334d46[_0x7625('0x27')]);if(_0x334d46[_0x7625('0x28')]){delete _0x334d46[_0x7625('0x28')];}_0x22b8a6[_0x7625('0x29')](_0x5a54f1)[_0x7625('0x2a')](_0x334d46);};}exports[_0x7625('0x2b')]=function(_0x48758c,_0x5ef7eb){var _0x461664={},_0xc7aa53={},_0x5ea946={'count':0x0,'rows':[]};var _0x27fe91=_[_0x7625('0x2c')](db[_0x7625('0x2d')][_0x7625('0x2e')],function(_0x32a69e){return{'name':_0x32a69e[_0x7625('0x2f')],'type':_0x32a69e[_0x7625('0x30')]['key']};});_0xc7aa53[_0x7625('0x31')]=_['map'](_0x27fe91,_0x7625('0x28'));_0xc7aa53[_0x7625('0x32')]=_[_0x7625('0x33')](_0x48758c[_0x7625('0x32')]);_0xc7aa53[_0x7625('0x34')]=_[_0x7625('0x35')](_0xc7aa53[_0x7625('0x31')],_0xc7aa53[_0x7625('0x32')]);_0x461664[_0x7625('0x36')]=_[_0x7625('0x35')](_0xc7aa53[_0x7625('0x31')],qs[_0x7625('0x37')](_0x48758c[_0x7625('0x32')][_0x7625('0x37')]));_0x461664[_0x7625('0x36')]=_0x461664[_0x7625('0x36')]['length']?_0x461664['attributes']:_0xc7aa53[_0x7625('0x31')];if(!_0x48758c['query']['hasOwnProperty'](_0x7625('0x38'))){_0x461664[_0x7625('0x39')]=qs['limit'](_0x48758c[_0x7625('0x32')][_0x7625('0x39')]);_0x461664[_0x7625('0x1e')]=qs[_0x7625('0x1e')](_0x48758c[_0x7625('0x32')][_0x7625('0x1e')]);}_0x461664['order']=qs['sort'](_0x48758c[_0x7625('0x32')]['sort']);_0x461664['where']=qs[_0x7625('0x34')](_[_0x7625('0x3a')](_0x48758c[_0x7625('0x32')],_0xc7aa53[_0x7625('0x34')]),_0x27fe91);if(_0x48758c[_0x7625('0x32')][_0x7625('0x3b')]){_0x461664[_0x7625('0x3c')]=_['merge'](_0x461664[_0x7625('0x3c')],{'$or':_['map'](_0x27fe91,function(_0x28eb67){if(_0x28eb67[_0x7625('0x30')]!=='VIRTUAL'){var _0x5caf11={};_0x5caf11[_0x28eb67[_0x7625('0x28')]]={'$like':'%'+_0x48758c['query']['filter']+'%'};return _0x5caf11;}})});}_0x461664=_['merge']({},_0x461664,_0x48758c['options']);var _0x3886ea={'where':_0x461664[_0x7625('0x3c')]};return db[_0x7625('0x2d')][_0x7625('0x1d')](_0x3886ea)['then'](function(_0x471b7f){_0x5ea946[_0x7625('0x1d')]=_0x471b7f;if(_0x48758c[_0x7625('0x32')][_0x7625('0x3d')]){_0x461664[_0x7625('0x3e')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x461664);})['then'](function(_0x3fc662){_0x5ea946[_0x7625('0x3f')]=_0x3fc662;return _0x5ea946;})[_0x7625('0x23')](respondWithFilteredResult(_0x5ef7eb,_0x461664))[_0x7625('0x40')](handleError(_0x5ef7eb,null));};exports['show']=function(_0x201d0d,_0x58a626){var _0x220477={'raw':!![],'where':{'id':_0x201d0d[_0x7625('0x41')]['id']}},_0x34e2a9={};_0x34e2a9[_0x7625('0x31')]=_[_0x7625('0x33')](db['FaxQueue']['rawAttributes']);_0x34e2a9[_0x7625('0x32')]=_['keys'](_0x201d0d[_0x7625('0x32')]);_0x34e2a9[_0x7625('0x34')]=_[_0x7625('0x35')](_0x34e2a9[_0x7625('0x31')],_0x34e2a9['query']);_0x220477[_0x7625('0x36')]=_['intersection'](_0x34e2a9[_0x7625('0x31')],qs[_0x7625('0x37')](_0x201d0d[_0x7625('0x32')][_0x7625('0x37')]));_0x220477['attributes']=_0x220477['attributes']['length']?_0x220477[_0x7625('0x36')]:_0x34e2a9['model'];if(_0x201d0d[_0x7625('0x32')][_0x7625('0x3d')]){_0x220477[_0x7625('0x3e')]=[{'all':!![]}];}_0x220477=_['merge']({},_0x220477,_0x201d0d['options']);return db[_0x7625('0x2d')][_0x7625('0x42')](_0x220477)[_0x7625('0x23')](handleEntityNotFound(_0x58a626,null))[_0x7625('0x23')](respondWithResult(_0x58a626,null))['catch'](handleError(_0x58a626,null));};exports[_0x7625('0x43')]=function(_0x426510,_0x4bbd1e){return db[_0x7625('0x2d')][_0x7625('0x43')](_0x426510[_0x7625('0x44')],{})[_0x7625('0x23')](function(_0x1bcf0d){var _0x48a93a=_0x426510[_0x7625('0x45')][_0x7625('0x46')]({'plain':!![]});if(!_0x48a93a)throw new Error(_0x7625('0x47'));if(_0x48a93a[_0x7625('0x48')]===_0x7625('0x45')){var _0x49b5d6=_0x1bcf0d[_0x7625('0x46')]({'plain':!![]});var _0x33c429=_0x7625('0x49');return db['UserProfileSection'][_0x7625('0x42')]({'where':{'name':_0x33c429,'userProfileId':_0x48a93a[_0x7625('0x4a')]},'raw':!![]})[_0x7625('0x23')](function(_0x58a4a7){if(_0x58a4a7&&_0x58a4a7[_0x7625('0x4b')]===0x0){return db[_0x7625('0x25')]['create']({'name':_0x49b5d6[_0x7625('0x28')],'resourceId':_0x49b5d6['id'],'type':_0x58a4a7[_0x7625('0x28')],'sectionId':_0x58a4a7['id']},{})[_0x7625('0x23')](function(){return _0x1bcf0d;});}else{return _0x1bcf0d;}})[_0x7625('0x40')](function(_0x7b4c8){logger[_0x7625('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7b4c8);throw _0x7b4c8;});}return _0x1bcf0d;})[_0x7625('0x23')](respondWithResult(_0x4bbd1e,0xc9))[_0x7625('0x40')](handleError(_0x4bbd1e,null));};exports[_0x7625('0x22')]=function(_0x216fea,_0x37d3a0){if(_0x216fea[_0x7625('0x44')]['id']){delete _0x216fea[_0x7625('0x44')]['id'];}return db[_0x7625('0x2d')]['find']({'where':{'id':_0x216fea[_0x7625('0x41')]['id']}})['then'](handleEntityNotFound(_0x37d3a0,null))['then'](saveUpdates(_0x216fea[_0x7625('0x44')],null))[_0x7625('0x23')](respondWithResult(_0x37d3a0,null))[_0x7625('0x40')](handleError(_0x37d3a0,null));};exports[_0x7625('0x24')]=function(_0x321712,_0x3938e5){return db[_0x7625('0x2d')][_0x7625('0x42')]({'where':{'id':_0x321712[_0x7625('0x41')]['id']}})['then'](handleEntityNotFound(_0x3938e5,null))[_0x7625('0x23')](removeEntity(_0x3938e5,null))['catch'](handleError(_0x3938e5,null));};exports['describe']=function(_0x14f5d8,_0x2a033b){return db[_0x7625('0x2d')][_0x7625('0x4c')]()[_0x7625('0x23')](respondWithResult(_0x2a033b,null))[_0x7625('0x40')](handleError(_0x2a033b,null));};exports[_0x7625('0x4d')]=function(_0x555687,_0x53ebd9,_0x41754a){var _0x5580a5={'raw':!![],'where':{}},_0xf935d0={},_0x3b8266;return db[_0x7625('0x2d')][_0x7625('0x4e')]({'where':{'id':_0x555687[_0x7625('0x41')]['id']}})[_0x7625('0x23')](handleEntityNotFound(_0x53ebd9,null))[_0x7625('0x23')](function(_0x27fee6){if(_0x27fee6){_0x3b8266=_0x27fee6['get']({'plain':!![]});_0xf935d0['model']=_[_0x7625('0x33')](db[_0x7625('0x4f')][_0x7625('0x2e')]);_0xf935d0[_0x7625('0x32')]=_['keys'](_0x555687[_0x7625('0x32')]);_0xf935d0[_0x7625('0x34')]=_[_0x7625('0x35')](_0xf935d0[_0x7625('0x31')],_0xf935d0[_0x7625('0x32')]);_0x5580a5[_0x7625('0x36')]=_['intersection'](_0xf935d0['model'],qs[_0x7625('0x37')](_0x555687[_0x7625('0x32')]['fields']));_0x5580a5[_0x7625('0x36')]=_0x5580a5[_0x7625('0x36')][_0x7625('0x50')]?_0x5580a5[_0x7625('0x36')]:_0xf935d0[_0x7625('0x31')];if(!_0x555687['query'][_0x7625('0x51')](_0x7625('0x38'))){_0x5580a5[_0x7625('0x39')]=qs[_0x7625('0x39')](_0x555687[_0x7625('0x32')][_0x7625('0x39')]);_0x5580a5[_0x7625('0x1e')]=qs[_0x7625('0x1e')](_0x555687[_0x7625('0x32')]['offset']);}_0x5580a5['order']=qs[_0x7625('0x52')](_0x555687[_0x7625('0x32')][_0x7625('0x52')]);_0x5580a5[_0x7625('0x3c')]=qs[_0x7625('0x34')](_[_0x7625('0x3a')](_0x555687[_0x7625('0x32')],_0xf935d0['filters']));_0x5580a5[_0x7625('0x3c')][_0x7625('0x53')]=_0x27fee6['id'];if(_0x555687[_0x7625('0x32')]['filter']){_0x5580a5[_0x7625('0x3c')]=_[_0x7625('0x54')](_0x5580a5['where'],{'$or':_['map'](_0x5580a5[_0x7625('0x36')],function(_0x30e42e){var _0x391a57={};_0x391a57[_0x30e42e]={'$like':'%'+_0x555687[_0x7625('0x32')][_0x7625('0x3b')]+'%'};return _0x391a57;})});}_0x5580a5=_[_0x7625('0x54')]({},_0x5580a5,_0x555687[_0x7625('0x55')]);return db['UserFaxQueue'][_0x7625('0x56')](_0x5580a5);}})['then'](function(_0x265b16){if(_0x265b16){return db[_0x7625('0x57')][_0x7625('0x58')]({'where':{'id':_[_0x7625('0x2c')](_0x265b16,_0x7625('0x59')),'role':_0x7625('0x5a')},'attributes':['id',_0x7625('0x28'),_0x7625('0x5b'),_0x7625('0x5c'),_0x7625('0x5d')]});}})[_0x7625('0x23')](function(_0x8b113d){if(_0x8b113d){return{'count':_0x8b113d[_0x7625('0x1d')],'rows':_['map'](_0x8b113d[_0x7625('0x3f')],function(_0x3aca5a){return{'membername':_0x3aca5a[_0x7625('0x28')],'UserId':_0x3aca5a['id'],'queue_name':_0x3b8266[_0x7625('0x28')],'FaxQueueId':_0x3b8266['id'],'interface':util[_0x7625('0x5e')](_0x7625('0x5f'),_0x7625('0x60'),_0x3aca5a[_0x7625('0x28')]),'penalty':0x0,'paused':_0x3aca5a[_0x7625('0x5b')],'createdAt':_0x3aca5a[_0x7625('0x5d')],'updatedAt':_0x3aca5a[_0x7625('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53ebd9,_0x5580a5))[_0x7625('0x40')](handleError(_0x53ebd9,null));};exports[_0x7625('0x61')]=function(_0x1d5752,_0x311968,_0x1023a7){var _0x2c0c23={};var _0x2a90ed={};var _0x36d825;var _0x1145bd;return db[_0x7625('0x2d')][_0x7625('0x4e')]({'where':{'id':_0x1d5752[_0x7625('0x41')]['id']}})[_0x7625('0x23')](handleEntityNotFound(_0x311968,null))[_0x7625('0x23')](function(_0x4b8db2){if(_0x4b8db2){_0x36d825=_0x4b8db2;_0x2a90ed['model']=_['keys'](db[_0x7625('0x62')][_0x7625('0x2e')]);_0x2a90ed[_0x7625('0x32')]=_[_0x7625('0x33')](_0x1d5752[_0x7625('0x32')]);_0x2a90ed[_0x7625('0x34')]=_[_0x7625('0x35')](_0x2a90ed[_0x7625('0x31')],_0x2a90ed['query']);_0x2c0c23[_0x7625('0x36')]=_[_0x7625('0x35')](_0x2a90ed['model'],qs['fields'](_0x1d5752[_0x7625('0x32')]['fields']));_0x2c0c23[_0x7625('0x36')]=_0x2c0c23['attributes']['length']?_0x2c0c23[_0x7625('0x36')]:_0x2a90ed[_0x7625('0x31')];_0x2c0c23['order']=qs['sort'](_0x1d5752[_0x7625('0x32')][_0x7625('0x52')]);_0x2c0c23[_0x7625('0x3c')]=qs[_0x7625('0x34')](_[_0x7625('0x3a')](_0x1d5752[_0x7625('0x32')],_0x2a90ed[_0x7625('0x34')]));if(_0x1d5752[_0x7625('0x32')]['filter']){_0x2c0c23[_0x7625('0x3c')]=_[_0x7625('0x54')](_0x2c0c23[_0x7625('0x3c')],{'$or':_[_0x7625('0x2c')](_0x2c0c23[_0x7625('0x36')],function(_0x10bb7a){var _0x5229fc={};_0x5229fc[_0x10bb7a]={'$like':'%'+_0x1d5752['query'][_0x7625('0x3b')]+'%'};return _0x5229fc;})});}_0x2c0c23=_[_0x7625('0x54')]({},_0x2c0c23,_0x1d5752['options']);return _0x36d825[_0x7625('0x61')](_0x2c0c23);}})[_0x7625('0x23')](function(_0x49880){if(_0x49880){_0x1145bd=_0x49880[_0x7625('0x50')];if(!_0x1d5752[_0x7625('0x32')][_0x7625('0x51')](_0x7625('0x38'))){_0x2c0c23[_0x7625('0x39')]=qs['limit'](_0x1d5752[_0x7625('0x32')][_0x7625('0x39')]);_0x2c0c23[_0x7625('0x1e')]=qs[_0x7625('0x1e')](_0x1d5752[_0x7625('0x32')]['offset']);}return _0x36d825[_0x7625('0x61')](_0x2c0c23);}})['then'](function(_0x3f2d94){if(_0x3f2d94){return _0x3f2d94?{'count':_0x1145bd,'rows':_0x3f2d94}:null;}})[_0x7625('0x23')](respondWithResult(_0x311968,null))['catch'](handleError(_0x311968,null));};exports['addTeams']=function(_0x3de136,_0x27b061,_0x5bd158){var _0x1c071d=_0x3de136['body'][_0x7625('0x63')];return db[_0x7625('0x62')][_0x7625('0x56')]({'where':{'id':_0x1c071d},'attributes':['id'],'include':[{'model':db[_0x7625('0x57')],'as':_0x7625('0x64'),'attributes':['id',_0x7625('0x28'),_0x7625('0x65'),'voicePause',_0x7625('0x66')],'raw':!![]}]})['then'](function(_0x1d1293){if(_0x1d1293){var _0x24138d=_[_0x7625('0x67')](_0x1d1293,function(_0x76fe84){var _0x12b324=_0x76fe84['get']({'plain':!![]});return _0x12b324['Agents'];});return db[_0x7625('0x2d')]['find']({'where':{'id':_0x3de136[_0x7625('0x41')]['id']}})[_0x7625('0x23')](function(_0x127f26){return db[_0x7625('0x68')][_0x7625('0x69')](function(_0x1eaae8){return _0x127f26['addTeams'](_0x1c071d,{'transaction':_0x1eaae8})[_0x7625('0x23')](function(){return BPromise[_0x7625('0x6a')](_0x24138d,function(_0x48ae31){return db['UserFaxQueue'][_0x7625('0x6b')]({'where':{'UserId':_0x48ae31['id'],'FaxQueueId':_0x3de136[_0x7625('0x41')]['id']},'transaction':_0x1eaae8});});})[_0x7625('0x23')](function(){_0x24138d[_0x7625('0x6c')](function(_0xaf8445){socket['emit'](_0x7625('0x6d'),{'UserId':_0xaf8445['id'],'FaxQueueId':_0x127f26['id']});});});});});}})[_0x7625('0x23')](respondWithStatusCode(_0x27b061,null))[_0x7625('0x40')](handleError(_0x27b061,null));};exports[_0x7625('0x6e')]=function(_0x473f0e,_0x3bf57d,_0x29fba9){return db[_0x7625('0x62')][_0x7625('0x56')]({'where':{'id':_0x473f0e[_0x7625('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7625('0x57')],'as':_0x7625('0x64'),'attributes':['id'],'raw':!![]}]})[_0x7625('0x23')](handleEntityNotFound(_0x3bf57d,null))['then'](function(_0x46f972){var _0x1632bb=_['map'](_0x46f972,'id');var _0x563e6a=[];var _0x2b03c8=[];var _0x500346=squel[_0x7625('0x6f')]();_0x500346[_0x7625('0x70')]('tq.TeamId')['from']('team_has_fax_queues','tq')['join'](_0x7625('0x71'),'ut',_0x7625('0x72'))[_0x7625('0x3c')](_0x7625('0x73'),_0x473f0e[_0x7625('0x41')]['id']);for(var _0x396d6b=0x0;_0x396d6b<_0x46f972[_0x7625('0x50')];_0x396d6b+=0x1){let _0x2b4665=_0x46f972[_0x396d6b];for(var _0x2845f7=0x0;_0x2845f7<_0x2b4665[_0x7625('0x64')][_0x7625('0x50')];_0x2845f7+=0x1){let _0x1dc35d=_0x2b4665['Agents'][_0x2845f7];var _0x54d404=_0x500346[_0x7625('0x74')]();_0x54d404['where'](_0x7625('0x75'),_0x1dc35d['id']);_0x2b03c8[_0x7625('0x76')](db[_0x7625('0x68')][_0x7625('0x32')](_0x54d404[_0x7625('0x77')](),{'type':db[_0x7625('0x68')]['QueryTypes'][_0x7625('0x78')]})[_0x7625('0x23')](function(_0x44bd0e){if(_0x44bd0e['length']===0x1){return _0x1dc35d['id'];}else{var _0x2b266b=_[_0x7625('0x79')](_[_0x7625('0x2c')](_0x44bd0e,'TeamId'),function(_0x44b86b){return _[_0x7625('0x7a')](_0x1632bb,_0x44b86b);});if(_0x2b266b){return _0x1dc35d['id'];}}}));}}return BPromise[_0x7625('0x7b')](_0x2b03c8)[_0x7625('0x23')](function(_0x1a621e){_0x563e6a=_(_0x563e6a)['union'](_0x1a621e)['compact']()[_0x7625('0x7c')]();return db['FaxQueue'][_0x7625('0x42')]({'where':{'id':_0x473f0e[_0x7625('0x41')]['id']}})[_0x7625('0x23')](function(_0x323c11){return db[_0x7625('0x68')][_0x7625('0x69')](function(_0x18c662){return _0x323c11[_0x7625('0x6e')](_0x473f0e[_0x7625('0x32')][_0x7625('0x63')],{'transaction':_0x18c662})[_0x7625('0x23')](function(){if(!_[_0x7625('0x7d')](_0x563e6a)){return _0x323c11['removeAgents'](_0x563e6a,{'transaction':_0x18c662});}})[_0x7625('0x23')](function(){_0x563e6a[_0x7625('0x6c')](function(_0x349d23){socket[_0x7625('0x7e')]('userFaxQueue:remove',{'UserId':_0x349d23,'FaxQueueId':_0x323c11['id']});});});});});});})[_0x7625('0x23')](respondWithStatusCode(_0x3bf57d,null))[_0x7625('0x40')](handleError(_0x3bf57d,null));};exports[_0x7625('0x7f')]=function(_0x145507,_0xf5ce3d,_0x15f2f4){return db['FaxQueue'][_0x7625('0x42')]({'where':{'id':_0x145507[_0x7625('0x41')]['id']}})[_0x7625('0x23')](handleEntityNotFound(_0xf5ce3d,null))[_0x7625('0x23')](function(_0x234cc6){if(_0x234cc6){return _0x234cc6[_0x7625('0x7f')](_0x145507[_0x7625('0x44')][_0x7625('0x63')],_[_0x7625('0x80')](_0x145507[_0x7625('0x44')],[_0x7625('0x63'),'id'])||{})['spread'](function(_0x4cc37b){for(var _0x5be539=0x0;_0x5be539<_0x145507[_0x7625('0x44')][_0x7625('0x63')]['length'];_0x5be539+=0x1){socket['emit'](_0x7625('0x6d'),{'UserId':_0x145507[_0x7625('0x44')][_0x7625('0x63')][_0x5be539],'FaxQueueId':_0x145507['params']['id']});}return _0x4cc37b;});}})[_0x7625('0x23')](respondWithResult(_0xf5ce3d,null))[_0x7625('0x40')](handleError(_0xf5ce3d,null));};exports[_0x7625('0x81')]=function(_0x3083a6,_0xece32d,_0x26329a){return db[_0x7625('0x2d')]['find']({'where':{'id':_0x3083a6[_0x7625('0x41')]['id']}})['then'](handleEntityNotFound(_0xece32d,null))[_0x7625('0x23')](function(_0x27d424){if(_0x27d424){return _0x27d424[_0x7625('0x81')](_0x3083a6[_0x7625('0x32')][_0x7625('0x63')])[_0x7625('0x23')](function(){if(_[_0x7625('0x82')](_0x3083a6['query'][_0x7625('0x63')])){for(var _0x4295ff=0x0;_0x4295ff<_0x3083a6['query'][_0x7625('0x63')][_0x7625('0x50')];_0x4295ff+=0x1){socket[_0x7625('0x7e')](_0x7625('0x83'),{'UserId':Number(_0x3083a6[_0x7625('0x32')][_0x7625('0x63')][_0x4295ff]),'FaxQueueId':Number(_0x3083a6[_0x7625('0x41')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3083a6['query'][_0x7625('0x63')]),'FaxQueueId':Number(_0x3083a6[_0x7625('0x41')]['id'])});}});}})[_0x7625('0x23')](respondWithStatusCode(_0xece32d,null))[_0x7625('0x40')](handleError(_0xece32d,null));};exports['getAgents']=function(_0x4cd0d0,_0x5c8902,_0x4889d1){var _0x5bf8ae={};var _0x52edef={};var _0x25b7ff;var _0xdbb078;return db[_0x7625('0x2d')][_0x7625('0x4e')]({'where':{'id':_0x4cd0d0[_0x7625('0x41')]['id']}})[_0x7625('0x23')](handleEntityNotFound(_0x5c8902,null))[_0x7625('0x23')](function(_0x5e6027){if(_0x5e6027){_0x25b7ff=_0x5e6027;_0x52edef[_0x7625('0x31')]=_[_0x7625('0x33')](db[_0x7625('0x57')]['rawAttributes']);_0x52edef[_0x7625('0x32')]=_[_0x7625('0x33')](_0x4cd0d0['query']);_0x52edef[_0x7625('0x34')]=_[_0x7625('0x35')](_0x52edef[_0x7625('0x31')],_0x52edef[_0x7625('0x32')]);_0x5bf8ae['attributes']=_['intersection'](_0x52edef[_0x7625('0x31')],qs['fields'](_0x4cd0d0[_0x7625('0x32')][_0x7625('0x37')]));_0x5bf8ae[_0x7625('0x36')]=_0x5bf8ae[_0x7625('0x36')][_0x7625('0x50')]?_0x5bf8ae[_0x7625('0x36')]:_0x52edef[_0x7625('0x31')];_0x5bf8ae['order']=qs[_0x7625('0x52')](_0x4cd0d0[_0x7625('0x32')][_0x7625('0x52')]);_0x5bf8ae[_0x7625('0x3c')]=qs[_0x7625('0x34')](_[_0x7625('0x3a')](_0x4cd0d0[_0x7625('0x32')],_0x52edef['filters']));if(_0x4cd0d0[_0x7625('0x32')]['filter']){_0x5bf8ae[_0x7625('0x3c')]=_[_0x7625('0x54')](_0x5bf8ae[_0x7625('0x3c')],{'$or':_[_0x7625('0x2c')](_0x5bf8ae[_0x7625('0x36')],function(_0x50b035){var _0x134828={};_0x134828[_0x50b035]={'$like':'%'+_0x4cd0d0[_0x7625('0x32')][_0x7625('0x3b')]+'%'};return _0x134828;})});}_0x5bf8ae=_[_0x7625('0x54')]({},_0x5bf8ae,_0x4cd0d0['options']);return _0x25b7ff[_0x7625('0x84')](_0x5bf8ae);}})[_0x7625('0x23')](function(_0x190a94){if(_0x190a94){_0xdbb078=_0x190a94['length'];if(!_0x4cd0d0['query'][_0x7625('0x51')](_0x7625('0x38'))){_0x5bf8ae[_0x7625('0x39')]=qs[_0x7625('0x39')](_0x4cd0d0[_0x7625('0x32')][_0x7625('0x39')]);_0x5bf8ae[_0x7625('0x1e')]=qs[_0x7625('0x1e')](_0x4cd0d0[_0x7625('0x32')]['offset']);}return _0x25b7ff[_0x7625('0x84')](_0x5bf8ae);}})[_0x7625('0x23')](function(_0x4c910b){if(_0x4c910b){return _0x4c910b?{'count':_0xdbb078,'rows':_0x4c910b}:null;}})['then'](respondWithResult(_0x5c8902,null))[_0x7625('0x40')](handleError(_0x5c8902,null));}; \ No newline at end of file +var _0x6343=['order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','catch','show','params','FaxQueue','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','findOne','FaxQueueId','UserFaxQueue','findAll','User','findAndCountAll','UserId','agent','faxPause','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','every','TeamId','all','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','rimraf','zip-dir','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','count','offset','limit','Content-Range','reject','save','then','get','FaxQueues','UserProfileResource','destroy','end','sendStatus','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x21c79b,_0x389e16){var _0x25e9a2=function(_0x3c8043){while(--_0x3c8043){_0x21c79b['push'](_0x21c79b['shift']());}};_0x25e9a2(++_0x389e16);}(_0x6343,0x168));var _0x3634=function(_0x3fea70,_0x1fe235){_0x3fea70=_0x3fea70-0x0;var _0x48b9c9=_0x6343[_0x3fea70];return _0x48b9c9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3634('0x0'));var zipdir=require(_0x3634('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3634('0x2'));var util=require(_0x3634('0x3'));var path=require('path');var sox=require(_0x3634('0x4'));var csv=require(_0x3634('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x5'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var db=require(_0x3634('0x11'))['db'];config[_0x3634('0x12')]=_[_0x3634('0x13')](config[_0x3634('0x12')],{'host':_0x3634('0x14'),'port':0x18eb});var socket=require(_0x3634('0x15'))(new Redis(config[_0x3634('0x12')]));require(_0x3634('0x16'))[_0x3634('0x17')](socket);function respondWithStatusCode(_0x71d09b,_0x7e4801){_0x7e4801=_0x7e4801||0xcc;return function(_0x2ad793){if(_0x2ad793){return _0x71d09b['sendStatus'](_0x7e4801);}return _0x71d09b[_0x3634('0x18')](_0x7e4801)['end']();};}function respondWithResult(_0x69609d,_0x18285c){_0x18285c=_0x18285c||0xc8;return function(_0x2fc628){if(_0x2fc628){return _0x69609d[_0x3634('0x18')](_0x18285c)[_0x3634('0x19')](_0x2fc628);}};}function respondWithFilteredResult(_0x4b57cd,_0x3121a3){return function(_0x4b8ec8){if(_0x4b8ec8){var _0x50350d=_0x4b8ec8[_0x3634('0x1a')],_0x2aaac7=_0x3121a3[_0x3634('0x1b')],_0x4b2115=_0x3121a3['offset']+_0x3121a3[_0x3634('0x1c')],_0x2fac8b;if(_0x4b2115>=_0x50350d){_0x4b2115=_0x50350d;_0x2fac8b=0xc8;}else{_0x2fac8b=0xce;}_0x4b57cd[_0x3634('0x18')](_0x2fac8b);return _0x4b57cd['set'](_0x3634('0x1d'),_0x2aaac7+'-'+_0x4b2115+'/'+_0x50350d)['json'](_0x4b8ec8);}return null;};}function patchUpdates(_0x742e56){return function(_0x2fa200){try{jsonpatch['apply'](_0x2fa200,_0x742e56,!![]);}catch(_0x29a343){return BPromise[_0x3634('0x1e')](_0x29a343);}return _0x2fa200[_0x3634('0x1f')]();};}function saveUpdates(_0x505026,_0x22b7ef){return function(_0x2c8874){if(_0x2c8874){return _0x2c8874['update'](_0x505026)[_0x3634('0x20')](function(_0x596acb){return _0x596acb;});}return null;};}function removeEntity(_0x5e9188,_0x3a8c41){return function(_0x862ab5){if(_0x862ab5){return _0x862ab5['destroy']()[_0x3634('0x20')](function(){var _0x21fd2c=_0x862ab5[_0x3634('0x21')]({'plain':!![]});var _0x225ddc=_0x3634('0x22');return db[_0x3634('0x23')][_0x3634('0x24')]({'where':{'type':_0x225ddc,'resourceId':_0x21fd2c['id']}})[_0x3634('0x20')](function(){return _0x862ab5;});})[_0x3634('0x20')](function(){_0x5e9188['status'](0xcc)[_0x3634('0x25')]();});}};}function handleEntityNotFound(_0x552cc3,_0x58841d){return function(_0x59f481){if(!_0x59f481){_0x552cc3[_0x3634('0x26')](0x194);}return _0x59f481;};}function handleError(_0x576977,_0x3bf28b){_0x3bf28b=_0x3bf28b||0x1f4;return function(_0x12b80e){logger['error'](_0x12b80e['stack']);if(_0x12b80e[_0x3634('0x27')]){delete _0x12b80e['name'];}_0x576977[_0x3634('0x18')](_0x3bf28b)['send'](_0x12b80e);};}exports[_0x3634('0x28')]=function(_0x3d7322,_0x1d88f7){var _0x17a0fd={},_0x1f46d9={},_0x20b062={'count':0x0,'rows':[]};var _0x309d53=_[_0x3634('0x29')](db['FaxQueue']['rawAttributes'],function(_0x4d26b4){return{'name':_0x4d26b4[_0x3634('0x2a')],'type':_0x4d26b4['type'][_0x3634('0x2b')]};});_0x1f46d9[_0x3634('0x2c')]=_[_0x3634('0x29')](_0x309d53,_0x3634('0x27'));_0x1f46d9[_0x3634('0x2d')]=_[_0x3634('0x2e')](_0x3d7322['query']);_0x1f46d9[_0x3634('0x2f')]=_[_0x3634('0x30')](_0x1f46d9[_0x3634('0x2c')],_0x1f46d9[_0x3634('0x2d')]);_0x17a0fd[_0x3634('0x31')]=_[_0x3634('0x30')](_0x1f46d9[_0x3634('0x2c')],qs[_0x3634('0x32')](_0x3d7322[_0x3634('0x2d')]['fields']));_0x17a0fd[_0x3634('0x31')]=_0x17a0fd[_0x3634('0x31')][_0x3634('0x33')]?_0x17a0fd[_0x3634('0x31')]:_0x1f46d9['model'];if(!_0x3d7322[_0x3634('0x2d')][_0x3634('0x34')](_0x3634('0x35'))){_0x17a0fd['limit']=qs['limit'](_0x3d7322['query'][_0x3634('0x1c')]);_0x17a0fd[_0x3634('0x1b')]=qs['offset'](_0x3d7322[_0x3634('0x2d')][_0x3634('0x1b')]);}_0x17a0fd[_0x3634('0x36')]=qs[_0x3634('0x37')](_0x3d7322[_0x3634('0x2d')][_0x3634('0x37')]);_0x17a0fd[_0x3634('0x38')]=qs['filters'](_[_0x3634('0x39')](_0x3d7322['query'],_0x1f46d9[_0x3634('0x2f')]),_0x309d53);if(_0x3d7322[_0x3634('0x2d')][_0x3634('0x3a')]){_0x17a0fd[_0x3634('0x38')]=_[_0x3634('0x3b')](_0x17a0fd['where'],{'$or':_[_0x3634('0x29')](_0x309d53,function(_0x33af29){if(_0x33af29[_0x3634('0x3c')]!==_0x3634('0x3d')){var _0x23f916={};_0x23f916[_0x33af29[_0x3634('0x27')]]={'$like':'%'+_0x3d7322[_0x3634('0x2d')][_0x3634('0x3a')]+'%'};return _0x23f916;}})});}_0x17a0fd=_[_0x3634('0x3b')]({},_0x17a0fd,_0x3d7322['options']);var _0x4c1e6a={'where':_0x17a0fd[_0x3634('0x38')]};return db['FaxQueue']['count'](_0x4c1e6a)['then'](function(_0x80f1a2){_0x20b062['count']=_0x80f1a2;if(_0x3d7322[_0x3634('0x2d')][_0x3634('0x3e')]){_0x17a0fd['include']=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x17a0fd);})[_0x3634('0x20')](function(_0x334223){_0x20b062['rows']=_0x334223;return _0x20b062;})[_0x3634('0x20')](respondWithFilteredResult(_0x1d88f7,_0x17a0fd))[_0x3634('0x3f')](handleError(_0x1d88f7,null));};exports[_0x3634('0x40')]=function(_0x18ce5a,_0x123a91){var _0x5f0711={'raw':!![],'where':{'id':_0x18ce5a[_0x3634('0x41')]['id']}},_0x497278={};_0x497278[_0x3634('0x2c')]=_[_0x3634('0x2e')](db[_0x3634('0x42')][_0x3634('0x43')]);_0x497278[_0x3634('0x2d')]=_['keys'](_0x18ce5a[_0x3634('0x2d')]);_0x497278[_0x3634('0x2f')]=_[_0x3634('0x30')](_0x497278['model'],_0x497278['query']);_0x5f0711[_0x3634('0x31')]=_[_0x3634('0x30')](_0x497278[_0x3634('0x2c')],qs[_0x3634('0x32')](_0x18ce5a[_0x3634('0x2d')][_0x3634('0x32')]));_0x5f0711[_0x3634('0x31')]=_0x5f0711[_0x3634('0x31')]['length']?_0x5f0711[_0x3634('0x31')]:_0x497278[_0x3634('0x2c')];if(_0x18ce5a[_0x3634('0x2d')][_0x3634('0x3e')]){_0x5f0711[_0x3634('0x44')]=[{'all':!![]}];}_0x5f0711=_[_0x3634('0x3b')]({},_0x5f0711,_0x18ce5a[_0x3634('0x45')]);return db[_0x3634('0x42')][_0x3634('0x46')](_0x5f0711)['then'](handleEntityNotFound(_0x123a91,null))[_0x3634('0x20')](respondWithResult(_0x123a91,null))[_0x3634('0x3f')](handleError(_0x123a91,null));};exports['create']=function(_0x3c356b,_0x454012){return db[_0x3634('0x42')][_0x3634('0x47')](_0x3c356b[_0x3634('0x48')],{})[_0x3634('0x20')](function(_0x5cc8d1){var _0x2663a2=_0x3c356b[_0x3634('0x49')][_0x3634('0x21')]({'plain':!![]});if(!_0x2663a2)throw new Error(_0x3634('0x4a'));if(_0x2663a2[_0x3634('0x4b')]==='user'){var _0x66f6a4=_0x5cc8d1[_0x3634('0x21')]({'plain':!![]});var _0x5c44f1='FaxQueues';return db[_0x3634('0x4c')]['find']({'where':{'name':_0x5c44f1,'userProfileId':_0x2663a2[_0x3634('0x4d')]},'raw':!![]})[_0x3634('0x20')](function(_0x1943a5){if(_0x1943a5&&_0x1943a5[_0x3634('0x4e')]===0x0){return db['UserProfileResource'][_0x3634('0x47')]({'name':_0x66f6a4[_0x3634('0x27')],'resourceId':_0x66f6a4['id'],'type':_0x1943a5[_0x3634('0x27')],'sectionId':_0x1943a5['id']},{})[_0x3634('0x20')](function(){return _0x5cc8d1;});}else{return _0x5cc8d1;}})[_0x3634('0x3f')](function(_0x38473b){logger[_0x3634('0x4f')](_0x3634('0x50'),_0x38473b);throw _0x38473b;});}return _0x5cc8d1;})[_0x3634('0x20')](respondWithResult(_0x454012,0xc9))[_0x3634('0x3f')](handleError(_0x454012,null));};exports[_0x3634('0x51')]=function(_0x4265eb,_0x557438){if(_0x4265eb[_0x3634('0x48')]['id']){delete _0x4265eb[_0x3634('0x48')]['id'];}return db[_0x3634('0x42')][_0x3634('0x46')]({'where':{'id':_0x4265eb[_0x3634('0x41')]['id']}})[_0x3634('0x20')](handleEntityNotFound(_0x557438,null))[_0x3634('0x20')](saveUpdates(_0x4265eb[_0x3634('0x48')],null))[_0x3634('0x20')](respondWithResult(_0x557438,null))['catch'](handleError(_0x557438,null));};exports[_0x3634('0x24')]=function(_0x2ea4b0,_0x48d641){return db[_0x3634('0x42')][_0x3634('0x46')]({'where':{'id':_0x2ea4b0['params']['id']}})[_0x3634('0x20')](handleEntityNotFound(_0x48d641,null))[_0x3634('0x20')](removeEntity(_0x48d641,null))[_0x3634('0x3f')](handleError(_0x48d641,null));};exports['describe']=function(_0x2c16fa,_0x53da29){return db[_0x3634('0x42')]['describe']()[_0x3634('0x20')](respondWithResult(_0x53da29,null))[_0x3634('0x3f')](handleError(_0x53da29,null));};exports[_0x3634('0x52')]=function(_0x5e3788,_0x2f2032,_0x2b72cd){var _0x5df700={'raw':!![],'where':{}},_0x2a2c92={},_0xbc0017;return db[_0x3634('0x42')][_0x3634('0x53')]({'where':{'id':_0x5e3788['params']['id']}})[_0x3634('0x20')](handleEntityNotFound(_0x2f2032,null))[_0x3634('0x20')](function(_0x55fb3d){if(_0x55fb3d){_0xbc0017=_0x55fb3d['get']({'plain':!![]});_0x2a2c92['model']=_[_0x3634('0x2e')](db['UserFaxQueue'][_0x3634('0x43')]);_0x2a2c92[_0x3634('0x2d')]=_[_0x3634('0x2e')](_0x5e3788['query']);_0x2a2c92[_0x3634('0x2f')]=_[_0x3634('0x30')](_0x2a2c92['model'],_0x2a2c92[_0x3634('0x2d')]);_0x5df700[_0x3634('0x31')]=_[_0x3634('0x30')](_0x2a2c92['model'],qs[_0x3634('0x32')](_0x5e3788[_0x3634('0x2d')][_0x3634('0x32')]));_0x5df700[_0x3634('0x31')]=_0x5df700[_0x3634('0x31')]['length']?_0x5df700[_0x3634('0x31')]:_0x2a2c92[_0x3634('0x2c')];if(!_0x5e3788[_0x3634('0x2d')]['hasOwnProperty'](_0x3634('0x35'))){_0x5df700['limit']=qs[_0x3634('0x1c')](_0x5e3788[_0x3634('0x2d')]['limit']);_0x5df700[_0x3634('0x1b')]=qs[_0x3634('0x1b')](_0x5e3788[_0x3634('0x2d')]['offset']);}_0x5df700[_0x3634('0x36')]=qs['sort'](_0x5e3788['query'][_0x3634('0x37')]);_0x5df700['where']=qs[_0x3634('0x2f')](_[_0x3634('0x39')](_0x5e3788[_0x3634('0x2d')],_0x2a2c92[_0x3634('0x2f')]));_0x5df700['where'][_0x3634('0x54')]=_0x55fb3d['id'];if(_0x5e3788[_0x3634('0x2d')]['filter']){_0x5df700[_0x3634('0x38')]=_['merge'](_0x5df700[_0x3634('0x38')],{'$or':_['map'](_0x5df700['attributes'],function(_0x11c4cc){var _0x9a3947={};_0x9a3947[_0x11c4cc]={'$like':'%'+_0x5e3788[_0x3634('0x2d')][_0x3634('0x3a')]+'%'};return _0x9a3947;})});}_0x5df700=_[_0x3634('0x3b')]({},_0x5df700,_0x5e3788['options']);return db[_0x3634('0x55')][_0x3634('0x56')](_0x5df700);}})[_0x3634('0x20')](function(_0x10ad0a){if(_0x10ad0a){return db[_0x3634('0x57')][_0x3634('0x58')]({'where':{'id':_[_0x3634('0x29')](_0x10ad0a,_0x3634('0x59')),'role':_0x3634('0x5a')},'attributes':['id',_0x3634('0x27'),_0x3634('0x5b'),'updatedAt','createdAt']});}})[_0x3634('0x20')](function(_0x592793){if(_0x592793){return{'count':_0x592793[_0x3634('0x1a')],'rows':_[_0x3634('0x29')](_0x592793[_0x3634('0x5c')],function(_0x5a2d90){return{'membername':_0x5a2d90[_0x3634('0x27')],'UserId':_0x5a2d90['id'],'queue_name':_0xbc0017['name'],'FaxQueueId':_0xbc0017['id'],'interface':util[_0x3634('0x5d')](_0x3634('0x5e'),_0x3634('0x5f'),_0x5a2d90[_0x3634('0x27')]),'penalty':0x0,'paused':_0x5a2d90[_0x3634('0x5b')],'createdAt':_0x5a2d90['createdAt'],'updatedAt':_0x5a2d90[_0x3634('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3634('0x20')](respondWithFilteredResult(_0x2f2032,_0x5df700))[_0x3634('0x3f')](handleError(_0x2f2032,null));};exports[_0x3634('0x61')]=function(_0x505424,_0x5c0a54,_0x15fa89){var _0x248cd0={};var _0x3ac037={};var _0x565cf4;var _0x4a5dc1;return db[_0x3634('0x42')]['findOne']({'where':{'id':_0x505424[_0x3634('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c0a54,null))[_0x3634('0x20')](function(_0x2eb0d1){if(_0x2eb0d1){_0x565cf4=_0x2eb0d1;_0x3ac037[_0x3634('0x2c')]=_[_0x3634('0x2e')](db[_0x3634('0x62')][_0x3634('0x43')]);_0x3ac037['query']=_[_0x3634('0x2e')](_0x505424['query']);_0x3ac037[_0x3634('0x2f')]=_[_0x3634('0x30')](_0x3ac037[_0x3634('0x2c')],_0x3ac037[_0x3634('0x2d')]);_0x248cd0[_0x3634('0x31')]=_[_0x3634('0x30')](_0x3ac037[_0x3634('0x2c')],qs[_0x3634('0x32')](_0x505424[_0x3634('0x2d')]['fields']));_0x248cd0[_0x3634('0x31')]=_0x248cd0[_0x3634('0x31')][_0x3634('0x33')]?_0x248cd0[_0x3634('0x31')]:_0x3ac037[_0x3634('0x2c')];_0x248cd0[_0x3634('0x36')]=qs[_0x3634('0x37')](_0x505424[_0x3634('0x2d')][_0x3634('0x37')]);_0x248cd0[_0x3634('0x38')]=qs['filters'](_[_0x3634('0x39')](_0x505424[_0x3634('0x2d')],_0x3ac037['filters']));if(_0x505424['query'][_0x3634('0x3a')]){_0x248cd0[_0x3634('0x38')]=_[_0x3634('0x3b')](_0x248cd0[_0x3634('0x38')],{'$or':_['map'](_0x248cd0[_0x3634('0x31')],function(_0x97c448){var _0x5bacd9={};_0x5bacd9[_0x97c448]={'$like':'%'+_0x505424[_0x3634('0x2d')][_0x3634('0x3a')]+'%'};return _0x5bacd9;})});}_0x248cd0=_['merge']({},_0x248cd0,_0x505424[_0x3634('0x45')]);return _0x565cf4[_0x3634('0x61')](_0x248cd0);}})['then'](function(_0x474d32){if(_0x474d32){_0x4a5dc1=_0x474d32[_0x3634('0x33')];if(!_0x505424['query'][_0x3634('0x34')](_0x3634('0x35'))){_0x248cd0[_0x3634('0x1c')]=qs['limit'](_0x505424['query']['limit']);_0x248cd0[_0x3634('0x1b')]=qs[_0x3634('0x1b')](_0x505424[_0x3634('0x2d')][_0x3634('0x1b')]);}return _0x565cf4['getTeams'](_0x248cd0);}})['then'](function(_0x7ba69b){if(_0x7ba69b){return _0x7ba69b?{'count':_0x4a5dc1,'rows':_0x7ba69b}:null;}})[_0x3634('0x20')](respondWithResult(_0x5c0a54,null))[_0x3634('0x3f')](handleError(_0x5c0a54,null));};exports[_0x3634('0x63')]=function(_0x167fa1,_0xe91224,_0x266744){var _0x4ccc03=_0x167fa1['body'][_0x3634('0x64')];return db[_0x3634('0x62')][_0x3634('0x56')]({'where':{'id':_0x4ccc03},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3634('0x65'),'attributes':['id',_0x3634('0x27'),_0x3634('0x66'),'voicePause',_0x3634('0x67')],'raw':!![]}]})['then'](function(_0x36d2e7){if(_0x36d2e7){var _0x58506b=_[_0x3634('0x68')](_0x36d2e7,function(_0x307aca){var _0x1bf80f=_0x307aca[_0x3634('0x21')]({'plain':!![]});return _0x1bf80f[_0x3634('0x65')];});return db[_0x3634('0x42')][_0x3634('0x46')]({'where':{'id':_0x167fa1[_0x3634('0x41')]['id']}})[_0x3634('0x20')](function(_0x2de3cb){return db['sequelize'][_0x3634('0x69')](function(_0x307f2c){return _0x2de3cb[_0x3634('0x63')](_0x4ccc03,{'transaction':_0x307f2c})[_0x3634('0x20')](function(){return BPromise[_0x3634('0x6a')](_0x58506b,function(_0x25fe79){return db[_0x3634('0x55')][_0x3634('0x6b')]({'where':{'UserId':_0x25fe79['id'],'FaxQueueId':_0x167fa1[_0x3634('0x41')]['id']},'transaction':_0x307f2c});});})[_0x3634('0x20')](function(){_0x58506b[_0x3634('0x6c')](function(_0x3d63f9){socket[_0x3634('0x6d')](_0x3634('0x6e'),{'UserId':_0x3d63f9['id'],'FaxQueueId':_0x2de3cb['id']});});});});});}})[_0x3634('0x20')](respondWithStatusCode(_0xe91224,null))[_0x3634('0x3f')](handleError(_0xe91224,null));};exports[_0x3634('0x6f')]=function(_0x351c1f,_0x1248fa,_0x5e68cd){return db['Team'][_0x3634('0x56')]({'where':{'id':_0x351c1f[_0x3634('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3634('0x57')],'as':_0x3634('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1248fa,null))[_0x3634('0x20')](function(_0x49e8bd){var _0x46da44=_[_0x3634('0x29')](_0x49e8bd,'id');var _0x20cd2b=[];var _0xfc3bd8=[];var _0x21de6f=squel[_0x3634('0x70')]();_0x21de6f[_0x3634('0x71')](_0x3634('0x72'))[_0x3634('0x73')](_0x3634('0x74'),'tq')['join'](_0x3634('0x75'),'ut',_0x3634('0x76'))['where'](_0x3634('0x77'),_0x351c1f['params']['id']);for(var _0x562430=0x0;_0x562430<_0x49e8bd[_0x3634('0x33')];_0x562430+=0x1){let _0x5522d3=_0x49e8bd[_0x562430];for(var _0xac7d50=0x0;_0xac7d50<_0x5522d3[_0x3634('0x65')][_0x3634('0x33')];_0xac7d50+=0x1){let _0x15961d=_0x5522d3[_0x3634('0x65')][_0xac7d50];var _0x3791de=_0x21de6f[_0x3634('0x78')]();_0x3791de[_0x3634('0x38')]('ut.UserId\x20=\x20?',_0x15961d['id']);_0xfc3bd8[_0x3634('0x79')](db[_0x3634('0x7a')][_0x3634('0x2d')](_0x3791de[_0x3634('0x7b')](),{'type':db[_0x3634('0x7a')][_0x3634('0x7c')]['SELECT']})[_0x3634('0x20')](function(_0xe51698){if(_0xe51698['length']===0x1){return _0x15961d['id'];}else{var _0x26fbf9=_[_0x3634('0x7d')](_[_0x3634('0x29')](_0xe51698,_0x3634('0x7e')),function(_0x2ecc07){return _['includes'](_0x46da44,_0x2ecc07);});if(_0x26fbf9){return _0x15961d['id'];}}}));}}return BPromise[_0x3634('0x7f')](_0xfc3bd8)[_0x3634('0x20')](function(_0x3cf87f){_0x20cd2b=_(_0x20cd2b)['union'](_0x3cf87f)[_0x3634('0x80')]()[_0x3634('0x81')]();return db[_0x3634('0x42')][_0x3634('0x46')]({'where':{'id':_0x351c1f['params']['id']}})['then'](function(_0x19f359){return db[_0x3634('0x7a')][_0x3634('0x69')](function(_0x421913){return _0x19f359['removeTeams'](_0x351c1f['query'][_0x3634('0x64')],{'transaction':_0x421913})['then'](function(){if(!_[_0x3634('0x82')](_0x20cd2b)){return _0x19f359[_0x3634('0x83')](_0x20cd2b,{'transaction':_0x421913});}})[_0x3634('0x20')](function(){_0x20cd2b[_0x3634('0x6c')](function(_0x5885ea){socket[_0x3634('0x6d')]('userFaxQueue:remove',{'UserId':_0x5885ea,'FaxQueueId':_0x19f359['id']});});});});});});})[_0x3634('0x20')](respondWithStatusCode(_0x1248fa,null))[_0x3634('0x3f')](handleError(_0x1248fa,null));};exports[_0x3634('0x84')]=function(_0x53e366,_0x36d3bf,_0x50ee57){return db['FaxQueue'][_0x3634('0x46')]({'where':{'id':_0x53e366[_0x3634('0x41')]['id']}})[_0x3634('0x20')](handleEntityNotFound(_0x36d3bf,null))['then'](function(_0x4b2242){if(_0x4b2242){return _0x4b2242[_0x3634('0x84')](_0x53e366[_0x3634('0x48')][_0x3634('0x64')],_[_0x3634('0x85')](_0x53e366[_0x3634('0x48')],[_0x3634('0x64'),'id'])||{})[_0x3634('0x86')](function(_0x171490){for(var _0x2b71d7=0x0;_0x2b71d7<_0x53e366[_0x3634('0x48')][_0x3634('0x64')][_0x3634('0x33')];_0x2b71d7+=0x1){socket[_0x3634('0x6d')](_0x3634('0x6e'),{'UserId':_0x53e366[_0x3634('0x48')][_0x3634('0x64')][_0x2b71d7],'FaxQueueId':_0x53e366[_0x3634('0x41')]['id']});}return _0x171490;});}})[_0x3634('0x20')](respondWithResult(_0x36d3bf,null))[_0x3634('0x3f')](handleError(_0x36d3bf,null));};exports[_0x3634('0x83')]=function(_0x3e7ae9,_0x336f18,_0x171da5){return db['FaxQueue'][_0x3634('0x46')]({'where':{'id':_0x3e7ae9[_0x3634('0x41')]['id']}})['then'](handleEntityNotFound(_0x336f18,null))['then'](function(_0x4bc6f9){if(_0x4bc6f9){return _0x4bc6f9[_0x3634('0x83')](_0x3e7ae9[_0x3634('0x2d')][_0x3634('0x64')])['then'](function(){if(_[_0x3634('0x87')](_0x3e7ae9[_0x3634('0x2d')]['ids'])){for(var _0x22b927=0x0;_0x22b927<_0x3e7ae9['query']['ids'][_0x3634('0x33')];_0x22b927+=0x1){socket[_0x3634('0x6d')](_0x3634('0x88'),{'UserId':Number(_0x3e7ae9[_0x3634('0x2d')]['ids'][_0x22b927]),'FaxQueueId':Number(_0x3e7ae9[_0x3634('0x41')]['id'])});}}else{socket[_0x3634('0x6d')](_0x3634('0x88'),{'UserId':Number(_0x3e7ae9[_0x3634('0x2d')][_0x3634('0x64')]),'FaxQueueId':Number(_0x3e7ae9[_0x3634('0x41')]['id'])});}});}})[_0x3634('0x20')](respondWithStatusCode(_0x336f18,null))[_0x3634('0x3f')](handleError(_0x336f18,null));};exports[_0x3634('0x89')]=function(_0x1a3184,_0x46fb78,_0x48b16b){var _0xca145e={};var _0x41af2b={};var _0x41df60;var _0x5ce7b9;return db[_0x3634('0x42')][_0x3634('0x53')]({'where':{'id':_0x1a3184[_0x3634('0x41')]['id']}})[_0x3634('0x20')](handleEntityNotFound(_0x46fb78,null))[_0x3634('0x20')](function(_0x457cb0){if(_0x457cb0){_0x41df60=_0x457cb0;_0x41af2b['model']=_[_0x3634('0x2e')](db[_0x3634('0x57')][_0x3634('0x43')]);_0x41af2b['query']=_[_0x3634('0x2e')](_0x1a3184[_0x3634('0x2d')]);_0x41af2b['filters']=_[_0x3634('0x30')](_0x41af2b[_0x3634('0x2c')],_0x41af2b[_0x3634('0x2d')]);_0xca145e[_0x3634('0x31')]=_[_0x3634('0x30')](_0x41af2b[_0x3634('0x2c')],qs[_0x3634('0x32')](_0x1a3184[_0x3634('0x2d')][_0x3634('0x32')]));_0xca145e['attributes']=_0xca145e[_0x3634('0x31')]['length']?_0xca145e[_0x3634('0x31')]:_0x41af2b[_0x3634('0x2c')];_0xca145e[_0x3634('0x36')]=qs['sort'](_0x1a3184[_0x3634('0x2d')]['sort']);_0xca145e[_0x3634('0x38')]=qs[_0x3634('0x2f')](_[_0x3634('0x39')](_0x1a3184['query'],_0x41af2b[_0x3634('0x2f')]));if(_0x1a3184[_0x3634('0x2d')][_0x3634('0x3a')]){_0xca145e[_0x3634('0x38')]=_[_0x3634('0x3b')](_0xca145e['where'],{'$or':_['map'](_0xca145e['attributes'],function(_0x92948d){var _0x4c30d7={};_0x4c30d7[_0x92948d]={'$like':'%'+_0x1a3184['query'][_0x3634('0x3a')]+'%'};return _0x4c30d7;})});}_0xca145e=_[_0x3634('0x3b')]({},_0xca145e,_0x1a3184['options']);return _0x41df60[_0x3634('0x89')](_0xca145e);}})[_0x3634('0x20')](function(_0x362e43){if(_0x362e43){_0x5ce7b9=_0x362e43['length'];if(!_0x1a3184['query'][_0x3634('0x34')](_0x3634('0x35'))){_0xca145e[_0x3634('0x1c')]=qs[_0x3634('0x1c')](_0x1a3184['query'][_0x3634('0x1c')]);_0xca145e[_0x3634('0x1b')]=qs[_0x3634('0x1b')](_0x1a3184['query'][_0x3634('0x1b')]);}return _0x41df60[_0x3634('0x89')](_0xca145e);}})[_0x3634('0x20')](function(_0x5c1f18){if(_0x5c1f18){return _0x5c1f18?{'count':_0x5ce7b9,'rows':_0x5c1f18}:null;}})['then'](respondWithResult(_0x46fb78,null))['catch'](handleError(_0x46fb78,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7a97e06..def7c96 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 _0xfe4b=['update','remove','emit','hasOwnProperty','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x1688b7,_0x1b5f82){var _0x3a7495=function(_0xc64f6){while(--_0xc64f6){_0x1688b7['push'](_0x1688b7['shift']());}};_0x3a7495(++_0x1b5f82);}(_0xfe4b,0x14c));var _0xbfe4=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xfe4b[_0x1f9f37];return _0x21c080;};'use strict';var EventEmitter=require(_0xbfe4('0x0'));var FaxQueue=require(_0xbfe4('0x1'))['db'][_0xbfe4('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbfe4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfe4('0x4'),'afterDestroy':_0xbfe4('0x5')};function emitEvent(_0x2a77ae){return function(_0x17a872,_0x2f04d2,_0x18fead){FaxQueueEvents[_0xbfe4('0x6')](_0x2a77ae+':'+_0x17a872['id'],_0x17a872);FaxQueueEvents[_0xbfe4('0x6')](_0x2a77ae,_0x17a872);_0x18fead(null);};}for(var e in events){if(events[_0xbfe4('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xb84d=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2dc7ee,_0x5600fc){var _0x29c63a=function(_0x51e84c){while(--_0x51e84c){_0x2dc7ee['push'](_0x2dc7ee['shift']());}};_0x29c63a(++_0x5600fc);}(_0xb84d,0x173));var _0xdb84=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb84d[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0xdb84('0x0'));var FaxQueue=require(_0xdb84('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdb84('0x2')](0x0);var events={'afterCreate':_0xdb84('0x3'),'afterUpdate':_0xdb84('0x4'),'afterDestroy':_0xdb84('0x5')};function emitEvent(_0x507ae1){return function(_0xaf2920,_0x5d0a1e,_0x34e606){FaxQueueEvents['emit'](_0x507ae1+':'+_0xaf2920['id'],_0xaf2920);FaxQueueEvents[_0xdb84('0x6')](_0x507ae1,_0xaf2920);_0x34e606(null);};}for(var e in events){if(events[_0xdb84('0x7')](e)){var event=events[e];FaxQueue[_0xdb84('0x8')](e,emitEvent(event));}}module[_0xdb84('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 7ca1e1b..a2aacbf 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 _0xd13b=['exports','define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x403be0,_0x41b5e2){var _0x403029=function(_0x452d0d){while(--_0x452d0d){_0x403be0['push'](_0x403be0['shift']());}};_0x403029(++_0x41b5e2);}(_0xd13b,0x170));var _0xbd13=function(_0x531f72,_0x3d7ebc){_0x531f72=_0x531f72-0x0;var _0x401ade=_0xd13b[_0x531f72];return _0x401ade;};'use strict';var _=require(_0xbd13('0x0'));var util=require(_0xbd13('0x1'));var logger=require('../../config/logger')(_0xbd13('0x2'));var moment=require(_0xbd13('0x3'));var BPromise=require(_0xbd13('0x4'));var rp=require(_0xbd13('0x5'));var fs=require('fs');var path=require(_0xbd13('0x6'));var rimraf=require(_0xbd13('0x7'));var config=require(_0xbd13('0x8'));var attributes=require(_0xbd13('0x9'));module[_0xbd13('0xa')]=function(_0x583434,_0x371961){return _0x583434[_0xbd13('0xb')](_0xbd13('0xc'),attributes,{'tableName':_0xbd13('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8943=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe7d561,_0x146cef){var _0x4c27f0=function(_0x287ac7){while(--_0x287ac7){_0xe7d561['push'](_0xe7d561['shift']());}};_0x4c27f0(++_0x146cef);}(_0x8943,0x17d));var _0x3894=function(_0x37b6cb,_0x2453b8){_0x37b6cb=_0x37b6cb-0x0;var _0x216b0c=_0x8943[_0x37b6cb];return _0x216b0c;};'use strict';var _=require(_0x3894('0x0'));var util=require(_0x3894('0x1'));var logger=require(_0x3894('0x2'))(_0x3894('0x3'));var moment=require(_0x3894('0x4'));var BPromise=require('bluebird');var rp=require(_0x3894('0x5'));var fs=require('fs');var path=require(_0x3894('0x6'));var rimraf=require(_0x3894('0x7'));var config=require(_0x3894('0x8'));var attributes=require('./faxQueue.attributes');module[_0x3894('0x9')]=function(_0x5afd00,_0x176704){return _0x5afd00[_0x3894('0xa')](_0x3894('0xb'),attributes,{'tableName':_0x3894('0xc'),'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 2a768a0..f7d247e 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 _0x3ce7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','info','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxQueue,\x20%s,\x20%s','message','catch','FaxQueue','options','raw','attributes','limit','include','map','model','GetFaxQueue','ShowFaxQueue','where','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3ce7,0xb3));var _0x73ce=function(_0x54bfb2,_0x7f436b){_0x54bfb2=_0x54bfb2-0x0;var _0x4ea201=_0x3ce7[_0x54bfb2];return _0x4ea201;};'use strict';var _=require('lodash');var util=require(_0x73ce('0x0'));var moment=require(_0x73ce('0x1'));var BPromise=require(_0x73ce('0x2'));var rs=require(_0x73ce('0x3'));var fs=require('fs');var Redis=require(_0x73ce('0x4'));var db=require(_0x73ce('0x5'))['db'];var utils=require(_0x73ce('0x6'));var logger=require(_0x73ce('0x7'))('rpc');var config=require(_0x73ce('0x8'));var jayson=require(_0x73ce('0x9'));var client=jayson[_0x73ce('0xa')][_0x73ce('0xb')]({'port':0x232a});config[_0x73ce('0xc')]=_[_0x73ce('0xd')](config[_0x73ce('0xc')],{'host':_0x73ce('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3ff52a,_0x43ad6a,_0x37bf65){return new BPromise(function(_0x11e406,_0x3bc109){return client[_0x73ce('0xf')](_0x3ff52a,_0x37bf65)[_0x73ce('0x10')](function(_0x5bdff4){logger[_0x73ce('0x11')]('FaxQueue,\x20%s,\x20%s',_0x43ad6a,'request\x20sent');logger['debug'](_0x73ce('0x12'),_0x43ad6a,_0x73ce('0x13'),JSON[_0x73ce('0x14')](_0x5bdff4));if(_0x5bdff4[_0x73ce('0x15')]){if(_0x5bdff4['error']['code']===0x1f4){logger['error'](_0x73ce('0x16'),_0x43ad6a,_0x5bdff4[_0x73ce('0x15')][_0x73ce('0x17')]);return _0x3bc109(_0x5bdff4['error'][_0x73ce('0x17')]);}logger[_0x73ce('0x15')]('FaxQueue,\x20%s,\x20%s',_0x43ad6a,_0x5bdff4['error'][_0x73ce('0x17')]);return _0x11e406(_0x5bdff4[_0x73ce('0x15')]['message']);}else{logger['info'](_0x73ce('0x16'),_0x43ad6a,_0x73ce('0x13'));_0x11e406(_0x5bdff4['result'][_0x73ce('0x17')]);}})[_0x73ce('0x18')](function(_0x2e057d){logger[_0x73ce('0x15')](_0x73ce('0x16'),_0x43ad6a,_0x2e057d);_0x3bc109(_0x2e057d);});});}exports['GetFaxQueue']=function(_0x2c5392){var _0x177d44=this;return new Promise(function(_0x4b117d,_0x377381){return db[_0x73ce('0x19')]['findAll']({'raw':_0x2c5392[_0x73ce('0x1a')]?_0x2c5392[_0x73ce('0x1a')][_0x73ce('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c5392[_0x73ce('0x1a')]?_0x2c5392[_0x73ce('0x1a')]['where']||null:null,'attributes':_0x2c5392[_0x73ce('0x1a')]?_0x2c5392[_0x73ce('0x1a')][_0x73ce('0x1c')]||null:null,'limit':_0x2c5392[_0x73ce('0x1a')]?_0x2c5392[_0x73ce('0x1a')][_0x73ce('0x1d')]||null:null,'include':_0x2c5392[_0x73ce('0x1a')]?_0x2c5392[_0x73ce('0x1a')][_0x73ce('0x1e')]?_[_0x73ce('0x1f')](_0x2c5392[_0x73ce('0x1a')][_0x73ce('0x1e')],function(_0x509a8c){return{'model':db[_0x509a8c[_0x73ce('0x20')]],'as':_0x509a8c['as'],'attributes':_0x509a8c['attributes'],'include':_0x509a8c['include']?_['map'](_0x509a8c[_0x73ce('0x1e')],function(_0x2ecfd6){return{'model':db[_0x2ecfd6[_0x73ce('0x20')]],'as':_0x2ecfd6['as'],'attributes':_0x2ecfd6[_0x73ce('0x1c')],'include':_0x2ecfd6[_0x73ce('0x1e')]?_[_0x73ce('0x1f')](_0x2ecfd6[_0x73ce('0x1e')],function(_0x2de27a){return{'model':db[_0x2de27a[_0x73ce('0x20')]],'as':_0x2de27a['as'],'attributes':_0x2de27a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25d8be){logger[_0x73ce('0x11')](_0x73ce('0x21'),_0x2c5392);logger['debug'](_0x73ce('0x21'),_0x2c5392,JSON[_0x73ce('0x14')](_0x25d8be));_0x4b117d(_0x25d8be);})[_0x73ce('0x18')](function(_0x56aa66){logger[_0x73ce('0x15')](_0x73ce('0x21'),_0x56aa66[_0x73ce('0x17')],_0x2c5392);_0x377381(_0x177d44[_0x73ce('0x15')](0x1f4,_0x56aa66['message']));});});};exports[_0x73ce('0x22')]=function(_0x598579){var _0x41353c=this;return new Promise(function(_0x2a4087,_0x3d11ea){return db[_0x73ce('0x19')]['find']({'raw':_0x598579['options']?_0x598579[_0x73ce('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x598579[_0x73ce('0x1a')]?_0x598579[_0x73ce('0x1a')][_0x73ce('0x23')]||null:null,'attributes':_0x598579[_0x73ce('0x1a')]?_0x598579[_0x73ce('0x1a')][_0x73ce('0x1c')]||null:null,'include':_0x598579[_0x73ce('0x1a')]?_0x598579[_0x73ce('0x1a')][_0x73ce('0x1e')]?_[_0x73ce('0x1f')](_0x598579[_0x73ce('0x1a')][_0x73ce('0x1e')],function(_0x482b9f){return{'model':db[_0x482b9f[_0x73ce('0x20')]],'as':_0x482b9f['as'],'attributes':_0x482b9f[_0x73ce('0x1c')],'include':_0x482b9f['include']?_['map'](_0x482b9f['include'],function(_0x5e1901){return{'model':db[_0x5e1901[_0x73ce('0x20')]],'as':_0x5e1901['as'],'attributes':_0x5e1901[_0x73ce('0x1c')],'include':_0x5e1901[_0x73ce('0x1e')]?_[_0x73ce('0x1f')](_0x5e1901[_0x73ce('0x1e')],function(_0x3849ef){return{'model':db[_0x3849ef[_0x73ce('0x20')]],'as':_0x3849ef['as'],'attributes':_0x3849ef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x360c56){logger[_0x73ce('0x11')](_0x73ce('0x22'),_0x598579);logger['debug'](_0x73ce('0x22'),_0x598579,JSON[_0x73ce('0x14')](_0x360c56));_0x2a4087(_0x360c56);})[_0x73ce('0x18')](function(_0x4f2516){logger[_0x73ce('0x15')](_0x73ce('0x22'),_0x4f2516[_0x73ce('0x17')],_0x598579);_0x3d11ea(_0x41353c[_0x73ce('0x15')](0x1f4,_0x4f2516[_0x73ce('0x17')]));});});}; \ No newline at end of file +var _0xbb67=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowFaxQueue','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1f00e1,_0x40b16f){var _0x34beea=function(_0x2988da){while(--_0x2988da){_0x1f00e1['push'](_0x1f00e1['shift']());}};_0x34beea(++_0x40b16f);}(_0xbb67,0x140));var _0x7bb6=function(_0xc7e3dc,_0x216cdc){_0xc7e3dc=_0xc7e3dc-0x0;var _0x5f12d5=_0xbb67[_0xc7e3dc];return _0x5f12d5;};'use strict';var _=require(_0x7bb6('0x0'));var util=require(_0x7bb6('0x1'));var moment=require(_0x7bb6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bb6('0x3'));var db=require(_0x7bb6('0x4'))['db'];var utils=require(_0x7bb6('0x5'));var logger=require(_0x7bb6('0x6'))(_0x7bb6('0x7'));var config=require(_0x7bb6('0x8'));var jayson=require(_0x7bb6('0x9'));var client=jayson[_0x7bb6('0xa')][_0x7bb6('0xb')]({'port':0x232a});config[_0x7bb6('0xc')]=_[_0x7bb6('0xd')](config[_0x7bb6('0xc')],{'host':_0x7bb6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7bb6('0xf'))[_0x7bb6('0x10')](socket);function respondWithRpcPromise(_0x10b642,_0x389575,_0x9e89f9){return new BPromise(function(_0xa82c65,_0x4bf855){return client[_0x7bb6('0x11')](_0x10b642,_0x9e89f9)['then'](function(_0x4e5914){logger['info'](_0x7bb6('0x12'),_0x389575,_0x7bb6('0x13'));logger[_0x7bb6('0x14')](_0x7bb6('0x15'),_0x389575,_0x7bb6('0x13'),JSON[_0x7bb6('0x16')](_0x4e5914));if(_0x4e5914[_0x7bb6('0x17')]){if(_0x4e5914[_0x7bb6('0x17')][_0x7bb6('0x18')]===0x1f4){logger[_0x7bb6('0x17')](_0x7bb6('0x12'),_0x389575,_0x4e5914['error'][_0x7bb6('0x19')]);return _0x4bf855(_0x4e5914[_0x7bb6('0x17')][_0x7bb6('0x19')]);}logger[_0x7bb6('0x17')](_0x7bb6('0x12'),_0x389575,_0x4e5914[_0x7bb6('0x17')]['message']);return _0xa82c65(_0x4e5914['error'][_0x7bb6('0x19')]);}else{logger[_0x7bb6('0x1a')](_0x7bb6('0x12'),_0x389575,'request\x20sent');_0xa82c65(_0x4e5914[_0x7bb6('0x1b')][_0x7bb6('0x19')]);}})['catch'](function(_0x2438b1){logger['error'](_0x7bb6('0x12'),_0x389575,_0x2438b1);_0x4bf855(_0x2438b1);});});}exports[_0x7bb6('0x1c')]=function(_0x1a1771){var _0x3750fd=this;return new Promise(function(_0x499816,_0x1c5e3e){return db[_0x7bb6('0x1d')][_0x7bb6('0x1e')]({'raw':_0x1a1771[_0x7bb6('0x1f')]?_0x1a1771[_0x7bb6('0x1f')][_0x7bb6('0x20')]===undefined?!![]:![]:!![],'where':_0x1a1771[_0x7bb6('0x1f')]?_0x1a1771[_0x7bb6('0x1f')][_0x7bb6('0x21')]||null:null,'attributes':_0x1a1771[_0x7bb6('0x1f')]?_0x1a1771[_0x7bb6('0x1f')][_0x7bb6('0x22')]||null:null,'limit':_0x1a1771[_0x7bb6('0x1f')]?_0x1a1771[_0x7bb6('0x1f')]['limit']||null:null,'include':_0x1a1771[_0x7bb6('0x1f')]?_0x1a1771[_0x7bb6('0x1f')][_0x7bb6('0x23')]?_[_0x7bb6('0x24')](_0x1a1771['options']['include'],function(_0x240aa8){return{'model':db[_0x240aa8['model']],'as':_0x240aa8['as'],'attributes':_0x240aa8[_0x7bb6('0x22')],'include':_0x240aa8[_0x7bb6('0x23')]?_[_0x7bb6('0x24')](_0x240aa8['include'],function(_0x52b423){return{'model':db[_0x52b423[_0x7bb6('0x25')]],'as':_0x52b423['as'],'attributes':_0x52b423[_0x7bb6('0x22')],'include':_0x52b423['include']?_['map'](_0x52b423[_0x7bb6('0x23')],function(_0x490413){return{'model':db[_0x490413[_0x7bb6('0x25')]],'as':_0x490413['as'],'attributes':_0x490413['attributes']};}):[]};}):[]};}):[]:[]})[_0x7bb6('0x26')](function(_0x54a447){logger[_0x7bb6('0x1a')](_0x7bb6('0x1c'),_0x1a1771);logger[_0x7bb6('0x14')](_0x7bb6('0x1c'),_0x1a1771,JSON['stringify'](_0x54a447));_0x499816(_0x54a447);})['catch'](function(_0x2be167){logger[_0x7bb6('0x17')](_0x7bb6('0x1c'),_0x2be167['message'],_0x1a1771);_0x1c5e3e(_0x3750fd['error'](0x1f4,_0x2be167[_0x7bb6('0x19')]));});});};exports['ShowFaxQueue']=function(_0x389ba5){var _0x18a913=this;return new Promise(function(_0x49ed32,_0x4a3c82){return db[_0x7bb6('0x1d')]['find']({'raw':_0x389ba5[_0x7bb6('0x1f')]?_0x389ba5[_0x7bb6('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x389ba5[_0x7bb6('0x1f')]?_0x389ba5[_0x7bb6('0x1f')][_0x7bb6('0x21')]||null:null,'attributes':_0x389ba5[_0x7bb6('0x1f')]?_0x389ba5[_0x7bb6('0x1f')][_0x7bb6('0x22')]||null:null,'include':_0x389ba5[_0x7bb6('0x1f')]?_0x389ba5['options'][_0x7bb6('0x23')]?_[_0x7bb6('0x24')](_0x389ba5[_0x7bb6('0x1f')][_0x7bb6('0x23')],function(_0x1fc4e1){return{'model':db[_0x1fc4e1[_0x7bb6('0x25')]],'as':_0x1fc4e1['as'],'attributes':_0x1fc4e1[_0x7bb6('0x22')],'include':_0x1fc4e1['include']?_[_0x7bb6('0x24')](_0x1fc4e1[_0x7bb6('0x23')],function(_0xe5a530){return{'model':db[_0xe5a530[_0x7bb6('0x25')]],'as':_0xe5a530['as'],'attributes':_0xe5a530[_0x7bb6('0x22')],'include':_0xe5a530[_0x7bb6('0x23')]?_[_0x7bb6('0x24')](_0xe5a530[_0x7bb6('0x23')],function(_0x4530d9){return{'model':db[_0x4530d9[_0x7bb6('0x25')]],'as':_0x4530d9['as'],'attributes':_0x4530d9[_0x7bb6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7bb6('0x26')](function(_0x4ac13a){logger[_0x7bb6('0x1a')](_0x7bb6('0x27'),_0x389ba5);logger['debug'](_0x7bb6('0x27'),_0x389ba5,JSON[_0x7bb6('0x16')](_0x4ac13a));_0x49ed32(_0x4ac13a);})[_0x7bb6('0x28')](function(_0x412157){logger[_0x7bb6('0x17')](_0x7bb6('0x27'),_0x412157[_0x7bb6('0x19')],_0x389ba5);_0x4a3c82(_0x18a913[_0x7bb6('0x17')](0x1f4,_0x412157[_0x7bb6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 94dbf91..f9bcf78 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 _0x493e=['length','faxQueue:','./faxQueue.events','save','remove','update','removeListener','register'];(function(_0x164237,_0x3777dd){var _0x5289ce=function(_0x3fbe78){while(--_0x3fbe78){_0x164237['push'](_0x164237['shift']());}};_0x5289ce(++_0x3777dd);}(_0x493e,0x1ba));var _0xe493=function(_0x5c5029,_0x45d1ce){_0x5c5029=_0x5c5029-0x0;var _0x283215=_0x493e[_0x5c5029];return _0x283215;};'use strict';var FaxQueueEvents=require(_0xe493('0x0'));var events=[_0xe493('0x1'),_0xe493('0x2'),_0xe493('0x3')];function createListener(_0x54f9c4,_0x58eb99){return function(_0x4f986c){_0x58eb99['emit'](_0x54f9c4,_0x4f986c);};}function removeListener(_0x4ee2b4,_0x8ead4){return function(){FaxQueueEvents[_0xe493('0x4')](_0x4ee2b4,_0x8ead4);};}exports[_0xe493('0x5')]=function(_0xe44165){for(var _0x14ebf2=0x0,_0x5eab98=events[_0xe493('0x6')];_0x14ebf2<_0x5eab98;_0x14ebf2++){var _0x3b5a51=events[_0x14ebf2];var _0x2286ec=createListener(_0xe493('0x7')+_0x3b5a51,_0xe44165);FaxQueueEvents['on'](_0x3b5a51,_0x2286ec);}}; \ No newline at end of file +var _0xaf3c=['remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xaf3c,0x17f));var _0xcaf3=function(_0x341135,_0xd840df){_0x341135=_0x341135-0x0;var _0xb9a991=_0xaf3c[_0x341135];return _0xb9a991;};'use strict';var FaxQueueEvents=require(_0xcaf3('0x0'));var events=['save',_0xcaf3('0x1'),_0xcaf3('0x2')];function createListener(_0x5e1cda,_0x3845e7){return function(_0x45ee92){_0x3845e7[_0xcaf3('0x3')](_0x5e1cda,_0x45ee92);};}function removeListener(_0x4c236d,_0x2a0304){return function(){FaxQueueEvents[_0xcaf3('0x4')](_0x4c236d,_0x2a0304);};}exports[_0xcaf3('0x5')]=function(_0x5bc4dc){for(var _0x24ad35=0x0,_0xe33f8e=events[_0xcaf3('0x6')];_0x24ad35<_0xe33f8e;_0x24ad35++){var _0xd51c44=events[_0x24ad35];var _0x21c641=createListener(_0xcaf3('0x7')+_0xd51c44,_0x5bc4dc);FaxQueueEvents['on'](_0xd51c44,_0x21c641);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 3524959..7db2683 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xb10b,0x12a));var _0xbb10=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0xb10b[_0x57928b];return _0x49aad6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x5d3b01,_0x239f71){var _0x4b7d91=function(_0x161f73){while(--_0x161f73){_0x5d3b01['push'](_0x5d3b01['shift']());}};_0x4b7d91(++_0x239f71);}(_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 auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5d9e26d..726b98b 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 _0xe9e6=['moment','sequelize','STRING','DATE'];(function(_0x3771f2,_0x5e82c4){var _0x546916=function(_0x27eeba){while(--_0x27eeba){_0x3771f2['push'](_0x3771f2['shift']());}};_0x546916(++_0x5e82c4);}(_0xe9e6,0xd0));var _0x6e9e=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xe9e6[_0x3b632f];return _0x10e788;};'use strict';var moment=require(_0x6e9e('0x0'));var Sequelize=require(_0x6e9e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6e9e('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6e9e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6e9e('0x3')]},'reason':{'type':Sequelize[_0x6e9e('0x2')]}}; \ No newline at end of file +var _0xbc7f=['moment','sequelize','exports','STRING','DATE'];(function(_0x373b82,_0xc66d54){var _0x3e134b=function(_0x197179){while(--_0x197179){_0x373b82['push'](_0x373b82['shift']());}};_0x3e134b(++_0xc66d54);}(_0xbc7f,0xe6));var _0xfbc7=function(_0xcc4ee,_0x59feb3){_0xcc4ee=_0xcc4ee-0x0;var _0x201fc4=_0xbc7f[_0xcc4ee];return _0x201fc4;};'use strict';var moment=require(_0xfbc7('0x0'));var Sequelize=require(_0xfbc7('0x1'));module[_0xfbc7('0x2')]={'uniqueid':{'type':Sequelize[_0xfbc7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfbc7('0x3')]},'joinAt':{'type':Sequelize[_0xfbc7('0x4')]},'leaveAt':{'type':Sequelize[_0xfbc7('0x4')]},'acceptAt':{'type':Sequelize[_0xfbc7('0x4')]},'exitAt':{'type':Sequelize[_0xfbc7('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 194acd3..e9bad14 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 _0xb656=['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','json','offset','limit','status','set','apply','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','destroy','describe','html-pdf','zip-dir','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce'];(function(_0x186500,_0x599e52){var _0x3cd160=function(_0x505ac1){while(--_0x505ac1){_0x186500['push'](_0x186500['shift']());}};_0x3cd160(++_0x599e52);}(_0xb656,0x1e7));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6b65('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b65('0x2'));var Mustache=require(_0x6b65('0x3'));var util=require('util');var path=require(_0x6b65('0x4'));var sox=require(_0x6b65('0x5'));var csv=require(_0x6b65('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6b65('0x7'));var crypto=require(_0x6b65('0x8'));var jsforce=require(_0x6b65('0x9'));var deskjs=require(_0x6b65('0xa'));var toCsv=require(_0x6b65('0x6'));var querystring=require(_0x6b65('0xb'));var Papa=require('papaparse');var Redis=require(_0x6b65('0xc'));var authService=require(_0x6b65('0xd'));var qs=require(_0x6b65('0xe'));var as=require(_0x6b65('0xf'));var hardwareService=require(_0x6b65('0x10'));var logger=require(_0x6b65('0x11'))(_0x6b65('0x12'));var utils=require(_0x6b65('0x13'));var config=require(_0x6b65('0x14'));var db=require(_0x6b65('0x15'))['db'];function respondWithStatusCode(_0x2ecc64,_0x54ae95){_0x54ae95=_0x54ae95||0xcc;return function(_0x4b8d91){if(_0x4b8d91){return _0x2ecc64[_0x6b65('0x16')](_0x54ae95);}return _0x2ecc64['status'](_0x54ae95)[_0x6b65('0x17')]();};}function respondWithResult(_0x35521a,_0x2e7c72){_0x2e7c72=_0x2e7c72||0xc8;return function(_0x24e4dd){if(_0x24e4dd){return _0x35521a['status'](_0x2e7c72)[_0x6b65('0x18')](_0x24e4dd);}};}function respondWithFilteredResult(_0x278b99,_0x4d1038){return function(_0x146918){if(_0x146918){var _0x18f972=_0x146918['count'],_0x3364a9=_0x4d1038[_0x6b65('0x19')],_0x4b3380=_0x4d1038[_0x6b65('0x19')]+_0x4d1038[_0x6b65('0x1a')],_0xee5375;if(_0x4b3380>=_0x18f972){_0x4b3380=_0x18f972;_0xee5375=0xc8;}else{_0xee5375=0xce;}_0x278b99[_0x6b65('0x1b')](_0xee5375);return _0x278b99[_0x6b65('0x1c')]('Content-Range',_0x3364a9+'-'+_0x4b3380+'/'+_0x18f972)[_0x6b65('0x18')](_0x146918);}return null;};}function patchUpdates(_0x52348c){return function(_0xc2057d){try{jsonpatch[_0x6b65('0x1d')](_0xc2057d,_0x52348c,!![]);}catch(_0x3175b2){return BPromise['reject'](_0x3175b2);}return _0xc2057d[_0x6b65('0x1e')]();};}function saveUpdates(_0x2ff7d8,_0x429439){return function(_0x10e37d){if(_0x10e37d){return _0x10e37d[_0x6b65('0x1f')](_0x2ff7d8)[_0x6b65('0x20')](function(_0x488cb8){return _0x488cb8;});}return null;};}function removeEntity(_0x2036ef,_0x5f3978){return function(_0x28a62d){if(_0x28a62d){return _0x28a62d['destroy']()[_0x6b65('0x20')](function(){_0x2036ef[_0x6b65('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e44f,_0x48b5ee){return function(_0x3a85fc){if(!_0x3a85fc){_0x34e44f[_0x6b65('0x16')](0x194);}return _0x3a85fc;};}function handleError(_0x4f184a,_0x1b2076){_0x1b2076=_0x1b2076||0x1f4;return function(_0x708f90){logger[_0x6b65('0x21')](_0x708f90[_0x6b65('0x22')]);if(_0x708f90[_0x6b65('0x23')]){delete _0x708f90[_0x6b65('0x23')];}_0x4f184a[_0x6b65('0x1b')](_0x1b2076)[_0x6b65('0x24')](_0x708f90);};}exports[_0x6b65('0x25')]=function(_0x498a54,_0x37fe3a){var _0x1634f8={},_0xc2d816={},_0x199080={'count':0x0,'rows':[]};var _0x46d020=_[_0x6b65('0x26')](db[_0x6b65('0x27')][_0x6b65('0x28')],function(_0x363fd8){return{'name':_0x363fd8[_0x6b65('0x29')],'type':_0x363fd8[_0x6b65('0x2a')][_0x6b65('0x2b')]};});_0xc2d816['model']=_[_0x6b65('0x26')](_0x46d020,_0x6b65('0x23'));_0xc2d816['query']=_['keys'](_0x498a54[_0x6b65('0x2c')]);_0xc2d816['filters']=_['intersection'](_0xc2d816[_0x6b65('0x2d')],_0xc2d816[_0x6b65('0x2c')]);_0x1634f8[_0x6b65('0x2e')]=_[_0x6b65('0x2f')](_0xc2d816[_0x6b65('0x2d')],qs[_0x6b65('0x30')](_0x498a54['query'][_0x6b65('0x30')]));_0x1634f8[_0x6b65('0x2e')]=_0x1634f8['attributes'][_0x6b65('0x31')]?_0x1634f8[_0x6b65('0x2e')]:_0xc2d816['model'];if(!_0x498a54[_0x6b65('0x2c')]['hasOwnProperty'](_0x6b65('0x32'))){_0x1634f8[_0x6b65('0x1a')]=qs[_0x6b65('0x1a')](_0x498a54[_0x6b65('0x2c')][_0x6b65('0x1a')]);_0x1634f8[_0x6b65('0x19')]=qs[_0x6b65('0x19')](_0x498a54[_0x6b65('0x2c')][_0x6b65('0x19')]);}_0x1634f8[_0x6b65('0x33')]=qs['sort'](_0x498a54[_0x6b65('0x2c')][_0x6b65('0x34')]);_0x1634f8[_0x6b65('0x35')]=qs[_0x6b65('0x36')](_[_0x6b65('0x37')](_0x498a54[_0x6b65('0x2c')],_0xc2d816['filters']),_0x46d020);if(_0x498a54['query'][_0x6b65('0x38')]){_0x1634f8[_0x6b65('0x35')]=_[_0x6b65('0x39')](_0x1634f8[_0x6b65('0x35')],{'$or':_[_0x6b65('0x26')](_0x46d020,function(_0x5f3dd5){if(_0x5f3dd5[_0x6b65('0x2a')]!==_0x6b65('0x3a')){var _0x2be083={};_0x2be083[_0x5f3dd5['name']]={'$like':'%'+_0x498a54[_0x6b65('0x2c')][_0x6b65('0x38')]+'%'};return _0x2be083;}})});}_0x1634f8=_[_0x6b65('0x39')]({},_0x1634f8,_0x498a54[_0x6b65('0x3b')]);var _0x293515={'where':_0x1634f8[_0x6b65('0x35')]};return db[_0x6b65('0x27')][_0x6b65('0x3c')](_0x293515)[_0x6b65('0x20')](function(_0x569dad){_0x199080[_0x6b65('0x3c')]=_0x569dad;if(_0x498a54['query'][_0x6b65('0x3d')]){_0x1634f8[_0x6b65('0x3e')]=[{'all':!![]}];}return db[_0x6b65('0x27')]['findAll'](_0x1634f8);})[_0x6b65('0x20')](function(_0x1891f2){_0x199080['rows']=_0x1891f2;return _0x199080;})[_0x6b65('0x20')](respondWithFilteredResult(_0x37fe3a,_0x1634f8))[_0x6b65('0x3f')](handleError(_0x37fe3a,null));};exports[_0x6b65('0x40')]=function(_0x403b9a,_0x10714b){var _0x8d2505={'raw':!![],'where':{'id':_0x403b9a[_0x6b65('0x41')]['id']}},_0x1565b3={};_0x1565b3['model']=_['keys'](db[_0x6b65('0x27')][_0x6b65('0x28')]);_0x1565b3[_0x6b65('0x2c')]=_['keys'](_0x403b9a[_0x6b65('0x2c')]);_0x1565b3[_0x6b65('0x36')]=_[_0x6b65('0x2f')](_0x1565b3[_0x6b65('0x2d')],_0x1565b3[_0x6b65('0x2c')]);_0x8d2505['attributes']=_[_0x6b65('0x2f')](_0x1565b3['model'],qs[_0x6b65('0x30')](_0x403b9a[_0x6b65('0x2c')]['fields']));_0x8d2505['attributes']=_0x8d2505[_0x6b65('0x2e')][_0x6b65('0x31')]?_0x8d2505['attributes']:_0x1565b3[_0x6b65('0x2d')];if(_0x403b9a['query'][_0x6b65('0x3d')]){_0x8d2505[_0x6b65('0x3e')]=[{'all':!![]}];}_0x8d2505=_[_0x6b65('0x39')]({},_0x8d2505,_0x403b9a['options']);return db[_0x6b65('0x27')][_0x6b65('0x42')](_0x8d2505)[_0x6b65('0x20')](handleEntityNotFound(_0x10714b,null))['then'](respondWithResult(_0x10714b,null))[_0x6b65('0x3f')](handleError(_0x10714b,null));};exports[_0x6b65('0x43')]=function(_0x65dfbb,_0x4f6748){return db[_0x6b65('0x27')][_0x6b65('0x43')](_0x65dfbb['body'],{})['then'](respondWithResult(_0x4f6748,0xc9))[_0x6b65('0x3f')](handleError(_0x4f6748,null));};exports[_0x6b65('0x1f')]=function(_0x22777f,_0x13626b){if(_0x22777f[_0x6b65('0x44')]['id']){delete _0x22777f[_0x6b65('0x44')]['id'];}return db[_0x6b65('0x27')]['find']({'where':{'id':_0x22777f['params']['id']}})[_0x6b65('0x20')](handleEntityNotFound(_0x13626b,null))[_0x6b65('0x20')](saveUpdates(_0x22777f['body'],null))[_0x6b65('0x20')](respondWithResult(_0x13626b,null))['catch'](handleError(_0x13626b,null));};exports[_0x6b65('0x45')]=function(_0x4ef243,_0x5c08ce){return db['FaxQueueReport'][_0x6b65('0x42')]({'where':{'id':_0x4ef243[_0x6b65('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c08ce,null))[_0x6b65('0x20')](removeEntity(_0x5c08ce,null))['catch'](handleError(_0x5c08ce,null));};exports[_0x6b65('0x46')]=function(_0x3a8992,_0x351d5a){return db[_0x6b65('0x27')][_0x6b65('0x46')]()['then'](respondWithResult(_0x351d5a,null))[_0x6b65('0x3f')](handleError(_0x351d5a,null));}; \ No newline at end of file +var _0xa0da=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','FaxQueueReport','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xa93b0f,_0x48d83f){var _0x2906e1=function(_0x470a39){while(--_0x470a39){_0xa93b0f['push'](_0xa93b0f['shift']());}};_0x2906e1(++_0x48d83f);}(_0xa0da,0xc6));var _0xaa0d=function(_0x1a96ec,_0x56af28){_0x1a96ec=_0x1a96ec-0x0;var _0x6dd2db=_0xa0da[_0x1a96ec];return _0x6dd2db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa0d('0x0'));var rimraf=require(_0xaa0d('0x1'));var zipdir=require(_0xaa0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa0d('0x3'));var BPromise=require(_0xaa0d('0x4'));var Mustache=require('mustache');var util=require(_0xaa0d('0x5'));var path=require(_0xaa0d('0x6'));var sox=require(_0xaa0d('0x7'));var csv=require(_0xaa0d('0x8'));var ejs=require(_0xaa0d('0x9'));var fs=require('fs');var _=require(_0xaa0d('0xa'));var squel=require(_0xaa0d('0xb'));var crypto=require(_0xaa0d('0xc'));var jsforce=require(_0xaa0d('0xd'));var deskjs=require(_0xaa0d('0xe'));var toCsv=require(_0xaa0d('0x8'));var querystring=require(_0xaa0d('0xf'));var Papa=require(_0xaa0d('0x10'));var Redis=require(_0xaa0d('0x11'));var authService=require(_0xaa0d('0x12'));var qs=require(_0xaa0d('0x13'));var as=require(_0xaa0d('0x14'));var hardwareService=require(_0xaa0d('0x15'));var logger=require(_0xaa0d('0x16'))(_0xaa0d('0x17'));var utils=require(_0xaa0d('0x18'));var config=require(_0xaa0d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e35b,_0x1b0ffa){_0x1b0ffa=_0x1b0ffa||0xcc;return function(_0x4b956d){if(_0x4b956d){return _0x23e35b['sendStatus'](_0x1b0ffa);}return _0x23e35b[_0xaa0d('0x1a')](_0x1b0ffa)[_0xaa0d('0x1b')]();};}function respondWithResult(_0x49e4b4,_0x1cd684){_0x1cd684=_0x1cd684||0xc8;return function(_0x5ed09b){if(_0x5ed09b){return _0x49e4b4[_0xaa0d('0x1a')](_0x1cd684)[_0xaa0d('0x1c')](_0x5ed09b);}};}function respondWithFilteredResult(_0x1bb6ff,_0xe3b8fb){return function(_0x193082){if(_0x193082){var _0x6623ca=_0x193082[_0xaa0d('0x1d')],_0x46adf7=_0xe3b8fb[_0xaa0d('0x1e')],_0x4cb70e=_0xe3b8fb['offset']+_0xe3b8fb[_0xaa0d('0x1f')],_0x166f98;if(_0x4cb70e>=_0x6623ca){_0x4cb70e=_0x6623ca;_0x166f98=0xc8;}else{_0x166f98=0xce;}_0x1bb6ff[_0xaa0d('0x1a')](_0x166f98);return _0x1bb6ff[_0xaa0d('0x20')](_0xaa0d('0x21'),_0x46adf7+'-'+_0x4cb70e+'/'+_0x6623ca)[_0xaa0d('0x1c')](_0x193082);}return null;};}function patchUpdates(_0xa339f9){return function(_0x28b6d8){try{jsonpatch['apply'](_0x28b6d8,_0xa339f9,!![]);}catch(_0x34a083){return BPromise[_0xaa0d('0x22')](_0x34a083);}return _0x28b6d8[_0xaa0d('0x23')]();};}function saveUpdates(_0x36a333,_0x17d08f){return function(_0x499415){if(_0x499415){return _0x499415[_0xaa0d('0x24')](_0x36a333)[_0xaa0d('0x25')](function(_0x1bcad1){return _0x1bcad1;});}return null;};}function removeEntity(_0x3db58d,_0x39ee43){return function(_0x1e8fa4){if(_0x1e8fa4){return _0x1e8fa4[_0xaa0d('0x26')]()[_0xaa0d('0x25')](function(){_0x3db58d[_0xaa0d('0x1a')](0xcc)[_0xaa0d('0x1b')]();});}};}function handleEntityNotFound(_0x5bdc9f,_0x368390){return function(_0x21b7fb){if(!_0x21b7fb){_0x5bdc9f['sendStatus'](0x194);}return _0x21b7fb;};}function handleError(_0x186ce4,_0x19f92d){_0x19f92d=_0x19f92d||0x1f4;return function(_0x7aefe5){logger['error'](_0x7aefe5[_0xaa0d('0x27')]);if(_0x7aefe5[_0xaa0d('0x28')]){delete _0x7aefe5[_0xaa0d('0x28')];}_0x186ce4[_0xaa0d('0x1a')](_0x19f92d)['send'](_0x7aefe5);};}exports[_0xaa0d('0x29')]=function(_0x52e381,_0x272ae0){var _0x5cf8d5={},_0x4fe659={},_0x32c0b2={'count':0x0,'rows':[]};var _0x445943=_[_0xaa0d('0x2a')](db['FaxQueueReport'][_0xaa0d('0x2b')],function(_0x5b4f71){return{'name':_0x5b4f71['fieldName'],'type':_0x5b4f71[_0xaa0d('0x2c')][_0xaa0d('0x2d')]};});_0x4fe659[_0xaa0d('0x2e')]=_['map'](_0x445943,_0xaa0d('0x28'));_0x4fe659[_0xaa0d('0x2f')]=_[_0xaa0d('0x30')](_0x52e381['query']);_0x4fe659[_0xaa0d('0x31')]=_[_0xaa0d('0x32')](_0x4fe659['model'],_0x4fe659['query']);_0x5cf8d5[_0xaa0d('0x33')]=_[_0xaa0d('0x32')](_0x4fe659[_0xaa0d('0x2e')],qs[_0xaa0d('0x34')](_0x52e381[_0xaa0d('0x2f')][_0xaa0d('0x34')]));_0x5cf8d5['attributes']=_0x5cf8d5[_0xaa0d('0x33')][_0xaa0d('0x35')]?_0x5cf8d5[_0xaa0d('0x33')]:_0x4fe659[_0xaa0d('0x2e')];if(!_0x52e381[_0xaa0d('0x2f')][_0xaa0d('0x36')](_0xaa0d('0x37'))){_0x5cf8d5[_0xaa0d('0x1f')]=qs[_0xaa0d('0x1f')](_0x52e381['query'][_0xaa0d('0x1f')]);_0x5cf8d5['offset']=qs[_0xaa0d('0x1e')](_0x52e381['query'][_0xaa0d('0x1e')]);}_0x5cf8d5['order']=qs[_0xaa0d('0x38')](_0x52e381[_0xaa0d('0x2f')][_0xaa0d('0x38')]);_0x5cf8d5[_0xaa0d('0x39')]=qs[_0xaa0d('0x31')](_[_0xaa0d('0x3a')](_0x52e381[_0xaa0d('0x2f')],_0x4fe659[_0xaa0d('0x31')]),_0x445943);if(_0x52e381[_0xaa0d('0x2f')][_0xaa0d('0x3b')]){_0x5cf8d5[_0xaa0d('0x39')]=_[_0xaa0d('0x3c')](_0x5cf8d5[_0xaa0d('0x39')],{'$or':_[_0xaa0d('0x2a')](_0x445943,function(_0x507fdb){if(_0x507fdb[_0xaa0d('0x2c')]!=='VIRTUAL'){var _0x3ca6ef={};_0x3ca6ef[_0x507fdb['name']]={'$like':'%'+_0x52e381[_0xaa0d('0x2f')][_0xaa0d('0x3b')]+'%'};return _0x3ca6ef;}})});}_0x5cf8d5=_['merge']({},_0x5cf8d5,_0x52e381[_0xaa0d('0x3d')]);var _0x4529fd={'where':_0x5cf8d5[_0xaa0d('0x39')]};return db[_0xaa0d('0x3e')][_0xaa0d('0x1d')](_0x4529fd)['then'](function(_0x1301f0){_0x32c0b2[_0xaa0d('0x1d')]=_0x1301f0;if(_0x52e381[_0xaa0d('0x2f')][_0xaa0d('0x3f')]){_0x5cf8d5[_0xaa0d('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xaa0d('0x41')](_0x5cf8d5);})[_0xaa0d('0x25')](function(_0xbb7630){_0x32c0b2['rows']=_0xbb7630;return _0x32c0b2;})[_0xaa0d('0x25')](respondWithFilteredResult(_0x272ae0,_0x5cf8d5))[_0xaa0d('0x42')](handleError(_0x272ae0,null));};exports[_0xaa0d('0x43')]=function(_0x32df67,_0x3ad705){var _0x1d9f0d={'raw':!![],'where':{'id':_0x32df67['params']['id']}},_0xac6c1f={};_0xac6c1f[_0xaa0d('0x2e')]=_[_0xaa0d('0x30')](db[_0xaa0d('0x3e')][_0xaa0d('0x2b')]);_0xac6c1f[_0xaa0d('0x2f')]=_[_0xaa0d('0x30')](_0x32df67['query']);_0xac6c1f[_0xaa0d('0x31')]=_[_0xaa0d('0x32')](_0xac6c1f[_0xaa0d('0x2e')],_0xac6c1f[_0xaa0d('0x2f')]);_0x1d9f0d[_0xaa0d('0x33')]=_[_0xaa0d('0x32')](_0xac6c1f[_0xaa0d('0x2e')],qs[_0xaa0d('0x34')](_0x32df67[_0xaa0d('0x2f')][_0xaa0d('0x34')]));_0x1d9f0d[_0xaa0d('0x33')]=_0x1d9f0d['attributes']['length']?_0x1d9f0d[_0xaa0d('0x33')]:_0xac6c1f['model'];if(_0x32df67[_0xaa0d('0x2f')][_0xaa0d('0x3f')]){_0x1d9f0d[_0xaa0d('0x40')]=[{'all':!![]}];}_0x1d9f0d=_[_0xaa0d('0x3c')]({},_0x1d9f0d,_0x32df67[_0xaa0d('0x3d')]);return db[_0xaa0d('0x3e')][_0xaa0d('0x44')](_0x1d9f0d)[_0xaa0d('0x25')](handleEntityNotFound(_0x3ad705,null))['then'](respondWithResult(_0x3ad705,null))['catch'](handleError(_0x3ad705,null));};exports[_0xaa0d('0x45')]=function(_0x2a0566,_0x3e48ee){return db[_0xaa0d('0x3e')][_0xaa0d('0x45')](_0x2a0566[_0xaa0d('0x46')],{})[_0xaa0d('0x25')](respondWithResult(_0x3e48ee,0xc9))[_0xaa0d('0x42')](handleError(_0x3e48ee,null));};exports['update']=function(_0x3d1ceb,_0x1d2a7a){if(_0x3d1ceb[_0xaa0d('0x46')]['id']){delete _0x3d1ceb['body']['id'];}return db[_0xaa0d('0x3e')][_0xaa0d('0x44')]({'where':{'id':_0x3d1ceb[_0xaa0d('0x47')]['id']}})[_0xaa0d('0x25')](handleEntityNotFound(_0x1d2a7a,null))[_0xaa0d('0x25')](saveUpdates(_0x3d1ceb[_0xaa0d('0x46')],null))[_0xaa0d('0x25')](respondWithResult(_0x1d2a7a,null))[_0xaa0d('0x42')](handleError(_0x1d2a7a,null));};exports['destroy']=function(_0x28293d,_0x2fa34c){return db[_0xaa0d('0x3e')][_0xaa0d('0x44')]({'where':{'id':_0x28293d[_0xaa0d('0x47')]['id']}})[_0xaa0d('0x25')](handleEntityNotFound(_0x2fa34c,null))['then'](removeEntity(_0x2fa34c,null))[_0xaa0d('0x42')](handleError(_0x2fa34c,null));};exports[_0xaa0d('0x48')]=function(_0x3c1aaa,_0x496ce9){return db[_0xaa0d('0x3e')][_0xaa0d('0x48')]()[_0xaa0d('0x25')](respondWithResult(_0x496ce9,null))[_0xaa0d('0x42')](handleError(_0x496ce9,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e61d154..69c286f 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 _0xd89e=['rimraf','../../config/environment','exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x5e122a,_0x276c3b){var _0x2b095f=function(_0x3859fc){while(--_0x3859fc){_0x5e122a['push'](_0x5e122a['shift']());}};_0x2b095f(++_0x276c3b);}(_0xd89e,0xa0));var _0xed89=function(_0x5685f9,_0x179de6){_0x5685f9=_0x5685f9-0x0;var _0x350147=_0xd89e[_0x5685f9];return _0x350147;};'use strict';var _=require(_0xed89('0x0'));var util=require(_0xed89('0x1'));var logger=require(_0xed89('0x2'))(_0xed89('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xed89('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed89('0x5'));var config=require(_0xed89('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xed89('0x7')]=function(_0x4d5407,_0x1712b4){return _0x4d5407[_0xed89('0x8')]('FaxQueueReport',attributes,{'tableName':_0xed89('0x9'),'paranoid':![],'indexes':[{'name':_0xed89('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x360f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid'];(function(_0x17c567,_0x1ee724){var _0x1cd811=function(_0x25d7e1){while(--_0x25d7e1){_0x17c567['push'](_0x17c567['shift']());}};_0x1cd811(++_0x1ee724);}(_0x360f,0x150));var _0xf360=function(_0x5e2022,_0x342f42){_0x5e2022=_0x5e2022-0x0;var _0x4e46d8=_0x360f[_0x5e2022];return _0x4e46d8;};'use strict';var _=require(_0xf360('0x0'));var util=require(_0xf360('0x1'));var logger=require(_0xf360('0x2'))(_0xf360('0x3'));var moment=require('moment');var BPromise=require(_0xf360('0x4'));var rp=require(_0xf360('0x5'));var fs=require('fs');var path=require(_0xf360('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf360('0x7'));module[_0xf360('0x8')]=function(_0xfcf437,_0x4726af){return _0xfcf437[_0xf360('0x9')]('FaxQueueReport',attributes,{'tableName':_0xf360('0xa'),'paranoid':![],'indexes':[{'name':_0xf360('0xb'),'fields':[_0xf360('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8007e8f..83801fe 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 _0x3821=['error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x3821,0x12e));var _0x1382=function(_0x161dd3,_0x212902){_0x161dd3=_0x161dd3-0x0;var _0x164902=_0x3821[_0x161dd3];return _0x164902;};'use strict';var _=require('lodash');var util=require(_0x1382('0x0'));var moment=require(_0x1382('0x1'));var BPromise=require(_0x1382('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1382('0x3'));var db=require(_0x1382('0x4'))['db'];var utils=require(_0x1382('0x5'));var logger=require('../../config/logger')(_0x1382('0x6'));var config=require(_0x1382('0x7'));var jayson=require(_0x1382('0x8'));var client=jayson['client'][_0x1382('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x268738,_0x54dc5b,_0x5079f0){return new BPromise(function(_0x3af837,_0x1d2729){return client[_0x1382('0xa')](_0x268738,_0x5079f0)[_0x1382('0xb')](function(_0x5ce8e7){logger[_0x1382('0xc')](_0x1382('0xd'),_0x54dc5b,'request\x20sent');logger[_0x1382('0xe')](_0x1382('0xf'),_0x54dc5b,_0x1382('0x10'),JSON[_0x1382('0x11')](_0x5ce8e7));if(_0x5ce8e7[_0x1382('0x12')]){if(_0x5ce8e7[_0x1382('0x12')][_0x1382('0x13')]===0x1f4){logger[_0x1382('0x12')](_0x1382('0xd'),_0x54dc5b,_0x5ce8e7[_0x1382('0x12')][_0x1382('0x14')]);return _0x1d2729(_0x5ce8e7['error'][_0x1382('0x14')]);}logger[_0x1382('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x54dc5b,_0x5ce8e7['error']['message']);return _0x3af837(_0x5ce8e7[_0x1382('0x12')][_0x1382('0x14')]);}else{logger['info'](_0x1382('0xd'),_0x54dc5b,_0x1382('0x10'));_0x3af837(_0x5ce8e7['result'][_0x1382('0x14')]);}})[_0x1382('0x15')](function(_0xdbe448){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x54dc5b,_0xdbe448);_0x1d2729(_0xdbe448);});});}exports[_0x1382('0x16')]=function(_0x1c49dd){var _0x4a65a7=this;return new Promise(function(_0x477f0c,_0x1f2525){return db[_0x1382('0x17')]['create'](_0x1c49dd[_0x1382('0x18')],{'raw':_0x1c49dd[_0x1382('0x19')]?_0x1c49dd[_0x1382('0x19')][_0x1382('0x1a')]===undefined?!![]:![]:!![]})[_0x1382('0xb')](function(_0x5e4580){logger[_0x1382('0xc')](_0x1382('0x16'),_0x1c49dd);logger['debug'](_0x1382('0x16'),_0x1c49dd,JSON['stringify'](_0x5e4580));_0x477f0c(_0x5e4580);})[_0x1382('0x15')](function(_0x2c0e83){logger[_0x1382('0x12')](_0x1382('0x16'),_0x2c0e83[_0x1382('0x14')],_0x1c49dd);_0x1f2525(_0x4a65a7[_0x1382('0x12')](0x1f4,_0x2c0e83[_0x1382('0x14')]));});});};exports[_0x1382('0x1b')]=function(_0x409694){var _0x33f8f6=this;return new Promise(function(_0x1052c9,_0x251c9b){return db['FaxQueueReport'][_0x1382('0x1c')](_0x409694[_0x1382('0x18')],{'raw':_0x409694[_0x1382('0x19')]?_0x409694[_0x1382('0x19')][_0x1382('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x409694[_0x1382('0x19')]?_0x409694[_0x1382('0x19')][_0x1382('0x1d')]||null:null,'attributes':_0x409694[_0x1382('0x19')]?_0x409694['options'][_0x1382('0x1e')]||null:null,'limit':_0x409694[_0x1382('0x19')]?_0x409694[_0x1382('0x19')][_0x1382('0x1f')]||null:null})['then'](function(_0x147598){logger['info'](_0x1382('0x1b'),_0x409694);logger['debug'](_0x1382('0x1b'),_0x409694,JSON['stringify'](_0x147598));_0x1052c9(_0x147598);})[_0x1382('0x15')](function(_0x53019c){logger[_0x1382('0x12')](_0x1382('0x1b'),_0x53019c[_0x1382('0x14')],_0x409694);_0x251c9b(_0x33f8f6[_0x1382('0x12')](0x1f4,_0x53019c[_0x1382('0x14')]));});});}; \ No newline at end of file +var _0xd2a7=['then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','debug','UpdateFaxQueueReport','update','raw','attributes','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a6ddb,_0x49cfd3){var _0x56dfd9=function(_0x1db8f7){while(--_0x1db8f7){_0x2a6ddb['push'](_0x2a6ddb['shift']());}};_0x56dfd9(++_0x49cfd3);}(_0xd2a7,0x1a8));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d2a('0x0'));var util=require(_0x7d2a('0x1'));var moment=require(_0x7d2a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7d2a('0x3'))(_0x7d2a('0x4'));var config=require(_0x7d2a('0x5'));var jayson=require(_0x7d2a('0x6'));var client=jayson[_0x7d2a('0x7')][_0x7d2a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb290a0,_0x22088f,_0x311946){return new BPromise(function(_0x510109,_0x1b45c8){return client[_0x7d2a('0x9')](_0xb290a0,_0x311946)[_0x7d2a('0xa')](function(_0xefff51){logger['info'](_0x7d2a('0xb'),_0x22088f,_0x7d2a('0xc'));logger['debug'](_0x7d2a('0xd'),_0x22088f,'request\x20sent',JSON[_0x7d2a('0xe')](_0xefff51));if(_0xefff51[_0x7d2a('0xf')]){if(_0xefff51[_0x7d2a('0xf')][_0x7d2a('0x10')]===0x1f4){logger['error'](_0x7d2a('0xb'),_0x22088f,_0xefff51[_0x7d2a('0xf')]['message']);return _0x1b45c8(_0xefff51[_0x7d2a('0xf')][_0x7d2a('0x11')]);}logger[_0x7d2a('0xf')](_0x7d2a('0xb'),_0x22088f,_0xefff51[_0x7d2a('0xf')][_0x7d2a('0x11')]);return _0x510109(_0xefff51[_0x7d2a('0xf')][_0x7d2a('0x11')]);}else{logger[_0x7d2a('0x12')](_0x7d2a('0xb'),_0x22088f,_0x7d2a('0xc'));_0x510109(_0xefff51[_0x7d2a('0x13')][_0x7d2a('0x11')]);}})[_0x7d2a('0x14')](function(_0x5421b1){logger[_0x7d2a('0xf')](_0x7d2a('0xb'),_0x22088f,_0x5421b1);_0x1b45c8(_0x5421b1);});});}exports[_0x7d2a('0x15')]=function(_0x2d7f3d){var _0xc04e96=this;return new Promise(function(_0x29d51e,_0x236be0){return db[_0x7d2a('0x16')][_0x7d2a('0x17')](_0x2d7f3d[_0x7d2a('0x18')],{'raw':_0x2d7f3d[_0x7d2a('0x19')]?_0x2d7f3d[_0x7d2a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7d2a('0xa')](function(_0x358d43){logger[_0x7d2a('0x12')](_0x7d2a('0x15'),_0x2d7f3d);logger[_0x7d2a('0x1a')](_0x7d2a('0x15'),_0x2d7f3d,JSON[_0x7d2a('0xe')](_0x358d43));_0x29d51e(_0x358d43);})['catch'](function(_0x3c8f45){logger[_0x7d2a('0xf')](_0x7d2a('0x15'),_0x3c8f45[_0x7d2a('0x11')],_0x2d7f3d);_0x236be0(_0xc04e96[_0x7d2a('0xf')](0x1f4,_0x3c8f45[_0x7d2a('0x11')]));});});};exports[_0x7d2a('0x1b')]=function(_0x2f7bf9){var _0x45be0f=this;return new Promise(function(_0x272095,_0x514e41){return db[_0x7d2a('0x16')][_0x7d2a('0x1c')](_0x2f7bf9[_0x7d2a('0x18')],{'raw':_0x2f7bf9[_0x7d2a('0x19')]?_0x2f7bf9[_0x7d2a('0x19')][_0x7d2a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7bf9['options']?_0x2f7bf9['options']['where']||null:null,'attributes':_0x2f7bf9[_0x7d2a('0x19')]?_0x2f7bf9[_0x7d2a('0x19')][_0x7d2a('0x1e')]||null:null,'limit':_0x2f7bf9[_0x7d2a('0x19')]?_0x2f7bf9[_0x7d2a('0x19')]['limit']||null:null})[_0x7d2a('0xa')](function(_0x3eac3f){logger[_0x7d2a('0x12')](_0x7d2a('0x1b'),_0x2f7bf9);logger[_0x7d2a('0x1a')](_0x7d2a('0x1b'),_0x2f7bf9,JSON[_0x7d2a('0xe')](_0x3eac3f));_0x272095(_0x3eac3f);})[_0x7d2a('0x14')](function(_0x4dec0b){logger[_0x7d2a('0xf')](_0x7d2a('0x1b'),_0x4dec0b[_0x7d2a('0x11')],_0x2f7bf9);_0x514e41(_0x45be0f[_0x7d2a('0xf')](0x1f4,_0x4dec0b[_0x7d2a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index cce55be..0fe1ac5 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 _0xb809=['express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x46e3a4,_0x33a4fe){var _0x1c647b=function(_0x335ed2){while(--_0x335ed2){_0x46e3a4['push'](_0x46e3a4['shift']());}};_0x1c647b(++_0x33a4fe);}(_0xb809,0x13c));var _0x9b80=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xb809[_0x456bd2];return _0x2218c1;};'use strict';var multer=require(_0x9b80('0x0'));var util=require(_0x9b80('0x1'));var path=require(_0x9b80('0x2'));var timeout=require(_0x9b80('0x3'));var express=require(_0x9b80('0x4'));var router=express[_0x9b80('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b80('0x6'));var config=require(_0x9b80('0x7'));var controller=require(_0x9b80('0x8'));router[_0x9b80('0x9')]('/',auth[_0x9b80('0xa')](),controller[_0x9b80('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9b80('0xc')]);router['get'](_0x9b80('0xd'),auth[_0x9b80('0xa')](),controller[_0x9b80('0xe')]);router[_0x9b80('0xf')]('/',auth[_0x9b80('0xa')](),controller['create']);router[_0x9b80('0x10')](_0x9b80('0xd'),auth[_0x9b80('0xa')](),controller['update']);router[_0x9b80('0x11')](_0x9b80('0xd'),auth[_0x9b80('0xa')](),controller[_0x9b80('0x12')]);module[_0x9b80('0x13')]=router; \ No newline at end of file +var _0x6545=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','put','delete','exports','multer','util','path'];(function(_0x34d8a1,_0x4e9d8f){var _0x11b1ce=function(_0x4ac29e){while(--_0x4ac29e){_0x34d8a1['push'](_0x34d8a1['shift']());}};_0x11b1ce(++_0x4e9d8f);}(_0x6545,0x6d));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5654('0x0'));var util=require(_0x5654('0x1'));var path=require(_0x5654('0x2'));var timeout=require(_0x5654('0x3'));var express=require('express');var router=express[_0x5654('0x4')]();var auth=require(_0x5654('0x5'));var interaction=require(_0x5654('0x6'));var config=require(_0x5654('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x5654('0x8')](),controller['index']);router['get'](_0x5654('0x9'),auth[_0x5654('0x8')](),controller[_0x5654('0xa')]);router[_0x5654('0xb')](_0x5654('0xc'),auth[_0x5654('0x8')](),controller['show']);router['post']('/',auth[_0x5654('0x8')](),controller['create']);router[_0x5654('0xd')]('/:id',auth[_0x5654('0x8')](),controller['update']);router[_0x5654('0xe')](_0x5654('0xc'),auth[_0x5654('0x8')](),controller['destroy']);module[_0x5654('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4e83418..80d202f 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 _0x5884=['ENUM','agent','queue','NOW','moment','sequelize','STRING'];(function(_0x4c5ef1,_0x488dbb){var _0x45f294=function(_0xc0cc1e){while(--_0xc0cc1e){_0x4c5ef1['push'](_0x4c5ef1['shift']());}};_0x45f294(++_0x488dbb);}(_0x5884,0x74));var _0x4588=function(_0x251dcc,_0x5be1a7){_0x251dcc=_0x251dcc-0x0;var _0x40589a=_0x5884[_0x251dcc];return _0x40589a;};'use strict';var moment=require(_0x4588('0x0'));var Sequelize=require(_0x4588('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4588('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4588('0x3')]('account',_0x4588('0x4'),'queue'),'allowNull':![],'defaultValue':_0x4588('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4588('0x6')]}}; \ No newline at end of file +var _0xc55c=['sequelize','STRING','ENUM','account','agent','queue','NOW','moment'];(function(_0x19e8c2,_0x23c75){var _0x2eaf5d=function(_0x1b6470){while(--_0x1b6470){_0x19e8c2['push'](_0x19e8c2['shift']());}};_0x2eaf5d(++_0x23c75);}(_0xc55c,0x1af));var _0xcc55=function(_0x5568fc,_0x579078){_0x5568fc=_0x5568fc-0x0;var _0x8b2704=_0xc55c[_0x5568fc];return _0x8b2704;};'use strict';var moment=require(_0xcc55('0x0'));var Sequelize=require(_0xcc55('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcc55('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc55('0x3')](_0xcc55('0x4'),_0xcc55('0x5'),_0xcc55('0x6')),'allowNull':![],'defaultValue':_0xcc55('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xcc55('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 60fb5ef..b6c7297 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 _0xadb5=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','describe','eml-format','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack','name','send','index'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xadb5,0xad));var _0x5adb=function(_0x3e6069,_0x225230){_0x3e6069=_0x3e6069-0x0;var _0xf882e6=_0xadb5[_0x3e6069];return _0xf882e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]),_0x36459b);if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['FaxTransferReport'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));};exports[_0x5adb('0x46')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x39')][_0x5adb('0x46')]()[_0x5adb('0x22')](respondWithResult(_0x2402a3,null))[_0x5adb('0x3c')](handleError(_0x2402a3,null));}; \ No newline at end of file +var _0xadb5=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','describe','eml-format','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack','name','send','index'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xadb5,0xad));var _0x5adb=function(_0x5ed12b,_0x7d1c76){_0x5ed12b=_0x5ed12b-0x0;var _0x2fc0c4=_0xadb5[_0x5ed12b];return _0x2fc0c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]),_0x36459b);if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['FaxTransferReport'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));};exports[_0x5adb('0x46')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x39')][_0x5adb('0x46')]()[_0x5adb('0x22')](respondWithResult(_0x2402a3,null))[_0x5adb('0x3c')](handleError(_0x2402a3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5b65c97..f0b9b11 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 _0x4a1a=['api','moment','rimraf','exports','define','report_fax_transfer','uniqueid','../../config/logger'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x4a1a,0x11f));var _0xa4a1=function(_0x1d2895,_0x1214ef){_0x1d2895=_0x1d2895-0x0;var _0x43364c=_0x4a1a[_0x1d2895];return _0x43364c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4a1('0x0'))(_0xa4a1('0x1'));var moment=require(_0xa4a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa4a1('0x3'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xa4a1('0x4')]=function(_0x58c7b8,_0x6284e3){return _0x58c7b8[_0xa4a1('0x5')]('FaxTransferReport',attributes,{'tableName':_0xa4a1('0x6'),'paranoid':![],'indexes':[{'name':_0xa4a1('0x7'),'fields':[_0xa4a1('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe500=['../../config/environment','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x26ea1f,_0x12eb55){var _0x5df37f=function(_0x5a7bc3){while(--_0x5a7bc3){_0x26ea1f['push'](_0x26ea1f['shift']());}};_0x5df37f(++_0x12eb55);}(_0xe500,0x67));var _0x0e50=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xe500[_0x5c78d9];return _0x69ae1f;};'use strict';var _=require(_0x0e50('0x0'));var util=require(_0x0e50('0x1'));var logger=require(_0x0e50('0x2'))(_0x0e50('0x3'));var moment=require(_0x0e50('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e50('0x6'));var config=require(_0x0e50('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2f60ab,_0x245dfb){return _0x2f60ab['define'](_0x0e50('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x0e50('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 42ccab1..d5c35f6 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 _0x7019=['error','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x204276,_0x1867a9){var _0x52e94a=function(_0x50c85c){while(--_0x50c85c){_0x204276['push'](_0x204276['shift']());}};_0x52e94a(++_0x1867a9);}(_0x7019,0xb0));var _0x9701=function(_0x50f75d,_0x24d667){_0x50f75d=_0x50f75d-0x0;var _0x460a87=_0x7019[_0x50f75d];return _0x460a87;};'use strict';var _=require('lodash');var util=require(_0x9701('0x0'));var moment=require(_0x9701('0x1'));var BPromise=require(_0x9701('0x2'));var rs=require(_0x9701('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9701('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9701('0x5'));var client=jayson[_0x9701('0x6')][_0x9701('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59b66b,_0x501050,_0x48b9be){return new BPromise(function(_0x253a09,_0x3249c3){return client[_0x9701('0x8')](_0x59b66b,_0x48b9be)[_0x9701('0x9')](function(_0x3267b0){logger['info'](_0x9701('0xa'),_0x501050,_0x9701('0xb'));logger[_0x9701('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x501050,'request\x20sent',JSON[_0x9701('0xd')](_0x3267b0));if(_0x3267b0[_0x9701('0xe')]){if(_0x3267b0[_0x9701('0xe')]['code']===0x1f4){logger['error'](_0x9701('0xa'),_0x501050,_0x3267b0[_0x9701('0xe')][_0x9701('0xf')]);return _0x3249c3(_0x3267b0[_0x9701('0xe')][_0x9701('0xf')]);}logger[_0x9701('0xe')](_0x9701('0xa'),_0x501050,_0x3267b0[_0x9701('0xe')][_0x9701('0xf')]);return _0x253a09(_0x3267b0[_0x9701('0xe')]['message']);}else{logger[_0x9701('0x10')](_0x9701('0xa'),_0x501050,_0x9701('0xb'));_0x253a09(_0x3267b0[_0x9701('0x11')]['message']);}})[_0x9701('0x12')](function(_0x41119f){logger[_0x9701('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x501050,_0x41119f);_0x3249c3(_0x41119f);});});} \ No newline at end of file +var _0xecf1=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xecf1,0x145));var _0x1ecf=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0xecf1[_0x154940];return _0x401409;};'use strict';var _=require(_0x1ecf('0x0'));var util=require(_0x1ecf('0x1'));var moment=require('moment');var BPromise=require(_0x1ecf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ecf('0x3'));var db=require(_0x1ecf('0x4'))['db'];var utils=require(_0x1ecf('0x5'));var logger=require(_0x1ecf('0x6'))(_0x1ecf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ecf('0x8')][_0x1ecf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bd602,_0xb867dd,_0x40c42e){return new BPromise(function(_0x31f3b9,_0x2b9249){return client[_0x1ecf('0xa')](_0x4bd602,_0x40c42e)[_0x1ecf('0xb')](function(_0x21d139){logger[_0x1ecf('0xc')](_0x1ecf('0xd'),_0xb867dd,'request\x20sent');logger[_0x1ecf('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xb867dd,'request\x20sent',JSON[_0x1ecf('0xf')](_0x21d139));if(_0x21d139[_0x1ecf('0x10')]){if(_0x21d139[_0x1ecf('0x10')][_0x1ecf('0x11')]===0x1f4){logger['error'](_0x1ecf('0xd'),_0xb867dd,_0x21d139[_0x1ecf('0x10')][_0x1ecf('0x12')]);return _0x2b9249(_0x21d139['error']['message']);}logger['error'](_0x1ecf('0xd'),_0xb867dd,_0x21d139['error'][_0x1ecf('0x12')]);return _0x31f3b9(_0x21d139[_0x1ecf('0x10')][_0x1ecf('0x12')]);}else{logger[_0x1ecf('0xc')](_0x1ecf('0xd'),_0xb867dd,_0x1ecf('0x13'));_0x31f3b9(_0x21d139[_0x1ecf('0x14')][_0x1ecf('0x12')]);}})[_0x1ecf('0x15')](function(_0x402ada){logger[_0x1ecf('0x10')](_0x1ecf('0xd'),_0xb867dd,_0x402ada);_0x2b9249(_0x402ada);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e39a47d..d2a256c 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 _0x0296=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x57d4ed,_0x41abfd){var _0x593ca9=function(_0x377dec){while(--_0x377dec){_0x57d4ed['push'](_0x57d4ed['shift']());}};_0x593ca9(++_0x41abfd);}(_0x0296,0x8f));var _0x6029=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x0296[_0xad57ee];return _0x3eaea9;};'use strict';var multer=require(_0x6029('0x0'));var util=require(_0x6029('0x1'));var path=require(_0x6029('0x2'));var timeout=require(_0x6029('0x3'));var express=require(_0x6029('0x4'));var router=express[_0x6029('0x5')]();var auth=require(_0x6029('0x6'));var interaction=require(_0x6029('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x6029('0x8')]('/',auth[_0x6029('0x9')](),controller[_0x6029('0xa')]);router[_0x6029('0x8')](_0x6029('0xb'),auth[_0x6029('0x9')](),controller['describe']);router[_0x6029('0x8')](_0x6029('0xc'),auth[_0x6029('0x9')](),controller[_0x6029('0xd')]);router[_0x6029('0xe')]('/',auth[_0x6029('0x9')](),controller[_0x6029('0xf')]);router[_0x6029('0x10')](_0x6029('0xc'),auth['isAuthenticated'](),controller[_0x6029('0x11')]);router[_0x6029('0x12')](_0x6029('0xc'),auth[_0x6029('0x9')](),controller['destroy']);module[_0x6029('0x13')]=router; \ No newline at end of file +var _0x7c94=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','exports','util'];(function(_0x3ae263,_0x4b3519){var _0x25a926=function(_0xc654f2){while(--_0xc654f2){_0x3ae263['push'](_0x3ae263['shift']());}};_0x25a926(++_0x4b3519);}(_0x7c94,0x1b7));var _0x47c9=function(_0x191b2d,_0x2a3125){_0x191b2d=_0x191b2d-0x0;var _0x95be63=_0x7c94[_0x191b2d];return _0x95be63;};'use strict';var multer=require('multer');var util=require(_0x47c9('0x0'));var path=require(_0x47c9('0x1'));var timeout=require(_0x47c9('0x2'));var express=require('express');var router=express[_0x47c9('0x3')]();var auth=require(_0x47c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47c9('0x5'));var controller=require(_0x47c9('0x6'));router['get']('/',auth[_0x47c9('0x7')](),controller[_0x47c9('0x8')]);router[_0x47c9('0x9')](_0x47c9('0xa'),auth['isAuthenticated'](),controller[_0x47c9('0xb')]);router[_0x47c9('0x9')]('/:id',auth[_0x47c9('0x7')](),controller[_0x47c9('0xc')]);router[_0x47c9('0xd')]('/',auth[_0x47c9('0x7')](),controller[_0x47c9('0xe')]);router[_0x47c9('0xf')](_0x47c9('0x10'),auth[_0x47c9('0x7')](),controller[_0x47c9('0x11')]);router[_0x47c9('0x12')](_0x47c9('0x10'),auth[_0x47c9('0x7')](),controller['destroy']);module[_0x47c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2d11a7d..129c283 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 _0xa9b1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','path'];(function(_0x5bad83,_0x5c216d){var _0x1bddfd=function(_0x236e94){while(--_0x236e94){_0x5bad83['push'](_0x5bad83['shift']());}};_0x1bddfd(++_0x5c216d);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var auth=require(_0x1a9b('0x4'));var interaction=require(_0x1a9b('0x5'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x1a9b('0x6')](),controller[_0x1a9b('0x7')]);router[_0x1a9b('0x8')](_0x1a9b('0x9'),auth[_0x1a9b('0x6')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0x8')](_0x1a9b('0xb'),auth[_0x1a9b('0x6')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0x8')](_0x1a9b('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x1a9b('0xe')]('/',auth[_0x1a9b('0x6')](),controller[_0x1a9b('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x1a9b('0x10')]);router[_0x1a9b('0x11')](_0x1a9b('0x9'),auth[_0x1a9b('0x6')](),controller[_0x1a9b('0x12')]);router[_0x1a9b('0x13')]('/:id',auth[_0x1a9b('0x6')](),controller[_0x1a9b('0x14')]);module[_0x1a9b('0x15')]=router; \ No newline at end of file +var _0x31af=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete'];(function(_0x3c817d,_0x3e5da2){var _0x31ad74=function(_0x53b90f){while(--_0x53b90f){_0x3c817d['push'](_0x3c817d['shift']());}};_0x31ad74(++_0x3e5da2);}(_0x31af,0xde));var _0xf31a=function(_0x314eec,_0x523304){_0x314eec=_0x314eec-0x0;var _0x161f34=_0x31af[_0x314eec];return _0x161f34;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf31a('0x4'));var config=require(_0xf31a('0x5'));var controller=require(_0xf31a('0x6'));router[_0xf31a('0x7')]('/',auth['isAuthenticated'](),controller[_0xf31a('0x8')]);router[_0xf31a('0x7')](_0xf31a('0x9'),auth[_0xf31a('0xa')](),controller['show']);router[_0xf31a('0x7')](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller[_0xf31a('0xc')]);router['get'](_0xf31a('0xd'),auth[_0xf31a('0xa')](),controller[_0xf31a('0xe')]);router[_0xf31a('0xf')]('/',auth[_0xf31a('0xa')](),controller['create']);router[_0xf31a('0xf')](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller[_0xf31a('0x10')]);router['put'](_0xf31a('0x9'),auth[_0xf31a('0xa')](),controller['update']);router[_0xf31a('0x11')](_0xf31a('0x9'),auth[_0xf31a('0xa')](),controller[_0xf31a('0x12')]);module[_0xf31a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 9c17121..974ad07 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 _0x1f01=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x3832d8,_0x59a62a){var _0x3308f8=function(_0x1fa198){while(--_0x1fa198){_0x3832d8['push'](_0x3832d8['shift']());}};_0x3308f8(++_0x59a62a);}(_0x1f01,0x1ea));var _0x11f0=function(_0x3db285,_0x2ce3dc){_0x3db285=_0x3db285-0x0;var _0x287478=_0x1f01[_0x3db285];return _0x287478;};'use strict';var Sequelize=require(_0x11f0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x11f0('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x11f0('0x1')]},'authType':{'type':Sequelize[_0x11f0('0x2')](_0x11f0('0x3')),'defaultValue':_0x11f0('0x3')},'password':{'type':Sequelize[_0x11f0('0x1')]},'consumerKey':{'type':Sequelize[_0x11f0('0x1')]},'consumerSecret':{'type':Sequelize[_0x11f0('0x1')]},'token':{'type':Sequelize[_0x11f0('0x1')]},'tokenSecret':{'type':Sequelize[_0x11f0('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x11f0('0x2')](_0x11f0('0x4'),_0x11f0('0x5')),'defaultValue':_0x11f0('0x4')}}; \ No newline at end of file +var _0x1878=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x10a899,_0x54a630){var _0x245803=function(_0x191c5f){while(--_0x191c5f){_0x10a899['push'](_0x10a899['shift']());}};_0x245803(++_0x54a630);}(_0x1878,0x136));var _0x8187=function(_0x525d88,_0x50155f){_0x525d88=_0x525d88-0x0;var _0x578865=_0x1878[_0x525d88];return _0x578865;};'use strict';var Sequelize=require(_0x8187('0x0'));module[_0x8187('0x1')]={'name':{'type':Sequelize[_0x8187('0x2')]},'description':{'type':Sequelize[_0x8187('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8187('0x2')]},'authType':{'type':Sequelize[_0x8187('0x3')]('basic'),'defaultValue':_0x8187('0x4')},'password':{'type':Sequelize[_0x8187('0x2')]},'consumerKey':{'type':Sequelize[_0x8187('0x2')]},'consumerSecret':{'type':Sequelize[_0x8187('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x8187('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8187('0x3')](_0x8187('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b716714..753af84 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 _0x4c8d=['label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','update','findOne','order','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','username','consumerKey','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','headers','Authorization','%s:%s','password','toString','base64','_embedded'];(function(_0x5c6cb2,_0x5b548b){var _0x4da024=function(_0x1fc1c4){while(--_0x1fc1c4){_0x5c6cb2['push'](_0x5c6cb2['shift']());}};_0x4da024(++_0x5b548b);}(_0x4c8d,0xf7));var _0xd4c8=function(_0x33416e,_0x1d8f89){_0x33416e=_0x33416e-0x0;var _0x4e3837=_0x4c8d[_0x33416e];return _0x4e3837;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd4c8('0x0'));var rimraf=require(_0xd4c8('0x1'));var zipdir=require(_0xd4c8('0x2'));var jsonpatch=require(_0xd4c8('0x3'));var rp=require('request-promise');var moment=require(_0xd4c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd4c8('0x5'));var util=require('util');var path=require(_0xd4c8('0x6'));var sox=require(_0xd4c8('0x7'));var csv=require(_0xd4c8('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd4c8('0x9'));var squel=require(_0xd4c8('0xa'));var crypto=require(_0xd4c8('0xb'));var jsforce=require(_0xd4c8('0xc'));var deskjs=require(_0xd4c8('0xd'));var toCsv=require(_0xd4c8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4c8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4c8('0xf'));var logger=require(_0xd4c8('0x10'))(_0xd4c8('0x11'));var utils=require('../../config/utils');var config=require(_0xd4c8('0x12'));var db=require(_0xd4c8('0x13'))['db'];var integrations=require(_0xd4c8('0x14'));var jayson=require(_0xd4c8('0x15'));var client=jayson[_0xd4c8('0x16')][_0xd4c8('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3d2c65,_0x338e15,_0x140793){if(_0x140793){var _0x48727a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48727a['test'](_0x338e15)){return _0x3d2c65;}else{throw new db[(_0xd4c8('0x18'))][(_0xd4c8('0x19'))](_0xd4c8('0x1a'));}}else{return _0x3d2c65;}}function respondWithRpcPromise(_0x56f174,_0x16ce98,_0x4ae084,_0x3ec56b){return new BPromise(function(_0x2b9dcb,_0x2969e9){var _0x32b483=_0x3ec56b||client;return _0x32b483[_0xd4c8('0x1b')](_0x56f174,_0x4ae084)[_0xd4c8('0x1c')](function(_0x2347c9){logger[_0xd4c8('0x1d')](_0xd4c8('0x1e'),_0x16ce98,_0xd4c8('0x1f'));logger['debug'](_0xd4c8('0x20'),_0x16ce98,_0xd4c8('0x1f'),JSON[_0xd4c8('0x21')](_0x2347c9));if(_0x2347c9[_0xd4c8('0x22')]){if(_0x2347c9[_0xd4c8('0x22')]['code']===0x1f4){logger[_0xd4c8('0x22')](_0xd4c8('0x1e'),_0x16ce98,_0x2347c9[_0xd4c8('0x22')]['message']);return _0x2969e9(_0x2347c9[_0xd4c8('0x22')][_0xd4c8('0x23')]);}logger['error'](_0xd4c8('0x1e'),_0x16ce98,_0x2347c9[_0xd4c8('0x22')][_0xd4c8('0x23')]);return _0x2b9dcb(_0x2347c9['error'][_0xd4c8('0x23')]);}else{logger[_0xd4c8('0x1d')](_0xd4c8('0x1e'),_0x16ce98,_0xd4c8('0x1f'));_0x2b9dcb(_0x2347c9[_0xd4c8('0x24')]['message']);}})[_0xd4c8('0x25')](function(_0x5afe99){logger[_0xd4c8('0x22')](_0xd4c8('0x1e'),_0x16ce98,_0x5afe99);_0x2969e9(_0x5afe99);});});}function respondWithStatusCode(_0x377947,_0x3f7726){_0x3f7726=_0x3f7726||0xcc;return function(_0x111b17){if(_0x111b17){return _0x377947['sendStatus'](_0x3f7726);}return _0x377947['status'](_0x3f7726)['end']();};}function respondWithResult(_0x4d639e,_0xc65665){_0xc65665=_0xc65665||0xc8;return function(_0x2d96b7){if(_0x2d96b7){return _0x4d639e[_0xd4c8('0x26')](_0xc65665)[_0xd4c8('0x27')](_0x2d96b7);}};}function respondWithFilteredResult(_0xea6681,_0x224988){return function(_0x576ab8){if(_0x576ab8){var _0x7344e=_0x576ab8[_0xd4c8('0x28')],_0x24501e=_0x224988[_0xd4c8('0x29')],_0x51bc14=_0x224988[_0xd4c8('0x29')]+_0x224988[_0xd4c8('0x2a')],_0x343af8;if(_0x51bc14>=_0x7344e){_0x51bc14=_0x7344e;_0x343af8=0xc8;}else{_0x343af8=0xce;}_0xea6681[_0xd4c8('0x26')](_0x343af8);return _0xea6681[_0xd4c8('0x2b')](_0xd4c8('0x2c'),_0x24501e+'-'+_0x51bc14+'/'+_0x7344e)[_0xd4c8('0x27')](_0x576ab8);}return null;};}function patchUpdates(_0x533547){return function(_0x159619){try{jsonpatch[_0xd4c8('0x2d')](_0x159619,_0x533547,!![]);}catch(_0x3efad1){return BPromise[_0xd4c8('0x2e')](_0x3efad1);}return _0x159619[_0xd4c8('0x2f')]();};}function saveUpdates(_0x2c33e6,_0x25e66b){return function(_0x26b4ba){if(_0x26b4ba){return _0x26b4ba['update'](_0x2c33e6)[_0xd4c8('0x1c')](function(_0x4ca947){return _0x4ca947;});}return null;};}function removeEntity(_0x571f01,_0x40ebe0){return function(_0x3de27f){if(_0x3de27f){return _0x3de27f[_0xd4c8('0x30')]()[_0xd4c8('0x1c')](function(){_0x571f01[_0xd4c8('0x26')](0xcc)[_0xd4c8('0x31')]();});}};}function handleEntityNotFound(_0x36d0a7,_0x21bdc1){return function(_0x3163da){if(!_0x3163da){_0x36d0a7[_0xd4c8('0x32')](0x194);}return _0x3163da;};}function handleError(_0x1e1507,_0x454a5b){_0x454a5b=_0x454a5b||0x1f4;return function(_0x420a91){logger[_0xd4c8('0x22')](_0x420a91[_0xd4c8('0x33')]);if(_0x420a91[_0xd4c8('0x34')]){delete _0x420a91['name'];}_0x1e1507[_0xd4c8('0x26')](_0x454a5b)[_0xd4c8('0x35')](_0x420a91);};}exports[_0xd4c8('0x36')]=function(_0x5c87dd,_0x3aa27f){var _0x2f975d={},_0x1cdf86={},_0xd8274={'count':0x0,'rows':[]};var _0x498dfb=_['map'](db[_0xd4c8('0x37')][_0xd4c8('0x38')],function(_0x4bd700){return{'name':_0x4bd700['fieldName'],'type':_0x4bd700[_0xd4c8('0x39')][_0xd4c8('0x3a')]};});_0x1cdf86[_0xd4c8('0x3b')]=_[_0xd4c8('0x3c')](_0x498dfb,'name');_0x1cdf86['query']=_[_0xd4c8('0x3d')](_0x5c87dd['query']);_0x1cdf86[_0xd4c8('0x3e')]=_[_0xd4c8('0x3f')](_0x1cdf86['model'],_0x1cdf86[_0xd4c8('0x40')]);_0x2f975d[_0xd4c8('0x41')]=_[_0xd4c8('0x3f')](_0x1cdf86[_0xd4c8('0x3b')],qs['fields'](_0x5c87dd[_0xd4c8('0x40')][_0xd4c8('0x42')]));_0x2f975d[_0xd4c8('0x41')]=_0x2f975d[_0xd4c8('0x41')][_0xd4c8('0x43')]?_0x2f975d[_0xd4c8('0x41')]:_0x1cdf86['model'];if(!_0x5c87dd[_0xd4c8('0x40')][_0xd4c8('0x44')](_0xd4c8('0x45'))){_0x2f975d[_0xd4c8('0x2a')]=qs[_0xd4c8('0x2a')](_0x5c87dd[_0xd4c8('0x40')][_0xd4c8('0x2a')]);_0x2f975d[_0xd4c8('0x29')]=qs[_0xd4c8('0x29')](_0x5c87dd[_0xd4c8('0x40')][_0xd4c8('0x29')]);}_0x2f975d['order']=qs[_0xd4c8('0x46')](_0x5c87dd['query'][_0xd4c8('0x46')]);_0x2f975d['where']=qs[_0xd4c8('0x3e')](_[_0xd4c8('0x47')](_0x5c87dd[_0xd4c8('0x40')],_0x1cdf86[_0xd4c8('0x3e')]),_0x498dfb);if(_0x5c87dd[_0xd4c8('0x40')][_0xd4c8('0x48')]){_0x2f975d[_0xd4c8('0x49')]=_[_0xd4c8('0x4a')](_0x2f975d['where'],{'$or':_['map'](_0x498dfb,function(_0x50069c){if(_0x50069c[_0xd4c8('0x39')]!==_0xd4c8('0x4b')){var _0x285506={};_0x285506[_0x50069c['name']]={'$like':'%'+_0x5c87dd[_0xd4c8('0x40')]['filter']+'%'};return _0x285506;}})});}_0x2f975d=_[_0xd4c8('0x4a')]({},_0x2f975d,_0x5c87dd[_0xd4c8('0x4c')]);var _0x4d81a4={'where':_0x2f975d[_0xd4c8('0x49')]};return db[_0xd4c8('0x37')]['count'](_0x4d81a4)[_0xd4c8('0x1c')](function(_0x36c6e4){_0xd8274['count']=_0x36c6e4;if(_0x5c87dd[_0xd4c8('0x40')][_0xd4c8('0x4d')]){_0x2f975d[_0xd4c8('0x4e')]=[{'all':!![]}];}return db[_0xd4c8('0x37')]['findAll'](_0x2f975d);})[_0xd4c8('0x1c')](function(_0x20ec86){_0xd8274[_0xd4c8('0x4f')]=_0x20ec86;return _0xd8274;})[_0xd4c8('0x1c')](respondWithFilteredResult(_0x3aa27f,_0x2f975d))['catch'](handleError(_0x3aa27f,null));};exports[_0xd4c8('0x50')]=function(_0x2d1b3c,_0x39c4c0){var _0x1673c8={'raw':![],'where':{'id':_0x2d1b3c[_0xd4c8('0x51')]['id']}},_0x4a7ac7={};_0x4a7ac7[_0xd4c8('0x3b')]=_['keys'](db[_0xd4c8('0x37')][_0xd4c8('0x38')]);_0x4a7ac7[_0xd4c8('0x40')]=_['keys'](_0x2d1b3c[_0xd4c8('0x40')]);_0x4a7ac7['filters']=_[_0xd4c8('0x3f')](_0x4a7ac7[_0xd4c8('0x3b')],_0x4a7ac7[_0xd4c8('0x40')]);_0x1673c8[_0xd4c8('0x41')]=_[_0xd4c8('0x3f')](_0x4a7ac7['model'],qs[_0xd4c8('0x42')](_0x2d1b3c[_0xd4c8('0x40')]['fields']));_0x1673c8[_0xd4c8('0x41')]=_0x1673c8[_0xd4c8('0x41')]['length']?_0x1673c8[_0xd4c8('0x41')]:_0x4a7ac7['model'];if(_0x2d1b3c['query']['includeAll']){_0x1673c8[_0xd4c8('0x4e')]=[{'all':!![]}];}_0x1673c8=_[_0xd4c8('0x4a')]({},_0x1673c8,_0x2d1b3c[_0xd4c8('0x4c')]);return db[_0xd4c8('0x37')][_0xd4c8('0x52')](_0x1673c8)[_0xd4c8('0x1c')](handleEntityNotFound(_0x39c4c0,null))[_0xd4c8('0x1c')](respondWithResult(_0x39c4c0,null))[_0xd4c8('0x25')](handleError(_0x39c4c0,null));};exports['create']=function(_0x596db3,_0x6ef0b8){return db[_0xd4c8('0x37')][_0xd4c8('0x53')](_0x596db3[_0xd4c8('0x54')],{})[_0xd4c8('0x1c')](respondWithResult(_0x6ef0b8,0xc9))['catch'](handleError(_0x6ef0b8,null));};exports[_0xd4c8('0x55')]=function(_0x342f1c,_0x217e93){if(_0x342f1c['body']['id']){delete _0x342f1c[_0xd4c8('0x54')]['id'];}return db['DeskAccount'][_0xd4c8('0x52')]({'where':{'id':_0x342f1c[_0xd4c8('0x51')]['id']}})['then'](handleEntityNotFound(_0x217e93,null))['then'](saveUpdates(_0x342f1c[_0xd4c8('0x54')],null))[_0xd4c8('0x1c')](respondWithResult(_0x217e93,null))[_0xd4c8('0x25')](handleError(_0x217e93,null));};exports[_0xd4c8('0x30')]=function(_0x19cb83,_0x54fb62){return db[_0xd4c8('0x37')][_0xd4c8('0x52')]({'where':{'id':_0x19cb83['params']['id']}})[_0xd4c8('0x1c')](handleEntityNotFound(_0x54fb62,null))[_0xd4c8('0x1c')](removeEntity(_0x54fb62,null))['catch'](handleError(_0x54fb62,null));};exports['getConfigurations']=function(_0x1250d0,_0x290a15,_0x13cb79){var _0x5004ed={};var _0x39b80a={};var _0x43b39d;var _0x34c583;return db[_0xd4c8('0x37')][_0xd4c8('0x56')]({'where':{'id':_0x1250d0[_0xd4c8('0x51')]['id']}})[_0xd4c8('0x1c')](handleEntityNotFound(_0x290a15,null))['then'](function(_0x15cf1c){if(_0x15cf1c){_0x43b39d=_0x15cf1c;_0x39b80a[_0xd4c8('0x3b')]=_[_0xd4c8('0x3d')](db['DeskConfiguration'][_0xd4c8('0x38')]);_0x39b80a[_0xd4c8('0x40')]=_[_0xd4c8('0x3d')](_0x1250d0[_0xd4c8('0x40')]);_0x39b80a[_0xd4c8('0x3e')]=_['intersection'](_0x39b80a[_0xd4c8('0x3b')],_0x39b80a[_0xd4c8('0x40')]);_0x5004ed[_0xd4c8('0x41')]=_[_0xd4c8('0x3f')](_0x39b80a[_0xd4c8('0x3b')],qs['fields'](_0x1250d0['query'][_0xd4c8('0x42')]));_0x5004ed[_0xd4c8('0x41')]=_0x5004ed[_0xd4c8('0x41')][_0xd4c8('0x43')]?_0x5004ed[_0xd4c8('0x41')]:_0x39b80a[_0xd4c8('0x3b')];_0x5004ed[_0xd4c8('0x57')]=qs[_0xd4c8('0x46')](_0x1250d0[_0xd4c8('0x40')][_0xd4c8('0x46')]);_0x5004ed[_0xd4c8('0x49')]=qs[_0xd4c8('0x3e')](_[_0xd4c8('0x47')](_0x1250d0[_0xd4c8('0x40')],_0x39b80a[_0xd4c8('0x3e')]));if(_0x1250d0[_0xd4c8('0x40')][_0xd4c8('0x48')]){_0x5004ed[_0xd4c8('0x49')]=_[_0xd4c8('0x4a')](_0x5004ed[_0xd4c8('0x49')],{'$or':_[_0xd4c8('0x3c')](_0x5004ed[_0xd4c8('0x41')],function(_0x164a8c){var _0x1c3aee={};_0x1c3aee[_0x164a8c]={'$like':'%'+_0x1250d0[_0xd4c8('0x40')][_0xd4c8('0x48')]+'%'};return _0x1c3aee;})});}_0x5004ed=_[_0xd4c8('0x4a')]({},_0x5004ed,_0x1250d0[_0xd4c8('0x4c')]);return _0x43b39d[_0xd4c8('0x58')](_0x5004ed);}})[_0xd4c8('0x1c')](function(_0x4cbaa0){if(_0x4cbaa0){_0x34c583=_0x4cbaa0['length'];if(!_0x1250d0[_0xd4c8('0x40')]['hasOwnProperty']('nolimit')){_0x5004ed[_0xd4c8('0x2a')]=qs['limit'](_0x1250d0['query'][_0xd4c8('0x2a')]);_0x5004ed[_0xd4c8('0x29')]=qs[_0xd4c8('0x29')](_0x1250d0['query'][_0xd4c8('0x29')]);}return _0x43b39d[_0xd4c8('0x58')](_0x5004ed);}})[_0xd4c8('0x1c')](function(_0x37f5fa){if(_0x37f5fa){return _0x37f5fa?{'count':_0x34c583,'rows':_0x37f5fa}:null;}})[_0xd4c8('0x1c')](respondWithResult(_0x290a15,null))[_0xd4c8('0x25')](handleError(_0x290a15,null));};exports[_0xd4c8('0x59')]=function(_0x5f3f62,_0xd3b6a3,_0x27eb2e){if(_0x5f3f62[_0xd4c8('0x54')]['id']){delete _0x5f3f62['body']['id'];}return db['DeskAccount'][_0xd4c8('0x56')]({'where':{'id':_0x5f3f62['params']['id']}})[_0xd4c8('0x1c')](handleEntityNotFound(_0xd3b6a3,null))[_0xd4c8('0x1c')](function(_0x182391){if(_0x182391){_0x5f3f62[_0xd4c8('0x54')][_0xd4c8('0x5a')]=_0x182391['id'];_0x5f3f62['body'][_0xd4c8('0x5b')]=integrations['getSubjects'](_0x5f3f62['body']['channel'],_0x5f3f62[_0xd4c8('0x54')][_0xd4c8('0x39')]);_0x5f3f62['body'][_0xd4c8('0x5c')]=integrations[_0xd4c8('0x5d')](_0x5f3f62['body'][_0xd4c8('0x5e')],_0x5f3f62['body'][_0xd4c8('0x39')]);return db['DeskConfiguration']['create'](_0x5f3f62[_0xd4c8('0x54')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0xd4c8('0x5f')],'as':'Descriptions'}]});}return null;})[_0xd4c8('0x1c')](respondWithResult(_0xd3b6a3,null))[_0xd4c8('0x25')](handleError(_0xd3b6a3,null));};exports[_0xd4c8('0x60')]=function(_0x2dbbf1,_0x5401f7,_0x801283){var _0x49ba9b=[{'name':_0xd4c8('0x61'),'label':_0xd4c8('0x61'),'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 _0xb7ce0e='';return db[_0xd4c8('0x37')][_0xd4c8('0x56')]({'where':{'id':_0x2dbbf1['params']['id']},'attributes':['id',_0xd4c8('0x62'),'authType',_0xd4c8('0x63'),'password',_0xd4c8('0x64'),'consumerSecret',_0xd4c8('0x65'),_0xd4c8('0x66')]})['then'](handleEntityNotFound(_0x5401f7,null))[_0xd4c8('0x1c')](function(_0x4098d9){if(_0x4098d9){_0xb7ce0e=_0x4098d9['remoteUri'];var _0x35d668=_0xb7ce0e['slice'](-0x1);if(_0x35d668==='/'){_0xb7ce0e=_0xb7ce0e[_0xd4c8('0x67')](0x0,_0xb7ce0e[_0xd4c8('0x68')](_0x35d668));}var _0x1ee93b={'method':'GET','uri':util[_0xd4c8('0x69')](_0xd4c8('0x6a'),_0xb7ce0e),'headers':{'Content-Type':_0xd4c8('0x6b'),'Accept':'application/json'},'json':!![]};if(_0x4098d9[_0xd4c8('0x6c')]==='basic'){_0x1ee93b[_0xd4c8('0x6d')][_0xd4c8('0x6e')]=util[_0xd4c8('0x69')]('Basic\x20%s',new Buffer(util[_0xd4c8('0x69')](_0xd4c8('0x6f'),_0x4098d9['username'],_0x4098d9[_0xd4c8('0x70')]))[_0xd4c8('0x71')](_0xd4c8('0x72')));}return rp(_0x1ee93b)[_0xd4c8('0x1c')](function(_0x68b74a){return _0x49ba9b['concat'](_[_0xd4c8('0x3c')](_0x68b74a[_0xd4c8('0x73')]['entries'],function(_0x45765a){return{'id':_0x45765a[_0xd4c8('0x34')],'name':_0x45765a[_0xd4c8('0x34')],'type':_0x45765a[_0xd4c8('0x39')],'active':_0x45765a['active'],'label':_0x45765a[_0xd4c8('0x74')],'custom':!![]};}));});}})[_0xd4c8('0x1c')](function(_0x487fa7){return{'count':_0x487fa7[_0xd4c8('0x43')],'rows':_0x487fa7};})[_0xd4c8('0x1c')](respondWithResult(_0x5401f7,null))[_0xd4c8('0x25')](function(_0x332f05){var _0x200f8a=_0x2dbbf1[_0xd4c8('0x40')][_0xd4c8('0x75')]?0x1f4:_0x332f05[_0xd4c8('0x76')]||0x1f4;logger['error'](_0xd4c8('0x77'),'getFields',_0x200f8a,JSON[_0xd4c8('0x21')](_0x332f05));delete _0x332f05[_0xd4c8('0x34')];if(_0x200f8a===0x191){_0x200f8a=0x190;}_0x5401f7['status'](_0x200f8a)[_0xd4c8('0x35')](_0x2dbbf1[_0xd4c8('0x40')][_0xd4c8('0x75')]?{'message':_0xd4c8('0x78'),'statusCode':_0x332f05[_0xd4c8('0x76')]}:_0x332f05);});}; \ No newline at end of file +var _0xb3bb=['getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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','../../mysqldb','../../components/integrations/configuration','client','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~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','stack','index','DeskAccount','rawAttributes','key','map','name','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','params','findOne','getConfigurations','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskConfiguration','DeskField'];(function(_0x581531,_0x463062){var _0x3e14c3=function(_0x1cb44c){while(--_0x1cb44c){_0x581531['push'](_0x581531['shift']());}};_0x3e14c3(++_0x463062);}(_0xb3bb,0xa2));var _0xbb3b=function(_0x1d7a0e,_0x374fe5){_0x1d7a0e=_0x1d7a0e-0x0;var _0x99716d=_0xb3bb[_0x1d7a0e];return _0x99716d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb3b('0x0'));var rimraf=require(_0xbb3b('0x1'));var zipdir=require(_0xbb3b('0x2'));var jsonpatch=require(_0xbb3b('0x3'));var rp=require('request-promise');var moment=require(_0xbb3b('0x4'));var BPromise=require(_0xbb3b('0x5'));var Mustache=require('mustache');var util=require(_0xbb3b('0x6'));var path=require(_0xbb3b('0x7'));var sox=require('sox');var csv=require(_0xbb3b('0x8'));var ejs=require(_0xbb3b('0x9'));var fs=require('fs');var _=require(_0xbb3b('0xa'));var squel=require(_0xbb3b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb3b('0xc'));var deskjs=require(_0xbb3b('0xd'));var toCsv=require(_0xbb3b('0x8'));var querystring=require(_0xbb3b('0xe'));var Papa=require(_0xbb3b('0xf'));var Redis=require(_0xbb3b('0x10'));var authService=require(_0xbb3b('0x11'));var qs=require(_0xbb3b('0x12'));var as=require(_0xbb3b('0x13'));var hardwareService=require(_0xbb3b('0x14'));var logger=require(_0xbb3b('0x15'))(_0xbb3b('0x16'));var utils=require(_0xbb3b('0x17'));var config=require('../../config/environment');var db=require(_0xbb3b('0x18'))['db'];var integrations=require(_0xbb3b('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xbb3b('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1a791e,_0x21af7f,_0x155767){if(_0x155767){var _0x58fe80=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58fe80['test'](_0x21af7f)){return _0x1a791e;}else{throw new db[(_0xbb3b('0x1b'))][(_0xbb3b('0x1c'))](_0xbb3b('0x1d'));}}else{return _0x1a791e;}}function respondWithRpcPromise(_0x2704f2,_0xb02acc,_0x39da7e,_0x41079d){return new BPromise(function(_0x2fe628,_0x219652){var _0x455e30=_0x41079d||client;return _0x455e30[_0xbb3b('0x1e')](_0x2704f2,_0x39da7e)[_0xbb3b('0x1f')](function(_0x4c6778){logger[_0xbb3b('0x20')](_0xbb3b('0x21'),_0xb02acc,'request\x20sent');logger[_0xbb3b('0x22')](_0xbb3b('0x23'),_0xb02acc,_0xbb3b('0x24'),JSON['stringify'](_0x4c6778));if(_0x4c6778['error']){if(_0x4c6778[_0xbb3b('0x25')][_0xbb3b('0x26')]===0x1f4){logger[_0xbb3b('0x25')](_0xbb3b('0x21'),_0xb02acc,_0x4c6778['error'][_0xbb3b('0x27')]);return _0x219652(_0x4c6778[_0xbb3b('0x25')]['message']);}logger['error'](_0xbb3b('0x21'),_0xb02acc,_0x4c6778[_0xbb3b('0x25')][_0xbb3b('0x27')]);return _0x2fe628(_0x4c6778[_0xbb3b('0x25')]['message']);}else{logger[_0xbb3b('0x20')](_0xbb3b('0x21'),_0xb02acc,'request\x20sent');_0x2fe628(_0x4c6778[_0xbb3b('0x28')][_0xbb3b('0x27')]);}})['catch'](function(_0x1095d4){logger[_0xbb3b('0x25')]('DeskAccount,\x20%s,\x20%s',_0xb02acc,_0x1095d4);_0x219652(_0x1095d4);});});}function respondWithStatusCode(_0x1f88db,_0x5235be){_0x5235be=_0x5235be||0xcc;return function(_0x364d54){if(_0x364d54){return _0x1f88db[_0xbb3b('0x29')](_0x5235be);}return _0x1f88db['status'](_0x5235be)[_0xbb3b('0x2a')]();};}function respondWithResult(_0x22c2a5,_0x1071a1){_0x1071a1=_0x1071a1||0xc8;return function(_0x199a30){if(_0x199a30){return _0x22c2a5[_0xbb3b('0x2b')](_0x1071a1)[_0xbb3b('0x2c')](_0x199a30);}};}function respondWithFilteredResult(_0x33493a,_0x1d177c){return function(_0x1a06fe){if(_0x1a06fe){var _0x58fd34=_0x1a06fe['count'],_0x50f61d=_0x1d177c[_0xbb3b('0x2d')],_0x26a191=_0x1d177c[_0xbb3b('0x2d')]+_0x1d177c[_0xbb3b('0x2e')],_0x25a659;if(_0x26a191>=_0x58fd34){_0x26a191=_0x58fd34;_0x25a659=0xc8;}else{_0x25a659=0xce;}_0x33493a[_0xbb3b('0x2b')](_0x25a659);return _0x33493a[_0xbb3b('0x2f')](_0xbb3b('0x30'),_0x50f61d+'-'+_0x26a191+'/'+_0x58fd34)[_0xbb3b('0x2c')](_0x1a06fe);}return null;};}function patchUpdates(_0x4a4728){return function(_0xd1d393){try{jsonpatch['apply'](_0xd1d393,_0x4a4728,!![]);}catch(_0x3564c1){return BPromise[_0xbb3b('0x31')](_0x3564c1);}return _0xd1d393[_0xbb3b('0x32')]();};}function saveUpdates(_0x1a6a9c,_0x5ceb13){return function(_0x10687a){if(_0x10687a){return _0x10687a[_0xbb3b('0x33')](_0x1a6a9c)['then'](function(_0x51e82b){return _0x51e82b;});}return null;};}function removeEntity(_0x3c5c92,_0x18afe1){return function(_0x13e2a4){if(_0x13e2a4){return _0x13e2a4[_0xbb3b('0x34')]()[_0xbb3b('0x1f')](function(){_0x3c5c92[_0xbb3b('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2b3d,_0x52fbad){return function(_0x1bc9ae){if(!_0x1bc9ae){_0x5e2b3d[_0xbb3b('0x29')](0x194);}return _0x1bc9ae;};}function handleError(_0x4bc875,_0x2f2148){_0x2f2148=_0x2f2148||0x1f4;return function(_0x4c8507){logger[_0xbb3b('0x25')](_0x4c8507[_0xbb3b('0x35')]);if(_0x4c8507['name']){delete _0x4c8507['name'];}_0x4bc875[_0xbb3b('0x2b')](_0x2f2148)['send'](_0x4c8507);};}exports[_0xbb3b('0x36')]=function(_0xaaab9,_0x37471e){var _0x475876={},_0x4d1727={},_0x447d41={'count':0x0,'rows':[]};var _0x59051=_['map'](db[_0xbb3b('0x37')][_0xbb3b('0x38')],function(_0x481f87){return{'name':_0x481f87['fieldName'],'type':_0x481f87['type'][_0xbb3b('0x39')]};});_0x4d1727['model']=_[_0xbb3b('0x3a')](_0x59051,_0xbb3b('0x3b'));_0x4d1727[_0xbb3b('0x3c')]=_['keys'](_0xaaab9['query']);_0x4d1727[_0xbb3b('0x3d')]=_['intersection'](_0x4d1727[_0xbb3b('0x3e')],_0x4d1727[_0xbb3b('0x3c')]);_0x475876[_0xbb3b('0x3f')]=_['intersection'](_0x4d1727[_0xbb3b('0x3e')],qs[_0xbb3b('0x40')](_0xaaab9['query'][_0xbb3b('0x40')]));_0x475876['attributes']=_0x475876['attributes'][_0xbb3b('0x41')]?_0x475876['attributes']:_0x4d1727[_0xbb3b('0x3e')];if(!_0xaaab9[_0xbb3b('0x3c')][_0xbb3b('0x42')](_0xbb3b('0x43'))){_0x475876[_0xbb3b('0x2e')]=qs[_0xbb3b('0x2e')](_0xaaab9[_0xbb3b('0x3c')]['limit']);_0x475876[_0xbb3b('0x2d')]=qs[_0xbb3b('0x2d')](_0xaaab9[_0xbb3b('0x3c')][_0xbb3b('0x2d')]);}_0x475876['order']=qs[_0xbb3b('0x44')](_0xaaab9[_0xbb3b('0x3c')][_0xbb3b('0x44')]);_0x475876[_0xbb3b('0x45')]=qs['filters'](_[_0xbb3b('0x46')](_0xaaab9['query'],_0x4d1727[_0xbb3b('0x3d')]),_0x59051);if(_0xaaab9[_0xbb3b('0x3c')][_0xbb3b('0x47')]){_0x475876[_0xbb3b('0x45')]=_[_0xbb3b('0x48')](_0x475876[_0xbb3b('0x45')],{'$or':_[_0xbb3b('0x3a')](_0x59051,function(_0x442778){if(_0x442778['type']!=='VIRTUAL'){var _0x49db6e={};_0x49db6e[_0x442778[_0xbb3b('0x3b')]]={'$like':'%'+_0xaaab9[_0xbb3b('0x3c')]['filter']+'%'};return _0x49db6e;}})});}_0x475876=_['merge']({},_0x475876,_0xaaab9[_0xbb3b('0x49')]);var _0x393280={'where':_0x475876[_0xbb3b('0x45')]};return db['DeskAccount'][_0xbb3b('0x4a')](_0x393280)[_0xbb3b('0x1f')](function(_0x46004e){_0x447d41[_0xbb3b('0x4a')]=_0x46004e;if(_0xaaab9['query'][_0xbb3b('0x4b')]){_0x475876[_0xbb3b('0x4c')]=[{'all':!![]}];}return db[_0xbb3b('0x37')][_0xbb3b('0x4d')](_0x475876);})[_0xbb3b('0x1f')](function(_0x38638a){_0x447d41[_0xbb3b('0x4e')]=_0x38638a;return _0x447d41;})[_0xbb3b('0x1f')](respondWithFilteredResult(_0x37471e,_0x475876))[_0xbb3b('0x4f')](handleError(_0x37471e,null));};exports[_0xbb3b('0x50')]=function(_0x2067ba,_0x67b1b5){var _0x21cfcc={'raw':![],'where':{'id':_0x2067ba['params']['id']}},_0x129017={};_0x129017[_0xbb3b('0x3e')]=_[_0xbb3b('0x51')](db[_0xbb3b('0x37')][_0xbb3b('0x38')]);_0x129017['query']=_[_0xbb3b('0x51')](_0x2067ba[_0xbb3b('0x3c')]);_0x129017['filters']=_[_0xbb3b('0x52')](_0x129017[_0xbb3b('0x3e')],_0x129017[_0xbb3b('0x3c')]);_0x21cfcc[_0xbb3b('0x3f')]=_[_0xbb3b('0x52')](_0x129017[_0xbb3b('0x3e')],qs['fields'](_0x2067ba[_0xbb3b('0x3c')][_0xbb3b('0x40')]));_0x21cfcc['attributes']=_0x21cfcc[_0xbb3b('0x3f')][_0xbb3b('0x41')]?_0x21cfcc['attributes']:_0x129017['model'];if(_0x2067ba[_0xbb3b('0x3c')][_0xbb3b('0x4b')]){_0x21cfcc[_0xbb3b('0x4c')]=[{'all':!![]}];}_0x21cfcc=_[_0xbb3b('0x48')]({},_0x21cfcc,_0x2067ba['options']);return db[_0xbb3b('0x37')][_0xbb3b('0x53')](_0x21cfcc)['then'](handleEntityNotFound(_0x67b1b5,null))[_0xbb3b('0x1f')](respondWithResult(_0x67b1b5,null))[_0xbb3b('0x4f')](handleError(_0x67b1b5,null));};exports[_0xbb3b('0x54')]=function(_0x338a81,_0x5bb1f2){return db[_0xbb3b('0x37')][_0xbb3b('0x54')](_0x338a81[_0xbb3b('0x55')],{})[_0xbb3b('0x1f')](respondWithResult(_0x5bb1f2,0xc9))[_0xbb3b('0x4f')](handleError(_0x5bb1f2,null));};exports[_0xbb3b('0x33')]=function(_0x9dfefb,_0x8a77ee){if(_0x9dfefb[_0xbb3b('0x55')]['id']){delete _0x9dfefb[_0xbb3b('0x55')]['id'];}return db[_0xbb3b('0x37')][_0xbb3b('0x53')]({'where':{'id':_0x9dfefb[_0xbb3b('0x56')]['id']}})[_0xbb3b('0x1f')](handleEntityNotFound(_0x8a77ee,null))['then'](saveUpdates(_0x9dfefb[_0xbb3b('0x55')],null))[_0xbb3b('0x1f')](respondWithResult(_0x8a77ee,null))['catch'](handleError(_0x8a77ee,null));};exports[_0xbb3b('0x34')]=function(_0x3268bf,_0x3b5c57){return db[_0xbb3b('0x37')][_0xbb3b('0x53')]({'where':{'id':_0x3268bf[_0xbb3b('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b5c57,null))['then'](removeEntity(_0x3b5c57,null))[_0xbb3b('0x4f')](handleError(_0x3b5c57,null));};exports['getConfigurations']=function(_0x1a278f,_0x4f164b,_0x2ec76a){var _0x4617fd={};var _0x23dbed={};var _0x3daf71;var _0x6b424e;return db['DeskAccount'][_0xbb3b('0x57')]({'where':{'id':_0x1a278f[_0xbb3b('0x56')]['id']}})[_0xbb3b('0x1f')](handleEntityNotFound(_0x4f164b,null))[_0xbb3b('0x1f')](function(_0x1fad9a){if(_0x1fad9a){_0x3daf71=_0x1fad9a;_0x23dbed[_0xbb3b('0x3e')]=_[_0xbb3b('0x51')](db['DeskConfiguration']['rawAttributes']);_0x23dbed[_0xbb3b('0x3c')]=_['keys'](_0x1a278f['query']);_0x23dbed[_0xbb3b('0x3d')]=_['intersection'](_0x23dbed[_0xbb3b('0x3e')],_0x23dbed[_0xbb3b('0x3c')]);_0x4617fd[_0xbb3b('0x3f')]=_['intersection'](_0x23dbed[_0xbb3b('0x3e')],qs[_0xbb3b('0x40')](_0x1a278f[_0xbb3b('0x3c')][_0xbb3b('0x40')]));_0x4617fd[_0xbb3b('0x3f')]=_0x4617fd[_0xbb3b('0x3f')][_0xbb3b('0x41')]?_0x4617fd[_0xbb3b('0x3f')]:_0x23dbed[_0xbb3b('0x3e')];_0x4617fd['order']=qs[_0xbb3b('0x44')](_0x1a278f[_0xbb3b('0x3c')][_0xbb3b('0x44')]);_0x4617fd[_0xbb3b('0x45')]=qs[_0xbb3b('0x3d')](_[_0xbb3b('0x46')](_0x1a278f[_0xbb3b('0x3c')],_0x23dbed[_0xbb3b('0x3d')]));if(_0x1a278f[_0xbb3b('0x3c')][_0xbb3b('0x47')]){_0x4617fd['where']=_['merge'](_0x4617fd['where'],{'$or':_[_0xbb3b('0x3a')](_0x4617fd[_0xbb3b('0x3f')],function(_0xea9cb0){var _0x490aff={};_0x490aff[_0xea9cb0]={'$like':'%'+_0x1a278f['query'][_0xbb3b('0x47')]+'%'};return _0x490aff;})});}_0x4617fd=_[_0xbb3b('0x48')]({},_0x4617fd,_0x1a278f[_0xbb3b('0x49')]);return _0x3daf71['getConfigurations'](_0x4617fd);}})[_0xbb3b('0x1f')](function(_0x5a6e75){if(_0x5a6e75){_0x6b424e=_0x5a6e75[_0xbb3b('0x41')];if(!_0x1a278f['query']['hasOwnProperty'](_0xbb3b('0x43'))){_0x4617fd[_0xbb3b('0x2e')]=qs[_0xbb3b('0x2e')](_0x1a278f['query'][_0xbb3b('0x2e')]);_0x4617fd['offset']=qs['offset'](_0x1a278f[_0xbb3b('0x3c')][_0xbb3b('0x2d')]);}return _0x3daf71[_0xbb3b('0x58')](_0x4617fd);}})[_0xbb3b('0x1f')](function(_0x37d2bd){if(_0x37d2bd){return _0x37d2bd?{'count':_0x6b424e,'rows':_0x37d2bd}:null;}})[_0xbb3b('0x1f')](respondWithResult(_0x4f164b,null))[_0xbb3b('0x4f')](handleError(_0x4f164b,null));};exports[_0xbb3b('0x59')]=function(_0x2faff8,_0x33b4f5,_0x1a0389){if(_0x2faff8['body']['id']){delete _0x2faff8[_0xbb3b('0x55')]['id'];}return db['DeskAccount'][_0xbb3b('0x57')]({'where':{'id':_0x2faff8[_0xbb3b('0x56')]['id']}})[_0xbb3b('0x1f')](handleEntityNotFound(_0x33b4f5,null))[_0xbb3b('0x1f')](function(_0x215ab5){if(_0x215ab5){_0x2faff8[_0xbb3b('0x55')]['AccountId']=_0x215ab5['id'];_0x2faff8['body'][_0xbb3b('0x5a')]=integrations[_0xbb3b('0x5b')](_0x2faff8[_0xbb3b('0x55')][_0xbb3b('0x5c')],_0x2faff8['body'][_0xbb3b('0x5d')]);_0x2faff8[_0xbb3b('0x55')][_0xbb3b('0x5e')]=integrations[_0xbb3b('0x5f')](_0x2faff8[_0xbb3b('0x55')][_0xbb3b('0x5c')],_0x2faff8['body'][_0xbb3b('0x5d')]);return db[_0xbb3b('0x60')]['create'](_0x2faff8[_0xbb3b('0x55')],{'include':[{'model':db['DeskField'],'as':_0xbb3b('0x5a')},{'model':db[_0xbb3b('0x61')],'as':_0xbb3b('0x5e')}]});}return null;})['then'](respondWithResult(_0x33b4f5,null))[_0xbb3b('0x4f')](handleError(_0x33b4f5,null));};exports[_0xbb3b('0x62')]=function(_0x41a5be,_0x4067ef,_0x5b3f36){var _0x29d3cf=[{'name':'priority','label':_0xbb3b('0x63'),'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 _0xc1a9c1='';return db[_0xbb3b('0x37')][_0xbb3b('0x57')]({'where':{'id':_0x41a5be[_0xbb3b('0x56')]['id']},'attributes':['id',_0xbb3b('0x64'),_0xbb3b('0x65'),_0xbb3b('0x66'),_0xbb3b('0x67'),_0xbb3b('0x68'),_0xbb3b('0x69'),_0xbb3b('0x6a'),_0xbb3b('0x6b')]})[_0xbb3b('0x1f')](handleEntityNotFound(_0x4067ef,null))[_0xbb3b('0x1f')](function(_0x4e80ff){if(_0x4e80ff){_0xc1a9c1=_0x4e80ff[_0xbb3b('0x64')];var _0x5b8fed=_0xc1a9c1[_0xbb3b('0x6c')](-0x1);if(_0x5b8fed==='/'){_0xc1a9c1=_0xc1a9c1[_0xbb3b('0x6d')](0x0,_0xc1a9c1['lastIndexOf'](_0x5b8fed));}var _0x2807c9={'method':_0xbb3b('0x6e'),'uri':util[_0xbb3b('0x6f')](_0xbb3b('0x70'),_0xc1a9c1),'headers':{'Content-Type':_0xbb3b('0x71'),'Accept':_0xbb3b('0x71')},'json':!![]};if(_0x4e80ff[_0xbb3b('0x65')]===_0xbb3b('0x72')){_0x2807c9['headers'][_0xbb3b('0x73')]=util[_0xbb3b('0x6f')](_0xbb3b('0x74'),new Buffer(util[_0xbb3b('0x6f')](_0xbb3b('0x75'),_0x4e80ff[_0xbb3b('0x66')],_0x4e80ff[_0xbb3b('0x67')]))[_0xbb3b('0x76')](_0xbb3b('0x77')));}return rp(_0x2807c9)[_0xbb3b('0x1f')](function(_0x102483){return _0x29d3cf[_0xbb3b('0x78')](_[_0xbb3b('0x3a')](_0x102483[_0xbb3b('0x79')][_0xbb3b('0x7a')],function(_0x4a6d5c){return{'id':_0x4a6d5c[_0xbb3b('0x3b')],'name':_0x4a6d5c[_0xbb3b('0x3b')],'type':_0x4a6d5c[_0xbb3b('0x5d')],'active':_0x4a6d5c['active'],'label':_0x4a6d5c[_0xbb3b('0x7b')],'custom':!![]};}));});}})[_0xbb3b('0x1f')](function(_0x5e91c9){return{'count':_0x5e91c9[_0xbb3b('0x41')],'rows':_0x5e91c9};})['then'](respondWithResult(_0x4067ef,null))[_0xbb3b('0x4f')](function(_0x2fb4db){var _0x165c3b=_0x41a5be[_0xbb3b('0x3c')][_0xbb3b('0x7c')]?0x1f4:_0x2fb4db['statusCode']||0x1f4;logger[_0xbb3b('0x25')](_0xbb3b('0x7d'),_0xbb3b('0x62'),_0x165c3b,JSON[_0xbb3b('0x7e')](_0x2fb4db));delete _0x2fb4db[_0xbb3b('0x3b')];if(_0x165c3b===0x191){_0x165c3b=0x190;}_0x4067ef[_0xbb3b('0x2b')](_0x165c3b)[_0xbb3b('0x7f')](_0x41a5be[_0xbb3b('0x3c')][_0xbb3b('0x7c')]?{'message':_0xbb3b('0x80'),'statusCode':_0x2fb4db[_0xbb3b('0x81')]}:_0x2fb4db);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f29c538..d3c5089 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 _0x9f96=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36a60e,_0x1fbadd){var _0x5d8dfe=function(_0x284338){while(--_0x284338){_0x36a60e['push'](_0x36a60e['shift']());}};_0x5d8dfe(++_0x1fbadd);}(_0x9f96,0x17e));var _0x69f9=function(_0x5abeb6,_0x8cf4be){_0x5abeb6=_0x5abeb6-0x0;var _0x3bfa33=_0x9f96[_0x5abeb6];return _0x3bfa33;};'use strict';var _=require(_0x69f9('0x0'));var util=require(_0x69f9('0x1'));var logger=require('../../config/logger')(_0x69f9('0x2'));var moment=require(_0x69f9('0x3'));var BPromise=require(_0x69f9('0x4'));var rp=require(_0x69f9('0x5'));var fs=require('fs');var path=require(_0x69f9('0x6'));var rimraf=require(_0x69f9('0x7'));var config=require(_0x69f9('0x8'));var attributes=require(_0x69f9('0x9'));var integrations=require(_0x69f9('0xa'));module[_0x69f9('0xb')]=function(_0xd7edd5,_0x18688d){return _0xd7edd5[_0x69f9('0xc')](_0x69f9('0xd'),attributes,{'tableName':_0x69f9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a1e=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2289ee,_0x53304a){var _0x3aded4=function(_0x33ce0e){while(--_0x33ce0e){_0x2289ee['push'](_0x2289ee['shift']());}};_0x3aded4(++_0x53304a);}(_0x3a1e,0xc2));var _0xe3a1=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x3a1e[_0xfd9b19];return _0x514918;};'use strict';var _=require(_0xe3a1('0x0'));var util=require(_0xe3a1('0x1'));var logger=require(_0xe3a1('0x2'))(_0xe3a1('0x3'));var moment=require(_0xe3a1('0x4'));var BPromise=require(_0xe3a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3a1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3a1('0x7'));var integrations=require(_0xe3a1('0x8'));module[_0xe3a1('0x9')]=function(_0x8bc1f2,_0x29e631){return _0x8bc1f2['define'](_0xe3a1('0xa'),attributes,{'tableName':_0xe3a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index d87de06..b7e0f03 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 _0x804e=['http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowDeskAccount','find','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0x804e,0x1d7));var _0xe804=function(_0x18c9ce,_0x4c0bfd){_0x18c9ce=_0x18c9ce-0x0;var _0x319ac2=_0x804e[_0x18c9ce];return _0x319ac2;};'use strict';var _=require(_0xe804('0x0'));var util=require(_0xe804('0x1'));var moment=require(_0xe804('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe804('0x3'));var db=require(_0xe804('0x4'))['db'];var utils=require(_0xe804('0x5'));var logger=require(_0xe804('0x6'))('rpc');var config=require(_0xe804('0x7'));var jayson=require(_0xe804('0x8'));var client=jayson[_0xe804('0x9')][_0xe804('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bdc74,_0x2525b8,_0x565957){return new BPromise(function(_0x183232,_0xd3d011){return client[_0xe804('0xb')](_0x2bdc74,_0x565957)[_0xe804('0xc')](function(_0x6b44d0){logger[_0xe804('0xd')](_0xe804('0xe'),_0x2525b8,'request\x20sent');logger[_0xe804('0xf')](_0xe804('0x10'),_0x2525b8,'request\x20sent',JSON['stringify'](_0x6b44d0));if(_0x6b44d0[_0xe804('0x11')]){if(_0x6b44d0[_0xe804('0x11')][_0xe804('0x12')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2525b8,_0x6b44d0[_0xe804('0x11')][_0xe804('0x13')]);return _0xd3d011(_0x6b44d0['error'][_0xe804('0x13')]);}logger[_0xe804('0x11')](_0xe804('0xe'),_0x2525b8,_0x6b44d0[_0xe804('0x11')][_0xe804('0x13')]);return _0x183232(_0x6b44d0['error'][_0xe804('0x13')]);}else{logger[_0xe804('0xd')]('DeskAccount,\x20%s,\x20%s',_0x2525b8,_0xe804('0x14'));_0x183232(_0x6b44d0[_0xe804('0x15')][_0xe804('0x13')]);}})[_0xe804('0x16')](function(_0x36017c){logger[_0xe804('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2525b8,_0x36017c);_0xd3d011(_0x36017c);});});}exports[_0xe804('0x17')]=function(_0x4ef74e){var _0x1a8600=this;return new Promise(function(_0x43bc66,_0x2317b5){return db[_0xe804('0x18')][_0xe804('0x19')]({'raw':_0x4ef74e['options']?_0x4ef74e[_0xe804('0x1a')][_0xe804('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ef74e[_0xe804('0x1a')]?_0x4ef74e[_0xe804('0x1a')][_0xe804('0x1c')]||null:null,'attributes':_0x4ef74e[_0xe804('0x1a')]?_0x4ef74e[_0xe804('0x1a')][_0xe804('0x1d')]||null:null,'limit':_0x4ef74e[_0xe804('0x1a')]?_0x4ef74e[_0xe804('0x1a')][_0xe804('0x1e')]||null:null,'include':_0x4ef74e['options']?_0x4ef74e[_0xe804('0x1a')]['include']?_[_0xe804('0x1f')](_0x4ef74e[_0xe804('0x1a')]['include'],function(_0x481eee){return{'model':db[_0x481eee['model']],'as':_0x481eee['as'],'attributes':_0x481eee[_0xe804('0x1d')],'include':_0x481eee['include']?_[_0xe804('0x1f')](_0x481eee['include'],function(_0x3d9f46){return{'model':db[_0x3d9f46[_0xe804('0x20')]],'as':_0x3d9f46['as'],'attributes':_0x3d9f46[_0xe804('0x1d')],'include':_0x3d9f46[_0xe804('0x21')]?_[_0xe804('0x1f')](_0x3d9f46['include'],function(_0x460c82){return{'model':db[_0x460c82[_0xe804('0x20')]],'as':_0x460c82['as'],'attributes':_0x460c82[_0xe804('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18ce99){logger[_0xe804('0xd')]('GetDeskAccount',_0x4ef74e);logger[_0xe804('0xf')](_0xe804('0x17'),_0x4ef74e,JSON['stringify'](_0x18ce99));_0x43bc66(_0x18ce99);})[_0xe804('0x16')](function(_0x521533){logger[_0xe804('0x11')](_0xe804('0x17'),_0x521533['message'],_0x4ef74e);_0x2317b5(_0x1a8600[_0xe804('0x11')](0x1f4,_0x521533[_0xe804('0x13')]));});});};exports[_0xe804('0x22')]=function(_0x579fad){var _0x45bb4f=this;return new Promise(function(_0x3a0f92,_0x1a5432){return db['DeskAccount'][_0xe804('0x23')]({'raw':_0x579fad[_0xe804('0x1a')]?_0x579fad[_0xe804('0x1a')][_0xe804('0x1b')]===undefined?!![]:![]:!![],'where':_0x579fad['options']?_0x579fad[_0xe804('0x1a')]['where']||null:null,'attributes':_0x579fad['options']?_0x579fad[_0xe804('0x1a')][_0xe804('0x1d')]||null:null,'include':_0x579fad[_0xe804('0x1a')]?_0x579fad['options'][_0xe804('0x21')]?_[_0xe804('0x1f')](_0x579fad[_0xe804('0x1a')][_0xe804('0x21')],function(_0x57ee52){return{'model':db[_0x57ee52[_0xe804('0x20')]],'as':_0x57ee52['as'],'attributes':_0x57ee52[_0xe804('0x1d')],'include':_0x57ee52['include']?_[_0xe804('0x1f')](_0x57ee52[_0xe804('0x21')],function(_0x57d44b){return{'model':db[_0x57d44b[_0xe804('0x20')]],'as':_0x57d44b['as'],'attributes':_0x57d44b[_0xe804('0x1d')],'include':_0x57d44b[_0xe804('0x21')]?_['map'](_0x57d44b[_0xe804('0x21')],function(_0x20ba3d){return{'model':db[_0x20ba3d[_0xe804('0x20')]],'as':_0x20ba3d['as'],'attributes':_0x20ba3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe804('0xc')](function(_0x15b0ca){logger[_0xe804('0xd')](_0xe804('0x22'),_0x579fad);logger['debug'](_0xe804('0x22'),_0x579fad,JSON[_0xe804('0x24')](_0x15b0ca));_0x3a0f92(_0x15b0ca);})[_0xe804('0x16')](function(_0x1ede86){logger[_0xe804('0x11')](_0xe804('0x22'),_0x1ede86['message'],_0x579fad);_0x1a5432(_0x45bb4f[_0xe804('0x11')](0x1f4,_0x1ede86[_0xe804('0x13')]));});});}; \ No newline at end of file +var _0xd091=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','raw','options','attributes','include','map','model','GetDeskAccount','ShowDeskAccount','find','where','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39b81d,_0x5f5ba2){var _0x3822a8=function(_0x17e96d){while(--_0x17e96d){_0x39b81d['push'](_0x39b81d['shift']());}};_0x3822a8(++_0x5f5ba2);}(_0xd091,0x76));var _0x1d09=function(_0x29c50a,_0x30dcd2){_0x29c50a=_0x29c50a-0x0;var _0x162737=_0xd091[_0x29c50a];return _0x162737;};'use strict';var _=require('lodash');var util=require(_0x1d09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d09('0x1'));var db=require(_0x1d09('0x2'))['db'];var utils=require(_0x1d09('0x3'));var logger=require(_0x1d09('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1d09('0x5'));var client=jayson[_0x1d09('0x6')][_0x1d09('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b9651,_0x56d0e9,_0x1fc4a9){return new BPromise(function(_0x13c50c,_0x4c4813){return client[_0x1d09('0x8')](_0x2b9651,_0x1fc4a9)[_0x1d09('0x9')](function(_0x4e59f5){logger[_0x1d09('0xa')](_0x1d09('0xb'),_0x56d0e9,_0x1d09('0xc'));logger[_0x1d09('0xd')](_0x1d09('0xe'),_0x56d0e9,_0x1d09('0xc'),JSON[_0x1d09('0xf')](_0x4e59f5));if(_0x4e59f5['error']){if(_0x4e59f5[_0x1d09('0x10')][_0x1d09('0x11')]===0x1f4){logger[_0x1d09('0x10')](_0x1d09('0xb'),_0x56d0e9,_0x4e59f5[_0x1d09('0x10')][_0x1d09('0x12')]);return _0x4c4813(_0x4e59f5[_0x1d09('0x10')][_0x1d09('0x12')]);}logger[_0x1d09('0x10')]('DeskAccount,\x20%s,\x20%s',_0x56d0e9,_0x4e59f5[_0x1d09('0x10')][_0x1d09('0x12')]);return _0x13c50c(_0x4e59f5['error']['message']);}else{logger[_0x1d09('0xa')](_0x1d09('0xb'),_0x56d0e9,'request\x20sent');_0x13c50c(_0x4e59f5[_0x1d09('0x13')][_0x1d09('0x12')]);}})[_0x1d09('0x14')](function(_0x30773e){logger[_0x1d09('0x10')](_0x1d09('0xb'),_0x56d0e9,_0x30773e);_0x4c4813(_0x30773e);});});}exports['GetDeskAccount']=function(_0x3b3053){var _0x5d99b9=this;return new Promise(function(_0x133aab,_0x1c8c39){return db[_0x1d09('0x15')][_0x1d09('0x16')]({'raw':_0x3b3053['options']?_0x3b3053['options'][_0x1d09('0x17')]===undefined?!![]:![]:!![],'where':_0x3b3053[_0x1d09('0x18')]?_0x3b3053[_0x1d09('0x18')]['where']||null:null,'attributes':_0x3b3053[_0x1d09('0x18')]?_0x3b3053[_0x1d09('0x18')][_0x1d09('0x19')]||null:null,'limit':_0x3b3053[_0x1d09('0x18')]?_0x3b3053[_0x1d09('0x18')]['limit']||null:null,'include':_0x3b3053[_0x1d09('0x18')]?_0x3b3053[_0x1d09('0x18')][_0x1d09('0x1a')]?_[_0x1d09('0x1b')](_0x3b3053[_0x1d09('0x18')][_0x1d09('0x1a')],function(_0x5059b4){return{'model':db[_0x5059b4[_0x1d09('0x1c')]],'as':_0x5059b4['as'],'attributes':_0x5059b4[_0x1d09('0x19')],'include':_0x5059b4[_0x1d09('0x1a')]?_[_0x1d09('0x1b')](_0x5059b4['include'],function(_0x5c5114){return{'model':db[_0x5c5114['model']],'as':_0x5c5114['as'],'attributes':_0x5c5114[_0x1d09('0x19')],'include':_0x5c5114['include']?_[_0x1d09('0x1b')](_0x5c5114['include'],function(_0x3c159d){return{'model':db[_0x3c159d['model']],'as':_0x3c159d['as'],'attributes':_0x3c159d[_0x1d09('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43318c){logger[_0x1d09('0xa')]('GetDeskAccount',_0x3b3053);logger[_0x1d09('0xd')](_0x1d09('0x1d'),_0x3b3053,JSON['stringify'](_0x43318c));_0x133aab(_0x43318c);})['catch'](function(_0x6de0ff){logger['error'](_0x1d09('0x1d'),_0x6de0ff[_0x1d09('0x12')],_0x3b3053);_0x1c8c39(_0x5d99b9[_0x1d09('0x10')](0x1f4,_0x6de0ff[_0x1d09('0x12')]));});});};exports[_0x1d09('0x1e')]=function(_0x58ed7e){var _0x494239=this;return new Promise(function(_0x1dfc09,_0x3354cb){return db[_0x1d09('0x15')][_0x1d09('0x1f')]({'raw':_0x58ed7e['options']?_0x58ed7e['options']['raw']===undefined?!![]:![]:!![],'where':_0x58ed7e['options']?_0x58ed7e[_0x1d09('0x18')][_0x1d09('0x20')]||null:null,'attributes':_0x58ed7e[_0x1d09('0x18')]?_0x58ed7e[_0x1d09('0x18')][_0x1d09('0x19')]||null:null,'include':_0x58ed7e[_0x1d09('0x18')]?_0x58ed7e[_0x1d09('0x18')][_0x1d09('0x1a')]?_[_0x1d09('0x1b')](_0x58ed7e[_0x1d09('0x18')][_0x1d09('0x1a')],function(_0xfae360){return{'model':db[_0xfae360['model']],'as':_0xfae360['as'],'attributes':_0xfae360[_0x1d09('0x19')],'include':_0xfae360[_0x1d09('0x1a')]?_[_0x1d09('0x1b')](_0xfae360[_0x1d09('0x1a')],function(_0x40ca1b){return{'model':db[_0x40ca1b[_0x1d09('0x1c')]],'as':_0x40ca1b['as'],'attributes':_0x40ca1b[_0x1d09('0x19')],'include':_0x40ca1b[_0x1d09('0x1a')]?_[_0x1d09('0x1b')](_0x40ca1b[_0x1d09('0x1a')],function(_0x3717ef){return{'model':db[_0x3717ef[_0x1d09('0x1c')]],'as':_0x3717ef['as'],'attributes':_0x3717ef[_0x1d09('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1d09('0x9')](function(_0x14656e){logger[_0x1d09('0xa')](_0x1d09('0x1e'),_0x58ed7e);logger[_0x1d09('0xd')](_0x1d09('0x1e'),_0x58ed7e,JSON['stringify'](_0x14656e));_0x1dfc09(_0x14656e);})[_0x1d09('0x14')](function(_0x499e94){logger[_0x1d09('0x10')]('ShowDeskAccount',_0x499e94[_0x1d09('0x12')],_0x58ed7e);_0x3354cb(_0x494239[_0x1d09('0x10')](0x1f4,_0x499e94[_0x1d09('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5f8cfc8..a5728a7 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 _0x6822=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put'];(function(_0x446e85,_0x421393){var _0x4fd3b0=function(_0x58309e){while(--_0x58309e){_0x446e85['push'](_0x446e85['shift']());}};_0x4fd3b0(++_0x421393);}(_0x6822,0xca));var _0x2682=function(_0x1ee1ca,_0x2d9e5e){_0x1ee1ca=_0x1ee1ca-0x0;var _0xf7bc97=_0x6822[_0x1ee1ca];return _0xf7bc97;};'use strict';var multer=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var path=require(_0x2682('0x2'));var timeout=require(_0x2682('0x3'));var express=require(_0x2682('0x4'));var router=express[_0x2682('0x5')]();var auth=require(_0x2682('0x6'));var interaction=require(_0x2682('0x7'));var config=require(_0x2682('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0x2682('0x9')]('/',auth['isAuthenticated'](),controller[_0x2682('0xa')]);router[_0x2682('0x9')](_0x2682('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2682('0xc'),auth[_0x2682('0xd')](),controller[_0x2682('0xe')]);router[_0x2682('0x9')]('/:id/subjects',auth[_0x2682('0xd')](),controller[_0x2682('0xf')]);router[_0x2682('0x9')](_0x2682('0x10'),auth['isAuthenticated'](),controller[_0x2682('0x11')]);router[_0x2682('0x9')](_0x2682('0x12'),auth[_0x2682('0xd')](),controller['getTags']);router[_0x2682('0x13')]('/',auth[_0x2682('0xd')](),controller[_0x2682('0x14')]);router[_0x2682('0x13')](_0x2682('0x12'),auth['isAuthenticated'](),controller[_0x2682('0x15')]);router[_0x2682('0x16')](_0x2682('0xb'),auth[_0x2682('0xd')](),controller[_0x2682('0x17')]);router['delete'](_0x2682('0xb'),auth['isAuthenticated'](),controller[_0x2682('0x18')]);module['exports']=router; \ No newline at end of file +var _0x073d=['getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x073d,0xd2));var _0xd073=function(_0x5e4759,_0x1f8793){_0x5e4759=_0x5e4759-0x0;var _0x1aefe3=_0x073d[_0x5e4759];return _0x1aefe3;};'use strict';var multer=require('multer');var util=require(_0xd073('0x0'));var path=require(_0xd073('0x1'));var timeout=require(_0xd073('0x2'));var express=require('express');var router=express[_0xd073('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd073('0x4'));var config=require(_0xd073('0x5'));var controller=require('./intDeskConfiguration.controller');router[_0xd073('0x6')]('/',auth[_0xd073('0x7')](),controller[_0xd073('0x8')]);router[_0xd073('0x6')](_0xd073('0x9'),auth[_0xd073('0x7')](),controller[_0xd073('0xa')]);router[_0xd073('0x6')](_0xd073('0xb'),auth[_0xd073('0x7')](),controller[_0xd073('0xc')]);router[_0xd073('0x6')](_0xd073('0xd'),auth[_0xd073('0x7')](),controller['getSubjects']);router['get'](_0xd073('0xe'),auth['isAuthenticated'](),controller[_0xd073('0xf')]);router[_0xd073('0x6')](_0xd073('0x10'),auth[_0xd073('0x7')](),controller[_0xd073('0x11')]);router['post']('/',auth[_0xd073('0x7')](),controller[_0xd073('0x12')]);router[_0xd073('0x13')](_0xd073('0x10'),auth['isAuthenticated'](),controller[_0xd073('0x14')]);router[_0xd073('0x15')]('/:id',auth[_0xd073('0x7')](),controller[_0xd073('0x16')]);router[_0xd073('0x17')](_0xd073('0x9'),auth['isAuthenticated'](),controller[_0xd073('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 9205ff1..57fe852 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 _0x6388=['exports','STRING'];(function(_0x5cfcb8,_0x4521b5){var _0x190f68=function(_0x1bad3c){while(--_0x1bad3c){_0x5cfcb8['push'](_0x5cfcb8['shift']());}};_0x190f68(++_0x4521b5);}(_0x6388,0xea));var _0x8638=function(_0x492335,_0xf937e6){_0x492335=_0x492335-0x0;var _0x1d082=_0x6388[_0x492335];return _0x1d082;};'use strict';var Sequelize=require('sequelize');module[_0x8638('0x0')]={'name':{'type':Sequelize[_0x8638('0x1')]},'description':{'type':Sequelize[_0x8638('0x1')]}}; \ No newline at end of file +var _0x55f3=['STRING','sequelize','exports'];(function(_0x2b4081,_0x4f8a0){var _0x2aecd4=function(_0x5c0fa6){while(--_0x5c0fa6){_0x2b4081['push'](_0x2b4081['shift']());}};_0x2aecd4(++_0x4f8a0);}(_0x55f3,0x1d8));var _0x355f=function(_0x32335b,_0x5b63af){_0x32335b=_0x32335b-0x0;var _0x54c1da=_0x55f3[_0x32335b];return _0x54c1da;};'use strict';var Sequelize=require(_0x355f('0x0'));module[_0x355f('0x1')]={'name':{'type':Sequelize[_0x355f('0x2')]},'description':{'type':Sequelize[_0x355f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b6cd9ba..c3faf37 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 _0xd6d6=['bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','DeskConfiguration','count','includeAll','include','findAll','show','params','find','create','body','destroy','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x3ffc74,_0x265c91){var _0xa2dd3b=function(_0x10abd1){while(--_0x10abd1){_0x3ffc74['push'](_0x3ffc74['shift']());}};_0xa2dd3b(++_0x265c91);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x83865d,_0x2367de){_0x83865d=_0x83865d-0x0;var _0x2464f7=_0xd6d6[_0x83865d];return _0x2464f7;};'use strict';var pdf=require(_0x6d6d('0x0'));var emlformat=require(_0x6d6d('0x1'));var rimraf=require(_0x6d6d('0x2'));var zipdir=require(_0x6d6d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d6d('0x4'));var moment=require(_0x6d6d('0x5'));var BPromise=require(_0x6d6d('0x6'));var Mustache=require(_0x6d6d('0x7'));var util=require(_0x6d6d('0x8'));var path=require(_0x6d6d('0x9'));var sox=require(_0x6d6d('0xa'));var csv=require('to-csv');var ejs=require(_0x6d6d('0xb'));var fs=require('fs');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('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x12'));var authService=require(_0x6d6d('0x13'));var qs=require(_0x6d6d('0x14'));var as=require(_0x6d6d('0x15'));var hardwareService=require(_0x6d6d('0x16'));var logger=require('../../config/logger')(_0x6d6d('0x17'));var utils=require(_0x6d6d('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3f8542,_0x2b74ed,_0x41fbdf){if(_0x41fbdf){var _0x19cf50=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x19cf50[_0x6d6d('0x1c')](_0x2b74ed)){return _0x3f8542;}else{throw new db['Sequelize'][(_0x6d6d('0x1d'))](_0x6d6d('0x1e'));}}else{return _0x3f8542;}}function respondWithRpcPromise(_0x1f2aac,_0xa3b05d,_0x29cbd8,_0x5d80c0){return new BPromise(function(_0x2e6fdb,_0x587338){var _0x27830d=_0x5d80c0||client;return _0x27830d[_0x6d6d('0x1f')](_0x1f2aac,_0x29cbd8)[_0x6d6d('0x20')](function(_0x4bb3d1){logger['info'](_0x6d6d('0x21'),_0xa3b05d,_0x6d6d('0x22'));logger[_0x6d6d('0x23')](_0x6d6d('0x24'),_0xa3b05d,'request\x20sent',JSON['stringify'](_0x4bb3d1));if(_0x4bb3d1[_0x6d6d('0x25')]){if(_0x4bb3d1['error'][_0x6d6d('0x26')]===0x1f4){logger[_0x6d6d('0x25')](_0x6d6d('0x21'),_0xa3b05d,_0x4bb3d1[_0x6d6d('0x25')][_0x6d6d('0x27')]);return _0x587338(_0x4bb3d1[_0x6d6d('0x25')][_0x6d6d('0x27')]);}logger[_0x6d6d('0x25')](_0x6d6d('0x21'),_0xa3b05d,_0x4bb3d1[_0x6d6d('0x25')][_0x6d6d('0x27')]);return _0x2e6fdb(_0x4bb3d1[_0x6d6d('0x25')][_0x6d6d('0x27')]);}else{logger[_0x6d6d('0x28')](_0x6d6d('0x21'),_0xa3b05d,_0x6d6d('0x22'));_0x2e6fdb(_0x4bb3d1[_0x6d6d('0x29')]['message']);}})[_0x6d6d('0x2a')](function(_0x2dcb9c){logger[_0x6d6d('0x25')](_0x6d6d('0x21'),_0xa3b05d,_0x2dcb9c);_0x587338(_0x2dcb9c);});});}function respondWithStatusCode(_0xf0df7f,_0x12fab2){_0x12fab2=_0x12fab2||0xcc;return function(_0x554f8e){if(_0x554f8e){return _0xf0df7f[_0x6d6d('0x2b')](_0x12fab2);}return _0xf0df7f[_0x6d6d('0x2c')](_0x12fab2)[_0x6d6d('0x2d')]();};}function respondWithResult(_0x126ac8,_0x25c121){_0x25c121=_0x25c121||0xc8;return function(_0x408f98){if(_0x408f98){return _0x126ac8[_0x6d6d('0x2c')](_0x25c121)['json'](_0x408f98);}};}function respondWithFilteredResult(_0x298408,_0x9595d8){return function(_0x51bd68){if(_0x51bd68){var _0x553645=_0x51bd68['count'],_0x3edcce=_0x9595d8[_0x6d6d('0x2e')],_0x5273cd=_0x9595d8[_0x6d6d('0x2e')]+_0x9595d8[_0x6d6d('0x2f')],_0x8a9a84;if(_0x5273cd>=_0x553645){_0x5273cd=_0x553645;_0x8a9a84=0xc8;}else{_0x8a9a84=0xce;}_0x298408[_0x6d6d('0x2c')](_0x8a9a84);return _0x298408[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x3edcce+'-'+_0x5273cd+'/'+_0x553645)[_0x6d6d('0x32')](_0x51bd68);}return null;};}function patchUpdates(_0x359cfd){return function(_0x6c4741){try{jsonpatch[_0x6d6d('0x33')](_0x6c4741,_0x359cfd,!![]);}catch(_0x5a67ca){return BPromise[_0x6d6d('0x34')](_0x5a67ca);}return _0x6c4741['save']();};}function saveUpdates(_0x18015a,_0x1ea9b2){return function(_0xf527da){if(_0xf527da){return _0xf527da[_0x6d6d('0x35')](_0x18015a)['then'](function(_0x182441){return _0x182441;});}return null;};}function removeEntity(_0x4f2f13,_0x3cc702){return function(_0x219fd4){if(_0x219fd4){return _0x219fd4['destroy']()[_0x6d6d('0x20')](function(){_0x4f2f13[_0x6d6d('0x2c')](0xcc)[_0x6d6d('0x2d')]();});}};}function handleEntityNotFound(_0xa73803,_0x34c390){return function(_0x486183){if(!_0x486183){_0xa73803[_0x6d6d('0x2b')](0x194);}return _0x486183;};}function handleError(_0x2d524d,_0x243555){_0x243555=_0x243555||0x1f4;return function(_0x1d0545){logger[_0x6d6d('0x25')](_0x1d0545[_0x6d6d('0x36')]);if(_0x1d0545[_0x6d6d('0x37')]){delete _0x1d0545[_0x6d6d('0x37')];}_0x2d524d['status'](_0x243555)[_0x6d6d('0x38')](_0x1d0545);};}exports[_0x6d6d('0x39')]=function(_0x3e2415,_0x5e4f38){var _0x4acf0f={},_0x52481b={},_0x3726ba={'count':0x0,'rows':[]};var _0x26b2de=_[_0x6d6d('0x3a')](db['DeskConfiguration'][_0x6d6d('0x3b')],function(_0x2607c1){return{'name':_0x2607c1[_0x6d6d('0x3c')],'type':_0x2607c1[_0x6d6d('0x3d')]['key']};});_0x52481b['model']=_['map'](_0x26b2de,_0x6d6d('0x37'));_0x52481b[_0x6d6d('0x3e')]=_[_0x6d6d('0x3f')](_0x3e2415[_0x6d6d('0x3e')]);_0x52481b['filters']=_[_0x6d6d('0x40')](_0x52481b[_0x6d6d('0x41')],_0x52481b[_0x6d6d('0x3e')]);_0x4acf0f[_0x6d6d('0x42')]=_[_0x6d6d('0x40')](_0x52481b[_0x6d6d('0x41')],qs['fields'](_0x3e2415[_0x6d6d('0x3e')][_0x6d6d('0x43')]));_0x4acf0f[_0x6d6d('0x42')]=_0x4acf0f[_0x6d6d('0x42')][_0x6d6d('0x44')]?_0x4acf0f[_0x6d6d('0x42')]:_0x52481b[_0x6d6d('0x41')];if(!_0x3e2415['query'][_0x6d6d('0x45')](_0x6d6d('0x46'))){_0x4acf0f[_0x6d6d('0x2f')]=qs[_0x6d6d('0x2f')](_0x3e2415[_0x6d6d('0x3e')]['limit']);_0x4acf0f[_0x6d6d('0x2e')]=qs[_0x6d6d('0x2e')](_0x3e2415['query'][_0x6d6d('0x2e')]);}_0x4acf0f['order']=qs[_0x6d6d('0x47')](_0x3e2415[_0x6d6d('0x3e')]['sort']);_0x4acf0f[_0x6d6d('0x48')]=qs[_0x6d6d('0x49')](_[_0x6d6d('0x4a')](_0x3e2415[_0x6d6d('0x3e')],_0x52481b[_0x6d6d('0x49')]),_0x26b2de);if(_0x3e2415['query']['filter']){_0x4acf0f[_0x6d6d('0x48')]=_['merge'](_0x4acf0f['where'],{'$or':_[_0x6d6d('0x3a')](_0x26b2de,function(_0x3e4d6c){if(_0x3e4d6c[_0x6d6d('0x3d')]!=='VIRTUAL'){var _0x21589d={};_0x21589d[_0x3e4d6c['name']]={'$like':'%'+_0x3e2415[_0x6d6d('0x3e')][_0x6d6d('0x4b')]+'%'};return _0x21589d;}})});}_0x4acf0f=_[_0x6d6d('0x4c')]({},_0x4acf0f,_0x3e2415[_0x6d6d('0x4d')]);var _0x75f298={'where':_0x4acf0f[_0x6d6d('0x48')]};return db[_0x6d6d('0x4e')]['count'](_0x75f298)[_0x6d6d('0x20')](function(_0x150479){_0x3726ba[_0x6d6d('0x4f')]=_0x150479;if(_0x3e2415[_0x6d6d('0x3e')][_0x6d6d('0x50')]){_0x4acf0f[_0x6d6d('0x51')]=[{'all':!![]}];}return db[_0x6d6d('0x4e')][_0x6d6d('0x52')](_0x4acf0f);})[_0x6d6d('0x20')](function(_0x5e4c04){_0x3726ba['rows']=_0x5e4c04;return _0x3726ba;})[_0x6d6d('0x20')](respondWithFilteredResult(_0x5e4f38,_0x4acf0f))[_0x6d6d('0x2a')](handleError(_0x5e4f38,null));};exports[_0x6d6d('0x53')]=function(_0x622c23,_0xe2a20e){var _0x492834={'raw':![],'where':{'id':_0x622c23[_0x6d6d('0x54')]['id']}},_0x47170d={};_0x47170d[_0x6d6d('0x41')]=_[_0x6d6d('0x3f')](db[_0x6d6d('0x4e')][_0x6d6d('0x3b')]);_0x47170d[_0x6d6d('0x3e')]=_[_0x6d6d('0x3f')](_0x622c23[_0x6d6d('0x3e')]);_0x47170d[_0x6d6d('0x49')]=_[_0x6d6d('0x40')](_0x47170d[_0x6d6d('0x41')],_0x47170d['query']);_0x492834[_0x6d6d('0x42')]=_[_0x6d6d('0x40')](_0x47170d[_0x6d6d('0x41')],qs[_0x6d6d('0x43')](_0x622c23[_0x6d6d('0x3e')]['fields']));_0x492834[_0x6d6d('0x42')]=_0x492834[_0x6d6d('0x42')][_0x6d6d('0x44')]?_0x492834['attributes']:_0x47170d['model'];if(_0x622c23[_0x6d6d('0x3e')]['includeAll']){_0x492834[_0x6d6d('0x51')]=[{'all':!![]}];}_0x492834=_[_0x6d6d('0x4c')]({},_0x492834,_0x622c23[_0x6d6d('0x4d')]);return db[_0x6d6d('0x4e')][_0x6d6d('0x55')](_0x492834)[_0x6d6d('0x20')](handleEntityNotFound(_0xe2a20e,null))[_0x6d6d('0x20')](respondWithResult(_0xe2a20e,null))[_0x6d6d('0x2a')](handleError(_0xe2a20e,null));};exports[_0x6d6d('0x56')]=function(_0x24c9a3,_0x583d1a){return db[_0x6d6d('0x4e')][_0x6d6d('0x56')](_0x24c9a3[_0x6d6d('0x57')],{})[_0x6d6d('0x20')](respondWithResult(_0x583d1a,0xc9))[_0x6d6d('0x2a')](handleError(_0x583d1a,null));};exports[_0x6d6d('0x35')]=function(_0x243be3,_0x5e5ace){if(_0x243be3['body']['id']){delete _0x243be3[_0x6d6d('0x57')]['id'];}return db[_0x6d6d('0x4e')]['find']({'where':{'id':_0x243be3[_0x6d6d('0x54')]['id']}})[_0x6d6d('0x20')](handleEntityNotFound(_0x5e5ace,null))[_0x6d6d('0x20')](saveUpdates(_0x243be3[_0x6d6d('0x57')],null))[_0x6d6d('0x20')](respondWithResult(_0x5e5ace,null))[_0x6d6d('0x2a')](handleError(_0x5e5ace,null));};exports[_0x6d6d('0x58')]=function(_0x1ef7fb,_0x2abd8c){return db[_0x6d6d('0x4e')][_0x6d6d('0x55')]({'where':{'id':_0x1ef7fb[_0x6d6d('0x54')]['id']}})[_0x6d6d('0x20')](handleEntityNotFound(_0x2abd8c,null))[_0x6d6d('0x20')](removeEntity(_0x2abd8c,null))[_0x6d6d('0x2a')](handleError(_0x2abd8c,null));};exports['getFields']=function(_0x43b81a,_0x33d7b1,_0x4bb143){var _0x1ab22b={};var _0x466778={};var _0x1f99ef;var _0x407357;return db[_0x6d6d('0x4e')][_0x6d6d('0x59')]({'where':{'id':_0x43b81a[_0x6d6d('0x54')]['id']}})[_0x6d6d('0x20')](handleEntityNotFound(_0x33d7b1,null))[_0x6d6d('0x20')](function(_0x5f1b29){if(_0x5f1b29){_0x1f99ef=_0x5f1b29;_0x466778['model']=_[_0x6d6d('0x3f')](db[_0x6d6d('0x5a')][_0x6d6d('0x3b')]);_0x466778['query']=_['keys'](_0x43b81a[_0x6d6d('0x3e')]);_0x466778['filters']=_[_0x6d6d('0x40')](_0x466778['model'],_0x466778[_0x6d6d('0x3e')]);_0x1ab22b[_0x6d6d('0x42')]=_[_0x6d6d('0x40')](_0x466778[_0x6d6d('0x41')],qs[_0x6d6d('0x43')](_0x43b81a[_0x6d6d('0x3e')]['fields']));_0x1ab22b[_0x6d6d('0x42')]=_0x1ab22b['attributes'][_0x6d6d('0x44')]?_0x1ab22b['attributes']:_0x466778[_0x6d6d('0x41')];_0x1ab22b[_0x6d6d('0x5b')]=qs[_0x6d6d('0x47')](_0x43b81a[_0x6d6d('0x3e')][_0x6d6d('0x47')]);_0x1ab22b[_0x6d6d('0x48')]=qs[_0x6d6d('0x49')](_['pick'](_0x43b81a['query'],_0x466778[_0x6d6d('0x49')]));if(_0x43b81a['query'][_0x6d6d('0x4b')]){_0x1ab22b['where']=_[_0x6d6d('0x4c')](_0x1ab22b[_0x6d6d('0x48')],{'$or':_[_0x6d6d('0x3a')](_0x1ab22b[_0x6d6d('0x42')],function(_0x423198){var _0x2ee7c9={};_0x2ee7c9[_0x423198]={'$like':'%'+_0x43b81a['query'][_0x6d6d('0x4b')]+'%'};return _0x2ee7c9;})});}_0x1ab22b=_[_0x6d6d('0x4c')]({},_0x1ab22b,_0x43b81a[_0x6d6d('0x4d')]);return _0x1f99ef[_0x6d6d('0x5c')](_0x1ab22b);}})[_0x6d6d('0x20')](function(_0x155670){if(_0x155670){_0x407357=_0x155670[_0x6d6d('0x44')];if(!_0x43b81a['query'][_0x6d6d('0x45')](_0x6d6d('0x46'))){_0x1ab22b[_0x6d6d('0x2f')]=qs[_0x6d6d('0x2f')](_0x43b81a[_0x6d6d('0x3e')][_0x6d6d('0x2f')]);_0x1ab22b[_0x6d6d('0x2e')]=qs[_0x6d6d('0x2e')](_0x43b81a[_0x6d6d('0x3e')][_0x6d6d('0x2e')]);}return _0x1f99ef[_0x6d6d('0x5c')](_0x1ab22b);}})['then'](function(_0x488b2f){if(_0x488b2f){return _0x488b2f?{'count':_0x407357,'rows':_0x488b2f}:null;}})[_0x6d6d('0x20')](respondWithResult(_0x33d7b1,null))['catch'](handleError(_0x33d7b1,null));};exports['getSubjects']=function(_0x5b6ca7,_0x1e3b17,_0x1ee1b3){var _0x4d11e9={};var _0x9f2647={};var _0x2d4a04;var _0x258b71;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5b6ca7[_0x6d6d('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e3b17,null))['then'](function(_0x4d042b){if(_0x4d042b){_0x2d4a04=_0x4d042b;_0x9f2647[_0x6d6d('0x41')]=_['keys'](db[_0x6d6d('0x5a')]['rawAttributes']);_0x9f2647[_0x6d6d('0x3e')]=_[_0x6d6d('0x3f')](_0x5b6ca7['query']);_0x9f2647['filters']=_[_0x6d6d('0x40')](_0x9f2647[_0x6d6d('0x41')],_0x9f2647[_0x6d6d('0x3e')]);_0x4d11e9[_0x6d6d('0x42')]=_['intersection'](_0x9f2647[_0x6d6d('0x41')],qs[_0x6d6d('0x43')](_0x5b6ca7[_0x6d6d('0x3e')][_0x6d6d('0x43')]));_0x4d11e9['attributes']=_0x4d11e9[_0x6d6d('0x42')]['length']?_0x4d11e9['attributes']:_0x9f2647['model'];_0x4d11e9[_0x6d6d('0x5b')]=qs['sort'](_0x5b6ca7[_0x6d6d('0x3e')][_0x6d6d('0x47')]);_0x4d11e9[_0x6d6d('0x48')]=qs['filters'](_['pick'](_0x5b6ca7[_0x6d6d('0x3e')],_0x9f2647[_0x6d6d('0x49')]));if(_0x5b6ca7['query']['filter']){_0x4d11e9[_0x6d6d('0x48')]=_[_0x6d6d('0x4c')](_0x4d11e9[_0x6d6d('0x48')],{'$or':_[_0x6d6d('0x3a')](_0x4d11e9[_0x6d6d('0x42')],function(_0x1e03a4){var _0x3f9aad={};_0x3f9aad[_0x1e03a4]={'$like':'%'+_0x5b6ca7['query']['filter']+'%'};return _0x3f9aad;})});}_0x4d11e9=_['merge']({},_0x4d11e9,_0x5b6ca7['options']);return _0x2d4a04['getSubjects'](_0x4d11e9);}})['then'](function(_0x87dd34){if(_0x87dd34){_0x258b71=_0x87dd34[_0x6d6d('0x44')];if(!_0x5b6ca7[_0x6d6d('0x3e')][_0x6d6d('0x45')]('nolimit')){_0x4d11e9['limit']=qs['limit'](_0x5b6ca7[_0x6d6d('0x3e')][_0x6d6d('0x2f')]);_0x4d11e9[_0x6d6d('0x2e')]=qs[_0x6d6d('0x2e')](_0x5b6ca7['query']['offset']);}return _0x2d4a04[_0x6d6d('0x5d')](_0x4d11e9);}})[_0x6d6d('0x20')](function(_0x478ed4){if(_0x478ed4){return _0x478ed4?{'count':_0x258b71,'rows':_0x478ed4}:null;}})[_0x6d6d('0x20')](respondWithResult(_0x1e3b17,null))[_0x6d6d('0x2a')](handleError(_0x1e3b17,null));};exports[_0x6d6d('0x5e')]=function(_0x2aaf4c,_0x28ea59,_0x581027){var _0xf5586f={};var _0x50eea6={};var _0x39f986;var _0x5885c5;return db[_0x6d6d('0x4e')]['findOne']({'where':{'id':_0x2aaf4c[_0x6d6d('0x54')]['id']}})[_0x6d6d('0x20')](handleEntityNotFound(_0x28ea59,null))[_0x6d6d('0x20')](function(_0x16bc35){if(_0x16bc35){_0x39f986=_0x16bc35;_0x50eea6[_0x6d6d('0x41')]=_[_0x6d6d('0x3f')](db[_0x6d6d('0x5a')][_0x6d6d('0x3b')]);_0x50eea6[_0x6d6d('0x3e')]=_[_0x6d6d('0x3f')](_0x2aaf4c[_0x6d6d('0x3e')]);_0x50eea6[_0x6d6d('0x49')]=_[_0x6d6d('0x40')](_0x50eea6[_0x6d6d('0x41')],_0x50eea6[_0x6d6d('0x3e')]);_0xf5586f[_0x6d6d('0x42')]=_['intersection'](_0x50eea6['model'],qs[_0x6d6d('0x43')](_0x2aaf4c['query'][_0x6d6d('0x43')]));_0xf5586f[_0x6d6d('0x42')]=_0xf5586f['attributes']['length']?_0xf5586f[_0x6d6d('0x42')]:_0x50eea6['model'];_0xf5586f[_0x6d6d('0x5b')]=qs[_0x6d6d('0x47')](_0x2aaf4c[_0x6d6d('0x3e')][_0x6d6d('0x47')]);_0xf5586f[_0x6d6d('0x48')]=qs[_0x6d6d('0x49')](_[_0x6d6d('0x4a')](_0x2aaf4c[_0x6d6d('0x3e')],_0x50eea6['filters']));if(_0x2aaf4c[_0x6d6d('0x3e')][_0x6d6d('0x4b')]){_0xf5586f[_0x6d6d('0x48')]=_['merge'](_0xf5586f['where'],{'$or':_[_0x6d6d('0x3a')](_0xf5586f[_0x6d6d('0x42')],function(_0x367b64){var _0x4d8dca={};_0x4d8dca[_0x367b64]={'$like':'%'+_0x2aaf4c[_0x6d6d('0x3e')][_0x6d6d('0x4b')]+'%'};return _0x4d8dca;})});}_0xf5586f=_['merge']({},_0xf5586f,_0x2aaf4c[_0x6d6d('0x4d')]);return _0x39f986[_0x6d6d('0x5e')](_0xf5586f);}})[_0x6d6d('0x20')](function(_0x155edb){if(_0x155edb){_0x5885c5=_0x155edb[_0x6d6d('0x44')];if(!_0x2aaf4c['query'][_0x6d6d('0x45')](_0x6d6d('0x46'))){_0xf5586f['limit']=qs['limit'](_0x2aaf4c[_0x6d6d('0x3e')][_0x6d6d('0x2f')]);_0xf5586f[_0x6d6d('0x2e')]=qs[_0x6d6d('0x2e')](_0x2aaf4c['query'][_0x6d6d('0x2e')]);}return _0x39f986['getDescriptions'](_0xf5586f);}})[_0x6d6d('0x20')](function(_0x330365){if(_0x330365){return _0x330365?{'count':_0x5885c5,'rows':_0x330365}:null;}})[_0x6d6d('0x20')](respondWithResult(_0x28ea59,null))[_0x6d6d('0x2a')](handleError(_0x28ea59,null));};exports[_0x6d6d('0x5f')]=function(_0x306559,_0x39c1a5,_0x2ee087){var _0x103c3d={};var _0x2893a2={};var _0x179bbe;var _0x2809b1;return db[_0x6d6d('0x4e')][_0x6d6d('0x59')]({'where':{'id':_0x306559[_0x6d6d('0x54')]['id']}})[_0x6d6d('0x20')](handleEntityNotFound(_0x39c1a5,null))[_0x6d6d('0x20')](function(_0xccbc07){if(_0xccbc07){_0x179bbe=_0xccbc07;_0x2893a2[_0x6d6d('0x41')]=_[_0x6d6d('0x3f')](db['Tag']['rawAttributes']);_0x2893a2[_0x6d6d('0x3e')]=_[_0x6d6d('0x3f')](_0x306559[_0x6d6d('0x3e')]);_0x2893a2[_0x6d6d('0x49')]=_[_0x6d6d('0x40')](_0x2893a2[_0x6d6d('0x41')],_0x2893a2[_0x6d6d('0x3e')]);_0x103c3d[_0x6d6d('0x42')]=_[_0x6d6d('0x40')](_0x2893a2[_0x6d6d('0x41')],qs[_0x6d6d('0x43')](_0x306559[_0x6d6d('0x3e')][_0x6d6d('0x43')]));_0x103c3d[_0x6d6d('0x42')]=_0x103c3d[_0x6d6d('0x42')]['length']?_0x103c3d[_0x6d6d('0x42')]:_0x2893a2[_0x6d6d('0x41')];_0x103c3d[_0x6d6d('0x5b')]=qs['sort'](_0x306559['query']['sort']);_0x103c3d[_0x6d6d('0x48')]=qs['filters'](_['pick'](_0x306559[_0x6d6d('0x3e')],_0x2893a2[_0x6d6d('0x49')]));if(_0x306559[_0x6d6d('0x3e')][_0x6d6d('0x4b')]){_0x103c3d[_0x6d6d('0x48')]=_['merge'](_0x103c3d[_0x6d6d('0x48')],{'$or':_[_0x6d6d('0x3a')](_0x103c3d[_0x6d6d('0x42')],function(_0x1e25cd){var _0x342365={};_0x342365[_0x1e25cd]={'$like':'%'+_0x306559['query'][_0x6d6d('0x4b')]+'%'};return _0x342365;})});}_0x103c3d=_['merge']({},_0x103c3d,_0x306559[_0x6d6d('0x4d')]);return _0x179bbe['getTags'](_0x103c3d);}})[_0x6d6d('0x20')](function(_0x49bb3a){if(_0x49bb3a){_0x2809b1=_0x49bb3a[_0x6d6d('0x44')];if(!_0x306559['query'][_0x6d6d('0x45')](_0x6d6d('0x46'))){_0x103c3d['limit']=qs[_0x6d6d('0x2f')](_0x306559[_0x6d6d('0x3e')][_0x6d6d('0x2f')]);_0x103c3d[_0x6d6d('0x2e')]=qs[_0x6d6d('0x2e')](_0x306559[_0x6d6d('0x3e')]['offset']);}return _0x179bbe[_0x6d6d('0x5f')](_0x103c3d);}})[_0x6d6d('0x20')](function(_0x5a09a6){if(_0x5a09a6){return _0x5a09a6?{'count':_0x2809b1,'rows':_0x5a09a6}:null;}})[_0x6d6d('0x20')](respondWithResult(_0x39c1a5,null))[_0x6d6d('0x2a')](handleError(_0x39c1a5,null));};exports[_0x6d6d('0x60')]=function(_0x30aaf1,_0x235f13,_0x5b21ae){if(_0x30aaf1['body']['id']){delete _0x30aaf1[_0x6d6d('0x57')]['id'];}return db[_0x6d6d('0x4e')][_0x6d6d('0x59')]({'where':{'id':_0x30aaf1[_0x6d6d('0x54')]['id']}})[_0x6d6d('0x20')](handleEntityNotFound(_0x235f13,null))[_0x6d6d('0x20')](function(_0x353aa3){if(_0x353aa3){return _0x353aa3['setTags'](_0x30aaf1['body'][_0x6d6d('0x61')]||[]);}return null;})[_0x6d6d('0x20')](respondWithResult(_0x235f13,null))['catch'](handleError(_0x235f13,null));}; \ No newline at end of file +var _0x62c8=['map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','include','findAll','rows','show','params','includeAll','find','create','body','update','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','stack','name'];(function(_0x3c57c5,_0x1bcd12){var _0x3a2ac9=function(_0x185475){while(--_0x185475){_0x3c57c5['push'](_0x3c57c5['shift']());}};_0x3a2ac9(++_0x1bcd12);}(_0x62c8,0x1ad));var _0x862c=function(_0x24649d,_0x506a13){_0x24649d=_0x24649d-0x0;var _0x5ba549=_0x62c8[_0x24649d];return _0x5ba549;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x862c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x862c('0x1'));var moment=require(_0x862c('0x2'));var BPromise=require(_0x862c('0x3'));var Mustache=require(_0x862c('0x4'));var util=require(_0x862c('0x5'));var path=require(_0x862c('0x6'));var sox=require('sox');var csv=require(_0x862c('0x7'));var ejs=require(_0x862c('0x8'));var fs=require('fs');var _=require(_0x862c('0x9'));var squel=require(_0x862c('0xa'));var crypto=require(_0x862c('0xb'));var jsforce=require(_0x862c('0xc'));var deskjs=require(_0x862c('0xd'));var toCsv=require(_0x862c('0x7'));var querystring=require(_0x862c('0xe'));var Papa=require(_0x862c('0xf'));var Redis=require(_0x862c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x862c('0x11'));var as=require(_0x862c('0x12'));var hardwareService=require(_0x862c('0x13'));var logger=require(_0x862c('0x14'))(_0x862c('0x15'));var utils=require('../../config/utils');var config=require(_0x862c('0x16'));var db=require(_0x862c('0x17'))['db'];var jayson=require(_0x862c('0x18'));var client=jayson[_0x862c('0x19')][_0x862c('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xe32af7,_0xa23713,_0x41087a){if(_0x41087a){var _0x3a4e3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a4e3a[_0x862c('0x1b')](_0xa23713)){return _0xe32af7;}else{throw new db[(_0x862c('0x1c'))][(_0x862c('0x1d'))](_0x862c('0x1e'));}}else{return _0xe32af7;}}function respondWithRpcPromise(_0xc8d008,_0x3aa366,_0x5213e1,_0x2cc463){return new BPromise(function(_0x5a7f05,_0x4bb999){var _0x22aeaa=_0x2cc463||client;return _0x22aeaa['request'](_0xc8d008,_0x5213e1)[_0x862c('0x1f')](function(_0x28c2c5){logger[_0x862c('0x20')](_0x862c('0x21'),_0x3aa366,_0x862c('0x22'));logger[_0x862c('0x23')](_0x862c('0x24'),_0x3aa366,_0x862c('0x22'),JSON[_0x862c('0x25')](_0x28c2c5));if(_0x28c2c5[_0x862c('0x26')]){if(_0x28c2c5[_0x862c('0x26')][_0x862c('0x27')]===0x1f4){logger['error'](_0x862c('0x21'),_0x3aa366,_0x28c2c5[_0x862c('0x26')]['message']);return _0x4bb999(_0x28c2c5['error'][_0x862c('0x28')]);}logger[_0x862c('0x26')](_0x862c('0x21'),_0x3aa366,_0x28c2c5['error'][_0x862c('0x28')]);return _0x5a7f05(_0x28c2c5[_0x862c('0x26')][_0x862c('0x28')]);}else{logger[_0x862c('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x3aa366,_0x862c('0x22'));_0x5a7f05(_0x28c2c5[_0x862c('0x29')][_0x862c('0x28')]);}})[_0x862c('0x2a')](function(_0x405029){logger[_0x862c('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x3aa366,_0x405029);_0x4bb999(_0x405029);});});}function respondWithStatusCode(_0x1d97bc,_0x4b5331){_0x4b5331=_0x4b5331||0xcc;return function(_0x280a10){if(_0x280a10){return _0x1d97bc[_0x862c('0x2b')](_0x4b5331);}return _0x1d97bc[_0x862c('0x2c')](_0x4b5331)[_0x862c('0x2d')]();};}function respondWithResult(_0x2e16a0,_0x1a2ab3){_0x1a2ab3=_0x1a2ab3||0xc8;return function(_0x427e50){if(_0x427e50){return _0x2e16a0[_0x862c('0x2c')](_0x1a2ab3)[_0x862c('0x2e')](_0x427e50);}};}function respondWithFilteredResult(_0x35f762,_0x2bd960){return function(_0x48ac8c){if(_0x48ac8c){var _0x2405fd=_0x48ac8c[_0x862c('0x2f')],_0x522b01=_0x2bd960[_0x862c('0x30')],_0x332209=_0x2bd960[_0x862c('0x30')]+_0x2bd960[_0x862c('0x31')],_0x55bbd0;if(_0x332209>=_0x2405fd){_0x332209=_0x2405fd;_0x55bbd0=0xc8;}else{_0x55bbd0=0xce;}_0x35f762[_0x862c('0x2c')](_0x55bbd0);return _0x35f762['set'](_0x862c('0x32'),_0x522b01+'-'+_0x332209+'/'+_0x2405fd)[_0x862c('0x2e')](_0x48ac8c);}return null;};}function patchUpdates(_0x142434){return function(_0xdab54){try{jsonpatch[_0x862c('0x33')](_0xdab54,_0x142434,!![]);}catch(_0x3c6af8){return BPromise[_0x862c('0x34')](_0x3c6af8);}return _0xdab54['save']();};}function saveUpdates(_0xa44acf,_0x186dc9){return function(_0x160810){if(_0x160810){return _0x160810['update'](_0xa44acf)[_0x862c('0x1f')](function(_0x54291f){return _0x54291f;});}return null;};}function removeEntity(_0x4bfec0,_0x31cd40){return function(_0x26c9fc){if(_0x26c9fc){return _0x26c9fc[_0x862c('0x35')]()[_0x862c('0x1f')](function(){_0x4bfec0[_0x862c('0x2c')](0xcc)[_0x862c('0x2d')]();});}};}function handleEntityNotFound(_0x5c1295,_0x2525d1){return function(_0xa69940){if(!_0xa69940){_0x5c1295[_0x862c('0x2b')](0x194);}return _0xa69940;};}function handleError(_0x31187d,_0x40a7eb){_0x40a7eb=_0x40a7eb||0x1f4;return function(_0xfcff49){logger[_0x862c('0x26')](_0xfcff49[_0x862c('0x36')]);if(_0xfcff49[_0x862c('0x37')]){delete _0xfcff49['name'];}_0x31187d[_0x862c('0x2c')](_0x40a7eb)['send'](_0xfcff49);};}exports['index']=function(_0x230480,_0x3573f1){var _0x155551={},_0x1fb795={},_0x129d3f={'count':0x0,'rows':[]};var _0x3c789b=_[_0x862c('0x38')](db['DeskConfiguration'][_0x862c('0x39')],function(_0x222e8d){return{'name':_0x222e8d[_0x862c('0x3a')],'type':_0x222e8d[_0x862c('0x3b')][_0x862c('0x3c')]};});_0x1fb795[_0x862c('0x3d')]=_['map'](_0x3c789b,_0x862c('0x37'));_0x1fb795[_0x862c('0x3e')]=_[_0x862c('0x3f')](_0x230480[_0x862c('0x3e')]);_0x1fb795['filters']=_[_0x862c('0x40')](_0x1fb795[_0x862c('0x3d')],_0x1fb795['query']);_0x155551[_0x862c('0x41')]=_[_0x862c('0x40')](_0x1fb795['model'],qs[_0x862c('0x42')](_0x230480[_0x862c('0x3e')][_0x862c('0x42')]));_0x155551[_0x862c('0x41')]=_0x155551[_0x862c('0x41')][_0x862c('0x43')]?_0x155551['attributes']:_0x1fb795[_0x862c('0x3d')];if(!_0x230480['query'][_0x862c('0x44')](_0x862c('0x45'))){_0x155551[_0x862c('0x31')]=qs[_0x862c('0x31')](_0x230480[_0x862c('0x3e')]['limit']);_0x155551[_0x862c('0x30')]=qs[_0x862c('0x30')](_0x230480[_0x862c('0x3e')][_0x862c('0x30')]);}_0x155551[_0x862c('0x46')]=qs[_0x862c('0x47')](_0x230480[_0x862c('0x3e')]['sort']);_0x155551[_0x862c('0x48')]=qs[_0x862c('0x49')](_[_0x862c('0x4a')](_0x230480[_0x862c('0x3e')],_0x1fb795['filters']),_0x3c789b);if(_0x230480[_0x862c('0x3e')][_0x862c('0x4b')]){_0x155551['where']=_[_0x862c('0x4c')](_0x155551[_0x862c('0x48')],{'$or':_[_0x862c('0x38')](_0x3c789b,function(_0x57d880){if(_0x57d880[_0x862c('0x3b')]!==_0x862c('0x4d')){var _0x155ea6={};_0x155ea6[_0x57d880['name']]={'$like':'%'+_0x230480[_0x862c('0x3e')][_0x862c('0x4b')]+'%'};return _0x155ea6;}})});}_0x155551=_[_0x862c('0x4c')]({},_0x155551,_0x230480[_0x862c('0x4e')]);var _0x22caf5={'where':_0x155551[_0x862c('0x48')]};return db[_0x862c('0x4f')][_0x862c('0x2f')](_0x22caf5)[_0x862c('0x1f')](function(_0x1bca67){_0x129d3f[_0x862c('0x2f')]=_0x1bca67;if(_0x230480['query']['includeAll']){_0x155551[_0x862c('0x50')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x862c('0x51')](_0x155551);})[_0x862c('0x1f')](function(_0x5a48ad){_0x129d3f[_0x862c('0x52')]=_0x5a48ad;return _0x129d3f;})[_0x862c('0x1f')](respondWithFilteredResult(_0x3573f1,_0x155551))[_0x862c('0x2a')](handleError(_0x3573f1,null));};exports[_0x862c('0x53')]=function(_0x49e409,_0x485b2d){var _0x4de26c={'raw':![],'where':{'id':_0x49e409[_0x862c('0x54')]['id']}},_0x1716aa={};_0x1716aa[_0x862c('0x3d')]=_[_0x862c('0x3f')](db[_0x862c('0x4f')][_0x862c('0x39')]);_0x1716aa[_0x862c('0x3e')]=_['keys'](_0x49e409[_0x862c('0x3e')]);_0x1716aa['filters']=_['intersection'](_0x1716aa[_0x862c('0x3d')],_0x1716aa[_0x862c('0x3e')]);_0x4de26c[_0x862c('0x41')]=_['intersection'](_0x1716aa[_0x862c('0x3d')],qs[_0x862c('0x42')](_0x49e409[_0x862c('0x3e')][_0x862c('0x42')]));_0x4de26c['attributes']=_0x4de26c['attributes'][_0x862c('0x43')]?_0x4de26c['attributes']:_0x1716aa[_0x862c('0x3d')];if(_0x49e409[_0x862c('0x3e')][_0x862c('0x55')]){_0x4de26c[_0x862c('0x50')]=[{'all':!![]}];}_0x4de26c=_[_0x862c('0x4c')]({},_0x4de26c,_0x49e409[_0x862c('0x4e')]);return db['DeskConfiguration'][_0x862c('0x56')](_0x4de26c)[_0x862c('0x1f')](handleEntityNotFound(_0x485b2d,null))[_0x862c('0x1f')](respondWithResult(_0x485b2d,null))['catch'](handleError(_0x485b2d,null));};exports[_0x862c('0x57')]=function(_0x336bf6,_0x11b981){return db['DeskConfiguration'][_0x862c('0x57')](_0x336bf6[_0x862c('0x58')],{})[_0x862c('0x1f')](respondWithResult(_0x11b981,0xc9))[_0x862c('0x2a')](handleError(_0x11b981,null));};exports[_0x862c('0x59')]=function(_0xfaa1a0,_0x48f579){if(_0xfaa1a0[_0x862c('0x58')]['id']){delete _0xfaa1a0[_0x862c('0x58')]['id'];}return db[_0x862c('0x4f')][_0x862c('0x56')]({'where':{'id':_0xfaa1a0['params']['id']}})[_0x862c('0x1f')](handleEntityNotFound(_0x48f579,null))[_0x862c('0x1f')](saveUpdates(_0xfaa1a0[_0x862c('0x58')],null))[_0x862c('0x1f')](respondWithResult(_0x48f579,null))[_0x862c('0x2a')](handleError(_0x48f579,null));};exports[_0x862c('0x35')]=function(_0x967516,_0x30cc28){return db[_0x862c('0x4f')][_0x862c('0x56')]({'where':{'id':_0x967516[_0x862c('0x54')]['id']}})['then'](handleEntityNotFound(_0x30cc28,null))[_0x862c('0x1f')](removeEntity(_0x30cc28,null))[_0x862c('0x2a')](handleError(_0x30cc28,null));};exports[_0x862c('0x5a')]=function(_0x2f253e,_0x261741,_0x28c97f){var _0x43b5be={};var _0x35c1e6={};var _0x36596a;var _0x497c09;return db['DeskConfiguration'][_0x862c('0x5b')]({'where':{'id':_0x2f253e[_0x862c('0x54')]['id']}})['then'](handleEntityNotFound(_0x261741,null))[_0x862c('0x1f')](function(_0x100e17){if(_0x100e17){_0x36596a=_0x100e17;_0x35c1e6[_0x862c('0x3d')]=_['keys'](db['DeskField'][_0x862c('0x39')]);_0x35c1e6[_0x862c('0x3e')]=_[_0x862c('0x3f')](_0x2f253e['query']);_0x35c1e6[_0x862c('0x49')]=_[_0x862c('0x40')](_0x35c1e6[_0x862c('0x3d')],_0x35c1e6[_0x862c('0x3e')]);_0x43b5be['attributes']=_['intersection'](_0x35c1e6[_0x862c('0x3d')],qs[_0x862c('0x42')](_0x2f253e[_0x862c('0x3e')][_0x862c('0x42')]));_0x43b5be[_0x862c('0x41')]=_0x43b5be[_0x862c('0x41')]['length']?_0x43b5be['attributes']:_0x35c1e6[_0x862c('0x3d')];_0x43b5be[_0x862c('0x46')]=qs[_0x862c('0x47')](_0x2f253e[_0x862c('0x3e')]['sort']);_0x43b5be[_0x862c('0x48')]=qs[_0x862c('0x49')](_[_0x862c('0x4a')](_0x2f253e['query'],_0x35c1e6[_0x862c('0x49')]));if(_0x2f253e[_0x862c('0x3e')][_0x862c('0x4b')]){_0x43b5be[_0x862c('0x48')]=_[_0x862c('0x4c')](_0x43b5be['where'],{'$or':_[_0x862c('0x38')](_0x43b5be['attributes'],function(_0x3320fa){var _0x1c8439={};_0x1c8439[_0x3320fa]={'$like':'%'+_0x2f253e['query'][_0x862c('0x4b')]+'%'};return _0x1c8439;})});}_0x43b5be=_['merge']({},_0x43b5be,_0x2f253e['options']);return _0x36596a[_0x862c('0x5a')](_0x43b5be);}})['then'](function(_0x5fb9f3){if(_0x5fb9f3){_0x497c09=_0x5fb9f3['length'];if(!_0x2f253e[_0x862c('0x3e')][_0x862c('0x44')](_0x862c('0x45'))){_0x43b5be['limit']=qs['limit'](_0x2f253e['query'][_0x862c('0x31')]);_0x43b5be[_0x862c('0x30')]=qs[_0x862c('0x30')](_0x2f253e[_0x862c('0x3e')][_0x862c('0x30')]);}return _0x36596a[_0x862c('0x5a')](_0x43b5be);}})[_0x862c('0x1f')](function(_0x3c2f41){if(_0x3c2f41){return _0x3c2f41?{'count':_0x497c09,'rows':_0x3c2f41}:null;}})[_0x862c('0x1f')](respondWithResult(_0x261741,null))[_0x862c('0x2a')](handleError(_0x261741,null));};exports['getSubjects']=function(_0x30cd94,_0xeb5092,_0x4e091e){var _0x228f6e={};var _0x5967a3={};var _0x3d2f12;var _0x260c1d;return db['DeskConfiguration'][_0x862c('0x5b')]({'where':{'id':_0x30cd94[_0x862c('0x54')]['id']}})[_0x862c('0x1f')](handleEntityNotFound(_0xeb5092,null))[_0x862c('0x1f')](function(_0x39fe56){if(_0x39fe56){_0x3d2f12=_0x39fe56;_0x5967a3['model']=_[_0x862c('0x3f')](db[_0x862c('0x5c')][_0x862c('0x39')]);_0x5967a3[_0x862c('0x3e')]=_['keys'](_0x30cd94[_0x862c('0x3e')]);_0x5967a3[_0x862c('0x49')]=_[_0x862c('0x40')](_0x5967a3[_0x862c('0x3d')],_0x5967a3['query']);_0x228f6e[_0x862c('0x41')]=_[_0x862c('0x40')](_0x5967a3[_0x862c('0x3d')],qs['fields'](_0x30cd94[_0x862c('0x3e')]['fields']));_0x228f6e[_0x862c('0x41')]=_0x228f6e['attributes'][_0x862c('0x43')]?_0x228f6e['attributes']:_0x5967a3['model'];_0x228f6e[_0x862c('0x46')]=qs[_0x862c('0x47')](_0x30cd94[_0x862c('0x3e')][_0x862c('0x47')]);_0x228f6e[_0x862c('0x48')]=qs['filters'](_[_0x862c('0x4a')](_0x30cd94[_0x862c('0x3e')],_0x5967a3['filters']));if(_0x30cd94[_0x862c('0x3e')][_0x862c('0x4b')]){_0x228f6e[_0x862c('0x48')]=_[_0x862c('0x4c')](_0x228f6e[_0x862c('0x48')],{'$or':_['map'](_0x228f6e['attributes'],function(_0xe074e){var _0x540540={};_0x540540[_0xe074e]={'$like':'%'+_0x30cd94[_0x862c('0x3e')]['filter']+'%'};return _0x540540;})});}_0x228f6e=_[_0x862c('0x4c')]({},_0x228f6e,_0x30cd94[_0x862c('0x4e')]);return _0x3d2f12[_0x862c('0x5d')](_0x228f6e);}})[_0x862c('0x1f')](function(_0x4d981d){if(_0x4d981d){_0x260c1d=_0x4d981d[_0x862c('0x43')];if(!_0x30cd94[_0x862c('0x3e')]['hasOwnProperty'](_0x862c('0x45'))){_0x228f6e[_0x862c('0x31')]=qs[_0x862c('0x31')](_0x30cd94[_0x862c('0x3e')][_0x862c('0x31')]);_0x228f6e[_0x862c('0x30')]=qs[_0x862c('0x30')](_0x30cd94['query'][_0x862c('0x30')]);}return _0x3d2f12[_0x862c('0x5d')](_0x228f6e);}})[_0x862c('0x1f')](function(_0x49bdb0){if(_0x49bdb0){return _0x49bdb0?{'count':_0x260c1d,'rows':_0x49bdb0}:null;}})['then'](respondWithResult(_0xeb5092,null))[_0x862c('0x2a')](handleError(_0xeb5092,null));};exports[_0x862c('0x5e')]=function(_0x21b13c,_0x57c442,_0x25ea14){var _0x7478e2={};var _0x5196a6={};var _0x466210;var _0xae643f;return db[_0x862c('0x4f')]['findOne']({'where':{'id':_0x21b13c[_0x862c('0x54')]['id']}})[_0x862c('0x1f')](handleEntityNotFound(_0x57c442,null))[_0x862c('0x1f')](function(_0x7a7c1c){if(_0x7a7c1c){_0x466210=_0x7a7c1c;_0x5196a6['model']=_['keys'](db[_0x862c('0x5c')][_0x862c('0x39')]);_0x5196a6['query']=_[_0x862c('0x3f')](_0x21b13c[_0x862c('0x3e')]);_0x5196a6[_0x862c('0x49')]=_[_0x862c('0x40')](_0x5196a6[_0x862c('0x3d')],_0x5196a6[_0x862c('0x3e')]);_0x7478e2[_0x862c('0x41')]=_[_0x862c('0x40')](_0x5196a6[_0x862c('0x3d')],qs[_0x862c('0x42')](_0x21b13c[_0x862c('0x3e')][_0x862c('0x42')]));_0x7478e2[_0x862c('0x41')]=_0x7478e2[_0x862c('0x41')]['length']?_0x7478e2[_0x862c('0x41')]:_0x5196a6[_0x862c('0x3d')];_0x7478e2[_0x862c('0x46')]=qs[_0x862c('0x47')](_0x21b13c[_0x862c('0x3e')][_0x862c('0x47')]);_0x7478e2[_0x862c('0x48')]=qs[_0x862c('0x49')](_[_0x862c('0x4a')](_0x21b13c['query'],_0x5196a6[_0x862c('0x49')]));if(_0x21b13c[_0x862c('0x3e')][_0x862c('0x4b')]){_0x7478e2[_0x862c('0x48')]=_['merge'](_0x7478e2[_0x862c('0x48')],{'$or':_[_0x862c('0x38')](_0x7478e2[_0x862c('0x41')],function(_0x4207e8){var _0x5eef8e={};_0x5eef8e[_0x4207e8]={'$like':'%'+_0x21b13c[_0x862c('0x3e')][_0x862c('0x4b')]+'%'};return _0x5eef8e;})});}_0x7478e2=_[_0x862c('0x4c')]({},_0x7478e2,_0x21b13c[_0x862c('0x4e')]);return _0x466210[_0x862c('0x5e')](_0x7478e2);}})[_0x862c('0x1f')](function(_0x5caa92){if(_0x5caa92){_0xae643f=_0x5caa92['length'];if(!_0x21b13c[_0x862c('0x3e')][_0x862c('0x44')](_0x862c('0x45'))){_0x7478e2[_0x862c('0x31')]=qs[_0x862c('0x31')](_0x21b13c[_0x862c('0x3e')][_0x862c('0x31')]);_0x7478e2['offset']=qs[_0x862c('0x30')](_0x21b13c[_0x862c('0x3e')][_0x862c('0x30')]);}return _0x466210['getDescriptions'](_0x7478e2);}})['then'](function(_0x2cedf2){if(_0x2cedf2){return _0x2cedf2?{'count':_0xae643f,'rows':_0x2cedf2}:null;}})['then'](respondWithResult(_0x57c442,null))[_0x862c('0x2a')](handleError(_0x57c442,null));};exports[_0x862c('0x5f')]=function(_0x3e79a5,_0x360779,_0x3a85ce){var _0x34fc84={};var _0x4fe50b={};var _0x3f1986;var _0x509c37;return db['DeskConfiguration'][_0x862c('0x5b')]({'where':{'id':_0x3e79a5[_0x862c('0x54')]['id']}})[_0x862c('0x1f')](handleEntityNotFound(_0x360779,null))[_0x862c('0x1f')](function(_0x5b6bba){if(_0x5b6bba){_0x3f1986=_0x5b6bba;_0x4fe50b[_0x862c('0x3d')]=_[_0x862c('0x3f')](db['Tag'][_0x862c('0x39')]);_0x4fe50b[_0x862c('0x3e')]=_[_0x862c('0x3f')](_0x3e79a5[_0x862c('0x3e')]);_0x4fe50b[_0x862c('0x49')]=_[_0x862c('0x40')](_0x4fe50b[_0x862c('0x3d')],_0x4fe50b[_0x862c('0x3e')]);_0x34fc84[_0x862c('0x41')]=_['intersection'](_0x4fe50b['model'],qs[_0x862c('0x42')](_0x3e79a5[_0x862c('0x3e')][_0x862c('0x42')]));_0x34fc84['attributes']=_0x34fc84[_0x862c('0x41')][_0x862c('0x43')]?_0x34fc84['attributes']:_0x4fe50b['model'];_0x34fc84['order']=qs['sort'](_0x3e79a5[_0x862c('0x3e')]['sort']);_0x34fc84[_0x862c('0x48')]=qs['filters'](_[_0x862c('0x4a')](_0x3e79a5['query'],_0x4fe50b[_0x862c('0x49')]));if(_0x3e79a5[_0x862c('0x3e')][_0x862c('0x4b')]){_0x34fc84[_0x862c('0x48')]=_[_0x862c('0x4c')](_0x34fc84[_0x862c('0x48')],{'$or':_[_0x862c('0x38')](_0x34fc84[_0x862c('0x41')],function(_0x45e092){var _0x4b96bb={};_0x4b96bb[_0x45e092]={'$like':'%'+_0x3e79a5['query']['filter']+'%'};return _0x4b96bb;})});}_0x34fc84=_[_0x862c('0x4c')]({},_0x34fc84,_0x3e79a5[_0x862c('0x4e')]);return _0x3f1986[_0x862c('0x5f')](_0x34fc84);}})[_0x862c('0x1f')](function(_0x527e1c){if(_0x527e1c){_0x509c37=_0x527e1c['length'];if(!_0x3e79a5[_0x862c('0x3e')][_0x862c('0x44')](_0x862c('0x45'))){_0x34fc84[_0x862c('0x31')]=qs['limit'](_0x3e79a5[_0x862c('0x3e')][_0x862c('0x31')]);_0x34fc84['offset']=qs[_0x862c('0x30')](_0x3e79a5[_0x862c('0x3e')][_0x862c('0x30')]);}return _0x3f1986[_0x862c('0x5f')](_0x34fc84);}})[_0x862c('0x1f')](function(_0x3f2d1d){if(_0x3f2d1d){return _0x3f2d1d?{'count':_0x509c37,'rows':_0x3f2d1d}:null;}})[_0x862c('0x1f')](respondWithResult(_0x360779,null))['catch'](handleError(_0x360779,null));};exports['setTags']=function(_0x2b6013,_0x2fd723,_0x1b66b8){if(_0x2b6013[_0x862c('0x58')]['id']){delete _0x2b6013[_0x862c('0x58')]['id'];}return db[_0x862c('0x4f')][_0x862c('0x5b')]({'where':{'id':_0x2b6013[_0x862c('0x54')]['id']}})[_0x862c('0x1f')](handleEntityNotFound(_0x2fd723,null))[_0x862c('0x1f')](function(_0x4e0ffa){if(_0x4e0ffa){return _0x4e0ffa[_0x862c('0x60')](_0x2b6013[_0x862c('0x58')]['ids']||[]);}return null;})[_0x862c('0x1f')](respondWithResult(_0x2fd723,null))[_0x862c('0x2a')](handleError(_0x2fd723,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9dafdef..69ae9d9 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 _0x6940=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations'];(function(_0x527f3c,_0x366a65){var _0xf6ac3c=function(_0x2e5f5b){while(--_0x2e5f5b){_0x527f3c['push'](_0x527f3c['shift']());}};_0xf6ac3c(++_0x366a65);}(_0x6940,0x9a));var _0x0694=function(_0x5c1e4a,_0x5723a6){_0x5c1e4a=_0x5c1e4a-0x0;var _0x373206=_0x6940[_0x5c1e4a];return _0x373206;};'use strict';var _=require(_0x0694('0x0'));var util=require(_0x0694('0x1'));var logger=require('../../config/logger')(_0x0694('0x2'));var moment=require(_0x0694('0x3'));var BPromise=require(_0x0694('0x4'));var rp=require(_0x0694('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0694('0x6'));var config=require(_0x0694('0x7'));var attributes=require(_0x0694('0x8'));module[_0x0694('0x9')]=function(_0x486928,_0x38ede6){return _0x486928['define']('DeskConfiguration',attributes,{'tableName':_0x0694('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69b7=['./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x474f1c,_0x15cb4a){var _0x429e8f=function(_0x4333e9){while(--_0x4333e9){_0x474f1c['push'](_0x474f1c['shift']());}};_0x429e8f(++_0x15cb4a);}(_0x69b7,0x1e4));var _0x769b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x69b7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x769b('0x0'));var util=require(_0x769b('0x1'));var logger=require(_0x769b('0x2'))(_0x769b('0x3'));var moment=require(_0x769b('0x4'));var BPromise=require(_0x769b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x769b('0x6'));var rimraf=require(_0x769b('0x7'));var config=require('../../config/environment');var attributes=require(_0x769b('0x8'));module['exports']=function(_0x2679b1,_0xec06f0){return _0x2679b1[_0x769b('0x9')](_0x769b('0xa'),attributes,{'tableName':_0x769b('0xb'),'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 36b7c3c..910ef7d 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 _0xbf5c=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s'];(function(_0x3addeb,_0x87cb1a){var _0x935f20=function(_0x3adb7d){while(--_0x3adb7d){_0x3addeb['push'](_0x3addeb['shift']());}};_0x935f20(++_0x87cb1a);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x2563ec,_0x5aca47){_0x2563ec=_0x2563ec-0x0;var _0x161c21=_0xbf5c[_0x2563ec];return _0x161c21;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var moment=require(_0xcbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf5('0x3'));var fs=require('fs');var Redis=require(_0xcbf5('0x4'));var db=require(_0xcbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf5('0x6'))(_0xcbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf5('0x8'));var client=jayson[_0xcbf5('0x9')][_0xcbf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522014,_0x4504dd,_0x31b6d1){return new BPromise(function(_0x54d2d4,_0x52f784){return client[_0xcbf5('0xb')](_0x522014,_0x31b6d1)[_0xcbf5('0xc')](function(_0x230a6c){logger['info'](_0xcbf5('0xd'),_0x4504dd,_0xcbf5('0xe'));logger[_0xcbf5('0xf')](_0xcbf5('0x10'),_0x4504dd,_0xcbf5('0xe'),JSON[_0xcbf5('0x11')](_0x230a6c));if(_0x230a6c['error']){if(_0x230a6c[_0xcbf5('0x12')][_0xcbf5('0x13')]===0x1f4){logger[_0xcbf5('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x4504dd,_0x230a6c['error'][_0xcbf5('0x14')]);return _0x52f784(_0x230a6c['error'][_0xcbf5('0x14')]);}logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x230a6c[_0xcbf5('0x12')]['message']);return _0x54d2d4(_0x230a6c['error'][_0xcbf5('0x14')]);}else{logger['info'](_0xcbf5('0xd'),_0x4504dd,'request\x20sent');_0x54d2d4(_0x230a6c['result'][_0xcbf5('0x14')]);}})[_0xcbf5('0x15')](function(_0x18753e){logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x18753e);_0x52f784(_0x18753e);});});} \ No newline at end of file +var _0x0eec=['jayson/promise','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1b4418,_0x3858b3){var _0x36c1ca=function(_0x3000b8){while(--_0x3000b8){_0x1b4418['push'](_0x1b4418['shift']());}};_0x36c1ca(++_0x3858b3);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0ee('0x1'));var rs=require(_0xc0ee('0x2'));var fs=require('fs');var Redis=require(_0xc0ee('0x3'));var db=require(_0xc0ee('0x4'))['db'];var utils=require(_0xc0ee('0x5'));var logger=require(_0xc0ee('0x6'))(_0xc0ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39022a,_0x2d364d,_0x3aaca5){return new BPromise(function(_0x38b387,_0x1d9dca){return client[_0xc0ee('0xa')](_0x39022a,_0x3aaca5)['then'](function(_0x141f4a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));logger[_0xc0ee('0xe')](_0xc0ee('0xf'),_0x2d364d,_0xc0ee('0xd'),JSON['stringify'](_0x141f4a));if(_0x141f4a[_0xc0ee('0x10')]){if(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x11')]===0x1f4){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x1d9dca(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x38b387(_0x141f4a[_0xc0ee('0x10')]['message']);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));_0x38b387(_0x141f4a['result']['message']);}})[_0xc0ee('0x13')](function(_0x4dc6de){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x4dc6de);_0x1d9dca(_0x4dc6de);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index dbbe11e..d1a01c1 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 _0x7f0e=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','exports','util'];(function(_0x4d6889,_0xee0cd3){var _0x5a52e5=function(_0x37e5d5){while(--_0x37e5d5){_0x4d6889['push'](_0x4d6889['shift']());}};_0x5a52e5(++_0xee0cd3);}(_0x7f0e,0x1db));var _0xe7f0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7f0e[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xe7f0('0x0'));var path=require(_0xe7f0('0x1'));var timeout=require(_0xe7f0('0x2'));var express=require(_0xe7f0('0x3'));var router=express[_0xe7f0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7f0('0x5'));var config=require(_0xe7f0('0x6'));var controller=require('./intDeskField.controller');router[_0xe7f0('0x7')]('/',auth[_0xe7f0('0x8')](),controller[_0xe7f0('0x9')]);router[_0xe7f0('0x7')]('/:id',auth[_0xe7f0('0x8')](),controller['show']);router[_0xe7f0('0xa')]('/',auth[_0xe7f0('0x8')](),controller[_0xe7f0('0xb')]);router[_0xe7f0('0xc')](_0xe7f0('0xd'),auth[_0xe7f0('0x8')](),controller[_0xe7f0('0xe')]);router[_0xe7f0('0xf')]('/:id',auth[_0xe7f0('0x8')](),controller['destroy']);module[_0xe7f0('0x10')]=router; \ No newline at end of file +var _0x7c5e=['isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c5e,0x69));var _0xe7c5=function(_0xccbac4,_0x93e995){_0xccbac4=_0xccbac4-0x0;var _0x2a83c7=_0x7c5e[_0xccbac4];return _0x2a83c7;};'use strict';var multer=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var path=require(_0xe7c5('0x2'));var timeout=require(_0xe7c5('0x3'));var express=require(_0xe7c5('0x4'));var router=express['Router']();var auth=require(_0xe7c5('0x5'));var interaction=require(_0xe7c5('0x6'));var config=require(_0xe7c5('0x7'));var controller=require(_0xe7c5('0x8'));router['get']('/',auth[_0xe7c5('0x9')](),controller['index']);router[_0xe7c5('0xa')](_0xe7c5('0xb'),auth['isAuthenticated'](),controller[_0xe7c5('0xc')]);router[_0xe7c5('0xd')]('/',auth[_0xe7c5('0x9')](),controller['create']);router[_0xe7c5('0xe')](_0xe7c5('0xb'),auth[_0xe7c5('0x9')](),controller[_0xe7c5('0xf')]);router[_0xe7c5('0x10')](_0xe7c5('0xb'),auth[_0xe7c5('0x9')](),controller[_0xe7c5('0x11')]);module[_0xe7c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2fdc11e..1b654e2 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 _0x0a00=['STRING','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x2be753,_0x19b417){var _0x5167e4=function(_0x44187f){while(--_0x44187f){_0x2be753['push'](_0x2be753['shift']());}};_0x5167e4(++_0x19b417);}(_0x0a00,0x15b));var _0x00a0=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0a00[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0x00a0('0x0'));module[_0x00a0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x00a0('0x2'),'variable',_0x00a0('0x3'),_0x00a0('0x4')),'defaultValue':_0x00a0('0x2')},'content':{'type':Sequelize[_0x00a0('0x5')]},'key':{'type':Sequelize[_0x00a0('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x00a0('0x6'),_0x00a0('0x3'))},'keyContent':{'type':Sequelize[_0x00a0('0x5')]},'idField':{'type':Sequelize[_0x00a0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x00a0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00a0('0x5')]}}; \ No newline at end of file +var _0x8078=['customVariable','STRING','BOOLEAN','sequelize','exports','string','variable','keyValue','ENUM'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0x8078,0x11a));var _0x8807=function(_0x22e091,_0x3905e9){_0x22e091=_0x22e091-0x0;var _0x1caa8c=_0x8078[_0x22e091];return _0x1caa8c;};'use strict';var Sequelize=require(_0x8807('0x0'));module[_0x8807('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8807('0x2'),_0x8807('0x3'),'customVariable',_0x8807('0x4')),'defaultValue':_0x8807('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8807('0x5')](_0x8807('0x2'),'variable',_0x8807('0x6'))},'keyContent':{'type':Sequelize[_0x8807('0x7')]},'idField':{'type':Sequelize[_0x8807('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8807('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8807('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1c4816e..0c3bdb0 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 _0x7a3d=['findAll','rows','catch','show','params','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','include','DeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a3d,0x17b));var _0xd7a3=function(_0x5a4e26,_0x50878a){_0x5a4e26=_0x5a4e26-0x0;var _0x456fd6=_0x7a3d[_0x5a4e26];return _0x456fd6;};'use strict';var pdf=require(_0xd7a3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd7a3('0x1'));var zipdir=require(_0xd7a3('0x2'));var jsonpatch=require(_0xd7a3('0x3'));var rp=require(_0xd7a3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7a3('0x5'));var util=require(_0xd7a3('0x6'));var path=require(_0xd7a3('0x7'));var sox=require(_0xd7a3('0x8'));var csv=require(_0xd7a3('0x9'));var ejs=require(_0xd7a3('0xa'));var fs=require('fs');var _=require(_0xd7a3('0xb'));var squel=require('squel');var crypto=require(_0xd7a3('0xc'));var jsforce=require(_0xd7a3('0xd'));var deskjs=require(_0xd7a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd7a3('0xf'));var Papa=require('papaparse');var Redis=require(_0xd7a3('0x10'));var authService=require(_0xd7a3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd7a3('0x12'));var hardwareService=require(_0xd7a3('0x13'));var logger=require('../../config/logger')(_0xd7a3('0x14'));var utils=require(_0xd7a3('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x505200,_0x152a09){_0x152a09=_0x152a09||0xcc;return function(_0x1cf98b){if(_0x1cf98b){return _0x505200[_0xd7a3('0x16')](_0x152a09);}return _0x505200[_0xd7a3('0x17')](_0x152a09)[_0xd7a3('0x18')]();};}function respondWithResult(_0xc2e544,_0x33669a){_0x33669a=_0x33669a||0xc8;return function(_0x43257a){if(_0x43257a){return _0xc2e544[_0xd7a3('0x17')](_0x33669a)[_0xd7a3('0x19')](_0x43257a);}};}function respondWithFilteredResult(_0x4b02d5,_0x54eb04){return function(_0x28f4a2){if(_0x28f4a2){var _0x4d24b7=_0x28f4a2['count'],_0x10edba=_0x54eb04[_0xd7a3('0x1a')],_0x22ce29=_0x54eb04[_0xd7a3('0x1a')]+_0x54eb04[_0xd7a3('0x1b')],_0x15e003;if(_0x22ce29>=_0x4d24b7){_0x22ce29=_0x4d24b7;_0x15e003=0xc8;}else{_0x15e003=0xce;}_0x4b02d5['status'](_0x15e003);return _0x4b02d5[_0xd7a3('0x1c')](_0xd7a3('0x1d'),_0x10edba+'-'+_0x22ce29+'/'+_0x4d24b7)[_0xd7a3('0x19')](_0x28f4a2);}return null;};}function patchUpdates(_0x87c58c){return function(_0x92f3c4){try{jsonpatch[_0xd7a3('0x1e')](_0x92f3c4,_0x87c58c,!![]);}catch(_0x4f6a1c){return BPromise[_0xd7a3('0x1f')](_0x4f6a1c);}return _0x92f3c4[_0xd7a3('0x20')]();};}function saveUpdates(_0x34d5b1,_0x286322){return function(_0x3b57d4){if(_0x3b57d4){return _0x3b57d4[_0xd7a3('0x21')](_0x34d5b1)[_0xd7a3('0x22')](function(_0x2b2e2d){return _0x2b2e2d;});}return null;};}function removeEntity(_0x51645d,_0x42cbcf){return function(_0x400c95){if(_0x400c95){return _0x400c95[_0xd7a3('0x23')]()['then'](function(){_0x51645d[_0xd7a3('0x17')](0xcc)[_0xd7a3('0x18')]();});}};}function handleEntityNotFound(_0x46c47a,_0x5323b1){return function(_0x58c1f7){if(!_0x58c1f7){_0x46c47a[_0xd7a3('0x16')](0x194);}return _0x58c1f7;};}function handleError(_0x4953b6,_0x852b8e){_0x852b8e=_0x852b8e||0x1f4;return function(_0x668ec1){logger[_0xd7a3('0x24')](_0x668ec1[_0xd7a3('0x25')]);if(_0x668ec1[_0xd7a3('0x26')]){delete _0x668ec1[_0xd7a3('0x26')];}_0x4953b6['status'](_0x852b8e)[_0xd7a3('0x27')](_0x668ec1);};}exports[_0xd7a3('0x28')]=function(_0x59becd,_0x1415d6){var _0x3c460f={},_0xaf24ed={},_0xee68bb={'count':0x0,'rows':[]};var _0x48bb19=_[_0xd7a3('0x29')](db['DeskField'][_0xd7a3('0x2a')],function(_0x356308){return{'name':_0x356308[_0xd7a3('0x2b')],'type':_0x356308[_0xd7a3('0x2c')]['key']};});_0xaf24ed['model']=_['map'](_0x48bb19,'name');_0xaf24ed['query']=_[_0xd7a3('0x2d')](_0x59becd[_0xd7a3('0x2e')]);_0xaf24ed['filters']=_['intersection'](_0xaf24ed[_0xd7a3('0x2f')],_0xaf24ed['query']);_0x3c460f[_0xd7a3('0x30')]=_[_0xd7a3('0x31')](_0xaf24ed[_0xd7a3('0x2f')],qs['fields'](_0x59becd[_0xd7a3('0x2e')][_0xd7a3('0x32')]));_0x3c460f[_0xd7a3('0x30')]=_0x3c460f[_0xd7a3('0x30')][_0xd7a3('0x33')]?_0x3c460f[_0xd7a3('0x30')]:_0xaf24ed['model'];if(!_0x59becd[_0xd7a3('0x2e')][_0xd7a3('0x34')](_0xd7a3('0x35'))){_0x3c460f[_0xd7a3('0x1b')]=qs['limit'](_0x59becd[_0xd7a3('0x2e')][_0xd7a3('0x1b')]);_0x3c460f[_0xd7a3('0x1a')]=qs[_0xd7a3('0x1a')](_0x59becd['query'][_0xd7a3('0x1a')]);}_0x3c460f['order']=qs['sort'](_0x59becd[_0xd7a3('0x2e')][_0xd7a3('0x36')]);_0x3c460f[_0xd7a3('0x37')]=qs['filters'](_[_0xd7a3('0x38')](_0x59becd[_0xd7a3('0x2e')],_0xaf24ed[_0xd7a3('0x39')]),_0x48bb19);if(_0x59becd['query'][_0xd7a3('0x3a')]){_0x3c460f[_0xd7a3('0x37')]=_[_0xd7a3('0x3b')](_0x3c460f[_0xd7a3('0x37')],{'$or':_['map'](_0x48bb19,function(_0x1df762){if(_0x1df762[_0xd7a3('0x2c')]!==_0xd7a3('0x3c')){var _0x1ac21d={};_0x1ac21d[_0x1df762[_0xd7a3('0x26')]]={'$like':'%'+_0x59becd[_0xd7a3('0x2e')][_0xd7a3('0x3a')]+'%'};return _0x1ac21d;}})});}_0x3c460f=_[_0xd7a3('0x3b')]({},_0x3c460f,_0x59becd['options']);var _0x2c07db={'where':_0x3c460f[_0xd7a3('0x37')]};return db['DeskField']['count'](_0x2c07db)[_0xd7a3('0x22')](function(_0x1306f8){_0xee68bb[_0xd7a3('0x3d')]=_0x1306f8;if(_0x59becd[_0xd7a3('0x2e')][_0xd7a3('0x3e')]){_0x3c460f[_0xd7a3('0x3f')]=[{'all':!![]}];}return db[_0xd7a3('0x40')][_0xd7a3('0x41')](_0x3c460f);})[_0xd7a3('0x22')](function(_0x4f04f4){_0xee68bb[_0xd7a3('0x42')]=_0x4f04f4;return _0xee68bb;})['then'](respondWithFilteredResult(_0x1415d6,_0x3c460f))[_0xd7a3('0x43')](handleError(_0x1415d6,null));};exports[_0xd7a3('0x44')]=function(_0x46d160,_0xe20c6a){var _0x5654d5={'raw':!![],'where':{'id':_0x46d160[_0xd7a3('0x45')]['id']}},_0x37015a={};_0x37015a[_0xd7a3('0x2f')]=_[_0xd7a3('0x2d')](db[_0xd7a3('0x40')][_0xd7a3('0x2a')]);_0x37015a['query']=_[_0xd7a3('0x2d')](_0x46d160['query']);_0x37015a['filters']=_['intersection'](_0x37015a[_0xd7a3('0x2f')],_0x37015a['query']);_0x5654d5[_0xd7a3('0x30')]=_[_0xd7a3('0x31')](_0x37015a['model'],qs[_0xd7a3('0x32')](_0x46d160['query'][_0xd7a3('0x32')]));_0x5654d5[_0xd7a3('0x30')]=_0x5654d5['attributes']['length']?_0x5654d5[_0xd7a3('0x30')]:_0x37015a['model'];if(_0x46d160[_0xd7a3('0x2e')][_0xd7a3('0x3e')]){_0x5654d5['include']=[{'all':!![]}];}_0x5654d5=_['merge']({},_0x5654d5,_0x46d160[_0xd7a3('0x46')]);return db[_0xd7a3('0x40')][_0xd7a3('0x47')](_0x5654d5)['then'](handleEntityNotFound(_0xe20c6a,null))['then'](respondWithResult(_0xe20c6a,null))[_0xd7a3('0x43')](handleError(_0xe20c6a,null));};exports[_0xd7a3('0x48')]=function(_0x967da3,_0x4abdf1){return db[_0xd7a3('0x40')]['create'](_0x967da3['body'],{})['then'](respondWithResult(_0x4abdf1,0xc9))[_0xd7a3('0x43')](handleError(_0x4abdf1,null));};exports[_0xd7a3('0x21')]=function(_0x4c8e14,_0x3ff19d){if(_0x4c8e14[_0xd7a3('0x49')]['id']){delete _0x4c8e14[_0xd7a3('0x49')]['id'];}return db[_0xd7a3('0x40')]['find']({'where':{'id':_0x4c8e14[_0xd7a3('0x45')]['id']}})[_0xd7a3('0x22')](handleEntityNotFound(_0x3ff19d,null))[_0xd7a3('0x22')](saveUpdates(_0x4c8e14[_0xd7a3('0x49')],null))[_0xd7a3('0x22')](respondWithResult(_0x3ff19d,null))['catch'](handleError(_0x3ff19d,null));};exports[_0xd7a3('0x23')]=function(_0x2082a4,_0xa9bad0){return db[_0xd7a3('0x40')][_0xd7a3('0x47')]({'where':{'id':_0x2082a4[_0xd7a3('0x45')]['id']}})['then'](handleEntityNotFound(_0xa9bad0,null))[_0xd7a3('0x22')](removeEntity(_0xa9bad0,null))[_0xd7a3('0x43')](handleError(_0xa9bad0,null));}; \ No newline at end of file +var _0xb263=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','update','then','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','model','map','query','filters'];(function(_0x43d758,_0x1e0034){var _0x489121=function(_0x452a92){while(--_0x452a92){_0x43d758['push'](_0x43d758['shift']());}};_0x489121(++_0x1e0034);}(_0xb263,0x180));var _0x3b26=function(_0x1ab0f4,_0xb04a44){_0x1ab0f4=_0x1ab0f4-0x0;var _0x51b885=_0xb263[_0x1ab0f4];return _0x51b885;};'use strict';var pdf=require(_0x3b26('0x0'));var emlformat=require(_0x3b26('0x1'));var rimraf=require(_0x3b26('0x2'));var zipdir=require(_0x3b26('0x3'));var jsonpatch=require(_0x3b26('0x4'));var rp=require(_0x3b26('0x5'));var moment=require(_0x3b26('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3b26('0x7'));var path=require(_0x3b26('0x8'));var sox=require('sox');var csv=require(_0x3b26('0x9'));var ejs=require(_0x3b26('0xa'));var fs=require('fs');var _=require(_0x3b26('0xb'));var squel=require(_0x3b26('0xc'));var crypto=require(_0x3b26('0xd'));var jsforce=require(_0x3b26('0xe'));var deskjs=require(_0x3b26('0xf'));var toCsv=require(_0x3b26('0x9'));var querystring=require('querystring');var Papa=require(_0x3b26('0x10'));var Redis=require(_0x3b26('0x11'));var authService=require(_0x3b26('0x12'));var qs=require(_0x3b26('0x13'));var as=require(_0x3b26('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3b26('0x15'));var config=require(_0x3b26('0x16'));var db=require(_0x3b26('0x17'))['db'];function respondWithStatusCode(_0x11ab65,_0x4f609d){_0x4f609d=_0x4f609d||0xcc;return function(_0x4388db){if(_0x4388db){return _0x11ab65[_0x3b26('0x18')](_0x4f609d);}return _0x11ab65['status'](_0x4f609d)[_0x3b26('0x19')]();};}function respondWithResult(_0x29c869,_0x40524c){_0x40524c=_0x40524c||0xc8;return function(_0x2fa536){if(_0x2fa536){return _0x29c869[_0x3b26('0x1a')](_0x40524c)[_0x3b26('0x1b')](_0x2fa536);}};}function respondWithFilteredResult(_0xf73785,_0x363593){return function(_0x27a689){if(_0x27a689){var _0xdd1ca2=_0x27a689[_0x3b26('0x1c')],_0x7704a3=_0x363593[_0x3b26('0x1d')],_0x456eb8=_0x363593[_0x3b26('0x1d')]+_0x363593[_0x3b26('0x1e')],_0x346b49;if(_0x456eb8>=_0xdd1ca2){_0x456eb8=_0xdd1ca2;_0x346b49=0xc8;}else{_0x346b49=0xce;}_0xf73785[_0x3b26('0x1a')](_0x346b49);return _0xf73785[_0x3b26('0x1f')]('Content-Range',_0x7704a3+'-'+_0x456eb8+'/'+_0xdd1ca2)[_0x3b26('0x1b')](_0x27a689);}return null;};}function patchUpdates(_0x19b61a){return function(_0x18149c){try{jsonpatch[_0x3b26('0x20')](_0x18149c,_0x19b61a,!![]);}catch(_0x1d0ec1){return BPromise['reject'](_0x1d0ec1);}return _0x18149c['save']();};}function saveUpdates(_0x405749,_0xa87b01){return function(_0x3d946c){if(_0x3d946c){return _0x3d946c[_0x3b26('0x21')](_0x405749)[_0x3b26('0x22')](function(_0x8ae85c){return _0x8ae85c;});}return null;};}function removeEntity(_0x383dc9,_0x31a3f7){return function(_0xca2413){if(_0xca2413){return _0xca2413['destroy']()[_0x3b26('0x22')](function(){_0x383dc9[_0x3b26('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x402f62,_0x382f71){return function(_0x29a75a){if(!_0x29a75a){_0x402f62[_0x3b26('0x18')](0x194);}return _0x29a75a;};}function handleError(_0x47a709,_0x1e1ff0){_0x1e1ff0=_0x1e1ff0||0x1f4;return function(_0x5026d9){logger[_0x3b26('0x23')](_0x5026d9[_0x3b26('0x24')]);if(_0x5026d9['name']){delete _0x5026d9[_0x3b26('0x25')];}_0x47a709[_0x3b26('0x1a')](_0x1e1ff0)[_0x3b26('0x26')](_0x5026d9);};}exports[_0x3b26('0x27')]=function(_0x512001,_0x5c016f){var _0x10ddbe={},_0x1b4226={},_0x5c892d={'count':0x0,'rows':[]};var _0x1b2e2b=_['map'](db[_0x3b26('0x28')][_0x3b26('0x29')],function(_0x45204a){return{'name':_0x45204a[_0x3b26('0x2a')],'type':_0x45204a[_0x3b26('0x2b')]['key']};});_0x1b4226[_0x3b26('0x2c')]=_[_0x3b26('0x2d')](_0x1b2e2b,_0x3b26('0x25'));_0x1b4226[_0x3b26('0x2e')]=_['keys'](_0x512001['query']);_0x1b4226[_0x3b26('0x2f')]=_[_0x3b26('0x30')](_0x1b4226[_0x3b26('0x2c')],_0x1b4226[_0x3b26('0x2e')]);_0x10ddbe['attributes']=_[_0x3b26('0x30')](_0x1b4226[_0x3b26('0x2c')],qs[_0x3b26('0x31')](_0x512001[_0x3b26('0x2e')][_0x3b26('0x31')]));_0x10ddbe[_0x3b26('0x32')]=_0x10ddbe[_0x3b26('0x32')][_0x3b26('0x33')]?_0x10ddbe[_0x3b26('0x32')]:_0x1b4226[_0x3b26('0x2c')];if(!_0x512001['query'][_0x3b26('0x34')](_0x3b26('0x35'))){_0x10ddbe[_0x3b26('0x1e')]=qs[_0x3b26('0x1e')](_0x512001[_0x3b26('0x2e')]['limit']);_0x10ddbe[_0x3b26('0x1d')]=qs[_0x3b26('0x1d')](_0x512001[_0x3b26('0x2e')][_0x3b26('0x1d')]);}_0x10ddbe['order']=qs[_0x3b26('0x36')](_0x512001[_0x3b26('0x2e')][_0x3b26('0x36')]);_0x10ddbe[_0x3b26('0x37')]=qs['filters'](_[_0x3b26('0x38')](_0x512001[_0x3b26('0x2e')],_0x1b4226[_0x3b26('0x2f')]),_0x1b2e2b);if(_0x512001[_0x3b26('0x2e')][_0x3b26('0x39')]){_0x10ddbe[_0x3b26('0x37')]=_['merge'](_0x10ddbe[_0x3b26('0x37')],{'$or':_[_0x3b26('0x2d')](_0x1b2e2b,function(_0x16619e){if(_0x16619e[_0x3b26('0x2b')]!==_0x3b26('0x3a')){var _0x253000={};_0x253000[_0x16619e[_0x3b26('0x25')]]={'$like':'%'+_0x512001[_0x3b26('0x2e')][_0x3b26('0x39')]+'%'};return _0x253000;}})});}_0x10ddbe=_[_0x3b26('0x3b')]({},_0x10ddbe,_0x512001[_0x3b26('0x3c')]);var _0x4998b3={'where':_0x10ddbe[_0x3b26('0x37')]};return db['DeskField']['count'](_0x4998b3)[_0x3b26('0x22')](function(_0x24d195){_0x5c892d[_0x3b26('0x1c')]=_0x24d195;if(_0x512001['query'][_0x3b26('0x3d')]){_0x10ddbe[_0x3b26('0x3e')]=[{'all':!![]}];}return db['DeskField'][_0x3b26('0x3f')](_0x10ddbe);})[_0x3b26('0x22')](function(_0xc82b1a){_0x5c892d['rows']=_0xc82b1a;return _0x5c892d;})[_0x3b26('0x22')](respondWithFilteredResult(_0x5c016f,_0x10ddbe))[_0x3b26('0x40')](handleError(_0x5c016f,null));};exports[_0x3b26('0x41')]=function(_0xb230ee,_0x174a08){var _0x4f5f93={'raw':!![],'where':{'id':_0xb230ee[_0x3b26('0x42')]['id']}},_0x146ca3={};_0x146ca3[_0x3b26('0x2c')]=_[_0x3b26('0x43')](db['DeskField'][_0x3b26('0x29')]);_0x146ca3['query']=_[_0x3b26('0x43')](_0xb230ee[_0x3b26('0x2e')]);_0x146ca3[_0x3b26('0x2f')]=_[_0x3b26('0x30')](_0x146ca3[_0x3b26('0x2c')],_0x146ca3[_0x3b26('0x2e')]);_0x4f5f93[_0x3b26('0x32')]=_[_0x3b26('0x30')](_0x146ca3[_0x3b26('0x2c')],qs[_0x3b26('0x31')](_0xb230ee[_0x3b26('0x2e')][_0x3b26('0x31')]));_0x4f5f93[_0x3b26('0x32')]=_0x4f5f93['attributes'][_0x3b26('0x33')]?_0x4f5f93['attributes']:_0x146ca3[_0x3b26('0x2c')];if(_0xb230ee[_0x3b26('0x2e')]['includeAll']){_0x4f5f93[_0x3b26('0x3e')]=[{'all':!![]}];}_0x4f5f93=_[_0x3b26('0x3b')]({},_0x4f5f93,_0xb230ee[_0x3b26('0x3c')]);return db['DeskField'][_0x3b26('0x44')](_0x4f5f93)[_0x3b26('0x22')](handleEntityNotFound(_0x174a08,null))[_0x3b26('0x22')](respondWithResult(_0x174a08,null))['catch'](handleError(_0x174a08,null));};exports[_0x3b26('0x45')]=function(_0x183799,_0x4eacec){return db[_0x3b26('0x28')][_0x3b26('0x45')](_0x183799[_0x3b26('0x46')],{})[_0x3b26('0x22')](respondWithResult(_0x4eacec,0xc9))[_0x3b26('0x40')](handleError(_0x4eacec,null));};exports[_0x3b26('0x21')]=function(_0x2e34de,_0x596fd2){if(_0x2e34de['body']['id']){delete _0x2e34de[_0x3b26('0x46')]['id'];}return db[_0x3b26('0x28')][_0x3b26('0x44')]({'where':{'id':_0x2e34de['params']['id']}})[_0x3b26('0x22')](handleEntityNotFound(_0x596fd2,null))[_0x3b26('0x22')](saveUpdates(_0x2e34de[_0x3b26('0x46')],null))['then'](respondWithResult(_0x596fd2,null))['catch'](handleError(_0x596fd2,null));};exports[_0x3b26('0x47')]=function(_0x403c6a,_0x111f92){return db[_0x3b26('0x28')][_0x3b26('0x44')]({'where':{'id':_0x403c6a[_0x3b26('0x42')]['id']}})[_0x3b26('0x22')](handleEntityNotFound(_0x111f92,null))[_0x3b26('0x22')](removeEntity(_0x111f92,null))['catch'](handleError(_0x111f92,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7cc7df2..c5b3635 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 _0x159e=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x11ad20,_0x1ce754){var _0x4dde4c=function(_0x5644f7){while(--_0x5644f7){_0x11ad20['push'](_0x11ad20['shift']());}};_0x4dde4c(++_0x1ce754);}(_0x159e,0x134));var _0xe159=function(_0x455aae,_0x48914f){_0x455aae=_0x455aae-0x0;var _0x1af325=_0x159e[_0x455aae];return _0x1af325;};'use strict';var _=require(_0xe159('0x0'));var util=require(_0xe159('0x1'));var logger=require(_0xe159('0x2'))('api');var moment=require(_0xe159('0x3'));var BPromise=require(_0xe159('0x4'));var rp=require(_0xe159('0x5'));var fs=require('fs');var path=require(_0xe159('0x6'));var rimraf=require(_0xe159('0x7'));var config=require(_0xe159('0x8'));var attributes=require(_0xe159('0x9'));module[_0xe159('0xa')]=function(_0x21b7aa,_0x41ca0f){return _0x21b7aa[_0xe159('0xb')](_0xe159('0xc'),attributes,{'tableName':_0xe159('0xd'),'paranoid':![],'indexes':[{'name':_0xe159('0xe'),'fields':[_0xe159('0xf'),_0xe159('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9af2=['idField','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x5495fc,_0x268c40){var _0x1c549e=function(_0x11ccb8){while(--_0x11ccb8){_0x5495fc['push'](_0x5495fc['shift']());}};_0x1c549e(++_0x268c40);}(_0x9af2,0x1eb));var _0x29af=function(_0x713928,_0x35b800){_0x713928=_0x713928-0x0;var _0xea9b39=_0x9af2[_0x713928];return _0xea9b39;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x29af('0x0'))(_0x29af('0x1'));var moment=require(_0x29af('0x2'));var BPromise=require(_0x29af('0x3'));var rp=require(_0x29af('0x4'));var fs=require('fs');var path=require(_0x29af('0x5'));var rimraf=require('rimraf');var config=require(_0x29af('0x6'));var attributes=require(_0x29af('0x7'));module[_0x29af('0x8')]=function(_0x11b08f,_0x4e7a7c){return _0x11b08f[_0x29af('0x9')](_0x29af('0xa'),attributes,{'tableName':_0x29af('0xb'),'paranoid':![],'indexes':[{'name':_0x29af('0xc'),'fields':[_0x29af('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index c4c815d..41643e0 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 _0x41b0=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3f679e,_0x165aa4){var _0x3a6382=function(_0xfae6c5){while(--_0xfae6c5){_0x3f679e['push'](_0x3f679e['shift']());}};_0x3a6382(++_0x165aa4);}(_0x41b0,0xa2));var _0x041b=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x41b0[_0x5712f8];return _0x14a364;};'use strict';var _=require(_0x041b('0x0'));var util=require(_0x041b('0x1'));var moment=require(_0x041b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x041b('0x3'));var logger=require(_0x041b('0x4'))('rpc');var config=require(_0x041b('0x5'));var jayson=require(_0x041b('0x6'));var client=jayson[_0x041b('0x7')][_0x041b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x113ccb,_0x3e46b5,_0x32efa1){return new BPromise(function(_0x21bc25,_0x311066){return client[_0x041b('0x9')](_0x113ccb,_0x32efa1)[_0x041b('0xa')](function(_0x2ba8eb){logger[_0x041b('0xb')](_0x041b('0xc'),_0x3e46b5,_0x041b('0xd'));logger[_0x041b('0xe')](_0x041b('0xf'),_0x3e46b5,_0x041b('0xd'),JSON[_0x041b('0x10')](_0x2ba8eb));if(_0x2ba8eb['error']){if(_0x2ba8eb[_0x041b('0x11')][_0x041b('0x12')]===0x1f4){logger['error'](_0x041b('0xc'),_0x3e46b5,_0x2ba8eb[_0x041b('0x11')]['message']);return _0x311066(_0x2ba8eb[_0x041b('0x11')][_0x041b('0x13')]);}logger[_0x041b('0x11')](_0x041b('0xc'),_0x3e46b5,_0x2ba8eb[_0x041b('0x11')][_0x041b('0x13')]);return _0x21bc25(_0x2ba8eb[_0x041b('0x11')][_0x041b('0x13')]);}else{logger[_0x041b('0xb')](_0x041b('0xc'),_0x3e46b5,_0x041b('0xd'));_0x21bc25(_0x2ba8eb[_0x041b('0x14')]['message']);}})[_0x041b('0x15')](function(_0x530372){logger[_0x041b('0x11')](_0x041b('0xc'),_0x3e46b5,_0x530372);_0x311066(_0x530372);});});} \ No newline at end of file +var _0xb637=['info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','DeskField,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xcab3a0,_0x2a50d0){var _0x809b33=function(_0x559397){while(--_0x559397){_0xcab3a0['push'](_0xcab3a0['shift']());}};_0x809b33(++_0x2a50d0);}(_0xb637,0xff));var _0x7b63=function(_0x436b9f,_0x5cb0ed){_0x436b9f=_0x436b9f-0x0;var _0x5b621c=_0xb637[_0x436b9f];return _0x5b621c;};'use strict';var _=require(_0x7b63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b63('0x1'));var fs=require('fs');var Redis=require(_0x7b63('0x2'));var db=require(_0x7b63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b63('0x4'))(_0x7b63('0x5'));var config=require(_0x7b63('0x6'));var jayson=require(_0x7b63('0x7'));var client=jayson[_0x7b63('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288fb3,_0xbe0bc3,_0x1fe70f){return new BPromise(function(_0x7e60aa,_0x270bf1){return client[_0x7b63('0x9')](_0x288fb3,_0x1fe70f)[_0x7b63('0xa')](function(_0x1cd458){logger[_0x7b63('0xb')]('DeskField,\x20%s,\x20%s',_0xbe0bc3,_0x7b63('0xc'));logger[_0x7b63('0xd')](_0x7b63('0xe'),_0xbe0bc3,_0x7b63('0xc'),JSON['stringify'](_0x1cd458));if(_0x1cd458[_0x7b63('0xf')]){if(_0x1cd458[_0x7b63('0xf')]['code']===0x1f4){logger[_0x7b63('0xf')](_0x7b63('0x10'),_0xbe0bc3,_0x1cd458[_0x7b63('0xf')][_0x7b63('0x11')]);return _0x270bf1(_0x1cd458[_0x7b63('0xf')]['message']);}logger[_0x7b63('0xf')]('DeskField,\x20%s,\x20%s',_0xbe0bc3,_0x1cd458[_0x7b63('0xf')][_0x7b63('0x11')]);return _0x7e60aa(_0x1cd458[_0x7b63('0xf')]['message']);}else{logger[_0x7b63('0xb')](_0x7b63('0x10'),_0xbe0bc3,_0x7b63('0xc'));_0x7e60aa(_0x1cd458[_0x7b63('0x12')][_0x7b63('0x11')]);}})['catch'](function(_0x310ce2){logger[_0x7b63('0xf')](_0x7b63('0x10'),_0xbe0bc3,_0x310ce2);_0x270bf1(_0x310ce2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 763fe7e..7b80eba 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 _0x68df=['index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x303460,_0x454848){var _0x2eab04=function(_0x5295fe){while(--_0x5295fe){_0x303460['push'](_0x303460['shift']());}};_0x2eab04(++_0x454848);}(_0x68df,0xad));var _0xf68d=function(_0x2051c5,_0x3d235c){_0x2051c5=_0x2051c5-0x0;var _0x146f60=_0x68df[_0x2051c5];return _0x146f60;};'use strict';var multer=require(_0xf68d('0x0'));var util=require(_0xf68d('0x1'));var path=require(_0xf68d('0x2'));var timeout=require(_0xf68d('0x3'));var express=require(_0xf68d('0x4'));var router=express[_0xf68d('0x5')]();var auth=require(_0xf68d('0x6'));var interaction=require(_0xf68d('0x7'));var config=require(_0xf68d('0x8'));var controller=require('./intDynamics365Account.controller');router[_0xf68d('0x9')]('/',auth[_0xf68d('0xa')](),controller[_0xf68d('0xb')]);router[_0xf68d('0x9')]('/:id',auth[_0xf68d('0xa')](),controller[_0xf68d('0xc')]);router[_0xf68d('0x9')](_0xf68d('0xd'),auth[_0xf68d('0xa')](),controller[_0xf68d('0xe')]);router[_0xf68d('0x9')](_0xf68d('0xf'),auth[_0xf68d('0xa')](),controller['getFields']);router[_0xf68d('0x10')]('/',auth[_0xf68d('0xa')](),controller[_0xf68d('0x11')]);router['post'](_0xf68d('0xd'),auth['isAuthenticated'](),controller[_0xf68d('0x12')]);router[_0xf68d('0x13')]('/:id',auth[_0xf68d('0xa')](),controller['update']);router['delete'](_0xf68d('0x14'),auth[_0xf68d('0xa')](),controller[_0xf68d('0x15')]);module[_0xf68d('0x16')]=router; \ No newline at end of file +var _0x3064=['isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3064,0xc6));var _0x4306=function(_0x206f65,_0x236430){_0x206f65=_0x206f65-0x0;var _0x18e881=_0x3064[_0x206f65];return _0x18e881;};'use strict';var multer=require(_0x4306('0x0'));var util=require(_0x4306('0x1'));var path=require('path');var timeout=require(_0x4306('0x2'));var express=require(_0x4306('0x3'));var router=express[_0x4306('0x4')]();var auth=require(_0x4306('0x5'));var interaction=require(_0x4306('0x6'));var config=require(_0x4306('0x7'));var controller=require(_0x4306('0x8'));router['get']('/',auth[_0x4306('0x9')](),controller[_0x4306('0xa')]);router[_0x4306('0xb')](_0x4306('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4306('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4306('0xd')]);router[_0x4306('0xb')](_0x4306('0xe'),auth[_0x4306('0x9')](),controller['getFields']);router[_0x4306('0xf')]('/',auth[_0x4306('0x9')](),controller[_0x4306('0x10')]);router[_0x4306('0xf')](_0x4306('0x11'),auth[_0x4306('0x9')](),controller[_0x4306('0x12')]);router[_0x4306('0x13')](_0x4306('0xc'),auth[_0x4306('0x9')](),controller[_0x4306('0x14')]);router[_0x4306('0x15')](_0x4306('0xc'),auth[_0x4306('0x9')](),controller[_0x4306('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 79ab6cd..ced2077 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 _0x1db3=['exports','STRING','sequelize'];(function(_0x45fa41,_0x138ffa){var _0x4ecd20=function(_0x511be1){while(--_0x511be1){_0x45fa41['push'](_0x45fa41['shift']());}};_0x4ecd20(++_0x138ffa);}(_0x1db3,0x15e));var _0x31db=function(_0x580b38,_0xa87039){_0x580b38=_0x580b38-0x0;var _0xd49824=_0x1db3[_0x580b38];return _0xd49824;};'use strict';var Sequelize=require(_0x31db('0x0'));module[_0x31db('0x1')]={'name':{'type':Sequelize[_0x31db('0x2')]},'username':{'type':Sequelize[_0x31db('0x2')]},'password':{'type':Sequelize[_0x31db('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x31db('0x2')]},'clientSecret':{'type':Sequelize[_0x31db('0x2')]},'serverUrl':{'type':Sequelize[_0x31db('0x2')]},'description':{'type':Sequelize[_0x31db('0x2')]}}; \ No newline at end of file +var _0x3b97=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b97,0xa6));var _0x73b9=function(_0x42d13f,_0x1e14d4){_0x42d13f=_0x42d13f-0x0;var _0x31f7ff=_0x3b97[_0x42d13f];return _0x31f7ff;};'use strict';var Sequelize=require(_0x73b9('0x0'));module[_0x73b9('0x1')]={'name':{'type':Sequelize[_0x73b9('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x73b9('0x2')]},'remoteUri':{'type':Sequelize[_0x73b9('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x73b9('0x2')]},'clientSecret':{'type':Sequelize[_0x73b9('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x73b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 603cf79..93d347d 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 _0xffae=['PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','ValidationError','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','include','findAll','rows','catch','show','keys','includeAll','merge','options','create','body','find','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','ticketType','incident','Incident','title','description','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','tenantId','clientId','clientSecret','slice','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','substring','lastIndexOf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xffae,0xe5));var _0xeffa=function(_0x3ffbe7,_0x285590){_0x3ffbe7=_0x3ffbe7-0x0;var _0x523639=_0xffae[_0x3ffbe7];return _0x523639;};'use strict';var pdf=require(_0xeffa('0x0'));var emlformat=require(_0xeffa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeffa('0x2'));var jsonpatch=require(_0xeffa('0x3'));var rp=require(_0xeffa('0x4'));var moment=require('moment');var BPromise=require(_0xeffa('0x5'));var Mustache=require('mustache');var util=require(_0xeffa('0x6'));var path=require(_0xeffa('0x7'));var sox=require(_0xeffa('0x8'));var csv=require(_0xeffa('0x9'));var ejs=require(_0xeffa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeffa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeffa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeffa('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeffa('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeffa('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xeffa('0x10'));var db=require(_0xeffa('0x11'))['db'];var integrations=require(_0xeffa('0x12'));var jayson=require(_0xeffa('0x13'));var client=jayson['client'][_0xeffa('0x14')]({'port':0x232a});function checkPasswordPattern(_0x376b95,_0x201c43,_0x313506){if(_0x313506){var _0x37cf52=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37cf52[_0xeffa('0x15')](_0x201c43)){return _0x376b95;}else{throw new db['Sequelize'][(_0xeffa('0x16'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x376b95;}}function respondWithRpcPromise(_0x5edaa9,_0xb0b25c,_0x30fa0c,_0x8358b9){return new BPromise(function(_0x416c19,_0x2b4584){var _0x5cf81b=_0x8358b9||client;return _0x5cf81b[_0xeffa('0x17')](_0x5edaa9,_0x30fa0c)['then'](function(_0x46e624){logger[_0xeffa('0x18')]('Dynamics365Account,\x20%s,\x20%s',_0xb0b25c,_0xeffa('0x19'));logger[_0xeffa('0x1a')](_0xeffa('0x1b'),_0xb0b25c,_0xeffa('0x19'),JSON['stringify'](_0x46e624));if(_0x46e624['error']){if(_0x46e624[_0xeffa('0x1c')][_0xeffa('0x1d')]===0x1f4){logger['error'](_0xeffa('0x1e'),_0xb0b25c,_0x46e624[_0xeffa('0x1c')][_0xeffa('0x1f')]);return _0x2b4584(_0x46e624[_0xeffa('0x1c')]['message']);}logger['error'](_0xeffa('0x1e'),_0xb0b25c,_0x46e624['error'][_0xeffa('0x1f')]);return _0x416c19(_0x46e624['error'][_0xeffa('0x1f')]);}else{logger[_0xeffa('0x18')](_0xeffa('0x1e'),_0xb0b25c,_0xeffa('0x19'));_0x416c19(_0x46e624[_0xeffa('0x20')][_0xeffa('0x1f')]);}})['catch'](function(_0x56217a){logger['error'](_0xeffa('0x1e'),_0xb0b25c,_0x56217a);_0x2b4584(_0x56217a);});});}function respondWithStatusCode(_0x27b10c,_0xb89200){_0xb89200=_0xb89200||0xcc;return function(_0x2df0e9){if(_0x2df0e9){return _0x27b10c[_0xeffa('0x21')](_0xb89200);}return _0x27b10c[_0xeffa('0x22')](_0xb89200)[_0xeffa('0x23')]();};}function respondWithResult(_0x3eb4e8,_0x11deb9){_0x11deb9=_0x11deb9||0xc8;return function(_0x5aa49b){if(_0x5aa49b){return _0x3eb4e8[_0xeffa('0x22')](_0x11deb9)['json'](_0x5aa49b);}};}function respondWithFilteredResult(_0x536149,_0x325cdb){return function(_0x337e53){if(_0x337e53){var _0x21c027=_0x337e53[_0xeffa('0x24')],_0x1a00c1=_0x325cdb[_0xeffa('0x25')],_0x134f08=_0x325cdb[_0xeffa('0x25')]+_0x325cdb[_0xeffa('0x26')],_0x4f3e09;if(_0x134f08>=_0x21c027){_0x134f08=_0x21c027;_0x4f3e09=0xc8;}else{_0x4f3e09=0xce;}_0x536149[_0xeffa('0x22')](_0x4f3e09);return _0x536149[_0xeffa('0x27')](_0xeffa('0x28'),_0x1a00c1+'-'+_0x134f08+'/'+_0x21c027)['json'](_0x337e53);}return null;};}function patchUpdates(_0x21774f){return function(_0x43d0fa){try{jsonpatch[_0xeffa('0x29')](_0x43d0fa,_0x21774f,!![]);}catch(_0x4aa661){return BPromise[_0xeffa('0x2a')](_0x4aa661);}return _0x43d0fa[_0xeffa('0x2b')]();};}function saveUpdates(_0x233777,_0x25c0fc){return function(_0x34840f){if(_0x34840f){return _0x34840f['update'](_0x233777)[_0xeffa('0x2c')](function(_0x2fb6fd){return _0x2fb6fd;});}return null;};}function removeEntity(_0x5456b4,_0x43c89f){return function(_0x5dcb0c){if(_0x5dcb0c){return _0x5dcb0c['destroy']()[_0xeffa('0x2c')](function(){_0x5456b4[_0xeffa('0x22')](0xcc)[_0xeffa('0x23')]();});}};}function handleEntityNotFound(_0x38d858,_0x361aa6){return function(_0x5c10be){if(!_0x5c10be){_0x38d858[_0xeffa('0x21')](0x194);}return _0x5c10be;};}function handleError(_0x593c8d,_0x357101){_0x357101=_0x357101||0x1f4;return function(_0x482144){logger[_0xeffa('0x1c')](_0x482144[_0xeffa('0x2d')]);if(_0x482144[_0xeffa('0x2e')]){delete _0x482144[_0xeffa('0x2e')];}_0x593c8d[_0xeffa('0x22')](_0x357101)[_0xeffa('0x2f')](_0x482144);};}exports[_0xeffa('0x30')]=function(_0x4aa854,_0x3240d3){var _0x1e0fcc={},_0x1e482c={},_0x28278d={'count':0x0,'rows':[]};var _0x1acbb8=_[_0xeffa('0x31')](db[_0xeffa('0x32')][_0xeffa('0x33')],function(_0x3d6a5b){return{'name':_0x3d6a5b['fieldName'],'type':_0x3d6a5b[_0xeffa('0x34')][_0xeffa('0x35')]};});_0x1e482c[_0xeffa('0x36')]=_['map'](_0x1acbb8,'name');_0x1e482c['query']=_['keys'](_0x4aa854['query']);_0x1e482c[_0xeffa('0x37')]=_[_0xeffa('0x38')](_0x1e482c[_0xeffa('0x36')],_0x1e482c[_0xeffa('0x39')]);_0x1e0fcc[_0xeffa('0x3a')]=_[_0xeffa('0x38')](_0x1e482c[_0xeffa('0x36')],qs[_0xeffa('0x3b')](_0x4aa854[_0xeffa('0x39')]['fields']));_0x1e0fcc[_0xeffa('0x3a')]=_0x1e0fcc['attributes'][_0xeffa('0x3c')]?_0x1e0fcc[_0xeffa('0x3a')]:_0x1e482c[_0xeffa('0x36')];if(!_0x4aa854[_0xeffa('0x39')][_0xeffa('0x3d')](_0xeffa('0x3e'))){_0x1e0fcc[_0xeffa('0x26')]=qs['limit'](_0x4aa854[_0xeffa('0x39')]['limit']);_0x1e0fcc[_0xeffa('0x25')]=qs[_0xeffa('0x25')](_0x4aa854[_0xeffa('0x39')][_0xeffa('0x25')]);}_0x1e0fcc['order']=qs['sort'](_0x4aa854['query'][_0xeffa('0x3f')]);_0x1e0fcc[_0xeffa('0x40')]=qs[_0xeffa('0x37')](_[_0xeffa('0x41')](_0x4aa854[_0xeffa('0x39')],_0x1e482c['filters']),_0x1acbb8);if(_0x4aa854[_0xeffa('0x39')][_0xeffa('0x42')]){_0x1e0fcc[_0xeffa('0x40')]=_['merge'](_0x1e0fcc[_0xeffa('0x40')],{'$or':_['map'](_0x1acbb8,function(_0x34a9d8){if(_0x34a9d8[_0xeffa('0x34')]!=='VIRTUAL'){var _0x30ae60={};_0x30ae60[_0x34a9d8[_0xeffa('0x2e')]]={'$like':'%'+_0x4aa854[_0xeffa('0x39')]['filter']+'%'};return _0x30ae60;}})});}_0x1e0fcc=_['merge']({},_0x1e0fcc,_0x4aa854['options']);var _0x5aeb75={'where':_0x1e0fcc[_0xeffa('0x40')]};return db[_0xeffa('0x32')][_0xeffa('0x24')](_0x5aeb75)[_0xeffa('0x2c')](function(_0x13c2e8){_0x28278d[_0xeffa('0x24')]=_0x13c2e8;if(_0x4aa854['query']['includeAll']){_0x1e0fcc[_0xeffa('0x43')]=[{'all':!![]}];}return db[_0xeffa('0x32')][_0xeffa('0x44')](_0x1e0fcc);})[_0xeffa('0x2c')](function(_0x22286c){_0x28278d[_0xeffa('0x45')]=_0x22286c;return _0x28278d;})[_0xeffa('0x2c')](respondWithFilteredResult(_0x3240d3,_0x1e0fcc))[_0xeffa('0x46')](handleError(_0x3240d3,null));};exports[_0xeffa('0x47')]=function(_0x108be6,_0x455cc9){var _0x223125={'raw':![],'where':{'id':_0x108be6['params']['id']}},_0x25c8f5={};_0x25c8f5[_0xeffa('0x36')]=_['keys'](db[_0xeffa('0x32')][_0xeffa('0x33')]);_0x25c8f5[_0xeffa('0x39')]=_[_0xeffa('0x48')](_0x108be6['query']);_0x25c8f5[_0xeffa('0x37')]=_[_0xeffa('0x38')](_0x25c8f5[_0xeffa('0x36')],_0x25c8f5[_0xeffa('0x39')]);_0x223125[_0xeffa('0x3a')]=_[_0xeffa('0x38')](_0x25c8f5[_0xeffa('0x36')],qs[_0xeffa('0x3b')](_0x108be6[_0xeffa('0x39')]['fields']));_0x223125[_0xeffa('0x3a')]=_0x223125['attributes'][_0xeffa('0x3c')]?_0x223125['attributes']:_0x25c8f5[_0xeffa('0x36')];if(_0x108be6[_0xeffa('0x39')][_0xeffa('0x49')]){_0x223125[_0xeffa('0x43')]=[{'all':!![]}];}_0x223125=_[_0xeffa('0x4a')]({},_0x223125,_0x108be6[_0xeffa('0x4b')]);return db[_0xeffa('0x32')]['find'](_0x223125)['then'](handleEntityNotFound(_0x455cc9,null))[_0xeffa('0x2c')](respondWithResult(_0x455cc9,null))['catch'](handleError(_0x455cc9,null));};exports[_0xeffa('0x4c')]=function(_0x273f15,_0xa0f374){return db[_0xeffa('0x32')][_0xeffa('0x4c')](_0x273f15[_0xeffa('0x4d')],{})['then'](respondWithResult(_0xa0f374,0xc9))[_0xeffa('0x46')](handleError(_0xa0f374,null));};exports['update']=function(_0x39e632,_0x46c8c5){if(_0x39e632[_0xeffa('0x4d')]['id']){delete _0x39e632[_0xeffa('0x4d')]['id'];}return db['Dynamics365Account'][_0xeffa('0x4e')]({'where':{'id':_0x39e632[_0xeffa('0x4f')]['id']}})[_0xeffa('0x2c')](handleEntityNotFound(_0x46c8c5,null))['then'](saveUpdates(_0x39e632[_0xeffa('0x4d')],null))[_0xeffa('0x2c')](respondWithResult(_0x46c8c5,null))[_0xeffa('0x46')](handleError(_0x46c8c5,null));};exports[_0xeffa('0x50')]=function(_0x1df54a,_0x52f51e){return db['Dynamics365Account']['find']({'where':{'id':_0x1df54a[_0xeffa('0x4f')]['id']}})[_0xeffa('0x2c')](handleEntityNotFound(_0x52f51e,null))[_0xeffa('0x2c')](removeEntity(_0x52f51e,null))[_0xeffa('0x46')](handleError(_0x52f51e,null));};exports[_0xeffa('0x51')]=function(_0x180d33,_0x56faa0,_0x39d969){var _0x593b23={};var _0x5cea1a={};var _0x1fb7e0;var _0x10be99;return db[_0xeffa('0x32')][_0xeffa('0x52')]({'where':{'id':_0x180d33[_0xeffa('0x4f')]['id']}})[_0xeffa('0x2c')](handleEntityNotFound(_0x56faa0,null))[_0xeffa('0x2c')](function(_0x3d9f98){if(_0x3d9f98){_0x1fb7e0=_0x3d9f98;_0x5cea1a['model']=_[_0xeffa('0x48')](db['Dynamics365Configuration'][_0xeffa('0x33')]);_0x5cea1a[_0xeffa('0x39')]=_['keys'](_0x180d33['query']);_0x5cea1a[_0xeffa('0x37')]=_[_0xeffa('0x38')](_0x5cea1a[_0xeffa('0x36')],_0x5cea1a[_0xeffa('0x39')]);_0x593b23[_0xeffa('0x3a')]=_[_0xeffa('0x38')](_0x5cea1a[_0xeffa('0x36')],qs[_0xeffa('0x3b')](_0x180d33[_0xeffa('0x39')][_0xeffa('0x3b')]));_0x593b23[_0xeffa('0x3a')]=_0x593b23[_0xeffa('0x3a')]['length']?_0x593b23[_0xeffa('0x3a')]:_0x5cea1a[_0xeffa('0x36')];_0x593b23['order']=qs['sort'](_0x180d33[_0xeffa('0x39')][_0xeffa('0x3f')]);_0x593b23['where']=qs[_0xeffa('0x37')](_[_0xeffa('0x41')](_0x180d33[_0xeffa('0x39')],_0x5cea1a[_0xeffa('0x37')]));if(_0x180d33[_0xeffa('0x39')]['filter']){_0x593b23[_0xeffa('0x40')]=_[_0xeffa('0x4a')](_0x593b23[_0xeffa('0x40')],{'$or':_[_0xeffa('0x31')](_0x593b23['attributes'],function(_0x1dfba1){var _0x44e732={};_0x44e732[_0x1dfba1]={'$like':'%'+_0x180d33[_0xeffa('0x39')][_0xeffa('0x42')]+'%'};return _0x44e732;})});}_0x593b23=_['merge']({},_0x593b23,_0x180d33[_0xeffa('0x4b')]);return _0x1fb7e0[_0xeffa('0x51')](_0x593b23);}})[_0xeffa('0x2c')](function(_0x2480af){if(_0x2480af){_0x10be99=_0x2480af[_0xeffa('0x3c')];if(!_0x180d33[_0xeffa('0x39')][_0xeffa('0x3d')]('nolimit')){_0x593b23[_0xeffa('0x26')]=qs[_0xeffa('0x26')](_0x180d33[_0xeffa('0x39')][_0xeffa('0x26')]);_0x593b23[_0xeffa('0x25')]=qs[_0xeffa('0x25')](_0x180d33[_0xeffa('0x39')]['offset']);}return _0x1fb7e0[_0xeffa('0x51')](_0x593b23);}})[_0xeffa('0x2c')](function(_0x1cfdf0){if(_0x1cfdf0){return _0x1cfdf0?{'count':_0x10be99,'rows':_0x1cfdf0}:null;}})[_0xeffa('0x2c')](respondWithResult(_0x56faa0,null))['catch'](handleError(_0x56faa0,null));};exports[_0xeffa('0x53')]=function(_0x242a43,_0x116edf,_0x1f0afb){if(_0x242a43['body']['id']){delete _0x242a43[_0xeffa('0x4d')]['id'];}return db[_0xeffa('0x32')][_0xeffa('0x52')]({'where':{'id':_0x242a43['params']['id']}})['then'](handleEntityNotFound(_0x116edf,null))[_0xeffa('0x2c')](function(_0x16f773){if(_0x16f773){_0x242a43[_0xeffa('0x4d')][_0xeffa('0x54')]=_0x16f773['id'];_0x242a43['body'][_0xeffa('0x55')]=integrations[_0xeffa('0x56')](_0x242a43[_0xeffa('0x4d')][_0xeffa('0x57')],_0x242a43['body'][_0xeffa('0x34')]);_0x242a43[_0xeffa('0x4d')]['Descriptions']=integrations[_0xeffa('0x58')](_0x242a43['body'][_0xeffa('0x57')],_0x242a43[_0xeffa('0x4d')]['type']);return db['Dynamics365Configuration']['create'](_0x242a43[_0xeffa('0x4d')],{'include':[{'model':db['Dynamics365Field'],'as':_0xeffa('0x55')},{'model':db[_0xeffa('0x59')],'as':_0xeffa('0x5a')}]});}return null;})[_0xeffa('0x2c')](respondWithResult(_0x116edf,null))[_0xeffa('0x46')](handleError(_0x116edf,null));};exports['getFields']=function(_0x265fd6,_0x5f516a,_0x2f4ff5){var _0xd7c4ed=_0x265fd6[_0xeffa('0x39')][_0xeffa('0x5b')];var _0xaee7c2=_0xd7c4ed===_0xeffa('0x5c')?_0xeffa('0x5d'):'PhoneCall';var _0x96b6df='';var _0x5ce4da='';var _0x41a2ae='';var _0x57e8bb='';var _0x194f8b='';var _0x59dfd='';var _0x53234a='';var _0x51f585='';var _0x40b96e=[_0xeffa('0x5e'),_0xeffa('0x5f'),'customerid',_0xeffa('0x60'),'caseorigincode',_0xeffa('0x61'),_0xeffa('0x62'),'regardingobjectid',_0xeffa('0x63'),_0xeffa('0x64')];var _0x1935cb=['accountidname',_0xeffa('0x65'),_0xeffa('0x66'),'billedserviceunits','contactidname','contactidyominame',_0xeffa('0x67'),_0xeffa('0x68'),_0xeffa('0x69'),_0xeffa('0x6a'),_0xeffa('0x6b'),_0xeffa('0x6c'),'createdon',_0xeffa('0x6d'),_0xeffa('0x6e'),_0xeffa('0x6f'),_0xeffa('0x70'),'customeridyominame',_0xeffa('0x71'),'entitlementidname','entityimage_timestamp',_0xeffa('0x72'),_0xeffa('0x73'),'exchangerate','firstresponsebykpiidname',_0xeffa('0x74'),_0xeffa('0x75'),_0xeffa('0x76'),'kbarticleidname',_0xeffa('0x77'),'masteridname',_0xeffa('0x78'),_0xeffa('0x79'),_0xeffa('0x7a'),'modifiedbyyominame',_0xeffa('0x7b'),_0xeffa('0x7c'),'modifiedonbehalfbyyominame',_0xeffa('0x7d'),_0xeffa('0x7e'),'numberofchildincidents',_0xeffa('0x7f'),_0xeffa('0x80'),'owneridname',_0xeffa('0x81'),_0xeffa('0x82'),'parentcaseidname',_0xeffa('0x83'),'primarycontactidyominame',_0xeffa('0x84'),_0xeffa('0x85'),_0xeffa('0x86'),_0xeffa('0x87'),_0xeffa('0x88'),_0xeffa('0x89'),_0xeffa('0x8a'),'responsiblecontactidyominame',_0xeffa('0x8b'),_0xeffa('0x8c'),_0xeffa('0x8d'),_0xeffa('0x8e'),_0xeffa('0x8f'),_0xeffa('0x90'),_0xeffa('0x91'),_0xeffa('0x92'),_0xeffa('0x93'),_0xeffa('0x94'),_0xeffa('0x95'),_0xeffa('0x96'),_0xeffa('0x97')];var _0x4fbbce=_0x40b96e[_0xeffa('0x98')](_0x1935cb);return db[_0xeffa('0x32')]['findOne']({'where':{'id':_0x265fd6[_0xeffa('0x4f')]['id']},'attributes':['id','username','password','remoteUri',_0xeffa('0x99'),_0xeffa('0x9a'),_0xeffa('0x9b')]})['then'](handleEntityNotFound(_0x5f516a,null))[_0xeffa('0x2c')](function(_0x2b3bc2){if(_0x2b3bc2){_0x51f585=_0x2b3bc2['remoteUri'];var _0x5259ca=_0x51f585[_0xeffa('0x9c')](-0x1);if(_0x5259ca==='/'){_0x51f585=_0x51f585['substring'](0x0,_0x51f585['lastIndexOf'](_0x5259ca));}_0x53234a=util[_0xeffa('0x9d')](_0xeffa('0x9e'),_0x51f585);var _0x540418={'method':_0xeffa('0x9f'),'uri':_0xeffa('0xa0')+_0x2b3bc2['tenantId']+_0xeffa('0xa1'),'form':{'client_id':_0x2b3bc2[_0xeffa('0x9a')],'resource':_0x51f585,'username':_0x2b3bc2[_0xeffa('0xa2')],'password':_0x2b3bc2['password'],'grant_type':_0xeffa('0xa3'),'client_secret':_0x2b3bc2[_0xeffa('0x9b')]},'json':!![]};return rp(_0x540418);}})[_0xeffa('0x2c')](function(_0x62cde){_0x59dfd=_0x62cde['access_token'];var _0x55508e={'method':_0xeffa('0xa4'),'uri':encodeURI(_0x53234a+_0xeffa('0xa5')+_0xaee7c2+'\x27'),'headers':{'Authorization':_0xeffa('0xa6')+_0x59dfd,'If-None-Match':null,'OData-Version':_0xeffa('0xa7')},'json':!![]};return rp(_0x55508e);})['then'](function(_0x3b7c34){var _0x31eebd=_0x3b7c34[_0xeffa('0xa8')][0x0];var _0x1ba008=_0x31eebd[_0xeffa('0xa9')];var _0x330bbe={'method':_0xeffa('0xa4'),'uri':_0x53234a+'EntityDefinitions('+_0x1ba008+_0xeffa('0xaa'),'headers':{'Authorization':_0xeffa('0xa6')+_0x59dfd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x330bbe);})[_0xeffa('0x2c')](function(_0x38698a){_0x96b6df=_0x38698a;_0x5ce4da=_0x96b6df['Attributes'];_0x5ce4da=_['remove'](_0x5ce4da,function(_0x55e210){return!_0x4fbbce[_0xeffa('0xab')](_0x55e210[_0xeffa('0xac')]);});var _0x576c74=[];var _0x18370e=[];_0x5ce4da[_0xeffa('0xad')](function(_0x398aa6){if(_0x398aa6[_0xeffa('0xae')]){var _0x4c3221=_0x398aa6[_0xeffa('0xae')][_0xeffa('0xaf')](_0x398aa6[_0xeffa('0xae')][_0xeffa('0xb0')]('.')+0x1);if(_0x4c3221===_0xeffa('0xb1')){_0x576c74[_0xeffa('0xb2')](getSelectList(_0x53234a,_0xd7c4ed,_0x18370e,_0x96b6df[_0xeffa('0xa9')],_0x398aa6['MetadataId'],_0x59dfd));}}});return Promise[_0xeffa('0xb3')](_0x576c74);})[_0xeffa('0x2c')](function(_0x1eb31e){_0x41a2ae=_0x1eb31e[0x0];var _0x35b2b3=[];var _0x53ad26=[];_0x5ce4da['forEach'](function(_0x47e4b2){if(!_[_0xeffa('0xb4')](_0x47e4b2[_0xeffa('0xae')])){var _0x3aff28=_0x47e4b2[_0xeffa('0xae')][_0xeffa('0xaf')](_0x47e4b2[_0xeffa('0xae')]['lastIndexOf']('.')+0x1);if(_0x3aff28===_0xeffa('0xb5')){_0x35b2b3['push'](getBooleanList(_0x53234a,_0xd7c4ed,_0x53ad26,_0x96b6df[_0xeffa('0xa9')],_0x47e4b2[_0xeffa('0xa9')],_0x59dfd));}}});return Promise[_0xeffa('0xb3')](_0x35b2b3);})[_0xeffa('0x2c')](function(_0xb47138){_0x57e8bb=_0xb47138[0x0];var _0x5446b0=[];var _0x2e9216=[];_0x5ce4da[_0xeffa('0xad')](function(_0x4c6a49){if(_0x4c6a49['@odata.type']){var _0x1cf3e8=_0x4c6a49[_0xeffa('0xae')][_0xeffa('0xaf')](_0x4c6a49[_0xeffa('0xae')]['lastIndexOf']('.')+0x1);if(_0x1cf3e8===_0xeffa('0xb6')||_0x1cf3e8===_0xeffa('0xb7')||_0x1cf3e8==='BigIntAttributeMetadata'||_0x1cf3e8===_0xeffa('0xb8')||_0x1cf3e8==='MemoAttributeMetadata'||_0x1cf3e8===_0xeffa('0xb9')||_0x1cf3e8===_0xeffa('0xba')||_0x1cf3e8===_0xeffa('0xbb')||_0x1cf3e8==='StateAttributeMetadata'||_0x1cf3e8==='DecimalAttributeMetadata'){_0x5446b0[_0xeffa('0xb2')](getInputList(_0x53234a,_0xd7c4ed,_0x1cf3e8,_0x2e9216,_0x96b6df[_0xeffa('0xa9')],_0x4c6a49[_0xeffa('0xa9')],_0x59dfd));}}});return Promise[_0xeffa('0xb3')](_0x5446b0);})[_0xeffa('0x2c')](function(_0x1e07cf){_0x194f8b=_0x1e07cf[0x0];var _0x440d32=_0x41a2ae[_0xeffa('0x98')](_0x57e8bb)[_0xeffa('0x98')](_0x194f8b);var _0x49f7f7={'count':_0x440d32[_0xeffa('0x3c')],'rows':_0x440d32};return _0x49f7f7;})['then'](respondWithResult(_0x5f516a,null))['catch'](function(_0x246722){var _0x50fce1=_0x265fd6['query'][_0xeffa('0x15')]?0x1f4:_0x246722[_0xeffa('0xbc')]||0x1f4;logger['error'](_0x246722[_0xeffa('0x2d')]);delete _0x246722[_0xeffa('0x2e')];if(_0x50fce1===0x191){_0x50fce1=0x190;}_0x5f516a[_0xeffa('0x22')](_0x50fce1)[_0xeffa('0x2f')](_0x265fd6[_0xeffa('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x246722[_0xeffa('0xbc')]}:_0x246722);});};function getSelectList(_0x22d62a,_0x261fe9,_0x467fdc,_0x4f411d,_0xebb149,_0x164a5a){var _0x5c6e5a={'method':_0xeffa('0xa4'),'uri':_0x22d62a+_0xeffa('0xbd')+_0x4f411d+_0xeffa('0xbe')+_0xebb149+_0xeffa('0xbf')+_0xeffa('0xc0'),'headers':{'Authorization':'Bearer\x20'+_0x164a5a,'If-None-Match':null,'OData-Version':_0xeffa('0xa7')},'json':!![]};return rp(_0x5c6e5a)[_0xeffa('0x2c')](function(_0x1b57fd){var _0x1526c0=[];var _0x27235f=_0x1b57fd[_0xeffa('0xc1')][_0xeffa('0xc2')];_0x27235f[_0xeffa('0xad')](function(_0x218635){_0x1526c0['push']({'name':_0x218635[_0xeffa('0xc3')][_0xeffa('0xc4')][_0xeffa('0xc3')],'value':String(_0x218635[_0xeffa('0xc5')])});});var _0x1d0071={'id':_0x261fe9+'_'+_0x1b57fd[_0xeffa('0xac')],'name':_0x1b57fd[_0xeffa('0xc6')][_0xeffa('0xc4')][_0xeffa('0xc3')],'custom':![],'options':_0x1526c0};_0x467fdc[_0xeffa('0xb2')](_0x1d0071);return _0x467fdc;});}function getBooleanList(_0x30503c,_0x3c89c1,_0xeac781,_0x2b266e,_0x1e9f0c,_0x80d2d5){var _0x18da49={'method':_0xeffa('0xa4'),'uri':_0x30503c+'EntityDefinitions('+_0x2b266e+_0xeffa('0xbe')+_0x1e9f0c+_0xeffa('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0x80d2d5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18da49)['then'](function(_0x57dfb1){var _0x44ca5a=[];_0x44ca5a[_0xeffa('0xb2')]({'name':_0x57dfb1[_0xeffa('0xc1')][_0xeffa('0xc8')][_0xeffa('0xc3')]['UserLocalizedLabel']['Label'],'value':_0xeffa('0xc9')},{'name':_0x57dfb1['OptionSet']['FalseOption'][_0xeffa('0xc3')]['UserLocalizedLabel'][_0xeffa('0xc3')],'value':'false'});var _0x3b4a11={'id':_0x3c89c1+'_'+_0x57dfb1['LogicalName'],'name':_0x57dfb1['DisplayName'][_0xeffa('0xc4')][_0xeffa('0xc3')],'custom':![],'options':_0x44ca5a};_0xeac781[_0xeffa('0xb2')](_0x3b4a11);return _0xeac781;});}function getInputList(_0x5ba23b,_0x245e63,_0x547b31,_0x2f0cf8,_0x5ed994,_0x90a26,_0x53503c){var _0x4262c5={'method':_0xeffa('0xa4'),'uri':_0x5ba23b+_0xeffa('0xbd')+_0x5ed994+')/Attributes('+_0x90a26+')/Microsoft.Dynamics.CRM.'+_0x547b31+_0xeffa('0xca'),'headers':{'Authorization':'Bearer\x20'+_0x53503c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4262c5)[_0xeffa('0x2c')](function(_0x421e59){var _0x539583={'id':_0x245e63+'_'+_0x421e59[_0xeffa('0xac')],'name':_0x421e59[_0xeffa('0xc6')][_0xeffa('0xc4')]?_0x421e59[_0xeffa('0xc6')]['UserLocalizedLabel'][_0xeffa('0xc3')]:_0x421e59[_0xeffa('0xac')],'custom':![],'options':[]};_0x2f0cf8[_0xeffa('0xb2')](_0x539583);return _0x2f0cf8;});} \ No newline at end of file +var _0x50c9=['end','json','count','offset','limit','set','apply','reject','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','name','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','update','body','destroy','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','statecode','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','tenantId','clientId','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','username','clientSecret','access_token','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','statusCode','stack',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','message','result','status'];(function(_0x503520,_0xcf3222){var _0x5b764b=function(_0x4cfb50){while(--_0x4cfb50){_0x503520['push'](_0x503520['shift']());}};_0x5b764b(++_0xcf3222);}(_0x50c9,0x182));var _0x950c=function(_0x2cade0,_0xb31b9e){_0x2cade0=_0x2cade0-0x0;var _0x3d95ad=_0x50c9[_0x2cade0];return _0x3d95ad;};'use strict';var pdf=require(_0x950c('0x0'));var emlformat=require(_0x950c('0x1'));var rimraf=require(_0x950c('0x2'));var zipdir=require(_0x950c('0x3'));var jsonpatch=require(_0x950c('0x4'));var rp=require(_0x950c('0x5'));var moment=require(_0x950c('0x6'));var BPromise=require(_0x950c('0x7'));var Mustache=require('mustache');var util=require(_0x950c('0x8'));var path=require(_0x950c('0x9'));var sox=require(_0x950c('0xa'));var csv=require(_0x950c('0xb'));var ejs=require(_0x950c('0xc'));var fs=require('fs');var _=require(_0x950c('0xd'));var squel=require(_0x950c('0xe'));var crypto=require(_0x950c('0xf'));var jsforce=require(_0x950c('0x10'));var deskjs=require(_0x950c('0x11'));var toCsv=require(_0x950c('0xb'));var querystring=require(_0x950c('0x12'));var Papa=require(_0x950c('0x13'));var Redis=require(_0x950c('0x14'));var authService=require(_0x950c('0x15'));var qs=require(_0x950c('0x16'));var as=require(_0x950c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x950c('0x18'))(_0x950c('0x19'));var utils=require(_0x950c('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x950c('0x1b'));var jayson=require(_0x950c('0x1c'));var client=jayson[_0x950c('0x1d')][_0x950c('0x1e')]({'port':0x232a});function checkPasswordPattern(_0xbe67a,_0x846698,_0x23cb9d){if(_0x23cb9d){var _0x1071a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1071a4[_0x950c('0x1f')](_0x846698)){return _0xbe67a;}else{throw new db[(_0x950c('0x20'))]['ValidationError'](_0x950c('0x21'));}}else{return _0xbe67a;}}function respondWithRpcPromise(_0x53085f,_0x3899cf,_0x5da721,_0x5dec50){return new BPromise(function(_0x1496cf,_0x4d7647){var _0x435bd0=_0x5dec50||client;return _0x435bd0[_0x950c('0x22')](_0x53085f,_0x5da721)[_0x950c('0x23')](function(_0x59ba71){logger[_0x950c('0x24')](_0x950c('0x25'),_0x3899cf,_0x950c('0x26'));logger[_0x950c('0x27')](_0x950c('0x28'),_0x3899cf,'request\x20sent',JSON['stringify'](_0x59ba71));if(_0x59ba71['error']){if(_0x59ba71['error'][_0x950c('0x29')]===0x1f4){logger[_0x950c('0x2a')]('Dynamics365Account,\x20%s,\x20%s',_0x3899cf,_0x59ba71['error']['message']);return _0x4d7647(_0x59ba71[_0x950c('0x2a')][_0x950c('0x2b')]);}logger['error'](_0x950c('0x25'),_0x3899cf,_0x59ba71[_0x950c('0x2a')][_0x950c('0x2b')]);return _0x1496cf(_0x59ba71[_0x950c('0x2a')][_0x950c('0x2b')]);}else{logger[_0x950c('0x24')](_0x950c('0x25'),_0x3899cf,'request\x20sent');_0x1496cf(_0x59ba71[_0x950c('0x2c')][_0x950c('0x2b')]);}})['catch'](function(_0x26eb50){logger[_0x950c('0x2a')]('Dynamics365Account,\x20%s,\x20%s',_0x3899cf,_0x26eb50);_0x4d7647(_0x26eb50);});});}function respondWithStatusCode(_0x14c8c9,_0x2c2851){_0x2c2851=_0x2c2851||0xcc;return function(_0x32c575){if(_0x32c575){return _0x14c8c9['sendStatus'](_0x2c2851);}return _0x14c8c9[_0x950c('0x2d')](_0x2c2851)[_0x950c('0x2e')]();};}function respondWithResult(_0x56d0a4,_0x3f87a7){_0x3f87a7=_0x3f87a7||0xc8;return function(_0x404dfa){if(_0x404dfa){return _0x56d0a4[_0x950c('0x2d')](_0x3f87a7)[_0x950c('0x2f')](_0x404dfa);}};}function respondWithFilteredResult(_0x294ab6,_0x216500){return function(_0x2c4b11){if(_0x2c4b11){var _0x1d7c07=_0x2c4b11[_0x950c('0x30')],_0x377c87=_0x216500['offset'],_0x1b7a54=_0x216500[_0x950c('0x31')]+_0x216500[_0x950c('0x32')],_0x44ee4c;if(_0x1b7a54>=_0x1d7c07){_0x1b7a54=_0x1d7c07;_0x44ee4c=0xc8;}else{_0x44ee4c=0xce;}_0x294ab6[_0x950c('0x2d')](_0x44ee4c);return _0x294ab6[_0x950c('0x33')]('Content-Range',_0x377c87+'-'+_0x1b7a54+'/'+_0x1d7c07)['json'](_0x2c4b11);}return null;};}function patchUpdates(_0x86752c){return function(_0x6dbc30){try{jsonpatch[_0x950c('0x34')](_0x6dbc30,_0x86752c,!![]);}catch(_0x2c70cb){return BPromise[_0x950c('0x35')](_0x2c70cb);}return _0x6dbc30['save']();};}function saveUpdates(_0x4a57f2,_0x6bfb93){return function(_0x322b26){if(_0x322b26){return _0x322b26['update'](_0x4a57f2)['then'](function(_0x240774){return _0x240774;});}return null;};}function removeEntity(_0x2221e9,_0x42468e){return function(_0x4f4fc2){if(_0x4f4fc2){return _0x4f4fc2['destroy']()[_0x950c('0x23')](function(){_0x2221e9['status'](0xcc)[_0x950c('0x2e')]();});}};}function handleEntityNotFound(_0x3e1a1d,_0x1fc8fe){return function(_0x24cb1b){if(!_0x24cb1b){_0x3e1a1d['sendStatus'](0x194);}return _0x24cb1b;};}function handleError(_0x1f6619,_0x3b993a){_0x3b993a=_0x3b993a||0x1f4;return function(_0x5342de){logger[_0x950c('0x2a')](_0x5342de['stack']);if(_0x5342de['name']){delete _0x5342de['name'];}_0x1f6619['status'](_0x3b993a)[_0x950c('0x36')](_0x5342de);};}exports['index']=function(_0xfe624e,_0x34ee2b){var _0x566fcd={},_0x2653d3={},_0x58339f={'count':0x0,'rows':[]};var _0x217252=_[_0x950c('0x37')](db[_0x950c('0x38')][_0x950c('0x39')],function(_0x3511c3){return{'name':_0x3511c3[_0x950c('0x3a')],'type':_0x3511c3[_0x950c('0x3b')][_0x950c('0x3c')]};});_0x2653d3['model']=_['map'](_0x217252,'name');_0x2653d3[_0x950c('0x3d')]=_[_0x950c('0x3e')](_0xfe624e[_0x950c('0x3d')]);_0x2653d3[_0x950c('0x3f')]=_[_0x950c('0x40')](_0x2653d3[_0x950c('0x41')],_0x2653d3[_0x950c('0x3d')]);_0x566fcd[_0x950c('0x42')]=_[_0x950c('0x40')](_0x2653d3[_0x950c('0x41')],qs[_0x950c('0x43')](_0xfe624e[_0x950c('0x3d')][_0x950c('0x43')]));_0x566fcd[_0x950c('0x42')]=_0x566fcd['attributes']['length']?_0x566fcd['attributes']:_0x2653d3[_0x950c('0x41')];if(!_0xfe624e[_0x950c('0x3d')][_0x950c('0x44')](_0x950c('0x45'))){_0x566fcd[_0x950c('0x32')]=qs[_0x950c('0x32')](_0xfe624e[_0x950c('0x3d')][_0x950c('0x32')]);_0x566fcd[_0x950c('0x31')]=qs[_0x950c('0x31')](_0xfe624e[_0x950c('0x3d')][_0x950c('0x31')]);}_0x566fcd[_0x950c('0x46')]=qs[_0x950c('0x47')](_0xfe624e[_0x950c('0x3d')]['sort']);_0x566fcd['where']=qs[_0x950c('0x3f')](_[_0x950c('0x48')](_0xfe624e[_0x950c('0x3d')],_0x2653d3[_0x950c('0x3f')]),_0x217252);if(_0xfe624e['query'][_0x950c('0x49')]){_0x566fcd[_0x950c('0x4a')]=_['merge'](_0x566fcd[_0x950c('0x4a')],{'$or':_[_0x950c('0x37')](_0x217252,function(_0x5604f5){if(_0x5604f5[_0x950c('0x3b')]!=='VIRTUAL'){var _0x16b327={};_0x16b327[_0x5604f5[_0x950c('0x4b')]]={'$like':'%'+_0xfe624e['query'][_0x950c('0x49')]+'%'};return _0x16b327;}})});}_0x566fcd=_[_0x950c('0x4c')]({},_0x566fcd,_0xfe624e['options']);var _0x44190f={'where':_0x566fcd[_0x950c('0x4a')]};return db[_0x950c('0x38')][_0x950c('0x30')](_0x44190f)[_0x950c('0x23')](function(_0x3711ae){_0x58339f[_0x950c('0x30')]=_0x3711ae;if(_0xfe624e[_0x950c('0x3d')][_0x950c('0x4d')]){_0x566fcd[_0x950c('0x4e')]=[{'all':!![]}];}return db[_0x950c('0x38')][_0x950c('0x4f')](_0x566fcd);})[_0x950c('0x23')](function(_0x43440d){_0x58339f[_0x950c('0x50')]=_0x43440d;return _0x58339f;})[_0x950c('0x23')](respondWithFilteredResult(_0x34ee2b,_0x566fcd))[_0x950c('0x51')](handleError(_0x34ee2b,null));};exports[_0x950c('0x52')]=function(_0x4464ae,_0x15a948){var _0x54d2b2={'raw':![],'where':{'id':_0x4464ae[_0x950c('0x53')]['id']}},_0x5d5e12={};_0x5d5e12[_0x950c('0x41')]=_[_0x950c('0x3e')](db[_0x950c('0x38')][_0x950c('0x39')]);_0x5d5e12['query']=_['keys'](_0x4464ae[_0x950c('0x3d')]);_0x5d5e12[_0x950c('0x3f')]=_[_0x950c('0x40')](_0x5d5e12[_0x950c('0x41')],_0x5d5e12[_0x950c('0x3d')]);_0x54d2b2['attributes']=_[_0x950c('0x40')](_0x5d5e12[_0x950c('0x41')],qs['fields'](_0x4464ae[_0x950c('0x3d')][_0x950c('0x43')]));_0x54d2b2[_0x950c('0x42')]=_0x54d2b2[_0x950c('0x42')][_0x950c('0x54')]?_0x54d2b2[_0x950c('0x42')]:_0x5d5e12[_0x950c('0x41')];if(_0x4464ae['query']['includeAll']){_0x54d2b2[_0x950c('0x4e')]=[{'all':!![]}];}_0x54d2b2=_[_0x950c('0x4c')]({},_0x54d2b2,_0x4464ae[_0x950c('0x55')]);return db[_0x950c('0x38')][_0x950c('0x56')](_0x54d2b2)[_0x950c('0x23')](handleEntityNotFound(_0x15a948,null))[_0x950c('0x23')](respondWithResult(_0x15a948,null))[_0x950c('0x51')](handleError(_0x15a948,null));};exports[_0x950c('0x57')]=function(_0x140ee7,_0x304715){return db[_0x950c('0x38')][_0x950c('0x57')](_0x140ee7['body'],{})['then'](respondWithResult(_0x304715,0xc9))[_0x950c('0x51')](handleError(_0x304715,null));};exports[_0x950c('0x58')]=function(_0x1f6896,_0x4559ba){if(_0x1f6896['body']['id']){delete _0x1f6896[_0x950c('0x59')]['id'];}return db[_0x950c('0x38')][_0x950c('0x56')]({'where':{'id':_0x1f6896[_0x950c('0x53')]['id']}})[_0x950c('0x23')](handleEntityNotFound(_0x4559ba,null))['then'](saveUpdates(_0x1f6896['body'],null))[_0x950c('0x23')](respondWithResult(_0x4559ba,null))[_0x950c('0x51')](handleError(_0x4559ba,null));};exports[_0x950c('0x5a')]=function(_0x479748,_0x22dfd7){return db[_0x950c('0x38')][_0x950c('0x56')]({'where':{'id':_0x479748['params']['id']}})[_0x950c('0x23')](handleEntityNotFound(_0x22dfd7,null))[_0x950c('0x23')](removeEntity(_0x22dfd7,null))[_0x950c('0x51')](handleError(_0x22dfd7,null));};exports['getConfigurations']=function(_0x28efb8,_0x31d77c,_0x298393){var _0x2dceb6={};var _0x38696b={};var _0x42c9e1;var _0x331e6b;return db[_0x950c('0x38')][_0x950c('0x5b')]({'where':{'id':_0x28efb8['params']['id']}})[_0x950c('0x23')](handleEntityNotFound(_0x31d77c,null))['then'](function(_0x5d2b3c){if(_0x5d2b3c){_0x42c9e1=_0x5d2b3c;_0x38696b[_0x950c('0x41')]=_['keys'](db['Dynamics365Configuration'][_0x950c('0x39')]);_0x38696b[_0x950c('0x3d')]=_['keys'](_0x28efb8[_0x950c('0x3d')]);_0x38696b[_0x950c('0x3f')]=_[_0x950c('0x40')](_0x38696b[_0x950c('0x41')],_0x38696b[_0x950c('0x3d')]);_0x2dceb6[_0x950c('0x42')]=_[_0x950c('0x40')](_0x38696b[_0x950c('0x41')],qs[_0x950c('0x43')](_0x28efb8[_0x950c('0x3d')]['fields']));_0x2dceb6[_0x950c('0x42')]=_0x2dceb6[_0x950c('0x42')][_0x950c('0x54')]?_0x2dceb6[_0x950c('0x42')]:_0x38696b[_0x950c('0x41')];_0x2dceb6[_0x950c('0x46')]=qs[_0x950c('0x47')](_0x28efb8[_0x950c('0x3d')][_0x950c('0x47')]);_0x2dceb6['where']=qs[_0x950c('0x3f')](_[_0x950c('0x48')](_0x28efb8['query'],_0x38696b[_0x950c('0x3f')]));if(_0x28efb8[_0x950c('0x3d')]['filter']){_0x2dceb6[_0x950c('0x4a')]=_['merge'](_0x2dceb6['where'],{'$or':_['map'](_0x2dceb6[_0x950c('0x42')],function(_0x31d844){var _0x4658a2={};_0x4658a2[_0x31d844]={'$like':'%'+_0x28efb8[_0x950c('0x3d')][_0x950c('0x49')]+'%'};return _0x4658a2;})});}_0x2dceb6=_['merge']({},_0x2dceb6,_0x28efb8['options']);return _0x42c9e1[_0x950c('0x5c')](_0x2dceb6);}})[_0x950c('0x23')](function(_0x11ddfa){if(_0x11ddfa){_0x331e6b=_0x11ddfa[_0x950c('0x54')];if(!_0x28efb8['query'][_0x950c('0x44')](_0x950c('0x45'))){_0x2dceb6[_0x950c('0x32')]=qs[_0x950c('0x32')](_0x28efb8['query']['limit']);_0x2dceb6[_0x950c('0x31')]=qs[_0x950c('0x31')](_0x28efb8[_0x950c('0x3d')][_0x950c('0x31')]);}return _0x42c9e1[_0x950c('0x5c')](_0x2dceb6);}})['then'](function(_0x471116){if(_0x471116){return _0x471116?{'count':_0x331e6b,'rows':_0x471116}:null;}})['then'](respondWithResult(_0x31d77c,null))[_0x950c('0x51')](handleError(_0x31d77c,null));};exports[_0x950c('0x5d')]=function(_0x1ee720,_0x51d059,_0x1e51ca){if(_0x1ee720[_0x950c('0x59')]['id']){delete _0x1ee720['body']['id'];}return db[_0x950c('0x38')]['findOne']({'where':{'id':_0x1ee720[_0x950c('0x53')]['id']}})['then'](handleEntityNotFound(_0x51d059,null))['then'](function(_0x5d7947){if(_0x5d7947){_0x1ee720[_0x950c('0x59')][_0x950c('0x5e')]=_0x5d7947['id'];_0x1ee720['body'][_0x950c('0x5f')]=integrations[_0x950c('0x60')](_0x1ee720['body'][_0x950c('0x61')],_0x1ee720[_0x950c('0x59')][_0x950c('0x3b')]);_0x1ee720['body'][_0x950c('0x62')]=integrations[_0x950c('0x63')](_0x1ee720[_0x950c('0x59')][_0x950c('0x61')],_0x1ee720['body'][_0x950c('0x3b')]);return db[_0x950c('0x64')]['create'](_0x1ee720[_0x950c('0x59')],{'include':[{'model':db[_0x950c('0x65')],'as':_0x950c('0x5f')},{'model':db['Dynamics365Field'],'as':_0x950c('0x62')}]});}return null;})[_0x950c('0x23')](respondWithResult(_0x51d059,null))['catch'](handleError(_0x51d059,null));};exports[_0x950c('0x66')]=function(_0x2c9792,_0x1b19d9,_0x402287){var _0x33f9cd=_0x2c9792['query'][_0x950c('0x67')];var _0x301a6d=_0x33f9cd===_0x950c('0x68')?_0x950c('0x69'):'PhoneCall';var _0x1b1c2b='';var _0x505f7a='';var _0x191ffa='';var _0x41646e='';var _0x54ec69='';var _0x35fbed='';var _0x183b61='';var _0x145cb7='';var _0x502b9a=[_0x950c('0x6a'),_0x950c('0x6b'),_0x950c('0x6c'),_0x950c('0x6d'),_0x950c('0x6e'),'subject',_0x950c('0x6f'),'regardingobjectid',_0x950c('0x70'),_0x950c('0x71')];var _0x122da3=[_0x950c('0x72'),_0x950c('0x73'),_0x950c('0x74'),_0x950c('0x75'),_0x950c('0x76'),'contactidyominame','contractdetailidname',_0x950c('0x77'),_0x950c('0x78'),_0x950c('0x79'),_0x950c('0x7a'),'createdbyyominame',_0x950c('0x7b'),_0x950c('0x7c'),'createdonbehalfbyyominame',_0x950c('0x7d'),'customeridtype',_0x950c('0x7e'),_0x950c('0x7f'),_0x950c('0x80'),_0x950c('0x81'),_0x950c('0x82'),'escalatedon',_0x950c('0x83'),_0x950c('0x84'),_0x950c('0x85'),_0x950c('0x86'),_0x950c('0x87'),_0x950c('0x88'),'lastonholdtime',_0x950c('0x89'),'modifiedbyexternalpartyname',_0x950c('0x8a'),_0x950c('0x8b'),'modifiedbyyominame',_0x950c('0x8c'),_0x950c('0x8d'),_0x950c('0x8e'),'msdyn_incidenttypename',_0x950c('0x8f'),'numberofchildincidents','onholdtime',_0x950c('0x90'),_0x950c('0x91'),_0x950c('0x92'),_0x950c('0x93'),'parentcaseidname',_0x950c('0x94'),_0x950c('0x95'),_0x950c('0x96'),_0x950c('0x97'),_0x950c('0x98'),'resolveby',_0x950c('0x99'),_0x950c('0x9a'),_0x950c('0x9b'),'responsiblecontactidyominame',_0x950c('0x9c'),'slainvokedidname',_0x950c('0x9d'),'socialprofileidname',_0x950c('0x9e'),'statuscode','subjectidname',_0x950c('0x9f'),'timezoneruleversionnumber',_0x950c('0xa0'),_0x950c('0xa1'),'utcconversiontimezonecode',_0x950c('0xa2')];var _0x130e67=_0x502b9a[_0x950c('0xa3')](_0x122da3);return db[_0x950c('0x38')][_0x950c('0x5b')]({'where':{'id':_0x2c9792[_0x950c('0x53')]['id']},'attributes':['id','username',_0x950c('0xa4'),_0x950c('0xa5'),_0x950c('0xa6'),_0x950c('0xa7'),'clientSecret']})[_0x950c('0x23')](handleEntityNotFound(_0x1b19d9,null))['then'](function(_0x1f6d5b){if(_0x1f6d5b){_0x145cb7=_0x1f6d5b['remoteUri'];var _0x5993c7=_0x145cb7['slice'](-0x1);if(_0x5993c7==='/'){_0x145cb7=_0x145cb7[_0x950c('0xa8')](0x0,_0x145cb7[_0x950c('0xa9')](_0x5993c7));}_0x183b61=util[_0x950c('0xaa')](_0x950c('0xab'),_0x145cb7);var _0x52e33a={'method':_0x950c('0xac'),'uri':_0x950c('0xad')+_0x1f6d5b[_0x950c('0xa6')]+_0x950c('0xae'),'form':{'client_id':_0x1f6d5b[_0x950c('0xa7')],'resource':_0x145cb7,'username':_0x1f6d5b[_0x950c('0xaf')],'password':_0x1f6d5b['password'],'grant_type':_0x950c('0xa4'),'client_secret':_0x1f6d5b[_0x950c('0xb0')]},'json':!![]};return rp(_0x52e33a);}})['then'](function(_0x8df8c){_0x35fbed=_0x8df8c[_0x950c('0xb1')];var _0x397736={'method':'GET','uri':encodeURI(_0x183b61+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x301a6d+'\x27'),'headers':{'Authorization':_0x950c('0xb2')+_0x35fbed,'If-None-Match':null,'OData-Version':_0x950c('0xb3')},'json':!![]};return rp(_0x397736);})[_0x950c('0x23')](function(_0x1c4ae3){var _0x53f20f=_0x1c4ae3[_0x950c('0xb4')][0x0];var _0x12699c=_0x53f20f[_0x950c('0xb5')];var _0x207351={'method':_0x950c('0xb6'),'uri':_0x183b61+_0x950c('0xb7')+_0x12699c+_0x950c('0xb8'),'headers':{'Authorization':_0x950c('0xb2')+_0x35fbed,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x207351);})['then'](function(_0x1dd8fb){_0x1b1c2b=_0x1dd8fb;_0x505f7a=_0x1b1c2b[_0x950c('0xb9')];_0x505f7a=_[_0x950c('0xba')](_0x505f7a,function(_0x5ecf0e){return!_0x130e67['includes'](_0x5ecf0e['LogicalName']);});var _0x1de982=[];var _0xcfab6=[];_0x505f7a[_0x950c('0xbb')](function(_0x34a1bc){if(_0x34a1bc[_0x950c('0xbc')]){var _0x32ccec=_0x34a1bc[_0x950c('0xbc')][_0x950c('0xa8')](_0x34a1bc[_0x950c('0xbc')][_0x950c('0xa9')]('.')+0x1);if(_0x32ccec==='PicklistAttributeMetadata'){_0x1de982[_0x950c('0xbd')](getSelectList(_0x183b61,_0x33f9cd,_0xcfab6,_0x1b1c2b[_0x950c('0xb5')],_0x34a1bc[_0x950c('0xb5')],_0x35fbed));}}});return Promise[_0x950c('0xbe')](_0x1de982);})['then'](function(_0x1aecc4){_0x191ffa=_0x1aecc4[0x0];var _0x571514=[];var _0x27bb18=[];_0x505f7a['forEach'](function(_0x2a9365){if(!_['isNil'](_0x2a9365[_0x950c('0xbc')])){var _0x4584c8=_0x2a9365['@odata.type']['substring'](_0x2a9365[_0x950c('0xbc')]['lastIndexOf']('.')+0x1);if(_0x4584c8===_0x950c('0xbf')){_0x571514[_0x950c('0xbd')](getBooleanList(_0x183b61,_0x33f9cd,_0x27bb18,_0x1b1c2b[_0x950c('0xb5')],_0x2a9365[_0x950c('0xb5')],_0x35fbed));}}});return Promise[_0x950c('0xbe')](_0x571514);})[_0x950c('0x23')](function(_0x1b8a61){_0x41646e=_0x1b8a61[0x0];var _0x32184b=[];var _0x56ef56=[];_0x505f7a[_0x950c('0xbb')](function(_0x363ee2){if(_0x363ee2['@odata.type']){var _0x9693a0=_0x363ee2[_0x950c('0xbc')][_0x950c('0xa8')](_0x363ee2[_0x950c('0xbc')][_0x950c('0xa9')]('.')+0x1);if(_0x9693a0==='StringAttributeMetadata'||_0x9693a0===_0x950c('0xc0')||_0x9693a0===_0x950c('0xc1')||_0x9693a0===_0x950c('0xc2')||_0x9693a0===_0x950c('0xc3')||_0x9693a0===_0x950c('0xc4')||_0x9693a0===_0x950c('0xc5')||_0x9693a0==='EntityNameAttributeMetadata'||_0x9693a0===_0x950c('0xc6')||_0x9693a0==='DecimalAttributeMetadata'){_0x32184b['push'](getInputList(_0x183b61,_0x33f9cd,_0x9693a0,_0x56ef56,_0x1b1c2b[_0x950c('0xb5')],_0x363ee2[_0x950c('0xb5')],_0x35fbed));}}});return Promise[_0x950c('0xbe')](_0x32184b);})['then'](function(_0x2557f5){_0x54ec69=_0x2557f5[0x0];var _0x9b3340=_0x191ffa[_0x950c('0xa3')](_0x41646e)[_0x950c('0xa3')](_0x54ec69);var _0x1eec7d={'count':_0x9b3340[_0x950c('0x54')],'rows':_0x9b3340};return _0x1eec7d;})[_0x950c('0x23')](respondWithResult(_0x1b19d9,null))['catch'](function(_0xa100ac){var _0x10d14f=_0x2c9792[_0x950c('0x3d')][_0x950c('0x1f')]?0x1f4:_0xa100ac[_0x950c('0xc7')]||0x1f4;logger['error'](_0xa100ac[_0x950c('0xc8')]);delete _0xa100ac[_0x950c('0x4b')];if(_0x10d14f===0x191){_0x10d14f=0x190;}_0x1b19d9[_0x950c('0x2d')](_0x10d14f)[_0x950c('0x36')](_0x2c9792[_0x950c('0x3d')][_0x950c('0x1f')]?{'message':'Wrong\x20credentials','statusCode':_0xa100ac[_0x950c('0xc7')]}:_0xa100ac);});};function getSelectList(_0x5eb161,_0x4fb256,_0x70a8e7,_0x4f6cb3,_0x516060,_0x474ddd){var _0x1c6da6={'method':_0x950c('0xb6'),'uri':_0x5eb161+'EntityDefinitions('+_0x4f6cb3+')/Attributes('+_0x516060+_0x950c('0xc9')+_0x950c('0xca'),'headers':{'Authorization':_0x950c('0xb2')+_0x474ddd,'If-None-Match':null,'OData-Version':_0x950c('0xb3')},'json':!![]};return rp(_0x1c6da6)[_0x950c('0x23')](function(_0x2bf852){var _0x253470=[];var _0x549c18=_0x2bf852[_0x950c('0xcb')][_0x950c('0xcc')];_0x549c18[_0x950c('0xbb')](function(_0x438fd5){_0x253470['push']({'name':_0x438fd5[_0x950c('0xcd')][_0x950c('0xce')]['Label'],'value':String(_0x438fd5[_0x950c('0xcf')])});});var _0x22eb55={'id':_0x4fb256+'_'+_0x2bf852[_0x950c('0xd0')],'name':_0x2bf852['DisplayName'][_0x950c('0xce')]['Label'],'custom':![],'options':_0x253470};_0x70a8e7[_0x950c('0xbd')](_0x22eb55);return _0x70a8e7;});}function getBooleanList(_0x133d12,_0x206b89,_0x1a360d,_0x5121b2,_0x3f76aa,_0x424ca2){var _0x392736={'method':_0x950c('0xb6'),'uri':_0x133d12+_0x950c('0xb7')+_0x5121b2+_0x950c('0xd1')+_0x3f76aa+_0x950c('0xd2'),'headers':{'Authorization':_0x950c('0xb2')+_0x424ca2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x392736)['then'](function(_0x6110b6){var _0x2fd938=[];_0x2fd938[_0x950c('0xbd')]({'name':_0x6110b6[_0x950c('0xcb')]['TrueOption'][_0x950c('0xcd')]['UserLocalizedLabel'][_0x950c('0xcd')],'value':_0x950c('0xd3')},{'name':_0x6110b6[_0x950c('0xcb')][_0x950c('0xd4')][_0x950c('0xcd')][_0x950c('0xce')][_0x950c('0xcd')],'value':_0x950c('0xd5')});var _0x1f5f8a={'id':_0x206b89+'_'+_0x6110b6[_0x950c('0xd0')],'name':_0x6110b6['DisplayName'][_0x950c('0xce')]['Label'],'custom':![],'options':_0x2fd938};_0x1a360d[_0x950c('0xbd')](_0x1f5f8a);return _0x1a360d;});}function getInputList(_0x2932d6,_0x49d70d,_0x15dd63,_0x414d72,_0x4abdd5,_0x36051f,_0x2e8e0e){var _0x9e447f={'method':_0x950c('0xb6'),'uri':_0x2932d6+_0x950c('0xb7')+_0x4abdd5+')/Attributes('+_0x36051f+_0x950c('0xd6')+_0x15dd63+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x950c('0xb2')+_0x2e8e0e,'If-None-Match':null,'OData-Version':_0x950c('0xb3')},'json':!![]};return rp(_0x9e447f)['then'](function(_0x1f5e76){var _0x2aad3e={'id':_0x49d70d+'_'+_0x1f5e76['LogicalName'],'name':_0x1f5e76[_0x950c('0xd7')][_0x950c('0xce')]?_0x1f5e76[_0x950c('0xd7')][_0x950c('0xce')][_0x950c('0xcd')]:_0x1f5e76[_0x950c('0xd0')],'custom':![],'options':[]};_0x414d72[_0x950c('0xbd')](_0x2aad3e);return _0x414d72;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6189c02..b102ade 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 _0x7e87=['int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','Dynamics365Account'];(function(_0x4a2eec,_0x323e3b){var _0x312602=function(_0x376a65){while(--_0x376a65){_0x4a2eec['push'](_0x4a2eec['shift']());}};_0x312602(++_0x323e3b);}(_0x7e87,0x1d2));var _0x77e8=function(_0x38c7c9,_0x2bf72b){_0x38c7c9=_0x38c7c9-0x0;var _0x3aecfb=_0x7e87[_0x38c7c9];return _0x3aecfb;};'use strict';var _=require(_0x77e8('0x0'));var util=require(_0x77e8('0x1'));var logger=require(_0x77e8('0x2'))(_0x77e8('0x3'));var moment=require(_0x77e8('0x4'));var BPromise=require(_0x77e8('0x5'));var rp=require(_0x77e8('0x6'));var fs=require('fs');var path=require(_0x77e8('0x7'));var rimraf=require(_0x77e8('0x8'));var config=require(_0x77e8('0x9'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x77e8('0xa'));module[_0x77e8('0xb')]=function(_0x56be48,_0x101e6b){return _0x56be48[_0x77e8('0xc')](_0x77e8('0xd'),attributes,{'tableName':_0x77e8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeda=['../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','lodash'];(function(_0x2ee4d9,_0x2a6d60){var _0x19361a=function(_0x23ae35){while(--_0x23ae35){_0x2ee4d9['push'](_0x2ee4d9['shift']());}};_0x19361a(++_0x2a6d60);}(_0xeeda,0xbc));var _0xaeed=function(_0x2e381e,_0x46035e){_0x2e381e=_0x2e381e-0x0;var _0x252204=_0xeeda[_0x2e381e];return _0x252204;};'use strict';var _=require(_0xaeed('0x0'));var util=require('util');var logger=require(_0xaeed('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaeed('0x2'));var rp=require(_0xaeed('0x3'));var fs=require('fs');var path=require(_0xaeed('0x4'));var rimraf=require(_0xaeed('0x5'));var config=require('../../config/environment');var attributes=require(_0xaeed('0x6'));var integrations=require(_0xaeed('0x7'));module[_0xaeed('0x8')]=function(_0x237eb4,_0x1a9260){return _0x237eb4['define']('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','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 8cb6a9b..21af48d 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 _0x5c91=['include','map','model','debug','stringify','ShowDynamics365Account','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x5c91,0x1e9));var _0x15c9=function(_0x2ecfdc,_0x5d1ced){_0x2ecfdc=_0x2ecfdc-0x0;var _0x526ccc=_0x5c91[_0x2ecfdc];return _0x526ccc;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x15c9('0x3'));var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require(_0x15c9('0x6'));var logger=require(_0x15c9('0x7'))(_0x15c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bcb6,_0x2c213e,_0x51a779){return new BPromise(function(_0x191695,_0x114775){return client[_0x15c9('0xc')](_0x42bcb6,_0x51a779)['then'](function(_0x23adaf){logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,'request\x20sent');logger['debug'](_0x15c9('0xf'),_0x2c213e,_0x15c9('0x10'),JSON['stringify'](_0x23adaf));if(_0x23adaf['error']){if(_0x23adaf['error'][_0x15c9('0x11')]===0x1f4){logger[_0x15c9('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2c213e,_0x23adaf[_0x15c9('0x12')][_0x15c9('0x13')]);return _0x114775(_0x23adaf[_0x15c9('0x12')]['message']);}logger['error'](_0x15c9('0xe'),_0x2c213e,_0x23adaf[_0x15c9('0x12')]['message']);return _0x191695(_0x23adaf[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,_0x15c9('0x10'));_0x191695(_0x23adaf[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x5eb50e){logger[_0x15c9('0x12')](_0x15c9('0xe'),_0x2c213e,_0x5eb50e);_0x114775(_0x5eb50e);});});}exports[_0x15c9('0x16')]=function(_0x449f20){var _0x2390a4=this;return new Promise(function(_0x2d36e5,_0x1c4b1a){return db[_0x15c9('0x17')]['findAll']({'raw':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1a')]||null:null,'attributes':_0x449f20[_0x15c9('0x18')]?_0x449f20['options'][_0x15c9('0x1b')]||null:null,'limit':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1c')]||null:null,'include':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')],function(_0x499ae2){return{'model':db[_0x499ae2[_0x15c9('0x1f')]],'as':_0x499ae2['as'],'attributes':_0x499ae2['attributes'],'include':_0x499ae2[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x499ae2['include'],function(_0x229ae9){return{'model':db[_0x229ae9[_0x15c9('0x1f')]],'as':_0x229ae9['as'],'attributes':_0x229ae9[_0x15c9('0x1b')],'include':_0x229ae9['include']?_['map'](_0x229ae9[_0x15c9('0x1d')],function(_0x3f372b){return{'model':db[_0x3f372b[_0x15c9('0x1f')]],'as':_0x3f372b['as'],'attributes':_0x3f372b[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12f6ed){logger[_0x15c9('0xd')](_0x15c9('0x16'),_0x449f20);logger[_0x15c9('0x20')](_0x15c9('0x16'),_0x449f20,JSON[_0x15c9('0x21')](_0x12f6ed));_0x2d36e5(_0x12f6ed);})[_0x15c9('0x15')](function(_0x86fd2e){logger['error'](_0x15c9('0x16'),_0x86fd2e[_0x15c9('0x13')],_0x449f20);_0x1c4b1a(_0x2390a4[_0x15c9('0x12')](0x1f4,_0x86fd2e[_0x15c9('0x13')]));});});};exports[_0x15c9('0x22')]=function(_0x201e8b){var _0x411357=this;return new Promise(function(_0x7cf151,_0x32aba4){return db[_0x15c9('0x17')][_0x15c9('0x23')]({'raw':_0x201e8b[_0x15c9('0x18')]?_0x201e8b['options'][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')]['where']||null:null,'attributes':_0x201e8b[_0x15c9('0x18')]?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1b')]||null:null,'include':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1d')]?_['map'](_0x201e8b['options'][_0x15c9('0x1d')],function(_0x1c0ad4){return{'model':db[_0x1c0ad4['model']],'as':_0x1c0ad4['as'],'attributes':_0x1c0ad4[_0x15c9('0x1b')],'include':_0x1c0ad4[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x1c0ad4[_0x15c9('0x1d')],function(_0x12649d){return{'model':db[_0x12649d[_0x15c9('0x1f')]],'as':_0x12649d['as'],'attributes':_0x12649d['attributes'],'include':_0x12649d[_0x15c9('0x1d')]?_['map'](_0x12649d[_0x15c9('0x1d')],function(_0x2cddaf){return{'model':db[_0x2cddaf['model']],'as':_0x2cddaf['as'],'attributes':_0x2cddaf[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x15c9('0x24')](function(_0x58e57e){logger[_0x15c9('0xd')](_0x15c9('0x22'),_0x201e8b);logger['debug']('ShowDynamics365Account',_0x201e8b,JSON[_0x15c9('0x21')](_0x58e57e));_0x7cf151(_0x58e57e);})[_0x15c9('0x15')](function(_0x4a81d5){logger['error']('ShowDynamics365Account',_0x4a81d5[_0x15c9('0x13')],_0x201e8b);_0x32aba4(_0x411357[_0x15c9('0x12')](0x1f4,_0x4a81d5['message']));});});}; \ No newline at end of file +var _0x87d8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','raw','where','include','map','model','attributes','then','GetDynamics365Account','ShowDynamics365Account','Dynamics365Account','find','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12c5b0,_0x359218){var _0x4a7962=function(_0x5259e1){while(--_0x5259e1){_0x12c5b0['push'](_0x12c5b0['shift']());}};_0x4a7962(++_0x359218);}(_0x87d8,0x1a9));var _0x887d=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0x87d8[_0x3132e8];return _0x43eb8c;};'use strict';var _=require('lodash');var util=require(_0x887d('0x0'));var moment=require(_0x887d('0x1'));var BPromise=require(_0x887d('0x2'));var rs=require(_0x887d('0x3'));var fs=require('fs');var Redis=require(_0x887d('0x4'));var db=require(_0x887d('0x5'))['db'];var utils=require(_0x887d('0x6'));var logger=require(_0x887d('0x7'))(_0x887d('0x8'));var config=require(_0x887d('0x9'));var jayson=require(_0x887d('0xa'));var client=jayson[_0x887d('0xb')][_0x887d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16820a,_0x242f79,_0x479f76){return new BPromise(function(_0x411c20,_0x3788f7){return client['request'](_0x16820a,_0x479f76)['then'](function(_0x583716){logger['info'](_0x887d('0xd'),_0x242f79,_0x887d('0xe'));logger[_0x887d('0xf')](_0x887d('0x10'),_0x242f79,'request\x20sent',JSON['stringify'](_0x583716));if(_0x583716[_0x887d('0x11')]){if(_0x583716[_0x887d('0x11')][_0x887d('0x12')]===0x1f4){logger[_0x887d('0x11')](_0x887d('0xd'),_0x242f79,_0x583716[_0x887d('0x11')][_0x887d('0x13')]);return _0x3788f7(_0x583716[_0x887d('0x11')]['message']);}logger[_0x887d('0x11')](_0x887d('0xd'),_0x242f79,_0x583716[_0x887d('0x11')]['message']);return _0x411c20(_0x583716[_0x887d('0x11')][_0x887d('0x13')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x242f79,'request\x20sent');_0x411c20(_0x583716[_0x887d('0x14')][_0x887d('0x13')]);}})['catch'](function(_0xa5b593){logger[_0x887d('0x11')](_0x887d('0xd'),_0x242f79,_0xa5b593);_0x3788f7(_0xa5b593);});});}exports['GetDynamics365Account']=function(_0xdfadaf){var _0x3f6123=this;return new Promise(function(_0x5e97ec,_0xd02be9){return db['Dynamics365Account'][_0x887d('0x15')]({'raw':_0xdfadaf[_0x887d('0x16')]?_0xdfadaf[_0x887d('0x16')][_0x887d('0x17')]===undefined?!![]:![]:!![],'where':_0xdfadaf[_0x887d('0x16')]?_0xdfadaf[_0x887d('0x16')][_0x887d('0x18')]||null:null,'attributes':_0xdfadaf[_0x887d('0x16')]?_0xdfadaf[_0x887d('0x16')]['attributes']||null:null,'limit':_0xdfadaf['options']?_0xdfadaf[_0x887d('0x16')]['limit']||null:null,'include':_0xdfadaf[_0x887d('0x16')]?_0xdfadaf[_0x887d('0x16')][_0x887d('0x19')]?_[_0x887d('0x1a')](_0xdfadaf[_0x887d('0x16')][_0x887d('0x19')],function(_0x515554){return{'model':db[_0x515554[_0x887d('0x1b')]],'as':_0x515554['as'],'attributes':_0x515554[_0x887d('0x1c')],'include':_0x515554['include']?_['map'](_0x515554[_0x887d('0x19')],function(_0x3e198b){return{'model':db[_0x3e198b[_0x887d('0x1b')]],'as':_0x3e198b['as'],'attributes':_0x3e198b[_0x887d('0x1c')],'include':_0x3e198b['include']?_[_0x887d('0x1a')](_0x3e198b[_0x887d('0x19')],function(_0x2cc7f7){return{'model':db[_0x2cc7f7['model']],'as':_0x2cc7f7['as'],'attributes':_0x2cc7f7[_0x887d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x887d('0x1d')](function(_0x2668a8){logger['info']('GetDynamics365Account',_0xdfadaf);logger[_0x887d('0xf')](_0x887d('0x1e'),_0xdfadaf,JSON['stringify'](_0x2668a8));_0x5e97ec(_0x2668a8);})['catch'](function(_0x329b92){logger['error'](_0x887d('0x1e'),_0x329b92[_0x887d('0x13')],_0xdfadaf);_0xd02be9(_0x3f6123['error'](0x1f4,_0x329b92[_0x887d('0x13')]));});});};exports[_0x887d('0x1f')]=function(_0x4ae14d){var _0x5edbe5=this;return new Promise(function(_0x4c8f92,_0x2891e2){return db[_0x887d('0x20')][_0x887d('0x21')]({'raw':_0x4ae14d[_0x887d('0x16')]?_0x4ae14d[_0x887d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4ae14d[_0x887d('0x16')]?_0x4ae14d[_0x887d('0x16')][_0x887d('0x18')]||null:null,'attributes':_0x4ae14d['options']?_0x4ae14d['options'][_0x887d('0x1c')]||null:null,'include':_0x4ae14d['options']?_0x4ae14d['options'][_0x887d('0x19')]?_['map'](_0x4ae14d[_0x887d('0x16')][_0x887d('0x19')],function(_0x124bd2){return{'model':db[_0x124bd2[_0x887d('0x1b')]],'as':_0x124bd2['as'],'attributes':_0x124bd2['attributes'],'include':_0x124bd2[_0x887d('0x19')]?_[_0x887d('0x1a')](_0x124bd2[_0x887d('0x19')],function(_0x322657){return{'model':db[_0x322657[_0x887d('0x1b')]],'as':_0x322657['as'],'attributes':_0x322657['attributes'],'include':_0x322657[_0x887d('0x19')]?_[_0x887d('0x1a')](_0x322657['include'],function(_0x24c713){return{'model':db[_0x24c713['model']],'as':_0x24c713['as'],'attributes':_0x24c713[_0x887d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x887d('0x1d')](function(_0x47e796){logger['info']('ShowDynamics365Account',_0x4ae14d);logger[_0x887d('0xf')](_0x887d('0x1f'),_0x4ae14d,JSON[_0x887d('0x22')](_0x47e796));_0x4c8f92(_0x47e796);})[_0x887d('0x23')](function(_0x171253){logger[_0x887d('0x11')](_0x887d('0x1f'),_0x171253['message'],_0x4ae14d);_0x2891e2(_0x5edbe5[_0x887d('0x11')](0x1f4,_0x171253['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 57fdef7..9efa5be 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 _0xf18d=['getFields','/:id/subjects','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x2d0cb4,_0x563b99){var _0x418812=function(_0x2ef989){while(--_0x2ef989){_0x2d0cb4['push'](_0x2d0cb4['shift']());}};_0x418812(++_0x563b99);}(_0xf18d,0x12f));var _0xdf18=function(_0x126242,_0x4d06d1){_0x126242=_0x126242-0x0;var _0x2086a1=_0xf18d[_0x126242];return _0x2086a1;};'use strict';var multer=require(_0xdf18('0x0'));var util=require(_0xdf18('0x1'));var path=require('path');var timeout=require(_0xdf18('0x2'));var express=require(_0xdf18('0x3'));var router=express[_0xdf18('0x4')]();var auth=require(_0xdf18('0x5'));var interaction=require(_0xdf18('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xdf18('0x7')]('/',auth[_0xdf18('0x8')](),controller[_0xdf18('0x9')]);router[_0xdf18('0x7')](_0xdf18('0xa'),auth[_0xdf18('0x8')](),controller[_0xdf18('0xb')]);router['get']('/:id/fields',auth[_0xdf18('0x8')](),controller[_0xdf18('0xc')]);router['get'](_0xdf18('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdf18('0x7')]('/:id/descriptions',auth[_0xdf18('0x8')](),controller[_0xdf18('0xe')]);router[_0xdf18('0xf')]('/',auth[_0xdf18('0x8')](),controller[_0xdf18('0x10')]);router['put'](_0xdf18('0xa'),auth['isAuthenticated'](),controller[_0xdf18('0x11')]);router[_0xdf18('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdf18('0x13')]);module[_0xdf18('0x14')]=router; \ No newline at end of file +var _0xf401=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','post','update','destroy','exports','multer'];(function(_0x933b2d,_0x316827){var _0x3c9d9b=function(_0x472e0e){while(--_0x472e0e){_0x933b2d['push'](_0x933b2d['shift']());}};_0x3c9d9b(++_0x316827);}(_0xf401,0x1c7));var _0x1f40=function(_0x6ca1db,_0x569d05){_0x6ca1db=_0x6ca1db-0x0;var _0x5bcc1b=_0xf401[_0x6ca1db];return _0x5bcc1b;};'use strict';var multer=require(_0x1f40('0x0'));var util=require(_0x1f40('0x1'));var path=require(_0x1f40('0x2'));var timeout=require(_0x1f40('0x3'));var express=require('express');var router=express[_0x1f40('0x4')]();var auth=require(_0x1f40('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f40('0x6'));var controller=require(_0x1f40('0x7'));router[_0x1f40('0x8')]('/',auth[_0x1f40('0x9')](),controller['index']);router['get'](_0x1f40('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1f40('0x8')](_0x1f40('0xb'),auth[_0x1f40('0x9')](),controller[_0x1f40('0xc')]);router[_0x1f40('0x8')](_0x1f40('0xd'),auth['isAuthenticated'](),controller[_0x1f40('0xe')]);router[_0x1f40('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x1f40('0xf')]('/',auth[_0x1f40('0x9')](),controller['create']);router['put'](_0x1f40('0xa'),auth[_0x1f40('0x9')](),controller[_0x1f40('0x10')]);router['delete'](_0x1f40('0xa'),auth[_0x1f40('0x9')](),controller[_0x1f40('0x11')]);module[_0x1f40('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 8317421..9b8a0ba 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 _0x3c22=['STRING','ENUM','phonecall','incident','sequelize','exports'];(function(_0x243507,_0x466b9d){var _0x30d84f=function(_0xf6b36e){while(--_0xf6b36e){_0x243507['push'](_0x243507['shift']());}};_0x30d84f(++_0x466b9d);}(_0x3c22,0x70));var _0x23c2=function(_0x135d20,_0x4079dc){_0x135d20=_0x135d20-0x0;var _0x358ec5=_0x3c22[_0x135d20];return _0x358ec5;};'use strict';var Sequelize=require(_0x23c2('0x0'));module[_0x23c2('0x1')]={'name':{'type':Sequelize[_0x23c2('0x2')]},'description':{'type':Sequelize[_0x23c2('0x2')]},'ticketType':{'type':Sequelize[_0x23c2('0x3')]('incident',_0x23c2('0x4')),'defaultValue':_0x23c2('0x5')}}; \ No newline at end of file +var _0xd05d=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x2e6abe,_0x129981){var _0x1db12c=function(_0x45b666){while(--_0x45b666){_0x2e6abe['push'](_0x2e6abe['shift']());}};_0x1db12c(++_0x129981);}(_0xd05d,0x93));var _0xdd05=function(_0x8a64eb,_0x160e79){_0x8a64eb=_0x8a64eb-0x0;var _0x1e0cf6=_0xd05d[_0x8a64eb];return _0x1e0cf6;};'use strict';var Sequelize=require(_0xdd05('0x0'));module[_0xdd05('0x1')]={'name':{'type':Sequelize[_0xdd05('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xdd05('0x3')](_0xdd05('0x4'),_0xdd05('0x5')),'defaultValue':_0xdd05('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6fad1c5..ad79a04 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 _0x72e0=['code','Dynamics365Configuration,\x20%s,\x20%s','message','sendStatus','json','count','offset','limit','set','apply','reject','save','update','destroy','status','end','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','Dynamics365Field','length','getFields','nolimit','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','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','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x72e0,0x1be));var _0x072e=function(_0x15672f,_0x4b8522){_0x15672f=_0x15672f-0x0;var _0x1e0a87=_0x72e0[_0x15672f];return _0x1e0a87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x072e('0x0'));var rimraf=require(_0x072e('0x1'));var zipdir=require(_0x072e('0x2'));var jsonpatch=require(_0x072e('0x3'));var rp=require(_0x072e('0x4'));var moment=require(_0x072e('0x5'));var BPromise=require(_0x072e('0x6'));var Mustache=require(_0x072e('0x7'));var util=require(_0x072e('0x8'));var path=require('path');var sox=require(_0x072e('0x9'));var csv=require('to-csv');var ejs=require(_0x072e('0xa'));var fs=require('fs');var _=require(_0x072e('0xb'));var squel=require(_0x072e('0xc'));var crypto=require(_0x072e('0xd'));var jsforce=require(_0x072e('0xe'));var deskjs=require(_0x072e('0xf'));var toCsv=require(_0x072e('0x10'));var querystring=require('querystring');var Papa=require(_0x072e('0x11'));var Redis=require(_0x072e('0x12'));var authService=require(_0x072e('0x13'));var qs=require(_0x072e('0x14'));var as=require(_0x072e('0x15'));var hardwareService=require(_0x072e('0x16'));var logger=require(_0x072e('0x17'))(_0x072e('0x18'));var utils=require(_0x072e('0x19'));var config=require('../../config/environment');var db=require(_0x072e('0x1a'))['db'];var jayson=require(_0x072e('0x1b'));var client=jayson[_0x072e('0x1c')][_0x072e('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x564f40,_0x4b21c8,_0x1fe101){if(_0x1fe101){var _0x3ef6fb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ef6fb[_0x072e('0x1e')](_0x4b21c8)){return _0x564f40;}else{throw new db[(_0x072e('0x1f'))]['ValidationError'](_0x072e('0x20'));}}else{return _0x564f40;}}function respondWithRpcPromise(_0x38d36e,_0x2e7f51,_0x2bfb92,_0x3f636f){return new BPromise(function(_0x315d64,_0x29b6a4){var _0x10a285=_0x3f636f||client;return _0x10a285[_0x072e('0x21')](_0x38d36e,_0x2bfb92)[_0x072e('0x22')](function(_0x3e4415){logger[_0x072e('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2e7f51,_0x072e('0x24'));logger['debug'](_0x072e('0x25'),_0x2e7f51,'request\x20sent',JSON['stringify'](_0x3e4415));if(_0x3e4415[_0x072e('0x26')]){if(_0x3e4415[_0x072e('0x26')][_0x072e('0x27')]===0x1f4){logger[_0x072e('0x26')](_0x072e('0x28'),_0x2e7f51,_0x3e4415['error'][_0x072e('0x29')]);return _0x29b6a4(_0x3e4415[_0x072e('0x26')][_0x072e('0x29')]);}logger['error'](_0x072e('0x28'),_0x2e7f51,_0x3e4415['error'][_0x072e('0x29')]);return _0x315d64(_0x3e4415[_0x072e('0x26')]['message']);}else{logger[_0x072e('0x23')](_0x072e('0x28'),_0x2e7f51,_0x072e('0x24'));_0x315d64(_0x3e4415['result'][_0x072e('0x29')]);}})['catch'](function(_0x29e6b4){logger['error'](_0x072e('0x28'),_0x2e7f51,_0x29e6b4);_0x29b6a4(_0x29e6b4);});});}function respondWithStatusCode(_0x567416,_0x16f685){_0x16f685=_0x16f685||0xcc;return function(_0xc12e48){if(_0xc12e48){return _0x567416[_0x072e('0x2a')](_0x16f685);}return _0x567416['status'](_0x16f685)['end']();};}function respondWithResult(_0x40906f,_0x238d67){_0x238d67=_0x238d67||0xc8;return function(_0x3f7772){if(_0x3f7772){return _0x40906f['status'](_0x238d67)[_0x072e('0x2b')](_0x3f7772);}};}function respondWithFilteredResult(_0x4bb53a,_0xea0fb2){return function(_0x480b78){if(_0x480b78){var _0x2798af=_0x480b78[_0x072e('0x2c')],_0x926baa=_0xea0fb2[_0x072e('0x2d')],_0x2a840d=_0xea0fb2[_0x072e('0x2d')]+_0xea0fb2[_0x072e('0x2e')],_0x42ee5c;if(_0x2a840d>=_0x2798af){_0x2a840d=_0x2798af;_0x42ee5c=0xc8;}else{_0x42ee5c=0xce;}_0x4bb53a['status'](_0x42ee5c);return _0x4bb53a[_0x072e('0x2f')]('Content-Range',_0x926baa+'-'+_0x2a840d+'/'+_0x2798af)[_0x072e('0x2b')](_0x480b78);}return null;};}function patchUpdates(_0x357523){return function(_0x419dd0){try{jsonpatch[_0x072e('0x30')](_0x419dd0,_0x357523,!![]);}catch(_0x5a5b5a){return BPromise[_0x072e('0x31')](_0x5a5b5a);}return _0x419dd0[_0x072e('0x32')]();};}function saveUpdates(_0x4b0e2d,_0x36d19c){return function(_0x475d14){if(_0x475d14){return _0x475d14[_0x072e('0x33')](_0x4b0e2d)['then'](function(_0x9e0775){return _0x9e0775;});}return null;};}function removeEntity(_0x5c1cd8,_0x58ed9c){return function(_0x469e17){if(_0x469e17){return _0x469e17[_0x072e('0x34')]()[_0x072e('0x22')](function(){_0x5c1cd8[_0x072e('0x35')](0xcc)[_0x072e('0x36')]();});}};}function handleEntityNotFound(_0x29ab25,_0x4af9cb){return function(_0x2af639){if(!_0x2af639){_0x29ab25[_0x072e('0x2a')](0x194);}return _0x2af639;};}function handleError(_0x2f0c3a,_0x35a02a){_0x35a02a=_0x35a02a||0x1f4;return function(_0x468427){logger[_0x072e('0x26')](_0x468427[_0x072e('0x37')]);if(_0x468427[_0x072e('0x38')]){delete _0x468427[_0x072e('0x38')];}_0x2f0c3a[_0x072e('0x35')](_0x35a02a)['send'](_0x468427);};}exports[_0x072e('0x39')]=function(_0x5df047,_0x47c9a0){var _0x5611d6={},_0x185c6f={},_0x4caaf8={'count':0x0,'rows':[]};var _0x3bce29=_['map'](db[_0x072e('0x3a')][_0x072e('0x3b')],function(_0x3e3cf8){return{'name':_0x3e3cf8[_0x072e('0x3c')],'type':_0x3e3cf8[_0x072e('0x3d')][_0x072e('0x3e')]};});_0x185c6f[_0x072e('0x3f')]=_[_0x072e('0x40')](_0x3bce29,_0x072e('0x38'));_0x185c6f[_0x072e('0x41')]=_[_0x072e('0x42')](_0x5df047['query']);_0x185c6f['filters']=_[_0x072e('0x43')](_0x185c6f[_0x072e('0x3f')],_0x185c6f['query']);_0x5611d6[_0x072e('0x44')]=_[_0x072e('0x43')](_0x185c6f[_0x072e('0x3f')],qs['fields'](_0x5df047['query'][_0x072e('0x45')]));_0x5611d6[_0x072e('0x44')]=_0x5611d6[_0x072e('0x44')]['length']?_0x5611d6[_0x072e('0x44')]:_0x185c6f[_0x072e('0x3f')];if(!_0x5df047[_0x072e('0x41')][_0x072e('0x46')]('nolimit')){_0x5611d6[_0x072e('0x2e')]=qs[_0x072e('0x2e')](_0x5df047[_0x072e('0x41')][_0x072e('0x2e')]);_0x5611d6[_0x072e('0x2d')]=qs[_0x072e('0x2d')](_0x5df047[_0x072e('0x41')][_0x072e('0x2d')]);}_0x5611d6['order']=qs[_0x072e('0x47')](_0x5df047[_0x072e('0x41')][_0x072e('0x47')]);_0x5611d6[_0x072e('0x48')]=qs['filters'](_[_0x072e('0x49')](_0x5df047['query'],_0x185c6f[_0x072e('0x4a')]),_0x3bce29);if(_0x5df047['query']['filter']){_0x5611d6['where']=_['merge'](_0x5611d6[_0x072e('0x48')],{'$or':_[_0x072e('0x40')](_0x3bce29,function(_0xb1fe96){if(_0xb1fe96[_0x072e('0x3d')]!==_0x072e('0x4b')){var _0x394ca9={};_0x394ca9[_0xb1fe96[_0x072e('0x38')]]={'$like':'%'+_0x5df047['query'][_0x072e('0x4c')]+'%'};return _0x394ca9;}})});}_0x5611d6=_[_0x072e('0x4d')]({},_0x5611d6,_0x5df047[_0x072e('0x4e')]);var _0x37a8e1={'where':_0x5611d6[_0x072e('0x48')]};return db[_0x072e('0x3a')]['count'](_0x37a8e1)[_0x072e('0x22')](function(_0x1b0480){_0x4caaf8[_0x072e('0x2c')]=_0x1b0480;if(_0x5df047['query'][_0x072e('0x4f')]){_0x5611d6[_0x072e('0x50')]=[{'all':!![]}];}return db[_0x072e('0x3a')][_0x072e('0x51')](_0x5611d6);})[_0x072e('0x22')](function(_0x55b289){_0x4caaf8[_0x072e('0x52')]=_0x55b289;return _0x4caaf8;})[_0x072e('0x22')](respondWithFilteredResult(_0x47c9a0,_0x5611d6))['catch'](handleError(_0x47c9a0,null));};exports[_0x072e('0x53')]=function(_0x171091,_0x14e3e2){var _0x500f19={'raw':![],'where':{'id':_0x171091[_0x072e('0x54')]['id']}},_0x4775cd={};_0x4775cd[_0x072e('0x3f')]=_[_0x072e('0x42')](db['Dynamics365Configuration'][_0x072e('0x3b')]);_0x4775cd[_0x072e('0x41')]=_[_0x072e('0x42')](_0x171091[_0x072e('0x41')]);_0x4775cd['filters']=_[_0x072e('0x43')](_0x4775cd[_0x072e('0x3f')],_0x4775cd[_0x072e('0x41')]);_0x500f19[_0x072e('0x44')]=_[_0x072e('0x43')](_0x4775cd[_0x072e('0x3f')],qs['fields'](_0x171091[_0x072e('0x41')][_0x072e('0x45')]));_0x500f19[_0x072e('0x44')]=_0x500f19[_0x072e('0x44')]['length']?_0x500f19['attributes']:_0x4775cd[_0x072e('0x3f')];if(_0x171091[_0x072e('0x41')][_0x072e('0x4f')]){_0x500f19[_0x072e('0x50')]=[{'all':!![]}];}_0x500f19=_[_0x072e('0x4d')]({},_0x500f19,_0x171091[_0x072e('0x4e')]);return db['Dynamics365Configuration'][_0x072e('0x55')](_0x500f19)[_0x072e('0x22')](handleEntityNotFound(_0x14e3e2,null))[_0x072e('0x22')](respondWithResult(_0x14e3e2,null))[_0x072e('0x56')](handleError(_0x14e3e2,null));};exports[_0x072e('0x57')]=function(_0x305780,_0x2c0076){return db[_0x072e('0x3a')][_0x072e('0x57')](_0x305780[_0x072e('0x58')],{})[_0x072e('0x22')](respondWithResult(_0x2c0076,0xc9))['catch'](handleError(_0x2c0076,null));};exports[_0x072e('0x33')]=function(_0x2ca976,_0x4eac68){if(_0x2ca976[_0x072e('0x58')]['id']){delete _0x2ca976['body']['id'];}return db[_0x072e('0x3a')]['find']({'where':{'id':_0x2ca976['params']['id']}})['then'](handleEntityNotFound(_0x4eac68,null))['then'](saveUpdates(_0x2ca976[_0x072e('0x58')],null))[_0x072e('0x22')](respondWithResult(_0x4eac68,null))[_0x072e('0x56')](handleError(_0x4eac68,null));};exports[_0x072e('0x34')]=function(_0x560cf2,_0x41a360){return db[_0x072e('0x3a')][_0x072e('0x55')]({'where':{'id':_0x560cf2[_0x072e('0x54')]['id']}})[_0x072e('0x22')](handleEntityNotFound(_0x41a360,null))[_0x072e('0x22')](removeEntity(_0x41a360,null))[_0x072e('0x56')](handleError(_0x41a360,null));};exports['getFields']=function(_0x756606,_0x3ae406,_0x430458){var _0x49da33={};var _0x1717fa={};var _0x167652;var _0x130f60;return db[_0x072e('0x3a')][_0x072e('0x59')]({'where':{'id':_0x756606[_0x072e('0x54')]['id']}})[_0x072e('0x22')](handleEntityNotFound(_0x3ae406,null))['then'](function(_0x4cd12f){if(_0x4cd12f){_0x167652=_0x4cd12f;_0x1717fa[_0x072e('0x3f')]=_[_0x072e('0x42')](db[_0x072e('0x5a')]['rawAttributes']);_0x1717fa['query']=_['keys'](_0x756606['query']);_0x1717fa[_0x072e('0x4a')]=_[_0x072e('0x43')](_0x1717fa['model'],_0x1717fa[_0x072e('0x41')]);_0x49da33[_0x072e('0x44')]=_[_0x072e('0x43')](_0x1717fa[_0x072e('0x3f')],qs[_0x072e('0x45')](_0x756606[_0x072e('0x41')][_0x072e('0x45')]));_0x49da33['attributes']=_0x49da33[_0x072e('0x44')][_0x072e('0x5b')]?_0x49da33['attributes']:_0x1717fa[_0x072e('0x3f')];_0x49da33['order']=qs[_0x072e('0x47')](_0x756606['query'][_0x072e('0x47')]);_0x49da33[_0x072e('0x48')]=qs[_0x072e('0x4a')](_['pick'](_0x756606[_0x072e('0x41')],_0x1717fa[_0x072e('0x4a')]));if(_0x756606[_0x072e('0x41')]['filter']){_0x49da33[_0x072e('0x48')]=_['merge'](_0x49da33[_0x072e('0x48')],{'$or':_[_0x072e('0x40')](_0x49da33[_0x072e('0x44')],function(_0x60f8d){var _0x4df59e={};_0x4df59e[_0x60f8d]={'$like':'%'+_0x756606[_0x072e('0x41')][_0x072e('0x4c')]+'%'};return _0x4df59e;})});}_0x49da33=_['merge']({},_0x49da33,_0x756606[_0x072e('0x4e')]);return _0x167652[_0x072e('0x5c')](_0x49da33);}})[_0x072e('0x22')](function(_0x3c99aa){if(_0x3c99aa){_0x130f60=_0x3c99aa[_0x072e('0x5b')];if(!_0x756606['query'][_0x072e('0x46')](_0x072e('0x5d'))){_0x49da33[_0x072e('0x2e')]=qs[_0x072e('0x2e')](_0x756606['query']['limit']);_0x49da33['offset']=qs['offset'](_0x756606['query'][_0x072e('0x2d')]);}return _0x167652[_0x072e('0x5c')](_0x49da33);}})[_0x072e('0x22')](function(_0x48df1e){if(_0x48df1e){return _0x48df1e?{'count':_0x130f60,'rows':_0x48df1e}:null;}})['then'](respondWithResult(_0x3ae406,null))[_0x072e('0x56')](handleError(_0x3ae406,null));};exports[_0x072e('0x5e')]=function(_0x54a979,_0x1b3dc1,_0x34c46c){var _0x4432ae={};var _0x1f3846={};var _0x3343e4;var _0x4c3617;return db[_0x072e('0x3a')][_0x072e('0x59')]({'where':{'id':_0x54a979[_0x072e('0x54')]['id']}})[_0x072e('0x22')](handleEntityNotFound(_0x1b3dc1,null))[_0x072e('0x22')](function(_0x43bf26){if(_0x43bf26){_0x3343e4=_0x43bf26;_0x1f3846[_0x072e('0x3f')]=_['keys'](db[_0x072e('0x5a')][_0x072e('0x3b')]);_0x1f3846[_0x072e('0x41')]=_[_0x072e('0x42')](_0x54a979['query']);_0x1f3846['filters']=_[_0x072e('0x43')](_0x1f3846[_0x072e('0x3f')],_0x1f3846[_0x072e('0x41')]);_0x4432ae['attributes']=_[_0x072e('0x43')](_0x1f3846[_0x072e('0x3f')],qs['fields'](_0x54a979[_0x072e('0x41')][_0x072e('0x45')]));_0x4432ae[_0x072e('0x44')]=_0x4432ae[_0x072e('0x44')][_0x072e('0x5b')]?_0x4432ae['attributes']:_0x1f3846[_0x072e('0x3f')];_0x4432ae[_0x072e('0x5f')]=qs['sort'](_0x54a979['query']['sort']);_0x4432ae[_0x072e('0x48')]=qs[_0x072e('0x4a')](_[_0x072e('0x49')](_0x54a979[_0x072e('0x41')],_0x1f3846[_0x072e('0x4a')]));if(_0x54a979[_0x072e('0x41')][_0x072e('0x4c')]){_0x4432ae[_0x072e('0x48')]=_[_0x072e('0x4d')](_0x4432ae['where'],{'$or':_[_0x072e('0x40')](_0x4432ae[_0x072e('0x44')],function(_0x32cee0){var _0x1033cd={};_0x1033cd[_0x32cee0]={'$like':'%'+_0x54a979[_0x072e('0x41')][_0x072e('0x4c')]+'%'};return _0x1033cd;})});}_0x4432ae=_[_0x072e('0x4d')]({},_0x4432ae,_0x54a979[_0x072e('0x4e')]);return _0x3343e4[_0x072e('0x5e')](_0x4432ae);}})[_0x072e('0x22')](function(_0x1c49b8){if(_0x1c49b8){_0x4c3617=_0x1c49b8[_0x072e('0x5b')];if(!_0x54a979[_0x072e('0x41')][_0x072e('0x46')](_0x072e('0x5d'))){_0x4432ae[_0x072e('0x2e')]=qs['limit'](_0x54a979[_0x072e('0x41')][_0x072e('0x2e')]);_0x4432ae['offset']=qs[_0x072e('0x2d')](_0x54a979['query'][_0x072e('0x2d')]);}return _0x3343e4[_0x072e('0x5e')](_0x4432ae);}})[_0x072e('0x22')](function(_0x2b4a0b){if(_0x2b4a0b){return _0x2b4a0b?{'count':_0x4c3617,'rows':_0x2b4a0b}:null;}})[_0x072e('0x22')](respondWithResult(_0x1b3dc1,null))[_0x072e('0x56')](handleError(_0x1b3dc1,null));};exports[_0x072e('0x60')]=function(_0x22d18d,_0x15d4c3,_0x56ff25){var _0x1cae64={};var _0x14164d={};var _0x106610;var _0x3b4b87;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x22d18d[_0x072e('0x54')]['id']}})['then'](handleEntityNotFound(_0x15d4c3,null))[_0x072e('0x22')](function(_0x14a2df){if(_0x14a2df){_0x106610=_0x14a2df;_0x14164d[_0x072e('0x3f')]=_[_0x072e('0x42')](db[_0x072e('0x5a')][_0x072e('0x3b')]);_0x14164d[_0x072e('0x41')]=_['keys'](_0x22d18d['query']);_0x14164d['filters']=_[_0x072e('0x43')](_0x14164d[_0x072e('0x3f')],_0x14164d[_0x072e('0x41')]);_0x1cae64['attributes']=_[_0x072e('0x43')](_0x14164d[_0x072e('0x3f')],qs[_0x072e('0x45')](_0x22d18d[_0x072e('0x41')][_0x072e('0x45')]));_0x1cae64['attributes']=_0x1cae64[_0x072e('0x44')][_0x072e('0x5b')]?_0x1cae64[_0x072e('0x44')]:_0x14164d[_0x072e('0x3f')];_0x1cae64['order']=qs[_0x072e('0x47')](_0x22d18d[_0x072e('0x41')]['sort']);_0x1cae64[_0x072e('0x48')]=qs[_0x072e('0x4a')](_[_0x072e('0x49')](_0x22d18d[_0x072e('0x41')],_0x14164d[_0x072e('0x4a')]));if(_0x22d18d[_0x072e('0x41')][_0x072e('0x4c')]){_0x1cae64[_0x072e('0x48')]=_[_0x072e('0x4d')](_0x1cae64['where'],{'$or':_[_0x072e('0x40')](_0x1cae64[_0x072e('0x44')],function(_0x266feb){var _0x449887={};_0x449887[_0x266feb]={'$like':'%'+_0x22d18d[_0x072e('0x41')][_0x072e('0x4c')]+'%'};return _0x449887;})});}_0x1cae64=_['merge']({},_0x1cae64,_0x22d18d[_0x072e('0x4e')]);return _0x106610[_0x072e('0x60')](_0x1cae64);}})[_0x072e('0x22')](function(_0x105a73){if(_0x105a73){_0x3b4b87=_0x105a73['length'];if(!_0x22d18d[_0x072e('0x41')][_0x072e('0x46')]('nolimit')){_0x1cae64['limit']=qs['limit'](_0x22d18d[_0x072e('0x41')]['limit']);_0x1cae64[_0x072e('0x2d')]=qs['offset'](_0x22d18d[_0x072e('0x41')][_0x072e('0x2d')]);}return _0x106610[_0x072e('0x60')](_0x1cae64);}})[_0x072e('0x22')](function(_0x22a6fd){if(_0x22a6fd){return _0x22a6fd?{'count':_0x3b4b87,'rows':_0x22a6fd}:null;}})['then'](respondWithResult(_0x15d4c3,null))[_0x072e('0x56')](handleError(_0x15d4c3,null));}; \ No newline at end of file +var _0xa42d=['name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','create','body','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','http','test','Sequelize','ValidationError','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack'];(function(_0x11bd78,_0x215f28){var _0x5864a7=function(_0x33735a){while(--_0x33735a){_0x11bd78['push'](_0x11bd78['shift']());}};_0x5864a7(++_0x215f28);}(_0xa42d,0xde));var _0xda42=function(_0x529391,_0x195752){_0x529391=_0x529391-0x0;var _0x50dc45=_0xa42d[_0x529391];return _0x50dc45;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xda42('0x0'));var rimraf=require(_0xda42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda42('0x2'));var BPromise=require(_0xda42('0x3'));var Mustache=require(_0xda42('0x4'));var util=require(_0xda42('0x5'));var path=require(_0xda42('0x6'));var sox=require('sox');var csv=require(_0xda42('0x7'));var ejs=require(_0xda42('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xda42('0x9'));var crypto=require(_0xda42('0xa'));var jsforce=require(_0xda42('0xb'));var deskjs=require(_0xda42('0xc'));var toCsv=require(_0xda42('0x7'));var querystring=require('querystring');var Papa=require(_0xda42('0xd'));var Redis=require(_0xda42('0xe'));var authService=require(_0xda42('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xda42('0x10'));var hardwareService=require(_0xda42('0x11'));var logger=require(_0xda42('0x12'))(_0xda42('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xda42('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xda42('0x15')][_0xda42('0x16')]({'port':0x232a});function checkPasswordPattern(_0x373bc6,_0x1c95b6,_0x43279b){if(_0x43279b){var _0x52db6a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52db6a[_0xda42('0x17')](_0x1c95b6)){return _0x373bc6;}else{throw new db[(_0xda42('0x18'))][(_0xda42('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x373bc6;}}function respondWithRpcPromise(_0x3440cd,_0x56b96a,_0x1fe68a,_0xa6b5a2){return new BPromise(function(_0x2a7e19,_0x46f032){var _0x346341=_0xa6b5a2||client;return _0x346341['request'](_0x3440cd,_0x1fe68a)[_0xda42('0x1a')](function(_0x46bd95){logger[_0xda42('0x1b')](_0xda42('0x1c'),_0x56b96a,_0xda42('0x1d'));logger['debug'](_0xda42('0x1e'),_0x56b96a,'request\x20sent',JSON[_0xda42('0x1f')](_0x46bd95));if(_0x46bd95[_0xda42('0x20')]){if(_0x46bd95[_0xda42('0x20')][_0xda42('0x21')]===0x1f4){logger[_0xda42('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x56b96a,_0x46bd95[_0xda42('0x20')][_0xda42('0x22')]);return _0x46f032(_0x46bd95[_0xda42('0x20')][_0xda42('0x22')]);}logger[_0xda42('0x20')](_0xda42('0x1c'),_0x56b96a,_0x46bd95[_0xda42('0x20')][_0xda42('0x22')]);return _0x2a7e19(_0x46bd95[_0xda42('0x20')][_0xda42('0x22')]);}else{logger[_0xda42('0x1b')](_0xda42('0x1c'),_0x56b96a,_0xda42('0x1d'));_0x2a7e19(_0x46bd95[_0xda42('0x23')][_0xda42('0x22')]);}})[_0xda42('0x24')](function(_0x6e8862){logger[_0xda42('0x20')](_0xda42('0x1c'),_0x56b96a,_0x6e8862);_0x46f032(_0x6e8862);});});}function respondWithStatusCode(_0x3babfd,_0x5a7109){_0x5a7109=_0x5a7109||0xcc;return function(_0x432c2c){if(_0x432c2c){return _0x3babfd['sendStatus'](_0x5a7109);}return _0x3babfd[_0xda42('0x25')](_0x5a7109)['end']();};}function respondWithResult(_0x205ad0,_0x16da96){_0x16da96=_0x16da96||0xc8;return function(_0x38729e){if(_0x38729e){return _0x205ad0[_0xda42('0x25')](_0x16da96)[_0xda42('0x26')](_0x38729e);}};}function respondWithFilteredResult(_0x2cc292,_0x18432e){return function(_0x31e3ac){if(_0x31e3ac){var _0x4b3fa1=_0x31e3ac[_0xda42('0x27')],_0xf1fc4c=_0x18432e[_0xda42('0x28')],_0x412d41=_0x18432e['offset']+_0x18432e['limit'],_0x2c8fae;if(_0x412d41>=_0x4b3fa1){_0x412d41=_0x4b3fa1;_0x2c8fae=0xc8;}else{_0x2c8fae=0xce;}_0x2cc292[_0xda42('0x25')](_0x2c8fae);return _0x2cc292[_0xda42('0x29')](_0xda42('0x2a'),_0xf1fc4c+'-'+_0x412d41+'/'+_0x4b3fa1)[_0xda42('0x26')](_0x31e3ac);}return null;};}function patchUpdates(_0x3cafa0){return function(_0x3a300f){try{jsonpatch[_0xda42('0x2b')](_0x3a300f,_0x3cafa0,!![]);}catch(_0x2690bf){return BPromise[_0xda42('0x2c')](_0x2690bf);}return _0x3a300f[_0xda42('0x2d')]();};}function saveUpdates(_0x3b9a68,_0x1e12d8){return function(_0x50c8eb){if(_0x50c8eb){return _0x50c8eb[_0xda42('0x2e')](_0x3b9a68)[_0xda42('0x1a')](function(_0x2eb64b){return _0x2eb64b;});}return null;};}function removeEntity(_0x535f97,_0x3eb0cc){return function(_0x3d4caa){if(_0x3d4caa){return _0x3d4caa[_0xda42('0x2f')]()[_0xda42('0x1a')](function(){_0x535f97[_0xda42('0x25')](0xcc)[_0xda42('0x30')]();});}};}function handleEntityNotFound(_0x39f89c,_0x52497b){return function(_0x34c284){if(!_0x34c284){_0x39f89c[_0xda42('0x31')](0x194);}return _0x34c284;};}function handleError(_0x45248b,_0x4868fe){_0x4868fe=_0x4868fe||0x1f4;return function(_0x240a65){logger['error'](_0x240a65[_0xda42('0x32')]);if(_0x240a65[_0xda42('0x33')]){delete _0x240a65[_0xda42('0x33')];}_0x45248b['status'](_0x4868fe)[_0xda42('0x34')](_0x240a65);};}exports[_0xda42('0x35')]=function(_0x4e43b5,_0x39463a){var _0x5bd484={},_0x55c935={},_0x54f71c={'count':0x0,'rows':[]};var _0x2c4365=_[_0xda42('0x36')](db[_0xda42('0x37')][_0xda42('0x38')],function(_0x4d7f3c){return{'name':_0x4d7f3c[_0xda42('0x39')],'type':_0x4d7f3c[_0xda42('0x3a')][_0xda42('0x3b')]};});_0x55c935[_0xda42('0x3c')]=_['map'](_0x2c4365,'name');_0x55c935[_0xda42('0x3d')]=_[_0xda42('0x3e')](_0x4e43b5[_0xda42('0x3d')]);_0x55c935[_0xda42('0x3f')]=_[_0xda42('0x40')](_0x55c935[_0xda42('0x3c')],_0x55c935['query']);_0x5bd484[_0xda42('0x41')]=_[_0xda42('0x40')](_0x55c935[_0xda42('0x3c')],qs[_0xda42('0x42')](_0x4e43b5[_0xda42('0x3d')]['fields']));_0x5bd484[_0xda42('0x41')]=_0x5bd484[_0xda42('0x41')]['length']?_0x5bd484['attributes']:_0x55c935['model'];if(!_0x4e43b5['query'][_0xda42('0x43')](_0xda42('0x44'))){_0x5bd484[_0xda42('0x45')]=qs[_0xda42('0x45')](_0x4e43b5['query'][_0xda42('0x45')]);_0x5bd484[_0xda42('0x28')]=qs[_0xda42('0x28')](_0x4e43b5[_0xda42('0x3d')]['offset']);}_0x5bd484[_0xda42('0x46')]=qs[_0xda42('0x47')](_0x4e43b5[_0xda42('0x3d')][_0xda42('0x47')]);_0x5bd484[_0xda42('0x48')]=qs[_0xda42('0x3f')](_[_0xda42('0x49')](_0x4e43b5['query'],_0x55c935[_0xda42('0x3f')]),_0x2c4365);if(_0x4e43b5[_0xda42('0x3d')][_0xda42('0x4a')]){_0x5bd484['where']=_['merge'](_0x5bd484[_0xda42('0x48')],{'$or':_[_0xda42('0x36')](_0x2c4365,function(_0x153079){if(_0x153079['type']!==_0xda42('0x4b')){var _0x3b0e38={};_0x3b0e38[_0x153079[_0xda42('0x33')]]={'$like':'%'+_0x4e43b5[_0xda42('0x3d')][_0xda42('0x4a')]+'%'};return _0x3b0e38;}})});}_0x5bd484=_[_0xda42('0x4c')]({},_0x5bd484,_0x4e43b5[_0xda42('0x4d')]);var _0xeaa16e={'where':_0x5bd484['where']};return db[_0xda42('0x37')][_0xda42('0x27')](_0xeaa16e)[_0xda42('0x1a')](function(_0x53d1b2){_0x54f71c['count']=_0x53d1b2;if(_0x4e43b5[_0xda42('0x3d')][_0xda42('0x4e')]){_0x5bd484[_0xda42('0x4f')]=[{'all':!![]}];}return db[_0xda42('0x37')][_0xda42('0x50')](_0x5bd484);})[_0xda42('0x1a')](function(_0x1d23d7){_0x54f71c['rows']=_0x1d23d7;return _0x54f71c;})[_0xda42('0x1a')](respondWithFilteredResult(_0x39463a,_0x5bd484))[_0xda42('0x24')](handleError(_0x39463a,null));};exports[_0xda42('0x51')]=function(_0x3a777c,_0xa4bcfd){var _0x1fc8d1={'raw':![],'where':{'id':_0x3a777c[_0xda42('0x52')]['id']}},_0x55fa7a={};_0x55fa7a['model']=_['keys'](db[_0xda42('0x37')][_0xda42('0x38')]);_0x55fa7a['query']=_[_0xda42('0x3e')](_0x3a777c[_0xda42('0x3d')]);_0x55fa7a['filters']=_[_0xda42('0x40')](_0x55fa7a[_0xda42('0x3c')],_0x55fa7a[_0xda42('0x3d')]);_0x1fc8d1[_0xda42('0x41')]=_[_0xda42('0x40')](_0x55fa7a[_0xda42('0x3c')],qs[_0xda42('0x42')](_0x3a777c[_0xda42('0x3d')][_0xda42('0x42')]));_0x1fc8d1[_0xda42('0x41')]=_0x1fc8d1['attributes'][_0xda42('0x53')]?_0x1fc8d1[_0xda42('0x41')]:_0x55fa7a[_0xda42('0x3c')];if(_0x3a777c[_0xda42('0x3d')][_0xda42('0x4e')]){_0x1fc8d1[_0xda42('0x4f')]=[{'all':!![]}];}_0x1fc8d1=_['merge']({},_0x1fc8d1,_0x3a777c[_0xda42('0x4d')]);return db[_0xda42('0x37')][_0xda42('0x54')](_0x1fc8d1)[_0xda42('0x1a')](handleEntityNotFound(_0xa4bcfd,null))[_0xda42('0x1a')](respondWithResult(_0xa4bcfd,null))['catch'](handleError(_0xa4bcfd,null));};exports[_0xda42('0x55')]=function(_0x54c76c,_0x5bfa49){return db['Dynamics365Configuration'][_0xda42('0x55')](_0x54c76c[_0xda42('0x56')],{})[_0xda42('0x1a')](respondWithResult(_0x5bfa49,0xc9))[_0xda42('0x24')](handleError(_0x5bfa49,null));};exports['update']=function(_0x2ca715,_0x3d4849){if(_0x2ca715[_0xda42('0x56')]['id']){delete _0x2ca715[_0xda42('0x56')]['id'];}return db[_0xda42('0x37')][_0xda42('0x54')]({'where':{'id':_0x2ca715[_0xda42('0x52')]['id']}})[_0xda42('0x1a')](handleEntityNotFound(_0x3d4849,null))[_0xda42('0x1a')](saveUpdates(_0x2ca715[_0xda42('0x56')],null))[_0xda42('0x1a')](respondWithResult(_0x3d4849,null))[_0xda42('0x24')](handleError(_0x3d4849,null));};exports[_0xda42('0x2f')]=function(_0x3a6e84,_0xe29aa1){return db['Dynamics365Configuration']['find']({'where':{'id':_0x3a6e84[_0xda42('0x52')]['id']}})[_0xda42('0x1a')](handleEntityNotFound(_0xe29aa1,null))[_0xda42('0x1a')](removeEntity(_0xe29aa1,null))[_0xda42('0x24')](handleError(_0xe29aa1,null));};exports[_0xda42('0x57')]=function(_0x1dd7c3,_0xbfcb17,_0xd3a363){var _0x458950={};var _0x1c0e3f={};var _0x25dfe2;var _0x3aada4;return db[_0xda42('0x37')][_0xda42('0x58')]({'where':{'id':_0x1dd7c3[_0xda42('0x52')]['id']}})[_0xda42('0x1a')](handleEntityNotFound(_0xbfcb17,null))[_0xda42('0x1a')](function(_0x17e2cb){if(_0x17e2cb){_0x25dfe2=_0x17e2cb;_0x1c0e3f[_0xda42('0x3c')]=_[_0xda42('0x3e')](db['Dynamics365Field'][_0xda42('0x38')]);_0x1c0e3f[_0xda42('0x3d')]=_[_0xda42('0x3e')](_0x1dd7c3[_0xda42('0x3d')]);_0x1c0e3f[_0xda42('0x3f')]=_['intersection'](_0x1c0e3f[_0xda42('0x3c')],_0x1c0e3f[_0xda42('0x3d')]);_0x458950[_0xda42('0x41')]=_['intersection'](_0x1c0e3f[_0xda42('0x3c')],qs[_0xda42('0x42')](_0x1dd7c3[_0xda42('0x3d')][_0xda42('0x42')]));_0x458950[_0xda42('0x41')]=_0x458950[_0xda42('0x41')][_0xda42('0x53')]?_0x458950[_0xda42('0x41')]:_0x1c0e3f[_0xda42('0x3c')];_0x458950[_0xda42('0x46')]=qs['sort'](_0x1dd7c3[_0xda42('0x3d')]['sort']);_0x458950[_0xda42('0x48')]=qs[_0xda42('0x3f')](_[_0xda42('0x49')](_0x1dd7c3['query'],_0x1c0e3f[_0xda42('0x3f')]));if(_0x1dd7c3[_0xda42('0x3d')]['filter']){_0x458950['where']=_[_0xda42('0x4c')](_0x458950['where'],{'$or':_[_0xda42('0x36')](_0x458950['attributes'],function(_0x163a1f){var _0x1479af={};_0x1479af[_0x163a1f]={'$like':'%'+_0x1dd7c3[_0xda42('0x3d')][_0xda42('0x4a')]+'%'};return _0x1479af;})});}_0x458950=_['merge']({},_0x458950,_0x1dd7c3[_0xda42('0x4d')]);return _0x25dfe2[_0xda42('0x57')](_0x458950);}})[_0xda42('0x1a')](function(_0x41cf93){if(_0x41cf93){_0x3aada4=_0x41cf93['length'];if(!_0x1dd7c3[_0xda42('0x3d')][_0xda42('0x43')]('nolimit')){_0x458950[_0xda42('0x45')]=qs[_0xda42('0x45')](_0x1dd7c3[_0xda42('0x3d')]['limit']);_0x458950['offset']=qs[_0xda42('0x28')](_0x1dd7c3[_0xda42('0x3d')]['offset']);}return _0x25dfe2[_0xda42('0x57')](_0x458950);}})['then'](function(_0x3ba0ad){if(_0x3ba0ad){return _0x3ba0ad?{'count':_0x3aada4,'rows':_0x3ba0ad}:null;}})[_0xda42('0x1a')](respondWithResult(_0xbfcb17,null))[_0xda42('0x24')](handleError(_0xbfcb17,null));};exports[_0xda42('0x59')]=function(_0x163bdf,_0x246578,_0x43ea44){var _0x42cf27={};var _0x33070b={};var _0xba8b39;var _0x192741;return db[_0xda42('0x37')][_0xda42('0x58')]({'where':{'id':_0x163bdf[_0xda42('0x52')]['id']}})[_0xda42('0x1a')](handleEntityNotFound(_0x246578,null))[_0xda42('0x1a')](function(_0x25d1db){if(_0x25d1db){_0xba8b39=_0x25d1db;_0x33070b[_0xda42('0x3c')]=_[_0xda42('0x3e')](db['Dynamics365Field'][_0xda42('0x38')]);_0x33070b[_0xda42('0x3d')]=_['keys'](_0x163bdf[_0xda42('0x3d')]);_0x33070b[_0xda42('0x3f')]=_['intersection'](_0x33070b[_0xda42('0x3c')],_0x33070b[_0xda42('0x3d')]);_0x42cf27[_0xda42('0x41')]=_[_0xda42('0x40')](_0x33070b[_0xda42('0x3c')],qs[_0xda42('0x42')](_0x163bdf[_0xda42('0x3d')][_0xda42('0x42')]));_0x42cf27[_0xda42('0x41')]=_0x42cf27['attributes'][_0xda42('0x53')]?_0x42cf27[_0xda42('0x41')]:_0x33070b[_0xda42('0x3c')];_0x42cf27['order']=qs['sort'](_0x163bdf[_0xda42('0x3d')][_0xda42('0x47')]);_0x42cf27['where']=qs[_0xda42('0x3f')](_[_0xda42('0x49')](_0x163bdf['query'],_0x33070b[_0xda42('0x3f')]));if(_0x163bdf['query'][_0xda42('0x4a')]){_0x42cf27[_0xda42('0x48')]=_[_0xda42('0x4c')](_0x42cf27[_0xda42('0x48')],{'$or':_['map'](_0x42cf27['attributes'],function(_0x3c617d){var _0x5a8dbb={};_0x5a8dbb[_0x3c617d]={'$like':'%'+_0x163bdf[_0xda42('0x3d')][_0xda42('0x4a')]+'%'};return _0x5a8dbb;})});}_0x42cf27=_['merge']({},_0x42cf27,_0x163bdf[_0xda42('0x4d')]);return _0xba8b39[_0xda42('0x59')](_0x42cf27);}})[_0xda42('0x1a')](function(_0x2ecb82){if(_0x2ecb82){_0x192741=_0x2ecb82[_0xda42('0x53')];if(!_0x163bdf[_0xda42('0x3d')]['hasOwnProperty']('nolimit')){_0x42cf27['limit']=qs['limit'](_0x163bdf[_0xda42('0x3d')][_0xda42('0x45')]);_0x42cf27[_0xda42('0x28')]=qs['offset'](_0x163bdf['query']['offset']);}return _0xba8b39[_0xda42('0x59')](_0x42cf27);}})['then'](function(_0x4b2e73){if(_0x4b2e73){return _0x4b2e73?{'count':_0x192741,'rows':_0x4b2e73}:null;}})['then'](respondWithResult(_0x246578,null))[_0xda42('0x24')](handleError(_0x246578,null));};exports['getDescriptions']=function(_0x51c2cc,_0xc422e7,_0x4429c5){var _0x5a4e72={};var _0x56afc9={};var _0x34906c;var _0x3efdc2;return db[_0xda42('0x37')][_0xda42('0x58')]({'where':{'id':_0x51c2cc[_0xda42('0x52')]['id']}})['then'](handleEntityNotFound(_0xc422e7,null))[_0xda42('0x1a')](function(_0x2382f5){if(_0x2382f5){_0x34906c=_0x2382f5;_0x56afc9['model']=_[_0xda42('0x3e')](db['Dynamics365Field'][_0xda42('0x38')]);_0x56afc9[_0xda42('0x3d')]=_[_0xda42('0x3e')](_0x51c2cc[_0xda42('0x3d')]);_0x56afc9[_0xda42('0x3f')]=_['intersection'](_0x56afc9[_0xda42('0x3c')],_0x56afc9['query']);_0x5a4e72[_0xda42('0x41')]=_[_0xda42('0x40')](_0x56afc9[_0xda42('0x3c')],qs[_0xda42('0x42')](_0x51c2cc['query']['fields']));_0x5a4e72[_0xda42('0x41')]=_0x5a4e72[_0xda42('0x41')][_0xda42('0x53')]?_0x5a4e72['attributes']:_0x56afc9[_0xda42('0x3c')];_0x5a4e72[_0xda42('0x46')]=qs[_0xda42('0x47')](_0x51c2cc[_0xda42('0x3d')][_0xda42('0x47')]);_0x5a4e72['where']=qs[_0xda42('0x3f')](_[_0xda42('0x49')](_0x51c2cc[_0xda42('0x3d')],_0x56afc9[_0xda42('0x3f')]));if(_0x51c2cc[_0xda42('0x3d')][_0xda42('0x4a')]){_0x5a4e72[_0xda42('0x48')]=_[_0xda42('0x4c')](_0x5a4e72[_0xda42('0x48')],{'$or':_[_0xda42('0x36')](_0x5a4e72['attributes'],function(_0x3d246c){var _0x5a2d14={};_0x5a2d14[_0x3d246c]={'$like':'%'+_0x51c2cc[_0xda42('0x3d')][_0xda42('0x4a')]+'%'};return _0x5a2d14;})});}_0x5a4e72=_[_0xda42('0x4c')]({},_0x5a4e72,_0x51c2cc[_0xda42('0x4d')]);return _0x34906c[_0xda42('0x5a')](_0x5a4e72);}})[_0xda42('0x1a')](function(_0x524459){if(_0x524459){_0x3efdc2=_0x524459[_0xda42('0x53')];if(!_0x51c2cc[_0xda42('0x3d')][_0xda42('0x43')]('nolimit')){_0x5a4e72[_0xda42('0x45')]=qs['limit'](_0x51c2cc[_0xda42('0x3d')]['limit']);_0x5a4e72[_0xda42('0x28')]=qs['offset'](_0x51c2cc[_0xda42('0x3d')][_0xda42('0x28')]);}return _0x34906c[_0xda42('0x5a')](_0x5a4e72);}})[_0xda42('0x1a')](function(_0x3de275){if(_0x3de275){return _0x3de275?{'count':_0x3efdc2,'rows':_0x3de275}:null;}})[_0xda42('0x1a')](respondWithResult(_0xc422e7,null))[_0xda42('0x24')](handleError(_0xc422e7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a283ca9..bcb4812 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 _0xba87=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x22bea9,_0x26d3a8){var _0x432864=function(_0x2aa3c9){while(--_0x2aa3c9){_0x22bea9['push'](_0x22bea9['shift']());}};_0x432864(++_0x26d3a8);}(_0xba87,0xb8));var _0x7ba8=function(_0x536380,_0x3f79d5){_0x536380=_0x536380-0x0;var _0xd2229d=_0xba87[_0x536380];return _0xd2229d;};'use strict';var _=require(_0x7ba8('0x0'));var util=require(_0x7ba8('0x1'));var logger=require(_0x7ba8('0x2'))(_0x7ba8('0x3'));var moment=require(_0x7ba8('0x4'));var BPromise=require(_0x7ba8('0x5'));var rp=require(_0x7ba8('0x6'));var fs=require('fs');var path=require(_0x7ba8('0x7'));var rimraf=require(_0x7ba8('0x8'));var config=require(_0x7ba8('0x9'));var attributes=require(_0x7ba8('0xa'));module[_0x7ba8('0xb')]=function(_0x471941,_0x2e2a0a){return _0x471941['define'](_0x7ba8('0xc'),attributes,{'tableName':_0x7ba8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0328=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x0328,0xf1));var _0x8032=function(_0xc93784,_0x142779){_0xc93784=_0xc93784-0x0;var _0x72f2c6=_0x0328[_0xc93784];return _0x72f2c6;};'use strict';var _=require('lodash');var util=require(_0x8032('0x0'));var logger=require(_0x8032('0x1'))(_0x8032('0x2'));var moment=require(_0x8032('0x3'));var BPromise=require(_0x8032('0x4'));var rp=require(_0x8032('0x5'));var fs=require('fs');var path=require(_0x8032('0x6'));var rimraf=require(_0x8032('0x7'));var config=require(_0x8032('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x8032('0x9')]=function(_0x310fb7,_0x17987d){return _0x310fb7[_0x8032('0xa')](_0x8032('0xb'),attributes,{'tableName':_0x8032('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 dfe8b71..a0e3af3 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 _0x6010=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x89ff78,_0x516791){var _0x1e9ebd=function(_0x4cfc08){while(--_0x4cfc08){_0x89ff78['push'](_0x89ff78['shift']());}};_0x1e9ebd(++_0x516791);}(_0x6010,0x15c));var _0x0601=function(_0x4512df,_0x152f60){_0x4512df=_0x4512df-0x0;var _0x87f6ac=_0x6010[_0x4512df];return _0x87f6ac;};'use strict';var _=require(_0x0601('0x0'));var util=require(_0x0601('0x1'));var moment=require(_0x0601('0x2'));var BPromise=require('bluebird');var rs=require(_0x0601('0x3'));var fs=require('fs');var Redis=require(_0x0601('0x4'));var db=require(_0x0601('0x5'))['db'];var utils=require(_0x0601('0x6'));var logger=require(_0x0601('0x7'))(_0x0601('0x8'));var config=require(_0x0601('0x9'));var jayson=require(_0x0601('0xa'));var client=jayson[_0x0601('0xb')][_0x0601('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x290d89,_0xb1ff02,_0x34f923){return new BPromise(function(_0x552683,_0xbdee8e){return client[_0x0601('0xd')](_0x290d89,_0x34f923)[_0x0601('0xe')](function(_0x33d74f){logger[_0x0601('0xf')](_0x0601('0x10'),_0xb1ff02,_0x0601('0x11'));logger[_0x0601('0x12')](_0x0601('0x13'),_0xb1ff02,_0x0601('0x11'),JSON[_0x0601('0x14')](_0x33d74f));if(_0x33d74f['error']){if(_0x33d74f[_0x0601('0x15')][_0x0601('0x16')]===0x1f4){logger['error'](_0x0601('0x10'),_0xb1ff02,_0x33d74f[_0x0601('0x15')][_0x0601('0x17')]);return _0xbdee8e(_0x33d74f[_0x0601('0x15')][_0x0601('0x17')]);}logger[_0x0601('0x15')](_0x0601('0x10'),_0xb1ff02,_0x33d74f[_0x0601('0x15')][_0x0601('0x17')]);return _0x552683(_0x33d74f['error']['message']);}else{logger[_0x0601('0xf')](_0x0601('0x10'),_0xb1ff02,_0x0601('0x11'));_0x552683(_0x33d74f['result']['message']);}})[_0x0601('0x18')](function(_0x266b76){logger[_0x0601('0x15')](_0x0601('0x10'),_0xb1ff02,_0x266b76);_0xbdee8e(_0x266b76);});});} \ No newline at end of file +var _0xd0e7=['debug','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','request\x20sent'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xd0e7,0xd8));var _0x7d0e=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xd0e7[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x7d0e('0x0'));var util=require(_0x7d0e('0x1'));var moment=require(_0x7d0e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d0e('0x3'));var db=require(_0x7d0e('0x4'))['db'];var utils=require(_0x7d0e('0x5'));var logger=require('../../config/logger')(_0x7d0e('0x6'));var config=require('../../config/environment');var jayson=require(_0x7d0e('0x7'));var client=jayson['client'][_0x7d0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8c1efe,_0x33b9cb,_0x384b7f){return new BPromise(function(_0x382c11,_0x5d8ff6){return client[_0x7d0e('0x9')](_0x8c1efe,_0x384b7f)['then'](function(_0x511865){logger[_0x7d0e('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x33b9cb,_0x7d0e('0xb'));logger[_0x7d0e('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x33b9cb,_0x7d0e('0xb'),JSON['stringify'](_0x511865));if(_0x511865[_0x7d0e('0xd')]){if(_0x511865['error'][_0x7d0e('0xe')]===0x1f4){logger[_0x7d0e('0xd')](_0x7d0e('0xf'),_0x33b9cb,_0x511865[_0x7d0e('0xd')][_0x7d0e('0x10')]);return _0x5d8ff6(_0x511865[_0x7d0e('0xd')][_0x7d0e('0x10')]);}logger[_0x7d0e('0xd')](_0x7d0e('0xf'),_0x33b9cb,_0x511865['error']['message']);return _0x382c11(_0x511865['error'][_0x7d0e('0x10')]);}else{logger[_0x7d0e('0xa')](_0x7d0e('0xf'),_0x33b9cb,_0x7d0e('0xb'));_0x382c11(_0x511865[_0x7d0e('0x11')][_0x7d0e('0x10')]);}})[_0x7d0e('0x12')](function(_0x35dbe6){logger[_0x7d0e('0xd')](_0x7d0e('0xf'),_0x33b9cb,_0x35dbe6);_0x5d8ff6(_0x35dbe6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 10dede1..7b09f23 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 _0x6282=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xb43382,_0x5710ea){var _0x8780a4=function(_0x318b81){while(--_0x318b81){_0xb43382['push'](_0xb43382['shift']());}};_0x8780a4(++_0x5710ea);}(_0x6282,0x76));var _0x2628=function(_0x2bb20b,_0x5dbba1){_0x2bb20b=_0x2bb20b-0x0;var _0x1b732d=_0x6282[_0x2bb20b];return _0x1b732d;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2628('0x4'));var interaction=require(_0x2628('0x5'));var config=require('../../config/environment');var controller=require(_0x2628('0x6'));router[_0x2628('0x7')]('/',auth[_0x2628('0x8')](),controller[_0x2628('0x9')]);router[_0x2628('0x7')]('/:id',auth[_0x2628('0x8')](),controller[_0x2628('0xa')]);router[_0x2628('0xb')]('/',auth[_0x2628('0x8')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')](_0x2628('0xe'),auth[_0x2628('0x8')](),controller[_0x2628('0xf')]);router[_0x2628('0x10')](_0x2628('0xe'),auth[_0x2628('0x8')](),controller[_0x2628('0x11')]);module[_0x2628('0x12')]=router; \ No newline at end of file +var _0x780f=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x4717d6,_0x55995b){var _0x3e8979=function(_0x15f08f){while(--_0x15f08f){_0x4717d6['push'](_0x4717d6['shift']());}};_0x3e8979(++_0x55995b);}(_0x780f,0x6c));var _0xf780=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x780f[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require(_0xf780('0x0'));var util=require(_0xf780('0x1'));var path=require(_0xf780('0x2'));var timeout=require(_0xf780('0x3'));var express=require(_0xf780('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf780('0x5'));var config=require(_0xf780('0x6'));var controller=require(_0xf780('0x7'));router[_0xf780('0x8')]('/',auth['isAuthenticated'](),controller[_0xf780('0x9')]);router['get'](_0xf780('0xa'),auth[_0xf780('0xb')](),controller[_0xf780('0xc')]);router[_0xf780('0xd')]('/',auth[_0xf780('0xb')](),controller[_0xf780('0xe')]);router['put'](_0xf780('0xa'),auth[_0xf780('0xb')](),controller[_0xf780('0xf')]);router[_0xf780('0x10')](_0xf780('0xa'),auth[_0xf780('0xb')](),controller[_0xf780('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5d122cb..c64d8ce 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 _0xb95a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x154d1e,_0x1f705a){var _0x17568e=function(_0x2da0bb){while(--_0x2da0bb){_0x154d1e['push'](_0x154d1e['shift']());}};_0x17568e(++_0x1f705a);}(_0xb95a,0x13b));var _0xab95=function(_0x399d1e,_0x425e53){_0x399d1e=_0x399d1e-0x0;var _0x1223a0=_0xb95a[_0x399d1e];return _0x1223a0;};'use strict';var Sequelize=require(_0xab95('0x0'));module[_0xab95('0x1')]={'type':{'type':Sequelize[_0xab95('0x2')](_0xab95('0x3'),_0xab95('0x4'),_0xab95('0x5'),_0xab95('0x6')),'defaultValue':_0xab95('0x3')},'content':{'type':Sequelize[_0xab95('0x7')]},'key':{'type':Sequelize[_0xab95('0x7')]},'keyType':{'type':Sequelize[_0xab95('0x2')](_0xab95('0x3'),'variable',_0xab95('0x5'))},'keyContent':{'type':Sequelize[_0xab95('0x7')]},'idField':{'type':Sequelize[_0xab95('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xab95('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab95('0x7')]}}; \ No newline at end of file +var _0x28ff=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x298ee8,_0x478638){var _0x23abe1=function(_0x2db58c){while(--_0x2db58c){_0x298ee8['push'](_0x298ee8['shift']());}};_0x23abe1(++_0x478638);}(_0x28ff,0x138));var _0xf28f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x28ff[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module[_0xf28f('0x0')]={'type':{'type':Sequelize[_0xf28f('0x1')](_0xf28f('0x2'),_0xf28f('0x3'),_0xf28f('0x4'),_0xf28f('0x5')),'defaultValue':_0xf28f('0x2')},'content':{'type':Sequelize[_0xf28f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf28f('0x1')]('string','variable',_0xf28f('0x4'))},'keyContent':{'type':Sequelize[_0xf28f('0x6')]},'idField':{'type':Sequelize[_0xf28f('0x6')]},'nameField':{'type':Sequelize[_0xf28f('0x6')]},'customField':{'type':Sequelize[_0xf28f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf28f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c05dbb0..1267335 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 _0x2743=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','Dynamics365Field','find','create','body','html-pdf','eml-format','rimraf','moment','mustache','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x51cbc9,_0x2df7c7){var _0x5bd721=function(_0x3c077f){while(--_0x3c077f){_0x51cbc9['push'](_0x51cbc9['shift']());}};_0x5bd721(++_0x2df7c7);}(_0x2743,0x176));var _0x3274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2743[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3274('0x0'));var emlformat=require(_0x3274('0x1'));var rimraf=require(_0x3274('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3274('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3274('0x4'));var util=require('util');var path=require(_0x3274('0x5'));var sox=require('sox');var csv=require(_0x3274('0x6'));var ejs=require(_0x3274('0x7'));var fs=require('fs');var _=require(_0x3274('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3274('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3274('0x6'));var querystring=require(_0x3274('0xa'));var Papa=require('papaparse');var Redis=require(_0x3274('0xb'));var authService=require(_0x3274('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x3274('0xd'));var hardwareService=require(_0x3274('0xe'));var logger=require(_0x3274('0xf'))(_0x3274('0x10'));var utils=require(_0x3274('0x11'));var config=require(_0x3274('0x12'));var db=require(_0x3274('0x13'))['db'];function respondWithStatusCode(_0x3d4142,_0x158876){_0x158876=_0x158876||0xcc;return function(_0x26e6ad){if(_0x26e6ad){return _0x3d4142[_0x3274('0x14')](_0x158876);}return _0x3d4142[_0x3274('0x15')](_0x158876)[_0x3274('0x16')]();};}function respondWithResult(_0x3a638c,_0x188810){_0x188810=_0x188810||0xc8;return function(_0xbf5951){if(_0xbf5951){return _0x3a638c[_0x3274('0x15')](_0x188810)[_0x3274('0x17')](_0xbf5951);}};}function respondWithFilteredResult(_0x5acb9e,_0x21fea2){return function(_0x43757c){if(_0x43757c){var _0xe11df5=_0x43757c[_0x3274('0x18')],_0x1c9a95=_0x21fea2[_0x3274('0x19')],_0x10a0ed=_0x21fea2[_0x3274('0x19')]+_0x21fea2[_0x3274('0x1a')],_0x682369;if(_0x10a0ed>=_0xe11df5){_0x10a0ed=_0xe11df5;_0x682369=0xc8;}else{_0x682369=0xce;}_0x5acb9e['status'](_0x682369);return _0x5acb9e['set'](_0x3274('0x1b'),_0x1c9a95+'-'+_0x10a0ed+'/'+_0xe11df5)[_0x3274('0x17')](_0x43757c);}return null;};}function patchUpdates(_0xc11384){return function(_0x132485){try{jsonpatch[_0x3274('0x1c')](_0x132485,_0xc11384,!![]);}catch(_0x2da103){return BPromise[_0x3274('0x1d')](_0x2da103);}return _0x132485['save']();};}function saveUpdates(_0x582e0a,_0x3f4a32){return function(_0x3e227f){if(_0x3e227f){return _0x3e227f[_0x3274('0x1e')](_0x582e0a)['then'](function(_0x2dbb4d){return _0x2dbb4d;});}return null;};}function removeEntity(_0x555f04,_0x4f3f59){return function(_0x523caa){if(_0x523caa){return _0x523caa[_0x3274('0x1f')]()[_0x3274('0x20')](function(){_0x555f04[_0x3274('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42ee68,_0x3b8355){return function(_0x46bca6){if(!_0x46bca6){_0x42ee68['sendStatus'](0x194);}return _0x46bca6;};}function handleError(_0x2653bf,_0x53b017){_0x53b017=_0x53b017||0x1f4;return function(_0x121ab7){logger[_0x3274('0x21')](_0x121ab7[_0x3274('0x22')]);if(_0x121ab7[_0x3274('0x23')]){delete _0x121ab7['name'];}_0x2653bf[_0x3274('0x15')](_0x53b017)['send'](_0x121ab7);};}exports[_0x3274('0x24')]=function(_0x2cd3ad,_0x8f9b97){var _0xa4c026={},_0x1676e8={},_0x3a9b3a={'count':0x0,'rows':[]};var _0x2f1897=_['map'](db['Dynamics365Field'][_0x3274('0x25')],function(_0x1ea0bf){return{'name':_0x1ea0bf['fieldName'],'type':_0x1ea0bf['type'][_0x3274('0x26')]};});_0x1676e8[_0x3274('0x27')]=_['map'](_0x2f1897,_0x3274('0x23'));_0x1676e8[_0x3274('0x28')]=_[_0x3274('0x29')](_0x2cd3ad[_0x3274('0x28')]);_0x1676e8[_0x3274('0x2a')]=_[_0x3274('0x2b')](_0x1676e8[_0x3274('0x27')],_0x1676e8[_0x3274('0x28')]);_0xa4c026[_0x3274('0x2c')]=_['intersection'](_0x1676e8['model'],qs[_0x3274('0x2d')](_0x2cd3ad[_0x3274('0x28')][_0x3274('0x2d')]));_0xa4c026[_0x3274('0x2c')]=_0xa4c026[_0x3274('0x2c')]['length']?_0xa4c026[_0x3274('0x2c')]:_0x1676e8[_0x3274('0x27')];if(!_0x2cd3ad[_0x3274('0x28')]['hasOwnProperty'](_0x3274('0x2e'))){_0xa4c026[_0x3274('0x1a')]=qs['limit'](_0x2cd3ad[_0x3274('0x28')]['limit']);_0xa4c026[_0x3274('0x19')]=qs['offset'](_0x2cd3ad[_0x3274('0x28')][_0x3274('0x19')]);}_0xa4c026[_0x3274('0x2f')]=qs['sort'](_0x2cd3ad[_0x3274('0x28')][_0x3274('0x30')]);_0xa4c026[_0x3274('0x31')]=qs['filters'](_[_0x3274('0x32')](_0x2cd3ad[_0x3274('0x28')],_0x1676e8[_0x3274('0x2a')]),_0x2f1897);if(_0x2cd3ad[_0x3274('0x28')][_0x3274('0x33')]){_0xa4c026[_0x3274('0x31')]=_[_0x3274('0x34')](_0xa4c026['where'],{'$or':_['map'](_0x2f1897,function(_0x2e7592){if(_0x2e7592['type']!==_0x3274('0x35')){var _0x1b2b8f={};_0x1b2b8f[_0x2e7592[_0x3274('0x23')]]={'$like':'%'+_0x2cd3ad[_0x3274('0x28')][_0x3274('0x33')]+'%'};return _0x1b2b8f;}})});}_0xa4c026=_[_0x3274('0x34')]({},_0xa4c026,_0x2cd3ad[_0x3274('0x36')]);var _0x5c27e2={'where':_0xa4c026[_0x3274('0x31')]};return db['Dynamics365Field'][_0x3274('0x18')](_0x5c27e2)[_0x3274('0x20')](function(_0x597380){_0x3a9b3a[_0x3274('0x18')]=_0x597380;if(_0x2cd3ad[_0x3274('0x28')]['includeAll']){_0xa4c026[_0x3274('0x37')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x3274('0x38')](_0xa4c026);})[_0x3274('0x20')](function(_0xa4f226){_0x3a9b3a['rows']=_0xa4f226;return _0x3a9b3a;})[_0x3274('0x20')](respondWithFilteredResult(_0x8f9b97,_0xa4c026))[_0x3274('0x39')](handleError(_0x8f9b97,null));};exports[_0x3274('0x3a')]=function(_0x14e4dd,_0x10e7e6){var _0x210ae7={'raw':!![],'where':{'id':_0x14e4dd[_0x3274('0x3b')]['id']}},_0x2ea66f={};_0x2ea66f[_0x3274('0x27')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x2ea66f['query']=_[_0x3274('0x29')](_0x14e4dd[_0x3274('0x28')]);_0x2ea66f[_0x3274('0x2a')]=_['intersection'](_0x2ea66f['model'],_0x2ea66f[_0x3274('0x28')]);_0x210ae7[_0x3274('0x2c')]=_['intersection'](_0x2ea66f['model'],qs[_0x3274('0x2d')](_0x14e4dd[_0x3274('0x28')][_0x3274('0x2d')]));_0x210ae7[_0x3274('0x2c')]=_0x210ae7[_0x3274('0x2c')][_0x3274('0x3c')]?_0x210ae7[_0x3274('0x2c')]:_0x2ea66f[_0x3274('0x27')];if(_0x14e4dd[_0x3274('0x28')]['includeAll']){_0x210ae7[_0x3274('0x37')]=[{'all':!![]}];}_0x210ae7=_[_0x3274('0x34')]({},_0x210ae7,_0x14e4dd[_0x3274('0x36')]);return db[_0x3274('0x3d')][_0x3274('0x3e')](_0x210ae7)[_0x3274('0x20')](handleEntityNotFound(_0x10e7e6,null))['then'](respondWithResult(_0x10e7e6,null))['catch'](handleError(_0x10e7e6,null));};exports['create']=function(_0x14efe6,_0x223d3a){return db[_0x3274('0x3d')][_0x3274('0x3f')](_0x14efe6[_0x3274('0x40')],{})['then'](respondWithResult(_0x223d3a,0xc9))[_0x3274('0x39')](handleError(_0x223d3a,null));};exports[_0x3274('0x1e')]=function(_0x39f192,_0x4384af){if(_0x39f192['body']['id']){delete _0x39f192[_0x3274('0x40')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x39f192[_0x3274('0x3b')]['id']}})[_0x3274('0x20')](handleEntityNotFound(_0x4384af,null))[_0x3274('0x20')](saveUpdates(_0x39f192[_0x3274('0x40')],null))['then'](respondWithResult(_0x4384af,null))['catch'](handleError(_0x4384af,null));};exports['destroy']=function(_0x420dc3,_0x82482b){return db[_0x3274('0x3d')][_0x3274('0x3e')]({'where':{'id':_0x420dc3['params']['id']}})['then'](handleEntityNotFound(_0x82482b,null))[_0x3274('0x20')](removeEntity(_0x82482b,null))[_0x3274('0x39')](handleError(_0x82482b,null));}; \ No newline at end of file +var _0x2560=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x1ad9f7,_0x3df7bc){var _0x495299=function(_0xb431b){while(--_0xb431b){_0x1ad9f7['push'](_0x1ad9f7['shift']());}};_0x495299(++_0x3df7bc);}(_0x2560,0x9a));var _0x0256=function(_0x68035a,_0x350f4e){_0x68035a=_0x68035a-0x0;var _0x47c80d=_0x2560[_0x68035a];return _0x47c80d;};'use strict';var pdf=require(_0x0256('0x0'));var emlformat=require(_0x0256('0x1'));var rimraf=require(_0x0256('0x2'));var zipdir=require(_0x0256('0x3'));var jsonpatch=require(_0x0256('0x4'));var rp=require(_0x0256('0x5'));var moment=require(_0x0256('0x6'));var BPromise=require(_0x0256('0x7'));var Mustache=require(_0x0256('0x8'));var util=require(_0x0256('0x9'));var path=require('path');var sox=require(_0x0256('0xa'));var csv=require(_0x0256('0xb'));var ejs=require(_0x0256('0xc'));var fs=require('fs');var _=require(_0x0256('0xd'));var squel=require('squel');var crypto=require(_0x0256('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0256('0xf'));var toCsv=require(_0x0256('0xb'));var querystring=require(_0x0256('0x10'));var Papa=require(_0x0256('0x11'));var Redis=require(_0x0256('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0256('0x13'));var as=require(_0x0256('0x14'));var hardwareService=require(_0x0256('0x15'));var logger=require(_0x0256('0x16'))(_0x0256('0x17'));var utils=require(_0x0256('0x18'));var config=require(_0x0256('0x19'));var db=require(_0x0256('0x1a'))['db'];function respondWithStatusCode(_0x5adf18,_0x4986f8){_0x4986f8=_0x4986f8||0xcc;return function(_0x34808b){if(_0x34808b){return _0x5adf18[_0x0256('0x1b')](_0x4986f8);}return _0x5adf18[_0x0256('0x1c')](_0x4986f8)['end']();};}function respondWithResult(_0x37e907,_0x2a9c88){_0x2a9c88=_0x2a9c88||0xc8;return function(_0x19d07e){if(_0x19d07e){return _0x37e907[_0x0256('0x1c')](_0x2a9c88)[_0x0256('0x1d')](_0x19d07e);}};}function respondWithFilteredResult(_0x4dab74,_0x45ab72){return function(_0x539752){if(_0x539752){var _0x2bf170=_0x539752[_0x0256('0x1e')],_0x5a6da6=_0x45ab72[_0x0256('0x1f')],_0x3ae450=_0x45ab72[_0x0256('0x1f')]+_0x45ab72['limit'],_0x1e1a70;if(_0x3ae450>=_0x2bf170){_0x3ae450=_0x2bf170;_0x1e1a70=0xc8;}else{_0x1e1a70=0xce;}_0x4dab74[_0x0256('0x1c')](_0x1e1a70);return _0x4dab74['set'](_0x0256('0x20'),_0x5a6da6+'-'+_0x3ae450+'/'+_0x2bf170)['json'](_0x539752);}return null;};}function patchUpdates(_0x38e56d){return function(_0x252d4d){try{jsonpatch[_0x0256('0x21')](_0x252d4d,_0x38e56d,!![]);}catch(_0x592687){return BPromise[_0x0256('0x22')](_0x592687);}return _0x252d4d[_0x0256('0x23')]();};}function saveUpdates(_0x1f9125,_0x3c497c){return function(_0x26c3a6){if(_0x26c3a6){return _0x26c3a6[_0x0256('0x24')](_0x1f9125)['then'](function(_0x1f9c74){return _0x1f9c74;});}return null;};}function removeEntity(_0x984113,_0x2a54d9){return function(_0x2f048a){if(_0x2f048a){return _0x2f048a['destroy']()[_0x0256('0x25')](function(){_0x984113[_0x0256('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42e3a8,_0x4220be){return function(_0x350108){if(!_0x350108){_0x42e3a8[_0x0256('0x1b')](0x194);}return _0x350108;};}function handleError(_0x494d7e,_0x30b19a){_0x30b19a=_0x30b19a||0x1f4;return function(_0x54568a){logger['error'](_0x54568a[_0x0256('0x26')]);if(_0x54568a[_0x0256('0x27')]){delete _0x54568a[_0x0256('0x27')];}_0x494d7e[_0x0256('0x1c')](_0x30b19a)[_0x0256('0x28')](_0x54568a);};}exports[_0x0256('0x29')]=function(_0x2bf46c,_0x4fdee2){var _0x5137a8={},_0x5867c0={},_0x4f406f={'count':0x0,'rows':[]};var _0x2cc130=_[_0x0256('0x2a')](db[_0x0256('0x2b')][_0x0256('0x2c')],function(_0x50aed7){return{'name':_0x50aed7[_0x0256('0x2d')],'type':_0x50aed7[_0x0256('0x2e')][_0x0256('0x2f')]};});_0x5867c0[_0x0256('0x30')]=_['map'](_0x2cc130,_0x0256('0x27'));_0x5867c0['query']=_[_0x0256('0x31')](_0x2bf46c[_0x0256('0x32')]);_0x5867c0[_0x0256('0x33')]=_[_0x0256('0x34')](_0x5867c0['model'],_0x5867c0['query']);_0x5137a8[_0x0256('0x35')]=_['intersection'](_0x5867c0[_0x0256('0x30')],qs[_0x0256('0x36')](_0x2bf46c[_0x0256('0x32')][_0x0256('0x36')]));_0x5137a8[_0x0256('0x35')]=_0x5137a8[_0x0256('0x35')][_0x0256('0x37')]?_0x5137a8[_0x0256('0x35')]:_0x5867c0[_0x0256('0x30')];if(!_0x2bf46c[_0x0256('0x32')][_0x0256('0x38')]('nolimit')){_0x5137a8['limit']=qs[_0x0256('0x39')](_0x2bf46c['query'][_0x0256('0x39')]);_0x5137a8[_0x0256('0x1f')]=qs[_0x0256('0x1f')](_0x2bf46c[_0x0256('0x32')][_0x0256('0x1f')]);}_0x5137a8[_0x0256('0x3a')]=qs[_0x0256('0x3b')](_0x2bf46c['query']['sort']);_0x5137a8[_0x0256('0x3c')]=qs['filters'](_[_0x0256('0x3d')](_0x2bf46c[_0x0256('0x32')],_0x5867c0[_0x0256('0x33')]),_0x2cc130);if(_0x2bf46c[_0x0256('0x32')][_0x0256('0x3e')]){_0x5137a8['where']=_[_0x0256('0x3f')](_0x5137a8[_0x0256('0x3c')],{'$or':_[_0x0256('0x2a')](_0x2cc130,function(_0x2c4265){if(_0x2c4265[_0x0256('0x2e')]!==_0x0256('0x40')){var _0x13769e={};_0x13769e[_0x2c4265[_0x0256('0x27')]]={'$like':'%'+_0x2bf46c['query']['filter']+'%'};return _0x13769e;}})});}_0x5137a8=_[_0x0256('0x3f')]({},_0x5137a8,_0x2bf46c[_0x0256('0x41')]);var _0x5123b4={'where':_0x5137a8[_0x0256('0x3c')]};return db['Dynamics365Field'][_0x0256('0x1e')](_0x5123b4)['then'](function(_0x4548d8){_0x4f406f[_0x0256('0x1e')]=_0x4548d8;if(_0x2bf46c['query'][_0x0256('0x42')]){_0x5137a8['include']=[{'all':!![]}];}return db[_0x0256('0x2b')][_0x0256('0x43')](_0x5137a8);})[_0x0256('0x25')](function(_0x2679ca){_0x4f406f[_0x0256('0x44')]=_0x2679ca;return _0x4f406f;})['then'](respondWithFilteredResult(_0x4fdee2,_0x5137a8))[_0x0256('0x45')](handleError(_0x4fdee2,null));};exports[_0x0256('0x46')]=function(_0xb545af,_0x4e56dc){var _0x5557d4={'raw':!![],'where':{'id':_0xb545af[_0x0256('0x47')]['id']}},_0x4301f4={};_0x4301f4[_0x0256('0x30')]=_[_0x0256('0x31')](db['Dynamics365Field'][_0x0256('0x2c')]);_0x4301f4[_0x0256('0x32')]=_[_0x0256('0x31')](_0xb545af[_0x0256('0x32')]);_0x4301f4[_0x0256('0x33')]=_[_0x0256('0x34')](_0x4301f4['model'],_0x4301f4[_0x0256('0x32')]);_0x5557d4['attributes']=_[_0x0256('0x34')](_0x4301f4[_0x0256('0x30')],qs['fields'](_0xb545af['query'][_0x0256('0x36')]));_0x5557d4[_0x0256('0x35')]=_0x5557d4[_0x0256('0x35')]['length']?_0x5557d4[_0x0256('0x35')]:_0x4301f4[_0x0256('0x30')];if(_0xb545af[_0x0256('0x32')][_0x0256('0x42')]){_0x5557d4[_0x0256('0x48')]=[{'all':!![]}];}_0x5557d4=_['merge']({},_0x5557d4,_0xb545af[_0x0256('0x41')]);return db[_0x0256('0x2b')][_0x0256('0x49')](_0x5557d4)[_0x0256('0x25')](handleEntityNotFound(_0x4e56dc,null))[_0x0256('0x25')](respondWithResult(_0x4e56dc,null))[_0x0256('0x45')](handleError(_0x4e56dc,null));};exports[_0x0256('0x4a')]=function(_0x2b0f70,_0x3afe47){return db[_0x0256('0x2b')]['create'](_0x2b0f70[_0x0256('0x4b')],{})[_0x0256('0x25')](respondWithResult(_0x3afe47,0xc9))[_0x0256('0x45')](handleError(_0x3afe47,null));};exports['update']=function(_0x403aa2,_0x2f731c){if(_0x403aa2[_0x0256('0x4b')]['id']){delete _0x403aa2[_0x0256('0x4b')]['id'];}return db[_0x0256('0x2b')][_0x0256('0x49')]({'where':{'id':_0x403aa2[_0x0256('0x47')]['id']}})[_0x0256('0x25')](handleEntityNotFound(_0x2f731c,null))[_0x0256('0x25')](saveUpdates(_0x403aa2[_0x0256('0x4b')],null))[_0x0256('0x25')](respondWithResult(_0x2f731c,null))[_0x0256('0x45')](handleError(_0x2f731c,null));};exports['destroy']=function(_0x5b9d8a,_0x34ca7f){return db[_0x0256('0x2b')][_0x0256('0x49')]({'where':{'id':_0x5b9d8a[_0x0256('0x47')]['id']}})[_0x0256('0x25')](handleEntityNotFound(_0x34ca7f,null))['then'](removeEntity(_0x34ca7f,null))[_0x0256('0x45')](handleError(_0x34ca7f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a241f47..5ef2269 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 _0x7d6b=['int_dynamics365_fields','dynamics365_unique_index','util','api','moment','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x1a8ad3,_0x5254af){var _0xd83aa5=function(_0x4ce4ca){while(--_0x4ce4ca){_0x1a8ad3['push'](_0x1a8ad3['shift']());}};_0xd83aa5(++_0x5254af);}(_0x7d6b,0x6e));var _0xb7d6=function(_0x1fa220,_0x82e1d3){_0x1fa220=_0x1fa220-0x0;var _0x564910=_0x7d6b[_0x1fa220];return _0x564910;};'use strict';var _=require('lodash');var util=require(_0xb7d6('0x0'));var logger=require('../../config/logger')(_0xb7d6('0x1'));var moment=require(_0xb7d6('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7d6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7d6('0x4'));var config=require(_0xb7d6('0x5'));var attributes=require(_0xb7d6('0x6'));module[_0xb7d6('0x7')]=function(_0x471cc7,_0x7b1d4d){return _0x471cc7[_0xb7d6('0x8')](_0xb7d6('0x9'),attributes,{'tableName':_0xb7d6('0xa'),'paranoid':![],'indexes':[{'name':_0xb7d6('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48dc=['int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x50b50f,_0x367677){var _0x57c486=function(_0x2964dd){while(--_0x2964dd){_0x50b50f['push'](_0x50b50f['shift']());}};_0x57c486(++_0x367677);}(_0x48dc,0x1e4));var _0xc48d=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0x48dc[_0x4baac8];return _0x56ebc5;};'use strict';var _=require('lodash');var util=require(_0xc48d('0x0'));var logger=require(_0xc48d('0x1'))(_0xc48d('0x2'));var moment=require(_0xc48d('0x3'));var BPromise=require(_0xc48d('0x4'));var rp=require(_0xc48d('0x5'));var fs=require('fs');var path=require(_0xc48d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc48d('0x7'));module['exports']=function(_0x5fac22,_0x3986db){return _0x5fac22[_0xc48d('0x8')](_0xc48d('0x9'),attributes,{'tableName':_0xc48d('0xa'),'paranoid':![],'indexes':[{'name':_0xc48d('0xb'),'fields':['idField',_0xc48d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index c6917f3..8861e1f 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 _0xed54=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','util'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0xed54,0xfc));var _0x4ed5=function(_0x2aa1a5,_0x123941){_0x2aa1a5=_0x2aa1a5-0x0;var _0x6fe8ba=_0xed54[_0x2aa1a5];return _0x6fe8ba;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var moment=require(_0x4ed5('0x1'));var BPromise=require(_0x4ed5('0x2'));var rs=require(_0x4ed5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ed5('0x4'))['db'];var utils=require(_0x4ed5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ed5('0x6'));var jayson=require(_0x4ed5('0x7'));var client=jayson[_0x4ed5('0x8')][_0x4ed5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32b0b3,_0x406871,_0x499db9){return new BPromise(function(_0x487945,_0x3993ac){return client[_0x4ed5('0xa')](_0x32b0b3,_0x499db9)[_0x4ed5('0xb')](function(_0xb74766){logger[_0x4ed5('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x406871,_0x4ed5('0xd'));logger[_0x4ed5('0xe')](_0x4ed5('0xf'),_0x406871,_0x4ed5('0xd'),JSON[_0x4ed5('0x10')](_0xb74766));if(_0xb74766['error']){if(_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x12')]===0x1f4){logger[_0x4ed5('0x11')](_0x4ed5('0x13'),_0x406871,_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);return _0x3993ac(_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x406871,_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);return _0x487945(_0xb74766[_0x4ed5('0x11')][_0x4ed5('0x14')]);}else{logger[_0x4ed5('0xc')](_0x4ed5('0x13'),_0x406871,_0x4ed5('0xd'));_0x487945(_0xb74766[_0x4ed5('0x15')][_0x4ed5('0x14')]);}})[_0x4ed5('0x16')](function(_0x168916){logger[_0x4ed5('0x11')](_0x4ed5('0x13'),_0x406871,_0x168916);_0x3993ac(_0x168916);});});} \ No newline at end of file +var _0x80c3=['message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s'];(function(_0x1490c9,_0x3255af){var _0x505429=function(_0x334c17){while(--_0x334c17){_0x1490c9['push'](_0x1490c9['shift']());}};_0x505429(++_0x3255af);}(_0x80c3,0x18f));var _0x380c=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x80c3[_0x27530d];return _0x59e561;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332ed3,_0x395efa,_0x1cdbad){return new BPromise(function(_0x59445f,_0x1d853e){return client[_0x380c('0x6')](_0x332ed3,_0x1cdbad)['then'](function(_0xdd635d){logger[_0x380c('0x7')]('Dynamics365Field,\x20%s,\x20%s',_0x395efa,_0x380c('0x8'));logger[_0x380c('0x9')](_0x380c('0xa'),_0x395efa,'request\x20sent',JSON[_0x380c('0xb')](_0xdd635d));if(_0xdd635d[_0x380c('0xc')]){if(_0xdd635d[_0x380c('0xc')][_0x380c('0xd')]===0x1f4){logger[_0x380c('0xc')](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);return _0x1d853e(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}logger['error'](_0x380c('0xe'),_0x395efa,_0xdd635d[_0x380c('0xc')]['message']);return _0x59445f(_0xdd635d[_0x380c('0xc')][_0x380c('0xf')]);}else{logger[_0x380c('0x7')](_0x380c('0xe'),_0x395efa,_0x380c('0x8'));_0x59445f(_0xdd635d[_0x380c('0x10')][_0x380c('0xf')]);}})[_0x380c('0x11')](function(_0x3022e6){logger['error'](_0x380c('0xe'),_0x395efa,_0x3022e6);_0x1d853e(_0x3022e6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 36baf46..eae027e 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 _0x4abf=['index','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4abf,0x133));var _0xf4ab=function(_0x18f1db,_0x5f545b){_0x18f1db=_0x18f1db-0x0;var _0x481861=_0x4abf[_0x18f1db];return _0x481861;};'use strict';var multer=require('multer');var util=require(_0xf4ab('0x0'));var path=require(_0xf4ab('0x1'));var timeout=require(_0xf4ab('0x2'));var express=require(_0xf4ab('0x3'));var router=express[_0xf4ab('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf4ab('0x5'));router[_0xf4ab('0x6')]('/',auth[_0xf4ab('0x7')](),controller[_0xf4ab('0x8')]);router[_0xf4ab('0x6')](_0xf4ab('0x9'),auth[_0xf4ab('0x7')](),controller[_0xf4ab('0xa')]);router[_0xf4ab('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf4ab('0xb')]);router[_0xf4ab('0x6')]('/:id/fields',auth[_0xf4ab('0x7')](),controller[_0xf4ab('0xc')]);router['post']('/',auth[_0xf4ab('0x7')](),controller[_0xf4ab('0xd')]);router[_0xf4ab('0xe')](_0xf4ab('0xf'),auth[_0xf4ab('0x7')](),controller[_0xf4ab('0x10')]);router[_0xf4ab('0x11')](_0xf4ab('0x9'),auth[_0xf4ab('0x7')](),controller[_0xf4ab('0x12')]);router['delete'](_0xf4ab('0x9'),auth[_0xf4ab('0x7')](),controller[_0xf4ab('0x13')]);module[_0xf4ab('0x14')]=router; \ No newline at end of file +var _0x2c2c=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x2c2c,0x12a));var _0xc2c2=function(_0x958c81,_0x4650ec){_0x958c81=_0x958c81-0x0;var _0x171716=_0x2c2c[_0x958c81];return _0x171716;};'use strict';var multer=require('multer');var util=require(_0xc2c2('0x0'));var path=require('path');var timeout=require(_0xc2c2('0x1'));var express=require(_0xc2c2('0x2'));var router=express[_0xc2c2('0x3')]();var auth=require(_0xc2c2('0x4'));var interaction=require(_0xc2c2('0x5'));var config=require('../../config/environment');var controller=require(_0xc2c2('0x6'));router[_0xc2c2('0x7')]('/',auth[_0xc2c2('0x8')](),controller[_0xc2c2('0x9')]);router[_0xc2c2('0x7')](_0xc2c2('0xa'),auth[_0xc2c2('0x8')](),controller[_0xc2c2('0xb')]);router[_0xc2c2('0x7')](_0xc2c2('0xc'),auth[_0xc2c2('0x8')](),controller[_0xc2c2('0xd')]);router[_0xc2c2('0x7')]('/:id/fields',auth[_0xc2c2('0x8')](),controller[_0xc2c2('0xe')]);router['post']('/',auth[_0xc2c2('0x8')](),controller[_0xc2c2('0xf')]);router['post']('/:id/configurations',auth[_0xc2c2('0x8')](),controller['addConfiguration']);router['put'](_0xc2c2('0xa'),auth['isAuthenticated'](),controller[_0xc2c2('0x10')]);router['delete'](_0xc2c2('0xa'),auth[_0xc2c2('0x8')](),controller[_0xc2c2('0x11')]);module[_0xc2c2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c7a7884..f006e25 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 _0x4c50=['exports','STRING','username','sequelize'];(function(_0xed3799,_0x28a3b1){var _0x51c6cb=function(_0x2c429c){while(--_0x2c429c){_0xed3799['push'](_0xed3799['shift']());}};_0x51c6cb(++_0x28a3b1);}(_0x4c50,0x10f));var _0x04c5=function(_0x267dca,_0xa8534c){_0x267dca=_0x267dca-0x0;var _0x11ada6=_0x4c50[_0x267dca];return _0x11ada6;};'use strict';var Sequelize=require(_0x04c5('0x0'));module[_0x04c5('0x1')]={'name':{'type':Sequelize[_0x04c5('0x2')]},'description':{'type':Sequelize[_0x04c5('0x2')]},'username':{'type':Sequelize[_0x04c5('0x2')],'unique':_0x04c5('0x3')},'apiKey':{'type':Sequelize[_0x04c5('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x04c5('0x2')]}}; \ No newline at end of file +var _0x2b29=['remoteUri','exports','STRING'];(function(_0x3168bf,_0x363cea){var _0x35c8df=function(_0x3b80cf){while(--_0x3b80cf){_0x3168bf['push'](_0x3168bf['shift']());}};_0x35c8df(++_0x363cea);}(_0x2b29,0x163));var _0x92b2=function(_0x460346,_0x249f0b){_0x460346=_0x460346-0x0;var _0x6f0d4=_0x2b29[_0x460346];return _0x6f0d4;};'use strict';var Sequelize=require('sequelize');module[_0x92b2('0x0')]={'name':{'type':Sequelize[_0x92b2('0x1')]},'description':{'type':Sequelize[_0x92b2('0x1')]},'username':{'type':Sequelize[_0x92b2('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x92b2('0x1')]},'remoteUri':{'type':Sequelize[_0x92b2('0x1')],'unique':_0x92b2('0x2')},'serverUrl':{'type':Sequelize[_0x92b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b9934c4..bd30692 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 _0x55ca=['filter','options','include','rows','show','includeAll','create','body','find','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','getFields','remoteUri','apiKey','slice','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','agent','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','Wrong\x20credentials','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','stack','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','name'];(function(_0xfe7cab,_0x303f19){var _0x221b12=function(_0x8b2696){while(--_0x8b2696){_0xfe7cab['push'](_0xfe7cab['shift']());}};_0x221b12(++_0x303f19);}(_0x55ca,0x126));var _0xa55c=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0x55ca[_0x4a095e];return _0x10ef73;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var integrations=require(_0xa55c('0x17'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function checkPasswordPattern(_0x576044,_0x5a3672,_0x59ea8d){if(_0x59ea8d){var _0x18ee85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18ee85[_0xa55c('0x19')](_0x5a3672)){return _0x576044;}else{throw new db[(_0xa55c('0x1a'))][(_0xa55c('0x1b'))](_0xa55c('0x1c'));}}else{return _0x576044;}}function respondWithRpcPromise(_0x247e77,_0x4e0b2f,_0x3ccf65,_0x3dcf4f){return new BPromise(function(_0x25934f,_0x31e10d){var _0x1c4cfd=_0x3dcf4f||client;return _0x1c4cfd[_0xa55c('0x1d')](_0x247e77,_0x3ccf65)[_0xa55c('0x1e')](function(_0x2d09d8){logger[_0xa55c('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x4e0b2f,_0xa55c('0x20'));logger[_0xa55c('0x21')](_0xa55c('0x22'),_0x4e0b2f,_0xa55c('0x20'),JSON[_0xa55c('0x23')](_0x2d09d8));if(_0x2d09d8[_0xa55c('0x24')]){if(_0x2d09d8['error']['code']===0x1f4){logger[_0xa55c('0x24')](_0xa55c('0x25'),_0x4e0b2f,_0x2d09d8[_0xa55c('0x24')]['message']);return _0x31e10d(_0x2d09d8[_0xa55c('0x24')][_0xa55c('0x26')]);}logger['error'](_0xa55c('0x25'),_0x4e0b2f,_0x2d09d8[_0xa55c('0x24')][_0xa55c('0x26')]);return _0x25934f(_0x2d09d8[_0xa55c('0x24')][_0xa55c('0x26')]);}else{logger['info'](_0xa55c('0x25'),_0x4e0b2f,'request\x20sent');_0x25934f(_0x2d09d8['result']['message']);}})[_0xa55c('0x27')](function(_0x54b038){logger[_0xa55c('0x24')](_0xa55c('0x25'),_0x4e0b2f,_0x54b038);_0x31e10d(_0x54b038);});});}function respondWithStatusCode(_0x3f64de,_0xf0e574){_0xf0e574=_0xf0e574||0xcc;return function(_0x2313a9){if(_0x2313a9){return _0x3f64de[_0xa55c('0x28')](_0xf0e574);}return _0x3f64de[_0xa55c('0x29')](_0xf0e574)[_0xa55c('0x2a')]();};}function respondWithResult(_0x192df2,_0x3cd152){_0x3cd152=_0x3cd152||0xc8;return function(_0x1273d7){if(_0x1273d7){return _0x192df2['status'](_0x3cd152)[_0xa55c('0x2b')](_0x1273d7);}};}function respondWithFilteredResult(_0x28814f,_0x1c9f6b){return function(_0x906caa){if(_0x906caa){var _0x5d940d=_0x906caa[_0xa55c('0x2c')],_0x1377b0=_0x1c9f6b[_0xa55c('0x2d')],_0x22f6b6=_0x1c9f6b[_0xa55c('0x2d')]+_0x1c9f6b['limit'],_0x1b8388;if(_0x22f6b6>=_0x5d940d){_0x22f6b6=_0x5d940d;_0x1b8388=0xc8;}else{_0x1b8388=0xce;}_0x28814f[_0xa55c('0x29')](_0x1b8388);return _0x28814f['set'](_0xa55c('0x2e'),_0x1377b0+'-'+_0x22f6b6+'/'+_0x5d940d)[_0xa55c('0x2b')](_0x906caa);}return null;};}function patchUpdates(_0x1cc53e){return function(_0x223813){try{jsonpatch['apply'](_0x223813,_0x1cc53e,!![]);}catch(_0x3d28fb){return BPromise[_0xa55c('0x2f')](_0x3d28fb);}return _0x223813[_0xa55c('0x30')]();};}function saveUpdates(_0x20da31,_0x10f4b7){return function(_0x1225c3){if(_0x1225c3){return _0x1225c3[_0xa55c('0x31')](_0x20da31)[_0xa55c('0x1e')](function(_0x2808e9){return _0x2808e9;});}return null;};}function removeEntity(_0xcbaf2e,_0x197099){return function(_0x4eb7c4){if(_0x4eb7c4){return _0x4eb7c4['destroy']()[_0xa55c('0x1e')](function(){_0xcbaf2e[_0xa55c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fadd,_0x2f0110){return function(_0x2e9623){if(!_0x2e9623){_0x30fadd[_0xa55c('0x28')](0x194);}return _0x2e9623;};}function handleError(_0x30d4f8,_0x38ff96){_0x38ff96=_0x38ff96||0x1f4;return function(_0x3ce1b3){logger[_0xa55c('0x24')](_0x3ce1b3[_0xa55c('0x32')]);if(_0x3ce1b3['name']){delete _0x3ce1b3['name'];}_0x30d4f8['status'](_0x38ff96)[_0xa55c('0x33')](_0x3ce1b3);};}exports[_0xa55c('0x34')]=function(_0x2bb4f0,_0x5802e4){var _0x768408={},_0x547930={},_0x119220={'count':0x0,'rows':[]};var _0x4ad813=_[_0xa55c('0x35')](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d3eb5){return{'name':_0x4d3eb5[_0xa55c('0x38')],'type':_0x4d3eb5[_0xa55c('0x39')]['key']};});_0x547930[_0xa55c('0x3a')]=_[_0xa55c('0x35')](_0x4ad813,'name');_0x547930['query']=_[_0xa55c('0x3b')](_0x2bb4f0['query']);_0x547930[_0xa55c('0x3c')]=_[_0xa55c('0x3d')](_0x547930['model'],_0x547930['query']);_0x768408['attributes']=_['intersection'](_0x547930[_0xa55c('0x3a')],qs[_0xa55c('0x3e')](_0x2bb4f0[_0xa55c('0x3f')][_0xa55c('0x3e')]));_0x768408[_0xa55c('0x40')]=_0x768408['attributes'][_0xa55c('0x41')]?_0x768408[_0xa55c('0x40')]:_0x547930[_0xa55c('0x3a')];if(!_0x2bb4f0[_0xa55c('0x3f')][_0xa55c('0x42')](_0xa55c('0x43'))){_0x768408['limit']=qs[_0xa55c('0x44')](_0x2bb4f0['query']['limit']);_0x768408[_0xa55c('0x2d')]=qs[_0xa55c('0x2d')](_0x2bb4f0['query'][_0xa55c('0x2d')]);}_0x768408['order']=qs['sort'](_0x2bb4f0[_0xa55c('0x3f')][_0xa55c('0x45')]);_0x768408[_0xa55c('0x46')]=qs['filters'](_[_0xa55c('0x47')](_0x2bb4f0[_0xa55c('0x3f')],_0x547930['filters']),_0x4ad813);if(_0x2bb4f0[_0xa55c('0x3f')]['filter']){_0x768408[_0xa55c('0x46')]=_[_0xa55c('0x48')](_0x768408['where'],{'$or':_[_0xa55c('0x35')](_0x4ad813,function(_0x1dae70){if(_0x1dae70['type']!==_0xa55c('0x49')){var _0x187e09={};_0x187e09[_0x1dae70[_0xa55c('0x4a')]]={'$like':'%'+_0x2bb4f0['query'][_0xa55c('0x4b')]+'%'};return _0x187e09;}})});}_0x768408=_['merge']({},_0x768408,_0x2bb4f0[_0xa55c('0x4c')]);var _0x3a8af4={'where':_0x768408[_0xa55c('0x46')]};return db['FreshdeskAccount'][_0xa55c('0x2c')](_0x3a8af4)[_0xa55c('0x1e')](function(_0x592429){_0x119220[_0xa55c('0x2c')]=_0x592429;if(_0x2bb4f0[_0xa55c('0x3f')]['includeAll']){_0x768408[_0xa55c('0x4d')]=[{'all':!![]}];}return db[_0xa55c('0x36')]['findAll'](_0x768408);})[_0xa55c('0x1e')](function(_0x81cee8){_0x119220[_0xa55c('0x4e')]=_0x81cee8;return _0x119220;})[_0xa55c('0x1e')](respondWithFilteredResult(_0x5802e4,_0x768408))['catch'](handleError(_0x5802e4,null));};exports[_0xa55c('0x4f')]=function(_0x58a7ea,_0x2157d6){var _0x213100={'raw':![],'where':{'id':_0x58a7ea['params']['id']}},_0x194a79={};_0x194a79[_0xa55c('0x3a')]=_[_0xa55c('0x3b')](db['FreshdeskAccount'][_0xa55c('0x37')]);_0x194a79[_0xa55c('0x3f')]=_[_0xa55c('0x3b')](_0x58a7ea[_0xa55c('0x3f')]);_0x194a79[_0xa55c('0x3c')]=_[_0xa55c('0x3d')](_0x194a79[_0xa55c('0x3a')],_0x194a79[_0xa55c('0x3f')]);_0x213100[_0xa55c('0x40')]=_[_0xa55c('0x3d')](_0x194a79['model'],qs[_0xa55c('0x3e')](_0x58a7ea[_0xa55c('0x3f')][_0xa55c('0x3e')]));_0x213100['attributes']=_0x213100[_0xa55c('0x40')][_0xa55c('0x41')]?_0x213100['attributes']:_0x194a79[_0xa55c('0x3a')];if(_0x58a7ea['query'][_0xa55c('0x50')]){_0x213100[_0xa55c('0x4d')]=[{'all':!![]}];}_0x213100=_[_0xa55c('0x48')]({},_0x213100,_0x58a7ea[_0xa55c('0x4c')]);return db[_0xa55c('0x36')]['find'](_0x213100)[_0xa55c('0x1e')](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x1e')](respondWithResult(_0x2157d6,null))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x51')]=function(_0x2291e0,_0x17f4f8){return db[_0xa55c('0x36')]['create'](_0x2291e0['body'],{})[_0xa55c('0x1e')](respondWithResult(_0x17f4f8,0xc9))[_0xa55c('0x27')](handleError(_0x17f4f8,null));};exports[_0xa55c('0x31')]=function(_0x44ac57,_0x54cbde){if(_0x44ac57[_0xa55c('0x52')]['id']){delete _0x44ac57['body']['id'];}return db[_0xa55c('0x36')][_0xa55c('0x53')]({'where':{'id':_0x44ac57[_0xa55c('0x54')]['id']}})[_0xa55c('0x1e')](handleEntityNotFound(_0x54cbde,null))[_0xa55c('0x1e')](saveUpdates(_0x44ac57['body'],null))[_0xa55c('0x1e')](respondWithResult(_0x54cbde,null))['catch'](handleError(_0x54cbde,null));};exports[_0xa55c('0x55')]=function(_0x157afe,_0x2cfe08){return db[_0xa55c('0x36')][_0xa55c('0x53')]({'where':{'id':_0x157afe[_0xa55c('0x54')]['id']}})[_0xa55c('0x1e')](handleEntityNotFound(_0x2cfe08,null))['then'](removeEntity(_0x2cfe08,null))[_0xa55c('0x27')](handleError(_0x2cfe08,null));};exports[_0xa55c('0x56')]=function(_0x2f2d21,_0x23a30e,_0x3fa00f){var _0x5ba2b0={};var _0xa72718={};var _0x3cd40d;var _0x28bac4;return db[_0xa55c('0x36')][_0xa55c('0x57')]({'where':{'id':_0x2f2d21['params']['id']}})[_0xa55c('0x1e')](handleEntityNotFound(_0x23a30e,null))[_0xa55c('0x1e')](function(_0x43136b){if(_0x43136b){_0x3cd40d=_0x43136b;_0xa72718[_0xa55c('0x3a')]=_[_0xa55c('0x3b')](db['FreshdeskConfiguration'][_0xa55c('0x37')]);_0xa72718['query']=_[_0xa55c('0x3b')](_0x2f2d21['query']);_0xa72718[_0xa55c('0x3c')]=_['intersection'](_0xa72718[_0xa55c('0x3a')],_0xa72718[_0xa55c('0x3f')]);_0x5ba2b0[_0xa55c('0x40')]=_[_0xa55c('0x3d')](_0xa72718[_0xa55c('0x3a')],qs[_0xa55c('0x3e')](_0x2f2d21[_0xa55c('0x3f')][_0xa55c('0x3e')]));_0x5ba2b0[_0xa55c('0x40')]=_0x5ba2b0[_0xa55c('0x40')]['length']?_0x5ba2b0[_0xa55c('0x40')]:_0xa72718[_0xa55c('0x3a')];_0x5ba2b0['order']=qs[_0xa55c('0x45')](_0x2f2d21[_0xa55c('0x3f')][_0xa55c('0x45')]);_0x5ba2b0[_0xa55c('0x46')]=qs[_0xa55c('0x3c')](_[_0xa55c('0x47')](_0x2f2d21[_0xa55c('0x3f')],_0xa72718[_0xa55c('0x3c')]));if(_0x2f2d21['query'][_0xa55c('0x4b')]){_0x5ba2b0[_0xa55c('0x46')]=_[_0xa55c('0x48')](_0x5ba2b0[_0xa55c('0x46')],{'$or':_[_0xa55c('0x35')](_0x5ba2b0[_0xa55c('0x40')],function(_0x2f1237){var _0x4249c1={};_0x4249c1[_0x2f1237]={'$like':'%'+_0x2f2d21[_0xa55c('0x3f')]['filter']+'%'};return _0x4249c1;})});}_0x5ba2b0=_[_0xa55c('0x48')]({},_0x5ba2b0,_0x2f2d21[_0xa55c('0x4c')]);return _0x3cd40d[_0xa55c('0x56')](_0x5ba2b0);}})[_0xa55c('0x1e')](function(_0x3a269d){if(_0x3a269d){_0x28bac4=_0x3a269d[_0xa55c('0x41')];if(!_0x2f2d21[_0xa55c('0x3f')][_0xa55c('0x42')](_0xa55c('0x43'))){_0x5ba2b0[_0xa55c('0x44')]=qs[_0xa55c('0x44')](_0x2f2d21['query'][_0xa55c('0x44')]);_0x5ba2b0['offset']=qs[_0xa55c('0x2d')](_0x2f2d21[_0xa55c('0x3f')][_0xa55c('0x2d')]);}return _0x3cd40d['getConfigurations'](_0x5ba2b0);}})['then'](function(_0x2640a1){if(_0x2640a1){return _0x2640a1?{'count':_0x28bac4,'rows':_0x2640a1}:null;}})[_0xa55c('0x1e')](respondWithResult(_0x23a30e,null))[_0xa55c('0x27')](handleError(_0x23a30e,null));};exports[_0xa55c('0x58')]=function(_0x4c7ee1,_0x149cb9,_0xd02251){if(_0x4c7ee1[_0xa55c('0x52')]['id']){delete _0x4c7ee1[_0xa55c('0x52')]['id'];}return db[_0xa55c('0x36')]['findOne']({'where':{'id':_0x4c7ee1['params']['id']}})[_0xa55c('0x1e')](handleEntityNotFound(_0x149cb9,null))[_0xa55c('0x1e')](function(_0x3f9d0a){if(_0x3f9d0a){_0x4c7ee1[_0xa55c('0x52')][_0xa55c('0x59')]=_0x3f9d0a['id'];_0x4c7ee1['body'][_0xa55c('0x5a')]=integrations[_0xa55c('0x5b')](_0x4c7ee1['body'][_0xa55c('0x5c')],_0x4c7ee1[_0xa55c('0x52')][_0xa55c('0x39')]);_0x4c7ee1['body'][_0xa55c('0x5d')]=integrations[_0xa55c('0x5e')](_0x4c7ee1[_0xa55c('0x52')][_0xa55c('0x5c')],_0x4c7ee1[_0xa55c('0x52')]['type']);return db[_0xa55c('0x5f')][_0xa55c('0x51')](_0x4c7ee1['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xa55c('0x5a')},{'model':db['FreshdeskField'],'as':_0xa55c('0x5d')}]});}return null;})[_0xa55c('0x1e')](respondWithResult(_0x149cb9,null))[_0xa55c('0x27')](handleError(_0x149cb9,null));};exports[_0xa55c('0x60')]=function(_0x30d1c1,_0x3f1132,_0x22b06f){var _0xff7b1c='';return db[_0xa55c('0x36')]['findOne']({'where':{'id':_0x30d1c1[_0xa55c('0x54')]['id']},'attributes':['id',_0xa55c('0x61'),_0xa55c('0x62')]})[_0xa55c('0x1e')](handleEntityNotFound(_0x3f1132,null))['then'](function(_0x4095f6){if(_0x4095f6){_0xff7b1c=_0x4095f6[_0xa55c('0x61')];var _0x1baa8b=_0xff7b1c[_0xa55c('0x63')](-0x1);if(_0x1baa8b==='/'){_0xff7b1c=_0xff7b1c['substring'](0x0,_0xff7b1c['lastIndexOf'](_0x1baa8b));}return rp({'method':_0xa55c('0x64'),'uri':util[_0xa55c('0x65')](_0xa55c('0x66'),_0xff7b1c,_0xa55c('0x67')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xa55c('0x65')](_0xa55c('0x68'),_0x4095f6[_0xa55c('0x62')]))[_0xa55c('0x69')](_0xa55c('0x6a')))},'json':!![]});}})[_0xa55c('0x1e')](function(_0x239269){if(_0x239269){var _0x51b58e=[_0xa55c('0x6b'),'subject',_0xa55c('0x6c'),'description',_0xa55c('0x29'),_0xa55c('0x6d'),_0xa55c('0x6e'),_0xa55c('0x6f'),_0xa55c('0x70'),_0xa55c('0x6e'),_0xa55c('0x71')];_[_0xa55c('0x72')](_0x239269,function(_0x576a1b){return _0x51b58e['includes'](_0x576a1b[_0xa55c('0x4a')])||!_0x576a1b[_0xa55c('0x73')]&&_0x576a1b[_0xa55c('0x39')]!==_0xa55c('0x74')&&_0x576a1b[_0xa55c('0x39')]!==_0xa55c('0x75');});return{'count':_0x239269['length'],'rows':_[_0xa55c('0x35')](_0x239269,function(_0x124740){return{'id':_0x124740[_0xa55c('0x4a')],'name':_0x124740[_0xa55c('0x76')],'custom':!_0x124740[_0xa55c('0x73')],'options':_0x124740[_0xa55c('0x77')]?_[_0xa55c('0x35')](_0x124740[_0xa55c('0x77')],function(_0x58b670){return{'name':_[_0xa55c('0x78')](_0x58b670),'value':_0x58b670};}):[]};})};}})[_0xa55c('0x1e')](respondWithResult(_0x3f1132,null))[_0xa55c('0x27')](function(_0x25e246){var _0xa957ad=_0x30d1c1['query'][_0xa55c('0x19')]?0x1f4:_0x25e246[_0xa55c('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa55c('0x60'),_0xa957ad,JSON[_0xa55c('0x23')](_0x25e246));delete _0x25e246['name'];if(_0xa957ad===0x191){_0xa957ad=0x190;}_0x3f1132['status'](_0xa957ad)['send'](_0x30d1c1['query'][_0xa55c('0x19')]?{'message':_0xa55c('0x7a'),'statusCode':_0x25e246[_0xa55c('0x79')]}:_0x25e246);});}; \ No newline at end of file +var _0x7fbe=['../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','params','includeAll','create','body','catch','find','findOne','merge','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2217f4,_0x479d40){var _0x442e96=function(_0x47a8fd){while(--_0x47a8fd){_0x2217f4['push'](_0x2217f4['shift']());}};_0x442e96(++_0x479d40);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2316b9,_0x87059b){_0x2316b9=_0x2316b9-0x0;var _0x4405a9=_0x7fbe[_0x2316b9];return _0x4405a9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var db=require(_0xe7fb('0x19'))['db'];var integrations=require(_0xe7fb('0x1a'));var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x45fe75,_0x7fe4d3,_0x598729){if(_0x598729){var _0x278b75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x278b75[_0xe7fb('0x1e')](_0x7fe4d3)){return _0x45fe75;}else{throw new db['Sequelize'][(_0xe7fb('0x1f'))](_0xe7fb('0x20'));}}else{return _0x45fe75;}}function respondWithRpcPromise(_0x482f7d,_0xa76acf,_0x559129,_0x12fff6){return new BPromise(function(_0x18d23c,_0x12603d){var _0x17e8a8=_0x12fff6||client;return _0x17e8a8['request'](_0x482f7d,_0x559129)[_0xe7fb('0x21')](function(_0x5ebc87){logger[_0xe7fb('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,_0xe7fb('0x23'));logger[_0xe7fb('0x24')](_0xe7fb('0x25'),_0xa76acf,_0xe7fb('0x23'),JSON['stringify'](_0x5ebc87));if(_0x5ebc87[_0xe7fb('0x26')]){if(_0x5ebc87['error'][_0xe7fb('0x27')]===0x1f4){logger['error'](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87['error'][_0xe7fb('0x29')]);return _0x12603d(_0x5ebc87[_0xe7fb('0x26')]['message']);}logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87[_0xe7fb('0x26')]['message']);return _0x18d23c(_0x5ebc87[_0xe7fb('0x26')][_0xe7fb('0x29')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,'request\x20sent');_0x18d23c(_0x5ebc87[_0xe7fb('0x2a')]['message']);}})['catch'](function(_0x4026b1){logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x4026b1);_0x12603d(_0x4026b1);});});}function respondWithStatusCode(_0x4f6c73,_0x6c930){_0x6c930=_0x6c930||0xcc;return function(_0x2b69c4){if(_0x2b69c4){return _0x4f6c73[_0xe7fb('0x2b')](_0x6c930);}return _0x4f6c73[_0xe7fb('0x2c')](_0x6c930)[_0xe7fb('0x2d')]();};}function respondWithResult(_0x16237a,_0x380130){_0x380130=_0x380130||0xc8;return function(_0x59e015){if(_0x59e015){return _0x16237a['status'](_0x380130)[_0xe7fb('0x2e')](_0x59e015);}};}function respondWithFilteredResult(_0x3bdee9,_0xead63){return function(_0x4fd290){if(_0x4fd290){var _0xb1f2f4=_0x4fd290[_0xe7fb('0x2f')],_0x251807=_0xead63[_0xe7fb('0x30')],_0xd3fffe=_0xead63[_0xe7fb('0x30')]+_0xead63[_0xe7fb('0x31')],_0x5f265f;if(_0xd3fffe>=_0xb1f2f4){_0xd3fffe=_0xb1f2f4;_0x5f265f=0xc8;}else{_0x5f265f=0xce;}_0x3bdee9['status'](_0x5f265f);return _0x3bdee9[_0xe7fb('0x32')](_0xe7fb('0x33'),_0x251807+'-'+_0xd3fffe+'/'+_0xb1f2f4)[_0xe7fb('0x2e')](_0x4fd290);}return null;};}function patchUpdates(_0x547a04){return function(_0x517d70){try{jsonpatch[_0xe7fb('0x34')](_0x517d70,_0x547a04,!![]);}catch(_0x4a9fea){return BPromise[_0xe7fb('0x35')](_0x4a9fea);}return _0x517d70[_0xe7fb('0x36')]();};}function saveUpdates(_0xe49053,_0x2a4745){return function(_0x556368){if(_0x556368){return _0x556368[_0xe7fb('0x37')](_0xe49053)[_0xe7fb('0x21')](function(_0x18ed83){return _0x18ed83;});}return null;};}function removeEntity(_0x2f8818,_0x2d650d){return function(_0x480819){if(_0x480819){return _0x480819[_0xe7fb('0x38')]()[_0xe7fb('0x21')](function(){_0x2f8818[_0xe7fb('0x2c')](0xcc)[_0xe7fb('0x2d')]();});}};}function handleEntityNotFound(_0x46f430,_0x25e925){return function(_0x1bc72d){if(!_0x1bc72d){_0x46f430[_0xe7fb('0x2b')](0x194);}return _0x1bc72d;};}function handleError(_0x389903,_0x59f9df){_0x59f9df=_0x59f9df||0x1f4;return function(_0x44d8cf){logger[_0xe7fb('0x26')](_0x44d8cf[_0xe7fb('0x39')]);if(_0x44d8cf['name']){delete _0x44d8cf[_0xe7fb('0x3a')];}_0x389903[_0xe7fb('0x2c')](_0x59f9df)[_0xe7fb('0x3b')](_0x44d8cf);};}exports[_0xe7fb('0x3c')]=function(_0x402ca3,_0x35b828){var _0xfeefb1={},_0xc4e271={},_0x195c35={'count':0x0,'rows':[]};var _0xebfe1d=_[_0xe7fb('0x3d')](db[_0xe7fb('0x3e')][_0xe7fb('0x3f')],function(_0x1c81fe){return{'name':_0x1c81fe[_0xe7fb('0x40')],'type':_0x1c81fe[_0xe7fb('0x41')][_0xe7fb('0x42')]};});_0xc4e271[_0xe7fb('0x43')]=_[_0xe7fb('0x3d')](_0xebfe1d,'name');_0xc4e271[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x402ca3[_0xe7fb('0x44')]);_0xc4e271[_0xe7fb('0x46')]=_['intersection'](_0xc4e271[_0xe7fb('0x43')],_0xc4e271[_0xe7fb('0x44')]);_0xfeefb1[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0xc4e271['model'],qs[_0xe7fb('0x49')](_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x49')]));_0xfeefb1[_0xe7fb('0x47')]=_0xfeefb1[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0xfeefb1['attributes']:_0xc4e271[_0xe7fb('0x43')];if(!_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0xfeefb1[_0xe7fb('0x31')]=qs[_0xe7fb('0x31')](_0x402ca3['query']['limit']);_0xfeefb1['offset']=qs['offset'](_0x402ca3['query'][_0xe7fb('0x30')]);}_0xfeefb1[_0xe7fb('0x4c')]=qs[_0xe7fb('0x4d')](_0x402ca3['query'][_0xe7fb('0x4d')]);_0xfeefb1['where']=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x402ca3['query'],_0xc4e271[_0xe7fb('0x46')]),_0xebfe1d);if(_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]){_0xfeefb1[_0xe7fb('0x50')]=_['merge'](_0xfeefb1[_0xe7fb('0x50')],{'$or':_[_0xe7fb('0x3d')](_0xebfe1d,function(_0x1b8a34){if(_0x1b8a34['type']!==_0xe7fb('0x51')){var _0x6eb1ab={};_0x6eb1ab[_0x1b8a34[_0xe7fb('0x3a')]]={'$like':'%'+_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]+'%'};return _0x6eb1ab;}})});}_0xfeefb1=_['merge']({},_0xfeefb1,_0x402ca3[_0xe7fb('0x52')]);var _0x4df4aa={'where':_0xfeefb1[_0xe7fb('0x50')]};return db[_0xe7fb('0x3e')][_0xe7fb('0x2f')](_0x4df4aa)[_0xe7fb('0x21')](function(_0x15cec3){_0x195c35['count']=_0x15cec3;if(_0x402ca3[_0xe7fb('0x44')]['includeAll']){_0xfeefb1['include']=[{'all':!![]}];}return db[_0xe7fb('0x3e')][_0xe7fb('0x53')](_0xfeefb1);})[_0xe7fb('0x21')](function(_0x589555){_0x195c35[_0xe7fb('0x54')]=_0x589555;return _0x195c35;})[_0xe7fb('0x21')](respondWithFilteredResult(_0x35b828,_0xfeefb1))['catch'](handleError(_0x35b828,null));};exports['show']=function(_0x284bcb,_0x42270b){var _0x1cbf34={'raw':![],'where':{'id':_0x284bcb[_0xe7fb('0x55')]['id']}},_0x3dd6bf={};_0x3dd6bf[_0xe7fb('0x43')]=_[_0xe7fb('0x45')](db[_0xe7fb('0x3e')]['rawAttributes']);_0x3dd6bf[_0xe7fb('0x44')]=_['keys'](_0x284bcb[_0xe7fb('0x44')]);_0x3dd6bf[_0xe7fb('0x46')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],_0x3dd6bf['query']);_0x1cbf34[_0xe7fb('0x47')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],qs['fields'](_0x284bcb[_0xe7fb('0x44')]['fields']));_0x1cbf34[_0xe7fb('0x47')]=_0x1cbf34[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0x1cbf34[_0xe7fb('0x47')]:_0x3dd6bf[_0xe7fb('0x43')];if(_0x284bcb[_0xe7fb('0x44')][_0xe7fb('0x56')]){_0x1cbf34['include']=[{'all':!![]}];}_0x1cbf34=_['merge']({},_0x1cbf34,_0x284bcb[_0xe7fb('0x52')]);return db['FreshdeskAccount']['find'](_0x1cbf34)['then'](handleEntityNotFound(_0x42270b,null))['then'](respondWithResult(_0x42270b,null))['catch'](handleError(_0x42270b,null));};exports[_0xe7fb('0x57')]=function(_0x34dd69,_0xd2fd76){return db[_0xe7fb('0x3e')]['create'](_0x34dd69[_0xe7fb('0x58')],{})[_0xe7fb('0x21')](respondWithResult(_0xd2fd76,0xc9))[_0xe7fb('0x59')](handleError(_0xd2fd76,null));};exports['update']=function(_0x56c512,_0x2f3b72){if(_0x56c512[_0xe7fb('0x58')]['id']){delete _0x56c512[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount'][_0xe7fb('0x5a')]({'where':{'id':_0x56c512[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f3b72,null))[_0xe7fb('0x21')](saveUpdates(_0x56c512['body'],null))['then'](respondWithResult(_0x2f3b72,null))[_0xe7fb('0x59')](handleError(_0x2f3b72,null));};exports[_0xe7fb('0x38')]=function(_0x1f16b2,_0x2f61b1){return db[_0xe7fb('0x3e')]['find']({'where':{'id':_0x1f16b2[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f61b1,null))[_0xe7fb('0x21')](removeEntity(_0x2f61b1,null))['catch'](handleError(_0x2f61b1,null));};exports['getConfigurations']=function(_0x425bee,_0x3b69f7,_0x14fe1b){var _0x1c4035={};var _0x40f546={};var _0x3385e2;var _0x585b7c;return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x425bee[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3b69f7,null))[_0xe7fb('0x21')](function(_0x1e0d69){if(_0x1e0d69){_0x3385e2=_0x1e0d69;_0x40f546['model']=_[_0xe7fb('0x45')](db['FreshdeskConfiguration'][_0xe7fb('0x3f')]);_0x40f546[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x425bee[_0xe7fb('0x44')]);_0x40f546['filters']=_['intersection'](_0x40f546[_0xe7fb('0x43')],_0x40f546[_0xe7fb('0x44')]);_0x1c4035[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x40f546[_0xe7fb('0x43')],qs['fields'](_0x425bee[_0xe7fb('0x44')]['fields']));_0x1c4035[_0xe7fb('0x47')]=_0x1c4035['attributes']['length']?_0x1c4035[_0xe7fb('0x47')]:_0x40f546[_0xe7fb('0x43')];_0x1c4035[_0xe7fb('0x4c')]=qs['sort'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4d')]);_0x1c4035[_0xe7fb('0x50')]=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x425bee['query'],_0x40f546[_0xe7fb('0x46')]));if(_0x425bee[_0xe7fb('0x44')]['filter']){_0x1c4035[_0xe7fb('0x50')]=_[_0xe7fb('0x5c')](_0x1c4035['where'],{'$or':_[_0xe7fb('0x3d')](_0x1c4035['attributes'],function(_0x2705ef){var _0x1dc9c1={};_0x1dc9c1[_0x2705ef]={'$like':'%'+_0x425bee[_0xe7fb('0x44')]['filter']+'%'};return _0x1dc9c1;})});}_0x1c4035=_[_0xe7fb('0x5c')]({},_0x1c4035,_0x425bee[_0xe7fb('0x52')]);return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x35487f){if(_0x35487f){_0x585b7c=_0x35487f[_0xe7fb('0x4a')];if(!_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0x1c4035['limit']=qs[_0xe7fb('0x31')](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x31')]);_0x1c4035['offset']=qs['offset'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x30')]);}return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x2d558c){if(_0x2d558c){return _0x2d558c?{'count':_0x585b7c,'rows':_0x2d558c}:null;}})[_0xe7fb('0x21')](respondWithResult(_0x3b69f7,null))[_0xe7fb('0x59')](handleError(_0x3b69f7,null));};exports[_0xe7fb('0x5e')]=function(_0xb06693,_0x3691a6,_0x1ff5e7){if(_0xb06693[_0xe7fb('0x58')]['id']){delete _0xb06693[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0xb06693[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3691a6,null))[_0xe7fb('0x21')](function(_0x16cd8f){if(_0x16cd8f){_0xb06693[_0xe7fb('0x58')]['AccountId']=_0x16cd8f['id'];_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x5f')]=integrations[_0xe7fb('0x60')](_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x61')],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x62')]=integrations['getDescriptions'](_0xb06693[_0xe7fb('0x58')]['channel'],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);return db[_0xe7fb('0x63')][_0xe7fb('0x57')](_0xb06693[_0xe7fb('0x58')],{'include':[{'model':db['FreshdeskField'],'as':_0xe7fb('0x5f')},{'model':db[_0xe7fb('0x64')],'as':_0xe7fb('0x62')}]});}return null;})[_0xe7fb('0x21')](respondWithResult(_0x3691a6,null))[_0xe7fb('0x59')](handleError(_0x3691a6,null));};exports[_0xe7fb('0x65')]=function(_0x10a6e8,_0x17e640,_0x3d139f){var _0x59731e='';return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x10a6e8[_0xe7fb('0x55')]['id']},'attributes':['id',_0xe7fb('0x66'),'apiKey']})['then'](handleEntityNotFound(_0x17e640,null))['then'](function(_0x13265b){if(_0x13265b){_0x59731e=_0x13265b[_0xe7fb('0x66')];var _0x25e4d9=_0x59731e[_0xe7fb('0x67')](-0x1);if(_0x25e4d9==='/'){_0x59731e=_0x59731e['substring'](0x0,_0x59731e[_0xe7fb('0x68')](_0x25e4d9));}return rp({'method':_0xe7fb('0x69'),'uri':util[_0xe7fb('0x6a')](_0xe7fb('0x6b'),_0x59731e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe7fb('0x6a')]('Basic\x20%s',new Buffer(util[_0xe7fb('0x6a')](_0xe7fb('0x6c'),_0x13265b[_0xe7fb('0x6d')]))[_0xe7fb('0x6e')](_0xe7fb('0x6f')))},'json':!![]});}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){var _0x5b8f3e=[_0xe7fb('0x70'),'subject',_0xe7fb('0x71'),_0xe7fb('0x72'),'status',_0xe7fb('0x73'),_0xe7fb('0x74'),_0xe7fb('0x75'),_0xe7fb('0x76'),'group',_0xe7fb('0x77')];_[_0xe7fb('0x78')](_0x3ffd6c,function(_0x1412e2){return _0x5b8f3e['includes'](_0x1412e2[_0xe7fb('0x3a')])||!_0x1412e2['default']&&_0x1412e2['type']!=='custom_text'&&_0x1412e2[_0xe7fb('0x41')]!==_0xe7fb('0x79');});return{'count':_0x3ffd6c['length'],'rows':_[_0xe7fb('0x3d')](_0x3ffd6c,function(_0x266bba){return{'id':_0x266bba[_0xe7fb('0x3a')],'name':_0x266bba[_0xe7fb('0x7a')],'custom':!_0x266bba[_0xe7fb('0x7b')],'options':_0x266bba[_0xe7fb('0x7c')]?_[_0xe7fb('0x3d')](_0x266bba[_0xe7fb('0x7c')],function(_0x42190e){return{'name':_[_0xe7fb('0x7d')](_0x42190e),'value':_0x42190e};}):[]};})};}})[_0xe7fb('0x21')](respondWithResult(_0x17e640,null))[_0xe7fb('0x59')](function(_0x3d1f34){var _0x27c97a=_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?0x1f4:_0x3d1f34[_0xe7fb('0x7e')]||0x1f4;logger[_0xe7fb('0x26')](_0xe7fb('0x7f'),_0xe7fb('0x65'),_0x27c97a,JSON['stringify'](_0x3d1f34));delete _0x3d1f34[_0xe7fb('0x3a')];if(_0x27c97a===0x191){_0x27c97a=0x190;}_0x17e640[_0xe7fb('0x2c')](_0x27c97a)[_0xe7fb('0x3b')](_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?{'message':_0xe7fb('0x80'),'statusCode':_0x3d1f34[_0xe7fb('0x7e')]}:_0x3d1f34);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2dace7f..6a73fec 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 _0xa135=['exports','define','int_freshdesk_accounts','util','../../config/logger','api','bluebird','request-promise','../../config/environment','../../components/integrations/configuration'];(function(_0x470e77,_0x348621){var _0x9efdb=function(_0x432bdb){while(--_0x432bdb){_0x470e77['push'](_0x470e77['shift']());}};_0x9efdb(++_0x348621);}(_0xa135,0x1e3));var _0x5a13=function(_0xcd9790,_0x3a6603){_0xcd9790=_0xcd9790-0x0;var _0x1f73b3=_0xa135[_0xcd9790];return _0x1f73b3;};'use strict';var _=require('lodash');var util=require(_0x5a13('0x0'));var logger=require(_0x5a13('0x1'))(_0x5a13('0x2'));var moment=require('moment');var BPromise=require(_0x5a13('0x3'));var rp=require(_0x5a13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a13('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x5a13('0x6'));module[_0x5a13('0x7')]=function(_0x121c3e,_0xaae907){return _0x121c3e[_0x5a13('0x8')]('FreshdeskAccount',attributes,{'tableName':_0x5a13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95b7=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api'];(function(_0x34cd09,_0x28ae39){var _0x7bbbc8=function(_0x1568ec){while(--_0x1568ec){_0x34cd09['push'](_0x34cd09['shift']());}};_0x7bbbc8(++_0x28ae39);}(_0x95b7,0x14f));var _0x795b=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x95b7[_0x55c1f0];return _0x1530fa;};'use strict';var _=require('lodash');var util=require(_0x795b('0x0'));var logger=require(_0x795b('0x1'))(_0x795b('0x2'));var moment=require(_0x795b('0x3'));var BPromise=require(_0x795b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x795b('0x5'));var rimraf=require(_0x795b('0x6'));var config=require(_0x795b('0x7'));var attributes=require(_0x795b('0x8'));var integrations=require(_0x795b('0x9'));module[_0x795b('0xa')]=function(_0x8777bd,_0x94ddf2){return _0x8777bd['define'](_0x795b('0xb'),attributes,{'tableName':_0x795b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index e2a5856..743766d 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 _0x5990=['FreshdeskAccount','findAll','options','limit','include','map','model','attributes','ShowFreshdeskAccount','find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetFreshdeskAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5990,0x17e));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0599('0x0'));var util=require('util');var moment=require(_0x0599('0x1'));var BPromise=require(_0x0599('0x2'));var rs=require(_0x0599('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0599('0x4'))['db'];var utils=require(_0x0599('0x5'));var logger=require(_0x0599('0x6'))(_0x0599('0x7'));var config=require(_0x0599('0x8'));var jayson=require(_0x0599('0x9'));var client=jayson[_0x0599('0xa')][_0x0599('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x220df8,_0x26cace,_0x1528cc){return new BPromise(function(_0x3b63e7,_0x2b85ad){return client[_0x0599('0xc')](_0x220df8,_0x1528cc)[_0x0599('0xd')](function(_0x52d462){logger[_0x0599('0xe')](_0x0599('0xf'),_0x26cace,_0x0599('0x10'));logger[_0x0599('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x26cace,_0x0599('0x10'),JSON[_0x0599('0x12')](_0x52d462));if(_0x52d462['error']){if(_0x52d462['error'][_0x0599('0x13')]===0x1f4){logger[_0x0599('0x14')](_0x0599('0xf'),_0x26cace,_0x52d462[_0x0599('0x14')]['message']);return _0x2b85ad(_0x52d462[_0x0599('0x14')][_0x0599('0x15')]);}logger['error'](_0x0599('0xf'),_0x26cace,_0x52d462[_0x0599('0x14')]['message']);return _0x3b63e7(_0x52d462[_0x0599('0x14')]['message']);}else{logger['info'](_0x0599('0xf'),_0x26cace,_0x0599('0x10'));_0x3b63e7(_0x52d462[_0x0599('0x16')][_0x0599('0x15')]);}})[_0x0599('0x17')](function(_0x1c69aa){logger['error'](_0x0599('0xf'),_0x26cace,_0x1c69aa);_0x2b85ad(_0x1c69aa);});});}exports[_0x0599('0x18')]=function(_0x6fd875){var _0x2788bf=this;return new Promise(function(_0x1d563a,_0x37a29d){return db[_0x0599('0x19')][_0x0599('0x1a')]({'raw':_0x6fd875[_0x0599('0x1b')]?_0x6fd875[_0x0599('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x6fd875['options']?_0x6fd875[_0x0599('0x1b')]['where']||null:null,'attributes':_0x6fd875[_0x0599('0x1b')]?_0x6fd875[_0x0599('0x1b')]['attributes']||null:null,'limit':_0x6fd875[_0x0599('0x1b')]?_0x6fd875[_0x0599('0x1b')][_0x0599('0x1c')]||null:null,'include':_0x6fd875['options']?_0x6fd875[_0x0599('0x1b')][_0x0599('0x1d')]?_[_0x0599('0x1e')](_0x6fd875[_0x0599('0x1b')][_0x0599('0x1d')],function(_0x5eb96d){return{'model':db[_0x5eb96d[_0x0599('0x1f')]],'as':_0x5eb96d['as'],'attributes':_0x5eb96d['attributes'],'include':_0x5eb96d[_0x0599('0x1d')]?_[_0x0599('0x1e')](_0x5eb96d[_0x0599('0x1d')],function(_0x597af1){return{'model':db[_0x597af1[_0x0599('0x1f')]],'as':_0x597af1['as'],'attributes':_0x597af1[_0x0599('0x20')],'include':_0x597af1['include']?_[_0x0599('0x1e')](_0x597af1[_0x0599('0x1d')],function(_0x2bd64e){return{'model':db[_0x2bd64e[_0x0599('0x1f')]],'as':_0x2bd64e['as'],'attributes':_0x2bd64e[_0x0599('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0599('0xd')](function(_0x4167df){logger[_0x0599('0xe')](_0x0599('0x18'),_0x6fd875);logger['debug'](_0x0599('0x18'),_0x6fd875,JSON[_0x0599('0x12')](_0x4167df));_0x1d563a(_0x4167df);})[_0x0599('0x17')](function(_0x2c04b5){logger['error'](_0x0599('0x18'),_0x2c04b5[_0x0599('0x15')],_0x6fd875);_0x37a29d(_0x2788bf[_0x0599('0x14')](0x1f4,_0x2c04b5[_0x0599('0x15')]));});});};exports[_0x0599('0x21')]=function(_0x5f5d40){var _0x24209c=this;return new Promise(function(_0x42f32c,_0x3e2db9){return db[_0x0599('0x19')][_0x0599('0x22')]({'raw':_0x5f5d40[_0x0599('0x1b')]?_0x5f5d40[_0x0599('0x1b')][_0x0599('0x23')]===undefined?!![]:![]:!![],'where':_0x5f5d40['options']?_0x5f5d40[_0x0599('0x1b')][_0x0599('0x24')]||null:null,'attributes':_0x5f5d40[_0x0599('0x1b')]?_0x5f5d40[_0x0599('0x1b')][_0x0599('0x20')]||null:null,'include':_0x5f5d40[_0x0599('0x1b')]?_0x5f5d40[_0x0599('0x1b')]['include']?_[_0x0599('0x1e')](_0x5f5d40[_0x0599('0x1b')][_0x0599('0x1d')],function(_0x114c88){return{'model':db[_0x114c88[_0x0599('0x1f')]],'as':_0x114c88['as'],'attributes':_0x114c88['attributes'],'include':_0x114c88[_0x0599('0x1d')]?_[_0x0599('0x1e')](_0x114c88[_0x0599('0x1d')],function(_0x524e0d){return{'model':db[_0x524e0d[_0x0599('0x1f')]],'as':_0x524e0d['as'],'attributes':_0x524e0d[_0x0599('0x20')],'include':_0x524e0d[_0x0599('0x1d')]?_[_0x0599('0x1e')](_0x524e0d[_0x0599('0x1d')],function(_0x222fa4){return{'model':db[_0x222fa4[_0x0599('0x1f')]],'as':_0x222fa4['as'],'attributes':_0x222fa4[_0x0599('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x707fe0){logger[_0x0599('0xe')]('ShowFreshdeskAccount',_0x5f5d40);logger['debug'](_0x0599('0x21'),_0x5f5d40,JSON[_0x0599('0x12')](_0x707fe0));_0x42f32c(_0x707fe0);})['catch'](function(_0x338f4f){logger[_0x0599('0x14')]('ShowFreshdeskAccount',_0x338f4f[_0x0599('0x15')],_0x5f5d40);_0x3e2db9(_0x24209c[_0x0599('0x14')](0x1f4,_0x338f4f[_0x0599('0x15')]));});});}; \ No newline at end of file +var _0x5e4b=['include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x2ac845,_0x30e7aa){var _0xdbbd51=function(_0x77d68){while(--_0x77d68){_0x2ac845['push'](_0x2ac845['shift']());}};_0xdbbd51(++_0x30e7aa);}(_0x5e4b,0x136));var _0xb5e4=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x5e4b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xb5e4('0x0'));var util=require(_0xb5e4('0x1'));var moment=require(_0xb5e4('0x2'));var BPromise=require(_0xb5e4('0x3'));var rs=require(_0xb5e4('0x4'));var fs=require('fs');var Redis=require(_0xb5e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5e4('0x6'));var logger=require(_0xb5e4('0x7'))(_0xb5e4('0x8'));var config=require(_0xb5e4('0x9'));var jayson=require(_0xb5e4('0xa'));var client=jayson[_0xb5e4('0xb')][_0xb5e4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x357ea7,_0x47ed0c,_0x359787){return new BPromise(function(_0x5cf003,_0x399bdc){return client[_0xb5e4('0xd')](_0x357ea7,_0x359787)[_0xb5e4('0xe')](function(_0x2ca729){logger[_0xb5e4('0xf')](_0xb5e4('0x10'),_0x47ed0c,_0xb5e4('0x11'));logger[_0xb5e4('0x12')](_0xb5e4('0x13'),_0x47ed0c,_0xb5e4('0x11'),JSON[_0xb5e4('0x14')](_0x2ca729));if(_0x2ca729[_0xb5e4('0x15')]){if(_0x2ca729[_0xb5e4('0x15')]['code']===0x1f4){logger[_0xb5e4('0x15')](_0xb5e4('0x10'),_0x47ed0c,_0x2ca729[_0xb5e4('0x15')][_0xb5e4('0x16')]);return _0x399bdc(_0x2ca729[_0xb5e4('0x15')][_0xb5e4('0x16')]);}logger[_0xb5e4('0x15')](_0xb5e4('0x10'),_0x47ed0c,_0x2ca729[_0xb5e4('0x15')]['message']);return _0x5cf003(_0x2ca729[_0xb5e4('0x15')][_0xb5e4('0x16')]);}else{logger[_0xb5e4('0xf')](_0xb5e4('0x10'),_0x47ed0c,_0xb5e4('0x11'));_0x5cf003(_0x2ca729[_0xb5e4('0x17')]['message']);}})[_0xb5e4('0x18')](function(_0x1273fb){logger[_0xb5e4('0x15')](_0xb5e4('0x10'),_0x47ed0c,_0x1273fb);_0x399bdc(_0x1273fb);});});}exports['GetFreshdeskAccount']=function(_0x543fa0){var _0x480e97=this;return new Promise(function(_0x59b767,_0x42b549){return db[_0xb5e4('0x19')][_0xb5e4('0x1a')]({'raw':_0x543fa0[_0xb5e4('0x1b')]?_0x543fa0[_0xb5e4('0x1b')][_0xb5e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x543fa0[_0xb5e4('0x1b')]?_0x543fa0[_0xb5e4('0x1b')][_0xb5e4('0x1d')]||null:null,'attributes':_0x543fa0['options']?_0x543fa0[_0xb5e4('0x1b')][_0xb5e4('0x1e')]||null:null,'limit':_0x543fa0['options']?_0x543fa0[_0xb5e4('0x1b')][_0xb5e4('0x1f')]||null:null,'include':_0x543fa0[_0xb5e4('0x1b')]?_0x543fa0[_0xb5e4('0x1b')][_0xb5e4('0x20')]?_[_0xb5e4('0x21')](_0x543fa0[_0xb5e4('0x1b')]['include'],function(_0x50f84f){return{'model':db[_0x50f84f[_0xb5e4('0x22')]],'as':_0x50f84f['as'],'attributes':_0x50f84f[_0xb5e4('0x1e')],'include':_0x50f84f[_0xb5e4('0x20')]?_[_0xb5e4('0x21')](_0x50f84f['include'],function(_0x568306){return{'model':db[_0x568306[_0xb5e4('0x22')]],'as':_0x568306['as'],'attributes':_0x568306['attributes'],'include':_0x568306[_0xb5e4('0x20')]?_[_0xb5e4('0x21')](_0x568306[_0xb5e4('0x20')],function(_0x5780cc){return{'model':db[_0x5780cc['model']],'as':_0x5780cc['as'],'attributes':_0x5780cc[_0xb5e4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x201862){logger[_0xb5e4('0xf')](_0xb5e4('0x23'),_0x543fa0);logger['debug'](_0xb5e4('0x23'),_0x543fa0,JSON[_0xb5e4('0x14')](_0x201862));_0x59b767(_0x201862);})[_0xb5e4('0x18')](function(_0x323fc5){logger[_0xb5e4('0x15')](_0xb5e4('0x23'),_0x323fc5['message'],_0x543fa0);_0x42b549(_0x480e97[_0xb5e4('0x15')](0x1f4,_0x323fc5[_0xb5e4('0x16')]));});});};exports[_0xb5e4('0x24')]=function(_0x1a3fa9){var _0x251288=this;return new Promise(function(_0x3906f3,_0x4f4076){return db['FreshdeskAccount'][_0xb5e4('0x25')]({'raw':_0x1a3fa9[_0xb5e4('0x1b')]?_0x1a3fa9[_0xb5e4('0x1b')][_0xb5e4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1a3fa9[_0xb5e4('0x1b')]?_0x1a3fa9[_0xb5e4('0x1b')]['where']||null:null,'attributes':_0x1a3fa9[_0xb5e4('0x1b')]?_0x1a3fa9[_0xb5e4('0x1b')][_0xb5e4('0x1e')]||null:null,'include':_0x1a3fa9[_0xb5e4('0x1b')]?_0x1a3fa9[_0xb5e4('0x1b')][_0xb5e4('0x20')]?_[_0xb5e4('0x21')](_0x1a3fa9[_0xb5e4('0x1b')][_0xb5e4('0x20')],function(_0xdc14c5){return{'model':db[_0xdc14c5[_0xb5e4('0x22')]],'as':_0xdc14c5['as'],'attributes':_0xdc14c5[_0xb5e4('0x1e')],'include':_0xdc14c5[_0xb5e4('0x20')]?_[_0xb5e4('0x21')](_0xdc14c5[_0xb5e4('0x20')],function(_0x531550){return{'model':db[_0x531550['model']],'as':_0x531550['as'],'attributes':_0x531550[_0xb5e4('0x1e')],'include':_0x531550[_0xb5e4('0x20')]?_[_0xb5e4('0x21')](_0x531550[_0xb5e4('0x20')],function(_0x39703a){return{'model':db[_0x39703a[_0xb5e4('0x22')]],'as':_0x39703a['as'],'attributes':_0x39703a[_0xb5e4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5e4('0xe')](function(_0x9fada2){logger['info'](_0xb5e4('0x24'),_0x1a3fa9);logger[_0xb5e4('0x12')](_0xb5e4('0x24'),_0x1a3fa9,JSON[_0xb5e4('0x14')](_0x9fada2));_0x3906f3(_0x9fada2);})[_0xb5e4('0x18')](function(_0x5cf9e){logger['error'](_0xb5e4('0x24'),_0x5cf9e[_0xb5e4('0x16')],_0x1a3fa9);_0x4f4076(_0x251288['error'](0x1f4,_0x5cf9e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 5b8d733..4649e29 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 _0x7310=['./intFreshdeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7310,0xd0));var _0x0731=function(_0x40b889,_0x27cc82){_0x40b889=_0x40b889-0x0;var _0x2d2bf9=_0x7310[_0x40b889];return _0x2d2bf9;};'use strict';var multer=require(_0x0731('0x0'));var util=require(_0x0731('0x1'));var path=require('path');var timeout=require(_0x0731('0x2'));var express=require(_0x0731('0x3'));var router=express[_0x0731('0x4')]();var auth=require(_0x0731('0x5'));var interaction=require(_0x0731('0x6'));var config=require(_0x0731('0x7'));var controller=require(_0x0731('0x8'));router[_0x0731('0x9')]('/',auth[_0x0731('0xa')](),controller[_0x0731('0xb')]);router[_0x0731('0x9')]('/:id',auth[_0x0731('0xa')](),controller['show']);router[_0x0731('0x9')]('/:id/fields',auth[_0x0731('0xa')](),controller[_0x0731('0xc')]);router[_0x0731('0x9')](_0x0731('0xd'),auth['isAuthenticated'](),controller[_0x0731('0xe')]);router[_0x0731('0x9')]('/:id/descriptions',auth[_0x0731('0xa')](),controller[_0x0731('0xf')]);router[_0x0731('0x9')](_0x0731('0x10'),auth['isAuthenticated'](),controller[_0x0731('0x11')]);router[_0x0731('0x12')]('/',auth[_0x0731('0xa')](),controller[_0x0731('0x13')]);router['post'](_0x0731('0x10'),auth[_0x0731('0xa')](),controller[_0x0731('0x14')]);router[_0x0731('0x15')](_0x0731('0x16'),auth[_0x0731('0xa')](),controller[_0x0731('0x17')]);router[_0x0731('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x0731('0x19')]);module[_0x0731('0x1a')]=router; \ No newline at end of file +var _0xc933=['/:id','update','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','isAuthenticated','show','getSubjects','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc933,0xab));var _0x3c93=function(_0x105cbb,_0x1ac9cb){_0x105cbb=_0x105cbb-0x0;var _0xac9683=_0xc933[_0x105cbb];return _0xac9683;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c93('0x0'));var timeout=require('connect-timeout');var express=require(_0x3c93('0x1'));var router=express[_0x3c93('0x2')]();var auth=require(_0x3c93('0x3'));var interaction=require(_0x3c93('0x4'));var config=require(_0x3c93('0x5'));var controller=require(_0x3c93('0x6'));router[_0x3c93('0x7')]('/',auth['isAuthenticated'](),controller[_0x3c93('0x8')]);router[_0x3c93('0x7')]('/:id',auth[_0x3c93('0x9')](),controller[_0x3c93('0xa')]);router[_0x3c93('0x7')]('/:id/fields',auth[_0x3c93('0x9')](),controller['getFields']);router[_0x3c93('0x7')]('/:id/subjects',auth[_0x3c93('0x9')](),controller[_0x3c93('0xb')]);router[_0x3c93('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x3c93('0xc')]);router[_0x3c93('0x7')](_0x3c93('0xd'),auth[_0x3c93('0x9')](),controller[_0x3c93('0xe')]);router['post']('/',auth[_0x3c93('0x9')](),controller[_0x3c93('0xf')]);router[_0x3c93('0x10')](_0x3c93('0xd'),auth[_0x3c93('0x9')](),controller[_0x3c93('0x11')]);router['put'](_0x3c93('0x12'),auth[_0x3c93('0x9')](),controller[_0x3c93('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3c93('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 672f9f3..33f2c78 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 _0xc592=['STRING','sequelize'];(function(_0x1c1918,_0x29851a){var _0x826a64=function(_0x19b5c3){while(--_0x19b5c3){_0x1c1918['push'](_0x1c1918['shift']());}};_0x826a64(++_0x29851a);}(_0xc592,0x19b));var _0x2c59=function(_0x5225fa,_0x2592eb){_0x5225fa=_0x5225fa-0x0;var _0x2e472e=_0xc592[_0x5225fa];return _0x2e472e;};'use strict';var Sequelize=require(_0x2c59('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c59('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe294=['STRING','sequelize'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xe294,0x14b));var _0x4e29=function(_0x53fba6,_0x4cfc03){_0x53fba6=_0x53fba6-0x0;var _0x3d129a=_0xe294[_0x53fba6];return _0x3d129a;};'use strict';var Sequelize=require(_0x4e29('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e29('0x1')]},'description':{'type':Sequelize[_0x4e29('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3c80ac0..85f29bf 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 _0x5aaa=['papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','apply','update','then','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','getFields','findOne','FreshdeskField','length','getSubjects','getDescriptions','getTags','html-pdf','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring'];(function(_0x232b0b,_0x4c9462){var _0x53300d=function(_0x293674){while(--_0x293674){_0x232b0b['push'](_0x232b0b['shift']());}};_0x53300d(++_0x4c9462);}(_0x5aaa,0xff));var _0xa5aa=function(_0x549932,_0x49c5dd){_0x549932=_0x549932-0x0;var _0x4641ed=_0x5aaa[_0x549932];return _0x4641ed;};'use strict';var pdf=require(_0xa5aa('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5aa('0x1'));var BPromise=require(_0xa5aa('0x2'));var Mustache=require(_0xa5aa('0x3'));var util=require('util');var path=require(_0xa5aa('0x4'));var sox=require(_0xa5aa('0x5'));var csv=require('to-csv');var ejs=require(_0xa5aa('0x6'));var fs=require('fs');var _=require(_0xa5aa('0x7'));var squel=require(_0xa5aa('0x8'));var crypto=require(_0xa5aa('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5aa('0xa'));var querystring=require(_0xa5aa('0xb'));var Papa=require(_0xa5aa('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa5aa('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5aa('0xe'))(_0xa5aa('0xf'));var utils=require(_0xa5aa('0x10'));var config=require(_0xa5aa('0x11'));var db=require(_0xa5aa('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa5aa('0x13')][_0xa5aa('0x14')]({'port':0x232a});function checkPasswordPattern(_0x3c80e8,_0x16787e,_0x4d317e){if(_0x4d317e){var _0x2de4b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2de4b2[_0xa5aa('0x15')](_0x16787e)){return _0x3c80e8;}else{throw new db[(_0xa5aa('0x16'))]['ValidationError'](_0xa5aa('0x17'));}}else{return _0x3c80e8;}}function respondWithRpcPromise(_0x1d9e69,_0x42bed9,_0x2a2697,_0x16b910){return new BPromise(function(_0x20141b,_0x2a1c4f){var _0x4b8bdf=_0x16b910||client;return _0x4b8bdf[_0xa5aa('0x18')](_0x1d9e69,_0x2a2697)['then'](function(_0x5bb59d){logger[_0xa5aa('0x19')](_0xa5aa('0x1a'),_0x42bed9,_0xa5aa('0x1b'));logger[_0xa5aa('0x1c')](_0xa5aa('0x1d'),_0x42bed9,_0xa5aa('0x1b'),JSON[_0xa5aa('0x1e')](_0x5bb59d));if(_0x5bb59d[_0xa5aa('0x1f')]){if(_0x5bb59d['error'][_0xa5aa('0x20')]===0x1f4){logger[_0xa5aa('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x42bed9,_0x5bb59d[_0xa5aa('0x1f')][_0xa5aa('0x21')]);return _0x2a1c4f(_0x5bb59d['error'][_0xa5aa('0x21')]);}logger[_0xa5aa('0x1f')](_0xa5aa('0x1a'),_0x42bed9,_0x5bb59d[_0xa5aa('0x1f')][_0xa5aa('0x21')]);return _0x20141b(_0x5bb59d[_0xa5aa('0x1f')][_0xa5aa('0x21')]);}else{logger[_0xa5aa('0x19')](_0xa5aa('0x1a'),_0x42bed9,_0xa5aa('0x1b'));_0x20141b(_0x5bb59d['result'][_0xa5aa('0x21')]);}})[_0xa5aa('0x22')](function(_0x456564){logger[_0xa5aa('0x1f')](_0xa5aa('0x1a'),_0x42bed9,_0x456564);_0x2a1c4f(_0x456564);});});}function respondWithStatusCode(_0x64962c,_0xc0e448){_0xc0e448=_0xc0e448||0xcc;return function(_0x28dc46){if(_0x28dc46){return _0x64962c[_0xa5aa('0x23')](_0xc0e448);}return _0x64962c[_0xa5aa('0x24')](_0xc0e448)[_0xa5aa('0x25')]();};}function respondWithResult(_0x10b5db,_0x2088ac){_0x2088ac=_0x2088ac||0xc8;return function(_0x247f69){if(_0x247f69){return _0x10b5db[_0xa5aa('0x24')](_0x2088ac)[_0xa5aa('0x26')](_0x247f69);}};}function respondWithFilteredResult(_0x446cf1,_0x57fc00){return function(_0x5d057e){if(_0x5d057e){var _0x565f64=_0x5d057e['count'],_0x4caaf1=_0x57fc00['offset'],_0x28d83a=_0x57fc00[_0xa5aa('0x27')]+_0x57fc00[_0xa5aa('0x28')],_0x5436cd;if(_0x28d83a>=_0x565f64){_0x28d83a=_0x565f64;_0x5436cd=0xc8;}else{_0x5436cd=0xce;}_0x446cf1[_0xa5aa('0x24')](_0x5436cd);return _0x446cf1[_0xa5aa('0x29')]('Content-Range',_0x4caaf1+'-'+_0x28d83a+'/'+_0x565f64)['json'](_0x5d057e);}return null;};}function patchUpdates(_0x4248c8){return function(_0x49e3f1){try{jsonpatch[_0xa5aa('0x2a')](_0x49e3f1,_0x4248c8,!![]);}catch(_0x44dcc4){return BPromise['reject'](_0x44dcc4);}return _0x49e3f1['save']();};}function saveUpdates(_0xf36682,_0x5653c4){return function(_0x6e0696){if(_0x6e0696){return _0x6e0696[_0xa5aa('0x2b')](_0xf36682)[_0xa5aa('0x2c')](function(_0x1be65f){return _0x1be65f;});}return null;};}function removeEntity(_0x27477d,_0x465804){return function(_0x17b87f){if(_0x17b87f){return _0x17b87f['destroy']()['then'](function(){_0x27477d[_0xa5aa('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3775,_0x161b5c){return function(_0x158332){if(!_0x158332){_0x4b3775[_0xa5aa('0x23')](0x194);}return _0x158332;};}function handleError(_0x4b6aa2,_0x2840d2){_0x2840d2=_0x2840d2||0x1f4;return function(_0x53b8dd){logger[_0xa5aa('0x1f')](_0x53b8dd[_0xa5aa('0x2d')]);if(_0x53b8dd['name']){delete _0x53b8dd[_0xa5aa('0x2e')];}_0x4b6aa2[_0xa5aa('0x24')](_0x2840d2)['send'](_0x53b8dd);};}exports[_0xa5aa('0x2f')]=function(_0x435a93,_0x34c00d){var _0x1cc374={},_0x4d09ab={},_0x43c2ea={'count':0x0,'rows':[]};var _0x566b53=_['map'](db['FreshdeskConfiguration'][_0xa5aa('0x30')],function(_0x959136){return{'name':_0x959136[_0xa5aa('0x31')],'type':_0x959136[_0xa5aa('0x32')][_0xa5aa('0x33')]};});_0x4d09ab[_0xa5aa('0x34')]=_[_0xa5aa('0x35')](_0x566b53,_0xa5aa('0x2e'));_0x4d09ab[_0xa5aa('0x36')]=_['keys'](_0x435a93['query']);_0x4d09ab[_0xa5aa('0x37')]=_[_0xa5aa('0x38')](_0x4d09ab[_0xa5aa('0x34')],_0x4d09ab[_0xa5aa('0x36')]);_0x1cc374[_0xa5aa('0x39')]=_[_0xa5aa('0x38')](_0x4d09ab['model'],qs[_0xa5aa('0x3a')](_0x435a93[_0xa5aa('0x36')][_0xa5aa('0x3a')]));_0x1cc374['attributes']=_0x1cc374[_0xa5aa('0x39')]['length']?_0x1cc374[_0xa5aa('0x39')]:_0x4d09ab['model'];if(!_0x435a93[_0xa5aa('0x36')][_0xa5aa('0x3b')](_0xa5aa('0x3c'))){_0x1cc374[_0xa5aa('0x28')]=qs[_0xa5aa('0x28')](_0x435a93[_0xa5aa('0x36')][_0xa5aa('0x28')]);_0x1cc374[_0xa5aa('0x27')]=qs[_0xa5aa('0x27')](_0x435a93[_0xa5aa('0x36')]['offset']);}_0x1cc374[_0xa5aa('0x3d')]=qs['sort'](_0x435a93[_0xa5aa('0x36')][_0xa5aa('0x3e')]);_0x1cc374[_0xa5aa('0x3f')]=qs[_0xa5aa('0x37')](_[_0xa5aa('0x40')](_0x435a93[_0xa5aa('0x36')],_0x4d09ab[_0xa5aa('0x37')]),_0x566b53);if(_0x435a93[_0xa5aa('0x36')][_0xa5aa('0x41')]){_0x1cc374[_0xa5aa('0x3f')]=_[_0xa5aa('0x42')](_0x1cc374[_0xa5aa('0x3f')],{'$or':_[_0xa5aa('0x35')](_0x566b53,function(_0x27146b){if(_0x27146b[_0xa5aa('0x32')]!==_0xa5aa('0x43')){var _0x5a28fb={};_0x5a28fb[_0x27146b[_0xa5aa('0x2e')]]={'$like':'%'+_0x435a93['query']['filter']+'%'};return _0x5a28fb;}})});}_0x1cc374=_[_0xa5aa('0x42')]({},_0x1cc374,_0x435a93[_0xa5aa('0x44')]);var _0x3e22ca={'where':_0x1cc374[_0xa5aa('0x3f')]};return db[_0xa5aa('0x45')][_0xa5aa('0x46')](_0x3e22ca)['then'](function(_0x3d7209){_0x43c2ea['count']=_0x3d7209;if(_0x435a93[_0xa5aa('0x36')][_0xa5aa('0x47')]){_0x1cc374[_0xa5aa('0x48')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xa5aa('0x49')](_0x1cc374);})[_0xa5aa('0x2c')](function(_0xdfe419){_0x43c2ea[_0xa5aa('0x4a')]=_0xdfe419;return _0x43c2ea;})[_0xa5aa('0x2c')](respondWithFilteredResult(_0x34c00d,_0x1cc374))[_0xa5aa('0x22')](handleError(_0x34c00d,null));};exports[_0xa5aa('0x4b')]=function(_0x116dc2,_0x3f43fc){var _0x6c2b01={'raw':![],'where':{'id':_0x116dc2[_0xa5aa('0x4c')]['id']}},_0x351f7e={};_0x351f7e[_0xa5aa('0x34')]=_[_0xa5aa('0x4d')](db[_0xa5aa('0x45')]['rawAttributes']);_0x351f7e['query']=_[_0xa5aa('0x4d')](_0x116dc2[_0xa5aa('0x36')]);_0x351f7e[_0xa5aa('0x37')]=_[_0xa5aa('0x38')](_0x351f7e[_0xa5aa('0x34')],_0x351f7e[_0xa5aa('0x36')]);_0x6c2b01[_0xa5aa('0x39')]=_[_0xa5aa('0x38')](_0x351f7e[_0xa5aa('0x34')],qs[_0xa5aa('0x3a')](_0x116dc2[_0xa5aa('0x36')]['fields']));_0x6c2b01[_0xa5aa('0x39')]=_0x6c2b01[_0xa5aa('0x39')]['length']?_0x6c2b01['attributes']:_0x351f7e[_0xa5aa('0x34')];if(_0x116dc2[_0xa5aa('0x36')][_0xa5aa('0x47')]){_0x6c2b01['include']=[{'all':!![]}];}_0x6c2b01=_[_0xa5aa('0x42')]({},_0x6c2b01,_0x116dc2[_0xa5aa('0x44')]);return db[_0xa5aa('0x45')][_0xa5aa('0x4e')](_0x6c2b01)[_0xa5aa('0x2c')](handleEntityNotFound(_0x3f43fc,null))[_0xa5aa('0x2c')](respondWithResult(_0x3f43fc,null))[_0xa5aa('0x22')](handleError(_0x3f43fc,null));};exports[_0xa5aa('0x4f')]=function(_0x3829a0,_0x5e1ec9){return db[_0xa5aa('0x45')][_0xa5aa('0x4f')](_0x3829a0['body'],{})[_0xa5aa('0x2c')](respondWithResult(_0x5e1ec9,0xc9))[_0xa5aa('0x22')](handleError(_0x5e1ec9,null));};exports['update']=function(_0x58bc6a,_0x149ae0){if(_0x58bc6a['body']['id']){delete _0x58bc6a[_0xa5aa('0x50')]['id'];}return db[_0xa5aa('0x45')][_0xa5aa('0x4e')]({'where':{'id':_0x58bc6a['params']['id']}})[_0xa5aa('0x2c')](handleEntityNotFound(_0x149ae0,null))[_0xa5aa('0x2c')](saveUpdates(_0x58bc6a[_0xa5aa('0x50')],null))[_0xa5aa('0x2c')](respondWithResult(_0x149ae0,null))[_0xa5aa('0x22')](handleError(_0x149ae0,null));};exports[_0xa5aa('0x51')]=function(_0xe9d4fb,_0x4291fb){return db[_0xa5aa('0x45')][_0xa5aa('0x4e')]({'where':{'id':_0xe9d4fb[_0xa5aa('0x4c')]['id']}})[_0xa5aa('0x2c')](handleEntityNotFound(_0x4291fb,null))[_0xa5aa('0x2c')](removeEntity(_0x4291fb,null))[_0xa5aa('0x22')](handleError(_0x4291fb,null));};exports[_0xa5aa('0x52')]=function(_0x4fe8aa,_0x23f41a,_0x9732d6){var _0x364ed6={};var _0x4164e0={};var _0x415052;var _0x46a968;return db[_0xa5aa('0x45')][_0xa5aa('0x53')]({'where':{'id':_0x4fe8aa[_0xa5aa('0x4c')]['id']}})[_0xa5aa('0x2c')](handleEntityNotFound(_0x23f41a,null))[_0xa5aa('0x2c')](function(_0x21f2e5){if(_0x21f2e5){_0x415052=_0x21f2e5;_0x4164e0[_0xa5aa('0x34')]=_[_0xa5aa('0x4d')](db[_0xa5aa('0x54')][_0xa5aa('0x30')]);_0x4164e0['query']=_[_0xa5aa('0x4d')](_0x4fe8aa[_0xa5aa('0x36')]);_0x4164e0['filters']=_['intersection'](_0x4164e0[_0xa5aa('0x34')],_0x4164e0[_0xa5aa('0x36')]);_0x364ed6['attributes']=_['intersection'](_0x4164e0['model'],qs[_0xa5aa('0x3a')](_0x4fe8aa['query'][_0xa5aa('0x3a')]));_0x364ed6[_0xa5aa('0x39')]=_0x364ed6[_0xa5aa('0x39')][_0xa5aa('0x55')]?_0x364ed6[_0xa5aa('0x39')]:_0x4164e0[_0xa5aa('0x34')];_0x364ed6['order']=qs['sort'](_0x4fe8aa[_0xa5aa('0x36')][_0xa5aa('0x3e')]);_0x364ed6[_0xa5aa('0x3f')]=qs[_0xa5aa('0x37')](_[_0xa5aa('0x40')](_0x4fe8aa['query'],_0x4164e0[_0xa5aa('0x37')]));if(_0x4fe8aa[_0xa5aa('0x36')]['filter']){_0x364ed6['where']=_[_0xa5aa('0x42')](_0x364ed6[_0xa5aa('0x3f')],{'$or':_['map'](_0x364ed6[_0xa5aa('0x39')],function(_0x48b8bb){var _0x473b7c={};_0x473b7c[_0x48b8bb]={'$like':'%'+_0x4fe8aa[_0xa5aa('0x36')][_0xa5aa('0x41')]+'%'};return _0x473b7c;})});}_0x364ed6=_['merge']({},_0x364ed6,_0x4fe8aa[_0xa5aa('0x44')]);return _0x415052['getFields'](_0x364ed6);}})[_0xa5aa('0x2c')](function(_0x326757){if(_0x326757){_0x46a968=_0x326757[_0xa5aa('0x55')];if(!_0x4fe8aa[_0xa5aa('0x36')][_0xa5aa('0x3b')]('nolimit')){_0x364ed6[_0xa5aa('0x28')]=qs[_0xa5aa('0x28')](_0x4fe8aa['query'][_0xa5aa('0x28')]);_0x364ed6[_0xa5aa('0x27')]=qs[_0xa5aa('0x27')](_0x4fe8aa['query'][_0xa5aa('0x27')]);}return _0x415052[_0xa5aa('0x52')](_0x364ed6);}})[_0xa5aa('0x2c')](function(_0x2e2390){if(_0x2e2390){return _0x2e2390?{'count':_0x46a968,'rows':_0x2e2390}:null;}})['then'](respondWithResult(_0x23f41a,null))[_0xa5aa('0x22')](handleError(_0x23f41a,null));};exports[_0xa5aa('0x56')]=function(_0x51eb01,_0x31de4d,_0x258c7d){var _0x280c48={};var _0x20b66f={};var _0x1d7ad0;var _0x4f42ce;return db[_0xa5aa('0x45')][_0xa5aa('0x53')]({'where':{'id':_0x51eb01[_0xa5aa('0x4c')]['id']}})[_0xa5aa('0x2c')](handleEntityNotFound(_0x31de4d,null))[_0xa5aa('0x2c')](function(_0x4473b0){if(_0x4473b0){_0x1d7ad0=_0x4473b0;_0x20b66f[_0xa5aa('0x34')]=_[_0xa5aa('0x4d')](db['FreshdeskField'][_0xa5aa('0x30')]);_0x20b66f[_0xa5aa('0x36')]=_[_0xa5aa('0x4d')](_0x51eb01['query']);_0x20b66f['filters']=_[_0xa5aa('0x38')](_0x20b66f[_0xa5aa('0x34')],_0x20b66f['query']);_0x280c48[_0xa5aa('0x39')]=_[_0xa5aa('0x38')](_0x20b66f[_0xa5aa('0x34')],qs['fields'](_0x51eb01[_0xa5aa('0x36')][_0xa5aa('0x3a')]));_0x280c48[_0xa5aa('0x39')]=_0x280c48[_0xa5aa('0x39')][_0xa5aa('0x55')]?_0x280c48[_0xa5aa('0x39')]:_0x20b66f[_0xa5aa('0x34')];_0x280c48[_0xa5aa('0x3d')]=qs[_0xa5aa('0x3e')](_0x51eb01[_0xa5aa('0x36')][_0xa5aa('0x3e')]);_0x280c48[_0xa5aa('0x3f')]=qs[_0xa5aa('0x37')](_[_0xa5aa('0x40')](_0x51eb01[_0xa5aa('0x36')],_0x20b66f[_0xa5aa('0x37')]));if(_0x51eb01[_0xa5aa('0x36')]['filter']){_0x280c48['where']=_[_0xa5aa('0x42')](_0x280c48[_0xa5aa('0x3f')],{'$or':_[_0xa5aa('0x35')](_0x280c48[_0xa5aa('0x39')],function(_0x43efef){var _0x3f8fa4={};_0x3f8fa4[_0x43efef]={'$like':'%'+_0x51eb01[_0xa5aa('0x36')][_0xa5aa('0x41')]+'%'};return _0x3f8fa4;})});}_0x280c48=_[_0xa5aa('0x42')]({},_0x280c48,_0x51eb01['options']);return _0x1d7ad0[_0xa5aa('0x56')](_0x280c48);}})[_0xa5aa('0x2c')](function(_0x4b6265){if(_0x4b6265){_0x4f42ce=_0x4b6265[_0xa5aa('0x55')];if(!_0x51eb01['query'][_0xa5aa('0x3b')](_0xa5aa('0x3c'))){_0x280c48[_0xa5aa('0x28')]=qs[_0xa5aa('0x28')](_0x51eb01[_0xa5aa('0x36')]['limit']);_0x280c48[_0xa5aa('0x27')]=qs[_0xa5aa('0x27')](_0x51eb01[_0xa5aa('0x36')][_0xa5aa('0x27')]);}return _0x1d7ad0['getSubjects'](_0x280c48);}})[_0xa5aa('0x2c')](function(_0x54a838){if(_0x54a838){return _0x54a838?{'count':_0x4f42ce,'rows':_0x54a838}:null;}})[_0xa5aa('0x2c')](respondWithResult(_0x31de4d,null))[_0xa5aa('0x22')](handleError(_0x31de4d,null));};exports[_0xa5aa('0x57')]=function(_0x508d9b,_0x4963d6,_0x4a4ade){var _0x4a018f={};var _0x4ce4b2={};var _0x1e0e1f;var _0x352f6d;return db[_0xa5aa('0x45')][_0xa5aa('0x53')]({'where':{'id':_0x508d9b[_0xa5aa('0x4c')]['id']}})[_0xa5aa('0x2c')](handleEntityNotFound(_0x4963d6,null))['then'](function(_0xa00df0){if(_0xa00df0){_0x1e0e1f=_0xa00df0;_0x4ce4b2[_0xa5aa('0x34')]=_[_0xa5aa('0x4d')](db[_0xa5aa('0x54')][_0xa5aa('0x30')]);_0x4ce4b2[_0xa5aa('0x36')]=_[_0xa5aa('0x4d')](_0x508d9b[_0xa5aa('0x36')]);_0x4ce4b2[_0xa5aa('0x37')]=_[_0xa5aa('0x38')](_0x4ce4b2[_0xa5aa('0x34')],_0x4ce4b2[_0xa5aa('0x36')]);_0x4a018f[_0xa5aa('0x39')]=_[_0xa5aa('0x38')](_0x4ce4b2[_0xa5aa('0x34')],qs[_0xa5aa('0x3a')](_0x508d9b[_0xa5aa('0x36')][_0xa5aa('0x3a')]));_0x4a018f['attributes']=_0x4a018f[_0xa5aa('0x39')][_0xa5aa('0x55')]?_0x4a018f[_0xa5aa('0x39')]:_0x4ce4b2[_0xa5aa('0x34')];_0x4a018f[_0xa5aa('0x3d')]=qs[_0xa5aa('0x3e')](_0x508d9b[_0xa5aa('0x36')][_0xa5aa('0x3e')]);_0x4a018f[_0xa5aa('0x3f')]=qs['filters'](_[_0xa5aa('0x40')](_0x508d9b[_0xa5aa('0x36')],_0x4ce4b2[_0xa5aa('0x37')]));if(_0x508d9b[_0xa5aa('0x36')][_0xa5aa('0x41')]){_0x4a018f['where']=_[_0xa5aa('0x42')](_0x4a018f[_0xa5aa('0x3f')],{'$or':_[_0xa5aa('0x35')](_0x4a018f[_0xa5aa('0x39')],function(_0xbc630c){var _0x22311f={};_0x22311f[_0xbc630c]={'$like':'%'+_0x508d9b['query']['filter']+'%'};return _0x22311f;})});}_0x4a018f=_[_0xa5aa('0x42')]({},_0x4a018f,_0x508d9b[_0xa5aa('0x44')]);return _0x1e0e1f[_0xa5aa('0x57')](_0x4a018f);}})['then'](function(_0x319334){if(_0x319334){_0x352f6d=_0x319334[_0xa5aa('0x55')];if(!_0x508d9b['query'][_0xa5aa('0x3b')](_0xa5aa('0x3c'))){_0x4a018f['limit']=qs[_0xa5aa('0x28')](_0x508d9b[_0xa5aa('0x36')]['limit']);_0x4a018f[_0xa5aa('0x27')]=qs[_0xa5aa('0x27')](_0x508d9b[_0xa5aa('0x36')][_0xa5aa('0x27')]);}return _0x1e0e1f[_0xa5aa('0x57')](_0x4a018f);}})[_0xa5aa('0x2c')](function(_0x3ccf2c){if(_0x3ccf2c){return _0x3ccf2c?{'count':_0x352f6d,'rows':_0x3ccf2c}:null;}})[_0xa5aa('0x2c')](respondWithResult(_0x4963d6,null))[_0xa5aa('0x22')](handleError(_0x4963d6,null));};exports[_0xa5aa('0x58')]=function(_0x106815,_0x12abff,_0x434c79){var _0x551d7d={};var _0x43ca45={};var _0x433a2e;var _0x1e478a;return db[_0xa5aa('0x45')][_0xa5aa('0x53')]({'where':{'id':_0x106815[_0xa5aa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12abff,null))[_0xa5aa('0x2c')](function(_0x33ff46){if(_0x33ff46){_0x433a2e=_0x33ff46;_0x43ca45[_0xa5aa('0x34')]=_[_0xa5aa('0x4d')](db['Tag'][_0xa5aa('0x30')]);_0x43ca45['query']=_['keys'](_0x106815[_0xa5aa('0x36')]);_0x43ca45[_0xa5aa('0x37')]=_['intersection'](_0x43ca45['model'],_0x43ca45[_0xa5aa('0x36')]);_0x551d7d[_0xa5aa('0x39')]=_[_0xa5aa('0x38')](_0x43ca45['model'],qs['fields'](_0x106815[_0xa5aa('0x36')]['fields']));_0x551d7d[_0xa5aa('0x39')]=_0x551d7d[_0xa5aa('0x39')]['length']?_0x551d7d['attributes']:_0x43ca45['model'];_0x551d7d[_0xa5aa('0x3d')]=qs[_0xa5aa('0x3e')](_0x106815['query'][_0xa5aa('0x3e')]);_0x551d7d[_0xa5aa('0x3f')]=qs[_0xa5aa('0x37')](_[_0xa5aa('0x40')](_0x106815[_0xa5aa('0x36')],_0x43ca45[_0xa5aa('0x37')]));if(_0x106815[_0xa5aa('0x36')][_0xa5aa('0x41')]){_0x551d7d[_0xa5aa('0x3f')]=_[_0xa5aa('0x42')](_0x551d7d['where'],{'$or':_[_0xa5aa('0x35')](_0x551d7d[_0xa5aa('0x39')],function(_0x407b38){var _0x363d0b={};_0x363d0b[_0x407b38]={'$like':'%'+_0x106815[_0xa5aa('0x36')]['filter']+'%'};return _0x363d0b;})});}_0x551d7d=_[_0xa5aa('0x42')]({},_0x551d7d,_0x106815[_0xa5aa('0x44')]);return _0x433a2e['getTags'](_0x551d7d);}})['then'](function(_0x4ac591){if(_0x4ac591){_0x1e478a=_0x4ac591[_0xa5aa('0x55')];if(!_0x106815[_0xa5aa('0x36')][_0xa5aa('0x3b')]('nolimit')){_0x551d7d[_0xa5aa('0x28')]=qs[_0xa5aa('0x28')](_0x106815[_0xa5aa('0x36')]['limit']);_0x551d7d[_0xa5aa('0x27')]=qs[_0xa5aa('0x27')](_0x106815[_0xa5aa('0x36')][_0xa5aa('0x27')]);}return _0x433a2e[_0xa5aa('0x58')](_0x551d7d);}})[_0xa5aa('0x2c')](function(_0x9fb2e6){if(_0x9fb2e6){return _0x9fb2e6?{'count':_0x1e478a,'rows':_0x9fb2e6}:null;}})[_0xa5aa('0x2c')](respondWithResult(_0x12abff,null))[_0xa5aa('0x22')](handleError(_0x12abff,null));};exports['setTags']=function(_0x2145eb,_0x21de43,_0x3aebb6){if(_0x2145eb[_0xa5aa('0x50')]['id']){delete _0x2145eb[_0xa5aa('0x50')]['id'];}return db[_0xa5aa('0x45')][_0xa5aa('0x53')]({'where':{'id':_0x2145eb['params']['id']}})[_0xa5aa('0x2c')](handleEntityNotFound(_0x21de43,null))['then'](function(_0x271feb){if(_0x271feb){return _0x271feb['setTags'](_0x2145eb[_0xa5aa('0x50')]['ids']||[]);}return null;})[_0xa5aa('0x2c')](respondWithResult(_0x21de43,null))[_0xa5aa('0x22')](handleError(_0x21de43,null));}; \ No newline at end of file +var _0x40c2=['ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','client','test','Sequelize','ValidationError','request','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','getFields','findOne','params','hasOwnProperty','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x40c2,0x10d));var _0x240c=function(_0x3a05cc,_0x2ea1f1){_0x3a05cc=_0x3a05cc-0x0;var _0x3d63a1=_0x40c2[_0x3a05cc];return _0x3d63a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x240c('0x0'));var rimraf=require(_0x240c('0x1'));var zipdir=require(_0x240c('0x2'));var jsonpatch=require(_0x240c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x240c('0x4'));var Mustache=require(_0x240c('0x5'));var util=require(_0x240c('0x6'));var path=require(_0x240c('0x7'));var sox=require(_0x240c('0x8'));var csv=require(_0x240c('0x9'));var ejs=require(_0x240c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x240c('0xb'));var crypto=require(_0x240c('0xc'));var jsforce=require(_0x240c('0xd'));var deskjs=require(_0x240c('0xe'));var toCsv=require(_0x240c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x240c('0xf'));var authService=require(_0x240c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x240c('0x11'))(_0x240c('0x12'));var utils=require(_0x240c('0x13'));var config=require(_0x240c('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x240c('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x5d3058,_0x3cb503,_0x619439){if(_0x619439){var _0x18999c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18999c[_0x240c('0x16')](_0x3cb503)){return _0x5d3058;}else{throw new db[(_0x240c('0x17'))][(_0x240c('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5d3058;}}function respondWithRpcPromise(_0x1dab7f,_0x28083d,_0x128c26,_0x321076){return new BPromise(function(_0x376f4b,_0x11676f){var _0x5c41bc=_0x321076||client;return _0x5c41bc[_0x240c('0x19')](_0x1dab7f,_0x128c26)[_0x240c('0x1a')](function(_0xf21b01){logger[_0x240c('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28083d,_0x240c('0x1c'));logger['debug'](_0x240c('0x1d'),_0x28083d,_0x240c('0x1c'),JSON[_0x240c('0x1e')](_0xf21b01));if(_0xf21b01[_0x240c('0x1f')]){if(_0xf21b01[_0x240c('0x1f')][_0x240c('0x20')]===0x1f4){logger[_0x240c('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28083d,_0xf21b01[_0x240c('0x1f')]['message']);return _0x11676f(_0xf21b01['error'][_0x240c('0x21')]);}logger[_0x240c('0x1f')](_0x240c('0x22'),_0x28083d,_0xf21b01['error']['message']);return _0x376f4b(_0xf21b01['error'][_0x240c('0x21')]);}else{logger[_0x240c('0x1b')](_0x240c('0x22'),_0x28083d,_0x240c('0x1c'));_0x376f4b(_0xf21b01[_0x240c('0x23')][_0x240c('0x21')]);}})[_0x240c('0x24')](function(_0x31fc07){logger[_0x240c('0x1f')](_0x240c('0x22'),_0x28083d,_0x31fc07);_0x11676f(_0x31fc07);});});}function respondWithStatusCode(_0x111905,_0x36af6d){_0x36af6d=_0x36af6d||0xcc;return function(_0x257a4c){if(_0x257a4c){return _0x111905['sendStatus'](_0x36af6d);}return _0x111905[_0x240c('0x25')](_0x36af6d)['end']();};}function respondWithResult(_0x1313bf,_0x2b22c2){_0x2b22c2=_0x2b22c2||0xc8;return function(_0x2370c8){if(_0x2370c8){return _0x1313bf[_0x240c('0x25')](_0x2b22c2)[_0x240c('0x26')](_0x2370c8);}};}function respondWithFilteredResult(_0x34f5a3,_0x5b7c15){return function(_0x3dc6cc){if(_0x3dc6cc){var _0x4c5df8=_0x3dc6cc[_0x240c('0x27')],_0x236d61=_0x5b7c15[_0x240c('0x28')],_0x127788=_0x5b7c15[_0x240c('0x28')]+_0x5b7c15[_0x240c('0x29')],_0x242037;if(_0x127788>=_0x4c5df8){_0x127788=_0x4c5df8;_0x242037=0xc8;}else{_0x242037=0xce;}_0x34f5a3['status'](_0x242037);return _0x34f5a3[_0x240c('0x2a')](_0x240c('0x2b'),_0x236d61+'-'+_0x127788+'/'+_0x4c5df8)['json'](_0x3dc6cc);}return null;};}function patchUpdates(_0x17a562){return function(_0x25f181){try{jsonpatch[_0x240c('0x2c')](_0x25f181,_0x17a562,!![]);}catch(_0x115288){return BPromise[_0x240c('0x2d')](_0x115288);}return _0x25f181['save']();};}function saveUpdates(_0x2b158c,_0x27755a){return function(_0x53f439){if(_0x53f439){return _0x53f439[_0x240c('0x2e')](_0x2b158c)[_0x240c('0x1a')](function(_0x2698ff){return _0x2698ff;});}return null;};}function removeEntity(_0x5549f3,_0x401349){return function(_0x15d2a1){if(_0x15d2a1){return _0x15d2a1[_0x240c('0x2f')]()[_0x240c('0x1a')](function(){_0x5549f3[_0x240c('0x25')](0xcc)[_0x240c('0x30')]();});}};}function handleEntityNotFound(_0x54ba1d,_0x42c95e){return function(_0x11fe17){if(!_0x11fe17){_0x54ba1d[_0x240c('0x31')](0x194);}return _0x11fe17;};}function handleError(_0x4c1849,_0x4d2ff1){_0x4d2ff1=_0x4d2ff1||0x1f4;return function(_0x23dde8){logger[_0x240c('0x1f')](_0x23dde8[_0x240c('0x32')]);if(_0x23dde8[_0x240c('0x33')]){delete _0x23dde8[_0x240c('0x33')];}_0x4c1849[_0x240c('0x25')](_0x4d2ff1)[_0x240c('0x34')](_0x23dde8);};}exports[_0x240c('0x35')]=function(_0x42983e,_0x5f1645){var _0x19714f={},_0x4ac22e={},_0xdaa7e4={'count':0x0,'rows':[]};var _0x43a910=_[_0x240c('0x36')](db[_0x240c('0x37')][_0x240c('0x38')],function(_0x41bf4b){return{'name':_0x41bf4b[_0x240c('0x39')],'type':_0x41bf4b['type'][_0x240c('0x3a')]};});_0x4ac22e[_0x240c('0x3b')]=_[_0x240c('0x36')](_0x43a910,_0x240c('0x33'));_0x4ac22e[_0x240c('0x3c')]=_[_0x240c('0x3d')](_0x42983e['query']);_0x4ac22e['filters']=_[_0x240c('0x3e')](_0x4ac22e['model'],_0x4ac22e[_0x240c('0x3c')]);_0x19714f['attributes']=_[_0x240c('0x3e')](_0x4ac22e[_0x240c('0x3b')],qs['fields'](_0x42983e[_0x240c('0x3c')][_0x240c('0x3f')]));_0x19714f['attributes']=_0x19714f[_0x240c('0x40')][_0x240c('0x41')]?_0x19714f['attributes']:_0x4ac22e[_0x240c('0x3b')];if(!_0x42983e[_0x240c('0x3c')]['hasOwnProperty'](_0x240c('0x42'))){_0x19714f[_0x240c('0x29')]=qs['limit'](_0x42983e[_0x240c('0x3c')][_0x240c('0x29')]);_0x19714f['offset']=qs[_0x240c('0x28')](_0x42983e[_0x240c('0x3c')][_0x240c('0x28')]);}_0x19714f[_0x240c('0x43')]=qs[_0x240c('0x44')](_0x42983e[_0x240c('0x3c')]['sort']);_0x19714f['where']=qs[_0x240c('0x45')](_[_0x240c('0x46')](_0x42983e[_0x240c('0x3c')],_0x4ac22e[_0x240c('0x45')]),_0x43a910);if(_0x42983e[_0x240c('0x3c')][_0x240c('0x47')]){_0x19714f[_0x240c('0x48')]=_[_0x240c('0x49')](_0x19714f[_0x240c('0x48')],{'$or':_[_0x240c('0x36')](_0x43a910,function(_0x1b9aca){if(_0x1b9aca['type']!==_0x240c('0x4a')){var _0x11ec80={};_0x11ec80[_0x1b9aca[_0x240c('0x33')]]={'$like':'%'+_0x42983e[_0x240c('0x3c')][_0x240c('0x47')]+'%'};return _0x11ec80;}})});}_0x19714f=_[_0x240c('0x49')]({},_0x19714f,_0x42983e[_0x240c('0x4b')]);var _0x37d911={'where':_0x19714f[_0x240c('0x48')]};return db[_0x240c('0x37')][_0x240c('0x27')](_0x37d911)['then'](function(_0x45432a){_0xdaa7e4['count']=_0x45432a;if(_0x42983e[_0x240c('0x3c')][_0x240c('0x4c')]){_0x19714f[_0x240c('0x4d')]=[{'all':!![]}];}return db[_0x240c('0x37')][_0x240c('0x4e')](_0x19714f);})[_0x240c('0x1a')](function(_0x335f9c){_0xdaa7e4[_0x240c('0x4f')]=_0x335f9c;return _0xdaa7e4;})['then'](respondWithFilteredResult(_0x5f1645,_0x19714f))['catch'](handleError(_0x5f1645,null));};exports[_0x240c('0x50')]=function(_0x561c5b,_0x837769){var _0x378318={'raw':![],'where':{'id':_0x561c5b['params']['id']}},_0x43b4c2={};_0x43b4c2['model']=_[_0x240c('0x3d')](db['FreshdeskConfiguration']['rawAttributes']);_0x43b4c2[_0x240c('0x3c')]=_[_0x240c('0x3d')](_0x561c5b[_0x240c('0x3c')]);_0x43b4c2['filters']=_[_0x240c('0x3e')](_0x43b4c2[_0x240c('0x3b')],_0x43b4c2[_0x240c('0x3c')]);_0x378318[_0x240c('0x40')]=_[_0x240c('0x3e')](_0x43b4c2['model'],qs[_0x240c('0x3f')](_0x561c5b[_0x240c('0x3c')]['fields']));_0x378318[_0x240c('0x40')]=_0x378318[_0x240c('0x40')][_0x240c('0x41')]?_0x378318[_0x240c('0x40')]:_0x43b4c2[_0x240c('0x3b')];if(_0x561c5b[_0x240c('0x3c')][_0x240c('0x4c')]){_0x378318[_0x240c('0x4d')]=[{'all':!![]}];}_0x378318=_['merge']({},_0x378318,_0x561c5b[_0x240c('0x4b')]);return db[_0x240c('0x37')][_0x240c('0x51')](_0x378318)[_0x240c('0x1a')](handleEntityNotFound(_0x837769,null))[_0x240c('0x1a')](respondWithResult(_0x837769,null))[_0x240c('0x24')](handleError(_0x837769,null));};exports['create']=function(_0x48db05,_0x1df2ec){return db[_0x240c('0x37')]['create'](_0x48db05[_0x240c('0x52')],{})['then'](respondWithResult(_0x1df2ec,0xc9))['catch'](handleError(_0x1df2ec,null));};exports['update']=function(_0x4d9854,_0x26f865){if(_0x4d9854['body']['id']){delete _0x4d9854[_0x240c('0x52')]['id'];}return db[_0x240c('0x37')][_0x240c('0x51')]({'where':{'id':_0x4d9854['params']['id']}})['then'](handleEntityNotFound(_0x26f865,null))[_0x240c('0x1a')](saveUpdates(_0x4d9854[_0x240c('0x52')],null))['then'](respondWithResult(_0x26f865,null))[_0x240c('0x24')](handleError(_0x26f865,null));};exports['destroy']=function(_0xaf1028,_0x324a87){return db['FreshdeskConfiguration'][_0x240c('0x51')]({'where':{'id':_0xaf1028['params']['id']}})[_0x240c('0x1a')](handleEntityNotFound(_0x324a87,null))['then'](removeEntity(_0x324a87,null))[_0x240c('0x24')](handleError(_0x324a87,null));};exports[_0x240c('0x53')]=function(_0x22b12c,_0x413bf2,_0x263f74){var _0x57b836={};var _0x580847={};var _0x4d9791;var _0x31ea61;return db[_0x240c('0x37')][_0x240c('0x54')]({'where':{'id':_0x22b12c[_0x240c('0x55')]['id']}})['then'](handleEntityNotFound(_0x413bf2,null))['then'](function(_0x2ef007){if(_0x2ef007){_0x4d9791=_0x2ef007;_0x580847[_0x240c('0x3b')]=_[_0x240c('0x3d')](db['FreshdeskField'][_0x240c('0x38')]);_0x580847[_0x240c('0x3c')]=_[_0x240c('0x3d')](_0x22b12c[_0x240c('0x3c')]);_0x580847[_0x240c('0x45')]=_[_0x240c('0x3e')](_0x580847[_0x240c('0x3b')],_0x580847[_0x240c('0x3c')]);_0x57b836[_0x240c('0x40')]=_[_0x240c('0x3e')](_0x580847[_0x240c('0x3b')],qs[_0x240c('0x3f')](_0x22b12c[_0x240c('0x3c')][_0x240c('0x3f')]));_0x57b836[_0x240c('0x40')]=_0x57b836[_0x240c('0x40')][_0x240c('0x41')]?_0x57b836[_0x240c('0x40')]:_0x580847[_0x240c('0x3b')];_0x57b836[_0x240c('0x43')]=qs['sort'](_0x22b12c['query'][_0x240c('0x44')]);_0x57b836[_0x240c('0x48')]=qs['filters'](_[_0x240c('0x46')](_0x22b12c[_0x240c('0x3c')],_0x580847[_0x240c('0x45')]));if(_0x22b12c[_0x240c('0x3c')]['filter']){_0x57b836[_0x240c('0x48')]=_[_0x240c('0x49')](_0x57b836['where'],{'$or':_[_0x240c('0x36')](_0x57b836['attributes'],function(_0x14db9c){var _0x877760={};_0x877760[_0x14db9c]={'$like':'%'+_0x22b12c[_0x240c('0x3c')][_0x240c('0x47')]+'%'};return _0x877760;})});}_0x57b836=_[_0x240c('0x49')]({},_0x57b836,_0x22b12c[_0x240c('0x4b')]);return _0x4d9791[_0x240c('0x53')](_0x57b836);}})[_0x240c('0x1a')](function(_0x29cefd){if(_0x29cefd){_0x31ea61=_0x29cefd[_0x240c('0x41')];if(!_0x22b12c[_0x240c('0x3c')][_0x240c('0x56')](_0x240c('0x42'))){_0x57b836[_0x240c('0x29')]=qs['limit'](_0x22b12c[_0x240c('0x3c')]['limit']);_0x57b836[_0x240c('0x28')]=qs[_0x240c('0x28')](_0x22b12c['query'][_0x240c('0x28')]);}return _0x4d9791['getFields'](_0x57b836);}})[_0x240c('0x1a')](function(_0x3e688d){if(_0x3e688d){return _0x3e688d?{'count':_0x31ea61,'rows':_0x3e688d}:null;}})[_0x240c('0x1a')](respondWithResult(_0x413bf2,null))['catch'](handleError(_0x413bf2,null));};exports['getSubjects']=function(_0x15cb39,_0x1b95e1,_0x1cc2ad){var _0x1a2b20={};var _0x5c6f93={};var _0x33ce48;var _0x44ecb8;return db[_0x240c('0x37')][_0x240c('0x54')]({'where':{'id':_0x15cb39[_0x240c('0x55')]['id']}})[_0x240c('0x1a')](handleEntityNotFound(_0x1b95e1,null))[_0x240c('0x1a')](function(_0x36c008){if(_0x36c008){_0x33ce48=_0x36c008;_0x5c6f93[_0x240c('0x3b')]=_['keys'](db[_0x240c('0x57')][_0x240c('0x38')]);_0x5c6f93[_0x240c('0x3c')]=_[_0x240c('0x3d')](_0x15cb39['query']);_0x5c6f93[_0x240c('0x45')]=_[_0x240c('0x3e')](_0x5c6f93['model'],_0x5c6f93['query']);_0x1a2b20[_0x240c('0x40')]=_['intersection'](_0x5c6f93['model'],qs[_0x240c('0x3f')](_0x15cb39[_0x240c('0x3c')][_0x240c('0x3f')]));_0x1a2b20['attributes']=_0x1a2b20[_0x240c('0x40')]['length']?_0x1a2b20[_0x240c('0x40')]:_0x5c6f93[_0x240c('0x3b')];_0x1a2b20['order']=qs[_0x240c('0x44')](_0x15cb39[_0x240c('0x3c')][_0x240c('0x44')]);_0x1a2b20['where']=qs[_0x240c('0x45')](_['pick'](_0x15cb39[_0x240c('0x3c')],_0x5c6f93[_0x240c('0x45')]));if(_0x15cb39[_0x240c('0x3c')][_0x240c('0x47')]){_0x1a2b20[_0x240c('0x48')]=_[_0x240c('0x49')](_0x1a2b20['where'],{'$or':_[_0x240c('0x36')](_0x1a2b20[_0x240c('0x40')],function(_0x5d3947){var _0x368c82={};_0x368c82[_0x5d3947]={'$like':'%'+_0x15cb39['query'][_0x240c('0x47')]+'%'};return _0x368c82;})});}_0x1a2b20=_[_0x240c('0x49')]({},_0x1a2b20,_0x15cb39[_0x240c('0x4b')]);return _0x33ce48['getSubjects'](_0x1a2b20);}})[_0x240c('0x1a')](function(_0x5c79ba){if(_0x5c79ba){_0x44ecb8=_0x5c79ba[_0x240c('0x41')];if(!_0x15cb39[_0x240c('0x3c')][_0x240c('0x56')]('nolimit')){_0x1a2b20['limit']=qs['limit'](_0x15cb39['query'][_0x240c('0x29')]);_0x1a2b20[_0x240c('0x28')]=qs['offset'](_0x15cb39[_0x240c('0x3c')][_0x240c('0x28')]);}return _0x33ce48[_0x240c('0x58')](_0x1a2b20);}})['then'](function(_0x3bd3ad){if(_0x3bd3ad){return _0x3bd3ad?{'count':_0x44ecb8,'rows':_0x3bd3ad}:null;}})[_0x240c('0x1a')](respondWithResult(_0x1b95e1,null))[_0x240c('0x24')](handleError(_0x1b95e1,null));};exports[_0x240c('0x59')]=function(_0x2cb85c,_0x23c373,_0x154f4a){var _0x3fd7fe={};var _0x3caa03={};var _0x7cbaf5;var _0x38b374;return db[_0x240c('0x37')][_0x240c('0x54')]({'where':{'id':_0x2cb85c['params']['id']}})[_0x240c('0x1a')](handleEntityNotFound(_0x23c373,null))[_0x240c('0x1a')](function(_0xf14f1d){if(_0xf14f1d){_0x7cbaf5=_0xf14f1d;_0x3caa03['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x3caa03[_0x240c('0x3c')]=_[_0x240c('0x3d')](_0x2cb85c['query']);_0x3caa03[_0x240c('0x45')]=_[_0x240c('0x3e')](_0x3caa03[_0x240c('0x3b')],_0x3caa03[_0x240c('0x3c')]);_0x3fd7fe[_0x240c('0x40')]=_[_0x240c('0x3e')](_0x3caa03['model'],qs['fields'](_0x2cb85c['query']['fields']));_0x3fd7fe[_0x240c('0x40')]=_0x3fd7fe[_0x240c('0x40')]['length']?_0x3fd7fe[_0x240c('0x40')]:_0x3caa03[_0x240c('0x3b')];_0x3fd7fe[_0x240c('0x43')]=qs[_0x240c('0x44')](_0x2cb85c[_0x240c('0x3c')][_0x240c('0x44')]);_0x3fd7fe[_0x240c('0x48')]=qs[_0x240c('0x45')](_[_0x240c('0x46')](_0x2cb85c[_0x240c('0x3c')],_0x3caa03[_0x240c('0x45')]));if(_0x2cb85c[_0x240c('0x3c')][_0x240c('0x47')]){_0x3fd7fe[_0x240c('0x48')]=_['merge'](_0x3fd7fe['where'],{'$or':_[_0x240c('0x36')](_0x3fd7fe[_0x240c('0x40')],function(_0x504f0c){var _0x66cdf6={};_0x66cdf6[_0x504f0c]={'$like':'%'+_0x2cb85c[_0x240c('0x3c')][_0x240c('0x47')]+'%'};return _0x66cdf6;})});}_0x3fd7fe=_[_0x240c('0x49')]({},_0x3fd7fe,_0x2cb85c[_0x240c('0x4b')]);return _0x7cbaf5[_0x240c('0x59')](_0x3fd7fe);}})[_0x240c('0x1a')](function(_0x356381){if(_0x356381){_0x38b374=_0x356381[_0x240c('0x41')];if(!_0x2cb85c[_0x240c('0x3c')][_0x240c('0x56')](_0x240c('0x42'))){_0x3fd7fe[_0x240c('0x29')]=qs[_0x240c('0x29')](_0x2cb85c['query'][_0x240c('0x29')]);_0x3fd7fe[_0x240c('0x28')]=qs[_0x240c('0x28')](_0x2cb85c[_0x240c('0x3c')]['offset']);}return _0x7cbaf5[_0x240c('0x59')](_0x3fd7fe);}})[_0x240c('0x1a')](function(_0x537c66){if(_0x537c66){return _0x537c66?{'count':_0x38b374,'rows':_0x537c66}:null;}})[_0x240c('0x1a')](respondWithResult(_0x23c373,null))[_0x240c('0x24')](handleError(_0x23c373,null));};exports['getTags']=function(_0x41dedb,_0xa0fd2b,_0x1d07a5){var _0x9e1d4e={};var _0x4e8f33={};var _0x2b7b40;var _0x54d687;return db['FreshdeskConfiguration'][_0x240c('0x54')]({'where':{'id':_0x41dedb[_0x240c('0x55')]['id']}})[_0x240c('0x1a')](handleEntityNotFound(_0xa0fd2b,null))[_0x240c('0x1a')](function(_0x4f3eca){if(_0x4f3eca){_0x2b7b40=_0x4f3eca;_0x4e8f33['model']=_[_0x240c('0x3d')](db['Tag']['rawAttributes']);_0x4e8f33[_0x240c('0x3c')]=_[_0x240c('0x3d')](_0x41dedb[_0x240c('0x3c')]);_0x4e8f33[_0x240c('0x45')]=_[_0x240c('0x3e')](_0x4e8f33['model'],_0x4e8f33[_0x240c('0x3c')]);_0x9e1d4e['attributes']=_[_0x240c('0x3e')](_0x4e8f33[_0x240c('0x3b')],qs[_0x240c('0x3f')](_0x41dedb[_0x240c('0x3c')]['fields']));_0x9e1d4e['attributes']=_0x9e1d4e[_0x240c('0x40')]['length']?_0x9e1d4e[_0x240c('0x40')]:_0x4e8f33['model'];_0x9e1d4e[_0x240c('0x43')]=qs[_0x240c('0x44')](_0x41dedb[_0x240c('0x3c')][_0x240c('0x44')]);_0x9e1d4e[_0x240c('0x48')]=qs[_0x240c('0x45')](_['pick'](_0x41dedb[_0x240c('0x3c')],_0x4e8f33['filters']));if(_0x41dedb[_0x240c('0x3c')][_0x240c('0x47')]){_0x9e1d4e[_0x240c('0x48')]=_[_0x240c('0x49')](_0x9e1d4e['where'],{'$or':_[_0x240c('0x36')](_0x9e1d4e[_0x240c('0x40')],function(_0x376a4f){var _0x298229={};_0x298229[_0x376a4f]={'$like':'%'+_0x41dedb[_0x240c('0x3c')][_0x240c('0x47')]+'%'};return _0x298229;})});}_0x9e1d4e=_[_0x240c('0x49')]({},_0x9e1d4e,_0x41dedb['options']);return _0x2b7b40[_0x240c('0x5a')](_0x9e1d4e);}})['then'](function(_0x55fcfc){if(_0x55fcfc){_0x54d687=_0x55fcfc[_0x240c('0x41')];if(!_0x41dedb['query']['hasOwnProperty'](_0x240c('0x42'))){_0x9e1d4e[_0x240c('0x29')]=qs[_0x240c('0x29')](_0x41dedb['query']['limit']);_0x9e1d4e[_0x240c('0x28')]=qs['offset'](_0x41dedb[_0x240c('0x3c')]['offset']);}return _0x2b7b40['getTags'](_0x9e1d4e);}})[_0x240c('0x1a')](function(_0x298fb1){if(_0x298fb1){return _0x298fb1?{'count':_0x54d687,'rows':_0x298fb1}:null;}})['then'](respondWithResult(_0xa0fd2b,null))[_0x240c('0x24')](handleError(_0xa0fd2b,null));};exports['setTags']=function(_0x4e7bb2,_0x15021b,_0x244b2b){if(_0x4e7bb2['body']['id']){delete _0x4e7bb2[_0x240c('0x52')]['id'];}return db['FreshdeskConfiguration'][_0x240c('0x54')]({'where':{'id':_0x4e7bb2[_0x240c('0x55')]['id']}})[_0x240c('0x1a')](handleEntityNotFound(_0x15021b,null))[_0x240c('0x1a')](function(_0x10b4a4){if(_0x10b4a4){return _0x10b4a4[_0x240c('0x5b')](_0x4e7bb2[_0x240c('0x52')][_0x240c('0x5c')]||[]);}return null;})['then'](respondWithResult(_0x15021b,null))[_0x240c('0x24')](handleError(_0x15021b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 293db47..af1f375 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 _0x5f17=['bluebird','request-promise','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment'];(function(_0x1a449a,_0x4111c5){var _0x395240=function(_0x5e77e4){while(--_0x5e77e4){_0x1a449a['push'](_0x1a449a['shift']());}};_0x395240(++_0x4111c5);}(_0x5f17,0x113));var _0x75f1=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x5f17[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0x75f1('0x0'));var util=require('util');var logger=require(_0x75f1('0x1'))(_0x75f1('0x2'));var moment=require(_0x75f1('0x3'));var BPromise=require(_0x75f1('0x4'));var rp=require(_0x75f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x75f1('0x6')]=function(_0x2a7fe5,_0x30fc7f){return _0x2a7fe5['define'](_0x75f1('0x7'),attributes,{'tableName':_0x75f1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ee1=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4839bf,_0x2d3bc1){var _0x137327=function(_0x2d4687){while(--_0x2d4687){_0x4839bf['push'](_0x4839bf['shift']());}};_0x137327(++_0x2d3bc1);}(_0x6ee1,0x1db));var _0x16ee=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x6ee1[_0xa60623];return _0x4a6487;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x16ee('0x0'));var BPromise=require(_0x16ee('0x1'));var rp=require(_0x16ee('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16ee('0x3'));var config=require(_0x16ee('0x4'));var attributes=require(_0x16ee('0x5'));module[_0x16ee('0x6')]=function(_0xcee139,_0x521b70){return _0xcee139[_0x16ee('0x7')](_0x16ee('0x8'),attributes,{'tableName':_0x16ee('0x9'),'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 7d8e093..b1171c3 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 _0x0a47=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird'];(function(_0x24243b,_0x55c567){var _0x1a85ce=function(_0x28c017){while(--_0x28c017){_0x24243b['push'](_0x24243b['shift']());}};_0x1a85ce(++_0x55c567);}(_0x0a47,0x1ca));var _0x70a4=function(_0x4e152d,_0x181a03){_0x4e152d=_0x4e152d-0x0;var _0x5b461b=_0x0a47[_0x4e152d];return _0x5b461b;};'use strict';var _=require(_0x70a4('0x0'));var util=require(_0x70a4('0x1'));var moment=require(_0x70a4('0x2'));var BPromise=require(_0x70a4('0x3'));var rs=require(_0x70a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x70a4('0x5'));var logger=require(_0x70a4('0x6'))(_0x70a4('0x7'));var config=require(_0x70a4('0x8'));var jayson=require(_0x70a4('0x9'));var client=jayson[_0x70a4('0xa')][_0x70a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f8914,_0x3a1217,_0x25ba0a){return new BPromise(function(_0x2a07de,_0xee3bdc){return client[_0x70a4('0xc')](_0x4f8914,_0x25ba0a)[_0x70a4('0xd')](function(_0x3f5ea8){logger[_0x70a4('0xe')](_0x70a4('0xf'),_0x3a1217,_0x70a4('0x10'));logger['debug'](_0x70a4('0x11'),_0x3a1217,_0x70a4('0x10'),JSON['stringify'](_0x3f5ea8));if(_0x3f5ea8['error']){if(_0x3f5ea8[_0x70a4('0x12')]['code']===0x1f4){logger[_0x70a4('0x12')](_0x70a4('0xf'),_0x3a1217,_0x3f5ea8[_0x70a4('0x12')]['message']);return _0xee3bdc(_0x3f5ea8[_0x70a4('0x12')][_0x70a4('0x13')]);}logger[_0x70a4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3a1217,_0x3f5ea8['error'][_0x70a4('0x13')]);return _0x2a07de(_0x3f5ea8[_0x70a4('0x12')]['message']);}else{logger['info'](_0x70a4('0xf'),_0x3a1217,_0x70a4('0x10'));_0x2a07de(_0x3f5ea8[_0x70a4('0x14')][_0x70a4('0x13')]);}})['catch'](function(_0x37105c){logger[_0x70a4('0x12')](_0x70a4('0xf'),_0x3a1217,_0x37105c);_0xee3bdc(_0x37105c);});});} \ No newline at end of file +var _0x351a=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x351a,0x19b));var _0xa351=function(_0x21d88e,_0x547126){_0x21d88e=_0x21d88e-0x0;var _0x6d374=_0x351a[_0x21d88e];return _0x6d374;};'use strict';var _=require(_0xa351('0x0'));var util=require(_0xa351('0x1'));var moment=require(_0xa351('0x2'));var BPromise=require('bluebird');var rs=require(_0xa351('0x3'));var fs=require('fs');var Redis=require(_0xa351('0x4'));var db=require(_0xa351('0x5'))['db'];var utils=require(_0xa351('0x6'));var logger=require(_0xa351('0x7'))(_0xa351('0x8'));var config=require(_0xa351('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa351('0xa')][_0xa351('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38e09f,_0x2235e1,_0x318b9e){return new BPromise(function(_0x3dbc7c,_0xf6743){return client[_0xa351('0xc')](_0x38e09f,_0x318b9e)[_0xa351('0xd')](function(_0x3a05fa){logger[_0xa351('0xe')](_0xa351('0xf'),_0x2235e1,_0xa351('0x10'));logger[_0xa351('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2235e1,'request\x20sent',JSON[_0xa351('0x12')](_0x3a05fa));if(_0x3a05fa[_0xa351('0x13')]){if(_0x3a05fa['error']['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2235e1,_0x3a05fa[_0xa351('0x13')]['message']);return _0xf6743(_0x3a05fa[_0xa351('0x13')][_0xa351('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2235e1,_0x3a05fa['error']['message']);return _0x3dbc7c(_0x3a05fa[_0xa351('0x13')]['message']);}else{logger[_0xa351('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2235e1,_0xa351('0x10'));_0x3dbc7c(_0x3a05fa[_0xa351('0x15')][_0xa351('0x14')]);}})['catch'](function(_0x30efac){logger['error'](_0xa351('0xf'),_0x2235e1,_0x30efac);_0xf6743(_0x30efac);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ab1b869..2bc01e5 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x506511,_0x48960b){var _0x3f8b8a=function(_0x2e2666){while(--_0x2e2666){_0x506511['push'](_0x506511['shift']());}};_0x3f8b8a(++_0x48960b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x4c4c28,_0x20fc51){var _0x4b0e0b=function(_0x34c879){while(--_0x34c879){_0x4c4c28['push'](_0x4c4c28['shift']());}};_0x4b0e0b(++_0x20fc51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6f29d31..80b38c7 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 _0x7c22=['keyValue','ENUM','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x596b74,_0x3c8f41){var _0x29a1c4=function(_0x112749){while(--_0x112749){_0x596b74['push'](_0x596b74['shift']());}};_0x29a1c4(++_0x3c8f41);}(_0x7c22,0x6c));var _0x27c2=function(_0x34566b,_0x549703){_0x34566b=_0x34566b-0x0;var _0x3fafa2=_0x7c22[_0x34566b];return _0x3fafa2;};'use strict';var Sequelize=require(_0x27c2('0x0'));module[_0x27c2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x27c2('0x2'),_0x27c2('0x3'),'customVariable',_0x27c2('0x4')),'defaultValue':_0x27c2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x27c2('0x5')]('string',_0x27c2('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x27c2('0x6')]},'idField':{'type':Sequelize[_0x27c2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x27c2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x27c2('0x6')]}}; \ No newline at end of file +var _0x68f5=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x557d34,_0x1434fb){var _0x132a39=function(_0x182a7a){while(--_0x182a7a){_0x557d34['push'](_0x557d34['shift']());}};_0x132a39(++_0x1434fb);}(_0x68f5,0x11a));var _0x568f=function(_0x413cce,_0x641580){_0x413cce=_0x413cce-0x0;var _0x2661a8=_0x68f5[_0x413cce];return _0x2661a8;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'type':{'type':Sequelize[_0x568f('0x2')]('string',_0x568f('0x3'),_0x568f('0x4'),_0x568f('0x5')),'defaultValue':_0x568f('0x6')},'content':{'type':Sequelize[_0x568f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x568f('0x2')](_0x568f('0x6'),_0x568f('0x3'),_0x568f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x568f('0x7')]},'customField':{'type':Sequelize[_0x568f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x568f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index baaaac3..00e5136 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 _0xfe53=['length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','catch','show','rawAttributes','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','model','keys','query','intersection','attributes','fields'];(function(_0x2b41f1,_0x241357){var _0x147911=function(_0x16b17b){while(--_0x16b17b){_0x2b41f1['push'](_0x2b41f1['shift']());}};_0x147911(++_0x241357);}(_0xfe53,0x175));var _0x3fe5=function(_0x15b182,_0xb73a6e){_0x15b182=_0x15b182-0x0;var _0x400ac7=_0xfe53[_0x15b182];return _0x400ac7;};'use strict';var pdf=require(_0x3fe5('0x0'));var emlformat=require(_0x3fe5('0x1'));var rimraf=require(_0x3fe5('0x2'));var zipdir=require(_0x3fe5('0x3'));var jsonpatch=require(_0x3fe5('0x4'));var rp=require(_0x3fe5('0x5'));var moment=require(_0x3fe5('0x6'));var BPromise=require(_0x3fe5('0x7'));var Mustache=require(_0x3fe5('0x8'));var util=require('util');var path=require(_0x3fe5('0x9'));var sox=require('sox');var csv=require(_0x3fe5('0xa'));var ejs=require(_0x3fe5('0xb'));var fs=require('fs');var _=require(_0x3fe5('0xc'));var squel=require(_0x3fe5('0xd'));var crypto=require(_0x3fe5('0xe'));var jsforce=require(_0x3fe5('0xf'));var deskjs=require(_0x3fe5('0x10'));var toCsv=require(_0x3fe5('0xa'));var querystring=require(_0x3fe5('0x11'));var Papa=require(_0x3fe5('0x12'));var Redis=require('ioredis');var authService=require(_0x3fe5('0x13'));var qs=require(_0x3fe5('0x14'));var as=require(_0x3fe5('0x15'));var hardwareService=require(_0x3fe5('0x16'));var logger=require(_0x3fe5('0x17'))('api');var utils=require(_0x3fe5('0x18'));var config=require(_0x3fe5('0x19'));var db=require(_0x3fe5('0x1a'))['db'];function respondWithStatusCode(_0x17868b,_0x344fa7){_0x344fa7=_0x344fa7||0xcc;return function(_0x33a318){if(_0x33a318){return _0x17868b['sendStatus'](_0x344fa7);}return _0x17868b[_0x3fe5('0x1b')](_0x344fa7)[_0x3fe5('0x1c')]();};}function respondWithResult(_0x44e868,_0x371dc4){_0x371dc4=_0x371dc4||0xc8;return function(_0x29449a){if(_0x29449a){return _0x44e868['status'](_0x371dc4)[_0x3fe5('0x1d')](_0x29449a);}};}function respondWithFilteredResult(_0x338b67,_0x21b114){return function(_0x5189f5){if(_0x5189f5){var _0x5957a4=_0x5189f5[_0x3fe5('0x1e')],_0x26727f=_0x21b114[_0x3fe5('0x1f')],_0x1a12c7=_0x21b114['offset']+_0x21b114[_0x3fe5('0x20')],_0x175761;if(_0x1a12c7>=_0x5957a4){_0x1a12c7=_0x5957a4;_0x175761=0xc8;}else{_0x175761=0xce;}_0x338b67[_0x3fe5('0x1b')](_0x175761);return _0x338b67[_0x3fe5('0x21')](_0x3fe5('0x22'),_0x26727f+'-'+_0x1a12c7+'/'+_0x5957a4)[_0x3fe5('0x1d')](_0x5189f5);}return null;};}function patchUpdates(_0x3e7481){return function(_0xc22eb){try{jsonpatch[_0x3fe5('0x23')](_0xc22eb,_0x3e7481,!![]);}catch(_0x13b29f){return BPromise[_0x3fe5('0x24')](_0x13b29f);}return _0xc22eb[_0x3fe5('0x25')]();};}function saveUpdates(_0x4d85f4,_0x3c0bbd){return function(_0x35b865){if(_0x35b865){return _0x35b865[_0x3fe5('0x26')](_0x4d85f4)[_0x3fe5('0x27')](function(_0xbf85a2){return _0xbf85a2;});}return null;};}function removeEntity(_0x1622ba,_0x39d0d3){return function(_0x545725){if(_0x545725){return _0x545725[_0x3fe5('0x28')]()[_0x3fe5('0x27')](function(){_0x1622ba[_0x3fe5('0x1b')](0xcc)[_0x3fe5('0x1c')]();});}};}function handleEntityNotFound(_0x39ef6b,_0x2ebe24){return function(_0x5a1c4e){if(!_0x5a1c4e){_0x39ef6b['sendStatus'](0x194);}return _0x5a1c4e;};}function handleError(_0x3e3cc8,_0x2dba3d){_0x2dba3d=_0x2dba3d||0x1f4;return function(_0x43eebc){logger[_0x3fe5('0x29')](_0x43eebc['stack']);if(_0x43eebc[_0x3fe5('0x2a')]){delete _0x43eebc[_0x3fe5('0x2a')];}_0x3e3cc8[_0x3fe5('0x1b')](_0x2dba3d)[_0x3fe5('0x2b')](_0x43eebc);};}exports[_0x3fe5('0x2c')]=function(_0x3bafdd,_0x4bd9ce){var _0x33cfb9={},_0x4f0ced={},_0x55aa4a={'count':0x0,'rows':[]};var _0x21ea84=_[_0x3fe5('0x2d')](db[_0x3fe5('0x2e')]['rawAttributes'],function(_0xc132c1){return{'name':_0xc132c1['fieldName'],'type':_0xc132c1['type']['key']};});_0x4f0ced[_0x3fe5('0x2f')]=_[_0x3fe5('0x2d')](_0x21ea84,_0x3fe5('0x2a'));_0x4f0ced['query']=_[_0x3fe5('0x30')](_0x3bafdd[_0x3fe5('0x31')]);_0x4f0ced['filters']=_[_0x3fe5('0x32')](_0x4f0ced[_0x3fe5('0x2f')],_0x4f0ced[_0x3fe5('0x31')]);_0x33cfb9[_0x3fe5('0x33')]=_[_0x3fe5('0x32')](_0x4f0ced[_0x3fe5('0x2f')],qs[_0x3fe5('0x34')](_0x3bafdd[_0x3fe5('0x31')][_0x3fe5('0x34')]));_0x33cfb9[_0x3fe5('0x33')]=_0x33cfb9[_0x3fe5('0x33')][_0x3fe5('0x35')]?_0x33cfb9[_0x3fe5('0x33')]:_0x4f0ced[_0x3fe5('0x2f')];if(!_0x3bafdd[_0x3fe5('0x31')][_0x3fe5('0x36')](_0x3fe5('0x37'))){_0x33cfb9[_0x3fe5('0x20')]=qs['limit'](_0x3bafdd['query'][_0x3fe5('0x20')]);_0x33cfb9[_0x3fe5('0x1f')]=qs[_0x3fe5('0x1f')](_0x3bafdd[_0x3fe5('0x31')]['offset']);}_0x33cfb9['order']=qs[_0x3fe5('0x38')](_0x3bafdd[_0x3fe5('0x31')]['sort']);_0x33cfb9[_0x3fe5('0x39')]=qs[_0x3fe5('0x3a')](_[_0x3fe5('0x3b')](_0x3bafdd[_0x3fe5('0x31')],_0x4f0ced[_0x3fe5('0x3a')]),_0x21ea84);if(_0x3bafdd['query'][_0x3fe5('0x3c')]){_0x33cfb9[_0x3fe5('0x39')]=_[_0x3fe5('0x3d')](_0x33cfb9[_0x3fe5('0x39')],{'$or':_[_0x3fe5('0x2d')](_0x21ea84,function(_0x1c4030){if(_0x1c4030['type']!=='VIRTUAL'){var _0x4d0c7b={};_0x4d0c7b[_0x1c4030[_0x3fe5('0x2a')]]={'$like':'%'+_0x3bafdd[_0x3fe5('0x31')]['filter']+'%'};return _0x4d0c7b;}})});}_0x33cfb9=_[_0x3fe5('0x3d')]({},_0x33cfb9,_0x3bafdd['options']);var _0x5ae4aa={'where':_0x33cfb9[_0x3fe5('0x39')]};return db['FreshdeskField'][_0x3fe5('0x1e')](_0x5ae4aa)[_0x3fe5('0x27')](function(_0x15a7e8){_0x55aa4a[_0x3fe5('0x1e')]=_0x15a7e8;if(_0x3bafdd['query'][_0x3fe5('0x3e')]){_0x33cfb9['include']=[{'all':!![]}];}return db[_0x3fe5('0x2e')]['findAll'](_0x33cfb9);})[_0x3fe5('0x27')](function(_0x2b1a91){_0x55aa4a['rows']=_0x2b1a91;return _0x55aa4a;})[_0x3fe5('0x27')](respondWithFilteredResult(_0x4bd9ce,_0x33cfb9))[_0x3fe5('0x3f')](handleError(_0x4bd9ce,null));};exports[_0x3fe5('0x40')]=function(_0x197f4d,_0x28b1f7){var _0x5bdfb8={'raw':!![],'where':{'id':_0x197f4d['params']['id']}},_0x50fe0f={};_0x50fe0f[_0x3fe5('0x2f')]=_[_0x3fe5('0x30')](db[_0x3fe5('0x2e')][_0x3fe5('0x41')]);_0x50fe0f['query']=_[_0x3fe5('0x30')](_0x197f4d['query']);_0x50fe0f[_0x3fe5('0x3a')]=_['intersection'](_0x50fe0f[_0x3fe5('0x2f')],_0x50fe0f[_0x3fe5('0x31')]);_0x5bdfb8[_0x3fe5('0x33')]=_['intersection'](_0x50fe0f[_0x3fe5('0x2f')],qs[_0x3fe5('0x34')](_0x197f4d['query'][_0x3fe5('0x34')]));_0x5bdfb8[_0x3fe5('0x33')]=_0x5bdfb8[_0x3fe5('0x33')]['length']?_0x5bdfb8[_0x3fe5('0x33')]:_0x50fe0f[_0x3fe5('0x2f')];if(_0x197f4d[_0x3fe5('0x31')][_0x3fe5('0x3e')]){_0x5bdfb8[_0x3fe5('0x42')]=[{'all':!![]}];}_0x5bdfb8=_[_0x3fe5('0x3d')]({},_0x5bdfb8,_0x197f4d['options']);return db[_0x3fe5('0x2e')][_0x3fe5('0x43')](_0x5bdfb8)['then'](handleEntityNotFound(_0x28b1f7,null))[_0x3fe5('0x27')](respondWithResult(_0x28b1f7,null))['catch'](handleError(_0x28b1f7,null));};exports[_0x3fe5('0x44')]=function(_0x1e8615,_0x485b67){return db[_0x3fe5('0x2e')]['create'](_0x1e8615[_0x3fe5('0x45')],{})[_0x3fe5('0x27')](respondWithResult(_0x485b67,0xc9))[_0x3fe5('0x3f')](handleError(_0x485b67,null));};exports[_0x3fe5('0x26')]=function(_0x5c9087,_0x318d06){if(_0x5c9087['body']['id']){delete _0x5c9087[_0x3fe5('0x45')]['id'];}return db['FreshdeskField'][_0x3fe5('0x43')]({'where':{'id':_0x5c9087['params']['id']}})[_0x3fe5('0x27')](handleEntityNotFound(_0x318d06,null))[_0x3fe5('0x27')](saveUpdates(_0x5c9087['body'],null))['then'](respondWithResult(_0x318d06,null))[_0x3fe5('0x3f')](handleError(_0x318d06,null));};exports['destroy']=function(_0x952fd4,_0xc0344b){return db['FreshdeskField'][_0x3fe5('0x43')]({'where':{'id':_0x952fd4[_0x3fe5('0x46')]['id']}})[_0x3fe5('0x27')](handleEntityNotFound(_0xc0344b,null))[_0x3fe5('0x27')](removeEntity(_0xc0344b,null))['catch'](handleError(_0xc0344b,null));}; \ No newline at end of file +var _0x5b74=['VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge'];(function(_0x1bf98a,_0x249c1d){var _0x2bb92c=function(_0x2f22fd){while(--_0x2f22fd){_0x1bf98a['push'](_0x1bf98a['shift']());}};_0x2bb92c(++_0x249c1d);}(_0x5b74,0x134));var _0x45b7=function(_0x20c73c,_0x299089){_0x20c73c=_0x20c73c-0x0;var _0x47635e=_0x5b74[_0x20c73c];return _0x47635e;};'use strict';var pdf=require(_0x45b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x45b7('0x1'));var zipdir=require(_0x45b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45b7('0x3'));var moment=require(_0x45b7('0x4'));var BPromise=require(_0x45b7('0x5'));var Mustache=require(_0x45b7('0x6'));var util=require(_0x45b7('0x7'));var path=require(_0x45b7('0x8'));var sox=require(_0x45b7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x45b7('0xa'));var squel=require(_0x45b7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x45b7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x45b7('0xd'));var Papa=require(_0x45b7('0xe'));var Redis=require(_0x45b7('0xf'));var authService=require(_0x45b7('0x10'));var qs=require(_0x45b7('0x11'));var as=require(_0x45b7('0x12'));var hardwareService=require(_0x45b7('0x13'));var logger=require(_0x45b7('0x14'))('api');var utils=require(_0x45b7('0x15'));var config=require(_0x45b7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e43a3,_0x427e6b){_0x427e6b=_0x427e6b||0xcc;return function(_0x58745e){if(_0x58745e){return _0x2e43a3['sendStatus'](_0x427e6b);}return _0x2e43a3[_0x45b7('0x17')](_0x427e6b)[_0x45b7('0x18')]();};}function respondWithResult(_0x51fc58,_0xc3b9ea){_0xc3b9ea=_0xc3b9ea||0xc8;return function(_0x34a18e){if(_0x34a18e){return _0x51fc58[_0x45b7('0x17')](_0xc3b9ea)[_0x45b7('0x19')](_0x34a18e);}};}function respondWithFilteredResult(_0x2a5fa8,_0x42420a){return function(_0x2dd78a){if(_0x2dd78a){var _0x15f079=_0x2dd78a[_0x45b7('0x1a')],_0x4d4417=_0x42420a['offset'],_0x2b3456=_0x42420a['offset']+_0x42420a[_0x45b7('0x1b')],_0x5db3b5;if(_0x2b3456>=_0x15f079){_0x2b3456=_0x15f079;_0x5db3b5=0xc8;}else{_0x5db3b5=0xce;}_0x2a5fa8['status'](_0x5db3b5);return _0x2a5fa8[_0x45b7('0x1c')](_0x45b7('0x1d'),_0x4d4417+'-'+_0x2b3456+'/'+_0x15f079)[_0x45b7('0x19')](_0x2dd78a);}return null;};}function patchUpdates(_0x14e3c2){return function(_0x44db1d){try{jsonpatch[_0x45b7('0x1e')](_0x44db1d,_0x14e3c2,!![]);}catch(_0x4ebd17){return BPromise[_0x45b7('0x1f')](_0x4ebd17);}return _0x44db1d[_0x45b7('0x20')]();};}function saveUpdates(_0x2b6cb0,_0x496b93){return function(_0x583ce2){if(_0x583ce2){return _0x583ce2[_0x45b7('0x21')](_0x2b6cb0)[_0x45b7('0x22')](function(_0x769967){return _0x769967;});}return null;};}function removeEntity(_0x253df4,_0x2e4617){return function(_0x3984c3){if(_0x3984c3){return _0x3984c3[_0x45b7('0x23')]()[_0x45b7('0x22')](function(){_0x253df4['status'](0xcc)[_0x45b7('0x18')]();});}};}function handleEntityNotFound(_0x12f66c,_0x4505b1){return function(_0x5d4229){if(!_0x5d4229){_0x12f66c['sendStatus'](0x194);}return _0x5d4229;};}function handleError(_0x2b5fdf,_0x216d2f){_0x216d2f=_0x216d2f||0x1f4;return function(_0xaa4967){logger[_0x45b7('0x24')](_0xaa4967[_0x45b7('0x25')]);if(_0xaa4967[_0x45b7('0x26')]){delete _0xaa4967['name'];}_0x2b5fdf[_0x45b7('0x17')](_0x216d2f)[_0x45b7('0x27')](_0xaa4967);};}exports[_0x45b7('0x28')]=function(_0x3fc72e,_0x16e16f){var _0x4a34ae={},_0x5e2d6f={},_0xd4ffbc={'count':0x0,'rows':[]};var _0xc832d4=_[_0x45b7('0x29')](db[_0x45b7('0x2a')]['rawAttributes'],function(_0x4e37f3){return{'name':_0x4e37f3[_0x45b7('0x2b')],'type':_0x4e37f3[_0x45b7('0x2c')][_0x45b7('0x2d')]};});_0x5e2d6f[_0x45b7('0x2e')]=_[_0x45b7('0x29')](_0xc832d4,_0x45b7('0x26'));_0x5e2d6f['query']=_[_0x45b7('0x2f')](_0x3fc72e[_0x45b7('0x30')]);_0x5e2d6f[_0x45b7('0x31')]=_[_0x45b7('0x32')](_0x5e2d6f['model'],_0x5e2d6f[_0x45b7('0x30')]);_0x4a34ae[_0x45b7('0x33')]=_[_0x45b7('0x32')](_0x5e2d6f[_0x45b7('0x2e')],qs[_0x45b7('0x34')](_0x3fc72e[_0x45b7('0x30')][_0x45b7('0x34')]));_0x4a34ae[_0x45b7('0x33')]=_0x4a34ae[_0x45b7('0x33')][_0x45b7('0x35')]?_0x4a34ae['attributes']:_0x5e2d6f['model'];if(!_0x3fc72e['query'][_0x45b7('0x36')](_0x45b7('0x37'))){_0x4a34ae[_0x45b7('0x1b')]=qs[_0x45b7('0x1b')](_0x3fc72e[_0x45b7('0x30')][_0x45b7('0x1b')]);_0x4a34ae[_0x45b7('0x38')]=qs[_0x45b7('0x38')](_0x3fc72e[_0x45b7('0x30')]['offset']);}_0x4a34ae[_0x45b7('0x39')]=qs[_0x45b7('0x3a')](_0x3fc72e[_0x45b7('0x30')][_0x45b7('0x3a')]);_0x4a34ae[_0x45b7('0x3b')]=qs['filters'](_['pick'](_0x3fc72e[_0x45b7('0x30')],_0x5e2d6f[_0x45b7('0x31')]),_0xc832d4);if(_0x3fc72e[_0x45b7('0x30')][_0x45b7('0x3c')]){_0x4a34ae['where']=_[_0x45b7('0x3d')](_0x4a34ae[_0x45b7('0x3b')],{'$or':_[_0x45b7('0x29')](_0xc832d4,function(_0x55e867){if(_0x55e867[_0x45b7('0x2c')]!==_0x45b7('0x3e')){var _0x558552={};_0x558552[_0x55e867['name']]={'$like':'%'+_0x3fc72e['query'][_0x45b7('0x3c')]+'%'};return _0x558552;}})});}_0x4a34ae=_[_0x45b7('0x3d')]({},_0x4a34ae,_0x3fc72e[_0x45b7('0x3f')]);var _0x4203c6={'where':_0x4a34ae['where']};return db[_0x45b7('0x2a')][_0x45b7('0x1a')](_0x4203c6)[_0x45b7('0x22')](function(_0x1479e8){_0xd4ffbc[_0x45b7('0x1a')]=_0x1479e8;if(_0x3fc72e[_0x45b7('0x30')][_0x45b7('0x40')]){_0x4a34ae[_0x45b7('0x41')]=[{'all':!![]}];}return db[_0x45b7('0x2a')][_0x45b7('0x42')](_0x4a34ae);})[_0x45b7('0x22')](function(_0xa16dda){_0xd4ffbc['rows']=_0xa16dda;return _0xd4ffbc;})[_0x45b7('0x22')](respondWithFilteredResult(_0x16e16f,_0x4a34ae))[_0x45b7('0x43')](handleError(_0x16e16f,null));};exports[_0x45b7('0x44')]=function(_0x40f277,_0x3ea19f){var _0x31fcdf={'raw':!![],'where':{'id':_0x40f277[_0x45b7('0x45')]['id']}},_0x3061c9={};_0x3061c9[_0x45b7('0x2e')]=_[_0x45b7('0x2f')](db[_0x45b7('0x2a')][_0x45b7('0x46')]);_0x3061c9[_0x45b7('0x30')]=_[_0x45b7('0x2f')](_0x40f277['query']);_0x3061c9[_0x45b7('0x31')]=_['intersection'](_0x3061c9['model'],_0x3061c9['query']);_0x31fcdf[_0x45b7('0x33')]=_[_0x45b7('0x32')](_0x3061c9[_0x45b7('0x2e')],qs[_0x45b7('0x34')](_0x40f277[_0x45b7('0x30')][_0x45b7('0x34')]));_0x31fcdf['attributes']=_0x31fcdf[_0x45b7('0x33')][_0x45b7('0x35')]?_0x31fcdf[_0x45b7('0x33')]:_0x3061c9[_0x45b7('0x2e')];if(_0x40f277['query'][_0x45b7('0x40')]){_0x31fcdf['include']=[{'all':!![]}];}_0x31fcdf=_[_0x45b7('0x3d')]({},_0x31fcdf,_0x40f277['options']);return db[_0x45b7('0x2a')]['find'](_0x31fcdf)[_0x45b7('0x22')](handleEntityNotFound(_0x3ea19f,null))[_0x45b7('0x22')](respondWithResult(_0x3ea19f,null))[_0x45b7('0x43')](handleError(_0x3ea19f,null));};exports[_0x45b7('0x47')]=function(_0x4b649f,_0x4bf520){return db[_0x45b7('0x2a')][_0x45b7('0x47')](_0x4b649f['body'],{})['then'](respondWithResult(_0x4bf520,0xc9))[_0x45b7('0x43')](handleError(_0x4bf520,null));};exports[_0x45b7('0x21')]=function(_0x4a40af,_0x3dc465){if(_0x4a40af['body']['id']){delete _0x4a40af[_0x45b7('0x48')]['id'];}return db[_0x45b7('0x2a')][_0x45b7('0x49')]({'where':{'id':_0x4a40af[_0x45b7('0x45')]['id']}})[_0x45b7('0x22')](handleEntityNotFound(_0x3dc465,null))['then'](saveUpdates(_0x4a40af[_0x45b7('0x48')],null))[_0x45b7('0x22')](respondWithResult(_0x3dc465,null))[_0x45b7('0x43')](handleError(_0x3dc465,null));};exports[_0x45b7('0x23')]=function(_0x284a8e,_0x5a86be){return db[_0x45b7('0x2a')]['find']({'where':{'id':_0x284a8e[_0x45b7('0x45')]['id']}})[_0x45b7('0x22')](handleEntityNotFound(_0x5a86be,null))[_0x45b7('0x22')](removeEntity(_0x5a86be,null))[_0x45b7('0x43')](handleError(_0x5a86be,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 36ea78c..f070764 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 _0x08d1=['./intFreshdeskField.attributes','FreshdeskField','freshdesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x450b21,_0x5c0be6){var _0x292a5b=function(_0x8e891f){while(--_0x8e891f){_0x450b21['push'](_0x450b21['shift']());}};_0x292a5b(++_0x5c0be6);}(_0x08d1,0x125));var _0x108d=function(_0x1f9b62,_0x29fa06){_0x1f9b62=_0x1f9b62-0x0;var _0x5bfb84=_0x08d1[_0x1f9b62];return _0x5bfb84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x108d('0x0'))(_0x108d('0x1'));var moment=require(_0x108d('0x2'));var BPromise=require(_0x108d('0x3'));var rp=require(_0x108d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x108d('0x5'));var config=require(_0x108d('0x6'));var attributes=require(_0x108d('0x7'));module['exports']=function(_0x59155a,_0x3ebde0){return _0x59155a['define'](_0x108d('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x108d('0x9'),'fields':[_0x108d('0xa'),_0x108d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f8c=['../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x326ee4,_0x22f9e8){var _0x4f1c1a=function(_0x32015f){while(--_0x32015f){_0x326ee4['push'](_0x326ee4['shift']());}};_0x4f1c1a(++_0x22f9e8);}(_0x7f8c,0x19e));var _0xc7f8=function(_0xcd66f6,_0x2624af){_0xcd66f6=_0xcd66f6-0x0;var _0x598702=_0x7f8c[_0xcd66f6];return _0x598702;};'use strict';var _=require(_0xc7f8('0x0'));var util=require(_0xc7f8('0x1'));var logger=require(_0xc7f8('0x2'))(_0xc7f8('0x3'));var moment=require(_0xc7f8('0x4'));var BPromise=require(_0xc7f8('0x5'));var rp=require(_0xc7f8('0x6'));var fs=require('fs');var path=require(_0xc7f8('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc7f8('0x8'));module['exports']=function(_0x52d7fb,_0xb3539a){return _0x52d7fb['define']('FreshdeskField',attributes,{'tableName':_0xc7f8('0x9'),'paranoid':![],'indexes':[{'name':_0xc7f8('0xa'),'fields':[_0xc7f8('0xb'),_0xc7f8('0xc')],'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 b3a5dfd..69a0914 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x525ab6,_0xc4f1ce){var _0x4fa659=function(_0x132faa){while(--_0x132faa){_0x525ab6['push'](_0x525ab6['shift']());}};_0x4fa659(++_0xc4f1ce);}(_0xb10b,0x12a));var _0xbb10=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0xb10b[_0x47041d];return _0x5022bd;};'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);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x9ba64c,_0x27727d){_0x9ba64c=_0x9ba64c-0x0;var _0x550730=_0x7a54[_0x9ba64c];return _0x550730;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index cca3221..2ae5c73 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 _0xdd4a=['show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x558489,_0x4344c4){var _0x14d9b8=function(_0x14ea90){while(--_0x14ea90){_0x558489['push'](_0x558489['shift']());}};_0x14d9b8(++_0x4344c4);}(_0xdd4a,0x1c4));var _0xadd4=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0xdd4a[_0x4a04de];return _0xbbe018;};'use strict';var multer=require(_0xadd4('0x0'));var util=require(_0xadd4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xadd4('0x2'));var router=express[_0xadd4('0x3')]();var auth=require(_0xadd4('0x4'));var interaction=require(_0xadd4('0x5'));var config=require(_0xadd4('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xadd4('0x7')]('/',auth[_0xadd4('0x8')](),controller[_0xadd4('0x9')]);router['get']('/:id',auth[_0xadd4('0x8')](),controller[_0xadd4('0xa')]);router[_0xadd4('0x7')](_0xadd4('0xb'),auth['isAuthenticated'](),controller[_0xadd4('0xc')]);router[_0xadd4('0x7')](_0xadd4('0xd'),auth[_0xadd4('0x8')](),controller['getFields']);router[_0xadd4('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xadd4('0xe')](_0xadd4('0xb'),auth['isAuthenticated'](),controller[_0xadd4('0xf')]);router[_0xadd4('0x10')](_0xadd4('0x11'),auth[_0xadd4('0x8')](),controller[_0xadd4('0x12')]);router[_0xadd4('0x13')](_0xadd4('0x11'),auth[_0xadd4('0x8')](),controller[_0xadd4('0x14')]);module[_0xadd4('0x15')]=router; \ No newline at end of file +var _0x92db=['create','put','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','isAuthenticated'];(function(_0x430993,_0x8c8cda){var _0x23e71f=function(_0x1c6dc6){while(--_0x1c6dc6){_0x430993['push'](_0x430993['shift']());}};_0x23e71f(++_0x8c8cda);}(_0x92db,0x9c));var _0xb92d=function(_0x5f4f75,_0x28e021){_0x5f4f75=_0x5f4f75-0x0;var _0x47387a=_0x92db[_0x5f4f75];return _0x47387a;};'use strict';var multer=require(_0xb92d('0x0'));var util=require(_0xb92d('0x1'));var path=require(_0xb92d('0x2'));var timeout=require(_0xb92d('0x3'));var express=require(_0xb92d('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb92d('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0xb92d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb92d('0x6')](_0xb92d('0x7'),auth['isAuthenticated'](),controller[_0xb92d('0x8')]);router['get'](_0xb92d('0x9'),auth['isAuthenticated'](),controller[_0xb92d('0xa')]);router[_0xb92d('0x6')](_0xb92d('0xb'),auth['isAuthenticated'](),controller[_0xb92d('0xc')]);router[_0xb92d('0xd')]('/',auth[_0xb92d('0xe')](),controller[_0xb92d('0xf')]);router[_0xb92d('0xd')](_0xb92d('0x9'),auth[_0xb92d('0xe')](),controller['addConfiguration']);router[_0xb92d('0x10')]('/:id',auth[_0xb92d('0xe')](),controller['update']);router[_0xb92d('0x11')](_0xb92d('0x7'),auth[_0xb92d('0xe')](),controller['destroy']);module[_0xb92d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6c82b79..74ac9e4 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 _0xe2cf=['remoteUri','exports','STRING','username'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xe2cf[_0x172133];return _0x2460e5;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfe2c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xfe2c('0x2')},'apiKey':{'type':Sequelize[_0xfe2c('0x1')]},'remoteUri':{'type':Sequelize[_0xfe2c('0x1')],'unique':_0xfe2c('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f08=['sequelize','exports','STRING','remoteUri'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x4f08,0x194));var _0x84f0=function(_0x2f9106,_0x303c0d){_0x2f9106=_0x2f9106-0x0;var _0x5c5dbc=_0x4f08[_0x2f9106];return _0x5c5dbc;};'use strict';var Sequelize=require(_0x84f0('0x0'));module[_0x84f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x84f0('0x2')]},'username':{'type':Sequelize[_0x84f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x84f0('0x2')]},'remoteUri':{'type':Sequelize[_0x84f0('0x2')],'unique':_0x84f0('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 23ab27d..ea55bed 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 _0xdaf8=['where','pick','filter','merge','count','includeAll','include','findAll','rows','show','fields','find','catch','create','body','params','getConfigurations','FreshsalesConfiguration','length','findOne','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','limit','sort'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdaf8,0x174));var _0x8daf=function(_0xf58e1e,_0x8f500c){_0xf58e1e=_0xf58e1e-0x0;var _0x38857c=_0xdaf8[_0xf58e1e];return _0x38857c;};'use strict';var pdf=require(_0x8daf('0x0'));var emlformat=require(_0x8daf('0x1'));var rimraf=require(_0x8daf('0x2'));var zipdir=require(_0x8daf('0x3'));var jsonpatch=require(_0x8daf('0x4'));var rp=require(_0x8daf('0x5'));var moment=require(_0x8daf('0x6'));var BPromise=require(_0x8daf('0x7'));var Mustache=require(_0x8daf('0x8'));var util=require('util');var path=require('path');var sox=require(_0x8daf('0x9'));var csv=require(_0x8daf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8daf('0xb'));var crypto=require(_0x8daf('0xc'));var jsforce=require(_0x8daf('0xd'));var deskjs=require(_0x8daf('0xe'));var toCsv=require(_0x8daf('0xa'));var querystring=require(_0x8daf('0xf'));var Papa=require('papaparse');var Redis=require(_0x8daf('0x10'));var authService=require(_0x8daf('0x11'));var qs=require(_0x8daf('0x12'));var as=require(_0x8daf('0x13'));var hardwareService=require(_0x8daf('0x14'));var logger=require('../../config/logger')(_0x8daf('0x15'));var utils=require(_0x8daf('0x16'));var config=require(_0x8daf('0x17'));var db=require(_0x8daf('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x8daf('0x19')][_0x8daf('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5f0bd8,_0x340bbe,_0x58b2a9){if(_0x58b2a9){var _0x21fa91=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21fa91[_0x8daf('0x1b')](_0x340bbe)){return _0x5f0bd8;}else{throw new db[(_0x8daf('0x1c'))][(_0x8daf('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5f0bd8;}}function respondWithRpcPromise(_0x418330,_0x3fe539,_0x224913,_0x5786ef){return new BPromise(function(_0x489373,_0x45f66a){var _0x329b3d=_0x5786ef||client;return _0x329b3d[_0x8daf('0x1e')](_0x418330,_0x224913)[_0x8daf('0x1f')](function(_0x8b281a){logger[_0x8daf('0x20')](_0x8daf('0x21'),_0x3fe539,_0x8daf('0x22'));logger[_0x8daf('0x23')](_0x8daf('0x24'),_0x3fe539,_0x8daf('0x22'),JSON[_0x8daf('0x25')](_0x8b281a));if(_0x8b281a[_0x8daf('0x26')]){if(_0x8b281a[_0x8daf('0x26')][_0x8daf('0x27')]===0x1f4){logger[_0x8daf('0x26')](_0x8daf('0x21'),_0x3fe539,_0x8b281a['error'][_0x8daf('0x28')]);return _0x45f66a(_0x8b281a[_0x8daf('0x26')][_0x8daf('0x28')]);}logger[_0x8daf('0x26')]('FreshsalesAccount,\x20%s,\x20%s',_0x3fe539,_0x8b281a[_0x8daf('0x26')][_0x8daf('0x28')]);return _0x489373(_0x8b281a[_0x8daf('0x26')]['message']);}else{logger[_0x8daf('0x20')](_0x8daf('0x21'),_0x3fe539,_0x8daf('0x22'));_0x489373(_0x8b281a['result'][_0x8daf('0x28')]);}})['catch'](function(_0x4d8f80){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3fe539,_0x4d8f80);_0x45f66a(_0x4d8f80);});});}function respondWithStatusCode(_0x30da2a,_0x95d628){_0x95d628=_0x95d628||0xcc;return function(_0xdff84c){if(_0xdff84c){return _0x30da2a[_0x8daf('0x29')](_0x95d628);}return _0x30da2a[_0x8daf('0x2a')](_0x95d628)[_0x8daf('0x2b')]();};}function respondWithResult(_0x24537f,_0x2102c5){_0x2102c5=_0x2102c5||0xc8;return function(_0x42ce50){if(_0x42ce50){return _0x24537f[_0x8daf('0x2a')](_0x2102c5)[_0x8daf('0x2c')](_0x42ce50);}};}function respondWithFilteredResult(_0xefcd43,_0x1942bb){return function(_0x265fcc){if(_0x265fcc){var _0x4ae5e6=_0x265fcc['count'],_0x3e56da=_0x1942bb[_0x8daf('0x2d')],_0x119ea5=_0x1942bb[_0x8daf('0x2d')]+_0x1942bb['limit'],_0x80d80e;if(_0x119ea5>=_0x4ae5e6){_0x119ea5=_0x4ae5e6;_0x80d80e=0xc8;}else{_0x80d80e=0xce;}_0xefcd43[_0x8daf('0x2a')](_0x80d80e);return _0xefcd43[_0x8daf('0x2e')](_0x8daf('0x2f'),_0x3e56da+'-'+_0x119ea5+'/'+_0x4ae5e6)[_0x8daf('0x2c')](_0x265fcc);}return null;};}function patchUpdates(_0x294884){return function(_0x120bba){try{jsonpatch[_0x8daf('0x30')](_0x120bba,_0x294884,!![]);}catch(_0x378f01){return BPromise[_0x8daf('0x31')](_0x378f01);}return _0x120bba['save']();};}function saveUpdates(_0x13b94f,_0x42a6cb){return function(_0xa258e6){if(_0xa258e6){return _0xa258e6[_0x8daf('0x32')](_0x13b94f)[_0x8daf('0x1f')](function(_0xe1c13c){return _0xe1c13c;});}return null;};}function removeEntity(_0x161ddd,_0x39df05){return function(_0x1a3b7a){if(_0x1a3b7a){return _0x1a3b7a[_0x8daf('0x33')]()[_0x8daf('0x1f')](function(){_0x161ddd[_0x8daf('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4093a8,_0x23d12b){return function(_0x393972){if(!_0x393972){_0x4093a8[_0x8daf('0x29')](0x194);}return _0x393972;};}function handleError(_0x48a582,_0x5f0815){_0x5f0815=_0x5f0815||0x1f4;return function(_0x3183f6){logger[_0x8daf('0x26')](_0x3183f6[_0x8daf('0x34')]);if(_0x3183f6[_0x8daf('0x35')]){delete _0x3183f6[_0x8daf('0x35')];}_0x48a582[_0x8daf('0x2a')](_0x5f0815)[_0x8daf('0x36')](_0x3183f6);};}exports[_0x8daf('0x37')]=function(_0x3b9058,_0x7765){var _0x30e379={},_0x58bdbc={},_0x442392={'count':0x0,'rows':[]};var _0x290bd0=_[_0x8daf('0x38')](db[_0x8daf('0x39')][_0x8daf('0x3a')],function(_0x3657e0){return{'name':_0x3657e0[_0x8daf('0x3b')],'type':_0x3657e0[_0x8daf('0x3c')][_0x8daf('0x3d')]};});_0x58bdbc[_0x8daf('0x3e')]=_[_0x8daf('0x38')](_0x290bd0,_0x8daf('0x35'));_0x58bdbc[_0x8daf('0x3f')]=_[_0x8daf('0x40')](_0x3b9058['query']);_0x58bdbc[_0x8daf('0x41')]=_['intersection'](_0x58bdbc[_0x8daf('0x3e')],_0x58bdbc['query']);_0x30e379[_0x8daf('0x42')]=_[_0x8daf('0x43')](_0x58bdbc[_0x8daf('0x3e')],qs['fields'](_0x3b9058[_0x8daf('0x3f')]['fields']));_0x30e379[_0x8daf('0x42')]=_0x30e379[_0x8daf('0x42')]['length']?_0x30e379[_0x8daf('0x42')]:_0x58bdbc['model'];if(!_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x44')](_0x8daf('0x45'))){_0x30e379[_0x8daf('0x46')]=qs[_0x8daf('0x46')](_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x46')]);_0x30e379[_0x8daf('0x2d')]=qs[_0x8daf('0x2d')](_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x2d')]);}_0x30e379['order']=qs['sort'](_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x47')]);_0x30e379[_0x8daf('0x48')]=qs['filters'](_[_0x8daf('0x49')](_0x3b9058[_0x8daf('0x3f')],_0x58bdbc[_0x8daf('0x41')]),_0x290bd0);if(_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x4a')]){_0x30e379[_0x8daf('0x48')]=_[_0x8daf('0x4b')](_0x30e379[_0x8daf('0x48')],{'$or':_[_0x8daf('0x38')](_0x290bd0,function(_0x196639){if(_0x196639[_0x8daf('0x3c')]!=='VIRTUAL'){var _0x97c8a7={};_0x97c8a7[_0x196639[_0x8daf('0x35')]]={'$like':'%'+_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x4a')]+'%'};return _0x97c8a7;}})});}_0x30e379=_[_0x8daf('0x4b')]({},_0x30e379,_0x3b9058['options']);var _0x43c7f4={'where':_0x30e379['where']};return db[_0x8daf('0x39')][_0x8daf('0x4c')](_0x43c7f4)['then'](function(_0x4ea8b1){_0x442392['count']=_0x4ea8b1;if(_0x3b9058[_0x8daf('0x3f')][_0x8daf('0x4d')]){_0x30e379[_0x8daf('0x4e')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x8daf('0x4f')](_0x30e379);})[_0x8daf('0x1f')](function(_0x3d16e8){_0x442392[_0x8daf('0x50')]=_0x3d16e8;return _0x442392;})[_0x8daf('0x1f')](respondWithFilteredResult(_0x7765,_0x30e379))['catch'](handleError(_0x7765,null));};exports[_0x8daf('0x51')]=function(_0x3b3c91,_0x2d31e4){var _0x296299={'raw':![],'where':{'id':_0x3b3c91['params']['id']}},_0x5c34fd={};_0x5c34fd['model']=_[_0x8daf('0x40')](db[_0x8daf('0x39')][_0x8daf('0x3a')]);_0x5c34fd[_0x8daf('0x3f')]=_['keys'](_0x3b3c91[_0x8daf('0x3f')]);_0x5c34fd['filters']=_[_0x8daf('0x43')](_0x5c34fd[_0x8daf('0x3e')],_0x5c34fd[_0x8daf('0x3f')]);_0x296299[_0x8daf('0x42')]=_[_0x8daf('0x43')](_0x5c34fd[_0x8daf('0x3e')],qs['fields'](_0x3b3c91[_0x8daf('0x3f')][_0x8daf('0x52')]));_0x296299['attributes']=_0x296299[_0x8daf('0x42')]['length']?_0x296299[_0x8daf('0x42')]:_0x5c34fd[_0x8daf('0x3e')];if(_0x3b3c91[_0x8daf('0x3f')]['includeAll']){_0x296299[_0x8daf('0x4e')]=[{'all':!![]}];}_0x296299=_[_0x8daf('0x4b')]({},_0x296299,_0x3b3c91['options']);return db[_0x8daf('0x39')][_0x8daf('0x53')](_0x296299)[_0x8daf('0x1f')](handleEntityNotFound(_0x2d31e4,null))[_0x8daf('0x1f')](respondWithResult(_0x2d31e4,null))[_0x8daf('0x54')](handleError(_0x2d31e4,null));};exports[_0x8daf('0x55')]=function(_0x311bee,_0x4eee9d){return db[_0x8daf('0x39')][_0x8daf('0x55')](_0x311bee[_0x8daf('0x56')],{})[_0x8daf('0x1f')](respondWithResult(_0x4eee9d,0xc9))['catch'](handleError(_0x4eee9d,null));};exports['update']=function(_0x1c3a05,_0xd84e7f){if(_0x1c3a05[_0x8daf('0x56')]['id']){delete _0x1c3a05[_0x8daf('0x56')]['id'];}return db[_0x8daf('0x39')][_0x8daf('0x53')]({'where':{'id':_0x1c3a05['params']['id']}})['then'](handleEntityNotFound(_0xd84e7f,null))[_0x8daf('0x1f')](saveUpdates(_0x1c3a05[_0x8daf('0x56')],null))['then'](respondWithResult(_0xd84e7f,null))[_0x8daf('0x54')](handleError(_0xd84e7f,null));};exports[_0x8daf('0x33')]=function(_0x3a5a95,_0x5e00d8){return db[_0x8daf('0x39')][_0x8daf('0x53')]({'where':{'id':_0x3a5a95[_0x8daf('0x57')]['id']}})[_0x8daf('0x1f')](handleEntityNotFound(_0x5e00d8,null))[_0x8daf('0x1f')](removeEntity(_0x5e00d8,null))['catch'](handleError(_0x5e00d8,null));};exports[_0x8daf('0x58')]=function(_0x1e9975,_0x4c41b6,_0x2f50ad){var _0x5b52f8={};var _0x3a97ff={};var _0x452239;var _0x2b4e26;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x1e9975['params']['id']}})[_0x8daf('0x1f')](handleEntityNotFound(_0x4c41b6,null))['then'](function(_0x17b69d){if(_0x17b69d){_0x452239=_0x17b69d;_0x3a97ff[_0x8daf('0x3e')]=_[_0x8daf('0x40')](db[_0x8daf('0x59')][_0x8daf('0x3a')]);_0x3a97ff[_0x8daf('0x3f')]=_[_0x8daf('0x40')](_0x1e9975[_0x8daf('0x3f')]);_0x3a97ff[_0x8daf('0x41')]=_[_0x8daf('0x43')](_0x3a97ff[_0x8daf('0x3e')],_0x3a97ff[_0x8daf('0x3f')]);_0x5b52f8[_0x8daf('0x42')]=_[_0x8daf('0x43')](_0x3a97ff['model'],qs['fields'](_0x1e9975[_0x8daf('0x3f')]['fields']));_0x5b52f8[_0x8daf('0x42')]=_0x5b52f8[_0x8daf('0x42')][_0x8daf('0x5a')]?_0x5b52f8[_0x8daf('0x42')]:_0x3a97ff[_0x8daf('0x3e')];_0x5b52f8['order']=qs[_0x8daf('0x47')](_0x1e9975[_0x8daf('0x3f')]['sort']);_0x5b52f8['where']=qs[_0x8daf('0x41')](_[_0x8daf('0x49')](_0x1e9975[_0x8daf('0x3f')],_0x3a97ff['filters']));if(_0x1e9975['query']['filter']){_0x5b52f8[_0x8daf('0x48')]=_[_0x8daf('0x4b')](_0x5b52f8[_0x8daf('0x48')],{'$or':_[_0x8daf('0x38')](_0x5b52f8[_0x8daf('0x42')],function(_0x3e7caa){var _0x49591a={};_0x49591a[_0x3e7caa]={'$like':'%'+_0x1e9975[_0x8daf('0x3f')][_0x8daf('0x4a')]+'%'};return _0x49591a;})});}_0x5b52f8=_[_0x8daf('0x4b')]({},_0x5b52f8,_0x1e9975['options']);return _0x452239[_0x8daf('0x58')](_0x5b52f8);}})[_0x8daf('0x1f')](function(_0x3f976a){if(_0x3f976a){_0x2b4e26=_0x3f976a['length'];if(!_0x1e9975[_0x8daf('0x3f')]['hasOwnProperty']('nolimit')){_0x5b52f8[_0x8daf('0x46')]=qs['limit'](_0x1e9975[_0x8daf('0x3f')]['limit']);_0x5b52f8[_0x8daf('0x2d')]=qs[_0x8daf('0x2d')](_0x1e9975['query']['offset']);}return _0x452239[_0x8daf('0x58')](_0x5b52f8);}})[_0x8daf('0x1f')](function(_0x3791fe){if(_0x3791fe){return _0x3791fe?{'count':_0x2b4e26,'rows':_0x3791fe}:null;}})[_0x8daf('0x1f')](respondWithResult(_0x4c41b6,null))[_0x8daf('0x54')](handleError(_0x4c41b6,null));};exports['addConfiguration']=function(_0x55ea80,_0x3fa703,_0x69c076){if(_0x55ea80[_0x8daf('0x56')]['id']){delete _0x55ea80[_0x8daf('0x56')]['id'];}return db[_0x8daf('0x39')][_0x8daf('0x5b')]({'where':{'id':_0x55ea80[_0x8daf('0x57')]['id']}})['then'](handleEntityNotFound(_0x3fa703,null))['then'](function(_0x2d8c09){if(_0x2d8c09){_0x55ea80[_0x8daf('0x56')]['AccountId']=_0x2d8c09['id'];_0x55ea80[_0x8daf('0x56')]['Subjects']=integrations['getSubjects'](_0x55ea80[_0x8daf('0x56')][_0x8daf('0x5c')],_0x55ea80['body']['type']);_0x55ea80['body'][_0x8daf('0x5d')]=integrations[_0x8daf('0x5e')](_0x55ea80[_0x8daf('0x56')][_0x8daf('0x5c')],_0x55ea80['body'][_0x8daf('0x3c')]);return db[_0x8daf('0x59')][_0x8daf('0x55')](_0x55ea80['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x8daf('0x5f')},{'model':db[_0x8daf('0x60')],'as':_0x8daf('0x5d')}]});}return null;})[_0x8daf('0x1f')](respondWithResult(_0x3fa703,null))[_0x8daf('0x54')](handleError(_0x3fa703,null));};exports[_0x8daf('0x61')]=function(_0x11fce9,_0x34ca1d,_0x5e1c19){var _0x5bf7b7='';var _0x5b673f='';return db[_0x8daf('0x39')][_0x8daf('0x5b')]({'where':{'id':_0x11fce9['params']['id']},'attributes':['id',_0x8daf('0x62'),_0x8daf('0x63'),_0x8daf('0x64')]})[_0x8daf('0x1f')](handleEntityNotFound(_0x34ca1d,null))[_0x8daf('0x1f')](function(_0xf6b410){if(_0xf6b410){_0x5b673f=_0xf6b410['username'];_0x5bf7b7=_0xf6b410[_0x8daf('0x63')];var _0x28712a=_0xf6b410[_0x8daf('0x63')][_0x8daf('0x65')](-0x1);if(_0x28712a==='/'){_0x5bf7b7=_0x5bf7b7['substring'](0x0,_0x5bf7b7[_0x8daf('0x66')](_0x28712a));}return rp({'method':'GET','uri':util[_0x8daf('0x67')]('%s%s',_0x5bf7b7,_0x8daf('0x68')),'headers':{'Authorization':_0x8daf('0x69')+_0xf6b410['apiKey']},'json':!![]});}})[_0x8daf('0x1f')](function(_0x2780a6){if(_0x2780a6){var _0x2c2523=_0x2780a6[_0x8daf('0x6a')];var _0x3d88e2=![];var _0xb7389a=null;for(_0xb7389a=0x0;_0xb7389a<_0x2c2523['length'];_0xb7389a++){if(_0x2c2523[_0xb7389a][_0x8daf('0x6b')]===_0x5b673f){_0x3d88e2=!![];}}if(_0x3d88e2){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8daf('0x6c')});}}})[_0x8daf('0x1f')](respondWithResult(_0x34ca1d,null))['catch'](function(_0x5984d1){var _0x29ffeb=_0x11fce9[_0x8daf('0x3f')][_0x8daf('0x1b')]?0x1f4:_0x5984d1['statusCode']||0x1f4;logger[_0x8daf('0x26')](_0x8daf('0x6d'),_0x8daf('0x61'),_0x29ffeb,JSON[_0x8daf('0x25')](_0x5984d1));delete _0x5984d1[_0x8daf('0x35')];if(_0x29ffeb===0x191){_0x29ffeb=0x190;}_0x34ca1d[_0x8daf('0x2a')](_0x29ffeb)[_0x8daf('0x36')](_0x11fce9['query'][_0x8daf('0x1b')]?{'message':_0x8daf('0x6e'),'statusCode':_0x5984d1['statusCode']}:_0x5984d1);});}; \ No newline at end of file +var _0xfea2=['../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','Content-Range','json','reject','save','update','then','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','create','body','destroy','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xfea2,0xd0));var _0x2fea=function(_0x22b64b,_0x5de02f){_0x22b64b=_0x22b64b-0x0;var _0x2b24de=_0xfea2[_0x22b64b];return _0x2b24de;};'use strict';var pdf=require(_0x2fea('0x0'));var emlformat=require(_0x2fea('0x1'));var rimraf=require(_0x2fea('0x2'));var zipdir=require(_0x2fea('0x3'));var jsonpatch=require(_0x2fea('0x4'));var rp=require('request-promise');var moment=require(_0x2fea('0x5'));var BPromise=require(_0x2fea('0x6'));var Mustache=require(_0x2fea('0x7'));var util=require(_0x2fea('0x8'));var path=require('path');var sox=require(_0x2fea('0x9'));var csv=require(_0x2fea('0xa'));var ejs=require(_0x2fea('0xb'));var fs=require('fs');var _=require(_0x2fea('0xc'));var squel=require('squel');var crypto=require(_0x2fea('0xd'));var jsforce=require(_0x2fea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2fea('0xa'));var querystring=require(_0x2fea('0xf'));var Papa=require(_0x2fea('0x10'));var Redis=require(_0x2fea('0x11'));var authService=require(_0x2fea('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2fea('0x13'));var hardwareService=require(_0x2fea('0x14'));var logger=require(_0x2fea('0x15'))('api');var utils=require(_0x2fea('0x16'));var config=require('../../config/environment');var db=require(_0x2fea('0x17'))['db'];var integrations=require(_0x2fea('0x18'));var jayson=require(_0x2fea('0x19'));var client=jayson['client'][_0x2fea('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2e66a3,_0x52b549,_0x53122b){if(_0x53122b){var _0x53a2c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53a2c2[_0x2fea('0x1b')](_0x52b549)){return _0x2e66a3;}else{throw new db[(_0x2fea('0x1c'))][(_0x2fea('0x1d'))](_0x2fea('0x1e'));}}else{return _0x2e66a3;}}function respondWithRpcPromise(_0x456c06,_0x4f5787,_0xaa2757,_0x2dd6bf){return new BPromise(function(_0x52e3be,_0x5e415f){var _0x33fe88=_0x2dd6bf||client;return _0x33fe88[_0x2fea('0x1f')](_0x456c06,_0xaa2757)['then'](function(_0x539017){logger['info'](_0x2fea('0x20'),_0x4f5787,_0x2fea('0x21'));logger['debug'](_0x2fea('0x22'),_0x4f5787,'request\x20sent',JSON['stringify'](_0x539017));if(_0x539017[_0x2fea('0x23')]){if(_0x539017[_0x2fea('0x23')][_0x2fea('0x24')]===0x1f4){logger[_0x2fea('0x23')](_0x2fea('0x20'),_0x4f5787,_0x539017[_0x2fea('0x23')][_0x2fea('0x25')]);return _0x5e415f(_0x539017[_0x2fea('0x23')][_0x2fea('0x25')]);}logger[_0x2fea('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x4f5787,_0x539017[_0x2fea('0x23')][_0x2fea('0x25')]);return _0x52e3be(_0x539017['error'][_0x2fea('0x25')]);}else{logger['info'](_0x2fea('0x20'),_0x4f5787,_0x2fea('0x21'));_0x52e3be(_0x539017[_0x2fea('0x26')][_0x2fea('0x25')]);}})[_0x2fea('0x27')](function(_0x1aab56){logger[_0x2fea('0x23')](_0x2fea('0x20'),_0x4f5787,_0x1aab56);_0x5e415f(_0x1aab56);});});}function respondWithStatusCode(_0x2c43a0,_0xbec870){_0xbec870=_0xbec870||0xcc;return function(_0x4d325d){if(_0x4d325d){return _0x2c43a0[_0x2fea('0x28')](_0xbec870);}return _0x2c43a0['status'](_0xbec870)[_0x2fea('0x29')]();};}function respondWithResult(_0x2aad1d,_0x27a8c1){_0x27a8c1=_0x27a8c1||0xc8;return function(_0x220d20){if(_0x220d20){return _0x2aad1d[_0x2fea('0x2a')](_0x27a8c1)['json'](_0x220d20);}};}function respondWithFilteredResult(_0x4d3429,_0x461e5b){return function(_0x4b71f4){if(_0x4b71f4){var _0x3c8db7=_0x4b71f4[_0x2fea('0x2b')],_0x248b22=_0x461e5b[_0x2fea('0x2c')],_0x46c5cc=_0x461e5b['offset']+_0x461e5b[_0x2fea('0x2d')],_0xf2e9c3;if(_0x46c5cc>=_0x3c8db7){_0x46c5cc=_0x3c8db7;_0xf2e9c3=0xc8;}else{_0xf2e9c3=0xce;}_0x4d3429[_0x2fea('0x2a')](_0xf2e9c3);return _0x4d3429['set'](_0x2fea('0x2e'),_0x248b22+'-'+_0x46c5cc+'/'+_0x3c8db7)[_0x2fea('0x2f')](_0x4b71f4);}return null;};}function patchUpdates(_0x5e07ee){return function(_0x22493a){try{jsonpatch['apply'](_0x22493a,_0x5e07ee,!![]);}catch(_0x1874f3){return BPromise[_0x2fea('0x30')](_0x1874f3);}return _0x22493a[_0x2fea('0x31')]();};}function saveUpdates(_0x4ca08e,_0xfe9d01){return function(_0x31f16e){if(_0x31f16e){return _0x31f16e[_0x2fea('0x32')](_0x4ca08e)[_0x2fea('0x33')](function(_0x5b8f8a){return _0x5b8f8a;});}return null;};}function removeEntity(_0xb6497a,_0x1a83ff){return function(_0x26f01a){if(_0x26f01a){return _0x26f01a['destroy']()['then'](function(){_0xb6497a[_0x2fea('0x2a')](0xcc)[_0x2fea('0x29')]();});}};}function handleEntityNotFound(_0x563c7a,_0x1f943c){return function(_0x4be9c2){if(!_0x4be9c2){_0x563c7a[_0x2fea('0x28')](0x194);}return _0x4be9c2;};}function handleError(_0x474f32,_0x5202da){_0x5202da=_0x5202da||0x1f4;return function(_0x4f12b1){logger[_0x2fea('0x23')](_0x4f12b1[_0x2fea('0x34')]);if(_0x4f12b1[_0x2fea('0x35')]){delete _0x4f12b1[_0x2fea('0x35')];}_0x474f32['status'](_0x5202da)[_0x2fea('0x36')](_0x4f12b1);};}exports[_0x2fea('0x37')]=function(_0xc7c0fd,_0x1ecb52){var _0x2e3d1f={},_0x3721d3={},_0x103638={'count':0x0,'rows':[]};var _0x82fdbe=_['map'](db[_0x2fea('0x38')][_0x2fea('0x39')],function(_0x4127a2){return{'name':_0x4127a2[_0x2fea('0x3a')],'type':_0x4127a2[_0x2fea('0x3b')]['key']};});_0x3721d3[_0x2fea('0x3c')]=_[_0x2fea('0x3d')](_0x82fdbe,_0x2fea('0x35'));_0x3721d3[_0x2fea('0x3e')]=_[_0x2fea('0x3f')](_0xc7c0fd[_0x2fea('0x3e')]);_0x3721d3[_0x2fea('0x40')]=_[_0x2fea('0x41')](_0x3721d3[_0x2fea('0x3c')],_0x3721d3[_0x2fea('0x3e')]);_0x2e3d1f[_0x2fea('0x42')]=_['intersection'](_0x3721d3['model'],qs[_0x2fea('0x43')](_0xc7c0fd[_0x2fea('0x3e')][_0x2fea('0x43')]));_0x2e3d1f[_0x2fea('0x42')]=_0x2e3d1f[_0x2fea('0x42')][_0x2fea('0x44')]?_0x2e3d1f[_0x2fea('0x42')]:_0x3721d3[_0x2fea('0x3c')];if(!_0xc7c0fd[_0x2fea('0x3e')]['hasOwnProperty'](_0x2fea('0x45'))){_0x2e3d1f[_0x2fea('0x2d')]=qs['limit'](_0xc7c0fd[_0x2fea('0x3e')]['limit']);_0x2e3d1f['offset']=qs[_0x2fea('0x2c')](_0xc7c0fd[_0x2fea('0x3e')][_0x2fea('0x2c')]);}_0x2e3d1f[_0x2fea('0x46')]=qs[_0x2fea('0x47')](_0xc7c0fd[_0x2fea('0x3e')][_0x2fea('0x47')]);_0x2e3d1f[_0x2fea('0x48')]=qs['filters'](_[_0x2fea('0x49')](_0xc7c0fd[_0x2fea('0x3e')],_0x3721d3['filters']),_0x82fdbe);if(_0xc7c0fd[_0x2fea('0x3e')][_0x2fea('0x4a')]){_0x2e3d1f['where']=_[_0x2fea('0x4b')](_0x2e3d1f[_0x2fea('0x48')],{'$or':_['map'](_0x82fdbe,function(_0x3ddcb1){if(_0x3ddcb1[_0x2fea('0x3b')]!==_0x2fea('0x4c')){var _0x66c4d1={};_0x66c4d1[_0x3ddcb1['name']]={'$like':'%'+_0xc7c0fd[_0x2fea('0x3e')]['filter']+'%'};return _0x66c4d1;}})});}_0x2e3d1f=_[_0x2fea('0x4b')]({},_0x2e3d1f,_0xc7c0fd[_0x2fea('0x4d')]);var _0xff2723={'where':_0x2e3d1f[_0x2fea('0x48')]};return db[_0x2fea('0x38')][_0x2fea('0x2b')](_0xff2723)[_0x2fea('0x33')](function(_0x1e0b19){_0x103638['count']=_0x1e0b19;if(_0xc7c0fd['query'][_0x2fea('0x4e')]){_0x2e3d1f['include']=[{'all':!![]}];}return db[_0x2fea('0x38')][_0x2fea('0x4f')](_0x2e3d1f);})[_0x2fea('0x33')](function(_0x22ddf9){_0x103638['rows']=_0x22ddf9;return _0x103638;})[_0x2fea('0x33')](respondWithFilteredResult(_0x1ecb52,_0x2e3d1f))[_0x2fea('0x27')](handleError(_0x1ecb52,null));};exports[_0x2fea('0x50')]=function(_0x44d475,_0xe0de07){var _0x491ec6={'raw':![],'where':{'id':_0x44d475[_0x2fea('0x51')]['id']}},_0x6e8512={};_0x6e8512[_0x2fea('0x3c')]=_['keys'](db['FreshsalesAccount'][_0x2fea('0x39')]);_0x6e8512[_0x2fea('0x3e')]=_[_0x2fea('0x3f')](_0x44d475[_0x2fea('0x3e')]);_0x6e8512[_0x2fea('0x40')]=_[_0x2fea('0x41')](_0x6e8512[_0x2fea('0x3c')],_0x6e8512[_0x2fea('0x3e')]);_0x491ec6[_0x2fea('0x42')]=_[_0x2fea('0x41')](_0x6e8512[_0x2fea('0x3c')],qs[_0x2fea('0x43')](_0x44d475[_0x2fea('0x3e')][_0x2fea('0x43')]));_0x491ec6['attributes']=_0x491ec6[_0x2fea('0x42')]['length']?_0x491ec6['attributes']:_0x6e8512[_0x2fea('0x3c')];if(_0x44d475[_0x2fea('0x3e')]['includeAll']){_0x491ec6[_0x2fea('0x52')]=[{'all':!![]}];}_0x491ec6=_[_0x2fea('0x4b')]({},_0x491ec6,_0x44d475['options']);return db[_0x2fea('0x38')]['find'](_0x491ec6)[_0x2fea('0x33')](handleEntityNotFound(_0xe0de07,null))[_0x2fea('0x33')](respondWithResult(_0xe0de07,null))[_0x2fea('0x27')](handleError(_0xe0de07,null));};exports[_0x2fea('0x53')]=function(_0x4538a5,_0x4b01de){return db[_0x2fea('0x38')][_0x2fea('0x53')](_0x4538a5['body'],{})[_0x2fea('0x33')](respondWithResult(_0x4b01de,0xc9))[_0x2fea('0x27')](handleError(_0x4b01de,null));};exports[_0x2fea('0x32')]=function(_0x323bf0,_0x2ca52d){if(_0x323bf0[_0x2fea('0x54')]['id']){delete _0x323bf0[_0x2fea('0x54')]['id'];}return db[_0x2fea('0x38')]['find']({'where':{'id':_0x323bf0['params']['id']}})['then'](handleEntityNotFound(_0x2ca52d,null))[_0x2fea('0x33')](saveUpdates(_0x323bf0[_0x2fea('0x54')],null))[_0x2fea('0x33')](respondWithResult(_0x2ca52d,null))[_0x2fea('0x27')](handleError(_0x2ca52d,null));};exports[_0x2fea('0x55')]=function(_0x51a872,_0xa06b88){return db[_0x2fea('0x38')][_0x2fea('0x56')]({'where':{'id':_0x51a872['params']['id']}})[_0x2fea('0x33')](handleEntityNotFound(_0xa06b88,null))['then'](removeEntity(_0xa06b88,null))['catch'](handleError(_0xa06b88,null));};exports[_0x2fea('0x57')]=function(_0x3e6101,_0x13d6c6,_0x35eacf){var _0x307f60={};var _0x415c9e={};var _0x103f99;var _0xdb579;return db[_0x2fea('0x38')][_0x2fea('0x58')]({'where':{'id':_0x3e6101[_0x2fea('0x51')]['id']}})[_0x2fea('0x33')](handleEntityNotFound(_0x13d6c6,null))[_0x2fea('0x33')](function(_0x3ccc0d){if(_0x3ccc0d){_0x103f99=_0x3ccc0d;_0x415c9e['model']=_[_0x2fea('0x3f')](db[_0x2fea('0x59')][_0x2fea('0x39')]);_0x415c9e[_0x2fea('0x3e')]=_[_0x2fea('0x3f')](_0x3e6101[_0x2fea('0x3e')]);_0x415c9e[_0x2fea('0x40')]=_[_0x2fea('0x41')](_0x415c9e['model'],_0x415c9e[_0x2fea('0x3e')]);_0x307f60[_0x2fea('0x42')]=_['intersection'](_0x415c9e[_0x2fea('0x3c')],qs['fields'](_0x3e6101[_0x2fea('0x3e')][_0x2fea('0x43')]));_0x307f60['attributes']=_0x307f60[_0x2fea('0x42')][_0x2fea('0x44')]?_0x307f60[_0x2fea('0x42')]:_0x415c9e[_0x2fea('0x3c')];_0x307f60[_0x2fea('0x46')]=qs[_0x2fea('0x47')](_0x3e6101[_0x2fea('0x3e')]['sort']);_0x307f60[_0x2fea('0x48')]=qs[_0x2fea('0x40')](_[_0x2fea('0x49')](_0x3e6101[_0x2fea('0x3e')],_0x415c9e[_0x2fea('0x40')]));if(_0x3e6101[_0x2fea('0x3e')][_0x2fea('0x4a')]){_0x307f60[_0x2fea('0x48')]=_[_0x2fea('0x4b')](_0x307f60[_0x2fea('0x48')],{'$or':_['map'](_0x307f60[_0x2fea('0x42')],function(_0x235a27){var _0x20e881={};_0x20e881[_0x235a27]={'$like':'%'+_0x3e6101[_0x2fea('0x3e')][_0x2fea('0x4a')]+'%'};return _0x20e881;})});}_0x307f60=_[_0x2fea('0x4b')]({},_0x307f60,_0x3e6101[_0x2fea('0x4d')]);return _0x103f99['getConfigurations'](_0x307f60);}})[_0x2fea('0x33')](function(_0x5110aa){if(_0x5110aa){_0xdb579=_0x5110aa[_0x2fea('0x44')];if(!_0x3e6101[_0x2fea('0x3e')]['hasOwnProperty'](_0x2fea('0x45'))){_0x307f60[_0x2fea('0x2d')]=qs[_0x2fea('0x2d')](_0x3e6101[_0x2fea('0x3e')][_0x2fea('0x2d')]);_0x307f60['offset']=qs[_0x2fea('0x2c')](_0x3e6101[_0x2fea('0x3e')][_0x2fea('0x2c')]);}return _0x103f99[_0x2fea('0x57')](_0x307f60);}})['then'](function(_0x5acd22){if(_0x5acd22){return _0x5acd22?{'count':_0xdb579,'rows':_0x5acd22}:null;}})[_0x2fea('0x33')](respondWithResult(_0x13d6c6,null))[_0x2fea('0x27')](handleError(_0x13d6c6,null));};exports[_0x2fea('0x5a')]=function(_0x19998f,_0xf493fa,_0x4a141e){if(_0x19998f[_0x2fea('0x54')]['id']){delete _0x19998f[_0x2fea('0x54')]['id'];}return db[_0x2fea('0x38')][_0x2fea('0x58')]({'where':{'id':_0x19998f[_0x2fea('0x51')]['id']}})[_0x2fea('0x33')](handleEntityNotFound(_0xf493fa,null))[_0x2fea('0x33')](function(_0x5b9495){if(_0x5b9495){_0x19998f[_0x2fea('0x54')][_0x2fea('0x5b')]=_0x5b9495['id'];_0x19998f['body'][_0x2fea('0x5c')]=integrations[_0x2fea('0x5d')](_0x19998f[_0x2fea('0x54')][_0x2fea('0x5e')],_0x19998f['body'][_0x2fea('0x3b')]);_0x19998f[_0x2fea('0x54')][_0x2fea('0x5f')]=integrations[_0x2fea('0x60')](_0x19998f[_0x2fea('0x54')][_0x2fea('0x5e')],_0x19998f[_0x2fea('0x54')]['type']);return db['FreshsalesConfiguration'][_0x2fea('0x53')](_0x19998f[_0x2fea('0x54')],{'include':[{'model':db[_0x2fea('0x61')],'as':'Subjects'},{'model':db[_0x2fea('0x61')],'as':_0x2fea('0x5f')}]});}return null;})[_0x2fea('0x33')](respondWithResult(_0xf493fa,null))[_0x2fea('0x27')](handleError(_0xf493fa,null));};exports[_0x2fea('0x62')]=function(_0x25a0c1,_0x49cfda,_0x19e9c9){var _0x3e893b='';var _0xad7c4a='';return db[_0x2fea('0x38')][_0x2fea('0x58')]({'where':{'id':_0x25a0c1['params']['id']},'attributes':['id',_0x2fea('0x63'),'remoteUri',_0x2fea('0x64')]})['then'](handleEntityNotFound(_0x49cfda,null))[_0x2fea('0x33')](function(_0x430187){if(_0x430187){_0xad7c4a=_0x430187[_0x2fea('0x63')];_0x3e893b=_0x430187['remoteUri'];var _0x11ff99=_0x430187[_0x2fea('0x65')][_0x2fea('0x66')](-0x1);if(_0x11ff99==='/'){_0x3e893b=_0x3e893b['substring'](0x0,_0x3e893b[_0x2fea('0x67')](_0x11ff99));}return rp({'method':_0x2fea('0x68'),'uri':util[_0x2fea('0x69')]('%s%s',_0x3e893b,_0x2fea('0x6a')),'headers':{'Authorization':_0x2fea('0x6b')+_0x430187['apiKey']},'json':!![]});}})[_0x2fea('0x33')](function(_0x29058e){if(_0x29058e){var _0x3d0a90=_0x29058e[_0x2fea('0x6c')];var _0x35d383=![];var _0x3f7ba9=null;for(_0x3f7ba9=0x0;_0x3f7ba9<_0x3d0a90[_0x2fea('0x44')];_0x3f7ba9++){if(_0x3d0a90[_0x3f7ba9][_0x2fea('0x6d')]===_0xad7c4a){_0x35d383=!![];}}if(_0x35d383){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2fea('0x6e')});}}})[_0x2fea('0x33')](respondWithResult(_0x49cfda,null))[_0x2fea('0x27')](function(_0x74fe56){var _0x1b59fc=_0x25a0c1[_0x2fea('0x3e')][_0x2fea('0x1b')]?0x1f4:_0x74fe56[_0x2fea('0x6f')]||0x1f4;logger[_0x2fea('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x2fea('0x62'),_0x1b59fc,JSON[_0x2fea('0x70')](_0x74fe56));delete _0x74fe56[_0x2fea('0x35')];if(_0x1b59fc===0x191){_0x1b59fc=0x190;}_0x49cfda['status'](_0x1b59fc)[_0x2fea('0x36')](_0x25a0c1['query'][_0x2fea('0x1b')]?{'message':_0x2fea('0x71'),'statusCode':_0x74fe56['statusCode']}:_0x74fe56);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ccfe0fe..f7d3922 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 _0x8af6=['rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x11f418,_0x16283a){var _0x5d7f70=function(_0x24ba86){while(--_0x24ba86){_0x11f418['push'](_0x11f418['shift']());}};_0x5d7f70(++_0x16283a);}(_0x8af6,0x76));var _0x68af=function(_0x2cddcc,_0x19f824){_0x2cddcc=_0x2cddcc-0x0;var _0x2653a2=_0x8af6[_0x2cddcc];return _0x2653a2;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var logger=require(_0x68af('0x2'))(_0x68af('0x3'));var moment=require(_0x68af('0x4'));var BPromise=require(_0x68af('0x5'));var rp=require(_0x68af('0x6'));var fs=require('fs');var path=require(_0x68af('0x7'));var rimraf=require(_0x68af('0x8'));var config=require(_0x68af('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x68af('0xa'));module['exports']=function(_0x36e91a,_0x2be0c1){return _0x36e91a[_0x68af('0xb')](_0x68af('0xc'),attributes,{'tableName':_0x68af('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b19=['define','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6b19,0xf4));var _0x96b1=function(_0x38c014,_0x4d2e00){_0x38c014=_0x38c014-0x0;var _0x452c11=_0x6b19[_0x38c014];return _0x452c11;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var logger=require(_0x96b1('0x1'))(_0x96b1('0x2'));var moment=require('moment');var BPromise=require(_0x96b1('0x3'));var rp=require(_0x96b1('0x4'));var fs=require('fs');var path=require(_0x96b1('0x5'));var rimraf=require(_0x96b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x96b1('0x7'));var integrations=require(_0x96b1('0x8'));module['exports']=function(_0x5e55b7,_0x288d77){return _0x5e55b7[_0x96b1('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x96b1('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 5a48cb9..cc937b4 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 _0x457b=['../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','options','raw','where','limit','include','map','attributes','model','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1c3c8e,_0x487729){var _0x1776ad=function(_0x50f66d){while(--_0x50f66d){_0x1c3c8e['push'](_0x1c3c8e['shift']());}};_0x1776ad(++_0x487729);}(_0x457b,0xca));var _0xb457=function(_0xc3f3bd,_0x20b7f5){_0xc3f3bd=_0xc3f3bd-0x0;var _0x27d0bd=_0x457b[_0xc3f3bd];return _0x27d0bd;};'use strict';var _=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var moment=require('moment');var BPromise=require(_0xb457('0x2'));var rs=require(_0xb457('0x3'));var fs=require('fs');var Redis=require(_0xb457('0x4'));var db=require(_0xb457('0x5'))['db'];var utils=require(_0xb457('0x6'));var logger=require('../../config/logger')(_0xb457('0x7'));var config=require(_0xb457('0x8'));var jayson=require(_0xb457('0x9'));var client=jayson[_0xb457('0xa')][_0xb457('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x523e05,_0x5b8ba2,_0x13632b){return new BPromise(function(_0x2182d6,_0x48388c){return client['request'](_0x523e05,_0x13632b)[_0xb457('0xc')](function(_0x3baee8){logger[_0xb457('0xd')](_0xb457('0xe'),_0x5b8ba2,_0xb457('0xf'));logger[_0xb457('0x10')](_0xb457('0x11'),_0x5b8ba2,_0xb457('0xf'),JSON[_0xb457('0x12')](_0x3baee8));if(_0x3baee8[_0xb457('0x13')]){if(_0x3baee8[_0xb457('0x13')][_0xb457('0x14')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5b8ba2,_0x3baee8[_0xb457('0x13')][_0xb457('0x15')]);return _0x48388c(_0x3baee8[_0xb457('0x13')][_0xb457('0x15')]);}logger[_0xb457('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x5b8ba2,_0x3baee8['error'][_0xb457('0x15')]);return _0x2182d6(_0x3baee8[_0xb457('0x13')][_0xb457('0x15')]);}else{logger[_0xb457('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x5b8ba2,_0xb457('0xf'));_0x2182d6(_0x3baee8[_0xb457('0x16')][_0xb457('0x15')]);}})[_0xb457('0x17')](function(_0x250a02){logger[_0xb457('0x13')](_0xb457('0xe'),_0x5b8ba2,_0x250a02);_0x48388c(_0x250a02);});});}exports[_0xb457('0x18')]=function(_0x54903c){var _0x37fd30=this;return new Promise(function(_0x3218f1,_0x12f888){return db['FreshsalesAccount']['findAll']({'raw':_0x54903c[_0xb457('0x19')]?_0x54903c[_0xb457('0x19')][_0xb457('0x1a')]===undefined?!![]:![]:!![],'where':_0x54903c[_0xb457('0x19')]?_0x54903c[_0xb457('0x19')][_0xb457('0x1b')]||null:null,'attributes':_0x54903c[_0xb457('0x19')]?_0x54903c['options']['attributes']||null:null,'limit':_0x54903c[_0xb457('0x19')]?_0x54903c[_0xb457('0x19')][_0xb457('0x1c')]||null:null,'include':_0x54903c['options']?_0x54903c[_0xb457('0x19')][_0xb457('0x1d')]?_[_0xb457('0x1e')](_0x54903c['options']['include'],function(_0x3d8a07){return{'model':db[_0x3d8a07['model']],'as':_0x3d8a07['as'],'attributes':_0x3d8a07[_0xb457('0x1f')],'include':_0x3d8a07[_0xb457('0x1d')]?_[_0xb457('0x1e')](_0x3d8a07[_0xb457('0x1d')],function(_0x557f03){return{'model':db[_0x557f03[_0xb457('0x20')]],'as':_0x557f03['as'],'attributes':_0x557f03[_0xb457('0x1f')],'include':_0x557f03['include']?_[_0xb457('0x1e')](_0x557f03[_0xb457('0x1d')],function(_0x17014b){return{'model':db[_0x17014b[_0xb457('0x20')]],'as':_0x17014b['as'],'attributes':_0x17014b[_0xb457('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb457('0xc')](function(_0x17c398){logger['info'](_0xb457('0x18'),_0x54903c);logger[_0xb457('0x10')]('GetFreshsalesAccount',_0x54903c,JSON[_0xb457('0x12')](_0x17c398));_0x3218f1(_0x17c398);})[_0xb457('0x17')](function(_0x48ba9f){logger[_0xb457('0x13')](_0xb457('0x18'),_0x48ba9f['message'],_0x54903c);_0x12f888(_0x37fd30[_0xb457('0x13')](0x1f4,_0x48ba9f['message']));});});};exports[_0xb457('0x21')]=function(_0x145b88){var _0x4a20f1=this;return new Promise(function(_0x41bb3c,_0x2e2bb6){return db['FreshsalesAccount'][_0xb457('0x22')]({'raw':_0x145b88['options']?_0x145b88[_0xb457('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x145b88[_0xb457('0x19')]?_0x145b88[_0xb457('0x19')]['where']||null:null,'attributes':_0x145b88[_0xb457('0x19')]?_0x145b88[_0xb457('0x19')][_0xb457('0x1f')]||null:null,'include':_0x145b88[_0xb457('0x19')]?_0x145b88['options'][_0xb457('0x1d')]?_[_0xb457('0x1e')](_0x145b88[_0xb457('0x19')][_0xb457('0x1d')],function(_0x1b4bc2){return{'model':db[_0x1b4bc2[_0xb457('0x20')]],'as':_0x1b4bc2['as'],'attributes':_0x1b4bc2['attributes'],'include':_0x1b4bc2[_0xb457('0x1d')]?_[_0xb457('0x1e')](_0x1b4bc2[_0xb457('0x1d')],function(_0xfebcfa){return{'model':db[_0xfebcfa[_0xb457('0x20')]],'as':_0xfebcfa['as'],'attributes':_0xfebcfa['attributes'],'include':_0xfebcfa['include']?_[_0xb457('0x1e')](_0xfebcfa['include'],function(_0x2ae40b){return{'model':db[_0x2ae40b[_0xb457('0x20')]],'as':_0x2ae40b['as'],'attributes':_0x2ae40b[_0xb457('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb457('0xc')](function(_0x453896){logger[_0xb457('0xd')](_0xb457('0x21'),_0x145b88);logger['debug']('ShowFreshsalesAccount',_0x145b88,JSON[_0xb457('0x12')](_0x453896));_0x41bb3c(_0x453896);})[_0xb457('0x17')](function(_0x4b07fc){logger[_0xb457('0x13')](_0xb457('0x21'),_0x4b07fc[_0xb457('0x15')],_0x145b88);_0x2e2bb6(_0x4a20f1[_0xb457('0x13')](0x1f4,_0x4b07fc[_0xb457('0x15')]));});});}; \ No newline at end of file +var _0x4c4a=['then','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x2291a9,_0x207ecb){var _0x161402=function(_0x554084){while(--_0x554084){_0x2291a9['push'](_0x2291a9['shift']());}};_0x161402(++_0x207ecb);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x277aae,_0x7462b4){_0x277aae=_0x277aae-0x0;var _0x315d36=_0x4c4a[_0x277aae];return _0x315d36;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var moment=require(_0xa4c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4c4('0x3'));var fs=require('fs');var Redis=require(_0xa4c4('0x4'));var db=require(_0xa4c4('0x5'))['db'];var utils=require(_0xa4c4('0x6'));var logger=require('../../config/logger')(_0xa4c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4c4('0x8'));var client=jayson[_0xa4c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x557596,_0x11b498,_0x553525){return new BPromise(function(_0x27b877,_0x118d89){return client[_0xa4c4('0xa')](_0x557596,_0x553525)['then'](function(_0x5ec64c){logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));logger[_0xa4c4('0xe')](_0xa4c4('0xf'),_0x11b498,'request\x20sent',JSON[_0xa4c4('0x10')](_0x5ec64c));if(_0x5ec64c['error']){if(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x12')]===0x1f4){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x118d89(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}logger[_0xa4c4('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x27b877(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}else{logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));_0x27b877(_0x5ec64c['result'][_0xa4c4('0x13')]);}})[_0xa4c4('0x14')](function(_0x4b2f2d){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x4b2f2d);_0x118d89(_0x4b2f2d);});});}exports[_0xa4c4('0x15')]=function(_0x5f5ef){var _0x3f2fce=this;return new Promise(function(_0x40661e,_0x3674b1){return db[_0xa4c4('0x16')][_0xa4c4('0x17')]({'raw':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x19')]===undefined?!![]:![]:!![],'where':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1a')]||null:null,'attributes':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1b')]||null:null,'limit':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef['options']['limit']||null:null,'include':_0x5f5ef[_0xa4c4('0x18')]?_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x5f5ef[_0xa4c4('0x18')][_0xa4c4('0x1c')],function(_0x5f1215){return{'model':db[_0x5f1215['model']],'as':_0x5f1215['as'],'attributes':_0x5f1215['attributes'],'include':_0x5f1215[_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x5f1215[_0xa4c4('0x1c')],function(_0x50bb08){return{'model':db[_0x50bb08[_0xa4c4('0x1e')]],'as':_0x50bb08['as'],'attributes':_0x50bb08[_0xa4c4('0x1b')],'include':_0x50bb08[_0xa4c4('0x1c')]?_['map'](_0x50bb08[_0xa4c4('0x1c')],function(_0xfa33ec){return{'model':db[_0xfa33ec[_0xa4c4('0x1e')]],'as':_0xfa33ec['as'],'attributes':_0xfa33ec[_0xa4c4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa4c4('0x1f')](function(_0x51d5fa){logger[_0xa4c4('0xb')](_0xa4c4('0x15'),_0x5f5ef);logger[_0xa4c4('0xe')](_0xa4c4('0x15'),_0x5f5ef,JSON[_0xa4c4('0x10')](_0x51d5fa));_0x40661e(_0x51d5fa);})['catch'](function(_0x32af71){logger['error']('GetFreshsalesAccount',_0x32af71['message'],_0x5f5ef);_0x3674b1(_0x3f2fce['error'](0x1f4,_0x32af71[_0xa4c4('0x13')]));});});};exports[_0xa4c4('0x20')]=function(_0x2456f6){var _0x26d239=this;return new Promise(function(_0x136b30,_0x4f126b){return db['FreshsalesAccount']['find']({'raw':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')]['where']||null:null,'attributes':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')]['attributes']||null:null,'include':_0x2456f6[_0xa4c4('0x18')]?_0x2456f6[_0xa4c4('0x18')][_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x2456f6[_0xa4c4('0x18')][_0xa4c4('0x1c')],function(_0x4ec09f){return{'model':db[_0x4ec09f[_0xa4c4('0x1e')]],'as':_0x4ec09f['as'],'attributes':_0x4ec09f[_0xa4c4('0x1b')],'include':_0x4ec09f[_0xa4c4('0x1c')]?_[_0xa4c4('0x1d')](_0x4ec09f[_0xa4c4('0x1c')],function(_0x33c218){return{'model':db[_0x33c218[_0xa4c4('0x1e')]],'as':_0x33c218['as'],'attributes':_0x33c218[_0xa4c4('0x1b')],'include':_0x33c218['include']?_[_0xa4c4('0x1d')](_0x33c218['include'],function(_0x1afcce){return{'model':db[_0x1afcce[_0xa4c4('0x1e')]],'as':_0x1afcce['as'],'attributes':_0x1afcce['attributes']};}):[]};}):[]};}):[]:[]})[_0xa4c4('0x1f')](function(_0x2a4dfa){logger[_0xa4c4('0xb')](_0xa4c4('0x20'),_0x2456f6);logger[_0xa4c4('0xe')](_0xa4c4('0x20'),_0x2456f6,JSON['stringify'](_0x2a4dfa));_0x136b30(_0x2a4dfa);})[_0xa4c4('0x14')](function(_0x2be4e1){logger['error'](_0xa4c4('0x20'),_0x2be4e1[_0xa4c4('0x13')],_0x2456f6);_0x4f126b(_0x26d239[_0xa4c4('0x11')](0x1f4,_0x2be4e1[_0xa4c4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 60ce960..7b40ef1 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 _0xe1ac=['express','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','create','put','update','destroy','multer','util','path'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xe1ac,0x1d8));var _0xce1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe1ac[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xce1a('0x0'));var util=require(_0xce1a('0x1'));var path=require(_0xce1a('0x2'));var timeout=require('connect-timeout');var express=require(_0xce1a('0x3'));var router=express['Router']();var auth=require(_0xce1a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xce1a('0x5')]('/',auth[_0xce1a('0x6')](),controller[_0xce1a('0x7')]);router[_0xce1a('0x5')](_0xce1a('0x8'),auth[_0xce1a('0x6')](),controller[_0xce1a('0x9')]);router['get'](_0xce1a('0xa'),auth[_0xce1a('0x6')](),controller[_0xce1a('0xb')]);router[_0xce1a('0x5')](_0xce1a('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xce1a('0x5')](_0xce1a('0xd'),auth[_0xce1a('0x6')](),controller['getFields']);router[_0xce1a('0xe')]('/',auth['isAuthenticated'](),controller[_0xce1a('0xf')]);router[_0xce1a('0x10')](_0xce1a('0x8'),auth['isAuthenticated'](),controller[_0xce1a('0x11')]);router['delete'](_0xce1a('0x8'),auth[_0xce1a('0x6')](),controller[_0xce1a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4c94=['get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0x4c94,0xf6));var _0x44c9=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x4c94[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require('multer');var util=require(_0x44c9('0x0'));var path=require('path');var timeout=require(_0x44c9('0x1'));var express=require(_0x44c9('0x2'));var router=express[_0x44c9('0x3')]();var auth=require(_0x44c9('0x4'));var interaction=require(_0x44c9('0x5'));var config=require('../../config/environment');var controller=require(_0x44c9('0x6'));router[_0x44c9('0x7')]('/',auth[_0x44c9('0x8')](),controller[_0x44c9('0x9')]);router['get']('/:id',auth[_0x44c9('0x8')](),controller[_0x44c9('0xa')]);router[_0x44c9('0x7')](_0x44c9('0xb'),auth[_0x44c9('0x8')](),controller[_0x44c9('0xc')]);router[_0x44c9('0x7')](_0x44c9('0xd'),auth[_0x44c9('0x8')](),controller[_0x44c9('0xe')]);router[_0x44c9('0x7')](_0x44c9('0xf'),auth[_0x44c9('0x8')](),controller['getFields']);router[_0x44c9('0x10')]('/',auth[_0x44c9('0x8')](),controller['create']);router[_0x44c9('0x11')](_0x44c9('0x12'),auth['isAuthenticated'](),controller[_0x44c9('0x13')]);router[_0x44c9('0x14')](_0x44c9('0x12'),auth[_0x44c9('0x8')](),controller[_0x44c9('0x15')]);module[_0x44c9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2fc68b1..1f9b8d1 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 _0x91f3=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91f3,0x117));var _0x391f=function(_0x7728f0,_0x3c406a){_0x7728f0=_0x7728f0-0x0;var _0x1b1d71=_0x91f3[_0x7728f0];return _0x1b1d71;};'use strict';var Sequelize=require(_0x391f('0x0'));module[_0x391f('0x1')]={'name':{'type':Sequelize[_0x391f('0x2')]},'description':{'type':Sequelize[_0x391f('0x2')]}}; \ No newline at end of file +var _0xd7e7=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7e7,0x9c));var _0x7d7e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd7e7[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x7d7e('0x0'));module[_0x7d7e('0x1')]={'name':{'type':Sequelize[_0x7d7e('0x2')]},'description':{'type':Sequelize[_0x7d7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b950136..691eec3 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 _0x3483=['model','attributes','fields','length','nolimit','order','sort','where','pick','filter','name','merge','findAll','rows','show','params','keys','includeAll','include','options','body','find','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','hasOwnProperty','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection'];(function(_0x22d70b,_0x29be5c){var _0x36a2c7=function(_0x515e10){while(--_0x515e10){_0x22d70b['push'](_0x22d70b['shift']());}};_0x36a2c7(++_0x29be5c);}(_0x3483,0x12b));var _0x3348=function(_0x1a7754,_0xf47bc4){_0x1a7754=_0x1a7754-0x0;var _0x1f839e=_0x3483[_0x1a7754];return _0x1f839e;};'use strict';var pdf=require(_0x3348('0x0'));var emlformat=require(_0x3348('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3348('0x2'));var jsonpatch=require(_0x3348('0x3'));var rp=require('request-promise');var moment=require(_0x3348('0x4'));var BPromise=require(_0x3348('0x5'));var Mustache=require(_0x3348('0x6'));var util=require(_0x3348('0x7'));var path=require(_0x3348('0x8'));var sox=require(_0x3348('0x9'));var csv=require(_0x3348('0xa'));var ejs=require(_0x3348('0xb'));var fs=require('fs');var _=require(_0x3348('0xc'));var squel=require(_0x3348('0xd'));var crypto=require(_0x3348('0xe'));var jsforce=require(_0x3348('0xf'));var deskjs=require(_0x3348('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3348('0x11'));var as=require(_0x3348('0x12'));var hardwareService=require(_0x3348('0x13'));var logger=require('../../config/logger')(_0x3348('0x14'));var utils=require(_0x3348('0x15'));var config=require(_0x3348('0x16'));var db=require(_0x3348('0x17'))['db'];var jayson=require(_0x3348('0x18'));var client=jayson[_0x3348('0x19')][_0x3348('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x399b92,_0x46f9c0,_0x13f2b4){if(_0x13f2b4){var _0x389b79=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x389b79['test'](_0x46f9c0)){return _0x399b92;}else{throw new db[(_0x3348('0x1b'))]['ValidationError'](_0x3348('0x1c'));}}else{return _0x399b92;}}function respondWithRpcPromise(_0x437649,_0x275324,_0x47722e,_0x5a3078){return new BPromise(function(_0x3926de,_0x2551df){var _0x1cf7cc=_0x5a3078||client;return _0x1cf7cc[_0x3348('0x1d')](_0x437649,_0x47722e)[_0x3348('0x1e')](function(_0x372a5a){logger['info'](_0x3348('0x1f'),_0x275324,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x275324,_0x3348('0x20'),JSON[_0x3348('0x21')](_0x372a5a));if(_0x372a5a[_0x3348('0x22')]){if(_0x372a5a[_0x3348('0x22')][_0x3348('0x23')]===0x1f4){logger[_0x3348('0x22')](_0x3348('0x1f'),_0x275324,_0x372a5a[_0x3348('0x22')][_0x3348('0x24')]);return _0x2551df(_0x372a5a[_0x3348('0x22')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x275324,_0x372a5a[_0x3348('0x22')][_0x3348('0x24')]);return _0x3926de(_0x372a5a[_0x3348('0x22')]['message']);}else{logger[_0x3348('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x275324,_0x3348('0x20'));_0x3926de(_0x372a5a[_0x3348('0x26')][_0x3348('0x24')]);}})[_0x3348('0x27')](function(_0x2a342b){logger[_0x3348('0x22')](_0x3348('0x1f'),_0x275324,_0x2a342b);_0x2551df(_0x2a342b);});});}function respondWithStatusCode(_0x47278c,_0x2e5490){_0x2e5490=_0x2e5490||0xcc;return function(_0x11fe93){if(_0x11fe93){return _0x47278c[_0x3348('0x28')](_0x2e5490);}return _0x47278c[_0x3348('0x29')](_0x2e5490)[_0x3348('0x2a')]();};}function respondWithResult(_0x407bc5,_0x595871){_0x595871=_0x595871||0xc8;return function(_0x2dff05){if(_0x2dff05){return _0x407bc5[_0x3348('0x29')](_0x595871)['json'](_0x2dff05);}};}function respondWithFilteredResult(_0x4d8794,_0x2bccc8){return function(_0x7edb33){if(_0x7edb33){var _0x35f711=_0x7edb33[_0x3348('0x2b')],_0x1a2e28=_0x2bccc8[_0x3348('0x2c')],_0x21fbca=_0x2bccc8[_0x3348('0x2c')]+_0x2bccc8[_0x3348('0x2d')],_0x12578f;if(_0x21fbca>=_0x35f711){_0x21fbca=_0x35f711;_0x12578f=0xc8;}else{_0x12578f=0xce;}_0x4d8794[_0x3348('0x29')](_0x12578f);return _0x4d8794[_0x3348('0x2e')](_0x3348('0x2f'),_0x1a2e28+'-'+_0x21fbca+'/'+_0x35f711)['json'](_0x7edb33);}return null;};}function patchUpdates(_0x489119){return function(_0x5b61a9){try{jsonpatch['apply'](_0x5b61a9,_0x489119,!![]);}catch(_0x181310){return BPromise[_0x3348('0x30')](_0x181310);}return _0x5b61a9[_0x3348('0x31')]();};}function saveUpdates(_0x63c97a,_0x4249ad){return function(_0x4dd2d7){if(_0x4dd2d7){return _0x4dd2d7[_0x3348('0x32')](_0x63c97a)['then'](function(_0x2ab105){return _0x2ab105;});}return null;};}function removeEntity(_0x556779,_0x3d6f5b){return function(_0x53aaac){if(_0x53aaac){return _0x53aaac['destroy']()[_0x3348('0x1e')](function(){_0x556779[_0x3348('0x29')](0xcc)[_0x3348('0x2a')]();});}};}function handleEntityNotFound(_0x40f151,_0x37dc89){return function(_0x35002d){if(!_0x35002d){_0x40f151[_0x3348('0x28')](0x194);}return _0x35002d;};}function handleError(_0x2309f5,_0x1af3b0){_0x1af3b0=_0x1af3b0||0x1f4;return function(_0x300ce3){logger[_0x3348('0x22')](_0x300ce3['stack']);if(_0x300ce3['name']){delete _0x300ce3['name'];}_0x2309f5[_0x3348('0x29')](_0x1af3b0)['send'](_0x300ce3);};}exports[_0x3348('0x33')]=function(_0x9a3e6b,_0x4e3d5d){var _0x9777cf={},_0x479cf5={},_0x266c28={'count':0x0,'rows':[]};var _0x2afba5=_[_0x3348('0x34')](db[_0x3348('0x35')][_0x3348('0x36')],function(_0x184ed5){return{'name':_0x184ed5[_0x3348('0x37')],'type':_0x184ed5[_0x3348('0x38')][_0x3348('0x39')]};});_0x479cf5['model']=_[_0x3348('0x34')](_0x2afba5,'name');_0x479cf5[_0x3348('0x3a')]=_['keys'](_0x9a3e6b['query']);_0x479cf5[_0x3348('0x3b')]=_[_0x3348('0x3c')](_0x479cf5[_0x3348('0x3d')],_0x479cf5[_0x3348('0x3a')]);_0x9777cf[_0x3348('0x3e')]=_[_0x3348('0x3c')](_0x479cf5[_0x3348('0x3d')],qs['fields'](_0x9a3e6b[_0x3348('0x3a')][_0x3348('0x3f')]));_0x9777cf[_0x3348('0x3e')]=_0x9777cf[_0x3348('0x3e')][_0x3348('0x40')]?_0x9777cf[_0x3348('0x3e')]:_0x479cf5[_0x3348('0x3d')];if(!_0x9a3e6b[_0x3348('0x3a')]['hasOwnProperty'](_0x3348('0x41'))){_0x9777cf['limit']=qs['limit'](_0x9a3e6b[_0x3348('0x3a')][_0x3348('0x2d')]);_0x9777cf[_0x3348('0x2c')]=qs['offset'](_0x9a3e6b[_0x3348('0x3a')][_0x3348('0x2c')]);}_0x9777cf[_0x3348('0x42')]=qs[_0x3348('0x43')](_0x9a3e6b[_0x3348('0x3a')][_0x3348('0x43')]);_0x9777cf[_0x3348('0x44')]=qs[_0x3348('0x3b')](_[_0x3348('0x45')](_0x9a3e6b[_0x3348('0x3a')],_0x479cf5[_0x3348('0x3b')]),_0x2afba5);if(_0x9a3e6b[_0x3348('0x3a')][_0x3348('0x46')]){_0x9777cf['where']=_['merge'](_0x9777cf['where'],{'$or':_[_0x3348('0x34')](_0x2afba5,function(_0x3c7ccd){if(_0x3c7ccd[_0x3348('0x38')]!=='VIRTUAL'){var _0x384fc1={};_0x384fc1[_0x3c7ccd[_0x3348('0x47')]]={'$like':'%'+_0x9a3e6b[_0x3348('0x3a')][_0x3348('0x46')]+'%'};return _0x384fc1;}})});}_0x9777cf=_[_0x3348('0x48')]({},_0x9777cf,_0x9a3e6b['options']);var _0x96abea={'where':_0x9777cf['where']};return db[_0x3348('0x35')][_0x3348('0x2b')](_0x96abea)[_0x3348('0x1e')](function(_0x1f45d2){_0x266c28[_0x3348('0x2b')]=_0x1f45d2;if(_0x9a3e6b[_0x3348('0x3a')]['includeAll']){_0x9777cf['include']=[{'all':!![]}];}return db[_0x3348('0x35')][_0x3348('0x49')](_0x9777cf);})['then'](function(_0xd98458){_0x266c28[_0x3348('0x4a')]=_0xd98458;return _0x266c28;})[_0x3348('0x1e')](respondWithFilteredResult(_0x4e3d5d,_0x9777cf))['catch'](handleError(_0x4e3d5d,null));};exports[_0x3348('0x4b')]=function(_0x1708ba,_0x3d3899){var _0x3bfaa2={'raw':![],'where':{'id':_0x1708ba[_0x3348('0x4c')]['id']}},_0x16af11={};_0x16af11[_0x3348('0x3d')]=_[_0x3348('0x4d')](db[_0x3348('0x35')][_0x3348('0x36')]);_0x16af11[_0x3348('0x3a')]=_[_0x3348('0x4d')](_0x1708ba['query']);_0x16af11[_0x3348('0x3b')]=_['intersection'](_0x16af11[_0x3348('0x3d')],_0x16af11[_0x3348('0x3a')]);_0x3bfaa2[_0x3348('0x3e')]=_['intersection'](_0x16af11[_0x3348('0x3d')],qs[_0x3348('0x3f')](_0x1708ba[_0x3348('0x3a')][_0x3348('0x3f')]));_0x3bfaa2['attributes']=_0x3bfaa2[_0x3348('0x3e')]['length']?_0x3bfaa2[_0x3348('0x3e')]:_0x16af11['model'];if(_0x1708ba[_0x3348('0x3a')][_0x3348('0x4e')]){_0x3bfaa2[_0x3348('0x4f')]=[{'all':!![]}];}_0x3bfaa2=_[_0x3348('0x48')]({},_0x3bfaa2,_0x1708ba[_0x3348('0x50')]);return db[_0x3348('0x35')]['find'](_0x3bfaa2)['then'](handleEntityNotFound(_0x3d3899,null))['then'](respondWithResult(_0x3d3899,null))[_0x3348('0x27')](handleError(_0x3d3899,null));};exports['create']=function(_0x23486c,_0x5ca718){return db[_0x3348('0x35')]['create'](_0x23486c[_0x3348('0x51')],{})[_0x3348('0x1e')](respondWithResult(_0x5ca718,0xc9))[_0x3348('0x27')](handleError(_0x5ca718,null));};exports[_0x3348('0x32')]=function(_0xf6efdf,_0x591cb5){if(_0xf6efdf[_0x3348('0x51')]['id']){delete _0xf6efdf[_0x3348('0x51')]['id'];}return db[_0x3348('0x35')][_0x3348('0x52')]({'where':{'id':_0xf6efdf[_0x3348('0x4c')]['id']}})[_0x3348('0x1e')](handleEntityNotFound(_0x591cb5,null))['then'](saveUpdates(_0xf6efdf['body'],null))['then'](respondWithResult(_0x591cb5,null))[_0x3348('0x27')](handleError(_0x591cb5,null));};exports[_0x3348('0x53')]=function(_0x5e319b,_0x378488){return db[_0x3348('0x35')][_0x3348('0x52')]({'where':{'id':_0x5e319b['params']['id']}})[_0x3348('0x1e')](handleEntityNotFound(_0x378488,null))[_0x3348('0x1e')](removeEntity(_0x378488,null))['catch'](handleError(_0x378488,null));};exports[_0x3348('0x54')]=function(_0x4af873,_0x5a6e51,_0x481de2){var _0x62899c={};var _0x79f583={};var _0x508154;var _0x24bb95;return db[_0x3348('0x35')][_0x3348('0x55')]({'where':{'id':_0x4af873[_0x3348('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a6e51,null))[_0x3348('0x1e')](function(_0x450022){if(_0x450022){_0x508154=_0x450022;_0x79f583[_0x3348('0x3d')]=_['keys'](db[_0x3348('0x56')][_0x3348('0x36')]);_0x79f583[_0x3348('0x3a')]=_['keys'](_0x4af873[_0x3348('0x3a')]);_0x79f583[_0x3348('0x3b')]=_['intersection'](_0x79f583[_0x3348('0x3d')],_0x79f583['query']);_0x62899c['attributes']=_[_0x3348('0x3c')](_0x79f583[_0x3348('0x3d')],qs['fields'](_0x4af873[_0x3348('0x3a')][_0x3348('0x3f')]));_0x62899c['attributes']=_0x62899c[_0x3348('0x3e')][_0x3348('0x40')]?_0x62899c[_0x3348('0x3e')]:_0x79f583[_0x3348('0x3d')];_0x62899c['order']=qs[_0x3348('0x43')](_0x4af873[_0x3348('0x3a')][_0x3348('0x43')]);_0x62899c[_0x3348('0x44')]=qs[_0x3348('0x3b')](_[_0x3348('0x45')](_0x4af873[_0x3348('0x3a')],_0x79f583[_0x3348('0x3b')]));if(_0x4af873[_0x3348('0x3a')][_0x3348('0x46')]){_0x62899c[_0x3348('0x44')]=_[_0x3348('0x48')](_0x62899c[_0x3348('0x44')],{'$or':_[_0x3348('0x34')](_0x62899c[_0x3348('0x3e')],function(_0x24f9bc){var _0x2fda9c={};_0x2fda9c[_0x24f9bc]={'$like':'%'+_0x4af873['query'][_0x3348('0x46')]+'%'};return _0x2fda9c;})});}_0x62899c=_['merge']({},_0x62899c,_0x4af873['options']);return _0x508154[_0x3348('0x54')](_0x62899c);}})[_0x3348('0x1e')](function(_0x19aceb){if(_0x19aceb){_0x24bb95=_0x19aceb[_0x3348('0x40')];if(!_0x4af873['query']['hasOwnProperty'](_0x3348('0x41'))){_0x62899c[_0x3348('0x2d')]=qs[_0x3348('0x2d')](_0x4af873[_0x3348('0x3a')][_0x3348('0x2d')]);_0x62899c['offset']=qs[_0x3348('0x2c')](_0x4af873[_0x3348('0x3a')][_0x3348('0x2c')]);}return _0x508154[_0x3348('0x54')](_0x62899c);}})[_0x3348('0x1e')](function(_0x4e64bf){if(_0x4e64bf){return _0x4e64bf?{'count':_0x24bb95,'rows':_0x4e64bf}:null;}})[_0x3348('0x1e')](respondWithResult(_0x5a6e51,null))[_0x3348('0x27')](handleError(_0x5a6e51,null));};exports['getDescriptions']=function(_0xa77111,_0x1f1a5e,_0x35e624){var _0x5dda89={};var _0x4b7842={};var _0x58a2ba;var _0x4afbd0;return db['FreshsalesConfiguration'][_0x3348('0x55')]({'where':{'id':_0xa77111[_0x3348('0x4c')]['id']}})[_0x3348('0x1e')](handleEntityNotFound(_0x1f1a5e,null))[_0x3348('0x1e')](function(_0x14ddc2){if(_0x14ddc2){_0x58a2ba=_0x14ddc2;_0x4b7842[_0x3348('0x3d')]=_[_0x3348('0x4d')](db[_0x3348('0x56')][_0x3348('0x36')]);_0x4b7842[_0x3348('0x3a')]=_[_0x3348('0x4d')](_0xa77111[_0x3348('0x3a')]);_0x4b7842[_0x3348('0x3b')]=_[_0x3348('0x3c')](_0x4b7842['model'],_0x4b7842[_0x3348('0x3a')]);_0x5dda89['attributes']=_['intersection'](_0x4b7842[_0x3348('0x3d')],qs[_0x3348('0x3f')](_0xa77111[_0x3348('0x3a')]['fields']));_0x5dda89[_0x3348('0x3e')]=_0x5dda89['attributes']['length']?_0x5dda89[_0x3348('0x3e')]:_0x4b7842[_0x3348('0x3d')];_0x5dda89[_0x3348('0x42')]=qs[_0x3348('0x43')](_0xa77111[_0x3348('0x3a')][_0x3348('0x43')]);_0x5dda89[_0x3348('0x44')]=qs[_0x3348('0x3b')](_[_0x3348('0x45')](_0xa77111[_0x3348('0x3a')],_0x4b7842['filters']));if(_0xa77111[_0x3348('0x3a')]['filter']){_0x5dda89['where']=_['merge'](_0x5dda89[_0x3348('0x44')],{'$or':_['map'](_0x5dda89[_0x3348('0x3e')],function(_0x27778d){var _0x2a5eac={};_0x2a5eac[_0x27778d]={'$like':'%'+_0xa77111[_0x3348('0x3a')][_0x3348('0x46')]+'%'};return _0x2a5eac;})});}_0x5dda89=_['merge']({},_0x5dda89,_0xa77111[_0x3348('0x50')]);return _0x58a2ba[_0x3348('0x57')](_0x5dda89);}})[_0x3348('0x1e')](function(_0x1053a7){if(_0x1053a7){_0x4afbd0=_0x1053a7[_0x3348('0x40')];if(!_0xa77111[_0x3348('0x3a')][_0x3348('0x58')](_0x3348('0x41'))){_0x5dda89['limit']=qs[_0x3348('0x2d')](_0xa77111[_0x3348('0x3a')][_0x3348('0x2d')]);_0x5dda89[_0x3348('0x2c')]=qs[_0x3348('0x2c')](_0xa77111[_0x3348('0x3a')][_0x3348('0x2c')]);}return _0x58a2ba[_0x3348('0x57')](_0x5dda89);}})[_0x3348('0x1e')](function(_0x576716){if(_0x576716){return _0x576716?{'count':_0x4afbd0,'rows':_0x576716}:null;}})[_0x3348('0x1e')](respondWithResult(_0x1f1a5e,null))[_0x3348('0x27')](handleError(_0x1f1a5e,null));};exports[_0x3348('0x59')]=function(_0x2c9243,_0x32605e,_0x2c249f){var _0x51a14b={};var _0x50ee30={};var _0x1c0ad;var _0x28f8c5;return db[_0x3348('0x35')][_0x3348('0x55')]({'where':{'id':_0x2c9243[_0x3348('0x4c')]['id']}})[_0x3348('0x1e')](handleEntityNotFound(_0x32605e,null))[_0x3348('0x1e')](function(_0x3cee96){if(_0x3cee96){_0x1c0ad=_0x3cee96;_0x50ee30[_0x3348('0x3d')]=_[_0x3348('0x4d')](db[_0x3348('0x56')][_0x3348('0x36')]);_0x50ee30[_0x3348('0x3a')]=_[_0x3348('0x4d')](_0x2c9243['query']);_0x50ee30[_0x3348('0x3b')]=_[_0x3348('0x3c')](_0x50ee30[_0x3348('0x3d')],_0x50ee30[_0x3348('0x3a')]);_0x51a14b['attributes']=_[_0x3348('0x3c')](_0x50ee30[_0x3348('0x3d')],qs['fields'](_0x2c9243[_0x3348('0x3a')][_0x3348('0x3f')]));_0x51a14b[_0x3348('0x3e')]=_0x51a14b[_0x3348('0x3e')]['length']?_0x51a14b[_0x3348('0x3e')]:_0x50ee30['model'];_0x51a14b['order']=qs[_0x3348('0x43')](_0x2c9243[_0x3348('0x3a')][_0x3348('0x43')]);_0x51a14b[_0x3348('0x44')]=qs[_0x3348('0x3b')](_[_0x3348('0x45')](_0x2c9243[_0x3348('0x3a')],_0x50ee30[_0x3348('0x3b')]));if(_0x2c9243[_0x3348('0x3a')][_0x3348('0x46')]){_0x51a14b['where']=_[_0x3348('0x48')](_0x51a14b[_0x3348('0x44')],{'$or':_['map'](_0x51a14b[_0x3348('0x3e')],function(_0xb7ffad){var _0xe23b05={};_0xe23b05[_0xb7ffad]={'$like':'%'+_0x2c9243['query'][_0x3348('0x46')]+'%'};return _0xe23b05;})});}_0x51a14b=_[_0x3348('0x48')]({},_0x51a14b,_0x2c9243[_0x3348('0x50')]);return _0x1c0ad[_0x3348('0x59')](_0x51a14b);}})[_0x3348('0x1e')](function(_0x3e823e){if(_0x3e823e){_0x28f8c5=_0x3e823e[_0x3348('0x40')];if(!_0x2c9243['query']['hasOwnProperty'](_0x3348('0x41'))){_0x51a14b[_0x3348('0x2d')]=qs[_0x3348('0x2d')](_0x2c9243[_0x3348('0x3a')]['limit']);_0x51a14b[_0x3348('0x2c')]=qs['offset'](_0x2c9243['query']['offset']);}return _0x1c0ad[_0x3348('0x59')](_0x51a14b);}})[_0x3348('0x1e')](function(_0x417dbd){if(_0x417dbd){return _0x417dbd?{'count':_0x28f8c5,'rows':_0x417dbd}:null;}})['then'](respondWithResult(_0x32605e,null))[_0x3348('0x27')](handleError(_0x32605e,null));}; \ No newline at end of file +var _0x020d=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getSubjects','findOne','order','getDescriptions','FreshsalesField','pick','getFields','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe4225a,_0x1f9ada){var _0x4fea5e=function(_0x2bf979){while(--_0x2bf979){_0xe4225a['push'](_0xe4225a['shift']());}};_0x4fea5e(++_0x1f9ada);}(_0x020d,0x1b1));var _0xd020=function(_0xdfd5d0,_0x3c7238){_0xdfd5d0=_0xdfd5d0-0x0;var _0x35dee0=_0x020d[_0xdfd5d0];return _0x35dee0;};'use strict';var pdf=require(_0xd020('0x0'));var emlformat=require(_0xd020('0x1'));var rimraf=require(_0xd020('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd020('0x3'));var rp=require(_0xd020('0x4'));var moment=require(_0xd020('0x5'));var BPromise=require(_0xd020('0x6'));var Mustache=require(_0xd020('0x7'));var util=require(_0xd020('0x8'));var path=require(_0xd020('0x9'));var sox=require(_0xd020('0xa'));var csv=require(_0xd020('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd020('0xc'));var squel=require(_0xd020('0xd'));var crypto=require(_0xd020('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd020('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd020('0xf'));var authService=require(_0xd020('0x10'));var qs=require(_0xd020('0x11'));var as=require(_0xd020('0x12'));var hardwareService=require(_0xd020('0x13'));var logger=require(_0xd020('0x14'))('api');var utils=require(_0xd020('0x15'));var config=require(_0xd020('0x16'));var db=require(_0xd020('0x17'))['db'];var jayson=require(_0xd020('0x18'));var client=jayson[_0xd020('0x19')][_0xd020('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2cf921,_0x16e8f4,_0x271705){if(_0x271705){var _0x28d0cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28d0cc[_0xd020('0x1b')](_0x16e8f4)){return _0x2cf921;}else{throw new db[(_0xd020('0x1c'))][(_0xd020('0x1d'))](_0xd020('0x1e'));}}else{return _0x2cf921;}}function respondWithRpcPromise(_0x275111,_0x21071b,_0x5d0e28,_0x187711){return new BPromise(function(_0x1187d6,_0x4a8021){var _0x3d3348=_0x187711||client;return _0x3d3348[_0xd020('0x1f')](_0x275111,_0x5d0e28)[_0xd020('0x20')](function(_0x257908){logger[_0xd020('0x21')](_0xd020('0x22'),_0x21071b,_0xd020('0x23'));logger[_0xd020('0x24')](_0xd020('0x25'),_0x21071b,_0xd020('0x23'),JSON[_0xd020('0x26')](_0x257908));if(_0x257908[_0xd020('0x27')]){if(_0x257908[_0xd020('0x27')]['code']===0x1f4){logger['error'](_0xd020('0x22'),_0x21071b,_0x257908[_0xd020('0x27')]['message']);return _0x4a8021(_0x257908['error'][_0xd020('0x28')]);}logger[_0xd020('0x27')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21071b,_0x257908[_0xd020('0x27')][_0xd020('0x28')]);return _0x1187d6(_0x257908[_0xd020('0x27')][_0xd020('0x28')]);}else{logger['info'](_0xd020('0x22'),_0x21071b,'request\x20sent');_0x1187d6(_0x257908[_0xd020('0x29')][_0xd020('0x28')]);}})['catch'](function(_0x4286b4){logger['error'](_0xd020('0x22'),_0x21071b,_0x4286b4);_0x4a8021(_0x4286b4);});});}function respondWithStatusCode(_0x4f61b7,_0x50735b){_0x50735b=_0x50735b||0xcc;return function(_0x4b517b){if(_0x4b517b){return _0x4f61b7['sendStatus'](_0x50735b);}return _0x4f61b7[_0xd020('0x2a')](_0x50735b)[_0xd020('0x2b')]();};}function respondWithResult(_0x59c275,_0x587095){_0x587095=_0x587095||0xc8;return function(_0x41a3ac){if(_0x41a3ac){return _0x59c275['status'](_0x587095)[_0xd020('0x2c')](_0x41a3ac);}};}function respondWithFilteredResult(_0x5e4b4e,_0x556e6e){return function(_0x5e1539){if(_0x5e1539){var _0x381663=_0x5e1539[_0xd020('0x2d')],_0x34f193=_0x556e6e['offset'],_0x301b0c=_0x556e6e[_0xd020('0x2e')]+_0x556e6e[_0xd020('0x2f')],_0x14d7f6;if(_0x301b0c>=_0x381663){_0x301b0c=_0x381663;_0x14d7f6=0xc8;}else{_0x14d7f6=0xce;}_0x5e4b4e[_0xd020('0x2a')](_0x14d7f6);return _0x5e4b4e[_0xd020('0x30')]('Content-Range',_0x34f193+'-'+_0x301b0c+'/'+_0x381663)[_0xd020('0x2c')](_0x5e1539);}return null;};}function patchUpdates(_0x5838ba){return function(_0x3e5323){try{jsonpatch[_0xd020('0x31')](_0x3e5323,_0x5838ba,!![]);}catch(_0x2e1493){return BPromise[_0xd020('0x32')](_0x2e1493);}return _0x3e5323[_0xd020('0x33')]();};}function saveUpdates(_0x5de103,_0x3923a0){return function(_0x57509c){if(_0x57509c){return _0x57509c[_0xd020('0x34')](_0x5de103)[_0xd020('0x20')](function(_0x543737){return _0x543737;});}return null;};}function removeEntity(_0x352708,_0x14bcf1){return function(_0x5b87c9){if(_0x5b87c9){return _0x5b87c9['destroy']()['then'](function(){_0x352708[_0xd020('0x2a')](0xcc)[_0xd020('0x2b')]();});}};}function handleEntityNotFound(_0xf3dca2,_0x5ba6b4){return function(_0x3a7cbd){if(!_0x3a7cbd){_0xf3dca2['sendStatus'](0x194);}return _0x3a7cbd;};}function handleError(_0x2592b3,_0x2b4b1d){_0x2b4b1d=_0x2b4b1d||0x1f4;return function(_0x58d9fb){logger[_0xd020('0x27')](_0x58d9fb[_0xd020('0x35')]);if(_0x58d9fb['name']){delete _0x58d9fb[_0xd020('0x36')];}_0x2592b3[_0xd020('0x2a')](_0x2b4b1d)[_0xd020('0x37')](_0x58d9fb);};}exports['index']=function(_0x5419a2,_0x206c36){var _0x3e7237={},_0x5d5d8c={},_0x22618a={'count':0x0,'rows':[]};var _0xc6c9a1=_[_0xd020('0x38')](db['FreshsalesConfiguration'][_0xd020('0x39')],function(_0x52d4b0){return{'name':_0x52d4b0[_0xd020('0x3a')],'type':_0x52d4b0[_0xd020('0x3b')]['key']};});_0x5d5d8c[_0xd020('0x3c')]=_[_0xd020('0x38')](_0xc6c9a1,_0xd020('0x36'));_0x5d5d8c[_0xd020('0x3d')]=_['keys'](_0x5419a2[_0xd020('0x3d')]);_0x5d5d8c['filters']=_[_0xd020('0x3e')](_0x5d5d8c[_0xd020('0x3c')],_0x5d5d8c[_0xd020('0x3d')]);_0x3e7237[_0xd020('0x3f')]=_['intersection'](_0x5d5d8c[_0xd020('0x3c')],qs[_0xd020('0x40')](_0x5419a2[_0xd020('0x3d')][_0xd020('0x40')]));_0x3e7237['attributes']=_0x3e7237[_0xd020('0x3f')][_0xd020('0x41')]?_0x3e7237[_0xd020('0x3f')]:_0x5d5d8c[_0xd020('0x3c')];if(!_0x5419a2[_0xd020('0x3d')][_0xd020('0x42')](_0xd020('0x43'))){_0x3e7237['limit']=qs['limit'](_0x5419a2[_0xd020('0x3d')][_0xd020('0x2f')]);_0x3e7237[_0xd020('0x2e')]=qs['offset'](_0x5419a2[_0xd020('0x3d')][_0xd020('0x2e')]);}_0x3e7237['order']=qs[_0xd020('0x44')](_0x5419a2[_0xd020('0x3d')][_0xd020('0x44')]);_0x3e7237['where']=qs[_0xd020('0x45')](_['pick'](_0x5419a2[_0xd020('0x3d')],_0x5d5d8c[_0xd020('0x45')]),_0xc6c9a1);if(_0x5419a2[_0xd020('0x3d')][_0xd020('0x46')]){_0x3e7237[_0xd020('0x47')]=_[_0xd020('0x48')](_0x3e7237[_0xd020('0x47')],{'$or':_[_0xd020('0x38')](_0xc6c9a1,function(_0x4fd804){if(_0x4fd804[_0xd020('0x3b')]!==_0xd020('0x49')){var _0xdca09={};_0xdca09[_0x4fd804['name']]={'$like':'%'+_0x5419a2[_0xd020('0x3d')][_0xd020('0x46')]+'%'};return _0xdca09;}})});}_0x3e7237=_[_0xd020('0x48')]({},_0x3e7237,_0x5419a2[_0xd020('0x4a')]);var _0x48a846={'where':_0x3e7237[_0xd020('0x47')]};return db[_0xd020('0x4b')][_0xd020('0x2d')](_0x48a846)['then'](function(_0x101cf3){_0x22618a[_0xd020('0x2d')]=_0x101cf3;if(_0x5419a2[_0xd020('0x3d')][_0xd020('0x4c')]){_0x3e7237[_0xd020('0x4d')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xd020('0x4e')](_0x3e7237);})[_0xd020('0x20')](function(_0x330fe0){_0x22618a[_0xd020('0x4f')]=_0x330fe0;return _0x22618a;})['then'](respondWithFilteredResult(_0x206c36,_0x3e7237))[_0xd020('0x50')](handleError(_0x206c36,null));};exports[_0xd020('0x51')]=function(_0x47e8e9,_0x174ae9){var _0x13f7f0={'raw':![],'where':{'id':_0x47e8e9[_0xd020('0x52')]['id']}},_0x301df1={};_0x301df1[_0xd020('0x3c')]=_[_0xd020('0x53')](db[_0xd020('0x4b')][_0xd020('0x39')]);_0x301df1['query']=_['keys'](_0x47e8e9[_0xd020('0x3d')]);_0x301df1[_0xd020('0x45')]=_['intersection'](_0x301df1['model'],_0x301df1[_0xd020('0x3d')]);_0x13f7f0[_0xd020('0x3f')]=_['intersection'](_0x301df1[_0xd020('0x3c')],qs['fields'](_0x47e8e9[_0xd020('0x3d')]['fields']));_0x13f7f0['attributes']=_0x13f7f0[_0xd020('0x3f')][_0xd020('0x41')]?_0x13f7f0[_0xd020('0x3f')]:_0x301df1[_0xd020('0x3c')];if(_0x47e8e9['query'][_0xd020('0x4c')]){_0x13f7f0[_0xd020('0x4d')]=[{'all':!![]}];}_0x13f7f0=_[_0xd020('0x48')]({},_0x13f7f0,_0x47e8e9['options']);return db[_0xd020('0x4b')][_0xd020('0x54')](_0x13f7f0)[_0xd020('0x20')](handleEntityNotFound(_0x174ae9,null))[_0xd020('0x20')](respondWithResult(_0x174ae9,null))[_0xd020('0x50')](handleError(_0x174ae9,null));};exports[_0xd020('0x55')]=function(_0x4b5b1e,_0x37b9c6){return db['FreshsalesConfiguration'][_0xd020('0x55')](_0x4b5b1e[_0xd020('0x56')],{})['then'](respondWithResult(_0x37b9c6,0xc9))[_0xd020('0x50')](handleError(_0x37b9c6,null));};exports[_0xd020('0x34')]=function(_0x373ce5,_0x5a1050){if(_0x373ce5['body']['id']){delete _0x373ce5[_0xd020('0x56')]['id'];}return db['FreshsalesConfiguration'][_0xd020('0x54')]({'where':{'id':_0x373ce5['params']['id']}})[_0xd020('0x20')](handleEntityNotFound(_0x5a1050,null))[_0xd020('0x20')](saveUpdates(_0x373ce5['body'],null))['then'](respondWithResult(_0x5a1050,null))[_0xd020('0x50')](handleError(_0x5a1050,null));};exports['destroy']=function(_0x6a7560,_0x349969){return db[_0xd020('0x4b')][_0xd020('0x54')]({'where':{'id':_0x6a7560[_0xd020('0x52')]['id']}})['then'](handleEntityNotFound(_0x349969,null))[_0xd020('0x20')](removeEntity(_0x349969,null))[_0xd020('0x50')](handleError(_0x349969,null));};exports[_0xd020('0x57')]=function(_0x41084d,_0x25d15b,_0x296579){var _0x1af630={};var _0x3980ab={};var _0x516fe1;var _0x582d2b;return db['FreshsalesConfiguration'][_0xd020('0x58')]({'where':{'id':_0x41084d[_0xd020('0x52')]['id']}})[_0xd020('0x20')](handleEntityNotFound(_0x25d15b,null))[_0xd020('0x20')](function(_0x133ab0){if(_0x133ab0){_0x516fe1=_0x133ab0;_0x3980ab[_0xd020('0x3c')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x3980ab['query']=_[_0xd020('0x53')](_0x41084d[_0xd020('0x3d')]);_0x3980ab[_0xd020('0x45')]=_['intersection'](_0x3980ab['model'],_0x3980ab['query']);_0x1af630[_0xd020('0x3f')]=_[_0xd020('0x3e')](_0x3980ab[_0xd020('0x3c')],qs[_0xd020('0x40')](_0x41084d[_0xd020('0x3d')]['fields']));_0x1af630[_0xd020('0x3f')]=_0x1af630[_0xd020('0x3f')][_0xd020('0x41')]?_0x1af630[_0xd020('0x3f')]:_0x3980ab[_0xd020('0x3c')];_0x1af630[_0xd020('0x59')]=qs[_0xd020('0x44')](_0x41084d[_0xd020('0x3d')]['sort']);_0x1af630['where']=qs[_0xd020('0x45')](_['pick'](_0x41084d[_0xd020('0x3d')],_0x3980ab[_0xd020('0x45')]));if(_0x41084d[_0xd020('0x3d')][_0xd020('0x46')]){_0x1af630['where']=_['merge'](_0x1af630[_0xd020('0x47')],{'$or':_[_0xd020('0x38')](_0x1af630[_0xd020('0x3f')],function(_0x2f519f){var _0x229b87={};_0x229b87[_0x2f519f]={'$like':'%'+_0x41084d[_0xd020('0x3d')][_0xd020('0x46')]+'%'};return _0x229b87;})});}_0x1af630=_[_0xd020('0x48')]({},_0x1af630,_0x41084d[_0xd020('0x4a')]);return _0x516fe1[_0xd020('0x57')](_0x1af630);}})[_0xd020('0x20')](function(_0x6da9bc){if(_0x6da9bc){_0x582d2b=_0x6da9bc[_0xd020('0x41')];if(!_0x41084d[_0xd020('0x3d')][_0xd020('0x42')](_0xd020('0x43'))){_0x1af630[_0xd020('0x2f')]=qs[_0xd020('0x2f')](_0x41084d[_0xd020('0x3d')][_0xd020('0x2f')]);_0x1af630[_0xd020('0x2e')]=qs[_0xd020('0x2e')](_0x41084d['query'][_0xd020('0x2e')]);}return _0x516fe1[_0xd020('0x57')](_0x1af630);}})[_0xd020('0x20')](function(_0xe77b18){if(_0xe77b18){return _0xe77b18?{'count':_0x582d2b,'rows':_0xe77b18}:null;}})[_0xd020('0x20')](respondWithResult(_0x25d15b,null))[_0xd020('0x50')](handleError(_0x25d15b,null));};exports[_0xd020('0x5a')]=function(_0x470b7b,_0xa61265,_0xfcabb0){var _0x27b1ef={};var _0xc08d9c={};var _0x1237f4;var _0x56d750;return db[_0xd020('0x4b')][_0xd020('0x58')]({'where':{'id':_0x470b7b['params']['id']}})[_0xd020('0x20')](handleEntityNotFound(_0xa61265,null))['then'](function(_0x6df97d){if(_0x6df97d){_0x1237f4=_0x6df97d;_0xc08d9c[_0xd020('0x3c')]=_['keys'](db[_0xd020('0x5b')][_0xd020('0x39')]);_0xc08d9c['query']=_['keys'](_0x470b7b['query']);_0xc08d9c['filters']=_[_0xd020('0x3e')](_0xc08d9c[_0xd020('0x3c')],_0xc08d9c['query']);_0x27b1ef[_0xd020('0x3f')]=_[_0xd020('0x3e')](_0xc08d9c[_0xd020('0x3c')],qs[_0xd020('0x40')](_0x470b7b[_0xd020('0x3d')]['fields']));_0x27b1ef[_0xd020('0x3f')]=_0x27b1ef['attributes'][_0xd020('0x41')]?_0x27b1ef[_0xd020('0x3f')]:_0xc08d9c[_0xd020('0x3c')];_0x27b1ef[_0xd020('0x59')]=qs[_0xd020('0x44')](_0x470b7b[_0xd020('0x3d')][_0xd020('0x44')]);_0x27b1ef[_0xd020('0x47')]=qs[_0xd020('0x45')](_[_0xd020('0x5c')](_0x470b7b[_0xd020('0x3d')],_0xc08d9c[_0xd020('0x45')]));if(_0x470b7b[_0xd020('0x3d')][_0xd020('0x46')]){_0x27b1ef['where']=_['merge'](_0x27b1ef[_0xd020('0x47')],{'$or':_[_0xd020('0x38')](_0x27b1ef[_0xd020('0x3f')],function(_0x11bdf5){var _0x18ff5e={};_0x18ff5e[_0x11bdf5]={'$like':'%'+_0x470b7b['query'][_0xd020('0x46')]+'%'};return _0x18ff5e;})});}_0x27b1ef=_[_0xd020('0x48')]({},_0x27b1ef,_0x470b7b[_0xd020('0x4a')]);return _0x1237f4[_0xd020('0x5a')](_0x27b1ef);}})[_0xd020('0x20')](function(_0x2d2c37){if(_0x2d2c37){_0x56d750=_0x2d2c37[_0xd020('0x41')];if(!_0x470b7b[_0xd020('0x3d')][_0xd020('0x42')](_0xd020('0x43'))){_0x27b1ef[_0xd020('0x2f')]=qs[_0xd020('0x2f')](_0x470b7b[_0xd020('0x3d')][_0xd020('0x2f')]);_0x27b1ef['offset']=qs[_0xd020('0x2e')](_0x470b7b[_0xd020('0x3d')][_0xd020('0x2e')]);}return _0x1237f4[_0xd020('0x5a')](_0x27b1ef);}})[_0xd020('0x20')](function(_0x2aac98){if(_0x2aac98){return _0x2aac98?{'count':_0x56d750,'rows':_0x2aac98}:null;}})[_0xd020('0x20')](respondWithResult(_0xa61265,null))['catch'](handleError(_0xa61265,null));};exports[_0xd020('0x5d')]=function(_0x286d67,_0x454f73,_0x290f88){var _0x4867eb={};var _0x2e2a89={};var _0x27c0f8;var _0x42c9b1;return db[_0xd020('0x4b')]['findOne']({'where':{'id':_0x286d67[_0xd020('0x52')]['id']}})[_0xd020('0x20')](handleEntityNotFound(_0x454f73,null))[_0xd020('0x20')](function(_0x26350a){if(_0x26350a){_0x27c0f8=_0x26350a;_0x2e2a89[_0xd020('0x3c')]=_['keys'](db[_0xd020('0x5b')][_0xd020('0x39')]);_0x2e2a89[_0xd020('0x3d')]=_[_0xd020('0x53')](_0x286d67[_0xd020('0x3d')]);_0x2e2a89[_0xd020('0x45')]=_[_0xd020('0x3e')](_0x2e2a89['model'],_0x2e2a89['query']);_0x4867eb[_0xd020('0x3f')]=_[_0xd020('0x3e')](_0x2e2a89[_0xd020('0x3c')],qs[_0xd020('0x40')](_0x286d67[_0xd020('0x3d')]['fields']));_0x4867eb[_0xd020('0x3f')]=_0x4867eb[_0xd020('0x3f')][_0xd020('0x41')]?_0x4867eb[_0xd020('0x3f')]:_0x2e2a89['model'];_0x4867eb[_0xd020('0x59')]=qs[_0xd020('0x44')](_0x286d67[_0xd020('0x3d')]['sort']);_0x4867eb[_0xd020('0x47')]=qs['filters'](_[_0xd020('0x5c')](_0x286d67[_0xd020('0x3d')],_0x2e2a89[_0xd020('0x45')]));if(_0x286d67['query'][_0xd020('0x46')]){_0x4867eb[_0xd020('0x47')]=_['merge'](_0x4867eb[_0xd020('0x47')],{'$or':_['map'](_0x4867eb[_0xd020('0x3f')],function(_0x158cab){var _0x45aea6={};_0x45aea6[_0x158cab]={'$like':'%'+_0x286d67[_0xd020('0x3d')][_0xd020('0x46')]+'%'};return _0x45aea6;})});}_0x4867eb=_[_0xd020('0x48')]({},_0x4867eb,_0x286d67[_0xd020('0x4a')]);return _0x27c0f8[_0xd020('0x5d')](_0x4867eb);}})[_0xd020('0x20')](function(_0x5374cb){if(_0x5374cb){_0x42c9b1=_0x5374cb[_0xd020('0x41')];if(!_0x286d67['query']['hasOwnProperty'](_0xd020('0x43'))){_0x4867eb[_0xd020('0x2f')]=qs[_0xd020('0x2f')](_0x286d67[_0xd020('0x3d')]['limit']);_0x4867eb[_0xd020('0x2e')]=qs[_0xd020('0x2e')](_0x286d67['query'][_0xd020('0x2e')]);}return _0x27c0f8['getFields'](_0x4867eb);}})[_0xd020('0x20')](function(_0x543955){if(_0x543955){return _0x543955?{'count':_0x42c9b1,'rows':_0x543955}:null;}})[_0xd020('0x20')](respondWithResult(_0x454f73,null))['catch'](handleError(_0x454f73,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 35f64e5..fba9264 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 _0x25a3=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x25a3,0x121));var _0x325a=function(_0x57d3de,_0x35c816){_0x57d3de=_0x57d3de-0x0;var _0x5f2fb7=_0x25a3[_0x57d3de];return _0x5f2fb7;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var logger=require(_0x325a('0x2'))('api');var moment=require(_0x325a('0x3'));var BPromise=require('bluebird');var rp=require(_0x325a('0x4'));var fs=require('fs');var path=require(_0x325a('0x5'));var rimraf=require(_0x325a('0x6'));var config=require('../../config/environment');var attributes=require(_0x325a('0x7'));module[_0x325a('0x8')]=function(_0x272122,_0x56e8fb){return _0x272122['define'](_0x325a('0x9'),attributes,{'tableName':_0x325a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb58b=['FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1f5b6d,_0x4340da){_0x1f5b6d=_0x1f5b6d-0x0;var _0x456806=_0xb58b[_0x1f5b6d];return _0x456806;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 24c1d52..0b3bf68 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 _0xd52d=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e0470,_0xe7c274){var _0x121606=function(_0x221cb7){while(--_0x221cb7){_0x3e0470['push'](_0x3e0470['shift']());}};_0x121606(++_0xe7c274);}(_0xd52d,0x1c7));var _0xdd52=function(_0x2c140a,_0x392f28){_0x2c140a=_0x2c140a-0x0;var _0x2edb01=_0xd52d[_0x2c140a];return _0x2edb01;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file +var _0xa9e0=['http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\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(_0x4c4758,_0x179631){var _0x3b3301=function(_0x57e71c){while(--_0x57e71c){_0x4c4758['push'](_0x4c4758['shift']());}};_0x3b3301(++_0x179631);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e3daef6..9cc0849 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 _0xdfb1=['post','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2eadbe,_0x3aa115){var _0x249dee=function(_0x4b892b){while(--_0x4b892b){_0x2eadbe['push'](_0x2eadbe['shift']());}};_0x249dee(++_0x3aa115);}(_0xdfb1,0xe6));var _0x1dfb=function(_0x25384c,_0x54e362){_0x25384c=_0x25384c-0x0;var _0x16298a=_0xdfb1[_0x25384c];return _0x16298a;};'use strict';var multer=require(_0x1dfb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1dfb('0x1'));var express=require(_0x1dfb('0x2'));var router=express['Router']();var auth=require(_0x1dfb('0x3'));var interaction=require(_0x1dfb('0x4'));var config=require(_0x1dfb('0x5'));var controller=require('./intFreshsalesField.controller');router[_0x1dfb('0x6')]('/',auth[_0x1dfb('0x7')](),controller[_0x1dfb('0x8')]);router[_0x1dfb('0x6')](_0x1dfb('0x9'),auth[_0x1dfb('0x7')](),controller['show']);router[_0x1dfb('0xa')]('/',auth[_0x1dfb('0x7')](),controller['create']);router['put'](_0x1dfb('0x9'),auth[_0x1dfb('0x7')](),controller[_0x1dfb('0xb')]);router[_0x1dfb('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1dfb('0xd')]);module[_0x1dfb('0xe')]=router; \ No newline at end of file +var _0x0721=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','put','update','delete','/:id','exports','util','path','express'];(function(_0x3e4b94,_0x5bbe13){var _0x5563eb=function(_0x2dd1a1){while(--_0x2dd1a1){_0x3e4b94['push'](_0x3e4b94['shift']());}};_0x5563eb(++_0x5bbe13);}(_0x0721,0xcd));var _0x1072=function(_0x4e1bd3,_0xda464d){_0x4e1bd3=_0x4e1bd3-0x0;var _0x234e83=_0x0721[_0x4e1bd3];return _0x234e83;};'use strict';var multer=require('multer');var util=require(_0x1072('0x0'));var path=require(_0x1072('0x1'));var timeout=require('connect-timeout');var express=require(_0x1072('0x2'));var router=express[_0x1072('0x3')]();var auth=require(_0x1072('0x4'));var interaction=require(_0x1072('0x5'));var config=require(_0x1072('0x6'));var controller=require(_0x1072('0x7'));router[_0x1072('0x8')]('/',auth[_0x1072('0x9')](),controller[_0x1072('0xa')]);router['get']('/:id',auth[_0x1072('0x9')](),controller['show']);router['post']('/',auth[_0x1072('0x9')](),controller['create']);router[_0x1072('0xb')]('/:id',auth[_0x1072('0x9')](),controller[_0x1072('0xc')]);router[_0x1072('0xd')](_0x1072('0xe'),auth[_0x1072('0x9')](),controller['destroy']);module[_0x1072('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 1312e63..0e4a361 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 _0x57fa=['exports','string','variable','customVariable','STRING','ENUM'];(function(_0x44b55f,_0x3f85fa){var _0xc047a1=function(_0x4f7063){while(--_0x4f7063){_0x44b55f['push'](_0x44b55f['shift']());}};_0xc047a1(++_0x3f85fa);}(_0x57fa,0x7e));var _0xa57f=function(_0x4fa3a1,_0x20e63c){_0x4fa3a1=_0x4fa3a1-0x0;var _0x4cec68=_0x57fa[_0x4fa3a1];return _0x4cec68;};'use strict';var Sequelize=require('sequelize');module[_0xa57f('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa57f('0x1'),_0xa57f('0x2'),_0xa57f('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa57f('0x4')]},'key':{'type':Sequelize[_0xa57f('0x4')]},'keyType':{'type':Sequelize[_0xa57f('0x5')](_0xa57f('0x1'),_0xa57f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xa57f('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa57f('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8369=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x49132e,_0x45232b){var _0x14fd86=function(_0x569092){while(--_0x569092){_0x49132e['push'](_0x49132e['shift']());}};_0x14fd86(++_0x45232b);}(_0x8369,0x10b));var _0x9836=function(_0x11f58c,_0x25fcc1){_0x11f58c=_0x11f58c-0x0;var _0x3dd98a=_0x8369[_0x11f58c];return _0x3dd98a;};'use strict';var Sequelize=require(_0x9836('0x0'));module[_0x9836('0x1')]={'type':{'type':Sequelize[_0x9836('0x2')](_0x9836('0x3'),_0x9836('0x4'),_0x9836('0x5'),_0x9836('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9836('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9836('0x2')](_0x9836('0x3'),'variable',_0x9836('0x5'))},'keyContent':{'type':Sequelize[_0x9836('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9836('0x7')]},'customField':{'type':Sequelize[_0x9836('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9836('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2283587..197edb4 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 _0x5b87=['rawAttributes','find','catch','create','body','update','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','show'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5b87,0x91));var _0x75b8=function(_0x14875a,_0x2dfd58){_0x14875a=_0x14875a-0x0;var _0xbadbf8=_0x5b87[_0x14875a];return _0xbadbf8;};'use strict';var pdf=require(_0x75b8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x75b8('0x1'));var zipdir=require(_0x75b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75b8('0x3'));var moment=require(_0x75b8('0x4'));var BPromise=require(_0x75b8('0x5'));var Mustache=require(_0x75b8('0x6'));var util=require('util');var path=require(_0x75b8('0x7'));var sox=require(_0x75b8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x75b8('0x9'));var crypto=require(_0x75b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x75b8('0xb'));var querystring=require(_0x75b8('0xc'));var Papa=require(_0x75b8('0xd'));var Redis=require(_0x75b8('0xe'));var authService=require(_0x75b8('0xf'));var qs=require(_0x75b8('0x10'));var as=require(_0x75b8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75b8('0x12'))(_0x75b8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x75b8('0x14'))['db'];function respondWithStatusCode(_0x46259e,_0x52a43c){_0x52a43c=_0x52a43c||0xcc;return function(_0x172345){if(_0x172345){return _0x46259e[_0x75b8('0x15')](_0x52a43c);}return _0x46259e[_0x75b8('0x16')](_0x52a43c)[_0x75b8('0x17')]();};}function respondWithResult(_0x3fc58f,_0xf6ef5e){_0xf6ef5e=_0xf6ef5e||0xc8;return function(_0x112354){if(_0x112354){return _0x3fc58f[_0x75b8('0x16')](_0xf6ef5e)[_0x75b8('0x18')](_0x112354);}};}function respondWithFilteredResult(_0x202f62,_0x5dd037){return function(_0x297f08){if(_0x297f08){var _0x11faae=_0x297f08[_0x75b8('0x19')],_0x597600=_0x5dd037[_0x75b8('0x1a')],_0x3cbeca=_0x5dd037[_0x75b8('0x1a')]+_0x5dd037[_0x75b8('0x1b')],_0x50cdb1;if(_0x3cbeca>=_0x11faae){_0x3cbeca=_0x11faae;_0x50cdb1=0xc8;}else{_0x50cdb1=0xce;}_0x202f62[_0x75b8('0x16')](_0x50cdb1);return _0x202f62[_0x75b8('0x1c')](_0x75b8('0x1d'),_0x597600+'-'+_0x3cbeca+'/'+_0x11faae)[_0x75b8('0x18')](_0x297f08);}return null;};}function patchUpdates(_0x1bc8fd){return function(_0xf71875){try{jsonpatch[_0x75b8('0x1e')](_0xf71875,_0x1bc8fd,!![]);}catch(_0x2d1ac8){return BPromise[_0x75b8('0x1f')](_0x2d1ac8);}return _0xf71875[_0x75b8('0x20')]();};}function saveUpdates(_0x194624,_0x17f826){return function(_0x52bad6){if(_0x52bad6){return _0x52bad6['update'](_0x194624)[_0x75b8('0x21')](function(_0x31fba1){return _0x31fba1;});}return null;};}function removeEntity(_0x204aeb,_0x436812){return function(_0x5ec7e4){if(_0x5ec7e4){return _0x5ec7e4[_0x75b8('0x22')]()[_0x75b8('0x21')](function(){_0x204aeb[_0x75b8('0x16')](0xcc)[_0x75b8('0x17')]();});}};}function handleEntityNotFound(_0x19a6ea,_0x107638){return function(_0xe4fbf4){if(!_0xe4fbf4){_0x19a6ea[_0x75b8('0x15')](0x194);}return _0xe4fbf4;};}function handleError(_0x3bd94b,_0x368067){_0x368067=_0x368067||0x1f4;return function(_0x448d1e){logger['error'](_0x448d1e[_0x75b8('0x23')]);if(_0x448d1e[_0x75b8('0x24')]){delete _0x448d1e[_0x75b8('0x24')];}_0x3bd94b['status'](_0x368067)[_0x75b8('0x25')](_0x448d1e);};}exports['index']=function(_0x376250,_0x1a07ee){var _0x59ac46={},_0x45869a={},_0x875432={'count':0x0,'rows':[]};var _0xf80cea=_[_0x75b8('0x26')](db[_0x75b8('0x27')]['rawAttributes'],function(_0x39b4bf){return{'name':_0x39b4bf[_0x75b8('0x28')],'type':_0x39b4bf[_0x75b8('0x29')][_0x75b8('0x2a')]};});_0x45869a[_0x75b8('0x2b')]=_[_0x75b8('0x26')](_0xf80cea,_0x75b8('0x24'));_0x45869a[_0x75b8('0x2c')]=_[_0x75b8('0x2d')](_0x376250[_0x75b8('0x2c')]);_0x45869a[_0x75b8('0x2e')]=_['intersection'](_0x45869a[_0x75b8('0x2b')],_0x45869a['query']);_0x59ac46[_0x75b8('0x2f')]=_[_0x75b8('0x30')](_0x45869a[_0x75b8('0x2b')],qs['fields'](_0x376250['query'][_0x75b8('0x31')]));_0x59ac46['attributes']=_0x59ac46['attributes'][_0x75b8('0x32')]?_0x59ac46['attributes']:_0x45869a[_0x75b8('0x2b')];if(!_0x376250['query'][_0x75b8('0x33')]('nolimit')){_0x59ac46['limit']=qs[_0x75b8('0x1b')](_0x376250[_0x75b8('0x2c')]['limit']);_0x59ac46[_0x75b8('0x1a')]=qs[_0x75b8('0x1a')](_0x376250[_0x75b8('0x2c')][_0x75b8('0x1a')]);}_0x59ac46[_0x75b8('0x34')]=qs[_0x75b8('0x35')](_0x376250[_0x75b8('0x2c')][_0x75b8('0x35')]);_0x59ac46[_0x75b8('0x36')]=qs['filters'](_[_0x75b8('0x37')](_0x376250[_0x75b8('0x2c')],_0x45869a[_0x75b8('0x2e')]),_0xf80cea);if(_0x376250[_0x75b8('0x2c')]['filter']){_0x59ac46['where']=_[_0x75b8('0x38')](_0x59ac46[_0x75b8('0x36')],{'$or':_[_0x75b8('0x26')](_0xf80cea,function(_0xe2bde4){if(_0xe2bde4[_0x75b8('0x29')]!==_0x75b8('0x39')){var _0x1a5061={};_0x1a5061[_0xe2bde4[_0x75b8('0x24')]]={'$like':'%'+_0x376250[_0x75b8('0x2c')]['filter']+'%'};return _0x1a5061;}})});}_0x59ac46=_[_0x75b8('0x38')]({},_0x59ac46,_0x376250[_0x75b8('0x3a')]);var _0x34ba36={'where':_0x59ac46[_0x75b8('0x36')]};return db['FreshsalesField'][_0x75b8('0x19')](_0x34ba36)['then'](function(_0x2fb6cc){_0x875432[_0x75b8('0x19')]=_0x2fb6cc;if(_0x376250[_0x75b8('0x2c')][_0x75b8('0x3b')]){_0x59ac46[_0x75b8('0x3c')]=[{'all':!![]}];}return db[_0x75b8('0x27')]['findAll'](_0x59ac46);})[_0x75b8('0x21')](function(_0x26f261){_0x875432['rows']=_0x26f261;return _0x875432;})[_0x75b8('0x21')](respondWithFilteredResult(_0x1a07ee,_0x59ac46))['catch'](handleError(_0x1a07ee,null));};exports[_0x75b8('0x3d')]=function(_0x5cc04,_0x20cec3){var _0x2fb291={'raw':!![],'where':{'id':_0x5cc04['params']['id']}},_0x2e5faf={};_0x2e5faf[_0x75b8('0x2b')]=_[_0x75b8('0x2d')](db['FreshsalesField'][_0x75b8('0x3e')]);_0x2e5faf[_0x75b8('0x2c')]=_[_0x75b8('0x2d')](_0x5cc04[_0x75b8('0x2c')]);_0x2e5faf[_0x75b8('0x2e')]=_[_0x75b8('0x30')](_0x2e5faf[_0x75b8('0x2b')],_0x2e5faf['query']);_0x2fb291['attributes']=_[_0x75b8('0x30')](_0x2e5faf[_0x75b8('0x2b')],qs[_0x75b8('0x31')](_0x5cc04[_0x75b8('0x2c')][_0x75b8('0x31')]));_0x2fb291[_0x75b8('0x2f')]=_0x2fb291[_0x75b8('0x2f')][_0x75b8('0x32')]?_0x2fb291[_0x75b8('0x2f')]:_0x2e5faf[_0x75b8('0x2b')];if(_0x5cc04['query']['includeAll']){_0x2fb291['include']=[{'all':!![]}];}_0x2fb291=_[_0x75b8('0x38')]({},_0x2fb291,_0x5cc04['options']);return db[_0x75b8('0x27')][_0x75b8('0x3f')](_0x2fb291)['then'](handleEntityNotFound(_0x20cec3,null))[_0x75b8('0x21')](respondWithResult(_0x20cec3,null))[_0x75b8('0x40')](handleError(_0x20cec3,null));};exports['create']=function(_0x4e14fa,_0x470670){return db[_0x75b8('0x27')][_0x75b8('0x41')](_0x4e14fa[_0x75b8('0x42')],{})[_0x75b8('0x21')](respondWithResult(_0x470670,0xc9))['catch'](handleError(_0x470670,null));};exports[_0x75b8('0x43')]=function(_0x5a5d10,_0xefa58b){if(_0x5a5d10[_0x75b8('0x42')]['id']){delete _0x5a5d10[_0x75b8('0x42')]['id'];}return db[_0x75b8('0x27')][_0x75b8('0x3f')]({'where':{'id':_0x5a5d10[_0x75b8('0x44')]['id']}})[_0x75b8('0x21')](handleEntityNotFound(_0xefa58b,null))[_0x75b8('0x21')](saveUpdates(_0x5a5d10[_0x75b8('0x42')],null))['then'](respondWithResult(_0xefa58b,null))[_0x75b8('0x40')](handleError(_0xefa58b,null));};exports[_0x75b8('0x22')]=function(_0x190005,_0x22d317){return db[_0x75b8('0x27')]['find']({'where':{'id':_0x190005[_0x75b8('0x44')]['id']}})[_0x75b8('0x21')](handleEntityNotFound(_0x22d317,null))[_0x75b8('0x21')](removeEntity(_0x22d317,null))['catch'](handleError(_0x22d317,null));}; \ No newline at end of file +var _0x1f3c=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','index','map','FreshsalesField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x33e0e8,_0x45c1d3){var _0x3796a4=function(_0x5002ad){while(--_0x5002ad){_0x33e0e8['push'](_0x33e0e8['shift']());}};_0x3796a4(++_0x45c1d3);}(_0x1f3c,0x1eb));var _0xc1f3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1f3c[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0xc1f3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc1f3('0x1'));var zipdir=require(_0xc1f3('0x2'));var jsonpatch=require(_0xc1f3('0x3'));var rp=require(_0xc1f3('0x4'));var moment=require(_0xc1f3('0x5'));var BPromise=require(_0xc1f3('0x6'));var Mustache=require(_0xc1f3('0x7'));var util=require(_0xc1f3('0x8'));var path=require(_0xc1f3('0x9'));var sox=require(_0xc1f3('0xa'));var csv=require(_0xc1f3('0xb'));var ejs=require(_0xc1f3('0xc'));var fs=require('fs');var _=require(_0xc1f3('0xd'));var squel=require(_0xc1f3('0xe'));var crypto=require(_0xc1f3('0xf'));var jsforce=require(_0xc1f3('0x10'));var deskjs=require(_0xc1f3('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc1f3('0x12'));var Papa=require(_0xc1f3('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc1f3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1f3('0x15'));var utils=require('../../config/utils');var config=require(_0xc1f3('0x16'));var db=require(_0xc1f3('0x17'))['db'];function respondWithStatusCode(_0x452b72,_0x17340a){_0x17340a=_0x17340a||0xcc;return function(_0x5ca12c){if(_0x5ca12c){return _0x452b72['sendStatus'](_0x17340a);}return _0x452b72[_0xc1f3('0x18')](_0x17340a)[_0xc1f3('0x19')]();};}function respondWithResult(_0x5e215e,_0x215f5a){_0x215f5a=_0x215f5a||0xc8;return function(_0x25ccb4){if(_0x25ccb4){return _0x5e215e[_0xc1f3('0x18')](_0x215f5a)[_0xc1f3('0x1a')](_0x25ccb4);}};}function respondWithFilteredResult(_0x1ecbda,_0xd7f3c1){return function(_0x5608de){if(_0x5608de){var _0x232a59=_0x5608de[_0xc1f3('0x1b')],_0x2c2836=_0xd7f3c1[_0xc1f3('0x1c')],_0x15ebf2=_0xd7f3c1[_0xc1f3('0x1c')]+_0xd7f3c1[_0xc1f3('0x1d')],_0x1f5a0e;if(_0x15ebf2>=_0x232a59){_0x15ebf2=_0x232a59;_0x1f5a0e=0xc8;}else{_0x1f5a0e=0xce;}_0x1ecbda[_0xc1f3('0x18')](_0x1f5a0e);return _0x1ecbda[_0xc1f3('0x1e')](_0xc1f3('0x1f'),_0x2c2836+'-'+_0x15ebf2+'/'+_0x232a59)['json'](_0x5608de);}return null;};}function patchUpdates(_0x3af56c){return function(_0x2fabaa){try{jsonpatch[_0xc1f3('0x20')](_0x2fabaa,_0x3af56c,!![]);}catch(_0x3389aa){return BPromise['reject'](_0x3389aa);}return _0x2fabaa[_0xc1f3('0x21')]();};}function saveUpdates(_0x2ca31d,_0xd8aaf1){return function(_0x3c5f68){if(_0x3c5f68){return _0x3c5f68[_0xc1f3('0x22')](_0x2ca31d)[_0xc1f3('0x23')](function(_0x2012ef){return _0x2012ef;});}return null;};}function removeEntity(_0x1578e3,_0x7be7df){return function(_0xb0c33d){if(_0xb0c33d){return _0xb0c33d['destroy']()[_0xc1f3('0x23')](function(){_0x1578e3[_0xc1f3('0x18')](0xcc)[_0xc1f3('0x19')]();});}};}function handleEntityNotFound(_0x1bdb44,_0x5bc5b8){return function(_0x10bda8){if(!_0x10bda8){_0x1bdb44[_0xc1f3('0x24')](0x194);}return _0x10bda8;};}function handleError(_0x384098,_0x42a917){_0x42a917=_0x42a917||0x1f4;return function(_0x5688da){logger[_0xc1f3('0x25')](_0x5688da[_0xc1f3('0x26')]);if(_0x5688da[_0xc1f3('0x27')]){delete _0x5688da[_0xc1f3('0x27')];}_0x384098['status'](_0x42a917)['send'](_0x5688da);};}exports[_0xc1f3('0x28')]=function(_0x2de957,_0x3db91e){var _0x490cb={},_0x370ebd={},_0x2bb111={'count':0x0,'rows':[]};var _0x1d1157=_[_0xc1f3('0x29')](db[_0xc1f3('0x2a')]['rawAttributes'],function(_0x1597d1){return{'name':_0x1597d1[_0xc1f3('0x2b')],'type':_0x1597d1['type'][_0xc1f3('0x2c')]};});_0x370ebd[_0xc1f3('0x2d')]=_[_0xc1f3('0x29')](_0x1d1157,_0xc1f3('0x27'));_0x370ebd[_0xc1f3('0x2e')]=_[_0xc1f3('0x2f')](_0x2de957[_0xc1f3('0x2e')]);_0x370ebd[_0xc1f3('0x30')]=_[_0xc1f3('0x31')](_0x370ebd['model'],_0x370ebd[_0xc1f3('0x2e')]);_0x490cb[_0xc1f3('0x32')]=_[_0xc1f3('0x31')](_0x370ebd[_0xc1f3('0x2d')],qs['fields'](_0x2de957['query'][_0xc1f3('0x33')]));_0x490cb[_0xc1f3('0x32')]=_0x490cb[_0xc1f3('0x32')][_0xc1f3('0x34')]?_0x490cb[_0xc1f3('0x32')]:_0x370ebd['model'];if(!_0x2de957[_0xc1f3('0x2e')][_0xc1f3('0x35')](_0xc1f3('0x36'))){_0x490cb['limit']=qs[_0xc1f3('0x1d')](_0x2de957['query'][_0xc1f3('0x1d')]);_0x490cb['offset']=qs[_0xc1f3('0x1c')](_0x2de957['query'][_0xc1f3('0x1c')]);}_0x490cb[_0xc1f3('0x37')]=qs['sort'](_0x2de957[_0xc1f3('0x2e')]['sort']);_0x490cb['where']=qs[_0xc1f3('0x30')](_[_0xc1f3('0x38')](_0x2de957['query'],_0x370ebd[_0xc1f3('0x30')]),_0x1d1157);if(_0x2de957[_0xc1f3('0x2e')][_0xc1f3('0x39')]){_0x490cb[_0xc1f3('0x3a')]=_['merge'](_0x490cb[_0xc1f3('0x3a')],{'$or':_[_0xc1f3('0x29')](_0x1d1157,function(_0x1b7d78){if(_0x1b7d78['type']!==_0xc1f3('0x3b')){var _0x13d60d={};_0x13d60d[_0x1b7d78[_0xc1f3('0x27')]]={'$like':'%'+_0x2de957[_0xc1f3('0x2e')][_0xc1f3('0x39')]+'%'};return _0x13d60d;}})});}_0x490cb=_['merge']({},_0x490cb,_0x2de957['options']);var _0x311cdb={'where':_0x490cb['where']};return db['FreshsalesField'][_0xc1f3('0x1b')](_0x311cdb)[_0xc1f3('0x23')](function(_0x60aaf1){_0x2bb111[_0xc1f3('0x1b')]=_0x60aaf1;if(_0x2de957[_0xc1f3('0x2e')][_0xc1f3('0x3c')]){_0x490cb[_0xc1f3('0x3d')]=[{'all':!![]}];}return db[_0xc1f3('0x2a')][_0xc1f3('0x3e')](_0x490cb);})[_0xc1f3('0x23')](function(_0x29b7f1){_0x2bb111[_0xc1f3('0x3f')]=_0x29b7f1;return _0x2bb111;})[_0xc1f3('0x23')](respondWithFilteredResult(_0x3db91e,_0x490cb))[_0xc1f3('0x40')](handleError(_0x3db91e,null));};exports[_0xc1f3('0x41')]=function(_0x980433,_0x1324e2){var _0x14e309={'raw':!![],'where':{'id':_0x980433[_0xc1f3('0x42')]['id']}},_0x141efa={};_0x141efa[_0xc1f3('0x2d')]=_['keys'](db[_0xc1f3('0x2a')][_0xc1f3('0x43')]);_0x141efa[_0xc1f3('0x2e')]=_[_0xc1f3('0x2f')](_0x980433[_0xc1f3('0x2e')]);_0x141efa[_0xc1f3('0x30')]=_[_0xc1f3('0x31')](_0x141efa[_0xc1f3('0x2d')],_0x141efa[_0xc1f3('0x2e')]);_0x14e309[_0xc1f3('0x32')]=_[_0xc1f3('0x31')](_0x141efa['model'],qs[_0xc1f3('0x33')](_0x980433['query'][_0xc1f3('0x33')]));_0x14e309[_0xc1f3('0x32')]=_0x14e309['attributes'][_0xc1f3('0x34')]?_0x14e309[_0xc1f3('0x32')]:_0x141efa[_0xc1f3('0x2d')];if(_0x980433[_0xc1f3('0x2e')][_0xc1f3('0x3c')]){_0x14e309[_0xc1f3('0x3d')]=[{'all':!![]}];}_0x14e309=_['merge']({},_0x14e309,_0x980433['options']);return db[_0xc1f3('0x2a')][_0xc1f3('0x44')](_0x14e309)[_0xc1f3('0x23')](handleEntityNotFound(_0x1324e2,null))[_0xc1f3('0x23')](respondWithResult(_0x1324e2,null))['catch'](handleError(_0x1324e2,null));};exports[_0xc1f3('0x45')]=function(_0x4178fd,_0x2a75e8){return db['FreshsalesField'][_0xc1f3('0x45')](_0x4178fd[_0xc1f3('0x46')],{})['then'](respondWithResult(_0x2a75e8,0xc9))['catch'](handleError(_0x2a75e8,null));};exports[_0xc1f3('0x22')]=function(_0x1eeced,_0x13104d){if(_0x1eeced[_0xc1f3('0x46')]['id']){delete _0x1eeced[_0xc1f3('0x46')]['id'];}return db[_0xc1f3('0x2a')][_0xc1f3('0x44')]({'where':{'id':_0x1eeced[_0xc1f3('0x42')]['id']}})[_0xc1f3('0x23')](handleEntityNotFound(_0x13104d,null))['then'](saveUpdates(_0x1eeced[_0xc1f3('0x46')],null))[_0xc1f3('0x23')](respondWithResult(_0x13104d,null))[_0xc1f3('0x40')](handleError(_0x13104d,null));};exports['destroy']=function(_0x3a89ab,_0x285ba7){return db[_0xc1f3('0x2a')][_0xc1f3('0x44')]({'where':{'id':_0x3a89ab['params']['id']}})['then'](handleEntityNotFound(_0x285ba7,null))['then'](removeEntity(_0x285ba7,null))[_0xc1f3('0x40')](handleError(_0x285ba7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index eaaaecf..90a13cb 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 _0xd09e=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','bluebird'];(function(_0x29e700,_0x5666f4){var _0xe0b251=function(_0x103fdb){while(--_0x103fdb){_0x29e700['push'](_0x29e700['shift']());}};_0xe0b251(++_0x5666f4);}(_0xd09e,0xdc));var _0xed09=function(_0x349f5e,_0x3da4d1){_0x349f5e=_0x349f5e-0x0;var _0x280439=_0xd09e[_0x349f5e];return _0x280439;};'use strict';var _=require(_0xed09('0x0'));var util=require(_0xed09('0x1'));var logger=require('../../config/logger')(_0xed09('0x2'));var moment=require('moment');var BPromise=require(_0xed09('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed09('0x4'));var config=require(_0xed09('0x5'));var attributes=require(_0xed09('0x6'));module[_0xed09('0x7')]=function(_0x27ba52,_0x1515c6){return _0x27ba52[_0xed09('0x8')](_0xed09('0x9'),attributes,{'tableName':_0xed09('0xa'),'paranoid':![],'indexes':[{'name':_0xed09('0xb'),'fields':[_0xed09('0xc'),_0xed09('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef52=['./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0xef52,0x1c2));var _0x2ef5=function(_0x5b2c7e,_0x3d22f0){_0x5b2c7e=_0x5b2c7e-0x0;var _0x5ec399=_0xef52[_0x5b2c7e];return _0x5ec399;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2ef5('0x0'))(_0x2ef5('0x1'));var moment=require('moment');var BPromise=require(_0x2ef5('0x2'));var rp=require(_0x2ef5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ef5('0x4'));var config=require(_0x2ef5('0x5'));var attributes=require(_0x2ef5('0x6'));module[_0x2ef5('0x7')]=function(_0x1253c8,_0x321010){return _0x1253c8[_0x2ef5('0x8')]('FreshsalesField',attributes,{'tableName':_0x2ef5('0x9'),'paranoid':![],'indexes':[{'name':_0x2ef5('0xa'),'fields':[_0x2ef5('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index a9f3af1..c4d2420 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 _0x03ad=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x03ad,0xe0));var _0xd03a=function(_0x534817,_0x55cc0a){_0x534817=_0x534817-0x0;var _0x4e3ecb=_0x03ad[_0x534817];return _0x4e3ecb;};'use strict';var _=require(_0xd03a('0x0'));var util=require('util');var moment=require(_0xd03a('0x1'));var BPromise=require(_0xd03a('0x2'));var rs=require(_0xd03a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd03a('0x4'))['db'];var utils=require(_0xd03a('0x5'));var logger=require(_0xd03a('0x6'))(_0xd03a('0x7'));var config=require(_0xd03a('0x8'));var jayson=require(_0xd03a('0x9'));var client=jayson[_0xd03a('0xa')][_0xd03a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x257a99,_0x191345,_0x12f8dc){return new BPromise(function(_0xbc7a97,_0x4763a3){return client[_0xd03a('0xc')](_0x257a99,_0x12f8dc)[_0xd03a('0xd')](function(_0xed6bf5){logger[_0xd03a('0xe')](_0xd03a('0xf'),_0x191345,_0xd03a('0x10'));logger['debug'](_0xd03a('0x11'),_0x191345,_0xd03a('0x10'),JSON[_0xd03a('0x12')](_0xed6bf5));if(_0xed6bf5[_0xd03a('0x13')]){if(_0xed6bf5[_0xd03a('0x13')][_0xd03a('0x14')]===0x1f4){logger[_0xd03a('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x191345,_0xed6bf5['error'][_0xd03a('0x15')]);return _0x4763a3(_0xed6bf5[_0xd03a('0x13')][_0xd03a('0x15')]);}logger[_0xd03a('0x13')](_0xd03a('0xf'),_0x191345,_0xed6bf5['error'][_0xd03a('0x15')]);return _0xbc7a97(_0xed6bf5['error']['message']);}else{logger[_0xd03a('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x191345,_0xd03a('0x10'));_0xbc7a97(_0xed6bf5['result'][_0xd03a('0x15')]);}})[_0xd03a('0x16')](function(_0x1d3ec6){logger[_0xd03a('0x13')](_0xd03a('0xf'),_0x191345,_0x1d3ec6);_0x4763a3(_0x1d3ec6);});});} \ No newline at end of file +var _0x3ec5=['error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36fc5d,_0x3380a1){var _0x386a98=function(_0x2a7fb0){while(--_0x2a7fb0){_0x36fc5d['push'](_0x36fc5d['shift']());}};_0x386a98(++_0x3380a1);}(_0x3ec5,0x176));var _0x53ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3ec5[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x53ec('0x0'));var moment=require('moment');var BPromise=require(_0x53ec('0x1'));var rs=require(_0x53ec('0x2'));var fs=require('fs');var Redis=require(_0x53ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x53ec('0x4'));var logger=require(_0x53ec('0x5'))(_0x53ec('0x6'));var config=require('../../config/environment');var jayson=require(_0x53ec('0x7'));var client=jayson[_0x53ec('0x8')][_0x53ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43a10c,_0x1b0a16,_0x6f47f6){return new BPromise(function(_0x43ed21,_0x5da137){return client[_0x53ec('0xa')](_0x43a10c,_0x6f47f6)[_0x53ec('0xb')](function(_0x5ce810){logger[_0x53ec('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1b0a16,_0x53ec('0xd'));logger[_0x53ec('0xe')](_0x53ec('0xf'),_0x1b0a16,_0x53ec('0xd'),JSON[_0x53ec('0x10')](_0x5ce810));if(_0x5ce810[_0x53ec('0x11')]){if(_0x5ce810[_0x53ec('0x11')][_0x53ec('0x12')]===0x1f4){logger[_0x53ec('0x11')](_0x53ec('0x13'),_0x1b0a16,_0x5ce810[_0x53ec('0x11')][_0x53ec('0x14')]);return _0x5da137(_0x5ce810[_0x53ec('0x11')]['message']);}logger[_0x53ec('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x1b0a16,_0x5ce810[_0x53ec('0x11')]['message']);return _0x43ed21(_0x5ce810[_0x53ec('0x11')][_0x53ec('0x14')]);}else{logger['info'](_0x53ec('0x13'),_0x1b0a16,_0x53ec('0xd'));_0x43ed21(_0x5ce810[_0x53ec('0x15')]['message']);}})[_0x53ec('0x16')](function(_0x30e3aa){logger['error'](_0x53ec('0x13'),_0x1b0a16,_0x30e3aa);_0x5da137(_0x30e3aa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0c646fd..2a89ddf 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 _0x22d3=['delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update'];(function(_0x5429e6,_0x1f78fe){var _0x3c6711=function(_0x2aca23){while(--_0x2aca23){_0x5429e6['push'](_0x5429e6['shift']());}};_0x3c6711(++_0x1f78fe);}(_0x22d3,0x66));var _0x322d=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x22d3[_0x46a3e8];return _0xf1442e;};'use strict';var multer=require('multer');var util=require(_0x322d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x322d('0x1'));var router=express[_0x322d('0x2')]();var auth=require(_0x322d('0x3'));var interaction=require(_0x322d('0x4'));var config=require(_0x322d('0x5'));var controller=require('./intSalesforceAccount.controller');router[_0x322d('0x6')]('/',auth[_0x322d('0x7')](),controller['index']);router[_0x322d('0x6')](_0x322d('0x8'),auth[_0x322d('0x7')](),controller[_0x322d('0x9')]);router['get'](_0x322d('0xa'),auth[_0x322d('0x7')](),controller[_0x322d('0xb')]);router[_0x322d('0x6')](_0x322d('0xc'),auth[_0x322d('0x7')](),controller[_0x322d('0xd')]);router[_0x322d('0xe')]('/',auth[_0x322d('0x7')](),controller[_0x322d('0xf')]);router['post']('/:id/configurations',auth[_0x322d('0x7')](),controller['addConfiguration']);router[_0x322d('0x10')]('/:id',auth[_0x322d('0x7')](),controller[_0x322d('0x11')]);router[_0x322d('0x12')](_0x322d('0x8'),auth[_0x322d('0x7')](),controller['destroy']);module[_0x322d('0x13')]=router; \ No newline at end of file +var _0x0f4a=['../../config/environment','index','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e1944,_0x5a6a06){var _0x392315=function(_0x104ffd){while(--_0x104ffd){_0x5e1944['push'](_0x5e1944['shift']());}};_0x392315(++_0x5a6a06);}(_0x0f4a,0x185));var _0xa0f4=function(_0x2c40ba,_0x51b89f){_0x2c40ba=_0x2c40ba-0x0;var _0x3a5281=_0x0f4a[_0x2c40ba];return _0x3a5281;};'use strict';var multer=require(_0xa0f4('0x0'));var util=require(_0xa0f4('0x1'));var path=require(_0xa0f4('0x2'));var timeout=require(_0xa0f4('0x3'));var express=require('express');var router=express[_0xa0f4('0x4')]();var auth=require(_0xa0f4('0x5'));var interaction=require(_0xa0f4('0x6'));var config=require(_0xa0f4('0x7'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa0f4('0x8')]);router['get'](_0xa0f4('0x9'),auth[_0xa0f4('0xa')](),controller['show']);router[_0xa0f4('0xb')](_0xa0f4('0xc'),auth[_0xa0f4('0xa')](),controller[_0xa0f4('0xd')]);router[_0xa0f4('0xb')]('/:id/fields',auth[_0xa0f4('0xa')](),controller['getFields']);router[_0xa0f4('0xe')]('/',auth[_0xa0f4('0xa')](),controller[_0xa0f4('0xf')]);router['post']('/:id/configurations',auth[_0xa0f4('0xa')](),controller[_0xa0f4('0x10')]);router[_0xa0f4('0x11')](_0xa0f4('0x9'),auth[_0xa0f4('0xa')](),controller[_0xa0f4('0x12')]);router[_0xa0f4('0x13')](_0xa0f4('0x9'),auth[_0xa0f4('0xa')](),controller[_0xa0f4('0x14')]);module[_0xa0f4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 4898cb4..2d04ae8 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 _0x7fbe=['integrationTab','newTab','STRING','username','ENUM'];(function(_0x5b0eac,_0x1c86f8){var _0x1340d6=function(_0x51098d){while(--_0x51098d){_0x5b0eac['push'](_0x5b0eac['shift']());}};_0x1340d6(++_0x1c86f8);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x197b38,_0x394a4d){_0x197b38=_0x197b38-0x0;var _0x20a23a=_0x7fbe[_0x197b38];return _0x20a23a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'username':{'type':Sequelize[_0xe7fb('0x0')],'unique':_0xe7fb('0x1')},'remoteUri':{'type':Sequelize[_0xe7fb('0x0')]},'password':{'type':Sequelize[_0xe7fb('0x0')]},'clientId':{'type':Sequelize[_0xe7fb('0x0')]},'clientSecret':{'type':Sequelize[_0xe7fb('0x0')]},'securityToken':{'type':Sequelize[_0xe7fb('0x0')]},'serverUrl':{'type':Sequelize[_0xe7fb('0x0')]},'type':{'type':Sequelize[_0xe7fb('0x2')](_0xe7fb('0x3'),_0xe7fb('0x4')),'defaultValue':_0xe7fb('0x3')}}; \ No newline at end of file +var _0x7fbe=['integrationTab','newTab','STRING','username','ENUM'];(function(_0xca4b88,_0x343bc3){var _0x19e9c1=function(_0x17d836){while(--_0x17d836){_0xca4b88['push'](_0xca4b88['shift']());}};_0x19e9c1(++_0x343bc3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x141c05,_0x319076){_0x141c05=_0x141c05-0x0;var _0x25fa28=_0x7fbe[_0x141c05];return _0x25fa28;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'username':{'type':Sequelize[_0xe7fb('0x0')],'unique':_0xe7fb('0x1')},'remoteUri':{'type':Sequelize[_0xe7fb('0x0')]},'password':{'type':Sequelize[_0xe7fb('0x0')]},'clientId':{'type':Sequelize[_0xe7fb('0x0')]},'clientSecret':{'type':Sequelize[_0xe7fb('0x0')]},'securityToken':{'type':Sequelize[_0xe7fb('0x0')]},'serverUrl':{'type':Sequelize[_0xe7fb('0x0')]},'type':{'type':Sequelize[_0xe7fb('0x2')](_0xe7fb('0x3'),_0xe7fb('0x4')),'defaultValue':_0xe7fb('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e399ed6..a7b0b9f 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 _0x9d05=['filters','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','create','body','params','getConfigurations','SalesforceConfiguration','order','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Origin','Reason','SuppliedCompany','remove','custom','label','picklistValues','value','boolean','True','true','False','false','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','json','count','set','Content-Range','save','update','destroy','end','name','send','SalesforceAccount','fieldName','type','model','query','keys'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x9d05,0xda));var _0x59d0=function(_0x3f702c,_0x2a542c){_0x3f702c=_0x3f702c-0x0;var _0x447463=_0x9d05[_0x3f702c];return _0x447463;};'use strict';var pdf=require(_0x59d0('0x0'));var emlformat=require(_0x59d0('0x1'));var rimraf=require(_0x59d0('0x2'));var zipdir=require(_0x59d0('0x3'));var jsonpatch=require(_0x59d0('0x4'));var rp=require(_0x59d0('0x5'));var moment=require(_0x59d0('0x6'));var BPromise=require(_0x59d0('0x7'));var Mustache=require(_0x59d0('0x8'));var util=require(_0x59d0('0x9'));var path=require(_0x59d0('0xa'));var sox=require('sox');var csv=require(_0x59d0('0xb'));var ejs=require(_0x59d0('0xc'));var fs=require('fs');var _=require(_0x59d0('0xd'));var squel=require(_0x59d0('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x59d0('0xf'));var toCsv=require(_0x59d0('0xb'));var querystring=require(_0x59d0('0x10'));var Papa=require('papaparse');var Redis=require(_0x59d0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x59d0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59d0('0x13'));var logger=require(_0x59d0('0x14'))(_0x59d0('0x15'));var utils=require(_0x59d0('0x16'));var config=require(_0x59d0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x59d0('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x59d0('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3aad99,_0x34c55a,_0x515352){if(_0x515352){var _0xcb5cb0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcb5cb0[_0x59d0('0x1a')](_0x34c55a)){return _0x3aad99;}else{throw new db[(_0x59d0('0x1b'))][(_0x59d0('0x1c'))](_0x59d0('0x1d'));}}else{return _0x3aad99;}}function respondWithRpcPromise(_0x5708b2,_0x26162d,_0x3cc128,_0x752ec8){return new BPromise(function(_0x380fa1,_0x3f5392){var _0x241c0d=_0x752ec8||client;return _0x241c0d[_0x59d0('0x1e')](_0x5708b2,_0x3cc128)[_0x59d0('0x1f')](function(_0x36d1d8){logger['info'](_0x59d0('0x20'),_0x26162d,_0x59d0('0x21'));logger[_0x59d0('0x22')](_0x59d0('0x23'),_0x26162d,_0x59d0('0x21'),JSON['stringify'](_0x36d1d8));if(_0x36d1d8[_0x59d0('0x24')]){if(_0x36d1d8['error']['code']===0x1f4){logger[_0x59d0('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x26162d,_0x36d1d8['error'][_0x59d0('0x25')]);return _0x3f5392(_0x36d1d8['error'][_0x59d0('0x25')]);}logger[_0x59d0('0x24')](_0x59d0('0x20'),_0x26162d,_0x36d1d8[_0x59d0('0x24')]['message']);return _0x380fa1(_0x36d1d8[_0x59d0('0x24')][_0x59d0('0x25')]);}else{logger[_0x59d0('0x26')]('SalesforceAccount,\x20%s,\x20%s',_0x26162d,_0x59d0('0x21'));_0x380fa1(_0x36d1d8['result']['message']);}})[_0x59d0('0x27')](function(_0x4865c2){logger[_0x59d0('0x24')](_0x59d0('0x20'),_0x26162d,_0x4865c2);_0x3f5392(_0x4865c2);});});}function respondWithStatusCode(_0x24615e,_0x1c682d){_0x1c682d=_0x1c682d||0xcc;return function(_0x527eaa){if(_0x527eaa){return _0x24615e[_0x59d0('0x28')](_0x1c682d);}return _0x24615e[_0x59d0('0x29')](_0x1c682d)['end']();};}function respondWithResult(_0x1cb128,_0x5cf3ed){_0x5cf3ed=_0x5cf3ed||0xc8;return function(_0xb4bab3){if(_0xb4bab3){return _0x1cb128['status'](_0x5cf3ed)[_0x59d0('0x2a')](_0xb4bab3);}};}function respondWithFilteredResult(_0x344bf7,_0x3089d5){return function(_0x101c54){if(_0x101c54){var _0xaa0943=_0x101c54[_0x59d0('0x2b')],_0x1e03cf=_0x3089d5['offset'],_0x518a6e=_0x3089d5['offset']+_0x3089d5['limit'],_0xb5a7a6;if(_0x518a6e>=_0xaa0943){_0x518a6e=_0xaa0943;_0xb5a7a6=0xc8;}else{_0xb5a7a6=0xce;}_0x344bf7[_0x59d0('0x29')](_0xb5a7a6);return _0x344bf7[_0x59d0('0x2c')](_0x59d0('0x2d'),_0x1e03cf+'-'+_0x518a6e+'/'+_0xaa0943)[_0x59d0('0x2a')](_0x101c54);}return null;};}function patchUpdates(_0x54f78f){return function(_0x5da57e){try{jsonpatch['apply'](_0x5da57e,_0x54f78f,!![]);}catch(_0x10e965){return BPromise['reject'](_0x10e965);}return _0x5da57e[_0x59d0('0x2e')]();};}function saveUpdates(_0x45b871,_0x36a883){return function(_0x1b9532){if(_0x1b9532){return _0x1b9532[_0x59d0('0x2f')](_0x45b871)['then'](function(_0x4f27a5){return _0x4f27a5;});}return null;};}function removeEntity(_0x279301,_0x3f314d){return function(_0x4e0097){if(_0x4e0097){return _0x4e0097[_0x59d0('0x30')]()[_0x59d0('0x1f')](function(){_0x279301['status'](0xcc)[_0x59d0('0x31')]();});}};}function handleEntityNotFound(_0x356479,_0x42f346){return function(_0x209107){if(!_0x209107){_0x356479[_0x59d0('0x28')](0x194);}return _0x209107;};}function handleError(_0x28eb67,_0x4a08ed){_0x4a08ed=_0x4a08ed||0x1f4;return function(_0x64efaa){logger['error'](_0x64efaa['stack']);if(_0x64efaa[_0x59d0('0x32')]){delete _0x64efaa[_0x59d0('0x32')];}_0x28eb67[_0x59d0('0x29')](_0x4a08ed)[_0x59d0('0x33')](_0x64efaa);};}exports['index']=function(_0x2767a6,_0x36c735){var _0x1d7fa4={},_0x2aaea8={},_0xa70558={'count':0x0,'rows':[]};var _0x144ece=_['map'](db[_0x59d0('0x34')]['rawAttributes'],function(_0x9d4bb){return{'name':_0x9d4bb[_0x59d0('0x35')],'type':_0x9d4bb[_0x59d0('0x36')]['key']};});_0x2aaea8[_0x59d0('0x37')]=_['map'](_0x144ece,'name');_0x2aaea8[_0x59d0('0x38')]=_[_0x59d0('0x39')](_0x2767a6[_0x59d0('0x38')]);_0x2aaea8[_0x59d0('0x3a')]=_[_0x59d0('0x3b')](_0x2aaea8[_0x59d0('0x37')],_0x2aaea8[_0x59d0('0x38')]);_0x1d7fa4[_0x59d0('0x3c')]=_[_0x59d0('0x3b')](_0x2aaea8['model'],qs[_0x59d0('0x3d')](_0x2767a6[_0x59d0('0x38')][_0x59d0('0x3d')]));_0x1d7fa4['attributes']=_0x1d7fa4[_0x59d0('0x3c')][_0x59d0('0x3e')]?_0x1d7fa4[_0x59d0('0x3c')]:_0x2aaea8[_0x59d0('0x37')];if(!_0x2767a6['query']['hasOwnProperty'](_0x59d0('0x3f'))){_0x1d7fa4['limit']=qs[_0x59d0('0x40')](_0x2767a6[_0x59d0('0x38')]['limit']);_0x1d7fa4[_0x59d0('0x41')]=qs['offset'](_0x2767a6[_0x59d0('0x38')]['offset']);}_0x1d7fa4['order']=qs[_0x59d0('0x42')](_0x2767a6['query'][_0x59d0('0x42')]);_0x1d7fa4[_0x59d0('0x43')]=qs[_0x59d0('0x3a')](_[_0x59d0('0x44')](_0x2767a6['query'],_0x2aaea8['filters']),_0x144ece);if(_0x2767a6[_0x59d0('0x38')][_0x59d0('0x45')]){_0x1d7fa4[_0x59d0('0x43')]=_[_0x59d0('0x46')](_0x1d7fa4[_0x59d0('0x43')],{'$or':_[_0x59d0('0x47')](_0x144ece,function(_0x2a2682){if(_0x2a2682[_0x59d0('0x36')]!==_0x59d0('0x48')){var _0x390d19={};_0x390d19[_0x2a2682[_0x59d0('0x32')]]={'$like':'%'+_0x2767a6['query'][_0x59d0('0x45')]+'%'};return _0x390d19;}})});}_0x1d7fa4=_[_0x59d0('0x46')]({},_0x1d7fa4,_0x2767a6[_0x59d0('0x49')]);var _0x1439b3={'where':_0x1d7fa4[_0x59d0('0x43')]};return db[_0x59d0('0x34')]['count'](_0x1439b3)[_0x59d0('0x1f')](function(_0x158360){_0xa70558[_0x59d0('0x2b')]=_0x158360;if(_0x2767a6[_0x59d0('0x38')][_0x59d0('0x4a')]){_0x1d7fa4[_0x59d0('0x4b')]=[{'all':!![]}];}return db[_0x59d0('0x34')]['findAll'](_0x1d7fa4);})[_0x59d0('0x1f')](function(_0x19ed91){_0xa70558[_0x59d0('0x4c')]=_0x19ed91;return _0xa70558;})[_0x59d0('0x1f')](respondWithFilteredResult(_0x36c735,_0x1d7fa4))[_0x59d0('0x27')](handleError(_0x36c735,null));};exports[_0x59d0('0x4d')]=function(_0x2c5aec,_0x15c7dc){var _0x515d9e={'raw':![],'where':{'id':_0x2c5aec['params']['id']}},_0x552547={};_0x552547[_0x59d0('0x37')]=_[_0x59d0('0x39')](db[_0x59d0('0x34')][_0x59d0('0x4e')]);_0x552547[_0x59d0('0x38')]=_[_0x59d0('0x39')](_0x2c5aec[_0x59d0('0x38')]);_0x552547['filters']=_[_0x59d0('0x3b')](_0x552547[_0x59d0('0x37')],_0x552547[_0x59d0('0x38')]);_0x515d9e[_0x59d0('0x3c')]=_[_0x59d0('0x3b')](_0x552547[_0x59d0('0x37')],qs[_0x59d0('0x3d')](_0x2c5aec[_0x59d0('0x38')][_0x59d0('0x3d')]));_0x515d9e[_0x59d0('0x3c')]=_0x515d9e['attributes'][_0x59d0('0x3e')]?_0x515d9e['attributes']:_0x552547[_0x59d0('0x37')];if(_0x2c5aec[_0x59d0('0x38')][_0x59d0('0x4a')]){_0x515d9e[_0x59d0('0x4b')]=[{'all':!![]}];}_0x515d9e=_[_0x59d0('0x46')]({},_0x515d9e,_0x2c5aec['options']);return db[_0x59d0('0x34')][_0x59d0('0x4f')](_0x515d9e)[_0x59d0('0x1f')](handleEntityNotFound(_0x15c7dc,null))[_0x59d0('0x1f')](respondWithResult(_0x15c7dc,null))[_0x59d0('0x27')](handleError(_0x15c7dc,null));};exports[_0x59d0('0x50')]=function(_0x3729c5,_0x349be4){return db['SalesforceAccount']['create'](_0x3729c5['body'],{})[_0x59d0('0x1f')](respondWithResult(_0x349be4,0xc9))['catch'](handleError(_0x349be4,null));};exports[_0x59d0('0x2f')]=function(_0x3f89e8,_0x1e43d3){if(_0x3f89e8[_0x59d0('0x51')]['id']){delete _0x3f89e8[_0x59d0('0x51')]['id'];}return db[_0x59d0('0x34')]['find']({'where':{'id':_0x3f89e8[_0x59d0('0x52')]['id']}})[_0x59d0('0x1f')](handleEntityNotFound(_0x1e43d3,null))[_0x59d0('0x1f')](saveUpdates(_0x3f89e8[_0x59d0('0x51')],null))[_0x59d0('0x1f')](respondWithResult(_0x1e43d3,null))[_0x59d0('0x27')](handleError(_0x1e43d3,null));};exports[_0x59d0('0x30')]=function(_0x299340,_0x28823e){return db[_0x59d0('0x34')]['find']({'where':{'id':_0x299340[_0x59d0('0x52')]['id']}})[_0x59d0('0x1f')](handleEntityNotFound(_0x28823e,null))[_0x59d0('0x1f')](removeEntity(_0x28823e,null))['catch'](handleError(_0x28823e,null));};exports[_0x59d0('0x53')]=function(_0x3e54d0,_0x3caf01,_0x8039dc){var _0x1b5bb1={};var _0x583815={};var _0x3bb70b;var _0x1e0638;return db['SalesforceAccount']['findOne']({'where':{'id':_0x3e54d0[_0x59d0('0x52')]['id']}})[_0x59d0('0x1f')](handleEntityNotFound(_0x3caf01,null))[_0x59d0('0x1f')](function(_0x186794){if(_0x186794){_0x3bb70b=_0x186794;_0x583815[_0x59d0('0x37')]=_[_0x59d0('0x39')](db[_0x59d0('0x54')][_0x59d0('0x4e')]);_0x583815[_0x59d0('0x38')]=_[_0x59d0('0x39')](_0x3e54d0[_0x59d0('0x38')]);_0x583815[_0x59d0('0x3a')]=_['intersection'](_0x583815['model'],_0x583815[_0x59d0('0x38')]);_0x1b5bb1['attributes']=_[_0x59d0('0x3b')](_0x583815[_0x59d0('0x37')],qs['fields'](_0x3e54d0[_0x59d0('0x38')][_0x59d0('0x3d')]));_0x1b5bb1[_0x59d0('0x3c')]=_0x1b5bb1['attributes'][_0x59d0('0x3e')]?_0x1b5bb1[_0x59d0('0x3c')]:_0x583815[_0x59d0('0x37')];_0x1b5bb1[_0x59d0('0x55')]=qs['sort'](_0x3e54d0[_0x59d0('0x38')][_0x59d0('0x42')]);_0x1b5bb1['where']=qs[_0x59d0('0x3a')](_[_0x59d0('0x44')](_0x3e54d0[_0x59d0('0x38')],_0x583815[_0x59d0('0x3a')]));if(_0x3e54d0[_0x59d0('0x38')]['filter']){_0x1b5bb1[_0x59d0('0x43')]=_[_0x59d0('0x46')](_0x1b5bb1[_0x59d0('0x43')],{'$or':_[_0x59d0('0x47')](_0x1b5bb1[_0x59d0('0x3c')],function(_0x4e12af){var _0x46c16d={};_0x46c16d[_0x4e12af]={'$like':'%'+_0x3e54d0[_0x59d0('0x38')][_0x59d0('0x45')]+'%'};return _0x46c16d;})});}_0x1b5bb1=_[_0x59d0('0x46')]({},_0x1b5bb1,_0x3e54d0[_0x59d0('0x49')]);return _0x3bb70b[_0x59d0('0x53')](_0x1b5bb1);}})[_0x59d0('0x1f')](function(_0x4d7d88){if(_0x4d7d88){_0x1e0638=_0x4d7d88[_0x59d0('0x3e')];if(!_0x3e54d0[_0x59d0('0x38')][_0x59d0('0x56')]('nolimit')){_0x1b5bb1[_0x59d0('0x40')]=qs[_0x59d0('0x40')](_0x3e54d0['query']['limit']);_0x1b5bb1[_0x59d0('0x41')]=qs[_0x59d0('0x41')](_0x3e54d0[_0x59d0('0x38')][_0x59d0('0x41')]);}return _0x3bb70b[_0x59d0('0x53')](_0x1b5bb1);}})[_0x59d0('0x1f')](function(_0x1899d6){if(_0x1899d6){return _0x1899d6?{'count':_0x1e0638,'rows':_0x1899d6}:null;}})['then'](respondWithResult(_0x3caf01,null))[_0x59d0('0x27')](handleError(_0x3caf01,null));};exports['addConfiguration']=function(_0x34349b,_0xc973aa,_0x113f7e){if(_0x34349b['body']['id']){delete _0x34349b['body']['id'];}return db[_0x59d0('0x34')][_0x59d0('0x57')]({'where':{'id':_0x34349b[_0x59d0('0x52')]['id']}})['then'](handleEntityNotFound(_0xc973aa,null))[_0x59d0('0x1f')](function(_0x714783){if(_0x714783){_0x34349b[_0x59d0('0x51')][_0x59d0('0x58')]=_0x714783['id'];_0x34349b[_0x59d0('0x51')][_0x59d0('0x59')]=integrations[_0x59d0('0x5a')](_0x34349b[_0x59d0('0x51')][_0x59d0('0x5b')],_0x34349b[_0x59d0('0x51')][_0x59d0('0x36')]);_0x34349b[_0x59d0('0x51')][_0x59d0('0x5c')]=integrations[_0x59d0('0x5d')](_0x34349b[_0x59d0('0x51')]['channel'],_0x34349b[_0x59d0('0x51')]['type']);return db[_0x59d0('0x54')][_0x59d0('0x50')](_0x34349b[_0x59d0('0x51')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x59d0('0x5e')],'as':'Descriptions'}]});}return null;})[_0x59d0('0x1f')](respondWithResult(_0xc973aa,null))[_0x59d0('0x27')](handleError(_0xc973aa,null));};exports['getFields']=function(_0x5d1720,_0x279694,_0x7b0a56){var _0x5d6ca7;var _0xbdce0a='';var _0x43775d=_0x59d0('0x5f');return db[_0x59d0('0x34')][_0x59d0('0x57')]({'where':{'id':_0x5d1720[_0x59d0('0x52')]['id']},'attributes':['id',_0x59d0('0x60'),_0x59d0('0x61'),_0x59d0('0x62'),_0x59d0('0x63'),'password',_0x59d0('0x64')]})[_0x59d0('0x1f')](handleEntityNotFound(_0x279694,null))['then'](function(_0x1c66b8){if(_0x1c66b8){_0xbdce0a=_0x1c66b8[_0x59d0('0x60')];var _0x3b6891=_0xbdce0a[_0x59d0('0x65')](-0x1);if(_0x3b6891==='/'){_0xbdce0a=_0xbdce0a[_0x59d0('0x66')](0x0,_0xbdce0a[_0x59d0('0x67')](_0x3b6891));}_0x5d6ca7=new jsforce[(_0x59d0('0x68'))]({'oauth2':{'loginUrl':_0xbdce0a,'clientId':_0x1c66b8[_0x59d0('0x61')],'clientSecret':_0x1c66b8[_0x59d0('0x62')]}});return _0x5d6ca7[_0x59d0('0x69')](_0x1c66b8[_0x59d0('0x63')],_0x1c66b8[_0x59d0('0x6a')][_0x59d0('0x6b')](_0x1c66b8[_0x59d0('0x64')]));}})['then'](function(_0x251f68){if(_0x251f68){if(!_[_0x59d0('0x6c')](_0x5d1720['query'][_0x59d0('0x6d')])){_0x43775d=_0x5d1720[_0x59d0('0x38')][_0x59d0('0x6d')];}return _0x5d6ca7[_0x59d0('0x6e')](_0x43775d)[_0x59d0('0x6f')]();}})[_0x59d0('0x1f')](function(_0x45c7fe){var _0x160b5c=[_0x59d0('0x70'),_0x59d0('0x71'),_0x59d0('0x72'),_0x59d0('0x73'),_0x59d0('0x74'),_0x59d0('0x75'),_0x59d0('0x76'),_0x59d0('0x77')];if(!_[_0x59d0('0x6c')](_0x5d1720[_0x59d0('0x38')][_0x59d0('0x6d')])&&_0x5d1720[_0x59d0('0x38')]['ticketType']==='Case'){_0x160b5c=[_0x59d0('0x77'),_0x59d0('0x78'),_0x59d0('0x79'),_0x59d0('0x76'),_0x59d0('0x75'),'IsEscalated','SuppliedName',_0x59d0('0x7a')];}if(_0x45c7fe){_[_0x59d0('0x7b')](_0x45c7fe[_0x59d0('0x3d')],function(_0x2ff75f){return _0x2ff75f[_0x59d0('0x7c')]===![]&&!_0x160b5c['includes'](_0x2ff75f[_0x59d0('0x32')]);});return{'count':_0x45c7fe[_0x59d0('0x3d')][_0x59d0('0x3e')],'rows':_[_0x59d0('0x47')](_0x45c7fe[_0x59d0('0x3d')],function(_0x1bcb6d){return{'id':_0x1bcb6d[_0x59d0('0x32')],'name':_0x1bcb6d[_0x59d0('0x7d')],'custom':_0x1bcb6d['custom'],'options':_0x1bcb6d['picklistValues'][_0x59d0('0x3e')]>0x0?_['map'](_0x1bcb6d[_0x59d0('0x7e')],function(_0x3b9411){return{'name':_0x3b9411[_0x59d0('0x7d')],'value':_0x3b9411[_0x59d0('0x7f')]};}):_0x1bcb6d['type']==_0x59d0('0x80')?[{'name':_0x59d0('0x81'),'value':_0x59d0('0x82')},{'name':_0x59d0('0x83'),'value':_0x59d0('0x84')}]:[]};})};}})[_0x59d0('0x1f')](respondWithResult(_0x279694,null))[_0x59d0('0x27')](function(_0x36a5a2){var _0x2c1e6e=_0x5d1720['query'][_0x59d0('0x1a')]?0x1f4:_0x36a5a2['statusCode']||0x1f4;logger[_0x59d0('0x24')](_0x59d0('0x85'),_0x59d0('0x86'),_0x2c1e6e,JSON[_0x59d0('0x87')](_0x36a5a2));delete _0x36a5a2['name'];if(_0x2c1e6e===0x191){_0x2c1e6e=0x190;}_0x279694[_0x59d0('0x29')](_0x2c1e6e)[_0x59d0('0x33')](_0x5d1720['query'][_0x59d0('0x1a')]?{'message':_0x59d0('0x88'),'statusCode':_0x36a5a2[_0x59d0('0x89')]}:_0x36a5a2);});}; \ No newline at end of file +var _0x2363=['Type','Reason','IsEscalated','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','count','include','findAll','rows','show','params','length','includeAll','options','find','body','getConfigurations','SalesforceConfiguration','filter','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','create','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','IsArchived','Priority','Status','Case'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x2363,0x12f));var _0x3236=function(_0x177791,_0x8159e3){_0x177791=_0x177791-0x0;var _0x4ac782=_0x2363[_0x177791];return _0x4ac782;};'use strict';var pdf=require(_0x3236('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3236('0x1'));var zipdir=require(_0x3236('0x2'));var jsonpatch=require(_0x3236('0x3'));var rp=require('request-promise');var moment=require(_0x3236('0x4'));var BPromise=require(_0x3236('0x5'));var Mustache=require(_0x3236('0x6'));var util=require(_0x3236('0x7'));var path=require(_0x3236('0x8'));var sox=require(_0x3236('0x9'));var csv=require(_0x3236('0xa'));var ejs=require(_0x3236('0xb'));var fs=require('fs');var _=require(_0x3236('0xc'));var squel=require(_0x3236('0xd'));var crypto=require(_0x3236('0xe'));var jsforce=require(_0x3236('0xf'));var deskjs=require(_0x3236('0x10'));var toCsv=require(_0x3236('0xa'));var querystring=require(_0x3236('0x11'));var Papa=require(_0x3236('0x12'));var Redis=require(_0x3236('0x13'));var authService=require(_0x3236('0x14'));var qs=require(_0x3236('0x15'));var as=require(_0x3236('0x16'));var hardwareService=require(_0x3236('0x17'));var logger=require(_0x3236('0x18'))(_0x3236('0x19'));var utils=require(_0x3236('0x1a'));var config=require(_0x3236('0x1b'));var db=require(_0x3236('0x1c'))['db'];var integrations=require(_0x3236('0x1d'));var jayson=require('jayson/promise');var client=jayson[_0x3236('0x1e')][_0x3236('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x14c597,_0x1da31d,_0x1a69c8){if(_0x1a69c8){var _0x51d60f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51d60f[_0x3236('0x20')](_0x1da31d)){return _0x14c597;}else{throw new db[(_0x3236('0x21'))][(_0x3236('0x22'))](_0x3236('0x23'));}}else{return _0x14c597;}}function respondWithRpcPromise(_0x38ded0,_0x398488,_0x5aef6a,_0x346827){return new BPromise(function(_0xd041da,_0x1ff811){var _0x536f50=_0x346827||client;return _0x536f50['request'](_0x38ded0,_0x5aef6a)[_0x3236('0x24')](function(_0x9ebbb){logger[_0x3236('0x25')](_0x3236('0x26'),_0x398488,_0x3236('0x27'));logger[_0x3236('0x28')](_0x3236('0x29'),_0x398488,_0x3236('0x27'),JSON[_0x3236('0x2a')](_0x9ebbb));if(_0x9ebbb[_0x3236('0x2b')]){if(_0x9ebbb[_0x3236('0x2b')]['code']===0x1f4){logger['error'](_0x3236('0x26'),_0x398488,_0x9ebbb[_0x3236('0x2b')][_0x3236('0x2c')]);return _0x1ff811(_0x9ebbb['error']['message']);}logger[_0x3236('0x2b')](_0x3236('0x26'),_0x398488,_0x9ebbb['error'][_0x3236('0x2c')]);return _0xd041da(_0x9ebbb['error']['message']);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x398488,_0x3236('0x27'));_0xd041da(_0x9ebbb['result']['message']);}})[_0x3236('0x2d')](function(_0x1214eb){logger[_0x3236('0x2b')](_0x3236('0x26'),_0x398488,_0x1214eb);_0x1ff811(_0x1214eb);});});}function respondWithStatusCode(_0x39ee16,_0x2ed1d5){_0x2ed1d5=_0x2ed1d5||0xcc;return function(_0x25fd57){if(_0x25fd57){return _0x39ee16[_0x3236('0x2e')](_0x2ed1d5);}return _0x39ee16[_0x3236('0x2f')](_0x2ed1d5)[_0x3236('0x30')]();};}function respondWithResult(_0x1b4c40,_0x278b55){_0x278b55=_0x278b55||0xc8;return function(_0x1d7857){if(_0x1d7857){return _0x1b4c40[_0x3236('0x2f')](_0x278b55)[_0x3236('0x31')](_0x1d7857);}};}function respondWithFilteredResult(_0x383de3,_0x2735c3){return function(_0xcc2280){if(_0xcc2280){var _0x89ac65=_0xcc2280['count'],_0x41b8ae=_0x2735c3[_0x3236('0x32')],_0x2a03ee=_0x2735c3['offset']+_0x2735c3['limit'],_0x775561;if(_0x2a03ee>=_0x89ac65){_0x2a03ee=_0x89ac65;_0x775561=0xc8;}else{_0x775561=0xce;}_0x383de3[_0x3236('0x2f')](_0x775561);return _0x383de3['set'](_0x3236('0x33'),_0x41b8ae+'-'+_0x2a03ee+'/'+_0x89ac65)[_0x3236('0x31')](_0xcc2280);}return null;};}function patchUpdates(_0x38d530){return function(_0x34ee9b){try{jsonpatch[_0x3236('0x34')](_0x34ee9b,_0x38d530,!![]);}catch(_0x29f423){return BPromise[_0x3236('0x35')](_0x29f423);}return _0x34ee9b[_0x3236('0x36')]();};}function saveUpdates(_0x2e61f9,_0x2e8afe){return function(_0x333afb){if(_0x333afb){return _0x333afb[_0x3236('0x37')](_0x2e61f9)['then'](function(_0x396808){return _0x396808;});}return null;};}function removeEntity(_0x3eb13c,_0x3214af){return function(_0x3b5ffd){if(_0x3b5ffd){return _0x3b5ffd[_0x3236('0x38')]()[_0x3236('0x24')](function(){_0x3eb13c[_0x3236('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c5c21,_0x4abe67){return function(_0x25037b){if(!_0x25037b){_0x5c5c21[_0x3236('0x2e')](0x194);}return _0x25037b;};}function handleError(_0x45bbb7,_0x2bd5fe){_0x2bd5fe=_0x2bd5fe||0x1f4;return function(_0xeb8874){logger['error'](_0xeb8874[_0x3236('0x39')]);if(_0xeb8874[_0x3236('0x3a')]){delete _0xeb8874[_0x3236('0x3a')];}_0x45bbb7['status'](_0x2bd5fe)[_0x3236('0x3b')](_0xeb8874);};}exports[_0x3236('0x3c')]=function(_0x167371,_0x53d510){var _0x19c50d={},_0x150356={},_0x4b1132={'count':0x0,'rows':[]};var _0x5ce805=_['map'](db[_0x3236('0x3d')][_0x3236('0x3e')],function(_0x5c174d){return{'name':_0x5c174d['fieldName'],'type':_0x5c174d[_0x3236('0x3f')][_0x3236('0x40')]};});_0x150356[_0x3236('0x41')]=_[_0x3236('0x42')](_0x5ce805,_0x3236('0x3a'));_0x150356[_0x3236('0x43')]=_[_0x3236('0x44')](_0x167371[_0x3236('0x43')]);_0x150356['filters']=_[_0x3236('0x45')](_0x150356[_0x3236('0x41')],_0x150356[_0x3236('0x43')]);_0x19c50d[_0x3236('0x46')]=_[_0x3236('0x45')](_0x150356[_0x3236('0x41')],qs[_0x3236('0x47')](_0x167371[_0x3236('0x43')][_0x3236('0x47')]));_0x19c50d['attributes']=_0x19c50d[_0x3236('0x46')]['length']?_0x19c50d[_0x3236('0x46')]:_0x150356['model'];if(!_0x167371[_0x3236('0x43')][_0x3236('0x48')](_0x3236('0x49'))){_0x19c50d[_0x3236('0x4a')]=qs[_0x3236('0x4a')](_0x167371[_0x3236('0x43')][_0x3236('0x4a')]);_0x19c50d[_0x3236('0x32')]=qs[_0x3236('0x32')](_0x167371[_0x3236('0x43')][_0x3236('0x32')]);}_0x19c50d[_0x3236('0x4b')]=qs[_0x3236('0x4c')](_0x167371[_0x3236('0x43')][_0x3236('0x4c')]);_0x19c50d[_0x3236('0x4d')]=qs[_0x3236('0x4e')](_[_0x3236('0x4f')](_0x167371[_0x3236('0x43')],_0x150356[_0x3236('0x4e')]),_0x5ce805);if(_0x167371[_0x3236('0x43')]['filter']){_0x19c50d[_0x3236('0x4d')]=_[_0x3236('0x50')](_0x19c50d[_0x3236('0x4d')],{'$or':_[_0x3236('0x42')](_0x5ce805,function(_0x376094){if(_0x376094[_0x3236('0x3f')]!==_0x3236('0x51')){var _0x1d4d38={};_0x1d4d38[_0x376094[_0x3236('0x3a')]]={'$like':'%'+_0x167371[_0x3236('0x43')]['filter']+'%'};return _0x1d4d38;}})});}_0x19c50d=_['merge']({},_0x19c50d,_0x167371['options']);var _0x29ded6={'where':_0x19c50d[_0x3236('0x4d')]};return db['SalesforceAccount'][_0x3236('0x52')](_0x29ded6)[_0x3236('0x24')](function(_0x4f0e72){_0x4b1132[_0x3236('0x52')]=_0x4f0e72;if(_0x167371[_0x3236('0x43')]['includeAll']){_0x19c50d[_0x3236('0x53')]=[{'all':!![]}];}return db[_0x3236('0x3d')][_0x3236('0x54')](_0x19c50d);})['then'](function(_0x3765a1){_0x4b1132[_0x3236('0x55')]=_0x3765a1;return _0x4b1132;})[_0x3236('0x24')](respondWithFilteredResult(_0x53d510,_0x19c50d))['catch'](handleError(_0x53d510,null));};exports[_0x3236('0x56')]=function(_0x193c96,_0xe81f29){var _0x19212b={'raw':![],'where':{'id':_0x193c96[_0x3236('0x57')]['id']}},_0x4d5438={};_0x4d5438[_0x3236('0x41')]=_[_0x3236('0x44')](db[_0x3236('0x3d')][_0x3236('0x3e')]);_0x4d5438[_0x3236('0x43')]=_[_0x3236('0x44')](_0x193c96[_0x3236('0x43')]);_0x4d5438[_0x3236('0x4e')]=_['intersection'](_0x4d5438[_0x3236('0x41')],_0x4d5438['query']);_0x19212b[_0x3236('0x46')]=_[_0x3236('0x45')](_0x4d5438[_0x3236('0x41')],qs[_0x3236('0x47')](_0x193c96[_0x3236('0x43')]['fields']));_0x19212b[_0x3236('0x46')]=_0x19212b[_0x3236('0x46')][_0x3236('0x58')]?_0x19212b[_0x3236('0x46')]:_0x4d5438[_0x3236('0x41')];if(_0x193c96[_0x3236('0x43')][_0x3236('0x59')]){_0x19212b['include']=[{'all':!![]}];}_0x19212b=_['merge']({},_0x19212b,_0x193c96[_0x3236('0x5a')]);return db['SalesforceAccount'][_0x3236('0x5b')](_0x19212b)[_0x3236('0x24')](handleEntityNotFound(_0xe81f29,null))[_0x3236('0x24')](respondWithResult(_0xe81f29,null))[_0x3236('0x2d')](handleError(_0xe81f29,null));};exports['create']=function(_0x13a007,_0x21df9f){return db[_0x3236('0x3d')]['create'](_0x13a007['body'],{})['then'](respondWithResult(_0x21df9f,0xc9))['catch'](handleError(_0x21df9f,null));};exports[_0x3236('0x37')]=function(_0x49650e,_0x2dd8c8){if(_0x49650e[_0x3236('0x5c')]['id']){delete _0x49650e[_0x3236('0x5c')]['id'];}return db['SalesforceAccount'][_0x3236('0x5b')]({'where':{'id':_0x49650e[_0x3236('0x57')]['id']}})[_0x3236('0x24')](handleEntityNotFound(_0x2dd8c8,null))[_0x3236('0x24')](saveUpdates(_0x49650e[_0x3236('0x5c')],null))['then'](respondWithResult(_0x2dd8c8,null))[_0x3236('0x2d')](handleError(_0x2dd8c8,null));};exports['destroy']=function(_0xc2f286,_0x5e55ec){return db[_0x3236('0x3d')][_0x3236('0x5b')]({'where':{'id':_0xc2f286[_0x3236('0x57')]['id']}})[_0x3236('0x24')](handleEntityNotFound(_0x5e55ec,null))[_0x3236('0x24')](removeEntity(_0x5e55ec,null))[_0x3236('0x2d')](handleError(_0x5e55ec,null));};exports[_0x3236('0x5d')]=function(_0x56b88f,_0x2afc7f,_0x574b59){var _0x379d81={};var _0x34aea0={};var _0x3a2346;var _0x4609c5;return db[_0x3236('0x3d')]['findOne']({'where':{'id':_0x56b88f[_0x3236('0x57')]['id']}})[_0x3236('0x24')](handleEntityNotFound(_0x2afc7f,null))[_0x3236('0x24')](function(_0x3f8fdf){if(_0x3f8fdf){_0x3a2346=_0x3f8fdf;_0x34aea0[_0x3236('0x41')]=_['keys'](db[_0x3236('0x5e')][_0x3236('0x3e')]);_0x34aea0[_0x3236('0x43')]=_[_0x3236('0x44')](_0x56b88f[_0x3236('0x43')]);_0x34aea0[_0x3236('0x4e')]=_[_0x3236('0x45')](_0x34aea0[_0x3236('0x41')],_0x34aea0[_0x3236('0x43')]);_0x379d81[_0x3236('0x46')]=_[_0x3236('0x45')](_0x34aea0[_0x3236('0x41')],qs[_0x3236('0x47')](_0x56b88f[_0x3236('0x43')][_0x3236('0x47')]));_0x379d81[_0x3236('0x46')]=_0x379d81['attributes'][_0x3236('0x58')]?_0x379d81[_0x3236('0x46')]:_0x34aea0[_0x3236('0x41')];_0x379d81['order']=qs[_0x3236('0x4c')](_0x56b88f[_0x3236('0x43')]['sort']);_0x379d81[_0x3236('0x4d')]=qs[_0x3236('0x4e')](_['pick'](_0x56b88f[_0x3236('0x43')],_0x34aea0['filters']));if(_0x56b88f[_0x3236('0x43')][_0x3236('0x5f')]){_0x379d81[_0x3236('0x4d')]=_[_0x3236('0x50')](_0x379d81[_0x3236('0x4d')],{'$or':_[_0x3236('0x42')](_0x379d81['attributes'],function(_0x451dad){var _0x19286e={};_0x19286e[_0x451dad]={'$like':'%'+_0x56b88f[_0x3236('0x43')][_0x3236('0x5f')]+'%'};return _0x19286e;})});}_0x379d81=_[_0x3236('0x50')]({},_0x379d81,_0x56b88f['options']);return _0x3a2346[_0x3236('0x5d')](_0x379d81);}})[_0x3236('0x24')](function(_0x4c6e7f){if(_0x4c6e7f){_0x4609c5=_0x4c6e7f['length'];if(!_0x56b88f[_0x3236('0x43')]['hasOwnProperty'](_0x3236('0x49'))){_0x379d81[_0x3236('0x4a')]=qs[_0x3236('0x4a')](_0x56b88f[_0x3236('0x43')][_0x3236('0x4a')]);_0x379d81[_0x3236('0x32')]=qs[_0x3236('0x32')](_0x56b88f[_0x3236('0x43')][_0x3236('0x32')]);}return _0x3a2346[_0x3236('0x5d')](_0x379d81);}})[_0x3236('0x24')](function(_0x471c8e){if(_0x471c8e){return _0x471c8e?{'count':_0x4609c5,'rows':_0x471c8e}:null;}})[_0x3236('0x24')](respondWithResult(_0x2afc7f,null))[_0x3236('0x2d')](handleError(_0x2afc7f,null));};exports['addConfiguration']=function(_0x2dfd42,_0x1aa359,_0x5334ce){if(_0x2dfd42[_0x3236('0x5c')]['id']){delete _0x2dfd42[_0x3236('0x5c')]['id'];}return db['SalesforceAccount'][_0x3236('0x60')]({'where':{'id':_0x2dfd42[_0x3236('0x57')]['id']}})[_0x3236('0x24')](handleEntityNotFound(_0x1aa359,null))[_0x3236('0x24')](function(_0x2a10fc){if(_0x2a10fc){_0x2dfd42[_0x3236('0x5c')][_0x3236('0x61')]=_0x2a10fc['id'];_0x2dfd42[_0x3236('0x5c')][_0x3236('0x62')]=integrations[_0x3236('0x63')](_0x2dfd42[_0x3236('0x5c')][_0x3236('0x64')],_0x2dfd42[_0x3236('0x5c')][_0x3236('0x3f')]);_0x2dfd42[_0x3236('0x5c')][_0x3236('0x65')]=integrations['getDescriptions'](_0x2dfd42[_0x3236('0x5c')][_0x3236('0x64')],_0x2dfd42[_0x3236('0x5c')]['type']);return db[_0x3236('0x5e')][_0x3236('0x66')](_0x2dfd42[_0x3236('0x5c')],{'include':[{'model':db['SalesforceField'],'as':_0x3236('0x62')},{'model':db[_0x3236('0x67')],'as':_0x3236('0x65')}]});}return null;})[_0x3236('0x24')](respondWithResult(_0x1aa359,null))[_0x3236('0x2d')](handleError(_0x1aa359,null));};exports[_0x3236('0x68')]=function(_0x3e32b8,_0x3a2f35,_0x480469){var _0x18e8e2;var _0x5daf3f='';var _0x2f4054='Task';return db['SalesforceAccount'][_0x3236('0x60')]({'where':{'id':_0x3e32b8[_0x3236('0x57')]['id']},'attributes':['id',_0x3236('0x69'),_0x3236('0x6a'),_0x3236('0x6b'),_0x3236('0x6c'),_0x3236('0x6d'),_0x3236('0x6e')]})['then'](handleEntityNotFound(_0x3a2f35,null))[_0x3236('0x24')](function(_0x211219){if(_0x211219){_0x5daf3f=_0x211219[_0x3236('0x69')];var _0x35f155=_0x5daf3f['slice'](-0x1);if(_0x35f155==='/'){_0x5daf3f=_0x5daf3f[_0x3236('0x6f')](0x0,_0x5daf3f[_0x3236('0x70')](_0x35f155));}_0x18e8e2=new jsforce[(_0x3236('0x71'))]({'oauth2':{'loginUrl':_0x5daf3f,'clientId':_0x211219[_0x3236('0x6a')],'clientSecret':_0x211219['clientSecret']}});return _0x18e8e2[_0x3236('0x72')](_0x211219[_0x3236('0x6c')],_0x211219['password'][_0x3236('0x73')](_0x211219[_0x3236('0x6e')]));}})[_0x3236('0x24')](function(_0x49e352){if(_0x49e352){if(!_[_0x3236('0x74')](_0x3e32b8[_0x3236('0x43')][_0x3236('0x75')])){_0x2f4054=_0x3e32b8['query'][_0x3236('0x75')];}return _0x18e8e2[_0x3236('0x76')](_0x2f4054)[_0x3236('0x77')]();}})[_0x3236('0x24')](function(_0x1226aa){var _0x195715=[_0x3236('0x78'),_0x3236('0x79'),'CallObject','CallType',_0x3236('0x7a'),_0x3236('0x7b'),_0x3236('0x7c'),'Type'];if(!_['isNil'](_0x3e32b8['query']['ticketType'])&&_0x3e32b8[_0x3236('0x43')][_0x3236('0x75')]===_0x3236('0x7d')){_0x195715=[_0x3236('0x7e'),'Origin',_0x3236('0x7f'),_0x3236('0x7c'),_0x3236('0x7b'),_0x3236('0x80'),'SuppliedName',_0x3236('0x81')];}if(_0x1226aa){_[_0x3236('0x82')](_0x1226aa[_0x3236('0x47')],function(_0x18c21d){return _0x18c21d[_0x3236('0x83')]===![]&&!_0x195715[_0x3236('0x84')](_0x18c21d[_0x3236('0x3a')]);});return{'count':_0x1226aa[_0x3236('0x47')][_0x3236('0x58')],'rows':_[_0x3236('0x42')](_0x1226aa[_0x3236('0x47')],function(_0x544439){return{'id':_0x544439[_0x3236('0x3a')],'name':_0x544439[_0x3236('0x85')],'custom':_0x544439[_0x3236('0x83')],'options':_0x544439[_0x3236('0x86')][_0x3236('0x58')]>0x0?_[_0x3236('0x42')](_0x544439[_0x3236('0x86')],function(_0x324968){return{'name':_0x324968[_0x3236('0x85')],'value':_0x324968[_0x3236('0x87')]};}):_0x544439[_0x3236('0x3f')]==_0x3236('0x88')?[{'name':'True','value':_0x3236('0x89')},{'name':_0x3236('0x8a'),'value':_0x3236('0x8b')}]:[]};})};}})[_0x3236('0x24')](respondWithResult(_0x3a2f35,null))[_0x3236('0x2d')](function(_0x398ad6){var _0x2f8aa2=_0x3e32b8[_0x3236('0x43')][_0x3236('0x20')]?0x1f4:_0x398ad6[_0x3236('0x8c')]||0x1f4;logger[_0x3236('0x2b')](_0x3236('0x8d'),_0x3236('0x68'),_0x2f8aa2,JSON['stringify'](_0x398ad6));delete _0x398ad6[_0x3236('0x3a')];if(_0x2f8aa2===0x191){_0x2f8aa2=0x190;}_0x3a2f35[_0x3236('0x2f')](_0x2f8aa2)['send'](_0x3e32b8[_0x3236('0x43')][_0x3236('0x20')]?{'message':_0x3236('0x8e'),'statusCode':_0x398ad6[_0x3236('0x8c')]}:_0x398ad6);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 693bd9d..e91a036 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 _0xe49d=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','util','../../config/logger','api','moment','bluebird'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xe49d,0x97));var _0xde49=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe49d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xde49('0x0'));var logger=require(_0xde49('0x1'))(_0xde49('0x2'));var moment=require(_0xde49('0x3'));var BPromise=require(_0xde49('0x4'));var rp=require(_0xde49('0x5'));var fs=require('fs');var path=require(_0xde49('0x6'));var rimraf=require(_0xde49('0x7'));var config=require(_0xde49('0x8'));var attributes=require(_0xde49('0x9'));var integrations=require(_0xde49('0xa'));module[_0xde49('0xb')]=function(_0x44522c,_0x335927){return _0x44522c['define'](_0xde49('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf18b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger'];(function(_0xbcac71,_0x3990c0){var _0x3dadf0=function(_0x15fb91){while(--_0x15fb91){_0xbcac71['push'](_0xbcac71['shift']());}};_0x3dadf0(++_0x3990c0);}(_0xf18b,0x1df));var _0xbf18=function(_0x24eabe,_0x10c857){_0x24eabe=_0x24eabe-0x0;var _0x17481d=_0xf18b[_0x24eabe];return _0x17481d;};'use strict';var _=require('lodash');var util=require(_0xbf18('0x0'));var logger=require(_0xbf18('0x1'))('api');var moment=require(_0xbf18('0x2'));var BPromise=require(_0xbf18('0x3'));var rp=require(_0xbf18('0x4'));var fs=require('fs');var path=require(_0xbf18('0x5'));var rimraf=require(_0xbf18('0x6'));var config=require(_0xbf18('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xbf18('0x8'));module[_0xbf18('0x9')]=function(_0x40b5c1,_0x4ee426){return _0x40b5c1[_0xbf18('0xa')](_0xbf18('0xb'),attributes,{'tableName':_0xbf18('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 e15b0f2..69c06e7 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 _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','SalesforceAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2299f7,_0x263232){var _0x5f3e33=function(_0x17f6cd){while(--_0x17f6cd){_0x2299f7['push'](_0x2299f7['shift']());}};_0x5f3e33(++_0x263232);}(_0x41bb,0xc5));var _0xb41b=function(_0x4b7e47,_0x189172){_0x4b7e47=_0x4b7e47-0x0;var _0x31e388=_0x41bb[_0x4b7e47];return _0x31e388;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['SalesforceAccount'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetSalesforceAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowSalesforceAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file +var _0x2f68=['info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','map','model','ShowSalesforceAccount','find','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3cf14e,_0x23ae52){var _0x3db4be=function(_0x3dd16d){while(--_0x3dd16d){_0x3cf14e['push'](_0x3cf14e['shift']());}};_0x3db4be(++_0x23ae52);}(_0x2f68,0x9a));var _0x82f6=function(_0x2cc130,_0x44bb51){_0x2cc130=_0x2cc130-0x0;var _0xb8ecfa=_0x2f68[_0x2cc130];return _0xb8ecfa;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});}exports[_0x82f6('0x15')]=function(_0xcbc95f){var _0x4072f0=this;return new Promise(function(_0x2bfd57,_0x1c79f9){return db[_0x82f6('0x16')][_0x82f6('0x17')]({'raw':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['where']||null:null,'attributes':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x19')]||null:null,'limit':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f['options'][_0x82f6('0x1a')]||null:null,'include':_0xcbc95f['options']?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x1b')]?_['map'](_0xcbc95f['options'][_0x82f6('0x1b')],function(_0x1d96d5){return{'model':db[_0x1d96d5['model']],'as':_0x1d96d5['as'],'attributes':_0x1d96d5['attributes'],'include':_0x1d96d5[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x1d96d5['include'],function(_0xfd8b68){return{'model':db[_0xfd8b68[_0x82f6('0x1d')]],'as':_0xfd8b68['as'],'attributes':_0xfd8b68['attributes'],'include':_0xfd8b68['include']?_[_0x82f6('0x1c')](_0xfd8b68['include'],function(_0x469b6b){return{'model':db[_0x469b6b[_0x82f6('0x1d')]],'as':_0x469b6b['as'],'attributes':_0x469b6b['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x15c9b7){logger[_0x82f6('0xb')](_0x82f6('0x15'),_0xcbc95f);logger['debug'](_0x82f6('0x15'),_0xcbc95f,JSON[_0x82f6('0x10')](_0x15c9b7));_0x2bfd57(_0x15c9b7);})[_0x82f6('0x14')](function(_0x400137){logger[_0x82f6('0x11')](_0x82f6('0x15'),_0x400137[_0x82f6('0x12')],_0xcbc95f);_0x1c79f9(_0x4072f0[_0x82f6('0x11')](0x1f4,_0x400137[_0x82f6('0x12')]));});});};exports[_0x82f6('0x1e')]=function(_0x3c9419){var _0x20d1c5=this;return new Promise(function(_0x6ce179,_0x91117b){return db['SalesforceAccount'][_0x82f6('0x1f')]({'raw':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')][_0x82f6('0x20')]||null:null,'attributes':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')][_0x82f6('0x19')]||null:null,'include':_0x3c9419[_0x82f6('0x18')]?_0x3c9419[_0x82f6('0x18')][_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x3c9419[_0x82f6('0x18')][_0x82f6('0x1b')],function(_0x1e028a){return{'model':db[_0x1e028a[_0x82f6('0x1d')]],'as':_0x1e028a['as'],'attributes':_0x1e028a['attributes'],'include':_0x1e028a[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x1e028a[_0x82f6('0x1b')],function(_0x276451){return{'model':db[_0x276451[_0x82f6('0x1d')]],'as':_0x276451['as'],'attributes':_0x276451[_0x82f6('0x19')],'include':_0x276451[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x276451[_0x82f6('0x1b')],function(_0x30c6f8){return{'model':db[_0x30c6f8[_0x82f6('0x1d')]],'as':_0x30c6f8['as'],'attributes':_0x30c6f8[_0x82f6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x34665a){logger['info'](_0x82f6('0x1e'),_0x3c9419);logger['debug']('ShowSalesforceAccount',_0x3c9419,JSON[_0x82f6('0x10')](_0x34665a));_0x6ce179(_0x34665a);})[_0x82f6('0x14')](function(_0x5e8828){logger[_0x82f6('0x11')](_0x82f6('0x1e'),_0x5e8828[_0x82f6('0x12')],_0x3c9419);_0x91117b(_0x20d1c5['error'](0x1f4,_0x5e8828[_0x82f6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 197a9b3..2d8bea6 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 _0x8a6f=['update','exports','multer','util','path','Router','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0xeef54f,_0x3ff0dd){var _0x32d1bb=function(_0x829324){while(--_0x829324){_0xeef54f['push'](_0xeef54f['shift']());}};_0x32d1bb(++_0x3ff0dd);}(_0x8a6f,0x1d6));var _0xf8a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a6f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf8a6('0x0'));var util=require(_0xf8a6('0x1'));var path=require(_0xf8a6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf8a6('0x3')]();var auth=require(_0xf8a6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf8a6('0x5'));router[_0xf8a6('0x6')]('/',auth[_0xf8a6('0x7')](),controller[_0xf8a6('0x8')]);router['get'](_0xf8a6('0x9'),auth[_0xf8a6('0x7')](),controller['show']);router[_0xf8a6('0x6')]('/:id/fields',auth[_0xf8a6('0x7')](),controller[_0xf8a6('0xa')]);router[_0xf8a6('0x6')](_0xf8a6('0xb'),auth[_0xf8a6('0x7')](),controller['getSubjects']);router[_0xf8a6('0x6')](_0xf8a6('0xc'),auth[_0xf8a6('0x7')](),controller[_0xf8a6('0xd')]);router[_0xf8a6('0xe')]('/',auth['isAuthenticated'](),controller[_0xf8a6('0xf')]);router['put'](_0xf8a6('0x9'),auth[_0xf8a6('0x7')](),controller[_0xf8a6('0x10')]);router['delete']('/:id',auth[_0xf8a6('0x7')](),controller['destroy']);module[_0xf8a6('0x11')]=router; \ No newline at end of file +var _0x3903=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xd1a6d6,_0x724ef3){var _0x44672b=function(_0x4f9e5f){while(--_0x4f9e5f){_0xd1a6d6['push'](_0xd1a6d6['shift']());}};_0x44672b(++_0x724ef3);}(_0x3903,0xa0));var _0x3390=function(_0x32df1f,_0x228b18){_0x32df1f=_0x32df1f-0x0;var _0x41ef00=_0x3903[_0x32df1f];return _0x41ef00;};'use strict';var multer=require(_0x3390('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3390('0x1'));var express=require(_0x3390('0x2'));var router=express[_0x3390('0x3')]();var auth=require(_0x3390('0x4'));var interaction=require(_0x3390('0x5'));var config=require(_0x3390('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x3390('0x7')]('/',auth[_0x3390('0x8')](),controller[_0x3390('0x9')]);router[_0x3390('0x7')](_0x3390('0xa'),auth[_0x3390('0x8')](),controller[_0x3390('0xb')]);router[_0x3390('0x7')](_0x3390('0xc'),auth['isAuthenticated'](),controller[_0x3390('0xd')]);router[_0x3390('0x7')](_0x3390('0xe'),auth[_0x3390('0x8')](),controller[_0x3390('0xf')]);router[_0x3390('0x7')](_0x3390('0x10'),auth[_0x3390('0x8')](),controller['getDescriptions']);router[_0x3390('0x11')]('/',auth[_0x3390('0x8')](),controller['create']);router[_0x3390('0x12')](_0x3390('0xa'),auth[_0x3390('0x8')](),controller[_0x3390('0x13')]);router['delete'](_0x3390('0xa'),auth[_0x3390('0x8')](),controller[_0x3390('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 20d598b..82e5b0f 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 _0xdaff=['Task','Case','contact','lead','contact_lead','nothing','sequelize','exports','STRING','ENUM'];(function(_0x4116d0,_0x12f2d8){var _0x2b3db6=function(_0x41c1a2){while(--_0x41c1a2){_0x4116d0['push'](_0x4116d0['shift']());}};_0x2b3db6(++_0x12f2d8);}(_0xdaff,0x1a0));var _0xfdaf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdaff[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xfdaf('0x0'));module[_0xfdaf('0x1')]={'name':{'type':Sequelize[_0xfdaf('0x2')]},'description':{'type':Sequelize[_0xfdaf('0x2')]},'ticketType':{'type':Sequelize[_0xfdaf('0x3')](_0xfdaf('0x4'),_0xfdaf('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xfdaf('0x3')]('contact_lead',_0xfdaf('0x6'),_0xfdaf('0x7')),'defaultValue':_0xfdaf('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0xfdaf('0x9'),_0xfdaf('0x6'),_0xfdaf('0x7')),'defaultValue':_0xfdaf('0x7')}}; \ No newline at end of file +var _0x58e2=['contact_lead','lead','nothing','contact','sequelize','STRING','Case','Task','ENUM'];(function(_0x2ff876,_0x4d2ddd){var _0x57eac8=function(_0x49549c){while(--_0x49549c){_0x2ff876['push'](_0x2ff876['shift']());}};_0x57eac8(++_0x4d2ddd);}(_0x58e2,0x1d8));var _0x258e=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x58e2[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0x258e('0x0'));module['exports']={'name':{'type':Sequelize[_0x258e('0x1')]},'description':{'type':Sequelize[_0x258e('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x258e('0x2')),'defaultValue':_0x258e('0x3')},'moduleSearch':{'type':Sequelize[_0x258e('0x4')](_0x258e('0x5'),'contact',_0x258e('0x6')),'defaultValue':_0x258e('0x5')},'moduleCreate':{'type':Sequelize[_0x258e('0x4')](_0x258e('0x7'),_0x258e('0x8'),'lead'),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4c2a58c..a97f55e 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 _0xa4bf=['client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','name','send','index','map','fieldName','type','key','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','count','include','findAll','rows','show','params','model','rawAttributes','includeAll','create','body','find','SalesforceField','getFields','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise'];(function(_0x45013e,_0x16236f){var _0x4a839b=function(_0x4c0645){while(--_0x4c0645){_0x45013e['push'](_0x45013e['shift']());}};_0x4a839b(++_0x16236f);}(_0xa4bf,0xa7));var _0xfa4b=function(_0x5bffd7,_0x1ac4f4){_0x5bffd7=_0x5bffd7-0x0;var _0x48e5dd=_0xa4bf[_0x5bffd7];return _0x48e5dd;};'use strict';var pdf=require(_0xfa4b('0x0'));var emlformat=require(_0xfa4b('0x1'));var rimraf=require(_0xfa4b('0x2'));var zipdir=require(_0xfa4b('0x3'));var jsonpatch=require(_0xfa4b('0x4'));var rp=require(_0xfa4b('0x5'));var moment=require('moment');var BPromise=require(_0xfa4b('0x6'));var Mustache=require(_0xfa4b('0x7'));var util=require(_0xfa4b('0x8'));var path=require(_0xfa4b('0x9'));var sox=require('sox');var csv=require(_0xfa4b('0xa'));var ejs=require(_0xfa4b('0xb'));var fs=require('fs');var _=require(_0xfa4b('0xc'));var squel=require(_0xfa4b('0xd'));var crypto=require(_0xfa4b('0xe'));var jsforce=require(_0xfa4b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfa4b('0xa'));var querystring=require(_0xfa4b('0x10'));var Papa=require(_0xfa4b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfa4b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa4b('0x13'));var logger=require(_0xfa4b('0x14'))(_0xfa4b('0x15'));var utils=require(_0xfa4b('0x16'));var config=require(_0xfa4b('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfa4b('0x18'));var client=jayson[_0xfa4b('0x19')][_0xfa4b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4a1892,_0x556854,_0x339d65){if(_0x339d65){var _0x18dea8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18dea8[_0xfa4b('0x1b')](_0x556854)){return _0x4a1892;}else{throw new db[(_0xfa4b('0x1c'))][(_0xfa4b('0x1d'))](_0xfa4b('0x1e'));}}else{return _0x4a1892;}}function respondWithRpcPromise(_0x330657,_0x4f405e,_0x8c9a79,_0x1f5cdb){return new BPromise(function(_0x5e434d,_0x2a5dfd){var _0xb326cf=_0x1f5cdb||client;return _0xb326cf[_0xfa4b('0x1f')](_0x330657,_0x8c9a79)[_0xfa4b('0x20')](function(_0xdacf4){logger[_0xfa4b('0x21')](_0xfa4b('0x22'),_0x4f405e,_0xfa4b('0x23'));logger[_0xfa4b('0x24')](_0xfa4b('0x25'),_0x4f405e,'request\x20sent',JSON[_0xfa4b('0x26')](_0xdacf4));if(_0xdacf4['error']){if(_0xdacf4[_0xfa4b('0x27')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f405e,_0xdacf4[_0xfa4b('0x27')][_0xfa4b('0x28')]);return _0x2a5dfd(_0xdacf4[_0xfa4b('0x27')][_0xfa4b('0x28')]);}logger[_0xfa4b('0x27')](_0xfa4b('0x22'),_0x4f405e,_0xdacf4[_0xfa4b('0x27')][_0xfa4b('0x28')]);return _0x5e434d(_0xdacf4[_0xfa4b('0x27')][_0xfa4b('0x28')]);}else{logger[_0xfa4b('0x21')](_0xfa4b('0x22'),_0x4f405e,'request\x20sent');_0x5e434d(_0xdacf4[_0xfa4b('0x29')][_0xfa4b('0x28')]);}})[_0xfa4b('0x2a')](function(_0xa3df6d){logger[_0xfa4b('0x27')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f405e,_0xa3df6d);_0x2a5dfd(_0xa3df6d);});});}function respondWithStatusCode(_0x1107de,_0xc7cec4){_0xc7cec4=_0xc7cec4||0xcc;return function(_0x58fd89){if(_0x58fd89){return _0x1107de[_0xfa4b('0x2b')](_0xc7cec4);}return _0x1107de[_0xfa4b('0x2c')](_0xc7cec4)[_0xfa4b('0x2d')]();};}function respondWithResult(_0x2c48f6,_0x2d3ab4){_0x2d3ab4=_0x2d3ab4||0xc8;return function(_0x9781d9){if(_0x9781d9){return _0x2c48f6[_0xfa4b('0x2c')](_0x2d3ab4)[_0xfa4b('0x2e')](_0x9781d9);}};}function respondWithFilteredResult(_0x5b7496,_0x2bd875){return function(_0x3df681){if(_0x3df681){var _0x2a96c9=_0x3df681['count'],_0x13e86c=_0x2bd875[_0xfa4b('0x2f')],_0x2ff714=_0x2bd875[_0xfa4b('0x2f')]+_0x2bd875[_0xfa4b('0x30')],_0x3ae3d9;if(_0x2ff714>=_0x2a96c9){_0x2ff714=_0x2a96c9;_0x3ae3d9=0xc8;}else{_0x3ae3d9=0xce;}_0x5b7496['status'](_0x3ae3d9);return _0x5b7496[_0xfa4b('0x31')](_0xfa4b('0x32'),_0x13e86c+'-'+_0x2ff714+'/'+_0x2a96c9)[_0xfa4b('0x2e')](_0x3df681);}return null;};}function patchUpdates(_0x2e962a){return function(_0x4f3eac){try{jsonpatch['apply'](_0x4f3eac,_0x2e962a,!![]);}catch(_0x122687){return BPromise[_0xfa4b('0x33')](_0x122687);}return _0x4f3eac['save']();};}function saveUpdates(_0x2ab459,_0x50d8c4){return function(_0x3dae41){if(_0x3dae41){return _0x3dae41[_0xfa4b('0x34')](_0x2ab459)[_0xfa4b('0x20')](function(_0x2aa745){return _0x2aa745;});}return null;};}function removeEntity(_0x2a110b,_0x7912a1){return function(_0x35ec4d){if(_0x35ec4d){return _0x35ec4d[_0xfa4b('0x35')]()['then'](function(){_0x2a110b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42144e,_0x4d94be){return function(_0x38f542){if(!_0x38f542){_0x42144e[_0xfa4b('0x2b')](0x194);}return _0x38f542;};}function handleError(_0x89db94,_0x4c6335){_0x4c6335=_0x4c6335||0x1f4;return function(_0x5dc142){logger['error'](_0x5dc142['stack']);if(_0x5dc142['name']){delete _0x5dc142[_0xfa4b('0x36')];}_0x89db94[_0xfa4b('0x2c')](_0x4c6335)[_0xfa4b('0x37')](_0x5dc142);};}exports[_0xfa4b('0x38')]=function(_0x5ca72e,_0x235063){var _0x23644c={},_0x48f21d={},_0xb2f42={'count':0x0,'rows':[]};var _0x3c48a0=_[_0xfa4b('0x39')](db['SalesforceConfiguration']['rawAttributes'],function(_0x30aa3f){return{'name':_0x30aa3f[_0xfa4b('0x3a')],'type':_0x30aa3f[_0xfa4b('0x3b')][_0xfa4b('0x3c')]};});_0x48f21d['model']=_[_0xfa4b('0x39')](_0x3c48a0,_0xfa4b('0x36'));_0x48f21d['query']=_[_0xfa4b('0x3d')](_0x5ca72e['query']);_0x48f21d[_0xfa4b('0x3e')]=_[_0xfa4b('0x3f')](_0x48f21d['model'],_0x48f21d[_0xfa4b('0x40')]);_0x23644c['attributes']=_['intersection'](_0x48f21d['model'],qs[_0xfa4b('0x41')](_0x5ca72e[_0xfa4b('0x40')][_0xfa4b('0x41')]));_0x23644c[_0xfa4b('0x42')]=_0x23644c[_0xfa4b('0x42')][_0xfa4b('0x43')]?_0x23644c[_0xfa4b('0x42')]:_0x48f21d['model'];if(!_0x5ca72e[_0xfa4b('0x40')][_0xfa4b('0x44')](_0xfa4b('0x45'))){_0x23644c['limit']=qs['limit'](_0x5ca72e[_0xfa4b('0x40')][_0xfa4b('0x30')]);_0x23644c[_0xfa4b('0x2f')]=qs[_0xfa4b('0x2f')](_0x5ca72e['query'][_0xfa4b('0x2f')]);}_0x23644c[_0xfa4b('0x46')]=qs[_0xfa4b('0x47')](_0x5ca72e['query'][_0xfa4b('0x47')]);_0x23644c[_0xfa4b('0x48')]=qs[_0xfa4b('0x3e')](_[_0xfa4b('0x49')](_0x5ca72e[_0xfa4b('0x40')],_0x48f21d['filters']),_0x3c48a0);if(_0x5ca72e[_0xfa4b('0x40')][_0xfa4b('0x4a')]){_0x23644c['where']=_[_0xfa4b('0x4b')](_0x23644c[_0xfa4b('0x48')],{'$or':_[_0xfa4b('0x39')](_0x3c48a0,function(_0x184a51){if(_0x184a51[_0xfa4b('0x3b')]!==_0xfa4b('0x4c')){var _0x12de87={};_0x12de87[_0x184a51[_0xfa4b('0x36')]]={'$like':'%'+_0x5ca72e[_0xfa4b('0x40')][_0xfa4b('0x4a')]+'%'};return _0x12de87;}})});}_0x23644c=_[_0xfa4b('0x4b')]({},_0x23644c,_0x5ca72e[_0xfa4b('0x4d')]);var _0x672bdd={'where':_0x23644c['where']};return db[_0xfa4b('0x4e')][_0xfa4b('0x4f')](_0x672bdd)[_0xfa4b('0x20')](function(_0x2cc66b){_0xb2f42['count']=_0x2cc66b;if(_0x5ca72e[_0xfa4b('0x40')]['includeAll']){_0x23644c[_0xfa4b('0x50')]=[{'all':!![]}];}return db[_0xfa4b('0x4e')][_0xfa4b('0x51')](_0x23644c);})['then'](function(_0x10a7e9){_0xb2f42[_0xfa4b('0x52')]=_0x10a7e9;return _0xb2f42;})[_0xfa4b('0x20')](respondWithFilteredResult(_0x235063,_0x23644c))[_0xfa4b('0x2a')](handleError(_0x235063,null));};exports[_0xfa4b('0x53')]=function(_0x44ce1b,_0x20006c){var _0x118123={'raw':![],'where':{'id':_0x44ce1b[_0xfa4b('0x54')]['id']}},_0x37ef65={};_0x37ef65[_0xfa4b('0x55')]=_[_0xfa4b('0x3d')](db[_0xfa4b('0x4e')][_0xfa4b('0x56')]);_0x37ef65[_0xfa4b('0x40')]=_[_0xfa4b('0x3d')](_0x44ce1b[_0xfa4b('0x40')]);_0x37ef65[_0xfa4b('0x3e')]=_[_0xfa4b('0x3f')](_0x37ef65['model'],_0x37ef65[_0xfa4b('0x40')]);_0x118123[_0xfa4b('0x42')]=_['intersection'](_0x37ef65['model'],qs[_0xfa4b('0x41')](_0x44ce1b['query'][_0xfa4b('0x41')]));_0x118123[_0xfa4b('0x42')]=_0x118123[_0xfa4b('0x42')][_0xfa4b('0x43')]?_0x118123[_0xfa4b('0x42')]:_0x37ef65[_0xfa4b('0x55')];if(_0x44ce1b['query'][_0xfa4b('0x57')]){_0x118123[_0xfa4b('0x50')]=[{'all':!![]}];}_0x118123=_[_0xfa4b('0x4b')]({},_0x118123,_0x44ce1b[_0xfa4b('0x4d')]);return db[_0xfa4b('0x4e')]['find'](_0x118123)[_0xfa4b('0x20')](handleEntityNotFound(_0x20006c,null))[_0xfa4b('0x20')](respondWithResult(_0x20006c,null))[_0xfa4b('0x2a')](handleError(_0x20006c,null));};exports[_0xfa4b('0x58')]=function(_0x54b8fc,_0x2a1806){return db[_0xfa4b('0x4e')][_0xfa4b('0x58')](_0x54b8fc[_0xfa4b('0x59')],{})[_0xfa4b('0x20')](respondWithResult(_0x2a1806,0xc9))[_0xfa4b('0x2a')](handleError(_0x2a1806,null));};exports[_0xfa4b('0x34')]=function(_0x9bdf99,_0x22e6b4){if(_0x9bdf99[_0xfa4b('0x59')]['id']){delete _0x9bdf99[_0xfa4b('0x59')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x9bdf99[_0xfa4b('0x54')]['id']}})['then'](handleEntityNotFound(_0x22e6b4,null))[_0xfa4b('0x20')](saveUpdates(_0x9bdf99[_0xfa4b('0x59')],null))[_0xfa4b('0x20')](respondWithResult(_0x22e6b4,null))[_0xfa4b('0x2a')](handleError(_0x22e6b4,null));};exports[_0xfa4b('0x35')]=function(_0x24d121,_0xadb8f8){return db['SalesforceConfiguration'][_0xfa4b('0x5a')]({'where':{'id':_0x24d121['params']['id']}})[_0xfa4b('0x20')](handleEntityNotFound(_0xadb8f8,null))['then'](removeEntity(_0xadb8f8,null))[_0xfa4b('0x2a')](handleError(_0xadb8f8,null));};exports['getFields']=function(_0x50d76e,_0x4ff442,_0x2fd8c8){var _0x18f629={};var _0x7c27b2={};var _0x43b570;var _0x3e25d0;return db[_0xfa4b('0x4e')]['findOne']({'where':{'id':_0x50d76e[_0xfa4b('0x54')]['id']}})[_0xfa4b('0x20')](handleEntityNotFound(_0x4ff442,null))[_0xfa4b('0x20')](function(_0x21772d){if(_0x21772d){_0x43b570=_0x21772d;_0x7c27b2[_0xfa4b('0x55')]=_[_0xfa4b('0x3d')](db[_0xfa4b('0x5b')][_0xfa4b('0x56')]);_0x7c27b2[_0xfa4b('0x40')]=_[_0xfa4b('0x3d')](_0x50d76e['query']);_0x7c27b2[_0xfa4b('0x3e')]=_[_0xfa4b('0x3f')](_0x7c27b2[_0xfa4b('0x55')],_0x7c27b2[_0xfa4b('0x40')]);_0x18f629[_0xfa4b('0x42')]=_['intersection'](_0x7c27b2[_0xfa4b('0x55')],qs['fields'](_0x50d76e[_0xfa4b('0x40')][_0xfa4b('0x41')]));_0x18f629[_0xfa4b('0x42')]=_0x18f629[_0xfa4b('0x42')]['length']?_0x18f629['attributes']:_0x7c27b2[_0xfa4b('0x55')];_0x18f629[_0xfa4b('0x46')]=qs[_0xfa4b('0x47')](_0x50d76e[_0xfa4b('0x40')][_0xfa4b('0x47')]);_0x18f629['where']=qs[_0xfa4b('0x3e')](_[_0xfa4b('0x49')](_0x50d76e[_0xfa4b('0x40')],_0x7c27b2[_0xfa4b('0x3e')]));if(_0x50d76e[_0xfa4b('0x40')]['filter']){_0x18f629['where']=_['merge'](_0x18f629[_0xfa4b('0x48')],{'$or':_['map'](_0x18f629[_0xfa4b('0x42')],function(_0x2abfb5){var _0x3fa0b7={};_0x3fa0b7[_0x2abfb5]={'$like':'%'+_0x50d76e[_0xfa4b('0x40')][_0xfa4b('0x4a')]+'%'};return _0x3fa0b7;})});}_0x18f629=_[_0xfa4b('0x4b')]({},_0x18f629,_0x50d76e[_0xfa4b('0x4d')]);return _0x43b570[_0xfa4b('0x5c')](_0x18f629);}})[_0xfa4b('0x20')](function(_0x4273f4){if(_0x4273f4){_0x3e25d0=_0x4273f4[_0xfa4b('0x43')];if(!_0x50d76e[_0xfa4b('0x40')]['hasOwnProperty']('nolimit')){_0x18f629[_0xfa4b('0x30')]=qs[_0xfa4b('0x30')](_0x50d76e[_0xfa4b('0x40')][_0xfa4b('0x30')]);_0x18f629[_0xfa4b('0x2f')]=qs[_0xfa4b('0x2f')](_0x50d76e['query']['offset']);}return _0x43b570['getFields'](_0x18f629);}})[_0xfa4b('0x20')](function(_0x21a07f){if(_0x21a07f){return _0x21a07f?{'count':_0x3e25d0,'rows':_0x21a07f}:null;}})['then'](respondWithResult(_0x4ff442,null))[_0xfa4b('0x2a')](handleError(_0x4ff442,null));};exports[_0xfa4b('0x5d')]=function(_0x3de2f0,_0x36dfd6,_0x59d6e5){var _0x6c05b={};var _0x1b5429={};var _0x5ecac2;var _0xab6ea3;return db[_0xfa4b('0x4e')][_0xfa4b('0x5e')]({'where':{'id':_0x3de2f0[_0xfa4b('0x54')]['id']}})[_0xfa4b('0x20')](handleEntityNotFound(_0x36dfd6,null))[_0xfa4b('0x20')](function(_0x1eb7f1){if(_0x1eb7f1){_0x5ecac2=_0x1eb7f1;_0x1b5429[_0xfa4b('0x55')]=_[_0xfa4b('0x3d')](db['SalesforceField'][_0xfa4b('0x56')]);_0x1b5429['query']=_[_0xfa4b('0x3d')](_0x3de2f0['query']);_0x1b5429[_0xfa4b('0x3e')]=_['intersection'](_0x1b5429['model'],_0x1b5429[_0xfa4b('0x40')]);_0x6c05b[_0xfa4b('0x42')]=_[_0xfa4b('0x3f')](_0x1b5429[_0xfa4b('0x55')],qs[_0xfa4b('0x41')](_0x3de2f0['query'][_0xfa4b('0x41')]));_0x6c05b[_0xfa4b('0x42')]=_0x6c05b['attributes'][_0xfa4b('0x43')]?_0x6c05b[_0xfa4b('0x42')]:_0x1b5429[_0xfa4b('0x55')];_0x6c05b[_0xfa4b('0x46')]=qs[_0xfa4b('0x47')](_0x3de2f0[_0xfa4b('0x40')][_0xfa4b('0x47')]);_0x6c05b[_0xfa4b('0x48')]=qs['filters'](_[_0xfa4b('0x49')](_0x3de2f0['query'],_0x1b5429[_0xfa4b('0x3e')]));if(_0x3de2f0[_0xfa4b('0x40')][_0xfa4b('0x4a')]){_0x6c05b[_0xfa4b('0x48')]=_[_0xfa4b('0x4b')](_0x6c05b[_0xfa4b('0x48')],{'$or':_[_0xfa4b('0x39')](_0x6c05b[_0xfa4b('0x42')],function(_0x17aaa9){var _0x4c71e6={};_0x4c71e6[_0x17aaa9]={'$like':'%'+_0x3de2f0['query'][_0xfa4b('0x4a')]+'%'};return _0x4c71e6;})});}_0x6c05b=_[_0xfa4b('0x4b')]({},_0x6c05b,_0x3de2f0[_0xfa4b('0x4d')]);return _0x5ecac2[_0xfa4b('0x5d')](_0x6c05b);}})[_0xfa4b('0x20')](function(_0x2fb551){if(_0x2fb551){_0xab6ea3=_0x2fb551[_0xfa4b('0x43')];if(!_0x3de2f0[_0xfa4b('0x40')][_0xfa4b('0x44')](_0xfa4b('0x45'))){_0x6c05b['limit']=qs[_0xfa4b('0x30')](_0x3de2f0[_0xfa4b('0x40')]['limit']);_0x6c05b[_0xfa4b('0x2f')]=qs[_0xfa4b('0x2f')](_0x3de2f0[_0xfa4b('0x40')][_0xfa4b('0x2f')]);}return _0x5ecac2[_0xfa4b('0x5d')](_0x6c05b);}})['then'](function(_0x37b020){if(_0x37b020){return _0x37b020?{'count':_0xab6ea3,'rows':_0x37b020}:null;}})['then'](respondWithResult(_0x36dfd6,null))[_0xfa4b('0x2a')](handleError(_0x36dfd6,null));};exports[_0xfa4b('0x5f')]=function(_0x21cc8c,_0x163281,_0xa0dc58){var _0xf884ff={};var _0x1ff4a9={};var _0x4b5814;var _0x46e155;return db[_0xfa4b('0x4e')][_0xfa4b('0x5e')]({'where':{'id':_0x21cc8c[_0xfa4b('0x54')]['id']}})[_0xfa4b('0x20')](handleEntityNotFound(_0x163281,null))['then'](function(_0x3a8b1c){if(_0x3a8b1c){_0x4b5814=_0x3a8b1c;_0x1ff4a9[_0xfa4b('0x55')]=_[_0xfa4b('0x3d')](db[_0xfa4b('0x5b')]['rawAttributes']);_0x1ff4a9['query']=_[_0xfa4b('0x3d')](_0x21cc8c[_0xfa4b('0x40')]);_0x1ff4a9['filters']=_[_0xfa4b('0x3f')](_0x1ff4a9[_0xfa4b('0x55')],_0x1ff4a9[_0xfa4b('0x40')]);_0xf884ff['attributes']=_[_0xfa4b('0x3f')](_0x1ff4a9[_0xfa4b('0x55')],qs['fields'](_0x21cc8c[_0xfa4b('0x40')][_0xfa4b('0x41')]));_0xf884ff[_0xfa4b('0x42')]=_0xf884ff[_0xfa4b('0x42')]['length']?_0xf884ff['attributes']:_0x1ff4a9[_0xfa4b('0x55')];_0xf884ff['order']=qs[_0xfa4b('0x47')](_0x21cc8c[_0xfa4b('0x40')]['sort']);_0xf884ff[_0xfa4b('0x48')]=qs[_0xfa4b('0x3e')](_[_0xfa4b('0x49')](_0x21cc8c[_0xfa4b('0x40')],_0x1ff4a9[_0xfa4b('0x3e')]));if(_0x21cc8c['query'][_0xfa4b('0x4a')]){_0xf884ff[_0xfa4b('0x48')]=_[_0xfa4b('0x4b')](_0xf884ff[_0xfa4b('0x48')],{'$or':_['map'](_0xf884ff[_0xfa4b('0x42')],function(_0x250b03){var _0x2039b4={};_0x2039b4[_0x250b03]={'$like':'%'+_0x21cc8c[_0xfa4b('0x40')][_0xfa4b('0x4a')]+'%'};return _0x2039b4;})});}_0xf884ff=_[_0xfa4b('0x4b')]({},_0xf884ff,_0x21cc8c['options']);return _0x4b5814[_0xfa4b('0x5f')](_0xf884ff);}})[_0xfa4b('0x20')](function(_0x381463){if(_0x381463){_0x46e155=_0x381463[_0xfa4b('0x43')];if(!_0x21cc8c['query'][_0xfa4b('0x44')](_0xfa4b('0x45'))){_0xf884ff['limit']=qs['limit'](_0x21cc8c[_0xfa4b('0x40')][_0xfa4b('0x30')]);_0xf884ff[_0xfa4b('0x2f')]=qs[_0xfa4b('0x2f')](_0x21cc8c[_0xfa4b('0x40')][_0xfa4b('0x2f')]);}return _0x4b5814[_0xfa4b('0x5f')](_0xf884ff);}})[_0xfa4b('0x20')](function(_0x11206c){if(_0x11206c){return _0x11206c?{'count':_0x46e155,'rows':_0x11206c}:null;}})[_0xfa4b('0x20')](respondWithResult(_0x163281,null))[_0xfa4b('0x2a')](handleError(_0x163281,null));}; \ No newline at end of file +var _0x46cb=['hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','include','findAll','rows','show','params','includeAll','create','body','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46cb,0xd6));var _0xb46c=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x46cb[_0x479509];return _0x382da8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb46c('0x0'));var jsonpatch=require(_0xb46c('0x1'));var rp=require(_0xb46c('0x2'));var moment=require(_0xb46c('0x3'));var BPromise=require(_0xb46c('0x4'));var Mustache=require(_0xb46c('0x5'));var util=require(_0xb46c('0x6'));var path=require(_0xb46c('0x7'));var sox=require(_0xb46c('0x8'));var csv=require(_0xb46c('0x9'));var ejs=require(_0xb46c('0xa'));var fs=require('fs');var _=require(_0xb46c('0xb'));var squel=require(_0xb46c('0xc'));var crypto=require(_0xb46c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb46c('0xe'));var toCsv=require(_0xb46c('0x9'));var querystring=require(_0xb46c('0xf'));var Papa=require(_0xb46c('0x10'));var Redis=require(_0xb46c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb46c('0x12'));var logger=require(_0xb46c('0x13'))(_0xb46c('0x14'));var utils=require(_0xb46c('0x15'));var config=require(_0xb46c('0x16'));var db=require(_0xb46c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb46c('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x464456,_0x371f88,_0x5603b1){if(_0x5603b1){var _0x87cd7f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x87cd7f[_0xb46c('0x19')](_0x371f88)){return _0x464456;}else{throw new db[(_0xb46c('0x1a'))]['ValidationError'](_0xb46c('0x1b'));}}else{return _0x464456;}}function respondWithRpcPromise(_0x28f93e,_0x4ee554,_0x3455d7,_0x3d0381){return new BPromise(function(_0x4134d4,_0x41d8ab){var _0x2a2a8f=_0x3d0381||client;return _0x2a2a8f[_0xb46c('0x1c')](_0x28f93e,_0x3455d7)[_0xb46c('0x1d')](function(_0x1c8e0b){logger['info'](_0xb46c('0x1e'),_0x4ee554,_0xb46c('0x1f'));logger[_0xb46c('0x20')](_0xb46c('0x21'),_0x4ee554,'request\x20sent',JSON[_0xb46c('0x22')](_0x1c8e0b));if(_0x1c8e0b['error']){if(_0x1c8e0b[_0xb46c('0x23')][_0xb46c('0x24')]===0x1f4){logger[_0xb46c('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ee554,_0x1c8e0b[_0xb46c('0x23')][_0xb46c('0x25')]);return _0x41d8ab(_0x1c8e0b['error']['message']);}logger[_0xb46c('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ee554,_0x1c8e0b['error'][_0xb46c('0x25')]);return _0x4134d4(_0x1c8e0b[_0xb46c('0x23')][_0xb46c('0x25')]);}else{logger[_0xb46c('0x26')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ee554,'request\x20sent');_0x4134d4(_0x1c8e0b[_0xb46c('0x27')][_0xb46c('0x25')]);}})[_0xb46c('0x28')](function(_0x2a5a42){logger[_0xb46c('0x23')](_0xb46c('0x1e'),_0x4ee554,_0x2a5a42);_0x41d8ab(_0x2a5a42);});});}function respondWithStatusCode(_0x204c10,_0x1530c4){_0x1530c4=_0x1530c4||0xcc;return function(_0x4e7403){if(_0x4e7403){return _0x204c10[_0xb46c('0x29')](_0x1530c4);}return _0x204c10[_0xb46c('0x2a')](_0x1530c4)[_0xb46c('0x2b')]();};}function respondWithResult(_0x11821a,_0x1fc0ad){_0x1fc0ad=_0x1fc0ad||0xc8;return function(_0x2c961b){if(_0x2c961b){return _0x11821a[_0xb46c('0x2a')](_0x1fc0ad)[_0xb46c('0x2c')](_0x2c961b);}};}function respondWithFilteredResult(_0x552574,_0x5b3e80){return function(_0x5d0505){if(_0x5d0505){var _0x3e276b=_0x5d0505['count'],_0x648b3b=_0x5b3e80['offset'],_0x596778=_0x5b3e80[_0xb46c('0x2d')]+_0x5b3e80[_0xb46c('0x2e')],_0x4270d2;if(_0x596778>=_0x3e276b){_0x596778=_0x3e276b;_0x4270d2=0xc8;}else{_0x4270d2=0xce;}_0x552574['status'](_0x4270d2);return _0x552574[_0xb46c('0x2f')](_0xb46c('0x30'),_0x648b3b+'-'+_0x596778+'/'+_0x3e276b)['json'](_0x5d0505);}return null;};}function patchUpdates(_0x414eea){return function(_0x50ccc0){try{jsonpatch[_0xb46c('0x31')](_0x50ccc0,_0x414eea,!![]);}catch(_0x188226){return BPromise[_0xb46c('0x32')](_0x188226);}return _0x50ccc0['save']();};}function saveUpdates(_0x5d77d9,_0x1b30fd){return function(_0x2d4548){if(_0x2d4548){return _0x2d4548[_0xb46c('0x33')](_0x5d77d9)['then'](function(_0x3aad64){return _0x3aad64;});}return null;};}function removeEntity(_0x5ea45b,_0x329e8a){return function(_0xb8f0f7){if(_0xb8f0f7){return _0xb8f0f7[_0xb46c('0x34')]()[_0xb46c('0x1d')](function(){_0x5ea45b[_0xb46c('0x2a')](0xcc)[_0xb46c('0x2b')]();});}};}function handleEntityNotFound(_0x4d837d,_0x26001e){return function(_0x3a5f36){if(!_0x3a5f36){_0x4d837d[_0xb46c('0x29')](0x194);}return _0x3a5f36;};}function handleError(_0x1f7d6d,_0x3b1e7b){_0x3b1e7b=_0x3b1e7b||0x1f4;return function(_0xc514b3){logger[_0xb46c('0x23')](_0xc514b3['stack']);if(_0xc514b3[_0xb46c('0x35')]){delete _0xc514b3[_0xb46c('0x35')];}_0x1f7d6d[_0xb46c('0x2a')](_0x3b1e7b)['send'](_0xc514b3);};}exports[_0xb46c('0x36')]=function(_0x48aa06,_0x118a06){var _0x291712={},_0x273565={},_0x323a3e={'count':0x0,'rows':[]};var _0x218877=_[_0xb46c('0x37')](db[_0xb46c('0x38')][_0xb46c('0x39')],function(_0xd5a868){return{'name':_0xd5a868[_0xb46c('0x3a')],'type':_0xd5a868['type'][_0xb46c('0x3b')]};});_0x273565[_0xb46c('0x3c')]=_[_0xb46c('0x37')](_0x218877,'name');_0x273565[_0xb46c('0x3d')]=_[_0xb46c('0x3e')](_0x48aa06[_0xb46c('0x3d')]);_0x273565[_0xb46c('0x3f')]=_['intersection'](_0x273565[_0xb46c('0x3c')],_0x273565['query']);_0x291712[_0xb46c('0x40')]=_[_0xb46c('0x41')](_0x273565[_0xb46c('0x3c')],qs[_0xb46c('0x42')](_0x48aa06[_0xb46c('0x3d')][_0xb46c('0x42')]));_0x291712[_0xb46c('0x40')]=_0x291712['attributes'][_0xb46c('0x43')]?_0x291712[_0xb46c('0x40')]:_0x273565[_0xb46c('0x3c')];if(!_0x48aa06[_0xb46c('0x3d')][_0xb46c('0x44')](_0xb46c('0x45'))){_0x291712[_0xb46c('0x2e')]=qs[_0xb46c('0x2e')](_0x48aa06[_0xb46c('0x3d')][_0xb46c('0x2e')]);_0x291712[_0xb46c('0x2d')]=qs[_0xb46c('0x2d')](_0x48aa06['query']['offset']);}_0x291712[_0xb46c('0x46')]=qs[_0xb46c('0x47')](_0x48aa06[_0xb46c('0x3d')][_0xb46c('0x47')]);_0x291712['where']=qs[_0xb46c('0x3f')](_[_0xb46c('0x48')](_0x48aa06[_0xb46c('0x3d')],_0x273565[_0xb46c('0x3f')]),_0x218877);if(_0x48aa06[_0xb46c('0x3d')]['filter']){_0x291712[_0xb46c('0x49')]=_[_0xb46c('0x4a')](_0x291712['where'],{'$or':_[_0xb46c('0x37')](_0x218877,function(_0x93cb71){if(_0x93cb71[_0xb46c('0x4b')]!==_0xb46c('0x4c')){var _0x6fc697={};_0x6fc697[_0x93cb71[_0xb46c('0x35')]]={'$like':'%'+_0x48aa06[_0xb46c('0x3d')][_0xb46c('0x4d')]+'%'};return _0x6fc697;}})});}_0x291712=_[_0xb46c('0x4a')]({},_0x291712,_0x48aa06[_0xb46c('0x4e')]);var _0xe2a675={'where':_0x291712[_0xb46c('0x49')]};return db[_0xb46c('0x38')][_0xb46c('0x4f')](_0xe2a675)[_0xb46c('0x1d')](function(_0x9134a8){_0x323a3e[_0xb46c('0x4f')]=_0x9134a8;if(_0x48aa06['query']['includeAll']){_0x291712[_0xb46c('0x50')]=[{'all':!![]}];}return db[_0xb46c('0x38')][_0xb46c('0x51')](_0x291712);})[_0xb46c('0x1d')](function(_0x55b3fb){_0x323a3e[_0xb46c('0x52')]=_0x55b3fb;return _0x323a3e;})['then'](respondWithFilteredResult(_0x118a06,_0x291712))[_0xb46c('0x28')](handleError(_0x118a06,null));};exports[_0xb46c('0x53')]=function(_0xad5fe,_0x19c883){var _0x16a96b={'raw':![],'where':{'id':_0xad5fe[_0xb46c('0x54')]['id']}},_0x5a1358={};_0x5a1358[_0xb46c('0x3c')]=_[_0xb46c('0x3e')](db['SalesforceConfiguration'][_0xb46c('0x39')]);_0x5a1358[_0xb46c('0x3d')]=_[_0xb46c('0x3e')](_0xad5fe['query']);_0x5a1358[_0xb46c('0x3f')]=_[_0xb46c('0x41')](_0x5a1358[_0xb46c('0x3c')],_0x5a1358[_0xb46c('0x3d')]);_0x16a96b['attributes']=_['intersection'](_0x5a1358[_0xb46c('0x3c')],qs[_0xb46c('0x42')](_0xad5fe['query'][_0xb46c('0x42')]));_0x16a96b[_0xb46c('0x40')]=_0x16a96b[_0xb46c('0x40')][_0xb46c('0x43')]?_0x16a96b[_0xb46c('0x40')]:_0x5a1358[_0xb46c('0x3c')];if(_0xad5fe[_0xb46c('0x3d')][_0xb46c('0x55')]){_0x16a96b[_0xb46c('0x50')]=[{'all':!![]}];}_0x16a96b=_['merge']({},_0x16a96b,_0xad5fe[_0xb46c('0x4e')]);return db[_0xb46c('0x38')]['find'](_0x16a96b)[_0xb46c('0x1d')](handleEntityNotFound(_0x19c883,null))[_0xb46c('0x1d')](respondWithResult(_0x19c883,null))['catch'](handleError(_0x19c883,null));};exports['create']=function(_0x2fc73b,_0x47fddc){return db[_0xb46c('0x38')][_0xb46c('0x56')](_0x2fc73b[_0xb46c('0x57')],{})[_0xb46c('0x1d')](respondWithResult(_0x47fddc,0xc9))['catch'](handleError(_0x47fddc,null));};exports[_0xb46c('0x33')]=function(_0x5c2339,_0x112a76){if(_0x5c2339[_0xb46c('0x57')]['id']){delete _0x5c2339[_0xb46c('0x57')]['id'];}return db[_0xb46c('0x38')][_0xb46c('0x58')]({'where':{'id':_0x5c2339['params']['id']}})[_0xb46c('0x1d')](handleEntityNotFound(_0x112a76,null))[_0xb46c('0x1d')](saveUpdates(_0x5c2339[_0xb46c('0x57')],null))[_0xb46c('0x1d')](respondWithResult(_0x112a76,null))[_0xb46c('0x28')](handleError(_0x112a76,null));};exports[_0xb46c('0x34')]=function(_0x272e99,_0x127455){return db[_0xb46c('0x38')]['find']({'where':{'id':_0x272e99[_0xb46c('0x54')]['id']}})['then'](handleEntityNotFound(_0x127455,null))[_0xb46c('0x1d')](removeEntity(_0x127455,null))[_0xb46c('0x28')](handleError(_0x127455,null));};exports[_0xb46c('0x59')]=function(_0x2433be,_0x4e4128,_0x10c2a1){var _0x397bc3={};var _0x35b0d2={};var _0xc0f7af;var _0x3fe7cd;return db[_0xb46c('0x38')][_0xb46c('0x5a')]({'where':{'id':_0x2433be['params']['id']}})[_0xb46c('0x1d')](handleEntityNotFound(_0x4e4128,null))[_0xb46c('0x1d')](function(_0x19558e){if(_0x19558e){_0xc0f7af=_0x19558e;_0x35b0d2['model']=_[_0xb46c('0x3e')](db[_0xb46c('0x5b')][_0xb46c('0x39')]);_0x35b0d2['query']=_[_0xb46c('0x3e')](_0x2433be['query']);_0x35b0d2['filters']=_[_0xb46c('0x41')](_0x35b0d2['model'],_0x35b0d2[_0xb46c('0x3d')]);_0x397bc3[_0xb46c('0x40')]=_[_0xb46c('0x41')](_0x35b0d2[_0xb46c('0x3c')],qs[_0xb46c('0x42')](_0x2433be[_0xb46c('0x3d')]['fields']));_0x397bc3['attributes']=_0x397bc3[_0xb46c('0x40')][_0xb46c('0x43')]?_0x397bc3[_0xb46c('0x40')]:_0x35b0d2[_0xb46c('0x3c')];_0x397bc3['order']=qs['sort'](_0x2433be[_0xb46c('0x3d')][_0xb46c('0x47')]);_0x397bc3['where']=qs[_0xb46c('0x3f')](_['pick'](_0x2433be[_0xb46c('0x3d')],_0x35b0d2[_0xb46c('0x3f')]));if(_0x2433be[_0xb46c('0x3d')][_0xb46c('0x4d')]){_0x397bc3['where']=_[_0xb46c('0x4a')](_0x397bc3[_0xb46c('0x49')],{'$or':_['map'](_0x397bc3[_0xb46c('0x40')],function(_0x2fa98e){var _0x344636={};_0x344636[_0x2fa98e]={'$like':'%'+_0x2433be[_0xb46c('0x3d')][_0xb46c('0x4d')]+'%'};return _0x344636;})});}_0x397bc3=_[_0xb46c('0x4a')]({},_0x397bc3,_0x2433be[_0xb46c('0x4e')]);return _0xc0f7af[_0xb46c('0x59')](_0x397bc3);}})['then'](function(_0x3f2b4b){if(_0x3f2b4b){_0x3fe7cd=_0x3f2b4b[_0xb46c('0x43')];if(!_0x2433be[_0xb46c('0x3d')]['hasOwnProperty'](_0xb46c('0x45'))){_0x397bc3['limit']=qs[_0xb46c('0x2e')](_0x2433be['query'][_0xb46c('0x2e')]);_0x397bc3[_0xb46c('0x2d')]=qs['offset'](_0x2433be['query'][_0xb46c('0x2d')]);}return _0xc0f7af['getFields'](_0x397bc3);}})[_0xb46c('0x1d')](function(_0x136cbb){if(_0x136cbb){return _0x136cbb?{'count':_0x3fe7cd,'rows':_0x136cbb}:null;}})[_0xb46c('0x1d')](respondWithResult(_0x4e4128,null))[_0xb46c('0x28')](handleError(_0x4e4128,null));};exports['getSubjects']=function(_0x34b027,_0x516c55,_0x33948d){var _0x202247={};var _0x578b6c={};var _0x5e4469;var _0xefb33b;return db[_0xb46c('0x38')][_0xb46c('0x5a')]({'where':{'id':_0x34b027[_0xb46c('0x54')]['id']}})['then'](handleEntityNotFound(_0x516c55,null))[_0xb46c('0x1d')](function(_0x451acc){if(_0x451acc){_0x5e4469=_0x451acc;_0x578b6c[_0xb46c('0x3c')]=_[_0xb46c('0x3e')](db[_0xb46c('0x5b')][_0xb46c('0x39')]);_0x578b6c['query']=_['keys'](_0x34b027[_0xb46c('0x3d')]);_0x578b6c[_0xb46c('0x3f')]=_[_0xb46c('0x41')](_0x578b6c[_0xb46c('0x3c')],_0x578b6c[_0xb46c('0x3d')]);_0x202247[_0xb46c('0x40')]=_[_0xb46c('0x41')](_0x578b6c[_0xb46c('0x3c')],qs[_0xb46c('0x42')](_0x34b027[_0xb46c('0x3d')][_0xb46c('0x42')]));_0x202247[_0xb46c('0x40')]=_0x202247[_0xb46c('0x40')][_0xb46c('0x43')]?_0x202247[_0xb46c('0x40')]:_0x578b6c[_0xb46c('0x3c')];_0x202247['order']=qs[_0xb46c('0x47')](_0x34b027[_0xb46c('0x3d')][_0xb46c('0x47')]);_0x202247[_0xb46c('0x49')]=qs[_0xb46c('0x3f')](_[_0xb46c('0x48')](_0x34b027[_0xb46c('0x3d')],_0x578b6c[_0xb46c('0x3f')]));if(_0x34b027[_0xb46c('0x3d')][_0xb46c('0x4d')]){_0x202247[_0xb46c('0x49')]=_[_0xb46c('0x4a')](_0x202247[_0xb46c('0x49')],{'$or':_[_0xb46c('0x37')](_0x202247[_0xb46c('0x40')],function(_0x296d29){var _0x3b0232={};_0x3b0232[_0x296d29]={'$like':'%'+_0x34b027[_0xb46c('0x3d')]['filter']+'%'};return _0x3b0232;})});}_0x202247=_['merge']({},_0x202247,_0x34b027['options']);return _0x5e4469[_0xb46c('0x5c')](_0x202247);}})[_0xb46c('0x1d')](function(_0x106ba7){if(_0x106ba7){_0xefb33b=_0x106ba7[_0xb46c('0x43')];if(!_0x34b027[_0xb46c('0x3d')][_0xb46c('0x44')](_0xb46c('0x45'))){_0x202247[_0xb46c('0x2e')]=qs[_0xb46c('0x2e')](_0x34b027['query']['limit']);_0x202247[_0xb46c('0x2d')]=qs[_0xb46c('0x2d')](_0x34b027[_0xb46c('0x3d')][_0xb46c('0x2d')]);}return _0x5e4469[_0xb46c('0x5c')](_0x202247);}})[_0xb46c('0x1d')](function(_0x844548){if(_0x844548){return _0x844548?{'count':_0xefb33b,'rows':_0x844548}:null;}})[_0xb46c('0x1d')](respondWithResult(_0x516c55,null))['catch'](handleError(_0x516c55,null));};exports[_0xb46c('0x5d')]=function(_0x4faae5,_0x2c93fd,_0x45f1fa){var _0x3894c4={};var _0x5612c0={};var _0x4d9bec;var _0x2d257c;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4faae5[_0xb46c('0x54')]['id']}})['then'](handleEntityNotFound(_0x2c93fd,null))[_0xb46c('0x1d')](function(_0xb407dc){if(_0xb407dc){_0x4d9bec=_0xb407dc;_0x5612c0[_0xb46c('0x3c')]=_[_0xb46c('0x3e')](db[_0xb46c('0x5b')][_0xb46c('0x39')]);_0x5612c0[_0xb46c('0x3d')]=_[_0xb46c('0x3e')](_0x4faae5['query']);_0x5612c0[_0xb46c('0x3f')]=_[_0xb46c('0x41')](_0x5612c0[_0xb46c('0x3c')],_0x5612c0[_0xb46c('0x3d')]);_0x3894c4[_0xb46c('0x40')]=_['intersection'](_0x5612c0[_0xb46c('0x3c')],qs[_0xb46c('0x42')](_0x4faae5[_0xb46c('0x3d')]['fields']));_0x3894c4[_0xb46c('0x40')]=_0x3894c4[_0xb46c('0x40')][_0xb46c('0x43')]?_0x3894c4[_0xb46c('0x40')]:_0x5612c0['model'];_0x3894c4['order']=qs[_0xb46c('0x47')](_0x4faae5[_0xb46c('0x3d')][_0xb46c('0x47')]);_0x3894c4[_0xb46c('0x49')]=qs[_0xb46c('0x3f')](_[_0xb46c('0x48')](_0x4faae5['query'],_0x5612c0[_0xb46c('0x3f')]));if(_0x4faae5['query'][_0xb46c('0x4d')]){_0x3894c4[_0xb46c('0x49')]=_[_0xb46c('0x4a')](_0x3894c4[_0xb46c('0x49')],{'$or':_[_0xb46c('0x37')](_0x3894c4[_0xb46c('0x40')],function(_0x1b7d94){var _0x13a186={};_0x13a186[_0x1b7d94]={'$like':'%'+_0x4faae5[_0xb46c('0x3d')][_0xb46c('0x4d')]+'%'};return _0x13a186;})});}_0x3894c4=_[_0xb46c('0x4a')]({},_0x3894c4,_0x4faae5[_0xb46c('0x4e')]);return _0x4d9bec[_0xb46c('0x5d')](_0x3894c4);}})[_0xb46c('0x1d')](function(_0x1deac5){if(_0x1deac5){_0x2d257c=_0x1deac5[_0xb46c('0x43')];if(!_0x4faae5[_0xb46c('0x3d')][_0xb46c('0x44')](_0xb46c('0x45'))){_0x3894c4[_0xb46c('0x2e')]=qs['limit'](_0x4faae5['query'][_0xb46c('0x2e')]);_0x3894c4[_0xb46c('0x2d')]=qs[_0xb46c('0x2d')](_0x4faae5[_0xb46c('0x3d')][_0xb46c('0x2d')]);}return _0x4d9bec[_0xb46c('0x5d')](_0x3894c4);}})[_0xb46c('0x1d')](function(_0x43d8d9){if(_0x43d8d9){return _0x43d8d9?{'count':_0x2d257c,'rows':_0x43d8d9}:null;}})[_0xb46c('0x1d')](respondWithResult(_0x2c93fd,null))[_0xb46c('0x28')](handleError(_0x2c93fd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 5ab761b..f994ff8 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 _0xb4f7=['./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3e23c5,_0x3875ec){var _0x42977a=function(_0x39f48a){while(--_0x39f48a){_0x3e23c5['push'](_0x3e23c5['shift']());}};_0x42977a(++_0x3875ec);}(_0xb4f7,0x156));var _0x7b4f=function(_0x3c5a41,_0x558b2c){_0x3c5a41=_0x3c5a41-0x0;var _0x5389f5=_0xb4f7[_0x3c5a41];return _0x5389f5;};'use strict';var _=require(_0x7b4f('0x0'));var util=require(_0x7b4f('0x1'));var logger=require(_0x7b4f('0x2'))(_0x7b4f('0x3'));var moment=require(_0x7b4f('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4f('0x5'));var fs=require('fs');var path=require(_0x7b4f('0x6'));var rimraf=require(_0x7b4f('0x7'));var config=require(_0x7b4f('0x8'));var attributes=require(_0x7b4f('0x9'));module[_0x7b4f('0xa')]=function(_0x38bbac,_0x204829){return _0x38bbac[_0x7b4f('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x7b4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x085f=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x6b6aa9,_0x20c99c){var _0x58efd4=function(_0xe805bd){while(--_0xe805bd){_0x6b6aa9['push'](_0x6b6aa9['shift']());}};_0x58efd4(++_0x20c99c);}(_0x085f,0x1d3));var _0xf085=function(_0x340143,_0x343c05){_0x340143=_0x340143-0x0;var _0x5e0d26=_0x085f[_0x340143];return _0x5e0d26;};'use strict';var _=require(_0xf085('0x0'));var util=require(_0xf085('0x1'));var logger=require('../../config/logger')(_0xf085('0x2'));var moment=require('moment');var BPromise=require(_0xf085('0x3'));var rp=require(_0xf085('0x4'));var fs=require('fs');var path=require(_0xf085('0x5'));var rimraf=require(_0xf085('0x6'));var config=require(_0xf085('0x7'));var attributes=require(_0xf085('0x8'));module[_0xf085('0x9')]=function(_0x512d26,_0x97c036){return _0x512d26[_0xf085('0xa')](_0xf085('0xb'),attributes,{'tableName':_0xf085('0xc'),'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 f24268e..c0edd2c 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 _0x1ad1=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1ad1,0x84));var _0x11ad=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1ad1[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x11ad('0x0'));var util=require(_0x11ad('0x1'));var moment=require(_0x11ad('0x2'));var BPromise=require(_0x11ad('0x3'));var rs=require(_0x11ad('0x4'));var fs=require('fs');var Redis=require(_0x11ad('0x5'));var db=require(_0x11ad('0x6'))['db'];var utils=require(_0x11ad('0x7'));var logger=require(_0x11ad('0x8'))(_0x11ad('0x9'));var config=require(_0x11ad('0xa'));var jayson=require(_0x11ad('0xb'));var client=jayson[_0x11ad('0xc')][_0x11ad('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5adba,_0x20acb3,_0x29abed){return new BPromise(function(_0x56541f,_0x54587e){return client[_0x11ad('0xe')](_0x5adba,_0x29abed)[_0x11ad('0xf')](function(_0x2a653d){logger['info'](_0x11ad('0x10'),_0x20acb3,'request\x20sent');logger[_0x11ad('0x11')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x20acb3,_0x11ad('0x12'),JSON[_0x11ad('0x13')](_0x2a653d));if(_0x2a653d[_0x11ad('0x14')]){if(_0x2a653d[_0x11ad('0x14')][_0x11ad('0x15')]===0x1f4){logger[_0x11ad('0x14')](_0x11ad('0x10'),_0x20acb3,_0x2a653d[_0x11ad('0x14')][_0x11ad('0x16')]);return _0x54587e(_0x2a653d[_0x11ad('0x14')]['message']);}logger[_0x11ad('0x14')](_0x11ad('0x10'),_0x20acb3,_0x2a653d[_0x11ad('0x14')][_0x11ad('0x16')]);return _0x56541f(_0x2a653d[_0x11ad('0x14')][_0x11ad('0x16')]);}else{logger[_0x11ad('0x17')]('SalesforceConfiguration,\x20%s,\x20%s',_0x20acb3,'request\x20sent');_0x56541f(_0x2a653d[_0x11ad('0x18')][_0x11ad('0x16')]);}})[_0x11ad('0x19')](function(_0x376e64){logger[_0x11ad('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x20acb3,_0x376e64);_0x54587e(_0x376e64);});});} \ No newline at end of file +var _0x8324=['code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','request\x20sent','debug','stringify','error'];(function(_0x509dad,_0x1f995f){var _0x21e122=function(_0x2a9b90){while(--_0x2a9b90){_0x509dad['push'](_0x509dad['shift']());}};_0x21e122(++_0x1f995f);}(_0x8324,0x16d));var _0x4832=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x8324[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x4832('0x0'));var util=require(_0x4832('0x1'));var moment=require(_0x4832('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4832('0x3'))['db'];var utils=require(_0x4832('0x4'));var logger=require('../../config/logger')(_0x4832('0x5'));var config=require(_0x4832('0x6'));var jayson=require(_0x4832('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x935f0d,_0x46802f,_0x3e521d){return new BPromise(function(_0x4b81e3,_0x4ca1c7){return client[_0x4832('0x8')](_0x935f0d,_0x3e521d)['then'](function(_0x3b350a){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x46802f,_0x4832('0x9'));logger[_0x4832('0xa')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x46802f,_0x4832('0x9'),JSON[_0x4832('0xb')](_0x3b350a));if(_0x3b350a['error']){if(_0x3b350a[_0x4832('0xc')][_0x4832('0xd')]===0x1f4){logger[_0x4832('0xc')](_0x4832('0xe'),_0x46802f,_0x3b350a[_0x4832('0xc')][_0x4832('0xf')]);return _0x4ca1c7(_0x3b350a[_0x4832('0xc')][_0x4832('0xf')]);}logger[_0x4832('0xc')](_0x4832('0xe'),_0x46802f,_0x3b350a[_0x4832('0xc')]['message']);return _0x4b81e3(_0x3b350a['error'][_0x4832('0xf')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x46802f,_0x4832('0x9'));_0x4b81e3(_0x3b350a[_0x4832('0x10')][_0x4832('0xf')]);}})[_0x4832('0x11')](function(_0x374e92){logger[_0x4832('0xc')](_0x4832('0xe'),_0x46802f,_0x374e92);_0x4ca1c7(_0x374e92);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 1f9434a..e61aa58 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 _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x43dc59,_0x2e90c0){var _0x24739e=function(_0x228214){while(--_0x228214){_0x43dc59['push'](_0x43dc59['shift']());}};_0x24739e(++_0x2e90c0);}(_0x6d38,0x1ef));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x741c=['/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index'];(function(_0x2b96f3,_0x3d105c){var _0x36cbf1=function(_0x3ebb5f){while(--_0x3ebb5f){_0x2b96f3['push'](_0x2b96f3['shift']());}};_0x36cbf1(++_0x3d105c);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x6'));var controller=require('./intSalesforceField.controller');router[_0xc741('0x7')]('/',auth[_0xc741('0x8')](),controller[_0xc741('0x9')]);router[_0xc741('0x7')](_0xc741('0xa'),auth[_0xc741('0x8')](),controller[_0xc741('0xb')]);router['post']('/',auth[_0xc741('0x8')](),controller[_0xc741('0xc')]);router['put'](_0xc741('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc741('0xd')](_0xc741('0xa'),auth[_0xc741('0x8')](),controller[_0xc741('0xe')]);module[_0xc741('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 355d2f5..a1c314f 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 _0x1e2a=['ENUM','string','variable','customVariable','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1e2a,0x118));var _0xa1e2=function(_0x23f925,_0x24d4bc){_0x23f925=_0x23f925-0x0;var _0x39e059=_0x1e2a[_0x23f925];return _0x39e059;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa1e2('0x0')](_0xa1e2('0x1'),_0xa1e2('0x2'),_0xa1e2('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa1e2('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa1e2('0x2'),_0xa1e2('0x3'))},'keyContent':{'type':Sequelize[_0xa1e2('0x4')]},'idField':{'type':Sequelize[_0xa1e2('0x4')]},'variableName':{'type':Sequelize[_0xa1e2('0x4')]}}; \ No newline at end of file +var _0xc529=['sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x4b17d6,_0x58786e){var _0x3c2c24=function(_0x3ab15e){while(--_0x3ab15e){_0x4b17d6['push'](_0x4b17d6['shift']());}};_0x3c2c24(++_0x58786e);}(_0xc529,0x170));var _0x9c52=function(_0x3a6b78,_0x2d62be){_0x3a6b78=_0x3a6b78-0x0;var _0x4943d4=_0xc529[_0x3a6b78];return _0x4943d4;};'use strict';var Sequelize=require(_0x9c52('0x0'));module[_0x9c52('0x1')]={'type':{'type':Sequelize[_0x9c52('0x2')]('string',_0x9c52('0x3'),_0x9c52('0x4'),_0x9c52('0x5')),'defaultValue':_0x9c52('0x6')},'content':{'type':Sequelize[_0x9c52('0x7')]},'key':{'type':Sequelize[_0x9c52('0x7')]},'keyType':{'type':Sequelize[_0x9c52('0x2')](_0x9c52('0x6'),'variable',_0x9c52('0x4'))},'keyContent':{'type':Sequelize[_0x9c52('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9c52('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f50149d..4233f65 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 _0x74f4=['count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','params','keys','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x74f4,0x1a4));var _0x474f=function(_0x134d35,_0x3fb38e){_0x134d35=_0x134d35-0x0;var _0x469533=_0x74f4[_0x134d35];return _0x469533;};'use strict';var pdf=require(_0x474f('0x0'));var emlformat=require(_0x474f('0x1'));var rimraf=require(_0x474f('0x2'));var zipdir=require(_0x474f('0x3'));var jsonpatch=require(_0x474f('0x4'));var rp=require(_0x474f('0x5'));var moment=require(_0x474f('0x6'));var BPromise=require(_0x474f('0x7'));var Mustache=require(_0x474f('0x8'));var util=require('util');var path=require(_0x474f('0x9'));var sox=require(_0x474f('0xa'));var csv=require(_0x474f('0xb'));var ejs=require(_0x474f('0xc'));var fs=require('fs');var _=require(_0x474f('0xd'));var squel=require('squel');var crypto=require(_0x474f('0xe'));var jsforce=require(_0x474f('0xf'));var deskjs=require(_0x474f('0x10'));var toCsv=require(_0x474f('0xb'));var querystring=require(_0x474f('0x11'));var Papa=require(_0x474f('0x12'));var Redis=require('ioredis');var authService=require(_0x474f('0x13'));var qs=require(_0x474f('0x14'));var as=require(_0x474f('0x15'));var hardwareService=require(_0x474f('0x16'));var logger=require(_0x474f('0x17'))('api');var utils=require(_0x474f('0x18'));var config=require(_0x474f('0x19'));var db=require(_0x474f('0x1a'))['db'];function respondWithStatusCode(_0x350f27,_0x5e46f4){_0x5e46f4=_0x5e46f4||0xcc;return function(_0x23dcf7){if(_0x23dcf7){return _0x350f27[_0x474f('0x1b')](_0x5e46f4);}return _0x350f27[_0x474f('0x1c')](_0x5e46f4)[_0x474f('0x1d')]();};}function respondWithResult(_0x4ee64f,_0x3b0e6c){_0x3b0e6c=_0x3b0e6c||0xc8;return function(_0x2452ef){if(_0x2452ef){return _0x4ee64f[_0x474f('0x1c')](_0x3b0e6c)['json'](_0x2452ef);}};}function respondWithFilteredResult(_0x1bc0ed,_0x30fcfc){return function(_0x3c36bb){if(_0x3c36bb){var _0x3454bb=_0x3c36bb[_0x474f('0x1e')],_0xd40680=_0x30fcfc[_0x474f('0x1f')],_0x14aeb0=_0x30fcfc[_0x474f('0x1f')]+_0x30fcfc[_0x474f('0x20')],_0x174b24;if(_0x14aeb0>=_0x3454bb){_0x14aeb0=_0x3454bb;_0x174b24=0xc8;}else{_0x174b24=0xce;}_0x1bc0ed[_0x474f('0x1c')](_0x174b24);return _0x1bc0ed[_0x474f('0x21')](_0x474f('0x22'),_0xd40680+'-'+_0x14aeb0+'/'+_0x3454bb)[_0x474f('0x23')](_0x3c36bb);}return null;};}function patchUpdates(_0x22add4){return function(_0x389efa){try{jsonpatch[_0x474f('0x24')](_0x389efa,_0x22add4,!![]);}catch(_0x5efe44){return BPromise['reject'](_0x5efe44);}return _0x389efa[_0x474f('0x25')]();};}function saveUpdates(_0x446c56,_0x57037c){return function(_0x3fed47){if(_0x3fed47){return _0x3fed47[_0x474f('0x26')](_0x446c56)['then'](function(_0x468949){return _0x468949;});}return null;};}function removeEntity(_0x2ce999,_0x52b5c){return function(_0x15e6ac){if(_0x15e6ac){return _0x15e6ac[_0x474f('0x27')]()[_0x474f('0x28')](function(){_0x2ce999['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6127,_0x5b5084){return function(_0x38f998){if(!_0x38f998){_0x2d6127[_0x474f('0x1b')](0x194);}return _0x38f998;};}function handleError(_0x2e444b,_0x2aeb77){_0x2aeb77=_0x2aeb77||0x1f4;return function(_0x5c3cc2){logger['error'](_0x5c3cc2[_0x474f('0x29')]);if(_0x5c3cc2[_0x474f('0x2a')]){delete _0x5c3cc2['name'];}_0x2e444b[_0x474f('0x1c')](_0x2aeb77)['send'](_0x5c3cc2);};}exports[_0x474f('0x2b')]=function(_0x3d5b68,_0x438bcd){var _0x1f9d9c={},_0x59f11c={},_0x57aaeb={'count':0x0,'rows':[]};var _0x15f790=_[_0x474f('0x2c')](db[_0x474f('0x2d')][_0x474f('0x2e')],function(_0x3a233f){return{'name':_0x3a233f[_0x474f('0x2f')],'type':_0x3a233f[_0x474f('0x30')][_0x474f('0x31')]};});_0x59f11c[_0x474f('0x32')]=_['map'](_0x15f790,_0x474f('0x2a'));_0x59f11c[_0x474f('0x33')]=_['keys'](_0x3d5b68[_0x474f('0x33')]);_0x59f11c['filters']=_[_0x474f('0x34')](_0x59f11c[_0x474f('0x32')],_0x59f11c['query']);_0x1f9d9c['attributes']=_[_0x474f('0x34')](_0x59f11c[_0x474f('0x32')],qs['fields'](_0x3d5b68[_0x474f('0x33')][_0x474f('0x35')]));_0x1f9d9c[_0x474f('0x36')]=_0x1f9d9c['attributes'][_0x474f('0x37')]?_0x1f9d9c['attributes']:_0x59f11c[_0x474f('0x32')];if(!_0x3d5b68[_0x474f('0x33')][_0x474f('0x38')]('nolimit')){_0x1f9d9c['limit']=qs[_0x474f('0x20')](_0x3d5b68[_0x474f('0x33')][_0x474f('0x20')]);_0x1f9d9c[_0x474f('0x1f')]=qs[_0x474f('0x1f')](_0x3d5b68[_0x474f('0x33')][_0x474f('0x1f')]);}_0x1f9d9c[_0x474f('0x39')]=qs[_0x474f('0x3a')](_0x3d5b68[_0x474f('0x33')][_0x474f('0x3a')]);_0x1f9d9c[_0x474f('0x3b')]=qs[_0x474f('0x3c')](_['pick'](_0x3d5b68['query'],_0x59f11c['filters']),_0x15f790);if(_0x3d5b68[_0x474f('0x33')][_0x474f('0x3d')]){_0x1f9d9c[_0x474f('0x3b')]=_[_0x474f('0x3e')](_0x1f9d9c[_0x474f('0x3b')],{'$or':_[_0x474f('0x2c')](_0x15f790,function(_0x1f9f1d){if(_0x1f9f1d['type']!==_0x474f('0x3f')){var _0x25bc10={};_0x25bc10[_0x1f9f1d[_0x474f('0x2a')]]={'$like':'%'+_0x3d5b68['query'][_0x474f('0x3d')]+'%'};return _0x25bc10;}})});}_0x1f9d9c=_[_0x474f('0x3e')]({},_0x1f9d9c,_0x3d5b68[_0x474f('0x40')]);var _0x56745d={'where':_0x1f9d9c[_0x474f('0x3b')]};return db[_0x474f('0x2d')][_0x474f('0x1e')](_0x56745d)[_0x474f('0x28')](function(_0x157d6b){_0x57aaeb[_0x474f('0x1e')]=_0x157d6b;if(_0x3d5b68[_0x474f('0x33')]['includeAll']){_0x1f9d9c['include']=[{'all':!![]}];}return db[_0x474f('0x2d')][_0x474f('0x41')](_0x1f9d9c);})[_0x474f('0x28')](function(_0x337d22){_0x57aaeb[_0x474f('0x42')]=_0x337d22;return _0x57aaeb;})[_0x474f('0x28')](respondWithFilteredResult(_0x438bcd,_0x1f9d9c))[_0x474f('0x43')](handleError(_0x438bcd,null));};exports['show']=function(_0x59d56e,_0x26cbbd){var _0x512148={'raw':!![],'where':{'id':_0x59d56e[_0x474f('0x44')]['id']}},_0xbc947d={};_0xbc947d['model']=_[_0x474f('0x45')](db['SalesforceField'][_0x474f('0x2e')]);_0xbc947d['query']=_[_0x474f('0x45')](_0x59d56e[_0x474f('0x33')]);_0xbc947d[_0x474f('0x3c')]=_['intersection'](_0xbc947d[_0x474f('0x32')],_0xbc947d['query']);_0x512148[_0x474f('0x36')]=_[_0x474f('0x34')](_0xbc947d[_0x474f('0x32')],qs[_0x474f('0x35')](_0x59d56e['query']['fields']));_0x512148[_0x474f('0x36')]=_0x512148[_0x474f('0x36')][_0x474f('0x37')]?_0x512148[_0x474f('0x36')]:_0xbc947d['model'];if(_0x59d56e['query'][_0x474f('0x46')]){_0x512148[_0x474f('0x47')]=[{'all':!![]}];}_0x512148=_[_0x474f('0x3e')]({},_0x512148,_0x59d56e[_0x474f('0x40')]);return db['SalesforceField'][_0x474f('0x48')](_0x512148)[_0x474f('0x28')](handleEntityNotFound(_0x26cbbd,null))['then'](respondWithResult(_0x26cbbd,null))[_0x474f('0x43')](handleError(_0x26cbbd,null));};exports[_0x474f('0x49')]=function(_0x1ab5e4,_0x52700d){return db[_0x474f('0x2d')][_0x474f('0x49')](_0x1ab5e4[_0x474f('0x4a')],{})[_0x474f('0x28')](respondWithResult(_0x52700d,0xc9))[_0x474f('0x43')](handleError(_0x52700d,null));};exports['update']=function(_0x380bf3,_0x1d0d63){if(_0x380bf3[_0x474f('0x4a')]['id']){delete _0x380bf3[_0x474f('0x4a')]['id'];}return db[_0x474f('0x2d')][_0x474f('0x48')]({'where':{'id':_0x380bf3[_0x474f('0x44')]['id']}})[_0x474f('0x28')](handleEntityNotFound(_0x1d0d63,null))[_0x474f('0x28')](saveUpdates(_0x380bf3[_0x474f('0x4a')],null))[_0x474f('0x28')](respondWithResult(_0x1d0d63,null))[_0x474f('0x43')](handleError(_0x1d0d63,null));};exports[_0x474f('0x27')]=function(_0x5b44d4,_0x44cd8b){return db[_0x474f('0x2d')]['find']({'where':{'id':_0x5b44d4[_0x474f('0x44')]['id']}})[_0x474f('0x28')](handleEntityNotFound(_0x44cd8b,null))[_0x474f('0x28')](removeEntity(_0x44cd8b,null))[_0x474f('0x43')](handleError(_0x44cd8b,null));}; \ No newline at end of file +var _0x5b58=['reject','update','destroy','then','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply'];(function(_0x4fdb3d,_0x42d9d4){var _0x40dbee=function(_0x32a20c){while(--_0x32a20c){_0x4fdb3d['push'](_0x4fdb3d['shift']());}};_0x40dbee(++_0x42d9d4);}(_0x5b58,0x75));var _0x85b5=function(_0x33626e,_0x2c1e9a){_0x33626e=_0x33626e-0x0;var _0x254df4=_0x5b58[_0x33626e];return _0x254df4;};'use strict';var pdf=require(_0x85b5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x85b5('0x1'));var zipdir=require(_0x85b5('0x2'));var jsonpatch=require(_0x85b5('0x3'));var rp=require(_0x85b5('0x4'));var moment=require(_0x85b5('0x5'));var BPromise=require(_0x85b5('0x6'));var Mustache=require(_0x85b5('0x7'));var util=require(_0x85b5('0x8'));var path=require(_0x85b5('0x9'));var sox=require(_0x85b5('0xa'));var csv=require(_0x85b5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x85b5('0xc'));var squel=require(_0x85b5('0xd'));var crypto=require(_0x85b5('0xe'));var jsforce=require(_0x85b5('0xf'));var deskjs=require(_0x85b5('0x10'));var toCsv=require(_0x85b5('0xb'));var querystring=require('querystring');var Papa=require(_0x85b5('0x11'));var Redis=require(_0x85b5('0x12'));var authService=require(_0x85b5('0x13'));var qs=require(_0x85b5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85b5('0x15'));var logger=require('../../config/logger')(_0x85b5('0x16'));var utils=require('../../config/utils');var config=require(_0x85b5('0x17'));var db=require(_0x85b5('0x18'))['db'];function respondWithStatusCode(_0x2e72e1,_0x41f9fb){_0x41f9fb=_0x41f9fb||0xcc;return function(_0x499aee){if(_0x499aee){return _0x2e72e1['sendStatus'](_0x41f9fb);}return _0x2e72e1[_0x85b5('0x19')](_0x41f9fb)[_0x85b5('0x1a')]();};}function respondWithResult(_0x340646,_0x549bb9){_0x549bb9=_0x549bb9||0xc8;return function(_0x20abfc){if(_0x20abfc){return _0x340646[_0x85b5('0x19')](_0x549bb9)[_0x85b5('0x1b')](_0x20abfc);}};}function respondWithFilteredResult(_0x21a80,_0x1a9426){return function(_0x5cdf5e){if(_0x5cdf5e){var _0x21cf65=_0x5cdf5e[_0x85b5('0x1c')],_0x57ae6b=_0x1a9426['offset'],_0x244a9d=_0x1a9426[_0x85b5('0x1d')]+_0x1a9426[_0x85b5('0x1e')],_0xdef347;if(_0x244a9d>=_0x21cf65){_0x244a9d=_0x21cf65;_0xdef347=0xc8;}else{_0xdef347=0xce;}_0x21a80[_0x85b5('0x19')](_0xdef347);return _0x21a80[_0x85b5('0x1f')]('Content-Range',_0x57ae6b+'-'+_0x244a9d+'/'+_0x21cf65)[_0x85b5('0x1b')](_0x5cdf5e);}return null;};}function patchUpdates(_0x5418b8){return function(_0xd8cadf){try{jsonpatch[_0x85b5('0x20')](_0xd8cadf,_0x5418b8,!![]);}catch(_0x21cd84){return BPromise[_0x85b5('0x21')](_0x21cd84);}return _0xd8cadf['save']();};}function saveUpdates(_0x422b92,_0x4d8114){return function(_0x5528de){if(_0x5528de){return _0x5528de[_0x85b5('0x22')](_0x422b92)['then'](function(_0x8e4b92){return _0x8e4b92;});}return null;};}function removeEntity(_0x3a20d6,_0x2746d5){return function(_0x19a9f3){if(_0x19a9f3){return _0x19a9f3[_0x85b5('0x23')]()[_0x85b5('0x24')](function(){_0x3a20d6[_0x85b5('0x19')](0xcc)[_0x85b5('0x1a')]();});}};}function handleEntityNotFound(_0x286e4e,_0x586502){return function(_0x39c735){if(!_0x39c735){_0x286e4e['sendStatus'](0x194);}return _0x39c735;};}function handleError(_0x51d9ec,_0x5e56a5){_0x5e56a5=_0x5e56a5||0x1f4;return function(_0x4f9e96){logger[_0x85b5('0x25')](_0x4f9e96[_0x85b5('0x26')]);if(_0x4f9e96[_0x85b5('0x27')]){delete _0x4f9e96['name'];}_0x51d9ec['status'](_0x5e56a5)[_0x85b5('0x28')](_0x4f9e96);};}exports[_0x85b5('0x29')]=function(_0x225301,_0x37c171){var _0x1de126={},_0x340c7d={},_0x18e9de={'count':0x0,'rows':[]};var _0x5a8116=_['map'](db[_0x85b5('0x2a')][_0x85b5('0x2b')],function(_0x45fcc1){return{'name':_0x45fcc1[_0x85b5('0x2c')],'type':_0x45fcc1['type'][_0x85b5('0x2d')]};});_0x340c7d[_0x85b5('0x2e')]=_[_0x85b5('0x2f')](_0x5a8116,_0x85b5('0x27'));_0x340c7d[_0x85b5('0x30')]=_[_0x85b5('0x31')](_0x225301[_0x85b5('0x30')]);_0x340c7d[_0x85b5('0x32')]=_[_0x85b5('0x33')](_0x340c7d['model'],_0x340c7d[_0x85b5('0x30')]);_0x1de126[_0x85b5('0x34')]=_[_0x85b5('0x33')](_0x340c7d['model'],qs[_0x85b5('0x35')](_0x225301['query']['fields']));_0x1de126[_0x85b5('0x34')]=_0x1de126[_0x85b5('0x34')]['length']?_0x1de126['attributes']:_0x340c7d[_0x85b5('0x2e')];if(!_0x225301[_0x85b5('0x30')]['hasOwnProperty'](_0x85b5('0x36'))){_0x1de126['limit']=qs[_0x85b5('0x1e')](_0x225301['query']['limit']);_0x1de126[_0x85b5('0x1d')]=qs[_0x85b5('0x1d')](_0x225301[_0x85b5('0x30')]['offset']);}_0x1de126[_0x85b5('0x37')]=qs[_0x85b5('0x38')](_0x225301[_0x85b5('0x30')][_0x85b5('0x38')]);_0x1de126[_0x85b5('0x39')]=qs[_0x85b5('0x32')](_[_0x85b5('0x3a')](_0x225301['query'],_0x340c7d[_0x85b5('0x32')]),_0x5a8116);if(_0x225301[_0x85b5('0x30')]['filter']){_0x1de126[_0x85b5('0x39')]=_[_0x85b5('0x3b')](_0x1de126[_0x85b5('0x39')],{'$or':_[_0x85b5('0x2f')](_0x5a8116,function(_0x41f1ff){if(_0x41f1ff[_0x85b5('0x3c')]!==_0x85b5('0x3d')){var _0x2c8cdd={};_0x2c8cdd[_0x41f1ff[_0x85b5('0x27')]]={'$like':'%'+_0x225301[_0x85b5('0x30')][_0x85b5('0x3e')]+'%'};return _0x2c8cdd;}})});}_0x1de126=_[_0x85b5('0x3b')]({},_0x1de126,_0x225301[_0x85b5('0x3f')]);var _0xf2fac1={'where':_0x1de126[_0x85b5('0x39')]};return db[_0x85b5('0x2a')][_0x85b5('0x1c')](_0xf2fac1)[_0x85b5('0x24')](function(_0x2f3c8b){_0x18e9de[_0x85b5('0x1c')]=_0x2f3c8b;if(_0x225301[_0x85b5('0x30')][_0x85b5('0x40')]){_0x1de126[_0x85b5('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x85b5('0x42')](_0x1de126);})['then'](function(_0x52c3fe){_0x18e9de[_0x85b5('0x43')]=_0x52c3fe;return _0x18e9de;})[_0x85b5('0x24')](respondWithFilteredResult(_0x37c171,_0x1de126))[_0x85b5('0x44')](handleError(_0x37c171,null));};exports[_0x85b5('0x45')]=function(_0x558866,_0x162023){var _0x4e1cb8={'raw':!![],'where':{'id':_0x558866[_0x85b5('0x46')]['id']}},_0x4f90c8={};_0x4f90c8['model']=_['keys'](db[_0x85b5('0x2a')][_0x85b5('0x2b')]);_0x4f90c8[_0x85b5('0x30')]=_[_0x85b5('0x31')](_0x558866[_0x85b5('0x30')]);_0x4f90c8[_0x85b5('0x32')]=_[_0x85b5('0x33')](_0x4f90c8['model'],_0x4f90c8[_0x85b5('0x30')]);_0x4e1cb8['attributes']=_['intersection'](_0x4f90c8[_0x85b5('0x2e')],qs[_0x85b5('0x35')](_0x558866['query']['fields']));_0x4e1cb8[_0x85b5('0x34')]=_0x4e1cb8[_0x85b5('0x34')][_0x85b5('0x47')]?_0x4e1cb8[_0x85b5('0x34')]:_0x4f90c8[_0x85b5('0x2e')];if(_0x558866[_0x85b5('0x30')]['includeAll']){_0x4e1cb8[_0x85b5('0x41')]=[{'all':!![]}];}_0x4e1cb8=_[_0x85b5('0x3b')]({},_0x4e1cb8,_0x558866[_0x85b5('0x3f')]);return db[_0x85b5('0x2a')]['find'](_0x4e1cb8)[_0x85b5('0x24')](handleEntityNotFound(_0x162023,null))[_0x85b5('0x24')](respondWithResult(_0x162023,null))['catch'](handleError(_0x162023,null));};exports[_0x85b5('0x48')]=function(_0x2ab507,_0x5ac1f6){return db[_0x85b5('0x2a')][_0x85b5('0x48')](_0x2ab507[_0x85b5('0x49')],{})[_0x85b5('0x24')](respondWithResult(_0x5ac1f6,0xc9))[_0x85b5('0x44')](handleError(_0x5ac1f6,null));};exports[_0x85b5('0x22')]=function(_0x44c28,_0xc430a3){if(_0x44c28['body']['id']){delete _0x44c28[_0x85b5('0x49')]['id'];}return db['SalesforceField'][_0x85b5('0x4a')]({'where':{'id':_0x44c28['params']['id']}})[_0x85b5('0x24')](handleEntityNotFound(_0xc430a3,null))['then'](saveUpdates(_0x44c28[_0x85b5('0x49')],null))['then'](respondWithResult(_0xc430a3,null))[_0x85b5('0x44')](handleError(_0xc430a3,null));};exports[_0x85b5('0x23')]=function(_0x1169c8,_0x1167d2){return db[_0x85b5('0x2a')][_0x85b5('0x4a')]({'where':{'id':_0x1169c8[_0x85b5('0x46')]['id']}})[_0x85b5('0x24')](handleEntityNotFound(_0x1167d2,null))[_0x85b5('0x24')](removeEntity(_0x1167d2,null))[_0x85b5('0x44')](handleError(_0x1167d2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2c0503d..768fd74 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 _0x7aa2=['./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7aa2,0x132));var _0x27aa=function(_0x3c3195,_0x595377){_0x3c3195=_0x3c3195-0x0;var _0x2ee24e=_0x7aa2[_0x3c3195];return _0x2ee24e;};'use strict';var _=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var logger=require(_0x27aa('0x2'))(_0x27aa('0x3'));var moment=require(_0x27aa('0x4'));var BPromise=require(_0x27aa('0x5'));var rp=require(_0x27aa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27aa('0x7'));var config=require(_0x27aa('0x8'));var attributes=require(_0x27aa('0x9'));module['exports']=function(_0x2eb905,_0x29fcb7){return _0x2eb905[_0x27aa('0xa')](_0x27aa('0xb'),attributes,{'tableName':_0x27aa('0xc'),'paranoid':![],'indexes':[{'name':_0x27aa('0xd'),'fields':['idField',_0x27aa('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf675=['FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf675,0x199));var _0x5f67=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xf675[_0xcaf223];return _0x17e00d;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var logger=require(_0x5f67('0x2'))('api');var moment=require(_0x5f67('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f67('0x4'));var fs=require('fs');var path=require(_0x5f67('0x5'));var rimraf=require(_0x5f67('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f67('0x7'));module[_0x5f67('0x8')]=function(_0x2919cc,_0xd4b727){return _0x2919cc['define'](_0x5f67('0x9'),attributes,{'tableName':_0x5f67('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x5f67('0xb')],'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 49aeec4..df21750 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 _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x5b02,0xe9));var _0x25b0=function(_0x12bade,_0x9fdbf2){_0x12bade=_0x12bade-0x0;var _0x11f449=_0x5b02[_0x12bade];return _0x11f449;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0xa4ca28,_0x5a2130){var _0x47a8b5=function(_0x4ac4e1){while(--_0x4ac4e1){_0xa4ca28['push'](_0xa4ca28['shift']());}};_0x47a8b5(++_0x5a2130);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x386751,_0x593305){_0x386751=_0x386751-0x0;var _0x4d190f=_0x9ffd[_0x386751];return _0x4d190f;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1011cf0..3ec6043 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 _0x7266=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x5828b7,_0x30e810){var _0x533f42=function(_0x4d7b55){while(--_0x4d7b55){_0x5828b7['push'](_0x5828b7['shift']());}};_0x533f42(++_0x30e810);}(_0x7266,0xec));var _0x6726=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7266[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var path=require(_0x6726('0x2'));var timeout=require(_0x6726('0x3'));var express=require(_0x6726('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6726('0x5'));var config=require(_0x6726('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x6726('0x7')](),controller[_0x6726('0x8')]);router[_0x6726('0x9')](_0x6726('0xa'),auth[_0x6726('0x7')](),controller[_0x6726('0xb')]);router[_0x6726('0x9')](_0x6726('0xc'),auth[_0x6726('0x7')](),controller[_0x6726('0xd')]);router[_0x6726('0x9')](_0x6726('0xe'),auth[_0x6726('0x7')](),controller['getFields']);router[_0x6726('0xf')]('/',auth[_0x6726('0x7')](),controller[_0x6726('0x10')]);router[_0x6726('0xf')]('/:id/configurations',auth[_0x6726('0x7')](),controller['addConfiguration']);router[_0x6726('0x11')](_0x6726('0xa'),auth['isAuthenticated'](),controller[_0x6726('0x12')]);router[_0x6726('0x13')](_0x6726('0xa'),auth[_0x6726('0x7')](),controller['destroy']);module[_0x6726('0x14')]=router; \ No newline at end of file +var _0x8fa6=['/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x8fa6,0x1c0));var _0x68fa=function(_0x4ebea1,_0x22121b){_0x4ebea1=_0x4ebea1-0x0;var _0x1d78d8=_0x8fa6[_0x4ebea1];return _0x1d78d8;};'use strict';var multer=require(_0x68fa('0x0'));var util=require(_0x68fa('0x1'));var path=require(_0x68fa('0x2'));var timeout=require('connect-timeout');var express=require(_0x68fa('0x3'));var router=express[_0x68fa('0x4')]();var auth=require(_0x68fa('0x5'));var interaction=require(_0x68fa('0x6'));var config=require('../../config/environment');var controller=require(_0x68fa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x68fa('0x8')]);router['get'](_0x68fa('0x9'),auth[_0x68fa('0xa')](),controller[_0x68fa('0xb')]);router[_0x68fa('0xc')](_0x68fa('0xd'),auth[_0x68fa('0xa')](),controller['getConfigurations']);router[_0x68fa('0xc')](_0x68fa('0xe'),auth['isAuthenticated'](),controller[_0x68fa('0xf')]);router[_0x68fa('0x10')]('/',auth[_0x68fa('0xa')](),controller[_0x68fa('0x11')]);router['post']('/:id/configurations',auth[_0x68fa('0xa')](),controller['addConfiguration']);router['put']('/:id',auth[_0x68fa('0xa')](),controller[_0x68fa('0x12')]);router[_0x68fa('0x13')](_0x68fa('0x9'),auth[_0x68fa('0xa')](),controller[_0x68fa('0x14')]);module[_0x68fa('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 478aa6a..1349a37 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 _0x28c9=['sequelize','exports','STRING','username','remoteUri'];(function(_0x36d1f6,_0x522a10){var _0x138210=function(_0x27f93b){while(--_0x27f93b){_0x36d1f6['push'](_0x36d1f6['shift']());}};_0x138210(++_0x522a10);}(_0x28c9,0xb9));var _0x928c=function(_0x447b23,_0x49c577){_0x447b23=_0x447b23-0x0;var _0x2f37c7=_0x28c9[_0x447b23];return _0x2f37c7;};'use strict';var Sequelize=require(_0x928c('0x0'));module[_0x928c('0x1')]={'name':{'type':Sequelize[_0x928c('0x2')]},'description':{'type':Sequelize[_0x928c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x928c('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x928c('0x2')]},'remoteUri':{'type':Sequelize[_0x928c('0x2')],'unique':_0x928c('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a52=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4d3f61,_0x394c2d){var _0xa01b50=function(_0xa0b14b){while(--_0xa0b14b){_0x4d3f61['push'](_0x4d3f61['shift']());}};_0xa01b50(++_0x394c2d);}(_0x7a52,0x1a3));var _0x27a5=function(_0x5982d9,_0x538e83){_0x5982d9=_0x5982d9-0x0;var _0x3969d4=_0x7a52[_0x5982d9];return _0x3969d4;};'use strict';var Sequelize=require(_0x27a5('0x0'));module[_0x27a5('0x1')]={'name':{'type':Sequelize[_0x27a5('0x2')]},'description':{'type':Sequelize[_0x27a5('0x2')]},'username':{'type':Sequelize[_0x27a5('0x2')],'unique':_0x27a5('0x3')},'password':{'type':Sequelize[_0x27a5('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x27a5('0x4')},'serverUrl':{'type':Sequelize[_0x27a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e292d7f..871d124 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 _0x881e=['destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','body','getConfigurations','filter','addConfiguration','findOne','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','priority','sys_domain_path','rfc','expected_start','business_duration','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','closed_by','parent_incident','sys_id','problem_id','company','reassignment_count','activity_due','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','log','incident\x20table\x20objects','assign','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','statusCode','Wrong\x20credentials','boolean','True','true','False','inactive','false','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','request\x20sent','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','sendStatus','end','status','json','count','offset','Content-Range','save','update','then'];(function(_0x2e11d3,_0x26a29a){var _0x3f7f7f=function(_0x3c43f1){while(--_0x3c43f1){_0x2e11d3['push'](_0x2e11d3['shift']());}};_0x3f7f7f(++_0x26a29a);}(_0x881e,0x87));var _0xe881=function(_0xb218f0,_0x408110){_0xb218f0=_0xb218f0-0x0;var _0x1061ec=_0x881e[_0xb218f0];return _0x1061ec;};'use strict';var pdf=require(_0xe881('0x0'));var emlformat=require(_0xe881('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe881('0x2'));var jsonpatch=require(_0xe881('0x3'));var rp=require(_0xe881('0x4'));var moment=require(_0xe881('0x5'));var BPromise=require(_0xe881('0x6'));var Mustache=require(_0xe881('0x7'));var util=require('util');var path=require(_0xe881('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe881('0x9'));var squel=require(_0xe881('0xa'));var crypto=require('crypto');var jsforce=require(_0xe881('0xb'));var deskjs=require(_0xe881('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe881('0xd'));var Papa=require(_0xe881('0xe'));var Redis=require(_0xe881('0xf'));var authService=require(_0xe881('0x10'));var qs=require(_0xe881('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe881('0x12'));var logger=require('../../config/logger')(_0xe881('0x13'));var utils=require(_0xe881('0x14'));var config=require(_0xe881('0x15'));var db=require(_0xe881('0x16'))['db'];var integrations=require(_0xe881('0x17'));var jayson=require(_0xe881('0x18'));var client=jayson[_0xe881('0x19')][_0xe881('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x10611c,_0x498b1b,_0x216b10){if(_0x216b10){var _0x4471e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4471e1[_0xe881('0x1b')](_0x498b1b)){return _0x10611c;}else{throw new db[(_0xe881('0x1c'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x10611c;}}function respondWithRpcPromise(_0x47d830,_0x5d0495,_0x334aa4,_0x4d5e90){return new BPromise(function(_0x424aaa,_0x1ace09){var _0x2ddbe5=_0x4d5e90||client;return _0x2ddbe5[_0xe881('0x1d')](_0x47d830,_0x334aa4)['then'](function(_0xae2aaa){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5d0495,_0xe881('0x1e'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5d0495,_0xe881('0x1e'),JSON['stringify'](_0xae2aaa));if(_0xae2aaa[_0xe881('0x1f')]){if(_0xae2aaa[_0xe881('0x1f')][_0xe881('0x20')]===0x1f4){logger[_0xe881('0x1f')](_0xe881('0x21'),_0x5d0495,_0xae2aaa[_0xe881('0x1f')][_0xe881('0x22')]);return _0x1ace09(_0xae2aaa['error'][_0xe881('0x22')]);}logger[_0xe881('0x1f')](_0xe881('0x21'),_0x5d0495,_0xae2aaa[_0xe881('0x1f')][_0xe881('0x22')]);return _0x424aaa(_0xae2aaa[_0xe881('0x1f')]['message']);}else{logger[_0xe881('0x23')](_0xe881('0x21'),_0x5d0495,_0xe881('0x1e'));_0x424aaa(_0xae2aaa[_0xe881('0x24')][_0xe881('0x22')]);}})['catch'](function(_0x45a28f){logger[_0xe881('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x5d0495,_0x45a28f);_0x1ace09(_0x45a28f);});});}function respondWithStatusCode(_0x1c2781,_0x58aff7){_0x58aff7=_0x58aff7||0xcc;return function(_0x32ebe3){if(_0x32ebe3){return _0x1c2781[_0xe881('0x25')](_0x58aff7);}return _0x1c2781['status'](_0x58aff7)[_0xe881('0x26')]();};}function respondWithResult(_0x74efc6,_0x5de4a3){_0x5de4a3=_0x5de4a3||0xc8;return function(_0x352d5b){if(_0x352d5b){return _0x74efc6[_0xe881('0x27')](_0x5de4a3)[_0xe881('0x28')](_0x352d5b);}};}function respondWithFilteredResult(_0x384fd0,_0x43fb14){return function(_0x5f041f){if(_0x5f041f){var _0x166dd6=_0x5f041f[_0xe881('0x29')],_0x5c1b1b=_0x43fb14[_0xe881('0x2a')],_0x431132=_0x43fb14[_0xe881('0x2a')]+_0x43fb14['limit'],_0x1e21e5;if(_0x431132>=_0x166dd6){_0x431132=_0x166dd6;_0x1e21e5=0xc8;}else{_0x1e21e5=0xce;}_0x384fd0[_0xe881('0x27')](_0x1e21e5);return _0x384fd0['set'](_0xe881('0x2b'),_0x5c1b1b+'-'+_0x431132+'/'+_0x166dd6)[_0xe881('0x28')](_0x5f041f);}return null;};}function patchUpdates(_0x185616){return function(_0xf2d839){try{jsonpatch['apply'](_0xf2d839,_0x185616,!![]);}catch(_0x7a78cd){return BPromise['reject'](_0x7a78cd);}return _0xf2d839[_0xe881('0x2c')]();};}function saveUpdates(_0x51a193,_0x4ecb1b){return function(_0x47c252){if(_0x47c252){return _0x47c252[_0xe881('0x2d')](_0x51a193)[_0xe881('0x2e')](function(_0x3b692f){return _0x3b692f;});}return null;};}function removeEntity(_0x229ac5,_0x110d2a){return function(_0x24e0fd){if(_0x24e0fd){return _0x24e0fd[_0xe881('0x2f')]()[_0xe881('0x2e')](function(){_0x229ac5[_0xe881('0x27')](0xcc)[_0xe881('0x26')]();});}};}function handleEntityNotFound(_0x2626a4,_0x12714b){return function(_0x18b766){if(!_0x18b766){_0x2626a4[_0xe881('0x25')](0x194);}return _0x18b766;};}function handleError(_0x464fff,_0x5b9d0d){_0x5b9d0d=_0x5b9d0d||0x1f4;return function(_0x1f18b5){logger['error'](_0x1f18b5[_0xe881('0x30')]);if(_0x1f18b5[_0xe881('0x31')]){delete _0x1f18b5[_0xe881('0x31')];}_0x464fff[_0xe881('0x27')](_0x5b9d0d)[_0xe881('0x32')](_0x1f18b5);};}exports[_0xe881('0x33')]=function(_0x40ef8c,_0x5259b0){var _0xeffd10={},_0x2fd36a={},_0x2c63a7={'count':0x0,'rows':[]};var _0x1f251a=_[_0xe881('0x34')](db[_0xe881('0x35')][_0xe881('0x36')],function(_0x4e6156){return{'name':_0x4e6156[_0xe881('0x37')],'type':_0x4e6156[_0xe881('0x38')]['key']};});_0x2fd36a[_0xe881('0x39')]=_[_0xe881('0x34')](_0x1f251a,_0xe881('0x31'));_0x2fd36a[_0xe881('0x3a')]=_['keys'](_0x40ef8c['query']);_0x2fd36a[_0xe881('0x3b')]=_[_0xe881('0x3c')](_0x2fd36a[_0xe881('0x39')],_0x2fd36a[_0xe881('0x3a')]);_0xeffd10[_0xe881('0x3d')]=_[_0xe881('0x3c')](_0x2fd36a['model'],qs[_0xe881('0x3e')](_0x40ef8c[_0xe881('0x3a')][_0xe881('0x3e')]));_0xeffd10[_0xe881('0x3d')]=_0xeffd10[_0xe881('0x3d')][_0xe881('0x3f')]?_0xeffd10[_0xe881('0x3d')]:_0x2fd36a[_0xe881('0x39')];if(!_0x40ef8c[_0xe881('0x3a')][_0xe881('0x40')](_0xe881('0x41'))){_0xeffd10[_0xe881('0x42')]=qs[_0xe881('0x42')](_0x40ef8c[_0xe881('0x3a')][_0xe881('0x42')]);_0xeffd10['offset']=qs[_0xe881('0x2a')](_0x40ef8c[_0xe881('0x3a')][_0xe881('0x2a')]);}_0xeffd10[_0xe881('0x43')]=qs[_0xe881('0x44')](_0x40ef8c[_0xe881('0x3a')][_0xe881('0x44')]);_0xeffd10[_0xe881('0x45')]=qs[_0xe881('0x3b')](_[_0xe881('0x46')](_0x40ef8c[_0xe881('0x3a')],_0x2fd36a[_0xe881('0x3b')]),_0x1f251a);if(_0x40ef8c[_0xe881('0x3a')]['filter']){_0xeffd10[_0xe881('0x45')]=_[_0xe881('0x47')](_0xeffd10[_0xe881('0x45')],{'$or':_[_0xe881('0x34')](_0x1f251a,function(_0x114aad){if(_0x114aad[_0xe881('0x38')]!==_0xe881('0x48')){var _0x5aecaa={};_0x5aecaa[_0x114aad[_0xe881('0x31')]]={'$like':'%'+_0x40ef8c['query']['filter']+'%'};return _0x5aecaa;}})});}_0xeffd10=_[_0xe881('0x47')]({},_0xeffd10,_0x40ef8c[_0xe881('0x49')]);var _0x231e93={'where':_0xeffd10[_0xe881('0x45')]};return db[_0xe881('0x35')][_0xe881('0x29')](_0x231e93)[_0xe881('0x2e')](function(_0x794198){_0x2c63a7['count']=_0x794198;if(_0x40ef8c[_0xe881('0x3a')][_0xe881('0x4a')]){_0xeffd10[_0xe881('0x4b')]=[{'all':!![]}];}return db[_0xe881('0x35')][_0xe881('0x4c')](_0xeffd10);})[_0xe881('0x2e')](function(_0x35454b){_0x2c63a7['rows']=_0x35454b;return _0x2c63a7;})[_0xe881('0x2e')](respondWithFilteredResult(_0x5259b0,_0xeffd10))[_0xe881('0x4d')](handleError(_0x5259b0,null));};exports[_0xe881('0x4e')]=function(_0x55155c,_0x357a31){var _0x297961={'raw':![],'where':{'id':_0x55155c[_0xe881('0x4f')]['id']}},_0x9e34c8={};_0x9e34c8[_0xe881('0x39')]=_['keys'](db[_0xe881('0x35')][_0xe881('0x36')]);_0x9e34c8[_0xe881('0x3a')]=_[_0xe881('0x50')](_0x55155c['query']);_0x9e34c8[_0xe881('0x3b')]=_[_0xe881('0x3c')](_0x9e34c8['model'],_0x9e34c8[_0xe881('0x3a')]);_0x297961['attributes']=_[_0xe881('0x3c')](_0x9e34c8['model'],qs['fields'](_0x55155c['query'][_0xe881('0x3e')]));_0x297961[_0xe881('0x3d')]=_0x297961[_0xe881('0x3d')][_0xe881('0x3f')]?_0x297961[_0xe881('0x3d')]:_0x9e34c8[_0xe881('0x39')];if(_0x55155c['query']['includeAll']){_0x297961[_0xe881('0x4b')]=[{'all':!![]}];}_0x297961=_['merge']({},_0x297961,_0x55155c['options']);return db[_0xe881('0x35')][_0xe881('0x51')](_0x297961)[_0xe881('0x2e')](handleEntityNotFound(_0x357a31,null))[_0xe881('0x2e')](respondWithResult(_0x357a31,null))['catch'](handleError(_0x357a31,null));};exports['create']=function(_0x524951,_0x3c76a1){return db[_0xe881('0x35')]['create'](_0x524951[_0xe881('0x52')],{})['then'](respondWithResult(_0x3c76a1,0xc9))['catch'](handleError(_0x3c76a1,null));};exports[_0xe881('0x2d')]=function(_0xcf15b5,_0x45b703){if(_0xcf15b5[_0xe881('0x52')]['id']){delete _0xcf15b5[_0xe881('0x52')]['id'];}return db[_0xe881('0x35')][_0xe881('0x51')]({'where':{'id':_0xcf15b5[_0xe881('0x4f')]['id']}})[_0xe881('0x2e')](handleEntityNotFound(_0x45b703,null))['then'](saveUpdates(_0xcf15b5['body'],null))['then'](respondWithResult(_0x45b703,null))[_0xe881('0x4d')](handleError(_0x45b703,null));};exports[_0xe881('0x2f')]=function(_0x195e4e,_0xf8c888){return db[_0xe881('0x35')]['find']({'where':{'id':_0x195e4e[_0xe881('0x4f')]['id']}})[_0xe881('0x2e')](handleEntityNotFound(_0xf8c888,null))['then'](removeEntity(_0xf8c888,null))[_0xe881('0x4d')](handleError(_0xf8c888,null));};exports[_0xe881('0x53')]=function(_0x1a2c80,_0x1d1cd1,_0x219774){var _0xe9b99f={};var _0x2918bf={};var _0x54b091;var _0x1e2354;return db[_0xe881('0x35')]['findOne']({'where':{'id':_0x1a2c80[_0xe881('0x4f')]['id']}})[_0xe881('0x2e')](handleEntityNotFound(_0x1d1cd1,null))['then'](function(_0x5fa4c6){if(_0x5fa4c6){_0x54b091=_0x5fa4c6;_0x2918bf[_0xe881('0x39')]=_[_0xe881('0x50')](db['ServicenowConfiguration'][_0xe881('0x36')]);_0x2918bf['query']=_[_0xe881('0x50')](_0x1a2c80[_0xe881('0x3a')]);_0x2918bf[_0xe881('0x3b')]=_['intersection'](_0x2918bf['model'],_0x2918bf[_0xe881('0x3a')]);_0xe9b99f[_0xe881('0x3d')]=_[_0xe881('0x3c')](_0x2918bf[_0xe881('0x39')],qs[_0xe881('0x3e')](_0x1a2c80[_0xe881('0x3a')][_0xe881('0x3e')]));_0xe9b99f[_0xe881('0x3d')]=_0xe9b99f['attributes'][_0xe881('0x3f')]?_0xe9b99f['attributes']:_0x2918bf[_0xe881('0x39')];_0xe9b99f['order']=qs[_0xe881('0x44')](_0x1a2c80['query'][_0xe881('0x44')]);_0xe9b99f[_0xe881('0x45')]=qs[_0xe881('0x3b')](_[_0xe881('0x46')](_0x1a2c80[_0xe881('0x3a')],_0x2918bf['filters']));if(_0x1a2c80[_0xe881('0x3a')][_0xe881('0x54')]){_0xe9b99f[_0xe881('0x45')]=_['merge'](_0xe9b99f[_0xe881('0x45')],{'$or':_['map'](_0xe9b99f['attributes'],function(_0x6212e){var _0x22d82b={};_0x22d82b[_0x6212e]={'$like':'%'+_0x1a2c80[_0xe881('0x3a')][_0xe881('0x54')]+'%'};return _0x22d82b;})});}_0xe9b99f=_[_0xe881('0x47')]({},_0xe9b99f,_0x1a2c80[_0xe881('0x49')]);return _0x54b091[_0xe881('0x53')](_0xe9b99f);}})[_0xe881('0x2e')](function(_0x325173){if(_0x325173){_0x1e2354=_0x325173[_0xe881('0x3f')];if(!_0x1a2c80[_0xe881('0x3a')]['hasOwnProperty'](_0xe881('0x41'))){_0xe9b99f[_0xe881('0x42')]=qs[_0xe881('0x42')](_0x1a2c80[_0xe881('0x3a')][_0xe881('0x42')]);_0xe9b99f[_0xe881('0x2a')]=qs[_0xe881('0x2a')](_0x1a2c80[_0xe881('0x3a')][_0xe881('0x2a')]);}return _0x54b091[_0xe881('0x53')](_0xe9b99f);}})[_0xe881('0x2e')](function(_0x518182){if(_0x518182){return _0x518182?{'count':_0x1e2354,'rows':_0x518182}:null;}})[_0xe881('0x2e')](respondWithResult(_0x1d1cd1,null))[_0xe881('0x4d')](handleError(_0x1d1cd1,null));};exports[_0xe881('0x55')]=function(_0x2f94a2,_0x334e78,_0x1d5f2a){if(_0x2f94a2['body']['id']){delete _0x2f94a2['body']['id'];}return db[_0xe881('0x35')][_0xe881('0x56')]({'where':{'id':_0x2f94a2['params']['id']}})[_0xe881('0x2e')](handleEntityNotFound(_0x334e78,null))['then'](function(_0x3f8ac1){if(_0x3f8ac1){_0x2f94a2['body']['AccountId']=_0x3f8ac1['id'];_0x2f94a2[_0xe881('0x52')]['Subjects']=integrations['getSubjects'](_0x2f94a2['body']['channel'],_0x2f94a2[_0xe881('0x52')][_0xe881('0x38')]);_0x2f94a2[_0xe881('0x52')][_0xe881('0x57')]=integrations[_0xe881('0x58')](_0x2f94a2['body'][_0xe881('0x59')],_0x2f94a2[_0xe881('0x52')][_0xe881('0x38')]);return db['ServicenowConfiguration']['create'](_0x2f94a2[_0xe881('0x52')],{'include':[{'model':db[_0xe881('0x5a')],'as':_0xe881('0x5b')},{'model':db[_0xe881('0x5a')],'as':_0xe881('0x57')}]});}return null;})[_0xe881('0x2e')](respondWithResult(_0x334e78,null))[_0xe881('0x4d')](handleError(_0x334e78,null));};exports[_0xe881('0x5c')]=function(_0x1cfbd9,_0x5d9c4c,_0x479cee){var _0x51d0c0=[_0xe881('0x5d'),'hold_reason',_0xe881('0x5e'),_0xe881('0x5f'),_0xe881('0x60'),_0xe881('0x61'),_0xe881('0x62'),_0xe881('0x63'),_0xe881('0x64')];var _0x17d57a=['parent',_0xe881('0x5d'),_0xe881('0x65'),_0xe881('0x66'),_0xe881('0x67'),'sys_updated_on',_0xe881('0x68'),_0xe881('0x69'),_0xe881('0x6a'),_0xe881('0x6b'),_0xe881('0x6c'),_0xe881('0x6d'),_0xe881('0x6e'),'user_input',_0xe881('0x6f'),'sys_domain',_0xe881('0x70'),_0xe881('0x71'),_0xe881('0x5e'),_0xe881('0x43'),'calendar_stc',_0xe881('0x72'),_0xe881('0x73'),_0xe881('0x74'),'impact',_0xe881('0x75'),'work_notes_list','business_service',_0xe881('0x76'),_0xe881('0x77'),_0xe881('0x78'),'time_worked',_0xe881('0x79'),'opened_at',_0xe881('0x7a'),'group_list','work_end',_0xe881('0x7b'),'resolved_at',_0xe881('0x7c'),_0xe881('0x7d'),'subcategory',_0xe881('0x7e'),_0xe881('0x7f'),_0xe881('0x60'),_0xe881('0x80'),_0xe881('0x81'),_0xe881('0x82'),_0xe881('0x83'),_0xe881('0x84'),_0xe881('0x85'),_0xe881('0x86'),'calendar_duration','notify',_0xe881('0x87'),'close_notes',_0xe881('0x88'),'follow_up',_0xe881('0x89'),_0xe881('0x8a'),'contact_type','reopened_by','incident_state','urgency',_0xe881('0x8b'),_0xe881('0x8c'),_0xe881('0x8d'),_0xe881('0x8e'),'assigned_to',_0xe881('0x63'),'comments',_0xe881('0x8f'),'approval',_0xe881('0x90'),'due_date',_0xe881('0x91'),_0xe881('0x92'),'sys_tags',_0xe881('0x93'),_0xe881('0x94'),_0xe881('0x95'),'location',_0xe881('0x64')];var _0x4d8f9b='';var _0x18bd83='';var _0x48f408=[];var _0x1b2e52='';var _0x2db460='';var _0x4cc280=[];var _0x2f45af='';var _0x2121bc='';var _0x27da2d={};var _0x5cc5fa='';return db[_0xe881('0x35')][_0xe881('0x56')]({'where':{'id':_0x1cfbd9[_0xe881('0x4f')]['id']},'attributes':['id',_0xe881('0x96'),_0xe881('0x97'),_0xe881('0x98'),_0xe881('0x99'),_0xe881('0x9a')]})[_0xe881('0x2e')](handleEntityNotFound(_0x5d9c4c,null))[_0xe881('0x2e')](function(_0x130b8f){if(_0x130b8f){_0x5cc5fa=_0x130b8f[_0xe881('0x99')];var _0x2f479=_0x5cc5fa[_0xe881('0x9b')](-0x1);if(_0x2f479==='/'){_0x5cc5fa=_0x5cc5fa[_0xe881('0x9c')](0x0,_0x5cc5fa[_0xe881('0x9d')](_0x2f479));}_0x2121bc=util[_0xe881('0x9e')](_0xe881('0x9f'),_0x5cc5fa);_0x2f45af=util[_0xe881('0x9e')](_0xe881('0xa0'),_0x5cc5fa);_0x27da2d={'user':_0x130b8f[_0xe881('0x96')],'pass':_0x130b8f[_0xe881('0x97')]};var _0x5dbe97={'method':_0xe881('0xa1'),'uri':_0x2121bc+'incident?sysparm_display_value=all','auth':_0x27da2d,'json':!![]};return rp(_0x5dbe97);}})[_0xe881('0x2e')](function(_0x572498){if(_0x572498['result'][_0xe881('0x3f')]>0x0){_0x4d8f9b=_0x572498[_0xe881('0x24')];}console[_0xe881('0xa2')](_0xe881('0xa3'),_0x4d8f9b);_0x4cc280=[];_0x18bd83=Object[_0xe881('0xa4')]([],_0x4d8f9b);_['remove'](_0x18bd83,function(_0x3269e2){return!_0x51d0c0[_0xe881('0xa5')](_0x3269e2[_0xe881('0x31')]);});_0x18bd83[_0xe881('0xa6')](function(_0x521081){var _0x48d57e=createFieldObject(_0x2f45af,_0x27da2d,_0x521081[_0xe881('0xa7')],_0x521081[_0xe881('0x31')],_0x521081['label'],![]);_0x4cc280[_0xe881('0xa8')](_0x48d57e);});return Promise[_0xe881('0xa9')](_0x4cc280);})[_0xe881('0x2e')](function(_0x181d51){_0x48f408=_0x181d51;_0x1b2e52=Object[_0xe881('0xa4')]([],_0x4d8f9b);console[_0xe881('0xa2')](_0xe881('0xaa'),_0x4d8f9b);_['remove'](_0x1b2e52,function(_0x42ad96){return _0x17d57a['includes'](_0x42ad96[_0xe881('0x31')]);});console['log'](_0xe881('0xab'),_0x1b2e52);_0x4cc280=[];_0x1b2e52[_0xe881('0xa6')](function(_0x48288a){var _0x4eeb9d=createFieldObject(_0x2f45af,_0x27da2d,_0x48288a['internalType'],_0x48288a['name'],_0x48288a[_0xe881('0xac')],!![]);_0x4cc280[_0xe881('0xa8')](_0x4eeb9d);});return Promise['all'](_0x4cc280);})[_0xe881('0x2e')](function(_0x5907ba){_0x2db460=_0x5907ba;var _0x22b633=_0x48f408[_0xe881('0xad')](_0x2db460);return{'count':_0x22b633[_0xe881('0x3f')],'rows':_0x22b633};})['then'](respondWithResult(_0x5d9c4c,null))['catch'](function(_0x32903e){console[_0xe881('0xa2')]('ServiceNow\x20error:\x20'+_0x32903e);var _0xa807e7=_0x1cfbd9['query'][_0xe881('0x1b')]?0x1f4:_0x32903e[_0xe881('0xae')]||0x1f4;logger[_0xe881('0x1f')](_0x32903e['stack']);delete _0x32903e[_0xe881('0x31')];if(_0xa807e7===0x191){_0xa807e7=0x190;}_0x5d9c4c[_0xe881('0x27')](_0xa807e7)[_0xe881('0x32')](_0x1cfbd9[_0xe881('0x3a')][_0xe881('0x1b')]?{'message':_0xe881('0xaf'),'statusCode':_0x32903e[_0xe881('0xae')]}:_0x32903e);});};function createFieldObject(_0x337022,_0x28352a,_0x2fe167,_0xc8675f,_0x5a4fd7,_0x441978){return new Promise(function(_0x4a9bbd,_0x2cd9fc){var _0x5e9ab4={'id':_0xc8675f,'name':_0x5a4fd7,'custom':_0x441978};if(_0x2fe167===_0xe881('0xb0')){_0x5e9ab4[_0xe881('0x49')]=[{'name':_0xe881('0xb1'),'value':_0xe881('0xb2')},{'name':_0xe881('0xb3'),'value':'false'}];_0x4a9bbd(_0x5e9ab4);}else{var _0x3db968={'method':'GET','uri':_0x337022+'sys_choice?sysparm_query=name=incident^element='+_0xc8675f,'auth':_0x28352a,'json':!![]};return rp(_0x3db968)[_0xe881('0x2e')](function(_0x4ec944){var _0x1c1385=[];if(_0x4ec944['result'][_0xe881('0x3f')]>0x0){_0x4ec944[_0xe881('0x24')][_0xe881('0xa6')](function(_0x458145){if(_0x458145[_0xe881('0xb4')]===_0xe881('0xb5')){var _0x4f6523={'name':_0x458145[_0xe881('0xac')],'value':_0x458145['value']};_0x1c1385[_0xe881('0xa8')](_0x4f6523);}});}_0x5e9ab4['options']=_0x1c1385;if(_0x5e9ab4[_0xe881('0x49')][_0xe881('0x3f')]>0x0){_0x4a9bbd(_0x5e9ab4);}else{if(_0x441978==![]){_0x4a9bbd();}else{_0x4a9bbd(_0x5e9ab4);}}});}});} \ No newline at end of file +var _0x05a6=['index','ServicenowAccount','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','show','params','create','body','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','ServicenowField','made_sla','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','hold_reason','number','resolved_by','sys_domain','state','sys_created_by','knowledge','calendar_stc','delivery_plan','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','comments_and_work_notes','sys_mod_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send'];(function(_0x404174,_0x5624ea){var _0x1783ce=function(_0x245377){while(--_0x245377){_0x404174['push'](_0x404174['shift']());}};_0x1783ce(++_0x5624ea);}(_0x05a6,0x8c));var _0x605a=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x05a6[_0x382a62];return _0x490a25;};'use strict';var pdf=require(_0x605a('0x0'));var emlformat=require(_0x605a('0x1'));var rimraf=require(_0x605a('0x2'));var zipdir=require(_0x605a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x605a('0x4'));var moment=require(_0x605a('0x5'));var BPromise=require(_0x605a('0x6'));var Mustache=require(_0x605a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x605a('0x8'));var csv=require('to-csv');var ejs=require(_0x605a('0x9'));var fs=require('fs');var _=require(_0x605a('0xa'));var squel=require('squel');var crypto=require(_0x605a('0xb'));var jsforce=require(_0x605a('0xc'));var deskjs=require(_0x605a('0xd'));var toCsv=require(_0x605a('0xe'));var querystring=require(_0x605a('0xf'));var Papa=require(_0x605a('0x10'));var Redis=require(_0x605a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x605a('0x12'));var as=require(_0x605a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x605a('0x14'))(_0x605a('0x15'));var utils=require(_0x605a('0x16'));var config=require(_0x605a('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x605a('0x18'));var jayson=require(_0x605a('0x19'));var client=jayson[_0x605a('0x1a')][_0x605a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x249117,_0x3467b7,_0x523367){if(_0x523367){var _0x4ccb7a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ccb7a['test'](_0x3467b7)){return _0x249117;}else{throw new db[(_0x605a('0x1c'))][(_0x605a('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x249117;}}function respondWithRpcPromise(_0xc9a3a5,_0x333756,_0x375f17,_0x1d7b79){return new BPromise(function(_0x20bf9f,_0x146dcf){var _0xe67e24=_0x1d7b79||client;return _0xe67e24['request'](_0xc9a3a5,_0x375f17)[_0x605a('0x1e')](function(_0x34951b){logger['info'](_0x605a('0x1f'),_0x333756,_0x605a('0x20'));logger[_0x605a('0x21')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x333756,_0x605a('0x20'),JSON[_0x605a('0x22')](_0x34951b));if(_0x34951b[_0x605a('0x23')]){if(_0x34951b[_0x605a('0x23')][_0x605a('0x24')]===0x1f4){logger['error'](_0x605a('0x1f'),_0x333756,_0x34951b['error'][_0x605a('0x25')]);return _0x146dcf(_0x34951b[_0x605a('0x23')][_0x605a('0x25')]);}logger[_0x605a('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0x333756,_0x34951b[_0x605a('0x23')][_0x605a('0x25')]);return _0x20bf9f(_0x34951b[_0x605a('0x23')][_0x605a('0x25')]);}else{logger['info'](_0x605a('0x1f'),_0x333756,_0x605a('0x20'));_0x20bf9f(_0x34951b[_0x605a('0x26')]['message']);}})[_0x605a('0x27')](function(_0x5ecfe2){logger[_0x605a('0x23')](_0x605a('0x1f'),_0x333756,_0x5ecfe2);_0x146dcf(_0x5ecfe2);});});}function respondWithStatusCode(_0x5de238,_0x2d7331){_0x2d7331=_0x2d7331||0xcc;return function(_0x1dac2d){if(_0x1dac2d){return _0x5de238[_0x605a('0x28')](_0x2d7331);}return _0x5de238[_0x605a('0x29')](_0x2d7331)[_0x605a('0x2a')]();};}function respondWithResult(_0x3e87a3,_0x4829c2){_0x4829c2=_0x4829c2||0xc8;return function(_0x3c2ba8){if(_0x3c2ba8){return _0x3e87a3['status'](_0x4829c2)['json'](_0x3c2ba8);}};}function respondWithFilteredResult(_0x1c7fa9,_0x7e1d2c){return function(_0x2be8ef){if(_0x2be8ef){var _0x2e56a9=_0x2be8ef['count'],_0x1c0179=_0x7e1d2c['offset'],_0x183dd5=_0x7e1d2c['offset']+_0x7e1d2c[_0x605a('0x2b')],_0x16e721;if(_0x183dd5>=_0x2e56a9){_0x183dd5=_0x2e56a9;_0x16e721=0xc8;}else{_0x16e721=0xce;}_0x1c7fa9['status'](_0x16e721);return _0x1c7fa9[_0x605a('0x2c')](_0x605a('0x2d'),_0x1c0179+'-'+_0x183dd5+'/'+_0x2e56a9)['json'](_0x2be8ef);}return null;};}function patchUpdates(_0x21fc81){return function(_0x58f831){try{jsonpatch[_0x605a('0x2e')](_0x58f831,_0x21fc81,!![]);}catch(_0x55433c){return BPromise[_0x605a('0x2f')](_0x55433c);}return _0x58f831[_0x605a('0x30')]();};}function saveUpdates(_0x42a99d,_0x3a1347){return function(_0x5278da){if(_0x5278da){return _0x5278da['update'](_0x42a99d)[_0x605a('0x1e')](function(_0x48c006){return _0x48c006;});}return null;};}function removeEntity(_0x5132f6,_0x24d408){return function(_0x1ff33e){if(_0x1ff33e){return _0x1ff33e[_0x605a('0x31')]()[_0x605a('0x1e')](function(){_0x5132f6[_0x605a('0x29')](0xcc)[_0x605a('0x2a')]();});}};}function handleEntityNotFound(_0x38fdbf,_0x42f220){return function(_0x1d7539){if(!_0x1d7539){_0x38fdbf[_0x605a('0x28')](0x194);}return _0x1d7539;};}function handleError(_0x116c67,_0x9f36fa){_0x9f36fa=_0x9f36fa||0x1f4;return function(_0x37fa01){logger[_0x605a('0x23')](_0x37fa01[_0x605a('0x32')]);if(_0x37fa01[_0x605a('0x33')]){delete _0x37fa01[_0x605a('0x33')];}_0x116c67[_0x605a('0x29')](_0x9f36fa)[_0x605a('0x34')](_0x37fa01);};}exports[_0x605a('0x35')]=function(_0x4cfcd5,_0x4a2392){var _0x124812={},_0x4a9dc6={},_0x47f43a={'count':0x0,'rows':[]};var _0x2222d0=_['map'](db[_0x605a('0x36')][_0x605a('0x37')],function(_0x8ff850){return{'name':_0x8ff850['fieldName'],'type':_0x8ff850['type'][_0x605a('0x38')]};});_0x4a9dc6['model']=_[_0x605a('0x39')](_0x2222d0,_0x605a('0x33'));_0x4a9dc6[_0x605a('0x3a')]=_[_0x605a('0x3b')](_0x4cfcd5[_0x605a('0x3a')]);_0x4a9dc6[_0x605a('0x3c')]=_[_0x605a('0x3d')](_0x4a9dc6[_0x605a('0x3e')],_0x4a9dc6['query']);_0x124812[_0x605a('0x3f')]=_[_0x605a('0x3d')](_0x4a9dc6[_0x605a('0x3e')],qs[_0x605a('0x40')](_0x4cfcd5[_0x605a('0x3a')][_0x605a('0x40')]));_0x124812[_0x605a('0x3f')]=_0x124812['attributes'][_0x605a('0x41')]?_0x124812[_0x605a('0x3f')]:_0x4a9dc6[_0x605a('0x3e')];if(!_0x4cfcd5[_0x605a('0x3a')]['hasOwnProperty'](_0x605a('0x42'))){_0x124812[_0x605a('0x2b')]=qs[_0x605a('0x2b')](_0x4cfcd5['query'][_0x605a('0x2b')]);_0x124812[_0x605a('0x43')]=qs[_0x605a('0x43')](_0x4cfcd5[_0x605a('0x3a')][_0x605a('0x43')]);}_0x124812[_0x605a('0x44')]=qs[_0x605a('0x45')](_0x4cfcd5[_0x605a('0x3a')]['sort']);_0x124812[_0x605a('0x46')]=qs[_0x605a('0x3c')](_[_0x605a('0x47')](_0x4cfcd5['query'],_0x4a9dc6[_0x605a('0x3c')]),_0x2222d0);if(_0x4cfcd5[_0x605a('0x3a')][_0x605a('0x48')]){_0x124812[_0x605a('0x46')]=_[_0x605a('0x49')](_0x124812[_0x605a('0x46')],{'$or':_['map'](_0x2222d0,function(_0x5cab03){if(_0x5cab03[_0x605a('0x4a')]!=='VIRTUAL'){var _0x33a9a8={};_0x33a9a8[_0x5cab03['name']]={'$like':'%'+_0x4cfcd5[_0x605a('0x3a')][_0x605a('0x48')]+'%'};return _0x33a9a8;}})});}_0x124812=_[_0x605a('0x49')]({},_0x124812,_0x4cfcd5[_0x605a('0x4b')]);var _0x59137a={'where':_0x124812[_0x605a('0x46')]};return db['ServicenowAccount'][_0x605a('0x4c')](_0x59137a)['then'](function(_0x112f2e){_0x47f43a['count']=_0x112f2e;if(_0x4cfcd5['query'][_0x605a('0x4d')]){_0x124812[_0x605a('0x4e')]=[{'all':!![]}];}return db[_0x605a('0x36')][_0x605a('0x4f')](_0x124812);})['then'](function(_0x1ce639){_0x47f43a['rows']=_0x1ce639;return _0x47f43a;})[_0x605a('0x1e')](respondWithFilteredResult(_0x4a2392,_0x124812))[_0x605a('0x27')](handleError(_0x4a2392,null));};exports[_0x605a('0x50')]=function(_0x509de6,_0x153e18){var _0x1a8b46={'raw':![],'where':{'id':_0x509de6[_0x605a('0x51')]['id']}},_0x35ec7a={};_0x35ec7a[_0x605a('0x3e')]=_[_0x605a('0x3b')](db[_0x605a('0x36')][_0x605a('0x37')]);_0x35ec7a[_0x605a('0x3a')]=_[_0x605a('0x3b')](_0x509de6[_0x605a('0x3a')]);_0x35ec7a[_0x605a('0x3c')]=_[_0x605a('0x3d')](_0x35ec7a[_0x605a('0x3e')],_0x35ec7a['query']);_0x1a8b46[_0x605a('0x3f')]=_['intersection'](_0x35ec7a[_0x605a('0x3e')],qs['fields'](_0x509de6[_0x605a('0x3a')][_0x605a('0x40')]));_0x1a8b46['attributes']=_0x1a8b46[_0x605a('0x3f')][_0x605a('0x41')]?_0x1a8b46[_0x605a('0x3f')]:_0x35ec7a[_0x605a('0x3e')];if(_0x509de6[_0x605a('0x3a')]['includeAll']){_0x1a8b46['include']=[{'all':!![]}];}_0x1a8b46=_[_0x605a('0x49')]({},_0x1a8b46,_0x509de6[_0x605a('0x4b')]);return db[_0x605a('0x36')]['find'](_0x1a8b46)['then'](handleEntityNotFound(_0x153e18,null))['then'](respondWithResult(_0x153e18,null))[_0x605a('0x27')](handleError(_0x153e18,null));};exports[_0x605a('0x52')]=function(_0x590d0d,_0x100337){return db['ServicenowAccount'][_0x605a('0x52')](_0x590d0d[_0x605a('0x53')],{})['then'](respondWithResult(_0x100337,0xc9))[_0x605a('0x27')](handleError(_0x100337,null));};exports['update']=function(_0x253e3c,_0x1d20c9){if(_0x253e3c[_0x605a('0x53')]['id']){delete _0x253e3c[_0x605a('0x53')]['id'];}return db[_0x605a('0x36')]['find']({'where':{'id':_0x253e3c[_0x605a('0x51')]['id']}})['then'](handleEntityNotFound(_0x1d20c9,null))[_0x605a('0x1e')](saveUpdates(_0x253e3c[_0x605a('0x53')],null))[_0x605a('0x1e')](respondWithResult(_0x1d20c9,null))[_0x605a('0x27')](handleError(_0x1d20c9,null));};exports[_0x605a('0x31')]=function(_0x8649c1,_0x19bd04){return db[_0x605a('0x36')][_0x605a('0x54')]({'where':{'id':_0x8649c1[_0x605a('0x51')]['id']}})[_0x605a('0x1e')](handleEntityNotFound(_0x19bd04,null))[_0x605a('0x1e')](removeEntity(_0x19bd04,null))[_0x605a('0x27')](handleError(_0x19bd04,null));};exports[_0x605a('0x55')]=function(_0xebf36e,_0x1144b5,_0x4103b8){var _0x113c23={};var _0x109720={};var _0x453d80;var _0x1dd788;return db[_0x605a('0x36')][_0x605a('0x56')]({'where':{'id':_0xebf36e[_0x605a('0x51')]['id']}})[_0x605a('0x1e')](handleEntityNotFound(_0x1144b5,null))[_0x605a('0x1e')](function(_0x52952d){if(_0x52952d){_0x453d80=_0x52952d;_0x109720['model']=_[_0x605a('0x3b')](db['ServicenowConfiguration'][_0x605a('0x37')]);_0x109720[_0x605a('0x3a')]=_['keys'](_0xebf36e[_0x605a('0x3a')]);_0x109720[_0x605a('0x3c')]=_[_0x605a('0x3d')](_0x109720[_0x605a('0x3e')],_0x109720[_0x605a('0x3a')]);_0x113c23[_0x605a('0x3f')]=_[_0x605a('0x3d')](_0x109720[_0x605a('0x3e')],qs['fields'](_0xebf36e['query']['fields']));_0x113c23[_0x605a('0x3f')]=_0x113c23['attributes']['length']?_0x113c23[_0x605a('0x3f')]:_0x109720[_0x605a('0x3e')];_0x113c23[_0x605a('0x44')]=qs[_0x605a('0x45')](_0xebf36e[_0x605a('0x3a')][_0x605a('0x45')]);_0x113c23['where']=qs[_0x605a('0x3c')](_[_0x605a('0x47')](_0xebf36e[_0x605a('0x3a')],_0x109720['filters']));if(_0xebf36e[_0x605a('0x3a')][_0x605a('0x48')]){_0x113c23[_0x605a('0x46')]=_['merge'](_0x113c23[_0x605a('0x46')],{'$or':_[_0x605a('0x39')](_0x113c23[_0x605a('0x3f')],function(_0x37f028){var _0x25f333={};_0x25f333[_0x37f028]={'$like':'%'+_0xebf36e['query'][_0x605a('0x48')]+'%'};return _0x25f333;})});}_0x113c23=_[_0x605a('0x49')]({},_0x113c23,_0xebf36e['options']);return _0x453d80['getConfigurations'](_0x113c23);}})[_0x605a('0x1e')](function(_0x1ab276){if(_0x1ab276){_0x1dd788=_0x1ab276[_0x605a('0x41')];if(!_0xebf36e[_0x605a('0x3a')][_0x605a('0x57')]('nolimit')){_0x113c23['limit']=qs[_0x605a('0x2b')](_0xebf36e[_0x605a('0x3a')][_0x605a('0x2b')]);_0x113c23['offset']=qs[_0x605a('0x43')](_0xebf36e[_0x605a('0x3a')][_0x605a('0x43')]);}return _0x453d80[_0x605a('0x55')](_0x113c23);}})[_0x605a('0x1e')](function(_0x183934){if(_0x183934){return _0x183934?{'count':_0x1dd788,'rows':_0x183934}:null;}})[_0x605a('0x1e')](respondWithResult(_0x1144b5,null))['catch'](handleError(_0x1144b5,null));};exports[_0x605a('0x58')]=function(_0x2edaea,_0x328c95,_0x41e0d5){if(_0x2edaea[_0x605a('0x53')]['id']){delete _0x2edaea[_0x605a('0x53')]['id'];}return db[_0x605a('0x36')][_0x605a('0x56')]({'where':{'id':_0x2edaea['params']['id']}})['then'](handleEntityNotFound(_0x328c95,null))[_0x605a('0x1e')](function(_0x2d3ae4){if(_0x2d3ae4){_0x2edaea[_0x605a('0x53')][_0x605a('0x59')]=_0x2d3ae4['id'];_0x2edaea['body'][_0x605a('0x5a')]=integrations[_0x605a('0x5b')](_0x2edaea[_0x605a('0x53')]['channel'],_0x2edaea['body'][_0x605a('0x4a')]);_0x2edaea[_0x605a('0x53')][_0x605a('0x5c')]=integrations[_0x605a('0x5d')](_0x2edaea[_0x605a('0x53')][_0x605a('0x5e')],_0x2edaea[_0x605a('0x53')][_0x605a('0x4a')]);return db[_0x605a('0x5f')][_0x605a('0x52')](_0x2edaea['body'],{'include':[{'model':db[_0x605a('0x60')],'as':'Subjects'},{'model':db[_0x605a('0x60')],'as':'Descriptions'}]});}return null;})[_0x605a('0x1e')](respondWithResult(_0x328c95,null))[_0x605a('0x27')](handleError(_0x328c95,null));};exports['getFields']=function(_0x368017,_0x35eb48,_0x2e7066){var _0x40a91c=[_0x605a('0x61'),'hold_reason','knowledge',_0x605a('0x62'),_0x605a('0x63'),'notify',_0x605a('0x64'),'severity',_0x605a('0x65')];var _0x1b89c4=[_0x605a('0x66'),'made_sla',_0x605a('0x67'),_0x605a('0x68'),_0x605a('0x69'),'sys_updated_on',_0x605a('0x6a'),_0x605a('0x6b'),'approval_history',_0x605a('0x6c'),_0x605a('0x6d'),'sys_updated_by','opened_by','user_input','sys_created_on',_0x605a('0x6e'),_0x605a('0x6f'),_0x605a('0x70'),_0x605a('0x71'),_0x605a('0x44'),_0x605a('0x72'),'closed_at','cmdb_ci',_0x605a('0x73'),'impact',_0x605a('0x74'),_0x605a('0x75'),'business_service',_0x605a('0x76'),_0x605a('0x77'),_0x605a('0x78'),_0x605a('0x79'),_0x605a('0x7a'),_0x605a('0x7b'),_0x605a('0x7c'),_0x605a('0x7d'),'work_end',_0x605a('0x7e'),'resolved_at',_0x605a('0x7f'),_0x605a('0x80'),_0x605a('0x62'),_0x605a('0x81'),_0x605a('0x82'),_0x605a('0x63'),_0x605a('0x83'),_0x605a('0x84'),_0x605a('0x85'),_0x605a('0x86'),_0x605a('0x87'),_0x605a('0x88'),'description',_0x605a('0x89'),_0x605a('0x8a'),'sys_class_name',_0x605a('0x8b'),_0x605a('0x8c'),_0x605a('0x8d'),_0x605a('0x8e'),'sys_id',_0x605a('0x8f'),_0x605a('0x90'),'incident_state','urgency',_0x605a('0x91'),_0x605a('0x92'),_0x605a('0x93'),_0x605a('0x94'),_0x605a('0x95'),_0x605a('0x96'),_0x605a('0x97'),_0x605a('0x98'),'approval',_0x605a('0x99'),'due_date',_0x605a('0x9a'),'reopen_count',_0x605a('0x9b'),_0x605a('0x9c'),'upon_approval',_0x605a('0x9d'),_0x605a('0x9e'),_0x605a('0x65')];var _0x18a1c5='';var _0x56a39f='';var _0x266e19=[];var _0x264469='';var _0x588242='';var _0x1c73b1=[];var _0x381d35='';var _0x2740a7='';var _0x134ae0={};var _0x17363c='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x368017[_0x605a('0x51')]['id']},'attributes':['id',_0x605a('0x9f'),_0x605a('0xa0'),_0x605a('0xa1'),_0x605a('0xa2'),_0x605a('0xa3')]})[_0x605a('0x1e')](handleEntityNotFound(_0x35eb48,null))['then'](function(_0x338248){if(_0x338248){_0x17363c=_0x338248['remoteUri'];var _0xf88636=_0x17363c['slice'](-0x1);if(_0xf88636==='/'){_0x17363c=_0x17363c[_0x605a('0xa4')](0x0,_0x17363c['lastIndexOf'](_0xf88636));}_0x2740a7=util['format'](_0x605a('0xa5'),_0x17363c);_0x381d35=util[_0x605a('0xa6')](_0x605a('0xa7'),_0x17363c);_0x134ae0={'user':_0x338248[_0x605a('0x9f')],'pass':_0x338248[_0x605a('0xa0')]};var _0x9d55de={'method':_0x605a('0xa8'),'uri':_0x2740a7+'incident?sysparm_display_value=all','auth':_0x134ae0,'json':!![]};return rp(_0x9d55de);}})['then'](function(_0x4c8ca1){if(_0x4c8ca1[_0x605a('0x26')][_0x605a('0x41')]>0x0){_0x18a1c5=_0x4c8ca1[_0x605a('0x26')];}console[_0x605a('0xa9')](_0x605a('0xaa'),_0x18a1c5);_0x1c73b1=[];_0x56a39f=Object['assign']([],_0x18a1c5);_[_0x605a('0xab')](_0x56a39f,function(_0x1a6c46){return!_0x40a91c[_0x605a('0xac')](_0x1a6c46[_0x605a('0x33')]);});_0x56a39f[_0x605a('0xad')](function(_0x19eab2){var _0x50aad7=createFieldObject(_0x381d35,_0x134ae0,_0x19eab2[_0x605a('0xae')],_0x19eab2[_0x605a('0x33')],_0x19eab2[_0x605a('0xaf')],![]);_0x1c73b1['push'](_0x50aad7);});return Promise[_0x605a('0xb0')](_0x1c73b1);})['then'](function(_0x550826){_0x266e19=_0x550826;_0x264469=Object[_0x605a('0xb1')]([],_0x18a1c5);console[_0x605a('0xa9')](_0x605a('0xb2'),_0x18a1c5);_[_0x605a('0xab')](_0x264469,function(_0x45c29e){return _0x1b89c4['includes'](_0x45c29e['name']);});console[_0x605a('0xa9')](_0x605a('0xb3'),_0x264469);_0x1c73b1=[];_0x264469['forEach'](function(_0x5c098a){var _0x2da7c9=createFieldObject(_0x381d35,_0x134ae0,_0x5c098a[_0x605a('0xae')],_0x5c098a[_0x605a('0x33')],_0x5c098a['label'],!![]);_0x1c73b1['push'](_0x2da7c9);});return Promise[_0x605a('0xb0')](_0x1c73b1);})[_0x605a('0x1e')](function(_0x4ae835){_0x588242=_0x4ae835;var _0x1ec794=_0x266e19['concat'](_0x588242);return{'count':_0x1ec794[_0x605a('0x41')],'rows':_0x1ec794};})['then'](respondWithResult(_0x35eb48,null))[_0x605a('0x27')](function(_0x1468cd){console['log'](_0x605a('0xb4')+_0x1468cd);var _0x502a2b=_0x368017[_0x605a('0x3a')][_0x605a('0xb5')]?0x1f4:_0x1468cd[_0x605a('0xb6')]||0x1f4;logger['error'](_0x1468cd[_0x605a('0x32')]);delete _0x1468cd[_0x605a('0x33')];if(_0x502a2b===0x191){_0x502a2b=0x190;}_0x35eb48[_0x605a('0x29')](_0x502a2b)[_0x605a('0x34')](_0x368017[_0x605a('0x3a')][_0x605a('0xb5')]?{'message':_0x605a('0xb7'),'statusCode':_0x1468cd[_0x605a('0xb6')]}:_0x1468cd);});};function createFieldObject(_0x572b35,_0x11a200,_0x57bec7,_0xe37ac9,_0x1f549a,_0x19b12f){return new Promise(function(_0x2bc925,_0x3941de){var _0x10bade={'id':_0xe37ac9,'name':_0x1f549a,'custom':_0x19b12f};if(_0x57bec7===_0x605a('0xb8')){_0x10bade[_0x605a('0x4b')]=[{'name':_0x605a('0xb9'),'value':_0x605a('0xba')},{'name':_0x605a('0xbb'),'value':_0x605a('0xbc')}];_0x2bc925(_0x10bade);}else{var _0xd4c9df={'method':_0x605a('0xa8'),'uri':_0x572b35+_0x605a('0xbd')+_0xe37ac9,'auth':_0x11a200,'json':!![]};return rp(_0xd4c9df)[_0x605a('0x1e')](function(_0x2fddce){var _0x437181=[];if(_0x2fddce[_0x605a('0x26')]['length']>0x0){_0x2fddce['result']['forEach'](function(_0x4bfa9c){if(_0x4bfa9c[_0x605a('0xbe')]==='false'){var _0x4974b4={'name':_0x4bfa9c[_0x605a('0xaf')],'value':_0x4bfa9c[_0x605a('0xbf')]};_0x437181[_0x605a('0xc0')](_0x4974b4);}});}_0x10bade[_0x605a('0x4b')]=_0x437181;if(_0x10bade[_0x605a('0x4b')][_0x605a('0x41')]>0x0){_0x2bc925(_0x10bade);}else{if(_0x19b12f==![]){_0x2bc925();}else{_0x2bc925(_0x10bade);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8ce021f..24c824e 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 _0xd6d6=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x303af4,_0x35327a){var _0x67de7e=function(_0x22e3f8){while(--_0x22e3f8){_0x303af4['push'](_0x303af4['shift']());}};_0x67de7e(++_0x35327a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4c2079,_0x14b6ce){_0x4c2079=_0x4c2079-0x0;var _0x37074f=_0xd6d6[_0x4c2079];return _0x37074f;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));var integrations=require(_0x6d6d('0xa'));module['exports']=function(_0x210ff7,_0x1bf731){return _0x210ff7[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84e7=['ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x84e7,0x122));var _0x784e=function(_0x51ed09,_0x2891d6){_0x51ed09=_0x51ed09-0x0;var _0x5761b6=_0x84e7[_0x51ed09];return _0x5761b6;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));var integrations=require(_0x784e('0x8'));module[_0x784e('0x9')]=function(_0x48ed22,_0x3cbdd1){return _0x48ed22['define'](_0x784e('0xa'),attributes,{'tableName':_0x784e('0xb'),'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 a7e93ec..1a9be54 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 _0xbb9c=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','limit','map','include','model','GetServicenowAccount','debug','ShowServicenowAccount','ServicenowAccount','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb9c,0x6f));var _0xcbb9=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0xbb9c[_0x5ec453];return _0x25548f;};'use strict';var _=require(_0xcbb9('0x0'));var util=require('util');var moment=require(_0xcbb9('0x1'));var BPromise=require(_0xcbb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbb9('0x3'));var db=require(_0xcbb9('0x4'))['db'];var utils=require(_0xcbb9('0x5'));var logger=require(_0xcbb9('0x6'))(_0xcbb9('0x7'));var config=require(_0xcbb9('0x8'));var jayson=require(_0xcbb9('0x9'));var client=jayson[_0xcbb9('0xa')][_0xcbb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47347c,_0x4265c1,_0x4ba582){return new BPromise(function(_0x864ceb,_0x2a3409){return client[_0xcbb9('0xc')](_0x47347c,_0x4ba582)[_0xcbb9('0xd')](function(_0x3d1bf2){logger[_0xcbb9('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x4265c1,_0xcbb9('0xf'));logger['debug'](_0xcbb9('0x10'),_0x4265c1,_0xcbb9('0xf'),JSON[_0xcbb9('0x11')](_0x3d1bf2));if(_0x3d1bf2[_0xcbb9('0x12')]){if(_0x3d1bf2[_0xcbb9('0x12')][_0xcbb9('0x13')]===0x1f4){logger[_0xcbb9('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x4265c1,_0x3d1bf2[_0xcbb9('0x12')]['message']);return _0x2a3409(_0x3d1bf2['error']['message']);}logger['error'](_0xcbb9('0x14'),_0x4265c1,_0x3d1bf2[_0xcbb9('0x12')][_0xcbb9('0x15')]);return _0x864ceb(_0x3d1bf2[_0xcbb9('0x12')]['message']);}else{logger[_0xcbb9('0xe')](_0xcbb9('0x14'),_0x4265c1,'request\x20sent');_0x864ceb(_0x3d1bf2[_0xcbb9('0x16')]['message']);}})[_0xcbb9('0x17')](function(_0xed6cad){logger[_0xcbb9('0x12')](_0xcbb9('0x14'),_0x4265c1,_0xed6cad);_0x2a3409(_0xed6cad);});});}exports['GetServicenowAccount']=function(_0x2329b1){var _0x30fcdc=this;return new Promise(function(_0x3a9d6c,_0x42b228){return db['ServicenowAccount'][_0xcbb9('0x18')]({'raw':_0x2329b1['options']?_0x2329b1[_0xcbb9('0x19')][_0xcbb9('0x1a')]===undefined?!![]:![]:!![],'where':_0x2329b1[_0xcbb9('0x19')]?_0x2329b1[_0xcbb9('0x19')]['where']||null:null,'attributes':_0x2329b1[_0xcbb9('0x19')]?_0x2329b1['options'][_0xcbb9('0x1b')]||null:null,'limit':_0x2329b1[_0xcbb9('0x19')]?_0x2329b1[_0xcbb9('0x19')][_0xcbb9('0x1c')]||null:null,'include':_0x2329b1[_0xcbb9('0x19')]?_0x2329b1[_0xcbb9('0x19')]['include']?_[_0xcbb9('0x1d')](_0x2329b1[_0xcbb9('0x19')]['include'],function(_0x107ea5){return{'model':db[_0x107ea5['model']],'as':_0x107ea5['as'],'attributes':_0x107ea5[_0xcbb9('0x1b')],'include':_0x107ea5[_0xcbb9('0x1e')]?_['map'](_0x107ea5[_0xcbb9('0x1e')],function(_0x23e467){return{'model':db[_0x23e467[_0xcbb9('0x1f')]],'as':_0x23e467['as'],'attributes':_0x23e467[_0xcbb9('0x1b')],'include':_0x23e467['include']?_['map'](_0x23e467[_0xcbb9('0x1e')],function(_0x4ac5d1){return{'model':db[_0x4ac5d1['model']],'as':_0x4ac5d1['as'],'attributes':_0x4ac5d1[_0xcbb9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48734c){logger[_0xcbb9('0xe')](_0xcbb9('0x20'),_0x2329b1);logger[_0xcbb9('0x21')](_0xcbb9('0x20'),_0x2329b1,JSON[_0xcbb9('0x11')](_0x48734c));_0x3a9d6c(_0x48734c);})['catch'](function(_0x15b65e){logger[_0xcbb9('0x12')](_0xcbb9('0x20'),_0x15b65e[_0xcbb9('0x15')],_0x2329b1);_0x42b228(_0x30fcdc[_0xcbb9('0x12')](0x1f4,_0x15b65e[_0xcbb9('0x15')]));});});};exports[_0xcbb9('0x22')]=function(_0x1a08ff){var _0x4d699e=this;return new Promise(function(_0x3f2434,_0x4dccce){return db[_0xcbb9('0x23')]['find']({'raw':_0x1a08ff[_0xcbb9('0x19')]?_0x1a08ff[_0xcbb9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a08ff[_0xcbb9('0x19')]?_0x1a08ff[_0xcbb9('0x19')][_0xcbb9('0x24')]||null:null,'attributes':_0x1a08ff[_0xcbb9('0x19')]?_0x1a08ff[_0xcbb9('0x19')][_0xcbb9('0x1b')]||null:null,'include':_0x1a08ff[_0xcbb9('0x19')]?_0x1a08ff[_0xcbb9('0x19')][_0xcbb9('0x1e')]?_[_0xcbb9('0x1d')](_0x1a08ff['options'][_0xcbb9('0x1e')],function(_0x1c4866){return{'model':db[_0x1c4866[_0xcbb9('0x1f')]],'as':_0x1c4866['as'],'attributes':_0x1c4866['attributes'],'include':_0x1c4866[_0xcbb9('0x1e')]?_[_0xcbb9('0x1d')](_0x1c4866[_0xcbb9('0x1e')],function(_0x55e9d0){return{'model':db[_0x55e9d0[_0xcbb9('0x1f')]],'as':_0x55e9d0['as'],'attributes':_0x55e9d0[_0xcbb9('0x1b')],'include':_0x55e9d0[_0xcbb9('0x1e')]?_['map'](_0x55e9d0['include'],function(_0x59d94e){return{'model':db[_0x59d94e[_0xcbb9('0x1f')]],'as':_0x59d94e['as'],'attributes':_0x59d94e[_0xcbb9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcbb9('0xd')](function(_0x19fd16){logger[_0xcbb9('0xe')](_0xcbb9('0x22'),_0x1a08ff);logger[_0xcbb9('0x21')](_0xcbb9('0x22'),_0x1a08ff,JSON[_0xcbb9('0x11')](_0x19fd16));_0x3f2434(_0x19fd16);})[_0xcbb9('0x17')](function(_0xa48306){logger[_0xcbb9('0x12')](_0xcbb9('0x22'),_0xa48306[_0xcbb9('0x15')],_0x1a08ff);_0x4dccce(_0x4d699e[_0xcbb9('0x12')](0x1f4,_0xa48306[_0xcbb9('0x15')]));});});}; \ No newline at end of file +var _0x5950=['code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','attributes','limit','include','map','model','ShowServicenowAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b7700,_0x35b167){var _0x86c6ec=function(_0xf7090d){while(--_0xf7090d){_0x5b7700['push'](_0x5b7700['shift']());}};_0x86c6ec(++_0x35b167);}(_0x5950,0x113));var _0x0595=function(_0x33ae15,_0x156df5){_0x33ae15=_0x33ae15-0x0;var _0x44b88a=_0x5950[_0x33ae15];return _0x44b88a;};'use strict';var _=require(_0x0595('0x0'));var util=require(_0x0595('0x1'));var moment=require(_0x0595('0x2'));var BPromise=require(_0x0595('0x3'));var rs=require(_0x0595('0x4'));var fs=require('fs');var Redis=require(_0x0595('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0595('0x6'))(_0x0595('0x7'));var config=require(_0x0595('0x8'));var jayson=require(_0x0595('0x9'));var client=jayson[_0x0595('0xa')][_0x0595('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb924f5,_0x29ce79,_0x5bc9fc){return new BPromise(function(_0x4274f9,_0x5ef71a){return client[_0x0595('0xc')](_0xb924f5,_0x5bc9fc)[_0x0595('0xd')](function(_0x3dea1a){logger[_0x0595('0xe')](_0x0595('0xf'),_0x29ce79,_0x0595('0x10'));logger[_0x0595('0x11')](_0x0595('0x12'),_0x29ce79,_0x0595('0x10'),JSON[_0x0595('0x13')](_0x3dea1a));if(_0x3dea1a[_0x0595('0x14')]){if(_0x3dea1a[_0x0595('0x14')][_0x0595('0x15')]===0x1f4){logger[_0x0595('0x14')](_0x0595('0xf'),_0x29ce79,_0x3dea1a[_0x0595('0x14')][_0x0595('0x16')]);return _0x5ef71a(_0x3dea1a[_0x0595('0x14')]['message']);}logger[_0x0595('0x14')](_0x0595('0xf'),_0x29ce79,_0x3dea1a[_0x0595('0x14')]['message']);return _0x4274f9(_0x3dea1a[_0x0595('0x14')]['message']);}else{logger[_0x0595('0xe')](_0x0595('0xf'),_0x29ce79,_0x0595('0x10'));_0x4274f9(_0x3dea1a[_0x0595('0x17')]['message']);}})[_0x0595('0x18')](function(_0x3bc54f){logger[_0x0595('0x14')](_0x0595('0xf'),_0x29ce79,_0x3bc54f);_0x5ef71a(_0x3bc54f);});});}exports[_0x0595('0x19')]=function(_0xb83d79){var _0x1457bd=this;return new Promise(function(_0x9c9420,_0x2bd593){return db[_0x0595('0x1a')][_0x0595('0x1b')]({'raw':_0xb83d79['options']?_0xb83d79[_0x0595('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xb83d79[_0x0595('0x1c')]?_0xb83d79[_0x0595('0x1c')]['where']||null:null,'attributes':_0xb83d79[_0x0595('0x1c')]?_0xb83d79['options'][_0x0595('0x1d')]||null:null,'limit':_0xb83d79[_0x0595('0x1c')]?_0xb83d79[_0x0595('0x1c')][_0x0595('0x1e')]||null:null,'include':_0xb83d79['options']?_0xb83d79[_0x0595('0x1c')][_0x0595('0x1f')]?_[_0x0595('0x20')](_0xb83d79[_0x0595('0x1c')][_0x0595('0x1f')],function(_0x5614fd){return{'model':db[_0x5614fd[_0x0595('0x21')]],'as':_0x5614fd['as'],'attributes':_0x5614fd[_0x0595('0x1d')],'include':_0x5614fd[_0x0595('0x1f')]?_[_0x0595('0x20')](_0x5614fd[_0x0595('0x1f')],function(_0x22505c){return{'model':db[_0x22505c[_0x0595('0x21')]],'as':_0x22505c['as'],'attributes':_0x22505c['attributes'],'include':_0x22505c[_0x0595('0x1f')]?_[_0x0595('0x20')](_0x22505c[_0x0595('0x1f')],function(_0x57358f){return{'model':db[_0x57358f[_0x0595('0x21')]],'as':_0x57358f['as'],'attributes':_0x57358f[_0x0595('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0595('0xd')](function(_0x1889e1){logger[_0x0595('0xe')](_0x0595('0x19'),_0xb83d79);logger['debug'](_0x0595('0x19'),_0xb83d79,JSON['stringify'](_0x1889e1));_0x9c9420(_0x1889e1);})[_0x0595('0x18')](function(_0x185036){logger[_0x0595('0x14')](_0x0595('0x19'),_0x185036[_0x0595('0x16')],_0xb83d79);_0x2bd593(_0x1457bd[_0x0595('0x14')](0x1f4,_0x185036[_0x0595('0x16')]));});});};exports[_0x0595('0x22')]=function(_0x4ba188){var _0x55d8cc=this;return new Promise(function(_0x54f2cd,_0x51d553){return db[_0x0595('0x1a')][_0x0595('0x23')]({'raw':_0x4ba188[_0x0595('0x1c')]?_0x4ba188['options'][_0x0595('0x24')]===undefined?!![]:![]:!![],'where':_0x4ba188[_0x0595('0x1c')]?_0x4ba188[_0x0595('0x1c')]['where']||null:null,'attributes':_0x4ba188[_0x0595('0x1c')]?_0x4ba188['options'][_0x0595('0x1d')]||null:null,'include':_0x4ba188[_0x0595('0x1c')]?_0x4ba188['options'][_0x0595('0x1f')]?_[_0x0595('0x20')](_0x4ba188[_0x0595('0x1c')][_0x0595('0x1f')],function(_0x4028cf){return{'model':db[_0x4028cf['model']],'as':_0x4028cf['as'],'attributes':_0x4028cf[_0x0595('0x1d')],'include':_0x4028cf['include']?_[_0x0595('0x20')](_0x4028cf[_0x0595('0x1f')],function(_0x1971a5){return{'model':db[_0x1971a5[_0x0595('0x21')]],'as':_0x1971a5['as'],'attributes':_0x1971a5[_0x0595('0x1d')],'include':_0x1971a5[_0x0595('0x1f')]?_[_0x0595('0x20')](_0x1971a5['include'],function(_0x44a4e7){return{'model':db[_0x44a4e7[_0x0595('0x21')]],'as':_0x44a4e7['as'],'attributes':_0x44a4e7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0595('0xd')](function(_0x1f669e){logger[_0x0595('0xe')]('ShowServicenowAccount',_0x4ba188);logger[_0x0595('0x11')]('ShowServicenowAccount',_0x4ba188,JSON[_0x0595('0x13')](_0x1f669e));_0x54f2cd(_0x1f669e);})[_0x0595('0x18')](function(_0x1fa019){logger[_0x0595('0x14')]('ShowServicenowAccount',_0x1fa019['message'],_0x4ba188);_0x51d553(_0x55d8cc[_0x0595('0x14')](0x1f4,_0x1fa019[_0x0595('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e38bda2..6bda2e8 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 _0xb4d5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xb4d5,0xcb));var _0x5b4d=function(_0x1705ec,_0xb5c7bb){_0x1705ec=_0x1705ec-0x0;var _0x4cd01a=_0xb4d5[_0x1705ec];return _0x4cd01a;};'use strict';var multer=require(_0x5b4d('0x0'));var util=require('util');var path=require(_0x5b4d('0x1'));var timeout=require(_0x5b4d('0x2'));var express=require('express');var router=express[_0x5b4d('0x3')]();var auth=require(_0x5b4d('0x4'));var interaction=require(_0x5b4d('0x5'));var config=require(_0x5b4d('0x6'));var controller=require(_0x5b4d('0x7'));router[_0x5b4d('0x8')]('/',auth[_0x5b4d('0x9')](),controller[_0x5b4d('0xa')]);router[_0x5b4d('0x8')](_0x5b4d('0xb'),auth['isAuthenticated'](),controller[_0x5b4d('0xc')]);router[_0x5b4d('0x8')]('/:id/fields',auth[_0x5b4d('0x9')](),controller[_0x5b4d('0xd')]);router['get'](_0x5b4d('0xe'),auth['isAuthenticated'](),controller[_0x5b4d('0xf')]);router[_0x5b4d('0x8')]('/:id/descriptions',auth[_0x5b4d('0x9')](),controller[_0x5b4d('0x10')]);router[_0x5b4d('0x11')]('/',auth[_0x5b4d('0x9')](),controller[_0x5b4d('0x12')]);router['put'](_0x5b4d('0xb'),auth[_0x5b4d('0x9')](),controller[_0x5b4d('0x13')]);router[_0x5b4d('0x14')](_0x5b4d('0xb'),auth[_0x5b4d('0x9')](),controller[_0x5b4d('0x15')]);module[_0x5b4d('0x16')]=router; \ No newline at end of file +var _0x5e39=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util'];(function(_0x58b6a8,_0x307021){var _0xc566dc=function(_0x59bd76){while(--_0x59bd76){_0x58b6a8['push'](_0x58b6a8['shift']());}};_0xc566dc(++_0x307021);}(_0x5e39,0x18e));var _0x95e3=function(_0x516200,_0x34e796){_0x516200=_0x516200-0x0;var _0x3e5528=_0x5e39[_0x516200];return _0x3e5528;};'use strict';var multer=require(_0x95e3('0x0'));var util=require(_0x95e3('0x1'));var path=require('path');var timeout=require(_0x95e3('0x2'));var express=require(_0x95e3('0x3'));var router=express[_0x95e3('0x4')]();var auth=require(_0x95e3('0x5'));var interaction=require(_0x95e3('0x6'));var config=require('../../config/environment');var controller=require(_0x95e3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x95e3('0x8')]);router[_0x95e3('0x9')](_0x95e3('0xa'),auth['isAuthenticated'](),controller[_0x95e3('0xb')]);router['get'](_0x95e3('0xc'),auth[_0x95e3('0xd')](),controller[_0x95e3('0xe')]);router[_0x95e3('0x9')](_0x95e3('0xf'),auth[_0x95e3('0xd')](),controller[_0x95e3('0x10')]);router['get'](_0x95e3('0x11'),auth[_0x95e3('0xd')](),controller[_0x95e3('0x12')]);router[_0x95e3('0x13')]('/',auth['isAuthenticated'](),controller[_0x95e3('0x14')]);router[_0x95e3('0x15')](_0x95e3('0xa'),auth[_0x95e3('0xd')](),controller[_0x95e3('0x16')]);router[_0x95e3('0x17')]('/:id',auth[_0x95e3('0xd')](),controller[_0x95e3('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index c79d012..1faa979 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 _0xf4ef=['sequelize','STRING'];(function(_0x2e7368,_0x52747a){var _0x5d074d=function(_0x43e4e4){while(--_0x43e4e4){_0x2e7368['push'](_0x2e7368['shift']());}};_0x5d074d(++_0x52747a);}(_0xf4ef,0x8e));var _0xff4e=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0xf4ef[_0xe2c95e];return _0x42ce6f;};'use strict';var Sequelize=require(_0xff4e('0x0'));module['exports']={'name':{'type':Sequelize[_0xff4e('0x1')]},'description':{'type':Sequelize[_0xff4e('0x1')]}}; \ No newline at end of file +var _0x8d29=['exports','STRING','sequelize'];(function(_0x5d5861,_0x470782){var _0x227747=function(_0x3e6c9c){while(--_0x3e6c9c){_0x5d5861['push'](_0x5d5861['shift']());}};_0x227747(++_0x470782);}(_0x8d29,0x1af));var _0x98d2=function(_0x4071b7,_0x4ff719){_0x4071b7=_0x4071b7-0x0;var _0x3d198b=_0x8d29[_0x4071b7];return _0x3d198b;};'use strict';var Sequelize=require(_0x98d2('0x0'));module[_0x98d2('0x1')]={'name':{'type':Sequelize[_0x98d2('0x2')]},'description':{'type':Sequelize[_0x98d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index fa9e4cd..f1d9702 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 _0xefda=['stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','apply','update','destroy','then','end','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','limit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','length','find','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','order','hasOwnProperty','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x16446a,_0x5e9140){var _0x2c7051=function(_0x2e6a25){while(--_0x2e6a25){_0x16446a['push'](_0x16446a['shift']());}};_0x2c7051(++_0x5e9140);}(_0xefda,0x96));var _0xaefd=function(_0x3d32db,_0x3a5ec1){_0x3d32db=_0x3d32db-0x0;var _0x1df2d7=_0xefda[_0x3d32db];return _0x1df2d7;};'use strict';var pdf=require(_0xaefd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaefd('0x1'));var jsonpatch=require(_0xaefd('0x2'));var rp=require('request-promise');var moment=require(_0xaefd('0x3'));var BPromise=require(_0xaefd('0x4'));var Mustache=require(_0xaefd('0x5'));var util=require(_0xaefd('0x6'));var path=require(_0xaefd('0x7'));var sox=require(_0xaefd('0x8'));var csv=require('to-csv');var ejs=require(_0xaefd('0x9'));var fs=require('fs');var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0xe'));var querystring=require(_0xaefd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0x10'));var as=require(_0xaefd('0x11'));var hardwareService=require(_0xaefd('0x12'));var logger=require(_0xaefd('0x13'))(_0xaefd('0x14'));var utils=require(_0xaefd('0x15'));var config=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var jayson=require(_0xaefd('0x18'));var client=jayson[_0xaefd('0x19')][_0xaefd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4b2b5c,_0x3172d3,_0x4ac467){if(_0x4ac467){var _0xd88c7c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd88c7c[_0xaefd('0x1b')](_0x3172d3)){return _0x4b2b5c;}else{throw new db[(_0xaefd('0x1c'))][(_0xaefd('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4b2b5c;}}function respondWithRpcPromise(_0x16e4f4,_0x13492c,_0x41f345,_0x411701){return new BPromise(function(_0x10ee28,_0x32f75e){var _0x277070=_0x411701||client;return _0x277070[_0xaefd('0x1e')](_0x16e4f4,_0x41f345)['then'](function(_0x9d9c29){logger[_0xaefd('0x1f')](_0xaefd('0x20'),_0x13492c,_0xaefd('0x21'));logger[_0xaefd('0x22')](_0xaefd('0x23'),_0x13492c,'request\x20sent',JSON[_0xaefd('0x24')](_0x9d9c29));if(_0x9d9c29[_0xaefd('0x25')]){if(_0x9d9c29[_0xaefd('0x25')][_0xaefd('0x26')]===0x1f4){logger[_0xaefd('0x25')](_0xaefd('0x20'),_0x13492c,_0x9d9c29['error'][_0xaefd('0x27')]);return _0x32f75e(_0x9d9c29[_0xaefd('0x25')][_0xaefd('0x27')]);}logger[_0xaefd('0x25')](_0xaefd('0x20'),_0x13492c,_0x9d9c29['error']['message']);return _0x10ee28(_0x9d9c29['error'][_0xaefd('0x27')]);}else{logger[_0xaefd('0x1f')](_0xaefd('0x20'),_0x13492c,'request\x20sent');_0x10ee28(_0x9d9c29[_0xaefd('0x28')]['message']);}})[_0xaefd('0x29')](function(_0x3caa99){logger[_0xaefd('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13492c,_0x3caa99);_0x32f75e(_0x3caa99);});});}function respondWithStatusCode(_0x435413,_0x3ffc9c){_0x3ffc9c=_0x3ffc9c||0xcc;return function(_0x18e720){if(_0x18e720){return _0x435413[_0xaefd('0x2a')](_0x3ffc9c);}return _0x435413[_0xaefd('0x2b')](_0x3ffc9c)['end']();};}function respondWithResult(_0x2fe27e,_0x58c008){_0x58c008=_0x58c008||0xc8;return function(_0x810bf){if(_0x810bf){return _0x2fe27e[_0xaefd('0x2b')](_0x58c008)['json'](_0x810bf);}};}function respondWithFilteredResult(_0x2b3d3d,_0x2a8fa8){return function(_0x521839){if(_0x521839){var _0xbeb1b8=_0x521839[_0xaefd('0x2c')],_0x114ec0=_0x2a8fa8['offset'],_0x36b6b7=_0x2a8fa8[_0xaefd('0x2d')]+_0x2a8fa8['limit'],_0x4c0898;if(_0x36b6b7>=_0xbeb1b8){_0x36b6b7=_0xbeb1b8;_0x4c0898=0xc8;}else{_0x4c0898=0xce;}_0x2b3d3d['status'](_0x4c0898);return _0x2b3d3d[_0xaefd('0x2e')](_0xaefd('0x2f'),_0x114ec0+'-'+_0x36b6b7+'/'+_0xbeb1b8)['json'](_0x521839);}return null;};}function patchUpdates(_0x578378){return function(_0x4ee0c1){try{jsonpatch[_0xaefd('0x30')](_0x4ee0c1,_0x578378,!![]);}catch(_0x280eab){return BPromise['reject'](_0x280eab);}return _0x4ee0c1['save']();};}function saveUpdates(_0x62ef86,_0x465d99){return function(_0x3f4947){if(_0x3f4947){return _0x3f4947[_0xaefd('0x31')](_0x62ef86)['then'](function(_0x3ff5b2){return _0x3ff5b2;});}return null;};}function removeEntity(_0x36854f,_0x3b11e4){return function(_0xad59fc){if(_0xad59fc){return _0xad59fc[_0xaefd('0x32')]()[_0xaefd('0x33')](function(){_0x36854f[_0xaefd('0x2b')](0xcc)[_0xaefd('0x34')]();});}};}function handleEntityNotFound(_0x3e3fe2,_0x234780){return function(_0x3744a5){if(!_0x3744a5){_0x3e3fe2[_0xaefd('0x2a')](0x194);}return _0x3744a5;};}function handleError(_0x304d34,_0x26a6bd){_0x26a6bd=_0x26a6bd||0x1f4;return function(_0x1ffec4){logger[_0xaefd('0x25')](_0x1ffec4['stack']);if(_0x1ffec4[_0xaefd('0x35')]){delete _0x1ffec4[_0xaefd('0x35')];}_0x304d34[_0xaefd('0x2b')](_0x26a6bd)['send'](_0x1ffec4);};}exports[_0xaefd('0x36')]=function(_0x577389,_0x187e76){var _0x3498d9={},_0x99a883={},_0xbbbf6d={'count':0x0,'rows':[]};var _0x2c0d72=_[_0xaefd('0x37')](db[_0xaefd('0x38')][_0xaefd('0x39')],function(_0x407bea){return{'name':_0x407bea[_0xaefd('0x3a')],'type':_0x407bea[_0xaefd('0x3b')][_0xaefd('0x3c')]};});_0x99a883[_0xaefd('0x3d')]=_[_0xaefd('0x37')](_0x2c0d72,'name');_0x99a883[_0xaefd('0x3e')]=_['keys'](_0x577389[_0xaefd('0x3e')]);_0x99a883[_0xaefd('0x3f')]=_[_0xaefd('0x40')](_0x99a883[_0xaefd('0x3d')],_0x99a883[_0xaefd('0x3e')]);_0x3498d9[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x99a883[_0xaefd('0x3d')],qs[_0xaefd('0x42')](_0x577389[_0xaefd('0x3e')]['fields']));_0x3498d9[_0xaefd('0x41')]=_0x3498d9[_0xaefd('0x41')]['length']?_0x3498d9[_0xaefd('0x41')]:_0x99a883[_0xaefd('0x3d')];if(!_0x577389[_0xaefd('0x3e')]['hasOwnProperty']('nolimit')){_0x3498d9[_0xaefd('0x43')]=qs[_0xaefd('0x43')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x3498d9[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x2d')]);}_0x3498d9['order']=qs[_0xaefd('0x44')](_0x577389[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x3498d9[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x577389[_0xaefd('0x3e')],_0x99a883[_0xaefd('0x3f')]),_0x2c0d72);if(_0x577389['query']['filter']){_0x3498d9[_0xaefd('0x45')]=_[_0xaefd('0x47')](_0x3498d9['where'],{'$or':_['map'](_0x2c0d72,function(_0x17d611){if(_0x17d611[_0xaefd('0x3b')]!==_0xaefd('0x48')){var _0x1ba03a={};_0x1ba03a[_0x17d611[_0xaefd('0x35')]]={'$like':'%'+_0x577389[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x1ba03a;}})});}_0x3498d9=_[_0xaefd('0x47')]({},_0x3498d9,_0x577389[_0xaefd('0x4a')]);var _0x558a75={'where':_0x3498d9[_0xaefd('0x45')]};return db[_0xaefd('0x38')][_0xaefd('0x2c')](_0x558a75)[_0xaefd('0x33')](function(_0x224613){_0xbbbf6d[_0xaefd('0x2c')]=_0x224613;if(_0x577389[_0xaefd('0x3e')]['includeAll']){_0x3498d9[_0xaefd('0x4b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xaefd('0x4c')](_0x3498d9);})[_0xaefd('0x33')](function(_0x16c664){_0xbbbf6d[_0xaefd('0x4d')]=_0x16c664;return _0xbbbf6d;})['then'](respondWithFilteredResult(_0x187e76,_0x3498d9))['catch'](handleError(_0x187e76,null));};exports[_0xaefd('0x4e')]=function(_0x34839e,_0x179b8b){var _0x4eeb56={'raw':![],'where':{'id':_0x34839e[_0xaefd('0x4f')]['id']}},_0x2a836a={};_0x2a836a['model']=_[_0xaefd('0x50')](db[_0xaefd('0x38')][_0xaefd('0x39')]);_0x2a836a[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x34839e[_0xaefd('0x3e')]);_0x2a836a[_0xaefd('0x3f')]=_[_0xaefd('0x40')](_0x2a836a['model'],_0x2a836a['query']);_0x4eeb56[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x2a836a['model'],qs[_0xaefd('0x42')](_0x34839e['query'][_0xaefd('0x42')]));_0x4eeb56[_0xaefd('0x41')]=_0x4eeb56[_0xaefd('0x41')][_0xaefd('0x51')]?_0x4eeb56[_0xaefd('0x41')]:_0x2a836a[_0xaefd('0x3d')];if(_0x34839e['query']['includeAll']){_0x4eeb56[_0xaefd('0x4b')]=[{'all':!![]}];}_0x4eeb56=_[_0xaefd('0x47')]({},_0x4eeb56,_0x34839e['options']);return db[_0xaefd('0x38')][_0xaefd('0x52')](_0x4eeb56)[_0xaefd('0x33')](handleEntityNotFound(_0x179b8b,null))[_0xaefd('0x33')](respondWithResult(_0x179b8b,null))['catch'](handleError(_0x179b8b,null));};exports['create']=function(_0x2b0d8e,_0x41ef40){return db[_0xaefd('0x38')][_0xaefd('0x53')](_0x2b0d8e[_0xaefd('0x54')],{})['then'](respondWithResult(_0x41ef40,0xc9))[_0xaefd('0x29')](handleError(_0x41ef40,null));};exports[_0xaefd('0x31')]=function(_0x5a54fb,_0xbeca29){if(_0x5a54fb[_0xaefd('0x54')]['id']){delete _0x5a54fb['body']['id'];}return db[_0xaefd('0x38')][_0xaefd('0x52')]({'where':{'id':_0x5a54fb[_0xaefd('0x4f')]['id']}})['then'](handleEntityNotFound(_0xbeca29,null))[_0xaefd('0x33')](saveUpdates(_0x5a54fb[_0xaefd('0x54')],null))['then'](respondWithResult(_0xbeca29,null))[_0xaefd('0x29')](handleError(_0xbeca29,null));};exports[_0xaefd('0x32')]=function(_0x14b472,_0x2dd1ee){return db['ServicenowConfiguration']['find']({'where':{'id':_0x14b472[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x2dd1ee,null))[_0xaefd('0x33')](removeEntity(_0x2dd1ee,null))[_0xaefd('0x29')](handleError(_0x2dd1ee,null));};exports[_0xaefd('0x55')]=function(_0x8ab9e7,_0x314660,_0x368fd3){var _0x1e519e={};var _0x133c4f={};var _0x48636d;var _0x4fc1f9;return db[_0xaefd('0x38')][_0xaefd('0x56')]({'where':{'id':_0x8ab9e7[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x314660,null))['then'](function(_0x13309e){if(_0x13309e){_0x48636d=_0x13309e;_0x133c4f[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db[_0xaefd('0x57')][_0xaefd('0x39')]);_0x133c4f[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x8ab9e7[_0xaefd('0x3e')]);_0x133c4f['filters']=_[_0xaefd('0x40')](_0x133c4f[_0xaefd('0x3d')],_0x133c4f[_0xaefd('0x3e')]);_0x1e519e[_0xaefd('0x41')]=_['intersection'](_0x133c4f[_0xaefd('0x3d')],qs['fields'](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x42')]));_0x1e519e['attributes']=_0x1e519e['attributes'][_0xaefd('0x51')]?_0x1e519e['attributes']:_0x133c4f['model'];_0x1e519e['order']=qs[_0xaefd('0x44')](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x1e519e[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x8ab9e7['query'],_0x133c4f['filters']));if(_0x8ab9e7['query']['filter']){_0x1e519e[_0xaefd('0x45')]=_['merge'](_0x1e519e[_0xaefd('0x45')],{'$or':_['map'](_0x1e519e[_0xaefd('0x41')],function(_0x32dc0d){var _0x416241={};_0x416241[_0x32dc0d]={'$like':'%'+_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x416241;})});}_0x1e519e=_[_0xaefd('0x47')]({},_0x1e519e,_0x8ab9e7[_0xaefd('0x4a')]);return _0x48636d['getFields'](_0x1e519e);}})[_0xaefd('0x33')](function(_0x4113e4){if(_0x4113e4){_0x4fc1f9=_0x4113e4[_0xaefd('0x51')];if(!_0x8ab9e7[_0xaefd('0x3e')]['hasOwnProperty'](_0xaefd('0x58'))){_0x1e519e['limit']=qs[_0xaefd('0x43')](_0x8ab9e7[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x1e519e[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x8ab9e7[_0xaefd('0x3e')]['offset']);}return _0x48636d[_0xaefd('0x55')](_0x1e519e);}})[_0xaefd('0x33')](function(_0x4a9fa5){if(_0x4a9fa5){return _0x4a9fa5?{'count':_0x4fc1f9,'rows':_0x4a9fa5}:null;}})[_0xaefd('0x33')](respondWithResult(_0x314660,null))[_0xaefd('0x29')](handleError(_0x314660,null));};exports['getSubjects']=function(_0x3a2b63,_0x2a472f,_0x4247d9){var _0x46a793={};var _0x2c4ba7={};var _0x406c6d;var _0x2d8283;return db[_0xaefd('0x38')][_0xaefd('0x56')]({'where':{'id':_0x3a2b63[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0x2a472f,null))[_0xaefd('0x33')](function(_0x11a068){if(_0x11a068){_0x406c6d=_0x11a068;_0x2c4ba7[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db[_0xaefd('0x57')][_0xaefd('0x39')]);_0x2c4ba7['query']=_[_0xaefd('0x50')](_0x3a2b63[_0xaefd('0x3e')]);_0x2c4ba7[_0xaefd('0x3f')]=_['intersection'](_0x2c4ba7[_0xaefd('0x3d')],_0x2c4ba7[_0xaefd('0x3e')]);_0x46a793[_0xaefd('0x41')]=_[_0xaefd('0x40')](_0x2c4ba7['model'],qs[_0xaefd('0x42')](_0x3a2b63['query'][_0xaefd('0x42')]));_0x46a793['attributes']=_0x46a793[_0xaefd('0x41')][_0xaefd('0x51')]?_0x46a793[_0xaefd('0x41')]:_0x2c4ba7['model'];_0x46a793['order']=qs[_0xaefd('0x44')](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x46a793[_0xaefd('0x45')]=qs[_0xaefd('0x3f')](_[_0xaefd('0x46')](_0x3a2b63['query'],_0x2c4ba7['filters']));if(_0x3a2b63['query']['filter']){_0x46a793['where']=_[_0xaefd('0x47')](_0x46a793[_0xaefd('0x45')],{'$or':_[_0xaefd('0x37')](_0x46a793[_0xaefd('0x41')],function(_0x5ae635){var _0x3ae6ba={};_0x3ae6ba[_0x5ae635]={'$like':'%'+_0x3a2b63[_0xaefd('0x3e')]['filter']+'%'};return _0x3ae6ba;})});}_0x46a793=_[_0xaefd('0x47')]({},_0x46a793,_0x3a2b63['options']);return _0x406c6d[_0xaefd('0x59')](_0x46a793);}})['then'](function(_0x21d44b){if(_0x21d44b){_0x2d8283=_0x21d44b['length'];if(!_0x3a2b63[_0xaefd('0x3e')]['hasOwnProperty'](_0xaefd('0x58'))){_0x46a793[_0xaefd('0x43')]=qs['limit'](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x46a793[_0xaefd('0x2d')]=qs['offset'](_0x3a2b63[_0xaefd('0x3e')][_0xaefd('0x2d')]);}return _0x406c6d[_0xaefd('0x59')](_0x46a793);}})[_0xaefd('0x33')](function(_0x23115d){if(_0x23115d){return _0x23115d?{'count':_0x2d8283,'rows':_0x23115d}:null;}})['then'](respondWithResult(_0x2a472f,null))[_0xaefd('0x29')](handleError(_0x2a472f,null));};exports[_0xaefd('0x5a')]=function(_0x4ebd3e,_0xdacfe3,_0x1a80ee){var _0x1298e4={};var _0x299868={};var _0x5e3743;var _0x2a62ac;return db['ServicenowConfiguration'][_0xaefd('0x56')]({'where':{'id':_0x4ebd3e[_0xaefd('0x4f')]['id']}})[_0xaefd('0x33')](handleEntityNotFound(_0xdacfe3,null))['then'](function(_0xa53ec){if(_0xa53ec){_0x5e3743=_0xa53ec;_0x299868[_0xaefd('0x3d')]=_[_0xaefd('0x50')](db['ServicenowField'][_0xaefd('0x39')]);_0x299868[_0xaefd('0x3e')]=_[_0xaefd('0x50')](_0x4ebd3e[_0xaefd('0x3e')]);_0x299868['filters']=_[_0xaefd('0x40')](_0x299868[_0xaefd('0x3d')],_0x299868[_0xaefd('0x3e')]);_0x1298e4[_0xaefd('0x41')]=_['intersection'](_0x299868[_0xaefd('0x3d')],qs[_0xaefd('0x42')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x42')]));_0x1298e4['attributes']=_0x1298e4[_0xaefd('0x41')]['length']?_0x1298e4[_0xaefd('0x41')]:_0x299868['model'];_0x1298e4[_0xaefd('0x5b')]=qs[_0xaefd('0x44')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x44')]);_0x1298e4[_0xaefd('0x45')]=qs['filters'](_[_0xaefd('0x46')](_0x4ebd3e['query'],_0x299868[_0xaefd('0x3f')]));if(_0x4ebd3e['query'][_0xaefd('0x49')]){_0x1298e4[_0xaefd('0x45')]=_[_0xaefd('0x47')](_0x1298e4['where'],{'$or':_[_0xaefd('0x37')](_0x1298e4['attributes'],function(_0xdb53cf){var _0x4310b1={};_0x4310b1[_0xdb53cf]={'$like':'%'+_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x49')]+'%'};return _0x4310b1;})});}_0x1298e4=_['merge']({},_0x1298e4,_0x4ebd3e[_0xaefd('0x4a')]);return _0x5e3743[_0xaefd('0x5a')](_0x1298e4);}})[_0xaefd('0x33')](function(_0x407c6a){if(_0x407c6a){_0x2a62ac=_0x407c6a[_0xaefd('0x51')];if(!_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x5c')](_0xaefd('0x58'))){_0x1298e4[_0xaefd('0x43')]=qs['limit'](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x43')]);_0x1298e4[_0xaefd('0x2d')]=qs[_0xaefd('0x2d')](_0x4ebd3e[_0xaefd('0x3e')][_0xaefd('0x2d')]);}return _0x5e3743[_0xaefd('0x5a')](_0x1298e4);}})[_0xaefd('0x33')](function(_0x190170){if(_0x190170){return _0x190170?{'count':_0x2a62ac,'rows':_0x190170}:null;}})[_0xaefd('0x33')](respondWithResult(_0xdacfe3,null))[_0xaefd('0x29')](handleError(_0xdacfe3,null));}; \ No newline at end of file +var _0x0bb5=['offset','limit','set','Content-Range','apply','reject','save','destroy','end','stack','index','ServicenowConfiguration','rawAttributes','key','model','map','name','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','body','update','params','find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bb5,0x148));var _0x50bb=function(_0x367571,_0x3dfce0){_0x367571=_0x367571-0x0;var _0xe7be1b=_0x0bb5[_0x367571];return _0xe7be1b;};'use strict';var pdf=require(_0x50bb('0x0'));var emlformat=require(_0x50bb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50bb('0x2'));var rp=require(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var Mustache=require(_0x50bb('0x6'));var util=require(_0x50bb('0x7'));var path=require(_0x50bb('0x8'));var sox=require(_0x50bb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var db=require(_0x50bb('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x50bb('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x283f04,_0xd8ab27,_0x155864){if(_0x155864){var _0x502250=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x502250[_0x50bb('0x1a')](_0xd8ab27)){return _0x283f04;}else{throw new db[(_0x50bb('0x1b'))][(_0x50bb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x283f04;}}function respondWithRpcPromise(_0xbbc6a0,_0x5e8478,_0x21befa,_0x3e1a51){return new BPromise(function(_0x253073,_0x42ffab){var _0x908950=_0x3e1a51||client;return _0x908950['request'](_0xbbc6a0,_0x21befa)[_0x50bb('0x1d')](function(_0x174065){logger['info'](_0x50bb('0x1e'),_0x5e8478,'request\x20sent');logger[_0x50bb('0x1f')](_0x50bb('0x20'),_0x5e8478,'request\x20sent',JSON['stringify'](_0x174065));if(_0x174065[_0x50bb('0x21')]){if(_0x174065[_0x50bb('0x21')][_0x50bb('0x22')]===0x1f4){logger[_0x50bb('0x21')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e8478,_0x174065[_0x50bb('0x21')][_0x50bb('0x23')]);return _0x42ffab(_0x174065[_0x50bb('0x21')]['message']);}logger[_0x50bb('0x21')](_0x50bb('0x1e'),_0x5e8478,_0x174065[_0x50bb('0x21')]['message']);return _0x253073(_0x174065[_0x50bb('0x21')]['message']);}else{logger[_0x50bb('0x24')](_0x50bb('0x1e'),_0x5e8478,_0x50bb('0x25'));_0x253073(_0x174065[_0x50bb('0x26')][_0x50bb('0x23')]);}})[_0x50bb('0x27')](function(_0x4f7f73){logger[_0x50bb('0x21')](_0x50bb('0x1e'),_0x5e8478,_0x4f7f73);_0x42ffab(_0x4f7f73);});});}function respondWithStatusCode(_0x284a76,_0x3462c1){_0x3462c1=_0x3462c1||0xcc;return function(_0x5234d7){if(_0x5234d7){return _0x284a76[_0x50bb('0x28')](_0x3462c1);}return _0x284a76['status'](_0x3462c1)['end']();};}function respondWithResult(_0x2befd9,_0x491632){_0x491632=_0x491632||0xc8;return function(_0x5cfe4b){if(_0x5cfe4b){return _0x2befd9[_0x50bb('0x29')](_0x491632)[_0x50bb('0x2a')](_0x5cfe4b);}};}function respondWithFilteredResult(_0x3004a3,_0x1b74f9){return function(_0x17c158){if(_0x17c158){var _0x269479=_0x17c158[_0x50bb('0x2b')],_0x41a8ad=_0x1b74f9[_0x50bb('0x2c')],_0x41d479=_0x1b74f9[_0x50bb('0x2c')]+_0x1b74f9[_0x50bb('0x2d')],_0x4f7514;if(_0x41d479>=_0x269479){_0x41d479=_0x269479;_0x4f7514=0xc8;}else{_0x4f7514=0xce;}_0x3004a3['status'](_0x4f7514);return _0x3004a3[_0x50bb('0x2e')](_0x50bb('0x2f'),_0x41a8ad+'-'+_0x41d479+'/'+_0x269479)[_0x50bb('0x2a')](_0x17c158);}return null;};}function patchUpdates(_0xb3c3ba){return function(_0x3fd5f6){try{jsonpatch[_0x50bb('0x30')](_0x3fd5f6,_0xb3c3ba,!![]);}catch(_0x51aa81){return BPromise[_0x50bb('0x31')](_0x51aa81);}return _0x3fd5f6[_0x50bb('0x32')]();};}function saveUpdates(_0x3459e5,_0x1c2ee2){return function(_0x210b0d){if(_0x210b0d){return _0x210b0d['update'](_0x3459e5)[_0x50bb('0x1d')](function(_0x3bad07){return _0x3bad07;});}return null;};}function removeEntity(_0x3f4d8e,_0x309f3b){return function(_0x2bea60){if(_0x2bea60){return _0x2bea60[_0x50bb('0x33')]()[_0x50bb('0x1d')](function(){_0x3f4d8e[_0x50bb('0x29')](0xcc)[_0x50bb('0x34')]();});}};}function handleEntityNotFound(_0x1cc4e2,_0x34fa35){return function(_0x53d288){if(!_0x53d288){_0x1cc4e2[_0x50bb('0x28')](0x194);}return _0x53d288;};}function handleError(_0xdb38e1,_0x20a097){_0x20a097=_0x20a097||0x1f4;return function(_0x2bfb54){logger[_0x50bb('0x21')](_0x2bfb54[_0x50bb('0x35')]);if(_0x2bfb54['name']){delete _0x2bfb54['name'];}_0xdb38e1[_0x50bb('0x29')](_0x20a097)['send'](_0x2bfb54);};}exports[_0x50bb('0x36')]=function(_0x1bf25a,_0x3c94ea){var _0x171c6b={},_0x4ba9f9={},_0x48f4de={'count':0x0,'rows':[]};var _0x3a5f09=_['map'](db[_0x50bb('0x37')][_0x50bb('0x38')],function(_0x280e5a){return{'name':_0x280e5a['fieldName'],'type':_0x280e5a['type'][_0x50bb('0x39')]};});_0x4ba9f9[_0x50bb('0x3a')]=_[_0x50bb('0x3b')](_0x3a5f09,_0x50bb('0x3c'));_0x4ba9f9['query']=_[_0x50bb('0x3d')](_0x1bf25a['query']);_0x4ba9f9['filters']=_[_0x50bb('0x3e')](_0x4ba9f9['model'],_0x4ba9f9[_0x50bb('0x3f')]);_0x171c6b[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x4ba9f9[_0x50bb('0x3a')],qs[_0x50bb('0x41')](_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x171c6b[_0x50bb('0x40')]=_0x171c6b[_0x50bb('0x40')][_0x50bb('0x42')]?_0x171c6b['attributes']:_0x4ba9f9['model'];if(!_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x43')](_0x50bb('0x44'))){_0x171c6b[_0x50bb('0x2d')]=qs['limit'](_0x1bf25a[_0x50bb('0x3f')]['limit']);_0x171c6b[_0x50bb('0x2c')]=qs[_0x50bb('0x2c')](_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x2c')]);}_0x171c6b[_0x50bb('0x45')]=qs[_0x50bb('0x46')](_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x46')]);_0x171c6b[_0x50bb('0x47')]=qs[_0x50bb('0x48')](_[_0x50bb('0x49')](_0x1bf25a[_0x50bb('0x3f')],_0x4ba9f9[_0x50bb('0x48')]),_0x3a5f09);if(_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x4a')]){_0x171c6b[_0x50bb('0x47')]=_['merge'](_0x171c6b[_0x50bb('0x47')],{'$or':_['map'](_0x3a5f09,function(_0x2a87c1){if(_0x2a87c1[_0x50bb('0x4b')]!==_0x50bb('0x4c')){var _0x4613c8={};_0x4613c8[_0x2a87c1[_0x50bb('0x3c')]]={'$like':'%'+_0x1bf25a[_0x50bb('0x3f')][_0x50bb('0x4a')]+'%'};return _0x4613c8;}})});}_0x171c6b=_[_0x50bb('0x4d')]({},_0x171c6b,_0x1bf25a[_0x50bb('0x4e')]);var _0x3fe267={'where':_0x171c6b[_0x50bb('0x47')]};return db[_0x50bb('0x37')][_0x50bb('0x2b')](_0x3fe267)[_0x50bb('0x1d')](function(_0x5880df){_0x48f4de[_0x50bb('0x2b')]=_0x5880df;if(_0x1bf25a['query'][_0x50bb('0x4f')]){_0x171c6b[_0x50bb('0x50')]=[{'all':!![]}];}return db[_0x50bb('0x37')][_0x50bb('0x51')](_0x171c6b);})[_0x50bb('0x1d')](function(_0x39ac1a){_0x48f4de[_0x50bb('0x52')]=_0x39ac1a;return _0x48f4de;})[_0x50bb('0x1d')](respondWithFilteredResult(_0x3c94ea,_0x171c6b))['catch'](handleError(_0x3c94ea,null));};exports[_0x50bb('0x53')]=function(_0x262a12,_0xf52a22){var _0x13afe2={'raw':![],'where':{'id':_0x262a12['params']['id']}},_0x3659c4={};_0x3659c4[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db[_0x50bb('0x37')][_0x50bb('0x38')]);_0x3659c4[_0x50bb('0x3f')]=_['keys'](_0x262a12['query']);_0x3659c4[_0x50bb('0x48')]=_['intersection'](_0x3659c4[_0x50bb('0x3a')],_0x3659c4['query']);_0x13afe2[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x3659c4[_0x50bb('0x3a')],qs['fields'](_0x262a12[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x13afe2['attributes']=_0x13afe2[_0x50bb('0x40')][_0x50bb('0x42')]?_0x13afe2[_0x50bb('0x40')]:_0x3659c4[_0x50bb('0x3a')];if(_0x262a12['query'][_0x50bb('0x4f')]){_0x13afe2[_0x50bb('0x50')]=[{'all':!![]}];}_0x13afe2=_[_0x50bb('0x4d')]({},_0x13afe2,_0x262a12[_0x50bb('0x4e')]);return db[_0x50bb('0x37')]['find'](_0x13afe2)[_0x50bb('0x1d')](handleEntityNotFound(_0xf52a22,null))['then'](respondWithResult(_0xf52a22,null))[_0x50bb('0x27')](handleError(_0xf52a22,null));};exports['create']=function(_0x52ea86,_0x3f1557){return db['ServicenowConfiguration']['create'](_0x52ea86[_0x50bb('0x54')],{})[_0x50bb('0x1d')](respondWithResult(_0x3f1557,0xc9))[_0x50bb('0x27')](handleError(_0x3f1557,null));};exports[_0x50bb('0x55')]=function(_0x3ef5d8,_0x3b78bd){if(_0x3ef5d8[_0x50bb('0x54')]['id']){delete _0x3ef5d8[_0x50bb('0x54')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x3ef5d8[_0x50bb('0x56')]['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x3b78bd,null))[_0x50bb('0x1d')](saveUpdates(_0x3ef5d8[_0x50bb('0x54')],null))[_0x50bb('0x1d')](respondWithResult(_0x3b78bd,null))[_0x50bb('0x27')](handleError(_0x3b78bd,null));};exports[_0x50bb('0x33')]=function(_0x4bf426,_0x3be83b){return db[_0x50bb('0x37')][_0x50bb('0x57')]({'where':{'id':_0x4bf426[_0x50bb('0x56')]['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x3be83b,null))['then'](removeEntity(_0x3be83b,null))[_0x50bb('0x27')](handleError(_0x3be83b,null));};exports[_0x50bb('0x58')]=function(_0x1da5cd,_0x507f26,_0x2ba758){var _0x5b20f7={};var _0x261bf5={};var _0x4a5e2d;var _0x596550;return db[_0x50bb('0x37')][_0x50bb('0x59')]({'where':{'id':_0x1da5cd[_0x50bb('0x56')]['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x507f26,null))[_0x50bb('0x1d')](function(_0x20e35a){if(_0x20e35a){_0x4a5e2d=_0x20e35a;_0x261bf5[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db[_0x50bb('0x5a')][_0x50bb('0x38')]);_0x261bf5[_0x50bb('0x3f')]=_['keys'](_0x1da5cd[_0x50bb('0x3f')]);_0x261bf5['filters']=_[_0x50bb('0x3e')](_0x261bf5[_0x50bb('0x3a')],_0x261bf5['query']);_0x5b20f7[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x261bf5[_0x50bb('0x3a')],qs[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x5b20f7[_0x50bb('0x40')]=_0x5b20f7[_0x50bb('0x40')]['length']?_0x5b20f7[_0x50bb('0x40')]:_0x261bf5[_0x50bb('0x3a')];_0x5b20f7[_0x50bb('0x45')]=qs['sort'](_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x46')]);_0x5b20f7[_0x50bb('0x47')]=qs[_0x50bb('0x48')](_[_0x50bb('0x49')](_0x1da5cd[_0x50bb('0x3f')],_0x261bf5['filters']));if(_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x4a')]){_0x5b20f7[_0x50bb('0x47')]=_[_0x50bb('0x4d')](_0x5b20f7[_0x50bb('0x47')],{'$or':_[_0x50bb('0x3b')](_0x5b20f7['attributes'],function(_0x40257b){var _0xa85833={};_0xa85833[_0x40257b]={'$like':'%'+_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x4a')]+'%'};return _0xa85833;})});}_0x5b20f7=_[_0x50bb('0x4d')]({},_0x5b20f7,_0x1da5cd[_0x50bb('0x4e')]);return _0x4a5e2d[_0x50bb('0x58')](_0x5b20f7);}})[_0x50bb('0x1d')](function(_0x25f2e7){if(_0x25f2e7){_0x596550=_0x25f2e7['length'];if(!_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x43')](_0x50bb('0x44'))){_0x5b20f7[_0x50bb('0x2d')]=qs[_0x50bb('0x2d')](_0x1da5cd[_0x50bb('0x3f')][_0x50bb('0x2d')]);_0x5b20f7[_0x50bb('0x2c')]=qs[_0x50bb('0x2c')](_0x1da5cd['query']['offset']);}return _0x4a5e2d['getFields'](_0x5b20f7);}})[_0x50bb('0x1d')](function(_0x5ba597){if(_0x5ba597){return _0x5ba597?{'count':_0x596550,'rows':_0x5ba597}:null;}})['then'](respondWithResult(_0x507f26,null))[_0x50bb('0x27')](handleError(_0x507f26,null));};exports[_0x50bb('0x5b')]=function(_0x18fa23,_0x2c62b1,_0x5e7ccc){var _0x413dd0={};var _0x16a500={};var _0x48bb56;var _0x13310d;return db['ServicenowConfiguration'][_0x50bb('0x59')]({'where':{'id':_0x18fa23[_0x50bb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c62b1,null))[_0x50bb('0x1d')](function(_0x52c882){if(_0x52c882){_0x48bb56=_0x52c882;_0x16a500[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db['ServicenowField'][_0x50bb('0x38')]);_0x16a500[_0x50bb('0x3f')]=_[_0x50bb('0x3d')](_0x18fa23['query']);_0x16a500[_0x50bb('0x48')]=_[_0x50bb('0x3e')](_0x16a500[_0x50bb('0x3a')],_0x16a500[_0x50bb('0x3f')]);_0x413dd0['attributes']=_[_0x50bb('0x3e')](_0x16a500[_0x50bb('0x3a')],qs['fields'](_0x18fa23['query'][_0x50bb('0x41')]));_0x413dd0[_0x50bb('0x40')]=_0x413dd0['attributes'][_0x50bb('0x42')]?_0x413dd0[_0x50bb('0x40')]:_0x16a500[_0x50bb('0x3a')];_0x413dd0[_0x50bb('0x45')]=qs[_0x50bb('0x46')](_0x18fa23['query']['sort']);_0x413dd0[_0x50bb('0x47')]=qs[_0x50bb('0x48')](_[_0x50bb('0x49')](_0x18fa23[_0x50bb('0x3f')],_0x16a500['filters']));if(_0x18fa23[_0x50bb('0x3f')]['filter']){_0x413dd0[_0x50bb('0x47')]=_[_0x50bb('0x4d')](_0x413dd0[_0x50bb('0x47')],{'$or':_[_0x50bb('0x3b')](_0x413dd0[_0x50bb('0x40')],function(_0x217170){var _0x3a7ba7={};_0x3a7ba7[_0x217170]={'$like':'%'+_0x18fa23['query'][_0x50bb('0x4a')]+'%'};return _0x3a7ba7;})});}_0x413dd0=_[_0x50bb('0x4d')]({},_0x413dd0,_0x18fa23[_0x50bb('0x4e')]);return _0x48bb56[_0x50bb('0x5b')](_0x413dd0);}})[_0x50bb('0x1d')](function(_0x1817eb){if(_0x1817eb){_0x13310d=_0x1817eb[_0x50bb('0x42')];if(!_0x18fa23['query'][_0x50bb('0x43')](_0x50bb('0x44'))){_0x413dd0[_0x50bb('0x2d')]=qs[_0x50bb('0x2d')](_0x18fa23[_0x50bb('0x3f')]['limit']);_0x413dd0['offset']=qs[_0x50bb('0x2c')](_0x18fa23['query'][_0x50bb('0x2c')]);}return _0x48bb56[_0x50bb('0x5b')](_0x413dd0);}})['then'](function(_0x498b88){if(_0x498b88){return _0x498b88?{'count':_0x13310d,'rows':_0x498b88}:null;}})[_0x50bb('0x1d')](respondWithResult(_0x2c62b1,null))[_0x50bb('0x27')](handleError(_0x2c62b1,null));};exports[_0x50bb('0x5c')]=function(_0x486f34,_0x75dc05,_0x77c26d){var _0x1b88f5={};var _0x104b0d={};var _0x669966;var _0x3a25a4;return db[_0x50bb('0x37')]['findOne']({'where':{'id':_0x486f34['params']['id']}})[_0x50bb('0x1d')](handleEntityNotFound(_0x75dc05,null))[_0x50bb('0x1d')](function(_0x232388){if(_0x232388){_0x669966=_0x232388;_0x104b0d[_0x50bb('0x3a')]=_[_0x50bb('0x3d')](db[_0x50bb('0x5a')][_0x50bb('0x38')]);_0x104b0d[_0x50bb('0x3f')]=_[_0x50bb('0x3d')](_0x486f34[_0x50bb('0x3f')]);_0x104b0d['filters']=_[_0x50bb('0x3e')](_0x104b0d[_0x50bb('0x3a')],_0x104b0d[_0x50bb('0x3f')]);_0x1b88f5[_0x50bb('0x40')]=_[_0x50bb('0x3e')](_0x104b0d[_0x50bb('0x3a')],qs[_0x50bb('0x41')](_0x486f34[_0x50bb('0x3f')][_0x50bb('0x41')]));_0x1b88f5[_0x50bb('0x40')]=_0x1b88f5[_0x50bb('0x40')][_0x50bb('0x42')]?_0x1b88f5[_0x50bb('0x40')]:_0x104b0d[_0x50bb('0x3a')];_0x1b88f5[_0x50bb('0x45')]=qs['sort'](_0x486f34[_0x50bb('0x3f')][_0x50bb('0x46')]);_0x1b88f5[_0x50bb('0x47')]=qs['filters'](_[_0x50bb('0x49')](_0x486f34[_0x50bb('0x3f')],_0x104b0d[_0x50bb('0x48')]));if(_0x486f34[_0x50bb('0x3f')][_0x50bb('0x4a')]){_0x1b88f5[_0x50bb('0x47')]=_[_0x50bb('0x4d')](_0x1b88f5[_0x50bb('0x47')],{'$or':_[_0x50bb('0x3b')](_0x1b88f5[_0x50bb('0x40')],function(_0x4ec601){var _0x353058={};_0x353058[_0x4ec601]={'$like':'%'+_0x486f34[_0x50bb('0x3f')][_0x50bb('0x4a')]+'%'};return _0x353058;})});}_0x1b88f5=_[_0x50bb('0x4d')]({},_0x1b88f5,_0x486f34[_0x50bb('0x4e')]);return _0x669966[_0x50bb('0x5c')](_0x1b88f5);}})[_0x50bb('0x1d')](function(_0x39b247){if(_0x39b247){_0x3a25a4=_0x39b247[_0x50bb('0x42')];if(!_0x486f34[_0x50bb('0x3f')][_0x50bb('0x43')]('nolimit')){_0x1b88f5[_0x50bb('0x2d')]=qs[_0x50bb('0x2d')](_0x486f34[_0x50bb('0x3f')][_0x50bb('0x2d')]);_0x1b88f5[_0x50bb('0x2c')]=qs[_0x50bb('0x2c')](_0x486f34['query'][_0x50bb('0x2c')]);}return _0x669966['getDescriptions'](_0x1b88f5);}})[_0x50bb('0x1d')](function(_0x35edd2){if(_0x35edd2){return _0x35edd2?{'count':_0x3a25a4,'rows':_0x35edd2}:null;}})['then'](respondWithResult(_0x75dc05,null))['catch'](handleError(_0x75dc05,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index dcc850c..3d5a14b 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 _0x6e05=['../../config/logger','request-promise','path','rimraf','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x4c8fa2,_0x5e816c){var _0x5db20b=function(_0x57563f){while(--_0x57563f){_0x4c8fa2['push'](_0x4c8fa2['shift']());}};_0x5db20b(++_0x5e816c);}(_0x6e05,0x1e4));var _0x56e0=function(_0x42d5f0,_0x151b49){_0x42d5f0=_0x42d5f0-0x0;var _0x5d008f=_0x6e05[_0x42d5f0];return _0x5d008f;};'use strict';var _=require(_0x56e0('0x0'));var util=require(_0x56e0('0x1'));var logger=require(_0x56e0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56e0('0x3'));var fs=require('fs');var path=require(_0x56e0('0x4'));var rimraf=require(_0x56e0('0x5'));var config=require('../../config/environment');var attributes=require(_0x56e0('0x6'));module['exports']=function(_0x24babd,_0x55715e){return _0x24babd['define'](_0x56e0('0x7'),attributes,{'tableName':_0x56e0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5c8=['util','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x341102,_0x228eba){var _0x161fb9=function(_0x22ffc9){while(--_0x22ffc9){_0x341102['push'](_0x341102['shift']());}};_0x161fb9(++_0x228eba);}(_0xe5c8,0x196));var _0x8e5c=function(_0x545065,_0x56426c){_0x545065=_0x545065-0x0;var _0x3dd008=_0xe5c8[_0x545065];return _0x3dd008;};'use strict';var _=require(_0x8e5c('0x0'));var util=require(_0x8e5c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e5c('0x2'));var BPromise=require(_0x8e5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e5c('0x4'));var rimraf=require(_0x8e5c('0x5'));var config=require(_0x8e5c('0x6'));var attributes=require(_0x8e5c('0x7'));module['exports']=function(_0xa1a42d,_0x1b23fe){return _0xa1a42d[_0x8e5c('0x8')](_0x8e5c('0x9'),attributes,{'tableName':_0x8e5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 7f41482..26caa3a 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 _0x8dfd=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x8dfd,0x97));var _0xd8df=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x8dfd[_0x10d670];return _0x20d6f8;};'use strict';var _=require('lodash');var util=require(_0xd8df('0x0'));var moment=require(_0xd8df('0x1'));var BPromise=require(_0xd8df('0x2'));var rs=require(_0xd8df('0x3'));var fs=require('fs');var Redis=require(_0xd8df('0x4'));var db=require(_0xd8df('0x5'))['db'];var utils=require(_0xd8df('0x6'));var logger=require(_0xd8df('0x7'))('rpc');var config=require(_0xd8df('0x8'));var jayson=require(_0xd8df('0x9'));var client=jayson['client'][_0xd8df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4327db,_0x335005,_0x50d41a){return new BPromise(function(_0x45e2e7,_0x55fc56){return client['request'](_0x4327db,_0x50d41a)[_0xd8df('0xb')](function(_0x1c44aa){logger['info'](_0xd8df('0xc'),_0x335005,_0xd8df('0xd'));logger[_0xd8df('0xe')](_0xd8df('0xf'),_0x335005,_0xd8df('0xd'),JSON[_0xd8df('0x10')](_0x1c44aa));if(_0x1c44aa[_0xd8df('0x11')]){if(_0x1c44aa['error']['code']===0x1f4){logger[_0xd8df('0x11')](_0xd8df('0xc'),_0x335005,_0x1c44aa['error'][_0xd8df('0x12')]);return _0x55fc56(_0x1c44aa[_0xd8df('0x11')][_0xd8df('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x335005,_0x1c44aa[_0xd8df('0x11')][_0xd8df('0x12')]);return _0x45e2e7(_0x1c44aa[_0xd8df('0x11')][_0xd8df('0x12')]);}else{logger[_0xd8df('0x13')](_0xd8df('0xc'),_0x335005,_0xd8df('0xd'));_0x45e2e7(_0x1c44aa[_0xd8df('0x14')][_0xd8df('0x12')]);}})[_0xd8df('0x15')](function(_0x38e4a1){logger[_0xd8df('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x335005,_0x38e4a1);_0x55fc56(_0x38e4a1);});});} \ No newline at end of file +var _0x2598=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2de259,_0x4fd83b){var _0x2c18fe=function(_0x4ef658){while(--_0x4ef658){_0x2de259['push'](_0x2de259['shift']());}};_0x2c18fe(++_0x4fd83b);}(_0x2598,0x15b));var _0x8259=function(_0x11765d,_0x46113b){_0x11765d=_0x11765d-0x0;var _0x389e72=_0x2598[_0x11765d];return _0x389e72;};'use strict';var _=require(_0x8259('0x0'));var util=require(_0x8259('0x1'));var moment=require('moment');var BPromise=require(_0x8259('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8259('0x3'));var db=require(_0x8259('0x4'))['db'];var utils=require(_0x8259('0x5'));var logger=require('../../config/logger')(_0x8259('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8259('0x7')][_0x8259('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33fec1,_0x1cc35d,_0x3710de){return new BPromise(function(_0x39a3e9,_0xc2bc4f){return client[_0x8259('0x9')](_0x33fec1,_0x3710de)['then'](function(_0x1b8b37){logger[_0x8259('0xa')](_0x8259('0xb'),_0x1cc35d,_0x8259('0xc'));logger[_0x8259('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1cc35d,'request\x20sent',JSON['stringify'](_0x1b8b37));if(_0x1b8b37[_0x8259('0xe')]){if(_0x1b8b37[_0x8259('0xe')][_0x8259('0xf')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1cc35d,_0x1b8b37[_0x8259('0xe')][_0x8259('0x10')]);return _0xc2bc4f(_0x1b8b37['error'][_0x8259('0x10')]);}logger[_0x8259('0xe')](_0x8259('0xb'),_0x1cc35d,_0x1b8b37[_0x8259('0xe')][_0x8259('0x10')]);return _0x39a3e9(_0x1b8b37['error'][_0x8259('0x10')]);}else{logger['info'](_0x8259('0xb'),_0x1cc35d,_0x8259('0xc'));_0x39a3e9(_0x1b8b37[_0x8259('0x11')][_0x8259('0x10')]);}})[_0x8259('0x12')](function(_0x82d63){logger[_0x8259('0xe')](_0x8259('0xb'),_0x1cc35d,_0x82d63);_0xc2bc4f(_0x82d63);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 995fe22..165d884 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 _0x62e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','delete','exports'];(function(_0x235326,_0x251051){var _0x43a1d7=function(_0x1e79d9){while(--_0x1e79d9){_0x235326['push'](_0x235326['shift']());}};_0x43a1d7(++_0x251051);}(_0x62e8,0x198));var _0x862e=function(_0x4a1aa1,_0x37af9c){_0x4a1aa1=_0x4a1aa1-0x0;var _0x3264f3=_0x62e8[_0x4a1aa1];return _0x3264f3;};'use strict';var multer=require(_0x862e('0x0'));var util=require(_0x862e('0x1'));var path=require(_0x862e('0x2'));var timeout=require(_0x862e('0x3'));var express=require('express');var router=express[_0x862e('0x4')]();var auth=require(_0x862e('0x5'));var interaction=require(_0x862e('0x6'));var config=require(_0x862e('0x7'));var controller=require(_0x862e('0x8'));router[_0x862e('0x9')]('/',auth[_0x862e('0xa')](),controller[_0x862e('0xb')]);router[_0x862e('0x9')](_0x862e('0xc'),auth[_0x862e('0xa')](),controller[_0x862e('0xd')]);router[_0x862e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x862e('0xc'),auth[_0x862e('0xa')](),controller['update']);router[_0x862e('0xf')](_0x862e('0xc'),auth[_0x862e('0xa')](),controller['destroy']);module[_0x862e('0x10')]=router; \ No newline at end of file +var _0x6d59=['isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x25f797,_0x449916){var _0x157fdd=function(_0x329fe1){while(--_0x329fe1){_0x25f797['push'](_0x25f797['shift']());}};_0x157fdd(++_0x449916);}(_0x6d59,0x108));var _0x96d5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6d59[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x96d5('0x0'));var util=require(_0x96d5('0x1'));var path=require(_0x96d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x96d5('0x3'));var router=express[_0x96d5('0x4')]();var auth=require(_0x96d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x96d5('0x6'));var controller=require('./intServicenowField.controller');router[_0x96d5('0x7')]('/',auth[_0x96d5('0x8')](),controller['index']);router[_0x96d5('0x7')](_0x96d5('0x9'),auth[_0x96d5('0x8')](),controller[_0x96d5('0xa')]);router[_0x96d5('0xb')]('/',auth[_0x96d5('0x8')](),controller['create']);router[_0x96d5('0xc')](_0x96d5('0x9'),auth[_0x96d5('0x8')](),controller['update']);router[_0x96d5('0xd')]('/:id',auth[_0x96d5('0x8')](),controller[_0x96d5('0xe')]);module[_0x96d5('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c0739f7..408dfb8 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 _0x74b0=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x60145a,_0x5c0f46){var _0x54368c=function(_0x5c1620){while(--_0x5c1620){_0x60145a['push'](_0x60145a['shift']());}};_0x54368c(++_0x5c0f46);}(_0x74b0,0x1ea));var _0x074b=function(_0x183acf,_0x20a500){_0x183acf=_0x183acf-0x0;var _0x52453c=_0x74b0[_0x183acf];return _0x52453c;};'use strict';var Sequelize=require('sequelize');module[_0x074b('0x0')]={'type':{'type':Sequelize[_0x074b('0x1')](_0x074b('0x2'),_0x074b('0x3'),_0x074b('0x4'),_0x074b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x074b('0x1')](_0x074b('0x2'),_0x074b('0x3'),_0x074b('0x4'))},'keyContent':{'type':Sequelize[_0x074b('0x6')]},'idField':{'type':Sequelize[_0x074b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x074b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x074b('0x6')]}}; \ No newline at end of file +var _0x5a7f=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x42ece4,_0x8ab064){var _0x1bc544=function(_0xc97387){while(--_0xc97387){_0x42ece4['push'](_0x42ece4['shift']());}};_0x1bc544(++_0x8ab064);}(_0x5a7f,0xaf));var _0xf5a7=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5a7f[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0xf5a7('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf5a7('0x1'),_0xf5a7('0x2'),_0xf5a7('0x3'),_0xf5a7('0x4')),'defaultValue':_0xf5a7('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf5a7('0x5')]},'keyType':{'type':Sequelize[_0xf5a7('0x6')](_0xf5a7('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf5a7('0x5')]},'idField':{'type':Sequelize[_0xf5a7('0x5')]},'nameField':{'type':Sequelize[_0xf5a7('0x5')]},'customField':{'type':Sequelize[_0xf5a7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5a7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0694620..dcbe1de 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5a56cc,_0x29650c){var _0x589caa=function(_0x1e3ce5){while(--_0x1e3ce5){_0x5a56cc['push'](_0x5a56cc['shift']());}};_0x589caa(++_0x29650c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x223540,_0x1af66a){var _0x221ae7=function(_0x4a975d){while(--_0x4a975d){_0x223540['push'](_0x223540['shift']());}};_0x221ae7(++_0x1af66a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 001ff77..8576006 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 _0xceac=['bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment'];(function(_0xefd3d7,_0x50bdc9){var _0x20029e=function(_0x381688){while(--_0x381688){_0xefd3d7['push'](_0xefd3d7['shift']());}};_0x20029e(++_0x50bdc9);}(_0xceac,0x92));var _0xccea=function(_0x58746f,_0x9b1594){_0x58746f=_0x58746f-0x0;var _0xfcc4d=_0xceac[_0x58746f];return _0xfcc4d;};'use strict';var _=require('lodash');var util=require(_0xccea('0x0'));var logger=require(_0xccea('0x1'))(_0xccea('0x2'));var moment=require(_0xccea('0x3'));var BPromise=require(_0xccea('0x4'));var rp=require(_0xccea('0x5'));var fs=require('fs');var path=require(_0xccea('0x6'));var rimraf=require(_0xccea('0x7'));var config=require('../../config/environment');var attributes=require(_0xccea('0x8'));module[_0xccea('0x9')]=function(_0x160ded,_0x21d5ff){return _0x160ded[_0xccea('0xa')]('ServicenowField',attributes,{'tableName':_0xccea('0xb'),'paranoid':![],'indexes':[{'name':_0xccea('0xc'),'fields':[_0xccea('0xd'),_0xccea('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfeef=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util'];(function(_0x310203,_0x1f191b){var _0x145d03=function(_0x24a569){while(--_0x24a569){_0x310203['push'](_0x310203['shift']());}};_0x145d03(++_0x1f191b);}(_0xfeef,0x1a3));var _0xffee=function(_0x3ed9d3,_0x26ed0a){_0x3ed9d3=_0x3ed9d3-0x0;var _0x346b6e=_0xfeef[_0x3ed9d3];return _0x346b6e;};'use strict';var _=require('lodash');var util=require(_0xffee('0x0'));var logger=require('../../config/logger')(_0xffee('0x1'));var moment=require(_0xffee('0x2'));var BPromise=require(_0xffee('0x3'));var rp=require(_0xffee('0x4'));var fs=require('fs');var path=require(_0xffee('0x5'));var rimraf=require(_0xffee('0x6'));var config=require(_0xffee('0x7'));var attributes=require('./intServicenowField.attributes');module[_0xffee('0x8')]=function(_0xcd5db0,_0x3abcad){return _0xcd5db0[_0xffee('0x9')]('ServicenowField',attributes,{'tableName':_0xffee('0xa'),'paranoid':![],'indexes':[{'name':_0xffee('0xb'),'fields':[_0xffee('0xc'),_0xffee('0xd')],'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 b164637..bb70609 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 _0x6517=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x8b1b8c,_0x598fa0){var _0x324ec3=function(_0x2bdcfe){while(--_0x2bdcfe){_0x8b1b8c['push'](_0x8b1b8c['shift']());}};_0x324ec3(++_0x598fa0);}(_0x6517,0x178));var _0x7651=function(_0x19b289,_0x2c8fbe){_0x19b289=_0x19b289-0x0;var _0x5da966=_0x6517[_0x19b289];return _0x5da966;};'use strict';var _=require(_0x7651('0x0'));var util=require('util');var moment=require(_0x7651('0x1'));var BPromise=require(_0x7651('0x2'));var rs=require(_0x7651('0x3'));var fs=require('fs');var Redis=require(_0x7651('0x4'));var db=require(_0x7651('0x5'))['db'];var utils=require(_0x7651('0x6'));var logger=require(_0x7651('0x7'))(_0x7651('0x8'));var config=require(_0x7651('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7651('0xa')][_0x7651('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d6b28,_0x3cadb8,_0x39eb78){return new BPromise(function(_0x2c277a,_0x1f19d1){return client[_0x7651('0xc')](_0x1d6b28,_0x39eb78)[_0x7651('0xd')](function(_0xa34ca){logger[_0x7651('0xe')](_0x7651('0xf'),_0x3cadb8,'request\x20sent');logger[_0x7651('0x10')](_0x7651('0x11'),_0x3cadb8,_0x7651('0x12'),JSON[_0x7651('0x13')](_0xa34ca));if(_0xa34ca[_0x7651('0x14')]){if(_0xa34ca[_0x7651('0x14')][_0x7651('0x15')]===0x1f4){logger[_0x7651('0x14')](_0x7651('0xf'),_0x3cadb8,_0xa34ca[_0x7651('0x14')][_0x7651('0x16')]);return _0x1f19d1(_0xa34ca[_0x7651('0x14')][_0x7651('0x16')]);}logger[_0x7651('0x14')]('ServicenowField,\x20%s,\x20%s',_0x3cadb8,_0xa34ca[_0x7651('0x14')]['message']);return _0x2c277a(_0xa34ca[_0x7651('0x14')][_0x7651('0x16')]);}else{logger[_0x7651('0xe')](_0x7651('0xf'),_0x3cadb8,_0x7651('0x12'));_0x2c277a(_0xa34ca[_0x7651('0x17')][_0x7651('0x16')]);}})[_0x7651('0x18')](function(_0x21b4ab){logger['error'](_0x7651('0xf'),_0x3cadb8,_0x21b4ab);_0x1f19d1(_0x21b4ab);});});} \ No newline at end of file +var _0xf6ee=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x98ac1f,_0x2effb0){var _0x1579d1=function(_0x54b8d7){while(--_0x54b8d7){_0x98ac1f['push'](_0x98ac1f['shift']());}};_0x1579d1(++_0x2effb0);}(_0xf6ee,0x18e));var _0xef6e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef6e('0x0'));var util=require(_0xef6e('0x1'));var moment=require('moment');var BPromise=require(_0xef6e('0x2'));var rs=require(_0xef6e('0x3'));var fs=require('fs');var Redis=require(_0xef6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef6e('0x5'));var logger=require(_0xef6e('0x6'))(_0xef6e('0x7'));var config=require(_0xef6e('0x8'));var jayson=require(_0xef6e('0x9'));var client=jayson[_0xef6e('0xa')][_0xef6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36263a,_0x2cf8b3,_0x3476c5){return new BPromise(function(_0x3d978c,_0x2f6980){return client[_0xef6e('0xc')](_0x36263a,_0x3476c5)[_0xef6e('0xd')](function(_0x51f935){logger[_0xef6e('0xe')](_0xef6e('0xf'),_0x2cf8b3,_0xef6e('0x10'));logger[_0xef6e('0x11')](_0xef6e('0x12'),_0x2cf8b3,_0xef6e('0x10'),JSON[_0xef6e('0x13')](_0x51f935));if(_0x51f935[_0xef6e('0x14')]){if(_0x51f935[_0xef6e('0x14')][_0xef6e('0x15')]===0x1f4){logger['error'](_0xef6e('0xf'),_0x2cf8b3,_0x51f935[_0xef6e('0x14')][_0xef6e('0x16')]);return _0x2f6980(_0x51f935[_0xef6e('0x14')][_0xef6e('0x16')]);}logger[_0xef6e('0x14')](_0xef6e('0xf'),_0x2cf8b3,_0x51f935[_0xef6e('0x14')][_0xef6e('0x16')]);return _0x3d978c(_0x51f935[_0xef6e('0x14')][_0xef6e('0x16')]);}else{logger[_0xef6e('0xe')]('ServicenowField,\x20%s,\x20%s',_0x2cf8b3,_0xef6e('0x10'));_0x3d978c(_0x51f935[_0xef6e('0x17')]['message']);}})[_0xef6e('0x18')](function(_0x2ff4e1){logger[_0xef6e('0x14')](_0xef6e('0xf'),_0x2cf8b3,_0x2ff4e1);_0x2f6980(_0x2ff4e1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 85b3950..994051e 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 _0x12d8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x458a82,_0x458dd9){var _0x3c6546=function(_0x4dd297){while(--_0x4dd297){_0x458a82['push'](_0x458a82['shift']());}};_0x3c6546(++_0x458dd9);}(_0x12d8,0x73));var _0x812d=function(_0x44f334,_0x2bc5e1){_0x44f334=_0x44f334-0x0;var _0x4d951e=_0x12d8[_0x44f334];return _0x4d951e;};'use strict';var multer=require(_0x812d('0x0'));var util=require(_0x812d('0x1'));var path=require(_0x812d('0x2'));var timeout=require(_0x812d('0x3'));var express=require(_0x812d('0x4'));var router=express[_0x812d('0x5')]();var auth=require(_0x812d('0x6'));var interaction=require(_0x812d('0x7'));var config=require(_0x812d('0x8'));var controller=require('./intSugarcrmAccount.controller');router[_0x812d('0x9')]('/',auth[_0x812d('0xa')](),controller[_0x812d('0xb')]);router[_0x812d('0x9')](_0x812d('0xc'),auth[_0x812d('0xa')](),controller['show']);router['get'](_0x812d('0xd'),auth['isAuthenticated'](),controller[_0x812d('0xe')]);router[_0x812d('0x9')](_0x812d('0xf'),auth[_0x812d('0xa')](),controller['getFields']);router['post']('/',auth[_0x812d('0xa')](),controller[_0x812d('0x10')]);router[_0x812d('0x11')](_0x812d('0xd'),auth[_0x812d('0xa')](),controller[_0x812d('0x12')]);router[_0x812d('0x13')]('/:id',auth[_0x812d('0xa')](),controller[_0x812d('0x14')]);router[_0x812d('0x15')](_0x812d('0xc'),auth[_0x812d('0xa')](),controller[_0x812d('0x16')]);module[_0x812d('0x17')]=router; \ No newline at end of file +var _0xd6b8=['get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller'];(function(_0x1f1b33,_0x42775d){var _0x2f013f=function(_0x47869b){while(--_0x47869b){_0x1f1b33['push'](_0x1f1b33['shift']());}};_0x2f013f(++_0x42775d);}(_0xd6b8,0xdc));var _0x8d6b=function(_0x17e8dc,_0x5cf16f){_0x17e8dc=_0x17e8dc-0x0;var _0x182056=_0xd6b8[_0x17e8dc];return _0x182056;};'use strict';var multer=require(_0x8d6b('0x0'));var util=require(_0x8d6b('0x1'));var path=require(_0x8d6b('0x2'));var timeout=require(_0x8d6b('0x3'));var express=require(_0x8d6b('0x4'));var router=express[_0x8d6b('0x5')]();var auth=require(_0x8d6b('0x6'));var interaction=require(_0x8d6b('0x7'));var config=require(_0x8d6b('0x8'));var controller=require(_0x8d6b('0x9'));router[_0x8d6b('0xa')]('/',auth[_0x8d6b('0xb')](),controller['index']);router[_0x8d6b('0xa')]('/:id',auth[_0x8d6b('0xb')](),controller[_0x8d6b('0xc')]);router[_0x8d6b('0xa')](_0x8d6b('0xd'),auth[_0x8d6b('0xb')](),controller[_0x8d6b('0xe')]);router[_0x8d6b('0xa')](_0x8d6b('0xf'),auth[_0x8d6b('0xb')](),controller['getFields']);router[_0x8d6b('0x10')]('/',auth[_0x8d6b('0xb')](),controller[_0x8d6b('0x11')]);router[_0x8d6b('0x10')](_0x8d6b('0xd'),auth[_0x8d6b('0xb')](),controller[_0x8d6b('0x12')]);router['put']('/:id',auth[_0x8d6b('0xb')](),controller['update']);router[_0x8d6b('0x13')](_0x8d6b('0x14'),auth[_0x8d6b('0xb')](),controller[_0x8d6b('0x15')]);module[_0x8d6b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 60bae44..ff6ca6a 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 _0x8853=['exports','STRING','username','remoteUri','sequelize'];(function(_0xc0921a,_0x1f107f){var _0x3f6189=function(_0x5cd2fe){while(--_0x5cd2fe){_0xc0921a['push'](_0xc0921a['shift']());}};_0x3f6189(++_0x1f107f);}(_0x8853,0x1a8));var _0x3885=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0x8853[_0x19f5fc];return _0x315fa3;};'use strict';var Sequelize=require(_0x3885('0x0'));module[_0x3885('0x1')]={'name':{'type':Sequelize[_0x3885('0x2')]},'description':{'type':Sequelize[_0x3885('0x2')]},'username':{'type':Sequelize[_0x3885('0x2')],'unique':_0x3885('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3885('0x2')],'unique':_0x3885('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa82a=['exports','STRING','username','sequelize'];(function(_0x5c4dbf,_0x562230){var _0x362ac5=function(_0x74e7f7){while(--_0x74e7f7){_0x5c4dbf['push'](_0x5c4dbf['shift']());}};_0x362ac5(++_0x562230);}(_0xa82a,0x1e7));var _0xaa82=function(_0x19b103,_0x42e4b1){_0x19b103=_0x19b103-0x0;var _0x4cd8ad=_0xa82a[_0x19b103];return _0x4cd8ad;};'use strict';var Sequelize=require(_0xaa82('0x0'));module[_0xaa82('0x1')]={'name':{'type':Sequelize[_0xaa82('0x2')]},'description':{'type':Sequelize[_0xaa82('0x2')]},'username':{'type':Sequelize[_0xaa82('0x2')],'unique':_0xaa82('0x3')},'password':{'type':Sequelize[_0xaa82('0x2')]},'remoteUri':{'type':Sequelize[_0xaa82('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xaa82('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 23b4ced..aba4a63 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 _0xafc4=['catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','end','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','SugarcrmAccount','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','created_by','duration_minutes','parent_type','direction','remoteUri','POST','format','%s%s','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','endsWith','values','test','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xafc4,0x1c1));var _0x4afc=function(_0xc261a,_0x1880bf){_0xc261a=_0xc261a-0x0;var _0x4e1011=_0xafc4[_0xc261a];return _0x4e1011;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4afc('0x0'));var rimraf=require(_0x4afc('0x1'));var zipdir=require(_0x4afc('0x2'));var jsonpatch=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var moment=require(_0x4afc('0x5'));var BPromise=require(_0x4afc('0x6'));var Mustache=require(_0x4afc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4afc('0x8'));var csv=require(_0x4afc('0x9'));var ejs=require(_0x4afc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4afc('0xb'));var jsforce=require(_0x4afc('0xc'));var deskjs=require(_0x4afc('0xd'));var toCsv=require(_0x4afc('0x9'));var querystring=require(_0x4afc('0xe'));var Papa=require(_0x4afc('0xf'));var Redis=require(_0x4afc('0x10'));var authService=require(_0x4afc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4afc('0x12'));var hardwareService=require(_0x4afc('0x13'));var logger=require(_0x4afc('0x14'))('api');var utils=require(_0x4afc('0x15'));var config=require(_0x4afc('0x16'));var db=require(_0x4afc('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x4afc('0x18'));var client=jayson[_0x4afc('0x19')][_0x4afc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x27cb67,_0x15c782,_0x905cc1){if(_0x905cc1){var _0x2c25a4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c25a4['test'](_0x15c782)){return _0x27cb67;}else{throw new db['Sequelize'][(_0x4afc('0x1b'))](_0x4afc('0x1c'));}}else{return _0x27cb67;}}function respondWithRpcPromise(_0x479088,_0x109fad,_0x1f1238,_0x44211c){return new BPromise(function(_0x3f3c9b,_0x45a2d5){var _0x280674=_0x44211c||client;return _0x280674[_0x4afc('0x1d')](_0x479088,_0x1f1238)[_0x4afc('0x1e')](function(_0x4a76d3){logger[_0x4afc('0x1f')](_0x4afc('0x20'),_0x109fad,_0x4afc('0x21'));logger[_0x4afc('0x22')](_0x4afc('0x23'),_0x109fad,'request\x20sent',JSON[_0x4afc('0x24')](_0x4a76d3));if(_0x4a76d3[_0x4afc('0x25')]){if(_0x4a76d3[_0x4afc('0x25')]['code']===0x1f4){logger[_0x4afc('0x25')](_0x4afc('0x20'),_0x109fad,_0x4a76d3[_0x4afc('0x25')][_0x4afc('0x26')]);return _0x45a2d5(_0x4a76d3[_0x4afc('0x25')][_0x4afc('0x26')]);}logger[_0x4afc('0x25')](_0x4afc('0x20'),_0x109fad,_0x4a76d3['error']['message']);return _0x3f3c9b(_0x4a76d3[_0x4afc('0x25')][_0x4afc('0x26')]);}else{logger[_0x4afc('0x1f')](_0x4afc('0x20'),_0x109fad,_0x4afc('0x21'));_0x3f3c9b(_0x4a76d3['result'][_0x4afc('0x26')]);}})[_0x4afc('0x27')](function(_0x22fad9){logger['error'](_0x4afc('0x20'),_0x109fad,_0x22fad9);_0x45a2d5(_0x22fad9);});});}function respondWithStatusCode(_0x6b8ce8,_0xaacdc0){_0xaacdc0=_0xaacdc0||0xcc;return function(_0x912b16){if(_0x912b16){return _0x6b8ce8[_0x4afc('0x28')](_0xaacdc0);}return _0x6b8ce8[_0x4afc('0x29')](_0xaacdc0)['end']();};}function respondWithResult(_0x485b5d,_0x401245){_0x401245=_0x401245||0xc8;return function(_0x517c01){if(_0x517c01){return _0x485b5d['status'](_0x401245)[_0x4afc('0x2a')](_0x517c01);}};}function respondWithFilteredResult(_0x1e39b4,_0x4e581a){return function(_0x16ec69){if(_0x16ec69){var _0x2b22db=_0x16ec69[_0x4afc('0x2b')],_0x244936=_0x4e581a['offset'],_0x31052a=_0x4e581a[_0x4afc('0x2c')]+_0x4e581a[_0x4afc('0x2d')],_0xc8878a;if(_0x31052a>=_0x2b22db){_0x31052a=_0x2b22db;_0xc8878a=0xc8;}else{_0xc8878a=0xce;}_0x1e39b4[_0x4afc('0x29')](_0xc8878a);return _0x1e39b4['set'](_0x4afc('0x2e'),_0x244936+'-'+_0x31052a+'/'+_0x2b22db)[_0x4afc('0x2a')](_0x16ec69);}return null;};}function patchUpdates(_0x1904ac){return function(_0x5a69c4){try{jsonpatch[_0x4afc('0x2f')](_0x5a69c4,_0x1904ac,!![]);}catch(_0x54e272){return BPromise[_0x4afc('0x30')](_0x54e272);}return _0x5a69c4['save']();};}function saveUpdates(_0x3d0287,_0x16d9c4){return function(_0xd27604){if(_0xd27604){return _0xd27604[_0x4afc('0x31')](_0x3d0287)[_0x4afc('0x1e')](function(_0x3f0c6e){return _0x3f0c6e;});}return null;};}function removeEntity(_0x488b5e,_0x488cf3){return function(_0x28ec81){if(_0x28ec81){return _0x28ec81[_0x4afc('0x32')]()['then'](function(){_0x488b5e[_0x4afc('0x29')](0xcc)[_0x4afc('0x33')]();});}};}function handleEntityNotFound(_0x146025,_0x3b3139){return function(_0x45a279){if(!_0x45a279){_0x146025[_0x4afc('0x28')](0x194);}return _0x45a279;};}function handleError(_0x21e41a,_0x1db67f){_0x1db67f=_0x1db67f||0x1f4;return function(_0x3e6f60){logger[_0x4afc('0x25')](_0x3e6f60[_0x4afc('0x34')]);if(_0x3e6f60[_0x4afc('0x35')]){delete _0x3e6f60[_0x4afc('0x35')];}_0x21e41a[_0x4afc('0x29')](_0x1db67f)['send'](_0x3e6f60);};}exports['index']=function(_0xbcb70c,_0x260948){var _0x325704={},_0x10e132={},_0x5abec5={'count':0x0,'rows':[]};var _0x2ab1e3=_[_0x4afc('0x36')](db['SugarcrmAccount'][_0x4afc('0x37')],function(_0x153971){return{'name':_0x153971[_0x4afc('0x38')],'type':_0x153971['type'][_0x4afc('0x39')]};});_0x10e132[_0x4afc('0x3a')]=_[_0x4afc('0x36')](_0x2ab1e3,_0x4afc('0x35'));_0x10e132[_0x4afc('0x3b')]=_[_0x4afc('0x3c')](_0xbcb70c[_0x4afc('0x3b')]);_0x10e132[_0x4afc('0x3d')]=_[_0x4afc('0x3e')](_0x10e132[_0x4afc('0x3a')],_0x10e132[_0x4afc('0x3b')]);_0x325704[_0x4afc('0x3f')]=_[_0x4afc('0x3e')](_0x10e132[_0x4afc('0x3a')],qs['fields'](_0xbcb70c[_0x4afc('0x3b')][_0x4afc('0x40')]));_0x325704[_0x4afc('0x3f')]=_0x325704['attributes'][_0x4afc('0x41')]?_0x325704['attributes']:_0x10e132[_0x4afc('0x3a')];if(!_0xbcb70c[_0x4afc('0x3b')][_0x4afc('0x42')]('nolimit')){_0x325704[_0x4afc('0x2d')]=qs['limit'](_0xbcb70c[_0x4afc('0x3b')]['limit']);_0x325704[_0x4afc('0x2c')]=qs['offset'](_0xbcb70c['query'][_0x4afc('0x2c')]);}_0x325704[_0x4afc('0x43')]=qs['sort'](_0xbcb70c[_0x4afc('0x3b')][_0x4afc('0x44')]);_0x325704['where']=qs[_0x4afc('0x3d')](_[_0x4afc('0x45')](_0xbcb70c[_0x4afc('0x3b')],_0x10e132[_0x4afc('0x3d')]),_0x2ab1e3);if(_0xbcb70c['query']['filter']){_0x325704[_0x4afc('0x46')]=_[_0x4afc('0x47')](_0x325704[_0x4afc('0x46')],{'$or':_[_0x4afc('0x36')](_0x2ab1e3,function(_0xa073ff){if(_0xa073ff[_0x4afc('0x48')]!==_0x4afc('0x49')){var _0x4cc578={};_0x4cc578[_0xa073ff['name']]={'$like':'%'+_0xbcb70c[_0x4afc('0x3b')][_0x4afc('0x4a')]+'%'};return _0x4cc578;}})});}_0x325704=_[_0x4afc('0x47')]({},_0x325704,_0xbcb70c[_0x4afc('0x4b')]);var _0x253522={'where':_0x325704[_0x4afc('0x46')]};return db['SugarcrmAccount'][_0x4afc('0x2b')](_0x253522)[_0x4afc('0x1e')](function(_0x16def4){_0x5abec5[_0x4afc('0x2b')]=_0x16def4;if(_0xbcb70c[_0x4afc('0x3b')]['includeAll']){_0x325704[_0x4afc('0x4c')]=[{'all':!![]}];}return db[_0x4afc('0x4d')][_0x4afc('0x4e')](_0x325704);})['then'](function(_0x366358){_0x5abec5[_0x4afc('0x4f')]=_0x366358;return _0x5abec5;})[_0x4afc('0x1e')](respondWithFilteredResult(_0x260948,_0x325704))['catch'](handleError(_0x260948,null));};exports[_0x4afc('0x50')]=function(_0x21c89e,_0x93bae5){var _0x55f963={'raw':![],'where':{'id':_0x21c89e[_0x4afc('0x51')]['id']}},_0x27d53a={};_0x27d53a['model']=_[_0x4afc('0x3c')](db['SugarcrmAccount'][_0x4afc('0x37')]);_0x27d53a[_0x4afc('0x3b')]=_['keys'](_0x21c89e[_0x4afc('0x3b')]);_0x27d53a[_0x4afc('0x3d')]=_[_0x4afc('0x3e')](_0x27d53a['model'],_0x27d53a[_0x4afc('0x3b')]);_0x55f963[_0x4afc('0x3f')]=_[_0x4afc('0x3e')](_0x27d53a['model'],qs[_0x4afc('0x40')](_0x21c89e[_0x4afc('0x3b')][_0x4afc('0x40')]));_0x55f963[_0x4afc('0x3f')]=_0x55f963[_0x4afc('0x3f')][_0x4afc('0x41')]?_0x55f963[_0x4afc('0x3f')]:_0x27d53a[_0x4afc('0x3a')];if(_0x21c89e['query'][_0x4afc('0x52')]){_0x55f963[_0x4afc('0x4c')]=[{'all':!![]}];}_0x55f963=_[_0x4afc('0x47')]({},_0x55f963,_0x21c89e['options']);return db['SugarcrmAccount'][_0x4afc('0x53')](_0x55f963)['then'](handleEntityNotFound(_0x93bae5,null))[_0x4afc('0x1e')](respondWithResult(_0x93bae5,null))[_0x4afc('0x27')](handleError(_0x93bae5,null));};exports[_0x4afc('0x54')]=function(_0x17af37,_0x9fc877){return db[_0x4afc('0x4d')][_0x4afc('0x54')](_0x17af37[_0x4afc('0x55')],{})['then'](respondWithResult(_0x9fc877,0xc9))[_0x4afc('0x27')](handleError(_0x9fc877,null));};exports['update']=function(_0x273343,_0x21019b){if(_0x273343[_0x4afc('0x55')]['id']){delete _0x273343[_0x4afc('0x55')]['id'];}return db[_0x4afc('0x4d')][_0x4afc('0x53')]({'where':{'id':_0x273343[_0x4afc('0x51')]['id']}})[_0x4afc('0x1e')](handleEntityNotFound(_0x21019b,null))[_0x4afc('0x1e')](saveUpdates(_0x273343[_0x4afc('0x55')],null))[_0x4afc('0x1e')](respondWithResult(_0x21019b,null))[_0x4afc('0x27')](handleError(_0x21019b,null));};exports[_0x4afc('0x32')]=function(_0x4642e4,_0x350457){return db['SugarcrmAccount'][_0x4afc('0x53')]({'where':{'id':_0x4642e4[_0x4afc('0x51')]['id']}})[_0x4afc('0x1e')](handleEntityNotFound(_0x350457,null))[_0x4afc('0x1e')](removeEntity(_0x350457,null))[_0x4afc('0x27')](handleError(_0x350457,null));};exports[_0x4afc('0x56')]=function(_0x4e296e,_0x59f1a9,_0x48da73){var _0x30c6fc={};var _0x14eb07={};var _0x1fb2ca;var _0x150468;return db[_0x4afc('0x4d')][_0x4afc('0x57')]({'where':{'id':_0x4e296e[_0x4afc('0x51')]['id']}})[_0x4afc('0x1e')](handleEntityNotFound(_0x59f1a9,null))['then'](function(_0x340d85){if(_0x340d85){_0x1fb2ca=_0x340d85;_0x14eb07['model']=_['keys'](db[_0x4afc('0x58')]['rawAttributes']);_0x14eb07[_0x4afc('0x3b')]=_[_0x4afc('0x3c')](_0x4e296e['query']);_0x14eb07[_0x4afc('0x3d')]=_[_0x4afc('0x3e')](_0x14eb07[_0x4afc('0x3a')],_0x14eb07[_0x4afc('0x3b')]);_0x30c6fc['attributes']=_[_0x4afc('0x3e')](_0x14eb07[_0x4afc('0x3a')],qs[_0x4afc('0x40')](_0x4e296e[_0x4afc('0x3b')]['fields']));_0x30c6fc[_0x4afc('0x3f')]=_0x30c6fc['attributes'][_0x4afc('0x41')]?_0x30c6fc[_0x4afc('0x3f')]:_0x14eb07['model'];_0x30c6fc['order']=qs['sort'](_0x4e296e['query'][_0x4afc('0x44')]);_0x30c6fc[_0x4afc('0x46')]=qs['filters'](_[_0x4afc('0x45')](_0x4e296e[_0x4afc('0x3b')],_0x14eb07[_0x4afc('0x3d')]));if(_0x4e296e[_0x4afc('0x3b')][_0x4afc('0x4a')]){_0x30c6fc[_0x4afc('0x46')]=_[_0x4afc('0x47')](_0x30c6fc['where'],{'$or':_[_0x4afc('0x36')](_0x30c6fc[_0x4afc('0x3f')],function(_0x1f425c){var _0x47f858={};_0x47f858[_0x1f425c]={'$like':'%'+_0x4e296e[_0x4afc('0x3b')]['filter']+'%'};return _0x47f858;})});}_0x30c6fc=_[_0x4afc('0x47')]({},_0x30c6fc,_0x4e296e[_0x4afc('0x4b')]);return _0x1fb2ca[_0x4afc('0x56')](_0x30c6fc);}})['then'](function(_0x33ca23){if(_0x33ca23){_0x150468=_0x33ca23[_0x4afc('0x41')];if(!_0x4e296e[_0x4afc('0x3b')][_0x4afc('0x42')](_0x4afc('0x59'))){_0x30c6fc['limit']=qs[_0x4afc('0x2d')](_0x4e296e['query'][_0x4afc('0x2d')]);_0x30c6fc[_0x4afc('0x2c')]=qs[_0x4afc('0x2c')](_0x4e296e[_0x4afc('0x3b')][_0x4afc('0x2c')]);}return _0x1fb2ca[_0x4afc('0x56')](_0x30c6fc);}})['then'](function(_0x18b098){if(_0x18b098){return _0x18b098?{'count':_0x150468,'rows':_0x18b098}:null;}})[_0x4afc('0x1e')](respondWithResult(_0x59f1a9,null))[_0x4afc('0x27')](handleError(_0x59f1a9,null));};exports['addConfiguration']=function(_0xb587b0,_0x2ff6f0,_0x10fd11){if(_0xb587b0['body']['id']){delete _0xb587b0[_0x4afc('0x55')]['id'];}return db[_0x4afc('0x4d')]['findOne']({'where':{'id':_0xb587b0[_0x4afc('0x51')]['id']}})[_0x4afc('0x1e')](handleEntityNotFound(_0x2ff6f0,null))['then'](function(_0x2d144d){if(_0x2d144d){_0xb587b0['body'][_0x4afc('0x5a')]=_0x2d144d['id'];_0xb587b0[_0x4afc('0x55')][_0x4afc('0x5b')]=integrations[_0x4afc('0x5c')](_0xb587b0[_0x4afc('0x55')][_0x4afc('0x5d')],_0xb587b0[_0x4afc('0x55')]['type']);_0xb587b0['body']['Descriptions']=integrations[_0x4afc('0x5e')](_0xb587b0['body'][_0x4afc('0x5d')],_0xb587b0[_0x4afc('0x55')]['type']);return db[_0x4afc('0x58')][_0x4afc('0x54')](_0xb587b0[_0x4afc('0x55')],{'include':[{'model':db[_0x4afc('0x5f')],'as':_0x4afc('0x5b')},{'model':db['SugarcrmField'],'as':_0x4afc('0x60')}]});}return null;})[_0x4afc('0x1e')](respondWithResult(_0x2ff6f0,null))['catch'](handleError(_0x2ff6f0,null));};exports[_0x4afc('0x61')]=function(_0x2eeed4,_0x529a62,_0x3ceabc){var _0x32f35b='';var _0x4ecaef=['id',_0x4afc('0x35'),'assigned_user_id',_0x4afc('0x62'),'description','date_start','duration_hours',_0x4afc('0x63'),'parent_id',_0x4afc('0x64'),'parent_name',_0x4afc('0x65')];return db[_0x4afc('0x4d')][_0x4afc('0x57')]({'where':{'id':_0x2eeed4['params']['id']},'attributes':['id','username','password',_0x4afc('0x66')]})['then'](handleEntityNotFound(_0x529a62,null))[_0x4afc('0x1e')](function(_0x58e435){if(_0x58e435){_0x32f35b=_0x58e435[_0x4afc('0x66')];var _0x31b5aa=_0x32f35b['slice'](-0x1);if(_0x31b5aa==='/'){_0x32f35b=_0x32f35b['substring'](0x0,_0x32f35b['lastIndexOf'](_0x31b5aa));}return rp({'method':_0x4afc('0x67'),'uri':util[_0x4afc('0x68')](_0x4afc('0x69'),_0x32f35b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x4afc('0x6a'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x58e435['username'],'password':_0x58e435[_0x4afc('0x6b')],'encryption':_0x4afc('0x6c')},'application':_0x4afc('0x6d')})}});}})[_0x4afc('0x1e')](function(_0xdd531f){if(_0xdd531f&&_0xdd531f[_0x4afc('0x35')]!==_0x4afc('0x6e')&&_0xdd531f['name']!==_0x4afc('0x6f')){return rp({'method':'POST','uri':util[_0x4afc('0x68')]('%s%s',_0x32f35b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x4afc('0x70'),'input_type':_0x4afc('0x6a'),'response_type':_0x4afc('0x6a'),'rest_data':JSON[_0x4afc('0x24')]({'session':_0xdd531f['id'],'module_name':_0x4afc('0x71')})}})[_0x4afc('0x1e')](function(_0x3c7f24){if(_0x3c7f24){var _0x322a53=_['values'](_0x3c7f24[_0x4afc('0x72')]);_[_0x4afc('0x73')](_0x322a53,function(_0x245e1c){return _0x4ecaef[_0x4afc('0x74')](_0x245e1c[_0x4afc('0x35')]);});return{'count':_0x322a53[_0x4afc('0x41')],'rows':_['map'](_0x322a53,function(_0x2c7ea8){return{'id':_0x2c7ea8[_0x4afc('0x35')],'name':_0x2c7ea8['label'],'custom':_[_0x4afc('0x75')](_0x2c7ea8[_0x4afc('0x35')],'_c')?!![]:![],'options':_0x2c7ea8[_0x4afc('0x4b')]?_['map'](_[_0x4afc('0x76')](_0x2c7ea8[_0x4afc('0x4b')]),function(_0x1332b3){return{'name':_0x1332b3['value'],'value':_0x1332b3[_0x4afc('0x35')]};}):[]};})};}})[_0x4afc('0x1e')](respondWithResult(_0x529a62,null))[_0x4afc('0x27')](function(_0x5bf2df){var _0x5a4278=_0x2eeed4[_0x4afc('0x3b')][_0x4afc('0x77')]?0x1f4:_0x5bf2df['statusCode']||0x1f4;logger[_0x4afc('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x4afc('0x61'),_0x5a4278,JSON['stringify'](_0x5bf2df));delete _0x5bf2df[_0x4afc('0x35')];if(_0x5a4278===0x191){_0x5a4278=0x190;}_0x529a62[_0x4afc('0x29')](_0x5a4278)[_0x4afc('0x78')](_0x2eeed4[_0x4afc('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5bf2df[_0x4afc('0x79')]}:_0x5bf2df);});}else{var _0x498cf9=0x1f4;_0x529a62[_0x4afc('0x29')](_0x498cf9)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9758=['update','destroy','stack','name','send','SugarcrmAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','show','find','create','body','getConfigurations','params','SugarcrmConfiguration','map','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','get_module_fields','values','module_fields','remove','includes','label','value','statusCode','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x15eab7,_0x49bed6){var _0x1f15c6=function(_0x33acb0){while(--_0x33acb0){_0x15eab7['push'](_0x15eab7['shift']());}};_0x1f15c6(++_0x49bed6);}(_0x9758,0x1cf));var _0x8975=function(_0x31eef0,_0x4d95f7){_0x31eef0=_0x31eef0-0x0;var _0x466718=_0x9758[_0x31eef0];return _0x466718;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8975('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8975('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8975('0x2'));var moment=require(_0x8975('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8975('0x4'));var path=require(_0x8975('0x5'));var sox=require(_0x8975('0x6'));var csv=require(_0x8975('0x7'));var ejs=require(_0x8975('0x8'));var fs=require('fs');var _=require(_0x8975('0x9'));var squel=require(_0x8975('0xa'));var crypto=require(_0x8975('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8975('0x7'));var querystring=require('querystring');var Papa=require(_0x8975('0xc'));var Redis=require('ioredis');var authService=require(_0x8975('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x8975('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8975('0xf'))(_0x8975('0x10'));var utils=require(_0x8975('0x11'));var config=require(_0x8975('0x12'));var db=require(_0x8975('0x13'))['db'];var integrations=require(_0x8975('0x14'));var jayson=require(_0x8975('0x15'));var client=jayson[_0x8975('0x16')][_0x8975('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1b941f,_0x5a00a8,_0x46f08b){if(_0x46f08b){var _0xdf7097=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdf7097[_0x8975('0x18')](_0x5a00a8)){return _0x1b941f;}else{throw new db[(_0x8975('0x19'))][(_0x8975('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1b941f;}}function respondWithRpcPromise(_0x18b7fe,_0x286793,_0x162bdc,_0x59652b){return new BPromise(function(_0x3ac34c,_0x51565d){var _0x2054af=_0x59652b||client;return _0x2054af[_0x8975('0x1b')](_0x18b7fe,_0x162bdc)[_0x8975('0x1c')](function(_0x2e67d9){logger[_0x8975('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x286793,_0x8975('0x1e'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x286793,_0x8975('0x1e'),JSON[_0x8975('0x1f')](_0x2e67d9));if(_0x2e67d9[_0x8975('0x20')]){if(_0x2e67d9[_0x8975('0x20')][_0x8975('0x21')]===0x1f4){logger['error'](_0x8975('0x22'),_0x286793,_0x2e67d9['error'][_0x8975('0x23')]);return _0x51565d(_0x2e67d9[_0x8975('0x20')][_0x8975('0x23')]);}logger[_0x8975('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x286793,_0x2e67d9[_0x8975('0x20')][_0x8975('0x23')]);return _0x3ac34c(_0x2e67d9[_0x8975('0x20')]['message']);}else{logger[_0x8975('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x286793,_0x8975('0x1e'));_0x3ac34c(_0x2e67d9['result'][_0x8975('0x23')]);}})[_0x8975('0x24')](function(_0x4a86ba){logger['error'](_0x8975('0x22'),_0x286793,_0x4a86ba);_0x51565d(_0x4a86ba);});});}function respondWithStatusCode(_0x216d51,_0x290970){_0x290970=_0x290970||0xcc;return function(_0x7a68cd){if(_0x7a68cd){return _0x216d51[_0x8975('0x25')](_0x290970);}return _0x216d51[_0x8975('0x26')](_0x290970)[_0x8975('0x27')]();};}function respondWithResult(_0x421ea3,_0x5726d2){_0x5726d2=_0x5726d2||0xc8;return function(_0x20b8f6){if(_0x20b8f6){return _0x421ea3[_0x8975('0x26')](_0x5726d2)[_0x8975('0x28')](_0x20b8f6);}};}function respondWithFilteredResult(_0x3958d4,_0x37854b){return function(_0x3d996e){if(_0x3d996e){var _0x48b553=_0x3d996e[_0x8975('0x29')],_0x3f46e7=_0x37854b[_0x8975('0x2a')],_0x35f473=_0x37854b[_0x8975('0x2a')]+_0x37854b[_0x8975('0x2b')],_0x37ed42;if(_0x35f473>=_0x48b553){_0x35f473=_0x48b553;_0x37ed42=0xc8;}else{_0x37ed42=0xce;}_0x3958d4['status'](_0x37ed42);return _0x3958d4[_0x8975('0x2c')](_0x8975('0x2d'),_0x3f46e7+'-'+_0x35f473+'/'+_0x48b553)[_0x8975('0x28')](_0x3d996e);}return null;};}function patchUpdates(_0x4b8359){return function(_0x1b533d){try{jsonpatch[_0x8975('0x2e')](_0x1b533d,_0x4b8359,!![]);}catch(_0x589c6c){return BPromise[_0x8975('0x2f')](_0x589c6c);}return _0x1b533d[_0x8975('0x30')]();};}function saveUpdates(_0x47e9f5,_0x4e36a1){return function(_0x50e8f5){if(_0x50e8f5){return _0x50e8f5[_0x8975('0x31')](_0x47e9f5)[_0x8975('0x1c')](function(_0xe54d23){return _0xe54d23;});}return null;};}function removeEntity(_0x4ed2d3,_0xac9ec9){return function(_0x50abd9){if(_0x50abd9){return _0x50abd9[_0x8975('0x32')]()[_0x8975('0x1c')](function(){_0x4ed2d3[_0x8975('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x428c43,_0x3d8c72){return function(_0x22fce5){if(!_0x22fce5){_0x428c43[_0x8975('0x25')](0x194);}return _0x22fce5;};}function handleError(_0x583775,_0x3d0ff0){_0x3d0ff0=_0x3d0ff0||0x1f4;return function(_0x5c9e00){logger[_0x8975('0x20')](_0x5c9e00[_0x8975('0x33')]);if(_0x5c9e00[_0x8975('0x34')]){delete _0x5c9e00[_0x8975('0x34')];}_0x583775['status'](_0x3d0ff0)[_0x8975('0x35')](_0x5c9e00);};}exports['index']=function(_0x5be00a,_0x345f64){var _0x50f4bd={},_0x18987f={},_0x4c8529={'count':0x0,'rows':[]};var _0x5ec8cc=_['map'](db[_0x8975('0x36')][_0x8975('0x37')],function(_0x109403){return{'name':_0x109403['fieldName'],'type':_0x109403['type'][_0x8975('0x38')]};});_0x18987f['model']=_['map'](_0x5ec8cc,_0x8975('0x34'));_0x18987f[_0x8975('0x39')]=_[_0x8975('0x3a')](_0x5be00a[_0x8975('0x39')]);_0x18987f[_0x8975('0x3b')]=_[_0x8975('0x3c')](_0x18987f[_0x8975('0x3d')],_0x18987f[_0x8975('0x39')]);_0x50f4bd[_0x8975('0x3e')]=_['intersection'](_0x18987f[_0x8975('0x3d')],qs[_0x8975('0x3f')](_0x5be00a[_0x8975('0x39')][_0x8975('0x3f')]));_0x50f4bd[_0x8975('0x3e')]=_0x50f4bd['attributes'][_0x8975('0x40')]?_0x50f4bd[_0x8975('0x3e')]:_0x18987f['model'];if(!_0x5be00a[_0x8975('0x39')][_0x8975('0x41')](_0x8975('0x42'))){_0x50f4bd[_0x8975('0x2b')]=qs['limit'](_0x5be00a[_0x8975('0x39')]['limit']);_0x50f4bd[_0x8975('0x2a')]=qs['offset'](_0x5be00a[_0x8975('0x39')][_0x8975('0x2a')]);}_0x50f4bd[_0x8975('0x43')]=qs[_0x8975('0x44')](_0x5be00a['query'][_0x8975('0x44')]);_0x50f4bd['where']=qs['filters'](_[_0x8975('0x45')](_0x5be00a[_0x8975('0x39')],_0x18987f[_0x8975('0x3b')]),_0x5ec8cc);if(_0x5be00a['query']['filter']){_0x50f4bd['where']=_[_0x8975('0x46')](_0x50f4bd['where'],{'$or':_['map'](_0x5ec8cc,function(_0x484957){if(_0x484957['type']!==_0x8975('0x47')){var _0x2ee709={};_0x2ee709[_0x484957[_0x8975('0x34')]]={'$like':'%'+_0x5be00a[_0x8975('0x39')][_0x8975('0x48')]+'%'};return _0x2ee709;}})});}_0x50f4bd=_[_0x8975('0x46')]({},_0x50f4bd,_0x5be00a[_0x8975('0x49')]);var _0x555923={'where':_0x50f4bd[_0x8975('0x4a')]};return db[_0x8975('0x36')][_0x8975('0x29')](_0x555923)['then'](function(_0x23d0f5){_0x4c8529[_0x8975('0x29')]=_0x23d0f5;if(_0x5be00a[_0x8975('0x39')][_0x8975('0x4b')]){_0x50f4bd[_0x8975('0x4c')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x8975('0x4d')](_0x50f4bd);})[_0x8975('0x1c')](function(_0x2270c8){_0x4c8529[_0x8975('0x4e')]=_0x2270c8;return _0x4c8529;})[_0x8975('0x1c')](respondWithFilteredResult(_0x345f64,_0x50f4bd))['catch'](handleError(_0x345f64,null));};exports[_0x8975('0x4f')]=function(_0x42e260,_0x3ca042){var _0x35dd7a={'raw':![],'where':{'id':_0x42e260['params']['id']}},_0x56c0de={};_0x56c0de[_0x8975('0x3d')]=_['keys'](db[_0x8975('0x36')][_0x8975('0x37')]);_0x56c0de[_0x8975('0x39')]=_[_0x8975('0x3a')](_0x42e260['query']);_0x56c0de[_0x8975('0x3b')]=_[_0x8975('0x3c')](_0x56c0de[_0x8975('0x3d')],_0x56c0de[_0x8975('0x39')]);_0x35dd7a[_0x8975('0x3e')]=_[_0x8975('0x3c')](_0x56c0de[_0x8975('0x3d')],qs['fields'](_0x42e260[_0x8975('0x39')][_0x8975('0x3f')]));_0x35dd7a['attributes']=_0x35dd7a[_0x8975('0x3e')][_0x8975('0x40')]?_0x35dd7a['attributes']:_0x56c0de[_0x8975('0x3d')];if(_0x42e260[_0x8975('0x39')][_0x8975('0x4b')]){_0x35dd7a[_0x8975('0x4c')]=[{'all':!![]}];}_0x35dd7a=_[_0x8975('0x46')]({},_0x35dd7a,_0x42e260['options']);return db['SugarcrmAccount'][_0x8975('0x50')](_0x35dd7a)[_0x8975('0x1c')](handleEntityNotFound(_0x3ca042,null))['then'](respondWithResult(_0x3ca042,null))[_0x8975('0x24')](handleError(_0x3ca042,null));};exports[_0x8975('0x51')]=function(_0x28458b,_0x5f10c2){return db[_0x8975('0x36')][_0x8975('0x51')](_0x28458b[_0x8975('0x52')],{})['then'](respondWithResult(_0x5f10c2,0xc9))[_0x8975('0x24')](handleError(_0x5f10c2,null));};exports[_0x8975('0x31')]=function(_0x1bca3e,_0x12db6a){if(_0x1bca3e['body']['id']){delete _0x1bca3e[_0x8975('0x52')]['id'];}return db['SugarcrmAccount'][_0x8975('0x50')]({'where':{'id':_0x1bca3e['params']['id']}})[_0x8975('0x1c')](handleEntityNotFound(_0x12db6a,null))[_0x8975('0x1c')](saveUpdates(_0x1bca3e[_0x8975('0x52')],null))['then'](respondWithResult(_0x12db6a,null))[_0x8975('0x24')](handleError(_0x12db6a,null));};exports[_0x8975('0x32')]=function(_0x455441,_0x24614b){return db['SugarcrmAccount'][_0x8975('0x50')]({'where':{'id':_0x455441['params']['id']}})['then'](handleEntityNotFound(_0x24614b,null))[_0x8975('0x1c')](removeEntity(_0x24614b,null))[_0x8975('0x24')](handleError(_0x24614b,null));};exports[_0x8975('0x53')]=function(_0x440a84,_0x18d547,_0x33f8d9){var _0x1f9d3f={};var _0x375919={};var _0x10b6af;var _0x49283f;return db[_0x8975('0x36')]['findOne']({'where':{'id':_0x440a84[_0x8975('0x54')]['id']}})[_0x8975('0x1c')](handleEntityNotFound(_0x18d547,null))[_0x8975('0x1c')](function(_0x1b59b0){if(_0x1b59b0){_0x10b6af=_0x1b59b0;_0x375919[_0x8975('0x3d')]=_['keys'](db[_0x8975('0x55')]['rawAttributes']);_0x375919[_0x8975('0x39')]=_[_0x8975('0x3a')](_0x440a84[_0x8975('0x39')]);_0x375919[_0x8975('0x3b')]=_[_0x8975('0x3c')](_0x375919[_0x8975('0x3d')],_0x375919[_0x8975('0x39')]);_0x1f9d3f['attributes']=_['intersection'](_0x375919[_0x8975('0x3d')],qs['fields'](_0x440a84['query'][_0x8975('0x3f')]));_0x1f9d3f[_0x8975('0x3e')]=_0x1f9d3f[_0x8975('0x3e')][_0x8975('0x40')]?_0x1f9d3f['attributes']:_0x375919[_0x8975('0x3d')];_0x1f9d3f[_0x8975('0x43')]=qs[_0x8975('0x44')](_0x440a84[_0x8975('0x39')][_0x8975('0x44')]);_0x1f9d3f[_0x8975('0x4a')]=qs[_0x8975('0x3b')](_[_0x8975('0x45')](_0x440a84['query'],_0x375919[_0x8975('0x3b')]));if(_0x440a84['query'][_0x8975('0x48')]){_0x1f9d3f[_0x8975('0x4a')]=_[_0x8975('0x46')](_0x1f9d3f[_0x8975('0x4a')],{'$or':_[_0x8975('0x56')](_0x1f9d3f[_0x8975('0x3e')],function(_0x3f77f0){var _0xecc936={};_0xecc936[_0x3f77f0]={'$like':'%'+_0x440a84[_0x8975('0x39')]['filter']+'%'};return _0xecc936;})});}_0x1f9d3f=_[_0x8975('0x46')]({},_0x1f9d3f,_0x440a84[_0x8975('0x49')]);return _0x10b6af[_0x8975('0x53')](_0x1f9d3f);}})[_0x8975('0x1c')](function(_0x2ce68b){if(_0x2ce68b){_0x49283f=_0x2ce68b[_0x8975('0x40')];if(!_0x440a84[_0x8975('0x39')]['hasOwnProperty'](_0x8975('0x42'))){_0x1f9d3f[_0x8975('0x2b')]=qs['limit'](_0x440a84[_0x8975('0x39')][_0x8975('0x2b')]);_0x1f9d3f[_0x8975('0x2a')]=qs[_0x8975('0x2a')](_0x440a84['query'][_0x8975('0x2a')]);}return _0x10b6af[_0x8975('0x53')](_0x1f9d3f);}})['then'](function(_0x2fe483){if(_0x2fe483){return _0x2fe483?{'count':_0x49283f,'rows':_0x2fe483}:null;}})[_0x8975('0x1c')](respondWithResult(_0x18d547,null))[_0x8975('0x24')](handleError(_0x18d547,null));};exports[_0x8975('0x57')]=function(_0x685982,_0x25ee0b,_0x1e7f68){if(_0x685982['body']['id']){delete _0x685982[_0x8975('0x52')]['id'];}return db['SugarcrmAccount'][_0x8975('0x58')]({'where':{'id':_0x685982[_0x8975('0x54')]['id']}})['then'](handleEntityNotFound(_0x25ee0b,null))[_0x8975('0x1c')](function(_0x3bf5e5){if(_0x3bf5e5){_0x685982[_0x8975('0x52')][_0x8975('0x59')]=_0x3bf5e5['id'];_0x685982[_0x8975('0x52')][_0x8975('0x5a')]=integrations[_0x8975('0x5b')](_0x685982[_0x8975('0x52')]['channel'],_0x685982['body'][_0x8975('0x5c')]);_0x685982['body'][_0x8975('0x5d')]=integrations[_0x8975('0x5e')](_0x685982[_0x8975('0x52')][_0x8975('0x5f')],_0x685982[_0x8975('0x52')][_0x8975('0x5c')]);return db[_0x8975('0x55')][_0x8975('0x51')](_0x685982[_0x8975('0x52')],{'include':[{'model':db[_0x8975('0x60')],'as':'Subjects'},{'model':db[_0x8975('0x60')],'as':_0x8975('0x5d')}]});}return null;})[_0x8975('0x1c')](respondWithResult(_0x25ee0b,null))[_0x8975('0x24')](handleError(_0x25ee0b,null));};exports[_0x8975('0x61')]=function(_0x1205b5,_0x2fed77,_0x546011){var _0x39743d='';var _0x420889=['id',_0x8975('0x34'),_0x8975('0x62'),_0x8975('0x63'),_0x8975('0x64'),_0x8975('0x65'),'duration_hours',_0x8975('0x66'),_0x8975('0x67'),_0x8975('0x68'),_0x8975('0x69'),_0x8975('0x6a')];return db[_0x8975('0x36')]['findOne']({'where':{'id':_0x1205b5[_0x8975('0x54')]['id']},'attributes':['id',_0x8975('0x6b'),_0x8975('0x6c'),_0x8975('0x6d')]})['then'](handleEntityNotFound(_0x2fed77,null))[_0x8975('0x1c')](function(_0x555fed){if(_0x555fed){_0x39743d=_0x555fed['remoteUri'];var _0x8d8ad=_0x39743d[_0x8975('0x6e')](-0x1);if(_0x8d8ad==='/'){_0x39743d=_0x39743d[_0x8975('0x6f')](0x0,_0x39743d[_0x8975('0x70')](_0x8d8ad));}return rp({'method':_0x8975('0x71'),'uri':util[_0x8975('0x72')](_0x8975('0x73'),_0x39743d,_0x8975('0x74')),'json':!![],'form':{'method':'login','input_type':_0x8975('0x75'),'response_type':'JSON','rest_data':JSON[_0x8975('0x1f')]({'user_auth':{'user_name':_0x555fed[_0x8975('0x6b')],'password':_0x555fed[_0x8975('0x6c')],'encryption':_0x8975('0x76')},'application':_0x8975('0x77')})}});}})[_0x8975('0x1c')](function(_0x329204){if(_0x329204&&_0x329204[_0x8975('0x34')]!=='Invalid\x20Login'&&_0x329204[_0x8975('0x34')]!=='Password\x20Expired'){return rp({'method':_0x8975('0x71'),'uri':util['format']('%s%s',_0x39743d,_0x8975('0x74')),'json':!![],'form':{'method':_0x8975('0x78'),'input_type':_0x8975('0x75'),'response_type':_0x8975('0x75'),'rest_data':JSON[_0x8975('0x1f')]({'session':_0x329204['id'],'module_name':'Calls'})}})[_0x8975('0x1c')](function(_0x443024){if(_0x443024){var _0xe297b3=_[_0x8975('0x79')](_0x443024[_0x8975('0x7a')]);_[_0x8975('0x7b')](_0xe297b3,function(_0x2b8829){return _0x420889[_0x8975('0x7c')](_0x2b8829['name']);});return{'count':_0xe297b3[_0x8975('0x40')],'rows':_[_0x8975('0x56')](_0xe297b3,function(_0x2a6c1d){return{'id':_0x2a6c1d[_0x8975('0x34')],'name':_0x2a6c1d[_0x8975('0x7d')],'custom':_['endsWith'](_0x2a6c1d[_0x8975('0x34')],'_c')?!![]:![],'options':_0x2a6c1d[_0x8975('0x49')]?_['map'](_[_0x8975('0x79')](_0x2a6c1d['options']),function(_0x2106e6){return{'name':_0x2106e6[_0x8975('0x7e')],'value':_0x2106e6[_0x8975('0x34')]};}):[]};})};}})[_0x8975('0x1c')](respondWithResult(_0x2fed77,null))[_0x8975('0x24')](function(_0x59f813){var _0x552de4=_0x1205b5[_0x8975('0x39')][_0x8975('0x18')]?0x1f4:_0x59f813['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8975('0x61'),_0x552de4,JSON[_0x8975('0x1f')](_0x59f813));delete _0x59f813[_0x8975('0x34')];if(_0x552de4===0x191){_0x552de4=0x190;}_0x2fed77['status'](_0x552de4)['send'](_0x1205b5[_0x8975('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x59f813[_0x8975('0x7f')]}:_0x59f813);});}else{var _0x19ca73=0x1f4;_0x2fed77[_0x8975('0x26')](_0x19ca73)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 0b8ba73..a437368 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 _0x5f5c=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','lodash','../../config/logger','moment'];(function(_0x12aab7,_0x10fa9a){var _0x16b408=function(_0x261032){while(--_0x261032){_0x12aab7['push'](_0x12aab7['shift']());}};_0x16b408(++_0x10fa9a);}(_0x5f5c,0x110));var _0xc5f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f5c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc5f5('0x0'));var util=require('util');var logger=require(_0xc5f5('0x1'))('api');var moment=require(_0xc5f5('0x2'));var BPromise=require(_0xc5f5('0x3'));var rp=require(_0xc5f5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5f5('0x5'));var config=require(_0xc5f5('0x6'));var attributes=require(_0xc5f5('0x7'));var integrations=require(_0xc5f5('0x8'));module[_0xc5f5('0x9')]=function(_0x28ea16,_0x2b0bf5){return _0x28ea16[_0xc5f5('0xa')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1816=['lodash','api','moment','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x44a48e,_0x472b4e){var _0x29417a=function(_0x527ea6){while(--_0x527ea6){_0x44a48e['push'](_0x44a48e['shift']());}};_0x29417a(++_0x472b4e);}(_0x1816,0x1d4));var _0x6181=function(_0xe90f2c,_0x506e05){_0xe90f2c=_0xe90f2c-0x0;var _0x20b51d=_0x1816[_0xe90f2c];return _0x20b51d;};'use strict';var _=require(_0x6181('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6181('0x1'));var moment=require(_0x6181('0x2'));var BPromise=require(_0x6181('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6181('0x4'));var rimraf=require('rimraf');var config=require(_0x6181('0x5'));var attributes=require(_0x6181('0x6'));var integrations=require(_0x6181('0x7'));module[_0x6181('0x8')]=function(_0x4db821,_0xf61bda){return _0x4db821[_0x6181('0x9')](_0x6181('0xa'),attributes,{'tableName':_0x6181('0xb'),'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 e88e402..51bf315 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 _0x90f6=['attributes','stringify','ShowSugarcrmAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','include','map','model'];(function(_0x485b70,_0x179af7){var _0x4dc80f=function(_0x51e397){while(--_0x51e397){_0x485b70['push'](_0x485b70['shift']());}};_0x4dc80f(++_0x179af7);}(_0x90f6,0x1b0));var _0x690f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90f6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x690f('0x0'));var moment=require(_0x690f('0x1'));var BPromise=require(_0x690f('0x2'));var rs=require(_0x690f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x690f('0x4'))['db'];var utils=require(_0x690f('0x5'));var logger=require('../../config/logger')(_0x690f('0x6'));var config=require(_0x690f('0x7'));var jayson=require(_0x690f('0x8'));var client=jayson[_0x690f('0x9')][_0x690f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e647,_0x201ffd,_0x14d480){return new BPromise(function(_0x451971,_0x412e3e){return client['request'](_0x45e647,_0x14d480)[_0x690f('0xb')](function(_0x382f94){logger[_0x690f('0xc')](_0x690f('0xd'),_0x201ffd,_0x690f('0xe'));logger[_0x690f('0xf')](_0x690f('0x10'),_0x201ffd,_0x690f('0xe'),JSON['stringify'](_0x382f94));if(_0x382f94[_0x690f('0x11')]){if(_0x382f94[_0x690f('0x11')][_0x690f('0x12')]===0x1f4){logger[_0x690f('0x11')](_0x690f('0xd'),_0x201ffd,_0x382f94['error']['message']);return _0x412e3e(_0x382f94['error'][_0x690f('0x13')]);}logger['error'](_0x690f('0xd'),_0x201ffd,_0x382f94[_0x690f('0x11')][_0x690f('0x13')]);return _0x451971(_0x382f94['error'][_0x690f('0x13')]);}else{logger['info'](_0x690f('0xd'),_0x201ffd,_0x690f('0xe'));_0x451971(_0x382f94[_0x690f('0x14')][_0x690f('0x13')]);}})[_0x690f('0x15')](function(_0x34c87a){logger[_0x690f('0x11')](_0x690f('0xd'),_0x201ffd,_0x34c87a);_0x412e3e(_0x34c87a);});});}exports[_0x690f('0x16')]=function(_0x577475){var _0x4f4a4a=this;return new Promise(function(_0x5d744d,_0x4330b1){return db[_0x690f('0x17')]['findAll']({'raw':_0x577475['options']?_0x577475[_0x690f('0x18')][_0x690f('0x19')]===undefined?!![]:![]:!![],'where':_0x577475[_0x690f('0x18')]?_0x577475[_0x690f('0x18')][_0x690f('0x1a')]||null:null,'attributes':_0x577475['options']?_0x577475[_0x690f('0x18')]['attributes']||null:null,'limit':_0x577475[_0x690f('0x18')]?_0x577475[_0x690f('0x18')]['limit']||null:null,'include':_0x577475[_0x690f('0x18')]?_0x577475[_0x690f('0x18')][_0x690f('0x1b')]?_[_0x690f('0x1c')](_0x577475[_0x690f('0x18')][_0x690f('0x1b')],function(_0x30d807){return{'model':db[_0x30d807[_0x690f('0x1d')]],'as':_0x30d807['as'],'attributes':_0x30d807[_0x690f('0x1e')],'include':_0x30d807[_0x690f('0x1b')]?_[_0x690f('0x1c')](_0x30d807[_0x690f('0x1b')],function(_0x34b1c7){return{'model':db[_0x34b1c7['model']],'as':_0x34b1c7['as'],'attributes':_0x34b1c7['attributes'],'include':_0x34b1c7[_0x690f('0x1b')]?_['map'](_0x34b1c7['include'],function(_0x5d3988){return{'model':db[_0x5d3988[_0x690f('0x1d')]],'as':_0x5d3988['as'],'attributes':_0x5d3988[_0x690f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x690f('0xb')](function(_0x2c4841){logger[_0x690f('0xc')](_0x690f('0x16'),_0x577475);logger['debug'](_0x690f('0x16'),_0x577475,JSON[_0x690f('0x1f')](_0x2c4841));_0x5d744d(_0x2c4841);})['catch'](function(_0xdf5ebb){logger[_0x690f('0x11')](_0x690f('0x16'),_0xdf5ebb['message'],_0x577475);_0x4330b1(_0x4f4a4a['error'](0x1f4,_0xdf5ebb[_0x690f('0x13')]));});});};exports[_0x690f('0x20')]=function(_0x2bee04){var _0x421d17=this;return new Promise(function(_0x337323,_0x5a67b2){return db[_0x690f('0x17')]['find']({'raw':_0x2bee04[_0x690f('0x18')]?_0x2bee04[_0x690f('0x18')][_0x690f('0x19')]===undefined?!![]:![]:!![],'where':_0x2bee04[_0x690f('0x18')]?_0x2bee04['options'][_0x690f('0x1a')]||null:null,'attributes':_0x2bee04[_0x690f('0x18')]?_0x2bee04[_0x690f('0x18')][_0x690f('0x1e')]||null:null,'include':_0x2bee04['options']?_0x2bee04[_0x690f('0x18')][_0x690f('0x1b')]?_[_0x690f('0x1c')](_0x2bee04['options'][_0x690f('0x1b')],function(_0x530479){return{'model':db[_0x530479[_0x690f('0x1d')]],'as':_0x530479['as'],'attributes':_0x530479[_0x690f('0x1e')],'include':_0x530479['include']?_[_0x690f('0x1c')](_0x530479[_0x690f('0x1b')],function(_0x52d39a){return{'model':db[_0x52d39a[_0x690f('0x1d')]],'as':_0x52d39a['as'],'attributes':_0x52d39a[_0x690f('0x1e')],'include':_0x52d39a[_0x690f('0x1b')]?_['map'](_0x52d39a['include'],function(_0x24fc05){return{'model':db[_0x24fc05[_0x690f('0x1d')]],'as':_0x24fc05['as'],'attributes':_0x24fc05['attributes']};}):[]};}):[]};}):[]:[]})[_0x690f('0xb')](function(_0x2ee216){logger['info']('ShowSugarcrmAccount',_0x2bee04);logger[_0x690f('0xf')](_0x690f('0x20'),_0x2bee04,JSON[_0x690f('0x1f')](_0x2ee216));_0x337323(_0x2ee216);})[_0x690f('0x15')](function(_0x3bb45c){logger['error']('ShowSugarcrmAccount',_0x3bb45c[_0x690f('0x13')],_0x2bee04);_0x5a67b2(_0x421d17['error'](0x1f4,_0x3bb45c[_0x690f('0x13')]));});});}; \ No newline at end of file +var _0x570a=['catch','ShowSugarcrmAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','map','model','include','attributes','debug'];(function(_0x20eff9,_0x5847b9){var _0x336e99=function(_0x37e63b){while(--_0x37e63b){_0x20eff9['push'](_0x20eff9['shift']());}};_0x336e99(++_0x5847b9);}(_0x570a,0xf8));var _0xa570=function(_0x5a5eb9,_0x2a9139){_0x5a5eb9=_0x5a5eb9-0x0;var _0x35e100=_0x570a[_0x5a5eb9];return _0x35e100;};'use strict';var _=require(_0xa570('0x0'));var util=require(_0xa570('0x1'));var moment=require('moment');var BPromise=require(_0xa570('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa570('0x3'));var db=require(_0xa570('0x4'))['db'];var utils=require(_0xa570('0x5'));var logger=require(_0xa570('0x6'))('rpc');var config=require(_0xa570('0x7'));var jayson=require(_0xa570('0x8'));var client=jayson[_0xa570('0x9')][_0xa570('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cd5a9,_0x1fa022,_0x27ec92){return new BPromise(function(_0x14e469,_0x4becbc){return client['request'](_0x3cd5a9,_0x27ec92)[_0xa570('0xb')](function(_0x2e7424){logger[_0xa570('0xc')](_0xa570('0xd'),_0x1fa022,'request\x20sent');logger['debug'](_0xa570('0xe'),_0x1fa022,'request\x20sent',JSON[_0xa570('0xf')](_0x2e7424));if(_0x2e7424[_0xa570('0x10')]){if(_0x2e7424[_0xa570('0x10')][_0xa570('0x11')]===0x1f4){logger[_0xa570('0x10')](_0xa570('0xd'),_0x1fa022,_0x2e7424['error'][_0xa570('0x12')]);return _0x4becbc(_0x2e7424['error'][_0xa570('0x12')]);}logger[_0xa570('0x10')](_0xa570('0xd'),_0x1fa022,_0x2e7424[_0xa570('0x10')]['message']);return _0x14e469(_0x2e7424[_0xa570('0x10')][_0xa570('0x12')]);}else{logger[_0xa570('0xc')](_0xa570('0xd'),_0x1fa022,_0xa570('0x13'));_0x14e469(_0x2e7424[_0xa570('0x14')]['message']);}})['catch'](function(_0x444f53){logger[_0xa570('0x10')](_0xa570('0xd'),_0x1fa022,_0x444f53);_0x4becbc(_0x444f53);});});}exports[_0xa570('0x15')]=function(_0x25b5f7){var _0x49101d=this;return new Promise(function(_0x549d7a,_0x4186dd){return db[_0xa570('0x16')][_0xa570('0x17')]({'raw':_0x25b5f7[_0xa570('0x18')]?_0x25b5f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x25b5f7[_0xa570('0x18')]?_0x25b5f7[_0xa570('0x18')][_0xa570('0x19')]||null:null,'attributes':_0x25b5f7[_0xa570('0x18')]?_0x25b5f7[_0xa570('0x18')]['attributes']||null:null,'limit':_0x25b5f7['options']?_0x25b5f7['options'][_0xa570('0x1a')]||null:null,'include':_0x25b5f7[_0xa570('0x18')]?_0x25b5f7[_0xa570('0x18')]['include']?_[_0xa570('0x1b')](_0x25b5f7[_0xa570('0x18')]['include'],function(_0x425ce3){return{'model':db[_0x425ce3[_0xa570('0x1c')]],'as':_0x425ce3['as'],'attributes':_0x425ce3['attributes'],'include':_0x425ce3['include']?_[_0xa570('0x1b')](_0x425ce3[_0xa570('0x1d')],function(_0xfd5175){return{'model':db[_0xfd5175[_0xa570('0x1c')]],'as':_0xfd5175['as'],'attributes':_0xfd5175[_0xa570('0x1e')],'include':_0xfd5175[_0xa570('0x1d')]?_[_0xa570('0x1b')](_0xfd5175[_0xa570('0x1d')],function(_0x21c992){return{'model':db[_0x21c992['model']],'as':_0x21c992['as'],'attributes':_0x21c992[_0xa570('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa570('0xb')](function(_0x3242f7){logger[_0xa570('0xc')]('GetSugarcrmAccount',_0x25b5f7);logger[_0xa570('0x1f')](_0xa570('0x15'),_0x25b5f7,JSON[_0xa570('0xf')](_0x3242f7));_0x549d7a(_0x3242f7);})[_0xa570('0x20')](function(_0x3de2d4){logger['error'](_0xa570('0x15'),_0x3de2d4['message'],_0x25b5f7);_0x4186dd(_0x49101d[_0xa570('0x10')](0x1f4,_0x3de2d4[_0xa570('0x12')]));});});};exports[_0xa570('0x21')]=function(_0x42cf47){var _0x5c6c98=this;return new Promise(function(_0x1a2fa7,_0x814d7d){return db['SugarcrmAccount'][_0xa570('0x22')]({'raw':_0x42cf47['options']?_0x42cf47['options']['raw']===undefined?!![]:![]:!![],'where':_0x42cf47[_0xa570('0x18')]?_0x42cf47[_0xa570('0x18')][_0xa570('0x19')]||null:null,'attributes':_0x42cf47['options']?_0x42cf47[_0xa570('0x18')]['attributes']||null:null,'include':_0x42cf47[_0xa570('0x18')]?_0x42cf47[_0xa570('0x18')][_0xa570('0x1d')]?_['map'](_0x42cf47[_0xa570('0x18')]['include'],function(_0x2ba294){return{'model':db[_0x2ba294[_0xa570('0x1c')]],'as':_0x2ba294['as'],'attributes':_0x2ba294[_0xa570('0x1e')],'include':_0x2ba294[_0xa570('0x1d')]?_['map'](_0x2ba294[_0xa570('0x1d')],function(_0x4a336d){return{'model':db[_0x4a336d[_0xa570('0x1c')]],'as':_0x4a336d['as'],'attributes':_0x4a336d['attributes'],'include':_0x4a336d['include']?_[_0xa570('0x1b')](_0x4a336d[_0xa570('0x1d')],function(_0x30a86a){return{'model':db[_0x30a86a['model']],'as':_0x30a86a['as'],'attributes':_0x30a86a[_0xa570('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c9145){logger[_0xa570('0xc')](_0xa570('0x21'),_0x42cf47);logger['debug'](_0xa570('0x21'),_0x42cf47,JSON[_0xa570('0xf')](_0x5c9145));_0x1a2fa7(_0x5c9145);})['catch'](function(_0x5107e4){logger[_0xa570('0x10')](_0xa570('0x21'),_0x5107e4[_0xa570('0x12')],_0x42cf47);_0x814d7d(_0x5c6c98[_0xa570('0x10')](0x1f4,_0x5107e4[_0xa570('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6a3bd13..32056e2 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 _0x4cb3=['/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index'];(function(_0x666eb9,_0x5a9e90){var _0x3fc80b=function(_0x4ec6ff){while(--_0x4ec6ff){_0x666eb9['push'](_0x666eb9['shift']());}};_0x3fc80b(++_0x5a9e90);}(_0x4cb3,0x17c));var _0x34cb=function(_0x79228d,_0x4ca6fc){_0x79228d=_0x79228d-0x0;var _0x240d9f=_0x4cb3[_0x79228d];return _0x240d9f;};'use strict';var multer=require('multer');var util=require(_0x34cb('0x0'));var path=require(_0x34cb('0x1'));var timeout=require(_0x34cb('0x2'));var express=require(_0x34cb('0x3'));var router=express[_0x34cb('0x4')]();var auth=require(_0x34cb('0x5'));var interaction=require(_0x34cb('0x6'));var config=require('../../config/environment');var controller=require(_0x34cb('0x7'));router[_0x34cb('0x8')]('/',auth[_0x34cb('0x9')](),controller[_0x34cb('0xa')]);router[_0x34cb('0x8')](_0x34cb('0xb'),auth[_0x34cb('0x9')](),controller[_0x34cb('0xc')]);router[_0x34cb('0x8')](_0x34cb('0xd'),auth['isAuthenticated'](),controller[_0x34cb('0xe')]);router[_0x34cb('0x8')]('/:id/subjects',auth[_0x34cb('0x9')](),controller[_0x34cb('0xf')]);router['get'](_0x34cb('0x10'),auth[_0x34cb('0x9')](),controller[_0x34cb('0x11')]);router['post']('/',auth[_0x34cb('0x9')](),controller[_0x34cb('0x12')]);router[_0x34cb('0x13')](_0x34cb('0xb'),auth[_0x34cb('0x9')](),controller['update']);router[_0x34cb('0x14')](_0x34cb('0xb'),auth[_0x34cb('0x9')](),controller[_0x34cb('0x15')]);module[_0x34cb('0x16')]=router; \ No newline at end of file +var _0x97d2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','put','/:id','update','delete','exports','util','connect-timeout','express','Router'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x97d2,0xac));var _0x297d=function(_0x11c46a,_0x40b0d2){_0x11c46a=_0x11c46a-0x0;var _0x1dbc13=_0x97d2[_0x11c46a];return _0x1dbc13;};'use strict';var multer=require('multer');var util=require(_0x297d('0x0'));var path=require('path');var timeout=require(_0x297d('0x1'));var express=require(_0x297d('0x2'));var router=express[_0x297d('0x3')]();var auth=require(_0x297d('0x4'));var interaction=require(_0x297d('0x5'));var config=require(_0x297d('0x6'));var controller=require(_0x297d('0x7'));router[_0x297d('0x8')]('/',auth[_0x297d('0x9')](),controller[_0x297d('0xa')]);router[_0x297d('0x8')]('/:id',auth[_0x297d('0x9')](),controller[_0x297d('0xb')]);router[_0x297d('0x8')](_0x297d('0xc'),auth[_0x297d('0x9')](),controller[_0x297d('0xd')]);router[_0x297d('0x8')](_0x297d('0xe'),auth[_0x297d('0x9')](),controller['getSubjects']);router[_0x297d('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x297d('0xf')]);router[_0x297d('0x10')]('/',auth[_0x297d('0x9')](),controller['create']);router[_0x297d('0x11')](_0x297d('0x12'),auth[_0x297d('0x9')](),controller[_0x297d('0x13')]);router[_0x297d('0x14')]('/:id',auth[_0x297d('0x9')](),controller['destroy']);module[_0x297d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e2ca860..33aaa9e 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 _0xe6b7=['STRING','sequelize','exports'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xe6b7,0x1cc));var _0x7e6b=function(_0x5bdc0f,_0xd2ca59){_0x5bdc0f=_0x5bdc0f-0x0;var _0x318e07=_0xe6b7[_0x5bdc0f];return _0x318e07;};'use strict';var Sequelize=require(_0x7e6b('0x0'));module[_0x7e6b('0x1')]={'name':{'type':Sequelize[_0x7e6b('0x2')]},'description':{'type':Sequelize[_0x7e6b('0x2')]}}; \ No newline at end of file +var _0x32b9=['sequelize','STRING'];(function(_0xdfc00a,_0x41c2a6){var _0x342edd=function(_0x1a6047){while(--_0x1a6047){_0xdfc00a['push'](_0xdfc00a['shift']());}};_0x342edd(++_0x41c2a6);}(_0x32b9,0x16c));var _0x932b=function(_0x4d3c59,_0x245104){_0x4d3c59=_0x4d3c59-0x0;var _0x230ada=_0x32b9[_0x4d3c59];return _0x230ada;};'use strict';var Sequelize=require(_0x932b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x932b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5cce4bd..8da0847 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 _0x893a=['http','test','Sequelize','ValidationError','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','update','destroy','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','client'];(function(_0x7d559,_0x4a4ad3){var _0x42b638=function(_0x172b82){while(--_0x172b82){_0x7d559['push'](_0x7d559['shift']());}};_0x42b638(++_0x4a4ad3);}(_0x893a,0x159));var _0xa893=function(_0x3947d2,_0x2b8242){_0x3947d2=_0x3947d2-0x0;var _0x2b8db1=_0x893a[_0x3947d2];return _0x2b8db1;};'use strict';var pdf=require(_0xa893('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa893('0x1'));var zipdir=require(_0xa893('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa893('0x3'));var moment=require(_0xa893('0x4'));var BPromise=require(_0xa893('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa893('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa893('0x7'));var fs=require('fs');var _=require(_0xa893('0x8'));var squel=require('squel');var crypto=require(_0xa893('0x9'));var jsforce=require(_0xa893('0xa'));var deskjs=require(_0xa893('0xb'));var toCsv=require(_0xa893('0xc'));var querystring=require(_0xa893('0xd'));var Papa=require(_0xa893('0xe'));var Redis=require('ioredis');var authService=require(_0xa893('0xf'));var qs=require(_0xa893('0x10'));var as=require(_0xa893('0x11'));var hardwareService=require(_0xa893('0x12'));var logger=require('../../config/logger')(_0xa893('0x13'));var utils=require(_0xa893('0x14'));var config=require(_0xa893('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa893('0x16')][_0xa893('0x17')]({'port':0x232a});function checkPasswordPattern(_0x22c43f,_0x5ac74c,_0x11601d){if(_0x11601d){var _0x3f2264=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f2264[_0xa893('0x18')](_0x5ac74c)){return _0x22c43f;}else{throw new db[(_0xa893('0x19'))][(_0xa893('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x22c43f;}}function respondWithRpcPromise(_0x1d2e06,_0x5924ad,_0x4ac8dd,_0x40151e){return new BPromise(function(_0x13e56d,_0x3f3d20){var _0x5682b0=_0x40151e||client;return _0x5682b0[_0xa893('0x1b')](_0x1d2e06,_0x4ac8dd)[_0xa893('0x1c')](function(_0x3acb72){logger[_0xa893('0x1d')](_0xa893('0x1e'),_0x5924ad,'request\x20sent');logger[_0xa893('0x1f')](_0xa893('0x20'),_0x5924ad,_0xa893('0x21'),JSON[_0xa893('0x22')](_0x3acb72));if(_0x3acb72[_0xa893('0x23')]){if(_0x3acb72[_0xa893('0x23')][_0xa893('0x24')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5924ad,_0x3acb72['error'][_0xa893('0x25')]);return _0x3f3d20(_0x3acb72['error']['message']);}logger[_0xa893('0x23')](_0xa893('0x1e'),_0x5924ad,_0x3acb72[_0xa893('0x23')][_0xa893('0x25')]);return _0x13e56d(_0x3acb72[_0xa893('0x23')][_0xa893('0x25')]);}else{logger[_0xa893('0x1d')](_0xa893('0x1e'),_0x5924ad,_0xa893('0x21'));_0x13e56d(_0x3acb72[_0xa893('0x26')][_0xa893('0x25')]);}})[_0xa893('0x27')](function(_0x562976){logger['error'](_0xa893('0x1e'),_0x5924ad,_0x562976);_0x3f3d20(_0x562976);});});}function respondWithStatusCode(_0x3b1338,_0x2d4dba){_0x2d4dba=_0x2d4dba||0xcc;return function(_0xd96dda){if(_0xd96dda){return _0x3b1338[_0xa893('0x28')](_0x2d4dba);}return _0x3b1338['status'](_0x2d4dba)[_0xa893('0x29')]();};}function respondWithResult(_0x29317c,_0x47aa93){_0x47aa93=_0x47aa93||0xc8;return function(_0x1661cc){if(_0x1661cc){return _0x29317c[_0xa893('0x2a')](_0x47aa93)[_0xa893('0x2b')](_0x1661cc);}};}function respondWithFilteredResult(_0x39212e,_0x22cfb4){return function(_0x4d0f0c){if(_0x4d0f0c){var _0x23b542=_0x4d0f0c[_0xa893('0x2c')],_0x5cfb1c=_0x22cfb4[_0xa893('0x2d')],_0x1f99dc=_0x22cfb4[_0xa893('0x2d')]+_0x22cfb4['limit'],_0x52cc42;if(_0x1f99dc>=_0x23b542){_0x1f99dc=_0x23b542;_0x52cc42=0xc8;}else{_0x52cc42=0xce;}_0x39212e['status'](_0x52cc42);return _0x39212e[_0xa893('0x2e')]('Content-Range',_0x5cfb1c+'-'+_0x1f99dc+'/'+_0x23b542)[_0xa893('0x2b')](_0x4d0f0c);}return null;};}function patchUpdates(_0x42c34b){return function(_0x5620e2){try{jsonpatch[_0xa893('0x2f')](_0x5620e2,_0x42c34b,!![]);}catch(_0x31dbfc){return BPromise['reject'](_0x31dbfc);}return _0x5620e2['save']();};}function saveUpdates(_0x2d263c,_0x38f84e){return function(_0x4e3a91){if(_0x4e3a91){return _0x4e3a91[_0xa893('0x30')](_0x2d263c)[_0xa893('0x1c')](function(_0x41ff30){return _0x41ff30;});}return null;};}function removeEntity(_0x4a5d35,_0x2ce189){return function(_0x183869){if(_0x183869){return _0x183869[_0xa893('0x31')]()[_0xa893('0x1c')](function(){_0x4a5d35[_0xa893('0x2a')](0xcc)[_0xa893('0x29')]();});}};}function handleEntityNotFound(_0x493ff2,_0x5773af){return function(_0x21a131){if(!_0x21a131){_0x493ff2[_0xa893('0x28')](0x194);}return _0x21a131;};}function handleError(_0x50367e,_0x36d51f){_0x36d51f=_0x36d51f||0x1f4;return function(_0x1d335a){logger[_0xa893('0x23')](_0x1d335a[_0xa893('0x32')]);if(_0x1d335a[_0xa893('0x33')]){delete _0x1d335a[_0xa893('0x33')];}_0x50367e[_0xa893('0x2a')](_0x36d51f)['send'](_0x1d335a);};}exports[_0xa893('0x34')]=function(_0x1b8672,_0x2e216f){var _0x3eed08={},_0x1e5296={},_0xd5f5f5={'count':0x0,'rows':[]};var _0x336726=_[_0xa893('0x35')](db['SugarcrmConfiguration']['rawAttributes'],function(_0xb36ab2){return{'name':_0xb36ab2[_0xa893('0x36')],'type':_0xb36ab2[_0xa893('0x37')][_0xa893('0x38')]};});_0x1e5296[_0xa893('0x39')]=_['map'](_0x336726,_0xa893('0x33'));_0x1e5296['query']=_[_0xa893('0x3a')](_0x1b8672[_0xa893('0x3b')]);_0x1e5296[_0xa893('0x3c')]=_[_0xa893('0x3d')](_0x1e5296[_0xa893('0x39')],_0x1e5296[_0xa893('0x3b')]);_0x3eed08[_0xa893('0x3e')]=_[_0xa893('0x3d')](_0x1e5296[_0xa893('0x39')],qs[_0xa893('0x3f')](_0x1b8672[_0xa893('0x3b')][_0xa893('0x3f')]));_0x3eed08['attributes']=_0x3eed08[_0xa893('0x3e')][_0xa893('0x40')]?_0x3eed08[_0xa893('0x3e')]:_0x1e5296[_0xa893('0x39')];if(!_0x1b8672[_0xa893('0x3b')]['hasOwnProperty']('nolimit')){_0x3eed08[_0xa893('0x41')]=qs['limit'](_0x1b8672['query'][_0xa893('0x41')]);_0x3eed08[_0xa893('0x2d')]=qs['offset'](_0x1b8672[_0xa893('0x3b')][_0xa893('0x2d')]);}_0x3eed08[_0xa893('0x42')]=qs[_0xa893('0x43')](_0x1b8672[_0xa893('0x3b')][_0xa893('0x43')]);_0x3eed08[_0xa893('0x44')]=qs[_0xa893('0x3c')](_[_0xa893('0x45')](_0x1b8672[_0xa893('0x3b')],_0x1e5296['filters']),_0x336726);if(_0x1b8672[_0xa893('0x3b')]['filter']){_0x3eed08[_0xa893('0x44')]=_[_0xa893('0x46')](_0x3eed08[_0xa893('0x44')],{'$or':_['map'](_0x336726,function(_0xa20a79){if(_0xa20a79['type']!==_0xa893('0x47')){var _0x5a7f55={};_0x5a7f55[_0xa20a79[_0xa893('0x33')]]={'$like':'%'+_0x1b8672[_0xa893('0x3b')][_0xa893('0x48')]+'%'};return _0x5a7f55;}})});}_0x3eed08=_['merge']({},_0x3eed08,_0x1b8672[_0xa893('0x49')]);var _0x3a8cb1={'where':_0x3eed08[_0xa893('0x44')]};return db[_0xa893('0x4a')][_0xa893('0x2c')](_0x3a8cb1)[_0xa893('0x1c')](function(_0x1c3b58){_0xd5f5f5[_0xa893('0x2c')]=_0x1c3b58;if(_0x1b8672[_0xa893('0x3b')][_0xa893('0x4b')]){_0x3eed08[_0xa893('0x4c')]=[{'all':!![]}];}return db[_0xa893('0x4a')][_0xa893('0x4d')](_0x3eed08);})['then'](function(_0x31b991){_0xd5f5f5[_0xa893('0x4e')]=_0x31b991;return _0xd5f5f5;})[_0xa893('0x1c')](respondWithFilteredResult(_0x2e216f,_0x3eed08))[_0xa893('0x27')](handleError(_0x2e216f,null));};exports[_0xa893('0x4f')]=function(_0x50bcff,_0x20989d){var _0x24ad4f={'raw':![],'where':{'id':_0x50bcff[_0xa893('0x50')]['id']}},_0x295cd4={};_0x295cd4[_0xa893('0x39')]=_[_0xa893('0x3a')](db[_0xa893('0x4a')][_0xa893('0x51')]);_0x295cd4['query']=_['keys'](_0x50bcff[_0xa893('0x3b')]);_0x295cd4[_0xa893('0x3c')]=_['intersection'](_0x295cd4['model'],_0x295cd4[_0xa893('0x3b')]);_0x24ad4f[_0xa893('0x3e')]=_[_0xa893('0x3d')](_0x295cd4['model'],qs['fields'](_0x50bcff['query']['fields']));_0x24ad4f['attributes']=_0x24ad4f[_0xa893('0x3e')][_0xa893('0x40')]?_0x24ad4f[_0xa893('0x3e')]:_0x295cd4[_0xa893('0x39')];if(_0x50bcff['query'][_0xa893('0x4b')]){_0x24ad4f[_0xa893('0x4c')]=[{'all':!![]}];}_0x24ad4f=_['merge']({},_0x24ad4f,_0x50bcff[_0xa893('0x49')]);return db[_0xa893('0x4a')][_0xa893('0x52')](_0x24ad4f)[_0xa893('0x1c')](handleEntityNotFound(_0x20989d,null))['then'](respondWithResult(_0x20989d,null))[_0xa893('0x27')](handleError(_0x20989d,null));};exports[_0xa893('0x53')]=function(_0x3f048d,_0x4b041d){return db[_0xa893('0x4a')][_0xa893('0x53')](_0x3f048d[_0xa893('0x54')],{})[_0xa893('0x1c')](respondWithResult(_0x4b041d,0xc9))[_0xa893('0x27')](handleError(_0x4b041d,null));};exports[_0xa893('0x30')]=function(_0x259520,_0x2a07ac){if(_0x259520[_0xa893('0x54')]['id']){delete _0x259520['body']['id'];}return db[_0xa893('0x4a')][_0xa893('0x52')]({'where':{'id':_0x259520[_0xa893('0x50')]['id']}})[_0xa893('0x1c')](handleEntityNotFound(_0x2a07ac,null))['then'](saveUpdates(_0x259520['body'],null))['then'](respondWithResult(_0x2a07ac,null))['catch'](handleError(_0x2a07ac,null));};exports[_0xa893('0x31')]=function(_0x28e2f8,_0x40c7fc){return db[_0xa893('0x4a')]['find']({'where':{'id':_0x28e2f8['params']['id']}})[_0xa893('0x1c')](handleEntityNotFound(_0x40c7fc,null))[_0xa893('0x1c')](removeEntity(_0x40c7fc,null))[_0xa893('0x27')](handleError(_0x40c7fc,null));};exports[_0xa893('0x55')]=function(_0x205464,_0x514f0c,_0x1d0e23){var _0x4d9683={};var _0x2ef0c3={};var _0x43ae33;var _0x2a820e;return db['SugarcrmConfiguration'][_0xa893('0x56')]({'where':{'id':_0x205464[_0xa893('0x50')]['id']}})[_0xa893('0x1c')](handleEntityNotFound(_0x514f0c,null))[_0xa893('0x1c')](function(_0x46a0c4){if(_0x46a0c4){_0x43ae33=_0x46a0c4;_0x2ef0c3[_0xa893('0x39')]=_['keys'](db[_0xa893('0x57')]['rawAttributes']);_0x2ef0c3[_0xa893('0x3b')]=_[_0xa893('0x3a')](_0x205464[_0xa893('0x3b')]);_0x2ef0c3[_0xa893('0x3c')]=_[_0xa893('0x3d')](_0x2ef0c3[_0xa893('0x39')],_0x2ef0c3[_0xa893('0x3b')]);_0x4d9683[_0xa893('0x3e')]=_[_0xa893('0x3d')](_0x2ef0c3[_0xa893('0x39')],qs[_0xa893('0x3f')](_0x205464['query'][_0xa893('0x3f')]));_0x4d9683['attributes']=_0x4d9683[_0xa893('0x3e')][_0xa893('0x40')]?_0x4d9683['attributes']:_0x2ef0c3[_0xa893('0x39')];_0x4d9683[_0xa893('0x42')]=qs[_0xa893('0x43')](_0x205464[_0xa893('0x3b')]['sort']);_0x4d9683['where']=qs[_0xa893('0x3c')](_[_0xa893('0x45')](_0x205464[_0xa893('0x3b')],_0x2ef0c3[_0xa893('0x3c')]));if(_0x205464[_0xa893('0x3b')]['filter']){_0x4d9683[_0xa893('0x44')]=_[_0xa893('0x46')](_0x4d9683[_0xa893('0x44')],{'$or':_[_0xa893('0x35')](_0x4d9683[_0xa893('0x3e')],function(_0x385b9a){var _0x2dffda={};_0x2dffda[_0x385b9a]={'$like':'%'+_0x205464['query'][_0xa893('0x48')]+'%'};return _0x2dffda;})});}_0x4d9683=_[_0xa893('0x46')]({},_0x4d9683,_0x205464[_0xa893('0x49')]);return _0x43ae33['getFields'](_0x4d9683);}})['then'](function(_0x3b579c){if(_0x3b579c){_0x2a820e=_0x3b579c[_0xa893('0x40')];if(!_0x205464[_0xa893('0x3b')][_0xa893('0x58')](_0xa893('0x59'))){_0x4d9683[_0xa893('0x41')]=qs['limit'](_0x205464[_0xa893('0x3b')][_0xa893('0x41')]);_0x4d9683['offset']=qs['offset'](_0x205464[_0xa893('0x3b')][_0xa893('0x2d')]);}return _0x43ae33[_0xa893('0x55')](_0x4d9683);}})[_0xa893('0x1c')](function(_0xd289b2){if(_0xd289b2){return _0xd289b2?{'count':_0x2a820e,'rows':_0xd289b2}:null;}})[_0xa893('0x1c')](respondWithResult(_0x514f0c,null))[_0xa893('0x27')](handleError(_0x514f0c,null));};exports[_0xa893('0x5a')]=function(_0x322fc5,_0x3d9e1a,_0x3c572c){var _0x5e8f6d={};var _0x27818a={};var _0x1295d8;var _0x4eaac4;return db[_0xa893('0x4a')][_0xa893('0x56')]({'where':{'id':_0x322fc5[_0xa893('0x50')]['id']}})[_0xa893('0x1c')](handleEntityNotFound(_0x3d9e1a,null))['then'](function(_0x488b0c){if(_0x488b0c){_0x1295d8=_0x488b0c;_0x27818a[_0xa893('0x39')]=_['keys'](db[_0xa893('0x57')][_0xa893('0x51')]);_0x27818a[_0xa893('0x3b')]=_['keys'](_0x322fc5['query']);_0x27818a['filters']=_[_0xa893('0x3d')](_0x27818a[_0xa893('0x39')],_0x27818a[_0xa893('0x3b')]);_0x5e8f6d['attributes']=_['intersection'](_0x27818a[_0xa893('0x39')],qs[_0xa893('0x3f')](_0x322fc5[_0xa893('0x3b')]['fields']));_0x5e8f6d[_0xa893('0x3e')]=_0x5e8f6d[_0xa893('0x3e')][_0xa893('0x40')]?_0x5e8f6d[_0xa893('0x3e')]:_0x27818a['model'];_0x5e8f6d[_0xa893('0x42')]=qs[_0xa893('0x43')](_0x322fc5[_0xa893('0x3b')][_0xa893('0x43')]);_0x5e8f6d['where']=qs[_0xa893('0x3c')](_['pick'](_0x322fc5[_0xa893('0x3b')],_0x27818a['filters']));if(_0x322fc5[_0xa893('0x3b')]['filter']){_0x5e8f6d[_0xa893('0x44')]=_['merge'](_0x5e8f6d[_0xa893('0x44')],{'$or':_[_0xa893('0x35')](_0x5e8f6d[_0xa893('0x3e')],function(_0x7d8246){var _0x5a23a1={};_0x5a23a1[_0x7d8246]={'$like':'%'+_0x322fc5[_0xa893('0x3b')][_0xa893('0x48')]+'%'};return _0x5a23a1;})});}_0x5e8f6d=_[_0xa893('0x46')]({},_0x5e8f6d,_0x322fc5[_0xa893('0x49')]);return _0x1295d8[_0xa893('0x5a')](_0x5e8f6d);}})[_0xa893('0x1c')](function(_0x4cb316){if(_0x4cb316){_0x4eaac4=_0x4cb316[_0xa893('0x40')];if(!_0x322fc5[_0xa893('0x3b')][_0xa893('0x58')]('nolimit')){_0x5e8f6d[_0xa893('0x41')]=qs[_0xa893('0x41')](_0x322fc5[_0xa893('0x3b')][_0xa893('0x41')]);_0x5e8f6d[_0xa893('0x2d')]=qs['offset'](_0x322fc5[_0xa893('0x3b')][_0xa893('0x2d')]);}return _0x1295d8[_0xa893('0x5a')](_0x5e8f6d);}})[_0xa893('0x1c')](function(_0x5f1890){if(_0x5f1890){return _0x5f1890?{'count':_0x4eaac4,'rows':_0x5f1890}:null;}})[_0xa893('0x1c')](respondWithResult(_0x3d9e1a,null))[_0xa893('0x27')](handleError(_0x3d9e1a,null));};exports[_0xa893('0x5b')]=function(_0x49d7b2,_0x26f0f2,_0xd411bd){var _0x327956={};var _0x3c8afd={};var _0x1144a9;var _0x28112c;return db['SugarcrmConfiguration'][_0xa893('0x56')]({'where':{'id':_0x49d7b2['params']['id']}})[_0xa893('0x1c')](handleEntityNotFound(_0x26f0f2,null))[_0xa893('0x1c')](function(_0x1cc7cf){if(_0x1cc7cf){_0x1144a9=_0x1cc7cf;_0x3c8afd[_0xa893('0x39')]=_['keys'](db['SugarcrmField'][_0xa893('0x51')]);_0x3c8afd[_0xa893('0x3b')]=_['keys'](_0x49d7b2['query']);_0x3c8afd[_0xa893('0x3c')]=_[_0xa893('0x3d')](_0x3c8afd[_0xa893('0x39')],_0x3c8afd[_0xa893('0x3b')]);_0x327956[_0xa893('0x3e')]=_[_0xa893('0x3d')](_0x3c8afd[_0xa893('0x39')],qs[_0xa893('0x3f')](_0x49d7b2[_0xa893('0x3b')][_0xa893('0x3f')]));_0x327956['attributes']=_0x327956['attributes'][_0xa893('0x40')]?_0x327956[_0xa893('0x3e')]:_0x3c8afd['model'];_0x327956['order']=qs[_0xa893('0x43')](_0x49d7b2[_0xa893('0x3b')][_0xa893('0x43')]);_0x327956[_0xa893('0x44')]=qs[_0xa893('0x3c')](_[_0xa893('0x45')](_0x49d7b2[_0xa893('0x3b')],_0x3c8afd['filters']));if(_0x49d7b2[_0xa893('0x3b')][_0xa893('0x48')]){_0x327956[_0xa893('0x44')]=_['merge'](_0x327956[_0xa893('0x44')],{'$or':_[_0xa893('0x35')](_0x327956[_0xa893('0x3e')],function(_0x1269d5){var _0x4fc1c5={};_0x4fc1c5[_0x1269d5]={'$like':'%'+_0x49d7b2[_0xa893('0x3b')][_0xa893('0x48')]+'%'};return _0x4fc1c5;})});}_0x327956=_[_0xa893('0x46')]({},_0x327956,_0x49d7b2[_0xa893('0x49')]);return _0x1144a9['getDescriptions'](_0x327956);}})[_0xa893('0x1c')](function(_0xbc7d11){if(_0xbc7d11){_0x28112c=_0xbc7d11[_0xa893('0x40')];if(!_0x49d7b2[_0xa893('0x3b')]['hasOwnProperty'](_0xa893('0x59'))){_0x327956['limit']=qs[_0xa893('0x41')](_0x49d7b2['query']['limit']);_0x327956['offset']=qs[_0xa893('0x2d')](_0x49d7b2[_0xa893('0x3b')][_0xa893('0x2d')]);}return _0x1144a9[_0xa893('0x5b')](_0x327956);}})[_0xa893('0x1c')](function(_0x5c3091){if(_0x5c3091){return _0x5c3091?{'count':_0x28112c,'rows':_0x5c3091}:null;}})[_0xa893('0x1c')](respondWithResult(_0x26f0f2,null))[_0xa893('0x27')](handleError(_0x26f0f2,null));}; \ No newline at end of file +var _0x92d9=['include','options','find','create','body','getFields','SugarcrmField','hasOwnProperty','getSubjects','findOne','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','test','ValidationError','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','params','includeAll'];(function(_0x19a04f,_0x5c82d){var _0x42a09=function(_0x163c49){while(--_0x163c49){_0x19a04f['push'](_0x19a04f['shift']());}};_0x42a09(++_0x5c82d);}(_0x92d9,0x67));var _0x992d=function(_0x477d46,_0x199226){_0x477d46=_0x477d46-0x0;var _0x46edc4=_0x92d9[_0x477d46];return _0x46edc4;};'use strict';var pdf=require(_0x992d('0x0'));var emlformat=require(_0x992d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x992d('0x2'));var jsonpatch=require(_0x992d('0x3'));var rp=require(_0x992d('0x4'));var moment=require(_0x992d('0x5'));var BPromise=require(_0x992d('0x6'));var Mustache=require(_0x992d('0x7'));var util=require(_0x992d('0x8'));var path=require(_0x992d('0x9'));var sox=require(_0x992d('0xa'));var csv=require('to-csv');var ejs=require(_0x992d('0xb'));var fs=require('fs');var _=require(_0x992d('0xc'));var squel=require('squel');var crypto=require(_0x992d('0xd'));var jsforce=require(_0x992d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x992d('0xf'));var querystring=require(_0x992d('0x10'));var Papa=require(_0x992d('0x11'));var Redis=require('ioredis');var authService=require(_0x992d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x992d('0x13'));var hardwareService=require(_0x992d('0x14'));var logger=require(_0x992d('0x15'))(_0x992d('0x16'));var utils=require('../../config/utils');var config=require(_0x992d('0x17'));var db=require(_0x992d('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x992d('0x19')][_0x992d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ad65d,_0x32b07c,_0x2cd5a0){if(_0x2cd5a0){var _0x3a3255=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a3255[_0x992d('0x1b')](_0x32b07c)){return _0x3ad65d;}else{throw new db['Sequelize'][(_0x992d('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ad65d;}}function respondWithRpcPromise(_0x351e16,_0x50f751,_0x32ba1c,_0x47e489){return new BPromise(function(_0x193dc0,_0x579aa4){var _0x32be7b=_0x47e489||client;return _0x32be7b[_0x992d('0x1d')](_0x351e16,_0x32ba1c)[_0x992d('0x1e')](function(_0x1ebcc5){logger[_0x992d('0x1f')](_0x992d('0x20'),_0x50f751,_0x992d('0x21'));logger['debug'](_0x992d('0x22'),_0x50f751,_0x992d('0x21'),JSON['stringify'](_0x1ebcc5));if(_0x1ebcc5[_0x992d('0x23')]){if(_0x1ebcc5['error'][_0x992d('0x24')]===0x1f4){logger[_0x992d('0x23')](_0x992d('0x20'),_0x50f751,_0x1ebcc5['error'][_0x992d('0x25')]);return _0x579aa4(_0x1ebcc5[_0x992d('0x23')][_0x992d('0x25')]);}logger[_0x992d('0x23')](_0x992d('0x20'),_0x50f751,_0x1ebcc5[_0x992d('0x23')][_0x992d('0x25')]);return _0x193dc0(_0x1ebcc5['error'][_0x992d('0x25')]);}else{logger[_0x992d('0x1f')](_0x992d('0x20'),_0x50f751,'request\x20sent');_0x193dc0(_0x1ebcc5[_0x992d('0x26')][_0x992d('0x25')]);}})[_0x992d('0x27')](function(_0x175a4d){logger[_0x992d('0x23')](_0x992d('0x20'),_0x50f751,_0x175a4d);_0x579aa4(_0x175a4d);});});}function respondWithStatusCode(_0x4c9bf9,_0x167e8d){_0x167e8d=_0x167e8d||0xcc;return function(_0x11382e){if(_0x11382e){return _0x4c9bf9[_0x992d('0x28')](_0x167e8d);}return _0x4c9bf9['status'](_0x167e8d)[_0x992d('0x29')]();};}function respondWithResult(_0x45ff56,_0x4558c1){_0x4558c1=_0x4558c1||0xc8;return function(_0xd5f683){if(_0xd5f683){return _0x45ff56[_0x992d('0x2a')](_0x4558c1)[_0x992d('0x2b')](_0xd5f683);}};}function respondWithFilteredResult(_0x1c6da0,_0x15ff06){return function(_0x42ff40){if(_0x42ff40){var _0x21f80a=_0x42ff40[_0x992d('0x2c')],_0x32ed23=_0x15ff06[_0x992d('0x2d')],_0x5816e4=_0x15ff06[_0x992d('0x2d')]+_0x15ff06[_0x992d('0x2e')],_0x467a26;if(_0x5816e4>=_0x21f80a){_0x5816e4=_0x21f80a;_0x467a26=0xc8;}else{_0x467a26=0xce;}_0x1c6da0[_0x992d('0x2a')](_0x467a26);return _0x1c6da0[_0x992d('0x2f')]('Content-Range',_0x32ed23+'-'+_0x5816e4+'/'+_0x21f80a)[_0x992d('0x2b')](_0x42ff40);}return null;};}function patchUpdates(_0x5bbdef){return function(_0x2056d2){try{jsonpatch[_0x992d('0x30')](_0x2056d2,_0x5bbdef,!![]);}catch(_0x465f0e){return BPromise['reject'](_0x465f0e);}return _0x2056d2[_0x992d('0x31')]();};}function saveUpdates(_0x4c801a,_0x4a604c){return function(_0x47a7c5){if(_0x47a7c5){return _0x47a7c5[_0x992d('0x32')](_0x4c801a)[_0x992d('0x1e')](function(_0x2aa2ab){return _0x2aa2ab;});}return null;};}function removeEntity(_0x47c9e0,_0x7ea768){return function(_0x4e449c){if(_0x4e449c){return _0x4e449c[_0x992d('0x33')]()[_0x992d('0x1e')](function(){_0x47c9e0[_0x992d('0x2a')](0xcc)[_0x992d('0x29')]();});}};}function handleEntityNotFound(_0x54ad28,_0x46963f){return function(_0x3e2463){if(!_0x3e2463){_0x54ad28[_0x992d('0x28')](0x194);}return _0x3e2463;};}function handleError(_0x2e1fd7,_0x2e6304){_0x2e6304=_0x2e6304||0x1f4;return function(_0x2492a8){logger[_0x992d('0x23')](_0x2492a8[_0x992d('0x34')]);if(_0x2492a8[_0x992d('0x35')]){delete _0x2492a8[_0x992d('0x35')];}_0x2e1fd7['status'](_0x2e6304)[_0x992d('0x36')](_0x2492a8);};}exports['index']=function(_0x494b01,_0x422d0c){var _0x148780={},_0x9d17d6={},_0x5cdde7={'count':0x0,'rows':[]};var _0x5eccbb=_[_0x992d('0x37')](db[_0x992d('0x38')][_0x992d('0x39')],function(_0x32b253){return{'name':_0x32b253[_0x992d('0x3a')],'type':_0x32b253[_0x992d('0x3b')][_0x992d('0x3c')]};});_0x9d17d6[_0x992d('0x3d')]=_['map'](_0x5eccbb,_0x992d('0x35'));_0x9d17d6[_0x992d('0x3e')]=_[_0x992d('0x3f')](_0x494b01[_0x992d('0x3e')]);_0x9d17d6[_0x992d('0x40')]=_[_0x992d('0x41')](_0x9d17d6['model'],_0x9d17d6[_0x992d('0x3e')]);_0x148780[_0x992d('0x42')]=_[_0x992d('0x41')](_0x9d17d6[_0x992d('0x3d')],qs[_0x992d('0x43')](_0x494b01[_0x992d('0x3e')][_0x992d('0x43')]));_0x148780['attributes']=_0x148780[_0x992d('0x42')][_0x992d('0x44')]?_0x148780[_0x992d('0x42')]:_0x9d17d6['model'];if(!_0x494b01[_0x992d('0x3e')]['hasOwnProperty'](_0x992d('0x45'))){_0x148780[_0x992d('0x2e')]=qs[_0x992d('0x2e')](_0x494b01['query'][_0x992d('0x2e')]);_0x148780[_0x992d('0x2d')]=qs[_0x992d('0x2d')](_0x494b01[_0x992d('0x3e')][_0x992d('0x2d')]);}_0x148780[_0x992d('0x46')]=qs[_0x992d('0x47')](_0x494b01[_0x992d('0x3e')][_0x992d('0x47')]);_0x148780[_0x992d('0x48')]=qs[_0x992d('0x40')](_[_0x992d('0x49')](_0x494b01[_0x992d('0x3e')],_0x9d17d6[_0x992d('0x40')]),_0x5eccbb);if(_0x494b01[_0x992d('0x3e')][_0x992d('0x4a')]){_0x148780[_0x992d('0x48')]=_[_0x992d('0x4b')](_0x148780[_0x992d('0x48')],{'$or':_[_0x992d('0x37')](_0x5eccbb,function(_0x532ba3){if(_0x532ba3['type']!==_0x992d('0x4c')){var _0x5659ee={};_0x5659ee[_0x532ba3[_0x992d('0x35')]]={'$like':'%'+_0x494b01[_0x992d('0x3e')]['filter']+'%'};return _0x5659ee;}})});}_0x148780=_[_0x992d('0x4b')]({},_0x148780,_0x494b01['options']);var _0x2f9c5e={'where':_0x148780[_0x992d('0x48')]};return db[_0x992d('0x38')]['count'](_0x2f9c5e)[_0x992d('0x1e')](function(_0xc6343f){_0x5cdde7[_0x992d('0x2c')]=_0xc6343f;if(_0x494b01[_0x992d('0x3e')]['includeAll']){_0x148780['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x992d('0x4d')](_0x148780);})[_0x992d('0x1e')](function(_0x43b76c){_0x5cdde7[_0x992d('0x4e')]=_0x43b76c;return _0x5cdde7;})['then'](respondWithFilteredResult(_0x422d0c,_0x148780))['catch'](handleError(_0x422d0c,null));};exports['show']=function(_0x31a951,_0x1b69c7){var _0x20cacd={'raw':![],'where':{'id':_0x31a951[_0x992d('0x4f')]['id']}},_0x50858f={};_0x50858f[_0x992d('0x3d')]=_[_0x992d('0x3f')](db[_0x992d('0x38')][_0x992d('0x39')]);_0x50858f['query']=_[_0x992d('0x3f')](_0x31a951['query']);_0x50858f['filters']=_[_0x992d('0x41')](_0x50858f['model'],_0x50858f[_0x992d('0x3e')]);_0x20cacd['attributes']=_[_0x992d('0x41')](_0x50858f[_0x992d('0x3d')],qs[_0x992d('0x43')](_0x31a951[_0x992d('0x3e')]['fields']));_0x20cacd[_0x992d('0x42')]=_0x20cacd[_0x992d('0x42')][_0x992d('0x44')]?_0x20cacd['attributes']:_0x50858f['model'];if(_0x31a951[_0x992d('0x3e')][_0x992d('0x50')]){_0x20cacd[_0x992d('0x51')]=[{'all':!![]}];}_0x20cacd=_['merge']({},_0x20cacd,_0x31a951[_0x992d('0x52')]);return db[_0x992d('0x38')][_0x992d('0x53')](_0x20cacd)['then'](handleEntityNotFound(_0x1b69c7,null))['then'](respondWithResult(_0x1b69c7,null))[_0x992d('0x27')](handleError(_0x1b69c7,null));};exports[_0x992d('0x54')]=function(_0x16ca53,_0x2a4782){return db[_0x992d('0x38')][_0x992d('0x54')](_0x16ca53[_0x992d('0x55')],{})[_0x992d('0x1e')](respondWithResult(_0x2a4782,0xc9))[_0x992d('0x27')](handleError(_0x2a4782,null));};exports[_0x992d('0x32')]=function(_0x1d6355,_0x3b0076){if(_0x1d6355[_0x992d('0x55')]['id']){delete _0x1d6355[_0x992d('0x55')]['id'];}return db[_0x992d('0x38')]['find']({'where':{'id':_0x1d6355[_0x992d('0x4f')]['id']}})[_0x992d('0x1e')](handleEntityNotFound(_0x3b0076,null))[_0x992d('0x1e')](saveUpdates(_0x1d6355[_0x992d('0x55')],null))[_0x992d('0x1e')](respondWithResult(_0x3b0076,null))['catch'](handleError(_0x3b0076,null));};exports[_0x992d('0x33')]=function(_0x37d5d0,_0x293526){return db['SugarcrmConfiguration'][_0x992d('0x53')]({'where':{'id':_0x37d5d0[_0x992d('0x4f')]['id']}})[_0x992d('0x1e')](handleEntityNotFound(_0x293526,null))[_0x992d('0x1e')](removeEntity(_0x293526,null))['catch'](handleError(_0x293526,null));};exports[_0x992d('0x56')]=function(_0x317740,_0x4c1b0b,_0x4e3fb3){var _0x18c6ea={};var _0x51a4bf={};var _0x41a01c;var _0x26edf6;return db[_0x992d('0x38')]['findOne']({'where':{'id':_0x317740['params']['id']}})['then'](handleEntityNotFound(_0x4c1b0b,null))['then'](function(_0x4c111d){if(_0x4c111d){_0x41a01c=_0x4c111d;_0x51a4bf['model']=_[_0x992d('0x3f')](db[_0x992d('0x57')]['rawAttributes']);_0x51a4bf[_0x992d('0x3e')]=_[_0x992d('0x3f')](_0x317740['query']);_0x51a4bf[_0x992d('0x40')]=_[_0x992d('0x41')](_0x51a4bf[_0x992d('0x3d')],_0x51a4bf['query']);_0x18c6ea[_0x992d('0x42')]=_['intersection'](_0x51a4bf[_0x992d('0x3d')],qs[_0x992d('0x43')](_0x317740[_0x992d('0x3e')][_0x992d('0x43')]));_0x18c6ea[_0x992d('0x42')]=_0x18c6ea[_0x992d('0x42')][_0x992d('0x44')]?_0x18c6ea[_0x992d('0x42')]:_0x51a4bf[_0x992d('0x3d')];_0x18c6ea[_0x992d('0x46')]=qs[_0x992d('0x47')](_0x317740[_0x992d('0x3e')][_0x992d('0x47')]);_0x18c6ea[_0x992d('0x48')]=qs[_0x992d('0x40')](_[_0x992d('0x49')](_0x317740[_0x992d('0x3e')],_0x51a4bf[_0x992d('0x40')]));if(_0x317740[_0x992d('0x3e')][_0x992d('0x4a')]){_0x18c6ea[_0x992d('0x48')]=_[_0x992d('0x4b')](_0x18c6ea[_0x992d('0x48')],{'$or':_['map'](_0x18c6ea['attributes'],function(_0x31cc74){var _0xea7b22={};_0xea7b22[_0x31cc74]={'$like':'%'+_0x317740[_0x992d('0x3e')]['filter']+'%'};return _0xea7b22;})});}_0x18c6ea=_[_0x992d('0x4b')]({},_0x18c6ea,_0x317740[_0x992d('0x52')]);return _0x41a01c[_0x992d('0x56')](_0x18c6ea);}})['then'](function(_0xe71c4f){if(_0xe71c4f){_0x26edf6=_0xe71c4f[_0x992d('0x44')];if(!_0x317740['query'][_0x992d('0x58')](_0x992d('0x45'))){_0x18c6ea[_0x992d('0x2e')]=qs[_0x992d('0x2e')](_0x317740[_0x992d('0x3e')]['limit']);_0x18c6ea[_0x992d('0x2d')]=qs['offset'](_0x317740[_0x992d('0x3e')][_0x992d('0x2d')]);}return _0x41a01c[_0x992d('0x56')](_0x18c6ea);}})[_0x992d('0x1e')](function(_0x1d1dd1){if(_0x1d1dd1){return _0x1d1dd1?{'count':_0x26edf6,'rows':_0x1d1dd1}:null;}})[_0x992d('0x1e')](respondWithResult(_0x4c1b0b,null))[_0x992d('0x27')](handleError(_0x4c1b0b,null));};exports[_0x992d('0x59')]=function(_0x4c36e6,_0x26595d,_0x51181d){var _0xe5ce42={};var _0x3fa76f={};var _0x58652d;var _0x4300fd;return db[_0x992d('0x38')][_0x992d('0x5a')]({'where':{'id':_0x4c36e6[_0x992d('0x4f')]['id']}})[_0x992d('0x1e')](handleEntityNotFound(_0x26595d,null))['then'](function(_0x321f42){if(_0x321f42){_0x58652d=_0x321f42;_0x3fa76f[_0x992d('0x3d')]=_[_0x992d('0x3f')](db[_0x992d('0x57')]['rawAttributes']);_0x3fa76f['query']=_['keys'](_0x4c36e6[_0x992d('0x3e')]);_0x3fa76f[_0x992d('0x40')]=_[_0x992d('0x41')](_0x3fa76f['model'],_0x3fa76f[_0x992d('0x3e')]);_0xe5ce42[_0x992d('0x42')]=_['intersection'](_0x3fa76f[_0x992d('0x3d')],qs[_0x992d('0x43')](_0x4c36e6[_0x992d('0x3e')][_0x992d('0x43')]));_0xe5ce42[_0x992d('0x42')]=_0xe5ce42['attributes'][_0x992d('0x44')]?_0xe5ce42[_0x992d('0x42')]:_0x3fa76f[_0x992d('0x3d')];_0xe5ce42[_0x992d('0x46')]=qs[_0x992d('0x47')](_0x4c36e6[_0x992d('0x3e')]['sort']);_0xe5ce42[_0x992d('0x48')]=qs[_0x992d('0x40')](_[_0x992d('0x49')](_0x4c36e6[_0x992d('0x3e')],_0x3fa76f[_0x992d('0x40')]));if(_0x4c36e6[_0x992d('0x3e')]['filter']){_0xe5ce42[_0x992d('0x48')]=_[_0x992d('0x4b')](_0xe5ce42[_0x992d('0x48')],{'$or':_[_0x992d('0x37')](_0xe5ce42[_0x992d('0x42')],function(_0x5b96fc){var _0x1bd346={};_0x1bd346[_0x5b96fc]={'$like':'%'+_0x4c36e6[_0x992d('0x3e')][_0x992d('0x4a')]+'%'};return _0x1bd346;})});}_0xe5ce42=_[_0x992d('0x4b')]({},_0xe5ce42,_0x4c36e6[_0x992d('0x52')]);return _0x58652d[_0x992d('0x59')](_0xe5ce42);}})[_0x992d('0x1e')](function(_0x4316ea){if(_0x4316ea){_0x4300fd=_0x4316ea[_0x992d('0x44')];if(!_0x4c36e6[_0x992d('0x3e')]['hasOwnProperty'](_0x992d('0x45'))){_0xe5ce42[_0x992d('0x2e')]=qs[_0x992d('0x2e')](_0x4c36e6[_0x992d('0x3e')][_0x992d('0x2e')]);_0xe5ce42['offset']=qs[_0x992d('0x2d')](_0x4c36e6[_0x992d('0x3e')]['offset']);}return _0x58652d[_0x992d('0x59')](_0xe5ce42);}})[_0x992d('0x1e')](function(_0x550e65){if(_0x550e65){return _0x550e65?{'count':_0x4300fd,'rows':_0x550e65}:null;}})[_0x992d('0x1e')](respondWithResult(_0x26595d,null))[_0x992d('0x27')](handleError(_0x26595d,null));};exports[_0x992d('0x5b')]=function(_0xf32e44,_0x178844,_0x25ad5d){var _0x2bb2c6={};var _0x369003={};var _0x5952da;var _0x598b55;return db['SugarcrmConfiguration'][_0x992d('0x5a')]({'where':{'id':_0xf32e44['params']['id']}})[_0x992d('0x1e')](handleEntityNotFound(_0x178844,null))[_0x992d('0x1e')](function(_0x2c5ea2){if(_0x2c5ea2){_0x5952da=_0x2c5ea2;_0x369003[_0x992d('0x3d')]=_[_0x992d('0x3f')](db['SugarcrmField'][_0x992d('0x39')]);_0x369003['query']=_[_0x992d('0x3f')](_0xf32e44[_0x992d('0x3e')]);_0x369003['filters']=_[_0x992d('0x41')](_0x369003[_0x992d('0x3d')],_0x369003['query']);_0x2bb2c6[_0x992d('0x42')]=_[_0x992d('0x41')](_0x369003[_0x992d('0x3d')],qs[_0x992d('0x43')](_0xf32e44['query']['fields']));_0x2bb2c6[_0x992d('0x42')]=_0x2bb2c6[_0x992d('0x42')][_0x992d('0x44')]?_0x2bb2c6[_0x992d('0x42')]:_0x369003['model'];_0x2bb2c6[_0x992d('0x46')]=qs[_0x992d('0x47')](_0xf32e44[_0x992d('0x3e')][_0x992d('0x47')]);_0x2bb2c6[_0x992d('0x48')]=qs['filters'](_[_0x992d('0x49')](_0xf32e44[_0x992d('0x3e')],_0x369003[_0x992d('0x40')]));if(_0xf32e44[_0x992d('0x3e')][_0x992d('0x4a')]){_0x2bb2c6[_0x992d('0x48')]=_[_0x992d('0x4b')](_0x2bb2c6[_0x992d('0x48')],{'$or':_[_0x992d('0x37')](_0x2bb2c6['attributes'],function(_0x475408){var _0x45acb9={};_0x45acb9[_0x475408]={'$like':'%'+_0xf32e44['query'][_0x992d('0x4a')]+'%'};return _0x45acb9;})});}_0x2bb2c6=_[_0x992d('0x4b')]({},_0x2bb2c6,_0xf32e44[_0x992d('0x52')]);return _0x5952da[_0x992d('0x5b')](_0x2bb2c6);}})[_0x992d('0x1e')](function(_0x415bd4){if(_0x415bd4){_0x598b55=_0x415bd4[_0x992d('0x44')];if(!_0xf32e44[_0x992d('0x3e')][_0x992d('0x58')]('nolimit')){_0x2bb2c6['limit']=qs['limit'](_0xf32e44[_0x992d('0x3e')][_0x992d('0x2e')]);_0x2bb2c6[_0x992d('0x2d')]=qs[_0x992d('0x2d')](_0xf32e44[_0x992d('0x3e')][_0x992d('0x2d')]);}return _0x5952da['getDescriptions'](_0x2bb2c6);}})[_0x992d('0x1e')](function(_0x7b7fd3){if(_0x7b7fd3){return _0x7b7fd3?{'count':_0x598b55,'rows':_0x7b7fd3}:null;}})['then'](respondWithResult(_0x178844,null))[_0x992d('0x27')](handleError(_0x178844,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0d3d476..50ac3ff 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 _0xda0d=['define','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x4e0595,_0x40fed8){var _0x52606c=function(_0xd360bd){while(--_0xd360bd){_0x4e0595['push'](_0x4e0595['shift']());}};_0x52606c(++_0x40fed8);}(_0xda0d,0x19b));var _0xdda0=function(_0x1fe689,_0x32f7f5){_0x1fe689=_0x1fe689-0x0;var _0x5aea21=_0xda0d[_0x1fe689];return _0x5aea21;};'use strict';var _=require('lodash');var util=require(_0xdda0('0x0'));var logger=require('../../config/logger')(_0xdda0('0x1'));var moment=require(_0xdda0('0x2'));var BPromise=require(_0xdda0('0x3'));var rp=require(_0xdda0('0x4'));var fs=require('fs');var path=require(_0xdda0('0x5'));var rimraf=require('rimraf');var config=require(_0xdda0('0x6'));var attributes=require(_0xdda0('0x7'));module[_0xdda0('0x8')]=function(_0x2cbc5d,_0x400f24){return _0x2cbc5d[_0xdda0('0x9')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b2=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x35dc5a,_0x592817){var _0x333dca=function(_0x1c0810){while(--_0x1c0810){_0x35dc5a['push'](_0x35dc5a['shift']());}};_0x333dca(++_0x592817);}(_0xf7b2,0x19b));var _0x2f7b=function(_0x7e3380,_0x4f2bc8){_0x7e3380=_0x7e3380-0x0;var _0x225272=_0xf7b2[_0x7e3380];return _0x225272;};'use strict';var _=require(_0x2f7b('0x0'));var util=require(_0x2f7b('0x1'));var logger=require(_0x2f7b('0x2'))(_0x2f7b('0x3'));var moment=require(_0x2f7b('0x4'));var BPromise=require(_0x2f7b('0x5'));var rp=require(_0x2f7b('0x6'));var fs=require('fs');var path=require(_0x2f7b('0x7'));var rimraf=require(_0x2f7b('0x8'));var config=require(_0x2f7b('0x9'));var attributes=require(_0x2f7b('0xa'));module[_0x2f7b('0xb')]=function(_0x4cee34,_0x77d9d8){return _0x4cee34[_0x2f7b('0xc')](_0x2f7b('0xd'),attributes,{'tableName':_0x2f7b('0xe'),'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 50c9f96..1e4b5ce 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 _0xfddb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis'];(function(_0x5b64a1,_0x2ec810){var _0x4b6f55=function(_0x44dd84){while(--_0x44dd84){_0x5b64a1['push'](_0x5b64a1['shift']());}};_0x4b6f55(++_0x2ec810);}(_0xfddb,0x176));var _0xbfdd=function(_0x389266,_0x3efce5){_0x389266=_0x389266-0x0;var _0xea25c9=_0xfddb[_0x389266];return _0xea25c9;};'use strict';var _=require(_0xbfdd('0x0'));var util=require(_0xbfdd('0x1'));var moment=require(_0xbfdd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfdd('0x4'));var logger=require(_0xbfdd('0x5'))('rpc');var config=require(_0xbfdd('0x6'));var jayson=require(_0xbfdd('0x7'));var client=jayson['client'][_0xbfdd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5212c1,_0x35cdb7,_0x519cca){return new BPromise(function(_0x2d4c28,_0x1b0e2){return client['request'](_0x5212c1,_0x519cca)[_0xbfdd('0x9')](function(_0x424e19){logger[_0xbfdd('0xa')](_0xbfdd('0xb'),_0x35cdb7,'request\x20sent');logger[_0xbfdd('0xc')](_0xbfdd('0xd'),_0x35cdb7,'request\x20sent',JSON[_0xbfdd('0xe')](_0x424e19));if(_0x424e19[_0xbfdd('0xf')]){if(_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x10')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x35cdb7,_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x11')]);return _0x1b0e2(_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x11')]);}logger[_0xbfdd('0xf')](_0xbfdd('0xb'),_0x35cdb7,_0x424e19[_0xbfdd('0xf')][_0xbfdd('0x11')]);return _0x2d4c28(_0x424e19[_0xbfdd('0xf')]['message']);}else{logger['info'](_0xbfdd('0xb'),_0x35cdb7,_0xbfdd('0x12'));_0x2d4c28(_0x424e19[_0xbfdd('0x13')][_0xbfdd('0x11')]);}})[_0xbfdd('0x14')](function(_0x547fa6){logger[_0xbfdd('0xf')](_0xbfdd('0xb'),_0x35cdb7,_0x547fa6);_0x1b0e2(_0x547fa6);});});} \ No newline at end of file +var _0x5cc5=['stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3e3b51,_0x40b18c){var _0xb8a30b=function(_0x5bb624){while(--_0x5bb624){_0x3e3b51['push'](_0x3e3b51['shift']());}};_0xb8a30b(++_0x40b18c);}(_0x5cc5,0x78));var _0x55cc=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x5cc5[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require('lodash');var util=require(_0x55cc('0x0'));var moment=require(_0x55cc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55cc('0x2'))['db'];var utils=require(_0x55cc('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x55cc('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55cc('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x37a9c5,_0x20e076,_0x5be517){return new BPromise(function(_0x59f0b7,_0x426caa){return client[_0x55cc('0x6')](_0x37a9c5,_0x5be517)[_0x55cc('0x7')](function(_0x282f87){logger[_0x55cc('0x8')](_0x55cc('0x9'),_0x20e076,_0x55cc('0xa'));logger[_0x55cc('0xb')](_0x55cc('0xc'),_0x20e076,_0x55cc('0xa'),JSON[_0x55cc('0xd')](_0x282f87));if(_0x282f87['error']){if(_0x282f87[_0x55cc('0xe')][_0x55cc('0xf')]===0x1f4){logger[_0x55cc('0xe')](_0x55cc('0x9'),_0x20e076,_0x282f87[_0x55cc('0xe')]['message']);return _0x426caa(_0x282f87[_0x55cc('0xe')][_0x55cc('0x10')]);}logger[_0x55cc('0xe')](_0x55cc('0x9'),_0x20e076,_0x282f87[_0x55cc('0xe')]['message']);return _0x59f0b7(_0x282f87[_0x55cc('0xe')][_0x55cc('0x10')]);}else{logger[_0x55cc('0x8')](_0x55cc('0x9'),_0x20e076,'request\x20sent');_0x59f0b7(_0x282f87[_0x55cc('0x11')]['message']);}})[_0x55cc('0x12')](function(_0x3fe9a5){logger[_0x55cc('0xe')](_0x55cc('0x9'),_0x20e076,_0x3fe9a5);_0x426caa(_0x3fe9a5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e3e5a5c..beb8537 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 _0x2044=['../../config/environment','./intSugarcrmField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','Router','../../components/interaction/service'];(function(_0x590b64,_0x231b9c){var _0x18d602=function(_0x88a545){while(--_0x88a545){_0x590b64['push'](_0x590b64['shift']());}};_0x18d602(++_0x231b9c);}(_0x2044,0x1e2));var _0x4204=function(_0x404860,_0x199c3d){_0x404860=_0x404860-0x0;var _0x3f11cf=_0x2044[_0x404860];return _0x3f11cf;};'use strict';var multer=require(_0x4204('0x0'));var util=require(_0x4204('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4204('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4204('0x3'));var config=require(_0x4204('0x4'));var controller=require(_0x4204('0x5'));router[_0x4204('0x6')]('/',auth['isAuthenticated'](),controller[_0x4204('0x7')]);router[_0x4204('0x6')](_0x4204('0x8'),auth['isAuthenticated'](),controller[_0x4204('0x9')]);router[_0x4204('0xa')]('/',auth[_0x4204('0xb')](),controller[_0x4204('0xc')]);router[_0x4204('0xd')](_0x4204('0x8'),auth[_0x4204('0xb')](),controller[_0x4204('0xe')]);router[_0x4204('0xf')](_0x4204('0x8'),auth['isAuthenticated'](),controller[_0x4204('0x10')]);module[_0x4204('0x11')]=router; \ No newline at end of file +var _0x8710=['Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x8710,0x68));var _0x0871=function(_0x28b5f9,_0x2d8681){_0x28b5f9=_0x28b5f9-0x0;var _0x213c18=_0x8710[_0x28b5f9];return _0x213c18;};'use strict';var multer=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var path=require('path');var timeout=require(_0x0871('0x2'));var express=require(_0x0871('0x3'));var router=express[_0x0871('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0871('0x5'));var config=require(_0x0871('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x0871('0x7')]('/',auth['isAuthenticated'](),controller[_0x0871('0x8')]);router[_0x0871('0x7')](_0x0871('0x9'),auth[_0x0871('0xa')](),controller[_0x0871('0xb')]);router[_0x0871('0xc')]('/',auth['isAuthenticated'](),controller[_0x0871('0xd')]);router[_0x0871('0xe')](_0x0871('0x9'),auth[_0x0871('0xa')](),controller[_0x0871('0xf')]);router['delete'](_0x0871('0x9'),auth[_0x0871('0xa')](),controller[_0x0871('0x10')]);module[_0x0871('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 65434aa..4f5ae10 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 _0xbbb8=['variable','keyValue','STRING','ENUM','customVariable','sequelize','exports','string'];(function(_0x105d46,_0x4d7856){var _0x25fdc4=function(_0x4e2b0c){while(--_0x4e2b0c){_0x105d46['push'](_0x105d46['shift']());}};_0x25fdc4(++_0x4d7856);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x25392b,_0x273d56){_0x25392b=_0x25392b-0x0;var _0x457674=_0xbbb8[_0x25392b];return _0x457674;};'use strict';var Sequelize=require(_0x8bbb('0x0'));module[_0x8bbb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8bbb('0x2'),_0x8bbb('0x3'),'customVariable',_0x8bbb('0x4')),'defaultValue':_0x8bbb('0x2')},'content':{'type':Sequelize[_0x8bbb('0x5')]},'key':{'type':Sequelize[_0x8bbb('0x5')]},'keyType':{'type':Sequelize[_0x8bbb('0x6')](_0x8bbb('0x2'),_0x8bbb('0x3'),_0x8bbb('0x7'))},'keyContent':{'type':Sequelize[_0x8bbb('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8bbb('0x5')]}}; \ No newline at end of file +var _0x4a99=['customVariable','BOOLEAN','sequelize','string','variable','keyValue','STRING','ENUM'];(function(_0x1b8229,_0x77b322){var _0x3db507=function(_0x351ff0){while(--_0x351ff0){_0x1b8229['push'](_0x1b8229['shift']());}};_0x3db507(++_0x77b322);}(_0x4a99,0x1aa));var _0x94a9=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x4a99[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0x94a9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x94a9('0x1'),_0x94a9('0x2'),'customVariable',_0x94a9('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x94a9('0x4')]},'key':{'type':Sequelize[_0x94a9('0x4')]},'keyType':{'type':Sequelize[_0x94a9('0x5')]('string',_0x94a9('0x2'),_0x94a9('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x94a9('0x4')]},'nameField':{'type':Sequelize[_0x94a9('0x4')]},'customField':{'type':Sequelize[_0x94a9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0770d7c..5cb63b7 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 _0x4887=['reject','save','update','then','error','name','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','merge','SugarcrmField','includeAll','include','findAll','params','keys','options','find','body','catch','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply'];(function(_0x3ac827,_0x2f013a){var _0x46b499=function(_0x12f1b2){while(--_0x12f1b2){_0x3ac827['push'](_0x3ac827['shift']());}};_0x46b499(++_0x2f013a);}(_0x4887,0x131));var _0x7488=function(_0x2cda25,_0x81ae5f){_0x2cda25=_0x2cda25-0x0;var _0x291282=_0x4887[_0x2cda25];return _0x291282;};'use strict';var pdf=require(_0x7488('0x0'));var emlformat=require(_0x7488('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7488('0x2'));var rp=require('request-promise');var moment=require(_0x7488('0x3'));var BPromise=require(_0x7488('0x4'));var Mustache=require(_0x7488('0x5'));var util=require(_0x7488('0x6'));var path=require('path');var sox=require(_0x7488('0x7'));var csv=require(_0x7488('0x8'));var ejs=require(_0x7488('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7488('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7488('0xb'));var toCsv=require(_0x7488('0x8'));var querystring=require(_0x7488('0xc'));var Papa=require('papaparse');var Redis=require(_0x7488('0xd'));var authService=require(_0x7488('0xe'));var qs=require(_0x7488('0xf'));var as=require(_0x7488('0x10'));var hardwareService=require(_0x7488('0x11'));var logger=require(_0x7488('0x12'))('api');var utils=require(_0x7488('0x13'));var config=require('../../config/environment');var db=require(_0x7488('0x14'))['db'];function respondWithStatusCode(_0x274384,_0x2c5950){_0x2c5950=_0x2c5950||0xcc;return function(_0x37dd8c){if(_0x37dd8c){return _0x274384[_0x7488('0x15')](_0x2c5950);}return _0x274384[_0x7488('0x16')](_0x2c5950)[_0x7488('0x17')]();};}function respondWithResult(_0x365f8f,_0x4771ec){_0x4771ec=_0x4771ec||0xc8;return function(_0xf03c2c){if(_0xf03c2c){return _0x365f8f['status'](_0x4771ec)[_0x7488('0x18')](_0xf03c2c);}};}function respondWithFilteredResult(_0x3483db,_0x447e87){return function(_0x476280){if(_0x476280){var _0x4d8f1a=_0x476280[_0x7488('0x19')],_0x219373=_0x447e87[_0x7488('0x1a')],_0x21f963=_0x447e87['offset']+_0x447e87['limit'],_0x348ccd;if(_0x21f963>=_0x4d8f1a){_0x21f963=_0x4d8f1a;_0x348ccd=0xc8;}else{_0x348ccd=0xce;}_0x3483db[_0x7488('0x16')](_0x348ccd);return _0x3483db[_0x7488('0x1b')](_0x7488('0x1c'),_0x219373+'-'+_0x21f963+'/'+_0x4d8f1a)[_0x7488('0x18')](_0x476280);}return null;};}function patchUpdates(_0x490a95){return function(_0x20a12f){try{jsonpatch[_0x7488('0x1d')](_0x20a12f,_0x490a95,!![]);}catch(_0x1850d3){return BPromise[_0x7488('0x1e')](_0x1850d3);}return _0x20a12f[_0x7488('0x1f')]();};}function saveUpdates(_0x26638d,_0x3c3b08){return function(_0xb1f838){if(_0xb1f838){return _0xb1f838[_0x7488('0x20')](_0x26638d)[_0x7488('0x21')](function(_0x4396e5){return _0x4396e5;});}return null;};}function removeEntity(_0x5ef3b1,_0xf3aeb4){return function(_0x2f73e9){if(_0x2f73e9){return _0x2f73e9['destroy']()[_0x7488('0x21')](function(){_0x5ef3b1[_0x7488('0x16')](0xcc)[_0x7488('0x17')]();});}};}function handleEntityNotFound(_0x3c7f5f,_0x1b001e){return function(_0x21ea57){if(!_0x21ea57){_0x3c7f5f[_0x7488('0x15')](0x194);}return _0x21ea57;};}function handleError(_0x43160e,_0x32193){_0x32193=_0x32193||0x1f4;return function(_0xc30d24){logger[_0x7488('0x22')](_0xc30d24['stack']);if(_0xc30d24[_0x7488('0x23')]){delete _0xc30d24['name'];}_0x43160e[_0x7488('0x16')](_0x32193)['send'](_0xc30d24);};}exports[_0x7488('0x24')]=function(_0x485532,_0x41cf9e){var _0x5511c5={},_0x52e052={},_0x2b9a24={'count':0x0,'rows':[]};var _0x2f9caa=_[_0x7488('0x25')](db['SugarcrmField'][_0x7488('0x26')],function(_0x41bb61){return{'name':_0x41bb61[_0x7488('0x27')],'type':_0x41bb61[_0x7488('0x28')][_0x7488('0x29')]};});_0x52e052['model']=_['map'](_0x2f9caa,'name');_0x52e052[_0x7488('0x2a')]=_['keys'](_0x485532[_0x7488('0x2a')]);_0x52e052['filters']=_[_0x7488('0x2b')](_0x52e052[_0x7488('0x2c')],_0x52e052[_0x7488('0x2a')]);_0x5511c5[_0x7488('0x2d')]=_['intersection'](_0x52e052[_0x7488('0x2c')],qs[_0x7488('0x2e')](_0x485532[_0x7488('0x2a')][_0x7488('0x2e')]));_0x5511c5[_0x7488('0x2d')]=_0x5511c5[_0x7488('0x2d')][_0x7488('0x2f')]?_0x5511c5[_0x7488('0x2d')]:_0x52e052['model'];if(!_0x485532['query'][_0x7488('0x30')](_0x7488('0x31'))){_0x5511c5[_0x7488('0x32')]=qs[_0x7488('0x32')](_0x485532[_0x7488('0x2a')][_0x7488('0x32')]);_0x5511c5[_0x7488('0x1a')]=qs[_0x7488('0x1a')](_0x485532[_0x7488('0x2a')][_0x7488('0x1a')]);}_0x5511c5[_0x7488('0x33')]=qs[_0x7488('0x34')](_0x485532[_0x7488('0x2a')]['sort']);_0x5511c5['where']=qs['filters'](_[_0x7488('0x35')](_0x485532[_0x7488('0x2a')],_0x52e052[_0x7488('0x36')]),_0x2f9caa);if(_0x485532[_0x7488('0x2a')][_0x7488('0x37')]){_0x5511c5['where']=_[_0x7488('0x38')](_0x5511c5['where'],{'$or':_[_0x7488('0x25')](_0x2f9caa,function(_0x1d69e7){if(_0x1d69e7[_0x7488('0x28')]!=='VIRTUAL'){var _0x4f1490={};_0x4f1490[_0x1d69e7[_0x7488('0x23')]]={'$like':'%'+_0x485532[_0x7488('0x2a')][_0x7488('0x37')]+'%'};return _0x4f1490;}})});}_0x5511c5=_[_0x7488('0x38')]({},_0x5511c5,_0x485532['options']);var _0x361baf={'where':_0x5511c5['where']};return db[_0x7488('0x39')][_0x7488('0x19')](_0x361baf)[_0x7488('0x21')](function(_0x1bc2a2){_0x2b9a24[_0x7488('0x19')]=_0x1bc2a2;if(_0x485532[_0x7488('0x2a')][_0x7488('0x3a')]){_0x5511c5[_0x7488('0x3b')]=[{'all':!![]}];}return db[_0x7488('0x39')][_0x7488('0x3c')](_0x5511c5);})[_0x7488('0x21')](function(_0x3dbc0d){_0x2b9a24['rows']=_0x3dbc0d;return _0x2b9a24;})[_0x7488('0x21')](respondWithFilteredResult(_0x41cf9e,_0x5511c5))['catch'](handleError(_0x41cf9e,null));};exports['show']=function(_0x2618ea,_0xd5293d){var _0x5b34f1={'raw':!![],'where':{'id':_0x2618ea[_0x7488('0x3d')]['id']}},_0x373acc={};_0x373acc['model']=_[_0x7488('0x3e')](db['SugarcrmField']['rawAttributes']);_0x373acc[_0x7488('0x2a')]=_['keys'](_0x2618ea[_0x7488('0x2a')]);_0x373acc['filters']=_[_0x7488('0x2b')](_0x373acc['model'],_0x373acc[_0x7488('0x2a')]);_0x5b34f1[_0x7488('0x2d')]=_[_0x7488('0x2b')](_0x373acc[_0x7488('0x2c')],qs[_0x7488('0x2e')](_0x2618ea[_0x7488('0x2a')]['fields']));_0x5b34f1[_0x7488('0x2d')]=_0x5b34f1[_0x7488('0x2d')]['length']?_0x5b34f1[_0x7488('0x2d')]:_0x373acc[_0x7488('0x2c')];if(_0x2618ea[_0x7488('0x2a')]['includeAll']){_0x5b34f1[_0x7488('0x3b')]=[{'all':!![]}];}_0x5b34f1=_['merge']({},_0x5b34f1,_0x2618ea[_0x7488('0x3f')]);return db[_0x7488('0x39')][_0x7488('0x40')](_0x5b34f1)[_0x7488('0x21')](handleEntityNotFound(_0xd5293d,null))[_0x7488('0x21')](respondWithResult(_0xd5293d,null))['catch'](handleError(_0xd5293d,null));};exports['create']=function(_0x15f07f,_0x22ec42){return db['SugarcrmField']['create'](_0x15f07f[_0x7488('0x41')],{})[_0x7488('0x21')](respondWithResult(_0x22ec42,0xc9))[_0x7488('0x42')](handleError(_0x22ec42,null));};exports[_0x7488('0x20')]=function(_0x37ea86,_0x18e0a2){if(_0x37ea86[_0x7488('0x41')]['id']){delete _0x37ea86[_0x7488('0x41')]['id'];}return db[_0x7488('0x39')]['find']({'where':{'id':_0x37ea86[_0x7488('0x3d')]['id']}})[_0x7488('0x21')](handleEntityNotFound(_0x18e0a2,null))[_0x7488('0x21')](saveUpdates(_0x37ea86[_0x7488('0x41')],null))[_0x7488('0x21')](respondWithResult(_0x18e0a2,null))['catch'](handleError(_0x18e0a2,null));};exports['destroy']=function(_0x469fb6,_0x56611b){return db[_0x7488('0x39')][_0x7488('0x40')]({'where':{'id':_0x469fb6[_0x7488('0x3d')]['id']}})[_0x7488('0x21')](handleEntityNotFound(_0x56611b,null))[_0x7488('0x21')](removeEntity(_0x56611b,null))['catch'](handleError(_0x56611b,null));}; \ No newline at end of file +var _0x4f5e=['limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','count','offset','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f5e,0x16b));var _0xe4f5=function(_0x2c4ef1,_0x1efcc9){_0x2c4ef1=_0x2c4ef1-0x0;var _0x55e3a4=_0x4f5e[_0x2c4ef1];return _0x55e3a4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe4f5('0x0'));var zipdir=require(_0xe4f5('0x1'));var jsonpatch=require(_0xe4f5('0x2'));var rp=require(_0xe4f5('0x3'));var moment=require(_0xe4f5('0x4'));var BPromise=require(_0xe4f5('0x5'));var Mustache=require(_0xe4f5('0x6'));var util=require('util');var path=require(_0xe4f5('0x7'));var sox=require(_0xe4f5('0x8'));var csv=require(_0xe4f5('0x9'));var ejs=require(_0xe4f5('0xa'));var fs=require('fs');var _=require(_0xe4f5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe4f5('0xc'));var toCsv=require(_0xe4f5('0x9'));var querystring=require('querystring');var Papa=require(_0xe4f5('0xd'));var Redis=require(_0xe4f5('0xe'));var authService=require(_0xe4f5('0xf'));var qs=require(_0xe4f5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4f5('0x11'));var logger=require('../../config/logger')(_0xe4f5('0x12'));var utils=require(_0xe4f5('0x13'));var config=require(_0xe4f5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1036d3,_0xed7321){_0xed7321=_0xed7321||0xcc;return function(_0x5ae826){if(_0x5ae826){return _0x1036d3['sendStatus'](_0xed7321);}return _0x1036d3[_0xe4f5('0x15')](_0xed7321)[_0xe4f5('0x16')]();};}function respondWithResult(_0x43d384,_0xec8483){_0xec8483=_0xec8483||0xc8;return function(_0x40a125){if(_0x40a125){return _0x43d384[_0xe4f5('0x15')](_0xec8483)['json'](_0x40a125);}};}function respondWithFilteredResult(_0x27f7d1,_0x3b4aa4){return function(_0x550895){if(_0x550895){var _0x38e23a=_0x550895[_0xe4f5('0x17')],_0x3ab1a9=_0x3b4aa4[_0xe4f5('0x18')],_0x1be321=_0x3b4aa4[_0xe4f5('0x18')]+_0x3b4aa4['limit'],_0x55376e;if(_0x1be321>=_0x38e23a){_0x1be321=_0x38e23a;_0x55376e=0xc8;}else{_0x55376e=0xce;}_0x27f7d1[_0xe4f5('0x15')](_0x55376e);return _0x27f7d1[_0xe4f5('0x19')](_0xe4f5('0x1a'),_0x3ab1a9+'-'+_0x1be321+'/'+_0x38e23a)[_0xe4f5('0x1b')](_0x550895);}return null;};}function patchUpdates(_0x448bbf){return function(_0x501cc7){try{jsonpatch['apply'](_0x501cc7,_0x448bbf,!![]);}catch(_0x554f1f){return BPromise['reject'](_0x554f1f);}return _0x501cc7['save']();};}function saveUpdates(_0x2e2604,_0x5cc7f7){return function(_0x55ae8a){if(_0x55ae8a){return _0x55ae8a[_0xe4f5('0x1c')](_0x2e2604)[_0xe4f5('0x1d')](function(_0x191191){return _0x191191;});}return null;};}function removeEntity(_0x261aef,_0x2a46b8){return function(_0x577b38){if(_0x577b38){return _0x577b38[_0xe4f5('0x1e')]()[_0xe4f5('0x1d')](function(){_0x261aef[_0xe4f5('0x15')](0xcc)[_0xe4f5('0x16')]();});}};}function handleEntityNotFound(_0x186bfd,_0x24e690){return function(_0x3ed3cd){if(!_0x3ed3cd){_0x186bfd[_0xe4f5('0x1f')](0x194);}return _0x3ed3cd;};}function handleError(_0x31b987,_0x490bde){_0x490bde=_0x490bde||0x1f4;return function(_0x5212be){logger[_0xe4f5('0x20')](_0x5212be[_0xe4f5('0x21')]);if(_0x5212be['name']){delete _0x5212be[_0xe4f5('0x22')];}_0x31b987[_0xe4f5('0x15')](_0x490bde)[_0xe4f5('0x23')](_0x5212be);};}exports[_0xe4f5('0x24')]=function(_0x59d513,_0x40701c){var _0x386853={},_0xd88f94={},_0x27b74b={'count':0x0,'rows':[]};var _0x4436ff=_[_0xe4f5('0x25')](db[_0xe4f5('0x26')][_0xe4f5('0x27')],function(_0x158c96){return{'name':_0x158c96['fieldName'],'type':_0x158c96[_0xe4f5('0x28')][_0xe4f5('0x29')]};});_0xd88f94[_0xe4f5('0x2a')]=_[_0xe4f5('0x25')](_0x4436ff,_0xe4f5('0x22'));_0xd88f94['query']=_[_0xe4f5('0x2b')](_0x59d513['query']);_0xd88f94[_0xe4f5('0x2c')]=_[_0xe4f5('0x2d')](_0xd88f94['model'],_0xd88f94['query']);_0x386853[_0xe4f5('0x2e')]=_[_0xe4f5('0x2d')](_0xd88f94['model'],qs[_0xe4f5('0x2f')](_0x59d513[_0xe4f5('0x30')]['fields']));_0x386853[_0xe4f5('0x2e')]=_0x386853[_0xe4f5('0x2e')][_0xe4f5('0x31')]?_0x386853[_0xe4f5('0x2e')]:_0xd88f94[_0xe4f5('0x2a')];if(!_0x59d513['query'][_0xe4f5('0x32')]('nolimit')){_0x386853[_0xe4f5('0x33')]=qs[_0xe4f5('0x33')](_0x59d513[_0xe4f5('0x30')][_0xe4f5('0x33')]);_0x386853['offset']=qs['offset'](_0x59d513[_0xe4f5('0x30')][_0xe4f5('0x18')]);}_0x386853['order']=qs[_0xe4f5('0x34')](_0x59d513['query']['sort']);_0x386853['where']=qs['filters'](_[_0xe4f5('0x35')](_0x59d513[_0xe4f5('0x30')],_0xd88f94[_0xe4f5('0x2c')]),_0x4436ff);if(_0x59d513['query'][_0xe4f5('0x36')]){_0x386853[_0xe4f5('0x37')]=_[_0xe4f5('0x38')](_0x386853[_0xe4f5('0x37')],{'$or':_[_0xe4f5('0x25')](_0x4436ff,function(_0x512a03){if(_0x512a03['type']!==_0xe4f5('0x39')){var _0x373dd4={};_0x373dd4[_0x512a03[_0xe4f5('0x22')]]={'$like':'%'+_0x59d513[_0xe4f5('0x30')]['filter']+'%'};return _0x373dd4;}})});}_0x386853=_['merge']({},_0x386853,_0x59d513[_0xe4f5('0x3a')]);var _0x40eeb3={'where':_0x386853[_0xe4f5('0x37')]};return db[_0xe4f5('0x26')][_0xe4f5('0x17')](_0x40eeb3)[_0xe4f5('0x1d')](function(_0x253193){_0x27b74b[_0xe4f5('0x17')]=_0x253193;if(_0x59d513[_0xe4f5('0x30')][_0xe4f5('0x3b')]){_0x386853[_0xe4f5('0x3c')]=[{'all':!![]}];}return db[_0xe4f5('0x26')][_0xe4f5('0x3d')](_0x386853);})[_0xe4f5('0x1d')](function(_0x3a288f){_0x27b74b[_0xe4f5('0x3e')]=_0x3a288f;return _0x27b74b;})[_0xe4f5('0x1d')](respondWithFilteredResult(_0x40701c,_0x386853))['catch'](handleError(_0x40701c,null));};exports[_0xe4f5('0x3f')]=function(_0xb5a6bf,_0x240e05){var _0x39f608={'raw':!![],'where':{'id':_0xb5a6bf[_0xe4f5('0x40')]['id']}},_0xd165b2={};_0xd165b2[_0xe4f5('0x2a')]=_[_0xe4f5('0x2b')](db[_0xe4f5('0x26')][_0xe4f5('0x27')]);_0xd165b2['query']=_[_0xe4f5('0x2b')](_0xb5a6bf[_0xe4f5('0x30')]);_0xd165b2[_0xe4f5('0x2c')]=_[_0xe4f5('0x2d')](_0xd165b2[_0xe4f5('0x2a')],_0xd165b2['query']);_0x39f608[_0xe4f5('0x2e')]=_[_0xe4f5('0x2d')](_0xd165b2['model'],qs['fields'](_0xb5a6bf[_0xe4f5('0x30')][_0xe4f5('0x2f')]));_0x39f608[_0xe4f5('0x2e')]=_0x39f608[_0xe4f5('0x2e')][_0xe4f5('0x31')]?_0x39f608[_0xe4f5('0x2e')]:_0xd165b2[_0xe4f5('0x2a')];if(_0xb5a6bf[_0xe4f5('0x30')]['includeAll']){_0x39f608['include']=[{'all':!![]}];}_0x39f608=_[_0xe4f5('0x38')]({},_0x39f608,_0xb5a6bf[_0xe4f5('0x3a')]);return db[_0xe4f5('0x26')]['find'](_0x39f608)[_0xe4f5('0x1d')](handleEntityNotFound(_0x240e05,null))[_0xe4f5('0x1d')](respondWithResult(_0x240e05,null))[_0xe4f5('0x41')](handleError(_0x240e05,null));};exports[_0xe4f5('0x42')]=function(_0x40418e,_0x292a72){return db[_0xe4f5('0x26')][_0xe4f5('0x42')](_0x40418e['body'],{})[_0xe4f5('0x1d')](respondWithResult(_0x292a72,0xc9))[_0xe4f5('0x41')](handleError(_0x292a72,null));};exports[_0xe4f5('0x1c')]=function(_0x48b879,_0x90cee5){if(_0x48b879[_0xe4f5('0x43')]['id']){delete _0x48b879[_0xe4f5('0x43')]['id'];}return db[_0xe4f5('0x26')][_0xe4f5('0x44')]({'where':{'id':_0x48b879[_0xe4f5('0x40')]['id']}})[_0xe4f5('0x1d')](handleEntityNotFound(_0x90cee5,null))[_0xe4f5('0x1d')](saveUpdates(_0x48b879['body'],null))[_0xe4f5('0x1d')](respondWithResult(_0x90cee5,null))['catch'](handleError(_0x90cee5,null));};exports[_0xe4f5('0x1e')]=function(_0x28365e,_0x5075e2){return db[_0xe4f5('0x26')][_0xe4f5('0x44')]({'where':{'id':_0x28365e[_0xe4f5('0x40')]['id']}})[_0xe4f5('0x1d')](handleEntityNotFound(_0x5075e2,null))[_0xe4f5('0x1d')](removeEntity(_0x5075e2,null))[_0xe4f5('0x41')](handleError(_0x5075e2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e568fe8..3d6b32b 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 _0x5033=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5033,0x6e));var _0x3503=function(_0x44cc0d,_0x2ec13f){_0x44cc0d=_0x44cc0d-0x0;var _0x5b311b=_0x5033[_0x44cc0d];return _0x5b311b;};'use strict';var _=require(_0x3503('0x0'));var util=require(_0x3503('0x1'));var logger=require(_0x3503('0x2'))(_0x3503('0x3'));var moment=require(_0x3503('0x4'));var BPromise=require(_0x3503('0x5'));var rp=require(_0x3503('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3503('0x7'));var config=require(_0x3503('0x8'));var attributes=require(_0x3503('0x9'));module['exports']=function(_0x4509d9,_0x404fbf){return _0x4509d9['define'](_0x3503('0xa'),attributes,{'tableName':_0x3503('0xb'),'paranoid':![],'indexes':[{'name':_0x3503('0xc'),'fields':[_0x3503('0xd'),_0x3503('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd18f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd18f,0x1be));var _0xfd18=function(_0x542185,_0x325852){_0x542185=_0x542185-0x0;var _0x2504b3=_0xd18f[_0x542185];return _0x2504b3;};'use strict';var _=require(_0xfd18('0x0'));var util=require(_0xfd18('0x1'));var logger=require('../../config/logger')(_0xfd18('0x2'));var moment=require(_0xfd18('0x3'));var BPromise=require(_0xfd18('0x4'));var rp=require(_0xfd18('0x5'));var fs=require('fs');var path=require(_0xfd18('0x6'));var rimraf=require(_0xfd18('0x7'));var config=require(_0xfd18('0x8'));var attributes=require(_0xfd18('0x9'));module[_0xfd18('0xa')]=function(_0x4ce803,_0x3401e2){return _0x4ce803[_0xfd18('0xb')](_0xfd18('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xfd18('0xd'),'fields':[_0xfd18('0xe'),_0xfd18('0xf')],'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 f1ef47d..4f09698 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 _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x0b0e[_0xcf581b];return _0x4f454d;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x2ea989,_0x269355){var _0x11c450=function(_0x1ed4b3){while(--_0x1ed4b3){_0x2ea989['push'](_0x2ea989['shift']());}};_0x11c450(++_0x269355);}(_0x1a85,0x178));var _0x51a8=function(_0x211b9c,_0x3e4a38){_0x211b9c=_0x211b9c-0x0;var _0x5be03d=_0x1a85[_0x211b9c];return _0x5be03d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f3e3db2..6a18362 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 _0xcacc=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','/:id/fields','getFields','create','post','addConfiguration','update'];(function(_0x408ef1,_0x5713e1){var _0x3fd3df=function(_0xbfe6cf){while(--_0xbfe6cf){_0x408ef1['push'](_0x408ef1['shift']());}};_0x3fd3df(++_0x5713e1);}(_0xcacc,0x17f));var _0xccac=function(_0x10193c,_0xad970f){_0x10193c=_0x10193c-0x0;var _0x2a7ac6=_0xcacc[_0x10193c];return _0x2a7ac6;};'use strict';var multer=require(_0xccac('0x0'));var util=require(_0xccac('0x1'));var path=require(_0xccac('0x2'));var timeout=require(_0xccac('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xccac('0x4'));var interaction=require(_0xccac('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xccac('0x6')](),controller['index']);router[_0xccac('0x7')](_0xccac('0x8'),auth[_0xccac('0x6')](),controller[_0xccac('0x9')]);router[_0xccac('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xccac('0x7')](_0xccac('0xa'),auth[_0xccac('0x6')](),controller[_0xccac('0xb')]);router['post']('/',auth[_0xccac('0x6')](),controller[_0xccac('0xc')]);router[_0xccac('0xd')]('/:id/configurations',auth[_0xccac('0x6')](),controller[_0xccac('0xe')]);router['put'](_0xccac('0x8'),auth[_0xccac('0x6')](),controller[_0xccac('0xf')]);router[_0xccac('0x10')](_0xccac('0x8'),auth[_0xccac('0x6')](),controller[_0xccac('0x11')]);module[_0xccac('0x12')]=router; \ No newline at end of file +var _0x5f38=['/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4b44b6,_0x16cf9b){var _0x533c51=function(_0x5321d8){while(--_0x5321d8){_0x4b44b6['push'](_0x4b44b6['shift']());}};_0x533c51(++_0x16cf9b);}(_0x5f38,0x106));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85f3('0x0'));var util=require('util');var path=require(_0x85f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x85f3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x85f3('0x3'));var config=require(_0x85f3('0x4'));var controller=require(_0x85f3('0x5'));router[_0x85f3('0x6')]('/',auth[_0x85f3('0x7')](),controller[_0x85f3('0x8')]);router[_0x85f3('0x6')](_0x85f3('0x9'),auth[_0x85f3('0x7')](),controller[_0x85f3('0xa')]);router[_0x85f3('0x6')](_0x85f3('0xb'),auth[_0x85f3('0x7')](),controller['getConfigurations']);router[_0x85f3('0x6')]('/:id/fields',auth[_0x85f3('0x7')](),controller[_0x85f3('0xc')]);router[_0x85f3('0xd')]('/',auth[_0x85f3('0x7')](),controller[_0x85f3('0xe')]);router['post'](_0x85f3('0xb'),auth['isAuthenticated'](),controller[_0x85f3('0xf')]);router[_0x85f3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x85f3('0x11')]);router[_0x85f3('0x12')](_0x85f3('0x9'),auth['isAuthenticated'](),controller[_0x85f3('0x13')]);module[_0x85f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 6c33589..353a64f 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 _0x7264=['exports','STRING','HelpDesk','sequelize'];(function(_0x5b484d,_0x1f6e3b){var _0x2a8c9e=function(_0x554194){while(--_0x554194){_0x5b484d['push'](_0x5b484d['shift']());}};_0x2a8c9e(++_0x1f6e3b);}(_0x7264,0x10b));var _0x4726=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7264[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x4726('0x0'));module[_0x4726('0x1')]={'name':{'type':Sequelize[_0x4726('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4726('0x2')]},'username':{'type':Sequelize[_0x4726('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4726('0x2')],'allowNull':![],'defaultValue':_0x4726('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4726('0x2')]},'accessKey':{'type':Sequelize[_0x4726('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc231=['exports','STRING','HelpDesk','sequelize'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xc231,0x8f));var _0x1c23=function(_0x1568c2,_0x2d6ac7){_0x1568c2=_0x1568c2-0x0;var _0x1815d9=_0xc231[_0x1568c2];return _0x1815d9;};'use strict';var Sequelize=require(_0x1c23('0x0'));module[_0x1c23('0x1')]={'name':{'type':Sequelize[_0x1c23('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1c23('0x2')]},'username':{'type':Sequelize[_0x1c23('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1c23('0x3')},'remoteUri':{'type':Sequelize[_0x1c23('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1c23('0x2')]},'accessKey':{'type':Sequelize[_0x1c23('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 7b788d1..658b732 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 _0x8470=['request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','keys','filters','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','length','create','body','params','find','getConfigurations','findOne','VtigerConfiguration','channel','type','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','GET','getchallenge','POST','result','describe','success','autogenerated','reference','remove','includes','editable','false','startsWith','cf_','picklistValues','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0xc78df3,_0xf1ca58){var _0x2893b7=function(_0x2483f5){while(--_0x2483f5){_0xc78df3['push'](_0xc78df3['shift']());}};_0x2893b7(++_0xf1ca58);}(_0x8470,0x160));var _0x0847=function(_0x42279e,_0x299494){_0x42279e=_0x42279e-0x0;var _0x4bd0a4=_0x8470[_0x42279e];return _0x4bd0a4;};'use strict';var pdf=require(_0x0847('0x0'));var emlformat=require(_0x0847('0x1'));var rimraf=require(_0x0847('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0847('0x3'));var rp=require(_0x0847('0x4'));var moment=require(_0x0847('0x5'));var BPromise=require(_0x0847('0x6'));var Mustache=require(_0x0847('0x7'));var util=require(_0x0847('0x8'));var path=require(_0x0847('0x9'));var sox=require('sox');var csv=require(_0x0847('0xa'));var ejs=require(_0x0847('0xb'));var fs=require('fs');var _=require(_0x0847('0xc'));var squel=require('squel');var crypto=require(_0x0847('0xd'));var jsforce=require(_0x0847('0xe'));var deskjs=require(_0x0847('0xf'));var toCsv=require(_0x0847('0xa'));var querystring=require(_0x0847('0x10'));var Papa=require(_0x0847('0x11'));var Redis=require(_0x0847('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0847('0x13'));var as=require(_0x0847('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0847('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x0847('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x0847('0x17')][_0x0847('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1b8ff5,_0x2e9667,_0x239f2a){if(_0x239f2a){var _0x392068=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x392068[_0x0847('0x19')](_0x2e9667)){return _0x1b8ff5;}else{throw new db[(_0x0847('0x1a'))][(_0x0847('0x1b'))](_0x0847('0x1c'));}}else{return _0x1b8ff5;}}function respondWithRpcPromise(_0x531f2c,_0x1f2d38,_0x56d1eb,_0x20f235){return new BPromise(function(_0x1b7291,_0x568381){var _0x465391=_0x20f235||client;return _0x465391[_0x0847('0x1d')](_0x531f2c,_0x56d1eb)[_0x0847('0x1e')](function(_0x4fe554){logger[_0x0847('0x1f')](_0x0847('0x20'),_0x1f2d38,_0x0847('0x21'));logger[_0x0847('0x22')](_0x0847('0x23'),_0x1f2d38,_0x0847('0x21'),JSON[_0x0847('0x24')](_0x4fe554));if(_0x4fe554[_0x0847('0x25')]){if(_0x4fe554[_0x0847('0x25')]['code']===0x1f4){logger[_0x0847('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x1f2d38,_0x4fe554[_0x0847('0x25')][_0x0847('0x26')]);return _0x568381(_0x4fe554[_0x0847('0x25')][_0x0847('0x26')]);}logger[_0x0847('0x25')](_0x0847('0x20'),_0x1f2d38,_0x4fe554[_0x0847('0x25')][_0x0847('0x26')]);return _0x1b7291(_0x4fe554[_0x0847('0x25')][_0x0847('0x26')]);}else{logger[_0x0847('0x1f')](_0x0847('0x20'),_0x1f2d38,_0x0847('0x21'));_0x1b7291(_0x4fe554['result'][_0x0847('0x26')]);}})['catch'](function(_0x3d8778){logger[_0x0847('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x1f2d38,_0x3d8778);_0x568381(_0x3d8778);});});}function respondWithStatusCode(_0x5769e6,_0x213e1f){_0x213e1f=_0x213e1f||0xcc;return function(_0x5b4660){if(_0x5b4660){return _0x5769e6['sendStatus'](_0x213e1f);}return _0x5769e6[_0x0847('0x27')](_0x213e1f)[_0x0847('0x28')]();};}function respondWithResult(_0x3dd08f,_0x44a77f){_0x44a77f=_0x44a77f||0xc8;return function(_0x4487d3){if(_0x4487d3){return _0x3dd08f[_0x0847('0x27')](_0x44a77f)[_0x0847('0x29')](_0x4487d3);}};}function respondWithFilteredResult(_0x260d9b,_0x119b55){return function(_0x5450dc){if(_0x5450dc){var _0x5b1d62=_0x5450dc['count'],_0x5ac98d=_0x119b55['offset'],_0x4cb4c6=_0x119b55[_0x0847('0x2a')]+_0x119b55[_0x0847('0x2b')],_0x10379e;if(_0x4cb4c6>=_0x5b1d62){_0x4cb4c6=_0x5b1d62;_0x10379e=0xc8;}else{_0x10379e=0xce;}_0x260d9b[_0x0847('0x27')](_0x10379e);return _0x260d9b['set'](_0x0847('0x2c'),_0x5ac98d+'-'+_0x4cb4c6+'/'+_0x5b1d62)['json'](_0x5450dc);}return null;};}function patchUpdates(_0x3047d){return function(_0x45bc3c){try{jsonpatch[_0x0847('0x2d')](_0x45bc3c,_0x3047d,!![]);}catch(_0x45bb5b){return BPromise[_0x0847('0x2e')](_0x45bb5b);}return _0x45bc3c['save']();};}function saveUpdates(_0xaecd88,_0x1b2b13){return function(_0x509f58){if(_0x509f58){return _0x509f58[_0x0847('0x2f')](_0xaecd88)[_0x0847('0x1e')](function(_0x59437a){return _0x59437a;});}return null;};}function removeEntity(_0x3a018b,_0x450fb9){return function(_0x8d3c3a){if(_0x8d3c3a){return _0x8d3c3a[_0x0847('0x30')]()['then'](function(){_0x3a018b[_0x0847('0x27')](0xcc)[_0x0847('0x28')]();});}};}function handleEntityNotFound(_0x5990cb,_0xdaba81){return function(_0x3c0b64){if(!_0x3c0b64){_0x5990cb[_0x0847('0x31')](0x194);}return _0x3c0b64;};}function handleError(_0x6516f2,_0x146a7c){_0x146a7c=_0x146a7c||0x1f4;return function(_0x32e1a8){logger[_0x0847('0x25')](_0x32e1a8[_0x0847('0x32')]);if(_0x32e1a8[_0x0847('0x33')]){delete _0x32e1a8[_0x0847('0x33')];}_0x6516f2[_0x0847('0x27')](_0x146a7c)[_0x0847('0x34')](_0x32e1a8);};}exports[_0x0847('0x35')]=function(_0x1ef0d7,_0x516a23){var _0x2b2996={},_0x27ee69={},_0x269b6a={'count':0x0,'rows':[]};var _0xae229f=_[_0x0847('0x36')](db[_0x0847('0x37')][_0x0847('0x38')],function(_0x38b861){return{'name':_0x38b861[_0x0847('0x39')],'type':_0x38b861['type']['key']};});_0x27ee69['model']=_[_0x0847('0x36')](_0xae229f,'name');_0x27ee69['query']=_[_0x0847('0x3a')](_0x1ef0d7['query']);_0x27ee69[_0x0847('0x3b')]=_['intersection'](_0x27ee69[_0x0847('0x3c')],_0x27ee69[_0x0847('0x3d')]);_0x2b2996['attributes']=_[_0x0847('0x3e')](_0x27ee69[_0x0847('0x3c')],qs[_0x0847('0x3f')](_0x1ef0d7[_0x0847('0x3d')][_0x0847('0x3f')]));_0x2b2996[_0x0847('0x40')]=_0x2b2996['attributes']['length']?_0x2b2996['attributes']:_0x27ee69[_0x0847('0x3c')];if(!_0x1ef0d7[_0x0847('0x3d')][_0x0847('0x41')](_0x0847('0x42'))){_0x2b2996['limit']=qs[_0x0847('0x2b')](_0x1ef0d7[_0x0847('0x3d')][_0x0847('0x2b')]);_0x2b2996[_0x0847('0x2a')]=qs[_0x0847('0x2a')](_0x1ef0d7['query'][_0x0847('0x2a')]);}_0x2b2996[_0x0847('0x43')]=qs[_0x0847('0x44')](_0x1ef0d7[_0x0847('0x3d')][_0x0847('0x44')]);_0x2b2996[_0x0847('0x45')]=qs[_0x0847('0x3b')](_[_0x0847('0x46')](_0x1ef0d7['query'],_0x27ee69[_0x0847('0x3b')]),_0xae229f);if(_0x1ef0d7[_0x0847('0x3d')][_0x0847('0x47')]){_0x2b2996['where']=_[_0x0847('0x48')](_0x2b2996['where'],{'$or':_[_0x0847('0x36')](_0xae229f,function(_0x25d336){if(_0x25d336['type']!=='VIRTUAL'){var _0x4ea80e={};_0x4ea80e[_0x25d336[_0x0847('0x33')]]={'$like':'%'+_0x1ef0d7['query'][_0x0847('0x47')]+'%'};return _0x4ea80e;}})});}_0x2b2996=_[_0x0847('0x48')]({},_0x2b2996,_0x1ef0d7[_0x0847('0x49')]);var _0x1994b0={'where':_0x2b2996['where']};return db[_0x0847('0x37')][_0x0847('0x4a')](_0x1994b0)[_0x0847('0x1e')](function(_0x4e4992){_0x269b6a[_0x0847('0x4a')]=_0x4e4992;if(_0x1ef0d7[_0x0847('0x3d')][_0x0847('0x4b')]){_0x2b2996[_0x0847('0x4c')]=[{'all':!![]}];}return db[_0x0847('0x37')][_0x0847('0x4d')](_0x2b2996);})[_0x0847('0x1e')](function(_0x31560d){_0x269b6a[_0x0847('0x4e')]=_0x31560d;return _0x269b6a;})[_0x0847('0x1e')](respondWithFilteredResult(_0x516a23,_0x2b2996))[_0x0847('0x4f')](handleError(_0x516a23,null));};exports[_0x0847('0x50')]=function(_0x25e42a,_0x33c7ff){var _0x100274={'raw':![],'where':{'id':_0x25e42a['params']['id']}},_0x4f041d={};_0x4f041d[_0x0847('0x3c')]=_[_0x0847('0x3a')](db[_0x0847('0x37')][_0x0847('0x38')]);_0x4f041d[_0x0847('0x3d')]=_[_0x0847('0x3a')](_0x25e42a['query']);_0x4f041d['filters']=_['intersection'](_0x4f041d[_0x0847('0x3c')],_0x4f041d[_0x0847('0x3d')]);_0x100274[_0x0847('0x40')]=_[_0x0847('0x3e')](_0x4f041d[_0x0847('0x3c')],qs['fields'](_0x25e42a[_0x0847('0x3d')][_0x0847('0x3f')]));_0x100274[_0x0847('0x40')]=_0x100274[_0x0847('0x40')][_0x0847('0x51')]?_0x100274[_0x0847('0x40')]:_0x4f041d['model'];if(_0x25e42a[_0x0847('0x3d')][_0x0847('0x4b')]){_0x100274[_0x0847('0x4c')]=[{'all':!![]}];}_0x100274=_[_0x0847('0x48')]({},_0x100274,_0x25e42a[_0x0847('0x49')]);return db[_0x0847('0x37')]['find'](_0x100274)['then'](handleEntityNotFound(_0x33c7ff,null))[_0x0847('0x1e')](respondWithResult(_0x33c7ff,null))[_0x0847('0x4f')](handleError(_0x33c7ff,null));};exports['create']=function(_0x6b1d42,_0x3b6056){return db[_0x0847('0x37')][_0x0847('0x52')](_0x6b1d42[_0x0847('0x53')],{})[_0x0847('0x1e')](respondWithResult(_0x3b6056,0xc9))[_0x0847('0x4f')](handleError(_0x3b6056,null));};exports['update']=function(_0x412c72,_0x16302a){if(_0x412c72[_0x0847('0x53')]['id']){delete _0x412c72[_0x0847('0x53')]['id'];}return db[_0x0847('0x37')]['find']({'where':{'id':_0x412c72[_0x0847('0x54')]['id']}})[_0x0847('0x1e')](handleEntityNotFound(_0x16302a,null))[_0x0847('0x1e')](saveUpdates(_0x412c72[_0x0847('0x53')],null))['then'](respondWithResult(_0x16302a,null))['catch'](handleError(_0x16302a,null));};exports[_0x0847('0x30')]=function(_0x57303b,_0x1e8d3a){return db[_0x0847('0x37')][_0x0847('0x55')]({'where':{'id':_0x57303b['params']['id']}})[_0x0847('0x1e')](handleEntityNotFound(_0x1e8d3a,null))['then'](removeEntity(_0x1e8d3a,null))[_0x0847('0x4f')](handleError(_0x1e8d3a,null));};exports[_0x0847('0x56')]=function(_0x1bc5b6,_0x4b0dd5,_0x2d90d0){var _0x332d6c={};var _0x11aa46={};var _0x134c0a;var _0x37bdc6;return db[_0x0847('0x37')][_0x0847('0x57')]({'where':{'id':_0x1bc5b6[_0x0847('0x54')]['id']}})[_0x0847('0x1e')](handleEntityNotFound(_0x4b0dd5,null))[_0x0847('0x1e')](function(_0x5a7a93){if(_0x5a7a93){_0x134c0a=_0x5a7a93;_0x11aa46[_0x0847('0x3c')]=_[_0x0847('0x3a')](db[_0x0847('0x58')][_0x0847('0x38')]);_0x11aa46['query']=_[_0x0847('0x3a')](_0x1bc5b6[_0x0847('0x3d')]);_0x11aa46[_0x0847('0x3b')]=_[_0x0847('0x3e')](_0x11aa46[_0x0847('0x3c')],_0x11aa46[_0x0847('0x3d')]);_0x332d6c[_0x0847('0x40')]=_['intersection'](_0x11aa46['model'],qs[_0x0847('0x3f')](_0x1bc5b6[_0x0847('0x3d')][_0x0847('0x3f')]));_0x332d6c[_0x0847('0x40')]=_0x332d6c[_0x0847('0x40')][_0x0847('0x51')]?_0x332d6c[_0x0847('0x40')]:_0x11aa46[_0x0847('0x3c')];_0x332d6c[_0x0847('0x43')]=qs[_0x0847('0x44')](_0x1bc5b6[_0x0847('0x3d')][_0x0847('0x44')]);_0x332d6c['where']=qs[_0x0847('0x3b')](_[_0x0847('0x46')](_0x1bc5b6[_0x0847('0x3d')],_0x11aa46[_0x0847('0x3b')]));if(_0x1bc5b6[_0x0847('0x3d')]['filter']){_0x332d6c[_0x0847('0x45')]=_['merge'](_0x332d6c[_0x0847('0x45')],{'$or':_[_0x0847('0x36')](_0x332d6c[_0x0847('0x40')],function(_0x5c9f74){var _0x2c8947={};_0x2c8947[_0x5c9f74]={'$like':'%'+_0x1bc5b6[_0x0847('0x3d')]['filter']+'%'};return _0x2c8947;})});}_0x332d6c=_[_0x0847('0x48')]({},_0x332d6c,_0x1bc5b6[_0x0847('0x49')]);return _0x134c0a[_0x0847('0x56')](_0x332d6c);}})[_0x0847('0x1e')](function(_0x1a7707){if(_0x1a7707){_0x37bdc6=_0x1a7707['length'];if(!_0x1bc5b6[_0x0847('0x3d')]['hasOwnProperty'](_0x0847('0x42'))){_0x332d6c[_0x0847('0x2b')]=qs[_0x0847('0x2b')](_0x1bc5b6['query'][_0x0847('0x2b')]);_0x332d6c[_0x0847('0x2a')]=qs[_0x0847('0x2a')](_0x1bc5b6[_0x0847('0x3d')]['offset']);}return _0x134c0a['getConfigurations'](_0x332d6c);}})[_0x0847('0x1e')](function(_0x491dd2){if(_0x491dd2){return _0x491dd2?{'count':_0x37bdc6,'rows':_0x491dd2}:null;}})['then'](respondWithResult(_0x4b0dd5,null))[_0x0847('0x4f')](handleError(_0x4b0dd5,null));};exports['addConfiguration']=function(_0x1ea726,_0x403564,_0x30bbdb){if(_0x1ea726[_0x0847('0x53')]['id']){delete _0x1ea726[_0x0847('0x53')]['id'];}return db[_0x0847('0x37')][_0x0847('0x57')]({'where':{'id':_0x1ea726[_0x0847('0x54')]['id']}})[_0x0847('0x1e')](handleEntityNotFound(_0x403564,null))[_0x0847('0x1e')](function(_0x5c16d0){if(_0x5c16d0){_0x1ea726[_0x0847('0x53')]['AccountId']=_0x5c16d0['id'];_0x1ea726[_0x0847('0x53')]['Subjects']=integrations['getSubjects'](_0x1ea726[_0x0847('0x53')][_0x0847('0x59')],_0x1ea726[_0x0847('0x53')][_0x0847('0x5a')]);_0x1ea726[_0x0847('0x53')][_0x0847('0x5b')]=integrations[_0x0847('0x5c')](_0x1ea726[_0x0847('0x53')]['channel'],_0x1ea726[_0x0847('0x53')][_0x0847('0x5a')]);return db[_0x0847('0x58')][_0x0847('0x52')](_0x1ea726[_0x0847('0x53')],{'include':[{'model':db[_0x0847('0x5d')],'as':_0x0847('0x5e')},{'model':db[_0x0847('0x5d')],'as':_0x0847('0x5b')}]});}return null;})[_0x0847('0x1e')](respondWithResult(_0x403564,null))[_0x0847('0x4f')](handleError(_0x403564,null));};var md5=require(_0x0847('0x5f'));exports[_0x0847('0x60')]=function(_0x11994f,_0x5d1ed3,_0x1fbedd){var _0x39de99=null;var _0x352464=null;var _0x55b922=null;var _0x3f5ff0=null;var _0x407d5e='';return db[_0x0847('0x37')][_0x0847('0x57')]({'where':{'id':_0x11994f[_0x0847('0x54')]['id']},'attributes':['id',_0x0847('0x33'),_0x0847('0x61'),_0x0847('0x62'),_0x0847('0x63'),_0x0847('0x64'),_0x0847('0x65'),_0x0847('0x66')]})[_0x0847('0x1e')](handleEntityNotFound(_0x5d1ed3,null))[_0x0847('0x1e')](function(_0x3f85d8){if(_0x3f85d8){_0x39de99=_0x3f85d8[_0x0847('0x61')];_0x352464=_0x3f85d8[_0x0847('0x66')];_0x55b922=_0x3f85d8[_0x0847('0x63')];_0x407d5e=_0x3f85d8[_0x0847('0x64')];var _0xface3d=_0x407d5e[_0x0847('0x67')](-0x1);if(_0xface3d==='/'){_0x407d5e=_0x407d5e[_0x0847('0x68')](0x0,_0x407d5e[_0x0847('0x69')](_0xface3d));}_0x3f5ff0=util[_0x0847('0x6a')]('%s/webservice.php',_0x407d5e);var _0x4ea6b0={'method':_0x0847('0x6b'),'uri':_0x3f5ff0,'qs':{'operation':_0x0847('0x6c'),'username':_0x3f85d8['username']},'json':!![]};return rp(_0x4ea6b0);}})[_0x0847('0x1e')](function(_0x289f81){if(_0x289f81['success']){var _0x47cfc2={'method':_0x0847('0x6d'),'uri':_0x3f5ff0,'form':{'operation':'login','username':_0x39de99,'accessKey':md5(_0x289f81[_0x0847('0x6e')]['token']+_0x352464)},'json':!![]};return rp(_0x47cfc2);}})[_0x0847('0x1e')](function(_0x446c4d){if(_0x446c4d['success']){var _0x2353da={'method':_0x0847('0x6b'),'uri':_0x3f5ff0,'qs':{'operation':_0x0847('0x6f'),'username':_0x39de99,'sessionName':_0x446c4d[_0x0847('0x6e')]['sessionName'],'elementType':_0x55b922},'json':!![]};return rp(_0x2353da);}})[_0x0847('0x1e')](function(_0x6768a9){if(_0x6768a9[_0x0847('0x70')]){var _0x151a7f=[_0x0847('0x71'),_0x0847('0x72'),'owner'];_[_0x0847('0x73')](_0x6768a9[_0x0847('0x6e')][_0x0847('0x3f')],function(_0x52c1f7){return _0x151a7f[_0x0847('0x74')](_0x52c1f7[_0x0847('0x5a')]['name']);});_[_0x0847('0x73')](_0x6768a9['result'][_0x0847('0x3f')],function(_0xdd1c27){return _0xdd1c27[_0x0847('0x75')]===_0x0847('0x76');});return{'count':_0x6768a9[_0x0847('0x6e')][_0x0847('0x3f')][_0x0847('0x51')],'rows':_[_0x0847('0x36')](_0x6768a9[_0x0847('0x6e')][_0x0847('0x3f')],function(_0x2082c9){return{'id':_0x2082c9[_0x0847('0x33')],'name':_0x2082c9['label'],'custom':_[_0x0847('0x77')](_0x2082c9[_0x0847('0x33')],_0x0847('0x78'))?!![]:![],'options':_0x2082c9[_0x0847('0x5a')][_0x0847('0x33')]==='picklist'&&_0x2082c9[_0x0847('0x5a')][_0x0847('0x79')][_0x0847('0x51')]>0x0?_[_0x0847('0x36')](_0x2082c9['type'][_0x0847('0x79')],function(_0x1c0630){return{'name':_0x1c0630[_0x0847('0x7a')],'value':_0x1c0630[_0x0847('0x7b')]};}):[]};})};}})['then'](respondWithResult(_0x5d1ed3,null))[_0x0847('0x4f')](function(_0x589fa1){console['log']('vTiger\x20error:\x20'+_0x589fa1);var _0x60ba45=_0x11994f['query']['test']?0x1f4:_0x589fa1[_0x0847('0x7c')]||0x1f4;logger['error'](_0x0847('0x7d'),'getFields',_0x60ba45,JSON[_0x0847('0x24')](_0x589fa1));delete _0x589fa1['name'];if(_0x60ba45===0x191){_0x60ba45=0x190;}_0x5d1ed3[_0x0847('0x27')](_0x60ba45)[_0x0847('0x34')](_0x11994f[_0x0847('0x3d')][_0x0847('0x19')]?{'message':_0x0847('0x7e'),'statusCode':_0x589fa1[_0x0847('0x7c')]}:_0x589fa1);});}; \ No newline at end of file +var _0x2c78=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','merge','options','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','accessKey','substring','lastIndexOf','%s/webservice.php','GET','success','POST','token','describe','sessionName','autogenerated','reference','includes','remove','false','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4dafd9,_0x414af8){var _0x589ce3=function(_0x34f0bf){while(--_0x34f0bf){_0x4dafd9['push'](_0x4dafd9['shift']());}};_0x589ce3(++_0x414af8);}(_0x2c78,0x17f));var _0x82c7=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x2c78[_0xd158dc];return _0x12d25f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82c7('0x0'));var rimraf=require(_0x82c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82c7('0x2'));var rp=require(_0x82c7('0x3'));var moment=require(_0x82c7('0x4'));var BPromise=require(_0x82c7('0x5'));var Mustache=require(_0x82c7('0x6'));var util=require(_0x82c7('0x7'));var path=require(_0x82c7('0x8'));var sox=require(_0x82c7('0x9'));var csv=require(_0x82c7('0xa'));var ejs=require(_0x82c7('0xb'));var fs=require('fs');var _=require(_0x82c7('0xc'));var squel=require('squel');var crypto=require(_0x82c7('0xd'));var jsforce=require(_0x82c7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x82c7('0xa'));var querystring=require(_0x82c7('0xf'));var Papa=require('papaparse');var Redis=require(_0x82c7('0x10'));var authService=require(_0x82c7('0x11'));var qs=require(_0x82c7('0x12'));var as=require(_0x82c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x82c7('0x14'));var utils=require(_0x82c7('0x15'));var config=require('../../config/environment');var db=require(_0x82c7('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x82c7('0x17'));var client=jayson[_0x82c7('0x18')][_0x82c7('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5b0439,_0x148cb7,_0xf07710){if(_0xf07710){var _0x588e69=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x588e69[_0x82c7('0x1a')](_0x148cb7)){return _0x5b0439;}else{throw new db['Sequelize'][(_0x82c7('0x1b'))](_0x82c7('0x1c'));}}else{return _0x5b0439;}}function respondWithRpcPromise(_0x5c282c,_0x1effd0,_0x3f38da,_0x2d51ea){return new BPromise(function(_0x5e7bf5,_0x4e9ed9){var _0x114b29=_0x2d51ea||client;return _0x114b29[_0x82c7('0x1d')](_0x5c282c,_0x3f38da)['then'](function(_0x5bb6e4){logger[_0x82c7('0x1e')](_0x82c7('0x1f'),_0x1effd0,_0x82c7('0x20'));logger[_0x82c7('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1effd0,_0x82c7('0x20'),JSON[_0x82c7('0x22')](_0x5bb6e4));if(_0x5bb6e4[_0x82c7('0x23')]){if(_0x5bb6e4[_0x82c7('0x23')][_0x82c7('0x24')]===0x1f4){logger[_0x82c7('0x23')](_0x82c7('0x1f'),_0x1effd0,_0x5bb6e4['error'][_0x82c7('0x25')]);return _0x4e9ed9(_0x5bb6e4[_0x82c7('0x23')][_0x82c7('0x25')]);}logger['error'](_0x82c7('0x1f'),_0x1effd0,_0x5bb6e4[_0x82c7('0x23')][_0x82c7('0x25')]);return _0x5e7bf5(_0x5bb6e4['error'][_0x82c7('0x25')]);}else{logger['info'](_0x82c7('0x1f'),_0x1effd0,_0x82c7('0x20'));_0x5e7bf5(_0x5bb6e4[_0x82c7('0x26')][_0x82c7('0x25')]);}})['catch'](function(_0x1b46b7){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1effd0,_0x1b46b7);_0x4e9ed9(_0x1b46b7);});});}function respondWithStatusCode(_0x107dd8,_0x1980cc){_0x1980cc=_0x1980cc||0xcc;return function(_0x4fd278){if(_0x4fd278){return _0x107dd8[_0x82c7('0x27')](_0x1980cc);}return _0x107dd8[_0x82c7('0x28')](_0x1980cc)[_0x82c7('0x29')]();};}function respondWithResult(_0x5c2739,_0x517336){_0x517336=_0x517336||0xc8;return function(_0x159ac0){if(_0x159ac0){return _0x5c2739[_0x82c7('0x28')](_0x517336)[_0x82c7('0x2a')](_0x159ac0);}};}function respondWithFilteredResult(_0x403b5b,_0x46e9f9){return function(_0x1c9ed6){if(_0x1c9ed6){var _0x10a123=_0x1c9ed6[_0x82c7('0x2b')],_0x4da67d=_0x46e9f9[_0x82c7('0x2c')],_0x5657d5=_0x46e9f9[_0x82c7('0x2c')]+_0x46e9f9[_0x82c7('0x2d')],_0x22a2ea;if(_0x5657d5>=_0x10a123){_0x5657d5=_0x10a123;_0x22a2ea=0xc8;}else{_0x22a2ea=0xce;}_0x403b5b[_0x82c7('0x28')](_0x22a2ea);return _0x403b5b[_0x82c7('0x2e')](_0x82c7('0x2f'),_0x4da67d+'-'+_0x5657d5+'/'+_0x10a123)[_0x82c7('0x2a')](_0x1c9ed6);}return null;};}function patchUpdates(_0x2fc560){return function(_0x1aef25){try{jsonpatch[_0x82c7('0x30')](_0x1aef25,_0x2fc560,!![]);}catch(_0x583d69){return BPromise[_0x82c7('0x31')](_0x583d69);}return _0x1aef25[_0x82c7('0x32')]();};}function saveUpdates(_0x2c11a6,_0x447bc8){return function(_0x519f94){if(_0x519f94){return _0x519f94[_0x82c7('0x33')](_0x2c11a6)[_0x82c7('0x34')](function(_0x5810be){return _0x5810be;});}return null;};}function removeEntity(_0x127e5c,_0x49706d){return function(_0x56eec0){if(_0x56eec0){return _0x56eec0[_0x82c7('0x35')]()[_0x82c7('0x34')](function(){_0x127e5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10b674,_0x3f8fd8){return function(_0x1486aa){if(!_0x1486aa){_0x10b674[_0x82c7('0x27')](0x194);}return _0x1486aa;};}function handleError(_0x2d548d,_0x19b141){_0x19b141=_0x19b141||0x1f4;return function(_0x405276){logger[_0x82c7('0x23')](_0x405276['stack']);if(_0x405276[_0x82c7('0x36')]){delete _0x405276['name'];}_0x2d548d[_0x82c7('0x28')](_0x19b141)['send'](_0x405276);};}exports[_0x82c7('0x37')]=function(_0x2ff80e,_0x12e6fb){var _0x3e7297={},_0x1d218f={},_0x8b181c={'count':0x0,'rows':[]};var _0x53e17b=_[_0x82c7('0x38')](db[_0x82c7('0x39')][_0x82c7('0x3a')],function(_0xc1dbeb){return{'name':_0xc1dbeb[_0x82c7('0x3b')],'type':_0xc1dbeb[_0x82c7('0x3c')]['key']};});_0x1d218f[_0x82c7('0x3d')]=_[_0x82c7('0x38')](_0x53e17b,_0x82c7('0x36'));_0x1d218f[_0x82c7('0x3e')]=_['keys'](_0x2ff80e[_0x82c7('0x3e')]);_0x1d218f[_0x82c7('0x3f')]=_[_0x82c7('0x40')](_0x1d218f[_0x82c7('0x3d')],_0x1d218f[_0x82c7('0x3e')]);_0x3e7297['attributes']=_[_0x82c7('0x40')](_0x1d218f[_0x82c7('0x3d')],qs[_0x82c7('0x41')](_0x2ff80e['query'][_0x82c7('0x41')]));_0x3e7297['attributes']=_0x3e7297['attributes'][_0x82c7('0x42')]?_0x3e7297[_0x82c7('0x43')]:_0x1d218f['model'];if(!_0x2ff80e[_0x82c7('0x3e')][_0x82c7('0x44')](_0x82c7('0x45'))){_0x3e7297['limit']=qs[_0x82c7('0x2d')](_0x2ff80e[_0x82c7('0x3e')][_0x82c7('0x2d')]);_0x3e7297['offset']=qs['offset'](_0x2ff80e['query'][_0x82c7('0x2c')]);}_0x3e7297[_0x82c7('0x46')]=qs[_0x82c7('0x47')](_0x2ff80e['query'][_0x82c7('0x47')]);_0x3e7297[_0x82c7('0x48')]=qs[_0x82c7('0x3f')](_[_0x82c7('0x49')](_0x2ff80e[_0x82c7('0x3e')],_0x1d218f[_0x82c7('0x3f')]),_0x53e17b);if(_0x2ff80e[_0x82c7('0x3e')][_0x82c7('0x4a')]){_0x3e7297[_0x82c7('0x48')]=_['merge'](_0x3e7297[_0x82c7('0x48')],{'$or':_['map'](_0x53e17b,function(_0x5ab9f4){if(_0x5ab9f4['type']!==_0x82c7('0x4b')){var _0x2d4380={};_0x2d4380[_0x5ab9f4['name']]={'$like':'%'+_0x2ff80e['query'][_0x82c7('0x4a')]+'%'};return _0x2d4380;}})});}_0x3e7297=_['merge']({},_0x3e7297,_0x2ff80e['options']);var _0x4ffd16={'where':_0x3e7297[_0x82c7('0x48')]};return db['VtigerAccount'][_0x82c7('0x2b')](_0x4ffd16)['then'](function(_0x1d09e6){_0x8b181c['count']=_0x1d09e6;if(_0x2ff80e[_0x82c7('0x3e')][_0x82c7('0x4c')]){_0x3e7297[_0x82c7('0x4d')]=[{'all':!![]}];}return db[_0x82c7('0x39')][_0x82c7('0x4e')](_0x3e7297);})[_0x82c7('0x34')](function(_0x4e5374){_0x8b181c[_0x82c7('0x4f')]=_0x4e5374;return _0x8b181c;})['then'](respondWithFilteredResult(_0x12e6fb,_0x3e7297))[_0x82c7('0x50')](handleError(_0x12e6fb,null));};exports[_0x82c7('0x51')]=function(_0x27a5c9,_0x560a32){var _0x44fe9f={'raw':![],'where':{'id':_0x27a5c9['params']['id']}},_0x497f7a={};_0x497f7a['model']=_[_0x82c7('0x52')](db[_0x82c7('0x39')][_0x82c7('0x3a')]);_0x497f7a[_0x82c7('0x3e')]=_[_0x82c7('0x52')](_0x27a5c9[_0x82c7('0x3e')]);_0x497f7a['filters']=_['intersection'](_0x497f7a[_0x82c7('0x3d')],_0x497f7a[_0x82c7('0x3e')]);_0x44fe9f[_0x82c7('0x43')]=_[_0x82c7('0x40')](_0x497f7a[_0x82c7('0x3d')],qs[_0x82c7('0x41')](_0x27a5c9[_0x82c7('0x3e')][_0x82c7('0x41')]));_0x44fe9f['attributes']=_0x44fe9f['attributes']['length']?_0x44fe9f['attributes']:_0x497f7a[_0x82c7('0x3d')];if(_0x27a5c9[_0x82c7('0x3e')][_0x82c7('0x4c')]){_0x44fe9f[_0x82c7('0x4d')]=[{'all':!![]}];}_0x44fe9f=_[_0x82c7('0x53')]({},_0x44fe9f,_0x27a5c9[_0x82c7('0x54')]);return db['VtigerAccount'][_0x82c7('0x55')](_0x44fe9f)['then'](handleEntityNotFound(_0x560a32,null))[_0x82c7('0x34')](respondWithResult(_0x560a32,null))['catch'](handleError(_0x560a32,null));};exports['create']=function(_0x494946,_0x461059){return db[_0x82c7('0x39')][_0x82c7('0x56')](_0x494946[_0x82c7('0x57')],{})['then'](respondWithResult(_0x461059,0xc9))[_0x82c7('0x50')](handleError(_0x461059,null));};exports[_0x82c7('0x33')]=function(_0xede581,_0x5e60f6){if(_0xede581['body']['id']){delete _0xede581[_0x82c7('0x57')]['id'];}return db[_0x82c7('0x39')][_0x82c7('0x55')]({'where':{'id':_0xede581['params']['id']}})[_0x82c7('0x34')](handleEntityNotFound(_0x5e60f6,null))[_0x82c7('0x34')](saveUpdates(_0xede581[_0x82c7('0x57')],null))[_0x82c7('0x34')](respondWithResult(_0x5e60f6,null))['catch'](handleError(_0x5e60f6,null));};exports[_0x82c7('0x35')]=function(_0x30e47e,_0x119072){return db[_0x82c7('0x39')][_0x82c7('0x55')]({'where':{'id':_0x30e47e[_0x82c7('0x58')]['id']}})[_0x82c7('0x34')](handleEntityNotFound(_0x119072,null))[_0x82c7('0x34')](removeEntity(_0x119072,null))[_0x82c7('0x50')](handleError(_0x119072,null));};exports[_0x82c7('0x59')]=function(_0x20e9cc,_0x1b3944,_0x4e0238){var _0x346650={};var _0x3b2d80={};var _0x25af5d;var _0x52f000;return db[_0x82c7('0x39')][_0x82c7('0x5a')]({'where':{'id':_0x20e9cc[_0x82c7('0x58')]['id']}})[_0x82c7('0x34')](handleEntityNotFound(_0x1b3944,null))[_0x82c7('0x34')](function(_0x591952){if(_0x591952){_0x25af5d=_0x591952;_0x3b2d80[_0x82c7('0x3d')]=_[_0x82c7('0x52')](db[_0x82c7('0x5b')][_0x82c7('0x3a')]);_0x3b2d80[_0x82c7('0x3e')]=_['keys'](_0x20e9cc[_0x82c7('0x3e')]);_0x3b2d80[_0x82c7('0x3f')]=_[_0x82c7('0x40')](_0x3b2d80[_0x82c7('0x3d')],_0x3b2d80[_0x82c7('0x3e')]);_0x346650[_0x82c7('0x43')]=_[_0x82c7('0x40')](_0x3b2d80[_0x82c7('0x3d')],qs[_0x82c7('0x41')](_0x20e9cc[_0x82c7('0x3e')]['fields']));_0x346650[_0x82c7('0x43')]=_0x346650[_0x82c7('0x43')][_0x82c7('0x42')]?_0x346650[_0x82c7('0x43')]:_0x3b2d80[_0x82c7('0x3d')];_0x346650[_0x82c7('0x46')]=qs[_0x82c7('0x47')](_0x20e9cc[_0x82c7('0x3e')][_0x82c7('0x47')]);_0x346650['where']=qs[_0x82c7('0x3f')](_[_0x82c7('0x49')](_0x20e9cc[_0x82c7('0x3e')],_0x3b2d80[_0x82c7('0x3f')]));if(_0x20e9cc['query'][_0x82c7('0x4a')]){_0x346650[_0x82c7('0x48')]=_[_0x82c7('0x53')](_0x346650[_0x82c7('0x48')],{'$or':_[_0x82c7('0x38')](_0x346650[_0x82c7('0x43')],function(_0x87d657){var _0x2db77b={};_0x2db77b[_0x87d657]={'$like':'%'+_0x20e9cc[_0x82c7('0x3e')][_0x82c7('0x4a')]+'%'};return _0x2db77b;})});}_0x346650=_['merge']({},_0x346650,_0x20e9cc[_0x82c7('0x54')]);return _0x25af5d['getConfigurations'](_0x346650);}})[_0x82c7('0x34')](function(_0xc68471){if(_0xc68471){_0x52f000=_0xc68471[_0x82c7('0x42')];if(!_0x20e9cc[_0x82c7('0x3e')][_0x82c7('0x44')](_0x82c7('0x45'))){_0x346650['limit']=qs[_0x82c7('0x2d')](_0x20e9cc[_0x82c7('0x3e')][_0x82c7('0x2d')]);_0x346650[_0x82c7('0x2c')]=qs[_0x82c7('0x2c')](_0x20e9cc[_0x82c7('0x3e')][_0x82c7('0x2c')]);}return _0x25af5d[_0x82c7('0x59')](_0x346650);}})[_0x82c7('0x34')](function(_0x3d90fe){if(_0x3d90fe){return _0x3d90fe?{'count':_0x52f000,'rows':_0x3d90fe}:null;}})[_0x82c7('0x34')](respondWithResult(_0x1b3944,null))[_0x82c7('0x50')](handleError(_0x1b3944,null));};exports[_0x82c7('0x5c')]=function(_0x133a0b,_0x2e01d1,_0x7bee2f){if(_0x133a0b[_0x82c7('0x57')]['id']){delete _0x133a0b['body']['id'];}return db['VtigerAccount'][_0x82c7('0x5a')]({'where':{'id':_0x133a0b[_0x82c7('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e01d1,null))[_0x82c7('0x34')](function(_0x13f717){if(_0x13f717){_0x133a0b[_0x82c7('0x57')][_0x82c7('0x5d')]=_0x13f717['id'];_0x133a0b[_0x82c7('0x57')][_0x82c7('0x5e')]=integrations[_0x82c7('0x5f')](_0x133a0b['body'][_0x82c7('0x60')],_0x133a0b[_0x82c7('0x57')]['type']);_0x133a0b[_0x82c7('0x57')][_0x82c7('0x61')]=integrations[_0x82c7('0x62')](_0x133a0b[_0x82c7('0x57')]['channel'],_0x133a0b[_0x82c7('0x57')]['type']);return db[_0x82c7('0x5b')]['create'](_0x133a0b[_0x82c7('0x57')],{'include':[{'model':db[_0x82c7('0x63')],'as':_0x82c7('0x5e')},{'model':db[_0x82c7('0x63')],'as':'Descriptions'}]});}return null;})[_0x82c7('0x34')](respondWithResult(_0x2e01d1,null))['catch'](handleError(_0x2e01d1,null));};var md5=require(_0x82c7('0x64'));exports['getFields']=function(_0x2aae43,_0x279274,_0x257596){var _0x47ad15=null;var _0x3dc15=null;var _0x284593=null;var _0xe0373a=null;var _0x11626f='';return db[_0x82c7('0x39')][_0x82c7('0x5a')]({'where':{'id':_0x2aae43[_0x82c7('0x58')]['id']},'attributes':['id','name',_0x82c7('0x65'),_0x82c7('0x66'),_0x82c7('0x67'),_0x82c7('0x68'),'serverUrl',_0x82c7('0x69')]})[_0x82c7('0x34')](handleEntityNotFound(_0x279274,null))[_0x82c7('0x34')](function(_0x8af6d2){if(_0x8af6d2){_0x47ad15=_0x8af6d2[_0x82c7('0x65')];_0x3dc15=_0x8af6d2[_0x82c7('0x69')];_0x284593=_0x8af6d2[_0x82c7('0x67')];_0x11626f=_0x8af6d2[_0x82c7('0x68')];var _0x3b8889=_0x11626f['slice'](-0x1);if(_0x3b8889==='/'){_0x11626f=_0x11626f[_0x82c7('0x6a')](0x0,_0x11626f[_0x82c7('0x6b')](_0x3b8889));}_0xe0373a=util['format'](_0x82c7('0x6c'),_0x11626f);var _0x5dc502={'method':_0x82c7('0x6d'),'uri':_0xe0373a,'qs':{'operation':'getchallenge','username':_0x8af6d2[_0x82c7('0x65')]},'json':!![]};return rp(_0x5dc502);}})['then'](function(_0x43ac74){if(_0x43ac74[_0x82c7('0x6e')]){var _0x27f28c={'method':_0x82c7('0x6f'),'uri':_0xe0373a,'form':{'operation':'login','username':_0x47ad15,'accessKey':md5(_0x43ac74['result'][_0x82c7('0x70')]+_0x3dc15)},'json':!![]};return rp(_0x27f28c);}})[_0x82c7('0x34')](function(_0x3089e1){if(_0x3089e1[_0x82c7('0x6e')]){var _0x5a15c9={'method':_0x82c7('0x6d'),'uri':_0xe0373a,'qs':{'operation':_0x82c7('0x71'),'username':_0x47ad15,'sessionName':_0x3089e1[_0x82c7('0x26')][_0x82c7('0x72')],'elementType':_0x284593},'json':!![]};return rp(_0x5a15c9);}})[_0x82c7('0x34')](function(_0x38a0b8){if(_0x38a0b8[_0x82c7('0x6e')]){var _0x39be9d=[_0x82c7('0x73'),_0x82c7('0x74'),'owner'];_['remove'](_0x38a0b8[_0x82c7('0x26')][_0x82c7('0x41')],function(_0x1a502d){return _0x39be9d[_0x82c7('0x75')](_0x1a502d[_0x82c7('0x3c')][_0x82c7('0x36')]);});_[_0x82c7('0x76')](_0x38a0b8[_0x82c7('0x26')][_0x82c7('0x41')],function(_0x2518a9){return _0x2518a9['editable']===_0x82c7('0x77');});return{'count':_0x38a0b8[_0x82c7('0x26')]['fields'][_0x82c7('0x42')],'rows':_[_0x82c7('0x38')](_0x38a0b8[_0x82c7('0x26')][_0x82c7('0x41')],function(_0x1fdada){return{'id':_0x1fdada[_0x82c7('0x36')],'name':_0x1fdada['label'],'custom':_['startsWith'](_0x1fdada['name'],_0x82c7('0x78'))?!![]:![],'options':_0x1fdada[_0x82c7('0x3c')][_0x82c7('0x36')]===_0x82c7('0x79')&&_0x1fdada[_0x82c7('0x3c')][_0x82c7('0x7a')]['length']>0x0?_['map'](_0x1fdada[_0x82c7('0x3c')][_0x82c7('0x7a')],function(_0x4617f1){return{'name':_0x4617f1['label'],'value':_0x4617f1[_0x82c7('0x7b')]};}):[]};})};}})['then'](respondWithResult(_0x279274,null))[_0x82c7('0x50')](function(_0xc384e3){console[_0x82c7('0x7c')](_0x82c7('0x7d')+_0xc384e3);var _0x2d4946=_0x2aae43['query']['test']?0x1f4:_0xc384e3[_0x82c7('0x7e')]||0x1f4;logger[_0x82c7('0x23')](_0x82c7('0x7f'),_0x82c7('0x80'),_0x2d4946,JSON[_0x82c7('0x22')](_0xc384e3));delete _0xc384e3['name'];if(_0x2d4946===0x191){_0x2d4946=0x190;}_0x279274['status'](_0x2d4946)['send'](_0x2aae43[_0x82c7('0x3e')]['test']?{'message':_0x82c7('0x81'),'statusCode':_0xc384e3[_0x82c7('0x7e')]}:_0xc384e3);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 30f5e53..a1952de 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 _0x6722=['VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports'];(function(_0x5a056e,_0x382a98){var _0x5e1dab=function(_0x1059a4){while(--_0x1059a4){_0x5a056e['push'](_0x5a056e['shift']());}};_0x5e1dab(++_0x382a98);}(_0x6722,0x115));var _0x2672=function(_0x4a9be3,_0x2a9ff7){_0x4a9be3=_0x4a9be3-0x0;var _0x214bc0=_0x6722[_0x4a9be3];return _0x214bc0;};'use strict';var _=require(_0x2672('0x0'));var util=require(_0x2672('0x1'));var logger=require(_0x2672('0x2'))(_0x2672('0x3'));var moment=require(_0x2672('0x4'));var BPromise=require(_0x2672('0x5'));var rp=require(_0x2672('0x6'));var fs=require('fs');var path=require(_0x2672('0x7'));var rimraf=require(_0x2672('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x2672('0x9'));module[_0x2672('0xa')]=function(_0x76bd0f,_0x2d0f1c){return _0x76bd0f['define'](_0x2672('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd54f=['rimraf','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x540f7a,_0x1decbc){var _0x175033=function(_0x23cee6){while(--_0x23cee6){_0x540f7a['push'](_0x540f7a['shift']());}};_0x175033(++_0x1decbc);}(_0xd54f,0x138));var _0xfd54=function(_0x5e80a1,_0x5558fa){_0x5e80a1=_0x5e80a1-0x0;var _0x2290fc=_0xd54f[_0x5e80a1];return _0x2290fc;};'use strict';var _=require(_0xfd54('0x0'));var util=require(_0xfd54('0x1'));var logger=require(_0xfd54('0x2'))(_0xfd54('0x3'));var moment=require(_0xfd54('0x4'));var BPromise=require(_0xfd54('0x5'));var rp=require(_0xfd54('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd54('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xfd54('0x8')]=function(_0x979fb1,_0x2c3783){return _0x979fb1[_0xfd54('0x9')]('VtigerAccount',attributes,{'tableName':_0xfd54('0xa'),'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 dd47735..2edd733 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 _0xc5b5=['catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','find','then','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x22c2da,_0x569b31){var _0x65a816=function(_0x42c4ef){while(--_0x42c4ef){_0x22c2da['push'](_0x22c2da['shift']());}};_0x65a816(++_0x569b31);}(_0xc5b5,0x19b));var _0x5c5b=function(_0x6c59fc,_0x5fe88d){_0x6c59fc=_0x6c59fc-0x0;var _0x17c96f=_0xc5b5[_0x6c59fc];return _0x17c96f;};'use strict';var _=require(_0x5c5b('0x0'));var util=require(_0x5c5b('0x1'));var moment=require(_0x5c5b('0x2'));var BPromise=require(_0x5c5b('0x3'));var rs=require(_0x5c5b('0x4'));var fs=require('fs');var Redis=require(_0x5c5b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5c5b('0x6'))(_0x5c5b('0x7'));var config=require(_0x5c5b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x291545,_0x59dd57,_0x14d733){return new BPromise(function(_0x24e45d,_0x4073e5){return client['request'](_0x291545,_0x14d733)['then'](function(_0x363fd1){logger[_0x5c5b('0xa')](_0x5c5b('0xb'),_0x59dd57,'request\x20sent');logger['debug'](_0x5c5b('0xc'),_0x59dd57,_0x5c5b('0xd'),JSON[_0x5c5b('0xe')](_0x363fd1));if(_0x363fd1[_0x5c5b('0xf')]){if(_0x363fd1[_0x5c5b('0xf')][_0x5c5b('0x10')]===0x1f4){logger[_0x5c5b('0xf')](_0x5c5b('0xb'),_0x59dd57,_0x363fd1[_0x5c5b('0xf')]['message']);return _0x4073e5(_0x363fd1['error']['message']);}logger[_0x5c5b('0xf')](_0x5c5b('0xb'),_0x59dd57,_0x363fd1['error']['message']);return _0x24e45d(_0x363fd1[_0x5c5b('0xf')][_0x5c5b('0x11')]);}else{logger['info'](_0x5c5b('0xb'),_0x59dd57,_0x5c5b('0xd'));_0x24e45d(_0x363fd1['result']['message']);}})[_0x5c5b('0x12')](function(_0x3b8deb){logger[_0x5c5b('0xf')](_0x5c5b('0xb'),_0x59dd57,_0x3b8deb);_0x4073e5(_0x3b8deb);});});}exports[_0x5c5b('0x13')]=function(_0x58cee6){var _0x3d68a3=this;return new Promise(function(_0x4ac7c7,_0x5e310a){return db['VtigerAccount'][_0x5c5b('0x14')]({'raw':_0x58cee6[_0x5c5b('0x15')]?_0x58cee6[_0x5c5b('0x15')][_0x5c5b('0x16')]===undefined?!![]:![]:!![],'where':_0x58cee6[_0x5c5b('0x15')]?_0x58cee6[_0x5c5b('0x15')][_0x5c5b('0x17')]||null:null,'attributes':_0x58cee6[_0x5c5b('0x15')]?_0x58cee6[_0x5c5b('0x15')][_0x5c5b('0x18')]||null:null,'limit':_0x58cee6['options']?_0x58cee6[_0x5c5b('0x15')][_0x5c5b('0x19')]||null:null,'include':_0x58cee6[_0x5c5b('0x15')]?_0x58cee6[_0x5c5b('0x15')]['include']?_[_0x5c5b('0x1a')](_0x58cee6[_0x5c5b('0x15')][_0x5c5b('0x1b')],function(_0x88570e){return{'model':db[_0x88570e[_0x5c5b('0x1c')]],'as':_0x88570e['as'],'attributes':_0x88570e[_0x5c5b('0x18')],'include':_0x88570e[_0x5c5b('0x1b')]?_[_0x5c5b('0x1a')](_0x88570e[_0x5c5b('0x1b')],function(_0x5a2613){return{'model':db[_0x5a2613[_0x5c5b('0x1c')]],'as':_0x5a2613['as'],'attributes':_0x5a2613['attributes'],'include':_0x5a2613['include']?_[_0x5c5b('0x1a')](_0x5a2613['include'],function(_0x3b4141){return{'model':db[_0x3b4141[_0x5c5b('0x1c')]],'as':_0x3b4141['as'],'attributes':_0x3b4141['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b5b51){logger[_0x5c5b('0xa')](_0x5c5b('0x13'),_0x58cee6);logger[_0x5c5b('0x1d')](_0x5c5b('0x13'),_0x58cee6,JSON[_0x5c5b('0xe')](_0x5b5b51));_0x4ac7c7(_0x5b5b51);})['catch'](function(_0x2e009b){logger['error'](_0x5c5b('0x13'),_0x2e009b['message'],_0x58cee6);_0x5e310a(_0x3d68a3[_0x5c5b('0xf')](0x1f4,_0x2e009b[_0x5c5b('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x1d9dbf){var _0x101c80=this;return new Promise(function(_0x49f944,_0x4bea69){return db['VtigerAccount'][_0x5c5b('0x1e')]({'raw':_0x1d9dbf['options']?_0x1d9dbf[_0x5c5b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d9dbf[_0x5c5b('0x15')]?_0x1d9dbf[_0x5c5b('0x15')]['where']||null:null,'attributes':_0x1d9dbf[_0x5c5b('0x15')]?_0x1d9dbf['options']['attributes']||null:null,'include':_0x1d9dbf[_0x5c5b('0x15')]?_0x1d9dbf[_0x5c5b('0x15')][_0x5c5b('0x1b')]?_['map'](_0x1d9dbf[_0x5c5b('0x15')]['include'],function(_0x2be045){return{'model':db[_0x2be045[_0x5c5b('0x1c')]],'as':_0x2be045['as'],'attributes':_0x2be045[_0x5c5b('0x18')],'include':_0x2be045['include']?_[_0x5c5b('0x1a')](_0x2be045[_0x5c5b('0x1b')],function(_0x2f516b){return{'model':db[_0x2f516b['model']],'as':_0x2f516b['as'],'attributes':_0x2f516b[_0x5c5b('0x18')],'include':_0x2f516b[_0x5c5b('0x1b')]?_[_0x5c5b('0x1a')](_0x2f516b['include'],function(_0x36f067){return{'model':db[_0x36f067[_0x5c5b('0x1c')]],'as':_0x36f067['as'],'attributes':_0x36f067[_0x5c5b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5c5b('0x1f')](function(_0x252f85){logger[_0x5c5b('0xa')]('ShowVtigerAccount',_0x1d9dbf);logger[_0x5c5b('0x1d')](_0x5c5b('0x20'),_0x1d9dbf,JSON[_0x5c5b('0xe')](_0x252f85));_0x49f944(_0x252f85);})[_0x5c5b('0x12')](function(_0x4db682){logger[_0x5c5b('0xf')]('ShowVtigerAccount',_0x4db682['message'],_0x1d9dbf);_0x4bea69(_0x101c80[_0x5c5b('0xf')](0x1f4,_0x4db682['message']));});});}; \ No newline at end of file +var _0x0969=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','map','model','include','then','ShowVtigerAccount','find','raw','lodash','moment','bluebird'];(function(_0x434734,_0x4d6b17){var _0x2d44c9=function(_0x508fb2){while(--_0x508fb2){_0x434734['push'](_0x434734['shift']());}};_0x2d44c9(++_0x4d6b17);}(_0x0969,0x89));var _0x9096=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0969[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9096('0x0'));var util=require('util');var moment=require(_0x9096('0x1'));var BPromise=require(_0x9096('0x2'));var rs=require(_0x9096('0x3'));var fs=require('fs');var Redis=require(_0x9096('0x4'));var db=require(_0x9096('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9096('0x6'))(_0x9096('0x7'));var config=require('../../config/environment');var jayson=require(_0x9096('0x8'));var client=jayson['client'][_0x9096('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31760e,_0x2165ca,_0x3fd5c1){return new BPromise(function(_0x307a27,_0x371d27){return client[_0x9096('0xa')](_0x31760e,_0x3fd5c1)['then'](function(_0x401567){logger[_0x9096('0xb')](_0x9096('0xc'),_0x2165ca,_0x9096('0xd'));logger[_0x9096('0xe')](_0x9096('0xf'),_0x2165ca,_0x9096('0xd'),JSON[_0x9096('0x10')](_0x401567));if(_0x401567[_0x9096('0x11')]){if(_0x401567['error'][_0x9096('0x12')]===0x1f4){logger[_0x9096('0x11')](_0x9096('0xc'),_0x2165ca,_0x401567['error']['message']);return _0x371d27(_0x401567[_0x9096('0x11')][_0x9096('0x13')]);}logger[_0x9096('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x2165ca,_0x401567[_0x9096('0x11')][_0x9096('0x13')]);return _0x307a27(_0x401567[_0x9096('0x11')]['message']);}else{logger[_0x9096('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x2165ca,_0x9096('0xd'));_0x307a27(_0x401567[_0x9096('0x14')][_0x9096('0x13')]);}})[_0x9096('0x15')](function(_0x3901a2){logger[_0x9096('0x11')](_0x9096('0xc'),_0x2165ca,_0x3901a2);_0x371d27(_0x3901a2);});});}exports[_0x9096('0x16')]=function(_0x2280ca){var _0x33f1f8=this;return new Promise(function(_0x3eb939,_0x5a5bbe){return db[_0x9096('0x17')][_0x9096('0x18')]({'raw':_0x2280ca[_0x9096('0x19')]?_0x2280ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x2280ca[_0x9096('0x19')]?_0x2280ca[_0x9096('0x19')]['where']||null:null,'attributes':_0x2280ca[_0x9096('0x19')]?_0x2280ca[_0x9096('0x19')][_0x9096('0x1a')]||null:null,'limit':_0x2280ca[_0x9096('0x19')]?_0x2280ca[_0x9096('0x19')][_0x9096('0x1b')]||null:null,'include':_0x2280ca[_0x9096('0x19')]?_0x2280ca['options']['include']?_['map'](_0x2280ca[_0x9096('0x19')]['include'],function(_0x364e09){return{'model':db[_0x364e09['model']],'as':_0x364e09['as'],'attributes':_0x364e09[_0x9096('0x1a')],'include':_0x364e09['include']?_[_0x9096('0x1c')](_0x364e09['include'],function(_0x2857e8){return{'model':db[_0x2857e8[_0x9096('0x1d')]],'as':_0x2857e8['as'],'attributes':_0x2857e8[_0x9096('0x1a')],'include':_0x2857e8['include']?_['map'](_0x2857e8[_0x9096('0x1e')],function(_0x543c5c){return{'model':db[_0x543c5c['model']],'as':_0x543c5c['as'],'attributes':_0x543c5c[_0x9096('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9096('0x1f')](function(_0x507973){logger[_0x9096('0xb')](_0x9096('0x16'),_0x2280ca);logger[_0x9096('0xe')](_0x9096('0x16'),_0x2280ca,JSON[_0x9096('0x10')](_0x507973));_0x3eb939(_0x507973);})[_0x9096('0x15')](function(_0x3b05d1){logger[_0x9096('0x11')]('GetVtigerAccount',_0x3b05d1[_0x9096('0x13')],_0x2280ca);_0x5a5bbe(_0x33f1f8[_0x9096('0x11')](0x1f4,_0x3b05d1[_0x9096('0x13')]));});});};exports[_0x9096('0x20')]=function(_0x31ba4d){var _0x52d8eb=this;return new Promise(function(_0xd43f58,_0xd375d5){return db[_0x9096('0x17')][_0x9096('0x21')]({'raw':_0x31ba4d[_0x9096('0x19')]?_0x31ba4d[_0x9096('0x19')][_0x9096('0x22')]===undefined?!![]:![]:!![],'where':_0x31ba4d[_0x9096('0x19')]?_0x31ba4d[_0x9096('0x19')]['where']||null:null,'attributes':_0x31ba4d['options']?_0x31ba4d[_0x9096('0x19')]['attributes']||null:null,'include':_0x31ba4d[_0x9096('0x19')]?_0x31ba4d[_0x9096('0x19')][_0x9096('0x1e')]?_[_0x9096('0x1c')](_0x31ba4d[_0x9096('0x19')][_0x9096('0x1e')],function(_0x2ba22f){return{'model':db[_0x2ba22f[_0x9096('0x1d')]],'as':_0x2ba22f['as'],'attributes':_0x2ba22f[_0x9096('0x1a')],'include':_0x2ba22f[_0x9096('0x1e')]?_[_0x9096('0x1c')](_0x2ba22f[_0x9096('0x1e')],function(_0x48d1c8){return{'model':db[_0x48d1c8['model']],'as':_0x48d1c8['as'],'attributes':_0x48d1c8['attributes'],'include':_0x48d1c8[_0x9096('0x1e')]?_[_0x9096('0x1c')](_0x48d1c8[_0x9096('0x1e')],function(_0x510ab5){return{'model':db[_0x510ab5[_0x9096('0x1d')]],'as':_0x510ab5['as'],'attributes':_0x510ab5[_0x9096('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9096('0x1f')](function(_0x9d6870){logger[_0x9096('0xb')](_0x9096('0x20'),_0x31ba4d);logger['debug'](_0x9096('0x20'),_0x31ba4d,JSON['stringify'](_0x9d6870));_0xd43f58(_0x9d6870);})[_0x9096('0x15')](function(_0x2ab14d){logger[_0x9096('0x11')](_0x9096('0x20'),_0x2ab14d[_0x9096('0x13')],_0x31ba4d);_0xd375d5(_0x52d8eb[_0x9096('0x11')](0x1f4,_0x2ab14d[_0x9096('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 27fe312..9a7a11a 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 _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x255c06,_0x54e6a4){var _0x50a4cd=function(_0x5e1d91){while(--_0x5e1d91){_0x255c06['push'](_0x255c06['shift']());}};_0x50a4cd(++_0x54e6a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xb10b[_0x1ee0a1];return _0x1d2d5b;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c6a0f46..dd9544c 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 _0x1b63=['sequelize','STRING'];(function(_0x2523e9,_0x4155e6){var _0x552155=function(_0x1b1278){while(--_0x1b1278){_0x2523e9['push'](_0x2523e9['shift']());}};_0x552155(++_0x4155e6);}(_0x1b63,0xf2));var _0x31b6=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x1b63[_0x42bafd];return _0x2ed705;};'use strict';var Sequelize=require(_0x31b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x31b6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe165=['sequelize','exports'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe165,0xfc));var _0x5e16=function(_0x9fbee0,_0x318bb9){_0x9fbee0=_0x9fbee0-0x0;var _0xd82e36=_0xe165[_0x9fbee0];return _0xd82e36;};'use strict';var Sequelize=require(_0x5e16('0x0'));module[_0x5e16('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 71569cf..e8c2fdd 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 _0x4747=['includeAll','include','findAll','catch','show','params','keys','create','body','find','findOne','getFields','getSubjects','VtigerField','hasOwnProperty','getDescriptions','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','error','code','VtigerConfiguration,\x20%s,\x20%s','message','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x4eea1c,_0x2f3d2f){var _0x186b5d=function(_0xecfdf3){while(--_0xecfdf3){_0x4eea1c['push'](_0x4eea1c['shift']());}};_0x186b5d(++_0x2f3d2f);}(_0x4747,0xc9));var _0x7474=function(_0x43d8be,_0x5d5e50){_0x43d8be=_0x43d8be-0x0;var _0x4adaac=_0x4747[_0x43d8be];return _0x4adaac;};'use strict';var pdf=require(_0x7474('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7474('0x1'));var zipdir=require(_0x7474('0x2'));var jsonpatch=require(_0x7474('0x3'));var rp=require(_0x7474('0x4'));var moment=require('moment');var BPromise=require(_0x7474('0x5'));var Mustache=require(_0x7474('0x6'));var util=require(_0x7474('0x7'));var path=require(_0x7474('0x8'));var sox=require('sox');var csv=require(_0x7474('0x9'));var ejs=require(_0x7474('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7474('0xb'));var crypto=require(_0x7474('0xc'));var jsforce=require(_0x7474('0xd'));var deskjs=require(_0x7474('0xe'));var toCsv=require(_0x7474('0x9'));var querystring=require(_0x7474('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7474('0x10'));var qs=require(_0x7474('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7474('0x12'));var logger=require(_0x7474('0x13'))(_0x7474('0x14'));var utils=require(_0x7474('0x15'));var config=require(_0x7474('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7474('0x17'));var client=jayson['client'][_0x7474('0x18')]({'port':0x232a});function checkPasswordPattern(_0x491e9c,_0x3d7aa9,_0x4dd104){if(_0x4dd104){var _0x57db19=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57db19[_0x7474('0x19')](_0x3d7aa9)){return _0x491e9c;}else{throw new db[(_0x7474('0x1a'))][(_0x7474('0x1b'))](_0x7474('0x1c'));}}else{return _0x491e9c;}}function respondWithRpcPromise(_0x12aee0,_0x2f28d1,_0x2a5d41,_0x105659){return new BPromise(function(_0xba7bc9,_0x2a69cc){var _0x124aa2=_0x105659||client;return _0x124aa2[_0x7474('0x1d')](_0x12aee0,_0x2a5d41)['then'](function(_0x2cbf1d){logger[_0x7474('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f28d1,_0x7474('0x1f'));logger[_0x7474('0x20')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2f28d1,_0x7474('0x1f'),JSON['stringify'](_0x2cbf1d));if(_0x2cbf1d[_0x7474('0x21')]){if(_0x2cbf1d[_0x7474('0x21')][_0x7474('0x22')]===0x1f4){logger[_0x7474('0x21')](_0x7474('0x23'),_0x2f28d1,_0x2cbf1d['error'][_0x7474('0x24')]);return _0x2a69cc(_0x2cbf1d[_0x7474('0x21')][_0x7474('0x24')]);}logger[_0x7474('0x21')](_0x7474('0x23'),_0x2f28d1,_0x2cbf1d[_0x7474('0x21')][_0x7474('0x24')]);return _0xba7bc9(_0x2cbf1d[_0x7474('0x21')][_0x7474('0x24')]);}else{logger['info'](_0x7474('0x23'),_0x2f28d1,_0x7474('0x1f'));_0xba7bc9(_0x2cbf1d['result'][_0x7474('0x24')]);}})['catch'](function(_0xcd9e45){logger[_0x7474('0x21')](_0x7474('0x23'),_0x2f28d1,_0xcd9e45);_0x2a69cc(_0xcd9e45);});});}function respondWithStatusCode(_0x4dc22b,_0x4c0d10){_0x4c0d10=_0x4c0d10||0xcc;return function(_0x11a431){if(_0x11a431){return _0x4dc22b['sendStatus'](_0x4c0d10);}return _0x4dc22b[_0x7474('0x25')](_0x4c0d10)['end']();};}function respondWithResult(_0x2f2458,_0x2bcaa5){_0x2bcaa5=_0x2bcaa5||0xc8;return function(_0x3e295b){if(_0x3e295b){return _0x2f2458[_0x7474('0x25')](_0x2bcaa5)[_0x7474('0x26')](_0x3e295b);}};}function respondWithFilteredResult(_0x1b5113,_0x515739){return function(_0xfa74ca){if(_0xfa74ca){var _0x5cb724=_0xfa74ca[_0x7474('0x27')],_0x5bfb0d=_0x515739[_0x7474('0x28')],_0x5b2066=_0x515739['offset']+_0x515739[_0x7474('0x29')],_0x592fe4;if(_0x5b2066>=_0x5cb724){_0x5b2066=_0x5cb724;_0x592fe4=0xc8;}else{_0x592fe4=0xce;}_0x1b5113[_0x7474('0x25')](_0x592fe4);return _0x1b5113[_0x7474('0x2a')](_0x7474('0x2b'),_0x5bfb0d+'-'+_0x5b2066+'/'+_0x5cb724)[_0x7474('0x26')](_0xfa74ca);}return null;};}function patchUpdates(_0x51d40b){return function(_0x2863f0){try{jsonpatch[_0x7474('0x2c')](_0x2863f0,_0x51d40b,!![]);}catch(_0x19224b){return BPromise[_0x7474('0x2d')](_0x19224b);}return _0x2863f0[_0x7474('0x2e')]();};}function saveUpdates(_0x1718c6,_0x4f67f8){return function(_0x47731c){if(_0x47731c){return _0x47731c[_0x7474('0x2f')](_0x1718c6)[_0x7474('0x30')](function(_0x46590f){return _0x46590f;});}return null;};}function removeEntity(_0xb83763,_0x576a31){return function(_0x510efc){if(_0x510efc){return _0x510efc[_0x7474('0x31')]()['then'](function(){_0xb83763[_0x7474('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3a4a,_0x2c3f00){return function(_0x4604b3){if(!_0x4604b3){_0x3f3a4a[_0x7474('0x32')](0x194);}return _0x4604b3;};}function handleError(_0xa265a6,_0x288640){_0x288640=_0x288640||0x1f4;return function(_0x44690d){logger[_0x7474('0x21')](_0x44690d[_0x7474('0x33')]);if(_0x44690d[_0x7474('0x34')]){delete _0x44690d[_0x7474('0x34')];}_0xa265a6[_0x7474('0x25')](_0x288640)['send'](_0x44690d);};}exports[_0x7474('0x35')]=function(_0x48781c,_0x22cc19){var _0x8e6bd5={},_0x4d75a7={},_0x22c9ad={'count':0x0,'rows':[]};var _0x25d22a=_[_0x7474('0x36')](db[_0x7474('0x37')][_0x7474('0x38')],function(_0x49b902){return{'name':_0x49b902[_0x7474('0x39')],'type':_0x49b902[_0x7474('0x3a')][_0x7474('0x3b')]};});_0x4d75a7[_0x7474('0x3c')]=_[_0x7474('0x36')](_0x25d22a,'name');_0x4d75a7['query']=_['keys'](_0x48781c[_0x7474('0x3d')]);_0x4d75a7[_0x7474('0x3e')]=_[_0x7474('0x3f')](_0x4d75a7['model'],_0x4d75a7['query']);_0x8e6bd5[_0x7474('0x40')]=_['intersection'](_0x4d75a7['model'],qs[_0x7474('0x41')](_0x48781c['query']['fields']));_0x8e6bd5[_0x7474('0x40')]=_0x8e6bd5['attributes'][_0x7474('0x42')]?_0x8e6bd5['attributes']:_0x4d75a7[_0x7474('0x3c')];if(!_0x48781c[_0x7474('0x3d')]['hasOwnProperty']('nolimit')){_0x8e6bd5['limit']=qs[_0x7474('0x29')](_0x48781c['query'][_0x7474('0x29')]);_0x8e6bd5['offset']=qs[_0x7474('0x28')](_0x48781c[_0x7474('0x3d')][_0x7474('0x28')]);}_0x8e6bd5[_0x7474('0x43')]=qs[_0x7474('0x44')](_0x48781c[_0x7474('0x3d')][_0x7474('0x44')]);_0x8e6bd5[_0x7474('0x45')]=qs[_0x7474('0x3e')](_[_0x7474('0x46')](_0x48781c['query'],_0x4d75a7[_0x7474('0x3e')]),_0x25d22a);if(_0x48781c[_0x7474('0x3d')]['filter']){_0x8e6bd5['where']=_[_0x7474('0x47')](_0x8e6bd5['where'],{'$or':_[_0x7474('0x36')](_0x25d22a,function(_0x4a9f34){if(_0x4a9f34[_0x7474('0x3a')]!==_0x7474('0x48')){var _0x2ab757={};_0x2ab757[_0x4a9f34['name']]={'$like':'%'+_0x48781c['query'][_0x7474('0x49')]+'%'};return _0x2ab757;}})});}_0x8e6bd5=_[_0x7474('0x47')]({},_0x8e6bd5,_0x48781c[_0x7474('0x4a')]);var _0x402b90={'where':_0x8e6bd5[_0x7474('0x45')]};return db['VtigerConfiguration'][_0x7474('0x27')](_0x402b90)[_0x7474('0x30')](function(_0x5ac800){_0x22c9ad[_0x7474('0x27')]=_0x5ac800;if(_0x48781c['query'][_0x7474('0x4b')]){_0x8e6bd5[_0x7474('0x4c')]=[{'all':!![]}];}return db[_0x7474('0x37')][_0x7474('0x4d')](_0x8e6bd5);})['then'](function(_0x457ab4){_0x22c9ad['rows']=_0x457ab4;return _0x22c9ad;})[_0x7474('0x30')](respondWithFilteredResult(_0x22cc19,_0x8e6bd5))[_0x7474('0x4e')](handleError(_0x22cc19,null));};exports[_0x7474('0x4f')]=function(_0x2bd6cb,_0xd1b368){var _0x14f6cc={'raw':![],'where':{'id':_0x2bd6cb[_0x7474('0x50')]['id']}},_0x18880f={};_0x18880f[_0x7474('0x3c')]=_[_0x7474('0x51')](db[_0x7474('0x37')][_0x7474('0x38')]);_0x18880f[_0x7474('0x3d')]=_[_0x7474('0x51')](_0x2bd6cb[_0x7474('0x3d')]);_0x18880f['filters']=_['intersection'](_0x18880f['model'],_0x18880f[_0x7474('0x3d')]);_0x14f6cc[_0x7474('0x40')]=_[_0x7474('0x3f')](_0x18880f[_0x7474('0x3c')],qs[_0x7474('0x41')](_0x2bd6cb['query'][_0x7474('0x41')]));_0x14f6cc[_0x7474('0x40')]=_0x14f6cc[_0x7474('0x40')][_0x7474('0x42')]?_0x14f6cc[_0x7474('0x40')]:_0x18880f[_0x7474('0x3c')];if(_0x2bd6cb[_0x7474('0x3d')][_0x7474('0x4b')]){_0x14f6cc[_0x7474('0x4c')]=[{'all':!![]}];}_0x14f6cc=_[_0x7474('0x47')]({},_0x14f6cc,_0x2bd6cb['options']);return db[_0x7474('0x37')]['find'](_0x14f6cc)[_0x7474('0x30')](handleEntityNotFound(_0xd1b368,null))[_0x7474('0x30')](respondWithResult(_0xd1b368,null))[_0x7474('0x4e')](handleError(_0xd1b368,null));};exports[_0x7474('0x52')]=function(_0x5238c3,_0x20ac11){return db[_0x7474('0x37')]['create'](_0x5238c3['body'],{})[_0x7474('0x30')](respondWithResult(_0x20ac11,0xc9))[_0x7474('0x4e')](handleError(_0x20ac11,null));};exports[_0x7474('0x2f')]=function(_0x29eba2,_0x185a26){if(_0x29eba2[_0x7474('0x53')]['id']){delete _0x29eba2[_0x7474('0x53')]['id'];}return db[_0x7474('0x37')][_0x7474('0x54')]({'where':{'id':_0x29eba2[_0x7474('0x50')]['id']}})[_0x7474('0x30')](handleEntityNotFound(_0x185a26,null))[_0x7474('0x30')](saveUpdates(_0x29eba2[_0x7474('0x53')],null))[_0x7474('0x30')](respondWithResult(_0x185a26,null))[_0x7474('0x4e')](handleError(_0x185a26,null));};exports[_0x7474('0x31')]=function(_0x3eea8e,_0x5203ab){return db[_0x7474('0x37')][_0x7474('0x54')]({'where':{'id':_0x3eea8e[_0x7474('0x50')]['id']}})[_0x7474('0x30')](handleEntityNotFound(_0x5203ab,null))[_0x7474('0x30')](removeEntity(_0x5203ab,null))[_0x7474('0x4e')](handleError(_0x5203ab,null));};exports['getFields']=function(_0x5d8703,_0x4687b6,_0x346ffc){var _0x1a398d={};var _0x3cdd19={};var _0x1a209d;var _0x418db7;return db[_0x7474('0x37')][_0x7474('0x55')]({'where':{'id':_0x5d8703[_0x7474('0x50')]['id']}})['then'](handleEntityNotFound(_0x4687b6,null))['then'](function(_0x4d7a2b){if(_0x4d7a2b){_0x1a209d=_0x4d7a2b;_0x3cdd19[_0x7474('0x3c')]=_['keys'](db['VtigerField'][_0x7474('0x38')]);_0x3cdd19[_0x7474('0x3d')]=_[_0x7474('0x51')](_0x5d8703[_0x7474('0x3d')]);_0x3cdd19[_0x7474('0x3e')]=_[_0x7474('0x3f')](_0x3cdd19[_0x7474('0x3c')],_0x3cdd19[_0x7474('0x3d')]);_0x1a398d[_0x7474('0x40')]=_[_0x7474('0x3f')](_0x3cdd19[_0x7474('0x3c')],qs[_0x7474('0x41')](_0x5d8703[_0x7474('0x3d')][_0x7474('0x41')]));_0x1a398d[_0x7474('0x40')]=_0x1a398d[_0x7474('0x40')][_0x7474('0x42')]?_0x1a398d[_0x7474('0x40')]:_0x3cdd19[_0x7474('0x3c')];_0x1a398d[_0x7474('0x43')]=qs[_0x7474('0x44')](_0x5d8703[_0x7474('0x3d')]['sort']);_0x1a398d[_0x7474('0x45')]=qs['filters'](_[_0x7474('0x46')](_0x5d8703[_0x7474('0x3d')],_0x3cdd19['filters']));if(_0x5d8703[_0x7474('0x3d')]['filter']){_0x1a398d[_0x7474('0x45')]=_[_0x7474('0x47')](_0x1a398d[_0x7474('0x45')],{'$or':_[_0x7474('0x36')](_0x1a398d[_0x7474('0x40')],function(_0x29ed59){var _0x4c848f={};_0x4c848f[_0x29ed59]={'$like':'%'+_0x5d8703['query'][_0x7474('0x49')]+'%'};return _0x4c848f;})});}_0x1a398d=_[_0x7474('0x47')]({},_0x1a398d,_0x5d8703[_0x7474('0x4a')]);return _0x1a209d[_0x7474('0x56')](_0x1a398d);}})[_0x7474('0x30')](function(_0x27a6fe){if(_0x27a6fe){_0x418db7=_0x27a6fe['length'];if(!_0x5d8703[_0x7474('0x3d')]['hasOwnProperty']('nolimit')){_0x1a398d[_0x7474('0x29')]=qs['limit'](_0x5d8703['query']['limit']);_0x1a398d[_0x7474('0x28')]=qs[_0x7474('0x28')](_0x5d8703[_0x7474('0x3d')][_0x7474('0x28')]);}return _0x1a209d[_0x7474('0x56')](_0x1a398d);}})[_0x7474('0x30')](function(_0x36bcf2){if(_0x36bcf2){return _0x36bcf2?{'count':_0x418db7,'rows':_0x36bcf2}:null;}})[_0x7474('0x30')](respondWithResult(_0x4687b6,null))[_0x7474('0x4e')](handleError(_0x4687b6,null));};exports[_0x7474('0x57')]=function(_0x5200c3,_0x1c96f0,_0x2bb2f6){var _0x12754f={};var _0x34c6ac={};var _0x39615d;var _0x34cc47;return db[_0x7474('0x37')][_0x7474('0x55')]({'where':{'id':_0x5200c3[_0x7474('0x50')]['id']}})[_0x7474('0x30')](handleEntityNotFound(_0x1c96f0,null))[_0x7474('0x30')](function(_0x4fc95a){if(_0x4fc95a){_0x39615d=_0x4fc95a;_0x34c6ac['model']=_[_0x7474('0x51')](db[_0x7474('0x58')]['rawAttributes']);_0x34c6ac['query']=_['keys'](_0x5200c3[_0x7474('0x3d')]);_0x34c6ac[_0x7474('0x3e')]=_[_0x7474('0x3f')](_0x34c6ac[_0x7474('0x3c')],_0x34c6ac['query']);_0x12754f[_0x7474('0x40')]=_['intersection'](_0x34c6ac['model'],qs[_0x7474('0x41')](_0x5200c3[_0x7474('0x3d')][_0x7474('0x41')]));_0x12754f[_0x7474('0x40')]=_0x12754f[_0x7474('0x40')][_0x7474('0x42')]?_0x12754f[_0x7474('0x40')]:_0x34c6ac[_0x7474('0x3c')];_0x12754f[_0x7474('0x43')]=qs[_0x7474('0x44')](_0x5200c3[_0x7474('0x3d')][_0x7474('0x44')]);_0x12754f[_0x7474('0x45')]=qs[_0x7474('0x3e')](_['pick'](_0x5200c3[_0x7474('0x3d')],_0x34c6ac[_0x7474('0x3e')]));if(_0x5200c3[_0x7474('0x3d')][_0x7474('0x49')]){_0x12754f[_0x7474('0x45')]=_['merge'](_0x12754f['where'],{'$or':_[_0x7474('0x36')](_0x12754f[_0x7474('0x40')],function(_0x4d8b9a){var _0x23955f={};_0x23955f[_0x4d8b9a]={'$like':'%'+_0x5200c3['query'][_0x7474('0x49')]+'%'};return _0x23955f;})});}_0x12754f=_['merge']({},_0x12754f,_0x5200c3[_0x7474('0x4a')]);return _0x39615d[_0x7474('0x57')](_0x12754f);}})[_0x7474('0x30')](function(_0x150f81){if(_0x150f81){_0x34cc47=_0x150f81[_0x7474('0x42')];if(!_0x5200c3[_0x7474('0x3d')][_0x7474('0x59')]('nolimit')){_0x12754f[_0x7474('0x29')]=qs[_0x7474('0x29')](_0x5200c3[_0x7474('0x3d')][_0x7474('0x29')]);_0x12754f[_0x7474('0x28')]=qs['offset'](_0x5200c3[_0x7474('0x3d')][_0x7474('0x28')]);}return _0x39615d['getSubjects'](_0x12754f);}})[_0x7474('0x30')](function(_0x35ff54){if(_0x35ff54){return _0x35ff54?{'count':_0x34cc47,'rows':_0x35ff54}:null;}})['then'](respondWithResult(_0x1c96f0,null))['catch'](handleError(_0x1c96f0,null));};exports['getDescriptions']=function(_0x337b9b,_0x5d3435,_0xacffc0){var _0x450e51={};var _0xd04e26={};var _0x5960ea;var _0xdf4e17;return db['VtigerConfiguration'][_0x7474('0x55')]({'where':{'id':_0x337b9b['params']['id']}})[_0x7474('0x30')](handleEntityNotFound(_0x5d3435,null))[_0x7474('0x30')](function(_0x39d086){if(_0x39d086){_0x5960ea=_0x39d086;_0xd04e26[_0x7474('0x3c')]=_[_0x7474('0x51')](db[_0x7474('0x58')][_0x7474('0x38')]);_0xd04e26[_0x7474('0x3d')]=_[_0x7474('0x51')](_0x337b9b[_0x7474('0x3d')]);_0xd04e26[_0x7474('0x3e')]=_[_0x7474('0x3f')](_0xd04e26['model'],_0xd04e26[_0x7474('0x3d')]);_0x450e51[_0x7474('0x40')]=_[_0x7474('0x3f')](_0xd04e26['model'],qs[_0x7474('0x41')](_0x337b9b[_0x7474('0x3d')][_0x7474('0x41')]));_0x450e51[_0x7474('0x40')]=_0x450e51[_0x7474('0x40')][_0x7474('0x42')]?_0x450e51[_0x7474('0x40')]:_0xd04e26[_0x7474('0x3c')];_0x450e51[_0x7474('0x43')]=qs[_0x7474('0x44')](_0x337b9b[_0x7474('0x3d')][_0x7474('0x44')]);_0x450e51[_0x7474('0x45')]=qs[_0x7474('0x3e')](_['pick'](_0x337b9b[_0x7474('0x3d')],_0xd04e26[_0x7474('0x3e')]));if(_0x337b9b[_0x7474('0x3d')][_0x7474('0x49')]){_0x450e51[_0x7474('0x45')]=_[_0x7474('0x47')](_0x450e51[_0x7474('0x45')],{'$or':_[_0x7474('0x36')](_0x450e51[_0x7474('0x40')],function(_0x3e69ad){var _0x355402={};_0x355402[_0x3e69ad]={'$like':'%'+_0x337b9b[_0x7474('0x3d')][_0x7474('0x49')]+'%'};return _0x355402;})});}_0x450e51=_[_0x7474('0x47')]({},_0x450e51,_0x337b9b[_0x7474('0x4a')]);return _0x5960ea[_0x7474('0x5a')](_0x450e51);}})[_0x7474('0x30')](function(_0x56a59a){if(_0x56a59a){_0xdf4e17=_0x56a59a[_0x7474('0x42')];if(!_0x337b9b[_0x7474('0x3d')][_0x7474('0x59')](_0x7474('0x5b'))){_0x450e51[_0x7474('0x29')]=qs[_0x7474('0x29')](_0x337b9b[_0x7474('0x3d')][_0x7474('0x29')]);_0x450e51['offset']=qs['offset'](_0x337b9b['query'][_0x7474('0x28')]);}return _0x5960ea['getDescriptions'](_0x450e51);}})['then'](function(_0x2c7630){if(_0x2c7630){return _0x2c7630?{'count':_0xdf4e17,'rows':_0x2c7630}:null;}})[_0x7474('0x30')](respondWithResult(_0x5d3435,null))['catch'](handleError(_0x5d3435,null));}; \ No newline at end of file +var _0x9ab4=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','params','keys','includeAll','include','options','find','create','body','getFields','findOne','getSubjects','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x371786,_0x509b1b){var _0x4eb533=function(_0x360732){while(--_0x360732){_0x371786['push'](_0x371786['shift']());}};_0x4eb533(++_0x509b1b);}(_0x9ab4,0x6f));var _0x49ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ab4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x49ab('0x0'));var emlformat=require(_0x49ab('0x1'));var rimraf=require(_0x49ab('0x2'));var zipdir=require(_0x49ab('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49ab('0x4'));var moment=require('moment');var BPromise=require(_0x49ab('0x5'));var Mustache=require(_0x49ab('0x6'));var util=require(_0x49ab('0x7'));var path=require(_0x49ab('0x8'));var sox=require(_0x49ab('0x9'));var csv=require('to-csv');var ejs=require(_0x49ab('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x49ab('0xb'));var jsforce=require(_0x49ab('0xc'));var deskjs=require(_0x49ab('0xd'));var toCsv=require('to-csv');var querystring=require(_0x49ab('0xe'));var Papa=require(_0x49ab('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49ab('0x10'));var as=require(_0x49ab('0x11'));var hardwareService=require(_0x49ab('0x12'));var logger=require(_0x49ab('0x13'))(_0x49ab('0x14'));var utils=require('../../config/utils');var config=require(_0x49ab('0x15'));var db=require(_0x49ab('0x16'))['db'];var jayson=require(_0x49ab('0x17'));var client=jayson[_0x49ab('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x2491e7,_0x34b523,_0x1a7c48){if(_0x1a7c48){var _0x49d2c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49d2c5[_0x49ab('0x19')](_0x34b523)){return _0x2491e7;}else{throw new db[(_0x49ab('0x1a'))][(_0x49ab('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2491e7;}}function respondWithRpcPromise(_0x597846,_0x120406,_0x3a3b9e,_0x2ec90a){return new BPromise(function(_0x16e500,_0x49cccc){var _0x38fe23=_0x2ec90a||client;return _0x38fe23['request'](_0x597846,_0x3a3b9e)[_0x49ab('0x1c')](function(_0x152b7f){logger[_0x49ab('0x1d')](_0x49ab('0x1e'),_0x120406,_0x49ab('0x1f'));logger['debug'](_0x49ab('0x20'),_0x120406,_0x49ab('0x1f'),JSON[_0x49ab('0x21')](_0x152b7f));if(_0x152b7f[_0x49ab('0x22')]){if(_0x152b7f['error']['code']===0x1f4){logger[_0x49ab('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x120406,_0x152b7f[_0x49ab('0x22')][_0x49ab('0x23')]);return _0x49cccc(_0x152b7f[_0x49ab('0x22')]['message']);}logger[_0x49ab('0x22')](_0x49ab('0x1e'),_0x120406,_0x152b7f['error'][_0x49ab('0x23')]);return _0x16e500(_0x152b7f[_0x49ab('0x22')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x120406,_0x49ab('0x1f'));_0x16e500(_0x152b7f[_0x49ab('0x24')][_0x49ab('0x23')]);}})[_0x49ab('0x25')](function(_0x5d38fe){logger['error'](_0x49ab('0x1e'),_0x120406,_0x5d38fe);_0x49cccc(_0x5d38fe);});});}function respondWithStatusCode(_0x1c3228,_0x14c3ad){_0x14c3ad=_0x14c3ad||0xcc;return function(_0x5e66f6){if(_0x5e66f6){return _0x1c3228[_0x49ab('0x26')](_0x14c3ad);}return _0x1c3228[_0x49ab('0x27')](_0x14c3ad)[_0x49ab('0x28')]();};}function respondWithResult(_0x4cd067,_0x47a74a){_0x47a74a=_0x47a74a||0xc8;return function(_0x43b7f3){if(_0x43b7f3){return _0x4cd067[_0x49ab('0x27')](_0x47a74a)[_0x49ab('0x29')](_0x43b7f3);}};}function respondWithFilteredResult(_0x2f9098,_0x86b12b){return function(_0x60ad4f){if(_0x60ad4f){var _0x5d6f4b=_0x60ad4f[_0x49ab('0x2a')],_0x19263a=_0x86b12b[_0x49ab('0x2b')],_0x53ff25=_0x86b12b[_0x49ab('0x2b')]+_0x86b12b[_0x49ab('0x2c')],_0x4c0f10;if(_0x53ff25>=_0x5d6f4b){_0x53ff25=_0x5d6f4b;_0x4c0f10=0xc8;}else{_0x4c0f10=0xce;}_0x2f9098[_0x49ab('0x27')](_0x4c0f10);return _0x2f9098[_0x49ab('0x2d')](_0x49ab('0x2e'),_0x19263a+'-'+_0x53ff25+'/'+_0x5d6f4b)[_0x49ab('0x29')](_0x60ad4f);}return null;};}function patchUpdates(_0x56017d){return function(_0x4f60c0){try{jsonpatch['apply'](_0x4f60c0,_0x56017d,!![]);}catch(_0x4b4ade){return BPromise[_0x49ab('0x2f')](_0x4b4ade);}return _0x4f60c0[_0x49ab('0x30')]();};}function saveUpdates(_0x598574,_0x281cd9){return function(_0xb4ae9a){if(_0xb4ae9a){return _0xb4ae9a['update'](_0x598574)[_0x49ab('0x1c')](function(_0xe23ac0){return _0xe23ac0;});}return null;};}function removeEntity(_0x22c92b,_0x5e16ff){return function(_0x560b8b){if(_0x560b8b){return _0x560b8b[_0x49ab('0x31')]()['then'](function(){_0x22c92b[_0x49ab('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d2e2,_0x577ac3){return function(_0x49fa54){if(!_0x49fa54){_0x12d2e2[_0x49ab('0x26')](0x194);}return _0x49fa54;};}function handleError(_0x449374,_0x2bf0af){_0x2bf0af=_0x2bf0af||0x1f4;return function(_0x547429){logger[_0x49ab('0x22')](_0x547429[_0x49ab('0x32')]);if(_0x547429[_0x49ab('0x33')]){delete _0x547429[_0x49ab('0x33')];}_0x449374[_0x49ab('0x27')](_0x2bf0af)[_0x49ab('0x34')](_0x547429);};}exports[_0x49ab('0x35')]=function(_0x5693f2,_0x3f7a0b){var _0x458f10={},_0x532a9d={},_0x5ca130={'count':0x0,'rows':[]};var _0x462c81=_['map'](db[_0x49ab('0x36')][_0x49ab('0x37')],function(_0x35ef28){return{'name':_0x35ef28[_0x49ab('0x38')],'type':_0x35ef28[_0x49ab('0x39')]['key']};});_0x532a9d[_0x49ab('0x3a')]=_[_0x49ab('0x3b')](_0x462c81,_0x49ab('0x33'));_0x532a9d[_0x49ab('0x3c')]=_['keys'](_0x5693f2[_0x49ab('0x3c')]);_0x532a9d[_0x49ab('0x3d')]=_[_0x49ab('0x3e')](_0x532a9d['model'],_0x532a9d[_0x49ab('0x3c')]);_0x458f10[_0x49ab('0x3f')]=_[_0x49ab('0x3e')](_0x532a9d[_0x49ab('0x3a')],qs['fields'](_0x5693f2[_0x49ab('0x3c')][_0x49ab('0x40')]));_0x458f10[_0x49ab('0x3f')]=_0x458f10[_0x49ab('0x3f')][_0x49ab('0x41')]?_0x458f10[_0x49ab('0x3f')]:_0x532a9d['model'];if(!_0x5693f2['query'][_0x49ab('0x42')](_0x49ab('0x43'))){_0x458f10[_0x49ab('0x2c')]=qs[_0x49ab('0x2c')](_0x5693f2['query']['limit']);_0x458f10['offset']=qs[_0x49ab('0x2b')](_0x5693f2[_0x49ab('0x3c')][_0x49ab('0x2b')]);}_0x458f10[_0x49ab('0x44')]=qs[_0x49ab('0x45')](_0x5693f2['query'][_0x49ab('0x45')]);_0x458f10[_0x49ab('0x46')]=qs[_0x49ab('0x3d')](_[_0x49ab('0x47')](_0x5693f2['query'],_0x532a9d[_0x49ab('0x3d')]),_0x462c81);if(_0x5693f2[_0x49ab('0x3c')][_0x49ab('0x48')]){_0x458f10[_0x49ab('0x46')]=_[_0x49ab('0x49')](_0x458f10[_0x49ab('0x46')],{'$or':_[_0x49ab('0x3b')](_0x462c81,function(_0x3f9397){if(_0x3f9397[_0x49ab('0x39')]!==_0x49ab('0x4a')){var _0x2829d8={};_0x2829d8[_0x3f9397[_0x49ab('0x33')]]={'$like':'%'+_0x5693f2[_0x49ab('0x3c')][_0x49ab('0x48')]+'%'};return _0x2829d8;}})});}_0x458f10=_['merge']({},_0x458f10,_0x5693f2['options']);var _0x51deb9={'where':_0x458f10[_0x49ab('0x46')]};return db[_0x49ab('0x36')]['count'](_0x51deb9)[_0x49ab('0x1c')](function(_0x341280){_0x5ca130[_0x49ab('0x2a')]=_0x341280;if(_0x5693f2['query']['includeAll']){_0x458f10['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x49ab('0x4b')](_0x458f10);})[_0x49ab('0x1c')](function(_0x3c085e){_0x5ca130['rows']=_0x3c085e;return _0x5ca130;})['then'](respondWithFilteredResult(_0x3f7a0b,_0x458f10))[_0x49ab('0x25')](handleError(_0x3f7a0b,null));};exports['show']=function(_0x254750,_0x41bed1){var _0x407bd1={'raw':![],'where':{'id':_0x254750[_0x49ab('0x4c')]['id']}},_0x4d190c={};_0x4d190c['model']=_[_0x49ab('0x4d')](db['VtigerConfiguration'][_0x49ab('0x37')]);_0x4d190c['query']=_[_0x49ab('0x4d')](_0x254750[_0x49ab('0x3c')]);_0x4d190c[_0x49ab('0x3d')]=_[_0x49ab('0x3e')](_0x4d190c[_0x49ab('0x3a')],_0x4d190c[_0x49ab('0x3c')]);_0x407bd1[_0x49ab('0x3f')]=_['intersection'](_0x4d190c[_0x49ab('0x3a')],qs[_0x49ab('0x40')](_0x254750[_0x49ab('0x3c')][_0x49ab('0x40')]));_0x407bd1[_0x49ab('0x3f')]=_0x407bd1[_0x49ab('0x3f')]['length']?_0x407bd1[_0x49ab('0x3f')]:_0x4d190c['model'];if(_0x254750[_0x49ab('0x3c')][_0x49ab('0x4e')]){_0x407bd1[_0x49ab('0x4f')]=[{'all':!![]}];}_0x407bd1=_[_0x49ab('0x49')]({},_0x407bd1,_0x254750[_0x49ab('0x50')]);return db['VtigerConfiguration'][_0x49ab('0x51')](_0x407bd1)[_0x49ab('0x1c')](handleEntityNotFound(_0x41bed1,null))[_0x49ab('0x1c')](respondWithResult(_0x41bed1,null))[_0x49ab('0x25')](handleError(_0x41bed1,null));};exports[_0x49ab('0x52')]=function(_0x55c64d,_0x5a231f){return db[_0x49ab('0x36')][_0x49ab('0x52')](_0x55c64d[_0x49ab('0x53')],{})[_0x49ab('0x1c')](respondWithResult(_0x5a231f,0xc9))[_0x49ab('0x25')](handleError(_0x5a231f,null));};exports['update']=function(_0xb50d78,_0x63eb5a){if(_0xb50d78[_0x49ab('0x53')]['id']){delete _0xb50d78[_0x49ab('0x53')]['id'];}return db[_0x49ab('0x36')][_0x49ab('0x51')]({'where':{'id':_0xb50d78[_0x49ab('0x4c')]['id']}})[_0x49ab('0x1c')](handleEntityNotFound(_0x63eb5a,null))['then'](saveUpdates(_0xb50d78[_0x49ab('0x53')],null))[_0x49ab('0x1c')](respondWithResult(_0x63eb5a,null))[_0x49ab('0x25')](handleError(_0x63eb5a,null));};exports[_0x49ab('0x31')]=function(_0x18c4a7,_0x566705){return db['VtigerConfiguration'][_0x49ab('0x51')]({'where':{'id':_0x18c4a7[_0x49ab('0x4c')]['id']}})[_0x49ab('0x1c')](handleEntityNotFound(_0x566705,null))[_0x49ab('0x1c')](removeEntity(_0x566705,null))[_0x49ab('0x25')](handleError(_0x566705,null));};exports[_0x49ab('0x54')]=function(_0x4b55f2,_0x299d1c,_0x38e348){var _0x378cb4={};var _0x37425a={};var _0x145e4c;var _0x132a78;return db['VtigerConfiguration'][_0x49ab('0x55')]({'where':{'id':_0x4b55f2['params']['id']}})[_0x49ab('0x1c')](handleEntityNotFound(_0x299d1c,null))[_0x49ab('0x1c')](function(_0x22d0b4){if(_0x22d0b4){_0x145e4c=_0x22d0b4;_0x37425a[_0x49ab('0x3a')]=_[_0x49ab('0x4d')](db['VtigerField'][_0x49ab('0x37')]);_0x37425a[_0x49ab('0x3c')]=_['keys'](_0x4b55f2[_0x49ab('0x3c')]);_0x37425a['filters']=_[_0x49ab('0x3e')](_0x37425a['model'],_0x37425a[_0x49ab('0x3c')]);_0x378cb4[_0x49ab('0x3f')]=_[_0x49ab('0x3e')](_0x37425a['model'],qs[_0x49ab('0x40')](_0x4b55f2[_0x49ab('0x3c')][_0x49ab('0x40')]));_0x378cb4[_0x49ab('0x3f')]=_0x378cb4[_0x49ab('0x3f')]['length']?_0x378cb4[_0x49ab('0x3f')]:_0x37425a[_0x49ab('0x3a')];_0x378cb4['order']=qs[_0x49ab('0x45')](_0x4b55f2[_0x49ab('0x3c')][_0x49ab('0x45')]);_0x378cb4['where']=qs[_0x49ab('0x3d')](_[_0x49ab('0x47')](_0x4b55f2['query'],_0x37425a[_0x49ab('0x3d')]));if(_0x4b55f2['query']['filter']){_0x378cb4[_0x49ab('0x46')]=_[_0x49ab('0x49')](_0x378cb4[_0x49ab('0x46')],{'$or':_[_0x49ab('0x3b')](_0x378cb4[_0x49ab('0x3f')],function(_0xd6d246){var _0x25aad8={};_0x25aad8[_0xd6d246]={'$like':'%'+_0x4b55f2['query']['filter']+'%'};return _0x25aad8;})});}_0x378cb4=_[_0x49ab('0x49')]({},_0x378cb4,_0x4b55f2['options']);return _0x145e4c['getFields'](_0x378cb4);}})['then'](function(_0x8e0c40){if(_0x8e0c40){_0x132a78=_0x8e0c40[_0x49ab('0x41')];if(!_0x4b55f2[_0x49ab('0x3c')][_0x49ab('0x42')](_0x49ab('0x43'))){_0x378cb4[_0x49ab('0x2c')]=qs[_0x49ab('0x2c')](_0x4b55f2['query'][_0x49ab('0x2c')]);_0x378cb4[_0x49ab('0x2b')]=qs[_0x49ab('0x2b')](_0x4b55f2['query'][_0x49ab('0x2b')]);}return _0x145e4c[_0x49ab('0x54')](_0x378cb4);}})[_0x49ab('0x1c')](function(_0x4efe7e){if(_0x4efe7e){return _0x4efe7e?{'count':_0x132a78,'rows':_0x4efe7e}:null;}})[_0x49ab('0x1c')](respondWithResult(_0x299d1c,null))[_0x49ab('0x25')](handleError(_0x299d1c,null));};exports[_0x49ab('0x56')]=function(_0x3764eb,_0x1f33e4,_0x5545a1){var _0x2b7be4={};var _0x2cd8c1={};var _0x4a7a2e;var _0x57f39c;return db['VtigerConfiguration'][_0x49ab('0x55')]({'where':{'id':_0x3764eb[_0x49ab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f33e4,null))[_0x49ab('0x1c')](function(_0x35063e){if(_0x35063e){_0x4a7a2e=_0x35063e;_0x2cd8c1[_0x49ab('0x3a')]=_['keys'](db[_0x49ab('0x57')][_0x49ab('0x37')]);_0x2cd8c1[_0x49ab('0x3c')]=_['keys'](_0x3764eb[_0x49ab('0x3c')]);_0x2cd8c1[_0x49ab('0x3d')]=_[_0x49ab('0x3e')](_0x2cd8c1[_0x49ab('0x3a')],_0x2cd8c1[_0x49ab('0x3c')]);_0x2b7be4[_0x49ab('0x3f')]=_[_0x49ab('0x3e')](_0x2cd8c1[_0x49ab('0x3a')],qs[_0x49ab('0x40')](_0x3764eb[_0x49ab('0x3c')]['fields']));_0x2b7be4[_0x49ab('0x3f')]=_0x2b7be4[_0x49ab('0x3f')][_0x49ab('0x41')]?_0x2b7be4[_0x49ab('0x3f')]:_0x2cd8c1['model'];_0x2b7be4[_0x49ab('0x44')]=qs[_0x49ab('0x45')](_0x3764eb[_0x49ab('0x3c')][_0x49ab('0x45')]);_0x2b7be4['where']=qs[_0x49ab('0x3d')](_['pick'](_0x3764eb[_0x49ab('0x3c')],_0x2cd8c1['filters']));if(_0x3764eb[_0x49ab('0x3c')][_0x49ab('0x48')]){_0x2b7be4[_0x49ab('0x46')]=_[_0x49ab('0x49')](_0x2b7be4[_0x49ab('0x46')],{'$or':_[_0x49ab('0x3b')](_0x2b7be4['attributes'],function(_0x4a310c){var _0x1501e2={};_0x1501e2[_0x4a310c]={'$like':'%'+_0x3764eb['query'][_0x49ab('0x48')]+'%'};return _0x1501e2;})});}_0x2b7be4=_['merge']({},_0x2b7be4,_0x3764eb['options']);return _0x4a7a2e[_0x49ab('0x56')](_0x2b7be4);}})[_0x49ab('0x1c')](function(_0x14e237){if(_0x14e237){_0x57f39c=_0x14e237['length'];if(!_0x3764eb[_0x49ab('0x3c')][_0x49ab('0x42')](_0x49ab('0x43'))){_0x2b7be4[_0x49ab('0x2c')]=qs['limit'](_0x3764eb[_0x49ab('0x3c')]['limit']);_0x2b7be4[_0x49ab('0x2b')]=qs[_0x49ab('0x2b')](_0x3764eb['query'][_0x49ab('0x2b')]);}return _0x4a7a2e[_0x49ab('0x56')](_0x2b7be4);}})[_0x49ab('0x1c')](function(_0x36e782){if(_0x36e782){return _0x36e782?{'count':_0x57f39c,'rows':_0x36e782}:null;}})[_0x49ab('0x1c')](respondWithResult(_0x1f33e4,null))[_0x49ab('0x25')](handleError(_0x1f33e4,null));};exports[_0x49ab('0x58')]=function(_0x4dbc06,_0x75989d,_0x28c830){var _0x43fcf8={};var _0x21ac3f={};var _0x57578d;var _0x18ed1c;return db['VtigerConfiguration'][_0x49ab('0x55')]({'where':{'id':_0x4dbc06[_0x49ab('0x4c')]['id']}})[_0x49ab('0x1c')](handleEntityNotFound(_0x75989d,null))['then'](function(_0x4e5eb9){if(_0x4e5eb9){_0x57578d=_0x4e5eb9;_0x21ac3f[_0x49ab('0x3a')]=_[_0x49ab('0x4d')](db['VtigerField'][_0x49ab('0x37')]);_0x21ac3f[_0x49ab('0x3c')]=_[_0x49ab('0x4d')](_0x4dbc06[_0x49ab('0x3c')]);_0x21ac3f[_0x49ab('0x3d')]=_[_0x49ab('0x3e')](_0x21ac3f[_0x49ab('0x3a')],_0x21ac3f[_0x49ab('0x3c')]);_0x43fcf8[_0x49ab('0x3f')]=_[_0x49ab('0x3e')](_0x21ac3f['model'],qs[_0x49ab('0x40')](_0x4dbc06[_0x49ab('0x3c')][_0x49ab('0x40')]));_0x43fcf8[_0x49ab('0x3f')]=_0x43fcf8[_0x49ab('0x3f')][_0x49ab('0x41')]?_0x43fcf8[_0x49ab('0x3f')]:_0x21ac3f[_0x49ab('0x3a')];_0x43fcf8['order']=qs[_0x49ab('0x45')](_0x4dbc06[_0x49ab('0x3c')]['sort']);_0x43fcf8['where']=qs[_0x49ab('0x3d')](_[_0x49ab('0x47')](_0x4dbc06[_0x49ab('0x3c')],_0x21ac3f[_0x49ab('0x3d')]));if(_0x4dbc06[_0x49ab('0x3c')][_0x49ab('0x48')]){_0x43fcf8[_0x49ab('0x46')]=_[_0x49ab('0x49')](_0x43fcf8[_0x49ab('0x46')],{'$or':_[_0x49ab('0x3b')](_0x43fcf8['attributes'],function(_0xdff7b0){var _0x208f32={};_0x208f32[_0xdff7b0]={'$like':'%'+_0x4dbc06[_0x49ab('0x3c')][_0x49ab('0x48')]+'%'};return _0x208f32;})});}_0x43fcf8=_[_0x49ab('0x49')]({},_0x43fcf8,_0x4dbc06['options']);return _0x57578d[_0x49ab('0x58')](_0x43fcf8);}})[_0x49ab('0x1c')](function(_0x832892){if(_0x832892){_0x18ed1c=_0x832892[_0x49ab('0x41')];if(!_0x4dbc06['query']['hasOwnProperty'](_0x49ab('0x43'))){_0x43fcf8['limit']=qs[_0x49ab('0x2c')](_0x4dbc06[_0x49ab('0x3c')][_0x49ab('0x2c')]);_0x43fcf8[_0x49ab('0x2b')]=qs[_0x49ab('0x2b')](_0x4dbc06[_0x49ab('0x3c')]['offset']);}return _0x57578d['getDescriptions'](_0x43fcf8);}})[_0x49ab('0x1c')](function(_0x1d295d){if(_0x1d295d){return _0x1d295d?{'count':_0x18ed1c,'rows':_0x1d295d}:null;}})[_0x49ab('0x1c')](respondWithResult(_0x75989d,null))[_0x49ab('0x25')](handleError(_0x75989d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 3ba4f98..df19cc4 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 _0x4013=['exports','define','VtigerConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x1e7840,_0x46e58a){var _0x1d81e6=function(_0x32b642){while(--_0x32b642){_0x1e7840['push'](_0x1e7840['shift']());}};_0x1d81e6(++_0x46e58a);}(_0x4013,0x1ef));var _0x3401=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4013[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x3401('0x0'));var util=require('util');var logger=require(_0x3401('0x1'))(_0x3401('0x2'));var moment=require(_0x3401('0x3'));var BPromise=require(_0x3401('0x4'));var rp=require(_0x3401('0x5'));var fs=require('fs');var path=require(_0x3401('0x6'));var rimraf=require('rimraf');var config=require(_0x3401('0x7'));var attributes=require(_0x3401('0x8'));module[_0x3401('0x9')]=function(_0xcd51c0,_0x55efa0){return _0xcd51c0[_0x3401('0xa')](_0x3401('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc2c=['exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x37aea3,_0x54352a){var _0x14637c=function(_0x2f2571){while(--_0x2f2571){_0x37aea3['push'](_0x37aea3['shift']());}};_0x14637c(++_0x54352a);}(_0xfc2c,0x163));var _0xcfc2=function(_0x57c99a,_0x111cf5){_0x57c99a=_0x57c99a-0x0;var _0x4b3044=_0xfc2c[_0x57c99a];return _0x4b3044;};'use strict';var _=require(_0xcfc2('0x0'));var util=require(_0xcfc2('0x1'));var logger=require('../../config/logger')(_0xcfc2('0x2'));var moment=require('moment');var BPromise=require(_0xcfc2('0x3'));var rp=require(_0xcfc2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfc2('0x5'));var config=require(_0xcfc2('0x6'));var attributes=require(_0xcfc2('0x7'));module[_0xcfc2('0x8')]=function(_0x434634,_0x5cebd4){return _0x434634['define'](_0xcfc2('0x9'),attributes,{'tableName':_0xcfc2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index f89cdd5..4ed9a8f 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 _0x4cba=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4a7273,_0x19c9ca){var _0x135ca9=function(_0x2dd02e){while(--_0x2dd02e){_0x4a7273['push'](_0x4a7273['shift']());}};_0x135ca9(++_0x19c9ca);}(_0x4cba,0x1ab));var _0xa4cb=function(_0x2b7cec,_0x948c5d){_0x2b7cec=_0x2b7cec-0x0;var _0x5c7780=_0x4cba[_0x2b7cec];return _0x5c7780;};'use strict';var _=require(_0xa4cb('0x0'));var util=require(_0xa4cb('0x1'));var moment=require('moment');var BPromise=require(_0xa4cb('0x2'));var rs=require(_0xa4cb('0x3'));var fs=require('fs');var Redis=require(_0xa4cb('0x4'));var db=require(_0xa4cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4cb('0x6'))('rpc');var config=require(_0xa4cb('0x7'));var jayson=require(_0xa4cb('0x8'));var client=jayson[_0xa4cb('0x9')][_0xa4cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298f38,_0x505db7,_0x44a272){return new BPromise(function(_0x5eb26d,_0x3a4354){return client['request'](_0x298f38,_0x44a272)[_0xa4cb('0xb')](function(_0x39df3f){logger[_0xa4cb('0xc')](_0xa4cb('0xd'),_0x505db7,_0xa4cb('0xe'));logger[_0xa4cb('0xf')](_0xa4cb('0x10'),_0x505db7,_0xa4cb('0xe'),JSON['stringify'](_0x39df3f));if(_0x39df3f['error']){if(_0x39df3f[_0xa4cb('0x11')][_0xa4cb('0x12')]===0x1f4){logger[_0xa4cb('0x11')](_0xa4cb('0xd'),_0x505db7,_0x39df3f[_0xa4cb('0x11')][_0xa4cb('0x13')]);return _0x3a4354(_0x39df3f['error'][_0xa4cb('0x13')]);}logger[_0xa4cb('0x11')](_0xa4cb('0xd'),_0x505db7,_0x39df3f[_0xa4cb('0x11')][_0xa4cb('0x13')]);return _0x5eb26d(_0x39df3f['error'][_0xa4cb('0x13')]);}else{logger['info'](_0xa4cb('0xd'),_0x505db7,'request\x20sent');_0x5eb26d(_0x39df3f[_0xa4cb('0x14')]['message']);}})[_0xa4cb('0x15')](function(_0x5be43f){logger[_0xa4cb('0x11')](_0xa4cb('0xd'),_0x505db7,_0x5be43f);_0x3a4354(_0x5be43f);});});} \ No newline at end of file +var _0xcb36=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x55f2c0,_0x305768){var _0x3109d9=function(_0x53a7ce){while(--_0x53a7ce){_0x55f2c0['push'](_0x55f2c0['shift']());}};_0x3109d9(++_0x305768);}(_0xcb36,0x1e2));var _0x6cb3=function(_0x34b0c5,_0x37e86e){_0x34b0c5=_0x34b0c5-0x0;var _0x52e147=_0xcb36[_0x34b0c5];return _0x52e147;};'use strict';var _=require(_0x6cb3('0x0'));var util=require(_0x6cb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6cb3('0x2'));var fs=require('fs');var Redis=require(_0x6cb3('0x3'));var db=require(_0x6cb3('0x4'))['db'];var utils=require(_0x6cb3('0x5'));var logger=require(_0x6cb3('0x6'))(_0x6cb3('0x7'));var config=require(_0x6cb3('0x8'));var jayson=require(_0x6cb3('0x9'));var client=jayson[_0x6cb3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27ec2f,_0x4cf6bf,_0x3ade3f){return new BPromise(function(_0x52a08c,_0x155339){return client[_0x6cb3('0xb')](_0x27ec2f,_0x3ade3f)[_0x6cb3('0xc')](function(_0x5edf05){logger[_0x6cb3('0xd')](_0x6cb3('0xe'),_0x4cf6bf,_0x6cb3('0xf'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4cf6bf,_0x6cb3('0xf'),JSON['stringify'](_0x5edf05));if(_0x5edf05['error']){if(_0x5edf05[_0x6cb3('0x10')]['code']===0x1f4){logger[_0x6cb3('0x10')](_0x6cb3('0xe'),_0x4cf6bf,_0x5edf05[_0x6cb3('0x10')][_0x6cb3('0x11')]);return _0x155339(_0x5edf05[_0x6cb3('0x10')][_0x6cb3('0x11')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4cf6bf,_0x5edf05[_0x6cb3('0x10')]['message']);return _0x52a08c(_0x5edf05[_0x6cb3('0x10')][_0x6cb3('0x11')]);}else{logger['info'](_0x6cb3('0xe'),_0x4cf6bf,_0x6cb3('0xf'));_0x52a08c(_0x5edf05[_0x6cb3('0x12')]['message']);}})[_0x6cb3('0x13')](function(_0x393d9d){logger[_0x6cb3('0x10')](_0x6cb3('0xe'),_0x4cf6bf,_0x393d9d);_0x155339(_0x393d9d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3cbf6af..56438be 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 _0xb4aa=['path','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','create','put','exports','multer'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xb4aa,0x1b7));var _0xab4a=function(_0xdb755d,_0x172313){_0xdb755d=_0xdb755d-0x0;var _0x4169c3=_0xb4aa[_0xdb755d];return _0x4169c3;};'use strict';var multer=require(_0xab4a('0x0'));var util=require('util');var path=require(_0xab4a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab4a('0x2'));router['get']('/',auth[_0xab4a('0x3')](),controller[_0xab4a('0x4')]);router[_0xab4a('0x5')](_0xab4a('0x6'),auth[_0xab4a('0x3')](),controller[_0xab4a('0x7')]);router['post']('/',auth[_0xab4a('0x3')](),controller[_0xab4a('0x8')]);router[_0xab4a('0x9')](_0xab4a('0x6'),auth[_0xab4a('0x3')](),controller['update']);router['delete'](_0xab4a('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0xab4a('0xa')]=router; \ No newline at end of file +var _0x3ed8=['get','index','/:id','isAuthenticated','post','create','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller'];(function(_0x58aff1,_0x4d8805){var _0x1c730f=function(_0x149556){while(--_0x149556){_0x58aff1['push'](_0x58aff1['shift']());}};_0x1c730f(++_0x4d8805);}(_0x3ed8,0x1b8));var _0x83ed=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x3ed8[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0x83ed('0x0'));var util=require(_0x83ed('0x1'));var path=require(_0x83ed('0x2'));var timeout=require(_0x83ed('0x3'));var express=require('express');var router=express[_0x83ed('0x4')]();var auth=require(_0x83ed('0x5'));var interaction=require(_0x83ed('0x6'));var config=require('../../config/environment');var controller=require(_0x83ed('0x7'));router[_0x83ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x83ed('0x9')]);router[_0x83ed('0x8')](_0x83ed('0xa'),auth[_0x83ed('0xb')](),controller['show']);router[_0x83ed('0xc')]('/',auth[_0x83ed('0xb')](),controller[_0x83ed('0xd')]);router['put'](_0x83ed('0xa'),auth[_0x83ed('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x83ed('0xe')]);module[_0x83ed('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 66fa8a4..77e63e5 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 _0x938a=['customVariable','sequelize','exports','ENUM','string','keyValue','STRING'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x938a,0x1f2));var _0xa938=function(_0xe10820,_0x456014){_0xe10820=_0xe10820-0x0;var _0x345443=_0x938a[_0xe10820];return _0x345443;};'use strict';var Sequelize=require(_0xa938('0x0'));module[_0xa938('0x1')]={'type':{'type':Sequelize[_0xa938('0x2')](_0xa938('0x3'),'variable','customVariable',_0xa938('0x4')),'defaultValue':_0xa938('0x3')},'content':{'type':Sequelize[_0xa938('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa938('0x2')](_0xa938('0x3'),'variable',_0xa938('0x6'))},'keyContent':{'type':Sequelize[_0xa938('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa938('0x5')]}}; \ No newline at end of file +var _0x8406=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x55413e,_0x16ef84){var _0x473e97=function(_0x75c15f){while(--_0x75c15f){_0x55413e['push'](_0x55413e['shift']());}};_0x473e97(++_0x16ef84);}(_0x8406,0x10c));var _0x6840=function(_0x5946a0,_0x2b26e4){_0x5946a0=_0x5946a0-0x0;var _0x96a639=_0x8406[_0x5946a0];return _0x96a639;};'use strict';var Sequelize=require(_0x6840('0x0'));module[_0x6840('0x1')]={'type':{'type':Sequelize[_0x6840('0x2')](_0x6840('0x3'),_0x6840('0x4'),_0x6840('0x5'),_0x6840('0x6')),'defaultValue':_0x6840('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6840('0x7')]},'keyType':{'type':Sequelize[_0x6840('0x2')]('string','variable',_0x6840('0x5'))},'keyContent':{'type':Sequelize[_0x6840('0x7')]},'idField':{'type':Sequelize[_0x6840('0x7')]},'nameField':{'type':Sequelize[_0x6840('0x7')]},'customField':{'type':Sequelize[_0x6840('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6840('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f31bfba..842317a 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 _0x3822=['then','error','stack','name','index','map','VtigerField','fieldName','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','rows','show','includeAll','find','catch','create','body','update','params','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy'];(function(_0x426904,_0xf45a16){var _0x1a7def=function(_0x1e5f76){while(--_0x1e5f76){_0x426904['push'](_0x426904['shift']());}};_0x1a7def(++_0xf45a16);}(_0x3822,0x65));var _0x2382=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x3822[_0x20a558];return _0x53d3f7;};'use strict';var pdf=require(_0x2382('0x0'));var emlformat=require(_0x2382('0x1'));var rimraf=require(_0x2382('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2382('0x3'));var BPromise=require(_0x2382('0x4'));var Mustache=require(_0x2382('0x5'));var util=require(_0x2382('0x6'));var path=require('path');var sox=require(_0x2382('0x7'));var csv=require(_0x2382('0x8'));var ejs=require(_0x2382('0x9'));var fs=require('fs');var _=require(_0x2382('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2382('0xb'));var toCsv=require(_0x2382('0x8'));var querystring=require('querystring');var Papa=require(_0x2382('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2382('0xd'));var hardwareService=require(_0x2382('0xe'));var logger=require(_0x2382('0xf'))('api');var utils=require(_0x2382('0x10'));var config=require(_0x2382('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45d3f9,_0x1e129a){_0x1e129a=_0x1e129a||0xcc;return function(_0x5d3847){if(_0x5d3847){return _0x45d3f9[_0x2382('0x12')](_0x1e129a);}return _0x45d3f9[_0x2382('0x13')](_0x1e129a)[_0x2382('0x14')]();};}function respondWithResult(_0x18c79a,_0x55088e){_0x55088e=_0x55088e||0xc8;return function(_0x26fb0d){if(_0x26fb0d){return _0x18c79a[_0x2382('0x13')](_0x55088e)[_0x2382('0x15')](_0x26fb0d);}};}function respondWithFilteredResult(_0x5f31e4,_0x5b9190){return function(_0x2a3bcc){if(_0x2a3bcc){var _0x247845=_0x2a3bcc[_0x2382('0x16')],_0x884891=_0x5b9190[_0x2382('0x17')],_0x525fa2=_0x5b9190[_0x2382('0x17')]+_0x5b9190[_0x2382('0x18')],_0xe49e06;if(_0x525fa2>=_0x247845){_0x525fa2=_0x247845;_0xe49e06=0xc8;}else{_0xe49e06=0xce;}_0x5f31e4[_0x2382('0x13')](_0xe49e06);return _0x5f31e4[_0x2382('0x19')](_0x2382('0x1a'),_0x884891+'-'+_0x525fa2+'/'+_0x247845)[_0x2382('0x15')](_0x2a3bcc);}return null;};}function patchUpdates(_0x555aed){return function(_0x1be93e){try{jsonpatch[_0x2382('0x1b')](_0x1be93e,_0x555aed,!![]);}catch(_0x24a129){return BPromise[_0x2382('0x1c')](_0x24a129);}return _0x1be93e[_0x2382('0x1d')]();};}function saveUpdates(_0x59b0d3,_0x58b7af){return function(_0x1be473){if(_0x1be473){return _0x1be473['update'](_0x59b0d3)['then'](function(_0x3e5fc1){return _0x3e5fc1;});}return null;};}function removeEntity(_0x81feb6,_0x459616){return function(_0x1548c2){if(_0x1548c2){return _0x1548c2[_0x2382('0x1e')]()[_0x2382('0x1f')](function(){_0x81feb6[_0x2382('0x13')](0xcc)[_0x2382('0x14')]();});}};}function handleEntityNotFound(_0x17f387,_0x5c20a0){return function(_0x3fd63a){if(!_0x3fd63a){_0x17f387['sendStatus'](0x194);}return _0x3fd63a;};}function handleError(_0xa8e1a6,_0x59110f){_0x59110f=_0x59110f||0x1f4;return function(_0x52e0ea){logger[_0x2382('0x20')](_0x52e0ea[_0x2382('0x21')]);if(_0x52e0ea['name']){delete _0x52e0ea[_0x2382('0x22')];}_0xa8e1a6[_0x2382('0x13')](_0x59110f)['send'](_0x52e0ea);};}exports[_0x2382('0x23')]=function(_0x2c4053,_0x5bcd9b){var _0x413b5f={},_0x419407={},_0x238022={'count':0x0,'rows':[]};var _0x173835=_[_0x2382('0x24')](db[_0x2382('0x25')]['rawAttributes'],function(_0x1f2750){return{'name':_0x1f2750[_0x2382('0x26')],'type':_0x1f2750['type']['key']};});_0x419407[_0x2382('0x27')]=_[_0x2382('0x24')](_0x173835,'name');_0x419407['query']=_[_0x2382('0x28')](_0x2c4053[_0x2382('0x29')]);_0x419407['filters']=_[_0x2382('0x2a')](_0x419407[_0x2382('0x27')],_0x419407['query']);_0x413b5f['attributes']=_[_0x2382('0x2a')](_0x419407[_0x2382('0x27')],qs[_0x2382('0x2b')](_0x2c4053[_0x2382('0x29')][_0x2382('0x2b')]));_0x413b5f['attributes']=_0x413b5f['attributes'][_0x2382('0x2c')]?_0x413b5f[_0x2382('0x2d')]:_0x419407['model'];if(!_0x2c4053[_0x2382('0x29')][_0x2382('0x2e')]('nolimit')){_0x413b5f[_0x2382('0x18')]=qs['limit'](_0x2c4053[_0x2382('0x29')][_0x2382('0x18')]);_0x413b5f[_0x2382('0x17')]=qs['offset'](_0x2c4053[_0x2382('0x29')][_0x2382('0x17')]);}_0x413b5f[_0x2382('0x2f')]=qs[_0x2382('0x30')](_0x2c4053['query']['sort']);_0x413b5f['where']=qs[_0x2382('0x31')](_[_0x2382('0x32')](_0x2c4053[_0x2382('0x29')],_0x419407[_0x2382('0x31')]),_0x173835);if(_0x2c4053[_0x2382('0x29')][_0x2382('0x33')]){_0x413b5f[_0x2382('0x34')]=_[_0x2382('0x35')](_0x413b5f[_0x2382('0x34')],{'$or':_['map'](_0x173835,function(_0x22ac4b){if(_0x22ac4b[_0x2382('0x36')]!==_0x2382('0x37')){var _0x4cef2f={};_0x4cef2f[_0x22ac4b['name']]={'$like':'%'+_0x2c4053[_0x2382('0x29')][_0x2382('0x33')]+'%'};return _0x4cef2f;}})});}_0x413b5f=_[_0x2382('0x35')]({},_0x413b5f,_0x2c4053[_0x2382('0x38')]);var _0x52a7cc={'where':_0x413b5f['where']};return db[_0x2382('0x25')]['count'](_0x52a7cc)[_0x2382('0x1f')](function(_0x3d9544){_0x238022[_0x2382('0x16')]=_0x3d9544;if(_0x2c4053['query']['includeAll']){_0x413b5f['include']=[{'all':!![]}];}return db[_0x2382('0x25')]['findAll'](_0x413b5f);})[_0x2382('0x1f')](function(_0x1b9bbb){_0x238022[_0x2382('0x39')]=_0x1b9bbb;return _0x238022;})['then'](respondWithFilteredResult(_0x5bcd9b,_0x413b5f))['catch'](handleError(_0x5bcd9b,null));};exports[_0x2382('0x3a')]=function(_0x69bbbc,_0x35710e){var _0x66faaa={'raw':!![],'where':{'id':_0x69bbbc['params']['id']}},_0x580f77={};_0x580f77[_0x2382('0x27')]=_[_0x2382('0x28')](db[_0x2382('0x25')]['rawAttributes']);_0x580f77['query']=_[_0x2382('0x28')](_0x69bbbc['query']);_0x580f77[_0x2382('0x31')]=_[_0x2382('0x2a')](_0x580f77['model'],_0x580f77[_0x2382('0x29')]);_0x66faaa[_0x2382('0x2d')]=_[_0x2382('0x2a')](_0x580f77[_0x2382('0x27')],qs[_0x2382('0x2b')](_0x69bbbc[_0x2382('0x29')][_0x2382('0x2b')]));_0x66faaa[_0x2382('0x2d')]=_0x66faaa[_0x2382('0x2d')][_0x2382('0x2c')]?_0x66faaa[_0x2382('0x2d')]:_0x580f77[_0x2382('0x27')];if(_0x69bbbc[_0x2382('0x29')][_0x2382('0x3b')]){_0x66faaa['include']=[{'all':!![]}];}_0x66faaa=_[_0x2382('0x35')]({},_0x66faaa,_0x69bbbc[_0x2382('0x38')]);return db[_0x2382('0x25')][_0x2382('0x3c')](_0x66faaa)[_0x2382('0x1f')](handleEntityNotFound(_0x35710e,null))[_0x2382('0x1f')](respondWithResult(_0x35710e,null))[_0x2382('0x3d')](handleError(_0x35710e,null));};exports[_0x2382('0x3e')]=function(_0x466c13,_0x3c3f15){return db[_0x2382('0x25')][_0x2382('0x3e')](_0x466c13[_0x2382('0x3f')],{})[_0x2382('0x1f')](respondWithResult(_0x3c3f15,0xc9))[_0x2382('0x3d')](handleError(_0x3c3f15,null));};exports[_0x2382('0x40')]=function(_0x2815ea,_0x424f9d){if(_0x2815ea[_0x2382('0x3f')]['id']){delete _0x2815ea['body']['id'];}return db['VtigerField'][_0x2382('0x3c')]({'where':{'id':_0x2815ea[_0x2382('0x41')]['id']}})[_0x2382('0x1f')](handleEntityNotFound(_0x424f9d,null))[_0x2382('0x1f')](saveUpdates(_0x2815ea['body'],null))['then'](respondWithResult(_0x424f9d,null))[_0x2382('0x3d')](handleError(_0x424f9d,null));};exports['destroy']=function(_0x275c9f,_0x40d4b0){return db[_0x2382('0x25')][_0x2382('0x3c')]({'where':{'id':_0x275c9f[_0x2382('0x41')]['id']}})[_0x2382('0x1f')](handleEntityNotFound(_0x40d4b0,null))[_0x2382('0x1f')](removeEntity(_0x40d4b0,null))[_0x2382('0x3d')](handleError(_0x40d4b0,null));}; \ No newline at end of file +var _0x6f58=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','params','keys','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x3851ea,_0x2a2ee9){var _0x58db3c=function(_0x321c83){while(--_0x321c83){_0x3851ea['push'](_0x3851ea['shift']());}};_0x58db3c(++_0x2a2ee9);}(_0x6f58,0xe9));var _0x86f5=function(_0x228eb7,_0x526138){_0x228eb7=_0x228eb7-0x0;var _0x59da7a=_0x6f58[_0x228eb7];return _0x59da7a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x86f5('0x0'));var zipdir=require(_0x86f5('0x1'));var jsonpatch=require(_0x86f5('0x2'));var rp=require('request-promise');var moment=require(_0x86f5('0x3'));var BPromise=require(_0x86f5('0x4'));var Mustache=require('mustache');var util=require(_0x86f5('0x5'));var path=require(_0x86f5('0x6'));var sox=require('sox');var csv=require(_0x86f5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x86f5('0x8'));var squel=require('squel');var crypto=require(_0x86f5('0x9'));var jsforce=require(_0x86f5('0xa'));var deskjs=require(_0x86f5('0xb'));var toCsv=require(_0x86f5('0x7'));var querystring=require(_0x86f5('0xc'));var Papa=require(_0x86f5('0xd'));var Redis=require('ioredis');var authService=require(_0x86f5('0xe'));var qs=require(_0x86f5('0xf'));var as=require(_0x86f5('0x10'));var hardwareService=require(_0x86f5('0x11'));var logger=require(_0x86f5('0x12'))(_0x86f5('0x13'));var utils=require(_0x86f5('0x14'));var config=require(_0x86f5('0x15'));var db=require(_0x86f5('0x16'))['db'];function respondWithStatusCode(_0x272129,_0x264cbe){_0x264cbe=_0x264cbe||0xcc;return function(_0x4e2029){if(_0x4e2029){return _0x272129[_0x86f5('0x17')](_0x264cbe);}return _0x272129[_0x86f5('0x18')](_0x264cbe)[_0x86f5('0x19')]();};}function respondWithResult(_0x58ff3c,_0x9dafd){_0x9dafd=_0x9dafd||0xc8;return function(_0x5df6ad){if(_0x5df6ad){return _0x58ff3c[_0x86f5('0x18')](_0x9dafd)[_0x86f5('0x1a')](_0x5df6ad);}};}function respondWithFilteredResult(_0x4fea9f,_0x9b5f10){return function(_0x438619){if(_0x438619){var _0x27c5a5=_0x438619[_0x86f5('0x1b')],_0x8a4c28=_0x9b5f10[_0x86f5('0x1c')],_0xc297d8=_0x9b5f10[_0x86f5('0x1c')]+_0x9b5f10[_0x86f5('0x1d')],_0x5448c3;if(_0xc297d8>=_0x27c5a5){_0xc297d8=_0x27c5a5;_0x5448c3=0xc8;}else{_0x5448c3=0xce;}_0x4fea9f['status'](_0x5448c3);return _0x4fea9f[_0x86f5('0x1e')](_0x86f5('0x1f'),_0x8a4c28+'-'+_0xc297d8+'/'+_0x27c5a5)[_0x86f5('0x1a')](_0x438619);}return null;};}function patchUpdates(_0x48057d){return function(_0x3c8978){try{jsonpatch[_0x86f5('0x20')](_0x3c8978,_0x48057d,!![]);}catch(_0x2e2a01){return BPromise[_0x86f5('0x21')](_0x2e2a01);}return _0x3c8978[_0x86f5('0x22')]();};}function saveUpdates(_0x2dd300,_0x2ae4db){return function(_0x27e93f){if(_0x27e93f){return _0x27e93f['update'](_0x2dd300)[_0x86f5('0x23')](function(_0x4a2f85){return _0x4a2f85;});}return null;};}function removeEntity(_0x36bc77,_0xc77f9b){return function(_0x25887e){if(_0x25887e){return _0x25887e['destroy']()[_0x86f5('0x23')](function(){_0x36bc77[_0x86f5('0x18')](0xcc)[_0x86f5('0x19')]();});}};}function handleEntityNotFound(_0x2e0647,_0x4c4b8b){return function(_0x3fe9e7){if(!_0x3fe9e7){_0x2e0647['sendStatus'](0x194);}return _0x3fe9e7;};}function handleError(_0x46f147,_0x4ee00e){_0x4ee00e=_0x4ee00e||0x1f4;return function(_0x4416f5){logger['error'](_0x4416f5[_0x86f5('0x24')]);if(_0x4416f5['name']){delete _0x4416f5[_0x86f5('0x25')];}_0x46f147[_0x86f5('0x18')](_0x4ee00e)[_0x86f5('0x26')](_0x4416f5);};}exports[_0x86f5('0x27')]=function(_0x3fc3c6,_0xca25d3){var _0x4ab0c={},_0x4e8085={},_0xb9686e={'count':0x0,'rows':[]};var _0x138e46=_[_0x86f5('0x28')](db['VtigerField'][_0x86f5('0x29')],function(_0x54b8e6){return{'name':_0x54b8e6[_0x86f5('0x2a')],'type':_0x54b8e6[_0x86f5('0x2b')][_0x86f5('0x2c')]};});_0x4e8085['model']=_[_0x86f5('0x28')](_0x138e46,_0x86f5('0x25'));_0x4e8085[_0x86f5('0x2d')]=_['keys'](_0x3fc3c6[_0x86f5('0x2d')]);_0x4e8085[_0x86f5('0x2e')]=_[_0x86f5('0x2f')](_0x4e8085[_0x86f5('0x30')],_0x4e8085[_0x86f5('0x2d')]);_0x4ab0c[_0x86f5('0x31')]=_[_0x86f5('0x2f')](_0x4e8085[_0x86f5('0x30')],qs[_0x86f5('0x32')](_0x3fc3c6[_0x86f5('0x2d')][_0x86f5('0x32')]));_0x4ab0c[_0x86f5('0x31')]=_0x4ab0c[_0x86f5('0x31')][_0x86f5('0x33')]?_0x4ab0c[_0x86f5('0x31')]:_0x4e8085[_0x86f5('0x30')];if(!_0x3fc3c6[_0x86f5('0x2d')][_0x86f5('0x34')]('nolimit')){_0x4ab0c['limit']=qs[_0x86f5('0x1d')](_0x3fc3c6[_0x86f5('0x2d')][_0x86f5('0x1d')]);_0x4ab0c[_0x86f5('0x1c')]=qs[_0x86f5('0x1c')](_0x3fc3c6[_0x86f5('0x2d')][_0x86f5('0x1c')]);}_0x4ab0c[_0x86f5('0x35')]=qs['sort'](_0x3fc3c6[_0x86f5('0x2d')][_0x86f5('0x36')]);_0x4ab0c[_0x86f5('0x37')]=qs[_0x86f5('0x2e')](_[_0x86f5('0x38')](_0x3fc3c6[_0x86f5('0x2d')],_0x4e8085[_0x86f5('0x2e')]),_0x138e46);if(_0x3fc3c6[_0x86f5('0x2d')][_0x86f5('0x39')]){_0x4ab0c['where']=_[_0x86f5('0x3a')](_0x4ab0c['where'],{'$or':_[_0x86f5('0x28')](_0x138e46,function(_0x1b1ec9){if(_0x1b1ec9[_0x86f5('0x2b')]!==_0x86f5('0x3b')){var _0x13adde={};_0x13adde[_0x1b1ec9['name']]={'$like':'%'+_0x3fc3c6[_0x86f5('0x2d')]['filter']+'%'};return _0x13adde;}})});}_0x4ab0c=_[_0x86f5('0x3a')]({},_0x4ab0c,_0x3fc3c6[_0x86f5('0x3c')]);var _0x507842={'where':_0x4ab0c[_0x86f5('0x37')]};return db[_0x86f5('0x3d')][_0x86f5('0x1b')](_0x507842)[_0x86f5('0x23')](function(_0x5705c9){_0xb9686e['count']=_0x5705c9;if(_0x3fc3c6['query'][_0x86f5('0x3e')]){_0x4ab0c[_0x86f5('0x3f')]=[{'all':!![]}];}return db[_0x86f5('0x3d')][_0x86f5('0x40')](_0x4ab0c);})['then'](function(_0x41c001){_0xb9686e['rows']=_0x41c001;return _0xb9686e;})[_0x86f5('0x23')](respondWithFilteredResult(_0xca25d3,_0x4ab0c))['catch'](handleError(_0xca25d3,null));};exports['show']=function(_0x363d3a,_0x47b842){var _0x2db0c1={'raw':!![],'where':{'id':_0x363d3a[_0x86f5('0x41')]['id']}},_0x31bcda={};_0x31bcda[_0x86f5('0x30')]=_[_0x86f5('0x42')](db[_0x86f5('0x3d')][_0x86f5('0x29')]);_0x31bcda['query']=_[_0x86f5('0x42')](_0x363d3a[_0x86f5('0x2d')]);_0x31bcda[_0x86f5('0x2e')]=_[_0x86f5('0x2f')](_0x31bcda[_0x86f5('0x30')],_0x31bcda[_0x86f5('0x2d')]);_0x2db0c1[_0x86f5('0x31')]=_[_0x86f5('0x2f')](_0x31bcda[_0x86f5('0x30')],qs[_0x86f5('0x32')](_0x363d3a[_0x86f5('0x2d')][_0x86f5('0x32')]));_0x2db0c1[_0x86f5('0x31')]=_0x2db0c1['attributes']['length']?_0x2db0c1[_0x86f5('0x31')]:_0x31bcda[_0x86f5('0x30')];if(_0x363d3a['query'][_0x86f5('0x3e')]){_0x2db0c1[_0x86f5('0x3f')]=[{'all':!![]}];}_0x2db0c1=_[_0x86f5('0x3a')]({},_0x2db0c1,_0x363d3a[_0x86f5('0x3c')]);return db[_0x86f5('0x3d')][_0x86f5('0x43')](_0x2db0c1)['then'](handleEntityNotFound(_0x47b842,null))[_0x86f5('0x23')](respondWithResult(_0x47b842,null))[_0x86f5('0x44')](handleError(_0x47b842,null));};exports[_0x86f5('0x45')]=function(_0x20b958,_0x31a932){return db[_0x86f5('0x3d')][_0x86f5('0x45')](_0x20b958['body'],{})['then'](respondWithResult(_0x31a932,0xc9))[_0x86f5('0x44')](handleError(_0x31a932,null));};exports['update']=function(_0x380184,_0x34232e){if(_0x380184[_0x86f5('0x46')]['id']){delete _0x380184[_0x86f5('0x46')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x380184[_0x86f5('0x41')]['id']}})[_0x86f5('0x23')](handleEntityNotFound(_0x34232e,null))[_0x86f5('0x23')](saveUpdates(_0x380184[_0x86f5('0x46')],null))['then'](respondWithResult(_0x34232e,null))[_0x86f5('0x44')](handleError(_0x34232e,null));};exports['destroy']=function(_0x3cc75a,_0x202e29){return db[_0x86f5('0x3d')]['find']({'where':{'id':_0x3cc75a['params']['id']}})[_0x86f5('0x23')](handleEntityNotFound(_0x202e29,null))['then'](removeEntity(_0x202e29,null))[_0x86f5('0x44')](handleError(_0x202e29,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 646d31c..dc1eafc 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x4d6dbe,_0x5764a9){var _0xfc604f=function(_0x3e6aa0){while(--_0x3e6aa0){_0x4d6dbe['push'](_0x4d6dbe['shift']());}};_0xfc604f(++_0x5764a9);}(_0x7a54,0x106));var _0x47a5=function(_0x2149df,_0x5c6138){_0x2149df=_0x2149df-0x0;var _0x4d8c7a=_0x7a54[_0x2149df];return _0x4d8c7a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index d868658..c7f2959 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x3266=['../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x3266,0x6a));var _0x6326=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x3266[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14208e,_0x5402e5,_0x161f4e){return new BPromise(function(_0x5730e7,_0x2af571){return client[_0x6326('0xc')](_0x14208e,_0x161f4e)[_0x6326('0xd')](function(_0x1aee60){logger[_0x6326('0xe')]('VtigerField,\x20%s,\x20%s',_0x5402e5,_0x6326('0xf'));logger[_0x6326('0x10')](_0x6326('0x11'),_0x5402e5,_0x6326('0xf'),JSON[_0x6326('0x12')](_0x1aee60));if(_0x1aee60[_0x6326('0x13')]){if(_0x1aee60[_0x6326('0x13')][_0x6326('0x14')]===0x1f4){logger[_0x6326('0x13')](_0x6326('0x15'),_0x5402e5,_0x1aee60['error']['message']);return _0x2af571(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}logger['error'](_0x6326('0x15'),_0x5402e5,_0x1aee60['error'][_0x6326('0x16')]);return _0x5730e7(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}else{logger[_0x6326('0xe')](_0x6326('0x15'),_0x5402e5,_0x6326('0xf'));_0x5730e7(_0x1aee60['result'][_0x6326('0x16')]);}})['catch'](function(_0x5945ee){logger['error']('VtigerField,\x20%s,\x20%s',_0x5402e5,_0x5945ee);_0x2af571(_0x5945ee);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4c279e2..75b423a 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 _0x6ab6=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b969c,_0x561dd4){var _0x5c1e18=function(_0x30c9de){while(--_0x30c9de){_0x4b969c['push'](_0x4b969c['shift']());}};_0x5c1e18(++_0x561dd4);}(_0x6ab6,0xfd));var _0x66ab=function(_0x432d38,_0x201399){_0x432d38=_0x432d38-0x0;var _0x39c577=_0x6ab6[_0x432d38];return _0x39c577;};'use strict';var multer=require(_0x66ab('0x0'));var util=require(_0x66ab('0x1'));var path=require('path');var timeout=require(_0x66ab('0x2'));var express=require(_0x66ab('0x3'));var router=express[_0x66ab('0x4')]();var auth=require(_0x66ab('0x5'));var interaction=require(_0x66ab('0x6'));var config=require(_0x66ab('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x66ab('0x8')]('/',auth[_0x66ab('0x9')](),controller[_0x66ab('0xa')]);router[_0x66ab('0x8')](_0x66ab('0xb'),auth[_0x66ab('0x9')](),controller[_0x66ab('0xc')]);router[_0x66ab('0x8')](_0x66ab('0xd'),auth[_0x66ab('0x9')](),controller[_0x66ab('0xe')]);router[_0x66ab('0x8')]('/:id/fields',auth[_0x66ab('0x9')](),controller['getFields']);router[_0x66ab('0xf')]('/',auth[_0x66ab('0x9')](),controller['create']);router[_0x66ab('0xf')](_0x66ab('0xd'),auth[_0x66ab('0x9')](),controller['addConfiguration']);router[_0x66ab('0x10')](_0x66ab('0xb'),auth[_0x66ab('0x9')](),controller[_0x66ab('0x11')]);router[_0x66ab('0x12')](_0x66ab('0xb'),auth[_0x66ab('0x9')](),controller['destroy']);module[_0x66ab('0x13')]=router; \ No newline at end of file +var _0x9846=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x17c9c2,_0x15a877){var _0x9f0823=function(_0x40d2b9){while(--_0x40d2b9){_0x17c9c2['push'](_0x17c9c2['shift']());}};_0x9f0823(++_0x15a877);}(_0x9846,0x1af));var _0x6984=function(_0x598f61,_0x348009){_0x598f61=_0x598f61-0x0;var _0x42b336=_0x9846[_0x598f61];return _0x42b336;};'use strict';var multer=require('multer');var util=require(_0x6984('0x0'));var path=require(_0x6984('0x1'));var timeout=require(_0x6984('0x2'));var express=require(_0x6984('0x3'));var router=express['Router']();var auth=require(_0x6984('0x4'));var interaction=require(_0x6984('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x6984('0x6')]('/',auth[_0x6984('0x7')](),controller[_0x6984('0x8')]);router[_0x6984('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6984('0x9')]);router[_0x6984('0x6')](_0x6984('0xa'),auth[_0x6984('0x7')](),controller[_0x6984('0xb')]);router[_0x6984('0x6')](_0x6984('0xc'),auth['isAuthenticated'](),controller[_0x6984('0xd')]);router[_0x6984('0xe')]('/',auth['isAuthenticated'](),controller[_0x6984('0xf')]);router[_0x6984('0xe')]('/:id/configurations',auth[_0x6984('0x7')](),controller[_0x6984('0x10')]);router['put'](_0x6984('0x11'),auth[_0x6984('0x7')](),controller[_0x6984('0x12')]);router[_0x6984('0x13')](_0x6984('0x11'),auth[_0x6984('0x7')](),controller[_0x6984('0x14')]);module[_0x6984('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 b33d818..dfc61fa 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 _0x9d97=['exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize'];(function(_0x27fb22,_0xab9f66){var _0x2046fc=function(_0x1a692c){while(--_0x1a692c){_0x27fb22['push'](_0x27fb22['shift']());}};_0x2046fc(++_0xab9f66);}(_0x9d97,0x179));var _0x79d9=function(_0x2f0101,_0x4af170){_0x2f0101=_0x2f0101-0x0;var _0x1d1516=_0x9d97[_0x2f0101];return _0x1d1516;};'use strict';var Sequelize=require(_0x79d9('0x0'));module[_0x79d9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79d9('0x2')]},'username':{'type':Sequelize[_0x79d9('0x2')],'unique':_0x79d9('0x3')},'password':{'type':Sequelize[_0x79d9('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x79d9('0x2')],'unique':_0x79d9('0x4')},'authType':{'type':Sequelize[_0x79d9('0x5')](_0x79d9('0x6'),_0x79d9('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x79d9('0x8'),'newTab'),'defaultValue':_0x79d9('0x8')}}; \ No newline at end of file +var _0x4b72=['ENUM','password','integrationTab','sequelize','STRING','username','remoteUri'];(function(_0x454fef,_0xa9bdab){var _0x340cc1=function(_0x25f5f7){while(--_0x25f5f7){_0x454fef['push'](_0x454fef['shift']());}};_0x340cc1(++_0xa9bdab);}(_0x4b72,0x1f4));var _0x24b7=function(_0x29cc14,_0x177050){_0x29cc14=_0x29cc14-0x0;var _0x3ff37e=_0x4b72[_0x29cc14];return _0x3ff37e;};'use strict';var Sequelize=require(_0x24b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x24b7('0x1')]},'description':{'type':Sequelize[_0x24b7('0x1')]},'username':{'type':Sequelize[_0x24b7('0x1')],'unique':_0x24b7('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x24b7('0x1')]},'remoteUri':{'type':Sequelize[_0x24b7('0x1')],'unique':_0x24b7('0x3')},'authType':{'type':Sequelize[_0x24b7('0x4')](_0x24b7('0x5'),'token'),'defaultValue':_0x24b7('0x5')},'serverUrl':{'type':Sequelize[_0x24b7('0x1')]},'type':{'type':Sequelize[_0x24b7('0x4')](_0x24b7('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2c7857d..21a9ac6 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 _0xfccf=['apply','reject','save','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','params','length','find','create','body','update','destroy','getConfigurations','findOne','keys','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','description','group','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set'];(function(_0x3096b1,_0x4adeeb){var _0x3885e4=function(_0x157e12){while(--_0x157e12){_0x3096b1['push'](_0x3096b1['shift']());}};_0x3885e4(++_0x4adeeb);}(_0xfccf,0x1d9));var _0xffcc=function(_0x271836,_0x256cd0){_0x271836=_0x271836-0x0;var _0x5dffbf=_0xfccf[_0x271836];return _0x5dffbf;};'use strict';var pdf=require(_0xffcc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xffcc('0x1'));var zipdir=require(_0xffcc('0x2'));var jsonpatch=require(_0xffcc('0x3'));var rp=require(_0xffcc('0x4'));var moment=require(_0xffcc('0x5'));var BPromise=require(_0xffcc('0x6'));var Mustache=require(_0xffcc('0x7'));var util=require(_0xffcc('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xffcc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xffcc('0xa'));var jsforce=require(_0xffcc('0xb'));var deskjs=require(_0xffcc('0xc'));var toCsv=require(_0xffcc('0xd'));var querystring=require(_0xffcc('0xe'));var Papa=require(_0xffcc('0xf'));var Redis=require(_0xffcc('0x10'));var authService=require(_0xffcc('0x11'));var qs=require(_0xffcc('0x12'));var as=require(_0xffcc('0x13'));var hardwareService=require(_0xffcc('0x14'));var logger=require(_0xffcc('0x15'))(_0xffcc('0x16'));var utils=require(_0xffcc('0x17'));var config=require(_0xffcc('0x18'));var db=require(_0xffcc('0x19'))['db'];var integrations=require(_0xffcc('0x1a'));var jayson=require(_0xffcc('0x1b'));var client=jayson[_0xffcc('0x1c')][_0xffcc('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4d6e1a,_0x5dfbb0,_0x5999af){if(_0x5999af){var _0x9517c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9517c2[_0xffcc('0x1e')](_0x5dfbb0)){return _0x4d6e1a;}else{throw new db['Sequelize'][(_0xffcc('0x1f'))](_0xffcc('0x20'));}}else{return _0x4d6e1a;}}function respondWithRpcPromise(_0x526fcb,_0x888151,_0x37c2be,_0xf8ef97){return new BPromise(function(_0x210a1a,_0x57a03c){var _0x3427ae=_0xf8ef97||client;return _0x3427ae[_0xffcc('0x21')](_0x526fcb,_0x37c2be)['then'](function(_0x3c96d5){logger[_0xffcc('0x22')](_0xffcc('0x23'),_0x888151,_0xffcc('0x24'));logger['debug'](_0xffcc('0x25'),_0x888151,_0xffcc('0x24'),JSON[_0xffcc('0x26')](_0x3c96d5));if(_0x3c96d5[_0xffcc('0x27')]){if(_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x28')]===0x1f4){logger[_0xffcc('0x27')](_0xffcc('0x23'),_0x888151,_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x29')]);return _0x57a03c(_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x29')]);}logger[_0xffcc('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x888151,_0x3c96d5[_0xffcc('0x27')][_0xffcc('0x29')]);return _0x210a1a(_0x3c96d5[_0xffcc('0x27')]['message']);}else{logger[_0xffcc('0x22')](_0xffcc('0x23'),_0x888151,'request\x20sent');_0x210a1a(_0x3c96d5[_0xffcc('0x2a')][_0xffcc('0x29')]);}})[_0xffcc('0x2b')](function(_0x1927ee){logger[_0xffcc('0x27')](_0xffcc('0x23'),_0x888151,_0x1927ee);_0x57a03c(_0x1927ee);});});}function respondWithStatusCode(_0x339f29,_0x276292){_0x276292=_0x276292||0xcc;return function(_0xaef15a){if(_0xaef15a){return _0x339f29[_0xffcc('0x2c')](_0x276292);}return _0x339f29[_0xffcc('0x2d')](_0x276292)[_0xffcc('0x2e')]();};}function respondWithResult(_0x48e29d,_0x18d82c){_0x18d82c=_0x18d82c||0xc8;return function(_0x533cae){if(_0x533cae){return _0x48e29d[_0xffcc('0x2d')](_0x18d82c)[_0xffcc('0x2f')](_0x533cae);}};}function respondWithFilteredResult(_0xd64fab,_0x156ac2){return function(_0x103298){if(_0x103298){var _0xbe842=_0x103298['count'],_0x5b9627=_0x156ac2[_0xffcc('0x30')],_0x74164=_0x156ac2[_0xffcc('0x30')]+_0x156ac2[_0xffcc('0x31')],_0x19a902;if(_0x74164>=_0xbe842){_0x74164=_0xbe842;_0x19a902=0xc8;}else{_0x19a902=0xce;}_0xd64fab['status'](_0x19a902);return _0xd64fab[_0xffcc('0x32')]('Content-Range',_0x5b9627+'-'+_0x74164+'/'+_0xbe842)[_0xffcc('0x2f')](_0x103298);}return null;};}function patchUpdates(_0x58d13b){return function(_0x24dc3c){try{jsonpatch[_0xffcc('0x33')](_0x24dc3c,_0x58d13b,!![]);}catch(_0x31b141){return BPromise[_0xffcc('0x34')](_0x31b141);}return _0x24dc3c[_0xffcc('0x35')]();};}function saveUpdates(_0x1af8a5,_0x2679e6){return function(_0x44230e){if(_0x44230e){return _0x44230e['update'](_0x1af8a5)[_0xffcc('0x36')](function(_0x4f0b98){return _0x4f0b98;});}return null;};}function removeEntity(_0x3d99c4,_0x1f1c3e){return function(_0x44f7e2){if(_0x44f7e2){return _0x44f7e2['destroy']()[_0xffcc('0x36')](function(){_0x3d99c4[_0xffcc('0x2d')](0xcc)[_0xffcc('0x2e')]();});}};}function handleEntityNotFound(_0x2f3af9,_0x391e71){return function(_0x19639d){if(!_0x19639d){_0x2f3af9[_0xffcc('0x2c')](0x194);}return _0x19639d;};}function handleError(_0x29f825,_0x365efb){_0x365efb=_0x365efb||0x1f4;return function(_0x535114){logger['error'](_0x535114[_0xffcc('0x37')]);if(_0x535114[_0xffcc('0x38')]){delete _0x535114['name'];}_0x29f825[_0xffcc('0x2d')](_0x365efb)[_0xffcc('0x39')](_0x535114);};}exports[_0xffcc('0x3a')]=function(_0x56be33,_0xc2a8fb){var _0x5c2964={},_0x599509={},_0x4851cf={'count':0x0,'rows':[]};var _0x37828c=_[_0xffcc('0x3b')](db[_0xffcc('0x3c')][_0xffcc('0x3d')],function(_0xe31aa9){return{'name':_0xe31aa9[_0xffcc('0x3e')],'type':_0xe31aa9[_0xffcc('0x3f')][_0xffcc('0x40')]};});_0x599509[_0xffcc('0x41')]=_[_0xffcc('0x3b')](_0x37828c,_0xffcc('0x38'));_0x599509[_0xffcc('0x42')]=_['keys'](_0x56be33[_0xffcc('0x42')]);_0x599509['filters']=_[_0xffcc('0x43')](_0x599509[_0xffcc('0x41')],_0x599509[_0xffcc('0x42')]);_0x5c2964[_0xffcc('0x44')]=_[_0xffcc('0x43')](_0x599509[_0xffcc('0x41')],qs[_0xffcc('0x45')](_0x56be33[_0xffcc('0x42')][_0xffcc('0x45')]));_0x5c2964[_0xffcc('0x44')]=_0x5c2964[_0xffcc('0x44')]['length']?_0x5c2964[_0xffcc('0x44')]:_0x599509[_0xffcc('0x41')];if(!_0x56be33[_0xffcc('0x42')][_0xffcc('0x46')]('nolimit')){_0x5c2964['limit']=qs[_0xffcc('0x31')](_0x56be33[_0xffcc('0x42')][_0xffcc('0x31')]);_0x5c2964[_0xffcc('0x30')]=qs[_0xffcc('0x30')](_0x56be33[_0xffcc('0x42')]['offset']);}_0x5c2964[_0xffcc('0x47')]=qs[_0xffcc('0x48')](_0x56be33['query'][_0xffcc('0x48')]);_0x5c2964[_0xffcc('0x49')]=qs[_0xffcc('0x4a')](_['pick'](_0x56be33[_0xffcc('0x42')],_0x599509['filters']),_0x37828c);if(_0x56be33[_0xffcc('0x42')][_0xffcc('0x4b')]){_0x5c2964[_0xffcc('0x49')]=_['merge'](_0x5c2964[_0xffcc('0x49')],{'$or':_[_0xffcc('0x3b')](_0x37828c,function(_0x2fb400){if(_0x2fb400[_0xffcc('0x3f')]!=='VIRTUAL'){var _0xc83db6={};_0xc83db6[_0x2fb400[_0xffcc('0x38')]]={'$like':'%'+_0x56be33['query'][_0xffcc('0x4b')]+'%'};return _0xc83db6;}})});}_0x5c2964=_[_0xffcc('0x4c')]({},_0x5c2964,_0x56be33[_0xffcc('0x4d')]);var _0x192179={'where':_0x5c2964[_0xffcc('0x49')]};return db[_0xffcc('0x3c')][_0xffcc('0x4e')](_0x192179)['then'](function(_0x37b686){_0x4851cf[_0xffcc('0x4e')]=_0x37b686;if(_0x56be33[_0xffcc('0x42')][_0xffcc('0x4f')]){_0x5c2964[_0xffcc('0x50')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xffcc('0x51')](_0x5c2964);})[_0xffcc('0x36')](function(_0x5576cf){_0x4851cf[_0xffcc('0x52')]=_0x5576cf;return _0x4851cf;})[_0xffcc('0x36')](respondWithFilteredResult(_0xc2a8fb,_0x5c2964))[_0xffcc('0x2b')](handleError(_0xc2a8fb,null));};exports['show']=function(_0x27b711,_0x3e8182){var _0x242e31={'raw':![],'where':{'id':_0x27b711[_0xffcc('0x53')]['id']}},_0x3e54a0={};_0x3e54a0[_0xffcc('0x41')]=_['keys'](db[_0xffcc('0x3c')][_0xffcc('0x3d')]);_0x3e54a0[_0xffcc('0x42')]=_['keys'](_0x27b711[_0xffcc('0x42')]);_0x3e54a0[_0xffcc('0x4a')]=_[_0xffcc('0x43')](_0x3e54a0[_0xffcc('0x41')],_0x3e54a0[_0xffcc('0x42')]);_0x242e31[_0xffcc('0x44')]=_[_0xffcc('0x43')](_0x3e54a0[_0xffcc('0x41')],qs[_0xffcc('0x45')](_0x27b711[_0xffcc('0x42')]['fields']));_0x242e31[_0xffcc('0x44')]=_0x242e31[_0xffcc('0x44')][_0xffcc('0x54')]?_0x242e31['attributes']:_0x3e54a0[_0xffcc('0x41')];if(_0x27b711[_0xffcc('0x42')][_0xffcc('0x4f')]){_0x242e31['include']=[{'all':!![]}];}_0x242e31=_[_0xffcc('0x4c')]({},_0x242e31,_0x27b711[_0xffcc('0x4d')]);return db['ZendeskAccount'][_0xffcc('0x55')](_0x242e31)[_0xffcc('0x36')](handleEntityNotFound(_0x3e8182,null))['then'](respondWithResult(_0x3e8182,null))[_0xffcc('0x2b')](handleError(_0x3e8182,null));};exports[_0xffcc('0x56')]=function(_0x5a5bbd,_0x4c1b9d){return db['ZendeskAccount'][_0xffcc('0x56')](_0x5a5bbd[_0xffcc('0x57')],{})['then'](respondWithResult(_0x4c1b9d,0xc9))[_0xffcc('0x2b')](handleError(_0x4c1b9d,null));};exports[_0xffcc('0x58')]=function(_0x24e752,_0x444b3f){if(_0x24e752[_0xffcc('0x57')]['id']){delete _0x24e752[_0xffcc('0x57')]['id'];}return db['ZendeskAccount'][_0xffcc('0x55')]({'where':{'id':_0x24e752['params']['id']}})[_0xffcc('0x36')](handleEntityNotFound(_0x444b3f,null))[_0xffcc('0x36')](saveUpdates(_0x24e752[_0xffcc('0x57')],null))[_0xffcc('0x36')](respondWithResult(_0x444b3f,null))[_0xffcc('0x2b')](handleError(_0x444b3f,null));};exports[_0xffcc('0x59')]=function(_0x5c6728,_0x7c8472){return db[_0xffcc('0x3c')][_0xffcc('0x55')]({'where':{'id':_0x5c6728[_0xffcc('0x53')]['id']}})[_0xffcc('0x36')](handleEntityNotFound(_0x7c8472,null))[_0xffcc('0x36')](removeEntity(_0x7c8472,null))[_0xffcc('0x2b')](handleError(_0x7c8472,null));};exports[_0xffcc('0x5a')]=function(_0x1e7cf4,_0x8fd18b,_0xf9a242){var _0x480d7e={};var _0x205e57={};var _0x450eb0;var _0x2bc875;return db['ZendeskAccount'][_0xffcc('0x5b')]({'where':{'id':_0x1e7cf4['params']['id']}})['then'](handleEntityNotFound(_0x8fd18b,null))[_0xffcc('0x36')](function(_0x398e15){if(_0x398e15){_0x450eb0=_0x398e15;_0x205e57[_0xffcc('0x41')]=_[_0xffcc('0x5c')](db[_0xffcc('0x5d')][_0xffcc('0x3d')]);_0x205e57[_0xffcc('0x42')]=_['keys'](_0x1e7cf4['query']);_0x205e57[_0xffcc('0x4a')]=_[_0xffcc('0x43')](_0x205e57['model'],_0x205e57[_0xffcc('0x42')]);_0x480d7e[_0xffcc('0x44')]=_[_0xffcc('0x43')](_0x205e57[_0xffcc('0x41')],qs['fields'](_0x1e7cf4['query'][_0xffcc('0x45')]));_0x480d7e[_0xffcc('0x44')]=_0x480d7e['attributes']['length']?_0x480d7e[_0xffcc('0x44')]:_0x205e57[_0xffcc('0x41')];_0x480d7e['order']=qs[_0xffcc('0x48')](_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x48')]);_0x480d7e[_0xffcc('0x49')]=qs[_0xffcc('0x4a')](_[_0xffcc('0x5e')](_0x1e7cf4[_0xffcc('0x42')],_0x205e57[_0xffcc('0x4a')]));if(_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x4b')]){_0x480d7e[_0xffcc('0x49')]=_[_0xffcc('0x4c')](_0x480d7e[_0xffcc('0x49')],{'$or':_[_0xffcc('0x3b')](_0x480d7e['attributes'],function(_0x4680cd){var _0xfdf98b={};_0xfdf98b[_0x4680cd]={'$like':'%'+_0x1e7cf4['query'][_0xffcc('0x4b')]+'%'};return _0xfdf98b;})});}_0x480d7e=_[_0xffcc('0x4c')]({},_0x480d7e,_0x1e7cf4[_0xffcc('0x4d')]);return _0x450eb0[_0xffcc('0x5a')](_0x480d7e);}})[_0xffcc('0x36')](function(_0xbb3784){if(_0xbb3784){_0x2bc875=_0xbb3784[_0xffcc('0x54')];if(!_0x1e7cf4[_0xffcc('0x42')]['hasOwnProperty'](_0xffcc('0x5f'))){_0x480d7e[_0xffcc('0x31')]=qs[_0xffcc('0x31')](_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x31')]);_0x480d7e[_0xffcc('0x30')]=qs[_0xffcc('0x30')](_0x1e7cf4[_0xffcc('0x42')][_0xffcc('0x30')]);}return _0x450eb0[_0xffcc('0x5a')](_0x480d7e);}})[_0xffcc('0x36')](function(_0x34d940){if(_0x34d940){return _0x34d940?{'count':_0x2bc875,'rows':_0x34d940}:null;}})[_0xffcc('0x36')](respondWithResult(_0x8fd18b,null))[_0xffcc('0x2b')](handleError(_0x8fd18b,null));};exports[_0xffcc('0x60')]=function(_0x209727,_0x4313a3,_0x59c892){if(_0x209727['body']['id']){delete _0x209727[_0xffcc('0x57')]['id'];}return db[_0xffcc('0x3c')]['findOne']({'where':{'id':_0x209727[_0xffcc('0x53')]['id']}})[_0xffcc('0x36')](handleEntityNotFound(_0x4313a3,null))[_0xffcc('0x36')](function(_0x39b65e){if(_0x39b65e){_0x209727[_0xffcc('0x57')][_0xffcc('0x61')]=_0x39b65e['id'];_0x209727[_0xffcc('0x57')][_0xffcc('0x62')]=integrations[_0xffcc('0x63')](_0x209727['body'][_0xffcc('0x64')],_0x209727[_0xffcc('0x57')][_0xffcc('0x3f')]);_0x209727[_0xffcc('0x57')][_0xffcc('0x65')]=integrations[_0xffcc('0x66')](_0x209727[_0xffcc('0x57')][_0xffcc('0x64')],_0x209727[_0xffcc('0x57')][_0xffcc('0x3f')]);return db[_0xffcc('0x5d')][_0xffcc('0x56')](_0x209727[_0xffcc('0x57')],{'include':[{'model':db[_0xffcc('0x67')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0xffcc('0x65')}]});}return null;})[_0xffcc('0x36')](respondWithResult(_0x4313a3,null))[_0xffcc('0x2b')](handleError(_0x4313a3,null));};exports[_0xffcc('0x68')]=function(_0x4f0ae1,_0x4129de,_0x396ebc){var _0xe4a119='';return db[_0xffcc('0x3c')][_0xffcc('0x5b')]({'where':{'id':_0x4f0ae1['params']['id']},'attributes':['id',_0xffcc('0x69'),_0xffcc('0x6a'),_0xffcc('0x6b'),_0xffcc('0x6c'),_0xffcc('0x6d')]})['then'](handleEntityNotFound(_0x4129de,null))[_0xffcc('0x36')](function(_0x3897b9){if(_0x3897b9){_0xe4a119=_0x3897b9[_0xffcc('0x6d')];var _0x2773b4=_0xe4a119['slice'](-0x1);if(_0x2773b4==='/'){_0xe4a119=_0xe4a119[_0xffcc('0x6e')](0x0,_0xe4a119['lastIndexOf'](_0x2773b4));}var _0x3e65f6={'method':_0xffcc('0x6f'),'uri':util[_0xffcc('0x70')](_0xffcc('0x71'),_0xe4a119,_0xffcc('0x72')),'json':!![]};switch(_0x3897b9[_0xffcc('0x6c')]){case _0xffcc('0x6a'):_0x3e65f6[_0xffcc('0x73')]={'Authorization':util[_0xffcc('0x70')]('Basic\x20%s',new Buffer(util[_0xffcc('0x70')](_0xffcc('0x74'),_0x3897b9[_0xffcc('0x69')],_0x3897b9['password']))[_0xffcc('0x75')](_0xffcc('0x76')))};break;case'token':_0x3e65f6[_0xffcc('0x73')]={'Authorization':util[_0xffcc('0x70')](_0xffcc('0x77'),new Buffer(util[_0xffcc('0x70')](_0xffcc('0x78'),_0x3897b9['username'],_0x3897b9[_0xffcc('0x6b')]))['toString'](_0xffcc('0x76')))};break;default:throw new db['Sequelize'][(_0xffcc('0x1f'))](_0xffcc('0x79'));}return rp(_0x3e65f6);}})[_0xffcc('0x36')](function(_0x38ef89){if(_0x38ef89){var _0x433151=['subject',_0xffcc('0x7a'),_0xffcc('0x7b'),'assignee'];_['remove'](_0x38ef89[_0xffcc('0x72')],function(_0x30aba6){return _0x433151[_0xffcc('0x7c')](_0x30aba6[_0xffcc('0x3f')]);});return{'count':_0x38ef89[_0xffcc('0x72')][_0xffcc('0x54')],'rows':_[_0xffcc('0x3b')](_0x38ef89[_0xffcc('0x72')],function(_0x11e7ce){return{'id':_0x11e7ce['id'],'name':_0x11e7ce[_0xffcc('0x7d')]>0x7?_0x11e7ce['title']:_0x11e7ce[_0xffcc('0x3f')],'custom':_0x11e7ce[_0xffcc('0x7d')]>0x7?!![]:![],'options':_0x11e7ce[_0xffcc('0x7e')]?_0x11e7ce[_0xffcc('0x7e')]:_0x11e7ce[_0xffcc('0x7f')]?_0x11e7ce[_0xffcc('0x7f')]:[]};})};}})[_0xffcc('0x36')](respondWithResult(_0x4129de,null))[_0xffcc('0x2b')](function(_0x1196c9){var _0x3db0b6=_0x4f0ae1['query'][_0xffcc('0x1e')]?0x1f4:_0x1196c9[_0xffcc('0x80')]||0x1f4;logger[_0xffcc('0x27')](_0xffcc('0x81'),_0xffcc('0x68'),_0x3db0b6,JSON['stringify'](_0x1196c9));delete _0x1196c9['name'];if(_0x3db0b6===0x191){_0x3db0b6=0x190;}_0x4129de[_0xffcc('0x2d')](_0x3db0b6)[_0xffcc('0x39')](_0x4f0ae1[_0xffcc('0x42')][_0xffcc('0x1e')]?{'message':_0xffcc('0x82'),'statusCode':_0x1196c9['statusCode']}:_0x1196c9);});}; \ No newline at end of file +var _0x854e=['intersection','fields','length','find','create','body','params','getConfigurations','ZendeskConfiguration','filters','order','findOne','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','password','token','authType','remoteUri','slice','substring','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','hasOwnProperty','nolimit','limit','sort','pick','merge','where','filter','options','count','includeAll','include','findAll','rows','show'];(function(_0x147ee8,_0x1e62cc){var _0x334ba4=function(_0x1c07d3){while(--_0x1c07d3){_0x147ee8['push'](_0x147ee8['shift']());}};_0x334ba4(++_0x1e62cc);}(_0x854e,0x134));var _0xe854=function(_0x238885,_0x1c2ec1){_0x238885=_0x238885-0x0;var _0x22af11=_0x854e[_0x238885];return _0x22af11;};'use strict';var pdf=require(_0xe854('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe854('0x1'));var zipdir=require(_0xe854('0x2'));var jsonpatch=require(_0xe854('0x3'));var rp=require('request-promise');var moment=require(_0xe854('0x4'));var BPromise=require(_0xe854('0x5'));var Mustache=require(_0xe854('0x6'));var util=require(_0xe854('0x7'));var path=require(_0xe854('0x8'));var sox=require('sox');var csv=require(_0xe854('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe854('0xa'));var squel=require(_0xe854('0xb'));var crypto=require('crypto');var jsforce=require(_0xe854('0xc'));var deskjs=require(_0xe854('0xd'));var toCsv=require(_0xe854('0x9'));var querystring=require(_0xe854('0xe'));var Papa=require('papaparse');var Redis=require(_0xe854('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe854('0x10'));var hardwareService=require(_0xe854('0x11'));var logger=require(_0xe854('0x12'))(_0xe854('0x13'));var utils=require('../../config/utils');var config=require(_0xe854('0x14'));var db=require(_0xe854('0x15'))['db'];var integrations=require(_0xe854('0x16'));var jayson=require(_0xe854('0x17'));var client=jayson[_0xe854('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x127462,_0x2b6b45,_0x3c0d5c){if(_0x3c0d5c){var _0x2b20c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b20c0['test'](_0x2b6b45)){return _0x127462;}else{throw new db[(_0xe854('0x19'))][(_0xe854('0x1a'))](_0xe854('0x1b'));}}else{return _0x127462;}}function respondWithRpcPromise(_0x390e47,_0x5bbdb6,_0x485f71,_0x2328fd){return new BPromise(function(_0x52e164,_0x2f3680){var _0x2a9d4b=_0x2328fd||client;return _0x2a9d4b[_0xe854('0x1c')](_0x390e47,_0x485f71)[_0xe854('0x1d')](function(_0x95e4c9){logger['info'](_0xe854('0x1e'),_0x5bbdb6,_0xe854('0x1f'));logger['debug'](_0xe854('0x20'),_0x5bbdb6,_0xe854('0x1f'),JSON[_0xe854('0x21')](_0x95e4c9));if(_0x95e4c9['error']){if(_0x95e4c9['error']['code']===0x1f4){logger[_0xe854('0x22')](_0xe854('0x1e'),_0x5bbdb6,_0x95e4c9[_0xe854('0x22')][_0xe854('0x23')]);return _0x2f3680(_0x95e4c9['error']['message']);}logger[_0xe854('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x5bbdb6,_0x95e4c9[_0xe854('0x22')][_0xe854('0x23')]);return _0x52e164(_0x95e4c9[_0xe854('0x22')][_0xe854('0x23')]);}else{logger[_0xe854('0x24')](_0xe854('0x1e'),_0x5bbdb6,_0xe854('0x1f'));_0x52e164(_0x95e4c9[_0xe854('0x25')][_0xe854('0x23')]);}})[_0xe854('0x26')](function(_0x56b106){logger[_0xe854('0x22')](_0xe854('0x1e'),_0x5bbdb6,_0x56b106);_0x2f3680(_0x56b106);});});}function respondWithStatusCode(_0x178c06,_0x15d2db){_0x15d2db=_0x15d2db||0xcc;return function(_0x238b53){if(_0x238b53){return _0x178c06[_0xe854('0x27')](_0x15d2db);}return _0x178c06[_0xe854('0x28')](_0x15d2db)['end']();};}function respondWithResult(_0x25f40f,_0x3cf2fb){_0x3cf2fb=_0x3cf2fb||0xc8;return function(_0x3653f8){if(_0x3653f8){return _0x25f40f[_0xe854('0x28')](_0x3cf2fb)[_0xe854('0x29')](_0x3653f8);}};}function respondWithFilteredResult(_0x465c51,_0x863bc0){return function(_0x1e97a7){if(_0x1e97a7){var _0xdbc6db=_0x1e97a7['count'],_0x51a28e=_0x863bc0[_0xe854('0x2a')],_0x433dd5=_0x863bc0[_0xe854('0x2a')]+_0x863bc0['limit'],_0x22fc85;if(_0x433dd5>=_0xdbc6db){_0x433dd5=_0xdbc6db;_0x22fc85=0xc8;}else{_0x22fc85=0xce;}_0x465c51[_0xe854('0x28')](_0x22fc85);return _0x465c51[_0xe854('0x2b')](_0xe854('0x2c'),_0x51a28e+'-'+_0x433dd5+'/'+_0xdbc6db)['json'](_0x1e97a7);}return null;};}function patchUpdates(_0x38e3d2){return function(_0x4e3129){try{jsonpatch[_0xe854('0x2d')](_0x4e3129,_0x38e3d2,!![]);}catch(_0x299eb2){return BPromise[_0xe854('0x2e')](_0x299eb2);}return _0x4e3129[_0xe854('0x2f')]();};}function saveUpdates(_0x3abdfc,_0x496b97){return function(_0x1937ca){if(_0x1937ca){return _0x1937ca[_0xe854('0x30')](_0x3abdfc)[_0xe854('0x1d')](function(_0x40aaab){return _0x40aaab;});}return null;};}function removeEntity(_0x3e1938,_0x5b57f8){return function(_0x61752f){if(_0x61752f){return _0x61752f[_0xe854('0x31')]()['then'](function(){_0x3e1938[_0xe854('0x28')](0xcc)[_0xe854('0x32')]();});}};}function handleEntityNotFound(_0x2b5a9b,_0x407625){return function(_0x4026e1){if(!_0x4026e1){_0x2b5a9b['sendStatus'](0x194);}return _0x4026e1;};}function handleError(_0x6eee5b,_0x3344c0){_0x3344c0=_0x3344c0||0x1f4;return function(_0x48434a){logger[_0xe854('0x22')](_0x48434a[_0xe854('0x33')]);if(_0x48434a[_0xe854('0x34')]){delete _0x48434a[_0xe854('0x34')];}_0x6eee5b[_0xe854('0x28')](_0x3344c0)['send'](_0x48434a);};}exports[_0xe854('0x35')]=function(_0x30edf8,_0x52ef56){var _0x5a1430={},_0x2d451f={},_0x3b7ebd={'count':0x0,'rows':[]};var _0x189098=_[_0xe854('0x36')](db[_0xe854('0x37')][_0xe854('0x38')],function(_0x35be81){return{'name':_0x35be81[_0xe854('0x39')],'type':_0x35be81[_0xe854('0x3a')][_0xe854('0x3b')]};});_0x2d451f[_0xe854('0x3c')]=_['map'](_0x189098,_0xe854('0x34'));_0x2d451f[_0xe854('0x3d')]=_[_0xe854('0x3e')](_0x30edf8[_0xe854('0x3d')]);_0x2d451f['filters']=_['intersection'](_0x2d451f[_0xe854('0x3c')],_0x2d451f['query']);_0x5a1430[_0xe854('0x3f')]=_['intersection'](_0x2d451f['model'],qs['fields'](_0x30edf8[_0xe854('0x3d')]['fields']));_0x5a1430[_0xe854('0x3f')]=_0x5a1430[_0xe854('0x3f')]['length']?_0x5a1430[_0xe854('0x3f')]:_0x2d451f[_0xe854('0x3c')];if(!_0x30edf8[_0xe854('0x3d')][_0xe854('0x40')](_0xe854('0x41'))){_0x5a1430[_0xe854('0x42')]=qs[_0xe854('0x42')](_0x30edf8[_0xe854('0x3d')]['limit']);_0x5a1430['offset']=qs[_0xe854('0x2a')](_0x30edf8[_0xe854('0x3d')][_0xe854('0x2a')]);}_0x5a1430['order']=qs[_0xe854('0x43')](_0x30edf8[_0xe854('0x3d')][_0xe854('0x43')]);_0x5a1430['where']=qs['filters'](_[_0xe854('0x44')](_0x30edf8[_0xe854('0x3d')],_0x2d451f['filters']),_0x189098);if(_0x30edf8[_0xe854('0x3d')]['filter']){_0x5a1430['where']=_[_0xe854('0x45')](_0x5a1430[_0xe854('0x46')],{'$or':_[_0xe854('0x36')](_0x189098,function(_0x15cded){if(_0x15cded['type']!=='VIRTUAL'){var _0x3da082={};_0x3da082[_0x15cded[_0xe854('0x34')]]={'$like':'%'+_0x30edf8[_0xe854('0x3d')][_0xe854('0x47')]+'%'};return _0x3da082;}})});}_0x5a1430=_['merge']({},_0x5a1430,_0x30edf8[_0xe854('0x48')]);var _0x19282b={'where':_0x5a1430[_0xe854('0x46')]};return db[_0xe854('0x37')][_0xe854('0x49')](_0x19282b)['then'](function(_0x1d3d0c){_0x3b7ebd[_0xe854('0x49')]=_0x1d3d0c;if(_0x30edf8[_0xe854('0x3d')][_0xe854('0x4a')]){_0x5a1430[_0xe854('0x4b')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xe854('0x4c')](_0x5a1430);})[_0xe854('0x1d')](function(_0x4a7673){_0x3b7ebd[_0xe854('0x4d')]=_0x4a7673;return _0x3b7ebd;})[_0xe854('0x1d')](respondWithFilteredResult(_0x52ef56,_0x5a1430))[_0xe854('0x26')](handleError(_0x52ef56,null));};exports[_0xe854('0x4e')]=function(_0x40c998,_0x380598){var _0x43c94a={'raw':![],'where':{'id':_0x40c998['params']['id']}},_0x2fc703={};_0x2fc703[_0xe854('0x3c')]=_[_0xe854('0x3e')](db[_0xe854('0x37')]['rawAttributes']);_0x2fc703[_0xe854('0x3d')]=_[_0xe854('0x3e')](_0x40c998[_0xe854('0x3d')]);_0x2fc703['filters']=_['intersection'](_0x2fc703[_0xe854('0x3c')],_0x2fc703[_0xe854('0x3d')]);_0x43c94a[_0xe854('0x3f')]=_[_0xe854('0x4f')](_0x2fc703[_0xe854('0x3c')],qs[_0xe854('0x50')](_0x40c998[_0xe854('0x3d')]['fields']));_0x43c94a[_0xe854('0x3f')]=_0x43c94a['attributes'][_0xe854('0x51')]?_0x43c94a[_0xe854('0x3f')]:_0x2fc703[_0xe854('0x3c')];if(_0x40c998[_0xe854('0x3d')][_0xe854('0x4a')]){_0x43c94a[_0xe854('0x4b')]=[{'all':!![]}];}_0x43c94a=_[_0xe854('0x45')]({},_0x43c94a,_0x40c998['options']);return db['ZendeskAccount'][_0xe854('0x52')](_0x43c94a)[_0xe854('0x1d')](handleEntityNotFound(_0x380598,null))[_0xe854('0x1d')](respondWithResult(_0x380598,null))[_0xe854('0x26')](handleError(_0x380598,null));};exports[_0xe854('0x53')]=function(_0x3b9fad,_0x4bace8){return db[_0xe854('0x37')]['create'](_0x3b9fad[_0xe854('0x54')],{})[_0xe854('0x1d')](respondWithResult(_0x4bace8,0xc9))[_0xe854('0x26')](handleError(_0x4bace8,null));};exports['update']=function(_0x3deb83,_0x413600){if(_0x3deb83[_0xe854('0x54')]['id']){delete _0x3deb83[_0xe854('0x54')]['id'];}return db[_0xe854('0x37')]['find']({'where':{'id':_0x3deb83[_0xe854('0x55')]['id']}})[_0xe854('0x1d')](handleEntityNotFound(_0x413600,null))[_0xe854('0x1d')](saveUpdates(_0x3deb83[_0xe854('0x54')],null))[_0xe854('0x1d')](respondWithResult(_0x413600,null))[_0xe854('0x26')](handleError(_0x413600,null));};exports[_0xe854('0x31')]=function(_0xe3fe4b,_0x5f12e8){return db[_0xe854('0x37')][_0xe854('0x52')]({'where':{'id':_0xe3fe4b['params']['id']}})[_0xe854('0x1d')](handleEntityNotFound(_0x5f12e8,null))[_0xe854('0x1d')](removeEntity(_0x5f12e8,null))['catch'](handleError(_0x5f12e8,null));};exports[_0xe854('0x56')]=function(_0x11f7cf,_0x43814c,_0x592767){var _0x59b7ab={};var _0x10e042={};var _0x549ff0;var _0x5dafef;return db[_0xe854('0x37')]['findOne']({'where':{'id':_0x11f7cf['params']['id']}})[_0xe854('0x1d')](handleEntityNotFound(_0x43814c,null))[_0xe854('0x1d')](function(_0x158e2a){if(_0x158e2a){_0x549ff0=_0x158e2a;_0x10e042['model']=_['keys'](db[_0xe854('0x57')][_0xe854('0x38')]);_0x10e042[_0xe854('0x3d')]=_[_0xe854('0x3e')](_0x11f7cf[_0xe854('0x3d')]);_0x10e042[_0xe854('0x58')]=_[_0xe854('0x4f')](_0x10e042[_0xe854('0x3c')],_0x10e042[_0xe854('0x3d')]);_0x59b7ab['attributes']=_[_0xe854('0x4f')](_0x10e042[_0xe854('0x3c')],qs[_0xe854('0x50')](_0x11f7cf[_0xe854('0x3d')][_0xe854('0x50')]));_0x59b7ab[_0xe854('0x3f')]=_0x59b7ab['attributes'][_0xe854('0x51')]?_0x59b7ab[_0xe854('0x3f')]:_0x10e042[_0xe854('0x3c')];_0x59b7ab[_0xe854('0x59')]=qs[_0xe854('0x43')](_0x11f7cf[_0xe854('0x3d')][_0xe854('0x43')]);_0x59b7ab[_0xe854('0x46')]=qs[_0xe854('0x58')](_[_0xe854('0x44')](_0x11f7cf[_0xe854('0x3d')],_0x10e042[_0xe854('0x58')]));if(_0x11f7cf[_0xe854('0x3d')][_0xe854('0x47')]){_0x59b7ab[_0xe854('0x46')]=_[_0xe854('0x45')](_0x59b7ab[_0xe854('0x46')],{'$or':_[_0xe854('0x36')](_0x59b7ab[_0xe854('0x3f')],function(_0x10b004){var _0x26f6a6={};_0x26f6a6[_0x10b004]={'$like':'%'+_0x11f7cf[_0xe854('0x3d')][_0xe854('0x47')]+'%'};return _0x26f6a6;})});}_0x59b7ab=_[_0xe854('0x45')]({},_0x59b7ab,_0x11f7cf[_0xe854('0x48')]);return _0x549ff0[_0xe854('0x56')](_0x59b7ab);}})[_0xe854('0x1d')](function(_0x344f0b){if(_0x344f0b){_0x5dafef=_0x344f0b[_0xe854('0x51')];if(!_0x11f7cf[_0xe854('0x3d')][_0xe854('0x40')](_0xe854('0x41'))){_0x59b7ab[_0xe854('0x42')]=qs[_0xe854('0x42')](_0x11f7cf[_0xe854('0x3d')][_0xe854('0x42')]);_0x59b7ab['offset']=qs[_0xe854('0x2a')](_0x11f7cf[_0xe854('0x3d')][_0xe854('0x2a')]);}return _0x549ff0[_0xe854('0x56')](_0x59b7ab);}})[_0xe854('0x1d')](function(_0x16b2ba){if(_0x16b2ba){return _0x16b2ba?{'count':_0x5dafef,'rows':_0x16b2ba}:null;}})['then'](respondWithResult(_0x43814c,null))[_0xe854('0x26')](handleError(_0x43814c,null));};exports['addConfiguration']=function(_0x5314c9,_0x54f650,_0x390fe9){if(_0x5314c9[_0xe854('0x54')]['id']){delete _0x5314c9['body']['id'];}return db[_0xe854('0x37')][_0xe854('0x5a')]({'where':{'id':_0x5314c9[_0xe854('0x55')]['id']}})[_0xe854('0x1d')](handleEntityNotFound(_0x54f650,null))[_0xe854('0x1d')](function(_0x23417a){if(_0x23417a){_0x5314c9['body']['AccountId']=_0x23417a['id'];_0x5314c9[_0xe854('0x54')]['Subjects']=integrations[_0xe854('0x5b')](_0x5314c9['body'][_0xe854('0x5c')],_0x5314c9[_0xe854('0x54')][_0xe854('0x3a')]);_0x5314c9[_0xe854('0x54')][_0xe854('0x5d')]=integrations[_0xe854('0x5e')](_0x5314c9[_0xe854('0x54')]['channel'],_0x5314c9[_0xe854('0x54')][_0xe854('0x3a')]);return db[_0xe854('0x57')][_0xe854('0x53')](_0x5314c9[_0xe854('0x54')],{'include':[{'model':db[_0xe854('0x5f')],'as':_0xe854('0x60')},{'model':db[_0xe854('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x54f650,null))['catch'](handleError(_0x54f650,null));};exports['getFields']=function(_0x57777f,_0x4e5578,_0x41a8e8){var _0x1f13dc='';return db['ZendeskAccount'][_0xe854('0x5a')]({'where':{'id':_0x57777f[_0xe854('0x55')]['id']},'attributes':['id','username',_0xe854('0x61'),_0xe854('0x62'),_0xe854('0x63'),_0xe854('0x64')]})[_0xe854('0x1d')](handleEntityNotFound(_0x4e5578,null))['then'](function(_0xde6206){if(_0xde6206){_0x1f13dc=_0xde6206[_0xe854('0x64')];var _0x246926=_0x1f13dc[_0xe854('0x65')](-0x1);if(_0x246926==='/'){_0x1f13dc=_0x1f13dc[_0xe854('0x66')](0x0,_0x1f13dc['lastIndexOf'](_0x246926));}var _0x28e12a={'method':'GET','uri':util[_0xe854('0x67')](_0xe854('0x68'),_0x1f13dc,_0xe854('0x69')),'json':!![]};switch(_0xde6206[_0xe854('0x63')]){case'password':_0x28e12a[_0xe854('0x6a')]={'Authorization':util[_0xe854('0x67')](_0xe854('0x6b'),new Buffer(util[_0xe854('0x67')](_0xe854('0x6c'),_0xde6206[_0xe854('0x6d')],_0xde6206[_0xe854('0x61')]))[_0xe854('0x6e')](_0xe854('0x6f')))};break;case _0xe854('0x62'):_0x28e12a['headers']={'Authorization':util[_0xe854('0x67')](_0xe854('0x6b'),new Buffer(util['format'](_0xe854('0x70'),_0xde6206['username'],_0xde6206[_0xe854('0x62')]))[_0xe854('0x6e')]('base64'))};break;default:throw new db[(_0xe854('0x19'))][(_0xe854('0x1a'))](_0xe854('0x71'));}return rp(_0x28e12a);}})[_0xe854('0x1d')](function(_0x55d95d){if(_0x55d95d){var _0x38e34d=[_0xe854('0x72'),_0xe854('0x73'),_0xe854('0x74'),_0xe854('0x75')];_[_0xe854('0x76')](_0x55d95d['ticket_fields'],function(_0x1f7aba){return _0x38e34d[_0xe854('0x77')](_0x1f7aba[_0xe854('0x3a')]);});return{'count':_0x55d95d['ticket_fields']['length'],'rows':_[_0xe854('0x36')](_0x55d95d[_0xe854('0x69')],function(_0x3405f8){return{'id':_0x3405f8['id'],'name':_0x3405f8[_0xe854('0x78')]>0x7?_0x3405f8['title']:_0x3405f8[_0xe854('0x3a')],'custom':_0x3405f8[_0xe854('0x78')]>0x7?!![]:![],'options':_0x3405f8[_0xe854('0x79')]?_0x3405f8[_0xe854('0x79')]:_0x3405f8[_0xe854('0x7a')]?_0x3405f8[_0xe854('0x7a')]:[]};})};}})[_0xe854('0x1d')](respondWithResult(_0x4e5578,null))['catch'](function(_0x32fb44){var _0xdd97be=_0x57777f['query'][_0xe854('0x7b')]?0x1f4:_0x32fb44[_0xe854('0x7c')]||0x1f4;logger[_0xe854('0x22')](_0xe854('0x7d'),_0xe854('0x7e'),_0xdd97be,JSON['stringify'](_0x32fb44));delete _0x32fb44[_0xe854('0x34')];if(_0xdd97be===0x191){_0xdd97be=0x190;}_0x4e5578['status'](_0xdd97be)[_0xe854('0x7f')](_0x57777f[_0xe854('0x3d')][_0xe854('0x7b')]?{'message':_0xe854('0x80'),'statusCode':_0x32fb44[_0xe854('0x7c')]}:_0x32fb44);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index da25dc4..5a5cbdb 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 _0xd4e3=['api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','ZendeskAccount','lodash','../../config/logger'];(function(_0x3323a4,_0x41a2d0){var _0x2375d3=function(_0x3ce0d7){while(--_0x3ce0d7){_0x3323a4['push'](_0x3323a4['shift']());}};_0x2375d3(++_0x41a2d0);}(_0xd4e3,0xe4));var _0x3d4e=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xd4e3[_0x90f34f];return _0x4b18cf;};'use strict';var _=require(_0x3d4e('0x0'));var util=require('util');var logger=require(_0x3d4e('0x1'))(_0x3d4e('0x2'));var moment=require('moment');var BPromise=require(_0x3d4e('0x3'));var rp=require(_0x3d4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d4e('0x5'));var config=require(_0x3d4e('0x6'));var attributes=require(_0x3d4e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3d4e('0x8')]=function(_0x5ef6f7,_0x47e138){return _0x5ef6f7['define'](_0x3d4e('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x184d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','define','lodash','util','../../config/logger'];(function(_0xa8b991,_0x38a251){var _0x5208ee=function(_0x38cc5d){while(--_0x38cc5d){_0xa8b991['push'](_0xa8b991['shift']());}};_0x5208ee(++_0x38a251);}(_0x184d,0x111));var _0xd184=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x184d[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xd184('0x0'));var util=require(_0xd184('0x1'));var logger=require(_0xd184('0x2'))(_0xd184('0x3'));var moment=require(_0xd184('0x4'));var BPromise=require(_0xd184('0x5'));var rp=require(_0xd184('0x6'));var fs=require('fs');var path=require(_0xd184('0x7'));var rimraf=require(_0xd184('0x8'));var config=require(_0xd184('0x9'));var attributes=require(_0xd184('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4f0b54,_0x2e060b){return _0x4f0b54[_0xd184('0xb')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index eb57508..201dd99 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x43eadd,_0x36ca50){var _0x125bde=function(_0x5d74cf){while(--_0x5d74cf){_0x43eadd['push'](_0x43eadd['shift']());}};_0x125bde(++_0x36ca50);}(_0xe706,0xa3));var _0x6e70=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe706[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index aed9189..086922e 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 _0x0a18=['../../components/auth/service','../../config/environment','index','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id/tags','setTags','update','delete','exports','multer','util','express','Router'];(function(_0x3cb27f,_0x1db6db){var _0x461ca0=function(_0x32c6e6){while(--_0x32c6e6){_0x3cb27f['push'](_0x3cb27f['shift']());}};_0x461ca0(++_0x1db6db);}(_0x0a18,0x80));var _0x80a1=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x0a18[_0x119d5a];return _0x15bff4;};'use strict';var multer=require(_0x80a1('0x0'));var util=require(_0x80a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x80a1('0x2'));var router=express[_0x80a1('0x3')]();var auth=require(_0x80a1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x80a1('0x5'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x80a1('0x6')]);router[_0x80a1('0x7')](_0x80a1('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x80a1('0x7')](_0x80a1('0x9'),auth[_0x80a1('0xa')](),controller[_0x80a1('0xb')]);router[_0x80a1('0x7')](_0x80a1('0xc'),auth[_0x80a1('0xa')](),controller[_0x80a1('0xd')]);router[_0x80a1('0x7')](_0x80a1('0xe'),auth[_0x80a1('0xa')](),controller['getDescriptions']);router[_0x80a1('0x7')]('/:id/tags',auth[_0x80a1('0xa')](),controller['getTags']);router[_0x80a1('0xf')]('/',auth[_0x80a1('0xa')](),controller[_0x80a1('0x10')]);router[_0x80a1('0xf')](_0x80a1('0x11'),auth[_0x80a1('0xa')](),controller[_0x80a1('0x12')]);router['put'](_0x80a1('0x8'),auth['isAuthenticated'](),controller[_0x80a1('0x13')]);router[_0x80a1('0x14')](_0x80a1('0x8'),auth[_0x80a1('0xa')](),controller['destroy']);module[_0x80a1('0x15')]=router; \ No newline at end of file +var _0x37f5=['getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x41a7d4,_0x409980){var _0x496a94=function(_0x17a65c){while(--_0x17a65c){_0x41a7d4['push'](_0x41a7d4['shift']());}};_0x496a94(++_0x409980);}(_0x37f5,0x10f));var _0x537f=function(_0x40155e,_0x4ef05c){_0x40155e=_0x40155e-0x0;var _0x1b1a63=_0x37f5[_0x40155e];return _0x1b1a63;};'use strict';var multer=require(_0x537f('0x0'));var util=require(_0x537f('0x1'));var path=require('path');var timeout=require(_0x537f('0x2'));var express=require(_0x537f('0x3'));var router=express[_0x537f('0x4')]();var auth=require(_0x537f('0x5'));var interaction=require(_0x537f('0x6'));var config=require(_0x537f('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x537f('0x8')]('/',auth[_0x537f('0x9')](),controller[_0x537f('0xa')]);router[_0x537f('0x8')](_0x537f('0xb'),auth['isAuthenticated'](),controller[_0x537f('0xc')]);router['get']('/:id/fields',auth[_0x537f('0x9')](),controller[_0x537f('0xd')]);router['get'](_0x537f('0xe'),auth[_0x537f('0x9')](),controller[_0x537f('0xf')]);router[_0x537f('0x8')](_0x537f('0x10'),auth[_0x537f('0x9')](),controller['getDescriptions']);router[_0x537f('0x8')](_0x537f('0x11'),auth[_0x537f('0x9')](),controller[_0x537f('0x12')]);router[_0x537f('0x13')]('/',auth[_0x537f('0x9')](),controller['create']);router[_0x537f('0x13')]('/:id/tags',auth['isAuthenticated'](),controller[_0x537f('0x14')]);router[_0x537f('0x15')](_0x537f('0xb'),auth[_0x537f('0x9')](),controller[_0x537f('0x16')]);router[_0x537f('0x17')]('/:id',auth[_0x537f('0x9')](),controller[_0x537f('0x18')]);module[_0x537f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index ce9e618..affe3fe 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 _0xe7f9=['exports','STRING','sequelize'];(function(_0xfaaad,_0x4c46e6){var _0x59136e=function(_0x96abfb){while(--_0x96abfb){_0xfaaad['push'](_0xfaaad['shift']());}};_0x59136e(++_0x4c46e6);}(_0xe7f9,0x9e));var _0x9e7f=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xe7f9[_0x136619];return _0x38c4a5;};'use strict';var Sequelize=require(_0x9e7f('0x0'));module[_0x9e7f('0x1')]={'name':{'type':Sequelize[_0x9e7f('0x2')]},'description':{'type':Sequelize[_0x9e7f('0x2')]}}; \ No newline at end of file +var _0x05bf=['exports','STRING','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x05bf,0xb9));var _0xf05b=function(_0x286d51,_0x3df07e){_0x286d51=_0x286d51-0x0;var _0x1d3579=_0x05bf[_0x286d51];return _0x1d3579;};'use strict';var Sequelize=require(_0xf05b('0x0'));module[_0xf05b('0x1')]={'name':{'type':Sequelize[_0xf05b('0x2')]},'description':{'type':Sequelize[_0xf05b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5775c4c..b58126e 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 _0x07b3=['../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','options','ZendeskConfiguration','includeAll','include','findAll','find','catch','create','body','params','destroy','findOne','ZendeskField','filter','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x07b3,0x1d1));var _0x307b=function(_0x2631cb,_0x4f5593){_0x2631cb=_0x2631cb-0x0;var _0x13fad3=_0x07b3[_0x2631cb];return _0x13fad3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x307b('0x0'));var rimraf=require(_0x307b('0x1'));var zipdir=require(_0x307b('0x2'));var jsonpatch=require(_0x307b('0x3'));var rp=require(_0x307b('0x4'));var moment=require('moment');var BPromise=require(_0x307b('0x5'));var Mustache=require(_0x307b('0x6'));var util=require(_0x307b('0x7'));var path=require(_0x307b('0x8'));var sox=require(_0x307b('0x9'));var csv=require(_0x307b('0xa'));var ejs=require(_0x307b('0xb'));var fs=require('fs');var _=require(_0x307b('0xc'));var squel=require('squel');var crypto=require(_0x307b('0xd'));var jsforce=require(_0x307b('0xe'));var deskjs=require(_0x307b('0xf'));var toCsv=require(_0x307b('0xa'));var querystring=require(_0x307b('0x10'));var Papa=require(_0x307b('0x11'));var Redis=require(_0x307b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x307b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x307b('0x14'))('api');var utils=require(_0x307b('0x15'));var config=require(_0x307b('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x307b('0x17'));var client=jayson[_0x307b('0x18')][_0x307b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4c480d,_0x4fd248,_0x113efb){if(_0x113efb){var _0x5a9656=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a9656[_0x307b('0x1a')](_0x4fd248)){return _0x4c480d;}else{throw new db[(_0x307b('0x1b'))][(_0x307b('0x1c'))](_0x307b('0x1d'));}}else{return _0x4c480d;}}function respondWithRpcPromise(_0xfff438,_0x409a19,_0x37c5d5,_0x1ceb06){return new BPromise(function(_0x5cb332,_0x57a4e4){var _0x327259=_0x1ceb06||client;return _0x327259[_0x307b('0x1e')](_0xfff438,_0x37c5d5)[_0x307b('0x1f')](function(_0x29a9ed){logger['info'](_0x307b('0x20'),_0x409a19,_0x307b('0x21'));logger[_0x307b('0x22')](_0x307b('0x23'),_0x409a19,_0x307b('0x21'),JSON[_0x307b('0x24')](_0x29a9ed));if(_0x29a9ed['error']){if(_0x29a9ed[_0x307b('0x25')][_0x307b('0x26')]===0x1f4){logger['error'](_0x307b('0x20'),_0x409a19,_0x29a9ed[_0x307b('0x25')][_0x307b('0x27')]);return _0x57a4e4(_0x29a9ed[_0x307b('0x25')][_0x307b('0x27')]);}logger[_0x307b('0x25')](_0x307b('0x20'),_0x409a19,_0x29a9ed[_0x307b('0x25')][_0x307b('0x27')]);return _0x5cb332(_0x29a9ed['error'][_0x307b('0x27')]);}else{logger[_0x307b('0x28')](_0x307b('0x20'),_0x409a19,_0x307b('0x21'));_0x5cb332(_0x29a9ed[_0x307b('0x29')][_0x307b('0x27')]);}})['catch'](function(_0x29d69d){logger[_0x307b('0x25')]('ZendeskConfiguration,\x20%s,\x20%s',_0x409a19,_0x29d69d);_0x57a4e4(_0x29d69d);});});}function respondWithStatusCode(_0x37264b,_0x1b3981){_0x1b3981=_0x1b3981||0xcc;return function(_0xd8c175){if(_0xd8c175){return _0x37264b[_0x307b('0x2a')](_0x1b3981);}return _0x37264b[_0x307b('0x2b')](_0x1b3981)[_0x307b('0x2c')]();};}function respondWithResult(_0x550c8f,_0x10ca70){_0x10ca70=_0x10ca70||0xc8;return function(_0x5e89c6){if(_0x5e89c6){return _0x550c8f[_0x307b('0x2b')](_0x10ca70)[_0x307b('0x2d')](_0x5e89c6);}};}function respondWithFilteredResult(_0x2fbcc5,_0xe32933){return function(_0x38e2a8){if(_0x38e2a8){var _0xe6b998=_0x38e2a8[_0x307b('0x2e')],_0x1c9fb7=_0xe32933[_0x307b('0x2f')],_0x45170a=_0xe32933[_0x307b('0x2f')]+_0xe32933['limit'],_0x3fc62b;if(_0x45170a>=_0xe6b998){_0x45170a=_0xe6b998;_0x3fc62b=0xc8;}else{_0x3fc62b=0xce;}_0x2fbcc5[_0x307b('0x2b')](_0x3fc62b);return _0x2fbcc5['set'](_0x307b('0x30'),_0x1c9fb7+'-'+_0x45170a+'/'+_0xe6b998)[_0x307b('0x2d')](_0x38e2a8);}return null;};}function patchUpdates(_0x53c5df){return function(_0x1b2a2d){try{jsonpatch[_0x307b('0x31')](_0x1b2a2d,_0x53c5df,!![]);}catch(_0x3e5438){return BPromise[_0x307b('0x32')](_0x3e5438);}return _0x1b2a2d['save']();};}function saveUpdates(_0xac6df3,_0x155df1){return function(_0x5dcc07){if(_0x5dcc07){return _0x5dcc07[_0x307b('0x33')](_0xac6df3)[_0x307b('0x1f')](function(_0x4ec7e8){return _0x4ec7e8;});}return null;};}function removeEntity(_0x4bbd37,_0x25b36a){return function(_0x383aea){if(_0x383aea){return _0x383aea['destroy']()['then'](function(){_0x4bbd37[_0x307b('0x2b')](0xcc)[_0x307b('0x2c')]();});}};}function handleEntityNotFound(_0x1184ec,_0x298c4a){return function(_0x3b5c38){if(!_0x3b5c38){_0x1184ec[_0x307b('0x2a')](0x194);}return _0x3b5c38;};}function handleError(_0x492464,_0x7b2d72){_0x7b2d72=_0x7b2d72||0x1f4;return function(_0x4b8a80){logger[_0x307b('0x25')](_0x4b8a80[_0x307b('0x34')]);if(_0x4b8a80[_0x307b('0x35')]){delete _0x4b8a80['name'];}_0x492464[_0x307b('0x2b')](_0x7b2d72)[_0x307b('0x36')](_0x4b8a80);};}exports[_0x307b('0x37')]=function(_0x1991ea,_0x5083e3){var _0x1cb713={},_0x41af4c={},_0x3a130c={'count':0x0,'rows':[]};var _0x2a3fb6=_['map'](db['ZendeskConfiguration'][_0x307b('0x38')],function(_0x3fe261){return{'name':_0x3fe261['fieldName'],'type':_0x3fe261[_0x307b('0x39')][_0x307b('0x3a')]};});_0x41af4c['model']=_[_0x307b('0x3b')](_0x2a3fb6,_0x307b('0x35'));_0x41af4c[_0x307b('0x3c')]=_[_0x307b('0x3d')](_0x1991ea[_0x307b('0x3c')]);_0x41af4c['filters']=_[_0x307b('0x3e')](_0x41af4c[_0x307b('0x3f')],_0x41af4c[_0x307b('0x3c')]);_0x1cb713[_0x307b('0x40')]=_['intersection'](_0x41af4c[_0x307b('0x3f')],qs[_0x307b('0x41')](_0x1991ea['query'][_0x307b('0x41')]));_0x1cb713[_0x307b('0x40')]=_0x1cb713[_0x307b('0x40')][_0x307b('0x42')]?_0x1cb713[_0x307b('0x40')]:_0x41af4c[_0x307b('0x3f')];if(!_0x1991ea[_0x307b('0x3c')][_0x307b('0x43')](_0x307b('0x44'))){_0x1cb713[_0x307b('0x45')]=qs[_0x307b('0x45')](_0x1991ea[_0x307b('0x3c')][_0x307b('0x45')]);_0x1cb713[_0x307b('0x2f')]=qs[_0x307b('0x2f')](_0x1991ea[_0x307b('0x3c')][_0x307b('0x2f')]);}_0x1cb713[_0x307b('0x46')]=qs[_0x307b('0x47')](_0x1991ea['query']['sort']);_0x1cb713['where']=qs[_0x307b('0x48')](_[_0x307b('0x49')](_0x1991ea[_0x307b('0x3c')],_0x41af4c['filters']),_0x2a3fb6);if(_0x1991ea[_0x307b('0x3c')]['filter']){_0x1cb713[_0x307b('0x4a')]=_['merge'](_0x1cb713[_0x307b('0x4a')],{'$or':_[_0x307b('0x3b')](_0x2a3fb6,function(_0x3633ed){if(_0x3633ed[_0x307b('0x39')]!=='VIRTUAL'){var _0x499c10={};_0x499c10[_0x3633ed[_0x307b('0x35')]]={'$like':'%'+_0x1991ea[_0x307b('0x3c')]['filter']+'%'};return _0x499c10;}})});}_0x1cb713=_[_0x307b('0x4b')]({},_0x1cb713,_0x1991ea[_0x307b('0x4c')]);var _0x5d2f8d={'where':_0x1cb713[_0x307b('0x4a')]};return db[_0x307b('0x4d')][_0x307b('0x2e')](_0x5d2f8d)[_0x307b('0x1f')](function(_0xca044e){_0x3a130c[_0x307b('0x2e')]=_0xca044e;if(_0x1991ea[_0x307b('0x3c')][_0x307b('0x4e')]){_0x1cb713[_0x307b('0x4f')]=[{'all':!![]}];}return db[_0x307b('0x4d')][_0x307b('0x50')](_0x1cb713);})[_0x307b('0x1f')](function(_0x37aa0c){_0x3a130c['rows']=_0x37aa0c;return _0x3a130c;})[_0x307b('0x1f')](respondWithFilteredResult(_0x5083e3,_0x1cb713))['catch'](handleError(_0x5083e3,null));};exports['show']=function(_0x55f2d9,_0x53d50c){var _0x193e6b={'raw':![],'where':{'id':_0x55f2d9['params']['id']}},_0x3ec52e={};_0x3ec52e[_0x307b('0x3f')]=_[_0x307b('0x3d')](db[_0x307b('0x4d')][_0x307b('0x38')]);_0x3ec52e[_0x307b('0x3c')]=_[_0x307b('0x3d')](_0x55f2d9[_0x307b('0x3c')]);_0x3ec52e[_0x307b('0x48')]=_[_0x307b('0x3e')](_0x3ec52e['model'],_0x3ec52e['query']);_0x193e6b[_0x307b('0x40')]=_[_0x307b('0x3e')](_0x3ec52e[_0x307b('0x3f')],qs[_0x307b('0x41')](_0x55f2d9[_0x307b('0x3c')][_0x307b('0x41')]));_0x193e6b[_0x307b('0x40')]=_0x193e6b[_0x307b('0x40')][_0x307b('0x42')]?_0x193e6b[_0x307b('0x40')]:_0x3ec52e[_0x307b('0x3f')];if(_0x55f2d9['query']['includeAll']){_0x193e6b[_0x307b('0x4f')]=[{'all':!![]}];}_0x193e6b=_[_0x307b('0x4b')]({},_0x193e6b,_0x55f2d9['options']);return db['ZendeskConfiguration'][_0x307b('0x51')](_0x193e6b)[_0x307b('0x1f')](handleEntityNotFound(_0x53d50c,null))['then'](respondWithResult(_0x53d50c,null))[_0x307b('0x52')](handleError(_0x53d50c,null));};exports[_0x307b('0x53')]=function(_0x1c8a4d,_0x412213){return db[_0x307b('0x4d')][_0x307b('0x53')](_0x1c8a4d[_0x307b('0x54')],{})[_0x307b('0x1f')](respondWithResult(_0x412213,0xc9))[_0x307b('0x52')](handleError(_0x412213,null));};exports[_0x307b('0x33')]=function(_0x528cf8,_0x433ec8){if(_0x528cf8[_0x307b('0x54')]['id']){delete _0x528cf8[_0x307b('0x54')]['id'];}return db[_0x307b('0x4d')][_0x307b('0x51')]({'where':{'id':_0x528cf8[_0x307b('0x55')]['id']}})[_0x307b('0x1f')](handleEntityNotFound(_0x433ec8,null))['then'](saveUpdates(_0x528cf8[_0x307b('0x54')],null))[_0x307b('0x1f')](respondWithResult(_0x433ec8,null))[_0x307b('0x52')](handleError(_0x433ec8,null));};exports[_0x307b('0x56')]=function(_0x4afeb0,_0x2b9321){return db[_0x307b('0x4d')][_0x307b('0x51')]({'where':{'id':_0x4afeb0[_0x307b('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b9321,null))[_0x307b('0x1f')](removeEntity(_0x2b9321,null))['catch'](handleError(_0x2b9321,null));};exports['getFields']=function(_0x2643b6,_0x53444a,_0x5855aa){var _0x5d971c={};var _0x361e8d={};var _0x58cdd0;var _0x3120f2;return db[_0x307b('0x4d')][_0x307b('0x57')]({'where':{'id':_0x2643b6[_0x307b('0x55')]['id']}})[_0x307b('0x1f')](handleEntityNotFound(_0x53444a,null))[_0x307b('0x1f')](function(_0x4c71ae){if(_0x4c71ae){_0x58cdd0=_0x4c71ae;_0x361e8d[_0x307b('0x3f')]=_['keys'](db[_0x307b('0x58')][_0x307b('0x38')]);_0x361e8d[_0x307b('0x3c')]=_['keys'](_0x2643b6[_0x307b('0x3c')]);_0x361e8d[_0x307b('0x48')]=_['intersection'](_0x361e8d[_0x307b('0x3f')],_0x361e8d[_0x307b('0x3c')]);_0x5d971c['attributes']=_[_0x307b('0x3e')](_0x361e8d[_0x307b('0x3f')],qs[_0x307b('0x41')](_0x2643b6['query']['fields']));_0x5d971c[_0x307b('0x40')]=_0x5d971c[_0x307b('0x40')][_0x307b('0x42')]?_0x5d971c[_0x307b('0x40')]:_0x361e8d[_0x307b('0x3f')];_0x5d971c[_0x307b('0x46')]=qs[_0x307b('0x47')](_0x2643b6[_0x307b('0x3c')][_0x307b('0x47')]);_0x5d971c['where']=qs[_0x307b('0x48')](_[_0x307b('0x49')](_0x2643b6['query'],_0x361e8d[_0x307b('0x48')]));if(_0x2643b6['query'][_0x307b('0x59')]){_0x5d971c[_0x307b('0x4a')]=_[_0x307b('0x4b')](_0x5d971c[_0x307b('0x4a')],{'$or':_[_0x307b('0x3b')](_0x5d971c[_0x307b('0x40')],function(_0x83a3f4){var _0x2f2380={};_0x2f2380[_0x83a3f4]={'$like':'%'+_0x2643b6[_0x307b('0x3c')]['filter']+'%'};return _0x2f2380;})});}_0x5d971c=_['merge']({},_0x5d971c,_0x2643b6[_0x307b('0x4c')]);return _0x58cdd0['getFields'](_0x5d971c);}})['then'](function(_0x31ba2d){if(_0x31ba2d){_0x3120f2=_0x31ba2d[_0x307b('0x42')];if(!_0x2643b6[_0x307b('0x3c')][_0x307b('0x43')](_0x307b('0x44'))){_0x5d971c['limit']=qs[_0x307b('0x45')](_0x2643b6[_0x307b('0x3c')][_0x307b('0x45')]);_0x5d971c[_0x307b('0x2f')]=qs[_0x307b('0x2f')](_0x2643b6['query'][_0x307b('0x2f')]);}return _0x58cdd0[_0x307b('0x5a')](_0x5d971c);}})[_0x307b('0x1f')](function(_0x2f3b63){if(_0x2f3b63){return _0x2f3b63?{'count':_0x3120f2,'rows':_0x2f3b63}:null;}})['then'](respondWithResult(_0x53444a,null))[_0x307b('0x52')](handleError(_0x53444a,null));};exports[_0x307b('0x5b')]=function(_0x39faa9,_0x1a67bc,_0x12e400){var _0x4c5492={};var _0x4a9875={};var _0xa4eba8;var _0x346d21;return db[_0x307b('0x4d')][_0x307b('0x57')]({'where':{'id':_0x39faa9[_0x307b('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a67bc,null))[_0x307b('0x1f')](function(_0x5f3b3b){if(_0x5f3b3b){_0xa4eba8=_0x5f3b3b;_0x4a9875[_0x307b('0x3f')]=_['keys'](db[_0x307b('0x58')]['rawAttributes']);_0x4a9875[_0x307b('0x3c')]=_[_0x307b('0x3d')](_0x39faa9['query']);_0x4a9875[_0x307b('0x48')]=_[_0x307b('0x3e')](_0x4a9875[_0x307b('0x3f')],_0x4a9875[_0x307b('0x3c')]);_0x4c5492[_0x307b('0x40')]=_[_0x307b('0x3e')](_0x4a9875[_0x307b('0x3f')],qs[_0x307b('0x41')](_0x39faa9[_0x307b('0x3c')][_0x307b('0x41')]));_0x4c5492[_0x307b('0x40')]=_0x4c5492[_0x307b('0x40')][_0x307b('0x42')]?_0x4c5492[_0x307b('0x40')]:_0x4a9875[_0x307b('0x3f')];_0x4c5492[_0x307b('0x46')]=qs[_0x307b('0x47')](_0x39faa9[_0x307b('0x3c')][_0x307b('0x47')]);_0x4c5492['where']=qs[_0x307b('0x48')](_[_0x307b('0x49')](_0x39faa9[_0x307b('0x3c')],_0x4a9875['filters']));if(_0x39faa9['query'][_0x307b('0x59')]){_0x4c5492[_0x307b('0x4a')]=_[_0x307b('0x4b')](_0x4c5492[_0x307b('0x4a')],{'$or':_['map'](_0x4c5492[_0x307b('0x40')],function(_0xddd822){var _0x288dee={};_0x288dee[_0xddd822]={'$like':'%'+_0x39faa9[_0x307b('0x3c')][_0x307b('0x59')]+'%'};return _0x288dee;})});}_0x4c5492=_[_0x307b('0x4b')]({},_0x4c5492,_0x39faa9[_0x307b('0x4c')]);return _0xa4eba8[_0x307b('0x5b')](_0x4c5492);}})[_0x307b('0x1f')](function(_0x31b79e){if(_0x31b79e){_0x346d21=_0x31b79e[_0x307b('0x42')];if(!_0x39faa9[_0x307b('0x3c')][_0x307b('0x43')](_0x307b('0x44'))){_0x4c5492[_0x307b('0x45')]=qs[_0x307b('0x45')](_0x39faa9['query'][_0x307b('0x45')]);_0x4c5492[_0x307b('0x2f')]=qs[_0x307b('0x2f')](_0x39faa9[_0x307b('0x3c')][_0x307b('0x2f')]);}return _0xa4eba8[_0x307b('0x5b')](_0x4c5492);}})[_0x307b('0x1f')](function(_0x753386){if(_0x753386){return _0x753386?{'count':_0x346d21,'rows':_0x753386}:null;}})[_0x307b('0x1f')](respondWithResult(_0x1a67bc,null))['catch'](handleError(_0x1a67bc,null));};exports[_0x307b('0x5c')]=function(_0x22e559,_0x766a51,_0x2becd5){var _0x2b9f40={};var _0x279980={};var _0x4d3508;var _0x4d7a96;return db[_0x307b('0x4d')][_0x307b('0x57')]({'where':{'id':_0x22e559[_0x307b('0x55')]['id']}})['then'](handleEntityNotFound(_0x766a51,null))[_0x307b('0x1f')](function(_0x4bfb0c){if(_0x4bfb0c){_0x4d3508=_0x4bfb0c;_0x279980[_0x307b('0x3f')]=_[_0x307b('0x3d')](db[_0x307b('0x58')][_0x307b('0x38')]);_0x279980[_0x307b('0x3c')]=_[_0x307b('0x3d')](_0x22e559[_0x307b('0x3c')]);_0x279980[_0x307b('0x48')]=_[_0x307b('0x3e')](_0x279980[_0x307b('0x3f')],_0x279980[_0x307b('0x3c')]);_0x2b9f40[_0x307b('0x40')]=_['intersection'](_0x279980['model'],qs[_0x307b('0x41')](_0x22e559[_0x307b('0x3c')][_0x307b('0x41')]));_0x2b9f40[_0x307b('0x40')]=_0x2b9f40[_0x307b('0x40')]['length']?_0x2b9f40[_0x307b('0x40')]:_0x279980[_0x307b('0x3f')];_0x2b9f40[_0x307b('0x46')]=qs[_0x307b('0x47')](_0x22e559[_0x307b('0x3c')][_0x307b('0x47')]);_0x2b9f40[_0x307b('0x4a')]=qs[_0x307b('0x48')](_['pick'](_0x22e559[_0x307b('0x3c')],_0x279980[_0x307b('0x48')]));if(_0x22e559[_0x307b('0x3c')][_0x307b('0x59')]){_0x2b9f40['where']=_[_0x307b('0x4b')](_0x2b9f40[_0x307b('0x4a')],{'$or':_[_0x307b('0x3b')](_0x2b9f40[_0x307b('0x40')],function(_0x51183a){var _0x1142ad={};_0x1142ad[_0x51183a]={'$like':'%'+_0x22e559[_0x307b('0x3c')][_0x307b('0x59')]+'%'};return _0x1142ad;})});}_0x2b9f40=_[_0x307b('0x4b')]({},_0x2b9f40,_0x22e559[_0x307b('0x4c')]);return _0x4d3508[_0x307b('0x5c')](_0x2b9f40);}})['then'](function(_0x2f3eeb){if(_0x2f3eeb){_0x4d7a96=_0x2f3eeb[_0x307b('0x42')];if(!_0x22e559['query'][_0x307b('0x43')](_0x307b('0x44'))){_0x2b9f40[_0x307b('0x45')]=qs['limit'](_0x22e559[_0x307b('0x3c')]['limit']);_0x2b9f40['offset']=qs[_0x307b('0x2f')](_0x22e559[_0x307b('0x3c')][_0x307b('0x2f')]);}return _0x4d3508[_0x307b('0x5c')](_0x2b9f40);}})['then'](function(_0x55b2e7){if(_0x55b2e7){return _0x55b2e7?{'count':_0x4d7a96,'rows':_0x55b2e7}:null;}})['then'](respondWithResult(_0x766a51,null))[_0x307b('0x52')](handleError(_0x766a51,null));};exports['getTags']=function(_0x4d7298,_0x589fd2,_0x4861c7){var _0x299f50={};var _0x5d8020={};var _0xa273db;var _0x23261c;return db[_0x307b('0x4d')][_0x307b('0x57')]({'where':{'id':_0x4d7298[_0x307b('0x55')]['id']}})[_0x307b('0x1f')](handleEntityNotFound(_0x589fd2,null))[_0x307b('0x1f')](function(_0x3f9820){if(_0x3f9820){_0xa273db=_0x3f9820;_0x5d8020[_0x307b('0x3f')]=_[_0x307b('0x3d')](db[_0x307b('0x5d')][_0x307b('0x38')]);_0x5d8020[_0x307b('0x3c')]=_[_0x307b('0x3d')](_0x4d7298[_0x307b('0x3c')]);_0x5d8020['filters']=_[_0x307b('0x3e')](_0x5d8020[_0x307b('0x3f')],_0x5d8020[_0x307b('0x3c')]);_0x299f50['attributes']=_[_0x307b('0x3e')](_0x5d8020[_0x307b('0x3f')],qs['fields'](_0x4d7298[_0x307b('0x3c')]['fields']));_0x299f50[_0x307b('0x40')]=_0x299f50[_0x307b('0x40')][_0x307b('0x42')]?_0x299f50[_0x307b('0x40')]:_0x5d8020[_0x307b('0x3f')];_0x299f50['order']=qs['sort'](_0x4d7298[_0x307b('0x3c')][_0x307b('0x47')]);_0x299f50['where']=qs[_0x307b('0x48')](_['pick'](_0x4d7298[_0x307b('0x3c')],_0x5d8020[_0x307b('0x48')]));if(_0x4d7298[_0x307b('0x3c')][_0x307b('0x59')]){_0x299f50[_0x307b('0x4a')]=_['merge'](_0x299f50[_0x307b('0x4a')],{'$or':_[_0x307b('0x3b')](_0x299f50[_0x307b('0x40')],function(_0x484641){var _0x5856b0={};_0x5856b0[_0x484641]={'$like':'%'+_0x4d7298[_0x307b('0x3c')][_0x307b('0x59')]+'%'};return _0x5856b0;})});}_0x299f50=_[_0x307b('0x4b')]({},_0x299f50,_0x4d7298['options']);return _0xa273db[_0x307b('0x5e')](_0x299f50);}})[_0x307b('0x1f')](function(_0x4513bb){if(_0x4513bb){_0x23261c=_0x4513bb['length'];if(!_0x4d7298[_0x307b('0x3c')][_0x307b('0x43')](_0x307b('0x44'))){_0x299f50[_0x307b('0x45')]=qs[_0x307b('0x45')](_0x4d7298['query'][_0x307b('0x45')]);_0x299f50['offset']=qs[_0x307b('0x2f')](_0x4d7298['query'][_0x307b('0x2f')]);}return _0xa273db['getTags'](_0x299f50);}})[_0x307b('0x1f')](function(_0x3a8542){if(_0x3a8542){return _0x3a8542?{'count':_0x23261c,'rows':_0x3a8542}:null;}})[_0x307b('0x1f')](respondWithResult(_0x589fd2,null))[_0x307b('0x52')](handleError(_0x589fd2,null));};exports[_0x307b('0x5f')]=function(_0x338329,_0x214668,_0x42bdfa){if(_0x338329[_0x307b('0x54')]['id']){delete _0x338329[_0x307b('0x54')]['id'];}return db[_0x307b('0x4d')][_0x307b('0x57')]({'where':{'id':_0x338329[_0x307b('0x55')]['id']}})[_0x307b('0x1f')](handleEntityNotFound(_0x214668,null))['then'](function(_0x2a6784){if(_0x2a6784){return _0x2a6784[_0x307b('0x5f')](_0x338329[_0x307b('0x54')][_0x307b('0x60')]||[]);}return null;})[_0x307b('0x1f')](respondWithResult(_0x214668,null))[_0x307b('0x52')](handleError(_0x214668,null));}; \ No newline at end of file +var _0x0932=['find','create','body','params','getFields','order','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','ZendeskConfiguration','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','keys','rawAttributes'];(function(_0x517ad3,_0x3015d5){var _0x3c69d6=function(_0xef0f04){while(--_0xef0f04){_0x517ad3['push'](_0x517ad3['shift']());}};_0x3c69d6(++_0x3015d5);}(_0x0932,0xd8));var _0x2093=function(_0x366efe,_0x3da6b7){_0x366efe=_0x366efe-0x0;var _0x34ef8f=_0x0932[_0x366efe];return _0x34ef8f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2093('0x0'));var rimraf=require(_0x2093('0x1'));var zipdir=require(_0x2093('0x2'));var jsonpatch=require(_0x2093('0x3'));var rp=require('request-promise');var moment=require(_0x2093('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2093('0x5'));var util=require(_0x2093('0x6'));var path=require(_0x2093('0x7'));var sox=require(_0x2093('0x8'));var csv=require('to-csv');var ejs=require(_0x2093('0x9'));var fs=require('fs');var _=require(_0x2093('0xa'));var squel=require(_0x2093('0xb'));var crypto=require(_0x2093('0xc'));var jsforce=require(_0x2093('0xd'));var deskjs=require(_0x2093('0xe'));var toCsv=require(_0x2093('0xf'));var querystring=require(_0x2093('0x10'));var Papa=require(_0x2093('0x11'));var Redis=require(_0x2093('0x12'));var authService=require(_0x2093('0x13'));var qs=require(_0x2093('0x14'));var as=require(_0x2093('0x15'));var hardwareService=require(_0x2093('0x16'));var logger=require(_0x2093('0x17'))(_0x2093('0x18'));var utils=require('../../config/utils');var config=require(_0x2093('0x19'));var db=require(_0x2093('0x1a'))['db'];var jayson=require(_0x2093('0x1b'));var client=jayson[_0x2093('0x1c')][_0x2093('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x573dff,_0x2bf8ed,_0x46c551){if(_0x46c551){var _0x551650=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x551650[_0x2093('0x1e')](_0x2bf8ed)){return _0x573dff;}else{throw new db[(_0x2093('0x1f'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x573dff;}}function respondWithRpcPromise(_0x280dc1,_0x4b1060,_0x3f180c,_0x46d551){return new BPromise(function(_0x4e2428,_0x5df1a1){var _0xc128c6=_0x46d551||client;return _0xc128c6[_0x2093('0x20')](_0x280dc1,_0x3f180c)['then'](function(_0x22c290){logger[_0x2093('0x21')](_0x2093('0x22'),_0x4b1060,'request\x20sent');logger[_0x2093('0x23')](_0x2093('0x24'),_0x4b1060,_0x2093('0x25'),JSON[_0x2093('0x26')](_0x22c290));if(_0x22c290['error']){if(_0x22c290['error'][_0x2093('0x27')]===0x1f4){logger['error'](_0x2093('0x22'),_0x4b1060,_0x22c290['error'][_0x2093('0x28')]);return _0x5df1a1(_0x22c290[_0x2093('0x29')][_0x2093('0x28')]);}logger[_0x2093('0x29')](_0x2093('0x22'),_0x4b1060,_0x22c290[_0x2093('0x29')][_0x2093('0x28')]);return _0x4e2428(_0x22c290[_0x2093('0x29')][_0x2093('0x28')]);}else{logger[_0x2093('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4b1060,_0x2093('0x25'));_0x4e2428(_0x22c290[_0x2093('0x2a')][_0x2093('0x28')]);}})[_0x2093('0x2b')](function(_0x26c5e2){logger[_0x2093('0x29')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4b1060,_0x26c5e2);_0x5df1a1(_0x26c5e2);});});}function respondWithStatusCode(_0x1c08a1,_0x2a76ce){_0x2a76ce=_0x2a76ce||0xcc;return function(_0x20383d){if(_0x20383d){return _0x1c08a1['sendStatus'](_0x2a76ce);}return _0x1c08a1[_0x2093('0x2c')](_0x2a76ce)[_0x2093('0x2d')]();};}function respondWithResult(_0x3c6bb1,_0x507fec){_0x507fec=_0x507fec||0xc8;return function(_0x14bba3){if(_0x14bba3){return _0x3c6bb1['status'](_0x507fec)[_0x2093('0x2e')](_0x14bba3);}};}function respondWithFilteredResult(_0x3dd0b3,_0x5e7a16){return function(_0x1ce05){if(_0x1ce05){var _0x18ad84=_0x1ce05[_0x2093('0x2f')],_0xe2a8ae=_0x5e7a16[_0x2093('0x30')],_0x339b09=_0x5e7a16[_0x2093('0x30')]+_0x5e7a16[_0x2093('0x31')],_0x2e02e7;if(_0x339b09>=_0x18ad84){_0x339b09=_0x18ad84;_0x2e02e7=0xc8;}else{_0x2e02e7=0xce;}_0x3dd0b3[_0x2093('0x2c')](_0x2e02e7);return _0x3dd0b3[_0x2093('0x32')](_0x2093('0x33'),_0xe2a8ae+'-'+_0x339b09+'/'+_0x18ad84)['json'](_0x1ce05);}return null;};}function patchUpdates(_0x482c30){return function(_0x2dccaa){try{jsonpatch[_0x2093('0x34')](_0x2dccaa,_0x482c30,!![]);}catch(_0x298539){return BPromise['reject'](_0x298539);}return _0x2dccaa[_0x2093('0x35')]();};}function saveUpdates(_0x11dc8a,_0x1bd2a6){return function(_0x282eea){if(_0x282eea){return _0x282eea[_0x2093('0x36')](_0x11dc8a)[_0x2093('0x37')](function(_0x2ad8cc){return _0x2ad8cc;});}return null;};}function removeEntity(_0x4f2fa9,_0x9cb089){return function(_0x5d0eb3){if(_0x5d0eb3){return _0x5d0eb3[_0x2093('0x38')]()[_0x2093('0x37')](function(){_0x4f2fa9[_0x2093('0x2c')](0xcc)[_0x2093('0x2d')]();});}};}function handleEntityNotFound(_0x42b35b,_0x5944b0){return function(_0x31431a){if(!_0x31431a){_0x42b35b[_0x2093('0x39')](0x194);}return _0x31431a;};}function handleError(_0x455f02,_0x526214){_0x526214=_0x526214||0x1f4;return function(_0x43d061){logger[_0x2093('0x29')](_0x43d061[_0x2093('0x3a')]);if(_0x43d061[_0x2093('0x3b')]){delete _0x43d061['name'];}_0x455f02[_0x2093('0x2c')](_0x526214)['send'](_0x43d061);};}exports[_0x2093('0x3c')]=function(_0x3dfedf,_0x121fa6){var _0x20fd60={},_0x1133fc={},_0x457bad={'count':0x0,'rows':[]};var _0x667bc7=_[_0x2093('0x3d')](db[_0x2093('0x3e')]['rawAttributes'],function(_0x42bd70){return{'name':_0x42bd70[_0x2093('0x3f')],'type':_0x42bd70['type'][_0x2093('0x40')]};});_0x1133fc['model']=_['map'](_0x667bc7,_0x2093('0x3b'));_0x1133fc['query']=_['keys'](_0x3dfedf[_0x2093('0x41')]);_0x1133fc['filters']=_['intersection'](_0x1133fc[_0x2093('0x42')],_0x1133fc[_0x2093('0x41')]);_0x20fd60[_0x2093('0x43')]=_[_0x2093('0x44')](_0x1133fc[_0x2093('0x42')],qs[_0x2093('0x45')](_0x3dfedf[_0x2093('0x41')][_0x2093('0x45')]));_0x20fd60['attributes']=_0x20fd60['attributes'][_0x2093('0x46')]?_0x20fd60['attributes']:_0x1133fc[_0x2093('0x42')];if(!_0x3dfedf[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x20fd60[_0x2093('0x31')]=qs[_0x2093('0x31')](_0x3dfedf['query']['limit']);_0x20fd60['offset']=qs[_0x2093('0x30')](_0x3dfedf['query']['offset']);}_0x20fd60['order']=qs['sort'](_0x3dfedf[_0x2093('0x41')][_0x2093('0x49')]);_0x20fd60['where']=qs[_0x2093('0x4a')](_[_0x2093('0x4b')](_0x3dfedf[_0x2093('0x41')],_0x1133fc[_0x2093('0x4a')]),_0x667bc7);if(_0x3dfedf['query'][_0x2093('0x4c')]){_0x20fd60['where']=_[_0x2093('0x4d')](_0x20fd60[_0x2093('0x4e')],{'$or':_[_0x2093('0x3d')](_0x667bc7,function(_0x19a856){if(_0x19a856['type']!=='VIRTUAL'){var _0x2679f2={};_0x2679f2[_0x19a856['name']]={'$like':'%'+_0x3dfedf['query'][_0x2093('0x4c')]+'%'};return _0x2679f2;}})});}_0x20fd60=_['merge']({},_0x20fd60,_0x3dfedf[_0x2093('0x4f')]);var _0x20cc42={'where':_0x20fd60[_0x2093('0x4e')]};return db[_0x2093('0x3e')][_0x2093('0x2f')](_0x20cc42)[_0x2093('0x37')](function(_0x4960b8){_0x457bad[_0x2093('0x2f')]=_0x4960b8;if(_0x3dfedf[_0x2093('0x41')][_0x2093('0x50')]){_0x20fd60[_0x2093('0x51')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x2093('0x52')](_0x20fd60);})[_0x2093('0x37')](function(_0x2437eb){_0x457bad[_0x2093('0x53')]=_0x2437eb;return _0x457bad;})[_0x2093('0x37')](respondWithFilteredResult(_0x121fa6,_0x20fd60))[_0x2093('0x2b')](handleError(_0x121fa6,null));};exports[_0x2093('0x54')]=function(_0x40a33c,_0xc35337){var _0x483a47={'raw':![],'where':{'id':_0x40a33c['params']['id']}},_0x31b706={};_0x31b706[_0x2093('0x42')]=_[_0x2093('0x55')](db[_0x2093('0x3e')][_0x2093('0x56')]);_0x31b706[_0x2093('0x41')]=_['keys'](_0x40a33c[_0x2093('0x41')]);_0x31b706[_0x2093('0x4a')]=_['intersection'](_0x31b706['model'],_0x31b706[_0x2093('0x41')]);_0x483a47[_0x2093('0x43')]=_[_0x2093('0x44')](_0x31b706[_0x2093('0x42')],qs[_0x2093('0x45')](_0x40a33c[_0x2093('0x41')][_0x2093('0x45')]));_0x483a47[_0x2093('0x43')]=_0x483a47['attributes']['length']?_0x483a47[_0x2093('0x43')]:_0x31b706[_0x2093('0x42')];if(_0x40a33c[_0x2093('0x41')]['includeAll']){_0x483a47[_0x2093('0x51')]=[{'all':!![]}];}_0x483a47=_[_0x2093('0x4d')]({},_0x483a47,_0x40a33c[_0x2093('0x4f')]);return db['ZendeskConfiguration'][_0x2093('0x57')](_0x483a47)['then'](handleEntityNotFound(_0xc35337,null))[_0x2093('0x37')](respondWithResult(_0xc35337,null))[_0x2093('0x2b')](handleError(_0xc35337,null));};exports[_0x2093('0x58')]=function(_0x45d9eb,_0x7aa42d){return db['ZendeskConfiguration'][_0x2093('0x58')](_0x45d9eb[_0x2093('0x59')],{})['then'](respondWithResult(_0x7aa42d,0xc9))[_0x2093('0x2b')](handleError(_0x7aa42d,null));};exports['update']=function(_0x57993d,_0x2cfd9d){if(_0x57993d['body']['id']){delete _0x57993d['body']['id'];}return db[_0x2093('0x3e')]['find']({'where':{'id':_0x57993d[_0x2093('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2cfd9d,null))[_0x2093('0x37')](saveUpdates(_0x57993d['body'],null))[_0x2093('0x37')](respondWithResult(_0x2cfd9d,null))[_0x2093('0x2b')](handleError(_0x2cfd9d,null));};exports[_0x2093('0x38')]=function(_0x556658,_0x4e03aa){return db['ZendeskConfiguration']['find']({'where':{'id':_0x556658['params']['id']}})['then'](handleEntityNotFound(_0x4e03aa,null))[_0x2093('0x37')](removeEntity(_0x4e03aa,null))[_0x2093('0x2b')](handleError(_0x4e03aa,null));};exports[_0x2093('0x5b')]=function(_0x701292,_0xe9b5f5,_0x1c045c){var _0x4397c2={};var _0x42e04e={};var _0x252334;var _0x3fa94d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x701292[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0xe9b5f5,null))[_0x2093('0x37')](function(_0x6d719a){if(_0x6d719a){_0x252334=_0x6d719a;_0x42e04e[_0x2093('0x42')]=_['keys'](db['ZendeskField'][_0x2093('0x56')]);_0x42e04e[_0x2093('0x41')]=_['keys'](_0x701292[_0x2093('0x41')]);_0x42e04e[_0x2093('0x4a')]=_[_0x2093('0x44')](_0x42e04e[_0x2093('0x42')],_0x42e04e['query']);_0x4397c2[_0x2093('0x43')]=_['intersection'](_0x42e04e[_0x2093('0x42')],qs[_0x2093('0x45')](_0x701292[_0x2093('0x41')]['fields']));_0x4397c2[_0x2093('0x43')]=_0x4397c2[_0x2093('0x43')][_0x2093('0x46')]?_0x4397c2['attributes']:_0x42e04e[_0x2093('0x42')];_0x4397c2[_0x2093('0x5c')]=qs['sort'](_0x701292['query'][_0x2093('0x49')]);_0x4397c2['where']=qs[_0x2093('0x4a')](_['pick'](_0x701292[_0x2093('0x41')],_0x42e04e['filters']));if(_0x701292['query'][_0x2093('0x4c')]){_0x4397c2[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x4397c2[_0x2093('0x4e')],{'$or':_[_0x2093('0x3d')](_0x4397c2['attributes'],function(_0x54bdd4){var _0x13e761={};_0x13e761[_0x54bdd4]={'$like':'%'+_0x701292[_0x2093('0x41')][_0x2093('0x4c')]+'%'};return _0x13e761;})});}_0x4397c2=_[_0x2093('0x4d')]({},_0x4397c2,_0x701292[_0x2093('0x4f')]);return _0x252334[_0x2093('0x5b')](_0x4397c2);}})['then'](function(_0x19e713){if(_0x19e713){_0x3fa94d=_0x19e713[_0x2093('0x46')];if(!_0x701292[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x4397c2[_0x2093('0x31')]=qs['limit'](_0x701292[_0x2093('0x41')]['limit']);_0x4397c2['offset']=qs[_0x2093('0x30')](_0x701292[_0x2093('0x41')][_0x2093('0x30')]);}return _0x252334[_0x2093('0x5b')](_0x4397c2);}})[_0x2093('0x37')](function(_0xb4b4dd){if(_0xb4b4dd){return _0xb4b4dd?{'count':_0x3fa94d,'rows':_0xb4b4dd}:null;}})[_0x2093('0x37')](respondWithResult(_0xe9b5f5,null))[_0x2093('0x2b')](handleError(_0xe9b5f5,null));};exports[_0x2093('0x5d')]=function(_0x292b72,_0x42bce7,_0x5298f3){var _0x135e67={};var _0x44c216={};var _0x425221;var _0x4fb4df;return db[_0x2093('0x3e')][_0x2093('0x5e')]({'where':{'id':_0x292b72[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0x42bce7,null))[_0x2093('0x37')](function(_0x1b5f35){if(_0x1b5f35){_0x425221=_0x1b5f35;_0x44c216[_0x2093('0x42')]=_[_0x2093('0x55')](db[_0x2093('0x5f')][_0x2093('0x56')]);_0x44c216['query']=_[_0x2093('0x55')](_0x292b72[_0x2093('0x41')]);_0x44c216['filters']=_[_0x2093('0x44')](_0x44c216[_0x2093('0x42')],_0x44c216['query']);_0x135e67['attributes']=_[_0x2093('0x44')](_0x44c216['model'],qs[_0x2093('0x45')](_0x292b72[_0x2093('0x41')][_0x2093('0x45')]));_0x135e67[_0x2093('0x43')]=_0x135e67[_0x2093('0x43')][_0x2093('0x46')]?_0x135e67['attributes']:_0x44c216[_0x2093('0x42')];_0x135e67[_0x2093('0x5c')]=qs[_0x2093('0x49')](_0x292b72[_0x2093('0x41')][_0x2093('0x49')]);_0x135e67[_0x2093('0x4e')]=qs[_0x2093('0x4a')](_[_0x2093('0x4b')](_0x292b72[_0x2093('0x41')],_0x44c216[_0x2093('0x4a')]));if(_0x292b72['query'][_0x2093('0x4c')]){_0x135e67[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x135e67[_0x2093('0x4e')],{'$or':_[_0x2093('0x3d')](_0x135e67[_0x2093('0x43')],function(_0x28afcf){var _0x35ff6f={};_0x35ff6f[_0x28afcf]={'$like':'%'+_0x292b72[_0x2093('0x41')][_0x2093('0x4c')]+'%'};return _0x35ff6f;})});}_0x135e67=_[_0x2093('0x4d')]({},_0x135e67,_0x292b72[_0x2093('0x4f')]);return _0x425221[_0x2093('0x5d')](_0x135e67);}})['then'](function(_0x6fe885){if(_0x6fe885){_0x4fb4df=_0x6fe885[_0x2093('0x46')];if(!_0x292b72[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x135e67[_0x2093('0x31')]=qs[_0x2093('0x31')](_0x292b72['query'][_0x2093('0x31')]);_0x135e67[_0x2093('0x30')]=qs[_0x2093('0x30')](_0x292b72[_0x2093('0x41')][_0x2093('0x30')]);}return _0x425221[_0x2093('0x5d')](_0x135e67);}})['then'](function(_0x35d424){if(_0x35d424){return _0x35d424?{'count':_0x4fb4df,'rows':_0x35d424}:null;}})[_0x2093('0x37')](respondWithResult(_0x42bce7,null))[_0x2093('0x2b')](handleError(_0x42bce7,null));};exports[_0x2093('0x60')]=function(_0xf7b13d,_0x36ca67,_0x1d7889){var _0x72eab7={};var _0x47103e={};var _0x16388a;var _0x56d851;return db[_0x2093('0x3e')][_0x2093('0x5e')]({'where':{'id':_0xf7b13d[_0x2093('0x5a')]['id']}})['then'](handleEntityNotFound(_0x36ca67,null))[_0x2093('0x37')](function(_0x4038f7){if(_0x4038f7){_0x16388a=_0x4038f7;_0x47103e[_0x2093('0x42')]=_[_0x2093('0x55')](db[_0x2093('0x5f')][_0x2093('0x56')]);_0x47103e['query']=_[_0x2093('0x55')](_0xf7b13d['query']);_0x47103e[_0x2093('0x4a')]=_['intersection'](_0x47103e[_0x2093('0x42')],_0x47103e[_0x2093('0x41')]);_0x72eab7[_0x2093('0x43')]=_[_0x2093('0x44')](_0x47103e['model'],qs['fields'](_0xf7b13d[_0x2093('0x41')][_0x2093('0x45')]));_0x72eab7[_0x2093('0x43')]=_0x72eab7[_0x2093('0x43')][_0x2093('0x46')]?_0x72eab7[_0x2093('0x43')]:_0x47103e['model'];_0x72eab7[_0x2093('0x5c')]=qs[_0x2093('0x49')](_0xf7b13d[_0x2093('0x41')]['sort']);_0x72eab7[_0x2093('0x4e')]=qs['filters'](_['pick'](_0xf7b13d[_0x2093('0x41')],_0x47103e[_0x2093('0x4a')]));if(_0xf7b13d[_0x2093('0x41')]['filter']){_0x72eab7[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x72eab7[_0x2093('0x4e')],{'$or':_['map'](_0x72eab7['attributes'],function(_0x6f5fe8){var _0x13441e={};_0x13441e[_0x6f5fe8]={'$like':'%'+_0xf7b13d['query'][_0x2093('0x4c')]+'%'};return _0x13441e;})});}_0x72eab7=_[_0x2093('0x4d')]({},_0x72eab7,_0xf7b13d['options']);return _0x16388a[_0x2093('0x60')](_0x72eab7);}})[_0x2093('0x37')](function(_0x5056b9){if(_0x5056b9){_0x56d851=_0x5056b9[_0x2093('0x46')];if(!_0xf7b13d[_0x2093('0x41')][_0x2093('0x47')](_0x2093('0x48'))){_0x72eab7['limit']=qs[_0x2093('0x31')](_0xf7b13d[_0x2093('0x41')]['limit']);_0x72eab7[_0x2093('0x30')]=qs['offset'](_0xf7b13d['query'][_0x2093('0x30')]);}return _0x16388a[_0x2093('0x60')](_0x72eab7);}})[_0x2093('0x37')](function(_0x405a2f){if(_0x405a2f){return _0x405a2f?{'count':_0x56d851,'rows':_0x405a2f}:null;}})[_0x2093('0x37')](respondWithResult(_0x36ca67,null))[_0x2093('0x2b')](handleError(_0x36ca67,null));};exports[_0x2093('0x61')]=function(_0x2c857a,_0x4f3328,_0x5c8254){var _0x220ad4={};var _0x3fb74c={};var _0x2391c2;var _0xda1d7e;return db['ZendeskConfiguration'][_0x2093('0x5e')]({'where':{'id':_0x2c857a[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0x4f3328,null))[_0x2093('0x37')](function(_0x1ada84){if(_0x1ada84){_0x2391c2=_0x1ada84;_0x3fb74c['model']=_[_0x2093('0x55')](db[_0x2093('0x62')][_0x2093('0x56')]);_0x3fb74c['query']=_['keys'](_0x2c857a[_0x2093('0x41')]);_0x3fb74c[_0x2093('0x4a')]=_['intersection'](_0x3fb74c['model'],_0x3fb74c['query']);_0x220ad4[_0x2093('0x43')]=_[_0x2093('0x44')](_0x3fb74c[_0x2093('0x42')],qs['fields'](_0x2c857a[_0x2093('0x41')][_0x2093('0x45')]));_0x220ad4['attributes']=_0x220ad4[_0x2093('0x43')][_0x2093('0x46')]?_0x220ad4[_0x2093('0x43')]:_0x3fb74c[_0x2093('0x42')];_0x220ad4[_0x2093('0x5c')]=qs[_0x2093('0x49')](_0x2c857a['query'][_0x2093('0x49')]);_0x220ad4['where']=qs[_0x2093('0x4a')](_[_0x2093('0x4b')](_0x2c857a[_0x2093('0x41')],_0x3fb74c['filters']));if(_0x2c857a[_0x2093('0x41')][_0x2093('0x4c')]){_0x220ad4[_0x2093('0x4e')]=_[_0x2093('0x4d')](_0x220ad4[_0x2093('0x4e')],{'$or':_['map'](_0x220ad4['attributes'],function(_0x4407b5){var _0x2a96f0={};_0x2a96f0[_0x4407b5]={'$like':'%'+_0x2c857a[_0x2093('0x41')]['filter']+'%'};return _0x2a96f0;})});}_0x220ad4=_[_0x2093('0x4d')]({},_0x220ad4,_0x2c857a[_0x2093('0x4f')]);return _0x2391c2[_0x2093('0x61')](_0x220ad4);}})[_0x2093('0x37')](function(_0x2a959b){if(_0x2a959b){_0xda1d7e=_0x2a959b[_0x2093('0x46')];if(!_0x2c857a[_0x2093('0x41')][_0x2093('0x47')]('nolimit')){_0x220ad4[_0x2093('0x31')]=qs[_0x2093('0x31')](_0x2c857a[_0x2093('0x41')][_0x2093('0x31')]);_0x220ad4[_0x2093('0x30')]=qs[_0x2093('0x30')](_0x2c857a[_0x2093('0x41')]['offset']);}return _0x2391c2['getTags'](_0x220ad4);}})[_0x2093('0x37')](function(_0x1c9784){if(_0x1c9784){return _0x1c9784?{'count':_0xda1d7e,'rows':_0x1c9784}:null;}})[_0x2093('0x37')](respondWithResult(_0x4f3328,null))['catch'](handleError(_0x4f3328,null));};exports[_0x2093('0x63')]=function(_0x248475,_0x48d6d0,_0x173bef){if(_0x248475[_0x2093('0x59')]['id']){delete _0x248475[_0x2093('0x59')]['id'];}return db[_0x2093('0x3e')][_0x2093('0x5e')]({'where':{'id':_0x248475[_0x2093('0x5a')]['id']}})[_0x2093('0x37')](handleEntityNotFound(_0x48d6d0,null))[_0x2093('0x37')](function(_0x4b4249){if(_0x4b4249){return _0x4b4249['setTags'](_0x248475[_0x2093('0x59')][_0x2093('0x64')]||[]);}return null;})[_0x2093('0x37')](respondWithResult(_0x48d6d0,null))[_0x2093('0x2b')](handleError(_0x48d6d0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index eb80c3c..b69b733 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 _0x197f=['bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3aac5e,_0x383855){var _0x1909fd=function(_0x3110ac){while(--_0x3110ac){_0x3aac5e['push'](_0x3aac5e['shift']());}};_0x1909fd(++_0x383855);}(_0x197f,0x133));var _0xf197=function(_0x3400ad,_0x277a68){_0x3400ad=_0x3400ad-0x0;var _0x42c53f=_0x197f[_0x3400ad];return _0x42c53f;};'use strict';var _=require(_0xf197('0x0'));var util=require(_0xf197('0x1'));var logger=require(_0xf197('0x2'))(_0xf197('0x3'));var moment=require(_0xf197('0x4'));var BPromise=require(_0xf197('0x5'));var rp=require(_0xf197('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf197('0x7'));var attributes=require(_0xf197('0x8'));module[_0xf197('0x9')]=function(_0x5a7b94,_0x302707){return _0x5a7b94[_0xf197('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0xf197('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x131c=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x4a208c,_0x17cefa){var _0x174e2f=function(_0x48c977){while(--_0x48c977){_0x4a208c['push'](_0x4a208c['shift']());}};_0x174e2f(++_0x17cefa);}(_0x131c,0x1e4));var _0xc131=function(_0x42dc37,_0x1b1c03){_0x42dc37=_0x42dc37-0x0;var _0x58d6d0=_0x131c[_0x42dc37];return _0x58d6d0;};'use strict';var _=require(_0xc131('0x0'));var util=require(_0xc131('0x1'));var logger=require(_0xc131('0x2'))(_0xc131('0x3'));var moment=require(_0xc131('0x4'));var BPromise=require(_0xc131('0x5'));var rp=require(_0xc131('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc131('0x7'));var config=require(_0xc131('0x8'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc131('0x9')]=function(_0x56b60e,_0x2f8796){return _0x56b60e[_0xc131('0xa')](_0xc131('0xb'),attributes,{'tableName':_0xc131('0xc'),'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 b912921..67853d7 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 _0x9a2e=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x5cd0e5,_0x35c3a3){var _0x4b6e6c=function(_0x4757af){while(--_0x4757af){_0x5cd0e5['push'](_0x5cd0e5['shift']());}};_0x4b6e6c(++_0x35c3a3);}(_0x9a2e,0x124));var _0xe9a2=function(_0x5da77e,_0x16e5c2){_0x5da77e=_0x5da77e-0x0;var _0x26e2bc=_0x9a2e[_0x5da77e];return _0x26e2bc;};'use strict';var _=require('lodash');var util=require(_0xe9a2('0x0'));var moment=require(_0xe9a2('0x1'));var BPromise=require(_0xe9a2('0x2'));var rs=require(_0xe9a2('0x3'));var fs=require('fs');var Redis=require(_0xe9a2('0x4'));var db=require(_0xe9a2('0x5'))['db'];var utils=require(_0xe9a2('0x6'));var logger=require(_0xe9a2('0x7'))('rpc');var config=require(_0xe9a2('0x8'));var jayson=require(_0xe9a2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3369f8,_0x11e9ea,_0x18fd54){return new BPromise(function(_0x8aeba9,_0xe9b0f4){return client[_0xe9a2('0xa')](_0x3369f8,_0x18fd54)[_0xe9a2('0xb')](function(_0x448cba){logger[_0xe9a2('0xc')](_0xe9a2('0xd'),_0x11e9ea,_0xe9a2('0xe'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x11e9ea,_0xe9a2('0xe'),JSON[_0xe9a2('0xf')](_0x448cba));if(_0x448cba['error']){if(_0x448cba[_0xe9a2('0x10')][_0xe9a2('0x11')]===0x1f4){logger['error'](_0xe9a2('0xd'),_0x11e9ea,_0x448cba['error'][_0xe9a2('0x12')]);return _0xe9b0f4(_0x448cba[_0xe9a2('0x10')]['message']);}logger[_0xe9a2('0x10')](_0xe9a2('0xd'),_0x11e9ea,_0x448cba[_0xe9a2('0x10')][_0xe9a2('0x12')]);return _0x8aeba9(_0x448cba[_0xe9a2('0x10')][_0xe9a2('0x12')]);}else{logger[_0xe9a2('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x11e9ea,_0xe9a2('0xe'));_0x8aeba9(_0x448cba['result'][_0xe9a2('0x12')]);}})['catch'](function(_0x1f4f09){logger[_0xe9a2('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x11e9ea,_0x1f4f09);_0xe9b0f4(_0x1f4f09);});});} \ No newline at end of file +var _0x5c1f=['result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x5c1f,0x1dc));var _0xf5c1=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x5c1f[_0x328534];return _0x2796c0;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require(_0xf5c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf5c1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5c1('0x5'));var jayson=require(_0xf5c1('0x6'));var client=jayson[_0xf5c1('0x7')][_0xf5c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32d085,_0x4a2b18,_0xf08b1e){return new BPromise(function(_0x4d9c2e,_0x1ed626){return client[_0xf5c1('0x9')](_0x32d085,_0xf08b1e)[_0xf5c1('0xa')](function(_0x429b93){logger[_0xf5c1('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4a2b18,'request\x20sent');logger[_0xf5c1('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4a2b18,'request\x20sent',JSON['stringify'](_0x429b93));if(_0x429b93[_0xf5c1('0xd')]){if(_0x429b93[_0xf5c1('0xd')][_0xf5c1('0xe')]===0x1f4){logger[_0xf5c1('0xd')](_0xf5c1('0xf'),_0x4a2b18,_0x429b93[_0xf5c1('0xd')]['message']);return _0x1ed626(_0x429b93[_0xf5c1('0xd')]['message']);}logger['error'](_0xf5c1('0xf'),_0x4a2b18,_0x429b93[_0xf5c1('0xd')]['message']);return _0x4d9c2e(_0x429b93['error'][_0xf5c1('0x10')]);}else{logger[_0xf5c1('0xb')](_0xf5c1('0xf'),_0x4a2b18,_0xf5c1('0x11'));_0x4d9c2e(_0x429b93[_0xf5c1('0x12')][_0xf5c1('0x10')]);}})['catch'](function(_0x305379){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4a2b18,_0x305379);_0x1ed626(_0x305379);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 84d8e4e..28cfd21 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 _0xcafb=['post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show'];(function(_0x3560a6,_0x59c2f6){var _0x18e7e9=function(_0x43e9d0){while(--_0x43e9d0){_0x3560a6['push'](_0x3560a6['shift']());}};_0x18e7e9(++_0x59c2f6);}(_0xcafb,0x16c));var _0xbcaf=function(_0x46a4b3,_0x42c7fe){_0x46a4b3=_0x46a4b3-0x0;var _0x41640b=_0xcafb[_0x46a4b3];return _0x41640b;};'use strict';var multer=require(_0xbcaf('0x0'));var util=require(_0xbcaf('0x1'));var path=require(_0xbcaf('0x2'));var timeout=require(_0xbcaf('0x3'));var express=require(_0xbcaf('0x4'));var router=express[_0xbcaf('0x5')]();var auth=require(_0xbcaf('0x6'));var interaction=require(_0xbcaf('0x7'));var config=require(_0xbcaf('0x8'));var controller=require(_0xbcaf('0x9'));router[_0xbcaf('0xa')]('/',auth[_0xbcaf('0xb')](),controller[_0xbcaf('0xc')]);router['get']('/:id',auth[_0xbcaf('0xb')](),controller[_0xbcaf('0xd')]);router[_0xbcaf('0xe')]('/',auth[_0xbcaf('0xb')](),controller[_0xbcaf('0xf')]);router[_0xbcaf('0x10')](_0xbcaf('0x11'),auth[_0xbcaf('0xb')](),controller[_0xbcaf('0x12')]);router[_0xbcaf('0x13')](_0xbcaf('0x11'),auth[_0xbcaf('0xb')](),controller[_0xbcaf('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4858=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x54277f,_0x3aa1d6){var _0x133974=function(_0x293280){while(--_0x293280){_0x54277f['push'](_0x54277f['shift']());}};_0x133974(++_0x3aa1d6);}(_0x4858,0x12c));var _0x8485=function(_0x510fdc,_0x1b0c0a){_0x510fdc=_0x510fdc-0x0;var _0x5e1d8e=_0x4858[_0x510fdc];return _0x5e1d8e;};'use strict';var multer=require(_0x8485('0x0'));var util=require(_0x8485('0x1'));var path=require(_0x8485('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8485('0x3')]();var auth=require(_0x8485('0x4'));var interaction=require(_0x8485('0x5'));var config=require(_0x8485('0x6'));var controller=require(_0x8485('0x7'));router[_0x8485('0x8')]('/',auth[_0x8485('0x9')](),controller[_0x8485('0xa')]);router['get'](_0x8485('0xb'),auth['isAuthenticated'](),controller[_0x8485('0xc')]);router[_0x8485('0xd')]('/',auth[_0x8485('0x9')](),controller[_0x8485('0xe')]);router[_0x8485('0xf')]('/:id',auth[_0x8485('0x9')](),controller[_0x8485('0x10')]);router[_0x8485('0x11')]('/:id',auth[_0x8485('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0489abb..c13f714 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 _0xabcb=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x31b63b,_0x1ade41){var _0x3b2e1b=function(_0x275315){while(--_0x275315){_0x31b63b['push'](_0x31b63b['shift']());}};_0x3b2e1b(++_0x1ade41);}(_0xabcb,0xf9));var _0xbabc=function(_0x302a44,_0x259415){_0x302a44=_0x302a44-0x0;var _0x5576da=_0xabcb[_0x302a44];return _0x5576da;};'use strict';var Sequelize=require('sequelize');module[_0xbabc('0x0')]={'type':{'type':Sequelize[_0xbabc('0x1')](_0xbabc('0x2'),_0xbabc('0x3'),_0xbabc('0x4'),_0xbabc('0x5')),'defaultValue':_0xbabc('0x2')},'content':{'type':Sequelize[_0xbabc('0x6')]},'key':{'type':Sequelize[_0xbabc('0x6')]},'keyType':{'type':Sequelize[_0xbabc('0x1')](_0xbabc('0x2'),_0xbabc('0x3'),_0xbabc('0x4'))},'keyContent':{'type':Sequelize[_0xbabc('0x6')]},'idField':{'type':Sequelize[_0xbabc('0x6')]},'nameField':{'type':Sequelize[_0xbabc('0x6')]},'customField':{'type':Sequelize[_0xbabc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbabc('0x6')]}}; \ No newline at end of file +var _0xaa7c=['ENUM','string','variable','BOOLEAN','sequelize','customVariable','keyValue','STRING'];(function(_0x3e3cac,_0x2c495d){var _0x4a0c5f=function(_0x2cbeac){while(--_0x2cbeac){_0x3e3cac['push'](_0x3e3cac['shift']());}};_0x4a0c5f(++_0x2c495d);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x20a100,_0x1d5859){_0x20a100=_0x20a100-0x0;var _0x573861=_0xaa7c[_0x20a100];return _0x573861;};'use strict';var Sequelize=require(_0xcaa7('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0xcaa7('0x1'),_0xcaa7('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcaa7('0x3')]},'key':{'type':Sequelize[_0xcaa7('0x3')]},'keyType':{'type':Sequelize[_0xcaa7('0x4')](_0xcaa7('0x5'),_0xcaa7('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xcaa7('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcaa7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcaa7('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 29e01ad..a7add13 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 _0x2d8c=['offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','end','error','name','index','map','ZendeskField','rawAttributes','fieldName','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','include','findAll','rows','catch','show','params','fields','includeAll','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count'];(function(_0x1ad144,_0x56a7f5){var _0x292504=function(_0x212413){while(--_0x212413){_0x1ad144['push'](_0x1ad144['shift']());}};_0x292504(++_0x56a7f5);}(_0x2d8c,0x1f0));var _0xc2d8=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x2d8c[_0x218972];return _0x1bb1a8;};'use strict';var pdf=require(_0xc2d8('0x0'));var emlformat=require(_0xc2d8('0x1'));var rimraf=require(_0xc2d8('0x2'));var zipdir=require(_0xc2d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2d8('0x4'));var moment=require(_0xc2d8('0x5'));var BPromise=require(_0xc2d8('0x6'));var Mustache=require('mustache');var util=require(_0xc2d8('0x7'));var path=require(_0xc2d8('0x8'));var sox=require(_0xc2d8('0x9'));var csv=require(_0xc2d8('0xa'));var ejs=require(_0xc2d8('0xb'));var fs=require('fs');var _=require(_0xc2d8('0xc'));var squel=require('squel');var crypto=require(_0xc2d8('0xd'));var jsforce=require(_0xc2d8('0xe'));var deskjs=require(_0xc2d8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc2d8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc2d8('0x11'));var qs=require(_0xc2d8('0x12'));var as=require(_0xc2d8('0x13'));var hardwareService=require(_0xc2d8('0x14'));var logger=require(_0xc2d8('0x15'))(_0xc2d8('0x16'));var utils=require(_0xc2d8('0x17'));var config=require(_0xc2d8('0x18'));var db=require(_0xc2d8('0x19'))['db'];function respondWithStatusCode(_0x3dba07,_0x146d41){_0x146d41=_0x146d41||0xcc;return function(_0x2fe35a){if(_0x2fe35a){return _0x3dba07[_0xc2d8('0x1a')](_0x146d41);}return _0x3dba07[_0xc2d8('0x1b')](_0x146d41)['end']();};}function respondWithResult(_0x4f022f,_0x4fba92){_0x4fba92=_0x4fba92||0xc8;return function(_0x58b009){if(_0x58b009){return _0x4f022f[_0xc2d8('0x1b')](_0x4fba92)['json'](_0x58b009);}};}function respondWithFilteredResult(_0x48fc68,_0x4a0320){return function(_0x5b4ea3){if(_0x5b4ea3){var _0x31c2a2=_0x5b4ea3[_0xc2d8('0x1c')],_0x274848=_0x4a0320[_0xc2d8('0x1d')],_0x401a7d=_0x4a0320[_0xc2d8('0x1d')]+_0x4a0320[_0xc2d8('0x1e')],_0x19d9ae;if(_0x401a7d>=_0x31c2a2){_0x401a7d=_0x31c2a2;_0x19d9ae=0xc8;}else{_0x19d9ae=0xce;}_0x48fc68[_0xc2d8('0x1b')](_0x19d9ae);return _0x48fc68[_0xc2d8('0x1f')](_0xc2d8('0x20'),_0x274848+'-'+_0x401a7d+'/'+_0x31c2a2)[_0xc2d8('0x21')](_0x5b4ea3);}return null;};}function patchUpdates(_0x4d745a){return function(_0x5a099f){try{jsonpatch[_0xc2d8('0x22')](_0x5a099f,_0x4d745a,!![]);}catch(_0x1bd5ec){return BPromise[_0xc2d8('0x23')](_0x1bd5ec);}return _0x5a099f['save']();};}function saveUpdates(_0x375846,_0x14c111){return function(_0x380fdf){if(_0x380fdf){return _0x380fdf[_0xc2d8('0x24')](_0x375846)['then'](function(_0x50fe18){return _0x50fe18;});}return null;};}function removeEntity(_0x1a81d0,_0x245de3){return function(_0x2a7ee1){if(_0x2a7ee1){return _0x2a7ee1[_0xc2d8('0x25')]()[_0xc2d8('0x26')](function(){_0x1a81d0[_0xc2d8('0x1b')](0xcc)[_0xc2d8('0x27')]();});}};}function handleEntityNotFound(_0x1d70f6,_0x395f9c){return function(_0x2ffe2c){if(!_0x2ffe2c){_0x1d70f6[_0xc2d8('0x1a')](0x194);}return _0x2ffe2c;};}function handleError(_0x144e0a,_0x22f1dd){_0x22f1dd=_0x22f1dd||0x1f4;return function(_0x51aa20){logger[_0xc2d8('0x28')](_0x51aa20['stack']);if(_0x51aa20['name']){delete _0x51aa20[_0xc2d8('0x29')];}_0x144e0a['status'](_0x22f1dd)['send'](_0x51aa20);};}exports[_0xc2d8('0x2a')]=function(_0x45df37,_0x1cf1ed){var _0x257883={},_0x121289={},_0x3ce418={'count':0x0,'rows':[]};var _0x103e76=_[_0xc2d8('0x2b')](db[_0xc2d8('0x2c')][_0xc2d8('0x2d')],function(_0x241e9a){return{'name':_0x241e9a[_0xc2d8('0x2e')],'type':_0x241e9a['type']['key']};});_0x121289[_0xc2d8('0x2f')]=_[_0xc2d8('0x2b')](_0x103e76,_0xc2d8('0x29'));_0x121289[_0xc2d8('0x30')]=_[_0xc2d8('0x31')](_0x45df37[_0xc2d8('0x30')]);_0x121289['filters']=_[_0xc2d8('0x32')](_0x121289[_0xc2d8('0x2f')],_0x121289[_0xc2d8('0x30')]);_0x257883[_0xc2d8('0x33')]=_['intersection'](_0x121289['model'],qs['fields'](_0x45df37[_0xc2d8('0x30')]['fields']));_0x257883['attributes']=_0x257883[_0xc2d8('0x33')][_0xc2d8('0x34')]?_0x257883['attributes']:_0x121289['model'];if(!_0x45df37['query'][_0xc2d8('0x35')](_0xc2d8('0x36'))){_0x257883[_0xc2d8('0x1e')]=qs[_0xc2d8('0x1e')](_0x45df37[_0xc2d8('0x30')][_0xc2d8('0x1e')]);_0x257883[_0xc2d8('0x1d')]=qs[_0xc2d8('0x1d')](_0x45df37[_0xc2d8('0x30')]['offset']);}_0x257883[_0xc2d8('0x37')]=qs[_0xc2d8('0x38')](_0x45df37[_0xc2d8('0x30')]['sort']);_0x257883[_0xc2d8('0x39')]=qs[_0xc2d8('0x3a')](_[_0xc2d8('0x3b')](_0x45df37[_0xc2d8('0x30')],_0x121289['filters']),_0x103e76);if(_0x45df37[_0xc2d8('0x30')][_0xc2d8('0x3c')]){_0x257883[_0xc2d8('0x39')]=_[_0xc2d8('0x3d')](_0x257883[_0xc2d8('0x39')],{'$or':_[_0xc2d8('0x2b')](_0x103e76,function(_0x235e06){if(_0x235e06[_0xc2d8('0x3e')]!=='VIRTUAL'){var _0x3e1ce2={};_0x3e1ce2[_0x235e06['name']]={'$like':'%'+_0x45df37[_0xc2d8('0x30')][_0xc2d8('0x3c')]+'%'};return _0x3e1ce2;}})});}_0x257883=_[_0xc2d8('0x3d')]({},_0x257883,_0x45df37['options']);var _0x3113f8={'where':_0x257883[_0xc2d8('0x39')]};return db[_0xc2d8('0x2c')]['count'](_0x3113f8)[_0xc2d8('0x26')](function(_0x1d7d24){_0x3ce418['count']=_0x1d7d24;if(_0x45df37[_0xc2d8('0x30')]['includeAll']){_0x257883[_0xc2d8('0x3f')]=[{'all':!![]}];}return db[_0xc2d8('0x2c')][_0xc2d8('0x40')](_0x257883);})['then'](function(_0x2d88d6){_0x3ce418[_0xc2d8('0x41')]=_0x2d88d6;return _0x3ce418;})[_0xc2d8('0x26')](respondWithFilteredResult(_0x1cf1ed,_0x257883))[_0xc2d8('0x42')](handleError(_0x1cf1ed,null));};exports[_0xc2d8('0x43')]=function(_0x2e9440,_0x169e31){var _0x20aac9={'raw':!![],'where':{'id':_0x2e9440[_0xc2d8('0x44')]['id']}},_0x227e31={};_0x227e31['model']=_[_0xc2d8('0x31')](db['ZendeskField']['rawAttributes']);_0x227e31[_0xc2d8('0x30')]=_[_0xc2d8('0x31')](_0x2e9440['query']);_0x227e31[_0xc2d8('0x3a')]=_[_0xc2d8('0x32')](_0x227e31[_0xc2d8('0x2f')],_0x227e31['query']);_0x20aac9[_0xc2d8('0x33')]=_[_0xc2d8('0x32')](_0x227e31['model'],qs[_0xc2d8('0x45')](_0x2e9440['query'][_0xc2d8('0x45')]));_0x20aac9['attributes']=_0x20aac9[_0xc2d8('0x33')][_0xc2d8('0x34')]?_0x20aac9[_0xc2d8('0x33')]:_0x227e31[_0xc2d8('0x2f')];if(_0x2e9440[_0xc2d8('0x30')][_0xc2d8('0x46')]){_0x20aac9[_0xc2d8('0x3f')]=[{'all':!![]}];}_0x20aac9=_[_0xc2d8('0x3d')]({},_0x20aac9,_0x2e9440[_0xc2d8('0x47')]);return db[_0xc2d8('0x2c')][_0xc2d8('0x48')](_0x20aac9)['then'](handleEntityNotFound(_0x169e31,null))[_0xc2d8('0x26')](respondWithResult(_0x169e31,null))['catch'](handleError(_0x169e31,null));};exports[_0xc2d8('0x49')]=function(_0x334bfd,_0x153241){return db[_0xc2d8('0x2c')][_0xc2d8('0x49')](_0x334bfd[_0xc2d8('0x4a')],{})[_0xc2d8('0x26')](respondWithResult(_0x153241,0xc9))[_0xc2d8('0x42')](handleError(_0x153241,null));};exports[_0xc2d8('0x24')]=function(_0x1bb50a,_0x453230){if(_0x1bb50a[_0xc2d8('0x4a')]['id']){delete _0x1bb50a[_0xc2d8('0x4a')]['id'];}return db['ZendeskField'][_0xc2d8('0x48')]({'where':{'id':_0x1bb50a['params']['id']}})['then'](handleEntityNotFound(_0x453230,null))[_0xc2d8('0x26')](saveUpdates(_0x1bb50a['body'],null))[_0xc2d8('0x26')](respondWithResult(_0x453230,null))[_0xc2d8('0x42')](handleError(_0x453230,null));};exports[_0xc2d8('0x25')]=function(_0x5931f8,_0x269c82){return db[_0xc2d8('0x2c')][_0xc2d8('0x48')]({'where':{'id':_0x5931f8[_0xc2d8('0x44')]['id']}})[_0xc2d8('0x26')](handleEntityNotFound(_0x269c82,null))['then'](removeEntity(_0x269c82,null))['catch'](handleError(_0x269c82,null));}; \ No newline at end of file +var _0x2544=['end','sendStatus','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy'];(function(_0xbe48c2,_0x3db103){var _0x39a679=function(_0x195d37){while(--_0x195d37){_0xbe48c2['push'](_0xbe48c2['shift']());}};_0x39a679(++_0x3db103);}(_0x2544,0x150));var _0x4254=function(_0x2deced,_0x12341a){_0x2deced=_0x2deced-0x0;var _0x139441=_0x2544[_0x2deced];return _0x139441;};'use strict';var pdf=require(_0x4254('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4254('0x1'));var jsonpatch=require(_0x4254('0x2'));var rp=require(_0x4254('0x3'));var moment=require(_0x4254('0x4'));var BPromise=require(_0x4254('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4254('0x6'));var sox=require(_0x4254('0x7'));var csv=require(_0x4254('0x8'));var ejs=require(_0x4254('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4254('0xa'));var crypto=require(_0x4254('0xb'));var jsforce=require(_0x4254('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4254('0x8'));var querystring=require(_0x4254('0xd'));var Papa=require(_0x4254('0xe'));var Redis=require(_0x4254('0xf'));var authService=require(_0x4254('0x10'));var qs=require(_0x4254('0x11'));var as=require(_0x4254('0x12'));var hardwareService=require(_0x4254('0x13'));var logger=require('../../config/logger')(_0x4254('0x14'));var utils=require('../../config/utils');var config=require(_0x4254('0x15'));var db=require(_0x4254('0x16'))['db'];function respondWithStatusCode(_0x183060,_0x4a484f){_0x4a484f=_0x4a484f||0xcc;return function(_0x29ce66){if(_0x29ce66){return _0x183060['sendStatus'](_0x4a484f);}return _0x183060['status'](_0x4a484f)['end']();};}function respondWithResult(_0x52048f,_0x10811b){_0x10811b=_0x10811b||0xc8;return function(_0x16a147){if(_0x16a147){return _0x52048f[_0x4254('0x17')](_0x10811b)[_0x4254('0x18')](_0x16a147);}};}function respondWithFilteredResult(_0x11fe3f,_0x5e8044){return function(_0x346c3f){if(_0x346c3f){var _0x3e366c=_0x346c3f[_0x4254('0x19')],_0x1d397c=_0x5e8044[_0x4254('0x1a')],_0xf33c69=_0x5e8044[_0x4254('0x1a')]+_0x5e8044[_0x4254('0x1b')],_0x32662d;if(_0xf33c69>=_0x3e366c){_0xf33c69=_0x3e366c;_0x32662d=0xc8;}else{_0x32662d=0xce;}_0x11fe3f[_0x4254('0x17')](_0x32662d);return _0x11fe3f[_0x4254('0x1c')](_0x4254('0x1d'),_0x1d397c+'-'+_0xf33c69+'/'+_0x3e366c)[_0x4254('0x18')](_0x346c3f);}return null;};}function patchUpdates(_0x2688e1){return function(_0x465607){try{jsonpatch['apply'](_0x465607,_0x2688e1,!![]);}catch(_0x11d9b0){return BPromise[_0x4254('0x1e')](_0x11d9b0);}return _0x465607[_0x4254('0x1f')]();};}function saveUpdates(_0x4157df,_0xbce7){return function(_0x5823eb){if(_0x5823eb){return _0x5823eb['update'](_0x4157df)[_0x4254('0x20')](function(_0x203f53){return _0x203f53;});}return null;};}function removeEntity(_0x1e9443,_0x586301){return function(_0x5169a4){if(_0x5169a4){return _0x5169a4[_0x4254('0x21')]()[_0x4254('0x20')](function(){_0x1e9443[_0x4254('0x17')](0xcc)[_0x4254('0x22')]();});}};}function handleEntityNotFound(_0x112c34,_0x2d408a){return function(_0xdbf802){if(!_0xdbf802){_0x112c34[_0x4254('0x23')](0x194);}return _0xdbf802;};}function handleError(_0x22da49,_0x4f618f){_0x4f618f=_0x4f618f||0x1f4;return function(_0x470b5c){logger[_0x4254('0x24')](_0x470b5c[_0x4254('0x25')]);if(_0x470b5c['name']){delete _0x470b5c['name'];}_0x22da49['status'](_0x4f618f)[_0x4254('0x26')](_0x470b5c);};}exports[_0x4254('0x27')]=function(_0x4b0daa,_0x3d6fdc){var _0x606d13={},_0x1ed2a4={},_0x18861d={'count':0x0,'rows':[]};var _0x1d26e8=_[_0x4254('0x28')](db[_0x4254('0x29')][_0x4254('0x2a')],function(_0x4406bb){return{'name':_0x4406bb[_0x4254('0x2b')],'type':_0x4406bb[_0x4254('0x2c')][_0x4254('0x2d')]};});_0x1ed2a4[_0x4254('0x2e')]=_[_0x4254('0x28')](_0x1d26e8,_0x4254('0x2f'));_0x1ed2a4[_0x4254('0x30')]=_[_0x4254('0x31')](_0x4b0daa[_0x4254('0x30')]);_0x1ed2a4[_0x4254('0x32')]=_['intersection'](_0x1ed2a4['model'],_0x1ed2a4[_0x4254('0x30')]);_0x606d13[_0x4254('0x33')]=_[_0x4254('0x34')](_0x1ed2a4[_0x4254('0x2e')],qs['fields'](_0x4b0daa[_0x4254('0x30')][_0x4254('0x35')]));_0x606d13[_0x4254('0x33')]=_0x606d13['attributes'][_0x4254('0x36')]?_0x606d13[_0x4254('0x33')]:_0x1ed2a4[_0x4254('0x2e')];if(!_0x4b0daa[_0x4254('0x30')][_0x4254('0x37')](_0x4254('0x38'))){_0x606d13[_0x4254('0x1b')]=qs[_0x4254('0x1b')](_0x4b0daa[_0x4254('0x30')][_0x4254('0x1b')]);_0x606d13[_0x4254('0x1a')]=qs['offset'](_0x4b0daa['query'][_0x4254('0x1a')]);}_0x606d13['order']=qs['sort'](_0x4b0daa[_0x4254('0x30')][_0x4254('0x39')]);_0x606d13[_0x4254('0x3a')]=qs[_0x4254('0x32')](_[_0x4254('0x3b')](_0x4b0daa[_0x4254('0x30')],_0x1ed2a4[_0x4254('0x32')]),_0x1d26e8);if(_0x4b0daa['query'][_0x4254('0x3c')]){_0x606d13[_0x4254('0x3a')]=_[_0x4254('0x3d')](_0x606d13[_0x4254('0x3a')],{'$or':_['map'](_0x1d26e8,function(_0x406560){if(_0x406560[_0x4254('0x2c')]!==_0x4254('0x3e')){var _0x240f06={};_0x240f06[_0x406560[_0x4254('0x2f')]]={'$like':'%'+_0x4b0daa[_0x4254('0x30')][_0x4254('0x3c')]+'%'};return _0x240f06;}})});}_0x606d13=_[_0x4254('0x3d')]({},_0x606d13,_0x4b0daa[_0x4254('0x3f')]);var _0x5cce97={'where':_0x606d13[_0x4254('0x3a')]};return db[_0x4254('0x29')][_0x4254('0x19')](_0x5cce97)['then'](function(_0x2b7be8){_0x18861d['count']=_0x2b7be8;if(_0x4b0daa['query'][_0x4254('0x40')]){_0x606d13['include']=[{'all':!![]}];}return db[_0x4254('0x29')]['findAll'](_0x606d13);})[_0x4254('0x20')](function(_0xb075d6){_0x18861d[_0x4254('0x41')]=_0xb075d6;return _0x18861d;})[_0x4254('0x20')](respondWithFilteredResult(_0x3d6fdc,_0x606d13))[_0x4254('0x42')](handleError(_0x3d6fdc,null));};exports[_0x4254('0x43')]=function(_0x5c13de,_0x388454){var _0x578740={'raw':!![],'where':{'id':_0x5c13de[_0x4254('0x44')]['id']}},_0x46c771={};_0x46c771[_0x4254('0x2e')]=_[_0x4254('0x31')](db[_0x4254('0x29')]['rawAttributes']);_0x46c771[_0x4254('0x30')]=_[_0x4254('0x31')](_0x5c13de[_0x4254('0x30')]);_0x46c771[_0x4254('0x32')]=_[_0x4254('0x34')](_0x46c771['model'],_0x46c771[_0x4254('0x30')]);_0x578740[_0x4254('0x33')]=_[_0x4254('0x34')](_0x46c771[_0x4254('0x2e')],qs[_0x4254('0x35')](_0x5c13de[_0x4254('0x30')][_0x4254('0x35')]));_0x578740['attributes']=_0x578740['attributes']['length']?_0x578740['attributes']:_0x46c771[_0x4254('0x2e')];if(_0x5c13de[_0x4254('0x30')][_0x4254('0x40')]){_0x578740[_0x4254('0x45')]=[{'all':!![]}];}_0x578740=_['merge']({},_0x578740,_0x5c13de[_0x4254('0x3f')]);return db[_0x4254('0x29')][_0x4254('0x46')](_0x578740)[_0x4254('0x20')](handleEntityNotFound(_0x388454,null))[_0x4254('0x20')](respondWithResult(_0x388454,null))[_0x4254('0x42')](handleError(_0x388454,null));};exports[_0x4254('0x47')]=function(_0x51d666,_0x445ba6){return db[_0x4254('0x29')][_0x4254('0x47')](_0x51d666[_0x4254('0x48')],{})[_0x4254('0x20')](respondWithResult(_0x445ba6,0xc9))[_0x4254('0x42')](handleError(_0x445ba6,null));};exports[_0x4254('0x49')]=function(_0x231e7e,_0x25b4b9){if(_0x231e7e[_0x4254('0x48')]['id']){delete _0x231e7e[_0x4254('0x48')]['id'];}return db[_0x4254('0x29')][_0x4254('0x46')]({'where':{'id':_0x231e7e['params']['id']}})['then'](handleEntityNotFound(_0x25b4b9,null))[_0x4254('0x20')](saveUpdates(_0x231e7e[_0x4254('0x48')],null))[_0x4254('0x20')](respondWithResult(_0x25b4b9,null))[_0x4254('0x42')](handleError(_0x25b4b9,null));};exports[_0x4254('0x21')]=function(_0x19853f,_0x3e9818){return db['ZendeskField']['find']({'where':{'id':_0x19853f[_0x4254('0x44')]['id']}})[_0x4254('0x20')](handleEntityNotFound(_0x3e9818,null))['then'](removeEntity(_0x3e9818,null))[_0x4254('0x42')](handleError(_0x3e9818,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1e67599..ee14cca 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 _0x3ee7=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','util','moment'];(function(_0x186b24,_0x593576){var _0x4dbb2d=function(_0x525592){while(--_0x525592){_0x186b24['push'](_0x186b24['shift']());}};_0x4dbb2d(++_0x593576);}(_0x3ee7,0x98));var _0x73ee=function(_0x75b0d9,_0x40dd78){_0x75b0d9=_0x75b0d9-0x0;var _0x324713=_0x3ee7[_0x75b0d9];return _0x324713;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x73ee('0x1'));var BPromise=require('bluebird');var rp=require(_0x73ee('0x2'));var fs=require('fs');var path=require(_0x73ee('0x3'));var rimraf=require(_0x73ee('0x4'));var config=require(_0x73ee('0x5'));var attributes=require(_0x73ee('0x6'));module[_0x73ee('0x7')]=function(_0x2bc2c1,_0x447c6f){return _0x2bc2c1['define'](_0x73ee('0x8'),attributes,{'tableName':_0x73ee('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x73ee('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb945=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','../../config/logger','moment','path','rimraf'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb945,0x97));var _0x5b94=function(_0x2c7e3d,_0x224968){_0x2c7e3d=_0x2c7e3d-0x0;var _0x4a27d6=_0xb945[_0x2c7e3d];return _0x4a27d6;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var logger=require(_0x5b94('0x1'))('api');var moment=require(_0x5b94('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b94('0x3'));var rimraf=require(_0x5b94('0x4'));var config=require(_0x5b94('0x5'));var attributes=require(_0x5b94('0x6'));module[_0x5b94('0x7')]=function(_0x4bef06,_0x492388){return _0x4bef06[_0x5b94('0x8')](_0x5b94('0x9'),attributes,{'tableName':_0x5b94('0xa'),'paranoid':![],'indexes':[{'name':_0x5b94('0xb'),'fields':['idField',_0x5b94('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 4b43e52..6c71cde 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 _0xc2ad=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xc2ad,0x84));var _0xdc2a=function(_0x11f902,_0x187a11){_0x11f902=_0x11f902-0x0;var _0x4f20cb=_0xc2ad[_0x11f902];return _0x4f20cb;};'use strict';var _=require('lodash');var util=require(_0xdc2a('0x0'));var moment=require('moment');var BPromise=require(_0xdc2a('0x1'));var rs=require(_0xdc2a('0x2'));var fs=require('fs');var Redis=require(_0xdc2a('0x3'));var db=require(_0xdc2a('0x4'))['db'];var utils=require(_0xdc2a('0x5'));var logger=require('../../config/logger')(_0xdc2a('0x6'));var config=require('../../config/environment');var jayson=require(_0xdc2a('0x7'));var client=jayson[_0xdc2a('0x8')][_0xdc2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d648e,_0x4c910e,_0x373192){return new BPromise(function(_0x4edd75,_0x5d8973){return client[_0xdc2a('0xa')](_0x3d648e,_0x373192)[_0xdc2a('0xb')](function(_0x2253a5){logger[_0xdc2a('0xc')](_0xdc2a('0xd'),_0x4c910e,_0xdc2a('0xe'));logger[_0xdc2a('0xf')](_0xdc2a('0x10'),_0x4c910e,_0xdc2a('0xe'),JSON[_0xdc2a('0x11')](_0x2253a5));if(_0x2253a5[_0xdc2a('0x12')]){if(_0x2253a5['error']['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4c910e,_0x2253a5['error']['message']);return _0x5d8973(_0x2253a5[_0xdc2a('0x12')][_0xdc2a('0x13')]);}logger[_0xdc2a('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4c910e,_0x2253a5[_0xdc2a('0x12')][_0xdc2a('0x13')]);return _0x4edd75(_0x2253a5[_0xdc2a('0x12')]['message']);}else{logger[_0xdc2a('0xc')](_0xdc2a('0xd'),_0x4c910e,'request\x20sent');_0x4edd75(_0x2253a5[_0xdc2a('0x14')][_0xdc2a('0x13')]);}})[_0xdc2a('0x15')](function(_0x56ec4b){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4c910e,_0x56ec4b);_0x5d8973(_0x56ec4b);});});} \ No newline at end of file +var _0xfd31=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x1e62b8,_0x5eed4c){var _0x2ab271=function(_0x20f14e){while(--_0x20f14e){_0x1e62b8['push'](_0x1e62b8['shift']());}};_0x2ab271(++_0x5eed4c);}(_0xfd31,0xc2));var _0x1fd3=function(_0x50431e,_0x57ce11){_0x50431e=_0x50431e-0x0;var _0x44aa87=_0xfd31[_0x50431e];return _0x44aa87;};'use strict';var _=require(_0x1fd3('0x0'));var util=require(_0x1fd3('0x1'));var moment=require(_0x1fd3('0x2'));var BPromise=require(_0x1fd3('0x3'));var rs=require(_0x1fd3('0x4'));var fs=require('fs');var Redis=require(_0x1fd3('0x5'));var db=require(_0x1fd3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fd3('0x7'))(_0x1fd3('0x8'));var config=require(_0x1fd3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1fd3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235809,_0x40abff,_0x12e62f){return new BPromise(function(_0x569708,_0x2ecdfe){return client[_0x1fd3('0xb')](_0x235809,_0x12e62f)[_0x1fd3('0xc')](function(_0x3d1895){logger[_0x1fd3('0xd')](_0x1fd3('0xe'),_0x40abff,_0x1fd3('0xf'));logger[_0x1fd3('0x10')](_0x1fd3('0x11'),_0x40abff,_0x1fd3('0xf'),JSON['stringify'](_0x3d1895));if(_0x3d1895[_0x1fd3('0x12')]){if(_0x3d1895[_0x1fd3('0x12')][_0x1fd3('0x13')]===0x1f4){logger[_0x1fd3('0x12')]('ZendeskField,\x20%s,\x20%s',_0x40abff,_0x3d1895[_0x1fd3('0x12')]['message']);return _0x2ecdfe(_0x3d1895[_0x1fd3('0x12')]['message']);}logger[_0x1fd3('0x12')](_0x1fd3('0xe'),_0x40abff,_0x3d1895[_0x1fd3('0x12')][_0x1fd3('0x14')]);return _0x569708(_0x3d1895[_0x1fd3('0x12')][_0x1fd3('0x14')]);}else{logger['info'](_0x1fd3('0xe'),_0x40abff,_0x1fd3('0xf'));_0x569708(_0x3d1895[_0x1fd3('0x15')][_0x1fd3('0x14')]);}})['catch'](function(_0x45658d){logger['error'](_0x1fd3('0xe'),_0x40abff,_0x45658d);_0x2ecdfe(_0x45658d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9e77b59..731cb34 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 _0x8621=['/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8621,0x15c));var _0x1862=function(_0x46b4d7,_0x30277d){_0x46b4d7=_0x46b4d7-0x0;var _0x50b9bb=_0x8621[_0x46b4d7];return _0x50b9bb;};'use strict';var multer=require(_0x1862('0x0'));var util=require(_0x1862('0x1'));var path=require(_0x1862('0x2'));var timeout=require(_0x1862('0x3'));var express=require(_0x1862('0x4'));var router=express[_0x1862('0x5')]();var auth=require(_0x1862('0x6'));var interaction=require(_0x1862('0x7'));var config=require(_0x1862('0x8'));var controller=require('./intZohoAccount.controller');router[_0x1862('0x9')]('/',auth[_0x1862('0xa')](),controller[_0x1862('0xb')]);router[_0x1862('0x9')](_0x1862('0xc'),auth['isAuthenticated'](),controller[_0x1862('0xd')]);router[_0x1862('0x9')]('/:id/configurations',auth[_0x1862('0xa')](),controller[_0x1862('0xe')]);router[_0x1862('0x9')]('/:id/fields',auth[_0x1862('0xa')](),controller[_0x1862('0xf')]);router[_0x1862('0x10')]('/',auth[_0x1862('0xa')](),controller[_0x1862('0x11')]);router[_0x1862('0x10')](_0x1862('0x12'),auth['isAuthenticated'](),controller[_0x1862('0x13')]);router[_0x1862('0x14')](_0x1862('0xc'),auth[_0x1862('0xa')](),controller[_0x1862('0x15')]);router[_0x1862('0x16')](_0x1862('0xc'),auth[_0x1862('0xa')](),controller[_0x1862('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6f53=['./intZohoAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x3d0d77,_0xf83fb4){var _0x5492f0=function(_0x5a7243){while(--_0x5a7243){_0x3d0d77['push'](_0x3d0d77['shift']());}};_0x5492f0(++_0xf83fb4);}(_0x6f53,0x15a));var _0x36f5=function(_0x46211f,_0x3bdc2b){_0x46211f=_0x46211f-0x0;var _0x3829cd=_0x6f53[_0x46211f];return _0x3829cd;};'use strict';var multer=require(_0x36f5('0x0'));var util=require(_0x36f5('0x1'));var path=require('path');var timeout=require(_0x36f5('0x2'));var express=require(_0x36f5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x36f5('0x4'));var config=require(_0x36f5('0x5'));var controller=require(_0x36f5('0x6'));router[_0x36f5('0x7')]('/',auth['isAuthenticated'](),controller[_0x36f5('0x8')]);router[_0x36f5('0x7')](_0x36f5('0x9'),auth['isAuthenticated'](),controller[_0x36f5('0xa')]);router[_0x36f5('0x7')](_0x36f5('0xb'),auth[_0x36f5('0xc')](),controller['getConfigurations']);router[_0x36f5('0x7')](_0x36f5('0xd'),auth['isAuthenticated'](),controller[_0x36f5('0xe')]);router['post']('/',auth[_0x36f5('0xc')](),controller[_0x36f5('0xf')]);router[_0x36f5('0x10')]('/:id/configurations',auth[_0x36f5('0xc')](),controller[_0x36f5('0x11')]);router[_0x36f5('0x12')](_0x36f5('0x9'),auth[_0x36f5('0xc')](),controller[_0x36f5('0x13')]);router['delete'](_0x36f5('0x9'),auth[_0x36f5('0xc')](),controller[_0x36f5('0x14')]);module[_0x36f5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0118883..6919cd1 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 _0x9371=['STRING','sequelize'];(function(_0x56e6ef,_0x4dfcc1){var _0x28fd09=function(_0x5baf57){while(--_0x5baf57){_0x56e6ef['push'](_0x56e6ef['shift']());}};_0x28fd09(++_0x4dfcc1);}(_0x9371,0x127));var _0x1937=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9371[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x1937('0x0'));module['exports']={'name':{'type':Sequelize[_0x1937('0x1')]},'description':{'type':Sequelize[_0x1937('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1937('0x1')]},'clientId':{'type':Sequelize[_0x1937('0x1')]},'clientSecret':{'type':Sequelize[_0x1937('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x1937('0x1')]},'refreshToken':{'type':Sequelize[_0x1937('0x1')]}}; \ No newline at end of file +var _0xd96c=['exports','STRING'];(function(_0x28c07e,_0x247e59){var _0x13845c=function(_0x2d63af){while(--_0x2d63af){_0x28c07e['push'](_0x28c07e['shift']());}};_0x13845c(++_0x247e59);}(_0xd96c,0xe4));var _0xcd96=function(_0x21a209,_0x1b8347){_0x21a209=_0x21a209-0x0;var _0x40c2a8=_0xd96c[_0x21a209];return _0x40c2a8;};'use strict';var Sequelize=require('sequelize');module[_0xcd96('0x0')]={'name':{'type':Sequelize[_0xcd96('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcd96('0x1')]},'zone':{'type':Sequelize[_0xcd96('0x1')]},'clientId':{'type':Sequelize[_0xcd96('0x1')]},'clientSecret':{'type':Sequelize[_0xcd96('0x1')]},'serverUrl':{'type':Sequelize[_0xcd96('0x1')]},'code':{'type':Sequelize[_0xcd96('0x1')]},'refreshToken':{'type':Sequelize[_0xcd96('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d02298b..38b28f3 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 _0x59f9=['system_mandatory','push','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','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','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~!@#$%^&-_=+[{]}.','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','name','send','index','map','ZohoAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','rawAttributes','options','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','access_token','getFields','host','clientSecret','serverUrl','zoho.eu','slice','substring','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','Owner','Subject','Description','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name'];(function(_0x15d203,_0x5b93ba){var _0x350cf6=function(_0x32335b){while(--_0x32335b){_0x15d203['push'](_0x15d203['shift']());}};_0x350cf6(++_0x5b93ba);}(_0x59f9,0x11f));var _0x959f=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x59f9[_0x29c261];return _0x1a9335;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x959f('0x0'));var rimraf=require(_0x959f('0x1'));var zipdir=require(_0x959f('0x2'));var jsonpatch=require(_0x959f('0x3'));var rp=require(_0x959f('0x4'));var moment=require(_0x959f('0x5'));var BPromise=require(_0x959f('0x6'));var Mustache=require(_0x959f('0x7'));var util=require(_0x959f('0x8'));var path=require(_0x959f('0x9'));var sox=require(_0x959f('0xa'));var csv=require('to-csv');var ejs=require(_0x959f('0xb'));var fs=require('fs');var _=require(_0x959f('0xc'));var squel=require(_0x959f('0xd'));var crypto=require(_0x959f('0xe'));var jsforce=require(_0x959f('0xf'));var deskjs=require(_0x959f('0x10'));var toCsv=require(_0x959f('0x11'));var querystring=require(_0x959f('0x12'));var Papa=require(_0x959f('0x13'));var Redis=require('ioredis');var authService=require(_0x959f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x959f('0x15'));var hardwareService=require(_0x959f('0x16'));var logger=require(_0x959f('0x17'))(_0x959f('0x18'));var utils=require(_0x959f('0x19'));var config=require(_0x959f('0x1a'));var db=require(_0x959f('0x1b'))['db'];var integrations=require(_0x959f('0x1c'));var jayson=require('jayson/promise');var client=jayson[_0x959f('0x1d')][_0x959f('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x37634f,_0x1009b3,_0x25b119){if(_0x25b119){var _0x29eac6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29eac6['test'](_0x1009b3)){return _0x37634f;}else{throw new db[(_0x959f('0x1f'))][(_0x959f('0x20'))](_0x959f('0x21'));}}else{return _0x37634f;}}function respondWithRpcPromise(_0x52ab32,_0xc3060a,_0x1daf4e,_0x540e7a){return new BPromise(function(_0x58b71f,_0x405263){var _0x3774cc=_0x540e7a||client;return _0x3774cc[_0x959f('0x22')](_0x52ab32,_0x1daf4e)['then'](function(_0x41ff3f){logger[_0x959f('0x23')](_0x959f('0x24'),_0xc3060a,_0x959f('0x25'));logger[_0x959f('0x26')](_0x959f('0x27'),_0xc3060a,_0x959f('0x25'),JSON[_0x959f('0x28')](_0x41ff3f));if(_0x41ff3f[_0x959f('0x29')]){if(_0x41ff3f[_0x959f('0x29')][_0x959f('0x2a')]===0x1f4){logger[_0x959f('0x29')]('ZohoAccount,\x20%s,\x20%s',_0xc3060a,_0x41ff3f[_0x959f('0x29')][_0x959f('0x2b')]);return _0x405263(_0x41ff3f[_0x959f('0x29')][_0x959f('0x2b')]);}logger['error'](_0x959f('0x24'),_0xc3060a,_0x41ff3f[_0x959f('0x29')][_0x959f('0x2b')]);return _0x58b71f(_0x41ff3f['error'][_0x959f('0x2b')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0xc3060a,'request\x20sent');_0x58b71f(_0x41ff3f[_0x959f('0x2c')][_0x959f('0x2b')]);}})['catch'](function(_0x581e69){logger[_0x959f('0x29')]('ZohoAccount,\x20%s,\x20%s',_0xc3060a,_0x581e69);_0x405263(_0x581e69);});});}function respondWithStatusCode(_0x1d25da,_0x1a5beb){_0x1a5beb=_0x1a5beb||0xcc;return function(_0x4d19f6){if(_0x4d19f6){return _0x1d25da[_0x959f('0x2d')](_0x1a5beb);}return _0x1d25da[_0x959f('0x2e')](_0x1a5beb)[_0x959f('0x2f')]();};}function respondWithResult(_0xb42fd8,_0x3815ec){_0x3815ec=_0x3815ec||0xc8;return function(_0x546ad6){if(_0x546ad6){return _0xb42fd8[_0x959f('0x2e')](_0x3815ec)[_0x959f('0x30')](_0x546ad6);}};}function respondWithFilteredResult(_0x33f0ff,_0x1ad66f){return function(_0x3e8a9d){if(_0x3e8a9d){var _0x3a769f=_0x3e8a9d[_0x959f('0x31')],_0x3dc87b=_0x1ad66f[_0x959f('0x32')],_0x5c5316=_0x1ad66f['offset']+_0x1ad66f[_0x959f('0x33')],_0x15832c;if(_0x5c5316>=_0x3a769f){_0x5c5316=_0x3a769f;_0x15832c=0xc8;}else{_0x15832c=0xce;}_0x33f0ff[_0x959f('0x2e')](_0x15832c);return _0x33f0ff['set']('Content-Range',_0x3dc87b+'-'+_0x5c5316+'/'+_0x3a769f)['json'](_0x3e8a9d);}return null;};}function patchUpdates(_0x231d96){return function(_0x3ae0bd){try{jsonpatch['apply'](_0x3ae0bd,_0x231d96,!![]);}catch(_0xeb650b){return BPromise[_0x959f('0x34')](_0xeb650b);}return _0x3ae0bd[_0x959f('0x35')]();};}function saveUpdates(_0x51ed54,_0x5bd502){return function(_0x3ab957){if(_0x3ab957){return _0x3ab957[_0x959f('0x36')](_0x51ed54)[_0x959f('0x37')](function(_0x5d076e){return _0x5d076e;});}return null;};}function removeEntity(_0x106038,_0x18d29a){return function(_0x1345db){if(_0x1345db){return _0x1345db[_0x959f('0x38')]()[_0x959f('0x37')](function(){_0x106038[_0x959f('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc341f0,_0x565120){return function(_0x3d2868){if(!_0x3d2868){_0xc341f0[_0x959f('0x2d')](0x194);}return _0x3d2868;};}function handleError(_0x514c5a,_0x4a09bb){_0x4a09bb=_0x4a09bb||0x1f4;return function(_0x578fbb){logger[_0x959f('0x29')](_0x578fbb['stack']);if(_0x578fbb[_0x959f('0x39')]){delete _0x578fbb[_0x959f('0x39')];}_0x514c5a[_0x959f('0x2e')](_0x4a09bb)[_0x959f('0x3a')](_0x578fbb);};}exports[_0x959f('0x3b')]=function(_0x54f566,_0x213d80){var _0x4990d5={},_0x1ca6dc={},_0x5d0358={'count':0x0,'rows':[]};var _0x1ef8d0=_[_0x959f('0x3c')](db[_0x959f('0x3d')]['rawAttributes'],function(_0x4b3357){return{'name':_0x4b3357['fieldName'],'type':_0x4b3357[_0x959f('0x3e')][_0x959f('0x3f')]};});_0x1ca6dc[_0x959f('0x40')]=_[_0x959f('0x3c')](_0x1ef8d0,_0x959f('0x39'));_0x1ca6dc[_0x959f('0x41')]=_[_0x959f('0x42')](_0x54f566[_0x959f('0x41')]);_0x1ca6dc[_0x959f('0x43')]=_[_0x959f('0x44')](_0x1ca6dc[_0x959f('0x40')],_0x1ca6dc[_0x959f('0x41')]);_0x4990d5[_0x959f('0x45')]=_[_0x959f('0x44')](_0x1ca6dc[_0x959f('0x40')],qs[_0x959f('0x46')](_0x54f566['query'][_0x959f('0x46')]));_0x4990d5[_0x959f('0x45')]=_0x4990d5['attributes'][_0x959f('0x47')]?_0x4990d5[_0x959f('0x45')]:_0x1ca6dc[_0x959f('0x40')];if(!_0x54f566[_0x959f('0x41')][_0x959f('0x48')](_0x959f('0x49'))){_0x4990d5[_0x959f('0x33')]=qs[_0x959f('0x33')](_0x54f566[_0x959f('0x41')][_0x959f('0x33')]);_0x4990d5['offset']=qs[_0x959f('0x32')](_0x54f566[_0x959f('0x41')]['offset']);}_0x4990d5[_0x959f('0x4a')]=qs['sort'](_0x54f566['query'][_0x959f('0x4b')]);_0x4990d5[_0x959f('0x4c')]=qs[_0x959f('0x43')](_['pick'](_0x54f566['query'],_0x1ca6dc['filters']),_0x1ef8d0);if(_0x54f566[_0x959f('0x41')][_0x959f('0x4d')]){_0x4990d5[_0x959f('0x4c')]=_['merge'](_0x4990d5[_0x959f('0x4c')],{'$or':_[_0x959f('0x3c')](_0x1ef8d0,function(_0x12568c){if(_0x12568c[_0x959f('0x3e')]!==_0x959f('0x4e')){var _0x34326e={};_0x34326e[_0x12568c[_0x959f('0x39')]]={'$like':'%'+_0x54f566['query'][_0x959f('0x4d')]+'%'};return _0x34326e;}})});}_0x4990d5=_[_0x959f('0x4f')]({},_0x4990d5,_0x54f566['options']);var _0x26357b={'where':_0x4990d5[_0x959f('0x4c')]};return db[_0x959f('0x3d')][_0x959f('0x31')](_0x26357b)[_0x959f('0x37')](function(_0x36ee36){_0x5d0358['count']=_0x36ee36;if(_0x54f566[_0x959f('0x41')][_0x959f('0x50')]){_0x4990d5[_0x959f('0x51')]=[{'all':!![]}];}return db[_0x959f('0x3d')]['findAll'](_0x4990d5);})[_0x959f('0x37')](function(_0x37e59f){_0x5d0358[_0x959f('0x52')]=_0x37e59f;return _0x5d0358;})[_0x959f('0x37')](respondWithFilteredResult(_0x213d80,_0x4990d5))[_0x959f('0x53')](handleError(_0x213d80,null));};exports['show']=function(_0x5d1874,_0x1e8162){var _0x21d76e={'raw':![],'where':{'id':_0x5d1874[_0x959f('0x54')]['id']}},_0xfeafd0={};_0xfeafd0['model']=_[_0x959f('0x42')](db['ZohoAccount'][_0x959f('0x55')]);_0xfeafd0[_0x959f('0x41')]=_[_0x959f('0x42')](_0x5d1874[_0x959f('0x41')]);_0xfeafd0[_0x959f('0x43')]=_[_0x959f('0x44')](_0xfeafd0[_0x959f('0x40')],_0xfeafd0[_0x959f('0x41')]);_0x21d76e[_0x959f('0x45')]=_[_0x959f('0x44')](_0xfeafd0['model'],qs['fields'](_0x5d1874['query'][_0x959f('0x46')]));_0x21d76e['attributes']=_0x21d76e[_0x959f('0x45')][_0x959f('0x47')]?_0x21d76e[_0x959f('0x45')]:_0xfeafd0[_0x959f('0x40')];if(_0x5d1874[_0x959f('0x41')][_0x959f('0x50')]){_0x21d76e[_0x959f('0x51')]=[{'all':!![]}];}_0x21d76e=_['merge']({},_0x21d76e,_0x5d1874[_0x959f('0x56')]);return db[_0x959f('0x3d')]['find'](_0x21d76e)['then'](handleEntityNotFound(_0x1e8162,null))[_0x959f('0x37')](respondWithResult(_0x1e8162,null))[_0x959f('0x53')](handleError(_0x1e8162,null));};exports['create']=function(_0x61c9e5,_0x10a057){return db[_0x959f('0x3d')][_0x959f('0x57')](_0x61c9e5[_0x959f('0x58')],{})['then'](respondWithResult(_0x10a057,0xc9))[_0x959f('0x53')](handleError(_0x10a057,null));};exports[_0x959f('0x36')]=function(_0x594e8d,_0x8b9e66){if(_0x594e8d[_0x959f('0x58')]['id']){delete _0x594e8d[_0x959f('0x58')]['id'];}return db[_0x959f('0x3d')][_0x959f('0x59')]({'where':{'id':_0x594e8d[_0x959f('0x54')]['id']}})[_0x959f('0x37')](handleEntityNotFound(_0x8b9e66,null))[_0x959f('0x37')](saveUpdates(_0x594e8d['body'],null))[_0x959f('0x37')](respondWithResult(_0x8b9e66,null))[_0x959f('0x53')](handleError(_0x8b9e66,null));};exports[_0x959f('0x38')]=function(_0x55237d,_0x29dc29){return db[_0x959f('0x3d')][_0x959f('0x59')]({'where':{'id':_0x55237d[_0x959f('0x54')]['id']}})['then'](handleEntityNotFound(_0x29dc29,null))[_0x959f('0x37')](removeEntity(_0x29dc29,null))[_0x959f('0x53')](handleError(_0x29dc29,null));};exports[_0x959f('0x5a')]=function(_0x431f16,_0x5752cd,_0x3b1b59){var _0xb50cc3={};var _0x3fcd9f={};var _0x9b4160;var _0x132d31;return db[_0x959f('0x3d')][_0x959f('0x5b')]({'where':{'id':_0x431f16['params']['id']}})[_0x959f('0x37')](handleEntityNotFound(_0x5752cd,null))[_0x959f('0x37')](function(_0xe385ea){if(_0xe385ea){_0x9b4160=_0xe385ea;_0x3fcd9f[_0x959f('0x40')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x3fcd9f[_0x959f('0x41')]=_[_0x959f('0x42')](_0x431f16[_0x959f('0x41')]);_0x3fcd9f[_0x959f('0x43')]=_[_0x959f('0x44')](_0x3fcd9f[_0x959f('0x40')],_0x3fcd9f['query']);_0xb50cc3[_0x959f('0x45')]=_[_0x959f('0x44')](_0x3fcd9f[_0x959f('0x40')],qs['fields'](_0x431f16['query'][_0x959f('0x46')]));_0xb50cc3[_0x959f('0x45')]=_0xb50cc3['attributes'][_0x959f('0x47')]?_0xb50cc3[_0x959f('0x45')]:_0x3fcd9f[_0x959f('0x40')];_0xb50cc3['order']=qs[_0x959f('0x4b')](_0x431f16[_0x959f('0x41')][_0x959f('0x4b')]);_0xb50cc3[_0x959f('0x4c')]=qs['filters'](_['pick'](_0x431f16[_0x959f('0x41')],_0x3fcd9f['filters']));if(_0x431f16[_0x959f('0x41')][_0x959f('0x4d')]){_0xb50cc3[_0x959f('0x4c')]=_[_0x959f('0x4f')](_0xb50cc3['where'],{'$or':_['map'](_0xb50cc3[_0x959f('0x45')],function(_0x12441b){var _0x178c17={};_0x178c17[_0x12441b]={'$like':'%'+_0x431f16[_0x959f('0x41')][_0x959f('0x4d')]+'%'};return _0x178c17;})});}_0xb50cc3=_[_0x959f('0x4f')]({},_0xb50cc3,_0x431f16['options']);return _0x9b4160[_0x959f('0x5a')](_0xb50cc3);}})[_0x959f('0x37')](function(_0x2c2e1f){if(_0x2c2e1f){_0x132d31=_0x2c2e1f[_0x959f('0x47')];if(!_0x431f16[_0x959f('0x41')][_0x959f('0x48')](_0x959f('0x49'))){_0xb50cc3[_0x959f('0x33')]=qs[_0x959f('0x33')](_0x431f16[_0x959f('0x41')]['limit']);_0xb50cc3[_0x959f('0x32')]=qs[_0x959f('0x32')](_0x431f16[_0x959f('0x41')][_0x959f('0x32')]);}return _0x9b4160['getConfigurations'](_0xb50cc3);}})[_0x959f('0x37')](function(_0x25206d){if(_0x25206d){return _0x25206d?{'count':_0x132d31,'rows':_0x25206d}:null;}})['then'](respondWithResult(_0x5752cd,null))['catch'](handleError(_0x5752cd,null));};exports[_0x959f('0x5c')]=function(_0x47e580,_0x3f83f9,_0x4e9a8e){if(_0x47e580[_0x959f('0x58')]['id']){delete _0x47e580[_0x959f('0x58')]['id'];}return db[_0x959f('0x3d')][_0x959f('0x5b')]({'where':{'id':_0x47e580['params']['id']}})[_0x959f('0x37')](handleEntityNotFound(_0x3f83f9,null))[_0x959f('0x37')](function(_0x563248){if(_0x563248){_0x47e580[_0x959f('0x58')][_0x959f('0x5d')]=_0x563248['id'];_0x47e580['body'][_0x959f('0x5e')]=integrations[_0x959f('0x5f')](_0x47e580['body'][_0x959f('0x60')],_0x47e580['body']['type']);_0x47e580[_0x959f('0x58')][_0x959f('0x61')]=integrations['getDescriptions'](_0x47e580[_0x959f('0x58')][_0x959f('0x60')],_0x47e580[_0x959f('0x58')][_0x959f('0x3e')]);return db[_0x959f('0x62')]['create'](_0x47e580[_0x959f('0x58')],{'include':[{'model':db[_0x959f('0x63')],'as':_0x959f('0x5e')},{'model':db[_0x959f('0x63')],'as':_0x959f('0x61')}]});}return null;})[_0x959f('0x37')](respondWithResult(_0x3f83f9,null))[_0x959f('0x53')](handleError(_0x3f83f9,null));};function getAccessToken(_0x2d85af){return new Promise(function(_0x265fc1,_0x10531e){var _0x1b81c0;switch(_0x2d85af[_0x959f('0x64')]){case'US':_0x1b81c0='https://accounts.zoho.com';break;case'AU':_0x1b81c0=_0x959f('0x65');break;case'EU':_0x1b81c0='https://accounts.zoho.eu';break;case'IN':_0x1b81c0='https://accounts.zoho.in';break;case'CN':_0x1b81c0=_0x959f('0x66');break;default:_0x1b81c0=_0x959f('0x67');break;}var _0x232cb1={'method':_0x959f('0x68'),'uri':_0x1b81c0+_0x959f('0x69'),'qs':{'refresh_token':_0x2d85af['refreshToken'],'client_id':_0x2d85af[_0x959f('0x6a')],'client_secret':_0x2d85af['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x232cb1)[_0x959f('0x37')](function(_0x44684c){if(_0x44684c[_0x959f('0x6b')]){_0x265fc1(_0x44684c[_0x959f('0x6b')]);}else{_0x10531e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x5885dc){_0x10531e(_0x5885dc);});});}exports[_0x959f('0x6c')]=function(_0x430bd4,_0x12a467,_0x48afb5){var _0x4f6659,_0x33cba7,_0xcedf16,_0x184ded,_0x14848c;return db[_0x959f('0x3d')][_0x959f('0x5b')]({'where':{'id':_0x430bd4[_0x959f('0x54')]['id']},'attributes':['id',_0x959f('0x6d'),_0x959f('0x64'),_0x959f('0x6a'),_0x959f('0x6e'),_0x959f('0x6f'),_0x959f('0x2a'),'refreshToken']})[_0x959f('0x37')](handleEntityNotFound(_0x12a467,null))[_0x959f('0x37')](function(_0x2d6da1){_0x14848c=_0x2d6da1;_0x4f6659=_0x14848c['host'];_0x33cba7=_0x4f6659===_0x959f('0x70')?'eu':'com';_0xcedf16=_0x14848c[_0x959f('0x6f')];var _0x2379f0=_0xcedf16[_0x959f('0x71')](-0x1);if(_0x2379f0==='/'||_0x2379f0==='\x5c'||_0x2379f0===':'){_0xcedf16=_0xcedf16[_0x959f('0x72')](0x0,_0xcedf16['lastIndexOf'](_0x2379f0));}if(!_0x14848c[_0x959f('0x73')]){throw new Error(_0x959f('0x74'));}return getAccessToken(_0x14848c);})['then'](function(_0x25481d){if(_0x25481d){return rp({'method':_0x959f('0x75'),'uri':util[_0x959f('0x76')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x33cba7),'qs':{'module':_0x959f('0x77')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x25481d},'json':!![]});}})['then'](function(_0x3358df){if(_0x3358df){if(_0x3358df[_0x959f('0x78')]&&_0x3358df[_0x959f('0x78')][_0x959f('0x29')]){throw new Error(_0x3358df[_0x959f('0x78')][_0x959f('0x29')]['message']);}var _0x1d5ac5=[];var _0x4b32c8=[];var _0x169816=[_0x959f('0x79'),_0x959f('0x7a'),_0x959f('0x7b'),'WhoId','Call_Duration',_0x959f('0x7c'),_0x959f('0x7d'),_0x959f('0x7e')];_0x4b32c8=_[_0x959f('0x7f')](_0x3358df[_0x959f('0x46')],function(_0x1277ba){return _0x169816[_0x959f('0x80')](_0x1277ba[_0x959f('0x81')]);});for(var _0x284362=0x0;_0x284362<_0x4b32c8[_0x959f('0x47')];_0x284362++){if(_0x4b32c8[_0x284362][_0x959f('0x82')]===![]){_0x1d5ac5[_0x959f('0x83')]({'id':_0x4b32c8[_0x284362]['id'],'name':_0x4b32c8[_0x284362]['display_label'],'custom':_0x4b32c8[_0x284362]['custom_field'],'options':_0x4b32c8[_0x284362][_0x959f('0x84')]===_0x959f('0x85')&&_0x4b32c8[_0x284362][_0x959f('0x86')][_0x959f('0x47')]>-0x1?_['map'](_0x4b32c8[_0x284362]['pick_list_values'],function(_0x3654bc){return{'name':_0x3654bc,'value':_0x3654bc};}):[]});}}return{'count':_0x1d5ac5[_0x959f('0x47')],'rows':_0x1d5ac5};}else{return{'count':0x0,'rows':[]};}})[_0x959f('0x37')](respondWithResult(_0x12a467,null))[_0x959f('0x53')](function(_0xfca8db){var _0x5d3e04=_0x430bd4['query'][_0x959f('0x87')]?0x1f4:_0xfca8db[_0x959f('0x88')]||0x1f4;logger[_0x959f('0x29')](_0x959f('0x89'),_0x959f('0x6c'),_0x5d3e04,JSON['stringify'](_0xfca8db));delete _0xfca8db[_0x959f('0x39')];if(_0x5d3e04===0x191){_0x5d3e04=0x190;}_0x12a467[_0x959f('0x2e')](_0x5d3e04)[_0x959f('0x3a')](_0x430bd4[_0x959f('0x41')][_0x959f('0x87')]?{'message':_0x959f('0x8a'),'statusCode':_0xfca8db[_0x959f('0x88')]}:_0xfca8db);});}; \ No newline at end of file +var _0xc2ff=['../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ZohoAccount','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','getFields','host','clientId','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb'];(function(_0x1bd2e3,_0x1587d4){var _0x3db57e=function(_0x11eb3f){while(--_0x11eb3f){_0x1bd2e3['push'](_0x1bd2e3['shift']());}};_0x3db57e(++_0x1587d4);}(_0xc2ff,0x77));var _0xfc2f=function(_0x886835,_0x522d9a){_0x886835=_0x886835-0x0;var _0x1e81df=_0xc2ff[_0x886835];return _0x1e81df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc2f('0x0'));var rimraf=require(_0xfc2f('0x1'));var zipdir=require(_0xfc2f('0x2'));var jsonpatch=require(_0xfc2f('0x3'));var rp=require(_0xfc2f('0x4'));var moment=require(_0xfc2f('0x5'));var BPromise=require(_0xfc2f('0x6'));var Mustache=require('mustache');var util=require(_0xfc2f('0x7'));var path=require(_0xfc2f('0x8'));var sox=require(_0xfc2f('0x9'));var csv=require(_0xfc2f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc2f('0xb'));var squel=require(_0xfc2f('0xc'));var crypto=require(_0xfc2f('0xd'));var jsforce=require(_0xfc2f('0xe'));var deskjs=require(_0xfc2f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfc2f('0x10'));var Papa=require(_0xfc2f('0x11'));var Redis=require('ioredis');var authService=require(_0xfc2f('0x12'));var qs=require(_0xfc2f('0x13'));var as=require(_0xfc2f('0x14'));var hardwareService=require(_0xfc2f('0x15'));var logger=require('../../config/logger')(_0xfc2f('0x16'));var utils=require('../../config/utils');var config=require(_0xfc2f('0x17'));var db=require(_0xfc2f('0x18'))['db'];var integrations=require(_0xfc2f('0x19'));var jayson=require(_0xfc2f('0x1a'));var client=jayson['client'][_0xfc2f('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x320a49,_0x570896,_0x19ae3b){if(_0x19ae3b){var _0x375e55=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x375e55[_0xfc2f('0x1c')](_0x570896)){return _0x320a49;}else{throw new db[(_0xfc2f('0x1d'))][(_0xfc2f('0x1e'))](_0xfc2f('0x1f'));}}else{return _0x320a49;}}function respondWithRpcPromise(_0x4b3b90,_0xc02778,_0x1f013c,_0x25e4df){return new BPromise(function(_0x429151,_0x6e76b8){var _0x4fe58e=_0x25e4df||client;return _0x4fe58e[_0xfc2f('0x20')](_0x4b3b90,_0x1f013c)[_0xfc2f('0x21')](function(_0x21b020){logger[_0xfc2f('0x22')](_0xfc2f('0x23'),_0xc02778,_0xfc2f('0x24'));logger[_0xfc2f('0x25')](_0xfc2f('0x26'),_0xc02778,_0xfc2f('0x24'),JSON[_0xfc2f('0x27')](_0x21b020));if(_0x21b020['error']){if(_0x21b020['error'][_0xfc2f('0x28')]===0x1f4){logger['error'](_0xfc2f('0x23'),_0xc02778,_0x21b020[_0xfc2f('0x29')][_0xfc2f('0x2a')]);return _0x6e76b8(_0x21b020[_0xfc2f('0x29')][_0xfc2f('0x2a')]);}logger[_0xfc2f('0x29')](_0xfc2f('0x23'),_0xc02778,_0x21b020[_0xfc2f('0x29')][_0xfc2f('0x2a')]);return _0x429151(_0x21b020[_0xfc2f('0x29')][_0xfc2f('0x2a')]);}else{logger['info'](_0xfc2f('0x23'),_0xc02778,_0xfc2f('0x24'));_0x429151(_0x21b020[_0xfc2f('0x2b')]['message']);}})[_0xfc2f('0x2c')](function(_0x442a1d){logger['error'](_0xfc2f('0x23'),_0xc02778,_0x442a1d);_0x6e76b8(_0x442a1d);});});}function respondWithStatusCode(_0x56d6c3,_0x46175b){_0x46175b=_0x46175b||0xcc;return function(_0x311e6a){if(_0x311e6a){return _0x56d6c3[_0xfc2f('0x2d')](_0x46175b);}return _0x56d6c3[_0xfc2f('0x2e')](_0x46175b)['end']();};}function respondWithResult(_0x5c505f,_0x131f96){_0x131f96=_0x131f96||0xc8;return function(_0x3c247f){if(_0x3c247f){return _0x5c505f[_0xfc2f('0x2e')](_0x131f96)[_0xfc2f('0x2f')](_0x3c247f);}};}function respondWithFilteredResult(_0x582c4b,_0x24f2b9){return function(_0x3514b1){if(_0x3514b1){var _0x148694=_0x3514b1[_0xfc2f('0x30')],_0x4ee2b9=_0x24f2b9[_0xfc2f('0x31')],_0x2b55a2=_0x24f2b9[_0xfc2f('0x31')]+_0x24f2b9[_0xfc2f('0x32')],_0x57bdb3;if(_0x2b55a2>=_0x148694){_0x2b55a2=_0x148694;_0x57bdb3=0xc8;}else{_0x57bdb3=0xce;}_0x582c4b[_0xfc2f('0x2e')](_0x57bdb3);return _0x582c4b[_0xfc2f('0x33')](_0xfc2f('0x34'),_0x4ee2b9+'-'+_0x2b55a2+'/'+_0x148694)[_0xfc2f('0x2f')](_0x3514b1);}return null;};}function patchUpdates(_0x1b6680){return function(_0x2b2513){try{jsonpatch[_0xfc2f('0x35')](_0x2b2513,_0x1b6680,!![]);}catch(_0x6ea808){return BPromise[_0xfc2f('0x36')](_0x6ea808);}return _0x2b2513['save']();};}function saveUpdates(_0xe02ca6,_0x3d8b69){return function(_0x1534c5){if(_0x1534c5){return _0x1534c5[_0xfc2f('0x37')](_0xe02ca6)[_0xfc2f('0x21')](function(_0x5d5274){return _0x5d5274;});}return null;};}function removeEntity(_0x494e0c,_0x11b50c){return function(_0x1ffe6c){if(_0x1ffe6c){return _0x1ffe6c['destroy']()[_0xfc2f('0x21')](function(){_0x494e0c[_0xfc2f('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230e24,_0x549c90){return function(_0x288caa){if(!_0x288caa){_0x230e24[_0xfc2f('0x2d')](0x194);}return _0x288caa;};}function handleError(_0x2be196,_0x2f49d2){_0x2f49d2=_0x2f49d2||0x1f4;return function(_0x48a67c){logger[_0xfc2f('0x29')](_0x48a67c[_0xfc2f('0x38')]);if(_0x48a67c[_0xfc2f('0x39')]){delete _0x48a67c[_0xfc2f('0x39')];}_0x2be196[_0xfc2f('0x2e')](_0x2f49d2)[_0xfc2f('0x3a')](_0x48a67c);};}exports[_0xfc2f('0x3b')]=function(_0x19178e,_0x6e04fa){var _0xf83c22={},_0x214df6={},_0x43197c={'count':0x0,'rows':[]};var _0xa195eb=_[_0xfc2f('0x3c')](db['ZohoAccount'][_0xfc2f('0x3d')],function(_0x2af548){return{'name':_0x2af548[_0xfc2f('0x3e')],'type':_0x2af548[_0xfc2f('0x3f')][_0xfc2f('0x40')]};});_0x214df6[_0xfc2f('0x41')]=_[_0xfc2f('0x3c')](_0xa195eb,'name');_0x214df6[_0xfc2f('0x42')]=_[_0xfc2f('0x43')](_0x19178e[_0xfc2f('0x42')]);_0x214df6[_0xfc2f('0x44')]=_['intersection'](_0x214df6[_0xfc2f('0x41')],_0x214df6[_0xfc2f('0x42')]);_0xf83c22[_0xfc2f('0x45')]=_[_0xfc2f('0x46')](_0x214df6[_0xfc2f('0x41')],qs[_0xfc2f('0x47')](_0x19178e[_0xfc2f('0x42')][_0xfc2f('0x47')]));_0xf83c22['attributes']=_0xf83c22[_0xfc2f('0x45')][_0xfc2f('0x48')]?_0xf83c22[_0xfc2f('0x45')]:_0x214df6[_0xfc2f('0x41')];if(!_0x19178e['query'][_0xfc2f('0x49')](_0xfc2f('0x4a'))){_0xf83c22[_0xfc2f('0x32')]=qs[_0xfc2f('0x32')](_0x19178e[_0xfc2f('0x42')][_0xfc2f('0x32')]);_0xf83c22[_0xfc2f('0x31')]=qs[_0xfc2f('0x31')](_0x19178e[_0xfc2f('0x42')][_0xfc2f('0x31')]);}_0xf83c22[_0xfc2f('0x4b')]=qs[_0xfc2f('0x4c')](_0x19178e[_0xfc2f('0x42')][_0xfc2f('0x4c')]);_0xf83c22[_0xfc2f('0x4d')]=qs[_0xfc2f('0x44')](_[_0xfc2f('0x4e')](_0x19178e[_0xfc2f('0x42')],_0x214df6[_0xfc2f('0x44')]),_0xa195eb);if(_0x19178e[_0xfc2f('0x42')]['filter']){_0xf83c22[_0xfc2f('0x4d')]=_[_0xfc2f('0x4f')](_0xf83c22[_0xfc2f('0x4d')],{'$or':_[_0xfc2f('0x3c')](_0xa195eb,function(_0x36ff86){if(_0x36ff86['type']!==_0xfc2f('0x50')){var _0x5c298f={};_0x5c298f[_0x36ff86[_0xfc2f('0x39')]]={'$like':'%'+_0x19178e['query'][_0xfc2f('0x51')]+'%'};return _0x5c298f;}})});}_0xf83c22=_[_0xfc2f('0x4f')]({},_0xf83c22,_0x19178e[_0xfc2f('0x52')]);var _0x4a93e1={'where':_0xf83c22['where']};return db[_0xfc2f('0x53')][_0xfc2f('0x30')](_0x4a93e1)[_0xfc2f('0x21')](function(_0x3dc149){_0x43197c['count']=_0x3dc149;if(_0x19178e[_0xfc2f('0x42')][_0xfc2f('0x54')]){_0xf83c22['include']=[{'all':!![]}];}return db[_0xfc2f('0x53')][_0xfc2f('0x55')](_0xf83c22);})[_0xfc2f('0x21')](function(_0x2f56f7){_0x43197c[_0xfc2f('0x56')]=_0x2f56f7;return _0x43197c;})[_0xfc2f('0x21')](respondWithFilteredResult(_0x6e04fa,_0xf83c22))[_0xfc2f('0x2c')](handleError(_0x6e04fa,null));};exports[_0xfc2f('0x57')]=function(_0x390107,_0x292782){var _0x317e97={'raw':![],'where':{'id':_0x390107[_0xfc2f('0x58')]['id']}},_0x37f005={};_0x37f005['model']=_[_0xfc2f('0x43')](db['ZohoAccount'][_0xfc2f('0x3d')]);_0x37f005[_0xfc2f('0x42')]=_['keys'](_0x390107[_0xfc2f('0x42')]);_0x37f005[_0xfc2f('0x44')]=_[_0xfc2f('0x46')](_0x37f005[_0xfc2f('0x41')],_0x37f005['query']);_0x317e97[_0xfc2f('0x45')]=_[_0xfc2f('0x46')](_0x37f005['model'],qs[_0xfc2f('0x47')](_0x390107['query']['fields']));_0x317e97[_0xfc2f('0x45')]=_0x317e97[_0xfc2f('0x45')][_0xfc2f('0x48')]?_0x317e97[_0xfc2f('0x45')]:_0x37f005[_0xfc2f('0x41')];if(_0x390107[_0xfc2f('0x42')][_0xfc2f('0x54')]){_0x317e97[_0xfc2f('0x59')]=[{'all':!![]}];}_0x317e97=_['merge']({},_0x317e97,_0x390107['options']);return db[_0xfc2f('0x53')][_0xfc2f('0x5a')](_0x317e97)[_0xfc2f('0x21')](handleEntityNotFound(_0x292782,null))[_0xfc2f('0x21')](respondWithResult(_0x292782,null))['catch'](handleError(_0x292782,null));};exports[_0xfc2f('0x5b')]=function(_0x1c1b4b,_0x493bf3){return db[_0xfc2f('0x53')][_0xfc2f('0x5b')](_0x1c1b4b[_0xfc2f('0x5c')],{})[_0xfc2f('0x21')](respondWithResult(_0x493bf3,0xc9))[_0xfc2f('0x2c')](handleError(_0x493bf3,null));};exports[_0xfc2f('0x37')]=function(_0x34f990,_0xe70e13){if(_0x34f990[_0xfc2f('0x5c')]['id']){delete _0x34f990['body']['id'];}return db[_0xfc2f('0x53')]['find']({'where':{'id':_0x34f990[_0xfc2f('0x58')]['id']}})[_0xfc2f('0x21')](handleEntityNotFound(_0xe70e13,null))['then'](saveUpdates(_0x34f990[_0xfc2f('0x5c')],null))['then'](respondWithResult(_0xe70e13,null))[_0xfc2f('0x2c')](handleError(_0xe70e13,null));};exports['destroy']=function(_0x2d4d94,_0x15bcd9){return db[_0xfc2f('0x53')][_0xfc2f('0x5a')]({'where':{'id':_0x2d4d94[_0xfc2f('0x58')]['id']}})[_0xfc2f('0x21')](handleEntityNotFound(_0x15bcd9,null))[_0xfc2f('0x21')](removeEntity(_0x15bcd9,null))[_0xfc2f('0x2c')](handleError(_0x15bcd9,null));};exports[_0xfc2f('0x5d')]=function(_0x86aac0,_0x5707a9,_0x40e5b6){var _0x26bed6={};var _0x118ecc={};var _0x3b85d5;var _0x468c03;return db[_0xfc2f('0x53')]['findOne']({'where':{'id':_0x86aac0['params']['id']}})[_0xfc2f('0x21')](handleEntityNotFound(_0x5707a9,null))[_0xfc2f('0x21')](function(_0xecc747){if(_0xecc747){_0x3b85d5=_0xecc747;_0x118ecc[_0xfc2f('0x41')]=_[_0xfc2f('0x43')](db[_0xfc2f('0x5e')][_0xfc2f('0x3d')]);_0x118ecc[_0xfc2f('0x42')]=_[_0xfc2f('0x43')](_0x86aac0['query']);_0x118ecc[_0xfc2f('0x44')]=_[_0xfc2f('0x46')](_0x118ecc['model'],_0x118ecc[_0xfc2f('0x42')]);_0x26bed6['attributes']=_[_0xfc2f('0x46')](_0x118ecc[_0xfc2f('0x41')],qs[_0xfc2f('0x47')](_0x86aac0[_0xfc2f('0x42')][_0xfc2f('0x47')]));_0x26bed6[_0xfc2f('0x45')]=_0x26bed6[_0xfc2f('0x45')]['length']?_0x26bed6[_0xfc2f('0x45')]:_0x118ecc[_0xfc2f('0x41')];_0x26bed6[_0xfc2f('0x4b')]=qs[_0xfc2f('0x4c')](_0x86aac0[_0xfc2f('0x42')][_0xfc2f('0x4c')]);_0x26bed6[_0xfc2f('0x4d')]=qs[_0xfc2f('0x44')](_[_0xfc2f('0x4e')](_0x86aac0[_0xfc2f('0x42')],_0x118ecc[_0xfc2f('0x44')]));if(_0x86aac0[_0xfc2f('0x42')][_0xfc2f('0x51')]){_0x26bed6[_0xfc2f('0x4d')]=_[_0xfc2f('0x4f')](_0x26bed6[_0xfc2f('0x4d')],{'$or':_['map'](_0x26bed6['attributes'],function(_0x43cd9){var _0x549820={};_0x549820[_0x43cd9]={'$like':'%'+_0x86aac0['query'][_0xfc2f('0x51')]+'%'};return _0x549820;})});}_0x26bed6=_[_0xfc2f('0x4f')]({},_0x26bed6,_0x86aac0[_0xfc2f('0x52')]);return _0x3b85d5['getConfigurations'](_0x26bed6);}})[_0xfc2f('0x21')](function(_0x3e5a4a){if(_0x3e5a4a){_0x468c03=_0x3e5a4a[_0xfc2f('0x48')];if(!_0x86aac0[_0xfc2f('0x42')][_0xfc2f('0x49')](_0xfc2f('0x4a'))){_0x26bed6['limit']=qs['limit'](_0x86aac0['query'][_0xfc2f('0x32')]);_0x26bed6[_0xfc2f('0x31')]=qs['offset'](_0x86aac0[_0xfc2f('0x42')]['offset']);}return _0x3b85d5[_0xfc2f('0x5d')](_0x26bed6);}})[_0xfc2f('0x21')](function(_0x327481){if(_0x327481){return _0x327481?{'count':_0x468c03,'rows':_0x327481}:null;}})[_0xfc2f('0x21')](respondWithResult(_0x5707a9,null))[_0xfc2f('0x2c')](handleError(_0x5707a9,null));};exports[_0xfc2f('0x5f')]=function(_0xbf6e23,_0x586ee1,_0x4edfd6){if(_0xbf6e23[_0xfc2f('0x5c')]['id']){delete _0xbf6e23[_0xfc2f('0x5c')]['id'];}return db[_0xfc2f('0x53')][_0xfc2f('0x60')]({'where':{'id':_0xbf6e23['params']['id']}})[_0xfc2f('0x21')](handleEntityNotFound(_0x586ee1,null))[_0xfc2f('0x21')](function(_0x484cc8){if(_0x484cc8){_0xbf6e23[_0xfc2f('0x5c')][_0xfc2f('0x61')]=_0x484cc8['id'];_0xbf6e23[_0xfc2f('0x5c')][_0xfc2f('0x62')]=integrations['getSubjects'](_0xbf6e23[_0xfc2f('0x5c')]['channel'],_0xbf6e23[_0xfc2f('0x5c')]['type']);_0xbf6e23[_0xfc2f('0x5c')]['Descriptions']=integrations['getDescriptions'](_0xbf6e23[_0xfc2f('0x5c')][_0xfc2f('0x63')],_0xbf6e23[_0xfc2f('0x5c')]['type']);return db[_0xfc2f('0x5e')][_0xfc2f('0x5b')](_0xbf6e23['body'],{'include':[{'model':db['ZohoField'],'as':_0xfc2f('0x62')},{'model':db[_0xfc2f('0x64')],'as':_0xfc2f('0x65')}]});}return null;})[_0xfc2f('0x21')](respondWithResult(_0x586ee1,null))[_0xfc2f('0x2c')](handleError(_0x586ee1,null));};function getAccessToken(_0xce99c5){return new Promise(function(_0x3d8177,_0x3edc3d){var _0x3d32af;switch(_0xce99c5[_0xfc2f('0x66')]){case'US':_0x3d32af=_0xfc2f('0x67');break;case'AU':_0x3d32af=_0xfc2f('0x68');break;case'EU':_0x3d32af=_0xfc2f('0x69');break;case'IN':_0x3d32af='https://accounts.zoho.in';break;case'CN':_0x3d32af=_0xfc2f('0x6a');break;default:_0x3d32af=_0xfc2f('0x69');break;}var _0x47978a={'method':_0xfc2f('0x6b'),'uri':_0x3d32af+_0xfc2f('0x6c'),'qs':{'refresh_token':_0xce99c5[_0xfc2f('0x6d')],'client_id':_0xce99c5['clientId'],'client_secret':_0xce99c5[_0xfc2f('0x6e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x47978a)[_0xfc2f('0x21')](function(_0x46906f){if(_0x46906f[_0xfc2f('0x6f')]){_0x3d8177(_0x46906f['access_token']);}else{_0x3edc3d('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0xe586d0){_0x3edc3d(_0xe586d0);});});}exports[_0xfc2f('0x70')]=function(_0x5b2525,_0x1df8c6,_0x2927ef){var _0x11413b,_0x273ec1,_0x2d4847,_0x22a6ab,_0x4d09ac;return db[_0xfc2f('0x53')][_0xfc2f('0x60')]({'where':{'id':_0x5b2525['params']['id']},'attributes':['id',_0xfc2f('0x71'),_0xfc2f('0x66'),_0xfc2f('0x72'),_0xfc2f('0x6e'),_0xfc2f('0x73'),_0xfc2f('0x28'),_0xfc2f('0x6d')]})[_0xfc2f('0x21')](handleEntityNotFound(_0x1df8c6,null))[_0xfc2f('0x21')](function(_0x23e13f){_0x4d09ac=_0x23e13f;_0x11413b=_0x4d09ac[_0xfc2f('0x71')];_0x273ec1=_0x11413b===_0xfc2f('0x74')?'eu':_0xfc2f('0x75');_0x2d4847=_0x4d09ac[_0xfc2f('0x73')];var _0x366cbf=_0x2d4847[_0xfc2f('0x76')](-0x1);if(_0x366cbf==='/'||_0x366cbf==='\x5c'||_0x366cbf===':'){_0x2d4847=_0x2d4847[_0xfc2f('0x77')](0x0,_0x2d4847[_0xfc2f('0x78')](_0x366cbf));}if(!_0x4d09ac['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4d09ac);})['then'](function(_0x297297){if(_0x297297){return rp({'method':_0xfc2f('0x79'),'uri':util['format'](_0xfc2f('0x7a'),_0x273ec1),'qs':{'module':_0xfc2f('0x7b')},'headers':{'Authorization':_0xfc2f('0x7c')+_0x297297},'json':!![]});}})[_0xfc2f('0x21')](function(_0x37646f){if(_0x37646f){if(_0x37646f['response']&&_0x37646f[_0xfc2f('0x7d')][_0xfc2f('0x29')]){throw new Error(_0x37646f['response'][_0xfc2f('0x29')][_0xfc2f('0x2a')]);}var _0xee855=[];var _0x79c362=[];var _0xdb5e02=['Owner',_0xfc2f('0x7e'),_0xfc2f('0x7f'),_0xfc2f('0x80'),_0xfc2f('0x81'),_0xfc2f('0x82'),_0xfc2f('0x83'),_0xfc2f('0x84')];_0x79c362=_[_0xfc2f('0x85')](_0x37646f[_0xfc2f('0x47')],function(_0xa0a30f){return _0xdb5e02[_0xfc2f('0x86')](_0xa0a30f[_0xfc2f('0x87')]);});for(var _0x56ae49=0x0;_0x56ae49<_0x79c362[_0xfc2f('0x48')];_0x56ae49++){if(_0x79c362[_0x56ae49][_0xfc2f('0x88')]===![]){_0xee855[_0xfc2f('0x89')]({'id':_0x79c362[_0x56ae49]['id'],'name':_0x79c362[_0x56ae49]['display_label'],'custom':_0x79c362[_0x56ae49][_0xfc2f('0x8a')],'options':_0x79c362[_0x56ae49][_0xfc2f('0x8b')]==='picklist'&&_0x79c362[_0x56ae49][_0xfc2f('0x8c')]['length']>-0x1?_[_0xfc2f('0x3c')](_0x79c362[_0x56ae49][_0xfc2f('0x8c')],function(_0x50cc73){return{'name':_0x50cc73,'value':_0x50cc73};}):[]});}}return{'count':_0xee855[_0xfc2f('0x48')],'rows':_0xee855};}else{return{'count':0x0,'rows':[]};}})[_0xfc2f('0x21')](respondWithResult(_0x1df8c6,null))['catch'](function(_0x137f0f){var _0x41707e=_0x5b2525['query'][_0xfc2f('0x1c')]?0x1f4:_0x137f0f[_0xfc2f('0x8d')]||0x1f4;logger[_0xfc2f('0x29')](_0xfc2f('0x8e'),_0xfc2f('0x70'),_0x41707e,JSON[_0xfc2f('0x27')](_0x137f0f));delete _0x137f0f[_0xfc2f('0x39')];if(_0x41707e===0x191){_0x41707e=0x190;}_0x1df8c6[_0xfc2f('0x2e')](_0x41707e)[_0xfc2f('0x3a')](_0x5b2525['query'][_0xfc2f('0x1c')]?{'message':_0xfc2f('0x8f'),'statusCode':_0x137f0f[_0xfc2f('0x8d')]}:_0x137f0f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b9795b8..98ace99 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 _0x59c4=['inspect','catch','substring','https://accounts.zoho.eu','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','moment','bluebird','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x59c4,0xb1));var _0x459c=function(_0x5d458d,_0x9d4f0a){_0x5d458d=_0x5d458d-0x0;var _0x17f4aa=_0x59c4[_0x5d458d];return _0x17f4aa;};'use strict';var _=require(_0x459c('0x0'));var util=require(_0x459c('0x1'));var logger=require(_0x459c('0x2'))('api');var moment=require(_0x459c('0x3'));var BPromise=require(_0x459c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x459c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x459c('0x6'));var integrations=require(_0x459c('0x7'));module[_0x459c('0x8')]=function(_0x97ee9a,_0x324980){return _0x97ee9a[_0x459c('0x9')](_0x459c('0xa'),attributes,{'tableName':_0x459c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x160cff,_0x243f94,_0xb76e5e){if(_0x160cff[_0x459c('0xc')](_0x459c('0xd'))||_0x160cff['changed'](_0x459c('0xe'))||_0x160cff[_0x459c('0xc')](_0x459c('0xf'))||_0x160cff[_0x459c('0xc')](_0x459c('0x10'))||_0x160cff['changed']('code')||_0x160cff[_0x459c('0xc')](_0x459c('0x11'))){var _0x25d9f1,_0x14c69f;_0x25d9f1=_0x160cff[_0x459c('0xe')];var _0x555ab2=_0x25d9f1[_0x459c('0x12')](-0x1);if(_0x555ab2==='/'||_0x555ab2==='\x5c'||_0x555ab2===':'){_0x25d9f1=_0x25d9f1['substring'](0x0,_0x25d9f1[_0x459c('0x13')](_0x555ab2));}switch(_0x160cff[_0x459c('0xd')]){case'US':_0x14c69f=_0x459c('0x14');break;case'AU':_0x14c69f=_0x459c('0x15');break;case'IN':_0x14c69f=_0x459c('0x16');break;case'CN':_0x14c69f=_0x459c('0x17');break;default:_0x14c69f='https://accounts.zoho.eu';break;}var _0x29485e={'method':_0x459c('0x18'),'uri':_0x14c69f+_0x459c('0x19'),'form':{'grant_type':_0x459c('0x1a'),'client_id':_0x160cff[_0x459c('0xf')],'client_secret':_0x160cff[_0x459c('0x10')],'redirect_uri':_0x160cff[_0x459c('0xe')],'code':_0x160cff[_0x459c('0x1b')]},'headers':{'Content-Type':_0x459c('0x1c')}};return rp(_0x29485e)[_0x459c('0x1d')](function(_0x25ce30){var _0x347b9a=JSON[_0x459c('0x1e')](_0x25ce30);if(_0x347b9a[_0x459c('0x1f')]){_0x160cff[_0x459c('0x20')]=_0x347b9a[_0x459c('0x1f')];logger[_0x459c('0x21')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x160cff[_0x459c('0x22')],_0x160cff['id']));}else{logger[_0x459c('0x23')](util[_0x459c('0x24')](_0x459c('0x25'),_0x160cff[_0x459c('0x22')],_0x160cff['id']),util[_0x459c('0x26')](_0x347b9a,{'showHidden':![],'depth':null}));}return _0xb76e5e(null,_0x243f94);})[_0x459c('0x27')](function(_0x2ef5f1){logger[_0x459c('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x160cff[_0x459c('0x22')],_0x160cff['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xb76e5e(_0x2ef5f1);});}else{return _0xb76e5e(null,_0x243f94);}},'beforeUpdate':function(_0x4cac39,_0x369e90,_0x41406c){if(_0x4cac39[_0x459c('0xc')](_0x459c('0xd'))||_0x4cac39['changed'](_0x459c('0xe'))||_0x4cac39[_0x459c('0xc')](_0x459c('0xf'))||_0x4cac39['changed']('clientSecret')||_0x4cac39['changed'](_0x459c('0x1b'))||_0x4cac39['changed'](_0x459c('0x11'))){var _0x4f4fd8,_0x2dee06;_0x4f4fd8=_0x4cac39[_0x459c('0xe')];var _0x344018=_0x4f4fd8[_0x459c('0x12')](-0x1);if(_0x344018==='/'||_0x344018==='\x5c'||_0x344018===':'){_0x4f4fd8=_0x4f4fd8[_0x459c('0x28')](0x0,_0x4f4fd8[_0x459c('0x13')](_0x344018));}switch(_0x4cac39[_0x459c('0xd')]){case'US':_0x2dee06=_0x459c('0x14');break;case'AU':_0x2dee06=_0x459c('0x15');break;case'IN':_0x2dee06=_0x459c('0x16');break;case'CN':_0x2dee06=_0x459c('0x17');break;default:_0x2dee06=_0x459c('0x29');break;}var _0x599cd2={'method':_0x459c('0x18'),'uri':_0x2dee06+_0x459c('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x4cac39[_0x459c('0xf')],'client_secret':_0x4cac39[_0x459c('0x10')],'redirect_uri':_0x4cac39['serverUrl'],'code':_0x4cac39[_0x459c('0x1b')]},'headers':{'Content-Type':_0x459c('0x1c')}};return rp(_0x599cd2)['then'](function(_0x28f077){var _0x5bbdcd=JSON['parse'](_0x28f077);if(_0x5bbdcd[_0x459c('0x1f')]){_0x4cac39[_0x459c('0x20')]=_0x5bbdcd['refresh_token'];logger[_0x459c('0x21')](util[_0x459c('0x24')](_0x459c('0x2a'),_0x4cac39[_0x459c('0x22')],_0x4cac39['id']));}else{logger[_0x459c('0x23')](util[_0x459c('0x24')](_0x459c('0x25'),_0x4cac39[_0x459c('0x22')],_0x4cac39['id']),util['inspect'](_0x5bbdcd,{'showHidden':![],'depth':null}));}return _0x41406c(null,_0x369e90);})[_0x459c('0x27')](function(_0x3db4c4){logger[_0x459c('0x23')](util[_0x459c('0x24')](_0x459c('0x25'),_0x4cac39['name'],_0x4cac39['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x41406c(_0x3db4c4);});}else{return _0x41406c(null,_0x369e90);}}}});}; \ No newline at end of file +var _0x6169=['parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refreshToken','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientId','serverUrl','application/x-www-form-urlencoded','then'];(function(_0x142bd5,_0x17ba15){var _0x12cd11=function(_0x16a3f6){while(--_0x16a3f6){_0x142bd5['push'](_0x142bd5['shift']());}};_0x12cd11(++_0x17ba15);}(_0x6169,0x8e));var _0x9616=function(_0x2eb547,_0x31dc15){_0x2eb547=_0x2eb547-0x0;var _0x195dd5=_0x6169[_0x2eb547];return _0x195dd5;};'use strict';var _=require(_0x9616('0x0'));var util=require('util');var logger=require(_0x9616('0x1'))('api');var moment=require(_0x9616('0x2'));var BPromise=require(_0x9616('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9616('0x4'));var rimraf=require(_0x9616('0x5'));var config=require(_0x9616('0x6'));var attributes=require(_0x9616('0x7'));var integrations=require(_0x9616('0x8'));module[_0x9616('0x9')]=function(_0x104865,_0x377070){return _0x104865[_0x9616('0xa')]('ZohoAccount',attributes,{'tableName':_0x9616('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x178fc6,_0x39c184,_0x48e018){if(_0x178fc6[_0x9616('0xc')](_0x9616('0xd'))||_0x178fc6[_0x9616('0xc')]('serverUrl')||_0x178fc6[_0x9616('0xc')]('clientId')||_0x178fc6[_0x9616('0xc')](_0x9616('0xe'))||_0x178fc6[_0x9616('0xc')](_0x9616('0xf'))||_0x178fc6['changed'](_0x9616('0x10'))){var _0x2fc01e,_0x58ada7;_0x2fc01e=_0x178fc6['serverUrl'];var _0x4fb084=_0x2fc01e[_0x9616('0x11')](-0x1);if(_0x4fb084==='/'||_0x4fb084==='\x5c'||_0x4fb084===':'){_0x2fc01e=_0x2fc01e[_0x9616('0x12')](0x0,_0x2fc01e[_0x9616('0x13')](_0x4fb084));}switch(_0x178fc6[_0x9616('0xd')]){case'US':_0x58ada7=_0x9616('0x14');break;case'AU':_0x58ada7=_0x9616('0x15');break;case'IN':_0x58ada7=_0x9616('0x16');break;case'CN':_0x58ada7='https://accounts.zoho.com.cn';break;default:_0x58ada7='https://accounts.zoho.eu';break;}var _0x591bff={'method':_0x9616('0x17'),'uri':_0x58ada7+_0x9616('0x18'),'form':{'grant_type':_0x9616('0x19'),'client_id':_0x178fc6[_0x9616('0x1a')],'client_secret':_0x178fc6[_0x9616('0xe')],'redirect_uri':_0x178fc6[_0x9616('0x1b')],'code':_0x178fc6['code']},'headers':{'Content-Type':_0x9616('0x1c')}};return rp(_0x591bff)[_0x9616('0x1d')](function(_0x476aab){var _0x122060=JSON[_0x9616('0x1e')](_0x476aab);if(_0x122060[_0x9616('0x1f')]){_0x178fc6['refreshToken']=_0x122060[_0x9616('0x1f')];logger[_0x9616('0x20')](util[_0x9616('0x21')](_0x9616('0x22'),_0x178fc6[_0x9616('0x23')],_0x178fc6['id']));}else{logger[_0x9616('0x24')](util[_0x9616('0x21')](_0x9616('0x25'),_0x178fc6[_0x9616('0x23')],_0x178fc6['id']),util[_0x9616('0x26')](_0x122060,{'showHidden':![],'depth':null}));}return _0x48e018(null,_0x39c184);})[_0x9616('0x27')](function(_0x4f56b8){logger[_0x9616('0x24')](util[_0x9616('0x21')](_0x9616('0x25'),_0x178fc6['name'],_0x178fc6['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x48e018(_0x4f56b8);});}else{return _0x48e018(null,_0x39c184);}},'beforeUpdate':function(_0x58b687,_0x2deafd,_0x8b05c6){if(_0x58b687[_0x9616('0xc')](_0x9616('0xd'))||_0x58b687[_0x9616('0xc')](_0x9616('0x1b'))||_0x58b687[_0x9616('0xc')](_0x9616('0x1a'))||_0x58b687['changed'](_0x9616('0xe'))||_0x58b687['changed'](_0x9616('0xf'))||_0x58b687[_0x9616('0xc')](_0x9616('0x10'))){var _0x4955da,_0x354427;_0x4955da=_0x58b687[_0x9616('0x1b')];var _0x1260e7=_0x4955da[_0x9616('0x11')](-0x1);if(_0x1260e7==='/'||_0x1260e7==='\x5c'||_0x1260e7===':'){_0x4955da=_0x4955da[_0x9616('0x12')](0x0,_0x4955da[_0x9616('0x13')](_0x1260e7));}switch(_0x58b687['zone']){case'US':_0x354427=_0x9616('0x14');break;case'AU':_0x354427=_0x9616('0x15');break;case'IN':_0x354427=_0x9616('0x16');break;case'CN':_0x354427=_0x9616('0x28');break;default:_0x354427=_0x9616('0x29');break;}var _0x37f568={'method':_0x9616('0x17'),'uri':_0x354427+_0x9616('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x58b687['clientId'],'client_secret':_0x58b687['clientSecret'],'redirect_uri':_0x58b687[_0x9616('0x1b')],'code':_0x58b687[_0x9616('0xf')]},'headers':{'Content-Type':_0x9616('0x1c')}};return rp(_0x37f568)['then'](function(_0x5e0198){var _0x175d14=JSON[_0x9616('0x1e')](_0x5e0198);if(_0x175d14[_0x9616('0x1f')]){_0x58b687[_0x9616('0x2a')]=_0x175d14[_0x9616('0x1f')];logger[_0x9616('0x20')](util[_0x9616('0x21')](_0x9616('0x22'),_0x58b687[_0x9616('0x23')],_0x58b687['id']));}else{logger['error'](util[_0x9616('0x21')](_0x9616('0x25'),_0x58b687[_0x9616('0x23')],_0x58b687['id']),util[_0x9616('0x26')](_0x175d14,{'showHidden':![],'depth':null}));}return _0x8b05c6(null,_0x2deafd);})[_0x9616('0x27')](function(_0x45f147){logger[_0x9616('0x24')](util[_0x9616('0x21')](_0x9616('0x25'),_0x58b687[_0x9616('0x23')],_0x58b687['id']),util[_0x9616('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x8b05c6(_0x45f147);});}else{return _0x8b05c6(null,_0x2deafd);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1e1c164..b9756da 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 _0x6df4=['lodash','moment','bluebird','../../config/utils','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZohoAccount,\x20%s,\x20%s','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6df4,0x78));var _0x46df=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6df4[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x46df('0x0'));var util=require('util');var moment=require(_0x46df('0x1'));var BPromise=require(_0x46df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x46df('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x46df('0x4'));var client=jayson['client'][_0x46df('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x402f5a,_0x4ce37c,_0x1fe76f){return new BPromise(function(_0x5e14fb,_0x35ba3b){return client[_0x46df('0x6')](_0x402f5a,_0x1fe76f)[_0x46df('0x7')](function(_0x5b5052){logger[_0x46df('0x8')]('ZohoAccount,\x20%s,\x20%s',_0x4ce37c,_0x46df('0x9'));logger[_0x46df('0xa')](_0x46df('0xb'),_0x4ce37c,_0x46df('0x9'),JSON['stringify'](_0x5b5052));if(_0x5b5052[_0x46df('0xc')]){if(_0x5b5052[_0x46df('0xc')][_0x46df('0xd')]===0x1f4){logger[_0x46df('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x4ce37c,_0x5b5052['error'][_0x46df('0xe')]);return _0x35ba3b(_0x5b5052[_0x46df('0xc')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4ce37c,_0x5b5052['error'][_0x46df('0xe')]);return _0x5e14fb(_0x5b5052[_0x46df('0xc')][_0x46df('0xe')]);}else{logger[_0x46df('0x8')](_0x46df('0xf'),_0x4ce37c,'request\x20sent');_0x5e14fb(_0x5b5052['result'][_0x46df('0xe')]);}})['catch'](function(_0x205c4d){logger[_0x46df('0xc')](_0x46df('0xf'),_0x4ce37c,_0x205c4d);_0x35ba3b(_0x205c4d);});});}exports[_0x46df('0x10')]=function(_0x5bd894){var _0x370f43=this;return new Promise(function(_0x54f709,_0x94b8b9){return db[_0x46df('0x11')][_0x46df('0x12')]({'raw':_0x5bd894['options']?_0x5bd894[_0x46df('0x13')][_0x46df('0x14')]===undefined?!![]:![]:!![],'where':_0x5bd894['options']?_0x5bd894[_0x46df('0x13')][_0x46df('0x15')]||null:null,'attributes':_0x5bd894[_0x46df('0x13')]?_0x5bd894[_0x46df('0x13')][_0x46df('0x16')]||null:null,'limit':_0x5bd894[_0x46df('0x13')]?_0x5bd894['options'][_0x46df('0x17')]||null:null,'include':_0x5bd894[_0x46df('0x13')]?_0x5bd894['options'][_0x46df('0x18')]?_[_0x46df('0x19')](_0x5bd894['options']['include'],function(_0x35e865){return{'model':db[_0x35e865[_0x46df('0x1a')]],'as':_0x35e865['as'],'attributes':_0x35e865[_0x46df('0x16')],'include':_0x35e865[_0x46df('0x18')]?_[_0x46df('0x19')](_0x35e865[_0x46df('0x18')],function(_0x56eedf){return{'model':db[_0x56eedf[_0x46df('0x1a')]],'as':_0x56eedf['as'],'attributes':_0x56eedf[_0x46df('0x16')],'include':_0x56eedf[_0x46df('0x18')]?_[_0x46df('0x19')](_0x56eedf['include'],function(_0x51320f){return{'model':db[_0x51320f[_0x46df('0x1a')]],'as':_0x51320f['as'],'attributes':_0x51320f[_0x46df('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x502656){logger['info'](_0x46df('0x10'),_0x5bd894);logger[_0x46df('0xa')]('GetZohoAccount',_0x5bd894,JSON[_0x46df('0x1b')](_0x502656));_0x54f709(_0x502656);})['catch'](function(_0x1af759){logger['error'](_0x46df('0x10'),_0x1af759['message'],_0x5bd894);_0x94b8b9(_0x370f43['error'](0x1f4,_0x1af759[_0x46df('0xe')]));});});};exports['ShowZohoAccount']=function(_0x55fa3f){var _0x70b16a=this;return new Promise(function(_0x2185a3,_0x131d15){return db[_0x46df('0x11')]['find']({'raw':_0x55fa3f[_0x46df('0x13')]?_0x55fa3f['options'][_0x46df('0x14')]===undefined?!![]:![]:!![],'where':_0x55fa3f[_0x46df('0x13')]?_0x55fa3f['options'][_0x46df('0x15')]||null:null,'attributes':_0x55fa3f[_0x46df('0x13')]?_0x55fa3f['options'][_0x46df('0x16')]||null:null,'include':_0x55fa3f[_0x46df('0x13')]?_0x55fa3f[_0x46df('0x13')]['include']?_[_0x46df('0x19')](_0x55fa3f[_0x46df('0x13')]['include'],function(_0x323d9d){return{'model':db[_0x323d9d[_0x46df('0x1a')]],'as':_0x323d9d['as'],'attributes':_0x323d9d[_0x46df('0x16')],'include':_0x323d9d[_0x46df('0x18')]?_['map'](_0x323d9d[_0x46df('0x18')],function(_0x153c23){return{'model':db[_0x153c23[_0x46df('0x1a')]],'as':_0x153c23['as'],'attributes':_0x153c23['attributes'],'include':_0x153c23[_0x46df('0x18')]?_[_0x46df('0x19')](_0x153c23[_0x46df('0x18')],function(_0x2ac726){return{'model':db[_0x2ac726[_0x46df('0x1a')]],'as':_0x2ac726['as'],'attributes':_0x2ac726['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c4ad6){logger['info'](_0x46df('0x1c'),_0x55fa3f);logger[_0x46df('0xa')](_0x46df('0x1c'),_0x55fa3f,JSON['stringify'](_0x5c4ad6));_0x2185a3(_0x5c4ad6);})[_0x46df('0x1d')](function(_0x197d20){logger['error'](_0x46df('0x1c'),_0x197d20[_0x46df('0xe')],_0x55fa3f);_0x131d15(_0x70b16a['error'](0x1f4,_0x197d20[_0x46df('0xe')]));});});}; \ No newline at end of file +var _0xc344=['code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowZohoAccount','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x139041,_0x34bbae){var _0x53e455=function(_0x243756){while(--_0x243756){_0x139041['push'](_0x139041['shift']());}};_0x53e455(++_0x34bbae);}(_0xc344,0x1bd));var _0x4c34=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc344[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x4c34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4c34('0x1'));var rs=require(_0x4c34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c34('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c34('0x4'))(_0x4c34('0x5'));var config=require('../../config/environment');var jayson=require(_0x4c34('0x6'));var client=jayson['client'][_0x4c34('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x296c8a,_0x47cea2,_0x4defa1){return new BPromise(function(_0xb29ba7,_0x33c523){return client[_0x4c34('0x8')](_0x296c8a,_0x4defa1)[_0x4c34('0x9')](function(_0x4cd9bd){logger[_0x4c34('0xa')](_0x4c34('0xb'),_0x47cea2,_0x4c34('0xc'));logger[_0x4c34('0xd')](_0x4c34('0xe'),_0x47cea2,'request\x20sent',JSON[_0x4c34('0xf')](_0x4cd9bd));if(_0x4cd9bd[_0x4c34('0x10')]){if(_0x4cd9bd[_0x4c34('0x10')][_0x4c34('0x11')]===0x1f4){logger[_0x4c34('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x47cea2,_0x4cd9bd[_0x4c34('0x10')]['message']);return _0x33c523(_0x4cd9bd[_0x4c34('0x10')][_0x4c34('0x12')]);}logger[_0x4c34('0x10')](_0x4c34('0xb'),_0x47cea2,_0x4cd9bd['error'][_0x4c34('0x12')]);return _0xb29ba7(_0x4cd9bd[_0x4c34('0x10')][_0x4c34('0x12')]);}else{logger[_0x4c34('0xa')](_0x4c34('0xb'),_0x47cea2,'request\x20sent');_0xb29ba7(_0x4cd9bd[_0x4c34('0x13')][_0x4c34('0x12')]);}})[_0x4c34('0x14')](function(_0x2878db){logger[_0x4c34('0x10')](_0x4c34('0xb'),_0x47cea2,_0x2878db);_0x33c523(_0x2878db);});});}exports[_0x4c34('0x15')]=function(_0x1cd1a4){var _0x439344=this;return new Promise(function(_0x298980,_0x8e73bc){return db[_0x4c34('0x16')][_0x4c34('0x17')]({'raw':_0x1cd1a4[_0x4c34('0x18')]?_0x1cd1a4[_0x4c34('0x18')][_0x4c34('0x19')]===undefined?!![]:![]:!![],'where':_0x1cd1a4['options']?_0x1cd1a4[_0x4c34('0x18')][_0x4c34('0x1a')]||null:null,'attributes':_0x1cd1a4[_0x4c34('0x18')]?_0x1cd1a4['options'][_0x4c34('0x1b')]||null:null,'limit':_0x1cd1a4[_0x4c34('0x18')]?_0x1cd1a4[_0x4c34('0x18')]['limit']||null:null,'include':_0x1cd1a4[_0x4c34('0x18')]?_0x1cd1a4[_0x4c34('0x18')][_0x4c34('0x1c')]?_[_0x4c34('0x1d')](_0x1cd1a4[_0x4c34('0x18')][_0x4c34('0x1c')],function(_0x3666ab){return{'model':db[_0x3666ab[_0x4c34('0x1e')]],'as':_0x3666ab['as'],'attributes':_0x3666ab[_0x4c34('0x1b')],'include':_0x3666ab[_0x4c34('0x1c')]?_[_0x4c34('0x1d')](_0x3666ab['include'],function(_0x360389){return{'model':db[_0x360389[_0x4c34('0x1e')]],'as':_0x360389['as'],'attributes':_0x360389[_0x4c34('0x1b')],'include':_0x360389[_0x4c34('0x1c')]?_[_0x4c34('0x1d')](_0x360389[_0x4c34('0x1c')],function(_0x3cdc5c){return{'model':db[_0x3cdc5c[_0x4c34('0x1e')]],'as':_0x3cdc5c['as'],'attributes':_0x3cdc5c[_0x4c34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4c34('0x9')](function(_0x433c3d){logger[_0x4c34('0xa')](_0x4c34('0x15'),_0x1cd1a4);logger[_0x4c34('0xd')](_0x4c34('0x15'),_0x1cd1a4,JSON[_0x4c34('0xf')](_0x433c3d));_0x298980(_0x433c3d);})[_0x4c34('0x14')](function(_0x3e07d4){logger[_0x4c34('0x10')]('GetZohoAccount',_0x3e07d4['message'],_0x1cd1a4);_0x8e73bc(_0x439344[_0x4c34('0x10')](0x1f4,_0x3e07d4[_0x4c34('0x12')]));});});};exports['ShowZohoAccount']=function(_0x2aee86){var _0x5750f4=this;return new Promise(function(_0x248dfa,_0x4ae80a){return db['ZohoAccount'][_0x4c34('0x1f')]({'raw':_0x2aee86['options']?_0x2aee86[_0x4c34('0x18')][_0x4c34('0x19')]===undefined?!![]:![]:!![],'where':_0x2aee86[_0x4c34('0x18')]?_0x2aee86['options'][_0x4c34('0x1a')]||null:null,'attributes':_0x2aee86[_0x4c34('0x18')]?_0x2aee86['options']['attributes']||null:null,'include':_0x2aee86[_0x4c34('0x18')]?_0x2aee86[_0x4c34('0x18')][_0x4c34('0x1c')]?_['map'](_0x2aee86[_0x4c34('0x18')][_0x4c34('0x1c')],function(_0x1ee211){return{'model':db[_0x1ee211[_0x4c34('0x1e')]],'as':_0x1ee211['as'],'attributes':_0x1ee211[_0x4c34('0x1b')],'include':_0x1ee211[_0x4c34('0x1c')]?_[_0x4c34('0x1d')](_0x1ee211[_0x4c34('0x1c')],function(_0x3d6bbb){return{'model':db[_0x3d6bbb[_0x4c34('0x1e')]],'as':_0x3d6bbb['as'],'attributes':_0x3d6bbb[_0x4c34('0x1b')],'include':_0x3d6bbb['include']?_[_0x4c34('0x1d')](_0x3d6bbb[_0x4c34('0x1c')],function(_0x4b3511){return{'model':db[_0x4b3511['model']],'as':_0x4b3511['as'],'attributes':_0x4b3511[_0x4c34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4c34('0x9')](function(_0x198b77){logger[_0x4c34('0xa')](_0x4c34('0x20'),_0x2aee86);logger[_0x4c34('0xd')](_0x4c34('0x20'),_0x2aee86,JSON['stringify'](_0x198b77));_0x248dfa(_0x198b77);})[_0x4c34('0x14')](function(_0x2f7a9a){logger[_0x4c34('0x10')](_0x4c34('0x20'),_0x2f7a9a['message'],_0x2aee86);_0x4ae80a(_0x5750f4['error'](0x1f4,_0x2f7a9a[_0x4c34('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 6874616..8993848 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 _0xbd99=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','exports','multer','util','connect-timeout','express'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbd99,0x1df));var _0x9bd9=function(_0xbe38d0,_0x4794c6){_0xbe38d0=_0xbe38d0-0x0;var _0x27e8f0=_0xbd99[_0xbe38d0];return _0x27e8f0;};'use strict';var multer=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var path=require('path');var timeout=require(_0x9bd9('0x2'));var express=require(_0x9bd9('0x3'));var router=express['Router']();var auth=require(_0x9bd9('0x4'));var interaction=require(_0x9bd9('0x5'));var config=require(_0x9bd9('0x6'));var controller=require(_0x9bd9('0x7'));router[_0x9bd9('0x8')]('/',auth[_0x9bd9('0x9')](),controller[_0x9bd9('0xa')]);router['get'](_0x9bd9('0xb'),auth[_0x9bd9('0x9')](),controller[_0x9bd9('0xc')]);router[_0x9bd9('0x8')](_0x9bd9('0xd'),auth[_0x9bd9('0x9')](),controller['getFields']);router[_0x9bd9('0x8')]('/:id/subjects',auth[_0x9bd9('0x9')](),controller[_0x9bd9('0xe')]);router[_0x9bd9('0x8')](_0x9bd9('0xf'),auth[_0x9bd9('0x9')](),controller[_0x9bd9('0x10')]);router[_0x9bd9('0x11')]('/',auth['isAuthenticated'](),controller[_0x9bd9('0x12')]);router['put']('/:id',auth[_0x9bd9('0x9')](),controller['update']);router[_0x9bd9('0x13')](_0x9bd9('0xb'),auth[_0x9bd9('0x9')](),controller['destroy']);module[_0x9bd9('0x14')]=router; \ No newline at end of file +var _0x1cc3=['Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x1cc3,0x11b));var _0x31cc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1cc3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x31cc('0x0'));var util=require(_0x31cc('0x1'));var path=require('path');var timeout=require(_0x31cc('0x2'));var express=require('express');var router=express[_0x31cc('0x3')]();var auth=require(_0x31cc('0x4'));var interaction=require(_0x31cc('0x5'));var config=require('../../config/environment');var controller=require(_0x31cc('0x6'));router[_0x31cc('0x7')]('/',auth[_0x31cc('0x8')](),controller['index']);router[_0x31cc('0x7')](_0x31cc('0x9'),auth[_0x31cc('0x8')](),controller[_0x31cc('0xa')]);router[_0x31cc('0x7')](_0x31cc('0xb'),auth[_0x31cc('0x8')](),controller[_0x31cc('0xc')]);router[_0x31cc('0x7')]('/:id/subjects',auth[_0x31cc('0x8')](),controller[_0x31cc('0xd')]);router[_0x31cc('0x7')](_0x31cc('0xe'),auth[_0x31cc('0x8')](),controller[_0x31cc('0xf')]);router[_0x31cc('0x10')]('/',auth[_0x31cc('0x8')](),controller[_0x31cc('0x11')]);router[_0x31cc('0x12')]('/:id',auth[_0x31cc('0x8')](),controller[_0x31cc('0x13')]);router['delete'](_0x31cc('0x9'),auth[_0x31cc('0x8')](),controller[_0x31cc('0x14')]);module[_0x31cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 254865b..f821b70 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 _0xaf1a=['sequelize','STRING','ENUM','contact','nothing','lead'];(function(_0xfcbcbb,_0x27ecc1){var _0xbca4d1=function(_0x216f10){while(--_0x216f10){_0xfcbcbb['push'](_0xfcbcbb['shift']());}};_0xbca4d1(++_0x27ecc1);}(_0xaf1a,0x1e6));var _0xaaf1=function(_0x4d02a2,_0x5d177e){_0x4d02a2=_0x4d02a2-0x0;var _0x1047dc=_0xaf1a[_0x4d02a2];return _0x1047dc;};'use strict';var Sequelize=require(_0xaaf1('0x0'));module['exports']={'name':{'type':Sequelize[_0xaaf1('0x1')]},'moduleCreate':{'type':Sequelize[_0xaaf1('0x2')]('lead',_0xaaf1('0x3'),_0xaaf1('0x4')),'defaultValue':_0xaaf1('0x5')},'moduleSearch':{'type':Sequelize[_0xaaf1('0x2')]('contact_lead',_0xaaf1('0x3'),_0xaaf1('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xaaf1('0x1')]}}; \ No newline at end of file +var _0x500b=['sequelize','exports','STRING','ENUM','lead','contact','contact_lead'];(function(_0x3d2fe5,_0x2f9c71){var _0x48de9d=function(_0x229709){while(--_0x229709){_0x3d2fe5['push'](_0x3d2fe5['shift']());}};_0x48de9d(++_0x2f9c71);}(_0x500b,0xd9));var _0xb500=function(_0x4e9182,_0x3b49b1){_0x4e9182=_0x4e9182-0x0;var _0x17aef7=_0x500b[_0x4e9182];return _0x17aef7;};'use strict';var Sequelize=require(_0xb500('0x0'));module[_0xb500('0x1')]={'name':{'type':Sequelize[_0xb500('0x2')]},'moduleCreate':{'type':Sequelize[_0xb500('0x3')](_0xb500('0x4'),_0xb500('0x5'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xb500('0x3')](_0xb500('0x6'),'contact',_0xb500('0x4')),'defaultValue':_0xb500('0x6')},'description':{'type':Sequelize[_0xb500('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dd67b0b..f62bafc 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 _0x5c21=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','ValidationError','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','stack','name','send','index','ZohoConfiguration','fieldName','type','key','query','keys','filters','attributes','model','fields','hasOwnProperty','limit','order','sort','filter','merge','where','VIRTUAL','options','include','rows','show','params','intersection','length','includeAll','find','create','update','body','destroy','findOne','ZohoField','rawAttributes','map','getFields','nolimit','pick','getDescriptions','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4604eb,_0x5821bb){var _0xc45625=function(_0x23492c){while(--_0x23492c){_0x4604eb['push'](_0x4604eb['shift']());}};_0xc45625(++_0x5821bb);}(_0x5c21,0x1cc));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x15c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15c2('0x1'));var zipdir=require(_0x15c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x15c2('0x3'));var BPromise=require(_0x15c2('0x4'));var Mustache=require(_0x15c2('0x5'));var util=require(_0x15c2('0x6'));var path=require(_0x15c2('0x7'));var sox=require(_0x15c2('0x8'));var csv=require(_0x15c2('0x9'));var ejs=require(_0x15c2('0xa'));var fs=require('fs');var _=require(_0x15c2('0xb'));var squel=require(_0x15c2('0xc'));var crypto=require(_0x15c2('0xd'));var jsforce=require(_0x15c2('0xe'));var deskjs=require(_0x15c2('0xf'));var toCsv=require(_0x15c2('0x9'));var querystring=require(_0x15c2('0x10'));var Papa=require(_0x15c2('0x11'));var Redis=require(_0x15c2('0x12'));var authService=require(_0x15c2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x15c2('0x14'));var hardwareService=require(_0x15c2('0x15'));var logger=require('../../config/logger')(_0x15c2('0x16'));var utils=require(_0x15c2('0x17'));var config=require(_0x15c2('0x18'));var db=require(_0x15c2('0x19'))['db'];var jayson=require(_0x15c2('0x1a'));var client=jayson[_0x15c2('0x1b')][_0x15c2('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x140f47,_0x1fced6,_0x16d526){if(_0x16d526){var _0x158eb9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x158eb9['test'](_0x1fced6)){return _0x140f47;}else{throw new db['Sequelize'][(_0x15c2('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x140f47;}}function respondWithRpcPromise(_0x12bf8d,_0x21a699,_0x576aa4,_0x251c5d){return new BPromise(function(_0x2b6165,_0x3061a6){var _0x7613b9=_0x251c5d||client;return _0x7613b9[_0x15c2('0x1e')](_0x12bf8d,_0x576aa4)[_0x15c2('0x1f')](function(_0x20b3a3){logger[_0x15c2('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x21a699,_0x15c2('0x21'));logger[_0x15c2('0x22')](_0x15c2('0x23'),_0x21a699,'request\x20sent',JSON[_0x15c2('0x24')](_0x20b3a3));if(_0x20b3a3['error']){if(_0x20b3a3['error'][_0x15c2('0x25')]===0x1f4){logger[_0x15c2('0x26')](_0x15c2('0x27'),_0x21a699,_0x20b3a3[_0x15c2('0x26')][_0x15c2('0x28')]);return _0x3061a6(_0x20b3a3[_0x15c2('0x26')][_0x15c2('0x28')]);}logger[_0x15c2('0x26')](_0x15c2('0x27'),_0x21a699,_0x20b3a3[_0x15c2('0x26')][_0x15c2('0x28')]);return _0x2b6165(_0x20b3a3[_0x15c2('0x26')][_0x15c2('0x28')]);}else{logger[_0x15c2('0x20')](_0x15c2('0x27'),_0x21a699,_0x15c2('0x21'));_0x2b6165(_0x20b3a3[_0x15c2('0x29')][_0x15c2('0x28')]);}})[_0x15c2('0x2a')](function(_0x14c801){logger['error'](_0x15c2('0x27'),_0x21a699,_0x14c801);_0x3061a6(_0x14c801);});});}function respondWithStatusCode(_0x48307b,_0x512d71){_0x512d71=_0x512d71||0xcc;return function(_0xb17ad1){if(_0xb17ad1){return _0x48307b[_0x15c2('0x2b')](_0x512d71);}return _0x48307b[_0x15c2('0x2c')](_0x512d71)[_0x15c2('0x2d')]();};}function respondWithResult(_0x1640b2,_0xa9b474){_0xa9b474=_0xa9b474||0xc8;return function(_0x5b02c5){if(_0x5b02c5){return _0x1640b2['status'](_0xa9b474)[_0x15c2('0x2e')](_0x5b02c5);}};}function respondWithFilteredResult(_0x308564,_0x1c2fe1){return function(_0x6ac8fb){if(_0x6ac8fb){var _0xc93d74=_0x6ac8fb[_0x15c2('0x2f')],_0x59b6e2=_0x1c2fe1[_0x15c2('0x30')],_0x561c6f=_0x1c2fe1[_0x15c2('0x30')]+_0x1c2fe1['limit'],_0x134eb0;if(_0x561c6f>=_0xc93d74){_0x561c6f=_0xc93d74;_0x134eb0=0xc8;}else{_0x134eb0=0xce;}_0x308564[_0x15c2('0x2c')](_0x134eb0);return _0x308564[_0x15c2('0x31')](_0x15c2('0x32'),_0x59b6e2+'-'+_0x561c6f+'/'+_0xc93d74)[_0x15c2('0x2e')](_0x6ac8fb);}return null;};}function patchUpdates(_0xb3ed1a){return function(_0x937532){try{jsonpatch[_0x15c2('0x33')](_0x937532,_0xb3ed1a,!![]);}catch(_0x2d2125){return BPromise[_0x15c2('0x34')](_0x2d2125);}return _0x937532['save']();};}function saveUpdates(_0x1553d0,_0x4b36ff){return function(_0x206cea){if(_0x206cea){return _0x206cea['update'](_0x1553d0)[_0x15c2('0x1f')](function(_0x3e9d4b){return _0x3e9d4b;});}return null;};}function removeEntity(_0x132236,_0x481ba4){return function(_0x56b78f){if(_0x56b78f){return _0x56b78f['destroy']()[_0x15c2('0x1f')](function(){_0x132236[_0x15c2('0x2c')](0xcc)[_0x15c2('0x2d')]();});}};}function handleEntityNotFound(_0x3384ce,_0x4461bc){return function(_0x2df7f9){if(!_0x2df7f9){_0x3384ce[_0x15c2('0x2b')](0x194);}return _0x2df7f9;};}function handleError(_0xf425ca,_0x58494b){_0x58494b=_0x58494b||0x1f4;return function(_0x494daf){logger[_0x15c2('0x26')](_0x494daf[_0x15c2('0x35')]);if(_0x494daf[_0x15c2('0x36')]){delete _0x494daf[_0x15c2('0x36')];}_0xf425ca[_0x15c2('0x2c')](_0x58494b)[_0x15c2('0x37')](_0x494daf);};}exports[_0x15c2('0x38')]=function(_0x302a98,_0x1756eb){var _0x3fec9a={},_0x29d620={},_0x1e9403={'count':0x0,'rows':[]};var _0x1b449d=_['map'](db[_0x15c2('0x39')]['rawAttributes'],function(_0x5e37ce){return{'name':_0x5e37ce[_0x15c2('0x3a')],'type':_0x5e37ce[_0x15c2('0x3b')][_0x15c2('0x3c')]};});_0x29d620['model']=_['map'](_0x1b449d,_0x15c2('0x36'));_0x29d620[_0x15c2('0x3d')]=_[_0x15c2('0x3e')](_0x302a98['query']);_0x29d620[_0x15c2('0x3f')]=_['intersection'](_0x29d620['model'],_0x29d620[_0x15c2('0x3d')]);_0x3fec9a[_0x15c2('0x40')]=_['intersection'](_0x29d620[_0x15c2('0x41')],qs['fields'](_0x302a98[_0x15c2('0x3d')][_0x15c2('0x42')]));_0x3fec9a['attributes']=_0x3fec9a[_0x15c2('0x40')]['length']?_0x3fec9a[_0x15c2('0x40')]:_0x29d620[_0x15c2('0x41')];if(!_0x302a98['query'][_0x15c2('0x43')]('nolimit')){_0x3fec9a['limit']=qs['limit'](_0x302a98[_0x15c2('0x3d')][_0x15c2('0x44')]);_0x3fec9a['offset']=qs[_0x15c2('0x30')](_0x302a98[_0x15c2('0x3d')][_0x15c2('0x30')]);}_0x3fec9a[_0x15c2('0x45')]=qs[_0x15c2('0x46')](_0x302a98[_0x15c2('0x3d')][_0x15c2('0x46')]);_0x3fec9a['where']=qs[_0x15c2('0x3f')](_['pick'](_0x302a98[_0x15c2('0x3d')],_0x29d620['filters']),_0x1b449d);if(_0x302a98[_0x15c2('0x3d')][_0x15c2('0x47')]){_0x3fec9a['where']=_[_0x15c2('0x48')](_0x3fec9a[_0x15c2('0x49')],{'$or':_['map'](_0x1b449d,function(_0x1ebd93){if(_0x1ebd93['type']!==_0x15c2('0x4a')){var _0x25547e={};_0x25547e[_0x1ebd93[_0x15c2('0x36')]]={'$like':'%'+_0x302a98[_0x15c2('0x3d')][_0x15c2('0x47')]+'%'};return _0x25547e;}})});}_0x3fec9a=_[_0x15c2('0x48')]({},_0x3fec9a,_0x302a98[_0x15c2('0x4b')]);var _0x46ed28={'where':_0x3fec9a[_0x15c2('0x49')]};return db['ZohoConfiguration'][_0x15c2('0x2f')](_0x46ed28)['then'](function(_0xb173f0){_0x1e9403[_0x15c2('0x2f')]=_0xb173f0;if(_0x302a98[_0x15c2('0x3d')]['includeAll']){_0x3fec9a[_0x15c2('0x4c')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x3fec9a);})['then'](function(_0x3d031e){_0x1e9403[_0x15c2('0x4d')]=_0x3d031e;return _0x1e9403;})[_0x15c2('0x1f')](respondWithFilteredResult(_0x1756eb,_0x3fec9a))['catch'](handleError(_0x1756eb,null));};exports[_0x15c2('0x4e')]=function(_0x4461ef,_0x4675f0){var _0xabfbfd={'raw':![],'where':{'id':_0x4461ef[_0x15c2('0x4f')]['id']}},_0x48546c={};_0x48546c[_0x15c2('0x41')]=_[_0x15c2('0x3e')](db[_0x15c2('0x39')]['rawAttributes']);_0x48546c[_0x15c2('0x3d')]=_[_0x15c2('0x3e')](_0x4461ef[_0x15c2('0x3d')]);_0x48546c[_0x15c2('0x3f')]=_[_0x15c2('0x50')](_0x48546c['model'],_0x48546c[_0x15c2('0x3d')]);_0xabfbfd[_0x15c2('0x40')]=_[_0x15c2('0x50')](_0x48546c['model'],qs['fields'](_0x4461ef['query']['fields']));_0xabfbfd[_0x15c2('0x40')]=_0xabfbfd[_0x15c2('0x40')][_0x15c2('0x51')]?_0xabfbfd['attributes']:_0x48546c[_0x15c2('0x41')];if(_0x4461ef[_0x15c2('0x3d')][_0x15c2('0x52')]){_0xabfbfd[_0x15c2('0x4c')]=[{'all':!![]}];}_0xabfbfd=_[_0x15c2('0x48')]({},_0xabfbfd,_0x4461ef[_0x15c2('0x4b')]);return db[_0x15c2('0x39')][_0x15c2('0x53')](_0xabfbfd)['then'](handleEntityNotFound(_0x4675f0,null))[_0x15c2('0x1f')](respondWithResult(_0x4675f0,null))[_0x15c2('0x2a')](handleError(_0x4675f0,null));};exports['create']=function(_0x271b80,_0xc15d38){return db[_0x15c2('0x39')][_0x15c2('0x54')](_0x271b80['body'],{})[_0x15c2('0x1f')](respondWithResult(_0xc15d38,0xc9))[_0x15c2('0x2a')](handleError(_0xc15d38,null));};exports[_0x15c2('0x55')]=function(_0x40cd6f,_0x300208){if(_0x40cd6f[_0x15c2('0x56')]['id']){delete _0x40cd6f['body']['id'];}return db[_0x15c2('0x39')]['find']({'where':{'id':_0x40cd6f[_0x15c2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x300208,null))[_0x15c2('0x1f')](saveUpdates(_0x40cd6f[_0x15c2('0x56')],null))[_0x15c2('0x1f')](respondWithResult(_0x300208,null))[_0x15c2('0x2a')](handleError(_0x300208,null));};exports[_0x15c2('0x57')]=function(_0x399260,_0x4a5fb8){return db[_0x15c2('0x39')]['find']({'where':{'id':_0x399260['params']['id']}})[_0x15c2('0x1f')](handleEntityNotFound(_0x4a5fb8,null))[_0x15c2('0x1f')](removeEntity(_0x4a5fb8,null))[_0x15c2('0x2a')](handleError(_0x4a5fb8,null));};exports['getFields']=function(_0x363ac2,_0x480883,_0x490be3){var _0x37e061={};var _0x381efd={};var _0x4c0fe2;var _0x4af6fd;return db['ZohoConfiguration'][_0x15c2('0x58')]({'where':{'id':_0x363ac2[_0x15c2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x480883,null))[_0x15c2('0x1f')](function(_0x577e8d){if(_0x577e8d){_0x4c0fe2=_0x577e8d;_0x381efd[_0x15c2('0x41')]=_[_0x15c2('0x3e')](db[_0x15c2('0x59')][_0x15c2('0x5a')]);_0x381efd[_0x15c2('0x3d')]=_['keys'](_0x363ac2[_0x15c2('0x3d')]);_0x381efd[_0x15c2('0x3f')]=_['intersection'](_0x381efd[_0x15c2('0x41')],_0x381efd['query']);_0x37e061[_0x15c2('0x40')]=_[_0x15c2('0x50')](_0x381efd[_0x15c2('0x41')],qs['fields'](_0x363ac2[_0x15c2('0x3d')][_0x15c2('0x42')]));_0x37e061[_0x15c2('0x40')]=_0x37e061[_0x15c2('0x40')][_0x15c2('0x51')]?_0x37e061['attributes']:_0x381efd['model'];_0x37e061[_0x15c2('0x45')]=qs[_0x15c2('0x46')](_0x363ac2[_0x15c2('0x3d')][_0x15c2('0x46')]);_0x37e061[_0x15c2('0x49')]=qs['filters'](_['pick'](_0x363ac2[_0x15c2('0x3d')],_0x381efd[_0x15c2('0x3f')]));if(_0x363ac2[_0x15c2('0x3d')][_0x15c2('0x47')]){_0x37e061[_0x15c2('0x49')]=_[_0x15c2('0x48')](_0x37e061[_0x15c2('0x49')],{'$or':_[_0x15c2('0x5b')](_0x37e061['attributes'],function(_0x3fabea){var _0x4cd1f0={};_0x4cd1f0[_0x3fabea]={'$like':'%'+_0x363ac2[_0x15c2('0x3d')][_0x15c2('0x47')]+'%'};return _0x4cd1f0;})});}_0x37e061=_[_0x15c2('0x48')]({},_0x37e061,_0x363ac2['options']);return _0x4c0fe2[_0x15c2('0x5c')](_0x37e061);}})['then'](function(_0x560c64){if(_0x560c64){_0x4af6fd=_0x560c64[_0x15c2('0x51')];if(!_0x363ac2[_0x15c2('0x3d')][_0x15c2('0x43')](_0x15c2('0x5d'))){_0x37e061['limit']=qs['limit'](_0x363ac2[_0x15c2('0x3d')]['limit']);_0x37e061[_0x15c2('0x30')]=qs[_0x15c2('0x30')](_0x363ac2[_0x15c2('0x3d')][_0x15c2('0x30')]);}return _0x4c0fe2[_0x15c2('0x5c')](_0x37e061);}})[_0x15c2('0x1f')](function(_0x566f){if(_0x566f){return _0x566f?{'count':_0x4af6fd,'rows':_0x566f}:null;}})[_0x15c2('0x1f')](respondWithResult(_0x480883,null))['catch'](handleError(_0x480883,null));};exports['getSubjects']=function(_0x4b2ec8,_0x44aeac,_0x15bfc1){var _0x4d574e={};var _0x35f9a8={};var _0x594266;var _0x5445e2;return db[_0x15c2('0x39')]['findOne']({'where':{'id':_0x4b2ec8[_0x15c2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x44aeac,null))[_0x15c2('0x1f')](function(_0x541c29){if(_0x541c29){_0x594266=_0x541c29;_0x35f9a8['model']=_['keys'](db['ZohoField'][_0x15c2('0x5a')]);_0x35f9a8[_0x15c2('0x3d')]=_[_0x15c2('0x3e')](_0x4b2ec8[_0x15c2('0x3d')]);_0x35f9a8['filters']=_[_0x15c2('0x50')](_0x35f9a8['model'],_0x35f9a8['query']);_0x4d574e[_0x15c2('0x40')]=_[_0x15c2('0x50')](_0x35f9a8['model'],qs['fields'](_0x4b2ec8[_0x15c2('0x3d')][_0x15c2('0x42')]));_0x4d574e[_0x15c2('0x40')]=_0x4d574e[_0x15c2('0x40')][_0x15c2('0x51')]?_0x4d574e[_0x15c2('0x40')]:_0x35f9a8[_0x15c2('0x41')];_0x4d574e[_0x15c2('0x45')]=qs[_0x15c2('0x46')](_0x4b2ec8[_0x15c2('0x3d')][_0x15c2('0x46')]);_0x4d574e[_0x15c2('0x49')]=qs[_0x15c2('0x3f')](_[_0x15c2('0x5e')](_0x4b2ec8[_0x15c2('0x3d')],_0x35f9a8[_0x15c2('0x3f')]));if(_0x4b2ec8['query'][_0x15c2('0x47')]){_0x4d574e[_0x15c2('0x49')]=_[_0x15c2('0x48')](_0x4d574e['where'],{'$or':_[_0x15c2('0x5b')](_0x4d574e[_0x15c2('0x40')],function(_0x43be42){var _0xb65c50={};_0xb65c50[_0x43be42]={'$like':'%'+_0x4b2ec8[_0x15c2('0x3d')]['filter']+'%'};return _0xb65c50;})});}_0x4d574e=_[_0x15c2('0x48')]({},_0x4d574e,_0x4b2ec8[_0x15c2('0x4b')]);return _0x594266['getSubjects'](_0x4d574e);}})[_0x15c2('0x1f')](function(_0x540933){if(_0x540933){_0x5445e2=_0x540933[_0x15c2('0x51')];if(!_0x4b2ec8[_0x15c2('0x3d')][_0x15c2('0x43')](_0x15c2('0x5d'))){_0x4d574e['limit']=qs[_0x15c2('0x44')](_0x4b2ec8[_0x15c2('0x3d')][_0x15c2('0x44')]);_0x4d574e[_0x15c2('0x30')]=qs['offset'](_0x4b2ec8['query'][_0x15c2('0x30')]);}return _0x594266['getSubjects'](_0x4d574e);}})[_0x15c2('0x1f')](function(_0x332db6){if(_0x332db6){return _0x332db6?{'count':_0x5445e2,'rows':_0x332db6}:null;}})[_0x15c2('0x1f')](respondWithResult(_0x44aeac,null))['catch'](handleError(_0x44aeac,null));};exports[_0x15c2('0x5f')]=function(_0x2a1e14,_0xbd1dad,_0x5f1a08){var _0x26c21a={};var _0x55685a={};var _0x17f659;var _0x3ccc60;return db[_0x15c2('0x39')][_0x15c2('0x58')]({'where':{'id':_0x2a1e14[_0x15c2('0x4f')]['id']}})[_0x15c2('0x1f')](handleEntityNotFound(_0xbd1dad,null))[_0x15c2('0x1f')](function(_0x41438a){if(_0x41438a){_0x17f659=_0x41438a;_0x55685a['model']=_[_0x15c2('0x3e')](db['ZohoField']['rawAttributes']);_0x55685a[_0x15c2('0x3d')]=_[_0x15c2('0x3e')](_0x2a1e14['query']);_0x55685a['filters']=_[_0x15c2('0x50')](_0x55685a[_0x15c2('0x41')],_0x55685a[_0x15c2('0x3d')]);_0x26c21a[_0x15c2('0x40')]=_[_0x15c2('0x50')](_0x55685a[_0x15c2('0x41')],qs['fields'](_0x2a1e14[_0x15c2('0x3d')][_0x15c2('0x42')]));_0x26c21a['attributes']=_0x26c21a[_0x15c2('0x40')][_0x15c2('0x51')]?_0x26c21a[_0x15c2('0x40')]:_0x55685a[_0x15c2('0x41')];_0x26c21a[_0x15c2('0x45')]=qs[_0x15c2('0x46')](_0x2a1e14[_0x15c2('0x3d')]['sort']);_0x26c21a[_0x15c2('0x49')]=qs[_0x15c2('0x3f')](_[_0x15c2('0x5e')](_0x2a1e14[_0x15c2('0x3d')],_0x55685a[_0x15c2('0x3f')]));if(_0x2a1e14[_0x15c2('0x3d')][_0x15c2('0x47')]){_0x26c21a[_0x15c2('0x49')]=_['merge'](_0x26c21a[_0x15c2('0x49')],{'$or':_[_0x15c2('0x5b')](_0x26c21a[_0x15c2('0x40')],function(_0x2c3901){var _0x1db7a4={};_0x1db7a4[_0x2c3901]={'$like':'%'+_0x2a1e14[_0x15c2('0x3d')][_0x15c2('0x47')]+'%'};return _0x1db7a4;})});}_0x26c21a=_[_0x15c2('0x48')]({},_0x26c21a,_0x2a1e14[_0x15c2('0x4b')]);return _0x17f659[_0x15c2('0x5f')](_0x26c21a);}})['then'](function(_0x581233){if(_0x581233){_0x3ccc60=_0x581233['length'];if(!_0x2a1e14['query']['hasOwnProperty']('nolimit')){_0x26c21a[_0x15c2('0x44')]=qs[_0x15c2('0x44')](_0x2a1e14[_0x15c2('0x3d')][_0x15c2('0x44')]);_0x26c21a[_0x15c2('0x30')]=qs[_0x15c2('0x30')](_0x2a1e14['query'][_0x15c2('0x30')]);}return _0x17f659[_0x15c2('0x5f')](_0x26c21a);}})[_0x15c2('0x1f')](function(_0xaf16ea){if(_0xaf16ea){return _0xaf16ea?{'count':_0x3ccc60,'rows':_0xaf16ea}:null;}})[_0x15c2('0x1f')](respondWithResult(_0xbd1dad,null))['catch'](handleError(_0xbd1dad,null));}; \ No newline at end of file +var _0xc1c1=['filter','merge','VIRTUAL','options','ZohoConfiguration','count','includeAll','findAll','params','include','find','create','body','findOne','ZohoField','sort','map','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','jayson/promise','Sequelize','ValidationError','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','offset','set','Content-Range','json','apply','reject','update','destroy','end','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','pick'];(function(_0x496ec9,_0x3f0544){var _0x42c12e=function(_0xef1372){while(--_0xef1372){_0x496ec9['push'](_0x496ec9['shift']());}};_0x42c12e(++_0x3f0544);}(_0xc1c1,0xc6));var _0x1c1c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc1c1[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0x1c1c('0x0'));var emlformat=require(_0x1c1c('0x1'));var rimraf=require(_0x1c1c('0x2'));var zipdir=require(_0x1c1c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c1c('0x4'));var moment=require(_0x1c1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1c1c('0x6'));var util=require(_0x1c1c('0x7'));var path=require('path');var sox=require(_0x1c1c('0x8'));var csv=require(_0x1c1c('0x9'));var ejs=require(_0x1c1c('0xa'));var fs=require('fs');var _=require(_0x1c1c('0xb'));var squel=require('squel');var crypto=require(_0x1c1c('0xc'));var jsforce=require(_0x1c1c('0xd'));var deskjs=require(_0x1c1c('0xe'));var toCsv=require(_0x1c1c('0x9'));var querystring=require(_0x1c1c('0xf'));var Papa=require(_0x1c1c('0x10'));var Redis=require(_0x1c1c('0x11'));var authService=require(_0x1c1c('0x12'));var qs=require(_0x1c1c('0x13'));var as=require(_0x1c1c('0x14'));var hardwareService=require(_0x1c1c('0x15'));var logger=require('../../config/logger')(_0x1c1c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x1c1c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1a5d61,_0x533e37,_0x2cd36a){if(_0x2cd36a){var _0x11b51c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11b51c['test'](_0x533e37)){return _0x1a5d61;}else{throw new db[(_0x1c1c('0x18'))][(_0x1c1c('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1a5d61;}}function respondWithRpcPromise(_0x19c896,_0x3131f7,_0x16d897,_0x4dbd2f){return new BPromise(function(_0x4d6808,_0x4d37de){var _0xe9a7a6=_0x4dbd2f||client;return _0xe9a7a6[_0x1c1c('0x1a')](_0x19c896,_0x16d897)[_0x1c1c('0x1b')](function(_0x394fd2){logger[_0x1c1c('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0x3131f7,'request\x20sent');logger[_0x1c1c('0x1d')](_0x1c1c('0x1e'),_0x3131f7,_0x1c1c('0x1f'),JSON[_0x1c1c('0x20')](_0x394fd2));if(_0x394fd2[_0x1c1c('0x21')]){if(_0x394fd2[_0x1c1c('0x21')][_0x1c1c('0x22')]===0x1f4){logger[_0x1c1c('0x21')](_0x1c1c('0x23'),_0x3131f7,_0x394fd2[_0x1c1c('0x21')][_0x1c1c('0x24')]);return _0x4d37de(_0x394fd2[_0x1c1c('0x21')][_0x1c1c('0x24')]);}logger['error'](_0x1c1c('0x23'),_0x3131f7,_0x394fd2[_0x1c1c('0x21')]['message']);return _0x4d6808(_0x394fd2[_0x1c1c('0x21')][_0x1c1c('0x24')]);}else{logger[_0x1c1c('0x1c')](_0x1c1c('0x23'),_0x3131f7,_0x1c1c('0x1f'));_0x4d6808(_0x394fd2['result']['message']);}})[_0x1c1c('0x25')](function(_0x3e7779){logger['error'](_0x1c1c('0x23'),_0x3131f7,_0x3e7779);_0x4d37de(_0x3e7779);});});}function respondWithStatusCode(_0x50db79,_0x4bbfd1){_0x4bbfd1=_0x4bbfd1||0xcc;return function(_0x535c99){if(_0x535c99){return _0x50db79[_0x1c1c('0x26')](_0x4bbfd1);}return _0x50db79['status'](_0x4bbfd1)['end']();};}function respondWithResult(_0x5a26fc,_0x3c42d5){_0x3c42d5=_0x3c42d5||0xc8;return function(_0x3303f1){if(_0x3303f1){return _0x5a26fc[_0x1c1c('0x27')](_0x3c42d5)['json'](_0x3303f1);}};}function respondWithFilteredResult(_0x2b4c6f,_0x523a73){return function(_0x22542c){if(_0x22542c){var _0x672e57=_0x22542c['count'],_0x56163a=_0x523a73[_0x1c1c('0x28')],_0x24681e=_0x523a73[_0x1c1c('0x28')]+_0x523a73['limit'],_0x1e2720;if(_0x24681e>=_0x672e57){_0x24681e=_0x672e57;_0x1e2720=0xc8;}else{_0x1e2720=0xce;}_0x2b4c6f['status'](_0x1e2720);return _0x2b4c6f[_0x1c1c('0x29')](_0x1c1c('0x2a'),_0x56163a+'-'+_0x24681e+'/'+_0x672e57)[_0x1c1c('0x2b')](_0x22542c);}return null;};}function patchUpdates(_0x1cfc81){return function(_0x421766){try{jsonpatch[_0x1c1c('0x2c')](_0x421766,_0x1cfc81,!![]);}catch(_0x1cf916){return BPromise[_0x1c1c('0x2d')](_0x1cf916);}return _0x421766['save']();};}function saveUpdates(_0x4a9779,_0x1ded4f){return function(_0x46d12a){if(_0x46d12a){return _0x46d12a[_0x1c1c('0x2e')](_0x4a9779)[_0x1c1c('0x1b')](function(_0x40f4e9){return _0x40f4e9;});}return null;};}function removeEntity(_0x214f1b,_0x172b9c){return function(_0x3f6930){if(_0x3f6930){return _0x3f6930[_0x1c1c('0x2f')]()[_0x1c1c('0x1b')](function(){_0x214f1b[_0x1c1c('0x27')](0xcc)[_0x1c1c('0x30')]();});}};}function handleEntityNotFound(_0x5f5148,_0x55c3ee){return function(_0x2c3eee){if(!_0x2c3eee){_0x5f5148['sendStatus'](0x194);}return _0x2c3eee;};}function handleError(_0x56ca7b,_0xd1aeae){_0xd1aeae=_0xd1aeae||0x1f4;return function(_0x14db7e){logger['error'](_0x14db7e['stack']);if(_0x14db7e[_0x1c1c('0x31')]){delete _0x14db7e['name'];}_0x56ca7b[_0x1c1c('0x27')](_0xd1aeae)[_0x1c1c('0x32')](_0x14db7e);};}exports[_0x1c1c('0x33')]=function(_0xce3d01,_0x2efb3e){var _0x957462={},_0x43f625={},_0x3bdd13={'count':0x0,'rows':[]};var _0x289b47=_['map'](db['ZohoConfiguration'][_0x1c1c('0x34')],function(_0x52d298){return{'name':_0x52d298['fieldName'],'type':_0x52d298[_0x1c1c('0x35')][_0x1c1c('0x36')]};});_0x43f625[_0x1c1c('0x37')]=_['map'](_0x289b47,_0x1c1c('0x31'));_0x43f625[_0x1c1c('0x38')]=_[_0x1c1c('0x39')](_0xce3d01[_0x1c1c('0x38')]);_0x43f625[_0x1c1c('0x3a')]=_['intersection'](_0x43f625[_0x1c1c('0x37')],_0x43f625[_0x1c1c('0x38')]);_0x957462[_0x1c1c('0x3b')]=_[_0x1c1c('0x3c')](_0x43f625[_0x1c1c('0x37')],qs[_0x1c1c('0x3d')](_0xce3d01[_0x1c1c('0x38')][_0x1c1c('0x3d')]));_0x957462['attributes']=_0x957462['attributes'][_0x1c1c('0x3e')]?_0x957462[_0x1c1c('0x3b')]:_0x43f625[_0x1c1c('0x37')];if(!_0xce3d01[_0x1c1c('0x38')][_0x1c1c('0x3f')](_0x1c1c('0x40'))){_0x957462['limit']=qs[_0x1c1c('0x41')](_0xce3d01[_0x1c1c('0x38')][_0x1c1c('0x41')]);_0x957462[_0x1c1c('0x28')]=qs[_0x1c1c('0x28')](_0xce3d01[_0x1c1c('0x38')]['offset']);}_0x957462[_0x1c1c('0x42')]=qs['sort'](_0xce3d01[_0x1c1c('0x38')]['sort']);_0x957462[_0x1c1c('0x43')]=qs[_0x1c1c('0x3a')](_[_0x1c1c('0x44')](_0xce3d01[_0x1c1c('0x38')],_0x43f625[_0x1c1c('0x3a')]),_0x289b47);if(_0xce3d01['query'][_0x1c1c('0x45')]){_0x957462['where']=_[_0x1c1c('0x46')](_0x957462[_0x1c1c('0x43')],{'$or':_['map'](_0x289b47,function(_0x1e2733){if(_0x1e2733['type']!==_0x1c1c('0x47')){var _0x38e268={};_0x38e268[_0x1e2733[_0x1c1c('0x31')]]={'$like':'%'+_0xce3d01[_0x1c1c('0x38')][_0x1c1c('0x45')]+'%'};return _0x38e268;}})});}_0x957462=_[_0x1c1c('0x46')]({},_0x957462,_0xce3d01[_0x1c1c('0x48')]);var _0x2756f8={'where':_0x957462['where']};return db[_0x1c1c('0x49')][_0x1c1c('0x4a')](_0x2756f8)['then'](function(_0x4e7192){_0x3bdd13[_0x1c1c('0x4a')]=_0x4e7192;if(_0xce3d01['query'][_0x1c1c('0x4b')]){_0x957462['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x1c1c('0x4c')](_0x957462);})[_0x1c1c('0x1b')](function(_0xac2f60){_0x3bdd13['rows']=_0xac2f60;return _0x3bdd13;})[_0x1c1c('0x1b')](respondWithFilteredResult(_0x2efb3e,_0x957462))[_0x1c1c('0x25')](handleError(_0x2efb3e,null));};exports['show']=function(_0xe47190,_0x12f61b){var _0x4e6962={'raw':![],'where':{'id':_0xe47190[_0x1c1c('0x4d')]['id']}},_0x4fedbe={};_0x4fedbe[_0x1c1c('0x37')]=_[_0x1c1c('0x39')](db[_0x1c1c('0x49')][_0x1c1c('0x34')]);_0x4fedbe[_0x1c1c('0x38')]=_[_0x1c1c('0x39')](_0xe47190[_0x1c1c('0x38')]);_0x4fedbe[_0x1c1c('0x3a')]=_[_0x1c1c('0x3c')](_0x4fedbe[_0x1c1c('0x37')],_0x4fedbe[_0x1c1c('0x38')]);_0x4e6962[_0x1c1c('0x3b')]=_['intersection'](_0x4fedbe[_0x1c1c('0x37')],qs[_0x1c1c('0x3d')](_0xe47190[_0x1c1c('0x38')][_0x1c1c('0x3d')]));_0x4e6962[_0x1c1c('0x3b')]=_0x4e6962['attributes']['length']?_0x4e6962['attributes']:_0x4fedbe[_0x1c1c('0x37')];if(_0xe47190[_0x1c1c('0x38')][_0x1c1c('0x4b')]){_0x4e6962[_0x1c1c('0x4e')]=[{'all':!![]}];}_0x4e6962=_[_0x1c1c('0x46')]({},_0x4e6962,_0xe47190[_0x1c1c('0x48')]);return db[_0x1c1c('0x49')][_0x1c1c('0x4f')](_0x4e6962)['then'](handleEntityNotFound(_0x12f61b,null))[_0x1c1c('0x1b')](respondWithResult(_0x12f61b,null))[_0x1c1c('0x25')](handleError(_0x12f61b,null));};exports[_0x1c1c('0x50')]=function(_0x51c3d7,_0x1d555f){return db[_0x1c1c('0x49')][_0x1c1c('0x50')](_0x51c3d7[_0x1c1c('0x51')],{})[_0x1c1c('0x1b')](respondWithResult(_0x1d555f,0xc9))[_0x1c1c('0x25')](handleError(_0x1d555f,null));};exports[_0x1c1c('0x2e')]=function(_0x2f9702,_0x40372b){if(_0x2f9702['body']['id']){delete _0x2f9702[_0x1c1c('0x51')]['id'];}return db[_0x1c1c('0x49')][_0x1c1c('0x4f')]({'where':{'id':_0x2f9702[_0x1c1c('0x4d')]['id']}})[_0x1c1c('0x1b')](handleEntityNotFound(_0x40372b,null))[_0x1c1c('0x1b')](saveUpdates(_0x2f9702[_0x1c1c('0x51')],null))[_0x1c1c('0x1b')](respondWithResult(_0x40372b,null))[_0x1c1c('0x25')](handleError(_0x40372b,null));};exports['destroy']=function(_0x1a762e,_0x39fa8f){return db['ZohoConfiguration']['find']({'where':{'id':_0x1a762e['params']['id']}})[_0x1c1c('0x1b')](handleEntityNotFound(_0x39fa8f,null))[_0x1c1c('0x1b')](removeEntity(_0x39fa8f,null))[_0x1c1c('0x25')](handleError(_0x39fa8f,null));};exports['getFields']=function(_0x318bd1,_0x2a8d56,_0x27c487){var _0x28ea25={};var _0x5b97dc={};var _0x4c7ff2;var _0x36dda8;return db[_0x1c1c('0x49')][_0x1c1c('0x52')]({'where':{'id':_0x318bd1[_0x1c1c('0x4d')]['id']}})[_0x1c1c('0x1b')](handleEntityNotFound(_0x2a8d56,null))['then'](function(_0x44cb17){if(_0x44cb17){_0x4c7ff2=_0x44cb17;_0x5b97dc['model']=_[_0x1c1c('0x39')](db[_0x1c1c('0x53')][_0x1c1c('0x34')]);_0x5b97dc[_0x1c1c('0x38')]=_[_0x1c1c('0x39')](_0x318bd1[_0x1c1c('0x38')]);_0x5b97dc[_0x1c1c('0x3a')]=_[_0x1c1c('0x3c')](_0x5b97dc[_0x1c1c('0x37')],_0x5b97dc[_0x1c1c('0x38')]);_0x28ea25[_0x1c1c('0x3b')]=_['intersection'](_0x5b97dc[_0x1c1c('0x37')],qs[_0x1c1c('0x3d')](_0x318bd1['query'][_0x1c1c('0x3d')]));_0x28ea25[_0x1c1c('0x3b')]=_0x28ea25[_0x1c1c('0x3b')][_0x1c1c('0x3e')]?_0x28ea25[_0x1c1c('0x3b')]:_0x5b97dc[_0x1c1c('0x37')];_0x28ea25[_0x1c1c('0x42')]=qs[_0x1c1c('0x54')](_0x318bd1[_0x1c1c('0x38')]['sort']);_0x28ea25['where']=qs[_0x1c1c('0x3a')](_[_0x1c1c('0x44')](_0x318bd1[_0x1c1c('0x38')],_0x5b97dc['filters']));if(_0x318bd1[_0x1c1c('0x38')][_0x1c1c('0x45')]){_0x28ea25[_0x1c1c('0x43')]=_[_0x1c1c('0x46')](_0x28ea25['where'],{'$or':_[_0x1c1c('0x55')](_0x28ea25['attributes'],function(_0x228b85){var _0x59fb86={};_0x59fb86[_0x228b85]={'$like':'%'+_0x318bd1[_0x1c1c('0x38')]['filter']+'%'};return _0x59fb86;})});}_0x28ea25=_[_0x1c1c('0x46')]({},_0x28ea25,_0x318bd1[_0x1c1c('0x48')]);return _0x4c7ff2[_0x1c1c('0x56')](_0x28ea25);}})[_0x1c1c('0x1b')](function(_0x3ab30e){if(_0x3ab30e){_0x36dda8=_0x3ab30e['length'];if(!_0x318bd1['query'][_0x1c1c('0x3f')](_0x1c1c('0x40'))){_0x28ea25[_0x1c1c('0x41')]=qs['limit'](_0x318bd1[_0x1c1c('0x38')]['limit']);_0x28ea25[_0x1c1c('0x28')]=qs[_0x1c1c('0x28')](_0x318bd1[_0x1c1c('0x38')]['offset']);}return _0x4c7ff2['getFields'](_0x28ea25);}})[_0x1c1c('0x1b')](function(_0x48ca92){if(_0x48ca92){return _0x48ca92?{'count':_0x36dda8,'rows':_0x48ca92}:null;}})[_0x1c1c('0x1b')](respondWithResult(_0x2a8d56,null))[_0x1c1c('0x25')](handleError(_0x2a8d56,null));};exports[_0x1c1c('0x57')]=function(_0x146ce2,_0x3f2663,_0x79cc6b){var _0xee3dfb={};var _0x31e88a={};var _0x3cfdda;var _0x2c6851;return db[_0x1c1c('0x49')][_0x1c1c('0x52')]({'where':{'id':_0x146ce2[_0x1c1c('0x4d')]['id']}})[_0x1c1c('0x1b')](handleEntityNotFound(_0x3f2663,null))[_0x1c1c('0x1b')](function(_0x262b98){if(_0x262b98){_0x3cfdda=_0x262b98;_0x31e88a[_0x1c1c('0x37')]=_[_0x1c1c('0x39')](db[_0x1c1c('0x53')]['rawAttributes']);_0x31e88a['query']=_[_0x1c1c('0x39')](_0x146ce2[_0x1c1c('0x38')]);_0x31e88a[_0x1c1c('0x3a')]=_[_0x1c1c('0x3c')](_0x31e88a[_0x1c1c('0x37')],_0x31e88a[_0x1c1c('0x38')]);_0xee3dfb[_0x1c1c('0x3b')]=_[_0x1c1c('0x3c')](_0x31e88a['model'],qs[_0x1c1c('0x3d')](_0x146ce2[_0x1c1c('0x38')][_0x1c1c('0x3d')]));_0xee3dfb[_0x1c1c('0x3b')]=_0xee3dfb[_0x1c1c('0x3b')][_0x1c1c('0x3e')]?_0xee3dfb[_0x1c1c('0x3b')]:_0x31e88a[_0x1c1c('0x37')];_0xee3dfb[_0x1c1c('0x42')]=qs[_0x1c1c('0x54')](_0x146ce2[_0x1c1c('0x38')][_0x1c1c('0x54')]);_0xee3dfb['where']=qs['filters'](_[_0x1c1c('0x44')](_0x146ce2[_0x1c1c('0x38')],_0x31e88a[_0x1c1c('0x3a')]));if(_0x146ce2[_0x1c1c('0x38')][_0x1c1c('0x45')]){_0xee3dfb[_0x1c1c('0x43')]=_[_0x1c1c('0x46')](_0xee3dfb[_0x1c1c('0x43')],{'$or':_[_0x1c1c('0x55')](_0xee3dfb[_0x1c1c('0x3b')],function(_0x34b7d8){var _0x538928={};_0x538928[_0x34b7d8]={'$like':'%'+_0x146ce2[_0x1c1c('0x38')]['filter']+'%'};return _0x538928;})});}_0xee3dfb=_[_0x1c1c('0x46')]({},_0xee3dfb,_0x146ce2[_0x1c1c('0x48')]);return _0x3cfdda[_0x1c1c('0x57')](_0xee3dfb);}})['then'](function(_0x49ede4){if(_0x49ede4){_0x2c6851=_0x49ede4[_0x1c1c('0x3e')];if(!_0x146ce2['query'][_0x1c1c('0x3f')](_0x1c1c('0x40'))){_0xee3dfb[_0x1c1c('0x41')]=qs[_0x1c1c('0x41')](_0x146ce2[_0x1c1c('0x38')][_0x1c1c('0x41')]);_0xee3dfb[_0x1c1c('0x28')]=qs[_0x1c1c('0x28')](_0x146ce2['query'][_0x1c1c('0x28')]);}return _0x3cfdda[_0x1c1c('0x57')](_0xee3dfb);}})[_0x1c1c('0x1b')](function(_0x1ef7da){if(_0x1ef7da){return _0x1ef7da?{'count':_0x2c6851,'rows':_0x1ef7da}:null;}})[_0x1c1c('0x1b')](respondWithResult(_0x3f2663,null))[_0x1c1c('0x25')](handleError(_0x3f2663,null));};exports[_0x1c1c('0x58')]=function(_0x38f0d2,_0x1dd46e,_0x1e576d){var _0x1ed6bf={};var _0x4ba3a9={};var _0x41895f;var _0x3ca27e;return db[_0x1c1c('0x49')][_0x1c1c('0x52')]({'where':{'id':_0x38f0d2[_0x1c1c('0x4d')]['id']}})[_0x1c1c('0x1b')](handleEntityNotFound(_0x1dd46e,null))['then'](function(_0x70b931){if(_0x70b931){_0x41895f=_0x70b931;_0x4ba3a9[_0x1c1c('0x37')]=_['keys'](db[_0x1c1c('0x53')][_0x1c1c('0x34')]);_0x4ba3a9[_0x1c1c('0x38')]=_[_0x1c1c('0x39')](_0x38f0d2[_0x1c1c('0x38')]);_0x4ba3a9[_0x1c1c('0x3a')]=_['intersection'](_0x4ba3a9[_0x1c1c('0x37')],_0x4ba3a9[_0x1c1c('0x38')]);_0x1ed6bf[_0x1c1c('0x3b')]=_[_0x1c1c('0x3c')](_0x4ba3a9[_0x1c1c('0x37')],qs[_0x1c1c('0x3d')](_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x3d')]));_0x1ed6bf[_0x1c1c('0x3b')]=_0x1ed6bf['attributes']['length']?_0x1ed6bf[_0x1c1c('0x3b')]:_0x4ba3a9[_0x1c1c('0x37')];_0x1ed6bf[_0x1c1c('0x42')]=qs[_0x1c1c('0x54')](_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x54')]);_0x1ed6bf[_0x1c1c('0x43')]=qs[_0x1c1c('0x3a')](_[_0x1c1c('0x44')](_0x38f0d2[_0x1c1c('0x38')],_0x4ba3a9['filters']));if(_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x45')]){_0x1ed6bf[_0x1c1c('0x43')]=_[_0x1c1c('0x46')](_0x1ed6bf[_0x1c1c('0x43')],{'$or':_[_0x1c1c('0x55')](_0x1ed6bf[_0x1c1c('0x3b')],function(_0x5e4c9d){var _0x4d92b8={};_0x4d92b8[_0x5e4c9d]={'$like':'%'+_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x45')]+'%'};return _0x4d92b8;})});}_0x1ed6bf=_[_0x1c1c('0x46')]({},_0x1ed6bf,_0x38f0d2[_0x1c1c('0x48')]);return _0x41895f['getDescriptions'](_0x1ed6bf);}})['then'](function(_0x2635a2){if(_0x2635a2){_0x3ca27e=_0x2635a2[_0x1c1c('0x3e')];if(!_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x3f')](_0x1c1c('0x40'))){_0x1ed6bf[_0x1c1c('0x41')]=qs[_0x1c1c('0x41')](_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x41')]);_0x1ed6bf[_0x1c1c('0x28')]=qs[_0x1c1c('0x28')](_0x38f0d2[_0x1c1c('0x38')][_0x1c1c('0x28')]);}return _0x41895f[_0x1c1c('0x58')](_0x1ed6bf);}})[_0x1c1c('0x1b')](function(_0x41e843){if(_0x41e843){return _0x41e843?{'count':_0x3ca27e,'rows':_0x41e843}:null;}})['then'](respondWithResult(_0x1dd46e,null))['catch'](handleError(_0x1dd46e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index db44488..2adfd46 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 _0x7f52=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x3c646e,_0x14b31f){var _0x40b9d5=function(_0x1c4b41){while(--_0x1c4b41){_0x3c646e['push'](_0x3c646e['shift']());}};_0x40b9d5(++_0x14b31f);}(_0x7f52,0x1d6));var _0x27f5=function(_0x512c4c,_0x4bd397){_0x512c4c=_0x512c4c-0x0;var _0x58c0f1=_0x7f52[_0x512c4c];return _0x58c0f1;};'use strict';var _=require(_0x27f5('0x0'));var util=require(_0x27f5('0x1'));var logger=require(_0x27f5('0x2'))(_0x27f5('0x3'));var moment=require('moment');var BPromise=require(_0x27f5('0x4'));var rp=require(_0x27f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27f5('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x27f5('0x7')]=function(_0x1b8388,_0x41fbb7){return _0x1b8388[_0x27f5('0x8')](_0x27f5('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e5c=['ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4eb699,_0x302a3b){var _0x3c323a=function(_0x337b9f){while(--_0x337b9f){_0x4eb699['push'](_0x4eb699['shift']());}};_0x3c323a(++_0x302a3b);}(_0x1e5c,0xb6));var _0xc1e5=function(_0x503fd7,_0x3f26f0){_0x503fd7=_0x503fd7-0x0;var _0x35ff26=_0x1e5c[_0x503fd7];return _0x35ff26;};'use strict';var _=require(_0xc1e5('0x0'));var util=require('util');var logger=require(_0xc1e5('0x1'))(_0xc1e5('0x2'));var moment=require(_0xc1e5('0x3'));var BPromise=require(_0xc1e5('0x4'));var rp=require(_0xc1e5('0x5'));var fs=require('fs');var path=require(_0xc1e5('0x6'));var rimraf=require('rimraf');var config=require(_0xc1e5('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc1e5('0x8')]=function(_0xd9d877,_0xa55942){return _0xd9d877[_0xc1e5('0x9')](_0xc1e5('0xa'),attributes,{'tableName':_0xc1e5('0xb'),'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 6d9e514..6d5a0b5 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 _0x235b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x235b,0xf0));var _0xb235=function(_0x406fa7,_0x59e646){_0x406fa7=_0x406fa7-0x0;var _0x2b72ac=_0x235b[_0x406fa7];return _0x2b72ac;};'use strict';var _=require(_0xb235('0x0'));var util=require(_0xb235('0x1'));var moment=require(_0xb235('0x2'));var BPromise=require(_0xb235('0x3'));var rs=require(_0xb235('0x4'));var fs=require('fs');var Redis=require(_0xb235('0x5'));var db=require(_0xb235('0x6'))['db'];var utils=require(_0xb235('0x7'));var logger=require('../../config/logger')(_0xb235('0x8'));var config=require(_0xb235('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb235('0xa')][_0xb235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x791d6f,_0x3016f6,_0x356f19){return new BPromise(function(_0x227111,_0x1d83fe){return client[_0xb235('0xc')](_0x791d6f,_0x356f19)[_0xb235('0xd')](function(_0x496fd9){logger[_0xb235('0xe')](_0xb235('0xf'),_0x3016f6,'request\x20sent');logger[_0xb235('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3016f6,_0xb235('0x11'),JSON[_0xb235('0x12')](_0x496fd9));if(_0x496fd9[_0xb235('0x13')]){if(_0x496fd9[_0xb235('0x13')][_0xb235('0x14')]===0x1f4){logger['error'](_0xb235('0xf'),_0x3016f6,_0x496fd9['error'][_0xb235('0x15')]);return _0x1d83fe(_0x496fd9[_0xb235('0x13')][_0xb235('0x15')]);}logger[_0xb235('0x13')](_0xb235('0xf'),_0x3016f6,_0x496fd9[_0xb235('0x13')][_0xb235('0x15')]);return _0x227111(_0x496fd9[_0xb235('0x13')][_0xb235('0x15')]);}else{logger[_0xb235('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3016f6,'request\x20sent');_0x227111(_0x496fd9['result'][_0xb235('0x15')]);}})['catch'](function(_0x8174a0){logger[_0xb235('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x3016f6,_0x8174a0);_0x1d83fe(_0x8174a0);});});} \ No newline at end of file +var _0xaf4c=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf4c,0x1da));var _0xcaf4=function(_0x3be94f,_0x582e21){_0x3be94f=_0x3be94f-0x0;var _0x477826=_0xaf4c[_0x3be94f];return _0x477826;};'use strict';var _=require(_0xcaf4('0x0'));var util=require(_0xcaf4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcaf4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaf4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaf4('0x4'))('rpc');var config=require(_0xcaf4('0x5'));var jayson=require(_0xcaf4('0x6'));var client=jayson[_0xcaf4('0x7')][_0xcaf4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55067b,_0x224d66,_0x386890){return new BPromise(function(_0x544a04,_0x276ec7){return client[_0xcaf4('0x9')](_0x55067b,_0x386890)[_0xcaf4('0xa')](function(_0x174024){logger[_0xcaf4('0xb')](_0xcaf4('0xc'),_0x224d66,_0xcaf4('0xd'));logger[_0xcaf4('0xe')](_0xcaf4('0xf'),_0x224d66,_0xcaf4('0xd'),JSON[_0xcaf4('0x10')](_0x174024));if(_0x174024[_0xcaf4('0x11')]){if(_0x174024[_0xcaf4('0x11')][_0xcaf4('0x12')]===0x1f4){logger[_0xcaf4('0x11')](_0xcaf4('0xc'),_0x224d66,_0x174024[_0xcaf4('0x11')]['message']);return _0x276ec7(_0x174024[_0xcaf4('0x11')][_0xcaf4('0x13')]);}logger['error'](_0xcaf4('0xc'),_0x224d66,_0x174024['error']['message']);return _0x544a04(_0x174024[_0xcaf4('0x11')][_0xcaf4('0x13')]);}else{logger[_0xcaf4('0xb')](_0xcaf4('0xc'),_0x224d66,_0xcaf4('0xd'));_0x544a04(_0x174024[_0xcaf4('0x14')][_0xcaf4('0x13')]);}})[_0xcaf4('0x15')](function(_0x4cd994){logger[_0xcaf4('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x224d66,_0x4cd994);_0x276ec7(_0x4cd994);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8744bde..14d1061 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 _0x5c3c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','post','put','/:id','update','delete'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x5c3c,0x132));var _0xc5c3=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x5c3c[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var auth=require(_0xc5c3('0x5'));var interaction=require(_0xc5c3('0x6'));var config=require(_0xc5c3('0x7'));var controller=require(_0xc5c3('0x8'));router[_0xc5c3('0x9')]('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xb')]);router[_0xc5c3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5c3('0xc')]('/',auth[_0xc5c3('0xa')](),controller['create']);router[_0xc5c3('0xd')](_0xc5c3('0xe'),auth['isAuthenticated'](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x10')]('/:id',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x11')]);module[_0xc5c3('0x12')]=router; \ No newline at end of file +var _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4200ff,_0x25558d){var _0x50d61f=function(_0xad8cd9){while(--_0xad8cd9){_0x4200ff['push'](_0x4200ff['shift']());}};_0x50d61f(++_0x25558d);}(_0x57ca,0x108));var _0xa57c=function(_0x22cfdc,_0xe97df4){_0x22cfdc=_0x22cfdc-0x0;var _0x396bc2=_0x57ca[_0x22cfdc];return _0x396bc2;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./intZohoField.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e08cd11..ebba0c4 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 _0xc906=['STRING','ENUM','sequelize','exports','string','variable','customVariable'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc906,0x1ad));var _0x6c90=function(_0x2a66d2,_0x27bbe5){_0x2a66d2=_0x2a66d2-0x0;var _0x499ae4=_0xc906[_0x2a66d2];return _0x499ae4;};'use strict';var Sequelize=require(_0x6c90('0x0'));module[_0x6c90('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6c90('0x2'),_0x6c90('0x3'),_0x6c90('0x4'),'keyValue'),'defaultValue':_0x6c90('0x2')},'content':{'type':Sequelize[_0x6c90('0x5')]},'key':{'type':Sequelize[_0x6c90('0x5')]},'keyType':{'type':Sequelize[_0x6c90('0x6')](_0x6c90('0x2'),_0x6c90('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6c90('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c90('0x5')]}}; \ No newline at end of file +var _0xd493=['customVariable','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x26474a,_0x3cfcfd){var _0x32e0e0=function(_0x2b110f){while(--_0x2b110f){_0x26474a['push'](_0x26474a['shift']());}};_0x32e0e0(++_0x3cfcfd);}(_0xd493,0x1bd));var _0x3d49=function(_0x4d5c55,_0x4031a5){_0x4d5c55=_0x4d5c55-0x0;var _0x2a2c2a=_0xd493[_0x4d5c55];return _0x2a2c2a;};'use strict';var Sequelize=require(_0x3d49('0x0'));module['exports']={'type':{'type':Sequelize[_0x3d49('0x1')](_0x3d49('0x2'),'variable',_0x3d49('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3d49('0x4')]},'key':{'type':Sequelize[_0x3d49('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3d49('0x5'),_0x3d49('0x3'))},'keyContent':{'type':Sequelize[_0x3d49('0x4')]},'idField':{'type':Sequelize[_0x3d49('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3d49('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d49('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c92679a..6b0be6c 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x197b38,_0x394a4d){var _0x20a23a=function(_0x2a5541){while(--_0x2a5541){_0x197b38['push'](_0x197b38['shift']());}};_0x20a23a(++_0x394a4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5850c0,_0x3c2c){var _0x113882=function(_0x1d8200){while(--_0x1d8200){_0x5850c0['push'](_0x5850c0['shift']());}};_0x113882(++_0x3c2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index cb6c036..1029f6a 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 _0x58ac=['define','int_zoho_fields','zoho_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x35ac44,_0x246096){var _0x1751bf=function(_0x47d30d){while(--_0x47d30d){_0x35ac44['push'](_0x35ac44['shift']());}};_0x1751bf(++_0x246096);}(_0x58ac,0x8b));var _0xc58a=function(_0x1527e4,_0xcd0fe8){_0x1527e4=_0x1527e4-0x0;var _0x52aff0=_0x58ac[_0x1527e4];return _0x52aff0;};'use strict';var _=require('lodash');var util=require(_0xc58a('0x0'));var logger=require(_0xc58a('0x1'))(_0xc58a('0x2'));var moment=require(_0xc58a('0x3'));var BPromise=require(_0xc58a('0x4'));var rp=require(_0xc58a('0x5'));var fs=require('fs');var path=require(_0xc58a('0x6'));var rimraf=require(_0xc58a('0x7'));var config=require(_0xc58a('0x8'));var attributes=require(_0xc58a('0x9'));module[_0xc58a('0xa')]=function(_0x46eb31,_0x33811d){return _0x46eb31[_0xc58a('0xb')]('ZohoField',attributes,{'tableName':_0xc58a('0xc'),'paranoid':![],'indexes':[{'name':_0xc58a('0xd'),'fields':[_0xc58a('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf06=['path','../../config/environment','./intZohoField.attributes','exports','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdf06,0xa4));var _0x6df0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdf06[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6df0('0x0'));var util=require(_0x6df0('0x1'));var logger=require('../../config/logger')(_0x6df0('0x2'));var moment=require('moment');var BPromise=require(_0x6df0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6df0('0x4'));var rimraf=require('rimraf');var config=require(_0x6df0('0x5'));var attributes=require(_0x6df0('0x6'));module[_0x6df0('0x7')]=function(_0x277d0a,_0x8353cc){return _0x277d0a['define'](_0x6df0('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6df0('0x9'),'fields':[_0x6df0('0xa'),_0x6df0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 218bfb3..b9e8220 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 _0x9c5a=['http','then','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x11b35c,_0x97d450){var _0x5d4c91=function(_0x2e05b1){while(--_0x2e05b1){_0x11b35c['push'](_0x11b35c['shift']());}};_0x5d4c91(++_0x97d450);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4a0bd4,_0x2406d8){_0x4a0bd4=_0x4a0bd4-0x0;var _0x31c8f6=_0x9c5a[_0x4a0bd4];return _0x31c8f6;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('ZohoField,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0xd2ea=['../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1eda1d,_0x54a29e){var _0x51638e=function(_0x38f46f){while(--_0x38f46f){_0x1eda1d['push'](_0x1eda1d['shift']());}};_0x51638e(++_0x54a29e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x23e984,_0x587ae8){_0x23e984=_0x23e984-0x0;var _0x345944=_0xd2ea[_0x23e984];return _0x345944;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 4a3637d..45e0545 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 _0x717e=['Router','../../components/auth/service','exports','multer','util','connect-timeout'];(function(_0x37e2db,_0x2e77a0){var _0x362746=function(_0x563f62){while(--_0x563f62){_0x37e2db['push'](_0x37e2db['shift']());}};_0x362746(++_0x2e77a0);}(_0x717e,0x135));var _0xe717=function(_0x5628b8,_0x145582){_0x5628b8=_0x5628b8-0x0;var _0x3ce423=_0x717e[_0x5628b8];return _0x3ce423;};'use strict';var multer=require(_0xe717('0x0'));var util=require(_0xe717('0x1'));var path=require('path');var timeout=require(_0xe717('0x2'));var express=require('express');var router=express[_0xe717('0x3')]();var auth=require(_0xe717('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xe717('0x5')]=router; \ No newline at end of file +var _0xea70=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x12c63c,_0x34e7da){var _0x59b23e=function(_0x1a8712){while(--_0x1a8712){_0x12c63c['push'](_0x12c63c['shift']());}};_0x59b23e(++_0x34e7da);}(_0xea70,0x137));var _0x0ea7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xea70[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var path=require('path');var timeout=require(_0x0ea7('0x2'));var express=require(_0x0ea7('0x3'));var router=express[_0x0ea7('0x4')]();var auth=require(_0x0ea7('0x5'));var interaction=require(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));module[_0x0ea7('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ad7ed9c..7bc6a56 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 _0x21b6=['sequelize','exports','unique_name_and_version','STRING','INTEGER','BOOLEAN','state'];(function(_0x5cc0f0,_0x288adf){var _0x2bf272=function(_0x4f4ba8){while(--_0x4f4ba8){_0x5cc0f0['push'](_0x5cc0f0['shift']());}};_0x2bf272(++_0x288adf);}(_0x21b6,0x134));var _0x621b=function(_0x110fee,_0x31a8f1){_0x110fee=_0x110fee-0x0;var _0xbed7ce=_0x21b6[_0x110fee];return _0xbed7ce;};'use strict';var Sequelize=require(_0x621b('0x0'));module[_0x621b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x621b('0x2')},'version':{'type':Sequelize[_0x621b('0x3')],'allowNull':![],'unique':_0x621b('0x2')},'main':{'type':Sequelize[_0x621b('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x621b('0x3')]},'type':{'type':Sequelize[_0x621b('0x3')]},'size':{'type':Sequelize[_0x621b('0x4')]},'active':{'type':Sequelize[_0x621b('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x621b('0x3')]},'logo':{'type':Sequelize[_0x621b('0x3')]},'state':{'type':Sequelize[_0x621b('0x3')],'unique':_0x621b('0x6')},'description':{'type':Sequelize[_0x621b('0x3')]},'title':{'type':Sequelize[_0x621b('0x3')]},'remoteUri':{'type':Sequelize[_0x621b('0x3')]},'link':{'type':Sequelize[_0x621b('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x337b=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x2b2346,_0x52b117){var _0x782096=function(_0x422b47){while(--_0x422b47){_0x2b2346['push'](_0x2b2346['shift']());}};_0x782096(++_0x52b117);}(_0x337b,0x13a));var _0xb337=function(_0x5e1080,_0x51aeda){_0x5e1080=_0x5e1080-0x0;var _0x12b647=_0x337b[_0x5e1080];return _0x12b647;};'use strict';var Sequelize=require(_0xb337('0x0'));module['exports']={'name':{'type':Sequelize[_0xb337('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xb337('0x1')],'allowNull':![],'unique':_0xb337('0x2')},'main':{'type':Sequelize[_0xb337('0x1')],'defaultValue':_0xb337('0x3')},'filename':{'type':Sequelize[_0xb337('0x1')]},'path':{'type':Sequelize[_0xb337('0x1')]},'type':{'type':Sequelize[_0xb337('0x1')]},'size':{'type':Sequelize[_0xb337('0x4')]},'active':{'type':Sequelize[_0xb337('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb337('0x1')],'unique':_0xb337('0x6')},'description':{'type':Sequelize[_0xb337('0x1')]},'title':{'type':Sequelize[_0xb337('0x1')]},'remoteUri':{'type':Sequelize[_0xb337('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b0a7c92..1b8b5f7 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 _0x5586=['eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','end','error','stack','name','send','index','map','Integration','key','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','destroy','html-pdf'];(function(_0x3fa552,_0x5da82c){var _0x44a74a=function(_0x337b88){while(--_0x337b88){_0x3fa552['push'](_0x3fa552['shift']());}};_0x44a74a(++_0x5da82c);}(_0x5586,0xc5));var _0x6558=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x5586[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require(_0x6558('0x0'));var emlformat=require(_0x6558('0x1'));var rimraf=require(_0x6558('0x2'));var zipdir=require(_0x6558('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6558('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6558('0x5'));var util=require(_0x6558('0x6'));var path=require(_0x6558('0x7'));var sox=require(_0x6558('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6558('0x9'));var squel=require(_0x6558('0xa'));var crypto=require('crypto');var jsforce=require(_0x6558('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6558('0xc'));var querystring=require(_0x6558('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6558('0xe'));var qs=require(_0x6558('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6558('0x10'));var utils=require(_0x6558('0x11'));var config=require('../../config/environment');var db=require(_0x6558('0x12'))['db'];function respondWithStatusCode(_0x46d599,_0x27eb09){_0x27eb09=_0x27eb09||0xcc;return function(_0x5befb2){if(_0x5befb2){return _0x46d599[_0x6558('0x13')](_0x27eb09);}return _0x46d599[_0x6558('0x14')](_0x27eb09)['end']();};}function respondWithResult(_0x105335,_0x270301){_0x270301=_0x270301||0xc8;return function(_0x1fb581){if(_0x1fb581){return _0x105335['status'](_0x270301)[_0x6558('0x15')](_0x1fb581);}};}function respondWithFilteredResult(_0x1c2ef8,_0x50d322){return function(_0x359202){if(_0x359202){var _0x5c8329=_0x359202[_0x6558('0x16')],_0x3c1a5a=_0x50d322[_0x6558('0x17')],_0x4c645d=_0x50d322[_0x6558('0x17')]+_0x50d322[_0x6558('0x18')],_0x37afaf;if(_0x4c645d>=_0x5c8329){_0x4c645d=_0x5c8329;_0x37afaf=0xc8;}else{_0x37afaf=0xce;}_0x1c2ef8[_0x6558('0x14')](_0x37afaf);return _0x1c2ef8['set']('Content-Range',_0x3c1a5a+'-'+_0x4c645d+'/'+_0x5c8329)[_0x6558('0x15')](_0x359202);}return null;};}function patchUpdates(_0x46cacb){return function(_0x40814e){try{jsonpatch[_0x6558('0x19')](_0x40814e,_0x46cacb,!![]);}catch(_0x46db78){return BPromise['reject'](_0x46db78);}return _0x40814e[_0x6558('0x1a')]();};}function saveUpdates(_0x1bb2d8,_0x58db17){return function(_0x388c72){if(_0x388c72){return _0x388c72[_0x6558('0x1b')](_0x1bb2d8)[_0x6558('0x1c')](function(_0x479928){return _0x479928;});}return null;};}function removeEntity(_0x51bc52,_0x121ec4){return function(_0x1daa41){if(_0x1daa41){return _0x1daa41['destroy']()[_0x6558('0x1c')](function(){_0x51bc52[_0x6558('0x14')](0xcc)[_0x6558('0x1d')]();});}};}function handleEntityNotFound(_0x29d124,_0x2645d0){return function(_0x5b0097){if(!_0x5b0097){_0x29d124['sendStatus'](0x194);}return _0x5b0097;};}function handleError(_0x2f6e6f,_0x2a6cca){_0x2a6cca=_0x2a6cca||0x1f4;return function(_0x3cacd9){logger[_0x6558('0x1e')](_0x3cacd9[_0x6558('0x1f')]);if(_0x3cacd9[_0x6558('0x20')]){delete _0x3cacd9['name'];}_0x2f6e6f[_0x6558('0x14')](_0x2a6cca)[_0x6558('0x21')](_0x3cacd9);};}exports[_0x6558('0x22')]=function(_0x13816f,_0x3c0489){var _0x4fbef9={},_0x3f2846={},_0x166149={'count':0x0,'rows':[]};var _0x4660ae=_[_0x6558('0x23')](db[_0x6558('0x24')]['rawAttributes'],function(_0x2c46ae){return{'name':_0x2c46ae['fieldName'],'type':_0x2c46ae['type'][_0x6558('0x25')]};});_0x3f2846['model']=_['map'](_0x4660ae,_0x6558('0x20'));_0x3f2846[_0x6558('0x26')]=_['keys'](_0x13816f[_0x6558('0x26')]);_0x3f2846[_0x6558('0x27')]=_['intersection'](_0x3f2846[_0x6558('0x28')],_0x3f2846[_0x6558('0x26')]);_0x4fbef9[_0x6558('0x29')]=_['intersection'](_0x3f2846['model'],qs[_0x6558('0x2a')](_0x13816f[_0x6558('0x26')]['fields']));_0x4fbef9['attributes']=_0x4fbef9[_0x6558('0x29')][_0x6558('0x2b')]?_0x4fbef9[_0x6558('0x29')]:_0x3f2846[_0x6558('0x28')];if(!_0x13816f['query']['hasOwnProperty'](_0x6558('0x2c'))){_0x4fbef9[_0x6558('0x18')]=qs['limit'](_0x13816f[_0x6558('0x26')][_0x6558('0x18')]);_0x4fbef9[_0x6558('0x17')]=qs[_0x6558('0x17')](_0x13816f['query'][_0x6558('0x17')]);}_0x4fbef9[_0x6558('0x2d')]=qs[_0x6558('0x2e')](_0x13816f[_0x6558('0x26')][_0x6558('0x2e')]);_0x4fbef9[_0x6558('0x2f')]=qs[_0x6558('0x27')](_[_0x6558('0x30')](_0x13816f['query'],_0x3f2846[_0x6558('0x27')]),_0x4660ae);if(_0x13816f[_0x6558('0x26')][_0x6558('0x31')]){_0x4fbef9[_0x6558('0x2f')]=_[_0x6558('0x32')](_0x4fbef9[_0x6558('0x2f')],{'$or':_['map'](_0x4660ae,function(_0x23219d){if(_0x23219d[_0x6558('0x33')]!==_0x6558('0x34')){var _0x48d27f={};_0x48d27f[_0x23219d['name']]={'$like':'%'+_0x13816f[_0x6558('0x26')][_0x6558('0x31')]+'%'};return _0x48d27f;}})});}_0x4fbef9=_[_0x6558('0x32')]({},_0x4fbef9,_0x13816f[_0x6558('0x35')]);var _0xc09c96={'where':_0x4fbef9['where']};return db[_0x6558('0x24')][_0x6558('0x16')](_0xc09c96)['then'](function(_0xacb6a){_0x166149['count']=_0xacb6a;if(_0x13816f[_0x6558('0x26')][_0x6558('0x36')]){_0x4fbef9[_0x6558('0x37')]=[{'all':!![]}];}return db[_0x6558('0x24')][_0x6558('0x38')](_0x4fbef9);})[_0x6558('0x1c')](function(_0xb74c05){_0x166149[_0x6558('0x39')]=_0xb74c05;return _0x166149;})[_0x6558('0x1c')](respondWithFilteredResult(_0x3c0489,_0x4fbef9))[_0x6558('0x3a')](handleError(_0x3c0489,null));};exports[_0x6558('0x3b')]=function(_0x3b8815,_0x16dfdf){var _0x4fc4bb={'raw':![],'where':{'id':_0x3b8815[_0x6558('0x3c')]['id']}},_0x312158={};_0x312158['model']=_[_0x6558('0x3d')](db[_0x6558('0x24')]['rawAttributes']);_0x312158[_0x6558('0x26')]=_[_0x6558('0x3d')](_0x3b8815[_0x6558('0x26')]);_0x312158[_0x6558('0x27')]=_[_0x6558('0x3e')](_0x312158[_0x6558('0x28')],_0x312158[_0x6558('0x26')]);_0x4fc4bb['attributes']=_[_0x6558('0x3e')](_0x312158[_0x6558('0x28')],qs[_0x6558('0x2a')](_0x3b8815[_0x6558('0x26')]['fields']));_0x4fc4bb[_0x6558('0x29')]=_0x4fc4bb[_0x6558('0x29')][_0x6558('0x2b')]?_0x4fc4bb['attributes']:_0x312158[_0x6558('0x28')];if(_0x3b8815[_0x6558('0x26')][_0x6558('0x36')]){_0x4fc4bb[_0x6558('0x37')]=[{'all':!![]}];}_0x4fc4bb=_['merge']({},_0x4fc4bb,_0x3b8815['options']);return db[_0x6558('0x24')]['find'](_0x4fc4bb)[_0x6558('0x1c')](handleEntityNotFound(_0x16dfdf,null))[_0x6558('0x1c')](respondWithResult(_0x16dfdf,null))[_0x6558('0x3a')](handleError(_0x16dfdf,null));};exports[_0x6558('0x3f')]=function(_0x1b6e2a,_0x290471){return db[_0x6558('0x24')][_0x6558('0x3f')](_0x1b6e2a[_0x6558('0x40')],{})['then'](respondWithResult(_0x290471,0xc9))[_0x6558('0x3a')](handleError(_0x290471,null));};exports['update']=function(_0x1013d9,_0x113646){if(_0x1013d9[_0x6558('0x40')]['id']){delete _0x1013d9['body']['id'];}return db[_0x6558('0x24')]['find']({'where':{'id':_0x1013d9['params']['id']}})['then'](handleEntityNotFound(_0x113646,null))[_0x6558('0x1c')](saveUpdates(_0x1013d9[_0x6558('0x40')],null))[_0x6558('0x1c')](respondWithResult(_0x113646,null))[_0x6558('0x3a')](handleError(_0x113646,null));};exports[_0x6558('0x41')]=function(_0x41f252,_0xfd050d){return db[_0x6558('0x24')]['find']({'where':{'id':_0x41f252[_0x6558('0x3c')]['id']}})['then'](handleEntityNotFound(_0xfd050d,null))[_0x6558('0x1c')](removeEntity(_0xfd050d,null))[_0x6558('0x3a')](handleError(_0xfd050d,null));}; \ No newline at end of file +var _0x6079=['key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','type','merge','options','count','include','findAll','params','keys','length','includeAll','catch','body','find','html-pdf','eml-format','rimraf','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','map','Integration','fieldName'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6079,0x1da));var _0x9607=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x6079[_0x3a6e4b];return _0x36572d;};'use strict';var pdf=require(_0x9607('0x0'));var emlformat=require(_0x9607('0x1'));var rimraf=require(_0x9607('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9607('0x3'));var Mustache=require(_0x9607('0x4'));var util=require(_0x9607('0x5'));var path=require(_0x9607('0x6'));var sox=require('sox');var csv=require(_0x9607('0x7'));var ejs=require(_0x9607('0x8'));var fs=require('fs');var _=require(_0x9607('0x9'));var squel=require(_0x9607('0xa'));var crypto=require(_0x9607('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9607('0xc'));var toCsv=require(_0x9607('0x7'));var querystring=require('querystring');var Papa=require(_0x9607('0xd'));var Redis=require(_0x9607('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9607('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9607('0x10'))(_0x9607('0x11'));var utils=require(_0x9607('0x12'));var config=require(_0x9607('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5660c4,_0x332e5a){_0x332e5a=_0x332e5a||0xcc;return function(_0x14e1fd){if(_0x14e1fd){return _0x5660c4['sendStatus'](_0x332e5a);}return _0x5660c4[_0x9607('0x14')](_0x332e5a)[_0x9607('0x15')]();};}function respondWithResult(_0x37a547,_0x59b6df){_0x59b6df=_0x59b6df||0xc8;return function(_0x31e81d){if(_0x31e81d){return _0x37a547['status'](_0x59b6df)[_0x9607('0x16')](_0x31e81d);}};}function respondWithFilteredResult(_0x59395e,_0x36ba54){return function(_0x4b24f3){if(_0x4b24f3){var _0x2261b3=_0x4b24f3['count'],_0x588a80=_0x36ba54[_0x9607('0x17')],_0x2c892d=_0x36ba54[_0x9607('0x17')]+_0x36ba54[_0x9607('0x18')],_0x1e2a11;if(_0x2c892d>=_0x2261b3){_0x2c892d=_0x2261b3;_0x1e2a11=0xc8;}else{_0x1e2a11=0xce;}_0x59395e[_0x9607('0x14')](_0x1e2a11);return _0x59395e[_0x9607('0x19')](_0x9607('0x1a'),_0x588a80+'-'+_0x2c892d+'/'+_0x2261b3)[_0x9607('0x16')](_0x4b24f3);}return null;};}function patchUpdates(_0x3b2f5d){return function(_0x4c007f){try{jsonpatch[_0x9607('0x1b')](_0x4c007f,_0x3b2f5d,!![]);}catch(_0x3a744f){return BPromise[_0x9607('0x1c')](_0x3a744f);}return _0x4c007f['save']();};}function saveUpdates(_0x4f0111,_0x3471ac){return function(_0x3d9033){if(_0x3d9033){return _0x3d9033[_0x9607('0x1d')](_0x4f0111)['then'](function(_0x5d825f){return _0x5d825f;});}return null;};}function removeEntity(_0x5e4946,_0x47eaea){return function(_0x6f3052){if(_0x6f3052){return _0x6f3052[_0x9607('0x1e')]()[_0x9607('0x1f')](function(){_0x5e4946[_0x9607('0x14')](0xcc)[_0x9607('0x15')]();});}};}function handleEntityNotFound(_0x6dc0af,_0x4e9735){return function(_0x3ecd8d){if(!_0x3ecd8d){_0x6dc0af[_0x9607('0x20')](0x194);}return _0x3ecd8d;};}function handleError(_0x5d6368,_0x26012){_0x26012=_0x26012||0x1f4;return function(_0x26f705){logger['error'](_0x26f705[_0x9607('0x21')]);if(_0x26f705[_0x9607('0x22')]){delete _0x26f705[_0x9607('0x22')];}_0x5d6368[_0x9607('0x14')](_0x26012)['send'](_0x26f705);};}exports['index']=function(_0x2cd15,_0x4b2fcc){var _0x428c14={},_0x419157={},_0x315fa9={'count':0x0,'rows':[]};var _0x2365e7=_[_0x9607('0x23')](db[_0x9607('0x24')]['rawAttributes'],function(_0x162733){return{'name':_0x162733[_0x9607('0x25')],'type':_0x162733['type'][_0x9607('0x26')]};});_0x419157[_0x9607('0x27')]=_['map'](_0x2365e7,_0x9607('0x22'));_0x419157[_0x9607('0x28')]=_['keys'](_0x2cd15['query']);_0x419157[_0x9607('0x29')]=_['intersection'](_0x419157[_0x9607('0x27')],_0x419157[_0x9607('0x28')]);_0x428c14[_0x9607('0x2a')]=_[_0x9607('0x2b')](_0x419157[_0x9607('0x27')],qs[_0x9607('0x2c')](_0x2cd15[_0x9607('0x28')]['fields']));_0x428c14[_0x9607('0x2a')]=_0x428c14['attributes']['length']?_0x428c14[_0x9607('0x2a')]:_0x419157['model'];if(!_0x2cd15['query'][_0x9607('0x2d')](_0x9607('0x2e'))){_0x428c14[_0x9607('0x18')]=qs[_0x9607('0x18')](_0x2cd15[_0x9607('0x28')]['limit']);_0x428c14['offset']=qs[_0x9607('0x17')](_0x2cd15['query'][_0x9607('0x17')]);}_0x428c14[_0x9607('0x2f')]=qs[_0x9607('0x30')](_0x2cd15['query']['sort']);_0x428c14['where']=qs[_0x9607('0x29')](_['pick'](_0x2cd15[_0x9607('0x28')],_0x419157['filters']),_0x2365e7);if(_0x2cd15[_0x9607('0x28')][_0x9607('0x31')]){_0x428c14[_0x9607('0x32')]=_['merge'](_0x428c14[_0x9607('0x32')],{'$or':_[_0x9607('0x23')](_0x2365e7,function(_0x5a44fa){if(_0x5a44fa[_0x9607('0x33')]!=='VIRTUAL'){var _0x108c45={};_0x108c45[_0x5a44fa[_0x9607('0x22')]]={'$like':'%'+_0x2cd15['query'][_0x9607('0x31')]+'%'};return _0x108c45;}})});}_0x428c14=_[_0x9607('0x34')]({},_0x428c14,_0x2cd15[_0x9607('0x35')]);var _0xef17b1={'where':_0x428c14['where']};return db[_0x9607('0x24')][_0x9607('0x36')](_0xef17b1)['then'](function(_0x29a4f2){_0x315fa9[_0x9607('0x36')]=_0x29a4f2;if(_0x2cd15[_0x9607('0x28')]['includeAll']){_0x428c14[_0x9607('0x37')]=[{'all':!![]}];}return db[_0x9607('0x24')][_0x9607('0x38')](_0x428c14);})[_0x9607('0x1f')](function(_0x44eaf5){_0x315fa9['rows']=_0x44eaf5;return _0x315fa9;})[_0x9607('0x1f')](respondWithFilteredResult(_0x4b2fcc,_0x428c14))['catch'](handleError(_0x4b2fcc,null));};exports['show']=function(_0x3a316b,_0x53c6d9){var _0x2633ea={'raw':![],'where':{'id':_0x3a316b[_0x9607('0x39')]['id']}},_0x144cc7={};_0x144cc7['model']=_[_0x9607('0x3a')](db['Integration']['rawAttributes']);_0x144cc7[_0x9607('0x28')]=_['keys'](_0x3a316b['query']);_0x144cc7[_0x9607('0x29')]=_[_0x9607('0x2b')](_0x144cc7[_0x9607('0x27')],_0x144cc7['query']);_0x2633ea['attributes']=_[_0x9607('0x2b')](_0x144cc7[_0x9607('0x27')],qs[_0x9607('0x2c')](_0x3a316b[_0x9607('0x28')][_0x9607('0x2c')]));_0x2633ea['attributes']=_0x2633ea['attributes'][_0x9607('0x3b')]?_0x2633ea[_0x9607('0x2a')]:_0x144cc7[_0x9607('0x27')];if(_0x3a316b[_0x9607('0x28')][_0x9607('0x3c')]){_0x2633ea['include']=[{'all':!![]}];}_0x2633ea=_['merge']({},_0x2633ea,_0x3a316b[_0x9607('0x35')]);return db[_0x9607('0x24')]['find'](_0x2633ea)[_0x9607('0x1f')](handleEntityNotFound(_0x53c6d9,null))[_0x9607('0x1f')](respondWithResult(_0x53c6d9,null))[_0x9607('0x3d')](handleError(_0x53c6d9,null));};exports['create']=function(_0x39dcbf,_0x5ee7f6){return db[_0x9607('0x24')]['create'](_0x39dcbf[_0x9607('0x3e')],{})['then'](respondWithResult(_0x5ee7f6,0xc9))[_0x9607('0x3d')](handleError(_0x5ee7f6,null));};exports['update']=function(_0x3b9962,_0x562413){if(_0x3b9962[_0x9607('0x3e')]['id']){delete _0x3b9962[_0x9607('0x3e')]['id'];}return db['Integration'][_0x9607('0x3f')]({'where':{'id':_0x3b9962['params']['id']}})['then'](handleEntityNotFound(_0x562413,null))[_0x9607('0x1f')](saveUpdates(_0x3b9962['body'],null))[_0x9607('0x1f')](respondWithResult(_0x562413,null))['catch'](handleError(_0x562413,null));};exports[_0x9607('0x1e')]=function(_0x514782,_0x58086b){return db['Integration'][_0x9607('0x3f')]({'where':{'id':_0x514782[_0x9607('0x39')]['id']}})['then'](handleEntityNotFound(_0x58086b,null))[_0x9607('0x1f')](removeEntity(_0x58086b,null))[_0x9607('0x3d')](handleError(_0x58086b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7d1f41e..35a8c6b 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 _0xbc18=['api','moment','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbc18,0x75));var _0x8bc1=function(_0x69ea92,_0x14506b){_0x69ea92=_0x69ea92-0x0;var _0x45b8ea=_0xbc18[_0x69ea92];return _0x45b8ea;};'use strict';var _=require(_0x8bc1('0x0'));var util=require(_0x8bc1('0x1'));var logger=require(_0x8bc1('0x2'))(_0x8bc1('0x3'));var moment=require(_0x8bc1('0x4'));var BPromise=require('bluebird');var rp=require(_0x8bc1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bc1('0x6'));var config=require(_0x8bc1('0x7'));var attributes=require(_0x8bc1('0x8'));module[_0x8bc1('0x9')]=function(_0x4cc497,_0x17920d){return _0x4cc497[_0x8bc1('0xa')](_0x8bc1('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b1=['../../config/environment','exports','util','api','moment','request-promise'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xd0b1,0x128));var _0x1d0b=function(_0x2dc37c,_0x2b8c48){_0x2dc37c=_0x2dc37c-0x0;var _0x345f53=_0xd0b1[_0x2dc37c];return _0x345f53;};'use strict';var _=require('lodash');var util=require(_0x1d0b('0x0'));var logger=require('../../config/logger')(_0x1d0b('0x1'));var moment=require(_0x1d0b('0x2'));var BPromise=require('bluebird');var rp=require(_0x1d0b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d0b('0x4'));var attributes=require('./integration.attributes');module[_0x1d0b('0x5')]=function(_0x47f7d3,_0x4371e2){return _0x47f7d3['define']('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 0ff21ea..1de5421 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 _0x75a2=['debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x75a2,0x187));var _0x275a=function(_0x58695b,_0x34d32f){_0x58695b=_0x58695b-0x0;var _0x3fa86d=_0x75a2[_0x58695b];return _0x3fa86d;};'use strict';var _=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var moment=require(_0x275a('0x2'));var BPromise=require('bluebird');var rs=require(_0x275a('0x3'));var fs=require('fs');var Redis=require(_0x275a('0x4'));var db=require(_0x275a('0x5'))['db'];var utils=require(_0x275a('0x6'));var logger=require('../../config/logger')(_0x275a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32f0cb,_0x12cad9,_0x17ad5e){return new BPromise(function(_0x38b303,_0x525950){return client['request'](_0x32f0cb,_0x17ad5e)[_0x275a('0x8')](function(_0x46f9c7){logger['info']('Integration,\x20%s,\x20%s',_0x12cad9,'request\x20sent');logger[_0x275a('0x9')](_0x275a('0xa'),_0x12cad9,_0x275a('0xb'),JSON[_0x275a('0xc')](_0x46f9c7));if(_0x46f9c7[_0x275a('0xd')]){if(_0x46f9c7[_0x275a('0xd')][_0x275a('0xe')]===0x1f4){logger[_0x275a('0xd')](_0x275a('0xf'),_0x12cad9,_0x46f9c7[_0x275a('0xd')][_0x275a('0x10')]);return _0x525950(_0x46f9c7['error'][_0x275a('0x10')]);}logger[_0x275a('0xd')]('Integration,\x20%s,\x20%s',_0x12cad9,_0x46f9c7['error'][_0x275a('0x10')]);return _0x38b303(_0x46f9c7[_0x275a('0xd')][_0x275a('0x10')]);}else{logger[_0x275a('0x11')](_0x275a('0xf'),_0x12cad9,_0x275a('0xb'));_0x38b303(_0x46f9c7[_0x275a('0x12')][_0x275a('0x10')]);}})[_0x275a('0x13')](function(_0x58e54d){logger['error'](_0x275a('0xf'),_0x12cad9,_0x58e54d);_0x525950(_0x58e54d);});});} \ No newline at end of file +var _0xbbb8=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x5b2dd2,_0xb6258){_0x5b2dd2=_0x5b2dd2-0x0;var _0x252ad4=_0xbbb8[_0x5b2dd2];return _0x252ad4;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var moment=require('moment');var BPromise=require(_0x8bbb('0x2'));var rs=require(_0x8bbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bbb('0x4'))['db'];var utils=require(_0x8bbb('0x5'));var logger=require(_0x8bbb('0x6'))(_0x8bbb('0x7'));var config=require(_0x8bbb('0x8'));var jayson=require(_0x8bbb('0x9'));var client=jayson[_0x8bbb('0xa')][_0x8bbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d7098,_0x4bbc55,_0x5c744c){return new BPromise(function(_0x4da98e,_0x2d69aa){return client[_0x8bbb('0xc')](_0x2d7098,_0x5c744c)[_0x8bbb('0xd')](function(_0x3a6ced){logger[_0x8bbb('0xe')](_0x8bbb('0xf'),_0x4bbc55,_0x8bbb('0x10'));logger[_0x8bbb('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0x4bbc55,_0x8bbb('0x10'),JSON[_0x8bbb('0x12')](_0x3a6ced));if(_0x3a6ced[_0x8bbb('0x13')]){if(_0x3a6ced['error'][_0x8bbb('0x14')]===0x1f4){logger[_0x8bbb('0x13')](_0x8bbb('0xf'),_0x4bbc55,_0x3a6ced['error'][_0x8bbb('0x15')]);return _0x2d69aa(_0x3a6ced[_0x8bbb('0x13')][_0x8bbb('0x15')]);}logger[_0x8bbb('0x13')]('Integration,\x20%s,\x20%s',_0x4bbc55,_0x3a6ced[_0x8bbb('0x13')][_0x8bbb('0x15')]);return _0x4da98e(_0x3a6ced['error'][_0x8bbb('0x15')]);}else{logger[_0x8bbb('0xe')](_0x8bbb('0xf'),_0x4bbc55,_0x8bbb('0x10'));_0x4da98e(_0x3a6ced[_0x8bbb('0x16')][_0x8bbb('0x15')]);}})[_0x8bbb('0x17')](function(_0x15643c){logger[_0x8bbb('0x13')](_0x8bbb('0xf'),_0x4bbc55,_0x15643c);_0x2d69aa(_0x15643c);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index dcdbec7..3cfc38f 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 _0xfa7c=['index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x37a0f5,_0x585f76){_0x37a0f5=_0x37a0f5-0x0;var _0x499af1=_0xfa7c[_0x37a0f5];return _0x499af1;};'use strict';var multer=require(_0xcfa7('0x0'));var util=require('util');var path=require(_0xcfa7('0x1'));var timeout=require(_0xcfa7('0x2'));var express=require(_0xcfa7('0x3'));var router=express[_0xcfa7('0x4')]();var auth=require(_0xcfa7('0x5'));var interaction=require(_0xcfa7('0x6'));var config=require(_0xcfa7('0x7'));var controller=require(_0xcfa7('0x8'));router['get']('/',auth[_0xcfa7('0x9')](),controller[_0xcfa7('0xa')]);router[_0xcfa7('0xb')](_0xcfa7('0xc'),auth['isAuthenticated'](),controller[_0xcfa7('0xd')]);router[_0xcfa7('0xb')](_0xcfa7('0xe'),auth[_0xcfa7('0x9')](),controller[_0xcfa7('0xf')]);router[_0xcfa7('0x10')]('/',auth['isAuthenticated'](),controller[_0xcfa7('0x11')]);router[_0xcfa7('0x12')](_0xcfa7('0xe'),auth[_0xcfa7('0x9')](),controller[_0xcfa7('0x13')]);router['delete']('/:id',auth[_0xcfa7('0x9')](),controller['destroy']);module[_0xcfa7('0x14')]=router; \ No newline at end of file +var _0x1f31=['update','delete','destroy','exports','connect-timeout','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x56c672,_0x17fae1){var _0x5cf583=function(_0xf94f2a){while(--_0xf94f2a){_0x56c672['push'](_0x56c672['shift']());}};_0x5cf583(++_0x17fae1);}(_0x1f31,0xca));var _0x11f3=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0x1f31[_0x233716];return _0x302298;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x11f3('0x0'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x11f3('0x1'));var config=require(_0x11f3('0x2'));var controller=require(_0x11f3('0x3'));router[_0x11f3('0x4')]('/',auth['isAuthenticated'](),controller[_0x11f3('0x5')]);router[_0x11f3('0x4')](_0x11f3('0x6'),auth[_0x11f3('0x7')](),controller[_0x11f3('0x8')]);router[_0x11f3('0x4')](_0x11f3('0x9'),auth[_0x11f3('0x7')](),controller[_0x11f3('0xa')]);router[_0x11f3('0xb')]('/',auth[_0x11f3('0x7')](),controller[_0x11f3('0xc')]);router[_0x11f3('0xd')](_0x11f3('0x9'),auth['isAuthenticated'](),controller[_0x11f3('0xe')]);router[_0x11f3('0xf')](_0x11f3('0x9'),auth['isAuthenticated'](),controller[_0x11f3('0x10')]);module[_0x11f3('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 349b388..5848607 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 _0x410e=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x44cb87,_0x2db36c){var _0x447459=function(_0x21053c){while(--_0x21053c){_0x44cb87['push'](_0x44cb87['shift']());}};_0x447459(++_0x2db36c);}(_0x410e,0x17f));var _0xe410=function(_0x149fb9,_0x257326){_0x149fb9=_0x149fb9-0x0;var _0x36399a=_0x410e[_0x149fb9];return _0x36399a;};'use strict';var Sequelize=require(_0xe410('0x0'));module[_0xe410('0x1')]={'integration':{'type':Sequelize[_0xe410('0x2')]},'eventChannel':{'type':Sequelize[_0xe410('0x2')]},'exitStatus':{'type':Sequelize[_0xe410('0x2')]},'ticketId':{'type':Sequelize[_0xe410('0x2')]},'integrationId':{'type':Sequelize[_0xe410('0x3')]},'contacts':{'type':Sequelize[_0xe410('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe410('0x2')]},'calleridname':{'type':Sequelize[_0xe410('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe410('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe410('0x4')]},'agentconnectAt':{'type':Sequelize[_0xe410('0x4')]},'holdtime':{'type':Sequelize[_0xe410('0x3')]},'agentcomplete':{'type':Sequelize[_0xe410('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe410('0x4')]},'talktime':{'type':Sequelize[_0xe410('0x3')]},'agentacw':{'type':Sequelize[_0xe410('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xe410('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xe410('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe410('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe410('0x2')]},'channelstate':{'type':Sequelize[_0xe410('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe410('0x2')]},'connectedlinename':{'type':Sequelize[_0xe410('0x2')]},'language':{'type':Sequelize[_0xe410('0x2')]},'accountcode':{'type':Sequelize[_0xe410('0x2')]},'context':{'type':Sequelize[_0xe410('0x2')]},'exten':{'type':Sequelize[_0xe410('0x2')]},'priority':{'type':Sequelize[_0xe410('0x2')]},'destchannel':{'type':Sequelize[_0xe410('0x2')]},'destchannelstate':{'type':Sequelize[_0xe410('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe410('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe410('0x2')]},'destcalleridname':{'type':Sequelize[_0xe410('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe410('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe410('0x2')]},'destlanguage':{'type':Sequelize[_0xe410('0x2')]},'destaccountcode':{'type':Sequelize[_0xe410('0x2')]},'destcontext':{'type':Sequelize[_0xe410('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe410('0x2')]},'destuniqueid':{'type':Sequelize[_0xe410('0x2')]},'messageId':{'type':Sequelize[_0xe410('0x2')]},'inReplyTo':{'type':Sequelize[_0xe410('0x2')]},'subject':{'type':Sequelize[_0xe410('0x2')]},'from':{'type':Sequelize[_0xe410('0x2')]},'to':{'type':Sequelize[_0xe410('0x2')]},'cc':{'type':Sequelize[_0xe410('0x2')]},'attachment':{'type':Sequelize[_0xe410('0x6')]},'html':{'type':Sequelize[_0xe410('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xe410('0x7')](_0xe410('0x8'),_0xe410('0x9'),_0xe410('0xa'),_0xe410('0xb'))},'url':{'type':Sequelize[_0xe410('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xe410('0x2')]},'projectId':{'type':Sequelize[_0xe410('0x3')]}}; \ No newline at end of file +var _0xa4ba=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0xa4ba,0x1eb));var _0xaa4b=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xa4ba[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module[_0xaa4b('0x0')]={'integration':{'type':Sequelize[_0xaa4b('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xaa4b('0x1')]},'ticketId':{'type':Sequelize[_0xaa4b('0x1')]},'integrationId':{'type':Sequelize[_0xaa4b('0x2')]},'contacts':{'type':Sequelize[_0xaa4b('0x1')]},'uniqueid':{'type':Sequelize[_0xaa4b('0x1')]},'calleridnum':{'type':Sequelize[_0xaa4b('0x1')]},'calleridname':{'type':Sequelize[_0xaa4b('0x1')]},'queue':{'type':Sequelize[_0xaa4b('0x1')]},'interface':{'type':Sequelize[_0xaa4b('0x1')]},'membername':{'type':Sequelize[_0xaa4b('0x1')]},'agentcalledAt':{'type':Sequelize[_0xaa4b('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaa4b('0x3')]},'holdtime':{'type':Sequelize[_0xaa4b('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xaa4b('0x2')]},'agentacw':{'type':Sequelize[_0xaa4b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xaa4b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xaa4b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xaa4b('0x3')]},'agentdump':{'type':Sequelize[_0xaa4b('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xaa4b('0x3')]},'lastevent':{'type':Sequelize[_0xaa4b('0x1')]},'channel':{'type':Sequelize[_0xaa4b('0x1')]},'channelstate':{'type':Sequelize[_0xaa4b('0x2')]},'channelstatedesc':{'type':Sequelize[_0xaa4b('0x1')]},'connectedlinenum':{'type':Sequelize[_0xaa4b('0x1')]},'connectedlinename':{'type':Sequelize[_0xaa4b('0x1')]},'language':{'type':Sequelize[_0xaa4b('0x1')]},'accountcode':{'type':Sequelize[_0xaa4b('0x1')]},'context':{'type':Sequelize[_0xaa4b('0x1')]},'exten':{'type':Sequelize[_0xaa4b('0x1')]},'priority':{'type':Sequelize[_0xaa4b('0x1')]},'destchannel':{'type':Sequelize[_0xaa4b('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa4b('0x1')]},'destcalleridnum':{'type':Sequelize[_0xaa4b('0x1')]},'destcalleridname':{'type':Sequelize[_0xaa4b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xaa4b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xaa4b('0x1')]},'destlanguage':{'type':Sequelize[_0xaa4b('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xaa4b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xaa4b('0x1')]},'destuniqueid':{'type':Sequelize[_0xaa4b('0x1')]},'messageId':{'type':Sequelize[_0xaa4b('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xaa4b('0x1')]},'cc':{'type':Sequelize[_0xaa4b('0x1')]},'attachment':{'type':Sequelize[_0xaa4b('0x5')]},'html':{'type':Sequelize[_0xaa4b('0x5')]},'text':{'type':Sequelize[_0xaa4b('0x5')]},'status':{'type':Sequelize[_0xaa4b('0x6')](_0xaa4b('0x7'),_0xaa4b('0x8'),_0xaa4b('0x9'),_0xaa4b('0xa'))},'url':{'type':Sequelize[_0xaa4b('0x1')]},'app':{'type':Sequelize[_0xaa4b('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d6ded0e..3e06e9e 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 _0x0ea0=['IntegrationReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0ea0,0x1d6));var _0x00ea=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x0ea0[_0x396466];return _0x5e9ab4;};'use strict';var pdf=require(_0x00ea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00ea('0x2'));var rp=require('request-promise');var moment=require(_0x00ea('0x3'));var BPromise=require(_0x00ea('0x4'));var Mustache=require(_0x00ea('0x5'));var util=require('util');var path=require(_0x00ea('0x6'));var sox=require(_0x00ea('0x7'));var csv=require(_0x00ea('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x00ea('0x9'));var squel=require(_0x00ea('0xa'));var crypto=require(_0x00ea('0xb'));var jsforce=require(_0x00ea('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x00ea('0xd'));var Papa=require(_0x00ea('0xe'));var Redis=require('ioredis');var authService=require(_0x00ea('0xf'));var qs=require(_0x00ea('0x10'));var as=require(_0x00ea('0x11'));var hardwareService=require(_0x00ea('0x12'));var logger=require(_0x00ea('0x13'))(_0x00ea('0x14'));var utils=require(_0x00ea('0x15'));var config=require(_0x00ea('0x16'));var db=require(_0x00ea('0x17'))['db'];function respondWithStatusCode(_0x414e01,_0x1663c0){_0x1663c0=_0x1663c0||0xcc;return function(_0xe8db0b){if(_0xe8db0b){return _0x414e01[_0x00ea('0x18')](_0x1663c0);}return _0x414e01[_0x00ea('0x19')](_0x1663c0)[_0x00ea('0x1a')]();};}function respondWithResult(_0x552691,_0x1580d7){_0x1580d7=_0x1580d7||0xc8;return function(_0x4fa91c){if(_0x4fa91c){return _0x552691[_0x00ea('0x19')](_0x1580d7)[_0x00ea('0x1b')](_0x4fa91c);}};}function respondWithFilteredResult(_0x235161,_0x389ca7){return function(_0x51eb8b){if(_0x51eb8b){var _0x2a1a70=_0x51eb8b['count'],_0x15ed33=_0x389ca7[_0x00ea('0x1c')],_0x1737c5=_0x389ca7[_0x00ea('0x1c')]+_0x389ca7[_0x00ea('0x1d')],_0x17ed5f;if(_0x1737c5>=_0x2a1a70){_0x1737c5=_0x2a1a70;_0x17ed5f=0xc8;}else{_0x17ed5f=0xce;}_0x235161[_0x00ea('0x19')](_0x17ed5f);return _0x235161[_0x00ea('0x1e')](_0x00ea('0x1f'),_0x15ed33+'-'+_0x1737c5+'/'+_0x2a1a70)[_0x00ea('0x1b')](_0x51eb8b);}return null;};}function patchUpdates(_0x7381cf){return function(_0x495a24){try{jsonpatch['apply'](_0x495a24,_0x7381cf,!![]);}catch(_0x17ad1a){return BPromise[_0x00ea('0x20')](_0x17ad1a);}return _0x495a24['save']();};}function saveUpdates(_0x4e7e64,_0x5daa88){return function(_0x61cd23){if(_0x61cd23){return _0x61cd23[_0x00ea('0x21')](_0x4e7e64)[_0x00ea('0x22')](function(_0x25e5fb){return _0x25e5fb;});}return null;};}function removeEntity(_0x3ed3bf,_0x1fdecf){return function(_0x17b9e3){if(_0x17b9e3){return _0x17b9e3[_0x00ea('0x23')]()['then'](function(){_0x3ed3bf[_0x00ea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa7c36c,_0x38ad75){return function(_0x323b0a){if(!_0x323b0a){_0xa7c36c[_0x00ea('0x18')](0x194);}return _0x323b0a;};}function handleError(_0x33b703,_0x28ef69){_0x28ef69=_0x28ef69||0x1f4;return function(_0x4d4229){logger[_0x00ea('0x24')](_0x4d4229[_0x00ea('0x25')]);if(_0x4d4229[_0x00ea('0x26')]){delete _0x4d4229[_0x00ea('0x26')];}_0x33b703['status'](_0x28ef69)['send'](_0x4d4229);};}exports[_0x00ea('0x27')]=function(_0x247539,_0x2f270f){var _0x46f38b={},_0x4b16f5={},_0x41e391={'count':0x0,'rows':[]};var _0x5daf72=_[_0x00ea('0x28')](db[_0x00ea('0x29')][_0x00ea('0x2a')],function(_0x49b02d){return{'name':_0x49b02d[_0x00ea('0x2b')],'type':_0x49b02d[_0x00ea('0x2c')]['key']};});_0x4b16f5['model']=_['map'](_0x5daf72,_0x00ea('0x26'));_0x4b16f5[_0x00ea('0x2d')]=_[_0x00ea('0x2e')](_0x247539['query']);_0x4b16f5[_0x00ea('0x2f')]=_[_0x00ea('0x30')](_0x4b16f5['model'],_0x4b16f5[_0x00ea('0x2d')]);_0x46f38b[_0x00ea('0x31')]=_[_0x00ea('0x30')](_0x4b16f5[_0x00ea('0x32')],qs[_0x00ea('0x33')](_0x247539[_0x00ea('0x2d')][_0x00ea('0x33')]));_0x46f38b['attributes']=_0x46f38b[_0x00ea('0x31')]['length']?_0x46f38b[_0x00ea('0x31')]:_0x4b16f5[_0x00ea('0x32')];if(!_0x247539['query'][_0x00ea('0x34')]('nolimit')){_0x46f38b[_0x00ea('0x1d')]=qs[_0x00ea('0x1d')](_0x247539[_0x00ea('0x2d')][_0x00ea('0x1d')]);_0x46f38b[_0x00ea('0x1c')]=qs[_0x00ea('0x1c')](_0x247539['query'][_0x00ea('0x1c')]);}_0x46f38b[_0x00ea('0x35')]=qs['sort'](_0x247539[_0x00ea('0x2d')][_0x00ea('0x36')]);_0x46f38b[_0x00ea('0x37')]=qs[_0x00ea('0x2f')](_[_0x00ea('0x38')](_0x247539[_0x00ea('0x2d')],_0x4b16f5[_0x00ea('0x2f')]),_0x5daf72);if(_0x247539[_0x00ea('0x2d')][_0x00ea('0x39')]){_0x46f38b[_0x00ea('0x37')]=_['merge'](_0x46f38b['where'],{'$or':_[_0x00ea('0x28')](_0x5daf72,function(_0x45e820){if(_0x45e820['type']!==_0x00ea('0x3a')){var _0x131cd3={};_0x131cd3[_0x45e820[_0x00ea('0x26')]]={'$like':'%'+_0x247539[_0x00ea('0x2d')][_0x00ea('0x39')]+'%'};return _0x131cd3;}})});}_0x46f38b=_[_0x00ea('0x3b')]({},_0x46f38b,_0x247539[_0x00ea('0x3c')]);var _0x14e56f={'where':_0x46f38b[_0x00ea('0x37')]};return db[_0x00ea('0x29')]['count'](_0x14e56f)['then'](function(_0x40b0c9){_0x41e391[_0x00ea('0x3d')]=_0x40b0c9;if(_0x247539[_0x00ea('0x2d')][_0x00ea('0x3e')]){_0x46f38b[_0x00ea('0x3f')]=[{'all':!![]}];}return db[_0x00ea('0x29')][_0x00ea('0x40')](_0x46f38b);})['then'](function(_0x1f6849){_0x41e391[_0x00ea('0x41')]=_0x1f6849;return _0x41e391;})['then'](respondWithFilteredResult(_0x2f270f,_0x46f38b))[_0x00ea('0x42')](handleError(_0x2f270f,null));};exports['show']=function(_0x2ea026,_0x3ac341){var _0x287c7e={'raw':![],'where':{'id':_0x2ea026['params']['id']}},_0x3845e7={};_0x3845e7[_0x00ea('0x32')]=_['keys'](db[_0x00ea('0x29')][_0x00ea('0x2a')]);_0x3845e7[_0x00ea('0x2d')]=_['keys'](_0x2ea026[_0x00ea('0x2d')]);_0x3845e7[_0x00ea('0x2f')]=_[_0x00ea('0x30')](_0x3845e7['model'],_0x3845e7['query']);_0x287c7e[_0x00ea('0x31')]=_['intersection'](_0x3845e7[_0x00ea('0x32')],qs['fields'](_0x2ea026[_0x00ea('0x2d')][_0x00ea('0x33')]));_0x287c7e[_0x00ea('0x31')]=_0x287c7e[_0x00ea('0x31')][_0x00ea('0x43')]?_0x287c7e[_0x00ea('0x31')]:_0x3845e7[_0x00ea('0x32')];if(_0x2ea026[_0x00ea('0x2d')]['includeAll']){_0x287c7e[_0x00ea('0x3f')]=[{'all':!![]}];}_0x287c7e=_[_0x00ea('0x3b')]({},_0x287c7e,_0x2ea026[_0x00ea('0x3c')]);return db[_0x00ea('0x29')][_0x00ea('0x44')](_0x287c7e)['then'](handleEntityNotFound(_0x3ac341,null))[_0x00ea('0x22')](respondWithResult(_0x3ac341,null))[_0x00ea('0x42')](handleError(_0x3ac341,null));};exports[_0x00ea('0x45')]=function(_0xec13bb,_0x690885){return db['IntegrationReport'][_0x00ea('0x45')](_0xec13bb[_0x00ea('0x46')],{})[_0x00ea('0x22')](respondWithResult(_0x690885,0xc9))['catch'](handleError(_0x690885,null));};exports['update']=function(_0x18baf3,_0x547f9b){if(_0x18baf3[_0x00ea('0x46')]['id']){delete _0x18baf3['body']['id'];}return db[_0x00ea('0x29')]['find']({'where':{'id':_0x18baf3[_0x00ea('0x47')]['id']}})[_0x00ea('0x22')](handleEntityNotFound(_0x547f9b,null))['then'](saveUpdates(_0x18baf3['body'],null))['then'](respondWithResult(_0x547f9b,null))[_0x00ea('0x42')](handleError(_0x547f9b,null));};exports[_0x00ea('0x23')]=function(_0x6f72cd,_0x2979dd){return db[_0x00ea('0x29')][_0x00ea('0x44')]({'where':{'id':_0x6f72cd[_0x00ea('0x47')]['id']}})[_0x00ea('0x22')](handleEntityNotFound(_0x2979dd,null))[_0x00ea('0x22')](removeEntity(_0x2979dd,null))['catch'](handleError(_0x2979dd,null));};exports[_0x00ea('0x48')]=function(_0x4ade0c,_0x4a0473){return db[_0x00ea('0x29')][_0x00ea('0x48')]()[_0x00ea('0x22')](respondWithResult(_0x4a0473,null))['catch'](handleError(_0x4a0473,null));}; \ No newline at end of file +var _0xf835=['status','count','offset','limit','Content-Range','json','reject','update','then','destroy','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','IntegrationReport','findAll','rows','catch','show','params','rawAttributes','keys','length','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end'];(function(_0x4588f1,_0x1dcfa0){var _0x147c88=function(_0x19d791){while(--_0x19d791){_0x4588f1['push'](_0x4588f1['shift']());}};_0x147c88(++_0x1dcfa0);}(_0xf835,0x149));var _0x5f83=function(_0x27b0bb,_0x1e9640){_0x27b0bb=_0x27b0bb-0x0;var _0x5174a1=_0xf835[_0x27b0bb];return _0x5174a1;};'use strict';var pdf=require(_0x5f83('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5f83('0x1'));var zipdir=require(_0x5f83('0x2'));var jsonpatch=require(_0x5f83('0x3'));var rp=require(_0x5f83('0x4'));var moment=require(_0x5f83('0x5'));var BPromise=require(_0x5f83('0x6'));var Mustache=require('mustache');var util=require(_0x5f83('0x7'));var path=require(_0x5f83('0x8'));var sox=require(_0x5f83('0x9'));var csv=require(_0x5f83('0xa'));var ejs=require(_0x5f83('0xb'));var fs=require('fs');var _=require(_0x5f83('0xc'));var squel=require(_0x5f83('0xd'));var crypto=require('crypto');var jsforce=require(_0x5f83('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5f83('0xa'));var querystring=require('querystring');var Papa=require(_0x5f83('0xf'));var Redis=require(_0x5f83('0x10'));var authService=require(_0x5f83('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f83('0x12'));var hardwareService=require(_0x5f83('0x13'));var logger=require(_0x5f83('0x14'))(_0x5f83('0x15'));var utils=require(_0x5f83('0x16'));var config=require('../../config/environment');var db=require(_0x5f83('0x17'))['db'];function respondWithStatusCode(_0x15bd44,_0x335b71){_0x335b71=_0x335b71||0xcc;return function(_0x33527a){if(_0x33527a){return _0x15bd44[_0x5f83('0x18')](_0x335b71);}return _0x15bd44['status'](_0x335b71)[_0x5f83('0x19')]();};}function respondWithResult(_0x54de10,_0x34ab95){_0x34ab95=_0x34ab95||0xc8;return function(_0x1aef4d){if(_0x1aef4d){return _0x54de10[_0x5f83('0x1a')](_0x34ab95)['json'](_0x1aef4d);}};}function respondWithFilteredResult(_0x522392,_0x5756d5){return function(_0xf1a58d){if(_0xf1a58d){var _0x2a0afa=_0xf1a58d[_0x5f83('0x1b')],_0x4d7f81=_0x5756d5[_0x5f83('0x1c')],_0x307f59=_0x5756d5['offset']+_0x5756d5[_0x5f83('0x1d')],_0x5b8f0e;if(_0x307f59>=_0x2a0afa){_0x307f59=_0x2a0afa;_0x5b8f0e=0xc8;}else{_0x5b8f0e=0xce;}_0x522392[_0x5f83('0x1a')](_0x5b8f0e);return _0x522392['set'](_0x5f83('0x1e'),_0x4d7f81+'-'+_0x307f59+'/'+_0x2a0afa)[_0x5f83('0x1f')](_0xf1a58d);}return null;};}function patchUpdates(_0x502a11){return function(_0x449fdc){try{jsonpatch['apply'](_0x449fdc,_0x502a11,!![]);}catch(_0x5433d9){return BPromise[_0x5f83('0x20')](_0x5433d9);}return _0x449fdc['save']();};}function saveUpdates(_0x307a97,_0xbbc960){return function(_0x55bc34){if(_0x55bc34){return _0x55bc34[_0x5f83('0x21')](_0x307a97)[_0x5f83('0x22')](function(_0x17cfa3){return _0x17cfa3;});}return null;};}function removeEntity(_0x56ab99,_0x52c4fa){return function(_0x1e6092){if(_0x1e6092){return _0x1e6092[_0x5f83('0x23')]()[_0x5f83('0x22')](function(){_0x56ab99[_0x5f83('0x1a')](0xcc)[_0x5f83('0x19')]();});}};}function handleEntityNotFound(_0x5b8899,_0x19fad0){return function(_0x1c8229){if(!_0x1c8229){_0x5b8899[_0x5f83('0x18')](0x194);}return _0x1c8229;};}function handleError(_0x121ba1,_0x4a9050){_0x4a9050=_0x4a9050||0x1f4;return function(_0x1f3b0b){logger['error'](_0x1f3b0b[_0x5f83('0x24')]);if(_0x1f3b0b[_0x5f83('0x25')]){delete _0x1f3b0b[_0x5f83('0x25')];}_0x121ba1[_0x5f83('0x1a')](_0x4a9050)[_0x5f83('0x26')](_0x1f3b0b);};}exports['index']=function(_0x563883,_0x5efe34){var _0x364854={},_0x2ee71a={},_0x5044c8={'count':0x0,'rows':[]};var _0x4f923e=_[_0x5f83('0x27')](db['IntegrationReport']['rawAttributes'],function(_0x480381){return{'name':_0x480381[_0x5f83('0x28')],'type':_0x480381[_0x5f83('0x29')][_0x5f83('0x2a')]};});_0x2ee71a[_0x5f83('0x2b')]=_[_0x5f83('0x27')](_0x4f923e,'name');_0x2ee71a[_0x5f83('0x2c')]=_['keys'](_0x563883[_0x5f83('0x2c')]);_0x2ee71a[_0x5f83('0x2d')]=_[_0x5f83('0x2e')](_0x2ee71a[_0x5f83('0x2b')],_0x2ee71a[_0x5f83('0x2c')]);_0x364854[_0x5f83('0x2f')]=_[_0x5f83('0x2e')](_0x2ee71a[_0x5f83('0x2b')],qs[_0x5f83('0x30')](_0x563883[_0x5f83('0x2c')][_0x5f83('0x30')]));_0x364854['attributes']=_0x364854[_0x5f83('0x2f')]['length']?_0x364854[_0x5f83('0x2f')]:_0x2ee71a[_0x5f83('0x2b')];if(!_0x563883[_0x5f83('0x2c')][_0x5f83('0x31')](_0x5f83('0x32'))){_0x364854[_0x5f83('0x1d')]=qs[_0x5f83('0x1d')](_0x563883[_0x5f83('0x2c')][_0x5f83('0x1d')]);_0x364854[_0x5f83('0x1c')]=qs[_0x5f83('0x1c')](_0x563883['query'][_0x5f83('0x1c')]);}_0x364854['order']=qs[_0x5f83('0x33')](_0x563883['query'][_0x5f83('0x33')]);_0x364854[_0x5f83('0x34')]=qs['filters'](_[_0x5f83('0x35')](_0x563883[_0x5f83('0x2c')],_0x2ee71a[_0x5f83('0x2d')]),_0x4f923e);if(_0x563883[_0x5f83('0x2c')][_0x5f83('0x36')]){_0x364854[_0x5f83('0x34')]=_['merge'](_0x364854[_0x5f83('0x34')],{'$or':_[_0x5f83('0x27')](_0x4f923e,function(_0x381a4b){if(_0x381a4b[_0x5f83('0x29')]!=='VIRTUAL'){var _0x3375ef={};_0x3375ef[_0x381a4b['name']]={'$like':'%'+_0x563883['query'][_0x5f83('0x36')]+'%'};return _0x3375ef;}})});}_0x364854=_[_0x5f83('0x37')]({},_0x364854,_0x563883['options']);var _0x2f02d8={'where':_0x364854[_0x5f83('0x34')]};return db['IntegrationReport'][_0x5f83('0x1b')](_0x2f02d8)['then'](function(_0x3a750a){_0x5044c8[_0x5f83('0x1b')]=_0x3a750a;if(_0x563883[_0x5f83('0x2c')][_0x5f83('0x38')]){_0x364854[_0x5f83('0x39')]=[{'all':!![]}];}return db[_0x5f83('0x3a')][_0x5f83('0x3b')](_0x364854);})[_0x5f83('0x22')](function(_0x59f947){_0x5044c8[_0x5f83('0x3c')]=_0x59f947;return _0x5044c8;})[_0x5f83('0x22')](respondWithFilteredResult(_0x5efe34,_0x364854))[_0x5f83('0x3d')](handleError(_0x5efe34,null));};exports[_0x5f83('0x3e')]=function(_0x7e6c9c,_0x57ecb8){var _0x41fc16={'raw':![],'where':{'id':_0x7e6c9c[_0x5f83('0x3f')]['id']}},_0x29d616={};_0x29d616[_0x5f83('0x2b')]=_['keys'](db[_0x5f83('0x3a')][_0x5f83('0x40')]);_0x29d616[_0x5f83('0x2c')]=_[_0x5f83('0x41')](_0x7e6c9c[_0x5f83('0x2c')]);_0x29d616[_0x5f83('0x2d')]=_[_0x5f83('0x2e')](_0x29d616[_0x5f83('0x2b')],_0x29d616[_0x5f83('0x2c')]);_0x41fc16[_0x5f83('0x2f')]=_[_0x5f83('0x2e')](_0x29d616['model'],qs[_0x5f83('0x30')](_0x7e6c9c[_0x5f83('0x2c')]['fields']));_0x41fc16[_0x5f83('0x2f')]=_0x41fc16[_0x5f83('0x2f')][_0x5f83('0x42')]?_0x41fc16[_0x5f83('0x2f')]:_0x29d616[_0x5f83('0x2b')];if(_0x7e6c9c[_0x5f83('0x2c')][_0x5f83('0x38')]){_0x41fc16[_0x5f83('0x39')]=[{'all':!![]}];}_0x41fc16=_[_0x5f83('0x37')]({},_0x41fc16,_0x7e6c9c['options']);return db[_0x5f83('0x3a')][_0x5f83('0x43')](_0x41fc16)['then'](handleEntityNotFound(_0x57ecb8,null))['then'](respondWithResult(_0x57ecb8,null))[_0x5f83('0x3d')](handleError(_0x57ecb8,null));};exports[_0x5f83('0x44')]=function(_0x3018e7,_0xfa8e87){return db['IntegrationReport'][_0x5f83('0x44')](_0x3018e7[_0x5f83('0x45')],{})[_0x5f83('0x22')](respondWithResult(_0xfa8e87,0xc9))[_0x5f83('0x3d')](handleError(_0xfa8e87,null));};exports[_0x5f83('0x21')]=function(_0x1fff5c,_0x48f7c7){if(_0x1fff5c[_0x5f83('0x45')]['id']){delete _0x1fff5c[_0x5f83('0x45')]['id'];}return db[_0x5f83('0x3a')]['find']({'where':{'id':_0x1fff5c[_0x5f83('0x3f')]['id']}})[_0x5f83('0x22')](handleEntityNotFound(_0x48f7c7,null))[_0x5f83('0x22')](saveUpdates(_0x1fff5c['body'],null))[_0x5f83('0x22')](respondWithResult(_0x48f7c7,null))[_0x5f83('0x3d')](handleError(_0x48f7c7,null));};exports['destroy']=function(_0x58ff4c,_0x14ecdd){return db[_0x5f83('0x3a')][_0x5f83('0x43')]({'where':{'id':_0x58ff4c[_0x5f83('0x3f')]['id']}})[_0x5f83('0x22')](handleEntityNotFound(_0x14ecdd,null))[_0x5f83('0x22')](removeEntity(_0x14ecdd,null))[_0x5f83('0x3d')](handleError(_0x14ecdd,null));};exports['describe']=function(_0x608b5c,_0x456d43){return db[_0x5f83('0x3a')][_0x5f83('0x46')]()['then'](respondWithResult(_0x456d43,null))[_0x5f83('0x3d')](handleError(_0x456d43,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 8c8e416..521cee1 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 _0x1e86=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x3efdb5,_0x314ae7){var _0x310bc9=function(_0x3fce80){while(--_0x3fce80){_0x3efdb5['push'](_0x3efdb5['shift']());}};_0x310bc9(++_0x314ae7);}(_0x1e86,0x162));var _0x61e8=function(_0x429a7e,_0x220ac4){_0x429a7e=_0x429a7e-0x0;var _0x15d691=_0x1e86[_0x429a7e];return _0x15d691;};'use strict';var _=require(_0x61e8('0x0'));var util=require(_0x61e8('0x1'));var logger=require(_0x61e8('0x2'))('api');var moment=require(_0x61e8('0x3'));var BPromise=require(_0x61e8('0x4'));var rp=require(_0x61e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61e8('0x6'));var config=require(_0x61e8('0x7'));var attributes=require(_0x61e8('0x8'));module[_0x61e8('0x9')]=function(_0x520d82,_0x3d852b){return _0x520d82[_0x61e8('0xa')](_0x61e8('0xb'),attributes,{'tableName':_0x61e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74e6=['moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','lodash','util','../../config/logger','api'];(function(_0x5daa0d,_0x2aa185){var _0x1d7fc9=function(_0x22f64e){while(--_0x22f64e){_0x5daa0d['push'](_0x5daa0d['shift']());}};_0x1d7fc9(++_0x2aa185);}(_0x74e6,0x104));var _0x674e=function(_0x23aa81,_0x8ff771){_0x23aa81=_0x23aa81-0x0;var _0x2ece22=_0x74e6[_0x23aa81];return _0x2ece22;};'use strict';var _=require(_0x674e('0x0'));var util=require(_0x674e('0x1'));var logger=require(_0x674e('0x2'))(_0x674e('0x3'));var moment=require(_0x674e('0x4'));var BPromise=require('bluebird');var rp=require(_0x674e('0x5'));var fs=require('fs');var path=require(_0x674e('0x6'));var rimraf=require(_0x674e('0x7'));var config=require(_0x674e('0x8'));var attributes=require(_0x674e('0x9'));module[_0x674e('0xa')]=function(_0x19201d,_0x2e7318){return _0x19201d['define'](_0x674e('0xb'),attributes,{'tableName':'report_integration','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 49f24af..f0f3d50 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3b0515,_0x1fa41d){var _0x198d7a=function(_0x17b712){while(--_0x17b712){_0x3b0515['push'](_0x3b0515['shift']());}};_0x198d7a(++_0x1fa41d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xac4a,0x13f));var _0xaac4=function(_0x51d5f7,_0x3f7875){_0x51d5f7=_0x51d5f7-0x0;var _0xf9efba=_0xac4a[_0x51d5f7];return _0xf9efba;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4eeecf8..56b5119 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 _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x55ca,0x126));var _0xa55c=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0x55ca[_0x1d5714];return _0x1b620e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x4f0a7b,_0x5ce384){var _0x104ade=function(_0x106822){while(--_0x106822){_0x4f0a7b['push'](_0x4f0a7b['shift']());}};_0x104ade(++_0x5ce384);}(_0x008c,0x188));var _0xc008=function(_0x49c008,_0x15dfd1){_0x49c008=_0x49c008-0x0;var _0x2626e4=_0x008c[_0x49c008];return _0x2626e4;};'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 auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d1259d8..0dc85ed 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 _0x47c1=['exports','STRING','sequelize'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x47c1,0x167));var _0x147c=function(_0x1519ec,_0x26ab64){_0x1519ec=_0x1519ec-0x0;var _0x4ebabc=_0x47c1[_0x1519ec];return _0x4ebabc;};'use strict';var Sequelize=require(_0x147c('0x0'));module[_0x147c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x147c('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xaa3e=['STRING','sequelize','exports'];(function(_0x1dab2d,_0x33988d){var _0x804d1a=function(_0x1ae164){while(--_0x1ae164){_0x1dab2d['push'](_0x1dab2d['shift']());}};_0x804d1a(++_0x33988d);}(_0xaa3e,0xfd));var _0xeaa3=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xaa3e[_0x1ebe90];return _0x447c82;};'use strict';var Sequelize=require(_0xeaa3('0x0'));module[_0xeaa3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeaa3('0x2')]},'interval':{'type':Sequelize[_0xeaa3('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 60240f2..71de23d 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 _0xe877=['rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','Interval','includeAll','include','rows','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','sequelize','transaction','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','Intervals','UserProfileResource','sendStatus','stack','name','send','map'];(function(_0x518197,_0x3ea40a){var _0xdf7adb=function(_0x436824){while(--_0x436824){_0x518197['push'](_0x518197['shift']());}};_0xdf7adb(++_0x3ea40a);}(_0xe877,0x197));var _0x7e87=function(_0x10f16b,_0x29a791){_0x10f16b=_0x10f16b-0x0;var _0x398dd5=_0xe877[_0x10f16b];return _0x398dd5;};'use strict';var pdf=require(_0x7e87('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e87('0x1'));var zipdir=require(_0x7e87('0x2'));var jsonpatch=require(_0x7e87('0x3'));var rp=require(_0x7e87('0x4'));var moment=require(_0x7e87('0x5'));var BPromise=require(_0x7e87('0x6'));var Mustache=require(_0x7e87('0x7'));var util=require(_0x7e87('0x8'));var path=require(_0x7e87('0x9'));var sox=require('sox');var csv=require(_0x7e87('0xa'));var ejs=require(_0x7e87('0xb'));var fs=require('fs');var _=require(_0x7e87('0xc'));var squel=require(_0x7e87('0xd'));var crypto=require('crypto');var jsforce=require(_0x7e87('0xe'));var deskjs=require(_0x7e87('0xf'));var toCsv=require(_0x7e87('0xa'));var querystring=require('querystring');var Papa=require(_0x7e87('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7e87('0x11'));var hardwareService=require(_0x7e87('0x12'));var logger=require(_0x7e87('0x13'))(_0x7e87('0x14'));var utils=require(_0x7e87('0x15'));var config=require(_0x7e87('0x16'));var db=require(_0x7e87('0x17'))['db'];var extensions=require(_0x7e87('0x18'));function respondWithStatusCode(_0x112ced,_0x1039bc){_0x1039bc=_0x1039bc||0xcc;return function(_0x2d5067){if(_0x2d5067){return _0x112ced['sendStatus'](_0x1039bc);}return _0x112ced['status'](_0x1039bc)['end']();};}function respondWithResult(_0x5a7ee6,_0x35fc7c){_0x35fc7c=_0x35fc7c||0xc8;return function(_0x34ec36){if(_0x34ec36){return _0x5a7ee6[_0x7e87('0x19')](_0x35fc7c)[_0x7e87('0x1a')](_0x34ec36);}};}function respondWithFilteredResult(_0x1b4e06,_0x3aea08){return function(_0x2c7dba){if(_0x2c7dba){var _0x19ada9=_0x2c7dba[_0x7e87('0x1b')],_0x54968f=_0x3aea08[_0x7e87('0x1c')],_0x5f40f4=_0x3aea08[_0x7e87('0x1c')]+_0x3aea08[_0x7e87('0x1d')],_0x5ec28d;if(_0x5f40f4>=_0x19ada9){_0x5f40f4=_0x19ada9;_0x5ec28d=0xc8;}else{_0x5ec28d=0xce;}_0x1b4e06[_0x7e87('0x19')](_0x5ec28d);return _0x1b4e06[_0x7e87('0x1e')](_0x7e87('0x1f'),_0x54968f+'-'+_0x5f40f4+'/'+_0x19ada9)[_0x7e87('0x1a')](_0x2c7dba);}return null;};}function patchUpdates(_0xe25e3a){return function(_0x46b387){try{jsonpatch[_0x7e87('0x20')](_0x46b387,_0xe25e3a,!![]);}catch(_0x331959){return BPromise['reject'](_0x331959);}return _0x46b387['save']();};}function saveUpdates(_0x287870,_0x1128e2){return function(_0x2d913f){if(_0x2d913f){return _0x2d913f[_0x7e87('0x21')](_0x287870)[_0x7e87('0x22')](function(_0x1e012d){return _0x1e012d;});}return null;};}function removeEntity(_0xbbb6e,_0x31dd39){return function(_0xa0de36){if(_0xa0de36){return _0xa0de36[_0x7e87('0x23')]()[_0x7e87('0x22')](function(){var _0x523133=_0xa0de36['get']({'plain':!![]});var _0x224bf3=_0x7e87('0x24');return db[_0x7e87('0x25')][_0x7e87('0x23')]({'where':{'type':_0x224bf3,'resourceId':_0x523133['id']}})['then'](function(){return _0xa0de36;});})['then'](function(){_0xbbb6e[_0x7e87('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf2b05,_0x2dce92){return function(_0x260e83){if(!_0x260e83){_0xaf2b05[_0x7e87('0x26')](0x194);}return _0x260e83;};}function handleError(_0x38c216,_0xca23bb){_0xca23bb=_0xca23bb||0x1f4;return function(_0x113b3e){logger['error'](_0x113b3e[_0x7e87('0x27')]);if(_0x113b3e[_0x7e87('0x28')]){delete _0x113b3e[_0x7e87('0x28')];}_0x38c216[_0x7e87('0x19')](_0xca23bb)[_0x7e87('0x29')](_0x113b3e);};}exports['index']=function(_0x165ee8,_0x28975b){var _0x438553={},_0x5781c7={},_0x14418c={'count':0x0,'rows':[]};var _0x270372=_[_0x7e87('0x2a')](db['Interval'][_0x7e87('0x2b')],function(_0x488ca2){return{'name':_0x488ca2[_0x7e87('0x2c')],'type':_0x488ca2[_0x7e87('0x2d')][_0x7e87('0x2e')]};});_0x5781c7['model']=_['map'](_0x270372,_0x7e87('0x28'));_0x5781c7[_0x7e87('0x2f')]=_[_0x7e87('0x30')](_0x165ee8['query']);_0x5781c7[_0x7e87('0x31')]=_['intersection'](_0x5781c7['model'],_0x5781c7['query']);_0x438553[_0x7e87('0x32')]=_[_0x7e87('0x33')](_0x5781c7[_0x7e87('0x34')],qs['fields'](_0x165ee8[_0x7e87('0x2f')][_0x7e87('0x35')]));_0x438553[_0x7e87('0x32')]=_0x438553['attributes']['length']?_0x438553[_0x7e87('0x32')]:_0x5781c7[_0x7e87('0x34')];if(!_0x165ee8['query'][_0x7e87('0x36')]('nolimit')){_0x438553[_0x7e87('0x1d')]=qs['limit'](_0x165ee8[_0x7e87('0x2f')][_0x7e87('0x1d')]);_0x438553[_0x7e87('0x1c')]=qs['offset'](_0x165ee8['query'][_0x7e87('0x1c')]);}_0x438553[_0x7e87('0x37')]=qs[_0x7e87('0x38')](_0x165ee8[_0x7e87('0x2f')]['sort']);_0x438553['where']=qs[_0x7e87('0x31')](_['pick'](_0x165ee8[_0x7e87('0x2f')],_0x5781c7[_0x7e87('0x31')]),_0x270372);if(_0x165ee8['query'][_0x7e87('0x39')]){_0x438553[_0x7e87('0x3a')]=_[_0x7e87('0x3b')](_0x438553['where'],{'$or':_[_0x7e87('0x2a')](_0x270372,function(_0x89dace){if(_0x89dace[_0x7e87('0x2d')]!==_0x7e87('0x3c')){var _0x1ee846={};_0x1ee846[_0x89dace['name']]={'$like':'%'+_0x165ee8['query']['filter']+'%'};return _0x1ee846;}})});}_0x438553=_['merge']({},_0x438553,_0x165ee8[_0x7e87('0x3d')]);var _0x507ebe={'where':_0x438553['where']};return db[_0x7e87('0x3e')]['count'](_0x507ebe)[_0x7e87('0x22')](function(_0xe7ba66){_0x14418c[_0x7e87('0x1b')]=_0xe7ba66;if(_0x165ee8['query'][_0x7e87('0x3f')]){_0x438553[_0x7e87('0x40')]=[{'all':!![]}];}return db[_0x7e87('0x3e')]['findAll'](_0x438553);})[_0x7e87('0x22')](function(_0x3fe3cb){_0x14418c[_0x7e87('0x41')]=_0x3fe3cb;return _0x14418c;})[_0x7e87('0x22')](respondWithFilteredResult(_0x28975b,_0x438553))['catch'](handleError(_0x28975b,null));};exports['show']=function(_0x25ee48,_0x43cc92){var _0x431d96={'raw':!![],'where':{'id':_0x25ee48['params']['id']}},_0x2884b3={};_0x2884b3['model']=_[_0x7e87('0x30')](db[_0x7e87('0x3e')][_0x7e87('0x2b')]);_0x2884b3['query']=_['keys'](_0x25ee48[_0x7e87('0x2f')]);_0x2884b3[_0x7e87('0x31')]=_[_0x7e87('0x33')](_0x2884b3[_0x7e87('0x34')],_0x2884b3['query']);_0x431d96[_0x7e87('0x32')]=_['intersection'](_0x2884b3[_0x7e87('0x34')],qs[_0x7e87('0x35')](_0x25ee48['query'][_0x7e87('0x35')]));_0x431d96[_0x7e87('0x32')]=_0x431d96['attributes'][_0x7e87('0x42')]?_0x431d96[_0x7e87('0x32')]:_0x2884b3[_0x7e87('0x34')];if(_0x25ee48['query'][_0x7e87('0x3f')]){_0x431d96['include']=[{'all':!![]}];}_0x431d96=_[_0x7e87('0x3b')]({},_0x431d96,_0x25ee48[_0x7e87('0x3d')]);return db[_0x7e87('0x3e')][_0x7e87('0x43')](_0x431d96)['then'](handleEntityNotFound(_0x43cc92,null))[_0x7e87('0x22')](respondWithResult(_0x43cc92,null))['catch'](handleError(_0x43cc92,null));};exports['create']=function(_0x364439,_0xf5c33b){return db[_0x7e87('0x3e')][_0x7e87('0x44')](_0x364439[_0x7e87('0x45')],{})['then'](function(_0x5c44b9){var _0x425460=_0x364439[_0x7e87('0x46')][_0x7e87('0x47')]({'plain':!![]});if(!_0x425460)throw new Error(_0x7e87('0x48'));if(_0x425460[_0x7e87('0x49')]==='user'){var _0x3d05ca=_0x5c44b9['get']({'plain':!![]});var _0x3c4def=_0x7e87('0x24');return db[_0x7e87('0x4a')]['find']({'where':{'name':_0x3c4def,'userProfileId':_0x425460[_0x7e87('0x4b')]},'raw':!![]})[_0x7e87('0x22')](function(_0x130ee6){if(_0x130ee6&&_0x130ee6[_0x7e87('0x4c')]===0x0){return db[_0x7e87('0x25')][_0x7e87('0x44')]({'name':_0x3d05ca['name'],'resourceId':_0x3d05ca['id'],'type':_0x130ee6[_0x7e87('0x28')],'sectionId':_0x130ee6['id']},{})[_0x7e87('0x22')](function(){return _0x5c44b9;});}else{return _0x5c44b9;}})['catch'](function(_0x4f0399){logger[_0x7e87('0x4d')](_0x7e87('0x4e'),_0x4f0399);throw _0x4f0399;});}return _0x5c44b9;})[_0x7e87('0x22')](respondWithResult(_0xf5c33b,0xc9))['catch'](handleError(_0xf5c33b,null));};exports[_0x7e87('0x21')]=function(_0x2fac3e,_0x1ebc0f){if(_0x2fac3e[_0x7e87('0x45')]['id']){delete _0x2fac3e['body']['id'];}return db[_0x7e87('0x3e')][_0x7e87('0x43')]({'where':{'id':_0x2fac3e['params']['id']}})['then'](handleEntityNotFound(_0x1ebc0f,null))[_0x7e87('0x22')](saveUpdates(_0x2fac3e['body'],null))[_0x7e87('0x22')](respondWithResult(_0x1ebc0f,null))[_0x7e87('0x4f')](handleError(_0x1ebc0f,null));};exports[_0x7e87('0x23')]=function(_0x3bf836,_0x665e13){return db[_0x7e87('0x3e')][_0x7e87('0x43')]({'where':{'id':_0x3bf836[_0x7e87('0x50')]['id']}})[_0x7e87('0x22')](handleEntityNotFound(_0x665e13,null))['then'](removeEntity(_0x665e13,null))[_0x7e87('0x4f')](handleError(_0x665e13,null));};exports[_0x7e87('0x51')]=function(_0x4adca1,_0x112547,_0xc64d7e){if(_0x4adca1[_0x7e87('0x45')]['id']){delete _0x4adca1['body']['id'];}return db[_0x7e87('0x3e')]['find']({'where':{'id':_0x4adca1[_0x7e87('0x50')]['id']}})[_0x7e87('0x22')](handleEntityNotFound(_0x112547,null))['then'](function(_0x39e9f3){if(_0x39e9f3){_0x4adca1[_0x7e87('0x45')][_0x7e87('0x52')]=_0x39e9f3['id'];return db['Interval'][_0x7e87('0x44')](_0x4adca1['body']);}})[_0x7e87('0x22')](respondWithResult(_0x112547,null))[_0x7e87('0x4f')](handleError(_0x112547,null));};exports[_0x7e87('0x53')]=function(_0x257b0b,_0x212e34,_0x489510){var _0x53851e={};var _0x255639={};var _0x3b87eb;var _0x5e53ef;return db[_0x7e87('0x3e')][_0x7e87('0x54')]({'where':{'id':_0x257b0b[_0x7e87('0x50')]['id']}})[_0x7e87('0x22')](handleEntityNotFound(_0x212e34,null))[_0x7e87('0x22')](function(_0x2b4ec3){if(_0x2b4ec3){_0x3b87eb=_0x2b4ec3;_0x255639[_0x7e87('0x34')]=_['keys'](db[_0x7e87('0x3e')]['rawAttributes']);_0x255639['query']=_['keys'](_0x257b0b[_0x7e87('0x2f')]);_0x255639[_0x7e87('0x31')]=_[_0x7e87('0x33')](_0x255639['model'],_0x255639['query']);_0x53851e[_0x7e87('0x32')]=_[_0x7e87('0x33')](_0x255639[_0x7e87('0x34')],qs[_0x7e87('0x35')](_0x257b0b[_0x7e87('0x2f')][_0x7e87('0x35')]));_0x53851e[_0x7e87('0x32')]=_0x53851e[_0x7e87('0x32')][_0x7e87('0x42')]?_0x53851e[_0x7e87('0x32')]:_0x255639[_0x7e87('0x34')];_0x53851e[_0x7e87('0x37')]=qs[_0x7e87('0x38')](_0x257b0b[_0x7e87('0x2f')][_0x7e87('0x38')]);_0x53851e['where']=qs[_0x7e87('0x31')](_[_0x7e87('0x55')](_0x257b0b[_0x7e87('0x2f')],_0x255639[_0x7e87('0x31')]));if(_0x257b0b['query'][_0x7e87('0x39')]){_0x53851e[_0x7e87('0x3a')]=_['merge'](_0x53851e[_0x7e87('0x3a')],{'$or':_[_0x7e87('0x2a')](_0x53851e[_0x7e87('0x32')],function(_0x51ab9e){var _0x496000={};_0x496000[_0x51ab9e]={'$like':'%'+_0x257b0b[_0x7e87('0x2f')][_0x7e87('0x39')]+'%'};return _0x496000;})});}_0x53851e=_[_0x7e87('0x3b')]({},_0x53851e,_0x257b0b[_0x7e87('0x3d')]);return _0x3b87eb[_0x7e87('0x53')](_0x53851e);}})[_0x7e87('0x22')](function(_0x458f4e){if(_0x458f4e){_0x5e53ef=_0x458f4e[_0x7e87('0x42')];if(!_0x257b0b[_0x7e87('0x2f')]['hasOwnProperty'](_0x7e87('0x56'))){_0x53851e['limit']=qs[_0x7e87('0x1d')](_0x257b0b['query']['limit']);_0x53851e[_0x7e87('0x1c')]=qs['offset'](_0x257b0b['query'][_0x7e87('0x1c')]);}return _0x3b87eb[_0x7e87('0x53')](_0x53851e);}})[_0x7e87('0x22')](function(_0x33ff99){if(_0x33ff99){return _0x33ff99?{'count':_0x5e53ef,'rows':_0x33ff99}:null;}})['then'](respondWithResult(_0x212e34,null))['catch'](handleError(_0x212e34,null));};exports['addIntervals']=function(_0xf4a481,_0x2694c0,_0xe34ee2){return db[_0x7e87('0x3e')]['findOne']({'where':{'id':_0xf4a481[_0x7e87('0x50')]['id']}})['then'](handleEntityNotFound(_0x2694c0,null))['then'](function(_0x2029f9){if(_0x2029f9){return db[_0x7e87('0x57')][_0x7e87('0x58')](function(_0x14c359){return db[_0x7e87('0x3e')]['destroy']({'where':{'IntervalId':_0xf4a481[_0x7e87('0x50')]['id']},'transaction':_0x14c359})[_0x7e87('0x22')](function(_0x5c6980){var _0x2e5226=_['map'](_0xf4a481['body'],function(_0x50fedc){delete _0x50fedc['id'];_0x50fedc['IntervalId']=_0xf4a481[_0x7e87('0x50')]['id'];return _0x50fedc;});return db[_0x7e87('0x3e')]['bulkCreate'](_0x2e5226,{'transaction':_0x14c359});});})[_0x7e87('0x22')](function(){return db[_0x7e87('0x3e')][_0x7e87('0x59')]({'where':{'IntervalId':_0xf4a481[_0x7e87('0x50')]['id']}});});}})['then'](respondWithResult(_0x2694c0,null))[_0x7e87('0x4f')](handleError(_0x2694c0,null));}; \ No newline at end of file +var _0xfcef=['set','Content-Range','apply','reject','save','then','get','UserProfileResource','error','stack','name','send','map','Interval','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','find','userProfileId','autoAssociation','update','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','destroy','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count'];(function(_0x189f54,_0x5f03d1){var _0x44e446=function(_0x27139b){while(--_0x27139b){_0x189f54['push'](_0x189f54['shift']());}};_0x44e446(++_0x5f03d1);}(_0xfcef,0x1bc));var _0xffce=function(_0x87523,_0x29ce7e){_0x87523=_0x87523-0x0;var _0x565bba=_0xfcef[_0x87523];return _0x565bba;};'use strict';var pdf=require(_0xffce('0x0'));var emlformat=require(_0xffce('0x1'));var rimraf=require(_0xffce('0x2'));var zipdir=require(_0xffce('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffce('0x4'));var moment=require('moment');var BPromise=require(_0xffce('0x5'));var Mustache=require(_0xffce('0x6'));var util=require(_0xffce('0x7'));var path=require(_0xffce('0x8'));var sox=require(_0xffce('0x9'));var csv=require(_0xffce('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xffce('0xb'));var squel=require(_0xffce('0xc'));var crypto=require(_0xffce('0xd'));var jsforce=require(_0xffce('0xe'));var deskjs=require(_0xffce('0xf'));var toCsv=require(_0xffce('0xa'));var querystring=require(_0xffce('0x10'));var Papa=require(_0xffce('0x11'));var Redis=require(_0xffce('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xffce('0x13'));var as=require(_0xffce('0x14'));var hardwareService=require(_0xffce('0x15'));var logger=require(_0xffce('0x16'))(_0xffce('0x17'));var utils=require(_0xffce('0x18'));var config=require(_0xffce('0x19'));var db=require(_0xffce('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x15e521,_0x1a0d55){_0x1a0d55=_0x1a0d55||0xcc;return function(_0x5677e7){if(_0x5677e7){return _0x15e521[_0xffce('0x1b')](_0x1a0d55);}return _0x15e521['status'](_0x1a0d55)[_0xffce('0x1c')]();};}function respondWithResult(_0x17f18d,_0x18e56a){_0x18e56a=_0x18e56a||0xc8;return function(_0x5350b9){if(_0x5350b9){return _0x17f18d[_0xffce('0x1d')](_0x18e56a)['json'](_0x5350b9);}};}function respondWithFilteredResult(_0x363b9,_0x446bdf){return function(_0x271814){if(_0x271814){var _0x59fc54=_0x271814[_0xffce('0x1e')],_0xfb5b5e=_0x446bdf['offset'],_0x1c17c6=_0x446bdf['offset']+_0x446bdf['limit'],_0x3fb2c1;if(_0x1c17c6>=_0x59fc54){_0x1c17c6=_0x59fc54;_0x3fb2c1=0xc8;}else{_0x3fb2c1=0xce;}_0x363b9[_0xffce('0x1d')](_0x3fb2c1);return _0x363b9[_0xffce('0x1f')](_0xffce('0x20'),_0xfb5b5e+'-'+_0x1c17c6+'/'+_0x59fc54)['json'](_0x271814);}return null;};}function patchUpdates(_0x337c3e){return function(_0x43abef){try{jsonpatch[_0xffce('0x21')](_0x43abef,_0x337c3e,!![]);}catch(_0x3d968b){return BPromise[_0xffce('0x22')](_0x3d968b);}return _0x43abef[_0xffce('0x23')]();};}function saveUpdates(_0x427d3e,_0x2c4527){return function(_0x2631e7){if(_0x2631e7){return _0x2631e7['update'](_0x427d3e)['then'](function(_0x142098){return _0x142098;});}return null;};}function removeEntity(_0x485d3a,_0x3ce45d){return function(_0x3f5272){if(_0x3f5272){return _0x3f5272['destroy']()[_0xffce('0x24')](function(){var _0x5c8576=_0x3f5272[_0xffce('0x25')]({'plain':!![]});var _0x2e7fe8='Intervals';return db[_0xffce('0x26')]['destroy']({'where':{'type':_0x2e7fe8,'resourceId':_0x5c8576['id']}})['then'](function(){return _0x3f5272;});})['then'](function(){_0x485d3a[_0xffce('0x1d')](0xcc)[_0xffce('0x1c')]();});}};}function handleEntityNotFound(_0x1ae614,_0x2b8179){return function(_0x2d7329){if(!_0x2d7329){_0x1ae614[_0xffce('0x1b')](0x194);}return _0x2d7329;};}function handleError(_0xd1cd61,_0xf68181){_0xf68181=_0xf68181||0x1f4;return function(_0x1fba7d){logger[_0xffce('0x27')](_0x1fba7d[_0xffce('0x28')]);if(_0x1fba7d[_0xffce('0x29')]){delete _0x1fba7d['name'];}_0xd1cd61[_0xffce('0x1d')](_0xf68181)[_0xffce('0x2a')](_0x1fba7d);};}exports['index']=function(_0xe75f86,_0x52c08c){var _0x652be0={},_0x13396b={},_0x2526f6={'count':0x0,'rows':[]};var _0x25dac2=_[_0xffce('0x2b')](db[_0xffce('0x2c')][_0xffce('0x2d')],function(_0x4ae90c){return{'name':_0x4ae90c[_0xffce('0x2e')],'type':_0x4ae90c['type'][_0xffce('0x2f')]};});_0x13396b['model']=_['map'](_0x25dac2,_0xffce('0x29'));_0x13396b[_0xffce('0x30')]=_[_0xffce('0x31')](_0xe75f86[_0xffce('0x30')]);_0x13396b[_0xffce('0x32')]=_[_0xffce('0x33')](_0x13396b[_0xffce('0x34')],_0x13396b['query']);_0x652be0['attributes']=_[_0xffce('0x33')](_0x13396b['model'],qs['fields'](_0xe75f86[_0xffce('0x30')]['fields']));_0x652be0[_0xffce('0x35')]=_0x652be0[_0xffce('0x35')][_0xffce('0x36')]?_0x652be0[_0xffce('0x35')]:_0x13396b[_0xffce('0x34')];if(!_0xe75f86[_0xffce('0x30')][_0xffce('0x37')](_0xffce('0x38'))){_0x652be0['limit']=qs['limit'](_0xe75f86['query'][_0xffce('0x39')]);_0x652be0[_0xffce('0x3a')]=qs[_0xffce('0x3a')](_0xe75f86[_0xffce('0x30')]['offset']);}_0x652be0[_0xffce('0x3b')]=qs['sort'](_0xe75f86[_0xffce('0x30')][_0xffce('0x3c')]);_0x652be0['where']=qs[_0xffce('0x32')](_['pick'](_0xe75f86[_0xffce('0x30')],_0x13396b[_0xffce('0x32')]),_0x25dac2);if(_0xe75f86[_0xffce('0x30')][_0xffce('0x3d')]){_0x652be0[_0xffce('0x3e')]=_[_0xffce('0x3f')](_0x652be0[_0xffce('0x3e')],{'$or':_[_0xffce('0x2b')](_0x25dac2,function(_0x5482f9){if(_0x5482f9[_0xffce('0x40')]!==_0xffce('0x41')){var _0x41ef79={};_0x41ef79[_0x5482f9[_0xffce('0x29')]]={'$like':'%'+_0xe75f86[_0xffce('0x30')][_0xffce('0x3d')]+'%'};return _0x41ef79;}})});}_0x652be0=_[_0xffce('0x3f')]({},_0x652be0,_0xe75f86[_0xffce('0x42')]);var _0x2ae165={'where':_0x652be0[_0xffce('0x3e')]};return db[_0xffce('0x2c')]['count'](_0x2ae165)['then'](function(_0xa473f0){_0x2526f6[_0xffce('0x1e')]=_0xa473f0;if(_0xe75f86[_0xffce('0x30')][_0xffce('0x43')]){_0x652be0[_0xffce('0x44')]=[{'all':!![]}];}return db[_0xffce('0x2c')][_0xffce('0x45')](_0x652be0);})[_0xffce('0x24')](function(_0x31d7e8){_0x2526f6[_0xffce('0x46')]=_0x31d7e8;return _0x2526f6;})[_0xffce('0x24')](respondWithFilteredResult(_0x52c08c,_0x652be0))['catch'](handleError(_0x52c08c,null));};exports[_0xffce('0x47')]=function(_0x132356,_0x5d58f5){var _0x2b388b={'raw':!![],'where':{'id':_0x132356[_0xffce('0x48')]['id']}},_0x22be56={};_0x22be56[_0xffce('0x34')]=_[_0xffce('0x31')](db[_0xffce('0x2c')][_0xffce('0x2d')]);_0x22be56[_0xffce('0x30')]=_['keys'](_0x132356['query']);_0x22be56[_0xffce('0x32')]=_[_0xffce('0x33')](_0x22be56['model'],_0x22be56['query']);_0x2b388b[_0xffce('0x35')]=_['intersection'](_0x22be56[_0xffce('0x34')],qs[_0xffce('0x49')](_0x132356[_0xffce('0x30')]['fields']));_0x2b388b[_0xffce('0x35')]=_0x2b388b['attributes'][_0xffce('0x36')]?_0x2b388b[_0xffce('0x35')]:_0x22be56[_0xffce('0x34')];if(_0x132356[_0xffce('0x30')][_0xffce('0x43')]){_0x2b388b[_0xffce('0x44')]=[{'all':!![]}];}_0x2b388b=_[_0xffce('0x3f')]({},_0x2b388b,_0x132356[_0xffce('0x42')]);return db['Interval']['find'](_0x2b388b)[_0xffce('0x24')](handleEntityNotFound(_0x5d58f5,null))['then'](respondWithResult(_0x5d58f5,null))[_0xffce('0x4a')](handleError(_0x5d58f5,null));};exports[_0xffce('0x4b')]=function(_0x1bc478,_0x457948){return db[_0xffce('0x2c')][_0xffce('0x4b')](_0x1bc478[_0xffce('0x4c')],{})[_0xffce('0x24')](function(_0x12e3da){var _0x1b2db4=_0x1bc478[_0xffce('0x4d')]['get']({'plain':!![]});if(!_0x1b2db4)throw new Error(_0xffce('0x4e'));if(_0x1b2db4[_0xffce('0x4f')]==='user'){var _0x12aa81=_0x12e3da[_0xffce('0x25')]({'plain':!![]});var _0x32564a=_0xffce('0x50');return db[_0xffce('0x51')][_0xffce('0x52')]({'where':{'name':_0x32564a,'userProfileId':_0x1b2db4[_0xffce('0x53')]},'raw':!![]})[_0xffce('0x24')](function(_0x427694){if(_0x427694&&_0x427694[_0xffce('0x54')]===0x0){return db[_0xffce('0x26')]['create']({'name':_0x12aa81[_0xffce('0x29')],'resourceId':_0x12aa81['id'],'type':_0x427694['name'],'sectionId':_0x427694['id']},{})['then'](function(){return _0x12e3da;});}else{return _0x12e3da;}})[_0xffce('0x4a')](function(_0xeda8c1){logger[_0xffce('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeda8c1);throw _0xeda8c1;});}return _0x12e3da;})[_0xffce('0x24')](respondWithResult(_0x457948,0xc9))['catch'](handleError(_0x457948,null));};exports[_0xffce('0x55')]=function(_0x5c4f37,_0x4912b3){if(_0x5c4f37[_0xffce('0x4c')]['id']){delete _0x5c4f37['body']['id'];}return db[_0xffce('0x2c')][_0xffce('0x52')]({'where':{'id':_0x5c4f37[_0xffce('0x48')]['id']}})[_0xffce('0x24')](handleEntityNotFound(_0x4912b3,null))[_0xffce('0x24')](saveUpdates(_0x5c4f37[_0xffce('0x4c')],null))[_0xffce('0x24')](respondWithResult(_0x4912b3,null))[_0xffce('0x4a')](handleError(_0x4912b3,null));};exports['destroy']=function(_0x12fcbf,_0x56ee60){return db[_0xffce('0x2c')][_0xffce('0x52')]({'where':{'id':_0x12fcbf[_0xffce('0x48')]['id']}})['then'](handleEntityNotFound(_0x56ee60,null))['then'](removeEntity(_0x56ee60,null))[_0xffce('0x4a')](handleError(_0x56ee60,null));};exports[_0xffce('0x56')]=function(_0x88f93f,_0x3eb96d,_0x4ca0b0){if(_0x88f93f[_0xffce('0x4c')]['id']){delete _0x88f93f[_0xffce('0x4c')]['id'];}return db[_0xffce('0x2c')][_0xffce('0x52')]({'where':{'id':_0x88f93f['params']['id']}})[_0xffce('0x24')](handleEntityNotFound(_0x3eb96d,null))['then'](function(_0x2ed1ca){if(_0x2ed1ca){_0x88f93f[_0xffce('0x4c')][_0xffce('0x57')]=_0x2ed1ca['id'];return db['Interval'][_0xffce('0x4b')](_0x88f93f[_0xffce('0x4c')]);}})[_0xffce('0x24')](respondWithResult(_0x3eb96d,null))[_0xffce('0x4a')](handleError(_0x3eb96d,null));};exports[_0xffce('0x58')]=function(_0x5b116d,_0x4dcc93,_0x173586){var _0x17d8ba={};var _0x59c4d9={};var _0x5af18e;var _0x2f28db;return db[_0xffce('0x2c')][_0xffce('0x59')]({'where':{'id':_0x5b116d[_0xffce('0x48')]['id']}})[_0xffce('0x24')](handleEntityNotFound(_0x4dcc93,null))['then'](function(_0x34fdef){if(_0x34fdef){_0x5af18e=_0x34fdef;_0x59c4d9[_0xffce('0x34')]=_['keys'](db[_0xffce('0x2c')][_0xffce('0x2d')]);_0x59c4d9[_0xffce('0x30')]=_[_0xffce('0x31')](_0x5b116d[_0xffce('0x30')]);_0x59c4d9[_0xffce('0x32')]=_[_0xffce('0x33')](_0x59c4d9[_0xffce('0x34')],_0x59c4d9[_0xffce('0x30')]);_0x17d8ba[_0xffce('0x35')]=_['intersection'](_0x59c4d9[_0xffce('0x34')],qs[_0xffce('0x49')](_0x5b116d[_0xffce('0x30')][_0xffce('0x49')]));_0x17d8ba[_0xffce('0x35')]=_0x17d8ba[_0xffce('0x35')][_0xffce('0x36')]?_0x17d8ba['attributes']:_0x59c4d9[_0xffce('0x34')];_0x17d8ba[_0xffce('0x3b')]=qs['sort'](_0x5b116d[_0xffce('0x30')]['sort']);_0x17d8ba['where']=qs[_0xffce('0x32')](_['pick'](_0x5b116d[_0xffce('0x30')],_0x59c4d9['filters']));if(_0x5b116d[_0xffce('0x30')]['filter']){_0x17d8ba[_0xffce('0x3e')]=_['merge'](_0x17d8ba['where'],{'$or':_[_0xffce('0x2b')](_0x17d8ba['attributes'],function(_0x5a144d){var _0x29ecc9={};_0x29ecc9[_0x5a144d]={'$like':'%'+_0x5b116d['query'][_0xffce('0x3d')]+'%'};return _0x29ecc9;})});}_0x17d8ba=_[_0xffce('0x3f')]({},_0x17d8ba,_0x5b116d[_0xffce('0x42')]);return _0x5af18e[_0xffce('0x58')](_0x17d8ba);}})[_0xffce('0x24')](function(_0x307737){if(_0x307737){_0x2f28db=_0x307737['length'];if(!_0x5b116d['query']['hasOwnProperty'](_0xffce('0x38'))){_0x17d8ba[_0xffce('0x39')]=qs[_0xffce('0x39')](_0x5b116d[_0xffce('0x30')]['limit']);_0x17d8ba[_0xffce('0x3a')]=qs[_0xffce('0x3a')](_0x5b116d[_0xffce('0x30')][_0xffce('0x3a')]);}return _0x5af18e['getIntervals'](_0x17d8ba);}})[_0xffce('0x24')](function(_0x5171cf){if(_0x5171cf){return _0x5171cf?{'count':_0x2f28db,'rows':_0x5171cf}:null;}})['then'](respondWithResult(_0x4dcc93,null))[_0xffce('0x4a')](handleError(_0x4dcc93,null));};exports[_0xffce('0x5a')]=function(_0x2c3563,_0x510a30,_0x4ed6f1){return db[_0xffce('0x2c')][_0xffce('0x59')]({'where':{'id':_0x2c3563['params']['id']}})[_0xffce('0x24')](handleEntityNotFound(_0x510a30,null))[_0xffce('0x24')](function(_0x45aa5a){if(_0x45aa5a){return db[_0xffce('0x5b')][_0xffce('0x5c')](function(_0x18ba70){return db[_0xffce('0x2c')][_0xffce('0x5d')]({'where':{'IntervalId':_0x2c3563[_0xffce('0x48')]['id']},'transaction':_0x18ba70})['then'](function(_0x3b37e2){var _0x17df7c=_[_0xffce('0x2b')](_0x2c3563['body'],function(_0x28dc85){delete _0x28dc85['id'];_0x28dc85[_0xffce('0x57')]=_0x2c3563[_0xffce('0x48')]['id'];return _0x28dc85;});return db[_0xffce('0x2c')][_0xffce('0x5e')](_0x17df7c,{'transaction':_0x18ba70});});})['then'](function(){return db[_0xffce('0x2c')]['findAll']({'where':{'IntervalId':_0x2c3563[_0xffce('0x48')]['id']}});});}})[_0xffce('0x24')](respondWithResult(_0x510a30,null))[_0xffce('0x4a')](handleError(_0x510a30,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 80af538..9a428d0 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 _0x0b41=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x457138,_0x222d8d){var _0x52e42d=function(_0x2d02a3){while(--_0x2d02a3){_0x457138['push'](_0x457138['shift']());}};_0x52e42d(++_0x222d8d);}(_0x0b41,0x6a));var _0x10b4=function(_0x439689,_0x56c358){_0x439689=_0x439689-0x0;var _0x24b18e=_0x0b41[_0x439689];return _0x24b18e;};'use strict';var _=require(_0x10b4('0x0'));var util=require('util');var logger=require(_0x10b4('0x1'))(_0x10b4('0x2'));var moment=require('moment');var BPromise=require(_0x10b4('0x3'));var rp=require(_0x10b4('0x4'));var fs=require('fs');var path=require(_0x10b4('0x5'));var rimraf=require('rimraf');var config=require(_0x10b4('0x6'));var attributes=require(_0x10b4('0x7'));var extensions=require(_0x10b4('0x8'));module[_0x10b4('0x9')]=function(_0x22f6a1,_0xaa560){return _0x22f6a1[_0x10b4('0xa')](_0x10b4('0xb'),attributes,{'tableName':_0x10b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fe3db,_0x16bfdf){extensions[_0x10b4('0xd')](_0x22f6a1,_0x2fe3db);},'afterBulkCreate':function(_0x76ee35,_0x362546,_0x246984){_0x246984();extensions[_0x10b4('0xd')](_0x22f6a1,_0x76ee35[0x0]);},'afterUpdate':function(_0x208478,_0x12cf87){extensions['rewrite'](_0x22f6a1,_0x208478);},'afterDestroy':function(_0x5ad53e,_0x1b2146){extensions['rewrite'](_0x22f6a1,_0x5ad53e);}}});}; \ No newline at end of file +var _0x5ff3=['path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','rewrite','util','api','bluebird','request-promise'];(function(_0x40b768,_0x4faeae){var _0xb3d29b=function(_0x7fde4c){while(--_0x7fde4c){_0x40b768['push'](_0x40b768['shift']());}};_0xb3d29b(++_0x4faeae);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5b1af3,_0x2d14c9){_0x5b1af3=_0x5b1af3-0x0;var _0x330237=_0x5ff3[_0x5b1af3];return _0x330237;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));var extensions=require(_0x35ff('0x7'));module[_0x35ff('0x8')]=function(_0x11e738,_0x30c3ff){return _0x11e738['define'](_0x35ff('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e7470,_0xfcec34){extensions[_0x35ff('0xa')](_0x11e738,_0x2e7470);},'afterBulkCreate':function(_0x51967a,_0x20647e,_0x59ec4f){_0x59ec4f();extensions[_0x35ff('0xa')](_0x11e738,_0x51967a[0x0]);},'afterUpdate':function(_0x228fea,_0x57ad20){extensions['rewrite'](_0x11e738,_0x228fea);},'afterDestroy':function(_0x3aba51,_0x574c81){extensions['rewrite'](_0x11e738,_0x3aba51);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 6d8cc14..9474575 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 _0xade0=['request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','result','GetInterval','Interval','findAll','options','raw','where','attributes','include','model','debug','ShowInterval','find','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x217c74,_0x168169){var _0x2cc1ff=function(_0x1e046e){while(--_0x1e046e){_0x217c74['push'](_0x217c74['shift']());}};_0x2cc1ff(++_0x168169);}(_0xade0,0x1dd));var _0x0ade=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0xade0[_0x274dd7];return _0x148829;};'use strict';var _=require(_0x0ade('0x0'));var util=require(_0x0ade('0x1'));var moment=require(_0x0ade('0x2'));var BPromise=require(_0x0ade('0x3'));var rs=require(_0x0ade('0x4'));var fs=require('fs');var Redis=require(_0x0ade('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ade('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ade('0x7'));var jayson=require(_0x0ade('0x8'));var client=jayson['client'][_0x0ade('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3774,_0x333943,_0x9046b7){return new BPromise(function(_0x3670c4,_0x156d4b){return client[_0x0ade('0xa')](_0x3c3774,_0x9046b7)[_0x0ade('0xb')](function(_0x38d549){logger[_0x0ade('0xc')]('Interval,\x20%s,\x20%s',_0x333943,_0x0ade('0xd'));logger['debug'](_0x0ade('0xe'),_0x333943,_0x0ade('0xd'),JSON[_0x0ade('0xf')](_0x38d549));if(_0x38d549[_0x0ade('0x10')]){if(_0x38d549['error'][_0x0ade('0x11')]===0x1f4){logger[_0x0ade('0x10')](_0x0ade('0x12'),_0x333943,_0x38d549[_0x0ade('0x10')]['message']);return _0x156d4b(_0x38d549[_0x0ade('0x10')][_0x0ade('0x13')]);}logger[_0x0ade('0x10')](_0x0ade('0x12'),_0x333943,_0x38d549['error'][_0x0ade('0x13')]);return _0x3670c4(_0x38d549['error']['message']);}else{logger[_0x0ade('0xc')](_0x0ade('0x12'),_0x333943,_0x0ade('0xd'));_0x3670c4(_0x38d549[_0x0ade('0x14')][_0x0ade('0x13')]);}})['catch'](function(_0x3aabb3){logger[_0x0ade('0x10')](_0x0ade('0x12'),_0x333943,_0x3aabb3);_0x156d4b(_0x3aabb3);});});}exports[_0x0ade('0x15')]=function(_0x445dbb){var _0x2b49c1=this;return new Promise(function(_0xeea8c8,_0x4f2bd7){return db[_0x0ade('0x16')][_0x0ade('0x17')]({'raw':_0x445dbb['options']?_0x445dbb[_0x0ade('0x18')][_0x0ade('0x19')]===undefined?!![]:![]:!![],'where':_0x445dbb[_0x0ade('0x18')]?_0x445dbb[_0x0ade('0x18')][_0x0ade('0x1a')]||null:null,'attributes':_0x445dbb[_0x0ade('0x18')]?_0x445dbb[_0x0ade('0x18')][_0x0ade('0x1b')]||null:null,'limit':_0x445dbb[_0x0ade('0x18')]?_0x445dbb[_0x0ade('0x18')]['limit']||null:null,'include':_0x445dbb[_0x0ade('0x18')]?_0x445dbb[_0x0ade('0x18')][_0x0ade('0x1c')]?_['map'](_0x445dbb[_0x0ade('0x18')][_0x0ade('0x1c')],function(_0x1ee298){return{'model':db[_0x1ee298[_0x0ade('0x1d')]],'as':_0x1ee298['as'],'attributes':_0x1ee298['attributes'],'include':_0x1ee298[_0x0ade('0x1c')]?_['map'](_0x1ee298[_0x0ade('0x1c')],function(_0x5afd1c){return{'model':db[_0x5afd1c[_0x0ade('0x1d')]],'as':_0x5afd1c['as'],'attributes':_0x5afd1c['attributes'],'include':_0x5afd1c['include']?_['map'](_0x5afd1c[_0x0ade('0x1c')],function(_0x3bdcec){return{'model':db[_0x3bdcec[_0x0ade('0x1d')]],'as':_0x3bdcec['as'],'attributes':_0x3bdcec[_0x0ade('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ade('0xb')](function(_0x9cf6de){logger[_0x0ade('0xc')](_0x0ade('0x15'),_0x445dbb);logger[_0x0ade('0x1e')](_0x0ade('0x15'),_0x445dbb,JSON[_0x0ade('0xf')](_0x9cf6de));_0xeea8c8(_0x9cf6de);})['catch'](function(_0x10c83f){logger['error']('GetInterval',_0x10c83f[_0x0ade('0x13')],_0x445dbb);_0x4f2bd7(_0x2b49c1['error'](0x1f4,_0x10c83f[_0x0ade('0x13')]));});});};exports[_0x0ade('0x1f')]=function(_0x1a81a9){var _0x3a72c6=this;return new Promise(function(_0x1af9d4,_0x54a3c9){return db['Interval'][_0x0ade('0x20')]({'raw':_0x1a81a9[_0x0ade('0x18')]?_0x1a81a9[_0x0ade('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1a81a9[_0x0ade('0x18')]?_0x1a81a9[_0x0ade('0x18')][_0x0ade('0x1a')]||null:null,'attributes':_0x1a81a9[_0x0ade('0x18')]?_0x1a81a9[_0x0ade('0x18')][_0x0ade('0x1b')]||null:null,'include':_0x1a81a9[_0x0ade('0x18')]?_0x1a81a9[_0x0ade('0x18')][_0x0ade('0x1c')]?_[_0x0ade('0x21')](_0x1a81a9[_0x0ade('0x18')][_0x0ade('0x1c')],function(_0x39327e){return{'model':db[_0x39327e[_0x0ade('0x1d')]],'as':_0x39327e['as'],'attributes':_0x39327e['attributes'],'include':_0x39327e[_0x0ade('0x1c')]?_[_0x0ade('0x21')](_0x39327e[_0x0ade('0x1c')],function(_0x1fa615){return{'model':db[_0x1fa615['model']],'as':_0x1fa615['as'],'attributes':_0x1fa615[_0x0ade('0x1b')],'include':_0x1fa615[_0x0ade('0x1c')]?_['map'](_0x1fa615['include'],function(_0x5ec92a){return{'model':db[_0x5ec92a[_0x0ade('0x1d')]],'as':_0x5ec92a['as'],'attributes':_0x5ec92a[_0x0ade('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18285b){logger[_0x0ade('0xc')](_0x0ade('0x1f'),_0x1a81a9);logger[_0x0ade('0x1e')](_0x0ade('0x1f'),_0x1a81a9,JSON[_0x0ade('0xf')](_0x18285b));_0x1af9d4(_0x18285b);})[_0x0ade('0x22')](function(_0x3b53f1){logger[_0x0ade('0x10')](_0x0ade('0x1f'),_0x3b53f1[_0x0ade('0x13')],_0x1a81a9);_0x54a3c9(_0x3a72c6['error'](0x1f4,_0x3b53f1[_0x0ade('0x13')]));});});}; \ No newline at end of file +var _0x5fa3=['request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetInterval','Interval','findAll','options','raw','where','limit','include','model','attributes','map','catch','ShowInterval','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4a55d5,_0x1a5928){var _0x2df00b=function(_0x592893){while(--_0x592893){_0x4a55d5['push'](_0x4a55d5['shift']());}};_0x2df00b(++_0x1a5928);}(_0x5fa3,0x16c));var _0x35fa=function(_0x3f7462,_0x2da508){_0x3f7462=_0x3f7462-0x0;var _0x3aa546=_0x5fa3[_0x3f7462];return _0x3aa546;};'use strict';var _=require(_0x35fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x35fa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35fa('0x2'));var db=require(_0x35fa('0x3'))['db'];var utils=require(_0x35fa('0x4'));var logger=require(_0x35fa('0x5'))(_0x35fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x35fa('0x7'));var client=jayson[_0x35fa('0x8')][_0x35fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26eff4,_0x39bd3b,_0x529a9f){return new BPromise(function(_0x3d74b4,_0x3f33c2){return client[_0x35fa('0xa')](_0x26eff4,_0x529a9f)[_0x35fa('0xb')](function(_0x1b8637){logger[_0x35fa('0xc')](_0x35fa('0xd'),_0x39bd3b,_0x35fa('0xe'));logger[_0x35fa('0xf')](_0x35fa('0x10'),_0x39bd3b,_0x35fa('0xe'),JSON[_0x35fa('0x11')](_0x1b8637));if(_0x1b8637['error']){if(_0x1b8637['error'][_0x35fa('0x12')]===0x1f4){logger[_0x35fa('0x13')]('Interval,\x20%s,\x20%s',_0x39bd3b,_0x1b8637[_0x35fa('0x13')][_0x35fa('0x14')]);return _0x3f33c2(_0x1b8637[_0x35fa('0x13')][_0x35fa('0x14')]);}logger[_0x35fa('0x13')](_0x35fa('0xd'),_0x39bd3b,_0x1b8637[_0x35fa('0x13')]['message']);return _0x3d74b4(_0x1b8637[_0x35fa('0x13')][_0x35fa('0x14')]);}else{logger[_0x35fa('0xc')]('Interval,\x20%s,\x20%s',_0x39bd3b,_0x35fa('0xe'));_0x3d74b4(_0x1b8637['result'][_0x35fa('0x14')]);}})['catch'](function(_0x14a2d1){logger[_0x35fa('0x13')]('Interval,\x20%s,\x20%s',_0x39bd3b,_0x14a2d1);_0x3f33c2(_0x14a2d1);});});}exports[_0x35fa('0x15')]=function(_0x150fc7){var _0x1239d6=this;return new Promise(function(_0x3778f4,_0x2555ed){return db[_0x35fa('0x16')][_0x35fa('0x17')]({'raw':_0x150fc7[_0x35fa('0x18')]?_0x150fc7[_0x35fa('0x18')][_0x35fa('0x19')]===undefined?!![]:![]:!![],'where':_0x150fc7[_0x35fa('0x18')]?_0x150fc7['options'][_0x35fa('0x1a')]||null:null,'attributes':_0x150fc7[_0x35fa('0x18')]?_0x150fc7[_0x35fa('0x18')]['attributes']||null:null,'limit':_0x150fc7['options']?_0x150fc7['options'][_0x35fa('0x1b')]||null:null,'include':_0x150fc7[_0x35fa('0x18')]?_0x150fc7[_0x35fa('0x18')][_0x35fa('0x1c')]?_['map'](_0x150fc7[_0x35fa('0x18')][_0x35fa('0x1c')],function(_0x4e859c){return{'model':db[_0x4e859c[_0x35fa('0x1d')]],'as':_0x4e859c['as'],'attributes':_0x4e859c[_0x35fa('0x1e')],'include':_0x4e859c[_0x35fa('0x1c')]?_[_0x35fa('0x1f')](_0x4e859c[_0x35fa('0x1c')],function(_0x563448){return{'model':db[_0x563448[_0x35fa('0x1d')]],'as':_0x563448['as'],'attributes':_0x563448['attributes'],'include':_0x563448[_0x35fa('0x1c')]?_[_0x35fa('0x1f')](_0x563448[_0x35fa('0x1c')],function(_0x171085){return{'model':db[_0x171085[_0x35fa('0x1d')]],'as':_0x171085['as'],'attributes':_0x171085[_0x35fa('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c4cb6){logger[_0x35fa('0xc')]('GetInterval',_0x150fc7);logger[_0x35fa('0xf')]('GetInterval',_0x150fc7,JSON[_0x35fa('0x11')](_0x2c4cb6));_0x3778f4(_0x2c4cb6);})[_0x35fa('0x20')](function(_0x648901){logger[_0x35fa('0x13')]('GetInterval',_0x648901['message'],_0x150fc7);_0x2555ed(_0x1239d6[_0x35fa('0x13')](0x1f4,_0x648901[_0x35fa('0x14')]));});});};exports[_0x35fa('0x21')]=function(_0x32c2c4){var _0x20c3ef=this;return new Promise(function(_0x4080f7,_0x20d13c){return db['Interval']['find']({'raw':_0x32c2c4[_0x35fa('0x18')]?_0x32c2c4[_0x35fa('0x18')][_0x35fa('0x19')]===undefined?!![]:![]:!![],'where':_0x32c2c4[_0x35fa('0x18')]?_0x32c2c4[_0x35fa('0x18')]['where']||null:null,'attributes':_0x32c2c4[_0x35fa('0x18')]?_0x32c2c4[_0x35fa('0x18')][_0x35fa('0x1e')]||null:null,'include':_0x32c2c4[_0x35fa('0x18')]?_0x32c2c4[_0x35fa('0x18')][_0x35fa('0x1c')]?_[_0x35fa('0x1f')](_0x32c2c4[_0x35fa('0x18')][_0x35fa('0x1c')],function(_0x4e6abc){return{'model':db[_0x4e6abc[_0x35fa('0x1d')]],'as':_0x4e6abc['as'],'attributes':_0x4e6abc[_0x35fa('0x1e')],'include':_0x4e6abc[_0x35fa('0x1c')]?_[_0x35fa('0x1f')](_0x4e6abc['include'],function(_0x33215c){return{'model':db[_0x33215c['model']],'as':_0x33215c['as'],'attributes':_0x33215c[_0x35fa('0x1e')],'include':_0x33215c['include']?_[_0x35fa('0x1f')](_0x33215c[_0x35fa('0x1c')],function(_0x4c0977){return{'model':db[_0x4c0977[_0x35fa('0x1d')]],'as':_0x4c0977['as'],'attributes':_0x4c0977[_0x35fa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35fa('0xb')](function(_0x176fa6){logger[_0x35fa('0xc')]('ShowInterval',_0x32c2c4);logger[_0x35fa('0xf')](_0x35fa('0x21'),_0x32c2c4,JSON[_0x35fa('0x11')](_0x176fa6));_0x4080f7(_0x176fa6);})[_0x35fa('0x20')](function(_0x5dac93){logger[_0x35fa('0x13')]('ShowInterval',_0x5dac93[_0x35fa('0x14')],_0x32c2c4);_0x20d13c(_0x20c3ef[_0x35fa('0x13')](0x1f4,_0x5dac93['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0c36c7d..8acda82 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 _0x6aa4=['isAuthenticated','exports','express','Router','./jira.controller','post'];(function(_0x32897b,_0x21bee8){var _0x4394ce=function(_0x2b7a5b){while(--_0x2b7a5b){_0x32897b['push'](_0x32897b['shift']());}};_0x4394ce(++_0x21bee8);}(_0x6aa4,0x12e));var _0x46aa=function(_0x3a4aee,_0x313912){_0x3a4aee=_0x3a4aee-0x0;var _0x45bd7c=_0x6aa4[_0x3a4aee];return _0x45bd7c;};'use strict';var express=require(_0x46aa('0x0'));var router=express[_0x46aa('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x46aa('0x2'));router[_0x46aa('0x3')]('/',auth[_0x46aa('0x4')](),controller['send']);module[_0x46aa('0x5')]=router; \ No newline at end of file +var _0x503b=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x503b,0xdf));var _0xb503=function(_0x2323a5,_0x2a2a92){_0x2323a5=_0x2323a5-0x0;var _0x5052b0=_0x503b[_0x2323a5];return _0x5052b0;};'use strict';var express=require(_0xb503('0x0'));var router=express[_0xb503('0x1')]();var auth=require(_0xb503('0x2'));var controller=require(_0xb503('0x3'));router[_0xb503('0x4')]('/',auth[_0xb503('0x5')](),controller[_0xb503('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7b5b294..84e516e 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 _0xf6c0=['issuetype','Bug','fields','customfield_11500','email','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','end','error','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify'];(function(_0x437472,_0x31db2d){var _0x217fce=function(_0x593ccd){while(--_0x593ccd){_0x437472['push'](_0x437472['shift']());}};_0x217fce(++_0x31db2d);}(_0xf6c0,0x145));var _0x0f6c=function(_0x6dc660,_0x5e63fb){_0x6dc660=_0x6dc660-0x0;var _0x4fa02a=_0xf6c0[_0x6dc660];return _0x4fa02a;};'use strict';var BPromise=require(_0x0f6c('0x0'));var https=require(_0x0f6c('0x1'));var logger=require(_0x0f6c('0x2'))(_0x0f6c('0x3'));var USERNAME=_0x0f6c('0x4');var PASSWORD=_0x0f6c('0x5');function openIssue(_0x35f803,_0x515c0f){var _0x2962de={'fields':{'project':{'key':_0x35f803[_0x0f6c('0x6')]||_0x0f6c('0x7')},'summary':(_0x35f803['summary']||_0x0f6c('0x8'))+'\x20from\x20'+_0x35f803['ip'],'description':_0x35f803[_0x0f6c('0x9')]||JSON[_0x0f6c('0xa')](_0x35f803),'issuetype':{'name':_0x35f803[_0x0f6c('0xb')]||_0x0f6c('0xc')}}};_0x2962de[_0x0f6c('0xd')][_0x0f6c('0xe')]=_0x35f803[_0x0f6c('0xf')];_0x2962de[_0x0f6c('0xd')]['customfield_11501']=_0x35f803['oldToken'];_0x2962de[_0x0f6c('0xd')][_0x0f6c('0x10')]=_0x35f803[_0x0f6c('0x11')];_0x2962de[_0x0f6c('0xd')]['customfield_11503']=_0x35f803[_0x0f6c('0x12')];_0x2962de[_0x0f6c('0xd')][_0x0f6c('0x13')]=_0x35f803[_0x0f6c('0x14')];_0x2962de['fields'][_0x0f6c('0x15')]=_0x35f803['ip'];var _0x4db363={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x0f6c('0x16'),'method':_0x0f6c('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x0f6c('0x18')](_0x0f6c('0x19'))}};var _0x986e79=JSON[_0x0f6c('0xa')](_0x2962de);var _0x2f299c=https[_0x0f6c('0x1a')](_0x4db363,function(_0xfebbd4){_0xfebbd4[_0x0f6c('0x1b')](_0x0f6c('0x1c'));var _0xebc37b='';_0xfebbd4['on']('data',function(_0x2233dc){_0xebc37b+=_0x2233dc;});_0xfebbd4['on'](_0x0f6c('0x1d'),function(){if(_0x515c0f){return _0x515c0f['status'](_0xfebbd4['statusCode'])['json'](JSON['parse'](_0xebc37b));}});});_0x2f299c['on'](_0x0f6c('0x1e'),function(_0x2e40ed){if(_0x515c0f){return _0x515c0f[_0x0f6c('0x1f')](0x1f4)[_0x0f6c('0x20')]({'errors':[{'message':_0x0f6c('0x21'),'type':_0x0f6c('0x22')}]});}});_0x2f299c[_0x0f6c('0x23')](_0x986e79);_0x2f299c[_0x0f6c('0x1d')]();}exports['openIssue']=openIssue;exports['send']=function(_0x1c6c43,_0x4d4831){_0x1c6c43[_0x0f6c('0x24')]['ip']=_0x1c6c43[_0x0f6c('0x25')][_0x0f6c('0x26')]||_0x1c6c43[_0x0f6c('0x27')][_0x0f6c('0x28')]||_0x1c6c43[_0x0f6c('0x29')][_0x0f6c('0x28')]||_0x1c6c43['connection']['socket'][_0x0f6c('0x28')];return openIssue(_0x1c6c43[_0x0f6c('0x24')],_0x4d4831);}; \ No newline at end of file +var _0x2933=['setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','headers','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','stringify','issuetype','Bug','customfield_11500','email','fields','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64'];(function(_0x417d30,_0x32cfdb){var _0x460dbe=function(_0x2c41bc){while(--_0x2c41bc){_0x417d30['push'](_0x417d30['shift']());}};_0x460dbe(++_0x32cfdb);}(_0x2933,0xe8));var _0x3293=function(_0x21282a,_0x3c3fac){_0x21282a=_0x21282a-0x0;var _0xb7ca67=_0x2933[_0x21282a];return _0xb7ca67;};'use strict';var BPromise=require(_0x3293('0x0'));var https=require(_0x3293('0x1'));var logger=require(_0x3293('0x2'))(_0x3293('0x3'));var USERNAME='support';var PASSWORD=_0x3293('0x4');function openIssue(_0x9dcf6,_0x2a714d){var _0x34007c={'fields':{'project':{'key':_0x9dcf6[_0x3293('0x5')]||_0x3293('0x6')},'summary':(_0x9dcf6[_0x3293('0x7')]||'Report')+'\x20from\x20'+_0x9dcf6['ip'],'description':_0x9dcf6['description']||JSON[_0x3293('0x8')](_0x9dcf6),'issuetype':{'name':_0x9dcf6[_0x3293('0x9')]||_0x3293('0xa')}}};_0x34007c['fields'][_0x3293('0xb')]=_0x9dcf6[_0x3293('0xc')];_0x34007c[_0x3293('0xd')]['customfield_11501']=_0x9dcf6[_0x3293('0xe')];_0x34007c[_0x3293('0xd')][_0x3293('0xf')]=_0x9dcf6['newToken'];_0x34007c[_0x3293('0xd')]['customfield_11503']=_0x9dcf6[_0x3293('0x10')];_0x34007c['fields'][_0x3293('0x11')]=_0x9dcf6[_0x3293('0x12')];_0x34007c[_0x3293('0xd')][_0x3293('0x13')]=_0x9dcf6['ip'];var _0x1dbadf={'host':_0x3293('0x14'),'port':0x1bb,'path':_0x3293('0x15'),'method':_0x3293('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x3293('0x17'),'Authorization':_0x3293('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3293('0x19'))}};var _0x3ae6ee=JSON[_0x3293('0x8')](_0x34007c);var _0xac5cd4=https['request'](_0x1dbadf,function(_0x4ba7dc){_0x4ba7dc[_0x3293('0x1a')](_0x3293('0x1b'));var _0x20a4fe='';_0x4ba7dc['on'](_0x3293('0x1c'),function(_0xf671ea){_0x20a4fe+=_0xf671ea;});_0x4ba7dc['on']('end',function(){if(_0x2a714d){return _0x2a714d[_0x3293('0x1d')](_0x4ba7dc[_0x3293('0x1e')])[_0x3293('0x1f')](JSON[_0x3293('0x20')](_0x20a4fe));}});});_0xac5cd4['on'](_0x3293('0x21'),function(_0x4d64f7){if(_0x2a714d){return _0x2a714d[_0x3293('0x1d')](0x1f4)[_0x3293('0x1f')]({'errors':[{'message':_0x3293('0x22'),'type':'api.jira'}]});}});_0xac5cd4[_0x3293('0x23')](_0x3ae6ee);_0xac5cd4['end']();}exports[_0x3293('0x24')]=openIssue;exports[_0x3293('0x25')]=function(_0x40b57c,_0x5d8b5e){_0x40b57c['body']['ip']=_0x40b57c[_0x3293('0x26')]['x-forwarded-for']||_0x40b57c[_0x3293('0x27')][_0x3293('0x28')]||_0x40b57c[_0x3293('0x29')][_0x3293('0x28')]||_0x40b57c['connection'][_0x3293('0x29')][_0x3293('0x28')];return openIssue(_0x40b57c[_0x3293('0x2a')],_0x5d8b5e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 637a4e6..67b4500 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 _0xc806=['update','destroy','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x506931,_0x1ca545){var _0x2126dc=function(_0x43c55c){while(--_0x43c55c){_0x506931['push'](_0x506931['shift']());}};_0x2126dc(++_0x1ca545);}(_0xc806,0x1e2));var _0x6c80=function(_0x4477cf,_0x5565bd){_0x4477cf=_0x4477cf-0x0;var _0xfa8f87=_0xc806[_0x4477cf];return _0xfa8f87;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c80('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x6c80('0x1'));var interaction=require(_0x6c80('0x2'));var config=require(_0x6c80('0x3'));var controller=require(_0x6c80('0x4'));router[_0x6c80('0x5')]('/',auth[_0x6c80('0x6')](),controller[_0x6c80('0x7')]);router[_0x6c80('0x5')](_0x6c80('0x8'),auth[_0x6c80('0x6')](),controller['describe']);router[_0x6c80('0x5')](_0x6c80('0x9'),auth[_0x6c80('0x6')](),controller[_0x6c80('0xa')]);router[_0x6c80('0xb')]('/',auth[_0x6c80('0x6')](),controller[_0x6c80('0xc')]);router[_0x6c80('0xd')](_0x6c80('0x9'),auth['isAuthenticated'](),controller[_0x6c80('0xe')]);router['delete'](_0x6c80('0x9'),auth[_0x6c80('0x6')](),controller[_0x6c80('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa486=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xa486,0x156));var _0x6a48=function(_0x38b746,_0x47b300){_0x38b746=_0x38b746-0x0;var _0x36f200=_0xa486[_0x38b746];return _0x36f200;};'use strict';var multer=require(_0x6a48('0x0'));var util=require('util');var path=require(_0x6a48('0x1'));var timeout=require(_0x6a48('0x2'));var express=require(_0x6a48('0x3'));var router=express[_0x6a48('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a48('0x5'));var config=require(_0x6a48('0x6'));var controller=require(_0x6a48('0x7'));router[_0x6a48('0x8')]('/',auth[_0x6a48('0x9')](),controller[_0x6a48('0xa')]);router[_0x6a48('0x8')](_0x6a48('0xb'),auth['isAuthenticated'](),controller[_0x6a48('0xc')]);router['get']('/:id',auth[_0x6a48('0x9')](),controller[_0x6a48('0xd')]);router[_0x6a48('0xe')]('/',auth[_0x6a48('0x9')](),controller[_0x6a48('0xf')]);router['put'](_0x6a48('0x10'),auth[_0x6a48('0x9')](),controller[_0x6a48('0x11')]);router[_0x6a48('0x12')]('/:id',auth[_0x6a48('0x9')](),controller['destroy']);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 0bb2839..28f9f17 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 _0x50cd=['STRING','TEXT','long','sequelize','exports'];(function(_0x4011b8,_0x56e92f){var _0x428a03=function(_0x2e2cc1){while(--_0x2e2cc1){_0x4011b8['push'](_0x4011b8['shift']());}};_0x428a03(++_0x56e92f);}(_0x50cd,0x166));var _0xd50c=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x50cd[_0x5e709a];return _0x57401a;};'use strict';var Sequelize=require(_0xd50c('0x0'));module[_0xd50c('0x1')]={'question':{'type':Sequelize[_0xd50c('0x2')]},'answer':{'type':Sequelize[_0xd50c('0x3')](_0xd50c('0x4'))},'membername':{'type':Sequelize[_0xd50c('0x2')]},'projectname':{'type':Sequelize[_0xd50c('0x2')]},'queue':{'type':Sequelize[_0xd50c('0x2')]},'uniqueid':{'type':Sequelize[_0xd50c('0x2')]},'calleridname':{'type':Sequelize[_0xd50c('0x2')]},'calleridnum':{'type':Sequelize[_0xd50c('0x2')]},'questionId':{'type':Sequelize[_0xd50c('0x2')]}}; \ No newline at end of file +var _0xdb26=['long','exports','STRING'];(function(_0x46bba7,_0x3154b){var _0x2f323f=function(_0x3ca103){while(--_0x3ca103){_0x46bba7['push'](_0x46bba7['shift']());}};_0x2f323f(++_0x3154b);}(_0xdb26,0x127));var _0x6db2=function(_0x5bfd00,_0x3e3371){_0x5bfd00=_0x5bfd00-0x0;var _0x440238=_0xdb26[_0x5bfd00];return _0x440238;};'use strict';var Sequelize=require('sequelize');module[_0x6db2('0x0')]={'question':{'type':Sequelize[_0x6db2('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x6db2('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6db2('0x1')]},'queue':{'type':Sequelize[_0x6db2('0x1')]},'uniqueid':{'type':Sequelize[_0x6db2('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6db2('0x1')]},'questionId':{'type':Sequelize[_0x6db2('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index c3b6a8b..1fe3ef3 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 _0xbde7=['params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','error','JscriptyAnswerReport','fieldName','type','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','body'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xbde7,0x8c));var _0x7bde=function(_0x1bafb1,_0x3f4d43){_0x1bafb1=_0x1bafb1-0x0;var _0x1e9aa9=_0xbde7[_0x1bafb1];return _0x1e9aa9;};'use strict';var pdf=require(_0x7bde('0x0'));var emlformat=require(_0x7bde('0x1'));var rimraf=require(_0x7bde('0x2'));var zipdir=require(_0x7bde('0x3'));var jsonpatch=require(_0x7bde('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bde('0x5'));var Mustache=require('mustache');var util=require(_0x7bde('0x6'));var path=require(_0x7bde('0x7'));var sox=require(_0x7bde('0x8'));var csv=require(_0x7bde('0x9'));var ejs=require(_0x7bde('0xa'));var fs=require('fs');var _=require(_0x7bde('0xb'));var squel=require(_0x7bde('0xc'));var crypto=require(_0x7bde('0xd'));var jsforce=require(_0x7bde('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7bde('0x9'));var querystring=require(_0x7bde('0xf'));var Papa=require(_0x7bde('0x10'));var Redis=require(_0x7bde('0x11'));var authService=require(_0x7bde('0x12'));var qs=require(_0x7bde('0x13'));var as=require(_0x7bde('0x14'));var hardwareService=require(_0x7bde('0x15'));var logger=require(_0x7bde('0x16'))(_0x7bde('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7bde('0x18'))['db'];function respondWithStatusCode(_0x5855cc,_0x365506){_0x365506=_0x365506||0xcc;return function(_0x59cfde){if(_0x59cfde){return _0x5855cc[_0x7bde('0x19')](_0x365506);}return _0x5855cc[_0x7bde('0x1a')](_0x365506)[_0x7bde('0x1b')]();};}function respondWithResult(_0x4053a6,_0x2cbbdc){_0x2cbbdc=_0x2cbbdc||0xc8;return function(_0x43f80e){if(_0x43f80e){return _0x4053a6['status'](_0x2cbbdc)[_0x7bde('0x1c')](_0x43f80e);}};}function respondWithFilteredResult(_0x433a59,_0x367034){return function(_0x4ecdff){if(_0x4ecdff){var _0x565b55=_0x4ecdff[_0x7bde('0x1d')],_0x4bdb29=_0x367034[_0x7bde('0x1e')],_0x506c4a=_0x367034['offset']+_0x367034[_0x7bde('0x1f')],_0x3c8683;if(_0x506c4a>=_0x565b55){_0x506c4a=_0x565b55;_0x3c8683=0xc8;}else{_0x3c8683=0xce;}_0x433a59[_0x7bde('0x1a')](_0x3c8683);return _0x433a59[_0x7bde('0x20')]('Content-Range',_0x4bdb29+'-'+_0x506c4a+'/'+_0x565b55)[_0x7bde('0x1c')](_0x4ecdff);}return null;};}function patchUpdates(_0x949230){return function(_0x5e7859){try{jsonpatch[_0x7bde('0x21')](_0x5e7859,_0x949230,!![]);}catch(_0x33a5ca){return BPromise[_0x7bde('0x22')](_0x33a5ca);}return _0x5e7859[_0x7bde('0x23')]();};}function saveUpdates(_0x5cb215,_0x2a6e0a){return function(_0x3b2eb7){if(_0x3b2eb7){return _0x3b2eb7['update'](_0x5cb215)['then'](function(_0x2dbbd8){return _0x2dbbd8;});}return null;};}function removeEntity(_0x591160,_0x3f2b67){return function(_0x4d9c6a){if(_0x4d9c6a){return _0x4d9c6a[_0x7bde('0x24')]()[_0x7bde('0x25')](function(){_0x591160[_0x7bde('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3830e5,_0x4741cd){return function(_0xa49e61){if(!_0xa49e61){_0x3830e5[_0x7bde('0x19')](0x194);}return _0xa49e61;};}function handleError(_0x9df971,_0x4d9dec){_0x4d9dec=_0x4d9dec||0x1f4;return function(_0x534836){logger[_0x7bde('0x26')](_0x534836['stack']);if(_0x534836['name']){delete _0x534836['name'];}_0x9df971[_0x7bde('0x1a')](_0x4d9dec)['send'](_0x534836);};}exports['index']=function(_0x321cf3,_0x556e37){var _0x563084={},_0x3f3654={},_0x25f5cc={'count':0x0,'rows':[]};var _0x46468c=_['map'](db[_0x7bde('0x27')]['rawAttributes'],function(_0x309b0b){return{'name':_0x309b0b[_0x7bde('0x28')],'type':_0x309b0b[_0x7bde('0x29')]['key']};});_0x3f3654[_0x7bde('0x2a')]=_[_0x7bde('0x2b')](_0x46468c,_0x7bde('0x2c'));_0x3f3654[_0x7bde('0x2d')]=_[_0x7bde('0x2e')](_0x321cf3['query']);_0x3f3654[_0x7bde('0x2f')]=_[_0x7bde('0x30')](_0x3f3654[_0x7bde('0x2a')],_0x3f3654[_0x7bde('0x2d')]);_0x563084['attributes']=_[_0x7bde('0x30')](_0x3f3654[_0x7bde('0x2a')],qs[_0x7bde('0x31')](_0x321cf3['query'][_0x7bde('0x31')]));_0x563084[_0x7bde('0x32')]=_0x563084[_0x7bde('0x32')][_0x7bde('0x33')]?_0x563084['attributes']:_0x3f3654[_0x7bde('0x2a')];if(!_0x321cf3[_0x7bde('0x2d')][_0x7bde('0x34')](_0x7bde('0x35'))){_0x563084[_0x7bde('0x1f')]=qs[_0x7bde('0x1f')](_0x321cf3['query'][_0x7bde('0x1f')]);_0x563084[_0x7bde('0x1e')]=qs['offset'](_0x321cf3['query'][_0x7bde('0x1e')]);}_0x563084['order']=qs[_0x7bde('0x36')](_0x321cf3[_0x7bde('0x2d')][_0x7bde('0x36')]);_0x563084[_0x7bde('0x37')]=qs['filters'](_['pick'](_0x321cf3['query'],_0x3f3654[_0x7bde('0x2f')]),_0x46468c);if(_0x321cf3[_0x7bde('0x2d')][_0x7bde('0x38')]){_0x563084[_0x7bde('0x37')]=_[_0x7bde('0x39')](_0x563084[_0x7bde('0x37')],{'$or':_['map'](_0x46468c,function(_0x29c919){if(_0x29c919[_0x7bde('0x29')]!=='VIRTUAL'){var _0x585d46={};_0x585d46[_0x29c919['name']]={'$like':'%'+_0x321cf3[_0x7bde('0x2d')][_0x7bde('0x38')]+'%'};return _0x585d46;}})});}_0x563084=_[_0x7bde('0x39')]({},_0x563084,_0x321cf3[_0x7bde('0x3a')]);var _0x42ae1e={'where':_0x563084[_0x7bde('0x37')]};return db[_0x7bde('0x27')]['count'](_0x42ae1e)['then'](function(_0x160d88){_0x25f5cc[_0x7bde('0x1d')]=_0x160d88;if(_0x321cf3['query'][_0x7bde('0x3b')]){_0x563084[_0x7bde('0x3c')]=[{'all':!![]}];}return db[_0x7bde('0x27')][_0x7bde('0x3d')](_0x563084);})[_0x7bde('0x25')](function(_0x3a0a74){_0x25f5cc[_0x7bde('0x3e')]=_0x3a0a74;return _0x25f5cc;})['then'](respondWithFilteredResult(_0x556e37,_0x563084))[_0x7bde('0x3f')](handleError(_0x556e37,null));};exports['show']=function(_0x545eda,_0x2b24ea){var _0x1ab169={'raw':!![],'where':{'id':_0x545eda['params']['id']}},_0x2c9904={};_0x2c9904[_0x7bde('0x2a')]=_[_0x7bde('0x2e')](db['JscriptyAnswerReport'][_0x7bde('0x40')]);_0x2c9904[_0x7bde('0x2d')]=_[_0x7bde('0x2e')](_0x545eda[_0x7bde('0x2d')]);_0x2c9904[_0x7bde('0x2f')]=_['intersection'](_0x2c9904['model'],_0x2c9904[_0x7bde('0x2d')]);_0x1ab169[_0x7bde('0x32')]=_[_0x7bde('0x30')](_0x2c9904[_0x7bde('0x2a')],qs[_0x7bde('0x31')](_0x545eda[_0x7bde('0x2d')][_0x7bde('0x31')]));_0x1ab169[_0x7bde('0x32')]=_0x1ab169[_0x7bde('0x32')][_0x7bde('0x33')]?_0x1ab169[_0x7bde('0x32')]:_0x2c9904[_0x7bde('0x2a')];if(_0x545eda[_0x7bde('0x2d')][_0x7bde('0x3b')]){_0x1ab169[_0x7bde('0x3c')]=[{'all':!![]}];}_0x1ab169=_['merge']({},_0x1ab169,_0x545eda[_0x7bde('0x3a')]);return db['JscriptyAnswerReport'][_0x7bde('0x41')](_0x1ab169)['then'](handleEntityNotFound(_0x2b24ea,null))[_0x7bde('0x25')](respondWithResult(_0x2b24ea,null))[_0x7bde('0x3f')](handleError(_0x2b24ea,null));};exports['create']=function(_0x3bb910,_0x34726b){return db[_0x7bde('0x27')]['create'](_0x3bb910['body'],{})[_0x7bde('0x25')](respondWithResult(_0x34726b,0xc9))['catch'](handleError(_0x34726b,null));};exports['update']=function(_0xb80a32,_0x103b23){if(_0xb80a32['body']['id']){delete _0xb80a32[_0x7bde('0x42')]['id'];}return db['JscriptyAnswerReport'][_0x7bde('0x41')]({'where':{'id':_0xb80a32['params']['id']}})[_0x7bde('0x25')](handleEntityNotFound(_0x103b23,null))[_0x7bde('0x25')](saveUpdates(_0xb80a32[_0x7bde('0x42')],null))[_0x7bde('0x25')](respondWithResult(_0x103b23,null))['catch'](handleError(_0x103b23,null));};exports['destroy']=function(_0x27b795,_0x46b8c5){return db[_0x7bde('0x27')][_0x7bde('0x41')]({'where':{'id':_0x27b795[_0x7bde('0x43')]['id']}})[_0x7bde('0x25')](handleEntityNotFound(_0x46b8c5,null))['then'](removeEntity(_0x46b8c5,null))['catch'](handleError(_0x46b8c5,null));};exports[_0x7bde('0x44')]=function(_0x246957,_0x2709c7){return db[_0x7bde('0x27')][_0x7bde('0x44')]()['then'](respondWithResult(_0x2709c7,null))[_0x7bde('0x3f')](handleError(_0x2709c7,null));}; \ No newline at end of file +var _0x53e4=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe'];(function(_0x3ac4f1,_0x37fbef){var _0x347699=function(_0x4fb641){while(--_0x4fb641){_0x3ac4f1['push'](_0x3ac4f1['shift']());}};_0x347699(++_0x37fbef);}(_0x53e4,0xd5));var _0x453e=function(_0x18894b,_0xb20093){_0x18894b=_0x18894b-0x0;var _0x4b3230=_0x53e4[_0x18894b];return _0x4b3230;};'use strict';var pdf=require(_0x453e('0x0'));var emlformat=require(_0x453e('0x1'));var rimraf=require(_0x453e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x453e('0x3'));var rp=require(_0x453e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x453e('0x5'));var util=require(_0x453e('0x6'));var path=require(_0x453e('0x7'));var sox=require(_0x453e('0x8'));var csv=require('to-csv');var ejs=require(_0x453e('0x9'));var fs=require('fs');var _=require(_0x453e('0xa'));var squel=require(_0x453e('0xb'));var crypto=require(_0x453e('0xc'));var jsforce=require(_0x453e('0xd'));var deskjs=require(_0x453e('0xe'));var toCsv=require(_0x453e('0xf'));var querystring=require(_0x453e('0x10'));var Papa=require('papaparse');var Redis=require(_0x453e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x453e('0x12'));var as=require(_0x453e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x453e('0x14'))(_0x453e('0x15'));var utils=require('../../config/utils');var config=require(_0x453e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f51be,_0x269046){_0x269046=_0x269046||0xcc;return function(_0x1c9294){if(_0x1c9294){return _0x3f51be[_0x453e('0x17')](_0x269046);}return _0x3f51be['status'](_0x269046)['end']();};}function respondWithResult(_0x27a04c,_0x52c97b){_0x52c97b=_0x52c97b||0xc8;return function(_0x2f7c40){if(_0x2f7c40){return _0x27a04c[_0x453e('0x18')](_0x52c97b)['json'](_0x2f7c40);}};}function respondWithFilteredResult(_0x49a889,_0x35cd46){return function(_0x5b7759){if(_0x5b7759){var _0x4b74ff=_0x5b7759['count'],_0x2e8f57=_0x35cd46[_0x453e('0x19')],_0x376420=_0x35cd46[_0x453e('0x19')]+_0x35cd46[_0x453e('0x1a')],_0x3e6c1d;if(_0x376420>=_0x4b74ff){_0x376420=_0x4b74ff;_0x3e6c1d=0xc8;}else{_0x3e6c1d=0xce;}_0x49a889[_0x453e('0x18')](_0x3e6c1d);return _0x49a889[_0x453e('0x1b')](_0x453e('0x1c'),_0x2e8f57+'-'+_0x376420+'/'+_0x4b74ff)[_0x453e('0x1d')](_0x5b7759);}return null;};}function patchUpdates(_0x910ef3){return function(_0x10eaa6){try{jsonpatch[_0x453e('0x1e')](_0x10eaa6,_0x910ef3,!![]);}catch(_0x202eea){return BPromise[_0x453e('0x1f')](_0x202eea);}return _0x10eaa6[_0x453e('0x20')]();};}function saveUpdates(_0x51dfc7,_0x44e7b6){return function(_0x5c98f8){if(_0x5c98f8){return _0x5c98f8[_0x453e('0x21')](_0x51dfc7)[_0x453e('0x22')](function(_0x3638e0){return _0x3638e0;});}return null;};}function removeEntity(_0x9a3544,_0x4539a8){return function(_0x48acfa){if(_0x48acfa){return _0x48acfa['destroy']()[_0x453e('0x22')](function(){_0x9a3544[_0x453e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f42d,_0x555549){return function(_0x5ac56c){if(!_0x5ac56c){_0x59f42d[_0x453e('0x17')](0x194);}return _0x5ac56c;};}function handleError(_0x40baae,_0xa4a0c7){_0xa4a0c7=_0xa4a0c7||0x1f4;return function(_0x5c0452){logger[_0x453e('0x23')](_0x5c0452[_0x453e('0x24')]);if(_0x5c0452[_0x453e('0x25')]){delete _0x5c0452[_0x453e('0x25')];}_0x40baae[_0x453e('0x18')](_0xa4a0c7)[_0x453e('0x26')](_0x5c0452);};}exports[_0x453e('0x27')]=function(_0x2c70aa,_0x3f0b7c){var _0x3b4e01={},_0x36816d={},_0x3009b2={'count':0x0,'rows':[]};var _0x3e62da=_['map'](db[_0x453e('0x28')][_0x453e('0x29')],function(_0x4f9148){return{'name':_0x4f9148['fieldName'],'type':_0x4f9148[_0x453e('0x2a')][_0x453e('0x2b')]};});_0x36816d[_0x453e('0x2c')]=_['map'](_0x3e62da,_0x453e('0x25'));_0x36816d[_0x453e('0x2d')]=_[_0x453e('0x2e')](_0x2c70aa[_0x453e('0x2d')]);_0x36816d[_0x453e('0x2f')]=_[_0x453e('0x30')](_0x36816d[_0x453e('0x2c')],_0x36816d[_0x453e('0x2d')]);_0x3b4e01[_0x453e('0x31')]=_[_0x453e('0x30')](_0x36816d[_0x453e('0x2c')],qs[_0x453e('0x32')](_0x2c70aa[_0x453e('0x2d')]['fields']));_0x3b4e01[_0x453e('0x31')]=_0x3b4e01[_0x453e('0x31')]['length']?_0x3b4e01[_0x453e('0x31')]:_0x36816d[_0x453e('0x2c')];if(!_0x2c70aa[_0x453e('0x2d')]['hasOwnProperty']('nolimit')){_0x3b4e01[_0x453e('0x1a')]=qs['limit'](_0x2c70aa[_0x453e('0x2d')][_0x453e('0x1a')]);_0x3b4e01['offset']=qs[_0x453e('0x19')](_0x2c70aa[_0x453e('0x2d')][_0x453e('0x19')]);}_0x3b4e01[_0x453e('0x33')]=qs[_0x453e('0x34')](_0x2c70aa[_0x453e('0x2d')][_0x453e('0x34')]);_0x3b4e01[_0x453e('0x35')]=qs[_0x453e('0x2f')](_['pick'](_0x2c70aa[_0x453e('0x2d')],_0x36816d[_0x453e('0x2f')]),_0x3e62da);if(_0x2c70aa[_0x453e('0x2d')][_0x453e('0x36')]){_0x3b4e01[_0x453e('0x35')]=_[_0x453e('0x37')](_0x3b4e01[_0x453e('0x35')],{'$or':_[_0x453e('0x38')](_0x3e62da,function(_0x3930b9){if(_0x3930b9['type']!==_0x453e('0x39')){var _0x2bd34a={};_0x2bd34a[_0x3930b9[_0x453e('0x25')]]={'$like':'%'+_0x2c70aa[_0x453e('0x2d')][_0x453e('0x36')]+'%'};return _0x2bd34a;}})});}_0x3b4e01=_[_0x453e('0x37')]({},_0x3b4e01,_0x2c70aa[_0x453e('0x3a')]);var _0x2e8e74={'where':_0x3b4e01[_0x453e('0x35')]};return db[_0x453e('0x28')][_0x453e('0x3b')](_0x2e8e74)[_0x453e('0x22')](function(_0x1802a9){_0x3009b2[_0x453e('0x3b')]=_0x1802a9;if(_0x2c70aa[_0x453e('0x2d')][_0x453e('0x3c')]){_0x3b4e01[_0x453e('0x3d')]=[{'all':!![]}];}return db[_0x453e('0x28')][_0x453e('0x3e')](_0x3b4e01);})['then'](function(_0x10f595){_0x3009b2[_0x453e('0x3f')]=_0x10f595;return _0x3009b2;})['then'](respondWithFilteredResult(_0x3f0b7c,_0x3b4e01))[_0x453e('0x40')](handleError(_0x3f0b7c,null));};exports['show']=function(_0x22ef9f,_0x36f0b3){var _0x3f2549={'raw':!![],'where':{'id':_0x22ef9f[_0x453e('0x41')]['id']}},_0x1c817c={};_0x1c817c[_0x453e('0x2c')]=_[_0x453e('0x2e')](db[_0x453e('0x28')][_0x453e('0x29')]);_0x1c817c['query']=_['keys'](_0x22ef9f['query']);_0x1c817c[_0x453e('0x2f')]=_['intersection'](_0x1c817c[_0x453e('0x2c')],_0x1c817c['query']);_0x3f2549[_0x453e('0x31')]=_[_0x453e('0x30')](_0x1c817c[_0x453e('0x2c')],qs[_0x453e('0x32')](_0x22ef9f['query']['fields']));_0x3f2549[_0x453e('0x31')]=_0x3f2549['attributes']['length']?_0x3f2549[_0x453e('0x31')]:_0x1c817c[_0x453e('0x2c')];if(_0x22ef9f[_0x453e('0x2d')][_0x453e('0x3c')]){_0x3f2549['include']=[{'all':!![]}];}_0x3f2549=_['merge']({},_0x3f2549,_0x22ef9f['options']);return db[_0x453e('0x28')][_0x453e('0x42')](_0x3f2549)[_0x453e('0x22')](handleEntityNotFound(_0x36f0b3,null))[_0x453e('0x22')](respondWithResult(_0x36f0b3,null))[_0x453e('0x40')](handleError(_0x36f0b3,null));};exports[_0x453e('0x43')]=function(_0x5d83b6,_0x3ecce6){return db['JscriptyAnswerReport']['create'](_0x5d83b6[_0x453e('0x44')],{})[_0x453e('0x22')](respondWithResult(_0x3ecce6,0xc9))[_0x453e('0x40')](handleError(_0x3ecce6,null));};exports[_0x453e('0x21')]=function(_0x34073c,_0x9497e8){if(_0x34073c[_0x453e('0x44')]['id']){delete _0x34073c[_0x453e('0x44')]['id'];}return db[_0x453e('0x28')][_0x453e('0x42')]({'where':{'id':_0x34073c[_0x453e('0x41')]['id']}})[_0x453e('0x22')](handleEntityNotFound(_0x9497e8,null))[_0x453e('0x22')](saveUpdates(_0x34073c[_0x453e('0x44')],null))[_0x453e('0x22')](respondWithResult(_0x9497e8,null))[_0x453e('0x40')](handleError(_0x9497e8,null));};exports[_0x453e('0x45')]=function(_0x416cd3,_0x41ff66){return db['JscriptyAnswerReport'][_0x453e('0x42')]({'where':{'id':_0x416cd3[_0x453e('0x41')]['id']}})[_0x453e('0x22')](handleEntityNotFound(_0x41ff66,null))['then'](removeEntity(_0x41ff66,null))['catch'](handleError(_0x41ff66,null));};exports[_0x453e('0x46')]=function(_0x179cd6,_0x101b47){return db['JscriptyAnswerReport'][_0x453e('0x46')]()[_0x453e('0x22')](respondWithResult(_0x101b47,null))[_0x453e('0x40')](handleError(_0x101b47,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a3d53e6..03494c9 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 _0x28e5=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x498e3e,_0x5cf823){var _0x247afb=function(_0x14e634){while(--_0x14e634){_0x498e3e['push'](_0x498e3e['shift']());}};_0x247afb(++_0x5cf823);}(_0x28e5,0xd2));var _0x528e=function(_0x1c2605,_0x2365fb){_0x1c2605=_0x1c2605-0x0;var _0x5535c1=_0x28e5[_0x1c2605];return _0x5535c1;};'use strict';var _=require('lodash');var util=require(_0x528e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x528e('0x1'));var BPromise=require(_0x528e('0x2'));var rp=require(_0x528e('0x3'));var fs=require('fs');var path=require(_0x528e('0x4'));var rimraf=require(_0x528e('0x5'));var config=require(_0x528e('0x6'));var attributes=require(_0x528e('0x7'));module[_0x528e('0x8')]=function(_0x172b4f,_0x279bcb){return _0x172b4f[_0x528e('0x9')](_0x528e('0xa'),attributes,{'tableName':_0x528e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd33=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util','../../config/logger','api','moment','bluebird','path'];(function(_0x132106,_0x1360e8){var _0x3fdce2=function(_0x4a5ac5){while(--_0x4a5ac5){_0x132106['push'](_0x132106['shift']());}};_0x3fdce2(++_0x1360e8);}(_0xfd33,0x14a));var _0x3fd3=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xfd33[_0x3826ad];return _0x17b900;};'use strict';var _=require('lodash');var util=require(_0x3fd3('0x0'));var logger=require(_0x3fd3('0x1'))(_0x3fd3('0x2'));var moment=require(_0x3fd3('0x3'));var BPromise=require(_0x3fd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fd3('0x5'));var rimraf=require(_0x3fd3('0x6'));var config=require(_0x3fd3('0x7'));var attributes=require(_0x3fd3('0x8'));module[_0x3fd3('0x9')]=function(_0x4ff8a3,_0x3e767b){return _0x4ff8a3[_0x3fd3('0xa')](_0x3fd3('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 83e746a..2f6746d 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 _0x05d5=['request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0xf7aa4d,_0xa274b7){var _0x158a94=function(_0x2e4afb){while(--_0x2e4afb){_0xf7aa4d['push'](_0xf7aa4d['shift']());}};_0x158a94(++_0xa274b7);}(_0x05d5,0x66));var _0x505d=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x05d5[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x505d('0x0'));var util=require('util');var moment=require(_0x505d('0x1'));var BPromise=require(_0x505d('0x2'));var rs=require(_0x505d('0x3'));var fs=require('fs');var Redis=require(_0x505d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x505d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25f7ff,_0x22dbf4,_0x209b2d){return new BPromise(function(_0x3e287b,_0x522c13){return client[_0x505d('0x6')](_0x25f7ff,_0x209b2d)['then'](function(_0x52a933){logger[_0x505d('0x7')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x22dbf4,_0x505d('0x8'));logger[_0x505d('0x9')](_0x505d('0xa'),_0x22dbf4,_0x505d('0x8'),JSON[_0x505d('0xb')](_0x52a933));if(_0x52a933[_0x505d('0xc')]){if(_0x52a933[_0x505d('0xc')][_0x505d('0xd')]===0x1f4){logger['error'](_0x505d('0xe'),_0x22dbf4,_0x52a933[_0x505d('0xc')][_0x505d('0xf')]);return _0x522c13(_0x52a933['error'][_0x505d('0xf')]);}logger[_0x505d('0xc')](_0x505d('0xe'),_0x22dbf4,_0x52a933[_0x505d('0xc')]['message']);return _0x3e287b(_0x52a933[_0x505d('0xc')]['message']);}else{logger[_0x505d('0x7')](_0x505d('0xe'),_0x22dbf4,'request\x20sent');_0x3e287b(_0x52a933[_0x505d('0x10')][_0x505d('0xf')]);}})[_0x505d('0x11')](function(_0x4ab877){logger['error'](_0x505d('0xe'),_0x22dbf4,_0x4ab877);_0x522c13(_0x4ab877);});});} \ No newline at end of file +var _0x833d=['../../config/logger','rpc','../../config/environment','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','info','result','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xf3ff3,_0x36ccba){var _0xdceb69=function(_0x49fc1c){while(--_0x49fc1c){_0xf3ff3['push'](_0xf3ff3['shift']());}};_0xdceb69(++_0x36ccba);}(_0x833d,0x153));var _0xd833=function(_0x121f5d,_0xc76267){_0x121f5d=_0x121f5d-0x0;var _0x18d4bd=_0x833d[_0x121f5d];return _0x18d4bd;};'use strict';var _=require(_0xd833('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd833('0x1'));var rs=require(_0xd833('0x2'));var fs=require('fs');var Redis=require(_0xd833('0x3'));var db=require(_0xd833('0x4'))['db'];var utils=require(_0xd833('0x5'));var logger=require(_0xd833('0x6'))(_0xd833('0x7'));var config=require(_0xd833('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd833('0x9')][_0xd833('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d265b,_0x2d3e5b,_0x58adfd){return new BPromise(function(_0x54caf1,_0x46acb6){return client[_0xd833('0xb')](_0x2d265b,_0x58adfd)[_0xd833('0xc')](function(_0x4d2a7e){logger['info'](_0xd833('0xd'),_0x2d3e5b,_0xd833('0xe'));logger[_0xd833('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2d3e5b,_0xd833('0xe'),JSON[_0xd833('0x10')](_0x4d2a7e));if(_0x4d2a7e[_0xd833('0x11')]){if(_0x4d2a7e[_0xd833('0x11')][_0xd833('0x12')]===0x1f4){logger['error'](_0xd833('0xd'),_0x2d3e5b,_0x4d2a7e[_0xd833('0x11')]['message']);return _0x46acb6(_0x4d2a7e['error']['message']);}logger[_0xd833('0x11')](_0xd833('0xd'),_0x2d3e5b,_0x4d2a7e[_0xd833('0x11')]['message']);return _0x54caf1(_0x4d2a7e['error']['message']);}else{logger[_0xd833('0x13')](_0xd833('0xd'),_0x2d3e5b,_0xd833('0xe'));_0x54caf1(_0x4d2a7e[_0xd833('0x14')][_0xd833('0x15')]);}})[_0xd833('0x16')](function(_0x53afcd){logger[_0xd833('0x11')](_0xd833('0xd'),_0x2d3e5b,_0x53afcd);_0x46acb6(_0x53afcd);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ec2adf3..d2d0431 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 _0xaaf5=['/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','/:id/clone','clone','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x8173ea,_0x1fc9a0){var _0x8c61b2=function(_0x5bc017){while(--_0x5bc017){_0x8173ea['push'](_0x8173ea['shift']());}};_0x8c61b2(++_0x1fc9a0);}(_0xaaf5,0x14d));var _0x5aaf=function(_0x291a60,_0x1efaba){_0x291a60=_0x291a60-0x0;var _0x3e4f64=_0xaaf5[_0x291a60];return _0x3e4f64;};'use strict';var multer=require(_0x5aaf('0x0'));var util=require(_0x5aaf('0x1'));var path=require(_0x5aaf('0x2'));var timeout=require(_0x5aaf('0x3'));var express=require(_0x5aaf('0x4'));var router=express[_0x5aaf('0x5')]();var auth=require(_0x5aaf('0x6'));var interaction=require(_0x5aaf('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x5aaf('0x8')]('/',auth[_0x5aaf('0x9')](),controller[_0x5aaf('0xa')]);router[_0x5aaf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5aaf('0xb')]);router[_0x5aaf('0x8')](_0x5aaf('0xc'),auth[_0x5aaf('0x9')](),controller[_0x5aaf('0xd')]);router['get'](_0x5aaf('0xe'),auth[_0x5aaf('0x9')](),controller[_0x5aaf('0xf')]);router[_0x5aaf('0x8')]('/:id/summary',auth[_0x5aaf('0x9')](),timeout(_0x5aaf('0x10')),controller['getSummary']);router[_0x5aaf('0x11')]('/',auth[_0x5aaf('0x9')](),controller['create']);router[_0x5aaf('0x11')](_0x5aaf('0x12'),auth[_0x5aaf('0x9')](),controller[_0x5aaf('0x13')]);router[_0x5aaf('0x14')](_0x5aaf('0x15'),auth[_0x5aaf('0x9')](),controller[_0x5aaf('0x16')]);router['delete'](_0x5aaf('0x15'),auth[_0x5aaf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe182=['/:id/clone','clone','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','getSessions','/:id/answers','getAnswers','30s','post'];(function(_0x384ee4,_0x37cfb4){var _0x4ca66d=function(_0x50d8a3){while(--_0x50d8a3){_0x384ee4['push'](_0x384ee4['shift']());}};_0x4ca66d(++_0x37cfb4);}(_0xe182,0xf8));var _0x2e18=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xe182[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require(_0x2e18('0x0'));var path=require(_0x2e18('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2e18('0x2')]();var auth=require(_0x2e18('0x3'));var interaction=require(_0x2e18('0x4'));var config=require(_0x2e18('0x5'));var controller=require(_0x2e18('0x6'));router[_0x2e18('0x7')]('/',auth[_0x2e18('0x8')](),controller[_0x2e18('0x9')]);router['get'](_0x2e18('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2e18('0x7')]('/:id/sessions',auth[_0x2e18('0x8')](),controller[_0x2e18('0xb')]);router[_0x2e18('0x7')](_0x2e18('0xc'),auth[_0x2e18('0x8')](),controller[_0x2e18('0xd')]);router[_0x2e18('0x7')]('/:id/summary',auth[_0x2e18('0x8')](),timeout(_0x2e18('0xe')),controller['getSummary']);router[_0x2e18('0xf')]('/',auth[_0x2e18('0x8')](),controller['create']);router[_0x2e18('0xf')](_0x2e18('0x10'),auth[_0x2e18('0x8')](),controller[_0x2e18('0x11')]);router['put'](_0x2e18('0xa'),auth[_0x2e18('0x8')](),controller[_0x2e18('0x12')]);router[_0x2e18('0x13')]('/:id',auth[_0x2e18('0x8')](),controller[_0x2e18('0x14')]);module[_0x2e18('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e9757af..c1af635 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 _0x3644=['stringify','isString','format','name','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x22e870,_0x276159){var _0x5de4e6=function(_0xf404){while(--_0xf404){_0x22e870['push'](_0x22e870['shift']());}};_0x5de4e6(++_0x276159);}(_0x3644,0x14a));var _0x4364=function(_0x5c451a,_0x30de9f){_0x5c451a=_0x5c451a-0x0;var _0x169df6=_0x3644[_0x5c451a];return _0x169df6;};'use strict';var Sequelize=require(_0x4364('0x0'));var _=require(_0x4364('0x1'));var util=require(_0x4364('0x2'));module[_0x4364('0x3')]={'name':{'type':Sequelize[_0x4364('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x4364('0x4')]},'formData':{'type':Sequelize[_0x4364('0x5')](_0x4364('0x6')),'set':function(_0x5ce818){if(_[_0x4364('0x7')](_0x5ce818)){this[_0x4364('0x8')](_0x4364('0x9'),JSON[_0x4364('0xa')](_0x5ce818));}else if(_[_0x4364('0xb')](_0x5ce818)){this[_0x4364('0x8')](_0x4364('0x9'),_0x5ce818);}else{this[_0x4364('0x8')](_0x4364('0x9'),util[_0x4364('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x4364('0xd'))||'',this[_0x4364('0xe')](_0x4364('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4364('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x317f=['BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description'];(function(_0x18f830,_0x3b7361){var _0x5df489=function(_0x1cf389){while(--_0x1cf389){_0x18f830['push'](_0x18f830['shift']());}};_0x5df489(++_0x3b7361);}(_0x317f,0x1a1));var _0xf317=function(_0x2e40bc,_0x30a94d){_0x2e40bc=_0x2e40bc-0x0;var _0x32b73e=_0x317f[_0x2e40bc];return _0x32b73e;};'use strict';var Sequelize=require(_0xf317('0x0'));var _=require('lodash');var util=require(_0xf317('0x1'));module[_0xf317('0x2')]={'name':{'type':Sequelize[_0xf317('0x3')],'unique':_0xf317('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xf317('0x5')](_0xf317('0x6')),'set':function(_0x13af84){if(_[_0xf317('0x7')](_0x13af84)){this[_0xf317('0x8')](_0xf317('0x9'),JSON[_0xf317('0xa')](_0x13af84));}else if(_[_0xf317('0xb')](_0x13af84)){this[_0xf317('0x8')](_0xf317('0x9'),_0x13af84);}else{this[_0xf317('0x8')](_0xf317('0x9'),util[_0xf317('0xc')](_0xf317('0xd'),this['getDataValue']('name')||'',this['getDataValue'](_0xf317('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf317('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf317('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index dd2a179..48760e0 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 _0x7655=['jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','then','get','Projects','UserProfileResource','destroy','error','name','send','index','JscriptyProject','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','show','params','include','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto'];(function(_0x8f8f27,_0xbc801b){var _0x4374a5=function(_0x616cf8){while(--_0x616cf8){_0x8f8f27['push'](_0x8f8f27['shift']());}};_0x4374a5(++_0xbc801b);}(_0x7655,0x150));var _0x5765=function(_0x51d97,_0x70d413){_0x51d97=_0x51d97-0x0;var _0x381c36=_0x7655[_0x51d97];return _0x381c36;};'use strict';var pdf=require(_0x5765('0x0'));var emlformat=require(_0x5765('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5765('0x2'));var jsonpatch=require(_0x5765('0x3'));var rp=require(_0x5765('0x4'));var moment=require(_0x5765('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5765('0x6'));var path=require(_0x5765('0x7'));var sox=require('sox');var csv=require(_0x5765('0x8'));var ejs=require(_0x5765('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5765('0xa'));var crypto=require(_0x5765('0xb'));var jsforce=require(_0x5765('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5765('0x8'));var querystring=require('querystring');var Papa=require(_0x5765('0xd'));var Redis=require(_0x5765('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5765('0xf'));var logger=require(_0x5765('0x10'))(_0x5765('0x11'));var utils=require(_0x5765('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9ef603,_0x4cfcc7){_0x4cfcc7=_0x4cfcc7||0xcc;return function(_0x411586){if(_0x411586){return _0x9ef603[_0x5765('0x13')](_0x4cfcc7);}return _0x9ef603['status'](_0x4cfcc7)[_0x5765('0x14')]();};}function respondWithResult(_0x260930,_0x230b5b){_0x230b5b=_0x230b5b||0xc8;return function(_0x489505){if(_0x489505){return _0x260930[_0x5765('0x15')](_0x230b5b)[_0x5765('0x16')](_0x489505);}};}function respondWithFilteredResult(_0x58a0d5,_0x34de10){return function(_0x36bf21){if(_0x36bf21){var _0xa41552=_0x36bf21[_0x5765('0x17')],_0x4e5147=_0x34de10[_0x5765('0x18')],_0x50e71c=_0x34de10[_0x5765('0x18')]+_0x34de10[_0x5765('0x19')],_0x46dbc6;if(_0x50e71c>=_0xa41552){_0x50e71c=_0xa41552;_0x46dbc6=0xc8;}else{_0x46dbc6=0xce;}_0x58a0d5[_0x5765('0x15')](_0x46dbc6);return _0x58a0d5[_0x5765('0x1a')](_0x5765('0x1b'),_0x4e5147+'-'+_0x50e71c+'/'+_0xa41552)[_0x5765('0x16')](_0x36bf21);}return null;};}function patchUpdates(_0x1b8648){return function(_0x386199){try{jsonpatch['apply'](_0x386199,_0x1b8648,!![]);}catch(_0x271357){return BPromise[_0x5765('0x1c')](_0x271357);}return _0x386199['save']();};}function saveUpdates(_0x2a610b,_0x2e47b2){return function(_0x4ced23){if(_0x4ced23){return _0x4ced23['update'](_0x2a610b)[_0x5765('0x1d')](function(_0xc54252){return _0xc54252;});}return null;};}function removeEntity(_0x2fe988,_0xca7279){return function(_0x43f181){if(_0x43f181){return _0x43f181['destroy']()[_0x5765('0x1d')](function(){var _0x2f4623=_0x43f181[_0x5765('0x1e')]({'plain':!![]});var _0x10bcc8=_0x5765('0x1f');return db[_0x5765('0x20')][_0x5765('0x21')]({'where':{'type':_0x10bcc8,'resourceId':_0x2f4623['id']}})['then'](function(){return _0x43f181;});})['then'](function(){_0x2fe988['status'](0xcc)[_0x5765('0x14')]();});}};}function handleEntityNotFound(_0x5b146d,_0x5aa1a8){return function(_0x4098c3){if(!_0x4098c3){_0x5b146d[_0x5765('0x13')](0x194);}return _0x4098c3;};}function handleError(_0x41dbb9,_0x3eb54d){_0x3eb54d=_0x3eb54d||0x1f4;return function(_0x4955f1){logger[_0x5765('0x22')](_0x4955f1['stack']);if(_0x4955f1[_0x5765('0x23')]){delete _0x4955f1['name'];}_0x41dbb9['status'](_0x3eb54d)[_0x5765('0x24')](_0x4955f1);};}exports[_0x5765('0x25')]=function(_0x499ed3,_0x8c8a63){var _0x3af712={},_0x1b095d={},_0xe93445={'count':0x0,'rows':[]};var _0x165e9e=_['map'](db[_0x5765('0x26')][_0x5765('0x27')],function(_0x5056d9){return{'name':_0x5056d9[_0x5765('0x28')],'type':_0x5056d9['type'][_0x5765('0x29')]};});_0x1b095d[_0x5765('0x2a')]=_[_0x5765('0x2b')](_0x165e9e,_0x5765('0x23'));_0x1b095d[_0x5765('0x2c')]=_[_0x5765('0x2d')](_0x499ed3[_0x5765('0x2c')]);_0x1b095d[_0x5765('0x2e')]=_[_0x5765('0x2f')](_0x1b095d['model'],_0x1b095d[_0x5765('0x2c')]);_0x3af712[_0x5765('0x30')]=_[_0x5765('0x2f')](_0x1b095d[_0x5765('0x2a')],qs['fields'](_0x499ed3[_0x5765('0x2c')][_0x5765('0x31')]));_0x3af712[_0x5765('0x30')]=_0x3af712[_0x5765('0x30')][_0x5765('0x32')]?_0x3af712[_0x5765('0x30')]:_0x1b095d[_0x5765('0x2a')];if(!_0x499ed3['query']['hasOwnProperty'](_0x5765('0x33'))){_0x3af712['limit']=qs['limit'](_0x499ed3[_0x5765('0x2c')][_0x5765('0x19')]);_0x3af712[_0x5765('0x18')]=qs[_0x5765('0x18')](_0x499ed3[_0x5765('0x2c')][_0x5765('0x18')]);}_0x3af712[_0x5765('0x34')]=qs['sort'](_0x499ed3[_0x5765('0x2c')][_0x5765('0x35')]);_0x3af712[_0x5765('0x36')]=qs[_0x5765('0x2e')](_[_0x5765('0x37')](_0x499ed3['query'],_0x1b095d['filters']),_0x165e9e);if(_0x499ed3[_0x5765('0x2c')]['filter']){_0x3af712['where']=_['merge'](_0x3af712[_0x5765('0x36')],{'$or':_[_0x5765('0x2b')](_0x165e9e,function(_0x23dd17){if(_0x23dd17[_0x5765('0x38')]!==_0x5765('0x39')){var _0x70a462={};_0x70a462[_0x23dd17[_0x5765('0x23')]]={'$like':'%'+_0x499ed3[_0x5765('0x2c')][_0x5765('0x3a')]+'%'};return _0x70a462;}})});}_0x3af712=_[_0x5765('0x3b')]({},_0x3af712,_0x499ed3[_0x5765('0x3c')]);var _0x171022={'where':_0x3af712[_0x5765('0x36')]};return db['JscriptyProject']['count'](_0x171022)['then'](function(_0x20111f){_0xe93445[_0x5765('0x17')]=_0x20111f;if(_0x499ed3[_0x5765('0x2c')]['includeAll']){_0x3af712['include']=[{'all':!![]}];}return db[_0x5765('0x26')]['findAll'](_0x3af712);})[_0x5765('0x1d')](function(_0x3958e7){_0xe93445[_0x5765('0x3d')]=_0x3958e7;return _0xe93445;})[_0x5765('0x1d')](respondWithFilteredResult(_0x8c8a63,_0x3af712))[_0x5765('0x3e')](handleError(_0x8c8a63,null));};exports[_0x5765('0x3f')]=function(_0x45472e,_0x41ebb3){var _0x3f7de6={'raw':![],'where':{'id':_0x45472e[_0x5765('0x40')]['id']}},_0x7ab84={};_0x7ab84[_0x5765('0x2a')]=_[_0x5765('0x2d')](db[_0x5765('0x26')][_0x5765('0x27')]);_0x7ab84['query']=_['keys'](_0x45472e[_0x5765('0x2c')]);_0x7ab84[_0x5765('0x2e')]=_['intersection'](_0x7ab84[_0x5765('0x2a')],_0x7ab84['query']);_0x3f7de6[_0x5765('0x30')]=_[_0x5765('0x2f')](_0x7ab84['model'],qs[_0x5765('0x31')](_0x45472e[_0x5765('0x2c')][_0x5765('0x31')]));_0x3f7de6[_0x5765('0x30')]=_0x3f7de6[_0x5765('0x30')][_0x5765('0x32')]?_0x3f7de6[_0x5765('0x30')]:_0x7ab84[_0x5765('0x2a')];if(_0x45472e[_0x5765('0x2c')]['includeAll']){_0x3f7de6[_0x5765('0x41')]=[{'all':!![]}];}_0x3f7de6=_['merge']({},_0x3f7de6,_0x45472e['options']);return db[_0x5765('0x26')][_0x5765('0x42')](_0x3f7de6)['then'](handleEntityNotFound(_0x41ebb3,null))['then'](respondWithResult(_0x41ebb3,null))[_0x5765('0x3e')](handleError(_0x41ebb3,null));};exports[_0x5765('0x43')]=function(_0x42cdfc,_0x14d556){return db[_0x5765('0x26')]['create'](_0x42cdfc[_0x5765('0x44')],{})[_0x5765('0x1d')](function(_0x3c7229){var _0x5bf412=_0x42cdfc[_0x5765('0x45')][_0x5765('0x1e')]({'plain':!![]});if(!_0x5bf412)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bf412['role']===_0x5765('0x45')){var _0x3a141f=_0x3c7229['get']({'plain':!![]});var _0x5a53ff=_0x5765('0x1f');return db[_0x5765('0x46')][_0x5765('0x42')]({'where':{'name':_0x5a53ff,'userProfileId':_0x5bf412['userProfileId']},'raw':!![]})[_0x5765('0x1d')](function(_0x17a0cd){if(_0x17a0cd&&_0x17a0cd[_0x5765('0x47')]===0x0){return db['UserProfileResource'][_0x5765('0x43')]({'name':_0x3a141f[_0x5765('0x23')],'resourceId':_0x3a141f['id'],'type':_0x17a0cd[_0x5765('0x23')],'sectionId':_0x17a0cd['id']},{})[_0x5765('0x1d')](function(){return _0x3c7229;});}else{return _0x3c7229;}})['catch'](function(_0x49bba8){logger[_0x5765('0x22')](_0x5765('0x48'),_0x49bba8);throw _0x49bba8;});}return _0x3c7229;})[_0x5765('0x1d')](respondWithResult(_0x14d556,0xc9))[_0x5765('0x3e')](handleError(_0x14d556,null));};exports[_0x5765('0x49')]=function(_0x521cbd,_0x31afe8){var _0x40c8f3={'where':{'id':_0x521cbd['params']['id']}},_0x51b4d4={};_0x51b4d4[_0x5765('0x2a')]=_[_0x5765('0x2d')](db[_0x5765('0x26')][_0x5765('0x27')]);_0x40c8f3[_0x5765('0x30')]=_[_0x5765('0x2f')](_0x51b4d4[_0x5765('0x2a')],qs['fields'](_0x521cbd[_0x5765('0x2c')][_0x5765('0x31')]));_0x40c8f3[_0x5765('0x30')]=_0x40c8f3[_0x5765('0x30')][_0x5765('0x32')]?_0x40c8f3[_0x5765('0x30')]:_0x51b4d4[_0x5765('0x2a')];if(_0x521cbd[_0x5765('0x2c')][_0x5765('0x4a')]){_0x40c8f3[_0x5765('0x41')]=[{'all':!![]}];}_0x40c8f3=_[_0x5765('0x3b')]({},_0x40c8f3,_0x521cbd['options']);return db[_0x5765('0x26')][_0x5765('0x42')](_0x40c8f3)[_0x5765('0x1d')](handleEntityNotFound(_0x31afe8,null))[_0x5765('0x1d')](function(_0x5b13a0){if(_0x5b13a0){var _0x352201=_0x5b13a0[_0x5765('0x1e')]({'plain':!![]});_0x352201=qs['omit'](_0x352201,['id','createdAt',_0x5765('0x4b')]);_0x521cbd[_0x5765('0x44')]=_[_0x5765('0x4c')](_0x521cbd[_0x5765('0x44')],['id',_0x5765('0x4d'),'updatedAt']);return db[_0x5765('0x26')][_0x5765('0x43')](_[_0x5765('0x3b')](_0x352201,_0x521cbd[_0x5765('0x44')]),{'include':_0x521cbd['query'][_0x5765('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x3de75d){var _0x189978=_0x521cbd[_0x5765('0x45')][_0x5765('0x1e')]({'plain':!![]});if(!_0x189978)throw new Error(_0x5765('0x4e'));if(_0x189978['role']===_0x5765('0x45')){var _0x472ee0=_0x3de75d['get']({'plain':!![]});var _0x2410dd=_0x5765('0x1f');return db[_0x5765('0x46')][_0x5765('0x42')]({'where':{'name':_0x2410dd,'userProfileId':_0x189978[_0x5765('0x4f')]},'raw':!![]})[_0x5765('0x1d')](function(_0x58e83d){if(_0x58e83d&&_0x58e83d[_0x5765('0x47')]===0x0){return db[_0x5765('0x20')][_0x5765('0x43')]({'name':_0x472ee0[_0x5765('0x23')],'resourceId':_0x472ee0['id'],'type':_0x58e83d[_0x5765('0x23')],'sectionId':_0x58e83d['id']},{})[_0x5765('0x1d')](function(){return _0x3de75d;});}else{return _0x3de75d;}})[_0x5765('0x3e')](function(_0x5c557b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c557b);throw _0x5c557b;});}return _0x3de75d;});}})[_0x5765('0x1d')](respondWithResult(_0x31afe8,0xc9))[_0x5765('0x3e')](handleError(_0x31afe8,null));};exports['update']=function(_0x326e1c,_0x378bd4){if(_0x326e1c['body']['id']){delete _0x326e1c[_0x5765('0x44')]['id'];}return db[_0x5765('0x26')][_0x5765('0x42')]({'where':{'id':_0x326e1c[_0x5765('0x40')]['id']}})['then'](handleEntityNotFound(_0x378bd4,null))[_0x5765('0x1d')](saveUpdates(_0x326e1c[_0x5765('0x44')],null))[_0x5765('0x1d')](respondWithResult(_0x378bd4,null))[_0x5765('0x3e')](handleError(_0x378bd4,null));};exports[_0x5765('0x21')]=function(_0x39532a,_0x543979){return db[_0x5765('0x26')][_0x5765('0x42')]({'where':{'id':_0x39532a[_0x5765('0x40')]['id']}})[_0x5765('0x1d')](handleEntityNotFound(_0x543979,null))[_0x5765('0x1d')](removeEntity(_0x543979,null))[_0x5765('0x3e')](handleError(_0x543979,null));};exports[_0x5765('0x50')]=function(_0x128c66,_0xd4958a,_0x514b64){var _0x5c0d4c={'raw':!![],'where':{}};var _0x1030bb={};var _0x21c5ca={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x5765('0x51')]({'where':{'id':_0x128c66['params']['id']}})[_0x5765('0x1d')](handleEntityNotFound(_0xd4958a,null))['then'](function(_0x47d550){if(_0x47d550){_0x1030bb['model']=_[_0x5765('0x2d')](db[_0x5765('0x52')][_0x5765('0x27')]);_0x1030bb[_0x5765('0x2c')]=_[_0x5765('0x2d')](_0x128c66[_0x5765('0x2c')]);_0x1030bb[_0x5765('0x2e')]=_[_0x5765('0x2f')](_0x1030bb[_0x5765('0x2a')],_0x1030bb[_0x5765('0x2c')]);_0x5c0d4c[_0x5765('0x30')]=_['intersection'](_0x1030bb['model'],qs['fields'](_0x128c66[_0x5765('0x2c')][_0x5765('0x31')]));_0x5c0d4c[_0x5765('0x30')]=_0x5c0d4c[_0x5765('0x30')]['length']?_0x5c0d4c[_0x5765('0x30')]:_0x1030bb['model'];if(!_0x128c66[_0x5765('0x2c')][_0x5765('0x53')](_0x5765('0x33'))){_0x5c0d4c[_0x5765('0x19')]=qs[_0x5765('0x19')](_0x128c66[_0x5765('0x2c')][_0x5765('0x19')]);_0x5c0d4c[_0x5765('0x18')]=qs[_0x5765('0x18')](_0x128c66[_0x5765('0x2c')]['offset']);}_0x5c0d4c[_0x5765('0x34')]=qs[_0x5765('0x35')](_0x128c66[_0x5765('0x2c')]['sort']);_0x5c0d4c[_0x5765('0x36')]=qs[_0x5765('0x2e')](_[_0x5765('0x37')](_0x128c66[_0x5765('0x2c')],_0x1030bb[_0x5765('0x2e')]));_0x5c0d4c[_0x5765('0x36')][_0x5765('0x54')]=_0x47d550['id'];if(_0x128c66[_0x5765('0x2c')]['filter']){_0x5c0d4c[_0x5765('0x36')]=_[_0x5765('0x3b')](_0x5c0d4c[_0x5765('0x36')],{'$or':_['map'](_0x5c0d4c['attributes'],function(_0xc3d8f4){var _0x3b7790={};_0x3b7790[_0xc3d8f4]={'$like':'%'+_0x128c66[_0x5765('0x2c')]['filter']+'%'};return _0x3b7790;})});}_0x5c0d4c=_[_0x5765('0x3b')]({},_0x5c0d4c,_0x128c66[_0x5765('0x3c')]);return db[_0x5765('0x52')][_0x5765('0x17')]({'where':_0x5c0d4c[_0x5765('0x36')]})['then'](function(_0x2cfe28){_0x21c5ca[_0x5765('0x17')]=_0x2cfe28;if(_0x128c66[_0x5765('0x2c')]['includeAll']){_0x5c0d4c[_0x5765('0x41')]=[{'all':!![]}];}return db[_0x5765('0x52')][_0x5765('0x55')](_0x5c0d4c);})['then'](function(_0x262122){_0x21c5ca[_0x5765('0x3d')]=_0x262122;return _0x21c5ca;});}})['then'](respondWithFilteredResult(_0xd4958a,_0x5c0d4c))[_0x5765('0x3e')](handleError(_0xd4958a,null));};exports[_0x5765('0x56')]=function(_0x56fa0b,_0x316a6b,_0x4c609b){var _0x499f50={'raw':!![],'where':{}};var _0x419e38={};var _0x342053={'count':0x0,'rows':[]};return db[_0x5765('0x26')]['findOne']({'where':{'id':_0x56fa0b[_0x5765('0x40')]['id']}})[_0x5765('0x1d')](handleEntityNotFound(_0x316a6b,null))['then'](function(_0x10bd43){if(_0x10bd43){_0x419e38[_0x5765('0x2a')]=_[_0x5765('0x2d')](db[_0x5765('0x57')][_0x5765('0x27')]);_0x419e38['query']=_['keys'](_0x56fa0b[_0x5765('0x2c')]);_0x419e38[_0x5765('0x2e')]=_[_0x5765('0x2f')](_0x419e38[_0x5765('0x2a')],_0x419e38['query']);_0x499f50[_0x5765('0x30')]=_[_0x5765('0x2f')](_0x419e38['model'],qs['fields'](_0x56fa0b['query']['fields']));_0x499f50[_0x5765('0x30')]=_0x499f50['attributes']['length']?_0x499f50[_0x5765('0x30')]:_0x419e38[_0x5765('0x2a')];if(!_0x56fa0b[_0x5765('0x2c')][_0x5765('0x53')](_0x5765('0x33'))){_0x499f50[_0x5765('0x19')]=qs['limit'](_0x56fa0b[_0x5765('0x2c')]['limit']);_0x499f50['offset']=qs[_0x5765('0x18')](_0x56fa0b[_0x5765('0x2c')][_0x5765('0x18')]);}_0x499f50[_0x5765('0x34')]=qs[_0x5765('0x35')](_0x56fa0b['query'][_0x5765('0x35')]);_0x499f50[_0x5765('0x36')]=qs[_0x5765('0x2e')](_[_0x5765('0x37')](_0x56fa0b[_0x5765('0x2c')],_0x419e38[_0x5765('0x2e')]));_0x499f50['where']['ProjectId']=_0x10bd43['id'];if(_0x56fa0b['query'][_0x5765('0x3a')]){_0x499f50[_0x5765('0x36')]=_[_0x5765('0x3b')](_0x499f50[_0x5765('0x36')],{'$or':_[_0x5765('0x2b')](_0x499f50[_0x5765('0x30')],function(_0x11e033){var _0x2cddba={};_0x2cddba[_0x11e033]={'$like':'%'+_0x56fa0b['query'][_0x5765('0x3a')]+'%'};return _0x2cddba;})});}_0x499f50=_[_0x5765('0x3b')]({},_0x499f50,_0x56fa0b[_0x5765('0x3c')]);return db[_0x5765('0x57')][_0x5765('0x17')]({'where':_0x499f50[_0x5765('0x36')]})[_0x5765('0x1d')](function(_0x1b25d6){_0x342053['count']=_0x1b25d6;if(_0x56fa0b[_0x5765('0x2c')][_0x5765('0x4a')]){_0x499f50[_0x5765('0x41')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5765('0x55')](_0x499f50);})['then'](function(_0xf6c53f){_0x342053['rows']=_0xf6c53f;return _0x342053;});}})['then'](respondWithFilteredResult(_0x316a6b,_0x499f50))[_0x5765('0x3e')](handleError(_0x316a6b,null));};function char(_0x6b2784){return _0x5765('0x58')===typeof _0x6b2784?String[_0x5765('0x59')][_0x5765('0x5a')](null,arguments):_0x6b2784;}function needsEncapsulation(_0x4f3fd2){return!!_0x4f3fd2&&(_0x4f3fd2[_0x5765('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x4f3fd2[_0x5765('0x5b')]()[_0x5765('0x5c')](char(0xa))>=0x0||_0x4f3fd2[_0x5765('0x5b')]()[_0x5765('0x5c')](char(0x2c))>=0x0||_0x4f3fd2[_0x5765('0x5b')]()[_0x5765('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x3c4610){var _0x327883=char(0x22),_0x416db2='\x5c'+char(0x22),_0x28a56d=_0x3c4610[_0x5765('0x5b')]()[_0x5765('0x5d')](new RegExp(_0x327883,'g'),_0x416db2);return _0x327883+_0x28a56d+_0x327883;}exports[_0x5765('0x5e')]=function(_0x298c6e,_0x561923,_0x402935){var _0x20dc44,_0x14acab;var _0x34969a={'where':{'ProjectId':_0x298c6e['params']['id']}};if(_0x298c6e[_0x5765('0x2c')][_0x5765('0x5f')]){_0x34969a[_0x5765('0x36')]['starttime']=JSON[_0x5765('0x60')](_0x298c6e['query'][_0x5765('0x5f')]);}return db['JscriptySessionReport']['findAll'](_0x34969a)[_0x5765('0x1d')](handleEntityNotFound(_0x561923,null))[_0x5765('0x1d')](function(_0x4b9d54){if(_0x4b9d54){_0x20dc44=_0x4b9d54;return db[_0x5765('0x61')][_0x5765('0x55')]({'where':{'SessionId':{'$in':_['map'](_0x20dc44,'id')},'ProjectId':_0x298c6e[_0x5765('0x40')]['id']},'order':_0x5765('0x62')});}})[_0x5765('0x1d')](handleEntityNotFound(_0x561923,null))[_0x5765('0x1d')](function(_0x42d618){if(_0x42d618){_0x14acab=_0x42d618;var _0x7bc723={};for(var _0x4a4147=0x0,_0xabbb0=_0x14acab['length'];_0x4a4147<_0xabbb0;_0x4a4147++){if(!_0x7bc723[_0x5765('0x53')](_0x14acab[_0x4a4147][_0x5765('0x63')])){_0x7bc723[_0x14acab[_0x4a4147][_0x5765('0x63')]]=needsEncapsulation(_0x14acab[_0x4a4147][_0x5765('0x64')])?encapsulate(_0x14acab[_0x4a4147][_0x5765('0x64')]):_0x14acab[_0x4a4147][_0x5765('0x64')];}}var _0x1385b1=[],_0x5b41e2={};for(var _0x3745f6=0x0,_0x8fe462=_0x20dc44[_0x5765('0x32')];_0x3745f6<_0x8fe462;_0x3745f6++){_0x5b41e2={'ProjectId':_0x298c6e[_0x5765('0x40')]['id'],'SessionId':_0x20dc44[_0x3745f6]['id'],'StartTime':moment(_0x20dc44[_0x3745f6]['starttime'])[_0x5765('0x65')](_0x5765('0x66'))};for(var _0x293225=0x0,_0x29b484=_0x14acab['length'];_0x293225<_0x29b484;_0x293225++){if(_0x14acab[_0x293225][_0x5765('0x67')]==_0x20dc44[_0x3745f6]['id']&&_0x7bc723['hasOwnProperty'](_0x14acab[_0x293225][_0x5765('0x63')])){_0x5b41e2[_0x7bc723[_0x14acab[_0x293225][_0x5765('0x63')]]]=_0x14acab[_0x293225][_0x5765('0x68')];}}for(var _0x213598 in _0x7bc723){if(!_0x5b41e2['hasOwnProperty'](_0x7bc723[_0x213598])){_0x5b41e2[_0x7bc723[_0x213598]]=null;}}_0x1385b1[_0x5765('0x69')](_0x5b41e2);}return _0x1385b1;}})[_0x5765('0x1d')](function(_0x1c8167){if(!_[_0x5765('0x6a')](_0x1c8167)){var _0x334acf=toCsv(_0x1c8167);var _0xf092c2=Date[_0x5765('0x6b')]();fs[_0x5765('0x6c')](util['format'](_0x5765('0x6d'),_0x298c6e['params']['id'],_0xf092c2),_0x334acf);_0x561923[_0x5765('0x6e')](_0x5765('0x6f'),'attachment;\x20filename='+util[_0x5765('0x65')](_0x5765('0x70'),_0x298c6e[_0x5765('0x40')]['id'],_0xf092c2));_0x561923[_0x5765('0x6e')](_0x5765('0x71'),_0x5765('0x72'));return _0x561923[_0x5765('0x73')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x298c6e[_0x5765('0x40')]['id'],_0xf092c2));}else{return _0x561923['sendStatus'](0xcc);}})['catch'](handleError(_0x561923,null));}; \ No newline at end of file +var _0x1f36=['JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','SessionId','push','now','writeFileSync','format','setHeader','Content-disposition','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','fieldName','type','map','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','include','JscriptyProject','findAll','catch','show','params','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','getSessions','findOne'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x1f36,0x109));var _0x61f3=function(_0x1eeb14,_0x3bdb98){_0x1eeb14=_0x1eeb14-0x0;var _0x5b52e9=_0x1f36[_0x1eeb14];return _0x5b52e9;};'use strict';var pdf=require(_0x61f3('0x0'));var emlformat=require(_0x61f3('0x1'));var rimraf=require(_0x61f3('0x2'));var zipdir=require(_0x61f3('0x3'));var jsonpatch=require(_0x61f3('0x4'));var rp=require(_0x61f3('0x5'));var moment=require(_0x61f3('0x6'));var BPromise=require(_0x61f3('0x7'));var Mustache=require(_0x61f3('0x8'));var util=require(_0x61f3('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x61f3('0xa'));var ejs=require(_0x61f3('0xb'));var fs=require('fs');var _=require(_0x61f3('0xc'));var squel=require(_0x61f3('0xd'));var crypto=require(_0x61f3('0xe'));var jsforce=require(_0x61f3('0xf'));var deskjs=require(_0x61f3('0x10'));var toCsv=require(_0x61f3('0xa'));var querystring=require(_0x61f3('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x61f3('0x12'));var qs=require(_0x61f3('0x13'));var as=require(_0x61f3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61f3('0x15'))('api');var utils=require(_0x61f3('0x16'));var config=require('../../config/environment');var db=require(_0x61f3('0x17'))['db'];function respondWithStatusCode(_0x59cc16,_0x204b72){_0x204b72=_0x204b72||0xcc;return function(_0x3cdcdf){if(_0x3cdcdf){return _0x59cc16[_0x61f3('0x18')](_0x204b72);}return _0x59cc16['status'](_0x204b72)[_0x61f3('0x19')]();};}function respondWithResult(_0x332528,_0x5474f1){_0x5474f1=_0x5474f1||0xc8;return function(_0x21d693){if(_0x21d693){return _0x332528[_0x61f3('0x1a')](_0x5474f1)[_0x61f3('0x1b')](_0x21d693);}};}function respondWithFilteredResult(_0x4ff85c,_0x1c6c70){return function(_0x465ff4){if(_0x465ff4){var _0x5667ec=_0x465ff4['count'],_0x49470a=_0x1c6c70[_0x61f3('0x1c')],_0x6bbaae=_0x1c6c70[_0x61f3('0x1c')]+_0x1c6c70[_0x61f3('0x1d')],_0x3543b9;if(_0x6bbaae>=_0x5667ec){_0x6bbaae=_0x5667ec;_0x3543b9=0xc8;}else{_0x3543b9=0xce;}_0x4ff85c[_0x61f3('0x1a')](_0x3543b9);return _0x4ff85c[_0x61f3('0x1e')](_0x61f3('0x1f'),_0x49470a+'-'+_0x6bbaae+'/'+_0x5667ec)[_0x61f3('0x1b')](_0x465ff4);}return null;};}function patchUpdates(_0x581fe2){return function(_0x52a3d7){try{jsonpatch[_0x61f3('0x20')](_0x52a3d7,_0x581fe2,!![]);}catch(_0x49e2e5){return BPromise[_0x61f3('0x21')](_0x49e2e5);}return _0x52a3d7[_0x61f3('0x22')]();};}function saveUpdates(_0x2b2685,_0x4efa27){return function(_0x45a95e){if(_0x45a95e){return _0x45a95e[_0x61f3('0x23')](_0x2b2685)['then'](function(_0x1e7cb6){return _0x1e7cb6;});}return null;};}function removeEntity(_0x5c662e,_0x4973fd){return function(_0x264f1c){if(_0x264f1c){return _0x264f1c[_0x61f3('0x24')]()[_0x61f3('0x25')](function(){var _0xb13ed5=_0x264f1c[_0x61f3('0x26')]({'plain':!![]});var _0x30a0f8='Projects';return db[_0x61f3('0x27')][_0x61f3('0x24')]({'where':{'type':_0x30a0f8,'resourceId':_0xb13ed5['id']}})[_0x61f3('0x25')](function(){return _0x264f1c;});})['then'](function(){_0x5c662e[_0x61f3('0x1a')](0xcc)[_0x61f3('0x19')]();});}};}function handleEntityNotFound(_0x43efda,_0x560d4d){return function(_0x4335ed){if(!_0x4335ed){_0x43efda['sendStatus'](0x194);}return _0x4335ed;};}function handleError(_0x50bbb5,_0x51adca){_0x51adca=_0x51adca||0x1f4;return function(_0x3a493b){logger[_0x61f3('0x28')](_0x3a493b[_0x61f3('0x29')]);if(_0x3a493b[_0x61f3('0x2a')]){delete _0x3a493b[_0x61f3('0x2a')];}_0x50bbb5[_0x61f3('0x1a')](_0x51adca)[_0x61f3('0x2b')](_0x3a493b);};}exports[_0x61f3('0x2c')]=function(_0x558ad8,_0x928301){var _0xe58f8b={},_0x41e007={},_0x5fecde={'count':0x0,'rows':[]};var _0x2bc80e=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x184a43){return{'name':_0x184a43[_0x61f3('0x2d')],'type':_0x184a43[_0x61f3('0x2e')]['key']};});_0x41e007['model']=_[_0x61f3('0x2f')](_0x2bc80e,_0x61f3('0x2a'));_0x41e007[_0x61f3('0x30')]=_[_0x61f3('0x31')](_0x558ad8[_0x61f3('0x30')]);_0x41e007['filters']=_['intersection'](_0x41e007['model'],_0x41e007[_0x61f3('0x30')]);_0xe58f8b[_0x61f3('0x32')]=_[_0x61f3('0x33')](_0x41e007[_0x61f3('0x34')],qs[_0x61f3('0x35')](_0x558ad8[_0x61f3('0x30')][_0x61f3('0x35')]));_0xe58f8b['attributes']=_0xe58f8b['attributes'][_0x61f3('0x36')]?_0xe58f8b[_0x61f3('0x32')]:_0x41e007[_0x61f3('0x34')];if(!_0x558ad8[_0x61f3('0x30')][_0x61f3('0x37')](_0x61f3('0x38'))){_0xe58f8b[_0x61f3('0x1d')]=qs['limit'](_0x558ad8['query'][_0x61f3('0x1d')]);_0xe58f8b[_0x61f3('0x1c')]=qs['offset'](_0x558ad8['query']['offset']);}_0xe58f8b[_0x61f3('0x39')]=qs[_0x61f3('0x3a')](_0x558ad8[_0x61f3('0x30')][_0x61f3('0x3a')]);_0xe58f8b[_0x61f3('0x3b')]=qs[_0x61f3('0x3c')](_[_0x61f3('0x3d')](_0x558ad8[_0x61f3('0x30')],_0x41e007['filters']),_0x2bc80e);if(_0x558ad8[_0x61f3('0x30')][_0x61f3('0x3e')]){_0xe58f8b[_0x61f3('0x3b')]=_['merge'](_0xe58f8b[_0x61f3('0x3b')],{'$or':_['map'](_0x2bc80e,function(_0x50a444){if(_0x50a444['type']!==_0x61f3('0x3f')){var _0x2db1f0={};_0x2db1f0[_0x50a444['name']]={'$like':'%'+_0x558ad8[_0x61f3('0x30')][_0x61f3('0x3e')]+'%'};return _0x2db1f0;}})});}_0xe58f8b=_[_0x61f3('0x40')]({},_0xe58f8b,_0x558ad8[_0x61f3('0x41')]);var _0x434df0={'where':_0xe58f8b[_0x61f3('0x3b')]};return db['JscriptyProject'][_0x61f3('0x42')](_0x434df0)[_0x61f3('0x25')](function(_0x21e3d6){_0x5fecde['count']=_0x21e3d6;if(_0x558ad8['query']['includeAll']){_0xe58f8b[_0x61f3('0x43')]=[{'all':!![]}];}return db[_0x61f3('0x44')][_0x61f3('0x45')](_0xe58f8b);})['then'](function(_0x4b5336){_0x5fecde['rows']=_0x4b5336;return _0x5fecde;})[_0x61f3('0x25')](respondWithFilteredResult(_0x928301,_0xe58f8b))[_0x61f3('0x46')](handleError(_0x928301,null));};exports[_0x61f3('0x47')]=function(_0x381600,_0x59abcd){var _0x3bd723={'raw':![],'where':{'id':_0x381600[_0x61f3('0x48')]['id']}},_0xe9fb6e={};_0xe9fb6e[_0x61f3('0x34')]=_[_0x61f3('0x31')](db['JscriptyProject'][_0x61f3('0x49')]);_0xe9fb6e['query']=_['keys'](_0x381600[_0x61f3('0x30')]);_0xe9fb6e['filters']=_[_0x61f3('0x33')](_0xe9fb6e['model'],_0xe9fb6e['query']);_0x3bd723[_0x61f3('0x32')]=_[_0x61f3('0x33')](_0xe9fb6e[_0x61f3('0x34')],qs[_0x61f3('0x35')](_0x381600[_0x61f3('0x30')]['fields']));_0x3bd723[_0x61f3('0x32')]=_0x3bd723[_0x61f3('0x32')][_0x61f3('0x36')]?_0x3bd723[_0x61f3('0x32')]:_0xe9fb6e['model'];if(_0x381600[_0x61f3('0x30')][_0x61f3('0x4a')]){_0x3bd723[_0x61f3('0x43')]=[{'all':!![]}];}_0x3bd723=_[_0x61f3('0x40')]({},_0x3bd723,_0x381600['options']);return db[_0x61f3('0x44')][_0x61f3('0x4b')](_0x3bd723)[_0x61f3('0x25')](handleEntityNotFound(_0x59abcd,null))[_0x61f3('0x25')](respondWithResult(_0x59abcd,null))[_0x61f3('0x46')](handleError(_0x59abcd,null));};exports[_0x61f3('0x4c')]=function(_0x5c8ea5,_0x3d7db3){return db[_0x61f3('0x44')][_0x61f3('0x4c')](_0x5c8ea5['body'],{})['then'](function(_0x4d68d1){var _0x18e790=_0x5c8ea5['user'][_0x61f3('0x26')]({'plain':!![]});if(!_0x18e790)throw new Error(_0x61f3('0x4d'));if(_0x18e790[_0x61f3('0x4e')]===_0x61f3('0x4f')){var _0x365311=_0x4d68d1[_0x61f3('0x26')]({'plain':!![]});var _0x41224a=_0x61f3('0x50');return db[_0x61f3('0x51')][_0x61f3('0x4b')]({'where':{'name':_0x41224a,'userProfileId':_0x18e790['userProfileId']},'raw':!![]})[_0x61f3('0x25')](function(_0x5dec71){if(_0x5dec71&&_0x5dec71[_0x61f3('0x52')]===0x0){return db[_0x61f3('0x27')][_0x61f3('0x4c')]({'name':_0x365311[_0x61f3('0x2a')],'resourceId':_0x365311['id'],'type':_0x5dec71['name'],'sectionId':_0x5dec71['id']},{})['then'](function(){return _0x4d68d1;});}else{return _0x4d68d1;}})[_0x61f3('0x46')](function(_0x3e6810){logger[_0x61f3('0x28')](_0x61f3('0x53'),_0x3e6810);throw _0x3e6810;});}return _0x4d68d1;})[_0x61f3('0x25')](respondWithResult(_0x3d7db3,0xc9))['catch'](handleError(_0x3d7db3,null));};exports[_0x61f3('0x54')]=function(_0x387e10,_0x5eb23a){var _0x2e207d={'where':{'id':_0x387e10[_0x61f3('0x48')]['id']}},_0x5d93bb={};_0x5d93bb[_0x61f3('0x34')]=_[_0x61f3('0x31')](db[_0x61f3('0x44')][_0x61f3('0x49')]);_0x2e207d['attributes']=_[_0x61f3('0x33')](_0x5d93bb[_0x61f3('0x34')],qs[_0x61f3('0x35')](_0x387e10[_0x61f3('0x30')][_0x61f3('0x35')]));_0x2e207d[_0x61f3('0x32')]=_0x2e207d[_0x61f3('0x32')][_0x61f3('0x36')]?_0x2e207d[_0x61f3('0x32')]:_0x5d93bb[_0x61f3('0x34')];if(_0x387e10[_0x61f3('0x30')][_0x61f3('0x4a')]){_0x2e207d[_0x61f3('0x43')]=[{'all':!![]}];}_0x2e207d=_[_0x61f3('0x40')]({},_0x2e207d,_0x387e10[_0x61f3('0x41')]);return db[_0x61f3('0x44')]['find'](_0x2e207d)[_0x61f3('0x25')](handleEntityNotFound(_0x5eb23a,null))[_0x61f3('0x25')](function(_0x5975a2){if(_0x5975a2){var _0x406220=_0x5975a2['get']({'plain':!![]});_0x406220=qs[_0x61f3('0x55')](_0x406220,['id',_0x61f3('0x56'),_0x61f3('0x57')]);_0x387e10['body']=_[_0x61f3('0x55')](_0x387e10[_0x61f3('0x58')],['id',_0x61f3('0x56'),_0x61f3('0x57')]);return db['JscriptyProject'][_0x61f3('0x4c')](_[_0x61f3('0x40')](_0x406220,_0x387e10[_0x61f3('0x58')]),{'include':_0x387e10['query'][_0x61f3('0x4a')]?[{'all':!![]}]:undefined})[_0x61f3('0x25')](function(_0x1e6ed0){var _0x2d328c=_0x387e10['user'][_0x61f3('0x26')]({'plain':!![]});if(!_0x2d328c)throw new Error(_0x61f3('0x4d'));if(_0x2d328c[_0x61f3('0x4e')]===_0x61f3('0x4f')){var _0x17be88=_0x1e6ed0['get']({'plain':!![]});var _0x10bc7b=_0x61f3('0x50');return db[_0x61f3('0x51')][_0x61f3('0x4b')]({'where':{'name':_0x10bc7b,'userProfileId':_0x2d328c[_0x61f3('0x59')]},'raw':!![]})[_0x61f3('0x25')](function(_0xfbe2d3){if(_0xfbe2d3&&_0xfbe2d3['autoAssociation']===0x0){return db['UserProfileResource'][_0x61f3('0x4c')]({'name':_0x17be88[_0x61f3('0x2a')],'resourceId':_0x17be88['id'],'type':_0xfbe2d3[_0x61f3('0x2a')],'sectionId':_0xfbe2d3['id']},{})['then'](function(){return _0x1e6ed0;});}else{return _0x1e6ed0;}})[_0x61f3('0x46')](function(_0x44ad96){logger[_0x61f3('0x28')](_0x61f3('0x53'),_0x44ad96);throw _0x44ad96;});}return _0x1e6ed0;});}})[_0x61f3('0x25')](respondWithResult(_0x5eb23a,0xc9))[_0x61f3('0x46')](handleError(_0x5eb23a,null));};exports[_0x61f3('0x23')]=function(_0x3c161e,_0x5c837a){if(_0x3c161e['body']['id']){delete _0x3c161e[_0x61f3('0x58')]['id'];}return db['JscriptyProject'][_0x61f3('0x4b')]({'where':{'id':_0x3c161e['params']['id']}})[_0x61f3('0x25')](handleEntityNotFound(_0x5c837a,null))[_0x61f3('0x25')](saveUpdates(_0x3c161e['body'],null))[_0x61f3('0x25')](respondWithResult(_0x5c837a,null))['catch'](handleError(_0x5c837a,null));};exports[_0x61f3('0x24')]=function(_0x552bf5,_0x4a69e6){return db[_0x61f3('0x44')][_0x61f3('0x4b')]({'where':{'id':_0x552bf5['params']['id']}})[_0x61f3('0x25')](handleEntityNotFound(_0x4a69e6,null))[_0x61f3('0x25')](removeEntity(_0x4a69e6,null))[_0x61f3('0x46')](handleError(_0x4a69e6,null));};exports[_0x61f3('0x5a')]=function(_0x21cf45,_0x579495,_0x56d763){var _0x58a5be={'raw':!![],'where':{}};var _0x3b6b54={};var _0x31c123={'count':0x0,'rows':[]};return db[_0x61f3('0x44')][_0x61f3('0x5b')]({'where':{'id':_0x21cf45[_0x61f3('0x48')]['id']}})[_0x61f3('0x25')](handleEntityNotFound(_0x579495,null))[_0x61f3('0x25')](function(_0x2d4add){if(_0x2d4add){_0x3b6b54['model']=_[_0x61f3('0x31')](db[_0x61f3('0x5c')]['rawAttributes']);_0x3b6b54['query']=_['keys'](_0x21cf45[_0x61f3('0x30')]);_0x3b6b54['filters']=_[_0x61f3('0x33')](_0x3b6b54['model'],_0x3b6b54[_0x61f3('0x30')]);_0x58a5be[_0x61f3('0x32')]=_['intersection'](_0x3b6b54[_0x61f3('0x34')],qs[_0x61f3('0x35')](_0x21cf45['query']['fields']));_0x58a5be['attributes']=_0x58a5be[_0x61f3('0x32')][_0x61f3('0x36')]?_0x58a5be[_0x61f3('0x32')]:_0x3b6b54['model'];if(!_0x21cf45[_0x61f3('0x30')][_0x61f3('0x37')](_0x61f3('0x38'))){_0x58a5be[_0x61f3('0x1d')]=qs[_0x61f3('0x1d')](_0x21cf45['query'][_0x61f3('0x1d')]);_0x58a5be['offset']=qs[_0x61f3('0x1c')](_0x21cf45['query'][_0x61f3('0x1c')]);}_0x58a5be[_0x61f3('0x39')]=qs[_0x61f3('0x3a')](_0x21cf45[_0x61f3('0x30')][_0x61f3('0x3a')]);_0x58a5be[_0x61f3('0x3b')]=qs['filters'](_[_0x61f3('0x3d')](_0x21cf45[_0x61f3('0x30')],_0x3b6b54[_0x61f3('0x3c')]));_0x58a5be[_0x61f3('0x3b')][_0x61f3('0x5d')]=_0x2d4add['id'];if(_0x21cf45[_0x61f3('0x30')][_0x61f3('0x3e')]){_0x58a5be[_0x61f3('0x3b')]=_[_0x61f3('0x40')](_0x58a5be[_0x61f3('0x3b')],{'$or':_[_0x61f3('0x2f')](_0x58a5be[_0x61f3('0x32')],function(_0x172c42){var _0x2f2753={};_0x2f2753[_0x172c42]={'$like':'%'+_0x21cf45[_0x61f3('0x30')][_0x61f3('0x3e')]+'%'};return _0x2f2753;})});}_0x58a5be=_[_0x61f3('0x40')]({},_0x58a5be,_0x21cf45[_0x61f3('0x41')]);return db[_0x61f3('0x5c')][_0x61f3('0x42')]({'where':_0x58a5be[_0x61f3('0x3b')]})[_0x61f3('0x25')](function(_0x1d75e5){_0x31c123[_0x61f3('0x42')]=_0x1d75e5;if(_0x21cf45[_0x61f3('0x30')]['includeAll']){_0x58a5be[_0x61f3('0x43')]=[{'all':!![]}];}return db[_0x61f3('0x5c')][_0x61f3('0x45')](_0x58a5be);})[_0x61f3('0x25')](function(_0x2ba883){_0x31c123[_0x61f3('0x5e')]=_0x2ba883;return _0x31c123;});}})[_0x61f3('0x25')](respondWithFilteredResult(_0x579495,_0x58a5be))['catch'](handleError(_0x579495,null));};exports[_0x61f3('0x5f')]=function(_0xa0a748,_0x485690,_0x562c96){var _0x299c14={'raw':!![],'where':{}};var _0x3e2592={};var _0x28ad80={'count':0x0,'rows':[]};return db[_0x61f3('0x44')][_0x61f3('0x5b')]({'where':{'id':_0xa0a748[_0x61f3('0x48')]['id']}})[_0x61f3('0x25')](handleEntityNotFound(_0x485690,null))[_0x61f3('0x25')](function(_0x47a4b1){if(_0x47a4b1){_0x3e2592['model']=_[_0x61f3('0x31')](db['JscriptyAnswerReport'][_0x61f3('0x49')]);_0x3e2592[_0x61f3('0x30')]=_[_0x61f3('0x31')](_0xa0a748[_0x61f3('0x30')]);_0x3e2592[_0x61f3('0x3c')]=_[_0x61f3('0x33')](_0x3e2592[_0x61f3('0x34')],_0x3e2592[_0x61f3('0x30')]);_0x299c14[_0x61f3('0x32')]=_[_0x61f3('0x33')](_0x3e2592[_0x61f3('0x34')],qs[_0x61f3('0x35')](_0xa0a748[_0x61f3('0x30')][_0x61f3('0x35')]));_0x299c14[_0x61f3('0x32')]=_0x299c14[_0x61f3('0x32')]['length']?_0x299c14[_0x61f3('0x32')]:_0x3e2592[_0x61f3('0x34')];if(!_0xa0a748[_0x61f3('0x30')][_0x61f3('0x37')]('nolimit')){_0x299c14[_0x61f3('0x1d')]=qs[_0x61f3('0x1d')](_0xa0a748[_0x61f3('0x30')]['limit']);_0x299c14['offset']=qs['offset'](_0xa0a748[_0x61f3('0x30')][_0x61f3('0x1c')]);}_0x299c14['order']=qs[_0x61f3('0x3a')](_0xa0a748[_0x61f3('0x30')][_0x61f3('0x3a')]);_0x299c14['where']=qs[_0x61f3('0x3c')](_[_0x61f3('0x3d')](_0xa0a748['query'],_0x3e2592[_0x61f3('0x3c')]));_0x299c14[_0x61f3('0x3b')][_0x61f3('0x5d')]=_0x47a4b1['id'];if(_0xa0a748[_0x61f3('0x30')][_0x61f3('0x3e')]){_0x299c14['where']=_['merge'](_0x299c14['where'],{'$or':_[_0x61f3('0x2f')](_0x299c14[_0x61f3('0x32')],function(_0x4ec182){var _0x5920f5={};_0x5920f5[_0x4ec182]={'$like':'%'+_0xa0a748[_0x61f3('0x30')]['filter']+'%'};return _0x5920f5;})});}_0x299c14=_[_0x61f3('0x40')]({},_0x299c14,_0xa0a748[_0x61f3('0x41')]);return db[_0x61f3('0x60')][_0x61f3('0x42')]({'where':_0x299c14[_0x61f3('0x3b')]})[_0x61f3('0x25')](function(_0x3ebd19){_0x28ad80[_0x61f3('0x42')]=_0x3ebd19;if(_0xa0a748['query'][_0x61f3('0x4a')]){_0x299c14[_0x61f3('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x61f3('0x45')](_0x299c14);})[_0x61f3('0x25')](function(_0x3c410b){_0x28ad80['rows']=_0x3c410b;return _0x28ad80;});}})['then'](respondWithFilteredResult(_0x485690,_0x299c14))[_0x61f3('0x46')](handleError(_0x485690,null));};function char(_0x580856){return _0x61f3('0x61')===typeof _0x580856?String[_0x61f3('0x62')][_0x61f3('0x20')](null,arguments):_0x580856;}function needsEncapsulation(_0x1e4db4){return!!_0x1e4db4&&(_0x1e4db4[_0x61f3('0x63')]()[_0x61f3('0x64')](char(0xd))>=0x0||_0x1e4db4[_0x61f3('0x63')]()[_0x61f3('0x64')](char(0xa))>=0x0||_0x1e4db4[_0x61f3('0x63')]()[_0x61f3('0x64')](char(0x2c))>=0x0||_0x1e4db4[_0x61f3('0x63')]()[_0x61f3('0x64')](char(0x22))>=0x0);}function encapsulate(_0x47cb4d){var _0x650fc7=char(0x22),_0x5307a3='\x5c'+char(0x22),_0x3f469f=_0x47cb4d[_0x61f3('0x63')]()[_0x61f3('0x65')](new RegExp(_0x650fc7,'g'),_0x5307a3);return _0x650fc7+_0x3f469f+_0x650fc7;}exports[_0x61f3('0x66')]=function(_0x1db0ce,_0x357b13,_0x52ebf6){var _0xd3b7a1,_0x20b86e;var _0x4b1ddb={'where':{'ProjectId':_0x1db0ce['params']['id']}};if(_0x1db0ce[_0x61f3('0x30')][_0x61f3('0x67')]){_0x4b1ddb[_0x61f3('0x3b')][_0x61f3('0x68')]=JSON[_0x61f3('0x69')](_0x1db0ce[_0x61f3('0x30')][_0x61f3('0x67')]);}return db[_0x61f3('0x5c')][_0x61f3('0x45')](_0x4b1ddb)[_0x61f3('0x25')](handleEntityNotFound(_0x357b13,null))[_0x61f3('0x25')](function(_0x384f89){if(_0x384f89){_0xd3b7a1=_0x384f89;return db['JscriptyQuestionReport'][_0x61f3('0x45')]({'where':{'SessionId':{'$in':_[_0x61f3('0x2f')](_0xd3b7a1,'id')},'ProjectId':_0x1db0ce['params']['id']},'order':_0x61f3('0x6a')});}})[_0x61f3('0x25')](handleEntityNotFound(_0x357b13,null))['then'](function(_0x301cca){if(_0x301cca){_0x20b86e=_0x301cca;var _0x3d0f95={};for(var _0x5edf98=0x0,_0x47140b=_0x20b86e[_0x61f3('0x36')];_0x5edf98<_0x47140b;_0x5edf98++){if(!_0x3d0f95[_0x61f3('0x37')](_0x20b86e[_0x5edf98][_0x61f3('0x6b')])){_0x3d0f95[_0x20b86e[_0x5edf98][_0x61f3('0x6b')]]=needsEncapsulation(_0x20b86e[_0x5edf98]['question'])?encapsulate(_0x20b86e[_0x5edf98][_0x61f3('0x6c')]):_0x20b86e[_0x5edf98]['question'];}}var _0x47ae4b=[],_0x1587d7={};for(var _0x37c432=0x0,_0x5a8e18=_0xd3b7a1['length'];_0x37c432<_0x5a8e18;_0x37c432++){_0x1587d7={'ProjectId':_0x1db0ce[_0x61f3('0x48')]['id'],'SessionId':_0xd3b7a1[_0x37c432]['id'],'StartTime':moment(_0xd3b7a1[_0x37c432][_0x61f3('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3712bc=0x0,_0x51b0e9=_0x20b86e[_0x61f3('0x36')];_0x3712bc<_0x51b0e9;_0x3712bc++){if(_0x20b86e[_0x3712bc][_0x61f3('0x6d')]==_0xd3b7a1[_0x37c432]['id']&&_0x3d0f95[_0x61f3('0x37')](_0x20b86e[_0x3712bc][_0x61f3('0x6b')])){_0x1587d7[_0x3d0f95[_0x20b86e[_0x3712bc][_0x61f3('0x6b')]]]=_0x20b86e[_0x3712bc]['answer'];}}for(var _0x4b39e8 in _0x3d0f95){if(!_0x1587d7[_0x61f3('0x37')](_0x3d0f95[_0x4b39e8])){_0x1587d7[_0x3d0f95[_0x4b39e8]]=null;}}_0x47ae4b[_0x61f3('0x6e')](_0x1587d7);}return _0x47ae4b;}})[_0x61f3('0x25')](function(_0x19d5e7){if(!_['isEmpty'](_0x19d5e7)){var _0x4fb406=toCsv(_0x19d5e7);var _0x499298=Date[_0x61f3('0x6f')]();fs[_0x61f3('0x70')](util[_0x61f3('0x71')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1db0ce[_0x61f3('0x48')]['id'],_0x499298),_0x4fb406);_0x357b13[_0x61f3('0x72')](_0x61f3('0x73'),'attachment;\x20filename='+util[_0x61f3('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x1db0ce[_0x61f3('0x48')]['id'],_0x499298));_0x357b13[_0x61f3('0x72')]('Content-type',_0x61f3('0x74'));return _0x357b13[_0x61f3('0x75')](util[_0x61f3('0x71')](_0x61f3('0x76'),_0x1db0ce[_0x61f3('0x48')]['id'],_0x499298));}else{return _0x357b13[_0x61f3('0x18')](0xcc);}})['catch'](handleError(_0x357b13,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index fb08760..cfa64f8 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 _0x17a6=['../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','api','moment','request-promise','rimraf'];(function(_0x225cae,_0x3442eb){var _0x474424=function(_0x3c53af){while(--_0x3c53af){_0x225cae['push'](_0x225cae['shift']());}};_0x474424(++_0x3442eb);}(_0x17a6,0xee));var _0x617a=function(_0x21f3ce,_0x16270d){_0x21f3ce=_0x21f3ce-0x0;var _0x21fb19=_0x17a6[_0x21f3ce];return _0x21fb19;};'use strict';var _=require(_0x617a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x617a('0x1'));var moment=require(_0x617a('0x2'));var BPromise=require('bluebird');var rp=require(_0x617a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x617a('0x4'));var config=require(_0x617a('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x617a('0x6')]=function(_0x5a85c5,_0x14da96){return _0x5a85c5['define'](_0x617a('0x7'),attributes,{'tableName':_0x617a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e02=['bluebird','request-promise','path','exports','define','util','../../config/logger','api'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x5e02,0xb5));var _0x25e0=function(_0x229e01,_0x75d644){_0x229e01=_0x229e01-0x0;var _0x160115=_0x5e02[_0x229e01];return _0x160115;};'use strict';var _=require('lodash');var util=require(_0x25e0('0x0'));var logger=require(_0x25e0('0x1'))(_0x25e0('0x2'));var moment=require('moment');var BPromise=require(_0x25e0('0x3'));var rp=require(_0x25e0('0x4'));var fs=require('fs');var path=require(_0x25e0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x25e0('0x6')]=function(_0x2f8e07,_0x3341b5){return _0x2f8e07[_0x25e0('0x7')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','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 e44b50a..df18ea2 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 _0x4bec=['jayson/promise','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x4bec,0x7b));var _0xc4be=function(_0x1c4e37,_0x5994e5){_0x1c4e37=_0x1c4e37-0x0;var _0x58635e=_0x4bec[_0x1c4e37];return _0x58635e;};'use strict';var _=require(_0xc4be('0x0'));var util=require('util');var moment=require(_0xc4be('0x1'));var BPromise=require(_0xc4be('0x2'));var rs=require(_0xc4be('0x3'));var fs=require('fs');var Redis=require(_0xc4be('0x4'));var db=require(_0xc4be('0x5'))['db'];var utils=require(_0xc4be('0x6'));var logger=require(_0xc4be('0x7'))(_0xc4be('0x8'));var config=require('../../config/environment');var jayson=require(_0xc4be('0x9'));var client=jayson['client'][_0xc4be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c9602,_0x1eb974,_0x2561bb){return new BPromise(function(_0x277b04,_0x5e192b){return client[_0xc4be('0xb')](_0x3c9602,_0x2561bb)[_0xc4be('0xc')](function(_0x3e71cc){logger[_0xc4be('0xd')](_0xc4be('0xe'),_0x1eb974,_0xc4be('0xf'));logger['debug'](_0xc4be('0x10'),_0x1eb974,'request\x20sent',JSON[_0xc4be('0x11')](_0x3e71cc));if(_0x3e71cc[_0xc4be('0x12')]){if(_0x3e71cc['error'][_0xc4be('0x13')]===0x1f4){logger[_0xc4be('0x12')](_0xc4be('0xe'),_0x1eb974,_0x3e71cc[_0xc4be('0x12')]['message']);return _0x5e192b(_0x3e71cc[_0xc4be('0x12')]['message']);}logger['error'](_0xc4be('0xe'),_0x1eb974,_0x3e71cc[_0xc4be('0x12')][_0xc4be('0x14')]);return _0x277b04(_0x3e71cc[_0xc4be('0x12')][_0xc4be('0x14')]);}else{logger[_0xc4be('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x1eb974,'request\x20sent');_0x277b04(_0x3e71cc[_0xc4be('0x15')][_0xc4be('0x14')]);}})['catch'](function(_0x2b7818){logger[_0xc4be('0x12')](_0xc4be('0xe'),_0x1eb974,_0x2b7818);_0x5e192b(_0x2b7818);});});} \ No newline at end of file +var _0x34cd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0x34cd,0x6b));var _0xd34c=function(_0x5f5b04,_0x57cc4e){_0x5f5b04=_0x5f5b04-0x0;var _0x2ba5f7=_0x34cd[_0x5f5b04];return _0x2ba5f7;};'use strict';var _=require(_0xd34c('0x0'));var util=require(_0xd34c('0x1'));var moment=require(_0xd34c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd34c('0x3'));var db=require(_0xd34c('0x4'))['db'];var utils=require(_0xd34c('0x5'));var logger=require(_0xd34c('0x6'))(_0xd34c('0x7'));var config=require(_0xd34c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd34c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1b01,_0x4670c,_0x362428){return new BPromise(function(_0xb63ddd,_0x5c4438){return client[_0xd34c('0xa')](_0x1d1b01,_0x362428)[_0xd34c('0xb')](function(_0x7b7924){logger[_0xd34c('0xc')](_0xd34c('0xd'),_0x4670c,_0xd34c('0xe'));logger[_0xd34c('0xf')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x4670c,_0xd34c('0xe'),JSON[_0xd34c('0x10')](_0x7b7924));if(_0x7b7924['error']){if(_0x7b7924['error'][_0xd34c('0x11')]===0x1f4){logger[_0xd34c('0x12')](_0xd34c('0xd'),_0x4670c,_0x7b7924[_0xd34c('0x12')]['message']);return _0x5c4438(_0x7b7924[_0xd34c('0x12')][_0xd34c('0x13')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x4670c,_0x7b7924[_0xd34c('0x12')][_0xd34c('0x13')]);return _0xb63ddd(_0x7b7924[_0xd34c('0x12')][_0xd34c('0x13')]);}else{logger['info'](_0xd34c('0xd'),_0x4670c,'request\x20sent');_0xb63ddd(_0x7b7924[_0xd34c('0x14')][_0xd34c('0x13')]);}})[_0xd34c('0x15')](function(_0x8f1d42){logger['error'](_0xd34c('0xd'),_0x4670c,_0x8f1d42);_0x5c4438(_0x8f1d42);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 50d56ce..28ce49c 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 _0x9dc9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9dc9,0x19d));var _0x99dc=function(_0x35e7c9,_0x448948){_0x35e7c9=_0x35e7c9-0x0;var _0x3bb16e=_0x9dc9[_0x35e7c9];return _0x3bb16e;};'use strict';var multer=require(_0x99dc('0x0'));var util=require(_0x99dc('0x1'));var path=require(_0x99dc('0x2'));var timeout=require(_0x99dc('0x3'));var express=require(_0x99dc('0x4'));var router=express[_0x99dc('0x5')]();var auth=require(_0x99dc('0x6'));var interaction=require(_0x99dc('0x7'));var config=require(_0x99dc('0x8'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x99dc('0x9')](),controller[_0x99dc('0xa')]);router[_0x99dc('0xb')](_0x99dc('0xc'),auth[_0x99dc('0x9')](),controller[_0x99dc('0xd')]);router[_0x99dc('0xb')](_0x99dc('0xe'),auth[_0x99dc('0x9')](),controller[_0x99dc('0xf')]);router[_0x99dc('0x10')]('/',auth[_0x99dc('0x9')](),controller[_0x99dc('0x11')]);router[_0x99dc('0x12')](_0x99dc('0xe'),auth[_0x99dc('0x9')](),controller[_0x99dc('0x13')]);router[_0x99dc('0x14')]('/:id',auth[_0x99dc('0x9')](),controller[_0x99dc('0x15')]);module[_0x99dc('0x16')]=router; \ No newline at end of file +var _0xfb4e=['./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','post','create','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xfb4e,0x70));var _0xefb4=function(_0x220882,_0x42619b){_0x220882=_0x220882-0x0;var _0xbcf788=_0xfb4e[_0x220882];return _0xbcf788;};'use strict';var multer=require('multer');var util=require(_0xefb4('0x0'));var path=require(_0xefb4('0x1'));var timeout=require(_0xefb4('0x2'));var express=require(_0xefb4('0x3'));var router=express[_0xefb4('0x4')]();var auth=require(_0xefb4('0x5'));var interaction=require(_0xefb4('0x6'));var config=require(_0xefb4('0x7'));var controller=require(_0xefb4('0x8'));router[_0xefb4('0x9')]('/',auth['isAuthenticated'](),controller[_0xefb4('0xa')]);router[_0xefb4('0x9')](_0xefb4('0xb'),auth[_0xefb4('0xc')](),controller[_0xefb4('0xd')]);router[_0xefb4('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xefb4('0xe')]('/',auth['isAuthenticated'](),controller[_0xefb4('0xf')]);router['put'](_0xefb4('0x10'),auth[_0xefb4('0xc')](),controller[_0xefb4('0x11')]);router[_0xefb4('0x12')]('/:id',auth[_0xefb4('0xc')](),controller['destroy']);module[_0xefb4('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4050696..8546730 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 _0xdf5a=['STRING','TEXT','long','sequelize'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xdf5a,0x13f));var _0xadf5=function(_0x404d2d,_0x3cef06){_0x404d2d=_0x404d2d-0x0;var _0x526482=_0xdf5a[_0x404d2d];return _0x526482;};'use strict';var Sequelize=require(_0xadf5('0x0'));module['exports']={'question':{'type':Sequelize[_0xadf5('0x1')]},'answer':{'type':Sequelize[_0xadf5('0x2')](_0xadf5('0x3'))},'membername':{'type':Sequelize[_0xadf5('0x1')]},'projectname':{'type':Sequelize[_0xadf5('0x1')]},'queue':{'type':Sequelize[_0xadf5('0x1')]},'uniqueid':{'type':Sequelize[_0xadf5('0x1')]},'calleridname':{'type':Sequelize[_0xadf5('0x1')]},'calleridnum':{'type':Sequelize[_0xadf5('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0152=['long','exports','STRING'];(function(_0x22a993,_0x4a48ba){var _0x13c3a7=function(_0x3c7cbe){while(--_0x3c7cbe){_0x22a993['push'](_0x22a993['shift']());}};_0x13c3a7(++_0x4a48ba);}(_0x0152,0xbb));var _0x2015=function(_0x3ff932,_0x3571f0){_0x3ff932=_0x3ff932-0x0;var _0x42717e=_0x0152[_0x3ff932];return _0x42717e;};'use strict';var Sequelize=require('sequelize');module[_0x2015('0x0')]={'question':{'type':Sequelize[_0x2015('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x2015('0x2'))},'membername':{'type':Sequelize[_0x2015('0x1')]},'projectname':{'type':Sequelize[_0x2015('0x1')]},'queue':{'type':Sequelize[_0x2015('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2015('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x2015('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 73c814a..66773e0 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 _0x7cca=['body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','params','length','includeAll','include','find','create'];(function(_0x464e1f,_0x2aa86f){var _0x1c1ce2=function(_0x543c79){while(--_0x543c79){_0x464e1f['push'](_0x464e1f['shift']());}};_0x1c1ce2(++_0x2aa86f);}(_0x7cca,0x16f));var _0xa7cc=function(_0x6778c5,_0x565f6c){_0x6778c5=_0x6778c5-0x0;var _0x1f7db2=_0x7cca[_0x6778c5];return _0x1f7db2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa7cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7cc('0x1'));var jsonpatch=require(_0xa7cc('0x2'));var rp=require(_0xa7cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa7cc('0x4'));var util=require(_0xa7cc('0x5'));var path=require(_0xa7cc('0x6'));var sox=require(_0xa7cc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa7cc('0x8'));var squel=require(_0xa7cc('0x9'));var crypto=require('crypto');var jsforce=require(_0xa7cc('0xa'));var deskjs=require(_0xa7cc('0xb'));var toCsv=require(_0xa7cc('0xc'));var querystring=require(_0xa7cc('0xd'));var Papa=require('papaparse');var Redis=require(_0xa7cc('0xe'));var authService=require(_0xa7cc('0xf'));var qs=require(_0xa7cc('0x10'));var as=require(_0xa7cc('0x11'));var hardwareService=require(_0xa7cc('0x12'));var logger=require(_0xa7cc('0x13'))('api');var utils=require(_0xa7cc('0x14'));var config=require(_0xa7cc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165e97,_0x5d5cd9){_0x5d5cd9=_0x5d5cd9||0xcc;return function(_0x1fc1f7){if(_0x1fc1f7){return _0x165e97[_0xa7cc('0x16')](_0x5d5cd9);}return _0x165e97[_0xa7cc('0x17')](_0x5d5cd9)['end']();};}function respondWithResult(_0x806317,_0x13ae28){_0x13ae28=_0x13ae28||0xc8;return function(_0x139318){if(_0x139318){return _0x806317[_0xa7cc('0x17')](_0x13ae28)[_0xa7cc('0x18')](_0x139318);}};}function respondWithFilteredResult(_0x394ebf,_0xe784e6){return function(_0x42ce87){if(_0x42ce87){var _0x3e1ce7=_0x42ce87[_0xa7cc('0x19')],_0x4959db=_0xe784e6[_0xa7cc('0x1a')],_0x19ede1=_0xe784e6[_0xa7cc('0x1a')]+_0xe784e6[_0xa7cc('0x1b')],_0x4fe76d;if(_0x19ede1>=_0x3e1ce7){_0x19ede1=_0x3e1ce7;_0x4fe76d=0xc8;}else{_0x4fe76d=0xce;}_0x394ebf['status'](_0x4fe76d);return _0x394ebf[_0xa7cc('0x1c')](_0xa7cc('0x1d'),_0x4959db+'-'+_0x19ede1+'/'+_0x3e1ce7)[_0xa7cc('0x18')](_0x42ce87);}return null;};}function patchUpdates(_0x54d434){return function(_0x5efb84){try{jsonpatch['apply'](_0x5efb84,_0x54d434,!![]);}catch(_0x28d162){return BPromise[_0xa7cc('0x1e')](_0x28d162);}return _0x5efb84[_0xa7cc('0x1f')]();};}function saveUpdates(_0x24d0ae,_0x33de9d){return function(_0x133a01){if(_0x133a01){return _0x133a01[_0xa7cc('0x20')](_0x24d0ae)[_0xa7cc('0x21')](function(_0x37ba59){return _0x37ba59;});}return null;};}function removeEntity(_0x38652b,_0x1f0f0c){return function(_0x55b32e){if(_0x55b32e){return _0x55b32e[_0xa7cc('0x22')]()[_0xa7cc('0x21')](function(){_0x38652b[_0xa7cc('0x17')](0xcc)[_0xa7cc('0x23')]();});}};}function handleEntityNotFound(_0x4da453,_0x21711f){return function(_0x2fabc7){if(!_0x2fabc7){_0x4da453[_0xa7cc('0x16')](0x194);}return _0x2fabc7;};}function handleError(_0x158ce2,_0x5b8768){_0x5b8768=_0x5b8768||0x1f4;return function(_0x576a6b){logger[_0xa7cc('0x24')](_0x576a6b[_0xa7cc('0x25')]);if(_0x576a6b[_0xa7cc('0x26')]){delete _0x576a6b[_0xa7cc('0x26')];}_0x158ce2[_0xa7cc('0x17')](_0x5b8768)[_0xa7cc('0x27')](_0x576a6b);};}exports[_0xa7cc('0x28')]=function(_0x7cd09,_0x3dfc20){var _0x5124b8={},_0x2bfd81={},_0x5e49b4={'count':0x0,'rows':[]};var _0x2f23bd=_['map'](db[_0xa7cc('0x29')][_0xa7cc('0x2a')],function(_0x40678d){return{'name':_0x40678d[_0xa7cc('0x2b')],'type':_0x40678d['type'][_0xa7cc('0x2c')]};});_0x2bfd81['model']=_['map'](_0x2f23bd,_0xa7cc('0x26'));_0x2bfd81[_0xa7cc('0x2d')]=_[_0xa7cc('0x2e')](_0x7cd09[_0xa7cc('0x2d')]);_0x2bfd81[_0xa7cc('0x2f')]=_['intersection'](_0x2bfd81[_0xa7cc('0x30')],_0x2bfd81[_0xa7cc('0x2d')]);_0x5124b8[_0xa7cc('0x31')]=_[_0xa7cc('0x32')](_0x2bfd81[_0xa7cc('0x30')],qs[_0xa7cc('0x33')](_0x7cd09[_0xa7cc('0x2d')][_0xa7cc('0x33')]));_0x5124b8[_0xa7cc('0x31')]=_0x5124b8['attributes']['length']?_0x5124b8[_0xa7cc('0x31')]:_0x2bfd81[_0xa7cc('0x30')];if(!_0x7cd09[_0xa7cc('0x2d')][_0xa7cc('0x34')]('nolimit')){_0x5124b8[_0xa7cc('0x1b')]=qs[_0xa7cc('0x1b')](_0x7cd09['query'][_0xa7cc('0x1b')]);_0x5124b8[_0xa7cc('0x1a')]=qs[_0xa7cc('0x1a')](_0x7cd09[_0xa7cc('0x2d')][_0xa7cc('0x1a')]);}_0x5124b8[_0xa7cc('0x35')]=qs[_0xa7cc('0x36')](_0x7cd09[_0xa7cc('0x2d')][_0xa7cc('0x36')]);_0x5124b8[_0xa7cc('0x37')]=qs[_0xa7cc('0x2f')](_[_0xa7cc('0x38')](_0x7cd09[_0xa7cc('0x2d')],_0x2bfd81['filters']),_0x2f23bd);if(_0x7cd09[_0xa7cc('0x2d')][_0xa7cc('0x39')]){_0x5124b8[_0xa7cc('0x37')]=_[_0xa7cc('0x3a')](_0x5124b8[_0xa7cc('0x37')],{'$or':_['map'](_0x2f23bd,function(_0xcbc688){if(_0xcbc688[_0xa7cc('0x3b')]!==_0xa7cc('0x3c')){var _0xf6d1c1={};_0xf6d1c1[_0xcbc688[_0xa7cc('0x26')]]={'$like':'%'+_0x7cd09[_0xa7cc('0x2d')][_0xa7cc('0x39')]+'%'};return _0xf6d1c1;}})});}_0x5124b8=_[_0xa7cc('0x3a')]({},_0x5124b8,_0x7cd09[_0xa7cc('0x3d')]);var _0x443d28={'where':_0x5124b8[_0xa7cc('0x37')]};return db[_0xa7cc('0x29')][_0xa7cc('0x19')](_0x443d28)[_0xa7cc('0x21')](function(_0x5a1122){_0x5e49b4['count']=_0x5a1122;if(_0x7cd09['query']['includeAll']){_0x5124b8['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xa7cc('0x3e')](_0x5124b8);})['then'](function(_0x32c6e8){_0x5e49b4[_0xa7cc('0x3f')]=_0x32c6e8;return _0x5e49b4;})[_0xa7cc('0x21')](respondWithFilteredResult(_0x3dfc20,_0x5124b8))[_0xa7cc('0x40')](handleError(_0x3dfc20,null));};exports['show']=function(_0x177163,_0x3a8c98){var _0x500453={'raw':!![],'where':{'id':_0x177163[_0xa7cc('0x41')]['id']}},_0x46f969={};_0x46f969[_0xa7cc('0x30')]=_[_0xa7cc('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x46f969[_0xa7cc('0x2d')]=_[_0xa7cc('0x2e')](_0x177163[_0xa7cc('0x2d')]);_0x46f969[_0xa7cc('0x2f')]=_[_0xa7cc('0x32')](_0x46f969['model'],_0x46f969[_0xa7cc('0x2d')]);_0x500453[_0xa7cc('0x31')]=_[_0xa7cc('0x32')](_0x46f969[_0xa7cc('0x30')],qs[_0xa7cc('0x33')](_0x177163[_0xa7cc('0x2d')][_0xa7cc('0x33')]));_0x500453['attributes']=_0x500453[_0xa7cc('0x31')][_0xa7cc('0x42')]?_0x500453[_0xa7cc('0x31')]:_0x46f969[_0xa7cc('0x30')];if(_0x177163[_0xa7cc('0x2d')][_0xa7cc('0x43')]){_0x500453[_0xa7cc('0x44')]=[{'all':!![]}];}_0x500453=_[_0xa7cc('0x3a')]({},_0x500453,_0x177163[_0xa7cc('0x3d')]);return db[_0xa7cc('0x29')][_0xa7cc('0x45')](_0x500453)[_0xa7cc('0x21')](handleEntityNotFound(_0x3a8c98,null))[_0xa7cc('0x21')](respondWithResult(_0x3a8c98,null))[_0xa7cc('0x40')](handleError(_0x3a8c98,null));};exports['create']=function(_0x238240,_0x25112f){return db[_0xa7cc('0x29')][_0xa7cc('0x46')](_0x238240[_0xa7cc('0x47')],{})[_0xa7cc('0x21')](respondWithResult(_0x25112f,0xc9))[_0xa7cc('0x40')](handleError(_0x25112f,null));};exports[_0xa7cc('0x20')]=function(_0x2d2545,_0x1e268b){if(_0x2d2545['body']['id']){delete _0x2d2545['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2d2545[_0xa7cc('0x41')]['id']}})[_0xa7cc('0x21')](handleEntityNotFound(_0x1e268b,null))['then'](saveUpdates(_0x2d2545[_0xa7cc('0x47')],null))['then'](respondWithResult(_0x1e268b,null))[_0xa7cc('0x40')](handleError(_0x1e268b,null));};exports[_0xa7cc('0x22')]=function(_0x26abbd,_0xfb16c4){return db[_0xa7cc('0x29')][_0xa7cc('0x45')]({'where':{'id':_0x26abbd[_0xa7cc('0x41')]['id']}})[_0xa7cc('0x21')](handleEntityNotFound(_0xfb16c4,null))[_0xa7cc('0x21')](removeEntity(_0xfb16c4,null))[_0xa7cc('0x40')](handleError(_0xfb16c4,null));};exports[_0xa7cc('0x48')]=function(_0x34c6ac,_0x5ae05b){return db['JscriptyQuestionReport']['describe']()[_0xa7cc('0x21')](respondWithResult(_0x5ae05b,null))[_0xa7cc('0x40')](handleError(_0x5ae05b,null));}; \ No newline at end of file +var _0xe714=['find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','save','update','destroy','then','error','stack','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','include','rows','catch','params','fields','includeAll'];(function(_0x10c8d2,_0x23e0d4){var _0x521419=function(_0x25bc55){while(--_0x25bc55){_0x10c8d2['push'](_0x10c8d2['shift']());}};_0x521419(++_0x23e0d4);}(_0xe714,0x95));var _0x4e71=function(_0x3fba0a,_0x48e8e0){_0x3fba0a=_0x3fba0a-0x0;var _0x1be99c=_0xe714[_0x3fba0a];return _0x1be99c;};'use strict';var pdf=require(_0x4e71('0x0'));var emlformat=require(_0x4e71('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4e71('0x2'));var jsonpatch=require(_0x4e71('0x3'));var rp=require(_0x4e71('0x4'));var moment=require(_0x4e71('0x5'));var BPromise=require(_0x4e71('0x6'));var Mustache=require(_0x4e71('0x7'));var util=require(_0x4e71('0x8'));var path=require('path');var sox=require(_0x4e71('0x9'));var csv=require(_0x4e71('0xa'));var ejs=require(_0x4e71('0xb'));var fs=require('fs');var _=require(_0x4e71('0xc'));var squel=require(_0x4e71('0xd'));var crypto=require(_0x4e71('0xe'));var jsforce=require(_0x4e71('0xf'));var deskjs=require(_0x4e71('0x10'));var toCsv=require(_0x4e71('0xa'));var querystring=require(_0x4e71('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4e71('0x12'));var qs=require(_0x4e71('0x13'));var as=require(_0x4e71('0x14'));var hardwareService=require(_0x4e71('0x15'));var logger=require(_0x4e71('0x16'))('api');var utils=require(_0x4e71('0x17'));var config=require(_0x4e71('0x18'));var db=require(_0x4e71('0x19'))['db'];function respondWithStatusCode(_0x4757d3,_0x44515e){_0x44515e=_0x44515e||0xcc;return function(_0x390fd3){if(_0x390fd3){return _0x4757d3[_0x4e71('0x1a')](_0x44515e);}return _0x4757d3['status'](_0x44515e)[_0x4e71('0x1b')]();};}function respondWithResult(_0x40f765,_0x52bacf){_0x52bacf=_0x52bacf||0xc8;return function(_0x342ba2){if(_0x342ba2){return _0x40f765[_0x4e71('0x1c')](_0x52bacf)[_0x4e71('0x1d')](_0x342ba2);}};}function respondWithFilteredResult(_0x956f12,_0xa569f6){return function(_0x581b24){if(_0x581b24){var _0x2f2af4=_0x581b24['count'],_0x23dde6=_0xa569f6[_0x4e71('0x1e')],_0x334d95=_0xa569f6[_0x4e71('0x1e')]+_0xa569f6[_0x4e71('0x1f')],_0x5b040f;if(_0x334d95>=_0x2f2af4){_0x334d95=_0x2f2af4;_0x5b040f=0xc8;}else{_0x5b040f=0xce;}_0x956f12[_0x4e71('0x1c')](_0x5b040f);return _0x956f12[_0x4e71('0x20')]('Content-Range',_0x23dde6+'-'+_0x334d95+'/'+_0x2f2af4)['json'](_0x581b24);}return null;};}function patchUpdates(_0x4a5874){return function(_0x1fe792){try{jsonpatch['apply'](_0x1fe792,_0x4a5874,!![]);}catch(_0x137e78){return BPromise['reject'](_0x137e78);}return _0x1fe792[_0x4e71('0x21')]();};}function saveUpdates(_0x158f3e,_0x5f2255){return function(_0x33490e){if(_0x33490e){return _0x33490e[_0x4e71('0x22')](_0x158f3e)['then'](function(_0x161dcc){return _0x161dcc;});}return null;};}function removeEntity(_0x4ff631,_0x20eeb9){return function(_0x4000cc){if(_0x4000cc){return _0x4000cc[_0x4e71('0x23')]()[_0x4e71('0x24')](function(){_0x4ff631['status'](0xcc)[_0x4e71('0x1b')]();});}};}function handleEntityNotFound(_0x1a24b7,_0x2530a5){return function(_0x2ce36a){if(!_0x2ce36a){_0x1a24b7[_0x4e71('0x1a')](0x194);}return _0x2ce36a;};}function handleError(_0x5626af,_0x23542e){_0x23542e=_0x23542e||0x1f4;return function(_0x5309a7){logger[_0x4e71('0x25')](_0x5309a7[_0x4e71('0x26')]);if(_0x5309a7['name']){delete _0x5309a7['name'];}_0x5626af['status'](_0x23542e)['send'](_0x5309a7);};}exports[_0x4e71('0x27')]=function(_0x4f8af5,_0x47d484){var _0x3228a0={},_0x594b2c={},_0x2122ae={'count':0x0,'rows':[]};var _0x3a8137=_[_0x4e71('0x28')](db[_0x4e71('0x29')][_0x4e71('0x2a')],function(_0x18db7b){return{'name':_0x18db7b[_0x4e71('0x2b')],'type':_0x18db7b['type'][_0x4e71('0x2c')]};});_0x594b2c['model']=_[_0x4e71('0x28')](_0x3a8137,_0x4e71('0x2d'));_0x594b2c[_0x4e71('0x2e')]=_[_0x4e71('0x2f')](_0x4f8af5[_0x4e71('0x2e')]);_0x594b2c[_0x4e71('0x30')]=_[_0x4e71('0x31')](_0x594b2c[_0x4e71('0x32')],_0x594b2c[_0x4e71('0x2e')]);_0x3228a0[_0x4e71('0x33')]=_['intersection'](_0x594b2c[_0x4e71('0x32')],qs['fields'](_0x4f8af5['query']['fields']));_0x3228a0[_0x4e71('0x33')]=_0x3228a0['attributes'][_0x4e71('0x34')]?_0x3228a0['attributes']:_0x594b2c[_0x4e71('0x32')];if(!_0x4f8af5[_0x4e71('0x2e')][_0x4e71('0x35')]('nolimit')){_0x3228a0[_0x4e71('0x1f')]=qs[_0x4e71('0x1f')](_0x4f8af5['query']['limit']);_0x3228a0['offset']=qs[_0x4e71('0x1e')](_0x4f8af5['query'][_0x4e71('0x1e')]);}_0x3228a0[_0x4e71('0x36')]=qs['sort'](_0x4f8af5[_0x4e71('0x2e')][_0x4e71('0x37')]);_0x3228a0['where']=qs[_0x4e71('0x30')](_[_0x4e71('0x38')](_0x4f8af5[_0x4e71('0x2e')],_0x594b2c[_0x4e71('0x30')]),_0x3a8137);if(_0x4f8af5[_0x4e71('0x2e')][_0x4e71('0x39')]){_0x3228a0[_0x4e71('0x3a')]=_[_0x4e71('0x3b')](_0x3228a0['where'],{'$or':_[_0x4e71('0x28')](_0x3a8137,function(_0x38c4a9){if(_0x38c4a9[_0x4e71('0x3c')]!==_0x4e71('0x3d')){var _0x1da4e9={};_0x1da4e9[_0x38c4a9[_0x4e71('0x2d')]]={'$like':'%'+_0x4f8af5[_0x4e71('0x2e')][_0x4e71('0x39')]+'%'};return _0x1da4e9;}})});}_0x3228a0=_[_0x4e71('0x3b')]({},_0x3228a0,_0x4f8af5[_0x4e71('0x3e')]);var _0x1c3985={'where':_0x3228a0[_0x4e71('0x3a')]};return db[_0x4e71('0x29')][_0x4e71('0x3f')](_0x1c3985)[_0x4e71('0x24')](function(_0x436d2e){_0x2122ae[_0x4e71('0x3f')]=_0x436d2e;if(_0x4f8af5['query']['includeAll']){_0x3228a0[_0x4e71('0x40')]=[{'all':!![]}];}return db[_0x4e71('0x29')]['findAll'](_0x3228a0);})['then'](function(_0x58a4a5){_0x2122ae[_0x4e71('0x41')]=_0x58a4a5;return _0x2122ae;})[_0x4e71('0x24')](respondWithFilteredResult(_0x47d484,_0x3228a0))[_0x4e71('0x42')](handleError(_0x47d484,null));};exports['show']=function(_0x57f46f,_0x362d46){var _0x21d61f={'raw':!![],'where':{'id':_0x57f46f[_0x4e71('0x43')]['id']}},_0x4cc5fb={};_0x4cc5fb[_0x4e71('0x32')]=_[_0x4e71('0x2f')](db[_0x4e71('0x29')][_0x4e71('0x2a')]);_0x4cc5fb[_0x4e71('0x2e')]=_[_0x4e71('0x2f')](_0x57f46f[_0x4e71('0x2e')]);_0x4cc5fb['filters']=_[_0x4e71('0x31')](_0x4cc5fb[_0x4e71('0x32')],_0x4cc5fb[_0x4e71('0x2e')]);_0x21d61f['attributes']=_['intersection'](_0x4cc5fb[_0x4e71('0x32')],qs[_0x4e71('0x44')](_0x57f46f['query']['fields']));_0x21d61f[_0x4e71('0x33')]=_0x21d61f['attributes'][_0x4e71('0x34')]?_0x21d61f[_0x4e71('0x33')]:_0x4cc5fb[_0x4e71('0x32')];if(_0x57f46f[_0x4e71('0x2e')][_0x4e71('0x45')]){_0x21d61f['include']=[{'all':!![]}];}_0x21d61f=_[_0x4e71('0x3b')]({},_0x21d61f,_0x57f46f['options']);return db[_0x4e71('0x29')][_0x4e71('0x46')](_0x21d61f)['then'](handleEntityNotFound(_0x362d46,null))['then'](respondWithResult(_0x362d46,null))[_0x4e71('0x42')](handleError(_0x362d46,null));};exports['create']=function(_0x553809,_0x2e05a4){return db[_0x4e71('0x29')]['create'](_0x553809[_0x4e71('0x47')],{})['then'](respondWithResult(_0x2e05a4,0xc9))[_0x4e71('0x42')](handleError(_0x2e05a4,null));};exports['update']=function(_0x160886,_0x17f3a9){if(_0x160886[_0x4e71('0x47')]['id']){delete _0x160886[_0x4e71('0x47')]['id'];}return db[_0x4e71('0x29')]['find']({'where':{'id':_0x160886[_0x4e71('0x43')]['id']}})[_0x4e71('0x24')](handleEntityNotFound(_0x17f3a9,null))[_0x4e71('0x24')](saveUpdates(_0x160886['body'],null))[_0x4e71('0x24')](respondWithResult(_0x17f3a9,null))['catch'](handleError(_0x17f3a9,null));};exports[_0x4e71('0x23')]=function(_0x3af2f2,_0x5629e1){return db[_0x4e71('0x29')]['find']({'where':{'id':_0x3af2f2[_0x4e71('0x43')]['id']}})[_0x4e71('0x24')](handleEntityNotFound(_0x5629e1,null))[_0x4e71('0x24')](removeEntity(_0x5629e1,null))['catch'](handleError(_0x5629e1,null));};exports[_0x4e71('0x48')]=function(_0x235006,_0xe6a84d){return db[_0x4e71('0x29')][_0x4e71('0x48')]()[_0x4e71('0x24')](respondWithResult(_0xe6a84d,null))[_0x4e71('0x42')](handleError(_0xe6a84d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b6d50b6..60adf0f 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 _0x5d3a=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','moment'];(function(_0x104275,_0x26df62){var _0x36ec39=function(_0x52454b){while(--_0x52454b){_0x104275['push'](_0x104275['shift']());}};_0x36ec39(++_0x26df62);}(_0x5d3a,0x11e));var _0xa5d3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5d3a[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0xa5d3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa5d3('0x1'));var BPromise=require('bluebird');var rp=require(_0xa5d3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5d3('0x3'));var config=require(_0xa5d3('0x4'));var attributes=require(_0xa5d3('0x5'));module[_0xa5d3('0x6')]=function(_0x224d80,_0x5092d5){return _0x224d80['define'](_0xa5d3('0x7'),attributes,{'tableName':_0xa5d3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ee=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api'];(function(_0x557741,_0x43d009){var _0x4cd544=function(_0xde56cc){while(--_0xde56cc){_0x557741['push'](_0x557741['shift']());}};_0x4cd544(++_0x43d009);}(_0x44ee,0x1e7));var _0xe44e=function(_0x4a31fe,_0x3fe820){_0x4a31fe=_0x4a31fe-0x0;var _0x357444=_0x44ee[_0x4a31fe];return _0x357444;};'use strict';var _=require(_0xe44e('0x0'));var util=require(_0xe44e('0x1'));var logger=require('../../config/logger')(_0xe44e('0x2'));var moment=require(_0xe44e('0x3'));var BPromise=require(_0xe44e('0x4'));var rp=require(_0xe44e('0x5'));var fs=require('fs');var path=require(_0xe44e('0x6'));var rimraf=require(_0xe44e('0x7'));var config=require(_0xe44e('0x8'));var attributes=require(_0xe44e('0x9'));module[_0xe44e('0xa')]=function(_0x402e8d,_0x156d1a){return _0x402e8d[_0xe44e('0xb')](_0xe44e('0xc'),attributes,{'tableName':_0xe44e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index b7d5ed3..68b3be0 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 _0x1040=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x381899,_0x1a0bc8){var _0xc50f6=function(_0x4c6f7a){while(--_0x4c6f7a){_0x381899['push'](_0x381899['shift']());}};_0xc50f6(++_0x1a0bc8);}(_0x1040,0x9a));var _0x0104=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x1040[_0x3d5f84];return _0x1981b8;};'use strict';var _=require(_0x0104('0x0'));var util=require(_0x0104('0x1'));var moment=require(_0x0104('0x2'));var BPromise=require('bluebird');var rs=require(_0x0104('0x3'));var fs=require('fs');var Redis=require(_0x0104('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0104('0x5'));var logger=require(_0x0104('0x6'))('rpc');var config=require(_0x0104('0x7'));var jayson=require(_0x0104('0x8'));var client=jayson[_0x0104('0x9')][_0x0104('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a5283,_0x342a16,_0x43b2d1){return new BPromise(function(_0x3b916a,_0x406aa3){return client[_0x0104('0xb')](_0x5a5283,_0x43b2d1)[_0x0104('0xc')](function(_0x45e703){logger[_0x0104('0xd')](_0x0104('0xe'),_0x342a16,_0x0104('0xf'));logger[_0x0104('0x10')](_0x0104('0x11'),_0x342a16,_0x0104('0xf'),JSON['stringify'](_0x45e703));if(_0x45e703['error']){if(_0x45e703['error']['code']===0x1f4){logger[_0x0104('0x12')](_0x0104('0xe'),_0x342a16,_0x45e703[_0x0104('0x12')][_0x0104('0x13')]);return _0x406aa3(_0x45e703['error'][_0x0104('0x13')]);}logger['error'](_0x0104('0xe'),_0x342a16,_0x45e703[_0x0104('0x12')]['message']);return _0x3b916a(_0x45e703[_0x0104('0x12')]['message']);}else{logger[_0x0104('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x342a16,_0x0104('0xf'));_0x3b916a(_0x45e703['result'][_0x0104('0x13')]);}})[_0x0104('0x14')](function(_0xdc613d){logger[_0x0104('0x12')](_0x0104('0xe'),_0x342a16,_0xdc613d);_0x406aa3(_0xdc613d);});});} \ No newline at end of file +var _0xe1ec=['client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x12aa79,_0x4c8030){var _0x34ca78=function(_0x30e97f){while(--_0x30e97f){_0x12aa79['push'](_0x12aa79['shift']());}};_0x34ca78(++_0x4c8030);}(_0xe1ec,0xa7));var _0xce1e=function(_0x3e8160,_0x426bc6){_0x3e8160=_0x3e8160-0x0;var _0x46873f=_0xe1ec[_0x3e8160];return _0x46873f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce1e('0x0'));var BPromise=require(_0xce1e('0x1'));var rs=require(_0xce1e('0x2'));var fs=require('fs');var Redis=require(_0xce1e('0x3'));var db=require(_0xce1e('0x4'))['db'];var utils=require(_0xce1e('0x5'));var logger=require(_0xce1e('0x6'))(_0xce1e('0x7'));var config=require('../../config/environment');var jayson=require(_0xce1e('0x8'));var client=jayson[_0xce1e('0x9')][_0xce1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c6b70,_0x2e5124,_0x504697){return new BPromise(function(_0x41efeb,_0xc6d0bb){return client[_0xce1e('0xb')](_0x5c6b70,_0x504697)['then'](function(_0x52ee4f){logger['info'](_0xce1e('0xc'),_0x2e5124,_0xce1e('0xd'));logger['debug'](_0xce1e('0xe'),_0x2e5124,_0xce1e('0xd'),JSON[_0xce1e('0xf')](_0x52ee4f));if(_0x52ee4f[_0xce1e('0x10')]){if(_0x52ee4f[_0xce1e('0x10')][_0xce1e('0x11')]===0x1f4){logger[_0xce1e('0x10')](_0xce1e('0xc'),_0x2e5124,_0x52ee4f[_0xce1e('0x10')][_0xce1e('0x12')]);return _0xc6d0bb(_0x52ee4f['error']['message']);}logger[_0xce1e('0x10')](_0xce1e('0xc'),_0x2e5124,_0x52ee4f[_0xce1e('0x10')][_0xce1e('0x12')]);return _0x41efeb(_0x52ee4f['error'][_0xce1e('0x12')]);}else{logger[_0xce1e('0x13')](_0xce1e('0xc'),_0x2e5124,_0xce1e('0xd'));_0x41efeb(_0x52ee4f[_0xce1e('0x14')][_0xce1e('0x12')]);}})[_0xce1e('0x15')](function(_0x359955){logger[_0xce1e('0x10')](_0xce1e('0xc'),_0x2e5124,_0x359955);_0xc6d0bb(_0x359955);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 79af33a..243fd73 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 _0x9589=['index','/describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5097d6,_0x491b42){var _0x441f02=function(_0x5cc045){while(--_0x5cc045){_0x5097d6['push'](_0x5097d6['shift']());}};_0x441f02(++_0x491b42);}(_0x9589,0xbc));var _0x9958=function(_0x24d7d2,_0x5bfd8c){_0x24d7d2=_0x24d7d2-0x0;var _0x242b90=_0x9589[_0x24d7d2];return _0x242b90;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var auth=require(_0x9958('0x5'));var interaction=require(_0x9958('0x6'));var config=require(_0x9958('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x9958('0x8')]('/',auth[_0x9958('0x9')](),controller[_0x9958('0xa')]);router[_0x9958('0x8')](_0x9958('0xb'),auth[_0x9958('0x9')](),controller['describe']);router[_0x9958('0x8')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0xd')]);router[_0x9958('0x8')](_0x9958('0xe'),auth[_0x9958('0x9')](),controller[_0x9958('0xf')]);router[_0x9958('0x10')]('/',auth[_0x9958('0x9')](),controller[_0x9958('0x11')]);router[_0x9958('0x12')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0x13')]);router[_0x9958('0x14')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller['destroy']);module[_0x9958('0x15')]=router; \ No newline at end of file +var _0xfa2b=['post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','show','/:id/questions','getQuestions'];(function(_0x567cf4,_0x58483e){var _0x2f632f=function(_0x39f487){while(--_0x39f487){_0x567cf4['push'](_0x567cf4['shift']());}};_0x2f632f(++_0x58483e);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x57d457,_0x26deaf){_0x57d457=_0x57d457-0x0;var _0xba22c=_0xfa2b[_0x57d457];return _0xba22c;};'use strict';var multer=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var path=require(_0xbfa2('0x2'));var timeout=require(_0xbfa2('0x3'));var express=require(_0xbfa2('0x4'));var router=express[_0xbfa2('0x5')]();var auth=require(_0xbfa2('0x6'));var interaction=require(_0xbfa2('0x7'));var config=require(_0xbfa2('0x8'));var controller=require(_0xbfa2('0x9'));router[_0xbfa2('0xa')]('/',auth[_0xbfa2('0xb')](),controller[_0xbfa2('0xc')]);router[_0xbfa2('0xa')](_0xbfa2('0xd'),auth[_0xbfa2('0xb')](),controller['describe']);router[_0xbfa2('0xa')]('/:id',auth[_0xbfa2('0xb')](),controller[_0xbfa2('0xe')]);router[_0xbfa2('0xa')](_0xbfa2('0xf'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x10')]);router[_0xbfa2('0x11')]('/',auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbfa2('0x13')]);router[_0xbfa2('0x14')](_0xbfa2('0x15'),auth[_0xbfa2('0xb')](),controller[_0xbfa2('0x16')]);module[_0xbfa2('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 95c3924..3c848ca 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 _0x60b5=['STRING','BOOLEAN','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x46e933,_0x3e6cf0){var _0x3a396b=function(_0xd88880){while(--_0xd88880){_0x46e933['push'](_0x46e933['shift']());}};_0x3a396b(++_0x3e6cf0);}(_0x60b5,0x161));var _0x560b=function(_0x1ae54a,_0x290259){_0x1ae54a=_0x1ae54a-0x0;var _0x3896d1=_0x60b5[_0x1ae54a];return _0x3896d1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x560b('0x0')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x2ff934){this[_0x560b('0x1')](_0x560b('0x2'),_0x2ff934);this[_0x560b('0x1')](_0x560b('0x3'),moment()[_0x560b('0x4')](_0x560b('0x5')));}},'endtime':{'type':Sequelize[_0x560b('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x560b('0x7')]},'queue':{'type':Sequelize[_0x560b('0x7')]},'uniqueid':{'type':Sequelize[_0x560b('0x7')]},'calleridname':{'type':Sequelize[_0x560b('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x560b('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x71f0=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime'];(function(_0x23da6b,_0x173cf1){var _0x5a9880=function(_0x1bcf3a){while(--_0x1bcf3a){_0x23da6b['push'](_0x23da6b['shift']());}};_0x5a9880(++_0x173cf1);}(_0x71f0,0x12b));var _0x071f=function(_0x5611a9,_0x460b05){_0x5611a9=_0x5611a9-0x0;var _0x483cd1=_0x71f0[_0x5611a9];return _0x483cd1;};'use strict';var moment=require(_0x071f('0x0'));var Sequelize=require(_0x071f('0x1'));module[_0x071f('0x2')]={'starttime':{'type':Sequelize[_0x071f('0x3')],'set':function(_0xd3015){this[_0x071f('0x4')](_0x071f('0x5'),_0xd3015);this[_0x071f('0x4')](_0x071f('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x071f('0x7')]},'queue':{'type':Sequelize[_0x071f('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x071f('0x7')]},'calleridnum':{'type':Sequelize[_0x071f('0x7')]},'completed':{'type':Sequelize[_0x071f('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index f98b1ca..5e4e96d 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 _0x5a64=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','index','map','JscriptySessionReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','findOne','rawAttributes','SessionId','JscriptyQuestionReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x480f34,_0x2f37df){var _0x245d27=function(_0x5e5b9e){while(--_0x5e5b9e){_0x480f34['push'](_0x480f34['shift']());}};_0x245d27(++_0x2f37df);}(_0x5a64,0x8c));var _0x45a6=function(_0x5631ca,_0x4d1bf1){_0x5631ca=_0x5631ca-0x0;var _0x21a62a=_0x5a64[_0x5631ca];return _0x21a62a;};'use strict';var pdf=require(_0x45a6('0x0'));var emlformat=require(_0x45a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x45a6('0x2'));var jsonpatch=require(_0x45a6('0x3'));var rp=require(_0x45a6('0x4'));var moment=require(_0x45a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x45a6('0x6'));var util=require(_0x45a6('0x7'));var path=require(_0x45a6('0x8'));var sox=require(_0x45a6('0x9'));var csv=require(_0x45a6('0xa'));var ejs=require(_0x45a6('0xb'));var fs=require('fs');var _=require(_0x45a6('0xc'));var squel=require('squel');var crypto=require(_0x45a6('0xd'));var jsforce=require(_0x45a6('0xe'));var deskjs=require(_0x45a6('0xf'));var toCsv=require(_0x45a6('0xa'));var querystring=require('querystring');var Papa=require(_0x45a6('0x10'));var Redis=require(_0x45a6('0x11'));var authService=require(_0x45a6('0x12'));var qs=require(_0x45a6('0x13'));var as=require(_0x45a6('0x14'));var hardwareService=require(_0x45a6('0x15'));var logger=require(_0x45a6('0x16'))(_0x45a6('0x17'));var utils=require(_0x45a6('0x18'));var config=require(_0x45a6('0x19'));var db=require(_0x45a6('0x1a'))['db'];function respondWithStatusCode(_0x2c4db9,_0x2e85a4){_0x2e85a4=_0x2e85a4||0xcc;return function(_0x226ecf){if(_0x226ecf){return _0x2c4db9[_0x45a6('0x1b')](_0x2e85a4);}return _0x2c4db9[_0x45a6('0x1c')](_0x2e85a4)['end']();};}function respondWithResult(_0x54f841,_0x5f5a0e){_0x5f5a0e=_0x5f5a0e||0xc8;return function(_0x21a8bd){if(_0x21a8bd){return _0x54f841[_0x45a6('0x1c')](_0x5f5a0e)[_0x45a6('0x1d')](_0x21a8bd);}};}function respondWithFilteredResult(_0x326524,_0x156dbd){return function(_0x317119){if(_0x317119){var _0x489d37=_0x317119[_0x45a6('0x1e')],_0xd02632=_0x156dbd[_0x45a6('0x1f')],_0x19a0d4=_0x156dbd[_0x45a6('0x1f')]+_0x156dbd[_0x45a6('0x20')],_0x4b829f;if(_0x19a0d4>=_0x489d37){_0x19a0d4=_0x489d37;_0x4b829f=0xc8;}else{_0x4b829f=0xce;}_0x326524[_0x45a6('0x1c')](_0x4b829f);return _0x326524[_0x45a6('0x21')](_0x45a6('0x22'),_0xd02632+'-'+_0x19a0d4+'/'+_0x489d37)[_0x45a6('0x1d')](_0x317119);}return null;};}function patchUpdates(_0x36cb5c){return function(_0x568e88){try{jsonpatch[_0x45a6('0x23')](_0x568e88,_0x36cb5c,!![]);}catch(_0x4a3b4e){return BPromise[_0x45a6('0x24')](_0x4a3b4e);}return _0x568e88['save']();};}function saveUpdates(_0x3f1e64,_0x43d034){return function(_0x115dc3){if(_0x115dc3){return _0x115dc3[_0x45a6('0x25')](_0x3f1e64)['then'](function(_0x1acdfc){return _0x1acdfc;});}return null;};}function removeEntity(_0x7cc8a6,_0x32ff4f){return function(_0x222ce9){if(_0x222ce9){return _0x222ce9[_0x45a6('0x26')]()[_0x45a6('0x27')](function(){_0x7cc8a6[_0x45a6('0x1c')](0xcc)[_0x45a6('0x28')]();});}};}function handleEntityNotFound(_0x5cefa9,_0x3137f2){return function(_0x26ef28){if(!_0x26ef28){_0x5cefa9[_0x45a6('0x1b')](0x194);}return _0x26ef28;};}function handleError(_0x408afb,_0x4bfc69){_0x4bfc69=_0x4bfc69||0x1f4;return function(_0x37cafa){logger[_0x45a6('0x29')](_0x37cafa[_0x45a6('0x2a')]);if(_0x37cafa[_0x45a6('0x2b')]){delete _0x37cafa[_0x45a6('0x2b')];}_0x408afb[_0x45a6('0x1c')](_0x4bfc69)['send'](_0x37cafa);};}exports[_0x45a6('0x2c')]=function(_0x473cd5,_0x15db8e){var _0x569690={},_0x1c419e={},_0x59abf7={'count':0x0,'rows':[]};var _0x512044=_[_0x45a6('0x2d')](db[_0x45a6('0x2e')]['rawAttributes'],function(_0x239a7c){return{'name':_0x239a7c['fieldName'],'type':_0x239a7c[_0x45a6('0x2f')][_0x45a6('0x30')]};});_0x1c419e[_0x45a6('0x31')]=_[_0x45a6('0x2d')](_0x512044,_0x45a6('0x2b'));_0x1c419e[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x473cd5['query']);_0x1c419e[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x1c419e['model'],_0x1c419e['query']);_0x569690[_0x45a6('0x36')]=_[_0x45a6('0x35')](_0x1c419e[_0x45a6('0x31')],qs[_0x45a6('0x37')](_0x473cd5[_0x45a6('0x32')][_0x45a6('0x37')]));_0x569690[_0x45a6('0x36')]=_0x569690[_0x45a6('0x36')][_0x45a6('0x38')]?_0x569690[_0x45a6('0x36')]:_0x1c419e[_0x45a6('0x31')];if(!_0x473cd5[_0x45a6('0x32')][_0x45a6('0x39')](_0x45a6('0x3a'))){_0x569690[_0x45a6('0x20')]=qs[_0x45a6('0x20')](_0x473cd5[_0x45a6('0x32')][_0x45a6('0x20')]);_0x569690[_0x45a6('0x1f')]=qs['offset'](_0x473cd5[_0x45a6('0x32')][_0x45a6('0x1f')]);}_0x569690[_0x45a6('0x3b')]=qs[_0x45a6('0x3c')](_0x473cd5[_0x45a6('0x32')][_0x45a6('0x3c')]);_0x569690['where']=qs[_0x45a6('0x34')](_[_0x45a6('0x3d')](_0x473cd5['query'],_0x1c419e['filters']),_0x512044);if(_0x473cd5[_0x45a6('0x32')][_0x45a6('0x3e')]){_0x569690[_0x45a6('0x3f')]=_['merge'](_0x569690['where'],{'$or':_[_0x45a6('0x2d')](_0x512044,function(_0x22680c){if(_0x22680c[_0x45a6('0x2f')]!=='VIRTUAL'){var _0x2ea44c={};_0x2ea44c[_0x22680c['name']]={'$like':'%'+_0x473cd5[_0x45a6('0x32')]['filter']+'%'};return _0x2ea44c;}})});}_0x569690=_[_0x45a6('0x40')]({},_0x569690,_0x473cd5[_0x45a6('0x41')]);var _0x3b8879={'where':_0x569690[_0x45a6('0x3f')]};return db['JscriptySessionReport']['count'](_0x3b8879)[_0x45a6('0x27')](function(_0x2b3970){_0x59abf7[_0x45a6('0x1e')]=_0x2b3970;if(_0x473cd5['query'][_0x45a6('0x42')]){_0x569690[_0x45a6('0x43')]=[{'all':!![]}];}return db[_0x45a6('0x2e')][_0x45a6('0x44')](_0x569690);})[_0x45a6('0x27')](function(_0x53ba46){_0x59abf7[_0x45a6('0x45')]=_0x53ba46;return _0x59abf7;})[_0x45a6('0x27')](respondWithFilteredResult(_0x15db8e,_0x569690))['catch'](handleError(_0x15db8e,null));};exports['show']=function(_0x2f456f,_0x3c8ede){var _0x40cfb3={'raw':!![],'where':{'id':_0x2f456f[_0x45a6('0x46')]['id']}},_0xec0eb9={};_0xec0eb9[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x2e')]['rawAttributes']);_0xec0eb9[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x2f456f[_0x45a6('0x32')]);_0xec0eb9['filters']=_[_0x45a6('0x35')](_0xec0eb9[_0x45a6('0x31')],_0xec0eb9[_0x45a6('0x32')]);_0x40cfb3[_0x45a6('0x36')]=_[_0x45a6('0x35')](_0xec0eb9[_0x45a6('0x31')],qs['fields'](_0x2f456f['query']['fields']));_0x40cfb3[_0x45a6('0x36')]=_0x40cfb3['attributes']['length']?_0x40cfb3[_0x45a6('0x36')]:_0xec0eb9[_0x45a6('0x31')];if(_0x2f456f[_0x45a6('0x32')][_0x45a6('0x42')]){_0x40cfb3[_0x45a6('0x43')]=[{'all':!![]}];}_0x40cfb3=_['merge']({},_0x40cfb3,_0x2f456f[_0x45a6('0x41')]);return db['JscriptySessionReport'][_0x45a6('0x47')](_0x40cfb3)[_0x45a6('0x27')](handleEntityNotFound(_0x3c8ede,null))[_0x45a6('0x27')](respondWithResult(_0x3c8ede,null))[_0x45a6('0x48')](handleError(_0x3c8ede,null));};exports[_0x45a6('0x49')]=function(_0x5e8102,_0x160a27){return db[_0x45a6('0x2e')][_0x45a6('0x49')](_0x5e8102[_0x45a6('0x4a')],{})['then'](respondWithResult(_0x160a27,0xc9))[_0x45a6('0x48')](handleError(_0x160a27,null));};exports[_0x45a6('0x25')]=function(_0x123b84,_0x1c6ea2){if(_0x123b84[_0x45a6('0x4a')]['id']){delete _0x123b84[_0x45a6('0x4a')]['id'];}return db['JscriptySessionReport'][_0x45a6('0x47')]({'where':{'id':_0x123b84[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c6ea2,null))[_0x45a6('0x27')](saveUpdates(_0x123b84[_0x45a6('0x4a')],null))[_0x45a6('0x27')](respondWithResult(_0x1c6ea2,null))['catch'](handleError(_0x1c6ea2,null));};exports[_0x45a6('0x26')]=function(_0x45c1ed,_0xe14a21){return db[_0x45a6('0x2e')]['find']({'where':{'id':_0x45c1ed[_0x45a6('0x46')]['id']}})[_0x45a6('0x27')](handleEntityNotFound(_0xe14a21,null))['then'](removeEntity(_0xe14a21,null))[_0x45a6('0x48')](handleError(_0xe14a21,null));};exports[_0x45a6('0x4b')]=function(_0x567050,_0xd1004){return db[_0x45a6('0x2e')]['describe']()[_0x45a6('0x27')](respondWithResult(_0xd1004,null))[_0x45a6('0x48')](handleError(_0xd1004,null));};exports['getQuestions']=function(_0x26b407,_0x155e5e,_0x22728a){var _0x8e0c08={'raw':!![],'where':{}};var _0x837be0={};var _0x4cdb31={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x45a6('0x4c')]({'where':{'id':_0x26b407[_0x45a6('0x46')]['id']}})[_0x45a6('0x27')](handleEntityNotFound(_0x155e5e,null))[_0x45a6('0x27')](function(_0x33790a){if(_0x33790a){_0x837be0['model']=_[_0x45a6('0x33')](db['JscriptyQuestionReport'][_0x45a6('0x4d')]);_0x837be0[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x26b407[_0x45a6('0x32')]);_0x837be0[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x837be0[_0x45a6('0x31')],_0x837be0[_0x45a6('0x32')]);_0x8e0c08[_0x45a6('0x36')]=_[_0x45a6('0x35')](_0x837be0[_0x45a6('0x31')],qs[_0x45a6('0x37')](_0x26b407[_0x45a6('0x32')][_0x45a6('0x37')]));_0x8e0c08['attributes']=_0x8e0c08[_0x45a6('0x36')][_0x45a6('0x38')]?_0x8e0c08[_0x45a6('0x36')]:_0x837be0[_0x45a6('0x31')];if(!_0x26b407[_0x45a6('0x32')][_0x45a6('0x39')](_0x45a6('0x3a'))){_0x8e0c08['limit']=qs[_0x45a6('0x20')](_0x26b407[_0x45a6('0x32')]['limit']);_0x8e0c08[_0x45a6('0x1f')]=qs[_0x45a6('0x1f')](_0x26b407[_0x45a6('0x32')][_0x45a6('0x1f')]);}_0x8e0c08[_0x45a6('0x3b')]=qs[_0x45a6('0x3c')](_0x26b407['query'][_0x45a6('0x3c')]);_0x8e0c08[_0x45a6('0x3f')]=qs['filters'](_[_0x45a6('0x3d')](_0x26b407[_0x45a6('0x32')],_0x837be0[_0x45a6('0x34')]));_0x8e0c08['where'][_0x45a6('0x4e')]=_0x33790a['id'];if(_0x26b407[_0x45a6('0x32')][_0x45a6('0x3e')]){_0x8e0c08[_0x45a6('0x3f')]=_[_0x45a6('0x40')](_0x8e0c08[_0x45a6('0x3f')],{'$or':_['map'](_0x8e0c08[_0x45a6('0x36')],function(_0x472310){var _0x4b5130={};_0x4b5130[_0x472310]={'$like':'%'+_0x26b407[_0x45a6('0x32')][_0x45a6('0x3e')]+'%'};return _0x4b5130;})});}_0x8e0c08=_[_0x45a6('0x40')]({},_0x8e0c08,_0x26b407['options']);return db[_0x45a6('0x4f')][_0x45a6('0x1e')]({'where':_0x8e0c08[_0x45a6('0x3f')]})['then'](function(_0x75a47d){_0x4cdb31[_0x45a6('0x1e')]=_0x75a47d;if(_0x26b407['query']['includeAll']){_0x8e0c08['include']=[{'all':!![]}];}return db[_0x45a6('0x4f')][_0x45a6('0x44')](_0x8e0c08);})[_0x45a6('0x27')](function(_0xfec664){_0x4cdb31[_0x45a6('0x45')]=_0xfec664;return _0x4cdb31;});}})[_0x45a6('0x27')](respondWithFilteredResult(_0x155e5e,_0x8e0c08))[_0x45a6('0x48')](handleError(_0x155e5e,null));}; \ No newline at end of file +var _0xa985=['name','JscriptySessionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','limit','order','where','merge','filter','includeAll','findAll','rows','catch','params','fields','include','options','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','sort','pick','SessionId','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0xf5ec57,_0x6b1180){var _0xaa0598=function(_0x2440c9){while(--_0x2440c9){_0xf5ec57['push'](_0xf5ec57['shift']());}};_0xaa0598(++_0x6b1180);}(_0xa985,0x105));var _0x5a98=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xa985[_0x599e60];return _0x468e19;};'use strict';var pdf=require(_0x5a98('0x0'));var emlformat=require(_0x5a98('0x1'));var rimraf=require(_0x5a98('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a98('0x3'));var rp=require(_0x5a98('0x4'));var moment=require('moment');var BPromise=require(_0x5a98('0x5'));var Mustache=require(_0x5a98('0x6'));var util=require(_0x5a98('0x7'));var path=require('path');var sox=require(_0x5a98('0x8'));var csv=require('to-csv');var ejs=require(_0x5a98('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a98('0xa'));var crypto=require(_0x5a98('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5a98('0xc'));var toCsv=require(_0x5a98('0xd'));var querystring=require(_0x5a98('0xe'));var Papa=require(_0x5a98('0xf'));var Redis=require('ioredis');var authService=require(_0x5a98('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a98('0x11'));var hardwareService=require(_0x5a98('0x12'));var logger=require('../../config/logger')(_0x5a98('0x13'));var utils=require('../../config/utils');var config=require(_0x5a98('0x14'));var db=require(_0x5a98('0x15'))['db'];function respondWithStatusCode(_0x5db1ad,_0x3ffc5e){_0x3ffc5e=_0x3ffc5e||0xcc;return function(_0x2b1113){if(_0x2b1113){return _0x5db1ad[_0x5a98('0x16')](_0x3ffc5e);}return _0x5db1ad[_0x5a98('0x17')](_0x3ffc5e)[_0x5a98('0x18')]();};}function respondWithResult(_0xce6a8a,_0x3850d9){_0x3850d9=_0x3850d9||0xc8;return function(_0x5ae1f5){if(_0x5ae1f5){return _0xce6a8a['status'](_0x3850d9)['json'](_0x5ae1f5);}};}function respondWithFilteredResult(_0x4c3a3e,_0x4424aa){return function(_0x3a660f){if(_0x3a660f){var _0x5206e8=_0x3a660f[_0x5a98('0x19')],_0x2882b1=_0x4424aa['offset'],_0x2c8cf8=_0x4424aa[_0x5a98('0x1a')]+_0x4424aa['limit'],_0x44fe60;if(_0x2c8cf8>=_0x5206e8){_0x2c8cf8=_0x5206e8;_0x44fe60=0xc8;}else{_0x44fe60=0xce;}_0x4c3a3e[_0x5a98('0x17')](_0x44fe60);return _0x4c3a3e[_0x5a98('0x1b')](_0x5a98('0x1c'),_0x2882b1+'-'+_0x2c8cf8+'/'+_0x5206e8)['json'](_0x3a660f);}return null;};}function patchUpdates(_0x322a70){return function(_0x2eea9a){try{jsonpatch[_0x5a98('0x1d')](_0x2eea9a,_0x322a70,!![]);}catch(_0x244c70){return BPromise[_0x5a98('0x1e')](_0x244c70);}return _0x2eea9a[_0x5a98('0x1f')]();};}function saveUpdates(_0x5b4d0b,_0x1be507){return function(_0x926711){if(_0x926711){return _0x926711['update'](_0x5b4d0b)[_0x5a98('0x20')](function(_0x389d41){return _0x389d41;});}return null;};}function removeEntity(_0x287d70,_0x2a3ecf){return function(_0xbb7ad6){if(_0xbb7ad6){return _0xbb7ad6['destroy']()[_0x5a98('0x20')](function(){_0x287d70[_0x5a98('0x17')](0xcc)[_0x5a98('0x18')]();});}};}function handleEntityNotFound(_0x45d7a7,_0x28010a){return function(_0x4423a7){if(!_0x4423a7){_0x45d7a7[_0x5a98('0x16')](0x194);}return _0x4423a7;};}function handleError(_0x29e3de,_0x32f40e){_0x32f40e=_0x32f40e||0x1f4;return function(_0x13beeb){logger[_0x5a98('0x21')](_0x13beeb[_0x5a98('0x22')]);if(_0x13beeb['name']){delete _0x13beeb[_0x5a98('0x23')];}_0x29e3de[_0x5a98('0x17')](_0x32f40e)['send'](_0x13beeb);};}exports['index']=function(_0x1a43b8,_0x1ffaed){var _0x31a005={},_0x5c45ea={},_0x33534f={'count':0x0,'rows':[]};var _0x501dcb=_['map'](db[_0x5a98('0x24')][_0x5a98('0x25')],function(_0x869ab6){return{'name':_0x869ab6[_0x5a98('0x26')],'type':_0x869ab6['type'][_0x5a98('0x27')]};});_0x5c45ea[_0x5a98('0x28')]=_[_0x5a98('0x29')](_0x501dcb,_0x5a98('0x23'));_0x5c45ea[_0x5a98('0x2a')]=_[_0x5a98('0x2b')](_0x1a43b8[_0x5a98('0x2a')]);_0x5c45ea[_0x5a98('0x2c')]=_[_0x5a98('0x2d')](_0x5c45ea[_0x5a98('0x28')],_0x5c45ea[_0x5a98('0x2a')]);_0x31a005[_0x5a98('0x2e')]=_['intersection'](_0x5c45ea['model'],qs['fields'](_0x1a43b8[_0x5a98('0x2a')]['fields']));_0x31a005['attributes']=_0x31a005['attributes'][_0x5a98('0x2f')]?_0x31a005[_0x5a98('0x2e')]:_0x5c45ea[_0x5a98('0x28')];if(!_0x1a43b8[_0x5a98('0x2a')]['hasOwnProperty'](_0x5a98('0x30'))){_0x31a005[_0x5a98('0x31')]=qs['limit'](_0x1a43b8[_0x5a98('0x2a')]['limit']);_0x31a005[_0x5a98('0x1a')]=qs[_0x5a98('0x1a')](_0x1a43b8[_0x5a98('0x2a')][_0x5a98('0x1a')]);}_0x31a005[_0x5a98('0x32')]=qs['sort'](_0x1a43b8[_0x5a98('0x2a')]['sort']);_0x31a005[_0x5a98('0x33')]=qs[_0x5a98('0x2c')](_['pick'](_0x1a43b8[_0x5a98('0x2a')],_0x5c45ea[_0x5a98('0x2c')]),_0x501dcb);if(_0x1a43b8[_0x5a98('0x2a')]['filter']){_0x31a005[_0x5a98('0x33')]=_[_0x5a98('0x34')](_0x31a005[_0x5a98('0x33')],{'$or':_['map'](_0x501dcb,function(_0x49e20b){if(_0x49e20b['type']!=='VIRTUAL'){var _0xffead2={};_0xffead2[_0x49e20b[_0x5a98('0x23')]]={'$like':'%'+_0x1a43b8[_0x5a98('0x2a')][_0x5a98('0x35')]+'%'};return _0xffead2;}})});}_0x31a005=_['merge']({},_0x31a005,_0x1a43b8['options']);var _0x4edd8f={'where':_0x31a005[_0x5a98('0x33')]};return db['JscriptySessionReport'][_0x5a98('0x19')](_0x4edd8f)['then'](function(_0x2942aa){_0x33534f[_0x5a98('0x19')]=_0x2942aa;if(_0x1a43b8[_0x5a98('0x2a')][_0x5a98('0x36')]){_0x31a005['include']=[{'all':!![]}];}return db[_0x5a98('0x24')][_0x5a98('0x37')](_0x31a005);})['then'](function(_0x4e3bcf){_0x33534f[_0x5a98('0x38')]=_0x4e3bcf;return _0x33534f;})[_0x5a98('0x20')](respondWithFilteredResult(_0x1ffaed,_0x31a005))[_0x5a98('0x39')](handleError(_0x1ffaed,null));};exports['show']=function(_0x38833b,_0x12bf4b){var _0x17303b={'raw':!![],'where':{'id':_0x38833b[_0x5a98('0x3a')]['id']}},_0x3f5f9d={};_0x3f5f9d[_0x5a98('0x28')]=_[_0x5a98('0x2b')](db[_0x5a98('0x24')]['rawAttributes']);_0x3f5f9d['query']=_[_0x5a98('0x2b')](_0x38833b[_0x5a98('0x2a')]);_0x3f5f9d[_0x5a98('0x2c')]=_[_0x5a98('0x2d')](_0x3f5f9d[_0x5a98('0x28')],_0x3f5f9d[_0x5a98('0x2a')]);_0x17303b[_0x5a98('0x2e')]=_[_0x5a98('0x2d')](_0x3f5f9d['model'],qs[_0x5a98('0x3b')](_0x38833b['query'][_0x5a98('0x3b')]));_0x17303b[_0x5a98('0x2e')]=_0x17303b[_0x5a98('0x2e')]['length']?_0x17303b[_0x5a98('0x2e')]:_0x3f5f9d['model'];if(_0x38833b[_0x5a98('0x2a')][_0x5a98('0x36')]){_0x17303b[_0x5a98('0x3c')]=[{'all':!![]}];}_0x17303b=_[_0x5a98('0x34')]({},_0x17303b,_0x38833b[_0x5a98('0x3d')]);return db[_0x5a98('0x24')][_0x5a98('0x3e')](_0x17303b)[_0x5a98('0x20')](handleEntityNotFound(_0x12bf4b,null))[_0x5a98('0x20')](respondWithResult(_0x12bf4b,null))['catch'](handleError(_0x12bf4b,null));};exports[_0x5a98('0x3f')]=function(_0xbcf40e,_0x4981c7){return db[_0x5a98('0x24')][_0x5a98('0x3f')](_0xbcf40e[_0x5a98('0x40')],{})[_0x5a98('0x20')](respondWithResult(_0x4981c7,0xc9))[_0x5a98('0x39')](handleError(_0x4981c7,null));};exports['update']=function(_0x2609e1,_0x51c453){if(_0x2609e1[_0x5a98('0x40')]['id']){delete _0x2609e1[_0x5a98('0x40')]['id'];}return db['JscriptySessionReport'][_0x5a98('0x3e')]({'where':{'id':_0x2609e1['params']['id']}})['then'](handleEntityNotFound(_0x51c453,null))[_0x5a98('0x20')](saveUpdates(_0x2609e1[_0x5a98('0x40')],null))[_0x5a98('0x20')](respondWithResult(_0x51c453,null))['catch'](handleError(_0x51c453,null));};exports[_0x5a98('0x41')]=function(_0x3adba4,_0x5b0177){return db[_0x5a98('0x24')][_0x5a98('0x3e')]({'where':{'id':_0x3adba4['params']['id']}})['then'](handleEntityNotFound(_0x5b0177,null))[_0x5a98('0x20')](removeEntity(_0x5b0177,null))['catch'](handleError(_0x5b0177,null));};exports['describe']=function(_0x10deaa,_0x8861ae){return db[_0x5a98('0x24')][_0x5a98('0x42')]()[_0x5a98('0x20')](respondWithResult(_0x8861ae,null))['catch'](handleError(_0x8861ae,null));};exports[_0x5a98('0x43')]=function(_0x12bd6c,_0x35d9e9,_0xcd2423){var _0x5a2e03={'raw':!![],'where':{}};var _0x2b2736={};var _0x649fde={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x5a98('0x44')]({'where':{'id':_0x12bd6c['params']['id']}})[_0x5a98('0x20')](handleEntityNotFound(_0x35d9e9,null))[_0x5a98('0x20')](function(_0xcece02){if(_0xcece02){_0x2b2736[_0x5a98('0x28')]=_['keys'](db[_0x5a98('0x45')][_0x5a98('0x25')]);_0x2b2736['query']=_[_0x5a98('0x2b')](_0x12bd6c[_0x5a98('0x2a')]);_0x2b2736[_0x5a98('0x2c')]=_[_0x5a98('0x2d')](_0x2b2736[_0x5a98('0x28')],_0x2b2736[_0x5a98('0x2a')]);_0x5a2e03[_0x5a98('0x2e')]=_['intersection'](_0x2b2736[_0x5a98('0x28')],qs[_0x5a98('0x3b')](_0x12bd6c['query'][_0x5a98('0x3b')]));_0x5a2e03[_0x5a98('0x2e')]=_0x5a2e03['attributes'][_0x5a98('0x2f')]?_0x5a2e03[_0x5a98('0x2e')]:_0x2b2736[_0x5a98('0x28')];if(!_0x12bd6c[_0x5a98('0x2a')][_0x5a98('0x46')](_0x5a98('0x30'))){_0x5a2e03[_0x5a98('0x31')]=qs[_0x5a98('0x31')](_0x12bd6c[_0x5a98('0x2a')][_0x5a98('0x31')]);_0x5a2e03[_0x5a98('0x1a')]=qs[_0x5a98('0x1a')](_0x12bd6c[_0x5a98('0x2a')]['offset']);}_0x5a2e03['order']=qs[_0x5a98('0x47')](_0x12bd6c[_0x5a98('0x2a')][_0x5a98('0x47')]);_0x5a2e03[_0x5a98('0x33')]=qs['filters'](_[_0x5a98('0x48')](_0x12bd6c['query'],_0x2b2736[_0x5a98('0x2c')]));_0x5a2e03['where'][_0x5a98('0x49')]=_0xcece02['id'];if(_0x12bd6c['query'][_0x5a98('0x35')]){_0x5a2e03[_0x5a98('0x33')]=_['merge'](_0x5a2e03[_0x5a98('0x33')],{'$or':_[_0x5a98('0x29')](_0x5a2e03[_0x5a98('0x2e')],function(_0x1515d3){var _0x34536d={};_0x34536d[_0x1515d3]={'$like':'%'+_0x12bd6c[_0x5a98('0x2a')]['filter']+'%'};return _0x34536d;})});}_0x5a2e03=_['merge']({},_0x5a2e03,_0x12bd6c['options']);return db[_0x5a98('0x45')]['count']({'where':_0x5a2e03[_0x5a98('0x33')]})[_0x5a98('0x20')](function(_0x279c66){_0x649fde[_0x5a98('0x19')]=_0x279c66;if(_0x12bd6c[_0x5a98('0x2a')][_0x5a98('0x36')]){_0x5a2e03['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5a98('0x37')](_0x5a2e03);})[_0x5a98('0x20')](function(_0x16981b){_0x649fde[_0x5a98('0x38')]=_0x16981b;return _0x649fde;});}})['then'](respondWithFilteredResult(_0x35d9e9,_0x5a2e03))['catch'](handleError(_0x35d9e9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 298b11c..5b21594 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 _0x6b0a=['exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x40d80a,_0x5e5089){var _0x335bfb=function(_0x3bb568){while(--_0x3bb568){_0x40d80a['push'](_0x40d80a['shift']());}};_0x335bfb(++_0x5e5089);}(_0x6b0a,0x9f));var _0xa6b0=function(_0x2278f0,_0x1e3729){_0x2278f0=_0x2278f0-0x0;var _0x3514ff=_0x6b0a[_0x2278f0];return _0x3514ff;};'use strict';var _=require(_0xa6b0('0x0'));var util=require('util');var logger=require(_0xa6b0('0x1'))(_0xa6b0('0x2'));var moment=require(_0xa6b0('0x3'));var BPromise=require(_0xa6b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6b0('0x5'));var rimraf=require(_0xa6b0('0x6'));var config=require(_0xa6b0('0x7'));var attributes=require(_0xa6b0('0x8'));module[_0xa6b0('0x9')]=function(_0x1e5132,_0x3029ef){return _0x1e5132[_0xa6b0('0xa')](_0xa6b0('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa983=['request-promise','exports','JscriptySessionReport','lodash','util','api','moment','bluebird'];(function(_0x30bd92,_0x1a41bc){var _0x226586=function(_0x2e05f5){while(--_0x2e05f5){_0x30bd92['push'](_0x30bd92['shift']());}};_0x226586(++_0x1a41bc);}(_0xa983,0x17b));var _0x3a98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa983[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a98('0x0'));var util=require(_0x3a98('0x1'));var logger=require('../../config/logger')(_0x3a98('0x2'));var moment=require(_0x3a98('0x3'));var BPromise=require(_0x3a98('0x4'));var rp=require(_0x3a98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x3a98('0x6')]=function(_0x551ca1,_0x57cb51){return _0x551ca1['define'](_0x3a98('0x7'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d2c0d1a..76a4b2b 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 _0x04d3=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x46ca8f,_0x22cd0d){var _0x2321a7=function(_0x172e08){while(--_0x172e08){_0x46ca8f['push'](_0x46ca8f['shift']());}};_0x2321a7(++_0x22cd0d);}(_0x04d3,0x19a));var _0x304d=function(_0x4af2ec,_0x456c48){_0x4af2ec=_0x4af2ec-0x0;var _0x2e5a82=_0x04d3[_0x4af2ec];return _0x2e5a82;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x304d('0x0'));var BPromise=require(_0x304d('0x1'));var rs=require(_0x304d('0x2'));var fs=require('fs');var Redis=require(_0x304d('0x3'));var db=require(_0x304d('0x4'))['db'];var utils=require(_0x304d('0x5'));var logger=require(_0x304d('0x6'))('rpc');var config=require(_0x304d('0x7'));var jayson=require(_0x304d('0x8'));var client=jayson[_0x304d('0x9')][_0x304d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb31e,_0x1bd6a4,_0x1a284f){return new BPromise(function(_0x4c91f4,_0x391060){return client[_0x304d('0xb')](_0x2bb31e,_0x1a284f)[_0x304d('0xc')](function(_0x32b6b5){logger[_0x304d('0xd')](_0x304d('0xe'),_0x1bd6a4,'request\x20sent');logger[_0x304d('0xf')](_0x304d('0x10'),_0x1bd6a4,'request\x20sent',JSON[_0x304d('0x11')](_0x32b6b5));if(_0x32b6b5['error']){if(_0x32b6b5[_0x304d('0x12')][_0x304d('0x13')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1bd6a4,_0x32b6b5[_0x304d('0x12')][_0x304d('0x14')]);return _0x391060(_0x32b6b5[_0x304d('0x12')][_0x304d('0x14')]);}logger[_0x304d('0x12')](_0x304d('0xe'),_0x1bd6a4,_0x32b6b5['error'][_0x304d('0x14')]);return _0x4c91f4(_0x32b6b5[_0x304d('0x12')][_0x304d('0x14')]);}else{logger['info'](_0x304d('0xe'),_0x1bd6a4,_0x304d('0x15'));_0x4c91f4(_0x32b6b5[_0x304d('0x16')][_0x304d('0x14')]);}})[_0x304d('0x17')](function(_0x54ec22){logger[_0x304d('0x12')](_0x304d('0xe'),_0x1bd6a4,_0x54ec22);_0x391060(_0x54ec22);});});} \ No newline at end of file +var _0x1599=['jayson/promise','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment'];(function(_0x398cd1,_0x20ca40){var _0x23b058=function(_0x4640fc){while(--_0x4640fc){_0x398cd1['push'](_0x398cd1['shift']());}};_0x23b058(++_0x20ca40);}(_0x1599,0xaa));var _0x9159=function(_0x1a8051,_0x44842e){_0x1a8051=_0x1a8051-0x0;var _0x5826b3=_0x1599[_0x1a8051];return _0x5826b3;};'use strict';var _=require(_0x9159('0x0'));var util=require(_0x9159('0x1'));var moment=require('moment');var BPromise=require(_0x9159('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9159('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9159('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9159('0x5'));var jayson=require(_0x9159('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d9338,_0x114b9c,_0x281108){return new BPromise(function(_0xd13216,_0x30250a){return client['request'](_0x4d9338,_0x281108)[_0x9159('0x7')](function(_0xa42043){logger[_0x9159('0x8')](_0x9159('0x9'),_0x114b9c,'request\x20sent');logger[_0x9159('0xa')](_0x9159('0xb'),_0x114b9c,'request\x20sent',JSON[_0x9159('0xc')](_0xa42043));if(_0xa42043[_0x9159('0xd')]){if(_0xa42043[_0x9159('0xd')]['code']===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x114b9c,_0xa42043['error'][_0x9159('0xe')]);return _0x30250a(_0xa42043[_0x9159('0xd')][_0x9159('0xe')]);}logger[_0x9159('0xd')](_0x9159('0x9'),_0x114b9c,_0xa42043['error'][_0x9159('0xe')]);return _0xd13216(_0xa42043[_0x9159('0xd')][_0x9159('0xe')]);}else{logger[_0x9159('0x8')](_0x9159('0x9'),_0x114b9c,'request\x20sent');_0xd13216(_0xa42043[_0x9159('0xf')][_0x9159('0xe')]);}})['catch'](function(_0x59224c){logger[_0x9159('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x114b9c,_0x59224c);_0x30250a(_0x59224c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8f73cff..c492b4b 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 _0xa738=['update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated'];(function(_0x25972f,_0x413623){var _0x2024ec=function(_0x4a6d4d){while(--_0x4a6d4d){_0x25972f['push'](_0x25972f['shift']());}};_0x2024ec(++_0x413623);}(_0xa738,0x160));var _0x8a73=function(_0x447f5f,_0x1e29f9){_0x447f5f=_0x447f5f-0x0;var _0x786043=_0xa738[_0x447f5f];return _0x786043;};'use strict';var multer=require(_0x8a73('0x0'));var util=require(_0x8a73('0x1'));var path=require(_0x8a73('0x2'));var timeout=require(_0x8a73('0x3'));var express=require(_0x8a73('0x4'));var router=express['Router']();var auth=require(_0x8a73('0x5'));var interaction=require(_0x8a73('0x6'));var config=require(_0x8a73('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0x8a73('0x8')]);router[_0x8a73('0x9')](_0x8a73('0xa'),auth[_0x8a73('0xb')](),controller[_0x8a73('0xc')]);module[_0x8a73('0xd')]=router; \ No newline at end of file +var _0x3331=['../../config/environment','./license.controller','get','put','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2d576f,_0x2e34e8){var _0x53e4cf=function(_0x403121){while(--_0x403121){_0x2d576f['push'](_0x2d576f['shift']());}};_0x53e4cf(++_0x2e34e8);}(_0x3331,0x1f4));var _0x1333=function(_0x27dc58,_0x4b236d){_0x27dc58=_0x27dc58-0x0;var _0x24c8e8=_0x3331[_0x27dc58];return _0x24c8e8;};'use strict';var multer=require(_0x1333('0x0'));var util=require(_0x1333('0x1'));var path=require(_0x1333('0x2'));var timeout=require(_0x1333('0x3'));var express=require(_0x1333('0x4'));var router=express[_0x1333('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1333('0x6'));var config=require(_0x1333('0x7'));var controller=require(_0x1333('0x8'));router[_0x1333('0x9')]('/',controller['index']);router[_0x1333('0xa')]('/:id',auth[_0x1333('0xb')](),controller[_0x1333('0xc')]);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 b4910ae..5d67dd6 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x13cbdb,_0x2be3a0){var _0x245ff7=function(_0x8045c0){while(--_0x8045c0){_0x13cbdb['push'](_0x13cbdb['shift']());}};_0x245ff7(++_0x2be3a0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'license':{'type':Sequelize[_0xac4a('0x2')]},'data1':{'type':Sequelize[_0xac4a('0x3')]},'data2':{'type':Sequelize[_0xac4a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xac4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x55adf3,_0xd67a44){var _0x522010=function(_0x3fcea5){while(--_0x3fcea5){_0x55adf3['push'](_0x55adf3['shift']());}};_0x522010(++_0xd67a44);}(_0x814b,0x1a2));var _0xb814=function(_0xc84e3,_0xd631b){_0xc84e3=_0xc84e3-0x0;var _0x437a90=_0x814b[_0xc84e3];return _0x437a90;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'license':{'type':Sequelize[_0xb814('0x2')]},'data1':{'type':Sequelize[_0xb814('0x3')]},'data2':{'type':Sequelize[_0xb814('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xb814('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 da07458..408047b 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 _0xa6af=['fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','name','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','catch','get','checkLicense','body','key','demo','eml-format','zip-dir'];(function(_0x526dc2,_0x37ebb8){var _0x54e521=function(_0x186bfb){while(--_0x186bfb){_0x526dc2['push'](_0x526dc2['shift']());}};_0x54e521(++_0x37ebb8);}(_0xa6af,0x130));var _0xfa6a=function(_0x981bf8,_0x29d805){_0x981bf8=_0x981bf8-0x0;var _0x590840=_0xa6af[_0x981bf8];return _0x590840;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa6a('0x1'));var jsonpatch=require(_0xfa6a('0x2'));var rp=require('request-promise');var moment=require(_0xfa6a('0x3'));var BPromise=require(_0xfa6a('0x4'));var Mustache=require(_0xfa6a('0x5'));var util=require('util');var path=require(_0xfa6a('0x6'));var sox=require(_0xfa6a('0x7'));var csv=require(_0xfa6a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa6a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa6a('0xa'));var deskjs=require(_0xfa6a('0xb'));var toCsv=require(_0xfa6a('0x8'));var querystring=require(_0xfa6a('0xc'));var Papa=require(_0xfa6a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa6a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa6a('0xf'))(_0xfa6a('0x10'));var utils=require('../../config/utils');var config=require(_0xfa6a('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303105,_0x4d7b60){_0x4d7b60=_0x4d7b60||0xcc;return function(_0x3445a0){if(_0x3445a0){return _0x303105[_0xfa6a('0x12')](_0x4d7b60);}return _0x303105['status'](_0x4d7b60)[_0xfa6a('0x13')]();};}function respondWithResult(_0x40ce6d,_0x25ced3){_0x25ced3=_0x25ced3||0xc8;return function(_0x53525c){if(_0x53525c){return _0x40ce6d[_0xfa6a('0x14')](_0x25ced3)[_0xfa6a('0x15')](_0x53525c);}};}function respondWithFilteredResult(_0x573071,_0x4bda19){return function(_0x489dcc){if(_0x489dcc){var _0x3545ce=_0x489dcc[_0xfa6a('0x16')],_0x331157=_0x4bda19[_0xfa6a('0x17')],_0x2d3f5a=_0x4bda19[_0xfa6a('0x17')]+_0x4bda19[_0xfa6a('0x18')],_0xcfb6d9;if(_0x2d3f5a>=_0x3545ce){_0x2d3f5a=_0x3545ce;_0xcfb6d9=0xc8;}else{_0xcfb6d9=0xce;}_0x573071[_0xfa6a('0x14')](_0xcfb6d9);return _0x573071[_0xfa6a('0x19')]('Content-Range',_0x331157+'-'+_0x2d3f5a+'/'+_0x3545ce)[_0xfa6a('0x15')](_0x489dcc);}return null;};}function patchUpdates(_0xc53a15){return function(_0x5e5b22){try{jsonpatch[_0xfa6a('0x1a')](_0x5e5b22,_0xc53a15,!![]);}catch(_0x510296){return BPromise[_0xfa6a('0x1b')](_0x510296);}return _0x5e5b22['save']();};}function saveUpdates(_0x35faf3,_0x4f07b5){return function(_0x190a57){if(_0x190a57){return _0x190a57[_0xfa6a('0x1c')](_0x35faf3)[_0xfa6a('0x1d')](function(_0x4b83e7){return _0x4b83e7;});}return null;};}function removeEntity(_0xd697c6,_0x22dbbd){return function(_0x32c94c){if(_0x32c94c){return _0x32c94c['destroy']()[_0xfa6a('0x1d')](function(){_0xd697c6['status'](0xcc)[_0xfa6a('0x13')]();});}};}function handleEntityNotFound(_0x28d755,_0x1fb988){return function(_0x1ce3ac){if(!_0x1ce3ac){_0x28d755[_0xfa6a('0x12')](0x194);}return _0x1ce3ac;};}function handleError(_0x1268d6,_0x3d5e1d){_0x3d5e1d=_0x3d5e1d||0x1f4;return function(_0x443300){logger['error'](_0x443300['stack']);if(_0x443300[_0xfa6a('0x1e')]){delete _0x443300[_0xfa6a('0x1e')];}_0x1268d6['status'](_0x3d5e1d)[_0xfa6a('0x1f')](_0x443300);};}var utilLicense=require(_0xfa6a('0x20'));exports[_0xfa6a('0x21')]=function(_0x26979f,_0x398ef8){var _0x23c368={'raw':!![],'where':{'id':0x1}},_0x33a4a2={};_0x33a4a2['model']=_[_0xfa6a('0x22')](db[_0xfa6a('0x23')][_0xfa6a('0x24')]);_0x33a4a2[_0xfa6a('0x25')]=_['keys'](_0x26979f[_0xfa6a('0x25')]);_0x33a4a2[_0xfa6a('0x26')]=_[_0xfa6a('0x27')](_0x33a4a2[_0xfa6a('0x28')],_0x33a4a2['query']);_0x23c368[_0xfa6a('0x29')]=_['intersection'](_0x33a4a2[_0xfa6a('0x28')],qs[_0xfa6a('0x2a')](_0x26979f[_0xfa6a('0x25')][_0xfa6a('0x2a')]));_0x23c368['attributes']=_0x23c368[_0xfa6a('0x29')][_0xfa6a('0x2b')]?_0x23c368[_0xfa6a('0x29')]:_0x33a4a2[_0xfa6a('0x28')];_0x23c368=_[_0xfa6a('0x2c')]({},_0x23c368,_0x26979f['options']);return utilLicense['getLicense'](_0x23c368)[_0xfa6a('0x1d')](respondWithResult(_0x398ef8,null))[_0xfa6a('0x2d')](handleError(_0x398ef8,null));};exports[_0xfa6a('0x1c')]=function(_0x5af3b9,_0x3ff4d7){if(_0x5af3b9['body']['id']){delete _0x5af3b9['body']['id'];}return db[_0xfa6a('0x23')]['find']({'where':{'id':_0x5af3b9['params']['id']}})[_0xfa6a('0x1d')](handleEntityNotFound(_0x3ff4d7,null))[_0xfa6a('0x1d')](function(_0x46962e){var _0x25262e=_0x46962e[_0xfa6a('0x2e')]({'plain':!![]});return utilLicense[_0xfa6a('0x2f')](_0x25262e,_0x5af3b9[_0xfa6a('0x30')][_0xfa6a('0x31')]);})[_0xfa6a('0x1d')](function(_0x554dce){if(!_0x554dce[_0xfa6a('0x32')]){return saveUpdates(_0x5af3b9['body'],null);}return _0x554dce;})[_0xfa6a('0x1d')](respondWithResult(_0x3ff4d7,null))['catch'](handleError(_0x3ff4d7,null));}; \ No newline at end of file +var _0x54c7=['jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','../../config/license/util','index','model','keys','rawAttributes','query','attributes','intersection','fields','length','catch','body','License','find','params','get','checkLicense','key','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto'];(function(_0x46c02f,_0x157f3e){var _0xbd0c9c=function(_0x228106){while(--_0x228106){_0x46c02f['push'](_0x46c02f['shift']());}};_0xbd0c9c(++_0x157f3e);}(_0x54c7,0x104));var _0x754c=function(_0x270555,_0x2837dd){_0x270555=_0x270555-0x0;var _0x53d2d6=_0x54c7[_0x270555];return _0x53d2d6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x754c('0x0'));var zipdir=require(_0x754c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x754c('0x2'));var moment=require(_0x754c('0x3'));var BPromise=require(_0x754c('0x4'));var Mustache=require(_0x754c('0x5'));var util=require(_0x754c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x754c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x754c('0x8'));var squel=require('squel');var crypto=require(_0x754c('0x9'));var jsforce=require(_0x754c('0xa'));var deskjs=require(_0x754c('0xb'));var toCsv=require(_0x754c('0x7'));var querystring=require(_0x754c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x754c('0xd'));var as=require(_0x754c('0xe'));var hardwareService=require(_0x754c('0xf'));var logger=require(_0x754c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x754c('0x11'));var db=require(_0x754c('0x12'))['db'];function respondWithStatusCode(_0x424391,_0x77e497){_0x77e497=_0x77e497||0xcc;return function(_0x53694a){if(_0x53694a){return _0x424391[_0x754c('0x13')](_0x77e497);}return _0x424391[_0x754c('0x14')](_0x77e497)[_0x754c('0x15')]();};}function respondWithResult(_0x117e17,_0x31c575){_0x31c575=_0x31c575||0xc8;return function(_0x194409){if(_0x194409){return _0x117e17[_0x754c('0x14')](_0x31c575)[_0x754c('0x16')](_0x194409);}};}function respondWithFilteredResult(_0x5ada9e,_0x1b8bd0){return function(_0x2ad436){if(_0x2ad436){var _0x16645c=_0x2ad436['count'],_0x283e75=_0x1b8bd0[_0x754c('0x17')],_0xc8022b=_0x1b8bd0['offset']+_0x1b8bd0[_0x754c('0x18')],_0x4bddc7;if(_0xc8022b>=_0x16645c){_0xc8022b=_0x16645c;_0x4bddc7=0xc8;}else{_0x4bddc7=0xce;}_0x5ada9e[_0x754c('0x14')](_0x4bddc7);return _0x5ada9e[_0x754c('0x19')]('Content-Range',_0x283e75+'-'+_0xc8022b+'/'+_0x16645c)['json'](_0x2ad436);}return null;};}function patchUpdates(_0x4607be){return function(_0x3fb9c9){try{jsonpatch[_0x754c('0x1a')](_0x3fb9c9,_0x4607be,!![]);}catch(_0x377871){return BPromise[_0x754c('0x1b')](_0x377871);}return _0x3fb9c9[_0x754c('0x1c')]();};}function saveUpdates(_0x395f94,_0x1fb755){return function(_0x37489b){if(_0x37489b){return _0x37489b[_0x754c('0x1d')](_0x395f94)['then'](function(_0x27f111){return _0x27f111;});}return null;};}function removeEntity(_0x1671e0,_0x404226){return function(_0x355b33){if(_0x355b33){return _0x355b33[_0x754c('0x1e')]()[_0x754c('0x1f')](function(){_0x1671e0[_0x754c('0x14')](0xcc)[_0x754c('0x15')]();});}};}function handleEntityNotFound(_0x4b4bcb,_0x1ed7dd){return function(_0x314ca2){if(!_0x314ca2){_0x4b4bcb[_0x754c('0x13')](0x194);}return _0x314ca2;};}function handleError(_0x63d17e,_0xc899b){_0xc899b=_0xc899b||0x1f4;return function(_0x43c77b){logger[_0x754c('0x20')](_0x43c77b[_0x754c('0x21')]);if(_0x43c77b[_0x754c('0x22')]){delete _0x43c77b['name'];}_0x63d17e['status'](_0xc899b)[_0x754c('0x23')](_0x43c77b);};}var utilLicense=require(_0x754c('0x24'));exports[_0x754c('0x25')]=function(_0x527269,_0x1ffdcd){var _0x46e085={'raw':!![],'where':{'id':0x1}},_0x4b49c8={};_0x4b49c8[_0x754c('0x26')]=_[_0x754c('0x27')](db['License'][_0x754c('0x28')]);_0x4b49c8[_0x754c('0x29')]=_[_0x754c('0x27')](_0x527269[_0x754c('0x29')]);_0x4b49c8['filters']=_['intersection'](_0x4b49c8[_0x754c('0x26')],_0x4b49c8['query']);_0x46e085[_0x754c('0x2a')]=_[_0x754c('0x2b')](_0x4b49c8['model'],qs[_0x754c('0x2c')](_0x527269[_0x754c('0x29')][_0x754c('0x2c')]));_0x46e085[_0x754c('0x2a')]=_0x46e085[_0x754c('0x2a')][_0x754c('0x2d')]?_0x46e085[_0x754c('0x2a')]:_0x4b49c8['model'];_0x46e085=_['merge']({},_0x46e085,_0x527269['options']);return utilLicense['getLicense'](_0x46e085)[_0x754c('0x1f')](respondWithResult(_0x1ffdcd,null))[_0x754c('0x2e')](handleError(_0x1ffdcd,null));};exports['update']=function(_0x4b5382,_0x1d6087){if(_0x4b5382['body']['id']){delete _0x4b5382[_0x754c('0x2f')]['id'];}return db[_0x754c('0x30')][_0x754c('0x31')]({'where':{'id':_0x4b5382[_0x754c('0x32')]['id']}})[_0x754c('0x1f')](handleEntityNotFound(_0x1d6087,null))[_0x754c('0x1f')](function(_0x2ed291){var _0x11abe1=_0x2ed291[_0x754c('0x33')]({'plain':!![]});return utilLicense[_0x754c('0x34')](_0x11abe1,_0x4b5382[_0x754c('0x2f')][_0x754c('0x35')]);})['then'](function(_0xa7bb1a){if(!_0xa7bb1a['demo']){return saveUpdates(_0x4b5382['body'],null);}return _0xa7bb1a;})[_0x754c('0x1f')](respondWithResult(_0x1d6087,null))[_0x754c('0x2e')](handleError(_0x1d6087,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 543632f..42b7f6c 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 _0x02ca=['util','api','moment','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0xec65f4,_0x4bbcfd){var _0x3352a7=function(_0x47e3d0){while(--_0x47e3d0){_0xec65f4['push'](_0xec65f4['shift']());}};_0x3352a7(++_0x4bbcfd);}(_0x02ca,0x197));var _0xa02c=function(_0xe23747,_0x406edd){_0xe23747=_0xe23747-0x0;var _0x4d2517=_0x02ca[_0xe23747];return _0x4d2517;};'use strict';var _=require('lodash');var util=require(_0xa02c('0x0'));var logger=require('../../config/logger')(_0xa02c('0x1'));var moment=require(_0xa02c('0x2'));var BPromise=require('bluebird');var rp=require(_0xa02c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa02c('0x4'));var config=require(_0xa02c('0x5'));var attributes=require(_0xa02c('0x6'));module[_0xa02c('0x7')]=function(_0x378ade,_0x3cd4c1){return _0x378ade[_0xa02c('0x8')](_0xa02c('0x9'),attributes,{'tableName':_0xa02c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd88c=['define','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x58dd4c,_0x3b5689){var _0x153125=function(_0x7ac0f9){while(--_0x7ac0f9){_0x58dd4c['push'](_0x58dd4c['shift']());}};_0x153125(++_0x3b5689);}(_0xd88c,0x162));var _0xcd88=function(_0x20dba1,_0x726a24){_0x20dba1=_0x20dba1-0x0;var _0x47203d=_0xd88c[_0x20dba1];return _0x47203d;};'use strict';var _=require(_0xcd88('0x0'));var util=require(_0xcd88('0x1'));var logger=require(_0xcd88('0x2'))(_0xcd88('0x3'));var moment=require('moment');var BPromise=require(_0xcd88('0x4'));var rp=require(_0xcd88('0x5'));var fs=require('fs');var path=require(_0xcd88('0x6'));var rimraf=require(_0xcd88('0x7'));var config=require(_0xcd88('0x8'));var attributes=require('./license.attributes');module[_0xcd88('0x9')]=function(_0x133953,_0x48eb1e){return _0x133953[_0xcd88('0xa')](_0xcd88('0xb'),attributes,{'tableName':_0xcd88('0xc'),'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 c6c3c95..a12de97 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 _0xbdb7=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','License,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x384e63,_0x3cdb06){_0x384e63=_0x384e63-0x0;var _0x163527=_0xbdb7[_0x384e63];return _0x163527;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0x0b25=['request','then','info','request\x20sent','debug','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x3d8745,_0x28221f){var _0x419373=function(_0x23e731){while(--_0x23e731){_0x3d8745['push'](_0x3d8745['shift']());}};_0x419373(++_0x28221f);}(_0x0b25,0x155));var _0x50b2=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0b25[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x50b2('0x0'));var util=require(_0x50b2('0x1'));var moment=require(_0x50b2('0x2'));var BPromise=require(_0x50b2('0x3'));var rs=require(_0x50b2('0x4'));var fs=require('fs');var Redis=require(_0x50b2('0x5'));var db=require(_0x50b2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50b2('0x7'));var config=require('../../config/environment');var jayson=require(_0x50b2('0x8'));var client=jayson[_0x50b2('0x9')][_0x50b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29278f,_0x151e97,_0x550cfd){return new BPromise(function(_0x2aeeb0,_0x2b7400){return client[_0x50b2('0xb')](_0x29278f,_0x550cfd)[_0x50b2('0xc')](function(_0x54d618){logger[_0x50b2('0xd')]('License,\x20%s,\x20%s',_0x151e97,_0x50b2('0xe'));logger[_0x50b2('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x151e97,_0x50b2('0xe'),JSON['stringify'](_0x54d618));if(_0x54d618['error']){if(_0x54d618[_0x50b2('0x10')][_0x50b2('0x11')]===0x1f4){logger[_0x50b2('0x10')](_0x50b2('0x12'),_0x151e97,_0x54d618[_0x50b2('0x10')][_0x50b2('0x13')]);return _0x2b7400(_0x54d618[_0x50b2('0x10')][_0x50b2('0x13')]);}logger[_0x50b2('0x10')](_0x50b2('0x12'),_0x151e97,_0x54d618[_0x50b2('0x10')]['message']);return _0x2aeeb0(_0x54d618[_0x50b2('0x10')][_0x50b2('0x13')]);}else{logger[_0x50b2('0xd')]('License,\x20%s,\x20%s',_0x151e97,_0x50b2('0xe'));_0x2aeeb0(_0x54d618[_0x50b2('0x14')][_0x50b2('0x13')]);}})[_0x50b2('0x15')](function(_0x1308dd){logger[_0x50b2('0x10')]('License,\x20%s,\x20%s',_0x151e97,_0x1308dd);_0x2b7400(_0x1308dd);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e495276..f96d72f 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 _0x39cc=['connect-timeout','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','post','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','delete','removeDispositions','removeImap','destroy','/:id/users','removeAgents','multer','util','path'];(function(_0x4e7235,_0x17f983){var _0x468910=function(_0x261609){while(--_0x261609){_0x4e7235['push'](_0x4e7235['shift']());}};_0x468910(++_0x17f983);}(_0x39cc,0xf9));var _0xc39c=function(_0x294053,_0x268e16){_0x294053=_0x294053-0x0;var _0x215ae5=_0x39cc[_0x294053];return _0x215ae5;};'use strict';var multer=require(_0xc39c('0x0'));var util=require(_0xc39c('0x1'));var path=require(_0xc39c('0x2'));var timeout=require(_0xc39c('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc39c('0x4'));var config=require('../../config/environment');var controller=require(_0xc39c('0x5'));router[_0xc39c('0x6')]('/',auth[_0xc39c('0x7')](),controller[_0xc39c('0x8')]);router[_0xc39c('0x6')](_0xc39c('0x9'),auth[_0xc39c('0x7')](),controller[_0xc39c('0xa')]);router['get']('/:id',auth[_0xc39c('0x7')](),controller[_0xc39c('0xb')]);router[_0xc39c('0x6')](_0xc39c('0xc'),auth[_0xc39c('0x7')](),controller[_0xc39c('0xd')]);router[_0xc39c('0x6')](_0xc39c('0xe'),auth[_0xc39c('0x7')](),controller[_0xc39c('0xf')]);router[_0xc39c('0x6')](_0xc39c('0x10'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x11')]);router['get'](_0xc39c('0x12'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x13')]);router[_0xc39c('0x6')]('/:id/interactions',auth[_0xc39c('0x7')](),controller[_0xc39c('0x14')]);router[_0xc39c('0x6')](_0xc39c('0x15'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x16')]);router[_0xc39c('0x6')](_0xc39c('0x17'),auth['isAuthenticated'](),controller['getMessages']);router[_0xc39c('0x6')]('/:id/verify',auth[_0xc39c('0x7')](),controller[_0xc39c('0x18')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc39c('0x19')](_0xc39c('0xc'),auth[_0xc39c('0x7')](),controller['addDisposition']);router[_0xc39c('0x19')]('/:id/canned_answers',auth[_0xc39c('0x7')](),controller['addAnswer']);router[_0xc39c('0x19')]('/',auth[_0xc39c('0x7')](),controller['create']);router[_0xc39c('0x19')](_0xc39c('0x10'),auth['isAuthenticated'](),controller[_0xc39c('0x1a')]);router[_0xc39c('0x19')](_0xc39c('0x12'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x1b')]);router[_0xc39c('0x19')](_0xc39c('0x1c'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x1d')]);router[_0xc39c('0x19')](_0xc39c('0x15'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x1e')]);router[_0xc39c('0x19')](_0xc39c('0x1f'),auth['isAuthenticated'](),controller[_0xc39c('0x20')]);router[_0xc39c('0x19')]('/:id/users',auth[_0xc39c('0x7')](),controller[_0xc39c('0x21')]);router[_0xc39c('0x22')](_0xc39c('0x23'),auth[_0xc39c('0x7')](),controller['update']);router[_0xc39c('0x24')](_0xc39c('0xc'),auth['isAuthenticated'](),controller[_0xc39c('0x25')]);router[_0xc39c('0x24')](_0xc39c('0xe'),auth[_0xc39c('0x7')](),controller['removeAnswers']);router[_0xc39c('0x24')](_0xc39c('0x10'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x26')]);router[_0xc39c('0x24')](_0xc39c('0x12'),auth[_0xc39c('0x7')](),controller['removeSmtp']);router[_0xc39c('0x24')](_0xc39c('0x23'),auth[_0xc39c('0x7')](),controller[_0xc39c('0x27')]);router[_0xc39c('0x24')](_0xc39c('0x28'),auth['isAuthenticated'](),controller[_0xc39c('0x29')]);module['exports']=router; \ No newline at end of file +var _0x6e76=['removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/:id','show','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','/:id/dispositions','addDisposition','post','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','put','delete','removeAnswers'];(function(_0x403ac7,_0x3b4cc1){var _0x399175=function(_0x3e7c9f){while(--_0x3e7c9f){_0x403ac7['push'](_0x403ac7['shift']());}};_0x399175(++_0x3b4cc1);}(_0x6e76,0x165));var _0x66e7=function(_0xc0cb02,_0x4564e9){_0xc0cb02=_0xc0cb02-0x0;var _0x21a6d7=_0x6e76[_0xc0cb02];return _0x21a6d7;};'use strict';var multer=require(_0x66e7('0x0'));var util=require('util');var path=require(_0x66e7('0x1'));var timeout=require('connect-timeout');var express=require(_0x66e7('0x2'));var router=express[_0x66e7('0x3')]();var auth=require(_0x66e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x66e7('0x5'));var controller=require(_0x66e7('0x6'));router[_0x66e7('0x7')]('/',auth[_0x66e7('0x8')](),controller['index']);router[_0x66e7('0x7')]('/describe',auth[_0x66e7('0x8')](),controller['describe']);router[_0x66e7('0x7')](_0x66e7('0x9'),auth[_0x66e7('0x8')](),controller[_0x66e7('0xa')]);router[_0x66e7('0x7')]('/:id/dispositions',auth[_0x66e7('0x8')](),controller['getDispositions']);router[_0x66e7('0x7')](_0x66e7('0xb'),auth[_0x66e7('0x8')](),controller[_0x66e7('0xc')]);router[_0x66e7('0x7')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x66e7('0xd')]);router['get'](_0x66e7('0xe'),auth[_0x66e7('0x8')](),controller[_0x66e7('0xf')]);router['get'](_0x66e7('0x10'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x11')]);router[_0x66e7('0x7')](_0x66e7('0x12'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x13')]);router[_0x66e7('0x7')](_0x66e7('0x14'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x15')]);router[_0x66e7('0x7')]('/:id/verify',auth['isAuthenticated'](),controller[_0x66e7('0x16')]);router[_0x66e7('0x7')](_0x66e7('0x17'),auth[_0x66e7('0x8')](),controller['getAgents']);router['post'](_0x66e7('0x18'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x19')]);router[_0x66e7('0x1a')](_0x66e7('0xb'),auth['isAuthenticated'](),controller[_0x66e7('0x1b')]);router[_0x66e7('0x1a')]('/',auth['isAuthenticated'](),controller[_0x66e7('0x1c')]);router['post'](_0x66e7('0x1d'),auth['isAuthenticated'](),controller[_0x66e7('0x1e')]);router[_0x66e7('0x1a')](_0x66e7('0xe'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x1f')]);router[_0x66e7('0x1a')](_0x66e7('0x10'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x20')]);router[_0x66e7('0x1a')]('/:id/applications',auth[_0x66e7('0x8')](),controller['addApplications']);router[_0x66e7('0x1a')](_0x66e7('0x21'),auth['isAuthenticated'](),controller[_0x66e7('0x22')]);router['post'](_0x66e7('0x17'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x23')]);router[_0x66e7('0x24')](_0x66e7('0x9'),auth[_0x66e7('0x8')](),controller['update']);router[_0x66e7('0x25')](_0x66e7('0x18'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x66e7('0xb'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x26')]);router['delete'](_0x66e7('0x1d'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x27')]);router[_0x66e7('0x25')](_0x66e7('0xe'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x28')]);router[_0x66e7('0x25')](_0x66e7('0x9'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x29')]);router[_0x66e7('0x25')](_0x66e7('0x17'),auth[_0x66e7('0x8')](),controller[_0x66e7('0x2a')]);module[_0x66e7('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index dc3c201..3115342 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 _0x6bfd=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN'];(function(_0x30397b,_0x3675e3){var _0x187a07=function(_0x4c6b71){while(--_0x4c6b71){_0x30397b['push'](_0x30397b['shift']());}};_0x187a07(++_0x3675e3);}(_0x6bfd,0x125));var _0xd6bf=function(_0x4f9ef1,_0x3cead7){_0x4f9ef1=_0x4f9ef1-0x0;var _0x3d3573=_0x6bfd[_0x4f9ef1];return _0x3d3573;};'use strict';var Sequelize=require(_0xd6bf('0x0'));module[_0xd6bf('0x1')]={'description':{'type':Sequelize[_0xd6bf('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd6bf('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd6bf('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd6bf('0x4')},'fontSize':{'type':Sequelize[_0xd6bf('0x5')](0x2)[_0xd6bf('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd6bf('0x7');}},'notificationSound':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd6bf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd6bf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd6bf('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f6871){if(!_0x4f6871)this[_0xd6bf('0x8')](_0xd6bf('0x9'),null);this['setDataValue'](_0xd6bf('0xa'),_0x4f6871);}}}; \ No newline at end of file +var _0x4c67=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x5a89c1,_0x30f5d9){var _0x1861b2=function(_0x315e4d){while(--_0x315e4d){_0x5a89c1['push'](_0x5a89c1['shift']());}};_0x1861b2(++_0x30f5d9);}(_0x4c67,0x119));var _0x74c6=function(_0x2ea015,_0x30979d){_0x2ea015=_0x2ea015-0x0;var _0x50ada7=_0x4c67[_0x2ea015];return _0x50ada7;};'use strict';var Sequelize=require(_0x74c6('0x0'));module[_0x74c6('0x1')]={'description':{'type':Sequelize[_0x74c6('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x74c6('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x74c6('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x74c6('0x4')]},'markAsUnread':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x74c6('0x2')],'allowNull':![],'defaultValue':_0x74c6('0x5')},'fontSize':{'type':Sequelize[_0x74c6('0x6')](0x2)[_0x74c6('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x74c6('0x8');}},'notificationSound':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x74c6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x74c6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x74c6('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x74c6('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x74c6('0x3')],'defaultValue':![],'comment':_0x74c6('0xa'),'set':function(_0x1fbe38){if(!_0x1fbe38)this[_0x74c6('0xb')]('mandatoryDispositionPauseId',null);this[_0x74c6('0xb')](_0x74c6('0xc'),_0x1fbe38);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 09ed6c0..81f133d 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 _0xd09b=['defaults','messageId','subject','attach','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','isArray','userMailAccount:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','save','destroy','get','UserProfileResource','sendStatus','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','MailAccount','includeAll','include','findAll','rows','find','body','params','update','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','create','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','auth','secure','sendMail','List\x20not\x20found'];(function(_0x4b6778,_0x505a76){var _0x22dbb9=function(_0x4881eb){while(--_0x4881eb){_0x4b6778['push'](_0x4b6778['shift']());}};_0x22dbb9(++_0x505a76);}(_0xd09b,0x18e));var _0xbd09=function(_0x242ca6,_0x29c726){_0x242ca6=_0x242ca6-0x0;var _0x4f3a1c=_0xd09b[_0x242ca6];return _0x4f3a1c;};'use strict';var pdf=require(_0xbd09('0x0'));var emlformat=require(_0xbd09('0x1'));var rimraf=require(_0xbd09('0x2'));var zipdir=require(_0xbd09('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd09('0x4'));var moment=require(_0xbd09('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbd09('0x6'));var util=require('util');var path=require(_0xbd09('0x7'));var sox=require(_0xbd09('0x8'));var csv=require(_0xbd09('0x9'));var ejs=require(_0xbd09('0xa'));var fs=require('fs');var _=require(_0xbd09('0xb'));var squel=require('squel');var crypto=require(_0xbd09('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd09('0x9'));var querystring=require(_0xbd09('0xd'));var Papa=require(_0xbd09('0xe'));var Redis=require(_0xbd09('0xf'));var authService=require(_0xbd09('0x10'));var qs=require(_0xbd09('0x11'));var as=require(_0xbd09('0x12'));var hardwareService=require(_0xbd09('0x13'));var logger=require(_0xbd09('0x14'))(_0xbd09('0x15'));var utils=require(_0xbd09('0x16'));var config=require('../../config/environment');var db=require(_0xbd09('0x17'))['db'];config[_0xbd09('0x18')]=_['defaults'](config[_0xbd09('0x18')],{'host':_0xbd09('0x19'),'port':0x18eb});var socket=require(_0xbd09('0x1a'))(new Redis(config[_0xbd09('0x18')]));require(_0xbd09('0x1b'))[_0xbd09('0x1c')](socket);var jayson=require(_0xbd09('0x1d'));var client=jayson[_0xbd09('0x1e')][_0xbd09('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x215b4a,_0x717cbd,_0xe6c727){if(_0xe6c727){var _0x1fbaa3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1fbaa3['test'](_0x717cbd)){return _0x215b4a;}else{throw new db[(_0xbd09('0x20'))]['ValidationError'](_0xbd09('0x21'));}}else{return _0x215b4a;}}function respondWithRpcPromise(_0x3d2911,_0x381b6b,_0x4b06f1,_0x21ed7b){return new BPromise(function(_0x5a2338,_0x5b3e00){var _0x232ec3=_0x21ed7b||client;return _0x232ec3[_0xbd09('0x22')](_0x3d2911,_0x4b06f1)[_0xbd09('0x23')](function(_0x4dce73){logger[_0xbd09('0x24')](_0xbd09('0x25'),_0x381b6b,_0xbd09('0x26'));logger[_0xbd09('0x27')](_0xbd09('0x28'),_0x381b6b,_0xbd09('0x26'),JSON[_0xbd09('0x29')](_0x4dce73));if(_0x4dce73[_0xbd09('0x2a')]){if(_0x4dce73[_0xbd09('0x2a')][_0xbd09('0x2b')]===0x1f4){logger[_0xbd09('0x2a')](_0xbd09('0x25'),_0x381b6b,_0x4dce73['error'][_0xbd09('0x2c')]);return _0x5b3e00(_0x4dce73[_0xbd09('0x2a')][_0xbd09('0x2c')]);}logger[_0xbd09('0x2a')](_0xbd09('0x25'),_0x381b6b,_0x4dce73[_0xbd09('0x2a')][_0xbd09('0x2c')]);return _0x5a2338(_0x4dce73[_0xbd09('0x2a')]['message']);}else{logger[_0xbd09('0x24')]('MailAccount,\x20%s,\x20%s',_0x381b6b,'request\x20sent');_0x5a2338(_0x4dce73[_0xbd09('0x2d')][_0xbd09('0x2c')]);}})[_0xbd09('0x2e')](function(_0x2921b1){logger['error'](_0xbd09('0x25'),_0x381b6b,_0x2921b1);_0x5b3e00(_0x2921b1);});});}function respondWithStatusCode(_0x199e72,_0x2649cb){_0x2649cb=_0x2649cb||0xcc;return function(_0x43b830){if(_0x43b830){return _0x199e72['sendStatus'](_0x2649cb);}return _0x199e72[_0xbd09('0x2f')](_0x2649cb)[_0xbd09('0x30')]();};}function respondWithResult(_0xcf2ab9,_0x1b2008){_0x1b2008=_0x1b2008||0xc8;return function(_0xde30c1){if(_0xde30c1){return _0xcf2ab9[_0xbd09('0x2f')](_0x1b2008)[_0xbd09('0x31')](_0xde30c1);}};}function respondWithFilteredResult(_0x4ddc5a,_0x3139d0){return function(_0x33182d){if(_0x33182d){var _0x50fe86=_0x33182d[_0xbd09('0x32')],_0xf0c8d2=_0x3139d0[_0xbd09('0x33')],_0x539295=_0x3139d0[_0xbd09('0x33')]+_0x3139d0['limit'],_0x6fe35e;if(_0x539295>=_0x50fe86){_0x539295=_0x50fe86;_0x6fe35e=0xc8;}else{_0x6fe35e=0xce;}_0x4ddc5a[_0xbd09('0x2f')](_0x6fe35e);return _0x4ddc5a[_0xbd09('0x34')](_0xbd09('0x35'),_0xf0c8d2+'-'+_0x539295+'/'+_0x50fe86)[_0xbd09('0x31')](_0x33182d);}return null;};}function patchUpdates(_0x59005b){return function(_0x5cd35e){try{jsonpatch['apply'](_0x5cd35e,_0x59005b,!![]);}catch(_0x2efa8a){return BPromise['reject'](_0x2efa8a);}return _0x5cd35e[_0xbd09('0x36')]();};}function saveUpdates(_0xb4c78b,_0x2585a5){return function(_0x75e36d){if(_0x75e36d){return _0x75e36d['update'](_0xb4c78b)[_0xbd09('0x23')](function(_0x1514ec){return _0x1514ec;});}return null;};}function removeEntity(_0x49eacb,_0x95b763){return function(_0x581c9b){if(_0x581c9b){return _0x581c9b[_0xbd09('0x37')]()['then'](function(){var _0x20d223=_0x581c9b[_0xbd09('0x38')]({'plain':!![]});var _0x4d2c35='MailAccounts';return db[_0xbd09('0x39')][_0xbd09('0x37')]({'where':{'type':_0x4d2c35,'resourceId':_0x20d223['id']}})[_0xbd09('0x23')](function(){return _0x581c9b;});})[_0xbd09('0x23')](function(){_0x49eacb[_0xbd09('0x2f')](0xcc)[_0xbd09('0x30')]();});}};}function handleEntityNotFound(_0x384cd3,_0x3b1cae){return function(_0x50276c){if(!_0x50276c){_0x384cd3[_0xbd09('0x3a')](0x194);}return _0x50276c;};}function handleError(_0x5046b7,_0x307ff7){_0x307ff7=_0x307ff7||0x1f4;return function(_0x486e24){logger[_0xbd09('0x2a')](_0x486e24['stack']);if(_0x486e24[_0xbd09('0x3b')]){delete _0x486e24[_0xbd09('0x3b')];}_0x5046b7[_0xbd09('0x2f')](_0x307ff7)[_0xbd09('0x3c')](_0x486e24);};}exports[_0xbd09('0x3d')]=function(_0x5f205f,_0x37b188){var _0xe44881={'include':[{'model':db[_0xbd09('0x3e')],'as':_0xbd09('0x3f')},{'model':db[_0xbd09('0x40')],'as':_0xbd09('0x41')},{'model':db[_0xbd09('0x42')],'as':_0xbd09('0x43')}]},_0x1b39ba={},_0x4f8968={'count':0x0,'rows':[]};var _0x33f752=_[_0xbd09('0x44')](db['MailAccount'][_0xbd09('0x45')],function(_0x23119b){return{'name':_0x23119b['fieldName'],'type':_0x23119b[_0xbd09('0x46')][_0xbd09('0x47')]};});_0x1b39ba['model']=_[_0xbd09('0x44')](_0x33f752,_0xbd09('0x3b'));_0x1b39ba['query']=_[_0xbd09('0x48')](_0x5f205f[_0xbd09('0x49')]);_0x1b39ba[_0xbd09('0x4a')]=_[_0xbd09('0x4b')](_0x1b39ba[_0xbd09('0x4c')],_0x1b39ba['query']);_0xe44881['attributes']=_[_0xbd09('0x4b')](_0x1b39ba[_0xbd09('0x4c')],qs[_0xbd09('0x4d')](_0x5f205f[_0xbd09('0x49')]['fields']));_0xe44881[_0xbd09('0x4e')]=_0xe44881[_0xbd09('0x4e')][_0xbd09('0x4f')]?_0xe44881[_0xbd09('0x4e')]:_0x1b39ba[_0xbd09('0x4c')];if(!_0x5f205f['query']['hasOwnProperty'](_0xbd09('0x50'))){_0xe44881[_0xbd09('0x51')]=qs['limit'](_0x5f205f['query'][_0xbd09('0x51')]);_0xe44881[_0xbd09('0x33')]=qs['offset'](_0x5f205f[_0xbd09('0x49')][_0xbd09('0x33')]);}_0xe44881[_0xbd09('0x52')]=qs[_0xbd09('0x53')](_0x5f205f['query'][_0xbd09('0x53')]);_0xe44881[_0xbd09('0x54')]=qs[_0xbd09('0x4a')](_[_0xbd09('0x55')](_0x5f205f[_0xbd09('0x49')],_0x1b39ba['filters']),_0x33f752);if(_0x5f205f[_0xbd09('0x49')]['filter']){_0xe44881[_0xbd09('0x54')]=_[_0xbd09('0x56')](_0xe44881[_0xbd09('0x54')],{'$or':_[_0xbd09('0x44')](_0x33f752,function(_0x4484fe){if(_0x4484fe[_0xbd09('0x46')]!==_0xbd09('0x57')){var _0x155c01={};_0x155c01[_0x4484fe[_0xbd09('0x3b')]]={'$like':'%'+_0x5f205f[_0xbd09('0x49')][_0xbd09('0x58')]+'%'};return _0x155c01;}})});}_0xe44881=_[_0xbd09('0x56')]({},_0xe44881,_0x5f205f[_0xbd09('0x59')]);var _0x324e65={'where':_0xe44881[_0xbd09('0x54')]};return db[_0xbd09('0x5a')]['count'](_0x324e65)[_0xbd09('0x23')](function(_0x2899ae){_0x4f8968[_0xbd09('0x32')]=_0x2899ae;if(_0x5f205f['query'][_0xbd09('0x5b')]){_0xe44881[_0xbd09('0x5c')]=[{'all':!![]}];}return db[_0xbd09('0x5a')][_0xbd09('0x5d')](_0xe44881);})[_0xbd09('0x23')](function(_0x241184){_0x4f8968[_0xbd09('0x5e')]=_0x241184;return _0x4f8968;})[_0xbd09('0x23')](respondWithFilteredResult(_0x37b188,_0xe44881))[_0xbd09('0x2e')](handleError(_0x37b188,null));};exports['show']=function(_0x53ced3,_0x397666){var _0x2dfb05={'raw':![],'where':{'id':_0x53ced3['params']['id']},'include':[{'model':db[_0xbd09('0x3e')],'as':'Imap'},{'model':db[_0xbd09('0x40')],'as':_0xbd09('0x41')},{'model':db[_0xbd09('0x42')],'as':_0xbd09('0x43')}]},_0x3adcc3={};_0x3adcc3[_0xbd09('0x4c')]=_[_0xbd09('0x48')](db[_0xbd09('0x5a')][_0xbd09('0x45')]);_0x3adcc3['query']=_[_0xbd09('0x48')](_0x53ced3[_0xbd09('0x49')]);_0x3adcc3[_0xbd09('0x4a')]=_[_0xbd09('0x4b')](_0x3adcc3[_0xbd09('0x4c')],_0x3adcc3[_0xbd09('0x49')]);_0x2dfb05[_0xbd09('0x4e')]=_[_0xbd09('0x4b')](_0x3adcc3[_0xbd09('0x4c')],qs[_0xbd09('0x4d')](_0x53ced3[_0xbd09('0x49')]['fields']));_0x2dfb05['attributes']=_0x2dfb05[_0xbd09('0x4e')][_0xbd09('0x4f')]?_0x2dfb05[_0xbd09('0x4e')]:_0x3adcc3[_0xbd09('0x4c')];if(_0x53ced3[_0xbd09('0x49')]['includeAll']){_0x2dfb05['include']=[{'all':!![]}];}_0x2dfb05=_[_0xbd09('0x56')]({},_0x2dfb05,_0x53ced3['options']);return db['MailAccount'][_0xbd09('0x5f')](_0x2dfb05)['then'](handleEntityNotFound(_0x397666,null))[_0xbd09('0x23')](respondWithResult(_0x397666,null))[_0xbd09('0x2e')](handleError(_0x397666,null));};exports['update']=function(_0x15b952,_0x42f8d9){if(_0x15b952[_0xbd09('0x60')]['id']){delete _0x15b952[_0xbd09('0x60')]['id'];}return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x15b952[_0xbd09('0x61')]['id']},'include':[{'model':db[_0xbd09('0x3e')],'as':_0xbd09('0x3f')},{'model':db[_0xbd09('0x40')],'as':_0xbd09('0x41')},{'model':db[_0xbd09('0x42')],'as':_0xbd09('0x43')}]})[_0xbd09('0x23')](handleEntityNotFound(_0x42f8d9,null))[_0xbd09('0x23')](saveUpdates(_0x15b952[_0xbd09('0x60')],null))[_0xbd09('0x23')](function(_0x34357c){if(_0x34357c&&_0x15b952[_0xbd09('0x60')][_0xbd09('0x3f')]){return db[_0xbd09('0x3e')]['update'](_0x15b952[_0xbd09('0x60')]['Imap'],{'where':{'MailAccountId':_0x34357c['id']}})['then'](function(){return _0x34357c;});}return _0x34357c;})[_0xbd09('0x23')](function(_0xf8e69f){if(_0xf8e69f&&_0x15b952[_0xbd09('0x60')][_0xbd09('0x41')]){return db[_0xbd09('0x40')][_0xbd09('0x62')](_0x15b952[_0xbd09('0x60')]['Smtp'],{'where':{'MailAccountId':_0xf8e69f['id']}})[_0xbd09('0x23')](function(){return _0xf8e69f;});}return _0xf8e69f;})['then'](respondWithResult(_0x42f8d9,null))[_0xbd09('0x2e')](handleError(_0x42f8d9,null));};exports[_0xbd09('0x63')]=function(_0x241ecb,_0x45c3d0){return db[_0xbd09('0x5a')][_0xbd09('0x63')]()[_0xbd09('0x23')](respondWithResult(_0x45c3d0,null))[_0xbd09('0x2e')](handleError(_0x45c3d0,null));};exports[_0xbd09('0x64')]=function(_0x4dce94,_0x5c79f1,_0x2deaf9){if(_0x4dce94[_0xbd09('0x60')]['id']){delete _0x4dce94[_0xbd09('0x60')]['id'];}return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x4dce94['params']['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x5c79f1,null))[_0xbd09('0x23')](function(_0x39d2b0){if(_0x39d2b0){_0x4dce94[_0xbd09('0x60')][_0xbd09('0x65')]=_0x39d2b0['id'];return db[_0xbd09('0x66')]['create'](_0x4dce94['body']);}})[_0xbd09('0x23')](respondWithResult(_0x5c79f1,null))[_0xbd09('0x2e')](handleError(_0x5c79f1,null));};exports[_0xbd09('0x67')]=function(_0x1e9cb4,_0x366873,_0x4aa752){var _0x4e47a8={'raw':![],'where':{}};var _0x9abef2={};var _0x159ddc={'count':0x0,'rows':[]};return db['MailAccount'][_0xbd09('0x68')]({'where':{'id':_0x1e9cb4['params']['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x366873,null))[_0xbd09('0x23')](function(_0x320d62){if(_0x320d62){_0x9abef2['model']=_['keys'](db[_0xbd09('0x66')]['rawAttributes']);_0x9abef2[_0xbd09('0x49')]=_[_0xbd09('0x48')](_0x1e9cb4[_0xbd09('0x49')]);_0x9abef2[_0xbd09('0x4a')]=_[_0xbd09('0x4b')](_0x9abef2[_0xbd09('0x4c')],_0x9abef2[_0xbd09('0x49')]);_0x4e47a8['attributes']=_['intersection'](_0x9abef2[_0xbd09('0x4c')],qs[_0xbd09('0x4d')](_0x1e9cb4[_0xbd09('0x49')][_0xbd09('0x4d')]));_0x4e47a8[_0xbd09('0x4e')]=_0x4e47a8[_0xbd09('0x4e')][_0xbd09('0x4f')]?_0x4e47a8[_0xbd09('0x4e')]:_0x9abef2[_0xbd09('0x4c')];if(!_0x1e9cb4[_0xbd09('0x49')][_0xbd09('0x69')](_0xbd09('0x50'))){_0x4e47a8[_0xbd09('0x51')]=qs[_0xbd09('0x51')](_0x1e9cb4[_0xbd09('0x49')]['limit']);_0x4e47a8[_0xbd09('0x33')]=qs['offset'](_0x1e9cb4[_0xbd09('0x49')][_0xbd09('0x33')]);}_0x4e47a8['order']=qs[_0xbd09('0x53')](_0x1e9cb4[_0xbd09('0x49')][_0xbd09('0x53')]);_0x4e47a8[_0xbd09('0x54')]=qs[_0xbd09('0x4a')](_[_0xbd09('0x55')](_0x1e9cb4['query'],_0x9abef2[_0xbd09('0x4a')]));_0x4e47a8[_0xbd09('0x54')][_0xbd09('0x65')]=_0x320d62['id'];if(_0x1e9cb4[_0xbd09('0x49')][_0xbd09('0x58')]){_0x4e47a8[_0xbd09('0x54')]=_['merge'](_0x4e47a8[_0xbd09('0x54')],{'$or':_['map'](_0x4e47a8[_0xbd09('0x4e')],function(_0x3220b8){var _0x58b848={};_0x58b848[_0x3220b8]={'$like':'%'+_0x1e9cb4['query'][_0xbd09('0x58')]+'%'};return _0x58b848;})});}_0x4e47a8=_['merge']({},_0x4e47a8,_0x1e9cb4['options']);return db[_0xbd09('0x66')][_0xbd09('0x32')]({'where':_0x4e47a8['where']})[_0xbd09('0x23')](function(_0x5190dc){_0x159ddc[_0xbd09('0x32')]=_0x5190dc;if(_0x1e9cb4['query']['includeAll']){_0x4e47a8[_0xbd09('0x5c')]=[{'all':!![]}];}return db[_0xbd09('0x66')][_0xbd09('0x5d')](_0x4e47a8);})['then'](function(_0x595488){_0x159ddc[_0xbd09('0x5e')]=_0x595488;return _0x159ddc;});}})[_0xbd09('0x23')](respondWithFilteredResult(_0x366873,_0x4e47a8))[_0xbd09('0x2e')](handleError(_0x366873,null));};exports[_0xbd09('0x6a')]=function(_0x334fb5,_0x50ca46,_0x378fa0){return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x334fb5[_0xbd09('0x61')]['id']}})['then'](handleEntityNotFound(_0x50ca46,null))[_0xbd09('0x23')](function(_0x48cc21){if(_0x48cc21){return _0x48cc21[_0xbd09('0x6a')](_0x334fb5[_0xbd09('0x49')][_0xbd09('0x6b')]);}})[_0xbd09('0x23')](respondWithStatusCode(_0x50ca46,null))['catch'](handleError(_0x50ca46,null));};exports['addAnswer']=function(_0xed918c,_0x37baf0,_0x4682fc){if(_0xed918c['body']['id']){delete _0xed918c[_0xbd09('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xed918c['params']['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x37baf0,null))[_0xbd09('0x23')](function(_0x5da2c2){if(_0x5da2c2){_0xed918c[_0xbd09('0x60')][_0xbd09('0x65')]=_0x5da2c2['id'];return db['CannedAnswer'][_0xbd09('0x6c')](_0xed918c[_0xbd09('0x60')]);}})[_0xbd09('0x23')](respondWithResult(_0x37baf0,null))['catch'](handleError(_0x37baf0,null));};exports[_0xbd09('0x6d')]=function(_0x24601c,_0x5dd778,_0xd3de00){var _0x37696f={'raw':![],'where':{}};var _0x4752a7={};var _0x5c9aaa={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x24601c[_0xbd09('0x61')]['id']}})['then'](handleEntityNotFound(_0x5dd778,null))[_0xbd09('0x23')](function(_0x560c9f){if(_0x560c9f){_0x4752a7[_0xbd09('0x4c')]=_[_0xbd09('0x48')](db['CannedAnswer'][_0xbd09('0x45')]);_0x4752a7['query']=_[_0xbd09('0x48')](_0x24601c[_0xbd09('0x49')]);_0x4752a7[_0xbd09('0x4a')]=_[_0xbd09('0x4b')](_0x4752a7['model'],_0x4752a7[_0xbd09('0x49')]);_0x37696f[_0xbd09('0x4e')]=_[_0xbd09('0x4b')](_0x4752a7[_0xbd09('0x4c')],qs['fields'](_0x24601c[_0xbd09('0x49')][_0xbd09('0x4d')]));_0x37696f[_0xbd09('0x4e')]=_0x37696f[_0xbd09('0x4e')]['length']?_0x37696f[_0xbd09('0x4e')]:_0x4752a7[_0xbd09('0x4c')];if(!_0x24601c[_0xbd09('0x49')][_0xbd09('0x69')]('nolimit')){_0x37696f[_0xbd09('0x51')]=qs[_0xbd09('0x51')](_0x24601c[_0xbd09('0x49')][_0xbd09('0x51')]);_0x37696f[_0xbd09('0x33')]=qs[_0xbd09('0x33')](_0x24601c['query'][_0xbd09('0x33')]);}_0x37696f[_0xbd09('0x52')]=qs[_0xbd09('0x53')](_0x24601c[_0xbd09('0x49')]['sort']);_0x37696f[_0xbd09('0x54')]=qs[_0xbd09('0x4a')](_['pick'](_0x24601c[_0xbd09('0x49')],_0x4752a7[_0xbd09('0x4a')]));_0x37696f[_0xbd09('0x54')][_0xbd09('0x65')]=_0x560c9f['id'];if(_0x24601c[_0xbd09('0x49')][_0xbd09('0x58')]){_0x37696f['where']=_[_0xbd09('0x56')](_0x37696f[_0xbd09('0x54')],{'$or':_['map'](_0x37696f[_0xbd09('0x4e')],function(_0x1cebea){var _0xcdc400={};_0xcdc400[_0x1cebea]={'$like':'%'+_0x24601c['query'][_0xbd09('0x58')]+'%'};return _0xcdc400;})});}_0x37696f=_[_0xbd09('0x56')]({},_0x37696f,_0x24601c[_0xbd09('0x59')]);return db[_0xbd09('0x6e')]['count']({'where':_0x37696f[_0xbd09('0x54')]})[_0xbd09('0x23')](function(_0x5b99d8){_0x5c9aaa[_0xbd09('0x32')]=_0x5b99d8;if(_0x24601c['query'][_0xbd09('0x5b')]){_0x37696f[_0xbd09('0x5c')]=[{'all':!![]}];}return db[_0xbd09('0x6e')]['findAll'](_0x37696f);})['then'](function(_0x482df4){_0x5c9aaa['rows']=_0x482df4;return _0x5c9aaa;});}})[_0xbd09('0x23')](respondWithFilteredResult(_0x5dd778,_0x37696f))[_0xbd09('0x2e')](handleError(_0x5dd778,null));};exports[_0xbd09('0x6f')]=function(_0xa8da4b,_0x331878,_0x4013bc){return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0xa8da4b['params']['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x331878,null))['then'](function(_0x4e165e){if(_0x4e165e){return _0x4e165e[_0xbd09('0x6f')](_0xa8da4b[_0xbd09('0x49')][_0xbd09('0x6b')]);}})['then'](respondWithStatusCode(_0x331878,null))[_0xbd09('0x2e')](handleError(_0x331878,null));};exports[_0xbd09('0x6c')]=function(_0x10436,_0x5ccfc8){var _0x23285b={'name':_0x10436[_0xbd09('0x60')][_0xbd09('0x3b')],'key':_0x10436[_0xbd09('0x60')]['key'],'email':_0x10436[_0xbd09('0x60')][_0xbd09('0x70')],'ListId':_0x10436[_0xbd09('0x60')][_0xbd09('0x71')],'active':!_[_0xbd09('0x72')](_0x10436[_0xbd09('0x60')][_0xbd09('0x73')])?_0x10436[_0xbd09('0x60')][_0xbd09('0x73')]:!![],'description':_0x10436[_0xbd09('0x60')][_0xbd09('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0xbd09('0x72')](_0x10436[_0xbd09('0x60')]['cservice'])){if(_0x10436[_0xbd09('0x60')][_0xbd09('0x75')]){_0x23285b[_0xbd09('0x3f')][_0xbd09('0x76')]=_0x23285b[_0xbd09('0x41')][_0xbd09('0x76')]=_0x10436[_0xbd09('0x60')][_0xbd09('0x77')];_0x23285b[_0xbd09('0x3f')][_0xbd09('0x78')]=_0x23285b[_0xbd09('0x41')]['pass']=_0x10436[_0xbd09('0x60')][_0xbd09('0x79')];}else{_0x23285b[_0xbd09('0x3f')][_0xbd09('0x7a')]=_0x23285b[_0xbd09('0x41')][_0xbd09('0x7a')]=![];}_0x23285b[_0xbd09('0x3f')][_0xbd09('0x7b')]=_0x10436[_0xbd09('0x60')]['Imap'][_0xbd09('0x7b')];_0x23285b[_0xbd09('0x3f')][_0xbd09('0x7c')]=_0x10436['body'][_0xbd09('0x3f')]['port'];_0x23285b[_0xbd09('0x41')][_0xbd09('0x7b')]=_0x10436[_0xbd09('0x60')][_0xbd09('0x41')][_0xbd09('0x7b')];_0x23285b[_0xbd09('0x41')][_0xbd09('0x7c')]=_0x10436[_0xbd09('0x60')][_0xbd09('0x41')][_0xbd09('0x7c')];}else{_0x23285b[_0xbd09('0x3f')]['service']=_0x23285b[_0xbd09('0x41')][_0xbd09('0x7d')]=_0x10436[_0xbd09('0x60')]['cservice'];_0x23285b[_0xbd09('0x3f')][_0xbd09('0x76')]=_0x23285b[_0xbd09('0x41')]['user']=_0x10436[_0xbd09('0x60')][_0xbd09('0x77')];_0x23285b['Imap'][_0xbd09('0x78')]=_0x23285b['Smtp'][_0xbd09('0x7e')]=_0x10436[_0xbd09('0x60')][_0xbd09('0x79')];}return db[_0xbd09('0x5a')]['create'](_0x23285b,{'include':[{'model':db[_0xbd09('0x40')],'as':_0xbd09('0x41')},{'model':db[_0xbd09('0x3e')],'as':_0xbd09('0x3f')}]})[_0xbd09('0x23')](function(_0x451c19){var _0x25418c=_0x10436[_0xbd09('0x76')][_0xbd09('0x38')]({'plain':!![]});if(!_0x25418c)throw new Error(_0xbd09('0x7f'));if(_0x25418c[_0xbd09('0x80')]===_0xbd09('0x76')){var _0x577ec6=_0x451c19[_0xbd09('0x38')]({'plain':!![]});return db[_0xbd09('0x81')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x25418c[_0xbd09('0x82')]},'raw':!![]})[_0xbd09('0x23')](function(_0x209207){if(_0x209207&&_0x209207[_0xbd09('0x83')]===0x0){return db[_0xbd09('0x39')][_0xbd09('0x6c')]({'name':_0x577ec6[_0xbd09('0x3b')],'resourceId':_0x577ec6['id'],'type':_0x209207[_0xbd09('0x3b')],'sectionId':_0x209207['id']},{})[_0xbd09('0x23')](function(){return _0x451c19;});}else{return _0x451c19;}})['catch'](function(_0x46f292){logger[_0xbd09('0x2a')](_0xbd09('0x84'),_0x46f292);throw _0x46f292;});}return _0x451c19;})[_0xbd09('0x23')](respondWithResult(_0x5ccfc8,0xc9))['catch'](handleError(_0x5ccfc8,null));};exports[_0xbd09('0x85')]=function(_0x2cf8f1,_0x5ed29d,_0x17e785){return db[_0xbd09('0x5a')][_0xbd09('0x68')]({'where':{'id':_0x2cf8f1[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x5ed29d,null))[_0xbd09('0x23')](function(_0x200224){if(_0x200224){return _0x200224[_0xbd09('0x85')]();}return null;})['then'](respondWithResult(_0x5ed29d,null))[_0xbd09('0x2e')](handleError(_0x5ed29d,null));};exports['addImap']=function(_0x33eab8,_0x43940e,_0x3eda58){if(_0x33eab8[_0xbd09('0x60')]['id']){delete _0x33eab8[_0xbd09('0x60')]['id'];}return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x33eab8[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x43940e,null))[_0xbd09('0x23')](function(_0x272cdf){if(_0x272cdf){_0x33eab8[_0xbd09('0x60')][_0xbd09('0x65')]=_0x272cdf['id'];return db['MailServerIn'][_0xbd09('0x6c')](_0x33eab8['body']);}})[_0xbd09('0x23')](respondWithResult(_0x43940e,null))[_0xbd09('0x2e')](handleError(_0x43940e,null));};exports[_0xbd09('0x86')]=function(_0x12e4ec,_0x13413c,_0x743ba9){return db[_0xbd09('0x5a')]['findOne']({'where':{'id':_0x12e4ec[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x13413c,null))[_0xbd09('0x23')](function(_0x2b5199){if(_0x2b5199){return _0x2b5199['setImap'](null);}return null;})[_0xbd09('0x23')](respondWithStatusCode(_0x13413c,null))['catch'](handleError(_0x13413c,null));};exports[_0xbd09('0x87')]=function(_0x566e82,_0xaf49dd,_0x104c72){return db[_0xbd09('0x5a')][_0xbd09('0x68')]({'where':{'id':_0x566e82[_0xbd09('0x61')]['id']}})['then'](handleEntityNotFound(_0xaf49dd,null))['then'](function(_0x5d4704){if(_0x5d4704){return _0x5d4704['getSmtp']();}return null;})[_0xbd09('0x23')](respondWithResult(_0xaf49dd,null))['catch'](handleError(_0xaf49dd,null));};exports[_0xbd09('0x88')]=function(_0x478103,_0x5b3274,_0x18a0c0){if(_0x478103[_0xbd09('0x60')]['id']){delete _0x478103[_0xbd09('0x60')]['id'];}return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x478103['params']['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x5b3274,null))[_0xbd09('0x23')](function(_0x53becb){if(_0x53becb){_0x478103['body'][_0xbd09('0x65')]=_0x53becb['id'];return db['MailServerOut'][_0xbd09('0x6c')](_0x478103[_0xbd09('0x60')]);}})[_0xbd09('0x23')](respondWithResult(_0x5b3274,null))[_0xbd09('0x2e')](handleError(_0x5b3274,null));};exports[_0xbd09('0x89')]=function(_0x2feff1,_0x53148e,_0x8f7a8b){return db[_0xbd09('0x5a')][_0xbd09('0x68')]({'where':{'id':_0x2feff1[_0xbd09('0x61')]['id']}})['then'](handleEntityNotFound(_0x53148e,null))[_0xbd09('0x23')](function(_0x5068f6){if(_0x5068f6){return _0x5068f6['setSmtp'](null);}return null;})[_0xbd09('0x23')](respondWithStatusCode(_0x53148e,null))[_0xbd09('0x2e')](handleError(_0x53148e,null));};exports[_0xbd09('0x8a')]=function(_0x2d0464,_0x335154,_0x4f96ad){return db[_0xbd09('0x8b')]['find']({'where':{'id':_0x2d0464[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x335154,null))['then'](function(_0x37160e){if(_0x37160e){return _0x37160e[_0xbd09('0x8a')](_0x2d0464['body'][_0xbd09('0x6b')],_[_0xbd09('0x8c')](_0x2d0464['body'],[_0xbd09('0x6b'),'id'])||{});}})[_0xbd09('0x23')](respondWithResult(_0x335154,null))[_0xbd09('0x2e')](handleError(_0x335154,null));};exports[_0xbd09('0x8d')]=function(_0x196c2b,_0x3dc15c,_0x3e624d){var _0x2769d7={'raw':![],'where':{}};var _0xbd6302={};var _0x52a32f={'count':0x0,'rows':[]};return db['MailAccount'][_0xbd09('0x68')]({'where':{'id':_0x196c2b[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x3dc15c,null))['then'](function(_0x2a4483){if(_0x2a4483){_0xbd6302[_0xbd09('0x4c')]=_[_0xbd09('0x48')](db['MailInteraction']['rawAttributes']);_0xbd6302[_0xbd09('0x49')]=_[_0xbd09('0x48')](_0x196c2b['query']);_0xbd6302['filters']=_[_0xbd09('0x4b')](_0xbd6302[_0xbd09('0x4c')],_0xbd6302['query']);_0x2769d7['attributes']=_[_0xbd09('0x4b')](_0xbd6302[_0xbd09('0x4c')],qs['fields'](_0x196c2b[_0xbd09('0x49')][_0xbd09('0x4d')]));_0x2769d7['attributes']=_0x2769d7[_0xbd09('0x4e')][_0xbd09('0x4f')]?_0x2769d7['attributes']:_0xbd6302['model'];if(!_0x196c2b[_0xbd09('0x49')]['hasOwnProperty'](_0xbd09('0x50'))){_0x2769d7[_0xbd09('0x51')]=qs['limit'](_0x196c2b[_0xbd09('0x49')]['limit']);_0x2769d7[_0xbd09('0x33')]=qs[_0xbd09('0x33')](_0x196c2b[_0xbd09('0x49')][_0xbd09('0x33')]);}_0x2769d7[_0xbd09('0x52')]=qs[_0xbd09('0x53')](_0x196c2b[_0xbd09('0x49')]['sort']);_0x2769d7[_0xbd09('0x54')]=qs[_0xbd09('0x4a')](_[_0xbd09('0x55')](_0x196c2b[_0xbd09('0x49')],_0xbd6302['filters']));_0x2769d7[_0xbd09('0x54')][_0xbd09('0x65')]=_0x2a4483['id'];if(_0x196c2b[_0xbd09('0x49')][_0xbd09('0x58')]){_0x2769d7[_0xbd09('0x54')]=_[_0xbd09('0x56')](_0x2769d7[_0xbd09('0x54')],{'$or':_[_0xbd09('0x44')](_0x2769d7['attributes'],function(_0x1b3383){var _0x1770f4={};_0x1770f4[_0x1b3383]={'$like':'%'+_0x196c2b[_0xbd09('0x49')][_0xbd09('0x58')]+'%'};return _0x1770f4;})});}_0x2769d7=_['merge']({},_0x2769d7,_0x196c2b[_0xbd09('0x59')]);return db[_0xbd09('0x8b')][_0xbd09('0x32')]({'where':_0x2769d7['where']})['then'](function(_0x21332d){_0x52a32f['count']=_0x21332d;if(_0x196c2b[_0xbd09('0x49')][_0xbd09('0x5b')]){_0x2769d7[_0xbd09('0x5c')]=[{'model':db[_0xbd09('0x8e')],'as':_0xbd09('0x8f'),'required':![]},{'model':db['User'],'as':_0xbd09('0x90'),'attributes':['name',_0xbd09('0x91'),'internal'],'required':![]},{'model':db[_0xbd09('0x92')],'as':_0xbd09('0x93'),'attributes':['id',_0xbd09('0x3b'),_0xbd09('0x94')],'where':_0x196c2b['query'][_0xbd09('0x95')]?{'id':_0x196c2b[_0xbd09('0x49')][_0xbd09('0x95')]}:undefined,'required':_0x196c2b[_0xbd09('0x49')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xbd09('0x5d')](_0x2769d7);})[_0xbd09('0x23')](function(_0x2d8450){_0x52a32f[_0xbd09('0x5e')]=_0x2d8450;return _0x52a32f;});}})[_0xbd09('0x23')](respondWithFilteredResult(_0x3dc15c,_0x2769d7))[_0xbd09('0x2e')](handleError(_0x3dc15c,null));};exports['addApplications']=function(_0x1f2afd,_0x7d5f91,_0x183146){return db[_0xbd09('0x5a')][_0xbd09('0x68')]({'where':{'id':_0x1f2afd[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x7d5f91,null))[_0xbd09('0x23')](function(_0x328a4f){if(_0x328a4f){return db[_0xbd09('0x96')][_0xbd09('0x97')](function(_0x5e0539){return db[_0xbd09('0x98')][_0xbd09('0x37')]({'where':{'MailAccountId':_0x1f2afd[_0xbd09('0x61')]['id']},'transaction':_0x5e0539})[_0xbd09('0x23')](function(_0x568c40){var _0x3e3efa=_[_0xbd09('0x44')](_0x1f2afd[_0xbd09('0x60')],function(_0x172655){_0x172655['MailAccountId']=_0x1f2afd[_0xbd09('0x61')]['id'];return _0x172655;});return db[_0xbd09('0x98')][_0xbd09('0x99')](_0x3e3efa,{'transaction':_0x5e0539});});})[_0xbd09('0x23')](function(){return db[_0xbd09('0x98')]['findAndCountAll']({'where':{'MailAccountId':_0x1f2afd[_0xbd09('0x61')]['id']},'order':_0xbd09('0x9a')});});}})[_0xbd09('0x23')](respondWithResult(_0x7d5f91,null))[_0xbd09('0x2e')](handleError(_0x7d5f91,null));};exports[_0xbd09('0x9b')]=function(_0x5726af,_0x4bcddc,_0x2fc0b3){var _0x4004f1={};var _0x584bbb={};var _0x1c67d5;var _0x41fcc2;return db[_0xbd09('0x5a')]['findOne']({'where':{'id':_0x5726af[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x4bcddc,null))['then'](function(_0x2e2588){if(_0x2e2588){_0x1c67d5=_0x2e2588;_0x584bbb[_0xbd09('0x4c')]=_[_0xbd09('0x48')](db[_0xbd09('0x98')][_0xbd09('0x45')]);_0x584bbb['query']=_[_0xbd09('0x48')](_0x5726af[_0xbd09('0x49')]);_0x584bbb['filters']=_[_0xbd09('0x4b')](_0x584bbb[_0xbd09('0x4c')],_0x584bbb[_0xbd09('0x49')]);_0x4004f1[_0xbd09('0x4e')]=_[_0xbd09('0x4b')](_0x584bbb[_0xbd09('0x4c')],qs[_0xbd09('0x4d')](_0x5726af[_0xbd09('0x49')][_0xbd09('0x4d')]));_0x4004f1[_0xbd09('0x4e')]=_0x4004f1[_0xbd09('0x4e')]['length']?_0x4004f1['attributes']:_0x584bbb[_0xbd09('0x4c')];_0x4004f1[_0xbd09('0x52')]=qs['sort'](_0x5726af['query'][_0xbd09('0x53')]);_0x4004f1[_0xbd09('0x54')]=qs['filters'](_[_0xbd09('0x55')](_0x5726af[_0xbd09('0x49')],_0x584bbb[_0xbd09('0x4a')]));if(_0x5726af[_0xbd09('0x49')][_0xbd09('0x58')]){_0x4004f1[_0xbd09('0x54')]=_[_0xbd09('0x56')](_0x4004f1[_0xbd09('0x54')],{'$or':_[_0xbd09('0x44')](_0x4004f1[_0xbd09('0x4e')],function(_0x306a0a){var _0x2a0387={};_0x2a0387[_0x306a0a]={'$like':'%'+_0x5726af['query'][_0xbd09('0x58')]+'%'};return _0x2a0387;})});}_0x4004f1=_[_0xbd09('0x56')]({},_0x4004f1,_0x5726af['options']);return _0x1c67d5[_0xbd09('0x9b')](_0x4004f1);}})[_0xbd09('0x23')](function(_0x187e25){if(_0x187e25){_0x41fcc2=_0x187e25[_0xbd09('0x4f')];if(!_0x5726af[_0xbd09('0x49')]['hasOwnProperty'](_0xbd09('0x50'))){_0x4004f1[_0xbd09('0x51')]=qs[_0xbd09('0x51')](_0x5726af[_0xbd09('0x49')][_0xbd09('0x51')]);_0x4004f1['offset']=qs[_0xbd09('0x33')](_0x5726af['query']['offset']);}return _0x1c67d5['getApplications'](_0x4004f1);}})[_0xbd09('0x23')](function(_0x59d346){if(_0x59d346){return _0x59d346?{'count':_0x41fcc2,'rows':_0x59d346}:null;}})[_0xbd09('0x23')](respondWithResult(_0x4bcddc,null))[_0xbd09('0x2e')](handleError(_0x4bcddc,null));};exports[_0xbd09('0x9c')]=function(_0x506573,_0x44048e,_0x509811){var _0x5eb5f6={'raw':!![],'where':{}};var _0x2c4924={};var _0x1af3b9={'count':0x0,'rows':[]};return db['MailAccount'][_0xbd09('0x68')]({'where':{'id':_0x506573[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x44048e,null))[_0xbd09('0x23')](function(_0x4e0b71){if(_0x4e0b71){_0x2c4924[_0xbd09('0x4c')]=_[_0xbd09('0x48')](db['MailMessage']['rawAttributes']);_0x2c4924['query']=_[_0xbd09('0x48')](_0x506573[_0xbd09('0x49')]);_0x2c4924[_0xbd09('0x4a')]=_[_0xbd09('0x4b')](_0x2c4924[_0xbd09('0x4c')],_0x2c4924[_0xbd09('0x49')]);_0x5eb5f6[_0xbd09('0x4e')]=_[_0xbd09('0x4b')](_0x2c4924[_0xbd09('0x4c')],qs['fields'](_0x506573[_0xbd09('0x49')]['fields']));_0x5eb5f6[_0xbd09('0x4e')]=_0x5eb5f6[_0xbd09('0x4e')][_0xbd09('0x4f')]?_0x5eb5f6[_0xbd09('0x4e')]:_0x2c4924[_0xbd09('0x4c')];if(!_0x506573[_0xbd09('0x49')][_0xbd09('0x69')](_0xbd09('0x50'))){_0x5eb5f6[_0xbd09('0x51')]=qs['limit'](_0x506573[_0xbd09('0x49')][_0xbd09('0x51')]);_0x5eb5f6[_0xbd09('0x33')]=qs[_0xbd09('0x33')](_0x506573[_0xbd09('0x49')]['offset']);}_0x5eb5f6[_0xbd09('0x52')]=qs['sort'](_0x506573[_0xbd09('0x49')][_0xbd09('0x53')]);_0x5eb5f6[_0xbd09('0x54')]=qs['filters'](_[_0xbd09('0x55')](_0x506573[_0xbd09('0x49')],_0x2c4924[_0xbd09('0x4a')]));_0x5eb5f6['where'][_0xbd09('0x65')]=_0x4e0b71['id'];if(_0x506573[_0xbd09('0x49')]['filter']){_0x5eb5f6[_0xbd09('0x54')]=_[_0xbd09('0x56')](_0x5eb5f6[_0xbd09('0x54')],{'$or':_[_0xbd09('0x44')](_0x5eb5f6[_0xbd09('0x4e')],function(_0x51c1f5){var _0x1c68eb={};_0x1c68eb[_0x51c1f5]={'$like':'%'+_0x506573[_0xbd09('0x49')][_0xbd09('0x58')]+'%'};return _0x1c68eb;})});}if(_0x506573[_0xbd09('0x49')]['$gte']){var _0x5360c7=_0x506573[_0xbd09('0x49')]['$gte'][_0xbd09('0x9d')](',');var _0x1a03de={};_0x1a03de[_0x5360c7[0x0]]={'$gte':moment(_0x5360c7[0x1])[_0xbd09('0x9e')](_0xbd09('0x9f'))};_0x5eb5f6['where']=_[_0xbd09('0x56')](_0x5eb5f6[_0xbd09('0x54')],_0x1a03de);}_0x5eb5f6=_[_0xbd09('0x56')]({},_0x5eb5f6,_0x506573[_0xbd09('0x59')]);return db[_0xbd09('0xa0')]['count']({'where':_0x5eb5f6[_0xbd09('0x54')]})[_0xbd09('0x23')](function(_0x547cbd){_0x1af3b9[_0xbd09('0x32')]=_0x547cbd;if(_0x506573['query']['includeAll']){_0x5eb5f6[_0xbd09('0x5c')]=[{'all':!![]}];}return db[_0xbd09('0xa0')][_0xbd09('0x5d')](_0x5eb5f6);})[_0xbd09('0x23')](function(_0x5d30ce){_0x1af3b9[_0xbd09('0x5e')]=_0x5d30ce;return _0x1af3b9;});}})[_0xbd09('0x23')](respondWithFilteredResult(_0x44048e,_0x5eb5f6))['catch'](handleError(_0x44048e,null));};exports[_0xbd09('0x3c')]=function(_0x500f8b,_0x4c8d1a,_0x34e56b){var _0x33ab9d,_0x62409a={},_0x9952cb;if(_0x500f8b[_0xbd09('0x60')]['to']){_0x9952cb=_0x500f8b[_0xbd09('0x60')]['to'][_0xbd09('0x9d')](',')[0x0];}return db['MailAccount'][_0xbd09('0x5f')]({'where':{'id':_0x500f8b[_0xbd09('0x61')]['id']},'include':[{'model':db[_0xbd09('0xa1')],'as':_0xbd09('0xa2'),'include':[{'model':db[_0xbd09('0x8e')],'as':_0xbd09('0xa3'),'where':{'email':_0x9952cb},'limit':0x1,'order':[[_0xbd09('0xa4'),_0xbd09('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0xbd09('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4c8d1a,null))['then'](function(_0x184e15){if(_0x184e15){_0x33ab9d=_0x184e15;if(_0x184e15['Smtp']){if(_[_0xbd09('0x72')](_0x500f8b['body'][_0xbd09('0xa6')])){_0x500f8b[_0xbd09('0x60')][_0xbd09('0xa6')]=util[_0xbd09('0x9e')](_0xbd09('0xa7'),_0x184e15[_0xbd09('0x3b')],_0x184e15[_0xbd09('0x70')]||_0x184e15[_0xbd09('0x41')][_0xbd09('0x76')]);}if(_0x500f8b['body'][_0xbd09('0xa8')]&&_0x500f8b[_0xbd09('0x60')][_0xbd09('0xa8')][_0xbd09('0x4f')]){for(var _0x382c02=0x0;_0x382c02<_0x500f8b[_0xbd09('0x60')][_0xbd09('0xa8')][_0xbd09('0x4f')];_0x382c02+=0x1){_0x500f8b[_0xbd09('0x60')]['attachments'][_0x382c02]={'filename':_0x500f8b['body']['attachments'][_0x382c02][_0xbd09('0x3b')],'path':path[_0xbd09('0xa9')](config[_0xbd09('0xaa')],'server/files/attachments',_0x500f8b[_0xbd09('0x60')][_0xbd09('0xa8')][_0x382c02]['basename'])};}}var _0x572393={'tls':{'rejectUnauthorized':![]}};if(_[_0xbd09('0x72')](_0x184e15[_0xbd09('0x41')][_0xbd09('0x7d')])){if(_0x184e15[_0xbd09('0x41')]['authentication']){_0x572393[_0xbd09('0xab')]={'user':_0x184e15[_0xbd09('0x41')][_0xbd09('0x76')],'pass':_0x184e15[_0xbd09('0x41')][_0xbd09('0x7e')]};}_0x572393['host']=_0x184e15[_0xbd09('0x41')][_0xbd09('0x7b')];_0x572393['port']=_0x184e15['Smtp']['port'];_0x572393[_0xbd09('0xac')]=_0x184e15[_0xbd09('0x41')]['secure'];}else{_0x572393[_0xbd09('0x7d')]=_0x184e15[_0xbd09('0x41')]['service'];_0x572393['auth']={'user':_0x184e15[_0xbd09('0x41')]['user'],'pass':_0x184e15[_0xbd09('0x41')][_0xbd09('0x7e')]};}return respondWithRpcPromise('SendMail',_0xbd09('0xad'),{'account':_0x572393,'message':_0x500f8b[_0xbd09('0x60')]});}else{throw new Error(_0xbd09('0xae'));}}})[_0xbd09('0x23')](function(_0x29ef05){if(_0x29ef05){_0x62409a=_0x29ef05;if(_0x33ab9d[_0xbd09('0xa2')]){if(_0x33ab9d['List']['Contacts']['length']){return _0x33ab9d['List'][_0xbd09('0xa3')][0x0];}else{return db[_0xbd09('0x8e')][_0xbd09('0x6c')](_[_0xbd09('0xaf')](_0x500f8b[_0xbd09('0x60')],{'firstName':_0x500f8b[_0xbd09('0x60')]['to'],'email':_0x500f8b['body']['to'],'phone':_0x500f8b[_0xbd09('0x60')]['to'],'ListId':_0x33ab9d[_0xbd09('0x71')]}));}}else{throw new Error(_0xbd09('0xae'));}}})[_0xbd09('0x23')](function(_0x5d2219){if(_0x5d2219){var _0x3e59ae={'UserId':_0x500f8b[_0xbd09('0x76')]['id'],'ContactId':_0x5d2219['id'],'MailAccountId':_0x33ab9d['id'],'inReplyTo':_0x62409a[_0xbd09('0xb0')],'to':_0x500f8b[_0xbd09('0x60')][_0xbd09('0xa6')],'cc':_0x500f8b[_0xbd09('0x60')]['cc'],'subject':_0x500f8b[_0xbd09('0x60')][_0xbd09('0xb1')],'attach':_0x500f8b[_0xbd09('0x60')][_0xbd09('0xb2')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xbd09('0x9e')](_0xbd09('0x9f')),'lastMsgDirection':'out','lastMsgBody':_0x500f8b['body'][_0xbd09('0x60')],'Messages':[_[_0xbd09('0x56')](_0x500f8b[_0xbd09('0x60')],{'messageId':_0x62409a[_0xbd09('0xb0')],'sentAt':moment()[_0xbd09('0x9e')](_0xbd09('0x9f')),'read':!![],'MailAccountId':_0x33ab9d['id'],'UserId':_0x500f8b[_0xbd09('0x76')]['id'],'ContactId':_0x5d2219['id']})]};if(_0x500f8b[_0xbd09('0x60')]['Interaction']){_0x3e59ae=_[_0xbd09('0x56')](_0x3e59ae,_0x500f8b[_0xbd09('0x60')][_0xbd09('0xb3')]);}return db[_0xbd09('0x8b')]['create'](_0x3e59ae,{'include':[{'model':db['MailMessage'],'as':_0xbd09('0xb4')}]});}})[_0xbd09('0x23')](respondWithResult(_0x4c8d1a,null))['catch'](handleError(_0x4c8d1a,null));};exports[_0xbd09('0xb5')]=function(_0x9139c0,_0x17ed13,_0x812b0e){return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x9139c0['params']['id']},'include':[{'model':db[_0xbd09('0x40')],'as':_0xbd09('0x41'),'raw':!![]}]})[_0xbd09('0x23')](handleEntityNotFound(_0x17ed13,null))['then'](function(_0x3af6ce){if(_0x3af6ce&&_0x3af6ce[_0xbd09('0x41')]){var _0x2a9c33={'id':_0x3af6ce['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3af6ce[_0xbd09('0x41')][_0xbd09('0x7d')]){_0x2a9c33['service']=_0x3af6ce[_0xbd09('0x41')][_0xbd09('0x7d')];}else{_0x2a9c33[_0xbd09('0x7b')]=_0x3af6ce[_0xbd09('0x41')][_0xbd09('0x7b')];_0x2a9c33[_0xbd09('0x7c')]=_0x3af6ce['Smtp']['port'];_0x2a9c33[_0xbd09('0xac')]=_0x3af6ce[_0xbd09('0x41')][_0xbd09('0xac')];}if(_0x3af6ce['Smtp'][_0xbd09('0x7a')]){_0x2a9c33[_0xbd09('0xab')]={'user':_0x3af6ce['Smtp'][_0xbd09('0x76')],'pass':_0x3af6ce[_0xbd09('0x41')][_0xbd09('0x7e')]};}return respondWithRpcPromise(_0xbd09('0xb6'),_0xbd09('0xb5'),{'account':_0x2a9c33});}})[_0xbd09('0x23')](respondWithResult(_0x17ed13,null))[_0xbd09('0x2e')](handleError(_0x17ed13,null));};exports[_0xbd09('0x37')]=function(_0x2ab22c,_0x5c700a){return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x2ab22c[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x5c700a,null))[_0xbd09('0x23')](function(_0x49672e){if(_0x49672e&&_0x49672e['service']){throw new db['Sequelize']['ValidationError'](_0xbd09('0xb7'));}return _0x49672e;})[_0xbd09('0x23')](removeEntity(_0x5c700a,null))[_0xbd09('0x2e')](handleError(_0x5c700a,null));};exports['addAgents']=function(_0x5e23a6,_0x1f645f,_0x115180){return db['MailAccount'][_0xbd09('0x5f')]({'where':{'id':_0x5e23a6[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x1f645f,null))[_0xbd09('0x23')](function(_0x38b3a1){if(_0x38b3a1){return _0x38b3a1[_0xbd09('0xb8')](_0x5e23a6['body'][_0xbd09('0x6b')],_[_0xbd09('0x8c')](_0x5e23a6[_0xbd09('0x60')],[_0xbd09('0x6b'),'id'])||{})[_0xbd09('0xb9')](function(_0x8b87a1){for(var _0x2e300d=0x0;_0x2e300d<_0x5e23a6[_0xbd09('0x60')][_0xbd09('0x6b')][_0xbd09('0x4f')];_0x2e300d+=0x1){socket[_0xbd09('0xba')]('userMailAccount:save',{'UserId':_0x5e23a6[_0xbd09('0x60')][_0xbd09('0x6b')][_0x2e300d],'MailAccountId':_0x5e23a6[_0xbd09('0x61')]['id']});}return _0x8b87a1;});}})[_0xbd09('0x23')](respondWithResult(_0x1f645f,null))[_0xbd09('0x2e')](handleError(_0x1f645f,null));};exports['removeAgents']=function(_0x3bc934,_0x2c747a,_0x168386){return db[_0xbd09('0x5a')][_0xbd09('0x5f')]({'where':{'id':_0x3bc934[_0xbd09('0x61')]['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x2c747a,null))[_0xbd09('0x23')](function(_0x1f3714){if(_0x1f3714){return _0x1f3714['removeAgents'](_0x3bc934[_0xbd09('0x49')]['ids'])[_0xbd09('0x23')](function(){if(_[_0xbd09('0xbb')](_0x3bc934[_0xbd09('0x49')][_0xbd09('0x6b')])){for(var _0x65d0d6=0x0;_0x65d0d6<_0x3bc934[_0xbd09('0x49')][_0xbd09('0x6b')][_0xbd09('0x4f')];_0x65d0d6+=0x1){socket[_0xbd09('0xba')]('userMailAccount:remove',{'UserId':Number(_0x3bc934[_0xbd09('0x49')][_0xbd09('0x6b')][_0x65d0d6]),'MailAccountId':Number(_0x3bc934[_0xbd09('0x61')]['id'])});}}else{socket['emit'](_0xbd09('0xbc'),{'UserId':Number(_0x3bc934[_0xbd09('0x49')][_0xbd09('0x6b')]),'MailAccountId':Number(_0x3bc934[_0xbd09('0x61')]['id'])});}});}})[_0xbd09('0x23')](respondWithStatusCode(_0x2c747a,null))['catch'](handleError(_0x2c747a,null));};exports['getAgents']=function(_0x4320c6,_0x3bd155,_0x31a1b0){var _0x4809eb={};var _0x8b7e3e={};var _0xd3886a;var _0xae7c85;return db[_0xbd09('0x5a')][_0xbd09('0x68')]({'where':{'id':_0x4320c6['params']['id']}})[_0xbd09('0x23')](handleEntityNotFound(_0x3bd155,null))[_0xbd09('0x23')](function(_0x2ac49d){if(_0x2ac49d){_0xd3886a=_0x2ac49d;_0x8b7e3e[_0xbd09('0x4c')]=_['keys'](db[_0xbd09('0xbd')]['rawAttributes']);_0x8b7e3e[_0xbd09('0x49')]=_[_0xbd09('0x48')](_0x4320c6[_0xbd09('0x49')]);_0x8b7e3e[_0xbd09('0x4a')]=_[_0xbd09('0x4b')](_0x8b7e3e['model'],_0x8b7e3e[_0xbd09('0x49')]);_0x4809eb['attributes']=_[_0xbd09('0x4b')](_0x8b7e3e['model'],qs[_0xbd09('0x4d')](_0x4320c6[_0xbd09('0x49')][_0xbd09('0x4d')]));_0x4809eb['attributes']=_0x4809eb['attributes'][_0xbd09('0x4f')]?_0x4809eb[_0xbd09('0x4e')]:_0x8b7e3e[_0xbd09('0x4c')];_0x4809eb['order']=qs[_0xbd09('0x53')](_0x4320c6['query'][_0xbd09('0x53')]);_0x4809eb[_0xbd09('0x54')]=qs[_0xbd09('0x4a')](_[_0xbd09('0x55')](_0x4320c6[_0xbd09('0x49')],_0x8b7e3e[_0xbd09('0x4a')]));if(_0x4320c6['query'][_0xbd09('0x58')]){_0x4809eb['where']=_['merge'](_0x4809eb[_0xbd09('0x54')],{'$or':_['map'](_0x4809eb['attributes'],function(_0x2f6cb8){var _0x234495={};_0x234495[_0x2f6cb8]={'$like':'%'+_0x4320c6['query'][_0xbd09('0x58')]+'%'};return _0x234495;})});}_0x4809eb=_['merge']({},_0x4809eb,_0x4320c6[_0xbd09('0x59')]);return _0xd3886a[_0xbd09('0xbe')](_0x4809eb);}})['then'](function(_0x477d77){if(_0x477d77){_0xae7c85=_0x477d77[_0xbd09('0x4f')];if(!_0x4320c6[_0xbd09('0x49')][_0xbd09('0x69')]('nolimit')){_0x4809eb[_0xbd09('0x51')]=qs[_0xbd09('0x51')](_0x4320c6['query'][_0xbd09('0x51')]);_0x4809eb[_0xbd09('0x33')]=qs[_0xbd09('0x33')](_0x4320c6['query']['offset']);}return _0xd3886a[_0xbd09('0xbe')](_0x4809eb);}})[_0xbd09('0x23')](function(_0x15960a){if(_0x15960a){return _0x15960a?{'count':_0xae7c85,'rows':_0x15960a}:null;}})[_0xbd09('0x23')](respondWithResult(_0x3bd155,null))[_0xbd09('0x2e')](handleError(_0x3bd155,null));}; \ No newline at end of file +var _0x5b68=['catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','end','stack','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','Imap','Smtp','keys','length','includeAll','find','body','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','isNil','active','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','split','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3f81cf,_0x5691d1){var _0x1a6e6b=function(_0x1bf493){while(--_0x1bf493){_0x3f81cf['push'](_0x3f81cf['shift']());}};_0x1a6e6b(++_0x5691d1);}(_0x5b68,0x99));var _0x85b6=function(_0x358f97,_0x2471e7){_0x358f97=_0x358f97-0x0;var _0x253cf3=_0x5b68[_0x358f97];return _0x253cf3;};'use strict';var pdf=require(_0x85b6('0x0'));var emlformat=require(_0x85b6('0x1'));var rimraf=require(_0x85b6('0x2'));var zipdir=require(_0x85b6('0x3'));var jsonpatch=require(_0x85b6('0x4'));var rp=require('request-promise');var moment=require(_0x85b6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x85b6('0x6'));var path=require(_0x85b6('0x7'));var sox=require(_0x85b6('0x8'));var csv=require(_0x85b6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x85b6('0xa'));var squel=require('squel');var crypto=require(_0x85b6('0xb'));var jsforce=require(_0x85b6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x85b6('0xd'));var Papa=require(_0x85b6('0xe'));var Redis=require('ioredis');var authService=require(_0x85b6('0xf'));var qs=require(_0x85b6('0x10'));var as=require(_0x85b6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85b6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x85b6('0x13'));var db=require(_0x85b6('0x14'))['db'];config[_0x85b6('0x15')]=_[_0x85b6('0x16')](config[_0x85b6('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85b6('0x15')]));require(_0x85b6('0x17'))[_0x85b6('0x18')](socket);var jayson=require(_0x85b6('0x19'));var client=jayson[_0x85b6('0x1a')]['http']({'port':0x232b});function checkPasswordPattern(_0xe24269,_0x3b305c,_0x56c27c){if(_0x56c27c){var _0x324d05=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x324d05[_0x85b6('0x1b')](_0x3b305c)){return _0xe24269;}else{throw new db[(_0x85b6('0x1c'))][(_0x85b6('0x1d'))](_0x85b6('0x1e'));}}else{return _0xe24269;}}function respondWithRpcPromise(_0x44abb7,_0x3c5e6a,_0x3a7ff4,_0x3b32eb){return new BPromise(function(_0x4ff68f,_0x1494db){var _0x390587=_0x3b32eb||client;return _0x390587['request'](_0x44abb7,_0x3a7ff4)[_0x85b6('0x1f')](function(_0x510b5d){logger[_0x85b6('0x20')](_0x85b6('0x21'),_0x3c5e6a,_0x85b6('0x22'));logger[_0x85b6('0x23')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3c5e6a,_0x85b6('0x22'),JSON[_0x85b6('0x24')](_0x510b5d));if(_0x510b5d[_0x85b6('0x25')]){if(_0x510b5d[_0x85b6('0x25')][_0x85b6('0x26')]===0x1f4){logger[_0x85b6('0x25')](_0x85b6('0x21'),_0x3c5e6a,_0x510b5d[_0x85b6('0x25')][_0x85b6('0x27')]);return _0x1494db(_0x510b5d[_0x85b6('0x25')][_0x85b6('0x27')]);}logger[_0x85b6('0x25')](_0x85b6('0x21'),_0x3c5e6a,_0x510b5d[_0x85b6('0x25')][_0x85b6('0x27')]);return _0x4ff68f(_0x510b5d[_0x85b6('0x25')][_0x85b6('0x27')]);}else{logger[_0x85b6('0x20')](_0x85b6('0x21'),_0x3c5e6a,_0x85b6('0x22'));_0x4ff68f(_0x510b5d['result'][_0x85b6('0x27')]);}})[_0x85b6('0x28')](function(_0x1d4995){logger['error'](_0x85b6('0x21'),_0x3c5e6a,_0x1d4995);_0x1494db(_0x1d4995);});});}function respondWithStatusCode(_0x595154,_0x50934c){_0x50934c=_0x50934c||0xcc;return function(_0x5723d3){if(_0x5723d3){return _0x595154[_0x85b6('0x29')](_0x50934c);}return _0x595154['status'](_0x50934c)['end']();};}function respondWithResult(_0x4c19e,_0x6b2947){_0x6b2947=_0x6b2947||0xc8;return function(_0x3303d9){if(_0x3303d9){return _0x4c19e[_0x85b6('0x2a')](_0x6b2947)['json'](_0x3303d9);}};}function respondWithFilteredResult(_0x188bea,_0x59339c){return function(_0x168877){if(_0x168877){var _0x22ba48=_0x168877[_0x85b6('0x2b')],_0x5a2428=_0x59339c['offset'],_0x3df710=_0x59339c[_0x85b6('0x2c')]+_0x59339c[_0x85b6('0x2d')],_0x149514;if(_0x3df710>=_0x22ba48){_0x3df710=_0x22ba48;_0x149514=0xc8;}else{_0x149514=0xce;}_0x188bea['status'](_0x149514);return _0x188bea[_0x85b6('0x2e')](_0x85b6('0x2f'),_0x5a2428+'-'+_0x3df710+'/'+_0x22ba48)[_0x85b6('0x30')](_0x168877);}return null;};}function patchUpdates(_0x203f8e){return function(_0x5d0dd0){try{jsonpatch[_0x85b6('0x31')](_0x5d0dd0,_0x203f8e,!![]);}catch(_0xf05e2e){return BPromise[_0x85b6('0x32')](_0xf05e2e);}return _0x5d0dd0[_0x85b6('0x33')]();};}function saveUpdates(_0x5087a7,_0x2014bb){return function(_0x4d5dc5){if(_0x4d5dc5){return _0x4d5dc5[_0x85b6('0x34')](_0x5087a7)[_0x85b6('0x1f')](function(_0x32f33a){return _0x32f33a;});}return null;};}function removeEntity(_0x5d5cae,_0x35a11b){return function(_0x31eeef){if(_0x31eeef){return _0x31eeef[_0x85b6('0x35')]()[_0x85b6('0x1f')](function(){var _0x530782=_0x31eeef[_0x85b6('0x36')]({'plain':!![]});var _0x51358e=_0x85b6('0x37');return db[_0x85b6('0x38')][_0x85b6('0x35')]({'where':{'type':_0x51358e,'resourceId':_0x530782['id']}})[_0x85b6('0x1f')](function(){return _0x31eeef;});})[_0x85b6('0x1f')](function(){_0x5d5cae[_0x85b6('0x2a')](0xcc)[_0x85b6('0x39')]();});}};}function handleEntityNotFound(_0x719a4d,_0x112cac){return function(_0x1a6658){if(!_0x1a6658){_0x719a4d['sendStatus'](0x194);}return _0x1a6658;};}function handleError(_0x27a5f4,_0x1af070){_0x1af070=_0x1af070||0x1f4;return function(_0x268f37){logger[_0x85b6('0x25')](_0x268f37[_0x85b6('0x3a')]);if(_0x268f37['name']){delete _0x268f37['name'];}_0x27a5f4[_0x85b6('0x2a')](_0x1af070)['send'](_0x268f37);};}exports['index']=function(_0x2a05d4,_0x1345a7){var _0x10f577={'include':[{'model':db[_0x85b6('0x3b')],'as':'Imap'},{'model':db[_0x85b6('0x3c')],'as':'Smtp'},{'model':db[_0x85b6('0x3d')],'as':_0x85b6('0x3e')}]},_0x2dc0c8={},_0x2db89b={'count':0x0,'rows':[]};var _0x1e8962=_[_0x85b6('0x3f')](db[_0x85b6('0x40')][_0x85b6('0x41')],function(_0x3e87f2){return{'name':_0x3e87f2['fieldName'],'type':_0x3e87f2[_0x85b6('0x42')][_0x85b6('0x43')]};});_0x2dc0c8[_0x85b6('0x44')]=_['map'](_0x1e8962,_0x85b6('0x45'));_0x2dc0c8[_0x85b6('0x46')]=_['keys'](_0x2a05d4[_0x85b6('0x46')]);_0x2dc0c8[_0x85b6('0x47')]=_[_0x85b6('0x48')](_0x2dc0c8[_0x85b6('0x44')],_0x2dc0c8[_0x85b6('0x46')]);_0x10f577[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x2dc0c8['model'],qs[_0x85b6('0x4a')](_0x2a05d4[_0x85b6('0x46')][_0x85b6('0x4a')]));_0x10f577[_0x85b6('0x49')]=_0x10f577['attributes']['length']?_0x10f577[_0x85b6('0x49')]:_0x2dc0c8[_0x85b6('0x44')];if(!_0x2a05d4[_0x85b6('0x46')][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x10f577['limit']=qs[_0x85b6('0x2d')](_0x2a05d4[_0x85b6('0x46')][_0x85b6('0x2d')]);_0x10f577[_0x85b6('0x2c')]=qs[_0x85b6('0x2c')](_0x2a05d4[_0x85b6('0x46')][_0x85b6('0x2c')]);}_0x10f577[_0x85b6('0x4d')]=qs[_0x85b6('0x4e')](_0x2a05d4[_0x85b6('0x46')]['sort']);_0x10f577[_0x85b6('0x4f')]=qs['filters'](_[_0x85b6('0x50')](_0x2a05d4[_0x85b6('0x46')],_0x2dc0c8[_0x85b6('0x47')]),_0x1e8962);if(_0x2a05d4[_0x85b6('0x46')][_0x85b6('0x51')]){_0x10f577[_0x85b6('0x4f')]=_[_0x85b6('0x52')](_0x10f577[_0x85b6('0x4f')],{'$or':_[_0x85b6('0x3f')](_0x1e8962,function(_0x436929){if(_0x436929[_0x85b6('0x42')]!==_0x85b6('0x53')){var _0x1d4f3b={};_0x1d4f3b[_0x436929[_0x85b6('0x45')]]={'$like':'%'+_0x2a05d4[_0x85b6('0x46')][_0x85b6('0x51')]+'%'};return _0x1d4f3b;}})});}_0x10f577=_['merge']({},_0x10f577,_0x2a05d4[_0x85b6('0x54')]);var _0x93f4ba={'where':_0x10f577[_0x85b6('0x4f')]};return db[_0x85b6('0x40')][_0x85b6('0x2b')](_0x93f4ba)[_0x85b6('0x1f')](function(_0x2f0237){_0x2db89b['count']=_0x2f0237;if(_0x2a05d4['query']['includeAll']){_0x10f577[_0x85b6('0x55')]=[{'all':!![]}];}return db[_0x85b6('0x40')][_0x85b6('0x56')](_0x10f577);})[_0x85b6('0x1f')](function(_0x4ea1f8){_0x2db89b[_0x85b6('0x57')]=_0x4ea1f8;return _0x2db89b;})[_0x85b6('0x1f')](respondWithFilteredResult(_0x1345a7,_0x10f577))['catch'](handleError(_0x1345a7,null));};exports['show']=function(_0x217f98,_0x4573a4){var _0x34e8ce={'raw':![],'where':{'id':_0x217f98[_0x85b6('0x58')]['id']},'include':[{'model':db[_0x85b6('0x3b')],'as':_0x85b6('0x59')},{'model':db['MailServerOut'],'as':_0x85b6('0x5a')},{'model':db['Pause'],'as':_0x85b6('0x3e')}]},_0x5d4ca2={};_0x5d4ca2['model']=_[_0x85b6('0x5b')](db['MailAccount']['rawAttributes']);_0x5d4ca2['query']=_['keys'](_0x217f98[_0x85b6('0x46')]);_0x5d4ca2['filters']=_[_0x85b6('0x48')](_0x5d4ca2['model'],_0x5d4ca2[_0x85b6('0x46')]);_0x34e8ce[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x5d4ca2[_0x85b6('0x44')],qs[_0x85b6('0x4a')](_0x217f98[_0x85b6('0x46')][_0x85b6('0x4a')]));_0x34e8ce[_0x85b6('0x49')]=_0x34e8ce[_0x85b6('0x49')][_0x85b6('0x5c')]?_0x34e8ce[_0x85b6('0x49')]:_0x5d4ca2[_0x85b6('0x44')];if(_0x217f98[_0x85b6('0x46')][_0x85b6('0x5d')]){_0x34e8ce['include']=[{'all':!![]}];}_0x34e8ce=_[_0x85b6('0x52')]({},_0x34e8ce,_0x217f98[_0x85b6('0x54')]);return db['MailAccount'][_0x85b6('0x5e')](_0x34e8ce)[_0x85b6('0x1f')](handleEntityNotFound(_0x4573a4,null))[_0x85b6('0x1f')](respondWithResult(_0x4573a4,null))[_0x85b6('0x28')](handleError(_0x4573a4,null));};exports[_0x85b6('0x34')]=function(_0x2b9255,_0x1bf6a9){if(_0x2b9255[_0x85b6('0x5f')]['id']){delete _0x2b9255[_0x85b6('0x5f')]['id'];}return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x2b9255[_0x85b6('0x58')]['id']},'include':[{'model':db[_0x85b6('0x3b')],'as':'Imap'},{'model':db[_0x85b6('0x3c')],'as':_0x85b6('0x5a')},{'model':db[_0x85b6('0x3d')],'as':_0x85b6('0x3e')}]})[_0x85b6('0x1f')](handleEntityNotFound(_0x1bf6a9,null))[_0x85b6('0x1f')](saveUpdates(_0x2b9255[_0x85b6('0x5f')],null))[_0x85b6('0x1f')](function(_0x40ccb7){if(_0x40ccb7&&_0x2b9255['body'][_0x85b6('0x59')]){return db[_0x85b6('0x3b')]['update'](_0x2b9255[_0x85b6('0x5f')]['Imap'],{'where':{'MailAccountId':_0x40ccb7['id']}})[_0x85b6('0x1f')](function(){return _0x40ccb7;});}return _0x40ccb7;})[_0x85b6('0x1f')](function(_0x4450a1){if(_0x4450a1&&_0x2b9255['body'][_0x85b6('0x5a')]){return db[_0x85b6('0x3c')][_0x85b6('0x34')](_0x2b9255[_0x85b6('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x4450a1['id']}})['then'](function(){return _0x4450a1;});}return _0x4450a1;})['then'](respondWithResult(_0x1bf6a9,null))['catch'](handleError(_0x1bf6a9,null));};exports[_0x85b6('0x60')]=function(_0x1a96b7,_0x4cb93e){return db['MailAccount'][_0x85b6('0x60')]()[_0x85b6('0x1f')](respondWithResult(_0x4cb93e,null))[_0x85b6('0x28')](handleError(_0x4cb93e,null));};exports[_0x85b6('0x61')]=function(_0x4bc671,_0x31d585,_0x412bcb){if(_0x4bc671[_0x85b6('0x5f')]['id']){delete _0x4bc671['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x4bc671[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x31d585,null))[_0x85b6('0x1f')](function(_0x57cb12){if(_0x57cb12){_0x4bc671[_0x85b6('0x5f')][_0x85b6('0x62')]=_0x57cb12['id'];return db['Disposition'][_0x85b6('0x63')](_0x4bc671[_0x85b6('0x5f')]);}})[_0x85b6('0x1f')](respondWithResult(_0x31d585,null))[_0x85b6('0x28')](handleError(_0x31d585,null));};exports[_0x85b6('0x64')]=function(_0x20aa39,_0x256054,_0x3022a2){var _0x538521={'raw':![],'where':{}};var _0x3e4b79={};var _0x41ff5c={'count':0x0,'rows':[]};return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x20aa39[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x256054,null))[_0x85b6('0x1f')](function(_0x42ecdb){if(_0x42ecdb){_0x3e4b79[_0x85b6('0x44')]=_[_0x85b6('0x5b')](db[_0x85b6('0x66')][_0x85b6('0x41')]);_0x3e4b79['query']=_[_0x85b6('0x5b')](_0x20aa39[_0x85b6('0x46')]);_0x3e4b79[_0x85b6('0x47')]=_['intersection'](_0x3e4b79['model'],_0x3e4b79[_0x85b6('0x46')]);_0x538521[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x3e4b79[_0x85b6('0x44')],qs['fields'](_0x20aa39[_0x85b6('0x46')][_0x85b6('0x4a')]));_0x538521[_0x85b6('0x49')]=_0x538521['attributes'][_0x85b6('0x5c')]?_0x538521[_0x85b6('0x49')]:_0x3e4b79[_0x85b6('0x44')];if(!_0x20aa39[_0x85b6('0x46')][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x538521[_0x85b6('0x2d')]=qs[_0x85b6('0x2d')](_0x20aa39['query'][_0x85b6('0x2d')]);_0x538521[_0x85b6('0x2c')]=qs[_0x85b6('0x2c')](_0x20aa39[_0x85b6('0x46')][_0x85b6('0x2c')]);}_0x538521[_0x85b6('0x4d')]=qs['sort'](_0x20aa39[_0x85b6('0x46')]['sort']);_0x538521[_0x85b6('0x4f')]=qs['filters'](_[_0x85b6('0x50')](_0x20aa39[_0x85b6('0x46')],_0x3e4b79['filters']));_0x538521['where'][_0x85b6('0x62')]=_0x42ecdb['id'];if(_0x20aa39[_0x85b6('0x46')]['filter']){_0x538521[_0x85b6('0x4f')]=_[_0x85b6('0x52')](_0x538521[_0x85b6('0x4f')],{'$or':_[_0x85b6('0x3f')](_0x538521[_0x85b6('0x49')],function(_0x327736){var _0x132f42={};_0x132f42[_0x327736]={'$like':'%'+_0x20aa39['query'][_0x85b6('0x51')]+'%'};return _0x132f42;})});}_0x538521=_[_0x85b6('0x52')]({},_0x538521,_0x20aa39[_0x85b6('0x54')]);return db[_0x85b6('0x66')][_0x85b6('0x2b')]({'where':_0x538521[_0x85b6('0x4f')]})[_0x85b6('0x1f')](function(_0x40c2b4){_0x41ff5c[_0x85b6('0x2b')]=_0x40c2b4;if(_0x20aa39[_0x85b6('0x46')][_0x85b6('0x5d')]){_0x538521[_0x85b6('0x55')]=[{'all':!![]}];}return db[_0x85b6('0x66')]['findAll'](_0x538521);})[_0x85b6('0x1f')](function(_0x217c11){_0x41ff5c[_0x85b6('0x57')]=_0x217c11;return _0x41ff5c;});}})[_0x85b6('0x1f')](respondWithFilteredResult(_0x256054,_0x538521))[_0x85b6('0x28')](handleError(_0x256054,null));};exports[_0x85b6('0x67')]=function(_0x4ce2ef,_0x4f1033,_0xe66116){return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x4ce2ef[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x4f1033,null))[_0x85b6('0x1f')](function(_0x50886a){if(_0x50886a){return _0x50886a[_0x85b6('0x67')](_0x4ce2ef[_0x85b6('0x46')][_0x85b6('0x68')]);}})[_0x85b6('0x1f')](respondWithStatusCode(_0x4f1033,null))[_0x85b6('0x28')](handleError(_0x4f1033,null));};exports[_0x85b6('0x69')]=function(_0x501f9d,_0x5effae,_0x111ba1){if(_0x501f9d['body']['id']){delete _0x501f9d['body']['id'];}return db['MailAccount'][_0x85b6('0x5e')]({'where':{'id':_0x501f9d['params']['id']}})['then'](handleEntityNotFound(_0x5effae,null))[_0x85b6('0x1f')](function(_0x2092bd){if(_0x2092bd){_0x501f9d[_0x85b6('0x5f')][_0x85b6('0x62')]=_0x2092bd['id'];return db['CannedAnswer'][_0x85b6('0x63')](_0x501f9d[_0x85b6('0x5f')]);}})[_0x85b6('0x1f')](respondWithResult(_0x5effae,null))[_0x85b6('0x28')](handleError(_0x5effae,null));};exports[_0x85b6('0x6a')]=function(_0x5c7bae,_0x220e8c,_0x256925){var _0x50f11d={'raw':![],'where':{}};var _0x32bf00={};var _0x26e9f0={'count':0x0,'rows':[]};return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x5c7bae['params']['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x220e8c,null))[_0x85b6('0x1f')](function(_0x50071c){if(_0x50071c){_0x32bf00[_0x85b6('0x44')]=_[_0x85b6('0x5b')](db['CannedAnswer'][_0x85b6('0x41')]);_0x32bf00['query']=_[_0x85b6('0x5b')](_0x5c7bae[_0x85b6('0x46')]);_0x32bf00[_0x85b6('0x47')]=_[_0x85b6('0x48')](_0x32bf00[_0x85b6('0x44')],_0x32bf00['query']);_0x50f11d['attributes']=_[_0x85b6('0x48')](_0x32bf00[_0x85b6('0x44')],qs[_0x85b6('0x4a')](_0x5c7bae[_0x85b6('0x46')][_0x85b6('0x4a')]));_0x50f11d[_0x85b6('0x49')]=_0x50f11d[_0x85b6('0x49')][_0x85b6('0x5c')]?_0x50f11d[_0x85b6('0x49')]:_0x32bf00[_0x85b6('0x44')];if(!_0x5c7bae['query'][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x50f11d[_0x85b6('0x2d')]=qs[_0x85b6('0x2d')](_0x5c7bae[_0x85b6('0x46')][_0x85b6('0x2d')]);_0x50f11d[_0x85b6('0x2c')]=qs[_0x85b6('0x2c')](_0x5c7bae[_0x85b6('0x46')]['offset']);}_0x50f11d[_0x85b6('0x4d')]=qs['sort'](_0x5c7bae[_0x85b6('0x46')][_0x85b6('0x4e')]);_0x50f11d['where']=qs['filters'](_[_0x85b6('0x50')](_0x5c7bae[_0x85b6('0x46')],_0x32bf00[_0x85b6('0x47')]));_0x50f11d[_0x85b6('0x4f')][_0x85b6('0x62')]=_0x50071c['id'];if(_0x5c7bae[_0x85b6('0x46')][_0x85b6('0x51')]){_0x50f11d[_0x85b6('0x4f')]=_[_0x85b6('0x52')](_0x50f11d[_0x85b6('0x4f')],{'$or':_[_0x85b6('0x3f')](_0x50f11d[_0x85b6('0x49')],function(_0x57036e){var _0x59ee88={};_0x59ee88[_0x57036e]={'$like':'%'+_0x5c7bae['query']['filter']+'%'};return _0x59ee88;})});}_0x50f11d=_[_0x85b6('0x52')]({},_0x50f11d,_0x5c7bae[_0x85b6('0x54')]);return db['CannedAnswer']['count']({'where':_0x50f11d[_0x85b6('0x4f')]})[_0x85b6('0x1f')](function(_0x1d0b41){_0x26e9f0[_0x85b6('0x2b')]=_0x1d0b41;if(_0x5c7bae[_0x85b6('0x46')]['includeAll']){_0x50f11d['include']=[{'all':!![]}];}return db[_0x85b6('0x6b')][_0x85b6('0x56')](_0x50f11d);})[_0x85b6('0x1f')](function(_0x56fe37){_0x26e9f0['rows']=_0x56fe37;return _0x26e9f0;});}})[_0x85b6('0x1f')](respondWithFilteredResult(_0x220e8c,_0x50f11d))[_0x85b6('0x28')](handleError(_0x220e8c,null));};exports[_0x85b6('0x6c')]=function(_0x16375b,_0x563dba,_0x13e04e){return db[_0x85b6('0x40')]['find']({'where':{'id':_0x16375b[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x563dba,null))[_0x85b6('0x1f')](function(_0x388726){if(_0x388726){return _0x388726[_0x85b6('0x6c')](_0x16375b[_0x85b6('0x46')][_0x85b6('0x68')]);}})[_0x85b6('0x1f')](respondWithStatusCode(_0x563dba,null))[_0x85b6('0x28')](handleError(_0x563dba,null));};exports[_0x85b6('0x63')]=function(_0x344240,_0x165730){var _0x13b0ee={'name':_0x344240[_0x85b6('0x5f')][_0x85b6('0x45')],'key':_0x344240[_0x85b6('0x5f')][_0x85b6('0x43')],'email':_0x344240[_0x85b6('0x5f')][_0x85b6('0x6d')],'ListId':_0x344240[_0x85b6('0x5f')]['ListId'],'active':!_[_0x85b6('0x6e')](_0x344240['body'][_0x85b6('0x6f')])?_0x344240[_0x85b6('0x5f')]['active']:!![],'description':_0x344240[_0x85b6('0x5f')][_0x85b6('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x85b6('0x6e')](_0x344240['body'][_0x85b6('0x71')])){if(_0x344240[_0x85b6('0x5f')]['cauthentication']){_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x72')]=_0x13b0ee[_0x85b6('0x5a')]['user']=_0x344240[_0x85b6('0x5f')][_0x85b6('0x73')];_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x74')]=_0x13b0ee[_0x85b6('0x5a')][_0x85b6('0x75')]=_0x344240[_0x85b6('0x5f')][_0x85b6('0x76')];}else{_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x77')]=_0x13b0ee['Smtp'][_0x85b6('0x77')]=![];}_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x78')]=_0x344240[_0x85b6('0x5f')][_0x85b6('0x59')][_0x85b6('0x78')];_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x79')]=_0x344240[_0x85b6('0x5f')][_0x85b6('0x59')]['port'];_0x13b0ee['Smtp'][_0x85b6('0x78')]=_0x344240[_0x85b6('0x5f')][_0x85b6('0x5a')][_0x85b6('0x78')];_0x13b0ee[_0x85b6('0x5a')][_0x85b6('0x79')]=_0x344240['body']['Smtp'][_0x85b6('0x79')];}else{_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x7a')]=_0x13b0ee[_0x85b6('0x5a')][_0x85b6('0x7a')]=_0x344240[_0x85b6('0x5f')]['cservice'];_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x72')]=_0x13b0ee[_0x85b6('0x5a')][_0x85b6('0x72')]=_0x344240[_0x85b6('0x5f')][_0x85b6('0x73')];_0x13b0ee[_0x85b6('0x59')][_0x85b6('0x74')]=_0x13b0ee['Smtp'][_0x85b6('0x75')]=_0x344240['body']['cpassword'];}return db[_0x85b6('0x40')][_0x85b6('0x63')](_0x13b0ee,{'include':[{'model':db['MailServerOut'],'as':_0x85b6('0x5a')},{'model':db[_0x85b6('0x3b')],'as':_0x85b6('0x59')}]})['then'](function(_0x2cab40){var _0x2c7306=_0x344240['user'][_0x85b6('0x36')]({'plain':!![]});if(!_0x2c7306)throw new Error(_0x85b6('0x7b'));if(_0x2c7306[_0x85b6('0x7c')]===_0x85b6('0x72')){var _0x35117=_0x2cab40[_0x85b6('0x36')]({'plain':!![]});return db[_0x85b6('0x7d')]['find']({'where':{'name':_0x85b6('0x37'),'userProfileId':_0x2c7306[_0x85b6('0x7e')]},'raw':!![]})['then'](function(_0x4a9dd2){if(_0x4a9dd2&&_0x4a9dd2[_0x85b6('0x7f')]===0x0){return db[_0x85b6('0x38')][_0x85b6('0x63')]({'name':_0x35117[_0x85b6('0x45')],'resourceId':_0x35117['id'],'type':_0x4a9dd2[_0x85b6('0x45')],'sectionId':_0x4a9dd2['id']},{})[_0x85b6('0x1f')](function(){return _0x2cab40;});}else{return _0x2cab40;}})[_0x85b6('0x28')](function(_0xe70d6){logger[_0x85b6('0x25')](_0x85b6('0x80'),_0xe70d6);throw _0xe70d6;});}return _0x2cab40;})[_0x85b6('0x1f')](respondWithResult(_0x165730,0xc9))[_0x85b6('0x28')](handleError(_0x165730,null));};exports[_0x85b6('0x81')]=function(_0x29f6f5,_0x475b0b,_0x4e59bc){return db[_0x85b6('0x40')]['findOne']({'where':{'id':_0x29f6f5[_0x85b6('0x58')]['id']}})['then'](handleEntityNotFound(_0x475b0b,null))[_0x85b6('0x1f')](function(_0x4b5807){if(_0x4b5807){return _0x4b5807[_0x85b6('0x81')]();}return null;})['then'](respondWithResult(_0x475b0b,null))[_0x85b6('0x28')](handleError(_0x475b0b,null));};exports[_0x85b6('0x82')]=function(_0x2857cd,_0x45e48a,_0x3b9c1d){if(_0x2857cd[_0x85b6('0x5f')]['id']){delete _0x2857cd[_0x85b6('0x5f')]['id'];}return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x2857cd[_0x85b6('0x58')]['id']}})['then'](handleEntityNotFound(_0x45e48a,null))[_0x85b6('0x1f')](function(_0x59840f){if(_0x59840f){_0x2857cd['body'][_0x85b6('0x62')]=_0x59840f['id'];return db[_0x85b6('0x3b')][_0x85b6('0x63')](_0x2857cd[_0x85b6('0x5f')]);}})[_0x85b6('0x1f')](respondWithResult(_0x45e48a,null))[_0x85b6('0x28')](handleError(_0x45e48a,null));};exports[_0x85b6('0x83')]=function(_0x4a449e,_0x64ad7d,_0x15d70e){return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x4a449e[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x64ad7d,null))['then'](function(_0xc94497){if(_0xc94497){return _0xc94497['setImap'](null);}return null;})[_0x85b6('0x1f')](respondWithStatusCode(_0x64ad7d,null))[_0x85b6('0x28')](handleError(_0x64ad7d,null));};exports['getSmtp']=function(_0x543324,_0x51a623,_0x3372ae){return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x543324['params']['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x51a623,null))[_0x85b6('0x1f')](function(_0x1784ff){if(_0x1784ff){return _0x1784ff[_0x85b6('0x84')]();}return null;})[_0x85b6('0x1f')](respondWithResult(_0x51a623,null))[_0x85b6('0x28')](handleError(_0x51a623,null));};exports['addSmtp']=function(_0xf694aa,_0x3fc9f8,_0x3985ed){if(_0xf694aa[_0x85b6('0x5f')]['id']){delete _0xf694aa['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0xf694aa[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x3fc9f8,null))[_0x85b6('0x1f')](function(_0x2841d1){if(_0x2841d1){_0xf694aa['body'][_0x85b6('0x62')]=_0x2841d1['id'];return db[_0x85b6('0x3c')][_0x85b6('0x63')](_0xf694aa[_0x85b6('0x5f')]);}})[_0x85b6('0x1f')](respondWithResult(_0x3fc9f8,null))['catch'](handleError(_0x3fc9f8,null));};exports[_0x85b6('0x85')]=function(_0x4135e5,_0x3dd8cf,_0x5e2aae){return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x4135e5['params']['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x3dd8cf,null))[_0x85b6('0x1f')](function(_0x1ef734){if(_0x1ef734){return _0x1ef734[_0x85b6('0x86')](null);}return null;})[_0x85b6('0x1f')](respondWithStatusCode(_0x3dd8cf,null))[_0x85b6('0x28')](handleError(_0x3dd8cf,null));};exports[_0x85b6('0x87')]=function(_0x5b8fc0,_0x73b1e7,_0x3d125b){return db[_0x85b6('0x88')][_0x85b6('0x5e')]({'where':{'id':_0x5b8fc0[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x73b1e7,null))['then'](function(_0x3d0425){if(_0x3d0425){return _0x3d0425[_0x85b6('0x87')](_0x5b8fc0[_0x85b6('0x5f')][_0x85b6('0x68')],_[_0x85b6('0x89')](_0x5b8fc0[_0x85b6('0x5f')],['ids','id'])||{});}})[_0x85b6('0x1f')](respondWithResult(_0x73b1e7,null))[_0x85b6('0x28')](handleError(_0x73b1e7,null));};exports[_0x85b6('0x8a')]=function(_0x5d9a22,_0x17a61d,_0x542624){var _0x3e3ee4={'raw':![],'where':{}};var _0x2cf37b={};var _0x44191f={'count':0x0,'rows':[]};return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x5d9a22[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x17a61d,null))[_0x85b6('0x1f')](function(_0x200d88){if(_0x200d88){_0x2cf37b['model']=_[_0x85b6('0x5b')](db[_0x85b6('0x88')][_0x85b6('0x41')]);_0x2cf37b[_0x85b6('0x46')]=_[_0x85b6('0x5b')](_0x5d9a22[_0x85b6('0x46')]);_0x2cf37b[_0x85b6('0x47')]=_[_0x85b6('0x48')](_0x2cf37b[_0x85b6('0x44')],_0x2cf37b['query']);_0x3e3ee4[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x2cf37b[_0x85b6('0x44')],qs[_0x85b6('0x4a')](_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x4a')]));_0x3e3ee4[_0x85b6('0x49')]=_0x3e3ee4[_0x85b6('0x49')][_0x85b6('0x5c')]?_0x3e3ee4[_0x85b6('0x49')]:_0x2cf37b[_0x85b6('0x44')];if(!_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x3e3ee4['limit']=qs[_0x85b6('0x2d')](_0x5d9a22['query'][_0x85b6('0x2d')]);_0x3e3ee4['offset']=qs[_0x85b6('0x2c')](_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x2c')]);}_0x3e3ee4['order']=qs[_0x85b6('0x4e')](_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x4e')]);_0x3e3ee4['where']=qs[_0x85b6('0x47')](_[_0x85b6('0x50')](_0x5d9a22[_0x85b6('0x46')],_0x2cf37b[_0x85b6('0x47')]));_0x3e3ee4[_0x85b6('0x4f')][_0x85b6('0x62')]=_0x200d88['id'];if(_0x5d9a22[_0x85b6('0x46')]['filter']){_0x3e3ee4['where']=_['merge'](_0x3e3ee4[_0x85b6('0x4f')],{'$or':_['map'](_0x3e3ee4[_0x85b6('0x49')],function(_0x2e2996){var _0x1a80f4={};_0x1a80f4[_0x2e2996]={'$like':'%'+_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x51')]+'%'};return _0x1a80f4;})});}_0x3e3ee4=_[_0x85b6('0x52')]({},_0x3e3ee4,_0x5d9a22[_0x85b6('0x54')]);return db[_0x85b6('0x88')]['count']({'where':_0x3e3ee4['where']})['then'](function(_0x7a40b4){_0x44191f[_0x85b6('0x2b')]=_0x7a40b4;if(_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x5d')]){_0x3e3ee4[_0x85b6('0x55')]=[{'model':db[_0x85b6('0x8b')],'as':_0x85b6('0x8c'),'required':![]},{'model':db[_0x85b6('0x8d')],'as':_0x85b6('0x8e'),'attributes':[_0x85b6('0x45'),_0x85b6('0x8f'),_0x85b6('0x90')],'required':![]},{'model':db[_0x85b6('0x91')],'as':_0x85b6('0x92'),'attributes':['id',_0x85b6('0x45'),'color'],'where':_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x93')]?{'id':_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x93')]}:undefined,'required':_0x5d9a22[_0x85b6('0x46')][_0x85b6('0x93')]?!![]:![]}];}return db[_0x85b6('0x88')][_0x85b6('0x56')](_0x3e3ee4);})[_0x85b6('0x1f')](function(_0x985c03){_0x44191f[_0x85b6('0x57')]=_0x985c03;return _0x44191f;});}})['then'](respondWithFilteredResult(_0x17a61d,_0x3e3ee4))['catch'](handleError(_0x17a61d,null));};exports[_0x85b6('0x94')]=function(_0xa0aaa3,_0x26cfc4,_0x253915){return db['MailAccount'][_0x85b6('0x65')]({'where':{'id':_0xa0aaa3[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x26cfc4,null))[_0x85b6('0x1f')](function(_0x5129c1){if(_0x5129c1){return db[_0x85b6('0x95')][_0x85b6('0x96')](function(_0x17a0cc){return db[_0x85b6('0x97')][_0x85b6('0x35')]({'where':{'MailAccountId':_0xa0aaa3['params']['id']},'transaction':_0x17a0cc})[_0x85b6('0x1f')](function(_0x576cd8){var _0x537989=_['map'](_0xa0aaa3[_0x85b6('0x5f')],function(_0x3dd809){_0x3dd809[_0x85b6('0x62')]=_0xa0aaa3['params']['id'];return _0x3dd809;});return db[_0x85b6('0x97')][_0x85b6('0x98')](_0x537989,{'transaction':_0x17a0cc});});})[_0x85b6('0x1f')](function(){return db[_0x85b6('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0xa0aaa3[_0x85b6('0x58')]['id']},'order':_0x85b6('0x99')});});}})[_0x85b6('0x1f')](respondWithResult(_0x26cfc4,null))[_0x85b6('0x28')](handleError(_0x26cfc4,null));};exports[_0x85b6('0x9a')]=function(_0x4449db,_0x39e98d,_0x5d59fc){var _0x5b4886={};var _0x3f671b={};var _0x39cace;var _0x205415;return db[_0x85b6('0x40')]['findOne']({'where':{'id':_0x4449db[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x39e98d,null))[_0x85b6('0x1f')](function(_0x43da07){if(_0x43da07){_0x39cace=_0x43da07;_0x3f671b[_0x85b6('0x44')]=_[_0x85b6('0x5b')](db['MailApplication'][_0x85b6('0x41')]);_0x3f671b['query']=_[_0x85b6('0x5b')](_0x4449db[_0x85b6('0x46')]);_0x3f671b[_0x85b6('0x47')]=_['intersection'](_0x3f671b['model'],_0x3f671b[_0x85b6('0x46')]);_0x5b4886[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x3f671b[_0x85b6('0x44')],qs['fields'](_0x4449db[_0x85b6('0x46')][_0x85b6('0x4a')]));_0x5b4886['attributes']=_0x5b4886['attributes'][_0x85b6('0x5c')]?_0x5b4886[_0x85b6('0x49')]:_0x3f671b[_0x85b6('0x44')];_0x5b4886[_0x85b6('0x4d')]=qs[_0x85b6('0x4e')](_0x4449db[_0x85b6('0x46')][_0x85b6('0x4e')]);_0x5b4886[_0x85b6('0x4f')]=qs[_0x85b6('0x47')](_[_0x85b6('0x50')](_0x4449db[_0x85b6('0x46')],_0x3f671b[_0x85b6('0x47')]));if(_0x4449db[_0x85b6('0x46')][_0x85b6('0x51')]){_0x5b4886[_0x85b6('0x4f')]=_[_0x85b6('0x52')](_0x5b4886[_0x85b6('0x4f')],{'$or':_[_0x85b6('0x3f')](_0x5b4886['attributes'],function(_0x7d0cb7){var _0x20d4ea={};_0x20d4ea[_0x7d0cb7]={'$like':'%'+_0x4449db[_0x85b6('0x46')][_0x85b6('0x51')]+'%'};return _0x20d4ea;})});}_0x5b4886=_[_0x85b6('0x52')]({},_0x5b4886,_0x4449db[_0x85b6('0x54')]);return _0x39cace[_0x85b6('0x9a')](_0x5b4886);}})[_0x85b6('0x1f')](function(_0x101391){if(_0x101391){_0x205415=_0x101391[_0x85b6('0x5c')];if(!_0x4449db[_0x85b6('0x46')][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x5b4886[_0x85b6('0x2d')]=qs[_0x85b6('0x2d')](_0x4449db[_0x85b6('0x46')][_0x85b6('0x2d')]);_0x5b4886['offset']=qs['offset'](_0x4449db[_0x85b6('0x46')][_0x85b6('0x2c')]);}return _0x39cace['getApplications'](_0x5b4886);}})[_0x85b6('0x1f')](function(_0xe04040){if(_0xe04040){return _0xe04040?{'count':_0x205415,'rows':_0xe04040}:null;}})[_0x85b6('0x1f')](respondWithResult(_0x39e98d,null))['catch'](handleError(_0x39e98d,null));};exports[_0x85b6('0x9b')]=function(_0x4c4cd1,_0x457ef0,_0x1f262d){var _0x57987a={'raw':!![],'where':{}};var _0x220886={};var _0xaf50d9={'count':0x0,'rows':[]};return db[_0x85b6('0x40')][_0x85b6('0x65')]({'where':{'id':_0x4c4cd1[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x457ef0,null))['then'](function(_0x1d0d71){if(_0x1d0d71){_0x220886[_0x85b6('0x44')]=_['keys'](db[_0x85b6('0x9c')]['rawAttributes']);_0x220886[_0x85b6('0x46')]=_['keys'](_0x4c4cd1[_0x85b6('0x46')]);_0x220886[_0x85b6('0x47')]=_[_0x85b6('0x48')](_0x220886[_0x85b6('0x44')],_0x220886[_0x85b6('0x46')]);_0x57987a[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x220886[_0x85b6('0x44')],qs[_0x85b6('0x4a')](_0x4c4cd1[_0x85b6('0x46')]['fields']));_0x57987a[_0x85b6('0x49')]=_0x57987a[_0x85b6('0x49')]['length']?_0x57987a[_0x85b6('0x49')]:_0x220886[_0x85b6('0x44')];if(!_0x4c4cd1[_0x85b6('0x46')][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x57987a[_0x85b6('0x2d')]=qs['limit'](_0x4c4cd1['query'][_0x85b6('0x2d')]);_0x57987a[_0x85b6('0x2c')]=qs[_0x85b6('0x2c')](_0x4c4cd1[_0x85b6('0x46')][_0x85b6('0x2c')]);}_0x57987a['order']=qs[_0x85b6('0x4e')](_0x4c4cd1['query'][_0x85b6('0x4e')]);_0x57987a['where']=qs[_0x85b6('0x47')](_[_0x85b6('0x50')](_0x4c4cd1[_0x85b6('0x46')],_0x220886['filters']));_0x57987a['where'][_0x85b6('0x62')]=_0x1d0d71['id'];if(_0x4c4cd1[_0x85b6('0x46')][_0x85b6('0x51')]){_0x57987a['where']=_[_0x85b6('0x52')](_0x57987a[_0x85b6('0x4f')],{'$or':_[_0x85b6('0x3f')](_0x57987a[_0x85b6('0x49')],function(_0x553b12){var _0x3c3f3e={};_0x3c3f3e[_0x553b12]={'$like':'%'+_0x4c4cd1[_0x85b6('0x46')][_0x85b6('0x51')]+'%'};return _0x3c3f3e;})});}if(_0x4c4cd1[_0x85b6('0x46')][_0x85b6('0x9d')]){var _0x766412=_0x4c4cd1[_0x85b6('0x46')]['$gte']['split'](',');var _0x2f02ca={};_0x2f02ca[_0x766412[0x0]]={'$gte':moment(_0x766412[0x1])[_0x85b6('0x9e')](_0x85b6('0x9f'))};_0x57987a[_0x85b6('0x4f')]=_[_0x85b6('0x52')](_0x57987a['where'],_0x2f02ca);}_0x57987a=_[_0x85b6('0x52')]({},_0x57987a,_0x4c4cd1[_0x85b6('0x54')]);return db[_0x85b6('0x9c')][_0x85b6('0x2b')]({'where':_0x57987a[_0x85b6('0x4f')]})['then'](function(_0x403ebe){_0xaf50d9[_0x85b6('0x2b')]=_0x403ebe;if(_0x4c4cd1[_0x85b6('0x46')][_0x85b6('0x5d')]){_0x57987a[_0x85b6('0x55')]=[{'all':!![]}];}return db[_0x85b6('0x9c')][_0x85b6('0x56')](_0x57987a);})[_0x85b6('0x1f')](function(_0x32dada){_0xaf50d9[_0x85b6('0x57')]=_0x32dada;return _0xaf50d9;});}})['then'](respondWithFilteredResult(_0x457ef0,_0x57987a))['catch'](handleError(_0x457ef0,null));};exports[_0x85b6('0xa0')]=function(_0x14a074,_0x2c38d2,_0x3e9016){var _0x13fed8,_0x342a67={},_0x4dad9b;if(_0x14a074['body']['to']){_0x4dad9b=_0x14a074['body']['to'][_0x85b6('0xa1')](',')[0x0];}return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x14a074[_0x85b6('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x85b6('0xa2'),'include':[{'model':db[_0x85b6('0x8b')],'as':_0x85b6('0xa3'),'where':{'email':_0x4dad9b},'limit':0x1,'order':[[_0x85b6('0xa4'),_0x85b6('0xa5')]]}]},{'model':db[_0x85b6('0x3c')],'as':_0x85b6('0x5a'),'raw':!![]}]})[_0x85b6('0x1f')](handleEntityNotFound(_0x2c38d2,null))[_0x85b6('0x1f')](function(_0x485bb4){if(_0x485bb4){_0x13fed8=_0x485bb4;if(_0x485bb4[_0x85b6('0x5a')]){if(_[_0x85b6('0x6e')](_0x14a074[_0x85b6('0x5f')]['from'])){_0x14a074[_0x85b6('0x5f')][_0x85b6('0xa6')]=util[_0x85b6('0x9e')]('%s\x20<%s>',_0x485bb4['name'],_0x485bb4[_0x85b6('0x6d')]||_0x485bb4[_0x85b6('0x5a')][_0x85b6('0x72')]);}if(_0x14a074[_0x85b6('0x5f')][_0x85b6('0xa7')]&&_0x14a074['body'][_0x85b6('0xa7')][_0x85b6('0x5c')]){for(var _0xdcb2ef=0x0;_0xdcb2ef<_0x14a074[_0x85b6('0x5f')]['attachments'][_0x85b6('0x5c')];_0xdcb2ef+=0x1){_0x14a074[_0x85b6('0x5f')][_0x85b6('0xa7')][_0xdcb2ef]={'filename':_0x14a074['body'][_0x85b6('0xa7')][_0xdcb2ef]['name'],'path':path[_0x85b6('0xa8')](config[_0x85b6('0xa9')],_0x85b6('0xaa'),_0x14a074[_0x85b6('0x5f')][_0x85b6('0xa7')][_0xdcb2ef][_0x85b6('0xab')])};}}var _0x39fcf0={'tls':{'rejectUnauthorized':![]}};if(_[_0x85b6('0x6e')](_0x485bb4[_0x85b6('0x5a')][_0x85b6('0x7a')])){if(_0x485bb4['Smtp'][_0x85b6('0x77')]){_0x39fcf0['auth']={'user':_0x485bb4[_0x85b6('0x5a')][_0x85b6('0x72')],'pass':_0x485bb4['Smtp'][_0x85b6('0x75')]};}_0x39fcf0[_0x85b6('0x78')]=_0x485bb4[_0x85b6('0x5a')][_0x85b6('0x78')];_0x39fcf0[_0x85b6('0x79')]=_0x485bb4['Smtp']['port'];_0x39fcf0[_0x85b6('0xac')]=_0x485bb4['Smtp'][_0x85b6('0xac')];}else{_0x39fcf0[_0x85b6('0x7a')]=_0x485bb4[_0x85b6('0x5a')]['service'];_0x39fcf0[_0x85b6('0xad')]={'user':_0x485bb4[_0x85b6('0x5a')][_0x85b6('0x72')],'pass':_0x485bb4[_0x85b6('0x5a')][_0x85b6('0x75')]};}return respondWithRpcPromise(_0x85b6('0xae'),'sendMail',{'account':_0x39fcf0,'message':_0x14a074[_0x85b6('0x5f')]});}else{throw new Error(_0x85b6('0xaf'));}}})['then'](function(_0x4ee220){if(_0x4ee220){_0x342a67=_0x4ee220;if(_0x13fed8[_0x85b6('0xa2')]){if(_0x13fed8[_0x85b6('0xa2')][_0x85b6('0xa3')]['length']){return _0x13fed8['List'][_0x85b6('0xa3')][0x0];}else{return db[_0x85b6('0x8b')][_0x85b6('0x63')](_['defaults'](_0x14a074['body'],{'firstName':_0x14a074[_0x85b6('0x5f')]['to'],'email':_0x14a074[_0x85b6('0x5f')]['to'],'phone':_0x14a074[_0x85b6('0x5f')]['to'],'ListId':_0x13fed8[_0x85b6('0xb0')]}));}}else{throw new Error(_0x85b6('0xaf'));}}})[_0x85b6('0x1f')](function(_0x26bfb4){if(_0x26bfb4){var _0x5b6421={'UserId':_0x14a074[_0x85b6('0x72')]['id'],'ContactId':_0x26bfb4['id'],'MailAccountId':_0x13fed8['id'],'inReplyTo':_0x342a67[_0x85b6('0xb1')],'to':_0x14a074[_0x85b6('0x5f')][_0x85b6('0xa6')],'cc':_0x14a074[_0x85b6('0x5f')]['cc'],'subject':_0x14a074[_0x85b6('0x5f')][_0x85b6('0xb2')],'attach':_0x14a074['body'][_0x85b6('0xb3')],'firstMsgDirection':_0x85b6('0xb4'),'lastMsgAt':moment()[_0x85b6('0x9e')](_0x85b6('0x9f')),'lastMsgDirection':'out','lastMsgBody':_0x14a074[_0x85b6('0x5f')]['body'],'Messages':[_['merge'](_0x14a074['body'],{'messageId':_0x342a67['messageId'],'sentAt':moment()[_0x85b6('0x9e')](_0x85b6('0x9f')),'read':!![],'MailAccountId':_0x13fed8['id'],'UserId':_0x14a074[_0x85b6('0x72')]['id'],'ContactId':_0x26bfb4['id']})]};if(_0x14a074[_0x85b6('0x5f')]['Interaction']){_0x5b6421=_[_0x85b6('0x52')](_0x5b6421,_0x14a074['body'][_0x85b6('0xb5')]);}return db[_0x85b6('0x88')][_0x85b6('0x63')](_0x5b6421,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x85b6('0x1f')](respondWithResult(_0x2c38d2,null))[_0x85b6('0x28')](handleError(_0x2c38d2,null));};exports['verifySmtp']=function(_0x50a5af,_0xeca9b6,_0xcdd96b){return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x50a5af[_0x85b6('0x58')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x85b6('0x5a'),'raw':!![]}]})[_0x85b6('0x1f')](handleEntityNotFound(_0xeca9b6,null))['then'](function(_0x442396){if(_0x442396&&_0x442396[_0x85b6('0x5a')]){var _0x483837={'id':_0x442396['id'],'tls':{'rejectUnauthorized':![]}};if(_0x442396[_0x85b6('0x5a')][_0x85b6('0x7a')]){_0x483837[_0x85b6('0x7a')]=_0x442396[_0x85b6('0x5a')][_0x85b6('0x7a')];}else{_0x483837[_0x85b6('0x78')]=_0x442396[_0x85b6('0x5a')][_0x85b6('0x78')];_0x483837[_0x85b6('0x79')]=_0x442396[_0x85b6('0x5a')][_0x85b6('0x79')];_0x483837['secure']=_0x442396[_0x85b6('0x5a')]['secure'];}if(_0x442396['Smtp']['authentication']){_0x483837[_0x85b6('0xad')]={'user':_0x442396['Smtp'][_0x85b6('0x72')],'pass':_0x442396[_0x85b6('0x5a')][_0x85b6('0x75')]};}return respondWithRpcPromise(_0x85b6('0xb6'),_0x85b6('0xb7'),{'account':_0x483837});}})[_0x85b6('0x1f')](respondWithResult(_0xeca9b6,null))[_0x85b6('0x28')](handleError(_0xeca9b6,null));};exports['destroy']=function(_0x12e629,_0x58f8ad){return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x12e629[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x58f8ad,null))[_0x85b6('0x1f')](function(_0x4b243b){if(_0x4b243b&&_0x4b243b['service']){throw new db['Sequelize'][(_0x85b6('0x1d'))](_0x85b6('0xb8'));}return _0x4b243b;})['then'](removeEntity(_0x58f8ad,null))[_0x85b6('0x28')](handleError(_0x58f8ad,null));};exports[_0x85b6('0xb9')]=function(_0x542bf5,_0x6ca234,_0x3a62d8){return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x542bf5[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x6ca234,null))[_0x85b6('0x1f')](function(_0x2eecce){if(_0x2eecce){return _0x2eecce[_0x85b6('0xb9')](_0x542bf5['body'][_0x85b6('0x68')],_['omit'](_0x542bf5[_0x85b6('0x5f')],[_0x85b6('0x68'),'id'])||{})[_0x85b6('0xba')](function(_0x856a00){for(var _0x58ef02=0x0;_0x58ef02<_0x542bf5[_0x85b6('0x5f')]['ids'][_0x85b6('0x5c')];_0x58ef02+=0x1){socket['emit'](_0x85b6('0xbb'),{'UserId':_0x542bf5[_0x85b6('0x5f')][_0x85b6('0x68')][_0x58ef02],'MailAccountId':_0x542bf5[_0x85b6('0x58')]['id']});}return _0x856a00;});}})[_0x85b6('0x1f')](respondWithResult(_0x6ca234,null))[_0x85b6('0x28')](handleError(_0x6ca234,null));};exports[_0x85b6('0xbc')]=function(_0x5d01a2,_0x586357,_0x5943e5){return db[_0x85b6('0x40')][_0x85b6('0x5e')]({'where':{'id':_0x5d01a2[_0x85b6('0x58')]['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x586357,null))[_0x85b6('0x1f')](function(_0x2350cf){if(_0x2350cf){return _0x2350cf[_0x85b6('0xbc')](_0x5d01a2[_0x85b6('0x46')][_0x85b6('0x68')])[_0x85b6('0x1f')](function(){if(_[_0x85b6('0xbd')](_0x5d01a2[_0x85b6('0x46')][_0x85b6('0x68')])){for(var _0x2cacb8=0x0;_0x2cacb8<_0x5d01a2[_0x85b6('0x46')][_0x85b6('0x68')]['length'];_0x2cacb8+=0x1){socket[_0x85b6('0xbe')](_0x85b6('0xbf'),{'UserId':Number(_0x5d01a2[_0x85b6('0x46')][_0x85b6('0x68')][_0x2cacb8]),'MailAccountId':Number(_0x5d01a2[_0x85b6('0x58')]['id'])});}}else{socket[_0x85b6('0xbe')](_0x85b6('0xbf'),{'UserId':Number(_0x5d01a2[_0x85b6('0x46')][_0x85b6('0x68')]),'MailAccountId':Number(_0x5d01a2[_0x85b6('0x58')]['id'])});}});}})[_0x85b6('0x1f')](respondWithStatusCode(_0x586357,null))[_0x85b6('0x28')](handleError(_0x586357,null));};exports[_0x85b6('0xc0')]=function(_0x483443,_0x48cb9e,_0x4e334b){var _0x5025d9={};var _0x2ba272={};var _0x1e2f7a;var _0x2b633d;return db['MailAccount'][_0x85b6('0x65')]({'where':{'id':_0x483443['params']['id']}})[_0x85b6('0x1f')](handleEntityNotFound(_0x48cb9e,null))[_0x85b6('0x1f')](function(_0x17ea94){if(_0x17ea94){_0x1e2f7a=_0x17ea94;_0x2ba272[_0x85b6('0x44')]=_['keys'](db['User'][_0x85b6('0x41')]);_0x2ba272[_0x85b6('0x46')]=_[_0x85b6('0x5b')](_0x483443[_0x85b6('0x46')]);_0x2ba272['filters']=_[_0x85b6('0x48')](_0x2ba272['model'],_0x2ba272[_0x85b6('0x46')]);_0x5025d9[_0x85b6('0x49')]=_[_0x85b6('0x48')](_0x2ba272[_0x85b6('0x44')],qs[_0x85b6('0x4a')](_0x483443['query'][_0x85b6('0x4a')]));_0x5025d9[_0x85b6('0x49')]=_0x5025d9[_0x85b6('0x49')][_0x85b6('0x5c')]?_0x5025d9['attributes']:_0x2ba272[_0x85b6('0x44')];_0x5025d9[_0x85b6('0x4d')]=qs['sort'](_0x483443[_0x85b6('0x46')][_0x85b6('0x4e')]);_0x5025d9[_0x85b6('0x4f')]=qs['filters'](_[_0x85b6('0x50')](_0x483443[_0x85b6('0x46')],_0x2ba272[_0x85b6('0x47')]));if(_0x483443[_0x85b6('0x46')][_0x85b6('0x51')]){_0x5025d9[_0x85b6('0x4f')]=_[_0x85b6('0x52')](_0x5025d9['where'],{'$or':_['map'](_0x5025d9['attributes'],function(_0x5843c4){var _0x545f6b={};_0x545f6b[_0x5843c4]={'$like':'%'+_0x483443['query'][_0x85b6('0x51')]+'%'};return _0x545f6b;})});}_0x5025d9=_[_0x85b6('0x52')]({},_0x5025d9,_0x483443[_0x85b6('0x54')]);return _0x1e2f7a['getAgents'](_0x5025d9);}})['then'](function(_0x9dc989){if(_0x9dc989){_0x2b633d=_0x9dc989[_0x85b6('0x5c')];if(!_0x483443['query'][_0x85b6('0x4b')](_0x85b6('0x4c'))){_0x5025d9[_0x85b6('0x2d')]=qs[_0x85b6('0x2d')](_0x483443['query'][_0x85b6('0x2d')]);_0x5025d9[_0x85b6('0x2c')]=qs['offset'](_0x483443[_0x85b6('0x46')][_0x85b6('0x2c')]);}return _0x1e2f7a['getAgents'](_0x5025d9);}})[_0x85b6('0x1f')](function(_0x544ad6){if(_0x544ad6){return _0x544ad6?{'count':_0x2b633d,'rows':_0x544ad6}:null;}})['then'](respondWithResult(_0x48cb9e,null))['catch'](handleError(_0x48cb9e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index bd145fb..2791915 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 _0x5084=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5084,0xc7));var _0x4508=function(_0x2aee7d,_0x5cbb41){_0x2aee7d=_0x2aee7d-0x0;var _0x7c9373=_0x5084[_0x2aee7d];return _0x7c9373;};'use strict';var EventEmitter=require(_0x4508('0x0'));var MailAccount=require(_0x4508('0x1'))['db'][_0x4508('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4508('0x3')](0x0);var events={'afterCreate':_0x4508('0x4'),'afterUpdate':_0x4508('0x5'),'afterDestroy':_0x4508('0x6')};function emitEvent(_0x438b6b){return function(_0x5d426b,_0xaff151,_0x879282){MailAccountEvents[_0x4508('0x7')](_0x438b6b+':'+_0x5d426b['id'],_0x5d426b);MailAccountEvents[_0x4508('0x7')](_0x438b6b,_0x5d426b);_0x879282(null);};}for(var e in events){if(events[_0x4508('0x8')](e)){var event=events[e];MailAccount[_0x4508('0x9')](e,emitEvent(event));}}module[_0x4508('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x27a3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x27a3,0x1ab));var _0x327a=function(_0x262d49,_0x59c4ad){_0x262d49=_0x262d49-0x0;var _0x1554c5=_0x27a3[_0x262d49];return _0x1554c5;};'use strict';var EventEmitter=require(_0x327a('0x0'));var MailAccount=require(_0x327a('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x327a('0x2')](0x0);var events={'afterCreate':_0x327a('0x3'),'afterUpdate':_0x327a('0x4'),'afterDestroy':_0x327a('0x5')};function emitEvent(_0x5df10d){return function(_0x3126d7,_0x5bfba4,_0x41c6bb){MailAccountEvents[_0x327a('0x6')](_0x5df10d+':'+_0x3126d7['id'],_0x3126d7);MailAccountEvents[_0x327a('0x6')](_0x5df10d,_0x3126d7);_0x41c6bb(null);};}for(var e in events){if(events[_0x327a('0x7')](e)){var event=events[e];MailAccount[_0x327a('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1c2202f..a03352a 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 _0x3b99=['path','../../config/environment','./mailAccount.attributes','define','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24eaa0,_0x5ad3ca){var _0x18dde1=function(_0x9e55f8){while(--_0x9e55f8){_0x24eaa0['push'](_0x24eaa0['shift']());}};_0x18dde1(++_0x5ad3ca);}(_0x3b99,0x161));var _0x93b9=function(_0x224cde,_0x1b392e){_0x224cde=_0x224cde-0x0;var _0x2528be=_0x3b99[_0x224cde];return _0x2528be;};'use strict';var _=require(_0x93b9('0x0'));var util=require(_0x93b9('0x1'));var logger=require(_0x93b9('0x2'))(_0x93b9('0x3'));var moment=require(_0x93b9('0x4'));var BPromise=require(_0x93b9('0x5'));var rp=require(_0x93b9('0x6'));var fs=require('fs');var path=require(_0x93b9('0x7'));var rimraf=require('rimraf');var config=require(_0x93b9('0x8'));var attributes=require(_0x93b9('0x9'));module['exports']=function(_0x53894f,_0x3d735f){return _0x53894f[_0x93b9('0xa')]('MailAccount',attributes,{'tableName':_0x93b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6878=['exports','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','./mailAccount.attributes'];(function(_0x7df6df,_0x51f15a){var _0x67cdfd=function(_0x120b1c){while(--_0x120b1c){_0x7df6df['push'](_0x7df6df['shift']());}};_0x67cdfd(++_0x51f15a);}(_0x6878,0x185));var _0x8687=function(_0x417b1e,_0xd72636){_0x417b1e=_0x417b1e-0x0;var _0x46526f=_0x6878[_0x417b1e];return _0x46526f;};'use strict';var _=require(_0x8687('0x0'));var util=require('util');var logger=require(_0x8687('0x1'))(_0x8687('0x2'));var moment=require(_0x8687('0x3'));var BPromise=require(_0x8687('0x4'));var rp=require(_0x8687('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8687('0x6'));module[_0x8687('0x7')]=function(_0x52ca2a,_0x142181){return _0x52ca2a['define']('MailAccount',attributes,{'tableName':_0x8687('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 50912c8..0a9e14f 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 _0x9b83=['Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','inReplyTo','MailInteraction','Contact\x20not\x20found','update','interaction','get','created','MailMessage','originTo','originCc','bcc','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','GetMailAccount','MailAccount','options','raw','where','attributes','include','map','model','find','ShowMailAccount','catch','NotifyMailAccount','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','MailApplication','Applications','Smtp','account','omit','applications','list','orderBy','asc','autoclose','push','length','close'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x9b83,0x84));var _0x39b8=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x9b83[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0x39b8('0x0'));var util=require(_0x39b8('0x1'));var moment=require(_0x39b8('0x2'));var BPromise=require(_0x39b8('0x3'));var rs=require(_0x39b8('0x4'));var fs=require('fs');var Redis=require(_0x39b8('0x5'));var db=require(_0x39b8('0x6'))['db'];var utils=require(_0x39b8('0x7'));var logger=require(_0x39b8('0x8'))(_0x39b8('0x9'));var config=require('../../config/environment');var jayson=require(_0x39b8('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0x39b8('0xb')]=_[_0x39b8('0xc')](config[_0x39b8('0xb')],{'host':_0x39b8('0xd'),'port':0x18eb});var socket=require(_0x39b8('0xe'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x33d152,_0x3fd80d,_0x14d391){return new BPromise(function(_0x473f6d,_0x3020ff){return client[_0x39b8('0xf')](_0x33d152,_0x14d391)[_0x39b8('0x10')](function(_0x222809){logger[_0x39b8('0x11')]('MailAccount,\x20%s,\x20%s',_0x3fd80d,_0x39b8('0x12'));logger['debug'](_0x39b8('0x13'),_0x3fd80d,_0x39b8('0x12'),JSON[_0x39b8('0x14')](_0x222809));if(_0x222809[_0x39b8('0x15')]){if(_0x222809['error'][_0x39b8('0x16')]===0x1f4){logger[_0x39b8('0x15')](_0x39b8('0x17'),_0x3fd80d,_0x222809[_0x39b8('0x15')]['message']);return _0x3020ff(_0x222809[_0x39b8('0x15')]['message']);}logger[_0x39b8('0x15')](_0x39b8('0x17'),_0x3fd80d,_0x222809[_0x39b8('0x15')][_0x39b8('0x18')]);return _0x473f6d(_0x222809['error']['message']);}else{logger[_0x39b8('0x11')]('MailAccount,\x20%s,\x20%s',_0x3fd80d,'request\x20sent');_0x473f6d(_0x222809['result'][_0x39b8('0x18')]);}})['catch'](function(_0x2cb44a){logger['error'](_0x39b8('0x17'),_0x3fd80d,_0x2cb44a);_0x3020ff(_0x2cb44a);});});}exports[_0x39b8('0x19')]=function(_0x39a641){var _0x5bcb3a=this;return new Promise(function(_0x3d4055,_0x146e91){return db[_0x39b8('0x1a')]['findAll']({'raw':_0x39a641[_0x39b8('0x1b')]?_0x39a641['options'][_0x39b8('0x1c')]===undefined?!![]:![]:!![],'where':_0x39a641['options']?_0x39a641[_0x39b8('0x1b')][_0x39b8('0x1d')]||null:null,'attributes':_0x39a641[_0x39b8('0x1b')]?_0x39a641[_0x39b8('0x1b')][_0x39b8('0x1e')]||null:null,'limit':_0x39a641['options']?_0x39a641[_0x39b8('0x1b')]['limit']||null:null,'include':_0x39a641[_0x39b8('0x1b')]?_0x39a641[_0x39b8('0x1b')][_0x39b8('0x1f')]?_[_0x39b8('0x20')](_0x39a641['options'][_0x39b8('0x1f')],function(_0x2094ba){return{'model':db[_0x2094ba[_0x39b8('0x21')]],'as':_0x2094ba['as'],'attributes':_0x2094ba[_0x39b8('0x1e')],'include':_0x2094ba[_0x39b8('0x1f')]?_[_0x39b8('0x20')](_0x2094ba[_0x39b8('0x1f')],function(_0x59a25f){return{'model':db[_0x59a25f[_0x39b8('0x21')]],'as':_0x59a25f['as'],'attributes':_0x59a25f['attributes'],'include':_0x59a25f[_0x39b8('0x1f')]?_['map'](_0x59a25f[_0x39b8('0x1f')],function(_0x133ff9){return{'model':db[_0x133ff9[_0x39b8('0x21')]],'as':_0x133ff9['as'],'attributes':_0x133ff9[_0x39b8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x39b8('0x10')](function(_0x415008){logger[_0x39b8('0x11')](_0x39b8('0x19'),_0x39a641);logger['debug'](_0x39b8('0x19'),_0x39a641,JSON['stringify'](_0x415008));_0x3d4055(_0x415008);})['catch'](function(_0x3a4503){logger[_0x39b8('0x15')](_0x39b8('0x19'),_0x3a4503[_0x39b8('0x18')],_0x39a641);_0x146e91(_0x5bcb3a[_0x39b8('0x15')](0x1f4,_0x3a4503[_0x39b8('0x18')]));});});};exports['ShowMailAccount']=function(_0x2c272a){var _0xebadc9=this;return new Promise(function(_0x47ebcb,_0x5ad841){return db[_0x39b8('0x1a')][_0x39b8('0x22')]({'raw':_0x2c272a[_0x39b8('0x1b')]?_0x2c272a[_0x39b8('0x1b')][_0x39b8('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c272a[_0x39b8('0x1b')]?_0x2c272a[_0x39b8('0x1b')][_0x39b8('0x1d')]||null:null,'attributes':_0x2c272a[_0x39b8('0x1b')]?_0x2c272a[_0x39b8('0x1b')][_0x39b8('0x1e')]||null:null,'include':_0x2c272a[_0x39b8('0x1b')]?_0x2c272a[_0x39b8('0x1b')][_0x39b8('0x1f')]?_[_0x39b8('0x20')](_0x2c272a[_0x39b8('0x1b')][_0x39b8('0x1f')],function(_0x2158ab){return{'model':db[_0x2158ab[_0x39b8('0x21')]],'as':_0x2158ab['as'],'attributes':_0x2158ab[_0x39b8('0x1e')],'include':_0x2158ab[_0x39b8('0x1f')]?_[_0x39b8('0x20')](_0x2158ab[_0x39b8('0x1f')],function(_0x390ba2){return{'model':db[_0x390ba2[_0x39b8('0x21')]],'as':_0x390ba2['as'],'attributes':_0x390ba2[_0x39b8('0x1e')],'include':_0x390ba2[_0x39b8('0x1f')]?_['map'](_0x390ba2[_0x39b8('0x1f')],function(_0x1d397d){return{'model':db[_0x1d397d[_0x39b8('0x21')]],'as':_0x1d397d['as'],'attributes':_0x1d397d['attributes']};}):[]};}):[]};}):[]:[]})[_0x39b8('0x10')](function(_0x253c5a){logger[_0x39b8('0x11')](_0x39b8('0x23'),_0x2c272a);logger['debug'](_0x39b8('0x23'),_0x2c272a,JSON[_0x39b8('0x14')](_0x253c5a));_0x47ebcb(_0x253c5a);})[_0x39b8('0x24')](function(_0x44b2c9){logger[_0x39b8('0x15')]('ShowMailAccount',_0x44b2c9[_0x39b8('0x18')],_0x2c272a);_0x5ad841(_0xebadc9[_0x39b8('0x15')](0x1f4,_0x44b2c9[_0x39b8('0x18')]));});});};exports[_0x39b8('0x25')]=function(_0x21e628){var _0x26d2ec=this;return new Promise(function(_0x154c70,_0x4309b6){var _0x57c62e={'body':_0x21e628['body'],'channel':'mail'};var _0x1f7823=_[_0x39b8('0x26')](_[_0x39b8('0x27')](db[_0x39b8('0x28')][_0x39b8('0x29')]),['createdAt',_0x39b8('0x2a'),_0x39b8('0x2b'),_0x39b8('0x2c')]);var _0x32079f=![];if(_0x21e628['body']['id']){delete _0x21e628[_0x39b8('0x2d')]['id'];}if(_[_0x39b8('0x2e')](_0x21e628[_0x39b8('0x2d')][_0x39b8('0x2f')])){return _0x4309b6(_0x26d2ec['error'](0x1f4,_0x39b8('0x30')));}if(_[_0x39b8('0x2e')](_0x21e628[_0x39b8('0x2d')][_0x39b8('0x2d')])||_0x21e628[_0x39b8('0x2d')][_0x39b8('0x2d')]===''){return _0x4309b6(_0x26d2ec[_0x39b8('0x15')](0x1f4,_0x39b8('0x31')));}if(_[_0x39b8('0x2e')](_0x21e628[_0x39b8('0x2d')][_0x39b8('0x32')])){return _0x4309b6(_0x26d2ec[_0x39b8('0x15')](0x1f4,_0x39b8('0x33')+_0x1f7823));}if(!_[_0x39b8('0x34')](_0x1f7823,_0x21e628[_0x39b8('0x2d')][_0x39b8('0x32')])){return _0x4309b6(_0x26d2ec[_0x39b8('0x15')](0x1f4,_0x39b8('0x35')+_0x1f7823));}var _0x2ba64c={};_0x2ba64c[_0x21e628[_0x39b8('0x2d')]['mapKey']]=_0x21e628['body'][_0x39b8('0x2f')];return db[_0x39b8('0x1a')][_0x39b8('0x22')]({'where':{'id':_0x21e628['account']['id']},'include':[{'model':db[_0x39b8('0x36')],'as':_0x39b8('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2ba64c,'limit':0x1,'order':[[_0x39b8('0x2a'),_0x39b8('0x38')]]}]},{'model':db[_0x39b8('0x39')],'as':_0x39b8('0x3a')},{'model':db['MailServerOut'],'as':_0x39b8('0x3b')}]})[_0x39b8('0x10')](function(_0x5dc743){if(_0x5dc743&&_0x5dc743[_0x39b8('0x37')]){var _0x1317b9=_0x5dc743['get']({'plain':!![]});_0x57c62e[_0x39b8('0x3c')]=_[_0x39b8('0x3d')](_0x1317b9,[_0x39b8('0x3a'),_0x39b8('0x37')]);_0x57c62e[_0x39b8('0x3e')]=_0x1317b9['Applications'];_0x57c62e[_0x39b8('0x3f')]=_0x1317b9[_0x39b8('0x37')];_0x57c62e['applications']=_[_0x39b8('0x40')](_0x57c62e['applications'],['priority'],[_0x39b8('0x41')]);if(_0x57c62e[_0x39b8('0x3c')]&&_0x57c62e[_0x39b8('0x3c')][_0x39b8('0x42')]){_0x57c62e[_0x39b8('0x3e')][_0x39b8('0x43')]({'id':0x0,'priority':_0x57c62e[_0x39b8('0x3e')][_0x39b8('0x44')]+0x1,'app':_0x39b8('0x45'),'appdata':_0x39b8('0x42'),'interval':'*,*,*,*'});}if(_0x57c62e[_0x39b8('0x3c')][_0x39b8('0x3a')]){delete _0x57c62e[_0x39b8('0x3c')]['Applications'];}if(_0x57c62e[_0x39b8('0x3c')][_0x39b8('0x37')]){delete _0x57c62e['account'][_0x39b8('0x37')];}if(_0x1317b9[_0x39b8('0x37')]['Contacts'][_0x39b8('0x44')]){return _0x1317b9[_0x39b8('0x37')][_0x39b8('0x46')][0x0];}var _0x2ceae3=_[_0x39b8('0xc')](_0x21e628['body'],{'firstName':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x2f')],'ListId':_0x1317b9[_0x39b8('0x2c')]});_0x2ceae3[_0x21e628['body']['mapKey']]=_0x21e628['body'][_0x39b8('0x2f')];return db[_0x39b8('0x28')][_0x39b8('0x47')](_0x2ceae3);}else{throw new Error(_0x39b8('0x48'));}})['then'](function(_0x2408ee){_0x57c62e[_0x39b8('0x49')]=_0x2408ee;if(_0x2408ee){if(!_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x4a')]){_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x4a')]=rs[_0x39b8('0x4b')]()+'\x20'+_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x2f')];}var _0x45c20a={'ContactId':_0x2408ee['id'],'MailAccountId':_0x21e628[_0x39b8('0x3c')]['id'],'inReplyTo':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')]['messageId'],'to':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')]['from'],'cc':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')]['cc'],'subject':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x4c')],'attach':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x4d')],'lastMsgAt':moment()[_0x39b8('0x4e')](_0x39b8('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x2d')]};return db['MailInteraction'][_0x39b8('0x22')]({'where':{'closed':![],'MailAccountId':_0x21e628[_0x39b8('0x3c')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x21e628['body'][_0x39b8('0x18')][_0x39b8('0x50')]}}]})[_0x39b8('0x10')](function(_0x48c34b){if(_0x48c34b){return[_0x48c34b,![]];}return db[_0x39b8('0x51')][_0x39b8('0x47')](_0x45c20a)['then'](function(_0x1c4096){return[_0x1c4096,!![]];});});}else{throw new Error(_0x39b8('0x52'));}})['spread'](function(_0x279e2b,_0x3f88fc){if(_0x279e2b){_0x32079f=_0x3f88fc;if(!_0x3f88fc){return _0x279e2b[_0x39b8('0x53')]({'inReplyTo':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x4a')],'to':_0x21e628[_0x39b8('0x2d')]['message'][_0x39b8('0x2f')],'cc':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')]['cc'],'subject':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')]['subject'],'attach':_0x279e2b[_0x39b8('0x4d')]?_0x279e2b[_0x39b8('0x4d')]:_0x21e628[_0x39b8('0x2d')]['message'][_0x39b8('0x4d')],'substatus':null,'substatusAt':moment()[_0x39b8('0x4e')](_0x39b8('0x4f')),'lastMsgAt':moment()['format'](_0x39b8('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x21e628[_0x39b8('0x2d')]['body']});}else{return _0x279e2b;}}})[_0x39b8('0x10')](function(_0x58c58e){_0x57c62e[_0x39b8('0x54')]=_0x58c58e[_0x39b8('0x55')]({'plain':!![]});_0x57c62e[_0x39b8('0x54')][_0x39b8('0x56')]=_0x32079f;return db[_0x39b8('0x57')][_0x39b8('0x47')]({'body':_0x21e628[_0x39b8('0x2d')]['body'],'MailAccountId':_0x21e628[_0x39b8('0x3c')]['id'],'MailInteractionId':_0x58c58e['id'],'direction':'in','ContactId':_0x57c62e[_0x39b8('0x49')]['id'],'messageId':_0x21e628['body'][_0x39b8('0x18')]['messageId'],'from':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x2f')],'to':_0x21e628['body']['message']['to'],'cc':_0x21e628['body'][_0x39b8('0x18')]['cc'],'subject':_0x21e628[_0x39b8('0x2d')]['message'][_0x39b8('0x4c')],'attach':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x4d')],'Attachments':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')]['attachments'],'originTo':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x58')],'originCc':_0x21e628['body'][_0x39b8('0x18')][_0x39b8('0x59')],'bcc':_0x21e628[_0x39b8('0x2d')][_0x39b8('0x18')][_0x39b8('0x5a')]},{'include':[{'model':db['Attachment'],'as':_0x39b8('0x5b')}]});})[_0x39b8('0x10')](function(_0x21c90b){_0x57c62e[_0x39b8('0x18')]=_0x21c90b;if(_0x57c62e[_0x39b8('0x54')][_0x39b8('0x5c')]){return db[_0x39b8('0x5d')][_0x39b8('0x22')]({'attributes':['id','name'],'where':{'id':_0x57c62e[_0x39b8('0x54')][_0x39b8('0x5c')]}})[_0x39b8('0x10')](function(_0x49e2cc){if(_0x49e2cc){_0x57c62e[_0x39b8('0x3e')][_0x39b8('0x5e')]({'id':0x0,'priority':0x0,'app':_0x39b8('0x5f'),'appdata':_0x49e2cc[_0x39b8('0x60')]+','+(_0x57c62e['account'][_0x39b8('0x61')]||0xa),'interval':_0x39b8('0x62')});}return respondWithRpcPromise(_0x39b8('0x63'),'startRouting',_0x57c62e);});}return respondWithRpcPromise(_0x39b8('0x63'),_0x39b8('0x64'),_0x57c62e);})[_0x39b8('0x10')](function(_0x420c6e){_0x154c70(_0x420c6e);})[_0x39b8('0x24')](function(_0x4ba02e){_0x4309b6(_0x26d2ec[_0x39b8('0x15')](0x1f4,_0x4ba02e[_0x39b8('0x18')]));});});}; \ No newline at end of file +var _0xe13a=['attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','get','account','orderBy','applications','priority','asc','autoclose','length','defaults','create','List\x20not\x20found','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','spread','update','subject','attach','interaction','created','MailMessage','contact','attachments','originTo','originCc','bcc','Attachment','UserId','User','name','agent','*,*,*,*','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','error','message','result','catch','MailAccount','findAll','options','raw','where'];(function(_0x41017,_0x548fc5){var _0x27a355=function(_0x3ec88f){while(--_0x3ec88f){_0x41017['push'](_0x41017['shift']());}};_0x27a355(++_0x548fc5);}(_0xe13a,0x178));var _0xae13=function(_0x55cac0,_0x13fad3){_0x55cac0=_0x55cac0-0x0;var _0x506150=_0xe13a[_0x55cac0];return _0x506150;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232c});config[_0xae13('0xc')]=_['defaults'](config[_0xae13('0xc')],{'host':_0xae13('0xd'),'port':0x18eb});var socket=require(_0xae13('0xe'))(new Redis(config[_0xae13('0xc')]));require(_0xae13('0xf'))[_0xae13('0x10')](socket);function respondWithRpcPromise(_0x235a37,_0x2d1149,_0x1f3451){return new BPromise(function(_0x5990e3,_0x404b0e){return client[_0xae13('0x11')](_0x235a37,_0x1f3451)[_0xae13('0x12')](function(_0x3a6d41){logger[_0xae13('0x13')](_0xae13('0x14'),_0x2d1149,_0xae13('0x15'));logger['debug'](_0xae13('0x16'),_0x2d1149,_0xae13('0x15'),JSON['stringify'](_0x3a6d41));if(_0x3a6d41['error']){if(_0x3a6d41['error']['code']===0x1f4){logger['error'](_0xae13('0x14'),_0x2d1149,_0x3a6d41[_0xae13('0x17')][_0xae13('0x18')]);return _0x404b0e(_0x3a6d41[_0xae13('0x17')][_0xae13('0x18')]);}logger[_0xae13('0x17')]('MailAccount,\x20%s,\x20%s',_0x2d1149,_0x3a6d41[_0xae13('0x17')]['message']);return _0x5990e3(_0x3a6d41[_0xae13('0x17')][_0xae13('0x18')]);}else{logger[_0xae13('0x13')](_0xae13('0x14'),_0x2d1149,_0xae13('0x15'));_0x5990e3(_0x3a6d41[_0xae13('0x19')][_0xae13('0x18')]);}})[_0xae13('0x1a')](function(_0x42b307){logger['error'](_0xae13('0x14'),_0x2d1149,_0x42b307);_0x404b0e(_0x42b307);});});}exports['GetMailAccount']=function(_0x17a8c6){var _0x1c66b7=this;return new Promise(function(_0x49c7d5,_0x25a195){return db[_0xae13('0x1b')][_0xae13('0x1c')]({'raw':_0x17a8c6[_0xae13('0x1d')]?_0x17a8c6[_0xae13('0x1d')][_0xae13('0x1e')]===undefined?!![]:![]:!![],'where':_0x17a8c6['options']?_0x17a8c6['options'][_0xae13('0x1f')]||null:null,'attributes':_0x17a8c6[_0xae13('0x1d')]?_0x17a8c6['options'][_0xae13('0x20')]||null:null,'limit':_0x17a8c6['options']?_0x17a8c6[_0xae13('0x1d')][_0xae13('0x21')]||null:null,'include':_0x17a8c6[_0xae13('0x1d')]?_0x17a8c6['options']['include']?_['map'](_0x17a8c6[_0xae13('0x1d')][_0xae13('0x22')],function(_0x17ce58){return{'model':db[_0x17ce58['model']],'as':_0x17ce58['as'],'attributes':_0x17ce58[_0xae13('0x20')],'include':_0x17ce58['include']?_[_0xae13('0x23')](_0x17ce58['include'],function(_0xbeda8d){return{'model':db[_0xbeda8d[_0xae13('0x24')]],'as':_0xbeda8d['as'],'attributes':_0xbeda8d['attributes'],'include':_0xbeda8d[_0xae13('0x22')]?_[_0xae13('0x23')](_0xbeda8d[_0xae13('0x22')],function(_0x306dfb){return{'model':db[_0x306dfb['model']],'as':_0x306dfb['as'],'attributes':_0x306dfb[_0xae13('0x20')]};}):[]};}):[]};}):[]:[]})[_0xae13('0x12')](function(_0x1d7152){logger[_0xae13('0x13')](_0xae13('0x25'),_0x17a8c6);logger[_0xae13('0x26')](_0xae13('0x25'),_0x17a8c6,JSON['stringify'](_0x1d7152));_0x49c7d5(_0x1d7152);})[_0xae13('0x1a')](function(_0x591f94){logger[_0xae13('0x17')](_0xae13('0x25'),_0x591f94[_0xae13('0x18')],_0x17a8c6);_0x25a195(_0x1c66b7[_0xae13('0x17')](0x1f4,_0x591f94[_0xae13('0x18')]));});});};exports[_0xae13('0x27')]=function(_0x11c2ba){var _0x48f0f6=this;return new Promise(function(_0x4a3deb,_0x30d2c0){return db[_0xae13('0x1b')][_0xae13('0x28')]({'raw':_0x11c2ba[_0xae13('0x1d')]?_0x11c2ba[_0xae13('0x1d')][_0xae13('0x1e')]===undefined?!![]:![]:!![],'where':_0x11c2ba[_0xae13('0x1d')]?_0x11c2ba[_0xae13('0x1d')][_0xae13('0x1f')]||null:null,'attributes':_0x11c2ba[_0xae13('0x1d')]?_0x11c2ba['options'][_0xae13('0x20')]||null:null,'include':_0x11c2ba[_0xae13('0x1d')]?_0x11c2ba[_0xae13('0x1d')]['include']?_['map'](_0x11c2ba['options']['include'],function(_0x5b4060){return{'model':db[_0x5b4060['model']],'as':_0x5b4060['as'],'attributes':_0x5b4060[_0xae13('0x20')],'include':_0x5b4060[_0xae13('0x22')]?_[_0xae13('0x23')](_0x5b4060['include'],function(_0x337a61){return{'model':db[_0x337a61[_0xae13('0x24')]],'as':_0x337a61['as'],'attributes':_0x337a61[_0xae13('0x20')],'include':_0x337a61[_0xae13('0x22')]?_[_0xae13('0x23')](_0x337a61['include'],function(_0x3df8fc){return{'model':db[_0x3df8fc[_0xae13('0x24')]],'as':_0x3df8fc['as'],'attributes':_0x3df8fc[_0xae13('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f0870){logger[_0xae13('0x13')](_0xae13('0x27'),_0x11c2ba);logger[_0xae13('0x26')](_0xae13('0x27'),_0x11c2ba,JSON['stringify'](_0x5f0870));_0x4a3deb(_0x5f0870);})[_0xae13('0x1a')](function(_0x133643){logger['error'](_0xae13('0x27'),_0x133643[_0xae13('0x18')],_0x11c2ba);_0x30d2c0(_0x48f0f6['error'](0x1f4,_0x133643[_0xae13('0x18')]));});});};exports[_0xae13('0x29')]=function(_0x3d3569){var _0x231748=this;return new Promise(function(_0x4d7405,_0x20e4ec){var _0x300b4e={'body':_0x3d3569[_0xae13('0x2a')],'channel':_0xae13('0x2b')};var _0x4ed070=_[_0xae13('0x2c')](_[_0xae13('0x2d')](db[_0xae13('0x2e')][_0xae13('0x2f')]),['createdAt','updatedAt',_0xae13('0x30'),_0xae13('0x31')]);var _0x4bff9d=![];if(_0x3d3569[_0xae13('0x2a')]['id']){delete _0x3d3569['body']['id'];}if(_[_0xae13('0x32')](_0x3d3569[_0xae13('0x2a')][_0xae13('0x33')])){return _0x20e4ec(_0x231748['error'](0x1f4,_0xae13('0x34')));}if(_[_0xae13('0x32')](_0x3d3569[_0xae13('0x2a')][_0xae13('0x2a')])||_0x3d3569['body'][_0xae13('0x2a')]===''){return _0x20e4ec(_0x231748[_0xae13('0x17')](0x1f4,_0xae13('0x35')));}if(_[_0xae13('0x32')](_0x3d3569[_0xae13('0x2a')][_0xae13('0x36')])){return _0x20e4ec(_0x231748[_0xae13('0x17')](0x1f4,_0xae13('0x37')+_0x4ed070));}if(!_['includes'](_0x4ed070,_0x3d3569[_0xae13('0x2a')]['mapKey'])){return _0x20e4ec(_0x231748[_0xae13('0x17')](0x1f4,_0xae13('0x38')+_0x4ed070));}var _0x282956={};_0x282956[_0x3d3569[_0xae13('0x2a')]['mapKey']]=_0x3d3569[_0xae13('0x2a')]['from'];return db[_0xae13('0x1b')][_0xae13('0x28')]({'where':{'id':_0x3d3569['account']['id']},'include':[{'model':db[_0xae13('0x39')],'as':_0xae13('0x3a'),'include':[{'model':db[_0xae13('0x2e')],'as':_0xae13('0x3b'),'where':_0x282956,'limit':0x1,'order':[[_0xae13('0x3c'),_0xae13('0x3d')]]}]},{'model':db['MailApplication'],'as':_0xae13('0x3e')},{'model':db[_0xae13('0x3f')],'as':_0xae13('0x40')}]})[_0xae13('0x12')](function(_0x29ba1){if(_0x29ba1&&_0x29ba1['List']){var _0x244f2c=_0x29ba1[_0xae13('0x41')]({'plain':!![]});_0x300b4e[_0xae13('0x42')]=_['omit'](_0x244f2c,['Applications','List']);_0x300b4e['applications']=_0x244f2c[_0xae13('0x3e')];_0x300b4e['list']=_0x244f2c[_0xae13('0x3a')];_0x300b4e['applications']=_[_0xae13('0x43')](_0x300b4e[_0xae13('0x44')],[_0xae13('0x45')],[_0xae13('0x46')]);if(_0x300b4e[_0xae13('0x42')]&&_0x300b4e['account'][_0xae13('0x47')]){_0x300b4e[_0xae13('0x44')]['push']({'id':0x0,'priority':_0x300b4e[_0xae13('0x44')][_0xae13('0x48')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x300b4e['account'][_0xae13('0x3e')]){delete _0x300b4e[_0xae13('0x42')]['Applications'];}if(_0x300b4e[_0xae13('0x42')][_0xae13('0x3a')]){delete _0x300b4e['account'][_0xae13('0x3a')];}if(_0x244f2c[_0xae13('0x3a')][_0xae13('0x3b')][_0xae13('0x48')]){return _0x244f2c[_0xae13('0x3a')][_0xae13('0x3b')][0x0];}var _0x2ac400=_[_0xae13('0x49')](_0x3d3569[_0xae13('0x2a')],{'firstName':_0x3d3569[_0xae13('0x2a')]['from'],'ListId':_0x244f2c[_0xae13('0x31')]});_0x2ac400[_0x3d3569[_0xae13('0x2a')][_0xae13('0x36')]]=_0x3d3569['body'][_0xae13('0x33')];return db['CmContact'][_0xae13('0x4a')](_0x2ac400);}else{throw new Error(_0xae13('0x4b'));}})[_0xae13('0x12')](function(_0x5b61e0){_0x300b4e['contact']=_0x5b61e0;if(_0x5b61e0){if(!_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x4c')]){_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x4c')]=rs[_0xae13('0x4d')]()+'\x20'+_0x3d3569['body'][_0xae13('0x18')][_0xae13('0x33')];}var _0x1cf135={'ContactId':_0x5b61e0['id'],'MailAccountId':_0x3d3569[_0xae13('0x42')]['id'],'inReplyTo':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x4c')],'to':_0x3d3569['body'][_0xae13('0x18')][_0xae13('0x33')],'cc':_0x3d3569['body'][_0xae13('0x18')]['cc'],'subject':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')]['subject'],'attach':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')]['attach'],'lastMsgAt':moment()[_0xae13('0x4e')](_0xae13('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x3d3569[_0xae13('0x2a')][_0xae13('0x2a')]};return db[_0xae13('0x50')][_0xae13('0x28')]({'where':{'closed':![],'MailAccountId':_0x3d3569['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xae13('0x51'),'attributes':[_0xae13('0x4c')],'where':{'messageId':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x52')]}}]})[_0xae13('0x12')](function(_0x47d84e){if(_0x47d84e){return[_0x47d84e,![]];}return db[_0xae13('0x50')][_0xae13('0x4a')](_0x1cf135)['then'](function(_0x507098){return[_0x507098,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xae13('0x53')](function(_0xf998e5,_0x27bcfc){if(_0xf998e5){_0x4bff9d=_0x27bcfc;if(!_0x27bcfc){return _0xf998e5[_0xae13('0x54')]({'inReplyTo':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x4c')],'to':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x33')],'cc':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')]['cc'],'subject':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x55')],'attach':_0xf998e5['attach']?_0xf998e5[_0xae13('0x56')]:_0x3d3569[_0xae13('0x2a')]['message'][_0xae13('0x56')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xae13('0x4e')](_0xae13('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x3d3569[_0xae13('0x2a')][_0xae13('0x2a')]});}else{return _0xf998e5;}}})[_0xae13('0x12')](function(_0x3797da){_0x300b4e['interaction']=_0x3797da['get']({'plain':!![]});_0x300b4e[_0xae13('0x57')][_0xae13('0x58')]=_0x4bff9d;return db[_0xae13('0x59')]['create']({'body':_0x3d3569[_0xae13('0x2a')]['body'],'MailAccountId':_0x3d3569[_0xae13('0x42')]['id'],'MailInteractionId':_0x3797da['id'],'direction':'in','ContactId':_0x300b4e[_0xae13('0x5a')]['id'],'messageId':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x4c')],'from':_0x3d3569['body'][_0xae13('0x18')][_0xae13('0x33')],'to':_0x3d3569['body'][_0xae13('0x18')]['to'],'cc':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')]['cc'],'subject':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x55')],'attach':_0x3d3569['body'][_0xae13('0x18')]['attach'],'Attachments':_0x3d3569[_0xae13('0x2a')]['message'][_0xae13('0x5b')],'originTo':_0x3d3569[_0xae13('0x2a')]['message'][_0xae13('0x5c')],'originCc':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x5d')],'bcc':_0x3d3569[_0xae13('0x2a')][_0xae13('0x18')][_0xae13('0x5e')]},{'include':[{'model':db[_0xae13('0x5f')],'as':'Attachments'}]});})[_0xae13('0x12')](function(_0x12c460){_0x300b4e[_0xae13('0x18')]=_0x12c460;if(_0x300b4e[_0xae13('0x57')][_0xae13('0x60')]){return db[_0xae13('0x61')][_0xae13('0x28')]({'attributes':['id',_0xae13('0x62')],'where':{'id':_0x300b4e[_0xae13('0x57')][_0xae13('0x60')]}})['then'](function(_0x40844e){if(_0x40844e){_0x300b4e['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xae13('0x63'),'appdata':_0x40844e[_0xae13('0x62')]+','+(_0x300b4e[_0xae13('0x42')]['waitForTheAssignedAgent']||0xa),'interval':_0xae13('0x64')});}return respondWithRpcPromise('Start',_0xae13('0x65'),_0x300b4e);});}return respondWithRpcPromise('Start',_0xae13('0x65'),_0x300b4e);})[_0xae13('0x12')](function(_0x4845e6){_0x4d7405(_0x4845e6);})[_0xae13('0x1a')](function(_0x415abb){_0x20e4ec(_0x231748['error'](0x1f4,_0x415abb['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1956412..b621f40 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 _0xbdb9=['update','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb9,0xac));var _0x9bdb=function(_0x1a50b9,_0x56785f){_0x1a50b9=_0x1a50b9-0x0;var _0x497aec=_0xbdb9[_0x1a50b9];return _0x497aec;};'use strict';var MailAccountEvents=require(_0x9bdb('0x0'));var events=[_0x9bdb('0x1'),_0x9bdb('0x2'),_0x9bdb('0x3')];function createListener(_0x23595d,_0x4fe743){return function(_0x24a6af){_0x4fe743['emit'](_0x23595d,_0x24a6af);};}function removeListener(_0x5dbce0,_0x5870f6){return function(){MailAccountEvents['removeListener'](_0x5dbce0,_0x5870f6);};}exports[_0x9bdb('0x4')]=function(_0x4f9fbe){for(var _0x225a66=0x0,_0x4e9c54=events[_0x9bdb('0x5')];_0x225a66<_0x4e9c54;_0x225a66++){var _0x27cdd8=events[_0x225a66];var _0x27c6b8=createListener(_0x9bdb('0x6')+_0x27cdd8,_0x4f9fbe);MailAccountEvents['on'](_0x27cdd8,_0x27c6b8);}}; \ No newline at end of file +var _0xf8b2=['save','remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x2a66d1,_0x41fc66){_0x2a66d1=_0x2a66d1-0x0;var _0x568bac=_0xf8b2[_0x2a66d1];return _0x568bac;};'use strict';var MailAccountEvents=require(_0x2f8b('0x0'));var events=[_0x2f8b('0x1'),_0x2f8b('0x2'),_0x2f8b('0x3')];function createListener(_0x40353f,_0x365b20){return function(_0x22e1c8){_0x365b20[_0x2f8b('0x4')](_0x40353f,_0x22e1c8);};}function removeListener(_0x50dae3,_0x4b33e9){return function(){MailAccountEvents[_0x2f8b('0x5')](_0x50dae3,_0x4b33e9);};}exports[_0x2f8b('0x6')]=function(_0x3c6838){for(var _0x1d133a=0x0,_0x3b0511=events[_0x2f8b('0x7')];_0x1d133a<_0x3b0511;_0x1d133a++){var _0x449c86=events[_0x1d133a];var _0x24bd39=createListener(_0x2f8b('0x8')+_0x449c86,_0x3c6838);MailAccountEvents['on'](_0x449c86,_0x24bd39);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c068a16..c356850 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 _0x0713=['/:id','isAuthenticated','show','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get'];(function(_0x1a2dea,_0x36c84f){var _0xe699c5=function(_0x4edaed){while(--_0x4edaed){_0x1a2dea['push'](_0x1a2dea['shift']());}};_0xe699c5(++_0x36c84f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')](_0x3071('0x8'),auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0xb')](_0x3071('0x8'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0xd')](_0x3071('0x8'),auth[_0x3071('0x9')](),controller['destroy']);module[_0x3071('0xe')]=router; \ No newline at end of file +var _0xbc9d=['path','connect-timeout','express','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','multer','util'];(function(_0x447475,_0x5138ac){var _0x32b86f=function(_0x143dd6){while(--_0x143dd6){_0x447475['push'](_0x447475['shift']());}};_0x32b86f(++_0x5138ac);}(_0xbc9d,0xb4));var _0xdbc9=function(_0xe9608e,_0x50cf47){_0xe9608e=_0xe9608e-0x0;var _0x5a3d18=_0xbc9d[_0xe9608e];return _0x5a3d18;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdbc9('0x5'));var controller=require(_0xdbc9('0x6'));router[_0xdbc9('0x7')](_0xdbc9('0x8'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0xb')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xc')]);router[_0xdbc9('0xd')]('/:id',auth[_0xdbc9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a6097fa..06b3f7f 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 _0xde7e=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x36cfa7,_0x54e888){var _0x6132f2=function(_0x2b72de){while(--_0x2b72de){_0x36cfa7['push'](_0x36cfa7['shift']());}};_0x6132f2(++_0x54e888);}(_0xde7e,0x18d));var _0xede7=function(_0x32ef54,_0x29a926){_0x32ef54=_0x32ef54-0x0;var _0x1206e9=_0xde7e[_0x32ef54];return _0x1206e9;};'use strict';var Sequelize=require(_0xede7('0x0'));module[_0xede7('0x1')]={'priority':{'type':Sequelize[_0xede7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xede7('0x3')],'allowNull':![],'defaultValue':_0xede7('0x4')},'appdata':{'type':Sequelize[_0xede7('0x5')]()},'description':{'type':Sequelize[_0xede7('0x3')]},'interval':{'type':Sequelize[_0xede7('0x3')],'defaultValue':_0xede7('0x6')}}; \ No newline at end of file +var _0xebb3=['sequelize','STRING','noop'];(function(_0x579127,_0x5d6040){var _0x4d9215=function(_0x1c63ab){while(--_0x1c63ab){_0x579127['push'](_0x579127['shift']());}};_0x4d9215(++_0x5d6040);}(_0xebb3,0x180));var _0x3ebb=function(_0x45dd9b,_0x35fa24){_0x45dd9b=_0x45dd9b-0x0;var _0x410941=_0xebb3[_0x45dd9b];return _0x410941;};'use strict';var Sequelize=require(_0x3ebb('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3ebb('0x1')],'allowNull':![],'defaultValue':_0x3ebb('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3ebb('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 45e1ee4..15de5c2 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 _0x67b2=['fields','length','include','merge','options','catch','update','body','find','params','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','reject','save','then','error','name','show','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection'];(function(_0x14c82d,_0x2898ea){var _0x2f7650=function(_0x2a1cc9){while(--_0x2a1cc9){_0x14c82d['push'](_0x14c82d['shift']());}};_0x2f7650(++_0x2898ea);}(_0x67b2,0x75));var _0x267b=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x67b2[_0x44a3b0];return _0x39e6f6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x267b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x267b('0x1'));var rp=require(_0x267b('0x2'));var moment=require(_0x267b('0x3'));var BPromise=require(_0x267b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x267b('0x5'));var csv=require(_0x267b('0x6'));var ejs=require(_0x267b('0x7'));var fs=require('fs');var _=require(_0x267b('0x8'));var squel=require(_0x267b('0x9'));var crypto=require(_0x267b('0xa'));var jsforce=require(_0x267b('0xb'));var deskjs=require(_0x267b('0xc'));var toCsv=require(_0x267b('0x6'));var querystring=require(_0x267b('0xd'));var Papa=require(_0x267b('0xe'));var Redis=require(_0x267b('0xf'));var authService=require(_0x267b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x267b('0x11'));var hardwareService=require(_0x267b('0x12'));var logger=require(_0x267b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x267b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2064a8,_0x4b1564){_0x4b1564=_0x4b1564||0xcc;return function(_0x1113fa){if(_0x1113fa){return _0x2064a8[_0x267b('0x15')](_0x4b1564);}return _0x2064a8[_0x267b('0x16')](_0x4b1564)[_0x267b('0x17')]();};}function respondWithResult(_0x75cae0,_0x4402df){_0x4402df=_0x4402df||0xc8;return function(_0x8ce18d){if(_0x8ce18d){return _0x75cae0[_0x267b('0x16')](_0x4402df)[_0x267b('0x18')](_0x8ce18d);}};}function respondWithFilteredResult(_0x5798ca,_0x34c140){return function(_0x3b3811){if(_0x3b3811){var _0x33c21e=_0x3b3811[_0x267b('0x19')],_0x55594a=_0x34c140[_0x267b('0x1a')],_0x41b1a1=_0x34c140[_0x267b('0x1a')]+_0x34c140[_0x267b('0x1b')],_0x3b9697;if(_0x41b1a1>=_0x33c21e){_0x41b1a1=_0x33c21e;_0x3b9697=0xc8;}else{_0x3b9697=0xce;}_0x5798ca[_0x267b('0x16')](_0x3b9697);return _0x5798ca['set']('Content-Range',_0x55594a+'-'+_0x41b1a1+'/'+_0x33c21e)['json'](_0x3b3811);}return null;};}function patchUpdates(_0x4f6fd3){return function(_0x27c03f){try{jsonpatch['apply'](_0x27c03f,_0x4f6fd3,!![]);}catch(_0x275f60){return BPromise[_0x267b('0x1c')](_0x275f60);}return _0x27c03f[_0x267b('0x1d')]();};}function saveUpdates(_0x2be42d,_0x1aadaa){return function(_0x578faf){if(_0x578faf){return _0x578faf['update'](_0x2be42d)[_0x267b('0x1e')](function(_0x24a02b){return _0x24a02b;});}return null;};}function removeEntity(_0x10f56a,_0x230469){return function(_0x44d3e9){if(_0x44d3e9){return _0x44d3e9['destroy']()[_0x267b('0x1e')](function(){_0x10f56a[_0x267b('0x16')](0xcc)[_0x267b('0x17')]();});}};}function handleEntityNotFound(_0x17f858,_0x5bfb05){return function(_0x474de0){if(!_0x474de0){_0x17f858[_0x267b('0x15')](0x194);}return _0x474de0;};}function handleError(_0x2b2a8c,_0x29f854){_0x29f854=_0x29f854||0x1f4;return function(_0x3a12c8){logger[_0x267b('0x1f')](_0x3a12c8['stack']);if(_0x3a12c8[_0x267b('0x20')]){delete _0x3a12c8[_0x267b('0x20')];}_0x2b2a8c[_0x267b('0x16')](_0x29f854)['send'](_0x3a12c8);};}exports[_0x267b('0x21')]=function(_0x127d6b,_0x3f25d9){var _0x5b8fd3={'raw':!![],'where':{'id':_0x127d6b['params']['id']}},_0x4a9121={};_0x4a9121[_0x267b('0x22')]=_[_0x267b('0x23')](db[_0x267b('0x24')][_0x267b('0x25')]);_0x4a9121[_0x267b('0x26')]=_['keys'](_0x127d6b['query']);_0x4a9121[_0x267b('0x27')]=_['intersection'](_0x4a9121['model'],_0x4a9121[_0x267b('0x26')]);_0x5b8fd3[_0x267b('0x28')]=_[_0x267b('0x29')](_0x4a9121[_0x267b('0x22')],qs['fields'](_0x127d6b[_0x267b('0x26')][_0x267b('0x2a')]));_0x5b8fd3['attributes']=_0x5b8fd3[_0x267b('0x28')][_0x267b('0x2b')]?_0x5b8fd3[_0x267b('0x28')]:_0x4a9121['model'];if(_0x127d6b[_0x267b('0x26')]['includeAll']){_0x5b8fd3[_0x267b('0x2c')]=[{'all':!![]}];}_0x5b8fd3=_[_0x267b('0x2d')]({},_0x5b8fd3,_0x127d6b[_0x267b('0x2e')]);return db[_0x267b('0x24')]['find'](_0x5b8fd3)[_0x267b('0x1e')](handleEntityNotFound(_0x3f25d9,null))['then'](respondWithResult(_0x3f25d9,null))[_0x267b('0x2f')](handleError(_0x3f25d9,null));};exports[_0x267b('0x30')]=function(_0x6fcc79,_0x2ebf5e){if(_0x6fcc79[_0x267b('0x31')]['id']){delete _0x6fcc79[_0x267b('0x31')]['id'];}return db[_0x267b('0x24')][_0x267b('0x32')]({'where':{'id':_0x6fcc79[_0x267b('0x33')]['id']}})[_0x267b('0x1e')](handleEntityNotFound(_0x2ebf5e,null))['then'](saveUpdates(_0x6fcc79['body'],null))[_0x267b('0x1e')](respondWithResult(_0x2ebf5e,null))[_0x267b('0x2f')](handleError(_0x2ebf5e,null));};exports[_0x267b('0x34')]=function(_0x35f494,_0x4ddc9d){return db[_0x267b('0x24')][_0x267b('0x32')]({'where':{'id':_0x35f494[_0x267b('0x33')]['id']}})[_0x267b('0x1e')](handleEntityNotFound(_0x4ddc9d,null))['then'](removeEntity(_0x4ddc9d,null))[_0x267b('0x2f')](handleError(_0x4ddc9d,null));}; \ No newline at end of file +var _0xe20f=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','stack','name','send','show','params','model','keys','query','intersection','fields','attributes','includeAll','include','options','find','body','catch','MailApplication','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x401751,_0x3a3e9c){var _0x1c1cfa=function(_0xa0bcac){while(--_0xa0bcac){_0x401751['push'](_0x401751['shift']());}};_0x1c1cfa(++_0x3a3e9c);}(_0xe20f,0x140));var _0xfe20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe20f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xfe20('0x0'));var emlformat=require(_0xfe20('0x1'));var rimraf=require(_0xfe20('0x2'));var zipdir=require(_0xfe20('0x3'));var jsonpatch=require(_0xfe20('0x4'));var rp=require(_0xfe20('0x5'));var moment=require(_0xfe20('0x6'));var BPromise=require(_0xfe20('0x7'));var Mustache=require(_0xfe20('0x8'));var util=require(_0xfe20('0x9'));var path=require(_0xfe20('0xa'));var sox=require(_0xfe20('0xb'));var csv=require(_0xfe20('0xc'));var ejs=require(_0xfe20('0xd'));var fs=require('fs');var _=require(_0xfe20('0xe'));var squel=require(_0xfe20('0xf'));var crypto=require('crypto');var jsforce=require(_0xfe20('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xfe20('0xc'));var querystring=require('querystring');var Papa=require(_0xfe20('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfe20('0x12'));var as=require(_0xfe20('0x13'));var hardwareService=require(_0xfe20('0x14'));var logger=require(_0xfe20('0x15'))('api');var utils=require(_0xfe20('0x16'));var config=require(_0xfe20('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec1be5,_0x26a7aa){_0x26a7aa=_0x26a7aa||0xcc;return function(_0x2ad5a3){if(_0x2ad5a3){return _0xec1be5[_0xfe20('0x18')](_0x26a7aa);}return _0xec1be5[_0xfe20('0x19')](_0x26a7aa)[_0xfe20('0x1a')]();};}function respondWithResult(_0x1e17e8,_0x19eb98){_0x19eb98=_0x19eb98||0xc8;return function(_0x232a7b){if(_0x232a7b){return _0x1e17e8[_0xfe20('0x19')](_0x19eb98)[_0xfe20('0x1b')](_0x232a7b);}};}function respondWithFilteredResult(_0x2dd208,_0x5075bb){return function(_0x48b87f){if(_0x48b87f){var _0x492747=_0x48b87f[_0xfe20('0x1c')],_0x2431b7=_0x5075bb[_0xfe20('0x1d')],_0x2b9c69=_0x5075bb[_0xfe20('0x1d')]+_0x5075bb[_0xfe20('0x1e')],_0x1c2e57;if(_0x2b9c69>=_0x492747){_0x2b9c69=_0x492747;_0x1c2e57=0xc8;}else{_0x1c2e57=0xce;}_0x2dd208[_0xfe20('0x19')](_0x1c2e57);return _0x2dd208[_0xfe20('0x1f')]('Content-Range',_0x2431b7+'-'+_0x2b9c69+'/'+_0x492747)[_0xfe20('0x1b')](_0x48b87f);}return null;};}function patchUpdates(_0x2fceba){return function(_0xb74131){try{jsonpatch['apply'](_0xb74131,_0x2fceba,!![]);}catch(_0x137733){return BPromise[_0xfe20('0x20')](_0x137733);}return _0xb74131['save']();};}function saveUpdates(_0x26a01e,_0x28e1c0){return function(_0x5d1b4d){if(_0x5d1b4d){return _0x5d1b4d[_0xfe20('0x21')](_0x26a01e)[_0xfe20('0x22')](function(_0x13cd3e){return _0x13cd3e;});}return null;};}function removeEntity(_0x3af1a5,_0x49154c){return function(_0x3ceffe){if(_0x3ceffe){return _0x3ceffe[_0xfe20('0x23')]()[_0xfe20('0x22')](function(){_0x3af1a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x354118,_0xd6b001){return function(_0x2fa0f0){if(!_0x2fa0f0){_0x354118[_0xfe20('0x18')](0x194);}return _0x2fa0f0;};}function handleError(_0x2991ce,_0x4c82){_0x4c82=_0x4c82||0x1f4;return function(_0x3fddc2){logger['error'](_0x3fddc2[_0xfe20('0x24')]);if(_0x3fddc2['name']){delete _0x3fddc2[_0xfe20('0x25')];}_0x2991ce[_0xfe20('0x19')](_0x4c82)[_0xfe20('0x26')](_0x3fddc2);};}exports[_0xfe20('0x27')]=function(_0x40218d,_0x17ad60){var _0x58446d={'raw':!![],'where':{'id':_0x40218d[_0xfe20('0x28')]['id']}},_0x3f8061={};_0x3f8061[_0xfe20('0x29')]=_[_0xfe20('0x2a')](db['MailApplication']['rawAttributes']);_0x3f8061[_0xfe20('0x2b')]=_[_0xfe20('0x2a')](_0x40218d['query']);_0x3f8061['filters']=_[_0xfe20('0x2c')](_0x3f8061[_0xfe20('0x29')],_0x3f8061[_0xfe20('0x2b')]);_0x58446d['attributes']=_[_0xfe20('0x2c')](_0x3f8061['model'],qs[_0xfe20('0x2d')](_0x40218d[_0xfe20('0x2b')][_0xfe20('0x2d')]));_0x58446d[_0xfe20('0x2e')]=_0x58446d['attributes']['length']?_0x58446d[_0xfe20('0x2e')]:_0x3f8061[_0xfe20('0x29')];if(_0x40218d[_0xfe20('0x2b')][_0xfe20('0x2f')]){_0x58446d[_0xfe20('0x30')]=[{'all':!![]}];}_0x58446d=_['merge']({},_0x58446d,_0x40218d[_0xfe20('0x31')]);return db['MailApplication'][_0xfe20('0x32')](_0x58446d)['then'](handleEntityNotFound(_0x17ad60,null))[_0xfe20('0x22')](respondWithResult(_0x17ad60,null))['catch'](handleError(_0x17ad60,null));};exports[_0xfe20('0x21')]=function(_0x33ffb5,_0x2c3bea){if(_0x33ffb5[_0xfe20('0x33')]['id']){delete _0x33ffb5[_0xfe20('0x33')]['id'];}return db['MailApplication'][_0xfe20('0x32')]({'where':{'id':_0x33ffb5['params']['id']}})[_0xfe20('0x22')](handleEntityNotFound(_0x2c3bea,null))[_0xfe20('0x22')](saveUpdates(_0x33ffb5[_0xfe20('0x33')],null))[_0xfe20('0x22')](respondWithResult(_0x2c3bea,null))[_0xfe20('0x34')](handleError(_0x2c3bea,null));};exports['destroy']=function(_0x3b6743,_0x3daf9a){return db[_0xfe20('0x35')]['find']({'where':{'id':_0x3b6743[_0xfe20('0x28')]['id']}})[_0xfe20('0x22')](handleEntityNotFound(_0x3daf9a,null))[_0xfe20('0x22')](removeEntity(_0x3daf9a,null))[_0xfe20('0x34')](handleError(_0x3daf9a,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b0b2128..e67990f 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 _0xd448=['../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x380b08,_0x1df63a){var _0x22f65d=function(_0x507f73){while(--_0x507f73){_0x380b08['push'](_0x380b08['shift']());}};_0x22f65d(++_0x1df63a);}(_0xd448,0x172));var _0x8d44=function(_0x36e2db,_0x7c037c){_0x36e2db=_0x36e2db-0x0;var _0x312ae1=_0xd448[_0x36e2db];return _0x312ae1;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var logger=require(_0x8d44('0x1'))(_0x8d44('0x2'));var moment=require(_0x8d44('0x3'));var BPromise=require(_0x8d44('0x4'));var rp=require(_0x8d44('0x5'));var fs=require('fs');var path=require(_0x8d44('0x6'));var rimraf=require(_0x8d44('0x7'));var config=require(_0x8d44('0x8'));var attributes=require(_0x8d44('0x9'));module['exports']=function(_0x41ae8e,_0x5032bc){return _0x41ae8e['define'](_0x8d44('0xa'),attributes,{'tableName':_0x8d44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d44('0xc'),'collate':_0x8d44('0xd')});}; \ No newline at end of file +var _0x866a=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2ac756,_0x33408b){var _0xa621fb=function(_0x5a316f){while(--_0x5a316f){_0x2ac756['push'](_0x2ac756['shift']());}};_0xa621fb(++_0x33408b);}(_0x866a,0x156));var _0xa866=function(_0x5d3550,_0x107033){_0x5d3550=_0x5d3550-0x0;var _0x5d1299=_0x866a[_0x5d3550];return _0x5d1299;};'use strict';var _=require('lodash');var util=require(_0xa866('0x0'));var logger=require(_0xa866('0x1'))(_0xa866('0x2'));var moment=require(_0xa866('0x3'));var BPromise=require(_0xa866('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa866('0x5'));var rimraf=require(_0xa866('0x6'));var config=require(_0xa866('0x7'));var attributes=require('./mailApplication.attributes');module[_0xa866('0x8')]=function(_0x31a017,_0x1ea4de){return _0x31a017[_0xa866('0x9')](_0xa866('0xa'),attributes,{'tableName':_0xa866('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa866('0xc'),'collate':_0xa866('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9b79db6..0c262cf 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 _0x67ac=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','MailApplication','update','body','options','raw','where','limit','UpdateMailApplication','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s'];(function(_0x310c57,_0x44fee1){var _0x41a80e=function(_0x27643d){while(--_0x27643d){_0x310c57['push'](_0x310c57['shift']());}};_0x41a80e(++_0x44fee1);}(_0x67ac,0xc5));var _0xc67a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x67ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc67a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc67a('0x1'));var db=require(_0xc67a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xc67a('0x3'))('rpc');var config=require(_0xc67a('0x4'));var jayson=require(_0xc67a('0x5'));var client=jayson[_0xc67a('0x6')][_0xc67a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xebf28e,_0x217e74,_0x54883c){return new BPromise(function(_0x40d137,_0x116653){return client['request'](_0xebf28e,_0x54883c)[_0xc67a('0x8')](function(_0x18f2d9){logger[_0xc67a('0x9')](_0xc67a('0xa'),_0x217e74,_0xc67a('0xb'));logger[_0xc67a('0xc')](_0xc67a('0xd'),_0x217e74,'request\x20sent',JSON[_0xc67a('0xe')](_0x18f2d9));if(_0x18f2d9[_0xc67a('0xf')]){if(_0x18f2d9['error']['code']===0x1f4){logger[_0xc67a('0xf')]('MailApplication,\x20%s,\x20%s',_0x217e74,_0x18f2d9[_0xc67a('0xf')]['message']);return _0x116653(_0x18f2d9[_0xc67a('0xf')][_0xc67a('0x10')]);}logger['error'](_0xc67a('0xa'),_0x217e74,_0x18f2d9['error'][_0xc67a('0x10')]);return _0x40d137(_0x18f2d9[_0xc67a('0xf')]['message']);}else{logger['info'](_0xc67a('0xa'),_0x217e74,_0xc67a('0xb'));_0x40d137(_0x18f2d9['result'][_0xc67a('0x10')]);}})[_0xc67a('0x11')](function(_0x414785){logger['error'](_0xc67a('0xa'),_0x217e74,_0x414785);_0x116653(_0x414785);});});}exports['UpdateMailApplication']=function(_0x95f834){var _0x1cd624=this;return new Promise(function(_0xc017f,_0x4ba26b){return db[_0xc67a('0x12')][_0xc67a('0x13')](_0x95f834[_0xc67a('0x14')],{'raw':_0x95f834['options']?_0x95f834[_0xc67a('0x15')][_0xc67a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95f834[_0xc67a('0x15')]?_0x95f834[_0xc67a('0x15')][_0xc67a('0x17')]||null:null,'attributes':_0x95f834[_0xc67a('0x15')]?_0x95f834['options']['attributes']||null:null,'limit':_0x95f834[_0xc67a('0x15')]?_0x95f834['options'][_0xc67a('0x18')]||null:null})[_0xc67a('0x8')](function(_0x1bc37f){logger[_0xc67a('0x9')](_0xc67a('0x19'),_0x95f834);logger['debug'](_0xc67a('0x19'),_0x95f834,JSON['stringify'](_0x1bc37f));_0xc017f(_0x1bc37f);})['catch'](function(_0x11c54b){logger[_0xc67a('0xf')](_0xc67a('0x19'),_0x11c54b['message'],_0x95f834);_0x4ba26b(_0x1cd624[_0xc67a('0xf')](0x1f4,_0x11c54b[_0xc67a('0x10')]));});});}; \ No newline at end of file +var _0x7ef2=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x4eecb9,_0x4d60a3){var _0x6f9cb9=function(_0x3c80e0){while(--_0x3c80e0){_0x4eecb9['push'](_0x4eecb9['shift']());}};_0x6f9cb9(++_0x4d60a3);}(_0x7ef2,0x130));var _0x27ef=function(_0x307386,_0x5100fc){_0x307386=_0x307386-0x0;var _0xbcdcc3=_0x7ef2[_0x307386];return _0xbcdcc3;};'use strict';var _=require(_0x27ef('0x0'));var util=require(_0x27ef('0x1'));var moment=require(_0x27ef('0x2'));var BPromise=require(_0x27ef('0x3'));var rs=require(_0x27ef('0x4'));var fs=require('fs');var Redis=require(_0x27ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x27ef('0x6'))(_0x27ef('0x7'));var config=require(_0x27ef('0x8'));var jayson=require(_0x27ef('0x9'));var client=jayson['client'][_0x27ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ce0fb,_0x456f40,_0x48dd97){return new BPromise(function(_0x3d00a6,_0x395f9d){return client['request'](_0x1ce0fb,_0x48dd97)[_0x27ef('0xb')](function(_0x370c98){logger[_0x27ef('0xc')](_0x27ef('0xd'),_0x456f40,_0x27ef('0xe'));logger['debug'](_0x27ef('0xf'),_0x456f40,_0x27ef('0xe'),JSON[_0x27ef('0x10')](_0x370c98));if(_0x370c98[_0x27ef('0x11')]){if(_0x370c98[_0x27ef('0x11')]['code']===0x1f4){logger['error'](_0x27ef('0xd'),_0x456f40,_0x370c98[_0x27ef('0x11')][_0x27ef('0x12')]);return _0x395f9d(_0x370c98[_0x27ef('0x11')][_0x27ef('0x12')]);}logger[_0x27ef('0x11')](_0x27ef('0xd'),_0x456f40,_0x370c98[_0x27ef('0x11')][_0x27ef('0x12')]);return _0x3d00a6(_0x370c98['error'][_0x27ef('0x12')]);}else{logger[_0x27ef('0xc')](_0x27ef('0xd'),_0x456f40,_0x27ef('0xe'));_0x3d00a6(_0x370c98['result'][_0x27ef('0x12')]);}})[_0x27ef('0x13')](function(_0x1c4ced){logger[_0x27ef('0x11')](_0x27ef('0xd'),_0x456f40,_0x1c4ced);_0x395f9d(_0x1c4ced);});});}exports[_0x27ef('0x14')]=function(_0x4fda18){var _0x24af1c=this;return new Promise(function(_0x2b7459,_0x3af4d7){return db['MailApplication'][_0x27ef('0x15')](_0x4fda18[_0x27ef('0x16')],{'raw':_0x4fda18['options']?_0x4fda18[_0x27ef('0x17')][_0x27ef('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fda18[_0x27ef('0x17')]?_0x4fda18[_0x27ef('0x17')][_0x27ef('0x19')]||null:null,'attributes':_0x4fda18['options']?_0x4fda18[_0x27ef('0x17')][_0x27ef('0x1a')]||null:null,'limit':_0x4fda18[_0x27ef('0x17')]?_0x4fda18['options'][_0x27ef('0x1b')]||null:null})[_0x27ef('0xb')](function(_0xf136c6){logger[_0x27ef('0xc')]('UpdateMailApplication',_0x4fda18);logger[_0x27ef('0x1c')](_0x27ef('0x14'),_0x4fda18,JSON['stringify'](_0xf136c6));_0x2b7459(_0xf136c6);})['catch'](function(_0x426e13){logger[_0x27ef('0x11')]('UpdateMailApplication',_0x426e13['message'],_0x4fda18);_0x3af4d7(_0x24af1c[_0x27ef('0x11')](0x1f4,_0x426e13[_0x27ef('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 077e0ee..14c0376 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 _0x2882=['addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','/:id','get','/:id/messages','getMessages','create','post'];(function(_0x4f2a4b,_0x5a0dfe){var _0x1e29af=function(_0x56d3b9){while(--_0x56d3b9){_0x4f2a4b['push'](_0x4f2a4b['shift']());}};_0x1e29af(++_0x5a0dfe);}(_0x2882,0x1db));var _0x2288=function(_0x1e297d,_0x4604cb){_0x1e297d=_0x1e297d-0x0;var _0x4a7f6a=_0x2882[_0x1e297d];return _0x4a7f6a;};'use strict';var multer=require(_0x2288('0x0'));var util=require('util');var path=require(_0x2288('0x1'));var timeout=require(_0x2288('0x2'));var express=require(_0x2288('0x3'));var router=express[_0x2288('0x4')]();var auth=require(_0x2288('0x5'));var interaction=require(_0x2288('0x6'));var config=require(_0x2288('0x7'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2288('0x8')]);router['get'](_0x2288('0x9'),auth[_0x2288('0xa')](),controller[_0x2288('0xb')]);router['get'](_0x2288('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2288('0xd')](_0x2288('0xe'),auth[_0x2288('0xa')](),controller[_0x2288('0xf')]);router[_0x2288('0xd')]('/:id/download',auth[_0x2288('0xa')](),controller['download']);router['post']('/',auth[_0x2288('0xa')](),controller[_0x2288('0x10')]);router[_0x2288('0x11')](_0x2288('0xe'),auth[_0x2288('0xa')](),controller[_0x2288('0x12')]);router[_0x2288('0x11')](_0x2288('0x13'),auth[_0x2288('0xa')](),interaction[_0x2288('0x14')](_0x2288('0x15'),'mailinteraction:addtags'),controller[_0x2288('0x16')]);router[_0x2288('0x17')](_0x2288('0xc'),auth[_0x2288('0xa')](),interaction[_0x2288('0x14')](_0x2288('0x15'),_0x2288('0x18')),controller[_0x2288('0x19')]);router[_0x2288('0x1a')]('/:id',auth[_0x2288('0xa')](),interaction['tracked']('mail',_0x2288('0x1b')),controller['destroy']);router[_0x2288('0x1a')](_0x2288('0x13'),auth[_0x2288('0xa')](),controller[_0x2288('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x9f29=['/:id/messages','/:id/download','create','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','index','/describe','/:id','isAuthenticated','show'];(function(_0x2f469b,_0x316be9){var _0x5222e9=function(_0x4dc57f){while(--_0x4dc57f){_0x2f469b['push'](_0x2f469b['shift']());}};_0x5222e9(++_0x316be9);}(_0x9f29,0x64));var _0x99f2=function(_0x40565e,_0x10619e){_0x40565e=_0x40565e-0x0;var _0x2b44ec=_0x9f29[_0x40565e];return _0x2b44ec;};'use strict';var multer=require(_0x99f2('0x0'));var util=require(_0x99f2('0x1'));var path=require(_0x99f2('0x2'));var timeout=require(_0x99f2('0x3'));var express=require(_0x99f2('0x4'));var router=express['Router']();var auth=require(_0x99f2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0x99f2('0x6')]('/',auth['isAuthenticated'](),controller[_0x99f2('0x7')]);router['get'](_0x99f2('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x99f2('0x6')](_0x99f2('0x9'),auth[_0x99f2('0xa')](),controller[_0x99f2('0xb')]);router[_0x99f2('0x6')](_0x99f2('0xc'),auth[_0x99f2('0xa')](),controller['getMessages']);router['get'](_0x99f2('0xd'),auth[_0x99f2('0xa')](),controller['download']);router['post']('/',auth[_0x99f2('0xa')](),controller[_0x99f2('0xe')]);router[_0x99f2('0xf')](_0x99f2('0xc'),auth[_0x99f2('0xa')](),controller[_0x99f2('0x10')]);router[_0x99f2('0xf')](_0x99f2('0x11'),auth[_0x99f2('0xa')](),interaction[_0x99f2('0x12')]('mail',_0x99f2('0x13')),controller[_0x99f2('0x14')]);router['put'](_0x99f2('0x9'),auth[_0x99f2('0xa')](),interaction[_0x99f2('0x12')](_0x99f2('0x15'),_0x99f2('0x16')),controller[_0x99f2('0x17')]);router[_0x99f2('0x18')](_0x99f2('0x9'),auth['isAuthenticated'](),interaction[_0x99f2('0x12')](_0x99f2('0x15'),_0x99f2('0x19')),controller['destroy']);router[_0x99f2('0x18')]('/:id/tags',auth[_0x99f2('0xa')](),controller[_0x99f2('0x1a')]);module[_0x99f2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index cc0949f..59cc114 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 _0x2ee0=['out','long','sequelize','iconv','exports','STRING','TEXT','BOOLEAN','DATE','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2ee0,0xb6));var _0x02ee=function(_0x2c1ee7,_0x3443b8){_0x2c1ee7=_0x2c1ee7-0x0;var _0x2f9e25=_0x2ee0[_0x2c1ee7];return _0x2f9e25;};'use strict';var Sequelize=require(_0x02ee('0x0'));var iconv=require(_0x02ee('0x1'));module[_0x02ee('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x02ee('0x3')]},'note':{'type':Sequelize[_0x02ee('0x3')]},'inReplyTo':{'type':Sequelize[_0x02ee('0x3')](0x1fe)},'to':{'type':Sequelize[_0x02ee('0x3')]},'cc':{'type':Sequelize[_0x02ee('0x4')]('long')},'subject':{'type':Sequelize[_0x02ee('0x4')]()},'attach':{'type':Sequelize[_0x02ee('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x02ee('0x6')]},'substatus':{'type':Sequelize[_0x02ee('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x02ee('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x02ee('0x7')]('in',_0x02ee('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x02ee('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x02ee('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT']('long')},'lastMsgText':{'type':Sequelize['TEXT'](_0x02ee('0x9'))}}; \ No newline at end of file +var _0x5921=['long','TEXT','DATE','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x53431b,_0x324d48){var _0xec5ba4=function(_0x690519){while(--_0x690519){_0x53431b['push'](_0x53431b['shift']());}};_0xec5ba4(++_0x324d48);}(_0x5921,0x11c));var _0x1592=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x5921[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0x1592('0x0'));var iconv=require('iconv');module[_0x1592('0x1')]={'closed':{'type':Sequelize[_0x1592('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1592('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x1592('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x1592('0x4'))},'subject':{'type':Sequelize[_0x1592('0x5')]()},'attach':{'type':Sequelize[_0x1592('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1592('0x6')]},'substatus':{'type':Sequelize[_0x1592('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x1592('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1592('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1592('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1592('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x1592('0x4'))},'lastMsgText':{'type':Sequelize[_0x1592('0x5')](_0x1592('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 964b045..b8dfe50 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 _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x5abc8a,_0x266f92){var _0x21bd12=function(_0x34a45c){while(--_0x34a45c){_0x5abc8a['push'](_0x5abc8a['shift']());}};_0x21bd12(++_0x266f92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x9bf6d7,_0x42d5cc){var _0x167a8e=function(_0x5dcb4c){while(--_0x5dcb4c){_0x9bf6d7['push'](_0x9bf6d7['shift']());}};_0x167a8e(++_0x42d5cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index dec4db7..0ca9afa 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 _0x2e68=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','length'];(function(_0x363e5c,_0x1eabfa){var _0x37c5ac=function(_0x503167){while(--_0x503167){_0x363e5c['push'](_0x363e5c['shift']());}};_0x37c5ac(++_0x1eabfa);}(_0x2e68,0x1c4));var _0x82e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2e68[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x82e6('0x0'))['db'][_0x82e6('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x82e6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x82e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x82e6('0x4'),'afterDestroy':_0x82e6('0x5')};function emitEvent(_0x346763){return function(_0x4440b9,_0x3269fb,_0x106132){_0x4440b9[_0x82e6('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x345e5c){_0x4440b9[_0x82e6('0x7')](_0x82e6('0x8'),_0x345e5c[_0x82e6('0x9')](function(_0xa8e0a2){return{'id':_0xa8e0a2['id']};}));return MailMessage[_0x82e6('0xa')]({'where':{'MailInteractionId':_0x4440b9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1c2b8f){_0x4440b9[_0x82e6('0x7')]('unreadMessages',_0x1c2b8f[_0x82e6('0xb')]);MailInteractionEvents[_0x82e6('0xc')](_0x346763+':'+_0x4440b9['id'],_0x4440b9);MailInteractionEvents['emit'](_0x346763,_0x4440b9);_0x106132(null);})['catch'](_0x106132(null));};}for(var e in events){if(events[_0x82e6('0xd')](e)){var event=events[e];MailInteraction[_0x82e6('0xe')](e,emitEvent(event));}}module[_0x82e6('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x6ce9=['map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers','setDataValue'];(function(_0x1e0da8,_0x3d1a67){var _0x4a2c79=function(_0x25a777){while(--_0x25a777){_0x1e0da8['push'](_0x1e0da8['shift']());}};_0x4a2c79(++_0x3d1a67);}(_0x6ce9,0xf8));var _0x96ce=function(_0xeb236a,_0x1eb222){_0xeb236a=_0xeb236a-0x0;var _0x23a246=_0x6ce9[_0xeb236a];return _0x23a246;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x96ce('0x0'))['db'][_0x96ce('0x1')];var MailMessage=require(_0x96ce('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x96ce('0x2')](0x0);var events={'afterCreate':_0x96ce('0x3'),'afterUpdate':_0x96ce('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f4a19){return function(_0x21f708,_0x8fbed4,_0x71af20){_0x21f708[_0x96ce('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40cb93){_0x21f708[_0x96ce('0x6')]('Users',_0x40cb93[_0x96ce('0x7')](function(_0x32a189){return{'id':_0x32a189['id']};}));return MailMessage[_0x96ce('0x8')]({'where':{'MailInteractionId':_0x21f708['id'],'direction':'in','read':![]},'raw':!![]});})[_0x96ce('0x9')](function(_0x8e94f5){_0x21f708['setDataValue'](_0x96ce('0xa'),_0x8e94f5['length']);MailInteractionEvents['emit'](_0x5f4a19+':'+_0x21f708['id'],_0x21f708);MailInteractionEvents[_0x96ce('0xb')](_0x5f4a19,_0x21f708);_0x71af20(null);})[_0x96ce('0xc')](_0x71af20(null));};}for(var e in events){if(events[_0x96ce('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x96ce('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d8d0f84..28c2e84 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 _0x2318=['get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x2318,0x115));var _0x8231=function(_0x2e9ba6,_0x33a7ad){_0x2e9ba6=_0x2e9ba6-0x0;var _0x3c1f7f=_0x2318[_0x2e9ba6];return _0x3c1f7f;};'use strict';var _=require('lodash');var util=require(_0x8231('0x0'));var logger=require(_0x8231('0x1'))(_0x8231('0x2'));var moment=require('moment');var BPromise=require(_0x8231('0x3'));var rp=require(_0x8231('0x4'));var fs=require('fs');var path=require(_0x8231('0x5'));var rimraf=require(_0x8231('0x6'));var config=require(_0x8231('0x7'));var attributes=require(_0x8231('0x8'));module['exports']=function(_0x9d0d99,_0x18a3c8){return _0x9d0d99['define']('MailInteraction',attributes,{'tableName':_0x8231('0x9'),'paranoid':![],'indexes':[{'name':_0x8231('0xa'),'fields':['subject','to'],'type':_0x8231('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1848f8,_0x4a6746,_0x29b004){if(_0x1848f8[_0x8231('0xc')]){_0x1848f8[_0x8231('0xd')]=moment()[_0x8231('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1848f8[_0x8231('0xf')]){_0x1848f8[_0x8231('0x10')]=moment()[_0x8231('0xe')](_0x8231('0x11'));}_0x29b004(null,_0x4a6746);},'beforeUpdate':function(_0x4d9027,_0x338b64,_0x2972d2){if(_0x4d9027[_0x8231('0x12')](_0x8231('0xc'))){_0x4d9027[_0x8231('0xd')]=_0x4d9027['substatus']?moment()[_0x8231('0xe')](_0x8231('0x11')):null;}if(_0x4d9027[_0x8231('0x12')]('closed')){_0x4d9027[_0x8231('0x10')]=moment()[_0x8231('0xe')](_0x8231('0x11'));_0x4d9027['substatus']=null;_0x4d9027[_0x8231('0xd')]=null;}_0x2972d2(null,_0x4d9027);},'afterUpdate':function(_0x38479f,_0x4d2f1b,_0xb6d96){var _0x2cf898=_0x9d0d99[_0x8231('0x13')];var _0x1e432f=_0x38479f[_0x8231('0x14')]({'plain':!![]});if(_0x1e432f[_0x8231('0xf')]){return _0x2cf898[_0x8231('0x15')][_0x8231('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1e432f['id']}})[_0x8231('0x17')](function(){_0xb6d96();})[_0x8231('0x18')](function(_0x214ae3){_0xb6d96(_0x214ae3);});}else{_0xb6d96();}}},'charset':_0x8231('0x19'),'collate':_0x8231('0x1a')});}; \ No newline at end of file +var _0xb941=['closedAt','changed','substatus','format','models','get','MailMessage','catch','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatusAt','closed'];(function(_0xffa302,_0xfd695c){var _0x38ea4b=function(_0xaa04c3){while(--_0xaa04c3){_0xffa302['push'](_0xffa302['shift']());}};_0x38ea4b(++_0xfd695c);}(_0xb941,0x1ec));var _0x1b94=function(_0xf4b49,_0x7c2356){_0xf4b49=_0xf4b49-0x0;var _0x181c78=_0xb941[_0xf4b49];return _0x181c78;};'use strict';var _=require(_0x1b94('0x0'));var util=require(_0x1b94('0x1'));var logger=require('../../config/logger')(_0x1b94('0x2'));var moment=require(_0x1b94('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b94('0x4'));var fs=require('fs');var path=require(_0x1b94('0x5'));var rimraf=require(_0x1b94('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x442dbe,_0x4638ac){return _0x442dbe[_0x1b94('0x7')](_0x1b94('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x1b94('0x9'),'fields':[_0x1b94('0xa'),'to'],'type':_0x1b94('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xace67b,_0x2428d1,_0xa1210){if(_0xace67b['substatus']){_0xace67b[_0x1b94('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xace67b[_0x1b94('0xd')]){_0xace67b[_0x1b94('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xa1210(null,_0x2428d1);},'beforeUpdate':function(_0x13121e,_0x2c6614,_0x42bd8f){if(_0x13121e[_0x1b94('0xf')](_0x1b94('0x10'))){_0x13121e[_0x1b94('0xc')]=_0x13121e[_0x1b94('0x10')]?moment()[_0x1b94('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x13121e['changed'](_0x1b94('0xd'))){_0x13121e['closedAt']=moment()[_0x1b94('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x13121e[_0x1b94('0x10')]=null;_0x13121e[_0x1b94('0xc')]=null;}_0x42bd8f(null,_0x13121e);},'afterUpdate':function(_0x5411d3,_0x1d49d1,_0x272431){var _0x36e4a0=_0x442dbe[_0x1b94('0x12')];var _0x18ec88=_0x5411d3[_0x1b94('0x13')]({'plain':!![]});if(_0x18ec88[_0x1b94('0xd')]){return _0x36e4a0[_0x1b94('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x18ec88['id']}})['then'](function(){_0x272431();})[_0x1b94('0x15')](function(_0x1f5342){_0x272431(_0x1f5342);});}else{_0x272431();}}},'charset':'utf8mb4','collate':_0x1b94('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 424aa20..c0ab214 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 _0x5ab4=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','where','addTags','ids','omit','AddTags','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5ab4,0x9f));var _0x45ab=function(_0x2b607f,_0x110eeb){_0x2b607f=_0x2b607f-0x0;var _0x1541ff=_0x5ab4[_0x2b607f];return _0x1541ff;};'use strict';var _=require(_0x45ab('0x0'));var util=require(_0x45ab('0x1'));var moment=require(_0x45ab('0x2'));var BPromise=require(_0x45ab('0x3'));var rs=require(_0x45ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ab('0x5'))['db'];var utils=require(_0x45ab('0x6'));var logger=require(_0x45ab('0x7'))(_0x45ab('0x8'));var config=require(_0x45ab('0x9'));var jayson=require(_0x45ab('0xa'));var client=jayson['client'][_0x45ab('0xb')]({'port':0x232a});config[_0x45ab('0xc')]=_[_0x45ab('0xd')](config[_0x45ab('0xc')],{'host':_0x45ab('0xe'),'port':0x18eb});var socket=require(_0x45ab('0xf'))(new Redis(config[_0x45ab('0xc')]));require(_0x45ab('0x10'))[_0x45ab('0x11')](socket);function respondWithRpcPromise(_0x310cf4,_0x218b1e,_0x1d790b){return new BPromise(function(_0x2a23f1,_0x5efc0e){return client[_0x45ab('0x12')](_0x310cf4,_0x1d790b)[_0x45ab('0x13')](function(_0x369751){logger[_0x45ab('0x14')](_0x45ab('0x15'),_0x218b1e,_0x45ab('0x16'));logger[_0x45ab('0x17')](_0x45ab('0x18'),_0x218b1e,_0x45ab('0x16'),JSON['stringify'](_0x369751));if(_0x369751['error']){if(_0x369751[_0x45ab('0x19')][_0x45ab('0x1a')]===0x1f4){logger[_0x45ab('0x19')](_0x45ab('0x15'),_0x218b1e,_0x369751[_0x45ab('0x19')][_0x45ab('0x1b')]);return _0x5efc0e(_0x369751[_0x45ab('0x19')][_0x45ab('0x1b')]);}logger['error'](_0x45ab('0x15'),_0x218b1e,_0x369751[_0x45ab('0x19')]['message']);return _0x2a23f1(_0x369751[_0x45ab('0x19')]['message']);}else{logger['info'](_0x45ab('0x15'),_0x218b1e,_0x45ab('0x16'));_0x2a23f1(_0x369751[_0x45ab('0x1c')][_0x45ab('0x1b')]);}})[_0x45ab('0x1d')](function(_0x48812a){logger[_0x45ab('0x19')](_0x45ab('0x15'),_0x218b1e,_0x48812a);_0x5efc0e(_0x48812a);});});}exports[_0x45ab('0x1e')]=function(_0x7a8b5e){var _0x4bee6a=this;return new Promise(function(_0x467a7f,_0x54fdab){return db[_0x45ab('0x1f')][_0x45ab('0x20')](_0x7a8b5e[_0x45ab('0x21')],{'raw':_0x7a8b5e[_0x45ab('0x22')]?_0x7a8b5e[_0x45ab('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a8b5e[_0x45ab('0x22')]?_0x7a8b5e[_0x45ab('0x22')]['where']||null:null,'attributes':_0x7a8b5e[_0x45ab('0x22')]?_0x7a8b5e[_0x45ab('0x22')][_0x45ab('0x23')]||null:null,'limit':_0x7a8b5e['options']?_0x7a8b5e[_0x45ab('0x22')]['limit']||null:null})['then'](function(_0x4d5fac){logger[_0x45ab('0x14')]('UpdateMailInteraction',_0x7a8b5e);logger['debug'](_0x45ab('0x1e'),_0x7a8b5e,JSON['stringify'](_0x4d5fac));_0x467a7f(_0x4d5fac);})[_0x45ab('0x1d')](function(_0x2b0ba5){logger[_0x45ab('0x19')](_0x45ab('0x1e'),_0x2b0ba5[_0x45ab('0x1b')],_0x7a8b5e);_0x54fdab(_0x4bee6a[_0x45ab('0x19')](0x1f4,_0x2b0ba5['message']));});});};exports['AddTagsToMailInteraction']=function(_0x1e96ad){return new Promise(function(_0x2c70cd,_0x2bd621){return db[_0x45ab('0x1f')]['find']({'where':_0x1e96ad['options']?_0x1e96ad['options'][_0x45ab('0x24')]||null:null})[_0x45ab('0x13')](function(_0x367926){if(_0x367926){return _0x367926[_0x45ab('0x25')](_0x1e96ad[_0x45ab('0x21')][_0x45ab('0x26')],_[_0x45ab('0x27')](_0x1e96ad[_0x45ab('0x21')],[_0x45ab('0x26'),'id'])||{});}})['spread'](function(_0x31d997){logger[_0x45ab('0x14')]('AddTags',_0x1e96ad);logger[_0x45ab('0x17')](_0x45ab('0x28'),_0x1e96ad,JSON[_0x45ab('0x29')](_0x31d997));_0x2c70cd(_0x31d997);})['catch'](function(_0x5b553a){logger['error'](_0x45ab('0x28'),_0x5b553a['message'],_0x1e96ad);_0x2bd621(_this[_0x45ab('0x19')](0x1f4,_0x5b553a[_0x45ab('0x1b')]));});});}; \ No newline at end of file +var _0x5088=['code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','then','AddTagsToMailInteraction','find','spread','AddTags','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x5088,0xa9));var _0x8508=function(_0x1d6cb8,_0x31a3f3){_0x1d6cb8=_0x1d6cb8-0x0;var _0x38a43f=_0x5088[_0x1d6cb8];return _0x38a43f;};'use strict';var _=require('lodash');var util=require(_0x8508('0x0'));var moment=require(_0x8508('0x1'));var BPromise=require(_0x8508('0x2'));var rs=require(_0x8508('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8508('0x4'))['db'];var utils=require(_0x8508('0x5'));var logger=require(_0x8508('0x6'))(_0x8508('0x7'));var config=require('../../config/environment');var jayson=require(_0x8508('0x8'));var client=jayson['client'][_0x8508('0x9')]({'port':0x232a});config[_0x8508('0xa')]=_['defaults'](config[_0x8508('0xa')],{'host':_0x8508('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8508('0xa')]));require(_0x8508('0xc'))[_0x8508('0xd')](socket);function respondWithRpcPromise(_0x1a48ae,_0x235703,_0x26047c){return new BPromise(function(_0x42ddd8,_0x2d99fb){return client[_0x8508('0xe')](_0x1a48ae,_0x26047c)['then'](function(_0x2ac40e){logger[_0x8508('0xf')](_0x8508('0x10'),_0x235703,_0x8508('0x11'));logger[_0x8508('0x12')](_0x8508('0x13'),_0x235703,_0x8508('0x11'),JSON['stringify'](_0x2ac40e));if(_0x2ac40e[_0x8508('0x14')]){if(_0x2ac40e[_0x8508('0x14')][_0x8508('0x15')]===0x1f4){logger[_0x8508('0x14')]('MailInteraction,\x20%s,\x20%s',_0x235703,_0x2ac40e[_0x8508('0x14')][_0x8508('0x16')]);return _0x2d99fb(_0x2ac40e['error'][_0x8508('0x16')]);}logger['error'](_0x8508('0x10'),_0x235703,_0x2ac40e[_0x8508('0x14')][_0x8508('0x16')]);return _0x42ddd8(_0x2ac40e[_0x8508('0x14')][_0x8508('0x16')]);}else{logger['info'](_0x8508('0x10'),_0x235703,_0x8508('0x11'));_0x42ddd8(_0x2ac40e['result']['message']);}})[_0x8508('0x17')](function(_0x5822c2){logger[_0x8508('0x14')](_0x8508('0x10'),_0x235703,_0x5822c2);_0x2d99fb(_0x5822c2);});});}exports[_0x8508('0x18')]=function(_0x5667ab){var _0x3755a9=this;return new Promise(function(_0xf63750,_0x245f8c){return db[_0x8508('0x19')][_0x8508('0x1a')](_0x5667ab[_0x8508('0x1b')],{'raw':_0x5667ab[_0x8508('0x1c')]?_0x5667ab[_0x8508('0x1c')][_0x8508('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5667ab[_0x8508('0x1c')]?_0x5667ab[_0x8508('0x1c')]['where']||null:null,'attributes':_0x5667ab[_0x8508('0x1c')]?_0x5667ab[_0x8508('0x1c')][_0x8508('0x1e')]||null:null,'limit':_0x5667ab['options']?_0x5667ab[_0x8508('0x1c')][_0x8508('0x1f')]||null:null})[_0x8508('0x20')](function(_0x52d646){logger[_0x8508('0xf')](_0x8508('0x18'),_0x5667ab);logger[_0x8508('0x12')](_0x8508('0x18'),_0x5667ab,JSON['stringify'](_0x52d646));_0xf63750(_0x52d646);})['catch'](function(_0x3dcdff){logger['error'](_0x8508('0x18'),_0x3dcdff['message'],_0x5667ab);_0x245f8c(_0x3755a9[_0x8508('0x14')](0x1f4,_0x3dcdff[_0x8508('0x16')]));});});};exports[_0x8508('0x21')]=function(_0x107c2b){return new Promise(function(_0x56b804,_0x2a99e0){return db[_0x8508('0x19')][_0x8508('0x22')]({'where':_0x107c2b['options']?_0x107c2b[_0x8508('0x1c')]['where']||null:null})[_0x8508('0x20')](function(_0x14b8a0){if(_0x14b8a0){return _0x14b8a0['addTags'](_0x107c2b[_0x8508('0x1b')]['ids'],_['omit'](_0x107c2b[_0x8508('0x1b')],['ids','id'])||{});}})[_0x8508('0x23')](function(_0x178bbf){logger['info'](_0x8508('0x24'),_0x107c2b);logger[_0x8508('0x12')](_0x8508('0x24'),_0x107c2b,JSON[_0x8508('0x25')](_0x178bbf));_0x56b804(_0x178bbf);})[_0x8508('0x17')](function(_0x4a60cf){logger[_0x8508('0x14')](_0x8508('0x24'),_0x4a60cf[_0x8508('0x16')],_0x107c2b);_0x2a99e0(_this['error'](0x1f4,_0x4a60cf[_0x8508('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 911caf4..004ef2d 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 _0x600a=['save','remove','emit','removeListener','register','length','./mailInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x600a,0x102));var _0xa600=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x600a[_0x506d2f];return _0x101255;};'use strict';var MailInteractionEvents=require(_0xa600('0x0'));var events=[_0xa600('0x1'),_0xa600('0x2'),'update'];function createListener(_0x2bf9a4,_0x112752){return function(_0x54a39e){_0x112752[_0xa600('0x3')](_0x2bf9a4,_0x54a39e);};}function removeListener(_0x5942b2,_0x39e49e){return function(){MailInteractionEvents[_0xa600('0x4')](_0x5942b2,_0x39e49e);};}exports[_0xa600('0x5')]=function(_0x56a2b7){for(var _0x47b03d=0x0,_0x1013f3=events[_0xa600('0x6')];_0x47b03d<_0x1013f3;_0x47b03d++){var _0x1a012c=events[_0x47b03d];var _0x534a1a=createListener('mailInteraction:'+_0x1a012c,_0x56a2b7);MailInteractionEvents['on'](_0x1a012c,_0x534a1a);}}; \ No newline at end of file +var _0xcfb4=['emit','removeListener','length','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x583bc8,_0x148c46){var _0x2eed91=function(_0x31e879){while(--_0x31e879){_0x583bc8['push'](_0x583bc8['shift']());}};_0x2eed91(++_0x148c46);}(_0xcfb4,0x162));var _0x4cfb=function(_0x3047ef,_0x286b20){_0x3047ef=_0x3047ef-0x0;var _0x3878d3=_0xcfb4[_0x3047ef];return _0x3878d3;};'use strict';var MailInteractionEvents=require(_0x4cfb('0x0'));var events=[_0x4cfb('0x1'),'remove',_0x4cfb('0x2')];function createListener(_0x1cb74d,_0x3f82ac){return function(_0x35ab72){_0x3f82ac[_0x4cfb('0x3')](_0x1cb74d,_0x35ab72);};}function removeListener(_0x22801f,_0x2ae379){return function(){MailInteractionEvents[_0x4cfb('0x4')](_0x22801f,_0x2ae379);};}exports['register']=function(_0x2a8d8a){for(var _0x392d5f=0x0,_0x13c322=events[_0x4cfb('0x5')];_0x392d5f<_0x13c322;_0x392d5f++){var _0x33b7eb=events[_0x392d5f];var _0x1db85c=createListener(_0x4cfb('0x6')+_0x33b7eb,_0x2a8d8a);MailInteractionEvents['on'](_0x33b7eb,_0x1db85c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1a3a28d..63a28be 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 _0xe5b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail','create','put','update','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x15d55d,_0x5ac565){var _0x3a6867=function(_0x4d2deb){while(--_0x4d2deb){_0x15d55d['push'](_0x15d55d['shift']());}};_0x3a6867(++_0x5ac565);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4b5b86,_0x23c37a){_0x4b5b86=_0x4b5b86-0x0;var _0xd965ac=_0xe5b3[_0x4b5b86];return _0xd965ac;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['get'](_0x3e5b('0xe'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x10')]('/',auth[_0x3e5b('0xa')](),interaction['tracked'](_0x3e5b('0x11'),'mailmessage:create'),controller[_0x3e5b('0x12')]);router[_0x3e5b('0x13')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0x14')]);router[_0x3e5b('0x13')](_0x3e5b('0x15'),auth['isAuthenticated'](),controller[_0x3e5b('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x3e5b('0x17')]);router[_0x3e5b('0x18')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa41a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x612812,_0x36e47e){var _0x3dd7a4=function(_0x288a78){while(--_0x288a78){_0x612812['push'](_0x612812['shift']());}};_0x3dd7a4(++_0x36e47e);}(_0xa41a,0x6b));var _0xaa41=function(_0x312a15,_0x491a70){_0x312a15=_0x312a15-0x0;var _0x57b120=_0xa41a[_0x312a15];return _0x57b120;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')]('/',auth[_0xaa41('0xc')](),interaction[_0xaa41('0x11')]('mail',_0xaa41('0x12')),controller[_0xaa41('0x13')]);router['put']('/:id',auth[_0xaa41('0xc')](),controller['update']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/:id/reject',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0x19'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index be391f7..530a0de 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 _0x9e63=['STRING','DATE','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x487f26,_0x1c70f3){var _0xcc6bd4=function(_0x34dd75){while(--_0x34dd75){_0x487f26['push'](_0x487f26['shift']());}};_0xcc6bd4(++_0x1c70f3);}(_0x9e63,0x65));var _0x39e6=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x9e63[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0x39e6('0x0'));var _=require(_0x39e6('0x1'));module[_0x39e6('0x2')]={'body':{'type':Sequelize['TEXT'](_0x39e6('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x39e6('0x4')](_0x39e6('0x5'))},'read':{'type':Sequelize[_0x39e6('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x39e6('0x7')]('in',_0x39e6('0x8')),'defaultValue':_0x39e6('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x39e6('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x39e6('0x4')](_0x39e6('0x3'))},'cc':{'type':Sequelize[_0x39e6('0x4')]('long')},'bcc':{'type':Sequelize[_0x39e6('0x4')](_0x39e6('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x39e6('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x39e6('0xa')]},'originTo':{'type':Sequelize[_0x39e6('0x4')](_0x39e6('0x3'))},'originCc':{'type':Sequelize[_0x39e6('0x4')](_0x39e6('0x3'))}}; \ No newline at end of file +var _0xc17d=['medium','BOOLEAN','ENUM','out','long','DATE','INTEGER','sequelize','lodash','exports','TEXT'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0xc17d,0x96));var _0xdc17=function(_0x1d2944,_0xa8ecab){_0x1d2944=_0x1d2944-0x0;var _0x2921f9=_0xc17d[_0x1d2944];return _0x2921f9;};'use strict';var Sequelize=require(_0xdc17('0x0'));var _=require(_0xdc17('0x1'));module[_0xdc17('0x2')]={'body':{'type':Sequelize[_0xdc17('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdc17('0x3')](_0xdc17('0x4'))},'read':{'type':Sequelize[_0xdc17('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc17('0x6')]('in','out'),'defaultValue':_0xdc17('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xdc17('0x3')]('long')},'cc':{'type':Sequelize[_0xdc17('0x3')](_0xdc17('0x8'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xdc17('0x3')]},'sentAt':{'type':Sequelize[_0xdc17('0x9')]},'attach':{'type':Sequelize[_0xdc17('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdc17('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdc17('0x9')]},'originTo':{'type':Sequelize[_0xdc17('0x3')](_0xdc17('0x8'))},'originCc':{'type':Sequelize[_0xdc17('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 79ac648..be34cbd 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 _0x3b59=['unix','toString','join','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','./mailMessage.socket','register','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','reject','update','destroy','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','pick','where','merge','filter','MailMessage','includeAll','include','rows','show','params','options','body','find','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','Contacts','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','service','pass','attachments','root','server/files/attachments','basename','List','CmContact','defaults','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','read','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','mail','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download'];(function(_0x410d34,_0xad523b){var _0x3b2f5d=function(_0x2232b6){while(--_0x2232b6){_0x410d34['push'](_0x410d34['shift']());}};_0x3b2f5d(++_0xad523b);}(_0x3b59,0xc0));var _0x93b5=function(_0xffb079,_0x2d5dc0){_0xffb079=_0xffb079-0x0;var _0x4ed0ee=_0x3b59[_0xffb079];return _0x4ed0ee;};'use strict';var pdf=require(_0x93b5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x93b5('0x1'));var zipdir=require(_0x93b5('0x2'));var jsonpatch=require(_0x93b5('0x3'));var rp=require(_0x93b5('0x4'));var moment=require(_0x93b5('0x5'));var BPromise=require(_0x93b5('0x6'));var Mustache=require(_0x93b5('0x7'));var util=require(_0x93b5('0x8'));var path=require(_0x93b5('0x9'));var sox=require('sox');var csv=require(_0x93b5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x93b5('0xb'));var squel=require(_0x93b5('0xc'));var crypto=require(_0x93b5('0xd'));var jsforce=require(_0x93b5('0xe'));var deskjs=require(_0x93b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x93b5('0x10'));var Redis=require(_0x93b5('0x11'));var authService=require(_0x93b5('0x12'));var qs=require(_0x93b5('0x13'));var as=require(_0x93b5('0x14'));var hardwareService=require(_0x93b5('0x15'));var logger=require(_0x93b5('0x16'))(_0x93b5('0x17'));var utils=require(_0x93b5('0x18'));var config=require('../../config/environment');var db=require(_0x93b5('0x19'))['db'];config[_0x93b5('0x1a')]=_['defaults'](config[_0x93b5('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93b5('0x1a')]));require(_0x93b5('0x1b'))[_0x93b5('0x1c')](socket);var jayson=require(_0x93b5('0x1d'));var client=jayson[_0x93b5('0x1e')][_0x93b5('0x1f')]({'port':0x232c});var client9003=jayson[_0x93b5('0x1e')][_0x93b5('0x1f')]({'port':0x232b});var client9002=jayson[_0x93b5('0x1e')][_0x93b5('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x595513,_0x40fc8c,_0x4fdc91){if(_0x4fdc91){var _0x582e11=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x582e11['test'](_0x40fc8c)){return _0x595513;}else{throw new db[(_0x93b5('0x20'))]['ValidationError'](_0x93b5('0x21'));}}else{return _0x595513;}}function respondWithRpcPromise(_0x14691a,_0x42fc67,_0x520ccf,_0x5c79ee){return new BPromise(function(_0x363b24,_0x3ef39b){var _0x1f61b0=_0x5c79ee||client;return _0x1f61b0[_0x93b5('0x22')](_0x14691a,_0x520ccf)[_0x93b5('0x23')](function(_0x3417f3){logger[_0x93b5('0x24')](_0x93b5('0x25'),_0x42fc67,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x42fc67,_0x93b5('0x26'),JSON[_0x93b5('0x27')](_0x3417f3));if(_0x3417f3['error']){if(_0x3417f3[_0x93b5('0x28')][_0x93b5('0x29')]===0x1f4){logger[_0x93b5('0x28')](_0x93b5('0x25'),_0x42fc67,_0x3417f3[_0x93b5('0x28')][_0x93b5('0x2a')]);return _0x3ef39b(_0x3417f3[_0x93b5('0x28')][_0x93b5('0x2a')]);}logger[_0x93b5('0x28')](_0x93b5('0x25'),_0x42fc67,_0x3417f3[_0x93b5('0x28')]['message']);return _0x363b24(_0x3417f3['error'][_0x93b5('0x2a')]);}else{logger[_0x93b5('0x24')](_0x93b5('0x25'),_0x42fc67,_0x93b5('0x26'));_0x363b24(_0x3417f3[_0x93b5('0x2b')]['message']);}})[_0x93b5('0x2c')](function(_0x11edc8){logger[_0x93b5('0x28')](_0x93b5('0x25'),_0x42fc67,_0x11edc8);_0x3ef39b(_0x11edc8);});});}function respondWithStatusCode(_0x55cb8c,_0x5d8232){_0x5d8232=_0x5d8232||0xcc;return function(_0x44f915){if(_0x44f915){return _0x55cb8c[_0x93b5('0x2d')](_0x5d8232);}return _0x55cb8c['status'](_0x5d8232)[_0x93b5('0x2e')]();};}function respondWithResult(_0x300f91,_0x46ec66){_0x46ec66=_0x46ec66||0xc8;return function(_0x3954ce){if(_0x3954ce){return _0x300f91[_0x93b5('0x2f')](_0x46ec66)[_0x93b5('0x30')](_0x3954ce);}};}function respondWithFilteredResult(_0xc7f3dd,_0x1f2bbf){return function(_0x47c396){if(_0x47c396){var _0x3f73d0=_0x47c396[_0x93b5('0x31')],_0x50d99e=_0x1f2bbf['offset'],_0x4578f6=_0x1f2bbf[_0x93b5('0x32')]+_0x1f2bbf['limit'],_0x610a94;if(_0x4578f6>=_0x3f73d0){_0x4578f6=_0x3f73d0;_0x610a94=0xc8;}else{_0x610a94=0xce;}_0xc7f3dd['status'](_0x610a94);return _0xc7f3dd[_0x93b5('0x33')]('Content-Range',_0x50d99e+'-'+_0x4578f6+'/'+_0x3f73d0)[_0x93b5('0x30')](_0x47c396);}return null;};}function patchUpdates(_0x3da62c){return function(_0x414ff2){try{jsonpatch[_0x93b5('0x34')](_0x414ff2,_0x3da62c,!![]);}catch(_0xd36ea0){return BPromise[_0x93b5('0x35')](_0xd36ea0);}return _0x414ff2['save']();};}function saveUpdates(_0x2004fa,_0x5ec3aa){return function(_0x1503e9){if(_0x1503e9){return _0x1503e9[_0x93b5('0x36')](_0x2004fa)[_0x93b5('0x23')](function(_0x25c6d8){return _0x25c6d8;});}return null;};}function removeEntity(_0x9cf835,_0x55ef1c){return function(_0x521af6){if(_0x521af6){return _0x521af6[_0x93b5('0x37')]()[_0x93b5('0x23')](function(){_0x9cf835['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d82f5,_0x4fa97c){return function(_0xebd179){if(!_0xebd179){_0x3d82f5[_0x93b5('0x2d')](0x194);}return _0xebd179;};}function handleError(_0x5cd373,_0x42c3fb){_0x42c3fb=_0x42c3fb||0x1f4;return function(_0x3baf23){logger['error'](_0x3baf23['stack']);if(_0x3baf23['name']){delete _0x3baf23[_0x93b5('0x38')];}_0x5cd373[_0x93b5('0x2f')](_0x42c3fb)[_0x93b5('0x39')](_0x3baf23);};}exports[_0x93b5('0x3a')]=function(_0x25f64f,_0x30c8df){var _0x92598b={},_0x18cb23={},_0xff7f09={'count':0x0,'rows':[]};var _0x1a1841=_[_0x93b5('0x3b')](db['MailMessage'][_0x93b5('0x3c')],function(_0x32516f){return{'name':_0x32516f['fieldName'],'type':_0x32516f[_0x93b5('0x3d')][_0x93b5('0x3e')]};});_0x18cb23[_0x93b5('0x3f')]=_['map'](_0x1a1841,'name');_0x18cb23['query']=_[_0x93b5('0x40')](_0x25f64f[_0x93b5('0x41')]);_0x18cb23['filters']=_[_0x93b5('0x42')](_0x18cb23['model'],_0x18cb23['query']);_0x92598b['attributes']=_[_0x93b5('0x42')](_0x18cb23[_0x93b5('0x3f')],qs['fields'](_0x25f64f['query'][_0x93b5('0x43')]));_0x92598b[_0x93b5('0x44')]=_0x92598b[_0x93b5('0x44')][_0x93b5('0x45')]?_0x92598b['attributes']:_0x18cb23[_0x93b5('0x3f')];if(!_0x25f64f[_0x93b5('0x41')][_0x93b5('0x46')]('nolimit')){_0x92598b[_0x93b5('0x47')]=qs[_0x93b5('0x47')](_0x25f64f[_0x93b5('0x41')][_0x93b5('0x47')]);_0x92598b[_0x93b5('0x32')]=qs['offset'](_0x25f64f[_0x93b5('0x41')][_0x93b5('0x32')]);}_0x92598b[_0x93b5('0x48')]=qs['sort'](_0x25f64f[_0x93b5('0x41')][_0x93b5('0x49')]);_0x92598b['where']=qs[_0x93b5('0x4a')](_[_0x93b5('0x4b')](_0x25f64f['query'],_0x18cb23[_0x93b5('0x4a')]),_0x1a1841);if(_0x25f64f['query']['filter']){_0x92598b[_0x93b5('0x4c')]=_[_0x93b5('0x4d')](_0x92598b[_0x93b5('0x4c')],{'$or':_['map'](_0x1a1841,function(_0x25f7c5){if(_0x25f7c5[_0x93b5('0x3d')]!=='VIRTUAL'){var _0x57adb9={};_0x57adb9[_0x25f7c5['name']]={'$like':'%'+_0x25f64f[_0x93b5('0x41')][_0x93b5('0x4e')]+'%'};return _0x57adb9;}})});}_0x92598b=_[_0x93b5('0x4d')]({},_0x92598b,_0x25f64f['options']);var _0x4cc808={'where':_0x92598b[_0x93b5('0x4c')]};return db[_0x93b5('0x4f')][_0x93b5('0x31')](_0x4cc808)['then'](function(_0x3ecee5){_0xff7f09['count']=_0x3ecee5;if(_0x25f64f[_0x93b5('0x41')][_0x93b5('0x50')]){_0x92598b[_0x93b5('0x51')]=[{'all':!![]}];}return db[_0x93b5('0x4f')]['findAll'](_0x92598b);})['then'](function(_0xbd95ec){_0xff7f09[_0x93b5('0x52')]=_0xbd95ec;return _0xff7f09;})[_0x93b5('0x23')](respondWithFilteredResult(_0x30c8df,_0x92598b))['catch'](handleError(_0x30c8df,null));};exports[_0x93b5('0x53')]=function(_0x4b71c7,_0x4bdbc1){var _0x16fb49={'raw':!![],'where':{'id':_0x4b71c7[_0x93b5('0x54')]['id']}},_0xc28987={};_0xc28987['model']=_[_0x93b5('0x40')](db[_0x93b5('0x4f')][_0x93b5('0x3c')]);_0xc28987[_0x93b5('0x41')]=_[_0x93b5('0x40')](_0x4b71c7[_0x93b5('0x41')]);_0xc28987[_0x93b5('0x4a')]=_[_0x93b5('0x42')](_0xc28987[_0x93b5('0x3f')],_0xc28987[_0x93b5('0x41')]);_0x16fb49[_0x93b5('0x44')]=_[_0x93b5('0x42')](_0xc28987[_0x93b5('0x3f')],qs['fields'](_0x4b71c7[_0x93b5('0x41')][_0x93b5('0x43')]));_0x16fb49[_0x93b5('0x44')]=_0x16fb49['attributes'][_0x93b5('0x45')]?_0x16fb49[_0x93b5('0x44')]:_0xc28987['model'];if(_0x4b71c7[_0x93b5('0x41')][_0x93b5('0x50')]){_0x16fb49[_0x93b5('0x51')]=[{'all':!![]}];}_0x16fb49=_[_0x93b5('0x4d')]({},_0x16fb49,_0x4b71c7[_0x93b5('0x55')]);return db['MailMessage']['find'](_0x16fb49)['then'](handleEntityNotFound(_0x4bdbc1,null))[_0x93b5('0x23')](respondWithResult(_0x4bdbc1,null))[_0x93b5('0x2c')](handleError(_0x4bdbc1,null));};exports['update']=function(_0xa7f1a8,_0x5b5b84){if(_0xa7f1a8[_0x93b5('0x56')]['id']){delete _0xa7f1a8['body']['id'];}return db[_0x93b5('0x4f')][_0x93b5('0x57')]({'where':{'id':_0xa7f1a8[_0x93b5('0x54')]['id']}})[_0x93b5('0x23')](handleEntityNotFound(_0x5b5b84,null))[_0x93b5('0x23')](saveUpdates(_0xa7f1a8['body'],null))[_0x93b5('0x23')](respondWithResult(_0x5b5b84,null))[_0x93b5('0x2c')](handleError(_0x5b5b84,null));};exports[_0x93b5('0x37')]=function(_0x4677f4,_0x65fd53){return db[_0x93b5('0x4f')][_0x93b5('0x57')]({'where':{'id':_0x4677f4[_0x93b5('0x54')]['id']}})['then'](handleEntityNotFound(_0x65fd53,null))[_0x93b5('0x23')](removeEntity(_0x65fd53,null))['catch'](handleError(_0x65fd53,null));};exports[_0x93b5('0x58')]=function(_0x276453,_0x651cd3){return db[_0x93b5('0x4f')]['describe']()[_0x93b5('0x23')](respondWithResult(_0x651cd3,null))[_0x93b5('0x2c')](handleError(_0x651cd3,null));};exports['create']=function(_0x2eba06,_0x46b0f4){return db[_0x93b5('0x4f')][_0x93b5('0x59')](_0x2eba06[_0x93b5('0x56')])[_0x93b5('0x23')](function(_0x5c291f){if(_0x5c291f){if(_0x5c291f[_0x93b5('0x5a')]==='out'&&!_0x5c291f[_0x93b5('0x5b')]){var _0x2e50de,_0x289b33,_0x597248;if(_0x2eba06[_0x93b5('0x56')]['to']){_0x289b33=_0x2eba06[_0x93b5('0x56')]['to'][_0x93b5('0x5c')](',')[0x0];}return db[_0x93b5('0x5d')][_0x93b5('0x5e')]({'where':{'id':_0x5c291f[_0x93b5('0x5f')]},'include':[{'model':db[_0x93b5('0x60')],'as':'List','include':[{'model':db['CmContact'],'as':_0x93b5('0x61'),'where':{'email':_0x289b33},'limit':0x1,'order':[['updatedAt',_0x93b5('0x62')]]}]},{'model':db[_0x93b5('0x63')],'as':'Smtp','raw':!![]}]})[_0x93b5('0x23')](function(_0xe095c4){_0x2e50de=_0xe095c4;if(_0x2e50de&&_0x2e50de[_0x93b5('0x64')]){var _0x11988b={'tls':{'rejectUnauthorized':![]}};if(_[_0x93b5('0x65')](_0x2e50de[_0x93b5('0x64')]['service'])){_0x11988b[_0x93b5('0x66')]=_0x2e50de[_0x93b5('0x64')][_0x93b5('0x66')];_0x11988b['port']=_0x2e50de[_0x93b5('0x64')][_0x93b5('0x67')];_0x11988b[_0x93b5('0x68')]=_0x2e50de[_0x93b5('0x64')][_0x93b5('0x68')];if(_0x2e50de[_0x93b5('0x64')][_0x93b5('0x69')]){_0x11988b[_0x93b5('0x6a')]={'user':_0x2e50de[_0x93b5('0x64')][_0x93b5('0x6b')],'pass':_0x2e50de['Smtp']['pass']};}}else{_0x11988b[_0x93b5('0x6c')]=_0x2e50de['Smtp'][_0x93b5('0x6c')];_0x11988b[_0x93b5('0x6a')]={'user':_0x2e50de[_0x93b5('0x64')]['user'],'pass':_0x2e50de[_0x93b5('0x64')][_0x93b5('0x6d')]};_0x11988b[_0x93b5('0x68')]=_0x2e50de[_0x93b5('0x64')][_0x93b5('0x68')];}if(_0x2eba06[_0x93b5('0x56')][_0x93b5('0x6e')]&&_0x2eba06[_0x93b5('0x56')][_0x93b5('0x6e')][_0x93b5('0x45')]){for(var _0x5d8e63=0x0;_0x5d8e63<_0x2eba06[_0x93b5('0x56')]['attachments'][_0x93b5('0x45')];_0x5d8e63+=0x1){_0x2eba06[_0x93b5('0x56')][_0x93b5('0x6e')][_0x5d8e63]={'filename':_0x2eba06[_0x93b5('0x56')][_0x93b5('0x6e')][_0x5d8e63][_0x93b5('0x38')],'path':path['join'](config[_0x93b5('0x6f')],_0x93b5('0x70'),_0x2eba06[_0x93b5('0x56')][_0x93b5('0x6e')][_0x5d8e63][_0x93b5('0x71')])};}}_0x597248={'account':_0x11988b,'message':_0x2eba06[_0x93b5('0x56')]};return;}})['then'](function(){if(_0x2e50de[_0x93b5('0x72')]){if(_0x2e50de[_0x93b5('0x72')][_0x93b5('0x61')]['length']){return _0x2e50de[_0x93b5('0x72')][_0x93b5('0x61')][0x0];}else{return db[_0x93b5('0x73')][_0x93b5('0x59')](_[_0x93b5('0x74')](_0x2eba06['body'],{'firstName':_0x2eba06[_0x93b5('0x56')]['to'],'email':_0x2eba06['body']['to'],'phone':_0x2eba06[_0x93b5('0x56')]['to'],'ListId':_0x2e50de[_0x93b5('0x75')]}));}}else{throw new Error(_0x93b5('0x76'));}})[_0x93b5('0x23')](function(){if(_0x597248){return respondWithRpcPromise('SendMail',_0x93b5('0x77'),_0x597248,client9003)['then'](function(_0x25d4f8){return _0x5c291f[_0x93b5('0x36')]({'read':!![],'messageId':_0x25d4f8['messageId'],'sentAt':moment()[_0x93b5('0x78')](_0x93b5('0x79'))});})[_0x93b5('0x2c')](function(_0x435884){logger['error']('%s',JSON[_0x93b5('0x27')](_0x435884));return _0x5c291f;});}return _0x5c291f;});}return _0x5c291f;}})[_0x93b5('0x23')](respondWithResult(_0x46b0f4,0xc9))[_0x93b5('0x2c')](handleError(_0x46b0f4,null));};var interaction_log=require(_0x93b5('0x16'))(_0x93b5('0x7a'));exports['accept']=function(_0x23c72a,_0x268d3f,_0x58ec5a){var _0x584600={'channel':'mail'};if(_0x23c72a[_0x93b5('0x56')]['id']){delete _0x23c72a[_0x93b5('0x56')]['id'];}_0x23c72a[_0x93b5('0x56')][_0x93b5('0x7b')]=!![];_0x23c72a[_0x93b5('0x56')][_0x93b5('0x7c')]=moment()[_0x93b5('0x78')](_0x93b5('0x79'));_0x23c72a[_0x93b5('0x56')][_0x93b5('0x7d')]=_0x23c72a[_0x93b5('0x56')][_0x93b5('0x7d')]||_0x23c72a['user']['id'];return db[_0x93b5('0x4f')][_0x93b5('0x57')]({'where':{'id':_0x23c72a[_0x93b5('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x93b5('0x73')],'as':'Contact'}]})[_0x93b5('0x23')](handleEntityNotFound(_0x268d3f,null))['then'](saveUpdates(_0x23c72a[_0x93b5('0x56')],null))['then'](function(_0xc2f87a){if(_0xc2f87a){_0x584600[_0x93b5('0x2a')]=_0xc2f87a[_0x93b5('0x7e')]({'plain':!![]});return db[_0x93b5('0x7f')][_0x93b5('0x57')]({'where':{'id':_0xc2f87a[_0x93b5('0x80')]}});}return null;})[_0x93b5('0x23')](handleEntityNotFound(_0x268d3f,null))[_0x93b5('0x23')](function(_0x196c6d){if(_0x196c6d){return _0x196c6d['update']({'UserId':_0x23c72a[_0x93b5('0x56')][_0x93b5('0x7d')],'read1stAt':_[_0x93b5('0x65')](_0x196c6d[_0x93b5('0x81')])?moment()[_0x93b5('0x78')](_0x93b5('0x79')):undefined});}return null;})[_0x93b5('0x23')](function(_0xc02d8e){if(_0xc02d8e){_0x584600[_0x93b5('0x82')]=_0xc02d8e[_0x93b5('0x7e')]({'plain':!![]});interaction_log[_0x93b5('0x24')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23c72a[_0x93b5('0x6b')]['id'],_0x23c72a[_0x93b5('0x6b')][_0x93b5('0x38')],_0x23c72a[_0x93b5('0x6b')][_0x93b5('0x83')],_0x584600[_0x93b5('0x82')]['id'],_0x23c72a[_0x93b5('0x56')]?JSON['stringify'](_0x23c72a['body']):_0x93b5('0x84'));return respondWithRpcPromise(_0x93b5('0x85'),_0x93b5('0x86'),_0x584600);}return null;})[_0x93b5('0x23')](function(_0x553363){if(_0x553363){if(_0x23c72a[_0x93b5('0x56')][_0x93b5('0x87')]){_0x584600['message'][_0x93b5('0x88')]=util['format'](_0x93b5('0x89'),_0x23c72a[_0x93b5('0x6b')][_0x93b5('0x38')]);_0x584600[_0x93b5('0x2a')][_0x93b5('0x8a')]=_0x584600['channel'];_0x584600[_0x93b5('0x2a')][_0x93b5('0x8b')]=_0x93b5('0x8c');return respondWithRpcPromise(_0x93b5('0x8d'),_0x93b5('0x8d'),{'event':_0x93b5('0x8e'),'message':_0x584600['message']},client9002)[_0x93b5('0x23')](function(){return _0x584600;});}return _0x584600;}return null;})[_0x93b5('0x23')](respondWithResult(_0x268d3f,null))[_0x93b5('0x2c')](handleError(_0x268d3f,null));};var interaction_log=require(_0x93b5('0x16'))('mail-interactions');exports[_0x93b5('0x35')]=function(_0x5428fe,_0x1bec90,_0x419f8c){var _0x2fee4a={'agent':{},'channel':_0x93b5('0x8f')};if(_0x5428fe[_0x93b5('0x56')]['id']){delete _0x5428fe[_0x93b5('0x56')]['id'];}_0x5428fe[_0x93b5('0x56')][_0x93b5('0x7d')]=_0x5428fe[_0x93b5('0x56')][_0x93b5('0x7d')]||_0x5428fe[_0x93b5('0x6b')]['id'];_0x2fee4a[_0x93b5('0x90')]['id']=_0x5428fe[_0x93b5('0x56')][_0x93b5('0x7d')];return db[_0x93b5('0x4f')][_0x93b5('0x57')]({'where':{'id':_0x5428fe['params']['id'],'UserId':null}})[_0x93b5('0x23')](handleEntityNotFound(_0x1bec90,null))[_0x93b5('0x23')](function(_0x1cd3ae){if(_0x1cd3ae){_0x2fee4a[_0x93b5('0x2a')]=_0x1cd3ae[_0x93b5('0x7e')]({'plain':!![]});return db[_0x93b5('0x7f')][_0x93b5('0x57')]({'where':{'id':_0x1cd3ae[_0x93b5('0x80')]}});}return null;})['then'](handleEntityNotFound(_0x1bec90,null))['then'](function(_0x5b7215){if(_0x5b7215){_0x2fee4a['interaction']=_0x5b7215[_0x93b5('0x7e')]({'plain':!![]});interaction_log[_0x93b5('0x24')](_0x93b5('0x91'),_0x5428fe[_0x93b5('0x6b')]['id'],_0x5428fe['user']['name'],_0x5428fe[_0x93b5('0x6b')][_0x93b5('0x83')],_0x2fee4a[_0x93b5('0x82')]['id'],_0x5428fe[_0x93b5('0x56')]?JSON[_0x93b5('0x27')](_0x5428fe['body']):_0x93b5('0x84'));return respondWithRpcPromise(_0x93b5('0x92'),_0x93b5('0x93'),_0x2fee4a);}return null;})[_0x93b5('0x23')](function(_0x2bc8e1){if(_0x2bc8e1){_0x2bc8e1[_0x93b5('0x2a')]['interface']=util[_0x93b5('0x78')]('SIP/%s',_0x5428fe[_0x93b5('0x6b')][_0x93b5('0x38')]);_0x2bc8e1[_0x93b5('0x2a')]['channel']=_0x2fee4a['channel'];_0x2bc8e1[_0x93b5('0x2a')][_0x93b5('0x8b')]=_0x93b5('0x35');respondWithRpcPromise(_0x93b5('0x8d'),'EventManager',{'event':_0x93b5('0x94'),'message':_0x2bc8e1[_0x93b5('0x2a')]},client9002);return _0x2fee4a;}return null;})[_0x93b5('0x23')](respondWithResult(_0x1bec90,null))[_0x93b5('0x2c')](handleError(_0x1bec90,null));};exports[_0x93b5('0x95')]=function(_0x2547bc,_0x17462f){var _0x59637f=moment()[_0x93b5('0x96')]()[_0x93b5('0x97')]();var _0x1abcae=path[_0x93b5('0x98')](config[_0x93b5('0x6f')],_0x93b5('0x99'),'files','tmp');var _0x2db433=path[_0x93b5('0x98')](config[_0x93b5('0x6f')],_0x93b5('0x99'),_0x93b5('0x9a'),_0x93b5('0x6e'));var _0x46474e=util[_0x93b5('0x78')]('message-%s.eml',_0x59637f);return db[_0x93b5('0x4f')][_0x93b5('0x57')]({'where':{'id':_0x2547bc['params']['id']},'attributes':['id',_0x93b5('0x56'),_0x93b5('0x9b'),'to','cc',_0x93b5('0x9c'),_0x93b5('0x9d'),_0x93b5('0x9e')],'include':_0x2547bc[_0x93b5('0x41')][_0x93b5('0x6e')]?[{'model':db[_0x93b5('0x9f')],'as':_0x93b5('0xa0')}]:undefined})[_0x93b5('0x23')](handleEntityNotFound(_0x17462f,null))[_0x93b5('0x23')](function(_0xfce60b){if(_0xfce60b){var _0x17d10b=_0xfce60b;var _0x21996b={'from':_0x17d10b[_0x93b5('0x9b')],'to':_0x17d10b['to'],'subject':_0x17d10b[_0x93b5('0x9d')],'html':_0x17d10b[_0x93b5('0x56')],'headers':{'Date':moment(_0x17d10b['createdAt'])[_0x93b5('0x78')](_0x93b5('0xa1'))},'attachments':[]};if(_0xfce60b['cc']){_0x21996b[_0x93b5('0xa2')]['Cc']=_0xfce60b['cc'];}if(_0xfce60b[_0x93b5('0x9c')]){_0x21996b[_0x93b5('0xa2')][_0x93b5('0xa3')]=_0xfce60b['bcc'];}return new BPromise(function(_0x301684,_0x4869f9){if(_0xfce60b[_0x93b5('0xa0')]){for(var _0x2cb8f3=0x0;_0x2cb8f3<_0xfce60b['Attachments'][_0x93b5('0x45')];_0x2cb8f3++){var _0x4ea110=_0xfce60b['Attachments'][_0x2cb8f3];var _0x31b9cd=path[_0x93b5('0x98')](_0x2db433,_0x4ea110['basename']);if(fs[_0x93b5('0xa4')](_0x31b9cd)){_0x21996b['attachments'][_0x93b5('0xa5')]({'name':_0x4ea110[_0x93b5('0x38')],'contentType':_0x4ea110[_0x93b5('0x3d')],'data':fs[_0x93b5('0xa6')](_0x31b9cd)});}}}emlformat[_0x93b5('0xa7')](_0x21996b,function(_0x3a3fcb,_0x4317cc){if(_0x3a3fcb)return _0x4869f9(_0x3a3fcb);fs['writeFileSync'](path[_0x93b5('0x98')](_0x1abcae,_0x46474e),_0x4317cc);return _0x301684(_0x4317cc);});});}})[_0x93b5('0x23')](function(_0x14b5fc){if(_0x14b5fc){return _0x17462f[_0x93b5('0x95')](path[_0x93b5('0x98')](_0x1abcae,_0x46474e),_0x46474e,function(_0x12fd6e){if(_0x12fd6e){console[_0x93b5('0xa8')](_0x93b5('0xa9'),_0x12fd6e);}else{fs[_0x93b5('0xaa')](path['join'](_0x1abcae,_0x46474e));}});}})['catch'](handleError(_0x17462f,null));}; \ No newline at end of file +var _0xbd50=['user','pass','attachments','length','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','mail-interactions','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','read1stAt','format','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','tmp','files','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication'];(function(_0x1c963d,_0x1d6da8){var _0x33cd38=function(_0x2c69a){while(--_0x2c69a){_0x1c963d['push'](_0x1c963d['shift']());}};_0x33cd38(++_0x1d6da8);}(_0xbd50,0x196));var _0x0bd5=function(_0x5894ee,_0x1bb6eb){_0x5894ee=_0x5894ee-0x0;var _0x40466a=_0xbd50[_0x5894ee];return _0x40466a;};'use strict';var pdf=require(_0x0bd5('0x0'));var emlformat=require(_0x0bd5('0x1'));var rimraf=require(_0x0bd5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bd5('0x3'));var rp=require(_0x0bd5('0x4'));var moment=require(_0x0bd5('0x5'));var BPromise=require(_0x0bd5('0x6'));var Mustache=require(_0x0bd5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bd5('0x8'));var ejs=require(_0x0bd5('0x9'));var fs=require('fs');var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0x8'));var querystring=require(_0x0bd5('0xd'));var Papa=require(_0x0bd5('0xe'));var Redis=require('ioredis');var authService=require(_0x0bd5('0xf'));var qs=require(_0x0bd5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x11'));var logger=require(_0x0bd5('0x12'))('api');var utils=require(_0x0bd5('0x13'));var config=require(_0x0bd5('0x14'));var db=require(_0x0bd5('0x15'))['db'];config['redis']=_[_0x0bd5('0x16')](config[_0x0bd5('0x17')],{'host':_0x0bd5('0x18'),'port':0x18eb});var socket=require(_0x0bd5('0x19'))(new Redis(config[_0x0bd5('0x17')]));require(_0x0bd5('0x1a'))[_0x0bd5('0x1b')](socket);var jayson=require(_0x0bd5('0x1c'));var client=jayson['client'][_0x0bd5('0x1d')]({'port':0x232c});var client9003=jayson[_0x0bd5('0x1e')]['http']({'port':0x232b});var client9002=jayson[_0x0bd5('0x1e')][_0x0bd5('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3a34e4,_0xc22553,_0x55d565){if(_0x55d565){var _0x14f32c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14f32c[_0x0bd5('0x1f')](_0xc22553)){return _0x3a34e4;}else{throw new db[(_0x0bd5('0x20'))][(_0x0bd5('0x21'))](_0x0bd5('0x22'));}}else{return _0x3a34e4;}}function respondWithRpcPromise(_0x23be38,_0xc58e12,_0x19fe20,_0x29fa4c){return new BPromise(function(_0x20c667,_0x27bc1e){var _0x415d8f=_0x29fa4c||client;return _0x415d8f[_0x0bd5('0x23')](_0x23be38,_0x19fe20)[_0x0bd5('0x24')](function(_0x527c37){logger['info']('MailMessage,\x20%s,\x20%s',_0xc58e12,'request\x20sent');logger['debug'](_0x0bd5('0x25'),_0xc58e12,_0x0bd5('0x26'),JSON[_0x0bd5('0x27')](_0x527c37));if(_0x527c37[_0x0bd5('0x28')]){if(_0x527c37[_0x0bd5('0x28')]['code']===0x1f4){logger[_0x0bd5('0x28')](_0x0bd5('0x29'),_0xc58e12,_0x527c37[_0x0bd5('0x28')]['message']);return _0x27bc1e(_0x527c37[_0x0bd5('0x28')]['message']);}logger['error'](_0x0bd5('0x29'),_0xc58e12,_0x527c37[_0x0bd5('0x28')][_0x0bd5('0x2a')]);return _0x20c667(_0x527c37['error'][_0x0bd5('0x2a')]);}else{logger['info'](_0x0bd5('0x29'),_0xc58e12,_0x0bd5('0x26'));_0x20c667(_0x527c37[_0x0bd5('0x2b')][_0x0bd5('0x2a')]);}})[_0x0bd5('0x2c')](function(_0x2023d5){logger[_0x0bd5('0x28')](_0x0bd5('0x29'),_0xc58e12,_0x2023d5);_0x27bc1e(_0x2023d5);});});}function respondWithStatusCode(_0x41c244,_0x4020ee){_0x4020ee=_0x4020ee||0xcc;return function(_0x15561b){if(_0x15561b){return _0x41c244[_0x0bd5('0x2d')](_0x4020ee);}return _0x41c244[_0x0bd5('0x2e')](_0x4020ee)[_0x0bd5('0x2f')]();};}function respondWithResult(_0x5e5a33,_0x461ae3){_0x461ae3=_0x461ae3||0xc8;return function(_0x19eb75){if(_0x19eb75){return _0x5e5a33['status'](_0x461ae3)[_0x0bd5('0x30')](_0x19eb75);}};}function respondWithFilteredResult(_0x8eccc9,_0x5d9d20){return function(_0x11f482){if(_0x11f482){var _0x1b7cf4=_0x11f482[_0x0bd5('0x31')],_0x28ab82=_0x5d9d20[_0x0bd5('0x32')],_0x25a35b=_0x5d9d20[_0x0bd5('0x32')]+_0x5d9d20[_0x0bd5('0x33')],_0x59683d;if(_0x25a35b>=_0x1b7cf4){_0x25a35b=_0x1b7cf4;_0x59683d=0xc8;}else{_0x59683d=0xce;}_0x8eccc9[_0x0bd5('0x2e')](_0x59683d);return _0x8eccc9[_0x0bd5('0x34')]('Content-Range',_0x28ab82+'-'+_0x25a35b+'/'+_0x1b7cf4)[_0x0bd5('0x30')](_0x11f482);}return null;};}function patchUpdates(_0x589ea2){return function(_0x398362){try{jsonpatch[_0x0bd5('0x35')](_0x398362,_0x589ea2,!![]);}catch(_0x444ddb){return BPromise[_0x0bd5('0x36')](_0x444ddb);}return _0x398362[_0x0bd5('0x37')]();};}function saveUpdates(_0x1c7010,_0x15e380){return function(_0x24f7d5){if(_0x24f7d5){return _0x24f7d5[_0x0bd5('0x38')](_0x1c7010)[_0x0bd5('0x24')](function(_0x1a735c){return _0x1a735c;});}return null;};}function removeEntity(_0x64d66d,_0x3cfb74){return function(_0x4c9a61){if(_0x4c9a61){return _0x4c9a61[_0x0bd5('0x39')]()[_0x0bd5('0x24')](function(){_0x64d66d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b93ed,_0xdf1ef5){return function(_0x8a6edc){if(!_0x8a6edc){_0x6b93ed[_0x0bd5('0x2d')](0x194);}return _0x8a6edc;};}function handleError(_0x1dd2e1,_0x387e24){_0x387e24=_0x387e24||0x1f4;return function(_0x22c10c){logger[_0x0bd5('0x28')](_0x22c10c[_0x0bd5('0x3a')]);if(_0x22c10c[_0x0bd5('0x3b')]){delete _0x22c10c[_0x0bd5('0x3b')];}_0x1dd2e1[_0x0bd5('0x2e')](_0x387e24)[_0x0bd5('0x3c')](_0x22c10c);};}exports['index']=function(_0x109f54,_0x5b915c){var _0x369d23={},_0x2f17a1={},_0x30f9da={'count':0x0,'rows':[]};var _0x1fcc49=_[_0x0bd5('0x3d')](db[_0x0bd5('0x3e')]['rawAttributes'],function(_0x35b4b9){return{'name':_0x35b4b9[_0x0bd5('0x3f')],'type':_0x35b4b9[_0x0bd5('0x40')][_0x0bd5('0x41')]};});_0x2f17a1[_0x0bd5('0x42')]=_[_0x0bd5('0x3d')](_0x1fcc49,_0x0bd5('0x3b'));_0x2f17a1[_0x0bd5('0x43')]=_[_0x0bd5('0x44')](_0x109f54['query']);_0x2f17a1[_0x0bd5('0x45')]=_['intersection'](_0x2f17a1[_0x0bd5('0x42')],_0x2f17a1[_0x0bd5('0x43')]);_0x369d23['attributes']=_[_0x0bd5('0x46')](_0x2f17a1[_0x0bd5('0x42')],qs[_0x0bd5('0x47')](_0x109f54[_0x0bd5('0x43')][_0x0bd5('0x47')]));_0x369d23[_0x0bd5('0x48')]=_0x369d23[_0x0bd5('0x48')]['length']?_0x369d23['attributes']:_0x2f17a1[_0x0bd5('0x42')];if(!_0x109f54['query']['hasOwnProperty'](_0x0bd5('0x49'))){_0x369d23[_0x0bd5('0x33')]=qs['limit'](_0x109f54['query']['limit']);_0x369d23[_0x0bd5('0x32')]=qs['offset'](_0x109f54['query'][_0x0bd5('0x32')]);}_0x369d23[_0x0bd5('0x4a')]=qs['sort'](_0x109f54['query'][_0x0bd5('0x4b')]);_0x369d23[_0x0bd5('0x4c')]=qs[_0x0bd5('0x45')](_[_0x0bd5('0x4d')](_0x109f54['query'],_0x2f17a1[_0x0bd5('0x45')]),_0x1fcc49);if(_0x109f54[_0x0bd5('0x43')][_0x0bd5('0x4e')]){_0x369d23[_0x0bd5('0x4c')]=_[_0x0bd5('0x4f')](_0x369d23[_0x0bd5('0x4c')],{'$or':_['map'](_0x1fcc49,function(_0x36348a){if(_0x36348a[_0x0bd5('0x40')]!==_0x0bd5('0x50')){var _0x5cdfe6={};_0x5cdfe6[_0x36348a[_0x0bd5('0x3b')]]={'$like':'%'+_0x109f54[_0x0bd5('0x43')][_0x0bd5('0x4e')]+'%'};return _0x5cdfe6;}})});}_0x369d23=_['merge']({},_0x369d23,_0x109f54[_0x0bd5('0x51')]);var _0x45240c={'where':_0x369d23[_0x0bd5('0x4c')]};return db[_0x0bd5('0x3e')][_0x0bd5('0x31')](_0x45240c)['then'](function(_0x205569){_0x30f9da[_0x0bd5('0x31')]=_0x205569;if(_0x109f54['query'][_0x0bd5('0x52')]){_0x369d23[_0x0bd5('0x53')]=[{'all':!![]}];}return db[_0x0bd5('0x3e')][_0x0bd5('0x54')](_0x369d23);})[_0x0bd5('0x24')](function(_0x508aa8){_0x30f9da[_0x0bd5('0x55')]=_0x508aa8;return _0x30f9da;})[_0x0bd5('0x24')](respondWithFilteredResult(_0x5b915c,_0x369d23))['catch'](handleError(_0x5b915c,null));};exports[_0x0bd5('0x56')]=function(_0x5bee57,_0x3c3e9b){var _0x14b74b={'raw':!![],'where':{'id':_0x5bee57[_0x0bd5('0x57')]['id']}},_0x37dc86={};_0x37dc86['model']=_[_0x0bd5('0x44')](db['MailMessage']['rawAttributes']);_0x37dc86[_0x0bd5('0x43')]=_[_0x0bd5('0x44')](_0x5bee57[_0x0bd5('0x43')]);_0x37dc86['filters']=_[_0x0bd5('0x46')](_0x37dc86['model'],_0x37dc86[_0x0bd5('0x43')]);_0x14b74b[_0x0bd5('0x48')]=_[_0x0bd5('0x46')](_0x37dc86['model'],qs['fields'](_0x5bee57['query'][_0x0bd5('0x47')]));_0x14b74b[_0x0bd5('0x48')]=_0x14b74b[_0x0bd5('0x48')]['length']?_0x14b74b[_0x0bd5('0x48')]:_0x37dc86[_0x0bd5('0x42')];if(_0x5bee57['query'][_0x0bd5('0x52')]){_0x14b74b['include']=[{'all':!![]}];}_0x14b74b=_['merge']({},_0x14b74b,_0x5bee57[_0x0bd5('0x51')]);return db[_0x0bd5('0x3e')][_0x0bd5('0x58')](_0x14b74b)[_0x0bd5('0x24')](handleEntityNotFound(_0x3c3e9b,null))['then'](respondWithResult(_0x3c3e9b,null))[_0x0bd5('0x2c')](handleError(_0x3c3e9b,null));};exports[_0x0bd5('0x38')]=function(_0x3df0a0,_0x5cf2f2){if(_0x3df0a0[_0x0bd5('0x59')]['id']){delete _0x3df0a0[_0x0bd5('0x59')]['id'];}return db[_0x0bd5('0x3e')]['find']({'where':{'id':_0x3df0a0['params']['id']}})[_0x0bd5('0x24')](handleEntityNotFound(_0x5cf2f2,null))['then'](saveUpdates(_0x3df0a0[_0x0bd5('0x59')],null))[_0x0bd5('0x24')](respondWithResult(_0x5cf2f2,null))[_0x0bd5('0x2c')](handleError(_0x5cf2f2,null));};exports['destroy']=function(_0x9b0dc5,_0x43e3d1){return db[_0x0bd5('0x3e')][_0x0bd5('0x58')]({'where':{'id':_0x9b0dc5['params']['id']}})[_0x0bd5('0x24')](handleEntityNotFound(_0x43e3d1,null))[_0x0bd5('0x24')](removeEntity(_0x43e3d1,null))[_0x0bd5('0x2c')](handleError(_0x43e3d1,null));};exports[_0x0bd5('0x5a')]=function(_0xf545c2,_0x478faa){return db[_0x0bd5('0x3e')]['describe']()[_0x0bd5('0x24')](respondWithResult(_0x478faa,null))['catch'](handleError(_0x478faa,null));};exports['create']=function(_0x24c496,_0x55883d){return db[_0x0bd5('0x3e')][_0x0bd5('0x5b')](_0x24c496[_0x0bd5('0x59')])['then'](function(_0x4f7e86){if(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='out'&&!_0x4f7e86[_0x0bd5('0x5d')]){var _0x134504,_0x5eeb83,_0x460ebb;if(_0x24c496['body']['to']){_0x5eeb83=_0x24c496[_0x0bd5('0x59')]['to'][_0x0bd5('0x5e')](',')[0x0];}return db[_0x0bd5('0x5f')][_0x0bd5('0x60')]({'where':{'id':_0x4f7e86[_0x0bd5('0x61')]},'include':[{'model':db[_0x0bd5('0x62')],'as':_0x0bd5('0x63'),'include':[{'model':db['CmContact'],'as':_0x0bd5('0x64'),'where':{'email':_0x5eeb83},'limit':0x1,'order':[[_0x0bd5('0x65'),_0x0bd5('0x66')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x0bd5('0x24')](function(_0x378586){_0x134504=_0x378586;if(_0x134504&&_0x134504[_0x0bd5('0x67')]){var _0x42dc72={'tls':{'rejectUnauthorized':![]}};if(_[_0x0bd5('0x68')](_0x134504[_0x0bd5('0x67')][_0x0bd5('0x69')])){_0x42dc72[_0x0bd5('0x6a')]=_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6a')];_0x42dc72[_0x0bd5('0x6b')]=_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6b')];_0x42dc72[_0x0bd5('0x6c')]=_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6c')];if(_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6d')]){_0x42dc72['auth']={'user':_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6e')],'pass':_0x134504['Smtp'][_0x0bd5('0x6f')]};}}else{_0x42dc72['service']=_0x134504[_0x0bd5('0x67')][_0x0bd5('0x69')];_0x42dc72['auth']={'user':_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6e')],'pass':_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6f')]};_0x42dc72[_0x0bd5('0x6c')]=_0x134504[_0x0bd5('0x67')][_0x0bd5('0x6c')];}if(_0x24c496[_0x0bd5('0x59')][_0x0bd5('0x70')]&&_0x24c496['body'][_0x0bd5('0x70')][_0x0bd5('0x71')]){for(var _0x583835=0x0;_0x583835<_0x24c496[_0x0bd5('0x59')][_0x0bd5('0x70')]['length'];_0x583835+=0x1){_0x24c496[_0x0bd5('0x59')][_0x0bd5('0x70')][_0x583835]={'filename':_0x24c496['body'][_0x0bd5('0x70')][_0x583835]['name'],'path':path[_0x0bd5('0x72')](config[_0x0bd5('0x73')],_0x0bd5('0x74'),_0x24c496[_0x0bd5('0x59')][_0x0bd5('0x70')][_0x583835][_0x0bd5('0x75')])};}}_0x460ebb={'account':_0x42dc72,'message':_0x24c496[_0x0bd5('0x59')]};return;}})[_0x0bd5('0x24')](function(){if(_0x134504[_0x0bd5('0x63')]){if(_0x134504[_0x0bd5('0x63')][_0x0bd5('0x64')][_0x0bd5('0x71')]){return _0x134504[_0x0bd5('0x63')][_0x0bd5('0x64')][0x0];}else{return db['CmContact'][_0x0bd5('0x5b')](_[_0x0bd5('0x16')](_0x24c496[_0x0bd5('0x59')],{'firstName':_0x24c496[_0x0bd5('0x59')]['to'],'email':_0x24c496[_0x0bd5('0x59')]['to'],'phone':_0x24c496[_0x0bd5('0x59')]['to'],'ListId':_0x134504['ListId']}));}}else{throw new Error(_0x0bd5('0x76'));}})[_0x0bd5('0x24')](function(){if(_0x460ebb){return respondWithRpcPromise(_0x0bd5('0x77'),_0x0bd5('0x78'),_0x460ebb,client9003)[_0x0bd5('0x24')](function(_0x116e67){return _0x4f7e86[_0x0bd5('0x38')]({'read':!![],'messageId':_0x116e67['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x0bd5('0x2c')](function(_0x343658){logger[_0x0bd5('0x28')]('%s',JSON[_0x0bd5('0x27')](_0x343658));return _0x4f7e86;});}return _0x4f7e86;});}return _0x4f7e86;}})[_0x0bd5('0x24')](respondWithResult(_0x55883d,0xc9))['catch'](handleError(_0x55883d,null));};var interaction_log=require(_0x0bd5('0x12'))(_0x0bd5('0x79'));exports['accept']=function(_0x46edf6,_0x935f1c,_0x1a812e){var _0x3cdfa9={'channel':_0x0bd5('0x7a')};if(_0x46edf6[_0x0bd5('0x59')]['id']){delete _0x46edf6[_0x0bd5('0x59')]['id'];}_0x46edf6[_0x0bd5('0x59')][_0x0bd5('0x7b')]=!![];_0x46edf6[_0x0bd5('0x59')][_0x0bd5('0x7c')]=moment()['format'](_0x0bd5('0x7d'));_0x46edf6[_0x0bd5('0x59')][_0x0bd5('0x7e')]=_0x46edf6[_0x0bd5('0x59')][_0x0bd5('0x7e')]||_0x46edf6['user']['id'];return db[_0x0bd5('0x3e')][_0x0bd5('0x58')]({'where':{'id':_0x46edf6[_0x0bd5('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x0bd5('0x7f')],'as':_0x0bd5('0x80')}]})[_0x0bd5('0x24')](handleEntityNotFound(_0x935f1c,null))[_0x0bd5('0x24')](saveUpdates(_0x46edf6[_0x0bd5('0x59')],null))[_0x0bd5('0x24')](function(_0x9acef6){if(_0x9acef6){_0x3cdfa9[_0x0bd5('0x2a')]=_0x9acef6[_0x0bd5('0x81')]({'plain':!![]});return db[_0x0bd5('0x82')][_0x0bd5('0x58')]({'where':{'id':_0x9acef6[_0x0bd5('0x83')]}});}return null;})[_0x0bd5('0x24')](handleEntityNotFound(_0x935f1c,null))[_0x0bd5('0x24')](function(_0x14653e){if(_0x14653e){return _0x14653e[_0x0bd5('0x38')]({'UserId':_0x46edf6['body']['UserId'],'read1stAt':_[_0x0bd5('0x68')](_0x14653e[_0x0bd5('0x84')])?moment()[_0x0bd5('0x85')](_0x0bd5('0x7d')):undefined});}return null;})[_0x0bd5('0x24')](function(_0x4f57fe){if(_0x4f57fe){_0x3cdfa9[_0x0bd5('0x86')]=_0x4f57fe[_0x0bd5('0x81')]({'plain':!![]});interaction_log[_0x0bd5('0x87')](_0x0bd5('0x88'),_0x46edf6[_0x0bd5('0x6e')]['id'],_0x46edf6['user'][_0x0bd5('0x3b')],_0x46edf6[_0x0bd5('0x6e')][_0x0bd5('0x89')],_0x3cdfa9[_0x0bd5('0x86')]['id'],_0x46edf6[_0x0bd5('0x59')]?JSON[_0x0bd5('0x27')](_0x46edf6[_0x0bd5('0x59')]):_0x0bd5('0x8a'));return respondWithRpcPromise(_0x0bd5('0x8b'),_0x0bd5('0x8c'),_0x3cdfa9);}return null;})[_0x0bd5('0x24')](function(_0x48a77d){if(_0x48a77d){if(_0x46edf6[_0x0bd5('0x59')][_0x0bd5('0x8d')]){_0x3cdfa9[_0x0bd5('0x2a')][_0x0bd5('0x8e')]=util[_0x0bd5('0x85')](_0x0bd5('0x8f'),_0x46edf6[_0x0bd5('0x6e')][_0x0bd5('0x3b')]);_0x3cdfa9['message'][_0x0bd5('0x90')]=_0x3cdfa9[_0x0bd5('0x90')];_0x3cdfa9[_0x0bd5('0x2a')][_0x0bd5('0x91')]=_0x0bd5('0x92');return respondWithRpcPromise(_0x0bd5('0x93'),_0x0bd5('0x93'),{'event':_0x0bd5('0x94'),'message':_0x3cdfa9[_0x0bd5('0x2a')]},client9002)[_0x0bd5('0x24')](function(){return _0x3cdfa9;});}return _0x3cdfa9;}return null;})[_0x0bd5('0x24')](respondWithResult(_0x935f1c,null))[_0x0bd5('0x2c')](handleError(_0x935f1c,null));};var interaction_log=require(_0x0bd5('0x12'))(_0x0bd5('0x79'));exports[_0x0bd5('0x36')]=function(_0x40b00c,_0x54ba20,_0x289ba4){var _0x331841={'agent':{},'channel':_0x0bd5('0x7a')};if(_0x40b00c[_0x0bd5('0x59')]['id']){delete _0x40b00c[_0x0bd5('0x59')]['id'];}_0x40b00c[_0x0bd5('0x59')][_0x0bd5('0x7e')]=_0x40b00c[_0x0bd5('0x59')][_0x0bd5('0x7e')]||_0x40b00c['user']['id'];_0x331841[_0x0bd5('0x95')]['id']=_0x40b00c[_0x0bd5('0x59')][_0x0bd5('0x7e')];return db['MailMessage'][_0x0bd5('0x58')]({'where':{'id':_0x40b00c[_0x0bd5('0x57')]['id'],'UserId':null}})[_0x0bd5('0x24')](handleEntityNotFound(_0x54ba20,null))[_0x0bd5('0x24')](function(_0x1e7d05){if(_0x1e7d05){_0x331841[_0x0bd5('0x2a')]=_0x1e7d05['get']({'plain':!![]});return db[_0x0bd5('0x82')]['find']({'where':{'id':_0x1e7d05[_0x0bd5('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x54ba20,null))['then'](function(_0x236981){if(_0x236981){_0x331841[_0x0bd5('0x86')]=_0x236981[_0x0bd5('0x81')]({'plain':!![]});interaction_log[_0x0bd5('0x87')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40b00c[_0x0bd5('0x6e')]['id'],_0x40b00c[_0x0bd5('0x6e')]['name'],_0x40b00c[_0x0bd5('0x6e')][_0x0bd5('0x89')],_0x331841[_0x0bd5('0x86')]['id'],_0x40b00c[_0x0bd5('0x59')]?JSON[_0x0bd5('0x27')](_0x40b00c[_0x0bd5('0x59')]):_0x0bd5('0x8a'));return respondWithRpcPromise(_0x0bd5('0x96'),_0x0bd5('0x97'),_0x331841);}return null;})[_0x0bd5('0x24')](function(_0xdb91c0){if(_0xdb91c0){_0xdb91c0[_0x0bd5('0x2a')][_0x0bd5('0x8e')]=util[_0x0bd5('0x85')](_0x0bd5('0x8f'),_0x40b00c[_0x0bd5('0x6e')][_0x0bd5('0x3b')]);_0xdb91c0[_0x0bd5('0x2a')][_0x0bd5('0x90')]=_0x331841[_0x0bd5('0x90')];_0xdb91c0[_0x0bd5('0x2a')][_0x0bd5('0x91')]=_0x0bd5('0x36');respondWithRpcPromise(_0x0bd5('0x93'),_0x0bd5('0x93'),{'event':_0x0bd5('0x98'),'message':_0xdb91c0['message']},client9002);return _0x331841;}return null;})[_0x0bd5('0x24')](respondWithResult(_0x54ba20,null))['catch'](handleError(_0x54ba20,null));};exports[_0x0bd5('0x99')]=function(_0x467a37,_0x2d843a){var _0x3704be=moment()[_0x0bd5('0x9a')]()[_0x0bd5('0x9b')]();var _0x1fa5c7=path[_0x0bd5('0x72')](config[_0x0bd5('0x73')],'server','files',_0x0bd5('0x9c'));var _0x392bdc=path['join'](config[_0x0bd5('0x73')],'server',_0x0bd5('0x9d'),_0x0bd5('0x70'));var _0x240ed8=util[_0x0bd5('0x85')]('message-%s.eml',_0x3704be);return db[_0x0bd5('0x3e')][_0x0bd5('0x58')]({'where':{'id':_0x467a37[_0x0bd5('0x57')]['id']},'attributes':['id',_0x0bd5('0x59'),'from','to','cc',_0x0bd5('0x9e'),_0x0bd5('0x9f'),_0x0bd5('0xa0')],'include':_0x467a37[_0x0bd5('0x43')][_0x0bd5('0x70')]?[{'model':db[_0x0bd5('0xa1')],'as':_0x0bd5('0xa2')}]:undefined})[_0x0bd5('0x24')](handleEntityNotFound(_0x2d843a,null))[_0x0bd5('0x24')](function(_0x42a7b0){if(_0x42a7b0){var _0x2404c9=_0x42a7b0;var _0x1a79af={'from':_0x2404c9['from'],'to':_0x2404c9['to'],'subject':_0x2404c9[_0x0bd5('0x9f')],'html':_0x2404c9[_0x0bd5('0x59')],'headers':{'Date':moment(_0x2404c9[_0x0bd5('0xa0')])[_0x0bd5('0x85')](_0x0bd5('0xa3'))},'attachments':[]};if(_0x42a7b0['cc']){_0x1a79af[_0x0bd5('0xa4')]['Cc']=_0x42a7b0['cc'];}if(_0x42a7b0[_0x0bd5('0x9e')]){_0x1a79af[_0x0bd5('0xa4')][_0x0bd5('0xa5')]=_0x42a7b0[_0x0bd5('0x9e')];}return new BPromise(function(_0x2a05bc,_0x5f529b){if(_0x42a7b0[_0x0bd5('0xa2')]){for(var _0x571f2b=0x0;_0x571f2b<_0x42a7b0[_0x0bd5('0xa2')][_0x0bd5('0x71')];_0x571f2b++){var _0x427e68=_0x42a7b0['Attachments'][_0x571f2b];var _0x509e4d=path['join'](_0x392bdc,_0x427e68[_0x0bd5('0x75')]);if(fs[_0x0bd5('0xa6')](_0x509e4d)){_0x1a79af[_0x0bd5('0x70')][_0x0bd5('0xa7')]({'name':_0x427e68[_0x0bd5('0x3b')],'contentType':_0x427e68[_0x0bd5('0x40')],'data':fs[_0x0bd5('0xa8')](_0x509e4d)});}}}emlformat[_0x0bd5('0xa9')](_0x1a79af,function(_0x1c1b4d,_0x1117f2){if(_0x1c1b4d)return _0x5f529b(_0x1c1b4d);fs[_0x0bd5('0xaa')](path['join'](_0x1fa5c7,_0x240ed8),_0x1117f2);return _0x2a05bc(_0x1117f2);});});}})[_0x0bd5('0x24')](function(_0x27561e){if(_0x27561e){return _0x2d843a['download'](path['join'](_0x1fa5c7,_0x240ed8),_0x240ed8,function(_0x141787){if(_0x141787){console['log']('err',_0x141787);}else{fs[_0x0bd5('0xab')](path[_0x0bd5('0x72')](_0x1fa5c7,_0x240ed8));}});}})[_0x0bd5('0x2c')](handleError(_0x2d843a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f7ce406..bc4e7b2 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 _0x8a78=['remove','emit','hook','exports','save','update'];(function(_0x46d726,_0x434bc7){var _0x3e72c5=function(_0x384a43){while(--_0x384a43){_0x46d726['push'](_0x46d726['shift']());}};_0x3e72c5(++_0x434bc7);}(_0x8a78,0x1ea));var _0x88a7=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x8a78[_0xb8cfbe];return _0x227d51;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x88a7('0x0'),'afterUpdate':_0x88a7('0x1'),'afterDestroy':_0x88a7('0x2')};function emitEvent(_0x44b158){return function(_0x38d953,_0x68934b,_0x5a2591){MailMessageEvents[_0x88a7('0x3')](_0x44b158+':'+_0x38d953['id'],_0x38d953);MailMessageEvents[_0x88a7('0x3')](_0x44b158,_0x38d953);_0x5a2591(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x88a7('0x4')](e,emitEvent(event));}}module[_0x88a7('0x5')]=MailMessageEvents; \ No newline at end of file +var _0x0ab9=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage'];(function(_0x5ad80c,_0x3cd070){var _0x389b32=function(_0x1f79d3){while(--_0x1f79d3){_0x5ad80c['push'](_0x5ad80c['shift']());}};_0x389b32(++_0x3cd070);}(_0x0ab9,0xbb));var _0x90ab=function(_0x50bb9b,_0x51c097){_0x50bb9b=_0x50bb9b-0x0;var _0x4b9481=_0x0ab9[_0x50bb9b];return _0x4b9481;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x90ab('0x0'))['db'][_0x90ab('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x90ab('0x2')](0x0);var events={'afterCreate':_0x90ab('0x3'),'afterUpdate':'update','afterDestroy':_0x90ab('0x4')};function emitEvent(_0x31ee31){return function(_0x47d1b3,_0x3cd248,_0x26d75e){MailMessageEvents[_0x90ab('0x5')](_0x31ee31+':'+_0x47d1b3['id'],_0x47d1b3);MailMessageEvents[_0x90ab('0x5')](_0x31ee31,_0x47d1b3);_0x26d75e(null);};}for(var e in events){if(events[_0x90ab('0x6')](e)){var event=events[e];MailMessage[_0x90ab('0x7')](e,emitEvent(event));}}module[_0x90ab('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 26ab017..d772d67 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 _0xffbb=['update','catch','error','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','then'];(function(_0x23f81c,_0x3c7833){var _0x31582b=function(_0x85354f){while(--_0x85354f){_0x23f81c['push'](_0x23f81c['shift']());}};_0x31582b(++_0x3c7833);}(_0xffbb,0x14e));var _0xbffb=function(_0x113ac2,_0x13d922){_0x113ac2=_0x113ac2-0x0;var _0x290f25=_0xffbb[_0x113ac2];return _0x290f25;};'use strict';var _=require('lodash');var util=require(_0xbffb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbffb('0x1'));var BPromise=require(_0xbffb('0x2'));var rp=require(_0xbffb('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xbffb('0x4'));var rimraf=require(_0xbffb('0x5'));var config=require(_0xbffb('0x6'));var attributes=require(_0xbffb('0x7'));module[_0xbffb('0x8')]=function(_0x24e230,_0x18d595){return _0x24e230['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xbffb('0x9'),'fields':['messageId']},{'name':_0xbffb('0xa'),'fields':[_0xbffb('0xb'),_0xbffb('0xc')],'type':_0xbffb('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b27f9,_0x294030,_0x4f1c81){if(_0x1b27f9[_0xbffb('0xe')]){_0x1b27f9[_0xbffb('0xb')]=htmlToText[_0xbffb('0xf')](_0x1b27f9[_0xbffb('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4f1c81(null,_0x294030);},'afterCreate':function(_0x160436,_0x8326d9,_0x29287a){var _0x39e3ae=_0x24e230[_0xbffb('0x10')];var _0x1b195c=_0x160436['get']({'plain':!![]});if(_0x1b195c[_0xbffb('0x11')]['toLowerCase']()==='in'||_0x1b195c[_0xbffb('0x11')][_0xbffb('0x12')]()===_0xbffb('0x13')&&!_0x1b195c[_0xbffb('0x14')]&&!_[_0xbffb('0x15')](_0x1b195c[_0xbffb('0x16')])){_0x39e3ae[_0xbffb('0x17')][_0xbffb('0x18')]({'where':{'id':_0x1b195c['MailInteractionId']}})[_0xbffb('0x19')](function(_0x35e1d4){if(_0x35e1d4){_0x35e1d4[_0xbffb('0x1a')]({'lastMsgAt':_0x1b195c['createdAt'],'lastMsgDirection':_0x1b195c[_0xbffb('0x11')][_0xbffb('0x12')](),'lastMsgBody':_0x1b195c['body']});}})[_0xbffb('0x1b')](function(_0x1cb11c){console[_0xbffb('0x1c')](_0x1cb11c);});}_0x29287a();}},'charset':'utf8mb4','collate':_0xbffb('0x1d')});}; \ No newline at end of file +var _0x09db=['../../config/environment','exports','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x2c6a0d,_0x28a135){var _0x4f9bde=function(_0x2e0f3d){while(--_0x2e0f3d){_0x2c6a0d['push'](_0x2c6a0d['shift']());}};_0x4f9bde(++_0x28a135);}(_0x09db,0x7d));var _0xb09d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x09db[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xb09d('0x0'));var logger=require('../../config/logger')(_0xb09d('0x1'));var moment=require('moment');var BPromise=require(_0xb09d('0x2'));var rp=require(_0xb09d('0x3'));var htmlToText=require(_0xb09d('0x4'));var fs=require('fs');var path=require(_0xb09d('0x5'));var rimraf=require(_0xb09d('0x6'));var config=require(_0xb09d('0x7'));var attributes=require('./mailMessage.attributes');module[_0xb09d('0x8')]=function(_0x4f93f1,_0x4319f0){return _0x4f93f1['define'](_0xb09d('0x9'),attributes,{'tableName':_0xb09d('0xa'),'paranoid':![],'indexes':[{'name':_0xb09d('0xb'),'fields':[_0xb09d('0xb')]},{'name':'fti_mail_messages','fields':[_0xb09d('0xc'),_0xb09d('0xd')],'type':_0xb09d('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xbaa222,_0x1a0d38,_0xd9b9a6){if(_0xbaa222[_0xb09d('0xf')]){_0xbaa222[_0xb09d('0xc')]=htmlToText[_0xb09d('0x10')](_0xbaa222[_0xb09d('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xd9b9a6(null,_0x1a0d38);},'afterCreate':function(_0x49ba09,_0x1785bf,_0x22bda4){var _0x2a902c=_0x4f93f1[_0xb09d('0x11')];var _0x4b4bbb=_0x49ba09[_0xb09d('0x12')]({'plain':!![]});if(_0x4b4bbb[_0xb09d('0x13')][_0xb09d('0x14')]()==='in'||_0x4b4bbb['direction'][_0xb09d('0x14')]()===_0xb09d('0x15')&&!_0x4b4bbb['secret']&&!_[_0xb09d('0x16')](_0x4b4bbb[_0xb09d('0x17')])){_0x2a902c[_0xb09d('0x18')][_0xb09d('0x19')]({'where':{'id':_0x4b4bbb['MailInteractionId']}})[_0xb09d('0x1a')](function(_0x7f6f3b){if(_0x7f6f3b){_0x7f6f3b[_0xb09d('0x1b')]({'lastMsgAt':_0x4b4bbb[_0xb09d('0x1c')],'lastMsgDirection':_0x4b4bbb[_0xb09d('0x13')][_0xb09d('0x14')](),'lastMsgBody':_0x4b4bbb[_0xb09d('0xf')]});}})[_0xb09d('0x1d')](function(_0x49870e){console[_0xb09d('0x1e')](_0x49870e);});}_0x22bda4();}},'charset':_0xb09d('0x1f'),'collate':_0xb09d('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index cb74cc4..8c84c48 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 _0x8375=['code','message','catch','CreateMailMessage','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8375,0xa8));var _0x5837=function(_0x590422,_0x4d0d6f){_0x590422=_0x590422-0x0;var _0x484739=_0x8375[_0x590422];return _0x484739;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var moment=require(_0x5837('0x2'));var BPromise=require('bluebird');var rs=require(_0x5837('0x3'));var fs=require('fs');var Redis=require(_0x5837('0x4'));var db=require(_0x5837('0x5'))['db'];var utils=require(_0x5837('0x6'));var logger=require(_0x5837('0x7'))(_0x5837('0x8'));var config=require('../../config/environment');var jayson=require(_0x5837('0x9'));var client=jayson[_0x5837('0xa')][_0x5837('0xb')]({'port':0x232a});config[_0x5837('0xc')]=_[_0x5837('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5837('0xe'))(new Redis(config[_0x5837('0xc')]));require('./mailMessage.socket')[_0x5837('0xf')](socket);function respondWithRpcPromise(_0x4d0e3c,_0x4556fd,_0x383e5e){return new BPromise(function(_0x11cd29,_0xc6c6c9){return client[_0x5837('0x10')](_0x4d0e3c,_0x383e5e)[_0x5837('0x11')](function(_0x5ec2fe){logger[_0x5837('0x12')](_0x5837('0x13'),_0x4556fd,_0x5837('0x14'));logger[_0x5837('0x15')](_0x5837('0x16'),_0x4556fd,'request\x20sent',JSON['stringify'](_0x5ec2fe));if(_0x5ec2fe['error']){if(_0x5ec2fe[_0x5837('0x17')][_0x5837('0x18')]===0x1f4){logger[_0x5837('0x17')](_0x5837('0x13'),_0x4556fd,_0x5ec2fe[_0x5837('0x17')][_0x5837('0x19')]);return _0xc6c6c9(_0x5ec2fe[_0x5837('0x17')][_0x5837('0x19')]);}logger[_0x5837('0x17')]('MailMessage,\x20%s,\x20%s',_0x4556fd,_0x5ec2fe[_0x5837('0x17')][_0x5837('0x19')]);return _0x11cd29(_0x5ec2fe['error'][_0x5837('0x19')]);}else{logger[_0x5837('0x12')](_0x5837('0x13'),_0x4556fd,'request\x20sent');_0x11cd29(_0x5ec2fe['result']['message']);}})[_0x5837('0x1a')](function(_0x3a5386){logger[_0x5837('0x17')]('MailMessage,\x20%s,\x20%s',_0x4556fd,_0x3a5386);_0xc6c6c9(_0x3a5386);});});}exports[_0x5837('0x1b')]=function(_0x178c4c){var _0x316d43=this;return new Promise(function(_0x139111,_0x5881ff){return db['MailMessage']['create'](_0x178c4c[_0x5837('0x1c')],{'raw':_0x178c4c['options']?_0x178c4c[_0x5837('0x1d')][_0x5837('0x1e')]===undefined?!![]:![]:!![]})[_0x5837('0x11')](function(_0x3a7efe){logger['info']('CreateMailMessage',_0x178c4c);logger[_0x5837('0x15')](_0x5837('0x1b'),_0x178c4c,JSON[_0x5837('0x1f')](_0x3a7efe));_0x139111(_0x3a7efe);})['catch'](function(_0x7a6232){logger[_0x5837('0x17')](_0x5837('0x1b'),_0x7a6232['message'],_0x178c4c);_0x5881ff(_0x316d43[_0x5837('0x17')](0x1f4,_0x7a6232[_0x5837('0x19')]));});});}; \ No newline at end of file +var _0x0309=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','body','options','raw','debug','lodash','moment','randomstring'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0309,0x165));var _0x9030=function(_0x376804,_0x513f3e){_0x376804=_0x376804-0x0;var _0x5f3653=_0x0309[_0x376804];return _0x5f3653;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var moment=require(_0x9030('0x1'));var BPromise=require('bluebird');var rs=require(_0x9030('0x2'));var fs=require('fs');var Redis=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];var utils=require(_0x9030('0x5'));var logger=require(_0x9030('0x6'))(_0x9030('0x7'));var config=require(_0x9030('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9030('0x9')]({'port':0x232a});config[_0x9030('0xa')]=_['defaults'](config[_0x9030('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9030('0xb'))(new Redis(config[_0x9030('0xa')]));require(_0x9030('0xc'))['register'](socket);function respondWithRpcPromise(_0xe2c28b,_0x1da9ec,_0x337b86){return new BPromise(function(_0x53ef39,_0x37d6e0){return client[_0x9030('0xd')](_0xe2c28b,_0x337b86)[_0x9030('0xe')](function(_0x11a539){logger[_0x9030('0xf')](_0x9030('0x10'),_0x1da9ec,_0x9030('0x11'));logger['debug'](_0x9030('0x12'),_0x1da9ec,_0x9030('0x11'),JSON[_0x9030('0x13')](_0x11a539));if(_0x11a539[_0x9030('0x14')]){if(_0x11a539['error'][_0x9030('0x15')]===0x1f4){logger[_0x9030('0x14')](_0x9030('0x10'),_0x1da9ec,_0x11a539[_0x9030('0x14')][_0x9030('0x16')]);return _0x37d6e0(_0x11a539[_0x9030('0x14')][_0x9030('0x16')]);}logger[_0x9030('0x14')](_0x9030('0x10'),_0x1da9ec,_0x11a539['error'][_0x9030('0x16')]);return _0x53ef39(_0x11a539[_0x9030('0x14')][_0x9030('0x16')]);}else{logger[_0x9030('0xf')](_0x9030('0x10'),_0x1da9ec,_0x9030('0x11'));_0x53ef39(_0x11a539[_0x9030('0x17')][_0x9030('0x16')]);}})[_0x9030('0x18')](function(_0x31e196){logger[_0x9030('0x14')](_0x9030('0x10'),_0x1da9ec,_0x31e196);_0x37d6e0(_0x31e196);});});}exports[_0x9030('0x19')]=function(_0x243e7d){var _0x1e5988=this;return new Promise(function(_0x285d93,_0x4105ec){return db['MailMessage']['create'](_0x243e7d[_0x9030('0x1a')],{'raw':_0x243e7d[_0x9030('0x1b')]?_0x243e7d['options'][_0x9030('0x1c')]===undefined?!![]:![]:!![]})[_0x9030('0xe')](function(_0x1f806a){logger[_0x9030('0xf')]('CreateMailMessage',_0x243e7d);logger[_0x9030('0x1d')]('CreateMailMessage',_0x243e7d,JSON['stringify'](_0x1f806a));_0x285d93(_0x1f806a);})[_0x9030('0x18')](function(_0x2b205c){logger[_0x9030('0x14')]('CreateMailMessage',_0x2b205c[_0x9030('0x16')],_0x243e7d);_0x4105ec(_0x1e5988[_0x9030('0x14')](0x1f4,_0x2b205c[_0x9030('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1f4a705..c2a3334 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 _0x1d1b=['length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x1d1b,0x110));var _0xb1d1=function(_0x1f6460,_0x35435e){_0x1f6460=_0x1f6460-0x0;var _0x5cd0ec=_0x1d1b[_0x1f6460];return _0x5cd0ec;};'use strict';var MailMessageEvents=require(_0xb1d1('0x0'));var events=[_0xb1d1('0x1'),_0xb1d1('0x2'),_0xb1d1('0x3')];function createListener(_0x7edf23,_0x4093d1){return function(_0x40de3e){_0x4093d1['emit'](_0x7edf23,_0x40de3e);};}function removeListener(_0x107276,_0xa4027f){return function(){MailMessageEvents['removeListener'](_0x107276,_0xa4027f);};}exports['register']=function(_0x45e162){for(var _0x1adc8e=0x0,_0x32716b=events[_0xb1d1('0x4')];_0x1adc8e<_0x32716b;_0x1adc8e++){var _0x30babe=events[_0x1adc8e];var _0x28dbad=createListener(_0xb1d1('0x5')+_0x30babe,_0x45e162);MailMessageEvents['on'](_0x30babe,_0x28dbad);}}; \ No newline at end of file +var _0xfd6b=['emit','removeListener','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfd6b,0x1d1));var _0xbfd6=function(_0x55b2fa,_0x454d8c){_0x55b2fa=_0x55b2fa-0x0;var _0x48bdc5=_0xfd6b[_0x55b2fa];return _0x48bdc5;};'use strict';var MailMessageEvents=require(_0xbfd6('0x0'));var events=[_0xbfd6('0x1'),_0xbfd6('0x2'),_0xbfd6('0x3')];function createListener(_0x60cc53,_0x371e92){return function(_0x5d8ad7){_0x371e92[_0xbfd6('0x4')](_0x60cc53,_0x5d8ad7);};}function removeListener(_0x23a61f,_0x3424fd){return function(){MailMessageEvents[_0xbfd6('0x5')](_0x23a61f,_0x3424fd);};}exports['register']=function(_0x249e43){for(var _0x6f57ec=0x0,_0x570c21=events['length'];_0x6f57ec<_0x570c21;_0x6f57ec++){var _0x161e4f=events[_0x6f57ec];var _0x73696c=createListener(_0xbfd6('0x6')+_0x161e4f,_0x249e43);MailMessageEvents['on'](_0x161e4f,_0x73696c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b99730e..cc8a67e 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 _0x1f8c=['/describe','describe','/:id','/:id/members','isAuthenticated','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','express','../../components/interaction/service','get'];(function(_0x1ff12c,_0x40e32e){var _0x5163f3=function(_0x4c6a98){while(--_0x4c6a98){_0x1ff12c['push'](_0x1ff12c['shift']());}};_0x5163f3(++_0x40e32e);}(_0x1f8c,0x6d));var _0xc1f8=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x1f8c[_0x5e7514];return _0x12f472;};'use strict';var multer=require(_0xc1f8('0x0'));var util=require(_0xc1f8('0x1'));var path=require(_0xc1f8('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1f8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc1f8('0x4'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xc1f8('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc1f8('0x5')](_0xc1f8('0x6'),auth['isAuthenticated'](),controller[_0xc1f8('0x7')]);router[_0xc1f8('0x5')](_0xc1f8('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xc1f8('0x5')](_0xc1f8('0x9'),auth[_0xc1f8('0xa')](),controller['getMembers']);router[_0xc1f8('0x5')](_0xc1f8('0xb'),auth[_0xc1f8('0xa')](),controller[_0xc1f8('0xc')]);router[_0xc1f8('0x5')](_0xc1f8('0xd'),auth['isAuthenticated'](),controller[_0xc1f8('0xe')]);router[_0xc1f8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc1f8('0xf')]('/:id/teams',auth[_0xc1f8('0xa')](),controller[_0xc1f8('0x10')]);router[_0xc1f8('0xf')](_0xc1f8('0xd'),auth[_0xc1f8('0xa')](),controller[_0xc1f8('0x11')]);router[_0xc1f8('0x12')](_0xc1f8('0x8'),auth[_0xc1f8('0xa')](),controller[_0xc1f8('0x13')]);router[_0xc1f8('0x14')](_0xc1f8('0x8'),auth[_0xc1f8('0xa')](),controller['destroy']);router[_0xc1f8('0x14')](_0xc1f8('0xb'),auth[_0xc1f8('0xa')](),controller[_0xc1f8('0x15')]);router[_0xc1f8('0x14')](_0xc1f8('0xd'),auth[_0xc1f8('0xa')](),controller[_0xc1f8('0x16')]);module['exports']=router; \ No newline at end of file +var _0xef71=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated'];(function(_0x37afcc,_0x54cda7){var _0x22ba6f=function(_0x467d98){while(--_0x467d98){_0x37afcc['push'](_0x37afcc['shift']());}};_0x22ba6f(++_0x54cda7);}(_0xef71,0x105));var _0x1ef7=function(_0x57d947,_0x175bde){_0x57d947=_0x57d947-0x0;var _0x216479=_0xef71[_0x57d947];return _0x216479;};'use strict';var multer=require(_0x1ef7('0x0'));var util=require(_0x1ef7('0x1'));var path=require('path');var timeout=require(_0x1ef7('0x2'));var express=require(_0x1ef7('0x3'));var router=express[_0x1ef7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1ef7('0x5'));var config=require('../../config/environment');var controller=require(_0x1ef7('0x6'));router[_0x1ef7('0x7')]('/',auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x9')]);router[_0x1ef7('0x7')](_0x1ef7('0xa'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0xb')]);router[_0x1ef7('0x7')]('/:id',auth[_0x1ef7('0x8')](),controller[_0x1ef7('0xc')]);router[_0x1ef7('0x7')](_0x1ef7('0xd'),auth['isAuthenticated'](),controller[_0x1ef7('0xe')]);router[_0x1ef7('0x7')](_0x1ef7('0xf'),auth['isAuthenticated'](),controller[_0x1ef7('0x10')]);router['get'](_0x1ef7('0x11'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x12')]);router['post']('/',auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x13')]);router[_0x1ef7('0x14')](_0x1ef7('0xf'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x15')]);router[_0x1ef7('0x14')](_0x1ef7('0x11'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x16')]);router['put'](_0x1ef7('0x17'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x18')]);router[_0x1ef7('0x19')](_0x1ef7('0x17'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x1a')]);router[_0x1ef7('0x19')](_0x1ef7('0xf'),auth[_0x1ef7('0x8')](),controller[_0x1ef7('0x1b')]);router[_0x1ef7('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x1ef7('0x1c')]);module[_0x1ef7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9e5ba57..07cd71b 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 _0x1477=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x33a373,_0x296c5d){var _0x1eb767=function(_0x535c36){while(--_0x535c36){_0x33a373['push'](_0x33a373['shift']());}};_0x1eb767(++_0x296c5d);}(_0x1477,0x14e));var _0x7147=function(_0x4151a2,_0x120072){_0x4151a2=_0x4151a2-0x0;var _0x446a5f=_0x1477[_0x4151a2];return _0x446a5f;};'use strict';var Sequelize=require(_0x7147('0x0'));module[_0x7147('0x1')]={'name':{'type':Sequelize[_0x7147('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7147('0x2')]},'timeout':{'type':Sequelize[_0x7147('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7147('0x4'),_0x7147('0x5'),_0x7147('0x6'))}}; \ No newline at end of file +var _0x1cc1=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x27125a,_0x252d0d){var _0x391f7a=function(_0x4068fb){while(--_0x4068fb){_0x27125a['push'](_0x27125a['shift']());}};_0x391f7a(++_0x252d0d);}(_0x1cc1,0x106));var _0x11cc=function(_0x89cf5e,_0x12e0bf){_0x89cf5e=_0x89cf5e-0x0;var _0x1eb7aa=_0x1cc1[_0x89cf5e];return _0x1eb7aa;};'use strict';var Sequelize=require(_0x11cc('0x0'));module[_0x11cc('0x1')]={'name':{'type':Sequelize[_0x11cc('0x2')],'unique':_0x11cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11cc('0x2')]},'timeout':{'type':Sequelize[_0x11cc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x11cc('0x5'),_0x11cc('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4c20406..c296642 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 _0x1db3=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','destroy','then','get','MailQueues','UserProfileResource','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','MailQueue','count','includeAll','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','mailPause','createdAt','getTeams','findOne','Team','pick','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x130728,_0x1381a0){var _0x413c3d=function(_0x5c234f){while(--_0x5c234f){_0x130728['push'](_0x130728['shift']());}};_0x413c3d(++_0x1381a0);}(_0x1db3,0x77));var _0x31db=function(_0x5f46c8,_0x5ccfb6){_0x5f46c8=_0x5f46c8-0x0;var _0xc0431a=_0x1db3[_0x5f46c8];return _0xc0431a;};'use strict';var pdf=require(_0x31db('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x31db('0x1'));var zipdir=require(_0x31db('0x2'));var jsonpatch=require(_0x31db('0x3'));var rp=require(_0x31db('0x4'));var moment=require('moment');var BPromise=require(_0x31db('0x5'));var Mustache=require('mustache');var util=require(_0x31db('0x6'));var path=require(_0x31db('0x7'));var sox=require(_0x31db('0x8'));var csv=require(_0x31db('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x31db('0xa'));var squel=require(_0x31db('0xb'));var crypto=require(_0x31db('0xc'));var jsforce=require(_0x31db('0xd'));var deskjs=require(_0x31db('0xe'));var toCsv=require('to-csv');var querystring=require(_0x31db('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x31db('0x10'));var as=require(_0x31db('0x11'));var hardwareService=require(_0x31db('0x12'));var logger=require(_0x31db('0x13'))('api');var utils=require(_0x31db('0x14'));var config=require(_0x31db('0x15'));var db=require(_0x31db('0x16'))['db'];config[_0x31db('0x17')]=_['defaults'](config[_0x31db('0x17')],{'host':_0x31db('0x18'),'port':0x18eb});var socket=require(_0x31db('0x19'))(new Redis(config[_0x31db('0x17')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x328567,_0xf02b68){_0xf02b68=_0xf02b68||0xcc;return function(_0xeba399){if(_0xeba399){return _0x328567[_0x31db('0x1a')](_0xf02b68);}return _0x328567[_0x31db('0x1b')](_0xf02b68)[_0x31db('0x1c')]();};}function respondWithResult(_0x5c78c4,_0x495f52){_0x495f52=_0x495f52||0xc8;return function(_0x28fa21){if(_0x28fa21){return _0x5c78c4[_0x31db('0x1b')](_0x495f52)[_0x31db('0x1d')](_0x28fa21);}};}function respondWithFilteredResult(_0x2c664d,_0x44568e){return function(_0x92394c){if(_0x92394c){var _0x5b5057=_0x92394c['count'],_0x2b8956=_0x44568e[_0x31db('0x1e')],_0x35846d=_0x44568e[_0x31db('0x1e')]+_0x44568e['limit'],_0x6bd70f;if(_0x35846d>=_0x5b5057){_0x35846d=_0x5b5057;_0x6bd70f=0xc8;}else{_0x6bd70f=0xce;}_0x2c664d[_0x31db('0x1b')](_0x6bd70f);return _0x2c664d[_0x31db('0x1f')](_0x31db('0x20'),_0x2b8956+'-'+_0x35846d+'/'+_0x5b5057)[_0x31db('0x1d')](_0x92394c);}return null;};}function patchUpdates(_0x56bb66){return function(_0x1cf3b9){try{jsonpatch[_0x31db('0x21')](_0x1cf3b9,_0x56bb66,!![]);}catch(_0x258be0){return BPromise['reject'](_0x258be0);}return _0x1cf3b9[_0x31db('0x22')]();};}function saveUpdates(_0x38a062,_0x1c387b){return function(_0x30fc86){if(_0x30fc86){return _0x30fc86[_0x31db('0x23')](_0x38a062)['then'](function(_0x3cfa5c){return _0x3cfa5c;});}return null;};}function removeEntity(_0x48306d,_0x9fadb4){return function(_0x5ecc2e){if(_0x5ecc2e){return _0x5ecc2e[_0x31db('0x24')]()[_0x31db('0x25')](function(){var _0x335afd=_0x5ecc2e[_0x31db('0x26')]({'plain':!![]});var _0x3592aa=_0x31db('0x27');return db[_0x31db('0x28')]['destroy']({'where':{'type':_0x3592aa,'resourceId':_0x335afd['id']}})['then'](function(){return _0x5ecc2e;});})['then'](function(){_0x48306d[_0x31db('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fc1f,_0x1f8cb5){return function(_0x2d14f4){if(!_0x2d14f4){_0x49fc1f['sendStatus'](0x194);}return _0x2d14f4;};}function handleError(_0x23b016,_0x1e9023){_0x1e9023=_0x1e9023||0x1f4;return function(_0x1ddfae){logger['error'](_0x1ddfae['stack']);if(_0x1ddfae[_0x31db('0x29')]){delete _0x1ddfae[_0x31db('0x29')];}_0x23b016[_0x31db('0x1b')](_0x1e9023)[_0x31db('0x2a')](_0x1ddfae);};}exports['index']=function(_0x3f6205,_0x47dabe){var _0x3ca2c0={},_0xeb4b9f={},_0x3ce45b={'count':0x0,'rows':[]};var _0x9ff86e=_[_0x31db('0x2b')](db['MailQueue'][_0x31db('0x2c')],function(_0x409651){return{'name':_0x409651[_0x31db('0x2d')],'type':_0x409651[_0x31db('0x2e')]['key']};});_0xeb4b9f[_0x31db('0x2f')]=_[_0x31db('0x2b')](_0x9ff86e,'name');_0xeb4b9f['query']=_[_0x31db('0x30')](_0x3f6205[_0x31db('0x31')]);_0xeb4b9f[_0x31db('0x32')]=_[_0x31db('0x33')](_0xeb4b9f[_0x31db('0x2f')],_0xeb4b9f[_0x31db('0x31')]);_0x3ca2c0[_0x31db('0x34')]=_[_0x31db('0x33')](_0xeb4b9f[_0x31db('0x2f')],qs[_0x31db('0x35')](_0x3f6205[_0x31db('0x31')]['fields']));_0x3ca2c0[_0x31db('0x34')]=_0x3ca2c0[_0x31db('0x34')][_0x31db('0x36')]?_0x3ca2c0[_0x31db('0x34')]:_0xeb4b9f[_0x31db('0x2f')];if(!_0x3f6205[_0x31db('0x31')][_0x31db('0x37')](_0x31db('0x38'))){_0x3ca2c0[_0x31db('0x39')]=qs[_0x31db('0x39')](_0x3f6205[_0x31db('0x31')][_0x31db('0x39')]);_0x3ca2c0[_0x31db('0x1e')]=qs[_0x31db('0x1e')](_0x3f6205[_0x31db('0x31')]['offset']);}_0x3ca2c0[_0x31db('0x3a')]=qs[_0x31db('0x3b')](_0x3f6205['query'][_0x31db('0x3b')]);_0x3ca2c0[_0x31db('0x3c')]=qs[_0x31db('0x32')](_['pick'](_0x3f6205[_0x31db('0x31')],_0xeb4b9f[_0x31db('0x32')]),_0x9ff86e);if(_0x3f6205[_0x31db('0x31')][_0x31db('0x3d')]){_0x3ca2c0['where']=_[_0x31db('0x3e')](_0x3ca2c0['where'],{'$or':_[_0x31db('0x2b')](_0x9ff86e,function(_0x4919aa){if(_0x4919aa['type']!==_0x31db('0x3f')){var _0x888176={};_0x888176[_0x4919aa['name']]={'$like':'%'+_0x3f6205[_0x31db('0x31')][_0x31db('0x3d')]+'%'};return _0x888176;}})});}_0x3ca2c0=_[_0x31db('0x3e')]({},_0x3ca2c0,_0x3f6205[_0x31db('0x40')]);var _0x4815be={'where':_0x3ca2c0[_0x31db('0x3c')]};return db[_0x31db('0x41')][_0x31db('0x42')](_0x4815be)['then'](function(_0x1379e0){_0x3ce45b[_0x31db('0x42')]=_0x1379e0;if(_0x3f6205[_0x31db('0x31')][_0x31db('0x43')]){_0x3ca2c0[_0x31db('0x44')]=[{'all':!![]}];}return db[_0x31db('0x41')][_0x31db('0x45')](_0x3ca2c0);})['then'](function(_0x548843){_0x3ce45b[_0x31db('0x46')]=_0x548843;return _0x3ce45b;})[_0x31db('0x25')](respondWithFilteredResult(_0x47dabe,_0x3ca2c0))['catch'](handleError(_0x47dabe,null));};exports[_0x31db('0x47')]=function(_0x2dfcd9,_0x58ecba){var _0xd40f43={'raw':!![],'where':{'id':_0x2dfcd9[_0x31db('0x48')]['id']}},_0x35e684={};_0x35e684[_0x31db('0x2f')]=_[_0x31db('0x30')](db[_0x31db('0x41')][_0x31db('0x2c')]);_0x35e684[_0x31db('0x31')]=_['keys'](_0x2dfcd9['query']);_0x35e684[_0x31db('0x32')]=_[_0x31db('0x33')](_0x35e684[_0x31db('0x2f')],_0x35e684[_0x31db('0x31')]);_0xd40f43[_0x31db('0x34')]=_[_0x31db('0x33')](_0x35e684[_0x31db('0x2f')],qs[_0x31db('0x35')](_0x2dfcd9[_0x31db('0x31')]['fields']));_0xd40f43[_0x31db('0x34')]=_0xd40f43[_0x31db('0x34')]['length']?_0xd40f43[_0x31db('0x34')]:_0x35e684[_0x31db('0x2f')];if(_0x2dfcd9[_0x31db('0x31')][_0x31db('0x43')]){_0xd40f43[_0x31db('0x44')]=[{'all':!![]}];}_0xd40f43=_[_0x31db('0x3e')]({},_0xd40f43,_0x2dfcd9[_0x31db('0x40')]);return db[_0x31db('0x41')][_0x31db('0x49')](_0xd40f43)[_0x31db('0x25')](handleEntityNotFound(_0x58ecba,null))[_0x31db('0x25')](respondWithResult(_0x58ecba,null))['catch'](handleError(_0x58ecba,null));};exports[_0x31db('0x4a')]=function(_0x571b1f,_0x1b0a5a){return db[_0x31db('0x41')][_0x31db('0x4a')](_0x571b1f['body'],{})['then'](function(_0x26307b){var _0xf41934=_0x571b1f['user'][_0x31db('0x26')]({'plain':!![]});if(!_0xf41934)throw new Error(_0x31db('0x4b'));if(_0xf41934[_0x31db('0x4c')]===_0x31db('0x4d')){var _0x2666eb=_0x26307b[_0x31db('0x26')]({'plain':!![]});var _0x43a7e0='MailQueues';return db[_0x31db('0x4e')][_0x31db('0x49')]({'where':{'name':_0x43a7e0,'userProfileId':_0xf41934[_0x31db('0x4f')]},'raw':!![]})[_0x31db('0x25')](function(_0x6926d9){if(_0x6926d9&&_0x6926d9[_0x31db('0x50')]===0x0){return db[_0x31db('0x28')][_0x31db('0x4a')]({'name':_0x2666eb[_0x31db('0x29')],'resourceId':_0x2666eb['id'],'type':_0x6926d9[_0x31db('0x29')],'sectionId':_0x6926d9['id']},{})[_0x31db('0x25')](function(){return _0x26307b;});}else{return _0x26307b;}})[_0x31db('0x51')](function(_0x1b9df5){logger[_0x31db('0x52')](_0x31db('0x53'),_0x1b9df5);throw _0x1b9df5;});}return _0x26307b;})['then'](respondWithResult(_0x1b0a5a,0xc9))[_0x31db('0x51')](handleError(_0x1b0a5a,null));};exports[_0x31db('0x23')]=function(_0x4d07d9,_0x249e30){if(_0x4d07d9[_0x31db('0x54')]['id']){delete _0x4d07d9[_0x31db('0x54')]['id'];}return db[_0x31db('0x41')][_0x31db('0x49')]({'where':{'id':_0x4d07d9[_0x31db('0x48')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x249e30,null))[_0x31db('0x25')](saveUpdates(_0x4d07d9[_0x31db('0x54')],null))[_0x31db('0x25')](respondWithResult(_0x249e30,null))[_0x31db('0x51')](handleError(_0x249e30,null));};exports[_0x31db('0x24')]=function(_0x31922d,_0x4f897e){return db[_0x31db('0x41')]['find']({'where':{'id':_0x31922d[_0x31db('0x48')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x4f897e,null))[_0x31db('0x25')](removeEntity(_0x4f897e,null))[_0x31db('0x51')](handleError(_0x4f897e,null));};exports['describe']=function(_0x496c6d,_0x456c9f){return db[_0x31db('0x41')][_0x31db('0x55')]()[_0x31db('0x25')](respondWithResult(_0x456c9f,null))[_0x31db('0x51')](handleError(_0x456c9f,null));};exports['getMembers']=function(_0x25dfc3,_0x1087ae,_0x1b831b){var _0x34b158={'raw':!![],'where':{}},_0x31ae7e={},_0x3bb38f;return db[_0x31db('0x41')]['findOne']({'where':{'id':_0x25dfc3[_0x31db('0x48')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x1087ae,null))[_0x31db('0x25')](function(_0x1dd318){if(_0x1dd318){_0x3bb38f=_0x1dd318[_0x31db('0x26')]({'plain':!![]});_0x31ae7e[_0x31db('0x2f')]=_[_0x31db('0x30')](db[_0x31db('0x56')][_0x31db('0x2c')]);_0x31ae7e['query']=_[_0x31db('0x30')](_0x25dfc3['query']);_0x31ae7e[_0x31db('0x32')]=_[_0x31db('0x33')](_0x31ae7e[_0x31db('0x2f')],_0x31ae7e[_0x31db('0x31')]);_0x34b158[_0x31db('0x34')]=_[_0x31db('0x33')](_0x31ae7e[_0x31db('0x2f')],qs[_0x31db('0x35')](_0x25dfc3[_0x31db('0x31')][_0x31db('0x35')]));_0x34b158['attributes']=_0x34b158['attributes'][_0x31db('0x36')]?_0x34b158[_0x31db('0x34')]:_0x31ae7e[_0x31db('0x2f')];if(!_0x25dfc3[_0x31db('0x31')]['hasOwnProperty']('nolimit')){_0x34b158[_0x31db('0x39')]=qs[_0x31db('0x39')](_0x25dfc3['query'][_0x31db('0x39')]);_0x34b158['offset']=qs[_0x31db('0x1e')](_0x25dfc3['query'][_0x31db('0x1e')]);}_0x34b158[_0x31db('0x3a')]=qs[_0x31db('0x3b')](_0x25dfc3[_0x31db('0x31')][_0x31db('0x3b')]);_0x34b158[_0x31db('0x3c')]=qs['filters'](_['pick'](_0x25dfc3[_0x31db('0x31')],_0x31ae7e[_0x31db('0x32')]));_0x34b158[_0x31db('0x3c')][_0x31db('0x57')]=_0x1dd318['id'];if(_0x25dfc3['query'][_0x31db('0x3d')]){_0x34b158[_0x31db('0x3c')]=_[_0x31db('0x3e')](_0x34b158[_0x31db('0x3c')],{'$or':_[_0x31db('0x2b')](_0x34b158[_0x31db('0x34')],function(_0xf4ca8d){var _0x477185={};_0x477185[_0xf4ca8d]={'$like':'%'+_0x25dfc3[_0x31db('0x31')][_0x31db('0x3d')]+'%'};return _0x477185;})});}_0x34b158=_[_0x31db('0x3e')]({},_0x34b158,_0x25dfc3[_0x31db('0x40')]);return db[_0x31db('0x56')][_0x31db('0x45')](_0x34b158);}})['then'](function(_0x247737){if(_0x247737){return db[_0x31db('0x58')][_0x31db('0x59')]({'where':{'id':_[_0x31db('0x2b')](_0x247737,_0x31db('0x5a')),'role':_0x31db('0x5b')},'attributes':['id','name','mailPause',_0x31db('0x5c'),'createdAt']});}})[_0x31db('0x25')](function(_0x5574fc){if(_0x5574fc){return{'count':_0x5574fc[_0x31db('0x42')],'rows':_[_0x31db('0x2b')](_0x5574fc[_0x31db('0x46')],function(_0x25959e){return{'membername':_0x25959e[_0x31db('0x29')],'UserId':_0x25959e['id'],'queue_name':_0x3bb38f[_0x31db('0x29')],'MailQueueId':_0x3bb38f['id'],'interface':util[_0x31db('0x5d')](_0x31db('0x5e'),'SIP',_0x25959e[_0x31db('0x29')]),'penalty':0x0,'paused':_0x25959e[_0x31db('0x5f')],'createdAt':_0x25959e[_0x31db('0x60')],'updatedAt':_0x25959e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x31db('0x25')](respondWithFilteredResult(_0x1087ae,_0x34b158))[_0x31db('0x51')](handleError(_0x1087ae,null));};exports[_0x31db('0x61')]=function(_0x48dbdc,_0x2314ff,_0x1e4ee7){var _0x58ca67={};var _0x19a640={};var _0x5f210b;var _0x4ed0b8;return db[_0x31db('0x41')][_0x31db('0x62')]({'where':{'id':_0x48dbdc[_0x31db('0x48')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x2314ff,null))[_0x31db('0x25')](function(_0xf2b65a){if(_0xf2b65a){_0x5f210b=_0xf2b65a;_0x19a640['model']=_['keys'](db[_0x31db('0x63')][_0x31db('0x2c')]);_0x19a640[_0x31db('0x31')]=_[_0x31db('0x30')](_0x48dbdc['query']);_0x19a640[_0x31db('0x32')]=_[_0x31db('0x33')](_0x19a640[_0x31db('0x2f')],_0x19a640[_0x31db('0x31')]);_0x58ca67[_0x31db('0x34')]=_['intersection'](_0x19a640[_0x31db('0x2f')],qs[_0x31db('0x35')](_0x48dbdc[_0x31db('0x31')][_0x31db('0x35')]));_0x58ca67[_0x31db('0x34')]=_0x58ca67['attributes'][_0x31db('0x36')]?_0x58ca67[_0x31db('0x34')]:_0x19a640[_0x31db('0x2f')];_0x58ca67[_0x31db('0x3a')]=qs[_0x31db('0x3b')](_0x48dbdc[_0x31db('0x31')]['sort']);_0x58ca67[_0x31db('0x3c')]=qs['filters'](_[_0x31db('0x64')](_0x48dbdc['query'],_0x19a640[_0x31db('0x32')]));if(_0x48dbdc['query'][_0x31db('0x3d')]){_0x58ca67[_0x31db('0x3c')]=_[_0x31db('0x3e')](_0x58ca67[_0x31db('0x3c')],{'$or':_[_0x31db('0x2b')](_0x58ca67[_0x31db('0x34')],function(_0x358719){var _0x520914={};_0x520914[_0x358719]={'$like':'%'+_0x48dbdc['query'][_0x31db('0x3d')]+'%'};return _0x520914;})});}_0x58ca67=_[_0x31db('0x3e')]({},_0x58ca67,_0x48dbdc['options']);return _0x5f210b[_0x31db('0x61')](_0x58ca67);}})[_0x31db('0x25')](function(_0x4705e3){if(_0x4705e3){_0x4ed0b8=_0x4705e3[_0x31db('0x36')];if(!_0x48dbdc[_0x31db('0x31')][_0x31db('0x37')](_0x31db('0x38'))){_0x58ca67[_0x31db('0x39')]=qs[_0x31db('0x39')](_0x48dbdc[_0x31db('0x31')][_0x31db('0x39')]);_0x58ca67['offset']=qs[_0x31db('0x1e')](_0x48dbdc[_0x31db('0x31')][_0x31db('0x1e')]);}return _0x5f210b[_0x31db('0x61')](_0x58ca67);}})[_0x31db('0x25')](function(_0x59ba4c){if(_0x59ba4c){return _0x59ba4c?{'count':_0x4ed0b8,'rows':_0x59ba4c}:null;}})[_0x31db('0x25')](respondWithResult(_0x2314ff,null))['catch'](handleError(_0x2314ff,null));};exports[_0x31db('0x65')]=function(_0x333609,_0x10be6d,_0x187ff8){var _0xb4446d=_0x333609[_0x31db('0x54')][_0x31db('0x66')];return db['Team'][_0x31db('0x45')]({'where':{'id':_0xb4446d},'attributes':['id'],'include':[{'model':db[_0x31db('0x58')],'as':_0x31db('0x67'),'attributes':['id',_0x31db('0x29'),'online',_0x31db('0x68'),_0x31db('0x69')],'raw':!![]}]})['then'](function(_0x53c394){if(_0x53c394){var _0x404654=_['flatMap'](_0x53c394,function(_0x174463){var _0x4bba01=_0x174463[_0x31db('0x26')]({'plain':!![]});return _0x4bba01[_0x31db('0x67')];});return db[_0x31db('0x41')][_0x31db('0x49')]({'where':{'id':_0x333609[_0x31db('0x48')]['id']}})[_0x31db('0x25')](function(_0x44b9b4){return db[_0x31db('0x6a')][_0x31db('0x6b')](function(_0x24603a){return _0x44b9b4['addTeams'](_0xb4446d,{'transaction':_0x24603a})[_0x31db('0x25')](function(){return BPromise[_0x31db('0x6c')](_0x404654,function(_0x517c75){return db[_0x31db('0x56')][_0x31db('0x6d')]({'where':{'UserId':_0x517c75['id'],'MailQueueId':_0x333609[_0x31db('0x48')]['id']},'transaction':_0x24603a});});})['then'](function(){_0x404654[_0x31db('0x6e')](function(_0x2910f5){socket[_0x31db('0x6f')](_0x31db('0x70'),{'UserId':_0x2910f5['id'],'MailQueueId':_0x44b9b4['id']});});});});});}})['then'](respondWithStatusCode(_0x10be6d,null))[_0x31db('0x51')](handleError(_0x10be6d,null));};exports[_0x31db('0x71')]=function(_0x2d3981,_0x3425f9,_0xaf6341){return db[_0x31db('0x63')][_0x31db('0x45')]({'where':{'id':_0x2d3981['query'][_0x31db('0x66')]},'attributes':['id'],'include':[{'model':db[_0x31db('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x31db('0x25')](handleEntityNotFound(_0x3425f9,null))['then'](function(_0x4cc2a7){var _0x78ec8e=_[_0x31db('0x2b')](_0x4cc2a7,'id');var _0x12518d=[];var _0x375c02=[];var _0x2dc18e=squel[_0x31db('0x72')]();_0x2dc18e[_0x31db('0x73')](_0x31db('0x74'))[_0x31db('0x75')](_0x31db('0x76'),'tq')[_0x31db('0x77')](_0x31db('0x78'),'ut',_0x31db('0x79'))[_0x31db('0x3c')](_0x31db('0x7a'),_0x2d3981[_0x31db('0x48')]['id']);for(var _0x3ec1d7=0x0;_0x3ec1d7<_0x4cc2a7[_0x31db('0x36')];_0x3ec1d7+=0x1){let _0x23890c=_0x4cc2a7[_0x3ec1d7];for(var _0x2a9658=0x0;_0x2a9658<_0x23890c[_0x31db('0x67')][_0x31db('0x36')];_0x2a9658+=0x1){let _0x431726=_0x23890c[_0x31db('0x67')][_0x2a9658];var _0x441b09=_0x2dc18e[_0x31db('0x7b')]();_0x441b09[_0x31db('0x3c')](_0x31db('0x7c'),_0x431726['id']);_0x375c02['push'](db[_0x31db('0x6a')][_0x31db('0x31')](_0x441b09[_0x31db('0x7d')](),{'type':db[_0x31db('0x6a')][_0x31db('0x7e')]['SELECT']})[_0x31db('0x25')](function(_0x1741bd){if(_0x1741bd[_0x31db('0x36')]===0x1){return _0x431726['id'];}else{var _0x32133c=_['every'](_[_0x31db('0x2b')](_0x1741bd,_0x31db('0x7f')),function(_0x310044){return _[_0x31db('0x80')](_0x78ec8e,_0x310044);});if(_0x32133c){return _0x431726['id'];}}}));}}return BPromise[_0x31db('0x81')](_0x375c02)[_0x31db('0x25')](function(_0x356e3b){_0x12518d=_(_0x12518d)[_0x31db('0x82')](_0x356e3b)[_0x31db('0x83')]()['value']();return db[_0x31db('0x41')][_0x31db('0x49')]({'where':{'id':_0x2d3981['params']['id']}})[_0x31db('0x25')](function(_0x413f16){return db[_0x31db('0x6a')][_0x31db('0x6b')](function(_0x121a0e){return _0x413f16[_0x31db('0x71')](_0x2d3981['query'][_0x31db('0x66')],{'transaction':_0x121a0e})['then'](function(){if(!_[_0x31db('0x84')](_0x12518d)){return _0x413f16[_0x31db('0x85')](_0x12518d,{'transaction':_0x121a0e});}})[_0x31db('0x25')](function(){_0x12518d['forEach'](function(_0x1ba568){socket[_0x31db('0x6f')](_0x31db('0x86'),{'UserId':_0x1ba568,'MailQueueId':_0x413f16['id']});});});});});});})[_0x31db('0x25')](respondWithStatusCode(_0x3425f9,null))[_0x31db('0x51')](handleError(_0x3425f9,null));};exports[_0x31db('0x87')]=function(_0x164d53,_0x29d938,_0xc3c5ea){return db[_0x31db('0x41')][_0x31db('0x49')]({'where':{'id':_0x164d53[_0x31db('0x48')]['id']}})['then'](handleEntityNotFound(_0x29d938,null))[_0x31db('0x25')](function(_0x46c911){if(_0x46c911){return _0x46c911[_0x31db('0x87')](_0x164d53['body'][_0x31db('0x66')],_[_0x31db('0x88')](_0x164d53[_0x31db('0x54')],[_0x31db('0x66'),'id'])||{})[_0x31db('0x89')](function(_0x13ca72){for(var _0x1d5139=0x0;_0x1d5139<_0x164d53[_0x31db('0x54')][_0x31db('0x66')]['length'];_0x1d5139+=0x1){socket[_0x31db('0x6f')]('userMailQueue:save',{'UserId':_0x164d53['body'][_0x31db('0x66')][_0x1d5139],'MailQueueId':_0x164d53['params']['id']});}return _0x13ca72;});}})[_0x31db('0x25')](respondWithResult(_0x29d938,null))[_0x31db('0x51')](handleError(_0x29d938,null));};exports['removeAgents']=function(_0x2e192b,_0x28b804,_0x46e507){return db[_0x31db('0x41')][_0x31db('0x49')]({'where':{'id':_0x2e192b[_0x31db('0x48')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x28b804,null))['then'](function(_0x5f3dda){if(_0x5f3dda){return _0x5f3dda[_0x31db('0x85')](_0x2e192b[_0x31db('0x31')][_0x31db('0x66')])[_0x31db('0x25')](function(){if(_[_0x31db('0x8a')](_0x2e192b[_0x31db('0x31')][_0x31db('0x66')])){for(var _0x18e3c4=0x0;_0x18e3c4<_0x2e192b['query'][_0x31db('0x66')][_0x31db('0x36')];_0x18e3c4+=0x1){socket['emit'](_0x31db('0x86'),{'UserId':Number(_0x2e192b[_0x31db('0x31')][_0x31db('0x66')][_0x18e3c4]),'MailQueueId':Number(_0x2e192b[_0x31db('0x48')]['id'])});}}else{socket[_0x31db('0x6f')]('userMailQueue:remove',{'UserId':Number(_0x2e192b['query'][_0x31db('0x66')]),'MailQueueId':Number(_0x2e192b['params']['id'])});}});}})[_0x31db('0x25')](respondWithStatusCode(_0x28b804,null))['catch'](handleError(_0x28b804,null));};exports['getAgents']=function(_0x58f3b3,_0x4ba780,_0x2cdcff){var _0x3752fb={};var _0x264aa3={};var _0x59b544;var _0x364723;return db['MailQueue'][_0x31db('0x62')]({'where':{'id':_0x58f3b3[_0x31db('0x48')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x4ba780,null))[_0x31db('0x25')](function(_0x2ea39d){if(_0x2ea39d){_0x59b544=_0x2ea39d;_0x264aa3[_0x31db('0x2f')]=_[_0x31db('0x30')](db[_0x31db('0x58')]['rawAttributes']);_0x264aa3['query']=_[_0x31db('0x30')](_0x58f3b3[_0x31db('0x31')]);_0x264aa3[_0x31db('0x32')]=_[_0x31db('0x33')](_0x264aa3[_0x31db('0x2f')],_0x264aa3[_0x31db('0x31')]);_0x3752fb[_0x31db('0x34')]=_[_0x31db('0x33')](_0x264aa3[_0x31db('0x2f')],qs[_0x31db('0x35')](_0x58f3b3[_0x31db('0x31')][_0x31db('0x35')]));_0x3752fb['attributes']=_0x3752fb[_0x31db('0x34')][_0x31db('0x36')]?_0x3752fb['attributes']:_0x264aa3['model'];_0x3752fb[_0x31db('0x3a')]=qs[_0x31db('0x3b')](_0x58f3b3[_0x31db('0x31')][_0x31db('0x3b')]);_0x3752fb[_0x31db('0x3c')]=qs[_0x31db('0x32')](_[_0x31db('0x64')](_0x58f3b3[_0x31db('0x31')],_0x264aa3[_0x31db('0x32')]));if(_0x58f3b3[_0x31db('0x31')]['filter']){_0x3752fb[_0x31db('0x3c')]=_['merge'](_0x3752fb[_0x31db('0x3c')],{'$or':_[_0x31db('0x2b')](_0x3752fb[_0x31db('0x34')],function(_0x2ce9a0){var _0x13cea5={};_0x13cea5[_0x2ce9a0]={'$like':'%'+_0x58f3b3[_0x31db('0x31')][_0x31db('0x3d')]+'%'};return _0x13cea5;})});}_0x3752fb=_[_0x31db('0x3e')]({},_0x3752fb,_0x58f3b3[_0x31db('0x40')]);return _0x59b544[_0x31db('0x8b')](_0x3752fb);}})[_0x31db('0x25')](function(_0x14ece5){if(_0x14ece5){_0x364723=_0x14ece5[_0x31db('0x36')];if(!_0x58f3b3[_0x31db('0x31')][_0x31db('0x37')]('nolimit')){_0x3752fb[_0x31db('0x39')]=qs[_0x31db('0x39')](_0x58f3b3[_0x31db('0x31')][_0x31db('0x39')]);_0x3752fb['offset']=qs[_0x31db('0x1e')](_0x58f3b3[_0x31db('0x31')]['offset']);}return _0x59b544['getAgents'](_0x3752fb);}})[_0x31db('0x25')](function(_0x2ef4b1){if(_0x2ef4b1){return _0x2ef4b1?{'count':_0x364723,'rows':_0x2ef4b1}:null;}})['then'](respondWithResult(_0x4ba780,null))['catch'](handleError(_0x4ba780,null));}; \ No newline at end of file +var _0xba13=['save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','type','model','query','keys','intersection','attributes','fields','length','order','where','pick','filters','filter','merge','VIRTUAL','options','MailQueue','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','nolimit','sort','MailQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause','Team','getTeams','ids','Agents','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','userMailQueue:remove','findOne','getAgents','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','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/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','sendStatus','status','end','offset','limit','set','Content-Range','json','reject'];(function(_0x34bfd8,_0x24eaa3){var _0x122c91=function(_0x17081a){while(--_0x17081a){_0x34bfd8['push'](_0x34bfd8['shift']());}};_0x122c91(++_0x24eaa3);}(_0xba13,0x17e));var _0x3ba1=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xba13[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0x3ba1('0x0'));var emlformat=require(_0x3ba1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3ba1('0x2'));var jsonpatch=require(_0x3ba1('0x3'));var rp=require(_0x3ba1('0x4'));var moment=require('moment');var BPromise=require(_0x3ba1('0x5'));var Mustache=require('mustache');var util=require(_0x3ba1('0x6'));var path=require('path');var sox=require(_0x3ba1('0x7'));var csv=require(_0x3ba1('0x8'));var ejs=require(_0x3ba1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3ba1('0xa'));var crypto=require(_0x3ba1('0xb'));var jsforce=require(_0x3ba1('0xc'));var deskjs=require(_0x3ba1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ba1('0xe'));var Papa=require(_0x3ba1('0xf'));var Redis=require(_0x3ba1('0x10'));var authService=require(_0x3ba1('0x11'));var qs=require(_0x3ba1('0x12'));var as=require(_0x3ba1('0x13'));var hardwareService=require(_0x3ba1('0x14'));var logger=require(_0x3ba1('0x15'))(_0x3ba1('0x16'));var utils=require('../../config/utils');var config=require(_0x3ba1('0x17'));var db=require(_0x3ba1('0x18'))['db'];config[_0x3ba1('0x19')]=_[_0x3ba1('0x1a')](config[_0x3ba1('0x19')],{'host':_0x3ba1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3ba1('0x1c'))['register'](socket);function respondWithStatusCode(_0x4293e0,_0x4ac06f){_0x4ac06f=_0x4ac06f||0xcc;return function(_0x21b498){if(_0x21b498){return _0x4293e0[_0x3ba1('0x1d')](_0x4ac06f);}return _0x4293e0[_0x3ba1('0x1e')](_0x4ac06f)[_0x3ba1('0x1f')]();};}function respondWithResult(_0x439943,_0x37dcff){_0x37dcff=_0x37dcff||0xc8;return function(_0x55f02f){if(_0x55f02f){return _0x439943[_0x3ba1('0x1e')](_0x37dcff)['json'](_0x55f02f);}};}function respondWithFilteredResult(_0x29aed7,_0x1b18ab){return function(_0x2fbd12){if(_0x2fbd12){var _0x2b4b1d=_0x2fbd12['count'],_0x4ef6fa=_0x1b18ab[_0x3ba1('0x20')],_0x434e14=_0x1b18ab[_0x3ba1('0x20')]+_0x1b18ab[_0x3ba1('0x21')],_0x39c9dd;if(_0x434e14>=_0x2b4b1d){_0x434e14=_0x2b4b1d;_0x39c9dd=0xc8;}else{_0x39c9dd=0xce;}_0x29aed7[_0x3ba1('0x1e')](_0x39c9dd);return _0x29aed7[_0x3ba1('0x22')](_0x3ba1('0x23'),_0x4ef6fa+'-'+_0x434e14+'/'+_0x2b4b1d)[_0x3ba1('0x24')](_0x2fbd12);}return null;};}function patchUpdates(_0x2eadb5){return function(_0x3c37fc){try{jsonpatch['apply'](_0x3c37fc,_0x2eadb5,!![]);}catch(_0x3c9852){return BPromise[_0x3ba1('0x25')](_0x3c9852);}return _0x3c37fc[_0x3ba1('0x26')]();};}function saveUpdates(_0x1e44b8,_0x349ec3){return function(_0x171aa5){if(_0x171aa5){return _0x171aa5[_0x3ba1('0x27')](_0x1e44b8)[_0x3ba1('0x28')](function(_0x2c505e){return _0x2c505e;});}return null;};}function removeEntity(_0x29977f,_0x2f5044){return function(_0x5975e6){if(_0x5975e6){return _0x5975e6[_0x3ba1('0x29')]()[_0x3ba1('0x28')](function(){var _0x4a4767=_0x5975e6[_0x3ba1('0x2a')]({'plain':!![]});var _0x5bf9e3='MailQueues';return db[_0x3ba1('0x2b')][_0x3ba1('0x29')]({'where':{'type':_0x5bf9e3,'resourceId':_0x4a4767['id']}})[_0x3ba1('0x28')](function(){return _0x5975e6;});})[_0x3ba1('0x28')](function(){_0x29977f[_0x3ba1('0x1e')](0xcc)[_0x3ba1('0x1f')]();});}};}function handleEntityNotFound(_0x2a7b9d,_0x5bdd86){return function(_0x14c302){if(!_0x14c302){_0x2a7b9d[_0x3ba1('0x1d')](0x194);}return _0x14c302;};}function handleError(_0x45b74b,_0x24000d){_0x24000d=_0x24000d||0x1f4;return function(_0x4adc55){logger[_0x3ba1('0x2c')](_0x4adc55[_0x3ba1('0x2d')]);if(_0x4adc55[_0x3ba1('0x2e')]){delete _0x4adc55[_0x3ba1('0x2e')];}_0x45b74b[_0x3ba1('0x1e')](_0x24000d)['send'](_0x4adc55);};}exports[_0x3ba1('0x2f')]=function(_0x3b1c02,_0x475efe){var _0x12a3ee={},_0x3855e2={},_0x4c9442={'count':0x0,'rows':[]};var _0x45621f=_[_0x3ba1('0x30')](db['MailQueue']['rawAttributes'],function(_0x130596){return{'name':_0x130596['fieldName'],'type':_0x130596[_0x3ba1('0x31')]['key']};});_0x3855e2[_0x3ba1('0x32')]=_[_0x3ba1('0x30')](_0x45621f,_0x3ba1('0x2e'));_0x3855e2[_0x3ba1('0x33')]=_[_0x3ba1('0x34')](_0x3b1c02['query']);_0x3855e2['filters']=_[_0x3ba1('0x35')](_0x3855e2[_0x3ba1('0x32')],_0x3855e2[_0x3ba1('0x33')]);_0x12a3ee[_0x3ba1('0x36')]=_[_0x3ba1('0x35')](_0x3855e2[_0x3ba1('0x32')],qs[_0x3ba1('0x37')](_0x3b1c02[_0x3ba1('0x33')]['fields']));_0x12a3ee[_0x3ba1('0x36')]=_0x12a3ee[_0x3ba1('0x36')][_0x3ba1('0x38')]?_0x12a3ee[_0x3ba1('0x36')]:_0x3855e2[_0x3ba1('0x32')];if(!_0x3b1c02[_0x3ba1('0x33')]['hasOwnProperty']('nolimit')){_0x12a3ee['limit']=qs[_0x3ba1('0x21')](_0x3b1c02[_0x3ba1('0x33')][_0x3ba1('0x21')]);_0x12a3ee[_0x3ba1('0x20')]=qs[_0x3ba1('0x20')](_0x3b1c02['query'][_0x3ba1('0x20')]);}_0x12a3ee[_0x3ba1('0x39')]=qs['sort'](_0x3b1c02[_0x3ba1('0x33')]['sort']);_0x12a3ee[_0x3ba1('0x3a')]=qs['filters'](_[_0x3ba1('0x3b')](_0x3b1c02[_0x3ba1('0x33')],_0x3855e2[_0x3ba1('0x3c')]),_0x45621f);if(_0x3b1c02[_0x3ba1('0x33')][_0x3ba1('0x3d')]){_0x12a3ee['where']=_[_0x3ba1('0x3e')](_0x12a3ee[_0x3ba1('0x3a')],{'$or':_[_0x3ba1('0x30')](_0x45621f,function(_0x487443){if(_0x487443[_0x3ba1('0x31')]!==_0x3ba1('0x3f')){var _0x15911e={};_0x15911e[_0x487443[_0x3ba1('0x2e')]]={'$like':'%'+_0x3b1c02['query']['filter']+'%'};return _0x15911e;}})});}_0x12a3ee=_[_0x3ba1('0x3e')]({},_0x12a3ee,_0x3b1c02[_0x3ba1('0x40')]);var _0x409819={'where':_0x12a3ee[_0x3ba1('0x3a')]};return db[_0x3ba1('0x41')][_0x3ba1('0x42')](_0x409819)[_0x3ba1('0x28')](function(_0x1085e8){_0x4c9442[_0x3ba1('0x42')]=_0x1085e8;if(_0x3b1c02[_0x3ba1('0x33')][_0x3ba1('0x43')]){_0x12a3ee[_0x3ba1('0x44')]=[{'all':!![]}];}return db[_0x3ba1('0x41')][_0x3ba1('0x45')](_0x12a3ee);})[_0x3ba1('0x28')](function(_0x417058){_0x4c9442[_0x3ba1('0x46')]=_0x417058;return _0x4c9442;})[_0x3ba1('0x28')](respondWithFilteredResult(_0x475efe,_0x12a3ee))['catch'](handleError(_0x475efe,null));};exports[_0x3ba1('0x47')]=function(_0x357169,_0x26d397){var _0x28269a={'raw':!![],'where':{'id':_0x357169[_0x3ba1('0x48')]['id']}},_0x3024dc={};_0x3024dc[_0x3ba1('0x32')]=_['keys'](db[_0x3ba1('0x41')][_0x3ba1('0x49')]);_0x3024dc[_0x3ba1('0x33')]=_['keys'](_0x357169['query']);_0x3024dc[_0x3ba1('0x3c')]=_['intersection'](_0x3024dc[_0x3ba1('0x32')],_0x3024dc['query']);_0x28269a['attributes']=_[_0x3ba1('0x35')](_0x3024dc[_0x3ba1('0x32')],qs[_0x3ba1('0x37')](_0x357169[_0x3ba1('0x33')][_0x3ba1('0x37')]));_0x28269a[_0x3ba1('0x36')]=_0x28269a[_0x3ba1('0x36')][_0x3ba1('0x38')]?_0x28269a[_0x3ba1('0x36')]:_0x3024dc[_0x3ba1('0x32')];if(_0x357169['query'][_0x3ba1('0x43')]){_0x28269a[_0x3ba1('0x44')]=[{'all':!![]}];}_0x28269a=_[_0x3ba1('0x3e')]({},_0x28269a,_0x357169[_0x3ba1('0x40')]);return db[_0x3ba1('0x41')][_0x3ba1('0x4a')](_0x28269a)[_0x3ba1('0x28')](handleEntityNotFound(_0x26d397,null))['then'](respondWithResult(_0x26d397,null))[_0x3ba1('0x4b')](handleError(_0x26d397,null));};exports['create']=function(_0xa73062,_0x3960d5){return db[_0x3ba1('0x41')]['create'](_0xa73062[_0x3ba1('0x4c')],{})[_0x3ba1('0x28')](function(_0x951ffb){var _0x5d8855=_0xa73062[_0x3ba1('0x4d')]['get']({'plain':!![]});if(!_0x5d8855)throw new Error(_0x3ba1('0x4e'));if(_0x5d8855[_0x3ba1('0x4f')]===_0x3ba1('0x4d')){var _0x557ad6=_0x951ffb[_0x3ba1('0x2a')]({'plain':!![]});var _0x3e594a=_0x3ba1('0x50');return db[_0x3ba1('0x51')][_0x3ba1('0x4a')]({'where':{'name':_0x3e594a,'userProfileId':_0x5d8855[_0x3ba1('0x52')]},'raw':!![]})[_0x3ba1('0x28')](function(_0x324852){if(_0x324852&&_0x324852[_0x3ba1('0x53')]===0x0){return db[_0x3ba1('0x2b')][_0x3ba1('0x54')]({'name':_0x557ad6[_0x3ba1('0x2e')],'resourceId':_0x557ad6['id'],'type':_0x324852[_0x3ba1('0x2e')],'sectionId':_0x324852['id']},{})[_0x3ba1('0x28')](function(){return _0x951ffb;});}else{return _0x951ffb;}})[_0x3ba1('0x4b')](function(_0x2f09ad){logger[_0x3ba1('0x2c')](_0x3ba1('0x55'),_0x2f09ad);throw _0x2f09ad;});}return _0x951ffb;})[_0x3ba1('0x28')](respondWithResult(_0x3960d5,0xc9))[_0x3ba1('0x4b')](handleError(_0x3960d5,null));};exports['update']=function(_0x384d4f,_0xc039fe){if(_0x384d4f['body']['id']){delete _0x384d4f[_0x3ba1('0x4c')]['id'];}return db[_0x3ba1('0x41')][_0x3ba1('0x4a')]({'where':{'id':_0x384d4f[_0x3ba1('0x48')]['id']}})[_0x3ba1('0x28')](handleEntityNotFound(_0xc039fe,null))['then'](saveUpdates(_0x384d4f[_0x3ba1('0x4c')],null))['then'](respondWithResult(_0xc039fe,null))['catch'](handleError(_0xc039fe,null));};exports['destroy']=function(_0x34f226,_0x4859e0){return db['MailQueue']['find']({'where':{'id':_0x34f226[_0x3ba1('0x48')]['id']}})['then'](handleEntityNotFound(_0x4859e0,null))[_0x3ba1('0x28')](removeEntity(_0x4859e0,null))['catch'](handleError(_0x4859e0,null));};exports[_0x3ba1('0x56')]=function(_0x3d5b1f,_0x4ace7e){return db[_0x3ba1('0x41')][_0x3ba1('0x56')]()[_0x3ba1('0x28')](respondWithResult(_0x4ace7e,null))[_0x3ba1('0x4b')](handleError(_0x4ace7e,null));};exports[_0x3ba1('0x57')]=function(_0x3d1c3a,_0x190af1,_0x2dc744){var _0x2ba261={'raw':!![],'where':{}},_0x25913f={},_0x5c0249;return db[_0x3ba1('0x41')]['findOne']({'where':{'id':_0x3d1c3a[_0x3ba1('0x48')]['id']}})[_0x3ba1('0x28')](handleEntityNotFound(_0x190af1,null))[_0x3ba1('0x28')](function(_0x46dd04){if(_0x46dd04){_0x5c0249=_0x46dd04[_0x3ba1('0x2a')]({'plain':!![]});_0x25913f['model']=_[_0x3ba1('0x34')](db[_0x3ba1('0x58')]['rawAttributes']);_0x25913f['query']=_[_0x3ba1('0x34')](_0x3d1c3a[_0x3ba1('0x33')]);_0x25913f['filters']=_[_0x3ba1('0x35')](_0x25913f[_0x3ba1('0x32')],_0x25913f[_0x3ba1('0x33')]);_0x2ba261['attributes']=_[_0x3ba1('0x35')](_0x25913f[_0x3ba1('0x32')],qs['fields'](_0x3d1c3a[_0x3ba1('0x33')][_0x3ba1('0x37')]));_0x2ba261[_0x3ba1('0x36')]=_0x2ba261[_0x3ba1('0x36')][_0x3ba1('0x38')]?_0x2ba261['attributes']:_0x25913f[_0x3ba1('0x32')];if(!_0x3d1c3a[_0x3ba1('0x33')]['hasOwnProperty'](_0x3ba1('0x59'))){_0x2ba261[_0x3ba1('0x21')]=qs[_0x3ba1('0x21')](_0x3d1c3a[_0x3ba1('0x33')][_0x3ba1('0x21')]);_0x2ba261[_0x3ba1('0x20')]=qs[_0x3ba1('0x20')](_0x3d1c3a[_0x3ba1('0x33')]['offset']);}_0x2ba261['order']=qs['sort'](_0x3d1c3a['query'][_0x3ba1('0x5a')]);_0x2ba261[_0x3ba1('0x3a')]=qs['filters'](_[_0x3ba1('0x3b')](_0x3d1c3a[_0x3ba1('0x33')],_0x25913f[_0x3ba1('0x3c')]));_0x2ba261['where'][_0x3ba1('0x5b')]=_0x46dd04['id'];if(_0x3d1c3a[_0x3ba1('0x33')][_0x3ba1('0x3d')]){_0x2ba261[_0x3ba1('0x3a')]=_[_0x3ba1('0x3e')](_0x2ba261[_0x3ba1('0x3a')],{'$or':_[_0x3ba1('0x30')](_0x2ba261[_0x3ba1('0x36')],function(_0x4cbb2f){var _0x1a50ae={};_0x1a50ae[_0x4cbb2f]={'$like':'%'+_0x3d1c3a[_0x3ba1('0x33')]['filter']+'%'};return _0x1a50ae;})});}_0x2ba261=_[_0x3ba1('0x3e')]({},_0x2ba261,_0x3d1c3a[_0x3ba1('0x40')]);return db[_0x3ba1('0x58')][_0x3ba1('0x45')](_0x2ba261);}})[_0x3ba1('0x28')](function(_0x4fa47b){if(_0x4fa47b){return db[_0x3ba1('0x5c')][_0x3ba1('0x5d')]({'where':{'id':_['map'](_0x4fa47b,'UserId'),'role':_0x3ba1('0x5e')},'attributes':['id',_0x3ba1('0x2e'),'mailPause',_0x3ba1('0x5f'),_0x3ba1('0x60')]});}})[_0x3ba1('0x28')](function(_0x29f583){if(_0x29f583){return{'count':_0x29f583['count'],'rows':_[_0x3ba1('0x30')](_0x29f583['rows'],function(_0x16a817){return{'membername':_0x16a817[_0x3ba1('0x2e')],'UserId':_0x16a817['id'],'queue_name':_0x5c0249[_0x3ba1('0x2e')],'MailQueueId':_0x5c0249['id'],'interface':util[_0x3ba1('0x61')](_0x3ba1('0x62'),_0x3ba1('0x63'),_0x16a817[_0x3ba1('0x2e')]),'penalty':0x0,'paused':_0x16a817[_0x3ba1('0x64')],'createdAt':_0x16a817[_0x3ba1('0x60')],'updatedAt':_0x16a817[_0x3ba1('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3ba1('0x28')](respondWithFilteredResult(_0x190af1,_0x2ba261))[_0x3ba1('0x4b')](handleError(_0x190af1,null));};exports['getTeams']=function(_0x49c3dc,_0x2aac59,_0x1367a6){var _0x2ebb07={};var _0x317066={};var _0x458475;var _0x4d56d3;return db['MailQueue']['findOne']({'where':{'id':_0x49c3dc[_0x3ba1('0x48')]['id']}})[_0x3ba1('0x28')](handleEntityNotFound(_0x2aac59,null))[_0x3ba1('0x28')](function(_0x33e9c8){if(_0x33e9c8){_0x458475=_0x33e9c8;_0x317066['model']=_[_0x3ba1('0x34')](db[_0x3ba1('0x65')][_0x3ba1('0x49')]);_0x317066['query']=_[_0x3ba1('0x34')](_0x49c3dc['query']);_0x317066[_0x3ba1('0x3c')]=_[_0x3ba1('0x35')](_0x317066[_0x3ba1('0x32')],_0x317066[_0x3ba1('0x33')]);_0x2ebb07[_0x3ba1('0x36')]=_[_0x3ba1('0x35')](_0x317066[_0x3ba1('0x32')],qs['fields'](_0x49c3dc['query'][_0x3ba1('0x37')]));_0x2ebb07[_0x3ba1('0x36')]=_0x2ebb07['attributes'][_0x3ba1('0x38')]?_0x2ebb07['attributes']:_0x317066[_0x3ba1('0x32')];_0x2ebb07['order']=qs[_0x3ba1('0x5a')](_0x49c3dc[_0x3ba1('0x33')][_0x3ba1('0x5a')]);_0x2ebb07[_0x3ba1('0x3a')]=qs['filters'](_[_0x3ba1('0x3b')](_0x49c3dc[_0x3ba1('0x33')],_0x317066[_0x3ba1('0x3c')]));if(_0x49c3dc[_0x3ba1('0x33')][_0x3ba1('0x3d')]){_0x2ebb07[_0x3ba1('0x3a')]=_[_0x3ba1('0x3e')](_0x2ebb07['where'],{'$or':_[_0x3ba1('0x30')](_0x2ebb07['attributes'],function(_0xbd3f10){var _0x4a49b5={};_0x4a49b5[_0xbd3f10]={'$like':'%'+_0x49c3dc['query'][_0x3ba1('0x3d')]+'%'};return _0x4a49b5;})});}_0x2ebb07=_[_0x3ba1('0x3e')]({},_0x2ebb07,_0x49c3dc[_0x3ba1('0x40')]);return _0x458475[_0x3ba1('0x66')](_0x2ebb07);}})['then'](function(_0x9b2bc3){if(_0x9b2bc3){_0x4d56d3=_0x9b2bc3['length'];if(!_0x49c3dc['query']['hasOwnProperty'](_0x3ba1('0x59'))){_0x2ebb07[_0x3ba1('0x21')]=qs[_0x3ba1('0x21')](_0x49c3dc[_0x3ba1('0x33')]['limit']);_0x2ebb07['offset']=qs['offset'](_0x49c3dc[_0x3ba1('0x33')]['offset']);}return _0x458475[_0x3ba1('0x66')](_0x2ebb07);}})[_0x3ba1('0x28')](function(_0x1bfd01){if(_0x1bfd01){return _0x1bfd01?{'count':_0x4d56d3,'rows':_0x1bfd01}:null;}})['then'](respondWithResult(_0x2aac59,null))[_0x3ba1('0x4b')](handleError(_0x2aac59,null));};exports['addTeams']=function(_0x575a55,_0x2cd77e,_0x362252){var _0x58f6a0=_0x575a55[_0x3ba1('0x4c')][_0x3ba1('0x67')];return db[_0x3ba1('0x65')][_0x3ba1('0x45')]({'where':{'id':_0x58f6a0},'attributes':['id'],'include':[{'model':db[_0x3ba1('0x5c')],'as':_0x3ba1('0x68'),'attributes':['id',_0x3ba1('0x2e'),'online',_0x3ba1('0x69'),_0x3ba1('0x6a')],'raw':!![]}]})[_0x3ba1('0x28')](function(_0x308cc5){if(_0x308cc5){var _0x478875=_['flatMap'](_0x308cc5,function(_0x178070){var _0x5e9eff=_0x178070[_0x3ba1('0x2a')]({'plain':!![]});return _0x5e9eff[_0x3ba1('0x68')];});return db[_0x3ba1('0x41')][_0x3ba1('0x4a')]({'where':{'id':_0x575a55[_0x3ba1('0x48')]['id']}})['then'](function(_0x1a519c){return db[_0x3ba1('0x6b')][_0x3ba1('0x6c')](function(_0x55d1b9){return _0x1a519c[_0x3ba1('0x6d')](_0x58f6a0,{'transaction':_0x55d1b9})['then'](function(){return BPromise[_0x3ba1('0x6e')](_0x478875,function(_0x106abb){return db[_0x3ba1('0x58')][_0x3ba1('0x6f')]({'where':{'UserId':_0x106abb['id'],'MailQueueId':_0x575a55[_0x3ba1('0x48')]['id']},'transaction':_0x55d1b9});});})[_0x3ba1('0x28')](function(){_0x478875[_0x3ba1('0x70')](function(_0x4c47e4){socket[_0x3ba1('0x71')](_0x3ba1('0x72'),{'UserId':_0x4c47e4['id'],'MailQueueId':_0x1a519c['id']});});});});});}})['then'](respondWithStatusCode(_0x2cd77e,null))[_0x3ba1('0x4b')](handleError(_0x2cd77e,null));};exports[_0x3ba1('0x73')]=function(_0x3b67c8,_0x385860,_0x5d0a61){return db[_0x3ba1('0x65')][_0x3ba1('0x45')]({'where':{'id':_0x3b67c8[_0x3ba1('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3ba1('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x385860,null))[_0x3ba1('0x28')](function(_0x5378c1){var _0xeb65ef=_[_0x3ba1('0x30')](_0x5378c1,'id');var _0x1d19e4=[];var _0x51b2b8=[];var _0x40d0ac=squel[_0x3ba1('0x74')]();_0x40d0ac['field'](_0x3ba1('0x75'))['from'](_0x3ba1('0x76'),'tq')['join']('user_has_teams','ut',_0x3ba1('0x77'))[_0x3ba1('0x3a')]('MailQueueId\x20=\x20?',_0x3b67c8['params']['id']);for(var _0xec64bd=0x0;_0xec64bd<_0x5378c1[_0x3ba1('0x38')];_0xec64bd+=0x1){let _0x231619=_0x5378c1[_0xec64bd];for(var _0x1ba480=0x0;_0x1ba480<_0x231619['Agents']['length'];_0x1ba480+=0x1){let _0xac70ba=_0x231619['Agents'][_0x1ba480];var _0x1c3d58=_0x40d0ac['clone']();_0x1c3d58[_0x3ba1('0x3a')](_0x3ba1('0x78'),_0xac70ba['id']);_0x51b2b8[_0x3ba1('0x79')](db[_0x3ba1('0x6b')][_0x3ba1('0x33')](_0x1c3d58[_0x3ba1('0x7a')](),{'type':db[_0x3ba1('0x6b')]['QueryTypes'][_0x3ba1('0x7b')]})[_0x3ba1('0x28')](function(_0x35ec07){if(_0x35ec07[_0x3ba1('0x38')]===0x1){return _0xac70ba['id'];}else{var _0x5539e9=_[_0x3ba1('0x7c')](_['map'](_0x35ec07,_0x3ba1('0x7d')),function(_0xaf064){return _[_0x3ba1('0x7e')](_0xeb65ef,_0xaf064);});if(_0x5539e9){return _0xac70ba['id'];}}}));}}return BPromise[_0x3ba1('0x7f')](_0x51b2b8)[_0x3ba1('0x28')](function(_0x401534){_0x1d19e4=_(_0x1d19e4)[_0x3ba1('0x80')](_0x401534)[_0x3ba1('0x81')]()[_0x3ba1('0x82')]();return db[_0x3ba1('0x41')][_0x3ba1('0x4a')]({'where':{'id':_0x3b67c8['params']['id']}})[_0x3ba1('0x28')](function(_0x138ac0){return db[_0x3ba1('0x6b')][_0x3ba1('0x6c')](function(_0x513953){return _0x138ac0[_0x3ba1('0x73')](_0x3b67c8[_0x3ba1('0x33')][_0x3ba1('0x67')],{'transaction':_0x513953})[_0x3ba1('0x28')](function(){if(!_[_0x3ba1('0x83')](_0x1d19e4)){return _0x138ac0['removeAgents'](_0x1d19e4,{'transaction':_0x513953});}})['then'](function(){_0x1d19e4[_0x3ba1('0x70')](function(_0x2468c5){socket[_0x3ba1('0x71')]('userMailQueue:remove',{'UserId':_0x2468c5,'MailQueueId':_0x138ac0['id']});});});});});});})[_0x3ba1('0x28')](respondWithStatusCode(_0x385860,null))[_0x3ba1('0x4b')](handleError(_0x385860,null));};exports[_0x3ba1('0x84')]=function(_0x49e404,_0x12ded4,_0x257b07){return db[_0x3ba1('0x41')][_0x3ba1('0x4a')]({'where':{'id':_0x49e404[_0x3ba1('0x48')]['id']}})[_0x3ba1('0x28')](handleEntityNotFound(_0x12ded4,null))[_0x3ba1('0x28')](function(_0x2acfdc){if(_0x2acfdc){return _0x2acfdc[_0x3ba1('0x84')](_0x49e404['body'][_0x3ba1('0x67')],_[_0x3ba1('0x85')](_0x49e404[_0x3ba1('0x4c')],[_0x3ba1('0x67'),'id'])||{})['spread'](function(_0x424e6a){for(var _0x5a28c0=0x0;_0x5a28c0<_0x49e404['body'][_0x3ba1('0x67')][_0x3ba1('0x38')];_0x5a28c0+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x49e404[_0x3ba1('0x4c')][_0x3ba1('0x67')][_0x5a28c0],'MailQueueId':_0x49e404[_0x3ba1('0x48')]['id']});}return _0x424e6a;});}})[_0x3ba1('0x28')](respondWithResult(_0x12ded4,null))[_0x3ba1('0x4b')](handleError(_0x12ded4,null));};exports['removeAgents']=function(_0x2f28b9,_0xa7ab77,_0x1b0945){return db[_0x3ba1('0x41')][_0x3ba1('0x4a')]({'where':{'id':_0x2f28b9[_0x3ba1('0x48')]['id']}})['then'](handleEntityNotFound(_0xa7ab77,null))[_0x3ba1('0x28')](function(_0x2a34a5){if(_0x2a34a5){return _0x2a34a5[_0x3ba1('0x86')](_0x2f28b9[_0x3ba1('0x33')][_0x3ba1('0x67')])['then'](function(){if(_[_0x3ba1('0x87')](_0x2f28b9[_0x3ba1('0x33')][_0x3ba1('0x67')])){for(var _0xff2162=0x0;_0xff2162<_0x2f28b9[_0x3ba1('0x33')][_0x3ba1('0x67')][_0x3ba1('0x38')];_0xff2162+=0x1){socket[_0x3ba1('0x71')](_0x3ba1('0x88'),{'UserId':Number(_0x2f28b9[_0x3ba1('0x33')]['ids'][_0xff2162]),'MailQueueId':Number(_0x2f28b9[_0x3ba1('0x48')]['id'])});}}else{socket[_0x3ba1('0x71')](_0x3ba1('0x88'),{'UserId':Number(_0x2f28b9[_0x3ba1('0x33')]['ids']),'MailQueueId':Number(_0x2f28b9[_0x3ba1('0x48')]['id'])});}});}})[_0x3ba1('0x28')](respondWithStatusCode(_0xa7ab77,null))[_0x3ba1('0x4b')](handleError(_0xa7ab77,null));};exports['getAgents']=function(_0xba38f7,_0x11c945,_0xfaec75){var _0x4ba32c={};var _0x39c418={};var _0x2cf774;var _0x3b2e72;return db[_0x3ba1('0x41')][_0x3ba1('0x89')]({'where':{'id':_0xba38f7[_0x3ba1('0x48')]['id']}})[_0x3ba1('0x28')](handleEntityNotFound(_0x11c945,null))['then'](function(_0x48155d){if(_0x48155d){_0x2cf774=_0x48155d;_0x39c418[_0x3ba1('0x32')]=_[_0x3ba1('0x34')](db[_0x3ba1('0x5c')]['rawAttributes']);_0x39c418[_0x3ba1('0x33')]=_['keys'](_0xba38f7['query']);_0x39c418[_0x3ba1('0x3c')]=_['intersection'](_0x39c418[_0x3ba1('0x32')],_0x39c418['query']);_0x4ba32c[_0x3ba1('0x36')]=_[_0x3ba1('0x35')](_0x39c418[_0x3ba1('0x32')],qs[_0x3ba1('0x37')](_0xba38f7['query'][_0x3ba1('0x37')]));_0x4ba32c[_0x3ba1('0x36')]=_0x4ba32c[_0x3ba1('0x36')][_0x3ba1('0x38')]?_0x4ba32c[_0x3ba1('0x36')]:_0x39c418[_0x3ba1('0x32')];_0x4ba32c[_0x3ba1('0x39')]=qs[_0x3ba1('0x5a')](_0xba38f7[_0x3ba1('0x33')][_0x3ba1('0x5a')]);_0x4ba32c['where']=qs[_0x3ba1('0x3c')](_[_0x3ba1('0x3b')](_0xba38f7[_0x3ba1('0x33')],_0x39c418['filters']));if(_0xba38f7[_0x3ba1('0x33')][_0x3ba1('0x3d')]){_0x4ba32c[_0x3ba1('0x3a')]=_[_0x3ba1('0x3e')](_0x4ba32c[_0x3ba1('0x3a')],{'$or':_[_0x3ba1('0x30')](_0x4ba32c[_0x3ba1('0x36')],function(_0x14984c){var _0x38fcc6={};_0x38fcc6[_0x14984c]={'$like':'%'+_0xba38f7[_0x3ba1('0x33')][_0x3ba1('0x3d')]+'%'};return _0x38fcc6;})});}_0x4ba32c=_[_0x3ba1('0x3e')]({},_0x4ba32c,_0xba38f7[_0x3ba1('0x40')]);return _0x2cf774[_0x3ba1('0x8a')](_0x4ba32c);}})[_0x3ba1('0x28')](function(_0x1a9e73){if(_0x1a9e73){_0x3b2e72=_0x1a9e73[_0x3ba1('0x38')];if(!_0xba38f7['query'][_0x3ba1('0x8b')](_0x3ba1('0x59'))){_0x4ba32c[_0x3ba1('0x21')]=qs[_0x3ba1('0x21')](_0xba38f7['query'][_0x3ba1('0x21')]);_0x4ba32c[_0x3ba1('0x20')]=qs[_0x3ba1('0x20')](_0xba38f7[_0x3ba1('0x33')]['offset']);}return _0x2cf774[_0x3ba1('0x8a')](_0x4ba32c);}})[_0x3ba1('0x28')](function(_0x490785){if(_0x490785){return _0x490785?{'count':_0x3b2e72,'rows':_0x490785}:null;}})[_0x3ba1('0x28')](respondWithResult(_0x11c945,null))[_0x3ba1('0x4b')](handleError(_0x11c945,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 672f767..ab2fa1c 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 _0xe5ae=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x384914,_0x636727){var _0x351eac=function(_0x398a0b){while(--_0x398a0b){_0x384914['push'](_0x384914['shift']());}};_0x351eac(++_0x636727);}(_0xe5ae,0x15e));var _0xee5a=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0xe5ae[_0x5ca52d];return _0x89e54e;};'use strict';var EventEmitter=require(_0xee5a('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xee5a('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xee5a('0x2')](0x0);var events={'afterCreate':_0xee5a('0x3'),'afterUpdate':_0xee5a('0x4'),'afterDestroy':_0xee5a('0x5')};function emitEvent(_0xdd6f1d){return function(_0x417ff4,_0x1e3d55,_0x4dd907){MailQueueEvents['emit'](_0xdd6f1d+':'+_0x417ff4['id'],_0x417ff4);MailQueueEvents[_0xee5a('0x6')](_0xdd6f1d,_0x417ff4);_0x4dd907(null);};}for(var e in events){if(events[_0xee5a('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xee5a('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x83db=['MailQueue','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4e5dab,_0x580479){var _0x3d5dc4=function(_0x3c704e){while(--_0x3c704e){_0x4e5dab['push'](_0x4e5dab['shift']());}};_0x3d5dc4(++_0x580479);}(_0x83db,0x13f));var _0xb83d=function(_0x87c2fc,_0x4fe84a){_0x87c2fc=_0x87c2fc-0x0;var _0x36b6e2=_0x83db[_0x87c2fc];return _0x36b6e2;};'use strict';var EventEmitter=require(_0xb83d('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xb83d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb83d('0x2'),'afterDestroy':_0xb83d('0x3')};function emitEvent(_0x3f3438){return function(_0x17ac8a,_0x32e6c3,_0x4f6bda){MailQueueEvents[_0xb83d('0x4')](_0x3f3438+':'+_0x17ac8a['id'],_0x17ac8a);MailQueueEvents[_0xb83d('0x4')](_0x3f3438,_0x17ac8a);_0x4f6bda(null);};}for(var e in events){if(events[_0xb83d('0x5')](e)){var event=events[e];MailQueue[_0xb83d('0x6')](e,emitEvent(event));}}module[_0xb83d('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f056962..d908d8e 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 _0x7948=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x582966,_0x1c94ed){var _0x278f6c=function(_0x1d0c50){while(--_0x1d0c50){_0x582966['push'](_0x582966['shift']());}};_0x278f6c(++_0x1c94ed);}(_0x7948,0x121));var _0x8794=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x7948[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0x8794('0x0'));var util=require(_0x8794('0x1'));var logger=require(_0x8794('0x2'))(_0x8794('0x3'));var moment=require(_0x8794('0x4'));var BPromise=require(_0x8794('0x5'));var rp=require(_0x8794('0x6'));var fs=require('fs');var path=require(_0x8794('0x7'));var rimraf=require(_0x8794('0x8'));var config=require(_0x8794('0x9'));var attributes=require(_0x8794('0xa'));module[_0x8794('0xb')]=function(_0x431a0b,_0x58762a){return _0x431a0b[_0x8794('0xc')](_0x8794('0xd'),attributes,{'tableName':_0x8794('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x619f=['request-promise','rimraf','exports','define','MailQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x544e40,_0x41cb21){var _0x5b6d6b=function(_0x20cfb8){while(--_0x20cfb8){_0x544e40['push'](_0x544e40['shift']());}};_0x5b6d6b(++_0x41cb21);}(_0x619f,0x9f));var _0xf619=function(_0xe4e60e,_0x34c04d){_0xe4e60e=_0xe4e60e-0x0;var _0x4b113d=_0x619f[_0xe4e60e];return _0x4b113d;};'use strict';var _=require(_0xf619('0x0'));var util=require(_0xf619('0x1'));var logger=require(_0xf619('0x2'))(_0xf619('0x3'));var moment=require(_0xf619('0x4'));var BPromise=require(_0xf619('0x5'));var rp=require(_0xf619('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf619('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xf619('0x8')]=function(_0x1e94ec,_0x12330a){return _0x1e94ec[_0xf619('0x9')](_0xf619('0xa'),attributes,{'tableName':'mail_queues','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 dc68856..2c1a3c1 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 _0xb04b=['where','options','attributes','limit','include','map','model','find','ShowMailQueue','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','debug','stringify','error','message','result','GetMailQueue','MailQueue','findAll','raw'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb04b,0xa2));var _0xbb04=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb04b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xbb04('0x0'));var moment=require(_0xbb04('0x1'));var BPromise=require(_0xbb04('0x2'));var rs=require(_0xbb04('0x3'));var fs=require('fs');var Redis=require(_0xbb04('0x4'));var db=require(_0xbb04('0x5'))['db'];var utils=require(_0xbb04('0x6'));var logger=require(_0xbb04('0x7'))(_0xbb04('0x8'));var config=require('../../config/environment');var jayson=require(_0xbb04('0x9'));var client=jayson[_0xbb04('0xa')]['http']({'port':0x232a});config[_0xbb04('0xb')]=_[_0xbb04('0xc')](config['redis'],{'host':_0xbb04('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbb04('0xe'))['register'](socket);function respondWithRpcPromise(_0x458da6,_0x2cabf8,_0x158d4b){return new BPromise(function(_0x5035cf,_0x4778e3){return client[_0xbb04('0xf')](_0x458da6,_0x158d4b)[_0xbb04('0x10')](function(_0x5b6127){logger[_0xbb04('0x11')](_0xbb04('0x12'),_0x2cabf8,'request\x20sent');logger[_0xbb04('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2cabf8,'request\x20sent',JSON[_0xbb04('0x14')](_0x5b6127));if(_0x5b6127[_0xbb04('0x15')]){if(_0x5b6127[_0xbb04('0x15')]['code']===0x1f4){logger[_0xbb04('0x15')](_0xbb04('0x12'),_0x2cabf8,_0x5b6127[_0xbb04('0x15')]['message']);return _0x4778e3(_0x5b6127[_0xbb04('0x15')][_0xbb04('0x16')]);}logger[_0xbb04('0x15')](_0xbb04('0x12'),_0x2cabf8,_0x5b6127[_0xbb04('0x15')][_0xbb04('0x16')]);return _0x5035cf(_0x5b6127[_0xbb04('0x15')][_0xbb04('0x16')]);}else{logger['info'](_0xbb04('0x12'),_0x2cabf8,'request\x20sent');_0x5035cf(_0x5b6127[_0xbb04('0x17')][_0xbb04('0x16')]);}})['catch'](function(_0x3d3b39){logger[_0xbb04('0x15')](_0xbb04('0x12'),_0x2cabf8,_0x3d3b39);_0x4778e3(_0x3d3b39);});});}exports[_0xbb04('0x18')]=function(_0x2f39d3){var _0x1406de=this;return new Promise(function(_0x533cc1,_0x3278ba){return db[_0xbb04('0x19')][_0xbb04('0x1a')]({'raw':_0x2f39d3['options']?_0x2f39d3['options'][_0xbb04('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f39d3['options']?_0x2f39d3['options'][_0xbb04('0x1c')]||null:null,'attributes':_0x2f39d3[_0xbb04('0x1d')]?_0x2f39d3[_0xbb04('0x1d')][_0xbb04('0x1e')]||null:null,'limit':_0x2f39d3[_0xbb04('0x1d')]?_0x2f39d3[_0xbb04('0x1d')][_0xbb04('0x1f')]||null:null,'include':_0x2f39d3[_0xbb04('0x1d')]?_0x2f39d3['options'][_0xbb04('0x20')]?_[_0xbb04('0x21')](_0x2f39d3[_0xbb04('0x1d')][_0xbb04('0x20')],function(_0x189be6){return{'model':db[_0x189be6[_0xbb04('0x22')]],'as':_0x189be6['as'],'attributes':_0x189be6[_0xbb04('0x1e')],'include':_0x189be6[_0xbb04('0x20')]?_[_0xbb04('0x21')](_0x189be6['include'],function(_0x527a0a){return{'model':db[_0x527a0a['model']],'as':_0x527a0a['as'],'attributes':_0x527a0a[_0xbb04('0x1e')],'include':_0x527a0a['include']?_[_0xbb04('0x21')](_0x527a0a[_0xbb04('0x20')],function(_0x23b285){return{'model':db[_0x23b285[_0xbb04('0x22')]],'as':_0x23b285['as'],'attributes':_0x23b285['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb04('0x10')](function(_0x28b9df){logger['info'](_0xbb04('0x18'),_0x2f39d3);logger[_0xbb04('0x13')](_0xbb04('0x18'),_0x2f39d3,JSON[_0xbb04('0x14')](_0x28b9df));_0x533cc1(_0x28b9df);})['catch'](function(_0x5202ba){logger['error'](_0xbb04('0x18'),_0x5202ba[_0xbb04('0x16')],_0x2f39d3);_0x3278ba(_0x1406de[_0xbb04('0x15')](0x1f4,_0x5202ba[_0xbb04('0x16')]));});});};exports['ShowMailQueue']=function(_0x590058){var _0x1c855d=this;return new Promise(function(_0x407196,_0x509633){return db[_0xbb04('0x19')][_0xbb04('0x23')]({'raw':_0x590058['options']?_0x590058[_0xbb04('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x590058[_0xbb04('0x1d')]?_0x590058[_0xbb04('0x1d')][_0xbb04('0x1c')]||null:null,'attributes':_0x590058[_0xbb04('0x1d')]?_0x590058['options']['attributes']||null:null,'include':_0x590058[_0xbb04('0x1d')]?_0x590058[_0xbb04('0x1d')]['include']?_[_0xbb04('0x21')](_0x590058[_0xbb04('0x1d')][_0xbb04('0x20')],function(_0x44bf6a){return{'model':db[_0x44bf6a[_0xbb04('0x22')]],'as':_0x44bf6a['as'],'attributes':_0x44bf6a[_0xbb04('0x1e')],'include':_0x44bf6a[_0xbb04('0x20')]?_[_0xbb04('0x21')](_0x44bf6a[_0xbb04('0x20')],function(_0x4bb0c0){return{'model':db[_0x4bb0c0[_0xbb04('0x22')]],'as':_0x4bb0c0['as'],'attributes':_0x4bb0c0[_0xbb04('0x1e')],'include':_0x4bb0c0[_0xbb04('0x20')]?_[_0xbb04('0x21')](_0x4bb0c0['include'],function(_0x127633){return{'model':db[_0x127633[_0xbb04('0x22')]],'as':_0x127633['as'],'attributes':_0x127633[_0xbb04('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbb04('0x10')](function(_0x261586){logger['info'](_0xbb04('0x24'),_0x590058);logger['debug']('ShowMailQueue',_0x590058,JSON[_0xbb04('0x14')](_0x261586));_0x407196(_0x261586);})[_0xbb04('0x25')](function(_0x1a1f89){logger[_0xbb04('0x15')](_0xbb04('0x24'),_0x1a1f89[_0xbb04('0x16')],_0x590058);_0x509633(_0x1c855d[_0xbb04('0x15')](0x1f4,_0x1a1f89[_0xbb04('0x16')]));});});}; \ No newline at end of file +var _0xb83f=['rpc','../../config/environment','client','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','findAll','options','raw','attributes','limit','include','map','model','GetMailQueue','stringify','catch','ShowMailQueue','MailQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xb83f,0x123));var _0xfb83=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb83f[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfb83('0x0'));var BPromise=require('bluebird');var rs=require(_0xfb83('0x1'));var fs=require('fs');var Redis=require(_0xfb83('0x2'));var db=require(_0xfb83('0x3'))['db'];var utils=require(_0xfb83('0x4'));var logger=require('../../config/logger')(_0xfb83('0x5'));var config=require(_0xfb83('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfb83('0x7')]['http']({'port':0x232a});config[_0xfb83('0x8')]=_[_0xfb83('0x9')](config[_0xfb83('0x8')],{'host':_0xfb83('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfb83('0xb'))[_0xfb83('0xc')](socket);function respondWithRpcPromise(_0x284b1a,_0xc18160,_0x567fa3){return new BPromise(function(_0xafa787,_0x44e1e7){return client[_0xfb83('0xd')](_0x284b1a,_0x567fa3)[_0xfb83('0xe')](function(_0x28b8d5){logger[_0xfb83('0xf')]('MailQueue,\x20%s,\x20%s',_0xc18160,_0xfb83('0x10'));logger[_0xfb83('0x11')](_0xfb83('0x12'),_0xc18160,_0xfb83('0x10'),JSON['stringify'](_0x28b8d5));if(_0x28b8d5[_0xfb83('0x13')]){if(_0x28b8d5[_0xfb83('0x13')][_0xfb83('0x14')]===0x1f4){logger[_0xfb83('0x13')](_0xfb83('0x15'),_0xc18160,_0x28b8d5['error'][_0xfb83('0x16')]);return _0x44e1e7(_0x28b8d5[_0xfb83('0x13')][_0xfb83('0x16')]);}logger[_0xfb83('0x13')](_0xfb83('0x15'),_0xc18160,_0x28b8d5[_0xfb83('0x13')][_0xfb83('0x16')]);return _0xafa787(_0x28b8d5[_0xfb83('0x13')]['message']);}else{logger[_0xfb83('0xf')](_0xfb83('0x15'),_0xc18160,_0xfb83('0x10'));_0xafa787(_0x28b8d5['result'][_0xfb83('0x16')]);}})['catch'](function(_0x63f144){logger[_0xfb83('0x13')]('MailQueue,\x20%s,\x20%s',_0xc18160,_0x63f144);_0x44e1e7(_0x63f144);});});}exports['GetMailQueue']=function(_0x30e8ba){var _0x466af2=this;return new Promise(function(_0xacd44e,_0x341802){return db['MailQueue'][_0xfb83('0x17')]({'raw':_0x30e8ba[_0xfb83('0x18')]?_0x30e8ba[_0xfb83('0x18')][_0xfb83('0x19')]===undefined?!![]:![]:!![],'where':_0x30e8ba[_0xfb83('0x18')]?_0x30e8ba[_0xfb83('0x18')]['where']||null:null,'attributes':_0x30e8ba['options']?_0x30e8ba[_0xfb83('0x18')][_0xfb83('0x1a')]||null:null,'limit':_0x30e8ba[_0xfb83('0x18')]?_0x30e8ba[_0xfb83('0x18')][_0xfb83('0x1b')]||null:null,'include':_0x30e8ba[_0xfb83('0x18')]?_0x30e8ba['options'][_0xfb83('0x1c')]?_[_0xfb83('0x1d')](_0x30e8ba['options'][_0xfb83('0x1c')],function(_0x2b8c42){return{'model':db[_0x2b8c42[_0xfb83('0x1e')]],'as':_0x2b8c42['as'],'attributes':_0x2b8c42['attributes'],'include':_0x2b8c42['include']?_[_0xfb83('0x1d')](_0x2b8c42['include'],function(_0x2b5a00){return{'model':db[_0x2b5a00[_0xfb83('0x1e')]],'as':_0x2b5a00['as'],'attributes':_0x2b5a00[_0xfb83('0x1a')],'include':_0x2b5a00['include']?_[_0xfb83('0x1d')](_0x2b5a00[_0xfb83('0x1c')],function(_0x30f5fe){return{'model':db[_0x30f5fe['model']],'as':_0x30f5fe['as'],'attributes':_0x30f5fe[_0xfb83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfb83('0xe')](function(_0x5e2e44){logger[_0xfb83('0xf')](_0xfb83('0x1f'),_0x30e8ba);logger[_0xfb83('0x11')]('GetMailQueue',_0x30e8ba,JSON[_0xfb83('0x20')](_0x5e2e44));_0xacd44e(_0x5e2e44);})[_0xfb83('0x21')](function(_0x5bb095){logger[_0xfb83('0x13')](_0xfb83('0x1f'),_0x5bb095[_0xfb83('0x16')],_0x30e8ba);_0x341802(_0x466af2[_0xfb83('0x13')](0x1f4,_0x5bb095[_0xfb83('0x16')]));});});};exports[_0xfb83('0x22')]=function(_0x5b2c8f){var _0x33213d=this;return new Promise(function(_0x5782eb,_0x1bc093){return db[_0xfb83('0x23')][_0xfb83('0x24')]({'raw':_0x5b2c8f[_0xfb83('0x18')]?_0x5b2c8f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b2c8f[_0xfb83('0x18')]?_0x5b2c8f[_0xfb83('0x18')]['where']||null:null,'attributes':_0x5b2c8f[_0xfb83('0x18')]?_0x5b2c8f[_0xfb83('0x18')][_0xfb83('0x1a')]||null:null,'include':_0x5b2c8f[_0xfb83('0x18')]?_0x5b2c8f[_0xfb83('0x18')][_0xfb83('0x1c')]?_[_0xfb83('0x1d')](_0x5b2c8f[_0xfb83('0x18')][_0xfb83('0x1c')],function(_0xe5483a){return{'model':db[_0xe5483a[_0xfb83('0x1e')]],'as':_0xe5483a['as'],'attributes':_0xe5483a['attributes'],'include':_0xe5483a[_0xfb83('0x1c')]?_[_0xfb83('0x1d')](_0xe5483a[_0xfb83('0x1c')],function(_0x5274f2){return{'model':db[_0x5274f2['model']],'as':_0x5274f2['as'],'attributes':_0x5274f2[_0xfb83('0x1a')],'include':_0x5274f2[_0xfb83('0x1c')]?_['map'](_0x5274f2['include'],function(_0x4e7c21){return{'model':db[_0x4e7c21['model']],'as':_0x4e7c21['as'],'attributes':_0x4e7c21[_0xfb83('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33e4ce){logger[_0xfb83('0xf')](_0xfb83('0x22'),_0x5b2c8f);logger[_0xfb83('0x11')](_0xfb83('0x22'),_0x5b2c8f,JSON[_0xfb83('0x20')](_0x33e4ce));_0x5782eb(_0x33e4ce);})[_0xfb83('0x21')](function(_0x4d4753){logger['error'](_0xfb83('0x22'),_0x4d4753[_0xfb83('0x16')],_0x5b2c8f);_0x1bc093(_0x33213d[_0xfb83('0x13')](0x1f4,_0x4d4753[_0xfb83('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 92ed9bc..f458107 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 _0xfd5e=['emit','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x5ced91,_0x26bc7d){var _0x3b84a0=function(_0x96f725){while(--_0x96f725){_0x5ced91['push'](_0x5ced91['shift']());}};_0x3b84a0(++_0x26bc7d);}(_0xfd5e,0x1d8));var _0xefd5=function(_0x30ae81,_0x1e8be1){_0x30ae81=_0x30ae81-0x0;var _0x34b4f1=_0xfd5e[_0x30ae81];return _0x34b4f1;};'use strict';var MailQueueEvents=require(_0xefd5('0x0'));var events=[_0xefd5('0x1'),_0xefd5('0x2'),_0xefd5('0x3')];function createListener(_0xf0af4b,_0x15b1e1){return function(_0x4162c9){_0x15b1e1[_0xefd5('0x4')](_0xf0af4b,_0x4162c9);};}function removeListener(_0x243707,_0xaa3cea){return function(){MailQueueEvents['removeListener'](_0x243707,_0xaa3cea);};}exports['register']=function(_0x375408){for(var _0x57fc12=0x0,_0x4c740d=events[_0xefd5('0x5')];_0x57fc12<_0x4c740d;_0x57fc12++){var _0x1be299=events[_0x57fc12];var _0x769a5f=createListener(_0xefd5('0x6')+_0x1be299,_0x375408);MailQueueEvents['on'](_0x1be299,_0x769a5f);}}; \ No newline at end of file +var _0x9550=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x397bf9,_0x20817d){var _0x3463c9=function(_0x3be6fa){while(--_0x3be6fa){_0x397bf9['push'](_0x397bf9['shift']());}};_0x3463c9(++_0x20817d);}(_0x9550,0x1cd));var _0x0955=function(_0x167c62,_0x191409){_0x167c62=_0x167c62-0x0;var _0x2b432d=_0x9550[_0x167c62];return _0x2b432d;};'use strict';var MailQueueEvents=require(_0x0955('0x0'));var events=[_0x0955('0x1'),_0x0955('0x2'),_0x0955('0x3')];function createListener(_0x484e7f,_0x480120){return function(_0x24167c){_0x480120[_0x0955('0x4')](_0x484e7f,_0x24167c);};}function removeListener(_0x2e45f4,_0x1136fa){return function(){MailQueueEvents[_0x0955('0x5')](_0x2e45f4,_0x1136fa);};}exports[_0x0955('0x6')]=function(_0x32ed10){for(var _0x1fdf3a=0x0,_0x2bdb14=events[_0x0955('0x7')];_0x1fdf3a<_0x2bdb14;_0x1fdf3a++){var _0x29f21d=events[_0x1fdf3a];var _0xadfe58=createListener(_0x0955('0x8')+_0x29f21d,_0x32ed10);MailQueueEvents['on'](_0x29f21d,_0xadfe58);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1b30b24..16d1325 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 _0x3926=['update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create'];(function(_0xdc7140,_0x4393f3){var _0x5ac096=function(_0x4fd7c4){while(--_0x4fd7c4){_0xdc7140['push'](_0xdc7140['shift']());}};_0x5ac096(++_0x4393f3);}(_0x3926,0xae));var _0x6392=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x3926[_0x543084];return _0x306a57;};'use strict';var multer=require(_0x6392('0x0'));var util=require('util');var path=require(_0x6392('0x1'));var timeout=require(_0x6392('0x2'));var express=require(_0x6392('0x3'));var router=express['Router']();var auth=require(_0x6392('0x4'));var interaction=require(_0x6392('0x5'));var config=require(_0x6392('0x6'));var controller=require(_0x6392('0x7'));router[_0x6392('0x8')]('/',auth['isAuthenticated'](),controller[_0x6392('0x9')]);router['get']('/describe',auth[_0x6392('0xa')](),controller[_0x6392('0xb')]);router[_0x6392('0x8')](_0x6392('0xc'),auth['isAuthenticated'](),controller[_0x6392('0xd')]);router[_0x6392('0xe')]('/',auth[_0x6392('0xa')](),controller[_0x6392('0xf')]);router['put'](_0x6392('0xc'),auth['isAuthenticated'](),controller[_0x6392('0x10')]);router[_0x6392('0x11')](_0x6392('0xc'),auth[_0x6392('0xa')](),controller['destroy']);module[_0x6392('0x12')]=router; \ No newline at end of file +var _0x8a7f=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x52ed03,_0xabbf65){var _0x5554d7=function(_0x44267a){while(--_0x44267a){_0x52ed03['push'](_0x52ed03['shift']());}};_0x5554d7(++_0xabbf65);}(_0x8a7f,0x19a));var _0xf8a7=function(_0x3db7a4,_0x48511b){_0x3db7a4=_0x3db7a4-0x0;var _0x41ec2e=_0x8a7f[_0x3db7a4];return _0x41ec2e;};'use strict';var multer=require(_0xf8a7('0x0'));var util=require(_0xf8a7('0x1'));var path=require(_0xf8a7('0x2'));var timeout=require(_0xf8a7('0x3'));var express=require(_0xf8a7('0x4'));var router=express['Router']();var auth=require(_0xf8a7('0x5'));var interaction=require(_0xf8a7('0x6'));var config=require(_0xf8a7('0x7'));var controller=require(_0xf8a7('0x8'));router[_0xf8a7('0x9')]('/',auth[_0xf8a7('0xa')](),controller[_0xf8a7('0xb')]);router[_0xf8a7('0x9')](_0xf8a7('0xc'),auth[_0xf8a7('0xa')](),controller[_0xf8a7('0xd')]);router[_0xf8a7('0x9')](_0xf8a7('0xe'),auth[_0xf8a7('0xa')](),controller[_0xf8a7('0xf')]);router[_0xf8a7('0x10')]('/',auth[_0xf8a7('0xa')](),controller[_0xf8a7('0x11')]);router[_0xf8a7('0x12')](_0xf8a7('0xe'),auth['isAuthenticated'](),controller[_0xf8a7('0x13')]);router[_0xf8a7('0x14')](_0xf8a7('0xe'),auth[_0xf8a7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 458e096..4cd83ca 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 _0xb351=['STRING','DATE','moment','sequelize','exports'];(function(_0x36a4ea,_0x4ac69e){var _0x344bcd=function(_0x183745){while(--_0x183745){_0x36a4ea['push'](_0x36a4ea['shift']());}};_0x344bcd(++_0x4ac69e);}(_0xb351,0xe3));var _0x1b35=function(_0x355335,_0x58095f){_0x355335=_0x355335-0x0;var _0x3048da=_0xb351[_0x355335];return _0x3048da;};'use strict';var moment=require(_0x1b35('0x0'));var Sequelize=require(_0x1b35('0x1'));module[_0x1b35('0x2')]={'uniqueid':{'type':Sequelize[_0x1b35('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1b35('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1b35('0x4')]},'acceptAt':{'type':Sequelize[_0x1b35('0x4')]},'exitAt':{'type':Sequelize[_0x1b35('0x4')]},'reason':{'type':Sequelize[_0x1b35('0x3')]}}; \ No newline at end of file +var _0x471b=['STRING','DATE','moment','sequelize','exports'];(function(_0x3bfbbc,_0x2370da){var _0x1d58ef=function(_0x1dd567){while(--_0x1dd567){_0x3bfbbc['push'](_0x3bfbbc['shift']());}};_0x1d58ef(++_0x2370da);}(_0x471b,0x183));var _0xb471=function(_0x58ec40,_0x4ed22f){_0x58ec40=_0x58ec40-0x0;var _0x6771bd=_0x471b[_0x58ec40];return _0x6771bd;};'use strict';var moment=require(_0xb471('0x0'));var Sequelize=require(_0xb471('0x1'));module[_0xb471('0x2')]={'uniqueid':{'type':Sequelize[_0xb471('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb471('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb471('0x4')]},'reason':{'type':Sequelize[_0xb471('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 95d9e5f..e698578 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 _0x3aa1=['find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params'];(function(_0x5c51f2,_0x526de8){var _0x45cd05=function(_0x3cbb19){while(--_0x3cbb19){_0x5c51f2['push'](_0x5c51f2['shift']());}};_0x45cd05(++_0x526de8);}(_0x3aa1,0xdb));var _0x13aa=function(_0x5831e0,_0x158ec4){_0x5831e0=_0x5831e0-0x0;var _0x5af09c=_0x3aa1[_0x5831e0];return _0x5af09c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x13aa('0x0'));var rimraf=require(_0x13aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13aa('0x2'));var moment=require(_0x13aa('0x3'));var BPromise=require(_0x13aa('0x4'));var Mustache=require(_0x13aa('0x5'));var util=require(_0x13aa('0x6'));var path=require('path');var sox=require(_0x13aa('0x7'));var csv=require('to-csv');var ejs=require(_0x13aa('0x8'));var fs=require('fs');var _=require(_0x13aa('0x9'));var squel=require(_0x13aa('0xa'));var crypto=require('crypto');var jsforce=require(_0x13aa('0xb'));var deskjs=require(_0x13aa('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13aa('0xd'));var Redis=require(_0x13aa('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x13aa('0xf'));var as=require(_0x13aa('0x10'));var hardwareService=require(_0x13aa('0x11'));var logger=require(_0x13aa('0x12'))('api');var utils=require(_0x13aa('0x13'));var config=require('../../config/environment');var db=require(_0x13aa('0x14'))['db'];function respondWithStatusCode(_0x343f0f,_0x56fbca){_0x56fbca=_0x56fbca||0xcc;return function(_0x1d03f9){if(_0x1d03f9){return _0x343f0f[_0x13aa('0x15')](_0x56fbca);}return _0x343f0f[_0x13aa('0x16')](_0x56fbca)[_0x13aa('0x17')]();};}function respondWithResult(_0x29725a,_0x558f7e){_0x558f7e=_0x558f7e||0xc8;return function(_0x1df399){if(_0x1df399){return _0x29725a[_0x13aa('0x16')](_0x558f7e)[_0x13aa('0x18')](_0x1df399);}};}function respondWithFilteredResult(_0x2b79f8,_0x3b87c1){return function(_0x463e09){if(_0x463e09){var _0x3be142=_0x463e09[_0x13aa('0x19')],_0x1da6ea=_0x3b87c1['offset'],_0x4451ae=_0x3b87c1[_0x13aa('0x1a')]+_0x3b87c1[_0x13aa('0x1b')],_0x3b038b;if(_0x4451ae>=_0x3be142){_0x4451ae=_0x3be142;_0x3b038b=0xc8;}else{_0x3b038b=0xce;}_0x2b79f8[_0x13aa('0x16')](_0x3b038b);return _0x2b79f8[_0x13aa('0x1c')]('Content-Range',_0x1da6ea+'-'+_0x4451ae+'/'+_0x3be142)[_0x13aa('0x18')](_0x463e09);}return null;};}function patchUpdates(_0x489593){return function(_0x695cc4){try{jsonpatch[_0x13aa('0x1d')](_0x695cc4,_0x489593,!![]);}catch(_0x3e986d){return BPromise[_0x13aa('0x1e')](_0x3e986d);}return _0x695cc4[_0x13aa('0x1f')]();};}function saveUpdates(_0x303bce,_0x29add1){return function(_0xfc6b44){if(_0xfc6b44){return _0xfc6b44[_0x13aa('0x20')](_0x303bce)['then'](function(_0x3ccf98){return _0x3ccf98;});}return null;};}function removeEntity(_0x407ff9,_0x5efae2){return function(_0x5053b7){if(_0x5053b7){return _0x5053b7[_0x13aa('0x21')]()['then'](function(){_0x407ff9[_0x13aa('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ba92,_0x57e8fb){return function(_0x19d9ce){if(!_0x19d9ce){_0x18ba92['sendStatus'](0x194);}return _0x19d9ce;};}function handleError(_0x213ad7,_0x5bb914){_0x5bb914=_0x5bb914||0x1f4;return function(_0x34127f){logger[_0x13aa('0x22')](_0x34127f[_0x13aa('0x23')]);if(_0x34127f['name']){delete _0x34127f[_0x13aa('0x24')];}_0x213ad7['status'](_0x5bb914)[_0x13aa('0x25')](_0x34127f);};}exports[_0x13aa('0x26')]=function(_0x47c067,_0x577cab){var _0x4a5963={},_0x55e7f7={},_0x31a1f0={'count':0x0,'rows':[]};var _0x4875ec=_['map'](db[_0x13aa('0x27')][_0x13aa('0x28')],function(_0x38286c){return{'name':_0x38286c[_0x13aa('0x29')],'type':_0x38286c['type']['key']};});_0x55e7f7[_0x13aa('0x2a')]=_[_0x13aa('0x2b')](_0x4875ec,_0x13aa('0x24'));_0x55e7f7[_0x13aa('0x2c')]=_[_0x13aa('0x2d')](_0x47c067[_0x13aa('0x2c')]);_0x55e7f7[_0x13aa('0x2e')]=_[_0x13aa('0x2f')](_0x55e7f7[_0x13aa('0x2a')],_0x55e7f7['query']);_0x4a5963[_0x13aa('0x30')]=_[_0x13aa('0x2f')](_0x55e7f7['model'],qs[_0x13aa('0x31')](_0x47c067[_0x13aa('0x2c')]['fields']));_0x4a5963[_0x13aa('0x30')]=_0x4a5963[_0x13aa('0x30')][_0x13aa('0x32')]?_0x4a5963[_0x13aa('0x30')]:_0x55e7f7[_0x13aa('0x2a')];if(!_0x47c067['query'][_0x13aa('0x33')](_0x13aa('0x34'))){_0x4a5963[_0x13aa('0x1b')]=qs[_0x13aa('0x1b')](_0x47c067[_0x13aa('0x2c')]['limit']);_0x4a5963[_0x13aa('0x1a')]=qs[_0x13aa('0x1a')](_0x47c067[_0x13aa('0x2c')]['offset']);}_0x4a5963[_0x13aa('0x35')]=qs[_0x13aa('0x36')](_0x47c067[_0x13aa('0x2c')]['sort']);_0x4a5963[_0x13aa('0x37')]=qs['filters'](_[_0x13aa('0x38')](_0x47c067[_0x13aa('0x2c')],_0x55e7f7[_0x13aa('0x2e')]),_0x4875ec);if(_0x47c067[_0x13aa('0x2c')][_0x13aa('0x39')]){_0x4a5963[_0x13aa('0x37')]=_['merge'](_0x4a5963['where'],{'$or':_['map'](_0x4875ec,function(_0x1afebe){if(_0x1afebe[_0x13aa('0x3a')]!==_0x13aa('0x3b')){var _0x447853={};_0x447853[_0x1afebe[_0x13aa('0x24')]]={'$like':'%'+_0x47c067[_0x13aa('0x2c')][_0x13aa('0x39')]+'%'};return _0x447853;}})});}_0x4a5963=_[_0x13aa('0x3c')]({},_0x4a5963,_0x47c067[_0x13aa('0x3d')]);var _0x5316={'where':_0x4a5963[_0x13aa('0x37')]};return db[_0x13aa('0x27')][_0x13aa('0x19')](_0x5316)[_0x13aa('0x3e')](function(_0x40f4eb){_0x31a1f0[_0x13aa('0x19')]=_0x40f4eb;if(_0x47c067[_0x13aa('0x2c')]['includeAll']){_0x4a5963[_0x13aa('0x3f')]=[{'all':!![]}];}return db[_0x13aa('0x27')][_0x13aa('0x40')](_0x4a5963);})[_0x13aa('0x3e')](function(_0x4e15a7){_0x31a1f0[_0x13aa('0x41')]=_0x4e15a7;return _0x31a1f0;})['then'](respondWithFilteredResult(_0x577cab,_0x4a5963))[_0x13aa('0x42')](handleError(_0x577cab,null));};exports[_0x13aa('0x43')]=function(_0x57948e,_0x1c1a47){var _0x5c777f={'raw':!![],'where':{'id':_0x57948e[_0x13aa('0x44')]['id']}},_0x44bfa9={};_0x44bfa9[_0x13aa('0x2a')]=_[_0x13aa('0x2d')](db['MailQueueReport'][_0x13aa('0x28')]);_0x44bfa9[_0x13aa('0x2c')]=_[_0x13aa('0x2d')](_0x57948e[_0x13aa('0x2c')]);_0x44bfa9[_0x13aa('0x2e')]=_[_0x13aa('0x2f')](_0x44bfa9['model'],_0x44bfa9[_0x13aa('0x2c')]);_0x5c777f[_0x13aa('0x30')]=_['intersection'](_0x44bfa9['model'],qs[_0x13aa('0x31')](_0x57948e[_0x13aa('0x2c')][_0x13aa('0x31')]));_0x5c777f[_0x13aa('0x30')]=_0x5c777f['attributes'][_0x13aa('0x32')]?_0x5c777f[_0x13aa('0x30')]:_0x44bfa9['model'];if(_0x57948e['query']['includeAll']){_0x5c777f[_0x13aa('0x3f')]=[{'all':!![]}];}_0x5c777f=_[_0x13aa('0x3c')]({},_0x5c777f,_0x57948e[_0x13aa('0x3d')]);return db['MailQueueReport'][_0x13aa('0x45')](_0x5c777f)[_0x13aa('0x3e')](handleEntityNotFound(_0x1c1a47,null))[_0x13aa('0x3e')](respondWithResult(_0x1c1a47,null))[_0x13aa('0x42')](handleError(_0x1c1a47,null));};exports[_0x13aa('0x46')]=function(_0x5b8743,_0x2c6ecf){return db['MailQueueReport'][_0x13aa('0x46')](_0x5b8743[_0x13aa('0x47')],{})[_0x13aa('0x3e')](respondWithResult(_0x2c6ecf,0xc9))[_0x13aa('0x42')](handleError(_0x2c6ecf,null));};exports[_0x13aa('0x20')]=function(_0x3cec96,_0x19cc64){if(_0x3cec96[_0x13aa('0x47')]['id']){delete _0x3cec96['body']['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x3cec96['params']['id']}})['then'](handleEntityNotFound(_0x19cc64,null))['then'](saveUpdates(_0x3cec96['body'],null))['then'](respondWithResult(_0x19cc64,null))['catch'](handleError(_0x19cc64,null));};exports[_0x13aa('0x21')]=function(_0x2a7e9,_0x5d7551){return db['MailQueueReport'][_0x13aa('0x45')]({'where':{'id':_0x2a7e9[_0x13aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d7551,null))[_0x13aa('0x3e')](removeEntity(_0x5d7551,null))[_0x13aa('0x42')](handleError(_0x5d7551,null));};exports['describe']=function(_0xaa5121,_0x19de30){return db[_0x13aa('0x27')]['describe']()[_0x13aa('0x3e')](respondWithResult(_0x19de30,null))[_0x13aa('0x42')](handleError(_0x19de30,null));}; \ No newline at end of file +var _0xc4f5=['length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1efc8c,_0x46e5ef){var _0x2f2ace=function(_0x1623a4){while(--_0x1623a4){_0x1efc8c['push'](_0x1efc8c['shift']());}};_0x2f2ace(++_0x46e5ef);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x24783a,_0x75041){_0x24783a=_0x24783a-0x0;var _0x227a77=_0xc4f5[_0x24783a];return _0x227a77;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c4f('0x0'));var rimraf=require(_0x5c4f('0x1'));var zipdir=require(_0x5c4f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c4f('0x3'));var moment=require(_0x5c4f('0x4'));var BPromise=require(_0x5c4f('0x5'));var Mustache=require(_0x5c4f('0x6'));var util=require(_0x5c4f('0x7'));var path=require('path');var sox=require(_0x5c4f('0x8'));var csv=require(_0x5c4f('0x9'));var ejs=require(_0x5c4f('0xa'));var fs=require('fs');var _=require(_0x5c4f('0xb'));var squel=require(_0x5c4f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5c4f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c4f('0x9'));var querystring=require('querystring');var Papa=require(_0x5c4f('0xe'));var Redis=require(_0x5c4f('0xf'));var authService=require(_0x5c4f('0x10'));var qs=require(_0x5c4f('0x11'));var as=require(_0x5c4f('0x12'));var hardwareService=require(_0x5c4f('0x13'));var logger=require(_0x5c4f('0x14'))('api');var utils=require(_0x5c4f('0x15'));var config=require(_0x5c4f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22b73b,_0x138495){_0x138495=_0x138495||0xcc;return function(_0x1d68ac){if(_0x1d68ac){return _0x22b73b[_0x5c4f('0x17')](_0x138495);}return _0x22b73b[_0x5c4f('0x18')](_0x138495)['end']();};}function respondWithResult(_0x48c4dc,_0x2cb7ff){_0x2cb7ff=_0x2cb7ff||0xc8;return function(_0x14b6f1){if(_0x14b6f1){return _0x48c4dc[_0x5c4f('0x18')](_0x2cb7ff)[_0x5c4f('0x19')](_0x14b6f1);}};}function respondWithFilteredResult(_0x193b60,_0x4d839e){return function(_0x4d52a5){if(_0x4d52a5){var _0x2de090=_0x4d52a5['count'],_0x54327c=_0x4d839e[_0x5c4f('0x1a')],_0x541f11=_0x4d839e[_0x5c4f('0x1a')]+_0x4d839e[_0x5c4f('0x1b')],_0xf1d701;if(_0x541f11>=_0x2de090){_0x541f11=_0x2de090;_0xf1d701=0xc8;}else{_0xf1d701=0xce;}_0x193b60[_0x5c4f('0x18')](_0xf1d701);return _0x193b60[_0x5c4f('0x1c')](_0x5c4f('0x1d'),_0x54327c+'-'+_0x541f11+'/'+_0x2de090)[_0x5c4f('0x19')](_0x4d52a5);}return null;};}function patchUpdates(_0x3ec0ff){return function(_0x167335){try{jsonpatch['apply'](_0x167335,_0x3ec0ff,!![]);}catch(_0x2a3bc3){return BPromise[_0x5c4f('0x1e')](_0x2a3bc3);}return _0x167335[_0x5c4f('0x1f')]();};}function saveUpdates(_0x32a779,_0x5170e0){return function(_0x4ac510){if(_0x4ac510){return _0x4ac510[_0x5c4f('0x20')](_0x32a779)[_0x5c4f('0x21')](function(_0x8cbb3a){return _0x8cbb3a;});}return null;};}function removeEntity(_0xecc7d9,_0x111312){return function(_0x40ce01){if(_0x40ce01){return _0x40ce01[_0x5c4f('0x22')]()[_0x5c4f('0x21')](function(){_0xecc7d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x111110,_0x45ae8c){return function(_0x38b65e){if(!_0x38b65e){_0x111110[_0x5c4f('0x17')](0x194);}return _0x38b65e;};}function handleError(_0x5a7ee4,_0x2fc5f8){_0x2fc5f8=_0x2fc5f8||0x1f4;return function(_0x585782){logger[_0x5c4f('0x23')](_0x585782[_0x5c4f('0x24')]);if(_0x585782[_0x5c4f('0x25')]){delete _0x585782['name'];}_0x5a7ee4[_0x5c4f('0x18')](_0x2fc5f8)[_0x5c4f('0x26')](_0x585782);};}exports[_0x5c4f('0x27')]=function(_0x158f35,_0x45bc65){var _0x157d2e={},_0x5da4a0={},_0xea0a11={'count':0x0,'rows':[]};var _0xc6b796=_[_0x5c4f('0x28')](db[_0x5c4f('0x29')]['rawAttributes'],function(_0x4d94a7){return{'name':_0x4d94a7['fieldName'],'type':_0x4d94a7[_0x5c4f('0x2a')][_0x5c4f('0x2b')]};});_0x5da4a0[_0x5c4f('0x2c')]=_[_0x5c4f('0x28')](_0xc6b796,_0x5c4f('0x25'));_0x5da4a0[_0x5c4f('0x2d')]=_[_0x5c4f('0x2e')](_0x158f35[_0x5c4f('0x2d')]);_0x5da4a0[_0x5c4f('0x2f')]=_[_0x5c4f('0x30')](_0x5da4a0[_0x5c4f('0x2c')],_0x5da4a0[_0x5c4f('0x2d')]);_0x157d2e[_0x5c4f('0x31')]=_['intersection'](_0x5da4a0['model'],qs[_0x5c4f('0x32')](_0x158f35['query'][_0x5c4f('0x32')]));_0x157d2e[_0x5c4f('0x31')]=_0x157d2e[_0x5c4f('0x31')][_0x5c4f('0x33')]?_0x157d2e[_0x5c4f('0x31')]:_0x5da4a0[_0x5c4f('0x2c')];if(!_0x158f35[_0x5c4f('0x2d')]['hasOwnProperty'](_0x5c4f('0x34'))){_0x157d2e[_0x5c4f('0x1b')]=qs[_0x5c4f('0x1b')](_0x158f35['query']['limit']);_0x157d2e['offset']=qs[_0x5c4f('0x1a')](_0x158f35[_0x5c4f('0x2d')][_0x5c4f('0x1a')]);}_0x157d2e[_0x5c4f('0x35')]=qs[_0x5c4f('0x36')](_0x158f35['query'][_0x5c4f('0x36')]);_0x157d2e[_0x5c4f('0x37')]=qs['filters'](_[_0x5c4f('0x38')](_0x158f35[_0x5c4f('0x2d')],_0x5da4a0['filters']),_0xc6b796);if(_0x158f35['query'][_0x5c4f('0x39')]){_0x157d2e[_0x5c4f('0x37')]=_['merge'](_0x157d2e[_0x5c4f('0x37')],{'$or':_[_0x5c4f('0x28')](_0xc6b796,function(_0x113f38){if(_0x113f38[_0x5c4f('0x2a')]!==_0x5c4f('0x3a')){var _0x52cbaa={};_0x52cbaa[_0x113f38[_0x5c4f('0x25')]]={'$like':'%'+_0x158f35['query'][_0x5c4f('0x39')]+'%'};return _0x52cbaa;}})});}_0x157d2e=_[_0x5c4f('0x3b')]({},_0x157d2e,_0x158f35[_0x5c4f('0x3c')]);var _0x419c1e={'where':_0x157d2e[_0x5c4f('0x37')]};return db[_0x5c4f('0x29')][_0x5c4f('0x3d')](_0x419c1e)[_0x5c4f('0x21')](function(_0x382d53){_0xea0a11['count']=_0x382d53;if(_0x158f35['query'][_0x5c4f('0x3e')]){_0x157d2e[_0x5c4f('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0x5c4f('0x40')](_0x157d2e);})[_0x5c4f('0x21')](function(_0x1b83c3){_0xea0a11[_0x5c4f('0x41')]=_0x1b83c3;return _0xea0a11;})[_0x5c4f('0x21')](respondWithFilteredResult(_0x45bc65,_0x157d2e))[_0x5c4f('0x42')](handleError(_0x45bc65,null));};exports['show']=function(_0x52cdfd,_0x57d7c5){var _0x29a409={'raw':!![],'where':{'id':_0x52cdfd[_0x5c4f('0x43')]['id']}},_0x573e5b={};_0x573e5b[_0x5c4f('0x2c')]=_[_0x5c4f('0x2e')](db[_0x5c4f('0x29')]['rawAttributes']);_0x573e5b['query']=_['keys'](_0x52cdfd['query']);_0x573e5b[_0x5c4f('0x2f')]=_[_0x5c4f('0x30')](_0x573e5b[_0x5c4f('0x2c')],_0x573e5b[_0x5c4f('0x2d')]);_0x29a409[_0x5c4f('0x31')]=_[_0x5c4f('0x30')](_0x573e5b[_0x5c4f('0x2c')],qs[_0x5c4f('0x32')](_0x52cdfd[_0x5c4f('0x2d')][_0x5c4f('0x32')]));_0x29a409[_0x5c4f('0x31')]=_0x29a409[_0x5c4f('0x31')][_0x5c4f('0x33')]?_0x29a409[_0x5c4f('0x31')]:_0x573e5b[_0x5c4f('0x2c')];if(_0x52cdfd[_0x5c4f('0x2d')][_0x5c4f('0x3e')]){_0x29a409[_0x5c4f('0x3f')]=[{'all':!![]}];}_0x29a409=_[_0x5c4f('0x3b')]({},_0x29a409,_0x52cdfd[_0x5c4f('0x3c')]);return db[_0x5c4f('0x29')][_0x5c4f('0x44')](_0x29a409)[_0x5c4f('0x21')](handleEntityNotFound(_0x57d7c5,null))['then'](respondWithResult(_0x57d7c5,null))[_0x5c4f('0x42')](handleError(_0x57d7c5,null));};exports[_0x5c4f('0x45')]=function(_0x4eab2e,_0x2fd61c){return db[_0x5c4f('0x29')][_0x5c4f('0x45')](_0x4eab2e[_0x5c4f('0x46')],{})['then'](respondWithResult(_0x2fd61c,0xc9))[_0x5c4f('0x42')](handleError(_0x2fd61c,null));};exports[_0x5c4f('0x20')]=function(_0x487e42,_0x47b98b){if(_0x487e42[_0x5c4f('0x46')]['id']){delete _0x487e42[_0x5c4f('0x46')]['id'];}return db[_0x5c4f('0x29')]['find']({'where':{'id':_0x487e42[_0x5c4f('0x43')]['id']}})[_0x5c4f('0x21')](handleEntityNotFound(_0x47b98b,null))[_0x5c4f('0x21')](saveUpdates(_0x487e42[_0x5c4f('0x46')],null))[_0x5c4f('0x21')](respondWithResult(_0x47b98b,null))[_0x5c4f('0x42')](handleError(_0x47b98b,null));};exports[_0x5c4f('0x22')]=function(_0xd6304d,_0x24b729){return db[_0x5c4f('0x29')][_0x5c4f('0x44')]({'where':{'id':_0xd6304d['params']['id']}})[_0x5c4f('0x21')](handleEntityNotFound(_0x24b729,null))[_0x5c4f('0x21')](removeEntity(_0x24b729,null))[_0x5c4f('0x42')](handleError(_0x24b729,null));};exports[_0x5c4f('0x47')]=function(_0x2262b9,_0x5d7f6e){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x5d7f6e,null))[_0x5c4f('0x42')](handleError(_0x5d7f6e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 110d4af..1d1df35 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 _0x9417=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0x9417,0xb4));var _0x7941=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x9417[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x7941('0x0'));var util=require(_0x7941('0x1'));var logger=require(_0x7941('0x2'))(_0x7941('0x3'));var moment=require('moment');var BPromise=require(_0x7941('0x4'));var rp=require(_0x7941('0x5'));var fs=require('fs');var path=require(_0x7941('0x6'));var rimraf=require(_0x7941('0x7'));var config=require(_0x7941('0x8'));var attributes=require(_0x7941('0x9'));module[_0x7941('0xa')]=function(_0x3e38d8,_0x1dee1a){return _0x3e38d8[_0x7941('0xb')]('MailQueueReport',attributes,{'tableName':_0x7941('0xc'),'paranoid':![],'indexes':[{'name':_0x7941('0xd'),'fields':[_0x7941('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d0c=['MailQueueReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x404f3c,_0x54bebc){var _0x11b307=function(_0x35f301){while(--_0x35f301){_0x404f3c['push'](_0x404f3c['shift']());}};_0x11b307(++_0x54bebc);}(_0x2d0c,0x1e2));var _0xc2d0=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x2d0c[_0x55257d];return _0x4d296d;};'use strict';var _=require('lodash');var util=require(_0xc2d0('0x0'));var logger=require(_0xc2d0('0x1'))('api');var moment=require(_0xc2d0('0x2'));var BPromise=require(_0xc2d0('0x3'));var rp=require(_0xc2d0('0x4'));var fs=require('fs');var path=require(_0xc2d0('0x5'));var rimraf=require(_0xc2d0('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0xc8e0d1,_0x1894e8){return _0xc8e0d1[_0xc2d0('0x7')](_0xc2d0('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xc2d0('0x9'),'fields':[_0xc2d0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ff09d9e..dd43cdc 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 _0x53ec=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','lodash','util','moment','bluebird'];(function(_0x2f99ff,_0x22ce16){var _0x12ed75=function(_0x234c64){while(--_0x234c64){_0x2f99ff['push'](_0x2f99ff['shift']());}};_0x12ed75(++_0x22ce16);}(_0x53ec,0x192));var _0xc53e=function(_0xd723,_0x164010){_0xd723=_0xd723-0x0;var _0x5179d2=_0x53ec[_0xd723];return _0x5179d2;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});}exports[_0xc53e('0x15')]=function(_0x164016){var _0x2d4ebb=this;return new Promise(function(_0x3b550e,_0x5d1098){return db['MailQueueReport'][_0xc53e('0x16')](_0x164016[_0xc53e('0x17')],{'raw':_0x164016[_0xc53e('0x18')]?_0x164016[_0xc53e('0x18')][_0xc53e('0x19')]===undefined?!![]:![]:!![]})[_0xc53e('0xb')](function(_0x15a015){logger[_0xc53e('0xc')](_0xc53e('0x15'),_0x164016);logger[_0xc53e('0xf')](_0xc53e('0x15'),_0x164016,JSON[_0xc53e('0x10')](_0x15a015));_0x3b550e(_0x15a015);})[_0xc53e('0x14')](function(_0x4fb695){logger['error']('CreateMailQueueReport',_0x4fb695[_0xc53e('0x13')],_0x164016);_0x5d1098(_0x2d4ebb[_0xc53e('0x12')](0x1f4,_0x4fb695[_0xc53e('0x13')]));});});};exports[_0xc53e('0x1a')]=function(_0x180811){var _0x5009e1=this;return new Promise(function(_0x5e5377,_0xe06e42){return db['MailQueueReport'][_0xc53e('0x1b')](_0x180811[_0xc53e('0x17')],{'raw':_0x180811[_0xc53e('0x18')]?_0x180811[_0xc53e('0x18')][_0xc53e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180811['options']?_0x180811[_0xc53e('0x18')]['where']||null:null,'attributes':_0x180811['options']?_0x180811['options'][_0xc53e('0x1c')]||null:null,'limit':_0x180811['options']?_0x180811[_0xc53e('0x18')]['limit']||null:null})[_0xc53e('0xb')](function(_0x5112d2){logger['info'](_0xc53e('0x1a'),_0x180811);logger[_0xc53e('0xf')](_0xc53e('0x1a'),_0x180811,JSON[_0xc53e('0x10')](_0x5112d2));_0x5e5377(_0x5112d2);})[_0xc53e('0x14')](function(_0xf97d78){logger[_0xc53e('0x12')](_0xc53e('0x1a'),_0xf97d78['message'],_0x180811);_0xe06e42(_0x5009e1[_0xc53e('0x12')](0x1f4,_0xf97d78[_0xc53e('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x8ee4e8,_0x192cf2){var _0x4b1ec4=function(_0xc3cfa5){while(--_0xc3cfa5){_0x8ee4e8['push'](_0x8ee4e8['shift']());}};_0x4b1ec4(++_0x192cf2);}(_0x2ef3,0xba));var _0x32ef=function(_0x55da6e,_0x4dedea){_0x55da6e=_0x55da6e-0x0;var _0x4b7397=_0x2ef3[_0x55da6e];return _0x4b7397;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d99b749..209dc6a 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 _0x68b6=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x490cd3,_0x97d5ee){var _0x3320d7=function(_0x2ad809){while(--_0x2ad809){_0x490cd3['push'](_0x490cd3['shift']());}};_0x3320d7(++_0x97d5ee);}(_0x68b6,0x178));var _0x668b=function(_0xf6cc84,_0x55467a){_0xf6cc84=_0xf6cc84-0x0;var _0x589bd5=_0x68b6[_0xf6cc84];return _0x589bd5;};'use strict';var multer=require(_0x668b('0x0'));var util=require('util');var path=require(_0x668b('0x1'));var timeout=require(_0x668b('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x668b('0x3'));var interaction=require(_0x668b('0x4'));var config=require(_0x668b('0x5'));module[_0x668b('0x6')]=router; \ No newline at end of file +var _0x6a94=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x21c504,_0x3e00c6){var _0x51b5c3=function(_0x5b3f42){while(--_0x5b3f42){_0x21c504['push'](_0x21c504['shift']());}};_0x51b5c3(++_0x3e00c6);}(_0x6a94,0xbd));var _0x46a9=function(_0x57d054,_0x3e9bfa){_0x57d054=_0x57d054-0x0;var _0x47c5e2=_0x6a94[_0x57d054];return _0x47c5e2;};'use strict';var multer=require(_0x46a9('0x0'));var util=require(_0x46a9('0x1'));var path=require(_0x46a9('0x2'));var timeout=require(_0x46a9('0x3'));var express=require(_0x46a9('0x4'));var router=express[_0x46a9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x46a9('0x6'));var config=require(_0x46a9('0x7'));module[_0x46a9('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a52028e..cd2b87b 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 _0x3553=['BOOLEAN','username','INTEGER','sequelize','exports','STRING'];(function(_0x33a467,_0x296c1f){var _0x22294d=function(_0x10687d){while(--_0x10687d){_0x33a467['push'](_0x33a467['shift']());}};_0x22294d(++_0x296c1f);}(_0x3553,0x123));var _0x3355=function(_0x182ef5,_0x5786c4){_0x182ef5=_0x182ef5-0x0;var _0x363748=_0x3553[_0x182ef5];return _0x363748;};'use strict';var Sequelize=require(_0x3355('0x0'));module[_0x3355('0x1')]={'description':{'type':Sequelize[_0x3355('0x2')]},'host':{'type':Sequelize[_0x3355('0x2')]},'authentication':{'type':Sequelize[_0x3355('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3355('0x2')],'unique':_0x3355('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3355('0x5')]},'tls':{'type':Sequelize[_0x3355('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3355('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3355('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3355('0x2')]}}; \ No newline at end of file +var _0xefae=['BOOLEAN','username','INTEGER','INBOX','sequelize','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xefae,0x172));var _0xeefa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefae[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xeefa('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeefa('0x1')]},'authentication':{'type':Sequelize[_0xeefa('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xeefa('0x3')},'password':{'type':Sequelize[_0xeefa('0x1')]},'port':{'type':Sequelize[_0xeefa('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xeefa('0x5')},'connTimeout':{'type':Sequelize[_0xeefa('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xeefa('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2a12c0f..32a1840 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 _0x8580=['api','request-promise','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn','util'];(function(_0x491853,_0x1311b9){var _0x2785c5=function(_0x50954c){while(--_0x50954c){_0x491853['push'](_0x491853['shift']());}};_0x2785c5(++_0x1311b9);}(_0x8580,0x1c7));var _0x0858=function(_0xbbfc9d,_0x3f4a0d){_0xbbfc9d=_0xbbfc9d-0x0;var _0x53a9e6=_0x8580[_0xbbfc9d];return _0x53a9e6;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var logger=require('../../config/logger')(_0x0858('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0858('0x2'));var fs=require('fs');var path=require(_0x0858('0x3'));var rimraf=require('rimraf');var config=require(_0x0858('0x4'));var attributes=require(_0x0858('0x5'));module['exports']=function(_0x2b34e0,_0x8c913d){return _0x2b34e0[_0x0858('0x6')](_0x0858('0x7'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe605=['exports','define','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x15f62e,_0x54b1d3){var _0x15ad52=function(_0x21dc28){while(--_0x21dc28){_0x15f62e['push'](_0x15f62e['shift']());}};_0x15ad52(++_0x54b1d3);}(_0xe605,0x92));var _0x5e60=function(_0x815ae0,_0x593be7){_0x815ae0=_0x815ae0-0x0;var _0x2e09c5=_0xe605[_0x815ae0];return _0x2e09c5;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var logger=require('../../config/logger')(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var BPromise=require(_0x5e60('0x4'));var rp=require(_0x5e60('0x5'));var fs=require('fs');var path=require(_0x5e60('0x6'));var rimraf=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var attributes=require(_0x5e60('0x9'));module[_0x5e60('0xa')]=function(_0xc41535,_0x1d4a08){return _0xc41535[_0x5e60('0xb')]('MailServerIn',attributes,{'tableName':_0x5e60('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 8942d8f..23585ff 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 _0x7d76=['request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','raw','options','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x994ec6,_0x21f04a){var _0x22524e=function(_0x18ec90){while(--_0x18ec90){_0x994ec6['push'](_0x994ec6['shift']());}};_0x22524e(++_0x21f04a);}(_0x7d76,0x148));var _0x67d7=function(_0x22f3c5,_0x18dd75){_0x22f3c5=_0x22f3c5-0x0;var _0x18df3a=_0x7d76[_0x22f3c5];return _0x18df3a;};'use strict';var _=require(_0x67d7('0x0'));var util=require(_0x67d7('0x1'));var moment=require(_0x67d7('0x2'));var BPromise=require(_0x67d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67d7('0x4'));var db=require(_0x67d7('0x5'))['db'];var utils=require(_0x67d7('0x6'));var logger=require(_0x67d7('0x7'))(_0x67d7('0x8'));var config=require('../../config/environment');var jayson=require(_0x67d7('0x9'));var client=jayson[_0x67d7('0xa')][_0x67d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b1110,_0x4a65cd,_0x4484a4){return new BPromise(function(_0x27b031,_0x70bfae){return client[_0x67d7('0xc')](_0x3b1110,_0x4484a4)[_0x67d7('0xd')](function(_0x225ff4){logger[_0x67d7('0xe')](_0x67d7('0xf'),_0x4a65cd,_0x67d7('0x10'));logger['debug'](_0x67d7('0x11'),_0x4a65cd,'request\x20sent',JSON[_0x67d7('0x12')](_0x225ff4));if(_0x225ff4[_0x67d7('0x13')]){if(_0x225ff4[_0x67d7('0x13')]['code']===0x1f4){logger['error'](_0x67d7('0xf'),_0x4a65cd,_0x225ff4[_0x67d7('0x13')][_0x67d7('0x14')]);return _0x70bfae(_0x225ff4['error'][_0x67d7('0x14')]);}logger[_0x67d7('0x13')](_0x67d7('0xf'),_0x4a65cd,_0x225ff4[_0x67d7('0x13')][_0x67d7('0x14')]);return _0x27b031(_0x225ff4['error'][_0x67d7('0x14')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x4a65cd,'request\x20sent');_0x27b031(_0x225ff4['result'][_0x67d7('0x14')]);}})[_0x67d7('0x15')](function(_0x5bb004){logger[_0x67d7('0x13')](_0x67d7('0xf'),_0x4a65cd,_0x5bb004);_0x70bfae(_0x5bb004);});});}exports[_0x67d7('0x16')]=function(_0x372da7){var _0x18dce2=this;return new Promise(function(_0x1084e8,_0x595e7a){return db[_0x67d7('0x17')][_0x67d7('0x18')]({'raw':_0x372da7['options']?_0x372da7['options'][_0x67d7('0x19')]===undefined?!![]:![]:!![],'where':_0x372da7['options']?_0x372da7[_0x67d7('0x1a')][_0x67d7('0x1b')]||null:null,'attributes':_0x372da7['options']?_0x372da7['options'][_0x67d7('0x1c')]||null:null,'limit':_0x372da7[_0x67d7('0x1a')]?_0x372da7['options'][_0x67d7('0x1d')]||null:null,'include':_0x372da7[_0x67d7('0x1a')]?_0x372da7['options'][_0x67d7('0x1e')]?_[_0x67d7('0x1f')](_0x372da7[_0x67d7('0x1a')][_0x67d7('0x1e')],function(_0x44affa){return{'model':db[_0x44affa[_0x67d7('0x20')]],'as':_0x44affa['as'],'attributes':_0x44affa['attributes'],'include':_0x44affa[_0x67d7('0x1e')]?_[_0x67d7('0x1f')](_0x44affa[_0x67d7('0x1e')],function(_0x4c5fa2){return{'model':db[_0x4c5fa2[_0x67d7('0x20')]],'as':_0x4c5fa2['as'],'attributes':_0x4c5fa2['attributes'],'include':_0x4c5fa2[_0x67d7('0x1e')]?_['map'](_0x4c5fa2[_0x67d7('0x1e')],function(_0x59c94b){return{'model':db[_0x59c94b[_0x67d7('0x20')]],'as':_0x59c94b['as'],'attributes':_0x59c94b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x226aa0){logger['info']('GetMailServerIn',_0x372da7);logger[_0x67d7('0x21')](_0x67d7('0x16'),_0x372da7,JSON['stringify'](_0x226aa0));_0x1084e8(_0x226aa0);})['catch'](function(_0x396e76){logger[_0x67d7('0x13')](_0x67d7('0x16'),_0x396e76[_0x67d7('0x14')],_0x372da7);_0x595e7a(_0x18dce2[_0x67d7('0x13')](0x1f4,_0x396e76[_0x67d7('0x14')]));});});}; \ No newline at end of file +var _0x730c=['then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','map','include','attributes','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x3b92f4,_0x220285){var _0x2345fb=function(_0x4b5e52){while(--_0x4b5e52){_0x3b92f4['push'](_0x3b92f4['shift']());}};_0x2345fb(++_0x220285);}(_0x730c,0x137));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc730('0x0'));var moment=require(_0xc730('0x1'));var BPromise=require(_0xc730('0x2'));var rs=require(_0xc730('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc730('0x4'))['db'];var utils=require(_0xc730('0x5'));var logger=require(_0xc730('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc730('0x7')][_0xc730('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5be0df,_0x519eac,_0xc6007d){return new BPromise(function(_0x19d35e,_0xd678b9){return client['request'](_0x5be0df,_0xc6007d)[_0xc730('0x9')](function(_0xe24948){logger[_0xc730('0xa')](_0xc730('0xb'),_0x519eac,'request\x20sent');logger[_0xc730('0xc')](_0xc730('0xd'),_0x519eac,_0xc730('0xe'),JSON[_0xc730('0xf')](_0xe24948));if(_0xe24948[_0xc730('0x10')]){if(_0xe24948[_0xc730('0x10')][_0xc730('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x519eac,_0xe24948[_0xc730('0x10')][_0xc730('0x12')]);return _0xd678b9(_0xe24948['error'][_0xc730('0x12')]);}logger[_0xc730('0x10')]('MailServerIn,\x20%s,\x20%s',_0x519eac,_0xe24948['error'][_0xc730('0x12')]);return _0x19d35e(_0xe24948[_0xc730('0x10')]['message']);}else{logger[_0xc730('0xa')](_0xc730('0xb'),_0x519eac,_0xc730('0xe'));_0x19d35e(_0xe24948[_0xc730('0x13')][_0xc730('0x12')]);}})[_0xc730('0x14')](function(_0x3a5e11){logger[_0xc730('0x10')](_0xc730('0xb'),_0x519eac,_0x3a5e11);_0xd678b9(_0x3a5e11);});});}exports[_0xc730('0x15')]=function(_0x3ba9bc){var _0x48281f=this;return new Promise(function(_0x44712c,_0x213e15){return db[_0xc730('0x16')][_0xc730('0x17')]({'raw':_0x3ba9bc[_0xc730('0x18')]?_0x3ba9bc[_0xc730('0x18')][_0xc730('0x19')]===undefined?!![]:![]:!![],'where':_0x3ba9bc['options']?_0x3ba9bc['options'][_0xc730('0x1a')]||null:null,'attributes':_0x3ba9bc[_0xc730('0x18')]?_0x3ba9bc['options']['attributes']||null:null,'limit':_0x3ba9bc[_0xc730('0x18')]?_0x3ba9bc['options'][_0xc730('0x1b')]||null:null,'include':_0x3ba9bc['options']?_0x3ba9bc[_0xc730('0x18')]['include']?_[_0xc730('0x1c')](_0x3ba9bc[_0xc730('0x18')][_0xc730('0x1d')],function(_0x3e53bf){return{'model':db[_0x3e53bf['model']],'as':_0x3e53bf['as'],'attributes':_0x3e53bf[_0xc730('0x1e')],'include':_0x3e53bf['include']?_[_0xc730('0x1c')](_0x3e53bf[_0xc730('0x1d')],function(_0x553c60){return{'model':db[_0x553c60[_0xc730('0x1f')]],'as':_0x553c60['as'],'attributes':_0x553c60[_0xc730('0x1e')],'include':_0x553c60['include']?_['map'](_0x553c60[_0xc730('0x1d')],function(_0x587f42){return{'model':db[_0x587f42[_0xc730('0x1f')]],'as':_0x587f42['as'],'attributes':_0x587f42[_0xc730('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc730('0x9')](function(_0x3a8d38){logger[_0xc730('0xa')](_0xc730('0x15'),_0x3ba9bc);logger[_0xc730('0xc')](_0xc730('0x15'),_0x3ba9bc,JSON[_0xc730('0xf')](_0x3a8d38));_0x44712c(_0x3a8d38);})[_0xc730('0x14')](function(_0x534dd9){logger[_0xc730('0x10')](_0xc730('0x15'),_0x534dd9[_0xc730('0x12')],_0x3ba9bc);_0x213e15(_0x48281f[_0xc730('0x10')](0x1f4,_0x534dd9[_0xc730('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4bd06c1..fc17332 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 _0xe19c=['../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c8c3e,_0x111a36){var _0x3a2437=function(_0x29246a){while(--_0x29246a){_0x5c8c3e['push'](_0x5c8c3e['shift']());}};_0x3a2437(++_0x111a36);}(_0xe19c,0x13f));var _0xce19=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0xe19c[_0x1c60bd];return _0xc46ef9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xce19('0x0'));var express=require(_0xce19('0x1'));var router=express[_0xce19('0x2')]();var auth=require(_0xce19('0x3'));var interaction=require(_0xce19('0x4'));var config=require(_0xce19('0x5'));var controller=require(_0xce19('0x6'));router[_0xce19('0x7')]('/',auth[_0xce19('0x8')](),controller[_0xce19('0x9')]);router[_0xce19('0x7')](_0xce19('0xa'),auth[_0xce19('0x8')](),controller[_0xce19('0xb')]);router[_0xce19('0xc')]('/',auth[_0xce19('0x8')](),controller[_0xce19('0xd')]);router['put'](_0xce19('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xce19('0xe')](_0xce19('0xa'),auth[_0xce19('0x8')](),controller[_0xce19('0xf')]);module[_0xce19('0x10')]=router; \ No newline at end of file +var _0xe7f1=['/:id','show','post','create','put','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index'];(function(_0x4d60b8,_0x59a4a){var _0x2e5aa1=function(_0x2cbf16){while(--_0x2cbf16){_0x4d60b8['push'](_0x4d60b8['shift']());}};_0x2e5aa1(++_0x59a4a);}(_0xe7f1,0x13a));var _0x1e7f=function(_0x44f220,_0x1ec8bc){_0x44f220=_0x44f220-0x0;var _0x2c786f=_0xe7f1[_0x44f220];return _0x2c786f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1e7f('0x0'));var express=require(_0x1e7f('0x1'));var router=express[_0x1e7f('0x2')]();var auth=require(_0x1e7f('0x3'));var interaction=require(_0x1e7f('0x4'));var config=require('../../config/environment');var controller=require(_0x1e7f('0x5'));router[_0x1e7f('0x6')]('/',auth[_0x1e7f('0x7')](),controller[_0x1e7f('0x8')]);router[_0x1e7f('0x6')](_0x1e7f('0x9'),auth[_0x1e7f('0x7')](),controller[_0x1e7f('0xa')]);router[_0x1e7f('0xb')]('/',auth[_0x1e7f('0x7')](),controller[_0x1e7f('0xc')]);router[_0x1e7f('0xd')]('/:id',auth[_0x1e7f('0x7')](),controller['update']);router[_0x1e7f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1e7f('0xf')]);module[_0x1e7f('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b0c996d..1a03da5 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 _0xf69d=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x4a2939,_0x122ab5){var _0x2aef78=function(_0x49623d){while(--_0x49623d){_0x4a2939['push'](_0x4a2939['shift']());}};_0x2aef78(++_0x122ab5);}(_0xf69d,0xd3));var _0xdf69=function(_0x258880,_0x225cb4){_0x258880=_0x258880-0x0;var _0x14c7df=_0xf69d[_0x258880];return _0x14c7df;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'description':{'type':Sequelize[_0xdf69('0x2')]},'host':{'type':Sequelize[_0xdf69('0x2')]},'user':{'type':Sequelize[_0xdf69('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xdf69('0x3')]},'secure':{'type':Sequelize[_0xdf69('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xdf69('0x2')]},'authentication':{'type':Sequelize[_0xdf69('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfd20=['exports','STRING','BOOLEAN'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0xfd20,0x66));var _0x0fd2=function(_0x1a5fda,_0xf98f89){_0x1a5fda=_0x1a5fda-0x0;var _0x107d8e=_0xfd20[_0x1a5fda];return _0x107d8e;};'use strict';var Sequelize=require('sequelize');module[_0x0fd2('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x0fd2('0x1')]},'pass':{'type':Sequelize[_0x0fd2('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x0fd2('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0fd2('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3cf1f2a..e3887ba 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 _0x88b6=['options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','MailServerOut','rawAttributes','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','name','where','includeAll','include','findAll','rows','catch','show','params'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x88b6,0x196));var _0x688b=function(_0x27784c,_0x702685){_0x27784c=_0x27784c-0x0;var _0x79c675=_0x88b6[_0x27784c];return _0x79c675;};'use strict';var pdf=require(_0x688b('0x0'));var emlformat=require(_0x688b('0x1'));var rimraf=require(_0x688b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x688b('0x3'));var rp=require(_0x688b('0x4'));var moment=require('moment');var BPromise=require(_0x688b('0x5'));var Mustache=require('mustache');var util=require(_0x688b('0x6'));var path=require(_0x688b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x688b('0x8'));var fs=require('fs');var _=require(_0x688b('0x9'));var squel=require('squel');var crypto=require(_0x688b('0xa'));var jsforce=require(_0x688b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x688b('0xc'));var Papa=require(_0x688b('0xd'));var Redis=require('ioredis');var authService=require(_0x688b('0xe'));var qs=require(_0x688b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x688b('0x10'));var logger=require('../../config/logger')(_0x688b('0x11'));var utils=require(_0x688b('0x12'));var config=require(_0x688b('0x13'));var db=require(_0x688b('0x14'))['db'];function respondWithStatusCode(_0x16df7f,_0x176275){_0x176275=_0x176275||0xcc;return function(_0x25b9f5){if(_0x25b9f5){return _0x16df7f[_0x688b('0x15')](_0x176275);}return _0x16df7f[_0x688b('0x16')](_0x176275)[_0x688b('0x17')]();};}function respondWithResult(_0x2c6c16,_0x4a2955){_0x4a2955=_0x4a2955||0xc8;return function(_0x21c21a){if(_0x21c21a){return _0x2c6c16[_0x688b('0x16')](_0x4a2955)['json'](_0x21c21a);}};}function respondWithFilteredResult(_0x2c8f96,_0x132348){return function(_0x44af42){if(_0x44af42){var _0x3375de=_0x44af42[_0x688b('0x18')],_0x24f62e=_0x132348[_0x688b('0x19')],_0x2e602a=_0x132348[_0x688b('0x19')]+_0x132348['limit'],_0x168156;if(_0x2e602a>=_0x3375de){_0x2e602a=_0x3375de;_0x168156=0xc8;}else{_0x168156=0xce;}_0x2c8f96[_0x688b('0x16')](_0x168156);return _0x2c8f96[_0x688b('0x1a')](_0x688b('0x1b'),_0x24f62e+'-'+_0x2e602a+'/'+_0x3375de)['json'](_0x44af42);}return null;};}function patchUpdates(_0x586851){return function(_0x14646e){try{jsonpatch[_0x688b('0x1c')](_0x14646e,_0x586851,!![]);}catch(_0x9f16c1){return BPromise[_0x688b('0x1d')](_0x9f16c1);}return _0x14646e[_0x688b('0x1e')]();};}function saveUpdates(_0x289b5e,_0x3ae8a4){return function(_0x3c9ef4){if(_0x3c9ef4){return _0x3c9ef4[_0x688b('0x1f')](_0x289b5e)[_0x688b('0x20')](function(_0x1479d6){return _0x1479d6;});}return null;};}function removeEntity(_0x3ae0be,_0xc88d94){return function(_0x1bb4cb){if(_0x1bb4cb){return _0x1bb4cb[_0x688b('0x21')]()[_0x688b('0x20')](function(){_0x3ae0be['status'](0xcc)[_0x688b('0x17')]();});}};}function handleEntityNotFound(_0x4f11b1,_0xa8e554){return function(_0x47fe32){if(!_0x47fe32){_0x4f11b1[_0x688b('0x15')](0x194);}return _0x47fe32;};}function handleError(_0x21c958,_0xe393a){_0xe393a=_0xe393a||0x1f4;return function(_0xf5db91){logger[_0x688b('0x22')](_0xf5db91['stack']);if(_0xf5db91['name']){delete _0xf5db91['name'];}_0x21c958[_0x688b('0x16')](_0xe393a)[_0x688b('0x23')](_0xf5db91);};}exports[_0x688b('0x24')]=function(_0x3ab78d,_0x1db836){var _0x137b59={},_0x28c19d={},_0x513fb3={'count':0x0,'rows':[]};var _0x57c78c=_['map'](db[_0x688b('0x25')][_0x688b('0x26')],function(_0x3726aa){return{'name':_0x3726aa['fieldName'],'type':_0x3726aa['type']['key']};});_0x28c19d['model']=_[_0x688b('0x27')](_0x57c78c,'name');_0x28c19d[_0x688b('0x28')]=_[_0x688b('0x29')](_0x3ab78d[_0x688b('0x28')]);_0x28c19d[_0x688b('0x2a')]=_[_0x688b('0x2b')](_0x28c19d['model'],_0x28c19d['query']);_0x137b59[_0x688b('0x2c')]=_['intersection'](_0x28c19d[_0x688b('0x2d')],qs[_0x688b('0x2e')](_0x3ab78d['query'][_0x688b('0x2e')]));_0x137b59['attributes']=_0x137b59[_0x688b('0x2c')][_0x688b('0x2f')]?_0x137b59[_0x688b('0x2c')]:_0x28c19d[_0x688b('0x2d')];if(!_0x3ab78d[_0x688b('0x28')][_0x688b('0x30')](_0x688b('0x31'))){_0x137b59[_0x688b('0x32')]=qs[_0x688b('0x32')](_0x3ab78d[_0x688b('0x28')][_0x688b('0x32')]);_0x137b59[_0x688b('0x19')]=qs[_0x688b('0x19')](_0x3ab78d[_0x688b('0x28')]['offset']);}_0x137b59['order']=qs['sort'](_0x3ab78d['query'][_0x688b('0x33')]);_0x137b59['where']=qs['filters'](_[_0x688b('0x34')](_0x3ab78d['query'],_0x28c19d[_0x688b('0x2a')]),_0x57c78c);if(_0x3ab78d[_0x688b('0x28')]['filter']){_0x137b59['where']=_[_0x688b('0x35')](_0x137b59['where'],{'$or':_[_0x688b('0x27')](_0x57c78c,function(_0x9adac0){if(_0x9adac0['type']!=='VIRTUAL'){var _0x4a3213={};_0x4a3213[_0x9adac0[_0x688b('0x36')]]={'$like':'%'+_0x3ab78d['query']['filter']+'%'};return _0x4a3213;}})});}_0x137b59=_['merge']({},_0x137b59,_0x3ab78d['options']);var _0xaddd1b={'where':_0x137b59[_0x688b('0x37')]};return db[_0x688b('0x25')][_0x688b('0x18')](_0xaddd1b)[_0x688b('0x20')](function(_0x5c2551){_0x513fb3[_0x688b('0x18')]=_0x5c2551;if(_0x3ab78d[_0x688b('0x28')][_0x688b('0x38')]){_0x137b59[_0x688b('0x39')]=[{'all':!![]}];}return db[_0x688b('0x25')][_0x688b('0x3a')](_0x137b59);})['then'](function(_0x2c441d){_0x513fb3[_0x688b('0x3b')]=_0x2c441d;return _0x513fb3;})[_0x688b('0x20')](respondWithFilteredResult(_0x1db836,_0x137b59))[_0x688b('0x3c')](handleError(_0x1db836,null));};exports[_0x688b('0x3d')]=function(_0x4fecf7,_0x17be92){var _0x47e9ae={'raw':!![],'where':{'id':_0x4fecf7[_0x688b('0x3e')]['id']}},_0xeafa0d={};_0xeafa0d[_0x688b('0x2d')]=_[_0x688b('0x29')](db[_0x688b('0x25')][_0x688b('0x26')]);_0xeafa0d['query']=_[_0x688b('0x29')](_0x4fecf7[_0x688b('0x28')]);_0xeafa0d[_0x688b('0x2a')]=_[_0x688b('0x2b')](_0xeafa0d['model'],_0xeafa0d[_0x688b('0x28')]);_0x47e9ae[_0x688b('0x2c')]=_[_0x688b('0x2b')](_0xeafa0d[_0x688b('0x2d')],qs['fields'](_0x4fecf7[_0x688b('0x28')][_0x688b('0x2e')]));_0x47e9ae[_0x688b('0x2c')]=_0x47e9ae[_0x688b('0x2c')][_0x688b('0x2f')]?_0x47e9ae[_0x688b('0x2c')]:_0xeafa0d[_0x688b('0x2d')];if(_0x4fecf7[_0x688b('0x28')][_0x688b('0x38')]){_0x47e9ae[_0x688b('0x39')]=[{'all':!![]}];}_0x47e9ae=_[_0x688b('0x35')]({},_0x47e9ae,_0x4fecf7[_0x688b('0x3f')]);return db[_0x688b('0x25')][_0x688b('0x40')](_0x47e9ae)['then'](handleEntityNotFound(_0x17be92,null))['then'](respondWithResult(_0x17be92,null))[_0x688b('0x3c')](handleError(_0x17be92,null));};exports[_0x688b('0x41')]=function(_0x4f5061,_0x3b72af){return db[_0x688b('0x25')][_0x688b('0x41')](_0x4f5061['body'],{})[_0x688b('0x20')](respondWithResult(_0x3b72af,0xc9))[_0x688b('0x3c')](handleError(_0x3b72af,null));};exports[_0x688b('0x1f')]=function(_0x1298f3,_0x1b181a){if(_0x1298f3[_0x688b('0x42')]['id']){delete _0x1298f3[_0x688b('0x42')]['id'];}return db[_0x688b('0x25')][_0x688b('0x40')]({'where':{'id':_0x1298f3[_0x688b('0x3e')]['id']}})[_0x688b('0x20')](handleEntityNotFound(_0x1b181a,null))[_0x688b('0x20')](saveUpdates(_0x1298f3['body'],null))[_0x688b('0x20')](respondWithResult(_0x1b181a,null))['catch'](handleError(_0x1b181a,null));};exports[_0x688b('0x21')]=function(_0x80fc0d,_0x5eb965){return db['MailServerOut']['find']({'where':{'id':_0x80fc0d[_0x688b('0x3e')]['id']}})[_0x688b('0x20')](handleEntityNotFound(_0x5eb965,null))['then'](removeEntity(_0x5eb965,null))[_0x688b('0x3c')](handleError(_0x5eb965,null));}; \ No newline at end of file +var _0xb375=['catch','show','params','rawAttributes','include','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','fieldName','key','model','keys','intersection','query','attributes','fields','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb375,0x9f));var _0x5b37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb375[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5b37('0x0'));var emlformat=require(_0x5b37('0x1'));var rimraf=require(_0x5b37('0x2'));var zipdir=require(_0x5b37('0x3'));var jsonpatch=require(_0x5b37('0x4'));var rp=require(_0x5b37('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b37('0x6'));var util=require(_0x5b37('0x7'));var path=require(_0x5b37('0x8'));var sox=require(_0x5b37('0x9'));var csv=require('to-csv');var ejs=require(_0x5b37('0xa'));var fs=require('fs');var _=require(_0x5b37('0xb'));var squel=require(_0x5b37('0xc'));var crypto=require(_0x5b37('0xd'));var jsforce=require(_0x5b37('0xe'));var deskjs=require(_0x5b37('0xf'));var toCsv=require(_0x5b37('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b37('0x11'));var authService=require(_0x5b37('0x12'));var qs=require(_0x5b37('0x13'));var as=require(_0x5b37('0x14'));var hardwareService=require(_0x5b37('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5b37('0x16'));var config=require(_0x5b37('0x17'));var db=require(_0x5b37('0x18'))['db'];function respondWithStatusCode(_0x3cfcb6,_0x1063b6){_0x1063b6=_0x1063b6||0xcc;return function(_0x5a5997){if(_0x5a5997){return _0x3cfcb6[_0x5b37('0x19')](_0x1063b6);}return _0x3cfcb6['status'](_0x1063b6)[_0x5b37('0x1a')]();};}function respondWithResult(_0x332bfe,_0x5e2df6){_0x5e2df6=_0x5e2df6||0xc8;return function(_0x568e73){if(_0x568e73){return _0x332bfe[_0x5b37('0x1b')](_0x5e2df6)[_0x5b37('0x1c')](_0x568e73);}};}function respondWithFilteredResult(_0x4d5de8,_0x59bdcf){return function(_0x53d8db){if(_0x53d8db){var _0x1ff884=_0x53d8db[_0x5b37('0x1d')],_0x5225de=_0x59bdcf[_0x5b37('0x1e')],_0x2527a9=_0x59bdcf[_0x5b37('0x1e')]+_0x59bdcf[_0x5b37('0x1f')],_0x16af61;if(_0x2527a9>=_0x1ff884){_0x2527a9=_0x1ff884;_0x16af61=0xc8;}else{_0x16af61=0xce;}_0x4d5de8[_0x5b37('0x1b')](_0x16af61);return _0x4d5de8[_0x5b37('0x20')](_0x5b37('0x21'),_0x5225de+'-'+_0x2527a9+'/'+_0x1ff884)[_0x5b37('0x1c')](_0x53d8db);}return null;};}function patchUpdates(_0x5ccba6){return function(_0x122f87){try{jsonpatch[_0x5b37('0x22')](_0x122f87,_0x5ccba6,!![]);}catch(_0x38d357){return BPromise[_0x5b37('0x23')](_0x38d357);}return _0x122f87[_0x5b37('0x24')]();};}function saveUpdates(_0x31f53a,_0x4e713d){return function(_0x3b90e9){if(_0x3b90e9){return _0x3b90e9[_0x5b37('0x25')](_0x31f53a)[_0x5b37('0x26')](function(_0xc9c38e){return _0xc9c38e;});}return null;};}function removeEntity(_0x3bb6b1,_0x1697c0){return function(_0x2ac765){if(_0x2ac765){return _0x2ac765[_0x5b37('0x27')]()['then'](function(){_0x3bb6b1[_0x5b37('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a4bc,_0x535684){return function(_0x12a183){if(!_0x12a183){_0x39a4bc['sendStatus'](0x194);}return _0x12a183;};}function handleError(_0x308a85,_0xee21e9){_0xee21e9=_0xee21e9||0x1f4;return function(_0x1aac15){logger['error'](_0x1aac15[_0x5b37('0x28')]);if(_0x1aac15['name']){delete _0x1aac15[_0x5b37('0x29')];}_0x308a85[_0x5b37('0x1b')](_0xee21e9)[_0x5b37('0x2a')](_0x1aac15);};}exports[_0x5b37('0x2b')]=function(_0x502289,_0x3f4c43){var _0x1e335a={},_0x1f3e99={},_0x12db50={'count':0x0,'rows':[]};var _0x347c0d=_[_0x5b37('0x2c')](db[_0x5b37('0x2d')]['rawAttributes'],function(_0x9f67ce){return{'name':_0x9f67ce[_0x5b37('0x2e')],'type':_0x9f67ce['type'][_0x5b37('0x2f')]};});_0x1f3e99[_0x5b37('0x30')]=_[_0x5b37('0x2c')](_0x347c0d,_0x5b37('0x29'));_0x1f3e99['query']=_[_0x5b37('0x31')](_0x502289['query']);_0x1f3e99['filters']=_[_0x5b37('0x32')](_0x1f3e99[_0x5b37('0x30')],_0x1f3e99[_0x5b37('0x33')]);_0x1e335a[_0x5b37('0x34')]=_['intersection'](_0x1f3e99[_0x5b37('0x30')],qs[_0x5b37('0x35')](_0x502289[_0x5b37('0x33')][_0x5b37('0x35')]));_0x1e335a['attributes']=_0x1e335a[_0x5b37('0x34')]['length']?_0x1e335a[_0x5b37('0x34')]:_0x1f3e99[_0x5b37('0x30')];if(!_0x502289['query']['hasOwnProperty'](_0x5b37('0x36'))){_0x1e335a[_0x5b37('0x1f')]=qs[_0x5b37('0x1f')](_0x502289[_0x5b37('0x33')][_0x5b37('0x1f')]);_0x1e335a[_0x5b37('0x1e')]=qs['offset'](_0x502289[_0x5b37('0x33')][_0x5b37('0x1e')]);}_0x1e335a[_0x5b37('0x37')]=qs[_0x5b37('0x38')](_0x502289['query'][_0x5b37('0x38')]);_0x1e335a[_0x5b37('0x39')]=qs[_0x5b37('0x3a')](_[_0x5b37('0x3b')](_0x502289[_0x5b37('0x33')],_0x1f3e99[_0x5b37('0x3a')]),_0x347c0d);if(_0x502289[_0x5b37('0x33')]['filter']){_0x1e335a[_0x5b37('0x39')]=_['merge'](_0x1e335a[_0x5b37('0x39')],{'$or':_[_0x5b37('0x2c')](_0x347c0d,function(_0x5dac06){if(_0x5dac06[_0x5b37('0x3c')]!==_0x5b37('0x3d')){var _0x1090d9={};_0x1090d9[_0x5dac06[_0x5b37('0x29')]]={'$like':'%'+_0x502289[_0x5b37('0x33')][_0x5b37('0x3e')]+'%'};return _0x1090d9;}})});}_0x1e335a=_[_0x5b37('0x3f')]({},_0x1e335a,_0x502289['options']);var _0x16ff69={'where':_0x1e335a[_0x5b37('0x39')]};return db[_0x5b37('0x2d')][_0x5b37('0x1d')](_0x16ff69)['then'](function(_0x482eab){_0x12db50[_0x5b37('0x1d')]=_0x482eab;if(_0x502289[_0x5b37('0x33')][_0x5b37('0x40')]){_0x1e335a['include']=[{'all':!![]}];}return db[_0x5b37('0x2d')]['findAll'](_0x1e335a);})[_0x5b37('0x26')](function(_0x5a65dd){_0x12db50[_0x5b37('0x41')]=_0x5a65dd;return _0x12db50;})[_0x5b37('0x26')](respondWithFilteredResult(_0x3f4c43,_0x1e335a))[_0x5b37('0x42')](handleError(_0x3f4c43,null));};exports[_0x5b37('0x43')]=function(_0x3a3291,_0x87bf8b){var _0x2b695c={'raw':!![],'where':{'id':_0x3a3291[_0x5b37('0x44')]['id']}},_0x49e481={};_0x49e481[_0x5b37('0x30')]=_['keys'](db[_0x5b37('0x2d')][_0x5b37('0x45')]);_0x49e481[_0x5b37('0x33')]=_[_0x5b37('0x31')](_0x3a3291['query']);_0x49e481[_0x5b37('0x3a')]=_['intersection'](_0x49e481[_0x5b37('0x30')],_0x49e481[_0x5b37('0x33')]);_0x2b695c[_0x5b37('0x34')]=_[_0x5b37('0x32')](_0x49e481[_0x5b37('0x30')],qs[_0x5b37('0x35')](_0x3a3291[_0x5b37('0x33')]['fields']));_0x2b695c[_0x5b37('0x34')]=_0x2b695c[_0x5b37('0x34')]['length']?_0x2b695c['attributes']:_0x49e481[_0x5b37('0x30')];if(_0x3a3291[_0x5b37('0x33')][_0x5b37('0x40')]){_0x2b695c[_0x5b37('0x46')]=[{'all':!![]}];}_0x2b695c=_[_0x5b37('0x3f')]({},_0x2b695c,_0x3a3291[_0x5b37('0x47')]);return db[_0x5b37('0x2d')]['find'](_0x2b695c)[_0x5b37('0x26')](handleEntityNotFound(_0x87bf8b,null))[_0x5b37('0x26')](respondWithResult(_0x87bf8b,null))[_0x5b37('0x42')](handleError(_0x87bf8b,null));};exports[_0x5b37('0x48')]=function(_0x4d166d,_0x3cf1e0){return db[_0x5b37('0x2d')][_0x5b37('0x48')](_0x4d166d['body'],{})[_0x5b37('0x26')](respondWithResult(_0x3cf1e0,0xc9))[_0x5b37('0x42')](handleError(_0x3cf1e0,null));};exports[_0x5b37('0x25')]=function(_0x5f06f9,_0x19fd0d){if(_0x5f06f9['body']['id']){delete _0x5f06f9[_0x5b37('0x49')]['id'];}return db[_0x5b37('0x2d')]['find']({'where':{'id':_0x5f06f9[_0x5b37('0x44')]['id']}})[_0x5b37('0x26')](handleEntityNotFound(_0x19fd0d,null))[_0x5b37('0x26')](saveUpdates(_0x5f06f9[_0x5b37('0x49')],null))[_0x5b37('0x26')](respondWithResult(_0x19fd0d,null))[_0x5b37('0x42')](handleError(_0x19fd0d,null));};exports[_0x5b37('0x27')]=function(_0x596212,_0x37df8b){return db['MailServerOut'][_0x5b37('0x4a')]({'where':{'id':_0x596212[_0x5b37('0x44')]['id']}})[_0x5b37('0x26')](handleEntityNotFound(_0x37df8b,null))[_0x5b37('0x26')](removeEntity(_0x37df8b,null))[_0x5b37('0x42')](handleError(_0x37df8b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index eb164fc..b9fd7f3 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','mail_servers_out','lodash'];(function(_0x322d60,_0x25339b){var _0x476ef1=function(_0x231973){while(--_0x231973){_0x322d60['push'](_0x322d60['shift']());}};_0x476ef1(++_0x25339b);}(_0xabce,0x103));var _0xeabc=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xabce[_0x411add];return _0x238242;};'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('./mailServerOut.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('MailServerOut',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ca=['define','mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5dfc4a,_0xe9b409){var _0xd127b4=function(_0x3592fc){while(--_0x3592fc){_0x5dfc4a['push'](_0x5dfc4a['shift']());}};_0xd127b4(++_0xe9b409);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0xf2ca[_0x57cc22];return _0x6f7bdc;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./mailServerOut.attributes');module[_0xaf2c('0x9')]=function(_0x100d17,_0x297740){return _0x100d17[_0xaf2c('0xa')]('MailServerOut',attributes,{'tableName':_0xaf2c('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 5a24b92..c2cfd20 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 _0x28b2=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x148915,_0x36b71d){var _0x4dc4a5=function(_0x313079){while(--_0x313079){_0x148915['push'](_0x148915['shift']());}};_0x4dc4a5(++_0x36b71d);}(_0x28b2,0xae));var _0x228b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x28b2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x228b('0x0'));var moment=require(_0x228b('0x1'));var BPromise=require(_0x228b('0x2'));var rs=require(_0x228b('0x3'));var fs=require('fs');var Redis=require(_0x228b('0x4'));var db=require(_0x228b('0x5'))['db'];var utils=require(_0x228b('0x6'));var logger=require('../../config/logger')(_0x228b('0x7'));var config=require(_0x228b('0x8'));var jayson=require(_0x228b('0x9'));var client=jayson['client'][_0x228b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fce0,_0x46b83e,_0xa197ff){return new BPromise(function(_0x38603f,_0x187ad7){return client[_0x228b('0xb')](_0x11fce0,_0xa197ff)[_0x228b('0xc')](function(_0x45beb3){logger[_0x228b('0xd')](_0x228b('0xe'),_0x46b83e,_0x228b('0xf'));logger[_0x228b('0x10')](_0x228b('0x11'),_0x46b83e,_0x228b('0xf'),JSON[_0x228b('0x12')](_0x45beb3));if(_0x45beb3[_0x228b('0x13')]){if(_0x45beb3[_0x228b('0x13')][_0x228b('0x14')]===0x1f4){logger[_0x228b('0x13')](_0x228b('0xe'),_0x46b83e,_0x45beb3['error']['message']);return _0x187ad7(_0x45beb3[_0x228b('0x13')][_0x228b('0x15')]);}logger[_0x228b('0x13')]('MailServerOut,\x20%s,\x20%s',_0x46b83e,_0x45beb3[_0x228b('0x13')]['message']);return _0x38603f(_0x45beb3['error']['message']);}else{logger[_0x228b('0xd')](_0x228b('0xe'),_0x46b83e,'request\x20sent');_0x38603f(_0x45beb3[_0x228b('0x16')][_0x228b('0x15')]);}})[_0x228b('0x17')](function(_0x591fda){logger['error'](_0x228b('0xe'),_0x46b83e,_0x591fda);_0x187ad7(_0x591fda);});});} \ No newline at end of file +var _0x6028=['MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3a441b,_0x342fd3){var _0x1dbd8d=function(_0x1d2072){while(--_0x1d2072){_0x3a441b['push'](_0x3a441b['shift']());}};_0x1dbd8d(++_0x342fd3);}(_0x6028,0x1d0));var _0x8602=function(_0x78cb06,_0x5b3722){_0x78cb06=_0x78cb06-0x0;var _0x5910d5=_0x6028[_0x78cb06];return _0x5910d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8602('0x0'));var rs=require(_0x8602('0x1'));var fs=require('fs');var Redis=require(_0x8602('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8602('0x3'));var logger=require(_0x8602('0x4'))('rpc');var config=require(_0x8602('0x5'));var jayson=require(_0x8602('0x6'));var client=jayson[_0x8602('0x7')][_0x8602('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bd6e3,_0x51ec63,_0x2e000b){return new BPromise(function(_0x78d61c,_0x53e981){return client['request'](_0x3bd6e3,_0x2e000b)[_0x8602('0x9')](function(_0x49eb9f){logger[_0x8602('0xa')](_0x8602('0xb'),_0x51ec63,'request\x20sent');logger['debug'](_0x8602('0xc'),_0x51ec63,_0x8602('0xd'),JSON[_0x8602('0xe')](_0x49eb9f));if(_0x49eb9f[_0x8602('0xf')]){if(_0x49eb9f['error'][_0x8602('0x10')]===0x1f4){logger['error'](_0x8602('0xb'),_0x51ec63,_0x49eb9f[_0x8602('0xf')][_0x8602('0x11')]);return _0x53e981(_0x49eb9f[_0x8602('0xf')]['message']);}logger[_0x8602('0xf')](_0x8602('0xb'),_0x51ec63,_0x49eb9f[_0x8602('0xf')][_0x8602('0x11')]);return _0x78d61c(_0x49eb9f[_0x8602('0xf')][_0x8602('0x11')]);}else{logger[_0x8602('0xa')](_0x8602('0xb'),_0x51ec63,'request\x20sent');_0x78d61c(_0x49eb9f[_0x8602('0x12')]['message']);}})['catch'](function(_0x8a24f6){logger[_0x8602('0xf')](_0x8602('0xb'),_0x51ec63,_0x8a24f6);_0x53e981(_0x8a24f6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 75fd9fa..e2bf7db 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 _0x75df=['index','/describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x75df,0xbd));var _0xf75d=function(_0x150203,_0x5878ca){_0x150203=_0x150203-0x0;var _0x218b7c=_0x75df[_0x150203];return _0x218b7c;};'use strict';var multer=require('multer');var util=require(_0xf75d('0x0'));var path=require(_0xf75d('0x1'));var timeout=require(_0xf75d('0x2'));var express=require('express');var router=express[_0xf75d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf75d('0x4'));var config=require(_0xf75d('0x5'));var controller=require(_0xf75d('0x6'));router[_0xf75d('0x7')]('/',auth[_0xf75d('0x8')](),controller[_0xf75d('0x9')]);router[_0xf75d('0x7')](_0xf75d('0xa'),auth[_0xf75d('0x8')](),controller['describe']);router[_0xf75d('0x7')](_0xf75d('0xb'),auth[_0xf75d('0x8')](),controller['show']);router[_0xf75d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf75d('0xd')]);router[_0xf75d('0xe')](_0xf75d('0xb'),auth[_0xf75d('0x8')](),controller[_0xf75d('0xf')]);router['delete'](_0xf75d('0xb'),auth[_0xf75d('0x8')](),controller[_0xf75d('0x10')]);module[_0xf75d('0x11')]=router; \ No newline at end of file +var _0xa247=['../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2d1611,_0x1bbfd5){var _0x13f856=function(_0x542a31){while(--_0x542a31){_0x2d1611['push'](_0x2d1611['shift']());}};_0x13f856(++_0x1bbfd5);}(_0xa247,0xa6));var _0x7a24=function(_0x1451b2,_0x242549){_0x1451b2=_0x1451b2-0x0;var _0x8dea7f=_0xa247[_0x1451b2];return _0x8dea7f;};'use strict';var multer=require(_0x7a24('0x0'));var util=require('util');var path=require(_0x7a24('0x1'));var timeout=require(_0x7a24('0x2'));var express=require(_0x7a24('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7a24('0x4'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x7a24('0x5')]('/',auth[_0x7a24('0x6')](),controller['index']);router[_0x7a24('0x5')](_0x7a24('0x7'),auth[_0x7a24('0x6')](),controller[_0x7a24('0x8')]);router[_0x7a24('0x5')](_0x7a24('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7a24('0xa')]('/',auth[_0x7a24('0x6')](),controller[_0x7a24('0xb')]);router[_0x7a24('0xc')]('/:id',auth[_0x7a24('0x6')](),controller[_0x7a24('0xd')]);router[_0x7a24('0xe')](_0x7a24('0x9'),auth[_0x7a24('0x6')](),controller[_0x7a24('0xf')]);module[_0x7a24('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 530f011..0ffe535 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 _0xd9fb=['name','sequelize','exports','STRING'];(function(_0x2ea163,_0x361f0c){var _0x1e420f=function(_0x55862c){while(--_0x55862c){_0x2ea163['push'](_0x2ea163['shift']());}};_0x1e420f(++_0x361f0c);}(_0xd9fb,0x189));var _0xbd9f=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xd9fb[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0xbd9f('0x0'));module[_0xbd9f('0x1')]={'name':{'type':Sequelize[_0xbd9f('0x2')],'unique':_0xbd9f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbd9f('0x2')]}}; \ No newline at end of file +var _0x225b=['STRING','sequelize','exports','name'];(function(_0x49d766,_0x47686f){var _0x3a1074=function(_0x4f74f2){while(--_0x4f74f2){_0x49d766['push'](_0x49d766['shift']());}};_0x3a1074(++_0x47686f);}(_0x225b,0xb1));var _0xb225=function(_0xac809c,_0xfd99bf){_0xac809c=_0xac809c-0x0;var _0x761fa8=_0x225b[_0xac809c];return _0x761fa8;};'use strict';var Sequelize=require(_0xb225('0x0'));module[_0xb225('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb225('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb225('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0400c8b..9ce86a4 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 _0x83cc=['query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body','destroy','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','save','update','then','error','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','name'];(function(_0x4ac076,_0x941c2f){var _0x1bcc7e=function(_0x472f12){while(--_0x472f12){_0x4ac076['push'](_0x4ac076['shift']());}};_0x1bcc7e(++_0x941c2f);}(_0x83cc,0x144));var _0xc83c=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x83cc[_0x18b5e8];return _0x25baed;};'use strict';var pdf=require(_0xc83c('0x0'));var emlformat=require(_0xc83c('0x1'));var rimraf=require(_0xc83c('0x2'));var zipdir=require(_0xc83c('0x3'));var jsonpatch=require(_0xc83c('0x4'));var rp=require(_0xc83c('0x5'));var moment=require(_0xc83c('0x6'));var BPromise=require(_0xc83c('0x7'));var Mustache=require(_0xc83c('0x8'));var util=require('util');var path=require(_0xc83c('0x9'));var sox=require('sox');var csv=require(_0xc83c('0xa'));var ejs=require(_0xc83c('0xb'));var fs=require('fs');var _=require(_0xc83c('0xc'));var squel=require(_0xc83c('0xd'));var crypto=require(_0xc83c('0xe'));var jsforce=require(_0xc83c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc83c('0xa'));var querystring=require('querystring');var Papa=require(_0xc83c('0x10'));var Redis=require(_0xc83c('0x11'));var authService=require(_0xc83c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc83c('0x13'));var hardwareService=require(_0xc83c('0x14'));var logger=require(_0xc83c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc83c('0x16'));var db=require(_0xc83c('0x17'))['db'];function respondWithStatusCode(_0xfa53c6,_0xf535ad){_0xf535ad=_0xf535ad||0xcc;return function(_0xaa7228){if(_0xaa7228){return _0xfa53c6[_0xc83c('0x18')](_0xf535ad);}return _0xfa53c6['status'](_0xf535ad)['end']();};}function respondWithResult(_0x3251f5,_0x45bdad){_0x45bdad=_0x45bdad||0xc8;return function(_0x562567){if(_0x562567){return _0x3251f5[_0xc83c('0x19')](_0x45bdad)['json'](_0x562567);}};}function respondWithFilteredResult(_0x1a359d,_0xf944fb){return function(_0x52148c){if(_0x52148c){var _0x3be419=_0x52148c[_0xc83c('0x1a')],_0x3c4ffb=_0xf944fb['offset'],_0x39dd53=_0xf944fb[_0xc83c('0x1b')]+_0xf944fb[_0xc83c('0x1c')],_0x32ecd9;if(_0x39dd53>=_0x3be419){_0x39dd53=_0x3be419;_0x32ecd9=0xc8;}else{_0x32ecd9=0xce;}_0x1a359d['status'](_0x32ecd9);return _0x1a359d[_0xc83c('0x1d')]('Content-Range',_0x3c4ffb+'-'+_0x39dd53+'/'+_0x3be419)['json'](_0x52148c);}return null;};}function patchUpdates(_0x46d7a4){return function(_0x3e3b6b){try{jsonpatch[_0xc83c('0x1e')](_0x3e3b6b,_0x46d7a4,!![]);}catch(_0xe48f9b){return BPromise[_0xc83c('0x1f')](_0xe48f9b);}return _0x3e3b6b[_0xc83c('0x20')]();};}function saveUpdates(_0x42a026,_0x3ecf01){return function(_0x4c87a9){if(_0x4c87a9){return _0x4c87a9[_0xc83c('0x21')](_0x42a026)['then'](function(_0x5a24cb){return _0x5a24cb;});}return null;};}function removeEntity(_0x479afb,_0x363a72){return function(_0x84c5f3){if(_0x84c5f3){return _0x84c5f3['destroy']()[_0xc83c('0x22')](function(){_0x479afb[_0xc83c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a915,_0x3d8987){return function(_0x39a576){if(!_0x39a576){_0x35a915['sendStatus'](0x194);}return _0x39a576;};}function handleError(_0x180df8,_0x318fc8){_0x318fc8=_0x318fc8||0x1f4;return function(_0x168467){logger[_0xc83c('0x23')](_0x168467[_0xc83c('0x24')]);if(_0x168467['name']){delete _0x168467['name'];}_0x180df8[_0xc83c('0x19')](_0x318fc8)[_0xc83c('0x25')](_0x168467);};}exports[_0xc83c('0x26')]=function(_0x9ea943,_0x2ba96f){var _0x37e86d={},_0x13f8ce={},_0x407036={'count':0x0,'rows':[]};var _0x3fed19=_[_0xc83c('0x27')](db[_0xc83c('0x28')][_0xc83c('0x29')],function(_0x2b196c){return{'name':_0x2b196c[_0xc83c('0x2a')],'type':_0x2b196c[_0xc83c('0x2b')][_0xc83c('0x2c')]};});_0x13f8ce['model']=_[_0xc83c('0x27')](_0x3fed19,_0xc83c('0x2d'));_0x13f8ce[_0xc83c('0x2e')]=_[_0xc83c('0x2f')](_0x9ea943[_0xc83c('0x2e')]);_0x13f8ce[_0xc83c('0x30')]=_[_0xc83c('0x31')](_0x13f8ce['model'],_0x13f8ce['query']);_0x37e86d['attributes']=_['intersection'](_0x13f8ce['model'],qs['fields'](_0x9ea943[_0xc83c('0x2e')]['fields']));_0x37e86d[_0xc83c('0x32')]=_0x37e86d['attributes'][_0xc83c('0x33')]?_0x37e86d[_0xc83c('0x32')]:_0x13f8ce[_0xc83c('0x34')];if(!_0x9ea943['query'][_0xc83c('0x35')](_0xc83c('0x36'))){_0x37e86d[_0xc83c('0x1c')]=qs[_0xc83c('0x1c')](_0x9ea943[_0xc83c('0x2e')][_0xc83c('0x1c')]);_0x37e86d[_0xc83c('0x1b')]=qs[_0xc83c('0x1b')](_0x9ea943[_0xc83c('0x2e')]['offset']);}_0x37e86d['order']=qs[_0xc83c('0x37')](_0x9ea943[_0xc83c('0x2e')][_0xc83c('0x37')]);_0x37e86d[_0xc83c('0x38')]=qs[_0xc83c('0x30')](_[_0xc83c('0x39')](_0x9ea943['query'],_0x13f8ce['filters']),_0x3fed19);if(_0x9ea943[_0xc83c('0x2e')][_0xc83c('0x3a')]){_0x37e86d[_0xc83c('0x38')]=_[_0xc83c('0x3b')](_0x37e86d['where'],{'$or':_[_0xc83c('0x27')](_0x3fed19,function(_0x14c278){if(_0x14c278[_0xc83c('0x2b')]!==_0xc83c('0x3c')){var _0x356562={};_0x356562[_0x14c278[_0xc83c('0x2d')]]={'$like':'%'+_0x9ea943[_0xc83c('0x2e')][_0xc83c('0x3a')]+'%'};return _0x356562;}})});}_0x37e86d=_[_0xc83c('0x3b')]({},_0x37e86d,_0x9ea943[_0xc83c('0x3d')]);var _0x116899={'where':_0x37e86d[_0xc83c('0x38')]};return db[_0xc83c('0x28')]['count'](_0x116899)['then'](function(_0x1993ef){_0x407036[_0xc83c('0x1a')]=_0x1993ef;if(_0x9ea943[_0xc83c('0x2e')][_0xc83c('0x3e')]){_0x37e86d[_0xc83c('0x3f')]=[{'all':!![]}];}return db[_0xc83c('0x28')]['findAll'](_0x37e86d);})['then'](function(_0x348853){_0x407036[_0xc83c('0x40')]=_0x348853;return _0x407036;})[_0xc83c('0x22')](respondWithFilteredResult(_0x2ba96f,_0x37e86d))[_0xc83c('0x41')](handleError(_0x2ba96f,null));};exports[_0xc83c('0x42')]=function(_0x2b4d09,_0x1589a1){var _0x26fe39={'raw':!![],'where':{'id':_0x2b4d09['params']['id']}},_0x2f54fe={};_0x2f54fe[_0xc83c('0x34')]=_[_0xc83c('0x2f')](db[_0xc83c('0x28')][_0xc83c('0x29')]);_0x2f54fe[_0xc83c('0x2e')]=_[_0xc83c('0x2f')](_0x2b4d09[_0xc83c('0x2e')]);_0x2f54fe['filters']=_['intersection'](_0x2f54fe[_0xc83c('0x34')],_0x2f54fe[_0xc83c('0x2e')]);_0x26fe39[_0xc83c('0x32')]=_[_0xc83c('0x31')](_0x2f54fe[_0xc83c('0x34')],qs[_0xc83c('0x43')](_0x2b4d09[_0xc83c('0x2e')][_0xc83c('0x43')]));_0x26fe39[_0xc83c('0x32')]=_0x26fe39[_0xc83c('0x32')][_0xc83c('0x33')]?_0x26fe39['attributes']:_0x2f54fe[_0xc83c('0x34')];if(_0x2b4d09[_0xc83c('0x2e')]['includeAll']){_0x26fe39['include']=[{'all':!![]}];}_0x26fe39=_[_0xc83c('0x3b')]({},_0x26fe39,_0x2b4d09['options']);return db[_0xc83c('0x28')][_0xc83c('0x44')](_0x26fe39)[_0xc83c('0x22')](handleEntityNotFound(_0x1589a1,null))[_0xc83c('0x22')](respondWithResult(_0x1589a1,null))[_0xc83c('0x41')](handleError(_0x1589a1,null));};exports[_0xc83c('0x45')]=function(_0x40d979,_0xc057a8){return db[_0xc83c('0x28')]['create'](_0x40d979[_0xc83c('0x46')],{})[_0xc83c('0x22')](respondWithResult(_0xc057a8,0xc9))['catch'](handleError(_0xc057a8,null));};exports[_0xc83c('0x21')]=function(_0xdce535,_0x5e361b){if(_0xdce535[_0xc83c('0x46')]['id']){delete _0xdce535[_0xc83c('0x46')]['id'];}return db['MailSubstatus'][_0xc83c('0x44')]({'where':{'id':_0xdce535['params']['id']}})[_0xc83c('0x22')](handleEntityNotFound(_0x5e361b,null))[_0xc83c('0x22')](saveUpdates(_0xdce535['body'],null))[_0xc83c('0x22')](respondWithResult(_0x5e361b,null))['catch'](handleError(_0x5e361b,null));};exports[_0xc83c('0x47')]=function(_0x69b17e,_0x57881c){return db['MailSubstatus'][_0xc83c('0x44')]({'where':{'id':_0x69b17e[_0xc83c('0x48')]['id']}})[_0xc83c('0x22')](handleEntityNotFound(_0x57881c,null))['then'](removeEntity(_0x57881c,null))[_0xc83c('0x41')](handleError(_0x57881c,null));};exports['describe']=function(_0x5dbe85,_0x4a8563){return db['MailSubstatus'][_0xc83c('0x49')]()[_0xc83c('0x22')](respondWithResult(_0x4a8563,null))[_0xc83c('0x41')](handleError(_0x4a8563,null));}; \ No newline at end of file +var _0xf5fc=['nolimit','order','sort','where','filter','merge','MailSubstatus','include','findAll','params','keys','fields','length','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty'];(function(_0x5263b1,_0x219056){var _0xd70a58=function(_0x53b446){while(--_0x53b446){_0x5263b1['push'](_0x5263b1['shift']());}};_0xd70a58(++_0x219056);}(_0xf5fc,0x9f));var _0xcf5f=function(_0x2872ca,_0x5be873){_0x2872ca=_0x2872ca-0x0;var _0x29220c=_0xf5fc[_0x2872ca];return _0x29220c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf5f('0x0'));var rimraf=require(_0xcf5f('0x1'));var zipdir=require(_0xcf5f('0x2'));var jsonpatch=require(_0xcf5f('0x3'));var rp=require(_0xcf5f('0x4'));var moment=require(_0xcf5f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcf5f('0x6'));var path=require(_0xcf5f('0x7'));var sox=require('sox');var csv=require(_0xcf5f('0x8'));var ejs=require(_0xcf5f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcf5f('0xa'));var crypto=require(_0xcf5f('0xb'));var jsforce=require(_0xcf5f('0xc'));var deskjs=require(_0xcf5f('0xd'));var toCsv=require(_0xcf5f('0x8'));var querystring=require(_0xcf5f('0xe'));var Papa=require(_0xcf5f('0xf'));var Redis=require('ioredis');var authService=require(_0xcf5f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf5f('0x11'));var logger=require(_0xcf5f('0x12'))('api');var utils=require(_0xcf5f('0x13'));var config=require(_0xcf5f('0x14'));var db=require(_0xcf5f('0x15'))['db'];function respondWithStatusCode(_0x34b739,_0x3f752b){_0x3f752b=_0x3f752b||0xcc;return function(_0x1deda7){if(_0x1deda7){return _0x34b739[_0xcf5f('0x16')](_0x3f752b);}return _0x34b739[_0xcf5f('0x17')](_0x3f752b)[_0xcf5f('0x18')]();};}function respondWithResult(_0x53d8be,_0x45cf1a){_0x45cf1a=_0x45cf1a||0xc8;return function(_0x53311b){if(_0x53311b){return _0x53d8be[_0xcf5f('0x17')](_0x45cf1a)[_0xcf5f('0x19')](_0x53311b);}};}function respondWithFilteredResult(_0x1f3b21,_0x297acc){return function(_0x10972b){if(_0x10972b){var _0xc62929=_0x10972b[_0xcf5f('0x1a')],_0x2c9da8=_0x297acc[_0xcf5f('0x1b')],_0x412f71=_0x297acc[_0xcf5f('0x1b')]+_0x297acc[_0xcf5f('0x1c')],_0x4775a8;if(_0x412f71>=_0xc62929){_0x412f71=_0xc62929;_0x4775a8=0xc8;}else{_0x4775a8=0xce;}_0x1f3b21['status'](_0x4775a8);return _0x1f3b21[_0xcf5f('0x1d')](_0xcf5f('0x1e'),_0x2c9da8+'-'+_0x412f71+'/'+_0xc62929)[_0xcf5f('0x19')](_0x10972b);}return null;};}function patchUpdates(_0x4fec40){return function(_0x1cddb4){try{jsonpatch['apply'](_0x1cddb4,_0x4fec40,!![]);}catch(_0x362eca){return BPromise[_0xcf5f('0x1f')](_0x362eca);}return _0x1cddb4[_0xcf5f('0x20')]();};}function saveUpdates(_0x32e1a8,_0x1ed302){return function(_0x27d5a8){if(_0x27d5a8){return _0x27d5a8[_0xcf5f('0x21')](_0x32e1a8)[_0xcf5f('0x22')](function(_0x1d7f49){return _0x1d7f49;});}return null;};}function removeEntity(_0x1f06db,_0x39ca91){return function(_0x33afbc){if(_0x33afbc){return _0x33afbc[_0xcf5f('0x23')]()['then'](function(){_0x1f06db[_0xcf5f('0x17')](0xcc)[_0xcf5f('0x18')]();});}};}function handleEntityNotFound(_0x5f2270,_0x78d54){return function(_0x19fe07){if(!_0x19fe07){_0x5f2270[_0xcf5f('0x16')](0x194);}return _0x19fe07;};}function handleError(_0x30af2a,_0x4d9ba9){_0x4d9ba9=_0x4d9ba9||0x1f4;return function(_0x1074bc){logger['error'](_0x1074bc[_0xcf5f('0x24')]);if(_0x1074bc[_0xcf5f('0x25')]){delete _0x1074bc[_0xcf5f('0x25')];}_0x30af2a[_0xcf5f('0x17')](_0x4d9ba9)[_0xcf5f('0x26')](_0x1074bc);};}exports[_0xcf5f('0x27')]=function(_0xbc7fa9,_0x157bd9){var _0x3865e1={},_0x281a31={},_0x522f40={'count':0x0,'rows':[]};var _0x3459ec=_[_0xcf5f('0x28')](db['MailSubstatus'][_0xcf5f('0x29')],function(_0x4990d5){return{'name':_0x4990d5[_0xcf5f('0x2a')],'type':_0x4990d5[_0xcf5f('0x2b')][_0xcf5f('0x2c')]};});_0x281a31['model']=_['map'](_0x3459ec,'name');_0x281a31['query']=_['keys'](_0xbc7fa9[_0xcf5f('0x2d')]);_0x281a31[_0xcf5f('0x2e')]=_[_0xcf5f('0x2f')](_0x281a31[_0xcf5f('0x30')],_0x281a31['query']);_0x3865e1['attributes']=_[_0xcf5f('0x2f')](_0x281a31[_0xcf5f('0x30')],qs['fields'](_0xbc7fa9[_0xcf5f('0x2d')]['fields']));_0x3865e1['attributes']=_0x3865e1[_0xcf5f('0x31')]['length']?_0x3865e1['attributes']:_0x281a31[_0xcf5f('0x30')];if(!_0xbc7fa9[_0xcf5f('0x2d')][_0xcf5f('0x32')](_0xcf5f('0x33'))){_0x3865e1[_0xcf5f('0x1c')]=qs[_0xcf5f('0x1c')](_0xbc7fa9['query'][_0xcf5f('0x1c')]);_0x3865e1[_0xcf5f('0x1b')]=qs['offset'](_0xbc7fa9[_0xcf5f('0x2d')]['offset']);}_0x3865e1[_0xcf5f('0x34')]=qs[_0xcf5f('0x35')](_0xbc7fa9[_0xcf5f('0x2d')][_0xcf5f('0x35')]);_0x3865e1[_0xcf5f('0x36')]=qs[_0xcf5f('0x2e')](_['pick'](_0xbc7fa9[_0xcf5f('0x2d')],_0x281a31[_0xcf5f('0x2e')]),_0x3459ec);if(_0xbc7fa9['query'][_0xcf5f('0x37')]){_0x3865e1[_0xcf5f('0x36')]=_['merge'](_0x3865e1[_0xcf5f('0x36')],{'$or':_[_0xcf5f('0x28')](_0x3459ec,function(_0x2ea34d){if(_0x2ea34d['type']!=='VIRTUAL'){var _0x42e35f={};_0x42e35f[_0x2ea34d['name']]={'$like':'%'+_0xbc7fa9[_0xcf5f('0x2d')]['filter']+'%'};return _0x42e35f;}})});}_0x3865e1=_[_0xcf5f('0x38')]({},_0x3865e1,_0xbc7fa9['options']);var _0x1431ab={'where':_0x3865e1[_0xcf5f('0x36')]};return db[_0xcf5f('0x39')][_0xcf5f('0x1a')](_0x1431ab)[_0xcf5f('0x22')](function(_0x249856){_0x522f40['count']=_0x249856;if(_0xbc7fa9[_0xcf5f('0x2d')]['includeAll']){_0x3865e1[_0xcf5f('0x3a')]=[{'all':!![]}];}return db['MailSubstatus'][_0xcf5f('0x3b')](_0x3865e1);})[_0xcf5f('0x22')](function(_0x375c85){_0x522f40['rows']=_0x375c85;return _0x522f40;})['then'](respondWithFilteredResult(_0x157bd9,_0x3865e1))['catch'](handleError(_0x157bd9,null));};exports['show']=function(_0x369ee8,_0x5e8907){var _0x530000={'raw':!![],'where':{'id':_0x369ee8[_0xcf5f('0x3c')]['id']}},_0x166e8c={};_0x166e8c['model']=_['keys'](db[_0xcf5f('0x39')][_0xcf5f('0x29')]);_0x166e8c[_0xcf5f('0x2d')]=_[_0xcf5f('0x3d')](_0x369ee8[_0xcf5f('0x2d')]);_0x166e8c['filters']=_[_0xcf5f('0x2f')](_0x166e8c[_0xcf5f('0x30')],_0x166e8c[_0xcf5f('0x2d')]);_0x530000[_0xcf5f('0x31')]=_['intersection'](_0x166e8c[_0xcf5f('0x30')],qs[_0xcf5f('0x3e')](_0x369ee8[_0xcf5f('0x2d')][_0xcf5f('0x3e')]));_0x530000[_0xcf5f('0x31')]=_0x530000['attributes'][_0xcf5f('0x3f')]?_0x530000[_0xcf5f('0x31')]:_0x166e8c[_0xcf5f('0x30')];if(_0x369ee8[_0xcf5f('0x2d')]['includeAll']){_0x530000[_0xcf5f('0x3a')]=[{'all':!![]}];}_0x530000=_[_0xcf5f('0x38')]({},_0x530000,_0x369ee8[_0xcf5f('0x40')]);return db[_0xcf5f('0x39')][_0xcf5f('0x41')](_0x530000)[_0xcf5f('0x22')](handleEntityNotFound(_0x5e8907,null))['then'](respondWithResult(_0x5e8907,null))[_0xcf5f('0x42')](handleError(_0x5e8907,null));};exports['create']=function(_0x1cf043,_0x28f49c){return db['MailSubstatus'][_0xcf5f('0x43')](_0x1cf043[_0xcf5f('0x44')],{})[_0xcf5f('0x22')](respondWithResult(_0x28f49c,0xc9))[_0xcf5f('0x42')](handleError(_0x28f49c,null));};exports[_0xcf5f('0x21')]=function(_0x45a844,_0x119476){if(_0x45a844[_0xcf5f('0x44')]['id']){delete _0x45a844['body']['id'];}return db[_0xcf5f('0x39')][_0xcf5f('0x41')]({'where':{'id':_0x45a844[_0xcf5f('0x3c')]['id']}})[_0xcf5f('0x22')](handleEntityNotFound(_0x119476,null))[_0xcf5f('0x22')](saveUpdates(_0x45a844[_0xcf5f('0x44')],null))[_0xcf5f('0x22')](respondWithResult(_0x119476,null))[_0xcf5f('0x42')](handleError(_0x119476,null));};exports[_0xcf5f('0x23')]=function(_0x13e93f,_0x174c2f){return db[_0xcf5f('0x39')][_0xcf5f('0x41')]({'where':{'id':_0x13e93f['params']['id']}})[_0xcf5f('0x22')](handleEntityNotFound(_0x174c2f,null))[_0xcf5f('0x22')](removeEntity(_0x174c2f,null))[_0xcf5f('0x42')](handleError(_0x174c2f,null));};exports[_0xcf5f('0x45')]=function(_0x525794,_0x1c9180){return db[_0xcf5f('0x39')][_0xcf5f('0x45')]()[_0xcf5f('0x22')](respondWithResult(_0x1c9180,null))[_0xcf5f('0x42')](handleError(_0x1c9180,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 0169ebf..336bcdb 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 _0x173d=['./mailSubstatus.attributes','define','mail_substatuses','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x51f2ac,_0x10e2da){var _0x4ced7d=function(_0x49a279){while(--_0x49a279){_0x51f2ac['push'](_0x51f2ac['shift']());}};_0x4ced7d(++_0x10e2da);}(_0x173d,0x108));var _0xd173=function(_0x3e86d1,_0x4e77e6){_0x3e86d1=_0x3e86d1-0x0;var _0x1a062d=_0x173d[_0x3e86d1];return _0x1a062d;};'use strict';var _=require('lodash');var util=require(_0xd173('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd173('0x1'));var BPromise=require('bluebird');var rp=require(_0xd173('0x2'));var fs=require('fs');var path=require(_0xd173('0x3'));var rimraf=require(_0xd173('0x4'));var config=require(_0xd173('0x5'));var attributes=require(_0xd173('0x6'));module['exports']=function(_0x24f796,_0x2d464b){return _0x24f796[_0xd173('0x7')]('MailSubstatus',attributes,{'tableName':_0xd173('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4f8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailSubstatus.attributes','exports','define','mail_substatuses','util'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0xb4f8,0x83));var _0x8b4f=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xb4f8[_0x557fd2];return _0x1b54a2;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var logger=require(_0x8b4f('0x1'))(_0x8b4f('0x2'));var moment=require(_0x8b4f('0x3'));var BPromise=require(_0x8b4f('0x4'));var rp=require(_0x8b4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b4f('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b4f('0x7'));module[_0x8b4f('0x8')]=function(_0x533e63,_0x17e04f){return _0x533e63[_0x8b4f('0x9')]('MailSubstatus',attributes,{'tableName':_0x8b4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 08d13df..e237ece 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 _0xf4eb=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x10a0e7,_0x5cd95d){var _0x293b07=function(_0x2f97c9){while(--_0x2f97c9){_0x10a0e7['push'](_0x10a0e7['shift']());}};_0x293b07(++_0x5cd95d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x28a27e,_0x2168e3){_0x28a27e=_0x28a27e-0x0;var _0x4dec7c=_0xf4eb[_0x28a27e];return _0x4dec7c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x1339=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x219c30,_0xc5b685){var _0x54156a=function(_0x189e21){while(--_0x189e21){_0x219c30['push'](_0x219c30['shift']());}};_0x54156a(++_0xc5b685);}(_0x1339,0x1ed));var _0x9133=function(_0x5e03b2,_0x334c03){_0x5e03b2=_0x5e03b2-0x0;var _0xc3e222=_0x1339[_0x5e03b2];return _0xc3e222;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 7a1aae8..7cad998 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 _0x5c3f=['Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c3f,0x81));var _0xf5c3=function(_0x993556,_0x1dd207){_0x993556=_0x993556-0x0;var _0x52d299=_0x5c3f[_0x993556];return _0x52d299;};'use strict';var multer=require(_0xf5c3('0x0'));var util=require(_0xf5c3('0x1'));var path=require('path');var timeout=require(_0xf5c3('0x2'));var express=require(_0xf5c3('0x3'));var router=express[_0xf5c3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf5c3('0x5'));var controller=require(_0xf5c3('0x6'));router[_0xf5c3('0x7')]('/',auth[_0xf5c3('0x8')](),controller[_0xf5c3('0x9')]);router[_0xf5c3('0x7')](_0xf5c3('0xa'),auth['isAuthenticated'](),controller[_0xf5c3('0xb')]);router[_0xf5c3('0x7')](_0xf5c3('0xc'),auth[_0xf5c3('0x8')](),controller[_0xf5c3('0xd')]);router['post']('/',auth[_0xf5c3('0x8')](),controller[_0xf5c3('0xe')]);router[_0xf5c3('0xf')](_0xf5c3('0xc'),auth[_0xf5c3('0x8')](),controller['update']);router[_0xf5c3('0x10')](_0xf5c3('0xc'),auth['isAuthenticated'](),controller[_0xf5c3('0x11')]);module[_0xf5c3('0x12')]=router; \ No newline at end of file +var _0xe061=['isAuthenticated','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','describe','/:id'];(function(_0x185d42,_0x1ba831){var _0x484076=function(_0x2ee758){while(--_0x2ee758){_0x185d42['push'](_0x185d42['shift']());}};_0x484076(++_0x1ba831);}(_0xe061,0x86));var _0x1e06=function(_0xef359c,_0x51e29e){_0xef359c=_0xef359c-0x0;var _0x5aa4e4=_0xe061[_0xef359c];return _0x5aa4e4;};'use strict';var multer=require('multer');var util=require(_0x1e06('0x0'));var path=require(_0x1e06('0x1'));var timeout=require(_0x1e06('0x2'));var express=require('express');var router=express[_0x1e06('0x3')]();var auth=require(_0x1e06('0x4'));var interaction=require(_0x1e06('0x5'));var config=require(_0x1e06('0x6'));var controller=require(_0x1e06('0x7'));router[_0x1e06('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e06('0x9')]);router[_0x1e06('0x8')](_0x1e06('0xa'),auth['isAuthenticated'](),controller[_0x1e06('0xb')]);router[_0x1e06('0x8')](_0x1e06('0xc'),auth[_0x1e06('0xd')](),controller[_0x1e06('0xe')]);router[_0x1e06('0xf')]('/',auth[_0x1e06('0xd')](),controller[_0x1e06('0x10')]);router[_0x1e06('0x11')](_0x1e06('0xc'),auth[_0x1e06('0xd')](),controller['update']);router[_0x1e06('0x12')](_0x1e06('0xc'),auth['isAuthenticated'](),controller[_0x1e06('0x13')]);module[_0x1e06('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2653c48..8a18729 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 _0x809d=['sequelize','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x15549e,_0xedbdea){var _0x50196a=function(_0x565ff0){while(--_0x565ff0){_0x15549e['push'](_0x15549e['shift']());}};_0x50196a(++_0xedbdea);}(_0x809d,0x155));var _0xd809=function(_0xe9f28c,_0x449a3e){_0xe9f28c=_0xe9f28c-0x0;var _0x358ccc=_0x809d[_0xe9f28c];return _0x358ccc;};'use strict';var moment=require(_0xd809('0x0'));var Sequelize=require(_0xd809('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd809('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd809('0x3')](_0xd809('0x4'),_0xd809('0x5'),_0xd809('0x6')),'allowNull':![],'defaultValue':_0xd809('0x6')},'transferredAt':{'type':Sequelize[_0xd809('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xd809('0x8')]}}; \ No newline at end of file +var _0xe6b2=['DATE','NOW','moment','exports','STRING','ENUM','account','agent','queue'];(function(_0x27725c,_0x10b696){var _0x1b5a0d=function(_0x41b99c){while(--_0x41b99c){_0x27725c['push'](_0x27725c['shift']());}};_0x1b5a0d(++_0x10b696);}(_0xe6b2,0x1df));var _0x2e6b=function(_0xa30bad,_0x40e784){_0xa30bad=_0xa30bad-0x0;var _0x118bd3=_0xe6b2[_0xa30bad];return _0x118bd3;};'use strict';var moment=require(_0x2e6b('0x0'));var Sequelize=require('sequelize');module[_0x2e6b('0x1')]={'uniqueid':{'type':Sequelize[_0x2e6b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2e6b('0x3')](_0x2e6b('0x4'),_0x2e6b('0x5'),_0x2e6b('0x6')),'allowNull':![],'defaultValue':_0x2e6b('0x6')},'transferredAt':{'type':Sequelize[_0x2e6b('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x2e6b('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0f6dfec..56baf00 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 _0x7000=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x13f5b4,_0x287700){var _0x311a51=function(_0x2fcafe){while(--_0x2fcafe){_0x13f5b4['push'](_0x13f5b4['shift']());}};_0x311a51(++_0x287700);}(_0x7000,0x94));var _0x0700=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0x7000[_0xd3da2a];return _0x10ab61;};'use strict';var pdf=require(_0x0700('0x0'));var emlformat=require(_0x0700('0x1'));var rimraf=require(_0x0700('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0700('0x3'));var moment=require(_0x0700('0x4'));var BPromise=require(_0x0700('0x5'));var Mustache=require(_0x0700('0x6'));var util=require('util');var path=require(_0x0700('0x7'));var sox=require(_0x0700('0x8'));var csv=require(_0x0700('0x9'));var ejs=require(_0x0700('0xa'));var fs=require('fs');var _=require(_0x0700('0xb'));var squel=require(_0x0700('0xc'));var crypto=require(_0x0700('0xd'));var jsforce=require(_0x0700('0xe'));var deskjs=require(_0x0700('0xf'));var toCsv=require(_0x0700('0x9'));var querystring=require(_0x0700('0x10'));var Papa=require(_0x0700('0x11'));var Redis=require(_0x0700('0x12'));var authService=require(_0x0700('0x13'));var qs=require(_0x0700('0x14'));var as=require(_0x0700('0x15'));var hardwareService=require(_0x0700('0x16'));var logger=require(_0x0700('0x17'))(_0x0700('0x18'));var utils=require('../../config/utils');var config=require(_0x0700('0x19'));var db=require(_0x0700('0x1a'))['db'];function respondWithStatusCode(_0x219418,_0x3d2910){_0x3d2910=_0x3d2910||0xcc;return function(_0x30b76e){if(_0x30b76e){return _0x219418[_0x0700('0x1b')](_0x3d2910);}return _0x219418[_0x0700('0x1c')](_0x3d2910)[_0x0700('0x1d')]();};}function respondWithResult(_0x50e0ff,_0x125a46){_0x125a46=_0x125a46||0xc8;return function(_0x1cc10a){if(_0x1cc10a){return _0x50e0ff[_0x0700('0x1c')](_0x125a46)[_0x0700('0x1e')](_0x1cc10a);}};}function respondWithFilteredResult(_0x5d9c91,_0x1a0864){return function(_0xd0289c){if(_0xd0289c){var _0x12727e=_0xd0289c['count'],_0x5d921a=_0x1a0864['offset'],_0x231590=_0x1a0864['offset']+_0x1a0864[_0x0700('0x1f')],_0x55439b;if(_0x231590>=_0x12727e){_0x231590=_0x12727e;_0x55439b=0xc8;}else{_0x55439b=0xce;}_0x5d9c91['status'](_0x55439b);return _0x5d9c91[_0x0700('0x20')](_0x0700('0x21'),_0x5d921a+'-'+_0x231590+'/'+_0x12727e)[_0x0700('0x1e')](_0xd0289c);}return null;};}function patchUpdates(_0x2f0e04){return function(_0x5d44de){try{jsonpatch['apply'](_0x5d44de,_0x2f0e04,!![]);}catch(_0xe281d8){return BPromise[_0x0700('0x22')](_0xe281d8);}return _0x5d44de[_0x0700('0x23')]();};}function saveUpdates(_0x1c86b2,_0x46f9ec){return function(_0x20083e){if(_0x20083e){return _0x20083e[_0x0700('0x24')](_0x1c86b2)[_0x0700('0x25')](function(_0x24240e){return _0x24240e;});}return null;};}function removeEntity(_0x93cf42,_0x2d50f9){return function(_0x107d4c){if(_0x107d4c){return _0x107d4c[_0x0700('0x26')]()['then'](function(){_0x93cf42[_0x0700('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46a98b,_0x58cd7b){return function(_0x37deef){if(!_0x37deef){_0x46a98b[_0x0700('0x1b')](0x194);}return _0x37deef;};}function handleError(_0x1ceffe,_0x29dbfe){_0x29dbfe=_0x29dbfe||0x1f4;return function(_0x5dac6c){logger[_0x0700('0x27')](_0x5dac6c[_0x0700('0x28')]);if(_0x5dac6c['name']){delete _0x5dac6c[_0x0700('0x29')];}_0x1ceffe[_0x0700('0x1c')](_0x29dbfe)[_0x0700('0x2a')](_0x5dac6c);};}exports[_0x0700('0x2b')]=function(_0x51bbce,_0x224182){var _0x4b6a45={},_0x1fee19={},_0x23d3ba={'count':0x0,'rows':[]};var _0x2bd392=_[_0x0700('0x2c')](db[_0x0700('0x2d')][_0x0700('0x2e')],function(_0x35c30c){return{'name':_0x35c30c[_0x0700('0x2f')],'type':_0x35c30c[_0x0700('0x30')][_0x0700('0x31')]};});_0x1fee19[_0x0700('0x32')]=_[_0x0700('0x2c')](_0x2bd392,_0x0700('0x29'));_0x1fee19[_0x0700('0x33')]=_[_0x0700('0x34')](_0x51bbce[_0x0700('0x33')]);_0x1fee19[_0x0700('0x35')]=_['intersection'](_0x1fee19[_0x0700('0x32')],_0x1fee19[_0x0700('0x33')]);_0x4b6a45[_0x0700('0x36')]=_[_0x0700('0x37')](_0x1fee19[_0x0700('0x32')],qs['fields'](_0x51bbce[_0x0700('0x33')][_0x0700('0x38')]));_0x4b6a45[_0x0700('0x36')]=_0x4b6a45[_0x0700('0x36')][_0x0700('0x39')]?_0x4b6a45['attributes']:_0x1fee19[_0x0700('0x32')];if(!_0x51bbce[_0x0700('0x33')][_0x0700('0x3a')](_0x0700('0x3b'))){_0x4b6a45[_0x0700('0x1f')]=qs['limit'](_0x51bbce[_0x0700('0x33')][_0x0700('0x1f')]);_0x4b6a45[_0x0700('0x3c')]=qs['offset'](_0x51bbce[_0x0700('0x33')][_0x0700('0x3c')]);}_0x4b6a45[_0x0700('0x3d')]=qs['sort'](_0x51bbce[_0x0700('0x33')][_0x0700('0x3e')]);_0x4b6a45[_0x0700('0x3f')]=qs[_0x0700('0x35')](_[_0x0700('0x40')](_0x51bbce[_0x0700('0x33')],_0x1fee19[_0x0700('0x35')]),_0x2bd392);if(_0x51bbce[_0x0700('0x33')]['filter']){_0x4b6a45['where']=_[_0x0700('0x41')](_0x4b6a45[_0x0700('0x3f')],{'$or':_[_0x0700('0x2c')](_0x2bd392,function(_0x3a366b){if(_0x3a366b[_0x0700('0x30')]!==_0x0700('0x42')){var _0x5118c4={};_0x5118c4[_0x3a366b['name']]={'$like':'%'+_0x51bbce['query']['filter']+'%'};return _0x5118c4;}})});}_0x4b6a45=_[_0x0700('0x41')]({},_0x4b6a45,_0x51bbce[_0x0700('0x43')]);var _0x4752c2={'where':_0x4b6a45[_0x0700('0x3f')]};return db[_0x0700('0x2d')][_0x0700('0x44')](_0x4752c2)[_0x0700('0x25')](function(_0x4829e7){_0x23d3ba[_0x0700('0x44')]=_0x4829e7;if(_0x51bbce['query'][_0x0700('0x45')]){_0x4b6a45[_0x0700('0x46')]=[{'all':!![]}];}return db['MailTransferReport'][_0x0700('0x47')](_0x4b6a45);})[_0x0700('0x25')](function(_0x8a930b){_0x23d3ba[_0x0700('0x48')]=_0x8a930b;return _0x23d3ba;})[_0x0700('0x25')](respondWithFilteredResult(_0x224182,_0x4b6a45))['catch'](handleError(_0x224182,null));};exports[_0x0700('0x49')]=function(_0x36b2b2,_0x5a94dc){var _0x8aba85={'raw':!![],'where':{'id':_0x36b2b2[_0x0700('0x4a')]['id']}},_0x4246b7={};_0x4246b7[_0x0700('0x32')]=_[_0x0700('0x34')](db['MailTransferReport']['rawAttributes']);_0x4246b7[_0x0700('0x33')]=_['keys'](_0x36b2b2['query']);_0x4246b7[_0x0700('0x35')]=_['intersection'](_0x4246b7[_0x0700('0x32')],_0x4246b7[_0x0700('0x33')]);_0x8aba85[_0x0700('0x36')]=_[_0x0700('0x37')](_0x4246b7[_0x0700('0x32')],qs[_0x0700('0x38')](_0x36b2b2[_0x0700('0x33')][_0x0700('0x38')]));_0x8aba85[_0x0700('0x36')]=_0x8aba85[_0x0700('0x36')][_0x0700('0x39')]?_0x8aba85[_0x0700('0x36')]:_0x4246b7[_0x0700('0x32')];if(_0x36b2b2[_0x0700('0x33')]['includeAll']){_0x8aba85[_0x0700('0x46')]=[{'all':!![]}];}_0x8aba85=_['merge']({},_0x8aba85,_0x36b2b2[_0x0700('0x43')]);return db['MailTransferReport'][_0x0700('0x4b')](_0x8aba85)[_0x0700('0x25')](handleEntityNotFound(_0x5a94dc,null))['then'](respondWithResult(_0x5a94dc,null))[_0x0700('0x4c')](handleError(_0x5a94dc,null));};exports[_0x0700('0x4d')]=function(_0x14a10c,_0x12ba14){return db[_0x0700('0x2d')][_0x0700('0x4d')](_0x14a10c[_0x0700('0x4e')],{})[_0x0700('0x25')](respondWithResult(_0x12ba14,0xc9))[_0x0700('0x4c')](handleError(_0x12ba14,null));};exports[_0x0700('0x24')]=function(_0x44e15f,_0x2820b5){if(_0x44e15f[_0x0700('0x4e')]['id']){delete _0x44e15f[_0x0700('0x4e')]['id'];}return db['MailTransferReport'][_0x0700('0x4b')]({'where':{'id':_0x44e15f[_0x0700('0x4a')]['id']}})[_0x0700('0x25')](handleEntityNotFound(_0x2820b5,null))[_0x0700('0x25')](saveUpdates(_0x44e15f[_0x0700('0x4e')],null))[_0x0700('0x25')](respondWithResult(_0x2820b5,null))[_0x0700('0x4c')](handleError(_0x2820b5,null));};exports[_0x0700('0x26')]=function(_0x802c9c,_0x3588d7){return db[_0x0700('0x2d')][_0x0700('0x4b')]({'where':{'id':_0x802c9c[_0x0700('0x4a')]['id']}})[_0x0700('0x25')](handleEntityNotFound(_0x3588d7,null))[_0x0700('0x25')](removeEntity(_0x3588d7,null))[_0x0700('0x4c')](handleError(_0x3588d7,null));};exports[_0x0700('0x4f')]=function(_0x3b4bf3,_0x42c281){return db[_0x0700('0x2d')][_0x0700('0x4f')]()['then'](respondWithResult(_0x42c281,null))[_0x0700('0x4c')](handleError(_0x42c281,null));}; \ No newline at end of file +var _0x4388=['includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x5e9590,_0x390b30){var _0x3d0ecd=function(_0x4a1738){while(--_0x4a1738){_0x5e9590['push'](_0x5e9590['shift']());}};_0x3d0ecd(++_0x390b30);}(_0x4388,0x1c3));var _0x8438=function(_0x417a0d,_0x332649){_0x417a0d=_0x417a0d-0x0;var _0x4f5b4e=_0x4388[_0x417a0d];return _0x4f5b4e;};'use strict';var pdf=require(_0x8438('0x0'));var emlformat=require(_0x8438('0x1'));var rimraf=require(_0x8438('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8438('0x3'));var rp=require(_0x8438('0x4'));var moment=require(_0x8438('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8438('0x6'));var sox=require(_0x8438('0x7'));var csv=require(_0x8438('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8438('0x9'));var squel=require(_0x8438('0xa'));var crypto=require(_0x8438('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8438('0xc'));var toCsv=require(_0x8438('0x8'));var querystring=require(_0x8438('0xd'));var Papa=require(_0x8438('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8438('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8438('0x10'));var logger=require(_0x8438('0x11'))('api');var utils=require(_0x8438('0x12'));var config=require(_0x8438('0x13'));var db=require(_0x8438('0x14'))['db'];function respondWithStatusCode(_0x50ec47,_0x5a7740){_0x5a7740=_0x5a7740||0xcc;return function(_0x2e5d6c){if(_0x2e5d6c){return _0x50ec47['sendStatus'](_0x5a7740);}return _0x50ec47[_0x8438('0x15')](_0x5a7740)[_0x8438('0x16')]();};}function respondWithResult(_0xc80110,_0x287083){_0x287083=_0x287083||0xc8;return function(_0x514c29){if(_0x514c29){return _0xc80110[_0x8438('0x15')](_0x287083)['json'](_0x514c29);}};}function respondWithFilteredResult(_0x5ce109,_0x69103d){return function(_0x32c000){if(_0x32c000){var _0x1fe4db=_0x32c000[_0x8438('0x17')],_0x2ce275=_0x69103d[_0x8438('0x18')],_0x5b552d=_0x69103d[_0x8438('0x18')]+_0x69103d[_0x8438('0x19')],_0xc6174;if(_0x5b552d>=_0x1fe4db){_0x5b552d=_0x1fe4db;_0xc6174=0xc8;}else{_0xc6174=0xce;}_0x5ce109['status'](_0xc6174);return _0x5ce109['set'](_0x8438('0x1a'),_0x2ce275+'-'+_0x5b552d+'/'+_0x1fe4db)[_0x8438('0x1b')](_0x32c000);}return null;};}function patchUpdates(_0x444e1e){return function(_0xfe4a85){try{jsonpatch[_0x8438('0x1c')](_0xfe4a85,_0x444e1e,!![]);}catch(_0x45e07b){return BPromise[_0x8438('0x1d')](_0x45e07b);}return _0xfe4a85[_0x8438('0x1e')]();};}function saveUpdates(_0xa609ba,_0x14b99f){return function(_0xda400b){if(_0xda400b){return _0xda400b[_0x8438('0x1f')](_0xa609ba)[_0x8438('0x20')](function(_0x4cea33){return _0x4cea33;});}return null;};}function removeEntity(_0x2bc094,_0x297296){return function(_0x2e8981){if(_0x2e8981){return _0x2e8981['destroy']()[_0x8438('0x20')](function(){_0x2bc094['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a6d6,_0x54a111){return function(_0x1c2f39){if(!_0x1c2f39){_0x15a6d6[_0x8438('0x21')](0x194);}return _0x1c2f39;};}function handleError(_0x33c0c4,_0x7ae052){_0x7ae052=_0x7ae052||0x1f4;return function(_0x283115){logger[_0x8438('0x22')](_0x283115[_0x8438('0x23')]);if(_0x283115['name']){delete _0x283115[_0x8438('0x24')];}_0x33c0c4[_0x8438('0x15')](_0x7ae052)[_0x8438('0x25')](_0x283115);};}exports[_0x8438('0x26')]=function(_0x1a34da,_0x33f00b){var _0xd47990={},_0x4acbf2={},_0x1b9667={'count':0x0,'rows':[]};var _0x8800d9=_[_0x8438('0x27')](db[_0x8438('0x28')][_0x8438('0x29')],function(_0x5249d1){return{'name':_0x5249d1['fieldName'],'type':_0x5249d1[_0x8438('0x2a')][_0x8438('0x2b')]};});_0x4acbf2[_0x8438('0x2c')]=_[_0x8438('0x27')](_0x8800d9,'name');_0x4acbf2['query']=_[_0x8438('0x2d')](_0x1a34da[_0x8438('0x2e')]);_0x4acbf2[_0x8438('0x2f')]=_['intersection'](_0x4acbf2['model'],_0x4acbf2[_0x8438('0x2e')]);_0xd47990[_0x8438('0x30')]=_[_0x8438('0x31')](_0x4acbf2[_0x8438('0x2c')],qs[_0x8438('0x32')](_0x1a34da['query'][_0x8438('0x32')]));_0xd47990[_0x8438('0x30')]=_0xd47990['attributes'][_0x8438('0x33')]?_0xd47990['attributes']:_0x4acbf2[_0x8438('0x2c')];if(!_0x1a34da[_0x8438('0x2e')][_0x8438('0x34')](_0x8438('0x35'))){_0xd47990['limit']=qs[_0x8438('0x19')](_0x1a34da[_0x8438('0x2e')][_0x8438('0x19')]);_0xd47990['offset']=qs[_0x8438('0x18')](_0x1a34da['query'][_0x8438('0x18')]);}_0xd47990['order']=qs[_0x8438('0x36')](_0x1a34da[_0x8438('0x2e')][_0x8438('0x36')]);_0xd47990[_0x8438('0x37')]=qs['filters'](_[_0x8438('0x38')](_0x1a34da['query'],_0x4acbf2['filters']),_0x8800d9);if(_0x1a34da[_0x8438('0x2e')][_0x8438('0x39')]){_0xd47990['where']=_['merge'](_0xd47990['where'],{'$or':_[_0x8438('0x27')](_0x8800d9,function(_0x41fd95){if(_0x41fd95['type']!==_0x8438('0x3a')){var _0x5ed561={};_0x5ed561[_0x41fd95[_0x8438('0x24')]]={'$like':'%'+_0x1a34da['query'][_0x8438('0x39')]+'%'};return _0x5ed561;}})});}_0xd47990=_[_0x8438('0x3b')]({},_0xd47990,_0x1a34da['options']);var _0x10ccd3={'where':_0xd47990[_0x8438('0x37')]};return db[_0x8438('0x28')][_0x8438('0x17')](_0x10ccd3)[_0x8438('0x20')](function(_0x1a2af7){_0x1b9667['count']=_0x1a2af7;if(_0x1a34da['query'][_0x8438('0x3c')]){_0xd47990['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x8438('0x3d')](_0xd47990);})[_0x8438('0x20')](function(_0x5e3eaa){_0x1b9667[_0x8438('0x3e')]=_0x5e3eaa;return _0x1b9667;})[_0x8438('0x20')](respondWithFilteredResult(_0x33f00b,_0xd47990))[_0x8438('0x3f')](handleError(_0x33f00b,null));};exports[_0x8438('0x40')]=function(_0x232f72,_0x476262){var _0x50ceb5={'raw':!![],'where':{'id':_0x232f72[_0x8438('0x41')]['id']}},_0x3a8373={};_0x3a8373[_0x8438('0x2c')]=_[_0x8438('0x2d')](db[_0x8438('0x28')][_0x8438('0x29')]);_0x3a8373['query']=_['keys'](_0x232f72[_0x8438('0x2e')]);_0x3a8373[_0x8438('0x2f')]=_[_0x8438('0x31')](_0x3a8373['model'],_0x3a8373['query']);_0x50ceb5[_0x8438('0x30')]=_[_0x8438('0x31')](_0x3a8373[_0x8438('0x2c')],qs[_0x8438('0x32')](_0x232f72[_0x8438('0x2e')][_0x8438('0x32')]));_0x50ceb5[_0x8438('0x30')]=_0x50ceb5[_0x8438('0x30')][_0x8438('0x33')]?_0x50ceb5[_0x8438('0x30')]:_0x3a8373['model'];if(_0x232f72[_0x8438('0x2e')]['includeAll']){_0x50ceb5[_0x8438('0x42')]=[{'all':!![]}];}_0x50ceb5=_[_0x8438('0x3b')]({},_0x50ceb5,_0x232f72[_0x8438('0x43')]);return db[_0x8438('0x28')][_0x8438('0x44')](_0x50ceb5)[_0x8438('0x20')](handleEntityNotFound(_0x476262,null))['then'](respondWithResult(_0x476262,null))[_0x8438('0x3f')](handleError(_0x476262,null));};exports[_0x8438('0x45')]=function(_0x5f5a93,_0x21452b){return db[_0x8438('0x28')]['create'](_0x5f5a93['body'],{})[_0x8438('0x20')](respondWithResult(_0x21452b,0xc9))['catch'](handleError(_0x21452b,null));};exports['update']=function(_0x5e4a40,_0x725238){if(_0x5e4a40[_0x8438('0x46')]['id']){delete _0x5e4a40[_0x8438('0x46')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x5e4a40[_0x8438('0x41')]['id']}})[_0x8438('0x20')](handleEntityNotFound(_0x725238,null))['then'](saveUpdates(_0x5e4a40[_0x8438('0x46')],null))[_0x8438('0x20')](respondWithResult(_0x725238,null))[_0x8438('0x3f')](handleError(_0x725238,null));};exports[_0x8438('0x47')]=function(_0x23fb08,_0x8be725){return db[_0x8438('0x28')][_0x8438('0x44')]({'where':{'id':_0x23fb08['params']['id']}})[_0x8438('0x20')](handleEntityNotFound(_0x8be725,null))['then'](removeEntity(_0x8be725,null))[_0x8438('0x3f')](handleError(_0x8be725,null));};exports[_0x8438('0x48')]=function(_0x3ba55d,_0x391706){return db[_0x8438('0x28')][_0x8438('0x48')]()[_0x8438('0x20')](respondWithResult(_0x391706,null))[_0x8438('0x3f')](handleError(_0x391706,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f81b5bb..11d4a32 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 _0x3432=['api','moment','bluebird','request-promise','rimraf','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','util'];(function(_0x4afbf7,_0x4a8930){var _0x4cc200=function(_0x363366){while(--_0x363366){_0x4afbf7['push'](_0x4afbf7['shift']());}};_0x4cc200(++_0x4a8930);}(_0x3432,0x199));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x2343('0x0'));var logger=require('../../config/logger')(_0x2343('0x1'));var moment=require(_0x2343('0x2'));var BPromise=require(_0x2343('0x3'));var rp=require(_0x2343('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2343('0x5'));var config=require('../../config/environment');var attributes=require(_0x2343('0x6'));module['exports']=function(_0x14f05e,_0x580555){return _0x14f05e[_0x2343('0x7')](_0x2343('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x2343('0x9'),'fields':[_0x2343('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56da=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x9161fa,_0x29eb1e){var _0x51a6bc=function(_0x199c74){while(--_0x199c74){_0x9161fa['push'](_0x9161fa['shift']());}};_0x51a6bc(++_0x29eb1e);}(_0x56da,0x119));var _0xa56d=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0x56da[_0x47604d];return _0x388e4c;};'use strict';var _=require(_0xa56d('0x0'));var util=require('util');var logger=require(_0xa56d('0x1'))(_0xa56d('0x2'));var moment=require('moment');var BPromise=require(_0xa56d('0x3'));var rp=require(_0xa56d('0x4'));var fs=require('fs');var path=require(_0xa56d('0x5'));var rimraf=require(_0xa56d('0x6'));var config=require(_0xa56d('0x7'));var attributes=require(_0xa56d('0x8'));module[_0xa56d('0x9')]=function(_0x14a16e,_0x4751ee){return _0x14a16e[_0xa56d('0xa')](_0xa56d('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa56d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 71f04fe..1a363e2 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 _0x86c4=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','MailTransferReport,\x20%s,\x20%s'];(function(_0xf3b525,_0x419b48){var _0x1f98b3=function(_0x1050c9){while(--_0x1050c9){_0xf3b525['push'](_0xf3b525['shift']());}};_0x1f98b3(++_0x419b48);}(_0x86c4,0x172));var _0x486c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86c4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x486c('0x0'));var util=require(_0x486c('0x1'));var moment=require(_0x486c('0x2'));var BPromise=require(_0x486c('0x3'));var rs=require(_0x486c('0x4'));var fs=require('fs');var Redis=require(_0x486c('0x5'));var db=require(_0x486c('0x6'))['db'];var utils=require(_0x486c('0x7'));var logger=require(_0x486c('0x8'))(_0x486c('0x9'));var config=require(_0x486c('0xa'));var jayson=require(_0x486c('0xb'));var client=jayson[_0x486c('0xc')][_0x486c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ec807,_0x2ea511,_0x48128a){return new BPromise(function(_0x2873ea,_0x3b858){return client[_0x486c('0xe')](_0x1ec807,_0x48128a)[_0x486c('0xf')](function(_0x172778){logger[_0x486c('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x2ea511,_0x486c('0x11'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2ea511,_0x486c('0x11'),JSON['stringify'](_0x172778));if(_0x172778[_0x486c('0x12')]){if(_0x172778[_0x486c('0x12')][_0x486c('0x13')]===0x1f4){logger[_0x486c('0x12')](_0x486c('0x14'),_0x2ea511,_0x172778[_0x486c('0x12')][_0x486c('0x15')]);return _0x3b858(_0x172778['error'][_0x486c('0x15')]);}logger[_0x486c('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x2ea511,_0x172778[_0x486c('0x12')][_0x486c('0x15')]);return _0x2873ea(_0x172778[_0x486c('0x12')]['message']);}else{logger['info'](_0x486c('0x14'),_0x2ea511,_0x486c('0x11'));_0x2873ea(_0x172778[_0x486c('0x16')][_0x486c('0x15')]);}})['catch'](function(_0x5ea75e){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2ea511,_0x5ea75e);_0x3b858(_0x5ea75e);});});} \ No newline at end of file +var _0xe95e=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe95e,0x179));var _0xee95=function(_0x5850e0,_0x2c3e9a){_0x5850e0=_0x5850e0-0x0;var _0x3d0697=_0xe95e[_0x5850e0];return _0x3d0697;};'use strict';var _=require(_0xee95('0x0'));var util=require(_0xee95('0x1'));var moment=require('moment');var BPromise=require(_0xee95('0x2'));var rs=require(_0xee95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee95('0x4'))['db'];var utils=require(_0xee95('0x5'));var logger=require(_0xee95('0x6'))('rpc');var config=require(_0xee95('0x7'));var jayson=require(_0xee95('0x8'));var client=jayson[_0xee95('0x9')][_0xee95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1605d2,_0x182716,_0x10a0c5){return new BPromise(function(_0x16f07f,_0x48de12){return client[_0xee95('0xb')](_0x1605d2,_0x10a0c5)[_0xee95('0xc')](function(_0x2e2f58){logger[_0xee95('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x182716,_0xee95('0xe'));logger['debug'](_0xee95('0xf'),_0x182716,_0xee95('0xe'),JSON['stringify'](_0x2e2f58));if(_0x2e2f58[_0xee95('0x10')]){if(_0x2e2f58[_0xee95('0x10')][_0xee95('0x11')]===0x1f4){logger[_0xee95('0x10')](_0xee95('0x12'),_0x182716,_0x2e2f58[_0xee95('0x10')][_0xee95('0x13')]);return _0x48de12(_0x2e2f58['error'][_0xee95('0x13')]);}logger[_0xee95('0x10')](_0xee95('0x12'),_0x182716,_0x2e2f58['error'][_0xee95('0x13')]);return _0x16f07f(_0x2e2f58[_0xee95('0x10')]['message']);}else{logger['info'](_0xee95('0x12'),_0x182716,_0xee95('0xe'));_0x16f07f(_0x2e2f58[_0xee95('0x14')][_0xee95('0x13')]);}})['catch'](function(_0x359fd1){logger[_0xee95('0x10')](_0xee95('0x12'),_0x182716,_0x359fd1);_0x48de12(_0x359fd1);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 15e40f7..836b4e1 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 _0x8bb5=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update'];(function(_0x4cdb87,_0x410b03){var _0x3f5f4c=function(_0x447f53){while(--_0x447f53){_0x4cdb87['push'](_0x4cdb87['shift']());}};_0x3f5f4c(++_0x410b03);}(_0x8bb5,0x1ca));var _0x58bb=function(_0x92d338,_0x535df8){_0x92d338=_0x92d338-0x0;var _0x9ead91=_0x8bb5[_0x92d338];return _0x9ead91;};'use strict';var multer=require(_0x58bb('0x0'));var util=require(_0x58bb('0x1'));var path=require(_0x58bb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58bb('0x3')]();var auth=require(_0x58bb('0x4'));var interaction=require(_0x58bb('0x5'));var config=require(_0x58bb('0x6'));var controller=require(_0x58bb('0x7'));router[_0x58bb('0x8')]('/',auth[_0x58bb('0x9')](),controller['index']);router[_0x58bb('0x8')](_0x58bb('0xa'),auth[_0x58bb('0x9')](),controller[_0x58bb('0xb')]);router[_0x58bb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x58bb('0xc')]);router[_0x58bb('0xd')]('/',auth[_0x58bb('0x9')](),controller[_0x58bb('0xe')]);router[_0x58bb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x58bb('0x10')]);router[_0x58bb('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x58bb('0x12')]=router; \ No newline at end of file +var _0xe508=['../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','util'];(function(_0x23cc2d,_0xd02450){var _0x3dd47d=function(_0x26c771){while(--_0x26c771){_0x23cc2d['push'](_0x23cc2d['shift']());}};_0x3dd47d(++_0xd02450);}(_0xe508,0x67));var _0x8e50=function(_0x25cf37,_0x1753a0){_0x25cf37=_0x25cf37-0x0;var _0x2141fe=_0xe508[_0x25cf37];return _0x2141fe;};'use strict';var multer=require(_0x8e50('0x0'));var util=require(_0x8e50('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e50('0x2'));var controller=require('./memberReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8e50('0x3')]);router[_0x8e50('0x4')](_0x8e50('0x5'),auth['isAuthenticated'](),controller[_0x8e50('0x6')]);router[_0x8e50('0x4')](_0x8e50('0x7'),auth[_0x8e50('0x8')](),controller[_0x8e50('0x9')]);router['post']('/',auth[_0x8e50('0x8')](),controller[_0x8e50('0xa')]);router[_0x8e50('0xb')](_0x8e50('0x7'),auth['isAuthenticated'](),controller[_0x8e50('0xc')]);router['delete'](_0x8e50('0x7'),auth[_0x8e50('0x8')](),controller[_0x8e50('0xd')]);module[_0x8e50('0xe')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 1f04353..5d9c1f5 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 _0xff57=['talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x6f3647,_0x58cad9){var _0x4382bf=function(_0x41f07f){while(--_0x41f07f){_0x6f3647['push'](_0x6f3647['shift']());}};_0x4382bf(++_0x58cad9);}(_0xff57,0x1f0));var _0x7ff5=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0xff57[_0x1da10a];return _0x5aea64;};'use strict';var Sequelize=require(_0x7ff5('0x0'));var moment=require(_0x7ff5('0x1'));module[_0x7ff5('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7ff5('0x3')]},'interface':{'type':Sequelize[_0x7ff5('0x3')]},'type':{'type':Sequelize[_0x7ff5('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x7ff5('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7ff5('0x5')],'set':function(_0x3d90fd){var _0xa7f83c=moment(_0x3d90fd);var _0x41cb9b=moment(this['getDataValue']('enterAt'));var _0x293f0a=_0xa7f83c[_0x7ff5('0x6')](_0x41cb9b,_0x7ff5('0x7'));this[_0x7ff5('0x8')](_0x7ff5('0x9'),_0x3d90fd);this[_0x7ff5('0x8')](_0x7ff5('0xa'),_0x293f0a||null);}},'data1':{'type':Sequelize[_0x7ff5('0x3')],'comment':_0x7ff5('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x7ff5('0xc')},'data3':{'type':Sequelize[_0x7ff5('0x3')],'comment':_0x7ff5('0xd')},'data4':{'type':Sequelize[_0x7ff5('0x3')],'comment':_0x7ff5('0xe')},'data5':{'type':Sequelize[_0x7ff5('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x7ff5('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd0dc=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt'];(function(_0xf3f1ed,_0x57e63e){var _0x3f5837=function(_0x29216f){while(--_0x29216f){_0xf3f1ed['push'](_0xf3f1ed['shift']());}};_0x3f5837(++_0x57e63e);}(_0xd0dc,0xf4));var _0xcd0d=function(_0x3b0b34,_0xe6a14f){_0x3b0b34=_0x3b0b34-0x0;var _0x5f5496=_0xd0dc[_0x3b0b34];return _0x5f5496;};'use strict';var Sequelize=require(_0xcd0d('0x0'));var moment=require(_0xcd0d('0x1'));module[_0xcd0d('0x2')]={'channel':{'type':Sequelize[_0xcd0d('0x3')]},'membername':{'type':Sequelize[_0xcd0d('0x3')]},'interface':{'type':Sequelize[_0xcd0d('0x3')]},'type':{'type':Sequelize[_0xcd0d('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xcd0d('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xcd0d('0x5')]},'exitAt':{'type':Sequelize[_0xcd0d('0x5')],'set':function(_0x20d9eb){var _0x4576fc=moment(_0x20d9eb);var _0x5a72aa=moment(this[_0xcd0d('0x6')](_0xcd0d('0x7')));var _0x480e37=_0x4576fc['diff'](_0x5a72aa,_0xcd0d('0x8'));this[_0xcd0d('0x9')](_0xcd0d('0xa'),_0x20d9eb);this['setDataValue'](_0xcd0d('0xb'),_0x480e37||null);}},'data1':{'type':Sequelize[_0xcd0d('0x3')],'comment':_0xcd0d('0xc')},'data2':{'type':Sequelize[_0xcd0d('0x3')],'comment':_0xcd0d('0xd')},'data3':{'type':Sequelize[_0xcd0d('0x3')],'comment':_0xcd0d('0xe')},'data4':{'type':Sequelize[_0xcd0d('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xcd0d('0xf')},'role':{'type':Sequelize[_0xcd0d('0x3')]},'internal':{'type':Sequelize[_0xcd0d('0x10')]},'uniqueid':{'type':Sequelize[_0xcd0d('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 57ab4d3..1cddd5c 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 _0x235c=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MemberReport','findAll','rows','show','keys','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x235c,0xcd));var _0xc235=function(_0x358f75,_0x463166){_0x358f75=_0x358f75-0x0;var _0x5248fe=_0x235c[_0x358f75];return _0x5248fe;};'use strict';var pdf=require(_0xc235('0x0'));var emlformat=require(_0xc235('0x1'));var rimraf=require(_0xc235('0x2'));var zipdir=require(_0xc235('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc235('0x4'));var moment=require('moment');var BPromise=require(_0xc235('0x5'));var Mustache=require(_0xc235('0x6'));var util=require(_0xc235('0x7'));var path=require(_0xc235('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc235('0x9'));var fs=require('fs');var _=require(_0xc235('0xa'));var squel=require('squel');var crypto=require(_0xc235('0xb'));var jsforce=require(_0xc235('0xc'));var deskjs=require(_0xc235('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc235('0xe'));var Papa=require(_0xc235('0xf'));var Redis=require(_0xc235('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc235('0x11'));var as=require(_0xc235('0x12'));var hardwareService=require(_0xc235('0x13'));var logger=require(_0xc235('0x14'))('api');var utils=require(_0xc235('0x15'));var config=require(_0xc235('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47caca,_0x25e5c2){_0x25e5c2=_0x25e5c2||0xcc;return function(_0x12d6cb){if(_0x12d6cb){return _0x47caca[_0xc235('0x17')](_0x25e5c2);}return _0x47caca[_0xc235('0x18')](_0x25e5c2)['end']();};}function respondWithResult(_0x15da2a,_0x4ce374){_0x4ce374=_0x4ce374||0xc8;return function(_0x24e401){if(_0x24e401){return _0x15da2a['status'](_0x4ce374)[_0xc235('0x19')](_0x24e401);}};}function respondWithFilteredResult(_0x4e515d,_0x23945b){return function(_0x1ea719){if(_0x1ea719){var _0x2fdb42=_0x1ea719[_0xc235('0x1a')],_0x252ca5=_0x23945b[_0xc235('0x1b')],_0x2e6b7d=_0x23945b[_0xc235('0x1b')]+_0x23945b[_0xc235('0x1c')],_0x2320c3;if(_0x2e6b7d>=_0x2fdb42){_0x2e6b7d=_0x2fdb42;_0x2320c3=0xc8;}else{_0x2320c3=0xce;}_0x4e515d[_0xc235('0x18')](_0x2320c3);return _0x4e515d[_0xc235('0x1d')](_0xc235('0x1e'),_0x252ca5+'-'+_0x2e6b7d+'/'+_0x2fdb42)[_0xc235('0x19')](_0x1ea719);}return null;};}function patchUpdates(_0x3be974){return function(_0x4807f9){try{jsonpatch['apply'](_0x4807f9,_0x3be974,!![]);}catch(_0x29ea73){return BPromise[_0xc235('0x1f')](_0x29ea73);}return _0x4807f9[_0xc235('0x20')]();};}function saveUpdates(_0x2eeb29,_0x523b7a){return function(_0x40ad7e){if(_0x40ad7e){return _0x40ad7e[_0xc235('0x21')](_0x2eeb29)['then'](function(_0x58999d){return _0x58999d;});}return null;};}function removeEntity(_0x1aab2b,_0x1aae3c){return function(_0x1adb2a){if(_0x1adb2a){return _0x1adb2a[_0xc235('0x22')]()[_0xc235('0x23')](function(){_0x1aab2b[_0xc235('0x18')](0xcc)[_0xc235('0x24')]();});}};}function handleEntityNotFound(_0x46fd1e,_0x3c0cd7){return function(_0x34a217){if(!_0x34a217){_0x46fd1e[_0xc235('0x17')](0x194);}return _0x34a217;};}function handleError(_0x1b2ce5,_0x545a99){_0x545a99=_0x545a99||0x1f4;return function(_0x36f55b){logger[_0xc235('0x25')](_0x36f55b[_0xc235('0x26')]);if(_0x36f55b[_0xc235('0x27')]){delete _0x36f55b[_0xc235('0x27')];}_0x1b2ce5[_0xc235('0x18')](_0x545a99)[_0xc235('0x28')](_0x36f55b);};}exports[_0xc235('0x29')]=function(_0x3eb637,_0x463f1a){var _0x2b1b89={},_0xe49173={},_0x2a998d={'count':0x0,'rows':[]};var _0x2814fb=_[_0xc235('0x2a')](db['MemberReport'][_0xc235('0x2b')],function(_0x415736){return{'name':_0x415736[_0xc235('0x2c')],'type':_0x415736[_0xc235('0x2d')]['key']};});_0xe49173[_0xc235('0x2e')]=_[_0xc235('0x2a')](_0x2814fb,_0xc235('0x27'));_0xe49173[_0xc235('0x2f')]=_['keys'](_0x3eb637[_0xc235('0x2f')]);_0xe49173[_0xc235('0x30')]=_[_0xc235('0x31')](_0xe49173[_0xc235('0x2e')],_0xe49173[_0xc235('0x2f')]);_0x2b1b89['attributes']=_[_0xc235('0x31')](_0xe49173['model'],qs[_0xc235('0x32')](_0x3eb637[_0xc235('0x2f')]['fields']));_0x2b1b89['attributes']=_0x2b1b89[_0xc235('0x33')][_0xc235('0x34')]?_0x2b1b89[_0xc235('0x33')]:_0xe49173[_0xc235('0x2e')];if(!_0x3eb637[_0xc235('0x2f')]['hasOwnProperty'](_0xc235('0x35'))){_0x2b1b89[_0xc235('0x1c')]=qs[_0xc235('0x1c')](_0x3eb637['query'][_0xc235('0x1c')]);_0x2b1b89['offset']=qs[_0xc235('0x1b')](_0x3eb637[_0xc235('0x2f')][_0xc235('0x1b')]);}_0x2b1b89[_0xc235('0x36')]=qs[_0xc235('0x37')](_0x3eb637['query'][_0xc235('0x37')]);_0x2b1b89[_0xc235('0x38')]=qs[_0xc235('0x30')](_[_0xc235('0x39')](_0x3eb637[_0xc235('0x2f')],_0xe49173[_0xc235('0x30')]),_0x2814fb);if(_0x3eb637[_0xc235('0x2f')][_0xc235('0x3a')]){_0x2b1b89['where']=_[_0xc235('0x3b')](_0x2b1b89[_0xc235('0x38')],{'$or':_[_0xc235('0x2a')](_0x2814fb,function(_0x424a72){if(_0x424a72['type']!==_0xc235('0x3c')){var _0x40a6a3={};_0x40a6a3[_0x424a72[_0xc235('0x27')]]={'$like':'%'+_0x3eb637[_0xc235('0x2f')]['filter']+'%'};return _0x40a6a3;}})});}_0x2b1b89=_[_0xc235('0x3b')]({},_0x2b1b89,_0x3eb637[_0xc235('0x3d')]);var _0x2135b2={'where':_0x2b1b89[_0xc235('0x38')]};return db['MemberReport'][_0xc235('0x1a')](_0x2135b2)[_0xc235('0x23')](function(_0xc8cde5){_0x2a998d[_0xc235('0x1a')]=_0xc8cde5;if(_0x3eb637['query'][_0xc235('0x3e')]){_0x2b1b89[_0xc235('0x3f')]=[{'all':!![]}];}return db[_0xc235('0x40')][_0xc235('0x41')](_0x2b1b89);})[_0xc235('0x23')](function(_0x5c037e){_0x2a998d[_0xc235('0x42')]=_0x5c037e;return _0x2a998d;})[_0xc235('0x23')](respondWithFilteredResult(_0x463f1a,_0x2b1b89))['catch'](handleError(_0x463f1a,null));};exports[_0xc235('0x43')]=function(_0x61a141,_0x499662){var _0x4ced79={'raw':!![],'where':{'id':_0x61a141['params']['id']}},_0x15a71a={};_0x15a71a[_0xc235('0x2e')]=_[_0xc235('0x44')](db[_0xc235('0x40')][_0xc235('0x2b')]);_0x15a71a['query']=_['keys'](_0x61a141[_0xc235('0x2f')]);_0x15a71a[_0xc235('0x30')]=_[_0xc235('0x31')](_0x15a71a[_0xc235('0x2e')],_0x15a71a['query']);_0x4ced79[_0xc235('0x33')]=_[_0xc235('0x31')](_0x15a71a['model'],qs[_0xc235('0x32')](_0x61a141[_0xc235('0x2f')][_0xc235('0x32')]));_0x4ced79['attributes']=_0x4ced79[_0xc235('0x33')][_0xc235('0x34')]?_0x4ced79[_0xc235('0x33')]:_0x15a71a['model'];if(_0x61a141[_0xc235('0x2f')][_0xc235('0x3e')]){_0x4ced79[_0xc235('0x3f')]=[{'all':!![]}];}_0x4ced79=_[_0xc235('0x3b')]({},_0x4ced79,_0x61a141['options']);return db['MemberReport'][_0xc235('0x45')](_0x4ced79)[_0xc235('0x23')](handleEntityNotFound(_0x499662,null))[_0xc235('0x23')](respondWithResult(_0x499662,null))[_0xc235('0x46')](handleError(_0x499662,null));};exports[_0xc235('0x47')]=function(_0x38e61d,_0x2f19ac){return db[_0xc235('0x40')][_0xc235('0x47')](_0x38e61d[_0xc235('0x48')],{})['then'](respondWithResult(_0x2f19ac,0xc9))[_0xc235('0x46')](handleError(_0x2f19ac,null));};exports['update']=function(_0x21afc4,_0x283eec){if(_0x21afc4['body']['id']){delete _0x21afc4[_0xc235('0x48')]['id'];}return db[_0xc235('0x40')][_0xc235('0x45')]({'where':{'id':_0x21afc4['params']['id']}})[_0xc235('0x23')](handleEntityNotFound(_0x283eec,null))['then'](saveUpdates(_0x21afc4[_0xc235('0x48')],null))[_0xc235('0x23')](respondWithResult(_0x283eec,null))['catch'](handleError(_0x283eec,null));};exports[_0xc235('0x22')]=function(_0x577577,_0xf356e1){return db[_0xc235('0x40')]['find']({'where':{'id':_0x577577[_0xc235('0x49')]['id']}})[_0xc235('0x23')](handleEntityNotFound(_0xf356e1,null))[_0xc235('0x23')](removeEntity(_0xf356e1,null))[_0xc235('0x46')](handleError(_0xf356e1,null));};exports[_0xc235('0x4a')]=function(_0x202fee,_0x46d605){return db[_0xc235('0x40')]['describe']()[_0xc235('0x23')](respondWithResult(_0x46d605,null))[_0xc235('0x46')](handleError(_0x46d605,null));}; \ No newline at end of file +var _0xad82=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','MemberReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf'];(function(_0x51a9b8,_0x48f6e0){var _0xaab44f=function(_0x148eff){while(--_0x148eff){_0x51a9b8['push'](_0x51a9b8['shift']());}};_0xaab44f(++_0x48f6e0);}(_0xad82,0x137));var _0x2ad8=function(_0x36e0e9,_0x138073){_0x36e0e9=_0x36e0e9-0x0;var _0x4591f5=_0xad82[_0x36e0e9];return _0x4591f5;};'use strict';var pdf=require(_0x2ad8('0x0'));var emlformat=require(_0x2ad8('0x1'));var rimraf=require(_0x2ad8('0x2'));var zipdir=require(_0x2ad8('0x3'));var jsonpatch=require(_0x2ad8('0x4'));var rp=require(_0x2ad8('0x5'));var moment=require(_0x2ad8('0x6'));var BPromise=require(_0x2ad8('0x7'));var Mustache=require(_0x2ad8('0x8'));var util=require(_0x2ad8('0x9'));var path=require(_0x2ad8('0xa'));var sox=require(_0x2ad8('0xb'));var csv=require(_0x2ad8('0xc'));var ejs=require(_0x2ad8('0xd'));var fs=require('fs');var _=require(_0x2ad8('0xe'));var squel=require(_0x2ad8('0xf'));var crypto=require(_0x2ad8('0x10'));var jsforce=require(_0x2ad8('0x11'));var deskjs=require(_0x2ad8('0x12'));var toCsv=require(_0x2ad8('0xc'));var querystring=require(_0x2ad8('0x13'));var Papa=require('papaparse');var Redis=require(_0x2ad8('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2ad8('0x15'));var as=require(_0x2ad8('0x16'));var hardwareService=require(_0x2ad8('0x17'));var logger=require('../../config/logger')(_0x2ad8('0x18'));var utils=require(_0x2ad8('0x19'));var config=require(_0x2ad8('0x1a'));var db=require(_0x2ad8('0x1b'))['db'];function respondWithStatusCode(_0x55a0e7,_0x597e09){_0x597e09=_0x597e09||0xcc;return function(_0x34ffa2){if(_0x34ffa2){return _0x55a0e7[_0x2ad8('0x1c')](_0x597e09);}return _0x55a0e7[_0x2ad8('0x1d')](_0x597e09)[_0x2ad8('0x1e')]();};}function respondWithResult(_0x1cc4cf,_0x2a7a40){_0x2a7a40=_0x2a7a40||0xc8;return function(_0x5c6d96){if(_0x5c6d96){return _0x1cc4cf['status'](_0x2a7a40)['json'](_0x5c6d96);}};}function respondWithFilteredResult(_0xe30317,_0xd21b88){return function(_0x4fac81){if(_0x4fac81){var _0x31e303=_0x4fac81[_0x2ad8('0x1f')],_0x2dd7d6=_0xd21b88[_0x2ad8('0x20')],_0x285fd2=_0xd21b88[_0x2ad8('0x20')]+_0xd21b88[_0x2ad8('0x21')],_0x56315c;if(_0x285fd2>=_0x31e303){_0x285fd2=_0x31e303;_0x56315c=0xc8;}else{_0x56315c=0xce;}_0xe30317[_0x2ad8('0x1d')](_0x56315c);return _0xe30317[_0x2ad8('0x22')]('Content-Range',_0x2dd7d6+'-'+_0x285fd2+'/'+_0x31e303)[_0x2ad8('0x23')](_0x4fac81);}return null;};}function patchUpdates(_0x17164d){return function(_0x47e87c){try{jsonpatch[_0x2ad8('0x24')](_0x47e87c,_0x17164d,!![]);}catch(_0x165361){return BPromise['reject'](_0x165361);}return _0x47e87c[_0x2ad8('0x25')]();};}function saveUpdates(_0x2e4aa8,_0x31d158){return function(_0x219006){if(_0x219006){return _0x219006[_0x2ad8('0x26')](_0x2e4aa8)[_0x2ad8('0x27')](function(_0xdeeafc){return _0xdeeafc;});}return null;};}function removeEntity(_0x538b44,_0xc381f3){return function(_0xcbe673){if(_0xcbe673){return _0xcbe673['destroy']()[_0x2ad8('0x27')](function(){_0x538b44[_0x2ad8('0x1d')](0xcc)[_0x2ad8('0x1e')]();});}};}function handleEntityNotFound(_0x32bf5a,_0x5b2787){return function(_0x32f5ec){if(!_0x32f5ec){_0x32bf5a[_0x2ad8('0x1c')](0x194);}return _0x32f5ec;};}function handleError(_0x4dd9ce,_0x565964){_0x565964=_0x565964||0x1f4;return function(_0x3df99f){logger[_0x2ad8('0x28')](_0x3df99f[_0x2ad8('0x29')]);if(_0x3df99f['name']){delete _0x3df99f[_0x2ad8('0x2a')];}_0x4dd9ce[_0x2ad8('0x1d')](_0x565964)[_0x2ad8('0x2b')](_0x3df99f);};}exports[_0x2ad8('0x2c')]=function(_0x460d24,_0x121ab1){var _0x1c628b={},_0x18c80a={},_0x27db81={'count':0x0,'rows':[]};var _0x3aecb5=_[_0x2ad8('0x2d')](db['MemberReport'][_0x2ad8('0x2e')],function(_0x5342e5){return{'name':_0x5342e5[_0x2ad8('0x2f')],'type':_0x5342e5[_0x2ad8('0x30')][_0x2ad8('0x31')]};});_0x18c80a[_0x2ad8('0x32')]=_[_0x2ad8('0x2d')](_0x3aecb5,_0x2ad8('0x2a'));_0x18c80a[_0x2ad8('0x33')]=_[_0x2ad8('0x34')](_0x460d24[_0x2ad8('0x33')]);_0x18c80a[_0x2ad8('0x35')]=_['intersection'](_0x18c80a[_0x2ad8('0x32')],_0x18c80a[_0x2ad8('0x33')]);_0x1c628b[_0x2ad8('0x36')]=_[_0x2ad8('0x37')](_0x18c80a[_0x2ad8('0x32')],qs['fields'](_0x460d24[_0x2ad8('0x33')][_0x2ad8('0x38')]));_0x1c628b[_0x2ad8('0x36')]=_0x1c628b[_0x2ad8('0x36')][_0x2ad8('0x39')]?_0x1c628b['attributes']:_0x18c80a[_0x2ad8('0x32')];if(!_0x460d24[_0x2ad8('0x33')][_0x2ad8('0x3a')]('nolimit')){_0x1c628b['limit']=qs[_0x2ad8('0x21')](_0x460d24[_0x2ad8('0x33')][_0x2ad8('0x21')]);_0x1c628b[_0x2ad8('0x20')]=qs[_0x2ad8('0x20')](_0x460d24[_0x2ad8('0x33')][_0x2ad8('0x20')]);}_0x1c628b[_0x2ad8('0x3b')]=qs['sort'](_0x460d24['query'][_0x2ad8('0x3c')]);_0x1c628b['where']=qs['filters'](_[_0x2ad8('0x3d')](_0x460d24[_0x2ad8('0x33')],_0x18c80a[_0x2ad8('0x35')]),_0x3aecb5);if(_0x460d24[_0x2ad8('0x33')]['filter']){_0x1c628b[_0x2ad8('0x3e')]=_[_0x2ad8('0x3f')](_0x1c628b[_0x2ad8('0x3e')],{'$or':_['map'](_0x3aecb5,function(_0x3fcaaa){if(_0x3fcaaa[_0x2ad8('0x30')]!==_0x2ad8('0x40')){var _0x334efc={};_0x334efc[_0x3fcaaa[_0x2ad8('0x2a')]]={'$like':'%'+_0x460d24[_0x2ad8('0x33')][_0x2ad8('0x41')]+'%'};return _0x334efc;}})});}_0x1c628b=_[_0x2ad8('0x3f')]({},_0x1c628b,_0x460d24[_0x2ad8('0x42')]);var _0xec1233={'where':_0x1c628b[_0x2ad8('0x3e')]};return db[_0x2ad8('0x43')][_0x2ad8('0x1f')](_0xec1233)['then'](function(_0x2f27c3){_0x27db81[_0x2ad8('0x1f')]=_0x2f27c3;if(_0x460d24['query'][_0x2ad8('0x44')]){_0x1c628b[_0x2ad8('0x45')]=[{'all':!![]}];}return db[_0x2ad8('0x43')][_0x2ad8('0x46')](_0x1c628b);})['then'](function(_0x1f41d6){_0x27db81[_0x2ad8('0x47')]=_0x1f41d6;return _0x27db81;})[_0x2ad8('0x27')](respondWithFilteredResult(_0x121ab1,_0x1c628b))[_0x2ad8('0x48')](handleError(_0x121ab1,null));};exports['show']=function(_0x35a0a7,_0x40eb88){var _0x4ad664={'raw':!![],'where':{'id':_0x35a0a7[_0x2ad8('0x49')]['id']}},_0x149333={};_0x149333['model']=_[_0x2ad8('0x34')](db[_0x2ad8('0x43')][_0x2ad8('0x2e')]);_0x149333[_0x2ad8('0x33')]=_[_0x2ad8('0x34')](_0x35a0a7[_0x2ad8('0x33')]);_0x149333['filters']=_[_0x2ad8('0x37')](_0x149333[_0x2ad8('0x32')],_0x149333[_0x2ad8('0x33')]);_0x4ad664[_0x2ad8('0x36')]=_[_0x2ad8('0x37')](_0x149333[_0x2ad8('0x32')],qs['fields'](_0x35a0a7['query']['fields']));_0x4ad664[_0x2ad8('0x36')]=_0x4ad664[_0x2ad8('0x36')][_0x2ad8('0x39')]?_0x4ad664['attributes']:_0x149333[_0x2ad8('0x32')];if(_0x35a0a7[_0x2ad8('0x33')][_0x2ad8('0x44')]){_0x4ad664[_0x2ad8('0x45')]=[{'all':!![]}];}_0x4ad664=_[_0x2ad8('0x3f')]({},_0x4ad664,_0x35a0a7[_0x2ad8('0x42')]);return db[_0x2ad8('0x43')][_0x2ad8('0x4a')](_0x4ad664)[_0x2ad8('0x27')](handleEntityNotFound(_0x40eb88,null))[_0x2ad8('0x27')](respondWithResult(_0x40eb88,null))['catch'](handleError(_0x40eb88,null));};exports[_0x2ad8('0x4b')]=function(_0x177b47,_0x9a0e51){return db['MemberReport']['create'](_0x177b47[_0x2ad8('0x4c')],{})['then'](respondWithResult(_0x9a0e51,0xc9))[_0x2ad8('0x48')](handleError(_0x9a0e51,null));};exports[_0x2ad8('0x26')]=function(_0x248f5c,_0x5f59c9){if(_0x248f5c['body']['id']){delete _0x248f5c['body']['id'];}return db[_0x2ad8('0x43')][_0x2ad8('0x4a')]({'where':{'id':_0x248f5c['params']['id']}})['then'](handleEntityNotFound(_0x5f59c9,null))['then'](saveUpdates(_0x248f5c[_0x2ad8('0x4c')],null))[_0x2ad8('0x27')](respondWithResult(_0x5f59c9,null))[_0x2ad8('0x48')](handleError(_0x5f59c9,null));};exports['destroy']=function(_0x2bff81,_0x43daf3){return db[_0x2ad8('0x43')]['find']({'where':{'id':_0x2bff81[_0x2ad8('0x49')]['id']}})[_0x2ad8('0x27')](handleEntityNotFound(_0x43daf3,null))[_0x2ad8('0x27')](removeEntity(_0x43daf3,null))[_0x2ad8('0x48')](handleError(_0x43daf3,null));};exports['describe']=function(_0x18e557,_0x17e199){return db[_0x2ad8('0x43')][_0x2ad8('0x4d')]()[_0x2ad8('0x27')](respondWithResult(_0x17e199,null))[_0x2ad8('0x48')](handleError(_0x17e199,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1cb2c80..a81958f 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 _0xfec7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util'];(function(_0x380557,_0x278070){var _0x1fb686=function(_0x5870b4){while(--_0x5870b4){_0x380557['push'](_0x380557['shift']());}};_0x1fb686(++_0x278070);}(_0xfec7,0x64));var _0x7fec=function(_0x314460,_0x540dd2){_0x314460=_0x314460-0x0;var _0x32f6bf=_0xfec7[_0x314460];return _0x32f6bf;};'use strict';var _=require(_0x7fec('0x0'));var util=require(_0x7fec('0x1'));var logger=require(_0x7fec('0x2'))(_0x7fec('0x3'));var moment=require(_0x7fec('0x4'));var BPromise=require(_0x7fec('0x5'));var rp=require(_0x7fec('0x6'));var fs=require('fs');var path=require(_0x7fec('0x7'));var rimraf=require(_0x7fec('0x8'));var config=require(_0x7fec('0x9'));var attributes=require(_0x7fec('0xa'));module['exports']=function(_0x312b9e,_0x350172){return _0x312b9e[_0x7fec('0xb')](_0x7fec('0xc'),attributes,{'tableName':_0x7fec('0xd'),'paranoid':![],'indexes':[{'name':_0x7fec('0xe'),'fields':[_0x7fec('0xf'),_0x7fec('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd7b=['api','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername','interface','lodash','util'];(function(_0x42ee6d,_0x1e1298){var _0x46fbc5=function(_0x38647e){while(--_0x38647e){_0x42ee6d['push'](_0x42ee6d['shift']());}};_0x46fbc5(++_0x1e1298);}(_0xcd7b,0x1d2));var _0xbcd7=function(_0x4c8f5e,_0x502fd4){_0x4c8f5e=_0x4c8f5e-0x0;var _0x5b69b7=_0xcd7b[_0x4c8f5e];return _0x5b69b7;};'use strict';var _=require(_0xbcd7('0x0'));var util=require(_0xbcd7('0x1'));var logger=require('../../config/logger')(_0xbcd7('0x2'));var moment=require('moment');var BPromise=require(_0xbcd7('0x3'));var rp=require(_0xbcd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcd7('0x5'));var config=require(_0xbcd7('0x6'));var attributes=require(_0xbcd7('0x7'));module[_0xbcd7('0x8')]=function(_0x33317c,_0x161200){return _0x33317c[_0xbcd7('0x9')]('MemberReport',attributes,{'tableName':_0xbcd7('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xbcd7('0xb'),_0xbcd7('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 a27f99f..ec7af99 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 _0x9425=['error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','then','UpdateMemberReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4e21e0,_0x2cb4eb){var _0x5a53f7=function(_0x16fbc8){while(--_0x16fbc8){_0x4e21e0['push'](_0x4e21e0['shift']());}};_0x5a53f7(++_0x2cb4eb);}(_0x9425,0x100));var _0x5942=function(_0x1fec21,_0xd5c86a){_0x1fec21=_0x1fec21-0x0;var _0x49c623=_0x9425[_0x1fec21];return _0x49c623;};'use strict';var _=require(_0x5942('0x0'));var util=require(_0x5942('0x1'));var moment=require(_0x5942('0x2'));var BPromise=require(_0x5942('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5942('0x4'));var db=require(_0x5942('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5942('0x6'));var jayson=require(_0x5942('0x7'));var client=jayson[_0x5942('0x8')][_0x5942('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dfc69,_0x255d22,_0x7a6fd8){return new BPromise(function(_0x6f9752,_0x32b2bc){return client[_0x5942('0xa')](_0x2dfc69,_0x7a6fd8)['then'](function(_0x89217f){logger[_0x5942('0xb')](_0x5942('0xc'),_0x255d22,'request\x20sent');logger[_0x5942('0xd')](_0x5942('0xe'),_0x255d22,_0x5942('0xf'),JSON[_0x5942('0x10')](_0x89217f));if(_0x89217f[_0x5942('0x11')]){if(_0x89217f['error'][_0x5942('0x12')]===0x1f4){logger['error'](_0x5942('0xc'),_0x255d22,_0x89217f[_0x5942('0x11')][_0x5942('0x13')]);return _0x32b2bc(_0x89217f[_0x5942('0x11')]['message']);}logger['error']('MemberReport,\x20%s,\x20%s',_0x255d22,_0x89217f[_0x5942('0x11')][_0x5942('0x13')]);return _0x6f9752(_0x89217f['error'][_0x5942('0x13')]);}else{logger[_0x5942('0xb')](_0x5942('0xc'),_0x255d22,_0x5942('0xf'));_0x6f9752(_0x89217f[_0x5942('0x14')][_0x5942('0x13')]);}})[_0x5942('0x15')](function(_0x208579){logger[_0x5942('0x11')](_0x5942('0xc'),_0x255d22,_0x208579);_0x32b2bc(_0x208579);});});}exports[_0x5942('0x16')]=function(_0x4a2bfd){var _0x29d8ca=this;return new Promise(function(_0x17d76f,_0x5f0f9a){return db[_0x5942('0x17')][_0x5942('0x18')]({'raw':_0x4a2bfd['options']?_0x4a2bfd[_0x5942('0x19')][_0x5942('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a2bfd[_0x5942('0x19')]?_0x4a2bfd['options'][_0x5942('0x1b')]||null:null,'attributes':_0x4a2bfd['options']?_0x4a2bfd['options'][_0x5942('0x1c')]||null:null,'limit':_0x4a2bfd[_0x5942('0x19')]?_0x4a2bfd['options'][_0x5942('0x1d')]||null:null,'include':_0x4a2bfd[_0x5942('0x19')]?_0x4a2bfd[_0x5942('0x19')]['include']?_[_0x5942('0x1e')](_0x4a2bfd[_0x5942('0x19')][_0x5942('0x1f')],function(_0x436f51){return{'model':db[_0x436f51['model']],'as':_0x436f51['as'],'attributes':_0x436f51[_0x5942('0x1c')],'include':_0x436f51[_0x5942('0x1f')]?_[_0x5942('0x1e')](_0x436f51['include'],function(_0x2f2776){return{'model':db[_0x2f2776[_0x5942('0x20')]],'as':_0x2f2776['as'],'attributes':_0x2f2776[_0x5942('0x1c')],'include':_0x2f2776[_0x5942('0x1f')]?_['map'](_0x2f2776['include'],function(_0x1c8260){return{'model':db[_0x1c8260[_0x5942('0x20')]],'as':_0x1c8260['as'],'attributes':_0x1c8260[_0x5942('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2926ef){logger['info'](_0x5942('0x16'),_0x4a2bfd);logger[_0x5942('0xd')](_0x5942('0x16'),_0x4a2bfd,JSON[_0x5942('0x10')](_0x2926ef));_0x17d76f(_0x2926ef);})[_0x5942('0x15')](function(_0x3d8f70){logger[_0x5942('0x11')]('GetMemberReport',_0x3d8f70[_0x5942('0x13')],_0x4a2bfd);_0x5f0f9a(_0x29d8ca[_0x5942('0x11')](0x1f4,_0x3d8f70['message']));});});};exports[_0x5942('0x21')]=function(_0x2b31e8){var _0x37c2b1=this;return new Promise(function(_0x34a63e,_0x1f3295){return db['MemberReport'][_0x5942('0x22')](_0x2b31e8[_0x5942('0x23')],{'raw':_0x2b31e8['options']?_0x2b31e8[_0x5942('0x19')][_0x5942('0x1a')]===undefined?!![]:![]:!![]})[_0x5942('0x24')](function(_0x19300b){logger['info'](_0x5942('0x21'),_0x2b31e8);logger[_0x5942('0xd')]('CreateMemberReport',_0x2b31e8,JSON['stringify'](_0x19300b));_0x34a63e(_0x19300b);})['catch'](function(_0x2167c2){logger['error'](_0x5942('0x21'),_0x2167c2[_0x5942('0x13')],_0x2b31e8);_0x1f3295(_0x37c2b1[_0x5942('0x11')](0x1f4,_0x2167c2['message']));});});};exports[_0x5942('0x25')]=function(_0x56f8f8){var _0x782fc8=this;return new Promise(function(_0x3d85dc,_0x1ef593){return db[_0x5942('0x17')][_0x5942('0x26')](_0x56f8f8[_0x5942('0x23')],{'raw':_0x56f8f8[_0x5942('0x19')]?_0x56f8f8[_0x5942('0x19')][_0x5942('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56f8f8['options']?_0x56f8f8[_0x5942('0x19')][_0x5942('0x1b')]||null:null,'attributes':_0x56f8f8[_0x5942('0x19')]?_0x56f8f8[_0x5942('0x19')][_0x5942('0x1c')]||null:null,'limit':_0x56f8f8['options']?_0x56f8f8[_0x5942('0x19')]['limit']||null:null})[_0x5942('0x24')](function(_0x5c6719){logger[_0x5942('0xb')](_0x5942('0x25'),_0x56f8f8);logger[_0x5942('0xd')]('UpdateMemberReport',_0x56f8f8,JSON[_0x5942('0x10')](_0x5c6719));_0x3d85dc(_0x5c6719);})['catch'](function(_0x244c9d){logger[_0x5942('0x11')](_0x5942('0x25'),_0x244c9d[_0x5942('0x13')],_0x56f8f8);_0x1ef593(_0x782fc8[_0x5942('0x11')](0x1f4,_0x244c9d[_0x5942('0x13')]));});});}; \ No newline at end of file +var _0xa9e7=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','findAll','raw','options','where','attributes','include','map','model','GetMemberReport','body','CreateMemberReport','UpdateMemberReport','update','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3b94d0,_0x1efcb7){var _0x1e9b77=function(_0x54c64e){while(--_0x54c64e){_0x3b94d0['push'](_0x3b94d0['shift']());}};_0x1e9b77(++_0x1efcb7);}(_0xa9e7,0x92));var _0x7a9e=function(_0x49cbdd,_0x476a3f){_0x49cbdd=_0x49cbdd-0x0;var _0x116832=_0xa9e7[_0x49cbdd];return _0x116832;};'use strict';var _=require(_0x7a9e('0x0'));var util=require(_0x7a9e('0x1'));var moment=require(_0x7a9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a9e('0x3'));var fs=require('fs');var Redis=require(_0x7a9e('0x4'));var db=require(_0x7a9e('0x5'))['db'];var utils=require(_0x7a9e('0x6'));var logger=require(_0x7a9e('0x7'))(_0x7a9e('0x8'));var config=require(_0x7a9e('0x9'));var jayson=require(_0x7a9e('0xa'));var client=jayson[_0x7a9e('0xb')][_0x7a9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10f23d,_0x5ce028,_0x59052e){return new BPromise(function(_0x56daa4,_0x4c2629){return client[_0x7a9e('0xd')](_0x10f23d,_0x59052e)[_0x7a9e('0xe')](function(_0x4411af){logger[_0x7a9e('0xf')](_0x7a9e('0x10'),_0x5ce028,_0x7a9e('0x11'));logger[_0x7a9e('0x12')](_0x7a9e('0x13'),_0x5ce028,'request\x20sent',JSON[_0x7a9e('0x14')](_0x4411af));if(_0x4411af['error']){if(_0x4411af[_0x7a9e('0x15')][_0x7a9e('0x16')]===0x1f4){logger[_0x7a9e('0x15')](_0x7a9e('0x10'),_0x5ce028,_0x4411af[_0x7a9e('0x15')][_0x7a9e('0x17')]);return _0x4c2629(_0x4411af[_0x7a9e('0x15')]['message']);}logger[_0x7a9e('0x15')](_0x7a9e('0x10'),_0x5ce028,_0x4411af[_0x7a9e('0x15')][_0x7a9e('0x17')]);return _0x56daa4(_0x4411af[_0x7a9e('0x15')][_0x7a9e('0x17')]);}else{logger[_0x7a9e('0xf')](_0x7a9e('0x10'),_0x5ce028,'request\x20sent');_0x56daa4(_0x4411af[_0x7a9e('0x18')][_0x7a9e('0x17')]);}})[_0x7a9e('0x19')](function(_0x44b7c7){logger['error'](_0x7a9e('0x10'),_0x5ce028,_0x44b7c7);_0x4c2629(_0x44b7c7);});});}exports['GetMemberReport']=function(_0x114854){var _0x3391fd=this;return new Promise(function(_0x25ebdf,_0x5d39b6){return db[_0x7a9e('0x1a')][_0x7a9e('0x1b')]({'raw':_0x114854['options']?_0x114854['options'][_0x7a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x114854[_0x7a9e('0x1d')]?_0x114854['options'][_0x7a9e('0x1e')]||null:null,'attributes':_0x114854[_0x7a9e('0x1d')]?_0x114854['options'][_0x7a9e('0x1f')]||null:null,'limit':_0x114854[_0x7a9e('0x1d')]?_0x114854[_0x7a9e('0x1d')]['limit']||null:null,'include':_0x114854[_0x7a9e('0x1d')]?_0x114854[_0x7a9e('0x1d')][_0x7a9e('0x20')]?_[_0x7a9e('0x21')](_0x114854[_0x7a9e('0x1d')][_0x7a9e('0x20')],function(_0x475e60){return{'model':db[_0x475e60['model']],'as':_0x475e60['as'],'attributes':_0x475e60[_0x7a9e('0x1f')],'include':_0x475e60[_0x7a9e('0x20')]?_[_0x7a9e('0x21')](_0x475e60[_0x7a9e('0x20')],function(_0x3acdd9){return{'model':db[_0x3acdd9[_0x7a9e('0x22')]],'as':_0x3acdd9['as'],'attributes':_0x3acdd9[_0x7a9e('0x1f')],'include':_0x3acdd9[_0x7a9e('0x20')]?_[_0x7a9e('0x21')](_0x3acdd9['include'],function(_0x511974){return{'model':db[_0x511974[_0x7a9e('0x22')]],'as':_0x511974['as'],'attributes':_0x511974[_0x7a9e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7a9e('0xe')](function(_0x28e09e){logger[_0x7a9e('0xf')](_0x7a9e('0x23'),_0x114854);logger[_0x7a9e('0x12')](_0x7a9e('0x23'),_0x114854,JSON['stringify'](_0x28e09e));_0x25ebdf(_0x28e09e);})['catch'](function(_0x258465){logger[_0x7a9e('0x15')](_0x7a9e('0x23'),_0x258465['message'],_0x114854);_0x5d39b6(_0x3391fd[_0x7a9e('0x15')](0x1f4,_0x258465['message']));});});};exports['CreateMemberReport']=function(_0x2b4255){var _0x26c7d0=this;return new Promise(function(_0x364ff8,_0x2ac970){return db[_0x7a9e('0x1a')]['create'](_0x2b4255[_0x7a9e('0x24')],{'raw':_0x2b4255[_0x7a9e('0x1d')]?_0x2b4255['options'][_0x7a9e('0x1c')]===undefined?!![]:![]:!![]})[_0x7a9e('0xe')](function(_0x3a36d1){logger[_0x7a9e('0xf')]('CreateMemberReport',_0x2b4255);logger['debug'](_0x7a9e('0x25'),_0x2b4255,JSON[_0x7a9e('0x14')](_0x3a36d1));_0x364ff8(_0x3a36d1);})[_0x7a9e('0x19')](function(_0x567012){logger[_0x7a9e('0x15')](_0x7a9e('0x25'),_0x567012[_0x7a9e('0x17')],_0x2b4255);_0x2ac970(_0x26c7d0[_0x7a9e('0x15')](0x1f4,_0x567012[_0x7a9e('0x17')]));});});};exports[_0x7a9e('0x26')]=function(_0x4488e8){var _0x57bd14=this;return new Promise(function(_0x1a96d2,_0x1a2177){return db[_0x7a9e('0x1a')][_0x7a9e('0x27')](_0x4488e8['body'],{'raw':_0x4488e8['options']?_0x4488e8[_0x7a9e('0x1d')][_0x7a9e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4488e8[_0x7a9e('0x1d')]?_0x4488e8[_0x7a9e('0x1d')][_0x7a9e('0x1e')]||null:null,'attributes':_0x4488e8['options']?_0x4488e8[_0x7a9e('0x1d')][_0x7a9e('0x1f')]||null:null,'limit':_0x4488e8[_0x7a9e('0x1d')]?_0x4488e8[_0x7a9e('0x1d')][_0x7a9e('0x28')]||null:null})[_0x7a9e('0xe')](function(_0x1b97c8){logger['info'](_0x7a9e('0x26'),_0x4488e8);logger[_0x7a9e('0x12')](_0x7a9e('0x26'),_0x4488e8,JSON[_0x7a9e('0x14')](_0x1b97c8));_0x1a96d2(_0x1b97c8);})[_0x7a9e('0x19')](function(_0x5abbc6){logger[_0x7a9e('0x15')](_0x7a9e('0x26'),_0x5abbc6[_0x7a9e('0x17')],_0x4488e8);_0x1a2177(_0x57bd14[_0x7a9e('0x15')](0x1f4,_0x5abbc6[_0x7a9e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 9e852ca..b1fd4eb 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 _0x04b8=['index','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x34cfe4,_0x4da303){var _0x5c6d50=function(_0x222024){while(--_0x222024){_0x34cfe4['push'](_0x34cfe4['shift']());}};_0x5c6d50(++_0x4da303);}(_0x04b8,0x159));var _0x804b=function(_0x299cba,_0x47ae85){_0x299cba=_0x299cba-0x0;var _0x3e0673=_0x04b8[_0x299cba];return _0x3e0673;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var auth=require(_0x804b('0x3'));var interaction=require(_0x804b('0x4'));var config=require('../../config/environment');var controller=require(_0x804b('0x5'));router[_0x804b('0x6')]('/',controller[_0x804b('0x7')]);module['exports']=router; \ No newline at end of file +var _0x1775=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path','connect-timeout','express','Router'];(function(_0x482027,_0xb281d2){var _0x361e4d=function(_0x194799){while(--_0x194799){_0x482027['push'](_0x482027['shift']());}};_0x361e4d(++_0xb281d2);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',controller[_0x5177('0xa')]);module[_0x5177('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 13bdb4f..c0ac844 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 _0x518c=['version','sequelize','exports'];(function(_0x34784d,_0x11d6b1){var _0x6d3773=function(_0x5d8535){while(--_0x5d8535){_0x34784d['push'](_0x34784d['shift']());}};_0x6d3773(++_0x11d6b1);}(_0x518c,0x13f));var _0xc518=function(_0x3d18d8,_0x3fd970){_0x3d18d8=_0x3d18d8-0x0;var _0x34e916=_0x518c[_0x3d18d8];return _0x34e916;};'use strict';var Sequelize=require(_0xc518('0x0'));module[_0xc518('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xc518('0x2')}}; \ No newline at end of file +var _0x92e5=['version','exports','STRING'];(function(_0x2d65ca,_0x18ffec){var _0x200ace=function(_0x3c1ca9){while(--_0x3c1ca9){_0x2d65ca['push'](_0x2d65ca['shift']());}};_0x200ace(++_0x18ffec);}(_0x92e5,0x64));var _0x592e=function(_0xfa1d6,_0x5ef25e){_0xfa1d6=_0xfa1d6-0x0;var _0x2606f5=_0x92e5[_0xfa1d6];return _0x2606f5;};'use strict';var Sequelize=require('sequelize');module[_0x592e('0x0')]={'version':{'type':Sequelize[_0x592e('0x1')],'unique':_0x592e('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2bf54d2..c49889c 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 _0xb43b=['filters','pick','filter','merge','options','count','includeAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','Migration','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x576af3,_0x2485b7){_0x576af3=_0x576af3-0x0;var _0x2670b2=_0xb43b[_0x576af3];return _0x2670b2;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');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 db=require(_0xbb43('0x17'))['db'];function respondWithStatusCode(_0x2a5a4d,_0x50e2c0){_0x50e2c0=_0x50e2c0||0xcc;return function(_0x578392){if(_0x578392){return _0x2a5a4d[_0xbb43('0x18')](_0x50e2c0);}return _0x2a5a4d['status'](_0x50e2c0)['end']();};}function respondWithResult(_0x438591,_0x5a509f){_0x5a509f=_0x5a509f||0xc8;return function(_0x68d45d){if(_0x68d45d){return _0x438591[_0xbb43('0x19')](_0x5a509f)['json'](_0x68d45d);}};}function respondWithFilteredResult(_0x4a6e18,_0x4d5bcf){return function(_0x338120){if(_0x338120){var _0x2abce0=_0x338120['count'],_0x57bd1d=_0x4d5bcf['offset'],_0x526330=_0x4d5bcf[_0xbb43('0x1a')]+_0x4d5bcf[_0xbb43('0x1b')],_0x202980;if(_0x526330>=_0x2abce0){_0x526330=_0x2abce0;_0x202980=0xc8;}else{_0x202980=0xce;}_0x4a6e18[_0xbb43('0x19')](_0x202980);return _0x4a6e18['set'](_0xbb43('0x1c'),_0x57bd1d+'-'+_0x526330+'/'+_0x2abce0)['json'](_0x338120);}return null;};}function patchUpdates(_0x3bb57d){return function(_0x8e6429){try{jsonpatch['apply'](_0x8e6429,_0x3bb57d,!![]);}catch(_0x5d765b){return BPromise[_0xbb43('0x1d')](_0x5d765b);}return _0x8e6429[_0xbb43('0x1e')]();};}function saveUpdates(_0xdb7f2e,_0x2bf2d4){return function(_0x5bcce7){if(_0x5bcce7){return _0x5bcce7[_0xbb43('0x1f')](_0xdb7f2e)['then'](function(_0x3a257d){return _0x3a257d;});}return null;};}function removeEntity(_0x4bfaca,_0x2f5e31){return function(_0x565256){if(_0x565256){return _0x565256[_0xbb43('0x20')]()[_0xbb43('0x21')](function(){_0x4bfaca['status'](0xcc)[_0xbb43('0x22')]();});}};}function handleEntityNotFound(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(!_0x298ce2){_0x4dfb7f[_0xbb43('0x18')](0x194);}return _0x298ce2;};}function handleError(_0x4d6d77,_0x53f0d5){_0x53f0d5=_0x53f0d5||0x1f4;return function(_0x59a24d){logger[_0xbb43('0x23')](_0x59a24d[_0xbb43('0x24')]);if(_0x59a24d['name']){delete _0x59a24d[_0xbb43('0x25')];}_0x4d6d77[_0xbb43('0x19')](_0x53f0d5)[_0xbb43('0x26')](_0x59a24d);};}exports[_0xbb43('0x27')]=function(_0x4ed43f,_0x4b5342){var _0x27fd7a={},_0x42800f={},_0xa88db0={'count':0x0,'rows':[]};var _0x8b3205=_[_0xbb43('0x28')](db[_0xbb43('0x29')][_0xbb43('0x2a')],function(_0x473828){return{'name':_0x473828['fieldName'],'type':_0x473828[_0xbb43('0x2b')]['key']};});_0x42800f[_0xbb43('0x2c')]=_[_0xbb43('0x28')](_0x8b3205,_0xbb43('0x25'));_0x42800f[_0xbb43('0x2d')]=_['keys'](_0x4ed43f[_0xbb43('0x2d')]);_0x42800f['filters']=_['intersection'](_0x42800f['model'],_0x42800f[_0xbb43('0x2d')]);_0x27fd7a['attributes']=_[_0xbb43('0x2e')](_0x42800f[_0xbb43('0x2c')],qs[_0xbb43('0x2f')](_0x4ed43f['query'][_0xbb43('0x2f')]));_0x27fd7a[_0xbb43('0x30')]=_0x27fd7a[_0xbb43('0x30')][_0xbb43('0x31')]?_0x27fd7a[_0xbb43('0x30')]:_0x42800f[_0xbb43('0x2c')];if(!_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x32')]('nolimit')){_0x27fd7a[_0xbb43('0x1b')]=qs[_0xbb43('0x1b')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x1b')]);_0x27fd7a[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x1a')]);}_0x27fd7a[_0xbb43('0x33')]=qs[_0xbb43('0x34')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x34')]);_0x27fd7a[_0xbb43('0x35')]=qs[_0xbb43('0x36')](_[_0xbb43('0x37')](_0x4ed43f[_0xbb43('0x2d')],_0x42800f['filters']),_0x8b3205);if(_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x38')]){_0x27fd7a['where']=_[_0xbb43('0x39')](_0x27fd7a[_0xbb43('0x35')],{'$or':_[_0xbb43('0x28')](_0x8b3205,function(_0x5374a2){if(_0x5374a2['type']!=='VIRTUAL'){var _0x40df31={};_0x40df31[_0x5374a2[_0xbb43('0x25')]]={'$like':'%'+_0x4ed43f['query']['filter']+'%'};return _0x40df31;}})});}_0x27fd7a=_[_0xbb43('0x39')]({},_0x27fd7a,_0x4ed43f[_0xbb43('0x3a')]);var _0x29f6e5={'where':_0x27fd7a[_0xbb43('0x35')]};return db[_0xbb43('0x29')]['count'](_0x29f6e5)[_0xbb43('0x21')](function(_0x526cb8){_0xa88db0[_0xbb43('0x3b')]=_0x526cb8;if(_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x3c')]){_0x27fd7a['include']=[{'all':!![]}];}return db[_0xbb43('0x29')]['findAll'](_0x27fd7a);})[_0xbb43('0x21')](function(_0x93aa1c){_0xa88db0['rows']=_0x93aa1c;return _0xa88db0;})[_0xbb43('0x21')](respondWithFilteredResult(_0x4b5342,_0x27fd7a))['catch'](handleError(_0x4b5342,null));}; \ No newline at end of file +var _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0x70e0,0x17b));var _0x070e=function(_0xa03f35,_0x33da1b){_0xa03f35=_0xa03f35-0x0;var _0xcdd20c=_0x70e0[_0xa03f35];return _0xcdd20c;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index eb11c58..cf1ead9 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 _0x903b=['bluebird','request-promise','path','../../config/environment','exports','Migration','migrations','util','../../config/logger','moment'];(function(_0x1137f8,_0x3be14e){var _0x350d46=function(_0x4f4c13){while(--_0x4f4c13){_0x1137f8['push'](_0x1137f8['shift']());}};_0x350d46(++_0x3be14e);}(_0x903b,0x179));var _0xb903=function(_0x4f3d39,_0x52886b){_0x4f3d39=_0x4f3d39-0x0;var _0x277322=_0x903b[_0x4f3d39];return _0x277322;};'use strict';var _=require('lodash');var util=require(_0xb903('0x0'));var logger=require(_0xb903('0x1'))('api');var moment=require(_0xb903('0x2'));var BPromise=require(_0xb903('0x3'));var rp=require(_0xb903('0x4'));var fs=require('fs');var path=require(_0xb903('0x5'));var rimraf=require('rimraf');var config=require(_0xb903('0x6'));var attributes=require('./migration.attributes');module[_0xb903('0x7')]=function(_0x40f5d8,_0x484eed){return _0x40f5d8['define'](_0xb903('0x8'),attributes,{'tableName':_0xb903('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd37f=['rimraf','../../config/environment','exports','define','Migration','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xd37f,0xb5));var _0xfd37=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd37f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xfd37('0x0'));var util=require(_0xfd37('0x1'));var logger=require(_0xfd37('0x2'))(_0xfd37('0x3'));var moment=require('moment');var BPromise=require(_0xfd37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd37('0x5'));var rimraf=require(_0xfd37('0x6'));var config=require(_0xfd37('0x7'));var attributes=require('./migration.attributes');module[_0xfd37('0x8')]=function(_0x5c8f34,_0x21cb98){return _0x5c8f34[_0xfd37('0x9')](_0xfd37('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 6523b91..9d44ccf 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 _0x568a=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2cf38c,_0x5b2102){var _0x3b56c6=function(_0x43895c){while(--_0x43895c){_0x2cf38c['push'](_0x2cf38c['shift']());}};_0x3b56c6(++_0x5b2102);}(_0x568a,0xcd));var _0xa568=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x568a[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xa568('0x0'));var util=require(_0xa568('0x1'));var moment=require(_0xa568('0x2'));var BPromise=require(_0xa568('0x3'));var rs=require(_0xa568('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa568('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa568('0x6')][_0xa568('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12160d,_0x1cf69c,_0x4ae3ee){return new BPromise(function(_0x2643d9,_0x11b9ae){return client[_0xa568('0x8')](_0x12160d,_0x4ae3ee)[_0xa568('0x9')](function(_0x1aabf7){logger['info'](_0xa568('0xa'),_0x1cf69c,_0xa568('0xb'));logger[_0xa568('0xc')](_0xa568('0xd'),_0x1cf69c,'request\x20sent',JSON[_0xa568('0xe')](_0x1aabf7));if(_0x1aabf7[_0xa568('0xf')]){if(_0x1aabf7[_0xa568('0xf')][_0xa568('0x10')]===0x1f4){logger[_0xa568('0xf')](_0xa568('0xa'),_0x1cf69c,_0x1aabf7[_0xa568('0xf')]['message']);return _0x11b9ae(_0x1aabf7['error'][_0xa568('0x11')]);}logger[_0xa568('0xf')](_0xa568('0xa'),_0x1cf69c,_0x1aabf7[_0xa568('0xf')][_0xa568('0x11')]);return _0x2643d9(_0x1aabf7[_0xa568('0xf')][_0xa568('0x11')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x1cf69c,_0xa568('0xb'));_0x2643d9(_0x1aabf7[_0xa568('0x12')][_0xa568('0x11')]);}})[_0xa568('0x13')](function(_0x114289){logger['error'](_0xa568('0xa'),_0x1cf69c,_0x114289);_0x11b9ae(_0x114289);});});} \ No newline at end of file +var _0x6e90=['error','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2711b7,_0x309ca6){var _0x27c40c=function(_0x569f06){while(--_0x569f06){_0x2711b7['push'](_0x2711b7['shift']());}};_0x27c40c(++_0x309ca6);}(_0x6e90,0xf5));var _0x06e9=function(_0x10c9f2,_0x2f7296){_0x10c9f2=_0x10c9f2-0x0;var _0x5cf80c=_0x6e90[_0x10c9f2];return _0x5cf80c;};'use strict';var _=require(_0x06e9('0x0'));var util=require(_0x06e9('0x1'));var moment=require(_0x06e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x06e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x06e9('0x4'));var logger=require(_0x06e9('0x5'))(_0x06e9('0x6'));var config=require(_0x06e9('0x7'));var jayson=require(_0x06e9('0x8'));var client=jayson[_0x06e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3781fc,_0x2215d6,_0xce440a){return new BPromise(function(_0x329db1,_0x2c86f1){return client[_0x06e9('0xa')](_0x3781fc,_0xce440a)[_0x06e9('0xb')](function(_0x4af2ca){logger[_0x06e9('0xc')](_0x06e9('0xd'),_0x2215d6,_0x06e9('0xe'));logger[_0x06e9('0xf')](_0x06e9('0x10'),_0x2215d6,_0x06e9('0xe'),JSON[_0x06e9('0x11')](_0x4af2ca));if(_0x4af2ca['error']){if(_0x4af2ca['error'][_0x06e9('0x12')]===0x1f4){logger[_0x06e9('0x13')](_0x06e9('0xd'),_0x2215d6,_0x4af2ca[_0x06e9('0x13')][_0x06e9('0x14')]);return _0x2c86f1(_0x4af2ca[_0x06e9('0x13')]['message']);}logger[_0x06e9('0x13')](_0x06e9('0xd'),_0x2215d6,_0x4af2ca[_0x06e9('0x13')][_0x06e9('0x14')]);return _0x329db1(_0x4af2ca[_0x06e9('0x13')][_0x06e9('0x14')]);}else{logger[_0x06e9('0xc')](_0x06e9('0xd'),_0x2215d6,_0x06e9('0xe'));_0x329db1(_0x4af2ca[_0x06e9('0x15')][_0x06e9('0x14')]);}})['catch'](function(_0x524301){logger[_0x06e9('0x13')](_0x06e9('0xd'),_0x2215d6,_0x524301);_0x2c86f1(_0x524301);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f1b9724..cffa184 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 _0x531f=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x350ae7,_0xffc7f){var _0x2221d2=function(_0x551bf8){while(--_0x551bf8){_0x350ae7['push'](_0x350ae7['shift']());}};_0x2221d2(++_0xffc7f);}(_0x531f,0x16a));var _0xf531=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x531f[_0x5d6c3e];return _0x44ecb7;};'use strict';var multer=require(_0xf531('0x0'));var util=require(_0xf531('0x1'));var path=require(_0xf531('0x2'));var timeout=require(_0xf531('0x3'));var express=require(_0xf531('0x4'));var router=express[_0xf531('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf531('0x6'));var config=require(_0xf531('0x7'));var controller=require('./network.controller');router['get']('/',auth[_0xf531('0x8')](),controller[_0xf531('0x9')]);router[_0xf531('0xa')](_0xf531('0xb'),auth[_0xf531('0x8')](),controller[_0xf531('0xc')]);router[_0xf531('0xd')]('/',auth[_0xf531('0x8')](),controller[_0xf531('0xe')]);router[_0xf531('0xf')](_0xf531('0xb'),auth[_0xf531('0x8')](),controller[_0xf531('0x10')]);router['delete'](_0xf531('0xb'),auth[_0xf531('0x8')](),controller['destroy']);module[_0xf531('0x11')]=router; \ No newline at end of file +var _0xce68=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','index','show','post','isAuthenticated','create','/:id','update','delete'];(function(_0x261c6c,_0x409160){var _0x432299=function(_0x7486df){while(--_0x7486df){_0x261c6c['push'](_0x261c6c['shift']());}};_0x432299(++_0x409160);}(_0xce68,0x10c));var _0x8ce6=function(_0x332c62,_0x305dd9){_0x332c62=_0x332c62-0x0;var _0x5c2423=_0xce68[_0x332c62];return _0x5c2423;};'use strict';var multer=require(_0x8ce6('0x0'));var util=require('util');var path=require(_0x8ce6('0x1'));var timeout=require(_0x8ce6('0x2'));var express=require(_0x8ce6('0x3'));var router=express[_0x8ce6('0x4')]();var auth=require(_0x8ce6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8ce6('0x6'));var controller=require(_0x8ce6('0x7'));router[_0x8ce6('0x8')]('/',auth['isAuthenticated'](),controller[_0x8ce6('0x9')]);router[_0x8ce6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8ce6('0xa')]);router[_0x8ce6('0xb')]('/',auth[_0x8ce6('0xc')](),controller[_0x8ce6('0xd')]);router['put'](_0x8ce6('0xe'),auth[_0x8ce6('0xc')](),controller[_0x8ce6('0xf')]);router[_0x8ce6('0x10')](_0x8ce6('0xe'),auth[_0x8ce6('0xc')](),controller[_0x8ce6('0x11')]);module[_0x8ce6('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index af8f478..04be35d 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x340c26,_0x2aea58){var _0x1c1514=function(_0x3025be){while(--_0x3025be){_0x340c26['push'](_0x340c26['shift']());}};_0x1c1514(++_0x2aea58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x9c5a2c,_0x29767b){var _0x3aaab4=function(_0x22a0a9){while(--_0x22a0a9){_0x9c5a2c['push'](_0x9c5a2c['shift']());}};_0x3aaab4(++_0x29767b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9e05000..208617f 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 _0x912b=['Sequelize','ValidationError','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','stack','name','send','index','Network','rawAttributes','type','model','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','findAll','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','test'];(function(_0x30bb89,_0x1a17b8){var _0x46febf=function(_0x5df15e){while(--_0x5df15e){_0x30bb89['push'](_0x30bb89['shift']());}};_0x46febf(++_0x1a17b8);}(_0x912b,0x190));var _0xb912=function(_0xc4e092,_0x5059f7){_0xc4e092=_0xc4e092-0x0;var _0xa4f542=_0x912b[_0xc4e092];return _0xa4f542;};'use strict';var pdf=require(_0xb912('0x0'));var emlformat=require(_0xb912('0x1'));var rimraf=require(_0xb912('0x2'));var zipdir=require(_0xb912('0x3'));var jsonpatch=require(_0xb912('0x4'));var rp=require('request-promise');var moment=require(_0xb912('0x5'));var BPromise=require(_0xb912('0x6'));var Mustache=require(_0xb912('0x7'));var util=require(_0xb912('0x8'));var path=require('path');var sox=require(_0xb912('0x9'));var csv=require(_0xb912('0xa'));var ejs=require(_0xb912('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb912('0xc'));var crypto=require(_0xb912('0xd'));var jsforce=require(_0xb912('0xe'));var deskjs=require(_0xb912('0xf'));var toCsv=require(_0xb912('0xa'));var querystring=require(_0xb912('0x10'));var Papa=require(_0xb912('0x11'));var Redis=require('ioredis');var authService=require(_0xb912('0x12'));var qs=require(_0xb912('0x13'));var as=require(_0xb912('0x14'));var hardwareService=require(_0xb912('0x15'));var logger=require(_0xb912('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb912('0x17'));var db=require(_0xb912('0x18'))['db'];var jayson=require(_0xb912('0x19'));var client=jayson['client'][_0xb912('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3e0769,_0x5078d5,_0x12e791){if(_0x12e791){var _0x1016b8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1016b8[_0xb912('0x1b')](_0x5078d5)){return _0x3e0769;}else{throw new db[(_0xb912('0x1c'))][(_0xb912('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3e0769;}}function respondWithRpcPromise(_0x45e63e,_0x2ab597,_0x35948d,_0x3c25a7){return new BPromise(function(_0xf70289,_0x1e6aab){var _0x35563e=_0x3c25a7||client;return _0x35563e['request'](_0x45e63e,_0x35948d)[_0xb912('0x1e')](function(_0x59e543){logger[_0xb912('0x1f')](_0xb912('0x20'),_0x2ab597,_0xb912('0x21'));logger['debug'](_0xb912('0x22'),_0x2ab597,_0xb912('0x21'),JSON[_0xb912('0x23')](_0x59e543));if(_0x59e543['error']){if(_0x59e543[_0xb912('0x24')]['code']===0x1f4){logger['error'](_0xb912('0x20'),_0x2ab597,_0x59e543[_0xb912('0x24')][_0xb912('0x25')]);return _0x1e6aab(_0x59e543['error'][_0xb912('0x25')]);}logger['error']('Network,\x20%s,\x20%s',_0x2ab597,_0x59e543[_0xb912('0x24')][_0xb912('0x25')]);return _0xf70289(_0x59e543[_0xb912('0x24')]['message']);}else{logger['info'](_0xb912('0x20'),_0x2ab597,'request\x20sent');_0xf70289(_0x59e543['result']['message']);}})[_0xb912('0x26')](function(_0x2c7dc7){logger['error'](_0xb912('0x20'),_0x2ab597,_0x2c7dc7);_0x1e6aab(_0x2c7dc7);});});}function respondWithStatusCode(_0x1f4ab9,_0x4a9f08){_0x4a9f08=_0x4a9f08||0xcc;return function(_0x3ef143){if(_0x3ef143){return _0x1f4ab9[_0xb912('0x27')](_0x4a9f08);}return _0x1f4ab9['status'](_0x4a9f08)[_0xb912('0x28')]();};}function respondWithResult(_0x188f92,_0x39ef99){_0x39ef99=_0x39ef99||0xc8;return function(_0x1b68fa){if(_0x1b68fa){return _0x188f92[_0xb912('0x29')](_0x39ef99)[_0xb912('0x2a')](_0x1b68fa);}};}function respondWithFilteredResult(_0x16198e,_0x45b06d){return function(_0x54b3b1){if(_0x54b3b1){var _0xa6431c=_0x54b3b1[_0xb912('0x2b')],_0x1bbbb0=_0x45b06d[_0xb912('0x2c')],_0x36d216=_0x45b06d[_0xb912('0x2c')]+_0x45b06d['limit'],_0x5f11d8;if(_0x36d216>=_0xa6431c){_0x36d216=_0xa6431c;_0x5f11d8=0xc8;}else{_0x5f11d8=0xce;}_0x16198e[_0xb912('0x29')](_0x5f11d8);return _0x16198e[_0xb912('0x2d')](_0xb912('0x2e'),_0x1bbbb0+'-'+_0x36d216+'/'+_0xa6431c)[_0xb912('0x2a')](_0x54b3b1);}return null;};}function patchUpdates(_0xb89d95){return function(_0x2fc9dc){try{jsonpatch[_0xb912('0x2f')](_0x2fc9dc,_0xb89d95,!![]);}catch(_0x4f00e2){return BPromise['reject'](_0x4f00e2);}return _0x2fc9dc['save']();};}function saveUpdates(_0x228c20,_0x2a8e3b){return function(_0x22ef53){if(_0x22ef53){return _0x22ef53[_0xb912('0x30')](_0x228c20)[_0xb912('0x1e')](function(_0x478529){return _0x478529;});}return null;};}function removeEntity(_0x4c0abf,_0x16ac43){return function(_0x50788e){if(_0x50788e){return _0x50788e['destroy']()[_0xb912('0x1e')](function(){_0x4c0abf[_0xb912('0x29')](0xcc)[_0xb912('0x28')]();});}};}function handleEntityNotFound(_0x226267,_0x16130d){return function(_0x22edd2){if(!_0x22edd2){_0x226267[_0xb912('0x27')](0x194);}return _0x22edd2;};}function handleError(_0x352c16,_0x415ea5){_0x415ea5=_0x415ea5||0x1f4;return function(_0x23a48a){logger[_0xb912('0x24')](_0x23a48a[_0xb912('0x31')]);if(_0x23a48a[_0xb912('0x32')]){delete _0x23a48a['name'];}_0x352c16[_0xb912('0x29')](_0x415ea5)[_0xb912('0x33')](_0x23a48a);};}exports[_0xb912('0x34')]=function(_0x3c46c4,_0x17f82e){var _0x2529e9={},_0x3b420a={},_0x222313={'count':0x0,'rows':[]};var _0x22d131=_['map'](db[_0xb912('0x35')][_0xb912('0x36')],function(_0x206e75){return{'name':_0x206e75['fieldName'],'type':_0x206e75[_0xb912('0x37')]['key']};});_0x3b420a[_0xb912('0x38')]=_['map'](_0x22d131,_0xb912('0x32'));_0x3b420a['query']=_['keys'](_0x3c46c4[_0xb912('0x39')]);_0x3b420a[_0xb912('0x3a')]=_['intersection'](_0x3b420a[_0xb912('0x38')],_0x3b420a[_0xb912('0x39')]);_0x2529e9['attributes']=_[_0xb912('0x3b')](_0x3b420a[_0xb912('0x38')],qs[_0xb912('0x3c')](_0x3c46c4['query'][_0xb912('0x3c')]));_0x2529e9[_0xb912('0x3d')]=_0x2529e9[_0xb912('0x3d')]['length']?_0x2529e9[_0xb912('0x3d')]:_0x3b420a[_0xb912('0x38')];if(!_0x3c46c4[_0xb912('0x39')]['hasOwnProperty'](_0xb912('0x3e'))){_0x2529e9['limit']=qs['limit'](_0x3c46c4[_0xb912('0x39')][_0xb912('0x3f')]);_0x2529e9[_0xb912('0x2c')]=qs[_0xb912('0x2c')](_0x3c46c4[_0xb912('0x39')][_0xb912('0x2c')]);}_0x2529e9[_0xb912('0x40')]=qs[_0xb912('0x41')](_0x3c46c4[_0xb912('0x39')][_0xb912('0x41')]);_0x2529e9['where']=qs[_0xb912('0x3a')](_[_0xb912('0x42')](_0x3c46c4[_0xb912('0x39')],_0x3b420a[_0xb912('0x3a')]),_0x22d131);if(_0x3c46c4[_0xb912('0x39')][_0xb912('0x43')]){_0x2529e9[_0xb912('0x44')]=_[_0xb912('0x45')](_0x2529e9['where'],{'$or':_[_0xb912('0x46')](_0x22d131,function(_0x1af664){if(_0x1af664[_0xb912('0x37')]!==_0xb912('0x47')){var _0x100ddf={};_0x100ddf[_0x1af664['name']]={'$like':'%'+_0x3c46c4[_0xb912('0x39')]['filter']+'%'};return _0x100ddf;}})});}_0x2529e9=_[_0xb912('0x45')]({},_0x2529e9,_0x3c46c4[_0xb912('0x48')]);var _0x4afb3b={'where':_0x2529e9[_0xb912('0x44')]};return db[_0xb912('0x35')]['count'](_0x4afb3b)[_0xb912('0x1e')](function(_0x26d898){_0x222313[_0xb912('0x2b')]=_0x26d898;if(_0x3c46c4['query'][_0xb912('0x49')]){_0x2529e9[_0xb912('0x4a')]=[{'all':!![]}];}return db[_0xb912('0x35')]['findAll'](_0x2529e9);})[_0xb912('0x1e')](function(_0x4d1ee1){_0x222313[_0xb912('0x4b')]=_0x4d1ee1;return _0x222313;})[_0xb912('0x1e')](respondWithFilteredResult(_0x17f82e,_0x2529e9))[_0xb912('0x26')](handleError(_0x17f82e,null));};exports[_0xb912('0x4c')]=function(_0x17eab3,_0x52ee28){var _0x3d3c57={'raw':!![],'where':{'id':_0x17eab3[_0xb912('0x4d')]['id']}},_0x18c5a7={};_0x18c5a7[_0xb912('0x38')]=_['keys'](db[_0xb912('0x35')][_0xb912('0x36')]);_0x18c5a7['query']=_[_0xb912('0x4e')](_0x17eab3['query']);_0x18c5a7['filters']=_['intersection'](_0x18c5a7[_0xb912('0x38')],_0x18c5a7[_0xb912('0x39')]);_0x3d3c57[_0xb912('0x3d')]=_[_0xb912('0x3b')](_0x18c5a7[_0xb912('0x38')],qs['fields'](_0x17eab3[_0xb912('0x39')][_0xb912('0x3c')]));_0x3d3c57[_0xb912('0x3d')]=_0x3d3c57[_0xb912('0x3d')][_0xb912('0x4f')]?_0x3d3c57[_0xb912('0x3d')]:_0x18c5a7[_0xb912('0x38')];if(_0x17eab3[_0xb912('0x39')]['includeAll']){_0x3d3c57[_0xb912('0x4a')]=[{'all':!![]}];}_0x3d3c57=_[_0xb912('0x45')]({},_0x3d3c57,_0x17eab3[_0xb912('0x48')]);return db[_0xb912('0x35')][_0xb912('0x50')](_0x3d3c57)[_0xb912('0x1e')](handleEntityNotFound(_0x52ee28,null))['then'](respondWithResult(_0x52ee28,null))[_0xb912('0x26')](handleError(_0x52ee28,null));};exports['create']=function(_0x5165ad,_0x1b69c6,_0x22ca91){var _0x14d552;return db[_0xb912('0x51')][_0xb912('0x52')](function(_0x26b3bc){return db['Network'][_0xb912('0x53')](_0x5165ad['body'],{'raw':!![]})[_0xb912('0x1e')](function(_0x2f77eb){_0x14d552=_0x2f77eb;return db[_0xb912('0x35')]['findAll']({'where':{'type':_0x5165ad[_0xb912('0x54')][_0xb912('0x37')]},'raw':!![]});})[_0xb912('0x1e')](function(_0x4a58bd){if(_0x14d552[_0xb912('0x37')][_0xb912('0x55')]()==_0xb912('0x56')){var _0x32133c=fs[_0xb912('0x57')](path[_0xb912('0x58')](config[_0xb912('0x59')],_0xb912('0x5a')),'utf8');var _0x40a297=ejs[_0xb912('0x5b')](_0x32133c,{'networks':_0x4a58bd||[]});fs[_0xb912('0x5c')](_0xb912('0x5d'),_0x40a297);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x53'),{'module':'res_stun_monitor.so'});}else if(_0x14d552[_0xb912('0x37')]['toUpperCase']()==_0xb912('0x5f')){var _0x18891b=fs[_0xb912('0x57')](path['join'](config[_0xb912('0x59')],_0xb912('0x60')),_0xb912('0x61'));var _0x19ff3b=ejs['render'](_0x18891b,{'networks':_0x4a58bd||[]});fs[_0xb912('0x5c')](_0xb912('0x62'),_0x19ff3b);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x53'),{'module':_0xb912('0x63')});}else{var _0x2f7181=fs['readFileSync'](path[_0xb912('0x58')](config['root'],_0xb912('0x64')),'utf8');var _0x4e8364=ejs['render'](_0x2f7181,{'networks':_0x4a58bd||[]});fs['writeFileSync'](util[_0xb912('0x65')](_0xb912('0x66'),_0x5165ad['body']['type'][_0xb912('0x67')]()),_0x4e8364);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x53'),{'module':_0xb912('0x68')});}return null;})[_0xb912('0x1e')](function(){return _0x14d552;});})['then'](respondWithResult(_0x1b69c6,0xc9))[_0xb912('0x26')](handleError(_0x1b69c6,null));};exports[_0xb912('0x30')]=function(_0x282d7b,_0x3cb044,_0xa0ce3c){var _0x90b897;return db[_0xb912('0x51')]['transaction'](function(_0x11f9fc){return db['Network'][_0xb912('0x50')]({'where':{'id':_0x282d7b[_0xb912('0x4d')]['id']}})[_0xb912('0x1e')](handleEntityNotFound(_0x3cb044,null))[_0xb912('0x1e')](saveUpdates(_0x282d7b[_0xb912('0x54')],null))[_0xb912('0x1e')](function(_0xd6ad8d){if(_0xd6ad8d){_0x90b897=_0xd6ad8d;return db[_0xb912('0x35')][_0xb912('0x69')]({'where':{'type':_0x90b897[_0xb912('0x37')]},'raw':!![]});}return null;})[_0xb912('0x1e')](function(_0x4afa67){if(_0x90b897[_0xb912('0x37')][_0xb912('0x55')]()==_0xb912('0x56')){var _0x51833f=fs[_0xb912('0x57')](path[_0xb912('0x58')](config[_0xb912('0x59')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1a7d96=ejs[_0xb912('0x5b')](_0x51833f,{'networks':_0x4afa67||[]});fs[_0xb912('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x1a7d96);return respondWithRpcPromise('Reload',_0xb912('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x90b897[_0xb912('0x37')]['toUpperCase']()==_0xb912('0x5f')){var _0x43d68e=fs[_0xb912('0x57')](path[_0xb912('0x58')](config[_0xb912('0x59')],_0xb912('0x60')),'utf8');var _0x4c431a=ejs[_0xb912('0x5b')](_0x43d68e,{'networks':_0x4afa67||[]});fs[_0xb912('0x5c')](_0xb912('0x62'),_0x4c431a);return respondWithRpcPromise(_0xb912('0x5e'),'update',{'module':_0xb912('0x63')});}else{var _0xba343f=fs['readFileSync'](path[_0xb912('0x58')](config[_0xb912('0x59')],_0xb912('0x64')),'utf8');var _0x59bd1b=ejs[_0xb912('0x5b')](_0xba343f,{'networks':_0x4afa67||[]});fs[_0xb912('0x5c')](util[_0xb912('0x65')](_0xb912('0x66'),_0x282d7b['body']['type'][_0xb912('0x67')]()),_0x59bd1b);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x8e8e23){if(_0x8e8e23){return _0x90b897;}return null;});})[_0xb912('0x1e')](respondWithResult(_0x3cb044,null))[_0xb912('0x26')](handleError(_0x3cb044,null));};exports[_0xb912('0x6a')]=function(_0x175249,_0x33f384,_0x223d60){var _0x478f6c;return db[_0xb912('0x35')][_0xb912('0x50')]({'where':{'id':_0x175249['params']['id']}})[_0xb912('0x1e')](function(_0x551434){_0x478f6c=_0x551434;return _0x551434;})[_0xb912('0x1e')](handleEntityNotFound(_0x33f384,null))[_0xb912('0x1e')](removeEntity(_0x33f384,null))['then'](function(){if(_0x478f6c){return db['Network'][_0xb912('0x69')]({'where':{'type':_0x478f6c['type']},'raw':!![]});}})['then'](function(_0x252cbc){if(_0x478f6c[_0xb912('0x37')]['toUpperCase']()==_0xb912('0x56')){var _0x5ed4b7=fs[_0xb912('0x57')](path['join'](config[_0xb912('0x59')],_0xb912('0x5a')),_0xb912('0x61'));var _0x1643bd=ejs[_0xb912('0x5b')](_0x5ed4b7,{'networks':_0x252cbc||[]});fs[_0xb912('0x5c')](_0xb912('0x5d'),_0x1643bd);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x6a'),{'module':_0xb912('0x63')});}else if(_0x478f6c[_0xb912('0x37')][_0xb912('0x55')]()=='TURN'){var _0x58de6d=fs[_0xb912('0x57')](path['join'](config[_0xb912('0x59')],_0xb912('0x60')),_0xb912('0x61'));var _0x2d602c=ejs[_0xb912('0x5b')](_0x58de6d,{'networks':_0x252cbc||[]});fs[_0xb912('0x5c')](_0xb912('0x62'),_0x2d602c);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x6a'),{'module':'res_stun_monitor.so'});}else{var _0x51a7ec=fs['readFileSync'](path[_0xb912('0x58')](config[_0xb912('0x59')],_0xb912('0x64')),_0xb912('0x61'));var _0x4b89ab=ejs['render'](_0x51a7ec,{'networks':_0x252cbc||[]});fs[_0xb912('0x5c')](util['format'](_0xb912('0x66'),_0x175249[_0xb912('0x54')][_0xb912('0x37')][_0xb912('0x67')]()),_0x4b89ab);return respondWithRpcPromise(_0xb912('0x5e'),_0xb912('0x6a'),{'module':'chan_sip.so'});}return null;})[_0xb912('0x26')](handleError(_0x33f384,null));}; \ No newline at end of file +var _0xb100=['fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','Network','includeAll','include','findAll','rows','show','params','rawAttributes','find','sequelize','transaction','create','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','toLowerCase','chan_sip.so','STUN','/etc/asterisk/stun_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x38a326,_0x48003c){var _0xe1b9e5=function(_0x47a069){while(--_0x47a069){_0x38a326['push'](_0x38a326['shift']());}};_0xe1b9e5(++_0x48003c);}(_0xb100,0x143));var _0x0b10=function(_0x25451a,_0x11c823){_0x25451a=_0x25451a-0x0;var _0x20a8aa=_0xb100[_0x25451a];return _0x20a8aa;};'use strict';var pdf=require(_0x0b10('0x0'));var emlformat=require(_0x0b10('0x1'));var rimraf=require(_0x0b10('0x2'));var zipdir=require(_0x0b10('0x3'));var jsonpatch=require(_0x0b10('0x4'));var rp=require(_0x0b10('0x5'));var moment=require(_0x0b10('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0b10('0x7'));var util=require('util');var path=require(_0x0b10('0x8'));var sox=require('sox');var csv=require(_0x0b10('0x9'));var ejs=require(_0x0b10('0xa'));var fs=require('fs');var _=require(_0x0b10('0xb'));var squel=require('squel');var crypto=require(_0x0b10('0xc'));var jsforce=require(_0x0b10('0xd'));var deskjs=require(_0x0b10('0xe'));var toCsv=require(_0x0b10('0x9'));var querystring=require(_0x0b10('0xf'));var Papa=require(_0x0b10('0x10'));var Redis=require(_0x0b10('0x11'));var authService=require(_0x0b10('0x12'));var qs=require(_0x0b10('0x13'));var as=require(_0x0b10('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b10('0x15'));var db=require(_0x0b10('0x16'))['db'];var jayson=require(_0x0b10('0x17'));var client=jayson[_0x0b10('0x18')][_0x0b10('0x19')]({'port':0x232a});function checkPasswordPattern(_0x169fdc,_0x568b8f,_0x4b3291){if(_0x4b3291){var _0x390482=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x390482['test'](_0x568b8f)){return _0x169fdc;}else{throw new db[(_0x0b10('0x1a'))][(_0x0b10('0x1b'))](_0x0b10('0x1c'));}}else{return _0x169fdc;}}function respondWithRpcPromise(_0x3381f6,_0x27b886,_0x30ede5,_0x2813d3){return new BPromise(function(_0x51a57d,_0x51c26f){var _0x40cdcb=_0x2813d3||client;return _0x40cdcb['request'](_0x3381f6,_0x30ede5)['then'](function(_0x19b6c3){logger[_0x0b10('0x1d')](_0x0b10('0x1e'),_0x27b886,_0x0b10('0x1f'));logger[_0x0b10('0x20')](_0x0b10('0x21'),_0x27b886,_0x0b10('0x1f'),JSON[_0x0b10('0x22')](_0x19b6c3));if(_0x19b6c3['error']){if(_0x19b6c3['error']['code']===0x1f4){logger['error'](_0x0b10('0x1e'),_0x27b886,_0x19b6c3[_0x0b10('0x23')][_0x0b10('0x24')]);return _0x51c26f(_0x19b6c3['error']['message']);}logger['error'](_0x0b10('0x1e'),_0x27b886,_0x19b6c3[_0x0b10('0x23')][_0x0b10('0x24')]);return _0x51a57d(_0x19b6c3['error']['message']);}else{logger[_0x0b10('0x1d')](_0x0b10('0x1e'),_0x27b886,_0x0b10('0x1f'));_0x51a57d(_0x19b6c3[_0x0b10('0x25')][_0x0b10('0x24')]);}})[_0x0b10('0x26')](function(_0x2ee4ff){logger[_0x0b10('0x23')](_0x0b10('0x1e'),_0x27b886,_0x2ee4ff);_0x51c26f(_0x2ee4ff);});});}function respondWithStatusCode(_0x44b980,_0x3ca6da){_0x3ca6da=_0x3ca6da||0xcc;return function(_0xe12289){if(_0xe12289){return _0x44b980[_0x0b10('0x27')](_0x3ca6da);}return _0x44b980[_0x0b10('0x28')](_0x3ca6da)[_0x0b10('0x29')]();};}function respondWithResult(_0x517f19,_0x55a40e){_0x55a40e=_0x55a40e||0xc8;return function(_0x563b72){if(_0x563b72){return _0x517f19[_0x0b10('0x28')](_0x55a40e)[_0x0b10('0x2a')](_0x563b72);}};}function respondWithFilteredResult(_0x3646ba,_0x3e04e6){return function(_0x4b4897){if(_0x4b4897){var _0x483084=_0x4b4897[_0x0b10('0x2b')],_0x281179=_0x3e04e6[_0x0b10('0x2c')],_0x3df18d=_0x3e04e6[_0x0b10('0x2c')]+_0x3e04e6[_0x0b10('0x2d')],_0x5efbe9;if(_0x3df18d>=_0x483084){_0x3df18d=_0x483084;_0x5efbe9=0xc8;}else{_0x5efbe9=0xce;}_0x3646ba[_0x0b10('0x28')](_0x5efbe9);return _0x3646ba[_0x0b10('0x2e')](_0x0b10('0x2f'),_0x281179+'-'+_0x3df18d+'/'+_0x483084)[_0x0b10('0x2a')](_0x4b4897);}return null;};}function patchUpdates(_0x1b54cd){return function(_0x4b1685){try{jsonpatch[_0x0b10('0x30')](_0x4b1685,_0x1b54cd,!![]);}catch(_0x535e73){return BPromise['reject'](_0x535e73);}return _0x4b1685['save']();};}function saveUpdates(_0x4b2efb,_0x1042fa){return function(_0x1fde63){if(_0x1fde63){return _0x1fde63[_0x0b10('0x31')](_0x4b2efb)[_0x0b10('0x32')](function(_0xf29d2c){return _0xf29d2c;});}return null;};}function removeEntity(_0x49ec24,_0x4ac7b2){return function(_0x33ece6){if(_0x33ece6){return _0x33ece6[_0x0b10('0x33')]()['then'](function(){_0x49ec24['status'](0xcc)[_0x0b10('0x29')]();});}};}function handleEntityNotFound(_0x1dfa49,_0x3e3f2a){return function(_0x2e7d8e){if(!_0x2e7d8e){_0x1dfa49[_0x0b10('0x27')](0x194);}return _0x2e7d8e;};}function handleError(_0x403f7f,_0x5f1dac){_0x5f1dac=_0x5f1dac||0x1f4;return function(_0xbe8b5d){logger[_0x0b10('0x23')](_0xbe8b5d[_0x0b10('0x34')]);if(_0xbe8b5d[_0x0b10('0x35')]){delete _0xbe8b5d['name'];}_0x403f7f['status'](_0x5f1dac)[_0x0b10('0x36')](_0xbe8b5d);};}exports[_0x0b10('0x37')]=function(_0x5ca996,_0x3c2df5){var _0xf7c769={},_0x21ddc8={},_0xfec06={'count':0x0,'rows':[]};var _0x1d844f=_[_0x0b10('0x38')](db['Network']['rawAttributes'],function(_0x597bca){return{'name':_0x597bca[_0x0b10('0x39')],'type':_0x597bca[_0x0b10('0x3a')]['key']};});_0x21ddc8[_0x0b10('0x3b')]=_[_0x0b10('0x38')](_0x1d844f,'name');_0x21ddc8[_0x0b10('0x3c')]=_[_0x0b10('0x3d')](_0x5ca996[_0x0b10('0x3c')]);_0x21ddc8['filters']=_[_0x0b10('0x3e')](_0x21ddc8[_0x0b10('0x3b')],_0x21ddc8['query']);_0xf7c769[_0x0b10('0x3f')]=_[_0x0b10('0x3e')](_0x21ddc8[_0x0b10('0x3b')],qs[_0x0b10('0x40')](_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x40')]));_0xf7c769[_0x0b10('0x3f')]=_0xf7c769[_0x0b10('0x3f')][_0x0b10('0x41')]?_0xf7c769['attributes']:_0x21ddc8[_0x0b10('0x3b')];if(!_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x42')](_0x0b10('0x43'))){_0xf7c769[_0x0b10('0x2d')]=qs[_0x0b10('0x2d')](_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x2d')]);_0xf7c769['offset']=qs[_0x0b10('0x2c')](_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x2c')]);}_0xf7c769['order']=qs[_0x0b10('0x44')](_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x44')]);_0xf7c769[_0x0b10('0x45')]=qs[_0x0b10('0x46')](_[_0x0b10('0x47')](_0x5ca996[_0x0b10('0x3c')],_0x21ddc8[_0x0b10('0x46')]),_0x1d844f);if(_0x5ca996[_0x0b10('0x3c')]['filter']){_0xf7c769[_0x0b10('0x45')]=_[_0x0b10('0x48')](_0xf7c769[_0x0b10('0x45')],{'$or':_[_0x0b10('0x38')](_0x1d844f,function(_0x49f1c0){if(_0x49f1c0[_0x0b10('0x3a')]!==_0x0b10('0x49')){var _0x3a089f={};_0x3a089f[_0x49f1c0['name']]={'$like':'%'+_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x4a')]+'%'};return _0x3a089f;}})});}_0xf7c769=_['merge']({},_0xf7c769,_0x5ca996[_0x0b10('0x4b')]);var _0xf0bc3c={'where':_0xf7c769[_0x0b10('0x45')]};return db[_0x0b10('0x4c')][_0x0b10('0x2b')](_0xf0bc3c)[_0x0b10('0x32')](function(_0x4b9dc3){_0xfec06[_0x0b10('0x2b')]=_0x4b9dc3;if(_0x5ca996[_0x0b10('0x3c')][_0x0b10('0x4d')]){_0xf7c769[_0x0b10('0x4e')]=[{'all':!![]}];}return db[_0x0b10('0x4c')][_0x0b10('0x4f')](_0xf7c769);})[_0x0b10('0x32')](function(_0x1996fc){_0xfec06[_0x0b10('0x50')]=_0x1996fc;return _0xfec06;})[_0x0b10('0x32')](respondWithFilteredResult(_0x3c2df5,_0xf7c769))[_0x0b10('0x26')](handleError(_0x3c2df5,null));};exports[_0x0b10('0x51')]=function(_0x499f82,_0x352d1a){var _0x13a87f={'raw':!![],'where':{'id':_0x499f82[_0x0b10('0x52')]['id']}},_0x594e79={};_0x594e79[_0x0b10('0x3b')]=_[_0x0b10('0x3d')](db[_0x0b10('0x4c')][_0x0b10('0x53')]);_0x594e79[_0x0b10('0x3c')]=_[_0x0b10('0x3d')](_0x499f82[_0x0b10('0x3c')]);_0x594e79[_0x0b10('0x46')]=_[_0x0b10('0x3e')](_0x594e79['model'],_0x594e79[_0x0b10('0x3c')]);_0x13a87f[_0x0b10('0x3f')]=_[_0x0b10('0x3e')](_0x594e79['model'],qs[_0x0b10('0x40')](_0x499f82[_0x0b10('0x3c')]['fields']));_0x13a87f[_0x0b10('0x3f')]=_0x13a87f['attributes'][_0x0b10('0x41')]?_0x13a87f[_0x0b10('0x3f')]:_0x594e79[_0x0b10('0x3b')];if(_0x499f82[_0x0b10('0x3c')][_0x0b10('0x4d')]){_0x13a87f[_0x0b10('0x4e')]=[{'all':!![]}];}_0x13a87f=_[_0x0b10('0x48')]({},_0x13a87f,_0x499f82[_0x0b10('0x4b')]);return db[_0x0b10('0x4c')][_0x0b10('0x54')](_0x13a87f)['then'](handleEntityNotFound(_0x352d1a,null))[_0x0b10('0x32')](respondWithResult(_0x352d1a,null))[_0x0b10('0x26')](handleError(_0x352d1a,null));};exports['create']=function(_0x3c8531,_0x34f26b,_0x3a9e5b){var _0x590c8d;return db[_0x0b10('0x55')][_0x0b10('0x56')](function(_0x416895){return db[_0x0b10('0x4c')][_0x0b10('0x57')](_0x3c8531[_0x0b10('0x58')],{'raw':!![]})['then'](function(_0x56bda1){_0x590c8d=_0x56bda1;return db[_0x0b10('0x4c')][_0x0b10('0x4f')]({'where':{'type':_0x3c8531['body']['type']},'raw':!![]});})['then'](function(_0x25b12c){if(_0x590c8d[_0x0b10('0x3a')]['toUpperCase']()=='STUN'){var _0x25bcf7=fs[_0x0b10('0x59')](path[_0x0b10('0x5a')](config[_0x0b10('0x5b')],_0x0b10('0x5c')),_0x0b10('0x5d'));var _0x1548cf=ejs['render'](_0x25bcf7,{'networks':_0x25b12c||[]});fs[_0x0b10('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x1548cf);return respondWithRpcPromise(_0x0b10('0x5f'),'create',{'module':_0x0b10('0x60')});}else if(_0x590c8d[_0x0b10('0x3a')][_0x0b10('0x61')]()==_0x0b10('0x62')){var _0x5ef44b=fs['readFileSync'](path[_0x0b10('0x5a')](config[_0x0b10('0x5b')],_0x0b10('0x63')),'utf8');var _0x1df44e=ejs['render'](_0x5ef44b,{'networks':_0x25b12c||[]});fs[_0x0b10('0x5e')](_0x0b10('0x64'),_0x1df44e);return respondWithRpcPromise('Reload',_0x0b10('0x57'),{'module':'res_stun_monitor.so'});}else{var _0x3b2388=fs[_0x0b10('0x59')](path['join'](config[_0x0b10('0x5b')],_0x0b10('0x65')),_0x0b10('0x5d'));var _0x5e4a5f=ejs[_0x0b10('0x66')](_0x3b2388,{'networks':_0x25b12c||[]});fs['writeFileSync'](util[_0x0b10('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x3c8531[_0x0b10('0x58')][_0x0b10('0x3a')][_0x0b10('0x68')]()),_0x5e4a5f);return respondWithRpcPromise(_0x0b10('0x5f'),_0x0b10('0x57'),{'module':_0x0b10('0x69')});}return null;})[_0x0b10('0x32')](function(){return _0x590c8d;});})[_0x0b10('0x32')](respondWithResult(_0x34f26b,0xc9))['catch'](handleError(_0x34f26b,null));};exports['update']=function(_0x3225cb,_0x4ba5e7,_0x1038ab){var _0x39d1b4;return db[_0x0b10('0x55')]['transaction'](function(_0x1b3fb2){return db['Network'][_0x0b10('0x54')]({'where':{'id':_0x3225cb[_0x0b10('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ba5e7,null))[_0x0b10('0x32')](saveUpdates(_0x3225cb['body'],null))[_0x0b10('0x32')](function(_0x473ecc){if(_0x473ecc){_0x39d1b4=_0x473ecc;return db[_0x0b10('0x4c')][_0x0b10('0x4f')]({'where':{'type':_0x39d1b4[_0x0b10('0x3a')]},'raw':!![]});}return null;})[_0x0b10('0x32')](function(_0x42ce4c){if(_0x39d1b4[_0x0b10('0x3a')][_0x0b10('0x61')]()==_0x0b10('0x6a')){var _0x3a1e25=fs[_0x0b10('0x59')](path[_0x0b10('0x5a')](config[_0x0b10('0x5b')],_0x0b10('0x5c')),'utf8');var _0x29fc06=ejs['render'](_0x3a1e25,{'networks':_0x42ce4c||[]});fs[_0x0b10('0x5e')](_0x0b10('0x6b'),_0x29fc06);return respondWithRpcPromise(_0x0b10('0x5f'),_0x0b10('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x39d1b4[_0x0b10('0x3a')][_0x0b10('0x61')]()=='TURN'){var _0xbdc55a=fs[_0x0b10('0x59')](path['join'](config[_0x0b10('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x0b10('0x5d'));var _0x56be08=ejs[_0x0b10('0x66')](_0xbdc55a,{'networks':_0x42ce4c||[]});fs[_0x0b10('0x5e')](_0x0b10('0x64'),_0x56be08);return respondWithRpcPromise('Reload',_0x0b10('0x31'),{'module':_0x0b10('0x60')});}else{var _0x17129a=fs['readFileSync'](path[_0x0b10('0x5a')](config['root'],_0x0b10('0x65')),_0x0b10('0x5d'));var _0x15b6b4=ejs['render'](_0x17129a,{'networks':_0x42ce4c||[]});fs[_0x0b10('0x5e')](util[_0x0b10('0x67')](_0x0b10('0x6c'),_0x3225cb[_0x0b10('0x58')]['type'][_0x0b10('0x68')]()),_0x15b6b4);return respondWithRpcPromise(_0x0b10('0x5f'),_0x0b10('0x31'),{'module':_0x0b10('0x69')});}return null;})[_0x0b10('0x32')](function(_0xcd6840){if(_0xcd6840){return _0x39d1b4;}return null;});})[_0x0b10('0x32')](respondWithResult(_0x4ba5e7,null))[_0x0b10('0x26')](handleError(_0x4ba5e7,null));};exports[_0x0b10('0x33')]=function(_0x52563b,_0x2627c0,_0x1b97ad){var _0x43cfcf;return db[_0x0b10('0x4c')][_0x0b10('0x54')]({'where':{'id':_0x52563b[_0x0b10('0x52')]['id']}})[_0x0b10('0x32')](function(_0x57f02e){_0x43cfcf=_0x57f02e;return _0x57f02e;})[_0x0b10('0x32')](handleEntityNotFound(_0x2627c0,null))[_0x0b10('0x32')](removeEntity(_0x2627c0,null))['then'](function(){if(_0x43cfcf){return db[_0x0b10('0x4c')][_0x0b10('0x4f')]({'where':{'type':_0x43cfcf[_0x0b10('0x3a')]},'raw':!![]});}})[_0x0b10('0x32')](function(_0x2c14f8){if(_0x43cfcf[_0x0b10('0x3a')][_0x0b10('0x61')]()==_0x0b10('0x6a')){var _0x1280dc=fs[_0x0b10('0x59')](path[_0x0b10('0x5a')](config[_0x0b10('0x5b')],_0x0b10('0x5c')),_0x0b10('0x5d'));var _0x45e72d=ejs['render'](_0x1280dc,{'networks':_0x2c14f8||[]});fs['writeFileSync'](_0x0b10('0x6b'),_0x45e72d);return respondWithRpcPromise('Reload','destroy',{'module':_0x0b10('0x60')});}else if(_0x43cfcf['type'][_0x0b10('0x61')]()==_0x0b10('0x62')){var _0x193fc7=fs[_0x0b10('0x59')](path[_0x0b10('0x5a')](config[_0x0b10('0x5b')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3a984b=ejs[_0x0b10('0x66')](_0x193fc7,{'networks':_0x2c14f8||[]});fs[_0x0b10('0x5e')](_0x0b10('0x64'),_0x3a984b);return respondWithRpcPromise(_0x0b10('0x5f'),_0x0b10('0x33'),{'module':_0x0b10('0x60')});}else{var _0x33bde3=fs[_0x0b10('0x59')](path['join'](config[_0x0b10('0x5b')],_0x0b10('0x65')),_0x0b10('0x5d'));var _0xf6b2cb=ejs[_0x0b10('0x66')](_0x33bde3,{'networks':_0x2c14f8||[]});fs[_0x0b10('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x52563b[_0x0b10('0x58')][_0x0b10('0x3a')][_0x0b10('0x68')]()),_0xf6b2cb);return respondWithRpcPromise(_0x0b10('0x5f'),_0x0b10('0x33'),{'module':'chan_sip.so'});}return null;})[_0x0b10('0x26')](handleError(_0x2627c0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 2ed8e98..5f10e90 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 _0xb0cc=['api','bluebird','request-promise','../../config/environment','./network.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x171b20,_0x5977fb){var _0x3704e5=function(_0x244303){while(--_0x244303){_0x171b20['push'](_0x171b20['shift']());}};_0x3704e5(++_0x5977fb);}(_0xb0cc,0x147));var _0xcb0c=function(_0x4eb566,_0x54b7db){_0x4eb566=_0x4eb566-0x0;var _0x8f69a6=_0xb0cc[_0x4eb566];return _0x8f69a6;};'use strict';var _=require(_0xcb0c('0x0'));var util=require(_0xcb0c('0x1'));var logger=require(_0xcb0c('0x2'))(_0xcb0c('0x3'));var moment=require('moment');var BPromise=require(_0xcb0c('0x4'));var rp=require(_0xcb0c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcb0c('0x6'));var attributes=require(_0xcb0c('0x7'));module[_0xcb0c('0x8')]=function(_0x572ad6,_0x432393){return _0x572ad6[_0xcb0c('0x9')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x407a=['path','../../config/environment','exports','define','Network','lodash','util','api','moment','request-promise'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x407a,0x18b));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa407('0x0'));var util=require(_0xa407('0x1'));var logger=require('../../config/logger')(_0xa407('0x2'));var moment=require(_0xa407('0x3'));var BPromise=require('bluebird');var rp=require(_0xa407('0x4'));var fs=require('fs');var path=require(_0xa407('0x5'));var rimraf=require('rimraf');var config=require(_0xa407('0x6'));var attributes=require('./network.attributes');module[_0xa407('0x7')]=function(_0x4c473b,_0xbcee6b){return _0x4c473b[_0xa407('0x8')](_0xa407('0x9'),attributes,{'tableName':'network','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 a36068b..147ac07 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 _0xe202=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','debug'];(function(_0x2f3e50,_0x347d1f){var _0x161089=function(_0x4fa237){while(--_0x4fa237){_0x2f3e50['push'](_0x2f3e50['shift']());}};_0x161089(++_0x347d1f);}(_0xe202,0x86));var _0x2e20=function(_0x11c918,_0x456313){_0x11c918=_0x11c918-0x0;var _0x4ee3d8=_0xe202[_0x11c918];return _0x4ee3d8;};'use strict';var _=require(_0x2e20('0x0'));var util=require(_0x2e20('0x1'));var moment=require(_0x2e20('0x2'));var BPromise=require(_0x2e20('0x3'));var rs=require(_0x2e20('0x4'));var fs=require('fs');var Redis=require(_0x2e20('0x5'));var db=require(_0x2e20('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e20('0x7'))(_0x2e20('0x8'));var config=require(_0x2e20('0x9'));var jayson=require(_0x2e20('0xa'));var client=jayson[_0x2e20('0xb')][_0x2e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31c35b,_0x4bf35a,_0x14fb69){return new BPromise(function(_0x3982e0,_0xc4353f){return client['request'](_0x31c35b,_0x14fb69)[_0x2e20('0xd')](function(_0x355b73){logger['info'](_0x2e20('0xe'),_0x4bf35a,'request\x20sent');logger[_0x2e20('0xf')](_0x2e20('0x10'),_0x4bf35a,'request\x20sent',JSON[_0x2e20('0x11')](_0x355b73));if(_0x355b73['error']){if(_0x355b73[_0x2e20('0x12')][_0x2e20('0x13')]===0x1f4){logger[_0x2e20('0x12')](_0x2e20('0xe'),_0x4bf35a,_0x355b73['error'][_0x2e20('0x14')]);return _0xc4353f(_0x355b73[_0x2e20('0x12')][_0x2e20('0x14')]);}logger[_0x2e20('0x12')]('Network,\x20%s,\x20%s',_0x4bf35a,_0x355b73['error']['message']);return _0x3982e0(_0x355b73['error'][_0x2e20('0x14')]);}else{logger[_0x2e20('0x15')](_0x2e20('0xe'),_0x4bf35a,_0x2e20('0x16'));_0x3982e0(_0x355b73[_0x2e20('0x17')][_0x2e20('0x14')]);}})[_0x2e20('0x18')](function(_0x5bc932){logger[_0x2e20('0x12')](_0x2e20('0xe'),_0x4bf35a,_0x5bc932);_0xc4353f(_0x5bc932);});});} \ No newline at end of file +var _0x35fe=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x99927f,_0x217b37){var _0x5af208=function(_0xe87e19){while(--_0xe87e19){_0x99927f['push'](_0x99927f['shift']());}};_0x5af208(++_0x217b37);}(_0x35fe,0x1cc));var _0xe35f=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x35fe[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xe35f('0x0'));var util=require('util');var moment=require(_0xe35f('0x1'));var BPromise=require(_0xe35f('0x2'));var rs=require(_0xe35f('0x3'));var fs=require('fs');var Redis=require(_0xe35f('0x4'));var db=require(_0xe35f('0x5'))['db'];var utils=require(_0xe35f('0x6'));var logger=require(_0xe35f('0x7'))(_0xe35f('0x8'));var config=require('../../config/environment');var jayson=require(_0xe35f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bcd88,_0x311d0f,_0x1a8752){return new BPromise(function(_0x5edfb0,_0x5ccc61){return client[_0xe35f('0xa')](_0x4bcd88,_0x1a8752)[_0xe35f('0xb')](function(_0x5c51dc){logger[_0xe35f('0xc')](_0xe35f('0xd'),_0x311d0f,_0xe35f('0xe'));logger['debug'](_0xe35f('0xf'),_0x311d0f,_0xe35f('0xe'),JSON[_0xe35f('0x10')](_0x5c51dc));if(_0x5c51dc[_0xe35f('0x11')]){if(_0x5c51dc[_0xe35f('0x11')][_0xe35f('0x12')]===0x1f4){logger['error'](_0xe35f('0xd'),_0x311d0f,_0x5c51dc[_0xe35f('0x11')][_0xe35f('0x13')]);return _0x5ccc61(_0x5c51dc['error'][_0xe35f('0x13')]);}logger['error'](_0xe35f('0xd'),_0x311d0f,_0x5c51dc[_0xe35f('0x11')][_0xe35f('0x13')]);return _0x5edfb0(_0x5c51dc[_0xe35f('0x11')][_0xe35f('0x13')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x311d0f,'request\x20sent');_0x5edfb0(_0x5c51dc['result'][_0xe35f('0x13')]);}})[_0xe35f('0x14')](function(_0x18112e){logger[_0xe35f('0x11')]('Network,\x20%s,\x20%s',_0x311d0f,_0x18112e);_0x5ccc61(_0x18112e);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index b97f32b..143b4ca 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x440c=['Router','../../components/auth/service','../../components/interaction/service','post','sendNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x49472f,_0x4b82f1){var _0x2d5b76=function(_0x134113){while(--_0x134113){_0x49472f['push'](_0x49472f['shift']());}};_0x2d5b76(++_0x4b82f1);}(_0x440c,0x12f));var _0xc440=function(_0x32265d,_0xb67168){_0x32265d=_0x32265d-0x0;var _0x22cae9=_0x440c[_0x32265d];return _0x22cae9;};'use strict';var multer=require(_0xc440('0x0'));var util=require(_0xc440('0x1'));var path=require(_0xc440('0x2'));var timeout=require(_0xc440('0x3'));var express=require(_0xc440('0x4'));var router=express[_0xc440('0x5')]();var auth=require(_0xc440('0x6'));var interaction=require(_0xc440('0x7'));var config=require('../../config/environment');var controller=require('./notification.controller');router[_0xc440('0x8')]('/',auth['isAuthenticated'](),controller[_0xc440('0x9')]);module[_0xc440('0xa')]=router; \ No newline at end of file +var _0x650b=['sendNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./notification.controller','post','isAuthenticated'];(function(_0x5a6612,_0x153860){var _0x47a401=function(_0x5688dc){while(--_0x5688dc){_0x5a6612['push'](_0x5a6612['shift']());}};_0x47a401(++_0x153860);}(_0x650b,0x12d));var _0xb650=function(_0x1acfb9,_0x52bc80){_0x1acfb9=_0x1acfb9-0x0;var _0x1416e3=_0x650b[_0x1acfb9];return _0x1416e3;};'use strict';var multer=require(_0xb650('0x0'));var util=require(_0xb650('0x1'));var path=require(_0xb650('0x2'));var timeout=require(_0xb650('0x3'));var express=require(_0xb650('0x4'));var router=express[_0xb650('0x5')]();var auth=require(_0xb650('0x6'));var interaction=require(_0xb650('0x7'));var config=require('../../config/environment');var controller=require(_0xb650('0x8'));router[_0xb650('0x9')]('/',auth[_0xb650('0xa')](),controller[_0xb650('0xb')]);module[_0xb650('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 08161b4..ac688ce 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d98=['sequelize','exports','TEXT','BOOLEAN'];(function(_0x5bcd65,_0x7a4258){var _0x427fc5=function(_0x4b779a){while(--_0x4b779a){_0x5bcd65['push'](_0x5bcd65['shift']());}};_0x427fc5(++_0x7a4258);}(_0x0d98,0x78));var _0x80d9=function(_0x38fb68,_0x5a862b){_0x38fb68=_0x38fb68-0x0;var _0x393e38=_0x0d98[_0x38fb68];return _0x393e38;};'use strict';var Sequelize=require(_0x80d9('0x0'));module[_0x80d9('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x80d9('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x80d9('0x3')]}}; \ No newline at end of file +var _0x8e0e=['TEXT','STRING','exports'];(function(_0x4d3f94,_0x2c8908){var _0x245267=function(_0x2f60b4){while(--_0x2f60b4){_0x4d3f94['push'](_0x4d3f94['shift']());}};_0x245267(++_0x2c8908);}(_0x8e0e,0xf5));var _0xe8e0=function(_0x84a81f,_0x26f46f){_0x84a81f=_0x84a81f-0x0;var _0x72b5cc=_0x8e0e[_0x84a81f];return _0x72b5cc;};'use strict';var Sequelize=require('sequelize');module[_0xe8e0('0x0')]={'body':{'type':Sequelize[_0xe8e0('0x1')]},'senderName':{'type':Sequelize[_0xe8e0('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xe8e0('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 563104f..fd9ff59 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b5e=['register','sendStatus','status','end','json','count','offset','set','apply','reject','update','destroy','then','stack','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','create','forEach','recipient','emit','notification:send','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','model','User','queue','replace','ids','push','findOne','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x4b5e,0x10a));var _0xe4b5=function(_0xdb3af9,_0x84dc9){_0xdb3af9=_0xdb3af9-0x0;var _0x47a4d8=_0x4b5e[_0xdb3af9];return _0x47a4d8;};'use strict';var pdf=require(_0xe4b5('0x0'));var emlformat=require(_0xe4b5('0x1'));var rimraf=require(_0xe4b5('0x2'));var zipdir=require(_0xe4b5('0x3'));var jsonpatch=require(_0xe4b5('0x4'));var rp=require(_0xe4b5('0x5'));var moment=require(_0xe4b5('0x6'));var BPromise=require(_0xe4b5('0x7'));var Mustache=require(_0xe4b5('0x8'));var util=require(_0xe4b5('0x9'));var path=require(_0xe4b5('0xa'));var sox=require(_0xe4b5('0xb'));var csv=require('to-csv');var ejs=require(_0xe4b5('0xc'));var fs=require('fs');var _=require(_0xe4b5('0xd'));var squel=require(_0xe4b5('0xe'));var crypto=require(_0xe4b5('0xf'));var jsforce=require(_0xe4b5('0x10'));var deskjs=require(_0xe4b5('0x11'));var toCsv=require(_0xe4b5('0x12'));var querystring=require(_0xe4b5('0x13'));var Papa=require(_0xe4b5('0x14'));var Redis=require(_0xe4b5('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xe4b5('0x16'));var as=require(_0xe4b5('0x17'));var hardwareService=require(_0xe4b5('0x18'));var logger=require(_0xe4b5('0x19'))(_0xe4b5('0x1a'));var utils=require('../../config/utils');var config=require(_0xe4b5('0x1b'));var db=require(_0xe4b5('0x1c'))['db'];config[_0xe4b5('0x1d')]=_[_0xe4b5('0x1e')](config[_0xe4b5('0x1d')],{'host':_0xe4b5('0x1f'),'port':0x18eb});var socket=require(_0xe4b5('0x20'))(new Redis(config[_0xe4b5('0x1d')]));require(_0xe4b5('0x21'))[_0xe4b5('0x22')](socket);function respondWithStatusCode(_0x660332,_0x3cf391){_0x3cf391=_0x3cf391||0xcc;return function(_0x5f09b6){if(_0x5f09b6){return _0x660332[_0xe4b5('0x23')](_0x3cf391);}return _0x660332[_0xe4b5('0x24')](_0x3cf391)[_0xe4b5('0x25')]();};}function respondWithResult(_0x35774b,_0x473bd4){_0x473bd4=_0x473bd4||0xc8;return function(_0x5950f2){if(_0x5950f2){return _0x35774b[_0xe4b5('0x24')](_0x473bd4)[_0xe4b5('0x26')](_0x5950f2);}};}function respondWithFilteredResult(_0x4a166a,_0x45845b){return function(_0x2e6637){if(_0x2e6637){var _0x281cf5=_0x2e6637[_0xe4b5('0x27')],_0x376c97=_0x45845b[_0xe4b5('0x28')],_0x2136fa=_0x45845b[_0xe4b5('0x28')]+_0x45845b['limit'],_0x58f57c;if(_0x2136fa>=_0x281cf5){_0x2136fa=_0x281cf5;_0x58f57c=0xc8;}else{_0x58f57c=0xce;}_0x4a166a[_0xe4b5('0x24')](_0x58f57c);return _0x4a166a[_0xe4b5('0x29')]('Content-Range',_0x376c97+'-'+_0x2136fa+'/'+_0x281cf5)[_0xe4b5('0x26')](_0x2e6637);}return null;};}function patchUpdates(_0x44e536){return function(_0x4872ac){try{jsonpatch[_0xe4b5('0x2a')](_0x4872ac,_0x44e536,!![]);}catch(_0x2ca428){return BPromise[_0xe4b5('0x2b')](_0x2ca428);}return _0x4872ac['save']();};}function saveUpdates(_0x1243f9,_0x6c411c){return function(_0xaa4c20){if(_0xaa4c20){return _0xaa4c20[_0xe4b5('0x2c')](_0x1243f9)['then'](function(_0x338c71){return _0x338c71;});}return null;};}function removeEntity(_0xaaf7f2,_0x5a8c77){return function(_0x1bd77a){if(_0x1bd77a){return _0x1bd77a[_0xe4b5('0x2d')]()[_0xe4b5('0x2e')](function(){_0xaaf7f2[_0xe4b5('0x24')](0xcc)[_0xe4b5('0x25')]();});}};}function handleEntityNotFound(_0x56aa57,_0x34316a){return function(_0x4977f5){if(!_0x4977f5){_0x56aa57[_0xe4b5('0x23')](0x194);}return _0x4977f5;};}function handleError(_0xbabcc0,_0x4a1da0){_0x4a1da0=_0x4a1da0||0x1f4;return function(_0x1f0a0d){logger['error'](_0x1f0a0d[_0xe4b5('0x2f')]);if(_0x1f0a0d['name']){delete _0x1f0a0d[_0xe4b5('0x30')];}_0xbabcc0[_0xe4b5('0x24')](_0x4a1da0)[_0xe4b5('0x31')](_0x1f0a0d);};}exports['sendNotification']=function(_0x17009c,_0x34462a,_0x268338){if(!_0x17009c['body'][_0xe4b5('0x32')](_0xe4b5('0x33'))&&!_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x32')](_0xe4b5('0x35'))){throw new db[(_0xe4b5('0x36'))][(_0xe4b5('0x37'))](_0xe4b5('0x38'));}else{if(_0x17009c['body'][_0xe4b5('0x32')]('TemplateId')&&!_0x17009c['body'][_0xe4b5('0x32')](_0xe4b5('0x39'))){throw new db[(_0xe4b5('0x36'))][(_0xe4b5('0x37'))](_0xe4b5('0x3a'));}if(!_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x32')](_0xe4b5('0x3b'))){throw new db[(_0xe4b5('0x36'))][(_0xe4b5('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x15dc8a=JSON[_0xe4b5('0x3c')](_0x17009c[_0xe4b5('0x34')]['recipients']);}catch(_0xbd0cd4){logger[_0xe4b5('0x3d')](_0xbd0cd4);throw new db[(_0xe4b5('0x36'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x18ec0c=[_0xe4b5('0x3e'),_0xe4b5('0x3f'),_0xe4b5('0x40'),'openchannelqueue',_0xe4b5('0x41'),_0xe4b5('0x42'),_0xe4b5('0x43'),_0xe4b5('0x44'),_0xe4b5('0x45')];if(_[_0xe4b5('0x46')](_0x15dc8a,function(_0x284b74){return!_[_0xe4b5('0x47')](_0x18ec0c,_0x284b74['model'][_0xe4b5('0x48')]());})){throw new db[(_0xe4b5('0x36'))]['ValidationError'](_0xe4b5('0x49'));}}}var _0x25c772={};_0x25c772['senderName']=_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x32')](_0xe4b5('0x4a'))?_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x4a')]:_0x17009c['user'][_0xe4b5('0x4b')];_0x25c772[_0xe4b5('0x4c')]=_['isEmpty'](_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x4c')])?null:_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x4c')];_0x25c772[_0xe4b5('0x4d')]=_0x17009c[_0xe4b5('0x34')][_0xe4b5('0x4d')]||![];_0x25c772[_0xe4b5('0x4e')]=_0x17009c[_0xe4b5('0x45')]['id'];return getContent(_0x17009c[_0xe4b5('0x34')])[_0xe4b5('0x2e')](function(_0x1c450d){_0x25c772[_0xe4b5('0x34')]=_0x1c450d;return getRecipients(_0x15dc8a);})[_0xe4b5('0x2e')](function(_0x4e700e){_0x25c772[_0xe4b5('0x4f')]=_[_0xe4b5('0x50')](_0x4e700e)[_0xe4b5('0x51')](',');return db['sequelize']['transaction'](function(_0x2bf9d4){return db['Notification'][_0xe4b5('0x52')](_0x25c772,{'raw':!![],'transaction':_0x2bf9d4})[_0xe4b5('0x2e')](function(_0x855d4d){var _0xa23648={'sender':_0x25c772[_0xe4b5('0x4a')],'description':_0x25c772[_0xe4b5('0x4c')],'content':_0x25c772[_0xe4b5('0x34')],'beep':_0x25c772['beep']};_0x4e700e[_0xe4b5('0x53')](function(_0x952b15){_0xa23648[_0xe4b5('0x54')]=_0x952b15;socket[_0xe4b5('0x55')](_0xe4b5('0x56'),_0xa23648);});return _0x855d4d;});});})[_0xe4b5('0x2e')](respondWithResult(_0x34462a,0xc9))['catch'](handleError(_0x34462a,null));};function getContent(_0xdf6ea6){return new BPromise(function(_0x2082c7,_0x276ab7){if(_0xdf6ea6[_0xe4b5('0x33')]){_0x2082c7(_0xdf6ea6[_0xe4b5('0x33')]);return;}return db['Template']['findOne']({'attributes':[_0xe4b5('0x57')],'where':{'id':_0xdf6ea6['TemplateId']},'raw':!![]})['then'](function(_0x2a362e){if(!_0x2a362e)throw new db[(_0xe4b5('0x36'))][(_0xe4b5('0x37'))](_0xe4b5('0x58'));var _0xab9e3d=Mustache['render'](_0x2a362e[_0xe4b5('0x57')],_0xdf6ea6[_0xe4b5('0x39')]);_0x2082c7(_0xab9e3d);})[_0xe4b5('0x59')](function(_0x18ad39){_0x276ab7(_0x18ad39);});});}function getRecipients(_0x3c4d71){return new BPromise(function(_0x219259,_0xfeffbf){var _0x49fecc=[];var _0x19ab75=[];_0x3c4d71[_0xe4b5('0x53')](function(_0x4b0896){var _0x4cc699=_[_0xe4b5('0x5a')](_0x4b0896[_0xe4b5('0x5b')]['toLowerCase']());if(_0x4cc699===_0xe4b5('0x5c')){_0x49fecc=_['union'](_0x49fecc,_0x4b0896['ids']);}else{if(_[_0xe4b5('0x47')](_0x4cc699,_0xe4b5('0x5d')))_0x4cc699=_0x4cc699[_0xe4b5('0x5e')](_0xe4b5('0x5d'),'Queue');_0x4b0896[_0xe4b5('0x5f')]['forEach'](function(_0xe9e67b){_0x19ab75[_0xe4b5('0x60')](getAgents(_0x4cc699,_0xe9e67b));});}});return BPromise['all'](_0x19ab75)['then'](function(_0x1b4dbe){_0x49fecc=_['union'](_0x49fecc,_['flatten'](_0x1b4dbe));_0x219259(_0x49fecc);})['catch'](function(_0x381095){_0xfeffbf(_0x381095);});});}function getAgents(_0xf7afbf,_0x143037){return new BPromise(function(_0x93b2f2,_0x5a8335){return db[_0xf7afbf][_0xe4b5('0x61')]({'where':{'id':_0x143037}})[_0xe4b5('0x2e')](function(_0x1a3792){return _0x1a3792[_0xe4b5('0x62')]({'attributes':['id'],'raw':!![]})[_0xe4b5('0x2e')](function(_0x39cecc){var _0x46f185=_[_0xe4b5('0x63')](_0x39cecc,'id');_0x93b2f2(_0x46f185);});})[_0xe4b5('0x59')](function(_0x3d8412){_0x5a8335(_0x3d8412);});});} \ No newline at end of file +var _0xad37=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','sendNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','beep','forEach','recipient','emit','notification:send','catch','text','Template','html','startCase','toLowerCase','ids','queue','replace','Queue','push','all','union','flatten','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x561430,_0x449efc){var _0x5a4964=function(_0x469c41){while(--_0x469c41){_0x561430['push'](_0x561430['shift']());}};_0x5a4964(++_0x449efc);}(_0xad37,0x18b));var _0x7ad3=function(_0x1d9f7f,_0xd01b44){_0x1d9f7f=_0x1d9f7f-0x0;var _0x4542ff=_0xad37[_0x1d9f7f];return _0x4542ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ad3('0x0'));var rimraf=require(_0x7ad3('0x1'));var zipdir=require(_0x7ad3('0x2'));var jsonpatch=require(_0x7ad3('0x3'));var rp=require('request-promise');var moment=require(_0x7ad3('0x4'));var BPromise=require(_0x7ad3('0x5'));var Mustache=require(_0x7ad3('0x6'));var util=require('util');var path=require(_0x7ad3('0x7'));var sox=require(_0x7ad3('0x8'));var csv=require(_0x7ad3('0x9'));var ejs=require(_0x7ad3('0xa'));var fs=require('fs');var _=require(_0x7ad3('0xb'));var squel=require(_0x7ad3('0xc'));var crypto=require(_0x7ad3('0xd'));var jsforce=require(_0x7ad3('0xe'));var deskjs=require(_0x7ad3('0xf'));var toCsv=require(_0x7ad3('0x9'));var querystring=require(_0x7ad3('0x10'));var Papa=require(_0x7ad3('0x11'));var Redis=require(_0x7ad3('0x12'));var authService=require(_0x7ad3('0x13'));var qs=require(_0x7ad3('0x14'));var as=require(_0x7ad3('0x15'));var hardwareService=require(_0x7ad3('0x16'));var logger=require(_0x7ad3('0x17'))('api');var utils=require(_0x7ad3('0x18'));var config=require(_0x7ad3('0x19'));var db=require('../../mysqldb')['db'];config[_0x7ad3('0x1a')]=_[_0x7ad3('0x1b')](config[_0x7ad3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad3('0x1a')]));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x477a22,_0x51fde1){_0x51fde1=_0x51fde1||0xcc;return function(_0x472725){if(_0x472725){return _0x477a22[_0x7ad3('0x1c')](_0x51fde1);}return _0x477a22[_0x7ad3('0x1d')](_0x51fde1)[_0x7ad3('0x1e')]();};}function respondWithResult(_0x4b4373,_0x5525ff){_0x5525ff=_0x5525ff||0xc8;return function(_0x22a2b2){if(_0x22a2b2){return _0x4b4373[_0x7ad3('0x1d')](_0x5525ff)[_0x7ad3('0x1f')](_0x22a2b2);}};}function respondWithFilteredResult(_0x2c77f5,_0x155438){return function(_0x4e15da){if(_0x4e15da){var _0x37a6f4=_0x4e15da['count'],_0x97ad01=_0x155438['offset'],_0x3fb379=_0x155438[_0x7ad3('0x20')]+_0x155438[_0x7ad3('0x21')],_0x7b1be3;if(_0x3fb379>=_0x37a6f4){_0x3fb379=_0x37a6f4;_0x7b1be3=0xc8;}else{_0x7b1be3=0xce;}_0x2c77f5[_0x7ad3('0x1d')](_0x7b1be3);return _0x2c77f5[_0x7ad3('0x22')](_0x7ad3('0x23'),_0x97ad01+'-'+_0x3fb379+'/'+_0x37a6f4)['json'](_0x4e15da);}return null;};}function patchUpdates(_0x2d40a3){return function(_0x314c86){try{jsonpatch[_0x7ad3('0x24')](_0x314c86,_0x2d40a3,!![]);}catch(_0x32f626){return BPromise['reject'](_0x32f626);}return _0x314c86['save']();};}function saveUpdates(_0x58ce4f,_0x2d3cc0){return function(_0x4a3f41){if(_0x4a3f41){return _0x4a3f41[_0x7ad3('0x25')](_0x58ce4f)[_0x7ad3('0x26')](function(_0x23cd77){return _0x23cd77;});}return null;};}function removeEntity(_0xab510,_0x9fc13e){return function(_0x35a650){if(_0x35a650){return _0x35a650[_0x7ad3('0x27')]()[_0x7ad3('0x26')](function(){_0xab510[_0x7ad3('0x1d')](0xcc)[_0x7ad3('0x1e')]();});}};}function handleEntityNotFound(_0x2c1e72,_0x56fa61){return function(_0x55a7c0){if(!_0x55a7c0){_0x2c1e72[_0x7ad3('0x1c')](0x194);}return _0x55a7c0;};}function handleError(_0x5e67dd,_0xc03920){_0xc03920=_0xc03920||0x1f4;return function(_0x35d5c6){logger[_0x7ad3('0x28')](_0x35d5c6[_0x7ad3('0x29')]);if(_0x35d5c6[_0x7ad3('0x2a')]){delete _0x35d5c6[_0x7ad3('0x2a')];}_0x5e67dd[_0x7ad3('0x1d')](_0xc03920)['send'](_0x35d5c6);};}exports[_0x7ad3('0x2b')]=function(_0x3f3beb,_0x3b3a65,_0x51cc63){if(!_0x3f3beb[_0x7ad3('0x2c')][_0x7ad3('0x2d')]('text')&&!_0x3f3beb['body']['hasOwnProperty'](_0x7ad3('0x2e'))){throw new db[(_0x7ad3('0x2f'))][(_0x7ad3('0x30'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3f3beb['body'][_0x7ad3('0x2d')](_0x7ad3('0x2e'))&&!_0x3f3beb[_0x7ad3('0x2c')][_0x7ad3('0x2d')](_0x7ad3('0x31'))){throw new db[(_0x7ad3('0x2f'))][(_0x7ad3('0x30'))](_0x7ad3('0x32'));}if(!_0x3f3beb[_0x7ad3('0x2c')][_0x7ad3('0x2d')]('recipients')){throw new db['Sequelize'][(_0x7ad3('0x30'))](_0x7ad3('0x33'));}else{try{var _0x53a3be=JSON[_0x7ad3('0x34')](_0x3f3beb[_0x7ad3('0x2c')][_0x7ad3('0x35')]);}catch(_0x3fe9e6){logger['error'](_0x3fe9e6);throw new db['Sequelize'][(_0x7ad3('0x30'))](_0x7ad3('0x36'));}var _0x2c6fab=[_0x7ad3('0x37'),_0x7ad3('0x38'),_0x7ad3('0x39'),_0x7ad3('0x3a'),_0x7ad3('0x3b'),_0x7ad3('0x3c'),_0x7ad3('0x3d'),_0x7ad3('0x3e'),'user'];if(_[_0x7ad3('0x3f')](_0x53a3be,function(_0x2fb6ee){return!_[_0x7ad3('0x40')](_0x2c6fab,_0x2fb6ee[_0x7ad3('0x41')]['toLowerCase']());})){throw new db[(_0x7ad3('0x2f'))]['ValidationError'](_0x7ad3('0x42'));}}}var _0x3d2dbe={};_0x3d2dbe[_0x7ad3('0x43')]=_0x3f3beb[_0x7ad3('0x2c')][_0x7ad3('0x2d')](_0x7ad3('0x43'))?_0x3f3beb['body'][_0x7ad3('0x43')]:_0x3f3beb[_0x7ad3('0x44')][_0x7ad3('0x45')];_0x3d2dbe['recipientsDescription']=_[_0x7ad3('0x46')](_0x3f3beb['body']['recipientsDescription'])?null:_0x3f3beb['body'][_0x7ad3('0x47')];_0x3d2dbe['beep']=_0x3f3beb[_0x7ad3('0x2c')]['beep']||![];_0x3d2dbe[_0x7ad3('0x48')]=_0x3f3beb[_0x7ad3('0x44')]['id'];return getContent(_0x3f3beb[_0x7ad3('0x2c')])[_0x7ad3('0x26')](function(_0x398c68){_0x3d2dbe[_0x7ad3('0x2c')]=_0x398c68;return getRecipients(_0x53a3be);})[_0x7ad3('0x26')](function(_0x1ecdaa){_0x3d2dbe[_0x7ad3('0x49')]=_[_0x7ad3('0x4a')](_0x1ecdaa)[_0x7ad3('0x4b')](',');return db[_0x7ad3('0x4c')][_0x7ad3('0x4d')](function(_0x5e685d){return db[_0x7ad3('0x4e')][_0x7ad3('0x4f')](_0x3d2dbe,{'raw':!![],'transaction':_0x5e685d})[_0x7ad3('0x26')](function(_0x31a744){var _0x6fdb9f={'sender':_0x3d2dbe['senderName'],'description':_0x3d2dbe['recipientsDescription'],'content':_0x3d2dbe['body'],'beep':_0x3d2dbe[_0x7ad3('0x50')]};_0x1ecdaa[_0x7ad3('0x51')](function(_0x358159){_0x6fdb9f[_0x7ad3('0x52')]=_0x358159;socket[_0x7ad3('0x53')](_0x7ad3('0x54'),_0x6fdb9f);});return _0x31a744;});});})[_0x7ad3('0x26')](respondWithResult(_0x3b3a65,0xc9))[_0x7ad3('0x55')](handleError(_0x3b3a65,null));};function getContent(_0x1ee2f8){return new BPromise(function(_0x252acf,_0x312671){if(_0x1ee2f8[_0x7ad3('0x56')]){_0x252acf(_0x1ee2f8[_0x7ad3('0x56')]);return;}return db[_0x7ad3('0x57')]['findOne']({'attributes':['html'],'where':{'id':_0x1ee2f8[_0x7ad3('0x2e')]},'raw':!![]})[_0x7ad3('0x26')](function(_0x5849cc){if(!_0x5849cc)throw new db[(_0x7ad3('0x2f'))][(_0x7ad3('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x228446=Mustache['render'](_0x5849cc[_0x7ad3('0x58')],_0x1ee2f8[_0x7ad3('0x31')]);_0x252acf(_0x228446);})[_0x7ad3('0x55')](function(_0x4bcfa6){_0x312671(_0x4bcfa6);});});}function getRecipients(_0x32ec9d){return new BPromise(function(_0xbe1838,_0x4c9180){var _0x5e5396=[];var _0x1ee3d7=[];_0x32ec9d[_0x7ad3('0x51')](function(_0x19f52a){var _0x1666c2=_[_0x7ad3('0x59')](_0x19f52a[_0x7ad3('0x41')][_0x7ad3('0x5a')]());if(_0x1666c2==='User'){_0x5e5396=_['union'](_0x5e5396,_0x19f52a[_0x7ad3('0x5b')]);}else{if(_[_0x7ad3('0x40')](_0x1666c2,_0x7ad3('0x5c')))_0x1666c2=_0x1666c2[_0x7ad3('0x5d')](_0x7ad3('0x5c'),_0x7ad3('0x5e'));_0x19f52a[_0x7ad3('0x5b')][_0x7ad3('0x51')](function(_0x50cdbd){_0x1ee3d7[_0x7ad3('0x5f')](getAgents(_0x1666c2,_0x50cdbd));});}});return BPromise[_0x7ad3('0x60')](_0x1ee3d7)[_0x7ad3('0x26')](function(_0x431b2d){_0x5e5396=_[_0x7ad3('0x61')](_0x5e5396,_[_0x7ad3('0x62')](_0x431b2d));_0xbe1838(_0x5e5396);})['catch'](function(_0x1006e8){_0x4c9180(_0x1006e8);});});}function getAgents(_0x1a8d17,_0x51d991){return new BPromise(function(_0x1ea052,_0x59a989){return db[_0x1a8d17][_0x7ad3('0x63')]({'where':{'id':_0x51d991}})[_0x7ad3('0x26')](function(_0x1e91db){return _0x1e91db['getAgents']({'attributes':['id'],'raw':!![]})[_0x7ad3('0x26')](function(_0x520132){var _0x5be168=_[_0x7ad3('0x64')](_0x520132,'id');_0x1ea052(_0x5be168);});})[_0x7ad3('0x55')](function(_0x1c1631){_0x59a989(_0x1c1631);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 758cf19..1082277 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x372c15,_0x3f4894){var _0x1567ad=function(_0x51c8f7){while(--_0x51c8f7){_0x372c15['push'](_0x372c15['shift']());}};_0x1567ad(++_0x3f4894);}(_0x757a,0xde));var _0xa757=function(_0x517b89,_0x5e256a){_0x517b89=_0x517b89-0x0;var _0xc23b8b=_0x757a[_0x517b89];return _0xc23b8b;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x5512ab,_0x26281f){var _0x28dcc5=function(_0x278bc0){while(--_0x278bc0){_0x5512ab['push'](_0x5512ab['shift']());}};_0x28dcc5(++_0x26281f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x155021,_0x50b3c8){_0x155021=_0x155021-0x0;var _0x11a15d=_0x5f2f[_0x155021];return _0x11a15d;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 0acff35..26194d6 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e4b=['../../config/logger','api','moment','bluebird','path','rimraf','./notification.attributes','exports','Notification','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xbfddf,_0x18f549){var _0x565f9b=function(_0x4747b5){while(--_0x4747b5){_0xbfddf['push'](_0xbfddf['shift']());}};_0x565f9b(++_0x18f549);}(_0x2e4b,0x16a));var _0xb2e4=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0x2e4b[_0xdefbc3];return _0x367798;};'use strict';var _=require(_0xb2e4('0x0'));var util=require(_0xb2e4('0x1'));var logger=require(_0xb2e4('0x2'))(_0xb2e4('0x3'));var moment=require(_0xb2e4('0x4'));var BPromise=require(_0xb2e4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2e4('0x6'));var rimraf=require(_0xb2e4('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2e4('0x8'));module[_0xb2e4('0x9')]=function(_0x13e79b,_0x14c694){return _0x13e79b['define'](_0xb2e4('0xa'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb2e4('0xb'),'collate':_0xb2e4('0xc')});}; \ No newline at end of file +var _0xe989=['notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./notification.attributes','define'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe989,0x107));var _0x9e98=function(_0x198a68,_0x1ab1cc){_0x198a68=_0x198a68-0x0;var _0x5f0d21=_0xe989[_0x198a68];return _0x5f0d21;};'use strict';var _=require(_0x9e98('0x0'));var util=require(_0x9e98('0x1'));var logger=require(_0x9e98('0x2'))('api');var moment=require(_0x9e98('0x3'));var BPromise=require(_0x9e98('0x4'));var rp=require(_0x9e98('0x5'));var fs=require('fs');var path=require(_0x9e98('0x6'));var rimraf=require('rimraf');var config=require(_0x9e98('0x7'));var attributes=require(_0x9e98('0x8'));module['exports']=function(_0x449730,_0xd17930){return _0x449730[_0x9e98('0x9')]('Notification',attributes,{'tableName':_0x9e98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9e98('0xb'),'collate':_0x9e98('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 99c38b2..8d57698 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a26=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','then','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','Notification,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../mysqldb'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x2a26,0xbc));var _0x62a2=function(_0x44e4e1,_0x5637b2){_0x44e4e1=_0x44e4e1-0x0;var _0x300cd2=_0x2a26[_0x44e4e1];return _0x300cd2;};'use strict';var _=require(_0x62a2('0x0'));var util=require('util');var moment=require(_0x62a2('0x1'));var BPromise=require(_0x62a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62a2('0x3'))['db'];var utils=require(_0x62a2('0x4'));var logger=require(_0x62a2('0x5'))(_0x62a2('0x6'));var config=require(_0x62a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x62a2('0x8')][_0x62a2('0x9')]({'port':0x232a});config[_0x62a2('0xa')]=_[_0x62a2('0xb')](config['redis'],{'host':_0x62a2('0xc'),'port':0x18eb});var socket=require(_0x62a2('0xd'))(new Redis(config[_0x62a2('0xa')]));require(_0x62a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x152951,_0x2fe865,_0x14f7fe){return new BPromise(function(_0x4bebb9,_0x121b8a){return client['request'](_0x152951,_0x14f7fe)[_0x62a2('0xf')](function(_0x19849d){logger['info']('Notification,\x20%s,\x20%s',_0x2fe865,_0x62a2('0x10'));logger[_0x62a2('0x11')](_0x62a2('0x12'),_0x2fe865,'request\x20sent',JSON[_0x62a2('0x13')](_0x19849d));if(_0x19849d['error']){if(_0x19849d['error']['code']===0x1f4){logger[_0x62a2('0x14')](_0x62a2('0x15'),_0x2fe865,_0x19849d[_0x62a2('0x14')][_0x62a2('0x16')]);return _0x121b8a(_0x19849d[_0x62a2('0x14')][_0x62a2('0x16')]);}logger[_0x62a2('0x14')]('Notification,\x20%s,\x20%s',_0x2fe865,_0x19849d[_0x62a2('0x14')][_0x62a2('0x16')]);return _0x4bebb9(_0x19849d[_0x62a2('0x14')]['message']);}else{logger['info'](_0x62a2('0x15'),_0x2fe865,_0x62a2('0x10'));_0x4bebb9(_0x19849d[_0x62a2('0x17')]['message']);}})['catch'](function(_0x47f57d){logger[_0x62a2('0x14')](_0x62a2('0x15'),_0x2fe865,_0x47f57d);_0x121b8a(_0x47f57d);});});} \ No newline at end of file +var _0xf6c4=['client','http','redis','defaults','socket.io-emitter','./notification.socket','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41ab5c,_0x14800f){var _0xab348=function(_0x46ea20){while(--_0x46ea20){_0x41ab5c['push'](_0x41ab5c['shift']());}};_0xab348(++_0x14800f);}(_0xf6c4,0x1ee));var _0x4f6c=function(_0x371912,_0x4cd2cc){_0x371912=_0x371912-0x0;var _0x4f740d=_0xf6c4[_0x371912];return _0x4f740d;};'use strict';var _=require(_0x4f6c('0x0'));var util=require(_0x4f6c('0x1'));var moment=require(_0x4f6c('0x2'));var BPromise=require(_0x4f6c('0x3'));var rs=require(_0x4f6c('0x4'));var fs=require('fs');var Redis=require(_0x4f6c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f6c('0x6'))(_0x4f6c('0x7'));var config=require(_0x4f6c('0x8'));var jayson=require(_0x4f6c('0x9'));var client=jayson[_0x4f6c('0xa')][_0x4f6c('0xb')]({'port':0x232a});config[_0x4f6c('0xc')]=_[_0x4f6c('0xd')](config[_0x4f6c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f6c('0xe'))(new Redis(config[_0x4f6c('0xc')]));require(_0x4f6c('0xf'))[_0x4f6c('0x10')](socket);function respondWithRpcPromise(_0x3589c9,_0xf238fe,_0x436453){return new BPromise(function(_0x4ebd8c,_0x119f76){return client['request'](_0x3589c9,_0x436453)[_0x4f6c('0x11')](function(_0x371d22){logger[_0x4f6c('0x12')](_0x4f6c('0x13'),_0xf238fe,_0x4f6c('0x14'));logger[_0x4f6c('0x15')](_0x4f6c('0x16'),_0xf238fe,_0x4f6c('0x14'),JSON['stringify'](_0x371d22));if(_0x371d22[_0x4f6c('0x17')]){if(_0x371d22['error'][_0x4f6c('0x18')]===0x1f4){logger[_0x4f6c('0x17')]('Notification,\x20%s,\x20%s',_0xf238fe,_0x371d22['error'][_0x4f6c('0x19')]);return _0x119f76(_0x371d22[_0x4f6c('0x17')][_0x4f6c('0x19')]);}logger[_0x4f6c('0x17')](_0x4f6c('0x13'),_0xf238fe,_0x371d22['error'][_0x4f6c('0x19')]);return _0x4ebd8c(_0x371d22[_0x4f6c('0x17')][_0x4f6c('0x19')]);}else{logger[_0x4f6c('0x12')](_0x4f6c('0x13'),_0xf238fe,_0x4f6c('0x14'));_0x4ebd8c(_0x371d22[_0x4f6c('0x1a')][_0x4f6c('0x19')]);}})[_0x4f6c('0x1b')](function(_0x36f725){logger[_0x4f6c('0x17')](_0x4f6c('0x13'),_0xf238fe,_0x36f725);_0x119f76(_0x36f725);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 998a7f5..84ca5e8 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x882e=['removeListener','notification:','./notification.events','save','remove','update','emit'];(function(_0x3ba4b0,_0x467a21){var _0x5e2c28=function(_0x2d3df1){while(--_0x2d3df1){_0x3ba4b0['push'](_0x3ba4b0['shift']());}};_0x5e2c28(++_0x467a21);}(_0x882e,0x6b));var _0xe882=function(_0x572f23,_0x19e1e0){_0x572f23=_0x572f23-0x0;var _0x1fab90=_0x882e[_0x572f23];return _0x1fab90;};'use strict';var NotificationEvents=require(_0xe882('0x0'));var events=[_0xe882('0x1'),_0xe882('0x2'),_0xe882('0x3')];function createListener(_0x46829d,_0x574fc9){return function(_0x1fdbe2){_0x574fc9[_0xe882('0x4')](_0x46829d,_0x1fdbe2);};}function removeListener(_0x3835bf,_0x5d9904){return function(){NotificationEvents[_0xe882('0x5')](_0x3835bf,_0x5d9904);};}exports['register']=function(_0x4f7e88){for(var _0x4106dd=0x0,_0x50a9ca=events['length'];_0x4106dd<_0x50a9ca;_0x4106dd++){var _0x569111=events[_0x4106dd];var _0x1fd492=createListener(_0xe882('0x6')+_0x569111,_0x4f7e88);NotificationEvents['on'](_0x569111,_0x1fd492);}}; \ No newline at end of file +var _0xd189=['register','notification:','./notification.events','save','update','emit','removeListener'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xd189,0x144));var _0x9d18=function(_0x2e1f5d,_0xbf2953){_0x2e1f5d=_0x2e1f5d-0x0;var _0x4a2176=_0xd189[_0x2e1f5d];return _0x4a2176;};'use strict';var NotificationEvents=require(_0x9d18('0x0'));var events=[_0x9d18('0x1'),'remove',_0x9d18('0x2')];function createListener(_0x424ad4,_0x1b4f34){return function(_0x5aec4f){_0x1b4f34[_0x9d18('0x3')](_0x424ad4,_0x5aec4f);};}function removeListener(_0x18979a,_0x595d71){return function(){NotificationEvents[_0x9d18('0x4')](_0x18979a,_0x595d71);};}exports[_0x9d18('0x5')]=function(_0x574783){for(var _0x571656=0x0,_0xd40127=events['length'];_0x571656<_0xd40127;_0x571656++){var _0x463e2f=events[_0x571656];var _0x16955b=createListener(_0x9d18('0x6')+_0x463e2f,_0x574783);NotificationEvents['on'](_0x463e2f,_0x16955b);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b5d1b69..dec6f18 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 _0x6516=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','addAnswer','/:id/notify','addApplications','/:id/send','send','put','delete','removeDispositions','removeAnswers','/:id/users','exports','multer','path'];(function(_0x40f4da,_0x2de114){var _0xcb68f=function(_0x1d4b0b){while(--_0x1d4b0b){_0x40f4da['push'](_0x40f4da['shift']());}};_0xcb68f(++_0x2de114);}(_0x6516,0x11e));var _0x6651=function(_0x2bf712,_0xd5be00){_0x2bf712=_0x2bf712-0x0;var _0x4d46af=_0x6516[_0x2bf712];return _0x4d46af;};'use strict';var multer=require(_0x6651('0x0'));var util=require('util');var path=require(_0x6651('0x1'));var timeout=require(_0x6651('0x2'));var express=require(_0x6651('0x3'));var router=express[_0x6651('0x4')]();var auth=require(_0x6651('0x5'));var interaction=require(_0x6651('0x6'));var config=require(_0x6651('0x7'));var controller=require(_0x6651('0x8'));router[_0x6651('0x9')]('/',auth[_0x6651('0xa')](),controller[_0x6651('0xb')]);router[_0x6651('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6651('0x9')](_0x6651('0xc'),auth[_0x6651('0xa')](),controller[_0x6651('0xd')]);router[_0x6651('0x9')](_0x6651('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x6651('0x9')](_0x6651('0xf'),auth['isAuthenticated'](),controller[_0x6651('0x10')]);router[_0x6651('0x9')](_0x6651('0x11'),auth['isAuthenticated'](),controller[_0x6651('0x12')]);router[_0x6651('0x9')](_0x6651('0x13'),auth[_0x6651('0xa')](),controller[_0x6651('0x14')]);router[_0x6651('0x9')]('/:id/users',auth[_0x6651('0xa')](),controller[_0x6651('0x15')]);router['post']('/',auth[_0x6651('0xa')](),controller[_0x6651('0x16')]);router[_0x6651('0x17')](_0x6651('0xe'),auth[_0x6651('0xa')](),controller[_0x6651('0x18')]);router[_0x6651('0x17')](_0x6651('0xf'),auth[_0x6651('0xa')](),controller[_0x6651('0x19')]);router['post'](_0x6651('0x1a'),controller['notify']);router[_0x6651('0x17')](_0x6651('0x11'),auth[_0x6651('0xa')](),controller[_0x6651('0x1b')]);router[_0x6651('0x17')]('/:id/users',auth[_0x6651('0xa')](),controller['addAgents']);router[_0x6651('0x17')](_0x6651('0x1c'),auth[_0x6651('0xa')](),controller[_0x6651('0x1d')]);router[_0x6651('0x1e')](_0x6651('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6651('0x1f')]('/:id',auth[_0x6651('0xa')](),controller['destroy']);router['delete'](_0x6651('0xe'),auth[_0x6651('0xa')](),controller[_0x6651('0x20')]);router[_0x6651('0x1f')](_0x6651('0xf'),auth['isAuthenticated'](),controller[_0x6651('0x21')]);router[_0x6651('0x1f')](_0x6651('0x22'),auth[_0x6651('0xa')](),controller['removeAgents']);module[_0x6651('0x23')]=router; \ No newline at end of file +var _0xe853=['delete','destroy','/:id/dispositions','removeDispositions','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put'];(function(_0x5ace5f,_0x24ae93){var _0x41a0ab=function(_0x2f1b6e){while(--_0x2f1b6e){_0x5ace5f['push'](_0x5ace5f['shift']());}};_0x41a0ab(++_0x24ae93);}(_0xe853,0x1a9));var _0x3e85=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe853[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x3e85('0x0'));var util=require(_0x3e85('0x1'));var path=require(_0x3e85('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e85('0x3'));var router=express[_0x3e85('0x4')]();var auth=require(_0x3e85('0x5'));var interaction=require(_0x3e85('0x6'));var config=require(_0x3e85('0x7'));var controller=require('./openchannelAccount.controller');router[_0x3e85('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e85('0x8')](_0x3e85('0x9'),auth[_0x3e85('0xa')](),controller[_0x3e85('0xb')]);router[_0x3e85('0x8')](_0x3e85('0xc'),auth[_0x3e85('0xa')](),controller[_0x3e85('0xd')]);router[_0x3e85('0x8')]('/:id/dispositions',auth[_0x3e85('0xa')](),controller[_0x3e85('0xe')]);router[_0x3e85('0x8')](_0x3e85('0xf'),auth['isAuthenticated'](),controller[_0x3e85('0x10')]);router[_0x3e85('0x8')](_0x3e85('0x11'),auth[_0x3e85('0xa')](),controller['getApplications']);router[_0x3e85('0x8')]('/:id/interactions',auth[_0x3e85('0xa')](),controller['getInteractions']);router[_0x3e85('0x8')](_0x3e85('0x12'),auth[_0x3e85('0xa')](),controller[_0x3e85('0x13')]);router[_0x3e85('0x14')]('/',auth[_0x3e85('0xa')](),controller[_0x3e85('0x15')]);router['post']('/:id/dispositions',auth[_0x3e85('0xa')](),controller['addDisposition']);router[_0x3e85('0x14')](_0x3e85('0xf'),auth[_0x3e85('0xa')](),controller[_0x3e85('0x16')]);router[_0x3e85('0x14')](_0x3e85('0x17'),controller[_0x3e85('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x3e85('0x19')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x3e85('0x1a')]);router[_0x3e85('0x14')](_0x3e85('0x1b'),auth[_0x3e85('0xa')](),controller[_0x3e85('0x1c')]);router[_0x3e85('0x1d')](_0x3e85('0xc'),auth[_0x3e85('0xa')](),controller['update']);router[_0x3e85('0x1e')](_0x3e85('0xc'),auth[_0x3e85('0xa')](),controller[_0x3e85('0x1f')]);router['delete'](_0x3e85('0x20'),auth[_0x3e85('0xa')](),controller[_0x3e85('0x21')]);router[_0x3e85('0x1e')](_0x3e85('0xf'),auth[_0x3e85('0xa')](),controller['removeAnswers']);router[_0x3e85('0x1e')](_0x3e85('0x12'),auth[_0x3e85('0xa')](),controller[_0x3e85('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 90a244f..7c12626 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 _0xf56c=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4f0dd8,_0x299400){var _0x48f875=function(_0x382c34){while(--_0x382c34){_0x4f0dd8['push'](_0x4f0dd8['shift']());}};_0x48f875(++_0x299400);}(_0xf56c,0x14b));var _0xcf56=function(_0x2d2421,_0x3422d6){_0x2d2421=_0x2d2421-0x0;var _0x341708=_0xf56c[_0x2d2421];return _0x341708;};'use strict';var Sequelize=require(_0xcf56('0x0'));var rs=require('randomstring');module[_0xcf56('0x1')]={'name':{'type':Sequelize[_0xcf56('0x2')],'unique':_0xcf56('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xcf56('0x2')]},'token':{'type':Sequelize[_0xcf56('0x2')],'defaultValue':function(){return rs[_0xcf56('0x4')]();}},'replyUri':{'type':Sequelize[_0xcf56('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcf56('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcf56('0x5')],'defaultValue':function(){return _0xcf56('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcf56('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf56('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcf56('0x2')]},'queueTransfer':{'type':Sequelize[_0xcf56('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf56('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf56('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf56('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf56('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xcf56('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcf56('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x181c06){if(!_0x181c06)this[_0xcf56('0xa')](_0xcf56('0xb'),null);this[_0xcf56('0xa')](_0xcf56('0xc'),_0x181c06);}}}; \ No newline at end of file +var _0x8633=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x5d54b5,_0x1d7203){var _0x4bb212=function(_0x615ac2){while(--_0x615ac2){_0x5d54b5['push'](_0x5d54b5['shift']());}};_0x4bb212(++_0x1d7203);}(_0x8633,0x1cf));var _0x3863=function(_0x5ce0e9,_0x40b143){_0x5ce0e9=_0x5ce0e9-0x0;var _0x2f0810=_0x8633[_0x5ce0e9];return _0x2f0810;};'use strict';var Sequelize=require(_0x3863('0x0'));var rs=require(_0x3863('0x1'));module[_0x3863('0x2')]={'name':{'type':Sequelize[_0x3863('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3863('0x3')]},'token':{'type':Sequelize[_0x3863('0x3')],'defaultValue':function(){return rs[_0x3863('0x4')]();}},'replyUri':{'type':Sequelize[_0x3863('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3863('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3863('0x5')],'defaultValue':function(){return _0x3863('0x6');}},'notificationSound':{'type':Sequelize[_0x3863('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3863('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3863('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3863('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3863('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3863('0xa'),'set':function(_0x367942){if(!_0x367942)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3863('0xb')](_0x3863('0xc'),_0x367942);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 31471dc..c130ab2 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 _0xd9ec=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','options','where','includeAll','include','findAll','rows','show','params','Pause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','rawAttributes','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','includes','mapKey','CmList','OpenchannelApplication','Applications','List','list','applications','orderBy','priority','asc','account','Contacts','CmContact','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','count','offset','limit','set','json','reject','update','destroy','get','OpenchannelAccounts','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','key','model','query','keys','filters'];(function(_0x1566eb,_0x3aed11){var _0x5bee5f=function(_0x5cad17){while(--_0x5cad17){_0x1566eb['push'](_0x1566eb['shift']());}};_0x5bee5f(++_0x3aed11);}(_0xd9ec,0x121));var _0xcd9e=function(_0x4837f8,_0x3cb1ed){_0x4837f8=_0x4837f8-0x0;var _0x5f3a87=_0xd9ec[_0x4837f8];return _0x5f3a87;};'use strict';var pdf=require(_0xcd9e('0x0'));var emlformat=require(_0xcd9e('0x1'));var rimraf=require(_0xcd9e('0x2'));var zipdir=require(_0xcd9e('0x3'));var jsonpatch=require(_0xcd9e('0x4'));var rp=require('request-promise');var moment=require(_0xcd9e('0x5'));var BPromise=require(_0xcd9e('0x6'));var Mustache=require(_0xcd9e('0x7'));var util=require(_0xcd9e('0x8'));var path=require(_0xcd9e('0x9'));var sox=require(_0xcd9e('0xa'));var csv=require('to-csv');var ejs=require(_0xcd9e('0xb'));var fs=require('fs');var _=require(_0xcd9e('0xc'));var squel=require(_0xcd9e('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd9e('0xe'));var deskjs=require(_0xcd9e('0xf'));var toCsv=require(_0xcd9e('0x10'));var querystring=require(_0xcd9e('0x11'));var Papa=require(_0xcd9e('0x12'));var Redis=require('ioredis');var authService=require(_0xcd9e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcd9e('0x14'));var hardwareService=require(_0xcd9e('0x15'));var logger=require(_0xcd9e('0x16'))(_0xcd9e('0x17'));var utils=require(_0xcd9e('0x18'));var config=require(_0xcd9e('0x19'));var db=require('../../mysqldb')['db'];config[_0xcd9e('0x1a')]=_[_0xcd9e('0x1b')](config[_0xcd9e('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd9e('0x1c'))(new Redis(config[_0xcd9e('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xcd9e('0x1d'));var client=jayson[_0xcd9e('0x1e')][_0xcd9e('0x1f')]({'port':0x232c});var client9002=jayson[_0xcd9e('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x5769b5,_0x4fcdb2,_0x3ec383){if(_0x3ec383){var _0x510564=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x510564[_0xcd9e('0x20')](_0x4fcdb2)){return _0x5769b5;}else{throw new db[(_0xcd9e('0x21'))]['ValidationError'](_0xcd9e('0x22'));}}else{return _0x5769b5;}}function respondWithRpcPromise(_0x3c067e,_0x235fab,_0x227da4,_0x59e450){return new BPromise(function(_0x295bdb,_0x84813a){var _0x1ef8fe=_0x59e450||client;return _0x1ef8fe['request'](_0x3c067e,_0x227da4)[_0xcd9e('0x23')](function(_0x13a7e3){logger[_0xcd9e('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x235fab,'request\x20sent');logger[_0xcd9e('0x25')](_0xcd9e('0x26'),_0x235fab,'request\x20sent',JSON['stringify'](_0x13a7e3));if(_0x13a7e3['error']){if(_0x13a7e3[_0xcd9e('0x27')][_0xcd9e('0x28')]===0x1f4){logger[_0xcd9e('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x235fab,_0x13a7e3[_0xcd9e('0x27')][_0xcd9e('0x29')]);return _0x84813a(_0x13a7e3['error'][_0xcd9e('0x29')]);}logger[_0xcd9e('0x27')](_0xcd9e('0x2a'),_0x235fab,_0x13a7e3[_0xcd9e('0x27')][_0xcd9e('0x29')]);return _0x295bdb(_0x13a7e3[_0xcd9e('0x27')][_0xcd9e('0x29')]);}else{logger[_0xcd9e('0x24')](_0xcd9e('0x2a'),_0x235fab,'request\x20sent');_0x295bdb(_0x13a7e3[_0xcd9e('0x2b')][_0xcd9e('0x29')]);}})[_0xcd9e('0x2c')](function(_0x4d2a1a){logger[_0xcd9e('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x235fab,_0x4d2a1a);_0x84813a(_0x4d2a1a);});});}function respondWithStatusCode(_0x50a0ad,_0x37f2d6){_0x37f2d6=_0x37f2d6||0xcc;return function(_0x5d2092){if(_0x5d2092){return _0x50a0ad[_0xcd9e('0x2d')](_0x37f2d6);}return _0x50a0ad['status'](_0x37f2d6)[_0xcd9e('0x2e')]();};}function respondWithResult(_0x284dd4,_0x146c99){_0x146c99=_0x146c99||0xc8;return function(_0x6a44c8){if(_0x6a44c8){return _0x284dd4[_0xcd9e('0x2f')](_0x146c99)['json'](_0x6a44c8);}};}function respondWithFilteredResult(_0x9bacdf,_0x5a51da){return function(_0x111738){if(_0x111738){var _0x2cbc30=_0x111738[_0xcd9e('0x30')],_0x5eb940=_0x5a51da[_0xcd9e('0x31')],_0x5a63c5=_0x5a51da[_0xcd9e('0x31')]+_0x5a51da[_0xcd9e('0x32')],_0x4e76f8;if(_0x5a63c5>=_0x2cbc30){_0x5a63c5=_0x2cbc30;_0x4e76f8=0xc8;}else{_0x4e76f8=0xce;}_0x9bacdf[_0xcd9e('0x2f')](_0x4e76f8);return _0x9bacdf[_0xcd9e('0x33')]('Content-Range',_0x5eb940+'-'+_0x5a63c5+'/'+_0x2cbc30)[_0xcd9e('0x34')](_0x111738);}return null;};}function patchUpdates(_0x430eb0){return function(_0x16f732){try{jsonpatch['apply'](_0x16f732,_0x430eb0,!![]);}catch(_0x33600d){return BPromise[_0xcd9e('0x35')](_0x33600d);}return _0x16f732['save']();};}function saveUpdates(_0x7599cd,_0xfebb92){return function(_0x34393c){if(_0x34393c){return _0x34393c[_0xcd9e('0x36')](_0x7599cd)[_0xcd9e('0x23')](function(_0x1f1010){return _0x1f1010;});}return null;};}function removeEntity(_0x49613e,_0xc46b3f){return function(_0xa9d2fc){if(_0xa9d2fc){return _0xa9d2fc[_0xcd9e('0x37')]()[_0xcd9e('0x23')](function(){var _0x68da98=_0xa9d2fc[_0xcd9e('0x38')]({'plain':!![]});var _0x452a19=_0xcd9e('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x452a19,'resourceId':_0x68da98['id']}})[_0xcd9e('0x23')](function(){return _0xa9d2fc;});})[_0xcd9e('0x23')](function(){_0x49613e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e741f,_0x36698d){return function(_0x4ad3f5){if(!_0x4ad3f5){_0x2e741f[_0xcd9e('0x2d')](0x194);}return _0x4ad3f5;};}function handleError(_0x447152,_0x17b29c){_0x17b29c=_0x17b29c||0x1f4;return function(_0x4837e3){logger[_0xcd9e('0x27')](_0x4837e3[_0xcd9e('0x3a')]);if(_0x4837e3[_0xcd9e('0x3b')]){delete _0x4837e3[_0xcd9e('0x3b')];}_0x447152[_0xcd9e('0x2f')](_0x17b29c)[_0xcd9e('0x3c')](_0x4837e3);};}exports['index']=function(_0x469c3a,_0x908a37){var _0x364325={'include':[{'model':db['Pause'],'as':_0xcd9e('0x3d')}]},_0x42aeb5={},_0x29e634={'count':0x0,'rows':[]};var _0x2932b5=_[_0xcd9e('0x3e')](db[_0xcd9e('0x3f')]['rawAttributes'],function(_0x1d1c24){return{'name':_0x1d1c24['fieldName'],'type':_0x1d1c24['type'][_0xcd9e('0x40')]};});_0x42aeb5[_0xcd9e('0x41')]=_[_0xcd9e('0x3e')](_0x2932b5,_0xcd9e('0x3b'));_0x42aeb5[_0xcd9e('0x42')]=_[_0xcd9e('0x43')](_0x469c3a[_0xcd9e('0x42')]);_0x42aeb5[_0xcd9e('0x44')]=_[_0xcd9e('0x45')](_0x42aeb5[_0xcd9e('0x41')],_0x42aeb5[_0xcd9e('0x42')]);_0x364325[_0xcd9e('0x46')]=_[_0xcd9e('0x45')](_0x42aeb5[_0xcd9e('0x41')],qs[_0xcd9e('0x47')](_0x469c3a[_0xcd9e('0x42')]['fields']));_0x364325[_0xcd9e('0x46')]=_0x364325[_0xcd9e('0x46')][_0xcd9e('0x48')]?_0x364325[_0xcd9e('0x46')]:_0x42aeb5[_0xcd9e('0x41')];if(!_0x469c3a['query'][_0xcd9e('0x49')](_0xcd9e('0x4a'))){_0x364325[_0xcd9e('0x32')]=qs['limit'](_0x469c3a[_0xcd9e('0x42')][_0xcd9e('0x32')]);_0x364325[_0xcd9e('0x31')]=qs['offset'](_0x469c3a[_0xcd9e('0x42')][_0xcd9e('0x31')]);}_0x364325['order']=qs[_0xcd9e('0x4b')](_0x469c3a['query']['sort']);_0x364325['where']=qs[_0xcd9e('0x44')](_['pick'](_0x469c3a[_0xcd9e('0x42')],_0x42aeb5[_0xcd9e('0x44')]),_0x2932b5);if(_0x469c3a[_0xcd9e('0x42')][_0xcd9e('0x4c')]){_0x364325['where']=_[_0xcd9e('0x4d')](_0x364325['where'],{'$or':_['map'](_0x2932b5,function(_0x2cf248){if(_0x2cf248['type']!=='VIRTUAL'){var _0x5f2a0e={};_0x5f2a0e[_0x2cf248[_0xcd9e('0x3b')]]={'$like':'%'+_0x469c3a['query'][_0xcd9e('0x4c')]+'%'};return _0x5f2a0e;}})});}_0x364325=_[_0xcd9e('0x4d')]({},_0x364325,_0x469c3a[_0xcd9e('0x4e')]);var _0x36c4df={'where':_0x364325[_0xcd9e('0x4f')]};return db['OpenchannelAccount'][_0xcd9e('0x30')](_0x36c4df)[_0xcd9e('0x23')](function(_0x15807a){_0x29e634[_0xcd9e('0x30')]=_0x15807a;if(_0x469c3a[_0xcd9e('0x42')][_0xcd9e('0x50')]){_0x364325[_0xcd9e('0x51')]=[{'all':!![]}];}return db[_0xcd9e('0x3f')][_0xcd9e('0x52')](_0x364325);})[_0xcd9e('0x23')](function(_0x55df9f){_0x29e634[_0xcd9e('0x53')]=_0x55df9f;return _0x29e634;})[_0xcd9e('0x23')](respondWithFilteredResult(_0x908a37,_0x364325))[_0xcd9e('0x2c')](handleError(_0x908a37,null));};exports[_0xcd9e('0x54')]=function(_0x24830f,_0x2c3df1){var _0x20b19a={'raw':![],'where':{'id':_0x24830f[_0xcd9e('0x55')]['id']},'include':[{'model':db[_0xcd9e('0x56')],'as':_0xcd9e('0x3d')}]},_0x4bc09c={};_0x4bc09c[_0xcd9e('0x41')]=_[_0xcd9e('0x43')](db[_0xcd9e('0x3f')]['rawAttributes']);_0x4bc09c[_0xcd9e('0x42')]=_[_0xcd9e('0x43')](_0x24830f[_0xcd9e('0x42')]);_0x4bc09c[_0xcd9e('0x44')]=_[_0xcd9e('0x45')](_0x4bc09c['model'],_0x4bc09c[_0xcd9e('0x42')]);_0x20b19a[_0xcd9e('0x46')]=_[_0xcd9e('0x45')](_0x4bc09c[_0xcd9e('0x41')],qs[_0xcd9e('0x47')](_0x24830f[_0xcd9e('0x42')][_0xcd9e('0x47')]));_0x20b19a[_0xcd9e('0x46')]=_0x20b19a['attributes'][_0xcd9e('0x48')]?_0x20b19a[_0xcd9e('0x46')]:_0x4bc09c['model'];if(_0x24830f['query']['includeAll']){_0x20b19a[_0xcd9e('0x51')]=[{'all':!![]}];}_0x20b19a=_[_0xcd9e('0x4d')]({},_0x20b19a,_0x24830f['options']);return db[_0xcd9e('0x3f')]['find'](_0x20b19a)[_0xcd9e('0x23')](handleEntityNotFound(_0x2c3df1,null))['then'](respondWithResult(_0x2c3df1,null))[_0xcd9e('0x2c')](handleError(_0x2c3df1,null));};exports[_0xcd9e('0x57')]=function(_0x608ec8,_0x3c9034){return db[_0xcd9e('0x3f')][_0xcd9e('0x57')](_0x608ec8[_0xcd9e('0x58')],{})[_0xcd9e('0x23')](function(_0x10bf16){var _0x1d3d67=_0x608ec8[_0xcd9e('0x59')][_0xcd9e('0x38')]({'plain':!![]});if(!_0x1d3d67)throw new Error(_0xcd9e('0x5a'));if(_0x1d3d67[_0xcd9e('0x5b')]===_0xcd9e('0x59')){var _0xa7db8c=_0x10bf16[_0xcd9e('0x38')]({'plain':!![]});var _0x443ff9=_0xcd9e('0x39');return db['UserProfileSection'][_0xcd9e('0x5c')]({'where':{'name':_0x443ff9,'userProfileId':_0x1d3d67[_0xcd9e('0x5d')]},'raw':!![]})[_0xcd9e('0x23')](function(_0x388fd9){if(_0x388fd9&&_0x388fd9['autoAssociation']===0x0){return db['UserProfileResource'][_0xcd9e('0x57')]({'name':_0xa7db8c[_0xcd9e('0x3b')],'resourceId':_0xa7db8c['id'],'type':_0x388fd9[_0xcd9e('0x3b')],'sectionId':_0x388fd9['id']},{})[_0xcd9e('0x23')](function(){return _0x10bf16;});}else{return _0x10bf16;}})['catch'](function(_0x36cdf0){logger[_0xcd9e('0x27')](_0xcd9e('0x5e'),_0x36cdf0);throw _0x36cdf0;});}return _0x10bf16;})['then'](respondWithResult(_0x3c9034,0xc9))['catch'](handleError(_0x3c9034,null));};exports['update']=function(_0x6ffca0,_0x54c684){if(_0x6ffca0['body']['id']){delete _0x6ffca0[_0xcd9e('0x58')]['id'];}return db[_0xcd9e('0x3f')][_0xcd9e('0x5c')]({'where':{'id':_0x6ffca0[_0xcd9e('0x55')]['id']},'include':[{'model':db[_0xcd9e('0x56')],'as':_0xcd9e('0x3d')}]})[_0xcd9e('0x23')](handleEntityNotFound(_0x54c684,null))[_0xcd9e('0x23')](saveUpdates(_0x6ffca0[_0xcd9e('0x58')],null))[_0xcd9e('0x23')](respondWithResult(_0x54c684,null))[_0xcd9e('0x2c')](handleError(_0x54c684,null));};exports['destroy']=function(_0x112f59,_0x53f45a){return db['OpenchannelAccount'][_0xcd9e('0x5c')]({'where':{'id':_0x112f59['params']['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x53f45a,null))[_0xcd9e('0x23')](removeEntity(_0x53f45a,null))[_0xcd9e('0x2c')](handleError(_0x53f45a,null));};exports[_0xcd9e('0x5f')]=function(_0x48cbe7,_0x25e947){return db[_0xcd9e('0x3f')][_0xcd9e('0x5f')]()[_0xcd9e('0x23')](respondWithResult(_0x25e947,null))[_0xcd9e('0x2c')](handleError(_0x25e947,null));};exports['addDisposition']=function(_0x1c29bd,_0x449771,_0x2e4ed0){if(_0x1c29bd[_0xcd9e('0x58')]['id']){delete _0x1c29bd[_0xcd9e('0x58')]['id'];}return db[_0xcd9e('0x3f')][_0xcd9e('0x5c')]({'where':{'id':_0x1c29bd[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x449771,null))[_0xcd9e('0x23')](function(_0x1cef52){if(_0x1cef52){_0x1c29bd[_0xcd9e('0x58')]['OpnechannelAccountId']=_0x1cef52['id'];return db[_0xcd9e('0x60')][_0xcd9e('0x57')](_0x1c29bd[_0xcd9e('0x58')]);}})[_0xcd9e('0x23')](respondWithResult(_0x449771,null))[_0xcd9e('0x2c')](handleError(_0x449771,null));};exports[_0xcd9e('0x61')]=function(_0x551ed9,_0x10b528,_0x13b143){var _0x512ffa={'raw':![],'where':{}};var _0x187c17={};var _0x109708={'count':0x0,'rows':[]};return db[_0xcd9e('0x3f')][_0xcd9e('0x62')]({'where':{'id':_0x551ed9[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x10b528,null))[_0xcd9e('0x23')](function(_0x4ceae6){if(_0x4ceae6){_0x187c17['model']=_[_0xcd9e('0x43')](db[_0xcd9e('0x60')][_0xcd9e('0x63')]);_0x187c17[_0xcd9e('0x42')]=_['keys'](_0x551ed9[_0xcd9e('0x42')]);_0x187c17['filters']=_[_0xcd9e('0x45')](_0x187c17[_0xcd9e('0x41')],_0x187c17[_0xcd9e('0x42')]);_0x512ffa[_0xcd9e('0x46')]=_[_0xcd9e('0x45')](_0x187c17[_0xcd9e('0x41')],qs[_0xcd9e('0x47')](_0x551ed9[_0xcd9e('0x42')][_0xcd9e('0x47')]));_0x512ffa[_0xcd9e('0x46')]=_0x512ffa[_0xcd9e('0x46')][_0xcd9e('0x48')]?_0x512ffa[_0xcd9e('0x46')]:_0x187c17[_0xcd9e('0x41')];if(!_0x551ed9[_0xcd9e('0x42')][_0xcd9e('0x49')]('nolimit')){_0x512ffa[_0xcd9e('0x32')]=qs[_0xcd9e('0x32')](_0x551ed9['query'][_0xcd9e('0x32')]);_0x512ffa['offset']=qs[_0xcd9e('0x31')](_0x551ed9[_0xcd9e('0x42')][_0xcd9e('0x31')]);}_0x512ffa['order']=qs[_0xcd9e('0x4b')](_0x551ed9[_0xcd9e('0x42')]['sort']);_0x512ffa[_0xcd9e('0x4f')]=qs[_0xcd9e('0x44')](_[_0xcd9e('0x64')](_0x551ed9['query'],_0x187c17[_0xcd9e('0x44')]));_0x512ffa['where'][_0xcd9e('0x65')]=_0x4ceae6['id'];if(_0x551ed9[_0xcd9e('0x42')][_0xcd9e('0x4c')]){_0x512ffa['where']=_[_0xcd9e('0x4d')](_0x512ffa[_0xcd9e('0x4f')],{'$or':_[_0xcd9e('0x3e')](_0x512ffa[_0xcd9e('0x46')],function(_0x242dea){var _0x3fdb8b={};_0x3fdb8b[_0x242dea]={'$like':'%'+_0x551ed9[_0xcd9e('0x42')][_0xcd9e('0x4c')]+'%'};return _0x3fdb8b;})});}_0x512ffa=_[_0xcd9e('0x4d')]({},_0x512ffa,_0x551ed9[_0xcd9e('0x4e')]);return db['Disposition'][_0xcd9e('0x30')]({'where':_0x512ffa[_0xcd9e('0x4f')]})[_0xcd9e('0x23')](function(_0x29956b){_0x109708[_0xcd9e('0x30')]=_0x29956b;if(_0x551ed9[_0xcd9e('0x42')][_0xcd9e('0x50')]){_0x512ffa[_0xcd9e('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x512ffa);})[_0xcd9e('0x23')](function(_0x4c9734){_0x109708['rows']=_0x4c9734;return _0x109708;});}})[_0xcd9e('0x23')](respondWithFilteredResult(_0x10b528,_0x512ffa))[_0xcd9e('0x2c')](handleError(_0x10b528,null));};exports[_0xcd9e('0x66')]=function(_0x2b63a4,_0x2ea1b9,_0x342c4e){return db[_0xcd9e('0x3f')][_0xcd9e('0x5c')]({'where':{'id':_0x2b63a4['params']['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x2ea1b9,null))[_0xcd9e('0x23')](function(_0x18a1e9){if(_0x18a1e9){return _0x18a1e9[_0xcd9e('0x66')](_0x2b63a4[_0xcd9e('0x42')][_0xcd9e('0x67')]);}})[_0xcd9e('0x23')](respondWithStatusCode(_0x2ea1b9,null))['catch'](handleError(_0x2ea1b9,null));};exports[_0xcd9e('0x68')]=function(_0x1b8910,_0x57a6b0,_0x16b420){if(_0x1b8910[_0xcd9e('0x58')]['id']){delete _0x1b8910[_0xcd9e('0x58')]['id'];}return db['OpenchannelAccount'][_0xcd9e('0x5c')]({'where':{'id':_0x1b8910[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x57a6b0,null))[_0xcd9e('0x23')](function(_0x1f7ebc){if(_0x1f7ebc){_0x1b8910[_0xcd9e('0x58')][_0xcd9e('0x65')]=_0x1f7ebc['id'];return db[_0xcd9e('0x69')]['create'](_0x1b8910[_0xcd9e('0x58')]);}})[_0xcd9e('0x23')](respondWithResult(_0x57a6b0,null))[_0xcd9e('0x2c')](handleError(_0x57a6b0,null));};exports['getAnswers']=function(_0x2da66f,_0x17cffe,_0x1b06a8){var _0x16aa78={'raw':![],'where':{}};var _0x4e9c08={};var _0x53f6d3={'count':0x0,'rows':[]};return db[_0xcd9e('0x3f')][_0xcd9e('0x62')]({'where':{'id':_0x2da66f[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x17cffe,null))[_0xcd9e('0x23')](function(_0x3acd93){if(_0x3acd93){_0x4e9c08[_0xcd9e('0x41')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x4e9c08[_0xcd9e('0x42')]=_[_0xcd9e('0x43')](_0x2da66f[_0xcd9e('0x42')]);_0x4e9c08[_0xcd9e('0x44')]=_[_0xcd9e('0x45')](_0x4e9c08[_0xcd9e('0x41')],_0x4e9c08[_0xcd9e('0x42')]);_0x16aa78[_0xcd9e('0x46')]=_[_0xcd9e('0x45')](_0x4e9c08[_0xcd9e('0x41')],qs['fields'](_0x2da66f['query'][_0xcd9e('0x47')]));_0x16aa78['attributes']=_0x16aa78[_0xcd9e('0x46')][_0xcd9e('0x48')]?_0x16aa78[_0xcd9e('0x46')]:_0x4e9c08[_0xcd9e('0x41')];if(!_0x2da66f[_0xcd9e('0x42')][_0xcd9e('0x49')](_0xcd9e('0x4a'))){_0x16aa78[_0xcd9e('0x32')]=qs['limit'](_0x2da66f['query'][_0xcd9e('0x32')]);_0x16aa78[_0xcd9e('0x31')]=qs[_0xcd9e('0x31')](_0x2da66f[_0xcd9e('0x42')]['offset']);}_0x16aa78[_0xcd9e('0x6a')]=qs['sort'](_0x2da66f[_0xcd9e('0x42')][_0xcd9e('0x4b')]);_0x16aa78['where']=qs['filters'](_[_0xcd9e('0x64')](_0x2da66f[_0xcd9e('0x42')],_0x4e9c08[_0xcd9e('0x44')]));_0x16aa78[_0xcd9e('0x4f')][_0xcd9e('0x65')]=_0x3acd93['id'];if(_0x2da66f[_0xcd9e('0x42')][_0xcd9e('0x4c')]){_0x16aa78['where']=_['merge'](_0x16aa78[_0xcd9e('0x4f')],{'$or':_[_0xcd9e('0x3e')](_0x16aa78[_0xcd9e('0x46')],function(_0x336ea0){var _0x4314e1={};_0x4314e1[_0x336ea0]={'$like':'%'+_0x2da66f[_0xcd9e('0x42')][_0xcd9e('0x4c')]+'%'};return _0x4314e1;})});}_0x16aa78=_[_0xcd9e('0x4d')]({},_0x16aa78,_0x2da66f[_0xcd9e('0x4e')]);return db[_0xcd9e('0x69')][_0xcd9e('0x30')]({'where':_0x16aa78[_0xcd9e('0x4f')]})[_0xcd9e('0x23')](function(_0x418718){_0x53f6d3[_0xcd9e('0x30')]=_0x418718;if(_0x2da66f[_0xcd9e('0x42')]['includeAll']){_0x16aa78['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x16aa78);})[_0xcd9e('0x23')](function(_0x33c4d3){_0x53f6d3[_0xcd9e('0x53')]=_0x33c4d3;return _0x53f6d3;});}})[_0xcd9e('0x23')](respondWithFilteredResult(_0x17cffe,_0x16aa78))[_0xcd9e('0x2c')](handleError(_0x17cffe,null));};exports['removeAnswers']=function(_0x475033,_0x523a7f,_0x3972f6){return db['OpenchannelAccount'][_0xcd9e('0x5c')]({'where':{'id':_0x475033[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x523a7f,null))['then'](function(_0x130f1a){if(_0x130f1a){return _0x130f1a[_0xcd9e('0x6b')](_0x475033[_0xcd9e('0x42')][_0xcd9e('0x67')]);}})[_0xcd9e('0x23')](respondWithStatusCode(_0x523a7f,null))[_0xcd9e('0x2c')](handleError(_0x523a7f,null));};exports[_0xcd9e('0x6c')]=function(_0x49c6fd,_0x41efa3,_0x2f5410){var _0x10bfd1={'body':_0x49c6fd[_0xcd9e('0x58')],'channel':_0xcd9e('0x6d')};var _0x103f23=[];var _0x2661b3=[];var _0x36e5c4={};var _0x8aa8b=![];return db['CmContact'][_0xcd9e('0x5f')]()['then'](function(_0x3edab2){if(!_0x3edab2){throw new db[(_0xcd9e('0x21'))][(_0xcd9e('0x6e'))](_0xcd9e('0x6f'));}_0x103f23=_[_0xcd9e('0x70')](_[_0xcd9e('0x43')](_0x3edab2),[_0xcd9e('0x71'),_0xcd9e('0x72')]);_0x2661b3=_['difference'](_[_0xcd9e('0x43')](_0x3edab2),['createdAt','updatedAt',_0xcd9e('0x73'),_0xcd9e('0x74')]);if(_0x49c6fd['body']['id']){delete _0x49c6fd[_0xcd9e('0x58')]['id'];}if(_[_0xcd9e('0x75')](_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x76')])){throw new db[(_0xcd9e('0x21'))][(_0xcd9e('0x6e'))](_0xcd9e('0x77'));}if(_[_0xcd9e('0x75')](_0x49c6fd[_0xcd9e('0x58')]['body'])||_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x58')]===''){throw new db[(_0xcd9e('0x21'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x49c6fd['body']['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2661b3);}if(!_[_0xcd9e('0x78')](_0x2661b3,_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x79')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2661b3);}_0x36e5c4[_0x49c6fd[_0xcd9e('0x58')]['mapKey']]=_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x76')];})[_0xcd9e('0x23')](function(){return db[_0xcd9e('0x3f')][_0xcd9e('0x5c')]({'where':{'id':_0x49c6fd[_0xcd9e('0x55')]['id']},'include':[{'model':db[_0xcd9e('0x7a')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x36e5c4,'limit':0x1,'order':[[_0xcd9e('0x72'),'DESC']]}]},{'model':db[_0xcd9e('0x7b')],'as':_0xcd9e('0x7c')}]});})[_0xcd9e('0x23')](handleEntityNotFound(_0x41efa3,null))[_0xcd9e('0x23')](function(_0x135cc6){if(_0x135cc6&&_0x135cc6[_0xcd9e('0x7d')]){_0x10bfd1['account']=_0x135cc6;_0x10bfd1['applications']=_0x135cc6[_0xcd9e('0x7c')];_0x10bfd1[_0xcd9e('0x7e')]=_0x135cc6[_0xcd9e('0x7d')];_0x10bfd1[_0xcd9e('0x7f')]=_[_0xcd9e('0x80')](_0x10bfd1[_0xcd9e('0x7f')],[_0xcd9e('0x81')],[_0xcd9e('0x82')]);if(_0x10bfd1['account'][_0xcd9e('0x7c')]){delete _0x10bfd1[_0xcd9e('0x83')][_0xcd9e('0x7c')];}if(_0x10bfd1[_0xcd9e('0x83')][_0xcd9e('0x7d')]&&_0x10bfd1[_0xcd9e('0x83')]['List'][_0xcd9e('0x84')][_0xcd9e('0x48')]){return _0x10bfd1[_0xcd9e('0x83')][_0xcd9e('0x7d')][_0xcd9e('0x84')][0x0];}var _0x911c8=_[_0xcd9e('0x1b')](_0x49c6fd['body'],{'firstName':_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x76')],'ListId':_0x135cc6[_0xcd9e('0x74')]});_0x911c8[_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x79')]]=_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x76')];return db[_0xcd9e('0x85')][_0xcd9e('0x57')](_0x911c8,{'fields':_0x103f23,'raw':!![]});}})[_0xcd9e('0x23')](handleEntityNotFound(_0x41efa3,null))[_0xcd9e('0x23')](function(_0x221d60){_0x10bfd1[_0xcd9e('0x86')]=_0x221d60;if(_0x221d60){var _0x277176={'ContactId':_0x221d60['id'],'OpenchannelAccountId':_0x49c6fd['params']['id'],'from':(_0x221d60[_0xcd9e('0x87')]||'')+'\x20'+(_0x221d60['lastName']||'')};var _0x2e3d1e={'OpenchannelAccountId':_0x49c6fd[_0xcd9e('0x55')]['id'],'closed':![]};if(_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x88')]){_0x2e3d1e['threadId']=_0x49c6fd[_0xcd9e('0x58')]['threadId'];return db[_0xcd9e('0x89')][_0xcd9e('0x5c')]({'where':_0x2e3d1e})[_0xcd9e('0x23')](function(_0x597b63){if(_0x597b63){return[_0x597b63,![]];}_0x277176[_0xcd9e('0x88')]=_0x49c6fd['body'][_0xcd9e('0x88')];_0x277176[_0xcd9e('0x8a')]=_0x49c6fd['body'][_0xcd9e('0x8a')];return db[_0xcd9e('0x89')][_0xcd9e('0x57')](_0x277176)[_0xcd9e('0x23')](function(_0x5df205){return[_0x5df205,!![]];});});}else{_0x2e3d1e[_0xcd9e('0x88')]=null;}_0x2e3d1e['ContactId']=_0x221d60['id'];return db[_0xcd9e('0x89')][_0xcd9e('0x5c')]({'where':_0x2e3d1e})[_0xcd9e('0x23')](function(_0x1770d9){if(_0x1770d9){return[_0x1770d9,![]];}return db[_0xcd9e('0x89')][_0xcd9e('0x57')](_0x277176)[_0xcd9e('0x23')](function(_0xad8e1f){return[_0xad8e1f,!![]];});});}})[_0xcd9e('0x8b')](function(_0x20e742,_0x32f85a){if(_0x20e742){_0x8aa8b=_0x32f85a;if(!_0x32f85a){var _0x3c9261={'from':(_0x10bfd1[_0xcd9e('0x86')][_0xcd9e('0x87')]||'')+'\x20'+(_0x10bfd1[_0xcd9e('0x86')][_0xcd9e('0x8c')]||'')};if(_0x49c6fd['body'][_0xcd9e('0x88')]&&_0x49c6fd['body'][_0xcd9e('0x8d')]&&_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x88')]!=_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x8d')]){_0x3c9261['threadId']=_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x8d')];}return _0x20e742[_0xcd9e('0x36')](_0x3c9261);}else{return _0x20e742;}}})[_0xcd9e('0x23')](function(_0xbcadf5){_0x10bfd1[_0xcd9e('0x8e')]=_0xbcadf5['get']({'plain':!![]});_0x10bfd1[_0xcd9e('0x8e')]['created']=_0x8aa8b;if(_0x10bfd1['interaction'][_0xcd9e('0x8f')]){if(_0x10bfd1['account'][_0xcd9e('0x90')]){_0x10bfd1[_0xcd9e('0x7f')]['push']({'id':0x0,'priority':_0x10bfd1[_0xcd9e('0x7f')][_0xcd9e('0x48')]+0x1,'app':_0xcd9e('0x91'),'appdata':_0xcd9e('0x92'),'interval':_0xcd9e('0x93')});}}return db[_0xcd9e('0x94')][_0xcd9e('0x57')]({'body':_0x49c6fd['body'][_0xcd9e('0x58')],'OpenchannelAccountId':_0x49c6fd[_0xcd9e('0x55')]['id'],'OpenchannelInteractionId':_0xbcadf5['id'],'direction':'in','ContactId':_0x10bfd1[_0xcd9e('0x86')]['id'],'AttachmentId':_0x49c6fd[_0xcd9e('0x58')][_0xcd9e('0x95')]});})['then'](function(_0x27ca94){_0x10bfd1[_0xcd9e('0x29')]=_0x27ca94;if(_0x10bfd1[_0xcd9e('0x8e')][_0xcd9e('0x96')]){return db[_0xcd9e('0x97')][_0xcd9e('0x5c')]({'attributes':['id',_0xcd9e('0x3b')],'where':{'id':_0x10bfd1['interaction']['UserId']}})['then'](function(_0x287365){if(_0x287365){_0x10bfd1[_0xcd9e('0x7f')][_0xcd9e('0x98')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x287365[_0xcd9e('0x3b')]+','+(_0x10bfd1['account'][_0xcd9e('0x99')]||0xa),'interval':'*,*,*,*'});_0x10bfd1[_0xcd9e('0x9a')]=![];}return respondWithRpcPromise('Start',_0xcd9e('0x9b'),_0x10bfd1);});}return respondWithRpcPromise('Start','startRouting',_0x10bfd1);})[_0xcd9e('0x23')](function(_0x4e14fd){respondWithRpcPromise('EventManager','EventManager',{'event':_0xcd9e('0x6c'),'message':_0x4e14fd},client9002);return _0x4e14fd;})[_0xcd9e('0x23')](respondWithResult(_0x41efa3,null))['catch'](handleError(_0x41efa3,null));};exports[_0xcd9e('0x9c')]=function(_0x4ab065,_0x8d852e,_0x4d273a){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4ab065['params']['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x8d852e,null))['then'](function(_0x207267){if(_0x207267){return db['sequelize']['transaction'](function(_0x5133f5){return db[_0xcd9e('0x7b')][_0xcd9e('0x37')]({'where':{'OpenchannelAccountId':_0x4ab065[_0xcd9e('0x55')]['id']},'transaction':_0x5133f5})[_0xcd9e('0x23')](function(_0x202e44){var _0x2cc13b=_[_0xcd9e('0x3e')](_0x4ab065[_0xcd9e('0x58')],function(_0x2f638f){_0x2f638f[_0xcd9e('0x65')]=_0x4ab065[_0xcd9e('0x55')]['id'];return _0x2f638f;});return db['OpenchannelApplication'][_0xcd9e('0x9d')](_0x2cc13b,{'transaction':_0x5133f5});});})[_0xcd9e('0x23')](function(){return db[_0xcd9e('0x7b')][_0xcd9e('0x9e')]({'where':{'OpenchannelAccountId':_0x4ab065['params']['id']},'order':_0xcd9e('0x81')});});}})['then'](respondWithResult(_0x8d852e,null))[_0xcd9e('0x2c')](handleError(_0x8d852e,null));};exports[_0xcd9e('0x9f')]=function(_0x2687a3,_0x528774,_0x4800c1){var _0x35815c={};var _0x4c0cb1={};var _0xc4d7cf;var _0x40bc0c;return db[_0xcd9e('0x3f')][_0xcd9e('0x62')]({'where':{'id':_0x2687a3[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x528774,null))['then'](function(_0x2b3927){if(_0x2b3927){_0xc4d7cf=_0x2b3927;_0x4c0cb1[_0xcd9e('0x41')]=_[_0xcd9e('0x43')](db[_0xcd9e('0x7b')]['rawAttributes']);_0x4c0cb1[_0xcd9e('0x42')]=_[_0xcd9e('0x43')](_0x2687a3[_0xcd9e('0x42')]);_0x4c0cb1['filters']=_[_0xcd9e('0x45')](_0x4c0cb1[_0xcd9e('0x41')],_0x4c0cb1[_0xcd9e('0x42')]);_0x35815c['attributes']=_['intersection'](_0x4c0cb1[_0xcd9e('0x41')],qs['fields'](_0x2687a3[_0xcd9e('0x42')]['fields']));_0x35815c[_0xcd9e('0x46')]=_0x35815c['attributes'][_0xcd9e('0x48')]?_0x35815c['attributes']:_0x4c0cb1['model'];_0x35815c[_0xcd9e('0x6a')]=qs[_0xcd9e('0x4b')](_0x2687a3[_0xcd9e('0x42')][_0xcd9e('0x4b')]);_0x35815c[_0xcd9e('0x4f')]=qs['filters'](_[_0xcd9e('0x64')](_0x2687a3[_0xcd9e('0x42')],_0x4c0cb1[_0xcd9e('0x44')]));if(_0x2687a3[_0xcd9e('0x42')][_0xcd9e('0x4c')]){_0x35815c[_0xcd9e('0x4f')]=_['merge'](_0x35815c[_0xcd9e('0x4f')],{'$or':_[_0xcd9e('0x3e')](_0x35815c['attributes'],function(_0x44efce){var _0x1aad6e={};_0x1aad6e[_0x44efce]={'$like':'%'+_0x2687a3[_0xcd9e('0x42')][_0xcd9e('0x4c')]+'%'};return _0x1aad6e;})});}_0x35815c=_[_0xcd9e('0x4d')]({},_0x35815c,_0x2687a3[_0xcd9e('0x4e')]);return _0xc4d7cf[_0xcd9e('0x9f')](_0x35815c);}})[_0xcd9e('0x23')](function(_0x43dcb0){if(_0x43dcb0){_0x40bc0c=_0x43dcb0[_0xcd9e('0x48')];if(!_0x2687a3[_0xcd9e('0x42')]['hasOwnProperty'](_0xcd9e('0x4a'))){_0x35815c[_0xcd9e('0x32')]=qs[_0xcd9e('0x32')](_0x2687a3['query']['limit']);_0x35815c['offset']=qs[_0xcd9e('0x31')](_0x2687a3[_0xcd9e('0x42')]['offset']);}return _0xc4d7cf[_0xcd9e('0x9f')](_0x35815c);}})[_0xcd9e('0x23')](function(_0x26e827){if(_0x26e827){return _0x26e827?{'count':_0x40bc0c,'rows':_0x26e827}:null;}})[_0xcd9e('0x23')](respondWithResult(_0x528774,null))[_0xcd9e('0x2c')](handleError(_0x528774,null));};exports[_0xcd9e('0xa0')]=function(_0x4b3fb5,_0x1f4bac,_0x461038){var _0x143dd8={'raw':![],'where':{}};var _0x1d26d4={};var _0x59e653={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcd9e('0x62')]({'where':{'id':_0x4b3fb5['params']['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x1f4bac,null))[_0xcd9e('0x23')](function(_0x1a7d91){if(_0x1a7d91){_0x1d26d4[_0xcd9e('0x41')]=_[_0xcd9e('0x43')](db[_0xcd9e('0x89')][_0xcd9e('0x63')]);_0x1d26d4['query']=_[_0xcd9e('0x43')](_0x4b3fb5[_0xcd9e('0x42')]);_0x1d26d4['filters']=_[_0xcd9e('0x45')](_0x1d26d4['model'],_0x1d26d4[_0xcd9e('0x42')]);_0x143dd8[_0xcd9e('0x46')]=_[_0xcd9e('0x45')](_0x1d26d4[_0xcd9e('0x41')],qs[_0xcd9e('0x47')](_0x4b3fb5['query'][_0xcd9e('0x47')]));_0x143dd8['attributes']=_0x143dd8[_0xcd9e('0x46')]['length']?_0x143dd8['attributes']:_0x1d26d4[_0xcd9e('0x41')];if(!_0x4b3fb5['query']['hasOwnProperty']('nolimit')){_0x143dd8[_0xcd9e('0x32')]=qs[_0xcd9e('0x32')](_0x4b3fb5[_0xcd9e('0x42')]['limit']);_0x143dd8[_0xcd9e('0x31')]=qs[_0xcd9e('0x31')](_0x4b3fb5['query'][_0xcd9e('0x31')]);}_0x143dd8['order']=qs[_0xcd9e('0x4b')](_0x4b3fb5['query']['sort']);_0x143dd8['where']=qs[_0xcd9e('0x44')](_[_0xcd9e('0x64')](_0x4b3fb5['query'],_0x1d26d4[_0xcd9e('0x44')]));_0x143dd8['where'][_0xcd9e('0x65')]=_0x1a7d91['id'];if(_0x4b3fb5[_0xcd9e('0x42')][_0xcd9e('0x4c')]){_0x143dd8[_0xcd9e('0x4f')]=_[_0xcd9e('0x4d')](_0x143dd8['where'],{'$or':_[_0xcd9e('0x3e')](_0x143dd8[_0xcd9e('0x46')],function(_0x10470e){var _0x2207b2={};_0x2207b2[_0x10470e]={'$like':'%'+_0x4b3fb5[_0xcd9e('0x42')][_0xcd9e('0x4c')]+'%'};return _0x2207b2;})});}_0x143dd8=_[_0xcd9e('0x4d')]({},_0x143dd8,_0x4b3fb5[_0xcd9e('0x4e')]);return db['OpenchannelInteraction'][_0xcd9e('0x30')]({'where':_0x143dd8[_0xcd9e('0x4f')]})[_0xcd9e('0x23')](function(_0x2dd79f){_0x59e653[_0xcd9e('0x30')]=_0x2dd79f;if(_0x4b3fb5['query'][_0xcd9e('0x50')]){_0x143dd8['include']=[{'model':db[_0xcd9e('0x85')],'as':_0xcd9e('0xa1'),'required':![]},{'model':db[_0xcd9e('0x97')],'as':'Owner','attributes':[_0xcd9e('0x3b'),_0xcd9e('0xa2'),_0xcd9e('0xa3')],'required':![]},{'model':db[_0xcd9e('0xa4')],'as':_0xcd9e('0xa5'),'attributes':['id','name',_0xcd9e('0xa6')],'where':_0x4b3fb5[_0xcd9e('0x42')][_0xcd9e('0xa7')]?{'id':_0x4b3fb5[_0xcd9e('0x42')][_0xcd9e('0xa7')]}:undefined,'required':_0x4b3fb5['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xcd9e('0x52')](_0x143dd8);})[_0xcd9e('0x23')](function(_0x384ee8){_0x59e653[_0xcd9e('0x53')]=_0x384ee8;return _0x59e653;});}})[_0xcd9e('0x23')](respondWithFilteredResult(_0x1f4bac,_0x143dd8))['catch'](handleError(_0x1f4bac,null));};exports[_0xcd9e('0xa8')]=function(_0x98d634,_0x255a93,_0x44d8b4){return db[_0xcd9e('0x3f')][_0xcd9e('0x5c')]({'where':{'id':_0x98d634['params']['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x255a93,null))[_0xcd9e('0x23')](function(_0x959d06){if(_0x959d06){return _0x959d06[_0xcd9e('0xa8')](_0x98d634[_0xcd9e('0x58')][_0xcd9e('0x67')],_[_0xcd9e('0xa9')](_0x98d634[_0xcd9e('0x58')],[_0xcd9e('0x67'),'id'])||{})[_0xcd9e('0x8b')](function(_0x3108a9){for(var _0xec265e=0x0;_0xec265e<_0x98d634[_0xcd9e('0x58')][_0xcd9e('0x67')]['length'];_0xec265e+=0x1){socket[_0xcd9e('0xaa')](_0xcd9e('0xab'),{'UserId':_0x98d634['body'][_0xcd9e('0x67')][_0xec265e],'OpenchannelAccountId':_0x98d634[_0xcd9e('0x55')]['id']});}return _0x3108a9;});}})[_0xcd9e('0x23')](respondWithResult(_0x255a93,null))[_0xcd9e('0x2c')](handleError(_0x255a93,null));};exports[_0xcd9e('0xac')]=function(_0x118b61,_0x422e3c,_0x5bd77c){return db[_0xcd9e('0x3f')]['find']({'where':{'id':_0x118b61['params']['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x422e3c,null))[_0xcd9e('0x23')](function(_0x2ddad0){if(_0x2ddad0){return _0x2ddad0['removeAgents'](_0x118b61[_0xcd9e('0x42')][_0xcd9e('0x67')])['then'](function(){if(_[_0xcd9e('0xad')](_0x118b61[_0xcd9e('0x42')][_0xcd9e('0x67')])){for(var _0xe7abd2=0x0;_0xe7abd2<_0x118b61['query'][_0xcd9e('0x67')][_0xcd9e('0x48')];_0xe7abd2+=0x1){socket[_0xcd9e('0xaa')](_0xcd9e('0xae'),{'UserId':Number(_0x118b61['query']['ids'][_0xe7abd2]),'OpenchannelAccountId':Number(_0x118b61[_0xcd9e('0x55')]['id'])});}}else{socket['emit'](_0xcd9e('0xae'),{'UserId':Number(_0x118b61['query'][_0xcd9e('0x67')]),'OpenchannelAccountId':Number(_0x118b61[_0xcd9e('0x55')]['id'])});}});}})[_0xcd9e('0x23')](respondWithStatusCode(_0x422e3c,null))['catch'](handleError(_0x422e3c,null));};exports[_0xcd9e('0xaf')]=function(_0x3cdff2,_0x5af880,_0x319069){var _0x1eb4fb={};var _0x3f5b37={};var _0x189510;var _0x417a91;return db[_0xcd9e('0x3f')]['findOne']({'where':{'id':_0x3cdff2[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x5af880,null))[_0xcd9e('0x23')](function(_0x1b6654){if(_0x1b6654){_0x189510=_0x1b6654;_0x3f5b37['model']=_[_0xcd9e('0x43')](db['User'][_0xcd9e('0x63')]);_0x3f5b37[_0xcd9e('0x42')]=_[_0xcd9e('0x43')](_0x3cdff2[_0xcd9e('0x42')]);_0x3f5b37['filters']=_[_0xcd9e('0x45')](_0x3f5b37[_0xcd9e('0x41')],_0x3f5b37[_0xcd9e('0x42')]);_0x1eb4fb[_0xcd9e('0x46')]=_[_0xcd9e('0x45')](_0x3f5b37[_0xcd9e('0x41')],qs[_0xcd9e('0x47')](_0x3cdff2[_0xcd9e('0x42')]['fields']));_0x1eb4fb[_0xcd9e('0x46')]=_0x1eb4fb[_0xcd9e('0x46')][_0xcd9e('0x48')]?_0x1eb4fb[_0xcd9e('0x46')]:_0x3f5b37[_0xcd9e('0x41')];_0x1eb4fb[_0xcd9e('0x6a')]=qs[_0xcd9e('0x4b')](_0x3cdff2[_0xcd9e('0x42')][_0xcd9e('0x4b')]);_0x1eb4fb[_0xcd9e('0x4f')]=qs[_0xcd9e('0x44')](_[_0xcd9e('0x64')](_0x3cdff2[_0xcd9e('0x42')],_0x3f5b37['filters']));if(_0x3cdff2[_0xcd9e('0x42')][_0xcd9e('0x4c')]){_0x1eb4fb[_0xcd9e('0x4f')]=_[_0xcd9e('0x4d')](_0x1eb4fb[_0xcd9e('0x4f')],{'$or':_[_0xcd9e('0x3e')](_0x1eb4fb['attributes'],function(_0x2f5a85){var _0x9520f0={};_0x9520f0[_0x2f5a85]={'$like':'%'+_0x3cdff2[_0xcd9e('0x42')][_0xcd9e('0x4c')]+'%'};return _0x9520f0;})});}_0x1eb4fb=_[_0xcd9e('0x4d')]({},_0x1eb4fb,_0x3cdff2[_0xcd9e('0x4e')]);return _0x189510['getAgents'](_0x1eb4fb);}})[_0xcd9e('0x23')](function(_0x2f6bf6){if(_0x2f6bf6){_0x417a91=_0x2f6bf6[_0xcd9e('0x48')];if(!_0x3cdff2[_0xcd9e('0x42')][_0xcd9e('0x49')](_0xcd9e('0x4a'))){_0x1eb4fb[_0xcd9e('0x32')]=qs[_0xcd9e('0x32')](_0x3cdff2[_0xcd9e('0x42')][_0xcd9e('0x32')]);_0x1eb4fb[_0xcd9e('0x31')]=qs['offset'](_0x3cdff2['query'][_0xcd9e('0x31')]);}return _0x189510['getAgents'](_0x1eb4fb);}})['then'](function(_0x128db8){if(_0x128db8){return _0x128db8?{'count':_0x417a91,'rows':_0x128db8}:null;}})['then'](respondWithResult(_0x5af880,null))['catch'](handleError(_0x5af880,null));};exports['send']=function(_0xfa74ee,_0x274c1d,_0x34c5e2){var _0x5e355a,_0x5d9db8,_0x40f91d;if(_[_0xcd9e('0x75')](_0xfa74ee['body'][_0xcd9e('0x58')])||_0xfa74ee[_0xcd9e('0x58')][_0xcd9e('0x58')]===''){throw new db[(_0xcd9e('0x21'))]['ValidationError'](_0xcd9e('0xb0'));}if(_[_0xcd9e('0x75')](_0xfa74ee['body']['to'])){}_0x5e355a=_0xfa74ee[_0xcd9e('0x58')]['to'];return db['OpenchannelAccount'][_0xcd9e('0x62')]({'where':{'id':_0xfa74ee[_0xcd9e('0x55')]['id']}})[_0xcd9e('0x23')](handleEntityNotFound(_0x274c1d,null))['then'](function(_0x5e7f63){if(_0x5e7f63){return db['OpenchannelAccount'][_0xcd9e('0x5c')]({'where':{'id':_0x5e7f63['id']},'include':[{'model':db['CmList'],'as':_0xcd9e('0x7d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x5e7f63[_0xcd9e('0x79')]]:_0x5e355a},'limit':0x1,'order':[[_0xcd9e('0x72'),'DESC']]}]}]})[_0xcd9e('0x23')](handleEntityNotFound(_0x274c1d,null))[_0xcd9e('0x23')](function(_0x9caa2){if(_0x9caa2&&_0x9caa2[_0xcd9e('0x7d')]){_0x5d9db8=_0x9caa2['get']({'plain':!![]});if(_0x5d9db8['List']&&_0x5d9db8[_0xcd9e('0x7d')][_0xcd9e('0x84')][_0xcd9e('0x48')]){return _0x5d9db8[_0xcd9e('0x7d')][_0xcd9e('0x84')][0x0];}return db[_0xcd9e('0x85')][_0xcd9e('0x57')](_[_0xcd9e('0x1b')](_0xfa74ee[_0xcd9e('0x58')],{'firstName':_0x5e355a,[_0x9caa2[_0xcd9e('0x79')]]:_0x5e355a,'phone':_0x5e355a,'ListId':_0x5d9db8['ListId']}));}})[_0xcd9e('0x23')](handleEntityNotFound(_0x274c1d,null))['then'](function(_0x3aff80){if(_0x3aff80){_0x40f91d=_0x3aff80;return db[_0xcd9e('0x89')][_0xcd9e('0x5c')]({'where':{'ContactId':_0x40f91d['id'],'closed':![],'OpenchannelAccountId':_0x5d9db8['id']}})[_0xcd9e('0x23')](function(_0x57e946){if(_0x57e946){return[_0x57e946,![]];}return db[_0xcd9e('0x89')][_0xcd9e('0x57')]({'UserId':_0xfa74ee[_0xcd9e('0x59')]['id'],'ContactId':_0x40f91d['id'],'OpenchannelAccountId':_0x5d9db8['id'],'lastMsgDirection':'out','Messages':[_[_0xcd9e('0x4d')](_0xfa74ee[_0xcd9e('0x58')],{'read':![],'body':_0xfa74ee['body'][_0xcd9e('0x58')],'OpenchannelAccountId':_0x5d9db8['id'],'UserId':_0xfa74ee[_0xcd9e('0x59')]['id'],'ContactId':_0x40f91d['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xcd9e('0x23')](function(_0xbeb35d){return[_0xbeb35d,!![]];});});}})[_0xcd9e('0x8b')](function(_0x5d8f88,_0x537dca){if(_0x537dca){return _0x5d8f88;}return db[_0xcd9e('0x94')][_0xcd9e('0x57')](_[_0xcd9e('0x4d')](_0xfa74ee[_0xcd9e('0x58')],{'read':![],'body':_0xfa74ee[_0xcd9e('0x58')][_0xcd9e('0x58')],'OpenchannelAccountId':_0x5d9db8['id'],'OpenchannelInteractionId':_0x5d8f88['id'],'UserId':_0xfa74ee[_0xcd9e('0x59')]['id'],'ContactId':_0x40f91d['id']}))[_0xcd9e('0x23')](function(_0x42e844){_0x5d8f88[_0xcd9e('0xb1')]['Messages']=[];_0x5d8f88[_0xcd9e('0xb1')]['Messages'][_0xcd9e('0xb2')](_0x42e844['dataValues']);return _0x5d8f88;});});}})[_0xcd9e('0x23')](respondWithResult(_0x274c1d,null))[_0xcd9e('0x2c')](handleError(_0x274c1d,null));}; \ No newline at end of file +var _0xf7ba=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','Applications','account','applications','priority','ListId','contact','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','firstName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','forcedOwnership','Start','startRouting','EventManager','findOne','transaction','OpenchannelApplication','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','status','json','count','offset','set','apply','save','update','OpenchannelAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','nolimit','filter','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','hasOwnProperty','options','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from'];(function(_0x265e07,_0x3ee166){var _0x47017a=function(_0x142cbd){while(--_0x142cbd){_0x265e07['push'](_0x265e07['shift']());}};_0x47017a(++_0x3ee166);}(_0xf7ba,0x1ac));var _0xaf7b=function(_0x3fb4e7,_0x57a246){_0x3fb4e7=_0x3fb4e7-0x0;var _0x84f75e=_0xf7ba[_0x3fb4e7];return _0x84f75e;};'use strict';var pdf=require(_0xaf7b('0x0'));var emlformat=require(_0xaf7b('0x1'));var rimraf=require(_0xaf7b('0x2'));var zipdir=require(_0xaf7b('0x3'));var jsonpatch=require(_0xaf7b('0x4'));var rp=require(_0xaf7b('0x5'));var moment=require('moment');var BPromise=require(_0xaf7b('0x6'));var Mustache=require(_0xaf7b('0x7'));var util=require(_0xaf7b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xaf7b('0x9'));var ejs=require(_0xaf7b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf7b('0xb'));var crypto=require(_0xaf7b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf7b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaf7b('0xe'));var Papa=require('papaparse');var Redis=require(_0xaf7b('0xf'));var authService=require(_0xaf7b('0x10'));var qs=require(_0xaf7b('0x11'));var as=require(_0xaf7b('0x12'));var hardwareService=require(_0xaf7b('0x13'));var logger=require(_0xaf7b('0x14'))(_0xaf7b('0x15'));var utils=require(_0xaf7b('0x16'));var config=require(_0xaf7b('0x17'));var db=require(_0xaf7b('0x18'))['db'];config[_0xaf7b('0x19')]=_[_0xaf7b('0x1a')](config[_0xaf7b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf7b('0x1b'))(new Redis(config[_0xaf7b('0x19')]));require('./openchannelAccount.socket')[_0xaf7b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaf7b('0x1d')][_0xaf7b('0x1e')]({'port':0x232c});var client9002=jayson[_0xaf7b('0x1d')][_0xaf7b('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x531503,_0x29d874,_0x33f8c8){if(_0x33f8c8){var _0x59e7b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59e7b1[_0xaf7b('0x1f')](_0x29d874)){return _0x531503;}else{throw new db[(_0xaf7b('0x20'))][(_0xaf7b('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x531503;}}function respondWithRpcPromise(_0x36ce98,_0x21756d,_0xc9f07a,_0x275199){return new BPromise(function(_0x549880,_0x21674d){var _0x347452=_0x275199||client;return _0x347452['request'](_0x36ce98,_0xc9f07a)[_0xaf7b('0x22')](function(_0x41758a){logger['info'](_0xaf7b('0x23'),_0x21756d,_0xaf7b('0x24'));logger[_0xaf7b('0x25')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x21756d,_0xaf7b('0x24'),JSON[_0xaf7b('0x26')](_0x41758a));if(_0x41758a['error']){if(_0x41758a['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x21756d,_0x41758a[_0xaf7b('0x27')][_0xaf7b('0x28')]);return _0x21674d(_0x41758a[_0xaf7b('0x27')][_0xaf7b('0x28')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x21756d,_0x41758a['error']['message']);return _0x549880(_0x41758a[_0xaf7b('0x27')]['message']);}else{logger[_0xaf7b('0x29')](_0xaf7b('0x23'),_0x21756d,_0xaf7b('0x24'));_0x549880(_0x41758a['result'][_0xaf7b('0x28')]);}})[_0xaf7b('0x2a')](function(_0x1bb2ec){logger['error'](_0xaf7b('0x23'),_0x21756d,_0x1bb2ec);_0x21674d(_0x1bb2ec);});});}function respondWithStatusCode(_0x24292e,_0x10d18c){_0x10d18c=_0x10d18c||0xcc;return function(_0x353f13){if(_0x353f13){return _0x24292e['sendStatus'](_0x10d18c);}return _0x24292e[_0xaf7b('0x2b')](_0x10d18c)['end']();};}function respondWithResult(_0x450b82,_0x88a46d){_0x88a46d=_0x88a46d||0xc8;return function(_0x117f18){if(_0x117f18){return _0x450b82[_0xaf7b('0x2b')](_0x88a46d)[_0xaf7b('0x2c')](_0x117f18);}};}function respondWithFilteredResult(_0xe0273a,_0x36a794){return function(_0x1954fe){if(_0x1954fe){var _0x31249a=_0x1954fe[_0xaf7b('0x2d')],_0x365062=_0x36a794[_0xaf7b('0x2e')],_0x4bccce=_0x36a794['offset']+_0x36a794['limit'],_0x490f4d;if(_0x4bccce>=_0x31249a){_0x4bccce=_0x31249a;_0x490f4d=0xc8;}else{_0x490f4d=0xce;}_0xe0273a[_0xaf7b('0x2b')](_0x490f4d);return _0xe0273a[_0xaf7b('0x2f')]('Content-Range',_0x365062+'-'+_0x4bccce+'/'+_0x31249a)[_0xaf7b('0x2c')](_0x1954fe);}return null;};}function patchUpdates(_0x2e432b){return function(_0x4ba9ef){try{jsonpatch[_0xaf7b('0x30')](_0x4ba9ef,_0x2e432b,!![]);}catch(_0x51efee){return BPromise['reject'](_0x51efee);}return _0x4ba9ef[_0xaf7b('0x31')]();};}function saveUpdates(_0x4d5190,_0x4cb48d){return function(_0x4a96fa){if(_0x4a96fa){return _0x4a96fa[_0xaf7b('0x32')](_0x4d5190)[_0xaf7b('0x22')](function(_0x530baf){return _0x530baf;});}return null;};}function removeEntity(_0x315331,_0x5c1b47){return function(_0x312c56){if(_0x312c56){return _0x312c56['destroy']()['then'](function(){var _0x589a8e=_0x312c56['get']({'plain':!![]});var _0x16d051=_0xaf7b('0x33');return db[_0xaf7b('0x34')][_0xaf7b('0x35')]({'where':{'type':_0x16d051,'resourceId':_0x589a8e['id']}})[_0xaf7b('0x22')](function(){return _0x312c56;});})[_0xaf7b('0x22')](function(){_0x315331['status'](0xcc)[_0xaf7b('0x36')]();});}};}function handleEntityNotFound(_0x4fe373,_0x4e6d5e){return function(_0x405aed){if(!_0x405aed){_0x4fe373[_0xaf7b('0x37')](0x194);}return _0x405aed;};}function handleError(_0x1f1b5c,_0x57fd50){_0x57fd50=_0x57fd50||0x1f4;return function(_0x209fdb){logger[_0xaf7b('0x27')](_0x209fdb[_0xaf7b('0x38')]);if(_0x209fdb['name']){delete _0x209fdb[_0xaf7b('0x39')];}_0x1f1b5c[_0xaf7b('0x2b')](_0x57fd50)[_0xaf7b('0x3a')](_0x209fdb);};}exports[_0xaf7b('0x3b')]=function(_0x1b3ca8,_0x15b545){var _0x6b3c41={'include':[{'model':db[_0xaf7b('0x3c')],'as':_0xaf7b('0x3d')}]},_0x2df4bb={},_0x2d6761={'count':0x0,'rows':[]};var _0x4037be=_[_0xaf7b('0x3e')](db[_0xaf7b('0x3f')][_0xaf7b('0x40')],function(_0x3e523d){return{'name':_0x3e523d['fieldName'],'type':_0x3e523d['type'][_0xaf7b('0x41')]};});_0x2df4bb[_0xaf7b('0x42')]=_[_0xaf7b('0x3e')](_0x4037be,_0xaf7b('0x39'));_0x2df4bb[_0xaf7b('0x43')]=_[_0xaf7b('0x44')](_0x1b3ca8[_0xaf7b('0x43')]);_0x2df4bb[_0xaf7b('0x45')]=_[_0xaf7b('0x46')](_0x2df4bb[_0xaf7b('0x42')],_0x2df4bb[_0xaf7b('0x43')]);_0x6b3c41[_0xaf7b('0x47')]=_[_0xaf7b('0x46')](_0x2df4bb[_0xaf7b('0x42')],qs[_0xaf7b('0x48')](_0x1b3ca8[_0xaf7b('0x43')][_0xaf7b('0x48')]));_0x6b3c41['attributes']=_0x6b3c41[_0xaf7b('0x47')]['length']?_0x6b3c41[_0xaf7b('0x47')]:_0x2df4bb[_0xaf7b('0x42')];if(!_0x1b3ca8[_0xaf7b('0x43')]['hasOwnProperty']('nolimit')){_0x6b3c41[_0xaf7b('0x49')]=qs[_0xaf7b('0x49')](_0x1b3ca8[_0xaf7b('0x43')][_0xaf7b('0x49')]);_0x6b3c41['offset']=qs['offset'](_0x1b3ca8[_0xaf7b('0x43')][_0xaf7b('0x2e')]);}_0x6b3c41[_0xaf7b('0x4a')]=qs[_0xaf7b('0x4b')](_0x1b3ca8[_0xaf7b('0x43')]['sort']);_0x6b3c41[_0xaf7b('0x4c')]=qs[_0xaf7b('0x45')](_[_0xaf7b('0x4d')](_0x1b3ca8['query'],_0x2df4bb[_0xaf7b('0x45')]),_0x4037be);if(_0x1b3ca8[_0xaf7b('0x43')]['filter']){_0x6b3c41['where']=_[_0xaf7b('0x4e')](_0x6b3c41['where'],{'$or':_[_0xaf7b('0x3e')](_0x4037be,function(_0x351d98){if(_0x351d98[_0xaf7b('0x4f')]!==_0xaf7b('0x50')){var _0x2faf47={};_0x2faf47[_0x351d98['name']]={'$like':'%'+_0x1b3ca8[_0xaf7b('0x43')]['filter']+'%'};return _0x2faf47;}})});}_0x6b3c41=_[_0xaf7b('0x4e')]({},_0x6b3c41,_0x1b3ca8['options']);var _0x4f60cf={'where':_0x6b3c41['where']};return db[_0xaf7b('0x3f')]['count'](_0x4f60cf)[_0xaf7b('0x22')](function(_0x5760fd){_0x2d6761[_0xaf7b('0x2d')]=_0x5760fd;if(_0x1b3ca8[_0xaf7b('0x43')][_0xaf7b('0x51')]){_0x6b3c41[_0xaf7b('0x52')]=[{'all':!![]}];}return db[_0xaf7b('0x3f')][_0xaf7b('0x53')](_0x6b3c41);})[_0xaf7b('0x22')](function(_0x956aef){_0x2d6761[_0xaf7b('0x54')]=_0x956aef;return _0x2d6761;})['then'](respondWithFilteredResult(_0x15b545,_0x6b3c41))[_0xaf7b('0x2a')](handleError(_0x15b545,null));};exports[_0xaf7b('0x55')]=function(_0x5c78f9,_0x295ea9){var _0x5d0f2e={'raw':![],'where':{'id':_0x5c78f9[_0xaf7b('0x56')]['id']},'include':[{'model':db[_0xaf7b('0x3c')],'as':'mandatoryDispositionPause'}]},_0xa7df1f={};_0xa7df1f[_0xaf7b('0x42')]=_['keys'](db[_0xaf7b('0x3f')][_0xaf7b('0x40')]);_0xa7df1f[_0xaf7b('0x43')]=_[_0xaf7b('0x44')](_0x5c78f9[_0xaf7b('0x43')]);_0xa7df1f[_0xaf7b('0x45')]=_[_0xaf7b('0x46')](_0xa7df1f[_0xaf7b('0x42')],_0xa7df1f['query']);_0x5d0f2e[_0xaf7b('0x47')]=_[_0xaf7b('0x46')](_0xa7df1f[_0xaf7b('0x42')],qs[_0xaf7b('0x48')](_0x5c78f9[_0xaf7b('0x43')][_0xaf7b('0x48')]));_0x5d0f2e[_0xaf7b('0x47')]=_0x5d0f2e[_0xaf7b('0x47')][_0xaf7b('0x57')]?_0x5d0f2e['attributes']:_0xa7df1f['model'];if(_0x5c78f9[_0xaf7b('0x43')][_0xaf7b('0x51')]){_0x5d0f2e[_0xaf7b('0x52')]=[{'all':!![]}];}_0x5d0f2e=_[_0xaf7b('0x4e')]({},_0x5d0f2e,_0x5c78f9['options']);return db[_0xaf7b('0x3f')][_0xaf7b('0x58')](_0x5d0f2e)[_0xaf7b('0x22')](handleEntityNotFound(_0x295ea9,null))['then'](respondWithResult(_0x295ea9,null))[_0xaf7b('0x2a')](handleError(_0x295ea9,null));};exports[_0xaf7b('0x59')]=function(_0x1a5187,_0x579c93){return db[_0xaf7b('0x3f')]['create'](_0x1a5187[_0xaf7b('0x5a')],{})['then'](function(_0x44bbe5){var _0xb138ef=_0x1a5187[_0xaf7b('0x5b')]['get']({'plain':!![]});if(!_0xb138ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb138ef[_0xaf7b('0x5c')]===_0xaf7b('0x5b')){var _0x3e06f9=_0x44bbe5[_0xaf7b('0x5d')]({'plain':!![]});var _0x28af39=_0xaf7b('0x33');return db[_0xaf7b('0x5e')]['find']({'where':{'name':_0x28af39,'userProfileId':_0xb138ef[_0xaf7b('0x5f')]},'raw':!![]})[_0xaf7b('0x22')](function(_0x5daecb){if(_0x5daecb&&_0x5daecb[_0xaf7b('0x60')]===0x0){return db[_0xaf7b('0x34')]['create']({'name':_0x3e06f9[_0xaf7b('0x39')],'resourceId':_0x3e06f9['id'],'type':_0x5daecb[_0xaf7b('0x39')],'sectionId':_0x5daecb['id']},{})[_0xaf7b('0x22')](function(){return _0x44bbe5;});}else{return _0x44bbe5;}})[_0xaf7b('0x2a')](function(_0x24fc11){logger[_0xaf7b('0x27')](_0xaf7b('0x61'),_0x24fc11);throw _0x24fc11;});}return _0x44bbe5;})['then'](respondWithResult(_0x579c93,0xc9))['catch'](handleError(_0x579c93,null));};exports[_0xaf7b('0x32')]=function(_0x3b2d06,_0x354629){if(_0x3b2d06['body']['id']){delete _0x3b2d06[_0xaf7b('0x5a')]['id'];}return db[_0xaf7b('0x3f')][_0xaf7b('0x58')]({'where':{'id':_0x3b2d06['params']['id']},'include':[{'model':db[_0xaf7b('0x3c')],'as':_0xaf7b('0x3d')}]})[_0xaf7b('0x22')](handleEntityNotFound(_0x354629,null))[_0xaf7b('0x22')](saveUpdates(_0x3b2d06[_0xaf7b('0x5a')],null))['then'](respondWithResult(_0x354629,null))[_0xaf7b('0x2a')](handleError(_0x354629,null));};exports[_0xaf7b('0x35')]=function(_0x8c6367,_0x484c86){return db[_0xaf7b('0x3f')][_0xaf7b('0x58')]({'where':{'id':_0x8c6367[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x484c86,null))[_0xaf7b('0x22')](removeEntity(_0x484c86,null))[_0xaf7b('0x2a')](handleError(_0x484c86,null));};exports['describe']=function(_0x5b9a8f,_0x414333){return db[_0xaf7b('0x3f')][_0xaf7b('0x62')]()[_0xaf7b('0x22')](respondWithResult(_0x414333,null))['catch'](handleError(_0x414333,null));};exports[_0xaf7b('0x63')]=function(_0x1ff3c1,_0x567a79,_0x198df4){if(_0x1ff3c1[_0xaf7b('0x5a')]['id']){delete _0x1ff3c1['body']['id'];}return db[_0xaf7b('0x3f')][_0xaf7b('0x58')]({'where':{'id':_0x1ff3c1[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x567a79,null))[_0xaf7b('0x22')](function(_0x4c87fc){if(_0x4c87fc){_0x1ff3c1[_0xaf7b('0x5a')][_0xaf7b('0x64')]=_0x4c87fc['id'];return db[_0xaf7b('0x65')][_0xaf7b('0x59')](_0x1ff3c1['body']);}})['then'](respondWithResult(_0x567a79,null))[_0xaf7b('0x2a')](handleError(_0x567a79,null));};exports[_0xaf7b('0x66')]=function(_0x29f5a6,_0x5c8cf8,_0x452a75){var _0x3c10f7={'raw':![],'where':{}};var _0x5518ee={};var _0x1100af={'count':0x0,'rows':[]};return db[_0xaf7b('0x3f')]['findOne']({'where':{'id':_0x29f5a6[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x5c8cf8,null))['then'](function(_0x47ac4b){if(_0x47ac4b){_0x5518ee['model']=_[_0xaf7b('0x44')](db['Disposition'][_0xaf7b('0x40')]);_0x5518ee[_0xaf7b('0x43')]=_[_0xaf7b('0x44')](_0x29f5a6[_0xaf7b('0x43')]);_0x5518ee[_0xaf7b('0x45')]=_[_0xaf7b('0x46')](_0x5518ee['model'],_0x5518ee[_0xaf7b('0x43')]);_0x3c10f7[_0xaf7b('0x47')]=_[_0xaf7b('0x46')](_0x5518ee['model'],qs[_0xaf7b('0x48')](_0x29f5a6['query']['fields']));_0x3c10f7[_0xaf7b('0x47')]=_0x3c10f7['attributes']['length']?_0x3c10f7[_0xaf7b('0x47')]:_0x5518ee[_0xaf7b('0x42')];if(!_0x29f5a6[_0xaf7b('0x43')]['hasOwnProperty'](_0xaf7b('0x67'))){_0x3c10f7[_0xaf7b('0x49')]=qs['limit'](_0x29f5a6[_0xaf7b('0x43')][_0xaf7b('0x49')]);_0x3c10f7[_0xaf7b('0x2e')]=qs[_0xaf7b('0x2e')](_0x29f5a6[_0xaf7b('0x43')][_0xaf7b('0x2e')]);}_0x3c10f7[_0xaf7b('0x4a')]=qs[_0xaf7b('0x4b')](_0x29f5a6['query'][_0xaf7b('0x4b')]);_0x3c10f7[_0xaf7b('0x4c')]=qs[_0xaf7b('0x45')](_['pick'](_0x29f5a6[_0xaf7b('0x43')],_0x5518ee[_0xaf7b('0x45')]));_0x3c10f7[_0xaf7b('0x4c')]['OpenchannelAccountId']=_0x47ac4b['id'];if(_0x29f5a6['query'][_0xaf7b('0x68')]){_0x3c10f7['where']=_[_0xaf7b('0x4e')](_0x3c10f7[_0xaf7b('0x4c')],{'$or':_[_0xaf7b('0x3e')](_0x3c10f7['attributes'],function(_0x927220){var _0x7fb3c2={};_0x7fb3c2[_0x927220]={'$like':'%'+_0x29f5a6[_0xaf7b('0x43')]['filter']+'%'};return _0x7fb3c2;})});}_0x3c10f7=_[_0xaf7b('0x4e')]({},_0x3c10f7,_0x29f5a6['options']);return db['Disposition']['count']({'where':_0x3c10f7[_0xaf7b('0x4c')]})['then'](function(_0x9f8b90){_0x1100af['count']=_0x9f8b90;if(_0x29f5a6[_0xaf7b('0x43')][_0xaf7b('0x51')]){_0x3c10f7[_0xaf7b('0x52')]=[{'all':!![]}];}return db[_0xaf7b('0x65')]['findAll'](_0x3c10f7);})['then'](function(_0x4c1a6b){_0x1100af[_0xaf7b('0x54')]=_0x4c1a6b;return _0x1100af;});}})[_0xaf7b('0x22')](respondWithFilteredResult(_0x5c8cf8,_0x3c10f7))[_0xaf7b('0x2a')](handleError(_0x5c8cf8,null));};exports[_0xaf7b('0x69')]=function(_0x2de903,_0x4c6444,_0x57c5c6){return db[_0xaf7b('0x3f')]['find']({'where':{'id':_0x2de903[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x4c6444,null))['then'](function(_0x4b2abe){if(_0x4b2abe){return _0x4b2abe[_0xaf7b('0x69')](_0x2de903[_0xaf7b('0x43')][_0xaf7b('0x6a')]);}})['then'](respondWithStatusCode(_0x4c6444,null))[_0xaf7b('0x2a')](handleError(_0x4c6444,null));};exports[_0xaf7b('0x6b')]=function(_0x295eae,_0x5e5c49,_0x3a7c0e){if(_0x295eae['body']['id']){delete _0x295eae[_0xaf7b('0x5a')]['id'];}return db[_0xaf7b('0x3f')]['find']({'where':{'id':_0x295eae['params']['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x5e5c49,null))[_0xaf7b('0x22')](function(_0x207771){if(_0x207771){_0x295eae['body'][_0xaf7b('0x6c')]=_0x207771['id'];return db[_0xaf7b('0x6d')][_0xaf7b('0x59')](_0x295eae[_0xaf7b('0x5a')]);}})['then'](respondWithResult(_0x5e5c49,null))[_0xaf7b('0x2a')](handleError(_0x5e5c49,null));};exports[_0xaf7b('0x6e')]=function(_0x791e84,_0x185602,_0x57c960){var _0x1c0a4c={'raw':![],'where':{}};var _0x205abe={};var _0x86d53c={'count':0x0,'rows':[]};return db[_0xaf7b('0x3f')]['findOne']({'where':{'id':_0x791e84[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x185602,null))[_0xaf7b('0x22')](function(_0x2c79d7){if(_0x2c79d7){_0x205abe[_0xaf7b('0x42')]=_[_0xaf7b('0x44')](db[_0xaf7b('0x6d')][_0xaf7b('0x40')]);_0x205abe[_0xaf7b('0x43')]=_['keys'](_0x791e84['query']);_0x205abe[_0xaf7b('0x45')]=_[_0xaf7b('0x46')](_0x205abe[_0xaf7b('0x42')],_0x205abe[_0xaf7b('0x43')]);_0x1c0a4c[_0xaf7b('0x47')]=_[_0xaf7b('0x46')](_0x205abe[_0xaf7b('0x42')],qs['fields'](_0x791e84[_0xaf7b('0x43')]['fields']));_0x1c0a4c[_0xaf7b('0x47')]=_0x1c0a4c[_0xaf7b('0x47')]['length']?_0x1c0a4c['attributes']:_0x205abe['model'];if(!_0x791e84[_0xaf7b('0x43')][_0xaf7b('0x6f')](_0xaf7b('0x67'))){_0x1c0a4c[_0xaf7b('0x49')]=qs[_0xaf7b('0x49')](_0x791e84[_0xaf7b('0x43')][_0xaf7b('0x49')]);_0x1c0a4c[_0xaf7b('0x2e')]=qs[_0xaf7b('0x2e')](_0x791e84[_0xaf7b('0x43')][_0xaf7b('0x2e')]);}_0x1c0a4c[_0xaf7b('0x4a')]=qs[_0xaf7b('0x4b')](_0x791e84['query']['sort']);_0x1c0a4c[_0xaf7b('0x4c')]=qs[_0xaf7b('0x45')](_['pick'](_0x791e84[_0xaf7b('0x43')],_0x205abe[_0xaf7b('0x45')]));_0x1c0a4c[_0xaf7b('0x4c')][_0xaf7b('0x6c')]=_0x2c79d7['id'];if(_0x791e84[_0xaf7b('0x43')][_0xaf7b('0x68')]){_0x1c0a4c[_0xaf7b('0x4c')]=_[_0xaf7b('0x4e')](_0x1c0a4c['where'],{'$or':_[_0xaf7b('0x3e')](_0x1c0a4c[_0xaf7b('0x47')],function(_0x4a2422){var _0x436a93={};_0x436a93[_0x4a2422]={'$like':'%'+_0x791e84['query'][_0xaf7b('0x68')]+'%'};return _0x436a93;})});}_0x1c0a4c=_[_0xaf7b('0x4e')]({},_0x1c0a4c,_0x791e84[_0xaf7b('0x70')]);return db[_0xaf7b('0x6d')][_0xaf7b('0x2d')]({'where':_0x1c0a4c['where']})['then'](function(_0x1e60b7){_0x86d53c['count']=_0x1e60b7;if(_0x791e84[_0xaf7b('0x43')][_0xaf7b('0x51')]){_0x1c0a4c[_0xaf7b('0x52')]=[{'all':!![]}];}return db[_0xaf7b('0x6d')][_0xaf7b('0x53')](_0x1c0a4c);})[_0xaf7b('0x22')](function(_0x30d807){_0x86d53c['rows']=_0x30d807;return _0x86d53c;});}})[_0xaf7b('0x22')](respondWithFilteredResult(_0x185602,_0x1c0a4c))['catch'](handleError(_0x185602,null));};exports['removeAnswers']=function(_0x3ae0b9,_0x3a21ae,_0x192a37){return db['OpenchannelAccount'][_0xaf7b('0x58')]({'where':{'id':_0x3ae0b9[_0xaf7b('0x56')]['id']}})['then'](handleEntityNotFound(_0x3a21ae,null))['then'](function(_0x213b51){if(_0x213b51){return _0x213b51[_0xaf7b('0x71')](_0x3ae0b9['query'][_0xaf7b('0x6a')]);}})[_0xaf7b('0x22')](respondWithStatusCode(_0x3a21ae,null))['catch'](handleError(_0x3a21ae,null));};exports[_0xaf7b('0x72')]=function(_0x9f4157,_0x308457,_0x2f21aa){var _0x24019b={'body':_0x9f4157['body'],'channel':_0xaf7b('0x73')};var _0x1f478a=[];var _0x5bee99=[];var _0x462c77={};var _0x435a83=![];return db[_0xaf7b('0x74')]['describe']()['then'](function(_0x21bfea){if(!_0x21bfea){throw new db[(_0xaf7b('0x20'))][(_0xaf7b('0x21'))](_0xaf7b('0x75'));}_0x1f478a=_[_0xaf7b('0x76')](_[_0xaf7b('0x44')](_0x21bfea),['createdAt','updatedAt']);_0x5bee99=_[_0xaf7b('0x76')](_[_0xaf7b('0x44')](_0x21bfea),[_0xaf7b('0x77'),_0xaf7b('0x78'),_0xaf7b('0x79'),'ListId']);if(_0x9f4157[_0xaf7b('0x5a')]['id']){delete _0x9f4157[_0xaf7b('0x5a')]['id'];}if(_[_0xaf7b('0x7a')](_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7b')])){throw new db[(_0xaf7b('0x20'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xaf7b('0x7a')](_0x9f4157['body'][_0xaf7b('0x5a')])||_0x9f4157[_0xaf7b('0x5a')]['body']===''){throw new db[(_0xaf7b('0x20'))][(_0xaf7b('0x21'))](_0xaf7b('0x7c'));}if(_[_0xaf7b('0x7a')](_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7d')])){throw new db[(_0xaf7b('0x20'))][(_0xaf7b('0x21'))](_0xaf7b('0x7e')+_0x5bee99);}if(!_[_0xaf7b('0x7f')](_0x5bee99,_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7d')])){throw new db['Sequelize'][(_0xaf7b('0x21'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5bee99);}_0x462c77[_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7d')]]=_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7b')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x9f4157[_0xaf7b('0x56')]['id']},'include':[{'model':db[_0xaf7b('0x80')],'as':_0xaf7b('0x81'),'include':[{'model':db['CmContact'],'as':_0xaf7b('0x82'),'where':_0x462c77,'limit':0x1,'order':[[_0xaf7b('0x78'),_0xaf7b('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0xaf7b('0x84')}]});})[_0xaf7b('0x22')](handleEntityNotFound(_0x308457,null))[_0xaf7b('0x22')](function(_0x4efa9d){if(_0x4efa9d&&_0x4efa9d[_0xaf7b('0x81')]){_0x24019b[_0xaf7b('0x85')]=_0x4efa9d;_0x24019b['applications']=_0x4efa9d[_0xaf7b('0x84')];_0x24019b['list']=_0x4efa9d[_0xaf7b('0x81')];_0x24019b[_0xaf7b('0x86')]=_['orderBy'](_0x24019b[_0xaf7b('0x86')],[_0xaf7b('0x87')],['asc']);if(_0x24019b[_0xaf7b('0x85')][_0xaf7b('0x84')]){delete _0x24019b[_0xaf7b('0x85')][_0xaf7b('0x84')];}if(_0x24019b[_0xaf7b('0x85')]['List']&&_0x24019b[_0xaf7b('0x85')][_0xaf7b('0x81')][_0xaf7b('0x82')]['length']){return _0x24019b['account'][_0xaf7b('0x81')][_0xaf7b('0x82')][0x0];}var _0x2d8b1e=_[_0xaf7b('0x1a')](_0x9f4157[_0xaf7b('0x5a')],{'firstName':_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7b')],'ListId':_0x4efa9d[_0xaf7b('0x88')]});_0x2d8b1e[_0x9f4157[_0xaf7b('0x5a')]['mapKey']]=_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x7b')];return db['CmContact']['create'](_0x2d8b1e,{'fields':_0x1f478a,'raw':!![]});}})[_0xaf7b('0x22')](handleEntityNotFound(_0x308457,null))[_0xaf7b('0x22')](function(_0x59fc30){_0x24019b[_0xaf7b('0x89')]=_0x59fc30;if(_0x59fc30){var _0x1c046e={'ContactId':_0x59fc30['id'],'OpenchannelAccountId':_0x9f4157['params']['id'],'from':(_0x59fc30['firstName']||'')+'\x20'+(_0x59fc30[_0xaf7b('0x8a')]||'')};var _0x5141d4={'OpenchannelAccountId':_0x9f4157['params']['id'],'closed':![]};if(_0x9f4157['body'][_0xaf7b('0x8b')]){_0x5141d4[_0xaf7b('0x8b')]=_0x9f4157['body'][_0xaf7b('0x8b')];return db['OpenchannelInteraction'][_0xaf7b('0x58')]({'where':_0x5141d4})[_0xaf7b('0x22')](function(_0x3dc8f4){if(_0x3dc8f4){return[_0x3dc8f4,![]];}_0x1c046e[_0xaf7b('0x8b')]=_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x8b')];_0x1c046e[_0xaf7b('0x8c')]=_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x8c')];return db['OpenchannelInteraction'][_0xaf7b('0x59')](_0x1c046e)[_0xaf7b('0x22')](function(_0x34c0d7){return[_0x34c0d7,!![]];});});}else{_0x5141d4[_0xaf7b('0x8b')]=null;}_0x5141d4[_0xaf7b('0x8d')]=_0x59fc30['id'];return db[_0xaf7b('0x8e')][_0xaf7b('0x58')]({'where':_0x5141d4})[_0xaf7b('0x22')](function(_0x53df21){if(_0x53df21){return[_0x53df21,![]];}return db['OpenchannelInteraction'][_0xaf7b('0x59')](_0x1c046e)[_0xaf7b('0x22')](function(_0x415bb0){return[_0x415bb0,!![]];});});}})[_0xaf7b('0x8f')](function(_0x2ab3fd,_0x40bb55){if(_0x2ab3fd){_0x435a83=_0x40bb55;if(!_0x40bb55){var _0x1c0cac={'from':(_0x24019b[_0xaf7b('0x89')][_0xaf7b('0x90')]||'')+'\x20'+(_0x24019b[_0xaf7b('0x89')][_0xaf7b('0x8a')]||'')};if(_0x9f4157[_0xaf7b('0x5a')]['threadId']&&_0x9f4157['body'][_0xaf7b('0x91')]&&_0x9f4157['body'][_0xaf7b('0x8b')]!=_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x91')]){_0x1c0cac['threadId']=_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x91')];}return _0x2ab3fd[_0xaf7b('0x32')](_0x1c0cac);}else{return _0x2ab3fd;}}})[_0xaf7b('0x22')](function(_0x15d1e2){_0x24019b[_0xaf7b('0x92')]=_0x15d1e2['get']({'plain':!![]});_0x24019b['interaction'][_0xaf7b('0x93')]=_0x435a83;if(_0x24019b[_0xaf7b('0x92')][_0xaf7b('0x93')]){if(_0x24019b[_0xaf7b('0x85')][_0xaf7b('0x94')]){_0x24019b['applications']['push']({'id':0x0,'priority':_0x24019b[_0xaf7b('0x86')][_0xaf7b('0x57')]+0x1,'app':_0xaf7b('0x95'),'appdata':_0xaf7b('0x96'),'interval':_0xaf7b('0x97')});}}return db[_0xaf7b('0x98')][_0xaf7b('0x59')]({'body':_0x9f4157['body'][_0xaf7b('0x5a')],'OpenchannelAccountId':_0x9f4157[_0xaf7b('0x56')]['id'],'OpenchannelInteractionId':_0x15d1e2['id'],'direction':'in','ContactId':_0x24019b['contact']['id'],'AttachmentId':_0x9f4157[_0xaf7b('0x5a')][_0xaf7b('0x99')]});})[_0xaf7b('0x22')](function(_0x46a5a4){_0x24019b[_0xaf7b('0x28')]=_0x46a5a4;if(_0x24019b[_0xaf7b('0x92')][_0xaf7b('0x9a')]){return db[_0xaf7b('0x9b')][_0xaf7b('0x58')]({'attributes':['id','name'],'where':{'id':_0x24019b['interaction']['UserId']}})[_0xaf7b('0x22')](function(_0x1544d0){if(_0x1544d0){_0x24019b[_0xaf7b('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xaf7b('0x9c'),'appdata':_0x1544d0[_0xaf7b('0x39')]+','+(_0x24019b[_0xaf7b('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0xaf7b('0x97')});_0x24019b[_0xaf7b('0x9d')]=![];}return respondWithRpcPromise('Start','startRouting',_0x24019b);});}return respondWithRpcPromise(_0xaf7b('0x9e'),_0xaf7b('0x9f'),_0x24019b);})[_0xaf7b('0x22')](function(_0x554759){respondWithRpcPromise('EventManager',_0xaf7b('0xa0'),{'event':_0xaf7b('0x72'),'message':_0x554759},client9002);return _0x554759;})[_0xaf7b('0x22')](respondWithResult(_0x308457,null))[_0xaf7b('0x2a')](handleError(_0x308457,null));};exports['addApplications']=function(_0x3a801a,_0x116089,_0x4bd8ee){return db[_0xaf7b('0x3f')][_0xaf7b('0xa1')]({'where':{'id':_0x3a801a[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x116089,null))['then'](function(_0x763834){if(_0x763834){return db['sequelize'][_0xaf7b('0xa2')](function(_0x3e5e2d){return db[_0xaf7b('0xa3')][_0xaf7b('0x35')]({'where':{'OpenchannelAccountId':_0x3a801a[_0xaf7b('0x56')]['id']},'transaction':_0x3e5e2d})[_0xaf7b('0x22')](function(_0x5cc6fc){var _0x192557=_[_0xaf7b('0x3e')](_0x3a801a['body'],function(_0x360081){_0x360081[_0xaf7b('0x6c')]=_0x3a801a[_0xaf7b('0x56')]['id'];return _0x360081;});return db['OpenchannelApplication']['bulkCreate'](_0x192557,{'transaction':_0x3e5e2d});});})[_0xaf7b('0x22')](function(){return db[_0xaf7b('0xa3')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3a801a['params']['id']},'order':'priority'});});}})[_0xaf7b('0x22')](respondWithResult(_0x116089,null))['catch'](handleError(_0x116089,null));};exports[_0xaf7b('0xa4')]=function(_0x23f141,_0x444286,_0x5130c5){var _0x49c0b9={};var _0x49b95b={};var _0x25ba92;var _0xf13367;return db[_0xaf7b('0x3f')][_0xaf7b('0xa1')]({'where':{'id':_0x23f141[_0xaf7b('0x56')]['id']}})['then'](handleEntityNotFound(_0x444286,null))[_0xaf7b('0x22')](function(_0x39cd18){if(_0x39cd18){_0x25ba92=_0x39cd18;_0x49b95b[_0xaf7b('0x42')]=_[_0xaf7b('0x44')](db[_0xaf7b('0xa3')]['rawAttributes']);_0x49b95b[_0xaf7b('0x43')]=_[_0xaf7b('0x44')](_0x23f141[_0xaf7b('0x43')]);_0x49b95b[_0xaf7b('0x45')]=_['intersection'](_0x49b95b[_0xaf7b('0x42')],_0x49b95b[_0xaf7b('0x43')]);_0x49c0b9[_0xaf7b('0x47')]=_[_0xaf7b('0x46')](_0x49b95b[_0xaf7b('0x42')],qs[_0xaf7b('0x48')](_0x23f141[_0xaf7b('0x43')][_0xaf7b('0x48')]));_0x49c0b9[_0xaf7b('0x47')]=_0x49c0b9[_0xaf7b('0x47')][_0xaf7b('0x57')]?_0x49c0b9[_0xaf7b('0x47')]:_0x49b95b[_0xaf7b('0x42')];_0x49c0b9['order']=qs[_0xaf7b('0x4b')](_0x23f141[_0xaf7b('0x43')]['sort']);_0x49c0b9[_0xaf7b('0x4c')]=qs[_0xaf7b('0x45')](_[_0xaf7b('0x4d')](_0x23f141[_0xaf7b('0x43')],_0x49b95b[_0xaf7b('0x45')]));if(_0x23f141[_0xaf7b('0x43')][_0xaf7b('0x68')]){_0x49c0b9[_0xaf7b('0x4c')]=_[_0xaf7b('0x4e')](_0x49c0b9[_0xaf7b('0x4c')],{'$or':_[_0xaf7b('0x3e')](_0x49c0b9[_0xaf7b('0x47')],function(_0x32c4af){var _0x11b572={};_0x11b572[_0x32c4af]={'$like':'%'+_0x23f141[_0xaf7b('0x43')][_0xaf7b('0x68')]+'%'};return _0x11b572;})});}_0x49c0b9=_[_0xaf7b('0x4e')]({},_0x49c0b9,_0x23f141[_0xaf7b('0x70')]);return _0x25ba92['getApplications'](_0x49c0b9);}})[_0xaf7b('0x22')](function(_0x48fd08){if(_0x48fd08){_0xf13367=_0x48fd08[_0xaf7b('0x57')];if(!_0x23f141[_0xaf7b('0x43')][_0xaf7b('0x6f')](_0xaf7b('0x67'))){_0x49c0b9[_0xaf7b('0x49')]=qs[_0xaf7b('0x49')](_0x23f141['query']['limit']);_0x49c0b9[_0xaf7b('0x2e')]=qs[_0xaf7b('0x2e')](_0x23f141['query'][_0xaf7b('0x2e')]);}return _0x25ba92['getApplications'](_0x49c0b9);}})[_0xaf7b('0x22')](function(_0x495538){if(_0x495538){return _0x495538?{'count':_0xf13367,'rows':_0x495538}:null;}})[_0xaf7b('0x22')](respondWithResult(_0x444286,null))[_0xaf7b('0x2a')](handleError(_0x444286,null));};exports['getInteractions']=function(_0x1ab6a6,_0x34304f,_0x3755ff){var _0x55eedd={'raw':![],'where':{}};var _0x5b6542={};var _0x45c4af={'count':0x0,'rows':[]};return db[_0xaf7b('0x3f')]['findOne']({'where':{'id':_0x1ab6a6[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x34304f,null))[_0xaf7b('0x22')](function(_0x238d18){if(_0x238d18){_0x5b6542['model']=_[_0xaf7b('0x44')](db[_0xaf7b('0x8e')]['rawAttributes']);_0x5b6542[_0xaf7b('0x43')]=_[_0xaf7b('0x44')](_0x1ab6a6[_0xaf7b('0x43')]);_0x5b6542[_0xaf7b('0x45')]=_[_0xaf7b('0x46')](_0x5b6542['model'],_0x5b6542[_0xaf7b('0x43')]);_0x55eedd[_0xaf7b('0x47')]=_[_0xaf7b('0x46')](_0x5b6542[_0xaf7b('0x42')],qs[_0xaf7b('0x48')](_0x1ab6a6[_0xaf7b('0x43')]['fields']));_0x55eedd[_0xaf7b('0x47')]=_0x55eedd['attributes'][_0xaf7b('0x57')]?_0x55eedd[_0xaf7b('0x47')]:_0x5b6542[_0xaf7b('0x42')];if(!_0x1ab6a6[_0xaf7b('0x43')]['hasOwnProperty'](_0xaf7b('0x67'))){_0x55eedd[_0xaf7b('0x49')]=qs[_0xaf7b('0x49')](_0x1ab6a6[_0xaf7b('0x43')][_0xaf7b('0x49')]);_0x55eedd['offset']=qs[_0xaf7b('0x2e')](_0x1ab6a6[_0xaf7b('0x43')][_0xaf7b('0x2e')]);}_0x55eedd['order']=qs[_0xaf7b('0x4b')](_0x1ab6a6[_0xaf7b('0x43')][_0xaf7b('0x4b')]);_0x55eedd[_0xaf7b('0x4c')]=qs[_0xaf7b('0x45')](_[_0xaf7b('0x4d')](_0x1ab6a6[_0xaf7b('0x43')],_0x5b6542['filters']));_0x55eedd[_0xaf7b('0x4c')]['OpenchannelAccountId']=_0x238d18['id'];if(_0x1ab6a6['query']['filter']){_0x55eedd[_0xaf7b('0x4c')]=_[_0xaf7b('0x4e')](_0x55eedd[_0xaf7b('0x4c')],{'$or':_['map'](_0x55eedd[_0xaf7b('0x47')],function(_0x385a09){var _0x22af25={};_0x22af25[_0x385a09]={'$like':'%'+_0x1ab6a6[_0xaf7b('0x43')][_0xaf7b('0x68')]+'%'};return _0x22af25;})});}_0x55eedd=_['merge']({},_0x55eedd,_0x1ab6a6[_0xaf7b('0x70')]);return db[_0xaf7b('0x8e')][_0xaf7b('0x2d')]({'where':_0x55eedd[_0xaf7b('0x4c')]})[_0xaf7b('0x22')](function(_0x45dcc1){_0x45c4af[_0xaf7b('0x2d')]=_0x45dcc1;if(_0x1ab6a6[_0xaf7b('0x43')][_0xaf7b('0x51')]){_0x55eedd[_0xaf7b('0x52')]=[{'model':db[_0xaf7b('0x74')],'as':_0xaf7b('0xa5'),'required':![]},{'model':db[_0xaf7b('0x9b')],'as':_0xaf7b('0xa6'),'attributes':['name',_0xaf7b('0xa7'),_0xaf7b('0xa8')],'required':![]},{'model':db[_0xaf7b('0xa9')],'as':'Tags','attributes':['id',_0xaf7b('0x39'),_0xaf7b('0xaa')],'where':_0x1ab6a6[_0xaf7b('0x43')]['tag']?{'id':_0x1ab6a6['query']['tag']}:undefined,'required':_0x1ab6a6[_0xaf7b('0x43')][_0xaf7b('0xab')]?!![]:![]}];}return db[_0xaf7b('0x8e')][_0xaf7b('0x53')](_0x55eedd);})[_0xaf7b('0x22')](function(_0x1ca568){_0x45c4af[_0xaf7b('0x54')]=_0x1ca568;return _0x45c4af;});}})[_0xaf7b('0x22')](respondWithFilteredResult(_0x34304f,_0x55eedd))[_0xaf7b('0x2a')](handleError(_0x34304f,null));};exports[_0xaf7b('0xac')]=function(_0x39d8de,_0x544cd8,_0x885871){return db[_0xaf7b('0x3f')][_0xaf7b('0x58')]({'where':{'id':_0x39d8de['params']['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x544cd8,null))[_0xaf7b('0x22')](function(_0xd42ba1){if(_0xd42ba1){return _0xd42ba1[_0xaf7b('0xac')](_0x39d8de['body'][_0xaf7b('0x6a')],_[_0xaf7b('0xad')](_0x39d8de['body'],[_0xaf7b('0x6a'),'id'])||{})[_0xaf7b('0x8f')](function(_0x202098){for(var _0x19cbba=0x0;_0x19cbba<_0x39d8de['body'][_0xaf7b('0x6a')]['length'];_0x19cbba+=0x1){socket[_0xaf7b('0xae')](_0xaf7b('0xaf'),{'UserId':_0x39d8de['body'][_0xaf7b('0x6a')][_0x19cbba],'OpenchannelAccountId':_0x39d8de['params']['id']});}return _0x202098;});}})[_0xaf7b('0x22')](respondWithResult(_0x544cd8,null))['catch'](handleError(_0x544cd8,null));};exports[_0xaf7b('0xb0')]=function(_0x54b61b,_0x1219fc,_0x18c617){return db['OpenchannelAccount'][_0xaf7b('0x58')]({'where':{'id':_0x54b61b['params']['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x1219fc,null))[_0xaf7b('0x22')](function(_0x2db5fa){if(_0x2db5fa){return _0x2db5fa[_0xaf7b('0xb0')](_0x54b61b[_0xaf7b('0x43')][_0xaf7b('0x6a')])[_0xaf7b('0x22')](function(){if(_[_0xaf7b('0xb1')](_0x54b61b['query'][_0xaf7b('0x6a')])){for(var _0x7df97e=0x0;_0x7df97e<_0x54b61b['query']['ids'][_0xaf7b('0x57')];_0x7df97e+=0x1){socket[_0xaf7b('0xae')](_0xaf7b('0xb2'),{'UserId':Number(_0x54b61b[_0xaf7b('0x43')][_0xaf7b('0x6a')][_0x7df97e]),'OpenchannelAccountId':Number(_0x54b61b[_0xaf7b('0x56')]['id'])});}}else{socket[_0xaf7b('0xae')](_0xaf7b('0xb2'),{'UserId':Number(_0x54b61b['query']['ids']),'OpenchannelAccountId':Number(_0x54b61b[_0xaf7b('0x56')]['id'])});}});}})[_0xaf7b('0x22')](respondWithStatusCode(_0x1219fc,null))[_0xaf7b('0x2a')](handleError(_0x1219fc,null));};exports[_0xaf7b('0xb3')]=function(_0x2f77ac,_0x1883fe,_0x35619f){var _0x2fadd7={};var _0x25fb86={};var _0x5c64cf;var _0x3fdcec;return db[_0xaf7b('0x3f')][_0xaf7b('0xa1')]({'where':{'id':_0x2f77ac[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x1883fe,null))[_0xaf7b('0x22')](function(_0x5ca7a8){if(_0x5ca7a8){_0x5c64cf=_0x5ca7a8;_0x25fb86['model']=_[_0xaf7b('0x44')](db[_0xaf7b('0x9b')][_0xaf7b('0x40')]);_0x25fb86[_0xaf7b('0x43')]=_[_0xaf7b('0x44')](_0x2f77ac[_0xaf7b('0x43')]);_0x25fb86[_0xaf7b('0x45')]=_[_0xaf7b('0x46')](_0x25fb86[_0xaf7b('0x42')],_0x25fb86[_0xaf7b('0x43')]);_0x2fadd7[_0xaf7b('0x47')]=_['intersection'](_0x25fb86[_0xaf7b('0x42')],qs['fields'](_0x2f77ac[_0xaf7b('0x43')][_0xaf7b('0x48')]));_0x2fadd7[_0xaf7b('0x47')]=_0x2fadd7[_0xaf7b('0x47')]['length']?_0x2fadd7[_0xaf7b('0x47')]:_0x25fb86['model'];_0x2fadd7[_0xaf7b('0x4a')]=qs[_0xaf7b('0x4b')](_0x2f77ac[_0xaf7b('0x43')][_0xaf7b('0x4b')]);_0x2fadd7[_0xaf7b('0x4c')]=qs[_0xaf7b('0x45')](_[_0xaf7b('0x4d')](_0x2f77ac['query'],_0x25fb86[_0xaf7b('0x45')]));if(_0x2f77ac[_0xaf7b('0x43')][_0xaf7b('0x68')]){_0x2fadd7[_0xaf7b('0x4c')]=_[_0xaf7b('0x4e')](_0x2fadd7[_0xaf7b('0x4c')],{'$or':_[_0xaf7b('0x3e')](_0x2fadd7[_0xaf7b('0x47')],function(_0x2a91fd){var _0x28efeb={};_0x28efeb[_0x2a91fd]={'$like':'%'+_0x2f77ac[_0xaf7b('0x43')][_0xaf7b('0x68')]+'%'};return _0x28efeb;})});}_0x2fadd7=_[_0xaf7b('0x4e')]({},_0x2fadd7,_0x2f77ac['options']);return _0x5c64cf[_0xaf7b('0xb3')](_0x2fadd7);}})['then'](function(_0x3688fe){if(_0x3688fe){_0x3fdcec=_0x3688fe[_0xaf7b('0x57')];if(!_0x2f77ac['query'][_0xaf7b('0x6f')](_0xaf7b('0x67'))){_0x2fadd7[_0xaf7b('0x49')]=qs[_0xaf7b('0x49')](_0x2f77ac[_0xaf7b('0x43')][_0xaf7b('0x49')]);_0x2fadd7[_0xaf7b('0x2e')]=qs['offset'](_0x2f77ac[_0xaf7b('0x43')][_0xaf7b('0x2e')]);}return _0x5c64cf[_0xaf7b('0xb3')](_0x2fadd7);}})[_0xaf7b('0x22')](function(_0x2bbcb1){if(_0x2bbcb1){return _0x2bbcb1?{'count':_0x3fdcec,'rows':_0x2bbcb1}:null;}})['then'](respondWithResult(_0x1883fe,null))[_0xaf7b('0x2a')](handleError(_0x1883fe,null));};exports[_0xaf7b('0x3a')]=function(_0x156921,_0x3906b3,_0x3ab614){var _0x19d4f8,_0x2d51e0,_0x456567;if(_['isNil'](_0x156921['body'][_0xaf7b('0x5a')])||_0x156921[_0xaf7b('0x5a')][_0xaf7b('0x5a')]===''){throw new db[(_0xaf7b('0x20'))][(_0xaf7b('0x21'))](_0xaf7b('0x7c'));}if(_[_0xaf7b('0x7a')](_0x156921[_0xaf7b('0x5a')]['to'])){}_0x19d4f8=_0x156921['body']['to'];return db['OpenchannelAccount'][_0xaf7b('0xa1')]({'where':{'id':_0x156921[_0xaf7b('0x56')]['id']}})[_0xaf7b('0x22')](handleEntityNotFound(_0x3906b3,null))['then'](function(_0x4828d8){if(_0x4828d8){return db[_0xaf7b('0x3f')][_0xaf7b('0x58')]({'where':{'id':_0x4828d8['id']},'include':[{'model':db[_0xaf7b('0x80')],'as':_0xaf7b('0x81'),'include':[{'model':db['CmContact'],'as':_0xaf7b('0x82'),'where':{[_0x4828d8[_0xaf7b('0x7d')]]:_0x19d4f8},'limit':0x1,'order':[[_0xaf7b('0x78'),'DESC']]}]}]})[_0xaf7b('0x22')](handleEntityNotFound(_0x3906b3,null))['then'](function(_0x170f86){if(_0x170f86&&_0x170f86['List']){_0x2d51e0=_0x170f86['get']({'plain':!![]});if(_0x2d51e0[_0xaf7b('0x81')]&&_0x2d51e0[_0xaf7b('0x81')][_0xaf7b('0x82')]['length']){return _0x2d51e0[_0xaf7b('0x81')][_0xaf7b('0x82')][0x0];}return db[_0xaf7b('0x74')][_0xaf7b('0x59')](_[_0xaf7b('0x1a')](_0x156921[_0xaf7b('0x5a')],{'firstName':_0x19d4f8,[_0x170f86[_0xaf7b('0x7d')]]:_0x19d4f8,'phone':_0x19d4f8,'ListId':_0x2d51e0['ListId']}));}})[_0xaf7b('0x22')](handleEntityNotFound(_0x3906b3,null))['then'](function(_0x385418){if(_0x385418){_0x456567=_0x385418;return db['OpenchannelInteraction'][_0xaf7b('0x58')]({'where':{'ContactId':_0x456567['id'],'closed':![],'OpenchannelAccountId':_0x2d51e0['id']}})[_0xaf7b('0x22')](function(_0x3113b1){if(_0x3113b1){return[_0x3113b1,![]];}return db[_0xaf7b('0x8e')][_0xaf7b('0x59')]({'UserId':_0x156921[_0xaf7b('0x5b')]['id'],'ContactId':_0x456567['id'],'OpenchannelAccountId':_0x2d51e0['id'],'lastMsgDirection':_0xaf7b('0xb4'),'Messages':[_['merge'](_0x156921[_0xaf7b('0x5a')],{'read':![],'body':_0x156921['body'][_0xaf7b('0x5a')],'OpenchannelAccountId':_0x2d51e0['id'],'UserId':_0x156921[_0xaf7b('0x5b')]['id'],'ContactId':_0x456567['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xaf7b('0xb5')}]})['then'](function(_0x521244){return[_0x521244,!![]];});});}})['spread'](function(_0x2d0347,_0x11aedc){if(_0x11aedc){return _0x2d0347;}return db[_0xaf7b('0x98')][_0xaf7b('0x59')](_[_0xaf7b('0x4e')](_0x156921[_0xaf7b('0x5a')],{'read':![],'body':_0x156921[_0xaf7b('0x5a')]['body'],'OpenchannelAccountId':_0x2d51e0['id'],'OpenchannelInteractionId':_0x2d0347['id'],'UserId':_0x156921[_0xaf7b('0x5b')]['id'],'ContactId':_0x456567['id']}))[_0xaf7b('0x22')](function(_0x96c719){_0x2d0347[_0xaf7b('0xb6')][_0xaf7b('0xb5')]=[];_0x2d0347[_0xaf7b('0xb6')][_0xaf7b('0xb5')][_0xaf7b('0xb7')](_0x96c719[_0xaf7b('0xb6')]);return _0x2d0347;});});}})[_0xaf7b('0x22')](respondWithResult(_0x3906b3,null))[_0xaf7b('0x2a')](handleError(_0x3906b3,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7c97f56..82b5d00 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 _0x6aeb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x33d888,_0xd43ceb){var _0x2a4bb5=function(_0x565c97){while(--_0x565c97){_0x33d888['push'](_0x33d888['shift']());}};_0x2a4bb5(++_0xd43ceb);}(_0x6aeb,0x180));var _0xb6ae=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x6aeb[_0x3daa8c];return _0x2b1bd7;};'use strict';var EventEmitter=require(_0xb6ae('0x0'));var OpenchannelAccount=require(_0xb6ae('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb6ae('0x2')](0x0);var events={'afterCreate':_0xb6ae('0x3'),'afterUpdate':_0xb6ae('0x4'),'afterDestroy':_0xb6ae('0x5')};function emitEvent(_0x41d427){return function(_0x1ffcb9,_0x83b52d,_0x1a643b){OpenchannelAccountEvents[_0xb6ae('0x6')](_0x41d427+':'+_0x1ffcb9['id'],_0x1ffcb9);OpenchannelAccountEvents[_0xb6ae('0x6')](_0x41d427,_0x1ffcb9);_0x1a643b(null);};}for(var e in events){if(events[_0xb6ae('0x7')](e)){var event=events[e];OpenchannelAccount[_0xb6ae('0x8')](e,emitEvent(event));}}module[_0xb6ae('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xa764=['emit','exports','events','../../mysqldb','setMaxListeners','remove'];(function(_0x4b5c14,_0x4280d7){var _0x1de9d3=function(_0x418723){while(--_0x418723){_0x4b5c14['push'](_0x4b5c14['shift']());}};_0x1de9d3(++_0x4280d7);}(_0xa764,0x1a6));var _0x4a76=function(_0x75355b,_0x444328){_0x75355b=_0x75355b-0x0;var _0x16a411=_0xa764[_0x75355b];return _0x16a411;};'use strict';var EventEmitter=require(_0x4a76('0x0'));var OpenchannelAccount=require(_0x4a76('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4a76('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4a76('0x3')};function emitEvent(_0x3bdc65){return function(_0x53833c,_0x1f4a40,_0x23951c){OpenchannelAccountEvents[_0x4a76('0x4')](_0x3bdc65+':'+_0x53833c['id'],_0x53833c);OpenchannelAccountEvents[_0x4a76('0x4')](_0x3bdc65,_0x53833c);_0x23951c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x4a76('0x5')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 54f292c..0dc765e 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 _0xa6ee=['exports','OpenchannelAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelAccount.attributes'];(function(_0x4f0b97,_0x213c2f){var _0x17d3e1=function(_0x1de288){while(--_0x1de288){_0x4f0b97['push'](_0x4f0b97['shift']());}};_0x17d3e1(++_0x213c2f);}(_0xa6ee,0x136));var _0xea6e=function(_0x8006b1,_0x4e98f2){_0x8006b1=_0x8006b1-0x0;var _0x272c09=_0xa6ee[_0x8006b1];return _0x272c09;};'use strict';var _=require(_0xea6e('0x0'));var util=require('util');var logger=require(_0xea6e('0x1'))(_0xea6e('0x2'));var moment=require(_0xea6e('0x3'));var BPromise=require(_0xea6e('0x4'));var rp=require(_0xea6e('0x5'));var fs=require('fs');var path=require(_0xea6e('0x6'));var rimraf=require('rimraf');var config=require(_0xea6e('0x7'));var attributes=require(_0xea6e('0x8'));module[_0xea6e('0x9')]=function(_0x2e8875,_0x2d3ad7){return _0x2e8875['define'](_0xea6e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f42=['util','../../config/logger','api','bluebird','path','define','OpenchannelAccount','openchannel_accounts','lodash'];(function(_0x6d1897,_0x7d9a25){var _0x1d9584=function(_0x4fbc78){while(--_0x4fbc78){_0x6d1897['push'](_0x6d1897['shift']());}};_0x1d9584(++_0x7d9a25);}(_0x7f42,0x179));var _0x27f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7f42[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x27f4('0x0'));var util=require(_0x27f4('0x1'));var logger=require(_0x27f4('0x2'))(_0x27f4('0x3'));var moment=require('moment');var BPromise=require(_0x27f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27f4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x2bcab6,_0x52379c){return _0x2bcab6[_0x27f4('0x6')](_0x27f4('0x7'),attributes,{'tableName':_0x27f4('0x8'),'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 2028993..45ccd8d 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 _0xbdb5=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xbdb5,0xa8));var _0x5bdb=function(_0x4bf3af,_0x23b40d){_0x4bf3af=_0x4bf3af-0x0;var _0x42f9a0=_0xbdb5[_0x4bf3af];return _0x42f9a0;};'use strict';var _=require(_0x5bdb('0x0'));var util=require(_0x5bdb('0x1'));var moment=require('moment');var BPromise=require(_0x5bdb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bdb('0x3'))['db'];var utils=require(_0x5bdb('0x4'));var logger=require(_0x5bdb('0x5'))(_0x5bdb('0x6'));var config=require(_0x5bdb('0x7'));var jayson=require(_0x5bdb('0x8'));var client=jayson[_0x5bdb('0x9')][_0x5bdb('0xa')]({'port':0x232a});config[_0x5bdb('0xb')]=_[_0x5bdb('0xc')](config['redis'],{'host':_0x5bdb('0xd'),'port':0x18eb});var socket=require(_0x5bdb('0xe'))(new Redis(config['redis']));require(_0x5bdb('0xf'))[_0x5bdb('0x10')](socket);function respondWithRpcPromise(_0x3397e1,_0x1a601a,_0x589d91){return new BPromise(function(_0x376030,_0x3f98bf){return client[_0x5bdb('0x11')](_0x3397e1,_0x589d91)[_0x5bdb('0x12')](function(_0x48a428){logger[_0x5bdb('0x13')](_0x5bdb('0x14'),_0x1a601a,'request\x20sent');logger[_0x5bdb('0x15')](_0x5bdb('0x16'),_0x1a601a,_0x5bdb('0x17'),JSON[_0x5bdb('0x18')](_0x48a428));if(_0x48a428[_0x5bdb('0x19')]){if(_0x48a428['error']['code']===0x1f4){logger[_0x5bdb('0x19')](_0x5bdb('0x14'),_0x1a601a,_0x48a428[_0x5bdb('0x19')][_0x5bdb('0x1a')]);return _0x3f98bf(_0x48a428[_0x5bdb('0x19')][_0x5bdb('0x1a')]);}logger[_0x5bdb('0x19')](_0x5bdb('0x14'),_0x1a601a,_0x48a428[_0x5bdb('0x19')][_0x5bdb('0x1a')]);return _0x376030(_0x48a428[_0x5bdb('0x19')][_0x5bdb('0x1a')]);}else{logger[_0x5bdb('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x1a601a,_0x5bdb('0x17'));_0x376030(_0x48a428[_0x5bdb('0x1b')][_0x5bdb('0x1a')]);}})[_0x5bdb('0x1c')](function(_0x18748e){logger['error'](_0x5bdb('0x14'),_0x1a601a,_0x18748e);_0x3f98bf(_0x18748e);});});} \ No newline at end of file +var _0x9489=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','randomstring','ioredis'];(function(_0x389add,_0x2c8a70){var _0x459b2c=function(_0x82740a){while(--_0x82740a){_0x389add['push'](_0x389add['shift']());}};_0x459b2c(++_0x2c8a70);}(_0x9489,0x111));var _0x9948=function(_0x248bbe,_0x1f7cbc){_0x248bbe=_0x248bbe-0x0;var _0x5997a9=_0x9489[_0x248bbe];return _0x5997a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9948('0x0'));var BPromise=require('bluebird');var rs=require(_0x9948('0x1'));var fs=require('fs');var Redis=require(_0x9948('0x2'));var db=require(_0x9948('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9948('0x4'))('rpc');var config=require(_0x9948('0x5'));var jayson=require(_0x9948('0x6'));var client=jayson[_0x9948('0x7')][_0x9948('0x8')]({'port':0x232a});config[_0x9948('0x9')]=_['defaults'](config[_0x9948('0x9')],{'host':_0x9948('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9948('0xb'))['register'](socket);function respondWithRpcPromise(_0x21cf89,_0x1d0d12,_0x593f7b){return new BPromise(function(_0x2430f5,_0x52e13f){return client[_0x9948('0xc')](_0x21cf89,_0x593f7b)['then'](function(_0x3d8529){logger[_0x9948('0xd')](_0x9948('0xe'),_0x1d0d12,_0x9948('0xf'));logger[_0x9948('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1d0d12,_0x9948('0xf'),JSON[_0x9948('0x11')](_0x3d8529));if(_0x3d8529[_0x9948('0x12')]){if(_0x3d8529[_0x9948('0x12')][_0x9948('0x13')]===0x1f4){logger[_0x9948('0x12')](_0x9948('0xe'),_0x1d0d12,_0x3d8529[_0x9948('0x12')][_0x9948('0x14')]);return _0x52e13f(_0x3d8529[_0x9948('0x12')]['message']);}logger['error'](_0x9948('0xe'),_0x1d0d12,_0x3d8529[_0x9948('0x12')]['message']);return _0x2430f5(_0x3d8529[_0x9948('0x12')][_0x9948('0x14')]);}else{logger[_0x9948('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d0d12,_0x9948('0xf'));_0x2430f5(_0x3d8529[_0x9948('0x15')][_0x9948('0x14')]);}})[_0x9948('0x16')](function(_0x5a5c33){logger[_0x9948('0x12')](_0x9948('0xe'),_0x1d0d12,_0x5a5c33);_0x52e13f(_0x5a5c33);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9be2b02..1d74779 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 _0x121f=['emit','register','length','openchannelAccount:','save'];(function(_0x15aed5,_0x21bf6e){var _0x3ab856=function(_0x1742fe){while(--_0x1742fe){_0x15aed5['push'](_0x15aed5['shift']());}};_0x3ab856(++_0x21bf6e);}(_0x121f,0x68));var _0xf121=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x121f[_0x1acc2d];return _0xabfa6d;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xf121('0x0'),'remove','update'];function createListener(_0x5d3167,_0x124e2c){return function(_0x469fb2){_0x124e2c[_0xf121('0x1')](_0x5d3167,_0x469fb2);};}function removeListener(_0x298e08,_0x1d2730){return function(){OpenchannelAccountEvents['removeListener'](_0x298e08,_0x1d2730);};}exports[_0xf121('0x2')]=function(_0x116861){for(var _0x22d057=0x0,_0xcad403=events[_0xf121('0x3')];_0x22d057<_0xcad403;_0x22d057++){var _0x100e21=events[_0x22d057];var _0xcc74d1=createListener(_0xf121('0x4')+_0x100e21,_0x116861);OpenchannelAccountEvents['on'](_0x100e21,_0xcc74d1);}}; \ No newline at end of file +var _0x87ff=['openchannelAccount:','./openchannelAccount.events','save','remove','emit','register','length'];(function(_0xc95ff5,_0x223e41){var _0x1439c9=function(_0x44e785){while(--_0x44e785){_0xc95ff5['push'](_0xc95ff5['shift']());}};_0x1439c9(++_0x223e41);}(_0x87ff,0x6a));var _0xf87f=function(_0x3eaefe,_0x402eeb){_0x3eaefe=_0x3eaefe-0x0;var _0x18fe9f=_0x87ff[_0x3eaefe];return _0x18fe9f;};'use strict';var OpenchannelAccountEvents=require(_0xf87f('0x0'));var events=[_0xf87f('0x1'),_0xf87f('0x2'),'update'];function createListener(_0x19dba2,_0x6f9da4){return function(_0x488f19){_0x6f9da4[_0xf87f('0x3')](_0x19dba2,_0x488f19);};}function removeListener(_0x21b0c9,_0x30e1c5){return function(){OpenchannelAccountEvents['removeListener'](_0x21b0c9,_0x30e1c5);};}exports[_0xf87f('0x4')]=function(_0x1e3e97){for(var _0x3c1d91=0x0,_0x52489d=events[_0xf87f('0x5')];_0x3c1d91<_0x52489d;_0x3c1d91++){var _0x27a6d1=events[_0x3c1d91];var _0x208dba=createListener(_0xf87f('0x6')+_0x27a6d1,_0x1e3e97);OpenchannelAccountEvents['on'](_0x27a6d1,_0x208dba);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4cffd99..39b1d2b 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 _0x9157=['express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','connect-timeout'];(function(_0x8cfc18,_0xa5bb8b){var _0x28df2d=function(_0x136ee3){while(--_0x136ee3){_0x8cfc18['push'](_0x8cfc18['shift']());}};_0x28df2d(++_0xa5bb8b);}(_0x9157,0x16f));var _0x7915=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x9157[_0x1ac120];return _0x19b703;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7915('0x0'));var express=require(_0x7915('0x1'));var router=express[_0x7915('0x2')]();var auth=require(_0x7915('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7915('0x4'));var controller=require(_0x7915('0x5'));router['get']('/',auth[_0x7915('0x6')](),controller[_0x7915('0x7')]);router[_0x7915('0x8')](_0x7915('0x9'),auth[_0x7915('0x6')](),controller[_0x7915('0xa')]);router[_0x7915('0xb')]('/',auth[_0x7915('0x6')](),controller[_0x7915('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7915('0xd')]);router['delete']('/:id',auth[_0x7915('0x6')](),controller[_0x7915('0xe')]);module[_0x7915('0xf')]=router; \ No newline at end of file +var _0xa223=['path','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','update','delete','exports','multer'];(function(_0x55aff0,_0x1d3869){var _0x52cdb9=function(_0x117c4e){while(--_0x117c4e){_0x55aff0['push'](_0x55aff0['shift']());}};_0x52cdb9(++_0x1d3869);}(_0xa223,0xbf));var _0x3a22=function(_0x4a2403,_0x1750ec){_0x4a2403=_0x4a2403-0x0;var _0x205228=_0xa223[_0x4a2403];return _0x205228;};'use strict';var multer=require(_0x3a22('0x0'));var util=require('util');var path=require(_0x3a22('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a22('0x2'));var router=express[_0x3a22('0x3')]();var auth=require(_0x3a22('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3a22('0x5'));var controller=require(_0x3a22('0x6'));router[_0x3a22('0x7')]('/',auth[_0x3a22('0x8')](),controller['index']);router[_0x3a22('0x7')](_0x3a22('0x9'),auth[_0x3a22('0x8')](),controller[_0x3a22('0xa')]);router[_0x3a22('0xb')]('/',auth['isAuthenticated'](),controller[_0x3a22('0xc')]);router['put'](_0x3a22('0x9'),auth[_0x3a22('0x8')](),controller[_0x3a22('0xd')]);router[_0x3a22('0xe')](_0x3a22('0x9'),auth[_0x3a22('0x8')](),controller['destroy']);module[_0x3a22('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d941009..82760ba 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 _0x8393=['sequelize','STRING','TEXT','*,*,*,*'];(function(_0xc0754,_0x37f107){var _0x195498=function(_0x23dba7){while(--_0x23dba7){_0xc0754['push'](_0xc0754['shift']());}};_0x195498(++_0x37f107);}(_0x8393,0x1c4));var _0x3839=function(_0x2c1dd5,_0x471eef){_0x2c1dd5=_0x2c1dd5-0x0;var _0x599f42=_0x8393[_0x2c1dd5];return _0x599f42;};'use strict';var Sequelize=require(_0x3839('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3839('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3839('0x2')]()},'description':{'type':Sequelize[_0x3839('0x1')]},'interval':{'type':Sequelize[_0x3839('0x1')],'defaultValue':_0x3839('0x3')}}; \ No newline at end of file +var _0x4add=['STRING','noop','TEXT','exports','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4add,0x1bb));var _0xd4ad=function(_0x3ff58b,_0x4a478b){_0x3ff58b=_0x3ff58b-0x0;var _0x586b77=_0x4add[_0x3ff58b];return _0x586b77;};'use strict';var Sequelize=require('sequelize');module[_0xd4ad('0x0')]={'priority':{'type':Sequelize[_0xd4ad('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd4ad('0x2')],'allowNull':![],'defaultValue':_0xd4ad('0x3')},'appdata':{'type':Sequelize[_0xd4ad('0x4')]()},'description':{'type':Sequelize[_0xd4ad('0x2')]},'interval':{'type':Sequelize[_0xd4ad('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a750c74..e8a895a 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 _0x9876=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','OpenchannelApplication','rawAttributes','merge','catch','create','body','destroy','find'];(function(_0x3d9f4a,_0x3c937d){var _0x455455=function(_0x1e6219){while(--_0x1e6219){_0x3d9f4a['push'](_0x3d9f4a['shift']());}};_0x455455(++_0x3c937d);}(_0x9876,0x120));var _0x6987=function(_0xd0448e,_0x2d3d92){_0xd0448e=_0xd0448e-0x0;var _0x3563cb=_0x9876[_0xd0448e];return _0x3563cb;};'use strict';var pdf=require(_0x6987('0x0'));var emlformat=require(_0x6987('0x1'));var rimraf=require(_0x6987('0x2'));var zipdir=require(_0x6987('0x3'));var jsonpatch=require(_0x6987('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6987('0x5'));var Mustache=require(_0x6987('0x6'));var util=require('util');var path=require(_0x6987('0x7'));var sox=require(_0x6987('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6987('0x9'));var squel=require(_0x6987('0xa'));var crypto=require(_0x6987('0xb'));var jsforce=require(_0x6987('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6987('0xd'));var querystring=require(_0x6987('0xe'));var Papa=require(_0x6987('0xf'));var Redis=require('ioredis');var authService=require(_0x6987('0x10'));var qs=require(_0x6987('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6987('0x12'))(_0x6987('0x13'));var utils=require(_0x6987('0x14'));var config=require(_0x6987('0x15'));var db=require(_0x6987('0x16'))['db'];function respondWithStatusCode(_0x55bfdf,_0x4843a4){_0x4843a4=_0x4843a4||0xcc;return function(_0x1f44b5){if(_0x1f44b5){return _0x55bfdf['sendStatus'](_0x4843a4);}return _0x55bfdf[_0x6987('0x17')](_0x4843a4)[_0x6987('0x18')]();};}function respondWithResult(_0x2c379a,_0x272ca4){_0x272ca4=_0x272ca4||0xc8;return function(_0x1fc6e1){if(_0x1fc6e1){return _0x2c379a[_0x6987('0x17')](_0x272ca4)[_0x6987('0x19')](_0x1fc6e1);}};}function respondWithFilteredResult(_0x435155,_0x3a4709){return function(_0x2808fe){if(_0x2808fe){var _0x1446ee=_0x2808fe['count'],_0x5d9752=_0x3a4709[_0x6987('0x1a')],_0x295771=_0x3a4709['offset']+_0x3a4709[_0x6987('0x1b')],_0x4464cf;if(_0x295771>=_0x1446ee){_0x295771=_0x1446ee;_0x4464cf=0xc8;}else{_0x4464cf=0xce;}_0x435155[_0x6987('0x17')](_0x4464cf);return _0x435155[_0x6987('0x1c')](_0x6987('0x1d'),_0x5d9752+'-'+_0x295771+'/'+_0x1446ee)[_0x6987('0x19')](_0x2808fe);}return null;};}function patchUpdates(_0x9fb2f6){return function(_0x2db512){try{jsonpatch[_0x6987('0x1e')](_0x2db512,_0x9fb2f6,!![]);}catch(_0x3201a6){return BPromise[_0x6987('0x1f')](_0x3201a6);}return _0x2db512[_0x6987('0x20')]();};}function saveUpdates(_0x62f4c1,_0xace881){return function(_0xa46719){if(_0xa46719){return _0xa46719[_0x6987('0x21')](_0x62f4c1)[_0x6987('0x22')](function(_0x2ba1d0){return _0x2ba1d0;});}return null;};}function removeEntity(_0x5b0cda,_0x11a5e3){return function(_0x1882a2){if(_0x1882a2){return _0x1882a2['destroy']()[_0x6987('0x22')](function(){_0x5b0cda[_0x6987('0x17')](0xcc)[_0x6987('0x18')]();});}};}function handleEntityNotFound(_0x4e1b86,_0x12ede2){return function(_0x4b186a){if(!_0x4b186a){_0x4e1b86[_0x6987('0x23')](0x194);}return _0x4b186a;};}function handleError(_0x43243a,_0x4be2ec){_0x4be2ec=_0x4be2ec||0x1f4;return function(_0x34b878){logger[_0x6987('0x24')](_0x34b878['stack']);if(_0x34b878[_0x6987('0x25')]){delete _0x34b878['name'];}_0x43243a['status'](_0x4be2ec)[_0x6987('0x26')](_0x34b878);};}exports[_0x6987('0x27')]=function(_0x5bc203,_0x20d113){var _0x3496a8={},_0x1b014f={},_0x47ffef={'count':0x0,'rows':[]};var _0x170273=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x12a4cf){return{'name':_0x12a4cf[_0x6987('0x28')],'type':_0x12a4cf['type'][_0x6987('0x29')]};});_0x1b014f[_0x6987('0x2a')]=_['map'](_0x170273,_0x6987('0x25'));_0x1b014f[_0x6987('0x2b')]=_[_0x6987('0x2c')](_0x5bc203[_0x6987('0x2b')]);_0x1b014f[_0x6987('0x2d')]=_[_0x6987('0x2e')](_0x1b014f[_0x6987('0x2a')],_0x1b014f[_0x6987('0x2b')]);_0x3496a8['attributes']=_[_0x6987('0x2e')](_0x1b014f[_0x6987('0x2a')],qs['fields'](_0x5bc203[_0x6987('0x2b')][_0x6987('0x2f')]));_0x3496a8[_0x6987('0x30')]=_0x3496a8['attributes']['length']?_0x3496a8[_0x6987('0x30')]:_0x1b014f[_0x6987('0x2a')];if(!_0x5bc203[_0x6987('0x2b')][_0x6987('0x31')](_0x6987('0x32'))){_0x3496a8['limit']=qs['limit'](_0x5bc203[_0x6987('0x2b')][_0x6987('0x1b')]);_0x3496a8[_0x6987('0x1a')]=qs[_0x6987('0x1a')](_0x5bc203['query'][_0x6987('0x1a')]);}_0x3496a8[_0x6987('0x33')]=qs['sort'](_0x5bc203[_0x6987('0x2b')][_0x6987('0x34')]);_0x3496a8[_0x6987('0x35')]=qs[_0x6987('0x2d')](_['pick'](_0x5bc203[_0x6987('0x2b')],_0x1b014f['filters']),_0x170273);if(_0x5bc203['query']['filter']){_0x3496a8['where']=_['merge'](_0x3496a8[_0x6987('0x35')],{'$or':_['map'](_0x170273,function(_0x4d0cbc){if(_0x4d0cbc[_0x6987('0x36')]!==_0x6987('0x37')){var _0x38a0ce={};_0x38a0ce[_0x4d0cbc[_0x6987('0x25')]]={'$like':'%'+_0x5bc203['query'][_0x6987('0x38')]+'%'};return _0x38a0ce;}})});}_0x3496a8=_['merge']({},_0x3496a8,_0x5bc203[_0x6987('0x39')]);var _0x9d1d5c={'where':_0x3496a8[_0x6987('0x35')]};return db['OpenchannelApplication'][_0x6987('0x3a')](_0x9d1d5c)[_0x6987('0x22')](function(_0x32eb9d){_0x47ffef[_0x6987('0x3a')]=_0x32eb9d;if(_0x5bc203[_0x6987('0x2b')][_0x6987('0x3b')]){_0x3496a8[_0x6987('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6987('0x3d')](_0x3496a8);})[_0x6987('0x22')](function(_0x2cee36){_0x47ffef['rows']=_0x2cee36;return _0x47ffef;})[_0x6987('0x22')](respondWithFilteredResult(_0x20d113,_0x3496a8))['catch'](handleError(_0x20d113,null));};exports[_0x6987('0x3e')]=function(_0xcc0e95,_0x14992c){var _0x50b03c={'raw':!![],'where':{'id':_0xcc0e95[_0x6987('0x3f')]['id']}},_0x8c61eb={};_0x8c61eb[_0x6987('0x2a')]=_[_0x6987('0x2c')](db[_0x6987('0x40')][_0x6987('0x41')]);_0x8c61eb[_0x6987('0x2b')]=_[_0x6987('0x2c')](_0xcc0e95[_0x6987('0x2b')]);_0x8c61eb[_0x6987('0x2d')]=_['intersection'](_0x8c61eb[_0x6987('0x2a')],_0x8c61eb[_0x6987('0x2b')]);_0x50b03c[_0x6987('0x30')]=_[_0x6987('0x2e')](_0x8c61eb[_0x6987('0x2a')],qs[_0x6987('0x2f')](_0xcc0e95[_0x6987('0x2b')][_0x6987('0x2f')]));_0x50b03c['attributes']=_0x50b03c[_0x6987('0x30')]['length']?_0x50b03c[_0x6987('0x30')]:_0x8c61eb[_0x6987('0x2a')];if(_0xcc0e95[_0x6987('0x2b')][_0x6987('0x3b')]){_0x50b03c[_0x6987('0x3c')]=[{'all':!![]}];}_0x50b03c=_[_0x6987('0x42')]({},_0x50b03c,_0xcc0e95[_0x6987('0x39')]);return db['OpenchannelApplication']['find'](_0x50b03c)[_0x6987('0x22')](handleEntityNotFound(_0x14992c,null))[_0x6987('0x22')](respondWithResult(_0x14992c,null))[_0x6987('0x43')](handleError(_0x14992c,null));};exports[_0x6987('0x44')]=function(_0x40a804,_0xc8b4f4){return db[_0x6987('0x40')][_0x6987('0x44')](_0x40a804[_0x6987('0x45')],{})['then'](respondWithResult(_0xc8b4f4,0xc9))[_0x6987('0x43')](handleError(_0xc8b4f4,null));};exports[_0x6987('0x21')]=function(_0xbaa80a,_0x45f366){if(_0xbaa80a[_0x6987('0x45')]['id']){delete _0xbaa80a[_0x6987('0x45')]['id'];}return db[_0x6987('0x40')]['find']({'where':{'id':_0xbaa80a[_0x6987('0x3f')]['id']}})[_0x6987('0x22')](handleEntityNotFound(_0x45f366,null))[_0x6987('0x22')](saveUpdates(_0xbaa80a[_0x6987('0x45')],null))[_0x6987('0x22')](respondWithResult(_0x45f366,null))[_0x6987('0x43')](handleError(_0x45f366,null));};exports[_0x6987('0x46')]=function(_0x3e8507,_0x1f0739){return db[_0x6987('0x40')][_0x6987('0x47')]({'where':{'id':_0x3e8507['params']['id']}})[_0x6987('0x22')](handleEntityNotFound(_0x1f0739,null))[_0x6987('0x22')](removeEntity(_0x1f0739,null))[_0x6987('0x43')](handleError(_0x1f0739,null));}; \ No newline at end of file +var _0x2e1b=['model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','destroy','then','end','error','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key'];(function(_0x210466,_0x43dd0a){var _0x19ff5a=function(_0x54abd2){while(--_0x54abd2){_0x210466['push'](_0x210466['shift']());}};_0x19ff5a(++_0x43dd0a);}(_0x2e1b,0xe3));var _0xb2e1=function(_0x4c7207,_0x34c17e){_0x4c7207=_0x4c7207-0x0;var _0x5c3655=_0x2e1b[_0x4c7207];return _0x5c3655;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2e1('0x0'));var rimraf=require(_0xb2e1('0x1'));var zipdir=require(_0xb2e1('0x2'));var jsonpatch=require(_0xb2e1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb2e1('0x4'));var path=require(_0xb2e1('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2e1('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2e1('0x7'));var crypto=require(_0xb2e1('0x8'));var jsforce=require(_0xb2e1('0x9'));var deskjs=require(_0xb2e1('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb2e1('0xb'));var Papa=require(_0xb2e1('0xc'));var Redis=require('ioredis');var authService=require(_0xb2e1('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb2e1('0xe'));var hardwareService=require(_0xb2e1('0xf'));var logger=require(_0xb2e1('0x10'))(_0xb2e1('0x11'));var utils=require('../../config/utils');var config=require(_0xb2e1('0x12'));var db=require(_0xb2e1('0x13'))['db'];function respondWithStatusCode(_0x4855ae,_0x18f41c){_0x18f41c=_0x18f41c||0xcc;return function(_0x17aa98){if(_0x17aa98){return _0x4855ae[_0xb2e1('0x14')](_0x18f41c);}return _0x4855ae[_0xb2e1('0x15')](_0x18f41c)['end']();};}function respondWithResult(_0x1ebc5f,_0x15a9ab){_0x15a9ab=_0x15a9ab||0xc8;return function(_0x5dc0d5){if(_0x5dc0d5){return _0x1ebc5f[_0xb2e1('0x15')](_0x15a9ab)[_0xb2e1('0x16')](_0x5dc0d5);}};}function respondWithFilteredResult(_0x2cc2be,_0x4ff6bf){return function(_0x3ca3e6){if(_0x3ca3e6){var _0xe4ec3b=_0x3ca3e6[_0xb2e1('0x17')],_0x3f71fe=_0x4ff6bf['offset'],_0x5129f9=_0x4ff6bf[_0xb2e1('0x18')]+_0x4ff6bf[_0xb2e1('0x19')],_0x310665;if(_0x5129f9>=_0xe4ec3b){_0x5129f9=_0xe4ec3b;_0x310665=0xc8;}else{_0x310665=0xce;}_0x2cc2be[_0xb2e1('0x15')](_0x310665);return _0x2cc2be[_0xb2e1('0x1a')](_0xb2e1('0x1b'),_0x3f71fe+'-'+_0x5129f9+'/'+_0xe4ec3b)[_0xb2e1('0x16')](_0x3ca3e6);}return null;};}function patchUpdates(_0x53a20b){return function(_0x320ac3){try{jsonpatch['apply'](_0x320ac3,_0x53a20b,!![]);}catch(_0x37a60a){return BPromise[_0xb2e1('0x1c')](_0x37a60a);}return _0x320ac3['save']();};}function saveUpdates(_0x314ce8,_0x4de043){return function(_0xa0ab10){if(_0xa0ab10){return _0xa0ab10['update'](_0x314ce8)['then'](function(_0x50f70b){return _0x50f70b;});}return null;};}function removeEntity(_0x177241,_0x237cf7){return function(_0x311787){if(_0x311787){return _0x311787[_0xb2e1('0x1d')]()[_0xb2e1('0x1e')](function(){_0x177241[_0xb2e1('0x15')](0xcc)[_0xb2e1('0x1f')]();});}};}function handleEntityNotFound(_0x9d2f1d,_0x473a6e){return function(_0x71c31b){if(!_0x71c31b){_0x9d2f1d['sendStatus'](0x194);}return _0x71c31b;};}function handleError(_0x659c19,_0xe23d6a){_0xe23d6a=_0xe23d6a||0x1f4;return function(_0x27b421){logger[_0xb2e1('0x20')](_0x27b421['stack']);if(_0x27b421['name']){delete _0x27b421[_0xb2e1('0x21')];}_0x659c19[_0xb2e1('0x15')](_0xe23d6a)[_0xb2e1('0x22')](_0x27b421);};}exports[_0xb2e1('0x23')]=function(_0xd43f32,_0x78a1f7){var _0x4cc664={},_0x5b38cb={},_0x2431cd={'count':0x0,'rows':[]};var _0x30b269=_['map'](db[_0xb2e1('0x24')][_0xb2e1('0x25')],function(_0x3d1c41){return{'name':_0x3d1c41[_0xb2e1('0x26')],'type':_0x3d1c41[_0xb2e1('0x27')][_0xb2e1('0x28')]};});_0x5b38cb[_0xb2e1('0x29')]=_[_0xb2e1('0x2a')](_0x30b269,_0xb2e1('0x21'));_0x5b38cb[_0xb2e1('0x2b')]=_[_0xb2e1('0x2c')](_0xd43f32['query']);_0x5b38cb[_0xb2e1('0x2d')]=_[_0xb2e1('0x2e')](_0x5b38cb['model'],_0x5b38cb[_0xb2e1('0x2b')]);_0x4cc664[_0xb2e1('0x2f')]=_[_0xb2e1('0x2e')](_0x5b38cb['model'],qs[_0xb2e1('0x30')](_0xd43f32['query']['fields']));_0x4cc664[_0xb2e1('0x2f')]=_0x4cc664[_0xb2e1('0x2f')]['length']?_0x4cc664[_0xb2e1('0x2f')]:_0x5b38cb['model'];if(!_0xd43f32[_0xb2e1('0x2b')][_0xb2e1('0x31')]('nolimit')){_0x4cc664[_0xb2e1('0x19')]=qs[_0xb2e1('0x19')](_0xd43f32[_0xb2e1('0x2b')][_0xb2e1('0x19')]);_0x4cc664[_0xb2e1('0x18')]=qs[_0xb2e1('0x18')](_0xd43f32[_0xb2e1('0x2b')][_0xb2e1('0x18')]);}_0x4cc664[_0xb2e1('0x32')]=qs[_0xb2e1('0x33')](_0xd43f32[_0xb2e1('0x2b')][_0xb2e1('0x33')]);_0x4cc664[_0xb2e1('0x34')]=qs[_0xb2e1('0x2d')](_[_0xb2e1('0x35')](_0xd43f32[_0xb2e1('0x2b')],_0x5b38cb['filters']),_0x30b269);if(_0xd43f32[_0xb2e1('0x2b')][_0xb2e1('0x36')]){_0x4cc664[_0xb2e1('0x34')]=_[_0xb2e1('0x37')](_0x4cc664[_0xb2e1('0x34')],{'$or':_[_0xb2e1('0x2a')](_0x30b269,function(_0x4223c9){if(_0x4223c9[_0xb2e1('0x27')]!==_0xb2e1('0x38')){var _0x44bfc1={};_0x44bfc1[_0x4223c9[_0xb2e1('0x21')]]={'$like':'%'+_0xd43f32[_0xb2e1('0x2b')][_0xb2e1('0x36')]+'%'};return _0x44bfc1;}})});}_0x4cc664=_[_0xb2e1('0x37')]({},_0x4cc664,_0xd43f32[_0xb2e1('0x39')]);var _0x48522e={'where':_0x4cc664[_0xb2e1('0x34')]};return db[_0xb2e1('0x24')][_0xb2e1('0x17')](_0x48522e)['then'](function(_0x4c6df1){_0x2431cd[_0xb2e1('0x17')]=_0x4c6df1;if(_0xd43f32['query'][_0xb2e1('0x3a')]){_0x4cc664['include']=[{'all':!![]}];}return db[_0xb2e1('0x24')][_0xb2e1('0x3b')](_0x4cc664);})[_0xb2e1('0x1e')](function(_0x6de513){_0x2431cd[_0xb2e1('0x3c')]=_0x6de513;return _0x2431cd;})[_0xb2e1('0x1e')](respondWithFilteredResult(_0x78a1f7,_0x4cc664))['catch'](handleError(_0x78a1f7,null));};exports['show']=function(_0x17e8a0,_0xbba7a4){var _0x177042={'raw':!![],'where':{'id':_0x17e8a0[_0xb2e1('0x3d')]['id']}},_0x2dad7f={};_0x2dad7f[_0xb2e1('0x29')]=_[_0xb2e1('0x2c')](db[_0xb2e1('0x24')][_0xb2e1('0x25')]);_0x2dad7f[_0xb2e1('0x2b')]=_[_0xb2e1('0x2c')](_0x17e8a0[_0xb2e1('0x2b')]);_0x2dad7f[_0xb2e1('0x2d')]=_[_0xb2e1('0x2e')](_0x2dad7f[_0xb2e1('0x29')],_0x2dad7f[_0xb2e1('0x2b')]);_0x177042['attributes']=_['intersection'](_0x2dad7f['model'],qs[_0xb2e1('0x30')](_0x17e8a0[_0xb2e1('0x2b')][_0xb2e1('0x30')]));_0x177042[_0xb2e1('0x2f')]=_0x177042[_0xb2e1('0x2f')][_0xb2e1('0x3e')]?_0x177042[_0xb2e1('0x2f')]:_0x2dad7f[_0xb2e1('0x29')];if(_0x17e8a0['query'][_0xb2e1('0x3a')]){_0x177042['include']=[{'all':!![]}];}_0x177042=_[_0xb2e1('0x37')]({},_0x177042,_0x17e8a0['options']);return db[_0xb2e1('0x24')][_0xb2e1('0x3f')](_0x177042)[_0xb2e1('0x1e')](handleEntityNotFound(_0xbba7a4,null))['then'](respondWithResult(_0xbba7a4,null))[_0xb2e1('0x40')](handleError(_0xbba7a4,null));};exports['create']=function(_0x276dc0,_0x592d9f){return db[_0xb2e1('0x24')][_0xb2e1('0x41')](_0x276dc0['body'],{})['then'](respondWithResult(_0x592d9f,0xc9))[_0xb2e1('0x40')](handleError(_0x592d9f,null));};exports['update']=function(_0x3a4bca,_0x201267){if(_0x3a4bca[_0xb2e1('0x42')]['id']){delete _0x3a4bca[_0xb2e1('0x42')]['id'];}return db[_0xb2e1('0x24')][_0xb2e1('0x3f')]({'where':{'id':_0x3a4bca['params']['id']}})[_0xb2e1('0x1e')](handleEntityNotFound(_0x201267,null))[_0xb2e1('0x1e')](saveUpdates(_0x3a4bca[_0xb2e1('0x42')],null))[_0xb2e1('0x1e')](respondWithResult(_0x201267,null))[_0xb2e1('0x40')](handleError(_0x201267,null));};exports[_0xb2e1('0x1d')]=function(_0x568bbb,_0x529515){return db[_0xb2e1('0x24')][_0xb2e1('0x3f')]({'where':{'id':_0x568bbb[_0xb2e1('0x3d')]['id']}})[_0xb2e1('0x1e')](handleEntityNotFound(_0x529515,null))[_0xb2e1('0x1e')](removeEntity(_0x529515,null))[_0xb2e1('0x40')](handleError(_0x529515,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 08836a7..7e09a6f 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 _0x4d61=['bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x5262f0,_0x161c89){var _0x353ff9=function(_0x4e34a3){while(--_0x4e34a3){_0x5262f0['push'](_0x5262f0['shift']());}};_0x353ff9(++_0x161c89);}(_0x4d61,0xb2));var _0x14d6=function(_0xee18e4,_0x1835eb){_0xee18e4=_0xee18e4-0x0;var _0x5993a8=_0x4d61[_0xee18e4];return _0x5993a8;};'use strict';var _=require(_0x14d6('0x0'));var util=require('util');var logger=require(_0x14d6('0x1'))(_0x14d6('0x2'));var moment=require(_0x14d6('0x3'));var BPromise=require(_0x14d6('0x4'));var rp=require(_0x14d6('0x5'));var fs=require('fs');var path=require(_0x14d6('0x6'));var rimraf=require('rimraf');var config=require(_0x14d6('0x7'));var attributes=require(_0x14d6('0x8'));module[_0x14d6('0x9')]=function(_0x25bc42,_0x3869cd){return _0x25bc42[_0x14d6('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x14d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14d6('0xc'),'collate':_0x14d6('0xd')});}; \ No newline at end of file +var _0x0738=['../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1ccd67,_0x13dec0){var _0x126d97=function(_0x26e222){while(--_0x26e222){_0x1ccd67['push'](_0x1ccd67['shift']());}};_0x126d97(++_0x13dec0);}(_0x0738,0xbc));var _0x8073=function(_0x59ee91,_0x5ca1ef){_0x59ee91=_0x59ee91-0x0;var _0x51b0b7=_0x0738[_0x59ee91];return _0x51b0b7;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var logger=require(_0x8073('0x2'))(_0x8073('0x3'));var moment=require('moment');var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require(_0x8073('0x6'));var rimraf=require(_0x8073('0x7'));var config=require(_0x8073('0x8'));var attributes=require(_0x8073('0x9'));module[_0x8073('0xa')]=function(_0x46fe13,_0x700716){return _0x46fe13['define'](_0x8073('0xb'),attributes,{'tableName':_0x8073('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8073('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b0fd0bf..31bfc01 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x528d5d,_0x431c95){_0x528d5d=_0x528d5d-0x0;var _0x58e6c0=_0x5f2f[_0x528d5d];return _0x58e6c0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3a7743,_0x24bba8){var _0x6bd473=function(_0x1226f7){while(--_0x1226f7){_0x3a7743['push'](_0x3a7743['shift']());}};_0x6bd473(++_0x24bba8);}(_0xb10b,0x12a));var _0xbb10=function(_0x511907,_0x4ae413){_0x511907=_0x511907-0x0;var _0x5e58e6=_0xb10b[_0x511907];return _0x5e58e6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 15a383b..544b057 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 _0x3b32=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','delete','/:id/tags','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','describe','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b32,0x18b));var _0x23b3=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x3b32[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x23b3('0x0'));var util=require(_0x23b3('0x1'));var path=require(_0x23b3('0x2'));var timeout=require(_0x23b3('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x23b3('0x4'));var config=require(_0x23b3('0x5'));var controller=require(_0x23b3('0x6'));router['get']('/',auth[_0x23b3('0x7')](),controller[_0x23b3('0x8')]);router['get']('/describe',auth[_0x23b3('0x7')](),controller[_0x23b3('0x9')]);router[_0x23b3('0xa')](_0x23b3('0xb'),auth[_0x23b3('0x7')](),controller[_0x23b3('0xc')]);router[_0x23b3('0xa')](_0x23b3('0xd'),auth[_0x23b3('0x7')](),controller[_0x23b3('0xe')]);router[_0x23b3('0xa')](_0x23b3('0xf'),auth['isAuthenticated'](),controller[_0x23b3('0x10')]);router[_0x23b3('0x11')]('/',auth[_0x23b3('0x7')](),controller[_0x23b3('0x12')]);router[_0x23b3('0x11')](_0x23b3('0xd'),auth[_0x23b3('0x7')](),controller[_0x23b3('0x13')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x23b3('0x14'),_0x23b3('0x15')),controller['addTags']);router[_0x23b3('0x16')](_0x23b3('0xb'),auth[_0x23b3('0x7')](),interaction[_0x23b3('0x17')](_0x23b3('0x14'),_0x23b3('0x18')),controller[_0x23b3('0x19')]);router[_0x23b3('0x1a')](_0x23b3('0xb'),auth[_0x23b3('0x7')](),interaction['tracked'](_0x23b3('0x14'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x23b3('0x1a')](_0x23b3('0x1b'),auth['isAuthenticated'](),controller['removeTags']);module[_0x23b3('0x1c')]=router; \ No newline at end of file +var _0x9c30=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index'];(function(_0x152893,_0x19db68){var _0x5700ef=function(_0x3b5688){while(--_0x3b5688){_0x152893['push'](_0x152893['shift']());}};_0x5700ef(++_0x19db68);}(_0x9c30,0x1c4));var _0x09c3=function(_0x1167ab,_0x539fd6){_0x1167ab=_0x1167ab-0x0;var _0x188882=_0x9c30[_0x1167ab];return _0x188882;};'use strict';var multer=require('multer');var util=require(_0x09c3('0x0'));var path=require(_0x09c3('0x1'));var timeout=require(_0x09c3('0x2'));var express=require('express');var router=express[_0x09c3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c3('0x4'));var config=require(_0x09c3('0x5'));var controller=require(_0x09c3('0x6'));router[_0x09c3('0x7')]('/',auth[_0x09c3('0x8')](),controller[_0x09c3('0x9')]);router['get'](_0x09c3('0xa'),auth[_0x09c3('0x8')](),controller[_0x09c3('0xb')]);router[_0x09c3('0x7')](_0x09c3('0xc'),auth[_0x09c3('0x8')](),controller[_0x09c3('0xd')]);router[_0x09c3('0x7')](_0x09c3('0xe'),auth[_0x09c3('0x8')](),controller[_0x09c3('0xf')]);router[_0x09c3('0x7')](_0x09c3('0x10'),auth[_0x09c3('0x8')](),controller[_0x09c3('0x11')]);router[_0x09c3('0x12')]('/',auth['isAuthenticated'](),controller[_0x09c3('0x13')]);router[_0x09c3('0x12')](_0x09c3('0xe'),auth[_0x09c3('0x8')](),controller[_0x09c3('0x14')]);router[_0x09c3('0x12')]('/:id/tags',auth[_0x09c3('0x8')](),interaction['tracked'](_0x09c3('0x15'),_0x09c3('0x16')),controller[_0x09c3('0x17')]);router[_0x09c3('0x18')]('/:id',auth[_0x09c3('0x8')](),interaction[_0x09c3('0x19')](_0x09c3('0x15'),_0x09c3('0x1a')),controller[_0x09c3('0x1b')]);router[_0x09c3('0x1c')]('/:id',auth[_0x09c3('0x8')](),interaction[_0x09c3('0x19')](_0x09c3('0x15'),_0x09c3('0x1d')),controller[_0x09c3('0x1e')]);router[_0x09c3('0x1c')](_0x09c3('0x1f'),auth[_0x09c3('0x8')](),controller['removeTags']);module[_0x09c3('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 561d698..4633dd1 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 _0x729e=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x729e,0x138));var _0xe729=function(_0x326e77,_0x2c7c07){_0x326e77=_0x326e77-0x0;var _0x580fd1=_0x729e[_0x326e77];return _0x580fd1;};'use strict';var Sequelize=require(_0xe729('0x0'));module[_0xe729('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe729('0x2')]},'disposition':{'type':Sequelize[_0xe729('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe729('0x2')]},'threadId':{'type':Sequelize[_0xe729('0x3')]},'externalUrl':{'type':Sequelize[_0xe729('0x3')]},'lastMsgAt':{'type':Sequelize[_0xe729('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe729('0x4')]('in',_0xe729('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe729('0x3')]}}; \ No newline at end of file +var _0x3476=['sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x3476,0x1c2));var _0x6347=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x3476[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0x6347('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6347('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6347('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6347('0x3')]},'read1stAt':{'type':Sequelize[_0x6347('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x6347('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6347('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 286e455..d8a38e8 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 _0x25e0=['options','findAll','addTags','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','root','attachments','format','User','CmContact','Attachment','Messages','direction','secret','read','OpenchannelAccount','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','firstName','lastName','out','views','downloadInteraction.html','toFile','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','Users','fullname','Tags','TagIds','split','push','index','map','OpenchannelInteraction','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','length','find','unreadMessages','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','forEach','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','text','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','OpenchannelInteractionId','rows','catch','show','params','rawAttributes','includeAll','merge','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x25e0,0x11f));var _0x025e=function(_0x493a96,_0x173e5d){_0x493a96=_0x493a96-0x0;var _0x38bec0=_0x25e0[_0x493a96];return _0x38bec0;};'use strict';var pdf=require(_0x025e('0x0'));var emlformat=require(_0x025e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x025e('0x2'));var jsonpatch=require(_0x025e('0x3'));var rp=require(_0x025e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x025e('0x5'));var util=require('util');var path=require(_0x025e('0x6'));var sox=require(_0x025e('0x7'));var csv=require(_0x025e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x025e('0x9'));var squel=require('squel');var crypto=require(_0x025e('0xa'));var jsforce=require(_0x025e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x025e('0xc'));var Papa=require(_0x025e('0xd'));var Redis=require(_0x025e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x025e('0xf'));var hardwareService=require(_0x025e('0x10'));var logger=require(_0x025e('0x11'))(_0x025e('0x12'));var utils=require('../../config/utils');var config=require(_0x025e('0x13'));var db=require(_0x025e('0x14'))['db'];config[_0x025e('0x15')]=_[_0x025e('0x16')](config[_0x025e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x025e('0x17'))(new Redis(config[_0x025e('0x15')]));require(_0x025e('0x18'))['register'](socket);function respondWithStatusCode(_0x5055c8,_0x36a9c3){_0x36a9c3=_0x36a9c3||0xcc;return function(_0x5d9d5e){if(_0x5d9d5e){return _0x5055c8[_0x025e('0x19')](_0x36a9c3);}return _0x5055c8[_0x025e('0x1a')](_0x36a9c3)['end']();};}function respondWithResult(_0x456e4c,_0x315f92){_0x315f92=_0x315f92||0xc8;return function(_0x190a59){if(_0x190a59){return _0x456e4c[_0x025e('0x1a')](_0x315f92)[_0x025e('0x1b')](_0x190a59);}};}function respondWithFilteredResult(_0x2d7dc5,_0x23c48e){return function(_0x39d4ba){if(_0x39d4ba){var _0x234c8c=_0x39d4ba['count'],_0x21c928=_0x23c48e['offset'],_0x84943d=_0x23c48e['offset']+_0x23c48e['limit'],_0x41d669;if(_0x84943d>=_0x234c8c){_0x84943d=_0x234c8c;_0x41d669=0xc8;}else{_0x41d669=0xce;}_0x2d7dc5[_0x025e('0x1a')](_0x41d669);return _0x2d7dc5['set'](_0x025e('0x1c'),_0x21c928+'-'+_0x84943d+'/'+_0x234c8c)[_0x025e('0x1b')](_0x39d4ba);}return null;};}function patchUpdates(_0x289138){return function(_0x135671){try{jsonpatch[_0x025e('0x1d')](_0x135671,_0x289138,!![]);}catch(_0x115b3e){return BPromise[_0x025e('0x1e')](_0x115b3e);}return _0x135671[_0x025e('0x1f')]();};}function saveUpdates(_0x5a5c1a,_0x46e468){return function(_0x3f72db){if(_0x3f72db){return _0x3f72db[_0x025e('0x20')](_0x5a5c1a)[_0x025e('0x21')](function(_0x1d5f4a){return _0x1d5f4a;});}return null;};}function removeEntity(_0x2f1127,_0x564586){return function(_0x3388b9){if(_0x3388b9){return _0x3388b9[_0x025e('0x22')]()[_0x025e('0x21')](function(){_0x2f1127['status'](0xcc)[_0x025e('0x23')]();});}};}function handleEntityNotFound(_0x1218cc,_0x25487c){return function(_0x203e44){if(!_0x203e44){_0x1218cc[_0x025e('0x19')](0x194);}return _0x203e44;};}function handleError(_0x1b9b91,_0x38ad93){_0x38ad93=_0x38ad93||0x1f4;return function(_0x24264c){logger[_0x025e('0x24')](_0x24264c[_0x025e('0x25')]);if(_0x24264c[_0x025e('0x26')]){delete _0x24264c['name'];}_0x1b9b91[_0x025e('0x1a')](_0x38ad93)['send'](_0x24264c);};}function getInteractionUsers(_0x513432,_0x38e95d){return new BPromise(function(_0x45ad1d,_0x36057e){try{if(_0x38e95d[_0x513432['id']]){_0x513432[_0x025e('0x27')]=_['map'](_0x38e95d[_0x513432['id']],function(_0x49875c){return{'id':_0x49875c['id'],'fullname':_0x49875c[_0x025e('0x28')]};});}}catch(_0x265733){_0x36057e(_0x265733);}_0x45ad1d(_0x513432);});}function getInteractionTags(_0x4054df,_0x196747){return new BPromise(function(_0xd1b72c,_0x2f2704){try{if(_0x4054df['TagIds']){_0x4054df[_0x025e('0x29')]=[];_0x4054df[_0x025e('0x2a')][_0x025e('0x2b')](',')['forEach'](function(_0x1159d9){_0x4054df[_0x025e('0x29')][_0x025e('0x2c')](_0x196747[_0x1159d9]);});}delete _0x4054df[_0x025e('0x2a')];}catch(_0x371050){_0x2f2704(_0x371050);}_0xd1b72c(_0x4054df);});}function updateOpenchannelInteraction(_0x33c209,_0x3ad608,_0x53d83a){return new BPromise(function(_0x40a7f2,_0x20cf51){return getInteractionUsers(_0x33c209,_0x53d83a)['then'](function(_0x392ebd){return getInteractionTags(_0x392ebd,_0x3ad608);})[_0x025e('0x21')](function(_0x5d4f31){_0x40a7f2(_0x5d4f31);})['catch'](function(_0x40fe3b){_0x20cf51(_0x40fe3b);});});}exports[_0x025e('0x2d')]=function(_0x9763ad,_0x5174b1){var _0x3ec87a={},_0x32af90={},_0x78ecd={'count':0x0,'rows':[]};var _0x273ff5=_[_0x025e('0x2e')](db[_0x025e('0x2f')]['rawAttributes'],function(_0x6d537e){return{'name':_0x6d537e[_0x025e('0x30')],'type':_0x6d537e['type'][_0x025e('0x31')]};});_0x32af90[_0x025e('0x32')]=_['map'](_0x273ff5,_0x025e('0x26'));_0x32af90[_0x025e('0x33')]=_[_0x025e('0x34')](_0x9763ad[_0x025e('0x33')]);_0x32af90[_0x025e('0x35')]=_['intersection'](_0x32af90[_0x025e('0x32')],_0x32af90[_0x025e('0x33')]);_0x3ec87a[_0x025e('0x36')]=_[_0x025e('0x37')](_0x32af90['model'],qs[_0x025e('0x38')](_0x9763ad[_0x025e('0x33')]['fields']));_0x3ec87a['attributes']=_0x3ec87a[_0x025e('0x36')]['length']?_0x3ec87a[_0x025e('0x36')]:_0x32af90[_0x025e('0x32')];if(!_0x9763ad['query'][_0x025e('0x39')](_0x025e('0x3a'))){_0x3ec87a[_0x025e('0x3b')]=qs[_0x025e('0x3b')](_0x9763ad[_0x025e('0x33')][_0x025e('0x3b')]);_0x3ec87a[_0x025e('0x3c')]=qs[_0x025e('0x3c')](_0x9763ad[_0x025e('0x33')]['offset']);}_0x3ec87a[_0x025e('0x3d')]=qs[_0x025e('0x3e')](_0x9763ad[_0x025e('0x33')][_0x025e('0x3e')]);_0x3ec87a[_0x025e('0x3f')]=qs[_0x025e('0x35')](_[_0x025e('0x40')](_0x9763ad['query'],_0x32af90['filters']),_0x273ff5);var _0x19df33=[];var _0x3e4879=squel[_0x025e('0x41')]()['field']('id')[_0x025e('0x42')](_0x025e('0x26'))[_0x025e('0x42')]('color')[_0x025e('0x43')](_0x025e('0x44'));var _0x1666b4=squel[_0x025e('0x41')]()[_0x025e('0x42')](_0x025e('0x45'))[_0x025e('0x42')](_0x025e('0x46'))[_0x025e('0x42')](_0x025e('0x47'))[_0x025e('0x43')](_0x025e('0x48'),'ui')[_0x025e('0x49')](_0x025e('0x4a'),'u',_0x025e('0x4b'));var _0x44426d=squel[_0x025e('0x41')]()[_0x025e('0x43')]('openchannel_interactions','i')['left_join'](_0x025e('0x4c'),'c',_0x025e('0x4d'))[_0x025e('0x49')](_0x025e('0x4a'),'o',_0x025e('0x4e'))[_0x025e('0x49')](_0x025e('0x4f'),'a',_0x025e('0x50'))[_0x025e('0x49')]('openchannel_messages','me',_0x025e('0x51'))[_0x025e('0x49')]('openchannel_interaction_has_tags','it',_0x025e('0x52'))['left_join'](_0x025e('0x44'),'t','t.id\x20=\x20it.TagId');var _0x41609b=squel[_0x025e('0x53')]();var _0x5c2915=[];var _0x2ff049=squel[_0x025e('0x53')]();var _0x4b4733;if(_0x9763ad[_0x025e('0x33')]['search']){_0x4b4733=as[_0x025e('0x54')](_0x9763ad[_0x025e('0x33')]['search']);var _0x39505e=_0x4b4733[_0x025e('0x55')];for(var _0x179a20=0x0;_0x179a20<_0x4b4733[_0x025e('0x56')][_0x025e('0x57')];_0x179a20++){var _0x5c25ce=_0x4b4733[_0x025e('0x56')][_0x179a20];var _0x2d5460='i';var _0x3fd2bf=_[_0x025e('0x58')](_0x273ff5,[_0x025e('0x26'),_0x5c25ce[_0x025e('0x42')]]);if(!_0x3fd2bf){switch(_0x5c25ce[_0x025e('0x42')]){case _0x025e('0x59'):if(_0x5c25ce['value']==0x1){_0x44426d['having']('`'+_0x5c25ce[_0x025e('0x42')]+_0x025e('0x5a'));}else{_0x44426d['having']('`'+_0x5c25ce[_0x025e('0x42')]+'`\x20>\x200');}break;case _0x025e('0x5b'):if(_0x5c25ce[_0x025e('0x5c')]===_0x025e('0x5d')){if(_0x5c25ce[_0x025e('0x5e')][_0x025e('0x2b')]('\x20')[_0x025e('0x57')]>0x1){_0x41609b[_0x39505e](_0x025e('0x5f'),qs[_0x025e('0x60')](_0x5c25ce[_0x025e('0x5e')]),null);}else{var _0x46e4ac='%'+_0x5c25ce['value']+'%';_0x41609b[_0x39505e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x46e4ac,_0x46e4ac,_0x46e4ac);}}else{_0x3fd2bf=_[_0x025e('0x58')](_0x273ff5,[_0x025e('0x26'),'ContactId']);_0x5c25ce['field']=_0x025e('0x61');_0x2e19c6=as[_0x025e('0x62')](_0x2d5460,_0x3fd2bf['type'],_0x5c25ce);_0x41609b[_0x39505e](_0x2e19c6['text'],_0x2e19c6['value'][_0x025e('0x63')],_0x2e19c6[_0x025e('0x5e')][_0x025e('0x23')]);}break;case _0x025e('0x64'):var _0xabf806=_0x5c25ce['value']['split'](',')[_0x025e('0x2e')](function(_0x538eaa){return Number(_0x538eaa);});_0xabf806[_0x025e('0x65')](function(_0x1f3841){_0x2ff049['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f3841+',%');});_0x5c2915=_[_0x025e('0x66')](_0x5c2915,_0xabf806);break;case'User':if(_0x5c25ce['operator']===_0x025e('0x5d')){_0x41609b[_0x39505e](_0x025e('0x67'),'%'+_0x5c25ce['value']+'%',null);}else{_0x3fd2bf=_[_0x025e('0x58')](_0x273ff5,[_0x025e('0x26'),_0x025e('0x68')]);_0x5c25ce[_0x025e('0x42')]=_0x025e('0x68');_0x2e19c6=as[_0x025e('0x62')](_0x2d5460,_0x3fd2bf[_0x025e('0x69')],_0x5c25ce);_0x41609b[_0x39505e](_0x2e19c6[_0x025e('0x6a')],_0x2e19c6['value'][_0x025e('0x63')],_0x2e19c6['value'][_0x025e('0x23')]);}break;case'body':_0x2e19c6=as['buildExpression']('me',null,_0x5c25ce);_0x41609b[_0x39505e](_0x2e19c6['text'],_0x2e19c6[_0x025e('0x5e')][_0x025e('0x63')],_0x2e19c6[_0x025e('0x5e')][_0x025e('0x23')]);break;}}else{var _0x2e19c6=as[_0x025e('0x62')](_0x2d5460,_0x3fd2bf['type'],_0x5c25ce);_0x41609b[_0x39505e](_0x2e19c6[_0x025e('0x6a')],_0x2e19c6[_0x025e('0x5e')][_0x025e('0x63')],_0x2e19c6[_0x025e('0x5e')][_0x025e('0x23')]);}}}else{var _0x175981=_(_0x9763ad[_0x025e('0x33')])[_0x025e('0x34')]()[_0x025e('0x2e')](function(_0x568729){return _[_0x025e('0x6b')](_0x273ff5,['name',_0x568729])?_0x568729:undefined;})[_0x025e('0x6c')]()[_0x025e('0x5e')]();if(!_[_0x025e('0x6d')](_0x175981)){_0x175981[_0x025e('0x65')](function(_0xa33552){if(_0xa33552===_0x025e('0x6e')){_0x44426d['where'](_0x025e('0x6f'),[][_0x025e('0x70')](_0x9763ad['query'][_0xa33552]));}else if(_0xa33552===_0x025e('0x71')){var _0x1a43fa=JSON[_0x025e('0x72')](_0x9763ad['query'][_0xa33552])[_0x025e('0x73')];var _0xb35ec8=JSON['parse'](_0x9763ad['query'][_0xa33552])[_0x025e('0x74')];_0x44426d[_0x025e('0x3f')](_0x025e('0x75'),_0x1a43fa,_0xb35ec8);}else{if(_0x9763ad[_0x025e('0x33')][_0xa33552]===_0x025e('0x76')){_0x44426d['where']('i.'+_0xa33552+'\x20IS\x20NULL');}else{_0x44426d[_0x025e('0x3f')]('i.'+_0xa33552+_0x025e('0x77'),_0x9763ad['query'][_0xa33552]);}}});}if(_0x9763ad[_0x025e('0x33')]['read']){if(_0x9763ad[_0x025e('0x33')]['read']==0x1){_0x44426d[_0x025e('0x78')](_0x025e('0x79'));}else{_0x44426d[_0x025e('0x78')](_0x025e('0x7a'));}}if(_0x9763ad['query'][_0x025e('0x7b')]){_0x5c2915=_[_0x025e('0x7c')](_0x9763ad['query'][_0x025e('0x7b')])?_0x9763ad[_0x025e('0x33')][_0x025e('0x7b')]:new Array(_0x9763ad[_0x025e('0x33')][_0x025e('0x7b')]);_0x5c2915[_0x025e('0x65')](function(_0x4e5742){_0x2ff049['or'](_0x025e('0x7d'),'%,'+_0x4e5742+',%');});}if(_0x9763ad[_0x025e('0x33')]['filter']){var _0xbaac54=_0x9763ad['query'][_0x025e('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x025e('0x7f')]('\x27\x27',_0x025e('0x80'));if(qs[_0x025e('0x81')](_0xbaac54)){_0x41609b['or']('i.id\x20LIKE\x20?',_0xbaac54+'%');}else{_0x41609b['or'](_0x025e('0x82'),qs[_0x025e('0x60')](_0xbaac54))['or'](_0x025e('0x83'),_0xbaac54+'%')['or'](_0x025e('0x84'),_0xbaac54+'%');}}}_0x44426d[_0x025e('0x3f')](_0x41609b);_0x44426d[_0x025e('0x85')](_0x025e('0x86'));var _0x53c095={'type':db['Sequelize'][_0x025e('0x87')][_0x025e('0x88')],'raw':!![]};var _0x14a18b=_0x44426d[_0x025e('0x89')]();_0x14a18b[_0x025e('0x42')](_0x025e('0x86'));_0x14a18b[_0x025e('0x42')](_0x025e('0x8a'),_0x025e('0x59'));if(_0x3ec87a[_0x025e('0x3d')]){_0x3ec87a[_0x025e('0x3d')]['forEach'](function(_0x546885){_0x44426d[_0x025e('0x3d')]('i.'+_0x546885[0x0],_0x546885[0x1]===_0x025e('0x8b')?![]:!![]);});}if(!_[_0x025e('0x6d')](_0x5c2915)){_0x44426d[_0x025e('0x78')](_0x2ff049);_0x14a18b['where'](_0x025e('0x8c'),_0x5c2915);}BPromise[_0x025e('0x8d')]()['then'](function(){if(!_0x4b4733){if(_0x9763ad['query'][_0x025e('0x6e')]||_0x9763ad[_0x025e('0x33')][_0x025e('0x8e')])return;_0x14a18b['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x44426d[_0x025e('0x3f')](_0x025e('0x8f'));return;}return _0x9763ad['user'][_0x025e('0x90')]({'attributes':['id'],'raw':!![]})[_0x025e('0x21')](function(_0x5c553a){if(_[_0x025e('0x6d')](_0x5c553a)){_0x14a18b['where'](_0x025e('0x91'));_0x44426d['where'](_0x025e('0x91'));}else{_0x14a18b[_0x025e('0x3f')](_0x025e('0x6f'),_['map'](_0x5c553a,'id'));_0x44426d[_0x025e('0x3f')](_0x025e('0x6f'),_[_0x025e('0x2e')](_0x5c553a,'id'));}});})[_0x025e('0x21')](function(){db[_0x025e('0x92')][_0x025e('0x33')](_0x14a18b[_0x025e('0x93')](),_0x53c095)[_0x025e('0x21')](function(_0x140d6e){_0x78ecd[_0x025e('0x94')]=_0x140d6e[_0x025e('0x57')];if(_0x78ecd[_0x025e('0x94')]===0x0)return[];return db['sequelize'][_0x025e('0x33')](_0x3e4879['toString'](),_0x53c095)[_0x025e('0x21')](function(_0x3b6ffe){_0x19df33=_[_0x025e('0x95')](_0x3b6ffe,'id');_0x53c095=_['merge'](_0x53c095,{'model':db[_0x025e('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9763ad[_0x025e('0x33')][_0x025e('0x38')]){_0x3ec87a[_0x025e('0x36')][_0x025e('0x65')](function(_0x90e0c6){_0x44426d[_0x025e('0x42')]('i.'+_0x90e0c6);});}else{_0x44426d[_0x025e('0x42')](_0x025e('0x8a'),_0x025e('0x59'));_0x44426d['field'](_0x025e('0x96'),_0x025e('0x97'));_0x44426d[_0x025e('0x42')]('a.mandatoryDisposition',_0x025e('0x98'));_0x44426d['field']('i.*');_0x44426d[_0x025e('0x42')]('c.firstName','Contact.firstName');_0x44426d[_0x025e('0x42')](_0x025e('0x99'),_0x025e('0x9a'));_0x44426d[_0x025e('0x42')](_0x025e('0x9b'),_0x025e('0x9c'));_0x44426d['field'](_0x025e('0x9d'),'Contact.phone');_0x44426d['field'](_0x025e('0x9e'),_0x025e('0x9f'));_0x44426d[_0x025e('0x42')](_0x025e('0xa0'),_0x025e('0xa1'));_0x44426d[_0x025e('0x42')](_0x025e('0xa2'),_0x025e('0xa3'));_0x44426d[_0x025e('0x42')](_0x025e('0xa4'),_0x025e('0xa5'));_0x44426d[_0x025e('0x42')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3ec87a[_0x025e('0x3b')])_0x44426d[_0x025e('0x3b')](_0x3ec87a[_0x025e('0x3b')]);if(_0x3ec87a['offset'])_0x44426d[_0x025e('0x3c')](_0x3ec87a[_0x025e('0x3c')]);return db[_0x025e('0x92')][_0x025e('0x33')](_0x44426d[_0x025e('0x93')](),_0x53c095);})[_0x025e('0x21')](function(_0x3e8218){_0x1666b4[_0x025e('0x3f')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x3e8218,'id'));return db[_0x025e('0x92')][_0x025e('0x33')](_0x1666b4['toString'](),_0x53c095)[_0x025e('0x21')](function(_0x89abe2){var _0x2ae6d8=_['groupBy'](_0x89abe2,_0x025e('0xa6'));var _0x55445c=[];_0x3e8218['forEach'](function(_0x396f3c){_0x55445c[_0x025e('0x2c')](updateOpenchannelInteraction(_0x396f3c,_0x19df33,_0x2ae6d8));});return BPromise['all'](_0x55445c);});});})['then'](function(_0x2f7083){_0x78ecd[_0x025e('0xa7')]=_0x2f7083;return _0x78ecd;})['then'](respondWithFilteredResult(_0x5174b1,_0x3ec87a));})[_0x025e('0xa8')](handleError(_0x5174b1,null));};exports[_0x025e('0xa9')]=function(_0xb437b6,_0x3fab4d){var _0x113d2a={'raw':![],'where':{'id':_0xb437b6[_0x025e('0xaa')]['id']}},_0x22dc90={};_0x22dc90[_0x025e('0x32')]=_[_0x025e('0x34')](db['OpenchannelInteraction'][_0x025e('0xab')]);_0x22dc90['query']=_[_0x025e('0x34')](_0xb437b6[_0x025e('0x33')]);_0x22dc90[_0x025e('0x35')]=_[_0x025e('0x37')](_0x22dc90[_0x025e('0x32')],_0x22dc90['query']);_0x113d2a['attributes']=_[_0x025e('0x37')](_0x22dc90[_0x025e('0x32')],qs[_0x025e('0x38')](_0xb437b6['query'][_0x025e('0x38')]));_0x113d2a['attributes']=_0x113d2a[_0x025e('0x36')][_0x025e('0x57')]?_0x113d2a['attributes']:_0x22dc90[_0x025e('0x32')];if(_0xb437b6['query'][_0x025e('0xac')]){_0x113d2a['include']=[{'all':!![]}];}_0x113d2a=_[_0x025e('0xad')]({},_0x113d2a,_0xb437b6['options']);return db['OpenchannelInteraction'][_0x025e('0x58')](_0x113d2a)['then'](handleEntityNotFound(_0x3fab4d,null))[_0x025e('0x21')](respondWithResult(_0x3fab4d,null))[_0x025e('0xa8')](handleError(_0x3fab4d,null));};exports['create']=function(_0x4ad6f1,_0xbb6ece){return db[_0x025e('0x2f')][_0x025e('0xae')](_0x4ad6f1[_0x025e('0xaf')],{})['then'](respondWithResult(_0xbb6ece,0xc9))['catch'](handleError(_0xbb6ece,null));};exports[_0x025e('0x20')]=function(_0x25d0cb,_0x208890){if(_0x25d0cb[_0x025e('0xaf')]['id']){delete _0x25d0cb['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x25d0cb['params']['id']}})[_0x025e('0x21')](handleEntityNotFound(_0x208890,null))[_0x025e('0x21')](saveUpdates(_0x25d0cb[_0x025e('0xaf')],null))[_0x025e('0x21')](respondWithResult(_0x208890,null))['catch'](handleError(_0x208890,null));};exports[_0x025e('0x22')]=function(_0x29a730,_0x19737d){return db[_0x025e('0x2f')]['find']({'where':{'id':_0x29a730[_0x025e('0xaa')]['id']}})[_0x025e('0x21')](handleEntityNotFound(_0x19737d,null))[_0x025e('0x21')](removeEntity(_0x19737d,null))['catch'](handleError(_0x19737d,null));};exports['describe']=function(_0x525da6,_0x32d9e6){return db[_0x025e('0x2f')][_0x025e('0xb0')]()[_0x025e('0x21')](respondWithResult(_0x32d9e6,null))[_0x025e('0xa8')](handleError(_0x32d9e6,null));};exports[_0x025e('0xb1')]=function(_0x358004,_0x9f1bf3,_0x5cf4b1){return db[_0x025e('0xb2')][_0x025e('0x58')]({'where':{'id':_0x358004[_0x025e('0xaa')]['id']}})[_0x025e('0x21')](handleEntityNotFound(_0x9f1bf3,null))[_0x025e('0x21')](function(_0x1be669){if(_0x1be669){return _0x1be669[_0x025e('0xb1')](_0x358004[_0x025e('0xaf')][_0x025e('0xb3')],_[_0x025e('0xb4')](_0x358004[_0x025e('0xaf')],[_0x025e('0xb3'),'id'])||{});}})[_0x025e('0x21')](respondWithResult(_0x9f1bf3,null))[_0x025e('0xa8')](handleError(_0x9f1bf3,null));};exports[_0x025e('0xb5')]=function(_0xa7fedc,_0x1bd9dd,_0x4cf908){var _0x164611={'raw':![],'where':{}};var _0x23beb7={};var _0x3ce031={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x025e('0xb6')]({'where':{'id':_0xa7fedc['params']['id']}})['then'](handleEntityNotFound(_0x1bd9dd,null))[_0x025e('0x21')](function(_0x4f0bf0){if(_0x4f0bf0){_0x23beb7[_0x025e('0x32')]=_[_0x025e('0x34')](db[_0x025e('0xb2')]['rawAttributes']);_0x23beb7[_0x025e('0x33')]=_['keys'](_0xa7fedc[_0x025e('0x33')]);_0x23beb7[_0x025e('0x35')]=_[_0x025e('0x37')](_0x23beb7['model'],_0x23beb7[_0x025e('0x33')]);_0x164611[_0x025e('0x36')]=_['intersection'](_0x23beb7['model'],qs['fields'](_0xa7fedc['query'][_0x025e('0x38')]));_0x164611[_0x025e('0x36')]=_0x164611[_0x025e('0x36')][_0x025e('0x57')]?_0x164611['attributes']:_0x23beb7['model'];if(!_0xa7fedc[_0x025e('0x33')][_0x025e('0x39')](_0x025e('0x3a'))){_0x164611['limit']=qs[_0x025e('0x3b')](_0xa7fedc['query'][_0x025e('0x3b')]);_0x164611['offset']=qs[_0x025e('0x3c')](_0xa7fedc['query']['offset']);}_0x164611[_0x025e('0x3d')]=qs[_0x025e('0x3e')](_0xa7fedc['query'][_0x025e('0x3e')]);_0x164611[_0x025e('0x3f')]=qs[_0x025e('0x35')](_[_0x025e('0x40')](_0xa7fedc[_0x025e('0x33')],_0x23beb7[_0x025e('0x35')]));_0x164611[_0x025e('0x3f')][_0x025e('0xa6')]=_0x4f0bf0['id'];if(_0xa7fedc['query']['filter']){_0x164611[_0x025e('0x3f')]=_['merge'](_0x164611[_0x025e('0x3f')],{'$or':_[_0x025e('0x2e')](_0x164611[_0x025e('0x36')],function(_0x4e5e63){var _0x2ed9cd={};_0x2ed9cd[_0x4e5e63]={'$like':'%'+_0xa7fedc[_0x025e('0x33')][_0x025e('0x7e')]+'%'};return _0x2ed9cd;})});}if(_0xa7fedc[_0x025e('0x33')]['$gte']){var _0x3e6503=_0xa7fedc[_0x025e('0x33')]['$gte'][_0x025e('0x2b')](',');var _0x29385d={};_0x29385d[_0x3e6503[0x0]]={'$gte':moment(_0x3e6503[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x164611['where']=_[_0x025e('0xad')](_0x164611[_0x025e('0x3f')],_0x29385d);}_0x164611=_[_0x025e('0xad')]({},_0x164611,_0xa7fedc[_0x025e('0xb7')]);return db[_0x025e('0xb2')][_0x025e('0x94')]({'where':_0x164611['where']})[_0x025e('0x21')](function(_0x11ebb1){_0x3ce031[_0x025e('0x94')]=_0x11ebb1;if(_0xa7fedc['query'][_0x025e('0xac')]){_0x164611['include']=[{'all':!![]}];}return db[_0x025e('0xb2')][_0x025e('0xb8')](_0x164611);})[_0x025e('0x21')](function(_0x273332){_0x3ce031[_0x025e('0xa7')]=_0x273332;return _0x3ce031;});}})[_0x025e('0x21')](respondWithFilteredResult(_0x1bd9dd,_0x164611))[_0x025e('0xa8')](handleError(_0x1bd9dd,null));};exports[_0x025e('0xb9')]=function(_0x1d1caf,_0x1081ea,_0xf2d05b){return db[_0x025e('0x2f')][_0x025e('0x58')]({'where':{'id':_0x1d1caf[_0x025e('0xaa')]['id']}})[_0x025e('0x21')](handleEntityNotFound(_0x1081ea,null))[_0x025e('0x21')](function(_0x2795c1){if(_0x2795c1){return _0x2795c1['setTags'](_0x1d1caf[_0x025e('0xaf')][_0x025e('0xb3')],_[_0x025e('0xb4')](_0x1d1caf[_0x025e('0xaf')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x025e('0xb8')]({'attributes':['id','name',_0x025e('0xba')],'where':{'id':_0x1d1caf[_0x025e('0xaf')][_0x025e('0xb3')]}});})['then'](function(_0x4d8b32){socket[_0x025e('0xbb')](_0x025e('0xbc'),{'id':Number(_0x1d1caf[_0x025e('0xaa')]['id']),'tags':_0x4d8b32||[]});return{'id':Number(_0x1d1caf['params']['id']),'tags':_0x4d8b32||[]};});}})[_0x025e('0x21')](respondWithResult(_0x1081ea,null))[_0x025e('0xa8')](handleError(_0x1081ea,null));};exports[_0x025e('0xbd')]=function(_0x6cb786,_0x313d48,_0x5df053){return db[_0x025e('0x2f')][_0x025e('0x58')]({'where':{'id':_0x6cb786['params']['id']}})[_0x025e('0x21')](handleEntityNotFound(_0x313d48,null))[_0x025e('0x21')](function(_0xa9a29c){if(_0xa9a29c){return _0xa9a29c[_0x025e('0xbd')](_0x6cb786[_0x025e('0x33')][_0x025e('0xb3')]);}})[_0x025e('0x21')](respondWithStatusCode(_0x313d48,null))[_0x025e('0xa8')](handleError(_0x313d48,null));};exports[_0x025e('0xbe')]=function(_0x971164,_0xfbdfed){var _0x35a3b8=moment()[_0x025e('0xbf')]()[_0x025e('0x93')]();var _0x3b8fb6=path[_0x025e('0xc0')](config['root'],_0x025e('0xc1'),_0x025e('0xc2'),'tmp');var _0x454067=path[_0x025e('0xc0')](config[_0x025e('0xc3')],_0x025e('0xc1'),_0x025e('0xc2'),_0x025e('0xc4'));var _0x1ec3fa=path[_0x025e('0xc0')](_0x3b8fb6,_0x35a3b8);var _0x296367=util[_0x025e('0xc5')]('transcript-%d-%s.zip',_0x971164[_0x025e('0xaa')]['id'],_0x35a3b8);var _0x241d30=path[_0x025e('0xc0')](_0x3b8fb6,_0x296367);var _0x1fe849=[];_0x1fe849['push']({'model':db[_0x025e('0xc6')],'as':_0x025e('0xc6'),'attributes':['id',_0x025e('0x28')],'raw':!![]});_0x1fe849[_0x025e('0x2c')]({'model':db[_0x025e('0xc7')],'as':_0x025e('0x5b'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x971164['query'][_0x025e('0xc4')]){_0x1fe849[_0x025e('0x2c')]({'model':db[_0x025e('0xc8')],'as':_0x025e('0xc8'),'raw':!![]});}var _0x4f8ec2=[{'model':db[_0x025e('0xb2')],'as':_0x025e('0xc9'),'attributes':['id',_0x025e('0xaf'),'createdAt',_0x025e('0xca'),_0x025e('0xcb'),_0x025e('0xcc')],'include':_0x1fe849}];_0x4f8ec2[_0x025e('0x2c')]({'model':db[_0x025e('0xcd')],'as':'Account','attributes':['id',_0x025e('0x26')]});_0x4f8ec2[_0x025e('0x2c')]({'model':db[_0x025e('0xc6')],'as':'Owner','attributes':['id',_0x025e('0x28')]});return db[_0x025e('0x2f')][_0x025e('0x58')]({'where':{'id':_0x971164[_0x025e('0xaa')]['id']},'include':_0x4f8ec2})[_0x025e('0x21')](handleEntityNotFound(_0xfbdfed,null))[_0x025e('0x21')](function(_0x46b589){if(_0x46b589){var _0x489cf9=_0x46b589[_0x025e('0xce')]({'plain':!![]});fs['mkdirSync'](_0x1ec3fa);var _0x775f21={'format':'A4','border':_0x025e('0xcf'),'header':{'height':_0x025e('0xd0'),'contents':{'first':_0x025e('0xd1')}},'footer':{'height':_0x025e('0xd2'),'contents':{'default':util[_0x025e('0xc5')](_0x025e('0xd3'),util[_0x025e('0xc5')](_0x025e('0xd4'),'Openchannel',_0x489cf9['id']),moment()['format']('YYYY-MM-DD')[_0x025e('0x93')]())}}};var _0x430557={'channel':_0x025e('0xd5'),'account':_0x489cf9['Account'][_0x025e('0x26')],'agent':_0x489cf9['Owner']?_0x489cf9[_0x025e('0xd6')][_0x025e('0x28')]:'N.A.','createdAt':moment(_0x489cf9['createdAt'])[_0x025e('0xc5')](_0x025e('0xd7'))[_0x025e('0x93')](),'closedAt':_0x489cf9['closed']?moment(_0x489cf9[_0x025e('0xd8')])[_0x025e('0xc5')](_0x025e('0xd7'))[_0x025e('0x93')]():'','disposition':_0x489cf9[_0x025e('0xd9')],'visibility':_0x489cf9[_0x025e('0xda')]?_0x025e('0xdb'):_0x025e('0xdc'),'messages':_(_0x489cf9[_0x025e('0xc9')])[_0x025e('0x7e')]({'secret':![]})['map'](function(_0x29836b){if(_0x29836b['Attachment']){var _0x4c1625=path[_0x025e('0xc0')](_0x454067,_0x29836b['Attachment'][_0x025e('0xdd')]);if(fs[_0x025e('0xde')](_0x4c1625)){fs[_0x025e('0xdf')](_0x4c1625)[_0x025e('0xe0')](fs[_0x025e('0xe1')](path[_0x025e('0xc0')](_0x1ec3fa,_0x29836b['Attachment'][_0x025e('0xdd')])));}}return{'date':moment(_0x29836b['createdAt'])[_0x025e('0xc5')](_0x025e('0xd7'))[_0x025e('0x93')](),'sender':_0x29836b[_0x025e('0xca')]==='out'?_0x29836b[_0x025e('0xc6')]?_0x29836b[_0x025e('0xc6')][_0x025e('0x28')]:'System':_0x29836b[_0x025e('0x5b')][_0x025e('0xe2')]+(_0x29836b['Contact']['lastName']?'\x20'+_0x29836b[_0x025e('0x5b')][_0x025e('0xe3')]:''),'body':_0x29836b['Attachment']?_0x29836b['Attachment']['basename']:_0x29836b[_0x025e('0xaf')],'direction':_0x29836b['direction']===_0x025e('0xe4')?'A':'C','secret':_0x29836b['secret'],'read':_0x29836b[_0x025e('0xcc')],'attachment':_0x29836b[_0x025e('0xc8')]};})[_0x025e('0x5e')]()};return ejs['renderFile'](path[_0x025e('0xc0')](config['root'],_0x025e('0xc1'),_0x025e('0xe5'),_0x025e('0xe6')),{'interaction':_0x430557})[_0x025e('0x21')](function(_0x12edd7){return new BPromise(function(_0x397653,_0x572a99){pdf[_0x025e('0xae')](_0x12edd7,_0x775f21)[_0x025e('0xe7')](path[_0x025e('0xc0')](_0x1ec3fa,'transcript-'+_0x489cf9['id']+'-'+_0x35a3b8+'.pdf'),function(_0x5e8f13,_0xde390c){if(_0x5e8f13)return _0x572a99(_0x5e8f13);_0x397653(_0xde390c);});});})['then'](function(){return new BPromise(function(_0x27f9fc,_0x155ae7){zipdir(_0x1ec3fa,{'saveTo':_0x241d30},function(_0x14187a,_0x2ef2a7){if(_0x14187a)return _0x155ae7(_0x14187a);return _0x27f9fc(_0x2ef2a7);});})[_0x025e('0x21')](function(){return new BPromise(function(_0x22b5e4,_0xfb2ee1){rimraf(_0x1ec3fa,function(_0x109d90){if(_0x109d90)_0xfb2ee1(_0x109d90);return _0x22b5e4();});});})[_0x025e('0x21')](function(){return _0xfbdfed[_0x025e('0xbe')](_0x241d30,_0x296367,function(_0x499660){if(_0x499660){console[_0x025e('0xe8')](_0x025e('0xe9'),_0x499660);}else{fs[_0x025e('0xea')](_0x241d30);}});});});}else{return _0xfbdfed[_0x025e('0x19')](0xc8);}})[_0x025e('0xa8')](handleError(_0xfbdfed,null));}; \ No newline at end of file +var _0xe18c=['MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','OpenchannelAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','params','rawAttributes','includeAll','include','merge','options','update','describe','addMessage','omit','ids','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','read','OpenchannelAccount','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','Owner','N.A.','closed','threadId','Public','Private','basename','createReadStream','out','System','secret','renderFile','views','downloadInteraction.html','create','toFile','.pdf','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','map','fullname','Tags','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring'];(function(_0x546440,_0xaf9742){var _0x3e41e8=function(_0x188b5c){while(--_0x188b5c){_0x546440['push'](_0x546440['shift']());}};_0x3e41e8(++_0xaf9742);}(_0xe18c,0x178));var _0xce18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe18c[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xce18('0x0'));var emlformat=require(_0xce18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xce18('0x2'));var jsonpatch=require(_0xce18('0x3'));var rp=require('request-promise');var moment=require(_0xce18('0x4'));var BPromise=require(_0xce18('0x5'));var Mustache=require(_0xce18('0x6'));var util=require(_0xce18('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xce18('0x8'));var ejs=require(_0xce18('0x9'));var fs=require('fs');var _=require(_0xce18('0xa'));var squel=require(_0xce18('0xb'));var crypto=require(_0xce18('0xc'));var jsforce=require(_0xce18('0xd'));var deskjs=require(_0xce18('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce18('0xf'));var Papa=require('papaparse');var Redis=require(_0xce18('0x10'));var authService=require(_0xce18('0x11'));var qs=require(_0xce18('0x12'));var as=require(_0xce18('0x13'));var hardwareService=require(_0xce18('0x14'));var logger=require(_0xce18('0x15'))('api');var utils=require(_0xce18('0x16'));var config=require(_0xce18('0x17'));var db=require(_0xce18('0x18'))['db'];config[_0xce18('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xce18('0x1a'))(new Redis(config[_0xce18('0x19')]));require(_0xce18('0x1b'))[_0xce18('0x1c')](socket);function respondWithStatusCode(_0x3b081b,_0xc863a5){_0xc863a5=_0xc863a5||0xcc;return function(_0x963691){if(_0x963691){return _0x3b081b[_0xce18('0x1d')](_0xc863a5);}return _0x3b081b[_0xce18('0x1e')](_0xc863a5)[_0xce18('0x1f')]();};}function respondWithResult(_0x1652da,_0x21021f){_0x21021f=_0x21021f||0xc8;return function(_0x15008f){if(_0x15008f){return _0x1652da[_0xce18('0x1e')](_0x21021f)[_0xce18('0x20')](_0x15008f);}};}function respondWithFilteredResult(_0x3b3a6f,_0x2a0198){return function(_0x10c3a6){if(_0x10c3a6){var _0x8edcbc=_0x10c3a6[_0xce18('0x21')],_0x5e349f=_0x2a0198[_0xce18('0x22')],_0x256b7f=_0x2a0198[_0xce18('0x22')]+_0x2a0198[_0xce18('0x23')],_0x4cbda0;if(_0x256b7f>=_0x8edcbc){_0x256b7f=_0x8edcbc;_0x4cbda0=0xc8;}else{_0x4cbda0=0xce;}_0x3b3a6f[_0xce18('0x1e')](_0x4cbda0);return _0x3b3a6f[_0xce18('0x24')](_0xce18('0x25'),_0x5e349f+'-'+_0x256b7f+'/'+_0x8edcbc)[_0xce18('0x20')](_0x10c3a6);}return null;};}function patchUpdates(_0x53eb94){return function(_0x2627be){try{jsonpatch[_0xce18('0x26')](_0x2627be,_0x53eb94,!![]);}catch(_0x5c7d00){return BPromise[_0xce18('0x27')](_0x5c7d00);}return _0x2627be['save']();};}function saveUpdates(_0x113645,_0x1095d){return function(_0x5ec1a2){if(_0x5ec1a2){return _0x5ec1a2['update'](_0x113645)['then'](function(_0x1b4940){return _0x1b4940;});}return null;};}function removeEntity(_0x566252,_0x1ea4a5){return function(_0x4f5108){if(_0x4f5108){return _0x4f5108[_0xce18('0x28')]()[_0xce18('0x29')](function(){_0x566252[_0xce18('0x1e')](0xcc)[_0xce18('0x1f')]();});}};}function handleEntityNotFound(_0x51711a,_0x374692){return function(_0x22db2f){if(!_0x22db2f){_0x51711a['sendStatus'](0x194);}return _0x22db2f;};}function handleError(_0xc5f429,_0xa065e9){_0xa065e9=_0xa065e9||0x1f4;return function(_0x34c96a){logger[_0xce18('0x2a')](_0x34c96a[_0xce18('0x2b')]);if(_0x34c96a[_0xce18('0x2c')]){delete _0x34c96a[_0xce18('0x2c')];}_0xc5f429[_0xce18('0x1e')](_0xa065e9)[_0xce18('0x2d')](_0x34c96a);};}function getInteractionUsers(_0x2cccae,_0x4172a4){return new BPromise(function(_0x59a6d4,_0x7b40a4){try{if(_0x4172a4[_0x2cccae['id']]){_0x2cccae['Users']=_[_0xce18('0x2e')](_0x4172a4[_0x2cccae['id']],function(_0x515ca3){return{'id':_0x515ca3['id'],'fullname':_0x515ca3[_0xce18('0x2f')]};});}}catch(_0x1b5a00){_0x7b40a4(_0x1b5a00);}_0x59a6d4(_0x2cccae);});}function getInteractionTags(_0x522c4b,_0x1d5831){return new BPromise(function(_0x23c3fa,_0x15cebd){try{if(_0x522c4b['TagIds']){_0x522c4b[_0xce18('0x30')]=[];_0x522c4b[_0xce18('0x31')][_0xce18('0x32')](',')[_0xce18('0x33')](function(_0x10ec6b){_0x522c4b[_0xce18('0x30')][_0xce18('0x34')](_0x1d5831[_0x10ec6b]);});}delete _0x522c4b[_0xce18('0x31')];}catch(_0x10029a){_0x15cebd(_0x10029a);}_0x23c3fa(_0x522c4b);});}function updateOpenchannelInteraction(_0xfbf13b,_0xe11f2c,_0x2a8856){return new BPromise(function(_0x6e22dc,_0x4ec101){return getInteractionUsers(_0xfbf13b,_0x2a8856)[_0xce18('0x29')](function(_0x4c97c4){return getInteractionTags(_0x4c97c4,_0xe11f2c);})[_0xce18('0x29')](function(_0x5bad06){_0x6e22dc(_0x5bad06);})[_0xce18('0x35')](function(_0x58346b){_0x4ec101(_0x58346b);});});}exports[_0xce18('0x36')]=function(_0x2b164f,_0x129d41){var _0x3a319e={},_0x2a0717={},_0x5d06d3={'count':0x0,'rows':[]};var _0xd01cb8=_[_0xce18('0x2e')](db[_0xce18('0x37')]['rawAttributes'],function(_0x4b7f74){return{'name':_0x4b7f74[_0xce18('0x38')],'type':_0x4b7f74[_0xce18('0x39')]['key']};});_0x2a0717[_0xce18('0x3a')]=_['map'](_0xd01cb8,_0xce18('0x2c'));_0x2a0717['query']=_[_0xce18('0x3b')](_0x2b164f[_0xce18('0x3c')]);_0x2a0717[_0xce18('0x3d')]=_[_0xce18('0x3e')](_0x2a0717[_0xce18('0x3a')],_0x2a0717[_0xce18('0x3c')]);_0x3a319e[_0xce18('0x3f')]=_[_0xce18('0x3e')](_0x2a0717[_0xce18('0x3a')],qs['fields'](_0x2b164f[_0xce18('0x3c')][_0xce18('0x40')]));_0x3a319e['attributes']=_0x3a319e['attributes'][_0xce18('0x41')]?_0x3a319e['attributes']:_0x2a0717[_0xce18('0x3a')];if(!_0x2b164f[_0xce18('0x3c')][_0xce18('0x42')]('nolimit')){_0x3a319e['limit']=qs[_0xce18('0x23')](_0x2b164f[_0xce18('0x3c')][_0xce18('0x23')]);_0x3a319e[_0xce18('0x22')]=qs[_0xce18('0x22')](_0x2b164f[_0xce18('0x3c')]['offset']);}_0x3a319e[_0xce18('0x43')]=qs[_0xce18('0x44')](_0x2b164f[_0xce18('0x3c')][_0xce18('0x44')]);_0x3a319e[_0xce18('0x45')]=qs[_0xce18('0x3d')](_[_0xce18('0x46')](_0x2b164f['query'],_0x2a0717['filters']),_0xd01cb8);var _0x531601=[];var _0x40f412=squel[_0xce18('0x47')]()[_0xce18('0x48')]('id')[_0xce18('0x48')](_0xce18('0x2c'))[_0xce18('0x48')](_0xce18('0x49'))['from']('tools_tags');var _0x274ec6=squel[_0xce18('0x47')]()[_0xce18('0x48')](_0xce18('0x4a'))[_0xce18('0x48')](_0xce18('0x4b'))[_0xce18('0x48')](_0xce18('0x4c'))[_0xce18('0x4d')](_0xce18('0x4e'),'ui')['left_join'](_0xce18('0x4f'),'u',_0xce18('0x50'));var _0x255f95=squel['select']()[_0xce18('0x4d')](_0xce18('0x51'),'i')[_0xce18('0x52')](_0xce18('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xce18('0x52')](_0xce18('0x4f'),'o',_0xce18('0x54'))[_0xce18('0x52')](_0xce18('0x55'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xce18('0x52')]('openchannel_messages','me',_0xce18('0x56'))[_0xce18('0x52')](_0xce18('0x57'),'it',_0xce18('0x58'))['left_join'](_0xce18('0x59'),'t',_0xce18('0x5a'));var _0x2c9104=squel['expr']();var _0x5e12b6=[];var _0x413de2=squel[_0xce18('0x5b')]();var _0x327ad5;if(_0x2b164f['query']['search']){_0x327ad5=as[_0xce18('0x5c')](_0x2b164f[_0xce18('0x3c')][_0xce18('0x5d')]);var _0x247cac=_0x327ad5['sqlOperator'];for(var _0xc0128e=0x0;_0xc0128e<_0x327ad5[_0xce18('0x5e')]['length'];_0xc0128e++){var _0x38db33=_0x327ad5[_0xce18('0x5e')][_0xc0128e];var _0xef69d5='i';var _0x42dae8=_[_0xce18('0x5f')](_0xd01cb8,[_0xce18('0x2c'),_0x38db33[_0xce18('0x48')]]);if(!_0x42dae8){switch(_0x38db33[_0xce18('0x48')]){case'unreadMessages':if(_0x38db33[_0xce18('0x60')]==0x1){_0x255f95[_0xce18('0x61')]('`'+_0x38db33[_0xce18('0x48')]+'`\x20=\x200');}else{_0x255f95[_0xce18('0x61')]('`'+_0x38db33['field']+_0xce18('0x62'));}break;case _0xce18('0x63'):if(_0x38db33[_0xce18('0x64')]===_0xce18('0x65')){if(_0x38db33[_0xce18('0x60')][_0xce18('0x32')]('\x20')[_0xce18('0x41')]>0x1){_0x2c9104[_0x247cac](_0xce18('0x66'),qs[_0xce18('0x67')](_0x38db33['value']),null);}else{var _0x1e16b1='%'+_0x38db33[_0xce18('0x60')]+'%';_0x2c9104[_0x247cac]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1e16b1,_0x1e16b1,_0x1e16b1);}}else{_0x42dae8=_[_0xce18('0x5f')](_0xd01cb8,[_0xce18('0x2c'),'ContactId']);_0x38db33[_0xce18('0x48')]=_0xce18('0x68');_0x4ac68a=as[_0xce18('0x69')](_0xef69d5,_0x42dae8['type'],_0x38db33);_0x2c9104[_0x247cac](_0x4ac68a[_0xce18('0x6a')],_0x4ac68a['value'][_0xce18('0x6b')],_0x4ac68a[_0xce18('0x60')][_0xce18('0x1f')]);}break;case _0xce18('0x6c'):var _0x13584c=_0x38db33[_0xce18('0x60')]['split'](',')[_0xce18('0x2e')](function(_0x1750f8){return Number(_0x1750f8);});_0x13584c[_0xce18('0x33')](function(_0x37bf1f){_0x413de2['or'](_0xce18('0x6d'),'%,'+_0x37bf1f+',%');});_0x5e12b6=_[_0xce18('0x6e')](_0x5e12b6,_0x13584c);break;case _0xce18('0x6f'):if(_0x38db33['operator']==='$substring'){_0x2c9104[_0x247cac](_0xce18('0x70'),'%'+_0x38db33['value']+'%',null);}else{_0x42dae8=_['find'](_0xd01cb8,[_0xce18('0x2c'),_0xce18('0x71')]);_0x38db33[_0xce18('0x48')]=_0xce18('0x71');_0x4ac68a=as[_0xce18('0x69')](_0xef69d5,_0x42dae8[_0xce18('0x39')],_0x38db33);_0x2c9104[_0x247cac](_0x4ac68a[_0xce18('0x6a')],_0x4ac68a[_0xce18('0x60')][_0xce18('0x6b')],_0x4ac68a[_0xce18('0x60')]['end']);}break;case _0xce18('0x72'):_0x4ac68a=as[_0xce18('0x69')]('me',null,_0x38db33);_0x2c9104[_0x247cac](_0x4ac68a['text'],_0x4ac68a[_0xce18('0x60')][_0xce18('0x6b')],_0x4ac68a[_0xce18('0x60')][_0xce18('0x1f')]);break;}}else{var _0x4ac68a=as[_0xce18('0x69')](_0xef69d5,_0x42dae8['type'],_0x38db33);_0x2c9104[_0x247cac](_0x4ac68a['text'],_0x4ac68a[_0xce18('0x60')][_0xce18('0x6b')],_0x4ac68a[_0xce18('0x60')]['end']);}}}else{var _0xc1cc87=_(_0x2b164f[_0xce18('0x3c')])['keys']()['map'](function(_0xb2afbd){return _['some'](_0xd01cb8,[_0xce18('0x2c'),_0xb2afbd])?_0xb2afbd:undefined;})['compact']()[_0xce18('0x60')]();if(!_[_0xce18('0x73')](_0xc1cc87)){_0xc1cc87[_0xce18('0x33')](function(_0x4b8f37){if(_0x4b8f37===_0xce18('0x74')){_0x255f95[_0xce18('0x45')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x2b164f[_0xce18('0x3c')][_0x4b8f37]));}else if(_0x4b8f37===_0xce18('0x75')){var _0x58bf9d=JSON[_0xce18('0x76')](_0x2b164f['query'][_0x4b8f37])[_0xce18('0x77')];var _0x49638b=JSON[_0xce18('0x76')](_0x2b164f[_0xce18('0x3c')][_0x4b8f37])[_0xce18('0x78')];_0x255f95['where'](_0xce18('0x79'),_0x58bf9d,_0x49638b);}else{if(_0x2b164f[_0xce18('0x3c')][_0x4b8f37]===_0xce18('0x7a')){_0x255f95[_0xce18('0x45')]('i.'+_0x4b8f37+_0xce18('0x7b'));}else{_0x255f95['where']('i.'+_0x4b8f37+_0xce18('0x7c'),_0x2b164f[_0xce18('0x3c')][_0x4b8f37]);}}});}if(_0x2b164f[_0xce18('0x3c')]['read']){if(_0x2b164f[_0xce18('0x3c')]['read']==0x1){_0x255f95['having'](_0xce18('0x7d'));}else{_0x255f95['having'](_0xce18('0x7e'));}}if(_0x2b164f[_0xce18('0x3c')][_0xce18('0x7f')]){_0x5e12b6=_['isArray'](_0x2b164f[_0xce18('0x3c')][_0xce18('0x7f')])?_0x2b164f[_0xce18('0x3c')][_0xce18('0x7f')]:new Array(_0x2b164f[_0xce18('0x3c')][_0xce18('0x7f')]);_0x5e12b6[_0xce18('0x33')](function(_0x2f037e){_0x413de2['or'](_0xce18('0x6d'),'%,'+_0x2f037e+',%');});}if(_0x2b164f[_0xce18('0x3c')][_0xce18('0x80')]){var _0x4120fd=_0x2b164f[_0xce18('0x3c')][_0xce18('0x80')][_0xce18('0x81')]('\x5c','\x5c\x5c')[_0xce18('0x81')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x4120fd)){_0x2c9104['or'](_0xce18('0x82'),_0x4120fd+'%');}else{_0x2c9104['or'](_0xce18('0x83'),qs[_0xce18('0x67')](_0x4120fd))['or'](_0xce18('0x84'),_0x4120fd+'%')['or'](_0xce18('0x85'),_0x4120fd+'%');}}}_0x255f95[_0xce18('0x45')](_0x2c9104);_0x255f95[_0xce18('0x86')](_0xce18('0x87'));var _0xcaa3a1={'type':db[_0xce18('0x88')][_0xce18('0x89')][_0xce18('0x8a')],'raw':!![]};var _0xcd34fa=_0x255f95[_0xce18('0x8b')]();_0xcd34fa[_0xce18('0x48')]('i.id');_0xcd34fa[_0xce18('0x48')](_0xce18('0x8c'),_0xce18('0x8d'));if(_0x3a319e[_0xce18('0x43')]){_0x3a319e[_0xce18('0x43')]['forEach'](function(_0x1a7e74){_0x255f95[_0xce18('0x43')]('i.'+_0x1a7e74[0x0],_0x1a7e74[0x1]==='DESC'?![]:!![]);});}if(!_[_0xce18('0x73')](_0x5e12b6)){_0x255f95[_0xce18('0x61')](_0x413de2);_0xcd34fa[_0xce18('0x45')]('t.id\x20IN\x20?',_0x5e12b6);}BPromise[_0xce18('0x8e')]()[_0xce18('0x29')](function(){if(!_0x327ad5){if(_0x2b164f[_0xce18('0x3c')]['OpenchannelAccountId']||_0x2b164f[_0xce18('0x3c')][_0xce18('0x8f')])return;_0xcd34fa[_0xce18('0x45')](_0xce18('0x90'));_0x255f95[_0xce18('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2b164f[_0xce18('0x91')][_0xce18('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2048eb){if(_[_0xce18('0x73')](_0x2048eb)){_0xcd34fa[_0xce18('0x45')](_0xce18('0x93'));_0x255f95[_0xce18('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0xcd34fa[_0xce18('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x2048eb,'id'));_0x255f95[_0xce18('0x45')](_0xce18('0x94'),_[_0xce18('0x2e')](_0x2048eb,'id'));}});})[_0xce18('0x29')](function(){db[_0xce18('0x95')]['query'](_0xcd34fa[_0xce18('0x96')](),_0xcaa3a1)[_0xce18('0x29')](function(_0x3f2c96){_0x5d06d3[_0xce18('0x21')]=_0x3f2c96[_0xce18('0x41')];if(_0x5d06d3['count']===0x0)return[];return db[_0xce18('0x95')][_0xce18('0x3c')](_0x40f412['toString'](),_0xcaa3a1)[_0xce18('0x29')](function(_0x110e87){_0x531601=_[_0xce18('0x97')](_0x110e87,'id');_0xcaa3a1=_['merge'](_0xcaa3a1,{'model':db[_0xce18('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b164f[_0xce18('0x3c')]['fields']){_0x3a319e[_0xce18('0x3f')][_0xce18('0x33')](function(_0x30c60b){_0x255f95[_0xce18('0x48')]('i.'+_0x30c60b);});}else{_0x255f95[_0xce18('0x48')](_0xce18('0x8c'),_0xce18('0x8d'));_0x255f95[_0xce18('0x48')](_0xce18('0x98'),_0xce18('0x99'));_0x255f95['field'](_0xce18('0x9a'),_0xce18('0x9b'));_0x255f95[_0xce18('0x48')](_0xce18('0x9c'));_0x255f95['field']('c.firstName','Contact.firstName');_0x255f95[_0xce18('0x48')](_0xce18('0x9d'),_0xce18('0x9e'));_0x255f95[_0xce18('0x48')](_0xce18('0x9f'),_0xce18('0xa0'));_0x255f95[_0xce18('0x48')]('c.phone',_0xce18('0xa1'));_0x255f95[_0xce18('0x48')](_0xce18('0xa2'),_0xce18('0xa3'));_0x255f95[_0xce18('0x48')](_0xce18('0xa4'),_0xce18('0xa5'));_0x255f95[_0xce18('0x48')](_0xce18('0xa6'),_0xce18('0xa7'));_0x255f95[_0xce18('0x48')](_0xce18('0xa8'),_0xce18('0xa9'));_0x255f95[_0xce18('0x48')](_0xce18('0xaa'),_0xce18('0x31'));}if(_0x3a319e[_0xce18('0x23')])_0x255f95[_0xce18('0x23')](_0x3a319e[_0xce18('0x23')]);if(_0x3a319e[_0xce18('0x22')])_0x255f95[_0xce18('0x22')](_0x3a319e[_0xce18('0x22')]);return db['sequelize'][_0xce18('0x3c')](_0x255f95[_0xce18('0x96')](),_0xcaa3a1);})['then'](function(_0x49afcb){_0x274ec6[_0xce18('0x45')](_0xce18('0xab'),_[_0xce18('0x2e')](_0x49afcb,'id'));return db[_0xce18('0x95')][_0xce18('0x3c')](_0x274ec6[_0xce18('0x96')](),_0xcaa3a1)['then'](function(_0x4fe30a){var _0x19b381=_[_0xce18('0xac')](_0x4fe30a,_0xce18('0xad'));var _0x2d7cfc=[];_0x49afcb[_0xce18('0x33')](function(_0x29fe2f){_0x2d7cfc[_0xce18('0x34')](updateOpenchannelInteraction(_0x29fe2f,_0x531601,_0x19b381));});return BPromise['all'](_0x2d7cfc);});});})[_0xce18('0x29')](function(_0xd8899e){_0x5d06d3[_0xce18('0xae')]=_0xd8899e;return _0x5d06d3;})[_0xce18('0x29')](respondWithFilteredResult(_0x129d41,_0x3a319e));})['catch'](handleError(_0x129d41,null));};exports['show']=function(_0xb175fc,_0x76af3e){var _0x577d71={'raw':![],'where':{'id':_0xb175fc[_0xce18('0xaf')]['id']}},_0x1faf40={};_0x1faf40['model']=_['keys'](db['OpenchannelInteraction'][_0xce18('0xb0')]);_0x1faf40[_0xce18('0x3c')]=_[_0xce18('0x3b')](_0xb175fc[_0xce18('0x3c')]);_0x1faf40[_0xce18('0x3d')]=_[_0xce18('0x3e')](_0x1faf40[_0xce18('0x3a')],_0x1faf40['query']);_0x577d71[_0xce18('0x3f')]=_[_0xce18('0x3e')](_0x1faf40[_0xce18('0x3a')],qs[_0xce18('0x40')](_0xb175fc['query'][_0xce18('0x40')]));_0x577d71['attributes']=_0x577d71[_0xce18('0x3f')][_0xce18('0x41')]?_0x577d71[_0xce18('0x3f')]:_0x1faf40['model'];if(_0xb175fc[_0xce18('0x3c')][_0xce18('0xb1')]){_0x577d71[_0xce18('0xb2')]=[{'all':!![]}];}_0x577d71=_[_0xce18('0xb3')]({},_0x577d71,_0xb175fc[_0xce18('0xb4')]);return db[_0xce18('0x37')][_0xce18('0x5f')](_0x577d71)[_0xce18('0x29')](handleEntityNotFound(_0x76af3e,null))['then'](respondWithResult(_0x76af3e,null))[_0xce18('0x35')](handleError(_0x76af3e,null));};exports['create']=function(_0x21767a,_0x2239e0){return db[_0xce18('0x37')]['create'](_0x21767a[_0xce18('0x72')],{})[_0xce18('0x29')](respondWithResult(_0x2239e0,0xc9))['catch'](handleError(_0x2239e0,null));};exports[_0xce18('0xb5')]=function(_0x1d9b75,_0x80dec7){if(_0x1d9b75['body']['id']){delete _0x1d9b75[_0xce18('0x72')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x1d9b75[_0xce18('0xaf')]['id']}})[_0xce18('0x29')](handleEntityNotFound(_0x80dec7,null))[_0xce18('0x29')](saveUpdates(_0x1d9b75[_0xce18('0x72')],null))[_0xce18('0x29')](respondWithResult(_0x80dec7,null))[_0xce18('0x35')](handleError(_0x80dec7,null));};exports[_0xce18('0x28')]=function(_0x10bec8,_0x2919e2){return db[_0xce18('0x37')][_0xce18('0x5f')]({'where':{'id':_0x10bec8[_0xce18('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2919e2,null))[_0xce18('0x29')](removeEntity(_0x2919e2,null))[_0xce18('0x35')](handleError(_0x2919e2,null));};exports['describe']=function(_0xd0d6a0,_0x2c31dc){return db[_0xce18('0x37')][_0xce18('0xb6')]()['then'](respondWithResult(_0x2c31dc,null))[_0xce18('0x35')](handleError(_0x2c31dc,null));};exports['addMessage']=function(_0x3b0511,_0x1602aa,_0x5b51dd){return db['OpenchannelMessage']['find']({'where':{'id':_0x3b0511[_0xce18('0xaf')]['id']}})[_0xce18('0x29')](handleEntityNotFound(_0x1602aa,null))['then'](function(_0x3e130e){if(_0x3e130e){return _0x3e130e[_0xce18('0xb7')](_0x3b0511[_0xce18('0x72')]['ids'],_[_0xce18('0xb8')](_0x3b0511[_0xce18('0x72')],[_0xce18('0xb9'),'id'])||{});}})[_0xce18('0x29')](respondWithResult(_0x1602aa,null))[_0xce18('0x35')](handleError(_0x1602aa,null));};exports['getMessages']=function(_0x3993a7,_0x12a1bd,_0x458e75){var _0x5613f3={'raw':![],'where':{}};var _0x5b2ba4={};var _0x2610fe={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xce18('0xba')]({'where':{'id':_0x3993a7['params']['id']}})['then'](handleEntityNotFound(_0x12a1bd,null))[_0xce18('0x29')](function(_0x196a3c){if(_0x196a3c){_0x5b2ba4[_0xce18('0x3a')]=_[_0xce18('0x3b')](db[_0xce18('0xbb')]['rawAttributes']);_0x5b2ba4[_0xce18('0x3c')]=_[_0xce18('0x3b')](_0x3993a7['query']);_0x5b2ba4[_0xce18('0x3d')]=_[_0xce18('0x3e')](_0x5b2ba4['model'],_0x5b2ba4[_0xce18('0x3c')]);_0x5613f3[_0xce18('0x3f')]=_[_0xce18('0x3e')](_0x5b2ba4['model'],qs[_0xce18('0x40')](_0x3993a7[_0xce18('0x3c')][_0xce18('0x40')]));_0x5613f3[_0xce18('0x3f')]=_0x5613f3[_0xce18('0x3f')]['length']?_0x5613f3[_0xce18('0x3f')]:_0x5b2ba4[_0xce18('0x3a')];if(!_0x3993a7['query'][_0xce18('0x42')]('nolimit')){_0x5613f3[_0xce18('0x23')]=qs['limit'](_0x3993a7[_0xce18('0x3c')]['limit']);_0x5613f3[_0xce18('0x22')]=qs[_0xce18('0x22')](_0x3993a7[_0xce18('0x3c')][_0xce18('0x22')]);}_0x5613f3[_0xce18('0x43')]=qs[_0xce18('0x44')](_0x3993a7[_0xce18('0x3c')]['sort']);_0x5613f3[_0xce18('0x45')]=qs[_0xce18('0x3d')](_[_0xce18('0x46')](_0x3993a7['query'],_0x5b2ba4[_0xce18('0x3d')]));_0x5613f3['where']['OpenchannelInteractionId']=_0x196a3c['id'];if(_0x3993a7[_0xce18('0x3c')]['filter']){_0x5613f3[_0xce18('0x45')]=_[_0xce18('0xb3')](_0x5613f3['where'],{'$or':_['map'](_0x5613f3[_0xce18('0x3f')],function(_0x169300){var _0x39902d={};_0x39902d[_0x169300]={'$like':'%'+_0x3993a7[_0xce18('0x3c')]['filter']+'%'};return _0x39902d;})});}if(_0x3993a7[_0xce18('0x3c')]['$gte']){var _0x11449a=_0x3993a7[_0xce18('0x3c')][_0xce18('0x77')][_0xce18('0x32')](',');var _0x5acd60={};_0x5acd60[_0x11449a[0x0]]={'$gte':moment(_0x11449a[0x1])[_0xce18('0xbc')](_0xce18('0xbd'))};_0x5613f3[_0xce18('0x45')]=_[_0xce18('0xb3')](_0x5613f3[_0xce18('0x45')],_0x5acd60);}_0x5613f3=_[_0xce18('0xb3')]({},_0x5613f3,_0x3993a7[_0xce18('0xb4')]);return db[_0xce18('0xbb')][_0xce18('0x21')]({'where':_0x5613f3[_0xce18('0x45')]})[_0xce18('0x29')](function(_0x366741){_0x2610fe[_0xce18('0x21')]=_0x366741;if(_0x3993a7['query']['includeAll']){_0x5613f3[_0xce18('0xb2')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x5613f3);})[_0xce18('0x29')](function(_0x4f0804){_0x2610fe[_0xce18('0xae')]=_0x4f0804;return _0x2610fe;});}})[_0xce18('0x29')](respondWithFilteredResult(_0x12a1bd,_0x5613f3))[_0xce18('0x35')](handleError(_0x12a1bd,null));};exports[_0xce18('0xbe')]=function(_0x1f9f89,_0x1d0818,_0x4505bd){return db[_0xce18('0x37')][_0xce18('0x5f')]({'where':{'id':_0x1f9f89[_0xce18('0xaf')]['id']}})[_0xce18('0x29')](handleEntityNotFound(_0x1d0818,null))[_0xce18('0x29')](function(_0x4b16c5){if(_0x4b16c5){return _0x4b16c5[_0xce18('0xbf')](_0x1f9f89[_0xce18('0x72')]['ids'],_[_0xce18('0xb8')](_0x1f9f89[_0xce18('0x72')],['ids','id'])||{})[_0xce18('0xc0')](function(){return db[_0xce18('0x6c')]['findAll']({'attributes':['id','name',_0xce18('0x49')],'where':{'id':_0x1f9f89['body']['ids']}});})[_0xce18('0x29')](function(_0x478d90){socket[_0xce18('0xc1')](_0xce18('0xc2'),{'id':Number(_0x1f9f89[_0xce18('0xaf')]['id']),'tags':_0x478d90||[]});return{'id':Number(_0x1f9f89[_0xce18('0xaf')]['id']),'tags':_0x478d90||[]};});}})[_0xce18('0x29')](respondWithResult(_0x1d0818,null))[_0xce18('0x35')](handleError(_0x1d0818,null));};exports[_0xce18('0xc3')]=function(_0x5166c8,_0x9ac0db,_0x97c81){return db[_0xce18('0x37')][_0xce18('0x5f')]({'where':{'id':_0x5166c8[_0xce18('0xaf')]['id']}})['then'](handleEntityNotFound(_0x9ac0db,null))['then'](function(_0x70ff69){if(_0x70ff69){return _0x70ff69['removeTags'](_0x5166c8['query'][_0xce18('0xb9')]);}})[_0xce18('0x29')](respondWithStatusCode(_0x9ac0db,null))['catch'](handleError(_0x9ac0db,null));};exports[_0xce18('0xc4')]=function(_0x5891f0,_0x39cfc1){var _0x4d3c1b=moment()[_0xce18('0xc5')]()[_0xce18('0x96')]();var _0x1eac36=path[_0xce18('0xc6')](config[_0xce18('0xc7')],_0xce18('0xc8'),_0xce18('0xc9'),_0xce18('0xca'));var _0x4ac422=path['join'](config[_0xce18('0xc7')],_0xce18('0xc8'),_0xce18('0xc9'),_0xce18('0xcb'));var _0x250ed1=path[_0xce18('0xc6')](_0x1eac36,_0x4d3c1b);var _0x31ced0=util[_0xce18('0xbc')](_0xce18('0xcc'),_0x5891f0[_0xce18('0xaf')]['id'],_0x4d3c1b);var _0x166c51=path[_0xce18('0xc6')](_0x1eac36,_0x31ced0);var _0x31e1eb=[];_0x31e1eb[_0xce18('0x34')]({'model':db['User'],'as':_0xce18('0x6f'),'attributes':['id',_0xce18('0x2f')],'raw':!![]});_0x31e1eb['push']({'model':db[_0xce18('0xcd')],'as':_0xce18('0x63'),'attributes':['id',_0xce18('0xce'),_0xce18('0xcf')],'raw':!![]});if(_0x5891f0[_0xce18('0x3c')][_0xce18('0xcb')]){_0x31e1eb['push']({'model':db[_0xce18('0xd0')],'as':'Attachment','raw':!![]});}var _0x39390c=[{'model':db[_0xce18('0xbb')],'as':_0xce18('0xd1'),'attributes':['id',_0xce18('0x72'),'createdAt',_0xce18('0xd2'),'secret',_0xce18('0xd3')],'include':_0x31e1eb}];_0x39390c[_0xce18('0x34')]({'model':db[_0xce18('0xd4')],'as':_0xce18('0xd5'),'attributes':['id',_0xce18('0x2c')]});_0x39390c[_0xce18('0x34')]({'model':db['User'],'as':'Owner','attributes':['id',_0xce18('0x2f')]});return db[_0xce18('0x37')]['find']({'where':{'id':_0x5891f0[_0xce18('0xaf')]['id']},'include':_0x39390c})[_0xce18('0x29')](handleEntityNotFound(_0x39cfc1,null))[_0xce18('0x29')](function(_0x3c412d){if(_0x3c412d){var _0x595898=_0x3c412d[_0xce18('0xd6')]({'plain':!![]});fs[_0xce18('0xd7')](_0x250ed1);var _0x5eb4e2={'format':'A4','border':_0xce18('0xd8'),'header':{'height':_0xce18('0xd9'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util[_0xce18('0xbc')](_0xce18('0xda'),util[_0xce18('0xbc')](_0xce18('0xdb'),_0xce18('0xdc'),_0x595898['id']),moment()['format']('YYYY-MM-DD')[_0xce18('0x96')]())}}};var _0x33daf7={'channel':_0xce18('0xdc'),'account':_0x595898[_0xce18('0xd5')]['name'],'agent':_0x595898[_0xce18('0xdd')]?_0x595898['Owner'][_0xce18('0x2f')]:_0xce18('0xde'),'createdAt':moment(_0x595898['createdAt'])[_0xce18('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0xce18('0x96')](),'closedAt':_0x595898[_0xce18('0xdf')]?moment(_0x595898['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xce18('0x96')]():'','disposition':_0x595898['disposition'],'visibility':_0x595898[_0xce18('0xe0')]?_0xce18('0xe1'):_0xce18('0xe2'),'messages':_(_0x595898[_0xce18('0xd1')])['filter']({'secret':![]})['map'](function(_0x1f2b76){if(_0x1f2b76[_0xce18('0xd0')]){var _0x558c3a=path[_0xce18('0xc6')](_0x4ac422,_0x1f2b76[_0xce18('0xd0')][_0xce18('0xe3')]);if(fs['existsSync'](_0x558c3a)){fs[_0xce18('0xe4')](_0x558c3a)['pipe'](fs['createWriteStream'](path[_0xce18('0xc6')](_0x250ed1,_0x1f2b76[_0xce18('0xd0')][_0xce18('0xe3')])));}}return{'date':moment(_0x1f2b76['createdAt'])[_0xce18('0xbc')](_0xce18('0xbd'))[_0xce18('0x96')](),'sender':_0x1f2b76[_0xce18('0xd2')]===_0xce18('0xe5')?_0x1f2b76[_0xce18('0x6f')]?_0x1f2b76['User'][_0xce18('0x2f')]:_0xce18('0xe6'):_0x1f2b76[_0xce18('0x63')][_0xce18('0xce')]+(_0x1f2b76['Contact'][_0xce18('0xcf')]?'\x20'+_0x1f2b76[_0xce18('0x63')][_0xce18('0xcf')]:''),'body':_0x1f2b76[_0xce18('0xd0')]?_0x1f2b76['Attachment'][_0xce18('0xe3')]:_0x1f2b76[_0xce18('0x72')],'direction':_0x1f2b76[_0xce18('0xd2')]===_0xce18('0xe5')?'A':'C','secret':_0x1f2b76[_0xce18('0xe7')],'read':_0x1f2b76[_0xce18('0xd3')],'attachment':_0x1f2b76[_0xce18('0xd0')]};})[_0xce18('0x60')]()};return ejs[_0xce18('0xe8')](path[_0xce18('0xc6')](config['root'],_0xce18('0xc8'),_0xce18('0xe9'),_0xce18('0xea')),{'interaction':_0x33daf7})[_0xce18('0x29')](function(_0x32d9a9){return new BPromise(function(_0xb0d469,_0x4e0004){pdf[_0xce18('0xeb')](_0x32d9a9,_0x5eb4e2)[_0xce18('0xec')](path['join'](_0x250ed1,'transcript-'+_0x595898['id']+'-'+_0x4d3c1b+_0xce18('0xed')),function(_0x2a3784,_0x159339){if(_0x2a3784)return _0x4e0004(_0x2a3784);_0xb0d469(_0x159339);});});})['then'](function(){return new BPromise(function(_0x2de39e,_0x349c72){zipdir(_0x250ed1,{'saveTo':_0x166c51},function(_0x254ad2,_0x23dfc6){if(_0x254ad2)return _0x349c72(_0x254ad2);return _0x2de39e(_0x23dfc6);});})[_0xce18('0x29')](function(){return new BPromise(function(_0x2f015d,_0x36c23f){rimraf(_0x250ed1,function(_0x425027){if(_0x425027)_0x36c23f(_0x425027);return _0x2f015d();});});})['then'](function(){return _0x39cfc1[_0xce18('0xc4')](_0x166c51,_0x31ced0,function(_0x15d644){if(_0x15d644){console['log']('err',_0x15d644);}else{fs[_0xce18('0xee')](_0x166c51);}});});});}else{return _0x39cfc1[_0xce18('0x1d')](0xc8);}})[_0xce18('0x35')](handleError(_0x39cfc1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5c673ff..f8e54f3 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 _0x464b=['map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x464b,0x149));var _0xb464=function(_0x39fd91,_0x146a90){_0x39fd91=_0x39fd91-0x0;var _0x3c3e49=_0x464b[_0x39fd91];return _0x3c3e49;};'use strict';var EventEmitter=require(_0xb464('0x0'));var OpenchannelInteraction=require(_0xb464('0x1'))['db'][_0xb464('0x2')];var OpenchannelMessage=require(_0xb464('0x1'))['db'][_0xb464('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb464('0x4')](0x0);var events={'afterCreate':_0xb464('0x5'),'afterUpdate':_0xb464('0x6'),'afterDestroy':_0xb464('0x7')};function emitEvent(_0x2b4525){return function(_0x345d80,_0x21e64c,_0x23669b){_0x345d80[_0xb464('0x8')]({'attributes':['id'],'raw':!![]})[_0xb464('0x9')](function(_0x442bdb){_0x345d80[_0xb464('0xa')]('Users',_0x442bdb[_0xb464('0xb')](function(_0x3b4d1e){return{'id':_0x3b4d1e['id']};}));return OpenchannelMessage[_0xb464('0xc')]({'where':{'OpenchannelInteractionId':_0x345d80['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb464('0x9')](function(_0x36a191){_0x345d80[_0xb464('0xa')](_0xb464('0xd'),_0x36a191[_0xb464('0xe')]);OpenchannelInteractionEvents[_0xb464('0xf')](_0x2b4525+':'+_0x345d80['id'],_0x345d80);OpenchannelInteractionEvents['emit'](_0x2b4525,_0x345d80);_0x23669b(null);})['catch'](_0x23669b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb464('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7c24=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','unreadMessages'];(function(_0x57eed3,_0x20800a){var _0x14c051=function(_0x285235){while(--_0x285235){_0x57eed3['push'](_0x57eed3['shift']());}};_0x14c051(++_0x20800a);}(_0x7c24,0x154));var _0x47c2=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7c24[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x47c2('0x0'));var OpenchannelInteraction=require(_0x47c2('0x1'))['db'][_0x47c2('0x2')];var OpenchannelMessage=require(_0x47c2('0x1'))['db'][_0x47c2('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x47c2('0x4')](0x0);var events={'afterCreate':_0x47c2('0x5'),'afterUpdate':'update','afterDestroy':_0x47c2('0x6')};function emitEvent(_0x41e592){return function(_0x59373f,_0x9c9a89,_0x3028da){_0x59373f[_0x47c2('0x7')]({'attributes':['id'],'raw':!![]})[_0x47c2('0x8')](function(_0x107fa6){_0x59373f[_0x47c2('0x9')]('Users',_0x107fa6[_0x47c2('0xa')](function(_0x134fcd){return{'id':_0x134fcd['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x59373f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x47c2('0x8')](function(_0x1e562c){_0x59373f[_0x47c2('0x9')](_0x47c2('0xb'),_0x1e562c['length']);OpenchannelInteractionEvents[_0x47c2('0xc')](_0x41e592+':'+_0x59373f['id'],_0x59373f);OpenchannelInteractionEvents['emit'](_0x41e592,_0x59373f);_0x3028da(null);})['catch'](_0x3028da(null));};}for(var e in events){if(events[_0x47c2('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x47c2('0xe')](e,emitEvent(event));}}module[_0x47c2('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0b77920..9895d49 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 _0x8ef6=['bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x3a1e00,_0x3f009c){var _0x29686f=function(_0x1c9a41){while(--_0x1c9a41){_0x3a1e00['push'](_0x3a1e00['shift']());}};_0x29686f(++_0x3f009c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x48fd9e,_0x109762){_0x48fd9e=_0x48fd9e-0x0;var _0x23c3bc=_0x8ef6[_0x48fd9e];return _0x23c3bc;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4eb5eb,_0x228967,_0x31007e){if(_0x4eb5eb[_0x68ef('0xe')](_0x68ef('0xf'))){_0x4eb5eb[_0x68ef('0x10')]=moment()[_0x68ef('0x11')](_0x68ef('0x12'));}_0x31007e(null,_0x4eb5eb);}}});}; \ No newline at end of file +var _0x4300=['OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','lodash','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x4300,0x1a6));var _0x0430=function(_0x5549e8,_0x3bbe96){_0x5549e8=_0x5549e8-0x0;var _0x377e65=_0x4300[_0x5549e8];return _0x377e65;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0430('0x1'));var rp=require(_0x0430('0x2'));var fs=require('fs');var path=require(_0x0430('0x3'));var rimraf=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var attributes=require('./openchannelInteraction.attributes');module[_0x0430('0x6')]=function(_0x5943c0,_0x16efe3){return _0x5943c0['define'](_0x0430('0x7'),attributes,{'tableName':_0x0430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x408b14,_0x31964e,_0x1e8d93){if(_0x408b14[_0x0430('0x9')](_0x0430('0xa'))){_0x408b14[_0x0430('0xb')]=moment()[_0x0430('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1e8d93(null,_0x408b14);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 510e35f..92b5d14 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 _0x1180=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','bluebird'];(function(_0x7babd9,_0x1d1f5e){var _0x394174=function(_0x40e52a){while(--_0x40e52a){_0x7babd9['push'](_0x7babd9['shift']());}};_0x394174(++_0x1d1f5e);}(_0x1180,0x7c));var _0x0118=function(_0x4de9cf,_0x4cf73d){_0x4de9cf=_0x4de9cf-0x0;var _0xf287bd=_0x1180[_0x4de9cf];return _0xf287bd;};'use strict';var _=require(_0x0118('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0118('0x1'));var rs=require(_0x0118('0x2'));var fs=require('fs');var Redis=require(_0x0118('0x3'));var db=require(_0x0118('0x4'))['db'];var utils=require(_0x0118('0x5'));var logger=require(_0x0118('0x6'))(_0x0118('0x7'));var config=require(_0x0118('0x8'));var jayson=require(_0x0118('0x9'));var client=jayson['client'][_0x0118('0xa')]({'port':0x232a});config[_0x0118('0xb')]=_[_0x0118('0xc')](config[_0x0118('0xb')],{'host':_0x0118('0xd'),'port':0x18eb});var socket=require(_0x0118('0xe'))(new Redis(config[_0x0118('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3ba49c,_0x1ed899,_0x3da97c){return new BPromise(function(_0x1e833d,_0x5b34e2){return client[_0x0118('0xf')](_0x3ba49c,_0x3da97c)['then'](function(_0x2c916b){logger[_0x0118('0x10')](_0x0118('0x11'),_0x1ed899,'request\x20sent');logger[_0x0118('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x1ed899,'request\x20sent',JSON['stringify'](_0x2c916b));if(_0x2c916b[_0x0118('0x13')]){if(_0x2c916b[_0x0118('0x13')][_0x0118('0x14')]===0x1f4){logger['error'](_0x0118('0x11'),_0x1ed899,_0x2c916b['error'][_0x0118('0x15')]);return _0x5b34e2(_0x2c916b[_0x0118('0x13')][_0x0118('0x15')]);}logger[_0x0118('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1ed899,_0x2c916b[_0x0118('0x13')][_0x0118('0x15')]);return _0x1e833d(_0x2c916b[_0x0118('0x13')][_0x0118('0x15')]);}else{logger[_0x0118('0x10')](_0x0118('0x11'),_0x1ed899,'request\x20sent');_0x1e833d(_0x2c916b[_0x0118('0x16')][_0x0118('0x15')]);}})[_0x0118('0x17')](function(_0x45f17a){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x1ed899,_0x45f17a);_0x5b34e2(_0x45f17a);});});}exports[_0x0118('0x18')]=function(_0x55ee64){var _0xec6001=this;return new Promise(function(_0x557a70,_0x4a8a8b){return db[_0x0118('0x19')][_0x0118('0x1a')](_0x55ee64[_0x0118('0x1b')],{'raw':_0x55ee64[_0x0118('0x1c')]?_0x55ee64[_0x0118('0x1c')][_0x0118('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55ee64[_0x0118('0x1c')]?_0x55ee64[_0x0118('0x1c')][_0x0118('0x1e')]||null:null,'attributes':_0x55ee64['options']?_0x55ee64[_0x0118('0x1c')][_0x0118('0x1f')]||null:null,'limit':_0x55ee64['options']?_0x55ee64[_0x0118('0x1c')][_0x0118('0x20')]||null:null})['then'](function(_0x55fe7c){logger['info']('UpdateOpenchannelInteraction',_0x55ee64);logger[_0x0118('0x12')](_0x0118('0x18'),_0x55ee64,JSON[_0x0118('0x21')](_0x55fe7c));_0x557a70(_0x55fe7c);})[_0x0118('0x17')](function(_0x548901){logger[_0x0118('0x13')]('UpdateOpenchannelInteraction',_0x548901[_0x0118('0x15')],_0x55ee64);_0x4a8a8b(_0xec6001[_0x0118('0x13')](0x1f4,_0x548901[_0x0118('0x15')]));});});};exports[_0x0118('0x22')]=function(_0x513c73){return new Promise(function(_0x32a616,_0x5a4767){return db[_0x0118('0x19')][_0x0118('0x23')]({'where':_0x513c73['options']?_0x513c73[_0x0118('0x1c')][_0x0118('0x1e')]||null:null})[_0x0118('0x24')](function(_0x2e58f3){if(_0x2e58f3){return _0x2e58f3[_0x0118('0x25')](_0x513c73['body'][_0x0118('0x26')],_[_0x0118('0x27')](_0x513c73[_0x0118('0x1b')],['ids','id'])||{});}})[_0x0118('0x28')](function(_0x36a298){logger[_0x0118('0x10')](_0x0118('0x29'),_0x513c73);logger['debug'](_0x0118('0x29'),_0x513c73,JSON[_0x0118('0x21')](_0x36a298));_0x32a616(_0x36a298);})[_0x0118('0x17')](function(_0x4761e0){logger[_0x0118('0x13')](_0x0118('0x29'),_0x4761e0[_0x0118('0x15')],_0x513c73);_0x5a4767(_this['error'](0x1f4,_0x4761e0[_0x0118('0x15')]));});});}; \ No newline at end of file +var _0xb5e7=['AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','where','attributes','limit','debug'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xb5e7,0xa2));var _0x7b5e=function(_0x536adf,_0x54ef4b){_0x536adf=_0x536adf-0x0;var _0x133b95=_0xb5e7[_0x536adf];return _0x133b95;};'use strict';var _=require(_0x7b5e('0x0'));var util=require(_0x7b5e('0x1'));var moment=require('moment');var BPromise=require(_0x7b5e('0x2'));var rs=require(_0x7b5e('0x3'));var fs=require('fs');var Redis=require(_0x7b5e('0x4'));var db=require(_0x7b5e('0x5'))['db'];var utils=require(_0x7b5e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7b5e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b5e('0x8')]({'port':0x232a});config[_0x7b5e('0x9')]=_[_0x7b5e('0xa')](config[_0x7b5e('0x9')],{'host':_0x7b5e('0xb'),'port':0x18eb});var socket=require(_0x7b5e('0xc'))(new Redis(config[_0x7b5e('0x9')]));require(_0x7b5e('0xd'))['register'](socket);function respondWithRpcPromise(_0x5668a2,_0x225ee7,_0x5342ed){return new BPromise(function(_0x3ff6e8,_0x4de830){return client[_0x7b5e('0xe')](_0x5668a2,_0x5342ed)[_0x7b5e('0xf')](function(_0x5382cb){logger[_0x7b5e('0x10')](_0x7b5e('0x11'),_0x225ee7,_0x7b5e('0x12'));logger['debug'](_0x7b5e('0x13'),_0x225ee7,_0x7b5e('0x12'),JSON[_0x7b5e('0x14')](_0x5382cb));if(_0x5382cb[_0x7b5e('0x15')]){if(_0x5382cb[_0x7b5e('0x15')][_0x7b5e('0x16')]===0x1f4){logger['error'](_0x7b5e('0x11'),_0x225ee7,_0x5382cb[_0x7b5e('0x15')][_0x7b5e('0x17')]);return _0x4de830(_0x5382cb[_0x7b5e('0x15')][_0x7b5e('0x17')]);}logger[_0x7b5e('0x15')](_0x7b5e('0x11'),_0x225ee7,_0x5382cb[_0x7b5e('0x15')][_0x7b5e('0x17')]);return _0x3ff6e8(_0x5382cb[_0x7b5e('0x15')][_0x7b5e('0x17')]);}else{logger[_0x7b5e('0x10')](_0x7b5e('0x11'),_0x225ee7,_0x7b5e('0x12'));_0x3ff6e8(_0x5382cb[_0x7b5e('0x18')][_0x7b5e('0x17')]);}})[_0x7b5e('0x19')](function(_0x4d565d){logger[_0x7b5e('0x15')](_0x7b5e('0x11'),_0x225ee7,_0x4d565d);_0x4de830(_0x4d565d);});});}exports[_0x7b5e('0x1a')]=function(_0x2e34a7){var _0x135b9c=this;return new Promise(function(_0x2cdc7f,_0x2f5581){return db['OpenchannelInteraction']['update'](_0x2e34a7[_0x7b5e('0x1b')],{'raw':_0x2e34a7[_0x7b5e('0x1c')]?_0x2e34a7[_0x7b5e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e34a7['options']?_0x2e34a7[_0x7b5e('0x1c')][_0x7b5e('0x1d')]||null:null,'attributes':_0x2e34a7[_0x7b5e('0x1c')]?_0x2e34a7['options'][_0x7b5e('0x1e')]||null:null,'limit':_0x2e34a7[_0x7b5e('0x1c')]?_0x2e34a7['options'][_0x7b5e('0x1f')]||null:null})[_0x7b5e('0xf')](function(_0x1aeae3){logger[_0x7b5e('0x10')](_0x7b5e('0x1a'),_0x2e34a7);logger[_0x7b5e('0x20')]('UpdateOpenchannelInteraction',_0x2e34a7,JSON['stringify'](_0x1aeae3));_0x2cdc7f(_0x1aeae3);})[_0x7b5e('0x19')](function(_0x2cc506){logger['error'](_0x7b5e('0x1a'),_0x2cc506[_0x7b5e('0x17')],_0x2e34a7);_0x2f5581(_0x135b9c[_0x7b5e('0x15')](0x1f4,_0x2cc506['message']));});});};exports[_0x7b5e('0x21')]=function(_0x246eed){return new Promise(function(_0x5c36a0,_0x137a0a){return db['OpenchannelInteraction'][_0x7b5e('0x22')]({'where':_0x246eed[_0x7b5e('0x1c')]?_0x246eed[_0x7b5e('0x1c')][_0x7b5e('0x1d')]||null:null})[_0x7b5e('0xf')](function(_0x2b9db6){if(_0x2b9db6){return _0x2b9db6[_0x7b5e('0x23')](_0x246eed['body'][_0x7b5e('0x24')],_[_0x7b5e('0x25')](_0x246eed[_0x7b5e('0x1b')],['ids','id'])||{});}})[_0x7b5e('0x26')](function(_0x4e01db){logger[_0x7b5e('0x10')]('AddTags',_0x246eed);logger['debug']('AddTags',_0x246eed,JSON[_0x7b5e('0x14')](_0x4e01db));_0x5c36a0(_0x4e01db);})[_0x7b5e('0x19')](function(_0x283c26){logger['error']('AddTags',_0x283c26[_0x7b5e('0x17')],_0x246eed);_0x137a0a(_this[_0x7b5e('0x15')](0x1f4,_0x283c26[_0x7b5e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 83d6c17..b91c2e4 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 _0xaa80=['./openchannelInteraction.events','update','removeListener','register','length','openchannelInteraction:'];(function(_0x4df69e,_0x5131d5){var _0x1f9041=function(_0x1e6288){while(--_0x1e6288){_0x4df69e['push'](_0x4df69e['shift']());}};_0x1f9041(++_0x5131d5);}(_0xaa80,0xcc));var _0x0aa8=function(_0x5ca9c4,_0x57ed8b){_0x5ca9c4=_0x5ca9c4-0x0;var _0x41063d=_0xaa80[_0x5ca9c4];return _0x41063d;};'use strict';var OpenchannelInteractionEvents=require(_0x0aa8('0x0'));var events=['save','remove',_0x0aa8('0x1')];function createListener(_0x1b000b,_0x3abdd7){return function(_0x193cd7){_0x3abdd7['emit'](_0x1b000b,_0x193cd7);};}function removeListener(_0x2fef6a,_0xb64532){return function(){OpenchannelInteractionEvents[_0x0aa8('0x2')](_0x2fef6a,_0xb64532);};}exports[_0x0aa8('0x3')]=function(_0x3198f7){for(var _0x3bdfeb=0x0,_0x3fa41c=events[_0x0aa8('0x4')];_0x3bdfeb<_0x3fa41c;_0x3bdfeb++){var _0x58c915=events[_0x3bdfeb];var _0x17e6d4=createListener(_0x0aa8('0x5')+_0x58c915,_0x3198f7);OpenchannelInteractionEvents['on'](_0x58c915,_0x17e6d4);}}; \ No newline at end of file +var _0x3f92=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0xbbcdd4,_0x5cfc23){var _0x13caf3=function(_0x1ab1b2){while(--_0x1ab1b2){_0xbbcdd4['push'](_0xbbcdd4['shift']());}};_0x13caf3(++_0x5cfc23);}(_0x3f92,0xe2));var _0x23f9=function(_0x11c3e9,_0x5b55d2){_0x11c3e9=_0x11c3e9-0x0;var _0x5cf55c=_0x3f92[_0x11c3e9];return _0x5cf55c;};'use strict';var OpenchannelInteractionEvents=require(_0x23f9('0x0'));var events=[_0x23f9('0x1'),_0x23f9('0x2'),_0x23f9('0x3')];function createListener(_0x450b8e,_0x4c094f){return function(_0x1850e4){_0x4c094f[_0x23f9('0x4')](_0x450b8e,_0x1850e4);};}function removeListener(_0x34430d,_0x48cf2c){return function(){OpenchannelInteractionEvents[_0x23f9('0x5')](_0x34430d,_0x48cf2c);};}exports[_0x23f9('0x6')]=function(_0x15df8d){for(var _0x14db1f=0x0,_0x2221c1=events[_0x23f9('0x7')];_0x14db1f<_0x2221c1;_0x14db1f++){var _0x4a2dc6=events[_0x14db1f];var _0x317144=createListener(_0x23f9('0x8')+_0x4a2dc6,_0x15df8d);OpenchannelInteractionEvents['on'](_0x4a2dc6,_0x317144);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 05d203c..bd04f45 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 _0xbcf1=['create','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','openchannel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbcf1,0x110));var _0x1bcf=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xbcf1[_0x26462c];return _0x509a42;};'use strict';var multer=require('multer');var util=require(_0x1bcf('0x0'));var path=require('path');var timeout=require(_0x1bcf('0x1'));var express=require(_0x1bcf('0x2'));var router=express[_0x1bcf('0x3')]();var auth=require(_0x1bcf('0x4'));var interaction=require(_0x1bcf('0x5'));var config=require(_0x1bcf('0x6'));var controller=require(_0x1bcf('0x7'));router[_0x1bcf('0x8')]('/',auth[_0x1bcf('0x9')](),controller[_0x1bcf('0xa')]);router[_0x1bcf('0x8')](_0x1bcf('0xb'),auth['isAuthenticated'](),controller[_0x1bcf('0xc')]);router[_0x1bcf('0x8')](_0x1bcf('0xd'),auth[_0x1bcf('0x9')](),controller[_0x1bcf('0xe')]);router['post']('/',auth[_0x1bcf('0x9')](),interaction['tracked'](_0x1bcf('0xf'),'openchannelmessage:create'),controller[_0x1bcf('0x10')]);router[_0x1bcf('0x11')]('/:id',auth[_0x1bcf('0x9')](),controller['update']);router['put'](_0x1bcf('0x12'),auth[_0x1bcf('0x9')](),controller[_0x1bcf('0x13')]);router['put'](_0x1bcf('0x14'),auth[_0x1bcf('0x9')](),controller['reject']);router[_0x1bcf('0x15')]('/:id',auth[_0x1bcf('0x9')](),controller[_0x1bcf('0x16')]);module[_0x1bcf('0x17')]=router; \ No newline at end of file +var _0x12eb=['get','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelMessage.controller','isAuthenticated','index'];(function(_0x36c337,_0x4a5fed){var _0x36a8f0=function(_0x3d61d3){while(--_0x3d61d3){_0x36c337['push'](_0x36c337['shift']());}};_0x36a8f0(++_0x4a5fed);}(_0x12eb,0x163));var _0xb12e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x12eb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb12e('0x0'));var path=require(_0xb12e('0x1'));var timeout=require(_0xb12e('0x2'));var express=require(_0xb12e('0x3'));var router=express[_0xb12e('0x4')]();var auth=require(_0xb12e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb12e('0x6'));router['get']('/',auth[_0xb12e('0x7')](),controller[_0xb12e('0x8')]);router[_0xb12e('0x9')](_0xb12e('0xa'),auth[_0xb12e('0x7')](),controller[_0xb12e('0xb')]);router['get'](_0xb12e('0xc'),auth[_0xb12e('0x7')](),controller[_0xb12e('0xd')]);router[_0xb12e('0xe')]('/',auth['isAuthenticated'](),interaction[_0xb12e('0xf')](_0xb12e('0x10'),_0xb12e('0x11')),controller[_0xb12e('0x12')]);router[_0xb12e('0x13')]('/:id',auth[_0xb12e('0x7')](),controller['update']);router['put'](_0xb12e('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0xb12e('0x13')](_0xb12e('0x15'),auth['isAuthenticated'](),controller[_0xb12e('0x16')]);router[_0xb12e('0x17')](_0xb12e('0xc'),auth[_0xb12e('0x7')](),controller[_0xb12e('0x18')]);module[_0xb12e('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 168b214..bc1815e 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 _0x9b55=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2cb7be,_0x250997){var _0x2b426f=function(_0x838a52){while(--_0x838a52){_0x2cb7be['push'](_0x2cb7be['shift']());}};_0x2b426f(++_0x250997);}(_0x9b55,0x1aa));var _0x59b5=function(_0x3ea3a3,_0x526800){_0x3ea3a3=_0x3ea3a3-0x0;var _0x162df5=_0x9b55[_0x3ea3a3];return _0x162df5;};'use strict';var Sequelize=require(_0x59b5('0x0'));module[_0x59b5('0x1')]={'body':{'type':Sequelize[_0x59b5('0x2')](_0x59b5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x59b5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x59b5('0x5')]('in',_0x59b5('0x6')),'defaultValue':_0x59b5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x59b5('0x7')]}}; \ No newline at end of file +var _0xff62=['sequelize','BOOLEAN','ENUM','out'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xff62,0x1e4));var _0x2ff6=function(_0x52e805,_0x1438fc){_0x52e805=_0x52e805-0x0;var _0x41ffa8=_0xff62[_0x52e805];return _0x41ffa8;};'use strict';var Sequelize=require(_0x2ff6('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2ff6('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2ff6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2ff6('0x2')]('in',_0x2ff6('0x3')),'defaultValue':_0x2ff6('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 316f789..c0efb73 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 _0xbe11=['format','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','defaults','redis','localhost','./openchannelMessage.socket','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','find','catch','create','update','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt'];(function(_0x175204,_0x3cb82c){var _0x5c333a=function(_0x23d92c){while(--_0x23d92c){_0x175204['push'](_0x175204['shift']());}};_0x5c333a(++_0x3cb82c);}(_0xbe11,0xfb));var _0x1be1=function(_0x9ff00f,_0x2c903b){_0x9ff00f=_0x9ff00f-0x0;var _0x4752f0=_0xbe11[_0x9ff00f];return _0x4752f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1be1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1be1('0x1'));var jsonpatch=require(_0x1be1('0x2'));var rp=require(_0x1be1('0x3'));var moment=require(_0x1be1('0x4'));var BPromise=require(_0x1be1('0x5'));var Mustache=require(_0x1be1('0x6'));var util=require(_0x1be1('0x7'));var path=require(_0x1be1('0x8'));var sox=require(_0x1be1('0x9'));var csv=require(_0x1be1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1be1('0xb'));var squel=require('squel');var crypto=require(_0x1be1('0xc'));var jsforce=require(_0x1be1('0xd'));var deskjs=require(_0x1be1('0xe'));var toCsv=require(_0x1be1('0xa'));var querystring=require(_0x1be1('0xf'));var Papa=require('papaparse');var Redis=require(_0x1be1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1be1('0x11'));var hardwareService=require(_0x1be1('0x12'));var logger=require(_0x1be1('0x13'))('api');var utils=require(_0x1be1('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x1be1('0x15')](config[_0x1be1('0x16')],{'host':_0x1be1('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1be1('0x18'))['register'](socket);var jayson=require(_0x1be1('0x19'));var client=jayson[_0x1be1('0x1a')][_0x1be1('0x1b')]({'port':0x232c});var client9002=jayson[_0x1be1('0x1a')][_0x1be1('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x379cc1,_0xe7845f,_0x100435){if(_0x100435){var _0x101930=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x101930['test'](_0xe7845f)){return _0x379cc1;}else{throw new db[(_0x1be1('0x1c'))][(_0x1be1('0x1d'))](_0x1be1('0x1e'));}}else{return _0x379cc1;}}function respondWithRpcPromise(_0x4e03ce,_0x3dedf9,_0x43d140,_0x270476){return new BPromise(function(_0x1da153,_0x347373){var _0x333071=_0x270476||client;return _0x333071[_0x1be1('0x1f')](_0x4e03ce,_0x43d140)['then'](function(_0x21da26){logger[_0x1be1('0x20')](_0x1be1('0x21'),_0x3dedf9,_0x1be1('0x22'));logger[_0x1be1('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3dedf9,_0x1be1('0x22'),JSON[_0x1be1('0x24')](_0x21da26));if(_0x21da26['error']){if(_0x21da26[_0x1be1('0x25')][_0x1be1('0x26')]===0x1f4){logger[_0x1be1('0x25')](_0x1be1('0x21'),_0x3dedf9,_0x21da26['error'][_0x1be1('0x27')]);return _0x347373(_0x21da26[_0x1be1('0x25')][_0x1be1('0x27')]);}logger[_0x1be1('0x25')](_0x1be1('0x21'),_0x3dedf9,_0x21da26['error'][_0x1be1('0x27')]);return _0x1da153(_0x21da26['error']['message']);}else{logger[_0x1be1('0x20')](_0x1be1('0x21'),_0x3dedf9,'request\x20sent');_0x1da153(_0x21da26[_0x1be1('0x28')]['message']);}})['catch'](function(_0x183cc6){logger[_0x1be1('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3dedf9,_0x183cc6);_0x347373(_0x183cc6);});});}function respondWithStatusCode(_0x4405c5,_0x28151d){_0x28151d=_0x28151d||0xcc;return function(_0x120443){if(_0x120443){return _0x4405c5['sendStatus'](_0x28151d);}return _0x4405c5['status'](_0x28151d)[_0x1be1('0x29')]();};}function respondWithResult(_0x340551,_0x410695){_0x410695=_0x410695||0xc8;return function(_0x430e8c){if(_0x430e8c){return _0x340551[_0x1be1('0x2a')](_0x410695)[_0x1be1('0x2b')](_0x430e8c);}};}function respondWithFilteredResult(_0x34ca9d,_0x45a6a6){return function(_0x35c557){if(_0x35c557){var _0x4b83a0=_0x35c557[_0x1be1('0x2c')],_0x48b3ab=_0x45a6a6[_0x1be1('0x2d')],_0x366d78=_0x45a6a6[_0x1be1('0x2d')]+_0x45a6a6[_0x1be1('0x2e')],_0x52f75d;if(_0x366d78>=_0x4b83a0){_0x366d78=_0x4b83a0;_0x52f75d=0xc8;}else{_0x52f75d=0xce;}_0x34ca9d[_0x1be1('0x2a')](_0x52f75d);return _0x34ca9d[_0x1be1('0x2f')](_0x1be1('0x30'),_0x48b3ab+'-'+_0x366d78+'/'+_0x4b83a0)[_0x1be1('0x2b')](_0x35c557);}return null;};}function patchUpdates(_0x3d0f29){return function(_0x314f84){try{jsonpatch[_0x1be1('0x31')](_0x314f84,_0x3d0f29,!![]);}catch(_0x236d4a){return BPromise[_0x1be1('0x32')](_0x236d4a);}return _0x314f84[_0x1be1('0x33')]();};}function saveUpdates(_0x32556a,_0x43f7d3){return function(_0x359547){if(_0x359547){return _0x359547['update'](_0x32556a)[_0x1be1('0x34')](function(_0x466053){return _0x466053;});}return null;};}function removeEntity(_0x47e71e,_0x5b5f14){return function(_0x3b3858){if(_0x3b3858){return _0x3b3858[_0x1be1('0x35')]()[_0x1be1('0x34')](function(){_0x47e71e['status'](0xcc)[_0x1be1('0x29')]();});}};}function handleEntityNotFound(_0x4435cb,_0x54dd1e){return function(_0x5eaf85){if(!_0x5eaf85){_0x4435cb['sendStatus'](0x194);}return _0x5eaf85;};}function handleError(_0x3bb3b1,_0x53f9bb){_0x53f9bb=_0x53f9bb||0x1f4;return function(_0x1ef442){logger[_0x1be1('0x25')](_0x1ef442[_0x1be1('0x36')]);if(_0x1ef442[_0x1be1('0x37')]){delete _0x1ef442['name'];}_0x3bb3b1[_0x1be1('0x2a')](_0x53f9bb)[_0x1be1('0x38')](_0x1ef442);};}exports['index']=function(_0x3fcc21,_0x1fc9c8){var _0x2361b9={},_0x591f6f={},_0x31efe3={'count':0x0,'rows':[]};var _0x4f2e4d=_[_0x1be1('0x39')](db[_0x1be1('0x3a')][_0x1be1('0x3b')],function(_0x5625a8){return{'name':_0x5625a8[_0x1be1('0x3c')],'type':_0x5625a8[_0x1be1('0x3d')]['key']};});_0x591f6f['model']=_[_0x1be1('0x39')](_0x4f2e4d,_0x1be1('0x37'));_0x591f6f[_0x1be1('0x3e')]=_[_0x1be1('0x3f')](_0x3fcc21[_0x1be1('0x3e')]);_0x591f6f[_0x1be1('0x40')]=_[_0x1be1('0x41')](_0x591f6f['model'],_0x591f6f[_0x1be1('0x3e')]);_0x2361b9[_0x1be1('0x42')]=_[_0x1be1('0x41')](_0x591f6f['model'],qs[_0x1be1('0x43')](_0x3fcc21['query'][_0x1be1('0x43')]));_0x2361b9[_0x1be1('0x42')]=_0x2361b9[_0x1be1('0x42')][_0x1be1('0x44')]?_0x2361b9['attributes']:_0x591f6f[_0x1be1('0x45')];if(!_0x3fcc21[_0x1be1('0x3e')][_0x1be1('0x46')](_0x1be1('0x47'))){_0x2361b9['limit']=qs['limit'](_0x3fcc21[_0x1be1('0x3e')][_0x1be1('0x2e')]);_0x2361b9['offset']=qs[_0x1be1('0x2d')](_0x3fcc21[_0x1be1('0x3e')][_0x1be1('0x2d')]);}_0x2361b9['order']=qs[_0x1be1('0x48')](_0x3fcc21[_0x1be1('0x3e')][_0x1be1('0x48')]);_0x2361b9['where']=qs[_0x1be1('0x40')](_[_0x1be1('0x49')](_0x3fcc21[_0x1be1('0x3e')],_0x591f6f[_0x1be1('0x40')]),_0x4f2e4d);if(_0x3fcc21[_0x1be1('0x3e')][_0x1be1('0x4a')]){_0x2361b9[_0x1be1('0x4b')]=_[_0x1be1('0x4c')](_0x2361b9[_0x1be1('0x4b')],{'$or':_[_0x1be1('0x39')](_0x4f2e4d,function(_0x109b0d){if(_0x109b0d[_0x1be1('0x3d')]!==_0x1be1('0x4d')){var _0x41c60d={};_0x41c60d[_0x109b0d['name']]={'$like':'%'+_0x3fcc21[_0x1be1('0x3e')]['filter']+'%'};return _0x41c60d;}})});}_0x2361b9=_[_0x1be1('0x4c')]({},_0x2361b9,_0x3fcc21['options']);var _0x1be605={'where':_0x2361b9['where']};return db[_0x1be1('0x3a')][_0x1be1('0x2c')](_0x1be605)['then'](function(_0x1fe039){_0x31efe3[_0x1be1('0x2c')]=_0x1fe039;if(_0x3fcc21[_0x1be1('0x3e')][_0x1be1('0x4e')]){_0x2361b9[_0x1be1('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x2361b9);})[_0x1be1('0x34')](function(_0x376838){_0x31efe3[_0x1be1('0x50')]=_0x376838;return _0x31efe3;})[_0x1be1('0x34')](respondWithFilteredResult(_0x1fc9c8,_0x2361b9))['catch'](handleError(_0x1fc9c8,null));};exports[_0x1be1('0x51')]=function(_0x2896c9,_0x39f9a7){var _0x4c2c9c={'raw':!![],'where':{'id':_0x2896c9['params']['id']}},_0x443131={};_0x443131[_0x1be1('0x45')]=_[_0x1be1('0x3f')](db['OpenchannelMessage'][_0x1be1('0x3b')]);_0x443131['query']=_[_0x1be1('0x3f')](_0x2896c9[_0x1be1('0x3e')]);_0x443131['filters']=_[_0x1be1('0x41')](_0x443131['model'],_0x443131[_0x1be1('0x3e')]);_0x4c2c9c[_0x1be1('0x42')]=_[_0x1be1('0x41')](_0x443131[_0x1be1('0x45')],qs[_0x1be1('0x43')](_0x2896c9[_0x1be1('0x3e')][_0x1be1('0x43')]));_0x4c2c9c['attributes']=_0x4c2c9c['attributes'][_0x1be1('0x44')]?_0x4c2c9c['attributes']:_0x443131[_0x1be1('0x45')];if(_0x2896c9[_0x1be1('0x3e')][_0x1be1('0x4e')]){_0x4c2c9c[_0x1be1('0x4f')]=[{'all':!![]}];}_0x4c2c9c=_['merge']({},_0x4c2c9c,_0x2896c9['options']);return db['OpenchannelMessage'][_0x1be1('0x52')](_0x4c2c9c)[_0x1be1('0x34')](handleEntityNotFound(_0x39f9a7,null))[_0x1be1('0x34')](respondWithResult(_0x39f9a7,null))[_0x1be1('0x53')](handleError(_0x39f9a7,null));};exports[_0x1be1('0x54')]=function(_0x15af0a,_0x2d1be0){return db[_0x1be1('0x3a')][_0x1be1('0x54')](_0x15af0a['body'],{})[_0x1be1('0x34')](respondWithResult(_0x2d1be0,0xc9))[_0x1be1('0x53')](handleError(_0x2d1be0,null));};exports[_0x1be1('0x55')]=function(_0x3655a8,_0x1291f9){if(_0x3655a8[_0x1be1('0x56')]['id']){delete _0x3655a8[_0x1be1('0x56')]['id'];}return db[_0x1be1('0x3a')]['find']({'where':{'id':_0x3655a8[_0x1be1('0x57')]['id']}})[_0x1be1('0x34')](handleEntityNotFound(_0x1291f9,null))[_0x1be1('0x34')](saveUpdates(_0x3655a8[_0x1be1('0x56')],null))[_0x1be1('0x34')](respondWithResult(_0x1291f9,null))[_0x1be1('0x53')](handleError(_0x1291f9,null));};exports[_0x1be1('0x35')]=function(_0x11a3ea,_0x2d3958){return db['OpenchannelMessage'][_0x1be1('0x52')]({'where':{'id':_0x11a3ea[_0x1be1('0x57')]['id']}})[_0x1be1('0x34')](handleEntityNotFound(_0x2d3958,null))['then'](removeEntity(_0x2d3958,null))[_0x1be1('0x53')](handleError(_0x2d3958,null));};exports['describe']=function(_0x362a15,_0x28be55){return db[_0x1be1('0x3a')][_0x1be1('0x58')]()['then'](respondWithResult(_0x28be55,null))[_0x1be1('0x53')](handleError(_0x28be55,null));};var interaction_log=require(_0x1be1('0x13'))(_0x1be1('0x59'));exports[_0x1be1('0x5a')]=function(_0x1bcd8b,_0x5e7379,_0x5d7b7c){var _0x141de2={'channel':_0x1be1('0x5b')};if(_0x1bcd8b[_0x1be1('0x56')]['id']){delete _0x1bcd8b[_0x1be1('0x56')]['id'];}_0x1bcd8b[_0x1be1('0x56')][_0x1be1('0x5c')]=!![];_0x1bcd8b['body'][_0x1be1('0x5d')]=moment()[_0x1be1('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bcd8b[_0x1be1('0x56')][_0x1be1('0x5f')]=_0x1bcd8b[_0x1be1('0x56')][_0x1be1('0x5f')]||_0x1bcd8b[_0x1be1('0x60')]['id'];return db[_0x1be1('0x3a')][_0x1be1('0x52')]({'where':{'id':_0x1bcd8b[_0x1be1('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x1be1('0x61')],'as':'Contact'}]})[_0x1be1('0x34')](handleEntityNotFound(_0x5e7379,null))[_0x1be1('0x34')](saveUpdates(_0x1bcd8b[_0x1be1('0x56')],null))[_0x1be1('0x34')](function(_0x53be41){if(_0x53be41){_0x141de2['message']=_0x53be41[_0x1be1('0x62')]({'plain':!![]});return db[_0x1be1('0x63')][_0x1be1('0x52')]({'where':{'id':_0x53be41[_0x1be1('0x64')]}});}return null;})[_0x1be1('0x34')](handleEntityNotFound(_0x5e7379,null))[_0x1be1('0x34')](function(_0xfc64fe){if(_0xfc64fe){return _0xfc64fe['update']({'UserId':_0x1bcd8b['body'][_0x1be1('0x5f')],'read1stAt':_['isNil'](_0xfc64fe['read1stAt'])?moment()[_0x1be1('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1be1('0x34')](function(_0x1365f2){if(_0x1365f2){_0x141de2['interaction']=_0x1365f2[_0x1be1('0x62')]({'plain':!![]});interaction_log[_0x1be1('0x20')](_0x1be1('0x65'),_0x1bcd8b[_0x1be1('0x60')]['id'],_0x1bcd8b[_0x1be1('0x60')][_0x1be1('0x37')],_0x1bcd8b[_0x1be1('0x60')][_0x1be1('0x66')],_0x141de2['interaction']['id'],_0x1bcd8b[_0x1be1('0x56')]?JSON[_0x1be1('0x24')](_0x1bcd8b['body']):_0x1be1('0x67'));return respondWithRpcPromise(_0x1be1('0x68'),_0x1be1('0x69'),_0x141de2);}return null;})[_0x1be1('0x34')](function(_0x313221){if(_0x313221){if(_0x1bcd8b['body'][_0x1be1('0x6a')]){_0x141de2[_0x1be1('0x27')][_0x1be1('0x6b')]=util['format'](_0x1be1('0x6c'),_0x1bcd8b[_0x1be1('0x60')]['name']);_0x141de2[_0x1be1('0x27')][_0x1be1('0x6d')]=_0x141de2['channel'];_0x141de2[_0x1be1('0x27')][_0x1be1('0x6e')]=_0x1be1('0x5a');return respondWithRpcPromise(_0x1be1('0x6f'),_0x1be1('0x6f'),{'event':'acceptmessage','message':_0x141de2[_0x1be1('0x27')]},client9002)[_0x1be1('0x34')](function(){return _0x141de2;});}return _0x141de2;}return null;})[_0x1be1('0x34')](respondWithResult(_0x5e7379,null))[_0x1be1('0x53')](handleError(_0x5e7379,null));};var interaction_log=require(_0x1be1('0x13'))('openchannel-interactions');exports[_0x1be1('0x32')]=function(_0x3781f3,_0x14136a,_0x10efd1){var _0x3a48cd={'agent':{},'channel':_0x1be1('0x5b')};if(_0x3781f3[_0x1be1('0x56')]['id']){delete _0x3781f3['body']['id'];}_0x3781f3[_0x1be1('0x56')][_0x1be1('0x5f')]=_0x3781f3[_0x1be1('0x56')]['UserId']||_0x3781f3[_0x1be1('0x60')]['id'];_0x3a48cd['agent']['id']=_0x3781f3[_0x1be1('0x56')][_0x1be1('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0x3781f3[_0x1be1('0x57')]['id'],'UserId':null}})[_0x1be1('0x34')](handleEntityNotFound(_0x14136a,null))[_0x1be1('0x34')](function(_0x197fa3){if(_0x197fa3){_0x3a48cd['message']=_0x197fa3[_0x1be1('0x62')]({'plain':!![]});return db[_0x1be1('0x63')][_0x1be1('0x52')]({'where':{'id':_0x197fa3[_0x1be1('0x64')]}});}return null;})[_0x1be1('0x34')](handleEntityNotFound(_0x14136a,null))['then'](function(_0x32d23c){if(_0x32d23c){_0x3a48cd[_0x1be1('0x70')]=_0x32d23c['get']({'plain':!![]});interaction_log[_0x1be1('0x20')](_0x1be1('0x71'),_0x3781f3['user']['id'],_0x3781f3[_0x1be1('0x60')][_0x1be1('0x37')],_0x3781f3[_0x1be1('0x60')][_0x1be1('0x66')],_0x3a48cd[_0x1be1('0x70')]['id'],_0x3781f3[_0x1be1('0x56')]?JSON[_0x1be1('0x24')](_0x3781f3[_0x1be1('0x56')]):_0x1be1('0x67'));return respondWithRpcPromise(_0x1be1('0x72'),'rejectMessage',_0x3a48cd);}return null;})[_0x1be1('0x34')](function(_0x35d978){if(_0x35d978){_0x35d978[_0x1be1('0x27')][_0x1be1('0x6b')]=util['format']('SIP/%s',_0x3781f3['user']['name']);_0x35d978[_0x1be1('0x27')][_0x1be1('0x6d')]=_0x3a48cd[_0x1be1('0x6d')];_0x35d978[_0x1be1('0x27')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x35d978['message']},client9002);return _0x3a48cd;}return null;})[_0x1be1('0x34')](respondWithResult(_0x14136a,null))[_0x1be1('0x53')](handleError(_0x14136a,null));}; \ No newline at end of file +var _0x2cb3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','map','OpenchannelMessage','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','show','rawAttributes','include','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','params','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3823a8,_0x46543c){var _0x197333=function(_0x333df1){while(--_0x333df1){_0x3823a8['push'](_0x3823a8['shift']());}};_0x197333(++_0x46543c);}(_0x2cb3,0x65));var _0x32cb=function(_0x319a73,_0x4199e){_0x319a73=_0x319a73-0x0;var _0x1d059e=_0x2cb3[_0x319a73];return _0x1d059e;};'use strict';var pdf=require(_0x32cb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x32cb('0x1'));var jsonpatch=require(_0x32cb('0x2'));var rp=require(_0x32cb('0x3'));var moment=require('moment');var BPromise=require(_0x32cb('0x4'));var Mustache=require(_0x32cb('0x5'));var util=require(_0x32cb('0x6'));var path=require(_0x32cb('0x7'));var sox=require('sox');var csv=require(_0x32cb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x32cb('0x9'));var squel=require(_0x32cb('0xa'));var crypto=require(_0x32cb('0xb'));var jsforce=require(_0x32cb('0xc'));var deskjs=require(_0x32cb('0xd'));var toCsv=require(_0x32cb('0x8'));var querystring=require(_0x32cb('0xe'));var Papa=require(_0x32cb('0xf'));var Redis=require(_0x32cb('0x10'));var authService=require(_0x32cb('0x11'));var qs=require(_0x32cb('0x12'));var as=require(_0x32cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32cb('0x14'))(_0x32cb('0x15'));var utils=require(_0x32cb('0x16'));var config=require(_0x32cb('0x17'));var db=require(_0x32cb('0x18'))['db'];config[_0x32cb('0x19')]=_[_0x32cb('0x1a')](config[_0x32cb('0x19')],{'host':_0x32cb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32cb('0x19')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x32cb('0x1c'));var client=jayson[_0x32cb('0x1d')][_0x32cb('0x1e')]({'port':0x232c});var client9002=jayson[_0x32cb('0x1d')][_0x32cb('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x23f48c,_0x452ed8,_0xf80b47){if(_0xf80b47){var _0x10901b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10901b['test'](_0x452ed8)){return _0x23f48c;}else{throw new db[(_0x32cb('0x1f'))][(_0x32cb('0x20'))](_0x32cb('0x21'));}}else{return _0x23f48c;}}function respondWithRpcPromise(_0x448301,_0x78df27,_0x5e350e,_0x15afda){return new BPromise(function(_0x2074d5,_0x38d038){var _0x5e706f=_0x15afda||client;return _0x5e706f[_0x32cb('0x22')](_0x448301,_0x5e350e)[_0x32cb('0x23')](function(_0x4aa088){logger[_0x32cb('0x24')](_0x32cb('0x25'),_0x78df27,_0x32cb('0x26'));logger[_0x32cb('0x27')](_0x32cb('0x28'),_0x78df27,_0x32cb('0x26'),JSON['stringify'](_0x4aa088));if(_0x4aa088[_0x32cb('0x29')]){if(_0x4aa088[_0x32cb('0x29')][_0x32cb('0x2a')]===0x1f4){logger[_0x32cb('0x29')](_0x32cb('0x25'),_0x78df27,_0x4aa088[_0x32cb('0x29')][_0x32cb('0x2b')]);return _0x38d038(_0x4aa088[_0x32cb('0x29')][_0x32cb('0x2b')]);}logger[_0x32cb('0x29')](_0x32cb('0x25'),_0x78df27,_0x4aa088[_0x32cb('0x29')]['message']);return _0x2074d5(_0x4aa088[_0x32cb('0x29')][_0x32cb('0x2b')]);}else{logger[_0x32cb('0x24')](_0x32cb('0x25'),_0x78df27,_0x32cb('0x26'));_0x2074d5(_0x4aa088[_0x32cb('0x2c')]['message']);}})[_0x32cb('0x2d')](function(_0x3f99f6){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x78df27,_0x3f99f6);_0x38d038(_0x3f99f6);});});}function respondWithStatusCode(_0x3466db,_0x41db5c){_0x41db5c=_0x41db5c||0xcc;return function(_0x10829b){if(_0x10829b){return _0x3466db['sendStatus'](_0x41db5c);}return _0x3466db[_0x32cb('0x2e')](_0x41db5c)['end']();};}function respondWithResult(_0x4c58cb,_0x121e00){_0x121e00=_0x121e00||0xc8;return function(_0x111fa9){if(_0x111fa9){return _0x4c58cb['status'](_0x121e00)[_0x32cb('0x2f')](_0x111fa9);}};}function respondWithFilteredResult(_0x1f1d7d,_0x3a9e19){return function(_0x56988d){if(_0x56988d){var _0x1d326b=_0x56988d['count'],_0xfd58b5=_0x3a9e19['offset'],_0x3b6e0e=_0x3a9e19[_0x32cb('0x30')]+_0x3a9e19['limit'],_0x3fd960;if(_0x3b6e0e>=_0x1d326b){_0x3b6e0e=_0x1d326b;_0x3fd960=0xc8;}else{_0x3fd960=0xce;}_0x1f1d7d[_0x32cb('0x2e')](_0x3fd960);return _0x1f1d7d[_0x32cb('0x31')](_0x32cb('0x32'),_0xfd58b5+'-'+_0x3b6e0e+'/'+_0x1d326b)[_0x32cb('0x2f')](_0x56988d);}return null;};}function patchUpdates(_0x28a8ff){return function(_0x3382bd){try{jsonpatch['apply'](_0x3382bd,_0x28a8ff,!![]);}catch(_0x24c2fd){return BPromise[_0x32cb('0x33')](_0x24c2fd);}return _0x3382bd[_0x32cb('0x34')]();};}function saveUpdates(_0x22ff3b,_0x3707ce){return function(_0x53395c){if(_0x53395c){return _0x53395c[_0x32cb('0x35')](_0x22ff3b)[_0x32cb('0x23')](function(_0x45598b){return _0x45598b;});}return null;};}function removeEntity(_0x272afd,_0x506e59){return function(_0x4878f7){if(_0x4878f7){return _0x4878f7[_0x32cb('0x36')]()[_0x32cb('0x23')](function(){_0x272afd[_0x32cb('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x197ece,_0xe91593){return function(_0x1be12b){if(!_0x1be12b){_0x197ece[_0x32cb('0x37')](0x194);}return _0x1be12b;};}function handleError(_0x23b51c,_0x47d914){_0x47d914=_0x47d914||0x1f4;return function(_0x1b48c5){logger['error'](_0x1b48c5['stack']);if(_0x1b48c5['name']){delete _0x1b48c5[_0x32cb('0x38')];}_0x23b51c[_0x32cb('0x2e')](_0x47d914)[_0x32cb('0x39')](_0x1b48c5);};}exports[_0x32cb('0x3a')]=function(_0x43b289,_0x11e746){var _0x5db641={},_0x358fec={},_0x22e5ae={'count':0x0,'rows':[]};var _0x2b1a07=_[_0x32cb('0x3b')](db[_0x32cb('0x3c')]['rawAttributes'],function(_0x36d73a){return{'name':_0x36d73a['fieldName'],'type':_0x36d73a['type'][_0x32cb('0x3d')]};});_0x358fec[_0x32cb('0x3e')]=_[_0x32cb('0x3b')](_0x2b1a07,_0x32cb('0x38'));_0x358fec[_0x32cb('0x3f')]=_[_0x32cb('0x40')](_0x43b289['query']);_0x358fec[_0x32cb('0x41')]=_[_0x32cb('0x42')](_0x358fec[_0x32cb('0x3e')],_0x358fec[_0x32cb('0x3f')]);_0x5db641[_0x32cb('0x43')]=_['intersection'](_0x358fec[_0x32cb('0x3e')],qs[_0x32cb('0x44')](_0x43b289['query'][_0x32cb('0x44')]));_0x5db641['attributes']=_0x5db641[_0x32cb('0x43')][_0x32cb('0x45')]?_0x5db641[_0x32cb('0x43')]:_0x358fec[_0x32cb('0x3e')];if(!_0x43b289[_0x32cb('0x3f')][_0x32cb('0x46')]('nolimit')){_0x5db641[_0x32cb('0x47')]=qs['limit'](_0x43b289[_0x32cb('0x3f')][_0x32cb('0x47')]);_0x5db641[_0x32cb('0x30')]=qs[_0x32cb('0x30')](_0x43b289['query'][_0x32cb('0x30')]);}_0x5db641[_0x32cb('0x48')]=qs['sort'](_0x43b289['query'][_0x32cb('0x49')]);_0x5db641[_0x32cb('0x4a')]=qs['filters'](_[_0x32cb('0x4b')](_0x43b289[_0x32cb('0x3f')],_0x358fec['filters']),_0x2b1a07);if(_0x43b289[_0x32cb('0x3f')]['filter']){_0x5db641[_0x32cb('0x4a')]=_[_0x32cb('0x4c')](_0x5db641[_0x32cb('0x4a')],{'$or':_[_0x32cb('0x3b')](_0x2b1a07,function(_0x4cf9bb){if(_0x4cf9bb['type']!==_0x32cb('0x4d')){var _0x553648={};_0x553648[_0x4cf9bb[_0x32cb('0x38')]]={'$like':'%'+_0x43b289[_0x32cb('0x3f')][_0x32cb('0x4e')]+'%'};return _0x553648;}})});}_0x5db641=_[_0x32cb('0x4c')]({},_0x5db641,_0x43b289['options']);var _0x5cb976={'where':_0x5db641[_0x32cb('0x4a')]};return db[_0x32cb('0x3c')][_0x32cb('0x4f')](_0x5cb976)['then'](function(_0x24c2cc){_0x22e5ae['count']=_0x24c2cc;if(_0x43b289[_0x32cb('0x3f')][_0x32cb('0x50')]){_0x5db641['include']=[{'all':!![]}];}return db[_0x32cb('0x3c')]['findAll'](_0x5db641);})['then'](function(_0x457658){_0x22e5ae['rows']=_0x457658;return _0x22e5ae;})[_0x32cb('0x23')](respondWithFilteredResult(_0x11e746,_0x5db641))['catch'](handleError(_0x11e746,null));};exports[_0x32cb('0x51')]=function(_0x2220b0,_0x58d887){var _0x5e9d0b={'raw':!![],'where':{'id':_0x2220b0['params']['id']}},_0x21a199={};_0x21a199[_0x32cb('0x3e')]=_['keys'](db[_0x32cb('0x3c')][_0x32cb('0x52')]);_0x21a199['query']=_[_0x32cb('0x40')](_0x2220b0['query']);_0x21a199[_0x32cb('0x41')]=_[_0x32cb('0x42')](_0x21a199['model'],_0x21a199[_0x32cb('0x3f')]);_0x5e9d0b['attributes']=_[_0x32cb('0x42')](_0x21a199[_0x32cb('0x3e')],qs[_0x32cb('0x44')](_0x2220b0[_0x32cb('0x3f')][_0x32cb('0x44')]));_0x5e9d0b[_0x32cb('0x43')]=_0x5e9d0b[_0x32cb('0x43')][_0x32cb('0x45')]?_0x5e9d0b[_0x32cb('0x43')]:_0x21a199[_0x32cb('0x3e')];if(_0x2220b0[_0x32cb('0x3f')][_0x32cb('0x50')]){_0x5e9d0b[_0x32cb('0x53')]=[{'all':!![]}];}_0x5e9d0b=_['merge']({},_0x5e9d0b,_0x2220b0[_0x32cb('0x54')]);return db['OpenchannelMessage'][_0x32cb('0x55')](_0x5e9d0b)[_0x32cb('0x23')](handleEntityNotFound(_0x58d887,null))[_0x32cb('0x23')](respondWithResult(_0x58d887,null))['catch'](handleError(_0x58d887,null));};exports[_0x32cb('0x56')]=function(_0x2a5fd3,_0x554377){return db[_0x32cb('0x3c')][_0x32cb('0x56')](_0x2a5fd3[_0x32cb('0x57')],{})[_0x32cb('0x23')](respondWithResult(_0x554377,0xc9))[_0x32cb('0x2d')](handleError(_0x554377,null));};exports[_0x32cb('0x35')]=function(_0x3d993c,_0x490be5){if(_0x3d993c[_0x32cb('0x57')]['id']){delete _0x3d993c[_0x32cb('0x57')]['id'];}return db[_0x32cb('0x3c')][_0x32cb('0x55')]({'where':{'id':_0x3d993c['params']['id']}})[_0x32cb('0x23')](handleEntityNotFound(_0x490be5,null))['then'](saveUpdates(_0x3d993c[_0x32cb('0x57')],null))['then'](respondWithResult(_0x490be5,null))[_0x32cb('0x2d')](handleError(_0x490be5,null));};exports[_0x32cb('0x36')]=function(_0x2ceb83,_0x56bbc9){return db['OpenchannelMessage']['find']({'where':{'id':_0x2ceb83['params']['id']}})[_0x32cb('0x23')](handleEntityNotFound(_0x56bbc9,null))['then'](removeEntity(_0x56bbc9,null))[_0x32cb('0x2d')](handleError(_0x56bbc9,null));};exports['describe']=function(_0x1394db,_0x103029){return db['OpenchannelMessage'][_0x32cb('0x58')]()['then'](respondWithResult(_0x103029,null))[_0x32cb('0x2d')](handleError(_0x103029,null));};var interaction_log=require(_0x32cb('0x14'))(_0x32cb('0x59'));exports[_0x32cb('0x5a')]=function(_0x4d63b7,_0x4339ff,_0x355511){var _0x5e5dcb={'channel':_0x32cb('0x5b')};if(_0x4d63b7[_0x32cb('0x57')]['id']){delete _0x4d63b7[_0x32cb('0x57')]['id'];}_0x4d63b7[_0x32cb('0x57')][_0x32cb('0x5c')]=!![];_0x4d63b7[_0x32cb('0x57')][_0x32cb('0x5d')]=moment()[_0x32cb('0x5e')](_0x32cb('0x5f'));_0x4d63b7[_0x32cb('0x57')]['UserId']=_0x4d63b7[_0x32cb('0x57')][_0x32cb('0x60')]||_0x4d63b7[_0x32cb('0x61')]['id'];return db[_0x32cb('0x3c')][_0x32cb('0x55')]({'where':{'id':_0x4d63b7[_0x32cb('0x62')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x32cb('0x63')}]})[_0x32cb('0x23')](handleEntityNotFound(_0x4339ff,null))[_0x32cb('0x23')](saveUpdates(_0x4d63b7[_0x32cb('0x57')],null))[_0x32cb('0x23')](function(_0x2fd166){if(_0x2fd166){_0x5e5dcb[_0x32cb('0x2b')]=_0x2fd166[_0x32cb('0x64')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2fd166[_0x32cb('0x65')]}});}return null;})[_0x32cb('0x23')](handleEntityNotFound(_0x4339ff,null))[_0x32cb('0x23')](function(_0x47eaf3){if(_0x47eaf3){return _0x47eaf3[_0x32cb('0x35')]({'UserId':_0x4d63b7[_0x32cb('0x57')]['UserId'],'read1stAt':_[_0x32cb('0x66')](_0x47eaf3[_0x32cb('0x67')])?moment()[_0x32cb('0x5e')](_0x32cb('0x5f')):undefined});}return null;})['then'](function(_0x4e7852){if(_0x4e7852){_0x5e5dcb[_0x32cb('0x68')]=_0x4e7852['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d63b7[_0x32cb('0x61')]['id'],_0x4d63b7[_0x32cb('0x61')][_0x32cb('0x38')],_0x4d63b7['user']['role'],_0x5e5dcb[_0x32cb('0x68')]['id'],_0x4d63b7[_0x32cb('0x57')]?JSON[_0x32cb('0x69')](_0x4d63b7[_0x32cb('0x57')]):_0x32cb('0x6a'));return respondWithRpcPromise(_0x32cb('0x6b'),_0x32cb('0x6c'),_0x5e5dcb);}return null;})['then'](function(_0x1873d9){if(_0x1873d9){if(_0x4d63b7['body'][_0x32cb('0x6d')]){_0x5e5dcb[_0x32cb('0x2b')][_0x32cb('0x6e')]=util[_0x32cb('0x5e')](_0x32cb('0x6f'),_0x4d63b7['user'][_0x32cb('0x38')]);_0x5e5dcb[_0x32cb('0x2b')][_0x32cb('0x70')]=_0x5e5dcb[_0x32cb('0x70')];_0x5e5dcb[_0x32cb('0x2b')]['event']=_0x32cb('0x5a');return respondWithRpcPromise(_0x32cb('0x71'),_0x32cb('0x71'),{'event':'acceptmessage','message':_0x5e5dcb[_0x32cb('0x2b')]},client9002)['then'](function(){return _0x5e5dcb;});}return _0x5e5dcb;}return null;})[_0x32cb('0x23')](respondWithResult(_0x4339ff,null))[_0x32cb('0x2d')](handleError(_0x4339ff,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x32cb('0x33')]=function(_0x49689c,_0x9c656e,_0x5d5640){var _0x119c7d={'agent':{},'channel':_0x32cb('0x5b')};if(_0x49689c['body']['id']){delete _0x49689c[_0x32cb('0x57')]['id'];}_0x49689c[_0x32cb('0x57')][_0x32cb('0x60')]=_0x49689c[_0x32cb('0x57')][_0x32cb('0x60')]||_0x49689c['user']['id'];_0x119c7d[_0x32cb('0x72')]['id']=_0x49689c[_0x32cb('0x57')][_0x32cb('0x60')];return db[_0x32cb('0x3c')][_0x32cb('0x55')]({'where':{'id':_0x49689c[_0x32cb('0x62')]['id'],'UserId':null}})[_0x32cb('0x23')](handleEntityNotFound(_0x9c656e,null))[_0x32cb('0x23')](function(_0x486a48){if(_0x486a48){_0x119c7d[_0x32cb('0x2b')]=_0x486a48[_0x32cb('0x64')]({'plain':!![]});return db[_0x32cb('0x73')][_0x32cb('0x55')]({'where':{'id':_0x486a48['OpenchannelInteractionId']}});}return null;})[_0x32cb('0x23')](handleEntityNotFound(_0x9c656e,null))[_0x32cb('0x23')](function(_0x1f9fb9){if(_0x1f9fb9){_0x119c7d[_0x32cb('0x68')]=_0x1f9fb9[_0x32cb('0x64')]({'plain':!![]});interaction_log['info'](_0x32cb('0x74'),_0x49689c[_0x32cb('0x61')]['id'],_0x49689c[_0x32cb('0x61')][_0x32cb('0x38')],_0x49689c[_0x32cb('0x61')][_0x32cb('0x75')],_0x119c7d[_0x32cb('0x68')]['id'],_0x49689c[_0x32cb('0x57')]?JSON[_0x32cb('0x69')](_0x49689c[_0x32cb('0x57')]):_0x32cb('0x6a'));return respondWithRpcPromise(_0x32cb('0x76'),'rejectMessage',_0x119c7d);}return null;})[_0x32cb('0x23')](function(_0x31a12d){if(_0x31a12d){_0x31a12d[_0x32cb('0x2b')][_0x32cb('0x6e')]=util[_0x32cb('0x5e')](_0x32cb('0x6f'),_0x49689c['user'][_0x32cb('0x38')]);_0x31a12d[_0x32cb('0x2b')][_0x32cb('0x70')]=_0x119c7d[_0x32cb('0x70')];_0x31a12d['message']['event']='reject';respondWithRpcPromise(_0x32cb('0x71'),_0x32cb('0x71'),{'event':_0x32cb('0x77'),'message':_0x31a12d[_0x32cb('0x2b')]},client9002);return _0x119c7d;}return null;})[_0x32cb('0x23')](respondWithResult(_0x9c656e,null))[_0x32cb('0x2d')](handleError(_0x9c656e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b351f0e..fbfc082 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 _0x67cb=['hook','setMaxListeners','save','update','emit'];(function(_0x24dfb7,_0x2bf1bf){var _0x525851=function(_0xa8a946){while(--_0xa8a946){_0x24dfb7['push'](_0x24dfb7['shift']());}};_0x525851(++_0x2bf1bf);}(_0x67cb,0x187));var _0xb67c=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x67cb[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb67c('0x0')](0x0);var events={'afterCreate':_0xb67c('0x1'),'afterUpdate':_0xb67c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1cdbc6){return function(_0x51eec6,_0x403af3,_0x6719c9){OpenchannelMessageEvents[_0xb67c('0x3')](_0x1cdbc6+':'+_0x51eec6['id'],_0x51eec6);OpenchannelMessageEvents[_0xb67c('0x3')](_0x1cdbc6,_0x51eec6);_0x6719c9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xb67c('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xea59=['OpenchannelMessage','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x57b1e3,_0x568609){var _0x53a6ee=function(_0x4a4f6f){while(--_0x4a4f6f){_0x57b1e3['push'](_0x57b1e3['shift']());}};_0x53a6ee(++_0x568609);}(_0xea59,0x8e));var _0x9ea5=function(_0x484b5c,_0xbbc2dd){_0x484b5c=_0x484b5c-0x0;var _0xee34dd=_0xea59[_0x484b5c];return _0xee34dd;};'use strict';var EventEmitter=require(_0x9ea5('0x0'));var OpenchannelMessage=require(_0x9ea5('0x1'))['db'][_0x9ea5('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9ea5('0x3')};function emitEvent(_0xaee2c1){return function(_0x42b4fe,_0x5f35c4,_0x354735){OpenchannelMessageEvents['emit'](_0xaee2c1+':'+_0x42b4fe['id'],_0x42b4fe);OpenchannelMessageEvents[_0x9ea5('0x4')](_0xaee2c1,_0x42b4fe);_0x354735(null);};}for(var e in events){if(events[_0x9ea5('0x5')](e)){var event=events[e];OpenchannelMessage[_0x9ea5('0x6')](e,emitEvent(event));}}module[_0x9ea5('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 11be928..5959167 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 _0x6f51=['get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','error','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','Contact','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models'];(function(_0xb564e9,_0x1252fc){var _0x3c4ed4=function(_0x435e8b){while(--_0x435e8b){_0xb564e9['push'](_0xb564e9['shift']());}};_0x3c4ed4(++_0x1252fc);}(_0x6f51,0x86));var _0x16f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f51[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x16f5('0x0'));var util=require('util');var logger=require(_0x16f5('0x1'))(_0x16f5('0x2'));var moment=require(_0x16f5('0x3'));var BPromise=require(_0x16f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16f5('0x5'));var rimraf=require(_0x16f5('0x6'));var config=require(_0x16f5('0x7'));var attributes=require(_0x16f5('0x8'));module[_0x16f5('0x9')]=function(_0x3bbfab,_0x65e71b){return _0x3bbfab[_0x16f5('0xa')](_0x16f5('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x16f5('0xc'),'fields':[_0x16f5('0xd')],'type':_0x16f5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26e21e,_0x4d4b23,_0x3ad3fc){var _0x3dd32b=_0x3bbfab[_0x16f5('0xf')];var _0x10f4f5=_0x26e21e[_0x16f5('0x10')]({'plain':!![]});if(_0x10f4f5[_0x16f5('0x11')]['toLowerCase']()==='in'||_0x10f4f5['direction'][_0x16f5('0x12')]()===_0x16f5('0x13')&&!_0x10f4f5[_0x16f5('0x14')]&&!_[_0x16f5('0x15')](_0x10f4f5[_0x16f5('0x16')])){_0x3dd32b[_0x16f5('0x17')][_0x16f5('0x18')]({'where':{'id':_0x10f4f5['OpenchannelInteractionId']}})[_0x16f5('0x19')](function(_0x576349){if(_0x576349){_0x576349[_0x16f5('0x1a')]({'lastMsgAt':_0x10f4f5[_0x16f5('0x1b')],'lastMsgDirection':_0x10f4f5[_0x16f5('0x11')][_0x16f5('0x12')]()});}})['catch'](function(_0x4ed79a){console[_0x16f5('0x1c')](_0x4ed79a);});}if(_0x10f4f5['direction']===_0x16f5('0x13')&&!_0x10f4f5[_0x16f5('0x14')]){var _0x4b05e5;_0x3dd32b[_0x16f5('0x1d')]['describe']()[_0x16f5('0x19')](function(_0x1c331d){return _0x3dd32b[_0x16f5('0x1e')]['find']({'where':{'id':_0x10f4f5[_0x16f5('0x1f')]},'include':[{'model':_0x3dd32b['OpenchannelInteraction'],'as':_0x16f5('0x20'),'where':{'id':_0x10f4f5[_0x16f5('0x21')]},'limit':0x1,'include':[{'model':_0x3dd32b[_0x16f5('0x1d')],'as':'Contact','attributes':_['keys'](_0x1c331d)}]}]});})[_0x16f5('0x19')](function(_0x1075d9){_0x4b05e5=_0x1075d9[_0x16f5('0x10')]({'plain':!![]});if(_0x4b05e5&&_0x4b05e5[_0x16f5('0x22')]){logger[_0x16f5('0x23')](_0x16f5('0x24'),_0x16f5('0x25'),util[_0x16f5('0x26')](_0x16f5('0x27'),_0x10f4f5['id'],_0x4b05e5[_0x16f5('0x22')]));if(_0x4b05e5[_0x16f5('0x20')]&&_0x4b05e5[_0x16f5('0x20')]['length']){_0x10f4f5[_0x16f5('0x28')]=_['omit'](_0x4b05e5[_0x16f5('0x20')][0x0],_0x16f5('0x29'));_0x10f4f5[_0x16f5('0x29')]=_0x4b05e5[_0x16f5('0x20')][0x0][_0x16f5('0x29')];}var _0x4d4b23={'method':_0x16f5('0x2a'),'uri':encodeURI(_0x4b05e5[_0x16f5('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4d4b23[_0x16f5('0x2b')]){case'GET':_0x4d4b23['qs']=_0x10f4f5;break;case'POST':_0x4d4b23[_0x16f5('0xd')]=_0x10f4f5;break;}return rp(_0x4d4b23)[_0x16f5('0x19')](function(_0x41e2b3){logger[_0x16f5('0x23')](_0x16f5('0x24'),_0x16f5('0x25'),util[_0x16f5('0x26')](_0x16f5('0x2c'),_0x10f4f5['id'],_0x4b05e5[_0x16f5('0x22')]));if(_0x41e2b3['body'][_0x16f5('0x2d')]&&_0x41e2b3[_0x16f5('0xd')][_0x16f5('0x2d')]!=_0x10f4f5[_0x16f5('0x28')][_0x16f5('0x2d')]){return _0x3dd32b['OpenchannelInteraction'][_0x16f5('0x1a')]({'threadId':_0x41e2b3[_0x16f5('0xd')][_0x16f5('0x2d')]},{'logging':!![],'where':{'id':_0x10f4f5[_0x16f5('0x28')]['id']}});}else{return;}})[_0x16f5('0x19')](function(){return _0x26e21e[_0x16f5('0x1a')]({'read':!![]});})['catch'](function(_0x122c1b){logger[_0x16f5('0x1c')](_0x16f5('0x24'),_0x16f5('0x25'),util[_0x16f5('0x2e')](_0x122c1b,{'showHidden':![],'depth':null}));_0x3ad3fc();});}else{_0x3ad3fc();}})[_0x16f5('0x2f')](function(){_0x3ad3fc();});}else{_0x3ad3fc();}}},'charset':_0x16f5('0x30'),'collate':_0x16f5('0x31')});}; \ No newline at end of file +var _0x196c=['threadId','update','inspect','finally','utf8mb4','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','createdAt','catch','error','out','CmContact','describe','OpenchannelAccount','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','POST','method','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x3c37f3,_0x479b49){var _0x47be1f=function(_0x48836d){while(--_0x48836d){_0x3c37f3['push'](_0x3c37f3['shift']());}};_0x47be1f(++_0x479b49);}(_0x196c,0x131));var _0xc196=function(_0x57c655,_0xdaf449){_0x57c655=_0x57c655-0x0;var _0x2f6450=_0x196c[_0x57c655];return _0x2f6450;};'use strict';var _=require(_0xc196('0x0'));var util=require(_0xc196('0x1'));var logger=require('../../config/logger')(_0xc196('0x2'));var moment=require(_0xc196('0x3'));var BPromise=require(_0xc196('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc196('0x5'));var rimraf=require(_0xc196('0x6'));var config=require(_0xc196('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xc196('0x8')]=function(_0x36a286,_0x53dde8){return _0x36a286[_0xc196('0x9')](_0xc196('0xa'),attributes,{'tableName':_0xc196('0xb'),'paranoid':![],'indexes':[{'name':_0xc196('0xc'),'fields':[_0xc196('0xd')],'type':_0xc196('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2873e2,_0x10fd68,_0x22aaf4){var _0x3e5991=_0x36a286[_0xc196('0xf')];var _0xf08151=_0x2873e2[_0xc196('0x10')]({'plain':!![]});if(_0xf08151[_0xc196('0x11')][_0xc196('0x12')]()==='in'||_0xf08151[_0xc196('0x11')]['toLowerCase']()==='out'&&!_0xf08151[_0xc196('0x13')]&&!_[_0xc196('0x14')](_0xf08151[_0xc196('0x15')])){_0x3e5991['OpenchannelInteraction'][_0xc196('0x16')]({'where':{'id':_0xf08151[_0xc196('0x17')]}})[_0xc196('0x18')](function(_0x5b7b8c){if(_0x5b7b8c){_0x5b7b8c['update']({'lastMsgAt':_0xf08151[_0xc196('0x19')],'lastMsgDirection':_0xf08151[_0xc196('0x11')]['toLowerCase']()});}})[_0xc196('0x1a')](function(_0x19a4b1){console[_0xc196('0x1b')](_0x19a4b1);});}if(_0xf08151[_0xc196('0x11')]===_0xc196('0x1c')&&!_0xf08151[_0xc196('0x13')]){var _0xda8907;_0x3e5991[_0xc196('0x1d')][_0xc196('0x1e')]()[_0xc196('0x18')](function(_0x424970){return _0x3e5991[_0xc196('0x1f')]['find']({'where':{'id':_0xf08151['OpenchannelAccountId']},'include':[{'model':_0x3e5991[_0xc196('0x20')],'as':_0xc196('0x21'),'where':{'id':_0xf08151[_0xc196('0x17')]},'limit':0x1,'include':[{'model':_0x3e5991['CmContact'],'as':_0xc196('0x22'),'attributes':_[_0xc196('0x23')](_0x424970)}]}]});})[_0xc196('0x18')](function(_0x2e4ae1){_0xda8907=_0x2e4ae1[_0xc196('0x10')]({'plain':!![]});if(_0xda8907&&_0xda8907[_0xc196('0x24')]){logger[_0xc196('0x25')](_0xc196('0x26'),_0xc196('0x27'),util['format'](_0xc196('0x28'),_0xf08151['id'],_0xda8907['replyUri']));if(_0xda8907[_0xc196('0x21')]&&_0xda8907['Interactions']['length']){_0xf08151[_0xc196('0x29')]=_['omit'](_0xda8907[_0xc196('0x21')][0x0],_0xc196('0x22'));_0xf08151['Contact']=_0xda8907['Interactions'][0x0][_0xc196('0x22')];}var _0x10fd68={'method':_0xc196('0x2a'),'uri':encodeURI(_0xda8907[_0xc196('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x10fd68[_0xc196('0x2b')]){case'GET':_0x10fd68['qs']=_0xf08151;break;case _0xc196('0x2a'):_0x10fd68[_0xc196('0xd')]=_0xf08151;break;}return rp(_0x10fd68)['then'](function(_0x4249e1){logger[_0xc196('0x25')](_0xc196('0x26'),_0xc196('0x27'),util['format'](_0xc196('0x2c'),_0xf08151['id'],_0xda8907[_0xc196('0x24')]));if(_0x4249e1[_0xc196('0xd')][_0xc196('0x2d')]&&_0x4249e1['body'][_0xc196('0x2d')]!=_0xf08151[_0xc196('0x29')][_0xc196('0x2d')]){return _0x3e5991[_0xc196('0x20')]['update']({'threadId':_0x4249e1[_0xc196('0xd')][_0xc196('0x2d')]},{'logging':!![],'where':{'id':_0xf08151[_0xc196('0x29')]['id']}});}else{return;}})[_0xc196('0x18')](function(){return _0x2873e2[_0xc196('0x2e')]({'read':!![]});})[_0xc196('0x1a')](function(_0x4587c9){logger[_0xc196('0x1b')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xc196('0x2f')](_0x4587c9,{'showHidden':![],'depth':null}));_0x22aaf4();});}else{_0x22aaf4();}})[_0xc196('0x30')](function(){_0x22aaf4();});}else{_0x22aaf4();}}},'charset':_0xc196('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index dd0baab..7a54d9e 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 _0x2faf=['./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateOpenchannelMessage','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x537044,_0x4de18f){var _0x5ba75e=function(_0x58cccc){while(--_0x58cccc){_0x537044['push'](_0x537044['shift']());}};_0x5ba75e(++_0x4de18f);}(_0x2faf,0xb0));var _0xf2fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2faf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var moment=require(_0xf2fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2fa('0x3'));var fs=require('fs');var Redis=require(_0xf2fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2fa('0x5'));var logger=require(_0xf2fa('0x6'))(_0xf2fa('0x7'));var config=require(_0xf2fa('0x8'));var jayson=require(_0xf2fa('0x9'));var client=jayson[_0xf2fa('0xa')][_0xf2fa('0xb')]({'port':0x232a});config['redis']=_[_0xf2fa('0xc')](config[_0xf2fa('0xd')],{'host':_0xf2fa('0xe'),'port':0x18eb});var socket=require(_0xf2fa('0xf'))(new Redis(config['redis']));require(_0xf2fa('0x10'))['register'](socket);function respondWithRpcPromise(_0x310ccd,_0x481c20,_0x36bd8d){return new BPromise(function(_0x44f3e2,_0x4640a6){return client[_0xf2fa('0x11')](_0x310ccd,_0x36bd8d)[_0xf2fa('0x12')](function(_0x2c1386){logger[_0xf2fa('0x13')](_0xf2fa('0x14'),_0x481c20,_0xf2fa('0x15'));logger[_0xf2fa('0x16')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x481c20,_0xf2fa('0x15'),JSON[_0xf2fa('0x17')](_0x2c1386));if(_0x2c1386[_0xf2fa('0x18')]){if(_0x2c1386[_0xf2fa('0x18')][_0xf2fa('0x19')]===0x1f4){logger[_0xf2fa('0x18')](_0xf2fa('0x14'),_0x481c20,_0x2c1386[_0xf2fa('0x18')]['message']);return _0x4640a6(_0x2c1386[_0xf2fa('0x18')]['message']);}logger[_0xf2fa('0x18')](_0xf2fa('0x14'),_0x481c20,_0x2c1386['error']['message']);return _0x44f3e2(_0x2c1386[_0xf2fa('0x18')][_0xf2fa('0x1a')]);}else{logger[_0xf2fa('0x13')](_0xf2fa('0x14'),_0x481c20,_0xf2fa('0x15'));_0x44f3e2(_0x2c1386[_0xf2fa('0x1b')]['message']);}})[_0xf2fa('0x1c')](function(_0x4f5baa){logger[_0xf2fa('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x481c20,_0x4f5baa);_0x4640a6(_0x4f5baa);});});}exports[_0xf2fa('0x1d')]=function(_0x1b2b4d){var _0xdc06fd=this;return new Promise(function(_0x4170b1,_0x25f5d3){return db['OpenchannelMessage']['create'](_0x1b2b4d['body'],{'raw':_0x1b2b4d[_0xf2fa('0x1e')]?_0x1b2b4d['options'][_0xf2fa('0x1f')]===undefined?!![]:![]:!![]})[_0xf2fa('0x12')](function(_0x599c7b){logger['info']('CreateOpenchannelMessage',_0x1b2b4d);logger[_0xf2fa('0x16')](_0xf2fa('0x1d'),_0x1b2b4d,JSON[_0xf2fa('0x17')](_0x599c7b));_0x4170b1(_0x599c7b);})[_0xf2fa('0x1c')](function(_0x484e33){logger['error'](_0xf2fa('0x1d'),_0x484e33['message'],_0x1b2b4d);_0x25f5d3(_0xdc06fd['error'](0x1f4,_0x484e33['message']));});});}; \ No newline at end of file +var _0xf562=['code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4834d8,_0x575176){var _0x2607af=function(_0x16d42a){while(--_0x16d42a){_0x4834d8['push'](_0x4834d8['shift']());}};_0x2607af(++_0x575176);}(_0xf562,0x100));var _0x2f56=function(_0x1179ec,_0x37d28c){_0x1179ec=_0x1179ec-0x0;var _0x2459a9=_0xf562[_0x1179ec];return _0x2459a9;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var moment=require(_0x2f56('0x2'));var BPromise=require(_0x2f56('0x3'));var rs=require(_0x2f56('0x4'));var fs=require('fs');var Redis=require(_0x2f56('0x5'));var db=require(_0x2f56('0x6'))['db'];var utils=require(_0x2f56('0x7'));var logger=require(_0x2f56('0x8'))('rpc');var config=require(_0x2f56('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2f56('0xa')]['http']({'port':0x232a});config[_0x2f56('0xb')]=_[_0x2f56('0xc')](config[_0x2f56('0xb')],{'host':_0x2f56('0xd'),'port':0x18eb});var socket=require(_0x2f56('0xe'))(new Redis(config[_0x2f56('0xb')]));require(_0x2f56('0xf'))[_0x2f56('0x10')](socket);function respondWithRpcPromise(_0x926a86,_0x5eeaa7,_0x30a106){return new BPromise(function(_0x39572f,_0x52d3d2){return client[_0x2f56('0x11')](_0x926a86,_0x30a106)[_0x2f56('0x12')](function(_0x575f1e){logger[_0x2f56('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x5eeaa7,_0x2f56('0x14'));logger['debug'](_0x2f56('0x15'),_0x5eeaa7,_0x2f56('0x14'),JSON[_0x2f56('0x16')](_0x575f1e));if(_0x575f1e[_0x2f56('0x17')]){if(_0x575f1e[_0x2f56('0x17')][_0x2f56('0x18')]===0x1f4){logger[_0x2f56('0x17')](_0x2f56('0x19'),_0x5eeaa7,_0x575f1e['error'][_0x2f56('0x1a')]);return _0x52d3d2(_0x575f1e[_0x2f56('0x17')][_0x2f56('0x1a')]);}logger[_0x2f56('0x17')](_0x2f56('0x19'),_0x5eeaa7,_0x575f1e['error'][_0x2f56('0x1a')]);return _0x39572f(_0x575f1e[_0x2f56('0x17')][_0x2f56('0x1a')]);}else{logger[_0x2f56('0x13')](_0x2f56('0x19'),_0x5eeaa7,'request\x20sent');_0x39572f(_0x575f1e[_0x2f56('0x1b')][_0x2f56('0x1a')]);}})[_0x2f56('0x1c')](function(_0x4651d9){logger[_0x2f56('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x5eeaa7,_0x4651d9);_0x52d3d2(_0x4651d9);});});}exports[_0x2f56('0x1d')]=function(_0x19ab8c){var _0x22e2e6=this;return new Promise(function(_0x129943,_0x33dc10){return db[_0x2f56('0x1e')][_0x2f56('0x1f')](_0x19ab8c[_0x2f56('0x20')],{'raw':_0x19ab8c['options']?_0x19ab8c[_0x2f56('0x21')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x297827){logger[_0x2f56('0x13')](_0x2f56('0x1d'),_0x19ab8c);logger[_0x2f56('0x22')](_0x2f56('0x1d'),_0x19ab8c,JSON[_0x2f56('0x16')](_0x297827));_0x129943(_0x297827);})[_0x2f56('0x1c')](function(_0x5c1e69){logger['error'](_0x2f56('0x1d'),_0x5c1e69[_0x2f56('0x1a')],_0x19ab8c);_0x33dc10(_0x22e2e6[_0x2f56('0x17')](0x1f4,_0x5c1e69[_0x2f56('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 99e0e9c..839aa69 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2f3a7b,_0x32914b){_0x2f3a7b=_0x2f3a7b-0x0;var _0x47f7af=_0x9bde[_0x2f3a7b];return _0x47f7af;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 19b9a65..6dbf9de 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 _0xe314=['destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete'];(function(_0x18c3bb,_0x5c97b2){var _0x580df2=function(_0x411dc1){while(--_0x411dc1){_0x18c3bb['push'](_0x18c3bb['shift']());}};_0x580df2(++_0x5c97b2);}(_0xe314,0x7c));var _0x4e31=function(_0x5cfa65,_0x18ea4b){_0x5cfa65=_0x5cfa65-0x0;var _0x3f4987=_0xe314[_0x5cfa65];return _0x3f4987;};'use strict';var multer=require('multer');var util=require(_0x4e31('0x0'));var path=require(_0x4e31('0x1'));var timeout=require(_0x4e31('0x2'));var express=require(_0x4e31('0x3'));var router=express[_0x4e31('0x4')]();var auth=require(_0x4e31('0x5'));var interaction=require(_0x4e31('0x6'));var config=require(_0x4e31('0x7'));var controller=require(_0x4e31('0x8'));router[_0x4e31('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4e31('0x9')](_0x4e31('0xa'),auth[_0x4e31('0xb')](),controller[_0x4e31('0xc')]);router[_0x4e31('0x9')](_0x4e31('0xd'),auth['isAuthenticated'](),controller[_0x4e31('0xe')]);router[_0x4e31('0x9')](_0x4e31('0xf'),auth[_0x4e31('0xb')](),controller['getMembers']);router[_0x4e31('0x9')](_0x4e31('0x10'),auth[_0x4e31('0xb')](),controller[_0x4e31('0x11')]);router[_0x4e31('0x9')](_0x4e31('0x12'),auth[_0x4e31('0xb')](),controller[_0x4e31('0x13')]);router[_0x4e31('0x14')]('/',auth[_0x4e31('0xb')](),controller[_0x4e31('0x15')]);router[_0x4e31('0x14')](_0x4e31('0x10'),auth[_0x4e31('0xb')](),controller[_0x4e31('0x16')]);router[_0x4e31('0x14')](_0x4e31('0x12'),auth[_0x4e31('0xb')](),controller['addAgents']);router[_0x4e31('0x17')](_0x4e31('0xd'),auth['isAuthenticated'](),controller[_0x4e31('0x18')]);router[_0x4e31('0x19')](_0x4e31('0xd'),auth['isAuthenticated'](),controller[_0x4e31('0x1a')]);router[_0x4e31('0x19')](_0x4e31('0x10'),auth['isAuthenticated'](),controller[_0x4e31('0x1b')]);router[_0x4e31('0x19')](_0x4e31('0x12'),auth['isAuthenticated'](),controller[_0x4e31('0x1c')]);module[_0x4e31('0x1d')]=router; \ No newline at end of file +var _0x36bb=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x42a66b,_0x1a345b){var _0x26a063=function(_0x55cd49){while(--_0x55cd49){_0x42a66b['push'](_0x42a66b['shift']());}};_0x26a063(++_0x1a345b);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb36b('0x0'));var util=require(_0xb36b('0x1'));var path=require(_0xb36b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb36b('0x3'));var router=express[_0xb36b('0x4')]();var auth=require(_0xb36b('0x5'));var interaction=require(_0xb36b('0x6'));var config=require(_0xb36b('0x7'));var controller=require(_0xb36b('0x8'));router[_0xb36b('0x9')]('/',auth[_0xb36b('0xa')](),controller[_0xb36b('0xb')]);router[_0xb36b('0x9')](_0xb36b('0xc'),auth[_0xb36b('0xa')](),controller[_0xb36b('0xd')]);router[_0xb36b('0x9')](_0xb36b('0xe'),auth[_0xb36b('0xa')](),controller[_0xb36b('0xf')]);router[_0xb36b('0x9')](_0xb36b('0x10'),auth['isAuthenticated'](),controller[_0xb36b('0x11')]);router[_0xb36b('0x9')](_0xb36b('0x12'),auth['isAuthenticated'](),controller[_0xb36b('0x13')]);router[_0xb36b('0x9')](_0xb36b('0x14'),auth[_0xb36b('0xa')](),controller[_0xb36b('0x15')]);router[_0xb36b('0x16')]('/',auth[_0xb36b('0xa')](),controller[_0xb36b('0x17')]);router[_0xb36b('0x16')](_0xb36b('0x12'),auth[_0xb36b('0xa')](),controller['addTeams']);router[_0xb36b('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xb36b('0x18')]);router[_0xb36b('0x19')](_0xb36b('0xe'),auth[_0xb36b('0xa')](),controller[_0xb36b('0x1a')]);router[_0xb36b('0x1b')]('/:id',auth[_0xb36b('0xa')](),controller[_0xb36b('0x1c')]);router[_0xb36b('0x1b')](_0xb36b('0x12'),auth['isAuthenticated'](),controller[_0xb36b('0x1d')]);router[_0xb36b('0x1b')](_0xb36b('0x14'),auth['isAuthenticated'](),controller[_0xb36b('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 89933d9..dc1208f 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 _0x8aa7=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x1e2c73,_0x12cd55){var _0x46f8d5=function(_0xe5a2fd){while(--_0xe5a2fd){_0x1e2c73['push'](_0x1e2c73['shift']());}};_0x46f8d5(++_0x12cd55);}(_0x8aa7,0x1c4));var _0x78aa=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x8aa7[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x78aa('0x0'));module[_0x78aa('0x1')]={'name':{'type':Sequelize[_0x78aa('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x78aa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78aa('0x4')](_0x78aa('0x5'),_0x78aa('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x8a2a=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x57ea0c,_0x35f3ad){var _0x5c5461=function(_0x4f249c){while(--_0x4f249c){_0x57ea0c['push'](_0x57ea0c['shift']());}};_0x5c5461(++_0x35f3ad);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x8a2a[_0x4226d6];return _0x19655b;};'use strict';var Sequelize=require('sequelize');module[_0xa8a2('0x0')]={'name':{'type':Sequelize[_0xa8a2('0x1')],'unique':_0xa8a2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa8a2('0x1')]},'timeout':{'type':Sequelize[_0xa8a2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa8a2('0x4'),_0xa8a2('0x5'),_0xa8a2('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0b54bcb..5f46dfd 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 _0xb8ed=['SELECT','every','TeamId','includes','compact','value','isEmpty','emit','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','offset','limit','Content-Range','save','update','get','OpenchannelQueues','UserProfileResource','destroy','then','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelQueue','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','getMembers','UserOpenchannelQueue','nolimit','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','User','select','field','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb8ed,0x19e));var _0xdb8e=function(_0x13c728,_0x3219de){_0x13c728=_0x13c728-0x0;var _0x8d5f62=_0xb8ed[_0x13c728];return _0x8d5f62;};'use strict';var pdf=require(_0xdb8e('0x0'));var emlformat=require(_0xdb8e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb8e('0x2'));var rp=require(_0xdb8e('0x3'));var moment=require(_0xdb8e('0x4'));var BPromise=require(_0xdb8e('0x5'));var Mustache=require(_0xdb8e('0x6'));var util=require(_0xdb8e('0x7'));var path=require(_0xdb8e('0x8'));var sox=require(_0xdb8e('0x9'));var csv=require('to-csv');var ejs=require(_0xdb8e('0xa'));var fs=require('fs');var _=require(_0xdb8e('0xb'));var squel=require('squel');var crypto=require(_0xdb8e('0xc'));var jsforce=require(_0xdb8e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdb8e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdb8e('0xf'));var hardwareService=require(_0xdb8e('0x10'));var logger=require(_0xdb8e('0x11'))(_0xdb8e('0x12'));var utils=require(_0xdb8e('0x13'));var config=require(_0xdb8e('0x14'));var db=require(_0xdb8e('0x15'))['db'];config[_0xdb8e('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdb8e('0x17'))(new Redis(config[_0xdb8e('0x16')]));require(_0xdb8e('0x18'))['register'](socket);function respondWithStatusCode(_0x5c5dd6,_0x44f884){_0x44f884=_0x44f884||0xcc;return function(_0x14a5a6){if(_0x14a5a6){return _0x5c5dd6[_0xdb8e('0x19')](_0x44f884);}return _0x5c5dd6['status'](_0x44f884)[_0xdb8e('0x1a')]();};}function respondWithResult(_0x10ab03,_0x3e336c){_0x3e336c=_0x3e336c||0xc8;return function(_0x2f5e67){if(_0x2f5e67){return _0x10ab03[_0xdb8e('0x1b')](_0x3e336c)[_0xdb8e('0x1c')](_0x2f5e67);}};}function respondWithFilteredResult(_0x1d0f0b,_0x3be90a){return function(_0x3f4583){if(_0x3f4583){var _0x29e0dc=_0x3f4583['count'],_0x443186=_0x3be90a[_0xdb8e('0x1d')],_0x6b3b59=_0x3be90a[_0xdb8e('0x1d')]+_0x3be90a[_0xdb8e('0x1e')],_0x275093;if(_0x6b3b59>=_0x29e0dc){_0x6b3b59=_0x29e0dc;_0x275093=0xc8;}else{_0x275093=0xce;}_0x1d0f0b[_0xdb8e('0x1b')](_0x275093);return _0x1d0f0b['set'](_0xdb8e('0x1f'),_0x443186+'-'+_0x6b3b59+'/'+_0x29e0dc)[_0xdb8e('0x1c')](_0x3f4583);}return null;};}function patchUpdates(_0xcc195d){return function(_0xc42ccc){try{jsonpatch['apply'](_0xc42ccc,_0xcc195d,!![]);}catch(_0x4d1b69){return BPromise['reject'](_0x4d1b69);}return _0xc42ccc[_0xdb8e('0x20')]();};}function saveUpdates(_0x4dedec,_0x160162){return function(_0xad041c){if(_0xad041c){return _0xad041c[_0xdb8e('0x21')](_0x4dedec)['then'](function(_0xb6b72){return _0xb6b72;});}return null;};}function removeEntity(_0x301dea,_0x1a2030){return function(_0x233a5b){if(_0x233a5b){return _0x233a5b['destroy']()['then'](function(){var _0x57548c=_0x233a5b[_0xdb8e('0x22')]({'plain':!![]});var _0x19cdb0=_0xdb8e('0x23');return db[_0xdb8e('0x24')][_0xdb8e('0x25')]({'where':{'type':_0x19cdb0,'resourceId':_0x57548c['id']}})[_0xdb8e('0x26')](function(){return _0x233a5b;});})[_0xdb8e('0x26')](function(){_0x301dea[_0xdb8e('0x1b')](0xcc)[_0xdb8e('0x1a')]();});}};}function handleEntityNotFound(_0x377837,_0x22aecf){return function(_0x1faac6){if(!_0x1faac6){_0x377837[_0xdb8e('0x19')](0x194);}return _0x1faac6;};}function handleError(_0x11c77b,_0x12af4e){_0x12af4e=_0x12af4e||0x1f4;return function(_0x17284e){logger[_0xdb8e('0x27')](_0x17284e['stack']);if(_0x17284e[_0xdb8e('0x28')]){delete _0x17284e[_0xdb8e('0x28')];}_0x11c77b['status'](_0x12af4e)[_0xdb8e('0x29')](_0x17284e);};}exports[_0xdb8e('0x2a')]=function(_0x2d6dc4,_0x1348ad){var _0x49bb33={},_0x213d1f={},_0x15c000={'count':0x0,'rows':[]};var _0xe4a046=_['map'](db['OpenchannelQueue'][_0xdb8e('0x2b')],function(_0x3cac2b){return{'name':_0x3cac2b[_0xdb8e('0x2c')],'type':_0x3cac2b[_0xdb8e('0x2d')][_0xdb8e('0x2e')]};});_0x213d1f['model']=_[_0xdb8e('0x2f')](_0xe4a046,_0xdb8e('0x28'));_0x213d1f[_0xdb8e('0x30')]=_[_0xdb8e('0x31')](_0x2d6dc4[_0xdb8e('0x30')]);_0x213d1f[_0xdb8e('0x32')]=_[_0xdb8e('0x33')](_0x213d1f[_0xdb8e('0x34')],_0x213d1f[_0xdb8e('0x30')]);_0x49bb33[_0xdb8e('0x35')]=_[_0xdb8e('0x33')](_0x213d1f[_0xdb8e('0x34')],qs[_0xdb8e('0x36')](_0x2d6dc4['query']['fields']));_0x49bb33['attributes']=_0x49bb33[_0xdb8e('0x35')][_0xdb8e('0x37')]?_0x49bb33[_0xdb8e('0x35')]:_0x213d1f[_0xdb8e('0x34')];if(!_0x2d6dc4['query'][_0xdb8e('0x38')]('nolimit')){_0x49bb33[_0xdb8e('0x1e')]=qs[_0xdb8e('0x1e')](_0x2d6dc4['query'][_0xdb8e('0x1e')]);_0x49bb33[_0xdb8e('0x1d')]=qs[_0xdb8e('0x1d')](_0x2d6dc4[_0xdb8e('0x30')][_0xdb8e('0x1d')]);}_0x49bb33[_0xdb8e('0x39')]=qs[_0xdb8e('0x3a')](_0x2d6dc4[_0xdb8e('0x30')]['sort']);_0x49bb33['where']=qs[_0xdb8e('0x32')](_[_0xdb8e('0x3b')](_0x2d6dc4[_0xdb8e('0x30')],_0x213d1f[_0xdb8e('0x32')]),_0xe4a046);if(_0x2d6dc4[_0xdb8e('0x30')][_0xdb8e('0x3c')]){_0x49bb33[_0xdb8e('0x3d')]=_[_0xdb8e('0x3e')](_0x49bb33['where'],{'$or':_[_0xdb8e('0x2f')](_0xe4a046,function(_0x3553a6){if(_0x3553a6['type']!==_0xdb8e('0x3f')){var _0x192bbd={};_0x192bbd[_0x3553a6[_0xdb8e('0x28')]]={'$like':'%'+_0x2d6dc4['query'][_0xdb8e('0x3c')]+'%'};return _0x192bbd;}})});}_0x49bb33=_[_0xdb8e('0x3e')]({},_0x49bb33,_0x2d6dc4[_0xdb8e('0x40')]);var _0x1696da={'where':_0x49bb33[_0xdb8e('0x3d')]};return db[_0xdb8e('0x41')][_0xdb8e('0x42')](_0x1696da)['then'](function(_0x4dbe95){_0x15c000['count']=_0x4dbe95;if(_0x2d6dc4['query']['includeAll']){_0x49bb33[_0xdb8e('0x43')]=[{'all':!![]}];}return db[_0xdb8e('0x41')][_0xdb8e('0x44')](_0x49bb33);})[_0xdb8e('0x26')](function(_0x444b8d){_0x15c000[_0xdb8e('0x45')]=_0x444b8d;return _0x15c000;})[_0xdb8e('0x26')](respondWithFilteredResult(_0x1348ad,_0x49bb33))[_0xdb8e('0x46')](handleError(_0x1348ad,null));};exports[_0xdb8e('0x47')]=function(_0x59ddab,_0x31c80c){var _0x4c0028={'raw':!![],'where':{'id':_0x59ddab[_0xdb8e('0x48')]['id']}},_0xf7f7cb={};_0xf7f7cb[_0xdb8e('0x34')]=_[_0xdb8e('0x31')](db[_0xdb8e('0x41')]['rawAttributes']);_0xf7f7cb[_0xdb8e('0x30')]=_['keys'](_0x59ddab[_0xdb8e('0x30')]);_0xf7f7cb[_0xdb8e('0x32')]=_[_0xdb8e('0x33')](_0xf7f7cb['model'],_0xf7f7cb[_0xdb8e('0x30')]);_0x4c0028[_0xdb8e('0x35')]=_[_0xdb8e('0x33')](_0xf7f7cb[_0xdb8e('0x34')],qs[_0xdb8e('0x36')](_0x59ddab[_0xdb8e('0x30')][_0xdb8e('0x36')]));_0x4c0028['attributes']=_0x4c0028['attributes'][_0xdb8e('0x37')]?_0x4c0028['attributes']:_0xf7f7cb['model'];if(_0x59ddab[_0xdb8e('0x30')][_0xdb8e('0x49')]){_0x4c0028[_0xdb8e('0x43')]=[{'all':!![]}];}_0x4c0028=_['merge']({},_0x4c0028,_0x59ddab[_0xdb8e('0x40')]);return db['OpenchannelQueue'][_0xdb8e('0x4a')](_0x4c0028)[_0xdb8e('0x26')](handleEntityNotFound(_0x31c80c,null))['then'](respondWithResult(_0x31c80c,null))[_0xdb8e('0x46')](handleError(_0x31c80c,null));};exports[_0xdb8e('0x4b')]=function(_0x45d4ca,_0x465f8b){return db['OpenchannelQueue'][_0xdb8e('0x4b')](_0x45d4ca[_0xdb8e('0x4c')],{})[_0xdb8e('0x26')](function(_0x5beb62){var _0x376ec9=_0x45d4ca[_0xdb8e('0x4d')][_0xdb8e('0x22')]({'plain':!![]});if(!_0x376ec9)throw new Error(_0xdb8e('0x4e'));if(_0x376ec9[_0xdb8e('0x4f')]===_0xdb8e('0x4d')){var _0x4c9f08=_0x5beb62[_0xdb8e('0x22')]({'plain':!![]});var _0x41691f=_0xdb8e('0x23');return db[_0xdb8e('0x50')][_0xdb8e('0x4a')]({'where':{'name':_0x41691f,'userProfileId':_0x376ec9['userProfileId']},'raw':!![]})[_0xdb8e('0x26')](function(_0x1bb2e2){if(_0x1bb2e2&&_0x1bb2e2[_0xdb8e('0x51')]===0x0){return db[_0xdb8e('0x24')][_0xdb8e('0x4b')]({'name':_0x4c9f08[_0xdb8e('0x28')],'resourceId':_0x4c9f08['id'],'type':_0x1bb2e2[_0xdb8e('0x28')],'sectionId':_0x1bb2e2['id']},{})[_0xdb8e('0x26')](function(){return _0x5beb62;});}else{return _0x5beb62;}})[_0xdb8e('0x46')](function(_0x255bd9){logger[_0xdb8e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x255bd9);throw _0x255bd9;});}return _0x5beb62;})[_0xdb8e('0x26')](respondWithResult(_0x465f8b,0xc9))[_0xdb8e('0x46')](handleError(_0x465f8b,null));};exports[_0xdb8e('0x21')]=function(_0x82fa0c,_0x41b6a5){if(_0x82fa0c[_0xdb8e('0x4c')]['id']){delete _0x82fa0c[_0xdb8e('0x4c')]['id'];}return db['OpenchannelQueue'][_0xdb8e('0x4a')]({'where':{'id':_0x82fa0c[_0xdb8e('0x48')]['id']}})[_0xdb8e('0x26')](handleEntityNotFound(_0x41b6a5,null))[_0xdb8e('0x26')](saveUpdates(_0x82fa0c[_0xdb8e('0x4c')],null))[_0xdb8e('0x26')](respondWithResult(_0x41b6a5,null))['catch'](handleError(_0x41b6a5,null));};exports['destroy']=function(_0x96a3d5,_0x16e36d){return db['OpenchannelQueue'][_0xdb8e('0x4a')]({'where':{'id':_0x96a3d5[_0xdb8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x16e36d,null))['then'](removeEntity(_0x16e36d,null))['catch'](handleError(_0x16e36d,null));};exports['describe']=function(_0x35ad0c,_0x512bb9){return db[_0xdb8e('0x41')][_0xdb8e('0x52')]()[_0xdb8e('0x26')](respondWithResult(_0x512bb9,null))['catch'](handleError(_0x512bb9,null));};exports[_0xdb8e('0x53')]=function(_0x36b8fc,_0x258612,_0x49353b){var _0x4972c3={'raw':!![],'where':{}},_0x4030f6={},_0x542a45;return db[_0xdb8e('0x41')]['findOne']({'where':{'id':_0x36b8fc[_0xdb8e('0x48')]['id']}})[_0xdb8e('0x26')](handleEntityNotFound(_0x258612,null))['then'](function(_0x4030c2){if(_0x4030c2){_0x542a45=_0x4030c2['get']({'plain':!![]});_0x4030f6['model']=_[_0xdb8e('0x31')](db[_0xdb8e('0x54')][_0xdb8e('0x2b')]);_0x4030f6[_0xdb8e('0x30')]=_[_0xdb8e('0x31')](_0x36b8fc['query']);_0x4030f6['filters']=_['intersection'](_0x4030f6[_0xdb8e('0x34')],_0x4030f6[_0xdb8e('0x30')]);_0x4972c3[_0xdb8e('0x35')]=_['intersection'](_0x4030f6[_0xdb8e('0x34')],qs[_0xdb8e('0x36')](_0x36b8fc[_0xdb8e('0x30')][_0xdb8e('0x36')]));_0x4972c3[_0xdb8e('0x35')]=_0x4972c3[_0xdb8e('0x35')][_0xdb8e('0x37')]?_0x4972c3[_0xdb8e('0x35')]:_0x4030f6[_0xdb8e('0x34')];if(!_0x36b8fc[_0xdb8e('0x30')]['hasOwnProperty'](_0xdb8e('0x55'))){_0x4972c3[_0xdb8e('0x1e')]=qs['limit'](_0x36b8fc['query'][_0xdb8e('0x1e')]);_0x4972c3[_0xdb8e('0x1d')]=qs[_0xdb8e('0x1d')](_0x36b8fc[_0xdb8e('0x30')][_0xdb8e('0x1d')]);}_0x4972c3[_0xdb8e('0x39')]=qs['sort'](_0x36b8fc[_0xdb8e('0x30')][_0xdb8e('0x3a')]);_0x4972c3['where']=qs[_0xdb8e('0x32')](_['pick'](_0x36b8fc['query'],_0x4030f6['filters']));_0x4972c3['where'][_0xdb8e('0x56')]=_0x4030c2['id'];if(_0x36b8fc['query'][_0xdb8e('0x3c')]){_0x4972c3[_0xdb8e('0x3d')]=_['merge'](_0x4972c3[_0xdb8e('0x3d')],{'$or':_[_0xdb8e('0x2f')](_0x4972c3[_0xdb8e('0x35')],function(_0x259dd2){var _0x4f9166={};_0x4f9166[_0x259dd2]={'$like':'%'+_0x36b8fc[_0xdb8e('0x30')]['filter']+'%'};return _0x4f9166;})});}_0x4972c3=_[_0xdb8e('0x3e')]({},_0x4972c3,_0x36b8fc[_0xdb8e('0x40')]);return db['UserOpenchannelQueue'][_0xdb8e('0x44')](_0x4972c3);}})[_0xdb8e('0x26')](function(_0x2a6d31){if(_0x2a6d31){return db['User'][_0xdb8e('0x57')]({'where':{'id':_[_0xdb8e('0x2f')](_0x2a6d31,_0xdb8e('0x58')),'role':_0xdb8e('0x59')},'attributes':['id',_0xdb8e('0x28'),_0xdb8e('0x5a'),_0xdb8e('0x5b'),_0xdb8e('0x5c')]});}})[_0xdb8e('0x26')](function(_0x517564){if(_0x517564){return{'count':_0x517564[_0xdb8e('0x42')],'rows':_[_0xdb8e('0x2f')](_0x517564[_0xdb8e('0x45')],function(_0x47f372){return{'membername':_0x47f372['name'],'UserId':_0x47f372['id'],'queue_name':_0x542a45[_0xdb8e('0x28')],'OpenchannelQueueId':_0x542a45['id'],'interface':util[_0xdb8e('0x5d')](_0xdb8e('0x5e'),'SIP',_0x47f372[_0xdb8e('0x28')]),'penalty':0x0,'paused':_0x47f372[_0xdb8e('0x5a')],'createdAt':_0x47f372['createdAt'],'updatedAt':_0x47f372['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdb8e('0x26')](respondWithFilteredResult(_0x258612,_0x4972c3))[_0xdb8e('0x46')](handleError(_0x258612,null));};exports['getTeams']=function(_0x80676f,_0x58b8c9,_0x2f668a){var _0x1c5aa8={};var _0xf933d8={};var _0x3df6b1;var _0xfc8226;return db['OpenchannelQueue'][_0xdb8e('0x5f')]({'where':{'id':_0x80676f[_0xdb8e('0x48')]['id']}})[_0xdb8e('0x26')](handleEntityNotFound(_0x58b8c9,null))['then'](function(_0x11bbbc){if(_0x11bbbc){_0x3df6b1=_0x11bbbc;_0xf933d8[_0xdb8e('0x34')]=_[_0xdb8e('0x31')](db['Team'][_0xdb8e('0x2b')]);_0xf933d8[_0xdb8e('0x30')]=_[_0xdb8e('0x31')](_0x80676f[_0xdb8e('0x30')]);_0xf933d8['filters']=_['intersection'](_0xf933d8['model'],_0xf933d8[_0xdb8e('0x30')]);_0x1c5aa8[_0xdb8e('0x35')]=_[_0xdb8e('0x33')](_0xf933d8[_0xdb8e('0x34')],qs[_0xdb8e('0x36')](_0x80676f[_0xdb8e('0x30')]['fields']));_0x1c5aa8[_0xdb8e('0x35')]=_0x1c5aa8[_0xdb8e('0x35')][_0xdb8e('0x37')]?_0x1c5aa8[_0xdb8e('0x35')]:_0xf933d8[_0xdb8e('0x34')];_0x1c5aa8[_0xdb8e('0x39')]=qs['sort'](_0x80676f[_0xdb8e('0x30')][_0xdb8e('0x3a')]);_0x1c5aa8[_0xdb8e('0x3d')]=qs['filters'](_[_0xdb8e('0x3b')](_0x80676f[_0xdb8e('0x30')],_0xf933d8[_0xdb8e('0x32')]));if(_0x80676f[_0xdb8e('0x30')][_0xdb8e('0x3c')]){_0x1c5aa8['where']=_[_0xdb8e('0x3e')](_0x1c5aa8[_0xdb8e('0x3d')],{'$or':_[_0xdb8e('0x2f')](_0x1c5aa8[_0xdb8e('0x35')],function(_0x28ddd1){var _0x5924b5={};_0x5924b5[_0x28ddd1]={'$like':'%'+_0x80676f[_0xdb8e('0x30')][_0xdb8e('0x3c')]+'%'};return _0x5924b5;})});}_0x1c5aa8=_[_0xdb8e('0x3e')]({},_0x1c5aa8,_0x80676f['options']);return _0x3df6b1['getTeams'](_0x1c5aa8);}})['then'](function(_0x308589){if(_0x308589){_0xfc8226=_0x308589[_0xdb8e('0x37')];if(!_0x80676f['query'][_0xdb8e('0x38')](_0xdb8e('0x55'))){_0x1c5aa8[_0xdb8e('0x1e')]=qs[_0xdb8e('0x1e')](_0x80676f[_0xdb8e('0x30')][_0xdb8e('0x1e')]);_0x1c5aa8[_0xdb8e('0x1d')]=qs['offset'](_0x80676f[_0xdb8e('0x30')][_0xdb8e('0x1d')]);}return _0x3df6b1['getTeams'](_0x1c5aa8);}})[_0xdb8e('0x26')](function(_0x370c17){if(_0x370c17){return _0x370c17?{'count':_0xfc8226,'rows':_0x370c17}:null;}})[_0xdb8e('0x26')](respondWithResult(_0x58b8c9,null))[_0xdb8e('0x46')](handleError(_0x58b8c9,null));};exports[_0xdb8e('0x60')]=function(_0x50a56f,_0x5d4467,_0x48cf34){var _0x35872e=_0x50a56f[_0xdb8e('0x4c')][_0xdb8e('0x61')];return db[_0xdb8e('0x62')][_0xdb8e('0x44')]({'where':{'id':_0x35872e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdb8e('0x63'),'attributes':['id',_0xdb8e('0x28'),_0xdb8e('0x64'),_0xdb8e('0x65'),_0xdb8e('0x66')],'raw':!![]}]})[_0xdb8e('0x26')](function(_0x2b741f){if(_0x2b741f){var _0x3301ae=_['flatMap'](_0x2b741f,function(_0x379c6a){var _0x5dfcad=_0x379c6a[_0xdb8e('0x22')]({'plain':!![]});return _0x5dfcad['Agents'];});return db[_0xdb8e('0x41')][_0xdb8e('0x4a')]({'where':{'id':_0x50a56f['params']['id']}})[_0xdb8e('0x26')](function(_0x1483e5){return db[_0xdb8e('0x67')]['transaction'](function(_0x53ae22){return _0x1483e5[_0xdb8e('0x60')](_0x35872e,{'transaction':_0x53ae22})[_0xdb8e('0x26')](function(){return BPromise[_0xdb8e('0x68')](_0x3301ae,function(_0x211f46){return db['UserOpenchannelQueue'][_0xdb8e('0x69')]({'where':{'UserId':_0x211f46['id'],'OpenchannelQueueId':_0x50a56f[_0xdb8e('0x48')]['id']},'transaction':_0x53ae22});});})['then'](function(){_0x3301ae[_0xdb8e('0x6a')](function(_0x3854f1){socket['emit'](_0xdb8e('0x6b'),{'UserId':_0x3854f1['id'],'OpenchannelQueueId':_0x1483e5['id']});});});});});}})[_0xdb8e('0x26')](respondWithStatusCode(_0x5d4467,null))['catch'](handleError(_0x5d4467,null));};exports[_0xdb8e('0x6c')]=function(_0x276474,_0x206e72,_0x4effc3){return db['Team']['findAll']({'where':{'id':_0x276474['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xdb8e('0x6d')],'as':_0xdb8e('0x63'),'attributes':['id'],'raw':!![]}]})[_0xdb8e('0x26')](handleEntityNotFound(_0x206e72,null))[_0xdb8e('0x26')](function(_0x3d0240){var _0x2f0bb1=_[_0xdb8e('0x2f')](_0x3d0240,'id');var _0x5b5955=[];var _0x5e21d8=[];var _0x55423f=squel[_0xdb8e('0x6e')]();_0x55423f[_0xdb8e('0x6f')]('tq.TeamId')['from'](_0xdb8e('0x70'),'tq')['join'](_0xdb8e('0x71'),'ut',_0xdb8e('0x72'))[_0xdb8e('0x3d')]('OpenchannelQueueId\x20=\x20?',_0x276474[_0xdb8e('0x48')]['id']);for(var _0x261bf8=0x0;_0x261bf8<_0x3d0240['length'];_0x261bf8+=0x1){let _0x401801=_0x3d0240[_0x261bf8];for(var _0x12c688=0x0;_0x12c688<_0x401801[_0xdb8e('0x63')]['length'];_0x12c688+=0x1){let _0x2f3d75=_0x401801[_0xdb8e('0x63')][_0x12c688];var _0xc1b292=_0x55423f[_0xdb8e('0x73')]();_0xc1b292[_0xdb8e('0x3d')]('ut.UserId\x20=\x20?',_0x2f3d75['id']);_0x5e21d8[_0xdb8e('0x74')](db[_0xdb8e('0x67')][_0xdb8e('0x30')](_0xc1b292[_0xdb8e('0x75')](),{'type':db[_0xdb8e('0x67')]['QueryTypes'][_0xdb8e('0x76')]})[_0xdb8e('0x26')](function(_0x42de80){if(_0x42de80['length']===0x1){return _0x2f3d75['id'];}else{var _0x2fdd72=_[_0xdb8e('0x77')](_[_0xdb8e('0x2f')](_0x42de80,_0xdb8e('0x78')),function(_0x55c03f){return _[_0xdb8e('0x79')](_0x2f0bb1,_0x55c03f);});if(_0x2fdd72){return _0x2f3d75['id'];}}}));}}return BPromise['all'](_0x5e21d8)['then'](function(_0x19dae2){_0x5b5955=_(_0x5b5955)['union'](_0x19dae2)[_0xdb8e('0x7a')]()[_0xdb8e('0x7b')]();return db[_0xdb8e('0x41')][_0xdb8e('0x4a')]({'where':{'id':_0x276474[_0xdb8e('0x48')]['id']}})['then'](function(_0x455a73){return db[_0xdb8e('0x67')]['transaction'](function(_0x550b1e){return _0x455a73[_0xdb8e('0x6c')](_0x276474[_0xdb8e('0x30')][_0xdb8e('0x61')],{'transaction':_0x550b1e})['then'](function(){if(!_[_0xdb8e('0x7c')](_0x5b5955)){return _0x455a73['removeAgents'](_0x5b5955,{'transaction':_0x550b1e});}})[_0xdb8e('0x26')](function(){_0x5b5955[_0xdb8e('0x6a')](function(_0x3531c7){socket[_0xdb8e('0x7d')](_0xdb8e('0x7e'),{'UserId':_0x3531c7,'OpenchannelQueueId':_0x455a73['id']});});});});});});})['then'](respondWithStatusCode(_0x206e72,null))[_0xdb8e('0x46')](handleError(_0x206e72,null));};exports['addAgents']=function(_0x3bb49e,_0x35dd7e,_0x272170){return db[_0xdb8e('0x41')][_0xdb8e('0x4a')]({'where':{'id':_0x3bb49e[_0xdb8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x35dd7e,null))['then'](function(_0x4f2581){if(_0x4f2581){return _0x4f2581[_0xdb8e('0x7f')](_0x3bb49e[_0xdb8e('0x4c')]['ids'],_[_0xdb8e('0x80')](_0x3bb49e[_0xdb8e('0x4c')],[_0xdb8e('0x61'),'id'])||{})[_0xdb8e('0x81')](function(_0x508211){for(var _0x32f69f=0x0;_0x32f69f<_0x3bb49e['body'][_0xdb8e('0x61')]['length'];_0x32f69f+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x3bb49e[_0xdb8e('0x4c')][_0xdb8e('0x61')][_0x32f69f],'OpenchannelQueueId':_0x3bb49e[_0xdb8e('0x48')]['id']});}return _0x508211;});}})[_0xdb8e('0x26')](respondWithResult(_0x35dd7e,null))[_0xdb8e('0x46')](handleError(_0x35dd7e,null));};exports['removeAgents']=function(_0x160314,_0x1d5de3,_0x3dba33){return db[_0xdb8e('0x41')][_0xdb8e('0x4a')]({'where':{'id':_0x160314[_0xdb8e('0x48')]['id']}})[_0xdb8e('0x26')](handleEntityNotFound(_0x1d5de3,null))['then'](function(_0x394a73){if(_0x394a73){return _0x394a73[_0xdb8e('0x82')](_0x160314[_0xdb8e('0x30')][_0xdb8e('0x61')])[_0xdb8e('0x26')](function(){if(_[_0xdb8e('0x83')](_0x160314[_0xdb8e('0x30')][_0xdb8e('0x61')])){for(var _0x51e70e=0x0;_0x51e70e<_0x160314[_0xdb8e('0x30')]['ids'][_0xdb8e('0x37')];_0x51e70e+=0x1){socket['emit'](_0xdb8e('0x7e'),{'UserId':Number(_0x160314['query'][_0xdb8e('0x61')][_0x51e70e]),'OpenchannelQueueId':Number(_0x160314[_0xdb8e('0x48')]['id'])});}}else{socket[_0xdb8e('0x7d')](_0xdb8e('0x7e'),{'UserId':Number(_0x160314[_0xdb8e('0x30')]['ids']),'OpenchannelQueueId':Number(_0x160314[_0xdb8e('0x48')]['id'])});}});}})[_0xdb8e('0x26')](respondWithStatusCode(_0x1d5de3,null))[_0xdb8e('0x46')](handleError(_0x1d5de3,null));};exports['getAgents']=function(_0x537d98,_0x5f35b1,_0x19fb08){var _0x1c7e05={};var _0x3f2a33={};var _0x4089b5;var _0x1fb9a6;return db[_0xdb8e('0x41')][_0xdb8e('0x5f')]({'where':{'id':_0x537d98[_0xdb8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f35b1,null))['then'](function(_0x8fabe9){if(_0x8fabe9){_0x4089b5=_0x8fabe9;_0x3f2a33['model']=_[_0xdb8e('0x31')](db[_0xdb8e('0x6d')][_0xdb8e('0x2b')]);_0x3f2a33[_0xdb8e('0x30')]=_[_0xdb8e('0x31')](_0x537d98[_0xdb8e('0x30')]);_0x3f2a33[_0xdb8e('0x32')]=_['intersection'](_0x3f2a33['model'],_0x3f2a33['query']);_0x1c7e05[_0xdb8e('0x35')]=_['intersection'](_0x3f2a33['model'],qs[_0xdb8e('0x36')](_0x537d98[_0xdb8e('0x30')]['fields']));_0x1c7e05[_0xdb8e('0x35')]=_0x1c7e05[_0xdb8e('0x35')]['length']?_0x1c7e05[_0xdb8e('0x35')]:_0x3f2a33[_0xdb8e('0x34')];_0x1c7e05[_0xdb8e('0x39')]=qs[_0xdb8e('0x3a')](_0x537d98[_0xdb8e('0x30')][_0xdb8e('0x3a')]);_0x1c7e05[_0xdb8e('0x3d')]=qs[_0xdb8e('0x32')](_[_0xdb8e('0x3b')](_0x537d98[_0xdb8e('0x30')],_0x3f2a33[_0xdb8e('0x32')]));if(_0x537d98[_0xdb8e('0x30')][_0xdb8e('0x3c')]){_0x1c7e05[_0xdb8e('0x3d')]=_[_0xdb8e('0x3e')](_0x1c7e05[_0xdb8e('0x3d')],{'$or':_[_0xdb8e('0x2f')](_0x1c7e05[_0xdb8e('0x35')],function(_0x52551c){var _0x25f67e={};_0x25f67e[_0x52551c]={'$like':'%'+_0x537d98[_0xdb8e('0x30')][_0xdb8e('0x3c')]+'%'};return _0x25f67e;})});}_0x1c7e05=_[_0xdb8e('0x3e')]({},_0x1c7e05,_0x537d98[_0xdb8e('0x40')]);return _0x4089b5[_0xdb8e('0x84')](_0x1c7e05);}})['then'](function(_0x1db766){if(_0x1db766){_0x1fb9a6=_0x1db766[_0xdb8e('0x37')];if(!_0x537d98[_0xdb8e('0x30')][_0xdb8e('0x38')](_0xdb8e('0x55'))){_0x1c7e05[_0xdb8e('0x1e')]=qs[_0xdb8e('0x1e')](_0x537d98[_0xdb8e('0x30')][_0xdb8e('0x1e')]);_0x1c7e05[_0xdb8e('0x1d')]=qs[_0xdb8e('0x1d')](_0x537d98[_0xdb8e('0x30')]['offset']);}return _0x4089b5[_0xdb8e('0x84')](_0x1c7e05);}})['then'](function(_0x15f7c7){if(_0x15f7c7){return _0x15f7c7?{'count':_0x1fb9a6,'rows':_0x15f7c7}:null;}})[_0xdb8e('0x26')](respondWithResult(_0x5f35b1,null))[_0xdb8e('0x46')](handleError(_0x5f35b1,null));}; \ No newline at end of file +var _0x3d23=['save','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','attributes','intersection','fields','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','OpenchannelQueue','includeAll','include','rows','catch','show','params','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','OpenchannelQueueId','findAll','User','findAndCountAll','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','removeTeams','Agents','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','set','apply','reject'];(function(_0x3d91b8,_0x4e8999){var _0xfa3d32=function(_0x4a577a){while(--_0x4a577a){_0x3d91b8['push'](_0x3d91b8['shift']());}};_0xfa3d32(++_0x4e8999);}(_0x3d23,0x64));var _0x33d2=function(_0x3b1d1e,_0x10d8d9){_0x3b1d1e=_0x3b1d1e-0x0;var _0x5670b7=_0x3d23[_0x3b1d1e];return _0x5670b7;};'use strict';var pdf=require(_0x33d2('0x0'));var emlformat=require(_0x33d2('0x1'));var rimraf=require(_0x33d2('0x2'));var zipdir=require(_0x33d2('0x3'));var jsonpatch=require(_0x33d2('0x4'));var rp=require(_0x33d2('0x5'));var moment=require(_0x33d2('0x6'));var BPromise=require(_0x33d2('0x7'));var Mustache=require(_0x33d2('0x8'));var util=require(_0x33d2('0x9'));var path=require(_0x33d2('0xa'));var sox=require(_0x33d2('0xb'));var csv=require(_0x33d2('0xc'));var ejs=require(_0x33d2('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33d2('0xe'));var crypto=require(_0x33d2('0xf'));var jsforce=require(_0x33d2('0x10'));var deskjs=require(_0x33d2('0x11'));var toCsv=require(_0x33d2('0xc'));var querystring=require(_0x33d2('0x12'));var Papa=require('papaparse');var Redis=require(_0x33d2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x33d2('0x14'));var as=require(_0x33d2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x33d2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x33d2('0x17')]=_[_0x33d2('0x18')](config['redis'],{'host':_0x33d2('0x19'),'port':0x18eb});var socket=require(_0x33d2('0x1a'))(new Redis(config[_0x33d2('0x17')]));require(_0x33d2('0x1b'))['register'](socket);function respondWithStatusCode(_0x225897,_0x1f6970){_0x1f6970=_0x1f6970||0xcc;return function(_0x3595e1){if(_0x3595e1){return _0x225897[_0x33d2('0x1c')](_0x1f6970);}return _0x225897[_0x33d2('0x1d')](_0x1f6970)[_0x33d2('0x1e')]();};}function respondWithResult(_0x521c25,_0x4be715){_0x4be715=_0x4be715||0xc8;return function(_0x5cc09d){if(_0x5cc09d){return _0x521c25['status'](_0x4be715)[_0x33d2('0x1f')](_0x5cc09d);}};}function respondWithFilteredResult(_0x3cc60c,_0x6d631d){return function(_0x4a6924){if(_0x4a6924){var _0x935e6e=_0x4a6924[_0x33d2('0x20')],_0x41900c=_0x6d631d[_0x33d2('0x21')],_0x1ee6b7=_0x6d631d['offset']+_0x6d631d['limit'],_0x12cf6e;if(_0x1ee6b7>=_0x935e6e){_0x1ee6b7=_0x935e6e;_0x12cf6e=0xc8;}else{_0x12cf6e=0xce;}_0x3cc60c[_0x33d2('0x1d')](_0x12cf6e);return _0x3cc60c[_0x33d2('0x22')]('Content-Range',_0x41900c+'-'+_0x1ee6b7+'/'+_0x935e6e)[_0x33d2('0x1f')](_0x4a6924);}return null;};}function patchUpdates(_0x22bcb3){return function(_0x20e038){try{jsonpatch[_0x33d2('0x23')](_0x20e038,_0x22bcb3,!![]);}catch(_0x39aa45){return BPromise[_0x33d2('0x24')](_0x39aa45);}return _0x20e038[_0x33d2('0x25')]();};}function saveUpdates(_0x34a930,_0x22fc22){return function(_0x5071a0){if(_0x5071a0){return _0x5071a0['update'](_0x34a930)[_0x33d2('0x26')](function(_0x37ba08){return _0x37ba08;});}return null;};}function removeEntity(_0x458d89,_0x222317){return function(_0x3de057){if(_0x3de057){return _0x3de057[_0x33d2('0x27')]()[_0x33d2('0x26')](function(){var _0x24b21b=_0x3de057[_0x33d2('0x28')]({'plain':!![]});var _0x54bacb=_0x33d2('0x29');return db[_0x33d2('0x2a')]['destroy']({'where':{'type':_0x54bacb,'resourceId':_0x24b21b['id']}})[_0x33d2('0x26')](function(){return _0x3de057;});})['then'](function(){_0x458d89['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2d8f,_0x1f9759){return function(_0xe7ab5a){if(!_0xe7ab5a){_0x4b2d8f[_0x33d2('0x1c')](0x194);}return _0xe7ab5a;};}function handleError(_0x301c08,_0x59a05a){_0x59a05a=_0x59a05a||0x1f4;return function(_0x5b8b9a){logger['error'](_0x5b8b9a[_0x33d2('0x2b')]);if(_0x5b8b9a['name']){delete _0x5b8b9a[_0x33d2('0x2c')];}_0x301c08[_0x33d2('0x1d')](_0x59a05a)[_0x33d2('0x2d')](_0x5b8b9a);};}exports[_0x33d2('0x2e')]=function(_0x4e3795,_0x28f2ce){var _0x26dc12={},_0x1f62f3={},_0x3f0877={'count':0x0,'rows':[]};var _0x55203c=_['map'](db['OpenchannelQueue'][_0x33d2('0x2f')],function(_0xb0605f){return{'name':_0xb0605f[_0x33d2('0x30')],'type':_0xb0605f[_0x33d2('0x31')]['key']};});_0x1f62f3[_0x33d2('0x32')]=_[_0x33d2('0x33')](_0x55203c,_0x33d2('0x2c'));_0x1f62f3[_0x33d2('0x34')]=_['keys'](_0x4e3795['query']);_0x1f62f3['filters']=_['intersection'](_0x1f62f3[_0x33d2('0x32')],_0x1f62f3[_0x33d2('0x34')]);_0x26dc12[_0x33d2('0x35')]=_[_0x33d2('0x36')](_0x1f62f3[_0x33d2('0x32')],qs[_0x33d2('0x37')](_0x4e3795[_0x33d2('0x34')][_0x33d2('0x37')]));_0x26dc12[_0x33d2('0x35')]=_0x26dc12['attributes']['length']?_0x26dc12[_0x33d2('0x35')]:_0x1f62f3[_0x33d2('0x32')];if(!_0x4e3795[_0x33d2('0x34')]['hasOwnProperty']('nolimit')){_0x26dc12[_0x33d2('0x38')]=qs[_0x33d2('0x38')](_0x4e3795[_0x33d2('0x34')][_0x33d2('0x38')]);_0x26dc12['offset']=qs['offset'](_0x4e3795[_0x33d2('0x34')][_0x33d2('0x21')]);}_0x26dc12[_0x33d2('0x39')]=qs[_0x33d2('0x3a')](_0x4e3795['query'][_0x33d2('0x3a')]);_0x26dc12[_0x33d2('0x3b')]=qs[_0x33d2('0x3c')](_[_0x33d2('0x3d')](_0x4e3795[_0x33d2('0x34')],_0x1f62f3[_0x33d2('0x3c')]),_0x55203c);if(_0x4e3795[_0x33d2('0x34')][_0x33d2('0x3e')]){_0x26dc12['where']=_[_0x33d2('0x3f')](_0x26dc12[_0x33d2('0x3b')],{'$or':_[_0x33d2('0x33')](_0x55203c,function(_0x3ea7b9){if(_0x3ea7b9[_0x33d2('0x31')]!==_0x33d2('0x40')){var _0x49e8ba={};_0x49e8ba[_0x3ea7b9[_0x33d2('0x2c')]]={'$like':'%'+_0x4e3795['query'][_0x33d2('0x3e')]+'%'};return _0x49e8ba;}})});}_0x26dc12=_[_0x33d2('0x3f')]({},_0x26dc12,_0x4e3795['options']);var _0x3b077c={'where':_0x26dc12[_0x33d2('0x3b')]};return db[_0x33d2('0x41')][_0x33d2('0x20')](_0x3b077c)[_0x33d2('0x26')](function(_0x5ce80d){_0x3f0877['count']=_0x5ce80d;if(_0x4e3795[_0x33d2('0x34')][_0x33d2('0x42')]){_0x26dc12[_0x33d2('0x43')]=[{'all':!![]}];}return db[_0x33d2('0x41')]['findAll'](_0x26dc12);})[_0x33d2('0x26')](function(_0x30653a){_0x3f0877[_0x33d2('0x44')]=_0x30653a;return _0x3f0877;})['then'](respondWithFilteredResult(_0x28f2ce,_0x26dc12))[_0x33d2('0x45')](handleError(_0x28f2ce,null));};exports[_0x33d2('0x46')]=function(_0x237068,_0x57f0a3){var _0xd823fe={'raw':!![],'where':{'id':_0x237068[_0x33d2('0x47')]['id']}},_0x2e8a7d={};_0x2e8a7d['model']=_['keys'](db['OpenchannelQueue'][_0x33d2('0x2f')]);_0x2e8a7d['query']=_[_0x33d2('0x48')](_0x237068[_0x33d2('0x34')]);_0x2e8a7d['filters']=_['intersection'](_0x2e8a7d[_0x33d2('0x32')],_0x2e8a7d[_0x33d2('0x34')]);_0xd823fe[_0x33d2('0x35')]=_['intersection'](_0x2e8a7d[_0x33d2('0x32')],qs[_0x33d2('0x37')](_0x237068[_0x33d2('0x34')][_0x33d2('0x37')]));_0xd823fe[_0x33d2('0x35')]=_0xd823fe[_0x33d2('0x35')][_0x33d2('0x49')]?_0xd823fe['attributes']:_0x2e8a7d[_0x33d2('0x32')];if(_0x237068[_0x33d2('0x34')][_0x33d2('0x42')]){_0xd823fe[_0x33d2('0x43')]=[{'all':!![]}];}_0xd823fe=_[_0x33d2('0x3f')]({},_0xd823fe,_0x237068[_0x33d2('0x4a')]);return db[_0x33d2('0x41')]['find'](_0xd823fe)[_0x33d2('0x26')](handleEntityNotFound(_0x57f0a3,null))[_0x33d2('0x26')](respondWithResult(_0x57f0a3,null))[_0x33d2('0x45')](handleError(_0x57f0a3,null));};exports[_0x33d2('0x4b')]=function(_0x438a91,_0x1e61e1){return db[_0x33d2('0x41')][_0x33d2('0x4b')](_0x438a91[_0x33d2('0x4c')],{})[_0x33d2('0x26')](function(_0x242af5){var _0x3e791d=_0x438a91[_0x33d2('0x4d')][_0x33d2('0x28')]({'plain':!![]});if(!_0x3e791d)throw new Error(_0x33d2('0x4e'));if(_0x3e791d['role']===_0x33d2('0x4d')){var _0x1f8ecd=_0x242af5[_0x33d2('0x28')]({'plain':!![]});var _0x56842c=_0x33d2('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x56842c,'userProfileId':_0x3e791d[_0x33d2('0x4f')]},'raw':!![]})['then'](function(_0x4640bd){if(_0x4640bd&&_0x4640bd[_0x33d2('0x50')]===0x0){return db[_0x33d2('0x2a')]['create']({'name':_0x1f8ecd[_0x33d2('0x2c')],'resourceId':_0x1f8ecd['id'],'type':_0x4640bd['name'],'sectionId':_0x4640bd['id']},{})[_0x33d2('0x26')](function(){return _0x242af5;});}else{return _0x242af5;}})[_0x33d2('0x45')](function(_0x800045){logger[_0x33d2('0x51')](_0x33d2('0x52'),_0x800045);throw _0x800045;});}return _0x242af5;})['then'](respondWithResult(_0x1e61e1,0xc9))['catch'](handleError(_0x1e61e1,null));};exports[_0x33d2('0x53')]=function(_0x5346f7,_0x5a9666){if(_0x5346f7[_0x33d2('0x4c')]['id']){delete _0x5346f7[_0x33d2('0x4c')]['id'];}return db[_0x33d2('0x41')][_0x33d2('0x54')]({'where':{'id':_0x5346f7[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x5a9666,null))['then'](saveUpdates(_0x5346f7['body'],null))[_0x33d2('0x26')](respondWithResult(_0x5a9666,null))[_0x33d2('0x45')](handleError(_0x5a9666,null));};exports['destroy']=function(_0x460479,_0x540b82){return db[_0x33d2('0x41')][_0x33d2('0x54')]({'where':{'id':_0x460479[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x540b82,null))[_0x33d2('0x26')](removeEntity(_0x540b82,null))[_0x33d2('0x45')](handleError(_0x540b82,null));};exports[_0x33d2('0x55')]=function(_0x1fa9ad,_0x5981e9){return db['OpenchannelQueue'][_0x33d2('0x55')]()['then'](respondWithResult(_0x5981e9,null))[_0x33d2('0x45')](handleError(_0x5981e9,null));};exports[_0x33d2('0x56')]=function(_0xc6885a,_0x4ac611,_0x369406){var _0x5d3355={'raw':!![],'where':{}},_0x2c69cf={},_0x46d78f;return db[_0x33d2('0x41')][_0x33d2('0x57')]({'where':{'id':_0xc6885a[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x4ac611,null))[_0x33d2('0x26')](function(_0xceae36){if(_0xceae36){_0x46d78f=_0xceae36[_0x33d2('0x28')]({'plain':!![]});_0x2c69cf[_0x33d2('0x32')]=_[_0x33d2('0x48')](db[_0x33d2('0x58')][_0x33d2('0x2f')]);_0x2c69cf[_0x33d2('0x34')]=_['keys'](_0xc6885a[_0x33d2('0x34')]);_0x2c69cf[_0x33d2('0x3c')]=_[_0x33d2('0x36')](_0x2c69cf[_0x33d2('0x32')],_0x2c69cf[_0x33d2('0x34')]);_0x5d3355[_0x33d2('0x35')]=_[_0x33d2('0x36')](_0x2c69cf[_0x33d2('0x32')],qs[_0x33d2('0x37')](_0xc6885a[_0x33d2('0x34')]['fields']));_0x5d3355[_0x33d2('0x35')]=_0x5d3355['attributes'][_0x33d2('0x49')]?_0x5d3355[_0x33d2('0x35')]:_0x2c69cf[_0x33d2('0x32')];if(!_0xc6885a[_0x33d2('0x34')][_0x33d2('0x59')](_0x33d2('0x5a'))){_0x5d3355[_0x33d2('0x38')]=qs[_0x33d2('0x38')](_0xc6885a['query']['limit']);_0x5d3355[_0x33d2('0x21')]=qs['offset'](_0xc6885a[_0x33d2('0x34')][_0x33d2('0x21')]);}_0x5d3355['order']=qs[_0x33d2('0x3a')](_0xc6885a[_0x33d2('0x34')]['sort']);_0x5d3355[_0x33d2('0x3b')]=qs['filters'](_['pick'](_0xc6885a[_0x33d2('0x34')],_0x2c69cf['filters']));_0x5d3355[_0x33d2('0x3b')][_0x33d2('0x5b')]=_0xceae36['id'];if(_0xc6885a[_0x33d2('0x34')][_0x33d2('0x3e')]){_0x5d3355[_0x33d2('0x3b')]=_[_0x33d2('0x3f')](_0x5d3355['where'],{'$or':_[_0x33d2('0x33')](_0x5d3355[_0x33d2('0x35')],function(_0x1af2cd){var _0xdb8c85={};_0xdb8c85[_0x1af2cd]={'$like':'%'+_0xc6885a[_0x33d2('0x34')][_0x33d2('0x3e')]+'%'};return _0xdb8c85;})});}_0x5d3355=_[_0x33d2('0x3f')]({},_0x5d3355,_0xc6885a['options']);return db[_0x33d2('0x58')][_0x33d2('0x5c')](_0x5d3355);}})['then'](function(_0x5c2894){if(_0x5c2894){return db[_0x33d2('0x5d')][_0x33d2('0x5e')]({'where':{'id':_[_0x33d2('0x33')](_0x5c2894,'UserId'),'role':'agent'},'attributes':['id',_0x33d2('0x2c'),_0x33d2('0x5f'),_0x33d2('0x60'),_0x33d2('0x61')]});}})['then'](function(_0x5a6229){if(_0x5a6229){return{'count':_0x5a6229[_0x33d2('0x20')],'rows':_['map'](_0x5a6229[_0x33d2('0x44')],function(_0x3b5578){return{'membername':_0x3b5578[_0x33d2('0x2c')],'UserId':_0x3b5578['id'],'queue_name':_0x46d78f[_0x33d2('0x2c')],'OpenchannelQueueId':_0x46d78f['id'],'interface':util['format'](_0x33d2('0x62'),_0x33d2('0x63'),_0x3b5578[_0x33d2('0x2c')]),'penalty':0x0,'paused':_0x3b5578[_0x33d2('0x5f')],'createdAt':_0x3b5578[_0x33d2('0x61')],'updatedAt':_0x3b5578[_0x33d2('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x33d2('0x26')](respondWithFilteredResult(_0x4ac611,_0x5d3355))[_0x33d2('0x45')](handleError(_0x4ac611,null));};exports[_0x33d2('0x64')]=function(_0x2a74ce,_0x4efcb1,_0x2fb3b8){var _0x2a8d7e={};var _0x114ab5={};var _0x1fc78c;var _0x4bd654;return db['OpenchannelQueue'][_0x33d2('0x57')]({'where':{'id':_0x2a74ce[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x4efcb1,null))[_0x33d2('0x26')](function(_0x41af6d){if(_0x41af6d){_0x1fc78c=_0x41af6d;_0x114ab5[_0x33d2('0x32')]=_[_0x33d2('0x48')](db['Team'][_0x33d2('0x2f')]);_0x114ab5[_0x33d2('0x34')]=_[_0x33d2('0x48')](_0x2a74ce[_0x33d2('0x34')]);_0x114ab5[_0x33d2('0x3c')]=_[_0x33d2('0x36')](_0x114ab5[_0x33d2('0x32')],_0x114ab5[_0x33d2('0x34')]);_0x2a8d7e[_0x33d2('0x35')]=_[_0x33d2('0x36')](_0x114ab5[_0x33d2('0x32')],qs[_0x33d2('0x37')](_0x2a74ce[_0x33d2('0x34')][_0x33d2('0x37')]));_0x2a8d7e[_0x33d2('0x35')]=_0x2a8d7e[_0x33d2('0x35')][_0x33d2('0x49')]?_0x2a8d7e[_0x33d2('0x35')]:_0x114ab5[_0x33d2('0x32')];_0x2a8d7e['order']=qs[_0x33d2('0x3a')](_0x2a74ce['query'][_0x33d2('0x3a')]);_0x2a8d7e[_0x33d2('0x3b')]=qs[_0x33d2('0x3c')](_[_0x33d2('0x3d')](_0x2a74ce[_0x33d2('0x34')],_0x114ab5[_0x33d2('0x3c')]));if(_0x2a74ce[_0x33d2('0x34')][_0x33d2('0x3e')]){_0x2a8d7e[_0x33d2('0x3b')]=_[_0x33d2('0x3f')](_0x2a8d7e[_0x33d2('0x3b')],{'$or':_[_0x33d2('0x33')](_0x2a8d7e[_0x33d2('0x35')],function(_0x30a42c){var _0x5c60cd={};_0x5c60cd[_0x30a42c]={'$like':'%'+_0x2a74ce['query'][_0x33d2('0x3e')]+'%'};return _0x5c60cd;})});}_0x2a8d7e=_[_0x33d2('0x3f')]({},_0x2a8d7e,_0x2a74ce[_0x33d2('0x4a')]);return _0x1fc78c[_0x33d2('0x64')](_0x2a8d7e);}})[_0x33d2('0x26')](function(_0x167d58){if(_0x167d58){_0x4bd654=_0x167d58[_0x33d2('0x49')];if(!_0x2a74ce['query'][_0x33d2('0x59')](_0x33d2('0x5a'))){_0x2a8d7e[_0x33d2('0x38')]=qs[_0x33d2('0x38')](_0x2a74ce[_0x33d2('0x34')][_0x33d2('0x38')]);_0x2a8d7e[_0x33d2('0x21')]=qs[_0x33d2('0x21')](_0x2a74ce[_0x33d2('0x34')][_0x33d2('0x21')]);}return _0x1fc78c[_0x33d2('0x64')](_0x2a8d7e);}})[_0x33d2('0x26')](function(_0x6c45d0){if(_0x6c45d0){return _0x6c45d0?{'count':_0x4bd654,'rows':_0x6c45d0}:null;}})['then'](respondWithResult(_0x4efcb1,null))[_0x33d2('0x45')](handleError(_0x4efcb1,null));};exports[_0x33d2('0x65')]=function(_0x470d62,_0x5882df,_0x999a33){var _0x2291d5=_0x470d62[_0x33d2('0x4c')][_0x33d2('0x66')];return db[_0x33d2('0x67')][_0x33d2('0x5c')]({'where':{'id':_0x2291d5},'attributes':['id'],'include':[{'model':db[_0x33d2('0x5d')],'as':'Agents','attributes':['id','name',_0x33d2('0x68'),_0x33d2('0x69'),_0x33d2('0x6a')],'raw':!![]}]})['then'](function(_0x472e7d){if(_0x472e7d){var _0x8eff53=_[_0x33d2('0x6b')](_0x472e7d,function(_0x296b0c){var _0x5b8490=_0x296b0c[_0x33d2('0x28')]({'plain':!![]});return _0x5b8490['Agents'];});return db[_0x33d2('0x41')][_0x33d2('0x54')]({'where':{'id':_0x470d62[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](function(_0x1b487e){return db[_0x33d2('0x6c')]['transaction'](function(_0x21d53a){return _0x1b487e[_0x33d2('0x65')](_0x2291d5,{'transaction':_0x21d53a})[_0x33d2('0x26')](function(){return BPromise[_0x33d2('0x6d')](_0x8eff53,function(_0x3c9e0b){return db[_0x33d2('0x58')]['findOrCreate']({'where':{'UserId':_0x3c9e0b['id'],'OpenchannelQueueId':_0x470d62['params']['id']},'transaction':_0x21d53a});});})[_0x33d2('0x26')](function(){_0x8eff53[_0x33d2('0x6e')](function(_0x2df540){socket[_0x33d2('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x2df540['id'],'OpenchannelQueueId':_0x1b487e['id']});});});});});}})[_0x33d2('0x26')](respondWithStatusCode(_0x5882df,null))[_0x33d2('0x45')](handleError(_0x5882df,null));};exports[_0x33d2('0x70')]=function(_0x46c977,_0x5740b8,_0x1a91ff){return db['Team']['findAll']({'where':{'id':_0x46c977[_0x33d2('0x34')][_0x33d2('0x66')]},'attributes':['id'],'include':[{'model':db[_0x33d2('0x5d')],'as':_0x33d2('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5740b8,null))[_0x33d2('0x26')](function(_0x4a3f19){var _0x2a107f=_[_0x33d2('0x33')](_0x4a3f19,'id');var _0x3b2931=[];var _0x5e3b9e=[];var _0x4e9e42=squel['select']();_0x4e9e42['field'](_0x33d2('0x72'))[_0x33d2('0x73')](_0x33d2('0x74'),'tq')[_0x33d2('0x75')](_0x33d2('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x33d2('0x3b')]('OpenchannelQueueId\x20=\x20?',_0x46c977[_0x33d2('0x47')]['id']);for(var _0x5d86ec=0x0;_0x5d86ec<_0x4a3f19[_0x33d2('0x49')];_0x5d86ec+=0x1){let _0x343aa5=_0x4a3f19[_0x5d86ec];for(var _0x26ab52=0x0;_0x26ab52<_0x343aa5[_0x33d2('0x71')][_0x33d2('0x49')];_0x26ab52+=0x1){let _0x1b1157=_0x343aa5[_0x33d2('0x71')][_0x26ab52];var _0x176f3a=_0x4e9e42[_0x33d2('0x77')]();_0x176f3a[_0x33d2('0x3b')]('ut.UserId\x20=\x20?',_0x1b1157['id']);_0x5e3b9e[_0x33d2('0x78')](db[_0x33d2('0x6c')][_0x33d2('0x34')](_0x176f3a[_0x33d2('0x79')](),{'type':db[_0x33d2('0x6c')][_0x33d2('0x7a')][_0x33d2('0x7b')]})[_0x33d2('0x26')](function(_0x2126e0){if(_0x2126e0[_0x33d2('0x49')]===0x1){return _0x1b1157['id'];}else{var _0x24d9a5=_[_0x33d2('0x7c')](_[_0x33d2('0x33')](_0x2126e0,_0x33d2('0x7d')),function(_0x1d6fe1){return _['includes'](_0x2a107f,_0x1d6fe1);});if(_0x24d9a5){return _0x1b1157['id'];}}}));}}return BPromise[_0x33d2('0x7e')](_0x5e3b9e)[_0x33d2('0x26')](function(_0x413a71){_0x3b2931=_(_0x3b2931)[_0x33d2('0x7f')](_0x413a71)[_0x33d2('0x80')]()[_0x33d2('0x81')]();return db[_0x33d2('0x41')][_0x33d2('0x54')]({'where':{'id':_0x46c977[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](function(_0x1509a7){return db[_0x33d2('0x6c')][_0x33d2('0x82')](function(_0x127e9c){return _0x1509a7[_0x33d2('0x70')](_0x46c977[_0x33d2('0x34')]['ids'],{'transaction':_0x127e9c})[_0x33d2('0x26')](function(){if(!_[_0x33d2('0x83')](_0x3b2931)){return _0x1509a7[_0x33d2('0x84')](_0x3b2931,{'transaction':_0x127e9c});}})[_0x33d2('0x26')](function(){_0x3b2931[_0x33d2('0x6e')](function(_0x4f82ed){socket[_0x33d2('0x6f')](_0x33d2('0x85'),{'UserId':_0x4f82ed,'OpenchannelQueueId':_0x1509a7['id']});});});});});});})[_0x33d2('0x26')](respondWithStatusCode(_0x5740b8,null))[_0x33d2('0x45')](handleError(_0x5740b8,null));};exports[_0x33d2('0x86')]=function(_0x10b8f6,_0x468627,_0x29cbc6){return db[_0x33d2('0x41')][_0x33d2('0x54')]({'where':{'id':_0x10b8f6[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x468627,null))['then'](function(_0xb9083d){if(_0xb9083d){return _0xb9083d[_0x33d2('0x86')](_0x10b8f6[_0x33d2('0x4c')][_0x33d2('0x66')],_['omit'](_0x10b8f6['body'],[_0x33d2('0x66'),'id'])||{})['spread'](function(_0xfd0cca){for(var _0x2f715b=0x0;_0x2f715b<_0x10b8f6[_0x33d2('0x4c')][_0x33d2('0x66')]['length'];_0x2f715b+=0x1){socket[_0x33d2('0x6f')]('userOpenchannelQueue:save',{'UserId':_0x10b8f6[_0x33d2('0x4c')][_0x33d2('0x66')][_0x2f715b],'OpenchannelQueueId':_0x10b8f6[_0x33d2('0x47')]['id']});}return _0xfd0cca;});}})[_0x33d2('0x26')](respondWithResult(_0x468627,null))[_0x33d2('0x45')](handleError(_0x468627,null));};exports['removeAgents']=function(_0x342b6a,_0x2c2953,_0x59fd78){return db[_0x33d2('0x41')][_0x33d2('0x54')]({'where':{'id':_0x342b6a[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x2c2953,null))['then'](function(_0x135c74){if(_0x135c74){return _0x135c74[_0x33d2('0x84')](_0x342b6a['query']['ids'])['then'](function(){if(_[_0x33d2('0x87')](_0x342b6a[_0x33d2('0x34')][_0x33d2('0x66')])){for(var _0x396b82=0x0;_0x396b82<_0x342b6a['query'][_0x33d2('0x66')][_0x33d2('0x49')];_0x396b82+=0x1){socket[_0x33d2('0x6f')](_0x33d2('0x85'),{'UserId':Number(_0x342b6a['query'][_0x33d2('0x66')][_0x396b82]),'OpenchannelQueueId':Number(_0x342b6a[_0x33d2('0x47')]['id'])});}}else{socket[_0x33d2('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x342b6a['query'][_0x33d2('0x66')]),'OpenchannelQueueId':Number(_0x342b6a[_0x33d2('0x47')]['id'])});}});}})[_0x33d2('0x26')](respondWithStatusCode(_0x2c2953,null))['catch'](handleError(_0x2c2953,null));};exports[_0x33d2('0x88')]=function(_0x1c4b6b,_0x3e0af0,_0x3c2350){var _0x19afce={};var _0x305a49={};var _0x3129eb;var _0x43f6b9;return db['OpenchannelQueue'][_0x33d2('0x57')]({'where':{'id':_0x1c4b6b[_0x33d2('0x47')]['id']}})[_0x33d2('0x26')](handleEntityNotFound(_0x3e0af0,null))['then'](function(_0x3fe30a){if(_0x3fe30a){_0x3129eb=_0x3fe30a;_0x305a49[_0x33d2('0x32')]=_[_0x33d2('0x48')](db[_0x33d2('0x5d')][_0x33d2('0x2f')]);_0x305a49['query']=_[_0x33d2('0x48')](_0x1c4b6b[_0x33d2('0x34')]);_0x305a49[_0x33d2('0x3c')]=_['intersection'](_0x305a49[_0x33d2('0x32')],_0x305a49[_0x33d2('0x34')]);_0x19afce[_0x33d2('0x35')]=_[_0x33d2('0x36')](_0x305a49['model'],qs[_0x33d2('0x37')](_0x1c4b6b[_0x33d2('0x34')][_0x33d2('0x37')]));_0x19afce[_0x33d2('0x35')]=_0x19afce[_0x33d2('0x35')][_0x33d2('0x49')]?_0x19afce[_0x33d2('0x35')]:_0x305a49[_0x33d2('0x32')];_0x19afce[_0x33d2('0x39')]=qs['sort'](_0x1c4b6b['query'][_0x33d2('0x3a')]);_0x19afce[_0x33d2('0x3b')]=qs['filters'](_[_0x33d2('0x3d')](_0x1c4b6b[_0x33d2('0x34')],_0x305a49['filters']));if(_0x1c4b6b[_0x33d2('0x34')]['filter']){_0x19afce[_0x33d2('0x3b')]=_['merge'](_0x19afce[_0x33d2('0x3b')],{'$or':_[_0x33d2('0x33')](_0x19afce[_0x33d2('0x35')],function(_0x220555){var _0xb3775d={};_0xb3775d[_0x220555]={'$like':'%'+_0x1c4b6b['query'][_0x33d2('0x3e')]+'%'};return _0xb3775d;})});}_0x19afce=_['merge']({},_0x19afce,_0x1c4b6b[_0x33d2('0x4a')]);return _0x3129eb[_0x33d2('0x88')](_0x19afce);}})[_0x33d2('0x26')](function(_0x38c392){if(_0x38c392){_0x43f6b9=_0x38c392['length'];if(!_0x1c4b6b['query'][_0x33d2('0x59')](_0x33d2('0x5a'))){_0x19afce[_0x33d2('0x38')]=qs['limit'](_0x1c4b6b['query'][_0x33d2('0x38')]);_0x19afce[_0x33d2('0x21')]=qs[_0x33d2('0x21')](_0x1c4b6b['query'][_0x33d2('0x21')]);}return _0x3129eb['getAgents'](_0x19afce);}})[_0x33d2('0x26')](function(_0x423fa6){if(_0x423fa6){return _0x423fa6?{'count':_0x43f6b9,'rows':_0x423fa6}:null;}})[_0x33d2('0x26')](respondWithResult(_0x3e0af0,null))['catch'](handleError(_0x3e0af0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6845050..a39d127 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 _0x8885=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x89b805,_0x2116af){var _0x39224f=function(_0x51f943){while(--_0x51f943){_0x89b805['push'](_0x89b805['shift']());}};_0x39224f(++_0x2116af);}(_0x8885,0x139));var _0x5888=function(_0x1284e0,_0x4e3a83){_0x1284e0=_0x1284e0-0x0;var _0x2cdf2d=_0x8885[_0x1284e0];return _0x2cdf2d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x5888('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5888('0x1')](0x0);var events={'afterCreate':_0x5888('0x2'),'afterUpdate':_0x5888('0x3'),'afterDestroy':'remove'};function emitEvent(_0x27f81a){return function(_0x38101d,_0x5ec8ac,_0xca4c2c){OpenchannelQueueEvents['emit'](_0x27f81a+':'+_0x38101d['id'],_0x38101d);OpenchannelQueueEvents[_0x5888('0x4')](_0x27f81a,_0x38101d);_0xca4c2c(null);};}for(var e in events){if(events[_0x5888('0x5')](e)){var event=events[e];OpenchannelQueue[_0x5888('0x6')](e,emitEvent(event));}}module[_0x5888('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x570d=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x570d,0x6c));var _0xd570=function(_0x4d3843,_0x29a84e){_0x4d3843=_0x4d3843-0x0;var _0x574e1f=_0x570d[_0x4d3843];return _0x574e1f;};'use strict';var EventEmitter=require(_0xd570('0x0'));var OpenchannelQueue=require(_0xd570('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd570('0x2')](0x0);var events={'afterCreate':_0xd570('0x3'),'afterUpdate':_0xd570('0x4'),'afterDestroy':_0xd570('0x5')};function emitEvent(_0x11ed89){return function(_0x1be6ec,_0x38c867,_0x43225e){OpenchannelQueueEvents['emit'](_0x11ed89+':'+_0x1be6ec['id'],_0x1be6ec);OpenchannelQueueEvents[_0xd570('0x6')](_0x11ed89,_0x1be6ec);_0x43225e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd570('0x7')](e,emitEvent(event));}}module[_0xd570('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 54e2e94..5e259db 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 _0x770f=['exports','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes'];(function(_0x4143b0,_0x105d39){var _0x5b6147=function(_0xb16a4a){while(--_0xb16a4a){_0x4143b0['push'](_0x4143b0['shift']());}};_0x5b6147(++_0x105d39);}(_0x770f,0x1e7));var _0xf770=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0x770f[_0xf20b6];return _0x4ff567;};'use strict';var _=require('lodash');var util=require(_0xf770('0x0'));var logger=require(_0xf770('0x1'))(_0xf770('0x2'));var moment=require('moment');var BPromise=require(_0xf770('0x3'));var rp=require(_0xf770('0x4'));var fs=require('fs');var path=require(_0xf770('0x5'));var rimraf=require('rimraf');var config=require(_0xf770('0x6'));var attributes=require(_0xf770('0x7'));module[_0xf770('0x8')]=function(_0x37176a,_0x40027f){return _0x37176a['define'](_0xf770('0x9'),attributes,{'tableName':_0xf770('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfac=['bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfac,0x105));var _0xccfa=function(_0x55d0a7,_0x262428){_0x55d0a7=_0x55d0a7-0x0;var _0x63330e=_0xcfac[_0x55d0a7];return _0x63330e;};'use strict';var _=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var logger=require(_0xccfa('0x2'))(_0xccfa('0x3'));var moment=require(_0xccfa('0x4'));var BPromise=require(_0xccfa('0x5'));var rp=require(_0xccfa('0x6'));var fs=require('fs');var path=require(_0xccfa('0x7'));var rimraf=require(_0xccfa('0x8'));var config=require('../../config/environment');var attributes=require(_0xccfa('0x9'));module[_0xccfa('0xa')]=function(_0x2d2ddf,_0x1ba378){return _0x2d2ddf[_0xccfa('0xb')](_0xccfa('0xc'),attributes,{'tableName':_0xccfa('0xd'),'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 72bf401..c41efed 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 _0xedb3=['model','map','then','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x55ca30,_0x161963){var _0x233915=function(_0x41982c){while(--_0x41982c){_0x55ca30['push'](_0x55ca30['shift']());}};_0x233915(++_0x161963);}(_0xedb3,0x12b));var _0x3edb=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xedb3[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x3edb('0x0'));var util=require(_0x3edb('0x1'));var moment=require(_0x3edb('0x2'));var BPromise=require(_0x3edb('0x3'));var rs=require(_0x3edb('0x4'));var fs=require('fs');var Redis=require(_0x3edb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3edb('0x6'));var logger=require(_0x3edb('0x7'))(_0x3edb('0x8'));var config=require(_0x3edb('0x9'));var jayson=require(_0x3edb('0xa'));var client=jayson[_0x3edb('0xb')][_0x3edb('0xc')]({'port':0x232a});config[_0x3edb('0xd')]=_['defaults'](config[_0x3edb('0xd')],{'host':_0x3edb('0xe'),'port':0x18eb});var socket=require(_0x3edb('0xf'))(new Redis(config[_0x3edb('0xd')]));require(_0x3edb('0x10'))[_0x3edb('0x11')](socket);function respondWithRpcPromise(_0x4d1e51,_0x36e9c3,_0x2ab5d5){return new BPromise(function(_0x49a362,_0x498778){return client['request'](_0x4d1e51,_0x2ab5d5)['then'](function(_0x8369d2){logger['info'](_0x3edb('0x12'),_0x36e9c3,_0x3edb('0x13'));logger[_0x3edb('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x36e9c3,_0x3edb('0x13'),JSON[_0x3edb('0x15')](_0x8369d2));if(_0x8369d2[_0x3edb('0x16')]){if(_0x8369d2[_0x3edb('0x16')][_0x3edb('0x17')]===0x1f4){logger['error'](_0x3edb('0x12'),_0x36e9c3,_0x8369d2[_0x3edb('0x16')][_0x3edb('0x18')]);return _0x498778(_0x8369d2['error']['message']);}logger[_0x3edb('0x16')](_0x3edb('0x12'),_0x36e9c3,_0x8369d2[_0x3edb('0x16')][_0x3edb('0x18')]);return _0x49a362(_0x8369d2[_0x3edb('0x16')]['message']);}else{logger[_0x3edb('0x19')](_0x3edb('0x12'),_0x36e9c3,_0x3edb('0x13'));_0x49a362(_0x8369d2[_0x3edb('0x1a')][_0x3edb('0x18')]);}})[_0x3edb('0x1b')](function(_0x4f24bb){logger[_0x3edb('0x16')](_0x3edb('0x12'),_0x36e9c3,_0x4f24bb);_0x498778(_0x4f24bb);});});}exports[_0x3edb('0x1c')]=function(_0x4b7432){var _0x1cfdc4=this;return new Promise(function(_0x119e15,_0xaab693){return db[_0x3edb('0x1d')][_0x3edb('0x1e')]({'raw':_0x4b7432['options']?_0x4b7432[_0x3edb('0x1f')][_0x3edb('0x20')]===undefined?!![]:![]:!![],'where':_0x4b7432[_0x3edb('0x1f')]?_0x4b7432[_0x3edb('0x1f')][_0x3edb('0x21')]||null:null,'attributes':_0x4b7432['options']?_0x4b7432['options'][_0x3edb('0x22')]||null:null,'limit':_0x4b7432[_0x3edb('0x1f')]?_0x4b7432[_0x3edb('0x1f')][_0x3edb('0x23')]||null:null,'include':_0x4b7432[_0x3edb('0x1f')]?_0x4b7432[_0x3edb('0x1f')]['include']?_['map'](_0x4b7432[_0x3edb('0x1f')][_0x3edb('0x24')],function(_0x5dbebe){return{'model':db[_0x5dbebe[_0x3edb('0x25')]],'as':_0x5dbebe['as'],'attributes':_0x5dbebe[_0x3edb('0x22')],'include':_0x5dbebe[_0x3edb('0x24')]?_[_0x3edb('0x26')](_0x5dbebe['include'],function(_0x4b612e){return{'model':db[_0x4b612e[_0x3edb('0x25')]],'as':_0x4b612e['as'],'attributes':_0x4b612e[_0x3edb('0x22')],'include':_0x4b612e[_0x3edb('0x24')]?_['map'](_0x4b612e['include'],function(_0x16ee6f){return{'model':db[_0x16ee6f[_0x3edb('0x25')]],'as':_0x16ee6f['as'],'attributes':_0x16ee6f[_0x3edb('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3edb('0x27')](function(_0x2ead0e){logger[_0x3edb('0x19')](_0x3edb('0x1c'),_0x4b7432);logger[_0x3edb('0x14')](_0x3edb('0x1c'),_0x4b7432,JSON['stringify'](_0x2ead0e));_0x119e15(_0x2ead0e);})[_0x3edb('0x1b')](function(_0x48411f){logger['error'](_0x3edb('0x1c'),_0x48411f['message'],_0x4b7432);_0xaab693(_0x1cfdc4[_0x3edb('0x16')](0x1f4,_0x48411f[_0x3edb('0x18')]));});});};exports[_0x3edb('0x28')]=function(_0x1b81ea){var _0x59bcdb=this;return new Promise(function(_0x4533b0,_0x5412f3){return db['OpenchannelQueue'][_0x3edb('0x29')]({'raw':_0x1b81ea[_0x3edb('0x1f')]?_0x1b81ea[_0x3edb('0x1f')][_0x3edb('0x20')]===undefined?!![]:![]:!![],'where':_0x1b81ea[_0x3edb('0x1f')]?_0x1b81ea['options'][_0x3edb('0x21')]||null:null,'attributes':_0x1b81ea[_0x3edb('0x1f')]?_0x1b81ea[_0x3edb('0x1f')]['attributes']||null:null,'include':_0x1b81ea[_0x3edb('0x1f')]?_0x1b81ea[_0x3edb('0x1f')][_0x3edb('0x24')]?_[_0x3edb('0x26')](_0x1b81ea['options'][_0x3edb('0x24')],function(_0x32269c){return{'model':db[_0x32269c[_0x3edb('0x25')]],'as':_0x32269c['as'],'attributes':_0x32269c[_0x3edb('0x22')],'include':_0x32269c[_0x3edb('0x24')]?_['map'](_0x32269c['include'],function(_0x52382d){return{'model':db[_0x52382d[_0x3edb('0x25')]],'as':_0x52382d['as'],'attributes':_0x52382d[_0x3edb('0x22')],'include':_0x52382d[_0x3edb('0x24')]?_['map'](_0x52382d[_0x3edb('0x24')],function(_0x4ca33a){return{'model':db[_0x4ca33a[_0x3edb('0x25')]],'as':_0x4ca33a['as'],'attributes':_0x4ca33a[_0x3edb('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe69464){logger[_0x3edb('0x19')](_0x3edb('0x28'),_0x1b81ea);logger[_0x3edb('0x14')](_0x3edb('0x28'),_0x1b81ea,JSON[_0x3edb('0x15')](_0xe69464));_0x4533b0(_0xe69464);})[_0x3edb('0x1b')](function(_0x229512){logger[_0x3edb('0x16')](_0x3edb('0x28'),_0x229512['message'],_0x1b81ea);_0x5412f3(_0x59bcdb[_0x3edb('0x16')](0x1f4,_0x229512['message']));});});}; \ No newline at end of file +var _0x4c93=['stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1c37cb,_0x214f8e){var _0x2c221e=function(_0x66fcc5){while(--_0x66fcc5){_0x1c37cb['push'](_0x1c37cb['shift']());}};_0x2c221e(++_0x214f8e);}(_0x4c93,0x182));var _0x34c9=function(_0x83e4b3,_0x339ea9){_0x83e4b3=_0x83e4b3-0x0;var _0x40dfa7=_0x4c93[_0x83e4b3];return _0x40dfa7;};'use strict';var _=require(_0x34c9('0x0'));var util=require(_0x34c9('0x1'));var moment=require(_0x34c9('0x2'));var BPromise=require(_0x34c9('0x3'));var rs=require(_0x34c9('0x4'));var fs=require('fs');var Redis=require(_0x34c9('0x5'));var db=require(_0x34c9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x34c9('0x7'))(_0x34c9('0x8'));var config=require(_0x34c9('0x9'));var jayson=require(_0x34c9('0xa'));var client=jayson['client'][_0x34c9('0xb')]({'port':0x232a});config[_0x34c9('0xc')]=_[_0x34c9('0xd')](config[_0x34c9('0xc')],{'host':_0x34c9('0xe'),'port':0x18eb});var socket=require(_0x34c9('0xf'))(new Redis(config[_0x34c9('0xc')]));require('./openchannelQueue.socket')[_0x34c9('0x10')](socket);function respondWithRpcPromise(_0x31aa6f,_0xd1dffb,_0x10e8dc){return new BPromise(function(_0x893a74,_0x5d791e){return client[_0x34c9('0x11')](_0x31aa6f,_0x10e8dc)[_0x34c9('0x12')](function(_0x535b8c){logger[_0x34c9('0x13')](_0x34c9('0x14'),_0xd1dffb,_0x34c9('0x15'));logger[_0x34c9('0x16')](_0x34c9('0x17'),_0xd1dffb,'request\x20sent',JSON[_0x34c9('0x18')](_0x535b8c));if(_0x535b8c[_0x34c9('0x19')]){if(_0x535b8c[_0x34c9('0x19')][_0x34c9('0x1a')]===0x1f4){logger[_0x34c9('0x19')](_0x34c9('0x14'),_0xd1dffb,_0x535b8c[_0x34c9('0x19')][_0x34c9('0x1b')]);return _0x5d791e(_0x535b8c[_0x34c9('0x19')][_0x34c9('0x1b')]);}logger[_0x34c9('0x19')](_0x34c9('0x14'),_0xd1dffb,_0x535b8c[_0x34c9('0x19')][_0x34c9('0x1b')]);return _0x893a74(_0x535b8c[_0x34c9('0x19')][_0x34c9('0x1b')]);}else{logger[_0x34c9('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0xd1dffb,_0x34c9('0x15'));_0x893a74(_0x535b8c['result'][_0x34c9('0x1b')]);}})['catch'](function(_0x34fd81){logger['error'](_0x34c9('0x14'),_0xd1dffb,_0x34fd81);_0x5d791e(_0x34fd81);});});}exports[_0x34c9('0x1c')]=function(_0x568135){var _0x4dd109=this;return new Promise(function(_0x20be57,_0x83d1d5){return db[_0x34c9('0x1d')][_0x34c9('0x1e')]({'raw':_0x568135[_0x34c9('0x1f')]?_0x568135[_0x34c9('0x1f')][_0x34c9('0x20')]===undefined?!![]:![]:!![],'where':_0x568135['options']?_0x568135['options'][_0x34c9('0x21')]||null:null,'attributes':_0x568135[_0x34c9('0x1f')]?_0x568135[_0x34c9('0x1f')][_0x34c9('0x22')]||null:null,'limit':_0x568135[_0x34c9('0x1f')]?_0x568135[_0x34c9('0x1f')][_0x34c9('0x23')]||null:null,'include':_0x568135['options']?_0x568135['options'][_0x34c9('0x24')]?_[_0x34c9('0x25')](_0x568135[_0x34c9('0x1f')][_0x34c9('0x24')],function(_0x5b887f){return{'model':db[_0x5b887f[_0x34c9('0x26')]],'as':_0x5b887f['as'],'attributes':_0x5b887f[_0x34c9('0x22')],'include':_0x5b887f[_0x34c9('0x24')]?_[_0x34c9('0x25')](_0x5b887f[_0x34c9('0x24')],function(_0xa7be09){return{'model':db[_0xa7be09[_0x34c9('0x26')]],'as':_0xa7be09['as'],'attributes':_0xa7be09[_0x34c9('0x22')],'include':_0xa7be09['include']?_[_0x34c9('0x25')](_0xa7be09[_0x34c9('0x24')],function(_0x5ba177){return{'model':db[_0x5ba177[_0x34c9('0x26')]],'as':_0x5ba177['as'],'attributes':_0x5ba177[_0x34c9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x34c9('0x12')](function(_0x2254bb){logger[_0x34c9('0x13')](_0x34c9('0x1c'),_0x568135);logger[_0x34c9('0x16')](_0x34c9('0x1c'),_0x568135,JSON[_0x34c9('0x18')](_0x2254bb));_0x20be57(_0x2254bb);})[_0x34c9('0x27')](function(_0x3e0cff){logger[_0x34c9('0x19')](_0x34c9('0x1c'),_0x3e0cff[_0x34c9('0x1b')],_0x568135);_0x83d1d5(_0x4dd109[_0x34c9('0x19')](0x1f4,_0x3e0cff[_0x34c9('0x1b')]));});});};exports[_0x34c9('0x28')]=function(_0x1b6936){var _0x4eed95=this;return new Promise(function(_0x309ed8,_0x785f2){return db['OpenchannelQueue']['find']({'raw':_0x1b6936[_0x34c9('0x1f')]?_0x1b6936[_0x34c9('0x1f')][_0x34c9('0x20')]===undefined?!![]:![]:!![],'where':_0x1b6936[_0x34c9('0x1f')]?_0x1b6936[_0x34c9('0x1f')][_0x34c9('0x21')]||null:null,'attributes':_0x1b6936[_0x34c9('0x1f')]?_0x1b6936['options'][_0x34c9('0x22')]||null:null,'include':_0x1b6936['options']?_0x1b6936[_0x34c9('0x1f')]['include']?_[_0x34c9('0x25')](_0x1b6936[_0x34c9('0x1f')][_0x34c9('0x24')],function(_0x134676){return{'model':db[_0x134676[_0x34c9('0x26')]],'as':_0x134676['as'],'attributes':_0x134676[_0x34c9('0x22')],'include':_0x134676[_0x34c9('0x24')]?_[_0x34c9('0x25')](_0x134676[_0x34c9('0x24')],function(_0x327354){return{'model':db[_0x327354[_0x34c9('0x26')]],'as':_0x327354['as'],'attributes':_0x327354[_0x34c9('0x22')],'include':_0x327354[_0x34c9('0x24')]?_[_0x34c9('0x25')](_0x327354[_0x34c9('0x24')],function(_0x36d7b8){return{'model':db[_0x36d7b8[_0x34c9('0x26')]],'as':_0x36d7b8['as'],'attributes':_0x36d7b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x34c9('0x12')](function(_0x22231b){logger[_0x34c9('0x13')]('ShowOpenchannelQueue',_0x1b6936);logger[_0x34c9('0x16')](_0x34c9('0x28'),_0x1b6936,JSON[_0x34c9('0x18')](_0x22231b));_0x309ed8(_0x22231b);})[_0x34c9('0x27')](function(_0x339ba9){logger['error'](_0x34c9('0x28'),_0x339ba9['message'],_0x1b6936);_0x785f2(_0x4eed95[_0x34c9('0x19')](0x1f4,_0x339ba9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 77be399..8456872 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 _0x16cb=['removeListener','register','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x148141,_0x455e4a){var _0x279686=function(_0x3fe271){while(--_0x3fe271){_0x148141['push'](_0x148141['shift']());}};_0x279686(++_0x455e4a);}(_0x16cb,0x73));var _0xb16c=function(_0x4aac97,_0x3513f6){_0x4aac97=_0x4aac97-0x0;var _0x1ba475=_0x16cb[_0x4aac97];return _0x1ba475;};'use strict';var OpenchannelQueueEvents=require(_0xb16c('0x0'));var events=[_0xb16c('0x1'),_0xb16c('0x2'),_0xb16c('0x3')];function createListener(_0x3914b9,_0x55a1b9){return function(_0x4d2f77){_0x55a1b9['emit'](_0x3914b9,_0x4d2f77);};}function removeListener(_0x930cec,_0x27fca7){return function(){OpenchannelQueueEvents[_0xb16c('0x4')](_0x930cec,_0x27fca7);};}exports[_0xb16c('0x5')]=function(_0x28d2f0){for(var _0x2fd5e2=0x0,_0x20a89f=events['length'];_0x2fd5e2<_0x20a89f;_0x2fd5e2++){var _0x134878=events[_0x2fd5e2];var _0x37445b=createListener(_0xb16c('0x6')+_0x134878,_0x28d2f0);OpenchannelQueueEvents['on'](_0x134878,_0x37445b);}}; \ No newline at end of file +var _0xfbc8=['removeListener','length','openchannelQueue:','save','emit'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xfbc8,0x17f));var _0x8fbc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xfbc8[_0x5f09c5];return _0x426ad9;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x8fbc('0x0'),'remove','update'];function createListener(_0x3d1da2,_0x329831){return function(_0x401a3e){_0x329831[_0x8fbc('0x1')](_0x3d1da2,_0x401a3e);};}function removeListener(_0x22c5f9,_0x54dd5b){return function(){OpenchannelQueueEvents[_0x8fbc('0x2')](_0x22c5f9,_0x54dd5b);};}exports['register']=function(_0x3e1580){for(var _0x39a9c2=0x0,_0x5659d7=events[_0x8fbc('0x3')];_0x39a9c2<_0x5659d7;_0x39a9c2++){var _0x4d8b9b=events[_0x39a9c2];var _0x112026=createListener(_0x8fbc('0x4')+_0x4d8b9b,_0x3e1580);OpenchannelQueueEvents['on'](_0x4d8b9b,_0x112026);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ccf604f..ef50cb9 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 _0xcc68=['./openchannelQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xcc68,0x7f));var _0x8cc6=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcc68[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x8cc6('0x0'));var path=require(_0x8cc6('0x1'));var timeout=require(_0x8cc6('0x2'));var express=require('express');var router=express[_0x8cc6('0x3')]();var auth=require(_0x8cc6('0x4'));var interaction=require(_0x8cc6('0x5'));var config=require('../../config/environment');var controller=require(_0x8cc6('0x6'));router['get']('/',auth[_0x8cc6('0x7')](),controller['index']);router[_0x8cc6('0x8')](_0x8cc6('0x9'),auth[_0x8cc6('0x7')](),controller[_0x8cc6('0xa')]);router[_0x8cc6('0x8')](_0x8cc6('0xb'),auth[_0x8cc6('0x7')](),controller[_0x8cc6('0xc')]);router[_0x8cc6('0xd')]('/',auth['isAuthenticated'](),controller[_0x8cc6('0xe')]);router['put'](_0x8cc6('0xb'),auth[_0x8cc6('0x7')](),controller[_0x8cc6('0xf')]);router[_0x8cc6('0x10')](_0x8cc6('0xb'),auth[_0x8cc6('0x7')](),controller[_0x8cc6('0x11')]);module[_0x8cc6('0x12')]=router; \ No newline at end of file +var _0xd211=['Router','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','exports','multer','util','path','express'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0xd211,0x88));var _0x1d21=function(_0x3ae425,_0x340f24){_0x3ae425=_0x3ae425-0x0;var _0x1670c2=_0xd211[_0x3ae425];return _0x1670c2;};'use strict';var multer=require(_0x1d21('0x0'));var util=require(_0x1d21('0x1'));var path=require(_0x1d21('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d21('0x3'));var router=express[_0x1d21('0x4')]();var auth=require(_0x1d21('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d21('0x6'));var controller=require(_0x1d21('0x7'));router[_0x1d21('0x8')]('/',auth[_0x1d21('0x9')](),controller[_0x1d21('0xa')]);router[_0x1d21('0x8')](_0x1d21('0xb'),auth[_0x1d21('0x9')](),controller[_0x1d21('0xc')]);router[_0x1d21('0x8')]('/:id',auth[_0x1d21('0x9')](),controller[_0x1d21('0xd')]);router[_0x1d21('0xe')]('/',auth[_0x1d21('0x9')](),controller[_0x1d21('0xf')]);router['put'](_0x1d21('0x10'),auth[_0x1d21('0x9')](),controller[_0x1d21('0x11')]);router[_0x1d21('0x12')]('/:id',auth[_0x1d21('0x9')](),controller['destroy']);module[_0x1d21('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 258577c..ec68ed3 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 _0x8fd9=['exports','STRING','DATE'];(function(_0x5838d6,_0x586dd1){var _0x5f6708=function(_0x3afbc8){while(--_0x3afbc8){_0x5838d6['push'](_0x5838d6['shift']());}};_0x5f6708(++_0x586dd1);}(_0x8fd9,0x1ce));var _0x98fd=function(_0xe2c665,_0x5467a0){_0xe2c665=_0xe2c665-0x0;var _0x5bcbb7=_0x8fd9[_0xe2c665];return _0x5bcbb7;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x98fd('0x0')]={'uniqueid':{'type':Sequelize[_0x98fd('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x98fd('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x98fd('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x98fd('0x2')]},'reason':{'type':Sequelize[_0x98fd('0x1')]}}; \ No newline at end of file +var _0x45ed=['sequelize','exports','STRING','DATE','moment'];(function(_0x5b3928,_0x39a322){var _0x5544a5=function(_0x1a5645){while(--_0x1a5645){_0x5b3928['push'](_0x5b3928['shift']());}};_0x5544a5(++_0x39a322);}(_0x45ed,0x108));var _0xd45e=function(_0x219a75,_0x4096eb){_0x219a75=_0x219a75-0x0;var _0x338782=_0x45ed[_0x219a75];return _0x338782;};'use strict';var moment=require(_0xd45e('0x0'));var Sequelize=require(_0xd45e('0x1'));module[_0xd45e('0x2')]={'uniqueid':{'type':Sequelize[_0xd45e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd45e('0x3')]},'joinAt':{'type':Sequelize[_0xd45e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd45e('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd45e('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ee865e3..8056615 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 _0xda34=['show','params','keys','length','find','create','update','body','describe','rimraf','zip-dir','request-promise','moment','util','path','sox','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','options','OpenchannelQueueReport','includeAll','include','rows','catch'];(function(_0xf1c70e,_0x1d67be){var _0x11c68a=function(_0x22818a){while(--_0x22818a){_0xf1c70e['push'](_0xf1c70e['shift']());}};_0x11c68a(++_0x1d67be);}(_0xda34,0x14e));var _0x4da3=function(_0xd593a2,_0x4a4b6d){_0xd593a2=_0xd593a2-0x0;var _0x483c06=_0xda34[_0xd593a2];return _0x483c06;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4da3('0x0'));var zipdir=require(_0x4da3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4da3('0x2'));var moment=require(_0x4da3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4da3('0x4'));var path=require(_0x4da3('0x5'));var sox=require(_0x4da3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4da3('0x7'));var jsforce=require(_0x4da3('0x8'));var deskjs=require(_0x4da3('0x9'));var toCsv=require('to-csv');var querystring=require(_0x4da3('0xa'));var Papa=require('papaparse');var Redis=require(_0x4da3('0xb'));var authService=require(_0x4da3('0xc'));var qs=require(_0x4da3('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4da3('0xe'));var logger=require(_0x4da3('0xf'))(_0x4da3('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e8a7,_0x412e20){_0x412e20=_0x412e20||0xcc;return function(_0x346e02){if(_0x346e02){return _0x20e8a7[_0x4da3('0x11')](_0x412e20);}return _0x20e8a7[_0x4da3('0x12')](_0x412e20)[_0x4da3('0x13')]();};}function respondWithResult(_0x3f8621,_0x5ae401){_0x5ae401=_0x5ae401||0xc8;return function(_0xdb5941){if(_0xdb5941){return _0x3f8621[_0x4da3('0x12')](_0x5ae401)[_0x4da3('0x14')](_0xdb5941);}};}function respondWithFilteredResult(_0x572429,_0x4afc8e){return function(_0x7503ba){if(_0x7503ba){var _0x330f62=_0x7503ba[_0x4da3('0x15')],_0xfe4d33=_0x4afc8e[_0x4da3('0x16')],_0x24a8d0=_0x4afc8e['offset']+_0x4afc8e['limit'],_0x56f700;if(_0x24a8d0>=_0x330f62){_0x24a8d0=_0x330f62;_0x56f700=0xc8;}else{_0x56f700=0xce;}_0x572429[_0x4da3('0x12')](_0x56f700);return _0x572429[_0x4da3('0x17')](_0x4da3('0x18'),_0xfe4d33+'-'+_0x24a8d0+'/'+_0x330f62)['json'](_0x7503ba);}return null;};}function patchUpdates(_0x22a54f){return function(_0x30e615){try{jsonpatch[_0x4da3('0x19')](_0x30e615,_0x22a54f,!![]);}catch(_0x27a6dc){return BPromise[_0x4da3('0x1a')](_0x27a6dc);}return _0x30e615['save']();};}function saveUpdates(_0x2969f9,_0x1d8cc8){return function(_0x583737){if(_0x583737){return _0x583737['update'](_0x2969f9)[_0x4da3('0x1b')](function(_0x3b326f){return _0x3b326f;});}return null;};}function removeEntity(_0x108cac,_0x3be6ef){return function(_0x52ff42){if(_0x52ff42){return _0x52ff42['destroy']()['then'](function(){_0x108cac['status'](0xcc)[_0x4da3('0x13')]();});}};}function handleEntityNotFound(_0xfeff22,_0x1d7638){return function(_0x181164){if(!_0x181164){_0xfeff22[_0x4da3('0x11')](0x194);}return _0x181164;};}function handleError(_0x38d392,_0x1e4609){_0x1e4609=_0x1e4609||0x1f4;return function(_0x321dd1){logger['error'](_0x321dd1['stack']);if(_0x321dd1[_0x4da3('0x1c')]){delete _0x321dd1['name'];}_0x38d392[_0x4da3('0x12')](_0x1e4609)[_0x4da3('0x1d')](_0x321dd1);};}exports[_0x4da3('0x1e')]=function(_0x499233,_0x2162c6){var _0xa96321={},_0x9375d0={},_0x2e52ec={'count':0x0,'rows':[]};var _0x2415e2=_[_0x4da3('0x1f')](db['OpenchannelQueueReport'][_0x4da3('0x20')],function(_0x57fdd6){return{'name':_0x57fdd6[_0x4da3('0x21')],'type':_0x57fdd6['type']['key']};});_0x9375d0[_0x4da3('0x22')]=_[_0x4da3('0x1f')](_0x2415e2,_0x4da3('0x1c'));_0x9375d0[_0x4da3('0x23')]=_['keys'](_0x499233['query']);_0x9375d0[_0x4da3('0x24')]=_[_0x4da3('0x25')](_0x9375d0[_0x4da3('0x22')],_0x9375d0[_0x4da3('0x23')]);_0xa96321[_0x4da3('0x26')]=_[_0x4da3('0x25')](_0x9375d0[_0x4da3('0x22')],qs[_0x4da3('0x27')](_0x499233[_0x4da3('0x23')][_0x4da3('0x27')]));_0xa96321['attributes']=_0xa96321[_0x4da3('0x26')]['length']?_0xa96321[_0x4da3('0x26')]:_0x9375d0['model'];if(!_0x499233['query'][_0x4da3('0x28')](_0x4da3('0x29'))){_0xa96321['limit']=qs[_0x4da3('0x2a')](_0x499233[_0x4da3('0x23')][_0x4da3('0x2a')]);_0xa96321[_0x4da3('0x16')]=qs[_0x4da3('0x16')](_0x499233[_0x4da3('0x23')][_0x4da3('0x16')]);}_0xa96321[_0x4da3('0x2b')]=qs[_0x4da3('0x2c')](_0x499233[_0x4da3('0x23')]['sort']);_0xa96321['where']=qs[_0x4da3('0x24')](_[_0x4da3('0x2d')](_0x499233[_0x4da3('0x23')],_0x9375d0[_0x4da3('0x24')]),_0x2415e2);if(_0x499233[_0x4da3('0x23')][_0x4da3('0x2e')]){_0xa96321['where']=_[_0x4da3('0x2f')](_0xa96321[_0x4da3('0x30')],{'$or':_['map'](_0x2415e2,function(_0x3ab231){if(_0x3ab231[_0x4da3('0x31')]!=='VIRTUAL'){var _0x2246fd={};_0x2246fd[_0x3ab231[_0x4da3('0x1c')]]={'$like':'%'+_0x499233[_0x4da3('0x23')][_0x4da3('0x2e')]+'%'};return _0x2246fd;}})});}_0xa96321=_[_0x4da3('0x2f')]({},_0xa96321,_0x499233[_0x4da3('0x32')]);var _0x250cba={'where':_0xa96321[_0x4da3('0x30')]};return db[_0x4da3('0x33')][_0x4da3('0x15')](_0x250cba)[_0x4da3('0x1b')](function(_0x214da8){_0x2e52ec[_0x4da3('0x15')]=_0x214da8;if(_0x499233[_0x4da3('0x23')][_0x4da3('0x34')]){_0xa96321[_0x4da3('0x35')]=[{'all':!![]}];}return db[_0x4da3('0x33')]['findAll'](_0xa96321);})[_0x4da3('0x1b')](function(_0x1f7282){_0x2e52ec[_0x4da3('0x36')]=_0x1f7282;return _0x2e52ec;})[_0x4da3('0x1b')](respondWithFilteredResult(_0x2162c6,_0xa96321))[_0x4da3('0x37')](handleError(_0x2162c6,null));};exports[_0x4da3('0x38')]=function(_0x2af02a,_0x2ce51b){var _0x4cfaa3={'raw':!![],'where':{'id':_0x2af02a[_0x4da3('0x39')]['id']}},_0x1846d5={};_0x1846d5[_0x4da3('0x22')]=_['keys'](db[_0x4da3('0x33')][_0x4da3('0x20')]);_0x1846d5[_0x4da3('0x23')]=_[_0x4da3('0x3a')](_0x2af02a[_0x4da3('0x23')]);_0x1846d5[_0x4da3('0x24')]=_['intersection'](_0x1846d5[_0x4da3('0x22')],_0x1846d5['query']);_0x4cfaa3[_0x4da3('0x26')]=_[_0x4da3('0x25')](_0x1846d5[_0x4da3('0x22')],qs[_0x4da3('0x27')](_0x2af02a[_0x4da3('0x23')]['fields']));_0x4cfaa3[_0x4da3('0x26')]=_0x4cfaa3[_0x4da3('0x26')][_0x4da3('0x3b')]?_0x4cfaa3[_0x4da3('0x26')]:_0x1846d5[_0x4da3('0x22')];if(_0x2af02a[_0x4da3('0x23')]['includeAll']){_0x4cfaa3[_0x4da3('0x35')]=[{'all':!![]}];}_0x4cfaa3=_[_0x4da3('0x2f')]({},_0x4cfaa3,_0x2af02a[_0x4da3('0x32')]);return db[_0x4da3('0x33')][_0x4da3('0x3c')](_0x4cfaa3)['then'](handleEntityNotFound(_0x2ce51b,null))[_0x4da3('0x1b')](respondWithResult(_0x2ce51b,null))[_0x4da3('0x37')](handleError(_0x2ce51b,null));};exports[_0x4da3('0x3d')]=function(_0x4b5953,_0x17b5ba){return db[_0x4da3('0x33')][_0x4da3('0x3d')](_0x4b5953['body'],{})[_0x4da3('0x1b')](respondWithResult(_0x17b5ba,0xc9))[_0x4da3('0x37')](handleError(_0x17b5ba,null));};exports[_0x4da3('0x3e')]=function(_0x4da7cc,_0x61f3b9){if(_0x4da7cc[_0x4da3('0x3f')]['id']){delete _0x4da7cc[_0x4da3('0x3f')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x4da7cc[_0x4da3('0x39')]['id']}})['then'](handleEntityNotFound(_0x61f3b9,null))[_0x4da3('0x1b')](saveUpdates(_0x4da7cc[_0x4da3('0x3f')],null))[_0x4da3('0x1b')](respondWithResult(_0x61f3b9,null))[_0x4da3('0x37')](handleError(_0x61f3b9,null));};exports['destroy']=function(_0x95bc49,_0x4408c8){return db[_0x4da3('0x33')][_0x4da3('0x3c')]({'where':{'id':_0x95bc49[_0x4da3('0x39')]['id']}})['then'](handleEntityNotFound(_0x4408c8,null))[_0x4da3('0x1b')](removeEntity(_0x4408c8,null))[_0x4da3('0x37')](handleError(_0x4408c8,null));};exports[_0x4da3('0x40')]=function(_0x9b80e1,_0x56ca24){return db['OpenchannelQueueReport'][_0x4da3('0x40')]()['then'](respondWithResult(_0x56ca24,null))[_0x4da3('0x37')](handleError(_0x56ca24,null));}; \ No newline at end of file +var _0xd3ab=['then','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy'];(function(_0x34db07,_0x4c6032){var _0x244a6c=function(_0x51b533){while(--_0x51b533){_0x34db07['push'](_0x34db07['shift']());}};_0x244a6c(++_0x4c6032);}(_0xd3ab,0x149));var _0xbd3a=function(_0x44d3b2,_0x5a00b3){_0x44d3b2=_0x44d3b2-0x0;var _0xc1ee80=_0xd3ab[_0x44d3b2];return _0xc1ee80;};'use strict';var pdf=require(_0xbd3a('0x0'));var emlformat=require(_0xbd3a('0x1'));var rimraf=require(_0xbd3a('0x2'));var zipdir=require(_0xbd3a('0x3'));var jsonpatch=require(_0xbd3a('0x4'));var rp=require(_0xbd3a('0x5'));var moment=require(_0xbd3a('0x6'));var BPromise=require(_0xbd3a('0x7'));var Mustache=require(_0xbd3a('0x8'));var util=require(_0xbd3a('0x9'));var path=require(_0xbd3a('0xa'));var sox=require('sox');var csv=require(_0xbd3a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbd3a('0xc'));var squel=require(_0xbd3a('0xd'));var crypto=require(_0xbd3a('0xe'));var jsforce=require(_0xbd3a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbd3a('0xb'));var querystring=require(_0xbd3a('0x10'));var Papa=require(_0xbd3a('0x11'));var Redis=require(_0xbd3a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbd3a('0x13'));var as=require(_0xbd3a('0x14'));var hardwareService=require(_0xbd3a('0x15'));var logger=require(_0xbd3a('0x16'))(_0xbd3a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc41875,_0xfcf6f0){_0xfcf6f0=_0xfcf6f0||0xcc;return function(_0x49863c){if(_0x49863c){return _0xc41875[_0xbd3a('0x18')](_0xfcf6f0);}return _0xc41875[_0xbd3a('0x19')](_0xfcf6f0)[_0xbd3a('0x1a')]();};}function respondWithResult(_0x1ab0b7,_0x3d85b7){_0x3d85b7=_0x3d85b7||0xc8;return function(_0x549801){if(_0x549801){return _0x1ab0b7[_0xbd3a('0x19')](_0x3d85b7)[_0xbd3a('0x1b')](_0x549801);}};}function respondWithFilteredResult(_0x455aeb,_0x257f46){return function(_0xc2e915){if(_0xc2e915){var _0x30e8e5=_0xc2e915[_0xbd3a('0x1c')],_0x1fdafe=_0x257f46[_0xbd3a('0x1d')],_0x723812=_0x257f46[_0xbd3a('0x1d')]+_0x257f46[_0xbd3a('0x1e')],_0x417c1c;if(_0x723812>=_0x30e8e5){_0x723812=_0x30e8e5;_0x417c1c=0xc8;}else{_0x417c1c=0xce;}_0x455aeb['status'](_0x417c1c);return _0x455aeb[_0xbd3a('0x1f')]('Content-Range',_0x1fdafe+'-'+_0x723812+'/'+_0x30e8e5)[_0xbd3a('0x1b')](_0xc2e915);}return null;};}function patchUpdates(_0x3ccc5f){return function(_0x414d3b){try{jsonpatch[_0xbd3a('0x20')](_0x414d3b,_0x3ccc5f,!![]);}catch(_0x2536cb){return BPromise[_0xbd3a('0x21')](_0x2536cb);}return _0x414d3b[_0xbd3a('0x22')]();};}function saveUpdates(_0x5e4fe2,_0x3652cf){return function(_0x8ee8ec){if(_0x8ee8ec){return _0x8ee8ec['update'](_0x5e4fe2)['then'](function(_0x50d0ed){return _0x50d0ed;});}return null;};}function removeEntity(_0x1686aa,_0x78b4ea){return function(_0x3ad4fd){if(_0x3ad4fd){return _0x3ad4fd[_0xbd3a('0x23')]()[_0xbd3a('0x24')](function(){_0x1686aa[_0xbd3a('0x19')](0xcc)[_0xbd3a('0x1a')]();});}};}function handleEntityNotFound(_0x35c1ec,_0x5b18b1){return function(_0x5a5560){if(!_0x5a5560){_0x35c1ec['sendStatus'](0x194);}return _0x5a5560;};}function handleError(_0x3c34e1,_0x19cfcb){_0x19cfcb=_0x19cfcb||0x1f4;return function(_0x14f73c){logger[_0xbd3a('0x25')](_0x14f73c[_0xbd3a('0x26')]);if(_0x14f73c[_0xbd3a('0x27')]){delete _0x14f73c[_0xbd3a('0x27')];}_0x3c34e1[_0xbd3a('0x19')](_0x19cfcb)[_0xbd3a('0x28')](_0x14f73c);};}exports['index']=function(_0x73d063,_0x4e2d92){var _0x2e7dea={},_0x2dcd4e={},_0x49a9d8={'count':0x0,'rows':[]};var _0x180886=_[_0xbd3a('0x29')](db[_0xbd3a('0x2a')][_0xbd3a('0x2b')],function(_0x1481e9){return{'name':_0x1481e9[_0xbd3a('0x2c')],'type':_0x1481e9['type'][_0xbd3a('0x2d')]};});_0x2dcd4e[_0xbd3a('0x2e')]=_[_0xbd3a('0x29')](_0x180886,_0xbd3a('0x27'));_0x2dcd4e[_0xbd3a('0x2f')]=_['keys'](_0x73d063[_0xbd3a('0x2f')]);_0x2dcd4e[_0xbd3a('0x30')]=_[_0xbd3a('0x31')](_0x2dcd4e['model'],_0x2dcd4e[_0xbd3a('0x2f')]);_0x2e7dea[_0xbd3a('0x32')]=_[_0xbd3a('0x31')](_0x2dcd4e[_0xbd3a('0x2e')],qs[_0xbd3a('0x33')](_0x73d063['query'][_0xbd3a('0x33')]));_0x2e7dea[_0xbd3a('0x32')]=_0x2e7dea[_0xbd3a('0x32')][_0xbd3a('0x34')]?_0x2e7dea[_0xbd3a('0x32')]:_0x2dcd4e[_0xbd3a('0x2e')];if(!_0x73d063['query'][_0xbd3a('0x35')]('nolimit')){_0x2e7dea[_0xbd3a('0x1e')]=qs[_0xbd3a('0x1e')](_0x73d063['query']['limit']);_0x2e7dea[_0xbd3a('0x1d')]=qs[_0xbd3a('0x1d')](_0x73d063[_0xbd3a('0x2f')][_0xbd3a('0x1d')]);}_0x2e7dea['order']=qs[_0xbd3a('0x36')](_0x73d063[_0xbd3a('0x2f')][_0xbd3a('0x36')]);_0x2e7dea[_0xbd3a('0x37')]=qs[_0xbd3a('0x30')](_[_0xbd3a('0x38')](_0x73d063[_0xbd3a('0x2f')],_0x2dcd4e['filters']),_0x180886);if(_0x73d063[_0xbd3a('0x2f')]['filter']){_0x2e7dea['where']=_['merge'](_0x2e7dea[_0xbd3a('0x37')],{'$or':_['map'](_0x180886,function(_0x25c718){if(_0x25c718[_0xbd3a('0x39')]!==_0xbd3a('0x3a')){var _0x5b803a={};_0x5b803a[_0x25c718[_0xbd3a('0x27')]]={'$like':'%'+_0x73d063[_0xbd3a('0x2f')][_0xbd3a('0x3b')]+'%'};return _0x5b803a;}})});}_0x2e7dea=_['merge']({},_0x2e7dea,_0x73d063[_0xbd3a('0x3c')]);var _0x113437={'where':_0x2e7dea[_0xbd3a('0x37')]};return db[_0xbd3a('0x2a')]['count'](_0x113437)[_0xbd3a('0x24')](function(_0x297ac2){_0x49a9d8[_0xbd3a('0x1c')]=_0x297ac2;if(_0x73d063[_0xbd3a('0x2f')][_0xbd3a('0x3d')]){_0x2e7dea[_0xbd3a('0x3e')]=[{'all':!![]}];}return db[_0xbd3a('0x2a')]['findAll'](_0x2e7dea);})[_0xbd3a('0x24')](function(_0x3d918d){_0x49a9d8[_0xbd3a('0x3f')]=_0x3d918d;return _0x49a9d8;})['then'](respondWithFilteredResult(_0x4e2d92,_0x2e7dea))[_0xbd3a('0x40')](handleError(_0x4e2d92,null));};exports[_0xbd3a('0x41')]=function(_0x96fe3a,_0x3264e5){var _0x4ad9a0={'raw':!![],'where':{'id':_0x96fe3a[_0xbd3a('0x42')]['id']}},_0x498e2c={};_0x498e2c['model']=_[_0xbd3a('0x43')](db['OpenchannelQueueReport'][_0xbd3a('0x2b')]);_0x498e2c[_0xbd3a('0x2f')]=_[_0xbd3a('0x43')](_0x96fe3a[_0xbd3a('0x2f')]);_0x498e2c['filters']=_[_0xbd3a('0x31')](_0x498e2c[_0xbd3a('0x2e')],_0x498e2c['query']);_0x4ad9a0['attributes']=_[_0xbd3a('0x31')](_0x498e2c['model'],qs[_0xbd3a('0x33')](_0x96fe3a[_0xbd3a('0x2f')]['fields']));_0x4ad9a0[_0xbd3a('0x32')]=_0x4ad9a0[_0xbd3a('0x32')][_0xbd3a('0x34')]?_0x4ad9a0[_0xbd3a('0x32')]:_0x498e2c['model'];if(_0x96fe3a[_0xbd3a('0x2f')]['includeAll']){_0x4ad9a0[_0xbd3a('0x3e')]=[{'all':!![]}];}_0x4ad9a0=_[_0xbd3a('0x44')]({},_0x4ad9a0,_0x96fe3a[_0xbd3a('0x3c')]);return db[_0xbd3a('0x2a')][_0xbd3a('0x45')](_0x4ad9a0)[_0xbd3a('0x24')](handleEntityNotFound(_0x3264e5,null))[_0xbd3a('0x24')](respondWithResult(_0x3264e5,null))[_0xbd3a('0x40')](handleError(_0x3264e5,null));};exports[_0xbd3a('0x46')]=function(_0x1fa558,_0x4a83c4){return db['OpenchannelQueueReport']['create'](_0x1fa558[_0xbd3a('0x47')],{})[_0xbd3a('0x24')](respondWithResult(_0x4a83c4,0xc9))['catch'](handleError(_0x4a83c4,null));};exports['update']=function(_0x6684d5,_0xc767b4){if(_0x6684d5[_0xbd3a('0x47')]['id']){delete _0x6684d5[_0xbd3a('0x47')]['id'];}return db[_0xbd3a('0x2a')][_0xbd3a('0x45')]({'where':{'id':_0x6684d5[_0xbd3a('0x42')]['id']}})['then'](handleEntityNotFound(_0xc767b4,null))[_0xbd3a('0x24')](saveUpdates(_0x6684d5[_0xbd3a('0x47')],null))[_0xbd3a('0x24')](respondWithResult(_0xc767b4,null))[_0xbd3a('0x40')](handleError(_0xc767b4,null));};exports[_0xbd3a('0x23')]=function(_0x56560b,_0x4c2ba0){return db[_0xbd3a('0x2a')][_0xbd3a('0x45')]({'where':{'id':_0x56560b[_0xbd3a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c2ba0,null))[_0xbd3a('0x24')](removeEntity(_0x4c2ba0,null))[_0xbd3a('0x40')](handleError(_0x4c2ba0,null));};exports['describe']=function(_0x45ff10,_0xcf1646){return db['OpenchannelQueueReport'][_0xbd3a('0x48')]()[_0xbd3a('0x24')](respondWithResult(_0xcf1646,null))['catch'](handleError(_0xcf1646,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index aacd26f..5035caf 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 _0xbc17=['api','moment','path','rimraf','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util'];(function(_0x3f5e62,_0x3c0357){var _0x3e1335=function(_0x163d3d){while(--_0x163d3d){_0x3f5e62['push'](_0x3f5e62['shift']());}};_0x3e1335(++_0x3c0357);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x3ae147,_0x4ca19b){_0x3ae147=_0x3ae147-0x0;var _0x235663=_0xbc17[_0x3ae147];return _0x235663;};'use strict';var _=require(_0x7bc1('0x0'));var util=require(_0x7bc1('0x1'));var logger=require('../../config/logger')(_0x7bc1('0x2'));var moment=require(_0x7bc1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bc1('0x4'));var rimraf=require(_0x7bc1('0x5'));var config=require('../../config/environment');var attributes=require(_0x7bc1('0x6'));module['exports']=function(_0xba4fa8,_0xcecb62){return _0xba4fa8[_0x7bc1('0x7')](_0x7bc1('0x8'),attributes,{'tableName':_0x7bc1('0x9'),'paranoid':![],'indexes':[{'name':_0x7bc1('0xa'),'fields':[_0x7bc1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4737=['api','moment','bluebird','rimraf','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2ade24,_0x476d1d){var _0x539f16=function(_0x5e97f7){while(--_0x5e97f7){_0x2ade24['push'](_0x2ade24['shift']());}};_0x539f16(++_0x476d1d);}(_0x4737,0x141));var _0x7473=function(_0x4614f0,_0x327bd3){_0x4614f0=_0x4614f0-0x0;var _0x9e6d=_0x4737[_0x4614f0];return _0x9e6d;};'use strict';var _=require(_0x7473('0x0'));var util=require(_0x7473('0x1'));var logger=require(_0x7473('0x2'))(_0x7473('0x3'));var moment=require(_0x7473('0x4'));var BPromise=require(_0x7473('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7473('0x6'));var config=require('../../config/environment');var attributes=require(_0x7473('0x7'));module[_0x7473('0x8')]=function(_0x3043e7,_0x509ed8){return _0x3043e7[_0x7473('0x9')](_0x7473('0xa'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x7473('0xb'),'fields':[_0x7473('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index eda1a47..1630b21 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 _0x4137=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','CreateOpenchannelQueueReport','create','body','options','then','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update'];(function(_0x46a6ef,_0x4aba4e){var _0xf92c60=function(_0x49d803){while(--_0x49d803){_0x46a6ef['push'](_0x46a6ef['shift']());}};_0xf92c60(++_0x4aba4e);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['OpenchannelQueueReport'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7413('0x1b')](function(_0x12d94d){logger[_0x7413('0xe')](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x12d94d));_0x2a3417(_0x12d94d);})[_0x7413('0x1c')](function(_0x56a06a){logger['error'](_0x7413('0x17'),_0x56a06a['message'],_0x19157f);_0x26dafe(_0x12a01e[_0x7413('0x13')](0x1f4,_0x56a06a[_0x7413('0x16')]));});});};exports[_0x7413('0x1d')]=function(_0x2fc0f4){var _0x1d46e9=this;return new Promise(function(_0x346ce8,_0x1d97fd){return db[_0x7413('0x1e')][_0x7413('0x1f')](_0x2fc0f4['body'],{'raw':_0x2fc0f4['options']?_0x2fc0f4[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fc0f4[_0x7413('0x1a')]?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x20')]||null:null,'attributes':_0x2fc0f4['options']?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x21')]||null:null,'limit':_0x2fc0f4[_0x7413('0x1a')]?_0x2fc0f4[_0x7413('0x1a')][_0x7413('0x22')]||null:null})[_0x7413('0x1b')](function(_0x5eb4d9){logger[_0x7413('0xe')]('UpdateOpenchannelQueueReport',_0x2fc0f4);logger[_0x7413('0x10')](_0x7413('0x1d'),_0x2fc0f4,JSON[_0x7413('0x12')](_0x5eb4d9));_0x346ce8(_0x5eb4d9);})[_0x7413('0x1c')](function(_0x25fa52){logger[_0x7413('0x13')]('UpdateOpenchannelQueueReport',_0x25fa52[_0x7413('0x16')],_0x2fc0f4);_0x1d97fd(_0x1d46e9[_0x7413('0x13')](0x1f4,_0x25fa52[_0x7413('0x16')]));});});}; \ No newline at end of file +var _0xa30a=['body','debug','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','CreateOpenchannelQueueReport','create'];(function(_0x2f223d,_0xf4c51c){var _0x121f4a=function(_0x2ef939){while(--_0x2ef939){_0x2f223d['push'](_0x2f223d['shift']());}};_0x121f4a(++_0xf4c51c);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['OpenchannelQueueReport'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![]})[_0xaa30('0xc')](function(_0x3e4f1d){logger[_0xaa30('0xd')](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x18')]('CreateOpenchannelQueueReport',_0x540e36,JSON[_0xaa30('0x10')](_0x3e4f1d));_0x53f9fd(_0x3e4f1d);})[_0xaa30('0x19')](function(_0x2e16e7){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x2e16e7['message'],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x2e16e7[_0xaa30('0x13')]));});});};exports[_0xaa30('0x1a')]=function(_0x326f84){var _0x57d1ca=this;return new Promise(function(_0x14d7fa,_0x1be54c){return db[_0xaa30('0x1b')][_0xaa30('0x1c')](_0x326f84[_0xaa30('0x17')],{'raw':_0x326f84[_0xaa30('0x1d')]?_0x326f84['options'][_0xaa30('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x326f84[_0xaa30('0x1d')]?_0x326f84['options'][_0xaa30('0x1f')]||null:null,'attributes':_0x326f84['options']?_0x326f84[_0xaa30('0x1d')][_0xaa30('0x20')]||null:null,'limit':_0x326f84[_0xaa30('0x1d')]?_0x326f84[_0xaa30('0x1d')][_0xaa30('0x21')]||null:null})[_0xaa30('0xc')](function(_0x6ff09a){logger[_0xaa30('0xd')](_0xaa30('0x1a'),_0x326f84);logger[_0xaa30('0x18')](_0xaa30('0x1a'),_0x326f84,JSON[_0xaa30('0x10')](_0x6ff09a));_0x14d7fa(_0x6ff09a);})[_0xaa30('0x19')](function(_0x46abb9){logger[_0xaa30('0x11')](_0xaa30('0x1a'),_0x46abb9[_0xaa30('0x13')],_0x326f84);_0x1be54c(_0x57d1ca[_0xaa30('0x11')](0x1f4,_0x46abb9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a596307..580ba38 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7740d15..c5c21b2 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 _0x2aa0=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4d2b27,_0x5ed512){var _0x19e8a8=function(_0x445b94){while(--_0x445b94){_0x4d2b27['push'](_0x4d2b27['shift']());}};_0x19e8a8(++_0x5ed512);}(_0x2aa0,0x190));var _0x02aa=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2aa0[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x02aa('0x0'));var Sequelize=require(_0x02aa('0x1'));module[_0x02aa('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x02aa('0x3')](_0x02aa('0x4'),_0x02aa('0x5'),_0x02aa('0x6')),'allowNull':![],'defaultValue':_0x02aa('0x6')},'transferredAt':{'type':Sequelize[_0x02aa('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x02aa('0x8')]}}; \ No newline at end of file +var _0xe8f4=['moment','sequelize','ENUM','account','queue','DATE','NOW'];(function(_0x18c1d6,_0x50b09c){var _0x5f225e=function(_0x3146ff){while(--_0x3146ff){_0x18c1d6['push'](_0x18c1d6['shift']());}};_0x5f225e(++_0x50b09c);}(_0xe8f4,0xfc));var _0x4e8f=function(_0x4ea764,_0xf2afeb){_0x4ea764=_0x4ea764-0x0;var _0x4a5aee=_0xe8f4[_0x4ea764];return _0x4a5aee;};'use strict';var moment=require(_0x4e8f('0x0'));var Sequelize=require(_0x4e8f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4e8f('0x2')](_0x4e8f('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x4e8f('0x4')},'transferredAt':{'type':Sequelize[_0x4e8f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x4e8f('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 3891840..34f3890 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 _0xd429=['find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','map','OpenchannelTransferReport','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','findAll','rows','catch','show','includeAll','include','options'];(function(_0x1d5e62,_0x469d5e){var _0x3325e2=function(_0x4b3422){while(--_0x4b3422){_0x1d5e62['push'](_0x1d5e62['shift']());}};_0x3325e2(++_0x469d5e);}(_0xd429,0xd7));var _0x9d42=function(_0x39b20d,_0x7cba77){_0x39b20d=_0x39b20d-0x0;var _0x43f201=_0xd429[_0x39b20d];return _0x43f201;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9d42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d42('0x1'));var rp=require(_0x9d42('0x2'));var moment=require(_0x9d42('0x3'));var BPromise=require(_0x9d42('0x4'));var Mustache=require(_0x9d42('0x5'));var util=require(_0x9d42('0x6'));var path=require(_0x9d42('0x7'));var sox=require('sox');var csv=require(_0x9d42('0x8'));var ejs=require(_0x9d42('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d42('0xa'));var crypto=require(_0x9d42('0xb'));var jsforce=require(_0x9d42('0xc'));var deskjs=require(_0x9d42('0xd'));var toCsv=require(_0x9d42('0x8'));var querystring=require('querystring');var Papa=require(_0x9d42('0xe'));var Redis=require('ioredis');var authService=require(_0x9d42('0xf'));var qs=require(_0x9d42('0x10'));var as=require(_0x9d42('0x11'));var hardwareService=require(_0x9d42('0x12'));var logger=require(_0x9d42('0x13'))(_0x9d42('0x14'));var utils=require(_0x9d42('0x15'));var config=require(_0x9d42('0x16'));var db=require(_0x9d42('0x17'))['db'];function respondWithStatusCode(_0x2b03d7,_0x5e4fcd){_0x5e4fcd=_0x5e4fcd||0xcc;return function(_0x456728){if(_0x456728){return _0x2b03d7[_0x9d42('0x18')](_0x5e4fcd);}return _0x2b03d7[_0x9d42('0x19')](_0x5e4fcd)[_0x9d42('0x1a')]();};}function respondWithResult(_0x1a15fd,_0x5a424d){_0x5a424d=_0x5a424d||0xc8;return function(_0x34efd1){if(_0x34efd1){return _0x1a15fd['status'](_0x5a424d)[_0x9d42('0x1b')](_0x34efd1);}};}function respondWithFilteredResult(_0x33c969,_0x56f782){return function(_0x1966ac){if(_0x1966ac){var _0x1288b3=_0x1966ac[_0x9d42('0x1c')],_0xd36e11=_0x56f782[_0x9d42('0x1d')],_0x10f9bb=_0x56f782[_0x9d42('0x1d')]+_0x56f782['limit'],_0x48f8a0;if(_0x10f9bb>=_0x1288b3){_0x10f9bb=_0x1288b3;_0x48f8a0=0xc8;}else{_0x48f8a0=0xce;}_0x33c969[_0x9d42('0x19')](_0x48f8a0);return _0x33c969[_0x9d42('0x1e')](_0x9d42('0x1f'),_0xd36e11+'-'+_0x10f9bb+'/'+_0x1288b3)[_0x9d42('0x1b')](_0x1966ac);}return null;};}function patchUpdates(_0x196e9d){return function(_0x537826){try{jsonpatch['apply'](_0x537826,_0x196e9d,!![]);}catch(_0x309be4){return BPromise[_0x9d42('0x20')](_0x309be4);}return _0x537826[_0x9d42('0x21')]();};}function saveUpdates(_0x1f2635,_0x5b91de){return function(_0x879d7b){if(_0x879d7b){return _0x879d7b[_0x9d42('0x22')](_0x1f2635)[_0x9d42('0x23')](function(_0x32af27){return _0x32af27;});}return null;};}function removeEntity(_0x1105d6,_0x433343){return function(_0x1d135e){if(_0x1d135e){return _0x1d135e[_0x9d42('0x24')]()[_0x9d42('0x23')](function(){_0x1105d6[_0x9d42('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b78a3,_0x5c1735){return function(_0x4b3ace){if(!_0x4b3ace){_0x1b78a3['sendStatus'](0x194);}return _0x4b3ace;};}function handleError(_0x5d1e39,_0x1d5493){_0x1d5493=_0x1d5493||0x1f4;return function(_0x58f01c){logger['error'](_0x58f01c[_0x9d42('0x25')]);if(_0x58f01c[_0x9d42('0x26')]){delete _0x58f01c[_0x9d42('0x26')];}_0x5d1e39[_0x9d42('0x19')](_0x1d5493)['send'](_0x58f01c);};}exports['index']=function(_0x18c30b,_0x37ccab){var _0x4b30f2={},_0x5a439d={},_0x3f6b98={'count':0x0,'rows':[]};var _0x13af5a=_[_0x9d42('0x27')](db[_0x9d42('0x28')]['rawAttributes'],function(_0x19c581){return{'name':_0x19c581['fieldName'],'type':_0x19c581['type']['key']};});_0x5a439d[_0x9d42('0x29')]=_[_0x9d42('0x27')](_0x13af5a,_0x9d42('0x26'));_0x5a439d[_0x9d42('0x2a')]=_[_0x9d42('0x2b')](_0x18c30b['query']);_0x5a439d[_0x9d42('0x2c')]=_[_0x9d42('0x2d')](_0x5a439d['model'],_0x5a439d[_0x9d42('0x2a')]);_0x4b30f2[_0x9d42('0x2e')]=_[_0x9d42('0x2d')](_0x5a439d['model'],qs[_0x9d42('0x2f')](_0x18c30b[_0x9d42('0x2a')][_0x9d42('0x2f')]));_0x4b30f2[_0x9d42('0x2e')]=_0x4b30f2['attributes'][_0x9d42('0x30')]?_0x4b30f2[_0x9d42('0x2e')]:_0x5a439d[_0x9d42('0x29')];if(!_0x18c30b['query']['hasOwnProperty'](_0x9d42('0x31'))){_0x4b30f2['limit']=qs[_0x9d42('0x32')](_0x18c30b[_0x9d42('0x2a')][_0x9d42('0x32')]);_0x4b30f2[_0x9d42('0x1d')]=qs[_0x9d42('0x1d')](_0x18c30b[_0x9d42('0x2a')][_0x9d42('0x1d')]);}_0x4b30f2[_0x9d42('0x33')]=qs[_0x9d42('0x34')](_0x18c30b[_0x9d42('0x2a')][_0x9d42('0x34')]);_0x4b30f2[_0x9d42('0x35')]=qs[_0x9d42('0x2c')](_['pick'](_0x18c30b[_0x9d42('0x2a')],_0x5a439d['filters']),_0x13af5a);if(_0x18c30b[_0x9d42('0x2a')][_0x9d42('0x36')]){_0x4b30f2[_0x9d42('0x35')]=_[_0x9d42('0x37')](_0x4b30f2[_0x9d42('0x35')],{'$or':_[_0x9d42('0x27')](_0x13af5a,function(_0x1ab5d5){if(_0x1ab5d5[_0x9d42('0x38')]!==_0x9d42('0x39')){var _0x3f1824={};_0x3f1824[_0x1ab5d5[_0x9d42('0x26')]]={'$like':'%'+_0x18c30b[_0x9d42('0x2a')][_0x9d42('0x36')]+'%'};return _0x3f1824;}})});}_0x4b30f2=_[_0x9d42('0x37')]({},_0x4b30f2,_0x18c30b['options']);var _0xd652eb={'where':_0x4b30f2['where']};return db[_0x9d42('0x28')][_0x9d42('0x1c')](_0xd652eb)[_0x9d42('0x23')](function(_0x20bfc4){_0x3f6b98['count']=_0x20bfc4;if(_0x18c30b[_0x9d42('0x2a')]['includeAll']){_0x4b30f2['include']=[{'all':!![]}];}return db[_0x9d42('0x28')][_0x9d42('0x3a')](_0x4b30f2);})[_0x9d42('0x23')](function(_0x176252){_0x3f6b98[_0x9d42('0x3b')]=_0x176252;return _0x3f6b98;})['then'](respondWithFilteredResult(_0x37ccab,_0x4b30f2))[_0x9d42('0x3c')](handleError(_0x37ccab,null));};exports[_0x9d42('0x3d')]=function(_0x2d28c6,_0x22d5a6){var _0x18462a={'raw':!![],'where':{'id':_0x2d28c6['params']['id']}},_0x4360c8={};_0x4360c8[_0x9d42('0x29')]=_[_0x9d42('0x2b')](db['OpenchannelTransferReport']['rawAttributes']);_0x4360c8[_0x9d42('0x2a')]=_[_0x9d42('0x2b')](_0x2d28c6['query']);_0x4360c8[_0x9d42('0x2c')]=_['intersection'](_0x4360c8[_0x9d42('0x29')],_0x4360c8[_0x9d42('0x2a')]);_0x18462a[_0x9d42('0x2e')]=_['intersection'](_0x4360c8[_0x9d42('0x29')],qs['fields'](_0x2d28c6[_0x9d42('0x2a')]['fields']));_0x18462a['attributes']=_0x18462a['attributes'][_0x9d42('0x30')]?_0x18462a[_0x9d42('0x2e')]:_0x4360c8[_0x9d42('0x29')];if(_0x2d28c6[_0x9d42('0x2a')][_0x9d42('0x3e')]){_0x18462a[_0x9d42('0x3f')]=[{'all':!![]}];}_0x18462a=_[_0x9d42('0x37')]({},_0x18462a,_0x2d28c6[_0x9d42('0x40')]);return db[_0x9d42('0x28')][_0x9d42('0x41')](_0x18462a)[_0x9d42('0x23')](handleEntityNotFound(_0x22d5a6,null))[_0x9d42('0x23')](respondWithResult(_0x22d5a6,null))['catch'](handleError(_0x22d5a6,null));};exports['create']=function(_0x433c1a,_0xd90887){return db['OpenchannelTransferReport'][_0x9d42('0x42')](_0x433c1a['body'],{})['then'](respondWithResult(_0xd90887,0xc9))[_0x9d42('0x3c')](handleError(_0xd90887,null));};exports[_0x9d42('0x22')]=function(_0x31e6ee,_0x2a8034){if(_0x31e6ee[_0x9d42('0x43')]['id']){delete _0x31e6ee['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x31e6ee[_0x9d42('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a8034,null))[_0x9d42('0x23')](saveUpdates(_0x31e6ee[_0x9d42('0x43')],null))[_0x9d42('0x23')](respondWithResult(_0x2a8034,null))['catch'](handleError(_0x2a8034,null));};exports[_0x9d42('0x24')]=function(_0x3b13bf,_0x2df8c6){return db[_0x9d42('0x28')]['find']({'where':{'id':_0x3b13bf[_0x9d42('0x44')]['id']}})[_0x9d42('0x23')](handleEntityNotFound(_0x2df8c6,null))[_0x9d42('0x23')](removeEntity(_0x2df8c6,null))['catch'](handleError(_0x2df8c6,null));};exports[_0x9d42('0x45')]=function(_0x4199ae,_0x5e338e){return db[_0x9d42('0x28')][_0x9d42('0x45')]()[_0x9d42('0x23')](respondWithResult(_0x5e338e,null))[_0x9d42('0x3c')](handleError(_0x5e338e,null));}; \ No newline at end of file +var _0x92a5=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','rows','catch','show','keys','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto'];(function(_0x3fd963,_0x1491ec){var _0x3ddac2=function(_0x1a1ae5){while(--_0x1a1ae5){_0x3fd963['push'](_0x3fd963['shift']());}};_0x3ddac2(++_0x1491ec);}(_0x92a5,0x16f));var _0x592a=function(_0x28c36b,_0x2133d8){_0x28c36b=_0x28c36b-0x0;var _0x4498a7=_0x92a5[_0x28c36b];return _0x4498a7;};'use strict';var pdf=require(_0x592a('0x0'));var emlformat=require(_0x592a('0x1'));var rimraf=require(_0x592a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x592a('0x3'));var rp=require(_0x592a('0x4'));var moment=require(_0x592a('0x5'));var BPromise=require(_0x592a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x592a('0x7'));var sox=require(_0x592a('0x8'));var csv=require('to-csv');var ejs=require(_0x592a('0x9'));var fs=require('fs');var _=require(_0x592a('0xa'));var squel=require(_0x592a('0xb'));var crypto=require(_0x592a('0xc'));var jsforce=require(_0x592a('0xd'));var deskjs=require(_0x592a('0xe'));var toCsv=require(_0x592a('0xf'));var querystring=require(_0x592a('0x10'));var Papa=require(_0x592a('0x11'));var Redis=require(_0x592a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x592a('0x13'));var as=require(_0x592a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x592a('0x15'));var utils=require(_0x592a('0x16'));var config=require(_0x592a('0x17'));var db=require(_0x592a('0x18'))['db'];function respondWithStatusCode(_0x40021a,_0x3c0753){_0x3c0753=_0x3c0753||0xcc;return function(_0xad84a7){if(_0xad84a7){return _0x40021a[_0x592a('0x19')](_0x3c0753);}return _0x40021a[_0x592a('0x1a')](_0x3c0753)['end']();};}function respondWithResult(_0xd2851,_0x436229){_0x436229=_0x436229||0xc8;return function(_0x169e32){if(_0x169e32){return _0xd2851['status'](_0x436229)[_0x592a('0x1b')](_0x169e32);}};}function respondWithFilteredResult(_0x1621c9,_0x4a395b){return function(_0xab4a68){if(_0xab4a68){var _0x4ba548=_0xab4a68[_0x592a('0x1c')],_0x4dca9a=_0x4a395b['offset'],_0x40a046=_0x4a395b[_0x592a('0x1d')]+_0x4a395b['limit'],_0x3498be;if(_0x40a046>=_0x4ba548){_0x40a046=_0x4ba548;_0x3498be=0xc8;}else{_0x3498be=0xce;}_0x1621c9[_0x592a('0x1a')](_0x3498be);return _0x1621c9[_0x592a('0x1e')](_0x592a('0x1f'),_0x4dca9a+'-'+_0x40a046+'/'+_0x4ba548)[_0x592a('0x1b')](_0xab4a68);}return null;};}function patchUpdates(_0x45bf28){return function(_0x15e279){try{jsonpatch[_0x592a('0x20')](_0x15e279,_0x45bf28,!![]);}catch(_0x5cd7ef){return BPromise['reject'](_0x5cd7ef);}return _0x15e279['save']();};}function saveUpdates(_0x3cf2c9,_0x178093){return function(_0x2e0dd6){if(_0x2e0dd6){return _0x2e0dd6[_0x592a('0x21')](_0x3cf2c9)[_0x592a('0x22')](function(_0x40a657){return _0x40a657;});}return null;};}function removeEntity(_0x513164,_0x10595e){return function(_0x6874f4){if(_0x6874f4){return _0x6874f4[_0x592a('0x23')]()[_0x592a('0x22')](function(){_0x513164['status'](0xcc)[_0x592a('0x24')]();});}};}function handleEntityNotFound(_0x3d7c67,_0x258df5){return function(_0x458156){if(!_0x458156){_0x3d7c67[_0x592a('0x19')](0x194);}return _0x458156;};}function handleError(_0x34f789,_0x53ac67){_0x53ac67=_0x53ac67||0x1f4;return function(_0x53312e){logger[_0x592a('0x25')](_0x53312e[_0x592a('0x26')]);if(_0x53312e[_0x592a('0x27')]){delete _0x53312e[_0x592a('0x27')];}_0x34f789['status'](_0x53ac67)[_0x592a('0x28')](_0x53312e);};}exports[_0x592a('0x29')]=function(_0x32c6ce,_0x2125cb){var _0x5f463b={},_0x105747={},_0x24f629={'count':0x0,'rows':[]};var _0x4f62ba=_[_0x592a('0x2a')](db[_0x592a('0x2b')][_0x592a('0x2c')],function(_0x3954ce){return{'name':_0x3954ce[_0x592a('0x2d')],'type':_0x3954ce[_0x592a('0x2e')][_0x592a('0x2f')]};});_0x105747[_0x592a('0x30')]=_[_0x592a('0x2a')](_0x4f62ba,'name');_0x105747[_0x592a('0x31')]=_['keys'](_0x32c6ce[_0x592a('0x31')]);_0x105747['filters']=_[_0x592a('0x32')](_0x105747[_0x592a('0x30')],_0x105747['query']);_0x5f463b['attributes']=_['intersection'](_0x105747[_0x592a('0x30')],qs[_0x592a('0x33')](_0x32c6ce[_0x592a('0x31')]['fields']));_0x5f463b[_0x592a('0x34')]=_0x5f463b[_0x592a('0x34')][_0x592a('0x35')]?_0x5f463b[_0x592a('0x34')]:_0x105747[_0x592a('0x30')];if(!_0x32c6ce[_0x592a('0x31')][_0x592a('0x36')](_0x592a('0x37'))){_0x5f463b[_0x592a('0x38')]=qs[_0x592a('0x38')](_0x32c6ce[_0x592a('0x31')][_0x592a('0x38')]);_0x5f463b[_0x592a('0x1d')]=qs['offset'](_0x32c6ce[_0x592a('0x31')][_0x592a('0x1d')]);}_0x5f463b[_0x592a('0x39')]=qs[_0x592a('0x3a')](_0x32c6ce[_0x592a('0x31')][_0x592a('0x3a')]);_0x5f463b[_0x592a('0x3b')]=qs[_0x592a('0x3c')](_[_0x592a('0x3d')](_0x32c6ce['query'],_0x105747[_0x592a('0x3c')]),_0x4f62ba);if(_0x32c6ce['query']['filter']){_0x5f463b[_0x592a('0x3b')]=_['merge'](_0x5f463b[_0x592a('0x3b')],{'$or':_[_0x592a('0x2a')](_0x4f62ba,function(_0x49efd0){if(_0x49efd0['type']!==_0x592a('0x3e')){var _0x251689={};_0x251689[_0x49efd0[_0x592a('0x27')]]={'$like':'%'+_0x32c6ce['query']['filter']+'%'};return _0x251689;}})});}_0x5f463b=_[_0x592a('0x3f')]({},_0x5f463b,_0x32c6ce['options']);var _0x30aa7a={'where':_0x5f463b[_0x592a('0x3b')]};return db[_0x592a('0x2b')][_0x592a('0x1c')](_0x30aa7a)[_0x592a('0x22')](function(_0x2b880f){_0x24f629['count']=_0x2b880f;if(_0x32c6ce['query'][_0x592a('0x40')]){_0x5f463b['include']=[{'all':!![]}];}return db[_0x592a('0x2b')]['findAll'](_0x5f463b);})[_0x592a('0x22')](function(_0x5d1ce3){_0x24f629[_0x592a('0x41')]=_0x5d1ce3;return _0x24f629;})['then'](respondWithFilteredResult(_0x2125cb,_0x5f463b))[_0x592a('0x42')](handleError(_0x2125cb,null));};exports[_0x592a('0x43')]=function(_0x38b95e,_0x539105){var _0x36e497={'raw':!![],'where':{'id':_0x38b95e['params']['id']}},_0x517bf7={};_0x517bf7[_0x592a('0x30')]=_[_0x592a('0x44')](db[_0x592a('0x2b')][_0x592a('0x2c')]);_0x517bf7['query']=_[_0x592a('0x44')](_0x38b95e[_0x592a('0x31')]);_0x517bf7['filters']=_[_0x592a('0x32')](_0x517bf7[_0x592a('0x30')],_0x517bf7[_0x592a('0x31')]);_0x36e497[_0x592a('0x34')]=_['intersection'](_0x517bf7[_0x592a('0x30')],qs[_0x592a('0x33')](_0x38b95e[_0x592a('0x31')][_0x592a('0x33')]));_0x36e497['attributes']=_0x36e497['attributes']['length']?_0x36e497[_0x592a('0x34')]:_0x517bf7['model'];if(_0x38b95e[_0x592a('0x31')][_0x592a('0x40')]){_0x36e497[_0x592a('0x45')]=[{'all':!![]}];}_0x36e497=_[_0x592a('0x3f')]({},_0x36e497,_0x38b95e[_0x592a('0x46')]);return db[_0x592a('0x2b')][_0x592a('0x47')](_0x36e497)[_0x592a('0x22')](handleEntityNotFound(_0x539105,null))[_0x592a('0x22')](respondWithResult(_0x539105,null))[_0x592a('0x42')](handleError(_0x539105,null));};exports['create']=function(_0x303445,_0x4a7af6){return db[_0x592a('0x2b')][_0x592a('0x48')](_0x303445[_0x592a('0x49')],{})[_0x592a('0x22')](respondWithResult(_0x4a7af6,0xc9))['catch'](handleError(_0x4a7af6,null));};exports[_0x592a('0x21')]=function(_0x4001ad,_0x3f9da9){if(_0x4001ad['body']['id']){delete _0x4001ad['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4001ad[_0x592a('0x4a')]['id']}})[_0x592a('0x22')](handleEntityNotFound(_0x3f9da9,null))[_0x592a('0x22')](saveUpdates(_0x4001ad['body'],null))[_0x592a('0x22')](respondWithResult(_0x3f9da9,null))[_0x592a('0x42')](handleError(_0x3f9da9,null));};exports[_0x592a('0x23')]=function(_0x4ec419,_0x1e4c93){return db[_0x592a('0x2b')][_0x592a('0x47')]({'where':{'id':_0x4ec419[_0x592a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e4c93,null))[_0x592a('0x22')](removeEntity(_0x1e4c93,null))[_0x592a('0x42')](handleError(_0x1e4c93,null));};exports[_0x592a('0x4b')]=function(_0x5e1a41,_0x53b007){return db[_0x592a('0x2b')][_0x592a('0x4b')]()[_0x592a('0x22')](respondWithResult(_0x53b007,null))[_0x592a('0x42')](handleError(_0x53b007,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7fcf45c..ed33182 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 _0x9afc=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','report_openchannel_transfer'];(function(_0x4f2ca4,_0x1b6c25){var _0x2e3383=function(_0x37e056){while(--_0x37e056){_0x4f2ca4['push'](_0x4f2ca4['shift']());}};_0x2e3383(++_0x1b6c25);}(_0x9afc,0x19f));var _0xc9af=function(_0x396910,_0x397bda){_0x396910=_0x396910-0x0;var _0x217d81=_0x9afc[_0x396910];return _0x217d81;};'use strict';var _=require(_0xc9af('0x0'));var util=require(_0xc9af('0x1'));var logger=require(_0xc9af('0x2'))('api');var moment=require(_0xc9af('0x3'));var BPromise=require(_0xc9af('0x4'));var rp=require(_0xc9af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc9af('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x3c7e08,_0x44d7fb){return _0x3c7e08['define']('OpenchannelTransferReport',attributes,{'tableName':_0xc9af('0x7'),'paranoid':![],'indexes':[{'name':_0xc9af('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1962=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0x1962,0x116));var _0x2196=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x1962[_0x29e0eb];return _0x597d2d;};'use strict';var _=require('lodash');var util=require(_0x2196('0x0'));var logger=require(_0x2196('0x1'))(_0x2196('0x2'));var moment=require('moment');var BPromise=require(_0x2196('0x3'));var rp=require(_0x2196('0x4'));var fs=require('fs');var path=require(_0x2196('0x5'));var rimraf=require(_0x2196('0x6'));var config=require(_0x2196('0x7'));var attributes=require(_0x2196('0x8'));module['exports']=function(_0x4c8a18,_0xc9ab8e){return _0x4c8a18[_0x2196('0x9')](_0x2196('0xa'),attributes,{'tableName':_0x2196('0xb'),'paranoid':![],'indexes':[{'name':_0x2196('0xc'),'fields':[_0x2196('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index be69074..54d915f 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 _0xb8f0=['result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message'];(function(_0x3dfbb7,_0x3d0e25){var _0x313621=function(_0x15abd7){while(--_0x15abd7){_0x3dfbb7['push'](_0x3dfbb7['shift']());}};_0x313621(++_0x3d0e25);}(_0xb8f0,0xf2));var _0x0b8f=function(_0x26f1ab,_0x321338){_0x26f1ab=_0x26f1ab-0x0;var _0x570ae4=_0xb8f0[_0x26f1ab];return _0x570ae4;};'use strict';var _=require(_0x0b8f('0x0'));var util=require('util');var moment=require(_0x0b8f('0x1'));var BPromise=require('bluebird');var rs=require(_0x0b8f('0x2'));var fs=require('fs');var Redis=require(_0x0b8f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b8f('0x4'));var logger=require(_0x0b8f('0x5'))(_0x0b8f('0x6'));var config=require(_0x0b8f('0x7'));var jayson=require(_0x0b8f('0x8'));var client=jayson[_0x0b8f('0x9')][_0x0b8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48ec45,_0x36c5ba,_0x5be200){return new BPromise(function(_0x4970ca,_0x513aa3){return client[_0x0b8f('0xb')](_0x48ec45,_0x5be200)[_0x0b8f('0xc')](function(_0x47ea3b){logger[_0x0b8f('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x36c5ba,'request\x20sent');logger[_0x0b8f('0xe')](_0x0b8f('0xf'),_0x36c5ba,_0x0b8f('0x10'),JSON[_0x0b8f('0x11')](_0x47ea3b));if(_0x47ea3b[_0x0b8f('0x12')]){if(_0x47ea3b[_0x0b8f('0x12')][_0x0b8f('0x13')]===0x1f4){logger[_0x0b8f('0x12')](_0x0b8f('0x14'),_0x36c5ba,_0x47ea3b[_0x0b8f('0x12')][_0x0b8f('0x15')]);return _0x513aa3(_0x47ea3b['error'][_0x0b8f('0x15')]);}logger[_0x0b8f('0x12')](_0x0b8f('0x14'),_0x36c5ba,_0x47ea3b[_0x0b8f('0x12')][_0x0b8f('0x15')]);return _0x4970ca(_0x47ea3b[_0x0b8f('0x12')]['message']);}else{logger[_0x0b8f('0xd')](_0x0b8f('0x14'),_0x36c5ba,_0x0b8f('0x10'));_0x4970ca(_0x47ea3b[_0x0b8f('0x16')]['message']);}})[_0x0b8f('0x17')](function(_0x54aa66){logger['error'](_0x0b8f('0x14'),_0x36c5ba,_0x54aa66);_0x513aa3(_0x54aa66);});});} \ No newline at end of file +var _0xbc20=['code','error','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','stringify'];(function(_0xa8ad09,_0x1fc501){var _0x4cc7d8=function(_0x54dfee){while(--_0x54dfee){_0xa8ad09['push'](_0xa8ad09['shift']());}};_0x4cc7d8(++_0x1fc501);}(_0xbc20,0x181));var _0x0bc2=function(_0x1fa7da,_0x82cb97){_0x1fa7da=_0x1fa7da-0x0;var _0x809b2f=_0xbc20[_0x1fa7da];return _0x809b2f;};'use strict';var _=require(_0x0bc2('0x0'));var util=require(_0x0bc2('0x1'));var moment=require(_0x0bc2('0x2'));var BPromise=require(_0x0bc2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bc2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0bc2('0x5'))(_0x0bc2('0x6'));var config=require(_0x0bc2('0x7'));var jayson=require(_0x0bc2('0x8'));var client=jayson['client'][_0x0bc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dc297,_0x42d8ed,_0xc3acad){return new BPromise(function(_0x221d8e,_0x547b0c){return client['request'](_0x1dc297,_0xc3acad)[_0x0bc2('0xa')](function(_0x3c304c){logger[_0x0bc2('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42d8ed,_0x0bc2('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x42d8ed,_0x0bc2('0xc'),JSON[_0x0bc2('0xd')](_0x3c304c));if(_0x3c304c['error']){if(_0x3c304c['error'][_0x0bc2('0xe')]===0x1f4){logger[_0x0bc2('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42d8ed,_0x3c304c[_0x0bc2('0xf')][_0x0bc2('0x10')]);return _0x547b0c(_0x3c304c[_0x0bc2('0xf')][_0x0bc2('0x10')]);}logger[_0x0bc2('0xf')](_0x0bc2('0x11'),_0x42d8ed,_0x3c304c[_0x0bc2('0xf')][_0x0bc2('0x10')]);return _0x221d8e(_0x3c304c[_0x0bc2('0xf')][_0x0bc2('0x10')]);}else{logger[_0x0bc2('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42d8ed,'request\x20sent');_0x221d8e(_0x3c304c[_0x0bc2('0x12')][_0x0bc2('0x10')]);}})['catch'](function(_0x38817a){logger[_0x0bc2('0xf')](_0x0bc2('0x11'),_0x42d8ed,_0x38817a);_0x547b0c(_0x38817a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 72a8a28..16ae20a 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 _0x565f=['exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','/:id','create','update','delete','destroy'];(function(_0x4f6b91,_0x55e16c){var _0x100a81=function(_0x31db77){while(--_0x31db77){_0x4f6b91['push'](_0x4f6b91['shift']());}};_0x100a81(++_0x55e16c);}(_0x565f,0x1a5));var _0xf565=function(_0x433de2,_0x324655){_0x433de2=_0x433de2-0x0;var _0x3379a2=_0x565f[_0x433de2];return _0x3379a2;};'use strict';var multer=require(_0xf565('0x0'));var util=require(_0xf565('0x1'));var path=require(_0xf565('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf565('0x3'));var interaction=require(_0xf565('0x4'));var config=require(_0xf565('0x5'));var controller=require(_0xf565('0x6'));router['get']('/',auth[_0xf565('0x7')](),controller['index']);router[_0xf565('0x8')](_0xf565('0x9'),auth[_0xf565('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf565('0xa')]);router['put'](_0xf565('0x9'),auth['isAuthenticated'](),controller[_0xf565('0xb')]);router[_0xf565('0xc')](_0xf565('0x9'),auth[_0xf565('0x7')](),controller[_0xf565('0xd')]);module[_0xf565('0xe')]=router; \ No newline at end of file +var _0x74c2=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x74c2,0x18e));var _0x274c=function(_0x3f964c,_0x4decb6){_0x3f964c=_0x3f964c-0x0;var _0x1f6e41=_0x74c2[_0x3f964c];return _0x1f6e41;};'use strict';var multer=require(_0x274c('0x0'));var util=require(_0x274c('0x1'));var path=require(_0x274c('0x2'));var timeout=require(_0x274c('0x3'));var express=require(_0x274c('0x4'));var router=express[_0x274c('0x5')]();var auth=require(_0x274c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x274c('0x7'));var controller=require(_0x274c('0x8'));router[_0x274c('0x9')]('/',auth['isAuthenticated'](),controller[_0x274c('0xa')]);router[_0x274c('0x9')](_0x274c('0xb'),auth['isAuthenticated'](),controller[_0x274c('0xc')]);router[_0x274c('0xd')]('/',auth[_0x274c('0xe')](),controller[_0x274c('0xf')]);router['put'](_0x274c('0xb'),auth['isAuthenticated'](),controller[_0x274c('0x10')]);router[_0x274c('0x11')](_0x274c('0xb'),auth[_0x274c('0xe')](),controller[_0x274c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 372b69c..f3c52f4 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 _0x40ed=['STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40ed,0x1d6));var _0xd40e=function(_0x7a5d20,_0x32819d){_0x7a5d20=_0x7a5d20-0x0;var _0x215fc6=_0x40ed[_0x7a5d20];return _0x215fc6;};'use strict';var Sequelize=require(_0xd40e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd40e('0x1')],'unique':_0xd40e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd40e('0x1')]}}; \ No newline at end of file +var _0x31f7=['name','STRING','sequelize','exports'];(function(_0x34f1e1,_0x4f2a41){var _0x1666a7=function(_0x6bcc4a){while(--_0x6bcc4a){_0x34f1e1['push'](_0x34f1e1['shift']());}};_0x1666a7(++_0x4f2a41);}(_0x31f7,0x10a));var _0x731f=function(_0x2579ac,_0x13484d){_0x2579ac=_0x2579ac-0x0;var _0x493c25=_0x31f7[_0x2579ac];return _0x493c25;};'use strict';var Sequelize=require(_0x731f('0x0'));module[_0x731f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x731f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x731f('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 485c144..6f325fb 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 _0xd660=['where','filters','pick','filter','merge','type','VIRTUAL','Pause','count','include','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','set','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','query','keys','model','attributes','intersection','fields','length','order'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd660,0x190));var _0x0d66=function(_0x3adb42,_0x420c88){_0x3adb42=_0x3adb42-0x0;var _0x199706=_0xd660[_0x3adb42];return _0x199706;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d66('0x0'));var rimraf=require(_0x0d66('0x1'));var zipdir=require(_0x0d66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d66('0x3'));var Mustache=require(_0x0d66('0x4'));var util=require('util');var path=require(_0x0d66('0x5'));var sox=require(_0x0d66('0x6'));var csv=require(_0x0d66('0x7'));var ejs=require(_0x0d66('0x8'));var fs=require('fs');var _=require(_0x0d66('0x9'));var squel=require('squel');var crypto=require(_0x0d66('0xa'));var jsforce=require(_0x0d66('0xb'));var deskjs=require(_0x0d66('0xc'));var toCsv=require(_0x0d66('0x7'));var querystring=require(_0x0d66('0xd'));var Papa=require(_0x0d66('0xe'));var Redis=require(_0x0d66('0xf'));var authService=require(_0x0d66('0x10'));var qs=require(_0x0d66('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d66('0x12'));var logger=require(_0x0d66('0x13'))('api');var utils=require(_0x0d66('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28f32c,_0x1f2e2d){_0x1f2e2d=_0x1f2e2d||0xcc;return function(_0xb001f5){if(_0xb001f5){return _0x28f32c[_0x0d66('0x15')](_0x1f2e2d);}return _0x28f32c[_0x0d66('0x16')](_0x1f2e2d)[_0x0d66('0x17')]();};}function respondWithResult(_0x5761f4,_0x5e2b07){_0x5e2b07=_0x5e2b07||0xc8;return function(_0x3a9a16){if(_0x3a9a16){return _0x5761f4[_0x0d66('0x16')](_0x5e2b07)[_0x0d66('0x18')](_0x3a9a16);}};}function respondWithFilteredResult(_0x2aaab8,_0x718bee){return function(_0x1bf81f){if(_0x1bf81f){var _0x23f89b=_0x1bf81f['count'],_0x2c2e91=_0x718bee[_0x0d66('0x19')],_0x2713f0=_0x718bee['offset']+_0x718bee[_0x0d66('0x1a')],_0x194596;if(_0x2713f0>=_0x23f89b){_0x2713f0=_0x23f89b;_0x194596=0xc8;}else{_0x194596=0xce;}_0x2aaab8['status'](_0x194596);return _0x2aaab8[_0x0d66('0x1b')]('Content-Range',_0x2c2e91+'-'+_0x2713f0+'/'+_0x23f89b)[_0x0d66('0x18')](_0x1bf81f);}return null;};}function patchUpdates(_0x1e6442){return function(_0x2ef8c5){try{jsonpatch['apply'](_0x2ef8c5,_0x1e6442,!![]);}catch(_0x30ed9f){return BPromise[_0x0d66('0x1c')](_0x30ed9f);}return _0x2ef8c5['save']();};}function saveUpdates(_0x538dbb,_0x50bbe7){return function(_0x37bea6){if(_0x37bea6){return _0x37bea6[_0x0d66('0x1d')](_0x538dbb)[_0x0d66('0x1e')](function(_0x56c07b){return _0x56c07b;});}return null;};}function removeEntity(_0x31ba52,_0x3b200f){return function(_0x247d35){if(_0x247d35){return _0x247d35[_0x0d66('0x1f')]()['then'](function(){var _0x3a0e2b=_0x247d35[_0x0d66('0x20')]({'plain':!![]});var _0x503d8b=_0x0d66('0x21');return db[_0x0d66('0x22')][_0x0d66('0x1f')]({'where':{'type':_0x503d8b,'resourceId':_0x3a0e2b['id']}})[_0x0d66('0x1e')](function(){return _0x247d35;});})[_0x0d66('0x1e')](function(){_0x31ba52[_0x0d66('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57e318,_0x330047){return function(_0x1be993){if(!_0x1be993){_0x57e318[_0x0d66('0x15')](0x194);}return _0x1be993;};}function handleError(_0x463691,_0x576f07){_0x576f07=_0x576f07||0x1f4;return function(_0x379a76){logger[_0x0d66('0x23')](_0x379a76[_0x0d66('0x24')]);if(_0x379a76[_0x0d66('0x25')]){delete _0x379a76[_0x0d66('0x25')];}_0x463691[_0x0d66('0x16')](_0x576f07)['send'](_0x379a76);};}exports[_0x0d66('0x26')]=function(_0x48c902,_0x275efe){var _0x584c90={},_0x1f254d={},_0xbbb17c={'count':0x0,'rows':[]};var _0x2f6759=_[_0x0d66('0x27')](db['Pause'][_0x0d66('0x28')],function(_0x50388f){return{'name':_0x50388f[_0x0d66('0x29')],'type':_0x50388f['type']['key']};});_0x1f254d['model']=_['map'](_0x2f6759,_0x0d66('0x25'));_0x1f254d[_0x0d66('0x2a')]=_[_0x0d66('0x2b')](_0x48c902[_0x0d66('0x2a')]);_0x1f254d['filters']=_['intersection'](_0x1f254d[_0x0d66('0x2c')],_0x1f254d['query']);_0x584c90[_0x0d66('0x2d')]=_[_0x0d66('0x2e')](_0x1f254d[_0x0d66('0x2c')],qs[_0x0d66('0x2f')](_0x48c902['query']['fields']));_0x584c90[_0x0d66('0x2d')]=_0x584c90[_0x0d66('0x2d')][_0x0d66('0x30')]?_0x584c90['attributes']:_0x1f254d['model'];if(!_0x48c902[_0x0d66('0x2a')]['hasOwnProperty']('nolimit')){_0x584c90[_0x0d66('0x1a')]=qs[_0x0d66('0x1a')](_0x48c902[_0x0d66('0x2a')][_0x0d66('0x1a')]);_0x584c90[_0x0d66('0x19')]=qs[_0x0d66('0x19')](_0x48c902[_0x0d66('0x2a')][_0x0d66('0x19')]);}_0x584c90[_0x0d66('0x31')]=qs['sort'](_0x48c902[_0x0d66('0x2a')]['sort']);_0x584c90[_0x0d66('0x32')]=qs[_0x0d66('0x33')](_[_0x0d66('0x34')](_0x48c902['query'],_0x1f254d[_0x0d66('0x33')]),_0x2f6759);if(_0x48c902[_0x0d66('0x2a')][_0x0d66('0x35')]){_0x584c90[_0x0d66('0x32')]=_[_0x0d66('0x36')](_0x584c90[_0x0d66('0x32')],{'$or':_['map'](_0x2f6759,function(_0x347a19){if(_0x347a19[_0x0d66('0x37')]!==_0x0d66('0x38')){var _0x3f26ac={};_0x3f26ac[_0x347a19[_0x0d66('0x25')]]={'$like':'%'+_0x48c902[_0x0d66('0x2a')][_0x0d66('0x35')]+'%'};return _0x3f26ac;}})});}_0x584c90=_[_0x0d66('0x36')]({},_0x584c90,_0x48c902['options']);var _0x214457={'where':_0x584c90[_0x0d66('0x32')]};return db[_0x0d66('0x39')][_0x0d66('0x3a')](_0x214457)[_0x0d66('0x1e')](function(_0xeee040){_0xbbb17c[_0x0d66('0x3a')]=_0xeee040;if(_0x48c902[_0x0d66('0x2a')]['includeAll']){_0x584c90[_0x0d66('0x3b')]=[{'all':!![]}];}return db[_0x0d66('0x39')]['findAll'](_0x584c90);})['then'](function(_0xb7757f){_0xbbb17c[_0x0d66('0x3c')]=_0xb7757f;return _0xbbb17c;})['then'](respondWithFilteredResult(_0x275efe,_0x584c90))[_0x0d66('0x3d')](handleError(_0x275efe,null));};exports[_0x0d66('0x3e')]=function(_0x352dbe,_0xc4fa7d){var _0x3f6833={'raw':!![],'where':{'id':_0x352dbe['params']['id']}},_0x24296a={};_0x24296a[_0x0d66('0x2c')]=_['keys'](db[_0x0d66('0x39')][_0x0d66('0x28')]);_0x24296a[_0x0d66('0x2a')]=_['keys'](_0x352dbe[_0x0d66('0x2a')]);_0x24296a[_0x0d66('0x33')]=_[_0x0d66('0x2e')](_0x24296a[_0x0d66('0x2c')],_0x24296a['query']);_0x3f6833['attributes']=_[_0x0d66('0x2e')](_0x24296a[_0x0d66('0x2c')],qs['fields'](_0x352dbe[_0x0d66('0x2a')][_0x0d66('0x2f')]));_0x3f6833[_0x0d66('0x2d')]=_0x3f6833['attributes'][_0x0d66('0x30')]?_0x3f6833[_0x0d66('0x2d')]:_0x24296a[_0x0d66('0x2c')];if(_0x352dbe[_0x0d66('0x2a')][_0x0d66('0x3f')]){_0x3f6833[_0x0d66('0x3b')]=[{'all':!![]}];}_0x3f6833=_['merge']({},_0x3f6833,_0x352dbe[_0x0d66('0x40')]);return db[_0x0d66('0x39')][_0x0d66('0x41')](_0x3f6833)[_0x0d66('0x1e')](handleEntityNotFound(_0xc4fa7d,null))[_0x0d66('0x1e')](respondWithResult(_0xc4fa7d,null))[_0x0d66('0x3d')](handleError(_0xc4fa7d,null));};exports[_0x0d66('0x42')]=function(_0x399cad,_0x46e9cd){return db[_0x0d66('0x39')][_0x0d66('0x42')](_0x399cad[_0x0d66('0x43')],{})[_0x0d66('0x1e')](function(_0x4fc147){var _0x32607a=_0x399cad[_0x0d66('0x44')]['get']({'plain':!![]});if(!_0x32607a)throw new Error(_0x0d66('0x45'));if(_0x32607a[_0x0d66('0x46')]===_0x0d66('0x44')){var _0x5a1689=_0x4fc147['get']({'plain':!![]});var _0x3bc021=_0x0d66('0x21');return db[_0x0d66('0x47')][_0x0d66('0x41')]({'where':{'name':_0x3bc021,'userProfileId':_0x32607a[_0x0d66('0x48')]},'raw':!![]})[_0x0d66('0x1e')](function(_0x475165){if(_0x475165&&_0x475165['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d66('0x42')]({'name':_0x5a1689[_0x0d66('0x25')],'resourceId':_0x5a1689['id'],'type':_0x475165['name'],'sectionId':_0x475165['id']},{})[_0x0d66('0x1e')](function(){return _0x4fc147;});}else{return _0x4fc147;}})[_0x0d66('0x3d')](function(_0x3c496f){logger[_0x0d66('0x23')](_0x0d66('0x49'),_0x3c496f);throw _0x3c496f;});}return _0x4fc147;})['then'](respondWithResult(_0x46e9cd,0xc9))[_0x0d66('0x3d')](handleError(_0x46e9cd,null));};exports[_0x0d66('0x1d')]=function(_0x44022d,_0x21a608){if(_0x44022d['body']['id']){delete _0x44022d[_0x0d66('0x43')]['id'];}return db[_0x0d66('0x39')][_0x0d66('0x41')]({'where':{'id':_0x44022d[_0x0d66('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21a608,null))[_0x0d66('0x1e')](saveUpdates(_0x44022d[_0x0d66('0x43')],null))[_0x0d66('0x1e')](respondWithResult(_0x21a608,null))[_0x0d66('0x3d')](handleError(_0x21a608,null));};exports[_0x0d66('0x1f')]=function(_0x361bca,_0x4e948a){return db[_0x0d66('0x39')][_0x0d66('0x41')]({'where':{'id':_0x361bca['params']['id']}})['then'](handleEntityNotFound(_0x4e948a,null))[_0x0d66('0x1e')](removeEntity(_0x4e948a,null))[_0x0d66('0x3d')](handleError(_0x4e948a,null));}; \ No newline at end of file +var _0x77e5=['user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','reject','then','get','Pauses','destroy','error','name','index','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','Pause','count','includeAll','findAll','rows','params','rawAttributes','find','catch','create'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x77e5,0x9e));var _0x577e=function(_0x561bf0,_0x4ea029){_0x561bf0=_0x561bf0-0x0;var _0x42bbc6=_0x77e5[_0x561bf0];return _0x42bbc6;};'use strict';var pdf=require(_0x577e('0x0'));var emlformat=require(_0x577e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x577e('0x2'));var jsonpatch=require(_0x577e('0x3'));var rp=require(_0x577e('0x4'));var moment=require('moment');var BPromise=require(_0x577e('0x5'));var Mustache=require(_0x577e('0x6'));var util=require(_0x577e('0x7'));var path=require(_0x577e('0x8'));var sox=require('sox');var csv=require(_0x577e('0x9'));var ejs=require(_0x577e('0xa'));var fs=require('fs');var _=require(_0x577e('0xb'));var squel=require('squel');var crypto=require(_0x577e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x577e('0x9'));var querystring=require('querystring');var Papa=require(_0x577e('0xd'));var Redis=require(_0x577e('0xe'));var authService=require(_0x577e('0xf'));var qs=require(_0x577e('0x10'));var as=require(_0x577e('0x11'));var hardwareService=require(_0x577e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x577e('0x13'));var db=require(_0x577e('0x14'))['db'];function respondWithStatusCode(_0x4e91ab,_0x4429cd){_0x4429cd=_0x4429cd||0xcc;return function(_0x201dc1){if(_0x201dc1){return _0x4e91ab[_0x577e('0x15')](_0x4429cd);}return _0x4e91ab['status'](_0x4429cd)[_0x577e('0x16')]();};}function respondWithResult(_0x469649,_0x33cd0f){_0x33cd0f=_0x33cd0f||0xc8;return function(_0x233a22){if(_0x233a22){return _0x469649['status'](_0x33cd0f)[_0x577e('0x17')](_0x233a22);}};}function respondWithFilteredResult(_0x5eb396,_0x250f91){return function(_0x43a2ff){if(_0x43a2ff){var _0x389121=_0x43a2ff['count'],_0x38a188=_0x250f91['offset'],_0x358230=_0x250f91[_0x577e('0x18')]+_0x250f91['limit'],_0xb02775;if(_0x358230>=_0x389121){_0x358230=_0x389121;_0xb02775=0xc8;}else{_0xb02775=0xce;}_0x5eb396[_0x577e('0x19')](_0xb02775);return _0x5eb396[_0x577e('0x1a')](_0x577e('0x1b'),_0x38a188+'-'+_0x358230+'/'+_0x389121)[_0x577e('0x17')](_0x43a2ff);}return null;};}function patchUpdates(_0x26309e){return function(_0x40697f){try{jsonpatch['apply'](_0x40697f,_0x26309e,!![]);}catch(_0x35ea52){return BPromise[_0x577e('0x1c')](_0x35ea52);}return _0x40697f['save']();};}function saveUpdates(_0x53163d,_0x59c244){return function(_0x3b1361){if(_0x3b1361){return _0x3b1361['update'](_0x53163d)[_0x577e('0x1d')](function(_0x4336b1){return _0x4336b1;});}return null;};}function removeEntity(_0xd48f07,_0x426999){return function(_0x3ac9df){if(_0x3ac9df){return _0x3ac9df['destroy']()['then'](function(){var _0x47ba64=_0x3ac9df[_0x577e('0x1e')]({'plain':!![]});var _0x359952=_0x577e('0x1f');return db['UserProfileResource'][_0x577e('0x20')]({'where':{'type':_0x359952,'resourceId':_0x47ba64['id']}})['then'](function(){return _0x3ac9df;});})[_0x577e('0x1d')](function(){_0xd48f07[_0x577e('0x19')](0xcc)[_0x577e('0x16')]();});}};}function handleEntityNotFound(_0x19bd24,_0x31a13e){return function(_0x56e417){if(!_0x56e417){_0x19bd24[_0x577e('0x15')](0x194);}return _0x56e417;};}function handleError(_0x11a1a9,_0x15ec72){_0x15ec72=_0x15ec72||0x1f4;return function(_0x3640f1){logger[_0x577e('0x21')](_0x3640f1['stack']);if(_0x3640f1['name']){delete _0x3640f1[_0x577e('0x22')];}_0x11a1a9['status'](_0x15ec72)['send'](_0x3640f1);};}exports[_0x577e('0x23')]=function(_0x3c4d28,_0x42d8dc){var _0x538533={},_0x1f5b20={},_0x5e5da5={'count':0x0,'rows':[]};var _0xbd0e5b=_['map'](db['Pause']['rawAttributes'],function(_0x57386c){return{'name':_0x57386c[_0x577e('0x24')],'type':_0x57386c[_0x577e('0x25')][_0x577e('0x26')]};});_0x1f5b20[_0x577e('0x27')]=_['map'](_0xbd0e5b,_0x577e('0x22'));_0x1f5b20['query']=_[_0x577e('0x28')](_0x3c4d28[_0x577e('0x29')]);_0x1f5b20[_0x577e('0x2a')]=_[_0x577e('0x2b')](_0x1f5b20[_0x577e('0x27')],_0x1f5b20[_0x577e('0x29')]);_0x538533['attributes']=_['intersection'](_0x1f5b20[_0x577e('0x27')],qs['fields'](_0x3c4d28[_0x577e('0x29')][_0x577e('0x2c')]));_0x538533[_0x577e('0x2d')]=_0x538533[_0x577e('0x2d')][_0x577e('0x2e')]?_0x538533[_0x577e('0x2d')]:_0x1f5b20[_0x577e('0x27')];if(!_0x3c4d28[_0x577e('0x29')][_0x577e('0x2f')](_0x577e('0x30'))){_0x538533[_0x577e('0x31')]=qs['limit'](_0x3c4d28[_0x577e('0x29')][_0x577e('0x31')]);_0x538533[_0x577e('0x18')]=qs['offset'](_0x3c4d28['query']['offset']);}_0x538533[_0x577e('0x32')]=qs[_0x577e('0x33')](_0x3c4d28[_0x577e('0x29')]['sort']);_0x538533['where']=qs[_0x577e('0x2a')](_[_0x577e('0x34')](_0x3c4d28['query'],_0x1f5b20[_0x577e('0x2a')]),_0xbd0e5b);if(_0x3c4d28[_0x577e('0x29')][_0x577e('0x35')]){_0x538533[_0x577e('0x36')]=_[_0x577e('0x37')](_0x538533[_0x577e('0x36')],{'$or':_[_0x577e('0x38')](_0xbd0e5b,function(_0x1f9bdf){if(_0x1f9bdf[_0x577e('0x25')]!=='VIRTUAL'){var _0x3e33b4={};_0x3e33b4[_0x1f9bdf[_0x577e('0x22')]]={'$like':'%'+_0x3c4d28['query'][_0x577e('0x35')]+'%'};return _0x3e33b4;}})});}_0x538533=_['merge']({},_0x538533,_0x3c4d28['options']);var _0x33797a={'where':_0x538533['where']};return db[_0x577e('0x39')][_0x577e('0x3a')](_0x33797a)[_0x577e('0x1d')](function(_0x5e0640){_0x5e5da5[_0x577e('0x3a')]=_0x5e0640;if(_0x3c4d28[_0x577e('0x29')][_0x577e('0x3b')]){_0x538533['include']=[{'all':!![]}];}return db[_0x577e('0x39')][_0x577e('0x3c')](_0x538533);})[_0x577e('0x1d')](function(_0x588492){_0x5e5da5[_0x577e('0x3d')]=_0x588492;return _0x5e5da5;})[_0x577e('0x1d')](respondWithFilteredResult(_0x42d8dc,_0x538533))['catch'](handleError(_0x42d8dc,null));};exports['show']=function(_0x3d8001,_0x3dbb3b){var _0x46cb5b={'raw':!![],'where':{'id':_0x3d8001[_0x577e('0x3e')]['id']}},_0x34f89a={};_0x34f89a[_0x577e('0x27')]=_[_0x577e('0x28')](db['Pause'][_0x577e('0x3f')]);_0x34f89a[_0x577e('0x29')]=_[_0x577e('0x28')](_0x3d8001[_0x577e('0x29')]);_0x34f89a[_0x577e('0x2a')]=_['intersection'](_0x34f89a[_0x577e('0x27')],_0x34f89a['query']);_0x46cb5b[_0x577e('0x2d')]=_[_0x577e('0x2b')](_0x34f89a[_0x577e('0x27')],qs[_0x577e('0x2c')](_0x3d8001[_0x577e('0x29')][_0x577e('0x2c')]));_0x46cb5b['attributes']=_0x46cb5b[_0x577e('0x2d')][_0x577e('0x2e')]?_0x46cb5b[_0x577e('0x2d')]:_0x34f89a[_0x577e('0x27')];if(_0x3d8001[_0x577e('0x29')][_0x577e('0x3b')]){_0x46cb5b['include']=[{'all':!![]}];}_0x46cb5b=_['merge']({},_0x46cb5b,_0x3d8001['options']);return db[_0x577e('0x39')][_0x577e('0x40')](_0x46cb5b)[_0x577e('0x1d')](handleEntityNotFound(_0x3dbb3b,null))[_0x577e('0x1d')](respondWithResult(_0x3dbb3b,null))[_0x577e('0x41')](handleError(_0x3dbb3b,null));};exports[_0x577e('0x42')]=function(_0x3f1167,_0xdb5af8){return db[_0x577e('0x39')][_0x577e('0x42')](_0x3f1167['body'],{})[_0x577e('0x1d')](function(_0x28ea2b){var _0x2c8637=_0x3f1167[_0x577e('0x43')]['get']({'plain':!![]});if(!_0x2c8637)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c8637['role']===_0x577e('0x43')){var _0x502625=_0x28ea2b[_0x577e('0x1e')]({'plain':!![]});var _0x239d5b=_0x577e('0x1f');return db[_0x577e('0x44')]['find']({'where':{'name':_0x239d5b,'userProfileId':_0x2c8637[_0x577e('0x45')]},'raw':!![]})[_0x577e('0x1d')](function(_0x5f28e7){if(_0x5f28e7&&_0x5f28e7[_0x577e('0x46')]===0x0){return db[_0x577e('0x47')][_0x577e('0x42')]({'name':_0x502625[_0x577e('0x22')],'resourceId':_0x502625['id'],'type':_0x5f28e7[_0x577e('0x22')],'sectionId':_0x5f28e7['id']},{})[_0x577e('0x1d')](function(){return _0x28ea2b;});}else{return _0x28ea2b;}})[_0x577e('0x41')](function(_0x453668){logger[_0x577e('0x21')](_0x577e('0x48'),_0x453668);throw _0x453668;});}return _0x28ea2b;})[_0x577e('0x1d')](respondWithResult(_0xdb5af8,0xc9))[_0x577e('0x41')](handleError(_0xdb5af8,null));};exports[_0x577e('0x49')]=function(_0x1e4ca9,_0x1e0d24){if(_0x1e4ca9['body']['id']){delete _0x1e4ca9[_0x577e('0x4a')]['id'];}return db[_0x577e('0x39')]['find']({'where':{'id':_0x1e4ca9['params']['id']}})['then'](handleEntityNotFound(_0x1e0d24,null))['then'](saveUpdates(_0x1e4ca9[_0x577e('0x4a')],null))[_0x577e('0x1d')](respondWithResult(_0x1e0d24,null))[_0x577e('0x41')](handleError(_0x1e0d24,null));};exports[_0x577e('0x20')]=function(_0x459abc,_0x26b3e9){return db['Pause']['find']({'where':{'id':_0x459abc['params']['id']}})[_0x577e('0x1d')](handleEntityNotFound(_0x26b3e9,null))[_0x577e('0x1d')](removeEntity(_0x26b3e9,null))[_0x577e('0x41')](handleError(_0x26b3e9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6c89496..fb144bd 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 _0xc74c=['exports','Pause','tools_pauses','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes'];(function(_0x1fad8b,_0x128a29){var _0x1666af=function(_0x166fb9){while(--_0x166fb9){_0x1fad8b['push'](_0x1fad8b['shift']());}};_0x1666af(++_0x128a29);}(_0xc74c,0x163));var _0xcc74=function(_0x4c88c9,_0x1e3ebf){_0x4c88c9=_0x4c88c9-0x0;var _0x3642c0=_0xc74c[_0x4c88c9];return _0x3642c0;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc74('0x2'));var BPromise=require(_0xcc74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc74('0x4'));var rimraf=require(_0xcc74('0x5'));var config=require(_0xcc74('0x6'));var attributes=require(_0xcc74('0x7'));module[_0xcc74('0x8')]=function(_0x23c249,_0x425b73){return _0x23c249['define'](_0xcc74('0x9'),attributes,{'tableName':_0xcc74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac0=['bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment'];(function(_0x44faf7,_0xec160c){var _0x5e128f=function(_0x5d9e8a){while(--_0x5d9e8a){_0x44faf7['push'](_0x44faf7['shift']());}};_0x5e128f(++_0xec160c);}(_0x0ac0,0x130));var _0x00ac=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x0ac0[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var logger=require(_0x00ac('0x2'))('api');var moment=require(_0x00ac('0x3'));var BPromise=require(_0x00ac('0x4'));var rp=require(_0x00ac('0x5'));var fs=require('fs');var path=require(_0x00ac('0x6'));var rimraf=require(_0x00ac('0x7'));var config=require(_0x00ac('0x8'));var attributes=require(_0x00ac('0x9'));module[_0x00ac('0xa')]=function(_0x4caaa8,_0x464817){return _0x4caaa8[_0x00ac('0xb')](_0x00ac('0xc'),attributes,{'tableName':_0x00ac('0xd'),'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 146ccc7..044e43c 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 _0x9c83=['Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','find','options','map','include','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21ce1a,_0x56c62d){var _0x4b704b=function(_0x9da5b2){while(--_0x9da5b2){_0x21ce1a['push'](_0x21ce1a['shift']());}};_0x4b704b(++_0x56c62d);}(_0x9c83,0x1ef));var _0x39c8=function(_0xd83d57,_0x2b149d){_0xd83d57=_0xd83d57-0x0;var _0x53c308=_0x9c83[_0xd83d57];return _0x53c308;};'use strict';var _=require(_0x39c8('0x0'));var util=require(_0x39c8('0x1'));var moment=require('moment');var BPromise=require(_0x39c8('0x2'));var rs=require(_0x39c8('0x3'));var fs=require('fs');var Redis=require(_0x39c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39c8('0x5'));var logger=require('../../config/logger')(_0x39c8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x39c8('0x7')][_0x39c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f44ee,_0x4a1620,_0x4d280d){return new BPromise(function(_0x516ab7,_0x1404ad){return client[_0x39c8('0x9')](_0x1f44ee,_0x4d280d)[_0x39c8('0xa')](function(_0x29eafc){logger[_0x39c8('0xb')](_0x39c8('0xc'),_0x4a1620,_0x39c8('0xd'));logger[_0x39c8('0xe')](_0x39c8('0xf'),_0x4a1620,_0x39c8('0xd'),JSON[_0x39c8('0x10')](_0x29eafc));if(_0x29eafc[_0x39c8('0x11')]){if(_0x29eafc[_0x39c8('0x11')][_0x39c8('0x12')]===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x4a1620,_0x29eafc['error'][_0x39c8('0x13')]);return _0x1404ad(_0x29eafc[_0x39c8('0x11')][_0x39c8('0x13')]);}logger[_0x39c8('0x11')](_0x39c8('0xc'),_0x4a1620,_0x29eafc[_0x39c8('0x11')][_0x39c8('0x13')]);return _0x516ab7(_0x29eafc[_0x39c8('0x11')]['message']);}else{logger[_0x39c8('0xb')](_0x39c8('0xc'),_0x4a1620,_0x39c8('0xd'));_0x516ab7(_0x29eafc[_0x39c8('0x14')]['message']);}})[_0x39c8('0x15')](function(_0x588b3d){logger[_0x39c8('0x11')](_0x39c8('0xc'),_0x4a1620,_0x588b3d);_0x1404ad(_0x588b3d);});});}exports[_0x39c8('0x16')]=function(_0x589523){var _0x374db8=this;return new Promise(function(_0x1473c7,_0x3620a3){return db[_0x39c8('0x17')][_0x39c8('0x18')]({'raw':_0x589523[_0x39c8('0x19')]?_0x589523['options']['raw']===undefined?!![]:![]:!![],'where':_0x589523[_0x39c8('0x19')]?_0x589523[_0x39c8('0x19')]['where']||null:null,'attributes':_0x589523['options']?_0x589523[_0x39c8('0x19')]['attributes']||null:null,'include':_0x589523['options']?_0x589523[_0x39c8('0x19')]['include']?_[_0x39c8('0x1a')](_0x589523['options'][_0x39c8('0x1b')],function(_0x51fd34){return{'model':db[_0x51fd34[_0x39c8('0x1c')]],'as':_0x51fd34['as'],'attributes':_0x51fd34['attributes'],'include':_0x51fd34[_0x39c8('0x1b')]?_['map'](_0x51fd34[_0x39c8('0x1b')],function(_0x2bf6b2){return{'model':db[_0x2bf6b2[_0x39c8('0x1c')]],'as':_0x2bf6b2['as'],'attributes':_0x2bf6b2[_0x39c8('0x1d')],'include':_0x2bf6b2['include']?_[_0x39c8('0x1a')](_0x2bf6b2[_0x39c8('0x1b')],function(_0x439cfd){return{'model':db[_0x439cfd[_0x39c8('0x1c')]],'as':_0x439cfd['as'],'attributes':_0x439cfd[_0x39c8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x39c8('0xa')](function(_0x23ca36){logger['info']('ShowPause',_0x589523);logger[_0x39c8('0xe')](_0x39c8('0x16'),_0x589523,JSON['stringify'](_0x23ca36));_0x1473c7(_0x23ca36);})[_0x39c8('0x15')](function(_0x2f8e66){logger[_0x39c8('0x11')](_0x39c8('0x16'),_0x2f8e66[_0x39c8('0x13')],_0x589523);_0x3620a3(_0x374db8['error'](0x1f4,_0x2f8e66[_0x39c8('0x13')]));});});}; \ No newline at end of file +var _0xbacf=['ShowPause','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Pause','options','raw','where','attributes','include','map','model'];(function(_0x12b2f2,_0x36820e){var _0x337b52=function(_0x5e71ae){while(--_0x5e71ae){_0x12b2f2['push'](_0x12b2f2['shift']());}};_0x337b52(++_0x36820e);}(_0xbacf,0xf9));var _0xfbac=function(_0x49f8c2,_0x5166b7){_0x49f8c2=_0x49f8c2-0x0;var _0x3e63ec=_0xbacf[_0x49f8c2];return _0x3e63ec;};'use strict';var _=require('lodash');var util=require(_0xfbac('0x0'));var moment=require(_0xfbac('0x1'));var BPromise=require(_0xfbac('0x2'));var rs=require(_0xfbac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbac('0x4'))(_0xfbac('0x5'));var config=require(_0xfbac('0x6'));var jayson=require(_0xfbac('0x7'));var client=jayson[_0xfbac('0x8')][_0xfbac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a173,_0x31ff42,_0x5880c9){return new BPromise(function(_0x38c928,_0x35d67f){return client[_0xfbac('0xa')](_0x32a173,_0x5880c9)[_0xfbac('0xb')](function(_0x1b91a6){logger[_0xfbac('0xc')](_0xfbac('0xd'),_0x31ff42,'request\x20sent');logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x31ff42,_0xfbac('0x10'),JSON[_0xfbac('0x11')](_0x1b91a6));if(_0x1b91a6[_0xfbac('0x12')]){if(_0x1b91a6[_0xfbac('0x12')]['code']===0x1f4){logger[_0xfbac('0x12')]('Pause,\x20%s,\x20%s',_0x31ff42,_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);return _0x35d67f(_0x1b91a6['error'][_0xfbac('0x13')]);}logger['error'](_0xfbac('0xd'),_0x31ff42,_0x1b91a6[_0xfbac('0x12')]['message']);return _0x38c928(_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);}else{logger[_0xfbac('0xc')]('Pause,\x20%s,\x20%s',_0x31ff42,_0xfbac('0x10'));_0x38c928(_0x1b91a6[_0xfbac('0x14')][_0xfbac('0x13')]);}})[_0xfbac('0x15')](function(_0x2b316a){logger[_0xfbac('0x12')]('Pause,\x20%s,\x20%s',_0x31ff42,_0x2b316a);_0x35d67f(_0x2b316a);});});}exports['ShowPause']=function(_0x102efe){var _0x56d710=this;return new Promise(function(_0x204e08,_0x3844e4){return db[_0xfbac('0x16')]['find']({'raw':_0x102efe[_0xfbac('0x17')]?_0x102efe[_0xfbac('0x17')][_0xfbac('0x18')]===undefined?!![]:![]:!![],'where':_0x102efe[_0xfbac('0x17')]?_0x102efe[_0xfbac('0x17')][_0xfbac('0x19')]||null:null,'attributes':_0x102efe[_0xfbac('0x17')]?_0x102efe['options'][_0xfbac('0x1a')]||null:null,'include':_0x102efe['options']?_0x102efe[_0xfbac('0x17')][_0xfbac('0x1b')]?_[_0xfbac('0x1c')](_0x102efe[_0xfbac('0x17')]['include'],function(_0x3f015b){return{'model':db[_0x3f015b[_0xfbac('0x1d')]],'as':_0x3f015b['as'],'attributes':_0x3f015b['attributes'],'include':_0x3f015b[_0xfbac('0x1b')]?_[_0xfbac('0x1c')](_0x3f015b[_0xfbac('0x1b')],function(_0x1ff7e0){return{'model':db[_0x1ff7e0[_0xfbac('0x1d')]],'as':_0x1ff7e0['as'],'attributes':_0x1ff7e0['attributes'],'include':_0x1ff7e0[_0xfbac('0x1b')]?_['map'](_0x1ff7e0['include'],function(_0x22fabb){return{'model':db[_0x22fabb['model']],'as':_0x22fabb['as'],'attributes':_0x22fabb['attributes']};}):[]};}):[]};}):[]:[]})[_0xfbac('0xb')](function(_0x5d06a0){logger[_0xfbac('0xc')](_0xfbac('0x1e'),_0x102efe);logger[_0xfbac('0xe')]('ShowPause',_0x102efe,JSON[_0xfbac('0x11')](_0x5d06a0));_0x204e08(_0x5d06a0);})[_0xfbac('0x15')](function(_0x30dd0b){logger[_0xfbac('0x12')](_0xfbac('0x1e'),_0x30dd0b[_0xfbac('0x13')],_0x102efe);_0x3844e4(_0x56d710[_0xfbac('0x12')](0x1f4,_0x30dd0b[_0xfbac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index ef690df..140f934 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 _0xd2d4=['%s-%s%s','basename','extname','now','post','single','file','webhookPost','put','update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','/webhook','/:id','show','/:id/download','download','diskStorage','join','originalname','format'];(function(_0x4712c2,_0x5529df){var _0x2d9923=function(_0x4163bb){while(--_0x4163bb){_0x4712c2['push'](_0x4712c2['shift']());}};_0x2d9923(++_0x5529df);}(_0xd2d4,0xb2));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4d2d('0x0'));var util=require(_0x4d2d('0x1'));var path=require(_0x4d2d('0x2'));var timeout=require(_0x4d2d('0x3'));var express=require(_0x4d2d('0x4'));var router=express[_0x4d2d('0x5')]();var auth=require(_0x4d2d('0x6'));var interaction=require(_0x4d2d('0x7'));var config=require(_0x4d2d('0x8'));var controller=require(_0x4d2d('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4d2d('0xa')](_0x4d2d('0xb'),controller['webhookGet']);router['get'](_0x4d2d('0xc'),auth['isAuthenticated'](),controller[_0x4d2d('0xd')]);router[_0x4d2d('0xa')](_0x4d2d('0xe'),auth['isAuthenticated'](),controller[_0x4d2d('0xf')]);var upload=multer({'storage':multer[_0x4d2d('0x10')]({'destination':function(_0x2d8510,_0x555e59,_0x285824){_0x285824(null,path[_0x4d2d('0x11')](config['root'],'server/files/plugins'));},'filename':function(_0x5242f4,_0x41f621,_0x327fe8){_0x41f621['originalname']=_0x41f621[_0x4d2d('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x327fe8(null,util[_0x4d2d('0x13')](_0x4d2d('0x14'),path[_0x4d2d('0x15')](_0x41f621['originalname'],path[_0x4d2d('0x16')](_0x41f621[_0x4d2d('0x12')])),Date[_0x4d2d('0x17')](),path['extname'](_0x41f621[_0x4d2d('0x12')])));}})});router[_0x4d2d('0x18')]('/',upload[_0x4d2d('0x19')](_0x4d2d('0x1a')),controller['upload']);router[_0x4d2d('0x18')](_0x4d2d('0xb'),controller[_0x4d2d('0x1b')]);router[_0x4d2d('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x4d2d('0x1d')]);router[_0x4d2d('0x1e')](_0x4d2d('0xc'),auth[_0x4d2d('0x1f')](),controller[_0x4d2d('0x1e')]);module[_0x4d2d('0x20')]=router; \ No newline at end of file +var _0x6ea8=['diskStorage','join','originalname','replace','format','%s-%s%s','extname','now','single','upload','post','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./plugin.controller','isAuthenticated','index','/webhook','webhookGet','get','/:id','show','/:id/download','download'];(function(_0x322ac3,_0x53c678){var _0x1337cb=function(_0x26ea74){while(--_0x26ea74){_0x322ac3['push'](_0x322ac3['shift']());}};_0x1337cb(++_0x53c678);}(_0x6ea8,0x157));var _0x86ea=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x6ea8[_0x30bd4d];return _0x306915;};'use strict';var multer=require(_0x86ea('0x0'));var util=require(_0x86ea('0x1'));var path=require(_0x86ea('0x2'));var timeout=require(_0x86ea('0x3'));var express=require(_0x86ea('0x4'));var router=express[_0x86ea('0x5')]();var auth=require(_0x86ea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x86ea('0x7'));router['get']('/',auth[_0x86ea('0x8')](),controller[_0x86ea('0x9')]);router['get'](_0x86ea('0xa'),controller[_0x86ea('0xb')]);router[_0x86ea('0xc')](_0x86ea('0xd'),auth[_0x86ea('0x8')](),controller[_0x86ea('0xe')]);router[_0x86ea('0xc')](_0x86ea('0xf'),auth[_0x86ea('0x8')](),controller[_0x86ea('0x10')]);var upload=multer({'storage':multer[_0x86ea('0x11')]({'destination':function(_0x3b97e4,_0x45d326,_0x2b950e){_0x2b950e(null,path[_0x86ea('0x12')](config['root'],'server/files/plugins'));},'filename':function(_0x1a6cde,_0x14d146,_0x3ab80c){_0x14d146[_0x86ea('0x13')]=_0x14d146['originalname'][_0x86ea('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ab80c(null,util[_0x86ea('0x15')](_0x86ea('0x16'),path['basename'](_0x14d146['originalname'],path[_0x86ea('0x17')](_0x14d146[_0x86ea('0x13')])),Date[_0x86ea('0x18')](),path[_0x86ea('0x17')](_0x14d146[_0x86ea('0x13')])));}})});router['post']('/',upload[_0x86ea('0x19')]('file'),controller[_0x86ea('0x1a')]);router[_0x86ea('0x1b')](_0x86ea('0xa'),controller['webhookPost']);router['put'](_0x86ea('0xd'),auth[_0x86ea('0x8')](),controller['update']);router[_0x86ea('0x1c')]('/:id',auth[_0x86ea('0x8')](),controller[_0x86ea('0x1c')]);module[_0x86ea('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 90dbfbb..f7c43f1 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 _0xa3b5=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','script','TEXT'];(function(_0x542a4e,_0x23f7ef){var _0x11d75d=function(_0x12c1c7){while(--_0x12c1c7){_0x542a4e['push'](_0x542a4e['shift']());}};_0x11d75d(++_0x23f7ef);}(_0xa3b5,0xc7));var _0x5a3b=function(_0x4ee87d,_0x2af6d3){_0x4ee87d=_0x4ee87d-0x0;var _0x29867c=_0xa3b5[_0x4ee87d];return _0x29867c;};'use strict';var Sequelize=require(_0x5a3b('0x0'));module[_0x5a3b('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5a3b('0x2')]('html',_0x5a3b('0x3'))},'description':{'type':Sequelize[_0x5a3b('0x4')]},'version':{'type':Sequelize[_0x5a3b('0x4')]},'path':{'type':Sequelize[_0x5a3b('0x5')],'comment':_0x5a3b('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5a3b('0x7')},'sidebar':{'type':Sequelize[_0x5a3b('0x2')]('adminOnly',_0x5a3b('0x8'),_0x5a3b('0x9'),_0x5a3b('0xa')),'defaultValue':'always','comment':_0x5a3b('0xb')},'icon':{'type':Sequelize[_0x5a3b('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x5a3b('0x5')]},'scriptName':{'type':Sequelize[_0x5a3b('0x5')]},'scriptPath':{'type':Sequelize[_0x5a3b('0x5')]}}; \ No newline at end of file +var _0xc5ab=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','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.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5ab,0x1c7));var _0xbc5a=function(_0x26e1f9,_0x48d684){_0x26e1f9=_0x26e1f9-0x0;var _0x20a0df=_0xc5ab[_0x26e1f9];return _0x20a0df;};'use strict';var Sequelize=require(_0xbc5a('0x0'));module[_0xbc5a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbc5a('0x2')](_0xbc5a('0x3'),_0xbc5a('0x4'))},'description':{'type':Sequelize[_0xbc5a('0x5')]},'version':{'type':Sequelize[_0xbc5a('0x5')]},'path':{'type':Sequelize[_0xbc5a('0x6')],'comment':_0xbc5a('0x7')},'active':{'type':Sequelize[_0xbc5a('0x8')],'defaultValue':0x0,'comment':_0xbc5a('0x9')},'sidebar':{'type':Sequelize[_0xbc5a('0x2')](_0xbc5a('0xa'),_0xbc5a('0xb'),_0xbc5a('0xc'),_0xbc5a('0xd')),'defaultValue':'always','comment':_0xbc5a('0xe')},'icon':{'type':Sequelize[_0xbc5a('0x6')]},'adminUrl':{'type':Sequelize[_0xbc5a('0x6')]},'agentUrl':{'type':Sequelize[_0xbc5a('0x6')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xbc5a('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 19612cc..f857ef5 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 _0x27cb=['filename','extname','file','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','body','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','set','sendStatus','statusCode','webhookPost','http://localhost:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','end','status','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','rawAttributes','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','Plugin','findAll','catch','params','fields','options','find','join','server/files/plugins','%s.zip','createWriteStream','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','root','dirname','basename','attachments/**/*','finalize','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed'];(function(_0x1464d2,_0x4e4d68){var _0x459990=function(_0x1e034d){while(--_0x1e034d){_0x1464d2['push'](_0x1464d2['shift']());}};_0x459990(++_0x4e4d68);}(_0x27cb,0x195));var _0xb27c=function(_0x3b2b57,_0x2aceab){_0x3b2b57=_0x3b2b57-0x0;var _0x47b2c2=_0x27cb[_0x3b2b57];return _0x47b2c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb27c('0x0'));var rimraf=require(_0xb27c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb27c('0x2'));var rp=require(_0xb27c('0x3'));var moment=require(_0xb27c('0x4'));var BPromise=require(_0xb27c('0x5'));var Mustache=require('mustache');var util=require(_0xb27c('0x6'));var path=require(_0xb27c('0x7'));var sox=require('sox');var csv=require(_0xb27c('0x8'));var ejs=require(_0xb27c('0x9'));var fs=require('fs');var _=require(_0xb27c('0xa'));var squel=require(_0xb27c('0xb'));var crypto=require('crypto');var jsforce=require(_0xb27c('0xc'));var deskjs=require(_0xb27c('0xd'));var toCsv=require(_0xb27c('0x8'));var querystring=require(_0xb27c('0xe'));var Papa=require(_0xb27c('0xf'));var extract=require(_0xb27c('0x10'));var rimraf=require(_0xb27c('0x1'));var archiver=require(_0xb27c('0x11'));var Redis=require(_0xb27c('0x12'));var authService=require(_0xb27c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb27c('0x14'));var hardwareService=require(_0xb27c('0x15'));var logger=require(_0xb27c('0x16'))(_0xb27c('0x17'));var utils=require(_0xb27c('0x18'));var config=require('../../config/environment');var db=require(_0xb27c('0x19'))['db'];config['redis']=_['defaults'](config[_0xb27c('0x1a')],{'host':_0xb27c('0x1b'),'port':0x18eb});var socket=require(_0xb27c('0x1c'))(new Redis(config[_0xb27c('0x1a')]));require(_0xb27c('0x1d'))[_0xb27c('0x1e')](socket);function respondWithStatusCode(_0x51f38b,_0x45d827){_0x45d827=_0x45d827||0xcc;return function(_0x13300a){if(_0x13300a){return _0x51f38b['sendStatus'](_0x45d827);}return _0x51f38b['status'](_0x45d827)[_0xb27c('0x1f')]();};}function respondWithResult(_0x328b44,_0x3d689f){_0x3d689f=_0x3d689f||0xc8;return function(_0x2cead4){if(_0x2cead4){return _0x328b44[_0xb27c('0x20')](_0x3d689f)['json'](_0x2cead4);}};}function respondWithFilteredResult(_0x1a3146,_0x35ebb2){return function(_0x4ad748){if(_0x4ad748){var _0x5e9763=_0x4ad748['count'],_0x2a8e13=_0x35ebb2[_0xb27c('0x21')],_0x16871b=_0x35ebb2[_0xb27c('0x21')]+_0x35ebb2[_0xb27c('0x22')],_0x235166;if(_0x16871b>=_0x5e9763){_0x16871b=_0x5e9763;_0x235166=0xc8;}else{_0x235166=0xce;}_0x1a3146['status'](_0x235166);return _0x1a3146['set'](_0xb27c('0x23'),_0x2a8e13+'-'+_0x16871b+'/'+_0x5e9763)[_0xb27c('0x24')](_0x4ad748);}return null;};}function patchUpdates(_0x280195){return function(_0x5e3299){try{jsonpatch[_0xb27c('0x25')](_0x5e3299,_0x280195,!![]);}catch(_0x32b0f5){return BPromise[_0xb27c('0x26')](_0x32b0f5);}return _0x5e3299[_0xb27c('0x27')]();};}function saveUpdates(_0x1df643,_0x10d8cf){return function(_0x44b647){if(_0x44b647){return _0x44b647['update'](_0x1df643)[_0xb27c('0x28')](function(_0x16cfe0){return _0x16cfe0;});}return null;};}function removeEntity(_0x3a918e,_0x601c4f){return function(_0x5dd8ff){if(_0x5dd8ff){return _0x5dd8ff[_0xb27c('0x29')]()[_0xb27c('0x28')](function(){var _0x551d3e=_0x5dd8ff[_0xb27c('0x2a')]({'plain':!![]});var _0x4773b0='Plugins';return db[_0xb27c('0x2b')][_0xb27c('0x29')]({'where':{'type':_0x4773b0,'resourceId':_0x551d3e['id']}})['then'](function(){return _0x5dd8ff;});})[_0xb27c('0x28')](function(){_0x3a918e[_0xb27c('0x20')](0xcc)[_0xb27c('0x1f')]();});}};}function handleEntityNotFound(_0x3b526b,_0x4a7e64){return function(_0x4b1ffb){if(!_0x4b1ffb){_0x3b526b['sendStatus'](0x194);}return _0x4b1ffb;};}function handleError(_0x1b0e8c,_0x3b1492){_0x3b1492=_0x3b1492||0x1f4;return function(_0x4a95ce){logger[_0xb27c('0x2c')](_0x4a95ce[_0xb27c('0x2d')]);if(_0x4a95ce[_0xb27c('0x2e')]){delete _0x4a95ce[_0xb27c('0x2e')];}_0x1b0e8c[_0xb27c('0x20')](_0x3b1492)[_0xb27c('0x2f')](_0x4a95ce);};}exports['index']=function(_0x5d4e17,_0x234480){var _0x5cc95b={},_0x5c5801={},_0x235bc9={'count':0x0,'rows':[]};var _0x138253=_['map'](db['Plugin'][_0xb27c('0x30')],function(_0xfe0e10){return{'name':_0xfe0e10['fieldName'],'type':_0xfe0e10[_0xb27c('0x31')]['key']};});_0x5c5801[_0xb27c('0x32')]=_['map'](_0x138253,_0xb27c('0x2e'));_0x5c5801['query']=_[_0xb27c('0x33')](_0x5d4e17[_0xb27c('0x34')]);_0x5c5801[_0xb27c('0x35')]=_[_0xb27c('0x36')](_0x5c5801[_0xb27c('0x32')],_0x5c5801[_0xb27c('0x34')]);_0x5cc95b[_0xb27c('0x37')]=_[_0xb27c('0x36')](_0x5c5801['model'],qs['fields'](_0x5d4e17['query']['fields']));_0x5cc95b[_0xb27c('0x37')]=_0x5cc95b['attributes'][_0xb27c('0x38')]?_0x5cc95b['attributes']:_0x5c5801[_0xb27c('0x32')];if(!_0x5d4e17[_0xb27c('0x34')][_0xb27c('0x39')]('nolimit')){_0x5cc95b[_0xb27c('0x22')]=qs[_0xb27c('0x22')](_0x5d4e17[_0xb27c('0x34')][_0xb27c('0x22')]);_0x5cc95b[_0xb27c('0x21')]=qs[_0xb27c('0x21')](_0x5d4e17['query'][_0xb27c('0x21')]);}_0x5cc95b['order']=qs[_0xb27c('0x3a')](_0x5d4e17[_0xb27c('0x34')][_0xb27c('0x3a')]);_0x5cc95b[_0xb27c('0x3b')]=qs['filters'](_[_0xb27c('0x3c')](_0x5d4e17['query'],_0x5c5801[_0xb27c('0x35')]),_0x138253);if(_0x5d4e17[_0xb27c('0x34')]['filter']){_0x5cc95b[_0xb27c('0x3b')]=_['merge'](_0x5cc95b[_0xb27c('0x3b')],{'$or':_['map'](_0x138253,function(_0x568bcb){if(_0x568bcb[_0xb27c('0x31')]!==_0xb27c('0x3d')){var _0x573d81={};_0x573d81[_0x568bcb[_0xb27c('0x2e')]]={'$like':'%'+_0x5d4e17[_0xb27c('0x34')][_0xb27c('0x3e')]+'%'};return _0x573d81;}})});}_0x5cc95b=_[_0xb27c('0x3f')]({},_0x5cc95b,_0x5d4e17['options']);var _0x17c1c5={'where':_0x5cc95b[_0xb27c('0x3b')]};return db['Plugin'][_0xb27c('0x40')](_0x17c1c5)[_0xb27c('0x28')](function(_0x57775a){_0x235bc9[_0xb27c('0x40')]=_0x57775a;if(_0x5d4e17[_0xb27c('0x34')][_0xb27c('0x41')]){_0x5cc95b[_0xb27c('0x42')]=[{'all':!![]}];}return db[_0xb27c('0x43')][_0xb27c('0x44')](_0x5cc95b);})[_0xb27c('0x28')](function(_0x3b45fe){_0x235bc9['rows']=_0x3b45fe;return _0x235bc9;})[_0xb27c('0x28')](respondWithFilteredResult(_0x234480,_0x5cc95b))[_0xb27c('0x45')](handleError(_0x234480,null));};exports['show']=function(_0x2a7319,_0x1f4cd9){var _0x43204f={'raw':!![],'where':{'id':_0x2a7319[_0xb27c('0x46')]['id']}},_0x37bec5={};_0x37bec5[_0xb27c('0x32')]=_[_0xb27c('0x33')](db['Plugin']['rawAttributes']);_0x37bec5[_0xb27c('0x34')]=_['keys'](_0x2a7319[_0xb27c('0x34')]);_0x37bec5[_0xb27c('0x35')]=_[_0xb27c('0x36')](_0x37bec5[_0xb27c('0x32')],_0x37bec5['query']);_0x43204f[_0xb27c('0x37')]=_[_0xb27c('0x36')](_0x37bec5['model'],qs[_0xb27c('0x47')](_0x2a7319[_0xb27c('0x34')][_0xb27c('0x47')]));_0x43204f['attributes']=_0x43204f[_0xb27c('0x37')][_0xb27c('0x38')]?_0x43204f[_0xb27c('0x37')]:_0x37bec5['model'];if(_0x2a7319[_0xb27c('0x34')][_0xb27c('0x41')]){_0x43204f[_0xb27c('0x42')]=[{'all':!![]}];}_0x43204f=_['merge']({},_0x43204f,_0x2a7319[_0xb27c('0x48')]);return db[_0xb27c('0x43')][_0xb27c('0x49')](_0x43204f)[_0xb27c('0x28')](handleEntityNotFound(_0x1f4cd9,null))[_0xb27c('0x28')](respondWithResult(_0x1f4cd9,null))[_0xb27c('0x45')](handleError(_0x1f4cd9,null));};exports['download']=function(_0x16922e,_0x1bad94,_0xf6a32e){return db[_0xb27c('0x43')]['find']({'where':{'id':_0x16922e[_0xb27c('0x46')]['id']},'attributes':[_0xb27c('0x2e'),_0xb27c('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x1bad94,null))[_0xb27c('0x28')](function(_0x27d698){if(_0x27d698){var _0x38d213=path[_0xb27c('0x4a')](config['root'],_0xb27c('0x4b'),util['format'](_0xb27c('0x4c'),path['basename'](_0x27d698[_0xb27c('0x7')])));var _0x2bf049=fs[_0xb27c('0x4d')](_0x38d213);var _0x522282=archiver(_0xb27c('0x4e'),{'zlib':{'level':0x9}});_0x522282['on'](_0xb27c('0x4f'),function(_0x956bfa){if(_0x956bfa['code']===_0xb27c('0x50')){logger[_0xb27c('0x2c')](_0x956bfa);}else{throw new db[(_0xb27c('0x51'))]['Error'](_0xb27c('0x52'));}});_0x522282['on']('error',function(_0x243b6e){throw new db[(_0xb27c('0x51'))][(_0xb27c('0x53'))](_0xb27c('0x52'));});_0x522282[_0xb27c('0x54')](_0x2bf049);_0x522282[_0xb27c('0x55')](_0xb27c('0x56'),{'cwd':path[_0xb27c('0x4a')](config[_0xb27c('0x57')],_0xb27c('0x4b'),path[_0xb27c('0x58')](_0x27d698[_0xb27c('0x7')])),'ignore':[path[_0xb27c('0x4a')](path[_0xb27c('0x59')](_0x27d698[_0xb27c('0x7')]),'node_modules/**/*'),path[_0xb27c('0x4a')](path[_0xb27c('0x59')](_0x27d698['path']),_0xb27c('0x5a'))],'nodir':!![]})[_0xb27c('0x5b')]();_0x2bf049['on']('close',function(){if(!fs['existsSync'](_0x38d213)){throw new db['Sequelize'][(_0xb27c('0x53'))](_0xb27c('0x5c'));}return _0x1bad94[_0xb27c('0x5d')](_0x38d213,util[_0xb27c('0x5e')](_0xb27c('0x4c'),path[_0xb27c('0x59')](_0x27d698['path'])),function(_0x4d6bc5){if(_0x4d6bc5){throw new db['Sequelize'][(_0xb27c('0x53'))](_0xb27c('0x5f'));}fs[_0xb27c('0x60')](_0x38d213);logger['info'](_0xb27c('0x61'));logger['info'](_0xb27c('0x62'));});});}return null;})[_0xb27c('0x45')](handleError(_0x1bad94,null));};exports['upload']=function(_0x3350f6,_0x1ef8c3,_0x3c2c9d){var _0x48feb5=path[_0xb27c('0x59')](_0x3350f6['file'][_0xb27c('0x63')],path[_0xb27c('0x64')](_0x3350f6[_0xb27c('0x65')][_0xb27c('0x63')]));var _0x3fafa9=path[_0xb27c('0x4a')](config[_0xb27c('0x57')],_0xb27c('0x4b'),_0x3350f6[_0xb27c('0x65')][_0xb27c('0x63')]);var _0x5ebc07=path[_0xb27c('0x4a')](config[_0xb27c('0x57')],_0xb27c('0x4b'),_0x48feb5);logger[_0xb27c('0x66')](_0xb27c('0x67'),_0x3fafa9);logger[_0xb27c('0x66')](_0xb27c('0x68'),_0x5ebc07);try{fs[_0xb27c('0x69')](_0x3fafa9,parseInt(_0xb27c('0x6a'),0x8));extract(_0x3fafa9,{'dir':_0x5ebc07},function(_0x3ff185){if(_0x3ff185){logger['error'](_0x3ff185);handleError(_0x3ff185,!![]);};var _0x2bbdc3=fs['readdirSync'](_0x5ebc07);if(_0x2bbdc3[_0xb27c('0x38')]>0x1){removeReferences(_0x3fafa9,_0x5ebc07);logger[_0xb27c('0x2c')](_0xb27c('0x6b'));return _0x3c2c9d(new Error('Invalid\x20plugin\x20structure'));}var _0x201ebb=fs['lstatSync'](path['join'](_0x5ebc07,_0x2bbdc3[0x0]));if(_0x201ebb[_0xb27c('0x6c')]()){removeReferences(_0x3fafa9,_0x5ebc07);logger[_0xb27c('0x2c')](_0xb27c('0x6b'));return _0x3c2c9d(new Error(_0xb27c('0x6b')));}if(_0x201ebb['isDirectory']()){var _0x5b6945=fs[_0xb27c('0x6d')](path[_0xb27c('0x4a')](_0x5ebc07,_0x2bbdc3[0x0]));if(_0x5b6945[_0xb27c('0x38')]===0x0){removeReferences(_0x3fafa9,_0x5ebc07);logger[_0xb27c('0x2c')](_0xb27c('0x6b'));return _0x3c2c9d(new Error(_0xb27c('0x6b')));}var _0x3bec4c=_0x5b6945[_0xb27c('0x6e')](function(_0x2add7d){return _0x2add7d===_0xb27c('0x6f');});if(!_0x3bec4c){return _0x3c2c9d(new Error(_0xb27c('0x70')));}var _0x51c1a4=fs['readFileSync'](path[_0xb27c('0x4a')](_0x5ebc07,_0x2bbdc3[0x0],_0xb27c('0x6f')));var _0x1ab840=JSON[_0xb27c('0x71')](_0x51c1a4);if(_0xb27c('0x72')==typeof _0x1ab840[_0xb27c('0x2e')]){return _0x3c2c9d(new Error(_0xb27c('0x73')));}if(_0xb27c('0x72')==typeof _0x1ab840[_0xb27c('0x31')]){return _0x3c2c9d(new Error(_0xb27c('0x74')));}if(_0xb27c('0x72')==typeof _0x1ab840[_0xb27c('0x75')]){return _0x3c2c9d(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb27c('0x72')==typeof _0x1ab840[_0xb27c('0x76')]){return _0x3c2c9d(new Error(_0xb27c('0x77')));}if(_0x1ab840['type']===_0xb27c('0x78')){if(_0xb27c('0x72')==typeof _0x1ab840[_0xb27c('0x76')]['views']){return _0x3c2c9d(new Error(_0xb27c('0x79')));}if(_0xb27c('0x72')==typeof _0x1ab840['parameters'][_0xb27c('0x7a')]['admin']&&_0xb27c('0x72')==typeof _0x1ab840['parameters'][_0xb27c('0x7a')][_0xb27c('0x7b')]){return _0x3c2c9d(new Error(_0xb27c('0x7c')));}}else if(_0x1ab840['type']==='script'){if(_0xb27c('0x72')==typeof _0x1ab840['parameters'][_0xb27c('0x7d')]){return _0x3c2c9d(new Error(_0xb27c('0x7e')));}if(_0xb27c('0x72')==typeof _0x1ab840[_0xb27c('0x76')][_0xb27c('0x7f')]){return _0x3c2c9d(new Error(_0xb27c('0x80')));}}else{return _0x3c2c9d(new Error(_0xb27c('0x81')));}var _0xa4bf35=_0x1ab840[_0xb27c('0x2e')];var _0x18991a=_0x1ab840[_0xb27c('0x82')];var _0x2db8a1=_0x1ab840[_0xb27c('0x31')];var _0x3b7ffa=_0x1ab840[_0xb27c('0x83')]?_0x1ab840[_0xb27c('0x83')]:_0xb27c('0x84');var _0x61482b=_0x1ab840[_0xb27c('0x85')]?_0x1ab840[_0xb27c('0x85')]:_0xb27c('0x86');var _0x4522fb='';var _0x15436c='';var _0x51479f='';var _0x4a849b='';var _0x1dd519=_0x1ab840['version'];if(_0x2db8a1===_0xb27c('0x78')){if(_0xb27c('0x72')!=typeof _0x1ab840[_0xb27c('0x76')]['views']['admin']){var _0x2d3c3e=_0x1ab840[_0xb27c('0x76')][_0xb27c('0x7a')][_0xb27c('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xb27c('0x88')](_0x2d3c3e)){_0x4522fb=path[_0xb27c('0x4a')](_0xb27c('0x89'),_0x48feb5,_0x2bbdc3[0x0],_0x2d3c3e);}else{_0x4522fb=_0x2d3c3e;}}else{logger[_0xb27c('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xb27c('0x72')!=typeof _0x1ab840['parameters'][_0xb27c('0x7a')][_0xb27c('0x7b')]){var _0x462606=_0x1ab840[_0xb27c('0x76')][_0xb27c('0x7a')][_0xb27c('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x462606)){_0x15436c=path[_0xb27c('0x4a')](_0xb27c('0x89'),_0x48feb5,_0x2bbdc3[0x0],_0x462606);}else{_0x15436c=_0x462606;}}else{logger['info'](_0xb27c('0x8a'));}}else if(_0x2db8a1==='script'){_0x51479f=_0x1ab840[_0xb27c('0x76')][_0xb27c('0x7d')];_0x4a849b=_0x1ab840['parameters']['scriptPath'];if('undefined'!=typeof _0x1ab840[_0xb27c('0x76')][_0xb27c('0x7a')]){if(_0xb27c('0x72')!=typeof _0x1ab840['parameters'][_0xb27c('0x7a')]['admin']){var _0x2d3c3e=_0x1ab840[_0xb27c('0x76')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2d3c3e)){_0x4522fb=path[_0xb27c('0x4a')]('plugins',_0x48feb5,_0x2bbdc3[0x0],_0x2d3c3e);}else{_0x4522fb=_0x2d3c3e;}}if(_0xb27c('0x72')!=typeof _0x1ab840[_0xb27c('0x76')][_0xb27c('0x7a')][_0xb27c('0x7b')]){var _0x462606=_0x1ab840[_0xb27c('0x76')][_0xb27c('0x7a')][_0xb27c('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb27c('0x88')](_0x462606)){_0x15436c=path[_0xb27c('0x4a')](_0xb27c('0x89'),_0x48feb5,_0x2bbdc3[0x0],_0x462606);}else{_0x15436c=_0x462606;}}}}var _0x410f17={'name':_0xa4bf35,'description':_0x18991a,'path':path['join'](_0x48feb5,_0x2bbdc3[0x0]),'type':_0x2db8a1,'sidebar':_0x3b7ffa,'icon':_0x61482b,'adminUrl':_0x4522fb,'agentUrl':_0x15436c,'scriptName':_0x51479f,'scriptPath':_0x4a849b,'version':_0x1dd519};removeReferences(_0x3fafa9,null);return db[_0xb27c('0x43')][_0xb27c('0x8b')](_0x410f17)[_0xb27c('0x28')](function(_0x2b07f3){var _0x42ada4={'role':_0x3350f6['body']['role'],'userProfileId':_0x3350f6['body'][_0xb27c('0x8c')]};if(!_0x42ada4)throw new Error(_0xb27c('0x8d'));if(_0x42ada4[_0xb27c('0x8e')]===_0xb27c('0x8f')){var _0x11ca54=_0x2b07f3['get']({'plain':!![]});return db[_0xb27c('0x90')][_0xb27c('0x49')]({'where':{'name':_0xb27c('0x91'),'userProfileId':_0x42ada4[_0xb27c('0x8c')]},'raw':!![]})[_0xb27c('0x28')](function(_0x3d3013){if(_0x3d3013&&_0x3d3013[_0xb27c('0x92')]===0x0){return db['UserProfileResource'][_0xb27c('0x8b')]({'name':_0x11ca54[_0xb27c('0x2e')],'resourceId':_0x11ca54['id'],'type':_0x3d3013[_0xb27c('0x2e')],'sectionId':_0x3d3013['id']},{})['then'](function(){return _0x2b07f3;});}else{return _0x2b07f3;}})[_0xb27c('0x45')](function(_0x466b02){logger[_0xb27c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x466b02);throw _0x466b02;});}return _0x2b07f3;})[_0xb27c('0x28')](respondWithResult(_0x1ef8c3,null))[_0xb27c('0x45')](handleError(_0x1ef8c3,null));}});}catch(_0x5d8ff3){_0x1ef8c3['status'](0x1f4)[_0xb27c('0x2f')](_0x5d8ff3);}};function removeReferences(_0x3100b9,_0x27ea70){try{if(_0x3100b9){fs[_0xb27c('0x60')](_0x3100b9);logger[_0xb27c('0x66')](_0xb27c('0x93'));}if(_0x27ea70){rimraf(_0x27ea70,function(){});logger[_0xb27c('0x66')](_0xb27c('0x94'));}}catch(_0x4a2873){logger[_0xb27c('0x2c')](_0x4a2873);}}exports[_0xb27c('0x95')]=function(_0xea2614,_0x4b3960,_0x1dc775){return db[_0xb27c('0x43')][_0xb27c('0x49')]({'where':{'id':_0xea2614[_0xb27c('0x46')]['id']}})[_0xb27c('0x28')](handleEntityNotFound(_0x4b3960,null))['then'](saveUpdates(_0xea2614[_0xb27c('0x96')],null))['then'](respondWithResult(_0x4b3960,null))[_0xb27c('0x45')](handleError(_0x4b3960,null));};exports['delete']=function(_0x56c2c7,_0x404451,_0x2f5a11){return db[_0xb27c('0x43')]['find']({'where':{'id':_0x56c2c7[_0xb27c('0x46')]['id']}})['then'](function(_0x5608d6){if(_0x5608d6){return _0x5608d6[_0xb27c('0x29')]();}})['then'](function(_0x4516fd){rimraf(path[_0xb27c('0x4a')](config[_0xb27c('0x57')],_0xb27c('0x4b'),path[_0xb27c('0x58')](_0x4516fd['path'])),function(){});return _0x4516fd;})[_0xb27c('0x28')](handleEntityNotFound(_0x404451,null))[_0xb27c('0x28')](respondWithStatusCode(_0x404451,null))[_0xb27c('0x45')](handleError(_0x404451,null));};exports[_0xb27c('0x97')]=function(_0x1d5080,_0x461230,_0x1c44bd){return BPromise[_0xb27c('0x98')]()[_0xb27c('0x28')](function(){if(!_0x1d5080[_0xb27c('0x34')][_0xb27c('0x7')]){throw new Error(_0xb27c('0x99'));}if(!_0x1d5080[_0xb27c('0x34')][_0xb27c('0x9a')]){throw new Error(_0xb27c('0x9b'));}var _0x1bdce6=_0x1d5080[_0xb27c('0x34')]['hostname']?_0x1d5080['query'][_0xb27c('0x9c')]+':'+_0x1d5080[_0xb27c('0x34')]['port']:'http://localhost:'+_0x1d5080[_0xb27c('0x34')][_0xb27c('0x9a')];var _0x316ecd=_0x1d5080[_0xb27c('0x34')][_0xb27c('0x24')]?_0x1d5080['query'][_0xb27c('0x24')]:!![];var _0x337fc8=_0x1d5080[_0xb27c('0x34')][_0xb27c('0x9d')]?_0x1d5080[_0xb27c('0x34')][_0xb27c('0x9d')]:null;var _0xf25347={'method':_0x1d5080[_0xb27c('0x9e')],'uri':util[_0xb27c('0x5e')](_0xb27c('0x9f'),_0x1bdce6,_0x1d5080[_0xb27c('0x34')][_0xb27c('0x7')]),'json':_0x316ecd,'resolveWithFullResponse':!![],'encoding':_0x337fc8,'qs':_0x1d5080[_0xb27c('0x34')]};if(_0x1d5080['headers']){_0xf25347[_0xb27c('0xa0')]=_0x1d5080[_0xb27c('0xa0')];if(_0xf25347['headers'][_0xb27c('0xa1')]){delete _0xf25347[_0xb27c('0xa0')][_0xb27c('0xa1')];}}if(_0xf25347[_0xb27c('0xa0')][_0xb27c('0xa2')]){delete _0xf25347[_0xb27c('0xa0')]['content-type'];}return rp(_0xf25347);})[_0xb27c('0x28')](function(_0x327094){if(_0x327094){_0x461230[_0xb27c('0xa3')](_0x327094[_0xb27c('0xa0')]);logger['info'](_0x327094['body']);if(_['endsWith'](_0x1d5080[_0xb27c('0x34')][_0xb27c('0x7')],_0xb27c('0x5d'))&&_0x327094['statusCode']==0x1f4){return _0x461230[_0xb27c('0xa4')](_0x327094[_0xb27c('0xa5')]);}else{return _0x461230[_0xb27c('0x20')](_0x327094['statusCode'])[_0xb27c('0x2f')](_0x327094['body']);}}else{return _0x461230[_0xb27c('0xa4')](0xc8);}})[_0xb27c('0x45')](handleError(_0x461230,null));};exports[_0xb27c('0xa6')]=function(_0x5d86da,_0x3fb4a6,_0x3f8e6b){return BPromise[_0xb27c('0x98')]()[_0xb27c('0x28')](function(){if(!_0x5d86da[_0xb27c('0x34')][_0xb27c('0x7')]){throw new Error(_0xb27c('0x99'));}if(!_0x5d86da[_0xb27c('0x34')][_0xb27c('0x9a')]){throw new Error(_0xb27c('0x9b'));}var _0xef38fa=_0x5d86da[_0xb27c('0x34')][_0xb27c('0x9c')]?_0x5d86da['query']['hostname']+':'+_0x5d86da[_0xb27c('0x34')][_0xb27c('0x9a')]:_0xb27c('0xa7')+_0x5d86da[_0xb27c('0x34')]['port'];var _0x394b6d=_0x5d86da[_0xb27c('0x34')]['json']?_0x5d86da[_0xb27c('0x34')]['json']:!![];var _0x129cba=_0x5d86da[_0xb27c('0x34')]['encoding']?_0x5d86da['query'][_0xb27c('0x9d')]:null;var _0x345058={'method':_0x5d86da[_0xb27c('0x9e')],'uri':util[_0xb27c('0x5e')](_0xb27c('0x9f'),_0xef38fa,_0x5d86da[_0xb27c('0x34')][_0xb27c('0x7')]),'json':_0x394b6d,'resolveWithFullResponse':!![],'encoding':_0x129cba,'body':_0x5d86da[_0xb27c('0x96')]};if(_0x5d86da[_0xb27c('0xa0')]){_0x345058[_0xb27c('0xa0')]=_0x5d86da[_0xb27c('0xa0')];if(_0x345058[_0xb27c('0xa0')][_0xb27c('0xa1')]){delete _0x345058[_0xb27c('0xa0')][_0xb27c('0xa1')];}}if(_0x345058[_0xb27c('0xa0')][_0xb27c('0xa2')]){delete _0x345058['headers'][_0xb27c('0xa2')];}return rp(_0x345058);})[_0xb27c('0x28')](function(_0x34a0fd){if(_0x34a0fd){_0x3fb4a6[_0xb27c('0xa3')](_0x34a0fd[_0xb27c('0xa0')]);logger[_0xb27c('0x66')](_0x34a0fd[_0xb27c('0x96')]);return _0x3fb4a6[_0xb27c('0x20')](_0x34a0fd[_0xb27c('0xa5')])['send'](_0x34a0fd[_0xb27c('0x96')]);}else{return _0x3fb4a6[_0xb27c('0xa4')](0xc8);}})[_0xb27c('0x45')](handleError(_0x3fb4a6,null));}; \ No newline at end of file +var _0x0863=['extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Plugins','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','Plugin','includeAll','findAll','rows','include','find','catch','download','params','root','server/files/plugins','format','%s.zip','createWriteStream','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','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','Invalid\x20manifest:\x20script\x20path\x20missing','description','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','html-pdf','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x39ad62,_0x3b2aa2){var _0x45a77b=function(_0xc6c6de){while(--_0xc6c6de){_0x39ad62['push'](_0x39ad62['shift']());}};_0x45a77b(++_0x3b2aa2);}(_0x0863,0x143));var _0x3086=function(_0x24d727,_0x3d60d3){_0x24d727=_0x24d727-0x0;var _0x83a316=_0x0863[_0x24d727];return _0x83a316;};'use strict';var pdf=require(_0x3086('0x0'));var emlformat=require(_0x3086('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3086('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3086('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3086('0x4'));var util=require(_0x3086('0x5'));var path=require(_0x3086('0x6'));var sox=require(_0x3086('0x7'));var csv=require(_0x3086('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3086('0x9'));var squel=require(_0x3086('0xa'));var crypto=require(_0x3086('0xb'));var jsforce=require(_0x3086('0xc'));var deskjs=require(_0x3086('0xd'));var toCsv=require(_0x3086('0x8'));var querystring=require('querystring');var Papa=require(_0x3086('0xe'));var extract=require(_0x3086('0xf'));var rimraf=require('rimraf');var archiver=require(_0x3086('0x10'));var Redis=require(_0x3086('0x11'));var authService=require(_0x3086('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3086('0x13'));var logger=require(_0x3086('0x14'))(_0x3086('0x15'));var utils=require(_0x3086('0x16'));var config=require(_0x3086('0x17'));var db=require(_0x3086('0x18'))['db'];config[_0x3086('0x19')]=_[_0x3086('0x1a')](config['redis'],{'host':_0x3086('0x1b'),'port':0x18eb});var socket=require(_0x3086('0x1c'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x1fadc6,_0x24e1eb){_0x24e1eb=_0x24e1eb||0xcc;return function(_0x2f0e63){if(_0x2f0e63){return _0x1fadc6[_0x3086('0x1d')](_0x24e1eb);}return _0x1fadc6[_0x3086('0x1e')](_0x24e1eb)[_0x3086('0x1f')]();};}function respondWithResult(_0xcff7b1,_0x44d9ee){_0x44d9ee=_0x44d9ee||0xc8;return function(_0x493e8f){if(_0x493e8f){return _0xcff7b1[_0x3086('0x1e')](_0x44d9ee)['json'](_0x493e8f);}};}function respondWithFilteredResult(_0x41a16a,_0x2ba0d4){return function(_0x54218b){if(_0x54218b){var _0x32122f=_0x54218b[_0x3086('0x20')],_0xb406bb=_0x2ba0d4['offset'],_0x4cc9a5=_0x2ba0d4[_0x3086('0x21')]+_0x2ba0d4[_0x3086('0x22')],_0x3433b2;if(_0x4cc9a5>=_0x32122f){_0x4cc9a5=_0x32122f;_0x3433b2=0xc8;}else{_0x3433b2=0xce;}_0x41a16a[_0x3086('0x1e')](_0x3433b2);return _0x41a16a[_0x3086('0x23')](_0x3086('0x24'),_0xb406bb+'-'+_0x4cc9a5+'/'+_0x32122f)[_0x3086('0x25')](_0x54218b);}return null;};}function patchUpdates(_0x67f5f0){return function(_0x382787){try{jsonpatch[_0x3086('0x26')](_0x382787,_0x67f5f0,!![]);}catch(_0x476877){return BPromise[_0x3086('0x27')](_0x476877);}return _0x382787[_0x3086('0x28')]();};}function saveUpdates(_0x8a19d1,_0x556a96){return function(_0x588764){if(_0x588764){return _0x588764[_0x3086('0x29')](_0x8a19d1)['then'](function(_0x237f40){return _0x237f40;});}return null;};}function removeEntity(_0x1a3ed8,_0x21b6dc){return function(_0x5af905){if(_0x5af905){return _0x5af905[_0x3086('0x2a')]()[_0x3086('0x2b')](function(){var _0x53e238=_0x5af905[_0x3086('0x2c')]({'plain':!![]});var _0xe00cd1=_0x3086('0x2d');return db['UserProfileResource'][_0x3086('0x2a')]({'where':{'type':_0xe00cd1,'resourceId':_0x53e238['id']}})[_0x3086('0x2b')](function(){return _0x5af905;});})[_0x3086('0x2b')](function(){_0x1a3ed8[_0x3086('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6dc09f,_0x36d423){return function(_0x4d105a){if(!_0x4d105a){_0x6dc09f[_0x3086('0x1d')](0x194);}return _0x4d105a;};}function handleError(_0x1f03bb,_0xd699b0){_0xd699b0=_0xd699b0||0x1f4;return function(_0x888ecd){logger[_0x3086('0x2e')](_0x888ecd['stack']);if(_0x888ecd['name']){delete _0x888ecd[_0x3086('0x2f')];}_0x1f03bb['status'](_0xd699b0)[_0x3086('0x30')](_0x888ecd);};}exports[_0x3086('0x31')]=function(_0x77109c,_0x21551f){var _0x41d6ee={},_0x39f438={},_0x2b3867={'count':0x0,'rows':[]};var _0x5015f4=_[_0x3086('0x32')](db['Plugin'][_0x3086('0x33')],function(_0x54bb05){return{'name':_0x54bb05[_0x3086('0x34')],'type':_0x54bb05['type']['key']};});_0x39f438[_0x3086('0x35')]=_[_0x3086('0x32')](_0x5015f4,_0x3086('0x2f'));_0x39f438[_0x3086('0x36')]=_[_0x3086('0x37')](_0x77109c[_0x3086('0x36')]);_0x39f438['filters']=_[_0x3086('0x38')](_0x39f438['model'],_0x39f438[_0x3086('0x36')]);_0x41d6ee[_0x3086('0x39')]=_[_0x3086('0x38')](_0x39f438['model'],qs[_0x3086('0x3a')](_0x77109c[_0x3086('0x36')]['fields']));_0x41d6ee[_0x3086('0x39')]=_0x41d6ee[_0x3086('0x39')][_0x3086('0x3b')]?_0x41d6ee[_0x3086('0x39')]:_0x39f438['model'];if(!_0x77109c[_0x3086('0x36')][_0x3086('0x3c')](_0x3086('0x3d'))){_0x41d6ee['limit']=qs[_0x3086('0x22')](_0x77109c[_0x3086('0x36')][_0x3086('0x22')]);_0x41d6ee[_0x3086('0x21')]=qs[_0x3086('0x21')](_0x77109c[_0x3086('0x36')][_0x3086('0x21')]);}_0x41d6ee[_0x3086('0x3e')]=qs['sort'](_0x77109c[_0x3086('0x36')][_0x3086('0x3f')]);_0x41d6ee[_0x3086('0x40')]=qs[_0x3086('0x41')](_[_0x3086('0x42')](_0x77109c[_0x3086('0x36')],_0x39f438['filters']),_0x5015f4);if(_0x77109c[_0x3086('0x36')][_0x3086('0x43')]){_0x41d6ee['where']=_[_0x3086('0x44')](_0x41d6ee[_0x3086('0x40')],{'$or':_[_0x3086('0x32')](_0x5015f4,function(_0x13eeba){if(_0x13eeba[_0x3086('0x45')]!==_0x3086('0x46')){var _0x36e890={};_0x36e890[_0x13eeba[_0x3086('0x2f')]]={'$like':'%'+_0x77109c['query'][_0x3086('0x43')]+'%'};return _0x36e890;}})});}_0x41d6ee=_[_0x3086('0x44')]({},_0x41d6ee,_0x77109c[_0x3086('0x47')]);var _0x42eb42={'where':_0x41d6ee[_0x3086('0x40')]};return db[_0x3086('0x48')]['count'](_0x42eb42)['then'](function(_0x3abb67){_0x2b3867[_0x3086('0x20')]=_0x3abb67;if(_0x77109c[_0x3086('0x36')][_0x3086('0x49')]){_0x41d6ee['include']=[{'all':!![]}];}return db['Plugin'][_0x3086('0x4a')](_0x41d6ee);})[_0x3086('0x2b')](function(_0x9f9bb0){_0x2b3867[_0x3086('0x4b')]=_0x9f9bb0;return _0x2b3867;})[_0x3086('0x2b')](respondWithFilteredResult(_0x21551f,_0x41d6ee))['catch'](handleError(_0x21551f,null));};exports['show']=function(_0x10abe1,_0x1b6829){var _0x3766c4={'raw':!![],'where':{'id':_0x10abe1['params']['id']}},_0x25f14a={};_0x25f14a[_0x3086('0x35')]=_['keys'](db[_0x3086('0x48')]['rawAttributes']);_0x25f14a[_0x3086('0x36')]=_[_0x3086('0x37')](_0x10abe1[_0x3086('0x36')]);_0x25f14a['filters']=_[_0x3086('0x38')](_0x25f14a[_0x3086('0x35')],_0x25f14a[_0x3086('0x36')]);_0x3766c4[_0x3086('0x39')]=_[_0x3086('0x38')](_0x25f14a['model'],qs[_0x3086('0x3a')](_0x10abe1['query'][_0x3086('0x3a')]));_0x3766c4[_0x3086('0x39')]=_0x3766c4[_0x3086('0x39')][_0x3086('0x3b')]?_0x3766c4[_0x3086('0x39')]:_0x25f14a['model'];if(_0x10abe1[_0x3086('0x36')][_0x3086('0x49')]){_0x3766c4[_0x3086('0x4c')]=[{'all':!![]}];}_0x3766c4=_[_0x3086('0x44')]({},_0x3766c4,_0x10abe1['options']);return db[_0x3086('0x48')][_0x3086('0x4d')](_0x3766c4)['then'](handleEntityNotFound(_0x1b6829,null))['then'](respondWithResult(_0x1b6829,null))[_0x3086('0x4e')](handleError(_0x1b6829,null));};exports[_0x3086('0x4f')]=function(_0x47b42b,_0x3c7cb9,_0x394d00){return db[_0x3086('0x48')][_0x3086('0x4d')]({'where':{'id':_0x47b42b[_0x3086('0x50')]['id']},'attributes':['name',_0x3086('0x6')],'raw':!![]})[_0x3086('0x2b')](handleEntityNotFound(_0x3c7cb9,null))[_0x3086('0x2b')](function(_0x1d0456){if(_0x1d0456){var _0x3730d0=path['join'](config[_0x3086('0x51')],_0x3086('0x52'),util[_0x3086('0x53')](_0x3086('0x54'),path['basename'](_0x1d0456[_0x3086('0x6')])));var _0x29c991=fs[_0x3086('0x55')](_0x3730d0);var _0x579090=archiver('zip',{'zlib':{'level':0x9}});_0x579090['on'](_0x3086('0x56'),function(_0x4382b6){if(_0x4382b6['code']==='ENOENT'){logger[_0x3086('0x2e')](_0x4382b6);}else{throw new db[(_0x3086('0x57'))][(_0x3086('0x58'))](_0x3086('0x59'));}});_0x579090['on']('error',function(_0x127b44){throw new db[(_0x3086('0x57'))][(_0x3086('0x58'))](_0x3086('0x59'));});_0x579090[_0x3086('0x5a')](_0x29c991);_0x579090[_0x3086('0x5b')](_0x3086('0x5c'),{'cwd':path[_0x3086('0x5d')](config[_0x3086('0x51')],_0x3086('0x52'),path['dirname'](_0x1d0456[_0x3086('0x6')])),'ignore':[path[_0x3086('0x5d')](path[_0x3086('0x5e')](_0x1d0456['path']),_0x3086('0x5f')),path['join'](path[_0x3086('0x5e')](_0x1d0456[_0x3086('0x6')]),_0x3086('0x60'))],'nodir':!![]})[_0x3086('0x61')]();_0x29c991['on'](_0x3086('0x62'),function(){if(!fs[_0x3086('0x63')](_0x3730d0)){throw new db[(_0x3086('0x57'))]['Error'](_0x3086('0x64'));}return _0x3c7cb9['download'](_0x3730d0,util[_0x3086('0x53')](_0x3086('0x54'),path[_0x3086('0x5e')](_0x1d0456[_0x3086('0x6')])),function(_0x367a29){if(_0x367a29){throw new db[(_0x3086('0x57'))]['Error'](_0x3086('0x65'));}fs['unlinkSync'](_0x3730d0);logger[_0x3086('0x66')](_0x3086('0x67'));logger[_0x3086('0x66')](_0x3086('0x68'));});});}return null;})[_0x3086('0x4e')](handleError(_0x3c7cb9,null));};exports[_0x3086('0x69')]=function(_0x55e0c2,_0x3431d6,_0x90f099){var _0x27e07e=path[_0x3086('0x5e')](_0x55e0c2[_0x3086('0x6a')]['filename'],path['extname'](_0x55e0c2[_0x3086('0x6a')]['filename']));var _0x503d12=path[_0x3086('0x5d')](config[_0x3086('0x51')],_0x3086('0x52'),_0x55e0c2[_0x3086('0x6a')][_0x3086('0x6b')]);var _0x416973=path[_0x3086('0x5d')](config[_0x3086('0x51')],_0x3086('0x52'),_0x27e07e);logger[_0x3086('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x503d12);logger[_0x3086('0x66')]('Plugin\x20upload\x20destination:\x20%s',_0x416973);try{fs[_0x3086('0x6c')](_0x503d12,parseInt(_0x3086('0x6d'),0x8));extract(_0x503d12,{'dir':_0x416973},function(_0x48ac81){if(_0x48ac81){logger[_0x3086('0x2e')](_0x48ac81);handleError(_0x48ac81,!![]);};var _0x5476d4=fs[_0x3086('0x6e')](_0x416973);if(_0x5476d4[_0x3086('0x3b')]>0x1){removeReferences(_0x503d12,_0x416973);logger['error']('Invalid\x20plugin\x20structure');return _0x90f099(new Error(_0x3086('0x6f')));}var _0x747a8a=fs[_0x3086('0x70')](path[_0x3086('0x5d')](_0x416973,_0x5476d4[0x0]));if(_0x747a8a['isFile']()){removeReferences(_0x503d12,_0x416973);logger['error'](_0x3086('0x6f'));return _0x90f099(new Error('Invalid\x20plugin\x20structure'));}if(_0x747a8a[_0x3086('0x71')]()){var _0x43a2a7=fs[_0x3086('0x6e')](path['join'](_0x416973,_0x5476d4[0x0]));if(_0x43a2a7['length']===0x0){removeReferences(_0x503d12,_0x416973);logger[_0x3086('0x2e')](_0x3086('0x6f'));return _0x90f099(new Error(_0x3086('0x6f')));}var _0x7f37bc=_0x43a2a7[_0x3086('0x72')](function(_0x548e0d){return _0x548e0d===_0x3086('0x73');});if(!_0x7f37bc){return _0x90f099(new Error('Plugin\x20manifest\x20missing'));}var _0x3fec42=fs['readFileSync'](path[_0x3086('0x5d')](_0x416973,_0x5476d4[0x0],_0x3086('0x73')));var _0x3dcb81=JSON[_0x3086('0x74')](_0x3fec42);if(_0x3086('0x75')==typeof _0x3dcb81['name']){return _0x90f099(new Error(_0x3086('0x76')));}if(_0x3086('0x75')==typeof _0x3dcb81[_0x3086('0x45')]){return _0x90f099(new Error(_0x3086('0x77')));}if(_0x3086('0x75')==typeof _0x3dcb81[_0x3086('0x78')]){return _0x90f099(new Error(_0x3086('0x79')));}if(_0x3086('0x75')==typeof _0x3dcb81[_0x3086('0x7a')]){return _0x90f099(new Error(_0x3086('0x7b')));}if(_0x3dcb81[_0x3086('0x45')]===_0x3086('0x7c')){if(_0x3086('0x75')==typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')]){return _0x90f099(new Error(_0x3086('0x7e')));}if(_0x3086('0x75')==typeof _0x3dcb81['parameters']['views'][_0x3086('0x7f')]&&_0x3086('0x75')==typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')][_0x3086('0x80')]){return _0x90f099(new Error(_0x3086('0x81')));}}else if(_0x3dcb81[_0x3086('0x45')]===_0x3086('0x82')){if('undefined'==typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x83')]){return _0x90f099(new Error(_0x3086('0x84')));}if(_0x3086('0x75')==typeof _0x3dcb81[_0x3086('0x7a')]['scriptPath']){return _0x90f099(new Error(_0x3086('0x85')));}}else{return _0x90f099(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x26e7ef=_0x3dcb81[_0x3086('0x2f')];var _0x526a9c=_0x3dcb81[_0x3086('0x86')];var _0x562c3a=_0x3dcb81[_0x3086('0x45')];var _0x242c1e=_0x3dcb81['sidebar']?_0x3dcb81['sidebar']:_0x3086('0x87');var _0x59cac3=_0x3dcb81[_0x3086('0x88')]?_0x3dcb81[_0x3086('0x88')]:'icon-apps';var _0xc82f01='';var _0x52176a='';var _0x468e73='';var _0x360c94='';var _0x563de4=_0x3dcb81[_0x3086('0x78')];if(_0x562c3a===_0x3086('0x7c')){if('undefined'!=typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')][_0x3086('0x7f')]){var _0x12ee8f=_0x3dcb81[_0x3086('0x7a')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3086('0x89')](_0x12ee8f)){_0xc82f01=path['join'](_0x3086('0x8a'),_0x27e07e,_0x5476d4[0x0],_0x12ee8f);}else{_0xc82f01=_0x12ee8f;}}else{logger[_0x3086('0x66')](_0x3086('0x8b'));}if(_0x3086('0x75')!=typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')][_0x3086('0x80')]){var _0x424aa8=_0x3dcb81['parameters'][_0x3086('0x7d')][_0x3086('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x424aa8)){_0x52176a=path['join'](_0x3086('0x8a'),_0x27e07e,_0x5476d4[0x0],_0x424aa8);}else{_0x52176a=_0x424aa8;}}else{logger[_0x3086('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x562c3a===_0x3086('0x82')){_0x468e73=_0x3dcb81[_0x3086('0x7a')][_0x3086('0x83')];_0x360c94=_0x3dcb81[_0x3086('0x7a')][_0x3086('0x8c')];if(_0x3086('0x75')!=typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')]){if('undefined'!=typeof _0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')][_0x3086('0x7f')]){var _0x12ee8f=_0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')][_0x3086('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x3086('0x89')](_0x12ee8f)){_0xc82f01=path[_0x3086('0x5d')]('plugins',_0x27e07e,_0x5476d4[0x0],_0x12ee8f);}else{_0xc82f01=_0x12ee8f;}}if(_0x3086('0x75')!=typeof _0x3dcb81['parameters'][_0x3086('0x7d')]['agent']){var _0x424aa8=_0x3dcb81[_0x3086('0x7a')][_0x3086('0x7d')][_0x3086('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x3086('0x89')](_0x424aa8)){_0x52176a=path[_0x3086('0x5d')](_0x3086('0x8a'),_0x27e07e,_0x5476d4[0x0],_0x424aa8);}else{_0x52176a=_0x424aa8;}}}}var _0x3dd481={'name':_0x26e7ef,'description':_0x526a9c,'path':path[_0x3086('0x5d')](_0x27e07e,_0x5476d4[0x0]),'type':_0x562c3a,'sidebar':_0x242c1e,'icon':_0x59cac3,'adminUrl':_0xc82f01,'agentUrl':_0x52176a,'scriptName':_0x468e73,'scriptPath':_0x360c94,'version':_0x563de4};removeReferences(_0x503d12,null);return db[_0x3086('0x48')][_0x3086('0x8d')](_0x3dd481)['then'](function(_0x39451a){var _0x3d6c67={'role':_0x55e0c2[_0x3086('0x8e')][_0x3086('0x8f')],'userProfileId':_0x55e0c2[_0x3086('0x8e')][_0x3086('0x90')]};if(!_0x3d6c67)throw new Error(_0x3086('0x91'));if(_0x3d6c67[_0x3086('0x8f')]==='user'){var _0x2a1649=_0x39451a[_0x3086('0x2c')]({'plain':!![]});return db[_0x3086('0x92')][_0x3086('0x4d')]({'where':{'name':_0x3086('0x2d'),'userProfileId':_0x3d6c67[_0x3086('0x90')]},'raw':!![]})[_0x3086('0x2b')](function(_0xefb2bf){if(_0xefb2bf&&_0xefb2bf[_0x3086('0x93')]===0x0){return db['UserProfileResource'][_0x3086('0x8d')]({'name':_0x2a1649[_0x3086('0x2f')],'resourceId':_0x2a1649['id'],'type':_0xefb2bf['name'],'sectionId':_0xefb2bf['id']},{})[_0x3086('0x2b')](function(){return _0x39451a;});}else{return _0x39451a;}})[_0x3086('0x4e')](function(_0x1ee3b7){logger[_0x3086('0x2e')](_0x3086('0x94'),_0x1ee3b7);throw _0x1ee3b7;});}return _0x39451a;})['then'](respondWithResult(_0x3431d6,null))[_0x3086('0x4e')](handleError(_0x3431d6,null));}});}catch(_0x17076b){_0x3431d6[_0x3086('0x1e')](0x1f4)['send'](_0x17076b);}};function removeReferences(_0x44957c,_0x29242e){try{if(_0x44957c){fs[_0x3086('0x95')](_0x44957c);logger[_0x3086('0x66')](_0x3086('0x96'));}if(_0x29242e){rimraf(_0x29242e,function(){});logger[_0x3086('0x66')](_0x3086('0x97'));}}catch(_0x3671d0){logger['error'](_0x3671d0);}}exports[_0x3086('0x29')]=function(_0x415add,_0x4ccfff,_0x2acabb){return db[_0x3086('0x48')][_0x3086('0x4d')]({'where':{'id':_0x415add[_0x3086('0x50')]['id']}})[_0x3086('0x2b')](handleEntityNotFound(_0x4ccfff,null))[_0x3086('0x2b')](saveUpdates(_0x415add['body'],null))[_0x3086('0x2b')](respondWithResult(_0x4ccfff,null))[_0x3086('0x4e')](handleError(_0x4ccfff,null));};exports[_0x3086('0x98')]=function(_0x43246e,_0xfd5418,_0x319b81){return db['Plugin'][_0x3086('0x4d')]({'where':{'id':_0x43246e['params']['id']}})['then'](function(_0x5ee60a){if(_0x5ee60a){return _0x5ee60a['destroy']();}})['then'](function(_0xef6d39){rimraf(path[_0x3086('0x5d')](config[_0x3086('0x51')],_0x3086('0x52'),path['dirname'](_0xef6d39['path'])),function(){});return _0xef6d39;})[_0x3086('0x2b')](handleEntityNotFound(_0xfd5418,null))[_0x3086('0x2b')](respondWithStatusCode(_0xfd5418,null))[_0x3086('0x4e')](handleError(_0xfd5418,null));};exports[_0x3086('0x99')]=function(_0x493f23,_0x568421,_0x4703b8){return BPromise[_0x3086('0x9a')]()['then'](function(){if(!_0x493f23['query']['path']){throw new Error(_0x3086('0x9b'));}if(!_0x493f23[_0x3086('0x36')][_0x3086('0x9c')]){throw new Error(_0x3086('0x9d'));}var _0xbe5680=_0x493f23[_0x3086('0x36')][_0x3086('0x9e')]?_0x493f23['query'][_0x3086('0x9e')]+':'+_0x493f23[_0x3086('0x36')]['port']:_0x3086('0x9f')+_0x493f23[_0x3086('0x36')]['port'];var _0x844c47=_0x493f23[_0x3086('0x36')][_0x3086('0x25')]?_0x493f23[_0x3086('0x36')][_0x3086('0x25')]:!![];var _0x476b23=_0x493f23[_0x3086('0x36')]['encoding']?_0x493f23[_0x3086('0x36')][_0x3086('0xa0')]:null;var _0x56989c={'method':_0x493f23[_0x3086('0xa1')],'uri':util[_0x3086('0x53')](_0x3086('0xa2'),_0xbe5680,_0x493f23[_0x3086('0x36')]['path']),'json':_0x844c47,'resolveWithFullResponse':!![],'encoding':_0x476b23,'qs':_0x493f23['query']};if(_0x493f23[_0x3086('0xa3')]){_0x56989c[_0x3086('0xa3')]=_0x493f23['headers'];if(_0x56989c['headers'][_0x3086('0xa4')]){delete _0x56989c[_0x3086('0xa3')][_0x3086('0xa4')];}}if(_0x56989c[_0x3086('0xa3')][_0x3086('0xa5')]){delete _0x56989c[_0x3086('0xa3')][_0x3086('0xa5')];}return rp(_0x56989c);})[_0x3086('0x2b')](function(_0x9412a1){if(_0x9412a1){_0x568421[_0x3086('0x23')](_0x9412a1[_0x3086('0xa3')]);logger[_0x3086('0x66')](_0x9412a1[_0x3086('0x8e')]);if(_[_0x3086('0xa6')](_0x493f23[_0x3086('0x36')][_0x3086('0x6')],_0x3086('0x4f'))&&_0x9412a1[_0x3086('0xa7')]==0x1f4){return _0x568421[_0x3086('0x1d')](_0x9412a1[_0x3086('0xa7')]);}else{return _0x568421[_0x3086('0x1e')](_0x9412a1['statusCode'])[_0x3086('0x30')](_0x9412a1[_0x3086('0x8e')]);}}else{return _0x568421[_0x3086('0x1d')](0xc8);}})[_0x3086('0x4e')](handleError(_0x568421,null));};exports[_0x3086('0xa8')]=function(_0x12a5dc,_0x293bc9,_0xad7f5d){return BPromise[_0x3086('0x9a')]()[_0x3086('0x2b')](function(){if(!_0x12a5dc[_0x3086('0x36')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x12a5dc[_0x3086('0x36')][_0x3086('0x9c')]){throw new Error(_0x3086('0x9d'));}var _0x37a279=_0x12a5dc['query'][_0x3086('0x9e')]?_0x12a5dc[_0x3086('0x36')][_0x3086('0x9e')]+':'+_0x12a5dc[_0x3086('0x36')][_0x3086('0x9c')]:_0x3086('0x9f')+_0x12a5dc[_0x3086('0x36')]['port'];var _0xe0839c=_0x12a5dc[_0x3086('0x36')][_0x3086('0x25')]?_0x12a5dc[_0x3086('0x36')][_0x3086('0x25')]:!![];var _0x3abf3c=_0x12a5dc[_0x3086('0x36')][_0x3086('0xa0')]?_0x12a5dc[_0x3086('0x36')]['encoding']:null;var _0x36d64d={'method':_0x12a5dc[_0x3086('0xa1')],'uri':util[_0x3086('0x53')](_0x3086('0xa2'),_0x37a279,_0x12a5dc[_0x3086('0x36')]['path']),'json':_0xe0839c,'resolveWithFullResponse':!![],'encoding':_0x3abf3c,'body':_0x12a5dc[_0x3086('0x8e')]};if(_0x12a5dc[_0x3086('0xa3')]){_0x36d64d['headers']=_0x12a5dc[_0x3086('0xa3')];if(_0x36d64d['headers'][_0x3086('0xa4')]){delete _0x36d64d['headers'][_0x3086('0xa4')];}}if(_0x36d64d[_0x3086('0xa3')][_0x3086('0xa5')]){delete _0x36d64d[_0x3086('0xa3')][_0x3086('0xa5')];}return rp(_0x36d64d);})['then'](function(_0x14d381){if(_0x14d381){_0x293bc9[_0x3086('0x23')](_0x14d381[_0x3086('0xa3')]);logger[_0x3086('0x66')](_0x14d381['body']);return _0x293bc9[_0x3086('0x1e')](_0x14d381[_0x3086('0xa7')])[_0x3086('0x30')](_0x14d381['body']);}else{return _0x293bc9['sendStatus'](0xc8);}})[_0x3086('0x4e')](handleError(_0x293bc9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index bfa364c..24b6aee 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 _0xb145=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2c3f07,_0xe7f862){var _0x2e17e8=function(_0x25aa4d){while(--_0x25aa4d){_0x2c3f07['push'](_0x2c3f07['shift']());}};_0x2e17e8(++_0xe7f862);}(_0xb145,0xa3));var _0x5b14=function(_0x2aea53,_0x1d1257){_0x2aea53=_0x2aea53-0x0;var _0x2e9b7c=_0xb145[_0x2aea53];return _0x2e9b7c;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){PluginEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);PluginEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=PluginEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x2032,0xd9));var _0x2203=function(_0x277718,_0x839b4b){_0x277718=_0x277718-0x0;var _0x173270=_0x2032[_0x277718];return _0x173270;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){PluginEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);PluginEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Plugin[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('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 e94c3f6..98cb655 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 _0xfd28=['rimraf','./plugin.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x347e78,_0x2ba5c5){var _0x40f8fd=function(_0x4aed2e){while(--_0x4aed2e){_0x347e78['push'](_0x347e78['shift']());}};_0x40f8fd(++_0x2ba5c5);}(_0xfd28,0x148));var _0x8fd2=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xfd28[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['plugins','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin'];(function(_0x12fc0e,_0x4b758f){var _0x38c7d2=function(_0x46e229){while(--_0x46e229){_0x12fc0e['push'](_0x12fc0e['shift']());}};_0x38c7d2(++_0x4b758f);}(_0x34e8,0x12c));var _0x834e=function(_0xc39d16,_0x5721ba){_0xc39d16=_0xc39d16-0x0;var _0x5fab3d=_0x34e8[_0xc39d16];return _0x5fab3d;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 3898410..d3c0808 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 _0x7794=['CreatePlugin','Plugin','create','options','raw','stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2d3c09,_0x1c9541){var _0x156749=function(_0x491894){while(--_0x491894){_0x2d3c09['push'](_0x2d3c09['shift']());}};_0x156749(++_0x1c9541);}(_0x7794,0xe6));var _0x4779=function(_0x3d749c,_0x22096e){_0x3d749c=_0x3d749c-0x0;var _0x1ae9dd=_0x7794[_0x3d749c];return _0x1ae9dd;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4779('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4779('0x4'));var logger=require(_0x4779('0x5'))('rpc');var config=require(_0x4779('0x6'));var jayson=require(_0x4779('0x7'));var client=jayson[_0x4779('0x8')][_0x4779('0x9')]({'port':0x232a});config['redis']=_[_0x4779('0xa')](config[_0x4779('0xb')],{'host':_0x4779('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4779('0xb')]));require('./plugin.socket')[_0x4779('0xd')](socket);function respondWithRpcPromise(_0x1dd704,_0x32363d,_0x3c75e2){return new BPromise(function(_0x2a1556,_0x594b86){return client[_0x4779('0xe')](_0x1dd704,_0x3c75e2)[_0x4779('0xf')](function(_0x32c3bd){logger[_0x4779('0x10')](_0x4779('0x11'),_0x32363d,_0x4779('0x12'));logger[_0x4779('0x13')](_0x4779('0x14'),_0x32363d,_0x4779('0x12'),JSON['stringify'](_0x32c3bd));if(_0x32c3bd[_0x4779('0x15')]){if(_0x32c3bd[_0x4779('0x15')][_0x4779('0x16')]===0x1f4){logger[_0x4779('0x15')](_0x4779('0x11'),_0x32363d,_0x32c3bd[_0x4779('0x15')][_0x4779('0x17')]);return _0x594b86(_0x32c3bd[_0x4779('0x15')][_0x4779('0x17')]);}logger[_0x4779('0x15')](_0x4779('0x11'),_0x32363d,_0x32c3bd[_0x4779('0x15')]['message']);return _0x2a1556(_0x32c3bd[_0x4779('0x15')][_0x4779('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x32363d,'request\x20sent');_0x2a1556(_0x32c3bd[_0x4779('0x18')][_0x4779('0x17')]);}})[_0x4779('0x19')](function(_0x3cc4e9){logger[_0x4779('0x15')](_0x4779('0x11'),_0x32363d,_0x3cc4e9);_0x594b86(_0x3cc4e9);});});}exports[_0x4779('0x1a')]=function(_0x5205c6){var _0x4984e3=this;return new Promise(function(_0x11b02a,_0x87b42a){return db[_0x4779('0x1b')][_0x4779('0x1c')](_0x5205c6['body'],{'raw':_0x5205c6[_0x4779('0x1d')]?_0x5205c6[_0x4779('0x1d')][_0x4779('0x1e')]===undefined?!![]:![]:!![]})[_0x4779('0xf')](function(_0x43cc37){logger['info'](_0x4779('0x1a'),_0x5205c6);logger[_0x4779('0x13')](_0x4779('0x1a'),_0x5205c6,JSON[_0x4779('0x1f')](_0x43cc37));_0x11b02a(_0x43cc37);})[_0x4779('0x19')](function(_0x514c8e){logger['error'](_0x4779('0x1a'),_0x514c8e[_0x4779('0x17')],_0x5205c6);_0x87b42a(_0x4984e3[_0x4779('0x15')](0x1f4,_0x514c8e['message']));});});}; \ No newline at end of file +var _0x26fb=['./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3eac38,_0x480513){var _0x558b4a=function(_0xa47eec){while(--_0xa47eec){_0x3eac38['push'](_0x3eac38['shift']());}};_0x558b4a(++_0x480513);}(_0x26fb,0xc3));var _0xb26f=function(_0x2cc499,_0x305c3a){_0x2cc499=_0x2cc499-0x0;var _0x19c299=_0x26fb[_0x2cc499];return _0x19c299;};'use strict';var _=require(_0xb26f('0x0'));var util=require('util');var moment=require(_0xb26f('0x1'));var BPromise=require(_0xb26f('0x2'));var rs=require(_0xb26f('0x3'));var fs=require('fs');var Redis=require(_0xb26f('0x4'));var db=require(_0xb26f('0x5'))['db'];var utils=require(_0xb26f('0x6'));var logger=require(_0xb26f('0x7'))('rpc');var config=require(_0xb26f('0x8'));var jayson=require(_0xb26f('0x9'));var client=jayson['client'][_0xb26f('0xa')]({'port':0x232a});config[_0xb26f('0xb')]=_[_0xb26f('0xc')](config['redis'],{'host':_0xb26f('0xd'),'port':0x18eb});var socket=require(_0xb26f('0xe'))(new Redis(config[_0xb26f('0xb')]));require(_0xb26f('0xf'))[_0xb26f('0x10')](socket);function respondWithRpcPromise(_0xb52b38,_0x5c7bf0,_0x3f603e){return new BPromise(function(_0x458ef6,_0xb04b54){return client[_0xb26f('0x11')](_0xb52b38,_0x3f603e)[_0xb26f('0x12')](function(_0x2fbfc1){logger[_0xb26f('0x13')](_0xb26f('0x14'),_0x5c7bf0,'request\x20sent');logger[_0xb26f('0x15')](_0xb26f('0x16'),_0x5c7bf0,_0xb26f('0x17'),JSON['stringify'](_0x2fbfc1));if(_0x2fbfc1[_0xb26f('0x18')]){if(_0x2fbfc1[_0xb26f('0x18')][_0xb26f('0x19')]===0x1f4){logger[_0xb26f('0x18')]('Plugin,\x20%s,\x20%s',_0x5c7bf0,_0x2fbfc1['error']['message']);return _0xb04b54(_0x2fbfc1[_0xb26f('0x18')][_0xb26f('0x1a')]);}logger[_0xb26f('0x18')]('Plugin,\x20%s,\x20%s',_0x5c7bf0,_0x2fbfc1['error']['message']);return _0x458ef6(_0x2fbfc1[_0xb26f('0x18')][_0xb26f('0x1a')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x5c7bf0,'request\x20sent');_0x458ef6(_0x2fbfc1[_0xb26f('0x1b')][_0xb26f('0x1a')]);}})[_0xb26f('0x1c')](function(_0x550d1d){logger[_0xb26f('0x18')]('Plugin,\x20%s,\x20%s',_0x5c7bf0,_0x550d1d);_0xb04b54(_0x550d1d);});});}exports[_0xb26f('0x1d')]=function(_0x19331b){var _0x26341f=this;return new Promise(function(_0x14f8d4,_0xc65b2a){return db[_0xb26f('0x1e')][_0xb26f('0x1f')](_0x19331b['body'],{'raw':_0x19331b[_0xb26f('0x20')]?_0x19331b[_0xb26f('0x20')][_0xb26f('0x21')]===undefined?!![]:![]:!![]})[_0xb26f('0x12')](function(_0x16a780){logger[_0xb26f('0x13')]('CreatePlugin',_0x19331b);logger[_0xb26f('0x15')](_0xb26f('0x1d'),_0x19331b,JSON[_0xb26f('0x22')](_0x16a780));_0x14f8d4(_0x16a780);})[_0xb26f('0x1c')](function(_0x52c30f){logger[_0xb26f('0x18')](_0xb26f('0x1d'),_0x52c30f[_0xb26f('0x1a')],_0x19331b);_0xc65b2a(_0x26341f[_0xb26f('0x18')](0x1f4,_0x52c30f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 56291a8..11e4c94 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 _0x21dc=['plugin:','./plugin.events','remove','update','removeListener','length'];(function(_0x36ec26,_0x4aa4de){var _0x1238ec=function(_0x47d51c){while(--_0x47d51c){_0x36ec26['push'](_0x36ec26['shift']());}};_0x1238ec(++_0x4aa4de);}(_0x21dc,0x151));var _0xc21d=function(_0x3b115f,_0x47c19b){_0x3b115f=_0x3b115f-0x0;var _0x2c5b83=_0x21dc[_0x3b115f];return _0x2c5b83;};'use strict';var PluginEvents=require(_0xc21d('0x0'));var events=['save',_0xc21d('0x1'),_0xc21d('0x2')];function createListener(_0x25ec88,_0x31b776){return function(_0x27e8b1){_0x31b776['emit'](_0x25ec88,_0x27e8b1);};}function removeListener(_0xb24ebb,_0x59bd33){return function(){PluginEvents[_0xc21d('0x3')](_0xb24ebb,_0x59bd33);};}exports['register']=function(_0x5c8c04){for(var _0x415782=0x0,_0x2386aa=events[_0xc21d('0x4')];_0x415782<_0x2386aa;_0x415782++){var _0x448ac7=events[_0x415782];var _0x277c37=createListener(_0xc21d('0x5')+_0x448ac7,_0x5c8c04);PluginEvents['on'](_0x448ac7,_0x277c37);}}; \ No newline at end of file +var _0x5aea=['emit','removeListener','register','plugin:','./plugin.events','save','update'];(function(_0x27250c,_0x3e6637){var _0x7e3095=function(_0x1bbce7){while(--_0x1bbce7){_0x27250c['push'](_0x27250c['shift']());}};_0x7e3095(++_0x3e6637);}(_0x5aea,0x131));var _0xa5ae=function(_0x4ff244,_0x500902){_0x4ff244=_0x4ff244-0x0;var _0x5307ca=_0x5aea[_0x4ff244];return _0x5307ca;};'use strict';var PluginEvents=require(_0xa5ae('0x0'));var events=[_0xa5ae('0x1'),'remove',_0xa5ae('0x2')];function createListener(_0x2ae7b7,_0x12b228){return function(_0x4fd17c){_0x12b228[_0xa5ae('0x3')](_0x2ae7b7,_0x4fd17c);};}function removeListener(_0xa976d2,_0x202ac9){return function(){PluginEvents[_0xa5ae('0x4')](_0xa976d2,_0x202ac9);};}exports[_0xa5ae('0x5')]=function(_0x465859){for(var _0x1bd026=0x0,_0x5201c4=events['length'];_0x1bd026<_0x5201c4;_0x1bd026++){var _0x59c72a=events[_0x1bd026];var _0x29c7c5=createListener(_0xa5ae('0x6')+_0x59c72a,_0x465859);PluginEvents['on'](_0x59c72a,_0x29c7c5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 2f37fcd..271d802 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 _0x968e=['index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','Router','./pm2.controller','get'];(function(_0x54c72b,_0x54886f){var _0x44c17a=function(_0x1b22fc){while(--_0x1b22fc){_0x54c72b['push'](_0x54c72b['shift']());}};_0x44c17a(++_0x54886f);}(_0x968e,0x1c4));var _0xe968=function(_0x482598,_0x54c1cf){_0x482598=_0x482598-0x0;var _0x4c9aae=_0x968e[_0x482598];return _0x4c9aae;};'use strict';var express=require('express');var router=express[_0xe968('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe968('0x1'));router[_0xe968('0x2')]('/',auth['isAuthenticated'](),controller[_0xe968('0x3')]);router['get']('/:id',auth[_0xe968('0x4')](),controller['show']);router[_0xe968('0x5')]('/',auth[_0xe968('0x4')](),controller[_0xe968('0x6')]);router[_0xe968('0x7')](_0xe968('0x8'),auth[_0xe968('0x4')](),controller[_0xe968('0x9')]);router[_0xe968('0xa')](_0xe968('0x8'),auth[_0xe968('0x4')](),controller[_0xe968('0xb')]);module[_0xe968('0xc')]=router; \ No newline at end of file +var _0xa30a=['express','../../components/auth/service','get','isAuthenticated','index','show','post','put','update','/:id','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa30a,0xbb));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xaa30('0x0'));var router=express['Router']();var auth=require(_0xaa30('0x1'));var controller=require('./pm2.controller');router[_0xaa30('0x2')]('/',auth[_0xaa30('0x3')](),controller[_0xaa30('0x4')]);router[_0xaa30('0x2')]('/:id',auth[_0xaa30('0x3')](),controller[_0xaa30('0x5')]);router[_0xaa30('0x6')]('/',auth[_0xaa30('0x3')](),controller['create']);router[_0xaa30('0x7')]('/:id',auth[_0xaa30('0x3')](),controller[_0xaa30('0x8')]);router['delete'](_0xaa30('0x9'),auth[_0xaa30('0x3')](),controller['destroy']);module[_0xaa30('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 37c8986..c595361 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 _0xf8b8=['api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','info','index','then','reject','express','motion2','length','catch','show','describe','params','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xf8b8,0xbe));var _0x8f8b=function(_0x521ec0,_0x1b8a5a){_0x521ec0=_0x521ec0-0x0;var _0x18180a=_0xf8b8[_0x521ec0];return _0x18180a;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x8f8b('0x0'));var path=require(_0x8f8b('0x1'));var exec=require(_0x8f8b('0x2'))[_0x8f8b('0x3')];var BPromise=require(_0x8f8b('0x4'));function handleEntityNotFound(_0x532510,_0x25a696){return function(_0x576c45){if(!_0x576c45){_0x532510[_0x8f8b('0x5')](0x194);;}return _0x576c45;};}function respondWithResult(_0x40d3ec,_0x50f306){_0x50f306=_0x50f306||0xc8;return function(_0x2f91e2){if(_0x2f91e2){return _0x40d3ec[_0x8f8b('0x6')](_0x50f306)[_0x8f8b('0x7')](_0x2f91e2);}return null;};}function handleError(_0x504f37,_0xed3b3e){_0xed3b3e=_0xed3b3e||0x1f4;return function(_0x1763a0){logger[_0x8f8b('0x8')](_0x1763a0['stack']);if(_0x1763a0[_0x8f8b('0x9')]){delete _0x1763a0[_0x8f8b('0x9')];}_0x504f37[_0x8f8b('0x6')](_0xed3b3e)[_0x8f8b('0xa')](_0x1763a0);};}function execChildProcess(){return new BPromise(function(_0x36c516,_0x1635db){exec('npm\x20install',function(_0x1b65a9,_0x4db938,_0x5a5e01){logger[_0x8f8b('0xb')](_0x4db938);logger[_0x8f8b('0xb')](_0x5a5e01);if(_0x1b65a9){logger[_0x8f8b('0x8')](_0x1b65a9);return _0x1635db(_0x1b65a9);}return _0x36c516(_0x4db938);});});}exports[_0x8f8b('0xc')]=function(_0x2ba66f,_0x5c53eb){return pm2['list']()[_0x8f8b('0xd')](function(_0x9a4b52){if(_0x9a4b52){var _0xdeaca0=_[_0x8f8b('0xe')](_0x9a4b52,function(_0x11d6f1){return _0x11d6f1[_0x8f8b('0x9')]===_0x8f8b('0xf')||_0x11d6f1['name']===_0x8f8b('0x10');});return{'rows':_0xdeaca0,'count':_0xdeaca0[_0x8f8b('0x11')]};}return null;})[_0x8f8b('0xd')](respondWithResult(_0x5c53eb,null))[_0x8f8b('0x12')](handleError(_0x5c53eb,null));};exports[_0x8f8b('0x13')]=function(_0x229c53,_0x17d5dc){return pm2[_0x8f8b('0x14')](_0x229c53[_0x8f8b('0x15')]['id'])['then'](respondWithResult(_0x17d5dc,null))[_0x8f8b('0xd')](handleEntityNotFound(_0x17d5dc,null))[_0x8f8b('0x12')](handleError(_0x17d5dc,null));};exports['create']=function(_0x59e2f9,_0x5777ad){if(_0x59e2f9[_0x8f8b('0x16')][_0x8f8b('0x9')]&&_0x59e2f9[_0x8f8b('0x16')]['script']){var _0x359535=path[_0x8f8b('0x17')](__dirname,_0x8f8b('0x18'),_0x59e2f9['body'][_0x8f8b('0x19')]);var _0x46da81=process[_0x8f8b('0x1a')]();process[_0x8f8b('0x1b')](path[_0x8f8b('0x1c')](_0x359535));return execChildProcess()[_0x8f8b('0xd')](function(_0x2ce59c){process['chdir'](_0x46da81);return pm2[_0x8f8b('0x1d')]({'name':_0x59e2f9[_0x8f8b('0x16')][_0x8f8b('0x9')],'script':_0x359535});})[_0x8f8b('0xd')](function(_0x3a306b){pm2[_0x8f8b('0x1e')]();return _0x3a306b[0x0];})[_0x8f8b('0xd')](respondWithResult(_0x5777ad,0xc9))[_0x8f8b('0x12')](handleError(_0x5777ad,null));}else{return _0x5777ad[_0x8f8b('0x6')](0x1f4)[_0x8f8b('0xa')]({'message':_0x8f8b('0x1f')});}};exports[_0x8f8b('0x20')]=function(_0x269185,_0x456ca2){if(_0x269185[_0x8f8b('0x16')]['id']){delete _0x269185[_0x8f8b('0x16')]['id'];}var _0x3581b3={'online':_0x8f8b('0x21'),'stopped':'stop'};if(_0x3581b3[_0x8f8b('0x22')](_0x269185[_0x8f8b('0x16')][_0x8f8b('0x6')])){return pm2[_0x3581b3[_0x269185[_0x8f8b('0x16')]['status']]](_0x269185['params']['id'])[_0x8f8b('0xd')](respondWithResult(_0x456ca2,0xc8))[_0x8f8b('0x12')](handleError(_0x456ca2,null));}else{return _0x456ca2['status'](0x1f4)[_0x8f8b('0xa')]({'message':_0x8f8b('0x23')});}};exports['destroy']=function(_0xc84bdd,_0x35bf48){if(_0xc84bdd['body']['id']){delete _0xc84bdd[_0x8f8b('0x16')]['id'];}if(_0xc84bdd[_0x8f8b('0x15')]['id']){return pm2[_0x8f8b('0x24')](_0xc84bdd[_0x8f8b('0x15')]['id'])[_0x8f8b('0xd')](function(_0x43ef29){pm2['dump']();return _0x43ef29[0x0];})[_0x8f8b('0xd')](respondWithResult(_0x35bf48,null))[_0x8f8b('0x12')](handleError(_0x35bf48,null));}else{return _0x35bf48['status'](0x1f4)[_0x8f8b('0xa')]({'message':_0x8f8b('0x25')});}}; \ No newline at end of file +var _0x760f=['catch','show','params','create','body','script','join','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length'];(function(_0x262f3f,_0x4c7292){var _0x121025=function(_0x116e57){while(--_0x116e57){_0x262f3f['push'](_0x262f3f['shift']());}};_0x121025(++_0x4c7292);}(_0x760f,0xdf));var _0xf760=function(_0x8703b2,_0x5c8eae){_0x8703b2=_0x8703b2-0x0;var _0x41ed65=_0x760f[_0x8703b2];return _0x41ed65;};'use strict';var _=require(_0xf760('0x0'));var pm2=require(_0xf760('0x1'));var logger=require(_0xf760('0x2'))(_0xf760('0x3'));var path=require(_0xf760('0x4'));var exec=require(_0xf760('0x5'))[_0xf760('0x6')];var BPromise=require(_0xf760('0x7'));function handleEntityNotFound(_0xc4bfe3,_0x327f51){return function(_0x17498b){if(!_0x17498b){_0xc4bfe3[_0xf760('0x8')](0x194);;}return _0x17498b;};}function respondWithResult(_0x24b07c,_0x352981){_0x352981=_0x352981||0xc8;return function(_0x50f1a9){if(_0x50f1a9){return _0x24b07c[_0xf760('0x9')](_0x352981)[_0xf760('0xa')](_0x50f1a9);}return null;};}function handleError(_0x4f6c5e,_0x5f223f){_0x5f223f=_0x5f223f||0x1f4;return function(_0x36615b){logger[_0xf760('0xb')](_0x36615b['stack']);if(_0x36615b[_0xf760('0xc')]){delete _0x36615b[_0xf760('0xc')];}_0x4f6c5e[_0xf760('0x9')](_0x5f223f)[_0xf760('0xd')](_0x36615b);};}function execChildProcess(){return new BPromise(function(_0x49e1a9,_0x40ca45){exec(_0xf760('0xe'),function(_0x2b1d80,_0x71ccb4,_0x413402){logger[_0xf760('0xf')](_0x71ccb4);logger['info'](_0x413402);if(_0x2b1d80){logger[_0xf760('0xb')](_0x2b1d80);return _0x40ca45(_0x2b1d80);}return _0x49e1a9(_0x71ccb4);});});}exports[_0xf760('0x10')]=function(_0x4e7a7f,_0x3b9e30){return pm2[_0xf760('0x11')]()[_0xf760('0x12')](function(_0x3033fa){if(_0x3033fa){var _0x119e75=_[_0xf760('0x13')](_0x3033fa,function(_0x183cc3){return _0x183cc3['name']===_0xf760('0x14')||_0x183cc3[_0xf760('0xc')]===_0xf760('0x15');});return{'rows':_0x119e75,'count':_0x119e75[_0xf760('0x16')]};}return null;})[_0xf760('0x12')](respondWithResult(_0x3b9e30,null))[_0xf760('0x17')](handleError(_0x3b9e30,null));};exports[_0xf760('0x18')]=function(_0x1949be,_0x37562d){return pm2['describe'](_0x1949be[_0xf760('0x19')]['id'])[_0xf760('0x12')](respondWithResult(_0x37562d,null))[_0xf760('0x12')](handleEntityNotFound(_0x37562d,null))['catch'](handleError(_0x37562d,null));};exports[_0xf760('0x1a')]=function(_0x329977,_0xa17a9a){if(_0x329977[_0xf760('0x1b')][_0xf760('0xc')]&&_0x329977[_0xf760('0x1b')][_0xf760('0x1c')]){var _0x5238cc=path[_0xf760('0x1d')](__dirname,'../../files/plugins',_0x329977[_0xf760('0x1b')][_0xf760('0x1c')]);var _0x53117c=process['cwd']();process['chdir'](path[_0xf760('0x1e')](_0x5238cc));return execChildProcess()[_0xf760('0x12')](function(_0x51d2dc){process[_0xf760('0x1f')](_0x53117c);return pm2[_0xf760('0x20')]({'name':_0x329977[_0xf760('0x1b')]['name'],'script':_0x5238cc});})['then'](function(_0x3fc9f4){pm2[_0xf760('0x21')]();return _0x3fc9f4[0x0];})[_0xf760('0x12')](respondWithResult(_0xa17a9a,0xc9))[_0xf760('0x17')](handleError(_0xa17a9a,null));}else{return _0xa17a9a['status'](0x1f4)['send']({'message':_0xf760('0x22')});}};exports['update']=function(_0x56b159,_0x20b0b3){if(_0x56b159[_0xf760('0x1b')]['id']){delete _0x56b159['body']['id'];}var _0x52a2be={'online':'restart','stopped':_0xf760('0x23')};if(_0x52a2be[_0xf760('0x24')](_0x56b159[_0xf760('0x1b')][_0xf760('0x9')])){return pm2[_0x52a2be[_0x56b159[_0xf760('0x1b')][_0xf760('0x9')]]](_0x56b159[_0xf760('0x19')]['id'])[_0xf760('0x12')](respondWithResult(_0x20b0b3,0xc8))['catch'](handleError(_0x20b0b3,null));}else{return _0x20b0b3['status'](0x1f4)[_0xf760('0xd')]({'message':_0xf760('0x25')});}};exports[_0xf760('0x26')]=function(_0x15e1b2,_0x594993){if(_0x15e1b2[_0xf760('0x1b')]['id']){delete _0x15e1b2[_0xf760('0x1b')]['id'];}if(_0x15e1b2[_0xf760('0x19')]['id']){return pm2[_0xf760('0x27')](_0x15e1b2[_0xf760('0x19')]['id'])[_0xf760('0x12')](function(_0x223d87){pm2[_0xf760('0x21')]();return _0x223d87[0x0];})['then'](respondWithResult(_0x594993,null))[_0xf760('0x17')](handleError(_0x594993,null));}else{return _0x594993[_0xf760('0x9')](0x1f4)['send']({'message':_0xf760('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7cf60a2..5eb08f9 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 _0xfb3b=['path','connect-timeout','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfb3b,0x1cc));var _0xbfb3=function(_0x279495,_0x36bf46){_0x279495=_0x279495-0x0;var _0xf69f3f=_0xfb3b[_0x279495];return _0xf69f3f;};'use strict';var multer=require(_0xbfb3('0x0'));var util=require(_0xbfb3('0x1'));var path=require(_0xbfb3('0x2'));var timeout=require(_0xbfb3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xbfb3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbfb3('0x5'));module[_0xbfb3('0x6')]=router; \ No newline at end of file +var _0xa8db=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x429156,_0x4a106c){var _0x4e5c34=function(_0xf5c8c2){while(--_0xf5c8c2){_0x429156['push'](_0x429156['shift']());}};_0x4e5c34(++_0x4a106c);}(_0xa8db,0x12a));var _0xba8d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa8db[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xba8d('0x0'));var util=require(_0xba8d('0x1'));var path=require(_0xba8d('0x2'));var timeout=require(_0xba8d('0x3'));var express=require(_0xba8d('0x4'));var router=express['Router']();var auth=require(_0xba8d('0x5'));var interaction=require(_0xba8d('0x6'));var config=require(_0xba8d('0x7'));module[_0xba8d('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index f359a89..8f0b54f 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 _0x5fe3=['INTEGER','STRING','sequelize','exports'];(function(_0x1c62c9,_0x52fb96){var _0x22a3fb=function(_0x260f60){while(--_0x260f60){_0x1c62c9['push'](_0x1c62c9['shift']());}};_0x22a3fb(++_0x52fb96);}(_0x5fe3,0x1ba));var _0x35fe=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x5fe3[_0x5bfa44];return _0x43815f;};'use strict';var Sequelize=require(_0x35fe('0x0'));module[_0x35fe('0x1')]={'state':{'type':Sequelize[_0x35fe('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x35fe('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x35fe('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x35fe('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x35fe('0x3')]},'campaigntype':{'type':Sequelize[_0x35fe('0x3')]},'membername':{'type':Sequelize[_0x35fe('0x3')]}}; \ No newline at end of file +var _0x9bea=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x418f9b,_0xecd47c){var _0x2e4b57=function(_0x9bb0c9){while(--_0x9bb0c9){_0x418f9b['push'](_0x418f9b['shift']());}};_0x2e4b57(++_0xecd47c);}(_0x9bea,0xf8));var _0xa9be=function(_0xff0fc4,_0x942a97){_0xff0fc4=_0xff0fc4-0x0;var _0x27b3c9=_0x9bea[_0xff0fc4];return _0x27b3c9;};'use strict';var Sequelize=require(_0xa9be('0x0'));module[_0xa9be('0x1')]={'state':{'type':Sequelize[_0xa9be('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa9be('0x3')]},'uniqueid':{'type':Sequelize[_0xa9be('0x4')]},'starttime':{'type':Sequelize[_0xa9be('0x3')]},'responsetime':{'type':Sequelize[_0xa9be('0x3')]},'ringtime':{'type':Sequelize[_0xa9be('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa9be('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa9be('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a10cbbc..a76ac30 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 _0x68b8=['moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','api'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x68b8,0x17a));var _0x868b=function(_0x51a85c,_0x2660a3){_0x51a85c=_0x51a85c-0x0;var _0x55001f=_0x68b8[_0x51a85c];return _0x55001f;};'use strict';var _=require(_0x868b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x868b('0x1'));var moment=require(_0x868b('0x2'));var BPromise=require(_0x868b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x868b('0x4'));var rimraf=require(_0x868b('0x5'));var config=require(_0x868b('0x6'));var attributes=require(_0x868b('0x7'));module[_0x868b('0x8')]=function(_0x439157,_0x7782d3){return _0x439157['define'](_0x868b('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3117=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x2d4b78,_0xa41467){var _0x14da49=function(_0x415b80){while(--_0x415b80){_0x2d4b78['push'](_0x2d4b78['shift']());}};_0x14da49(++_0xa41467);}(_0x3117,0x1d2));var _0x7311=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x3117[_0x151721];return _0x2deaa7;};'use strict';var _=require(_0x7311('0x0'));var util=require(_0x7311('0x1'));var logger=require(_0x7311('0x2'))(_0x7311('0x3'));var moment=require(_0x7311('0x4'));var BPromise=require(_0x7311('0x5'));var rp=require(_0x7311('0x6'));var fs=require('fs');var path=require(_0x7311('0x7'));var rimraf=require('rimraf');var config=require(_0x7311('0x8'));var attributes=require(_0x7311('0x9'));module['exports']=function(_0x5f150c,_0x385369){return _0x5f150c['define'](_0x7311('0xa'),attributes,{'tableName':_0x7311('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 463c646..fbe7837 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 _0xbd8b=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x99f753,_0x11a325){var _0x7f3d93=function(_0x3fd45d){while(--_0x3fd45d){_0x99f753['push'](_0x99f753['shift']());}};_0x7f3d93(++_0x11a325);}(_0xbd8b,0x86));var _0xbbd8=function(_0x3a5afa,_0x8ca56b){_0x3a5afa=_0x3a5afa-0x0;var _0xbf25cb=_0xbd8b[_0x3a5afa];return _0xbf25cb;};'use strict';var _=require(_0xbbd8('0x0'));var util=require(_0xbbd8('0x1'));var moment=require(_0xbbd8('0x2'));var BPromise=require(_0xbbd8('0x3'));var rs=require(_0xbbd8('0x4'));var fs=require('fs');var Redis=require(_0xbbd8('0x5'));var db=require(_0xbbd8('0x6'))['db'];var utils=require(_0xbbd8('0x7'));var logger=require(_0xbbd8('0x8'))(_0xbbd8('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbd8('0xa'));var client=jayson[_0xbbd8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ddda9,_0xd1b7a3,_0x2eae0a){return new BPromise(function(_0x1c06d9,_0x3db8b0){return client[_0xbbd8('0xc')](_0x4ddda9,_0x2eae0a)['then'](function(_0x575b4f){logger[_0xbbd8('0xd')](_0xbbd8('0xe'),_0xd1b7a3,'request\x20sent');logger[_0xbbd8('0xf')](_0xbbd8('0x10'),_0xd1b7a3,_0xbbd8('0x11'),JSON[_0xbbd8('0x12')](_0x575b4f));if(_0x575b4f[_0xbbd8('0x13')]){if(_0x575b4f[_0xbbd8('0x13')][_0xbbd8('0x14')]===0x1f4){logger[_0xbbd8('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0xd1b7a3,_0x575b4f[_0xbbd8('0x13')][_0xbbd8('0x15')]);return _0x3db8b0(_0x575b4f[_0xbbd8('0x13')][_0xbbd8('0x15')]);}logger[_0xbbd8('0x13')](_0xbbd8('0xe'),_0xd1b7a3,_0x575b4f[_0xbbd8('0x13')][_0xbbd8('0x15')]);return _0x1c06d9(_0x575b4f['error'][_0xbbd8('0x15')]);}else{logger[_0xbbd8('0xd')](_0xbbd8('0xe'),_0xd1b7a3,'request\x20sent');_0x1c06d9(_0x575b4f[_0xbbd8('0x16')][_0xbbd8('0x15')]);}})[_0xbbd8('0x17')](function(_0x55ebfb){logger[_0xbbd8('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0xd1b7a3,_0x55ebfb);_0x3db8b0(_0x55ebfb);});});}exports[_0xbbd8('0x18')]=function(_0x9dea65){var _0x4352b7=this;return new Promise(function(_0x220a33,_0x5d8de1){return db[_0xbbd8('0x19')][_0xbbd8('0x1a')](_0x9dea65[_0xbbd8('0x1b')],{'raw':_0x9dea65[_0xbbd8('0x1c')]?_0x9dea65['options'][_0xbbd8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x43d7c0){logger[_0xbbd8('0xd')]('CreateReportAgentPreview',_0x9dea65);logger[_0xbbd8('0xf')](_0xbbd8('0x18'),_0x9dea65,JSON[_0xbbd8('0x12')](_0x43d7c0));_0x220a33(_0x43d7c0);})[_0xbbd8('0x17')](function(_0x38ecb7){logger['error'](_0xbbd8('0x18'),_0x38ecb7[_0xbbd8('0x15')],_0x9dea65);_0x5d8de1(_0x4352b7[_0xbbd8('0x13')](0x1f4,_0x38ecb7[_0xbbd8('0x15')]));});});}; \ No newline at end of file +var _0xd4a0=['message','result','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xd4a0,0x19e));var _0x0d4a=function(_0xc71f95,_0x8612b8){_0xc71f95=_0xc71f95-0x0;var _0x500d7f=_0xd4a0[_0xc71f95];return _0x500d7f;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var moment=require(_0x0d4a('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d4a('0x3'));var fs=require('fs');var Redis=require(_0x0d4a('0x4'));var db=require(_0x0d4a('0x5'))['db'];var utils=require(_0x0d4a('0x6'));var logger=require(_0x0d4a('0x7'))(_0x0d4a('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d4a('0x9'));var client=jayson[_0x0d4a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42cb3c,_0x2ba973,_0x13cacd){return new BPromise(function(_0x3a809c,_0x14a7f3){return client[_0x0d4a('0xb')](_0x42cb3c,_0x13cacd)[_0x0d4a('0xc')](function(_0x2a7dfd){logger[_0x0d4a('0xd')](_0x0d4a('0xe'),_0x2ba973,_0x0d4a('0xf'));logger[_0x0d4a('0x10')](_0x0d4a('0x11'),_0x2ba973,_0x0d4a('0xf'),JSON[_0x0d4a('0x12')](_0x2a7dfd));if(_0x2a7dfd[_0x0d4a('0x13')]){if(_0x2a7dfd[_0x0d4a('0x13')][_0x0d4a('0x14')]===0x1f4){logger['error'](_0x0d4a('0xe'),_0x2ba973,_0x2a7dfd[_0x0d4a('0x13')][_0x0d4a('0x15')]);return _0x14a7f3(_0x2a7dfd['error'][_0x0d4a('0x15')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2ba973,_0x2a7dfd[_0x0d4a('0x13')][_0x0d4a('0x15')]);return _0x3a809c(_0x2a7dfd[_0x0d4a('0x13')]['message']);}else{logger[_0x0d4a('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x2ba973,_0x0d4a('0xf'));_0x3a809c(_0x2a7dfd[_0x0d4a('0x16')]['message']);}})[_0x0d4a('0x17')](function(_0x203172){logger[_0x0d4a('0x13')](_0x0d4a('0xe'),_0x2ba973,_0x203172);_0x14a7f3(_0x203172);});});}exports['CreateReportAgentPreview']=function(_0x2450e0){var _0x1c079e=this;return new Promise(function(_0x48d03f,_0x574c38){return db[_0x0d4a('0x18')]['create'](_0x2450e0[_0x0d4a('0x19')],{'raw':_0x2450e0[_0x0d4a('0x1a')]?_0x2450e0[_0x0d4a('0x1a')][_0x0d4a('0x1b')]===undefined?!![]:![]:!![]})[_0x0d4a('0xc')](function(_0x5ecd8e){logger[_0x0d4a('0xd')](_0x0d4a('0x1c'),_0x2450e0);logger[_0x0d4a('0x10')](_0x0d4a('0x1c'),_0x2450e0,JSON[_0x0d4a('0x12')](_0x5ecd8e));_0x48d03f(_0x5ecd8e);})['catch'](function(_0x194585){logger[_0x0d4a('0x13')]('CreateReportAgentPreview',_0x194585[_0x0d4a('0x15')],_0x2450e0);_0x574c38(_0x1c079e['error'](0x1f4,_0x194585[_0x0d4a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3a9f2d4..8ad56af 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 _0xa3fd=['/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','telephones','trunks','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0xa3fd,0x139));var _0xda3f=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xa3fd[_0x330723];return _0x60c546;};'use strict';var multer=require('multer');var util=require(_0xda3f('0x0'));var path=require('path');var express=require(_0xda3f('0x1'));var router=express[_0xda3f('0x2')]();var auth=require(_0xda3f('0x3'));var controller=require(_0xda3f('0x4'));router[_0xda3f('0x5')]('/voice/channels',auth[_0xda3f('0x6')](),controller['voiceChannels']);router[_0xda3f('0x5')](_0xda3f('0x7'),auth[_0xda3f('0x6')](),controller['voiceChannelMixMonitor']);router['get'](_0xda3f('0x8'),auth[_0xda3f('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xda3f('0x5')](_0xda3f('0x9'),auth[_0xda3f('0x6')](),controller[_0xda3f('0xa')]);router['get'](_0xda3f('0xb'),auth['isAuthenticated'](),controller['chatQueues']);router[_0xda3f('0x5')](_0xda3f('0xc'),auth[_0xda3f('0x6')](),controller[_0xda3f('0xd')]);router['get'](_0xda3f('0xe'),auth[_0xda3f('0x6')](),controller[_0xda3f('0xf')]);router[_0xda3f('0x5')](_0xda3f('0x10'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x11')]);router['get'](_0xda3f('0x12'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x13')]);router[_0xda3f('0x5')](_0xda3f('0x14'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x15')]);router[_0xda3f('0x5')]('/fax/queues',auth[_0xda3f('0x6')](),controller[_0xda3f('0x16')]);router['get']('/voice/queues/preview/:id',auth[_0xda3f('0x6')](),controller[_0xda3f('0x17')]);router[_0xda3f('0x5')](_0xda3f('0x18'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x19')]);router[_0xda3f('0x5')](_0xda3f('0x1a'),auth[_0xda3f('0x6')](),controller['voiceQueuesChannel']);router[_0xda3f('0x5')](_0xda3f('0x1b'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x1c')]);router[_0xda3f('0x5')](_0xda3f('0x1d'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x1e')]);router[_0xda3f('0x5')](_0xda3f('0x1f'),auth['isAuthenticated'](),controller[_0xda3f('0x20')]);router[_0xda3f('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0xda3f('0x21')]);router[_0xda3f('0x5')](_0xda3f('0x22'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x23')]);router[_0xda3f('0x5')](_0xda3f('0x24'),auth['isAuthenticated'](),controller[_0xda3f('0x25')]);router[_0xda3f('0x26')]('/agents/:id/capacity',auth[_0xda3f('0x6')](),controller[_0xda3f('0x27')]);router[_0xda3f('0x5')]('/telephones',auth['isAuthenticated'](),controller[_0xda3f('0x28')]);router[_0xda3f('0x5')]('/trunks',auth[_0xda3f('0x6')](),controller[_0xda3f('0x29')]);router['get']('/campaigns',auth['isAuthenticated'](),controller[_0xda3f('0x2a')]);router['get'](_0xda3f('0x2b'),auth[_0xda3f('0x6')](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xda3f('0x2c')]);router[_0xda3f('0x5')](_0xda3f('0x2d'),auth[_0xda3f('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xda3f('0x5')](_0xda3f('0x2e'),auth['isAuthenticated'](),controller[_0xda3f('0x2f')]);router[_0xda3f('0x5')]('/sms/queues/waitinginteractions',auth[_0xda3f('0x6')](),controller[_0xda3f('0x30')]);router[_0xda3f('0x5')](_0xda3f('0x31'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x32')]);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xda3f('0x33')]);router[_0xda3f('0x34')](_0xda3f('0x35'),auth['isAuthenticated'](),controller[_0xda3f('0x36')]('mail'));router[_0xda3f('0x5')](_0xda3f('0x37'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x38')]);router[_0xda3f('0x34')](_0xda3f('0x39'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x36')](_0xda3f('0x3a')));router[_0xda3f('0x5')](_0xda3f('0x3b'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x3c')]);router[_0xda3f('0x34')](_0xda3f('0x3d'),auth[_0xda3f('0x6')](),controller['queueNotify'](_0xda3f('0x3e')));router[_0xda3f('0x5')](_0xda3f('0x3f'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x40')]);router['post'](_0xda3f('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0xda3f('0x42')));router[_0xda3f('0x5')](_0xda3f('0x43'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x44')]);router[_0xda3f('0x34')](_0xda3f('0x45'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x36')](_0xda3f('0x46')));router[_0xda3f('0x34')](_0xda3f('0x47'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x36')](_0xda3f('0x48')));router[_0xda3f('0x5')](_0xda3f('0x49'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x4a')]);router[_0xda3f('0x5')](_0xda3f('0x4b'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x4c')]);router['post'](_0xda3f('0x4d'),auth[_0xda3f('0x6')](),controller[_0xda3f('0x4e')]);module[_0xda3f('0x4f')]=router; \ No newline at end of file +var _0x0805=['voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid'];(function(_0x39fa7e,_0x1da9b1){var _0x4a5408=function(_0xcc6aa0){while(--_0xcc6aa0){_0x39fa7e['push'](_0x39fa7e['shift']());}};_0x4a5408(++_0x1da9b1);}(_0x0805,0x7f));var _0x5080=function(_0x3c0c85,_0x48e2c5){_0x3c0c85=_0x3c0c85-0x0;var _0x4670a8=_0x0805[_0x3c0c85];return _0x4670a8;};'use strict';var multer=require('multer');var util=require(_0x5080('0x0'));var path=require('path');var express=require(_0x5080('0x1'));var router=express[_0x5080('0x2')]();var auth=require(_0x5080('0x3'));var controller=require('./rpc.controller');router[_0x5080('0x4')](_0x5080('0x5'),auth[_0x5080('0x6')](),controller['voiceChannels']);router['get'](_0x5080('0x7'),auth[_0x5080('0x6')](),controller[_0x5080('0x8')]);router[_0x5080('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x5080('0x6')](),controller[_0x5080('0x9')]);router[_0x5080('0x4')](_0x5080('0xa'),auth['isAuthenticated'](),controller[_0x5080('0xb')]);router[_0x5080('0x4')](_0x5080('0xc'),auth[_0x5080('0x6')](),controller[_0x5080('0xd')]);router[_0x5080('0x4')](_0x5080('0xe'),auth[_0x5080('0x6')](),controller['mailQueues']);router[_0x5080('0x4')](_0x5080('0xf'),auth[_0x5080('0x6')](),controller[_0x5080('0x10')]);router[_0x5080('0x4')](_0x5080('0x11'),auth[_0x5080('0x6')](),controller[_0x5080('0x12')]);router[_0x5080('0x4')](_0x5080('0x13'),auth[_0x5080('0x6')](),controller[_0x5080('0x14')]);router['get'](_0x5080('0x15'),auth['isAuthenticated'](),controller[_0x5080('0x16')]);router[_0x5080('0x4')](_0x5080('0x17'),auth[_0x5080('0x6')](),controller[_0x5080('0x18')]);router[_0x5080('0x4')](_0x5080('0x19'),auth[_0x5080('0x6')](),controller[_0x5080('0x1a')]);router[_0x5080('0x4')](_0x5080('0x1b'),auth[_0x5080('0x6')](),controller['voiceQueuesChannels']);router[_0x5080('0x4')](_0x5080('0x1c'),auth['isAuthenticated'](),controller[_0x5080('0x1d')]);router['get'](_0x5080('0x1e'),auth['isAuthenticated'](),controller[_0x5080('0x1f')]);router[_0x5080('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5080('0x6')](),controller[_0x5080('0x20')]);router[_0x5080('0x4')]('/voice/queues/:id',auth[_0x5080('0x6')](),controller[_0x5080('0x21')]);router['get'](_0x5080('0x22'),auth[_0x5080('0x6')](),controller['outbound']);router[_0x5080('0x4')]('/outbound/channels',auth[_0x5080('0x6')](),controller['outboundChannels']);router[_0x5080('0x4')](_0x5080('0x23'),auth[_0x5080('0x6')](),controller[_0x5080('0x24')]);router[_0x5080('0x25')](_0x5080('0x26'),auth[_0x5080('0x6')](),controller[_0x5080('0x27')]);router[_0x5080('0x4')](_0x5080('0x28'),auth[_0x5080('0x6')](),controller[_0x5080('0x29')]);router[_0x5080('0x4')](_0x5080('0x2a'),auth['isAuthenticated'](),controller['trunks']);router[_0x5080('0x4')]('/campaigns',auth[_0x5080('0x6')](),controller['campaigns']);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x5080('0x2b')]);router['get'](_0x5080('0x2c'),auth['isAuthenticated'](),controller[_0x5080('0x2d')]);router['get'](_0x5080('0x2e'),auth[_0x5080('0x6')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x5080('0x2f'),auth[_0x5080('0x6')](),controller[_0x5080('0x30')]);router['get'](_0x5080('0x31'),auth[_0x5080('0x6')](),controller[_0x5080('0x32')]);router[_0x5080('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0x5080('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x5080('0x4')](_0x5080('0x33'),auth[_0x5080('0x6')](),controller[_0x5080('0x34')]);router[_0x5080('0x35')](_0x5080('0x36'),auth[_0x5080('0x6')](),controller[_0x5080('0x37')](_0x5080('0x38')));router[_0x5080('0x4')](_0x5080('0x39'),auth[_0x5080('0x6')](),controller[_0x5080('0x3a')]);router['post'](_0x5080('0x3b'),auth[_0x5080('0x6')](),controller['queueNotify'](_0x5080('0x3c')));router[_0x5080('0x4')](_0x5080('0x3d'),auth[_0x5080('0x6')](),controller['showChatQueues']);router[_0x5080('0x35')](_0x5080('0x3e'),auth[_0x5080('0x6')](),controller[_0x5080('0x37')](_0x5080('0x3f')));router[_0x5080('0x4')](_0x5080('0x40'),auth[_0x5080('0x6')](),controller[_0x5080('0x41')]);router['post'](_0x5080('0x42'),auth[_0x5080('0x6')](),controller[_0x5080('0x37')]('openchannel'));router[_0x5080('0x4')](_0x5080('0x43'),auth['isAuthenticated'](),controller[_0x5080('0x44')]);router[_0x5080('0x35')](_0x5080('0x45'),auth[_0x5080('0x6')](),controller[_0x5080('0x37')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x5080('0x46')));router[_0x5080('0x4')](_0x5080('0x47'),auth[_0x5080('0x6')](),controller[_0x5080('0x48')]);router[_0x5080('0x4')](_0x5080('0x49'),auth[_0x5080('0x6')](),controller[_0x5080('0x4a')]);router[_0x5080('0x35')](_0x5080('0x4b'),auth[_0x5080('0x6')](),controller[_0x5080('0x4c')]);module[_0x5080('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5a23ee5..061ad0c 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 _0x40f5=['Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','From','moment','lodash','util','../../mysqldb','api','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound'];(function(_0x37e911,_0x430da5){var _0x1e35bd=function(_0x9deafa){while(--_0x9deafa){_0x37e911['push'](_0x37e911['shift']());}};_0x1e35bd(++_0x430da5);}(_0x40f5,0x13a));var _0x540f=function(_0x121350,_0x361f4d){_0x121350=_0x121350-0x0;var _0x2e21c7=_0x40f5[_0x121350];return _0x2e21c7;};'use strict';var BPromise=require('bluebird');var moment=require(_0x540f('0x0'));var _=require(_0x540f('0x1'));var util=require(_0x540f('0x2'));var db=require(_0x540f('0x3'))['db'];var logger=require('../../config/logger')(_0x540f('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x540f('0x5')]['http']({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x540f('0x5')][_0x540f('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x57d987,_0x44c51a,_0xa82ae2){return new BPromise(function(_0x1bcaf9,_0x54e907){var _0x23dc07=_0xa82ae2?_0xa82ae2:amiClient;return _0x23dc07['request'](_0x57d987,_0x44c51a)[_0x540f('0x7')](function(_0x4f06e0){if(_0x4f06e0[_0x540f('0x8')]){if(_0x4f06e0[_0x540f('0x8')][_0x540f('0x9')]===0x1f4){return _0x54e907(_0x4f06e0[_0x540f('0x8')][_0x540f('0xa')]);}return _0x1bcaf9(_0x4f06e0[_0x540f('0x8')][_0x540f('0xa')]);}else{_0x1bcaf9(_0x4f06e0[_0x540f('0xb')]);}})[_0x540f('0xc')](function(_0x1b8e1f){_0x54e907(_0x1b8e1f);});});}function respondWithResult(_0x4e4ee3,_0x4a6a6f){_0x4a6a6f=_0x4a6a6f||0xc8;return function(_0x38ad4c){if(_0x38ad4c){return _0x4e4ee3[_0x540f('0xd')](_0x4a6a6f)[_0x540f('0xe')](_0x38ad4c);}return _0x4e4ee3[_0x540f('0xf')](0x194);};}function handleError(_0x34d2c3,_0x1b0e8e){_0x1b0e8e=_0x1b0e8e||0x1f4;return function(_0x13e51a){logger['error'](_0x13e51a[_0x540f('0x10')]);if(_0x13e51a[_0x540f('0x11')]){delete _0x13e51a[_0x540f('0x11')];}_0x34d2c3[_0x540f('0xd')](_0x1b0e8e)[_0x540f('0x12')](_0x13e51a);};}function findById(_0x2bed7b){return function(_0x46a109){if(!_[_0x540f('0x13')](_0x2bed7b)&&!_[_0x540f('0x13')](_0x46a109)&&!_[_0x540f('0x13')](_0x46a109[_0x540f('0x14')])){return _[_0x540f('0x15')](_0x46a109[_0x540f('0x14')],function(_0x3d4780){return _0x3d4780['id']==_0x2bed7b;});}return null;};}exports[_0x540f('0x16')]=function(_0x587765,_0x4aac47){return respondWithRpcPromise('VoiceChannels',_0x587765[_0x540f('0x17')])['then'](respondWithResult(_0x4aac47,null))[_0x540f('0xc')](handleError(_0x4aac47,null));};exports[_0x540f('0x18')]=function(_0x1e3d7f,_0x4e4f2c){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x540f('0x19')](_0x1e3d7f['query'],_0x1e3d7f[_0x540f('0x1a')]))[_0x540f('0x7')](respondWithResult(_0x4e4f2c,null))[_0x540f('0xc')](handleError(_0x4e4f2c,null));};exports[_0x540f('0x1b')]=function(_0x40ee22,_0x282a8d){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x540f('0x19')](_0x40ee22[_0x540f('0x17')],_0x40ee22[_0x540f('0x1a')]))['then'](respondWithResult(_0x282a8d,null))[_0x540f('0xc')](handleError(_0x282a8d,null));};exports[_0x540f('0x1c')]=function(_0x336087,_0x3ec971){return respondWithRpcPromise('VoiceQueues',_0x336087[_0x540f('0x17')])[_0x540f('0x7')](respondWithResult(_0x3ec971,null))[_0x540f('0xc')](handleError(_0x3ec971,null));};exports[_0x540f('0x1d')]=function(_0xbcb942,_0x34d682){return respondWithRpcPromise(_0x540f('0x1e'),_0xbcb942[_0x540f('0x17')])[_0x540f('0x7')](findById(_0xbcb942['params']['id']))[_0x540f('0x7')](respondWithResult(_0x34d682,null))[_0x540f('0xc')](handleError(_0x34d682,null));};exports[_0x540f('0x1f')]=function(_0xa4babc,_0x4ac8a8){return respondWithRpcPromise(_0x540f('0x20'),_['merge'](_0xa4babc[_0x540f('0x17')],_0xa4babc['params']))[_0x540f('0x7')](respondWithResult(_0x4ac8a8,null))[_0x540f('0xc')](handleError(_0x4ac8a8,null));};exports[_0x540f('0x21')]=function(_0x1981c2,_0x558cf8){return respondWithRpcPromise(_0x540f('0x22'),_0x1981c2['query'])[_0x540f('0x7')](respondWithResult(_0x558cf8,null))['catch'](handleError(_0x558cf8,null));};exports[_0x540f('0x23')]=function(_0xb43145,_0x59dbfa){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x540f('0x19')](_0xb43145[_0x540f('0x17')],_0xb43145[_0x540f('0x1a')]))['then'](respondWithResult(_0x59dbfa,null))[_0x540f('0xc')](handleError(_0x59dbfa,null));};exports[_0x540f('0x24')]=function(_0x54e609,_0x346d28){return respondWithRpcPromise(_0x540f('0x25'),_['merge'](_0x54e609['query'],_0x54e609[_0x540f('0x1a')]))[_0x540f('0x7')](respondWithResult(_0x346d28,null))['catch'](handleError(_0x346d28,null));};exports['voiceQueuesChannelRedirect']=function(_0x370aee,_0x4be827){return respondWithRpcPromise(_0x540f('0x26'),_[_0x540f('0x19')](_0x370aee[_0x540f('0x17')],_0x370aee[_0x540f('0x1a')]))[_0x540f('0x7')](respondWithResult(_0x4be827,null))['catch'](handleError(_0x4be827,null));};exports[_0x540f('0x27')]=function(_0x42fa1b,_0x1abf23){return respondWithRpcPromise(_0x540f('0x28'),_0x42fa1b[_0x540f('0x17')])[_0x540f('0x7')](respondWithResult(_0x1abf23,null))[_0x540f('0xc')](handleError(_0x1abf23,null));};exports['outboundChannels']=function(_0x525b33,_0x557778){return respondWithRpcPromise(_0x540f('0x29'),_0x525b33['query'])['then'](respondWithResult(_0x557778,null))['catch'](handleError(_0x557778,null));};exports[_0x540f('0x2a')]=function(_0x4f7cac,_0x5b7a2f){var _0x472336;return respondWithRpcPromise(_0x540f('0x2b'),_0x4f7cac[_0x540f('0x17')])[_0x540f('0x7')](function(_0x5375ef){_0x472336=_0x5375ef;return respondWithRpcPromise(_0x540f('0x2b'),_0x4f7cac[_0x540f('0x17')],routingClient);})[_0x540f('0x7')](function(_0x58398e){return _[_0x540f('0x19')]({},_0x58398e,_0x472336);})[_0x540f('0x7')](respondWithResult(_0x5b7a2f,null))[_0x540f('0xc')](handleError(_0x5b7a2f,null));};exports[_0x540f('0x2c')]=function(_0x145744,_0x1ddb5d){if(_0x145744[_0x540f('0x2d')]&&_0x145744[_0x540f('0x2d')]['interaction']&&_0x145744[_0x540f('0x2e')]&&_0x145744['user'][_0x540f('0x11')]){for(var _0x12f82d in _0x145744[_0x540f('0x2d')]['interaction']){if(_0x145744['body'][_0x540f('0x2f')][_0x540f('0x30')](_0x12f82d)){db['MemberReport']['findAll']({'where':{'channel':_0x12f82d,'membername':_0x145744[_0x540f('0x2e')][_0x540f('0x11')],'type':_0x540f('0x31'),'exitAt':null,'uniqueid':_0x145744[_0x540f('0x2d')]['interaction'][_0x12f82d]&&_0x145744[_0x540f('0x2d')][_0x540f('0x2f')][_0x12f82d][_0x540f('0x32')]?{'$notIn':_0x145744['body'][_0x540f('0x2f')][_0x12f82d]}:{'$ne':null}}})['then'](function(_0x4bafba){var _0x3e10db=moment()[_0x540f('0x33')](_0x540f('0x34'));for(var _0x458d5e=0x0,_0x2c98fc=_0x4bafba[_0x540f('0x32')];_0x458d5e<_0x2c98fc;_0x458d5e+=0x1){_0x4bafba[_0x458d5e][_0x540f('0x35')]({'exitAt':_0x3e10db});}});for(var _0x5bcda4=0x0;_0x5bcda4<_0x145744[_0x540f('0x2d')][_0x540f('0x2f')][_0x12f82d]['length'];_0x5bcda4+=0x1){db[_0x540f('0x36')][_0x540f('0x37')]({'where':{'channel':_0x12f82d,'membername':_0x145744[_0x540f('0x2e')][_0x540f('0x11')],'type':_0x540f('0x31'),'uniqueid':_0x145744[_0x540f('0x2d')][_0x540f('0x2f')][_0x12f82d][_0x5bcda4],'exitAt':null},'defaults':{'channel':_0x12f82d,'membername':_0x145744[_0x540f('0x2e')][_0x540f('0x11')],'interface':_['isNil'](_0x145744[_0x540f('0x2e')][_0x540f('0x38')])?util[_0x540f('0x33')](_0x540f('0x39'),_0x145744[_0x540f('0x2e')][_0x540f('0x11')]):_0x145744['user'][_0x540f('0x38')],'type':'INTERACTION','enterAt':moment()[_0x540f('0x33')](_0x540f('0x34')),'role':_0x540f('0x3a'),'internal':_0x145744[_0x540f('0x2e')][_0x540f('0x3b')],'uniqueid':_0x145744[_0x540f('0x2d')]['interaction'][_0x12f82d][_0x5bcda4]}});}}}}return respondWithRpcPromise(_0x540f('0x3c'),{'id':_0x145744[_0x540f('0x1a')]['id'],'capacity':_0x145744[_0x540f('0x2d')][_0x540f('0x3d')]},routingClient)[_0x540f('0x7')](respondWithResult(_0x1ddb5d,null))[_0x540f('0xc')](handleError(_0x1ddb5d,null));};exports[_0x540f('0x3e')]=function(_0x520d51,_0xa453f9){return respondWithRpcPromise(_0x540f('0x3f'),_0x520d51['query'])[_0x540f('0x7')](respondWithResult(_0xa453f9,null))[_0x540f('0xc')](handleError(_0xa453f9,null));};exports['trunks']=function(_0x443cbf,_0x3673ef){return respondWithRpcPromise('Trunks',_0x443cbf['query'])[_0x540f('0x7')](respondWithResult(_0x3673ef,null))['catch'](handleError(_0x3673ef,null));};exports[_0x540f('0x40')]=function(_0x52edc7,_0x2a3c76){return respondWithRpcPromise(_0x540f('0x41'),_0x52edc7[_0x540f('0x17')])[_0x540f('0x7')](respondWithResult(_0x2a3c76,null))['catch'](handleError(_0x2a3c76,null));};exports[_0x540f('0x42')]=function(_0x224c64,_0x4c622d){return respondWithRpcPromise(_0x540f('0x43'),_0x224c64[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x4c622d,null))['catch'](handleError(_0x4c622d,null));};exports[_0x540f('0x44')]=function(_0x2dd4e3,_0x1d5b0f){return respondWithRpcPromise(_0x540f('0x43'),_0x2dd4e3['query'],routingClient)[_0x540f('0x7')](findById(_0x2dd4e3['params']['id']))['then'](respondWithResult(_0x1d5b0f,null))['catch'](handleError(_0x1d5b0f,null));};exports[_0x540f('0x45')]=function(_0x12441a,_0x3a282c){return respondWithRpcPromise('MailQueues',_0x12441a[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x3a282c,null))[_0x540f('0xc')](handleError(_0x3a282c,null));};exports['showMailQueues']=function(_0x597b9d,_0x520f86){return respondWithRpcPromise('MailQueues',_0x597b9d['query'],routingClient)[_0x540f('0x7')](findById(_0x597b9d[_0x540f('0x1a')]['id']))[_0x540f('0x7')](respondWithResult(_0x520f86,null))['catch'](handleError(_0x520f86,null));};exports[_0x540f('0x46')]=function(_0x38602d,_0x14a6f8){return respondWithRpcPromise(_0x540f('0x47'),_0x38602d[_0x540f('0x17')],mailClient)[_0x540f('0x7')](respondWithResult(_0x14a6f8,null))[_0x540f('0xc')](handleError(_0x14a6f8,null));};exports[_0x540f('0x48')]=function(_0x3b0d79,_0x319a4e){return respondWithRpcPromise(_0x540f('0x49'),_0x3b0d79[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x319a4e,null))[_0x540f('0xc')](handleError(_0x319a4e,null));};exports[_0x540f('0x4a')]=function(_0x1e674f,_0x571fc8){return respondWithRpcPromise(_0x540f('0x49'),_0x1e674f[_0x540f('0x17')],routingClient)['then'](findById(_0x1e674f[_0x540f('0x1a')]['id']))[_0x540f('0x7')](respondWithResult(_0x571fc8,null))[_0x540f('0xc')](handleError(_0x571fc8,null));};exports['smsQueues']=function(_0x456a82,_0x17ee5e){return respondWithRpcPromise(_0x540f('0x4b'),_0x456a82[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x17ee5e,null))[_0x540f('0xc')](handleError(_0x17ee5e,null));};exports[_0x540f('0x4c')]=function(_0x570827,_0x3dbf64){return respondWithRpcPromise('SmsQueues',_0x570827[_0x540f('0x17')],routingClient)[_0x540f('0x7')](findById(_0x570827['params']['id']))[_0x540f('0x7')](respondWithResult(_0x3dbf64,null))[_0x540f('0xc')](handleError(_0x3dbf64,null));};exports[_0x540f('0x4d')]=function(_0x5047ec,_0x58c78e){return respondWithRpcPromise(_0x540f('0x4e'),_0x5047ec[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x58c78e,null))['catch'](handleError(_0x58c78e,null));};exports['showWhatsappQueues']=function(_0x4fc528,_0x35f519){return respondWithRpcPromise(_0x540f('0x4e'),_0x4fc528['query'],routingClient)['then'](findById(_0x4fc528[_0x540f('0x1a')]['id']))[_0x540f('0x7')](respondWithResult(_0x35f519,null))['catch'](handleError(_0x35f519,null));};exports[_0x540f('0x4f')]=function(_0x5a6c23,_0x267183){return respondWithRpcPromise(_0x540f('0x50'),_0x5a6c23[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x267183,null))['catch'](handleError(_0x267183,null));};exports[_0x540f('0x51')]=function(_0x3edc6b,_0x381b41){return respondWithRpcPromise('FaxQueues',_0x3edc6b[_0x540f('0x17')],routingClient)['then'](findById(_0x3edc6b[_0x540f('0x1a')]['id']))[_0x540f('0x7')](respondWithResult(_0x381b41,null))[_0x540f('0xc')](handleError(_0x381b41,null));};exports[_0x540f('0x52')]=function(_0x2f6408,_0x1e2b8b){return respondWithRpcPromise('FaxAccounts',_0x2f6408[_0x540f('0x17')])[_0x540f('0x7')](respondWithResult(_0x1e2b8b,null))[_0x540f('0xc')](handleError(_0x1e2b8b,null));};exports['chatQueuesWaitingInteractions']=function(_0x1a4a6a,_0x2ef78b){return respondWithRpcPromise(_0x540f('0x53'),_0x1a4a6a['query'],routingClient)['then'](respondWithResult(_0x2ef78b,null))[_0x540f('0xc')](handleError(_0x2ef78b,null));};exports['mailQueuesWaitingInteractions']=function(_0x5e3775,_0x8f41da){return respondWithRpcPromise(_0x540f('0x54'),_0x5e3775[_0x540f('0x17')],routingClient)['then'](respondWithResult(_0x8f41da,null))[_0x540f('0xc')](handleError(_0x8f41da,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x847811,_0x5edf4e){return respondWithRpcPromise(_0x540f('0x55'),_0x847811[_0x540f('0x17')],routingClient)[_0x540f('0x7')](respondWithResult(_0x5edf4e,null))[_0x540f('0xc')](handleError(_0x5edf4e,null));};exports[_0x540f('0x56')]=function(_0x43ccae,_0x44409f){return respondWithRpcPromise(_0x540f('0x57'),_0x43ccae['query'],routingClient)[_0x540f('0x7')](respondWithResult(_0x44409f,null))[_0x540f('0xc')](handleError(_0x44409f,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x56e749,_0x5843a2){return respondWithRpcPromise(_0x540f('0x58'),_0x56e749[_0x540f('0x17')],routingClient)['then'](respondWithResult(_0x5843a2,null))['catch'](handleError(_0x5843a2,null));};exports[_0x540f('0x59')]=function(_0x194f94,_0x52b66d){return respondWithRpcPromise(_0x540f('0x5a'),_0x194f94[_0x540f('0x17')],routingClient)['then'](respondWithResult(_0x52b66d,null))['catch'](handleError(_0x52b66d,null));};exports[_0x540f('0x5b')]=function(_0x2b7626){return function(_0x1323c6,_0x53d873){var _0x494b76,_0x932f83;var _0x174784=_[_0x540f('0x5c')](_0x2b7626);var _0x241ce5=_0x2b7626===_0x540f('0x5d')?_0x540f('0x5e'):'Account';return db[_0x174784+_0x540f('0x5f')][_0x540f('0x60')]({'raw':!![],'where':{'id':_0x1323c6[_0x540f('0x1a')]['id']}})['then'](function(_0x1793e3){if(_[_0x540f('0x13')](_0x1793e3)){throw new Error(_0x174784+_0x540f('0x61'));}_0x494b76=_0x1793e3;return db[_0x174784+_0x540f('0x62')][_0x540f('0x60')]({'where':{'id':_0x1323c6['body'][_0x540f('0x63')]},'include':[{'model':db[_0x174784+'Interaction'],'as':_0x540f('0x64')},{'model':db[_0x174784+_0x241ce5],'as':_0x540f('0x65')}]});})[_0x540f('0x7')](function(_0x131471){if(_['isNil'](_0x131471)){throw new Error(_0x174784+_0x540f('0x66'));}_0x932f83=_0x131471;return _0x131471[_0x540f('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x540f('0x7')](function(){var _0x19a4a2={'uniqueid':_0x2b7626+'.'+_0x932f83['id']+'.'+_0x932f83[_0x540f('0x64')]['id'],'FromUserId':_0x1323c6[_0x540f('0x2e')]['id'],'type':_0x540f('0x68')};_0x19a4a2[_0x174784+_0x540f('0x69')]=_0x932f83['id'];_0x19a4a2[_0x174784+_0x540f('0x6a')]=_0x932f83[_0x540f('0x64')]['id'];_0x19a4a2['From'+_0x174784+_0x241ce5+'Id']=_0x932f83['Account']['id'];_0x19a4a2['To'+_0x174784+_0x540f('0x6b')]=_0x494b76['id'];return db[_0x174784+_0x540f('0x6c')][_0x540f('0x6d')](_0x19a4a2);})[_0x540f('0x7')](function(){return respondWithRpcPromise(_0x540f('0x6e'),{'channel':_0x2b7626,'interaction':_0x932f83[_0x540f('0x64')],'message':_0x932f83,'account':_0x932f83[_0x540f('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x540f('0x68'),'appdata':_0x494b76[_0x540f('0x11')]+','+(_0x932f83['Account'][_0x540f('0x6f')]||0x12c),'interval':_0x540f('0x70')}]},routingClient);})[_0x540f('0x7')](respondWithResult(_0x53d873,null))[_0x540f('0xc')](handleError(_0x53d873,null));};};exports[_0x540f('0x71')]=function(_0x5b858f,_0x31eabb){var _0x22ccf2,_0x37cd1a;if(_[_0x540f('0x13')](_0x5b858f[_0x540f('0x2d')][_0x540f('0x72')])){throw new Error(_0x540f('0x73'));}var _0x59e793=_0x5b858f[_0x540f('0x2d')][_0x540f('0x72')];var _0x5ae06c=_['capitalize'](_0x59e793);var _0x2cf451=_0x59e793===_0x540f('0x5d')?_0x540f('0x5e'):'Account';return db[_0x540f('0x74')]['findOne']({'raw':!![],'where':{'id':_0x5b858f[_0x540f('0x1a')]['id'],'role':_0x540f('0x3a')}})[_0x540f('0x7')](function(_0x5610c6){if(_['isNil'](_0x5610c6)){throw new Error('Agent\x20not\x20found');}_0x22ccf2=_0x5610c6;return db[_0x5ae06c+_0x540f('0x62')]['findOne']({'where':{'id':_0x5b858f[_0x540f('0x2d')][_0x540f('0x63')]},'include':[{'model':db[_0x5ae06c+_0x540f('0x64')],'as':'Interaction'},{'model':db[_0x5ae06c+_0x2cf451],'as':_0x540f('0x65')}]});})[_0x540f('0x7')](function(_0x49706c){if(_[_0x540f('0x13')](_0x49706c)){throw new Error(_0x5ae06c+_0x540f('0x66'));}_0x37cd1a=_0x49706c;return _0x49706c[_0x540f('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x540f('0x7')](function(){var _0x516996={'uniqueid':_0x59e793+'.'+_0x37cd1a['id']+'.'+_0x37cd1a[_0x540f('0x64')]['id'],'FromUserId':_0x5b858f['user']['id'],'type':_0x540f('0x68'),'ToUserId':_0x22ccf2['id']};_0x516996[_0x5ae06c+_0x540f('0x69')]=_0x37cd1a['id'];_0x516996[_0x5ae06c+'InteractionId']=_0x37cd1a['Interaction']['id'];_0x516996[_0x540f('0x75')+_0x5ae06c+_0x2cf451+'Id']=_0x37cd1a[_0x540f('0x65')]['id'];return db[_0x5ae06c+_0x540f('0x6c')][_0x540f('0x6d')](_0x516996);})[_0x540f('0x7')](function(){return respondWithRpcPromise(_0x540f('0x6e'),{'channel':_0x59e793,'interaction':_0x37cd1a['Interaction'],'message':_0x37cd1a,'account':_0x37cd1a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x540f('0x3a'),'appdata':_0x22ccf2[_0x540f('0x11')]+','+(_0x37cd1a[_0x540f('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x540f('0x70')}]},routingClient);})[_0x540f('0x7')](respondWithResult(_0x31eabb,null))[_0x540f('0xc')](handleError(_0x31eabb,null));}; \ No newline at end of file +var _0xa5ad=['find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','catch','voiceQueues','VoiceQueues','showVoiceQueues','params','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','agent','AgentCapacity','capacity','telephones','Trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','Message','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','status','json','sendStatus','stack','name','send','isNil','rows'];(function(_0xcd11dc,_0x322aa5){var _0x20c62f=function(_0x15e174){while(--_0x15e174){_0xcd11dc['push'](_0xcd11dc['shift']());}};_0x20c62f(++_0x322aa5);}(_0xa5ad,0x1be));var _0xda5a=function(_0x5885a4,_0x464904){_0x5885a4=_0x5885a4-0x0;var _0x4c9200=_0xa5ad[_0x5885a4];return _0x4c9200;};'use strict';var BPromise=require(_0xda5a('0x0'));var moment=require(_0xda5a('0x1'));var _=require(_0xda5a('0x2'));var util=require('util');var db=require(_0xda5a('0x3'))['db'];var logger=require(_0xda5a('0x4'))(_0xda5a('0x5'));var jayson=require(_0xda5a('0x6'));var amiClient=jayson[_0xda5a('0x7')][_0xda5a('0x8')]({'port':0x232a});var mailClient=jayson[_0xda5a('0x7')][_0xda5a('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0xe0674d,_0x2717fa,_0xb37e33){return new BPromise(function(_0x2652a0,_0x19306e){var _0x1f1dd0=_0xb37e33?_0xb37e33:amiClient;return _0x1f1dd0[_0xda5a('0x9')](_0xe0674d,_0x2717fa)[_0xda5a('0xa')](function(_0x528c38){if(_0x528c38[_0xda5a('0xb')]){if(_0x528c38[_0xda5a('0xb')]['code']===0x1f4){return _0x19306e(_0x528c38[_0xda5a('0xb')][_0xda5a('0xc')]);}return _0x2652a0(_0x528c38[_0xda5a('0xb')][_0xda5a('0xc')]);}else{_0x2652a0(_0x528c38[_0xda5a('0xd')]);}})['catch'](function(_0x360043){_0x19306e(_0x360043);});});}function respondWithResult(_0x4e49d9,_0xa5e184){_0xa5e184=_0xa5e184||0xc8;return function(_0x37bd11){if(_0x37bd11){return _0x4e49d9[_0xda5a('0xe')](_0xa5e184)[_0xda5a('0xf')](_0x37bd11);}return _0x4e49d9[_0xda5a('0x10')](0x194);};}function handleError(_0x1c0a1f,_0x2adc00){_0x2adc00=_0x2adc00||0x1f4;return function(_0x4f2e71){logger['error'](_0x4f2e71[_0xda5a('0x11')]);if(_0x4f2e71['name']){delete _0x4f2e71[_0xda5a('0x12')];}_0x1c0a1f[_0xda5a('0xe')](_0x2adc00)[_0xda5a('0x13')](_0x4f2e71);};}function findById(_0x439899){return function(_0x4c21bb){if(!_[_0xda5a('0x14')](_0x439899)&&!_[_0xda5a('0x14')](_0x4c21bb)&&!_[_0xda5a('0x14')](_0x4c21bb[_0xda5a('0x15')])){return _[_0xda5a('0x16')](_0x4c21bb[_0xda5a('0x15')],function(_0x5aec78){return _0x5aec78['id']==_0x439899;});}return null;};}exports[_0xda5a('0x17')]=function(_0x47aee0,_0x25a96a){return respondWithRpcPromise(_0xda5a('0x18'),_0x47aee0[_0xda5a('0x19')])[_0xda5a('0xa')](respondWithResult(_0x25a96a,null))['catch'](handleError(_0x25a96a,null));};exports[_0xda5a('0x1a')]=function(_0x5ab808,_0x1513bd){return respondWithRpcPromise(_0xda5a('0x1b'),_[_0xda5a('0x1c')](_0x5ab808[_0xda5a('0x19')],_0x5ab808['params']))[_0xda5a('0xa')](respondWithResult(_0x1513bd,null))[_0xda5a('0x1d')](handleError(_0x1513bd,null));};exports['voiceChannelStopMixMonitor']=function(_0x1aea3a,_0x188621){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xda5a('0x1c')](_0x1aea3a[_0xda5a('0x19')],_0x1aea3a['params']))['then'](respondWithResult(_0x188621,null))['catch'](handleError(_0x188621,null));};exports[_0xda5a('0x1e')]=function(_0x4f58f5,_0x255bab){return respondWithRpcPromise(_0xda5a('0x1f'),_0x4f58f5[_0xda5a('0x19')])['then'](respondWithResult(_0x255bab,null))[_0xda5a('0x1d')](handleError(_0x255bab,null));};exports[_0xda5a('0x20')]=function(_0xaa158d,_0x255c3b){return respondWithRpcPromise('VoiceQueues',_0xaa158d[_0xda5a('0x19')])[_0xda5a('0xa')](findById(_0xaa158d[_0xda5a('0x21')]['id']))[_0xda5a('0xa')](respondWithResult(_0x255c3b,null))[_0xda5a('0x1d')](handleError(_0x255c3b,null));};exports[_0xda5a('0x22')]=function(_0x5114fc,_0x45cde4){return respondWithRpcPromise(_0xda5a('0x23'),_[_0xda5a('0x1c')](_0x5114fc[_0xda5a('0x19')],_0x5114fc[_0xda5a('0x21')]))['then'](respondWithResult(_0x45cde4,null))[_0xda5a('0x1d')](handleError(_0x45cde4,null));};exports[_0xda5a('0x24')]=function(_0x208f67,_0x33a64c){return respondWithRpcPromise(_0xda5a('0x25'),_0x208f67[_0xda5a('0x19')])[_0xda5a('0xa')](respondWithResult(_0x33a64c,null))[_0xda5a('0x1d')](handleError(_0x33a64c,null));};exports[_0xda5a('0x26')]=function(_0x1ecc1d,_0xb74fd4){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x1ecc1d[_0xda5a('0x19')],_0x1ecc1d[_0xda5a('0x21')]))[_0xda5a('0xa')](respondWithResult(_0xb74fd4,null))[_0xda5a('0x1d')](handleError(_0xb74fd4,null));};exports['voiceQueuesChannelHangup']=function(_0x464d52,_0x16fbaf){return respondWithRpcPromise(_0xda5a('0x27'),_[_0xda5a('0x1c')](_0x464d52['query'],_0x464d52[_0xda5a('0x21')]))['then'](respondWithResult(_0x16fbaf,null))[_0xda5a('0x1d')](handleError(_0x16fbaf,null));};exports['voiceQueuesChannelRedirect']=function(_0x19fce7,_0x3f2794){return respondWithRpcPromise(_0xda5a('0x28'),_[_0xda5a('0x1c')](_0x19fce7['query'],_0x19fce7[_0xda5a('0x21')]))[_0xda5a('0xa')](respondWithResult(_0x3f2794,null))[_0xda5a('0x1d')](handleError(_0x3f2794,null));};exports[_0xda5a('0x29')]=function(_0x187e54,_0x5e3404){return respondWithRpcPromise(_0xda5a('0x2a'),_0x187e54[_0xda5a('0x19')])[_0xda5a('0xa')](respondWithResult(_0x5e3404,null))[_0xda5a('0x1d')](handleError(_0x5e3404,null));};exports['outboundChannels']=function(_0x413224,_0x8e7ea8){return respondWithRpcPromise(_0xda5a('0x2b'),_0x413224[_0xda5a('0x19')])['then'](respondWithResult(_0x8e7ea8,null))[_0xda5a('0x1d')](handleError(_0x8e7ea8,null));};exports[_0xda5a('0x2c')]=function(_0xa8c64c,_0x289341){var _0x909367;return respondWithRpcPromise('Agents',_0xa8c64c[_0xda5a('0x19')])[_0xda5a('0xa')](function(_0x2faabb){_0x909367=_0x2faabb;return respondWithRpcPromise(_0xda5a('0x2d'),_0xa8c64c[_0xda5a('0x19')],routingClient);})[_0xda5a('0xa')](function(_0x425885){return _[_0xda5a('0x1c')]({},_0x425885,_0x909367);})[_0xda5a('0xa')](respondWithResult(_0x289341,null))[_0xda5a('0x1d')](handleError(_0x289341,null));};exports[_0xda5a('0x2e')]=function(_0x1b11e5,_0x511e81){if(_0x1b11e5[_0xda5a('0x2f')]&&_0x1b11e5[_0xda5a('0x2f')][_0xda5a('0x30')]&&_0x1b11e5[_0xda5a('0x31')]&&_0x1b11e5[_0xda5a('0x31')][_0xda5a('0x12')]){for(var _0x1e2d20 in _0x1b11e5[_0xda5a('0x2f')][_0xda5a('0x30')]){if(_0x1b11e5[_0xda5a('0x2f')]['interaction'][_0xda5a('0x32')](_0x1e2d20)){db[_0xda5a('0x33')][_0xda5a('0x34')]({'where':{'channel':_0x1e2d20,'membername':_0x1b11e5[_0xda5a('0x31')][_0xda5a('0x12')],'type':_0xda5a('0x35'),'exitAt':null,'uniqueid':_0x1b11e5[_0xda5a('0x2f')]['interaction'][_0x1e2d20]&&_0x1b11e5[_0xda5a('0x2f')][_0xda5a('0x30')][_0x1e2d20][_0xda5a('0x36')]?{'$notIn':_0x1b11e5[_0xda5a('0x2f')]['interaction'][_0x1e2d20]}:{'$ne':null}}})[_0xda5a('0xa')](function(_0x1368bd){var _0x3a8f56=moment()['format'](_0xda5a('0x37'));for(var _0x3ec675=0x0,_0x7863b0=_0x1368bd[_0xda5a('0x36')];_0x3ec675<_0x7863b0;_0x3ec675+=0x1){_0x1368bd[_0x3ec675][_0xda5a('0x38')]({'exitAt':_0x3a8f56});}});for(var _0x55fa4e=0x0;_0x55fa4e<_0x1b11e5[_0xda5a('0x2f')]['interaction'][_0x1e2d20][_0xda5a('0x36')];_0x55fa4e+=0x1){db['MemberReport'][_0xda5a('0x39')]({'where':{'channel':_0x1e2d20,'membername':_0x1b11e5['user']['name'],'type':'INTERACTION','uniqueid':_0x1b11e5[_0xda5a('0x2f')][_0xda5a('0x30')][_0x1e2d20][_0x55fa4e],'exitAt':null},'defaults':{'channel':_0x1e2d20,'membername':_0x1b11e5['user'][_0xda5a('0x12')],'interface':_['isNil'](_0x1b11e5[_0xda5a('0x31')][_0xda5a('0x3a')])?util[_0xda5a('0x3b')]('SIP/%s',_0x1b11e5[_0xda5a('0x31')]['name']):_0x1b11e5[_0xda5a('0x31')][_0xda5a('0x3a')],'type':_0xda5a('0x35'),'enterAt':moment()[_0xda5a('0x3b')](_0xda5a('0x37')),'role':_0xda5a('0x3c'),'internal':_0x1b11e5['user']['internal'],'uniqueid':_0x1b11e5['body'][_0xda5a('0x30')][_0x1e2d20][_0x55fa4e]}});}}}}return respondWithRpcPromise(_0xda5a('0x3d'),{'id':_0x1b11e5[_0xda5a('0x21')]['id'],'capacity':_0x1b11e5[_0xda5a('0x2f')][_0xda5a('0x3e')]},routingClient)[_0xda5a('0xa')](respondWithResult(_0x511e81,null))['catch'](handleError(_0x511e81,null));};exports[_0xda5a('0x3f')]=function(_0x459d18,_0x2dea0c){return respondWithRpcPromise('Telephones',_0x459d18[_0xda5a('0x19')])['then'](respondWithResult(_0x2dea0c,null))[_0xda5a('0x1d')](handleError(_0x2dea0c,null));};exports['trunks']=function(_0x2239b2,_0x58a4b8){return respondWithRpcPromise(_0xda5a('0x40'),_0x2239b2[_0xda5a('0x19')])['then'](respondWithResult(_0x58a4b8,null))[_0xda5a('0x1d')](handleError(_0x58a4b8,null));};exports['campaigns']=function(_0xc79d89,_0x4bcfe9){return respondWithRpcPromise('Campaigns',_0xc79d89['query'])[_0xda5a('0xa')](respondWithResult(_0x4bcfe9,null))[_0xda5a('0x1d')](handleError(_0x4bcfe9,null));};exports[_0xda5a('0x41')]=function(_0x17eb14,_0x55b6e5){return respondWithRpcPromise(_0xda5a('0x42'),_0x17eb14[_0xda5a('0x19')],routingClient)['then'](respondWithResult(_0x55b6e5,null))['catch'](handleError(_0x55b6e5,null));};exports['showChatQueues']=function(_0x3343fb,_0x26cfb3){return respondWithRpcPromise(_0xda5a('0x42'),_0x3343fb['query'],routingClient)[_0xda5a('0xa')](findById(_0x3343fb['params']['id']))[_0xda5a('0xa')](respondWithResult(_0x26cfb3,null))[_0xda5a('0x1d')](handleError(_0x26cfb3,null));};exports[_0xda5a('0x43')]=function(_0x17b1a1,_0x5860df){return respondWithRpcPromise(_0xda5a('0x44'),_0x17b1a1[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0x5860df,null))[_0xda5a('0x1d')](handleError(_0x5860df,null));};exports[_0xda5a('0x45')]=function(_0x2f8d5e,_0x21e072){return respondWithRpcPromise(_0xda5a('0x44'),_0x2f8d5e['query'],routingClient)[_0xda5a('0xa')](findById(_0x2f8d5e['params']['id']))['then'](respondWithResult(_0x21e072,null))[_0xda5a('0x1d')](handleError(_0x21e072,null));};exports[_0xda5a('0x46')]=function(_0x3d3842,_0x1c5198){return respondWithRpcPromise(_0xda5a('0x47'),_0x3d3842[_0xda5a('0x19')],mailClient)[_0xda5a('0xa')](respondWithResult(_0x1c5198,null))[_0xda5a('0x1d')](handleError(_0x1c5198,null));};exports['openchannelQueues']=function(_0x3acce7,_0x510280){return respondWithRpcPromise(_0xda5a('0x48'),_0x3acce7['query'],routingClient)['then'](respondWithResult(_0x510280,null))['catch'](handleError(_0x510280,null));};exports[_0xda5a('0x49')]=function(_0x172eea,_0x1383cf){return respondWithRpcPromise(_0xda5a('0x48'),_0x172eea[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](findById(_0x172eea['params']['id']))[_0xda5a('0xa')](respondWithResult(_0x1383cf,null))[_0xda5a('0x1d')](handleError(_0x1383cf,null));};exports[_0xda5a('0x4a')]=function(_0x504074,_0x543cd3){return respondWithRpcPromise('SmsQueues',_0x504074[_0xda5a('0x19')],routingClient)['then'](respondWithResult(_0x543cd3,null))['catch'](handleError(_0x543cd3,null));};exports[_0xda5a('0x4b')]=function(_0xca6328,_0x15fdf7){return respondWithRpcPromise(_0xda5a('0x4c'),_0xca6328[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](findById(_0xca6328[_0xda5a('0x21')]['id']))['then'](respondWithResult(_0x15fdf7,null))[_0xda5a('0x1d')](handleError(_0x15fdf7,null));};exports[_0xda5a('0x4d')]=function(_0x1aca65,_0x52d6ee){return respondWithRpcPromise(_0xda5a('0x4e'),_0x1aca65[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0x52d6ee,null))['catch'](handleError(_0x52d6ee,null));};exports[_0xda5a('0x4f')]=function(_0x43b513,_0x5f5511){return respondWithRpcPromise(_0xda5a('0x4e'),_0x43b513['query'],routingClient)[_0xda5a('0xa')](findById(_0x43b513[_0xda5a('0x21')]['id']))[_0xda5a('0xa')](respondWithResult(_0x5f5511,null))[_0xda5a('0x1d')](handleError(_0x5f5511,null));};exports[_0xda5a('0x50')]=function(_0x4ca534,_0xa11912){return respondWithRpcPromise(_0xda5a('0x51'),_0x4ca534[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0xa11912,null))[_0xda5a('0x1d')](handleError(_0xa11912,null));};exports['showFaxQueues']=function(_0x3d533c,_0xf16369){return respondWithRpcPromise(_0xda5a('0x51'),_0x3d533c['query'],routingClient)[_0xda5a('0xa')](findById(_0x3d533c['params']['id']))[_0xda5a('0xa')](respondWithResult(_0xf16369,null))[_0xda5a('0x1d')](handleError(_0xf16369,null));};exports['faxAccounts']=function(_0x3c2766,_0x1d5d0f){return respondWithRpcPromise('FaxAccounts',_0x3c2766['query'])['then'](respondWithResult(_0x1d5d0f,null))['catch'](handleError(_0x1d5d0f,null));};exports[_0xda5a('0x52')]=function(_0x10374b,_0x3ae818){return respondWithRpcPromise(_0xda5a('0x53'),_0x10374b[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0x3ae818,null))[_0xda5a('0x1d')](handleError(_0x3ae818,null));};exports['mailQueuesWaitingInteractions']=function(_0x1fc9fc,_0x36e0d0){return respondWithRpcPromise(_0xda5a('0x54'),_0x1fc9fc[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0x36e0d0,null))['catch'](handleError(_0x36e0d0,null));};exports[_0xda5a('0x55')]=function(_0xb1a316,_0x569017){return respondWithRpcPromise(_0xda5a('0x56'),_0xb1a316[_0xda5a('0x19')],routingClient)['then'](respondWithResult(_0x569017,null))[_0xda5a('0x1d')](handleError(_0x569017,null));};exports[_0xda5a('0x57')]=function(_0x1054c9,_0x2e0778){return respondWithRpcPromise(_0xda5a('0x58'),_0x1054c9[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0x2e0778,null))[_0xda5a('0x1d')](handleError(_0x2e0778,null));};exports[_0xda5a('0x59')]=function(_0x3f65d7,_0x352c91){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3f65d7[_0xda5a('0x19')],routingClient)['then'](respondWithResult(_0x352c91,null))[_0xda5a('0x1d')](handleError(_0x352c91,null));};exports[_0xda5a('0x5a')]=function(_0x14962e,_0x1b1ce8){return respondWithRpcPromise(_0xda5a('0x5b'),_0x14962e[_0xda5a('0x19')],routingClient)[_0xda5a('0xa')](respondWithResult(_0x1b1ce8,null))[_0xda5a('0x1d')](handleError(_0x1b1ce8,null));};exports[_0xda5a('0x5c')]=function(_0x40c6b8){return function(_0x54e8e1,_0x23893a){var _0x51e74f,_0x4d0015;var _0x32f548=_[_0xda5a('0x5d')](_0x40c6b8);var _0x5247a3=_0x40c6b8==='chat'?_0xda5a('0x5e'):'Account';return db[_0x32f548+'Queue'][_0xda5a('0x5f')]({'raw':!![],'where':{'id':_0x54e8e1['params']['id']}})[_0xda5a('0xa')](function(_0x5e514f){if(_['isNil'](_0x5e514f)){throw new Error(_0x32f548+_0xda5a('0x60'));}_0x51e74f=_0x5e514f;return db[_0x32f548+'Message'][_0xda5a('0x5f')]({'where':{'id':_0x54e8e1[_0xda5a('0x2f')][_0xda5a('0x61')]},'include':[{'model':db[_0x32f548+'Interaction'],'as':_0xda5a('0x62')},{'model':db[_0x32f548+_0x5247a3],'as':_0xda5a('0x63')}]});})[_0xda5a('0xa')](function(_0x1ad450){if(_['isNil'](_0x1ad450)){throw new Error(_0x32f548+_0xda5a('0x64'));}_0x4d0015=_0x1ad450;return _0x1ad450[_0xda5a('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xda5a('0xa')](function(){var _0x763aef={'uniqueid':_0x40c6b8+'.'+_0x4d0015['id']+'.'+_0x4d0015[_0xda5a('0x62')]['id'],'FromUserId':_0x54e8e1[_0xda5a('0x31')]['id'],'type':'queue'};_0x763aef[_0x32f548+_0xda5a('0x66')]=_0x4d0015['id'];_0x763aef[_0x32f548+_0xda5a('0x67')]=_0x4d0015['Interaction']['id'];_0x763aef[_0xda5a('0x68')+_0x32f548+_0x5247a3+'Id']=_0x4d0015[_0xda5a('0x63')]['id'];_0x763aef['To'+_0x32f548+_0xda5a('0x69')]=_0x51e74f['id'];return db[_0x32f548+_0xda5a('0x6a')]['create'](_0x763aef);})[_0xda5a('0xa')](function(){return respondWithRpcPromise(_0xda5a('0x6b'),{'channel':_0x40c6b8,'interaction':_0x4d0015['Interaction'],'message':_0x4d0015,'account':_0x4d0015['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xda5a('0x6c'),'appdata':_0x51e74f[_0xda5a('0x12')]+','+(_0x4d0015['Account'][_0xda5a('0x6d')]||0x12c),'interval':_0xda5a('0x6e')}]},routingClient);})[_0xda5a('0xa')](respondWithResult(_0x23893a,null))['catch'](handleError(_0x23893a,null));};};exports['agentNotify']=function(_0x4bf0a5,_0x257c9c){var _0x2c69f6,_0x49ec3c;if(_[_0xda5a('0x14')](_0x4bf0a5['body'][_0xda5a('0x6f')])){throw new Error(_0xda5a('0x70'));}var _0x182b4a=_0x4bf0a5[_0xda5a('0x2f')][_0xda5a('0x6f')];var _0x13254a=_['capitalize'](_0x182b4a);var _0x39f8b2=_0x182b4a===_0xda5a('0x71')?'Website':'Account';return db[_0xda5a('0x72')][_0xda5a('0x5f')]({'raw':!![],'where':{'id':_0x4bf0a5[_0xda5a('0x21')]['id'],'role':_0xda5a('0x3c')}})[_0xda5a('0xa')](function(_0x3b69ae){if(_[_0xda5a('0x14')](_0x3b69ae)){throw new Error(_0xda5a('0x73'));}_0x2c69f6=_0x3b69ae;return db[_0x13254a+_0xda5a('0x74')][_0xda5a('0x5f')]({'where':{'id':_0x4bf0a5[_0xda5a('0x2f')][_0xda5a('0x61')]},'include':[{'model':db[_0x13254a+_0xda5a('0x62')],'as':'Interaction'},{'model':db[_0x13254a+_0x39f8b2],'as':'Account'}]});})[_0xda5a('0xa')](function(_0x1fed91){if(_['isNil'](_0x1fed91)){throw new Error(_0x13254a+_0xda5a('0x64'));}_0x49ec3c=_0x1fed91;return _0x1fed91[_0xda5a('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xda5a('0xa')](function(){var _0x419f5a={'uniqueid':_0x182b4a+'.'+_0x49ec3c['id']+'.'+_0x49ec3c[_0xda5a('0x62')]['id'],'FromUserId':_0x4bf0a5[_0xda5a('0x31')]['id'],'type':_0xda5a('0x6c'),'ToUserId':_0x2c69f6['id']};_0x419f5a[_0x13254a+'MessageId']=_0x49ec3c['id'];_0x419f5a[_0x13254a+_0xda5a('0x67')]=_0x49ec3c[_0xda5a('0x62')]['id'];_0x419f5a[_0xda5a('0x68')+_0x13254a+_0x39f8b2+'Id']=_0x49ec3c[_0xda5a('0x63')]['id'];return db[_0x13254a+_0xda5a('0x6a')]['create'](_0x419f5a);})['then'](function(){return respondWithRpcPromise(_0xda5a('0x6b'),{'channel':_0x182b4a,'interaction':_0x49ec3c['Interaction'],'message':_0x49ec3c,'account':_0x49ec3c[_0xda5a('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0xda5a('0x3c'),'appdata':_0x2c69f6[_0xda5a('0x12')]+','+(_0x49ec3c[_0xda5a('0x63')]['agentTransferTimeout']||0x12c),'interval':_0xda5a('0x6e')}]},routingClient);})[_0xda5a('0xa')](respondWithResult(_0x257c9c,null))['catch'](handleError(_0x257c9c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 884bda3..618f7c0 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 _0x96c6=['/:id','show','/:id/run','run','post','create','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x96c6,0x194));var _0x696c=function(_0x3e8b9f,_0x4cd823){_0x3e8b9f=_0x3e8b9f-0x0;var _0x4aa974=_0x96c6[_0x3e8b9f];return _0x4aa974;};'use strict';var multer=require('multer');var util=require(_0x696c('0x0'));var path=require(_0x696c('0x1'));var timeout=require(_0x696c('0x2'));var express=require('express');var router=express[_0x696c('0x3')]();var auth=require(_0x696c('0x4'));var interaction=require(_0x696c('0x5'));var config=require(_0x696c('0x6'));var controller=require(_0x696c('0x7'));router[_0x696c('0x8')]('/',auth[_0x696c('0x9')](),controller['index']);router[_0x696c('0x8')](_0x696c('0xa'),auth['isAuthenticated'](),controller[_0x696c('0xb')]);router['get'](_0x696c('0xc'),auth[_0x696c('0x9')](),controller[_0x696c('0xd')]);router[_0x696c('0xe')]('/',auth['isAuthenticated'](),controller[_0x696c('0xf')]);router['put'](_0x696c('0xa'),auth[_0x696c('0x9')](),controller['update']);router[_0x696c('0x10')](_0x696c('0xa'),auth[_0x696c('0x9')](),controller[_0x696c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcb8e=['show','/:id/run','run','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x1a83f2,_0x4661bc){var _0x30d0ad=function(_0x3f4349){while(--_0x3f4349){_0x1a83f2['push'](_0x1a83f2['shift']());}};_0x30d0ad(++_0x4661bc);}(_0xcb8e,0x184));var _0xecb8=function(_0x240362,_0x156794){_0x240362=_0x240362-0x0;var _0x26de18=_0xcb8e[_0x240362];return _0x26de18;};'use strict';var multer=require(_0xecb8('0x0'));var util=require(_0xecb8('0x1'));var path=require(_0xecb8('0x2'));var timeout=require(_0xecb8('0x3'));var express=require('express');var router=express[_0xecb8('0x4')]();var auth=require(_0xecb8('0x5'));var interaction=require(_0xecb8('0x6'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xecb8('0x7')]('/',auth[_0xecb8('0x8')](),controller[_0xecb8('0x9')]);router[_0xecb8('0x7')](_0xecb8('0xa'),auth[_0xecb8('0x8')](),controller[_0xecb8('0xb')]);router[_0xecb8('0x7')](_0xecb8('0xc'),auth[_0xecb8('0x8')](),controller[_0xecb8('0xd')]);router['post']('/',auth[_0xecb8('0x8')](),controller[_0xecb8('0xe')]);router[_0xecb8('0xf')]('/:id',auth[_0xecb8('0x8')](),controller[_0xecb8('0x10')]);router[_0xecb8('0x11')](_0xecb8('0xa'),auth[_0xecb8('0x8')](),controller[_0xecb8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 33c9b16..f7389b0 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 _0x9e2e=['days','minutes','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x341b8a,_0x3beeea){_0x341b8a=_0x341b8a-0x0;var _0x5a1711=_0x9e2e[_0x341b8a];return _0x5a1711;};'use strict';var Sequelize=require(_0xe9e2('0x0'));module[_0xe9e2('0x1')]={'name':{'type':Sequelize[_0xe9e2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe9e2('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xe9e2('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe9e2('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe9e2('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe9e2('0x6')](_0xe9e2('0x7'),_0xe9e2('0x8'),_0xe9e2('0x9'),'weeks',_0xe9e2('0xa'),'hours',_0xe9e2('0xb')),'allowNull':![],'defaultValue':_0xe9e2('0xa')},'output':{'type':Sequelize['ENUM'](_0xe9e2('0xc'),_0xe9e2('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xe9e2('0xc')},'type':{'type':Sequelize[_0xe9e2('0x6')]('custom','default'),'allowNull':![],'defaultValue':_0xe9e2('0xe')},'sendMail':{'type':Sequelize[_0xe9e2('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe9e2('0x2')]},'cc':{'type':Sequelize[_0xe9e2('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x254a=['ENUM','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','hours','minutes'];(function(_0x1600e2,_0x2bbd9b){var _0x3236a0=function(_0x26c3e6){while(--_0x26c3e6){_0x1600e2['push'](_0x1600e2['shift']());}};_0x3236a0(++_0x2bbd9b);}(_0x254a,0x138));var _0xa254=function(_0x278646,_0x25736a){_0x278646=_0x278646-0x0;var _0x1bba75=_0x254a[_0x278646];return _0x1bba75;};'use strict';var Sequelize=require(_0xa254('0x0'));module[_0xa254('0x1')]={'name':{'type':Sequelize[_0xa254('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa254('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa254('0x2')],'allowNull':![],'defaultValue':_0xa254('0x4')},'startAt':{'type':Sequelize[_0xa254('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa254('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xa254('0x7'),_0xa254('0x8'),_0xa254('0x9'),'weeks','days',_0xa254('0xa'),_0xa254('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa254('0xc')]('csv',_0xa254('0xd'),_0xa254('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xa254('0xf'),_0xa254('0x10')),'allowNull':![],'defaultValue':_0xa254('0xf')},'sendMail':{'type':Sequelize[_0xa254('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa254('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xa254('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 57f257e..5ede50d 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 _0xfe3a=['save','update','destroy','Scheduler','UserProfileResource','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','Schedule','findAll','rows','catch','show','keys','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply'];(function(_0x518673,_0x3e8616){var _0x378ffa=function(_0x23872c){while(--_0x23872c){_0x518673['push'](_0x518673['shift']());}};_0x378ffa(++_0x3e8616);}(_0xfe3a,0x183));var _0xafe3=function(_0x168b6f,_0x2b5077){_0x168b6f=_0x168b6f-0x0;var _0x507fda=_0xfe3a[_0x168b6f];return _0x507fda;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xafe3('0x0'));var rimraf=require(_0xafe3('0x1'));var zipdir=require(_0xafe3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafe3('0x3'));var moment=require(_0xafe3('0x4'));var BPromise=require(_0xafe3('0x5'));var Mustache=require(_0xafe3('0x6'));var util=require(_0xafe3('0x7'));var path=require(_0xafe3('0x8'));var sox=require(_0xafe3('0x9'));var csv=require(_0xafe3('0xa'));var ejs=require(_0xafe3('0xb'));var fs=require('fs');var _=require(_0xafe3('0xc'));var squel=require(_0xafe3('0xd'));var crypto=require(_0xafe3('0xe'));var jsforce=require(_0xafe3('0xf'));var deskjs=require(_0xafe3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xafe3('0x11'));var Papa=require(_0xafe3('0x12'));var Redis=require(_0xafe3('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafe3('0x14'));var logger=require(_0xafe3('0x15'))('api');var utils=require(_0xafe3('0x16'));var config=require(_0xafe3('0x17'));var db=require(_0xafe3('0x18'))['db'];function respondWithStatusCode(_0x16a6e8,_0x159de7){_0x159de7=_0x159de7||0xcc;return function(_0x113953){if(_0x113953){return _0x16a6e8[_0xafe3('0x19')](_0x159de7);}return _0x16a6e8['status'](_0x159de7)[_0xafe3('0x1a')]();};}function respondWithResult(_0x1df00e,_0x1d2cb9){_0x1d2cb9=_0x1d2cb9||0xc8;return function(_0x118f88){if(_0x118f88){return _0x1df00e[_0xafe3('0x1b')](_0x1d2cb9)[_0xafe3('0x1c')](_0x118f88);}};}function respondWithFilteredResult(_0x57a4a7,_0x1e0302){return function(_0x28a456){if(_0x28a456){var _0x3f3e07=_0x28a456[_0xafe3('0x1d')],_0x1bcbd5=_0x1e0302['offset'],_0x596ed2=_0x1e0302[_0xafe3('0x1e')]+_0x1e0302['limit'],_0x5a0380;if(_0x596ed2>=_0x3f3e07){_0x596ed2=_0x3f3e07;_0x5a0380=0xc8;}else{_0x5a0380=0xce;}_0x57a4a7[_0xafe3('0x1b')](_0x5a0380);return _0x57a4a7['set'](_0xafe3('0x1f'),_0x1bcbd5+'-'+_0x596ed2+'/'+_0x3f3e07)[_0xafe3('0x1c')](_0x28a456);}return null;};}function patchUpdates(_0x103844){return function(_0x535121){try{jsonpatch[_0xafe3('0x20')](_0x535121,_0x103844,!![]);}catch(_0x3b003b){return BPromise['reject'](_0x3b003b);}return _0x535121[_0xafe3('0x21')]();};}function saveUpdates(_0x2b2b06,_0x587f00){return function(_0x4acfb2){if(_0x4acfb2){return _0x4acfb2[_0xafe3('0x22')](_0x2b2b06)['then'](function(_0x596b9f){return _0x596b9f;});}return null;};}function removeEntity(_0x10b89c,_0x4b48ea){return function(_0x16a29b){if(_0x16a29b){return _0x16a29b[_0xafe3('0x23')]()['then'](function(){var _0x37d4a2=_0x16a29b['get']({'plain':!![]});var _0x590633=_0xafe3('0x24');return db[_0xafe3('0x25')][_0xafe3('0x23')]({'where':{'type':_0x590633,'resourceId':_0x37d4a2['id']}})[_0xafe3('0x26')](function(){return _0x16a29b;});})[_0xafe3('0x26')](function(){_0x10b89c[_0xafe3('0x1b')](0xcc)[_0xafe3('0x1a')]();});}};}function handleEntityNotFound(_0x244df7,_0x245276){return function(_0x4c2232){if(!_0x4c2232){_0x244df7[_0xafe3('0x19')](0x194);}return _0x4c2232;};}function handleError(_0x2fa49b,_0x27b3bc){_0x27b3bc=_0x27b3bc||0x1f4;return function(_0xa251e8){logger[_0xafe3('0x27')](_0xa251e8['stack']);if(_0xa251e8[_0xafe3('0x28')]){delete _0xa251e8['name'];}_0x2fa49b[_0xafe3('0x1b')](_0x27b3bc)[_0xafe3('0x29')](_0xa251e8);};}exports[_0xafe3('0x2a')]=function(_0x31f730,_0x2e5153){var _0x3c2c21={},_0x2f6309={},_0xdd1466={'count':0x0,'rows':[]};var _0x11389c=_[_0xafe3('0x2b')](db['Schedule'][_0xafe3('0x2c')],function(_0x1ec57a){return{'name':_0x1ec57a[_0xafe3('0x2d')],'type':_0x1ec57a[_0xafe3('0x2e')][_0xafe3('0x2f')]};});_0x2f6309[_0xafe3('0x30')]=_['map'](_0x11389c,_0xafe3('0x28'));_0x2f6309[_0xafe3('0x31')]=_['keys'](_0x31f730[_0xafe3('0x31')]);_0x2f6309[_0xafe3('0x32')]=_[_0xafe3('0x33')](_0x2f6309[_0xafe3('0x30')],_0x2f6309[_0xafe3('0x31')]);_0x3c2c21['attributes']=_[_0xafe3('0x33')](_0x2f6309[_0xafe3('0x30')],qs[_0xafe3('0x34')](_0x31f730['query'][_0xafe3('0x34')]));_0x3c2c21[_0xafe3('0x35')]=_0x3c2c21['attributes'][_0xafe3('0x36')]?_0x3c2c21[_0xafe3('0x35')]:_0x2f6309[_0xafe3('0x30')];if(!_0x31f730['query']['hasOwnProperty'](_0xafe3('0x37'))){_0x3c2c21[_0xafe3('0x38')]=qs[_0xafe3('0x38')](_0x31f730[_0xafe3('0x31')][_0xafe3('0x38')]);_0x3c2c21[_0xafe3('0x1e')]=qs[_0xafe3('0x1e')](_0x31f730[_0xafe3('0x31')]['offset']);}_0x3c2c21[_0xafe3('0x39')]=qs['sort'](_0x31f730[_0xafe3('0x31')]['sort']);_0x3c2c21[_0xafe3('0x3a')]=qs[_0xafe3('0x32')](_[_0xafe3('0x3b')](_0x31f730[_0xafe3('0x31')],_0x2f6309[_0xafe3('0x32')]),_0x11389c);if(_0x31f730['query']['filter']){_0x3c2c21[_0xafe3('0x3a')]=_['merge'](_0x3c2c21[_0xafe3('0x3a')],{'$or':_[_0xafe3('0x2b')](_0x11389c,function(_0x1f74c2){if(_0x1f74c2['type']!==_0xafe3('0x3c')){var _0x13ddd3={};_0x13ddd3[_0x1f74c2['name']]={'$like':'%'+_0x31f730[_0xafe3('0x31')][_0xafe3('0x3d')]+'%'};return _0x13ddd3;}})});}_0x3c2c21=_[_0xafe3('0x3e')]({},_0x3c2c21,_0x31f730[_0xafe3('0x3f')]);var _0x50d4dd={'where':_0x3c2c21['where']};return db['Schedule'][_0xafe3('0x1d')](_0x50d4dd)[_0xafe3('0x26')](function(_0x24f901){_0xdd1466[_0xafe3('0x1d')]=_0x24f901;if(_0x31f730['query'][_0xafe3('0x40')]){_0x3c2c21['include']=[{'all':!![]}];}return db[_0xafe3('0x41')][_0xafe3('0x42')](_0x3c2c21);})[_0xafe3('0x26')](function(_0x2eab16){_0xdd1466[_0xafe3('0x43')]=_0x2eab16;return _0xdd1466;})[_0xafe3('0x26')](respondWithFilteredResult(_0x2e5153,_0x3c2c21))[_0xafe3('0x44')](handleError(_0x2e5153,null));};exports[_0xafe3('0x45')]=function(_0x22199f,_0x14a4cd){var _0x22a2b9={'raw':![],'where':{'id':_0x22199f['params']['id']}},_0x9205db={};_0x9205db[_0xafe3('0x30')]=_[_0xafe3('0x46')](db[_0xafe3('0x41')][_0xafe3('0x2c')]);_0x9205db[_0xafe3('0x31')]=_[_0xafe3('0x46')](_0x22199f[_0xafe3('0x31')]);_0x9205db['filters']=_[_0xafe3('0x33')](_0x9205db[_0xafe3('0x30')],_0x9205db[_0xafe3('0x31')]);_0x22a2b9[_0xafe3('0x35')]=_[_0xafe3('0x33')](_0x9205db[_0xafe3('0x30')],qs[_0xafe3('0x34')](_0x22199f[_0xafe3('0x31')]['fields']));_0x22a2b9[_0xafe3('0x35')]=_0x22a2b9[_0xafe3('0x35')][_0xafe3('0x36')]?_0x22a2b9[_0xafe3('0x35')]:_0x9205db[_0xafe3('0x30')];if(_0x22199f[_0xafe3('0x31')]['includeAll']){_0x22a2b9[_0xafe3('0x47')]=[{'all':!![]}];}_0x22a2b9=_[_0xafe3('0x3e')]({},_0x22a2b9,_0x22199f[_0xafe3('0x3f')]);return db['Schedule']['find'](_0x22a2b9)[_0xafe3('0x26')](handleEntityNotFound(_0x14a4cd,null))[_0xafe3('0x26')](respondWithResult(_0x14a4cd,null))['catch'](handleError(_0x14a4cd,null));};exports[_0xafe3('0x48')]=function(_0x1e1af8,_0x169efa){return db['Schedule'][_0xafe3('0x48')](_0x1e1af8[_0xafe3('0x49')],{})['then'](function(_0x303fba){var _0x2b546c=_0x1e1af8[_0xafe3('0x4a')][_0xafe3('0x4b')]({'plain':!![]});if(!_0x2b546c)throw new Error(_0xafe3('0x4c'));if(_0x2b546c[_0xafe3('0x4d')]===_0xafe3('0x4a')){var _0x1116a2=_0x303fba[_0xafe3('0x4b')]({'plain':!![]});var _0x15d78c=_0xafe3('0x24');return db[_0xafe3('0x4e')][_0xafe3('0x4f')]({'where':{'name':_0x15d78c,'userProfileId':_0x2b546c[_0xafe3('0x50')]},'raw':!![]})['then'](function(_0x4a30b0){if(_0x4a30b0&&_0x4a30b0[_0xafe3('0x51')]===0x0){return db[_0xafe3('0x25')][_0xafe3('0x48')]({'name':_0x1116a2[_0xafe3('0x28')],'resourceId':_0x1116a2['id'],'type':_0x4a30b0[_0xafe3('0x28')],'sectionId':_0x4a30b0['id']},{})[_0xafe3('0x26')](function(){return _0x303fba;});}else{return _0x303fba;}})[_0xafe3('0x44')](function(_0x4b4bec){logger['error'](_0xafe3('0x52'),_0x4b4bec);throw _0x4b4bec;});}return _0x303fba;})[_0xafe3('0x26')](respondWithResult(_0x169efa,0xc9))['catch'](handleError(_0x169efa,null));};exports[_0xafe3('0x22')]=function(_0xba841c,_0x5edb07){if(_0xba841c['body']['id']){delete _0xba841c['body']['id'];}return db[_0xafe3('0x41')][_0xafe3('0x4f')]({'where':{'id':_0xba841c[_0xafe3('0x53')]['id']}})[_0xafe3('0x26')](handleEntityNotFound(_0x5edb07,null))[_0xafe3('0x26')](saveUpdates(_0xba841c[_0xafe3('0x49')],null))['then'](respondWithResult(_0x5edb07,null))['catch'](handleError(_0x5edb07,null));};exports[_0xafe3('0x23')]=function(_0x4f605f,_0x5ac23c){return db[_0xafe3('0x41')][_0xafe3('0x4f')]({'where':{'id':_0x4f605f[_0xafe3('0x53')]['id']}})[_0xafe3('0x26')](handleEntityNotFound(_0x5ac23c,null))['then'](removeEntity(_0x5ac23c,null))[_0xafe3('0x44')](handleError(_0x5ac23c,null));};exports['run']=function(_0x6c2e28,_0x356811,_0x554796){var _0x462859=require('../../config/schedule');return db[_0xafe3('0x41')][_0xafe3('0x4f')]({'where':{'id':_0x6c2e28[_0xafe3('0x53')]['id']},'raw':!![]})[_0xafe3('0x26')](handleEntityNotFound(_0x356811,null))[_0xafe3('0x26')](function(){_0x462859['run'](_0x6c2e28['params']['id']);})[_0xafe3('0x26')](respondWithStatusCode(_0x356811,null))[_0xafe3('0x44')](handleError(_0x356811,null));}; \ No newline at end of file +var _0x2fa1=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','error','name','Schedule','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','find','run','../../config/schedule','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x26f9cd,_0x3905b5){var _0x1e6c14=function(_0x3ae83c){while(--_0x3ae83c){_0x26f9cd['push'](_0x26f9cd['shift']());}};_0x1e6c14(++_0x3905b5);}(_0x2fa1,0xf1));var _0x12fa=function(_0x6f9d49,_0x548a36){_0x6f9d49=_0x6f9d49-0x0;var _0x36dc14=_0x2fa1[_0x6f9d49];return _0x36dc14;};'use strict';var pdf=require(_0x12fa('0x0'));var emlformat=require(_0x12fa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x12fa('0x2'));var rp=require(_0x12fa('0x3'));var moment=require(_0x12fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12fa('0x5'));var util=require(_0x12fa('0x6'));var path=require(_0x12fa('0x7'));var sox=require(_0x12fa('0x8'));var csv=require(_0x12fa('0x9'));var ejs=require(_0x12fa('0xa'));var fs=require('fs');var _=require(_0x12fa('0xb'));var squel=require(_0x12fa('0xc'));var crypto=require(_0x12fa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x12fa('0xe'));var toCsv=require(_0x12fa('0x9'));var querystring=require(_0x12fa('0xf'));var Papa=require(_0x12fa('0x10'));var Redis=require(_0x12fa('0x11'));var authService=require(_0x12fa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x12fa('0x13'));var hardwareService=require(_0x12fa('0x14'));var logger=require(_0x12fa('0x15'))(_0x12fa('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c36e,_0x26241c){_0x26241c=_0x26241c||0xcc;return function(_0x101243){if(_0x101243){return _0x36c36e[_0x12fa('0x17')](_0x26241c);}return _0x36c36e[_0x12fa('0x18')](_0x26241c)[_0x12fa('0x19')]();};}function respondWithResult(_0x41b771,_0x25d054){_0x25d054=_0x25d054||0xc8;return function(_0x43383d){if(_0x43383d){return _0x41b771[_0x12fa('0x18')](_0x25d054)[_0x12fa('0x1a')](_0x43383d);}};}function respondWithFilteredResult(_0x3c9e8f,_0x4f2289){return function(_0x17a12f){if(_0x17a12f){var _0x575ea9=_0x17a12f[_0x12fa('0x1b')],_0x9a966e=_0x4f2289[_0x12fa('0x1c')],_0x358fae=_0x4f2289[_0x12fa('0x1c')]+_0x4f2289[_0x12fa('0x1d')],_0x277b54;if(_0x358fae>=_0x575ea9){_0x358fae=_0x575ea9;_0x277b54=0xc8;}else{_0x277b54=0xce;}_0x3c9e8f[_0x12fa('0x18')](_0x277b54);return _0x3c9e8f[_0x12fa('0x1e')](_0x12fa('0x1f'),_0x9a966e+'-'+_0x358fae+'/'+_0x575ea9)[_0x12fa('0x1a')](_0x17a12f);}return null;};}function patchUpdates(_0x33084){return function(_0x7a6e5c){try{jsonpatch[_0x12fa('0x20')](_0x7a6e5c,_0x33084,!![]);}catch(_0x23a01c){return BPromise[_0x12fa('0x21')](_0x23a01c);}return _0x7a6e5c[_0x12fa('0x22')]();};}function saveUpdates(_0x4bd3c7,_0x424a96){return function(_0x540d13){if(_0x540d13){return _0x540d13[_0x12fa('0x23')](_0x4bd3c7)[_0x12fa('0x24')](function(_0x2692ba){return _0x2692ba;});}return null;};}function removeEntity(_0x449b95,_0x5ae8c4){return function(_0x264ad6){if(_0x264ad6){return _0x264ad6[_0x12fa('0x25')]()[_0x12fa('0x24')](function(){var _0xbc2891=_0x264ad6[_0x12fa('0x26')]({'plain':!![]});var _0x33417f=_0x12fa('0x27');return db['UserProfileResource'][_0x12fa('0x25')]({'where':{'type':_0x33417f,'resourceId':_0xbc2891['id']}})[_0x12fa('0x24')](function(){return _0x264ad6;});})[_0x12fa('0x24')](function(){_0x449b95[_0x12fa('0x18')](0xcc)[_0x12fa('0x19')]();});}};}function handleEntityNotFound(_0x4f1a9c,_0xf65eae){return function(_0x3b6fee){if(!_0x3b6fee){_0x4f1a9c['sendStatus'](0x194);}return _0x3b6fee;};}function handleError(_0x3d519e,_0x46a9a2){_0x46a9a2=_0x46a9a2||0x1f4;return function(_0xafaff6){logger[_0x12fa('0x28')](_0xafaff6['stack']);if(_0xafaff6[_0x12fa('0x29')]){delete _0xafaff6['name'];}_0x3d519e[_0x12fa('0x18')](_0x46a9a2)['send'](_0xafaff6);};}exports['index']=function(_0x4ab90d,_0x312d58){var _0x2addc4={},_0x17527b={},_0x1911a5={'count':0x0,'rows':[]};var _0x170fe0=_['map'](db[_0x12fa('0x2a')][_0x12fa('0x2b')],function(_0x5578db){return{'name':_0x5578db[_0x12fa('0x2c')],'type':_0x5578db['type']['key']};});_0x17527b['model']=_[_0x12fa('0x2d')](_0x170fe0,'name');_0x17527b[_0x12fa('0x2e')]=_[_0x12fa('0x2f')](_0x4ab90d[_0x12fa('0x2e')]);_0x17527b[_0x12fa('0x30')]=_[_0x12fa('0x31')](_0x17527b[_0x12fa('0x32')],_0x17527b[_0x12fa('0x2e')]);_0x2addc4[_0x12fa('0x33')]=_['intersection'](_0x17527b[_0x12fa('0x32')],qs[_0x12fa('0x34')](_0x4ab90d['query'][_0x12fa('0x34')]));_0x2addc4[_0x12fa('0x33')]=_0x2addc4[_0x12fa('0x33')][_0x12fa('0x35')]?_0x2addc4[_0x12fa('0x33')]:_0x17527b[_0x12fa('0x32')];if(!_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x36')](_0x12fa('0x37'))){_0x2addc4[_0x12fa('0x1d')]=qs[_0x12fa('0x1d')](_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x1d')]);_0x2addc4['offset']=qs[_0x12fa('0x1c')](_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x1c')]);}_0x2addc4[_0x12fa('0x38')]=qs[_0x12fa('0x39')](_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x39')]);_0x2addc4[_0x12fa('0x3a')]=qs[_0x12fa('0x30')](_[_0x12fa('0x3b')](_0x4ab90d['query'],_0x17527b['filters']),_0x170fe0);if(_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x3c')]){_0x2addc4[_0x12fa('0x3a')]=_[_0x12fa('0x3d')](_0x2addc4[_0x12fa('0x3a')],{'$or':_[_0x12fa('0x2d')](_0x170fe0,function(_0x4af429){if(_0x4af429['type']!=='VIRTUAL'){var _0xd63e93={};_0xd63e93[_0x4af429[_0x12fa('0x29')]]={'$like':'%'+_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x3c')]+'%'};return _0xd63e93;}})});}_0x2addc4=_[_0x12fa('0x3d')]({},_0x2addc4,_0x4ab90d['options']);var _0x4df425={'where':_0x2addc4['where']};return db[_0x12fa('0x2a')][_0x12fa('0x1b')](_0x4df425)[_0x12fa('0x24')](function(_0x510e75){_0x1911a5[_0x12fa('0x1b')]=_0x510e75;if(_0x4ab90d[_0x12fa('0x2e')][_0x12fa('0x3e')]){_0x2addc4[_0x12fa('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0x12fa('0x40')](_0x2addc4);})[_0x12fa('0x24')](function(_0x458190){_0x1911a5[_0x12fa('0x41')]=_0x458190;return _0x1911a5;})[_0x12fa('0x24')](respondWithFilteredResult(_0x312d58,_0x2addc4))['catch'](handleError(_0x312d58,null));};exports[_0x12fa('0x42')]=function(_0x26d67f,_0x4a649e){var _0x4dc97a={'raw':![],'where':{'id':_0x26d67f[_0x12fa('0x43')]['id']}},_0x34ac9f={};_0x34ac9f[_0x12fa('0x32')]=_['keys'](db[_0x12fa('0x2a')]['rawAttributes']);_0x34ac9f[_0x12fa('0x2e')]=_['keys'](_0x26d67f[_0x12fa('0x2e')]);_0x34ac9f[_0x12fa('0x30')]=_[_0x12fa('0x31')](_0x34ac9f['model'],_0x34ac9f['query']);_0x4dc97a[_0x12fa('0x33')]=_['intersection'](_0x34ac9f['model'],qs[_0x12fa('0x34')](_0x26d67f[_0x12fa('0x2e')]['fields']));_0x4dc97a[_0x12fa('0x33')]=_0x4dc97a['attributes'][_0x12fa('0x35')]?_0x4dc97a[_0x12fa('0x33')]:_0x34ac9f[_0x12fa('0x32')];if(_0x26d67f[_0x12fa('0x2e')][_0x12fa('0x3e')]){_0x4dc97a[_0x12fa('0x3f')]=[{'all':!![]}];}_0x4dc97a=_[_0x12fa('0x3d')]({},_0x4dc97a,_0x26d67f[_0x12fa('0x44')]);return db[_0x12fa('0x2a')]['find'](_0x4dc97a)[_0x12fa('0x24')](handleEntityNotFound(_0x4a649e,null))['then'](respondWithResult(_0x4a649e,null))['catch'](handleError(_0x4a649e,null));};exports['create']=function(_0xbb2789,_0x32e0eb){return db[_0x12fa('0x2a')][_0x12fa('0x45')](_0xbb2789['body'],{})[_0x12fa('0x24')](function(_0x50856f){var _0x5f04d2=_0xbb2789[_0x12fa('0x46')][_0x12fa('0x26')]({'plain':!![]});if(!_0x5f04d2)throw new Error(_0x12fa('0x47'));if(_0x5f04d2[_0x12fa('0x48')]==='user'){var _0x5449f5=_0x50856f[_0x12fa('0x26')]({'plain':!![]});var _0x47bf54='Scheduler';return db[_0x12fa('0x49')]['find']({'where':{'name':_0x47bf54,'userProfileId':_0x5f04d2['userProfileId']},'raw':!![]})[_0x12fa('0x24')](function(_0x18ac21){if(_0x18ac21&&_0x18ac21[_0x12fa('0x4a')]===0x0){return db[_0x12fa('0x4b')][_0x12fa('0x45')]({'name':_0x5449f5[_0x12fa('0x29')],'resourceId':_0x5449f5['id'],'type':_0x18ac21[_0x12fa('0x29')],'sectionId':_0x18ac21['id']},{})['then'](function(){return _0x50856f;});}else{return _0x50856f;}})['catch'](function(_0x319b4c){logger[_0x12fa('0x28')](_0x12fa('0x4c'),_0x319b4c);throw _0x319b4c;});}return _0x50856f;})[_0x12fa('0x24')](respondWithResult(_0x32e0eb,0xc9))[_0x12fa('0x4d')](handleError(_0x32e0eb,null));};exports[_0x12fa('0x23')]=function(_0x169459,_0x884a8d){if(_0x169459[_0x12fa('0x4e')]['id']){delete _0x169459['body']['id'];}return db[_0x12fa('0x2a')][_0x12fa('0x4f')]({'where':{'id':_0x169459[_0x12fa('0x43')]['id']}})[_0x12fa('0x24')](handleEntityNotFound(_0x884a8d,null))[_0x12fa('0x24')](saveUpdates(_0x169459[_0x12fa('0x4e')],null))[_0x12fa('0x24')](respondWithResult(_0x884a8d,null))[_0x12fa('0x4d')](handleError(_0x884a8d,null));};exports[_0x12fa('0x25')]=function(_0x5289e6,_0x256ba0){return db[_0x12fa('0x2a')][_0x12fa('0x4f')]({'where':{'id':_0x5289e6['params']['id']}})[_0x12fa('0x24')](handleEntityNotFound(_0x256ba0,null))['then'](removeEntity(_0x256ba0,null))['catch'](handleError(_0x256ba0,null));};exports[_0x12fa('0x50')]=function(_0x5cd416,_0x4bd0b2,_0x58810a){var _0x5295a9=require(_0x12fa('0x51'));return db[_0x12fa('0x2a')][_0x12fa('0x4f')]({'where':{'id':_0x5cd416[_0x12fa('0x43')]['id']},'raw':!![]})[_0x12fa('0x24')](handleEntityNotFound(_0x4bd0b2,null))[_0x12fa('0x24')](function(){_0x5295a9[_0x12fa('0x50')](_0x5cd416[_0x12fa('0x43')]['id']);})[_0x12fa('0x24')](respondWithStatusCode(_0x4bd0b2,null))['catch'](handleError(_0x4bd0b2,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0692b82..e422a6a 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 _0x8715=['./schedule.attributes','exports','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e1be1,_0x18e1bf){var _0x263af6=function(_0x37a8e9){while(--_0x37a8e9){_0x3e1be1['push'](_0x3e1be1['shift']());}};_0x263af6(++_0x18e1bf);}(_0x8715,0x93));var _0x5871=function(_0x40a046,_0x54b2a3){_0x40a046=_0x40a046-0x0;var _0x5f35b4=_0x8715[_0x40a046];return _0x5f35b4;};'use strict';var _=require('lodash');var util=require(_0x5871('0x0'));var logger=require(_0x5871('0x1'))(_0x5871('0x2'));var moment=require(_0x5871('0x3'));var BPromise=require(_0x5871('0x4'));var rp=require(_0x5871('0x5'));var fs=require('fs');var path=require(_0x5871('0x6'));var rimraf=require(_0x5871('0x7'));var config=require(_0x5871('0x8'));var attributes=require(_0x5871('0x9'));module[_0x5871('0xa')]=function(_0x545098,_0x2131d7){return _0x545098['define'](_0x5871('0xb'),attributes,{'tableName':_0x5871('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ff3=['tools_schedules','util','api','moment','request-promise','path','../../config/environment','./schedule.attributes','exports','Schedule'];(function(_0x96c9c,_0x4ca96f){var _0x595909=function(_0x3ce2b8){while(--_0x3ce2b8){_0x96c9c['push'](_0x96c9c['shift']());}};_0x595909(++_0x4ca96f);}(_0x7ff3,0x1cd));var _0x37ff=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0x7ff3[_0x223c0d];return _0x207827;};'use strict';var _=require('lodash');var util=require(_0x37ff('0x0'));var logger=require('../../config/logger')(_0x37ff('0x1'));var moment=require(_0x37ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x37ff('0x3'));var fs=require('fs');var path=require(_0x37ff('0x4'));var rimraf=require('rimraf');var config=require(_0x37ff('0x5'));var attributes=require(_0x37ff('0x6'));module[_0x37ff('0x7')]=function(_0x25e58,_0xff13a2){return _0x25e58['define'](_0x37ff('0x8'),attributes,{'tableName':_0x37ff('0x9'),'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 e7ca135..6b853be 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 _0x8e9d=['http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x22dc70,_0x36378a){var _0x3596b3=function(_0x45afb1){while(--_0x45afb1){_0x22dc70['push'](_0x22dc70['shift']());}};_0x3596b3(++_0x36378a);}(_0x8e9d,0x69));var _0xd8e9=function(_0x35df50,_0xeff270){_0x35df50=_0x35df50-0x0;var _0x1254da=_0x8e9d[_0x35df50];return _0x1254da;};'use strict';var _=require(_0xd8e9('0x0'));var util=require(_0xd8e9('0x1'));var moment=require(_0xd8e9('0x2'));var BPromise=require(_0xd8e9('0x3'));var rs=require(_0xd8e9('0x4'));var fs=require('fs');var Redis=require(_0xd8e9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8e9('0x6'));var logger=require('../../config/logger')(_0xd8e9('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8e9('0x8'));var client=jayson[_0xd8e9('0x9')][_0xd8e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b21a7,_0x508f6d,_0x5848e4){return new BPromise(function(_0x752910,_0x1d69d9){return client[_0xd8e9('0xb')](_0x2b21a7,_0x5848e4)['then'](function(_0x5deaf9){logger[_0xd8e9('0xc')](_0xd8e9('0xd'),_0x508f6d,_0xd8e9('0xe'));logger[_0xd8e9('0xf')](_0xd8e9('0x10'),_0x508f6d,'request\x20sent',JSON[_0xd8e9('0x11')](_0x5deaf9));if(_0x5deaf9['error']){if(_0x5deaf9[_0xd8e9('0x12')][_0xd8e9('0x13')]===0x1f4){logger[_0xd8e9('0x12')]('Schedule,\x20%s,\x20%s',_0x508f6d,_0x5deaf9[_0xd8e9('0x12')][_0xd8e9('0x14')]);return _0x1d69d9(_0x5deaf9[_0xd8e9('0x12')][_0xd8e9('0x14')]);}logger[_0xd8e9('0x12')](_0xd8e9('0xd'),_0x508f6d,_0x5deaf9['error'][_0xd8e9('0x14')]);return _0x752910(_0x5deaf9[_0xd8e9('0x12')][_0xd8e9('0x14')]);}else{logger['info'](_0xd8e9('0xd'),_0x508f6d,'request\x20sent');_0x752910(_0x5deaf9[_0xd8e9('0x15')][_0xd8e9('0x14')]);}})[_0xd8e9('0x16')](function(_0x266a7a){logger['error'](_0xd8e9('0xd'),_0x508f6d,_0x266a7a);_0x1d69d9(_0x266a7a);});});} \ No newline at end of file +var _0x4487=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','debug','code','error','message','request\x20sent','catch','lodash','util'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x4487,0xbb));var _0x7448=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x4487[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x7448('0x0'));var util=require(_0x7448('0x1'));var moment=require(_0x7448('0x2'));var BPromise=require('bluebird');var rs=require(_0x7448('0x3'));var fs=require('fs');var Redis=require(_0x7448('0x4'));var db=require(_0x7448('0x5'))['db'];var utils=require(_0x7448('0x6'));var logger=require(_0x7448('0x7'))(_0x7448('0x8'));var config=require(_0x7448('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7448('0xa')][_0x7448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28d4a5,_0x108393,_0x57a25f){return new BPromise(function(_0x385adb,_0x3b193e){return client[_0x7448('0xc')](_0x28d4a5,_0x57a25f)['then'](function(_0x54d228){logger[_0x7448('0xd')](_0x7448('0xe'),_0x108393,'request\x20sent');logger[_0x7448('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x108393,'request\x20sent',JSON['stringify'](_0x54d228));if(_0x54d228['error']){if(_0x54d228['error'][_0x7448('0x10')]===0x1f4){logger[_0x7448('0x11')]('Schedule,\x20%s,\x20%s',_0x108393,_0x54d228[_0x7448('0x11')]['message']);return _0x3b193e(_0x54d228[_0x7448('0x11')][_0x7448('0x12')]);}logger[_0x7448('0x11')](_0x7448('0xe'),_0x108393,_0x54d228[_0x7448('0x11')]['message']);return _0x385adb(_0x54d228[_0x7448('0x11')][_0x7448('0x12')]);}else{logger[_0x7448('0xd')](_0x7448('0xe'),_0x108393,_0x7448('0x13'));_0x385adb(_0x54d228['result'][_0x7448('0x12')]);}})[_0x7448('0x14')](function(_0x479cfa){logger[_0x7448('0x11')](_0x7448('0xe'),_0x108393,_0x479cfa);_0x3b193e(_0x479cfa);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cc636a5..4dc8408 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 _0xca23=['/describe','describe','/:id','show','/:id/download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x5e21b4,_0x166ad4){var _0x5d7297=function(_0x32f4f2){while(--_0x32f4f2){_0x5e21b4['push'](_0x5e21b4['shift']());}};_0x5d7297(++_0x166ad4);}(_0xca23,0x1ee));var _0x3ca2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xca23[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3ca2('0x0'));var util=require(_0x3ca2('0x1'));var path=require(_0x3ca2('0x2'));var timeout=require(_0x3ca2('0x3'));var express=require(_0x3ca2('0x4'));var router=express[_0x3ca2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ca2('0x6'));var config=require(_0x3ca2('0x7'));var controller=require(_0x3ca2('0x8'));router[_0x3ca2('0x9')]('/',auth[_0x3ca2('0xa')](),controller[_0x3ca2('0xb')]);router[_0x3ca2('0x9')](_0x3ca2('0xc'),auth[_0x3ca2('0xa')](),controller[_0x3ca2('0xd')]);router[_0x3ca2('0x9')](_0x3ca2('0xe'),auth[_0x3ca2('0xa')](),controller[_0x3ca2('0xf')]);router['get'](_0x3ca2('0x10'),auth[_0x3ca2('0xa')](),controller['download']);router[_0x3ca2('0x11')]('/',auth['isAuthenticated'](),controller[_0x3ca2('0x12')]);router[_0x3ca2('0x13')](_0x3ca2('0xe'),auth[_0x3ca2('0xa')](),controller[_0x3ca2('0x14')]);router['delete'](_0x3ca2('0xe'),auth[_0x3ca2('0xa')](),controller[_0x3ca2('0x15')]);module[_0x3ca2('0x16')]=router; \ No newline at end of file +var _0x00bd=['../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x19ff5a,_0x5cbd84){var _0x10561d=function(_0x595ce1){while(--_0x595ce1){_0x19ff5a['push'](_0x19ff5a['shift']());}};_0x10561d(++_0x5cbd84);}(_0x00bd,0x126));var _0xd00b=function(_0xe4a382,_0x3a9f85){_0xe4a382=_0xe4a382-0x0;var _0x2ec46c=_0x00bd[_0xe4a382];return _0x2ec46c;};'use strict';var multer=require(_0xd00b('0x0'));var util=require(_0xd00b('0x1'));var path=require(_0xd00b('0x2'));var timeout=require(_0xd00b('0x3'));var express=require('express');var router=express[_0xd00b('0x4')]();var auth=require(_0xd00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd00b('0x6'));var controller=require(_0xd00b('0x7'));router[_0xd00b('0x8')]('/',auth[_0xd00b('0x9')](),controller['index']);router['get'](_0xd00b('0xa'),auth[_0xd00b('0x9')](),controller[_0xd00b('0xb')]);router['get'](_0xd00b('0xc'),auth[_0xd00b('0x9')](),controller[_0xd00b('0xd')]);router[_0xd00b('0x8')]('/:id/download',auth[_0xd00b('0x9')](),controller['download']);router['post']('/',auth[_0xd00b('0x9')](),controller[_0xd00b('0xe')]);router[_0xd00b('0xf')](_0xd00b('0xc'),auth[_0xd00b('0x9')](),controller[_0xd00b('0x10')]);router[_0xd00b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd00b('0x12')]);module[_0xd00b('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d0c4595..2bd5f03 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 _0x7217=['value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x7721('0x0'));var moment=require('moment');var path=require(_0x7721('0x1'));var config=require(_0x7721('0x2'));module[_0x7721('0x3')]={'format':{'type':Sequelize[_0x7721('0x4')],'get':function(){return this[_0x7721('0x5')]('value')?path['extname'](this[_0x7721('0x5')](_0x7721('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x7721('0x7')]},'channel':{'type':Sequelize[_0x7721('0x7')]},'value':{'type':Sequelize[_0x7721('0x7')],'set':function(_0xf7ff37){var _0x18ab6b=_0xf7ff37[_0x7721('0x8')](/\\/g,'/');this[_0x7721('0x9')](_0x7721('0x6'),_0x18ab6b);}},'rating':{'type':Sequelize[_0x7721('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7721('0xa')],'set':function(_0xfa8835){this[_0x7721('0x9')](_0x7721('0xb'),moment()['subtract'](_0xfa8835,'ms'));this[_0x7721('0x9')](_0x7721('0xc'),moment());this[_0x7721('0x9')](_0x7721('0xd'),_0xfa8835);}},'startedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0xb')))[_0x7721('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x7721('0x10')]();}},'closedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this['getDataValue'](_0x7721('0xc')))[_0x7721('0xf')](_0x7721('0x11'))[_0x7721('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0x13')))[_0x7721('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x7721('0x10')]();}}}; \ No newline at end of file +var _0x7dfd=['startedAt','setDataValue','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER'];(function(_0x34e79d,_0x1fb826){var _0x56afa8=function(_0x5177f4){while(--_0x5177f4){_0x34e79d['push'](_0x34e79d['shift']());}};_0x56afa8(++_0x1fb826);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var config=require(_0xd7df('0x3'));module[_0xd7df('0x4')]={'format':{'type':Sequelize[_0xd7df('0x5')],'get':function(){return this[_0xd7df('0x6')](_0xd7df('0x7'))?path[_0xd7df('0x8')](this[_0xd7df('0x6')](_0xd7df('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xd7df('0x9')]},'channel':{'type':Sequelize[_0xd7df('0x9')]},'value':{'type':Sequelize[_0xd7df('0x9')],'set':function(_0x354ea7){var _0x16e50=_0x354ea7[_0xd7df('0xa')](/\\/g,'/');this['setDataValue'](_0xd7df('0x7'),_0x16e50);}},'rating':{'type':Sequelize[_0xd7df('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd7df('0xb')],'set':function(_0x3dee59){this['setDataValue'](_0xd7df('0xc'),moment()['subtract'](_0x3dee59,'ms'));this[_0xd7df('0xd')]('closedAt',moment());this[_0xd7df('0xd')](_0xd7df('0xe'),_0x3dee59);}},'startedAt':{'type':Sequelize[_0xd7df('0xf')],'get':function(){return moment(this[_0xd7df('0x6')](_0xd7df('0xc')))[_0xd7df('0x10')](_0xd7df('0x11'))[_0xd7df('0x12')]();}},'closedAt':{'type':Sequelize[_0xd7df('0xf')],'get':function(){return moment(this[_0xd7df('0x6')](_0xd7df('0x13')))[_0xd7df('0x10')](_0xd7df('0x11'))[_0xd7df('0x12')]();}},'createdAt':{'type':Sequelize[_0xd7df('0xf')],'get':function(){return moment(this[_0xd7df('0x6')](_0xd7df('0x14')))['format'](_0xd7df('0x11'))[_0xd7df('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd7df('0x6')](_0xd7df('0x15')))['format'](_0xd7df('0x11'))[_0xd7df('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2d54ffb..cc0e146 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 _0x140b=['filename','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','json','offset','Content-Range','apply','reject','save','then','error','stack','name','index','ScreenRecording','rawAttributes','type','key','model','map','format','keys','query','filters','intersection','attributes','hasOwnProperty','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','rows','show','fields','length','find','catch','create','body','update','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','params','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','join','ValidationError'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0x140b,0x6f));var _0xb140=function(_0x3c57c7,_0x28167f){_0x3c57c7=_0x3c57c7-0x0;var _0x396f0f=_0x140b[_0x3c57c7];return _0x396f0f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb140('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb140('0x1'));var rp=require(_0xb140('0x2'));var moment=require(_0xb140('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb140('0x4'));var util=require(_0xb140('0x5'));var path=require(_0xb140('0x6'));var sox=require(_0xb140('0x7'));var csv=require(_0xb140('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb140('0x9'));var squel=require(_0xb140('0xa'));var crypto=require(_0xb140('0xb'));var jsforce=require(_0xb140('0xc'));var deskjs=require(_0xb140('0xd'));var toCsv=require(_0xb140('0x8'));var querystring=require(_0xb140('0xe'));var Papa=require(_0xb140('0xf'));var Redis=require(_0xb140('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb140('0x11'));var as=require(_0xb140('0x12'));var hardwareService=require(_0xb140('0x13'));var logger=require('../../config/logger')(_0xb140('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb140('0x15'))['db'];function respondWithStatusCode(_0x3878d1,_0x185c47){_0x185c47=_0x185c47||0xcc;return function(_0x2b5f58){if(_0x2b5f58){return _0x3878d1[_0xb140('0x16')](_0x185c47);}return _0x3878d1['status'](_0x185c47)[_0xb140('0x17')]();};}function respondWithResult(_0x8eb761,_0x3c3238){_0x3c3238=_0x3c3238||0xc8;return function(_0x16ad32){if(_0x16ad32){return _0x8eb761[_0xb140('0x18')](_0x3c3238)[_0xb140('0x19')](_0x16ad32);}};}function respondWithFilteredResult(_0x554b8c,_0x442801){return function(_0x49c9de){if(_0x49c9de){var _0x5360f2=_0x49c9de['count'],_0x4c6aea=_0x442801['offset'],_0x4d8dc6=_0x442801[_0xb140('0x1a')]+_0x442801['limit'],_0x18bee6;if(_0x4d8dc6>=_0x5360f2){_0x4d8dc6=_0x5360f2;_0x18bee6=0xc8;}else{_0x18bee6=0xce;}_0x554b8c['status'](_0x18bee6);return _0x554b8c['set'](_0xb140('0x1b'),_0x4c6aea+'-'+_0x4d8dc6+'/'+_0x5360f2)[_0xb140('0x19')](_0x49c9de);}return null;};}function patchUpdates(_0x3f0270){return function(_0x5a00df){try{jsonpatch[_0xb140('0x1c')](_0x5a00df,_0x3f0270,!![]);}catch(_0x1362eb){return BPromise[_0xb140('0x1d')](_0x1362eb);}return _0x5a00df[_0xb140('0x1e')]();};}function saveUpdates(_0x13321c,_0x1d7cdf){return function(_0x519615){if(_0x519615){return _0x519615['update'](_0x13321c)['then'](function(_0x516aa2){return _0x516aa2;});}return null;};}function removeEntity(_0x38c424,_0x2e0646){return function(_0x16d651){if(_0x16d651){return _0x16d651['destroy']()[_0xb140('0x1f')](function(){_0x38c424[_0xb140('0x18')](0xcc)[_0xb140('0x17')]();});}};}function handleEntityNotFound(_0x4ce982,_0x364519){return function(_0x48c5e6){if(!_0x48c5e6){_0x4ce982['sendStatus'](0x194);}return _0x48c5e6;};}function handleError(_0xf38f36,_0x392650){_0x392650=_0x392650||0x1f4;return function(_0x182584){logger[_0xb140('0x20')](_0x182584[_0xb140('0x21')]);if(_0x182584[_0xb140('0x22')]){delete _0x182584[_0xb140('0x22')];}_0xf38f36['status'](_0x392650)['send'](_0x182584);};}exports[_0xb140('0x23')]=function(_0x1a5afe,_0x3ff8b3){var _0x24af00={},_0x35c3c4={},_0x101ab5={'count':0x0,'rows':[]};var _0x2f5216=_['map'](db[_0xb140('0x24')][_0xb140('0x25')],function(_0xc2d4ea){return{'name':_0xc2d4ea['fieldName'],'type':_0xc2d4ea[_0xb140('0x26')][_0xb140('0x27')]};});_0x35c3c4[_0xb140('0x28')]=_['differenceBy'](_[_0xb140('0x29')](_0x2f5216,_0xb140('0x22')),[_0xb140('0x2a')]);_0x35c3c4['query']=_[_0xb140('0x2b')](_0x1a5afe[_0xb140('0x2c')]);_0x35c3c4[_0xb140('0x2d')]=_[_0xb140('0x2e')](_0x35c3c4['model'],_0x35c3c4[_0xb140('0x2c')]);_0x24af00[_0xb140('0x2f')]=_[_0xb140('0x2e')](_0x35c3c4[_0xb140('0x28')],qs['fields'](_0x1a5afe[_0xb140('0x2c')]['fields']));_0x24af00['attributes']=_0x24af00[_0xb140('0x2f')]['length']?_0x24af00[_0xb140('0x2f')]:_0x35c3c4[_0xb140('0x28')];if(!_0x1a5afe['query'][_0xb140('0x30')]('nolimit')){_0x24af00[_0xb140('0x31')]=qs[_0xb140('0x31')](_0x1a5afe[_0xb140('0x2c')][_0xb140('0x31')]);_0x24af00['offset']=qs[_0xb140('0x1a')](_0x1a5afe[_0xb140('0x2c')][_0xb140('0x1a')]);}_0x24af00[_0xb140('0x32')]=qs[_0xb140('0x33')](_0x1a5afe['query']['sort']);_0x24af00['where']=qs[_0xb140('0x2d')](_[_0xb140('0x34')](_0x1a5afe['query'],_0x35c3c4[_0xb140('0x2d')]),_0x2f5216);if(_0x1a5afe[_0xb140('0x2c')][_0xb140('0x35')]){_0x24af00['where']=_[_0xb140('0x36')](_0x24af00[_0xb140('0x37')],{'$or':_[_0xb140('0x29')](_0x2f5216,function(_0x300565){if(_0x300565['type']!==_0xb140('0x38')){var _0x500fe6={};_0x500fe6[_0x300565[_0xb140('0x22')]]={'$like':'%'+_0x1a5afe['query']['filter']+'%'};return _0x500fe6;}})});}_0x24af00=_[_0xb140('0x36')]({},_0x24af00,_0x1a5afe[_0xb140('0x39')]);var _0x9252e0={'where':_0x24af00[_0xb140('0x37')]};return db[_0xb140('0x24')][_0xb140('0x3a')](_0x9252e0)[_0xb140('0x1f')](function(_0x30ac68){_0x101ab5[_0xb140('0x3a')]=_0x30ac68;if(_0x1a5afe['query'][_0xb140('0x3b')]){_0x24af00[_0xb140('0x3c')]=[{'all':!![]}];}return db[_0xb140('0x24')]['findAll'](_0x24af00);})['then'](function(_0x5576a0){_0x101ab5[_0xb140('0x3d')]=_0x5576a0;return _0x101ab5;})[_0xb140('0x1f')](respondWithFilteredResult(_0x3ff8b3,_0x24af00))['catch'](handleError(_0x3ff8b3,null));};exports[_0xb140('0x3e')]=function(_0x579ab5,_0x57ae5c){var _0x522225={'raw':![],'where':{'id':_0x579ab5['params']['id']}},_0xd4e191={};_0xd4e191[_0xb140('0x28')]=_[_0xb140('0x2b')](db[_0xb140('0x24')][_0xb140('0x25')]);_0xd4e191[_0xb140('0x2c')]=_['keys'](_0x579ab5[_0xb140('0x2c')]);_0xd4e191[_0xb140('0x2d')]=_[_0xb140('0x2e')](_0xd4e191[_0xb140('0x28')],_0xd4e191[_0xb140('0x2c')]);_0x522225[_0xb140('0x2f')]=_['intersection'](_0xd4e191[_0xb140('0x28')],qs['fields'](_0x579ab5[_0xb140('0x2c')][_0xb140('0x3f')]));_0x522225['attributes']=_0x522225[_0xb140('0x2f')][_0xb140('0x40')]?_0x522225['attributes']:_0xd4e191[_0xb140('0x28')];if(_0x579ab5['query'][_0xb140('0x3b')]){_0x522225[_0xb140('0x3c')]=[{'all':!![]}];}_0x522225=_['merge']({},_0x522225,_0x579ab5[_0xb140('0x39')]);return db[_0xb140('0x24')][_0xb140('0x41')](_0x522225)['then'](handleEntityNotFound(_0x57ae5c,null))[_0xb140('0x1f')](respondWithResult(_0x57ae5c,null))[_0xb140('0x42')](handleError(_0x57ae5c,null));};exports[_0xb140('0x43')]=function(_0x1f6d44,_0x3ce308){return db[_0xb140('0x24')][_0xb140('0x43')](_0x1f6d44[_0xb140('0x44')],{})[_0xb140('0x1f')](respondWithResult(_0x3ce308,0xc9))[_0xb140('0x42')](handleError(_0x3ce308,null));};exports[_0xb140('0x45')]=function(_0x5ec966,_0x4d2a8d){if(_0x5ec966['body']['id']){delete _0x5ec966[_0xb140('0x44')]['id'];}delete _0x5ec966[_0xb140('0x44')][_0xb140('0x46')];delete _0x5ec966[_0xb140('0x44')][_0xb140('0x47')];delete _0x5ec966['body'][_0xb140('0x48')];delete _0x5ec966[_0xb140('0x44')][_0xb140('0x49')];return db['ScreenRecording'][_0xb140('0x41')]({'where':{'id':_0x5ec966['params']['id']}})[_0xb140('0x1f')](handleEntityNotFound(_0x4d2a8d,null))['then'](saveUpdates(_0x5ec966[_0xb140('0x44')],null))[_0xb140('0x1f')](respondWithResult(_0x4d2a8d,null))[_0xb140('0x42')](handleError(_0x4d2a8d,null));};exports[_0xb140('0x4a')]=function(_0x3e729d,_0x6ff37c){return db[_0xb140('0x24')]['describe']()[_0xb140('0x1f')](respondWithResult(_0x6ff37c,null))[_0xb140('0x42')](handleError(_0x6ff37c,null));};exports[_0xb140('0x4b')]=function(_0x12aa34,_0x6f21f6,_0x3bcb07){var _0x26224d=require(_0xb140('0x4c'));var _0x29b4bc=![];var _0xa4bf99={};if(_0x12aa34[_0xb140('0x2c')][_0xb140('0x26')]&&_0x12aa34['query']['type']===_0xb140('0x4d')){_0xa4bf99[_0xb140('0x4d')]=_0x12aa34[_0xb140('0x4e')]['id'];}else{_0xa4bf99['id']=_0x12aa34['params']['id'];}return db[_0xb140('0x24')][_0xb140('0x41')]({'where':_0xa4bf99,'attributes':['id',_0xb140('0x49')],'raw':!![]})[_0xb140('0x1f')](handleEntityNotFound(_0x6f21f6,null))['then'](function(_0x5d72ee){if(_0x5d72ee){var _0x4a3226=path['join'](config[_0xb140('0x4f')],_0xb140('0x50'),_0x5d72ee[_0xb140('0x49')]);var _0x33f082=util[_0xb140('0x2a')](_0xb140('0x51'),_0x4a3226);if(fs[_0xb140('0x52')](_0x33f082)){_0x29b4bc=!![];return _0x26224d[_0xb140('0x53')](_0x33f082,_0x4a3226,config['secrets'][_0xb140('0x54')])['then'](function(){return _0x5d72ee;});}return _0x5d72ee;}})['then'](function(_0x59b301){if(_0x59b301){var _0x566953=path[_0xb140('0x55')](config[_0xb140('0x4f')],_0xb140('0x50'),_0x59b301[_0xb140('0x49')]);if(!fs[_0xb140('0x52')](_0x566953)){throw new db['Sequelize'][(_0xb140('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x59b301[_0xb140('0x57')]){return _0x6f21f6[_0xb140('0x4b')](_0x566953,_0x59b301[_0xb140('0x57')]+path['extname'](_0x566953),function(){if(_0x29b4bc){fs[_0xb140('0x58')](_0x566953);}});}else{return _0x6f21f6['download'](_0x566953,function(_0x11310c){if(_0x29b4bc){fs[_0xb140('0x58')](_0x566953);}});}}})[_0xb140('0x42')](function(_0x1ca4f7){if(_0x1ca4f7[_0xb140('0x59')]===_0xb140('0x5a')){_0x6f21f6[_0xb140('0x18')](0x194)[_0xb140('0x5b')](_0xb140('0x5c'));}else{return handleError(_0x6f21f6,null);}});};exports['destroy']=function(_0x407ca4,_0x5af3da){return db[_0xb140('0x24')]['find']({'where':{'id':_0x407ca4[_0xb140('0x4e')]['id']}})['then'](function(_0x12b5fe){if(!_0x12b5fe)throw new ReferenceError('Entity\x20not\x20found');return _0x12b5fe;})['then'](function(_0x2f779d){var _0xa0afea=path[_0xb140('0x55')](config['root'],_0xb140('0x50'),_0x2f779d[_0xb140('0x49')]);logger[_0xb140('0x5d')](_0xb140('0x5e'),_0xa0afea);if(!_['isNil'](_0x2f779d['value'])&&fs[_0xb140('0x52')](_0xa0afea)){logger[_0xb140('0x5d')]('File:\x20\x22'+_0xa0afea+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb140('0x5f')](_0xa0afea);}_0xa0afea=_0xa0afea+_0xb140('0x60');if(!_['isNil'](_0x2f779d['value'])&&fs[_0xb140('0x52')](_0xa0afea)){logger[_0xb140('0x5d')]('File:\x20\x22'+_0xa0afea+_0xb140('0x61'));fs[_0xb140('0x5f')](_0xa0afea);}return _0x2f779d;})[_0xb140('0x1f')](function(_0x46d49a){if(!_0x46d49a)throw new InternalError();return _0x46d49a[_0xb140('0x62')]();})[_0xb140('0x1f')](function(){_0x5af3da[_0xb140('0x18')](0xcc)[_0xb140('0x17')]();})[_0xb140('0x42')](handleError(_0x5af3da,null));}; \ No newline at end of file +var _0x262d=['create','body','duration','createdAt','closedAt','value','catch','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','save','update','destroy','then','error','stack','name','send','index','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','length','find'];(function(_0x1b5ba6,_0x3be496){var _0x41a3fc=function(_0x2396ca){while(--_0x2396ca){_0x1b5ba6['push'](_0x1b5ba6['shift']());}};_0x41a3fc(++_0x3be496);}(_0x262d,0x14c));var _0xd262=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x262d[_0x3a6efd];return _0x487b9a;};'use strict';var pdf=require(_0xd262('0x0'));var emlformat=require(_0xd262('0x1'));var rimraf=require(_0xd262('0x2'));var zipdir=require(_0xd262('0x3'));var jsonpatch=require(_0xd262('0x4'));var rp=require('request-promise');var moment=require(_0xd262('0x5'));var BPromise=require(_0xd262('0x6'));var Mustache=require(_0xd262('0x7'));var util=require(_0xd262('0x8'));var path=require(_0xd262('0x9'));var sox=require(_0xd262('0xa'));var csv=require('to-csv');var ejs=require(_0xd262('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd262('0xc'));var querystring=require(_0xd262('0xd'));var Papa=require('papaparse');var Redis=require(_0xd262('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd262('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd262('0x10'))(_0xd262('0x11'));var utils=require(_0xd262('0x12'));var config=require(_0xd262('0x13'));var db=require(_0xd262('0x14'))['db'];function respondWithStatusCode(_0x26ced0,_0xe44eee){_0xe44eee=_0xe44eee||0xcc;return function(_0x244eec){if(_0x244eec){return _0x26ced0[_0xd262('0x15')](_0xe44eee);}return _0x26ced0[_0xd262('0x16')](_0xe44eee)[_0xd262('0x17')]();};}function respondWithResult(_0x3e0252,_0x45a6bb){_0x45a6bb=_0x45a6bb||0xc8;return function(_0x4f54fd){if(_0x4f54fd){return _0x3e0252['status'](_0x45a6bb)['json'](_0x4f54fd);}};}function respondWithFilteredResult(_0x101ab8,_0x5575ab){return function(_0x81675d){if(_0x81675d){var _0x5b26c9=_0x81675d['count'],_0x4e2faf=_0x5575ab[_0xd262('0x18')],_0x495f94=_0x5575ab[_0xd262('0x18')]+_0x5575ab[_0xd262('0x19')],_0x358b86;if(_0x495f94>=_0x5b26c9){_0x495f94=_0x5b26c9;_0x358b86=0xc8;}else{_0x358b86=0xce;}_0x101ab8[_0xd262('0x16')](_0x358b86);return _0x101ab8[_0xd262('0x1a')](_0xd262('0x1b'),_0x4e2faf+'-'+_0x495f94+'/'+_0x5b26c9)[_0xd262('0x1c')](_0x81675d);}return null;};}function patchUpdates(_0x1821a2){return function(_0x57565f){try{jsonpatch['apply'](_0x57565f,_0x1821a2,!![]);}catch(_0x38c107){return BPromise['reject'](_0x38c107);}return _0x57565f[_0xd262('0x1d')]();};}function saveUpdates(_0x27359d,_0x77a51a){return function(_0x2c1d52){if(_0x2c1d52){return _0x2c1d52[_0xd262('0x1e')](_0x27359d)['then'](function(_0x247d6c){return _0x247d6c;});}return null;};}function removeEntity(_0xd2ccda,_0x471476){return function(_0x47fe1b){if(_0x47fe1b){return _0x47fe1b[_0xd262('0x1f')]()[_0xd262('0x20')](function(){_0xd2ccda['status'](0xcc)[_0xd262('0x17')]();});}};}function handleEntityNotFound(_0x3fed4e,_0x175394){return function(_0x4e8ee9){if(!_0x4e8ee9){_0x3fed4e[_0xd262('0x15')](0x194);}return _0x4e8ee9;};}function handleError(_0x2c8795,_0x241305){_0x241305=_0x241305||0x1f4;return function(_0x88600a){logger[_0xd262('0x21')](_0x88600a[_0xd262('0x22')]);if(_0x88600a['name']){delete _0x88600a[_0xd262('0x23')];}_0x2c8795[_0xd262('0x16')](_0x241305)[_0xd262('0x24')](_0x88600a);};}exports[_0xd262('0x25')]=function(_0x27c347,_0x213795){var _0x522639={},_0x26bc65={},_0x51470f={'count':0x0,'rows':[]};var _0x18088a=_['map'](db[_0xd262('0x26')][_0xd262('0x27')],function(_0x5288d7){return{'name':_0x5288d7[_0xd262('0x28')],'type':_0x5288d7[_0xd262('0x29')][_0xd262('0x2a')]};});_0x26bc65[_0xd262('0x2b')]=_[_0xd262('0x2c')](_[_0xd262('0x2d')](_0x18088a,_0xd262('0x23')),['format']);_0x26bc65[_0xd262('0x2e')]=_['keys'](_0x27c347[_0xd262('0x2e')]);_0x26bc65[_0xd262('0x2f')]=_[_0xd262('0x30')](_0x26bc65[_0xd262('0x2b')],_0x26bc65[_0xd262('0x2e')]);_0x522639['attributes']=_[_0xd262('0x30')](_0x26bc65[_0xd262('0x2b')],qs[_0xd262('0x31')](_0x27c347[_0xd262('0x2e')][_0xd262('0x31')]));_0x522639['attributes']=_0x522639['attributes']['length']?_0x522639[_0xd262('0x32')]:_0x26bc65[_0xd262('0x2b')];if(!_0x27c347[_0xd262('0x2e')]['hasOwnProperty'](_0xd262('0x33'))){_0x522639[_0xd262('0x19')]=qs[_0xd262('0x19')](_0x27c347['query']['limit']);_0x522639[_0xd262('0x18')]=qs[_0xd262('0x18')](_0x27c347[_0xd262('0x2e')][_0xd262('0x18')]);}_0x522639['order']=qs[_0xd262('0x34')](_0x27c347[_0xd262('0x2e')]['sort']);_0x522639[_0xd262('0x35')]=qs[_0xd262('0x2f')](_[_0xd262('0x36')](_0x27c347[_0xd262('0x2e')],_0x26bc65['filters']),_0x18088a);if(_0x27c347[_0xd262('0x2e')][_0xd262('0x37')]){_0x522639[_0xd262('0x35')]=_[_0xd262('0x38')](_0x522639['where'],{'$or':_[_0xd262('0x2d')](_0x18088a,function(_0x18db46){if(_0x18db46[_0xd262('0x29')]!==_0xd262('0x39')){var _0x3aa5df={};_0x3aa5df[_0x18db46[_0xd262('0x23')]]={'$like':'%'+_0x27c347['query'][_0xd262('0x37')]+'%'};return _0x3aa5df;}})});}_0x522639=_['merge']({},_0x522639,_0x27c347[_0xd262('0x3a')]);var _0xf42237={'where':_0x522639['where']};return db[_0xd262('0x26')][_0xd262('0x3b')](_0xf42237)[_0xd262('0x20')](function(_0x17e65b){_0x51470f['count']=_0x17e65b;if(_0x27c347['query']['includeAll']){_0x522639[_0xd262('0x3c')]=[{'all':!![]}];}return db[_0xd262('0x26')][_0xd262('0x3d')](_0x522639);})[_0xd262('0x20')](function(_0x4730f5){_0x51470f[_0xd262('0x3e')]=_0x4730f5;return _0x51470f;})[_0xd262('0x20')](respondWithFilteredResult(_0x213795,_0x522639))['catch'](handleError(_0x213795,null));};exports[_0xd262('0x3f')]=function(_0x26382b,_0x548c16){var _0x5895aa={'raw':![],'where':{'id':_0x26382b[_0xd262('0x40')]['id']}},_0x41f403={};_0x41f403[_0xd262('0x2b')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x41f403[_0xd262('0x2e')]=_[_0xd262('0x41')](_0x26382b['query']);_0x41f403[_0xd262('0x2f')]=_[_0xd262('0x30')](_0x41f403['model'],_0x41f403[_0xd262('0x2e')]);_0x5895aa[_0xd262('0x32')]=_[_0xd262('0x30')](_0x41f403['model'],qs['fields'](_0x26382b[_0xd262('0x2e')][_0xd262('0x31')]));_0x5895aa[_0xd262('0x32')]=_0x5895aa[_0xd262('0x32')][_0xd262('0x42')]?_0x5895aa[_0xd262('0x32')]:_0x41f403[_0xd262('0x2b')];if(_0x26382b['query']['includeAll']){_0x5895aa['include']=[{'all':!![]}];}_0x5895aa=_[_0xd262('0x38')]({},_0x5895aa,_0x26382b[_0xd262('0x3a')]);return db['ScreenRecording'][_0xd262('0x43')](_0x5895aa)[_0xd262('0x20')](handleEntityNotFound(_0x548c16,null))['then'](respondWithResult(_0x548c16,null))['catch'](handleError(_0x548c16,null));};exports['create']=function(_0x5119c1,_0x42f30b){return db[_0xd262('0x26')][_0xd262('0x44')](_0x5119c1[_0xd262('0x45')],{})[_0xd262('0x20')](respondWithResult(_0x42f30b,0xc9))['catch'](handleError(_0x42f30b,null));};exports['update']=function(_0x3af8aa,_0x45272e){if(_0x3af8aa[_0xd262('0x45')]['id']){delete _0x3af8aa[_0xd262('0x45')]['id'];}delete _0x3af8aa[_0xd262('0x45')][_0xd262('0x46')];delete _0x3af8aa[_0xd262('0x45')][_0xd262('0x47')];delete _0x3af8aa[_0xd262('0x45')][_0xd262('0x48')];delete _0x3af8aa['body'][_0xd262('0x49')];return db[_0xd262('0x26')]['find']({'where':{'id':_0x3af8aa['params']['id']}})[_0xd262('0x20')](handleEntityNotFound(_0x45272e,null))[_0xd262('0x20')](saveUpdates(_0x3af8aa[_0xd262('0x45')],null))[_0xd262('0x20')](respondWithResult(_0x45272e,null))[_0xd262('0x4a')](handleError(_0x45272e,null));};exports[_0xd262('0x4b')]=function(_0x5cd317,_0x394868){return db[_0xd262('0x26')][_0xd262('0x4b')]()['then'](respondWithResult(_0x394868,null))[_0xd262('0x4a')](handleError(_0x394868,null));};exports[_0xd262('0x4c')]=function(_0x32f3cc,_0x465d88,_0x472c8a){var _0x3b6044=require(_0xd262('0x4d'));var _0x1ffa24=![];var _0x38aed6={};if(_0x32f3cc[_0xd262('0x2e')]['type']&&_0x32f3cc[_0xd262('0x2e')][_0xd262('0x29')]==='uniqueid'){_0x38aed6[_0xd262('0x4e')]=_0x32f3cc['params']['id'];}else{_0x38aed6['id']=_0x32f3cc['params']['id'];}return db[_0xd262('0x26')][_0xd262('0x43')]({'where':_0x38aed6,'attributes':['id',_0xd262('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x465d88,null))[_0xd262('0x20')](function(_0xdb1d3f){if(_0xdb1d3f){var _0x385c52=path[_0xd262('0x4f')](config[_0xd262('0x50')],_0xd262('0x51'),_0xdb1d3f[_0xd262('0x49')]);var _0x301f07=util[_0xd262('0x52')](_0xd262('0x53'),_0x385c52);if(fs[_0xd262('0x54')](_0x301f07)){_0x1ffa24=!![];return _0x3b6044[_0xd262('0x55')](_0x301f07,_0x385c52,config[_0xd262('0x56')][_0xd262('0x57')])[_0xd262('0x20')](function(){return _0xdb1d3f;});}return _0xdb1d3f;}})[_0xd262('0x20')](function(_0x936a6a){if(_0x936a6a){var _0x1d9fc3=path[_0xd262('0x4f')](config[_0xd262('0x50')],_0xd262('0x51'),_0x936a6a['value']);if(!fs['existsSync'](_0x1d9fc3)){throw new db['Sequelize'][(_0xd262('0x58'))](_0xd262('0x59'));}if(_0x936a6a['filename']){return _0x465d88[_0xd262('0x4c')](_0x1d9fc3,_0x936a6a[_0xd262('0x5a')]+path[_0xd262('0x5b')](_0x1d9fc3),function(){if(_0x1ffa24){fs[_0xd262('0x5c')](_0x1d9fc3);}});}else{return _0x465d88[_0xd262('0x4c')](_0x1d9fc3,function(_0x5f334d){if(_0x1ffa24){fs[_0xd262('0x5c')](_0x1d9fc3);}});}}})[_0xd262('0x4a')](function(_0x47f4bb){if(_0x47f4bb[_0xd262('0x5d')]===_0xd262('0x59')){_0x465d88['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x465d88,null);}});};exports[_0xd262('0x1f')]=function(_0x5de144,_0x1767dd){return db['ScreenRecording'][_0xd262('0x43')]({'where':{'id':_0x5de144[_0xd262('0x40')]['id']}})['then'](function(_0x127ae2){if(!_0x127ae2)throw new ReferenceError('Entity\x20not\x20found');return _0x127ae2;})[_0xd262('0x20')](function(_0xb97c01){var _0x5ae38d=path['join'](config['root'],_0xd262('0x51'),_0xb97c01[_0xd262('0x49')]);logger[_0xd262('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x5ae38d);if(!_[_0xd262('0x5f')](_0xb97c01[_0xd262('0x49')])&&fs[_0xd262('0x54')](_0x5ae38d)){logger['info'](_0xd262('0x60')+_0x5ae38d+_0xd262('0x61'));fs[_0xd262('0x62')](_0x5ae38d);}_0x5ae38d=_0x5ae38d+_0xd262('0x63');if(!_[_0xd262('0x5f')](_0xb97c01[_0xd262('0x49')])&&fs[_0xd262('0x54')](_0x5ae38d)){logger[_0xd262('0x5e')](_0xd262('0x60')+_0x5ae38d+_0xd262('0x61'));fs[_0xd262('0x62')](_0x5ae38d);}return _0xb97c01;})[_0xd262('0x20')](function(_0x5e37ff){if(!_0x5e37ff)throw new InternalError();return _0x5e37ff[_0xd262('0x1f')]();})['then'](function(){_0x1767dd['status'](0xcc)['end']();})[_0xd262('0x4a')](handleError(_0x1767dd,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3a26a58..c56207c 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 _0xa53a=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','util','api','moment','path'];(function(_0x3cedce,_0x416557){var _0x280108=function(_0x22e633){while(--_0x22e633){_0x3cedce['push'](_0x3cedce['shift']());}};_0x280108(++_0x416557);}(_0xa53a,0xe3));var _0xaa53=function(_0x2a19c8,_0x525a70){_0x2a19c8=_0x2a19c8-0x0;var _0x414062=_0xa53a[_0x2a19c8];return _0x414062;};'use strict';var _=require('lodash');var util=require(_0xaa53('0x0'));var logger=require('../../config/logger')(_0xaa53('0x1'));var moment=require(_0xaa53('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa53('0x3'));var rimraf=require(_0xaa53('0x4'));var config=require(_0xaa53('0x5'));var attributes=require(_0xaa53('0x6'));module[_0xaa53('0x7')]=function(_0x32242c,_0x3ab3d5){return _0x32242c[_0xaa53('0x8')](_0xaa53('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xaa53('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0751=['../../config/environment','exports','screen_recordings','interactionid','lodash','request-promise','path','rimraf'];(function(_0x1fb321,_0x3fe5fa){var _0xf06b78=function(_0x48d814){while(--_0x48d814){_0x1fb321['push'](_0x1fb321['shift']());}};_0xf06b78(++_0x3fe5fa);}(_0x0751,0x194));var _0x1075=function(_0x1d2101,_0x167515){_0x1d2101=_0x1d2101-0x0;var _0x49757a=_0x0751[_0x1d2101];return _0x49757a;};'use strict';var _=require(_0x1075('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1075('0x1'));var fs=require('fs');var path=require(_0x1075('0x2'));var rimraf=require(_0x1075('0x3'));var config=require(_0x1075('0x4'));var attributes=require('./screenRecording.attributes');module[_0x1075('0x5')]=function(_0x26bd94,_0x313452){return _0x26bd94['define']('ScreenRecording',attributes,{'tableName':_0x1075('0x6'),'paranoid':![],'indexes':[{'name':_0x1075('0x7'),'fields':[_0x1075('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 81f14d2..c5256e2 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37663d,_0x3279b8){var _0xeed90=function(_0x81dbb4){while(--_0x81dbb4){_0x37663d['push'](_0x37663d['shift']());}};_0xeed90(++_0x3279b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x238c1c,_0x5c964c){var _0x528659=function(_0x3a6c8e){while(--_0x3a6c8e){_0x238c1c['push'](_0x238c1c['shift']());}};_0x528659(++_0x5c964c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fae72b5..3e3e5b0 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 _0xa1fd=['join','server/files/images/logos/','logo','extname','originalname','post','/:id/logo','single','file','addLogo','root','%s%s','addLogoLogin','format','/:id/preferred','addFavicon','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','diskStorage'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xa1fd,0x85));var _0xda1f=function(_0x472ee2,_0x295444){_0x472ee2=_0x472ee2-0x0;var _0x18387b=_0xa1fd[_0x472ee2];return _0x18387b;};'use strict';var multer=require('multer');var util=require(_0xda1f('0x0'));var path=require(_0xda1f('0x1'));var timeout=require(_0xda1f('0x2'));var express=require(_0xda1f('0x3'));var router=express[_0xda1f('0x4')]();var auth=require(_0xda1f('0x5'));var interaction=require(_0xda1f('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xda1f('0x7')]('/',auth[_0xda1f('0x8')](),controller[_0xda1f('0x9')]);router[_0xda1f('0x7')](_0xda1f('0xa'),controller[_0xda1f('0xb')]);router['get']('/:id/logo',controller[_0xda1f('0xc')]);router[_0xda1f('0x7')](_0xda1f('0xd'),controller[_0xda1f('0xe')]);router[_0xda1f('0x7')](_0xda1f('0xf'),controller['gdpr']);router['get']('/:id/preferred',controller[_0xda1f('0x10')]);router['get'](_0xda1f('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xda1f('0x12')]({'destination':function(_0x2b17c4,_0x1d2400,_0x3814f1){_0x3814f1(null,path[_0xda1f('0x13')](config['root'],_0xda1f('0x14')));},'filename':function(_0x2e4361,_0x3a96bc,_0x5abe72){_0x5abe72(null,util['format']('%s%s',_0xda1f('0x15'),path[_0xda1f('0x16')](_0x3a96bc[_0xda1f('0x17')])));}})});router[_0xda1f('0x18')](_0xda1f('0x19'),upload[_0xda1f('0x1a')](_0xda1f('0x1b')),controller[_0xda1f('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25089a,_0x339ee6,_0x113618){_0x113618(null,path[_0xda1f('0x13')](config[_0xda1f('0x1d')],_0xda1f('0x14')));},'filename':function(_0x41b1c8,_0x209bdc,_0x57ac50){_0x57ac50(null,util['format'](_0xda1f('0x1e'),'logologin',path[_0xda1f('0x16')](_0x209bdc[_0xda1f('0x17')])));}})});router[_0xda1f('0x18')](_0xda1f('0xd'),upload[_0xda1f('0x1a')](_0xda1f('0x1b')),controller[_0xda1f('0x1f')]);var upload=multer({'storage':multer[_0xda1f('0x12')]({'destination':function(_0x62f876,_0x1d7987,_0x5a2487){_0x5a2487(null,path[_0xda1f('0x13')](config[_0xda1f('0x1d')],_0xda1f('0x14')));},'filename':function(_0x30b9ad,_0x5b613f,_0x11b5ea){_0x11b5ea(null,util[_0xda1f('0x20')](_0xda1f('0x1e'),'preferred',path[_0xda1f('0x16')](_0x5b613f[_0xda1f('0x17')])));}})});router['post'](_0xda1f('0x21'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xda1f('0x12')]({'destination':function(_0x5a7968,_0x3a34c7,_0x2cf993){_0x2cf993(null,path['join'](config[_0xda1f('0x1d')],_0xda1f('0x14')));},'filename':function(_0xfdc709,_0x2c95d2,_0x2d8e11){_0x2d8e11(null,util['format'](_0xda1f('0x1e'),'favicon',path['extname'](_0x2c95d2[_0xda1f('0x17')])));}})});router[_0xda1f('0x18')](_0xda1f('0x11'),upload[_0xda1f('0x1a')](_0xda1f('0x1b')),controller[_0xda1f('0x22')]);router[_0xda1f('0x23')](_0xda1f('0xa'),auth[_0xda1f('0x8')](),controller[_0xda1f('0x24')]);module[_0xda1f('0x25')]=router; \ No newline at end of file +var _0xae56=['format','logo','/:id/logo','single','addLogo','root','%s%s','logologin','extname','originalname','post','addLogoLogin','join','preferred','file','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xae56,0x6b));var _0x6ae5=function(_0x29cea6,_0x163537){_0x29cea6=_0x29cea6-0x0;var _0x5ef938=_0xae56[_0x29cea6];return _0x5ef938;};'use strict';var multer=require(_0x6ae5('0x0'));var util=require(_0x6ae5('0x1'));var path=require(_0x6ae5('0x2'));var timeout=require(_0x6ae5('0x3'));var express=require('express');var router=express[_0x6ae5('0x4')]();var auth=require(_0x6ae5('0x5'));var interaction=require(_0x6ae5('0x6'));var config=require(_0x6ae5('0x7'));var controller=require(_0x6ae5('0x8'));router[_0x6ae5('0x9')]('/',auth[_0x6ae5('0xa')](),controller[_0x6ae5('0xb')]);router[_0x6ae5('0x9')](_0x6ae5('0xc'),controller['show']);router['get']('/:id/logo',controller[_0x6ae5('0xd')]);router[_0x6ae5('0x9')](_0x6ae5('0xe'),controller['getLogoLogin']);router[_0x6ae5('0x9')](_0x6ae5('0xf'),controller['gdpr']);router['get'](_0x6ae5('0x10'),controller[_0x6ae5('0x11')]);router[_0x6ae5('0x9')](_0x6ae5('0x12'),controller[_0x6ae5('0x13')]);var upload=multer({'storage':multer[_0x6ae5('0x14')]({'destination':function(_0x15e72f,_0x9a8580,_0x4ec80e){_0x4ec80e(null,path['join'](config['root'],_0x6ae5('0x15')));},'filename':function(_0x4ace28,_0x1bac53,_0x4db791){_0x4db791(null,util[_0x6ae5('0x16')]('%s%s',_0x6ae5('0x17'),path['extname'](_0x1bac53['originalname'])));}})});router['post'](_0x6ae5('0x18'),upload[_0x6ae5('0x19')]('file'),controller[_0x6ae5('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a0e5b,_0x3c8c90,_0x5d34eb){_0x5d34eb(null,path['join'](config[_0x6ae5('0x1b')],_0x6ae5('0x15')));},'filename':function(_0xe7e3f2,_0x17521b,_0xdc96fc){_0xdc96fc(null,util[_0x6ae5('0x16')](_0x6ae5('0x1c'),_0x6ae5('0x1d'),path[_0x6ae5('0x1e')](_0x17521b[_0x6ae5('0x1f')])));}})});router[_0x6ae5('0x20')](_0x6ae5('0xe'),upload[_0x6ae5('0x19')]('file'),controller[_0x6ae5('0x21')]);var upload=multer({'storage':multer[_0x6ae5('0x14')]({'destination':function(_0xd2d02e,_0x219e62,_0x343b55){_0x343b55(null,path[_0x6ae5('0x22')](config[_0x6ae5('0x1b')],_0x6ae5('0x15')));},'filename':function(_0x65eb0d,_0x4f0906,_0x35f94e){_0x35f94e(null,util[_0x6ae5('0x16')](_0x6ae5('0x1c'),_0x6ae5('0x23'),path['extname'](_0x4f0906[_0x6ae5('0x1f')])));}})});router[_0x6ae5('0x20')](_0x6ae5('0x10'),upload[_0x6ae5('0x19')](_0x6ae5('0x24')),controller[_0x6ae5('0x25')]);var upload=multer({'storage':multer[_0x6ae5('0x14')]({'destination':function(_0x531d55,_0x75e178,_0x51fb6d){_0x51fb6d(null,path['join'](config[_0x6ae5('0x1b')],_0x6ae5('0x15')));},'filename':function(_0x378218,_0x1f39f3,_0x57a2da){_0x57a2da(null,util[_0x6ae5('0x16')](_0x6ae5('0x1c'),_0x6ae5('0x26'),path['extname'](_0x1f39f3[_0x6ae5('0x1f')])));}})});router[_0x6ae5('0x20')](_0x6ae5('0x12'),upload[_0x6ae5('0x19')](_0x6ae5('0x24')),controller[_0x6ae5('0x27')]);router[_0x6ae5('0x28')](_0x6ae5('0xc'),auth[_0x6ae5('0xa')](),controller[_0x6ae5('0x29')]);module[_0x6ae5('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index fd62c7e..9162d27 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 _0x9e03=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','exports','INTEGER','min_internal'];(function(_0x5055ba,_0x1e9484){var _0x2e8f39=function(_0x4b715a){while(--_0x4b715a){_0x5055ba['push'](_0x5055ba['shift']());}};_0x2e8f39(++_0x1e9484);}(_0x9e03,0x18d));var _0x39e0=function(_0x167ca1,_0x324981){_0x167ca1=_0x167ca1-0x0;var _0x6c10aa=_0x9e03[_0x167ca1];return _0x6c10aa;};'use strict';var Sequelize=require('sequelize');module[_0x39e0('0x0')]={'min_internal':{'type':Sequelize[_0x39e0('0x1')](0xb),'unique':_0x39e0('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x39e0('0x1')](0xb),'unique':_0x39e0('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x39e0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x39e0('0x4')],'defaultValue':_0x39e0('0x5')},'logo':{'type':Sequelize[_0x39e0('0x4')]},'defaultLogo':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x39e0('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x39e0('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x39e0('0x4')]},'turnusername':{'type':Sequelize[_0x39e0('0x4')]},'turnpassword':{'type':Sequelize[_0x39e0('0x4')]},'pageTitle':{'type':Sequelize[_0x39e0('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x39e0('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x39e0('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x39e0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x39e0('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x39e0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x39e0('0x4')],'defaultValue':_0x39e0('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x39e0('0x4')]},'defaultPreferred':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x39e0('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x39e0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x39e0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x39e0('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x39e0('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x39e0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x39e0('0x4')]},'bucket':{'type':Sequelize[_0x39e0('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x39e0('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5e4=['min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x5b179e,_0x1d1ca0){var _0x25f795=function(_0x3ba96d){while(--_0x3ba96d){_0x5b179e['push'](_0x5b179e['shift']());}};_0x25f795(++_0x1d1ca0);}(_0xa5e4,0x111));var _0x4a5e=function(_0x49f3bf,_0x4f7e08){_0x49f3bf=_0x49f3bf-0x0;var _0x5bbca6=_0xa5e4[_0x49f3bf];return _0x5bbca6;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4a5e('0x0'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4a5e('0x1')](0xb),'unique':_0x4a5e('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4a5e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4a5e('0x3')],'defaultValue':_0x4a5e('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4a5e('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4a5e('0x3')]},'turnaddr':{'type':Sequelize[_0x4a5e('0x3')]},'turnusername':{'type':Sequelize[_0x4a5e('0x3')]},'turnpassword':{'type':Sequelize[_0x4a5e('0x3')]},'pageTitle':{'type':Sequelize[_0x4a5e('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4a5e('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4a5e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4a5e('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4a5e('0x3')],'defaultValue':_0x4a5e('0x6')},'chatTimeout':{'type':Sequelize[_0x4a5e('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4a5e('0x3')]},'defaultPreferred':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x4a5e('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4a5e('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4a5e('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4a5e('0x1')]},'sentimentRegion':{'type':Sequelize[_0x4a5e('0x3')]},'language':{'type':Sequelize[_0x4a5e('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x4a5e('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4d91206..c92f210 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 _0xff5f=['zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','body','addLogo','filename','logo','addLogoLogin','file','../../config/license/util','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default','upperFirst','default_logo.png','\x20not\x20found','download','default_loginLogo.png','custom','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','eml-format','rimraf'];(function(_0x52c907,_0x5bb5cb){var _0x568c5a=function(_0x58580e){while(--_0x58580e){_0x52c907['push'](_0x52c907['shift']());}};_0x568c5a(++_0x5bb5cb);}(_0xff5f,0x1ea));var _0xfff5=function(_0x2a4fcc,_0x41f47){_0x2a4fcc=_0x2a4fcc-0x0;var _0x529133=_0xff5f[_0x2a4fcc];return _0x529133;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfff5('0x0'));var rimraf=require(_0xfff5('0x1'));var zipdir=require(_0xfff5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfff5('0x3'));var moment=require(_0xfff5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfff5('0x5'));var util=require('util');var path=require(_0xfff5('0x6'));var sox=require('sox');var csv=require(_0xfff5('0x7'));var ejs=require(_0xfff5('0x8'));var fs=require('fs');var _=require(_0xfff5('0x9'));var squel=require(_0xfff5('0xa'));var crypto=require(_0xfff5('0xb'));var jsforce=require(_0xfff5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfff5('0xd'));var Papa=require(_0xfff5('0xe'));var Redis=require(_0xfff5('0xf'));var authService=require(_0xfff5('0x10'));var qs=require(_0xfff5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfff5('0x12'));var logger=require(_0xfff5('0x13'))(_0xfff5('0x14'));var utils=require(_0xfff5('0x15'));var config=require(_0xfff5('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfff5('0x17'));var client=jayson[_0xfff5('0x18')][_0xfff5('0x19')]({'port':0x232a});function checkPasswordPattern(_0x402423,_0x25d07a,_0x29f803){if(_0x29f803){var _0x93d9ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x93d9ad[_0xfff5('0x1a')](_0x25d07a)){return _0x402423;}else{throw new db[(_0xfff5('0x1b'))][(_0xfff5('0x1c'))](_0xfff5('0x1d'));}}else{return _0x402423;}}function respondWithRpcPromise(_0x57a7d1,_0x1f2313,_0x194ab7,_0x43aae1){return new BPromise(function(_0x3df689,_0x1a9c10){var _0x15f475=_0x43aae1||client;return _0x15f475['request'](_0x57a7d1,_0x194ab7)[_0xfff5('0x1e')](function(_0x25cdee){logger['info'](_0xfff5('0x1f'),_0x1f2313,_0xfff5('0x20'));logger[_0xfff5('0x21')](_0xfff5('0x22'),_0x1f2313,_0xfff5('0x20'),JSON[_0xfff5('0x23')](_0x25cdee));if(_0x25cdee[_0xfff5('0x24')]){if(_0x25cdee[_0xfff5('0x24')][_0xfff5('0x25')]===0x1f4){logger[_0xfff5('0x24')](_0xfff5('0x1f'),_0x1f2313,_0x25cdee[_0xfff5('0x24')][_0xfff5('0x26')]);return _0x1a9c10(_0x25cdee[_0xfff5('0x24')][_0xfff5('0x26')]);}logger[_0xfff5('0x24')]('Setting,\x20%s,\x20%s',_0x1f2313,_0x25cdee['error'][_0xfff5('0x26')]);return _0x3df689(_0x25cdee[_0xfff5('0x24')][_0xfff5('0x26')]);}else{logger['info'](_0xfff5('0x1f'),_0x1f2313,_0xfff5('0x20'));_0x3df689(_0x25cdee[_0xfff5('0x27')][_0xfff5('0x26')]);}})[_0xfff5('0x28')](function(_0x2e6b98){logger['error'](_0xfff5('0x1f'),_0x1f2313,_0x2e6b98);_0x1a9c10(_0x2e6b98);});});}function respondWithStatusCode(_0x417992,_0x448ee8){_0x448ee8=_0x448ee8||0xcc;return function(_0x3d0445){if(_0x3d0445){return _0x417992[_0xfff5('0x29')](_0x448ee8);}return _0x417992[_0xfff5('0x2a')](_0x448ee8)[_0xfff5('0x2b')]();};}function respondWithResult(_0x3bf552,_0x3dcffb){_0x3dcffb=_0x3dcffb||0xc8;return function(_0x49b35f){if(_0x49b35f){return _0x3bf552['status'](_0x3dcffb)[_0xfff5('0x2c')](_0x49b35f);}};}function respondWithFilteredResult(_0x3f9488,_0x19874f){return function(_0x4b117e){if(_0x4b117e){var _0x1f1933=_0x4b117e['count'],_0x3fb8b1=_0x19874f[_0xfff5('0x2d')],_0x40ceec=_0x19874f[_0xfff5('0x2d')]+_0x19874f[_0xfff5('0x2e')],_0x1ea4e3;if(_0x40ceec>=_0x1f1933){_0x40ceec=_0x1f1933;_0x1ea4e3=0xc8;}else{_0x1ea4e3=0xce;}_0x3f9488['status'](_0x1ea4e3);return _0x3f9488[_0xfff5('0x2f')](_0xfff5('0x30'),_0x3fb8b1+'-'+_0x40ceec+'/'+_0x1f1933)[_0xfff5('0x2c')](_0x4b117e);}return null;};}function patchUpdates(_0x583e64){return function(_0x49d487){try{jsonpatch[_0xfff5('0x31')](_0x49d487,_0x583e64,!![]);}catch(_0xff57b8){return BPromise[_0xfff5('0x32')](_0xff57b8);}return _0x49d487['save']();};}function saveUpdates(_0x59dbc7,_0x4e746e){return function(_0x1f3cd3){if(_0x1f3cd3){return _0x1f3cd3[_0xfff5('0x33')](_0x59dbc7)[_0xfff5('0x1e')](function(_0x575471){return _0x575471;});}return null;};}function removeEntity(_0x3ce691,_0x554ccc){return function(_0x35b48b){if(_0x35b48b){return _0x35b48b[_0xfff5('0x34')]()['then'](function(){_0x3ce691[_0xfff5('0x2a')](0xcc)[_0xfff5('0x2b')]();});}};}function handleEntityNotFound(_0x20dce6,_0x5ae42f){return function(_0x34c841){if(!_0x34c841){_0x20dce6[_0xfff5('0x29')](0x194);}return _0x34c841;};}function handleError(_0x51f7e6,_0x194dfd){_0x194dfd=_0x194dfd||0x1f4;return function(_0x5ab4d7){logger[_0xfff5('0x24')](_0x5ab4d7[_0xfff5('0x35')]);if(_0x5ab4d7[_0xfff5('0x36')]){delete _0x5ab4d7[_0xfff5('0x36')];}_0x51f7e6['status'](_0x194dfd)[_0xfff5('0x37')](_0x5ab4d7);};}exports[_0xfff5('0x38')]=function(_0xdf4a20,_0x5952f1){var _0x4b6448={},_0x4f605a={},_0x4db5bd={'count':0x0,'rows':[]};var _0xe2e5e1=_[_0xfff5('0x39')](db[_0xfff5('0x3a')][_0xfff5('0x3b')],function(_0x59efa5){return{'name':_0x59efa5[_0xfff5('0x3c')],'type':_0x59efa5[_0xfff5('0x3d')][_0xfff5('0x3e')]};});_0x4f605a[_0xfff5('0x3f')]=_[_0xfff5('0x39')](_0xe2e5e1,_0xfff5('0x36'));_0x4f605a['query']=_[_0xfff5('0x40')](_0xdf4a20['query']);_0x4f605a[_0xfff5('0x41')]=_['intersection'](_0x4f605a['model'],_0x4f605a[_0xfff5('0x42')]);_0x4b6448['attributes']=_[_0xfff5('0x43')](_0x4f605a[_0xfff5('0x3f')],qs['fields'](_0xdf4a20[_0xfff5('0x42')][_0xfff5('0x44')]));_0x4b6448[_0xfff5('0x45')]=_0x4b6448[_0xfff5('0x45')][_0xfff5('0x46')]?_0x4b6448[_0xfff5('0x45')]:_0x4f605a[_0xfff5('0x3f')];if(!_0xdf4a20[_0xfff5('0x42')][_0xfff5('0x47')]('nolimit')){_0x4b6448[_0xfff5('0x2e')]=qs[_0xfff5('0x2e')](_0xdf4a20[_0xfff5('0x42')][_0xfff5('0x2e')]);_0x4b6448[_0xfff5('0x2d')]=qs[_0xfff5('0x2d')](_0xdf4a20['query']['offset']);}_0x4b6448[_0xfff5('0x48')]=qs[_0xfff5('0x49')](_0xdf4a20[_0xfff5('0x42')][_0xfff5('0x49')]);_0x4b6448[_0xfff5('0x4a')]=qs[_0xfff5('0x41')](_[_0xfff5('0x4b')](_0xdf4a20[_0xfff5('0x42')],_0x4f605a['filters']),_0xe2e5e1);if(_0xdf4a20[_0xfff5('0x42')]['filter']){_0x4b6448[_0xfff5('0x4a')]=_[_0xfff5('0x4c')](_0x4b6448[_0xfff5('0x4a')],{'$or':_[_0xfff5('0x39')](_0xe2e5e1,function(_0x4f8860){if(_0x4f8860[_0xfff5('0x3d')]!==_0xfff5('0x4d')){var _0xdc30f7={};_0xdc30f7[_0x4f8860[_0xfff5('0x36')]]={'$like':'%'+_0xdf4a20[_0xfff5('0x42')][_0xfff5('0x4e')]+'%'};return _0xdc30f7;}})});}_0x4b6448=_[_0xfff5('0x4c')]({},_0x4b6448,_0xdf4a20[_0xfff5('0x4f')]);var _0x2447cc={'where':_0x4b6448[_0xfff5('0x4a')]};return db[_0xfff5('0x3a')][_0xfff5('0x50')](_0x2447cc)[_0xfff5('0x1e')](function(_0xfb5ed2){_0x4db5bd[_0xfff5('0x50')]=_0xfb5ed2;if(_0xdf4a20[_0xfff5('0x42')][_0xfff5('0x51')]){_0x4b6448[_0xfff5('0x52')]=[{'all':!![]}];}return db[_0xfff5('0x3a')][_0xfff5('0x53')](_0x4b6448);})[_0xfff5('0x1e')](function(_0x2eb762){_0x4db5bd[_0xfff5('0x54')]=_0x2eb762;return _0x4db5bd;})['then'](respondWithFilteredResult(_0x5952f1,_0x4b6448))[_0xfff5('0x28')](handleError(_0x5952f1,null));};exports[_0xfff5('0x55')]=function(_0x17051d,_0x5ce53a){var _0x12dd2b={'raw':![],'where':{'id':_0x17051d[_0xfff5('0x56')]['id']}},_0x3e3a9c={};_0x3e3a9c['model']=_[_0xfff5('0x40')](db[_0xfff5('0x3a')][_0xfff5('0x3b')]);_0x3e3a9c['query']=_[_0xfff5('0x40')](_0x17051d['query']);_0x3e3a9c[_0xfff5('0x41')]=_[_0xfff5('0x43')](_0x3e3a9c[_0xfff5('0x3f')],_0x3e3a9c['query']);_0x12dd2b[_0xfff5('0x45')]=_[_0xfff5('0x43')](_0x3e3a9c[_0xfff5('0x3f')],qs[_0xfff5('0x44')](_0x17051d[_0xfff5('0x42')][_0xfff5('0x44')]));_0x12dd2b[_0xfff5('0x45')]=_0x12dd2b[_0xfff5('0x45')][_0xfff5('0x46')]?_0x12dd2b[_0xfff5('0x45')]:_0x3e3a9c['model'];if(_0x17051d[_0xfff5('0x42')][_0xfff5('0x51')]){_0x12dd2b[_0xfff5('0x52')]=[{'all':!![]}];}_0x12dd2b=_[_0xfff5('0x4c')]({},_0x12dd2b,_0x17051d[_0xfff5('0x4f')]);return db['Setting'][_0xfff5('0x57')](_0x12dd2b)[_0xfff5('0x1e')](handleEntityNotFound(_0x5ce53a,null))[_0xfff5('0x1e')](respondWithResult(_0x5ce53a,null))[_0xfff5('0x28')](handleError(_0x5ce53a,null));};exports[_0xfff5('0x33')]=function(_0x34b67a,_0x599630){if(_0x34b67a['body']['id']){delete _0x34b67a['body']['id'];}return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x34b67a[_0xfff5('0x56')]['id']}})[_0xfff5('0x1e')](handleEntityNotFound(_0x599630,null))[_0xfff5('0x1e')](saveUpdates(_0x34b67a[_0xfff5('0x58')],null))[_0xfff5('0x1e')](respondWithResult(_0x599630,null))[_0xfff5('0x28')](handleError(_0x599630,null));};exports[_0xfff5('0x59')]=function(_0x351862,_0x1564e7,_0x5c064c){if(_0x351862['file']&&_0x351862['file'][_0xfff5('0x5a')]){_0x351862[_0xfff5('0x58')][_0xfff5('0x5b')]=_0x351862['file'][_0xfff5('0x5a')];}return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x351862['params']['id']}})[_0xfff5('0x1e')](handleEntityNotFound(_0x1564e7,null))['then'](saveUpdates(_0x351862['body'],null))[_0xfff5('0x1e')](respondWithResult(_0x1564e7,null))[_0xfff5('0x28')](handleError(_0x1564e7,null));};exports[_0xfff5('0x5c')]=function(_0x5a03a0,_0x36dd00,_0x352453){if(_0x5a03a0[_0xfff5('0x5d')]&&_0x5a03a0['file'][_0xfff5('0x5a')]){_0x5a03a0[_0xfff5('0x58')]['loginLogo']=_0x5a03a0['file']['filename'];}return db['Setting'][_0xfff5('0x57')]({'where':{'id':_0x5a03a0[_0xfff5('0x56')]['id']}})[_0xfff5('0x1e')](handleEntityNotFound(_0x36dd00,null))['then'](saveUpdates(_0x5a03a0[_0xfff5('0x58')],null))[_0xfff5('0x1e')](respondWithResult(_0x36dd00,null))[_0xfff5('0x28')](handleError(_0x36dd00,null));};var utilLicense=require(_0xfff5('0x5e'));exports[_0xfff5('0x5f')]=function(_0x47b865,_0x9771b3,_0x15b7e3){var _0x51bea6=_0xfff5('0x60');var _0x376481={'custom':![]};return utilLicense[_0xfff5('0x61')]()[_0xfff5('0x1e')](function(_0x5864d6){if(_0x5864d6){_0x376481=_0x5864d6;}return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x47b865[_0xfff5('0x56')]['id']},'attributes':[_0xfff5('0x5b'),_0xfff5('0x62'),_0xfff5('0x63'),_0xfff5('0x64'),_0xfff5('0x65'),_0xfff5('0x66'),_0xfff5('0x67'),_0xfff5('0x68')],'raw':!![]});})['then'](handleEntityNotFound(_0x9771b3,null))[_0xfff5('0x1e')](function(_0x437853){if(_0x437853){var _0x3755d8=_0x437853[_0xfff5('0x5b')]&&fs[_0xfff5('0x69')](path['join'](config[_0xfff5('0x6a')],_0x51bea6,_[_0xfff5('0x6b')](_0x437853[_0xfff5('0x5b')])))?path[_0xfff5('0x6c')](config['root'],_0x51bea6,_[_0xfff5('0x6b')](_0x437853[_0xfff5('0x5b')])):path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x51bea6,_['toLower']('default_logo.png'));var _0x5e7a4e=_0xfff5('0x6d')+_[_0xfff5('0x6e')](_0xfff5('0x5b'));if(_0x437853[_0x5e7a4e]||!_0x376481['custom']){_0x3755d8=path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x51bea6,_[_0xfff5('0x6b')](_0xfff5('0x6f')));}if(!fs[_0xfff5('0x69')](_0x3755d8)){throw new db[(_0xfff5('0x1b'))][(_0xfff5('0x1c'))](_['upperFirst'](_0xfff5('0x5b'))+_0xfff5('0x70'));}return _0x9771b3[_0xfff5('0x71')](_0x3755d8);}})[_0xfff5('0x28')](handleError(_0x9771b3,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x5da5a6,_0x23a50b,_0x1a243c){var _0x33e858=_0xfff5('0x60');var _0x205758={'custom':![]};return utilLicense[_0xfff5('0x61')]()[_0xfff5('0x1e')](function(_0x545a28){if(_0x545a28){_0x205758=_0x545a28;}return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x5da5a6[_0xfff5('0x56')]['id']},'attributes':['logo',_0xfff5('0x62'),_0xfff5('0x63'),'favicon',_0xfff5('0x65'),'defaultLoginLogo','defaultPreferred',_0xfff5('0x68')],'raw':!![]});})[_0xfff5('0x1e')](handleEntityNotFound(_0x23a50b,null))[_0xfff5('0x1e')](function(_0x169363){if(_0x169363){var _0x14b6ab=_0x169363['loginLogo']&&fs[_0xfff5('0x69')](path[_0xfff5('0x6c')](config['root'],_0x33e858,_['toLower'](_0x169363[_0xfff5('0x62')])))?path[_0xfff5('0x6c')](config['root'],_0x33e858,_[_0xfff5('0x6b')](_0x169363[_0xfff5('0x62')])):path[_0xfff5('0x6c')](config['root'],_0x33e858,_[_0xfff5('0x6b')](_0xfff5('0x72')));var _0x3fb8b8=_0xfff5('0x6d')+_['upperFirst'](_0xfff5('0x62'));if(_0x169363[_0x3fb8b8]||!_0x205758[_0xfff5('0x73')]){_0x14b6ab=path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x33e858,_[_0xfff5('0x6b')](_0xfff5('0x72')));}if(!fs['existsSync'](_0x14b6ab)){throw new db['Sequelize'][(_0xfff5('0x1c'))](_['upperFirst'](_0xfff5('0x62'))+'\x20not\x20found');}return _0x23a50b[_0xfff5('0x71')](_0x14b6ab);}})[_0xfff5('0x28')](handleError(_0x23a50b,null));};exports['gdpr']=function(_0x21b8a6,_0x236761){return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x21b8a6[_0xfff5('0x56')]['id']},'attributes':[_0xfff5('0x74')]})[_0xfff5('0x1e')](respondWithResult(_0x236761,null))[_0xfff5('0x28')](handleError(_0x236761,null));};exports[_0xfff5('0x75')]=function(_0x28a317,_0x34bb69,_0x1bb3f7){if(_0x28a317[_0xfff5('0x5d')]&&_0x28a317[_0xfff5('0x5d')][_0xfff5('0x5a')]){_0x28a317['body'][_0xfff5('0x63')]=_0x28a317[_0xfff5('0x5d')][_0xfff5('0x5a')];}return db['Setting'][_0xfff5('0x57')]({'where':{'id':_0x28a317['params']['id']}})[_0xfff5('0x1e')](handleEntityNotFound(_0x34bb69,null))[_0xfff5('0x1e')](saveUpdates(_0x28a317[_0xfff5('0x58')],null))[_0xfff5('0x1e')](respondWithResult(_0x34bb69,null))[_0xfff5('0x28')](handleError(_0x34bb69,null));};var utilLicense=require(_0xfff5('0x5e'));exports[_0xfff5('0x76')]=function(_0x58dd50,_0x30b203,_0x11e65e){var _0x8ec0b2='server/files/images/logos';var _0x184bde={'custom':![]};return utilLicense[_0xfff5('0x61')]()[_0xfff5('0x1e')](function(_0x4984df){if(_0x4984df){_0x184bde=_0x4984df;}return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x58dd50[_0xfff5('0x56')]['id']},'attributes':['logo',_0xfff5('0x62'),'preferred',_0xfff5('0x64'),_0xfff5('0x65'),_0xfff5('0x66'),'defaultPreferred',_0xfff5('0x68')],'raw':!![]});})[_0xfff5('0x1e')](handleEntityNotFound(_0x30b203,null))[_0xfff5('0x1e')](function(_0x3bad60){if(_0x3bad60){var _0x594540=_0x3bad60[_0xfff5('0x63')]&&fs[_0xfff5('0x69')](path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x8ec0b2,_[_0xfff5('0x6b')](_0x3bad60[_0xfff5('0x63')])))?path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x8ec0b2,_[_0xfff5('0x6b')](_0x3bad60['preferred'])):path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x8ec0b2,_[_0xfff5('0x6b')](_0xfff5('0x77')));var _0x389c21=_0xfff5('0x6d')+_[_0xfff5('0x6e')]('preferred');if(_0x3bad60[_0x389c21]||!_0x184bde[_0xfff5('0x73')]||!_0x184bde[_0xfff5('0x63')]){_0x594540=path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x8ec0b2,_['toLower'](_0xfff5('0x77')));}if(!fs[_0xfff5('0x69')](_0x594540)){throw new db[(_0xfff5('0x1b'))]['ValidationError'](_[_0xfff5('0x6e')](_0xfff5('0x63'))+_0xfff5('0x70'));}return _0x30b203['download'](_0x594540);}})['catch'](handleError(_0x30b203,null));};exports[_0xfff5('0x78')]=function(_0x42f26e,_0x1d4be5,_0x19c75d){if(_0x42f26e['file']&&_0x42f26e[_0xfff5('0x5d')][_0xfff5('0x5a')]){_0x42f26e[_0xfff5('0x58')][_0xfff5('0x64')]=_0x42f26e[_0xfff5('0x5d')][_0xfff5('0x5a')];}return db[_0xfff5('0x3a')][_0xfff5('0x57')]({'where':{'id':_0x42f26e[_0xfff5('0x56')]['id']}})[_0xfff5('0x1e')](handleEntityNotFound(_0x1d4be5,null))[_0xfff5('0x1e')](saveUpdates(_0x42f26e[_0xfff5('0x58')],null))[_0xfff5('0x1e')](respondWithResult(_0x1d4be5,null))[_0xfff5('0x28')](handleError(_0x1d4be5,null));};var utilLicense=require(_0xfff5('0x5e'));exports[_0xfff5('0x79')]=function(_0x536308,_0x35d196,_0x41912f){var _0x27e191=_0xfff5('0x60');var _0x436430={'custom':![]};return utilLicense[_0xfff5('0x61')]()[_0xfff5('0x1e')](function(_0x284d6f){if(_0x284d6f){_0x436430=_0x284d6f;}return db['Setting'][_0xfff5('0x57')]({'where':{'id':_0x536308['params']['id']},'attributes':[_0xfff5('0x5b'),_0xfff5('0x62'),_0xfff5('0x63'),_0xfff5('0x64'),'defaultLogo',_0xfff5('0x66'),_0xfff5('0x67'),'defaultFavicon'],'raw':!![]});})[_0xfff5('0x1e')](handleEntityNotFound(_0x35d196,null))['then'](function(_0x1288b7){if(_0x1288b7){var _0x539309=_0x1288b7[_0xfff5('0x64')]&&fs[_0xfff5('0x69')](path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x27e191,_[_0xfff5('0x6b')](_0x1288b7[_0xfff5('0x64')])))?path[_0xfff5('0x6c')](config['root'],_0x27e191,_[_0xfff5('0x6b')](_0x1288b7['favicon'])):path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x27e191,_['toLower'](_0xfff5('0x7a')));var _0x30327c=_0xfff5('0x6d')+_[_0xfff5('0x6e')](_0xfff5('0x64'));if(_0x1288b7[_0x30327c]||!_0x436430[_0xfff5('0x73')]){_0x539309=path[_0xfff5('0x6c')](config[_0xfff5('0x6a')],_0x27e191,_[_0xfff5('0x6b')](_0xfff5('0x7a')));}if(!fs[_0xfff5('0x69')](_0x539309)){throw new db['Sequelize']['ValidationError'](_[_0xfff5('0x6e')](_0xfff5('0x64'))+_0xfff5('0x70'));}return _0x35d196['download'](_0x539309);}})[_0xfff5('0x28')](handleError(_0x35d196,null));}; \ No newline at end of file +var _0x1930=['set','Content-Range','apply','reject','save','update','stack','name','index','map','Setting','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','include','rows','show','params','includeAll','body','find','filename','file','loginLogo','../../config/license/util','getLogo','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','join','root','toLower','default_logo.png','default','upperFirst','\x20not\x20found','preferred','default_loginLogo.png','custom','Sequelize','ValidationError','gdpr','addPreferred','getPreferred','favicon','default_preferred.png','download','getFavicon','server/files/images/logos','default_favicon.ico','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset'];(function(_0x1df369,_0x548e39){var _0x3d4239=function(_0x4d4f4c){while(--_0x4d4f4c){_0x1df369['push'](_0x1df369['shift']());}};_0x3d4239(++_0x548e39);}(_0x1930,0x133));var _0x0193=function(_0x2b3d1f,_0x40c8b6){_0x2b3d1f=_0x2b3d1f-0x0;var _0x187469=_0x1930[_0x2b3d1f];return _0x187469;};'use strict';var pdf=require(_0x0193('0x0'));var emlformat=require(_0x0193('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0193('0x2'));var moment=require(_0x0193('0x3'));var BPromise=require(_0x0193('0x4'));var Mustache=require(_0x0193('0x5'));var util=require(_0x0193('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0193('0x7'));var fs=require('fs');var _=require(_0x0193('0x8'));var squel=require(_0x0193('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0193('0xa'));var toCsv=require(_0x0193('0xb'));var querystring=require(_0x0193('0xc'));var Papa=require(_0x0193('0xd'));var Redis=require(_0x0193('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0193('0xf'));var as=require(_0x0193('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0193('0x11'))(_0x0193('0x12'));var utils=require(_0x0193('0x13'));var config=require(_0x0193('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0193('0x15'));var client=jayson[_0x0193('0x16')][_0x0193('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5dd674,_0x520df2,_0x5729d4){if(_0x5729d4){var _0x55abf2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55abf2[_0x0193('0x18')](_0x520df2)){return _0x5dd674;}else{throw new db['Sequelize']['ValidationError'](_0x0193('0x19'));}}else{return _0x5dd674;}}function respondWithRpcPromise(_0x47fefb,_0x425199,_0x4e1e16,_0x186d8b){return new BPromise(function(_0xe8776a,_0x728f20){var _0x161588=_0x186d8b||client;return _0x161588['request'](_0x47fefb,_0x4e1e16)[_0x0193('0x1a')](function(_0x12bc7c){logger[_0x0193('0x1b')](_0x0193('0x1c'),_0x425199,_0x0193('0x1d'));logger[_0x0193('0x1e')](_0x0193('0x1f'),_0x425199,_0x0193('0x1d'),JSON[_0x0193('0x20')](_0x12bc7c));if(_0x12bc7c['error']){if(_0x12bc7c[_0x0193('0x21')][_0x0193('0x22')]===0x1f4){logger[_0x0193('0x21')](_0x0193('0x1c'),_0x425199,_0x12bc7c[_0x0193('0x21')]['message']);return _0x728f20(_0x12bc7c[_0x0193('0x21')][_0x0193('0x23')]);}logger[_0x0193('0x21')](_0x0193('0x1c'),_0x425199,_0x12bc7c['error']['message']);return _0xe8776a(_0x12bc7c[_0x0193('0x21')][_0x0193('0x23')]);}else{logger[_0x0193('0x1b')]('Setting,\x20%s,\x20%s',_0x425199,_0x0193('0x1d'));_0xe8776a(_0x12bc7c[_0x0193('0x24')][_0x0193('0x23')]);}})[_0x0193('0x25')](function(_0x4d895c){logger['error'](_0x0193('0x1c'),_0x425199,_0x4d895c);_0x728f20(_0x4d895c);});});}function respondWithStatusCode(_0xf30d4,_0x32a251){_0x32a251=_0x32a251||0xcc;return function(_0x2c77c3){if(_0x2c77c3){return _0xf30d4[_0x0193('0x26')](_0x32a251);}return _0xf30d4[_0x0193('0x27')](_0x32a251)[_0x0193('0x28')]();};}function respondWithResult(_0x177816,_0x1aca5b){_0x1aca5b=_0x1aca5b||0xc8;return function(_0x28ca18){if(_0x28ca18){return _0x177816[_0x0193('0x27')](_0x1aca5b)[_0x0193('0x29')](_0x28ca18);}};}function respondWithFilteredResult(_0x4c0d4e,_0x56a261){return function(_0x182d10){if(_0x182d10){var _0x5d7a17=_0x182d10[_0x0193('0x2a')],_0x4fa21a=_0x56a261[_0x0193('0x2b')],_0x11dd37=_0x56a261['offset']+_0x56a261['limit'],_0x32a1ce;if(_0x11dd37>=_0x5d7a17){_0x11dd37=_0x5d7a17;_0x32a1ce=0xc8;}else{_0x32a1ce=0xce;}_0x4c0d4e[_0x0193('0x27')](_0x32a1ce);return _0x4c0d4e[_0x0193('0x2c')](_0x0193('0x2d'),_0x4fa21a+'-'+_0x11dd37+'/'+_0x5d7a17)[_0x0193('0x29')](_0x182d10);}return null;};}function patchUpdates(_0x3489e3){return function(_0x15f5da){try{jsonpatch[_0x0193('0x2e')](_0x15f5da,_0x3489e3,!![]);}catch(_0x4d09cc){return BPromise[_0x0193('0x2f')](_0x4d09cc);}return _0x15f5da[_0x0193('0x30')]();};}function saveUpdates(_0x553c95,_0x1aa776){return function(_0x484030){if(_0x484030){return _0x484030[_0x0193('0x31')](_0x553c95)['then'](function(_0x154f8f){return _0x154f8f;});}return null;};}function removeEntity(_0xf61ed1,_0x3e3073){return function(_0x9b30ab){if(_0x9b30ab){return _0x9b30ab['destroy']()[_0x0193('0x1a')](function(){_0xf61ed1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db4f4,_0x1076d7){return function(_0x438f06){if(!_0x438f06){_0x4db4f4[_0x0193('0x26')](0x194);}return _0x438f06;};}function handleError(_0x3b9a60,_0x4b1218){_0x4b1218=_0x4b1218||0x1f4;return function(_0x348f94){logger[_0x0193('0x21')](_0x348f94[_0x0193('0x32')]);if(_0x348f94['name']){delete _0x348f94[_0x0193('0x33')];}_0x3b9a60['status'](_0x4b1218)['send'](_0x348f94);};}exports[_0x0193('0x34')]=function(_0x1ab688,_0xf5ba7c){var _0x3a36e8={},_0x558a4a={},_0x240a4d={'count':0x0,'rows':[]};var _0x5407da=_[_0x0193('0x35')](db[_0x0193('0x36')][_0x0193('0x37')],function(_0x50364b){return{'name':_0x50364b[_0x0193('0x38')],'type':_0x50364b['type'][_0x0193('0x39')]};});_0x558a4a[_0x0193('0x3a')]=_[_0x0193('0x35')](_0x5407da,_0x0193('0x33'));_0x558a4a['query']=_[_0x0193('0x3b')](_0x1ab688[_0x0193('0x3c')]);_0x558a4a['filters']=_[_0x0193('0x3d')](_0x558a4a[_0x0193('0x3a')],_0x558a4a['query']);_0x3a36e8['attributes']=_[_0x0193('0x3d')](_0x558a4a['model'],qs[_0x0193('0x3e')](_0x1ab688['query'][_0x0193('0x3e')]));_0x3a36e8[_0x0193('0x3f')]=_0x3a36e8[_0x0193('0x3f')][_0x0193('0x40')]?_0x3a36e8[_0x0193('0x3f')]:_0x558a4a[_0x0193('0x3a')];if(!_0x1ab688[_0x0193('0x3c')][_0x0193('0x41')](_0x0193('0x42'))){_0x3a36e8['limit']=qs[_0x0193('0x43')](_0x1ab688[_0x0193('0x3c')][_0x0193('0x43')]);_0x3a36e8[_0x0193('0x2b')]=qs[_0x0193('0x2b')](_0x1ab688[_0x0193('0x3c')][_0x0193('0x2b')]);}_0x3a36e8[_0x0193('0x44')]=qs[_0x0193('0x45')](_0x1ab688[_0x0193('0x3c')][_0x0193('0x45')]);_0x3a36e8['where']=qs['filters'](_[_0x0193('0x46')](_0x1ab688[_0x0193('0x3c')],_0x558a4a[_0x0193('0x47')]),_0x5407da);if(_0x1ab688['query'][_0x0193('0x48')]){_0x3a36e8[_0x0193('0x49')]=_['merge'](_0x3a36e8['where'],{'$or':_[_0x0193('0x35')](_0x5407da,function(_0x51e7dd){if(_0x51e7dd['type']!==_0x0193('0x4a')){var _0x24df2f={};_0x24df2f[_0x51e7dd[_0x0193('0x33')]]={'$like':'%'+_0x1ab688[_0x0193('0x3c')]['filter']+'%'};return _0x24df2f;}})});}_0x3a36e8=_[_0x0193('0x4b')]({},_0x3a36e8,_0x1ab688[_0x0193('0x4c')]);var _0x369388={'where':_0x3a36e8['where']};return db[_0x0193('0x36')][_0x0193('0x2a')](_0x369388)['then'](function(_0x2350ce){_0x240a4d['count']=_0x2350ce;if(_0x1ab688[_0x0193('0x3c')]['includeAll']){_0x3a36e8[_0x0193('0x4d')]=[{'all':!![]}];}return db[_0x0193('0x36')]['findAll'](_0x3a36e8);})[_0x0193('0x1a')](function(_0x954990){_0x240a4d[_0x0193('0x4e')]=_0x954990;return _0x240a4d;})['then'](respondWithFilteredResult(_0xf5ba7c,_0x3a36e8))[_0x0193('0x25')](handleError(_0xf5ba7c,null));};exports[_0x0193('0x4f')]=function(_0x2f86d3,_0x41525a){var _0x574579={'raw':![],'where':{'id':_0x2f86d3[_0x0193('0x50')]['id']}},_0x481486={};_0x481486[_0x0193('0x3a')]=_[_0x0193('0x3b')](db[_0x0193('0x36')][_0x0193('0x37')]);_0x481486[_0x0193('0x3c')]=_[_0x0193('0x3b')](_0x2f86d3['query']);_0x481486[_0x0193('0x47')]=_[_0x0193('0x3d')](_0x481486['model'],_0x481486[_0x0193('0x3c')]);_0x574579[_0x0193('0x3f')]=_['intersection'](_0x481486['model'],qs['fields'](_0x2f86d3['query'][_0x0193('0x3e')]));_0x574579[_0x0193('0x3f')]=_0x574579[_0x0193('0x3f')][_0x0193('0x40')]?_0x574579[_0x0193('0x3f')]:_0x481486[_0x0193('0x3a')];if(_0x2f86d3[_0x0193('0x3c')][_0x0193('0x51')]){_0x574579['include']=[{'all':!![]}];}_0x574579=_[_0x0193('0x4b')]({},_0x574579,_0x2f86d3[_0x0193('0x4c')]);return db[_0x0193('0x36')]['find'](_0x574579)[_0x0193('0x1a')](handleEntityNotFound(_0x41525a,null))['then'](respondWithResult(_0x41525a,null))[_0x0193('0x25')](handleError(_0x41525a,null));};exports[_0x0193('0x31')]=function(_0x40d00e,_0x28d3bb){if(_0x40d00e[_0x0193('0x52')]['id']){delete _0x40d00e[_0x0193('0x52')]['id'];}return db['Setting'][_0x0193('0x53')]({'where':{'id':_0x40d00e[_0x0193('0x50')]['id']}})[_0x0193('0x1a')](handleEntityNotFound(_0x28d3bb,null))['then'](saveUpdates(_0x40d00e[_0x0193('0x52')],null))[_0x0193('0x1a')](respondWithResult(_0x28d3bb,null))['catch'](handleError(_0x28d3bb,null));};exports['addLogo']=function(_0x564ad9,_0x1cf364,_0x12f630){if(_0x564ad9['file']&&_0x564ad9['file'][_0x0193('0x54')]){_0x564ad9['body']['logo']=_0x564ad9[_0x0193('0x55')][_0x0193('0x54')];}return db[_0x0193('0x36')][_0x0193('0x53')]({'where':{'id':_0x564ad9[_0x0193('0x50')]['id']}})[_0x0193('0x1a')](handleEntityNotFound(_0x1cf364,null))['then'](saveUpdates(_0x564ad9[_0x0193('0x52')],null))[_0x0193('0x1a')](respondWithResult(_0x1cf364,null))[_0x0193('0x25')](handleError(_0x1cf364,null));};exports['addLogoLogin']=function(_0x28db46,_0x298107,_0x20ae37){if(_0x28db46['file']&&_0x28db46[_0x0193('0x55')][_0x0193('0x54')]){_0x28db46[_0x0193('0x52')][_0x0193('0x56')]=_0x28db46[_0x0193('0x55')][_0x0193('0x54')];}return db[_0x0193('0x36')][_0x0193('0x53')]({'where':{'id':_0x28db46[_0x0193('0x50')]['id']}})[_0x0193('0x1a')](handleEntityNotFound(_0x298107,null))['then'](saveUpdates(_0x28db46[_0x0193('0x52')],null))[_0x0193('0x1a')](respondWithResult(_0x298107,null))[_0x0193('0x25')](handleError(_0x298107,null));};var utilLicense=require(_0x0193('0x57'));exports[_0x0193('0x58')]=function(_0x41806a,_0x3de32d,_0x221537){var _0x972571='server/files/images/logos';var _0x2ab52d={'custom':![]};return utilLicense[_0x0193('0x59')]()[_0x0193('0x1a')](function(_0x519e42){if(_0x519e42){_0x2ab52d=_0x519e42;}return db[_0x0193('0x36')][_0x0193('0x53')]({'where':{'id':_0x41806a[_0x0193('0x50')]['id']},'attributes':['logo',_0x0193('0x56'),'preferred','favicon',_0x0193('0x5a'),_0x0193('0x5b'),_0x0193('0x5c'),_0x0193('0x5d')],'raw':!![]});})[_0x0193('0x1a')](handleEntityNotFound(_0x3de32d,null))[_0x0193('0x1a')](function(_0xbcb1c8){if(_0xbcb1c8){var _0x2d3026=_0xbcb1c8[_0x0193('0x5e')]&&fs[_0x0193('0x5f')](path[_0x0193('0x60')](config[_0x0193('0x61')],_0x972571,_[_0x0193('0x62')](_0xbcb1c8[_0x0193('0x5e')])))?path['join'](config['root'],_0x972571,_[_0x0193('0x62')](_0xbcb1c8[_0x0193('0x5e')])):path['join'](config[_0x0193('0x61')],_0x972571,_[_0x0193('0x62')](_0x0193('0x63')));var _0x15d021=_0x0193('0x64')+_[_0x0193('0x65')](_0x0193('0x5e'));if(_0xbcb1c8[_0x15d021]||!_0x2ab52d['custom']){_0x2d3026=path['join'](config[_0x0193('0x61')],_0x972571,_['toLower'](_0x0193('0x63')));}if(!fs[_0x0193('0x5f')](_0x2d3026)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x0193('0x5e'))+_0x0193('0x66'));}return _0x3de32d['download'](_0x2d3026);}})[_0x0193('0x25')](handleError(_0x3de32d,null));};var utilLicense=require(_0x0193('0x57'));exports['getLogoLogin']=function(_0x237c65,_0xc91613,_0x21353a){var _0x2eb88f='server/files/images/logos';var _0x79fce6={'custom':![]};return utilLicense['getLicense']()[_0x0193('0x1a')](function(_0xe861eb){if(_0xe861eb){_0x79fce6=_0xe861eb;}return db[_0x0193('0x36')][_0x0193('0x53')]({'where':{'id':_0x237c65[_0x0193('0x50')]['id']},'attributes':[_0x0193('0x5e'),_0x0193('0x56'),_0x0193('0x67'),'favicon',_0x0193('0x5a'),_0x0193('0x5b'),_0x0193('0x5c'),_0x0193('0x5d')],'raw':!![]});})[_0x0193('0x1a')](handleEntityNotFound(_0xc91613,null))[_0x0193('0x1a')](function(_0x57f203){if(_0x57f203){var _0x27d4e6=_0x57f203['loginLogo']&&fs[_0x0193('0x5f')](path['join'](config['root'],_0x2eb88f,_['toLower'](_0x57f203['loginLogo'])))?path['join'](config[_0x0193('0x61')],_0x2eb88f,_[_0x0193('0x62')](_0x57f203[_0x0193('0x56')])):path[_0x0193('0x60')](config[_0x0193('0x61')],_0x2eb88f,_['toLower'](_0x0193('0x68')));var _0x4b72a3=_0x0193('0x64')+_[_0x0193('0x65')](_0x0193('0x56'));if(_0x57f203[_0x4b72a3]||!_0x79fce6[_0x0193('0x69')]){_0x27d4e6=path[_0x0193('0x60')](config[_0x0193('0x61')],_0x2eb88f,_[_0x0193('0x62')](_0x0193('0x68')));}if(!fs[_0x0193('0x5f')](_0x27d4e6)){throw new db[(_0x0193('0x6a'))][(_0x0193('0x6b'))](_[_0x0193('0x65')]('loginLogo')+_0x0193('0x66'));}return _0xc91613['download'](_0x27d4e6);}})[_0x0193('0x25')](handleError(_0xc91613,null));};exports[_0x0193('0x6c')]=function(_0x3e5c33,_0x56901d){return db['Setting'][_0x0193('0x53')]({'where':{'id':_0x3e5c33[_0x0193('0x50')]['id']},'attributes':['securePassword']})[_0x0193('0x1a')](respondWithResult(_0x56901d,null))[_0x0193('0x25')](handleError(_0x56901d,null));};exports[_0x0193('0x6d')]=function(_0x47e7bb,_0x2509f5,_0x14efaa){if(_0x47e7bb[_0x0193('0x55')]&&_0x47e7bb[_0x0193('0x55')][_0x0193('0x54')]){_0x47e7bb[_0x0193('0x52')][_0x0193('0x67')]=_0x47e7bb[_0x0193('0x55')]['filename'];}return db[_0x0193('0x36')][_0x0193('0x53')]({'where':{'id':_0x47e7bb[_0x0193('0x50')]['id']}})['then'](handleEntityNotFound(_0x2509f5,null))['then'](saveUpdates(_0x47e7bb['body'],null))[_0x0193('0x1a')](respondWithResult(_0x2509f5,null))[_0x0193('0x25')](handleError(_0x2509f5,null));};var utilLicense=require('../../config/license/util');exports[_0x0193('0x6e')]=function(_0x3758c7,_0x415aa3,_0x5c7228){var _0x24efab='server/files/images/logos';var _0x402e76={'custom':![]};return utilLicense[_0x0193('0x59')]()[_0x0193('0x1a')](function(_0x495870){if(_0x495870){_0x402e76=_0x495870;}return db['Setting'][_0x0193('0x53')]({'where':{'id':_0x3758c7[_0x0193('0x50')]['id']},'attributes':[_0x0193('0x5e'),_0x0193('0x56'),_0x0193('0x67'),_0x0193('0x6f'),_0x0193('0x5a'),_0x0193('0x5b'),'defaultPreferred',_0x0193('0x5d')],'raw':!![]});})[_0x0193('0x1a')](handleEntityNotFound(_0x415aa3,null))[_0x0193('0x1a')](function(_0x299a84){if(_0x299a84){var _0xe8a254=_0x299a84[_0x0193('0x67')]&&fs[_0x0193('0x5f')](path[_0x0193('0x60')](config[_0x0193('0x61')],_0x24efab,_[_0x0193('0x62')](_0x299a84['preferred'])))?path[_0x0193('0x60')](config['root'],_0x24efab,_[_0x0193('0x62')](_0x299a84[_0x0193('0x67')])):path[_0x0193('0x60')](config[_0x0193('0x61')],_0x24efab,_[_0x0193('0x62')]('default_preferred.png'));var _0x3da01a=_0x0193('0x64')+_[_0x0193('0x65')](_0x0193('0x67'));if(_0x299a84[_0x3da01a]||!_0x402e76[_0x0193('0x69')]||!_0x402e76[_0x0193('0x67')]){_0xe8a254=path['join'](config[_0x0193('0x61')],_0x24efab,_['toLower'](_0x0193('0x70')));}if(!fs[_0x0193('0x5f')](_0xe8a254)){throw new db[(_0x0193('0x6a'))]['ValidationError'](_[_0x0193('0x65')](_0x0193('0x67'))+_0x0193('0x66'));}return _0x415aa3[_0x0193('0x71')](_0xe8a254);}})[_0x0193('0x25')](handleError(_0x415aa3,null));};exports['addFavicon']=function(_0xf0e74,_0x387634,_0x2bb84c){if(_0xf0e74[_0x0193('0x55')]&&_0xf0e74[_0x0193('0x55')]['filename']){_0xf0e74[_0x0193('0x52')]['favicon']=_0xf0e74[_0x0193('0x55')][_0x0193('0x54')];}return db['Setting'][_0x0193('0x53')]({'where':{'id':_0xf0e74[_0x0193('0x50')]['id']}})[_0x0193('0x1a')](handleEntityNotFound(_0x387634,null))[_0x0193('0x1a')](saveUpdates(_0xf0e74[_0x0193('0x52')],null))['then'](respondWithResult(_0x387634,null))[_0x0193('0x25')](handleError(_0x387634,null));};var utilLicense=require('../../config/license/util');exports[_0x0193('0x72')]=function(_0x347290,_0x3de641,_0x1fde56){var _0xdc0fa0=_0x0193('0x73');var _0x56b5fb={'custom':![]};return utilLicense['getLicense']()[_0x0193('0x1a')](function(_0xb5875d){if(_0xb5875d){_0x56b5fb=_0xb5875d;}return db['Setting']['find']({'where':{'id':_0x347290[_0x0193('0x50')]['id']},'attributes':[_0x0193('0x5e'),'loginLogo',_0x0193('0x67'),'favicon','defaultLogo',_0x0193('0x5b'),'defaultPreferred',_0x0193('0x5d')],'raw':!![]});})[_0x0193('0x1a')](handleEntityNotFound(_0x3de641,null))['then'](function(_0x5da18a){if(_0x5da18a){var _0x4a1b5c=_0x5da18a[_0x0193('0x6f')]&&fs[_0x0193('0x5f')](path['join'](config[_0x0193('0x61')],_0xdc0fa0,_[_0x0193('0x62')](_0x5da18a['favicon'])))?path[_0x0193('0x60')](config[_0x0193('0x61')],_0xdc0fa0,_['toLower'](_0x5da18a[_0x0193('0x6f')])):path[_0x0193('0x60')](config['root'],_0xdc0fa0,_[_0x0193('0x62')](_0x0193('0x74')));var _0x34b1fc=_0x0193('0x64')+_[_0x0193('0x65')](_0x0193('0x6f'));if(_0x5da18a[_0x34b1fc]||!_0x56b5fb[_0x0193('0x69')]){_0x4a1b5c=path[_0x0193('0x60')](config['root'],_0xdc0fa0,_[_0x0193('0x62')](_0x0193('0x74')));}if(!fs[_0x0193('0x5f')](_0x4a1b5c)){throw new db['Sequelize'][(_0x0193('0x6b'))](_[_0x0193('0x65')](_0x0193('0x6f'))+_0x0193('0x66'));}return _0x3de641[_0x0193('0x71')](_0x4a1b5c);}})['catch'](handleError(_0x3de641,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 950699f..c9d530e 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 _0x60bb=['./setting.attributes','exports','define','Setting','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2d0317,_0x616ed4){var _0x60598a=function(_0x4a47ac){while(--_0x4a47ac){_0x2d0317['push'](_0x2d0317['shift']());}};_0x60598a(++_0x616ed4);}(_0x60bb,0x13c));var _0xb60b=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x60bb[_0x57474e];return _0xfaae8c;};'use strict';var _=require(_0xb60b('0x0'));var util=require(_0xb60b('0x1'));var logger=require(_0xb60b('0x2'))(_0xb60b('0x3'));var moment=require(_0xb60b('0x4'));var BPromise=require('bluebird');var rp=require(_0xb60b('0x5'));var fs=require('fs');var path=require(_0xb60b('0x6'));var rimraf=require(_0xb60b('0x7'));var config=require(_0xb60b('0x8'));var attributes=require(_0xb60b('0x9'));module[_0xb60b('0xa')]=function(_0x5c34de,_0x13ba46){return _0x5c34de[_0xb60b('0xb')](_0xb60b('0xc'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2824=['rimraf','../../config/environment','./setting.attributes','define','Setting','settings','lodash','util','api','moment','bluebird','path'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2824,0x66));var _0x4282=function(_0x376fa9,_0x5765e5){_0x376fa9=_0x376fa9-0x0;var _0x2f4e0a=_0x2824[_0x376fa9];return _0x2f4e0a;};'use strict';var _=require(_0x4282('0x0'));var util=require(_0x4282('0x1'));var logger=require('../../config/logger')(_0x4282('0x2'));var moment=require(_0x4282('0x3'));var BPromise=require(_0x4282('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4282('0x5'));var rimraf=require(_0x4282('0x6'));var config=require(_0x4282('0x7'));var attributes=require(_0x4282('0x8'));module['exports']=function(_0x23c1d7,_0x4c7633){return _0x23c1d7[_0x4282('0x9')](_0x4282('0xa'),attributes,{'tableName':_0x4282('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5b7759b..47239e3 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 _0xbd0b=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','lodash','util','bluebird','randomstring'];(function(_0x46b7d3,_0x2bac87){var _0x4639b0=function(_0x4920c7){while(--_0x4920c7){_0x46b7d3['push'](_0x46b7d3['shift']());}};_0x4639b0(++_0x2bac87);}(_0xbd0b,0xc2));var _0xbbd0=function(_0x24a88f,_0x2b9066){_0x24a88f=_0x24a88f-0x0;var _0x3b9767=_0xbd0b[_0x24a88f];return _0x3b9767;};'use strict';var _=require(_0xbbd0('0x0'));var util=require(_0xbbd0('0x1'));var moment=require('moment');var BPromise=require(_0xbbd0('0x2'));var rs=require(_0xbbd0('0x3'));var fs=require('fs');var Redis=require(_0xbbd0('0x4'));var db=require(_0xbbd0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbd0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbd0('0x7'));var client=jayson[_0xbbd0('0x8')][_0xbbd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c4dc1,_0x243b62,_0x21a521){return new BPromise(function(_0x2c7600,_0x43885a){return client[_0xbbd0('0xa')](_0x4c4dc1,_0x21a521)['then'](function(_0x4ad93e){logger[_0xbbd0('0xb')]('Setting,\x20%s,\x20%s',_0x243b62,_0xbbd0('0xc'));logger['debug'](_0xbbd0('0xd'),_0x243b62,_0xbbd0('0xc'),JSON['stringify'](_0x4ad93e));if(_0x4ad93e[_0xbbd0('0xe')]){if(_0x4ad93e['error'][_0xbbd0('0xf')]===0x1f4){logger[_0xbbd0('0xe')]('Setting,\x20%s,\x20%s',_0x243b62,_0x4ad93e[_0xbbd0('0xe')]['message']);return _0x43885a(_0x4ad93e[_0xbbd0('0xe')][_0xbbd0('0x10')]);}logger[_0xbbd0('0xe')](_0xbbd0('0x11'),_0x243b62,_0x4ad93e[_0xbbd0('0xe')]['message']);return _0x2c7600(_0x4ad93e[_0xbbd0('0xe')][_0xbbd0('0x10')]);}else{logger[_0xbbd0('0xb')](_0xbbd0('0x11'),_0x243b62,_0xbbd0('0xc'));_0x2c7600(_0x4ad93e['result']['message']);}})['catch'](function(_0x5e46c8){logger['error']('Setting,\x20%s,\x20%s',_0x243b62,_0x5e46c8);_0x43885a(_0x5e46c8);});});} \ No newline at end of file +var _0x3e82=['request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3faa44,_0x4b5e8a){var _0xa50d54=function(_0x4b1bca){while(--_0x4b1bca){_0x3faa44['push'](_0x3faa44['shift']());}};_0xa50d54(++_0x4b5e8a);}(_0x3e82,0xb4));var _0x23e8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3e82[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x23e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23e8('0x1'));var rs=require(_0x23e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23e8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x23e8('0x4'))('rpc');var config=require(_0x23e8('0x5'));var jayson=require(_0x23e8('0x6'));var client=jayson[_0x23e8('0x7')][_0x23e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe407ac,_0x593349,_0x1bdd18){return new BPromise(function(_0x3e67cc,_0x42c11c){return client[_0x23e8('0x9')](_0xe407ac,_0x1bdd18)['then'](function(_0x2c46b0){logger[_0x23e8('0xa')](_0x23e8('0xb'),_0x593349,_0x23e8('0xc'));logger[_0x23e8('0xd')](_0x23e8('0xe'),_0x593349,_0x23e8('0xc'),JSON[_0x23e8('0xf')](_0x2c46b0));if(_0x2c46b0[_0x23e8('0x10')]){if(_0x2c46b0[_0x23e8('0x10')][_0x23e8('0x11')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x593349,_0x2c46b0[_0x23e8('0x10')][_0x23e8('0x12')]);return _0x42c11c(_0x2c46b0[_0x23e8('0x10')][_0x23e8('0x12')]);}logger['error'](_0x23e8('0xb'),_0x593349,_0x2c46b0[_0x23e8('0x10')][_0x23e8('0x12')]);return _0x3e67cc(_0x2c46b0['error'][_0x23e8('0x12')]);}else{logger[_0x23e8('0xa')](_0x23e8('0xb'),_0x593349,_0x23e8('0xc'));_0x3e67cc(_0x2c46b0[_0x23e8('0x13')]['message']);}})[_0x23e8('0x14')](function(_0x1d8d9b){logger[_0x23e8('0x10')](_0x23e8('0xb'),_0x593349,_0x1d8d9b);_0x42c11c(_0x1d8d9b);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 32f8947..8e238ce 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 _0x84e1=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller'];(function(_0x465a22,_0x6bfa46){var _0x5ad9da=function(_0x527753){while(--_0x527753){_0x465a22['push'](_0x465a22['shift']());}};_0x5ad9da(++_0x6bfa46);}(_0x84e1,0x9f));var _0x184e=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x84e1[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x184e('0x0'));var util=require(_0x184e('0x1'));var path=require('path');var timeout=require(_0x184e('0x2'));var express=require(_0x184e('0x3'));var router=express[_0x184e('0x4')]();var auth=require(_0x184e('0x5'));var interaction=require(_0x184e('0x6'));var config=require(_0x184e('0x7'));var controller=require(_0x184e('0x8'));router[_0x184e('0x9')]('/',auth[_0x184e('0xa')](),controller[_0x184e('0xb')]);router[_0x184e('0x9')](_0x184e('0xc'),auth[_0x184e('0xa')](),controller[_0x184e('0xd')]);router[_0x184e('0x9')](_0x184e('0xe'),auth[_0x184e('0xa')](),controller[_0x184e('0xf')]);router[_0x184e('0x9')](_0x184e('0x10'),auth['isAuthenticated'](),controller[_0x184e('0x11')]);router[_0x184e('0x9')](_0x184e('0x12'),auth[_0x184e('0xa')](),controller[_0x184e('0x13')]);router['get']('/:id/applications',auth[_0x184e('0xa')](),controller['getApplications']);router[_0x184e('0x9')](_0x184e('0x14'),auth[_0x184e('0xa')](),controller[_0x184e('0x15')]);router['get'](_0x184e('0x16'),controller[_0x184e('0x17')]);router[_0x184e('0x9')](_0x184e('0x18'),auth[_0x184e('0xa')](),controller[_0x184e('0x19')]);router[_0x184e('0x1a')]('/',auth['isAuthenticated'](),controller[_0x184e('0x1b')]);router['post']('/:id/dispositions',auth[_0x184e('0xa')](),controller[_0x184e('0x1c')]);router[_0x184e('0x1a')]('/:id/canned_answers',auth[_0x184e('0xa')](),controller['addAnswer']);router['post'](_0x184e('0x1d'),controller[_0x184e('0x1e')]);router[_0x184e('0x1a')]('/:id/applications',auth[_0x184e('0xa')](),controller['addApplications']);router['post'](_0x184e('0x1f'),auth[_0x184e('0xa')](),controller[_0x184e('0x20')]);router['post'](_0x184e('0x16'),controller[_0x184e('0x21')]);router[_0x184e('0x1a')](_0x184e('0x18'),auth['isAuthenticated'](),controller[_0x184e('0x22')]);router[_0x184e('0x23')](_0x184e('0xe'),auth[_0x184e('0xa')](),controller[_0x184e('0x24')]);router[_0x184e('0x25')](_0x184e('0xe'),auth['isAuthenticated'](),controller[_0x184e('0x26')]);router['delete'](_0x184e('0x10'),auth[_0x184e('0xa')](),controller[_0x184e('0x27')]);router[_0x184e('0x25')](_0x184e('0x12'),auth[_0x184e('0xa')](),controller[_0x184e('0x28')]);router[_0x184e('0x25')](_0x184e('0x18'),auth[_0x184e('0xa')](),controller[_0x184e('0x29')]);module['exports']=router; \ No newline at end of file +var _0xf613=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','/:id/notify','notify','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf613,0x70));var _0x3f61=function(_0x28fa6f,_0x1b22ac){_0x28fa6f=_0x28fa6f-0x0;var _0x1ae01b=_0xf613[_0x28fa6f];return _0x1ae01b;};'use strict';var multer=require(_0x3f61('0x0'));var util=require(_0x3f61('0x1'));var path=require(_0x3f61('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f61('0x3'));var router=express[_0x3f61('0x4')]();var auth=require(_0x3f61('0x5'));var interaction=require(_0x3f61('0x6'));var config=require(_0x3f61('0x7'));var controller=require(_0x3f61('0x8'));router[_0x3f61('0x9')]('/',auth[_0x3f61('0xa')](),controller['index']);router['get'](_0x3f61('0xb'),auth['isAuthenticated'](),controller[_0x3f61('0xc')]);router[_0x3f61('0x9')](_0x3f61('0xd'),auth[_0x3f61('0xa')](),controller[_0x3f61('0xe')]);router[_0x3f61('0x9')](_0x3f61('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x3f61('0xa')](),controller[_0x3f61('0x10')]);router[_0x3f61('0x9')](_0x3f61('0x11'),auth[_0x3f61('0xa')](),controller['getApplications']);router[_0x3f61('0x9')](_0x3f61('0x12'),auth[_0x3f61('0xa')](),controller[_0x3f61('0x13')]);router[_0x3f61('0x9')](_0x3f61('0x14'),controller['statusGet']);router['get'](_0x3f61('0x15'),auth['isAuthenticated'](),controller[_0x3f61('0x16')]);router[_0x3f61('0x17')]('/',auth[_0x3f61('0xa')](),controller[_0x3f61('0x18')]);router[_0x3f61('0x17')](_0x3f61('0xf'),auth['isAuthenticated'](),controller[_0x3f61('0x19')]);router[_0x3f61('0x17')](_0x3f61('0x1a'),auth[_0x3f61('0xa')](),controller['addAnswer']);router[_0x3f61('0x17')](_0x3f61('0x1b'),controller[_0x3f61('0x1c')]);router[_0x3f61('0x17')](_0x3f61('0x11'),auth[_0x3f61('0xa')](),controller[_0x3f61('0x1d')]);router[_0x3f61('0x17')](_0x3f61('0x1e'),auth[_0x3f61('0xa')](),controller[_0x3f61('0x1f')]);router[_0x3f61('0x17')](_0x3f61('0x14'),controller['status']);router['post'](_0x3f61('0x15'),auth[_0x3f61('0xa')](),controller[_0x3f61('0x20')]);router[_0x3f61('0x21')](_0x3f61('0xd'),auth[_0x3f61('0xa')](),controller['update']);router[_0x3f61('0x22')](_0x3f61('0xd'),auth[_0x3f61('0xa')](),controller['destroy']);router[_0x3f61('0x22')](_0x3f61('0xf'),auth[_0x3f61('0xa')](),controller[_0x3f61('0x23')]);router[_0x3f61('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3f61('0x24')]);router[_0x3f61('0x22')]('/:id/users',auth[_0x3f61('0xa')](),controller[_0x3f61('0x25')]);module[_0x3f61('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index d8891da..bf6550a 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 _0xd804=['connectel','plivo','csc','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','twilio','skebby'];(function(_0x3ef0d7,_0x2b5c99){var _0x10ddac=function(_0x34b19b){while(--_0x34b19b){_0x3ef0d7['push'](_0x3ef0d7['shift']());}};_0x10ddac(++_0x2b5c99);}(_0xd804,0x174));var _0x4d80=function(_0x274270,_0x53ea2f){_0x274270=_0x274270-0x0;var _0x1d49a2=_0xd804[_0x274270];return _0x1d49a2;};'use strict';var Sequelize=require(_0x4d80('0x0'));var rs=require('randomstring');module[_0x4d80('0x1')]={'name':{'type':Sequelize[_0x4d80('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4d80('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4d80('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x4d80('0x2')]},'type':{'type':Sequelize[_0x4d80('0x3')](_0x4d80('0x4'),_0x4d80('0x5'),_0x4d80('0x6'),'clicksend',_0x4d80('0x7'),'clickatell',_0x4d80('0x8'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x4d80('0x3')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4d80('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x4d80('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x4d80('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4d80('0x9')],'defaultValue':function(){return _0x4d80('0xa');}},'notificationSound':{'type':Sequelize[_0x4d80('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4d80('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4d80('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4d80('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4d80('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4d80('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4d80('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4d80('0xe'),'set':function(_0x4bc8c5){if(!_0x4bc8c5)this[_0x4d80('0xf')](_0x4d80('0x10'),null);this['setDataValue'](_0x4d80('0x11'),_0x4bc8c5);}}}; \ No newline at end of file +var _0x14ad=['randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','csc','infobip','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'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x14ad,0x1cd));var _0xd14a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x14ad[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xd14a('0x0'));var rs=require(_0xd14a('0x1'));module[_0xd14a('0x2')]={'name':{'type':Sequelize[_0xd14a('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xd14a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xd14a('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd14a('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd14a('0x5')](_0xd14a('0x6'),_0xd14a('0x7'),_0xd14a('0x8'),_0xd14a('0x9'),'plivo',_0xd14a('0xa'),_0xd14a('0xb'),_0xd14a('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xd14a('0x3')]},'authId':{'type':Sequelize[_0xd14a('0x3')]},'authToken':{'type':Sequelize[_0xd14a('0x3')]},'smsMethod':{'type':Sequelize[_0xd14a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd14a('0x3')]},'password':{'type':Sequelize[_0xd14a('0x3')]},'apiKey':{'type':Sequelize[_0xd14a('0x3')]},'senderString':{'type':Sequelize[_0xd14a('0x3')]},'deliveryReport':{'type':Sequelize[_0xd14a('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xd14a('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd14a('0xe')],'defaultValue':function(){return _0xd14a('0xf');}},'notificationSound':{'type':Sequelize[_0xd14a('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd14a('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd14a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd14a('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd14a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd14a('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd14a('0xd')],'defaultValue':![],'comment':_0xd14a('0x12'),'set':function(_0xae9693){if(!_0xae9693)this[_0xd14a('0x13')]('mandatoryDispositionPauseId',null);this[_0xd14a('0x13')](_0xd14a('0x14'),_0xae9693);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 192a377..09f72ae 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 _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x1f143f,_0x1b71c7){var _0x32c93e=function(_0x25d58e){while(--_0x25d58e){_0x1f143f['push'](_0x1f143f['shift']());}};_0x32c93e(++_0x1b71c7);}(_0x7a54,0x106));var _0x47a5=function(_0x4d0d86,_0x12c7ba){_0x4d0d86=_0x4d0d86-0x0;var _0x54039f=_0x7a54[_0x4d0d86];return _0x54039f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a68393e..a6e544b 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 _0x77b0=['save','update','remove','emit','hasOwnProperty','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x1ac5a5,_0x50b1da){var _0x3387db=function(_0x5d508a){while(--_0x5d508a){_0x1ac5a5['push'](_0x1ac5a5['shift']());}};_0x3387db(++_0x50b1da);}(_0x77b0,0x1c5));var _0x077b=function(_0x4ab0bf,_0x560a00){_0x4ab0bf=_0x4ab0bf-0x0;var _0x1e3fb7=_0x77b0[_0x4ab0bf];return _0x1e3fb7;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x077b('0x0'))['db'][_0x077b('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x077b('0x2')](0x0);var events={'afterCreate':_0x077b('0x3'),'afterUpdate':_0x077b('0x4'),'afterDestroy':_0x077b('0x5')};function emitEvent(_0x54c768){return function(_0x176d6b,_0x31565d,_0x4577cd){SmsAccountEvents[_0x077b('0x6')](_0x54c768+':'+_0x176d6b['id'],_0x176d6b);SmsAccountEvents['emit'](_0x54c768,_0x176d6b);_0x4577cd(null);};}for(var e in events){if(events[_0x077b('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x5a78=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x368016,_0x2d4188){var _0x44c875=function(_0x5a5d17){while(--_0x5a5d17){_0x368016['push'](_0x368016['shift']());}};_0x44c875(++_0x2d4188);}(_0x5a78,0x1b0));var _0x85a7=function(_0x421ef4,_0x4fc826){_0x421ef4=_0x421ef4-0x0;var _0x12e29b=_0x5a78[_0x421ef4];return _0x12e29b;};'use strict';var EventEmitter=require(_0x85a7('0x0'));var SmsAccount=require(_0x85a7('0x1'))['db'][_0x85a7('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x85a7('0x3')](0x0);var events={'afterCreate':_0x85a7('0x4'),'afterUpdate':_0x85a7('0x5'),'afterDestroy':_0x85a7('0x6')};function emitEvent(_0x5d1f4e){return function(_0x5e784d,_0x5a5704,_0x422883){SmsAccountEvents[_0x85a7('0x7')](_0x5d1f4e+':'+_0x5e784d['id'],_0x5e784d);SmsAccountEvents[_0x85a7('0x7')](_0x5d1f4e,_0x5e784d);_0x422883(null);};}for(var e in events){if(events[_0x85a7('0x8')](e)){var event=events[e];SmsAccount[_0x85a7('0x9')](e,emitEvent(event));}}module[_0x85a7('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f4852b8..7ba509e 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 _0x6710=['request-promise','path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment'];(function(_0x171d26,_0x283521){var _0x575012=function(_0x433a80){while(--_0x433a80){_0x171d26['push'](_0x171d26['shift']());}};_0x575012(++_0x283521);}(_0x6710,0xd4));var _0x0671=function(_0x5d3e97,_0x17254e){_0x5d3e97=_0x5d3e97-0x0;var _0x233e5b=_0x6710[_0x5d3e97];return _0x233e5b;};'use strict';var _=require(_0x0671('0x0'));var util=require(_0x0671('0x1'));var logger=require(_0x0671('0x2'))('api');var moment=require(_0x0671('0x3'));var BPromise=require('bluebird');var rp=require(_0x0671('0x4'));var fs=require('fs');var path=require(_0x0671('0x5'));var rimraf=require('rimraf');var config=require(_0x0671('0x6'));var attributes=require(_0x0671('0x7'));module[_0x0671('0x8')]=function(_0x4f4070,_0x544a10){return _0x4f4070[_0x0671('0x9')](_0x0671('0xa'),attributes,{'tableName':_0x0671('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x299f=['./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x16b6ae,_0x3c82bc){var _0x2faa73=function(_0x108426){while(--_0x108426){_0x16b6ae['push'](_0x16b6ae['shift']());}};_0x2faa73(++_0x3c82bc);}(_0x299f,0xd5));var _0xf299=function(_0x330ae3,_0xc38a70){_0x330ae3=_0x330ae3-0x0;var _0x3dc586=_0x299f[_0x330ae3];return _0x3dc586;};'use strict';var _=require(_0xf299('0x0'));var util=require('util');var logger=require(_0xf299('0x1'))(_0xf299('0x2'));var moment=require(_0xf299('0x3'));var BPromise=require(_0xf299('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf299('0x5'));var rimraf=require(_0xf299('0x6'));var config=require('../../config/environment');var attributes=require(_0xf299('0x7'));module[_0xf299('0x8')]=function(_0x1ca7ea,_0x962b52){return _0x1ca7ea['define'](_0xf299('0x9'),attributes,{'tableName':_0xf299('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 8f2f29e..4634616 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 _0x8fd9=['include','model','map','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where'];(function(_0x5d85a4,_0x33b331){var _0x160df6=function(_0x29dbf8){while(--_0x29dbf8){_0x5d85a4['push'](_0x5d85a4['shift']());}};_0x160df6(++_0x33b331);}(_0x8fd9,0x1e4));var _0x98fd=function(_0x212960,_0x520f14){_0x212960=_0x212960-0x0;var _0x4f5a8a=_0x8fd9[_0x212960];return _0x4f5a8a;};'use strict';var _=require('lodash');var util=require(_0x98fd('0x0'));var moment=require(_0x98fd('0x1'));var BPromise=require(_0x98fd('0x2'));var rs=require(_0x98fd('0x3'));var fs=require('fs');var Redis=require(_0x98fd('0x4'));var db=require(_0x98fd('0x5'))['db'];var utils=require(_0x98fd('0x6'));var logger=require(_0x98fd('0x7'))(_0x98fd('0x8'));var config=require(_0x98fd('0x9'));var jayson=require(_0x98fd('0xa'));var client=jayson[_0x98fd('0xb')][_0x98fd('0xc')]({'port':0x232a});config['redis']=_[_0x98fd('0xd')](config[_0x98fd('0xe')],{'host':_0x98fd('0xf'),'port':0x18eb});var socket=require(_0x98fd('0x10'))(new Redis(config[_0x98fd('0xe')]));require(_0x98fd('0x11'))[_0x98fd('0x12')](socket);function respondWithRpcPromise(_0x1bcc1a,_0x569226,_0x1ed7e4){return new BPromise(function(_0x319ad7,_0x16fa4c){return client[_0x98fd('0x13')](_0x1bcc1a,_0x1ed7e4)[_0x98fd('0x14')](function(_0x27e587){logger[_0x98fd('0x15')](_0x98fd('0x16'),_0x569226,_0x98fd('0x17'));logger[_0x98fd('0x18')](_0x98fd('0x19'),_0x569226,_0x98fd('0x17'),JSON['stringify'](_0x27e587));if(_0x27e587[_0x98fd('0x1a')]){if(_0x27e587[_0x98fd('0x1a')][_0x98fd('0x1b')]===0x1f4){logger[_0x98fd('0x1a')](_0x98fd('0x16'),_0x569226,_0x27e587['error'][_0x98fd('0x1c')]);return _0x16fa4c(_0x27e587[_0x98fd('0x1a')][_0x98fd('0x1c')]);}logger[_0x98fd('0x1a')](_0x98fd('0x16'),_0x569226,_0x27e587[_0x98fd('0x1a')]['message']);return _0x319ad7(_0x27e587[_0x98fd('0x1a')][_0x98fd('0x1c')]);}else{logger[_0x98fd('0x15')](_0x98fd('0x16'),_0x569226,_0x98fd('0x17'));_0x319ad7(_0x27e587[_0x98fd('0x1d')][_0x98fd('0x1c')]);}})[_0x98fd('0x1e')](function(_0x2b3e2d){logger[_0x98fd('0x1a')](_0x98fd('0x16'),_0x569226,_0x2b3e2d);_0x16fa4c(_0x2b3e2d);});});}exports[_0x98fd('0x1f')]=function(_0x4e2215){var _0xd08a=this;return new Promise(function(_0xd75a10,_0x32a8d6){return db[_0x98fd('0x20')]['find']({'raw':_0x4e2215[_0x98fd('0x21')]?_0x4e2215[_0x98fd('0x21')][_0x98fd('0x22')]===undefined?!![]:![]:!![],'where':_0x4e2215['options']?_0x4e2215[_0x98fd('0x21')][_0x98fd('0x23')]||null:null,'attributes':_0x4e2215[_0x98fd('0x21')]?_0x4e2215[_0x98fd('0x21')]['attributes']||null:null,'include':_0x4e2215[_0x98fd('0x21')]?_0x4e2215[_0x98fd('0x21')][_0x98fd('0x24')]?_['map'](_0x4e2215[_0x98fd('0x21')][_0x98fd('0x24')],function(_0x34434e){return{'model':db[_0x34434e[_0x98fd('0x25')]],'as':_0x34434e['as'],'attributes':_0x34434e['attributes'],'include':_0x34434e[_0x98fd('0x24')]?_['map'](_0x34434e[_0x98fd('0x24')],function(_0xa4df37){return{'model':db[_0xa4df37[_0x98fd('0x25')]],'as':_0xa4df37['as'],'attributes':_0xa4df37['attributes'],'include':_0xa4df37['include']?_[_0x98fd('0x26')](_0xa4df37[_0x98fd('0x24')],function(_0x3a43c8){return{'model':db[_0x3a43c8[_0x98fd('0x25')]],'as':_0x3a43c8['as'],'attributes':_0x3a43c8[_0x98fd('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x217514){logger['info']('ShowSmsAccount',_0x4e2215);logger[_0x98fd('0x18')](_0x98fd('0x1f'),_0x4e2215,JSON['stringify'](_0x217514));_0xd75a10(_0x217514);})[_0x98fd('0x1e')](function(_0x12be77){logger[_0x98fd('0x1a')](_0x98fd('0x1f'),_0x12be77['message'],_0x4e2215);_0x32a8d6(_0xd08a[_0x98fd('0x1a')](0x1f4,_0x12be77[_0x98fd('0x1c')]));});});}; \ No newline at end of file +var _0xd9e8=['./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSmsAccount','find','options','raw','include','attributes','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter'];(function(_0x5ba33d,_0x2c7707){var _0x34c66a=function(_0x2c3af7){while(--_0x2c3af7){_0x5ba33d['push'](_0x5ba33d['shift']());}};_0x34c66a(++_0x2c7707);}(_0xd9e8,0xc4));var _0x8d9e=function(_0xf988e6,_0x5db9e1){_0xf988e6=_0xf988e6-0x0;var _0x9b496b=_0xd9e8[_0xf988e6];return _0x9b496b;};'use strict';var _=require(_0x8d9e('0x0'));var util=require('util');var moment=require(_0x8d9e('0x1'));var BPromise=require(_0x8d9e('0x2'));var rs=require(_0x8d9e('0x3'));var fs=require('fs');var Redis=require(_0x8d9e('0x4'));var db=require(_0x8d9e('0x5'))['db'];var utils=require(_0x8d9e('0x6'));var logger=require(_0x8d9e('0x7'))(_0x8d9e('0x8'));var config=require(_0x8d9e('0x9'));var jayson=require(_0x8d9e('0xa'));var client=jayson[_0x8d9e('0xb')]['http']({'port':0x232a});config[_0x8d9e('0xc')]=_['defaults'](config[_0x8d9e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d9e('0xd'))(new Redis(config['redis']));require(_0x8d9e('0xe'))['register'](socket);function respondWithRpcPromise(_0x8b8c88,_0x1a22a7,_0x1467b2){return new BPromise(function(_0x5ac22e,_0x332e34){return client[_0x8d9e('0xf')](_0x8b8c88,_0x1467b2)[_0x8d9e('0x10')](function(_0x4cf323){logger['info'](_0x8d9e('0x11'),_0x1a22a7,_0x8d9e('0x12'));logger[_0x8d9e('0x13')](_0x8d9e('0x14'),_0x1a22a7,_0x8d9e('0x12'),JSON[_0x8d9e('0x15')](_0x4cf323));if(_0x4cf323[_0x8d9e('0x16')]){if(_0x4cf323[_0x8d9e('0x16')][_0x8d9e('0x17')]===0x1f4){logger[_0x8d9e('0x16')](_0x8d9e('0x11'),_0x1a22a7,_0x4cf323['error'][_0x8d9e('0x18')]);return _0x332e34(_0x4cf323[_0x8d9e('0x16')][_0x8d9e('0x18')]);}logger[_0x8d9e('0x16')](_0x8d9e('0x11'),_0x1a22a7,_0x4cf323['error'][_0x8d9e('0x18')]);return _0x5ac22e(_0x4cf323[_0x8d9e('0x16')][_0x8d9e('0x18')]);}else{logger[_0x8d9e('0x19')]('SmsAccount,\x20%s,\x20%s',_0x1a22a7,_0x8d9e('0x12'));_0x5ac22e(_0x4cf323['result'][_0x8d9e('0x18')]);}})[_0x8d9e('0x1a')](function(_0xb08477){logger[_0x8d9e('0x16')](_0x8d9e('0x11'),_0x1a22a7,_0xb08477);_0x332e34(_0xb08477);});});}exports[_0x8d9e('0x1b')]=function(_0x184030){var _0x5dc700=this;return new Promise(function(_0x12e1bf,_0x316eb0){return db['SmsAccount'][_0x8d9e('0x1c')]({'raw':_0x184030[_0x8d9e('0x1d')]?_0x184030[_0x8d9e('0x1d')][_0x8d9e('0x1e')]===undefined?!![]:![]:!![],'where':_0x184030['options']?_0x184030['options']['where']||null:null,'attributes':_0x184030[_0x8d9e('0x1d')]?_0x184030[_0x8d9e('0x1d')]['attributes']||null:null,'include':_0x184030['options']?_0x184030[_0x8d9e('0x1d')][_0x8d9e('0x1f')]?_['map'](_0x184030['options']['include'],function(_0x31a161){return{'model':db[_0x31a161['model']],'as':_0x31a161['as'],'attributes':_0x31a161[_0x8d9e('0x20')],'include':_0x31a161[_0x8d9e('0x1f')]?_[_0x8d9e('0x21')](_0x31a161[_0x8d9e('0x1f')],function(_0x4bb086){return{'model':db[_0x4bb086[_0x8d9e('0x22')]],'as':_0x4bb086['as'],'attributes':_0x4bb086[_0x8d9e('0x20')],'include':_0x4bb086[_0x8d9e('0x1f')]?_['map'](_0x4bb086[_0x8d9e('0x1f')],function(_0x4e061f){return{'model':db[_0x4e061f[_0x8d9e('0x22')]],'as':_0x4e061f['as'],'attributes':_0x4e061f[_0x8d9e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8d9e('0x10')](function(_0x1b1325){logger[_0x8d9e('0x19')]('ShowSmsAccount',_0x184030);logger[_0x8d9e('0x13')]('ShowSmsAccount',_0x184030,JSON['stringify'](_0x1b1325));_0x12e1bf(_0x1b1325);})[_0x8d9e('0x1a')](function(_0x1cb77e){logger[_0x8d9e('0x16')](_0x8d9e('0x1b'),_0x1cb77e[_0x8d9e('0x18')],_0x184030);_0x316eb0(_0x5dc700['error'](0x1f4,_0x1cb77e[_0x8d9e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index cd748be..cc245e3 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 _0x06a2=['smsAccount:','./smsAccount.events','save','update','emit','removeListener','length'];(function(_0x1839e2,_0x37be65){var _0x59f1fa=function(_0x21e81a){while(--_0x21e81a){_0x1839e2['push'](_0x1839e2['shift']());}};_0x59f1fa(++_0x37be65);}(_0x06a2,0x1ac));var _0x206a=function(_0x45a932,_0x52247e){_0x45a932=_0x45a932-0x0;var _0xe66c87=_0x06a2[_0x45a932];return _0xe66c87;};'use strict';var SmsAccountEvents=require(_0x206a('0x0'));var events=[_0x206a('0x1'),'remove',_0x206a('0x2')];function createListener(_0x2ace1a,_0x1b25c5){return function(_0x3a053a){_0x1b25c5[_0x206a('0x3')](_0x2ace1a,_0x3a053a);};}function removeListener(_0x2adaf5,_0x13c2c8){return function(){SmsAccountEvents[_0x206a('0x4')](_0x2adaf5,_0x13c2c8);};}exports['register']=function(_0x41386d){for(var _0x17bccc=0x0,_0x94730d=events[_0x206a('0x5')];_0x17bccc<_0x94730d;_0x17bccc++){var _0x46fcdb=events[_0x17bccc];var _0xc084ad=createListener(_0x206a('0x6')+_0x46fcdb,_0x41386d);SmsAccountEvents['on'](_0x46fcdb,_0xc084ad);}}; \ No newline at end of file +var _0x693a=['length','smsAccount:','./smsAccount.events','save','update','register'];(function(_0x304507,_0x582d57){var _0xdd2472=function(_0x517df6){while(--_0x517df6){_0x304507['push'](_0x304507['shift']());}};_0xdd2472(++_0x582d57);}(_0x693a,0x1ee));var _0xa693=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x693a[_0x29c261];return _0x1a9335;};'use strict';var SmsAccountEvents=require(_0xa693('0x0'));var events=[_0xa693('0x1'),'remove',_0xa693('0x2')];function createListener(_0x162927,_0x46ddfa){return function(_0x47330d){_0x46ddfa['emit'](_0x162927,_0x47330d);};}function removeListener(_0x470a32,_0x1d135f){return function(){SmsAccountEvents['removeListener'](_0x470a32,_0x1d135f);};}exports[_0xa693('0x3')]=function(_0x4c07f1){for(var _0x1c3dd2=0x0,_0x3abc7d=events[_0xa693('0x4')];_0x1c3dd2<_0x3abc7d;_0x1c3dd2++){var _0x1b9a50=events[_0x1c3dd2];var _0x23889a=createListener(_0xa693('0x5')+_0x1b9a50,_0x4c07f1);SmsAccountEvents['on'](_0x1b9a50,_0x23889a);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 8d1fd5b..24a42be 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 _0x241c=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x4e7dd9,_0x948713){var _0x3ab8d9=function(_0x5a2bb9){while(--_0x5a2bb9){_0x4e7dd9['push'](_0x4e7dd9['shift']());}};_0x3ab8d9(++_0x948713);}(_0x241c,0x109));var _0xc241=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x241c[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xc241('0x0'));var path=require(_0xc241('0x1'));var timeout=require(_0xc241('0x2'));var express=require('express');var router=express[_0xc241('0x3')]();var auth=require(_0xc241('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc241('0x5'));var controller=require('./smsApplication.controller');router[_0xc241('0x6')]('/',auth[_0xc241('0x7')](),controller[_0xc241('0x8')]);router['get'](_0xc241('0x9'),auth[_0xc241('0x7')](),controller[_0xc241('0xa')]);router[_0xc241('0xb')]('/',auth[_0xc241('0x7')](),controller[_0xc241('0xc')]);router[_0xc241('0xd')](_0xc241('0x9'),auth[_0xc241('0x7')](),controller[_0xc241('0xe')]);router[_0xc241('0xf')](_0xc241('0x9'),auth[_0xc241('0x7')](),controller[_0xc241('0x10')]);module['exports']=router; \ No newline at end of file +var _0xec98=['express','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0xcac2ec,_0x54b40b){var _0x2bb095=function(_0x370ac3){while(--_0x370ac3){_0xcac2ec['push'](_0xcac2ec['shift']());}};_0x2bb095(++_0x54b40b);}(_0xec98,0x1c0));var _0x8ec9=function(_0x1dece4,_0x5c570a){_0x1dece4=_0x1dece4-0x0;var _0xda4163=_0xec98[_0x1dece4];return _0xda4163;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ec9('0x0'));var timeout=require(_0x8ec9('0x1'));var express=require(_0x8ec9('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8ec9('0x3'));var config=require('../../config/environment');var controller=require(_0x8ec9('0x4'));router[_0x8ec9('0x5')]('/',auth[_0x8ec9('0x6')](),controller['index']);router[_0x8ec9('0x5')](_0x8ec9('0x7'),auth['isAuthenticated'](),controller[_0x8ec9('0x8')]);router[_0x8ec9('0x9')]('/',auth[_0x8ec9('0x6')](),controller[_0x8ec9('0xa')]);router[_0x8ec9('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x8ec9('0xc')]);router['delete'](_0x8ec9('0x7'),auth['isAuthenticated'](),controller[_0x8ec9('0xd')]);module[_0x8ec9('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 86aee3d..d15ec1e 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 _0xf667=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf667,0x182));var _0x7f66=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xf667[_0x5a79e2];return _0x266c45;};'use strict';var Sequelize=require('sequelize');module[_0x7f66('0x0')]={'priority':{'type':Sequelize[_0x7f66('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7f66('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7f66('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7f66('0x2')],'defaultValue':_0x7f66('0x4')}}; \ No newline at end of file +var _0x31bf=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x183268,_0x284666){var _0xdef54f=function(_0x4b413d){while(--_0x4b413d){_0x183268['push'](_0x183268['shift']());}};_0xdef54f(++_0x284666);}(_0x31bf,0x1d7));var _0xf31b=function(_0x4786d4,_0x1670ad){_0x4786d4=_0x4786d4-0x0;var _0x5174d3=_0x31bf[_0x4786d4];return _0x5174d3;};'use strict';var Sequelize=require(_0xf31b('0x0'));module[_0xf31b('0x1')]={'priority':{'type':Sequelize[_0xf31b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf31b('0x3')],'allowNull':![],'defaultValue':_0xf31b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf31b('0x3')]},'interval':{'type':Sequelize[_0xf31b('0x3')],'defaultValue':_0xf31b('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index afbdb10..75f7ab2 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 _0xb03e=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','SmsApplication','rawAttributes','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','map','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x22849a,_0x13c397){var _0x5eab95=function(_0x888baa){while(--_0x888baa){_0x22849a['push'](_0x22849a['shift']());}};_0x5eab95(++_0x13c397);}(_0xb03e,0x1eb));var _0xeb03=function(_0x9ac359,_0x571aa6){_0x9ac359=_0x9ac359-0x0;var _0x25c704=_0xb03e[_0x9ac359];return _0x25c704;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb03('0x0'));var rimraf=require(_0xeb03('0x1'));var zipdir=require(_0xeb03('0x2'));var jsonpatch=require(_0xeb03('0x3'));var rp=require(_0xeb03('0x4'));var moment=require(_0xeb03('0x5'));var BPromise=require(_0xeb03('0x6'));var Mustache=require(_0xeb03('0x7'));var util=require(_0xeb03('0x8'));var path=require(_0xeb03('0x9'));var sox=require(_0xeb03('0xa'));var csv=require(_0xeb03('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xb'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var db=require(_0xeb03('0x19'))['db'];function respondWithStatusCode(_0x45481b,_0x367d36){_0x367d36=_0x367d36||0xcc;return function(_0x384cbe){if(_0x384cbe){return _0x45481b[_0xeb03('0x1a')](_0x367d36);}return _0x45481b[_0xeb03('0x1b')](_0x367d36)[_0xeb03('0x1c')]();};}function respondWithResult(_0x3bebc6,_0x4d9c8e){_0x4d9c8e=_0x4d9c8e||0xc8;return function(_0x212082){if(_0x212082){return _0x3bebc6[_0xeb03('0x1b')](_0x4d9c8e)[_0xeb03('0x1d')](_0x212082);}};}function respondWithFilteredResult(_0x33f9ba,_0x52be5b){return function(_0x15f4fe){if(_0x15f4fe){var _0x36f5d8=_0x15f4fe[_0xeb03('0x1e')],_0x3f26ef=_0x52be5b[_0xeb03('0x1f')],_0x478989=_0x52be5b[_0xeb03('0x1f')]+_0x52be5b[_0xeb03('0x20')],_0x7ce874;if(_0x478989>=_0x36f5d8){_0x478989=_0x36f5d8;_0x7ce874=0xc8;}else{_0x7ce874=0xce;}_0x33f9ba[_0xeb03('0x1b')](_0x7ce874);return _0x33f9ba[_0xeb03('0x21')](_0xeb03('0x22'),_0x3f26ef+'-'+_0x478989+'/'+_0x36f5d8)[_0xeb03('0x1d')](_0x15f4fe);}return null;};}function patchUpdates(_0x469d25){return function(_0x456fb3){try{jsonpatch[_0xeb03('0x23')](_0x456fb3,_0x469d25,!![]);}catch(_0x2443d9){return BPromise[_0xeb03('0x24')](_0x2443d9);}return _0x456fb3['save']();};}function saveUpdates(_0x1bea3f,_0x3855dd){return function(_0x413d3e){if(_0x413d3e){return _0x413d3e[_0xeb03('0x25')](_0x1bea3f)[_0xeb03('0x26')](function(_0x31e406){return _0x31e406;});}return null;};}function removeEntity(_0xb98dc1,_0x2c795b){return function(_0x3c3d09){if(_0x3c3d09){return _0x3c3d09['destroy']()[_0xeb03('0x26')](function(){_0xb98dc1[_0xeb03('0x1b')](0xcc)[_0xeb03('0x1c')]();});}};}function handleEntityNotFound(_0x300dc0,_0x2f99e6){return function(_0x5dcda3){if(!_0x5dcda3){_0x300dc0[_0xeb03('0x1a')](0x194);}return _0x5dcda3;};}function handleError(_0x406864,_0x16cd4){_0x16cd4=_0x16cd4||0x1f4;return function(_0x20efa8){logger[_0xeb03('0x27')](_0x20efa8[_0xeb03('0x28')]);if(_0x20efa8[_0xeb03('0x29')]){delete _0x20efa8[_0xeb03('0x29')];}_0x406864[_0xeb03('0x1b')](_0x16cd4)['send'](_0x20efa8);};}exports[_0xeb03('0x2a')]=function(_0x1b2c7b,_0x2683f9){var _0x1ada2e={},_0x4cdea6={},_0x581685={'count':0x0,'rows':[]};var _0x1064a5=_['map'](db[_0xeb03('0x2b')][_0xeb03('0x2c')],function(_0x160a37){return{'name':_0x160a37['fieldName'],'type':_0x160a37[_0xeb03('0x2d')]['key']};});_0x4cdea6['model']=_['map'](_0x1064a5,'name');_0x4cdea6[_0xeb03('0x2e')]=_[_0xeb03('0x2f')](_0x1b2c7b['query']);_0x4cdea6['filters']=_['intersection'](_0x4cdea6['model'],_0x4cdea6[_0xeb03('0x2e')]);_0x1ada2e[_0xeb03('0x30')]=_[_0xeb03('0x31')](_0x4cdea6[_0xeb03('0x32')],qs[_0xeb03('0x33')](_0x1b2c7b['query'][_0xeb03('0x33')]));_0x1ada2e['attributes']=_0x1ada2e[_0xeb03('0x30')][_0xeb03('0x34')]?_0x1ada2e[_0xeb03('0x30')]:_0x4cdea6[_0xeb03('0x32')];if(!_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x35')](_0xeb03('0x36'))){_0x1ada2e[_0xeb03('0x20')]=qs['limit'](_0x1b2c7b[_0xeb03('0x2e')]['limit']);_0x1ada2e[_0xeb03('0x1f')]=qs[_0xeb03('0x1f')](_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x1f')]);}_0x1ada2e[_0xeb03('0x37')]=qs[_0xeb03('0x38')](_0x1b2c7b['query'][_0xeb03('0x38')]);_0x1ada2e['where']=qs['filters'](_['pick'](_0x1b2c7b[_0xeb03('0x2e')],_0x4cdea6[_0xeb03('0x39')]),_0x1064a5);if(_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x3a')]){_0x1ada2e[_0xeb03('0x3b')]=_['merge'](_0x1ada2e[_0xeb03('0x3b')],{'$or':_[_0xeb03('0x3c')](_0x1064a5,function(_0x1d3ca1){if(_0x1d3ca1['type']!=='VIRTUAL'){var _0xac05c4={};_0xac05c4[_0x1d3ca1[_0xeb03('0x29')]]={'$like':'%'+_0x1b2c7b[_0xeb03('0x2e')]['filter']+'%'};return _0xac05c4;}})});}_0x1ada2e=_[_0xeb03('0x3d')]({},_0x1ada2e,_0x1b2c7b[_0xeb03('0x3e')]);var _0x57b2ab={'where':_0x1ada2e['where']};return db[_0xeb03('0x2b')][_0xeb03('0x1e')](_0x57b2ab)['then'](function(_0x39ebe8){_0x581685[_0xeb03('0x1e')]=_0x39ebe8;if(_0x1b2c7b[_0xeb03('0x2e')][_0xeb03('0x3f')]){_0x1ada2e[_0xeb03('0x40')]=[{'all':!![]}];}return db[_0xeb03('0x2b')][_0xeb03('0x41')](_0x1ada2e);})[_0xeb03('0x26')](function(_0x20ebe8){_0x581685[_0xeb03('0x42')]=_0x20ebe8;return _0x581685;})[_0xeb03('0x26')](respondWithFilteredResult(_0x2683f9,_0x1ada2e))[_0xeb03('0x43')](handleError(_0x2683f9,null));};exports[_0xeb03('0x44')]=function(_0x33414d,_0x28b831){var _0x6b95dd={'raw':!![],'where':{'id':_0x33414d[_0xeb03('0x45')]['id']}},_0x407f0b={};_0x407f0b[_0xeb03('0x32')]=_[_0xeb03('0x2f')](db[_0xeb03('0x2b')][_0xeb03('0x2c')]);_0x407f0b[_0xeb03('0x2e')]=_['keys'](_0x33414d['query']);_0x407f0b[_0xeb03('0x39')]=_[_0xeb03('0x31')](_0x407f0b[_0xeb03('0x32')],_0x407f0b[_0xeb03('0x2e')]);_0x6b95dd[_0xeb03('0x30')]=_[_0xeb03('0x31')](_0x407f0b[_0xeb03('0x32')],qs[_0xeb03('0x33')](_0x33414d['query'][_0xeb03('0x33')]));_0x6b95dd[_0xeb03('0x30')]=_0x6b95dd[_0xeb03('0x30')][_0xeb03('0x34')]?_0x6b95dd[_0xeb03('0x30')]:_0x407f0b['model'];if(_0x33414d['query'][_0xeb03('0x3f')]){_0x6b95dd['include']=[{'all':!![]}];}_0x6b95dd=_['merge']({},_0x6b95dd,_0x33414d['options']);return db[_0xeb03('0x2b')][_0xeb03('0x46')](_0x6b95dd)[_0xeb03('0x26')](handleEntityNotFound(_0x28b831,null))[_0xeb03('0x26')](respondWithResult(_0x28b831,null))[_0xeb03('0x43')](handleError(_0x28b831,null));};exports[_0xeb03('0x47')]=function(_0x481271,_0x35279d){return db['SmsApplication']['create'](_0x481271[_0xeb03('0x48')],{})[_0xeb03('0x26')](respondWithResult(_0x35279d,0xc9))[_0xeb03('0x43')](handleError(_0x35279d,null));};exports['update']=function(_0x404191,_0x9c8073){if(_0x404191[_0xeb03('0x48')]['id']){delete _0x404191[_0xeb03('0x48')]['id'];}return db[_0xeb03('0x2b')]['find']({'where':{'id':_0x404191[_0xeb03('0x45')]['id']}})['then'](handleEntityNotFound(_0x9c8073,null))[_0xeb03('0x26')](saveUpdates(_0x404191[_0xeb03('0x48')],null))[_0xeb03('0x26')](respondWithResult(_0x9c8073,null))[_0xeb03('0x43')](handleError(_0x9c8073,null));};exports[_0xeb03('0x49')]=function(_0x46f4a7,_0x42e73f){return db[_0xeb03('0x2b')][_0xeb03('0x46')]({'where':{'id':_0x46f4a7[_0xeb03('0x45')]['id']}})[_0xeb03('0x26')](handleEntityNotFound(_0x42e73f,null))[_0xeb03('0x26')](removeEntity(_0x42e73f,null))[_0xeb03('0x43')](handleError(_0x42e73f,null));}; \ No newline at end of file +var _0x1c7c=['json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','html-pdf','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x159e5f,_0x36d147){var _0x39fd02=function(_0x28596d){while(--_0x28596d){_0x159e5f['push'](_0x159e5f['shift']());}};_0x39fd02(++_0x36d147);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4500dd,_0x273a4e){_0x4500dd=_0x4500dd-0x0;var _0x4e4da5=_0x1c7c[_0x4500dd];return _0x4e4da5;};'use strict';var pdf=require(_0xc1c7('0x0'));var emlformat=require(_0xc1c7('0x1'));var rimraf=require(_0xc1c7('0x2'));var zipdir=require(_0xc1c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c7('0x4'));var moment=require('moment');var BPromise=require(_0xc1c7('0x5'));var Mustache=require(_0xc1c7('0x6'));var util=require(_0xc1c7('0x7'));var path=require(_0xc1c7('0x8'));var sox=require(_0xc1c7('0x9'));var csv=require(_0xc1c7('0xa'));var ejs=require(_0xc1c7('0xb'));var fs=require('fs');var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0xa'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473248,_0x44bf88){_0x44bf88=_0x44bf88||0xcc;return function(_0x376cab){if(_0x376cab){return _0x473248[_0xc1c7('0x1a')](_0x44bf88);}return _0x473248[_0xc1c7('0x1b')](_0x44bf88)[_0xc1c7('0x1c')]();};}function respondWithResult(_0x40c313,_0x1b57ab){_0x1b57ab=_0x1b57ab||0xc8;return function(_0xdfc7d9){if(_0xdfc7d9){return _0x40c313[_0xc1c7('0x1b')](_0x1b57ab)[_0xc1c7('0x1d')](_0xdfc7d9);}};}function respondWithFilteredResult(_0x34d392,_0x49576d){return function(_0x3e1f0e){if(_0x3e1f0e){var _0x335600=_0x3e1f0e[_0xc1c7('0x1e')],_0x21911c=_0x49576d[_0xc1c7('0x1f')],_0x555b59=_0x49576d[_0xc1c7('0x1f')]+_0x49576d[_0xc1c7('0x20')],_0x94678a;if(_0x555b59>=_0x335600){_0x555b59=_0x335600;_0x94678a=0xc8;}else{_0x94678a=0xce;}_0x34d392[_0xc1c7('0x1b')](_0x94678a);return _0x34d392[_0xc1c7('0x21')](_0xc1c7('0x22'),_0x21911c+'-'+_0x555b59+'/'+_0x335600)['json'](_0x3e1f0e);}return null;};}function patchUpdates(_0x37d748){return function(_0x17fd22){try{jsonpatch[_0xc1c7('0x23')](_0x17fd22,_0x37d748,!![]);}catch(_0x1bc9d){return BPromise['reject'](_0x1bc9d);}return _0x17fd22[_0xc1c7('0x24')]();};}function saveUpdates(_0x4d6171,_0x5e7e4a){return function(_0x195c5f){if(_0x195c5f){return _0x195c5f['update'](_0x4d6171)['then'](function(_0x2d006f){return _0x2d006f;});}return null;};}function removeEntity(_0x17a265,_0x2f1b87){return function(_0x4c6b34){if(_0x4c6b34){return _0x4c6b34[_0xc1c7('0x25')]()[_0xc1c7('0x26')](function(){_0x17a265[_0xc1c7('0x1b')](0xcc)[_0xc1c7('0x1c')]();});}};}function handleEntityNotFound(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(!_0x3180fd){_0x2e64c4[_0xc1c7('0x1a')](0x194);}return _0x3180fd;};}function handleError(_0x22b654,_0x1540c1){_0x1540c1=_0x1540c1||0x1f4;return function(_0x29cf97){logger[_0xc1c7('0x27')](_0x29cf97[_0xc1c7('0x28')]);if(_0x29cf97[_0xc1c7('0x29')]){delete _0x29cf97[_0xc1c7('0x29')];}_0x22b654[_0xc1c7('0x1b')](_0x1540c1)['send'](_0x29cf97);};}exports[_0xc1c7('0x2a')]=function(_0x13a1f9,_0x4e1721){var _0x52a1d5={},_0x352f24={},_0x539931={'count':0x0,'rows':[]};var _0x544fbb=_[_0xc1c7('0x2b')](db[_0xc1c7('0x2c')][_0xc1c7('0x2d')],function(_0x243450){return{'name':_0x243450[_0xc1c7('0x2e')],'type':_0x243450['type']['key']};});_0x352f24[_0xc1c7('0x2f')]=_[_0xc1c7('0x2b')](_0x544fbb,_0xc1c7('0x29'));_0x352f24[_0xc1c7('0x30')]=_[_0xc1c7('0x31')](_0x13a1f9['query']);_0x352f24['filters']=_[_0xc1c7('0x32')](_0x352f24[_0xc1c7('0x2f')],_0x352f24['query']);_0x52a1d5[_0xc1c7('0x33')]=_[_0xc1c7('0x32')](_0x352f24[_0xc1c7('0x2f')],qs[_0xc1c7('0x34')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x34')]));_0x52a1d5[_0xc1c7('0x33')]=_0x52a1d5['attributes'][_0xc1c7('0x35')]?_0x52a1d5[_0xc1c7('0x33')]:_0x352f24[_0xc1c7('0x2f')];if(!_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x36')](_0xc1c7('0x37'))){_0x52a1d5[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x13a1f9[_0xc1c7('0x30')]['limit']);_0x52a1d5['offset']=qs[_0xc1c7('0x1f')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x1f')]);}_0x52a1d5[_0xc1c7('0x38')]=qs[_0xc1c7('0x39')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x39')]);_0x52a1d5[_0xc1c7('0x3a')]=qs[_0xc1c7('0x3b')](_[_0xc1c7('0x3c')](_0x13a1f9[_0xc1c7('0x30')],_0x352f24[_0xc1c7('0x3b')]),_0x544fbb);if(_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x3d')]){_0x52a1d5[_0xc1c7('0x3a')]=_[_0xc1c7('0x3e')](_0x52a1d5[_0xc1c7('0x3a')],{'$or':_[_0xc1c7('0x2b')](_0x544fbb,function(_0x2f9e9a){if(_0x2f9e9a[_0xc1c7('0x3f')]!==_0xc1c7('0x40')){var _0x49e9ac={};_0x49e9ac[_0x2f9e9a['name']]={'$like':'%'+_0x13a1f9['query'][_0xc1c7('0x3d')]+'%'};return _0x49e9ac;}})});}_0x52a1d5=_['merge']({},_0x52a1d5,_0x13a1f9['options']);var _0x17ae8e={'where':_0x52a1d5[_0xc1c7('0x3a')]};return db[_0xc1c7('0x2c')][_0xc1c7('0x1e')](_0x17ae8e)['then'](function(_0x5cd9ff){_0x539931[_0xc1c7('0x1e')]=_0x5cd9ff;if(_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x41')]){_0x52a1d5[_0xc1c7('0x42')]=[{'all':!![]}];}return db[_0xc1c7('0x2c')][_0xc1c7('0x43')](_0x52a1d5);})[_0xc1c7('0x26')](function(_0x1d4621){_0x539931[_0xc1c7('0x44')]=_0x1d4621;return _0x539931;})[_0xc1c7('0x26')](respondWithFilteredResult(_0x4e1721,_0x52a1d5))[_0xc1c7('0x45')](handleError(_0x4e1721,null));};exports[_0xc1c7('0x46')]=function(_0x5409d2,_0xbbf96d){var _0x412520={'raw':!![],'where':{'id':_0x5409d2[_0xc1c7('0x47')]['id']}},_0x508b32={};_0x508b32[_0xc1c7('0x2f')]=_[_0xc1c7('0x31')](db[_0xc1c7('0x2c')][_0xc1c7('0x2d')]);_0x508b32[_0xc1c7('0x30')]=_[_0xc1c7('0x31')](_0x5409d2[_0xc1c7('0x30')]);_0x508b32[_0xc1c7('0x3b')]=_[_0xc1c7('0x32')](_0x508b32['model'],_0x508b32[_0xc1c7('0x30')]);_0x412520[_0xc1c7('0x33')]=_['intersection'](_0x508b32['model'],qs[_0xc1c7('0x34')](_0x5409d2[_0xc1c7('0x30')][_0xc1c7('0x34')]));_0x412520[_0xc1c7('0x33')]=_0x412520[_0xc1c7('0x33')]['length']?_0x412520[_0xc1c7('0x33')]:_0x508b32[_0xc1c7('0x2f')];if(_0x5409d2['query']['includeAll']){_0x412520['include']=[{'all':!![]}];}_0x412520=_[_0xc1c7('0x3e')]({},_0x412520,_0x5409d2[_0xc1c7('0x48')]);return db[_0xc1c7('0x2c')]['find'](_0x412520)[_0xc1c7('0x26')](handleEntityNotFound(_0xbbf96d,null))[_0xc1c7('0x26')](respondWithResult(_0xbbf96d,null))['catch'](handleError(_0xbbf96d,null));};exports[_0xc1c7('0x49')]=function(_0xce8ab9,_0x32e38e){return db[_0xc1c7('0x2c')][_0xc1c7('0x49')](_0xce8ab9[_0xc1c7('0x4a')],{})[_0xc1c7('0x26')](respondWithResult(_0x32e38e,0xc9))[_0xc1c7('0x45')](handleError(_0x32e38e,null));};exports[_0xc1c7('0x4b')]=function(_0x3ec5de,_0xa49f73){if(_0x3ec5de[_0xc1c7('0x4a')]['id']){delete _0x3ec5de[_0xc1c7('0x4a')]['id'];}return db[_0xc1c7('0x2c')][_0xc1c7('0x4c')]({'where':{'id':_0x3ec5de[_0xc1c7('0x47')]['id']}})[_0xc1c7('0x26')](handleEntityNotFound(_0xa49f73,null))[_0xc1c7('0x26')](saveUpdates(_0x3ec5de['body'],null))[_0xc1c7('0x26')](respondWithResult(_0xa49f73,null))['catch'](handleError(_0xa49f73,null));};exports[_0xc1c7('0x25')]=function(_0x23f42f,_0x2840a3){return db['SmsApplication'][_0xc1c7('0x4c')]({'where':{'id':_0x23f42f[_0xc1c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2840a3,null))['then'](removeEntity(_0x2840a3,null))['catch'](handleError(_0x2840a3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 4a97f0e..76bc6da 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 _0x61b3=['request-promise','path','rimraf','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x29d118,_0x3fafef){var _0x5627b8=function(_0x4a6e8e){while(--_0x4a6e8e){_0x29d118['push'](_0x29d118['shift']());}};_0x5627b8(++_0x3fafef);}(_0x61b3,0xb1));var _0x361b=function(_0x768e3c,_0x1783fb){_0x768e3c=_0x768e3c-0x0;var _0x24fd61=_0x61b3[_0x768e3c];return _0x24fd61;};'use strict';var _=require('lodash');var util=require(_0x361b('0x0'));var logger=require(_0x361b('0x1'))(_0x361b('0x2'));var moment=require(_0x361b('0x3'));var BPromise=require(_0x361b('0x4'));var rp=require(_0x361b('0x5'));var fs=require('fs');var path=require(_0x361b('0x6'));var rimraf=require(_0x361b('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module['exports']=function(_0x1acd0b,_0x522acf){return _0x1acd0b[_0x361b('0x8')](_0x361b('0x9'),attributes,{'tableName':_0x361b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x361b('0xb'),'collate':_0x361b('0xc')});}; \ No newline at end of file +var _0x8976=['sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SmsApplication'];(function(_0x45e0e8,_0x322ed8){var _0xbded42=function(_0x9fc910){while(--_0x9fc910){_0x45e0e8['push'](_0x45e0e8['shift']());}};_0xbded42(++_0x322ed8);}(_0x8976,0x1a7));var _0x6897=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8976[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6897('0x0'));var logger=require(_0x6897('0x1'))(_0x6897('0x2'));var moment=require(_0x6897('0x3'));var BPromise=require(_0x6897('0x4'));var rp=require(_0x6897('0x5'));var fs=require('fs');var path=require(_0x6897('0x6'));var rimraf=require(_0x6897('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x6897('0x8')]=function(_0x18c247,_0x2a6929){return _0x18c247[_0x6897('0x9')](_0x6897('0xa'),attributes,{'tableName':_0x6897('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6897('0xc'),'collate':_0x6897('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e16bc94..f70d364 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 _0x7722=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x37b7a2,_0x163a9b){var _0x4cc76a=function(_0x51fd0d){while(--_0x51fd0d){_0x37b7a2['push'](_0x37b7a2['shift']());}};_0x4cc76a(++_0x163a9b);}(_0x7722,0x14e));var _0x2772=function(_0x5e2299,_0x3bf63d){_0x5e2299=_0x5e2299-0x0;var _0x3ff816=_0x7722[_0x5e2299];return _0x3ff816;};'use strict';var _=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var moment=require(_0x2772('0x2'));var BPromise=require(_0x2772('0x3'));var rs=require(_0x2772('0x4'));var fs=require('fs');var Redis=require(_0x2772('0x5'));var db=require(_0x2772('0x6'))['db'];var utils=require(_0x2772('0x7'));var logger=require(_0x2772('0x8'))('rpc');var config=require(_0x2772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2772('0xa')][_0x2772('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e6c6e,_0xabc5bb,_0x21b452){return new BPromise(function(_0x53f017,_0x408df9){return client[_0x2772('0xc')](_0x3e6c6e,_0x21b452)[_0x2772('0xd')](function(_0x131220){logger[_0x2772('0xe')](_0x2772('0xf'),_0xabc5bb,_0x2772('0x10'));logger[_0x2772('0x11')](_0x2772('0x12'),_0xabc5bb,_0x2772('0x10'),JSON['stringify'](_0x131220));if(_0x131220[_0x2772('0x13')]){if(_0x131220[_0x2772('0x13')][_0x2772('0x14')]===0x1f4){logger['error'](_0x2772('0xf'),_0xabc5bb,_0x131220[_0x2772('0x13')][_0x2772('0x15')]);return _0x408df9(_0x131220[_0x2772('0x13')][_0x2772('0x15')]);}logger['error'](_0x2772('0xf'),_0xabc5bb,_0x131220[_0x2772('0x13')][_0x2772('0x15')]);return _0x53f017(_0x131220[_0x2772('0x13')]['message']);}else{logger[_0x2772('0xe')]('SmsApplication,\x20%s,\x20%s',_0xabc5bb,_0x2772('0x10'));_0x53f017(_0x131220[_0x2772('0x16')][_0x2772('0x15')]);}})[_0x2772('0x17')](function(_0x3c5f5a){logger[_0x2772('0x13')](_0x2772('0xf'),_0xabc5bb,_0x3c5f5a);_0x408df9(_0x3c5f5a);});});} \ No newline at end of file +var _0x7b83=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsApplication,\x20%s,\x20%s','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x7b83,0xa1));var _0x37b8=function(_0x1a8b58,_0x2c6665){_0x1a8b58=_0x1a8b58-0x0;var _0x3fa938=_0x7b83[_0x1a8b58];return _0x3fa938;};'use strict';var _=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var moment=require(_0x37b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37b8('0x3'));var db=require(_0x37b8('0x4'))['db'];var utils=require(_0x37b8('0x5'));var logger=require('../../config/logger')(_0x37b8('0x6'));var config=require(_0x37b8('0x7'));var jayson=require(_0x37b8('0x8'));var client=jayson[_0x37b8('0x9')][_0x37b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x220cd2,_0x5eb540,_0x45e094){return new BPromise(function(_0xc3ab5b,_0x50f729){return client[_0x37b8('0xb')](_0x220cd2,_0x45e094)['then'](function(_0x548dfd){logger['info']('SmsApplication,\x20%s,\x20%s',_0x5eb540,_0x37b8('0xc'));logger[_0x37b8('0xd')](_0x37b8('0xe'),_0x5eb540,_0x37b8('0xc'),JSON[_0x37b8('0xf')](_0x548dfd));if(_0x548dfd['error']){if(_0x548dfd[_0x37b8('0x10')]['code']===0x1f4){logger[_0x37b8('0x10')]('SmsApplication,\x20%s,\x20%s',_0x5eb540,_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);return _0x50f729(_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);}logger[_0x37b8('0x10')]('SmsApplication,\x20%s,\x20%s',_0x5eb540,_0x548dfd['error'][_0x37b8('0x11')]);return _0xc3ab5b(_0x548dfd[_0x37b8('0x10')][_0x37b8('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x5eb540,_0x37b8('0xc'));_0xc3ab5b(_0x548dfd[_0x37b8('0x12')][_0x37b8('0x11')]);}})[_0x37b8('0x13')](function(_0x290068){logger[_0x37b8('0x10')](_0x37b8('0x14'),_0x5eb540,_0x290068);_0x50f729(_0x290068);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6750994..0bba395 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 _0x71a1=['smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','getMessages','/:id/download','download','post','addMessage','tracked','sms'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x71a1,0x1eb));var _0x171a=function(_0x3b1a85,_0x73c2b6){_0x3b1a85=_0x3b1a85-0x0;var _0x53757f=_0x71a1[_0x3b1a85];return _0x53757f;};'use strict';var multer=require(_0x171a('0x0'));var util=require(_0x171a('0x1'));var path=require(_0x171a('0x2'));var timeout=require(_0x171a('0x3'));var express=require(_0x171a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x171a('0x5'));var config=require(_0x171a('0x6'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x171a('0x7')](),controller[_0x171a('0x8')]);router['get'](_0x171a('0x9'),auth[_0x171a('0x7')](),controller[_0x171a('0xa')]);router[_0x171a('0xb')](_0x171a('0xc'),auth[_0x171a('0x7')](),controller[_0x171a('0xd')]);router[_0x171a('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0x171a('0xe')]);router[_0x171a('0xb')](_0x171a('0xf'),auth[_0x171a('0x7')](),controller[_0x171a('0x10')]);router[_0x171a('0x11')]('/',auth[_0x171a('0x7')](),controller['create']);router[_0x171a('0x11')]('/:id/messages',auth[_0x171a('0x7')](),controller[_0x171a('0x12')]);router['post']('/:id/tags',auth[_0x171a('0x7')](),interaction[_0x171a('0x13')](_0x171a('0x14'),_0x171a('0x15')),controller[_0x171a('0x16')]);router[_0x171a('0x17')](_0x171a('0xc'),auth[_0x171a('0x7')](),interaction[_0x171a('0x13')](_0x171a('0x14'),_0x171a('0x18')),controller[_0x171a('0x19')]);router[_0x171a('0x1a')](_0x171a('0xc'),auth[_0x171a('0x7')](),interaction[_0x171a('0x13')](_0x171a('0x14'),_0x171a('0x1b')),controller[_0x171a('0x1c')]);router[_0x171a('0x1a')](_0x171a('0x1d'),auth['isAuthenticated'](),controller[_0x171a('0x1e')]);module[_0x171a('0x1f')]=router; \ No newline at end of file +var _0xc0a6=['show','/:id/messages','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x1f966e,_0x4b489c){var _0xe4c6c2=function(_0xb06c3c){while(--_0xb06c3c){_0x1f966e['push'](_0x1f966e['shift']());}};_0xe4c6c2(++_0x4b489c);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x495903,_0x408038){_0x495903=_0x495903-0x0;var _0x5938bc=_0xc0a6[_0x495903];return _0x5938bc;};'use strict';var multer=require(_0x6c0a('0x0'));var util=require(_0x6c0a('0x1'));var path=require('path');var timeout=require(_0x6c0a('0x2'));var express=require(_0x6c0a('0x3'));var router=express[_0x6c0a('0x4')]();var auth=require(_0x6c0a('0x5'));var interaction=require(_0x6c0a('0x6'));var config=require(_0x6c0a('0x7'));var controller=require(_0x6c0a('0x8'));router[_0x6c0a('0x9')]('/',auth['isAuthenticated'](),controller[_0x6c0a('0xa')]);router[_0x6c0a('0x9')](_0x6c0a('0xb'),auth[_0x6c0a('0xc')](),controller['describe']);router[_0x6c0a('0x9')](_0x6c0a('0xd'),auth['isAuthenticated'](),controller[_0x6c0a('0xe')]);router['get'](_0x6c0a('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x6c0a('0xc')](),controller['download']);router[_0x6c0a('0x10')]('/',auth[_0x6c0a('0xc')](),controller[_0x6c0a('0x11')]);router['post'](_0x6c0a('0xf'),auth[_0x6c0a('0xc')](),controller[_0x6c0a('0x12')]);router[_0x6c0a('0x10')](_0x6c0a('0x13'),auth[_0x6c0a('0xc')](),interaction['tracked'](_0x6c0a('0x14'),_0x6c0a('0x15')),controller[_0x6c0a('0x16')]);router[_0x6c0a('0x17')](_0x6c0a('0xd'),auth[_0x6c0a('0xc')](),interaction[_0x6c0a('0x18')](_0x6c0a('0x14'),_0x6c0a('0x19')),controller[_0x6c0a('0x1a')]);router[_0x6c0a('0x1b')](_0x6c0a('0xd'),auth['isAuthenticated'](),interaction[_0x6c0a('0x18')](_0x6c0a('0x14'),_0x6c0a('0x1c')),controller[_0x6c0a('0x1d')]);router[_0x6c0a('0x1b')](_0x6c0a('0x13'),auth[_0x6c0a('0xc')](),controller[_0x6c0a('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8477bf4..97fcae8 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 _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x39628c,_0x2eb8c4){var _0x2b0532=function(_0x87cc3b){while(--_0x87cc3b){_0x39628c['push'](_0x39628c['shift']());}};_0x2b0532(++_0x2eb8c4);}(_0x757a,0xde));var _0xa757=function(_0x4f7637,_0x55b3d1){_0x4f7637=_0x4f7637-0x0;var _0x1dbf8e=_0x757a[_0x4f7637];return _0x1dbf8e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x7b534f,_0x8e91bc){var _0x2fae25=function(_0x85442b){while(--_0x85442b){_0x7b534f['push'](_0x7b534f['shift']());}};_0x2fae25(++_0x8e91bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 10852fc..0fb7de0 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 _0xf72b=['toFile','transcript-','.pdf','err','unlinkSync','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','hasOwnProperty','order','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','start','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','a.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','rows','catch','show','includeAll','create','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','spread','emit','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Sms','Owner','N.A.','closed','closedAt','disposition','out','System','Contact','renderFile','downloadInteraction.html'];(function(_0x34a284,_0x207084){var _0x2ec13b=function(_0x197011){while(--_0x197011){_0x34a284['push'](_0x34a284['shift']());}};_0x2ec13b(++_0x207084);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3ff937,_0x3f6a9e){_0x3ff937=_0x3ff937-0x0;var _0x106dc2=_0xf72b[_0x3ff937];return _0x106dc2;};'use strict';var pdf=require(_0xbf72('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf72('0x2'));var rp=require(_0xbf72('0x3'));var moment=require('moment');var BPromise=require(_0xbf72('0x4'));var Mustache=require(_0xbf72('0x5'));var util=require(_0xbf72('0x6'));var path=require(_0xbf72('0x7'));var sox=require(_0xbf72('0x8'));var csv=require(_0xbf72('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbf72('0xa'));var squel=require(_0xbf72('0xb'));var crypto=require(_0xbf72('0xc'));var jsforce=require(_0xbf72('0xd'));var deskjs=require(_0xbf72('0xe'));var toCsv=require(_0xbf72('0x9'));var querystring=require('querystring');var Papa=require(_0xbf72('0xf'));var Redis=require('ioredis');var authService=require(_0xbf72('0x10'));var qs=require(_0xbf72('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf72('0x12'));var logger=require(_0xbf72('0x13'))(_0xbf72('0x14'));var utils=require(_0xbf72('0x15'));var config=require(_0xbf72('0x16'));var db=require(_0xbf72('0x17'))['db'];config[_0xbf72('0x18')]=_[_0xbf72('0x19')](config['redis'],{'host':_0xbf72('0x1a'),'port':0x18eb});var socket=require(_0xbf72('0x1b'))(new Redis(config[_0xbf72('0x18')]));require('./smsInteraction.socket')[_0xbf72('0x1c')](socket);function respondWithStatusCode(_0x4f4fa5,_0x5625b3){_0x5625b3=_0x5625b3||0xcc;return function(_0x4a79df){if(_0x4a79df){return _0x4f4fa5[_0xbf72('0x1d')](_0x5625b3);}return _0x4f4fa5[_0xbf72('0x1e')](_0x5625b3)[_0xbf72('0x1f')]();};}function respondWithResult(_0x723eb1,_0x39d0cd){_0x39d0cd=_0x39d0cd||0xc8;return function(_0x160d61){if(_0x160d61){return _0x723eb1['status'](_0x39d0cd)[_0xbf72('0x20')](_0x160d61);}};}function respondWithFilteredResult(_0xeb7183,_0x2a8609){return function(_0x3d4dea){if(_0x3d4dea){var _0x27dadc=_0x3d4dea[_0xbf72('0x21')],_0x5b5fc9=_0x2a8609[_0xbf72('0x22')],_0x51d4c9=_0x2a8609[_0xbf72('0x22')]+_0x2a8609[_0xbf72('0x23')],_0x1b8d73;if(_0x51d4c9>=_0x27dadc){_0x51d4c9=_0x27dadc;_0x1b8d73=0xc8;}else{_0x1b8d73=0xce;}_0xeb7183[_0xbf72('0x1e')](_0x1b8d73);return _0xeb7183[_0xbf72('0x24')]('Content-Range',_0x5b5fc9+'-'+_0x51d4c9+'/'+_0x27dadc)[_0xbf72('0x20')](_0x3d4dea);}return null;};}function patchUpdates(_0x42a193){return function(_0xcd9c0b){try{jsonpatch[_0xbf72('0x25')](_0xcd9c0b,_0x42a193,!![]);}catch(_0x3486f3){return BPromise['reject'](_0x3486f3);}return _0xcd9c0b[_0xbf72('0x26')]();};}function saveUpdates(_0x1de926,_0x536071){return function(_0x35c40f){if(_0x35c40f){return _0x35c40f[_0xbf72('0x27')](_0x1de926)[_0xbf72('0x28')](function(_0x4c7f3d){return _0x4c7f3d;});}return null;};}function removeEntity(_0x44f3f9,_0x428361){return function(_0x44d456){if(_0x44d456){return _0x44d456[_0xbf72('0x29')]()['then'](function(){_0x44f3f9[_0xbf72('0x1e')](0xcc)[_0xbf72('0x1f')]();});}};}function handleEntityNotFound(_0x1c8b8b,_0x54fdfe){return function(_0x3b3171){if(!_0x3b3171){_0x1c8b8b[_0xbf72('0x1d')](0x194);}return _0x3b3171;};}function handleError(_0x3df816,_0x1a2f55){_0x1a2f55=_0x1a2f55||0x1f4;return function(_0x15d60d){logger[_0xbf72('0x2a')](_0x15d60d[_0xbf72('0x2b')]);if(_0x15d60d[_0xbf72('0x2c')]){delete _0x15d60d[_0xbf72('0x2c')];}_0x3df816[_0xbf72('0x1e')](_0x1a2f55)[_0xbf72('0x2d')](_0x15d60d);};}function getInteractionUsers(_0x20e747,_0x4a6ccf){return new BPromise(function(_0xb648f2,_0x37a233){try{if(_0x4a6ccf[_0x20e747['id']]){_0x20e747['Users']=_[_0xbf72('0x2e')](_0x4a6ccf[_0x20e747['id']],function(_0x475a54){return{'id':_0x475a54['id'],'fullname':_0x475a54[_0xbf72('0x2f')]};});}}catch(_0x28850d){_0x37a233(_0x28850d);}_0xb648f2(_0x20e747);});}function getInteractionTags(_0xb1ee4e,_0x82c0f0){return new BPromise(function(_0x35ecdc,_0x209b2b){try{if(_0xb1ee4e[_0xbf72('0x30')]){_0xb1ee4e[_0xbf72('0x31')]=[];_0xb1ee4e[_0xbf72('0x30')][_0xbf72('0x32')](',')[_0xbf72('0x33')](function(_0x3ad363){_0xb1ee4e['Tags'][_0xbf72('0x34')](_0x82c0f0[_0x3ad363]);});}delete _0xb1ee4e[_0xbf72('0x30')];}catch(_0x3f47e6){_0x209b2b(_0x3f47e6);}_0x35ecdc(_0xb1ee4e);});}function updateSmsInteraction(_0x479cfe,_0x586537,_0x5c8bb4){return new BPromise(function(_0x2755c3,_0x80d176){return getInteractionUsers(_0x479cfe,_0x5c8bb4)[_0xbf72('0x28')](function(_0x52d979){return getInteractionTags(_0x52d979,_0x586537);})[_0xbf72('0x28')](function(_0x4c9662){_0x2755c3(_0x4c9662);})['catch'](function(_0x1158d3){_0x80d176(_0x1158d3);});});}exports['index']=function(_0x13ab4f,_0x202497){var _0x5c2f60={},_0x4aac2f={},_0x424669={'count':0x0,'rows':[]};var _0xc5edc4=_[_0xbf72('0x2e')](db[_0xbf72('0x35')][_0xbf72('0x36')],function(_0x26c91c){return{'name':_0x26c91c[_0xbf72('0x37')],'type':_0x26c91c[_0xbf72('0x38')][_0xbf72('0x39')]};});_0x4aac2f['model']=_[_0xbf72('0x2e')](_0xc5edc4,_0xbf72('0x2c'));_0x4aac2f[_0xbf72('0x3a')]=_[_0xbf72('0x3b')](_0x13ab4f['query']);_0x4aac2f[_0xbf72('0x3c')]=_[_0xbf72('0x3d')](_0x4aac2f['model'],_0x4aac2f[_0xbf72('0x3a')]);_0x5c2f60['attributes']=_['intersection'](_0x4aac2f['model'],qs['fields'](_0x13ab4f[_0xbf72('0x3a')]['fields']));_0x5c2f60['attributes']=_0x5c2f60[_0xbf72('0x3e')]['length']?_0x5c2f60[_0xbf72('0x3e')]:_0x4aac2f[_0xbf72('0x3f')];if(!_0x13ab4f['query'][_0xbf72('0x40')]('nolimit')){_0x5c2f60['limit']=qs[_0xbf72('0x23')](_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x23')]);_0x5c2f60[_0xbf72('0x22')]=qs[_0xbf72('0x22')](_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x22')]);}_0x5c2f60[_0xbf72('0x41')]=qs['sort'](_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x42')]);_0x5c2f60['where']=qs[_0xbf72('0x3c')](_['pick'](_0x13ab4f['query'],_0x4aac2f[_0xbf72('0x3c')]),_0xc5edc4);var _0x15e4c7=[];var _0x3992fd=squel[_0xbf72('0x43')]()[_0xbf72('0x44')]('id')['field']('name')['field'](_0xbf72('0x45'))[_0xbf72('0x46')](_0xbf72('0x47'));var _0x2a679a=squel['select']()['field'](_0xbf72('0x48'))['field'](_0xbf72('0x49'))[_0xbf72('0x44')](_0xbf72('0x4a'))[_0xbf72('0x46')]('user_has_sms_interactions','ui')[_0xbf72('0x4b')](_0xbf72('0x4c'),'u',_0xbf72('0x4d'));var _0x1da27a=squel['select']()[_0xbf72('0x46')](_0xbf72('0x4e'),'i')['left_join'](_0xbf72('0x4f'),'c',_0xbf72('0x50'))[_0xbf72('0x4b')](_0xbf72('0x4c'),'o',_0xbf72('0x51'))[_0xbf72('0x4b')](_0xbf72('0x52'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me',_0xbf72('0x53'))['left_join'](_0xbf72('0x54'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xbf72('0x55'));var _0x15a271=squel[_0xbf72('0x56')]();var _0x3304b1=[];var _0x3d36de=squel[_0xbf72('0x56')]();var _0x530663;if(_0x13ab4f[_0xbf72('0x3a')]['search']){_0x530663=as[_0xbf72('0x57')](_0x13ab4f['query'][_0xbf72('0x58')]);var _0x199473=_0x530663[_0xbf72('0x59')];for(var _0x1fd1f8=0x0;_0x1fd1f8<_0x530663[_0xbf72('0x5a')][_0xbf72('0x5b')];_0x1fd1f8++){var _0x578b07=_0x530663[_0xbf72('0x5a')][_0x1fd1f8];var _0x3f6b6f='i';var _0x5c54fe=_[_0xbf72('0x5c')](_0xc5edc4,[_0xbf72('0x2c'),_0x578b07[_0xbf72('0x44')]]);if(!_0x5c54fe){switch(_0x578b07['field']){case _0xbf72('0x5d'):if(_0x578b07[_0xbf72('0x5e')]==0x1){_0x1da27a[_0xbf72('0x5f')]('`'+_0x578b07[_0xbf72('0x44')]+_0xbf72('0x60'));}else{_0x1da27a['having']('`'+_0x578b07[_0xbf72('0x44')]+_0xbf72('0x61'));}break;case'Contact':if(_0x578b07[_0xbf72('0x62')]==='$substring'){if(_0x578b07['value'][_0xbf72('0x32')]('\x20')[_0xbf72('0x5b')]>0x1){_0x15a271[_0x199473](_0xbf72('0x63'),qs[_0xbf72('0x64')](_0x578b07[_0xbf72('0x5e')]),null);}else{var _0x527061='%'+_0x578b07['value']+'%';_0x15a271[_0x199473]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x527061,_0x527061,_0x527061);}}else{_0x5c54fe=_[_0xbf72('0x5c')](_0xc5edc4,[_0xbf72('0x2c'),_0xbf72('0x65')]);_0x578b07[_0xbf72('0x44')]='ContactId';_0x537398=as['buildExpression'](_0x3f6b6f,_0x5c54fe[_0xbf72('0x38')],_0x578b07);_0x15a271[_0x199473](_0x537398[_0xbf72('0x66')],_0x537398[_0xbf72('0x5e')]['start'],_0x537398[_0xbf72('0x5e')]['end']);}break;case _0xbf72('0x67'):var _0x3da80c=_0x578b07['value'][_0xbf72('0x32')](',')[_0xbf72('0x2e')](function(_0x55ac06){return Number(_0x55ac06);});_0x3da80c[_0xbf72('0x33')](function(_0x46f908){_0x3d36de['or'](_0xbf72('0x68'),'%,'+_0x46f908+',%');});_0x3304b1=_['union'](_0x3304b1,_0x3da80c);break;case'User':if(_0x578b07['operator']===_0xbf72('0x69')){_0x15a271[_0x199473](_0xbf72('0x6a'),'%'+_0x578b07[_0xbf72('0x5e')]+'%',null);}else{_0x5c54fe=_[_0xbf72('0x5c')](_0xc5edc4,[_0xbf72('0x2c'),_0xbf72('0x6b')]);_0x578b07[_0xbf72('0x44')]=_0xbf72('0x6b');_0x537398=as[_0xbf72('0x6c')](_0x3f6b6f,_0x5c54fe['type'],_0x578b07);_0x15a271[_0x199473](_0x537398[_0xbf72('0x66')],_0x537398[_0xbf72('0x5e')]['start'],_0x537398[_0xbf72('0x5e')][_0xbf72('0x1f')]);}break;case _0xbf72('0x6d'):_0x537398=as[_0xbf72('0x6c')]('me',null,_0x578b07);_0x15a271[_0x199473](_0x537398[_0xbf72('0x66')],_0x537398[_0xbf72('0x5e')][_0xbf72('0x6e')],_0x537398[_0xbf72('0x5e')][_0xbf72('0x1f')]);break;}}else{var _0x537398=as['buildExpression'](_0x3f6b6f,_0x5c54fe[_0xbf72('0x38')],_0x578b07);_0x15a271[_0x199473](_0x537398[_0xbf72('0x66')],_0x537398[_0xbf72('0x5e')][_0xbf72('0x6e')],_0x537398[_0xbf72('0x5e')][_0xbf72('0x1f')]);}}}else{var _0x3f2c1f=_(_0x13ab4f[_0xbf72('0x3a')])['keys']()[_0xbf72('0x2e')](function(_0x2cb706){return _[_0xbf72('0x6f')](_0xc5edc4,[_0xbf72('0x2c'),_0x2cb706])?_0x2cb706:undefined;})[_0xbf72('0x70')]()[_0xbf72('0x5e')]();if(!_[_0xbf72('0x71')](_0x3f2c1f)){_0x3f2c1f['forEach'](function(_0x428902){if(_0x428902===_0xbf72('0x72')){_0x1da27a[_0xbf72('0x73')](_0xbf72('0x74'),[][_0xbf72('0x75')](_0x13ab4f[_0xbf72('0x3a')][_0x428902]));}else if(_0x428902===_0xbf72('0x76')){var _0x25b7ea=JSON['parse'](_0x13ab4f[_0xbf72('0x3a')][_0x428902])[_0xbf72('0x77')];var _0x17ab12=JSON['parse'](_0x13ab4f[_0xbf72('0x3a')][_0x428902])[_0xbf72('0x78')];_0x1da27a['where'](_0xbf72('0x79'),_0x25b7ea,_0x17ab12);}else{if(_0x13ab4f[_0xbf72('0x3a')][_0x428902]==='null'){_0x1da27a[_0xbf72('0x73')]('i.'+_0x428902+_0xbf72('0x7a'));}else{_0x1da27a['where']('i.'+_0x428902+_0xbf72('0x7b'),_0x13ab4f[_0xbf72('0x3a')][_0x428902]);}}});}if(_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x7c')]){if(_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x7c')]==0x1){_0x1da27a[_0xbf72('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x1da27a[_0xbf72('0x5f')](_0xbf72('0x7d'));}}if(_0x13ab4f['query'][_0xbf72('0x7e')]){_0x3304b1=_['isArray'](_0x13ab4f['query'][_0xbf72('0x7e')])?_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x7e')]:new Array(_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x7e')]);_0x3304b1[_0xbf72('0x33')](function(_0x50f70c){_0x3d36de['or'](_0xbf72('0x68'),'%,'+_0x50f70c+',%');});}if(_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x7f')]){var _0x33257f=_0x13ab4f['query'][_0xbf72('0x7f')][_0xbf72('0x80')]('\x5c','\x5c\x5c')[_0xbf72('0x80')]('\x27\x27',_0xbf72('0x81'));if(qs['isNumeric'](_0x33257f)){_0x15a271['or'](_0xbf72('0x82'),_0x33257f+'%')['or']('i.phone\x20LIKE\x20?',_0x33257f+'%');}else{_0x15a271['or'](_0xbf72('0x83'),qs[_0xbf72('0x64')](_0x33257f))['or'](_0xbf72('0x84'),_0x33257f+'%');}}}_0x1da27a['where'](_0x15a271);_0x1da27a[_0xbf72('0x85')](_0xbf72('0x86'));var _0x289dcc={'type':db[_0xbf72('0x87')][_0xbf72('0x88')][_0xbf72('0x89')],'raw':!![]};var _0x36a3dc=_0x1da27a[_0xbf72('0x8a')]();_0x36a3dc[_0xbf72('0x44')](_0xbf72('0x86'));_0x36a3dc[_0xbf72('0x44')](_0xbf72('0x8b'),'unreadMessages');if(_0x5c2f60[_0xbf72('0x41')]){_0x5c2f60[_0xbf72('0x41')][_0xbf72('0x33')](function(_0x594b73){_0x1da27a[_0xbf72('0x41')]('i.'+_0x594b73[0x0],_0x594b73[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbf72('0x71')](_0x3304b1)){_0x1da27a[_0xbf72('0x5f')](_0x3d36de);_0x36a3dc[_0xbf72('0x73')](_0xbf72('0x8c'),_0x3304b1);}BPromise[_0xbf72('0x8d')]()[_0xbf72('0x28')](function(){if(!_0x530663){if(_0x13ab4f['query'][_0xbf72('0x72')]||_0x13ab4f['query'][_0xbf72('0x8e')])return;_0x36a3dc['where'](_0xbf72('0x8f'));_0x1da27a[_0xbf72('0x73')](_0xbf72('0x8f'));return;}return _0x13ab4f[_0xbf72('0x90')][_0xbf72('0x91')]({'attributes':['id'],'raw':!![]})[_0xbf72('0x28')](function(_0x3ba2f9){if(_[_0xbf72('0x71')](_0x3ba2f9)){_0x36a3dc[_0xbf72('0x73')](_0xbf72('0x92'));_0x1da27a[_0xbf72('0x73')](_0xbf72('0x92'));}else{_0x36a3dc[_0xbf72('0x73')](_0xbf72('0x74'),_[_0xbf72('0x2e')](_0x3ba2f9,'id'));_0x1da27a['where']('i.SmsAccountId\x20IN\x20?',_[_0xbf72('0x2e')](_0x3ba2f9,'id'));}});})['then'](function(){db[_0xbf72('0x93')][_0xbf72('0x3a')](_0x36a3dc['toString'](),_0x289dcc)[_0xbf72('0x28')](function(_0xffecec){_0x424669[_0xbf72('0x21')]=_0xffecec['length'];if(_0x424669[_0xbf72('0x21')]===0x0)return[];return db['sequelize'][_0xbf72('0x3a')](_0x3992fd[_0xbf72('0x94')](),_0x289dcc)['then'](function(_0x2e0923){_0x15e4c7=_[_0xbf72('0x95')](_0x2e0923,'id');_0x289dcc=_[_0xbf72('0x96')](_0x289dcc,{'model':db[_0xbf72('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13ab4f[_0xbf72('0x3a')][_0xbf72('0x97')]){_0x5c2f60[_0xbf72('0x3e')][_0xbf72('0x33')](function(_0x55b183){_0x1da27a['field']('i.'+_0x55b183);});}else{_0x1da27a[_0xbf72('0x44')](_0xbf72('0x8b'),_0xbf72('0x5d'));_0x1da27a['field'](_0xbf72('0x98'),'Account.key');_0x1da27a[_0xbf72('0x44')]('a.mandatoryDisposition',_0xbf72('0x99'));_0x1da27a[_0xbf72('0x44')](_0xbf72('0x9a'));_0x1da27a['field'](_0xbf72('0x9b'),_0xbf72('0x9c'));_0x1da27a['field'](_0xbf72('0x9d'),'Contact.lastName');_0x1da27a[_0xbf72('0x44')](_0xbf72('0x9e'),_0xbf72('0x9f'));_0x1da27a[_0xbf72('0x44')](_0xbf72('0xa0'),_0xbf72('0xa1'));_0x1da27a['field'](_0xbf72('0xa2'),_0xbf72('0xa3'));_0x1da27a[_0xbf72('0x44')]('c.fax',_0xbf72('0xa4'));_0x1da27a[_0xbf72('0x44')]('o.fullname','Owner.fullname');_0x1da27a['field'](_0xbf72('0xa5'),_0xbf72('0xa6'));_0x1da27a[_0xbf72('0x44')](_0xbf72('0xa7'),'TagIds');}if(_0x5c2f60[_0xbf72('0x23')])_0x1da27a['limit'](_0x5c2f60[_0xbf72('0x23')]);if(_0x5c2f60[_0xbf72('0x22')])_0x1da27a[_0xbf72('0x22')](_0x5c2f60['offset']);return db[_0xbf72('0x93')]['query'](_0x1da27a[_0xbf72('0x94')](),_0x289dcc);})[_0xbf72('0x28')](function(_0x2b7772){_0x2a679a['where'](_0xbf72('0xa8'),_['map'](_0x2b7772,'id'));return db['sequelize'][_0xbf72('0x3a')](_0x2a679a[_0xbf72('0x94')](),_0x289dcc)['then'](function(_0x5a2710){var _0x45e0b6=_['groupBy'](_0x5a2710,'SmsInteractionId');var _0x2fa244=[];_0x2b7772[_0xbf72('0x33')](function(_0x2d390d){_0x2fa244['push'](updateSmsInteraction(_0x2d390d,_0x15e4c7,_0x45e0b6));});return BPromise[_0xbf72('0xa9')](_0x2fa244);});});})[_0xbf72('0x28')](function(_0x4ffdc5){_0x424669[_0xbf72('0xaa')]=_0x4ffdc5;return _0x424669;})['then'](respondWithFilteredResult(_0x202497,_0x5c2f60));})[_0xbf72('0xab')](handleError(_0x202497,null));};exports[_0xbf72('0xac')]=function(_0x5bc71f,_0xcdfdca){var _0x126df6={'raw':![],'where':{'id':_0x5bc71f['params']['id']}},_0x1294c3={};_0x1294c3[_0xbf72('0x3f')]=_[_0xbf72('0x3b')](db[_0xbf72('0x35')][_0xbf72('0x36')]);_0x1294c3['query']=_[_0xbf72('0x3b')](_0x5bc71f[_0xbf72('0x3a')]);_0x1294c3[_0xbf72('0x3c')]=_[_0xbf72('0x3d')](_0x1294c3[_0xbf72('0x3f')],_0x1294c3[_0xbf72('0x3a')]);_0x126df6[_0xbf72('0x3e')]=_['intersection'](_0x1294c3[_0xbf72('0x3f')],qs['fields'](_0x5bc71f[_0xbf72('0x3a')][_0xbf72('0x97')]));_0x126df6['attributes']=_0x126df6[_0xbf72('0x3e')][_0xbf72('0x5b')]?_0x126df6[_0xbf72('0x3e')]:_0x1294c3['model'];if(_0x5bc71f[_0xbf72('0x3a')][_0xbf72('0xad')]){_0x126df6['include']=[{'all':!![]}];}_0x126df6=_[_0xbf72('0x96')]({},_0x126df6,_0x5bc71f['options']);return db[_0xbf72('0x35')]['find'](_0x126df6)[_0xbf72('0x28')](handleEntityNotFound(_0xcdfdca,null))[_0xbf72('0x28')](respondWithResult(_0xcdfdca,null))[_0xbf72('0xab')](handleError(_0xcdfdca,null));};exports[_0xbf72('0xae')]=function(_0x17318e,_0x197fc7){return db[_0xbf72('0x35')][_0xbf72('0xae')](_0x17318e[_0xbf72('0x6d')],{})[_0xbf72('0x28')](respondWithResult(_0x197fc7,0xc9))[_0xbf72('0xab')](handleError(_0x197fc7,null));};exports[_0xbf72('0x27')]=function(_0x3d21dc,_0x2f6ffe){if(_0x3d21dc[_0xbf72('0x6d')]['id']){delete _0x3d21dc[_0xbf72('0x6d')]['id'];}return db[_0xbf72('0x35')]['find']({'where':{'id':_0x3d21dc['params']['id']}})[_0xbf72('0x28')](handleEntityNotFound(_0x2f6ffe,null))[_0xbf72('0x28')](saveUpdates(_0x3d21dc['body'],null))[_0xbf72('0x28')](respondWithResult(_0x2f6ffe,null))[_0xbf72('0xab')](handleError(_0x2f6ffe,null));};exports['destroy']=function(_0x2b3de2,_0x59a0c1){return db['SmsInteraction']['find']({'where':{'id':_0x2b3de2[_0xbf72('0xaf')]['id']}})['then'](handleEntityNotFound(_0x59a0c1,null))['then'](removeEntity(_0x59a0c1,null))[_0xbf72('0xab')](handleError(_0x59a0c1,null));};exports[_0xbf72('0xb0')]=function(_0x3dc0a4,_0x35517f){return db[_0xbf72('0x35')][_0xbf72('0xb0')]()[_0xbf72('0x28')](respondWithResult(_0x35517f,null))[_0xbf72('0xab')](handleError(_0x35517f,null));};exports[_0xbf72('0xb1')]=function(_0x7d6f18,_0x54993a,_0x3c7929){return db[_0xbf72('0xb2')][_0xbf72('0x5c')]({'where':{'id':_0x7d6f18['params']['id']}})[_0xbf72('0x28')](handleEntityNotFound(_0x54993a,null))[_0xbf72('0x28')](function(_0x2e3519){if(_0x2e3519){return _0x2e3519[_0xbf72('0xb1')](_0x7d6f18['body'][_0xbf72('0xb3')],_[_0xbf72('0xb4')](_0x7d6f18[_0xbf72('0x6d')],[_0xbf72('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x54993a,null))[_0xbf72('0xab')](handleError(_0x54993a,null));};exports[_0xbf72('0xb5')]=function(_0x42663e,_0x812ece,_0x375054){var _0x1e716f={'raw':![],'where':{}};var _0x52d372={};var _0x47da7d={'count':0x0,'rows':[]};return db[_0xbf72('0x35')][_0xbf72('0xb6')]({'where':{'id':_0x42663e[_0xbf72('0xaf')]['id']}})['then'](handleEntityNotFound(_0x812ece,null))[_0xbf72('0x28')](function(_0x2c5779){if(_0x2c5779){_0x52d372['model']=_[_0xbf72('0x3b')](db[_0xbf72('0xb2')]['rawAttributes']);_0x52d372[_0xbf72('0x3a')]=_[_0xbf72('0x3b')](_0x42663e['query']);_0x52d372['filters']=_[_0xbf72('0x3d')](_0x52d372[_0xbf72('0x3f')],_0x52d372[_0xbf72('0x3a')]);_0x1e716f[_0xbf72('0x3e')]=_['intersection'](_0x52d372[_0xbf72('0x3f')],qs[_0xbf72('0x97')](_0x42663e[_0xbf72('0x3a')]['fields']));_0x1e716f['attributes']=_0x1e716f['attributes'][_0xbf72('0x5b')]?_0x1e716f[_0xbf72('0x3e')]:_0x52d372[_0xbf72('0x3f')];if(!_0x42663e[_0xbf72('0x3a')]['hasOwnProperty'](_0xbf72('0xb7'))){_0x1e716f[_0xbf72('0x23')]=qs[_0xbf72('0x23')](_0x42663e[_0xbf72('0x3a')][_0xbf72('0x23')]);_0x1e716f[_0xbf72('0x22')]=qs[_0xbf72('0x22')](_0x42663e[_0xbf72('0x3a')][_0xbf72('0x22')]);}_0x1e716f[_0xbf72('0x41')]=qs['sort'](_0x42663e[_0xbf72('0x3a')][_0xbf72('0x42')]);_0x1e716f[_0xbf72('0x73')]=qs[_0xbf72('0x3c')](_['pick'](_0x42663e['query'],_0x52d372[_0xbf72('0x3c')]));_0x1e716f[_0xbf72('0x73')][_0xbf72('0xb8')]=_0x2c5779['id'];if(_0x42663e[_0xbf72('0x3a')][_0xbf72('0x7f')]){_0x1e716f['where']=_['merge'](_0x1e716f[_0xbf72('0x73')],{'$or':_[_0xbf72('0x2e')](_0x1e716f[_0xbf72('0x3e')],function(_0x465a51){var _0x2fd92a={};_0x2fd92a[_0x465a51]={'$like':'%'+_0x42663e[_0xbf72('0x3a')][_0xbf72('0x7f')]+'%'};return _0x2fd92a;})});}if(_0x42663e[_0xbf72('0x3a')][_0xbf72('0x77')]){var _0x250cb5=_0x42663e[_0xbf72('0x3a')]['$gte'][_0xbf72('0x32')](',');var _0x49dac9={};_0x49dac9[_0x250cb5[0x0]]={'$gte':moment(_0x250cb5[0x1])[_0xbf72('0xb9')](_0xbf72('0xba'))};_0x1e716f['where']=_[_0xbf72('0x96')](_0x1e716f['where'],_0x49dac9);}_0x1e716f=_[_0xbf72('0x96')]({},_0x1e716f,_0x42663e[_0xbf72('0xbb')]);return db['SmsMessage'][_0xbf72('0x21')]({'where':_0x1e716f[_0xbf72('0x73')]})[_0xbf72('0x28')](function(_0x11fcad){_0x47da7d['count']=_0x11fcad;if(_0x42663e['query'][_0xbf72('0xad')]){_0x1e716f[_0xbf72('0xbc')]=[{'all':!![]}];}return db[_0xbf72('0xb2')][_0xbf72('0xbd')](_0x1e716f);})[_0xbf72('0x28')](function(_0x7b2e81){_0x47da7d[_0xbf72('0xaa')]=_0x7b2e81;return _0x47da7d;});}})[_0xbf72('0x28')](respondWithFilteredResult(_0x812ece,_0x1e716f))[_0xbf72('0xab')](handleError(_0x812ece,null));};exports[_0xbf72('0xbe')]=function(_0xbeac16,_0x27c6a3,_0x1306b9){return db[_0xbf72('0x35')]['find']({'where':{'id':_0xbeac16[_0xbf72('0xaf')]['id']}})['then'](handleEntityNotFound(_0x27c6a3,null))[_0xbf72('0x28')](function(_0x369ae8){if(_0x369ae8){return _0x369ae8[_0xbf72('0xbf')](_0xbeac16['body'][_0xbf72('0xb3')],_[_0xbf72('0xb4')](_0xbeac16[_0xbf72('0x6d')],[_0xbf72('0xb3'),'id'])||{})[_0xbf72('0xc0')](function(){return db['Tag'][_0xbf72('0xbd')]({'attributes':['id',_0xbf72('0x2c'),_0xbf72('0x45')],'where':{'id':_0xbeac16[_0xbf72('0x6d')][_0xbf72('0xb3')]}});})[_0xbf72('0x28')](function(_0x4fa0f1){socket[_0xbf72('0xc1')]('smsInteractionTags:save',{'id':Number(_0xbeac16['params']['id']),'tags':_0x4fa0f1||[]});return{'id':Number(_0xbeac16[_0xbf72('0xaf')]['id']),'tags':_0x4fa0f1||[]};});}})[_0xbf72('0x28')](respondWithResult(_0x27c6a3,null))[_0xbf72('0xab')](handleError(_0x27c6a3,null));};exports['removeTags']=function(_0x59ce68,_0x4af0b4,_0x29a1bd){return db[_0xbf72('0x35')][_0xbf72('0x5c')]({'where':{'id':_0x59ce68[_0xbf72('0xaf')]['id']}})[_0xbf72('0x28')](handleEntityNotFound(_0x4af0b4,null))[_0xbf72('0x28')](function(_0x35f0cc){if(_0x35f0cc){return _0x35f0cc[_0xbf72('0xc2')](_0x59ce68[_0xbf72('0x3a')][_0xbf72('0xb3')]);}})[_0xbf72('0x28')](respondWithStatusCode(_0x4af0b4,null))['catch'](handleError(_0x4af0b4,null));};exports[_0xbf72('0xc3')]=function(_0x810cdf,_0x15f8f4){var _0x47defd=moment()['unix']()[_0xbf72('0x94')]();var _0x49e3a4=path[_0xbf72('0xc4')](config[_0xbf72('0xc5')],_0xbf72('0xc6'),_0xbf72('0xc7'),_0xbf72('0xc8'));var _0x57d05b=path[_0xbf72('0xc4')](config['root'],_0xbf72('0xc6'),'files',_0xbf72('0xc9'));var _0x16d4cd=path['join'](_0x49e3a4,_0x47defd);var _0x2ac801=util['format'](_0xbf72('0xca'),_0x810cdf[_0xbf72('0xaf')]['id'],_0x47defd);var _0x7dbb1=path['join'](_0x49e3a4,_0x2ac801);var _0x445842=[];_0x445842['push']({'model':db[_0xbf72('0xcb')],'as':_0xbf72('0xcb'),'attributes':['id',_0xbf72('0x2f')],'raw':!![]});_0x445842['push']({'model':db[_0xbf72('0xcc')],'as':'Contact','attributes':['id',_0xbf72('0xcd'),_0xbf72('0xce')],'raw':!![]});var _0x47d1fb=[{'model':db[_0xbf72('0xb2')],'as':_0xbf72('0xcf'),'attributes':['id',_0xbf72('0x6d'),_0xbf72('0x76'),_0xbf72('0xd0'),_0xbf72('0xd1'),_0xbf72('0x7c')],'include':_0x445842}];_0x47d1fb[_0xbf72('0x34')]({'model':db[_0xbf72('0xd2')],'as':_0xbf72('0xd3'),'attributes':['id',_0xbf72('0x2c')]});_0x47d1fb[_0xbf72('0x34')]({'model':db[_0xbf72('0xcb')],'as':'Owner','attributes':['id','fullname']});return db[_0xbf72('0x35')]['find']({'where':{'id':_0x810cdf[_0xbf72('0xaf')]['id']},'include':_0x47d1fb})['then'](handleEntityNotFound(_0x15f8f4,null))['then'](function(_0x1a3f8c){if(_0x1a3f8c){var _0x5f71ba=_0x1a3f8c[_0xbf72('0xd4')]({'plain':!![]});fs[_0xbf72('0xd5')](_0x16d4cd);var _0xc70212={'format':'A4','border':_0xbf72('0xd6'),'header':{'height':'40px','contents':{'first':_0xbf72('0xd7')}},'footer':{'height':_0xbf72('0xd8'),'contents':{'default':util[_0xbf72('0xb9')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xbf72('0xb9')](_0xbf72('0xd9'),'Sms',_0x5f71ba['id']),moment()[_0xbf72('0xb9')]('YYYY-MM-DD')[_0xbf72('0x94')]())}}};var _0x383749={'channel':_0xbf72('0xda'),'account':_0x5f71ba[_0xbf72('0xd3')][_0xbf72('0x2c')],'agent':_0x5f71ba[_0xbf72('0xdb')]?_0x5f71ba[_0xbf72('0xdb')][_0xbf72('0x2f')]:_0xbf72('0xdc'),'createdAt':moment(_0x5f71ba[_0xbf72('0x76')])[_0xbf72('0xb9')](_0xbf72('0xba'))[_0xbf72('0x94')](),'closedAt':_0x5f71ba[_0xbf72('0xdd')]?moment(_0x5f71ba[_0xbf72('0xde')])['format'](_0xbf72('0xba'))['toString']():'','disposition':_0x5f71ba[_0xbf72('0xdf')],'messages':_(_0x5f71ba[_0xbf72('0xcf')])[_0xbf72('0x7f')]({'secret':![]})[_0xbf72('0x2e')](function(_0x29dfd1){return{'date':moment(_0x29dfd1[_0xbf72('0x76')])[_0xbf72('0xb9')](_0xbf72('0xba'))[_0xbf72('0x94')](),'sender':_0x29dfd1[_0xbf72('0xd0')]===_0xbf72('0xe0')?_0x29dfd1[_0xbf72('0xcb')]?_0x29dfd1[_0xbf72('0xcb')][_0xbf72('0x2f')]:_0xbf72('0xe1'):_0x29dfd1[_0xbf72('0xe2')][_0xbf72('0xcd')]+(_0x29dfd1[_0xbf72('0xe2')]['lastName']?'\x20'+_0x29dfd1[_0xbf72('0xe2')][_0xbf72('0xce')]:''),'body':_0x29dfd1[_0xbf72('0x6d')],'direction':_0x29dfd1[_0xbf72('0xd0')]==='out'?'A':'C','secret':_0x29dfd1[_0xbf72('0xd1')],'read':_0x29dfd1[_0xbf72('0x7c')]};})[_0xbf72('0x5e')]()};return ejs[_0xbf72('0xe3')](path[_0xbf72('0xc4')](config[_0xbf72('0xc5')],_0xbf72('0xc6'),'views',_0xbf72('0xe4')),{'interaction':_0x383749})[_0xbf72('0x28')](function(_0x5c77b4){return new BPromise(function(_0x2c14c9,_0xe82795){pdf[_0xbf72('0xae')](_0x5c77b4,_0xc70212)[_0xbf72('0xe5')](path[_0xbf72('0xc4')](_0x16d4cd,_0xbf72('0xe6')+_0x5f71ba['id']+'-'+_0x47defd+_0xbf72('0xe7')),function(_0x1af909,_0x588469){if(_0x1af909)return _0xe82795(_0x1af909);_0x2c14c9(_0x588469);});});})[_0xbf72('0x28')](function(){return new BPromise(function(_0x3b5558,_0xc3eb94){zipdir(_0x16d4cd,{'saveTo':_0x7dbb1},function(_0x2fbc9f,_0x40bf3d){if(_0x2fbc9f)return _0xc3eb94(_0x2fbc9f);return _0x3b5558(_0x40bf3d);});})[_0xbf72('0x28')](function(){return new BPromise(function(_0x308385,_0x24e1fd){rimraf(_0x16d4cd,function(_0xd71399){if(_0xd71399)_0x24e1fd(_0xd71399);return _0x308385();});});})[_0xbf72('0x28')](function(){return _0x15f8f4[_0xbf72('0xc3')](_0x7dbb1,_0x2ac801,function(_0xd36e9a){if(_0xd36e9a){console['log'](_0xbf72('0xe8'),_0xd36e9a);}else{fs[_0xbf72('0xe9')](_0x7dbb1);}});});});}else{return _0x15f8f4['sendStatus'](0xc8);}})['catch'](handleError(_0x15f8f4,null));}; \ No newline at end of file +var _0x9348=['files','attachments','format','transcript-%d-%s.zip','CmContact','lastName','direction','secret','SmsAccount','Account','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','fullname','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','out','System','firstName','renderFile','views','downloadInteraction.html','.pdf','download','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','where','pick','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','start','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','rawAttributes','includeAll','include','create','body','describe','SmsMessage','addMessage','ids','findOne','hasOwnProperty','sort','options','findAll','setTags','omit','spread','smsInteractionTags:save','removeTags','unix','join','root','server','tmp'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x9348,0x10d));var _0x8934=function(_0x26c9cb,_0x5a5ecc){_0x26c9cb=_0x26c9cb-0x0;var _0xcb1b4a=_0x9348[_0x26c9cb];return _0xcb1b4a;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var db=require(_0x8934('0x17'))['db'];config[_0x8934('0x18')]=_['defaults'](config[_0x8934('0x18')],{'host':_0x8934('0x19'),'port':0x18eb});var socket=require(_0x8934('0x1a'))(new Redis(config[_0x8934('0x18')]));require(_0x8934('0x1b'))[_0x8934('0x1c')](socket);function respondWithStatusCode(_0x5b560f,_0x254720){_0x254720=_0x254720||0xcc;return function(_0x38230a){if(_0x38230a){return _0x5b560f[_0x8934('0x1d')](_0x254720);}return _0x5b560f[_0x8934('0x1e')](_0x254720)[_0x8934('0x1f')]();};}function respondWithResult(_0x41e6a9,_0x2a5b04){_0x2a5b04=_0x2a5b04||0xc8;return function(_0x357cf8){if(_0x357cf8){return _0x41e6a9['status'](_0x2a5b04)[_0x8934('0x20')](_0x357cf8);}};}function respondWithFilteredResult(_0x3ef798,_0x261c78){return function(_0x5de8f0){if(_0x5de8f0){var _0x47f25e=_0x5de8f0[_0x8934('0x21')],_0x597eed=_0x261c78[_0x8934('0x22')],_0x2ff9ce=_0x261c78[_0x8934('0x22')]+_0x261c78[_0x8934('0x23')],_0x51f9ed;if(_0x2ff9ce>=_0x47f25e){_0x2ff9ce=_0x47f25e;_0x51f9ed=0xc8;}else{_0x51f9ed=0xce;}_0x3ef798[_0x8934('0x1e')](_0x51f9ed);return _0x3ef798['set'](_0x8934('0x24'),_0x597eed+'-'+_0x2ff9ce+'/'+_0x47f25e)['json'](_0x5de8f0);}return null;};}function patchUpdates(_0x476c6c){return function(_0x34f4e7){try{jsonpatch[_0x8934('0x25')](_0x34f4e7,_0x476c6c,!![]);}catch(_0x379445){return BPromise[_0x8934('0x26')](_0x379445);}return _0x34f4e7[_0x8934('0x27')]();};}function saveUpdates(_0x36fe20,_0x4f4a9b){return function(_0xe763c6){if(_0xe763c6){return _0xe763c6[_0x8934('0x28')](_0x36fe20)[_0x8934('0x29')](function(_0x343e09){return _0x343e09;});}return null;};}function removeEntity(_0x43b89a,_0x5e593b){return function(_0x3cf295){if(_0x3cf295){return _0x3cf295[_0x8934('0x2a')]()[_0x8934('0x29')](function(){_0x43b89a['status'](0xcc)[_0x8934('0x1f')]();});}};}function handleEntityNotFound(_0x561df2,_0x14c5f0){return function(_0x1783ce){if(!_0x1783ce){_0x561df2[_0x8934('0x1d')](0x194);}return _0x1783ce;};}function handleError(_0x5ef0ed,_0x1fd5eb){_0x1fd5eb=_0x1fd5eb||0x1f4;return function(_0x15910b){logger[_0x8934('0x2b')](_0x15910b[_0x8934('0x2c')]);if(_0x15910b['name']){delete _0x15910b[_0x8934('0x2d')];}_0x5ef0ed[_0x8934('0x1e')](_0x1fd5eb)[_0x8934('0x2e')](_0x15910b);};}function getInteractionUsers(_0x3d93c7,_0x44972b){return new BPromise(function(_0x20d448,_0x3f328a){try{if(_0x44972b[_0x3d93c7['id']]){_0x3d93c7[_0x8934('0x2f')]=_[_0x8934('0x30')](_0x44972b[_0x3d93c7['id']],function(_0x18938a){return{'id':_0x18938a['id'],'fullname':_0x18938a['fullname']};});}}catch(_0x1d068c){_0x3f328a(_0x1d068c);}_0x20d448(_0x3d93c7);});}function getInteractionTags(_0x3e973e,_0x54d28d){return new BPromise(function(_0x2aa18e,_0x3d60f9){try{if(_0x3e973e[_0x8934('0x31')]){_0x3e973e[_0x8934('0x32')]=[];_0x3e973e['TagIds'][_0x8934('0x33')](',')[_0x8934('0x34')](function(_0x11844a){_0x3e973e[_0x8934('0x32')][_0x8934('0x35')](_0x54d28d[_0x11844a]);});}delete _0x3e973e['TagIds'];}catch(_0x15c40c){_0x3d60f9(_0x15c40c);}_0x2aa18e(_0x3e973e);});}function updateSmsInteraction(_0x59a6bf,_0x5559f1,_0xff95be){return new BPromise(function(_0x2447e6,_0x2f5880){return getInteractionUsers(_0x59a6bf,_0xff95be)[_0x8934('0x29')](function(_0x50bbb4){return getInteractionTags(_0x50bbb4,_0x5559f1);})[_0x8934('0x29')](function(_0x22aebe){_0x2447e6(_0x22aebe);})[_0x8934('0x36')](function(_0x1439ef){_0x2f5880(_0x1439ef);});});}exports[_0x8934('0x37')]=function(_0x4cd282,_0x6764f8){var _0x1ea0cd={},_0x5d5bc2={},_0x5914b9={'count':0x0,'rows':[]};var _0x845028=_[_0x8934('0x30')](db['SmsInteraction']['rawAttributes'],function(_0x1a30c1){return{'name':_0x1a30c1[_0x8934('0x38')],'type':_0x1a30c1[_0x8934('0x39')][_0x8934('0x3a')]};});_0x5d5bc2[_0x8934('0x3b')]=_[_0x8934('0x30')](_0x845028,_0x8934('0x2d'));_0x5d5bc2[_0x8934('0x3c')]=_[_0x8934('0x3d')](_0x4cd282[_0x8934('0x3c')]);_0x5d5bc2[_0x8934('0x3e')]=_['intersection'](_0x5d5bc2[_0x8934('0x3b')],_0x5d5bc2[_0x8934('0x3c')]);_0x1ea0cd['attributes']=_[_0x8934('0x3f')](_0x5d5bc2[_0x8934('0x3b')],qs[_0x8934('0x40')](_0x4cd282[_0x8934('0x3c')][_0x8934('0x40')]));_0x1ea0cd['attributes']=_0x1ea0cd['attributes']['length']?_0x1ea0cd[_0x8934('0x41')]:_0x5d5bc2[_0x8934('0x3b')];if(!_0x4cd282[_0x8934('0x3c')]['hasOwnProperty'](_0x8934('0x42'))){_0x1ea0cd['limit']=qs['limit'](_0x4cd282[_0x8934('0x3c')][_0x8934('0x23')]);_0x1ea0cd['offset']=qs['offset'](_0x4cd282[_0x8934('0x3c')][_0x8934('0x22')]);}_0x1ea0cd[_0x8934('0x43')]=qs['sort'](_0x4cd282[_0x8934('0x3c')]['sort']);_0x1ea0cd[_0x8934('0x44')]=qs['filters'](_[_0x8934('0x45')](_0x4cd282[_0x8934('0x3c')],_0x5d5bc2[_0x8934('0x3e')]),_0x845028);var _0x566d67=[];var _0xefdfab=squel[_0x8934('0x46')]()[_0x8934('0x47')]('id')[_0x8934('0x47')]('name')[_0x8934('0x47')](_0x8934('0x48'))[_0x8934('0x49')](_0x8934('0x4a'));var _0x6e63ff=squel[_0x8934('0x46')]()[_0x8934('0x47')](_0x8934('0x4b'))['field']('u.fullname')['field'](_0x8934('0x4c'))[_0x8934('0x49')]('user_has_sms_interactions','ui')[_0x8934('0x4d')]('users','u',_0x8934('0x4e'));var _0x170fbf=squel['select']()[_0x8934('0x49')](_0x8934('0x4f'),'i')[_0x8934('0x4d')](_0x8934('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8934('0x4d')](_0x8934('0x51'),'o','o.id\x20=\x20i.UserId')[_0x8934('0x4d')](_0x8934('0x52'),'a',_0x8934('0x53'))[_0x8934('0x4d')](_0x8934('0x54'),'me',_0x8934('0x55'))[_0x8934('0x4d')](_0x8934('0x56'),'it',_0x8934('0x57'))[_0x8934('0x4d')](_0x8934('0x4a'),'t',_0x8934('0x58'));var _0x2c322d=squel[_0x8934('0x59')]();var _0x11b06f=[];var _0x245176=squel[_0x8934('0x59')]();var _0x248d88;if(_0x4cd282['query'][_0x8934('0x5a')]){_0x248d88=as[_0x8934('0x5b')](_0x4cd282['query']['search']);var _0x4a52c0=_0x248d88['sqlOperator'];for(var _0x3610a0=0x0;_0x3610a0<_0x248d88[_0x8934('0x5c')][_0x8934('0x5d')];_0x3610a0++){var _0x4d1433=_0x248d88['conditions'][_0x3610a0];var _0x16eb4d='i';var _0x5aa035=_['find'](_0x845028,[_0x8934('0x2d'),_0x4d1433[_0x8934('0x47')]]);if(!_0x5aa035){switch(_0x4d1433[_0x8934('0x47')]){case _0x8934('0x5e'):if(_0x4d1433[_0x8934('0x5f')]==0x1){_0x170fbf[_0x8934('0x60')]('`'+_0x4d1433[_0x8934('0x47')]+'`\x20=\x200');}else{_0x170fbf[_0x8934('0x60')]('`'+_0x4d1433['field']+_0x8934('0x61'));}break;case _0x8934('0x62'):if(_0x4d1433[_0x8934('0x63')]===_0x8934('0x64')){if(_0x4d1433[_0x8934('0x5f')][_0x8934('0x33')]('\x20')[_0x8934('0x5d')]>0x1){_0x2c322d[_0x4a52c0](_0x8934('0x65'),qs['getFullTextValue'](_0x4d1433[_0x8934('0x5f')]),null);}else{var _0x345a95='%'+_0x4d1433[_0x8934('0x5f')]+'%';_0x2c322d[_0x4a52c0](_0x8934('0x66'),_0x345a95,_0x345a95,_0x345a95);}}else{_0x5aa035=_[_0x8934('0x67')](_0x845028,['name',_0x8934('0x68')]);_0x4d1433[_0x8934('0x47')]=_0x8934('0x68');_0x458895=as['buildExpression'](_0x16eb4d,_0x5aa035[_0x8934('0x39')],_0x4d1433);_0x2c322d[_0x4a52c0](_0x458895[_0x8934('0x69')],_0x458895[_0x8934('0x5f')]['start'],_0x458895['value']['end']);}break;case _0x8934('0x6a'):var _0x8e3e85=_0x4d1433[_0x8934('0x5f')]['split'](',')[_0x8934('0x30')](function(_0x10ff96){return Number(_0x10ff96);});_0x8e3e85['forEach'](function(_0x5157d7){_0x245176['or'](_0x8934('0x6b'),'%,'+_0x5157d7+',%');});_0x11b06f=_[_0x8934('0x6c')](_0x11b06f,_0x8e3e85);break;case _0x8934('0x6d'):if(_0x4d1433[_0x8934('0x63')]==='$substring'){_0x2c322d[_0x4a52c0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4d1433['value']+'%',null);}else{_0x5aa035=_['find'](_0x845028,[_0x8934('0x2d'),_0x8934('0x6e')]);_0x4d1433[_0x8934('0x47')]=_0x8934('0x6e');_0x458895=as[_0x8934('0x6f')](_0x16eb4d,_0x5aa035[_0x8934('0x39')],_0x4d1433);_0x2c322d[_0x4a52c0](_0x458895['text'],_0x458895[_0x8934('0x5f')][_0x8934('0x70')],_0x458895['value'][_0x8934('0x1f')]);}break;case'body':_0x458895=as[_0x8934('0x6f')]('me',null,_0x4d1433);_0x2c322d[_0x4a52c0](_0x458895['text'],_0x458895[_0x8934('0x5f')][_0x8934('0x70')],_0x458895[_0x8934('0x5f')][_0x8934('0x1f')]);break;}}else{var _0x458895=as[_0x8934('0x6f')](_0x16eb4d,_0x5aa035[_0x8934('0x39')],_0x4d1433);_0x2c322d[_0x4a52c0](_0x458895['text'],_0x458895['value'][_0x8934('0x70')],_0x458895[_0x8934('0x5f')][_0x8934('0x1f')]);}}}else{var _0x458aaf=_(_0x4cd282[_0x8934('0x3c')])[_0x8934('0x3d')]()[_0x8934('0x30')](function(_0x112957){return _[_0x8934('0x71')](_0x845028,[_0x8934('0x2d'),_0x112957])?_0x112957:undefined;})[_0x8934('0x72')]()[_0x8934('0x5f')]();if(!_[_0x8934('0x73')](_0x458aaf)){_0x458aaf[_0x8934('0x34')](function(_0x5c7b96){if(_0x5c7b96==='SmsAccountId'){_0x170fbf[_0x8934('0x44')](_0x8934('0x74'),[][_0x8934('0x75')](_0x4cd282[_0x8934('0x3c')][_0x5c7b96]));}else if(_0x5c7b96===_0x8934('0x76')){var _0x1b54ed=JSON[_0x8934('0x77')](_0x4cd282['query'][_0x5c7b96])[_0x8934('0x78')];var _0x3f51dc=JSON['parse'](_0x4cd282[_0x8934('0x3c')][_0x5c7b96])['$lte'];_0x170fbf[_0x8934('0x44')](_0x8934('0x79'),_0x1b54ed,_0x3f51dc);}else{if(_0x4cd282[_0x8934('0x3c')][_0x5c7b96]==='null'){_0x170fbf[_0x8934('0x44')]('i.'+_0x5c7b96+_0x8934('0x7a'));}else{_0x170fbf['where']('i.'+_0x5c7b96+_0x8934('0x7b'),_0x4cd282['query'][_0x5c7b96]);}}});}if(_0x4cd282[_0x8934('0x3c')]['read']){if(_0x4cd282[_0x8934('0x3c')][_0x8934('0x7c')]==0x1){_0x170fbf[_0x8934('0x60')]('`unreadMessages`\x20=\x200');}else{_0x170fbf[_0x8934('0x60')](_0x8934('0x7d'));}}if(_0x4cd282[_0x8934('0x3c')][_0x8934('0x7e')]){_0x11b06f=_['isArray'](_0x4cd282[_0x8934('0x3c')]['tag'])?_0x4cd282[_0x8934('0x3c')][_0x8934('0x7e')]:new Array(_0x4cd282[_0x8934('0x3c')][_0x8934('0x7e')]);_0x11b06f['forEach'](function(_0xc2799d){_0x245176['or'](_0x8934('0x6b'),'%,'+_0xc2799d+',%');});}if(_0x4cd282[_0x8934('0x3c')]['filter']){var _0x259fcf=_0x4cd282[_0x8934('0x3c')][_0x8934('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x8934('0x80'));if(qs[_0x8934('0x81')](_0x259fcf)){_0x2c322d['or'](_0x8934('0x82'),_0x259fcf+'%')['or'](_0x8934('0x83'),_0x259fcf+'%');}else{_0x2c322d['or'](_0x8934('0x84'),qs[_0x8934('0x85')](_0x259fcf))['or'](_0x8934('0x86'),_0x259fcf+'%');}}}_0x170fbf[_0x8934('0x44')](_0x2c322d);_0x170fbf[_0x8934('0x87')]('i.id');var _0x334b42={'type':db[_0x8934('0x88')][_0x8934('0x89')][_0x8934('0x8a')],'raw':!![]};var _0x3a860c=_0x170fbf['clone']();_0x3a860c[_0x8934('0x47')](_0x8934('0x8b'));_0x3a860c['field'](_0x8934('0x8c'),'unreadMessages');if(_0x1ea0cd['order']){_0x1ea0cd['order'][_0x8934('0x34')](function(_0x459c41){_0x170fbf[_0x8934('0x43')]('i.'+_0x459c41[0x0],_0x459c41[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8934('0x73')](_0x11b06f)){_0x170fbf[_0x8934('0x60')](_0x245176);_0x3a860c['where'](_0x8934('0x8d'),_0x11b06f);}BPromise[_0x8934('0x8e')]()[_0x8934('0x29')](function(){if(!_0x248d88){if(_0x4cd282[_0x8934('0x3c')][_0x8934('0x8f')]||_0x4cd282[_0x8934('0x3c')][_0x8934('0x90')])return;_0x3a860c[_0x8934('0x44')](_0x8934('0x91'));_0x170fbf[_0x8934('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x4cd282[_0x8934('0x92')][_0x8934('0x93')]({'attributes':['id'],'raw':!![]})[_0x8934('0x29')](function(_0x22a907){if(_[_0x8934('0x73')](_0x22a907)){_0x3a860c[_0x8934('0x44')](_0x8934('0x94'));_0x170fbf['where'](_0x8934('0x94'));}else{_0x3a860c[_0x8934('0x44')](_0x8934('0x74'),_[_0x8934('0x30')](_0x22a907,'id'));_0x170fbf[_0x8934('0x44')](_0x8934('0x74'),_[_0x8934('0x30')](_0x22a907,'id'));}});})[_0x8934('0x29')](function(){db[_0x8934('0x95')]['query'](_0x3a860c['toString'](),_0x334b42)[_0x8934('0x29')](function(_0x9df49d){_0x5914b9['count']=_0x9df49d[_0x8934('0x5d')];if(_0x5914b9[_0x8934('0x21')]===0x0)return[];return db[_0x8934('0x95')][_0x8934('0x3c')](_0xefdfab[_0x8934('0x96')](),_0x334b42)[_0x8934('0x29')](function(_0x2d8db7){_0x566d67=_[_0x8934('0x97')](_0x2d8db7,'id');_0x334b42=_[_0x8934('0x98')](_0x334b42,{'model':db[_0x8934('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4cd282[_0x8934('0x3c')]['fields']){_0x1ea0cd[_0x8934('0x41')][_0x8934('0x34')](function(_0x460cef){_0x170fbf['field']('i.'+_0x460cef);});}else{_0x170fbf[_0x8934('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8934('0x5e'));_0x170fbf[_0x8934('0x47')](_0x8934('0x9a'),_0x8934('0x9b'));_0x170fbf['field']('a.mandatoryDisposition',_0x8934('0x9c'));_0x170fbf['field'](_0x8934('0x9d'));_0x170fbf[_0x8934('0x47')](_0x8934('0x9e'),_0x8934('0x9f'));_0x170fbf['field'](_0x8934('0xa0'),'Contact.lastName');_0x170fbf['field']('c.email','Contact.email');_0x170fbf[_0x8934('0x47')](_0x8934('0xa1'),_0x8934('0xa2'));_0x170fbf[_0x8934('0x47')](_0x8934('0xa3'),'Contact.mobile');_0x170fbf['field'](_0x8934('0xa4'),_0x8934('0xa5'));_0x170fbf[_0x8934('0x47')](_0x8934('0xa6'),_0x8934('0xa7'));_0x170fbf[_0x8934('0x47')](_0x8934('0xa8'),_0x8934('0xa9'));_0x170fbf[_0x8934('0x47')](_0x8934('0xaa'),_0x8934('0x31'));}if(_0x1ea0cd[_0x8934('0x23')])_0x170fbf[_0x8934('0x23')](_0x1ea0cd[_0x8934('0x23')]);if(_0x1ea0cd[_0x8934('0x22')])_0x170fbf[_0x8934('0x22')](_0x1ea0cd['offset']);return db['sequelize'][_0x8934('0x3c')](_0x170fbf[_0x8934('0x96')](),_0x334b42);})['then'](function(_0x2313f7){_0x6e63ff[_0x8934('0x44')](_0x8934('0xab'),_[_0x8934('0x30')](_0x2313f7,'id'));return db[_0x8934('0x95')][_0x8934('0x3c')](_0x6e63ff[_0x8934('0x96')](),_0x334b42)['then'](function(_0x12fd3c){var _0x5aab65=_[_0x8934('0xac')](_0x12fd3c,_0x8934('0xad'));var _0xdd9bb3=[];_0x2313f7[_0x8934('0x34')](function(_0x5d1baf){_0xdd9bb3[_0x8934('0x35')](updateSmsInteraction(_0x5d1baf,_0x566d67,_0x5aab65));});return BPromise['all'](_0xdd9bb3);});});})['then'](function(_0x383431){_0x5914b9[_0x8934('0xae')]=_0x383431;return _0x5914b9;})['then'](respondWithFilteredResult(_0x6764f8,_0x1ea0cd));})['catch'](handleError(_0x6764f8,null));};exports[_0x8934('0xaf')]=function(_0x5e6b01,_0x22edac){var _0x79bd0d={'raw':![],'where':{'id':_0x5e6b01[_0x8934('0xb0')]['id']}},_0x4ed97b={};_0x4ed97b[_0x8934('0x3b')]=_[_0x8934('0x3d')](db['SmsInteraction'][_0x8934('0xb1')]);_0x4ed97b[_0x8934('0x3c')]=_['keys'](_0x5e6b01['query']);_0x4ed97b[_0x8934('0x3e')]=_[_0x8934('0x3f')](_0x4ed97b[_0x8934('0x3b')],_0x4ed97b['query']);_0x79bd0d['attributes']=_[_0x8934('0x3f')](_0x4ed97b['model'],qs[_0x8934('0x40')](_0x5e6b01[_0x8934('0x3c')][_0x8934('0x40')]));_0x79bd0d[_0x8934('0x41')]=_0x79bd0d[_0x8934('0x41')][_0x8934('0x5d')]?_0x79bd0d[_0x8934('0x41')]:_0x4ed97b[_0x8934('0x3b')];if(_0x5e6b01['query'][_0x8934('0xb2')]){_0x79bd0d[_0x8934('0xb3')]=[{'all':!![]}];}_0x79bd0d=_['merge']({},_0x79bd0d,_0x5e6b01['options']);return db[_0x8934('0x99')]['find'](_0x79bd0d)[_0x8934('0x29')](handleEntityNotFound(_0x22edac,null))[_0x8934('0x29')](respondWithResult(_0x22edac,null))['catch'](handleError(_0x22edac,null));};exports[_0x8934('0xb4')]=function(_0x417ca4,_0x1e8fa6){return db[_0x8934('0x99')]['create'](_0x417ca4[_0x8934('0xb5')],{})[_0x8934('0x29')](respondWithResult(_0x1e8fa6,0xc9))[_0x8934('0x36')](handleError(_0x1e8fa6,null));};exports[_0x8934('0x28')]=function(_0x542c1f,_0x78015a){if(_0x542c1f[_0x8934('0xb5')]['id']){delete _0x542c1f[_0x8934('0xb5')]['id'];}return db[_0x8934('0x99')][_0x8934('0x67')]({'where':{'id':_0x542c1f[_0x8934('0xb0')]['id']}})['then'](handleEntityNotFound(_0x78015a,null))[_0x8934('0x29')](saveUpdates(_0x542c1f['body'],null))[_0x8934('0x29')](respondWithResult(_0x78015a,null))[_0x8934('0x36')](handleError(_0x78015a,null));};exports[_0x8934('0x2a')]=function(_0x5b4cc4,_0xf8b851){return db[_0x8934('0x99')][_0x8934('0x67')]({'where':{'id':_0x5b4cc4[_0x8934('0xb0')]['id']}})['then'](handleEntityNotFound(_0xf8b851,null))[_0x8934('0x29')](removeEntity(_0xf8b851,null))[_0x8934('0x36')](handleError(_0xf8b851,null));};exports[_0x8934('0xb6')]=function(_0x510288,_0x58802c){return db['SmsInteraction']['describe']()[_0x8934('0x29')](respondWithResult(_0x58802c,null))[_0x8934('0x36')](handleError(_0x58802c,null));};exports['addMessage']=function(_0x5ac735,_0x53be62,_0x33a584){return db[_0x8934('0xb7')][_0x8934('0x67')]({'where':{'id':_0x5ac735[_0x8934('0xb0')]['id']}})[_0x8934('0x29')](handleEntityNotFound(_0x53be62,null))[_0x8934('0x29')](function(_0x3cd86b){if(_0x3cd86b){return _0x3cd86b[_0x8934('0xb8')](_0x5ac735['body'][_0x8934('0xb9')],_['omit'](_0x5ac735[_0x8934('0xb5')],[_0x8934('0xb9'),'id'])||{});}})[_0x8934('0x29')](respondWithResult(_0x53be62,null))[_0x8934('0x36')](handleError(_0x53be62,null));};exports['getMessages']=function(_0x122f82,_0x14cfce,_0x1da1cd){var _0x2eb89a={'raw':![],'where':{}};var _0x30bfc1={};var _0x512f54={'count':0x0,'rows':[]};return db[_0x8934('0x99')][_0x8934('0xba')]({'where':{'id':_0x122f82[_0x8934('0xb0')]['id']}})[_0x8934('0x29')](handleEntityNotFound(_0x14cfce,null))[_0x8934('0x29')](function(_0x18dab8){if(_0x18dab8){_0x30bfc1[_0x8934('0x3b')]=_[_0x8934('0x3d')](db[_0x8934('0xb7')]['rawAttributes']);_0x30bfc1[_0x8934('0x3c')]=_[_0x8934('0x3d')](_0x122f82[_0x8934('0x3c')]);_0x30bfc1['filters']=_[_0x8934('0x3f')](_0x30bfc1[_0x8934('0x3b')],_0x30bfc1[_0x8934('0x3c')]);_0x2eb89a[_0x8934('0x41')]=_[_0x8934('0x3f')](_0x30bfc1[_0x8934('0x3b')],qs[_0x8934('0x40')](_0x122f82[_0x8934('0x3c')]['fields']));_0x2eb89a['attributes']=_0x2eb89a[_0x8934('0x41')][_0x8934('0x5d')]?_0x2eb89a['attributes']:_0x30bfc1['model'];if(!_0x122f82[_0x8934('0x3c')][_0x8934('0xbb')](_0x8934('0x42'))){_0x2eb89a[_0x8934('0x23')]=qs[_0x8934('0x23')](_0x122f82[_0x8934('0x3c')]['limit']);_0x2eb89a[_0x8934('0x22')]=qs['offset'](_0x122f82[_0x8934('0x3c')][_0x8934('0x22')]);}_0x2eb89a[_0x8934('0x43')]=qs[_0x8934('0xbc')](_0x122f82['query'][_0x8934('0xbc')]);_0x2eb89a[_0x8934('0x44')]=qs[_0x8934('0x3e')](_[_0x8934('0x45')](_0x122f82[_0x8934('0x3c')],_0x30bfc1[_0x8934('0x3e')]));_0x2eb89a['where']['SmsInteractionId']=_0x18dab8['id'];if(_0x122f82[_0x8934('0x3c')]['filter']){_0x2eb89a['where']=_[_0x8934('0x98')](_0x2eb89a[_0x8934('0x44')],{'$or':_[_0x8934('0x30')](_0x2eb89a[_0x8934('0x41')],function(_0x8c7175){var _0x4ca9ea={};_0x4ca9ea[_0x8c7175]={'$like':'%'+_0x122f82[_0x8934('0x3c')][_0x8934('0x7f')]+'%'};return _0x4ca9ea;})});}if(_0x122f82['query'][_0x8934('0x78')]){var _0x342cfd=_0x122f82[_0x8934('0x3c')][_0x8934('0x78')]['split'](',');var _0xdff48f={};_0xdff48f[_0x342cfd[0x0]]={'$gte':moment(_0x342cfd[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2eb89a[_0x8934('0x44')]=_['merge'](_0x2eb89a[_0x8934('0x44')],_0xdff48f);}_0x2eb89a=_[_0x8934('0x98')]({},_0x2eb89a,_0x122f82[_0x8934('0xbd')]);return db[_0x8934('0xb7')][_0x8934('0x21')]({'where':_0x2eb89a[_0x8934('0x44')]})[_0x8934('0x29')](function(_0xa01149){_0x512f54[_0x8934('0x21')]=_0xa01149;if(_0x122f82[_0x8934('0x3c')]['includeAll']){_0x2eb89a['include']=[{'all':!![]}];}return db[_0x8934('0xb7')][_0x8934('0xbe')](_0x2eb89a);})[_0x8934('0x29')](function(_0x4ec5e2){_0x512f54[_0x8934('0xae')]=_0x4ec5e2;return _0x512f54;});}})['then'](respondWithFilteredResult(_0x14cfce,_0x2eb89a))[_0x8934('0x36')](handleError(_0x14cfce,null));};exports['addTags']=function(_0x39aed1,_0x4a8cd6,_0x58bb7f){return db['SmsInteraction'][_0x8934('0x67')]({'where':{'id':_0x39aed1[_0x8934('0xb0')]['id']}})[_0x8934('0x29')](handleEntityNotFound(_0x4a8cd6,null))['then'](function(_0x5c6b41){if(_0x5c6b41){return _0x5c6b41[_0x8934('0xbf')](_0x39aed1[_0x8934('0xb5')][_0x8934('0xb9')],_[_0x8934('0xc0')](_0x39aed1['body'],[_0x8934('0xb9'),'id'])||{})[_0x8934('0xc1')](function(){return db['Tag'][_0x8934('0xbe')]({'attributes':['id',_0x8934('0x2d'),'color'],'where':{'id':_0x39aed1[_0x8934('0xb5')][_0x8934('0xb9')]}});})['then'](function(_0x28a360){socket['emit'](_0x8934('0xc2'),{'id':Number(_0x39aed1[_0x8934('0xb0')]['id']),'tags':_0x28a360||[]});return{'id':Number(_0x39aed1['params']['id']),'tags':_0x28a360||[]};});}})[_0x8934('0x29')](respondWithResult(_0x4a8cd6,null))['catch'](handleError(_0x4a8cd6,null));};exports['removeTags']=function(_0x2af43d,_0x20ca44,_0x15f400){return db[_0x8934('0x99')][_0x8934('0x67')]({'where':{'id':_0x2af43d[_0x8934('0xb0')]['id']}})[_0x8934('0x29')](handleEntityNotFound(_0x20ca44,null))['then'](function(_0x29641e){if(_0x29641e){return _0x29641e[_0x8934('0xc3')](_0x2af43d[_0x8934('0x3c')]['ids']);}})[_0x8934('0x29')](respondWithStatusCode(_0x20ca44,null))[_0x8934('0x36')](handleError(_0x20ca44,null));};exports['download']=function(_0x44cae5,_0x216f7c){var _0x31c017=moment()[_0x8934('0xc4')]()[_0x8934('0x96')]();var _0x55c5ea=path[_0x8934('0xc5')](config[_0x8934('0xc6')],_0x8934('0xc7'),'files',_0x8934('0xc8'));var _0x1e0d72=path[_0x8934('0xc5')](config[_0x8934('0xc6')],_0x8934('0xc7'),_0x8934('0xc9'),_0x8934('0xca'));var _0x3cfddb=path[_0x8934('0xc5')](_0x55c5ea,_0x31c017);var _0x95754d=util[_0x8934('0xcb')](_0x8934('0xcc'),_0x44cae5['params']['id'],_0x31c017);var _0x5bbb70=path[_0x8934('0xc5')](_0x55c5ea,_0x95754d);var _0x3af94e=[];_0x3af94e['push']({'model':db['User'],'as':_0x8934('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0x3af94e[_0x8934('0x35')]({'model':db[_0x8934('0xcd')],'as':_0x8934('0x62'),'attributes':['id','firstName',_0x8934('0xce')],'raw':!![]});var _0x31c9be=[{'model':db[_0x8934('0xb7')],'as':'Messages','attributes':['id','body',_0x8934('0x76'),_0x8934('0xcf'),_0x8934('0xd0'),_0x8934('0x7c')],'include':_0x3af94e}];_0x31c9be[_0x8934('0x35')]({'model':db[_0x8934('0xd1')],'as':_0x8934('0xd2'),'attributes':['id',_0x8934('0x2d')]});_0x31c9be[_0x8934('0x35')]({'model':db[_0x8934('0x6d')],'as':_0x8934('0xd3'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x8934('0x67')]({'where':{'id':_0x44cae5[_0x8934('0xb0')]['id']},'include':_0x31c9be})['then'](handleEntityNotFound(_0x216f7c,null))[_0x8934('0x29')](function(_0x35543d){if(_0x35543d){var _0x1cb741=_0x35543d['get']({'plain':!![]});fs[_0x8934('0xd4')](_0x3cfddb);var _0x279d54={'format':'A4','border':_0x8934('0xd5'),'header':{'height':_0x8934('0xd6'),'contents':{'first':_0x8934('0xd7')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x8934('0xcb')]('%s\x20#%d',_0x8934('0xd8'),_0x1cb741['id']),moment()[_0x8934('0xcb')](_0x8934('0xd9'))['toString']())}}};var _0x2913ad={'channel':'Sms','account':_0x1cb741[_0x8934('0xd2')][_0x8934('0x2d')],'agent':_0x1cb741['Owner']?_0x1cb741[_0x8934('0xd3')][_0x8934('0xda')]:_0x8934('0xdb'),'createdAt':moment(_0x1cb741[_0x8934('0x76')])[_0x8934('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8934('0x96')](),'closedAt':_0x1cb741[_0x8934('0xdc')]?moment(_0x1cb741[_0x8934('0xdd')])[_0x8934('0xcb')](_0x8934('0xde'))[_0x8934('0x96')]():'','disposition':_0x1cb741[_0x8934('0xdf')],'messages':_(_0x1cb741[_0x8934('0xe0')])[_0x8934('0x7f')]({'secret':![]})[_0x8934('0x30')](function(_0xc35284){return{'date':moment(_0xc35284[_0x8934('0x76')])[_0x8934('0xcb')](_0x8934('0xde'))[_0x8934('0x96')](),'sender':_0xc35284[_0x8934('0xcf')]===_0x8934('0xe1')?_0xc35284[_0x8934('0x6d')]?_0xc35284[_0x8934('0x6d')][_0x8934('0xda')]:_0x8934('0xe2'):_0xc35284[_0x8934('0x62')][_0x8934('0xe3')]+(_0xc35284[_0x8934('0x62')]['lastName']?'\x20'+_0xc35284[_0x8934('0x62')]['lastName']:''),'body':_0xc35284[_0x8934('0xb5')],'direction':_0xc35284['direction']===_0x8934('0xe1')?'A':'C','secret':_0xc35284[_0x8934('0xd0')],'read':_0xc35284['read']};})[_0x8934('0x5f')]()};return ejs[_0x8934('0xe4')](path['join'](config[_0x8934('0xc6')],'server',_0x8934('0xe5'),_0x8934('0xe6')),{'interaction':_0x2913ad})[_0x8934('0x29')](function(_0x35e54e){return new BPromise(function(_0x35b69d,_0x5d8e8e){pdf[_0x8934('0xb4')](_0x35e54e,_0x279d54)['toFile'](path[_0x8934('0xc5')](_0x3cfddb,'transcript-'+_0x1cb741['id']+'-'+_0x31c017+_0x8934('0xe7')),function(_0x36ede5,_0x3ae823){if(_0x36ede5)return _0x5d8e8e(_0x36ede5);_0x35b69d(_0x3ae823);});});})[_0x8934('0x29')](function(){return new BPromise(function(_0x4e53cd,_0x36740b){zipdir(_0x3cfddb,{'saveTo':_0x5bbb70},function(_0x25af33,_0x591acf){if(_0x25af33)return _0x36740b(_0x25af33);return _0x4e53cd(_0x591acf);});})[_0x8934('0x29')](function(){return new BPromise(function(_0xe50e0c,_0x508508){rimraf(_0x3cfddb,function(_0x7f8a86){if(_0x7f8a86)_0x508508(_0x7f8a86);return _0xe50e0c();});});})[_0x8934('0x29')](function(){return _0x216f7c[_0x8934('0xe8')](_0x5bbb70,_0x95754d,function(_0x4e26b1){if(_0x4e26b1){console[_0x8934('0xe9')](_0x8934('0xea'),_0x4e26b1);}else{fs['unlinkSync'](_0x5bbb70);}});});});}else{return _0x216f7c[_0x8934('0x1d')](0xc8);}})[_0x8934('0x36')](handleError(_0x216f7c,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e8ac590..8e4f8f1 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 _0x31af=['getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','update','remove'];(function(_0x3ec265,_0x33af97){var _0x3c4f10=function(_0x3a9991){while(--_0x3a9991){_0x3ec265['push'](_0x3ec265['shift']());}};_0x3c4f10(++_0x33af97);}(_0x31af,0xde));var _0xf31a=function(_0x185059,_0x41e209){_0x185059=_0x185059-0x0;var _0x4e1377=_0x31af[_0x185059];return _0x4e1377;};'use strict';var EventEmitter=require(_0xf31a('0x0'));var SmsInteraction=require(_0xf31a('0x1'))['db'][_0xf31a('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf31a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf31a('0x4'),'afterDestroy':_0xf31a('0x5')};function emitEvent(_0x820362){return function(_0x245db8,_0x5ad096,_0x8d7853){_0x245db8[_0xf31a('0x6')]({'attributes':['id'],'raw':!![]})[_0xf31a('0x7')](function(_0x1dc7cc){_0x245db8['setDataValue'](_0xf31a('0x8'),_0x1dc7cc[_0xf31a('0x9')](function(_0x410d44){return{'id':_0x410d44['id']};}));return SmsMessage[_0xf31a('0xa')]({'where':{'SmsInteractionId':_0x245db8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1c56e9){_0x245db8[_0xf31a('0xb')](_0xf31a('0xc'),_0x1c56e9[_0xf31a('0xd')]);SmsInteractionEvents[_0xf31a('0xe')](_0x820362+':'+_0x245db8['id'],_0x245db8);SmsInteractionEvents['emit'](_0x820362,_0x245db8);_0x8d7853(null);})[_0xf31a('0xf')](_0x8d7853(null));};}for(var e in events){if(events[_0xf31a('0x10')](e)){var event=events[e];SmsInteraction[_0xf31a('0x11')](e,emitEvent(event));}}module[_0xf31a('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x008c=['hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','map','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x008c,0x188));var _0xc008=function(_0x53b22e,_0x5e248f){_0x53b22e=_0x53b22e-0x0;var _0x14a0a4=_0x008c[_0x53b22e];return _0x14a0a4;};'use strict';var EventEmitter=require(_0xc008('0x0'));var SmsInteraction=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var SmsMessage=require(_0xc008('0x1'))['db'][_0xc008('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':_0xc008('0x5'),'afterDestroy':_0xc008('0x6')};function emitEvent(_0x163bd9){return function(_0x1cbe76,_0x1679e0,_0x13aa7){_0x1cbe76[_0xc008('0x7')]({'attributes':['id'],'raw':!![]})[_0xc008('0x8')](function(_0x4af530){_0x1cbe76[_0xc008('0x9')]('Users',_0x4af530[_0xc008('0xa')](function(_0x5b64f8){return{'id':_0x5b64f8['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1cbe76['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc008('0x8')](function(_0x7231b4){_0x1cbe76['setDataValue']('unreadMessages',_0x7231b4['length']);SmsInteractionEvents[_0xc008('0xb')](_0x163bd9+':'+_0x1cbe76['id'],_0x1cbe76);SmsInteractionEvents[_0xc008('0xb')](_0x163bd9,_0x1cbe76);_0x13aa7(null);})['catch'](_0x13aa7(null));};}for(var e in events){if(events[_0xc008('0xc')](e)){var event=events[e];SmsInteraction[_0xc008('0xd')](e,emitEvent(event));}}module[_0xc008('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index bfca2f2..91ee996 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 _0xa75e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x34ec72,_0x695f6c){var _0x285481=function(_0x35abcd){while(--_0x35abcd){_0x34ec72['push'](_0x34ec72['shift']());}};_0x285481(++_0x695f6c);}(_0xa75e,0x1c2));var _0xea75=function(_0x30a848,_0x408ca5){_0x30a848=_0x30a848-0x0;var _0x5d2369=_0xa75e[_0x30a848];return _0x5d2369;};'use strict';var _=require(_0xea75('0x0'));var util=require(_0xea75('0x1'));var logger=require(_0xea75('0x2'))(_0xea75('0x3'));var moment=require(_0xea75('0x4'));var BPromise=require(_0xea75('0x5'));var rp=require(_0xea75('0x6'));var fs=require('fs');var path=require(_0xea75('0x7'));var rimraf=require('rimraf');var config=require(_0xea75('0x8'));var attributes=require('./smsInteraction.attributes');module[_0xea75('0x9')]=function(_0x3711a6,_0x386095){return _0x3711a6[_0xea75('0xa')](_0xea75('0xb'),attributes,{'tableName':_0xea75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f15d4,_0x2dd828,_0x5e4ccd){if(_0x3f15d4[_0xea75('0xd')](_0xea75('0xe'))){_0x3f15d4[_0xea75('0xf')]=moment()[_0xea75('0x10')](_0xea75('0x11'));}_0x5e4ccd(null,_0x3f15d4);}}});}; \ No newline at end of file +var _0x9f99=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x9f99,0x197));var _0x99f9=function(_0x232d09,_0x30a518){_0x232d09=_0x232d09-0x0;var _0x454385=_0x9f99[_0x232d09];return _0x454385;};'use strict';var _=require(_0x99f9('0x0'));var util=require(_0x99f9('0x1'));var logger=require(_0x99f9('0x2'))(_0x99f9('0x3'));var moment=require(_0x99f9('0x4'));var BPromise=require('bluebird');var rp=require(_0x99f9('0x5'));var fs=require('fs');var path=require(_0x99f9('0x6'));var rimraf=require(_0x99f9('0x7'));var config=require(_0x99f9('0x8'));var attributes=require(_0x99f9('0x9'));module['exports']=function(_0x181d35,_0xa13858){return _0x181d35[_0x99f9('0xa')](_0x99f9('0xb'),attributes,{'tableName':_0x99f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f2ccc,_0x40c9c7,_0x34fc8b){if(_0x4f2ccc[_0x99f9('0xd')]('closed')){_0x4f2ccc[_0x99f9('0xe')]=moment()[_0x99f9('0xf')](_0x99f9('0x10'));}_0x34fc8b(null,_0x4f2ccc);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b8e2cad..279fbbb 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 _0x474d=['ioredis','../../config/logger','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','then','find','body','ids','omit','spread','AddTags','util','bluebird','randomstring'];(function(_0x4afeb5,_0x261b51){var _0x3aecda=function(_0x38e2a5){while(--_0x38e2a5){_0x4afeb5['push'](_0x4afeb5['shift']());}};_0x3aecda(++_0x261b51);}(_0x474d,0xcf));var _0xd474=function(_0x47e79d,_0x12c8d9){_0x47e79d=_0x47e79d-0x0;var _0x2da982=_0x474d[_0x47e79d];return _0x2da982;};'use strict';var _=require('lodash');var util=require(_0xd474('0x0'));var moment=require('moment');var BPromise=require(_0xd474('0x1'));var rs=require(_0xd474('0x2'));var fs=require('fs');var Redis=require(_0xd474('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd474('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd474('0x5')]=_['defaults'](config[_0xd474('0x5')],{'host':_0xd474('0x6'),'port':0x18eb});var socket=require(_0xd474('0x7'))(new Redis(config['redis']));require(_0xd474('0x8'))[_0xd474('0x9')](socket);function respondWithRpcPromise(_0x30c9f9,_0x357394,_0x4587db){return new BPromise(function(_0x5276af,_0x26d56a){return client['request'](_0x30c9f9,_0x4587db)['then'](function(_0x34dd70){logger[_0xd474('0xa')](_0xd474('0xb'),_0x357394,_0xd474('0xc'));logger[_0xd474('0xd')](_0xd474('0xe'),_0x357394,_0xd474('0xc'),JSON[_0xd474('0xf')](_0x34dd70));if(_0x34dd70[_0xd474('0x10')]){if(_0x34dd70[_0xd474('0x10')][_0xd474('0x11')]===0x1f4){logger[_0xd474('0x10')](_0xd474('0xb'),_0x357394,_0x34dd70[_0xd474('0x10')][_0xd474('0x12')]);return _0x26d56a(_0x34dd70['error']['message']);}logger[_0xd474('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x357394,_0x34dd70[_0xd474('0x10')][_0xd474('0x12')]);return _0x5276af(_0x34dd70['error'][_0xd474('0x12')]);}else{logger[_0xd474('0xa')](_0xd474('0xb'),_0x357394,'request\x20sent');_0x5276af(_0x34dd70[_0xd474('0x13')][_0xd474('0x12')]);}})[_0xd474('0x14')](function(_0x193f73){logger['error'](_0xd474('0xb'),_0x357394,_0x193f73);_0x26d56a(_0x193f73);});});}exports[_0xd474('0x15')]=function(_0x2ab322){var _0x430fe3=this;return new Promise(function(_0x2f63c8,_0x200a69){return db[_0xd474('0x16')][_0xd474('0x17')](_0x2ab322['body'],{'raw':_0x2ab322[_0xd474('0x18')]?_0x2ab322[_0xd474('0x18')][_0xd474('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab322[_0xd474('0x18')]?_0x2ab322['options'][_0xd474('0x1a')]||null:null,'attributes':_0x2ab322[_0xd474('0x18')]?_0x2ab322[_0xd474('0x18')][_0xd474('0x1b')]||null:null,'limit':_0x2ab322[_0xd474('0x18')]?_0x2ab322[_0xd474('0x18')]['limit']||null:null})[_0xd474('0x1c')](function(_0x836b48){logger[_0xd474('0xa')](_0xd474('0x15'),_0x2ab322);logger[_0xd474('0xd')](_0xd474('0x15'),_0x2ab322,JSON[_0xd474('0xf')](_0x836b48));_0x2f63c8(_0x836b48);})[_0xd474('0x14')](function(_0x1b984f){logger[_0xd474('0x10')]('UpdateSmsInteraction',_0x1b984f[_0xd474('0x12')],_0x2ab322);_0x200a69(_0x430fe3[_0xd474('0x10')](0x1f4,_0x1b984f[_0xd474('0x12')]));});});};exports['AddTagsToSmsInteraction']=function(_0x18b8bb){return new Promise(function(_0x837d50,_0x823e97){return db['SmsInteraction'][_0xd474('0x1d')]({'where':_0x18b8bb[_0xd474('0x18')]?_0x18b8bb[_0xd474('0x18')][_0xd474('0x1a')]||null:null})[_0xd474('0x1c')](function(_0x3d67b4){if(_0x3d67b4){return _0x3d67b4['addTags'](_0x18b8bb[_0xd474('0x1e')][_0xd474('0x1f')],_[_0xd474('0x20')](_0x18b8bb['body'],[_0xd474('0x1f'),'id'])||{});}})[_0xd474('0x21')](function(_0x230bf8){logger['info'](_0xd474('0x22'),_0x18b8bb);logger['debug'](_0xd474('0x22'),_0x18b8bb,JSON['stringify'](_0x230bf8));_0x837d50(_0x230bf8);})[_0xd474('0x14')](function(_0x2f1683){logger[_0xd474('0x10')](_0xd474('0x22'),_0x2f1683[_0xd474('0x12')],_0x18b8bb);_0x823e97(_this[_0xd474('0x10')](0x1f4,_0x2f1683[_0xd474('0x12')]));});});}; \ No newline at end of file +var _0x4f61=['body','options','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsInteraction','update'];(function(_0x11216a,_0x4a052e){var _0x3f9389=function(_0x48a3fa){while(--_0x48a3fa){_0x11216a['push'](_0x11216a['shift']());}};_0x3f9389(++_0x4a052e);}(_0x4f61,0x149));var _0x14f6=function(_0x5ddaaa,_0x5f0453){_0x5ddaaa=_0x5ddaaa-0x0;var _0x4ca0c0=_0x4f61[_0x5ddaaa];return _0x4ca0c0;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var moment=require(_0x14f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x14f6('0x3'));var fs=require('fs');var Redis=require(_0x14f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x14f6('0x5'));var logger=require(_0x14f6('0x6'))(_0x14f6('0x7'));var config=require(_0x14f6('0x8'));var jayson=require(_0x14f6('0x9'));var client=jayson[_0x14f6('0xa')]['http']({'port':0x232a});config[_0x14f6('0xb')]=_[_0x14f6('0xc')](config[_0x14f6('0xb')],{'host':_0x14f6('0xd'),'port':0x18eb});var socket=require(_0x14f6('0xe'))(new Redis(config['redis']));require(_0x14f6('0xf'))[_0x14f6('0x10')](socket);function respondWithRpcPromise(_0x466ecc,_0x54c0d4,_0x16d43c){return new BPromise(function(_0x45cbd3,_0x522fe5){return client[_0x14f6('0x11')](_0x466ecc,_0x16d43c)[_0x14f6('0x12')](function(_0x3f8a46){logger[_0x14f6('0x13')](_0x14f6('0x14'),_0x54c0d4,'request\x20sent');logger[_0x14f6('0x15')](_0x14f6('0x16'),_0x54c0d4,_0x14f6('0x17'),JSON[_0x14f6('0x18')](_0x3f8a46));if(_0x3f8a46[_0x14f6('0x19')]){if(_0x3f8a46[_0x14f6('0x19')]['code']===0x1f4){logger[_0x14f6('0x19')](_0x14f6('0x14'),_0x54c0d4,_0x3f8a46['error'][_0x14f6('0x1a')]);return _0x522fe5(_0x3f8a46[_0x14f6('0x19')][_0x14f6('0x1a')]);}logger[_0x14f6('0x19')](_0x14f6('0x14'),_0x54c0d4,_0x3f8a46[_0x14f6('0x19')][_0x14f6('0x1a')]);return _0x45cbd3(_0x3f8a46[_0x14f6('0x19')][_0x14f6('0x1a')]);}else{logger[_0x14f6('0x13')](_0x14f6('0x14'),_0x54c0d4,'request\x20sent');_0x45cbd3(_0x3f8a46[_0x14f6('0x1b')][_0x14f6('0x1a')]);}})[_0x14f6('0x1c')](function(_0x1c841a){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x54c0d4,_0x1c841a);_0x522fe5(_0x1c841a);});});}exports['UpdateSmsInteraction']=function(_0x16a9b8){var _0x1dae57=this;return new Promise(function(_0x535203,_0x165ede){return db[_0x14f6('0x1d')][_0x14f6('0x1e')](_0x16a9b8[_0x14f6('0x1f')],{'raw':_0x16a9b8['options']?_0x16a9b8[_0x14f6('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a9b8[_0x14f6('0x20')]?_0x16a9b8[_0x14f6('0x20')]['where']||null:null,'attributes':_0x16a9b8[_0x14f6('0x20')]?_0x16a9b8['options'][_0x14f6('0x21')]||null:null,'limit':_0x16a9b8['options']?_0x16a9b8[_0x14f6('0x20')][_0x14f6('0x22')]||null:null})[_0x14f6('0x12')](function(_0x56439a){logger['info'](_0x14f6('0x23'),_0x16a9b8);logger[_0x14f6('0x15')]('UpdateSmsInteraction',_0x16a9b8,JSON['stringify'](_0x56439a));_0x535203(_0x56439a);})[_0x14f6('0x1c')](function(_0x63f73e){logger[_0x14f6('0x19')](_0x14f6('0x23'),_0x63f73e[_0x14f6('0x1a')],_0x16a9b8);_0x165ede(_0x1dae57[_0x14f6('0x19')](0x1f4,_0x63f73e[_0x14f6('0x1a')]));});});};exports[_0x14f6('0x24')]=function(_0x35acd){return new Promise(function(_0x4306a0,_0x2ca235){return db[_0x14f6('0x1d')][_0x14f6('0x25')]({'where':_0x35acd['options']?_0x35acd['options']['where']||null:null})[_0x14f6('0x12')](function(_0x3481ba){if(_0x3481ba){return _0x3481ba['addTags'](_0x35acd[_0x14f6('0x1f')]['ids'],_[_0x14f6('0x26')](_0x35acd['body'],['ids','id'])||{});}})['spread'](function(_0x100ce0){logger['info']('AddTags',_0x35acd);logger[_0x14f6('0x15')](_0x14f6('0x27'),_0x35acd,JSON['stringify'](_0x100ce0));_0x4306a0(_0x100ce0);})[_0x14f6('0x1c')](function(_0x3bfd88){logger[_0x14f6('0x19')](_0x14f6('0x27'),_0x3bfd88['message'],_0x35acd);_0x2ca235(_this[_0x14f6('0x19')](0x1f4,_0x3bfd88[_0x14f6('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 30122a2..7f9e803 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x2032,0xd9));var _0x2203=function(_0x5d7e56,_0x17bef9){_0x5d7e56=_0x5d7e56-0x0;var _0x16189a=_0x2032[_0x5d7e56];return _0x16189a;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0x332bcd,_0x515bfc){var _0x3fc099=function(_0x184be5){while(--_0x184be5){_0x332bcd['push'](_0x332bcd['shift']());}};_0x3fc099(++_0x515bfc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var SmsInteractionEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){SmsInteractionEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('smsInteraction:'+_0x413284,_0x3f8b6f);SmsInteractionEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b1ab8aa..4217e37 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 _0x1660=['smsmessage:create','create','post','/:id/status','status','put','/:id','update','accept','/:id/reject','reject','destroy','util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','show'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x1660,0x12a));var _0x0166=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x1660[_0x1a72f3];return _0x57ef47;};'use strict';var multer=require('multer');var util=require(_0x0166('0x0'));var path=require(_0x0166('0x1'));var timeout=require(_0x0166('0x2'));var express=require(_0x0166('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0166('0x4'));var controller=require('./smsMessage.controller');router[_0x0166('0x5')]('/',auth[_0x0166('0x6')](),controller[_0x0166('0x7')]);router[_0x0166('0x5')](_0x0166('0x8'),auth[_0x0166('0x6')](),controller['describe']);router[_0x0166('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x0166('0x9')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x0166('0xa')),controller[_0x0166('0xb')]);router[_0x0166('0xc')](_0x0166('0xd'),controller[_0x0166('0xe')]);router[_0x0166('0xf')](_0x0166('0x10'),auth[_0x0166('0x6')](),controller[_0x0166('0x11')]);router[_0x0166('0xf')]('/:id/accept',auth['isAuthenticated'](),controller[_0x0166('0x12')]);router['put'](_0x0166('0x13'),auth[_0x0166('0x6')](),controller[_0x0166('0x14')]);router['delete'](_0x0166('0x10'),auth[_0x0166('0x6')](),controller[_0x0166('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc11b=['index','describe','/:id','show','post','tracked','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x11dadd,_0xfc7365){var _0x1350d0=function(_0x18a7ab){while(--_0x18a7ab){_0x11dadd['push'](_0x11dadd['shift']());}};_0x1350d0(++_0xfc7365);}(_0xc11b,0x13b));var _0xbc11=function(_0x2a2380,_0x32eee0){_0x2a2380=_0x2a2380-0x0;var _0x3cfca1=_0xc11b[_0x2a2380];return _0x3cfca1;};'use strict';var multer=require('multer');var util=require(_0xbc11('0x0'));var path=require('path');var timeout=require(_0xbc11('0x1'));var express=require('express');var router=express[_0xbc11('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc11('0x3'));var config=require(_0xbc11('0x4'));var controller=require('./smsMessage.controller');router[_0xbc11('0x5')]('/',auth[_0xbc11('0x6')](),controller[_0xbc11('0x7')]);router['get']('/describe',auth[_0xbc11('0x6')](),controller[_0xbc11('0x8')]);router['get'](_0xbc11('0x9'),auth[_0xbc11('0x6')](),controller[_0xbc11('0xa')]);router[_0xbc11('0xb')]('/',auth[_0xbc11('0x6')](),interaction[_0xbc11('0xc')]('sms','smsmessage:create'),controller['create']);router[_0xbc11('0xb')]('/:id/status',controller[_0xbc11('0xd')]);router[_0xbc11('0xe')](_0xbc11('0x9'),auth[_0xbc11('0x6')](),controller[_0xbc11('0xf')]);router[_0xbc11('0xe')](_0xbc11('0x10'),auth[_0xbc11('0x6')](),controller[_0xbc11('0x11')]);router[_0xbc11('0xe')](_0xbc11('0x12'),auth[_0xbc11('0x6')](),controller[_0xbc11('0x13')]);router[_0xbc11('0x14')](_0xbc11('0x9'),auth['isAuthenticated'](),controller[_0xbc11('0x15')]);module[_0xbc11('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 07b6fa0..8529a46 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 _0xf858=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x11ec0d,_0x47a66c){var _0x55498=function(_0x5513f9){while(--_0x5513f9){_0x11ec0d['push'](_0x11ec0d['shift']());}};_0x55498(++_0x47a66c);}(_0xf858,0xb1));var _0x8f85=function(_0x587345,_0x501c9e){_0x587345=_0x587345-0x0;var _0x2dc171=_0xf858[_0x587345];return _0x2dc171;};'use strict';var Sequelize=require('sequelize');module[_0x8f85('0x0')]={'body':{'type':Sequelize[_0x8f85('0x1')](_0x8f85('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8f85('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8f85('0x4')]('in','out'),'defaultValue':_0x8f85('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8f85('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8f85('0x6')]},'readAt':{'type':Sequelize[_0x8f85('0x7')]},'secret':{'type':Sequelize[_0x8f85('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6418=['BOOLEAN','ENUM','out','STRING','DATE','exports','medium'];(function(_0x4256c5,_0x288cee){var _0x3c8bfd=function(_0x5471f1){while(--_0x5471f1){_0x4256c5['push'](_0x4256c5['shift']());}};_0x3c8bfd(++_0x288cee);}(_0x6418,0xfa));var _0x8641=function(_0x3c6ca4,_0xc681ef){_0x3c6ca4=_0x3c6ca4-0x0;var _0x2f3637=_0x6418[_0x3c6ca4];return _0x2f3637;};'use strict';var Sequelize=require('sequelize');module[_0x8641('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8641('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8641('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8641('0x3')]('in',_0x8641('0x4')),'defaultValue':_0x8641('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8641('0x5')](0xbe)},'phone':{'type':Sequelize[_0x8641('0x5')]},'readAt':{'type':Sequelize[_0x8641('0x6')]},'secret':{'type':Sequelize[_0x8641('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2af19ef..83de024 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 _0x7ec2=['fields','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','sms-interactions','accept','sms','read','readAt','format','UserId','CmContact','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','reject','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','model','keys','query','intersection','attributes'];(function(_0x59a664,_0x400379){var _0x195248=function(_0x380bcf){while(--_0x380bcf){_0x59a664['push'](_0x59a664['shift']());}};_0x195248(++_0x400379);}(_0x7ec2,0x15c));var _0x27ec=function(_0x4045ce,_0x2d87b2){_0x4045ce=_0x4045ce-0x0;var _0x26e4bf=_0x7ec2[_0x4045ce];return _0x26e4bf;};'use strict';var pdf=require(_0x27ec('0x0'));var emlformat=require(_0x27ec('0x1'));var rimraf=require(_0x27ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27ec('0x3'));var rp=require(_0x27ec('0x4'));var moment=require('moment');var BPromise=require(_0x27ec('0x5'));var Mustache=require(_0x27ec('0x6'));var util=require(_0x27ec('0x7'));var path=require(_0x27ec('0x8'));var sox=require(_0x27ec('0x9'));var csv=require(_0x27ec('0xa'));var ejs=require(_0x27ec('0xb'));var fs=require('fs');var _=require(_0x27ec('0xc'));var squel=require(_0x27ec('0xd'));var crypto=require(_0x27ec('0xe'));var jsforce=require(_0x27ec('0xf'));var deskjs=require(_0x27ec('0x10'));var toCsv=require(_0x27ec('0xa'));var querystring=require(_0x27ec('0x11'));var Papa=require(_0x27ec('0x12'));var Redis=require(_0x27ec('0x13'));var authService=require(_0x27ec('0x14'));var qs=require(_0x27ec('0x15'));var as=require(_0x27ec('0x16'));var hardwareService=require(_0x27ec('0x17'));var logger=require(_0x27ec('0x18'))('api');var utils=require(_0x27ec('0x19'));var config=require(_0x27ec('0x1a'));var db=require(_0x27ec('0x1b'))['db'];config[_0x27ec('0x1c')]=_['defaults'](config[_0x27ec('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x27ec('0x1d'))(new Redis(config[_0x27ec('0x1c')]));require(_0x27ec('0x1e'))[_0x27ec('0x1f')](socket);var jayson=require(_0x27ec('0x20'));var client=jayson[_0x27ec('0x21')][_0x27ec('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x27ec('0x22')]({'port':0x232a});function checkPasswordPattern(_0x1d75b1,_0x486dae,_0x56bf7d){if(_0x56bf7d){var _0x26f35a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26f35a['test'](_0x486dae)){return _0x1d75b1;}else{throw new db[(_0x27ec('0x23'))][(_0x27ec('0x24'))](_0x27ec('0x25'));}}else{return _0x1d75b1;}}function respondWithRpcPromise(_0x2dec35,_0x54b2c9,_0x24b9be,_0x389425){return new BPromise(function(_0x3ce529,_0x5ac6cd){var _0x37210b=_0x389425||client;return _0x37210b[_0x27ec('0x26')](_0x2dec35,_0x24b9be)['then'](function(_0x264e6a){logger[_0x27ec('0x27')]('SmsMessage,\x20%s,\x20%s',_0x54b2c9,'request\x20sent');logger[_0x27ec('0x28')](_0x27ec('0x29'),_0x54b2c9,_0x27ec('0x2a'),JSON[_0x27ec('0x2b')](_0x264e6a));if(_0x264e6a[_0x27ec('0x2c')]){if(_0x264e6a['error'][_0x27ec('0x2d')]===0x1f4){logger[_0x27ec('0x2c')](_0x27ec('0x2e'),_0x54b2c9,_0x264e6a[_0x27ec('0x2c')]['message']);return _0x5ac6cd(_0x264e6a['error'][_0x27ec('0x2f')]);}logger['error'](_0x27ec('0x2e'),_0x54b2c9,_0x264e6a[_0x27ec('0x2c')]['message']);return _0x3ce529(_0x264e6a[_0x27ec('0x2c')][_0x27ec('0x2f')]);}else{logger[_0x27ec('0x27')]('SmsMessage,\x20%s,\x20%s',_0x54b2c9,'request\x20sent');_0x3ce529(_0x264e6a[_0x27ec('0x30')]['message']);}})['catch'](function(_0x486550){logger['error'](_0x27ec('0x2e'),_0x54b2c9,_0x486550);_0x5ac6cd(_0x486550);});});}function respondWithStatusCode(_0xf1ee48,_0x151df3){_0x151df3=_0x151df3||0xcc;return function(_0x299ecf){if(_0x299ecf){return _0xf1ee48[_0x27ec('0x31')](_0x151df3);}return _0xf1ee48[_0x27ec('0x32')](_0x151df3)[_0x27ec('0x33')]();};}function respondWithResult(_0x471a9b,_0x52d906){_0x52d906=_0x52d906||0xc8;return function(_0x3c8fd2){if(_0x3c8fd2){return _0x471a9b[_0x27ec('0x32')](_0x52d906)['json'](_0x3c8fd2);}};}function respondWithFilteredResult(_0x3cb2ae,_0x389389){return function(_0x45d2df){if(_0x45d2df){var _0x34138d=_0x45d2df[_0x27ec('0x34')],_0xf8c72=_0x389389[_0x27ec('0x35')],_0x3a564a=_0x389389[_0x27ec('0x35')]+_0x389389[_0x27ec('0x36')],_0x2d879b;if(_0x3a564a>=_0x34138d){_0x3a564a=_0x34138d;_0x2d879b=0xc8;}else{_0x2d879b=0xce;}_0x3cb2ae['status'](_0x2d879b);return _0x3cb2ae[_0x27ec('0x37')]('Content-Range',_0xf8c72+'-'+_0x3a564a+'/'+_0x34138d)['json'](_0x45d2df);}return null;};}function patchUpdates(_0x5feb8f){return function(_0x2f4a3e){try{jsonpatch['apply'](_0x2f4a3e,_0x5feb8f,!![]);}catch(_0x23c9de){return BPromise[_0x27ec('0x38')](_0x23c9de);}return _0x2f4a3e['save']();};}function saveUpdates(_0x4ab82a,_0x1a2e00){return function(_0xd28859){if(_0xd28859){return _0xd28859['update'](_0x4ab82a)[_0x27ec('0x39')](function(_0x4ba2f3){return _0x4ba2f3;});}return null;};}function removeEntity(_0xcaa2f8,_0x53771a){return function(_0x165c14){if(_0x165c14){return _0x165c14[_0x27ec('0x3a')]()['then'](function(){_0xcaa2f8[_0x27ec('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecfa8,_0x255a14){return function(_0x10c7fa){if(!_0x10c7fa){_0x3ecfa8[_0x27ec('0x31')](0x194);}return _0x10c7fa;};}function handleError(_0x400ff4,_0x381c16){_0x381c16=_0x381c16||0x1f4;return function(_0xef7ff7){logger['error'](_0xef7ff7[_0x27ec('0x3b')]);if(_0xef7ff7[_0x27ec('0x3c')]){delete _0xef7ff7[_0x27ec('0x3c')];}_0x400ff4[_0x27ec('0x32')](_0x381c16)[_0x27ec('0x3d')](_0xef7ff7);};}exports[_0x27ec('0x3e')]=function(_0x32cfd7,_0x11f2f6){var _0x3357c3={},_0x445bf0={},_0x23f4d8={'count':0x0,'rows':[]};var _0x407cda=_[_0x27ec('0x3f')](db[_0x27ec('0x40')][_0x27ec('0x41')],function(_0x316e1f){return{'name':_0x316e1f['fieldName'],'type':_0x316e1f[_0x27ec('0x42')]['key']};});_0x445bf0[_0x27ec('0x43')]=_[_0x27ec('0x3f')](_0x407cda,'name');_0x445bf0['query']=_[_0x27ec('0x44')](_0x32cfd7[_0x27ec('0x45')]);_0x445bf0['filters']=_[_0x27ec('0x46')](_0x445bf0[_0x27ec('0x43')],_0x445bf0[_0x27ec('0x45')]);_0x3357c3[_0x27ec('0x47')]=_[_0x27ec('0x46')](_0x445bf0[_0x27ec('0x43')],qs[_0x27ec('0x48')](_0x32cfd7[_0x27ec('0x45')][_0x27ec('0x48')]));_0x3357c3[_0x27ec('0x47')]=_0x3357c3[_0x27ec('0x47')][_0x27ec('0x49')]?_0x3357c3[_0x27ec('0x47')]:_0x445bf0[_0x27ec('0x43')];if(!_0x32cfd7['query']['hasOwnProperty'](_0x27ec('0x4a'))){_0x3357c3['limit']=qs[_0x27ec('0x36')](_0x32cfd7[_0x27ec('0x45')][_0x27ec('0x36')]);_0x3357c3[_0x27ec('0x35')]=qs[_0x27ec('0x35')](_0x32cfd7[_0x27ec('0x45')][_0x27ec('0x35')]);}_0x3357c3[_0x27ec('0x4b')]=qs['sort'](_0x32cfd7[_0x27ec('0x45')][_0x27ec('0x4c')]);_0x3357c3[_0x27ec('0x4d')]=qs[_0x27ec('0x4e')](_[_0x27ec('0x4f')](_0x32cfd7[_0x27ec('0x45')],_0x445bf0['filters']),_0x407cda);if(_0x32cfd7[_0x27ec('0x45')][_0x27ec('0x50')]){_0x3357c3[_0x27ec('0x4d')]=_['merge'](_0x3357c3[_0x27ec('0x4d')],{'$or':_[_0x27ec('0x3f')](_0x407cda,function(_0x84a930){if(_0x84a930[_0x27ec('0x42')]!=='VIRTUAL'){var _0x2ab727={};_0x2ab727[_0x84a930[_0x27ec('0x3c')]]={'$like':'%'+_0x32cfd7['query'][_0x27ec('0x50')]+'%'};return _0x2ab727;}})});}_0x3357c3=_[_0x27ec('0x51')]({},_0x3357c3,_0x32cfd7['options']);var _0x19acce={'where':_0x3357c3[_0x27ec('0x4d')]};return db[_0x27ec('0x40')][_0x27ec('0x34')](_0x19acce)[_0x27ec('0x39')](function(_0x2ec281){_0x23f4d8[_0x27ec('0x34')]=_0x2ec281;if(_0x32cfd7[_0x27ec('0x45')][_0x27ec('0x52')]){_0x3357c3[_0x27ec('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0x27ec('0x54')](_0x3357c3);})[_0x27ec('0x39')](function(_0x3bbc5a){_0x23f4d8[_0x27ec('0x55')]=_0x3bbc5a;return _0x23f4d8;})[_0x27ec('0x39')](respondWithFilteredResult(_0x11f2f6,_0x3357c3))[_0x27ec('0x56')](handleError(_0x11f2f6,null));};exports[_0x27ec('0x57')]=function(_0x469481,_0x12b148){var _0x3ff61f={'raw':!![],'where':{'id':_0x469481[_0x27ec('0x58')]['id']}},_0x43fe25={};_0x43fe25[_0x27ec('0x43')]=_['keys'](db[_0x27ec('0x40')][_0x27ec('0x41')]);_0x43fe25[_0x27ec('0x45')]=_[_0x27ec('0x44')](_0x469481[_0x27ec('0x45')]);_0x43fe25[_0x27ec('0x4e')]=_[_0x27ec('0x46')](_0x43fe25[_0x27ec('0x43')],_0x43fe25['query']);_0x3ff61f['attributes']=_['intersection'](_0x43fe25['model'],qs[_0x27ec('0x48')](_0x469481['query'][_0x27ec('0x48')]));_0x3ff61f[_0x27ec('0x47')]=_0x3ff61f[_0x27ec('0x47')][_0x27ec('0x49')]?_0x3ff61f[_0x27ec('0x47')]:_0x43fe25[_0x27ec('0x43')];if(_0x469481[_0x27ec('0x45')][_0x27ec('0x52')]){_0x3ff61f[_0x27ec('0x53')]=[{'all':!![]}];}_0x3ff61f=_[_0x27ec('0x51')]({},_0x3ff61f,_0x469481[_0x27ec('0x59')]);return db['SmsMessage'][_0x27ec('0x5a')](_0x3ff61f)[_0x27ec('0x39')](handleEntityNotFound(_0x12b148,null))[_0x27ec('0x39')](respondWithResult(_0x12b148,null))[_0x27ec('0x56')](handleError(_0x12b148,null));};exports['create']=function(_0x45ece3,_0x1d20c7){return db['SmsMessage'][_0x27ec('0x5b')](_0x45ece3[_0x27ec('0x5c')],{})['then'](respondWithResult(_0x1d20c7,0xc9))[_0x27ec('0x56')](handleError(_0x1d20c7,null));};exports[_0x27ec('0x5d')]=function(_0x1d00d6,_0x291c9d){if(_0x1d00d6[_0x27ec('0x5c')]['id']){delete _0x1d00d6[_0x27ec('0x5c')]['id'];}return db[_0x27ec('0x40')][_0x27ec('0x5a')]({'where':{'id':_0x1d00d6[_0x27ec('0x58')]['id']}})[_0x27ec('0x39')](handleEntityNotFound(_0x291c9d,null))['then'](saveUpdates(_0x1d00d6[_0x27ec('0x5c')],null))[_0x27ec('0x39')](respondWithResult(_0x291c9d,null))[_0x27ec('0x56')](handleError(_0x291c9d,null));};exports[_0x27ec('0x3a')]=function(_0x593e3a,_0x1436fa){return db[_0x27ec('0x40')][_0x27ec('0x5a')]({'where':{'id':_0x593e3a[_0x27ec('0x58')]['id']}})[_0x27ec('0x39')](handleEntityNotFound(_0x1436fa,null))['then'](removeEntity(_0x1436fa,null))[_0x27ec('0x56')](handleError(_0x1436fa,null));};exports['describe']=function(_0x378f86,_0x3f0df6){return db[_0x27ec('0x40')][_0x27ec('0x5e')]()[_0x27ec('0x39')](respondWithResult(_0x3f0df6,null))[_0x27ec('0x56')](handleError(_0x3f0df6,null));};var interaction_log=require(_0x27ec('0x18'))(_0x27ec('0x5f'));exports[_0x27ec('0x60')]=function(_0x3e9288,_0x1291f4,_0x45d92){var _0x1a6e50={'channel':_0x27ec('0x61')};if(_0x3e9288[_0x27ec('0x5c')]['id']){delete _0x3e9288[_0x27ec('0x5c')]['id'];}_0x3e9288['body'][_0x27ec('0x62')]=!![];_0x3e9288[_0x27ec('0x5c')][_0x27ec('0x63')]=moment()[_0x27ec('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e9288[_0x27ec('0x5c')][_0x27ec('0x65')]=_0x3e9288[_0x27ec('0x5c')]['UserId']||_0x3e9288['user']['id'];return db[_0x27ec('0x40')][_0x27ec('0x5a')]({'where':{'id':_0x3e9288['params']['id'],'UserId':null},'include':[{'model':db[_0x27ec('0x66')],'as':_0x27ec('0x67')}]})[_0x27ec('0x39')](handleEntityNotFound(_0x1291f4,null))['then'](saveUpdates(_0x3e9288[_0x27ec('0x5c')],null))[_0x27ec('0x39')](function(_0x4a9b39){if(_0x4a9b39){_0x1a6e50[_0x27ec('0x2f')]=_0x4a9b39[_0x27ec('0x68')]({'plain':!![]});return db['SmsInteraction'][_0x27ec('0x5a')]({'where':{'id':_0x4a9b39[_0x27ec('0x69')]}});}return null;})[_0x27ec('0x39')](handleEntityNotFound(_0x1291f4,null))[_0x27ec('0x39')](function(_0x1a5dcc){if(_0x1a5dcc){return _0x1a5dcc['update']({'UserId':_0x3e9288['body'][_0x27ec('0x65')],'read1stAt':_[_0x27ec('0x6a')](_0x1a5dcc[_0x27ec('0x6b')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x27ec('0x39')](function(_0x45a3b2){if(_0x45a3b2){_0x1a6e50[_0x27ec('0x6c')]=_0x45a3b2[_0x27ec('0x68')]({'plain':!![]});interaction_log[_0x27ec('0x27')](_0x27ec('0x6d'),_0x3e9288[_0x27ec('0x6e')]['id'],_0x3e9288[_0x27ec('0x6e')]['name'],_0x3e9288[_0x27ec('0x6e')][_0x27ec('0x6f')],_0x1a6e50[_0x27ec('0x6c')]['id'],_0x3e9288['body']?JSON['stringify'](_0x3e9288[_0x27ec('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage',_0x27ec('0x70'),_0x1a6e50);}return null;})['then'](function(_0x2e7353){if(_0x2e7353){if(_0x3e9288[_0x27ec('0x5c')][_0x27ec('0x71')]){_0x1a6e50[_0x27ec('0x2f')][_0x27ec('0x72')]=util['format'](_0x27ec('0x73'),_0x3e9288[_0x27ec('0x6e')][_0x27ec('0x3c')]);_0x1a6e50[_0x27ec('0x2f')][_0x27ec('0x74')]=_0x1a6e50[_0x27ec('0x74')];_0x1a6e50[_0x27ec('0x2f')][_0x27ec('0x75')]='accept';return respondWithRpcPromise(_0x27ec('0x76'),_0x27ec('0x76'),{'event':'acceptmessage','message':_0x1a6e50[_0x27ec('0x2f')]},client9002)['then'](function(){return _0x1a6e50;});}return _0x1a6e50;}return null;})['then'](respondWithResult(_0x1291f4,null))[_0x27ec('0x56')](handleError(_0x1291f4,null));};var interaction_log=require(_0x27ec('0x18'))(_0x27ec('0x5f'));exports[_0x27ec('0x38')]=function(_0xe70a9b,_0x1acacf,_0x11997b){var _0x11f1b2={'agent':{},'channel':_0x27ec('0x61')};if(_0xe70a9b[_0x27ec('0x5c')]['id']){delete _0xe70a9b['body']['id'];}_0xe70a9b[_0x27ec('0x5c')]['UserId']=_0xe70a9b[_0x27ec('0x5c')][_0x27ec('0x65')]||_0xe70a9b[_0x27ec('0x6e')]['id'];_0x11f1b2[_0x27ec('0x77')]['id']=_0xe70a9b['body']['UserId'];return db[_0x27ec('0x40')]['find']({'where':{'id':_0xe70a9b[_0x27ec('0x58')]['id'],'UserId':null}})[_0x27ec('0x39')](handleEntityNotFound(_0x1acacf,null))['then'](function(_0x365c9e){if(_0x365c9e){_0x11f1b2[_0x27ec('0x2f')]=_0x365c9e[_0x27ec('0x68')]({'plain':!![]});return db['SmsInteraction'][_0x27ec('0x5a')]({'where':{'id':_0x365c9e['SmsInteractionId']}});}return null;})[_0x27ec('0x39')](handleEntityNotFound(_0x1acacf,null))['then'](function(_0x41ee44){if(_0x41ee44){_0x11f1b2[_0x27ec('0x6c')]=_0x41ee44[_0x27ec('0x68')]({'plain':!![]});interaction_log[_0x27ec('0x27')](_0x27ec('0x78'),_0xe70a9b[_0x27ec('0x6e')]['id'],_0xe70a9b[_0x27ec('0x6e')][_0x27ec('0x3c')],_0xe70a9b['user'][_0x27ec('0x6f')],_0x11f1b2['interaction']['id'],_0xe70a9b['body']?JSON[_0x27ec('0x2b')](_0xe70a9b['body']):_0x27ec('0x79'));return respondWithRpcPromise(_0x27ec('0x7a'),_0x27ec('0x7b'),_0x11f1b2);}return null;})[_0x27ec('0x39')](function(_0x228122){if(_0x228122){_0x228122[_0x27ec('0x2f')][_0x27ec('0x72')]=util[_0x27ec('0x64')](_0x27ec('0x73'),_0xe70a9b[_0x27ec('0x6e')][_0x27ec('0x3c')]);_0x228122[_0x27ec('0x2f')][_0x27ec('0x74')]=_0x11f1b2[_0x27ec('0x74')];_0x228122[_0x27ec('0x2f')][_0x27ec('0x75')]=_0x27ec('0x38');respondWithRpcPromise('EventManager',_0x27ec('0x76'),{'event':'rejectmessage','message':_0x228122['message']},client9002);return _0x11f1b2;}return null;})[_0x27ec('0x39')](respondWithResult(_0x1acacf,null))[_0x27ec('0x56')](handleError(_0x1acacf,null));};exports['status']=function(_0x200b44,_0x2e0c49,_0x4a7d0b){if(_0x200b44[_0x27ec('0x5c')]['id']){delete _0x200b44['body']['id'];}var _0x3a36a3;return db[_0x27ec('0x40')]['find']({'where':{'id':_0x200b44[_0x27ec('0x58')]['id']}})[_0x27ec('0x39')](handleEntityNotFound(_0x2e0c49,null))['then'](function(_0x10e565){if(_0x10e565){_0x3a36a3=_0x10e565;return db[_0x27ec('0x7c')][_0x27ec('0x5a')]({'where':{'id':_0x10e565[_0x27ec('0x7d')]}});}})[_0x27ec('0x39')](handleEntityNotFound(_0x2e0c49,null))[_0x27ec('0x39')](function(_0xcc2522){if(_0xcc2522){logger[_0x27ec('0x28')](_0x27ec('0x29'),_0x27ec('0x32'),_0x27ec('0x7e'),_0xcc2522[_0x27ec('0x42')],util['inspect'](_0x200b44[_0x27ec('0x5c')],{'showHidden':![],'depth':null}));switch(_0xcc2522[_0x27ec('0x42')]){case _0x27ec('0x7f'):if(_0x200b44[_0x27ec('0x5c')][_0x27ec('0x80')]&&_0x200b44[_0x27ec('0x5c')][_0x27ec('0x80')]===_0x3a36a3[_0x27ec('0x81')]){return _0x3a36a3[_0x27ec('0x5d')]({'read':!![]});}else{logger[_0x27ec('0x2c')](_0x27ec('0x82'),_0x27ec('0x32'),_0x27ec('0x7f'),util[_0x27ec('0x83')](_0x200b44[_0x27ec('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x27ec('0x84'):if(_0x200b44['body'][_0x27ec('0x85')]&&_0x200b44[_0x27ec('0x5c')]['MessageUUID']===_0x3a36a3[_0x27ec('0x81')]&&_['indexOf'](['sent','delivered'],_0x200b44[_0x27ec('0x5c')][_0x27ec('0x86')])>=0x0){return _0x3a36a3[_0x27ec('0x5d')]({'read':!![]});}else{logger[_0x27ec('0x2c')](_0x27ec('0x82'),_0x27ec('0x32'),_0x27ec('0x87'),util[_0x27ec('0x83')](_0x200b44[_0x27ec('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x27ec('0x88'):var _0x2cf1ec=_0x200b44[_0x27ec('0x5c')][_0x27ec('0x89')][0x0];if(_0x2cf1ec['status'][_0x27ec('0x8a')]===_0x27ec('0x8b')){return _0x3a36a3[_0x27ec('0x5d')]({'read':!![]});}else{logger[_0x27ec('0x2c')](_0x27ec('0x82'),_0x27ec('0x32'),'infobip',util['inspect'](_0x200b44[_0x27ec('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x3a36a3;}})[_0x27ec('0x39')](respondWithResult(_0x2e0c49,null))['catch'](handleError(_0x2e0c49,null));}; \ No newline at end of file +var _0x09dd=['body','find','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','isNil','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','sms-interactions','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccount','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','plivio','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','end','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','then','rows','params','SmsMessage','rawAttributes','create','catch','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09dd,0xb7));var _0xd09d=function(_0x1fd155,_0x340af9){_0x1fd155=_0x1fd155-0x0;var _0x250e2f=_0x09dd[_0x1fd155];return _0x250e2f;};'use strict';var pdf=require(_0xd09d('0x0'));var emlformat=require(_0xd09d('0x1'));var rimraf=require(_0xd09d('0x2'));var zipdir=require(_0xd09d('0x3'));var jsonpatch=require(_0xd09d('0x4'));var rp=require(_0xd09d('0x5'));var moment=require(_0xd09d('0x6'));var BPromise=require(_0xd09d('0x7'));var Mustache=require(_0xd09d('0x8'));var util=require('util');var path=require(_0xd09d('0x9'));var sox=require('sox');var csv=require(_0xd09d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd09d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd09d('0xa'));var querystring=require('querystring');var Papa=require(_0xd09d('0xc'));var Redis=require(_0xd09d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd09d('0xe'));var logger=require(_0xd09d('0xf'))(_0xd09d('0x10'));var utils=require(_0xd09d('0x11'));var config=require(_0xd09d('0x12'));var db=require(_0xd09d('0x13'))['db'];config[_0xd09d('0x14')]=_['defaults'](config[_0xd09d('0x14')],{'host':_0xd09d('0x15'),'port':0x18eb});var socket=require(_0xd09d('0x16'))(new Redis(config[_0xd09d('0x14')]));require(_0xd09d('0x17'))['register'](socket);var jayson=require(_0xd09d('0x18'));var client=jayson[_0xd09d('0x19')][_0xd09d('0x1a')]({'port':0x232c});var client9002=jayson[_0xd09d('0x19')][_0xd09d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5b0c0a,_0xf4c819,_0x375e61){if(_0x375e61){var _0x4909b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4909b2[_0xd09d('0x1b')](_0xf4c819)){return _0x5b0c0a;}else{throw new db[(_0xd09d('0x1c'))][(_0xd09d('0x1d'))](_0xd09d('0x1e'));}}else{return _0x5b0c0a;}}function respondWithRpcPromise(_0x440b36,_0x209df3,_0x29aa6,_0x24d3c9){return new BPromise(function(_0x1ed546,_0x175920){var _0x5bc594=_0x24d3c9||client;return _0x5bc594[_0xd09d('0x1f')](_0x440b36,_0x29aa6)['then'](function(_0x700b25){logger[_0xd09d('0x20')](_0xd09d('0x21'),_0x209df3,_0xd09d('0x22'));logger['debug'](_0xd09d('0x23'),_0x209df3,'request\x20sent',JSON['stringify'](_0x700b25));if(_0x700b25[_0xd09d('0x24')]){if(_0x700b25[_0xd09d('0x24')]['code']===0x1f4){logger[_0xd09d('0x24')](_0xd09d('0x21'),_0x209df3,_0x700b25[_0xd09d('0x24')][_0xd09d('0x25')]);return _0x175920(_0x700b25[_0xd09d('0x24')][_0xd09d('0x25')]);}logger[_0xd09d('0x24')](_0xd09d('0x21'),_0x209df3,_0x700b25[_0xd09d('0x24')][_0xd09d('0x25')]);return _0x1ed546(_0x700b25[_0xd09d('0x24')][_0xd09d('0x25')]);}else{logger[_0xd09d('0x20')](_0xd09d('0x21'),_0x209df3,_0xd09d('0x22'));_0x1ed546(_0x700b25['result']['message']);}})['catch'](function(_0x57a028){logger[_0xd09d('0x24')](_0xd09d('0x21'),_0x209df3,_0x57a028);_0x175920(_0x57a028);});});}function respondWithStatusCode(_0x35d097,_0x20d031){_0x20d031=_0x20d031||0xcc;return function(_0x50b800){if(_0x50b800){return _0x35d097[_0xd09d('0x26')](_0x20d031);}return _0x35d097[_0xd09d('0x27')](_0x20d031)['end']();};}function respondWithResult(_0x1842d0,_0x5df00f){_0x5df00f=_0x5df00f||0xc8;return function(_0x5dfb1c){if(_0x5dfb1c){return _0x1842d0[_0xd09d('0x27')](_0x5df00f)['json'](_0x5dfb1c);}};}function respondWithFilteredResult(_0x6a5562,_0x3b60b0){return function(_0x4d6016){if(_0x4d6016){var _0x482e0a=_0x4d6016[_0xd09d('0x28')],_0x18a416=_0x3b60b0[_0xd09d('0x29')],_0xc67fd=_0x3b60b0[_0xd09d('0x29')]+_0x3b60b0[_0xd09d('0x2a')],_0x1b3639;if(_0xc67fd>=_0x482e0a){_0xc67fd=_0x482e0a;_0x1b3639=0xc8;}else{_0x1b3639=0xce;}_0x6a5562[_0xd09d('0x27')](_0x1b3639);return _0x6a5562[_0xd09d('0x2b')](_0xd09d('0x2c'),_0x18a416+'-'+_0xc67fd+'/'+_0x482e0a)[_0xd09d('0x2d')](_0x4d6016);}return null;};}function patchUpdates(_0x2bba85){return function(_0x58c1e6){try{jsonpatch[_0xd09d('0x2e')](_0x58c1e6,_0x2bba85,!![]);}catch(_0x49a65d){return BPromise[_0xd09d('0x2f')](_0x49a65d);}return _0x58c1e6[_0xd09d('0x30')]();};}function saveUpdates(_0x503878,_0x402ea3){return function(_0x40f2de){if(_0x40f2de){return _0x40f2de['update'](_0x503878)['then'](function(_0x4a1a5a){return _0x4a1a5a;});}return null;};}function removeEntity(_0x897b3,_0x1ce18b){return function(_0x5cae56){if(_0x5cae56){return _0x5cae56['destroy']()['then'](function(){_0x897b3[_0xd09d('0x27')](0xcc)[_0xd09d('0x31')]();});}};}function handleEntityNotFound(_0xb15a5,_0x4b8d30){return function(_0x223621){if(!_0x223621){_0xb15a5[_0xd09d('0x26')](0x194);}return _0x223621;};}function handleError(_0x236022,_0x4d6550){_0x4d6550=_0x4d6550||0x1f4;return function(_0x11145d){logger[_0xd09d('0x24')](_0x11145d[_0xd09d('0x32')]);if(_0x11145d[_0xd09d('0x33')]){delete _0x11145d[_0xd09d('0x33')];}_0x236022[_0xd09d('0x27')](_0x4d6550)[_0xd09d('0x34')](_0x11145d);};}exports[_0xd09d('0x35')]=function(_0xbfc964,_0x1a9955){var _0xb03673={},_0x21259d={},_0x544960={'count':0x0,'rows':[]};var _0x47fa05=_[_0xd09d('0x36')](db['SmsMessage']['rawAttributes'],function(_0x3da77d){return{'name':_0x3da77d[_0xd09d('0x37')],'type':_0x3da77d[_0xd09d('0x38')]['key']};});_0x21259d['model']=_[_0xd09d('0x36')](_0x47fa05,'name');_0x21259d[_0xd09d('0x39')]=_[_0xd09d('0x3a')](_0xbfc964[_0xd09d('0x39')]);_0x21259d[_0xd09d('0x3b')]=_[_0xd09d('0x3c')](_0x21259d['model'],_0x21259d['query']);_0xb03673['attributes']=_[_0xd09d('0x3c')](_0x21259d['model'],qs[_0xd09d('0x3d')](_0xbfc964[_0xd09d('0x39')]['fields']));_0xb03673['attributes']=_0xb03673[_0xd09d('0x3e')][_0xd09d('0x3f')]?_0xb03673[_0xd09d('0x3e')]:_0x21259d[_0xd09d('0x40')];if(!_0xbfc964[_0xd09d('0x39')][_0xd09d('0x41')](_0xd09d('0x42'))){_0xb03673[_0xd09d('0x2a')]=qs[_0xd09d('0x2a')](_0xbfc964[_0xd09d('0x39')]['limit']);_0xb03673[_0xd09d('0x29')]=qs[_0xd09d('0x29')](_0xbfc964['query'][_0xd09d('0x29')]);}_0xb03673[_0xd09d('0x43')]=qs['sort'](_0xbfc964[_0xd09d('0x39')][_0xd09d('0x44')]);_0xb03673['where']=qs[_0xd09d('0x3b')](_[_0xd09d('0x45')](_0xbfc964[_0xd09d('0x39')],_0x21259d[_0xd09d('0x3b')]),_0x47fa05);if(_0xbfc964[_0xd09d('0x39')][_0xd09d('0x46')]){_0xb03673[_0xd09d('0x47')]=_[_0xd09d('0x48')](_0xb03673[_0xd09d('0x47')],{'$or':_[_0xd09d('0x36')](_0x47fa05,function(_0x46a93b){if(_0x46a93b[_0xd09d('0x38')]!==_0xd09d('0x49')){var _0x1001ff={};_0x1001ff[_0x46a93b['name']]={'$like':'%'+_0xbfc964[_0xd09d('0x39')][_0xd09d('0x46')]+'%'};return _0x1001ff;}})});}_0xb03673=_[_0xd09d('0x48')]({},_0xb03673,_0xbfc964['options']);var _0x414473={'where':_0xb03673['where']};return db['SmsMessage'][_0xd09d('0x28')](_0x414473)['then'](function(_0x172e4b){_0x544960[_0xd09d('0x28')]=_0x172e4b;if(_0xbfc964['query'][_0xd09d('0x4a')]){_0xb03673[_0xd09d('0x4b')]=[{'all':!![]}];}return db['SmsMessage'][_0xd09d('0x4c')](_0xb03673);})[_0xd09d('0x4d')](function(_0xbfd4db){_0x544960[_0xd09d('0x4e')]=_0xbfd4db;return _0x544960;})[_0xd09d('0x4d')](respondWithFilteredResult(_0x1a9955,_0xb03673))['catch'](handleError(_0x1a9955,null));};exports['show']=function(_0x5402fa,_0x3ac8c9){var _0x178ba0={'raw':!![],'where':{'id':_0x5402fa[_0xd09d('0x4f')]['id']}},_0x316dd0={};_0x316dd0['model']=_[_0xd09d('0x3a')](db[_0xd09d('0x50')][_0xd09d('0x51')]);_0x316dd0[_0xd09d('0x39')]=_[_0xd09d('0x3a')](_0x5402fa[_0xd09d('0x39')]);_0x316dd0[_0xd09d('0x3b')]=_[_0xd09d('0x3c')](_0x316dd0['model'],_0x316dd0[_0xd09d('0x39')]);_0x178ba0[_0xd09d('0x3e')]=_[_0xd09d('0x3c')](_0x316dd0[_0xd09d('0x40')],qs[_0xd09d('0x3d')](_0x5402fa[_0xd09d('0x39')][_0xd09d('0x3d')]));_0x178ba0[_0xd09d('0x3e')]=_0x178ba0[_0xd09d('0x3e')][_0xd09d('0x3f')]?_0x178ba0[_0xd09d('0x3e')]:_0x316dd0['model'];if(_0x5402fa['query'][_0xd09d('0x4a')]){_0x178ba0[_0xd09d('0x4b')]=[{'all':!![]}];}_0x178ba0=_['merge']({},_0x178ba0,_0x5402fa['options']);return db[_0xd09d('0x50')]['find'](_0x178ba0)[_0xd09d('0x4d')](handleEntityNotFound(_0x3ac8c9,null))['then'](respondWithResult(_0x3ac8c9,null))['catch'](handleError(_0x3ac8c9,null));};exports[_0xd09d('0x52')]=function(_0x304cf8,_0x366c4d){return db[_0xd09d('0x50')][_0xd09d('0x52')](_0x304cf8['body'],{})[_0xd09d('0x4d')](respondWithResult(_0x366c4d,0xc9))[_0xd09d('0x53')](handleError(_0x366c4d,null));};exports[_0xd09d('0x54')]=function(_0x58035d,_0x3d3fb3){if(_0x58035d[_0xd09d('0x55')]['id']){delete _0x58035d['body']['id'];}return db[_0xd09d('0x50')]['find']({'where':{'id':_0x58035d[_0xd09d('0x4f')]['id']}})[_0xd09d('0x4d')](handleEntityNotFound(_0x3d3fb3,null))[_0xd09d('0x4d')](saveUpdates(_0x58035d[_0xd09d('0x55')],null))[_0xd09d('0x4d')](respondWithResult(_0x3d3fb3,null))[_0xd09d('0x53')](handleError(_0x3d3fb3,null));};exports['destroy']=function(_0x325fab,_0x5f2fe4){return db['SmsMessage'][_0xd09d('0x56')]({'where':{'id':_0x325fab[_0xd09d('0x4f')]['id']}})[_0xd09d('0x4d')](handleEntityNotFound(_0x5f2fe4,null))['then'](removeEntity(_0x5f2fe4,null))[_0xd09d('0x53')](handleError(_0x5f2fe4,null));};exports['describe']=function(_0x5dad77,_0xa475d2){return db[_0xd09d('0x50')][_0xd09d('0x57')]()[_0xd09d('0x4d')](respondWithResult(_0xa475d2,null))[_0xd09d('0x53')](handleError(_0xa475d2,null));};var interaction_log=require(_0xd09d('0xf'))('sms-interactions');exports[_0xd09d('0x58')]=function(_0x1701f3,_0x5d6682,_0x3e79b6){var _0x1d59cc={'channel':_0xd09d('0x59')};if(_0x1701f3['body']['id']){delete _0x1701f3['body']['id'];}_0x1701f3[_0xd09d('0x55')][_0xd09d('0x5a')]=!![];_0x1701f3[_0xd09d('0x55')][_0xd09d('0x5b')]=moment()[_0xd09d('0x5c')](_0xd09d('0x5d'));_0x1701f3[_0xd09d('0x55')]['UserId']=_0x1701f3[_0xd09d('0x55')][_0xd09d('0x5e')]||_0x1701f3[_0xd09d('0x5f')]['id'];return db[_0xd09d('0x50')][_0xd09d('0x56')]({'where':{'id':_0x1701f3['params']['id'],'UserId':null},'include':[{'model':db[_0xd09d('0x60')],'as':_0xd09d('0x61')}]})['then'](handleEntityNotFound(_0x5d6682,null))[_0xd09d('0x4d')](saveUpdates(_0x1701f3[_0xd09d('0x55')],null))[_0xd09d('0x4d')](function(_0x528d7f){if(_0x528d7f){_0x1d59cc['message']=_0x528d7f[_0xd09d('0x62')]({'plain':!![]});return db[_0xd09d('0x63')][_0xd09d('0x56')]({'where':{'id':_0x528d7f['SmsInteractionId']}});}return null;})[_0xd09d('0x4d')](handleEntityNotFound(_0x5d6682,null))[_0xd09d('0x4d')](function(_0x4baad0){if(_0x4baad0){return _0x4baad0['update']({'UserId':_0x1701f3[_0xd09d('0x55')][_0xd09d('0x5e')],'read1stAt':_[_0xd09d('0x64')](_0x4baad0['read1stAt'])?moment()[_0xd09d('0x5c')](_0xd09d('0x5d')):undefined});}return null;})[_0xd09d('0x4d')](function(_0x4a4dad){if(_0x4a4dad){_0x1d59cc['interaction']=_0x4a4dad[_0xd09d('0x62')]({'plain':!![]});interaction_log['info'](_0xd09d('0x65'),_0x1701f3[_0xd09d('0x5f')]['id'],_0x1701f3[_0xd09d('0x5f')][_0xd09d('0x33')],_0x1701f3['user']['role'],_0x1d59cc[_0xd09d('0x66')]['id'],_0x1701f3[_0xd09d('0x55')]?JSON[_0xd09d('0x67')](_0x1701f3['body']):_0xd09d('0x68'));return respondWithRpcPromise(_0xd09d('0x69'),_0xd09d('0x6a'),_0x1d59cc);}return null;})[_0xd09d('0x4d')](function(_0x4137d6){if(_0x4137d6){if(_0x1701f3[_0xd09d('0x55')]['manual']){_0x1d59cc[_0xd09d('0x25')][_0xd09d('0x6b')]=util[_0xd09d('0x5c')]('SIP/%s',_0x1701f3['user'][_0xd09d('0x33')]);_0x1d59cc[_0xd09d('0x25')][_0xd09d('0x6c')]=_0x1d59cc[_0xd09d('0x6c')];_0x1d59cc['message'][_0xd09d('0x6d')]='accept';return respondWithRpcPromise(_0xd09d('0x6e'),_0xd09d('0x6e'),{'event':_0xd09d('0x6f'),'message':_0x1d59cc['message']},client9002)['then'](function(){return _0x1d59cc;});}return _0x1d59cc;}return null;})[_0xd09d('0x4d')](respondWithResult(_0x5d6682,null))[_0xd09d('0x53')](handleError(_0x5d6682,null));};var interaction_log=require(_0xd09d('0xf'))(_0xd09d('0x70'));exports[_0xd09d('0x2f')]=function(_0x26fc99,_0x28d34d,_0xe29e03){var _0x2fa7e6={'agent':{},'channel':_0xd09d('0x59')};if(_0x26fc99[_0xd09d('0x55')]['id']){delete _0x26fc99[_0xd09d('0x55')]['id'];}_0x26fc99[_0xd09d('0x55')][_0xd09d('0x5e')]=_0x26fc99['body']['UserId']||_0x26fc99['user']['id'];_0x2fa7e6['agent']['id']=_0x26fc99[_0xd09d('0x55')][_0xd09d('0x5e')];return db[_0xd09d('0x50')][_0xd09d('0x56')]({'where':{'id':_0x26fc99[_0xd09d('0x4f')]['id'],'UserId':null}})[_0xd09d('0x4d')](handleEntityNotFound(_0x28d34d,null))[_0xd09d('0x4d')](function(_0x100ab2){if(_0x100ab2){_0x2fa7e6[_0xd09d('0x25')]=_0x100ab2[_0xd09d('0x62')]({'plain':!![]});return db[_0xd09d('0x63')][_0xd09d('0x56')]({'where':{'id':_0x100ab2[_0xd09d('0x71')]}});}return null;})[_0xd09d('0x4d')](handleEntityNotFound(_0x28d34d,null))[_0xd09d('0x4d')](function(_0x279894){if(_0x279894){_0x2fa7e6[_0xd09d('0x66')]=_0x279894[_0xd09d('0x62')]({'plain':!![]});interaction_log['info'](_0xd09d('0x72'),_0x26fc99[_0xd09d('0x5f')]['id'],_0x26fc99[_0xd09d('0x5f')][_0xd09d('0x33')],_0x26fc99['user'][_0xd09d('0x73')],_0x2fa7e6[_0xd09d('0x66')]['id'],_0x26fc99[_0xd09d('0x55')]?JSON[_0xd09d('0x67')](_0x26fc99[_0xd09d('0x55')]):'null');return respondWithRpcPromise(_0xd09d('0x74'),_0xd09d('0x75'),_0x2fa7e6);}return null;})[_0xd09d('0x4d')](function(_0x4c2308){if(_0x4c2308){_0x4c2308[_0xd09d('0x25')]['interface']=util[_0xd09d('0x5c')](_0xd09d('0x76'),_0x26fc99[_0xd09d('0x5f')][_0xd09d('0x33')]);_0x4c2308[_0xd09d('0x25')][_0xd09d('0x6c')]=_0x2fa7e6[_0xd09d('0x6c')];_0x4c2308[_0xd09d('0x25')][_0xd09d('0x6d')]=_0xd09d('0x2f');respondWithRpcPromise(_0xd09d('0x6e'),'EventManager',{'event':_0xd09d('0x77'),'message':_0x4c2308['message']},client9002);return _0x2fa7e6;}return null;})[_0xd09d('0x4d')](respondWithResult(_0x28d34d,null))[_0xd09d('0x53')](handleError(_0x28d34d,null));};exports[_0xd09d('0x27')]=function(_0x14deb3,_0x54b01c,_0x70ccb3){if(_0x14deb3[_0xd09d('0x55')]['id']){delete _0x14deb3['body']['id'];}var _0x2f0cc0;return db['SmsMessage'][_0xd09d('0x56')]({'where':{'id':_0x14deb3[_0xd09d('0x4f')]['id']}})[_0xd09d('0x4d')](handleEntityNotFound(_0x54b01c,null))[_0xd09d('0x4d')](function(_0x46f93a){if(_0x46f93a){_0x2f0cc0=_0x46f93a;return db[_0xd09d('0x78')][_0xd09d('0x56')]({'where':{'id':_0x46f93a['SmsAccountId']}});}})[_0xd09d('0x4d')](handleEntityNotFound(_0x54b01c,null))['then'](function(_0x1250a9){if(_0x1250a9){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x1250a9[_0xd09d('0x38')],util[_0xd09d('0x79')](_0x14deb3[_0xd09d('0x55')],{'showHidden':![],'depth':null}));switch(_0x1250a9[_0xd09d('0x38')]){case'twilio':if(_0x14deb3[_0xd09d('0x55')][_0xd09d('0x7a')]&&_0x14deb3['body'][_0xd09d('0x7a')]===_0x2f0cc0[_0xd09d('0x7b')]){return _0x2f0cc0[_0xd09d('0x54')]({'read':!![]});}else{logger[_0xd09d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd09d('0x27'),_0xd09d('0x7c'),util[_0xd09d('0x79')](_0x14deb3['body'],{'showHidden':![],'depth':null}));}break;case _0xd09d('0x7d'):if(_0x14deb3[_0xd09d('0x55')][_0xd09d('0x7e')]&&_0x14deb3[_0xd09d('0x55')][_0xd09d('0x7e')]===_0x2f0cc0['messageId']&&_[_0xd09d('0x7f')](['sent','delivered'],_0x14deb3[_0xd09d('0x55')]['Status'])>=0x0){return _0x2f0cc0['update']({'read':!![]});}else{logger[_0xd09d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd09d('0x27'),_0xd09d('0x80'),util['inspect'](_0x14deb3[_0xd09d('0x55')],{'showHidden':![],'depth':null}));}break;case _0xd09d('0x81'):var _0x1593ce=_0x14deb3[_0xd09d('0x55')][_0xd09d('0x82')][0x0];if(_0x1593ce['status'][_0xd09d('0x83')]===_0xd09d('0x84')){return _0x2f0cc0[_0xd09d('0x54')]({'read':!![]});}else{logger[_0xd09d('0x24')](_0xd09d('0x85'),_0xd09d('0x27'),_0xd09d('0x81'),util[_0xd09d('0x79')](_0x14deb3['body'],{'showHidden':![],'depth':null}));}break;}return _0x2f0cc0;}})[_0xd09d('0x4d')](respondWithResult(_0x54b01c,null))[_0xd09d('0x53')](handleError(_0x54b01c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0b45b1e..fc55e5c 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 _0x4c85=['hook','exports','events','../../mysqldb','SmsMessage','save','update','emit'];(function(_0x1b6b0b,_0x14bc89){var _0x47e3ea=function(_0x38f255){while(--_0x38f255){_0x1b6b0b['push'](_0x1b6b0b['shift']());}};_0x47e3ea(++_0x14bc89);}(_0x4c85,0xc2));var _0x54c8=function(_0x545aa7,_0x59a5a9){_0x545aa7=_0x545aa7-0x0;var _0x2e716b=_0x4c85[_0x545aa7];return _0x2e716b;};'use strict';var EventEmitter=require(_0x54c8('0x0'));var SmsMessage=require(_0x54c8('0x1'))['db'][_0x54c8('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54c8('0x3'),'afterUpdate':_0x54c8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x477b2f){return function(_0x319309,_0x362a4d,_0x1d5230){SmsMessageEvents[_0x54c8('0x5')](_0x477b2f+':'+_0x319309['id'],_0x319309);SmsMessageEvents[_0x54c8('0x5')](_0x477b2f,_0x319309);_0x1d5230(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x54c8('0x6')](e,emitEvent(event));}}module[_0x54c8('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xa71f=['hasOwnProperty','exports','events','../../mysqldb','SmsMessage','save','update','emit'];(function(_0x4be3ca,_0x1fb9bc){var _0x5d2c7f=function(_0x3fe9ec){while(--_0x3fe9ec){_0x4be3ca['push'](_0x4be3ca['shift']());}};_0x5d2c7f(++_0x1fb9bc);}(_0xa71f,0x152));var _0xfa71=function(_0x498bd7,_0x31e3b5){_0x498bd7=_0x498bd7-0x0;var _0x51b5a0=_0xa71f[_0x498bd7];return _0x51b5a0;};'use strict';var EventEmitter=require(_0xfa71('0x0'));var SmsMessage=require(_0xfa71('0x1'))['db'][_0xfa71('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa71('0x3'),'afterUpdate':_0xfa71('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a0580){return function(_0x3fe956,_0x5f19c9,_0x372f8d){SmsMessageEvents[_0xfa71('0x5')](_0x4a0580+':'+_0x3fe956['id'],_0x3fe956);SmsMessageEvents[_0xfa71('0x5')](_0x4a0580,_0x3fe956);_0x372f8d(null);};}for(var e in events){if(events[_0xfa71('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xfa71('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index bfc123d..08d69b6 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 _0x0c6a=['bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','connectel','authToken','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','base64','http_code','queued_count','head','message_id','clickSend','plivo','token','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','apiKey','sender','text','keys','sort','length','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0x4158d9,_0x2f1979){var _0x25636d=function(_0x50b602){while(--_0x50b602){_0x4158d9['push'](_0x4158d9['shift']());}};_0x25636d(++_0x2f1979);}(_0x0c6a,0x157));var _0xa0c6=function(_0x5ecb65,_0x150439){_0x5ecb65=_0x5ecb65-0x0;var _0x32c120=_0x0c6a[_0x5ecb65];return _0x32c120;};'use strict';var _=require('lodash');var util=require(_0xa0c6('0x0'));var logger=require('../../config/logger')(_0xa0c6('0x1'));var moment=require('moment');var BPromise=require(_0xa0c6('0x2'));var rp=require(_0xa0c6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0c6('0x4'));var config=require(_0xa0c6('0x5'));var attributes=require(_0xa0c6('0x6'));module['exports']=function(_0x5e3c70,_0x222baa){return _0x5e3c70['define']('SmsMessage',attributes,{'tableName':_0xa0c6('0x7'),'paranoid':![],'indexes':[{'name':_0xa0c6('0x8'),'fields':['messageId']},{'name':_0xa0c6('0x9'),'fields':['body'],'type':_0xa0c6('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x437ac7,_0x584804,_0x2b9019){var _0x42ac74=_0x5e3c70[_0xa0c6('0xb')];var _0x1c613=_0x437ac7[_0xa0c6('0xc')]({'plain':!![]});if(_0x1c613[_0xa0c6('0xd')][_0xa0c6('0xe')]()==='in'||_0x1c613[_0xa0c6('0xd')][_0xa0c6('0xe')]()===_0xa0c6('0xf')&&!_0x1c613[_0xa0c6('0x10')]&&!_[_0xa0c6('0x11')](_0x1c613[_0xa0c6('0x12')])){_0x42ac74[_0xa0c6('0x13')]['findOne']({'where':{'id':_0x1c613['SmsInteractionId']}})[_0xa0c6('0x14')](function(_0x168f69){if(_0x168f69){_0x168f69[_0xa0c6('0x15')]({'lastMsgAt':_0x1c613[_0xa0c6('0x16')],'lastMsgDirection':_0x1c613['direction'][_0xa0c6('0xe')]()});}})[_0xa0c6('0x17')](function(_0x41be06){console[_0xa0c6('0x18')](_0x41be06);});}if(_0x1c613[_0xa0c6('0xd')]===_0xa0c6('0xf')&&!_0x1c613[_0xa0c6('0x10')]){var _0x17140f;_0x42ac74['SmsAccount'][_0xa0c6('0x19')]({'where':{'id':_0x1c613[_0xa0c6('0x1a')]},'raw':!![]})[_0xa0c6('0x14')](function(_0x5789e4){_0x17140f=_0x5789e4;if(_0x17140f&&_0x17140f[_0xa0c6('0x1b')]){switch(_0x17140f[_0xa0c6('0x1b')]){case'twilio':var _0x2864bc=require(_0xa0c6('0x1c'));if(_0x17140f['accountSid']&&_0x17140f['authToken']&&_0x17140f[_0xa0c6('0x1d')]){var _0x3ece27=new _0x2864bc(_0x17140f['accountSid'],_0x17140f['authToken']);_0x3ece27[_0xa0c6('0x1e')][_0xa0c6('0x1f')]({'body':_0x1c613[_0xa0c6('0x20')],'to':_0x1c613[_0xa0c6('0x1d')],'from':_0x17140f[_0xa0c6('0x1d')],'statusCallback':_0x17140f[_0xa0c6('0x21')]+_0xa0c6('0x22')+_0x1c613['id']+_0xa0c6('0x23')+_0x17140f['token']})[_0xa0c6('0x14')](function(_0x1e2274){if(_0x1e2274['sid']){return _0x437ac7[_0xa0c6('0x15')]({'messageId':_0x1e2274[_0xa0c6('0x24')]});}})[_0xa0c6('0x17')](function(_0x19ee1f){logger[_0xa0c6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa0c6('0x25'),'twilio',util[_0xa0c6('0x26')](_0x19ee1f,{'showHidden':![],'depth':null}));});}else{logger[_0xa0c6('0x18')](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xa0c6('0x28'):var _0x25aa05=_0xa0c6('0x29');if(_0x17140f[_0xa0c6('0x2a')]&&_0x17140f[_0xa0c6('0x2b')]){var _0x254ea5={'recipient':[_0x1c613['phone']],'message':_0x1c613[_0xa0c6('0x20')],'message_type':_0x17140f[_0xa0c6('0x2c')]};if(_0x17140f[_0xa0c6('0x2c')]&&_0x17140f[_0xa0c6('0x2c')]!=='SI'){_0x254ea5['sender']=_0x17140f[_0xa0c6('0x1d')];}var _0x453b05={'url':_0x25aa05+_0xa0c6('0x2d')+_0x17140f[_0xa0c6('0x2a')]+_0xa0c6('0x2e')+_0x17140f[_0xa0c6('0x2b')],'method':_0xa0c6('0x2f')};rp(_0x453b05)[_0xa0c6('0x14')](function(_0x17832f){var _0x19fb63=_0x17832f[_0xa0c6('0x30')](';');var _0x52c469={'user_key':_0x19fb63[0x0],'session_key':_0x19fb63[0x1]};_0x453b05={'url':_0x25aa05+_0xa0c6('0x31'),'method':_0xa0c6('0x32'),'headers':{'user_key':_0x52c469[_0xa0c6('0x33')],'Session_key':_0x52c469[_0xa0c6('0x34')]},'json':!![],'body':_0x254ea5};return rp(_0x453b05);})[_0xa0c6('0x14')](function(_0x29bb4f){if(_0x29bb4f[_0xa0c6('0x35')]>=0x1){var _0x3f4af3={'messageId':_0x29bb4f['internal_order_id']};if(_0x17140f[_0xa0c6('0x2c')]!=='GP'||!_0x17140f[_0xa0c6('0x36')]){_0x3f4af3[_0xa0c6('0x37')]=!![];}return _0x437ac7[_0xa0c6('0x15')](_0x3f4af3);}else{return logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),'skebby',util[_0xa0c6('0x26')](_0x29bb4f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x433fa6){return logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x28'),util[_0xa0c6('0x26')](_0x433fa6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x28'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa0c6('0x38'):if(_0x17140f[_0xa0c6('0x39')]){var _0x179906={'recipient':_0x1c613['phone'],'message':_0x1c613[_0xa0c6('0x20')],'sender':_0x17140f[_0xa0c6('0x3a')]||_0x17140f[_0xa0c6('0x1d')],'authorization':_0x17140f[_0xa0c6('0x39')]};var _0x584804={'method':'POST','uri':_0xa0c6('0x3b'),'body':_0x179906,'json':!![]};rp(_0x584804)[_0xa0c6('0x14')](function(_0x130144){var _0x34ec3b={'messageId':_0x130144[_0xa0c6('0x3c')]};if(!_0x17140f[_0xa0c6('0x36')]){_0x34ec3b[_0xa0c6('0x37')]=!![];}return _0x437ac7[_0xa0c6('0x15')](_0x34ec3b);})[_0xa0c6('0x17')](function(_0x351007){logger[_0xa0c6('0x18')](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x38'),util[_0xa0c6('0x26')](_0x351007,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x38'),_0xa0c6('0x3d'));}break;case _0xa0c6('0x3e'):if(_0x17140f['username']&&_0x17140f[_0xa0c6('0x2b')]){var _0x179906={'messages':[{'source':_0xa0c6('0x3f'),'to':_0x1c613['phone'],'body':_0x1c613[_0xa0c6('0x20')],'from':_0x17140f[_0xa0c6('0x3a')]||_0x17140f[_0xa0c6('0x1d')]}]};var _0x59e3e1=util[_0xa0c6('0x40')](_0xa0c6('0x41'),_0x17140f[_0xa0c6('0x2a')],_0x17140f[_0xa0c6('0x2b')]);var _0x584804={'method':_0xa0c6('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x179906,'headers':{'Authorization':util[_0xa0c6('0x40')](_0xa0c6('0x42'),new Buffer(_0x59e3e1)['toString'](_0xa0c6('0x43')))},'json':!![]};rp(_0x584804)['then'](function(_0x41975b){if(_0x41975b[_0xa0c6('0x44')]>=0xc8&&_0x41975b[_0xa0c6('0x44')]<=0xce){if(_0x41975b['data']&&_0x41975b['data'][_0xa0c6('0x45')]>0x0){var _0x2b9daf=_[_0xa0c6('0x46')](_0x41975b['data'][_0xa0c6('0x1e')]);var _0x218ad2={'messageId':_0x2b9daf[_0xa0c6('0x47')]};if(!_0x17140f[_0xa0c6('0x36')]){_0x218ad2[_0xa0c6('0x37')]=!![];}return _0x437ac7[_0xa0c6('0x15')](_0x218ad2);}else{logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),'clickSend',util[_0xa0c6('0x26')](_0x41975b,{'showHidden':![],'depth':null}));}}else{logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x48'),util[_0xa0c6('0x26')](_0x41975b,{'showHidden':![],'depth':null}));}})[_0xa0c6('0x17')](function(_0x5c43c3){logger['error'](_0xa0c6('0x27'),_0xa0c6('0x25'),'clickSend',util[_0xa0c6('0x26')](_0x5c43c3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa0c6('0x49'):if(_0x17140f['authId']&&_0x17140f[_0xa0c6('0x39')]){var _0x179906={'dst':_0x1c613['phone'],'text':_0x1c613[_0xa0c6('0x20')],'src':_0x17140f['senderString']||_0x17140f[_0xa0c6('0x1d')],'url':_0x17140f['remote']+_0xa0c6('0x22')+_0x1c613['id']+_0xa0c6('0x23')+_0x17140f[_0xa0c6('0x4a')]};var _0x59e3e1=util[_0xa0c6('0x40')](_0xa0c6('0x41'),_0x17140f[_0xa0c6('0x4b')],_0x17140f[_0xa0c6('0x39')]);var _0x584804={'method':_0xa0c6('0x32'),'uri':util[_0xa0c6('0x40')](_0xa0c6('0x4c'),_0x17140f[_0xa0c6('0x4b')]),'body':_0x179906,'headers':{'Authorization':util[_0xa0c6('0x40')](_0xa0c6('0x42'),new Buffer(_0x59e3e1)[_0xa0c6('0x4d')](_0xa0c6('0x43')))},'json':!![]};rp(_0x584804)[_0xa0c6('0x14')](function(_0x26492a){var _0x380851={'messageId':_0x26492a['message_uuid'][0x0]};return _0x437ac7[_0xa0c6('0x15')](_0x380851);})['catch'](function(_0x3b59d4){logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x49'),util[_0xa0c6('0x26')](_0x3b59d4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x49'),_0xa0c6('0x4e'));}break;case'infobip':if(_0x17140f[_0xa0c6('0x2a')]&&_0x17140f[_0xa0c6('0x2b')]){if(_0x17140f[_0xa0c6('0x4f')]){var _0x19b1ca={'method':_0xa0c6('0x32'),'uri':_0x17140f['baseUrl']+'/auth/1/session','body':{'username':_0x17140f['username'],'password':_0x17140f[_0xa0c6('0x2b')]},'json':!![]};return rp(_0x19b1ca)[_0xa0c6('0x14')](function(_0x4f7e50){var _0x5b5996={'method':'POST','uri':_0x17140f[_0xa0c6('0x4f')]+_0xa0c6('0x50'),'body':{'messages':[{'from':_0x17140f[_0xa0c6('0x1d')],'destinations':[{'to':_0x1c613['phone']}],'text':_0x1c613[_0xa0c6('0x20')],'notifyUrl':_0x17140f[_0xa0c6('0x21')]+_0xa0c6('0x22')+_0x1c613['id']+_0xa0c6('0x23')+_0x17140f['token'],'notifyContentType':_0xa0c6('0x51'),'callbackData':_0x17140f['phone']+';'+_0x1c613['body']}]},'headers':{'Authorization':_0xa0c6('0x52')+_0x4f7e50[_0xa0c6('0x4a')]},'json':!![]};return rp(_0x5b5996)['then'](function(_0x27877a){if(_0x27877a[_0xa0c6('0x1e')]){var _0x14b2c2={'messageId':_0x27877a[_0xa0c6('0x1e')][0x0]['messageId']};if(!_0x17140f[_0xa0c6('0x36')]){_0x14b2c2['read']=!![];}return _0x437ac7['update'](_0x14b2c2);}else{return logger['error'](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x53'),util[_0xa0c6('0x26')](_0x27877a,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5007ab){return logger[_0xa0c6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa0c6('0x25'),_0xa0c6('0x53'),util['inspect'](_0x5007ab,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa0c6('0x25'),_0xa0c6('0x53'),_0xa0c6('0x54'));}}else{logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x53'),_0xa0c6('0x55'));}break;case _0xa0c6('0x56'):var _0x4446cd=require('crypto');if(_0x17140f[_0xa0c6('0x57')]){var _0x332837={};_0x332837['login']=_0x17140f[_0xa0c6('0x2a')];_0x332837[_0xa0c6('0x1d')]=_0x1c613[_0xa0c6('0x1d')];_0x332837[_0xa0c6('0x58')]=_0x17140f[_0xa0c6('0x1d')];_0x332837[_0xa0c6('0x59')]=_0x1c613[_0xa0c6('0x20')];_0x332837['timestamp']=+new Date();var _0x31c129='';var _0x4e4120='';var _0x25ee8a=Object[_0xa0c6('0x5a')](_0x332837);_0x25ee8a[_0xa0c6('0x5b')]();for(var _0x34891f=0x0;_0x34891f<_0x25ee8a[_0xa0c6('0x5c')];_0x34891f++){if(_0x31c129!=''){_0x31c129+='&';}_0x31c129+=_0x25ee8a[_0x34891f]+'='+encodeURIComponent(_0x332837[_0x25ee8a[_0x34891f]]);_0x4e4120+=_0x332837[_0x25ee8a[_0x34891f]];}_0x4e4120+=_0x17140f[_0xa0c6('0x57')];_0x4e4120=_0x4446cd['createHash'](_0xa0c6('0x5d'))['update'](_0x4e4120)[_0xa0c6('0x5e')](_0xa0c6('0x5f'));if(_0x31c129!==''){_0x31c129+='&';}_0x31c129+=_0xa0c6('0x60')+_0x4e4120;var _0x453b05={'method':_0xa0c6('0x2f'),'uri':_0x17140f['baseUrl']+'/external/get/send.php?'+_0x31c129,'json':!![]};return rp(_0x453b05)[_0xa0c6('0x14')](function(_0x26538e){var _0x219278=Object[_0xa0c6('0x5a')](_0x26538e);if(_0x26538e[_0x219278[0x0]]['error']&&parseInt(_0x26538e[_0x219278[0x0]][_0xa0c6('0x18')])===0x0){var _0x362a72={'messageId':_0x26538e[_0x219278[0x0]][_0xa0c6('0x61')]};if(!_0x17140f[_0xa0c6('0x36')]){_0x362a72[_0xa0c6('0x37')]=!![];}return _0x437ac7['update'](_0x362a72);}else{return logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x56'),util[_0xa0c6('0x26')](_0x26538e[_0xa0c6('0x18')],{'showHidden':![],'depth':null}));}})[_0xa0c6('0x17')](function(_0x3e74db){return logger[_0xa0c6('0x18')](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x56'),util[_0xa0c6('0x26')](_0x3e74db,{'showHidden':![],'depth':null}));});}else{logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),'csc',_0xa0c6('0x62'));}break;case _0xa0c6('0x63'):if(_0x17140f[_0xa0c6('0x57')]){var _0x32b19c={'method':_0xa0c6('0x32'),'uri':_0xa0c6('0x64'),'headers':{'Authorization':_0x17140f[_0xa0c6('0x57')]},'body':{'content':_0x1c613['body'],'to':[_0x1c613[_0xa0c6('0x1d')]],'from':_0x17140f[_0xa0c6('0x1d')],'binary':![],'clientMessageId':_0xa0c6('0x65'),'charset':_0xa0c6('0x66')},'json':!![]};rp(_0x32b19c)['then'](function(_0x2ae67a){if(!_0x2ae67a[_0xa0c6('0x18')]){var _0x1a5d08={'messageId':_0x2ae67a[_0xa0c6('0x1e')][0x0][_0xa0c6('0x67')]};if(!_0x17140f[_0xa0c6('0x36')]){_0x1a5d08[_0xa0c6('0x37')]=!![];}return _0x437ac7[_0xa0c6('0x15')](_0x1a5d08);}else{return logger['error'](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x63'),util[_0xa0c6('0x26')](_0x2ae67a[_0xa0c6('0x18')],{'showHidden':![],'depth':null}));}})[_0xa0c6('0x17')](function(_0x21c079){return logger['error'](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x63'),util[_0xa0c6('0x26')](_0x21c079,{'showHidden':![],'depth':null}));});}else{logger[_0xa0c6('0x18')](_0xa0c6('0x27'),_0xa0c6('0x25'),_0xa0c6('0x63'),_0xa0c6('0x62'));}break;case _0xa0c6('0x68'):if(_0x17140f['apiKey']){var _0x1e8b78={};var _0x453b05={'method':_0xa0c6('0x32'),'uri':_0xa0c6('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x17140f[_0xa0c6('0x57')],'Content-Type':_0xa0c6('0x51')},'body':{'from':_0x17140f[_0xa0c6('0x1d')],'to':_0x1c613['phone'],'text':_0x1c613[_0xa0c6('0x20')]},'json':!![]};return rp(_0x453b05)[_0xa0c6('0x14')](function(_0x38371d){if(_0x38371d[_0xa0c6('0x6a')]==0xca){_0x1e8b78['message']=_0x38371d;var _0x1d1c4c={'method':'POST','uri':_0xa0c6('0x6b'),'headers':{'Authorization':'Bearer\x20'+_0x17140f[_0xa0c6('0x57')],'Content-Type':_0xa0c6('0x51')},'body':{'refid':_0x1e8b78[_0xa0c6('0x6c')]['refid']},'json':!![]};return rp(_0x1d1c4c)['then'](function(_0x32df3c){_0x1e8b78[_0xa0c6('0x6d')]=_0x32df3c;var _0x483428={'messageId':_0x1e8b78[_0xa0c6('0x6c')][_0xa0c6('0x6e')],'read':!![]};return _0x437ac7['update'](_0x483428);});}else{return logger[_0xa0c6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa0c6('0x25'),'intelepeer',util[_0xa0c6('0x26')](_0x38371d,{'showHidden':![],'depth':null}));}})[_0xa0c6('0x17')](function(_0x577b4f){return logger[_0xa0c6('0x18')](_0xa0c6('0x27'),'afterCreate',_0xa0c6('0x68'),util[_0xa0c6('0x26')](_0x577b4f,{'showHidden':![],'depth':null}));});}else{return logger[_0xa0c6('0x18')](_0xa0c6('0x27'),'afterCreate','intelepeer',_0xa0c6('0x6f'));}break;}}})[_0xa0c6('0x70')](function(){_0x2b9019();});}else{_0x2b9019();}}},'charset':_0xa0c6('0x71'),'collate':_0xa0c6('0x72')});}; \ No newline at end of file +var _0x78e0=['clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','afterCreate','senderString','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x78e0,0x124));var _0x078e=function(_0x1cc925,_0x4c59a1){_0x1cc925=_0x1cc925-0x0;var _0x5a2e6c=_0x78e0[_0x1cc925];return _0x5a2e6c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x078e('0x0'))('api');var moment=require(_0x078e('0x1'));var BPromise=require(_0x078e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x078e('0x3'));var rimraf=require(_0x078e('0x4'));var config=require(_0x078e('0x5'));var attributes=require(_0x078e('0x6'));module[_0x078e('0x7')]=function(_0x380f6b,_0x1668ab){return _0x380f6b['define'](_0x078e('0x8'),attributes,{'tableName':_0x078e('0x9'),'paranoid':![],'indexes':[{'name':_0x078e('0xa'),'fields':['messageId']},{'name':_0x078e('0xb'),'fields':[_0x078e('0xc')],'type':_0x078e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1be92d,_0x19a90f,_0x1d2be1){var _0xb0eba4=_0x380f6b[_0x078e('0xe')];var _0x455bb6=_0x1be92d[_0x078e('0xf')]({'plain':!![]});if(_0x455bb6[_0x078e('0x10')][_0x078e('0x11')]()==='in'||_0x455bb6[_0x078e('0x10')][_0x078e('0x11')]()===_0x078e('0x12')&&!_0x455bb6[_0x078e('0x13')]&&!_[_0x078e('0x14')](_0x455bb6[_0x078e('0x15')])){_0xb0eba4['SmsInteraction'][_0x078e('0x16')]({'where':{'id':_0x455bb6['SmsInteractionId']}})['then'](function(_0x120f07){if(_0x120f07){_0x120f07[_0x078e('0x17')]({'lastMsgAt':_0x455bb6[_0x078e('0x18')],'lastMsgDirection':_0x455bb6[_0x078e('0x10')][_0x078e('0x11')]()});}})[_0x078e('0x19')](function(_0x331c1b){console[_0x078e('0x1a')](_0x331c1b);});}if(_0x455bb6['direction']===_0x078e('0x12')&&!_0x455bb6[_0x078e('0x13')]){var _0x1ac0b6;_0xb0eba4[_0x078e('0x1b')][_0x078e('0x1c')]({'where':{'id':_0x455bb6[_0x078e('0x1d')]},'raw':!![]})[_0x078e('0x1e')](function(_0x566f56){_0x1ac0b6=_0x566f56;if(_0x1ac0b6&&_0x1ac0b6[_0x078e('0x1f')]){switch(_0x1ac0b6[_0x078e('0x1f')]){case _0x078e('0x20'):var _0x3ee040=require(_0x078e('0x20'));if(_0x1ac0b6[_0x078e('0x21')]&&_0x1ac0b6[_0x078e('0x22')]&&_0x1ac0b6[_0x078e('0x23')]){var _0x40962f=new _0x3ee040(_0x1ac0b6[_0x078e('0x21')],_0x1ac0b6[_0x078e('0x22')]);_0x40962f[_0x078e('0x24')][_0x078e('0x25')]({'body':_0x455bb6[_0x078e('0xc')],'to':_0x455bb6[_0x078e('0x23')],'from':_0x1ac0b6[_0x078e('0x23')],'statusCallback':_0x1ac0b6[_0x078e('0x26')]+_0x078e('0x27')+_0x455bb6['id']+_0x078e('0x28')+_0x1ac0b6['token']})['then'](function(_0x481552){if(_0x481552[_0x078e('0x29')]){return _0x1be92d[_0x078e('0x17')]({'messageId':_0x481552['sid']});}})['catch'](function(_0x145da7){logger[_0x078e('0x1a')](_0x078e('0x2a'),'afterCreate',_0x078e('0x20'),util[_0x078e('0x2b')](_0x145da7,{'showHidden':![],'depth':null}));});}else{logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x078e('0x20'),_0x078e('0x2c'));}break;case _0x078e('0x2d'):var _0x3bb94d='https://api.skebby.it/API/v1.0/REST/';if(_0x1ac0b6[_0x078e('0x2e')]&&_0x1ac0b6[_0x078e('0x2f')]){var _0x421b4a={'recipient':[_0x455bb6[_0x078e('0x23')]],'message':_0x455bb6[_0x078e('0xc')],'message_type':_0x1ac0b6[_0x078e('0x30')]};if(_0x1ac0b6[_0x078e('0x30')]&&_0x1ac0b6[_0x078e('0x30')]!=='SI'){_0x421b4a[_0x078e('0x31')]=_0x1ac0b6[_0x078e('0x23')];}var _0x397bb3={'url':_0x3bb94d+_0x078e('0x32')+_0x1ac0b6[_0x078e('0x2e')]+_0x078e('0x33')+_0x1ac0b6[_0x078e('0x2f')],'method':'GET'};rp(_0x397bb3)[_0x078e('0x1e')](function(_0x28520f){var _0x203bd9=_0x28520f[_0x078e('0x34')](';');var _0x2fd92e={'user_key':_0x203bd9[0x0],'session_key':_0x203bd9[0x1]};_0x397bb3={'url':_0x3bb94d+'sms','method':_0x078e('0x35'),'headers':{'user_key':_0x2fd92e[_0x078e('0x36')],'Session_key':_0x2fd92e[_0x078e('0x37')]},'json':!![],'body':_0x421b4a};return rp(_0x397bb3);})[_0x078e('0x1e')](function(_0x119dfb){if(_0x119dfb['total_sent']>=0x1){var _0x33f623={'messageId':_0x119dfb[_0x078e('0x38')]};if(_0x1ac0b6['smsMethod']!=='GP'||!_0x1ac0b6[_0x078e('0x39')]){_0x33f623[_0x078e('0x3a')]=!![];}return _0x1be92d['update'](_0x33f623);}else{return logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),'skebby',util[_0x078e('0x2b')](_0x119dfb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2ee093){return logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x2d'),util['inspect'](_0x2ee093,{'showHidden':![],'depth':null}));});}else{logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x078e('0x3b'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x1ac0b6[_0x078e('0x22')]){var _0x18acc2={'recipient':_0x455bb6[_0x078e('0x23')],'message':_0x455bb6[_0x078e('0xc')],'sender':_0x1ac0b6[_0x078e('0x3c')]||_0x1ac0b6[_0x078e('0x23')],'authorization':_0x1ac0b6[_0x078e('0x22')]};var _0x19a90f={'method':_0x078e('0x35'),'uri':_0x078e('0x3d'),'body':_0x18acc2,'json':!![]};rp(_0x19a90f)[_0x078e('0x1e')](function(_0x14b9fe){var _0x286aec={'messageId':_0x14b9fe[_0x078e('0x3e')]};if(!_0x1ac0b6[_0x078e('0x39')]){_0x286aec[_0x078e('0x3a')]=!![];}return _0x1be92d[_0x078e('0x17')](_0x286aec);})[_0x078e('0x19')](function(_0x47043d){logger['error'](_0x078e('0x2a'),'afterCreate',_0x078e('0x3f'),util[_0x078e('0x2b')](_0x47043d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x3f'),_0x078e('0x40'));}break;case _0x078e('0x41'):if(_0x1ac0b6[_0x078e('0x2e')]&&_0x1ac0b6[_0x078e('0x2f')]){var _0x18acc2={'messages':[{'source':_0x078e('0x42'),'to':_0x455bb6['phone'],'body':_0x455bb6['body'],'from':_0x1ac0b6[_0x078e('0x3c')]||_0x1ac0b6[_0x078e('0x23')]}]};var _0x7ac536=util[_0x078e('0x43')](_0x078e('0x44'),_0x1ac0b6[_0x078e('0x2e')],_0x1ac0b6[_0x078e('0x2f')]);var _0x19a90f={'method':_0x078e('0x35'),'uri':_0x078e('0x45'),'body':_0x18acc2,'headers':{'Authorization':util[_0x078e('0x43')]('Basic\x20%s',new Buffer(_0x7ac536)['toString'](_0x078e('0x46')))},'json':!![]};rp(_0x19a90f)[_0x078e('0x1e')](function(_0x5b46b2){if(_0x5b46b2[_0x078e('0x47')]>=0xc8&&_0x5b46b2[_0x078e('0x47')]<=0xce){if(_0x5b46b2[_0x078e('0x48')]&&_0x5b46b2['data'][_0x078e('0x49')]>0x0){var _0x15671e=_['head'](_0x5b46b2[_0x078e('0x48')][_0x078e('0x24')]);var _0x5f3922={'messageId':_0x15671e[_0x078e('0x4a')]};if(!_0x1ac0b6[_0x078e('0x39')]){_0x5f3922[_0x078e('0x3a')]=!![];}return _0x1be92d[_0x078e('0x17')](_0x5f3922);}else{logger['error'](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x4b'),util[_0x078e('0x2b')](_0x5b46b2,{'showHidden':![],'depth':null}));}}else{logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x078e('0x3b'),_0x078e('0x4b'),util[_0x078e('0x2b')](_0x5b46b2,{'showHidden':![],'depth':null}));}})[_0x078e('0x19')](function(_0x1b8545){logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x4b'),util[_0x078e('0x2b')](_0x1b8545,{'showHidden':![],'depth':null}));});}else{logger[_0x078e('0x1a')](_0x078e('0x2a'),'afterCreate',_0x078e('0x4b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x078e('0x4c'):if(_0x1ac0b6[_0x078e('0x4d')]&&_0x1ac0b6[_0x078e('0x22')]){var _0x18acc2={'dst':_0x455bb6[_0x078e('0x23')],'text':_0x455bb6[_0x078e('0xc')],'src':_0x1ac0b6[_0x078e('0x3c')]||_0x1ac0b6[_0x078e('0x23')],'url':_0x1ac0b6[_0x078e('0x26')]+'/api/sms/messages/'+_0x455bb6['id']+'/status?token='+_0x1ac0b6[_0x078e('0x4e')]};var _0x7ac536=util[_0x078e('0x43')](_0x078e('0x44'),_0x1ac0b6['authId'],_0x1ac0b6[_0x078e('0x22')]);var _0x19a90f={'method':_0x078e('0x35'),'uri':util[_0x078e('0x43')](_0x078e('0x4f'),_0x1ac0b6['authId']),'body':_0x18acc2,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x7ac536)[_0x078e('0x50')](_0x078e('0x46')))},'json':!![]};rp(_0x19a90f)[_0x078e('0x1e')](function(_0x7f0f31){var _0x562e60={'messageId':_0x7f0f31[_0x078e('0x51')][0x0]};return _0x1be92d['update'](_0x562e60);})[_0x078e('0x19')](function(_0x31d0d9){logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x4c'),util[_0x078e('0x2b')](_0x31d0d9,{'showHidden':![],'depth':null}));});}else{logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),'plivo',_0x078e('0x52'));}break;case'infobip':if(_0x1ac0b6[_0x078e('0x2e')]&&_0x1ac0b6[_0x078e('0x2f')]){if(_0x1ac0b6['baseUrl']){var _0x34c24c={'method':_0x078e('0x35'),'uri':_0x1ac0b6[_0x078e('0x53')]+_0x078e('0x54'),'body':{'username':_0x1ac0b6[_0x078e('0x2e')],'password':_0x1ac0b6[_0x078e('0x2f')]},'json':!![]};return rp(_0x34c24c)[_0x078e('0x1e')](function(_0x5ea6f8){var _0xd22001={'method':_0x078e('0x35'),'uri':_0x1ac0b6[_0x078e('0x53')]+_0x078e('0x55'),'body':{'messages':[{'from':_0x1ac0b6[_0x078e('0x23')],'destinations':[{'to':_0x455bb6[_0x078e('0x23')]}],'text':_0x455bb6['body'],'notifyUrl':_0x1ac0b6[_0x078e('0x26')]+_0x078e('0x27')+_0x455bb6['id']+_0x078e('0x28')+_0x1ac0b6['token'],'notifyContentType':'application/json','callbackData':_0x1ac0b6[_0x078e('0x23')]+';'+_0x455bb6[_0x078e('0xc')]}]},'headers':{'Authorization':_0x078e('0x56')+_0x5ea6f8[_0x078e('0x4e')]},'json':!![]};return rp(_0xd22001)[_0x078e('0x1e')](function(_0x3ee7bb){if(_0x3ee7bb[_0x078e('0x24')]){var _0x22940e={'messageId':_0x3ee7bb['messages'][0x0]['messageId']};if(!_0x1ac0b6[_0x078e('0x39')]){_0x22940e[_0x078e('0x3a')]=!![];}return _0x1be92d[_0x078e('0x17')](_0x22940e);}else{return logger['error'](_0x078e('0x2a'),'afterCreate',_0x078e('0x57'),util[_0x078e('0x2b')](_0x3ee7bb,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3027bf){return logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x078e('0x3b'),_0x078e('0x57'),util['inspect'](_0x3027bf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x57'),_0x078e('0x58'));}}else{logger['error'](_0x078e('0x2a'),'afterCreate',_0x078e('0x57'),_0x078e('0x59'));}break;case _0x078e('0x5a'):var _0x14ecc0=require(_0x078e('0x5b'));if(_0x1ac0b6[_0x078e('0x5c')]){var _0x458149={};_0x458149[_0x078e('0x5d')]=_0x1ac0b6[_0x078e('0x2e')];_0x458149['phone']=_0x455bb6[_0x078e('0x23')];_0x458149[_0x078e('0x31')]=_0x1ac0b6[_0x078e('0x23')];_0x458149[_0x078e('0x5e')]=_0x455bb6['body'];_0x458149['timestamp']=+new Date();var _0x190051='';var _0x13f4a9='';var _0x1d4c6b=Object[_0x078e('0x5f')](_0x458149);_0x1d4c6b[_0x078e('0x60')]();for(var _0x1994de=0x0;_0x1994de<_0x1d4c6b[_0x078e('0x61')];_0x1994de++){if(_0x190051!=''){_0x190051+='&';}_0x190051+=_0x1d4c6b[_0x1994de]+'='+encodeURIComponent(_0x458149[_0x1d4c6b[_0x1994de]]);_0x13f4a9+=_0x458149[_0x1d4c6b[_0x1994de]];}_0x13f4a9+=_0x1ac0b6[_0x078e('0x5c')];_0x13f4a9=_0x14ecc0[_0x078e('0x62')](_0x078e('0x63'))[_0x078e('0x17')](_0x13f4a9)['digest'](_0x078e('0x64'));if(_0x190051!==''){_0x190051+='&';}_0x190051+='signature='+_0x13f4a9;var _0x397bb3={'method':'GET','uri':_0x1ac0b6[_0x078e('0x53')]+_0x078e('0x65')+_0x190051,'json':!![]};return rp(_0x397bb3)['then'](function(_0x44ea5b){var _0x3a8cd6=Object['keys'](_0x44ea5b);if(_0x44ea5b[_0x3a8cd6[0x0]][_0x078e('0x1a')]&&parseInt(_0x44ea5b[_0x3a8cd6[0x0]][_0x078e('0x1a')])===0x0){var _0x1960c3={'messageId':_0x44ea5b[_0x3a8cd6[0x0]][_0x078e('0x66')]};if(!_0x1ac0b6[_0x078e('0x39')]){_0x1960c3[_0x078e('0x3a')]=!![];}return _0x1be92d[_0x078e('0x17')](_0x1960c3);}else{return logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x5a'),util[_0x078e('0x2b')](_0x44ea5b[_0x078e('0x1a')],{'showHidden':![],'depth':null}));}})[_0x078e('0x19')](function(_0x271ad5){return logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x5a'),util[_0x078e('0x2b')](_0x271ad5,{'showHidden':![],'depth':null}));});}else{logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x5a'),_0x078e('0x67'));}break;case _0x078e('0x68'):if(_0x1ac0b6[_0x078e('0x5c')]){var _0x2921f4={'method':_0x078e('0x35'),'uri':_0x078e('0x69'),'headers':{'Authorization':_0x1ac0b6[_0x078e('0x5c')]},'body':{'content':_0x455bb6[_0x078e('0xc')],'to':[_0x455bb6[_0x078e('0x23')]],'from':_0x1ac0b6[_0x078e('0x23')],'binary':![],'clientMessageId':_0x078e('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x2921f4)['then'](function(_0x36aebf){if(!_0x36aebf['error']){var _0x3feec9={'messageId':_0x36aebf[_0x078e('0x24')][0x0][_0x078e('0x6b')]};if(!_0x1ac0b6[_0x078e('0x39')]){_0x3feec9[_0x078e('0x3a')]=!![];}return _0x1be92d[_0x078e('0x17')](_0x3feec9);}else{return logger['error'](_0x078e('0x2a'),_0x078e('0x3b'),'clickatell',util['inspect'](_0x36aebf[_0x078e('0x1a')],{'showHidden':![],'depth':null}));}})[_0x078e('0x19')](function(_0x1f5924){return logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x078e('0x68'),util[_0x078e('0x2b')](_0x1f5924,{'showHidden':![],'depth':null}));});}else{logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x078e('0x3b'),_0x078e('0x68'),_0x078e('0x67'));}break;case'intelepeer':if(_0x1ac0b6[_0x078e('0x5c')]){var _0x352d8e={};var _0x397bb3={'method':_0x078e('0x35'),'uri':_0x078e('0x6c'),'headers':{'Authorization':_0x078e('0x6d')+_0x1ac0b6[_0x078e('0x5c')],'Content-Type':_0x078e('0x6e')},'body':{'from':_0x1ac0b6[_0x078e('0x23')],'to':_0x455bb6[_0x078e('0x23')],'text':_0x455bb6['body']},'json':!![]};return rp(_0x397bb3)[_0x078e('0x1e')](function(_0x7d7a51){if(_0x7d7a51['code']==0xca){_0x352d8e['message']=_0x7d7a51;var _0x37ccf0={'method':_0x078e('0x35'),'uri':_0x078e('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x1ac0b6[_0x078e('0x5c')],'Content-Type':_0x078e('0x6e')},'body':{'refid':_0x352d8e[_0x078e('0x70')]['refid']},'json':!![]};return rp(_0x37ccf0)[_0x078e('0x1e')](function(_0x195ce3){_0x352d8e[_0x078e('0x71')]=_0x195ce3;var _0x261d76={'messageId':_0x352d8e[_0x078e('0x70')]['refid'],'read':!![]};return _0x1be92d[_0x078e('0x17')](_0x261d76);});}else{return logger[_0x078e('0x1a')](_0x078e('0x2a'),_0x078e('0x3b'),_0x078e('0x72'),util[_0x078e('0x2b')](_0x7d7a51,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a1bfd){return logger['error'](_0x078e('0x2a'),_0x078e('0x3b'),'intelepeer',util['inspect'](_0x5a1bfd,{'showHidden':![],'depth':null}));});}else{return logger[_0x078e('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x078e('0x3b'),_0x078e('0x72'),_0x078e('0x73'));}break;}}})[_0x078e('0x74')](function(){_0x1d2be1();});}else{_0x1d2be1();}}},'charset':_0x078e('0x75'),'collate':_0x078e('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d870152..28e4486 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 _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x41e9ac,_0x103d21){var _0x36b686=function(_0x289b03){while(--_0x289b03){_0x41e9ac['push'](_0x41e9ac['shift']());}};_0x36b686(++_0x103d21);}(_0x8603,0x190));var _0x3860=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x8603[_0x2adfb1];return _0xa52d45;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateSmsMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ No newline at end of file +var _0xdb28=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request'];(function(_0x42c2f7,_0x16bbdd){var _0x55c3ae=function(_0x24502f){while(--_0x24502f){_0x42c2f7['push'](_0x42c2f7['shift']());}};_0x55c3ae(++_0x16bbdd);}(_0xdb28,0x106));var _0x8db2=function(_0x3e22c9,_0x1b4004){_0x3e22c9=_0x3e22c9-0x0;var _0x424ffb=_0xdb28[_0x3e22c9];return _0x424ffb;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('SmsMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateSmsMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateSmsMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5d07865..4602858 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 _0x37c5=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x37c5,0x143));var _0x537c=function(_0x306b54,_0x43e69e){_0x306b54=_0x306b54-0x0;var _0xf6e564=_0x37c5[_0x306b54];return _0xf6e564;};'use strict';var SmsMessageEvents=require(_0x537c('0x0'));var events=[_0x537c('0x1'),_0x537c('0x2'),_0x537c('0x3')];function createListener(_0x567540,_0x11364c){return function(_0x52d973){_0x11364c[_0x537c('0x4')](_0x567540,_0x52d973);};}function removeListener(_0x2f1793,_0x4a8b28){return function(){SmsMessageEvents['removeListener'](_0x2f1793,_0x4a8b28);};}exports[_0x537c('0x5')]=function(_0x1be216){for(var _0x461bd5=0x0,_0x89970d=events[_0x537c('0x6')];_0x461bd5<_0x89970d;_0x461bd5++){var _0x1cf7d3=events[_0x461bd5];var _0x4812c5=createListener(_0x537c('0x7')+_0x1cf7d3,_0x1be216);SmsMessageEvents['on'](_0x1cf7d3,_0x4812c5);}}; \ No newline at end of file +var _0xf352=['update','emit','removeListener','register','./smsMessage.events'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0xf352,0xf9));var _0x2f35=function(_0x44ef46,_0x1b41cc){_0x44ef46=_0x44ef46-0x0;var _0x316a9e=_0xf352[_0x44ef46];return _0x316a9e;};'use strict';var SmsMessageEvents=require(_0x2f35('0x0'));var events=['save','remove',_0x2f35('0x1')];function createListener(_0x5765cb,_0x346573){return function(_0x55326a){_0x346573[_0x2f35('0x2')](_0x5765cb,_0x55326a);};}function removeListener(_0x18a035,_0x1fcd27){return function(){SmsMessageEvents[_0x2f35('0x3')](_0x18a035,_0x1fcd27);};}exports[_0x2f35('0x4')]=function(_0x55f271){for(var _0x1b3f76=0x0,_0x3f2c3c=events['length'];_0x1b3f76<_0x3f2c3c;_0x1b3f76++){var _0x56bc3d=events[_0x1b3f76];var _0x1cbd43=createListener('smsMessage:'+_0x56bc3d,_0x55f271);SmsMessageEvents['on'](_0x56bc3d,_0x1cbd43);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0434680..a04224a 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 _0x3646=['get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3646,0x15f));var _0x6364=function(_0x2be191,_0x4f7e63){_0x2be191=_0x2be191-0x0;var _0x249083=_0x3646[_0x2be191];return _0x249083;};'use strict';var multer=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var path=require(_0x6364('0x2'));var timeout=require(_0x6364('0x3'));var express=require('express');var router=express[_0x6364('0x4')]();var auth=require(_0x6364('0x5'));var interaction=require(_0x6364('0x6'));var config=require(_0x6364('0x7'));var controller=require(_0x6364('0x8'));router[_0x6364('0x9')]('/',auth[_0x6364('0xa')](),controller[_0x6364('0xb')]);router[_0x6364('0x9')](_0x6364('0xc'),auth[_0x6364('0xa')](),controller['describe']);router[_0x6364('0x9')](_0x6364('0xd'),auth[_0x6364('0xa')](),controller[_0x6364('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x6364('0xf')]);router[_0x6364('0x9')](_0x6364('0x10'),auth[_0x6364('0xa')](),controller[_0x6364('0x11')]);router[_0x6364('0x9')](_0x6364('0x12'),auth['isAuthenticated'](),controller[_0x6364('0x13')]);router[_0x6364('0x14')]('/',auth[_0x6364('0xa')](),controller['create']);router[_0x6364('0x14')](_0x6364('0x10'),auth[_0x6364('0xa')](),controller[_0x6364('0x15')]);router['post'](_0x6364('0x12'),auth['isAuthenticated'](),controller[_0x6364('0x16')]);router[_0x6364('0x17')](_0x6364('0xd'),auth['isAuthenticated'](),controller[_0x6364('0x18')]);router[_0x6364('0x19')](_0x6364('0xd'),auth[_0x6364('0xa')](),controller[_0x6364('0x1a')]);router[_0x6364('0x19')](_0x6364('0x10'),auth['isAuthenticated'](),controller[_0x6364('0x1b')]);router['delete'](_0x6364('0x12'),auth[_0x6364('0xa')](),controller[_0x6364('0x1c')]);module[_0x6364('0x1d')]=router; \ No newline at end of file +var _0x41d0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','removeAgents','exports','multer','util','path','connect-timeout','Router'];(function(_0x1f35b3,_0x346bcf){var _0x2e6e31=function(_0x2d0a5a){while(--_0x2d0a5a){_0x1f35b3['push'](_0x1f35b3['shift']());}};_0x2e6e31(++_0x346bcf);}(_0x41d0,0x1c6));var _0x041d=function(_0x205dd4,_0x269d4a){_0x205dd4=_0x205dd4-0x0;var _0x561d69=_0x41d0[_0x205dd4];return _0x561d69;};'use strict';var multer=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var path=require(_0x041d('0x2'));var timeout=require(_0x041d('0x3'));var express=require('express');var router=express[_0x041d('0x4')]();var auth=require(_0x041d('0x5'));var interaction=require(_0x041d('0x6'));var config=require(_0x041d('0x7'));var controller=require(_0x041d('0x8'));router[_0x041d('0x9')]('/',auth[_0x041d('0xa')](),controller[_0x041d('0xb')]);router[_0x041d('0x9')]('/describe',auth[_0x041d('0xa')](),controller['describe']);router[_0x041d('0x9')]('/:id',auth[_0x041d('0xa')](),controller[_0x041d('0xc')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x041d('0xd')]);router['get'](_0x041d('0xe'),auth['isAuthenticated'](),controller[_0x041d('0xf')]);router[_0x041d('0x9')](_0x041d('0x10'),auth[_0x041d('0xa')](),controller[_0x041d('0x11')]);router[_0x041d('0x12')]('/',auth[_0x041d('0xa')](),controller[_0x041d('0x13')]);router[_0x041d('0x12')]('/:id/teams',auth[_0x041d('0xa')](),controller[_0x041d('0x14')]);router[_0x041d('0x12')](_0x041d('0x10'),auth[_0x041d('0xa')](),controller[_0x041d('0x15')]);router['put'](_0x041d('0x16'),auth[_0x041d('0xa')](),controller[_0x041d('0x17')]);router[_0x041d('0x18')](_0x041d('0x16'),auth[_0x041d('0xa')](),controller['destroy']);router['delete'](_0x041d('0xe'),auth[_0x041d('0xa')](),controller['removeTeams']);router[_0x041d('0x18')]('/:id/users',auth[_0x041d('0xa')](),controller[_0x041d('0x19')]);module[_0x041d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e0e3b7b..354f6af 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 _0x8cd7=['ENUM','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x8cd7,0x12b));var _0x78cd=function(_0x57a9ab,_0x347c7a){_0x57a9ab=_0x57a9ab-0x0;var _0x3b8797=_0x8cd7[_0x57a9ab];return _0x3b8797;};'use strict';var Sequelize=require(_0x78cd('0x0'));module[_0x78cd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x78cd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x78cd('0x3')]},'timeout':{'type':Sequelize[_0x78cd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78cd('0x5')]('rrmemory',_0x78cd('0x6'),_0x78cd('0x7'))}}; \ No newline at end of file +var _0x4c22=['beepall','roundrobin','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x4c22,0x17c));var _0x24c2=function(_0x501934,_0x31e33b){_0x501934=_0x501934-0x0;var _0x23ec1c=_0x4c22[_0x501934];return _0x23ec1c;};'use strict';var Sequelize=require('sequelize');module[_0x24c2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x24c2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x24c2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x24c2('0x3')](_0x24c2('0x4'),_0x24c2('0x5'),_0x24c2('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f0ff238..0b06920 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 _0x3659=['../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','status','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','filter','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x3659,0x7f));var _0x9365=function(_0x1621dd,_0x172229){_0x1621dd=_0x1621dd-0x0;var _0x3b0046=_0x3659[_0x1621dd];return _0x3b0046;};'use strict';var pdf=require(_0x9365('0x0'));var emlformat=require(_0x9365('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9365('0x2'));var jsonpatch=require(_0x9365('0x3'));var rp=require('request-promise');var moment=require(_0x9365('0x4'));var BPromise=require(_0x9365('0x5'));var Mustache=require(_0x9365('0x6'));var util=require(_0x9365('0x7'));var path=require(_0x9365('0x8'));var sox=require(_0x9365('0x9'));var csv=require('to-csv');var ejs=require(_0x9365('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9365('0xb'));var crypto=require('crypto');var jsforce=require(_0x9365('0xc'));var deskjs=require(_0x9365('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9365('0xe'));var Papa=require('papaparse');var Redis=require(_0x9365('0xf'));var authService=require(_0x9365('0x10'));var qs=require(_0x9365('0x11'));var as=require(_0x9365('0x12'));var hardwareService=require(_0x9365('0x13'));var logger=require(_0x9365('0x14'))(_0x9365('0x15'));var utils=require(_0x9365('0x16'));var config=require(_0x9365('0x17'));var db=require('../../mysqldb')['db'];config[_0x9365('0x18')]=_[_0x9365('0x19')](config[_0x9365('0x18')],{'host':_0x9365('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9365('0x18')]));require(_0x9365('0x1b'))[_0x9365('0x1c')](socket);function respondWithStatusCode(_0x28bfd8,_0x56a03c){_0x56a03c=_0x56a03c||0xcc;return function(_0x35dfe0){if(_0x35dfe0){return _0x28bfd8[_0x9365('0x1d')](_0x56a03c);}return _0x28bfd8['status'](_0x56a03c)[_0x9365('0x1e')]();};}function respondWithResult(_0x3fe2fa,_0x513421){_0x513421=_0x513421||0xc8;return function(_0x3df850){if(_0x3df850){return _0x3fe2fa[_0x9365('0x1f')](_0x513421)['json'](_0x3df850);}};}function respondWithFilteredResult(_0x56bf5d,_0x5df258){return function(_0x46a812){if(_0x46a812){var _0x234b73=_0x46a812[_0x9365('0x20')],_0x188376=_0x5df258['offset'],_0x443062=_0x5df258['offset']+_0x5df258[_0x9365('0x21')],_0x5d5bbf;if(_0x443062>=_0x234b73){_0x443062=_0x234b73;_0x5d5bbf=0xc8;}else{_0x5d5bbf=0xce;}_0x56bf5d[_0x9365('0x1f')](_0x5d5bbf);return _0x56bf5d[_0x9365('0x22')](_0x9365('0x23'),_0x188376+'-'+_0x443062+'/'+_0x234b73)[_0x9365('0x24')](_0x46a812);}return null;};}function patchUpdates(_0x4500d3){return function(_0x323bdb){try{jsonpatch[_0x9365('0x25')](_0x323bdb,_0x4500d3,!![]);}catch(_0x5ef30f){return BPromise[_0x9365('0x26')](_0x5ef30f);}return _0x323bdb[_0x9365('0x27')]();};}function saveUpdates(_0x569b2a,_0x300756){return function(_0xb4216e){if(_0xb4216e){return _0xb4216e[_0x9365('0x28')](_0x569b2a)['then'](function(_0xd09787){return _0xd09787;});}return null;};}function removeEntity(_0x1241ce,_0x5201f6){return function(_0x159bf2){if(_0x159bf2){return _0x159bf2['destroy']()[_0x9365('0x29')](function(){var _0x4a7028=_0x159bf2[_0x9365('0x2a')]({'plain':!![]});var _0x31372e=_0x9365('0x2b');return db[_0x9365('0x2c')][_0x9365('0x2d')]({'where':{'type':_0x31372e,'resourceId':_0x4a7028['id']}})[_0x9365('0x29')](function(){return _0x159bf2;});})[_0x9365('0x29')](function(){_0x1241ce[_0x9365('0x1f')](0xcc)[_0x9365('0x1e')]();});}};}function handleEntityNotFound(_0x4675fe,_0x541c65){return function(_0x1d8934){if(!_0x1d8934){_0x4675fe['sendStatus'](0x194);}return _0x1d8934;};}function handleError(_0x26eb12,_0x4ee00b){_0x4ee00b=_0x4ee00b||0x1f4;return function(_0xd07514){logger[_0x9365('0x2e')](_0xd07514[_0x9365('0x2f')]);if(_0xd07514['name']){delete _0xd07514['name'];}_0x26eb12['status'](_0x4ee00b)[_0x9365('0x30')](_0xd07514);};}exports[_0x9365('0x31')]=function(_0x16b133,_0x450861){var _0x22a721={},_0x5ec79f={},_0x349aba={'count':0x0,'rows':[]};var _0x5ea9d7=_[_0x9365('0x32')](db[_0x9365('0x33')][_0x9365('0x34')],function(_0x41e9dc){return{'name':_0x41e9dc[_0x9365('0x35')],'type':_0x41e9dc[_0x9365('0x36')][_0x9365('0x37')]};});_0x5ec79f['model']=_[_0x9365('0x32')](_0x5ea9d7,'name');_0x5ec79f[_0x9365('0x38')]=_['keys'](_0x16b133[_0x9365('0x38')]);_0x5ec79f[_0x9365('0x39')]=_[_0x9365('0x3a')](_0x5ec79f[_0x9365('0x3b')],_0x5ec79f[_0x9365('0x38')]);_0x22a721[_0x9365('0x3c')]=_[_0x9365('0x3a')](_0x5ec79f[_0x9365('0x3b')],qs['fields'](_0x16b133[_0x9365('0x38')][_0x9365('0x3d')]));_0x22a721[_0x9365('0x3c')]=_0x22a721[_0x9365('0x3c')][_0x9365('0x3e')]?_0x22a721[_0x9365('0x3c')]:_0x5ec79f[_0x9365('0x3b')];if(!_0x16b133['query'][_0x9365('0x3f')](_0x9365('0x40'))){_0x22a721['limit']=qs[_0x9365('0x21')](_0x16b133[_0x9365('0x38')][_0x9365('0x21')]);_0x22a721[_0x9365('0x41')]=qs[_0x9365('0x41')](_0x16b133['query']['offset']);}_0x22a721['order']=qs[_0x9365('0x42')](_0x16b133['query']['sort']);_0x22a721[_0x9365('0x43')]=qs[_0x9365('0x39')](_[_0x9365('0x44')](_0x16b133[_0x9365('0x38')],_0x5ec79f[_0x9365('0x39')]),_0x5ea9d7);if(_0x16b133[_0x9365('0x38')]['filter']){_0x22a721[_0x9365('0x43')]=_[_0x9365('0x45')](_0x22a721[_0x9365('0x43')],{'$or':_[_0x9365('0x32')](_0x5ea9d7,function(_0x3d227e){if(_0x3d227e[_0x9365('0x36')]!==_0x9365('0x46')){var _0x249e33={};_0x249e33[_0x3d227e['name']]={'$like':'%'+_0x16b133[_0x9365('0x38')]['filter']+'%'};return _0x249e33;}})});}_0x22a721=_[_0x9365('0x45')]({},_0x22a721,_0x16b133[_0x9365('0x47')]);var _0x58f04f={'where':_0x22a721[_0x9365('0x43')]};return db['SmsQueue'][_0x9365('0x20')](_0x58f04f)[_0x9365('0x29')](function(_0x43f678){_0x349aba[_0x9365('0x20')]=_0x43f678;if(_0x16b133[_0x9365('0x38')][_0x9365('0x48')]){_0x22a721['include']=[{'all':!![]}];}return db[_0x9365('0x33')][_0x9365('0x49')](_0x22a721);})[_0x9365('0x29')](function(_0x3c61b5){_0x349aba[_0x9365('0x4a')]=_0x3c61b5;return _0x349aba;})[_0x9365('0x29')](respondWithFilteredResult(_0x450861,_0x22a721))[_0x9365('0x4b')](handleError(_0x450861,null));};exports[_0x9365('0x4c')]=function(_0x2c30fc,_0x264d96){var _0x1f4bfa={'raw':!![],'where':{'id':_0x2c30fc[_0x9365('0x4d')]['id']}},_0x54cfb4={};_0x54cfb4[_0x9365('0x3b')]=_[_0x9365('0x4e')](db[_0x9365('0x33')][_0x9365('0x34')]);_0x54cfb4[_0x9365('0x38')]=_[_0x9365('0x4e')](_0x2c30fc['query']);_0x54cfb4[_0x9365('0x39')]=_[_0x9365('0x3a')](_0x54cfb4[_0x9365('0x3b')],_0x54cfb4[_0x9365('0x38')]);_0x1f4bfa['attributes']=_[_0x9365('0x3a')](_0x54cfb4['model'],qs[_0x9365('0x3d')](_0x2c30fc['query'][_0x9365('0x3d')]));_0x1f4bfa[_0x9365('0x3c')]=_0x1f4bfa[_0x9365('0x3c')][_0x9365('0x3e')]?_0x1f4bfa[_0x9365('0x3c')]:_0x54cfb4['model'];if(_0x2c30fc[_0x9365('0x38')][_0x9365('0x48')]){_0x1f4bfa[_0x9365('0x4f')]=[{'all':!![]}];}_0x1f4bfa=_[_0x9365('0x45')]({},_0x1f4bfa,_0x2c30fc[_0x9365('0x47')]);return db[_0x9365('0x33')][_0x9365('0x50')](_0x1f4bfa)['then'](handleEntityNotFound(_0x264d96,null))['then'](respondWithResult(_0x264d96,null))[_0x9365('0x4b')](handleError(_0x264d96,null));};exports['create']=function(_0x153dc2,_0x1341e6){return db[_0x9365('0x33')][_0x9365('0x51')](_0x153dc2[_0x9365('0x52')],{})[_0x9365('0x29')](function(_0x3003ce){var _0x4ec47e=_0x153dc2[_0x9365('0x53')]['get']({'plain':!![]});if(!_0x4ec47e)throw new Error(_0x9365('0x54'));if(_0x4ec47e[_0x9365('0x55')]===_0x9365('0x53')){var _0x1ceac6=_0x3003ce[_0x9365('0x2a')]({'plain':!![]});var _0x31e13b=_0x9365('0x2b');return db[_0x9365('0x56')][_0x9365('0x50')]({'where':{'name':_0x31e13b,'userProfileId':_0x4ec47e['userProfileId']},'raw':!![]})[_0x9365('0x29')](function(_0x5ecc29){if(_0x5ecc29&&_0x5ecc29[_0x9365('0x57')]===0x0){return db[_0x9365('0x2c')][_0x9365('0x51')]({'name':_0x1ceac6[_0x9365('0x58')],'resourceId':_0x1ceac6['id'],'type':_0x5ecc29[_0x9365('0x58')],'sectionId':_0x5ecc29['id']},{})['then'](function(){return _0x3003ce;});}else{return _0x3003ce;}})['catch'](function(_0xd7fdaf){logger[_0x9365('0x2e')](_0x9365('0x59'),_0xd7fdaf);throw _0xd7fdaf;});}return _0x3003ce;})[_0x9365('0x29')](respondWithResult(_0x1341e6,0xc9))['catch'](handleError(_0x1341e6,null));};exports[_0x9365('0x28')]=function(_0x512380,_0x2f51ba){if(_0x512380[_0x9365('0x52')]['id']){delete _0x512380[_0x9365('0x52')]['id'];}return db['SmsQueue'][_0x9365('0x50')]({'where':{'id':_0x512380[_0x9365('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f51ba,null))[_0x9365('0x29')](saveUpdates(_0x512380['body'],null))['then'](respondWithResult(_0x2f51ba,null))['catch'](handleError(_0x2f51ba,null));};exports[_0x9365('0x2d')]=function(_0x11d87e,_0x34ea5e){return db[_0x9365('0x33')]['find']({'where':{'id':_0x11d87e[_0x9365('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ea5e,null))[_0x9365('0x29')](removeEntity(_0x34ea5e,null))['catch'](handleError(_0x34ea5e,null));};exports['describe']=function(_0x2223ae,_0x8aee22){return db[_0x9365('0x33')][_0x9365('0x5a')]()[_0x9365('0x29')](respondWithResult(_0x8aee22,null))[_0x9365('0x4b')](handleError(_0x8aee22,null));};exports[_0x9365('0x5b')]=function(_0x23b2bb,_0x17099b,_0x26d57f){var _0x22b6b4={'raw':!![],'where':{}},_0x129d91={},_0x4ee3a6;return db[_0x9365('0x33')][_0x9365('0x5c')]({'where':{'id':_0x23b2bb[_0x9365('0x4d')]['id']}})[_0x9365('0x29')](handleEntityNotFound(_0x17099b,null))[_0x9365('0x29')](function(_0x348734){if(_0x348734){_0x4ee3a6=_0x348734[_0x9365('0x2a')]({'plain':!![]});_0x129d91['model']=_[_0x9365('0x4e')](db[_0x9365('0x5d')][_0x9365('0x34')]);_0x129d91['query']=_[_0x9365('0x4e')](_0x23b2bb['query']);_0x129d91[_0x9365('0x39')]=_[_0x9365('0x3a')](_0x129d91[_0x9365('0x3b')],_0x129d91[_0x9365('0x38')]);_0x22b6b4['attributes']=_[_0x9365('0x3a')](_0x129d91[_0x9365('0x3b')],qs[_0x9365('0x3d')](_0x23b2bb[_0x9365('0x38')]['fields']));_0x22b6b4[_0x9365('0x3c')]=_0x22b6b4[_0x9365('0x3c')][_0x9365('0x3e')]?_0x22b6b4[_0x9365('0x3c')]:_0x129d91[_0x9365('0x3b')];if(!_0x23b2bb[_0x9365('0x38')][_0x9365('0x3f')](_0x9365('0x40'))){_0x22b6b4['limit']=qs[_0x9365('0x21')](_0x23b2bb[_0x9365('0x38')][_0x9365('0x21')]);_0x22b6b4['offset']=qs[_0x9365('0x41')](_0x23b2bb[_0x9365('0x38')][_0x9365('0x41')]);}_0x22b6b4[_0x9365('0x5e')]=qs[_0x9365('0x42')](_0x23b2bb[_0x9365('0x38')][_0x9365('0x42')]);_0x22b6b4[_0x9365('0x43')]=qs['filters'](_['pick'](_0x23b2bb['query'],_0x129d91['filters']));_0x22b6b4['where'][_0x9365('0x5f')]=_0x348734['id'];if(_0x23b2bb[_0x9365('0x38')][_0x9365('0x60')]){_0x22b6b4['where']=_['merge'](_0x22b6b4[_0x9365('0x43')],{'$or':_[_0x9365('0x32')](_0x22b6b4[_0x9365('0x3c')],function(_0x57ef7d){var _0xdbb93a={};_0xdbb93a[_0x57ef7d]={'$like':'%'+_0x23b2bb['query']['filter']+'%'};return _0xdbb93a;})});}_0x22b6b4=_[_0x9365('0x45')]({},_0x22b6b4,_0x23b2bb[_0x9365('0x47')]);return db[_0x9365('0x5d')][_0x9365('0x49')](_0x22b6b4);}})['then'](function(_0x1fbe3e){if(_0x1fbe3e){return db[_0x9365('0x61')][_0x9365('0x62')]({'where':{'id':_[_0x9365('0x32')](_0x1fbe3e,'UserId'),'role':_0x9365('0x63')},'attributes':['id',_0x9365('0x58'),_0x9365('0x64'),_0x9365('0x65'),_0x9365('0x66')]});}})[_0x9365('0x29')](function(_0x41f5fa){if(_0x41f5fa){return{'count':_0x41f5fa[_0x9365('0x20')],'rows':_[_0x9365('0x32')](_0x41f5fa[_0x9365('0x4a')],function(_0x411dcf){return{'membername':_0x411dcf['name'],'UserId':_0x411dcf['id'],'queue_name':_0x4ee3a6['name'],'SmsQueueId':_0x4ee3a6['id'],'interface':util[_0x9365('0x67')](_0x9365('0x68'),_0x9365('0x69'),_0x411dcf['name']),'penalty':0x0,'paused':_0x411dcf[_0x9365('0x64')],'createdAt':_0x411dcf[_0x9365('0x66')],'updatedAt':_0x411dcf[_0x9365('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17099b,_0x22b6b4))['catch'](handleError(_0x17099b,null));};exports['getTeams']=function(_0x3b3796,_0x1c53ec,_0x17bf29){var _0x302f40={};var _0x2f3a34={};var _0x239749;var _0x5f3703;return db['SmsQueue'][_0x9365('0x5c')]({'where':{'id':_0x3b3796['params']['id']}})['then'](handleEntityNotFound(_0x1c53ec,null))[_0x9365('0x29')](function(_0xbc1deb){if(_0xbc1deb){_0x239749=_0xbc1deb;_0x2f3a34[_0x9365('0x3b')]=_['keys'](db[_0x9365('0x6a')]['rawAttributes']);_0x2f3a34[_0x9365('0x38')]=_[_0x9365('0x4e')](_0x3b3796[_0x9365('0x38')]);_0x2f3a34[_0x9365('0x39')]=_[_0x9365('0x3a')](_0x2f3a34[_0x9365('0x3b')],_0x2f3a34[_0x9365('0x38')]);_0x302f40[_0x9365('0x3c')]=_['intersection'](_0x2f3a34[_0x9365('0x3b')],qs[_0x9365('0x3d')](_0x3b3796[_0x9365('0x38')][_0x9365('0x3d')]));_0x302f40[_0x9365('0x3c')]=_0x302f40['attributes'][_0x9365('0x3e')]?_0x302f40['attributes']:_0x2f3a34[_0x9365('0x3b')];_0x302f40[_0x9365('0x5e')]=qs[_0x9365('0x42')](_0x3b3796[_0x9365('0x38')][_0x9365('0x42')]);_0x302f40[_0x9365('0x43')]=qs[_0x9365('0x39')](_[_0x9365('0x44')](_0x3b3796[_0x9365('0x38')],_0x2f3a34[_0x9365('0x39')]));if(_0x3b3796[_0x9365('0x38')][_0x9365('0x60')]){_0x302f40['where']=_[_0x9365('0x45')](_0x302f40[_0x9365('0x43')],{'$or':_['map'](_0x302f40[_0x9365('0x3c')],function(_0x5e56c3){var _0x47adec={};_0x47adec[_0x5e56c3]={'$like':'%'+_0x3b3796[_0x9365('0x38')][_0x9365('0x60')]+'%'};return _0x47adec;})});}_0x302f40=_[_0x9365('0x45')]({},_0x302f40,_0x3b3796[_0x9365('0x47')]);return _0x239749[_0x9365('0x6b')](_0x302f40);}})[_0x9365('0x29')](function(_0x458ac4){if(_0x458ac4){_0x5f3703=_0x458ac4[_0x9365('0x3e')];if(!_0x3b3796[_0x9365('0x38')][_0x9365('0x3f')](_0x9365('0x40'))){_0x302f40[_0x9365('0x21')]=qs['limit'](_0x3b3796[_0x9365('0x38')]['limit']);_0x302f40['offset']=qs['offset'](_0x3b3796[_0x9365('0x38')][_0x9365('0x41')]);}return _0x239749[_0x9365('0x6b')](_0x302f40);}})[_0x9365('0x29')](function(_0x381772){if(_0x381772){return _0x381772?{'count':_0x5f3703,'rows':_0x381772}:null;}})['then'](respondWithResult(_0x1c53ec,null))[_0x9365('0x4b')](handleError(_0x1c53ec,null));};exports[_0x9365('0x6c')]=function(_0x3fcd7f,_0x50f456,_0x94f91f){var _0x34e632=_0x3fcd7f[_0x9365('0x52')][_0x9365('0x6d')];return db[_0x9365('0x6a')][_0x9365('0x49')]({'where':{'id':_0x34e632},'attributes':['id'],'include':[{'model':db[_0x9365('0x61')],'as':_0x9365('0x6e'),'attributes':['id',_0x9365('0x58'),'online',_0x9365('0x6f'),_0x9365('0x70')],'raw':!![]}]})['then'](function(_0x1ee32e){if(_0x1ee32e){var _0x40b281=_[_0x9365('0x71')](_0x1ee32e,function(_0x524162){var _0x157087=_0x524162[_0x9365('0x2a')]({'plain':!![]});return _0x157087[_0x9365('0x6e')];});return db[_0x9365('0x33')][_0x9365('0x50')]({'where':{'id':_0x3fcd7f[_0x9365('0x4d')]['id']}})[_0x9365('0x29')](function(_0x2c3aa1){return db['sequelize']['transaction'](function(_0x573eff){return _0x2c3aa1[_0x9365('0x6c')](_0x34e632,{'transaction':_0x573eff})['then'](function(){return BPromise[_0x9365('0x72')](_0x40b281,function(_0x4f382c){return db[_0x9365('0x5d')][_0x9365('0x73')]({'where':{'UserId':_0x4f382c['id'],'SmsQueueId':_0x3fcd7f[_0x9365('0x4d')]['id']},'transaction':_0x573eff});});})[_0x9365('0x29')](function(){_0x40b281[_0x9365('0x74')](function(_0xb7efd3){socket[_0x9365('0x75')]('userSmsQueue:save',{'UserId':_0xb7efd3['id'],'SmsQueueId':_0x2c3aa1['id']});});});});});}})[_0x9365('0x29')](respondWithStatusCode(_0x50f456,null))[_0x9365('0x4b')](handleError(_0x50f456,null));};exports[_0x9365('0x76')]=function(_0x5c5a15,_0x23e054,_0x416fdf){return db[_0x9365('0x6a')][_0x9365('0x49')]({'where':{'id':_0x5c5a15['query'][_0x9365('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x9365('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9365('0x29')](handleEntityNotFound(_0x23e054,null))[_0x9365('0x29')](function(_0x1a30b7){var _0x5dcc5c=_['map'](_0x1a30b7,'id');var _0x45725e=[];var _0x5918a8=[];var _0x5e872d=squel[_0x9365('0x77')]();_0x5e872d[_0x9365('0x78')](_0x9365('0x79'))[_0x9365('0x7a')](_0x9365('0x7b'),'tq')[_0x9365('0x7c')](_0x9365('0x7d'),'ut',_0x9365('0x7e'))[_0x9365('0x43')](_0x9365('0x7f'),_0x5c5a15[_0x9365('0x4d')]['id']);for(var _0x231f8e=0x0;_0x231f8e<_0x1a30b7[_0x9365('0x3e')];_0x231f8e+=0x1){let _0xe6b598=_0x1a30b7[_0x231f8e];for(var _0x4da311=0x0;_0x4da311<_0xe6b598[_0x9365('0x6e')]['length'];_0x4da311+=0x1){let _0xb95487=_0xe6b598['Agents'][_0x4da311];var _0x29e6e8=_0x5e872d[_0x9365('0x80')]();_0x29e6e8['where']('ut.UserId\x20=\x20?',_0xb95487['id']);_0x5918a8[_0x9365('0x81')](db[_0x9365('0x82')][_0x9365('0x38')](_0x29e6e8['toString'](),{'type':db[_0x9365('0x82')][_0x9365('0x83')][_0x9365('0x84')]})[_0x9365('0x29')](function(_0x5b1889){if(_0x5b1889['length']===0x1){return _0xb95487['id'];}else{var _0x582fa3=_[_0x9365('0x85')](_['map'](_0x5b1889,'TeamId'),function(_0x2beac5){return _[_0x9365('0x86')](_0x5dcc5c,_0x2beac5);});if(_0x582fa3){return _0xb95487['id'];}}}));}}return BPromise[_0x9365('0x87')](_0x5918a8)[_0x9365('0x29')](function(_0x9d6967){_0x45725e=_(_0x45725e)[_0x9365('0x88')](_0x9d6967)[_0x9365('0x89')]()[_0x9365('0x8a')]();return db[_0x9365('0x33')][_0x9365('0x50')]({'where':{'id':_0x5c5a15['params']['id']}})[_0x9365('0x29')](function(_0x16a4bf){return db[_0x9365('0x82')]['transaction'](function(_0x126c0d){return _0x16a4bf['removeTeams'](_0x5c5a15[_0x9365('0x38')][_0x9365('0x6d')],{'transaction':_0x126c0d})[_0x9365('0x29')](function(){if(!_[_0x9365('0x8b')](_0x45725e)){return _0x16a4bf[_0x9365('0x8c')](_0x45725e,{'transaction':_0x126c0d});}})['then'](function(){_0x45725e['forEach'](function(_0x624347){socket[_0x9365('0x75')]('userSmsQueue:remove',{'UserId':_0x624347,'SmsQueueId':_0x16a4bf['id']});});});});});});})['then'](respondWithStatusCode(_0x23e054,null))[_0x9365('0x4b')](handleError(_0x23e054,null));};exports[_0x9365('0x8d')]=function(_0x403c72,_0x4e1d57,_0x22ab8b){return db[_0x9365('0x33')][_0x9365('0x50')]({'where':{'id':_0x403c72[_0x9365('0x4d')]['id']}})[_0x9365('0x29')](handleEntityNotFound(_0x4e1d57,null))['then'](function(_0x525eba){if(_0x525eba){return _0x525eba[_0x9365('0x8d')](_0x403c72[_0x9365('0x52')][_0x9365('0x6d')],_[_0x9365('0x8e')](_0x403c72[_0x9365('0x52')],[_0x9365('0x6d'),'id'])||{})[_0x9365('0x8f')](function(_0x2d006c){for(var _0x1b86c1=0x0;_0x1b86c1<_0x403c72['body']['ids']['length'];_0x1b86c1+=0x1){socket[_0x9365('0x75')]('userSmsQueue:save',{'UserId':_0x403c72[_0x9365('0x52')]['ids'][_0x1b86c1],'SmsQueueId':_0x403c72[_0x9365('0x4d')]['id']});}return _0x2d006c;});}})[_0x9365('0x29')](respondWithResult(_0x4e1d57,null))[_0x9365('0x4b')](handleError(_0x4e1d57,null));};exports[_0x9365('0x8c')]=function(_0x35b22b,_0x459572,_0x212bc8){return db['SmsQueue'][_0x9365('0x50')]({'where':{'id':_0x35b22b[_0x9365('0x4d')]['id']}})[_0x9365('0x29')](handleEntityNotFound(_0x459572,null))['then'](function(_0x218e62){if(_0x218e62){return _0x218e62['removeAgents'](_0x35b22b[_0x9365('0x38')][_0x9365('0x6d')])['then'](function(){if(_[_0x9365('0x90')](_0x35b22b[_0x9365('0x38')][_0x9365('0x6d')])){for(var _0x13940b=0x0;_0x13940b<_0x35b22b[_0x9365('0x38')]['ids'][_0x9365('0x3e')];_0x13940b+=0x1){socket[_0x9365('0x75')](_0x9365('0x91'),{'UserId':Number(_0x35b22b[_0x9365('0x38')][_0x9365('0x6d')][_0x13940b]),'SmsQueueId':Number(_0x35b22b[_0x9365('0x4d')]['id'])});}}else{socket[_0x9365('0x75')](_0x9365('0x91'),{'UserId':Number(_0x35b22b[_0x9365('0x38')][_0x9365('0x6d')]),'SmsQueueId':Number(_0x35b22b[_0x9365('0x4d')]['id'])});}});}})[_0x9365('0x29')](respondWithStatusCode(_0x459572,null))[_0x9365('0x4b')](handleError(_0x459572,null));};exports[_0x9365('0x92')]=function(_0x39c483,_0x453156,_0x13ceb7){var _0x168005={};var _0x27bdaf={};var _0x10d405;var _0x531c6c;return db['SmsQueue'][_0x9365('0x5c')]({'where':{'id':_0x39c483[_0x9365('0x4d')]['id']}})[_0x9365('0x29')](handleEntityNotFound(_0x453156,null))[_0x9365('0x29')](function(_0xca17de){if(_0xca17de){_0x10d405=_0xca17de;_0x27bdaf[_0x9365('0x3b')]=_[_0x9365('0x4e')](db['User']['rawAttributes']);_0x27bdaf[_0x9365('0x38')]=_[_0x9365('0x4e')](_0x39c483[_0x9365('0x38')]);_0x27bdaf['filters']=_[_0x9365('0x3a')](_0x27bdaf[_0x9365('0x3b')],_0x27bdaf['query']);_0x168005['attributes']=_[_0x9365('0x3a')](_0x27bdaf[_0x9365('0x3b')],qs['fields'](_0x39c483[_0x9365('0x38')]['fields']));_0x168005[_0x9365('0x3c')]=_0x168005['attributes'][_0x9365('0x3e')]?_0x168005[_0x9365('0x3c')]:_0x27bdaf['model'];_0x168005[_0x9365('0x5e')]=qs['sort'](_0x39c483[_0x9365('0x38')][_0x9365('0x42')]);_0x168005['where']=qs[_0x9365('0x39')](_[_0x9365('0x44')](_0x39c483[_0x9365('0x38')],_0x27bdaf['filters']));if(_0x39c483['query'][_0x9365('0x60')]){_0x168005[_0x9365('0x43')]=_['merge'](_0x168005[_0x9365('0x43')],{'$or':_['map'](_0x168005[_0x9365('0x3c')],function(_0x4a655d){var _0x4c078c={};_0x4c078c[_0x4a655d]={'$like':'%'+_0x39c483[_0x9365('0x38')][_0x9365('0x60')]+'%'};return _0x4c078c;})});}_0x168005=_[_0x9365('0x45')]({},_0x168005,_0x39c483[_0x9365('0x47')]);return _0x10d405[_0x9365('0x92')](_0x168005);}})['then'](function(_0x355253){if(_0x355253){_0x531c6c=_0x355253[_0x9365('0x3e')];if(!_0x39c483['query'][_0x9365('0x3f')]('nolimit')){_0x168005[_0x9365('0x21')]=qs[_0x9365('0x21')](_0x39c483[_0x9365('0x38')][_0x9365('0x21')]);_0x168005[_0x9365('0x41')]=qs['offset'](_0x39c483[_0x9365('0x38')][_0x9365('0x41')]);}return _0x10d405[_0x9365('0x92')](_0x168005);}})[_0x9365('0x29')](function(_0x338430){if(_0x338430){return _0x338430?{'count':_0x531c6c,'rows':_0x338430}:null;}})['then'](respondWithResult(_0x453156,null))[_0x9365('0x4b')](handleError(_0x453156,null));}; \ No newline at end of file +var _0x1bc9=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','SmsQueue','includeAll','findAll','rows','catch','params','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','update','body','describe','findOne','UserSmsQueue','nolimit','SmsQueueId','options','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0x1bc9,0xfb));var _0x91bc=function(_0x4a8bfd,_0x2849a8){_0x4a8bfd=_0x4a8bfd-0x0;var _0x562bd9=_0x1bc9[_0x4a8bfd];return _0x562bd9;};'use strict';var pdf=require(_0x91bc('0x0'));var emlformat=require(_0x91bc('0x1'));var rimraf=require(_0x91bc('0x2'));var zipdir=require(_0x91bc('0x3'));var jsonpatch=require(_0x91bc('0x4'));var rp=require(_0x91bc('0x5'));var moment=require(_0x91bc('0x6'));var BPromise=require(_0x91bc('0x7'));var Mustache=require(_0x91bc('0x8'));var util=require('util');var path=require('path');var sox=require(_0x91bc('0x9'));var csv=require('to-csv');var ejs=require(_0x91bc('0xa'));var fs=require('fs');var _=require(_0x91bc('0xb'));var squel=require(_0x91bc('0xc'));var crypto=require(_0x91bc('0xd'));var jsforce=require(_0x91bc('0xe'));var deskjs=require(_0x91bc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x91bc('0x10'));var Redis=require(_0x91bc('0x11'));var authService=require(_0x91bc('0x12'));var qs=require(_0x91bc('0x13'));var as=require(_0x91bc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91bc('0x15'))(_0x91bc('0x16'));var utils=require(_0x91bc('0x17'));var config=require(_0x91bc('0x18'));var db=require(_0x91bc('0x19'))['db'];config[_0x91bc('0x1a')]=_[_0x91bc('0x1b')](config[_0x91bc('0x1a')],{'host':_0x91bc('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91bc('0x1a')]));require('./smsQueue.socket')[_0x91bc('0x1d')](socket);function respondWithStatusCode(_0xc3c238,_0x247304){_0x247304=_0x247304||0xcc;return function(_0x5d319f){if(_0x5d319f){return _0xc3c238[_0x91bc('0x1e')](_0x247304);}return _0xc3c238[_0x91bc('0x1f')](_0x247304)['end']();};}function respondWithResult(_0x1b77f8,_0x4f9be8){_0x4f9be8=_0x4f9be8||0xc8;return function(_0x4a72c9){if(_0x4a72c9){return _0x1b77f8['status'](_0x4f9be8)[_0x91bc('0x20')](_0x4a72c9);}};}function respondWithFilteredResult(_0x356c24,_0x22f335){return function(_0x31d1ca){if(_0x31d1ca){var _0x5e4f8e=_0x31d1ca[_0x91bc('0x21')],_0x13fac4=_0x22f335[_0x91bc('0x22')],_0x46a2f4=_0x22f335['offset']+_0x22f335[_0x91bc('0x23')],_0x2e3f47;if(_0x46a2f4>=_0x5e4f8e){_0x46a2f4=_0x5e4f8e;_0x2e3f47=0xc8;}else{_0x2e3f47=0xce;}_0x356c24[_0x91bc('0x1f')](_0x2e3f47);return _0x356c24['set'](_0x91bc('0x24'),_0x13fac4+'-'+_0x46a2f4+'/'+_0x5e4f8e)[_0x91bc('0x20')](_0x31d1ca);}return null;};}function patchUpdates(_0x218e1a){return function(_0x1106c4){try{jsonpatch[_0x91bc('0x25')](_0x1106c4,_0x218e1a,!![]);}catch(_0x14003c){return BPromise['reject'](_0x14003c);}return _0x1106c4[_0x91bc('0x26')]();};}function saveUpdates(_0x5ad2fc,_0x9d4488){return function(_0x17154a){if(_0x17154a){return _0x17154a['update'](_0x5ad2fc)[_0x91bc('0x27')](function(_0x5b260e){return _0x5b260e;});}return null;};}function removeEntity(_0x1b9d29,_0x40cec5){return function(_0x9bfa0f){if(_0x9bfa0f){return _0x9bfa0f[_0x91bc('0x28')]()[_0x91bc('0x27')](function(){var _0x3ba807=_0x9bfa0f[_0x91bc('0x29')]({'plain':!![]});var _0x161c0a='SmsQueues';return db['UserProfileResource'][_0x91bc('0x28')]({'where':{'type':_0x161c0a,'resourceId':_0x3ba807['id']}})[_0x91bc('0x27')](function(){return _0x9bfa0f;});})[_0x91bc('0x27')](function(){_0x1b9d29['status'](0xcc)[_0x91bc('0x2a')]();});}};}function handleEntityNotFound(_0xb8ded4,_0x2bd801){return function(_0x4f5cb6){if(!_0x4f5cb6){_0xb8ded4[_0x91bc('0x1e')](0x194);}return _0x4f5cb6;};}function handleError(_0x4ebfec,_0x2c9a50){_0x2c9a50=_0x2c9a50||0x1f4;return function(_0x423e6a){logger[_0x91bc('0x2b')](_0x423e6a[_0x91bc('0x2c')]);if(_0x423e6a[_0x91bc('0x2d')]){delete _0x423e6a[_0x91bc('0x2d')];}_0x4ebfec['status'](_0x2c9a50)[_0x91bc('0x2e')](_0x423e6a);};}exports[_0x91bc('0x2f')]=function(_0x262ac5,_0x4e4062){var _0x1cc31e={},_0x512eb2={},_0x49090b={'count':0x0,'rows':[]};var _0x8b0994=_[_0x91bc('0x30')](db['SmsQueue'][_0x91bc('0x31')],function(_0x509ea8){return{'name':_0x509ea8[_0x91bc('0x32')],'type':_0x509ea8[_0x91bc('0x33')]['key']};});_0x512eb2[_0x91bc('0x34')]=_[_0x91bc('0x30')](_0x8b0994,'name');_0x512eb2['query']=_[_0x91bc('0x35')](_0x262ac5[_0x91bc('0x36')]);_0x512eb2[_0x91bc('0x37')]=_['intersection'](_0x512eb2['model'],_0x512eb2[_0x91bc('0x36')]);_0x1cc31e['attributes']=_[_0x91bc('0x38')](_0x512eb2[_0x91bc('0x34')],qs[_0x91bc('0x39')](_0x262ac5['query'][_0x91bc('0x39')]));_0x1cc31e['attributes']=_0x1cc31e['attributes'][_0x91bc('0x3a')]?_0x1cc31e[_0x91bc('0x3b')]:_0x512eb2[_0x91bc('0x34')];if(!_0x262ac5[_0x91bc('0x36')][_0x91bc('0x3c')]('nolimit')){_0x1cc31e['limit']=qs['limit'](_0x262ac5['query']['limit']);_0x1cc31e[_0x91bc('0x22')]=qs[_0x91bc('0x22')](_0x262ac5['query']['offset']);}_0x1cc31e[_0x91bc('0x3d')]=qs[_0x91bc('0x3e')](_0x262ac5[_0x91bc('0x36')]['sort']);_0x1cc31e['where']=qs[_0x91bc('0x37')](_[_0x91bc('0x3f')](_0x262ac5[_0x91bc('0x36')],_0x512eb2[_0x91bc('0x37')]),_0x8b0994);if(_0x262ac5['query'][_0x91bc('0x40')]){_0x1cc31e['where']=_[_0x91bc('0x41')](_0x1cc31e[_0x91bc('0x42')],{'$or':_[_0x91bc('0x30')](_0x8b0994,function(_0x263673){if(_0x263673[_0x91bc('0x33')]!==_0x91bc('0x43')){var _0x3d5ba8={};_0x3d5ba8[_0x263673[_0x91bc('0x2d')]]={'$like':'%'+_0x262ac5['query'][_0x91bc('0x40')]+'%'};return _0x3d5ba8;}})});}_0x1cc31e=_[_0x91bc('0x41')]({},_0x1cc31e,_0x262ac5['options']);var _0x537d82={'where':_0x1cc31e[_0x91bc('0x42')]};return db[_0x91bc('0x44')][_0x91bc('0x21')](_0x537d82)[_0x91bc('0x27')](function(_0x4440e6){_0x49090b[_0x91bc('0x21')]=_0x4440e6;if(_0x262ac5[_0x91bc('0x36')][_0x91bc('0x45')]){_0x1cc31e['include']=[{'all':!![]}];}return db[_0x91bc('0x44')][_0x91bc('0x46')](_0x1cc31e);})[_0x91bc('0x27')](function(_0x29bdcd){_0x49090b[_0x91bc('0x47')]=_0x29bdcd;return _0x49090b;})['then'](respondWithFilteredResult(_0x4e4062,_0x1cc31e))[_0x91bc('0x48')](handleError(_0x4e4062,null));};exports['show']=function(_0x425ce0,_0x27e414){var _0x3e93fa={'raw':!![],'where':{'id':_0x425ce0[_0x91bc('0x49')]['id']}},_0x525983={};_0x525983['model']=_['keys'](db[_0x91bc('0x44')][_0x91bc('0x31')]);_0x525983[_0x91bc('0x36')]=_[_0x91bc('0x35')](_0x425ce0[_0x91bc('0x36')]);_0x525983['filters']=_['intersection'](_0x525983['model'],_0x525983[_0x91bc('0x36')]);_0x3e93fa[_0x91bc('0x3b')]=_['intersection'](_0x525983[_0x91bc('0x34')],qs[_0x91bc('0x39')](_0x425ce0[_0x91bc('0x36')][_0x91bc('0x39')]));_0x3e93fa['attributes']=_0x3e93fa['attributes'][_0x91bc('0x3a')]?_0x3e93fa['attributes']:_0x525983[_0x91bc('0x34')];if(_0x425ce0[_0x91bc('0x36')][_0x91bc('0x45')]){_0x3e93fa[_0x91bc('0x4a')]=[{'all':!![]}];}_0x3e93fa=_[_0x91bc('0x41')]({},_0x3e93fa,_0x425ce0['options']);return db['SmsQueue'][_0x91bc('0x4b')](_0x3e93fa)[_0x91bc('0x27')](handleEntityNotFound(_0x27e414,null))[_0x91bc('0x27')](respondWithResult(_0x27e414,null))[_0x91bc('0x48')](handleError(_0x27e414,null));};exports[_0x91bc('0x4c')]=function(_0xdfa3bc,_0x5ac7c4){return db[_0x91bc('0x44')][_0x91bc('0x4c')](_0xdfa3bc['body'],{})['then'](function(_0x205607){var _0x3ed5c7=_0xdfa3bc['user'][_0x91bc('0x29')]({'plain':!![]});if(!_0x3ed5c7)throw new Error(_0x91bc('0x4d'));if(_0x3ed5c7[_0x91bc('0x4e')]===_0x91bc('0x4f')){var _0x315513=_0x205607[_0x91bc('0x29')]({'plain':!![]});var _0x115128=_0x91bc('0x50');return db['UserProfileSection'][_0x91bc('0x4b')]({'where':{'name':_0x115128,'userProfileId':_0x3ed5c7['userProfileId']},'raw':!![]})['then'](function(_0x18ec5e){if(_0x18ec5e&&_0x18ec5e['autoAssociation']===0x0){return db['UserProfileResource'][_0x91bc('0x4c')]({'name':_0x315513[_0x91bc('0x2d')],'resourceId':_0x315513['id'],'type':_0x18ec5e[_0x91bc('0x2d')],'sectionId':_0x18ec5e['id']},{})['then'](function(){return _0x205607;});}else{return _0x205607;}})['catch'](function(_0x4588f1){logger[_0x91bc('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4588f1);throw _0x4588f1;});}return _0x205607;})[_0x91bc('0x27')](respondWithResult(_0x5ac7c4,0xc9))['catch'](handleError(_0x5ac7c4,null));};exports[_0x91bc('0x51')]=function(_0x2e8208,_0x23c75f){if(_0x2e8208[_0x91bc('0x52')]['id']){delete _0x2e8208['body']['id'];}return db[_0x91bc('0x44')][_0x91bc('0x4b')]({'where':{'id':_0x2e8208[_0x91bc('0x49')]['id']}})[_0x91bc('0x27')](handleEntityNotFound(_0x23c75f,null))[_0x91bc('0x27')](saveUpdates(_0x2e8208[_0x91bc('0x52')],null))[_0x91bc('0x27')](respondWithResult(_0x23c75f,null))[_0x91bc('0x48')](handleError(_0x23c75f,null));};exports[_0x91bc('0x28')]=function(_0x1fc717,_0x598777){return db[_0x91bc('0x44')]['find']({'where':{'id':_0x1fc717[_0x91bc('0x49')]['id']}})[_0x91bc('0x27')](handleEntityNotFound(_0x598777,null))[_0x91bc('0x27')](removeEntity(_0x598777,null))[_0x91bc('0x48')](handleError(_0x598777,null));};exports[_0x91bc('0x53')]=function(_0x13ca87,_0x22459f){return db[_0x91bc('0x44')][_0x91bc('0x53')]()[_0x91bc('0x27')](respondWithResult(_0x22459f,null))[_0x91bc('0x48')](handleError(_0x22459f,null));};exports['getMembers']=function(_0x34b0e3,_0x5d285a,_0x34428f){var _0x5af259={'raw':!![],'where':{}},_0x48c5d8={},_0x1d8988;return db[_0x91bc('0x44')][_0x91bc('0x54')]({'where':{'id':_0x34b0e3[_0x91bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d285a,null))[_0x91bc('0x27')](function(_0x38f3da){if(_0x38f3da){_0x1d8988=_0x38f3da[_0x91bc('0x29')]({'plain':!![]});_0x48c5d8[_0x91bc('0x34')]=_['keys'](db[_0x91bc('0x55')][_0x91bc('0x31')]);_0x48c5d8[_0x91bc('0x36')]=_['keys'](_0x34b0e3[_0x91bc('0x36')]);_0x48c5d8[_0x91bc('0x37')]=_[_0x91bc('0x38')](_0x48c5d8['model'],_0x48c5d8[_0x91bc('0x36')]);_0x5af259[_0x91bc('0x3b')]=_[_0x91bc('0x38')](_0x48c5d8[_0x91bc('0x34')],qs[_0x91bc('0x39')](_0x34b0e3['query'][_0x91bc('0x39')]));_0x5af259['attributes']=_0x5af259[_0x91bc('0x3b')][_0x91bc('0x3a')]?_0x5af259['attributes']:_0x48c5d8[_0x91bc('0x34')];if(!_0x34b0e3[_0x91bc('0x36')][_0x91bc('0x3c')](_0x91bc('0x56'))){_0x5af259[_0x91bc('0x23')]=qs[_0x91bc('0x23')](_0x34b0e3[_0x91bc('0x36')][_0x91bc('0x23')]);_0x5af259[_0x91bc('0x22')]=qs['offset'](_0x34b0e3[_0x91bc('0x36')][_0x91bc('0x22')]);}_0x5af259[_0x91bc('0x3d')]=qs[_0x91bc('0x3e')](_0x34b0e3['query']['sort']);_0x5af259[_0x91bc('0x42')]=qs['filters'](_[_0x91bc('0x3f')](_0x34b0e3[_0x91bc('0x36')],_0x48c5d8[_0x91bc('0x37')]));_0x5af259['where'][_0x91bc('0x57')]=_0x38f3da['id'];if(_0x34b0e3[_0x91bc('0x36')]['filter']){_0x5af259[_0x91bc('0x42')]=_['merge'](_0x5af259[_0x91bc('0x42')],{'$or':_['map'](_0x5af259[_0x91bc('0x3b')],function(_0x3ee36d){var _0x1d45bf={};_0x1d45bf[_0x3ee36d]={'$like':'%'+_0x34b0e3[_0x91bc('0x36')][_0x91bc('0x40')]+'%'};return _0x1d45bf;})});}_0x5af259=_['merge']({},_0x5af259,_0x34b0e3[_0x91bc('0x58')]);return db[_0x91bc('0x55')][_0x91bc('0x46')](_0x5af259);}})[_0x91bc('0x27')](function(_0x497fc2){if(_0x497fc2){return db[_0x91bc('0x59')][_0x91bc('0x5a')]({'where':{'id':_[_0x91bc('0x30')](_0x497fc2,_0x91bc('0x5b')),'role':_0x91bc('0x5c')},'attributes':['id',_0x91bc('0x2d'),_0x91bc('0x5d'),_0x91bc('0x5e'),_0x91bc('0x5f')]});}})[_0x91bc('0x27')](function(_0x44bea0){if(_0x44bea0){return{'count':_0x44bea0[_0x91bc('0x21')],'rows':_[_0x91bc('0x30')](_0x44bea0[_0x91bc('0x47')],function(_0x521df6){return{'membername':_0x521df6[_0x91bc('0x2d')],'UserId':_0x521df6['id'],'queue_name':_0x1d8988[_0x91bc('0x2d')],'SmsQueueId':_0x1d8988['id'],'interface':util[_0x91bc('0x60')](_0x91bc('0x61'),_0x91bc('0x62'),_0x521df6[_0x91bc('0x2d')]),'penalty':0x0,'paused':_0x521df6[_0x91bc('0x5d')],'createdAt':_0x521df6[_0x91bc('0x5f')],'updatedAt':_0x521df6[_0x91bc('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x91bc('0x27')](respondWithFilteredResult(_0x5d285a,_0x5af259))[_0x91bc('0x48')](handleError(_0x5d285a,null));};exports['getTeams']=function(_0x518c22,_0x259d2e,_0x273d06){var _0x4052d6={};var _0x15ac09={};var _0x261f1c;var _0x10914d;return db[_0x91bc('0x44')][_0x91bc('0x54')]({'where':{'id':_0x518c22['params']['id']}})[_0x91bc('0x27')](handleEntityNotFound(_0x259d2e,null))[_0x91bc('0x27')](function(_0x243e04){if(_0x243e04){_0x261f1c=_0x243e04;_0x15ac09[_0x91bc('0x34')]=_['keys'](db[_0x91bc('0x63')]['rawAttributes']);_0x15ac09[_0x91bc('0x36')]=_[_0x91bc('0x35')](_0x518c22[_0x91bc('0x36')]);_0x15ac09[_0x91bc('0x37')]=_[_0x91bc('0x38')](_0x15ac09[_0x91bc('0x34')],_0x15ac09['query']);_0x4052d6[_0x91bc('0x3b')]=_['intersection'](_0x15ac09[_0x91bc('0x34')],qs['fields'](_0x518c22[_0x91bc('0x36')][_0x91bc('0x39')]));_0x4052d6[_0x91bc('0x3b')]=_0x4052d6['attributes'][_0x91bc('0x3a')]?_0x4052d6[_0x91bc('0x3b')]:_0x15ac09[_0x91bc('0x34')];_0x4052d6[_0x91bc('0x3d')]=qs[_0x91bc('0x3e')](_0x518c22['query'][_0x91bc('0x3e')]);_0x4052d6[_0x91bc('0x42')]=qs[_0x91bc('0x37')](_[_0x91bc('0x3f')](_0x518c22[_0x91bc('0x36')],_0x15ac09[_0x91bc('0x37')]));if(_0x518c22[_0x91bc('0x36')][_0x91bc('0x40')]){_0x4052d6[_0x91bc('0x42')]=_[_0x91bc('0x41')](_0x4052d6[_0x91bc('0x42')],{'$or':_['map'](_0x4052d6[_0x91bc('0x3b')],function(_0x443ac5){var _0x13c451={};_0x13c451[_0x443ac5]={'$like':'%'+_0x518c22[_0x91bc('0x36')]['filter']+'%'};return _0x13c451;})});}_0x4052d6=_[_0x91bc('0x41')]({},_0x4052d6,_0x518c22[_0x91bc('0x58')]);return _0x261f1c['getTeams'](_0x4052d6);}})['then'](function(_0xc41eaa){if(_0xc41eaa){_0x10914d=_0xc41eaa['length'];if(!_0x518c22[_0x91bc('0x36')][_0x91bc('0x3c')](_0x91bc('0x56'))){_0x4052d6[_0x91bc('0x23')]=qs[_0x91bc('0x23')](_0x518c22[_0x91bc('0x36')][_0x91bc('0x23')]);_0x4052d6['offset']=qs[_0x91bc('0x22')](_0x518c22[_0x91bc('0x36')][_0x91bc('0x22')]);}return _0x261f1c[_0x91bc('0x64')](_0x4052d6);}})[_0x91bc('0x27')](function(_0x2592cd){if(_0x2592cd){return _0x2592cd?{'count':_0x10914d,'rows':_0x2592cd}:null;}})['then'](respondWithResult(_0x259d2e,null))[_0x91bc('0x48')](handleError(_0x259d2e,null));};exports[_0x91bc('0x65')]=function(_0x445d61,_0xf5206,_0x57d4ed){var _0x43b619=_0x445d61[_0x91bc('0x52')][_0x91bc('0x66')];return db[_0x91bc('0x63')][_0x91bc('0x46')]({'where':{'id':_0x43b619},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x91bc('0x2d'),_0x91bc('0x67'),_0x91bc('0x68'),_0x91bc('0x69')],'raw':!![]}]})[_0x91bc('0x27')](function(_0x306106){if(_0x306106){var _0x24e9c9=_[_0x91bc('0x6a')](_0x306106,function(_0x34f26e){var _0x2ccb28=_0x34f26e['get']({'plain':!![]});return _0x2ccb28[_0x91bc('0x6b')];});return db['SmsQueue']['find']({'where':{'id':_0x445d61[_0x91bc('0x49')]['id']}})[_0x91bc('0x27')](function(_0xdf47b){return db[_0x91bc('0x6c')][_0x91bc('0x6d')](function(_0x5802f8){return _0xdf47b['addTeams'](_0x43b619,{'transaction':_0x5802f8})['then'](function(){return BPromise['each'](_0x24e9c9,function(_0x311e2e){return db['UserSmsQueue'][_0x91bc('0x6e')]({'where':{'UserId':_0x311e2e['id'],'SmsQueueId':_0x445d61[_0x91bc('0x49')]['id']},'transaction':_0x5802f8});});})[_0x91bc('0x27')](function(){_0x24e9c9['forEach'](function(_0x5df5cc){socket['emit']('userSmsQueue:save',{'UserId':_0x5df5cc['id'],'SmsQueueId':_0xdf47b['id']});});});});});}})['then'](respondWithStatusCode(_0xf5206,null))[_0x91bc('0x48')](handleError(_0xf5206,null));};exports[_0x91bc('0x6f')]=function(_0x374ebb,_0x21e8e7,_0x531c6b){return db['Team'][_0x91bc('0x46')]({'where':{'id':_0x374ebb[_0x91bc('0x36')][_0x91bc('0x66')]},'attributes':['id'],'include':[{'model':db[_0x91bc('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x91bc('0x27')](handleEntityNotFound(_0x21e8e7,null))['then'](function(_0x404204){var _0x1a2506=_[_0x91bc('0x30')](_0x404204,'id');var _0x242966=[];var _0x41d8c1=[];var _0x24ff53=squel['select']();_0x24ff53[_0x91bc('0x70')](_0x91bc('0x71'))[_0x91bc('0x72')](_0x91bc('0x73'),'tq')[_0x91bc('0x74')](_0x91bc('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x91bc('0x42')](_0x91bc('0x76'),_0x374ebb[_0x91bc('0x49')]['id']);for(var _0x597b59=0x0;_0x597b59<_0x404204[_0x91bc('0x3a')];_0x597b59+=0x1){let _0x400da0=_0x404204[_0x597b59];for(var _0x1fd6c6=0x0;_0x1fd6c6<_0x400da0[_0x91bc('0x6b')][_0x91bc('0x3a')];_0x1fd6c6+=0x1){let _0x1a07ad=_0x400da0[_0x91bc('0x6b')][_0x1fd6c6];var _0x590950=_0x24ff53[_0x91bc('0x77')]();_0x590950['where'](_0x91bc('0x78'),_0x1a07ad['id']);_0x41d8c1['push'](db[_0x91bc('0x6c')][_0x91bc('0x36')](_0x590950['toString'](),{'type':db[_0x91bc('0x6c')]['QueryTypes'][_0x91bc('0x79')]})[_0x91bc('0x27')](function(_0x4c63f0){if(_0x4c63f0[_0x91bc('0x3a')]===0x1){return _0x1a07ad['id'];}else{var _0xeb9a39=_[_0x91bc('0x7a')](_[_0x91bc('0x30')](_0x4c63f0,_0x91bc('0x7b')),function(_0x252b04){return _[_0x91bc('0x7c')](_0x1a2506,_0x252b04);});if(_0xeb9a39){return _0x1a07ad['id'];}}}));}}return BPromise[_0x91bc('0x7d')](_0x41d8c1)[_0x91bc('0x27')](function(_0x308992){_0x242966=_(_0x242966)[_0x91bc('0x7e')](_0x308992)[_0x91bc('0x7f')]()[_0x91bc('0x80')]();return db[_0x91bc('0x44')][_0x91bc('0x4b')]({'where':{'id':_0x374ebb[_0x91bc('0x49')]['id']}})['then'](function(_0x3fc5ab){return db[_0x91bc('0x6c')][_0x91bc('0x6d')](function(_0xedd79b){return _0x3fc5ab[_0x91bc('0x6f')](_0x374ebb[_0x91bc('0x36')][_0x91bc('0x66')],{'transaction':_0xedd79b})[_0x91bc('0x27')](function(){if(!_['isEmpty'](_0x242966)){return _0x3fc5ab[_0x91bc('0x81')](_0x242966,{'transaction':_0xedd79b});}})[_0x91bc('0x27')](function(){_0x242966['forEach'](function(_0x10cbd4){socket[_0x91bc('0x82')](_0x91bc('0x83'),{'UserId':_0x10cbd4,'SmsQueueId':_0x3fc5ab['id']});});});});});});})[_0x91bc('0x27')](respondWithStatusCode(_0x21e8e7,null))['catch'](handleError(_0x21e8e7,null));};exports[_0x91bc('0x84')]=function(_0xdcc1dc,_0xefd3b7,_0x260fee){return db[_0x91bc('0x44')]['find']({'where':{'id':_0xdcc1dc[_0x91bc('0x49')]['id']}})[_0x91bc('0x27')](handleEntityNotFound(_0xefd3b7,null))['then'](function(_0x387915){if(_0x387915){return _0x387915[_0x91bc('0x84')](_0xdcc1dc[_0x91bc('0x52')][_0x91bc('0x66')],_['omit'](_0xdcc1dc['body'],[_0x91bc('0x66'),'id'])||{})[_0x91bc('0x85')](function(_0x2ef610){for(var _0x39f04f=0x0;_0x39f04f<_0xdcc1dc[_0x91bc('0x52')][_0x91bc('0x66')][_0x91bc('0x3a')];_0x39f04f+=0x1){socket['emit'](_0x91bc('0x86'),{'UserId':_0xdcc1dc[_0x91bc('0x52')]['ids'][_0x39f04f],'SmsQueueId':_0xdcc1dc[_0x91bc('0x49')]['id']});}return _0x2ef610;});}})[_0x91bc('0x27')](respondWithResult(_0xefd3b7,null))['catch'](handleError(_0xefd3b7,null));};exports[_0x91bc('0x81')]=function(_0x496719,_0x52519d,_0xe7a2cb){return db[_0x91bc('0x44')][_0x91bc('0x4b')]({'where':{'id':_0x496719[_0x91bc('0x49')]['id']}})[_0x91bc('0x27')](handleEntityNotFound(_0x52519d,null))[_0x91bc('0x27')](function(_0x3ff648){if(_0x3ff648){return _0x3ff648[_0x91bc('0x81')](_0x496719['query']['ids'])[_0x91bc('0x27')](function(){if(_['isArray'](_0x496719[_0x91bc('0x36')][_0x91bc('0x66')])){for(var _0xb63358=0x0;_0xb63358<_0x496719[_0x91bc('0x36')]['ids'][_0x91bc('0x3a')];_0xb63358+=0x1){socket[_0x91bc('0x82')](_0x91bc('0x83'),{'UserId':Number(_0x496719[_0x91bc('0x36')][_0x91bc('0x66')][_0xb63358]),'SmsQueueId':Number(_0x496719[_0x91bc('0x49')]['id'])});}}else{socket[_0x91bc('0x82')](_0x91bc('0x83'),{'UserId':Number(_0x496719[_0x91bc('0x36')][_0x91bc('0x66')]),'SmsQueueId':Number(_0x496719[_0x91bc('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x52519d,null))['catch'](handleError(_0x52519d,null));};exports['getAgents']=function(_0x288040,_0x420e42,_0x5c6b66){var _0xb6a2de={};var _0x3978c5={};var _0x2bb7d4;var _0x3d26d1;return db['SmsQueue'][_0x91bc('0x54')]({'where':{'id':_0x288040[_0x91bc('0x49')]['id']}})[_0x91bc('0x27')](handleEntityNotFound(_0x420e42,null))[_0x91bc('0x27')](function(_0x21d136){if(_0x21d136){_0x2bb7d4=_0x21d136;_0x3978c5[_0x91bc('0x34')]=_['keys'](db[_0x91bc('0x59')][_0x91bc('0x31')]);_0x3978c5['query']=_[_0x91bc('0x35')](_0x288040[_0x91bc('0x36')]);_0x3978c5[_0x91bc('0x37')]=_['intersection'](_0x3978c5[_0x91bc('0x34')],_0x3978c5['query']);_0xb6a2de[_0x91bc('0x3b')]=_[_0x91bc('0x38')](_0x3978c5['model'],qs[_0x91bc('0x39')](_0x288040['query'][_0x91bc('0x39')]));_0xb6a2de[_0x91bc('0x3b')]=_0xb6a2de['attributes'][_0x91bc('0x3a')]?_0xb6a2de[_0x91bc('0x3b')]:_0x3978c5['model'];_0xb6a2de[_0x91bc('0x3d')]=qs[_0x91bc('0x3e')](_0x288040['query'][_0x91bc('0x3e')]);_0xb6a2de['where']=qs[_0x91bc('0x37')](_[_0x91bc('0x3f')](_0x288040[_0x91bc('0x36')],_0x3978c5[_0x91bc('0x37')]));if(_0x288040[_0x91bc('0x36')][_0x91bc('0x40')]){_0xb6a2de[_0x91bc('0x42')]=_[_0x91bc('0x41')](_0xb6a2de['where'],{'$or':_[_0x91bc('0x30')](_0xb6a2de[_0x91bc('0x3b')],function(_0x18f0f1){var _0x21e133={};_0x21e133[_0x18f0f1]={'$like':'%'+_0x288040['query'][_0x91bc('0x40')]+'%'};return _0x21e133;})});}_0xb6a2de=_[_0x91bc('0x41')]({},_0xb6a2de,_0x288040[_0x91bc('0x58')]);return _0x2bb7d4[_0x91bc('0x87')](_0xb6a2de);}})[_0x91bc('0x27')](function(_0x301b30){if(_0x301b30){_0x3d26d1=_0x301b30[_0x91bc('0x3a')];if(!_0x288040[_0x91bc('0x36')][_0x91bc('0x3c')]('nolimit')){_0xb6a2de[_0x91bc('0x23')]=qs[_0x91bc('0x23')](_0x288040[_0x91bc('0x36')][_0x91bc('0x23')]);_0xb6a2de[_0x91bc('0x22')]=qs[_0x91bc('0x22')](_0x288040[_0x91bc('0x36')][_0x91bc('0x22')]);}return _0x2bb7d4['getAgents'](_0xb6a2de);}})['then'](function(_0x22923b){if(_0x22923b){return _0x22923b?{'count':_0x3d26d1,'rows':_0x22923b}:null;}})[_0x91bc('0x27')](respondWithResult(_0x420e42,null))[_0x91bc('0x48')](handleError(_0x420e42,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 8a42730..53b22a2 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 _0xa38f=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x35e06d,_0xad434c){var _0x1b7a39=function(_0x40efcb){while(--_0x40efcb){_0x35e06d['push'](_0x35e06d['shift']());}};_0x1b7a39(++_0xad434c);}(_0xa38f,0xea));var _0xfa38=function(_0x3ab317,_0x3a3b63){_0x3ab317=_0x3ab317-0x0;var _0x4b2d6b=_0xa38f[_0x3ab317];return _0x4b2d6b;};'use strict';var EventEmitter=require(_0xfa38('0x0'));var SmsQueue=require(_0xfa38('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfa38('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa38('0x3'),'afterDestroy':_0xfa38('0x4')};function emitEvent(_0x35a08e){return function(_0x97f1e5,_0x808e8c,_0x3d4cd6){SmsQueueEvents[_0xfa38('0x5')](_0x35a08e+':'+_0x97f1e5['id'],_0x97f1e5);SmsQueueEvents[_0xfa38('0x5')](_0x35a08e,_0x97f1e5);_0x3d4cd6(null);};}for(var e in events){if(events[_0xfa38('0x6')](e)){var event=events[e];SmsQueue[_0xfa38('0x7')](e,emitEvent(event));}}module[_0xfa38('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x76cc=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x5d20ad,_0x5410e2){var _0x197adf=function(_0xf7c7bf){while(--_0xf7c7bf){_0x5d20ad['push'](_0x5d20ad['shift']());}};_0x197adf(++_0x5410e2);}(_0x76cc,0x117));var _0xc76c=function(_0x33fbd4,_0x1873bc){_0x33fbd4=_0x33fbd4-0x0;var _0x155d8e=_0x76cc[_0x33fbd4];return _0x155d8e;};'use strict';var EventEmitter=require(_0xc76c('0x0'));var SmsQueue=require(_0xc76c('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc76c('0x2')](0x0);var events={'afterCreate':_0xc76c('0x3'),'afterUpdate':_0xc76c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2319ca){return function(_0x3dad62,_0x209273,_0x2a2824){SmsQueueEvents['emit'](_0x2319ca+':'+_0x3dad62['id'],_0x3dad62);SmsQueueEvents[_0xc76c('0x5')](_0x2319ca,_0x3dad62);_0x2a2824(null);};}for(var e in events){if(events[_0xc76c('0x6')](e)){var event=events[e];SmsQueue[_0xc76c('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index f772e6b..e55ee3e 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 _0x1d8e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','util','../../config/logger','api'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1d8e,0xcc));var _0xe1d8=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x1d8e[_0x460666];return _0x555cbf;};'use strict';var _=require(_0xe1d8('0x0'));var util=require(_0xe1d8('0x1'));var logger=require(_0xe1d8('0x2'))(_0xe1d8('0x3'));var moment=require(_0xe1d8('0x4'));var BPromise=require(_0xe1d8('0x5'));var rp=require(_0xe1d8('0x6'));var fs=require('fs');var path=require(_0xe1d8('0x7'));var rimraf=require(_0xe1d8('0x8'));var config=require(_0xe1d8('0x9'));var attributes=require('./smsQueue.attributes');module[_0xe1d8('0xa')]=function(_0x1470ae,_0x336be9){return _0x1470ae[_0xe1d8('0xb')](_0xe1d8('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x972c=['api','bluebird','request-promise','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','../../config/logger'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x972c,0xf2));var _0xc972=function(_0x331a99,_0x285516){_0x331a99=_0x331a99-0x0;var _0x37b75d=_0x972c[_0x331a99];return _0x37b75d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc972('0x0'))(_0xc972('0x1'));var moment=require('moment');var BPromise=require(_0xc972('0x2'));var rp=require(_0xc972('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc972('0x4'));var attributes=require(_0xc972('0x5'));module[_0xc972('0x6')]=function(_0x5dd2c8,_0xd70261){return _0x5dd2c8['define'](_0xc972('0x7'),attributes,{'tableName':_0xc972('0x8'),'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 6e46ee9..ae1dcfc 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 _0xc8c5=['../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find','lodash','moment','../../mysqldb'];(function(_0x4c65e7,_0x4adfdc){var _0xdae086=function(_0x2531bd){while(--_0x2531bd){_0x4c65e7['push'](_0x4c65e7['shift']());}};_0xdae086(++_0x4adfdc);}(_0xc8c5,0x1c5));var _0x5c8c=function(_0x130d3b,_0x2b6918){_0x130d3b=_0x130d3b-0x0;var _0x3cba4d=_0xc8c5[_0x130d3b];return _0x3cba4d;};'use strict';var _=require(_0x5c8c('0x0'));var util=require('util');var moment=require(_0x5c8c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c8c('0x2'))['db'];var utils=require(_0x5c8c('0x3'));var logger=require(_0x5c8c('0x4'))('rpc');var config=require(_0x5c8c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c8c('0x6')]({'port':0x232a});config[_0x5c8c('0x7')]=_[_0x5c8c('0x8')](config[_0x5c8c('0x7')],{'host':_0x5c8c('0x9'),'port':0x18eb});var socket=require(_0x5c8c('0xa'))(new Redis(config['redis']));require(_0x5c8c('0xb'))[_0x5c8c('0xc')](socket);function respondWithRpcPromise(_0x3736be,_0x5972a1,_0x4573fc){return new BPromise(function(_0x17c0c5,_0x3292fe){return client[_0x5c8c('0xd')](_0x3736be,_0x4573fc)[_0x5c8c('0xe')](function(_0x1aa2e9){logger[_0x5c8c('0xf')]('SmsQueue,\x20%s,\x20%s',_0x5972a1,_0x5c8c('0x10'));logger[_0x5c8c('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5972a1,_0x5c8c('0x10'),JSON[_0x5c8c('0x12')](_0x1aa2e9));if(_0x1aa2e9[_0x5c8c('0x13')]){if(_0x1aa2e9[_0x5c8c('0x13')][_0x5c8c('0x14')]===0x1f4){logger[_0x5c8c('0x13')](_0x5c8c('0x15'),_0x5972a1,_0x1aa2e9[_0x5c8c('0x13')][_0x5c8c('0x16')]);return _0x3292fe(_0x1aa2e9[_0x5c8c('0x13')][_0x5c8c('0x16')]);}logger[_0x5c8c('0x13')](_0x5c8c('0x15'),_0x5972a1,_0x1aa2e9[_0x5c8c('0x13')][_0x5c8c('0x16')]);return _0x17c0c5(_0x1aa2e9['error'][_0x5c8c('0x16')]);}else{logger[_0x5c8c('0xf')](_0x5c8c('0x15'),_0x5972a1,'request\x20sent');_0x17c0c5(_0x1aa2e9[_0x5c8c('0x17')][_0x5c8c('0x16')]);}})[_0x5c8c('0x18')](function(_0x1b5675){logger['error'](_0x5c8c('0x15'),_0x5972a1,_0x1b5675);_0x3292fe(_0x1b5675);});});}exports[_0x5c8c('0x19')]=function(_0x4c8c4e){var _0x54584b=this;return new Promise(function(_0xe8d5a6,_0x438e21){return db['SmsQueue'][_0x5c8c('0x1a')]({'raw':_0x4c8c4e[_0x5c8c('0x1b')]?_0x4c8c4e[_0x5c8c('0x1b')][_0x5c8c('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c8c4e[_0x5c8c('0x1b')]?_0x4c8c4e[_0x5c8c('0x1b')][_0x5c8c('0x1d')]||null:null,'attributes':_0x4c8c4e[_0x5c8c('0x1b')]?_0x4c8c4e[_0x5c8c('0x1b')][_0x5c8c('0x1e')]||null:null,'limit':_0x4c8c4e[_0x5c8c('0x1b')]?_0x4c8c4e[_0x5c8c('0x1b')][_0x5c8c('0x1f')]||null:null,'include':_0x4c8c4e[_0x5c8c('0x1b')]?_0x4c8c4e[_0x5c8c('0x1b')][_0x5c8c('0x20')]?_['map'](_0x4c8c4e[_0x5c8c('0x1b')]['include'],function(_0x2deea0){return{'model':db[_0x2deea0['model']],'as':_0x2deea0['as'],'attributes':_0x2deea0['attributes'],'include':_0x2deea0[_0x5c8c('0x20')]?_[_0x5c8c('0x21')](_0x2deea0[_0x5c8c('0x20')],function(_0x3c368a){return{'model':db[_0x3c368a[_0x5c8c('0x22')]],'as':_0x3c368a['as'],'attributes':_0x3c368a[_0x5c8c('0x1e')],'include':_0x3c368a[_0x5c8c('0x20')]?_[_0x5c8c('0x21')](_0x3c368a[_0x5c8c('0x20')],function(_0x54fbfd){return{'model':db[_0x54fbfd[_0x5c8c('0x22')]],'as':_0x54fbfd['as'],'attributes':_0x54fbfd[_0x5c8c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c8c('0xe')](function(_0x1d372a){logger[_0x5c8c('0xf')](_0x5c8c('0x19'),_0x4c8c4e);logger[_0x5c8c('0x11')]('GetSmsQueue',_0x4c8c4e,JSON[_0x5c8c('0x12')](_0x1d372a));_0xe8d5a6(_0x1d372a);})['catch'](function(_0x146eea){logger['error'](_0x5c8c('0x19'),_0x146eea[_0x5c8c('0x16')],_0x4c8c4e);_0x438e21(_0x54584b[_0x5c8c('0x13')](0x1f4,_0x146eea['message']));});});};exports[_0x5c8c('0x23')]=function(_0x51f3eb){var _0x564b67=this;return new Promise(function(_0x28d928,_0x1af627){return db[_0x5c8c('0x24')][_0x5c8c('0x25')]({'raw':_0x51f3eb[_0x5c8c('0x1b')]?_0x51f3eb[_0x5c8c('0x1b')][_0x5c8c('0x1c')]===undefined?!![]:![]:!![],'where':_0x51f3eb[_0x5c8c('0x1b')]?_0x51f3eb[_0x5c8c('0x1b')][_0x5c8c('0x1d')]||null:null,'attributes':_0x51f3eb[_0x5c8c('0x1b')]?_0x51f3eb[_0x5c8c('0x1b')][_0x5c8c('0x1e')]||null:null,'include':_0x51f3eb[_0x5c8c('0x1b')]?_0x51f3eb[_0x5c8c('0x1b')][_0x5c8c('0x20')]?_[_0x5c8c('0x21')](_0x51f3eb[_0x5c8c('0x1b')][_0x5c8c('0x20')],function(_0x1810bf){return{'model':db[_0x1810bf['model']],'as':_0x1810bf['as'],'attributes':_0x1810bf[_0x5c8c('0x1e')],'include':_0x1810bf[_0x5c8c('0x20')]?_['map'](_0x1810bf[_0x5c8c('0x20')],function(_0x4a69e5){return{'model':db[_0x4a69e5[_0x5c8c('0x22')]],'as':_0x4a69e5['as'],'attributes':_0x4a69e5[_0x5c8c('0x1e')],'include':_0x4a69e5[_0x5c8c('0x20')]?_[_0x5c8c('0x21')](_0x4a69e5['include'],function(_0x836890){return{'model':db[_0x836890[_0x5c8c('0x22')]],'as':_0x836890['as'],'attributes':_0x836890[_0x5c8c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e6b5f){logger[_0x5c8c('0xf')]('ShowSmsQueue',_0x51f3eb);logger[_0x5c8c('0x11')](_0x5c8c('0x23'),_0x51f3eb,JSON[_0x5c8c('0x12')](_0x4e6b5f));_0x28d928(_0x4e6b5f);})[_0x5c8c('0x18')](function(_0x2eb2fb){logger[_0x5c8c('0x13')](_0x5c8c('0x23'),_0x2eb2fb['message'],_0x51f3eb);_0x1af627(_0x564b67[_0x5c8c('0x13')](0x1f4,_0x2eb2fb[_0x5c8c('0x16')]));});});}; \ No newline at end of file +var _0x2da8=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','request\x20sent','stringify','error','SmsQueue,\x20%s,\x20%s','message','info','result','SmsQueue','findAll','options','where','attributes','limit','include','map','model','GetSmsQueue','find','raw','ShowSmsQueue','debug','lodash'];(function(_0x4e3494,_0x59824e){var _0xabe05d=function(_0x9dcd9b){while(--_0x9dcd9b){_0x4e3494['push'](_0x4e3494['shift']());}};_0xabe05d(++_0x59824e);}(_0x2da8,0x109));var _0x82da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2da8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x82da('0x0'));var util=require('util');var moment=require(_0x82da('0x1'));var BPromise=require('bluebird');var rs=require(_0x82da('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x82da('0x3'));var logger=require(_0x82da('0x4'))(_0x82da('0x5'));var config=require(_0x82da('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x82da('0x7')][_0x82da('0x8')]({'port':0x232a});config[_0x82da('0x9')]=_[_0x82da('0xa')](config['redis'],{'host':_0x82da('0xb'),'port':0x18eb});var socket=require(_0x82da('0xc'))(new Redis(config['redis']));require(_0x82da('0xd'))[_0x82da('0xe')](socket);function respondWithRpcPromise(_0x1081a6,_0x17991b,_0x2d5097){return new BPromise(function(_0x264e5d,_0x2bfdc7){return client[_0x82da('0xf')](_0x1081a6,_0x2d5097)[_0x82da('0x10')](function(_0x1f8238){logger['info']('SmsQueue,\x20%s,\x20%s',_0x17991b,_0x82da('0x11'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x17991b,_0x82da('0x11'),JSON[_0x82da('0x12')](_0x1f8238));if(_0x1f8238[_0x82da('0x13')]){if(_0x1f8238[_0x82da('0x13')]['code']===0x1f4){logger[_0x82da('0x13')](_0x82da('0x14'),_0x17991b,_0x1f8238[_0x82da('0x13')][_0x82da('0x15')]);return _0x2bfdc7(_0x1f8238[_0x82da('0x13')][_0x82da('0x15')]);}logger['error'](_0x82da('0x14'),_0x17991b,_0x1f8238[_0x82da('0x13')][_0x82da('0x15')]);return _0x264e5d(_0x1f8238['error']['message']);}else{logger[_0x82da('0x16')](_0x82da('0x14'),_0x17991b,_0x82da('0x11'));_0x264e5d(_0x1f8238[_0x82da('0x17')][_0x82da('0x15')]);}})['catch'](function(_0x3ae760){logger[_0x82da('0x13')](_0x82da('0x14'),_0x17991b,_0x3ae760);_0x2bfdc7(_0x3ae760);});});}exports['GetSmsQueue']=function(_0x3975da){var _0x131af8=this;return new Promise(function(_0xe23cef,_0x2afbec){return db[_0x82da('0x18')][_0x82da('0x19')]({'raw':_0x3975da[_0x82da('0x1a')]?_0x3975da[_0x82da('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3975da[_0x82da('0x1a')]?_0x3975da['options'][_0x82da('0x1b')]||null:null,'attributes':_0x3975da[_0x82da('0x1a')]?_0x3975da['options'][_0x82da('0x1c')]||null:null,'limit':_0x3975da[_0x82da('0x1a')]?_0x3975da[_0x82da('0x1a')][_0x82da('0x1d')]||null:null,'include':_0x3975da[_0x82da('0x1a')]?_0x3975da[_0x82da('0x1a')][_0x82da('0x1e')]?_[_0x82da('0x1f')](_0x3975da[_0x82da('0x1a')][_0x82da('0x1e')],function(_0x31b159){return{'model':db[_0x31b159[_0x82da('0x20')]],'as':_0x31b159['as'],'attributes':_0x31b159[_0x82da('0x1c')],'include':_0x31b159[_0x82da('0x1e')]?_[_0x82da('0x1f')](_0x31b159[_0x82da('0x1e')],function(_0x31f689){return{'model':db[_0x31f689['model']],'as':_0x31f689['as'],'attributes':_0x31f689['attributes'],'include':_0x31f689[_0x82da('0x1e')]?_[_0x82da('0x1f')](_0x31f689[_0x82da('0x1e')],function(_0x4c3354){return{'model':db[_0x4c3354[_0x82da('0x20')]],'as':_0x4c3354['as'],'attributes':_0x4c3354[_0x82da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x82da('0x10')](function(_0x1e9179){logger['info'](_0x82da('0x21'),_0x3975da);logger['debug'](_0x82da('0x21'),_0x3975da,JSON['stringify'](_0x1e9179));_0xe23cef(_0x1e9179);})['catch'](function(_0x40f0b8){logger[_0x82da('0x13')](_0x82da('0x21'),_0x40f0b8[_0x82da('0x15')],_0x3975da);_0x2afbec(_0x131af8['error'](0x1f4,_0x40f0b8[_0x82da('0x15')]));});});};exports['ShowSmsQueue']=function(_0x1a4890){var _0x483ab6=this;return new Promise(function(_0x1aa4ed,_0x50a6b5){return db[_0x82da('0x18')][_0x82da('0x22')]({'raw':_0x1a4890['options']?_0x1a4890[_0x82da('0x1a')][_0x82da('0x23')]===undefined?!![]:![]:!![],'where':_0x1a4890['options']?_0x1a4890['options'][_0x82da('0x1b')]||null:null,'attributes':_0x1a4890[_0x82da('0x1a')]?_0x1a4890[_0x82da('0x1a')][_0x82da('0x1c')]||null:null,'include':_0x1a4890[_0x82da('0x1a')]?_0x1a4890[_0x82da('0x1a')][_0x82da('0x1e')]?_[_0x82da('0x1f')](_0x1a4890[_0x82da('0x1a')][_0x82da('0x1e')],function(_0x146b52){return{'model':db[_0x146b52[_0x82da('0x20')]],'as':_0x146b52['as'],'attributes':_0x146b52[_0x82da('0x1c')],'include':_0x146b52[_0x82da('0x1e')]?_[_0x82da('0x1f')](_0x146b52[_0x82da('0x1e')],function(_0x5948be){return{'model':db[_0x5948be[_0x82da('0x20')]],'as':_0x5948be['as'],'attributes':_0x5948be[_0x82da('0x1c')],'include':_0x5948be['include']?_[_0x82da('0x1f')](_0x5948be[_0x82da('0x1e')],function(_0x5b2e60){return{'model':db[_0x5b2e60['model']],'as':_0x5b2e60['as'],'attributes':_0x5b2e60[_0x82da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49ea06){logger['info'](_0x82da('0x24'),_0x1a4890);logger[_0x82da('0x25')](_0x82da('0x24'),_0x1a4890,JSON['stringify'](_0x49ea06));_0x1aa4ed(_0x49ea06);})['catch'](function(_0x581ff6){logger[_0x82da('0x13')](_0x82da('0x24'),_0x581ff6[_0x82da('0x15')],_0x1a4890);_0x50a6b5(_0x483ab6['error'](0x1f4,_0x581ff6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a5b98db..5a842de 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 _0x72b7=['save','update','emit','removeListener','register','length','smsQueue:'];(function(_0x580a9f,_0x2fde4c){var _0x7bac9f=function(_0x3d59e2){while(--_0x3d59e2){_0x580a9f['push'](_0x580a9f['shift']());}};_0x7bac9f(++_0x2fde4c);}(_0x72b7,0x181));var _0x772b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x72b7[_0x20a584];return _0x4b41a8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x772b('0x0'),'remove',_0x772b('0x1')];function createListener(_0x5c6885,_0x467110){return function(_0x50de57){_0x467110[_0x772b('0x2')](_0x5c6885,_0x50de57);};}function removeListener(_0x2a1dfa,_0x4e069a){return function(){SmsQueueEvents[_0x772b('0x3')](_0x2a1dfa,_0x4e069a);};}exports[_0x772b('0x4')]=function(_0x5107cd){for(var _0x527389=0x0,_0x124cd1=events[_0x772b('0x5')];_0x527389<_0x124cd1;_0x527389++){var _0x347c84=events[_0x527389];var _0x5bc996=createListener(_0x772b('0x6')+_0x347c84,_0x5107cd);SmsQueueEvents['on'](_0x347c84,_0x5bc996);}}; \ No newline at end of file +var _0xaacd=['./smsQueue.events','save','remove','update','emit','removeListener','register','smsQueue:'];(function(_0x187067,_0x29ea08){var _0x480c13=function(_0x4f3e52){while(--_0x4f3e52){_0x187067['push'](_0x187067['shift']());}};_0x480c13(++_0x29ea08);}(_0xaacd,0xc0));var _0xdaac=function(_0x235563,_0x260ece){_0x235563=_0x235563-0x0;var _0x219be0=_0xaacd[_0x235563];return _0x219be0;};'use strict';var SmsQueueEvents=require(_0xdaac('0x0'));var events=[_0xdaac('0x1'),_0xdaac('0x2'),_0xdaac('0x3')];function createListener(_0x59d97c,_0x2bb29c){return function(_0x5ad6fb){_0x2bb29c[_0xdaac('0x4')](_0x59d97c,_0x5ad6fb);};}function removeListener(_0x2974c2,_0x3d9bff){return function(){SmsQueueEvents[_0xdaac('0x5')](_0x2974c2,_0x3d9bff);};}exports[_0xdaac('0x6')]=function(_0x332e0d){for(var _0x2f0822=0x0,_0x43996d=events['length'];_0x2f0822<_0x43996d;_0x2f0822++){var _0x340c51=events[_0x2f0822];var _0x1c459e=createListener(_0xdaac('0x7')+_0x340c51,_0x332e0d);SmsQueueEvents['on'](_0x340c51,_0x1c459e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f1178a0..a08149f 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 _0xaf2b=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4588bd,_0x57222b){var _0x1becaa=function(_0x2ec59d){while(--_0x2ec59d){_0x4588bd['push'](_0x4588bd['shift']());}};_0x1becaa(++_0x57222b);}(_0xaf2b,0x93));var _0xbaf2=function(_0x93f2d,_0x56e902){_0x93f2d=_0x93f2d-0x0;var _0x1ce7dd=_0xaf2b[_0x93f2d];return _0x1ce7dd;};'use strict';var multer=require(_0xbaf2('0x0'));var util=require(_0xbaf2('0x1'));var path=require(_0xbaf2('0x2'));var timeout=require(_0xbaf2('0x3'));var express=require(_0xbaf2('0x4'));var router=express[_0xbaf2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbaf2('0x6'));var config=require(_0xbaf2('0x7'));var controller=require('./smsQueueReport.controller');router[_0xbaf2('0x8')]('/',auth[_0xbaf2('0x9')](),controller[_0xbaf2('0xa')]);router[_0xbaf2('0x8')](_0xbaf2('0xb'),auth[_0xbaf2('0x9')](),controller[_0xbaf2('0xc')]);router['get']('/:id',auth[_0xbaf2('0x9')](),controller[_0xbaf2('0xd')]);router[_0xbaf2('0xe')]('/',auth[_0xbaf2('0x9')](),controller[_0xbaf2('0xf')]);router[_0xbaf2('0x10')](_0xbaf2('0x11'),auth[_0xbaf2('0x9')](),controller[_0xbaf2('0x12')]);router[_0xbaf2('0x13')](_0xbaf2('0x11'),auth[_0xbaf2('0x9')](),controller[_0xbaf2('0x14')]);module[_0xbaf2('0x15')]=router; \ No newline at end of file +var _0x9731=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x123092,_0x4655bc){var _0x2816cc=function(_0x106014){while(--_0x106014){_0x123092['push'](_0x123092['shift']());}};_0x2816cc(++_0x4655bc);}(_0x9731,0x11b));var _0x1973=function(_0x4c77a0,_0x29cd33){_0x4c77a0=_0x4c77a0-0x0;var _0x5b7397=_0x9731[_0x4c77a0];return _0x5b7397;};'use strict';var multer=require(_0x1973('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1973('0x1'));var express=require(_0x1973('0x2'));var router=express[_0x1973('0x3')]();var auth=require(_0x1973('0x4'));var interaction=require(_0x1973('0x5'));var config=require(_0x1973('0x6'));var controller=require(_0x1973('0x7'));router[_0x1973('0x8')]('/',auth[_0x1973('0x9')](),controller['index']);router[_0x1973('0x8')](_0x1973('0xa'),auth[_0x1973('0x9')](),controller[_0x1973('0xb')]);router[_0x1973('0x8')](_0x1973('0xc'),auth[_0x1973('0x9')](),controller['show']);router['post']('/',auth[_0x1973('0x9')](),controller[_0x1973('0xd')]);router[_0x1973('0xe')]('/:id',auth[_0x1973('0x9')](),controller[_0x1973('0xf')]);router[_0x1973('0x10')](_0x1973('0xc'),auth[_0x1973('0x9')](),controller[_0x1973('0x11')]);module[_0x1973('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 5d3915d..d1cbd84 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 _0xda24=['STRING','DATE','moment','sequelize'];(function(_0x5b70a8,_0xb5daf0){var _0x4b68d2=function(_0x344eaf){while(--_0x344eaf){_0x5b70a8['push'](_0x5b70a8['shift']());}};_0x4b68d2(++_0xb5daf0);}(_0xda24,0xe6));var _0x4da2=function(_0x5be527,_0x47a3f2){_0x5be527=_0x5be527-0x0;var _0x3f0f16=_0xda24[_0x5be527];return _0x3f0f16;};'use strict';var moment=require(_0x4da2('0x0'));var Sequelize=require(_0x4da2('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4da2('0x2')]},'joinAt':{'type':Sequelize[_0x4da2('0x3')]},'leaveAt':{'type':Sequelize[_0x4da2('0x3')]},'acceptAt':{'type':Sequelize[_0x4da2('0x3')]},'exitAt':{'type':Sequelize[_0x4da2('0x3')]},'reason':{'type':Sequelize[_0x4da2('0x2')]}}; \ No newline at end of file +var _0x9083=['exports','STRING','DATE','moment','sequelize'];(function(_0x5aadae,_0x5c337b){var _0x280758=function(_0x7765c3){while(--_0x7765c3){_0x5aadae['push'](_0x5aadae['shift']());}};_0x280758(++_0x5c337b);}(_0x9083,0x1d9));var _0x3908=function(_0xa13eff,_0x3e7df8){_0xa13eff=_0xa13eff-0x0;var _0x22a765=_0x9083[_0xa13eff];return _0x22a765;};'use strict';var moment=require(_0x3908('0x0'));var Sequelize=require(_0x3908('0x1'));module[_0x3908('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3908('0x3')]},'joinAt':{'type':Sequelize[_0x3908('0x4')]},'leaveAt':{'type':Sequelize[_0x3908('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3908('0x4')]},'reason':{'type':Sequelize[_0x3908('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d80a2cc..4680863 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 _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x1ab8f8,_0x387f87){var _0x777a63=function(_0x3021e3){while(--_0x3021e3){_0x1ab8f8['push'](_0x1ab8f8['shift']());}};_0x777a63(++_0x387f87);}(_0x814b,0x1a2));var _0xb814=function(_0x280bef,_0x5e1bd3){_0x280bef=_0x280bef-0x0;var _0x56dc85=_0x814b[_0x280bef];return _0x56dc85;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0xc4aa=['request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['SmsQueueReport']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['SmsQueueReport'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['SmsQueueReport'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x49')]=function(_0x187306,_0x4e6e19){return db[_0xac4a('0x29')][_0xac4a('0x49')]()['then'](respondWithResult(_0x4e6e19,null))[_0xac4a('0x42')](handleError(_0x4e6e19,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4231e03..1469719 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 _0x2904=['exports','SmsQueueReport','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x647508,_0x39d116){var _0x4c54b1=function(_0x54e222){while(--_0x54e222){_0x647508['push'](_0x647508['shift']());}};_0x4c54b1(++_0x39d116);}(_0x2904,0x137));var _0x4290=function(_0x3b11e0,_0x7dc9a){_0x3b11e0=_0x3b11e0-0x0;var _0x436b45=_0x2904[_0x3b11e0];return _0x436b45;};'use strict';var _=require(_0x4290('0x0'));var util=require(_0x4290('0x1'));var logger=require('../../config/logger')(_0x4290('0x2'));var moment=require('moment');var BPromise=require(_0x4290('0x3'));var rp=require(_0x4290('0x4'));var fs=require('fs');var path=require(_0x4290('0x5'));var rimraf=require(_0x4290('0x6'));var config=require(_0x4290('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x4290('0x8')]=function(_0x1ce864,_0x2c44ab){return _0x1ce864['define'](_0x4290('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4290('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafe6=['define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','moment','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x369426,_0x1a7e64){var _0x56871a=function(_0x2eeb00){while(--_0x2eeb00){_0x369426['push'](_0x369426['shift']());}};_0x56871a(++_0x1a7e64);}(_0xafe6,0xac));var _0x6afe=function(_0x532e7b,_0x16a680){_0x532e7b=_0x532e7b-0x0;var _0x136bec=_0xafe6[_0x532e7b];return _0x136bec;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6afe('0x2'));var BPromise=require(_0x6afe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6afe('0x4'));var config=require(_0x6afe('0x5'));var attributes=require(_0x6afe('0x6'));module[_0x6afe('0x7')]=function(_0x2ce302,_0x4898bb){return _0x2ce302[_0x6afe('0x8')](_0x6afe('0x9'),attributes,{'tableName':_0x6afe('0xa'),'paranoid':![],'indexes':[{'name':_0x6afe('0xb'),'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 e561153..cff33a4 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 _0x1e0f=['SmsQueueReport','create','body','options','raw','limit','UpdateSmsQueueReport','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport'];(function(_0x4e50f9,_0x1cf2ab){var _0x4daf9c=function(_0x6291d4){while(--_0x6291d4){_0x4e50f9['push'](_0x4e50f9['shift']());}};_0x4daf9c(++_0x1cf2ab);}(_0x1e0f,0xcb));var _0xf1e0=function(_0x1cd74d,_0x87a9b1){_0x1cd74d=_0x1cd74d-0x0;var _0x380a5a=_0x1e0f[_0x1cd74d];return _0x380a5a;};'use strict';var _=require(_0xf1e0('0x0'));var util=require(_0xf1e0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf1e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf1e0('0x3'));var logger=require(_0xf1e0('0x4'))('rpc');var config=require(_0xf1e0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf1e0('0x6')][_0xf1e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9354eb,_0xc2a86d,_0x488c48){return new BPromise(function(_0x246655,_0x427ca4){return client[_0xf1e0('0x8')](_0x9354eb,_0x488c48)[_0xf1e0('0x9')](function(_0x1986d0){logger[_0xf1e0('0xa')](_0xf1e0('0xb'),_0xc2a86d,_0xf1e0('0xc'));logger[_0xf1e0('0xd')](_0xf1e0('0xe'),_0xc2a86d,_0xf1e0('0xc'),JSON[_0xf1e0('0xf')](_0x1986d0));if(_0x1986d0[_0xf1e0('0x10')]){if(_0x1986d0[_0xf1e0('0x10')]['code']===0x1f4){logger[_0xf1e0('0x10')](_0xf1e0('0xb'),_0xc2a86d,_0x1986d0[_0xf1e0('0x10')][_0xf1e0('0x11')]);return _0x427ca4(_0x1986d0['error'][_0xf1e0('0x11')]);}logger[_0xf1e0('0x10')](_0xf1e0('0xb'),_0xc2a86d,_0x1986d0[_0xf1e0('0x10')][_0xf1e0('0x11')]);return _0x246655(_0x1986d0['error']['message']);}else{logger[_0xf1e0('0xa')](_0xf1e0('0xb'),_0xc2a86d,_0xf1e0('0xc'));_0x246655(_0x1986d0[_0xf1e0('0x12')][_0xf1e0('0x11')]);}})[_0xf1e0('0x13')](function(_0x48851e){logger[_0xf1e0('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0xc2a86d,_0x48851e);_0x427ca4(_0x48851e);});});}exports[_0xf1e0('0x14')]=function(_0x30bb17){var _0x239483=this;return new Promise(function(_0x4ee9ba,_0x4e9ea5){return db[_0xf1e0('0x15')][_0xf1e0('0x16')](_0x30bb17[_0xf1e0('0x17')],{'raw':_0x30bb17[_0xf1e0('0x18')]?_0x30bb17[_0xf1e0('0x18')][_0xf1e0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x24b8f2){logger[_0xf1e0('0xa')](_0xf1e0('0x14'),_0x30bb17);logger['debug'](_0xf1e0('0x14'),_0x30bb17,JSON[_0xf1e0('0xf')](_0x24b8f2));_0x4ee9ba(_0x24b8f2);})[_0xf1e0('0x13')](function(_0x45cf5d){logger[_0xf1e0('0x10')]('CreateSmsQueueReport',_0x45cf5d[_0xf1e0('0x11')],_0x30bb17);_0x4e9ea5(_0x239483[_0xf1e0('0x10')](0x1f4,_0x45cf5d[_0xf1e0('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x3e4588){var _0x49b374=this;return new Promise(function(_0x26092b,_0x157264){return db['SmsQueueReport']['update'](_0x3e4588['body'],{'raw':_0x3e4588['options']?_0x3e4588[_0xf1e0('0x18')][_0xf1e0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e4588[_0xf1e0('0x18')]?_0x3e4588[_0xf1e0('0x18')]['where']||null:null,'attributes':_0x3e4588[_0xf1e0('0x18')]?_0x3e4588['options']['attributes']||null:null,'limit':_0x3e4588[_0xf1e0('0x18')]?_0x3e4588['options'][_0xf1e0('0x1a')]||null:null})[_0xf1e0('0x9')](function(_0x129897){logger['info']('UpdateSmsQueueReport',_0x3e4588);logger['debug'](_0xf1e0('0x1b'),_0x3e4588,JSON[_0xf1e0('0xf')](_0x129897));_0x26092b(_0x129897);})[_0xf1e0('0x13')](function(_0x4fd7e7){logger['error'](_0xf1e0('0x1b'),_0x4fd7e7[_0xf1e0('0x11')],_0x3e4588);_0x157264(_0x49b374[_0xf1e0('0x10')](0x1f4,_0x4fd7e7['message']));});});}; \ No newline at end of file +var _0x3ade=['../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x764aaf,_0x488cb8){var _0x2a64e0=function(_0x223d90){while(--_0x223d90){_0x764aaf['push'](_0x764aaf['shift']());}};_0x2a64e0(++_0x488cb8);}(_0x3ade,0x1d8));var _0xe3ad=function(_0x584789,_0x1f4b10){_0x584789=_0x584789-0x0;var _0x57c028=_0x3ade[_0x584789];return _0x57c028;};'use strict';var _=require('lodash');var util=require(_0xe3ad('0x0'));var moment=require(_0xe3ad('0x1'));var BPromise=require(_0xe3ad('0x2'));var rs=require(_0xe3ad('0x3'));var fs=require('fs');var Redis=require(_0xe3ad('0x4'));var db=require(_0xe3ad('0x5'))['db'];var utils=require(_0xe3ad('0x6'));var logger=require(_0xe3ad('0x7'))('rpc');var config=require(_0xe3ad('0x8'));var jayson=require(_0xe3ad('0x9'));var client=jayson[_0xe3ad('0xa')][_0xe3ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b4f89,_0xe45045,_0x135203){return new BPromise(function(_0x273553,_0x593173){return client['request'](_0x3b4f89,_0x135203)[_0xe3ad('0xc')](function(_0x4b23fc){logger['info'](_0xe3ad('0xd'),_0xe45045,_0xe3ad('0xe'));logger[_0xe3ad('0xf')](_0xe3ad('0x10'),_0xe45045,'request\x20sent',JSON['stringify'](_0x4b23fc));if(_0x4b23fc[_0xe3ad('0x11')]){if(_0x4b23fc['error'][_0xe3ad('0x12')]===0x1f4){logger[_0xe3ad('0x11')](_0xe3ad('0xd'),_0xe45045,_0x4b23fc[_0xe3ad('0x11')][_0xe3ad('0x13')]);return _0x593173(_0x4b23fc[_0xe3ad('0x11')][_0xe3ad('0x13')]);}logger[_0xe3ad('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xe45045,_0x4b23fc[_0xe3ad('0x11')][_0xe3ad('0x13')]);return _0x273553(_0x4b23fc[_0xe3ad('0x11')][_0xe3ad('0x13')]);}else{logger[_0xe3ad('0x14')](_0xe3ad('0xd'),_0xe45045,_0xe3ad('0xe'));_0x273553(_0x4b23fc[_0xe3ad('0x15')]['message']);}})[_0xe3ad('0x16')](function(_0x212644){logger[_0xe3ad('0x11')](_0xe3ad('0xd'),_0xe45045,_0x212644);_0x593173(_0x212644);});});}exports['CreateSmsQueueReport']=function(_0x3f10ae){var _0x59aaa0=this;return new Promise(function(_0xac1d2a,_0x52e9e4){return db['SmsQueueReport'][_0xe3ad('0x17')](_0x3f10ae[_0xe3ad('0x18')],{'raw':_0x3f10ae['options']?_0x3f10ae[_0xe3ad('0x19')][_0xe3ad('0x1a')]===undefined?!![]:![]:!![]})[_0xe3ad('0xc')](function(_0x5da44d){logger[_0xe3ad('0x14')]('CreateSmsQueueReport',_0x3f10ae);logger[_0xe3ad('0xf')](_0xe3ad('0x1b'),_0x3f10ae,JSON['stringify'](_0x5da44d));_0xac1d2a(_0x5da44d);})[_0xe3ad('0x16')](function(_0x530edb){logger[_0xe3ad('0x11')](_0xe3ad('0x1b'),_0x530edb[_0xe3ad('0x13')],_0x3f10ae);_0x52e9e4(_0x59aaa0['error'](0x1f4,_0x530edb[_0xe3ad('0x13')]));});});};exports[_0xe3ad('0x1c')]=function(_0x539078){var _0x20767f=this;return new Promise(function(_0x58b3f0,_0x1826df){return db['SmsQueueReport'][_0xe3ad('0x1d')](_0x539078['body'],{'raw':_0x539078[_0xe3ad('0x19')]?_0x539078[_0xe3ad('0x19')][_0xe3ad('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x539078[_0xe3ad('0x19')]?_0x539078[_0xe3ad('0x19')][_0xe3ad('0x1e')]||null:null,'attributes':_0x539078['options']?_0x539078[_0xe3ad('0x19')]['attributes']||null:null,'limit':_0x539078[_0xe3ad('0x19')]?_0x539078[_0xe3ad('0x19')][_0xe3ad('0x1f')]||null:null})[_0xe3ad('0xc')](function(_0x546bcd){logger['info'](_0xe3ad('0x1c'),_0x539078);logger[_0xe3ad('0xf')]('UpdateSmsQueueReport',_0x539078,JSON['stringify'](_0x546bcd));_0x58b3f0(_0x546bcd);})['catch'](function(_0x1d8151){logger['error']('UpdateSmsQueueReport',_0x1d8151[_0xe3ad('0x13')],_0x539078);_0x1826df(_0x20767f[_0xe3ad('0x11')](0x1f4,_0x1d8151[_0xe3ad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f77d9e2..8a59228 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 _0x8f4c=['get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8f4c,0x113));var _0xc8f4=function(_0x100770,_0x2a6617){_0x100770=_0x100770-0x0;var _0x26c777=_0x8f4c[_0x100770];return _0x26c777;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8f4('0x6'));var config=require(_0xc8f4('0x7'));var controller=require(_0xc8f4('0x8'));router['get']('/',auth[_0xc8f4('0x9')](),controller['index']);router['get']('/describe',auth[_0xc8f4('0x9')](),controller['describe']);router[_0xc8f4('0xa')](_0xc8f4('0xb'),auth[_0xc8f4('0x9')](),controller[_0xc8f4('0xc')]);router[_0xc8f4('0xd')]('/',auth['isAuthenticated'](),controller[_0xc8f4('0xe')]);router[_0xc8f4('0xf')](_0xc8f4('0xb'),auth[_0xc8f4('0x9')](),controller['update']);router[_0xc8f4('0x10')]('/:id',auth[_0xc8f4('0x9')](),controller[_0xc8f4('0x11')]);module[_0xc8f4('0x12')]=router; \ No newline at end of file +var _0x4024=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller','index','get','/describe','describe','isAuthenticated','put','delete','/:id','destroy'];(function(_0x3c17f1,_0x5bd639){var _0x5ec099=function(_0x39694a){while(--_0x39694a){_0x3c17f1['push'](_0x3c17f1['shift']());}};_0x5ec099(++_0x5bd639);}(_0x4024,0x89));var _0x4402=function(_0x27102a,_0x432add){_0x27102a=_0x27102a-0x0;var _0x314c90=_0x4024[_0x27102a];return _0x314c90;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['post']('/',auth[_0x4402('0xb')](),controller['create']);router[_0x4402('0xc')]('/:id',auth[_0x4402('0xb')](),controller['update']);router[_0x4402('0xd')](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);module[_0x4402('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2a544b8..9ad1b50 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 _0x9ddb=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x44389c,_0x73f05e){var _0x329b1b=function(_0x18aab4){while(--_0x18aab4){_0x44389c['push'](_0x44389c['shift']());}};_0x329b1b(++_0x73f05e);}(_0x9ddb,0x1de));var _0xb9dd=function(_0x226ce0,_0x50858a){_0x226ce0=_0x226ce0-0x0;var _0x222650=_0x9ddb[_0x226ce0];return _0x222650;};'use strict';var moment=require(_0xb9dd('0x0'));var Sequelize=require(_0xb9dd('0x1'));module[_0xb9dd('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb9dd('0x3')](_0xb9dd('0x4'),_0xb9dd('0x5'),_0xb9dd('0x6')),'allowNull':![],'defaultValue':_0xb9dd('0x6')},'transferredAt':{'type':Sequelize[_0xb9dd('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xb9dd('0x8')]}}; \ No newline at end of file +var _0x4404=['moment','sequelize','exports','account','agent','queue','DATE','NOW'];(function(_0xaf6897,_0x5a1f05){var _0x26b524=function(_0x36e31f){while(--_0x36e31f){_0xaf6897['push'](_0xaf6897['shift']());}};_0x26b524(++_0x5a1f05);}(_0x4404,0x190));var _0x4440=function(_0x10b843,_0x39c3f7){_0x10b843=_0x10b843-0x0;var _0x34e0eb=_0x4404[_0x10b843];return _0x34e0eb;};'use strict';var moment=require(_0x4440('0x0'));var Sequelize=require(_0x4440('0x1'));module[_0x4440('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4440('0x3'),_0x4440('0x4'),_0x4440('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4440('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x4440('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 40e5b89..e4375cf 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 _0xe706=['catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x390d91,_0xeab53){var _0x370ad9=function(_0x8484b8){while(--_0x8484b8){_0x390d91['push'](_0x390d91['shift']());}};_0x370ad9(++_0xeab53);}(_0xe706,0xa3));var _0x6e70=function(_0x47a756,_0xc38065){_0x47a756=_0x47a756-0x0;var _0x4db04c=_0xe706[_0x47a756];return _0x4db04c;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['SmsTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]),_0x114344);if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));};exports['describe']=function(_0x2c5538,_0x2e3ea6){return db[_0x6e70('0x42')][_0x6e70('0x4e')]()[_0x6e70('0x27')](respondWithResult(_0x2e3ea6,null))['catch'](handleError(_0x2e3ea6,null));}; \ No newline at end of file +var _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','SmsTransferReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0xe4aeaa,_0x27ddb2){var _0x2f236f=function(_0x4bdb5f){while(--_0x4bdb5f){_0xe4aeaa['push'](_0xe4aeaa['shift']());}};_0x2f236f(++_0x27ddb2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['SmsTransferReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['SmsTransferReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['SmsTransferReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index de84f0b..221a585 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 _0x9fd4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','report_sms_transfer','uniqueid'];(function(_0x3a951e,_0x35eade){var _0x142e63=function(_0x377c54){while(--_0x377c54){_0x3a951e['push'](_0x3a951e['shift']());}};_0x142e63(++_0x35eade);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3f823a,_0x29330a){_0x3f823a=_0x3f823a-0x0;var _0x440e40=_0x9fd4[_0x3f823a];return _0x440e40;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('SmsTransferReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[{'name':_0x49fd('0xc'),'fields':[_0x49fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','moment'];(function(_0x2dde34,_0x17cc61){var _0x454551=function(_0x1cc039){while(--_0x1cc039){_0x2dde34['push'](_0x2dde34['shift']());}};_0x454551(++_0x17cc61);}(_0x7ee1,0x8d));var _0x17ee=function(_0x352ff1,_0x1c5aa0){_0x352ff1=_0x352ff1-0x0;var _0x1a2a42=_0x7ee1[_0x352ff1];return _0x1a2a42;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('SmsTransferReport',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x17ee('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4319145..5260820 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 _0x9236=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xa8f24a,_0x48d7d3){var _0x3a1471=function(_0x281470){while(--_0x281470){_0xa8f24a['push'](_0xa8f24a['shift']());}};_0x3a1471(++_0x48d7d3);}(_0x9236,0x9c));var _0x6923=function(_0xc5bc31,_0x1879c8){_0xc5bc31=_0xc5bc31-0x0;var _0x44e3cb=_0x9236[_0xc5bc31];return _0x44e3cb;};'use strict';var _=require(_0x6923('0x0'));var util=require(_0x6923('0x1'));var moment=require(_0x6923('0x2'));var BPromise=require(_0x6923('0x3'));var rs=require(_0x6923('0x4'));var fs=require('fs');var Redis=require(_0x6923('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6923('0x6'));var logger=require(_0x6923('0x7'))('rpc');var config=require(_0x6923('0x8'));var jayson=require(_0x6923('0x9'));var client=jayson[_0x6923('0xa')][_0x6923('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x553184,_0x40dc00,_0x428538){return new BPromise(function(_0x49c842,_0x116126){return client[_0x6923('0xc')](_0x553184,_0x428538)['then'](function(_0x1eca0d){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x40dc00,_0x6923('0xd'));logger[_0x6923('0xe')](_0x6923('0xf'),_0x40dc00,_0x6923('0xd'),JSON[_0x6923('0x10')](_0x1eca0d));if(_0x1eca0d['error']){if(_0x1eca0d[_0x6923('0x11')][_0x6923('0x12')]===0x1f4){logger['error'](_0x6923('0x13'),_0x40dc00,_0x1eca0d[_0x6923('0x11')][_0x6923('0x14')]);return _0x116126(_0x1eca0d[_0x6923('0x11')][_0x6923('0x14')]);}logger['error'](_0x6923('0x13'),_0x40dc00,_0x1eca0d[_0x6923('0x11')][_0x6923('0x14')]);return _0x49c842(_0x1eca0d[_0x6923('0x11')][_0x6923('0x14')]);}else{logger[_0x6923('0x15')](_0x6923('0x13'),_0x40dc00,'request\x20sent');_0x49c842(_0x1eca0d['result'][_0x6923('0x14')]);}})[_0x6923('0x16')](function(_0x44f40b){logger['error'](_0x6923('0x13'),_0x40dc00,_0x44f40b);_0x116126(_0x44f40b);});});} \ No newline at end of file +var _0x4405=['error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2a7774,_0x4931f6){var _0xb41c73=function(_0x2cedee){while(--_0x2cedee){_0x2a7774['push'](_0x2a7774['shift']());}};_0xb41c73(++_0x4931f6);}(_0x4405,0x1a2));var _0x5440=function(_0x176649,_0xa21572){_0x176649=_0x176649-0x0;var _0x41ead7=_0x4405[_0x176649];return _0x41ead7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5440('0x0'));var BPromise=require(_0x5440('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5440('0x2'));var db=require(_0x5440('0x3'))['db'];var utils=require(_0x5440('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5440('0x5'));var jayson=require(_0x5440('0x6'));var client=jayson['client'][_0x5440('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f64c3,_0x5b83f7,_0xa86bc4){return new BPromise(function(_0x1900e1,_0x263c97){return client[_0x5440('0x8')](_0x3f64c3,_0xa86bc4)[_0x5440('0x9')](function(_0xaf74a4){logger[_0x5440('0xa')](_0x5440('0xb'),_0x5b83f7,_0x5440('0xc'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5b83f7,_0x5440('0xc'),JSON[_0x5440('0xd')](_0xaf74a4));if(_0xaf74a4[_0x5440('0xe')]){if(_0xaf74a4[_0x5440('0xe')][_0x5440('0xf')]===0x1f4){logger[_0x5440('0xe')](_0x5440('0xb'),_0x5b83f7,_0xaf74a4[_0x5440('0xe')][_0x5440('0x10')]);return _0x263c97(_0xaf74a4['error'][_0x5440('0x10')]);}logger[_0x5440('0xe')](_0x5440('0xb'),_0x5b83f7,_0xaf74a4[_0x5440('0xe')][_0x5440('0x10')]);return _0x1900e1(_0xaf74a4[_0x5440('0xe')]['message']);}else{logger[_0x5440('0xa')](_0x5440('0xb'),_0x5b83f7,'request\x20sent');_0x1900e1(_0xaf74a4[_0x5440('0x11')][_0x5440('0x10')]);}})['catch'](function(_0xa2a236){logger[_0x5440('0xe')](_0x5440('0xb'),_0x5b83f7,_0xa2a236);_0x263c97(_0xa2a236);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index fe22b2a..d793aea 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 _0x657f=['/:id','/:id/download','download','join','root','originalname','replace','format','basename','extname','now','post','single','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x31e716,_0x1a901f){var _0x531e97=function(_0x1b00ae){while(--_0x1b00ae){_0x31e716['push'](_0x31e716['shift']());}};_0x531e97(++_0x1a901f);}(_0x657f,0x146));var _0xf657=function(_0x2d5934,_0x1acc4f){_0x2d5934=_0x2d5934-0x0;var _0x5807c8=_0x657f[_0x2d5934];return _0x5807c8;};'use strict';var multer=require('multer');var util=require(_0xf657('0x0'));var path=require(_0xf657('0x1'));var timeout=require(_0xf657('0x2'));var express=require('express');var router=express[_0xf657('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf657('0x4'));var config=require(_0xf657('0x5'));var controller=require(_0xf657('0x6'));router[_0xf657('0x7')]('/',auth[_0xf657('0x8')](),controller[_0xf657('0x9')]);router[_0xf657('0x7')](_0xf657('0xa'),auth[_0xf657('0x8')](),controller['show']);router[_0xf657('0x7')](_0xf657('0xb'),auth['isAuthenticated'](),controller[_0xf657('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ea606,_0x14f588,_0x385835){_0x385835(null,path[_0xf657('0xd')](config[_0xf657('0xe')],'server/files/sounds/original/'));},'filename':function(_0x56674a,_0x34e6ee,_0x65960b){_0x34e6ee[_0xf657('0xf')]=_0x34e6ee[_0xf657('0xf')][_0xf657('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x65960b(null,util[_0xf657('0x11')]('%s-%s%s',path[_0xf657('0x12')](_0x34e6ee[_0xf657('0xf')],path[_0xf657('0x13')](_0x34e6ee[_0xf657('0xf')])),Date[_0xf657('0x14')](),path['extname'](_0x34e6ee[_0xf657('0xf')])));}})});router[_0xf657('0x15')]('/',upload[_0xf657('0x16')]('file'),controller[_0xf657('0x17')]);router[_0xf657('0x18')](_0xf657('0xa'),auth['isAuthenticated'](),controller[_0xf657('0x19')]);router[_0xf657('0x1a')](_0xf657('0xa'),auth[_0xf657('0x8')](),controller[_0xf657('0x1a')]);module[_0xf657('0x1b')]=router; \ No newline at end of file +var _0x5dd9=['extname','now','post','single','file','create','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','basename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dd9,0x153));var _0x95dd=function(_0x48f791,_0x57dbd7){_0x48f791=_0x48f791-0x0;var _0x5ec5ea=_0x5dd9[_0x48f791];return _0x5ec5ea;};'use strict';var multer=require('multer');var util=require(_0x95dd('0x0'));var path=require('path');var timeout=require(_0x95dd('0x1'));var express=require(_0x95dd('0x2'));var router=express[_0x95dd('0x3')]();var auth=require(_0x95dd('0x4'));var interaction=require(_0x95dd('0x5'));var config=require(_0x95dd('0x6'));var controller=require('./sound.controller');router[_0x95dd('0x7')]('/',auth[_0x95dd('0x8')](),controller[_0x95dd('0x9')]);router[_0x95dd('0x7')](_0x95dd('0xa'),auth[_0x95dd('0x8')](),controller[_0x95dd('0xb')]);router[_0x95dd('0x7')](_0x95dd('0xc'),auth[_0x95dd('0x8')](),controller[_0x95dd('0xd')]);var upload=multer({'storage':multer[_0x95dd('0xe')]({'destination':function(_0x29b658,_0x42e11e,_0x248481){_0x248481(null,path[_0x95dd('0xf')](config[_0x95dd('0x10')],_0x95dd('0x11')));},'filename':function(_0x2c6645,_0x5821df,_0xe03c93){_0x5821df[_0x95dd('0x12')]=_0x5821df[_0x95dd('0x12')][_0x95dd('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe03c93(null,util['format']('%s-%s%s',path[_0x95dd('0x14')](_0x5821df[_0x95dd('0x12')],path[_0x95dd('0x15')](_0x5821df[_0x95dd('0x12')])),Date[_0x95dd('0x16')](),path[_0x95dd('0x15')](_0x5821df[_0x95dd('0x12')])));}})});router[_0x95dd('0x17')]('/',upload[_0x95dd('0x18')](_0x95dd('0x19')),controller[_0x95dd('0x1a')]);router[_0x95dd('0x1b')](_0x95dd('0xa'),auth[_0x95dd('0x8')](),controller['update']);router[_0x95dd('0x1c')](_0x95dd('0xa'),auth[_0x95dd('0x8')](),controller[_0x95dd('0x1c')]);module[_0x95dd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b83d050..55ee8c1 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 _0xb468=['exports','STRING','name','BIGINT','INTEGER','FLOAT','sequelize'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xb468,0x15d));var _0x8b46=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xb468[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x8b46('0x0'));module[_0x8b46('0x1')]={'name':{'type':Sequelize[_0x8b46('0x2')],'unique':_0x8b46('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8b46('0x2')]},'display_name':{'type':Sequelize[_0x8b46('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x8b46('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x8b46('0x4')]},'original_channelCount':{'type':Sequelize[_0x8b46('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x8b46('0x5')]},'converted_format':{'type':Sequelize[_0x8b46('0x2')]},'converted_duration':{'type':Sequelize[_0x8b46('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x8b46('0x4')]},'converted_channelCount':{'type':Sequelize[_0x8b46('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x8b46('0x5')]}}; \ No newline at end of file +var _0xf2f2=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports','name'];(function(_0x3bca22,_0x12b0de){var _0xa337f2=function(_0x4cc6d4){while(--_0x4cc6d4){_0x3bca22['push'](_0x3bca22['shift']());}};_0xa337f2(++_0x12b0de);}(_0xf2f2,0x177));var _0x2f2f=function(_0xf1603b,_0x257c11){_0xf1603b=_0xf1603b-0x0;var _0x298fab=_0xf2f2[_0xf1603b];return _0x298fab;};'use strict';var Sequelize=require(_0x2f2f('0x0'));module[_0x2f2f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2f2f('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2f2f('0x3')]},'display_name':{'type':Sequelize[_0x2f2f('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x2f2f('0x3')]},'original_format':{'type':Sequelize[_0x2f2f('0x3')]},'original_duration':{'type':Sequelize[_0x2f2f('0x4')]},'original_sampleCount':{'type':Sequelize[_0x2f2f('0x5')]},'original_channelCount':{'type':Sequelize[_0x2f2f('0x6')]},'original_bitRate':{'type':Sequelize[_0x2f2f('0x5')]},'original_sampleRate':{'type':Sequelize[_0x2f2f('0x6')]},'converted_format':{'type':Sequelize[_0x2f2f('0x3')]},'converted_duration':{'type':Sequelize[_0x2f2f('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x2f2f('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x2f2f('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index da32092..f143e4e 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 _0xd1b3=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','end','name','send','index','map','Sound','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','include','catch','show','params','includeAll','find','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','originalname','file','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir'];(function(_0x2f5e59,_0x20948b){var _0x3b07a8=function(_0x3b3feb){while(--_0x3b3feb){_0x2f5e59['push'](_0x2f5e59['shift']());}};_0x3b07a8(++_0x20948b);}(_0xd1b3,0xef));var _0x3d1b=function(_0x45da1e,_0x5aa9de){_0x45da1e=_0x45da1e-0x0;var _0x1fd07e=_0xd1b3[_0x45da1e];return _0x1fd07e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3d1b('0x0'));var rimraf=require(_0x3d1b('0x1'));var zipdir=require(_0x3d1b('0x2'));var jsonpatch=require(_0x3d1b('0x3'));var rp=require(_0x3d1b('0x4'));var moment=require(_0x3d1b('0x5'));var BPromise=require(_0x3d1b('0x6'));var Mustache=require(_0x3d1b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3d1b('0x8'));var csv=require('to-csv');var ejs=require(_0x3d1b('0x9'));var fs=require('fs');var _=require(_0x3d1b('0xa'));var squel=require(_0x3d1b('0xb'));var crypto=require(_0x3d1b('0xc'));var jsforce=require(_0x3d1b('0xd'));var deskjs=require(_0x3d1b('0xe'));var toCsv=require(_0x3d1b('0xf'));var querystring=require(_0x3d1b('0x10'));var Papa=require(_0x3d1b('0x11'));var Redis=require(_0x3d1b('0x12'));var authService=require(_0x3d1b('0x13'));var qs=require(_0x3d1b('0x14'));var as=require(_0x3d1b('0x15'));var hardwareService=require(_0x3d1b('0x16'));var logger=require('../../config/logger')(_0x3d1b('0x17'));var utils=require('../../config/utils');var config=require(_0x3d1b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475fb4,_0xbb8606){_0xbb8606=_0xbb8606||0xcc;return function(_0x1d2fbc){if(_0x1d2fbc){return _0x475fb4[_0x3d1b('0x19')](_0xbb8606);}return _0x475fb4[_0x3d1b('0x1a')](_0xbb8606)['end']();};}function respondWithResult(_0x190d0f,_0x356e74){_0x356e74=_0x356e74||0xc8;return function(_0x2ba3e6){if(_0x2ba3e6){return _0x190d0f[_0x3d1b('0x1a')](_0x356e74)[_0x3d1b('0x1b')](_0x2ba3e6);}};}function respondWithFilteredResult(_0xccdbf6,_0x3a48ec){return function(_0x37198c){if(_0x37198c){var _0x29e2ec=_0x37198c[_0x3d1b('0x1c')],_0x75ded=_0x3a48ec[_0x3d1b('0x1d')],_0x25bf29=_0x3a48ec[_0x3d1b('0x1d')]+_0x3a48ec[_0x3d1b('0x1e')],_0x1c9ca9;if(_0x25bf29>=_0x29e2ec){_0x25bf29=_0x29e2ec;_0x1c9ca9=0xc8;}else{_0x1c9ca9=0xce;}_0xccdbf6[_0x3d1b('0x1a')](_0x1c9ca9);return _0xccdbf6[_0x3d1b('0x1f')](_0x3d1b('0x20'),_0x75ded+'-'+_0x25bf29+'/'+_0x29e2ec)[_0x3d1b('0x1b')](_0x37198c);}return null;};}function patchUpdates(_0x87f5c2){return function(_0x848888){try{jsonpatch[_0x3d1b('0x21')](_0x848888,_0x87f5c2,!![]);}catch(_0x41d18f){return BPromise[_0x3d1b('0x22')](_0x41d18f);}return _0x848888[_0x3d1b('0x23')]();};}function saveUpdates(_0x3a3045,_0x341a2e){return function(_0x5cc0b2){if(_0x5cc0b2){return _0x5cc0b2[_0x3d1b('0x24')](_0x3a3045)[_0x3d1b('0x25')](function(_0x46911f){return _0x46911f;});}return null;};}function removeEntity(_0x2f7e4c,_0x452e0b){return function(_0x4a0db4){if(_0x4a0db4){return _0x4a0db4[_0x3d1b('0x26')]()[_0x3d1b('0x25')](function(){var _0x2e4a00=_0x4a0db4[_0x3d1b('0x27')]({'plain':!![]});var _0x5d0d6c=_0x3d1b('0x28');return db['UserProfileResource'][_0x3d1b('0x26')]({'where':{'type':_0x5d0d6c,'resourceId':_0x2e4a00['id']}})[_0x3d1b('0x25')](function(){return _0x4a0db4;});})[_0x3d1b('0x25')](function(){_0x2f7e4c['status'](0xcc)[_0x3d1b('0x29')]();});}};}function handleEntityNotFound(_0x4002b2,_0xc0c7cd){return function(_0x584163){if(!_0x584163){_0x4002b2[_0x3d1b('0x19')](0x194);}return _0x584163;};}function handleError(_0x112564,_0x4ab371){_0x4ab371=_0x4ab371||0x1f4;return function(_0x1a6d41){logger['error'](_0x1a6d41['stack']);if(_0x1a6d41[_0x3d1b('0x2a')]){delete _0x1a6d41[_0x3d1b('0x2a')];}_0x112564['status'](_0x4ab371)[_0x3d1b('0x2b')](_0x1a6d41);};}exports[_0x3d1b('0x2c')]=function(_0x4da42e,_0x39b1ff){var _0x53572a={},_0x5e2439={},_0x53741b={'count':0x0,'rows':[]};var _0x37d4ae=_[_0x3d1b('0x2d')](db[_0x3d1b('0x2e')]['rawAttributes'],function(_0x2a9c4d){return{'name':_0x2a9c4d[_0x3d1b('0x2f')],'type':_0x2a9c4d[_0x3d1b('0x30')][_0x3d1b('0x31')]};});_0x5e2439[_0x3d1b('0x32')]=_[_0x3d1b('0x2d')](_0x37d4ae,_0x3d1b('0x2a'));_0x5e2439[_0x3d1b('0x33')]=_[_0x3d1b('0x34')](_0x4da42e[_0x3d1b('0x33')]);_0x5e2439['filters']=_[_0x3d1b('0x35')](_0x5e2439[_0x3d1b('0x32')],_0x5e2439[_0x3d1b('0x33')]);_0x53572a[_0x3d1b('0x36')]=_[_0x3d1b('0x35')](_0x5e2439['model'],qs[_0x3d1b('0x37')](_0x4da42e[_0x3d1b('0x33')]['fields']));_0x53572a['attributes']=_0x53572a['attributes']['length']?_0x53572a['attributes']:_0x5e2439[_0x3d1b('0x32')];if(!_0x4da42e[_0x3d1b('0x33')][_0x3d1b('0x38')](_0x3d1b('0x39'))){_0x53572a[_0x3d1b('0x1e')]=qs[_0x3d1b('0x1e')](_0x4da42e['query'][_0x3d1b('0x1e')]);_0x53572a['offset']=qs[_0x3d1b('0x1d')](_0x4da42e[_0x3d1b('0x33')][_0x3d1b('0x1d')]);}_0x53572a[_0x3d1b('0x3a')]=qs[_0x3d1b('0x3b')](_0x4da42e['query'][_0x3d1b('0x3b')]);_0x53572a['where']=qs['filters'](_['pick'](_0x4da42e[_0x3d1b('0x33')],_0x5e2439[_0x3d1b('0x3c')]),_0x37d4ae);if(_0x4da42e['query']['filter']){_0x53572a[_0x3d1b('0x3d')]=_[_0x3d1b('0x3e')](_0x53572a[_0x3d1b('0x3d')],{'$or':_[_0x3d1b('0x2d')](_0x37d4ae,function(_0x445d74){if(_0x445d74[_0x3d1b('0x30')]!==_0x3d1b('0x3f')){var _0x7c6824={};_0x7c6824[_0x445d74['name']]={'$like':'%'+_0x4da42e['query'][_0x3d1b('0x40')]+'%'};return _0x7c6824;}})});}_0x53572a=_['merge']({},_0x53572a,_0x4da42e[_0x3d1b('0x41')]);var _0x2ee817={'where':_0x53572a['where']};return db[_0x3d1b('0x2e')]['count'](_0x2ee817)[_0x3d1b('0x25')](function(_0x204307){_0x53741b[_0x3d1b('0x1c')]=_0x204307;if(_0x4da42e[_0x3d1b('0x33')]['includeAll']){_0x53572a[_0x3d1b('0x42')]=[{'all':!![]}];}return db[_0x3d1b('0x2e')]['findAll'](_0x53572a);})[_0x3d1b('0x25')](function(_0x2260a8){_0x53741b['rows']=_0x2260a8;return _0x53741b;})['then'](respondWithFilteredResult(_0x39b1ff,_0x53572a))[_0x3d1b('0x43')](handleError(_0x39b1ff,null));};exports[_0x3d1b('0x44')]=function(_0x20aeb1,_0x189d8b){var _0x5c9761={'raw':!![],'where':{'id':_0x20aeb1[_0x3d1b('0x45')]['id']}},_0x5bc63f={};_0x5bc63f[_0x3d1b('0x32')]=_['keys'](db[_0x3d1b('0x2e')]['rawAttributes']);_0x5bc63f['query']=_[_0x3d1b('0x34')](_0x20aeb1[_0x3d1b('0x33')]);_0x5bc63f['filters']=_['intersection'](_0x5bc63f[_0x3d1b('0x32')],_0x5bc63f[_0x3d1b('0x33')]);_0x5c9761[_0x3d1b('0x36')]=_[_0x3d1b('0x35')](_0x5bc63f['model'],qs['fields'](_0x20aeb1['query'][_0x3d1b('0x37')]));_0x5c9761[_0x3d1b('0x36')]=_0x5c9761[_0x3d1b('0x36')]['length']?_0x5c9761['attributes']:_0x5bc63f[_0x3d1b('0x32')];if(_0x20aeb1['query'][_0x3d1b('0x46')]){_0x5c9761[_0x3d1b('0x42')]=[{'all':!![]}];}_0x5c9761=_[_0x3d1b('0x3e')]({},_0x5c9761,_0x20aeb1[_0x3d1b('0x41')]);return db[_0x3d1b('0x2e')][_0x3d1b('0x47')](_0x5c9761)[_0x3d1b('0x25')](handleEntityNotFound(_0x189d8b,null))[_0x3d1b('0x25')](respondWithResult(_0x189d8b,null))[_0x3d1b('0x43')](handleError(_0x189d8b,null));};exports['download']=function(_0x410c88,_0x2d69e2,_0xa479a7){return db[_0x3d1b('0x2e')]['find']({'where':{'id':_0x410c88[_0x3d1b('0x45')]['id']},'attributes':[_0x3d1b('0x2a'),_0x3d1b('0x48'),'converted_format'],'raw':!![]})[_0x3d1b('0x25')](handleEntityNotFound(_0x2d69e2,null))[_0x3d1b('0x25')](function(_0x5e0d48){if(_0x5e0d48){if(!fs[_0x3d1b('0x49')](path[_0x3d1b('0x4a')](config[_0x3d1b('0x4b')],_0x3d1b('0x4c'),_0x5e0d48[_0x3d1b('0x48')]+'.'+_0x5e0d48[_0x3d1b('0x4d')]))){throw new db['Sequelize'][(_0x3d1b('0x4e'))](_0x3d1b('0x4f'));}return _0x2d69e2[_0x3d1b('0x50')](path['join'](config[_0x3d1b('0x4b')],_0x3d1b('0x4c'),util[_0x3d1b('0x51')](_0x3d1b('0x52'),_0x5e0d48[_0x3d1b('0x48')],_0x5e0d48['converted_format'])),util[_0x3d1b('0x51')](_0x3d1b('0x52'),_0x5e0d48[_0x3d1b('0x2a')],_0x5e0d48['converted_format']));}return null;})['catch'](handleError(_0x2d69e2,null));};exports[_0x3d1b('0x53')]=function(_0xa73f78,_0x45d1c2,_0x15815a){var _0x42bef9={'name':path[_0x3d1b('0x54')](_0xa73f78['file'][_0x3d1b('0x55')],path['extname'](_0xa73f78[_0x3d1b('0x56')][_0x3d1b('0x55')])),'save_name':path[_0x3d1b('0x54')](_0xa73f78[_0x3d1b('0x56')][_0x3d1b('0x57')],path['extname'](_0xa73f78[_0x3d1b('0x56')][_0x3d1b('0x57')])),'original_format':path[_0x3d1b('0x58')](_0xa73f78[_0x3d1b('0x56')]['originalname'])[_0x3d1b('0x59')](0x1),'converted_format':_0x3d1b('0x5a')};var _0x319ba6=path[_0x3d1b('0x4a')](config[_0x3d1b('0x4b')],_0x3d1b('0x5b'),_0xa73f78[_0x3d1b('0x56')][_0x3d1b('0x57')]);var _0x10e05d=path[_0x3d1b('0x4a')](config[_0x3d1b('0x4b')],'server/files/sounds/converted',util[_0x3d1b('0x51')](_0x3d1b('0x52'),path[_0x3d1b('0x54')](_0xa73f78[_0x3d1b('0x56')][_0x3d1b('0x57')],path[_0x3d1b('0x58')](_0xa73f78[_0x3d1b('0x56')][_0x3d1b('0x57')])),_0x42bef9[_0x3d1b('0x4d')]));logger[_0x3d1b('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x319ba6);logger[_0x3d1b('0x5c')](_0x3d1b('0x5d'),_0x10e05d);try{fs[_0x3d1b('0x5e')](_0x319ba6,parseInt(_0x3d1b('0x5f'),0x8));var _0x2b1162=sox[_0x3d1b('0x60')](_0x319ba6,_0x10e05d,{'sampleRate':0x1f40,'format':_0x3d1b('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b1162['on'](_0x3d1b('0x61'),function(_0x5e11f6){fs[_0x3d1b('0x62')](_0x319ba6);_0x45d1c2[_0x3d1b('0x1a')](0x1f4)['send'](_0x5e11f6);});_0x2b1162['on'](_0x3d1b('0x63'),function(_0xd926e7){_0x42bef9[_0x3d1b('0x64')]=isNaN(_0xd926e7['duration'])?null:_0xd926e7['duration']*0x3e8;_0x42bef9[_0x3d1b('0x65')]=isNaN(_0xd926e7[_0x3d1b('0x66')])?null:_0xd926e7[_0x3d1b('0x66')];_0x42bef9['original_channelCount']=isNaN(_0xd926e7[_0x3d1b('0x67')])?null:_0xd926e7['channelCount'];_0x42bef9[_0x3d1b('0x68')]=isNaN(_0xd926e7[_0x3d1b('0x69')])?null:_0xd926e7[_0x3d1b('0x69')];_0x42bef9['original_sampleRate']=isNaN(_0xd926e7[_0x3d1b('0x6a')])?null:_0xd926e7[_0x3d1b('0x6a')];});_0x2b1162['on']('dest',function(_0x2c9179){_0x42bef9[_0x3d1b('0x6b')]=isNaN(_0x2c9179[_0x3d1b('0x6c')])?null:_0x2c9179[_0x3d1b('0x6c')]*0x3e8;_0x42bef9['converted_sampleCount']=isNaN(_0x2c9179['sampleCount'])?null:_0x2c9179[_0x3d1b('0x66')];_0x42bef9[_0x3d1b('0x6d')]=isNaN(_0x2c9179['channelCount'])?null:_0x2c9179['channelCount'];_0x42bef9[_0x3d1b('0x6e')]=isNaN(_0x2c9179['bitRate'])?null:_0x2c9179[_0x3d1b('0x69')];_0x42bef9[_0x3d1b('0x6f')]=isNaN(_0x2c9179['sampleRate'])?null:_0x2c9179[_0x3d1b('0x6a')];});_0x2b1162['on'](_0x3d1b('0x29'),function(){fs[_0x3d1b('0x5e')](_0x10e05d,parseInt(_0x3d1b('0x5f'),0x8));return db[_0x3d1b('0x2e')][_0x3d1b('0x53')](_0x42bef9)[_0x3d1b('0x25')](function(_0x5cb1cd){var _0x4c5ad7={'role':_0xa73f78[_0x3d1b('0x70')]['role'],'userProfileId':_0xa73f78[_0x3d1b('0x70')][_0x3d1b('0x71')]};if(!_0x4c5ad7)throw new Error(_0x3d1b('0x72'));if(_0x4c5ad7['role']==='user'){var _0xb54efe=_0x5cb1cd[_0x3d1b('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x3d1b('0x47')]({'where':{'name':_0x3d1b('0x28'),'userProfileId':_0x4c5ad7['userProfileId']},'raw':!![]})[_0x3d1b('0x25')](function(_0x2e48ee){if(_0x2e48ee&&_0x2e48ee[_0x3d1b('0x73')]===0x0){return db['UserProfileResource'][_0x3d1b('0x53')]({'name':_0xb54efe[_0x3d1b('0x2a')],'resourceId':_0xb54efe['id'],'type':_0x2e48ee['name'],'sectionId':_0x2e48ee['id']},{})[_0x3d1b('0x25')](function(){return _0x5cb1cd;});}else{return _0x5cb1cd;}})[_0x3d1b('0x43')](function(_0x439b64){logger[_0x3d1b('0x61')](_0x3d1b('0x74'),_0x439b64);throw _0x439b64;});}return _0x5cb1cd;})[_0x3d1b('0x25')](respondWithResult(_0x45d1c2,null))[_0x3d1b('0x43')](handleError(_0x45d1c2,null));});_0x2b1162[_0x3d1b('0x75')]();}catch(_0xc447f3){_0x45d1c2[_0x3d1b('0x1a')](0x1f4)['send'](_0xc447f3);}};exports['update']=function(_0x51d7b7,_0x2ce482,_0xe09c8c){return db[_0x3d1b('0x2e')][_0x3d1b('0x47')]({'where':{'id':_0x51d7b7[_0x3d1b('0x45')]['id']}})[_0x3d1b('0x25')](handleEntityNotFound(_0x2ce482,null))[_0x3d1b('0x25')](saveUpdates(_['pick'](_0x51d7b7[_0x3d1b('0x70')],['name',_0x3d1b('0x76')]),null))[_0x3d1b('0x25')](respondWithResult(_0x2ce482,null))['catch'](handleError(_0x2ce482,null));};exports[_0x3d1b('0x77')]=function(_0x4b19d3,_0x49ee7a,_0x3e54c3){return db[_0x3d1b('0x2e')][_0x3d1b('0x47')]({'where':{'id':_0x4b19d3[_0x3d1b('0x45')]['id']}})['then'](function(_0x2585a8){if(_0x2585a8){return _0x2585a8[_0x3d1b('0x26')]();}})[_0x3d1b('0x25')](function(_0x32f8df){var _0xb3e53b=path[_0x3d1b('0x4a')](config[_0x3d1b('0x4b')],_0x3d1b('0x5b'),util[_0x3d1b('0x51')](_0x3d1b('0x52'),_0x32f8df[_0x3d1b('0x48')],_0x32f8df[_0x3d1b('0x78')]));var _0x3c42e9=path['join'](config[_0x3d1b('0x4b')],_0x3d1b('0x4c'),util[_0x3d1b('0x51')]('%s.%s',_0x32f8df['save_name'],_0x32f8df[_0x3d1b('0x4d')]));fs['unlinkSync'](_0xb3e53b);fs[_0x3d1b('0x62')](_0x3c42e9);return _0x32f8df;})[_0x3d1b('0x25')](function(_0x497999){if(_0x497999){return _0x49ee7a['status'](0xcc)[_0x3d1b('0x29')]();}})[_0x3d1b('0x25')](handleEntityNotFound(_0x49ee7a,null))[_0x3d1b('0x43')](handleError(_0x49ee7a,null));}; \ No newline at end of file +var _0xf3b2=['../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','stack','send','index','map','Sound','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','download','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','%s.%s','save_name','format','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','error','description','delete','original_format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0x1a57c7,_0x1f0c32){var _0xb5899c=function(_0x4b7242){while(--_0x4b7242){_0x1a57c7['push'](_0x1a57c7['shift']());}};_0xb5899c(++_0x1f0c32);}(_0xf3b2,0x152));var _0x2f3b=function(_0x3ad133,_0x377068){_0x3ad133=_0x3ad133-0x0;var _0x33b86a=_0xf3b2[_0x3ad133];return _0x33b86a;};'use strict';var pdf=require(_0x2f3b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2f3b('0x1'));var zipdir=require(_0x2f3b('0x2'));var jsonpatch=require(_0x2f3b('0x3'));var rp=require(_0x2f3b('0x4'));var moment=require(_0x2f3b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f3b('0x6'));var path=require(_0x2f3b('0x7'));var sox=require('sox');var csv=require(_0x2f3b('0x8'));var ejs=require(_0x2f3b('0x9'));var fs=require('fs');var _=require(_0x2f3b('0xa'));var squel=require(_0x2f3b('0xb'));var crypto=require(_0x2f3b('0xc'));var jsforce=require(_0x2f3b('0xd'));var deskjs=require(_0x2f3b('0xe'));var toCsv=require(_0x2f3b('0x8'));var querystring=require(_0x2f3b('0xf'));var Papa=require(_0x2f3b('0x10'));var Redis=require('ioredis');var authService=require(_0x2f3b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f3b('0x12'));var logger=require(_0x2f3b('0x13'))(_0x2f3b('0x14'));var utils=require('../../config/utils');var config=require(_0x2f3b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2af00c,_0x536ae6){_0x536ae6=_0x536ae6||0xcc;return function(_0x5d15e3){if(_0x5d15e3){return _0x2af00c[_0x2f3b('0x16')](_0x536ae6);}return _0x2af00c[_0x2f3b('0x17')](_0x536ae6)['end']();};}function respondWithResult(_0x3dd5d8,_0x3eff2e){_0x3eff2e=_0x3eff2e||0xc8;return function(_0x499e86){if(_0x499e86){return _0x3dd5d8[_0x2f3b('0x17')](_0x3eff2e)[_0x2f3b('0x18')](_0x499e86);}};}function respondWithFilteredResult(_0x378df4,_0xaa50b6){return function(_0x3fefc7){if(_0x3fefc7){var _0x22a04d=_0x3fefc7[_0x2f3b('0x19')],_0x1ea73b=_0xaa50b6['offset'],_0x456742=_0xaa50b6[_0x2f3b('0x1a')]+_0xaa50b6['limit'],_0x2b013b;if(_0x456742>=_0x22a04d){_0x456742=_0x22a04d;_0x2b013b=0xc8;}else{_0x2b013b=0xce;}_0x378df4[_0x2f3b('0x17')](_0x2b013b);return _0x378df4[_0x2f3b('0x1b')](_0x2f3b('0x1c'),_0x1ea73b+'-'+_0x456742+'/'+_0x22a04d)[_0x2f3b('0x18')](_0x3fefc7);}return null;};}function patchUpdates(_0x4c6a43){return function(_0x28e75f){try{jsonpatch[_0x2f3b('0x1d')](_0x28e75f,_0x4c6a43,!![]);}catch(_0x1d8290){return BPromise[_0x2f3b('0x1e')](_0x1d8290);}return _0x28e75f[_0x2f3b('0x1f')]();};}function saveUpdates(_0x512015,_0x3f09fb){return function(_0x10c716){if(_0x10c716){return _0x10c716[_0x2f3b('0x20')](_0x512015)[_0x2f3b('0x21')](function(_0x5ed7ed){return _0x5ed7ed;});}return null;};}function removeEntity(_0x59023a,_0x40c164){return function(_0x4b482d){if(_0x4b482d){return _0x4b482d[_0x2f3b('0x22')]()[_0x2f3b('0x21')](function(){var _0x5f598c=_0x4b482d[_0x2f3b('0x23')]({'plain':!![]});var _0x582d23=_0x2f3b('0x24');return db[_0x2f3b('0x25')][_0x2f3b('0x22')]({'where':{'type':_0x582d23,'resourceId':_0x5f598c['id']}})['then'](function(){return _0x4b482d;});})['then'](function(){_0x59023a['status'](0xcc)[_0x2f3b('0x26')]();});}};}function handleEntityNotFound(_0x16a7b5,_0x124a63){return function(_0x8d2e52){if(!_0x8d2e52){_0x16a7b5[_0x2f3b('0x16')](0x194);}return _0x8d2e52;};}function handleError(_0x1300dc,_0x2a5602){_0x2a5602=_0x2a5602||0x1f4;return function(_0x79cff4){logger['error'](_0x79cff4[_0x2f3b('0x27')]);if(_0x79cff4['name']){delete _0x79cff4['name'];}_0x1300dc['status'](_0x2a5602)[_0x2f3b('0x28')](_0x79cff4);};}exports[_0x2f3b('0x29')]=function(_0x37e573,_0x18f421){var _0x552ff4={},_0x34b0b5={},_0x26525b={'count':0x0,'rows':[]};var _0x32e60d=_[_0x2f3b('0x2a')](db[_0x2f3b('0x2b')][_0x2f3b('0x2c')],function(_0x66895f){return{'name':_0x66895f['fieldName'],'type':_0x66895f[_0x2f3b('0x2d')][_0x2f3b('0x2e')]};});_0x34b0b5[_0x2f3b('0x2f')]=_['map'](_0x32e60d,_0x2f3b('0x30'));_0x34b0b5[_0x2f3b('0x31')]=_[_0x2f3b('0x32')](_0x37e573[_0x2f3b('0x31')]);_0x34b0b5[_0x2f3b('0x33')]=_[_0x2f3b('0x34')](_0x34b0b5[_0x2f3b('0x2f')],_0x34b0b5['query']);_0x552ff4[_0x2f3b('0x35')]=_['intersection'](_0x34b0b5['model'],qs['fields'](_0x37e573[_0x2f3b('0x31')]['fields']));_0x552ff4[_0x2f3b('0x35')]=_0x552ff4[_0x2f3b('0x35')][_0x2f3b('0x36')]?_0x552ff4[_0x2f3b('0x35')]:_0x34b0b5[_0x2f3b('0x2f')];if(!_0x37e573[_0x2f3b('0x31')]['hasOwnProperty'](_0x2f3b('0x37'))){_0x552ff4[_0x2f3b('0x38')]=qs[_0x2f3b('0x38')](_0x37e573[_0x2f3b('0x31')][_0x2f3b('0x38')]);_0x552ff4[_0x2f3b('0x1a')]=qs[_0x2f3b('0x1a')](_0x37e573['query'][_0x2f3b('0x1a')]);}_0x552ff4['order']=qs[_0x2f3b('0x39')](_0x37e573[_0x2f3b('0x31')][_0x2f3b('0x39')]);_0x552ff4[_0x2f3b('0x3a')]=qs[_0x2f3b('0x33')](_[_0x2f3b('0x3b')](_0x37e573[_0x2f3b('0x31')],_0x34b0b5['filters']),_0x32e60d);if(_0x37e573[_0x2f3b('0x31')][_0x2f3b('0x3c')]){_0x552ff4[_0x2f3b('0x3a')]=_['merge'](_0x552ff4['where'],{'$or':_['map'](_0x32e60d,function(_0x4a0d16){if(_0x4a0d16[_0x2f3b('0x2d')]!==_0x2f3b('0x3d')){var _0x52f5ba={};_0x52f5ba[_0x4a0d16['name']]={'$like':'%'+_0x37e573['query']['filter']+'%'};return _0x52f5ba;}})});}_0x552ff4=_['merge']({},_0x552ff4,_0x37e573[_0x2f3b('0x3e')]);var _0x5c5ede={'where':_0x552ff4[_0x2f3b('0x3a')]};return db[_0x2f3b('0x2b')]['count'](_0x5c5ede)['then'](function(_0x122665){_0x26525b[_0x2f3b('0x19')]=_0x122665;if(_0x37e573[_0x2f3b('0x31')][_0x2f3b('0x3f')]){_0x552ff4[_0x2f3b('0x40')]=[{'all':!![]}];}return db[_0x2f3b('0x2b')][_0x2f3b('0x41')](_0x552ff4);})[_0x2f3b('0x21')](function(_0x2d4945){_0x26525b[_0x2f3b('0x42')]=_0x2d4945;return _0x26525b;})[_0x2f3b('0x21')](respondWithFilteredResult(_0x18f421,_0x552ff4))['catch'](handleError(_0x18f421,null));};exports[_0x2f3b('0x43')]=function(_0x5e7034,_0x3b47d6){var _0x5582c7={'raw':!![],'where':{'id':_0x5e7034[_0x2f3b('0x44')]['id']}},_0x4c2491={};_0x4c2491[_0x2f3b('0x2f')]=_[_0x2f3b('0x32')](db['Sound']['rawAttributes']);_0x4c2491[_0x2f3b('0x31')]=_[_0x2f3b('0x32')](_0x5e7034[_0x2f3b('0x31')]);_0x4c2491['filters']=_[_0x2f3b('0x34')](_0x4c2491[_0x2f3b('0x2f')],_0x4c2491[_0x2f3b('0x31')]);_0x5582c7[_0x2f3b('0x35')]=_[_0x2f3b('0x34')](_0x4c2491[_0x2f3b('0x2f')],qs[_0x2f3b('0x45')](_0x5e7034[_0x2f3b('0x31')][_0x2f3b('0x45')]));_0x5582c7[_0x2f3b('0x35')]=_0x5582c7[_0x2f3b('0x35')][_0x2f3b('0x36')]?_0x5582c7['attributes']:_0x4c2491['model'];if(_0x5e7034[_0x2f3b('0x31')][_0x2f3b('0x3f')]){_0x5582c7['include']=[{'all':!![]}];}_0x5582c7=_['merge']({},_0x5582c7,_0x5e7034[_0x2f3b('0x3e')]);return db[_0x2f3b('0x2b')]['find'](_0x5582c7)[_0x2f3b('0x21')](handleEntityNotFound(_0x3b47d6,null))[_0x2f3b('0x21')](respondWithResult(_0x3b47d6,null))[_0x2f3b('0x46')](handleError(_0x3b47d6,null));};exports[_0x2f3b('0x47')]=function(_0x31dfcf,_0x5b7c91,_0xf03509){return db['Sound']['find']({'where':{'id':_0x31dfcf[_0x2f3b('0x44')]['id']},'attributes':['name','save_name',_0x2f3b('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x5b7c91,null))[_0x2f3b('0x21')](function(_0xd1d36){if(_0xd1d36){if(!fs[_0x2f3b('0x49')](path[_0x2f3b('0x4a')](config[_0x2f3b('0x4b')],_0x2f3b('0x4c'),_0xd1d36['save_name']+'.'+_0xd1d36[_0x2f3b('0x48')]))){throw new db['Sequelize'][(_0x2f3b('0x4d'))](_0x2f3b('0x4e'));}return _0x5b7c91[_0x2f3b('0x47')](path[_0x2f3b('0x4a')](config['root'],_0x2f3b('0x4c'),util['format'](_0x2f3b('0x4f'),_0xd1d36[_0x2f3b('0x50')],_0xd1d36[_0x2f3b('0x48')])),util[_0x2f3b('0x51')]('%s.%s',_0xd1d36[_0x2f3b('0x30')],_0xd1d36[_0x2f3b('0x48')]));}return null;})[_0x2f3b('0x46')](handleError(_0x5b7c91,null));};exports['create']=function(_0x5d59c0,_0x476f88,_0xbff85b){var _0x460b94={'name':path[_0x2f3b('0x52')](_0x5d59c0[_0x2f3b('0x53')][_0x2f3b('0x54')],path[_0x2f3b('0x55')](_0x5d59c0['file'][_0x2f3b('0x54')])),'save_name':path[_0x2f3b('0x52')](_0x5d59c0[_0x2f3b('0x53')][_0x2f3b('0x56')],path[_0x2f3b('0x55')](_0x5d59c0[_0x2f3b('0x53')][_0x2f3b('0x56')])),'original_format':path[_0x2f3b('0x55')](_0x5d59c0[_0x2f3b('0x53')]['originalname'])['substring'](0x1),'converted_format':_0x2f3b('0x57')};var _0x212937=path[_0x2f3b('0x4a')](config[_0x2f3b('0x4b')],_0x2f3b('0x58'),_0x5d59c0['file'][_0x2f3b('0x56')]);var _0x2729a1=path[_0x2f3b('0x4a')](config[_0x2f3b('0x4b')],_0x2f3b('0x4c'),util['format'](_0x2f3b('0x4f'),path[_0x2f3b('0x52')](_0x5d59c0[_0x2f3b('0x53')]['filename'],path[_0x2f3b('0x55')](_0x5d59c0[_0x2f3b('0x53')][_0x2f3b('0x56')])),_0x460b94['converted_format']));logger[_0x2f3b('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x212937);logger[_0x2f3b('0x59')](_0x2f3b('0x5a'),_0x2729a1);try{fs['chmodSync'](_0x212937,parseInt('0777',0x8));var _0x5f3cf3=sox[_0x2f3b('0x5b')](_0x212937,_0x2729a1,{'sampleRate':0x1f40,'format':_0x2f3b('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5f3cf3['on']('error',function(_0x13605a){fs[_0x2f3b('0x5c')](_0x212937);_0x476f88['status'](0x1f4)[_0x2f3b('0x28')](_0x13605a);});_0x5f3cf3['on']('src',function(_0xe3312c){_0x460b94['original_duration']=isNaN(_0xe3312c['duration'])?null:_0xe3312c[_0x2f3b('0x5d')]*0x3e8;_0x460b94[_0x2f3b('0x5e')]=isNaN(_0xe3312c['sampleCount'])?null:_0xe3312c[_0x2f3b('0x5f')];_0x460b94[_0x2f3b('0x60')]=isNaN(_0xe3312c[_0x2f3b('0x61')])?null:_0xe3312c[_0x2f3b('0x61')];_0x460b94[_0x2f3b('0x62')]=isNaN(_0xe3312c[_0x2f3b('0x63')])?null:_0xe3312c[_0x2f3b('0x63')];_0x460b94[_0x2f3b('0x64')]=isNaN(_0xe3312c[_0x2f3b('0x65')])?null:_0xe3312c[_0x2f3b('0x65')];});_0x5f3cf3['on'](_0x2f3b('0x66'),function(_0x49837f){_0x460b94['converted_duration']=isNaN(_0x49837f[_0x2f3b('0x5d')])?null:_0x49837f[_0x2f3b('0x5d')]*0x3e8;_0x460b94[_0x2f3b('0x67')]=isNaN(_0x49837f[_0x2f3b('0x5f')])?null:_0x49837f[_0x2f3b('0x5f')];_0x460b94[_0x2f3b('0x68')]=isNaN(_0x49837f[_0x2f3b('0x61')])?null:_0x49837f[_0x2f3b('0x61')];_0x460b94['converted_bitRate']=isNaN(_0x49837f[_0x2f3b('0x63')])?null:_0x49837f[_0x2f3b('0x63')];_0x460b94[_0x2f3b('0x69')]=isNaN(_0x49837f[_0x2f3b('0x65')])?null:_0x49837f[_0x2f3b('0x65')];});_0x5f3cf3['on'](_0x2f3b('0x26'),function(){fs['chmodSync'](_0x2729a1,parseInt(_0x2f3b('0x6a'),0x8));return db['Sound'][_0x2f3b('0x6b')](_0x460b94)[_0x2f3b('0x21')](function(_0x54bff2){var _0x2cf28b={'role':_0x5d59c0[_0x2f3b('0x6c')]['role'],'userProfileId':_0x5d59c0[_0x2f3b('0x6c')][_0x2f3b('0x6d')]};if(!_0x2cf28b)throw new Error(_0x2f3b('0x6e'));if(_0x2cf28b['role']===_0x2f3b('0x6f')){var _0x31bb57=_0x54bff2[_0x2f3b('0x23')]({'plain':!![]});return db[_0x2f3b('0x70')][_0x2f3b('0x71')]({'where':{'name':_0x2f3b('0x24'),'userProfileId':_0x2cf28b[_0x2f3b('0x6d')]},'raw':!![]})[_0x2f3b('0x21')](function(_0x2e52ab){if(_0x2e52ab&&_0x2e52ab[_0x2f3b('0x72')]===0x0){return db[_0x2f3b('0x25')][_0x2f3b('0x6b')]({'name':_0x31bb57['name'],'resourceId':_0x31bb57['id'],'type':_0x2e52ab['name'],'sectionId':_0x2e52ab['id']},{})['then'](function(){return _0x54bff2;});}else{return _0x54bff2;}})[_0x2f3b('0x46')](function(_0x564da9){logger[_0x2f3b('0x73')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x564da9);throw _0x564da9;});}return _0x54bff2;})[_0x2f3b('0x21')](respondWithResult(_0x476f88,null))[_0x2f3b('0x46')](handleError(_0x476f88,null));});_0x5f3cf3['start']();}catch(_0x31e6fc){_0x476f88[_0x2f3b('0x17')](0x1f4)[_0x2f3b('0x28')](_0x31e6fc);}};exports[_0x2f3b('0x20')]=function(_0xe5b1e,_0xfbf7e2,_0x4862a3){return db['Sound'][_0x2f3b('0x71')]({'where':{'id':_0xe5b1e[_0x2f3b('0x44')]['id']}})[_0x2f3b('0x21')](handleEntityNotFound(_0xfbf7e2,null))[_0x2f3b('0x21')](saveUpdates(_['pick'](_0xe5b1e[_0x2f3b('0x6c')],['name',_0x2f3b('0x74')]),null))[_0x2f3b('0x21')](respondWithResult(_0xfbf7e2,null))[_0x2f3b('0x46')](handleError(_0xfbf7e2,null));};exports[_0x2f3b('0x75')]=function(_0x22d912,_0x19006f,_0x2c9120){return db['Sound']['find']({'where':{'id':_0x22d912[_0x2f3b('0x44')]['id']}})[_0x2f3b('0x21')](function(_0x1cb5e4){if(_0x1cb5e4){return _0x1cb5e4['destroy']();}})[_0x2f3b('0x21')](function(_0x529dd3){var _0x3bdcb=path['join'](config['root'],_0x2f3b('0x58'),util['format']('%s.%s',_0x529dd3[_0x2f3b('0x50')],_0x529dd3[_0x2f3b('0x76')]));var _0x5f0fa0=path[_0x2f3b('0x4a')](config[_0x2f3b('0x4b')],_0x2f3b('0x4c'),util[_0x2f3b('0x51')](_0x2f3b('0x4f'),_0x529dd3['save_name'],_0x529dd3[_0x2f3b('0x48')]));fs[_0x2f3b('0x5c')](_0x3bdcb);fs[_0x2f3b('0x5c')](_0x5f0fa0);return _0x529dd3;})[_0x2f3b('0x21')](function(_0x72cd65){if(_0x72cd65){return _0x19006f[_0x2f3b('0x17')](0xcc)['end']();}})[_0x2f3b('0x21')](handleEntityNotFound(_0x19006f,null))['catch'](handleError(_0x19006f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e4a15e6..d3fdd72 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 _0xb432=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','util','api','moment','bluebird'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb432,0xf8));var _0x2b43=function(_0xe9ff1d,_0x33356e){_0xe9ff1d=_0xe9ff1d-0x0;var _0x50ac05=_0xb432[_0xe9ff1d];return _0x50ac05;};'use strict';var _=require('lodash');var util=require(_0x2b43('0x0'));var logger=require('../../config/logger')(_0x2b43('0x1'));var moment=require(_0x2b43('0x2'));var BPromise=require(_0x2b43('0x3'));var rp=require(_0x2b43('0x4'));var fs=require('fs');var path=require(_0x2b43('0x5'));var rimraf=require(_0x2b43('0x6'));var config=require(_0x2b43('0x7'));var attributes=require(_0x2b43('0x8'));module[_0x2b43('0x9')]=function(_0x37aeca,_0x2f1ecd){return _0x37aeca[_0x2b43('0xa')]('Sound',attributes,{'tableName':_0x2b43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f4a=['tools_sounds','lodash','bluebird','request-promise','path','../../config/environment','exports','Sound'];(function(_0x5381e2,_0x452bc8){var _0x4a418d=function(_0x4a50f5){while(--_0x4a50f5){_0x5381e2['push'](_0x5381e2['shift']());}};_0x4a418d(++_0x452bc8);}(_0x7f4a,0x179));var _0xa7f4=function(_0x5dcae8,_0x14040a){_0x5dcae8=_0x5dcae8-0x0;var _0xa7a0c6=_0x7f4a[_0x5dcae8];return _0xa7a0c6;};'use strict';var _=require(_0xa7f4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa7f4('0x1'));var rp=require(_0xa7f4('0x2'));var fs=require('fs');var path=require(_0xa7f4('0x3'));var rimraf=require('rimraf');var config=require(_0xa7f4('0x4'));var attributes=require('./sound.attributes');module[_0xa7f4('0x5')]=function(_0xf101ca,_0x5b4e94){return _0xf101ca['define'](_0xa7f4('0x6'),attributes,{'tableName':_0xa7f4('0x7'),'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 dff9db5..e361c9b 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 _0xe931=['message','request\x20sent','result','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe931,0x91));var _0x1e93=function(_0x3a7edb,_0xd392ef){_0x3a7edb=_0x3a7edb-0x0;var _0x34c671=_0xe931[_0x3a7edb];return _0x34c671;};'use strict';var _=require(_0x1e93('0x0'));var util=require(_0x1e93('0x1'));var moment=require(_0x1e93('0x2'));var BPromise=require(_0x1e93('0x3'));var rs=require(_0x1e93('0x4'));var fs=require('fs');var Redis=require(_0x1e93('0x5'));var db=require(_0x1e93('0x6'))['db'];var utils=require(_0x1e93('0x7'));var logger=require(_0x1e93('0x8'))('rpc');var config=require(_0x1e93('0x9'));var jayson=require(_0x1e93('0xa'));var client=jayson[_0x1e93('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b9cb2,_0x1ff36f,_0x22042e){return new BPromise(function(_0x3a62ad,_0x1cba46){return client[_0x1e93('0xc')](_0x5b9cb2,_0x22042e)['then'](function(_0x291b5b){logger[_0x1e93('0xd')]('Sound,\x20%s,\x20%s',_0x1ff36f,'request\x20sent');logger[_0x1e93('0xe')](_0x1e93('0xf'),_0x1ff36f,'request\x20sent',JSON[_0x1e93('0x10')](_0x291b5b));if(_0x291b5b['error']){if(_0x291b5b[_0x1e93('0x11')][_0x1e93('0x12')]===0x1f4){logger[_0x1e93('0x11')](_0x1e93('0x13'),_0x1ff36f,_0x291b5b[_0x1e93('0x11')][_0x1e93('0x14')]);return _0x1cba46(_0x291b5b[_0x1e93('0x11')][_0x1e93('0x14')]);}logger[_0x1e93('0x11')](_0x1e93('0x13'),_0x1ff36f,_0x291b5b[_0x1e93('0x11')]['message']);return _0x3a62ad(_0x291b5b[_0x1e93('0x11')][_0x1e93('0x14')]);}else{logger[_0x1e93('0xd')](_0x1e93('0x13'),_0x1ff36f,_0x1e93('0x15'));_0x3a62ad(_0x291b5b[_0x1e93('0x16')]['message']);}})[_0x1e93('0x17')](function(_0xe49e7f){logger[_0x1e93('0x11')](_0x1e93('0x13'),_0x1ff36f,_0xe49e7f);_0x1cba46(_0xe49e7f);});});}exports[_0x1e93('0x18')]=function(_0x37a636){var _0x23d4bf=this;return new Promise(function(_0x3fe595,_0x28a150){return db[_0x1e93('0x19')][_0x1e93('0x1a')]({'raw':_0x37a636[_0x1e93('0x1b')]?_0x37a636['options']['raw']===undefined?!![]:![]:!![],'where':_0x37a636[_0x1e93('0x1b')]?_0x37a636[_0x1e93('0x1b')][_0x1e93('0x1c')]||null:null,'attributes':_0x37a636[_0x1e93('0x1b')]?_0x37a636[_0x1e93('0x1b')][_0x1e93('0x1d')]||null:null,'include':_0x37a636['options']?_0x37a636[_0x1e93('0x1b')][_0x1e93('0x1e')]?_[_0x1e93('0x1f')](_0x37a636[_0x1e93('0x1b')][_0x1e93('0x1e')],function(_0x1536df){return{'model':db[_0x1536df[_0x1e93('0x20')]],'as':_0x1536df['as'],'attributes':_0x1536df[_0x1e93('0x1d')],'include':_0x1536df['include']?_[_0x1e93('0x1f')](_0x1536df[_0x1e93('0x1e')],function(_0x2a2f6c){return{'model':db[_0x2a2f6c['model']],'as':_0x2a2f6c['as'],'attributes':_0x2a2f6c['attributes'],'include':_0x2a2f6c[_0x1e93('0x1e')]?_[_0x1e93('0x1f')](_0x2a2f6c[_0x1e93('0x1e')],function(_0x520b41){return{'model':db[_0x520b41[_0x1e93('0x20')]],'as':_0x520b41['as'],'attributes':_0x520b41[_0x1e93('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x479970){logger[_0x1e93('0xd')](_0x1e93('0x18'),_0x37a636);logger[_0x1e93('0xe')]('ShowSound',_0x37a636,JSON[_0x1e93('0x10')](_0x479970));_0x3fe595(_0x479970);})['catch'](function(_0x5808d4){logger[_0x1e93('0x11')]('ShowSound',_0x5808d4[_0x1e93('0x14')],_0x37a636);_0x28a150(_0x23d4bf[_0x1e93('0x11')](0x1f4,_0x5808d4[_0x1e93('0x14')]));});});}; \ No newline at end of file +var _0xe4d6=['options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowSound','Sound','find'];(function(_0x540805,_0xc6b114){var _0x56b29e=function(_0x2f9a96){while(--_0x2f9a96){_0x540805['push'](_0x540805['shift']());}};_0x56b29e(++_0xc6b114);}(_0xe4d6,0x151));var _0x6e4d=function(_0x146fe6,_0x445323){_0x146fe6=_0x146fe6-0x0;var _0x26985e=_0xe4d6[_0x146fe6];return _0x26985e;};'use strict';var _=require(_0x6e4d('0x0'));var util=require(_0x6e4d('0x1'));var moment=require(_0x6e4d('0x2'));var BPromise=require(_0x6e4d('0x3'));var rs=require(_0x6e4d('0x4'));var fs=require('fs');var Redis=require(_0x6e4d('0x5'));var db=require(_0x6e4d('0x6'))['db'];var utils=require(_0x6e4d('0x7'));var logger=require(_0x6e4d('0x8'))(_0x6e4d('0x9'));var config=require('../../config/environment');var jayson=require(_0x6e4d('0xa'));var client=jayson['client'][_0x6e4d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb65d,_0x1b88b6,_0x48c624){return new BPromise(function(_0x273cc1,_0x108521){return client[_0x6e4d('0xc')](_0x4cb65d,_0x48c624)[_0x6e4d('0xd')](function(_0x522769){logger[_0x6e4d('0xe')](_0x6e4d('0xf'),_0x1b88b6,'request\x20sent');logger[_0x6e4d('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x1b88b6,_0x6e4d('0x11'),JSON[_0x6e4d('0x12')](_0x522769));if(_0x522769[_0x6e4d('0x13')]){if(_0x522769['error'][_0x6e4d('0x14')]===0x1f4){logger['error'](_0x6e4d('0xf'),_0x1b88b6,_0x522769[_0x6e4d('0x13')][_0x6e4d('0x15')]);return _0x108521(_0x522769[_0x6e4d('0x13')][_0x6e4d('0x15')]);}logger[_0x6e4d('0x13')](_0x6e4d('0xf'),_0x1b88b6,_0x522769['error'][_0x6e4d('0x15')]);return _0x273cc1(_0x522769[_0x6e4d('0x13')][_0x6e4d('0x15')]);}else{logger[_0x6e4d('0xe')](_0x6e4d('0xf'),_0x1b88b6,'request\x20sent');_0x273cc1(_0x522769['result'][_0x6e4d('0x15')]);}})[_0x6e4d('0x16')](function(_0x3626d7){logger[_0x6e4d('0x13')](_0x6e4d('0xf'),_0x1b88b6,_0x3626d7);_0x108521(_0x3626d7);});});}exports[_0x6e4d('0x17')]=function(_0x94af53){var _0x448bca=this;return new Promise(function(_0x25d1b9,_0x3140f8){return db[_0x6e4d('0x18')][_0x6e4d('0x19')]({'raw':_0x94af53[_0x6e4d('0x1a')]?_0x94af53[_0x6e4d('0x1a')][_0x6e4d('0x1b')]===undefined?!![]:![]:!![],'where':_0x94af53[_0x6e4d('0x1a')]?_0x94af53[_0x6e4d('0x1a')][_0x6e4d('0x1c')]||null:null,'attributes':_0x94af53[_0x6e4d('0x1a')]?_0x94af53[_0x6e4d('0x1a')][_0x6e4d('0x1d')]||null:null,'include':_0x94af53[_0x6e4d('0x1a')]?_0x94af53[_0x6e4d('0x1a')][_0x6e4d('0x1e')]?_[_0x6e4d('0x1f')](_0x94af53[_0x6e4d('0x1a')][_0x6e4d('0x1e')],function(_0x16f7ac){return{'model':db[_0x16f7ac[_0x6e4d('0x20')]],'as':_0x16f7ac['as'],'attributes':_0x16f7ac[_0x6e4d('0x1d')],'include':_0x16f7ac[_0x6e4d('0x1e')]?_[_0x6e4d('0x1f')](_0x16f7ac['include'],function(_0x32cdb2){return{'model':db[_0x32cdb2[_0x6e4d('0x20')]],'as':_0x32cdb2['as'],'attributes':_0x32cdb2[_0x6e4d('0x1d')],'include':_0x32cdb2[_0x6e4d('0x1e')]?_['map'](_0x32cdb2[_0x6e4d('0x1e')],function(_0x73ac3e){return{'model':db[_0x73ac3e[_0x6e4d('0x20')]],'as':_0x73ac3e['as'],'attributes':_0x73ac3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45148a){logger[_0x6e4d('0xe')](_0x6e4d('0x17'),_0x94af53);logger[_0x6e4d('0x10')](_0x6e4d('0x17'),_0x94af53,JSON['stringify'](_0x45148a));_0x25d1b9(_0x45148a);})['catch'](function(_0x246384){logger[_0x6e4d('0x13')]('ShowSound',_0x246384[_0x6e4d('0x15')],_0x94af53);_0x3140f8(_0x448bca[_0x6e4d('0x13')](0x1f4,_0x246384['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5d836b1..85fe4b5 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 _0xe2e2=['delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x16c6f2,_0x4dc23f){var _0x1d7d6f=function(_0x93562b){while(--_0x93562b){_0x16c6f2['push'](_0x16c6f2['shift']());}};_0x1d7d6f(++_0x4dc23f);}(_0xe2e2,0xf1));var _0x2e2e=function(_0x57fd1e,_0xaf76d3){_0x57fd1e=_0x57fd1e-0x0;var _0x543234=_0xe2e2[_0x57fd1e];return _0x543234;};'use strict';var multer=require('multer');var util=require(_0x2e2e('0x0'));var path=require('path');var timeout=require(_0x2e2e('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2e2e('0x2'));var interaction=require(_0x2e2e('0x3'));var config=require(_0x2e2e('0x4'));var controller=require(_0x2e2e('0x5'));router[_0x2e2e('0x6')]('/',auth[_0x2e2e('0x7')](),controller[_0x2e2e('0x8')]);router[_0x2e2e('0x6')](_0x2e2e('0x9'),auth['isAuthenticated'](),controller[_0x2e2e('0xa')]);router['post']('/',auth[_0x2e2e('0x7')](),controller[_0x2e2e('0xb')]);router[_0x2e2e('0xc')](_0x2e2e('0x9'),auth[_0x2e2e('0x7')](),controller[_0x2e2e('0xd')]);router[_0x2e2e('0xe')](_0x2e2e('0x9'),auth['isAuthenticated'](),controller[_0x2e2e('0xf')]);module[_0x2e2e('0x10')]=router; \ No newline at end of file +var _0xf7ef=['delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','index','isAuthenticated','show','put'];(function(_0x43aa05,_0x45f683){var _0x53c8a6=function(_0x205c67){while(--_0x205c67){_0x43aa05['push'](_0x43aa05['shift']());}};_0x53c8a6(++_0x45f683);}(_0xf7ef,0xc6));var _0xff7e=function(_0x2e2234,_0x12d5b1){_0x2e2234=_0x2e2234-0x0;var _0x2cf401=_0xf7ef[_0x2e2234];return _0x2cf401;};'use strict';var multer=require(_0xff7e('0x0'));var util=require(_0xff7e('0x1'));var path=require(_0xff7e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff7e('0x3')]();var auth=require(_0xff7e('0x4'));var interaction=require(_0xff7e('0x5'));var config=require('../../config/environment');var controller=require(_0xff7e('0x6'));router[_0xff7e('0x7')]('/',auth['isAuthenticated'](),controller[_0xff7e('0x8')]);router[_0xff7e('0x7')]('/:id',auth[_0xff7e('0x9')](),controller[_0xff7e('0xa')]);router['post']('/',auth[_0xff7e('0x9')](),controller['create']);router[_0xff7e('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xff7e('0xc')]('/:id',auth[_0xff7e('0x9')](),controller[_0xff7e('0xd')]);module[_0xff7e('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ba60773..26c705e 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 _0xef56=['out','sequelize','exports','TEXT','medium','ENUM'];(function(_0x5aa2c6,_0x329607){var _0x19dbb7=function(_0x2d3d0c){while(--_0x2d3d0c){_0x5aa2c6['push'](_0x5aa2c6['shift']());}};_0x19dbb7(++_0x329607);}(_0xef56,0x73));var _0x6ef5=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xef56[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x6ef5('0x0'));module[_0x6ef5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x6ef5('0x2')](_0x6ef5('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6ef5('0x4')]('in',_0x6ef5('0x5')),'defaultValue':_0x6ef5('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0xa907=['STRING','TEXT','medium','ENUM','out','exports'];(function(_0x59487f,_0x47d190){var _0x56a304=function(_0x3bd7be){while(--_0x3bd7be){_0x59487f['push'](_0x59487f['shift']());}};_0x56a304(++_0x47d190);}(_0xa907,0x191));var _0x7a90=function(_0x430205,_0x328c94){_0x430205=_0x430205-0x0;var _0x3f5146=_0xa907[_0x430205];return _0x3f5146;};'use strict';var Sequelize=require('sequelize');module[_0x7a90('0x0')]={'uniqueid':{'type':Sequelize[_0x7a90('0x1')]},'body':{'type':Sequelize[_0x7a90('0x2')](_0x7a90('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7a90('0x4')]('in',_0x7a90('0x5')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 72b6809..dfa9d79 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 _0x9c84=['Content-Range','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SquareMessage','includeAll','include','rows','catch','show','rawAttributes','options','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x5ddda9,_0x43e558){var _0x53a004=function(_0x2794a1){while(--_0x2794a1){_0x5ddda9['push'](_0x5ddda9['shift']());}};_0x53a004(++_0x43e558);}(_0x9c84,0x15b));var _0x49c8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9c84[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x49c8('0x0'));var emlformat=require(_0x49c8('0x1'));var rimraf=require(_0x49c8('0x2'));var zipdir=require(_0x49c8('0x3'));var jsonpatch=require(_0x49c8('0x4'));var rp=require('request-promise');var moment=require(_0x49c8('0x5'));var BPromise=require(_0x49c8('0x6'));var Mustache=require(_0x49c8('0x7'));var util=require('util');var path=require(_0x49c8('0x8'));var sox=require(_0x49c8('0x9'));var csv=require('to-csv');var ejs=require(_0x49c8('0xa'));var fs=require('fs');var _=require(_0x49c8('0xb'));var squel=require(_0x49c8('0xc'));var crypto=require(_0x49c8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x49c8('0xe'));var toCsv=require(_0x49c8('0xf'));var querystring=require(_0x49c8('0x10'));var Papa=require(_0x49c8('0x11'));var Redis=require('ioredis');var authService=require(_0x49c8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x49c8('0x13'));var hardwareService=require(_0x49c8('0x14'));var logger=require(_0x49c8('0x15'))(_0x49c8('0x16'));var utils=require(_0x49c8('0x17'));var config=require('../../config/environment');var db=require(_0x49c8('0x18'))['db'];function respondWithStatusCode(_0x11653f,_0x1dfbfc){_0x1dfbfc=_0x1dfbfc||0xcc;return function(_0x3b6fec){if(_0x3b6fec){return _0x11653f[_0x49c8('0x19')](_0x1dfbfc);}return _0x11653f[_0x49c8('0x1a')](_0x1dfbfc)[_0x49c8('0x1b')]();};}function respondWithResult(_0x388e33,_0x55704c){_0x55704c=_0x55704c||0xc8;return function(_0x12f374){if(_0x12f374){return _0x388e33[_0x49c8('0x1a')](_0x55704c)[_0x49c8('0x1c')](_0x12f374);}};}function respondWithFilteredResult(_0x4ae474,_0x4dcaa2){return function(_0x4a9c91){if(_0x4a9c91){var _0x2a3044=_0x4a9c91[_0x49c8('0x1d')],_0x4a82cd=_0x4dcaa2[_0x49c8('0x1e')],_0x5a04a4=_0x4dcaa2[_0x49c8('0x1e')]+_0x4dcaa2[_0x49c8('0x1f')],_0x387f9d;if(_0x5a04a4>=_0x2a3044){_0x5a04a4=_0x2a3044;_0x387f9d=0xc8;}else{_0x387f9d=0xce;}_0x4ae474[_0x49c8('0x1a')](_0x387f9d);return _0x4ae474[_0x49c8('0x20')](_0x49c8('0x21'),_0x4a82cd+'-'+_0x5a04a4+'/'+_0x2a3044)['json'](_0x4a9c91);}return null;};}function patchUpdates(_0x570aa0){return function(_0x1cea64){try{jsonpatch['apply'](_0x1cea64,_0x570aa0,!![]);}catch(_0x32d676){return BPromise[_0x49c8('0x22')](_0x32d676);}return _0x1cea64[_0x49c8('0x23')]();};}function saveUpdates(_0x47c757,_0x4b7780){return function(_0x4609dc){if(_0x4609dc){return _0x4609dc[_0x49c8('0x24')](_0x47c757)[_0x49c8('0x25')](function(_0x3e352e){return _0x3e352e;});}return null;};}function removeEntity(_0x4983b7,_0x304b13){return function(_0x43a5df){if(_0x43a5df){return _0x43a5df['destroy']()[_0x49c8('0x25')](function(){_0x4983b7[_0x49c8('0x1a')](0xcc)[_0x49c8('0x1b')]();});}};}function handleEntityNotFound(_0x330272,_0x43a532){return function(_0x127e26){if(!_0x127e26){_0x330272[_0x49c8('0x19')](0x194);}return _0x127e26;};}function handleError(_0x2b072e,_0x4c1011){_0x4c1011=_0x4c1011||0x1f4;return function(_0x41ebfa){logger[_0x49c8('0x26')](_0x41ebfa[_0x49c8('0x27')]);if(_0x41ebfa['name']){delete _0x41ebfa[_0x49c8('0x28')];}_0x2b072e['status'](_0x4c1011)[_0x49c8('0x29')](_0x41ebfa);};}exports[_0x49c8('0x2a')]=function(_0x42c561,_0x43a0c2){var _0x5d6885={},_0x294cdf={},_0x283903={'count':0x0,'rows':[]};var _0x5cf52e=_[_0x49c8('0x2b')](db['SquareMessage']['rawAttributes'],function(_0x4143cb){return{'name':_0x4143cb[_0x49c8('0x2c')],'type':_0x4143cb[_0x49c8('0x2d')][_0x49c8('0x2e')]};});_0x294cdf[_0x49c8('0x2f')]=_[_0x49c8('0x2b')](_0x5cf52e,_0x49c8('0x28'));_0x294cdf['query']=_[_0x49c8('0x30')](_0x42c561[_0x49c8('0x31')]);_0x294cdf[_0x49c8('0x32')]=_['intersection'](_0x294cdf[_0x49c8('0x2f')],_0x294cdf['query']);_0x5d6885[_0x49c8('0x33')]=_[_0x49c8('0x34')](_0x294cdf[_0x49c8('0x2f')],qs[_0x49c8('0x35')](_0x42c561[_0x49c8('0x31')][_0x49c8('0x35')]));_0x5d6885[_0x49c8('0x33')]=_0x5d6885[_0x49c8('0x33')][_0x49c8('0x36')]?_0x5d6885[_0x49c8('0x33')]:_0x294cdf[_0x49c8('0x2f')];if(!_0x42c561['query'][_0x49c8('0x37')]('nolimit')){_0x5d6885[_0x49c8('0x1f')]=qs[_0x49c8('0x1f')](_0x42c561[_0x49c8('0x31')]['limit']);_0x5d6885[_0x49c8('0x1e')]=qs[_0x49c8('0x1e')](_0x42c561[_0x49c8('0x31')][_0x49c8('0x1e')]);}_0x5d6885[_0x49c8('0x38')]=qs[_0x49c8('0x39')](_0x42c561['query'][_0x49c8('0x39')]);_0x5d6885[_0x49c8('0x3a')]=qs[_0x49c8('0x32')](_[_0x49c8('0x3b')](_0x42c561[_0x49c8('0x31')],_0x294cdf[_0x49c8('0x32')]),_0x5cf52e);if(_0x42c561[_0x49c8('0x31')][_0x49c8('0x3c')]){_0x5d6885['where']=_[_0x49c8('0x3d')](_0x5d6885[_0x49c8('0x3a')],{'$or':_[_0x49c8('0x2b')](_0x5cf52e,function(_0x8923e0){if(_0x8923e0['type']!==_0x49c8('0x3e')){var _0x277f1d={};_0x277f1d[_0x8923e0[_0x49c8('0x28')]]={'$like':'%'+_0x42c561[_0x49c8('0x31')]['filter']+'%'};return _0x277f1d;}})});}_0x5d6885=_[_0x49c8('0x3d')]({},_0x5d6885,_0x42c561['options']);var _0x3a17e8={'where':_0x5d6885[_0x49c8('0x3a')]};return db[_0x49c8('0x3f')][_0x49c8('0x1d')](_0x3a17e8)[_0x49c8('0x25')](function(_0x36b82c){_0x283903['count']=_0x36b82c;if(_0x42c561[_0x49c8('0x31')][_0x49c8('0x40')]){_0x5d6885[_0x49c8('0x41')]=[{'all':!![]}];}return db[_0x49c8('0x3f')]['findAll'](_0x5d6885);})[_0x49c8('0x25')](function(_0x50cbfc){_0x283903[_0x49c8('0x42')]=_0x50cbfc;return _0x283903;})[_0x49c8('0x25')](respondWithFilteredResult(_0x43a0c2,_0x5d6885))[_0x49c8('0x43')](handleError(_0x43a0c2,null));};exports[_0x49c8('0x44')]=function(_0x3d554f,_0x5c76d7){var _0x4d75ab={'raw':!![],'where':{'id':_0x3d554f['params']['id']}},_0x38de10={};_0x38de10[_0x49c8('0x2f')]=_[_0x49c8('0x30')](db['SquareMessage'][_0x49c8('0x45')]);_0x38de10[_0x49c8('0x31')]=_[_0x49c8('0x30')](_0x3d554f['query']);_0x38de10[_0x49c8('0x32')]=_[_0x49c8('0x34')](_0x38de10[_0x49c8('0x2f')],_0x38de10[_0x49c8('0x31')]);_0x4d75ab[_0x49c8('0x33')]=_[_0x49c8('0x34')](_0x38de10['model'],qs['fields'](_0x3d554f['query'][_0x49c8('0x35')]));_0x4d75ab['attributes']=_0x4d75ab[_0x49c8('0x33')][_0x49c8('0x36')]?_0x4d75ab[_0x49c8('0x33')]:_0x38de10[_0x49c8('0x2f')];if(_0x3d554f[_0x49c8('0x31')][_0x49c8('0x40')]){_0x4d75ab[_0x49c8('0x41')]=[{'all':!![]}];}_0x4d75ab=_['merge']({},_0x4d75ab,_0x3d554f[_0x49c8('0x46')]);return db['SquareMessage'][_0x49c8('0x47')](_0x4d75ab)['then'](handleEntityNotFound(_0x5c76d7,null))[_0x49c8('0x25')](respondWithResult(_0x5c76d7,null))[_0x49c8('0x43')](handleError(_0x5c76d7,null));};exports[_0x49c8('0x48')]=function(_0x3d07e7,_0x4dffc9){return db[_0x49c8('0x3f')][_0x49c8('0x48')](_0x3d07e7['body'],{})[_0x49c8('0x25')](respondWithResult(_0x4dffc9,0xc9))['catch'](handleError(_0x4dffc9,null));};exports[_0x49c8('0x24')]=function(_0x138216,_0x1ac92c){if(_0x138216[_0x49c8('0x49')]['id']){delete _0x138216[_0x49c8('0x49')]['id'];}return db[_0x49c8('0x3f')]['find']({'where':{'id':_0x138216[_0x49c8('0x4a')]['id']}})[_0x49c8('0x25')](handleEntityNotFound(_0x1ac92c,null))[_0x49c8('0x25')](saveUpdates(_0x138216[_0x49c8('0x49')],null))[_0x49c8('0x25')](respondWithResult(_0x1ac92c,null))[_0x49c8('0x43')](handleError(_0x1ac92c,null));};exports[_0x49c8('0x4b')]=function(_0x564705,_0x26c7c8){return db['SquareMessage']['find']({'where':{'id':_0x564705[_0x49c8('0x4a')]['id']}})[_0x49c8('0x25')](handleEntityNotFound(_0x26c7c8,null))[_0x49c8('0x25')](removeEntity(_0x26c7c8,null))[_0x49c8('0x43')](handleError(_0x26c7c8,null));}; \ No newline at end of file +var _0x9ca0=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','SquareMessage','rawAttributes','fieldName','type','key','model','map','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x225a5c,_0x41f12b){var _0x1e2385=function(_0x1b512b){while(--_0x1b512b){_0x225a5c['push'](_0x225a5c['shift']());}};_0x1e2385(++_0x41f12b);}(_0x9ca0,0x1ab));var _0x09ca=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x9ca0[_0x3c2a69];return _0x596bc8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x09ca('0x0'));var rimraf=require(_0x09ca('0x1'));var zipdir=require(_0x09ca('0x2'));var jsonpatch=require(_0x09ca('0x3'));var rp=require(_0x09ca('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x09ca('0x5'));var util=require(_0x09ca('0x6'));var path=require(_0x09ca('0x7'));var sox=require(_0x09ca('0x8'));var csv=require('to-csv');var ejs=require(_0x09ca('0x9'));var fs=require('fs');var _=require(_0x09ca('0xa'));var squel=require('squel');var crypto=require(_0x09ca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x09ca('0xc'));var toCsv=require(_0x09ca('0xd'));var querystring=require(_0x09ca('0xe'));var Papa=require(_0x09ca('0xf'));var Redis=require(_0x09ca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x09ca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ca('0x12'));var logger=require(_0x09ca('0x13'))(_0x09ca('0x14'));var utils=require(_0x09ca('0x15'));var config=require('../../config/environment');var db=require(_0x09ca('0x16'))['db'];function respondWithStatusCode(_0x169cab,_0x559b52){_0x559b52=_0x559b52||0xcc;return function(_0x45f8f8){if(_0x45f8f8){return _0x169cab[_0x09ca('0x17')](_0x559b52);}return _0x169cab[_0x09ca('0x18')](_0x559b52)[_0x09ca('0x19')]();};}function respondWithResult(_0x452645,_0x4e75fc){_0x4e75fc=_0x4e75fc||0xc8;return function(_0x2a24c1){if(_0x2a24c1){return _0x452645[_0x09ca('0x18')](_0x4e75fc)[_0x09ca('0x1a')](_0x2a24c1);}};}function respondWithFilteredResult(_0x3f5c91,_0x532148){return function(_0x26bbd){if(_0x26bbd){var _0xe0f1f3=_0x26bbd[_0x09ca('0x1b')],_0x1aeb57=_0x532148[_0x09ca('0x1c')],_0x58c2ba=_0x532148[_0x09ca('0x1c')]+_0x532148['limit'],_0x54c219;if(_0x58c2ba>=_0xe0f1f3){_0x58c2ba=_0xe0f1f3;_0x54c219=0xc8;}else{_0x54c219=0xce;}_0x3f5c91[_0x09ca('0x18')](_0x54c219);return _0x3f5c91[_0x09ca('0x1d')](_0x09ca('0x1e'),_0x1aeb57+'-'+_0x58c2ba+'/'+_0xe0f1f3)['json'](_0x26bbd);}return null;};}function patchUpdates(_0x39a52d){return function(_0x5d4e61){try{jsonpatch[_0x09ca('0x1f')](_0x5d4e61,_0x39a52d,!![]);}catch(_0x333332){return BPromise[_0x09ca('0x20')](_0x333332);}return _0x5d4e61[_0x09ca('0x21')]();};}function saveUpdates(_0x4b8379,_0x25c167){return function(_0x57dc4d){if(_0x57dc4d){return _0x57dc4d['update'](_0x4b8379)[_0x09ca('0x22')](function(_0x3f8e3f){return _0x3f8e3f;});}return null;};}function removeEntity(_0x8c9738,_0xcab827){return function(_0x2adc1c){if(_0x2adc1c){return _0x2adc1c[_0x09ca('0x23')]()['then'](function(){_0x8c9738['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c505e,_0x11fc18){return function(_0x50b0f2){if(!_0x50b0f2){_0x4c505e[_0x09ca('0x17')](0x194);}return _0x50b0f2;};}function handleError(_0x5d313e,_0x6969bf){_0x6969bf=_0x6969bf||0x1f4;return function(_0x26febb){logger['error'](_0x26febb[_0x09ca('0x24')]);if(_0x26febb[_0x09ca('0x25')]){delete _0x26febb[_0x09ca('0x25')];}_0x5d313e['status'](_0x6969bf)[_0x09ca('0x26')](_0x26febb);};}exports['index']=function(_0x3d08b7,_0x26ffc6){var _0x2107fa={},_0x5cfea4={},_0x1d28ee={'count':0x0,'rows':[]};var _0x6c8edf=_['map'](db[_0x09ca('0x27')][_0x09ca('0x28')],function(_0x427e9a){return{'name':_0x427e9a[_0x09ca('0x29')],'type':_0x427e9a[_0x09ca('0x2a')][_0x09ca('0x2b')]};});_0x5cfea4[_0x09ca('0x2c')]=_[_0x09ca('0x2d')](_0x6c8edf,_0x09ca('0x25'));_0x5cfea4['query']=_[_0x09ca('0x2e')](_0x3d08b7['query']);_0x5cfea4[_0x09ca('0x2f')]=_['intersection'](_0x5cfea4[_0x09ca('0x2c')],_0x5cfea4['query']);_0x2107fa[_0x09ca('0x30')]=_[_0x09ca('0x31')](_0x5cfea4[_0x09ca('0x2c')],qs[_0x09ca('0x32')](_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x32')]));_0x2107fa[_0x09ca('0x30')]=_0x2107fa[_0x09ca('0x30')][_0x09ca('0x34')]?_0x2107fa[_0x09ca('0x30')]:_0x5cfea4[_0x09ca('0x2c')];if(!_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x35')](_0x09ca('0x36'))){_0x2107fa[_0x09ca('0x37')]=qs['limit'](_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x37')]);_0x2107fa[_0x09ca('0x1c')]=qs[_0x09ca('0x1c')](_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x1c')]);}_0x2107fa[_0x09ca('0x38')]=qs['sort'](_0x3d08b7['query'][_0x09ca('0x39')]);_0x2107fa[_0x09ca('0x3a')]=qs['filters'](_[_0x09ca('0x3b')](_0x3d08b7[_0x09ca('0x33')],_0x5cfea4[_0x09ca('0x2f')]),_0x6c8edf);if(_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x3c')]){_0x2107fa[_0x09ca('0x3a')]=_['merge'](_0x2107fa['where'],{'$or':_[_0x09ca('0x2d')](_0x6c8edf,function(_0x329855){if(_0x329855[_0x09ca('0x2a')]!==_0x09ca('0x3d')){var _0x280a5e={};_0x280a5e[_0x329855['name']]={'$like':'%'+_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x3c')]+'%'};return _0x280a5e;}})});}_0x2107fa=_[_0x09ca('0x3e')]({},_0x2107fa,_0x3d08b7[_0x09ca('0x3f')]);var _0x4678e0={'where':_0x2107fa['where']};return db['SquareMessage'][_0x09ca('0x1b')](_0x4678e0)[_0x09ca('0x22')](function(_0x1b1648){_0x1d28ee[_0x09ca('0x1b')]=_0x1b1648;if(_0x3d08b7[_0x09ca('0x33')][_0x09ca('0x40')]){_0x2107fa[_0x09ca('0x41')]=[{'all':!![]}];}return db[_0x09ca('0x27')][_0x09ca('0x42')](_0x2107fa);})[_0x09ca('0x22')](function(_0x26b897){_0x1d28ee[_0x09ca('0x43')]=_0x26b897;return _0x1d28ee;})[_0x09ca('0x22')](respondWithFilteredResult(_0x26ffc6,_0x2107fa))[_0x09ca('0x44')](handleError(_0x26ffc6,null));};exports[_0x09ca('0x45')]=function(_0x59a957,_0x4b4d84){var _0x228b76={'raw':!![],'where':{'id':_0x59a957['params']['id']}},_0x248ee2={};_0x248ee2[_0x09ca('0x2c')]=_[_0x09ca('0x2e')](db[_0x09ca('0x27')]['rawAttributes']);_0x248ee2[_0x09ca('0x33')]=_[_0x09ca('0x2e')](_0x59a957[_0x09ca('0x33')]);_0x248ee2['filters']=_[_0x09ca('0x31')](_0x248ee2[_0x09ca('0x2c')],_0x248ee2['query']);_0x228b76[_0x09ca('0x30')]=_['intersection'](_0x248ee2[_0x09ca('0x2c')],qs[_0x09ca('0x32')](_0x59a957[_0x09ca('0x33')][_0x09ca('0x32')]));_0x228b76[_0x09ca('0x30')]=_0x228b76['attributes'][_0x09ca('0x34')]?_0x228b76[_0x09ca('0x30')]:_0x248ee2[_0x09ca('0x2c')];if(_0x59a957[_0x09ca('0x33')][_0x09ca('0x40')]){_0x228b76[_0x09ca('0x41')]=[{'all':!![]}];}_0x228b76=_['merge']({},_0x228b76,_0x59a957[_0x09ca('0x3f')]);return db[_0x09ca('0x27')]['find'](_0x228b76)['then'](handleEntityNotFound(_0x4b4d84,null))['then'](respondWithResult(_0x4b4d84,null))['catch'](handleError(_0x4b4d84,null));};exports[_0x09ca('0x46')]=function(_0x44be26,_0x1a1114){return db[_0x09ca('0x27')][_0x09ca('0x46')](_0x44be26[_0x09ca('0x47')],{})['then'](respondWithResult(_0x1a1114,0xc9))[_0x09ca('0x44')](handleError(_0x1a1114,null));};exports[_0x09ca('0x48')]=function(_0x43d84c,_0x308fa8){if(_0x43d84c[_0x09ca('0x47')]['id']){delete _0x43d84c[_0x09ca('0x47')]['id'];}return db[_0x09ca('0x27')][_0x09ca('0x49')]({'where':{'id':_0x43d84c[_0x09ca('0x4a')]['id']}})[_0x09ca('0x22')](handleEntityNotFound(_0x308fa8,null))['then'](saveUpdates(_0x43d84c[_0x09ca('0x47')],null))[_0x09ca('0x22')](respondWithResult(_0x308fa8,null))[_0x09ca('0x44')](handleError(_0x308fa8,null));};exports[_0x09ca('0x23')]=function(_0x462047,_0x2d1294){return db[_0x09ca('0x27')]['find']({'where':{'id':_0x462047['params']['id']}})[_0x09ca('0x22')](handleEntityNotFound(_0x2d1294,null))['then'](removeEntity(_0x2d1294,null))['catch'](handleError(_0x2d1294,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index bb38b59..814877a 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 _0xe3d3=['./squareMessage.attributes','exports','define','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x85ebcb,_0x2a88f0){var _0x58f55d=function(_0x2ba05b){while(--_0x2ba05b){_0x85ebcb['push'](_0x85ebcb['shift']());}};_0x58f55d(++_0x2a88f0);}(_0xe3d3,0x7b));var _0x3e3d=function(_0x1dd614,_0x23e273){_0x1dd614=_0x1dd614-0x0;var _0x10c61d=_0xe3d3[_0x1dd614];return _0x10c61d;};'use strict';var _=require(_0x3e3d('0x0'));var util=require(_0x3e3d('0x1'));var logger=require(_0x3e3d('0x2'))(_0x3e3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e3d('0x4'));var rimraf=require(_0x3e3d('0x5'));var config=require(_0x3e3d('0x6'));var attributes=require(_0x3e3d('0x7'));module[_0x3e3d('0x8')]=function(_0x23a672,_0x1d2715){return _0x23a672[_0x3e3d('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x698c=['../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1b734e,_0x456cd8){var _0x841eed=function(_0x15da60){while(--_0x15da60){_0x1b734e['push'](_0x1b734e['shift']());}};_0x841eed(++_0x456cd8);}(_0x698c,0xf7));var _0xc698=function(_0x4dde69,_0x1de4ec){_0x4dde69=_0x4dde69-0x0;var _0x5ebeba=_0x698c[_0x4dde69];return _0x5ebeba;};'use strict';var _=require(_0xc698('0x0'));var util=require(_0xc698('0x1'));var logger=require(_0xc698('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc698('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc698('0x4'));var rimraf=require(_0xc698('0x5'));var config=require(_0xc698('0x6'));var attributes=require(_0xc698('0x7'));module['exports']=function(_0x2c9e63,_0x734e76){return _0x2c9e63[_0xc698('0x8')](_0xc698('0x9'),attributes,{'tableName':_0xc698('0xa'),'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 f11c5da..7a88e57 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 _0xbbbd=['jayson/promise','http','request','then','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbbbd,0x86));var _0xdbbb=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xbbbd[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var moment=require(_0xdbbb('0x2'));var BPromise=require(_0xdbbb('0x3'));var rs=require(_0xdbbb('0x4'));var fs=require('fs');var Redis=require(_0xdbbb('0x5'));var db=require(_0xdbbb('0x6'))['db'];var utils=require(_0xdbbb('0x7'));var logger=require(_0xdbbb('0x8'))(_0xdbbb('0x9'));var config=require(_0xdbbb('0xa'));var jayson=require(_0xdbbb('0xb'));var client=jayson['client'][_0xdbbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42ea38,_0x197916,_0x478756){return new BPromise(function(_0x463ea6,_0x28a1fd){return client[_0xdbbb('0xd')](_0x42ea38,_0x478756)[_0xdbbb('0xe')](function(_0x2def2e){logger[_0xdbbb('0xf')]('SquareMessage,\x20%s,\x20%s',_0x197916,_0xdbbb('0x10'));logger['debug'](_0xdbbb('0x11'),_0x197916,'request\x20sent',JSON[_0xdbbb('0x12')](_0x2def2e));if(_0x2def2e[_0xdbbb('0x13')]){if(_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x14')]===0x1f4){logger[_0xdbbb('0x13')](_0xdbbb('0x15'),_0x197916,_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);return _0x28a1fd(_0x2def2e[_0xdbbb('0x13')]['message']);}logger[_0xdbbb('0x13')](_0xdbbb('0x15'),_0x197916,_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);return _0x463ea6(_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);}else{logger[_0xdbbb('0xf')](_0xdbbb('0x15'),_0x197916,_0xdbbb('0x10'));_0x463ea6(_0x2def2e[_0xdbbb('0x17')][_0xdbbb('0x16')]);}})[_0xdbbb('0x18')](function(_0x203feb){logger[_0xdbbb('0x13')]('SquareMessage,\x20%s,\x20%s',_0x197916,_0x203feb);_0x28a1fd(_0x203feb);});});}exports[_0xdbbb('0x19')]=function(_0xbbf0b4){var _0x50c9ec=this;return new Promise(function(_0x5c4b3d,_0x50ede3){return db[_0xdbbb('0x1a')][_0xdbbb('0x1b')](_0xbbf0b4['body'],{'raw':_0xbbf0b4[_0xdbbb('0x1c')]?_0xbbf0b4[_0xdbbb('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xdbbb('0xe')](function(_0x1c2e3f){logger[_0xdbbb('0xf')](_0xdbbb('0x19'),_0xbbf0b4);logger['debug'](_0xdbbb('0x19'),_0xbbf0b4,JSON[_0xdbbb('0x12')](_0x1c2e3f));_0x5c4b3d(_0x1c2e3f);})[_0xdbbb('0x18')](function(_0xe98d9e){logger[_0xdbbb('0x13')](_0xdbbb('0x19'),_0xe98d9e['message'],_0xbbf0b4);_0x50ede3(_0x50c9ec[_0xdbbb('0x13')](0x1f4,_0xe98d9e[_0xdbbb('0x16')]));});});}; \ No newline at end of file +var _0x8ca9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','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','CreateSquareMessage','SquareMessage','create','body','options'];(function(_0x356538,_0x1087c2){var _0x1a3199=function(_0x54b3d2){while(--_0x54b3d2){_0x356538['push'](_0x356538['shift']());}};_0x1a3199(++_0x1087c2);}(_0x8ca9,0x9c));var _0x98ca=function(_0x4a5635,_0x443b90){_0x4a5635=_0x4a5635-0x0;var _0x18d602=_0x8ca9[_0x4a5635];return _0x18d602;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson['client'][_0x98ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca4097,_0x18c349,_0x2852a0){return new BPromise(function(_0x323c95,_0x28a37a){return client[_0x98ca('0xa')](_0xca4097,_0x2852a0)[_0x98ca('0xb')](function(_0x277c29){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x18c349,_0x98ca('0xe'),JSON[_0x98ca('0x11')](_0x277c29));if(_0x277c29[_0x98ca('0x12')]){if(_0x277c29[_0x98ca('0x12')]['code']===0x1f4){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x28a37a(_0x277c29['error'][_0x98ca('0x13')]);}logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x323c95(_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);}else{logger['info'](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));_0x323c95(_0x277c29[_0x98ca('0x14')][_0x98ca('0x13')]);}})['catch'](function(_0x238c1a){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x238c1a);_0x28a37a(_0x238c1a);});});}exports[_0x98ca('0x15')]=function(_0x4523bb){var _0x3ca209=this;return new Promise(function(_0x28c8a6,_0x3dc670){return db[_0x98ca('0x16')][_0x98ca('0x17')](_0x4523bb[_0x98ca('0x18')],{'raw':_0x4523bb['options']?_0x4523bb[_0x98ca('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x98ca('0xb')](function(_0x2fe568){logger['info']('CreateSquareMessage',_0x4523bb);logger[_0x98ca('0xf')](_0x98ca('0x15'),_0x4523bb,JSON[_0x98ca('0x11')](_0x2fe568));_0x28c8a6(_0x2fe568);})['catch'](function(_0x2f7742){logger[_0x98ca('0x12')]('CreateSquareMessage',_0x2f7742[_0x98ca('0x13')],_0x4523bb);_0x3dc670(_0x3ca209['error'](0x1f4,_0x2f7742[_0x98ca('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6d3d4e6..a7d3057 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 _0x0170=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','post','create','update','delete','multer'];(function(_0x426fd3,_0x16b1f8){var _0xe23ac0=function(_0x3a8da4){while(--_0x3a8da4){_0x426fd3['push'](_0x426fd3['shift']());}};_0xe23ac0(++_0x16b1f8);}(_0x0170,0x117));var _0x0017=function(_0x110db4,_0x29c881){_0x110db4=_0x110db4-0x0;var _0x698281=_0x0170[_0x110db4];return _0x698281;};'use strict';var multer=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var path=require(_0x0017('0x2'));var timeout=require(_0x0017('0x3'));var express=require(_0x0017('0x4'));var router=express[_0x0017('0x5')]();var auth=require(_0x0017('0x6'));var interaction=require(_0x0017('0x7'));var config=require(_0x0017('0x8'));var controller=require(_0x0017('0x9'));router[_0x0017('0xa')]('/',auth[_0x0017('0xb')](),controller[_0x0017('0xc')]);router[_0x0017('0xa')](_0x0017('0xd'),auth[_0x0017('0xb')](),controller[_0x0017('0xe')]);router[_0x0017('0xa')]('/:id/test',auth[_0x0017('0xb')](),timeout(_0x0017('0xf')),controller['test']);router[_0x0017('0x10')]('/',auth['isAuthenticated'](),controller[_0x0017('0x11')]);router['put'](_0x0017('0xd'),auth[_0x0017('0xb')](),controller[_0x0017('0x12')]);router[_0x0017('0x13')](_0x0017('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6942=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','/:id/test','test','post','put','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x341b3c,_0x4adde2){var _0x149d68=function(_0x5b0bfb){while(--_0x5b0bfb){_0x341b3c['push'](_0x341b3c['shift']());}};_0x149d68(++_0x4adde2);}(_0x6942,0xf7));var _0x2694=function(_0x47bd6a,_0x1d2c26){_0x47bd6a=_0x47bd6a-0x0;var _0x5b5141=_0x6942[_0x47bd6a];return _0x5b5141;};'use strict';var multer=require(_0x2694('0x0'));var util=require(_0x2694('0x1'));var path=require(_0x2694('0x2'));var timeout=require(_0x2694('0x3'));var express=require('express');var router=express[_0x2694('0x4')]();var auth=require(_0x2694('0x5'));var interaction=require(_0x2694('0x6'));var config=require(_0x2694('0x7'));var controller=require(_0x2694('0x8'));router['get']('/',auth[_0x2694('0x9')](),controller[_0x2694('0xa')]);router['get'](_0x2694('0xb'),auth[_0x2694('0x9')](),controller['show']);router['get'](_0x2694('0xc'),auth['isAuthenticated'](),timeout('15s'),controller[_0x2694('0xd')]);router[_0x2694('0xe')]('/',auth[_0x2694('0x9')](),controller['create']);router[_0x2694('0xf')](_0x2694('0xb'),auth[_0x2694('0x9')](),controller[_0x2694('0x10')]);router['delete'](_0x2694('0xb'),auth[_0x2694('0x9')](),controller[_0x2694('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2e12342..ccc234f 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 _0x99ee=['exports','STRING','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x99ee,0x18b));var _0xe99e=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x99ee[_0x2cc711];return _0x31a52e;};'use strict';var Sequelize=require(_0xe99e('0x0'));module[_0xe99e('0x1')]={'name':{'type':Sequelize[_0xe99e('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xe99e('0x2')]},'description':{'type':Sequelize[_0xe99e('0x2')]}}; \ No newline at end of file +var _0x86de=['name','STRING'];(function(_0x568c5d,_0x535034){var _0x58e0e4=function(_0x22e142){while(--_0x22e142){_0x568c5d['push'](_0x568c5d['shift']());}};_0x58e0e4(++_0x535034);}(_0x86de,0x16e));var _0xe86d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86de[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe86d('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe86d('0x1')]},'description':{'type':Sequelize[_0xe86d('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0ccba60..0aa7542 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 _0x03b8=['limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','create','test','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','name','send','map','SquareOdbc','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x2ddf0d,_0x24569f){var _0x5bd7d6=function(_0x27d2ee){while(--_0x27d2ee){_0x2ddf0d['push'](_0x2ddf0d['shift']());}};_0x5bd7d6(++_0x24569f);}(_0x03b8,0xbb));var _0x803b=function(_0x6c1312,_0x4a6a7a){_0x6c1312=_0x6c1312-0x0;var _0x1f986c=_0x03b8[_0x6c1312];return _0x1f986c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x803b('0x0'));var zipdir=require(_0x803b('0x1'));var jsonpatch=require(_0x803b('0x2'));var rp=require(_0x803b('0x3'));var moment=require(_0x803b('0x4'));var BPromise=require(_0x803b('0x5'));var Mustache=require(_0x803b('0x6'));var util=require('util');var path=require(_0x803b('0x7'));var sox=require(_0x803b('0x8'));var csv=require(_0x803b('0x9'));var ejs=require(_0x803b('0xa'));var fs=require('fs');var _=require(_0x803b('0xb'));var squel=require(_0x803b('0xc'));var crypto=require(_0x803b('0xd'));var jsforce=require(_0x803b('0xe'));var deskjs=require(_0x803b('0xf'));var toCsv=require(_0x803b('0x9'));var querystring=require(_0x803b('0x10'));var Papa=require(_0x803b('0x11'));var Redis=require(_0x803b('0x12'));var authService=require(_0x803b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x803b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x803b('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x803b('0x16'));var db=require(_0x803b('0x17'))['db'];function respondWithStatusCode(_0x3a76b8,_0x2fdad8){_0x2fdad8=_0x2fdad8||0xcc;return function(_0x4bee45){if(_0x4bee45){return _0x3a76b8['sendStatus'](_0x2fdad8);}return _0x3a76b8[_0x803b('0x18')](_0x2fdad8)[_0x803b('0x19')]();};}function respondWithResult(_0x104bca,_0xf13e4f){_0xf13e4f=_0xf13e4f||0xc8;return function(_0x4f92f5){if(_0x4f92f5){return _0x104bca[_0x803b('0x18')](_0xf13e4f)[_0x803b('0x1a')](_0x4f92f5);}};}function respondWithFilteredResult(_0x1447a9,_0x142e79){return function(_0x247145){if(_0x247145){var _0x11e39f=_0x247145[_0x803b('0x1b')],_0x5e6010=_0x142e79[_0x803b('0x1c')],_0x48caf2=_0x142e79[_0x803b('0x1c')]+_0x142e79['limit'],_0x4c0412;if(_0x48caf2>=_0x11e39f){_0x48caf2=_0x11e39f;_0x4c0412=0xc8;}else{_0x4c0412=0xce;}_0x1447a9[_0x803b('0x18')](_0x4c0412);return _0x1447a9[_0x803b('0x1d')](_0x803b('0x1e'),_0x5e6010+'-'+_0x48caf2+'/'+_0x11e39f)[_0x803b('0x1a')](_0x247145);}return null;};}function patchUpdates(_0x204275){return function(_0x3d300b){try{jsonpatch[_0x803b('0x1f')](_0x3d300b,_0x204275,!![]);}catch(_0x2c5460){return BPromise[_0x803b('0x20')](_0x2c5460);}return _0x3d300b[_0x803b('0x21')]();};}function saveUpdates(_0x4c3fb7,_0x4fb66f){return function(_0x51ae73){if(_0x51ae73){return _0x51ae73[_0x803b('0x22')](_0x4c3fb7)[_0x803b('0x23')](function(_0x3220cd){return _0x3220cd;});}return null;};}function removeEntity(_0x28e0f5,_0x25510f){return function(_0x541af1){if(_0x541af1){return _0x541af1[_0x803b('0x24')]()[_0x803b('0x23')](function(){var _0x405204=_0x541af1[_0x803b('0x25')]({'plain':!![]});var _0xa5f326=_0x803b('0x26');return db[_0x803b('0x27')]['destroy']({'where':{'type':_0xa5f326,'resourceId':_0x405204['id']}})[_0x803b('0x23')](function(){return _0x541af1;});})[_0x803b('0x23')](function(){_0x28e0f5['status'](0xcc)[_0x803b('0x19')]();});}};}function handleEntityNotFound(_0x34c9bf,_0x10b0e7){return function(_0x285845){if(!_0x285845){_0x34c9bf[_0x803b('0x28')](0x194);}return _0x285845;};}function handleError(_0x1295e1,_0xfc1f40){_0xfc1f40=_0xfc1f40||0x1f4;return function(_0x119b4b){logger[_0x803b('0x29')](_0x119b4b['stack']);if(_0x119b4b['name']){delete _0x119b4b[_0x803b('0x2a')];}_0x1295e1[_0x803b('0x18')](_0xfc1f40)[_0x803b('0x2b')](_0x119b4b);};}exports['index']=function(_0x472d7f,_0xdcb99a){var _0x213aff={},_0x149a84={},_0x5c9a1a={'count':0x0,'rows':[]};var _0x469045=_[_0x803b('0x2c')](db[_0x803b('0x2d')][_0x803b('0x2e')],function(_0x33b455){return{'name':_0x33b455[_0x803b('0x2f')],'type':_0x33b455['type']['key']};});_0x149a84[_0x803b('0x30')]=_[_0x803b('0x2c')](_0x469045,'name');_0x149a84[_0x803b('0x31')]=_[_0x803b('0x32')](_0x472d7f['query']);_0x149a84[_0x803b('0x33')]=_[_0x803b('0x34')](_0x149a84[_0x803b('0x30')],_0x149a84[_0x803b('0x31')]);_0x213aff[_0x803b('0x35')]=_[_0x803b('0x34')](_0x149a84['model'],qs[_0x803b('0x36')](_0x472d7f[_0x803b('0x31')][_0x803b('0x36')]));_0x213aff[_0x803b('0x35')]=_0x213aff['attributes']['length']?_0x213aff[_0x803b('0x35')]:_0x149a84['model'];if(!_0x472d7f['query'][_0x803b('0x37')]('nolimit')){_0x213aff['limit']=qs['limit'](_0x472d7f[_0x803b('0x31')][_0x803b('0x38')]);_0x213aff[_0x803b('0x1c')]=qs[_0x803b('0x1c')](_0x472d7f[_0x803b('0x31')][_0x803b('0x1c')]);}_0x213aff[_0x803b('0x39')]=qs[_0x803b('0x3a')](_0x472d7f['query'][_0x803b('0x3a')]);_0x213aff['where']=qs[_0x803b('0x33')](_[_0x803b('0x3b')](_0x472d7f['query'],_0x149a84['filters']),_0x469045);if(_0x472d7f['query'][_0x803b('0x3c')]){_0x213aff['where']=_[_0x803b('0x3d')](_0x213aff[_0x803b('0x3e')],{'$or':_['map'](_0x469045,function(_0x77454e){if(_0x77454e['type']!==_0x803b('0x3f')){var _0xd40c3b={};_0xd40c3b[_0x77454e['name']]={'$like':'%'+_0x472d7f['query'][_0x803b('0x3c')]+'%'};return _0xd40c3b;}})});}_0x213aff=_[_0x803b('0x3d')]({},_0x213aff,_0x472d7f[_0x803b('0x40')]);var _0xbf9722={'where':_0x213aff['where']};return db[_0x803b('0x2d')][_0x803b('0x1b')](_0xbf9722)[_0x803b('0x23')](function(_0x2b3ddb){_0x5c9a1a[_0x803b('0x1b')]=_0x2b3ddb;if(_0x472d7f[_0x803b('0x31')][_0x803b('0x41')]){_0x213aff['include']=[{'all':!![]}];}return db[_0x803b('0x2d')][_0x803b('0x42')](_0x213aff);})['then'](function(_0xf04980){_0x5c9a1a[_0x803b('0x43')]=_0xf04980;return _0x5c9a1a;})[_0x803b('0x23')](respondWithFilteredResult(_0xdcb99a,_0x213aff))[_0x803b('0x44')](handleError(_0xdcb99a,null));};exports[_0x803b('0x45')]=function(_0x810b2d,_0x56241a){var _0x5a16c6={'raw':!![],'where':{'id':_0x810b2d[_0x803b('0x46')]['id']}},_0x397462={};_0x397462[_0x803b('0x30')]=_[_0x803b('0x32')](db[_0x803b('0x2d')][_0x803b('0x2e')]);_0x397462[_0x803b('0x31')]=_[_0x803b('0x32')](_0x810b2d[_0x803b('0x31')]);_0x397462[_0x803b('0x33')]=_[_0x803b('0x34')](_0x397462[_0x803b('0x30')],_0x397462['query']);_0x5a16c6[_0x803b('0x35')]=_[_0x803b('0x34')](_0x397462[_0x803b('0x30')],qs[_0x803b('0x36')](_0x810b2d[_0x803b('0x31')][_0x803b('0x36')]));_0x5a16c6[_0x803b('0x35')]=_0x5a16c6['attributes'][_0x803b('0x47')]?_0x5a16c6[_0x803b('0x35')]:_0x397462['model'];if(_0x810b2d[_0x803b('0x31')]['includeAll']){_0x5a16c6[_0x803b('0x48')]=[{'all':!![]}];}_0x5a16c6=_['merge']({},_0x5a16c6,_0x810b2d['options']);return db[_0x803b('0x2d')][_0x803b('0x49')](_0x5a16c6)[_0x803b('0x23')](handleEntityNotFound(_0x56241a,null))['then'](respondWithResult(_0x56241a,null))[_0x803b('0x44')](handleError(_0x56241a,null));};exports['create']=function(_0x5a030f,_0x3d3764){return db[_0x803b('0x2d')]['create'](_0x5a030f[_0x803b('0x4a')],{})[_0x803b('0x23')](function(_0x21a394){var _0x1e502a=_0x5a030f['user'][_0x803b('0x25')]({'plain':!![]});if(!_0x1e502a)throw new Error(_0x803b('0x4b'));if(_0x1e502a['role']==='user'){var _0x4db835=_0x21a394['get']({'plain':!![]});var _0x30c942=_0x803b('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x30c942,'userProfileId':_0x1e502a['userProfileId']},'raw':!![]})[_0x803b('0x23')](function(_0x48fe84){if(_0x48fe84&&_0x48fe84['autoAssociation']===0x0){return db[_0x803b('0x27')][_0x803b('0x4c')]({'name':_0x4db835[_0x803b('0x2a')],'resourceId':_0x4db835['id'],'type':_0x48fe84[_0x803b('0x2a')],'sectionId':_0x48fe84['id']},{})[_0x803b('0x23')](function(){return _0x21a394;});}else{return _0x21a394;}})['catch'](function(_0x519314){logger[_0x803b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x519314);throw _0x519314;});}return _0x21a394;})[_0x803b('0x23')](respondWithResult(_0x3d3764,0xc9))['catch'](handleError(_0x3d3764,null));};exports[_0x803b('0x22')]=function(_0x460c02,_0x296f3c){if(_0x460c02['body']['id']){delete _0x460c02[_0x803b('0x4a')]['id'];}return db[_0x803b('0x2d')][_0x803b('0x49')]({'where':{'id':_0x460c02[_0x803b('0x46')]['id']}})['then'](handleEntityNotFound(_0x296f3c,null))[_0x803b('0x23')](saveUpdates(_0x460c02[_0x803b('0x4a')],null))[_0x803b('0x23')](respondWithResult(_0x296f3c,null))['catch'](handleError(_0x296f3c,null));};exports[_0x803b('0x24')]=function(_0x1725eb,_0x429ad7){return db['SquareOdbc'][_0x803b('0x49')]({'where':{'id':_0x1725eb[_0x803b('0x46')]['id']}})[_0x803b('0x23')](handleEntityNotFound(_0x429ad7,null))['then'](removeEntity(_0x429ad7,null))[_0x803b('0x44')](handleError(_0x429ad7,null));};exports[_0x803b('0x4d')]=function(_0xf22be4,_0x1cd98c,_0x597b2a){var _0x43a3a0;return db['SquareOdbc'][_0x803b('0x49')]({'where':{'id':_0xf22be4[_0x803b('0x46')]['id']},'attributes':['id',_0x803b('0x4e')]})['then'](handleEntityNotFound(_0x1cd98c,null))[_0x803b('0x23')](function(_0x7e9e8d){if(_0x7e9e8d){var _0x468f94=require('odbc')();_0x468f94[_0x803b('0x4f')](_0x7e9e8d[_0x803b('0x4e')]);_0x468f94[_0x803b('0x50')]();return _0x7e9e8d;}})['then'](respondWithResult(_0x1cd98c,null))[_0x803b('0x44')](handleError(_0x1cd98c,null));}; \ No newline at end of file +var _0x84e9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','length','create','body'];(function(_0x5e9997,_0x243fa6){var _0x959a8b=function(_0xd6f27f){while(--_0xd6f27f){_0x5e9997['push'](_0x5e9997['shift']());}};_0x959a8b(++_0x243fa6);}(_0x84e9,0x102));var _0x984e=function(_0xa079d4,_0x1f5079){_0xa079d4=_0xa079d4-0x0;var _0x4e141b=_0x84e9[_0xa079d4];return _0x4e141b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x984e('0x0'));var rimraf=require(_0x984e('0x1'));var zipdir=require(_0x984e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x984e('0x3'));var moment=require(_0x984e('0x4'));var BPromise=require(_0x984e('0x5'));var Mustache=require(_0x984e('0x6'));var util=require('util');var path=require(_0x984e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x984e('0x8'));var fs=require('fs');var _=require(_0x984e('0x9'));var squel=require(_0x984e('0xa'));var crypto=require('crypto');var jsforce=require(_0x984e('0xb'));var deskjs=require(_0x984e('0xc'));var toCsv=require(_0x984e('0xd'));var querystring=require(_0x984e('0xe'));var Papa=require(_0x984e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x984e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x984e('0x11'));var db=require(_0x984e('0x12'))['db'];function respondWithStatusCode(_0x140120,_0x10e339){_0x10e339=_0x10e339||0xcc;return function(_0x299af5){if(_0x299af5){return _0x140120[_0x984e('0x13')](_0x10e339);}return _0x140120[_0x984e('0x14')](_0x10e339)[_0x984e('0x15')]();};}function respondWithResult(_0xac14ad,_0x190250){_0x190250=_0x190250||0xc8;return function(_0xb937df){if(_0xb937df){return _0xac14ad[_0x984e('0x14')](_0x190250)[_0x984e('0x16')](_0xb937df);}};}function respondWithFilteredResult(_0x142d30,_0x1efcd3){return function(_0x1f98eb){if(_0x1f98eb){var _0x2a0235=_0x1f98eb[_0x984e('0x17')],_0x1ef0f7=_0x1efcd3[_0x984e('0x18')],_0x38431c=_0x1efcd3[_0x984e('0x18')]+_0x1efcd3[_0x984e('0x19')],_0x2eb594;if(_0x38431c>=_0x2a0235){_0x38431c=_0x2a0235;_0x2eb594=0xc8;}else{_0x2eb594=0xce;}_0x142d30[_0x984e('0x14')](_0x2eb594);return _0x142d30[_0x984e('0x1a')](_0x984e('0x1b'),_0x1ef0f7+'-'+_0x38431c+'/'+_0x2a0235)[_0x984e('0x16')](_0x1f98eb);}return null;};}function patchUpdates(_0x623c2d){return function(_0x1f7a8d){try{jsonpatch[_0x984e('0x1c')](_0x1f7a8d,_0x623c2d,!![]);}catch(_0x10c169){return BPromise[_0x984e('0x1d')](_0x10c169);}return _0x1f7a8d['save']();};}function saveUpdates(_0x31f6c6,_0x536f29){return function(_0x4524c7){if(_0x4524c7){return _0x4524c7[_0x984e('0x1e')](_0x31f6c6)[_0x984e('0x1f')](function(_0x1ac3cb){return _0x1ac3cb;});}return null;};}function removeEntity(_0x3ee376,_0x4dece9){return function(_0x52db49){if(_0x52db49){return _0x52db49[_0x984e('0x20')]()[_0x984e('0x1f')](function(){var _0x1fac0b=_0x52db49[_0x984e('0x21')]({'plain':!![]});var _0xa7dbbd=_0x984e('0x22');return db[_0x984e('0x23')][_0x984e('0x20')]({'where':{'type':_0xa7dbbd,'resourceId':_0x1fac0b['id']}})['then'](function(){return _0x52db49;});})[_0x984e('0x1f')](function(){_0x3ee376['status'](0xcc)[_0x984e('0x15')]();});}};}function handleEntityNotFound(_0x1dbbf5,_0x439b0a){return function(_0x27574c){if(!_0x27574c){_0x1dbbf5[_0x984e('0x13')](0x194);}return _0x27574c;};}function handleError(_0x4f8ab8,_0x22aa91){_0x22aa91=_0x22aa91||0x1f4;return function(_0x5add2b){logger[_0x984e('0x24')](_0x5add2b[_0x984e('0x25')]);if(_0x5add2b[_0x984e('0x26')]){delete _0x5add2b['name'];}_0x4f8ab8['status'](_0x22aa91)[_0x984e('0x27')](_0x5add2b);};}exports[_0x984e('0x28')]=function(_0x14d4f5,_0xe6f217){var _0x55c000={},_0x4ab135={},_0x15e3d5={'count':0x0,'rows':[]};var _0x5f224a=_[_0x984e('0x29')](db[_0x984e('0x2a')][_0x984e('0x2b')],function(_0x19cfa2){return{'name':_0x19cfa2[_0x984e('0x2c')],'type':_0x19cfa2[_0x984e('0x2d')]['key']};});_0x4ab135[_0x984e('0x2e')]=_[_0x984e('0x29')](_0x5f224a,_0x984e('0x26'));_0x4ab135['query']=_[_0x984e('0x2f')](_0x14d4f5[_0x984e('0x30')]);_0x4ab135[_0x984e('0x31')]=_[_0x984e('0x32')](_0x4ab135[_0x984e('0x2e')],_0x4ab135[_0x984e('0x30')]);_0x55c000['attributes']=_[_0x984e('0x32')](_0x4ab135[_0x984e('0x2e')],qs[_0x984e('0x33')](_0x14d4f5[_0x984e('0x30')][_0x984e('0x33')]));_0x55c000[_0x984e('0x34')]=_0x55c000[_0x984e('0x34')]['length']?_0x55c000[_0x984e('0x34')]:_0x4ab135[_0x984e('0x2e')];if(!_0x14d4f5[_0x984e('0x30')][_0x984e('0x35')](_0x984e('0x36'))){_0x55c000[_0x984e('0x19')]=qs[_0x984e('0x19')](_0x14d4f5[_0x984e('0x30')][_0x984e('0x19')]);_0x55c000['offset']=qs[_0x984e('0x18')](_0x14d4f5[_0x984e('0x30')][_0x984e('0x18')]);}_0x55c000[_0x984e('0x37')]=qs[_0x984e('0x38')](_0x14d4f5[_0x984e('0x30')]['sort']);_0x55c000[_0x984e('0x39')]=qs['filters'](_[_0x984e('0x3a')](_0x14d4f5['query'],_0x4ab135[_0x984e('0x31')]),_0x5f224a);if(_0x14d4f5['query'][_0x984e('0x3b')]){_0x55c000['where']=_[_0x984e('0x3c')](_0x55c000[_0x984e('0x39')],{'$or':_[_0x984e('0x29')](_0x5f224a,function(_0x466724){if(_0x466724[_0x984e('0x2d')]!==_0x984e('0x3d')){var _0x5aff82={};_0x5aff82[_0x466724[_0x984e('0x26')]]={'$like':'%'+_0x14d4f5[_0x984e('0x30')][_0x984e('0x3b')]+'%'};return _0x5aff82;}})});}_0x55c000=_[_0x984e('0x3c')]({},_0x55c000,_0x14d4f5['options']);var _0x51192e={'where':_0x55c000[_0x984e('0x39')]};return db['SquareOdbc']['count'](_0x51192e)[_0x984e('0x1f')](function(_0x1b249e){_0x15e3d5['count']=_0x1b249e;if(_0x14d4f5[_0x984e('0x30')]['includeAll']){_0x55c000[_0x984e('0x3e')]=[{'all':!![]}];}return db['SquareOdbc'][_0x984e('0x3f')](_0x55c000);})['then'](function(_0x260232){_0x15e3d5[_0x984e('0x40')]=_0x260232;return _0x15e3d5;})['then'](respondWithFilteredResult(_0xe6f217,_0x55c000))[_0x984e('0x41')](handleError(_0xe6f217,null));};exports['show']=function(_0x35c5be,_0x15da25){var _0x1aeffc={'raw':!![],'where':{'id':_0x35c5be[_0x984e('0x42')]['id']}},_0x54f540={};_0x54f540[_0x984e('0x2e')]=_['keys'](db[_0x984e('0x2a')][_0x984e('0x2b')]);_0x54f540[_0x984e('0x30')]=_[_0x984e('0x2f')](_0x35c5be['query']);_0x54f540[_0x984e('0x31')]=_[_0x984e('0x32')](_0x54f540['model'],_0x54f540[_0x984e('0x30')]);_0x1aeffc['attributes']=_[_0x984e('0x32')](_0x54f540[_0x984e('0x2e')],qs[_0x984e('0x33')](_0x35c5be['query'][_0x984e('0x33')]));_0x1aeffc[_0x984e('0x34')]=_0x1aeffc[_0x984e('0x34')][_0x984e('0x43')]?_0x1aeffc[_0x984e('0x34')]:_0x54f540[_0x984e('0x2e')];if(_0x35c5be['query']['includeAll']){_0x1aeffc[_0x984e('0x3e')]=[{'all':!![]}];}_0x1aeffc=_[_0x984e('0x3c')]({},_0x1aeffc,_0x35c5be['options']);return db[_0x984e('0x2a')]['find'](_0x1aeffc)[_0x984e('0x1f')](handleEntityNotFound(_0x15da25,null))[_0x984e('0x1f')](respondWithResult(_0x15da25,null))['catch'](handleError(_0x15da25,null));};exports[_0x984e('0x44')]=function(_0x3e3fae,_0x5e425d){return db[_0x984e('0x2a')][_0x984e('0x44')](_0x3e3fae[_0x984e('0x45')],{})[_0x984e('0x1f')](function(_0x2f6feb){var _0x3eec22=_0x3e3fae[_0x984e('0x46')]['get']({'plain':!![]});if(!_0x3eec22)throw new Error(_0x984e('0x47'));if(_0x3eec22['role']===_0x984e('0x46')){var _0xf49577=_0x2f6feb[_0x984e('0x21')]({'plain':!![]});var _0x55d972=_0x984e('0x22');return db[_0x984e('0x48')]['find']({'where':{'name':_0x55d972,'userProfileId':_0x3eec22[_0x984e('0x49')]},'raw':!![]})[_0x984e('0x1f')](function(_0x1f748f){if(_0x1f748f&&_0x1f748f[_0x984e('0x4a')]===0x0){return db['UserProfileResource'][_0x984e('0x44')]({'name':_0xf49577[_0x984e('0x26')],'resourceId':_0xf49577['id'],'type':_0x1f748f[_0x984e('0x26')],'sectionId':_0x1f748f['id']},{})[_0x984e('0x1f')](function(){return _0x2f6feb;});}else{return _0x2f6feb;}})[_0x984e('0x41')](function(_0x110d0e){logger[_0x984e('0x24')](_0x984e('0x4b'),_0x110d0e);throw _0x110d0e;});}return _0x2f6feb;})['then'](respondWithResult(_0x5e425d,0xc9))['catch'](handleError(_0x5e425d,null));};exports['update']=function(_0x2ec49f,_0x447f60){if(_0x2ec49f[_0x984e('0x45')]['id']){delete _0x2ec49f['body']['id'];}return db[_0x984e('0x2a')][_0x984e('0x4c')]({'where':{'id':_0x2ec49f[_0x984e('0x42')]['id']}})[_0x984e('0x1f')](handleEntityNotFound(_0x447f60,null))[_0x984e('0x1f')](saveUpdates(_0x2ec49f[_0x984e('0x45')],null))[_0x984e('0x1f')](respondWithResult(_0x447f60,null))['catch'](handleError(_0x447f60,null));};exports[_0x984e('0x20')]=function(_0x37ffff,_0x5dfee9){return db[_0x984e('0x2a')]['find']({'where':{'id':_0x37ffff[_0x984e('0x42')]['id']}})[_0x984e('0x1f')](handleEntityNotFound(_0x5dfee9,null))[_0x984e('0x1f')](removeEntity(_0x5dfee9,null))['catch'](handleError(_0x5dfee9,null));};exports[_0x984e('0x4d')]=function(_0x5b9adf,_0x7f9cf6,_0x3c03f3){var _0x2ea2c7;return db['SquareOdbc'][_0x984e('0x4c')]({'where':{'id':_0x5b9adf['params']['id']},'attributes':['id',_0x984e('0x4e')]})['then'](handleEntityNotFound(_0x7f9cf6,null))[_0x984e('0x1f')](function(_0x2572e5){if(_0x2572e5){var _0x59b101=require(_0x984e('0x4f'))();_0x59b101[_0x984e('0x50')](_0x2572e5[_0x984e('0x4e')]);_0x59b101[_0x984e('0x51')]();return _0x2572e5;}})['then'](respondWithResult(_0x7f9cf6,null))['catch'](handleError(_0x7f9cf6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ba1aaec..226808d 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 _0xb804=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0x3ed2f2,_0x474876){var _0x109a04=function(_0x4b6282){while(--_0x4b6282){_0x3ed2f2['push'](_0x3ed2f2['shift']());}};_0x109a04(++_0x474876);}(_0xb804,0x107));var _0x4b80=function(_0x2f196c,_0x4317ca){_0x2f196c=_0x2f196c-0x0;var _0x27191d=_0xb804[_0x2f196c];return _0x27191d;};'use strict';var _=require(_0x4b80('0x0'));var util=require(_0x4b80('0x1'));var logger=require(_0x4b80('0x2'))(_0x4b80('0x3'));var moment=require(_0x4b80('0x4'));var BPromise=require(_0x4b80('0x5'));var rp=require(_0x4b80('0x6'));var fs=require('fs');var path=require(_0x4b80('0x7'));var rimraf=require(_0x4b80('0x8'));var config=require(_0x4b80('0x9'));var attributes=require(_0x4b80('0xa'));module[_0x4b80('0xb')]=function(_0x5bc0e3,_0x2ab08a){return _0x5bc0e3[_0x4b80('0xc')](_0x4b80('0xd'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x413c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareOdbc.attributes','define'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x413c,0x104));var _0xc413=function(_0x59e352,_0x255dc4){_0x59e352=_0x59e352-0x0;var _0xd042fb=_0x413c[_0x59e352];return _0xd042fb;};'use strict';var _=require(_0xc413('0x0'));var util=require(_0xc413('0x1'));var logger=require(_0xc413('0x2'))(_0xc413('0x3'));var moment=require(_0xc413('0x4'));var BPromise=require(_0xc413('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc413('0x6'));var rimraf=require(_0xc413('0x7'));var config=require('../../config/environment');var attributes=require(_0xc413('0x8'));module['exports']=function(_0x4d6be1,_0x8c6855){return _0x4d6be1[_0xc413('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','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 bafa761..71ba522 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1785e8,_0x492aac){var _0x5e6021=function(_0x312e79){while(--_0x312e79){_0x1785e8['push'](_0x1785e8['shift']());}};_0x5e6021(++_0x492aac);}(_0x5fc3,0xa8));var _0x35fc=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x5fc3[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x8feedb,_0x41239c){var _0x5ec4e2=function(_0x50e44a){while(--_0x50e44a){_0x8feedb['push'](_0x8feedb['shift']());}};_0x5ec4e2(++_0x41239c);}(_0x7217,0x19e));var _0x7721=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x7217[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 911832f..03a0a49 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 _0x14a0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','getUsers','/:id/users','addUsers','put','update','delete','/:id','destroy','removeUsers','exports','util','path','connect-timeout','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x14a0,0x8e));var _0x014a=function(_0x3f2bcf,_0x355cde){_0x3f2bcf=_0x3f2bcf-0x0;var _0xa5dc46=_0x14a0[_0x3f2bcf];return _0xa5dc46;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var auth=require(_0x014a('0x5'));var interaction=require(_0x014a('0x6'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x014a('0x7')]('/',auth[_0x014a('0x8')](),controller[_0x014a('0x9')]);router['get']('/:id',auth[_0x014a('0x8')](),controller[_0x014a('0xa')]);router[_0x014a('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x014a('0xc'),auth['isAuthenticated'](),controller[_0x014a('0xd')]);router[_0x014a('0xe')]('/:id',auth[_0x014a('0x8')](),controller[_0x014a('0xf')]);router[_0x014a('0x10')](_0x014a('0x11'),auth[_0x014a('0x8')](),controller[_0x014a('0x12')]);router[_0x014a('0x10')](_0x014a('0xc'),auth[_0x014a('0x8')](),controller[_0x014a('0x13')]);module[_0x014a('0x14')]=router; \ No newline at end of file +var _0x3c81=['/:id','getUsers','post','create','/:id/users','addUsers','put','update','delete','destroy','removeUsers','multer','util','connect-timeout','express','./squareProject.controller','get','isAuthenticated','index'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x3c81,0x102));var _0x13c8=function(_0x32088f,_0x20b781){_0x32088f=_0x32088f-0x0;var _0xf2a4fd=_0x3c81[_0x32088f];return _0xf2a4fd;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0x7')]);router[_0x13c8('0x5')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller['show']);router[_0x13c8('0x5')]('/:id/users',auth[_0x13c8('0x6')](),controller[_0x13c8('0x9')]);router[_0x13c8('0xa')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0xb')]);router[_0x13c8('0xa')](_0x13c8('0xc'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xd')]);router[_0x13c8('0xe')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xf')]);router[_0x13c8('0x10')]('/:id',auth[_0x13c8('0x6')](),controller[_0x13c8('0x11')]);router[_0x13c8('0x10')](_0x13c8('0xc'),auth['isAuthenticated'](),controller[_0x13c8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 856eb17..8176a4a 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 _0x13bd=['preproduction','utf8','BLOB','production','toString','STRING','TEXT','long','getDataValue'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x13bd,0x68));var _0xd13b=function(_0x2656a4,_0x28dd1b){_0x2656a4=_0x2656a4-0x0;var _0x48ce85=_0x13bd[_0x2656a4];return _0x48ce85;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd13b('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd13b('0x0')]},'notes':{'type':Sequelize[_0xd13b('0x1')]},'preproduction':{'type':Sequelize['BLOB'](_0xd13b('0x2')),'get':function(){if(this[_0xd13b('0x3')]('preproduction')){return this[_0xd13b('0x3')](_0xd13b('0x4'))['toString'](_0xd13b('0x5'));}}},'production':{'type':Sequelize[_0xd13b('0x6')]('long'),'get':function(){if(this[_0xd13b('0x3')](_0xd13b('0x7'))){return this['getDataValue'](_0xd13b('0x7'))[_0xd13b('0x8')](_0xd13b('0x5'));}}}}; \ No newline at end of file +var _0x084c=['getDataValue','preproduction','toString','utf8','production','sequelize','STRING','BLOB','long'];(function(_0x4b245a,_0x521dcd){var _0x1439b4=function(_0x3727f2){while(--_0x3727f2){_0x4b245a['push'](_0x4b245a['shift']());}};_0x1439b4(++_0x521dcd);}(_0x084c,0x1be));var _0xc084=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x084c[_0x45bf86];return _0x1f02b7;};'use strict';var Sequelize=require(_0xc084('0x0'));module['exports']={'name':{'type':Sequelize[_0xc084('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc084('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xc084('0x2')](_0xc084('0x3')),'get':function(){if(this[_0xc084('0x4')](_0xc084('0x5'))){return this[_0xc084('0x4')](_0xc084('0x5'))[_0xc084('0x6')](_0xc084('0x7'));}}},'production':{'type':Sequelize[_0xc084('0x2')]('long'),'get':function(){if(this[_0xc084('0x4')](_0xc084('0x8'))){return this[_0xc084('0x4')](_0xc084('0x8'))[_0xc084('0x6')](_0xc084('0x7'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ae27901..a3c22ae 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 _0x0b2a=['filter','options','includeAll','findAll','catch','show','length','include','find','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','pick','getUsers','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','status','end','json','count','offset','limit','set','reject','save','update','then','get','SquareProjects','destroy','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','merge'];(function(_0x2b5dab,_0x292954){var _0xbd0978=function(_0x23bfbb){while(--_0x23bfbb){_0x2b5dab['push'](_0x2b5dab['shift']());}};_0xbd0978(++_0x292954);}(_0x0b2a,0xd3));var _0xa0b2=function(_0x96635c,_0x2e12aa){_0x96635c=_0x96635c-0x0;var _0x47d76f=_0x0b2a[_0x96635c];return _0x47d76f;};'use strict';var pdf=require(_0xa0b2('0x0'));var emlformat=require(_0xa0b2('0x1'));var rimraf=require(_0xa0b2('0x2'));var zipdir=require(_0xa0b2('0x3'));var jsonpatch=require(_0xa0b2('0x4'));var rp=require(_0xa0b2('0x5'));var moment=require('moment');var BPromise=require(_0xa0b2('0x6'));var Mustache=require(_0xa0b2('0x7'));var util=require(_0xa0b2('0x8'));var path=require(_0xa0b2('0x9'));var sox=require(_0xa0b2('0xa'));var csv=require(_0xa0b2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa0b2('0xc'));var squel=require(_0xa0b2('0xd'));var crypto=require(_0xa0b2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa0b2('0xf'));var toCsv=require(_0xa0b2('0xb'));var querystring=require(_0xa0b2('0x10'));var Papa=require(_0xa0b2('0x11'));var Redis=require(_0xa0b2('0x12'));var authService=require(_0xa0b2('0x13'));var qs=require(_0xa0b2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa0b2('0x15'));var utils=require(_0xa0b2('0x16'));var config=require(_0xa0b2('0x17'));var db=require('../../mysqldb')['db'];config[_0xa0b2('0x18')]=_[_0xa0b2('0x19')](config[_0xa0b2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0b2('0x1a'))(new Redis(config[_0xa0b2('0x18')]));require(_0xa0b2('0x1b'))['register'](socket);function respondWithStatusCode(_0x2dd006,_0xf36a05){_0xf36a05=_0xf36a05||0xcc;return function(_0x2b3bf9){if(_0x2b3bf9){return _0x2dd006['sendStatus'](_0xf36a05);}return _0x2dd006[_0xa0b2('0x1c')](_0xf36a05)[_0xa0b2('0x1d')]();};}function respondWithResult(_0x56fb72,_0x1acb9b){_0x1acb9b=_0x1acb9b||0xc8;return function(_0x34dc62){if(_0x34dc62){return _0x56fb72['status'](_0x1acb9b)[_0xa0b2('0x1e')](_0x34dc62);}};}function respondWithFilteredResult(_0x7193a8,_0x385fa6){return function(_0x31be97){if(_0x31be97){var _0x576a19=_0x31be97[_0xa0b2('0x1f')],_0x45c447=_0x385fa6[_0xa0b2('0x20')],_0x306f9a=_0x385fa6['offset']+_0x385fa6[_0xa0b2('0x21')],_0x720958;if(_0x306f9a>=_0x576a19){_0x306f9a=_0x576a19;_0x720958=0xc8;}else{_0x720958=0xce;}_0x7193a8['status'](_0x720958);return _0x7193a8[_0xa0b2('0x22')]('Content-Range',_0x45c447+'-'+_0x306f9a+'/'+_0x576a19)[_0xa0b2('0x1e')](_0x31be97);}return null;};}function patchUpdates(_0xac7baa){return function(_0x3d60c0){try{jsonpatch['apply'](_0x3d60c0,_0xac7baa,!![]);}catch(_0x2a4875){return BPromise[_0xa0b2('0x23')](_0x2a4875);}return _0x3d60c0[_0xa0b2('0x24')]();};}function saveUpdates(_0x10509b,_0x2789b4){return function(_0x37e5c9){if(_0x37e5c9){return _0x37e5c9[_0xa0b2('0x25')](_0x10509b)['then'](function(_0x4b64d4){return _0x4b64d4;});}return null;};}function removeEntity(_0x4427c9,_0x478bb8){return function(_0x2aa194){if(_0x2aa194){return _0x2aa194['destroy']()[_0xa0b2('0x26')](function(){var _0x35b698=_0x2aa194[_0xa0b2('0x27')]({'plain':!![]});var _0x5507f7=_0xa0b2('0x28');return db['UserProfileResource'][_0xa0b2('0x29')]({'where':{'type':_0x5507f7,'resourceId':_0x35b698['id']}})[_0xa0b2('0x26')](function(){return _0x2aa194;});})['then'](function(){_0x4427c9[_0xa0b2('0x1c')](0xcc)[_0xa0b2('0x1d')]();});}};}function handleEntityNotFound(_0x418671,_0xc71c45){return function(_0x33a2a2){if(!_0x33a2a2){_0x418671['sendStatus'](0x194);}return _0x33a2a2;};}function handleError(_0x43e1c2,_0x5035d1){_0x5035d1=_0x5035d1||0x1f4;return function(_0x135288){logger[_0xa0b2('0x2a')](_0x135288[_0xa0b2('0x2b')]);if(_0x135288[_0xa0b2('0x2c')]){delete _0x135288[_0xa0b2('0x2c')];}_0x43e1c2[_0xa0b2('0x1c')](_0x5035d1)[_0xa0b2('0x2d')](_0x135288);};}exports[_0xa0b2('0x2e')]=function(_0x37f079,_0x5e33ca){var _0x1ef99f={},_0x49b7a3={},_0x1132b7={'count':0x0,'rows':[]};var _0x400091=_[_0xa0b2('0x2f')](db[_0xa0b2('0x30')][_0xa0b2('0x31')],function(_0x3d403b){return{'name':_0x3d403b[_0xa0b2('0x32')],'type':_0x3d403b[_0xa0b2('0x33')][_0xa0b2('0x34')]};});_0x49b7a3[_0xa0b2('0x35')]=_['map'](_0x400091,_0xa0b2('0x2c'));_0x49b7a3[_0xa0b2('0x36')]=_[_0xa0b2('0x37')](_0x37f079[_0xa0b2('0x36')]);_0x49b7a3['filters']=_[_0xa0b2('0x38')](_0x49b7a3['model'],_0x49b7a3[_0xa0b2('0x36')]);_0x1ef99f['attributes']=_['intersection'](_0x49b7a3[_0xa0b2('0x35')],qs[_0xa0b2('0x39')](_0x37f079[_0xa0b2('0x36')][_0xa0b2('0x39')]));_0x1ef99f['attributes']=_0x1ef99f[_0xa0b2('0x3a')]['length']?_0x1ef99f['attributes']:_0x49b7a3[_0xa0b2('0x35')];if(!_0x37f079[_0xa0b2('0x36')][_0xa0b2('0x3b')]('nolimit')){_0x1ef99f[_0xa0b2('0x21')]=qs[_0xa0b2('0x21')](_0x37f079[_0xa0b2('0x36')]['limit']);_0x1ef99f[_0xa0b2('0x20')]=qs[_0xa0b2('0x20')](_0x37f079['query'][_0xa0b2('0x20')]);}_0x1ef99f[_0xa0b2('0x3c')]=qs['sort'](_0x37f079['query'][_0xa0b2('0x3d')]);_0x1ef99f[_0xa0b2('0x3e')]=qs[_0xa0b2('0x3f')](_['pick'](_0x37f079[_0xa0b2('0x36')],_0x49b7a3[_0xa0b2('0x3f')]),_0x400091);if(_0x37f079[_0xa0b2('0x36')]['filter']){_0x1ef99f[_0xa0b2('0x3e')]=_[_0xa0b2('0x40')](_0x1ef99f[_0xa0b2('0x3e')],{'$or':_[_0xa0b2('0x2f')](_0x400091,function(_0x38b0e6){if(_0x38b0e6[_0xa0b2('0x33')]!=='VIRTUAL'){var _0x472a0b={};_0x472a0b[_0x38b0e6[_0xa0b2('0x2c')]]={'$like':'%'+_0x37f079[_0xa0b2('0x36')][_0xa0b2('0x41')]+'%'};return _0x472a0b;}})});}_0x1ef99f=_[_0xa0b2('0x40')]({},_0x1ef99f,_0x37f079[_0xa0b2('0x42')]);var _0x190328={'where':_0x1ef99f[_0xa0b2('0x3e')]};return db[_0xa0b2('0x30')]['count'](_0x190328)['then'](function(_0x5be8eb){_0x1132b7[_0xa0b2('0x1f')]=_0x5be8eb;if(_0x37f079[_0xa0b2('0x36')][_0xa0b2('0x43')]){_0x1ef99f['include']=[{'all':!![]}];}return db[_0xa0b2('0x30')][_0xa0b2('0x44')](_0x1ef99f);})[_0xa0b2('0x26')](function(_0xf73bae){_0x1132b7['rows']=_0xf73bae;return _0x1132b7;})[_0xa0b2('0x26')](respondWithFilteredResult(_0x5e33ca,_0x1ef99f))[_0xa0b2('0x45')](handleError(_0x5e33ca,null));};exports[_0xa0b2('0x46')]=function(_0x445a03,_0x5ab949){var _0x41521d={'raw':![],'where':{'id':_0x445a03['params']['id']}},_0x470137={};_0x470137['model']=_['keys'](db['SquareProject'][_0xa0b2('0x31')]);_0x470137[_0xa0b2('0x36')]=_[_0xa0b2('0x37')](_0x445a03[_0xa0b2('0x36')]);_0x470137[_0xa0b2('0x3f')]=_[_0xa0b2('0x38')](_0x470137[_0xa0b2('0x35')],_0x470137[_0xa0b2('0x36')]);_0x41521d[_0xa0b2('0x3a')]=_[_0xa0b2('0x38')](_0x470137['model'],qs[_0xa0b2('0x39')](_0x445a03[_0xa0b2('0x36')][_0xa0b2('0x39')]));_0x41521d[_0xa0b2('0x3a')]=_0x41521d[_0xa0b2('0x3a')][_0xa0b2('0x47')]?_0x41521d[_0xa0b2('0x3a')]:_0x470137[_0xa0b2('0x35')];if(_0x445a03[_0xa0b2('0x36')][_0xa0b2('0x43')]){_0x41521d[_0xa0b2('0x48')]=[{'all':!![]}];}_0x41521d=_['merge']({},_0x41521d,_0x445a03[_0xa0b2('0x42')]);return db[_0xa0b2('0x30')][_0xa0b2('0x49')](_0x41521d)['then'](handleEntityNotFound(_0x5ab949,null))['then'](respondWithResult(_0x5ab949,null))[_0xa0b2('0x45')](handleError(_0x5ab949,null));};exports[_0xa0b2('0x4a')]=function(_0x573f70,_0x50c4a3){return db[_0xa0b2('0x30')][_0xa0b2('0x4a')](_0x573f70['body'],{})[_0xa0b2('0x26')](function(_0x426816){var _0x2297ae=_0x573f70[_0xa0b2('0x4b')][_0xa0b2('0x27')]({'plain':!![]});if(!_0x2297ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2297ae['role']==='user'){var _0x2c3d74=_0x426816['get']({'plain':!![]});var _0x31b6dc='SquareProjects';return db[_0xa0b2('0x4c')][_0xa0b2('0x49')]({'where':{'name':_0x31b6dc,'userProfileId':_0x2297ae['userProfileId']},'raw':!![]})['then'](function(_0x2c2bc5){if(_0x2c2bc5&&_0x2c2bc5[_0xa0b2('0x4d')]===0x0){return db['UserProfileResource'][_0xa0b2('0x4a')]({'name':_0x2c3d74['name'],'resourceId':_0x2c3d74['id'],'type':_0x2c2bc5[_0xa0b2('0x2c')],'sectionId':_0x2c2bc5['id']},{})[_0xa0b2('0x26')](function(){return _0x426816;});}else{return _0x426816;}})[_0xa0b2('0x45')](function(_0xd37e70){logger[_0xa0b2('0x2a')](_0xa0b2('0x4e'),_0xd37e70);throw _0xd37e70;});}return _0x426816;})['then'](respondWithResult(_0x50c4a3,0xc9))[_0xa0b2('0x45')](handleError(_0x50c4a3,null));};exports[_0xa0b2('0x25')]=function(_0x4935b9,_0x59cbe3){if(_0x4935b9[_0xa0b2('0x4f')]['id']){delete _0x4935b9['body']['id'];}return db[_0xa0b2('0x30')][_0xa0b2('0x49')]({'where':{'id':_0x4935b9[_0xa0b2('0x50')]['id']}})[_0xa0b2('0x26')](handleEntityNotFound(_0x59cbe3,null))[_0xa0b2('0x26')](saveUpdates(_0x4935b9[_0xa0b2('0x4f')],null))[_0xa0b2('0x26')](respondWithResult(_0x59cbe3,null))[_0xa0b2('0x45')](handleError(_0x59cbe3,null));};exports[_0xa0b2('0x29')]=function(_0x3a333d,_0x4af051){return db[_0xa0b2('0x30')]['find']({'where':{'id':_0x3a333d['params']['id']}})[_0xa0b2('0x26')](handleEntityNotFound(_0x4af051,null))[_0xa0b2('0x26')](removeEntity(_0x4af051,null))[_0xa0b2('0x45')](handleError(_0x4af051,null));};exports[_0xa0b2('0x51')]=function(_0x466c4a,_0x33e201,_0x256871){return db[_0xa0b2('0x30')]['find']({'where':{'id':_0x466c4a[_0xa0b2('0x50')]['id']}})[_0xa0b2('0x26')](handleEntityNotFound(_0x33e201,null))[_0xa0b2('0x26')](function(_0x47199a){if(_0x47199a){return _0x47199a['addUsers'](_0x466c4a[_0xa0b2('0x4f')][_0xa0b2('0x52')],_['omit'](_0x466c4a['body'],[_0xa0b2('0x52'),'id'])||{});}})[_0xa0b2('0x26')](respondWithResult(_0x33e201,null))[_0xa0b2('0x45')](handleError(_0x33e201,null));};exports[_0xa0b2('0x53')]=function(_0x3ffa99,_0x3c01cf,_0x2d130f){return db['SquareProject']['find']({'where':{'id':_0x3ffa99[_0xa0b2('0x50')]['id']}})['then'](handleEntityNotFound(_0x3c01cf,null))['then'](function(_0x2458b3){if(_0x2458b3){return _0x2458b3[_0xa0b2('0x53')](_0x3ffa99[_0xa0b2('0x36')][_0xa0b2('0x52')])['then'](function(){if(_[_0xa0b2('0x54')](_0x3ffa99[_0xa0b2('0x36')][_0xa0b2('0x52')])){for(var _0x441a09=0x0;_0x441a09<_0x3ffa99[_0xa0b2('0x36')][_0xa0b2('0x52')][_0xa0b2('0x47')];_0x441a09+=0x1){socket[_0xa0b2('0x55')](_0xa0b2('0x56'),{'UserId':Number(_0x3ffa99[_0xa0b2('0x36')][_0xa0b2('0x52')][_0x441a09]),'SquareProjectId':Number(_0x3ffa99[_0xa0b2('0x50')]['id'])});}}else{socket[_0xa0b2('0x55')]('userSquareProject:remove',{'UserId':Number(_0x3ffa99[_0xa0b2('0x36')][_0xa0b2('0x52')]),'SquareProjectId':Number(_0x3ffa99[_0xa0b2('0x50')]['id'])});}});}})[_0xa0b2('0x26')](respondWithStatusCode(_0x3c01cf,null))[_0xa0b2('0x45')](handleError(_0x3c01cf,null));};exports['getUsers']=function(_0x5d5f68,_0x14beb6,_0x875f0){var _0x23c175={};var _0x58433a={};var _0x2d67cf;var _0x3f648b;return db[_0xa0b2('0x30')][_0xa0b2('0x57')]({'where':{'id':_0x5d5f68[_0xa0b2('0x50')]['id']}})[_0xa0b2('0x26')](handleEntityNotFound(_0x14beb6,null))[_0xa0b2('0x26')](function(_0x204fd6){if(_0x204fd6){_0x2d67cf=_0x204fd6;_0x58433a[_0xa0b2('0x35')]=_[_0xa0b2('0x37')](db[_0xa0b2('0x58')]['rawAttributes']);_0x58433a['query']=_[_0xa0b2('0x37')](_0x5d5f68['query']);_0x58433a[_0xa0b2('0x3f')]=_[_0xa0b2('0x38')](_0x58433a[_0xa0b2('0x35')],_0x58433a['query']);_0x23c175[_0xa0b2('0x3a')]=_[_0xa0b2('0x38')](_0x58433a[_0xa0b2('0x35')],qs[_0xa0b2('0x39')](_0x5d5f68['query']['fields']));_0x23c175['attributes']=_0x23c175[_0xa0b2('0x3a')][_0xa0b2('0x47')]?_0x23c175[_0xa0b2('0x3a')]:_0x58433a[_0xa0b2('0x35')];_0x23c175['order']=qs[_0xa0b2('0x3d')](_0x5d5f68[_0xa0b2('0x36')][_0xa0b2('0x3d')]);_0x23c175[_0xa0b2('0x3e')]=qs[_0xa0b2('0x3f')](_[_0xa0b2('0x59')](_0x5d5f68[_0xa0b2('0x36')],_0x58433a[_0xa0b2('0x3f')]));if(_0x5d5f68[_0xa0b2('0x36')][_0xa0b2('0x41')]){_0x23c175['where']=_[_0xa0b2('0x40')](_0x23c175[_0xa0b2('0x3e')],{'$or':_['map'](_0x23c175[_0xa0b2('0x3a')],function(_0x3aebd0){var _0x2dc417={};_0x2dc417[_0x3aebd0]={'$like':'%'+_0x5d5f68[_0xa0b2('0x36')][_0xa0b2('0x41')]+'%'};return _0x2dc417;})});}_0x23c175=_[_0xa0b2('0x40')]({},_0x23c175,_0x5d5f68[_0xa0b2('0x42')]);return _0x2d67cf[_0xa0b2('0x5a')](_0x23c175);}})[_0xa0b2('0x26')](function(_0x517509){if(_0x517509){_0x3f648b=_0x517509['length'];if(!_0x5d5f68[_0xa0b2('0x36')][_0xa0b2('0x3b')](_0xa0b2('0x5b'))){_0x23c175['limit']=qs[_0xa0b2('0x21')](_0x5d5f68[_0xa0b2('0x36')][_0xa0b2('0x21')]);_0x23c175[_0xa0b2('0x20')]=qs[_0xa0b2('0x20')](_0x5d5f68[_0xa0b2('0x36')]['offset']);}return _0x2d67cf[_0xa0b2('0x5a')](_0x23c175);}})[_0xa0b2('0x26')](function(_0x269ef6){if(_0x269ef6){return _0x269ef6?{'count':_0x3f648b,'rows':_0x269ef6}:null;}})[_0xa0b2('0x26')](respondWithResult(_0x14beb6,null))[_0xa0b2('0x45')](handleError(_0x14beb6,null));}; \ No newline at end of file +var _0x646b=['attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','findAll','params','fields','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','find','userProfileId','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','keys','query','intersection'];(function(_0x149f8c,_0x3267bd){var _0x5d6ddd=function(_0x337aeb){while(--_0x337aeb){_0x149f8c['push'](_0x149f8c['shift']());}};_0x5d6ddd(++_0x3267bd);}(_0x646b,0x85));var _0xb646=function(_0x6acb69,_0xd36dbf){_0x6acb69=_0x6acb69-0x0;var _0x29a021=_0x646b[_0x6acb69];return _0x29a021;};'use strict';var pdf=require(_0xb646('0x0'));var emlformat=require(_0xb646('0x1'));var rimraf=require(_0xb646('0x2'));var zipdir=require(_0xb646('0x3'));var jsonpatch=require(_0xb646('0x4'));var rp=require(_0xb646('0x5'));var moment=require(_0xb646('0x6'));var BPromise=require(_0xb646('0x7'));var Mustache=require(_0xb646('0x8'));var util=require('util');var path=require('path');var sox=require(_0xb646('0x9'));var csv=require(_0xb646('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb646('0xb'));var squel=require(_0xb646('0xc'));var crypto=require(_0xb646('0xd'));var jsforce=require(_0xb646('0xe'));var deskjs=require(_0xb646('0xf'));var toCsv=require(_0xb646('0xa'));var querystring=require(_0xb646('0x10'));var Papa=require(_0xb646('0x11'));var Redis=require(_0xb646('0x12'));var authService=require(_0xb646('0x13'));var qs=require(_0xb646('0x14'));var as=require(_0xb646('0x15'));var hardwareService=require(_0xb646('0x16'));var logger=require(_0xb646('0x17'))('api');var utils=require(_0xb646('0x18'));var config=require('../../config/environment');var db=require(_0xb646('0x19'))['db'];config[_0xb646('0x1a')]=_[_0xb646('0x1b')](config[_0xb646('0x1a')],{'host':_0xb646('0x1c'),'port':0x18eb});var socket=require(_0xb646('0x1d'))(new Redis(config['redis']));require(_0xb646('0x1e'))['register'](socket);function respondWithStatusCode(_0x22cbee,_0x467e6c){_0x467e6c=_0x467e6c||0xcc;return function(_0x2b91dd){if(_0x2b91dd){return _0x22cbee[_0xb646('0x1f')](_0x467e6c);}return _0x22cbee[_0xb646('0x20')](_0x467e6c)[_0xb646('0x21')]();};}function respondWithResult(_0x3da72b,_0x4299ee){_0x4299ee=_0x4299ee||0xc8;return function(_0x166916){if(_0x166916){return _0x3da72b[_0xb646('0x20')](_0x4299ee)[_0xb646('0x22')](_0x166916);}};}function respondWithFilteredResult(_0x4d118e,_0x2a93c3){return function(_0x24023f){if(_0x24023f){var _0x9eb244=_0x24023f[_0xb646('0x23')],_0xb0f3d6=_0x2a93c3[_0xb646('0x24')],_0x383b30=_0x2a93c3[_0xb646('0x24')]+_0x2a93c3[_0xb646('0x25')],_0x167530;if(_0x383b30>=_0x9eb244){_0x383b30=_0x9eb244;_0x167530=0xc8;}else{_0x167530=0xce;}_0x4d118e[_0xb646('0x20')](_0x167530);return _0x4d118e[_0xb646('0x26')](_0xb646('0x27'),_0xb0f3d6+'-'+_0x383b30+'/'+_0x9eb244)[_0xb646('0x22')](_0x24023f);}return null;};}function patchUpdates(_0x44e2e8){return function(_0x403ee8){try{jsonpatch[_0xb646('0x28')](_0x403ee8,_0x44e2e8,!![]);}catch(_0x498e05){return BPromise[_0xb646('0x29')](_0x498e05);}return _0x403ee8[_0xb646('0x2a')]();};}function saveUpdates(_0x2ddae5,_0x5018c2){return function(_0x17ed5){if(_0x17ed5){return _0x17ed5[_0xb646('0x2b')](_0x2ddae5)[_0xb646('0x2c')](function(_0xa64268){return _0xa64268;});}return null;};}function removeEntity(_0x57092b,_0x1964a0){return function(_0x3f3039){if(_0x3f3039){return _0x3f3039[_0xb646('0x2d')]()[_0xb646('0x2c')](function(){var _0x4c9a70=_0x3f3039[_0xb646('0x2e')]({'plain':!![]});var _0x13fff2='SquareProjects';return db[_0xb646('0x2f')]['destroy']({'where':{'type':_0x13fff2,'resourceId':_0x4c9a70['id']}})[_0xb646('0x2c')](function(){return _0x3f3039;});})[_0xb646('0x2c')](function(){_0x57092b[_0xb646('0x20')](0xcc)[_0xb646('0x21')]();});}};}function handleEntityNotFound(_0x3b47bc,_0x5414a6){return function(_0x13a410){if(!_0x13a410){_0x3b47bc['sendStatus'](0x194);}return _0x13a410;};}function handleError(_0x51d179,_0x2e318c){_0x2e318c=_0x2e318c||0x1f4;return function(_0x2fb208){logger[_0xb646('0x30')](_0x2fb208[_0xb646('0x31')]);if(_0x2fb208[_0xb646('0x32')]){delete _0x2fb208[_0xb646('0x32')];}_0x51d179[_0xb646('0x20')](_0x2e318c)['send'](_0x2fb208);};}exports[_0xb646('0x33')]=function(_0x1c60b3,_0xbee3b5){var _0x2ae4a6={},_0x359a44={},_0x2b9cd5={'count':0x0,'rows':[]};var _0x2432a1=_[_0xb646('0x34')](db[_0xb646('0x35')][_0xb646('0x36')],function(_0x4f7bc7){return{'name':_0x4f7bc7[_0xb646('0x37')],'type':_0x4f7bc7[_0xb646('0x38')][_0xb646('0x39')]};});_0x359a44['model']=_[_0xb646('0x34')](_0x2432a1,'name');_0x359a44['query']=_[_0xb646('0x3a')](_0x1c60b3[_0xb646('0x3b')]);_0x359a44['filters']=_[_0xb646('0x3c')](_0x359a44['model'],_0x359a44[_0xb646('0x3b')]);_0x2ae4a6[_0xb646('0x3d')]=_['intersection'](_0x359a44[_0xb646('0x3e')],qs['fields'](_0x1c60b3[_0xb646('0x3b')]['fields']));_0x2ae4a6[_0xb646('0x3d')]=_0x2ae4a6[_0xb646('0x3d')][_0xb646('0x3f')]?_0x2ae4a6[_0xb646('0x3d')]:_0x359a44[_0xb646('0x3e')];if(!_0x1c60b3[_0xb646('0x3b')][_0xb646('0x40')](_0xb646('0x41'))){_0x2ae4a6[_0xb646('0x25')]=qs[_0xb646('0x25')](_0x1c60b3[_0xb646('0x3b')]['limit']);_0x2ae4a6['offset']=qs['offset'](_0x1c60b3[_0xb646('0x3b')][_0xb646('0x24')]);}_0x2ae4a6[_0xb646('0x42')]=qs[_0xb646('0x43')](_0x1c60b3['query']['sort']);_0x2ae4a6[_0xb646('0x44')]=qs[_0xb646('0x45')](_[_0xb646('0x46')](_0x1c60b3[_0xb646('0x3b')],_0x359a44[_0xb646('0x45')]),_0x2432a1);if(_0x1c60b3[_0xb646('0x3b')]['filter']){_0x2ae4a6['where']=_['merge'](_0x2ae4a6['where'],{'$or':_[_0xb646('0x34')](_0x2432a1,function(_0x1f79f1){if(_0x1f79f1[_0xb646('0x38')]!==_0xb646('0x47')){var _0x1e6c78={};_0x1e6c78[_0x1f79f1[_0xb646('0x32')]]={'$like':'%'+_0x1c60b3['query'][_0xb646('0x48')]+'%'};return _0x1e6c78;}})});}_0x2ae4a6=_[_0xb646('0x49')]({},_0x2ae4a6,_0x1c60b3['options']);var _0x4741ea={'where':_0x2ae4a6[_0xb646('0x44')]};return db[_0xb646('0x35')][_0xb646('0x23')](_0x4741ea)[_0xb646('0x2c')](function(_0x577a84){_0x2b9cd5[_0xb646('0x23')]=_0x577a84;if(_0x1c60b3[_0xb646('0x3b')][_0xb646('0x4a')]){_0x2ae4a6['include']=[{'all':!![]}];}return db[_0xb646('0x35')][_0xb646('0x4b')](_0x2ae4a6);})[_0xb646('0x2c')](function(_0x342ef9){_0x2b9cd5['rows']=_0x342ef9;return _0x2b9cd5;})[_0xb646('0x2c')](respondWithFilteredResult(_0xbee3b5,_0x2ae4a6))['catch'](handleError(_0xbee3b5,null));};exports['show']=function(_0x5e2426,_0x3266c7){var _0x38e765={'raw':![],'where':{'id':_0x5e2426[_0xb646('0x4c')]['id']}},_0x51a541={};_0x51a541['model']=_[_0xb646('0x3a')](db[_0xb646('0x35')]['rawAttributes']);_0x51a541['query']=_[_0xb646('0x3a')](_0x5e2426['query']);_0x51a541[_0xb646('0x45')]=_['intersection'](_0x51a541[_0xb646('0x3e')],_0x51a541[_0xb646('0x3b')]);_0x38e765[_0xb646('0x3d')]=_[_0xb646('0x3c')](_0x51a541[_0xb646('0x3e')],qs[_0xb646('0x4d')](_0x5e2426[_0xb646('0x3b')]['fields']));_0x38e765[_0xb646('0x3d')]=_0x38e765['attributes']['length']?_0x38e765['attributes']:_0x51a541['model'];if(_0x5e2426[_0xb646('0x3b')][_0xb646('0x4a')]){_0x38e765[_0xb646('0x4e')]=[{'all':!![]}];}_0x38e765=_['merge']({},_0x38e765,_0x5e2426[_0xb646('0x4f')]);return db[_0xb646('0x35')]['find'](_0x38e765)[_0xb646('0x2c')](handleEntityNotFound(_0x3266c7,null))[_0xb646('0x2c')](respondWithResult(_0x3266c7,null))[_0xb646('0x50')](handleError(_0x3266c7,null));};exports['create']=function(_0xcbef51,_0x4ed7d0){return db['SquareProject'][_0xb646('0x51')](_0xcbef51[_0xb646('0x52')],{})[_0xb646('0x2c')](function(_0x2a8224){var _0x2c98f3=_0xcbef51[_0xb646('0x53')][_0xb646('0x2e')]({'plain':!![]});if(!_0x2c98f3)throw new Error(_0xb646('0x54'));if(_0x2c98f3['role']===_0xb646('0x53')){var _0x2b4e56=_0x2a8224['get']({'plain':!![]});var _0xb029f1=_0xb646('0x55');return db[_0xb646('0x56')][_0xb646('0x57')]({'where':{'name':_0xb029f1,'userProfileId':_0x2c98f3[_0xb646('0x58')]},'raw':!![]})[_0xb646('0x2c')](function(_0x4f5ad7){if(_0x4f5ad7&&_0x4f5ad7['autoAssociation']===0x0){return db[_0xb646('0x2f')][_0xb646('0x51')]({'name':_0x2b4e56['name'],'resourceId':_0x2b4e56['id'],'type':_0x4f5ad7['name'],'sectionId':_0x4f5ad7['id']},{})[_0xb646('0x2c')](function(){return _0x2a8224;});}else{return _0x2a8224;}})['catch'](function(_0xf96a26){logger[_0xb646('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf96a26);throw _0xf96a26;});}return _0x2a8224;})[_0xb646('0x2c')](respondWithResult(_0x4ed7d0,0xc9))[_0xb646('0x50')](handleError(_0x4ed7d0,null));};exports[_0xb646('0x2b')]=function(_0x4200ca,_0x5902db){if(_0x4200ca[_0xb646('0x52')]['id']){delete _0x4200ca['body']['id'];}return db[_0xb646('0x35')][_0xb646('0x57')]({'where':{'id':_0x4200ca[_0xb646('0x4c')]['id']}})[_0xb646('0x2c')](handleEntityNotFound(_0x5902db,null))[_0xb646('0x2c')](saveUpdates(_0x4200ca[_0xb646('0x52')],null))['then'](respondWithResult(_0x5902db,null))['catch'](handleError(_0x5902db,null));};exports['destroy']=function(_0x3ef81a,_0x47f5cc){return db[_0xb646('0x35')]['find']({'where':{'id':_0x3ef81a[_0xb646('0x4c')]['id']}})['then'](handleEntityNotFound(_0x47f5cc,null))[_0xb646('0x2c')](removeEntity(_0x47f5cc,null))['catch'](handleError(_0x47f5cc,null));};exports[_0xb646('0x59')]=function(_0x3b24c4,_0x1b3d7f,_0x1c17c9){return db['SquareProject']['find']({'where':{'id':_0x3b24c4[_0xb646('0x4c')]['id']}})[_0xb646('0x2c')](handleEntityNotFound(_0x1b3d7f,null))['then'](function(_0x711c1d){if(_0x711c1d){return _0x711c1d[_0xb646('0x59')](_0x3b24c4[_0xb646('0x52')][_0xb646('0x5a')],_['omit'](_0x3b24c4['body'],['ids','id'])||{});}})[_0xb646('0x2c')](respondWithResult(_0x1b3d7f,null))[_0xb646('0x50')](handleError(_0x1b3d7f,null));};exports[_0xb646('0x5b')]=function(_0x2f8279,_0x3d30af,_0x2d50f5){return db['SquareProject'][_0xb646('0x57')]({'where':{'id':_0x2f8279[_0xb646('0x4c')]['id']}})[_0xb646('0x2c')](handleEntityNotFound(_0x3d30af,null))[_0xb646('0x2c')](function(_0x33aa4e){if(_0x33aa4e){return _0x33aa4e[_0xb646('0x5b')](_0x2f8279[_0xb646('0x3b')][_0xb646('0x5a')])[_0xb646('0x2c')](function(){if(_[_0xb646('0x5c')](_0x2f8279[_0xb646('0x3b')][_0xb646('0x5a')])){for(var _0x2b813b=0x0;_0x2b813b<_0x2f8279[_0xb646('0x3b')][_0xb646('0x5a')]['length'];_0x2b813b+=0x1){socket['emit'](_0xb646('0x5d'),{'UserId':Number(_0x2f8279[_0xb646('0x3b')]['ids'][_0x2b813b]),'SquareProjectId':Number(_0x2f8279[_0xb646('0x4c')]['id'])});}}else{socket[_0xb646('0x5e')](_0xb646('0x5d'),{'UserId':Number(_0x2f8279[_0xb646('0x3b')][_0xb646('0x5a')]),'SquareProjectId':Number(_0x2f8279[_0xb646('0x4c')]['id'])});}});}})[_0xb646('0x2c')](respondWithStatusCode(_0x3d30af,null))['catch'](handleError(_0x3d30af,null));};exports[_0xb646('0x5f')]=function(_0x40ac05,_0x4708c6,_0x3e80ff){var _0x44816b={};var _0x354f6f={};var _0x59154d;var _0x71f22;return db[_0xb646('0x35')][_0xb646('0x60')]({'where':{'id':_0x40ac05[_0xb646('0x4c')]['id']}})[_0xb646('0x2c')](handleEntityNotFound(_0x4708c6,null))[_0xb646('0x2c')](function(_0x21944f){if(_0x21944f){_0x59154d=_0x21944f;_0x354f6f[_0xb646('0x3e')]=_[_0xb646('0x3a')](db['User'][_0xb646('0x36')]);_0x354f6f[_0xb646('0x3b')]=_[_0xb646('0x3a')](_0x40ac05[_0xb646('0x3b')]);_0x354f6f['filters']=_[_0xb646('0x3c')](_0x354f6f[_0xb646('0x3e')],_0x354f6f[_0xb646('0x3b')]);_0x44816b['attributes']=_['intersection'](_0x354f6f[_0xb646('0x3e')],qs[_0xb646('0x4d')](_0x40ac05[_0xb646('0x3b')]['fields']));_0x44816b[_0xb646('0x3d')]=_0x44816b[_0xb646('0x3d')][_0xb646('0x3f')]?_0x44816b[_0xb646('0x3d')]:_0x354f6f[_0xb646('0x3e')];_0x44816b[_0xb646('0x42')]=qs['sort'](_0x40ac05[_0xb646('0x3b')][_0xb646('0x43')]);_0x44816b['where']=qs[_0xb646('0x45')](_['pick'](_0x40ac05['query'],_0x354f6f[_0xb646('0x45')]));if(_0x40ac05['query'][_0xb646('0x48')]){_0x44816b['where']=_[_0xb646('0x49')](_0x44816b[_0xb646('0x44')],{'$or':_[_0xb646('0x34')](_0x44816b[_0xb646('0x3d')],function(_0x141229){var _0x17e314={};_0x17e314[_0x141229]={'$like':'%'+_0x40ac05[_0xb646('0x3b')][_0xb646('0x48')]+'%'};return _0x17e314;})});}_0x44816b=_[_0xb646('0x49')]({},_0x44816b,_0x40ac05['options']);return _0x59154d[_0xb646('0x5f')](_0x44816b);}})[_0xb646('0x2c')](function(_0x41fa35){if(_0x41fa35){_0x71f22=_0x41fa35[_0xb646('0x3f')];if(!_0x40ac05[_0xb646('0x3b')][_0xb646('0x40')]('nolimit')){_0x44816b[_0xb646('0x25')]=qs[_0xb646('0x25')](_0x40ac05[_0xb646('0x3b')][_0xb646('0x25')]);_0x44816b[_0xb646('0x24')]=qs['offset'](_0x40ac05[_0xb646('0x3b')][_0xb646('0x24')]);}return _0x59154d['getUsers'](_0x44816b);}})['then'](function(_0x335008){if(_0x335008){return _0x335008?{'count':_0x71f22,'rows':_0x335008}:null;}})[_0xb646('0x2c')](respondWithResult(_0x4708c6,null))[_0xb646('0x50')](handleError(_0x4708c6,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f5df491..b48eba8 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 _0xe994=['emit','hook','exports','events','../../mysqldb','SquareProject','save','remove'];(function(_0x197e06,_0x42c950){var _0xdff668=function(_0x21e7ec){while(--_0x21e7ec){_0x197e06['push'](_0x197e06['shift']());}};_0xdff668(++_0x42c950);}(_0xe994,0x6b));var _0x4e99=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xe994[_0x88cd7b];return _0x56fcc8;};'use strict';var EventEmitter=require(_0x4e99('0x0'));var SquareProject=require(_0x4e99('0x1'))['db'][_0x4e99('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e99('0x3'),'afterUpdate':'update','afterDestroy':_0x4e99('0x4')};function emitEvent(_0x574f20){return function(_0x569b6c,_0x464b47,_0xb2c18a){SquareProjectEvents[_0x4e99('0x5')](_0x574f20+':'+_0x569b6c['id'],_0x569b6c);SquareProjectEvents['emit'](_0x574f20,_0x569b6c);_0xb2c18a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4e99('0x6')](e,emitEvent(event));}}module[_0x4e99('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x357e=['events','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0x357e,0x1c2));var _0xe357=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x357e[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0xe357('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xe357('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe357('0x2')](0x0);var events={'afterCreate':_0xe357('0x3'),'afterUpdate':'update','afterDestroy':_0xe357('0x4')};function emitEvent(_0x4e4ee6){return function(_0x2e468e,_0x4699c7,_0x51036e){SquareProjectEvents[_0xe357('0x5')](_0x4e4ee6+':'+_0x2e468e['id'],_0x2e468e);SquareProjectEvents[_0xe357('0x5')](_0x4e4ee6,_0x2e468e);_0x51036e(null);};}for(var e in events){if(events[_0xe357('0x6')](e)){var event=events[e];SquareProject[_0xe357('0x7')](e,emitEvent(event));}}module[_0xe357('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5acc9e4..3d16f09 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 _0x33fe=['rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3aadc1,_0x2cd79c){var _0x4e4292=function(_0x588ac5){while(--_0x588ac5){_0x3aadc1['push'](_0x3aadc1['shift']());}};_0x4e4292(++_0x2cd79c);}(_0x33fe,0x1b2));var _0xe33f=function(_0x4a1aa9,_0x103486){_0x4a1aa9=_0x4a1aa9-0x0;var _0x3e6e06=_0x33fe[_0x4a1aa9];return _0x3e6e06;};'use strict';var _=require(_0xe33f('0x0'));var util=require(_0xe33f('0x1'));var logger=require(_0xe33f('0x2'))(_0xe33f('0x3'));var moment=require(_0xe33f('0x4'));var BPromise=require(_0xe33f('0x5'));var rp=require(_0xe33f('0x6'));var fs=require('fs');var path=require(_0xe33f('0x7'));var rimraf=require(_0xe33f('0x8'));var config=require(_0xe33f('0x9'));var attributes=require(_0xe33f('0xa'));module['exports']=function(_0x567861,_0x533668){return _0x567861[_0xe33f('0xb')](_0xe33f('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19b3=['api','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','util','../../config/logger'];(function(_0x578429,_0x2a64aa){var _0x4276d7=function(_0x5a818f){while(--_0x5a818f){_0x578429['push'](_0x578429['shift']());}};_0x4276d7(++_0x2a64aa);}(_0x19b3,0x6d));var _0x319b=function(_0x53da0e,_0x2c4eb0){_0x53da0e=_0x53da0e-0x0;var _0x3a6ae7=_0x19b3[_0x53da0e];return _0x3a6ae7;};'use strict';var _=require(_0x319b('0x0'));var util=require(_0x319b('0x1'));var logger=require(_0x319b('0x2'))(_0x319b('0x3'));var moment=require(_0x319b('0x4'));var BPromise=require(_0x319b('0x5'));var rp=require(_0x319b('0x6'));var fs=require('fs');var path=require(_0x319b('0x7'));var rimraf=require(_0x319b('0x8'));var config=require('../../config/environment');var attributes=require(_0x319b('0x9'));module[_0x319b('0xa')]=function(_0x4b9cd9,_0x3a8db2){return _0x4b9cd9[_0x319b('0xb')](_0x319b('0xc'),attributes,{'tableName':_0x319b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a16c8de..35ad0ad 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 _0xf0fb=['where','attributes','map','model','include','ShowSquareProject','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','SquareProject,\x20%s,\x20%s','message','catch','SquareProject','options'];(function(_0x28579a,_0x13e3df){var _0xc5ab3=function(_0x54b732){while(--_0x54b732){_0x28579a['push'](_0x28579a['shift']());}};_0xc5ab3(++_0x13e3df);}(_0xf0fb,0x72));var _0xbf0f=function(_0x279095,_0x15f37e){_0x279095=_0x279095-0x0;var _0x5a5cdb=_0xf0fb[_0x279095];return _0x5a5cdb;};'use strict';var _=require(_0xbf0f('0x0'));var util=require(_0xbf0f('0x1'));var moment=require(_0xbf0f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf0f('0x3'));var fs=require('fs');var Redis=require(_0xbf0f('0x4'));var db=require(_0xbf0f('0x5'))['db'];var utils=require(_0xbf0f('0x6'));var logger=require('../../config/logger')(_0xbf0f('0x7'));var config=require(_0xbf0f('0x8'));var jayson=require(_0xbf0f('0x9'));var client=jayson[_0xbf0f('0xa')]['http']({'port':0x232a});config['redis']=_[_0xbf0f('0xb')](config[_0xbf0f('0xc')],{'host':_0xbf0f('0xd'),'port':0x18eb});var socket=require(_0xbf0f('0xe'))(new Redis(config[_0xbf0f('0xc')]));require(_0xbf0f('0xf'))[_0xbf0f('0x10')](socket);function respondWithRpcPromise(_0x476d4e,_0x280494,_0x500e50){return new BPromise(function(_0x17d307,_0x297cc3){return client[_0xbf0f('0x11')](_0x476d4e,_0x500e50)[_0xbf0f('0x12')](function(_0x577f01){logger[_0xbf0f('0x13')]('SquareProject,\x20%s,\x20%s',_0x280494,_0xbf0f('0x14'));logger[_0xbf0f('0x15')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x280494,_0xbf0f('0x14'),JSON[_0xbf0f('0x16')](_0x577f01));if(_0x577f01[_0xbf0f('0x17')]){if(_0x577f01[_0xbf0f('0x17')][_0xbf0f('0x18')]===0x1f4){logger[_0xbf0f('0x17')](_0xbf0f('0x19'),_0x280494,_0x577f01[_0xbf0f('0x17')][_0xbf0f('0x1a')]);return _0x297cc3(_0x577f01[_0xbf0f('0x17')]['message']);}logger[_0xbf0f('0x17')](_0xbf0f('0x19'),_0x280494,_0x577f01[_0xbf0f('0x17')][_0xbf0f('0x1a')]);return _0x17d307(_0x577f01[_0xbf0f('0x17')][_0xbf0f('0x1a')]);}else{logger[_0xbf0f('0x13')](_0xbf0f('0x19'),_0x280494,'request\x20sent');_0x17d307(_0x577f01['result'][_0xbf0f('0x1a')]);}})[_0xbf0f('0x1b')](function(_0x22c8aa){logger[_0xbf0f('0x17')](_0xbf0f('0x19'),_0x280494,_0x22c8aa);_0x297cc3(_0x22c8aa);});});}exports['ShowSquareProject']=function(_0x48023b){var _0x98a482=this;return new Promise(function(_0x4f1bf3,_0x15c135){return db[_0xbf0f('0x1c')]['find']({'raw':_0x48023b[_0xbf0f('0x1d')]?_0x48023b[_0xbf0f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x48023b['options']?_0x48023b['options'][_0xbf0f('0x1e')]||null:null,'attributes':_0x48023b[_0xbf0f('0x1d')]?_0x48023b[_0xbf0f('0x1d')][_0xbf0f('0x1f')]||null:null,'include':_0x48023b[_0xbf0f('0x1d')]?_0x48023b[_0xbf0f('0x1d')]['include']?_[_0xbf0f('0x20')](_0x48023b[_0xbf0f('0x1d')]['include'],function(_0x2a3943){return{'model':db[_0x2a3943[_0xbf0f('0x21')]],'as':_0x2a3943['as'],'attributes':_0x2a3943[_0xbf0f('0x1f')],'include':_0x2a3943['include']?_[_0xbf0f('0x20')](_0x2a3943[_0xbf0f('0x22')],function(_0x29c635){return{'model':db[_0x29c635[_0xbf0f('0x21')]],'as':_0x29c635['as'],'attributes':_0x29c635[_0xbf0f('0x1f')],'include':_0x29c635['include']?_[_0xbf0f('0x20')](_0x29c635[_0xbf0f('0x22')],function(_0x392b0e){return{'model':db[_0x392b0e['model']],'as':_0x392b0e['as'],'attributes':_0x392b0e[_0xbf0f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbf0f('0x12')](function(_0x1692e4){logger[_0xbf0f('0x13')](_0xbf0f('0x23'),_0x48023b);logger[_0xbf0f('0x15')](_0xbf0f('0x23'),_0x48023b,JSON[_0xbf0f('0x16')](_0x1692e4));_0x4f1bf3(_0x1692e4);})['catch'](function(_0x5131e6){logger[_0xbf0f('0x17')](_0xbf0f('0x23'),_0x5131e6[_0xbf0f('0x1a')],_0x48023b);_0x15c135(_0x98a482[_0xbf0f('0x17')](0x1f4,_0x5131e6['message']));});});}; \ No newline at end of file +var _0x8072=['attributes','info','ShowSquareProject','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','then','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','find','options','raw','where','include','map','model'];(function(_0x6ba9d8,_0x4ffdfc){var _0x2f700a=function(_0xe82177){while(--_0xe82177){_0x6ba9d8['push'](_0x6ba9d8['shift']());}};_0x2f700a(++_0x4ffdfc);}(_0x8072,0xd5));var _0x2807=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x8072[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x2807('0x0'));var util=require(_0x2807('0x1'));var moment=require('moment');var BPromise=require(_0x2807('0x2'));var rs=require(_0x2807('0x3'));var fs=require('fs');var Redis=require(_0x2807('0x4'));var db=require(_0x2807('0x5'))['db'];var utils=require(_0x2807('0x6'));var logger=require(_0x2807('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2807('0x8'));var client=jayson[_0x2807('0x9')][_0x2807('0xa')]({'port':0x232a});config['redis']=_[_0x2807('0xb')](config[_0x2807('0xc')],{'host':_0x2807('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2807('0xc')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x36aacb,_0x40a000,_0x48b25b){return new BPromise(function(_0x19298d,_0x33e64f){return client['request'](_0x36aacb,_0x48b25b)[_0x2807('0xe')](function(_0x276398){logger['info']('SquareProject,\x20%s,\x20%s',_0x40a000,_0x2807('0xf'));logger[_0x2807('0x10')](_0x2807('0x11'),_0x40a000,_0x2807('0xf'),JSON[_0x2807('0x12')](_0x276398));if(_0x276398[_0x2807('0x13')]){if(_0x276398[_0x2807('0x13')][_0x2807('0x14')]===0x1f4){logger['error'](_0x2807('0x15'),_0x40a000,_0x276398[_0x2807('0x13')][_0x2807('0x16')]);return _0x33e64f(_0x276398[_0x2807('0x13')]['message']);}logger[_0x2807('0x13')]('SquareProject,\x20%s,\x20%s',_0x40a000,_0x276398[_0x2807('0x13')][_0x2807('0x16')]);return _0x19298d(_0x276398[_0x2807('0x13')][_0x2807('0x16')]);}else{logger['info'](_0x2807('0x15'),_0x40a000,'request\x20sent');_0x19298d(_0x276398[_0x2807('0x17')][_0x2807('0x16')]);}})[_0x2807('0x18')](function(_0x188347){logger['error'](_0x2807('0x15'),_0x40a000,_0x188347);_0x33e64f(_0x188347);});});}exports['ShowSquareProject']=function(_0x334cac){var _0x4a7658=this;return new Promise(function(_0x18e9dc,_0x3d0dda){return db['SquareProject'][_0x2807('0x19')]({'raw':_0x334cac[_0x2807('0x1a')]?_0x334cac[_0x2807('0x1a')][_0x2807('0x1b')]===undefined?!![]:![]:!![],'where':_0x334cac[_0x2807('0x1a')]?_0x334cac[_0x2807('0x1a')][_0x2807('0x1c')]||null:null,'attributes':_0x334cac[_0x2807('0x1a')]?_0x334cac['options']['attributes']||null:null,'include':_0x334cac[_0x2807('0x1a')]?_0x334cac[_0x2807('0x1a')][_0x2807('0x1d')]?_[_0x2807('0x1e')](_0x334cac[_0x2807('0x1a')][_0x2807('0x1d')],function(_0x55f64e){return{'model':db[_0x55f64e['model']],'as':_0x55f64e['as'],'attributes':_0x55f64e['attributes'],'include':_0x55f64e['include']?_[_0x2807('0x1e')](_0x55f64e[_0x2807('0x1d')],function(_0x1d3c9a){return{'model':db[_0x1d3c9a[_0x2807('0x1f')]],'as':_0x1d3c9a['as'],'attributes':_0x1d3c9a[_0x2807('0x20')],'include':_0x1d3c9a[_0x2807('0x1d')]?_[_0x2807('0x1e')](_0x1d3c9a[_0x2807('0x1d')],function(_0x49bd11){return{'model':db[_0x49bd11[_0x2807('0x1f')]],'as':_0x49bd11['as'],'attributes':_0x49bd11[_0x2807('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e17bf){logger[_0x2807('0x21')](_0x2807('0x22'),_0x334cac);logger['debug'](_0x2807('0x22'),_0x334cac,JSON[_0x2807('0x12')](_0x2e17bf));_0x18e9dc(_0x2e17bf);})[_0x2807('0x18')](function(_0x3e4e4d){logger[_0x2807('0x13')](_0x2807('0x22'),_0x3e4e4d[_0x2807('0x16')],_0x334cac);_0x3d0dda(_0x4a7658[_0x2807('0x13')](0x1f4,_0x3e4e4d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 50d4169..1a6d887 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 _0xabce=['squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x22c08a,_0x3c7fc0){var _0x25fa2a=function(_0x5221e3){while(--_0x5221e3){_0x22c08a['push'](_0x22c08a['shift']());}};_0x25fa2a(++_0x3c7fc0);}(_0xabce,0x103));var _0xeabc=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xabce[_0x25bea7];return _0x175952;};'use strict';var SquareProjectEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){SquareProjectEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);SquareProjectEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x1883=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x8bccf6,_0x3c6473){var _0x3c7291=function(_0x24f9d5){while(--_0x24f9d5){_0x8bccf6['push'](_0x8bccf6['shift']());}};_0x3c7291(++_0x3c6473);}(_0x1883,0xab));var _0x3188=function(_0x70447d,_0x4eb572){_0x70447d=_0x70447d-0x0;var _0x40eff0=_0x1883[_0x70447d];return _0x40eff0;};'use strict';var SquareProjectEvents=require(_0x3188('0x0'));var events=[_0x3188('0x1'),_0x3188('0x2'),_0x3188('0x3')];function createListener(_0x11e3bf,_0x7ce655){return function(_0x2551e5){_0x7ce655[_0x3188('0x4')](_0x11e3bf,_0x2551e5);};}function removeListener(_0x1c7c86,_0x44afb8){return function(){SquareProjectEvents[_0x3188('0x5')](_0x1c7c86,_0x44afb8);};}exports[_0x3188('0x6')]=function(_0x408ae0){for(var _0x33b62d=0x0,_0x24f2f1=events[_0x3188('0x7')];_0x33b62d<_0x24f2f1;_0x33b62d++){var _0x3e3afb=events[_0x33b62d];var _0x5c8f26=createListener(_0x3188('0x8')+_0x3e3afb,_0x408ae0);SquareProjectEvents['on'](_0x3e3afb,_0x5c8f26);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 759f5d5..20e92c9 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 _0xdeef=['isAuthenticated','get','show','download','create','put','/:id','update','delete','/:id/delete','destroy','multer','util','connect-timeout','express'];(function(_0x1b87c7,_0x53c83c){var _0x331556=function(_0x22c2de){while(--_0x22c2de){_0x1b87c7['push'](_0x1b87c7['shift']());}};_0x331556(++_0x53c83c);}(_0xdeef,0x182));var _0xfdee=function(_0x3a2deb,_0x2f8c2d){_0x3a2deb=_0x3a2deb-0x0;var _0x203ab0=_0xdeef[_0x3a2deb];return _0x203ab0;};'use strict';var multer=require(_0xfdee('0x0'));var util=require(_0xfdee('0x1'));var path=require('path');var timeout=require(_0xfdee('0x2'));var express=require(_0xfdee('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareRecording.controller');router['get']('/',auth[_0xfdee('0x4')](),controller['index']);router[_0xfdee('0x5')]('/:id',auth[_0xfdee('0x4')](),controller[_0xfdee('0x6')]);router[_0xfdee('0x5')]('/:id/download',auth[_0xfdee('0x4')](),controller[_0xfdee('0x7')]);router['post']('/',auth[_0xfdee('0x4')](),controller[_0xfdee('0x8')]);router[_0xfdee('0x9')](_0xfdee('0xa'),auth[_0xfdee('0x4')](),controller[_0xfdee('0xb')]);router[_0xfdee('0xc')](_0xfdee('0xd'),auth[_0xfdee('0x4')](),controller[_0xfdee('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc880=['./squareRecording.controller','get','isAuthenticated','/:id','/:id/download','post','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x28fac8,_0x357fb2){var _0x440053=function(_0x2b33d8){while(--_0x2b33d8){_0x28fac8['push'](_0x28fac8['shift']());}};_0x440053(++_0x357fb2);}(_0xc880,0xfc));var _0x0c88=function(_0x369c49,_0x56051f){_0x369c49=_0x369c49-0x0;var _0x462801=_0xc880[_0x369c49];return _0x462801;};'use strict';var multer=require(_0x0c88('0x0'));var util=require(_0x0c88('0x1'));var path=require(_0x0c88('0x2'));var timeout=require(_0x0c88('0x3'));var express=require(_0x0c88('0x4'));var router=express[_0x0c88('0x5')]();var auth=require(_0x0c88('0x6'));var interaction=require(_0x0c88('0x7'));var config=require('../../config/environment');var controller=require(_0x0c88('0x8'));router[_0x0c88('0x9')]('/',auth[_0x0c88('0xa')](),controller['index']);router[_0x0c88('0x9')](_0x0c88('0xb'),auth[_0x0c88('0xa')](),controller['show']);router['get'](_0x0c88('0xc'),auth[_0x0c88('0xa')](),controller['download']);router[_0x0c88('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0c88('0xe')](_0x0c88('0xb'),auth[_0x0c88('0xa')](),controller[_0x0c88('0xf')]);router[_0x0c88('0x10')](_0x0c88('0x11'),auth[_0x0c88('0xa')](),controller[_0x0c88('0x12')]);module[_0x0c88('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index c4741db..5b87138 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 _0xd530=['substring','lastIndexOf','sequelize','STRING','getDataValue','savePath'];(function(_0x1168c2,_0x1ed2ce){var _0x5ab8b5=function(_0x49bca8){while(--_0x49bca8){_0x1168c2['push'](_0x1168c2['shift']());}};_0x5ab8b5(++_0x1ed2ce);}(_0xd530,0x7a));var _0x0d53=function(_0x53bb42,_0x337b44){_0x53bb42=_0x53bb42-0x0;var _0xd400d4=_0xd530[_0x53bb42];return _0xd400d4;};'use strict';var Sequelize=require(_0x0d53('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0d53('0x1')]},'callerid':{'type':Sequelize[_0x0d53('0x1')]},'calleridname':{'type':Sequelize[_0x0d53('0x1')]},'context':{'type':Sequelize[_0x0d53('0x1')]},'extension':{'type':Sequelize[_0x0d53('0x1')]},'priority':{'type':Sequelize[_0x0d53('0x1')]},'accountcode':{'type':Sequelize[_0x0d53('0x1')]},'dnid':{'type':Sequelize[_0x0d53('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x0d53('0x1')]},'filename':{'type':Sequelize[_0x0d53('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x1cf968='';var _0x2e16c1=this[_0x0d53('0x2')](_0x0d53('0x3'));if(_0x2e16c1){_0x1cf968=_0x2e16c1[_0x0d53('0x4')](_0x2e16c1[_0x0d53('0x5')]('.'));}return _0x1cf968;}}}; \ No newline at end of file +var _0xaa37=['STRING','VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','exports'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xaa37[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0x7aa3('0x0'));module[_0x7aa3('0x1')]={'uniqueid':{'type':Sequelize[_0x7aa3('0x2')]},'callerid':{'type':Sequelize[_0x7aa3('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7aa3('0x2')]},'extension':{'type':Sequelize[_0x7aa3('0x2')]},'priority':{'type':Sequelize[_0x7aa3('0x2')]},'accountcode':{'type':Sequelize[_0x7aa3('0x2')]},'dnid':{'type':Sequelize[_0x7aa3('0x2')]},'projectName':{'type':Sequelize[_0x7aa3('0x2')]},'saveName':{'type':Sequelize[_0x7aa3('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x7aa3('0x2')]},'format':{'type':Sequelize[_0x7aa3('0x3')],'get':function(){var _0x5d1627='';var _0x100894=this[_0x7aa3('0x4')](_0x7aa3('0x5'));if(_0x100894){_0x5d1627=_0x100894['substring'](_0x100894[_0x7aa3('0x6')]('.'));}return _0x5d1627;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8a3a993..d57ada8 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 _0x21ab=['error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','offset','limit','set','Content-Range','json','apply','reject','save','then','end'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x21ab,0x159));var _0xb21a=function(_0x37026f,_0x2df88f){_0x37026f=_0x37026f-0x0;var _0x40cb74=_0x21ab[_0x37026f];return _0x40cb74;};'use strict';var pdf=require(_0xb21a('0x0'));var emlformat=require(_0xb21a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb21a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb21a('0x3'));var moment=require(_0xb21a('0x4'));var BPromise=require(_0xb21a('0x5'));var Mustache=require(_0xb21a('0x6'));var util=require(_0xb21a('0x7'));var path=require('path');var sox=require(_0xb21a('0x8'));var csv=require(_0xb21a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb21a('0xa'));var crypto=require(_0xb21a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb21a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb21a('0xd'));var Papa=require(_0xb21a('0xe'));var Redis=require(_0xb21a('0xf'));var authService=require(_0xb21a('0x10'));var qs=require(_0xb21a('0x11'));var as=require(_0xb21a('0x12'));var hardwareService=require(_0xb21a('0x13'));var logger=require(_0xb21a('0x14'))(_0xb21a('0x15'));var utils=require('../../config/utils');var config=require(_0xb21a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18faf8,_0x23915b){_0x23915b=_0x23915b||0xcc;return function(_0xc546c6){if(_0xc546c6){return _0x18faf8[_0xb21a('0x17')](_0x23915b);}return _0x18faf8['status'](_0x23915b)['end']();};}function respondWithResult(_0x1a0a9f,_0x2de83f){_0x2de83f=_0x2de83f||0xc8;return function(_0xe213c7){if(_0xe213c7){return _0x1a0a9f[_0xb21a('0x18')](_0x2de83f)['json'](_0xe213c7);}};}function respondWithFilteredResult(_0x3db659,_0x4f366c){return function(_0x167dbf){if(_0x167dbf){var _0x14cdd8=_0x167dbf['count'],_0x4c0648=_0x4f366c[_0xb21a('0x19')],_0x2b821c=_0x4f366c[_0xb21a('0x19')]+_0x4f366c[_0xb21a('0x1a')],_0x5107cc;if(_0x2b821c>=_0x14cdd8){_0x2b821c=_0x14cdd8;_0x5107cc=0xc8;}else{_0x5107cc=0xce;}_0x3db659[_0xb21a('0x18')](_0x5107cc);return _0x3db659[_0xb21a('0x1b')](_0xb21a('0x1c'),_0x4c0648+'-'+_0x2b821c+'/'+_0x14cdd8)[_0xb21a('0x1d')](_0x167dbf);}return null;};}function patchUpdates(_0x589d3e){return function(_0x4c1ab4){try{jsonpatch[_0xb21a('0x1e')](_0x4c1ab4,_0x589d3e,!![]);}catch(_0x5ef416){return BPromise[_0xb21a('0x1f')](_0x5ef416);}return _0x4c1ab4[_0xb21a('0x20')]();};}function saveUpdates(_0xdabaa6,_0x3faf25){return function(_0x102f60){if(_0x102f60){return _0x102f60['update'](_0xdabaa6)[_0xb21a('0x21')](function(_0x4779c7){return _0x4779c7;});}return null;};}function removeEntity(_0x5eae0b,_0x19a8e3){return function(_0x544f27){if(_0x544f27){return _0x544f27['destroy']()[_0xb21a('0x21')](function(){_0x5eae0b[_0xb21a('0x18')](0xcc)[_0xb21a('0x22')]();});}};}function handleEntityNotFound(_0x2628ba,_0x36f023){return function(_0x4217e6){if(!_0x4217e6){_0x2628ba[_0xb21a('0x17')](0x194);}return _0x4217e6;};}function handleError(_0x322a5,_0x58c1a4){_0x58c1a4=_0x58c1a4||0x1f4;return function(_0x5a1e57){logger[_0xb21a('0x23')](_0x5a1e57[_0xb21a('0x24')]);if(_0x5a1e57[_0xb21a('0x25')]){delete _0x5a1e57[_0xb21a('0x25')];}_0x322a5[_0xb21a('0x18')](_0x58c1a4)[_0xb21a('0x26')](_0x5a1e57);};}exports[_0xb21a('0x27')]=function(_0x2d08f6,_0x210cee){var _0x55abb3={},_0x19239f={},_0x479d44={'count':0x0,'rows':[]};var _0x135529=_[_0xb21a('0x28')](db[_0xb21a('0x29')]['rawAttributes'],function(_0x4e1383){return{'name':_0x4e1383[_0xb21a('0x2a')],'type':_0x4e1383[_0xb21a('0x2b')][_0xb21a('0x2c')]};});_0x19239f[_0xb21a('0x2d')]=_[_0xb21a('0x28')](_0x135529,_0xb21a('0x25'));_0x19239f['query']=_['keys'](_0x2d08f6[_0xb21a('0x2e')]);_0x19239f[_0xb21a('0x2f')]=_[_0xb21a('0x30')](_0x19239f[_0xb21a('0x2d')],_0x19239f['query']);_0x55abb3[_0xb21a('0x31')]=_['intersection'](_0x19239f[_0xb21a('0x2d')],qs[_0xb21a('0x32')](_0x2d08f6['query'][_0xb21a('0x32')]));_0x55abb3['attributes']=_0x55abb3[_0xb21a('0x31')][_0xb21a('0x33')]?_0x55abb3[_0xb21a('0x31')]:_0x19239f[_0xb21a('0x2d')];if(!_0x2d08f6[_0xb21a('0x2e')][_0xb21a('0x34')](_0xb21a('0x35'))){_0x55abb3[_0xb21a('0x1a')]=qs[_0xb21a('0x1a')](_0x2d08f6[_0xb21a('0x2e')][_0xb21a('0x1a')]);_0x55abb3[_0xb21a('0x19')]=qs[_0xb21a('0x19')](_0x2d08f6['query']['offset']);}_0x55abb3[_0xb21a('0x36')]=qs[_0xb21a('0x37')](_0x2d08f6[_0xb21a('0x2e')]['sort']);_0x55abb3[_0xb21a('0x38')]=qs[_0xb21a('0x2f')](_[_0xb21a('0x39')](_0x2d08f6[_0xb21a('0x2e')],_0x19239f['filters']),_0x135529);if(_0x2d08f6[_0xb21a('0x2e')][_0xb21a('0x3a')]){_0x55abb3[_0xb21a('0x38')]=_[_0xb21a('0x3b')](_0x55abb3[_0xb21a('0x38')],{'$or':_[_0xb21a('0x28')](_0x135529,function(_0x5ad4e3){if(_0x5ad4e3['type']!=='VIRTUAL'){var _0x2065a0={};_0x2065a0[_0x5ad4e3[_0xb21a('0x25')]]={'$like':'%'+_0x2d08f6[_0xb21a('0x2e')][_0xb21a('0x3a')]+'%'};return _0x2065a0;}})});}_0x55abb3=_[_0xb21a('0x3b')]({},_0x55abb3,_0x2d08f6[_0xb21a('0x3c')]);var _0xf12f61={'where':_0x55abb3['where']};return db[_0xb21a('0x29')][_0xb21a('0x3d')](_0xf12f61)[_0xb21a('0x21')](function(_0xbfdfbf){_0x479d44[_0xb21a('0x3d')]=_0xbfdfbf;if(_0x2d08f6[_0xb21a('0x2e')][_0xb21a('0x3e')]){_0x55abb3[_0xb21a('0x3f')]=[{'all':!![]}];}return db[_0xb21a('0x29')][_0xb21a('0x40')](_0x55abb3);})['then'](function(_0xe24043){_0x479d44['rows']=_0xe24043;return _0x479d44;})['then'](respondWithFilteredResult(_0x210cee,_0x55abb3))[_0xb21a('0x41')](handleError(_0x210cee,null));};exports[_0xb21a('0x42')]=function(_0x3c5854,_0xebfd){var _0x54959a={'raw':!![],'where':{'id':_0x3c5854[_0xb21a('0x43')]['id']}},_0x413f4c={};_0x413f4c['model']=_[_0xb21a('0x44')](db[_0xb21a('0x29')]['rawAttributes']);_0x413f4c[_0xb21a('0x2e')]=_['keys'](_0x3c5854[_0xb21a('0x2e')]);_0x413f4c['filters']=_['intersection'](_0x413f4c[_0xb21a('0x2d')],_0x413f4c['query']);_0x54959a['attributes']=_['intersection'](_0x413f4c[_0xb21a('0x2d')],qs[_0xb21a('0x32')](_0x3c5854['query'][_0xb21a('0x32')]));_0x54959a[_0xb21a('0x31')]=_0x54959a[_0xb21a('0x31')][_0xb21a('0x33')]?_0x54959a[_0xb21a('0x31')]:_0x413f4c[_0xb21a('0x2d')];if(_0x3c5854['query'][_0xb21a('0x3e')]){_0x54959a[_0xb21a('0x3f')]=[{'all':!![]}];}_0x54959a=_[_0xb21a('0x3b')]({},_0x54959a,_0x3c5854[_0xb21a('0x3c')]);return db['SquareRecording'][_0xb21a('0x45')](_0x54959a)[_0xb21a('0x21')](handleEntityNotFound(_0xebfd,null))[_0xb21a('0x21')](respondWithResult(_0xebfd,null))[_0xb21a('0x41')](handleError(_0xebfd,null));};exports[_0xb21a('0x46')]=function(_0x40d182,_0x103b8f){return db[_0xb21a('0x29')][_0xb21a('0x46')](_0x40d182[_0xb21a('0x47')],{})[_0xb21a('0x21')](respondWithResult(_0x103b8f,0xc9))[_0xb21a('0x41')](handleError(_0x103b8f,null));};exports[_0xb21a('0x48')]=function(_0x5b8ae2,_0x3fbb90){if(_0x5b8ae2[_0xb21a('0x47')]['id']){delete _0x5b8ae2[_0xb21a('0x47')]['id'];}return db[_0xb21a('0x29')][_0xb21a('0x45')]({'where':{'id':_0x5b8ae2[_0xb21a('0x43')]['id']}})[_0xb21a('0x21')](handleEntityNotFound(_0x3fbb90,null))['then'](saveUpdates(_0x5b8ae2[_0xb21a('0x47')],null))[_0xb21a('0x21')](respondWithResult(_0x3fbb90,null))[_0xb21a('0x41')](handleError(_0x3fbb90,null));};exports[_0xb21a('0x49')]=function(_0x26a3a9,_0x50a074,_0x25f442){var _0x211018=require(_0xb21a('0x4a'));var _0x38a21e=![];var _0x11b812={};if(_0x26a3a9[_0xb21a('0x2e')][_0xb21a('0x2b')]&&_0x26a3a9['query'][_0xb21a('0x2b')]===_0xb21a('0x4b')){_0x11b812[_0xb21a('0x4b')]=_0x26a3a9[_0xb21a('0x43')]['id'];}else{_0x11b812['id']=_0x26a3a9[_0xb21a('0x43')]['id'];}return db[_0xb21a('0x29')][_0xb21a('0x45')]({'where':_0x11b812,'attributes':['id',_0xb21a('0x4c'),'filename'],'raw':!![]})[_0xb21a('0x21')](handleEntityNotFound(_0x50a074,null))[_0xb21a('0x21')](function(_0x11173a){if(_0x11173a){var _0x562d61=_0x11173a['savePath'];var _0x3fe166=util['format'](_0xb21a('0x4d'),_0x562d61);if(fs[_0xb21a('0x4e')](_0x3fe166)){_0x38a21e=!![];return _0x211018[_0xb21a('0x4f')](_0x3fe166,_0x562d61,config[_0xb21a('0x50')]['recording'])[_0xb21a('0x21')](function(){return _0x11173a;});}return _0x11173a;}})['then'](function(_0x8545e){if(_0x8545e){var _0x2cdbf8=_0x8545e[_0xb21a('0x4c')];if(!fs[_0xb21a('0x4e')](_0x2cdbf8)){throw new db[(_0xb21a('0x51'))][(_0xb21a('0x52'))](_0xb21a('0x53'));}if(_0x8545e['filename']){return _0x50a074[_0xb21a('0x49')](_0x2cdbf8,_0x8545e['filename']+path[_0xb21a('0x54')](_0x2cdbf8),function(){if(_0x38a21e){fs[_0xb21a('0x55')](_0x2cdbf8);}});}else{return _0x50a074[_0xb21a('0x49')](_0x2cdbf8,function(_0x7bb664){if(_0x38a21e){fs[_0xb21a('0x55')](_0x2cdbf8);}});}}})[_0xb21a('0x41')](function(_0x33a615){if(_0x33a615['message']===_0xb21a('0x53')){_0x50a074[_0xb21a('0x18')](0x194)[_0xb21a('0x26')]('Not\x20found');}else{return handleError(_0x50a074,null);}});};exports[_0xb21a('0x56')]=function(_0x59bf19,_0xf1620d){return db[_0xb21a('0x29')][_0xb21a('0x45')]({'where':{'id':_0x59bf19['params']['id']}})[_0xb21a('0x21')](function(_0x250077){if(!_0x250077)throw new ReferenceError(_0xb21a('0x57'));return _0x250077;})[_0xb21a('0x21')](function(_0x4b3402){var _0x2db8a8=_0x4b3402['savePath'];logger['info'](_0xb21a('0x58'),_0x2db8a8);if(!_[_0xb21a('0x59')](_0x4b3402[_0xb21a('0x4c')])&&fs[_0xb21a('0x4e')](_0x2db8a8)){logger[_0xb21a('0x5a')](_0xb21a('0x5b')+_0x2db8a8+_0xb21a('0x5c'));fs[_0xb21a('0x5d')](_0x2db8a8);}_0x2db8a8=_0x2db8a8+_0xb21a('0x5e');if(!_[_0xb21a('0x59')](_0x4b3402[_0xb21a('0x4c')])&&fs[_0xb21a('0x4e')](_0x2db8a8)){logger[_0xb21a('0x5a')](_0xb21a('0x5b')+_0x2db8a8+_0xb21a('0x5c'));fs[_0xb21a('0x5d')](_0x2db8a8);}return _0x4b3402;})[_0xb21a('0x21')](function(_0x5c8402){if(!_0x5c8402)throw new InternalError();return _0x5c8402[_0xb21a('0x56')]();})[_0xb21a('0x21')](function(){_0xf1620d[_0xb21a('0x18')](0xcc)[_0xb21a('0x22')]();})[_0xb21a('0x41')](handleError(_0xf1620d,null));}; \ No newline at end of file +var _0x5635=['download','../../components/encryptor','type','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','SquareRecording','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','create','body','params'];(function(_0x58d4b9,_0x5b641d){var _0x4b53fc=function(_0x286a49){while(--_0x286a49){_0x58d4b9['push'](_0x58d4b9['shift']());}};_0x4b53fc(++_0x5b641d);}(_0x5635,0xdd));var _0x5563=function(_0xf45426,_0x550e35){_0xf45426=_0xf45426-0x0;var _0x24b9c9=_0x5635[_0xf45426];return _0x24b9c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5563('0x0'));var rimraf=require(_0x5563('0x1'));var zipdir=require(_0x5563('0x2'));var jsonpatch=require(_0x5563('0x3'));var rp=require(_0x5563('0x4'));var moment=require(_0x5563('0x5'));var BPromise=require(_0x5563('0x6'));var Mustache=require(_0x5563('0x7'));var util=require('util');var path=require(_0x5563('0x8'));var sox=require(_0x5563('0x9'));var csv=require(_0x5563('0xa'));var ejs=require(_0x5563('0xb'));var fs=require('fs');var _=require(_0x5563('0xc'));var squel=require(_0x5563('0xd'));var crypto=require(_0x5563('0xe'));var jsforce=require(_0x5563('0xf'));var deskjs=require(_0x5563('0x10'));var toCsv=require(_0x5563('0xa'));var querystring=require(_0x5563('0x11'));var Papa=require(_0x5563('0x12'));var Redis=require(_0x5563('0x13'));var authService=require(_0x5563('0x14'));var qs=require(_0x5563('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5563('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x5563('0x17'));var config=require(_0x5563('0x18'));var db=require(_0x5563('0x19'))['db'];function respondWithStatusCode(_0x1ae7ad,_0x543204){_0x543204=_0x543204||0xcc;return function(_0x18c043){if(_0x18c043){return _0x1ae7ad[_0x5563('0x1a')](_0x543204);}return _0x1ae7ad[_0x5563('0x1b')](_0x543204)['end']();};}function respondWithResult(_0x4868c5,_0x202904){_0x202904=_0x202904||0xc8;return function(_0x29e4d6){if(_0x29e4d6){return _0x4868c5[_0x5563('0x1b')](_0x202904)[_0x5563('0x1c')](_0x29e4d6);}};}function respondWithFilteredResult(_0x5b9213,_0x46a539){return function(_0x1a1241){if(_0x1a1241){var _0x5e85be=_0x1a1241[_0x5563('0x1d')],_0xf6ee73=_0x46a539[_0x5563('0x1e')],_0x45b1d8=_0x46a539['offset']+_0x46a539[_0x5563('0x1f')],_0x244cf9;if(_0x45b1d8>=_0x5e85be){_0x45b1d8=_0x5e85be;_0x244cf9=0xc8;}else{_0x244cf9=0xce;}_0x5b9213[_0x5563('0x1b')](_0x244cf9);return _0x5b9213[_0x5563('0x20')]('Content-Range',_0xf6ee73+'-'+_0x45b1d8+'/'+_0x5e85be)[_0x5563('0x1c')](_0x1a1241);}return null;};}function patchUpdates(_0x998c3a){return function(_0x311154){try{jsonpatch[_0x5563('0x21')](_0x311154,_0x998c3a,!![]);}catch(_0x1e3cf8){return BPromise[_0x5563('0x22')](_0x1e3cf8);}return _0x311154[_0x5563('0x23')]();};}function saveUpdates(_0x58d680,_0x2be863){return function(_0x2d1409){if(_0x2d1409){return _0x2d1409[_0x5563('0x24')](_0x58d680)[_0x5563('0x25')](function(_0x5e9695){return _0x5e9695;});}return null;};}function removeEntity(_0x541672,_0x4bf2ab){return function(_0x9a176e){if(_0x9a176e){return _0x9a176e[_0x5563('0x26')]()[_0x5563('0x25')](function(){_0x541672[_0x5563('0x1b')](0xcc)[_0x5563('0x27')]();});}};}function handleEntityNotFound(_0x343736,_0x518c49){return function(_0x2be057){if(!_0x2be057){_0x343736[_0x5563('0x1a')](0x194);}return _0x2be057;};}function handleError(_0x2952cc,_0x44c18c){_0x44c18c=_0x44c18c||0x1f4;return function(_0x46c5e7){logger[_0x5563('0x28')](_0x46c5e7[_0x5563('0x29')]);if(_0x46c5e7[_0x5563('0x2a')]){delete _0x46c5e7[_0x5563('0x2a')];}_0x2952cc['status'](_0x44c18c)['send'](_0x46c5e7);};}exports['index']=function(_0x325611,_0x2e00a4){var _0x29e748={},_0x46409d={},_0x13317f={'count':0x0,'rows':[]};var _0x2fbe5b=_['map'](db[_0x5563('0x2b')][_0x5563('0x2c')],function(_0x3e742c){return{'name':_0x3e742c[_0x5563('0x2d')],'type':_0x3e742c['type']['key']};});_0x46409d['model']=_[_0x5563('0x2e')](_0x2fbe5b,_0x5563('0x2a'));_0x46409d[_0x5563('0x2f')]=_[_0x5563('0x30')](_0x325611[_0x5563('0x2f')]);_0x46409d[_0x5563('0x31')]=_[_0x5563('0x32')](_0x46409d[_0x5563('0x33')],_0x46409d[_0x5563('0x2f')]);_0x29e748[_0x5563('0x34')]=_[_0x5563('0x32')](_0x46409d['model'],qs[_0x5563('0x35')](_0x325611[_0x5563('0x2f')][_0x5563('0x35')]));_0x29e748['attributes']=_0x29e748[_0x5563('0x34')]['length']?_0x29e748['attributes']:_0x46409d[_0x5563('0x33')];if(!_0x325611[_0x5563('0x2f')][_0x5563('0x36')](_0x5563('0x37'))){_0x29e748[_0x5563('0x1f')]=qs['limit'](_0x325611[_0x5563('0x2f')]['limit']);_0x29e748[_0x5563('0x1e')]=qs[_0x5563('0x1e')](_0x325611[_0x5563('0x2f')][_0x5563('0x1e')]);}_0x29e748['order']=qs[_0x5563('0x38')](_0x325611[_0x5563('0x2f')]['sort']);_0x29e748[_0x5563('0x39')]=qs[_0x5563('0x31')](_[_0x5563('0x3a')](_0x325611[_0x5563('0x2f')],_0x46409d[_0x5563('0x31')]),_0x2fbe5b);if(_0x325611[_0x5563('0x2f')][_0x5563('0x3b')]){_0x29e748[_0x5563('0x39')]=_[_0x5563('0x3c')](_0x29e748[_0x5563('0x39')],{'$or':_[_0x5563('0x2e')](_0x2fbe5b,function(_0x31fd0b){if(_0x31fd0b['type']!==_0x5563('0x3d')){var _0x47066b={};_0x47066b[_0x31fd0b[_0x5563('0x2a')]]={'$like':'%'+_0x325611[_0x5563('0x2f')]['filter']+'%'};return _0x47066b;}})});}_0x29e748=_[_0x5563('0x3c')]({},_0x29e748,_0x325611[_0x5563('0x3e')]);var _0x5a0826={'where':_0x29e748['where']};return db[_0x5563('0x2b')][_0x5563('0x1d')](_0x5a0826)[_0x5563('0x25')](function(_0xe2bac9){_0x13317f['count']=_0xe2bac9;if(_0x325611['query'][_0x5563('0x3f')]){_0x29e748[_0x5563('0x40')]=[{'all':!![]}];}return db[_0x5563('0x2b')]['findAll'](_0x29e748);})[_0x5563('0x25')](function(_0x509172){_0x13317f[_0x5563('0x41')]=_0x509172;return _0x13317f;})[_0x5563('0x25')](respondWithFilteredResult(_0x2e00a4,_0x29e748))[_0x5563('0x42')](handleError(_0x2e00a4,null));};exports[_0x5563('0x43')]=function(_0x1c059c,_0x222a79){var _0x5ba7f5={'raw':!![],'where':{'id':_0x1c059c['params']['id']}},_0x39019d={};_0x39019d[_0x5563('0x33')]=_[_0x5563('0x30')](db['SquareRecording'][_0x5563('0x2c')]);_0x39019d[_0x5563('0x2f')]=_[_0x5563('0x30')](_0x1c059c['query']);_0x39019d['filters']=_[_0x5563('0x32')](_0x39019d[_0x5563('0x33')],_0x39019d[_0x5563('0x2f')]);_0x5ba7f5[_0x5563('0x34')]=_[_0x5563('0x32')](_0x39019d['model'],qs[_0x5563('0x35')](_0x1c059c[_0x5563('0x2f')][_0x5563('0x35')]));_0x5ba7f5[_0x5563('0x34')]=_0x5ba7f5['attributes'][_0x5563('0x44')]?_0x5ba7f5['attributes']:_0x39019d[_0x5563('0x33')];if(_0x1c059c[_0x5563('0x2f')]['includeAll']){_0x5ba7f5[_0x5563('0x40')]=[{'all':!![]}];}_0x5ba7f5=_[_0x5563('0x3c')]({},_0x5ba7f5,_0x1c059c['options']);return db[_0x5563('0x2b')][_0x5563('0x45')](_0x5ba7f5)['then'](handleEntityNotFound(_0x222a79,null))['then'](respondWithResult(_0x222a79,null))['catch'](handleError(_0x222a79,null));};exports[_0x5563('0x46')]=function(_0xe81aa1,_0x3d0bad){return db['SquareRecording']['create'](_0xe81aa1['body'],{})[_0x5563('0x25')](respondWithResult(_0x3d0bad,0xc9))['catch'](handleError(_0x3d0bad,null));};exports[_0x5563('0x24')]=function(_0x30c0ce,_0x528a66){if(_0x30c0ce[_0x5563('0x47')]['id']){delete _0x30c0ce[_0x5563('0x47')]['id'];}return db[_0x5563('0x2b')][_0x5563('0x45')]({'where':{'id':_0x30c0ce[_0x5563('0x48')]['id']}})[_0x5563('0x25')](handleEntityNotFound(_0x528a66,null))[_0x5563('0x25')](saveUpdates(_0x30c0ce['body'],null))['then'](respondWithResult(_0x528a66,null))[_0x5563('0x42')](handleError(_0x528a66,null));};exports[_0x5563('0x49')]=function(_0x4772b3,_0xd651fa,_0x5bb81c){var _0x32d70d=require(_0x5563('0x4a'));var _0x5e70f1=![];var _0x98edbe={};if(_0x4772b3[_0x5563('0x2f')][_0x5563('0x4b')]&&_0x4772b3[_0x5563('0x2f')]['type']===_0x5563('0x4c')){_0x98edbe[_0x5563('0x4c')]=_0x4772b3[_0x5563('0x48')]['id'];}else{_0x98edbe['id']=_0x4772b3['params']['id'];}return db[_0x5563('0x2b')][_0x5563('0x45')]({'where':_0x98edbe,'attributes':['id',_0x5563('0x4d'),_0x5563('0x4e')],'raw':!![]})[_0x5563('0x25')](handleEntityNotFound(_0xd651fa,null))[_0x5563('0x25')](function(_0x5debc7){if(_0x5debc7){var _0x3e8028=_0x5debc7[_0x5563('0x4d')];var _0x29a19e=util[_0x5563('0x4f')]('%s.cypher',_0x3e8028);if(fs[_0x5563('0x50')](_0x29a19e)){_0x5e70f1=!![];return _0x32d70d[_0x5563('0x51')](_0x29a19e,_0x3e8028,config[_0x5563('0x52')][_0x5563('0x53')])[_0x5563('0x25')](function(){return _0x5debc7;});}return _0x5debc7;}})['then'](function(_0x383d6c){if(_0x383d6c){var _0x5237d3=_0x383d6c[_0x5563('0x4d')];if(!fs[_0x5563('0x50')](_0x5237d3)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x383d6c[_0x5563('0x4e')]){return _0xd651fa[_0x5563('0x49')](_0x5237d3,_0x383d6c[_0x5563('0x4e')]+path[_0x5563('0x54')](_0x5237d3),function(){if(_0x5e70f1){fs[_0x5563('0x55')](_0x5237d3);}});}else{return _0xd651fa['download'](_0x5237d3,function(_0x15f0a4){if(_0x5e70f1){fs[_0x5563('0x55')](_0x5237d3);}});}}})['catch'](function(_0x131137){if(_0x131137[_0x5563('0x56')]===_0x5563('0x57')){_0xd651fa[_0x5563('0x1b')](0x194)[_0x5563('0x58')](_0x5563('0x59'));}else{return handleError(_0xd651fa,null);}});};exports[_0x5563('0x26')]=function(_0x17be01,_0x44b915){return db[_0x5563('0x2b')]['find']({'where':{'id':_0x17be01['params']['id']}})[_0x5563('0x25')](function(_0x29a83d){if(!_0x29a83d)throw new ReferenceError(_0x5563('0x5a'));return _0x29a83d;})[_0x5563('0x25')](function(_0x4b8f17){var _0x565d36=_0x4b8f17['savePath'];logger[_0x5563('0x5b')](_0x5563('0x5c'),_0x565d36);if(!_[_0x5563('0x5d')](_0x4b8f17[_0x5563('0x4d')])&&fs[_0x5563('0x50')](_0x565d36)){logger[_0x5563('0x5b')](_0x5563('0x5e')+_0x565d36+_0x5563('0x5f'));fs['unlinkSync'](_0x565d36);}_0x565d36=_0x565d36+_0x5563('0x60');if(!_[_0x5563('0x5d')](_0x4b8f17[_0x5563('0x4d')])&&fs[_0x5563('0x50')](_0x565d36)){logger['info'](_0x5563('0x5e')+_0x565d36+_0x5563('0x5f'));fs[_0x5563('0x61')](_0x565d36);}return _0x4b8f17;})[_0x5563('0x25')](function(_0x1fc802){if(!_0x1fc802)throw new InternalError();return _0x1fc802[_0x5563('0x26')]();})[_0x5563('0x25')](function(){_0x44b915[_0x5563('0x1b')](0xcc)[_0x5563('0x27')]();})[_0x5563('0x42')](handleError(_0x44b915,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f01e19b..9b609f0 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 _0x4325=['moment','bluebird','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording','lodash','util','api'];(function(_0x135a4f,_0x2c0520){var _0x5018d8=function(_0x223034){while(--_0x223034){_0x135a4f['push'](_0x135a4f['shift']());}};_0x5018d8(++_0x2c0520);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3423=['SquareRecording','square_recordings','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x16068d,_0x1fd621){var _0x3a668e=function(_0x34127b){while(--_0x34127b){_0x16068d['push'](_0x16068d['shift']());}};_0x3a668e(++_0x1fd621);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index a92f78b..363c50a 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 _0x5ed4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SquareRecording','options','CreateSquareRecording','stringify'];(function(_0x3039b1,_0x2b40f6){var _0x1335f8=function(_0xeaa286){while(--_0xeaa286){_0x3039b1['push'](_0x3039b1['shift']());}};_0x1335f8(++_0x2b40f6);}(_0x5ed4,0x186));var _0x45ed=function(_0x517161,_0x25490e){_0x517161=_0x517161-0x0;var _0x4cc3e5=_0x5ed4[_0x517161];return _0x4cc3e5;};'use strict';var _=require(_0x45ed('0x0'));var util=require(_0x45ed('0x1'));var moment=require('moment');var BPromise=require(_0x45ed('0x2'));var rs=require(_0x45ed('0x3'));var fs=require('fs');var Redis=require(_0x45ed('0x4'));var db=require(_0x45ed('0x5'))['db'];var utils=require(_0x45ed('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x45ed('0x7'));var jayson=require(_0x45ed('0x8'));var client=jayson[_0x45ed('0x9')][_0x45ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0369,_0x15b711,_0x57323e){return new BPromise(function(_0x5016ca,_0x4bd9cf){return client[_0x45ed('0xb')](_0x2a0369,_0x57323e)[_0x45ed('0xc')](function(_0x262cdc){logger[_0x45ed('0xd')](_0x45ed('0xe'),_0x15b711,_0x45ed('0xf'));logger[_0x45ed('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x15b711,'request\x20sent',JSON['stringify'](_0x262cdc));if(_0x262cdc[_0x45ed('0x11')]){if(_0x262cdc[_0x45ed('0x11')][_0x45ed('0x12')]===0x1f4){logger['error'](_0x45ed('0xe'),_0x15b711,_0x262cdc[_0x45ed('0x11')]['message']);return _0x4bd9cf(_0x262cdc[_0x45ed('0x11')][_0x45ed('0x13')]);}logger[_0x45ed('0x11')]('SquareRecording,\x20%s,\x20%s',_0x15b711,_0x262cdc[_0x45ed('0x11')][_0x45ed('0x13')]);return _0x5016ca(_0x262cdc[_0x45ed('0x11')]['message']);}else{logger[_0x45ed('0xd')](_0x45ed('0xe'),_0x15b711,'request\x20sent');_0x5016ca(_0x262cdc[_0x45ed('0x14')][_0x45ed('0x13')]);}})[_0x45ed('0x15')](function(_0x46970e){logger['error']('SquareRecording,\x20%s,\x20%s',_0x15b711,_0x46970e);_0x4bd9cf(_0x46970e);});});}exports['CreateSquareRecording']=function(_0x3ca907){var _0x194808=this;return new Promise(function(_0x38e0b2,_0x38ae58){return db[_0x45ed('0x16')]['create'](_0x3ca907['body'],{'raw':_0x3ca907[_0x45ed('0x17')]?_0x3ca907[_0x45ed('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x45ed('0xc')](function(_0x54d26c){logger[_0x45ed('0xd')](_0x45ed('0x18'),_0x3ca907);logger['debug']('CreateSquareRecording',_0x3ca907,JSON[_0x45ed('0x19')](_0x54d26c));_0x38e0b2(_0x54d26c);})[_0x45ed('0x15')](function(_0x144445){logger[_0x45ed('0x11')](_0x45ed('0x18'),_0x144445['message'],_0x3ca907);_0x38ae58(_0x194808[_0x45ed('0x11')](0x1f4,_0x144445[_0x45ed('0x13')]));});});}; \ No newline at end of file +var _0x4a57=['rpc','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareRecording','create','body','options','raw','then','CreateSquareRecording','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a57,0x18e));var _0x74a5=function(_0xf244e0,_0x20556c){_0xf244e0=_0xf244e0-0x0;var _0xe94095=_0x4a57[_0xf244e0];return _0xe94095;};'use strict';var _=require(_0x74a5('0x0'));var util=require(_0x74a5('0x1'));var moment=require(_0x74a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x74a5('0x3'));var fs=require('fs');var Redis=require(_0x74a5('0x4'));var db=require(_0x74a5('0x5'))['db'];var utils=require(_0x74a5('0x6'));var logger=require(_0x74a5('0x7'))(_0x74a5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74a5('0x9')][_0x74a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x437805,_0x3d2fac,_0x4e21ff){return new BPromise(function(_0x5e65e8,_0x553ea8){return client['request'](_0x437805,_0x4e21ff)['then'](function(_0x5d218e){logger[_0x74a5('0xb')](_0x74a5('0xc'),_0x3d2fac,_0x74a5('0xd'));logger[_0x74a5('0xe')](_0x74a5('0xf'),_0x3d2fac,_0x74a5('0xd'),JSON[_0x74a5('0x10')](_0x5d218e));if(_0x5d218e[_0x74a5('0x11')]){if(_0x5d218e['error'][_0x74a5('0x12')]===0x1f4){logger[_0x74a5('0x11')](_0x74a5('0xc'),_0x3d2fac,_0x5d218e['error'][_0x74a5('0x13')]);return _0x553ea8(_0x5d218e['error'][_0x74a5('0x13')]);}logger[_0x74a5('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3d2fac,_0x5d218e[_0x74a5('0x11')][_0x74a5('0x13')]);return _0x5e65e8(_0x5d218e['error'][_0x74a5('0x13')]);}else{logger[_0x74a5('0xb')](_0x74a5('0xc'),_0x3d2fac,_0x74a5('0xd'));_0x5e65e8(_0x5d218e[_0x74a5('0x14')]['message']);}})[_0x74a5('0x15')](function(_0xbcbe3){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3d2fac,_0xbcbe3);_0x553ea8(_0xbcbe3);});});}exports['CreateSquareRecording']=function(_0x2fca07){var _0x128c14=this;return new Promise(function(_0x5b1748,_0x5449fb){return db[_0x74a5('0x16')][_0x74a5('0x17')](_0x2fca07[_0x74a5('0x18')],{'raw':_0x2fca07[_0x74a5('0x19')]?_0x2fca07[_0x74a5('0x19')][_0x74a5('0x1a')]===undefined?!![]:![]:!![]})[_0x74a5('0x1b')](function(_0x47b1e4){logger[_0x74a5('0xb')](_0x74a5('0x1c'),_0x2fca07);logger[_0x74a5('0xe')](_0x74a5('0x1c'),_0x2fca07,JSON[_0x74a5('0x10')](_0x47b1e4));_0x5b1748(_0x47b1e4);})[_0x74a5('0x15')](function(_0x1e1647){logger[_0x74a5('0x11')](_0x74a5('0x1c'),_0x1e1647[_0x74a5('0x13')],_0x2fca07);_0x5449fb(_0x128c14[_0x74a5('0x11')](0x1f4,_0x1e1647['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 628e1e8..6724897 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 _0x80a3=['/describe','isAuthenticated','describe','show','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x4d0870,_0x5ec61f){var _0xfc3e6b=function(_0x893fdf){while(--_0x893fdf){_0x4d0870['push'](_0x4d0870['shift']());}};_0xfc3e6b(++_0x5ec61f);}(_0x80a3,0x172));var _0x380a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80a3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x380a('0x0'));var util=require(_0x380a('0x1'));var path=require(_0x380a('0x2'));var timeout=require(_0x380a('0x3'));var express=require(_0x380a('0x4'));var router=express['Router']();var auth=require(_0x380a('0x5'));var interaction=require(_0x380a('0x6'));var config=require(_0x380a('0x7'));var controller=require(_0x380a('0x8'));router[_0x380a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x380a('0x9')](_0x380a('0xa'),auth[_0x380a('0xb')](),controller[_0x380a('0xc')]);router['get']('/:id',auth[_0x380a('0xb')](),controller[_0x380a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x380a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x380a('0xf')]);router[_0x380a('0x10')](_0x380a('0x11'),auth[_0x380a('0xb')](),controller[_0x380a('0x12')]);module[_0x380a('0x13')]=router; \ No newline at end of file +var _0x2941=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareReport.controller','get','/describe','/:id','isAuthenticated','show','post','put','update'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x2941,0x159));var _0x1294=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x2941[_0x289e64];return _0x30246c;};'use strict';var multer=require('multer');var util=require(_0x1294('0x0'));var path=require(_0x1294('0x1'));var timeout=require(_0x1294('0x2'));var express=require(_0x1294('0x3'));var router=express['Router']();var auth=require(_0x1294('0x4'));var interaction=require(_0x1294('0x5'));var config=require('../../config/environment');var controller=require(_0x1294('0x6'));router[_0x1294('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1294('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x1294('0x7')](_0x1294('0x9'),auth[_0x1294('0xa')](),controller[_0x1294('0xb')]);router[_0x1294('0xc')]('/',auth[_0x1294('0xa')](),controller['create']);router[_0x1294('0xd')](_0x1294('0x9'),auth['isAuthenticated'](),controller[_0x1294('0xe')]);router[_0x1294('0xf')](_0x1294('0x9'),auth[_0x1294('0xa')](),controller[_0x1294('0x10')]);module[_0x1294('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fe2e31a..287603c 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 _0xcc34=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x6e16f9,_0x3f9046){var _0x1e3730=function(_0x23187a){while(--_0x23187a){_0x6e16f9['push'](_0x6e16f9['shift']());}};_0x1e3730(++_0x3f9046);}(_0xcc34,0x127));var _0x4cc3=function(_0x1c3e7c,_0x500f8a){_0x1c3e7c=_0x1c3e7c-0x0;var _0x186529=_0xcc34[_0x1c3e7c];return _0x186529;};'use strict';var Sequelize=require(_0x4cc3('0x0'));module['exports']={'network':{'type':Sequelize[_0x4cc3('0x1')]},'network_script':{'type':Sequelize[_0x4cc3('0x1')]},'request':{'type':Sequelize[_0x4cc3('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4cc3('0x1')]},'type':{'type':Sequelize[_0x4cc3('0x1')]},'uniqueid':{'type':Sequelize[_0x4cc3('0x1')]},'version':{'type':Sequelize[_0x4cc3('0x1')]},'callerid':{'type':Sequelize[_0x4cc3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x4cc3('0x1')]},'callingani2':{'type':Sequelize[_0x4cc3('0x1')]},'callington':{'type':Sequelize[_0x4cc3('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x4cc3('0x1')]},'rdnis':{'type':Sequelize[_0x4cc3('0x1')]},'context':{'type':Sequelize[_0x4cc3('0x1')]},'extension':{'type':Sequelize[_0x4cc3('0x1')]},'priority':{'type':Sequelize[_0x4cc3('0x1')]},'enhanced':{'type':Sequelize[_0x4cc3('0x1')]},'accountcode':{'type':Sequelize[_0x4cc3('0x1')]},'threadid':{'type':Sequelize[_0x4cc3('0x1')]},'project_name':{'type':Sequelize[_0x4cc3('0x1')]},'joinAt':{'type':Sequelize[_0x4cc3('0x2')]},'leaveAt':{'type':Sequelize[_0x4cc3('0x2')]},'bot':{'type':Sequelize[_0x4cc3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0fc2=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x55a34a,_0x1542cf){var _0x411aca=function(_0x2a322d){while(--_0x2a322d){_0x55a34a['push'](_0x55a34a['shift']());}};_0x411aca(++_0x1542cf);}(_0x0fc2,0xb8));var _0x20fc=function(_0x560d05,_0x597962){_0x560d05=_0x560d05-0x0;var _0x3b7d02=_0x0fc2[_0x560d05];return _0x3b7d02;};'use strict';var Sequelize=require(_0x20fc('0x0'));module[_0x20fc('0x1')]={'network':{'type':Sequelize[_0x20fc('0x2')]},'network_script':{'type':Sequelize[_0x20fc('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x20fc('0x2')]},'type':{'type':Sequelize[_0x20fc('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x20fc('0x2')]},'callerid':{'type':Sequelize[_0x20fc('0x2')]},'calleridname':{'type':Sequelize[_0x20fc('0x2')]},'callingpres':{'type':Sequelize[_0x20fc('0x2')]},'callingani2':{'type':Sequelize[_0x20fc('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x20fc('0x2')]},'dnid':{'type':Sequelize[_0x20fc('0x2')]},'rdnis':{'type':Sequelize[_0x20fc('0x2')]},'context':{'type':Sequelize[_0x20fc('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x20fc('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x20fc('0x2')]},'threadid':{'type':Sequelize[_0x20fc('0x2')]},'project_name':{'type':Sequelize[_0x20fc('0x2')]},'joinAt':{'type':Sequelize[_0x20fc('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x20fc('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a9091ff..52ab7f7 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 _0x1d65=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','SquareReport','fieldName','type','model','map','keys','query','filters','intersection','attributes'];(function(_0x330c5a,_0x53df10){var _0x7c6e5=function(_0xb31d34){while(--_0xb31d34){_0x330c5a['push'](_0x330c5a['shift']());}};_0x7c6e5(++_0x53df10);}(_0x1d65,0x19e));var _0x51d6=function(_0x442b31,_0x278d58){_0x442b31=_0x442b31-0x0;var _0x2c1151=_0x1d65[_0x442b31];return _0x2c1151;};'use strict';var pdf=require(_0x51d6('0x0'));var emlformat=require(_0x51d6('0x1'));var rimraf=require(_0x51d6('0x2'));var zipdir=require(_0x51d6('0x3'));var jsonpatch=require(_0x51d6('0x4'));var rp=require('request-promise');var moment=require(_0x51d6('0x5'));var BPromise=require(_0x51d6('0x6'));var Mustache=require(_0x51d6('0x7'));var util=require(_0x51d6('0x8'));var path=require(_0x51d6('0x9'));var sox=require(_0x51d6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x51d6('0xb'));var crypto=require(_0x51d6('0xc'));var jsforce=require(_0x51d6('0xd'));var deskjs=require(_0x51d6('0xe'));var toCsv=require(_0x51d6('0xf'));var querystring=require(_0x51d6('0x10'));var Papa=require(_0x51d6('0x11'));var Redis=require(_0x51d6('0x12'));var authService=require(_0x51d6('0x13'));var qs=require(_0x51d6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51d6('0x15'))(_0x51d6('0x16'));var utils=require(_0x51d6('0x17'));var config=require(_0x51d6('0x18'));var db=require(_0x51d6('0x19'))['db'];function respondWithStatusCode(_0x159f2b,_0x29481b){_0x29481b=_0x29481b||0xcc;return function(_0x4ff562){if(_0x4ff562){return _0x159f2b[_0x51d6('0x1a')](_0x29481b);}return _0x159f2b[_0x51d6('0x1b')](_0x29481b)[_0x51d6('0x1c')]();};}function respondWithResult(_0x27cb87,_0x5f5b0e){_0x5f5b0e=_0x5f5b0e||0xc8;return function(_0x12b849){if(_0x12b849){return _0x27cb87[_0x51d6('0x1b')](_0x5f5b0e)['json'](_0x12b849);}};}function respondWithFilteredResult(_0x4d03c7,_0x98133f){return function(_0xf7db13){if(_0xf7db13){var _0x1c8135=_0xf7db13['count'],_0x28f8e6=_0x98133f[_0x51d6('0x1d')],_0x37a0e5=_0x98133f[_0x51d6('0x1d')]+_0x98133f[_0x51d6('0x1e')],_0x2e6731;if(_0x37a0e5>=_0x1c8135){_0x37a0e5=_0x1c8135;_0x2e6731=0xc8;}else{_0x2e6731=0xce;}_0x4d03c7[_0x51d6('0x1b')](_0x2e6731);return _0x4d03c7[_0x51d6('0x1f')](_0x51d6('0x20'),_0x28f8e6+'-'+_0x37a0e5+'/'+_0x1c8135)[_0x51d6('0x21')](_0xf7db13);}return null;};}function patchUpdates(_0x255876){return function(_0xe32b07){try{jsonpatch[_0x51d6('0x22')](_0xe32b07,_0x255876,!![]);}catch(_0x4cc038){return BPromise[_0x51d6('0x23')](_0x4cc038);}return _0xe32b07[_0x51d6('0x24')]();};}function saveUpdates(_0x4811ba,_0x456bd1){return function(_0xf3f7cf){if(_0xf3f7cf){return _0xf3f7cf['update'](_0x4811ba)[_0x51d6('0x25')](function(_0x2a4501){return _0x2a4501;});}return null;};}function removeEntity(_0x3cd593,_0x444280){return function(_0x47371b){if(_0x47371b){return _0x47371b[_0x51d6('0x26')]()['then'](function(){_0x3cd593[_0x51d6('0x1b')](0xcc)[_0x51d6('0x1c')]();});}};}function handleEntityNotFound(_0x3455ae,_0x4a71a5){return function(_0x31de4d){if(!_0x31de4d){_0x3455ae[_0x51d6('0x1a')](0x194);}return _0x31de4d;};}function handleError(_0x13bde0,_0x212c11){_0x212c11=_0x212c11||0x1f4;return function(_0xd67964){logger[_0x51d6('0x27')](_0xd67964[_0x51d6('0x28')]);if(_0xd67964[_0x51d6('0x29')]){delete _0xd67964[_0x51d6('0x29')];}_0x13bde0[_0x51d6('0x1b')](_0x212c11)[_0x51d6('0x2a')](_0xd67964);};}exports[_0x51d6('0x2b')]=function(_0x58cfd5,_0xa98479){var _0x54cc94={},_0x3b0eca={},_0x111c08={'count':0x0,'rows':[]};var _0x53cf28=_['map'](db[_0x51d6('0x2c')]['rawAttributes'],function(_0x1c4176){return{'name':_0x1c4176[_0x51d6('0x2d')],'type':_0x1c4176[_0x51d6('0x2e')]['key']};});_0x3b0eca[_0x51d6('0x2f')]=_[_0x51d6('0x30')](_0x53cf28,_0x51d6('0x29'));_0x3b0eca['query']=_[_0x51d6('0x31')](_0x58cfd5[_0x51d6('0x32')]);_0x3b0eca[_0x51d6('0x33')]=_[_0x51d6('0x34')](_0x3b0eca['model'],_0x3b0eca['query']);_0x54cc94[_0x51d6('0x35')]=_[_0x51d6('0x34')](_0x3b0eca[_0x51d6('0x2f')],qs[_0x51d6('0x36')](_0x58cfd5[_0x51d6('0x32')]['fields']));_0x54cc94[_0x51d6('0x35')]=_0x54cc94['attributes'][_0x51d6('0x37')]?_0x54cc94[_0x51d6('0x35')]:_0x3b0eca['model'];if(!_0x58cfd5[_0x51d6('0x32')][_0x51d6('0x38')](_0x51d6('0x39'))){_0x54cc94['limit']=qs['limit'](_0x58cfd5[_0x51d6('0x32')][_0x51d6('0x1e')]);_0x54cc94[_0x51d6('0x1d')]=qs[_0x51d6('0x1d')](_0x58cfd5[_0x51d6('0x32')][_0x51d6('0x1d')]);}_0x54cc94[_0x51d6('0x3a')]=qs[_0x51d6('0x3b')](_0x58cfd5['query'][_0x51d6('0x3b')]);_0x54cc94[_0x51d6('0x3c')]=qs[_0x51d6('0x33')](_[_0x51d6('0x3d')](_0x58cfd5['query'],_0x3b0eca[_0x51d6('0x33')]),_0x53cf28);if(_0x58cfd5[_0x51d6('0x32')][_0x51d6('0x3e')]){_0x54cc94[_0x51d6('0x3c')]=_['merge'](_0x54cc94['where'],{'$or':_['map'](_0x53cf28,function(_0x335d78){if(_0x335d78[_0x51d6('0x2e')]!=='VIRTUAL'){var _0x3808ba={};_0x3808ba[_0x335d78[_0x51d6('0x29')]]={'$like':'%'+_0x58cfd5[_0x51d6('0x32')][_0x51d6('0x3e')]+'%'};return _0x3808ba;}})});}_0x54cc94=_[_0x51d6('0x3f')]({},_0x54cc94,_0x58cfd5[_0x51d6('0x40')]);var _0x19bcc8={'where':_0x54cc94['where']};return db[_0x51d6('0x2c')][_0x51d6('0x41')](_0x19bcc8)[_0x51d6('0x25')](function(_0x53da1f){_0x111c08['count']=_0x53da1f;if(_0x58cfd5[_0x51d6('0x32')][_0x51d6('0x42')]){_0x54cc94[_0x51d6('0x43')]=[{'all':!![]}];}return db[_0x51d6('0x2c')][_0x51d6('0x44')](_0x54cc94);})[_0x51d6('0x25')](function(_0x174a3b){_0x111c08['rows']=_0x174a3b;return _0x111c08;})[_0x51d6('0x25')](respondWithFilteredResult(_0xa98479,_0x54cc94))[_0x51d6('0x45')](handleError(_0xa98479,null));};exports[_0x51d6('0x46')]=function(_0x266a44,_0x5691ad){var _0x25b08a={'raw':!![],'where':{'id':_0x266a44[_0x51d6('0x47')]['id']}},_0x3aa6c9={};_0x3aa6c9[_0x51d6('0x2f')]=_[_0x51d6('0x31')](db[_0x51d6('0x2c')][_0x51d6('0x48')]);_0x3aa6c9[_0x51d6('0x32')]=_[_0x51d6('0x31')](_0x266a44[_0x51d6('0x32')]);_0x3aa6c9['filters']=_[_0x51d6('0x34')](_0x3aa6c9[_0x51d6('0x2f')],_0x3aa6c9[_0x51d6('0x32')]);_0x25b08a['attributes']=_[_0x51d6('0x34')](_0x3aa6c9['model'],qs[_0x51d6('0x36')](_0x266a44['query'][_0x51d6('0x36')]));_0x25b08a[_0x51d6('0x35')]=_0x25b08a[_0x51d6('0x35')][_0x51d6('0x37')]?_0x25b08a['attributes']:_0x3aa6c9[_0x51d6('0x2f')];if(_0x266a44[_0x51d6('0x32')][_0x51d6('0x42')]){_0x25b08a[_0x51d6('0x43')]=[{'all':!![]}];}_0x25b08a=_[_0x51d6('0x3f')]({},_0x25b08a,_0x266a44[_0x51d6('0x40')]);return db[_0x51d6('0x2c')][_0x51d6('0x49')](_0x25b08a)[_0x51d6('0x25')](handleEntityNotFound(_0x5691ad,null))['then'](respondWithResult(_0x5691ad,null))[_0x51d6('0x45')](handleError(_0x5691ad,null));};exports['create']=function(_0x1f2843,_0x2e34e0){return db[_0x51d6('0x2c')][_0x51d6('0x4a')](_0x1f2843[_0x51d6('0x4b')],{})[_0x51d6('0x25')](respondWithResult(_0x2e34e0,0xc9))[_0x51d6('0x45')](handleError(_0x2e34e0,null));};exports[_0x51d6('0x4c')]=function(_0x7774cc,_0x55c5f0){if(_0x7774cc[_0x51d6('0x4b')]['id']){delete _0x7774cc[_0x51d6('0x4b')]['id'];}return db[_0x51d6('0x2c')][_0x51d6('0x49')]({'where':{'id':_0x7774cc['params']['id']}})[_0x51d6('0x25')](handleEntityNotFound(_0x55c5f0,null))['then'](saveUpdates(_0x7774cc[_0x51d6('0x4b')],null))[_0x51d6('0x25')](respondWithResult(_0x55c5f0,null))[_0x51d6('0x45')](handleError(_0x55c5f0,null));};exports['destroy']=function(_0x5e5c8f,_0x47ba5f){return db[_0x51d6('0x2c')][_0x51d6('0x49')]({'where':{'id':_0x5e5c8f[_0x51d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x47ba5f,null))[_0x51d6('0x25')](removeEntity(_0x47ba5f,null))['catch'](handleError(_0x47ba5f,null));};exports[_0x51d6('0x4d')]=function(_0x20b006,_0x18db5d){return db[_0x51d6('0x2c')][_0x51d6('0x4d')]()[_0x51d6('0x25')](respondWithResult(_0x18db5d,null))['catch'](handleError(_0x18db5d,null));}; \ No newline at end of file +var _0x348c=['crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','intersection','length','options','find','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x139368,_0x317d88){var _0xd390a0=function(_0x570612){while(--_0x570612){_0x139368['push'](_0x139368['shift']());}};_0xd390a0(++_0x317d88);}(_0x348c,0x1dd));var _0xc348=function(_0x55f3ec,_0x34dda8){_0x55f3ec=_0x55f3ec-0x0;var _0x47ac94=_0x348c[_0x55f3ec];return _0x47ac94;};'use strict';var pdf=require(_0xc348('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc348('0x1'));var zipdir=require(_0xc348('0x2'));var jsonpatch=require(_0xc348('0x3'));var rp=require(_0xc348('0x4'));var moment=require(_0xc348('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc348('0x6'));var util=require(_0xc348('0x7'));var path=require(_0xc348('0x8'));var sox=require(_0xc348('0x9'));var csv=require(_0xc348('0xa'));var ejs=require(_0xc348('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc348('0xc'));var crypto=require(_0xc348('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc348('0xe'));var toCsv=require(_0xc348('0xa'));var querystring=require(_0xc348('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc348('0x10'));var as=require(_0xc348('0x11'));var hardwareService=require(_0xc348('0x12'));var logger=require(_0xc348('0x13'))('api');var utils=require(_0xc348('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c7eaa,_0x911387){_0x911387=_0x911387||0xcc;return function(_0x530717){if(_0x530717){return _0x5c7eaa[_0xc348('0x15')](_0x911387);}return _0x5c7eaa['status'](_0x911387)[_0xc348('0x16')]();};}function respondWithResult(_0x168ec6,_0x23df75){_0x23df75=_0x23df75||0xc8;return function(_0x587aba){if(_0x587aba){return _0x168ec6[_0xc348('0x17')](_0x23df75)[_0xc348('0x18')](_0x587aba);}};}function respondWithFilteredResult(_0x30c632,_0x2701a1){return function(_0x538b81){if(_0x538b81){var _0x362c8e=_0x538b81[_0xc348('0x19')],_0x2af6fa=_0x2701a1[_0xc348('0x1a')],_0x3d4a7e=_0x2701a1['offset']+_0x2701a1[_0xc348('0x1b')],_0x11392a;if(_0x3d4a7e>=_0x362c8e){_0x3d4a7e=_0x362c8e;_0x11392a=0xc8;}else{_0x11392a=0xce;}_0x30c632['status'](_0x11392a);return _0x30c632[_0xc348('0x1c')](_0xc348('0x1d'),_0x2af6fa+'-'+_0x3d4a7e+'/'+_0x362c8e)[_0xc348('0x18')](_0x538b81);}return null;};}function patchUpdates(_0x115135){return function(_0x5835de){try{jsonpatch['apply'](_0x5835de,_0x115135,!![]);}catch(_0x1f9a71){return BPromise[_0xc348('0x1e')](_0x1f9a71);}return _0x5835de[_0xc348('0x1f')]();};}function saveUpdates(_0x416485,_0x59a349){return function(_0x27a55e){if(_0x27a55e){return _0x27a55e[_0xc348('0x20')](_0x416485)['then'](function(_0x309748){return _0x309748;});}return null;};}function removeEntity(_0x3feb57,_0x33124c){return function(_0x2925bb){if(_0x2925bb){return _0x2925bb[_0xc348('0x21')]()[_0xc348('0x22')](function(){_0x3feb57[_0xc348('0x17')](0xcc)[_0xc348('0x16')]();});}};}function handleEntityNotFound(_0x50a264,_0x1fe68a){return function(_0x5bef89){if(!_0x5bef89){_0x50a264[_0xc348('0x15')](0x194);}return _0x5bef89;};}function handleError(_0x2657b3,_0x4fed04){_0x4fed04=_0x4fed04||0x1f4;return function(_0x32a92d){logger[_0xc348('0x23')](_0x32a92d['stack']);if(_0x32a92d['name']){delete _0x32a92d[_0xc348('0x24')];}_0x2657b3[_0xc348('0x17')](_0x4fed04)[_0xc348('0x25')](_0x32a92d);};}exports['index']=function(_0x9b0da6,_0x590089){var _0x5d8ea2={},_0x38e1fe={},_0x1f2dd6={'count':0x0,'rows':[]};var _0x4c7ccb=_[_0xc348('0x26')](db[_0xc348('0x27')][_0xc348('0x28')],function(_0x3b6cae){return{'name':_0x3b6cae[_0xc348('0x29')],'type':_0x3b6cae[_0xc348('0x2a')][_0xc348('0x2b')]};});_0x38e1fe['model']=_[_0xc348('0x26')](_0x4c7ccb,_0xc348('0x24'));_0x38e1fe['query']=_['keys'](_0x9b0da6[_0xc348('0x2c')]);_0x38e1fe[_0xc348('0x2d')]=_['intersection'](_0x38e1fe[_0xc348('0x2e')],_0x38e1fe[_0xc348('0x2c')]);_0x5d8ea2[_0xc348('0x2f')]=_['intersection'](_0x38e1fe[_0xc348('0x2e')],qs[_0xc348('0x30')](_0x9b0da6[_0xc348('0x2c')][_0xc348('0x30')]));_0x5d8ea2[_0xc348('0x2f')]=_0x5d8ea2[_0xc348('0x2f')]['length']?_0x5d8ea2[_0xc348('0x2f')]:_0x38e1fe[_0xc348('0x2e')];if(!_0x9b0da6['query']['hasOwnProperty'](_0xc348('0x31'))){_0x5d8ea2[_0xc348('0x1b')]=qs[_0xc348('0x1b')](_0x9b0da6['query'][_0xc348('0x1b')]);_0x5d8ea2[_0xc348('0x1a')]=qs[_0xc348('0x1a')](_0x9b0da6[_0xc348('0x2c')]['offset']);}_0x5d8ea2[_0xc348('0x32')]=qs[_0xc348('0x33')](_0x9b0da6['query'][_0xc348('0x33')]);_0x5d8ea2['where']=qs['filters'](_[_0xc348('0x34')](_0x9b0da6[_0xc348('0x2c')],_0x38e1fe[_0xc348('0x2d')]),_0x4c7ccb);if(_0x9b0da6['query'][_0xc348('0x35')]){_0x5d8ea2[_0xc348('0x36')]=_[_0xc348('0x37')](_0x5d8ea2[_0xc348('0x36')],{'$or':_[_0xc348('0x26')](_0x4c7ccb,function(_0x213e67){if(_0x213e67['type']!==_0xc348('0x38')){var _0x267f0a={};_0x267f0a[_0x213e67[_0xc348('0x24')]]={'$like':'%'+_0x9b0da6[_0xc348('0x2c')][_0xc348('0x35')]+'%'};return _0x267f0a;}})});}_0x5d8ea2=_[_0xc348('0x37')]({},_0x5d8ea2,_0x9b0da6['options']);var _0x577f4e={'where':_0x5d8ea2['where']};return db[_0xc348('0x27')][_0xc348('0x19')](_0x577f4e)[_0xc348('0x22')](function(_0x345014){_0x1f2dd6[_0xc348('0x19')]=_0x345014;if(_0x9b0da6[_0xc348('0x2c')][_0xc348('0x39')]){_0x5d8ea2[_0xc348('0x3a')]=[{'all':!![]}];}return db[_0xc348('0x27')][_0xc348('0x3b')](_0x5d8ea2);})[_0xc348('0x22')](function(_0x1f1589){_0x1f2dd6['rows']=_0x1f1589;return _0x1f2dd6;})['then'](respondWithFilteredResult(_0x590089,_0x5d8ea2))[_0xc348('0x3c')](handleError(_0x590089,null));};exports[_0xc348('0x3d')]=function(_0x2f2c84,_0x55695b){var _0x247350={'raw':!![],'where':{'id':_0x2f2c84[_0xc348('0x3e')]['id']}},_0x273e5b={};_0x273e5b[_0xc348('0x2e')]=_[_0xc348('0x3f')](db[_0xc348('0x27')][_0xc348('0x28')]);_0x273e5b['query']=_[_0xc348('0x3f')](_0x2f2c84['query']);_0x273e5b[_0xc348('0x2d')]=_[_0xc348('0x40')](_0x273e5b[_0xc348('0x2e')],_0x273e5b[_0xc348('0x2c')]);_0x247350[_0xc348('0x2f')]=_['intersection'](_0x273e5b[_0xc348('0x2e')],qs['fields'](_0x2f2c84[_0xc348('0x2c')][_0xc348('0x30')]));_0x247350['attributes']=_0x247350['attributes'][_0xc348('0x41')]?_0x247350[_0xc348('0x2f')]:_0x273e5b[_0xc348('0x2e')];if(_0x2f2c84[_0xc348('0x2c')]['includeAll']){_0x247350[_0xc348('0x3a')]=[{'all':!![]}];}_0x247350=_['merge']({},_0x247350,_0x2f2c84[_0xc348('0x42')]);return db[_0xc348('0x27')][_0xc348('0x43')](_0x247350)[_0xc348('0x22')](handleEntityNotFound(_0x55695b,null))['then'](respondWithResult(_0x55695b,null))[_0xc348('0x3c')](handleError(_0x55695b,null));};exports['create']=function(_0x46668b,_0x381db2){return db[_0xc348('0x27')]['create'](_0x46668b[_0xc348('0x44')],{})[_0xc348('0x22')](respondWithResult(_0x381db2,0xc9))[_0xc348('0x3c')](handleError(_0x381db2,null));};exports[_0xc348('0x20')]=function(_0x44ffee,_0x5473e9){if(_0x44ffee[_0xc348('0x44')]['id']){delete _0x44ffee[_0xc348('0x44')]['id'];}return db[_0xc348('0x27')][_0xc348('0x43')]({'where':{'id':_0x44ffee[_0xc348('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5473e9,null))[_0xc348('0x22')](saveUpdates(_0x44ffee[_0xc348('0x44')],null))['then'](respondWithResult(_0x5473e9,null))[_0xc348('0x3c')](handleError(_0x5473e9,null));};exports[_0xc348('0x21')]=function(_0x164558,_0xc07d3e){return db[_0xc348('0x27')][_0xc348('0x43')]({'where':{'id':_0x164558['params']['id']}})[_0xc348('0x22')](handleEntityNotFound(_0xc07d3e,null))['then'](removeEntity(_0xc07d3e,null))[_0xc348('0x3c')](handleError(_0xc07d3e,null));};exports[_0xc348('0x45')]=function(_0x526151,_0x568939){return db['SquareReport']['describe']()[_0xc348('0x22')](respondWithResult(_0x568939,null))[_0xc348('0x3c')](handleError(_0x568939,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c575996..8569a10 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 _0xe523=['exports','define','SquareReport','report_square','uid_pname','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x18f6cb,_0x1ee225){var _0x293e92=function(_0x1b5882){while(--_0x1b5882){_0x18f6cb['push'](_0x18f6cb['shift']());}};_0x293e92(++_0x1ee225);}(_0xe523,0x92));var _0x3e52=function(_0x20d9f4,_0x4a50c9){_0x20d9f4=_0x20d9f4-0x0;var _0x308465=_0xe523[_0x20d9f4];return _0x308465;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e52('0x0'))(_0x3e52('0x1'));var moment=require('moment');var BPromise=require(_0x3e52('0x2'));var rp=require(_0x3e52('0x3'));var fs=require('fs');var path=require(_0x3e52('0x4'));var rimraf=require(_0x3e52('0x5'));var config=require(_0x3e52('0x6'));var attributes=require(_0x3e52('0x7'));module[_0x3e52('0x8')]=function(_0x1a80f0,_0x362d41){return _0x1a80f0[_0x3e52('0x9')](_0x3e52('0xa'),attributes,{'tableName':_0x3e52('0xb'),'paranoid':![],'indexes':[{'name':_0x3e52('0xc'),'fields':[_0x3e52('0xd'),'project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x02a8=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x348251,_0x1409d2){var _0x536ca3=function(_0x9e9212){while(--_0x9e9212){_0x348251['push'](_0x348251['shift']());}};_0x536ca3(++_0x1409d2);}(_0x02a8,0x12a));var _0x802a=function(_0x3b4bf6,_0x3d2f99){_0x3b4bf6=_0x3b4bf6-0x0;var _0x30b82e=_0x02a8[_0x3b4bf6];return _0x30b82e;};'use strict';var _=require(_0x802a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x802a('0x1'));var moment=require(_0x802a('0x2'));var BPromise=require(_0x802a('0x3'));var rp=require(_0x802a('0x4'));var fs=require('fs');var path=require(_0x802a('0x5'));var rimraf=require(_0x802a('0x6'));var config=require(_0x802a('0x7'));var attributes=require(_0x802a('0x8'));module[_0x802a('0x9')]=function(_0x4c326f,_0x5f38b4){return _0x4c326f[_0x802a('0xa')](_0x802a('0xb'),attributes,{'tableName':_0x802a('0xc'),'paranoid':![],'indexes':[{'name':_0x802a('0xd'),'fields':[_0x802a('0xe'),_0x802a('0xf')]},{'name':_0x802a('0x10'),'fields':[_0x802a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d0b1dca..44af712 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 _0xa624=['CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa624,0xb0));var _0x4a62=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xa624[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0x4a62('0x0'));var util=require(_0x4a62('0x1'));var moment=require(_0x4a62('0x2'));var BPromise=require(_0x4a62('0x3'));var rs=require(_0x4a62('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a62('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a62('0x6'))(_0x4a62('0x7'));var config=require(_0x4a62('0x8'));var jayson=require(_0x4a62('0x9'));var client=jayson[_0x4a62('0xa')][_0x4a62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3079ee,_0x4f54f7,_0x131c5a){return new BPromise(function(_0x24d86e,_0x4eaef0){return client['request'](_0x3079ee,_0x131c5a)[_0x4a62('0xc')](function(_0x197323){logger['info'](_0x4a62('0xd'),_0x4f54f7,_0x4a62('0xe'));logger[_0x4a62('0xf')](_0x4a62('0x10'),_0x4f54f7,_0x4a62('0xe'),JSON[_0x4a62('0x11')](_0x197323));if(_0x197323[_0x4a62('0x12')]){if(_0x197323[_0x4a62('0x12')]['code']===0x1f4){logger[_0x4a62('0x12')](_0x4a62('0xd'),_0x4f54f7,_0x197323[_0x4a62('0x12')][_0x4a62('0x13')]);return _0x4eaef0(_0x197323['error'][_0x4a62('0x13')]);}logger[_0x4a62('0x12')](_0x4a62('0xd'),_0x4f54f7,_0x197323[_0x4a62('0x12')][_0x4a62('0x13')]);return _0x24d86e(_0x197323[_0x4a62('0x12')][_0x4a62('0x13')]);}else{logger[_0x4a62('0x14')](_0x4a62('0xd'),_0x4f54f7,_0x4a62('0xe'));_0x24d86e(_0x197323['result'][_0x4a62('0x13')]);}})[_0x4a62('0x15')](function(_0xe2a55b){logger['error'](_0x4a62('0xd'),_0x4f54f7,_0xe2a55b);_0x4eaef0(_0xe2a55b);});});}exports[_0x4a62('0x16')]=function(_0x560ebc){var _0x266126=this;return new Promise(function(_0x58ce59,_0x451818){return db['SquareReport'][_0x4a62('0x17')](_0x560ebc[_0x4a62('0x18')],{'raw':_0x560ebc[_0x4a62('0x19')]?_0x560ebc[_0x4a62('0x19')][_0x4a62('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x438112){logger['info'](_0x4a62('0x16'),_0x560ebc);logger['debug']('CreateSquareReport',_0x560ebc,JSON[_0x4a62('0x11')](_0x438112));_0x58ce59(_0x438112);})[_0x4a62('0x15')](function(_0x411153){logger[_0x4a62('0x12')](_0x4a62('0x16'),_0x411153['message'],_0x560ebc);_0x451818(_0x266126[_0x4a62('0x12')](0x1f4,_0x411153[_0x4a62('0x13')]));});});};exports[_0x4a62('0x1b')]=function(_0x554c71){var _0x5bb1e5=this;return new Promise(function(_0x4235a9,_0x4af9c1){return db[_0x4a62('0x1c')][_0x4a62('0x1d')](_0x554c71[_0x4a62('0x18')],{'raw':_0x554c71[_0x4a62('0x19')]?_0x554c71[_0x4a62('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x554c71['options']?_0x554c71[_0x4a62('0x19')][_0x4a62('0x1e')]||null:null,'attributes':_0x554c71[_0x4a62('0x19')]?_0x554c71[_0x4a62('0x19')][_0x4a62('0x1f')]||null:null,'limit':_0x554c71[_0x4a62('0x19')]?_0x554c71['options'][_0x4a62('0x20')]||null:null})[_0x4a62('0xc')](function(_0x352c08){logger[_0x4a62('0x14')](_0x4a62('0x1b'),_0x554c71);logger[_0x4a62('0xf')](_0x4a62('0x1b'),_0x554c71,JSON[_0x4a62('0x11')](_0x352c08));_0x4235a9(_0x352c08);})[_0x4a62('0x15')](function(_0x38eb3e){logger['error']('UpdateSquareReport',_0x38eb3e[_0x4a62('0x13')],_0x554c71);_0x4af9c1(_0x5bb1e5['error'](0x1f4,_0x38eb3e[_0x4a62('0x13')]));});});}; \ No newline at end of file +var _0x1a08=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','update','where','limit','then','UpdateSquareReport','lodash','util','moment'];(function(_0x4a7696,_0x5ea553){var _0x5c4a52=function(_0x433e1d){while(--_0x433e1d){_0x4a7696['push'](_0x4a7696['shift']());}};_0x5c4a52(++_0x5ea553);}(_0x1a08,0x15d));var _0x81a0=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x1a08[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0x81a0('0x0'));var util=require(_0x81a0('0x1'));var moment=require(_0x81a0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81a0('0x3'))['db'];var utils=require(_0x81a0('0x4'));var logger=require(_0x81a0('0x5'))(_0x81a0('0x6'));var config=require('../../config/environment');var jayson=require(_0x81a0('0x7'));var client=jayson[_0x81a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1412d3,_0x221707,_0x59d4ce){return new BPromise(function(_0x30ee68,_0x55dfcf){return client[_0x81a0('0x9')](_0x1412d3,_0x59d4ce)['then'](function(_0x60cf4b){logger[_0x81a0('0xa')](_0x81a0('0xb'),_0x221707,'request\x20sent');logger[_0x81a0('0xc')](_0x81a0('0xd'),_0x221707,_0x81a0('0xe'),JSON[_0x81a0('0xf')](_0x60cf4b));if(_0x60cf4b['error']){if(_0x60cf4b[_0x81a0('0x10')][_0x81a0('0x11')]===0x1f4){logger[_0x81a0('0x10')]('SquareReport,\x20%s,\x20%s',_0x221707,_0x60cf4b[_0x81a0('0x10')][_0x81a0('0x12')]);return _0x55dfcf(_0x60cf4b[_0x81a0('0x10')][_0x81a0('0x12')]);}logger[_0x81a0('0x10')]('SquareReport,\x20%s,\x20%s',_0x221707,_0x60cf4b['error'][_0x81a0('0x12')]);return _0x30ee68(_0x60cf4b[_0x81a0('0x10')]['message']);}else{logger[_0x81a0('0xa')](_0x81a0('0xb'),_0x221707,_0x81a0('0xe'));_0x30ee68(_0x60cf4b[_0x81a0('0x13')][_0x81a0('0x12')]);}})['catch'](function(_0x5a140c){logger['error'](_0x81a0('0xb'),_0x221707,_0x5a140c);_0x55dfcf(_0x5a140c);});});}exports[_0x81a0('0x14')]=function(_0x2b4ce3){var _0x4411f4=this;return new Promise(function(_0x246697,_0x292017){return db[_0x81a0('0x15')][_0x81a0('0x16')](_0x2b4ce3[_0x81a0('0x17')],{'raw':_0x2b4ce3[_0x81a0('0x18')]?_0x2b4ce3[_0x81a0('0x18')][_0x81a0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3b45ee){logger['info'](_0x81a0('0x14'),_0x2b4ce3);logger[_0x81a0('0xc')]('CreateSquareReport',_0x2b4ce3,JSON['stringify'](_0x3b45ee));_0x246697(_0x3b45ee);})[_0x81a0('0x1a')](function(_0x441ac5){logger['error'](_0x81a0('0x14'),_0x441ac5[_0x81a0('0x12')],_0x2b4ce3);_0x292017(_0x4411f4[_0x81a0('0x10')](0x1f4,_0x441ac5[_0x81a0('0x12')]));});});};exports['UpdateSquareReport']=function(_0x7a2b1){var _0x3acbaa=this;return new Promise(function(_0x53c5a7,_0x1460cf){return db[_0x81a0('0x15')][_0x81a0('0x1b')](_0x7a2b1[_0x81a0('0x17')],{'raw':_0x7a2b1[_0x81a0('0x18')]?_0x7a2b1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a2b1[_0x81a0('0x18')]?_0x7a2b1[_0x81a0('0x18')][_0x81a0('0x1c')]||null:null,'attributes':_0x7a2b1[_0x81a0('0x18')]?_0x7a2b1[_0x81a0('0x18')]['attributes']||null:null,'limit':_0x7a2b1[_0x81a0('0x18')]?_0x7a2b1[_0x81a0('0x18')][_0x81a0('0x1d')]||null:null})[_0x81a0('0x1e')](function(_0x4da342){logger[_0x81a0('0xa')]('UpdateSquareReport',_0x7a2b1);logger[_0x81a0('0xc')](_0x81a0('0x1f'),_0x7a2b1,JSON[_0x81a0('0xf')](_0x4da342));_0x53c5a7(_0x4da342);})[_0x81a0('0x1a')](function(_0x58342c){logger[_0x81a0('0x10')](_0x81a0('0x1f'),_0x58342c[_0x81a0('0x12')],_0x7a2b1);_0x1460cf(_0x3acbaa[_0x81a0('0x10')](0x1f4,_0x58342c[_0x81a0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 20e32b5..48a28d8 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x2860e2,_0x3df8b3){var _0xd27571=function(_0x4c2c34){while(--_0x4c2c34){_0x2860e2['push'](_0x2860e2['shift']());}};_0xd27571(++_0x3df8b3);}(_0x7a54,0x106));var _0x47a5=function(_0x2f1bd5,_0x58c0bf){_0x2f1bd5=_0x2f1bd5-0x0;var _0x2e6bcc=_0x7a54[_0x2f1bd5];return _0x2e6bcc;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x47a37b,_0x4e4312){var _0x2073cf=function(_0x11fa8d){while(--_0x11fa8d){_0x47a37b['push'](_0x47a37b['shift']());}};_0x2073cf(++_0x4e4312);}(_0x5f2f,0x73));var _0xf5f2=function(_0x396587,_0x231d16){_0x396587=_0x396587-0x0;var _0x3cab9d=_0x5f2f[_0x396587];return _0x3cab9d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 68b3e0a..a9a9606 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 _0xf9b9=['STRING','TEXT','sequelize'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xf9b9,0x1a3));var _0x9f9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9b9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9f9b('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x9f9b('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x9f9b('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9f9b('0x1')]}}; \ No newline at end of file +var _0x314e=['sequelize','exports','STRING'];(function(_0x208ac5,_0x3a847a){var _0x10f651=function(_0x2dfb4e){while(--_0x2dfb4e){_0x208ac5['push'](_0x208ac5['shift']());}};_0x10f651(++_0x3a847a);}(_0x314e,0xf9));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe314('0x0'));module[_0xe314('0x1')]={'uniqueid':{'type':Sequelize[_0xe314('0x2')]},'node':{'type':Sequelize[_0xe314('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xe314('0x2')]},'callerid':{'type':Sequelize[_0xe314('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4d6098f..55bbe72 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 _0x8b89=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','error','stack','name','send','map','SquareDetailsReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','keys','rawAttributes','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b89,0x107));var _0x98b8=function(_0x5e6a94,_0x126298){_0x5e6a94=_0x5e6a94-0x0;var _0x3304c6=_0x8b89[_0x5e6a94];return _0x3304c6;};'use strict';var pdf=require(_0x98b8('0x0'));var emlformat=require(_0x98b8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x98b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b8('0x3'));var moment=require(_0x98b8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98b8('0x5'));var path=require('path');var sox=require(_0x98b8('0x6'));var csv=require(_0x98b8('0x7'));var ejs=require(_0x98b8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x98b8('0x9'));var jsforce=require(_0x98b8('0xa'));var deskjs=require(_0x98b8('0xb'));var toCsv=require(_0x98b8('0x7'));var querystring=require(_0x98b8('0xc'));var Papa=require(_0x98b8('0xd'));var Redis=require(_0x98b8('0xe'));var authService=require(_0x98b8('0xf'));var qs=require(_0x98b8('0x10'));var as=require(_0x98b8('0x11'));var hardwareService=require(_0x98b8('0x12'));var logger=require(_0x98b8('0x13'))(_0x98b8('0x14'));var utils=require(_0x98b8('0x15'));var config=require('../../config/environment');var db=require(_0x98b8('0x16'))['db'];function respondWithStatusCode(_0x5d85f7,_0x3dd456){_0x3dd456=_0x3dd456||0xcc;return function(_0x367a52){if(_0x367a52){return _0x5d85f7[_0x98b8('0x17')](_0x3dd456);}return _0x5d85f7[_0x98b8('0x18')](_0x3dd456)['end']();};}function respondWithResult(_0xddf327,_0x3f24d3){_0x3f24d3=_0x3f24d3||0xc8;return function(_0x40047f){if(_0x40047f){return _0xddf327['status'](_0x3f24d3)[_0x98b8('0x19')](_0x40047f);}};}function respondWithFilteredResult(_0x525f07,_0x4fa35c){return function(_0x34b1d3){if(_0x34b1d3){var _0x163d62=_0x34b1d3[_0x98b8('0x1a')],_0x3b6399=_0x4fa35c['offset'],_0x325a91=_0x4fa35c[_0x98b8('0x1b')]+_0x4fa35c[_0x98b8('0x1c')],_0x57c518;if(_0x325a91>=_0x163d62){_0x325a91=_0x163d62;_0x57c518=0xc8;}else{_0x57c518=0xce;}_0x525f07[_0x98b8('0x18')](_0x57c518);return _0x525f07[_0x98b8('0x1d')]('Content-Range',_0x3b6399+'-'+_0x325a91+'/'+_0x163d62)[_0x98b8('0x19')](_0x34b1d3);}return null;};}function patchUpdates(_0xd8db10){return function(_0x340565){try{jsonpatch[_0x98b8('0x1e')](_0x340565,_0xd8db10,!![]);}catch(_0x302993){return BPromise[_0x98b8('0x1f')](_0x302993);}return _0x340565['save']();};}function saveUpdates(_0x59ac27,_0x2ecec0){return function(_0x4079e0){if(_0x4079e0){return _0x4079e0[_0x98b8('0x20')](_0x59ac27)[_0x98b8('0x21')](function(_0x3b544d){return _0x3b544d;});}return null;};}function removeEntity(_0x409825,_0x4787bb){return function(_0x137b76){if(_0x137b76){return _0x137b76['destroy']()['then'](function(){_0x409825[_0x98b8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cfd0,_0xbde2ef){return function(_0x59c020){if(!_0x59c020){_0x38cfd0[_0x98b8('0x17')](0x194);}return _0x59c020;};}function handleError(_0x570021,_0xb566f7){_0xb566f7=_0xb566f7||0x1f4;return function(_0x5854e2){logger[_0x98b8('0x22')](_0x5854e2[_0x98b8('0x23')]);if(_0x5854e2[_0x98b8('0x24')]){delete _0x5854e2[_0x98b8('0x24')];}_0x570021[_0x98b8('0x18')](_0xb566f7)[_0x98b8('0x25')](_0x5854e2);};}exports['index']=function(_0x1f65d7,_0xa8d0c8){var _0x5091b7={},_0x1fd662={},_0x46013e={'count':0x0,'rows':[]};var _0x1f9a4d=_[_0x98b8('0x26')](db[_0x98b8('0x27')]['rawAttributes'],function(_0x4ac783){return{'name':_0x4ac783[_0x98b8('0x28')],'type':_0x4ac783[_0x98b8('0x29')][_0x98b8('0x2a')]};});_0x1fd662[_0x98b8('0x2b')]=_[_0x98b8('0x26')](_0x1f9a4d,_0x98b8('0x24'));_0x1fd662[_0x98b8('0x2c')]=_['keys'](_0x1f65d7[_0x98b8('0x2c')]);_0x1fd662[_0x98b8('0x2d')]=_[_0x98b8('0x2e')](_0x1fd662[_0x98b8('0x2b')],_0x1fd662['query']);_0x5091b7['attributes']=_['intersection'](_0x1fd662[_0x98b8('0x2b')],qs[_0x98b8('0x2f')](_0x1f65d7['query'][_0x98b8('0x2f')]));_0x5091b7[_0x98b8('0x30')]=_0x5091b7['attributes'][_0x98b8('0x31')]?_0x5091b7[_0x98b8('0x30')]:_0x1fd662[_0x98b8('0x2b')];if(!_0x1f65d7['query'][_0x98b8('0x32')](_0x98b8('0x33'))){_0x5091b7[_0x98b8('0x1c')]=qs[_0x98b8('0x1c')](_0x1f65d7[_0x98b8('0x2c')]['limit']);_0x5091b7[_0x98b8('0x1b')]=qs[_0x98b8('0x1b')](_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x1b')]);}_0x5091b7[_0x98b8('0x34')]=qs[_0x98b8('0x35')](_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x35')]);_0x5091b7[_0x98b8('0x36')]=qs[_0x98b8('0x2d')](_['pick'](_0x1f65d7[_0x98b8('0x2c')],_0x1fd662[_0x98b8('0x2d')]),_0x1f9a4d);if(_0x1f65d7['query'][_0x98b8('0x37')]){_0x5091b7[_0x98b8('0x36')]=_['merge'](_0x5091b7[_0x98b8('0x36')],{'$or':_[_0x98b8('0x26')](_0x1f9a4d,function(_0x526871){if(_0x526871[_0x98b8('0x29')]!=='VIRTUAL'){var _0x3fb98e={};_0x3fb98e[_0x526871[_0x98b8('0x24')]]={'$like':'%'+_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x37')]+'%'};return _0x3fb98e;}})});}_0x5091b7=_[_0x98b8('0x38')]({},_0x5091b7,_0x1f65d7[_0x98b8('0x39')]);var _0x5c4545={'where':_0x5091b7['where']};return db[_0x98b8('0x27')]['count'](_0x5c4545)[_0x98b8('0x21')](function(_0x1980c4){_0x46013e[_0x98b8('0x1a')]=_0x1980c4;if(_0x1f65d7[_0x98b8('0x2c')][_0x98b8('0x3a')]){_0x5091b7[_0x98b8('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5091b7);})[_0x98b8('0x21')](function(_0x1293e){_0x46013e['rows']=_0x1293e;return _0x46013e;})[_0x98b8('0x21')](respondWithFilteredResult(_0xa8d0c8,_0x5091b7))[_0x98b8('0x3c')](handleError(_0xa8d0c8,null));};exports[_0x98b8('0x3d')]=function(_0x414f92,_0x14735c){var _0x560910={'raw':!![],'where':{'id':_0x414f92[_0x98b8('0x3e')]['id']}},_0x227edf={};_0x227edf['model']=_[_0x98b8('0x3f')](db[_0x98b8('0x27')][_0x98b8('0x40')]);_0x227edf[_0x98b8('0x2c')]=_[_0x98b8('0x3f')](_0x414f92[_0x98b8('0x2c')]);_0x227edf['filters']=_[_0x98b8('0x2e')](_0x227edf[_0x98b8('0x2b')],_0x227edf['query']);_0x560910[_0x98b8('0x30')]=_[_0x98b8('0x2e')](_0x227edf[_0x98b8('0x2b')],qs[_0x98b8('0x2f')](_0x414f92[_0x98b8('0x2c')][_0x98b8('0x2f')]));_0x560910[_0x98b8('0x30')]=_0x560910[_0x98b8('0x30')][_0x98b8('0x31')]?_0x560910[_0x98b8('0x30')]:_0x227edf['model'];if(_0x414f92[_0x98b8('0x2c')][_0x98b8('0x3a')]){_0x560910[_0x98b8('0x3b')]=[{'all':!![]}];}_0x560910=_[_0x98b8('0x38')]({},_0x560910,_0x414f92[_0x98b8('0x39')]);return db['SquareDetailsReport'][_0x98b8('0x41')](_0x560910)['then'](handleEntityNotFound(_0x14735c,null))[_0x98b8('0x21')](respondWithResult(_0x14735c,null))['catch'](handleError(_0x14735c,null));};exports[_0x98b8('0x42')]=function(_0x560837,_0x41678c){return db[_0x98b8('0x27')][_0x98b8('0x42')](_0x560837[_0x98b8('0x43')],{})[_0x98b8('0x21')](respondWithResult(_0x41678c,0xc9))['catch'](handleError(_0x41678c,null));};exports[_0x98b8('0x20')]=function(_0x48de65,_0x422dc7){if(_0x48de65['body']['id']){delete _0x48de65[_0x98b8('0x43')]['id'];}return db[_0x98b8('0x27')][_0x98b8('0x41')]({'where':{'id':_0x48de65[_0x98b8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x422dc7,null))[_0x98b8('0x21')](saveUpdates(_0x48de65['body'],null))['then'](respondWithResult(_0x422dc7,null))[_0x98b8('0x3c')](handleError(_0x422dc7,null));};exports[_0x98b8('0x44')]=function(_0x417bd4,_0x545bab){return db[_0x98b8('0x27')]['find']({'where':{'id':_0x417bd4[_0x98b8('0x3e')]['id']}})[_0x98b8('0x21')](handleEntityNotFound(_0x545bab,null))[_0x98b8('0x21')](removeEntity(_0x545bab,null))[_0x98b8('0x3c')](handleError(_0x545bab,null));};exports['describe']=function(_0xa7c422,_0x363a91){return db[_0x98b8('0x27')]['describe']()[_0x98b8('0x21')](respondWithResult(_0x363a91,null))[_0x98b8('0x3c')](handleError(_0x363a91,null));}; \ No newline at end of file +var _0x39c4=['nolimit','order','sort','where','VIRTUAL','merge','options','SquareDetailsReport','count','includeAll','findAll','catch','show','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','Content-Range','json','apply','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x271143,_0x11ee2c){var _0x5e1327=function(_0x386f46){while(--_0x386f46){_0x271143['push'](_0x271143['shift']());}};_0x5e1327(++_0x11ee2c);}(_0x39c4,0xf2));var _0x439c=function(_0x24b250,_0x48f9aa){_0x24b250=_0x24b250-0x0;var _0x8813af=_0x39c4[_0x24b250];return _0x8813af;};'use strict';var pdf=require(_0x439c('0x0'));var emlformat=require(_0x439c('0x1'));var rimraf=require(_0x439c('0x2'));var zipdir=require(_0x439c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x439c('0x4'));var moment=require(_0x439c('0x5'));var BPromise=require(_0x439c('0x6'));var Mustache=require(_0x439c('0x7'));var util=require(_0x439c('0x8'));var path=require(_0x439c('0x9'));var sox=require(_0x439c('0xa'));var csv=require(_0x439c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x439c('0xc'));var squel=require(_0x439c('0xd'));var crypto=require(_0x439c('0xe'));var jsforce=require(_0x439c('0xf'));var deskjs=require(_0x439c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x439c('0x11'));var Papa=require(_0x439c('0x12'));var Redis=require(_0x439c('0x13'));var authService=require(_0x439c('0x14'));var qs=require(_0x439c('0x15'));var as=require(_0x439c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x439c('0x17'))('api');var utils=require(_0x439c('0x18'));var config=require(_0x439c('0x19'));var db=require(_0x439c('0x1a'))['db'];function respondWithStatusCode(_0x5a1b0e,_0x2f2dac){_0x2f2dac=_0x2f2dac||0xcc;return function(_0x4b700b){if(_0x4b700b){return _0x5a1b0e[_0x439c('0x1b')](_0x2f2dac);}return _0x5a1b0e[_0x439c('0x1c')](_0x2f2dac)['end']();};}function respondWithResult(_0x10bf2c,_0x2a9f8b){_0x2a9f8b=_0x2a9f8b||0xc8;return function(_0x39820f){if(_0x39820f){return _0x10bf2c[_0x439c('0x1c')](_0x2a9f8b)['json'](_0x39820f);}};}function respondWithFilteredResult(_0x86b00f,_0x194dfa){return function(_0x1a44a9){if(_0x1a44a9){var _0xe4a5b8=_0x1a44a9['count'],_0x53346d=_0x194dfa[_0x439c('0x1d')],_0x573114=_0x194dfa[_0x439c('0x1d')]+_0x194dfa[_0x439c('0x1e')],_0x3dede1;if(_0x573114>=_0xe4a5b8){_0x573114=_0xe4a5b8;_0x3dede1=0xc8;}else{_0x3dede1=0xce;}_0x86b00f[_0x439c('0x1c')](_0x3dede1);return _0x86b00f['set'](_0x439c('0x1f'),_0x53346d+'-'+_0x573114+'/'+_0xe4a5b8)[_0x439c('0x20')](_0x1a44a9);}return null;};}function patchUpdates(_0xb479a5){return function(_0x1ae96e){try{jsonpatch[_0x439c('0x21')](_0x1ae96e,_0xb479a5,!![]);}catch(_0x149f90){return BPromise['reject'](_0x149f90);}return _0x1ae96e[_0x439c('0x22')]();};}function saveUpdates(_0x515cc8,_0x5cced3){return function(_0x41512b){if(_0x41512b){return _0x41512b[_0x439c('0x23')](_0x515cc8)[_0x439c('0x24')](function(_0x1bf4cf){return _0x1bf4cf;});}return null;};}function removeEntity(_0x2aacbf,_0x144d64){return function(_0x3cd86d){if(_0x3cd86d){return _0x3cd86d[_0x439c('0x25')]()[_0x439c('0x24')](function(){_0x2aacbf[_0x439c('0x1c')](0xcc)[_0x439c('0x26')]();});}};}function handleEntityNotFound(_0x352b3b,_0x7f98a7){return function(_0x36e2c5){if(!_0x36e2c5){_0x352b3b[_0x439c('0x1b')](0x194);}return _0x36e2c5;};}function handleError(_0x59ec4e,_0x55b68e){_0x55b68e=_0x55b68e||0x1f4;return function(_0x51e1d9){logger[_0x439c('0x27')](_0x51e1d9['stack']);if(_0x51e1d9['name']){delete _0x51e1d9[_0x439c('0x28')];}_0x59ec4e[_0x439c('0x1c')](_0x55b68e)[_0x439c('0x29')](_0x51e1d9);};}exports[_0x439c('0x2a')]=function(_0x36f4b7,_0x3ca648){var _0x36aa57={},_0x1d1ffc={},_0xb58fde={'count':0x0,'rows':[]};var _0x5efcf6=_[_0x439c('0x2b')](db['SquareDetailsReport'][_0x439c('0x2c')],function(_0x2c26b5){return{'name':_0x2c26b5[_0x439c('0x2d')],'type':_0x2c26b5[_0x439c('0x2e')]['key']};});_0x1d1ffc[_0x439c('0x2f')]=_[_0x439c('0x2b')](_0x5efcf6,'name');_0x1d1ffc[_0x439c('0x30')]=_[_0x439c('0x31')](_0x36f4b7[_0x439c('0x30')]);_0x1d1ffc[_0x439c('0x32')]=_[_0x439c('0x33')](_0x1d1ffc[_0x439c('0x2f')],_0x1d1ffc[_0x439c('0x30')]);_0x36aa57[_0x439c('0x34')]=_[_0x439c('0x33')](_0x1d1ffc[_0x439c('0x2f')],qs['fields'](_0x36f4b7[_0x439c('0x30')][_0x439c('0x35')]));_0x36aa57[_0x439c('0x34')]=_0x36aa57['attributes']['length']?_0x36aa57[_0x439c('0x34')]:_0x1d1ffc[_0x439c('0x2f')];if(!_0x36f4b7[_0x439c('0x30')]['hasOwnProperty'](_0x439c('0x36'))){_0x36aa57[_0x439c('0x1e')]=qs[_0x439c('0x1e')](_0x36f4b7[_0x439c('0x30')]['limit']);_0x36aa57[_0x439c('0x1d')]=qs[_0x439c('0x1d')](_0x36f4b7[_0x439c('0x30')][_0x439c('0x1d')]);}_0x36aa57[_0x439c('0x37')]=qs[_0x439c('0x38')](_0x36f4b7['query'][_0x439c('0x38')]);_0x36aa57['where']=qs[_0x439c('0x32')](_['pick'](_0x36f4b7[_0x439c('0x30')],_0x1d1ffc['filters']),_0x5efcf6);if(_0x36f4b7['query']['filter']){_0x36aa57[_0x439c('0x39')]=_['merge'](_0x36aa57[_0x439c('0x39')],{'$or':_[_0x439c('0x2b')](_0x5efcf6,function(_0x5a477f){if(_0x5a477f[_0x439c('0x2e')]!==_0x439c('0x3a')){var _0x97018e={};_0x97018e[_0x5a477f[_0x439c('0x28')]]={'$like':'%'+_0x36f4b7[_0x439c('0x30')]['filter']+'%'};return _0x97018e;}})});}_0x36aa57=_[_0x439c('0x3b')]({},_0x36aa57,_0x36f4b7[_0x439c('0x3c')]);var _0x298667={'where':_0x36aa57['where']};return db[_0x439c('0x3d')]['count'](_0x298667)[_0x439c('0x24')](function(_0x1d6bc5){_0xb58fde[_0x439c('0x3e')]=_0x1d6bc5;if(_0x36f4b7[_0x439c('0x30')][_0x439c('0x3f')]){_0x36aa57['include']=[{'all':!![]}];}return db[_0x439c('0x3d')][_0x439c('0x40')](_0x36aa57);})[_0x439c('0x24')](function(_0x245bf6){_0xb58fde['rows']=_0x245bf6;return _0xb58fde;})[_0x439c('0x24')](respondWithFilteredResult(_0x3ca648,_0x36aa57))[_0x439c('0x41')](handleError(_0x3ca648,null));};exports[_0x439c('0x42')]=function(_0x5bdae8,_0x86e974){var _0x4b3a55={'raw':!![],'where':{'id':_0x5bdae8['params']['id']}},_0x492dfb={};_0x492dfb['model']=_[_0x439c('0x31')](db[_0x439c('0x3d')][_0x439c('0x2c')]);_0x492dfb[_0x439c('0x30')]=_[_0x439c('0x31')](_0x5bdae8[_0x439c('0x30')]);_0x492dfb[_0x439c('0x32')]=_[_0x439c('0x33')](_0x492dfb[_0x439c('0x2f')],_0x492dfb['query']);_0x4b3a55['attributes']=_[_0x439c('0x33')](_0x492dfb[_0x439c('0x2f')],qs[_0x439c('0x35')](_0x5bdae8[_0x439c('0x30')]['fields']));_0x4b3a55[_0x439c('0x34')]=_0x4b3a55[_0x439c('0x34')][_0x439c('0x43')]?_0x4b3a55[_0x439c('0x34')]:_0x492dfb[_0x439c('0x2f')];if(_0x5bdae8[_0x439c('0x30')][_0x439c('0x3f')]){_0x4b3a55[_0x439c('0x44')]=[{'all':!![]}];}_0x4b3a55=_[_0x439c('0x3b')]({},_0x4b3a55,_0x5bdae8[_0x439c('0x3c')]);return db['SquareDetailsReport'][_0x439c('0x45')](_0x4b3a55)['then'](handleEntityNotFound(_0x86e974,null))[_0x439c('0x24')](respondWithResult(_0x86e974,null))[_0x439c('0x41')](handleError(_0x86e974,null));};exports['create']=function(_0x501ab8,_0x57c69b){return db[_0x439c('0x3d')][_0x439c('0x46')](_0x501ab8[_0x439c('0x47')],{})[_0x439c('0x24')](respondWithResult(_0x57c69b,0xc9))[_0x439c('0x41')](handleError(_0x57c69b,null));};exports[_0x439c('0x23')]=function(_0x5b1b85,_0x2b285d){if(_0x5b1b85[_0x439c('0x47')]['id']){delete _0x5b1b85[_0x439c('0x47')]['id'];}return db[_0x439c('0x3d')][_0x439c('0x45')]({'where':{'id':_0x5b1b85[_0x439c('0x48')]['id']}})[_0x439c('0x24')](handleEntityNotFound(_0x2b285d,null))['then'](saveUpdates(_0x5b1b85['body'],null))[_0x439c('0x24')](respondWithResult(_0x2b285d,null))[_0x439c('0x41')](handleError(_0x2b285d,null));};exports['destroy']=function(_0x3f62fc,_0x9111e4){return db[_0x439c('0x3d')][_0x439c('0x45')]({'where':{'id':_0x3f62fc['params']['id']}})[_0x439c('0x24')](handleEntityNotFound(_0x9111e4,null))[_0x439c('0x24')](removeEntity(_0x9111e4,null))[_0x439c('0x41')](handleError(_0x9111e4,null));};exports[_0x439c('0x49')]=function(_0x14bd47,_0x143f77){return db['SquareDetailsReport'][_0x439c('0x49')]()[_0x439c('0x24')](respondWithResult(_0x143f77,null))['catch'](handleError(_0x143f77,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 9637685..131fa52 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 _0x553d=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0x553d,0x1a2));var _0xd553=function(_0x2ff8e8,_0x15b50a){_0x2ff8e8=_0x2ff8e8-0x0;var _0x16212b=_0x553d[_0x2ff8e8];return _0x16212b;};'use strict';var _=require(_0xd553('0x0'));var util=require(_0xd553('0x1'));var logger=require('../../config/logger')(_0xd553('0x2'));var moment=require(_0xd553('0x3'));var BPromise=require('bluebird');var rp=require(_0xd553('0x4'));var fs=require('fs');var path=require(_0xd553('0x5'));var rimraf=require(_0xd553('0x6'));var config=require(_0xd553('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xd553('0x8')]=function(_0x225a95,_0x4a7b2c){return _0x225a95[_0xd553('0x9')](_0xd553('0xa'),attributes,{'tableName':_0xd553('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x714d=['exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x5f0a5a,_0x520961){var _0xa0788d=function(_0x143f36){while(--_0x143f36){_0x5f0a5a['push'](_0x5f0a5a['shift']());}};_0xa0788d(++_0x520961);}(_0x714d,0x7b));var _0xd714=function(_0x1152e0,_0x21eeb0){_0x1152e0=_0x1152e0-0x0;var _0x4af4ae=_0x714d[_0x1152e0];return _0x4af4ae;};'use strict';var _=require(_0xd714('0x0'));var util=require(_0xd714('0x1'));var logger=require(_0xd714('0x2'))(_0xd714('0x3'));var moment=require(_0xd714('0x4'));var BPromise=require('bluebird');var rp=require(_0xd714('0x5'));var fs=require('fs');var path=require(_0xd714('0x6'));var rimraf=require(_0xd714('0x7'));var config=require('../../config/environment');var attributes=require(_0xd714('0x8'));module[_0xd714('0x9')]=function(_0x22746c,_0x3bca29){return _0x22746c[_0xd714('0xa')](_0xd714('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 550c760..0bc018d 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 _0x3fc7=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x186abc,_0x5b4ee9){var _0x59697d=function(_0x35d2da){while(--_0x35d2da){_0x186abc['push'](_0x186abc['shift']());}};_0x59697d(++_0x5b4ee9);}(_0x3fc7,0x13b));var _0x73fc=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x3fc7[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0x73fc('0x0'));var util=require(_0x73fc('0x1'));var moment=require(_0x73fc('0x2'));var BPromise=require(_0x73fc('0x3'));var rs=require(_0x73fc('0x4'));var fs=require('fs');var Redis=require(_0x73fc('0x5'));var db=require(_0x73fc('0x6'))['db'];var utils=require(_0x73fc('0x7'));var logger=require(_0x73fc('0x8'))(_0x73fc('0x9'));var config=require(_0x73fc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x73fc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x878df9,_0x239290,_0x320119){return new BPromise(function(_0x1d65f9,_0x16f0e4){return client[_0x73fc('0xc')](_0x878df9,_0x320119)[_0x73fc('0xd')](function(_0x12ab0e){logger[_0x73fc('0xe')](_0x73fc('0xf'),_0x239290,'request\x20sent');logger[_0x73fc('0x10')](_0x73fc('0x11'),_0x239290,_0x73fc('0x12'),JSON[_0x73fc('0x13')](_0x12ab0e));if(_0x12ab0e['error']){if(_0x12ab0e['error']['code']===0x1f4){logger[_0x73fc('0x14')](_0x73fc('0xf'),_0x239290,_0x12ab0e[_0x73fc('0x14')][_0x73fc('0x15')]);return _0x16f0e4(_0x12ab0e[_0x73fc('0x14')][_0x73fc('0x15')]);}logger[_0x73fc('0x14')](_0x73fc('0xf'),_0x239290,_0x12ab0e['error'][_0x73fc('0x15')]);return _0x1d65f9(_0x12ab0e[_0x73fc('0x14')]['message']);}else{logger[_0x73fc('0xe')](_0x73fc('0xf'),_0x239290,_0x73fc('0x12'));_0x1d65f9(_0x12ab0e[_0x73fc('0x16')]['message']);}})[_0x73fc('0x17')](function(_0x4de2f7){logger[_0x73fc('0x14')](_0x73fc('0xf'),_0x239290,_0x4de2f7);_0x16f0e4(_0x4de2f7);});});}exports[_0x73fc('0x18')]=function(_0x1052ba){var _0x5474b6=this;return new Promise(function(_0x4ecfe9,_0x40d4aa){return db[_0x73fc('0x19')][_0x73fc('0x1a')](_0x1052ba['body'],{'raw':_0x1052ba[_0x73fc('0x1b')]?_0x1052ba['options']['raw']===undefined?!![]:![]:!![]})[_0x73fc('0xd')](function(_0x5951ed){logger[_0x73fc('0xe')]('CreateSquareDetailsReport',_0x1052ba);logger[_0x73fc('0x10')](_0x73fc('0x18'),_0x1052ba,JSON[_0x73fc('0x13')](_0x5951ed));_0x4ecfe9(_0x5951ed);})[_0x73fc('0x17')](function(_0x16eff6){logger[_0x73fc('0x14')](_0x73fc('0x18'),_0x16eff6[_0x73fc('0x15')],_0x1052ba);_0x40d4aa(_0x5474b6[_0x73fc('0x14')](0x1f4,_0x16eff6['message']));});});}; \ No newline at end of file +var _0x27b2=['request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','catch','SquareDetailsReport','create','body','options','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x76f08a,_0x15cfad){var _0x2e7ff0=function(_0x2df3ea){while(--_0x2df3ea){_0x76f08a['push'](_0x76f08a['shift']());}};_0x2e7ff0(++_0x15cfad);}(_0x27b2,0x10a));var _0x227b=function(_0x17b515,_0x179fa6){_0x17b515=_0x17b515-0x0;var _0x5d11f4=_0x27b2[_0x17b515];return _0x5d11f4;};'use strict';var _=require(_0x227b('0x0'));var util=require(_0x227b('0x1'));var moment=require(_0x227b('0x2'));var BPromise=require(_0x227b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x227b('0x4'));var db=require(_0x227b('0x5'))['db'];var utils=require(_0x227b('0x6'));var logger=require('../../config/logger')(_0x227b('0x7'));var config=require(_0x227b('0x8'));var jayson=require(_0x227b('0x9'));var client=jayson[_0x227b('0xa')][_0x227b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34c8fd,_0x571494,_0x5b8d4e){return new BPromise(function(_0x190d91,_0x3968e9){return client[_0x227b('0xc')](_0x34c8fd,_0x5b8d4e)['then'](function(_0xfcd1c1){logger[_0x227b('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x571494,_0x227b('0xe'));logger['debug'](_0x227b('0xf'),_0x571494,_0x227b('0xe'),JSON[_0x227b('0x10')](_0xfcd1c1));if(_0xfcd1c1[_0x227b('0x11')]){if(_0xfcd1c1[_0x227b('0x11')][_0x227b('0x12')]===0x1f4){logger[_0x227b('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x571494,_0xfcd1c1[_0x227b('0x11')][_0x227b('0x13')]);return _0x3968e9(_0xfcd1c1['error'][_0x227b('0x13')]);}logger[_0x227b('0x11')](_0x227b('0x14'),_0x571494,_0xfcd1c1[_0x227b('0x11')][_0x227b('0x13')]);return _0x190d91(_0xfcd1c1[_0x227b('0x11')]['message']);}else{logger[_0x227b('0xd')](_0x227b('0x14'),_0x571494,_0x227b('0xe'));_0x190d91(_0xfcd1c1['result'][_0x227b('0x13')]);}})[_0x227b('0x15')](function(_0x502923){logger[_0x227b('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x571494,_0x502923);_0x3968e9(_0x502923);});});}exports['CreateSquareDetailsReport']=function(_0x1fcb07){var _0x29e4a8=this;return new Promise(function(_0x56252a,_0x4a81be){return db[_0x227b('0x16')][_0x227b('0x17')](_0x1fcb07[_0x227b('0x18')],{'raw':_0x1fcb07['options']?_0x1fcb07[_0x227b('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x227b('0x1a')](function(_0x383d88){logger['info']('CreateSquareDetailsReport',_0x1fcb07);logger['debug'](_0x227b('0x1b'),_0x1fcb07,JSON[_0x227b('0x10')](_0x383d88));_0x56252a(_0x383d88);})[_0x227b('0x15')](function(_0x211924){logger[_0x227b('0x11')](_0x227b('0x1b'),_0x211924['message'],_0x1fcb07);_0x4a81be(_0x29e4a8['error'](0x1f4,_0x211924['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0f73eec..1b4c0de 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 _0xcbe8=['isAuthenticated','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','./system.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbe8,0x1e4));var _0x8cbe=function(_0x2451ac,_0x41eeaa){_0x2451ac=_0x2451ac-0x0;var _0x467038=_0xcbe8[_0x2451ac];return _0x467038;};'use strict';var express=require('express');var router=express[_0x8cbe('0x0')]();var auth=require(_0x8cbe('0x1'));var controller=require(_0x8cbe('0x2'));router[_0x8cbe('0x3')]('/',auth[_0x8cbe('0x4')](),controller['index']);router['get'](_0x8cbe('0x5'),auth[_0x8cbe('0x4')](),controller[_0x8cbe('0x6')]);module[_0x8cbe('0x7')]=router; \ No newline at end of file +var _0xbbcd=['exports','express','Router','../../components/auth/service','./system.controller','get','/process/:pid/kill','killProcess'];(function(_0x425f81,_0x2515ec){var _0x279e6b=function(_0x40267f){while(--_0x40267f){_0x425f81['push'](_0x425f81['shift']());}};_0x279e6b(++_0x2515ec);}(_0xbbcd,0xa1));var _0xdbbc=function(_0x1c7b36,_0x487647){_0x1c7b36=_0x1c7b36-0x0;var _0x520c56=_0xbbcd[_0x1c7b36];return _0x520c56;};'use strict';var express=require(_0xdbbc('0x0'));var router=express[_0xdbbc('0x1')]();var auth=require(_0xdbbc('0x2'));var controller=require(_0xdbbc('0x3'));router[_0xdbbc('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdbbc('0x4')](_0xdbbc('0x5'),auth['isAuthenticated'](),controller[_0xdbbc('0x6')]);module[_0xdbbc('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f1483ac..7fdd9e4 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 _0xc75a=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','then','json','catch','components/import/cm','format'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xc75a,0xeb));var _0xac75=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0xc75a[_0x43941d];return _0x27b82a;};'use strict';var info=require(_0xac75('0x0'));var exec=require(_0xac75('0x1'))[_0xac75('0x2')];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0xac75('0x3'));function handleError(_0x14bb37,_0x1a9dc6,_0x3c82ab){_0x1a9dc6=_0x1a9dc6||0x1f4;return function(_0x6f375c){logger[_0xac75('0x4')](_0xac75('0x5'),_0x3c82ab,_0x1a9dc6,util[_0xac75('0x6')](_0x6f375c,{'showHidden':![],'depth':null}));delete _0x6f375c[_0xac75('0x7')];_0x14bb37[_0xac75('0x8')](_0x1a9dc6)[_0xac75('0x9')](_0x6f375c);};}exports['index']=function(_0x331bd9,_0x3ffea4){return info['getAllData']()[_0xac75('0xa')](function(_0x29825d){return _0x3ffea4['status'](0xc8)[_0xac75('0xb')](_0x29825d);})[_0xac75('0xc')](function(_0x550d85){return _0x3ffea4['status'](0x1f4)[_0xac75('0xb')](_0x550d85);});};exports['killProcess']=function(_0x40b392,_0x2e242f){var _0x3165d5=[_0xac75('0xd')];return new BPromise(function(_0x43b53f,_0x181f2c){return exec(util[_0xac75('0xe')](_0xac75('0xf'),_0x40b392[_0xac75('0x10')][_0xac75('0x11')]),function(_0x5c7b18,_0x5ec2f9,_0x23505f){if(_0x5c7b18){return _0x181f2c(_0x5c7b18);}return _0x43b53f(_0x5ec2f9);});})[_0xac75('0xa')](function(_0x527b7e){var _0x566aef=![];var _0x53f714=_0x527b7e[_0xac75('0x12')](/\n/);for(var _0x2f6b10=0x0,_0x52562b=_0x3165d5[_0xac75('0x13')];_0x2f6b10<_0x52562b,_0x566aef===![];_0x2f6b10+=0x1){if(_0x527b7e[_0xac75('0x14')](_0x3165d5[_0x2f6b10])>=0x0){_0x566aef=!![];}}if(!_0x566aef){throw new Error(util[_0xac75('0xe')](_0xac75('0x15'),_0x40b392['params'][_0xac75('0x11')]));}process[_0xac75('0x16')](_0x40b392[_0xac75('0x10')]['pid'],_0xac75('0x17'));return _0x2e242f['status'](0xc8)['json']({'message':util[_0xac75('0xe')](_0xac75('0x18'),_0x40b392['params']['pid'])});})[_0xac75('0xc')](handleError(_0x2e242f,null,'killProcess'));}; \ No newline at end of file +var _0xaef0=['api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','then','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaef0,0x1c8));var _0x0aef=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0xaef0[_0xd0cd0b];return _0x59cced;};'use strict';var info=require(_0x0aef('0x0'));var exec=require('child_process')[_0x0aef('0x1')];var logger=require(_0x0aef('0x2'))(_0x0aef('0x3'));var util=require(_0x0aef('0x4'));var BPromise=require(_0x0aef('0x5'));var _=require(_0x0aef('0x6'));function handleError(_0xc80dea,_0x2ffc72,_0x5a4789){_0x2ffc72=_0x2ffc72||0x1f4;return function(_0x37f2d4){logger[_0x0aef('0x7')](_0x0aef('0x8'),_0x5a4789,_0x2ffc72,util['inspect'](_0x37f2d4,{'showHidden':![],'depth':null}));delete _0x37f2d4[_0x0aef('0x9')];_0xc80dea[_0x0aef('0xa')](_0x2ffc72)['send'](_0x37f2d4);};}exports[_0x0aef('0xb')]=function(_0x284dc8,_0x283784){return info['getAllData']()[_0x0aef('0xc')](function(_0x16c27e){return _0x283784[_0x0aef('0xa')](0xc8)[_0x0aef('0xd')](_0x16c27e);})[_0x0aef('0xe')](function(_0x3cdd63){return _0x283784[_0x0aef('0xa')](0x1f4)[_0x0aef('0xd')](_0x3cdd63);});};exports[_0x0aef('0xf')]=function(_0x3a0d0e,_0x571136){var _0x38c758=[_0x0aef('0x10')];return new BPromise(function(_0x1b5675,_0x5564f6){return exec(util['format'](_0x0aef('0x11'),_0x3a0d0e[_0x0aef('0x12')][_0x0aef('0x13')]),function(_0xf17c2,_0x41284d,_0x33ce07){if(_0xf17c2){return _0x5564f6(_0xf17c2);}return _0x1b5675(_0x41284d);});})[_0x0aef('0xc')](function(_0x182852){var _0x49b83c=![];var _0x4e259f=_0x182852[_0x0aef('0x14')](/\n/);for(var _0x45c800=0x0,_0x8420eb=_0x38c758[_0x0aef('0x15')];_0x45c800<_0x8420eb,_0x49b83c===![];_0x45c800+=0x1){if(_0x182852[_0x0aef('0x16')](_0x38c758[_0x45c800])>=0x0){_0x49b83c=!![];}}if(!_0x49b83c){throw new Error(util[_0x0aef('0x17')](_0x0aef('0x18'),_0x3a0d0e['params'][_0x0aef('0x13')]));}process['kill'](_0x3a0d0e[_0x0aef('0x12')][_0x0aef('0x13')],_0x0aef('0x19'));return _0x571136[_0x0aef('0xa')](0xc8)[_0x0aef('0xd')]({'message':util[_0x0aef('0x17')](_0x0aef('0x1a'),_0x3a0d0e[_0x0aef('0x12')][_0x0aef('0x13')])});})['catch'](handleError(_0x571136,null,_0x0aef('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7dca0be..65fe7d9 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 _0x6c76=['update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./tag.controller','isAuthenticated','index','/:id','post','create'];(function(_0x1ce595,_0x1069cb){var _0x525dfe=function(_0xeee00a){while(--_0xeee00a){_0x1ce595['push'](_0x1ce595['shift']());}};_0x525dfe(++_0x1069cb);}(_0x6c76,0x184));var _0x66c7=function(_0x42138b,_0x5bc44f){_0x42138b=_0x42138b-0x0;var _0x1f47e1=_0x6c76[_0x42138b];return _0x1f47e1;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66c7('0x5'));var controller=require(_0x66c7('0x6'));router['get']('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0x8')]);router['get'](_0x66c7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x66c7('0xa')]('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0xb')]);router['put'](_0x66c7('0x9'),auth[_0x66c7('0x7')](),controller[_0x66c7('0xc')]);router[_0x66c7('0xd')]('/:id',auth[_0x66c7('0x7')](),controller[_0x66c7('0xe')]);module[_0x66c7('0xf')]=router; \ No newline at end of file +var _0x5b02=['get','isAuthenticated','index','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./tag.controller'];(function(_0x3852df,_0x49c49e){var _0x51f764=function(_0x197e18){while(--_0x197e18){_0x3852df['push'](_0x3852df['shift']());}};_0x51f764(++_0x49c49e);}(_0x5b02,0xe9));var _0x25b0=function(_0x698025,_0x205115){_0x698025=_0x698025-0x0;var _0x400895=_0x5b02[_0x698025];return _0x400895;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x25b0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x25b0('0x5'));var controller=require(_0x25b0('0x6'));router[_0x25b0('0x7')]('/',auth[_0x25b0('0x8')](),controller[_0x25b0('0x9')]);router['get'](_0x25b0('0xa'),auth[_0x25b0('0x8')](),controller['show']);router[_0x25b0('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x25b0('0xc')](_0x25b0('0xa'),auth[_0x25b0('0x8')](),controller['update']);router[_0x25b0('0xd')](_0x25b0('0xa'),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);module[_0x25b0('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c519071..d958be7 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 _0xb688=['STRING','name','#0091EA','exports'];(function(_0x276e49,_0x49034f){var _0x406326=function(_0x3b4c71){while(--_0x3b4c71){_0x276e49['push'](_0x276e49['shift']());}};_0x406326(++_0x49034f);}(_0xb688,0xcf));var _0x8b68=function(_0x83be8d,_0x372e2d){_0x83be8d=_0x83be8d-0x0;var _0x33c534=_0xb688[_0x83be8d];return _0x33c534;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'unique':_0x8b68('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x3')},'description':{'type':Sequelize[_0x8b68('0x1')]}}; \ No newline at end of file +var _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x290612,_0x264e17){var _0x44aade=function(_0x3358d9){while(--_0x3358d9){_0x290612['push'](_0x290612['shift']());}};_0x44aade(++_0x264e17);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index cca7b4d..3e81f02 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 _0x4e73=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','body','user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','html-pdf','eml-format','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce'];(function(_0x8d6485,_0x5c051d){var _0x175717=function(_0x2cc209){while(--_0x2cc209){_0x8d6485['push'](_0x8d6485['shift']());}};_0x175717(++_0x5c051d);}(_0x4e73,0x18f));var _0x34e7=function(_0x2892b7,_0x26c16a){_0x2892b7=_0x2892b7-0x0;var _0x52806e=_0x4e73[_0x2892b7];return _0x52806e;};'use strict';var pdf=require(_0x34e7('0x0'));var emlformat=require(_0x34e7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x34e7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x34e7('0x3'));var util=require(_0x34e7('0x4'));var path=require(_0x34e7('0x5'));var sox=require(_0x34e7('0x6'));var csv=require(_0x34e7('0x7'));var ejs=require(_0x34e7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x34e7('0x9'));var jsforce=require(_0x34e7('0xa'));var deskjs=require(_0x34e7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x34e7('0xc'));var Papa=require(_0x34e7('0xd'));var Redis=require(_0x34e7('0xe'));var authService=require(_0x34e7('0xf'));var qs=require(_0x34e7('0x10'));var as=require(_0x34e7('0x11'));var hardwareService=require(_0x34e7('0x12'));var logger=require('../../config/logger')(_0x34e7('0x13'));var utils=require(_0x34e7('0x14'));var config=require(_0x34e7('0x15'));var db=require(_0x34e7('0x16'))['db'];function respondWithStatusCode(_0x467ead,_0x523622){_0x523622=_0x523622||0xcc;return function(_0x27c8cf){if(_0x27c8cf){return _0x467ead['sendStatus'](_0x523622);}return _0x467ead[_0x34e7('0x17')](_0x523622)['end']();};}function respondWithResult(_0x44bc2f,_0x23d3cf){_0x23d3cf=_0x23d3cf||0xc8;return function(_0x1e7ff0){if(_0x1e7ff0){return _0x44bc2f[_0x34e7('0x17')](_0x23d3cf)[_0x34e7('0x18')](_0x1e7ff0);}};}function respondWithFilteredResult(_0x129b1b,_0x21df5b){return function(_0x26a7ae){if(_0x26a7ae){var _0x1fe2ae=_0x26a7ae[_0x34e7('0x19')],_0x1c2cfd=_0x21df5b['offset'],_0x24f490=_0x21df5b[_0x34e7('0x1a')]+_0x21df5b[_0x34e7('0x1b')],_0x53361c;if(_0x24f490>=_0x1fe2ae){_0x24f490=_0x1fe2ae;_0x53361c=0xc8;}else{_0x53361c=0xce;}_0x129b1b[_0x34e7('0x17')](_0x53361c);return _0x129b1b[_0x34e7('0x1c')]('Content-Range',_0x1c2cfd+'-'+_0x24f490+'/'+_0x1fe2ae)['json'](_0x26a7ae);}return null;};}function patchUpdates(_0xd3ad95){return function(_0x1b8d9b){try{jsonpatch[_0x34e7('0x1d')](_0x1b8d9b,_0xd3ad95,!![]);}catch(_0x4aeb58){return BPromise[_0x34e7('0x1e')](_0x4aeb58);}return _0x1b8d9b[_0x34e7('0x1f')]();};}function saveUpdates(_0x248d73,_0x3d34ba){return function(_0x463985){if(_0x463985){return _0x463985[_0x34e7('0x20')](_0x248d73)[_0x34e7('0x21')](function(_0x21d816){return _0x21d816;});}return null;};}function removeEntity(_0x4f0d8d,_0x2bc85a){return function(_0x5ca2fe){if(_0x5ca2fe){return _0x5ca2fe[_0x34e7('0x22')]()[_0x34e7('0x21')](function(){var _0x1c5312=_0x5ca2fe[_0x34e7('0x23')]({'plain':!![]});var _0x4d39b5='Tags';return db[_0x34e7('0x24')]['destroy']({'where':{'type':_0x4d39b5,'resourceId':_0x1c5312['id']}})[_0x34e7('0x21')](function(){return _0x5ca2fe;});})[_0x34e7('0x21')](function(){_0x4f0d8d[_0x34e7('0x17')](0xcc)[_0x34e7('0x25')]();});}};}function handleEntityNotFound(_0x25e6e3,_0x3926f2){return function(_0x1c5270){if(!_0x1c5270){_0x25e6e3['sendStatus'](0x194);}return _0x1c5270;};}function handleError(_0x55cb55,_0x370356){_0x370356=_0x370356||0x1f4;return function(_0x7ff60a){logger[_0x34e7('0x26')](_0x7ff60a[_0x34e7('0x27')]);if(_0x7ff60a[_0x34e7('0x28')]){delete _0x7ff60a[_0x34e7('0x28')];}_0x55cb55[_0x34e7('0x17')](_0x370356)[_0x34e7('0x29')](_0x7ff60a);};}exports[_0x34e7('0x2a')]=function(_0x589ffe,_0x1c9b22){var _0x26957a={},_0x460f06={},_0x10d2fd={'count':0x0,'rows':[]};var _0x14c2d6=_[_0x34e7('0x2b')](db[_0x34e7('0x2c')]['rawAttributes'],function(_0x501f30){return{'name':_0x501f30[_0x34e7('0x2d')],'type':_0x501f30[_0x34e7('0x2e')][_0x34e7('0x2f')]};});_0x460f06[_0x34e7('0x30')]=_['map'](_0x14c2d6,_0x34e7('0x28'));_0x460f06[_0x34e7('0x31')]=_[_0x34e7('0x32')](_0x589ffe[_0x34e7('0x31')]);_0x460f06['filters']=_['intersection'](_0x460f06[_0x34e7('0x30')],_0x460f06[_0x34e7('0x31')]);_0x26957a[_0x34e7('0x33')]=_[_0x34e7('0x34')](_0x460f06[_0x34e7('0x30')],qs[_0x34e7('0x35')](_0x589ffe[_0x34e7('0x31')]['fields']));_0x26957a[_0x34e7('0x33')]=_0x26957a['attributes']['length']?_0x26957a[_0x34e7('0x33')]:_0x460f06[_0x34e7('0x30')];if(!_0x589ffe['query'][_0x34e7('0x36')](_0x34e7('0x37'))){_0x26957a[_0x34e7('0x1b')]=qs[_0x34e7('0x1b')](_0x589ffe[_0x34e7('0x31')]['limit']);_0x26957a[_0x34e7('0x1a')]=qs[_0x34e7('0x1a')](_0x589ffe['query'][_0x34e7('0x1a')]);}_0x26957a[_0x34e7('0x38')]=qs[_0x34e7('0x39')](_0x589ffe[_0x34e7('0x31')]['sort']);_0x26957a[_0x34e7('0x3a')]=qs[_0x34e7('0x3b')](_[_0x34e7('0x3c')](_0x589ffe[_0x34e7('0x31')],_0x460f06[_0x34e7('0x3b')]),_0x14c2d6);if(_0x589ffe['query'][_0x34e7('0x3d')]){_0x26957a[_0x34e7('0x3a')]=_['merge'](_0x26957a[_0x34e7('0x3a')],{'$or':_[_0x34e7('0x2b')](_0x14c2d6,function(_0x59b87d){if(_0x59b87d['type']!==_0x34e7('0x3e')){var _0x16787c={};_0x16787c[_0x59b87d[_0x34e7('0x28')]]={'$like':'%'+_0x589ffe[_0x34e7('0x31')][_0x34e7('0x3d')]+'%'};return _0x16787c;}})});}_0x26957a=_[_0x34e7('0x3f')]({},_0x26957a,_0x589ffe[_0x34e7('0x40')]);var _0x4395e2={'where':_0x26957a[_0x34e7('0x3a')]};return db[_0x34e7('0x2c')][_0x34e7('0x19')](_0x4395e2)[_0x34e7('0x21')](function(_0x3c542a){_0x10d2fd[_0x34e7('0x19')]=_0x3c542a;if(_0x589ffe[_0x34e7('0x31')][_0x34e7('0x41')]){_0x26957a[_0x34e7('0x42')]=[{'all':!![]}];}return db[_0x34e7('0x2c')][_0x34e7('0x43')](_0x26957a);})[_0x34e7('0x21')](function(_0x285d13){_0x10d2fd['rows']=_0x285d13;return _0x10d2fd;})['then'](respondWithFilteredResult(_0x1c9b22,_0x26957a))[_0x34e7('0x44')](handleError(_0x1c9b22,null));};exports[_0x34e7('0x45')]=function(_0x1c36c5,_0x5f3b15){var _0x178c19={'raw':!![],'where':{'id':_0x1c36c5[_0x34e7('0x46')]['id']}},_0x44de23={};_0x44de23['model']=_['keys'](db['Tag'][_0x34e7('0x47')]);_0x44de23[_0x34e7('0x31')]=_[_0x34e7('0x32')](_0x1c36c5[_0x34e7('0x31')]);_0x44de23[_0x34e7('0x3b')]=_['intersection'](_0x44de23['model'],_0x44de23['query']);_0x178c19[_0x34e7('0x33')]=_[_0x34e7('0x34')](_0x44de23[_0x34e7('0x30')],qs['fields'](_0x1c36c5[_0x34e7('0x31')][_0x34e7('0x35')]));_0x178c19['attributes']=_0x178c19[_0x34e7('0x33')][_0x34e7('0x48')]?_0x178c19[_0x34e7('0x33')]:_0x44de23[_0x34e7('0x30')];if(_0x1c36c5[_0x34e7('0x31')][_0x34e7('0x41')]){_0x178c19['include']=[{'all':!![]}];}_0x178c19=_[_0x34e7('0x3f')]({},_0x178c19,_0x1c36c5['options']);return db['Tag']['find'](_0x178c19)['then'](handleEntityNotFound(_0x5f3b15,null))[_0x34e7('0x21')](respondWithResult(_0x5f3b15,null))[_0x34e7('0x44')](handleError(_0x5f3b15,null));};exports['create']=function(_0x4776eb,_0x3bbff8){return db[_0x34e7('0x2c')][_0x34e7('0x49')](_0x4776eb[_0x34e7('0x4a')],{})[_0x34e7('0x21')](function(_0xb53715){var _0x213a32=_0x4776eb[_0x34e7('0x4b')][_0x34e7('0x23')]({'plain':!![]});if(!_0x213a32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x213a32[_0x34e7('0x4c')]===_0x34e7('0x4b')){var _0x1bb50d=_0xb53715[_0x34e7('0x23')]({'plain':!![]});var _0x20154f=_0x34e7('0x4d');return db[_0x34e7('0x4e')][_0x34e7('0x4f')]({'where':{'name':_0x20154f,'userProfileId':_0x213a32[_0x34e7('0x50')]},'raw':!![]})['then'](function(_0x10362a){if(_0x10362a&&_0x10362a[_0x34e7('0x51')]===0x0){return db[_0x34e7('0x24')][_0x34e7('0x49')]({'name':_0x1bb50d[_0x34e7('0x28')],'resourceId':_0x1bb50d['id'],'type':_0x10362a[_0x34e7('0x28')],'sectionId':_0x10362a['id']},{})['then'](function(){return _0xb53715;});}else{return _0xb53715;}})[_0x34e7('0x44')](function(_0x58271e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58271e);throw _0x58271e;});}return _0xb53715;})['then'](respondWithResult(_0x3bbff8,0xc9))[_0x34e7('0x44')](handleError(_0x3bbff8,null));};exports[_0x34e7('0x20')]=function(_0x4d7886,_0x2553ea){if(_0x4d7886[_0x34e7('0x4a')]['id']){delete _0x4d7886[_0x34e7('0x4a')]['id'];}return db['Tag'][_0x34e7('0x4f')]({'where':{'id':_0x4d7886[_0x34e7('0x46')]['id']}})[_0x34e7('0x21')](handleEntityNotFound(_0x2553ea,null))[_0x34e7('0x21')](saveUpdates(_0x4d7886[_0x34e7('0x4a')],null))[_0x34e7('0x21')](respondWithResult(_0x2553ea,null))[_0x34e7('0x44')](handleError(_0x2553ea,null));};exports['destroy']=function(_0x107803,_0x504686){return db[_0x34e7('0x2c')][_0x34e7('0x4f')]({'where':{'id':_0x107803[_0x34e7('0x46')]['id']}})['then'](handleEntityNotFound(_0x504686,null))[_0x34e7('0x21')](removeEntity(_0x504686,null))['catch'](handleError(_0x504686,null));}; \ No newline at end of file +var _0xac30=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x3dcd9c,_0x2f7831){var _0xa085cd=function(_0x4e7b18){while(--_0x4e7b18){_0x3dcd9c['push'](_0x3dcd9c['shift']());}};_0xa085cd(++_0x2f7831);}(_0xac30,0x98));var _0x0ac3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xac30[_0x413feb];return _0x40ee88;};'use strict';var pdf=require(_0x0ac3('0x0'));var emlformat=require(_0x0ac3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0ac3('0x2'));var jsonpatch=require(_0x0ac3('0x3'));var rp=require(_0x0ac3('0x4'));var moment=require(_0x0ac3('0x5'));var BPromise=require(_0x0ac3('0x6'));var Mustache=require(_0x0ac3('0x7'));var util=require(_0x0ac3('0x8'));var path=require(_0x0ac3('0x9'));var sox=require('sox');var csv=require(_0x0ac3('0xa'));var ejs=require(_0x0ac3('0xb'));var fs=require('fs');var _=require(_0x0ac3('0xc'));var squel=require(_0x0ac3('0xd'));var crypto=require('crypto');var jsforce=require(_0x0ac3('0xe'));var deskjs=require(_0x0ac3('0xf'));var toCsv=require(_0x0ac3('0xa'));var querystring=require(_0x0ac3('0x10'));var Papa=require(_0x0ac3('0x11'));var Redis=require(_0x0ac3('0x12'));var authService=require(_0x0ac3('0x13'));var qs=require(_0x0ac3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ac3('0x15'));var logger=require(_0x0ac3('0x16'))(_0x0ac3('0x17'));var utils=require(_0x0ac3('0x18'));var config=require(_0x0ac3('0x19'));var db=require(_0x0ac3('0x1a'))['db'];function respondWithStatusCode(_0x4f6b26,_0x17351a){_0x17351a=_0x17351a||0xcc;return function(_0x30d85e){if(_0x30d85e){return _0x4f6b26[_0x0ac3('0x1b')](_0x17351a);}return _0x4f6b26[_0x0ac3('0x1c')](_0x17351a)['end']();};}function respondWithResult(_0x9b06c0,_0x400ef7){_0x400ef7=_0x400ef7||0xc8;return function(_0x4b9960){if(_0x4b9960){return _0x9b06c0[_0x0ac3('0x1c')](_0x400ef7)[_0x0ac3('0x1d')](_0x4b9960);}};}function respondWithFilteredResult(_0x2cb701,_0x561726){return function(_0x10d6c1){if(_0x10d6c1){var _0x454b6d=_0x10d6c1[_0x0ac3('0x1e')],_0x4f2ae1=_0x561726[_0x0ac3('0x1f')],_0x2b3f87=_0x561726['offset']+_0x561726['limit'],_0x2a2480;if(_0x2b3f87>=_0x454b6d){_0x2b3f87=_0x454b6d;_0x2a2480=0xc8;}else{_0x2a2480=0xce;}_0x2cb701[_0x0ac3('0x1c')](_0x2a2480);return _0x2cb701['set']('Content-Range',_0x4f2ae1+'-'+_0x2b3f87+'/'+_0x454b6d)[_0x0ac3('0x1d')](_0x10d6c1);}return null;};}function patchUpdates(_0x5a0a03){return function(_0x4847a1){try{jsonpatch['apply'](_0x4847a1,_0x5a0a03,!![]);}catch(_0x2924a1){return BPromise[_0x0ac3('0x20')](_0x2924a1);}return _0x4847a1[_0x0ac3('0x21')]();};}function saveUpdates(_0x4cdddf,_0x4f5517){return function(_0x44ae36){if(_0x44ae36){return _0x44ae36[_0x0ac3('0x22')](_0x4cdddf)[_0x0ac3('0x23')](function(_0xa97061){return _0xa97061;});}return null;};}function removeEntity(_0x237695,_0x1c3210){return function(_0x261d1e){if(_0x261d1e){return _0x261d1e[_0x0ac3('0x24')]()['then'](function(){var _0x197118=_0x261d1e[_0x0ac3('0x25')]({'plain':!![]});var _0x48c49b=_0x0ac3('0x26');return db[_0x0ac3('0x27')][_0x0ac3('0x24')]({'where':{'type':_0x48c49b,'resourceId':_0x197118['id']}})[_0x0ac3('0x23')](function(){return _0x261d1e;});})[_0x0ac3('0x23')](function(){_0x237695['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fdfaf,_0x3b5c90){return function(_0x548d39){if(!_0x548d39){_0x3fdfaf[_0x0ac3('0x1b')](0x194);}return _0x548d39;};}function handleError(_0x2397d3,_0x3e6260){_0x3e6260=_0x3e6260||0x1f4;return function(_0x4bbb18){logger[_0x0ac3('0x28')](_0x4bbb18['stack']);if(_0x4bbb18[_0x0ac3('0x29')]){delete _0x4bbb18[_0x0ac3('0x29')];}_0x2397d3[_0x0ac3('0x1c')](_0x3e6260)[_0x0ac3('0x2a')](_0x4bbb18);};}exports[_0x0ac3('0x2b')]=function(_0x3b6143,_0xe0a0a2){var _0x39704d={},_0x3ce6cd={},_0x22abdd={'count':0x0,'rows':[]};var _0x4cd606=_[_0x0ac3('0x2c')](db[_0x0ac3('0x2d')][_0x0ac3('0x2e')],function(_0x362326){return{'name':_0x362326[_0x0ac3('0x2f')],'type':_0x362326[_0x0ac3('0x30')][_0x0ac3('0x31')]};});_0x3ce6cd[_0x0ac3('0x32')]=_[_0x0ac3('0x2c')](_0x4cd606,_0x0ac3('0x29'));_0x3ce6cd['query']=_[_0x0ac3('0x33')](_0x3b6143[_0x0ac3('0x34')]);_0x3ce6cd['filters']=_[_0x0ac3('0x35')](_0x3ce6cd[_0x0ac3('0x32')],_0x3ce6cd[_0x0ac3('0x34')]);_0x39704d[_0x0ac3('0x36')]=_[_0x0ac3('0x35')](_0x3ce6cd[_0x0ac3('0x32')],qs['fields'](_0x3b6143[_0x0ac3('0x34')]['fields']));_0x39704d[_0x0ac3('0x36')]=_0x39704d[_0x0ac3('0x36')][_0x0ac3('0x37')]?_0x39704d[_0x0ac3('0x36')]:_0x3ce6cd[_0x0ac3('0x32')];if(!_0x3b6143['query'][_0x0ac3('0x38')](_0x0ac3('0x39'))){_0x39704d[_0x0ac3('0x3a')]=qs[_0x0ac3('0x3a')](_0x3b6143[_0x0ac3('0x34')]['limit']);_0x39704d[_0x0ac3('0x1f')]=qs[_0x0ac3('0x1f')](_0x3b6143[_0x0ac3('0x34')][_0x0ac3('0x1f')]);}_0x39704d[_0x0ac3('0x3b')]=qs['sort'](_0x3b6143[_0x0ac3('0x34')][_0x0ac3('0x3c')]);_0x39704d[_0x0ac3('0x3d')]=qs[_0x0ac3('0x3e')](_[_0x0ac3('0x3f')](_0x3b6143[_0x0ac3('0x34')],_0x3ce6cd[_0x0ac3('0x3e')]),_0x4cd606);if(_0x3b6143[_0x0ac3('0x34')]['filter']){_0x39704d['where']=_[_0x0ac3('0x40')](_0x39704d[_0x0ac3('0x3d')],{'$or':_[_0x0ac3('0x2c')](_0x4cd606,function(_0x2aeb6e){if(_0x2aeb6e[_0x0ac3('0x30')]!=='VIRTUAL'){var _0x148d26={};_0x148d26[_0x2aeb6e[_0x0ac3('0x29')]]={'$like':'%'+_0x3b6143[_0x0ac3('0x34')]['filter']+'%'};return _0x148d26;}})});}_0x39704d=_[_0x0ac3('0x40')]({},_0x39704d,_0x3b6143[_0x0ac3('0x41')]);var _0x3808fe={'where':_0x39704d[_0x0ac3('0x3d')]};return db[_0x0ac3('0x2d')][_0x0ac3('0x1e')](_0x3808fe)['then'](function(_0x36697a){_0x22abdd['count']=_0x36697a;if(_0x3b6143[_0x0ac3('0x34')][_0x0ac3('0x42')]){_0x39704d[_0x0ac3('0x43')]=[{'all':!![]}];}return db['Tag'][_0x0ac3('0x44')](_0x39704d);})[_0x0ac3('0x23')](function(_0x1bb463){_0x22abdd[_0x0ac3('0x45')]=_0x1bb463;return _0x22abdd;})['then'](respondWithFilteredResult(_0xe0a0a2,_0x39704d))[_0x0ac3('0x46')](handleError(_0xe0a0a2,null));};exports[_0x0ac3('0x47')]=function(_0x2d3c54,_0x3c908b){var _0x243ca4={'raw':!![],'where':{'id':_0x2d3c54['params']['id']}},_0x287438={};_0x287438['model']=_[_0x0ac3('0x33')](db['Tag'][_0x0ac3('0x2e')]);_0x287438[_0x0ac3('0x34')]=_['keys'](_0x2d3c54[_0x0ac3('0x34')]);_0x287438[_0x0ac3('0x3e')]=_[_0x0ac3('0x35')](_0x287438['model'],_0x287438[_0x0ac3('0x34')]);_0x243ca4[_0x0ac3('0x36')]=_[_0x0ac3('0x35')](_0x287438['model'],qs[_0x0ac3('0x48')](_0x2d3c54['query'][_0x0ac3('0x48')]));_0x243ca4['attributes']=_0x243ca4[_0x0ac3('0x36')][_0x0ac3('0x37')]?_0x243ca4[_0x0ac3('0x36')]:_0x287438[_0x0ac3('0x32')];if(_0x2d3c54[_0x0ac3('0x34')]['includeAll']){_0x243ca4[_0x0ac3('0x43')]=[{'all':!![]}];}_0x243ca4=_[_0x0ac3('0x40')]({},_0x243ca4,_0x2d3c54[_0x0ac3('0x41')]);return db[_0x0ac3('0x2d')][_0x0ac3('0x49')](_0x243ca4)[_0x0ac3('0x23')](handleEntityNotFound(_0x3c908b,null))[_0x0ac3('0x23')](respondWithResult(_0x3c908b,null))[_0x0ac3('0x46')](handleError(_0x3c908b,null));};exports[_0x0ac3('0x4a')]=function(_0xbe5805,_0x27526c){return db[_0x0ac3('0x2d')]['create'](_0xbe5805[_0x0ac3('0x4b')],{})['then'](function(_0x534eb4){var _0x20e815=_0xbe5805[_0x0ac3('0x4c')][_0x0ac3('0x25')]({'plain':!![]});if(!_0x20e815)throw new Error(_0x0ac3('0x4d'));if(_0x20e815[_0x0ac3('0x4e')]==='user'){var _0x29e303=_0x534eb4[_0x0ac3('0x25')]({'plain':!![]});var _0x5715dc=_0x0ac3('0x26');return db[_0x0ac3('0x4f')][_0x0ac3('0x49')]({'where':{'name':_0x5715dc,'userProfileId':_0x20e815['userProfileId']},'raw':!![]})[_0x0ac3('0x23')](function(_0x4e3dd4){if(_0x4e3dd4&&_0x4e3dd4[_0x0ac3('0x50')]===0x0){return db[_0x0ac3('0x27')]['create']({'name':_0x29e303[_0x0ac3('0x29')],'resourceId':_0x29e303['id'],'type':_0x4e3dd4[_0x0ac3('0x29')],'sectionId':_0x4e3dd4['id']},{})[_0x0ac3('0x23')](function(){return _0x534eb4;});}else{return _0x534eb4;}})['catch'](function(_0x5d7bce){logger[_0x0ac3('0x28')](_0x0ac3('0x51'),_0x5d7bce);throw _0x5d7bce;});}return _0x534eb4;})[_0x0ac3('0x23')](respondWithResult(_0x27526c,0xc9))['catch'](handleError(_0x27526c,null));};exports['update']=function(_0x343a5e,_0x1e6311){if(_0x343a5e[_0x0ac3('0x4b')]['id']){delete _0x343a5e[_0x0ac3('0x4b')]['id'];}return db[_0x0ac3('0x2d')]['find']({'where':{'id':_0x343a5e[_0x0ac3('0x52')]['id']}})[_0x0ac3('0x23')](handleEntityNotFound(_0x1e6311,null))[_0x0ac3('0x23')](saveUpdates(_0x343a5e[_0x0ac3('0x4b')],null))[_0x0ac3('0x23')](respondWithResult(_0x1e6311,null))['catch'](handleError(_0x1e6311,null));};exports['destroy']=function(_0x1dd3df,_0x15faf8){return db[_0x0ac3('0x2d')][_0x0ac3('0x49')]({'where':{'id':_0x1dd3df['params']['id']}})[_0x0ac3('0x23')](handleEntityNotFound(_0x15faf8,null))[_0x0ac3('0x23')](removeEntity(_0x15faf8,null))['catch'](handleError(_0x15faf8,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9247b28..e4af0da 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 _0xa5c1=['bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger'];(function(_0x9b7a2e,_0x31f874){var _0x2e308f=function(_0x47a1d9){while(--_0x47a1d9){_0x9b7a2e['push'](_0x9b7a2e['shift']());}};_0x2e308f(++_0x31f874);}(_0xa5c1,0x19f));var _0x1a5c=function(_0xa82e01,_0x5c5ab3){_0xa82e01=_0xa82e01-0x0;var _0x57e601=_0xa5c1[_0xa82e01];return _0x57e601;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('Tag',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c53=['moment','bluebird','request-promise','path','./tag.attributes','define','Tag','lodash','util','../../config/logger'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7c53,0x1dd));var _0x37c5=function(_0xd93e9f,_0x54e7b5){_0xd93e9f=_0xd93e9f-0x0;var _0x15d78=_0x7c53[_0xd93e9f];return _0x15d78;};'use strict';var _=require(_0x37c5('0x0'));var util=require(_0x37c5('0x1'));var logger=require(_0x37c5('0x2'))('api');var moment=require(_0x37c5('0x3'));var BPromise=require(_0x37c5('0x4'));var rp=require(_0x37c5('0x5'));var fs=require('fs');var path=require(_0x37c5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x37c5('0x7'));module['exports']=function(_0x26e4ab,_0x29d61c){return _0x26e4ab[_0x37c5('0x8')](_0x37c5('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index af1ef16..6e50e38 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xea2757,_0x394521){var _0x3ed656=function(_0x46129f){while(--_0x46129f){_0xea2757['push'](_0xea2757['shift']());}};_0x3ed656(++_0x394521);}(_0xaa88,0x137));var _0x8aa8=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0xaa88[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('Tag,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('Tag,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('Tag,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0x3c81=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x250b1b,_0x21e6e9){var _0x1ccc00=function(_0x2ab7ad){while(--_0x2ab7ad){_0x250b1b['push'](_0x250b1b['shift']());}};_0x1ccc00(++_0x21e6e9);}(_0x3c81,0x102));var _0x13c8=function(_0xa58115,_0x16d1c6){_0xa58115=_0xa58115-0x0;var _0x21de50=_0x3c81[_0xa58115];return _0x21de50;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('Tag,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d4f88b8..d0757dc 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 _0x1e27=['Router','../../components/auth/service','../../config/environment','./team.controller','index','get','/:id','/:id/queues','isAuthenticated','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','update','delete','removeQueues','removeAgents','exports','multer','path','express'];(function(_0x342b37,_0x29726c){var _0x533c98=function(_0x59b85b){while(--_0x59b85b){_0x342b37['push'](_0x342b37['shift']());}};_0x533c98(++_0x29726c);}(_0x1e27,0x195));var _0x71e2=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x1e27[_0x1529a3];return _0x1a0d4b;};'use strict';var multer=require(_0x71e2('0x0'));var util=require('util');var path=require(_0x71e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x71e2('0x2'));var router=express[_0x71e2('0x3')]();var auth=require(_0x71e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x71e2('0x5'));var controller=require(_0x71e2('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x71e2('0x7')]);router[_0x71e2('0x8')](_0x71e2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x71e2('0x8')](_0x71e2('0xa'),auth[_0x71e2('0xb')](),controller[_0x71e2('0xc')]);router[_0x71e2('0x8')](_0x71e2('0xd'),auth[_0x71e2('0xb')](),controller[_0x71e2('0xe')]);router[_0x71e2('0xf')]('/',auth[_0x71e2('0xb')](),controller[_0x71e2('0x10')]);router[_0x71e2('0xf')](_0x71e2('0xa'),auth[_0x71e2('0xb')](),controller[_0x71e2('0x11')]);router['post'](_0x71e2('0xd'),auth[_0x71e2('0xb')](),controller[_0x71e2('0x12')]);router['put'](_0x71e2('0x9'),auth['isAuthenticated'](),controller[_0x71e2('0x13')]);router[_0x71e2('0x14')](_0x71e2('0x9'),auth[_0x71e2('0xb')](),controller['destroy']);router['delete']('/:id/queues',auth[_0x71e2('0xb')](),controller[_0x71e2('0x15')]);router[_0x71e2('0x14')](_0x71e2('0xd'),auth['isAuthenticated'](),controller[_0x71e2('0x16')]);module[_0x71e2('0x17')]=router; \ No newline at end of file +var _0x3b2c=['post','update','destroy','delete','removeQueues','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','/:id/users','getAgents','create'];(function(_0x19e966,_0x55d008){var _0x24e3d6=function(_0x4d2d7f){while(--_0x4d2d7f){_0x19e966['push'](_0x19e966['shift']());}};_0x24e3d6(++_0x55d008);}(_0x3b2c,0x127));var _0xc3b2=function(_0x3e7c04,_0x860d26){_0x3e7c04=_0x3e7c04-0x0;var _0x39994a=_0x3b2c[_0x3e7c04];return _0x39994a;};'use strict';var multer=require('multer');var util=require(_0xc3b2('0x0'));var path=require(_0xc3b2('0x1'));var timeout=require(_0xc3b2('0x2'));var express=require('express');var router=express[_0xc3b2('0x3')]();var auth=require(_0xc3b2('0x4'));var interaction=require(_0xc3b2('0x5'));var config=require(_0xc3b2('0x6'));var controller=require(_0xc3b2('0x7'));router[_0xc3b2('0x8')]('/',auth[_0xc3b2('0x9')](),controller[_0xc3b2('0xa')]);router[_0xc3b2('0x8')](_0xc3b2('0xb'),auth[_0xc3b2('0x9')](),controller[_0xc3b2('0xc')]);router[_0xc3b2('0x8')](_0xc3b2('0xd'),auth['isAuthenticated'](),controller['getQueues']);router[_0xc3b2('0x8')](_0xc3b2('0xe'),auth[_0xc3b2('0x9')](),controller[_0xc3b2('0xf')]);router['post']('/',auth[_0xc3b2('0x9')](),controller[_0xc3b2('0x10')]);router[_0xc3b2('0x11')]('/:id/queues',auth[_0xc3b2('0x9')](),controller['addQueues']);router['post'](_0xc3b2('0xe'),auth[_0xc3b2('0x9')](),controller['addAgents']);router['put'](_0xc3b2('0xb'),auth['isAuthenticated'](),controller[_0xc3b2('0x12')]);router['delete'](_0xc3b2('0xb'),auth[_0xc3b2('0x9')](),controller[_0xc3b2('0x13')]);router[_0xc3b2('0x14')]('/:id/queues',auth[_0xc3b2('0x9')](),controller[_0xc3b2('0x15')]);router['delete'](_0xc3b2('0xe'),auth['isAuthenticated'](),controller[_0xc3b2('0x16')]);module[_0xc3b2('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 52300b6..59b58e0 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 _0x4ae9=['exports','STRING','name','sequelize'];(function(_0x4772fb,_0x12782b){var _0x376db6=function(_0x477bdf){while(--_0x477bdf){_0x4772fb['push'](_0x4772fb['shift']());}};_0x376db6(++_0x12782b);}(_0x4ae9,0x1cf));var _0x94ae=function(_0x276ab9,_0x13fc29){_0x276ab9=_0x276ab9-0x0;var _0x58317d=_0x4ae9[_0x276ab9];return _0x58317d;};'use strict';var Sequelize=require(_0x94ae('0x0'));module[_0x94ae('0x1')]={'name':{'type':Sequelize[_0x94ae('0x2')],'allowNull':![],'unique':_0x94ae('0x3')},'description':{'type':Sequelize[_0x94ae('0x2')]}}; \ No newline at end of file +var _0xd121=['sequelize','STRING','name'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd121,0x6c));var _0x1d12=function(_0x485de2,_0x17190c){_0x485de2=_0x485de2-0x0;var _0x321eec=_0xd121[_0x485de2];return _0x321eec;};'use strict';var Sequelize=require(_0x1d12('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d12('0x1')],'allowNull':![],'unique':_0x1d12('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f9bd330..0879a16 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 _0x5c4e=['register','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','get','Teams','UserProfileResource','stack','name','send','index','Team','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','catch','show','rawAttributes','length','merge','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','error','params','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Queues','removeQueues','remove','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','each','Voice','findAll','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','ids','spread','emit','userTeam:save','removeAgents','mail','sms','fax','openchannel','whatsapp','voice','isArray','userTeam:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./team.socket'];(function(_0xeb393e,_0x44b178){var _0x19a612=function(_0x4aa72a){while(--_0x4aa72a){_0xeb393e['push'](_0xeb393e['shift']());}};_0x19a612(++_0x44b178);}(_0x5c4e,0xea));var _0xe5c4=function(_0xad65b5,_0x4f93d8){_0xad65b5=_0xad65b5-0x0;var _0x6f4ff3=_0x5c4e[_0xad65b5];return _0x6f4ff3;};'use strict';var pdf=require(_0xe5c4('0x0'));var emlformat=require(_0xe5c4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe5c4('0x2'));var rp=require(_0xe5c4('0x3'));var moment=require(_0xe5c4('0x4'));var BPromise=require(_0xe5c4('0x5'));var Mustache=require(_0xe5c4('0x6'));var util=require(_0xe5c4('0x7'));var path=require(_0xe5c4('0x8'));var sox=require(_0xe5c4('0x9'));var csv=require(_0xe5c4('0xa'));var ejs=require(_0xe5c4('0xb'));var fs=require('fs');var _=require(_0xe5c4('0xc'));var squel=require(_0xe5c4('0xd'));var crypto=require(_0xe5c4('0xe'));var jsforce=require(_0xe5c4('0xf'));var deskjs=require(_0xe5c4('0x10'));var toCsv=require(_0xe5c4('0xa'));var querystring=require(_0xe5c4('0x11'));var Papa=require(_0xe5c4('0x12'));var Redis=require('ioredis');var authService=require(_0xe5c4('0x13'));var qs=require(_0xe5c4('0x14'));var as=require(_0xe5c4('0x15'));var hardwareService=require(_0xe5c4('0x16'));var logger=require(_0xe5c4('0x17'))(_0xe5c4('0x18'));var utils=require('../../config/utils');var config=require(_0xe5c4('0x19'));var db=require('../../mysqldb')['db'];config[_0xe5c4('0x1a')]=_['defaults'](config[_0xe5c4('0x1a')],{'host':_0xe5c4('0x1b'),'port':0x18eb});var socket=require(_0xe5c4('0x1c'))(new Redis(config[_0xe5c4('0x1a')]));require(_0xe5c4('0x1d'))[_0xe5c4('0x1e')](socket);function respondWithStatusCode(_0xac7969,_0x49b500){_0x49b500=_0x49b500||0xcc;return function(_0x841645){if(_0x841645){return _0xac7969[_0xe5c4('0x1f')](_0x49b500);}return _0xac7969[_0xe5c4('0x20')](_0x49b500)[_0xe5c4('0x21')]();};}function respondWithResult(_0x790e81,_0x304e0c){_0x304e0c=_0x304e0c||0xc8;return function(_0x431372){if(_0x431372){return _0x790e81[_0xe5c4('0x20')](_0x304e0c)[_0xe5c4('0x22')](_0x431372);}};}function respondWithFilteredResult(_0x41145c,_0x229e90){return function(_0x57ee57){if(_0x57ee57){var _0x3a3d18=_0x57ee57[_0xe5c4('0x23')],_0xa7f2e1=_0x229e90[_0xe5c4('0x24')],_0x30c65a=_0x229e90[_0xe5c4('0x24')]+_0x229e90['limit'],_0x4aaacd;if(_0x30c65a>=_0x3a3d18){_0x30c65a=_0x3a3d18;_0x4aaacd=0xc8;}else{_0x4aaacd=0xce;}_0x41145c[_0xe5c4('0x20')](_0x4aaacd);return _0x41145c[_0xe5c4('0x25')]('Content-Range',_0xa7f2e1+'-'+_0x30c65a+'/'+_0x3a3d18)[_0xe5c4('0x22')](_0x57ee57);}return null;};}function patchUpdates(_0x3bc24b){return function(_0x22ae85){try{jsonpatch[_0xe5c4('0x26')](_0x22ae85,_0x3bc24b,!![]);}catch(_0xd1a6dc){return BPromise['reject'](_0xd1a6dc);}return _0x22ae85[_0xe5c4('0x27')]();};}function saveUpdates(_0xb9a672,_0x32a2e7){return function(_0x4539df){if(_0x4539df){return _0x4539df[_0xe5c4('0x28')](_0xb9a672)[_0xe5c4('0x29')](function(_0x408dd7){return _0x408dd7;});}return null;};}function removeEntity(_0x5b8d02,_0xf423c5){return function(_0x4cbad0){if(_0x4cbad0){return _0x4cbad0[_0xe5c4('0x2a')]()[_0xe5c4('0x29')](function(){var _0xf6004b=_0x4cbad0[_0xe5c4('0x2b')]({'plain':!![]});var _0x4d9dae=_0xe5c4('0x2c');return db[_0xe5c4('0x2d')]['destroy']({'where':{'type':_0x4d9dae,'resourceId':_0xf6004b['id']}})[_0xe5c4('0x29')](function(){return _0x4cbad0;});})[_0xe5c4('0x29')](function(){_0x5b8d02['status'](0xcc)[_0xe5c4('0x21')]();});}};}function handleEntityNotFound(_0xee1625,_0x181878){return function(_0x152ed2){if(!_0x152ed2){_0xee1625[_0xe5c4('0x1f')](0x194);}return _0x152ed2;};}function handleError(_0xfc5c63,_0x52e97c){_0x52e97c=_0x52e97c||0x1f4;return function(_0xe64d97){logger['error'](_0xe64d97[_0xe5c4('0x2e')]);if(_0xe64d97[_0xe5c4('0x2f')]){delete _0xe64d97[_0xe5c4('0x2f')];}_0xfc5c63[_0xe5c4('0x20')](_0x52e97c)[_0xe5c4('0x30')](_0xe64d97);};}exports[_0xe5c4('0x31')]=function(_0x37968d,_0x53e863){var _0x274aad={},_0x2ff3c9={},_0x12b755={'count':0x0,'rows':[]};var _0x5d418f=_['map'](db[_0xe5c4('0x32')]['rawAttributes'],function(_0x3d41ba){return{'name':_0x3d41ba[_0xe5c4('0x33')],'type':_0x3d41ba[_0xe5c4('0x34')][_0xe5c4('0x35')]};});_0x2ff3c9[_0xe5c4('0x36')]=_[_0xe5c4('0x37')](_0x5d418f,'name');_0x2ff3c9[_0xe5c4('0x38')]=_[_0xe5c4('0x39')](_0x37968d['query']);_0x2ff3c9[_0xe5c4('0x3a')]=_[_0xe5c4('0x3b')](_0x2ff3c9[_0xe5c4('0x36')],_0x2ff3c9[_0xe5c4('0x38')]);_0x274aad['attributes']=_[_0xe5c4('0x3b')](_0x2ff3c9[_0xe5c4('0x36')],qs[_0xe5c4('0x3c')](_0x37968d[_0xe5c4('0x38')]['fields']));_0x274aad[_0xe5c4('0x3d')]=_0x274aad[_0xe5c4('0x3d')]['length']?_0x274aad[_0xe5c4('0x3d')]:_0x2ff3c9[_0xe5c4('0x36')];if(!_0x37968d[_0xe5c4('0x38')][_0xe5c4('0x3e')](_0xe5c4('0x3f'))){_0x274aad[_0xe5c4('0x40')]=qs[_0xe5c4('0x40')](_0x37968d['query']['limit']);_0x274aad[_0xe5c4('0x24')]=qs[_0xe5c4('0x24')](_0x37968d[_0xe5c4('0x38')]['offset']);}_0x274aad[_0xe5c4('0x41')]=qs[_0xe5c4('0x42')](_0x37968d[_0xe5c4('0x38')]['sort']);_0x274aad[_0xe5c4('0x43')]=qs['filters'](_[_0xe5c4('0x44')](_0x37968d[_0xe5c4('0x38')],_0x2ff3c9[_0xe5c4('0x3a')]),_0x5d418f);if(_0x37968d['query'][_0xe5c4('0x45')]){_0x274aad[_0xe5c4('0x43')]=_['merge'](_0x274aad[_0xe5c4('0x43')],{'$or':_[_0xe5c4('0x37')](_0x5d418f,function(_0x49daa1){if(_0x49daa1['type']!==_0xe5c4('0x46')){var _0x4b25d7={};_0x4b25d7[_0x49daa1[_0xe5c4('0x2f')]]={'$like':'%'+_0x37968d[_0xe5c4('0x38')]['filter']+'%'};return _0x4b25d7;}})});}_0x274aad=_['merge']({},_0x274aad,_0x37968d[_0xe5c4('0x47')]);var _0x246f98={'where':_0x274aad[_0xe5c4('0x43')]};return db[_0xe5c4('0x32')][_0xe5c4('0x23')](_0x246f98)[_0xe5c4('0x29')](function(_0x4ac424){_0x12b755['count']=_0x4ac424;if(_0x37968d[_0xe5c4('0x38')]['includeAll']){_0x274aad[_0xe5c4('0x48')]=[{'all':!![]}];}return db[_0xe5c4('0x32')]['findAll'](_0x274aad);})[_0xe5c4('0x29')](function(_0x580f21){_0x12b755['rows']=_0x580f21;return _0x12b755;})[_0xe5c4('0x29')](respondWithFilteredResult(_0x53e863,_0x274aad))[_0xe5c4('0x49')](handleError(_0x53e863,null));};exports[_0xe5c4('0x4a')]=function(_0x2bbde5,_0x2ec923){var _0xdb6d41={'raw':![],'where':{'id':_0x2bbde5['params']['id']}},_0x3dced3={};_0x3dced3[_0xe5c4('0x36')]=_['keys'](db[_0xe5c4('0x32')][_0xe5c4('0x4b')]);_0x3dced3['query']=_[_0xe5c4('0x39')](_0x2bbde5[_0xe5c4('0x38')]);_0x3dced3[_0xe5c4('0x3a')]=_[_0xe5c4('0x3b')](_0x3dced3[_0xe5c4('0x36')],_0x3dced3[_0xe5c4('0x38')]);_0xdb6d41[_0xe5c4('0x3d')]=_[_0xe5c4('0x3b')](_0x3dced3['model'],qs['fields'](_0x2bbde5['query']['fields']));_0xdb6d41['attributes']=_0xdb6d41[_0xe5c4('0x3d')][_0xe5c4('0x4c')]?_0xdb6d41[_0xe5c4('0x3d')]:_0x3dced3['model'];if(_0x2bbde5['query']['includeAll']){_0xdb6d41[_0xe5c4('0x48')]=[{'all':!![]}];}_0xdb6d41=_[_0xe5c4('0x4d')]({},_0xdb6d41,_0x2bbde5[_0xe5c4('0x47')]);return db[_0xe5c4('0x32')]['find'](_0xdb6d41)[_0xe5c4('0x29')](handleEntityNotFound(_0x2ec923,null))[_0xe5c4('0x29')](respondWithResult(_0x2ec923,null))[_0xe5c4('0x49')](handleError(_0x2ec923,null));};exports['create']=function(_0x8b9888,_0x26b748){return db[_0xe5c4('0x32')]['create'](_0x8b9888[_0xe5c4('0x4e')],{})[_0xe5c4('0x29')](function(_0x42e087){var _0x3e3d49=_0x8b9888[_0xe5c4('0x4f')][_0xe5c4('0x2b')]({'plain':!![]});if(!_0x3e3d49)throw new Error(_0xe5c4('0x50'));if(_0x3e3d49[_0xe5c4('0x51')]==='user'){var _0x487f10=_0x42e087[_0xe5c4('0x2b')]({'plain':!![]});var _0x5512a0='Teams';return db['UserProfileSection'][_0xe5c4('0x52')]({'where':{'name':_0x5512a0,'userProfileId':_0x3e3d49[_0xe5c4('0x53')]},'raw':!![]})['then'](function(_0x335983){if(_0x335983&&_0x335983[_0xe5c4('0x54')]===0x0){return db['UserProfileResource'][_0xe5c4('0x55')]({'name':_0x487f10[_0xe5c4('0x2f')],'resourceId':_0x487f10['id'],'type':_0x335983['name'],'sectionId':_0x335983['id']},{})[_0xe5c4('0x29')](function(){return _0x42e087;});}else{return _0x42e087;}})[_0xe5c4('0x49')](function(_0x342672){logger[_0xe5c4('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x342672);throw _0x342672;});}return _0x42e087;})['then'](respondWithResult(_0x26b748,0xc9))['catch'](handleError(_0x26b748,null));};exports[_0xe5c4('0x28')]=function(_0x3d74cd,_0x27ebf3){if(_0x3d74cd[_0xe5c4('0x4e')]['id']){delete _0x3d74cd['body']['id'];}return db['Team'][_0xe5c4('0x52')]({'where':{'id':_0x3d74cd[_0xe5c4('0x57')]['id']}})[_0xe5c4('0x29')](handleEntityNotFound(_0x27ebf3,null))['then'](saveUpdates(_0x3d74cd['body'],null))[_0xe5c4('0x29')](respondWithResult(_0x27ebf3,null))[_0xe5c4('0x49')](handleError(_0x27ebf3,null));};exports[_0xe5c4('0x2a')]=function(_0x2d441a,_0x41ac20){return db[_0xe5c4('0x32')][_0xe5c4('0x52')]({'where':{'id':_0x2d441a['params']['id']}})[_0xe5c4('0x29')](handleEntityNotFound(_0x41ac20,null))[_0xe5c4('0x29')](removeEntity(_0x41ac20,null))[_0xe5c4('0x49')](handleError(_0x41ac20,null));};exports['getQueues']=function(_0x365be5,_0x1d8af8,_0x2fd352){return db[_0xe5c4('0x32')][_0xe5c4('0x58')]({'where':{'id':_0x365be5[_0xe5c4('0x57')]['id']}})[_0xe5c4('0x29')](handleEntityNotFound(_0x1d8af8,null))[_0xe5c4('0x29')](function(_0x131084){if(!_0x365be5[_0xe5c4('0x38')][_0xe5c4('0x59')]||!utils[_0xe5c4('0x5a')](_0x365be5['query'][_0xe5c4('0x59')])){throw new db[(_0xe5c4('0x5b'))][(_0xe5c4('0x5c'))](_0xe5c4('0x5d'));}var _0x1bea21={};var _0x1f8701={};_0x1f8701[_0xe5c4('0x36')]=_[_0xe5c4('0x39')](db[_[_0xe5c4('0x5e')](_0x365be5[_0xe5c4('0x38')]['channel'][_0xe5c4('0x5f')]())+_0xe5c4('0x60')]['rawAttributes']);_0x1f8701['query']=_[_0xe5c4('0x39')](_0x365be5[_0xe5c4('0x38')]);_0x1f8701['filters']=_['intersection'](_0x1f8701[_0xe5c4('0x36')],_0x1f8701[_0xe5c4('0x38')]);_0x1bea21[_0xe5c4('0x3d')]=_[_0xe5c4('0x3b')](_0x1f8701[_0xe5c4('0x36')],qs['fields'](_0x365be5[_0xe5c4('0x38')][_0xe5c4('0x3c')]));_0x1bea21[_0xe5c4('0x3d')]=_0x1bea21[_0xe5c4('0x3d')][_0xe5c4('0x4c')]?_0x1bea21[_0xe5c4('0x3d')]:_0x1f8701[_0xe5c4('0x36')];_0x1bea21[_0xe5c4('0x40')]=qs[_0xe5c4('0x40')](_0x365be5['query'][_0xe5c4('0x40')]);_0x1bea21['offset']=qs['offset'](_0x365be5[_0xe5c4('0x38')][_0xe5c4('0x24')]);_0x1bea21[_0xe5c4('0x41')]=qs[_0xe5c4('0x42')](_0x365be5[_0xe5c4('0x38')][_0xe5c4('0x42')]);_0x1bea21['where']=qs[_0xe5c4('0x3a')](_['pick'](_0x365be5[_0xe5c4('0x38')],_0x1f8701[_0xe5c4('0x3a')]));_0x1bea21=_['merge']({},_0x1bea21,_0x365be5[_0xe5c4('0x47')]);return _0x131084[_0xe5c4('0x2b')+_['capitalize'](_0x365be5[_0xe5c4('0x38')][_0xe5c4('0x59')][_0xe5c4('0x5f')]())+'Queues'](_0x1bea21);})[_0xe5c4('0x29')](respondWithResult(_0x1d8af8,null))[_0xe5c4('0x49')](handleError(_0x1d8af8,null));};exports[_0xe5c4('0x61')]=function(_0x46b58d,_0x52c749,_0x2af119){return db[_0xe5c4('0x32')][_0xe5c4('0x58')]({'where':{'id':_0x46b58d['params']['id']}})[_0xe5c4('0x29')](function(_0x203c90){if(_0x203c90){if(!_0x46b58d['body']['channel']||!utils[_0xe5c4('0x5a')](_0x46b58d[_0xe5c4('0x4e')]['channel'])){throw new db[(_0xe5c4('0x5b'))]['ValidationError'](_0xe5c4('0x5d'));}return _0x203c90['add'+_['capitalize'](_0x46b58d[_0xe5c4('0x4e')][_0xe5c4('0x59')][_0xe5c4('0x5f')]())+_0xe5c4('0x62')](_0x46b58d[_0xe5c4('0x4e')]['ids']);}return null;})[_0xe5c4('0x29')](handleEntityNotFound(_0x52c749,null))[_0xe5c4('0x29')](respondWithStatusCode(_0x52c749,null))[_0xe5c4('0x49')](handleError(_0x52c749,null));};exports[_0xe5c4('0x63')]=function(_0x2a95a9,_0x4a3cd0,_0x38360a){return db[_0xe5c4('0x32')][_0xe5c4('0x58')]({'where':{'id':_0x2a95a9[_0xe5c4('0x57')]['id']}})[_0xe5c4('0x29')](function(_0x4d1408){if(_0x4d1408){if(!_0x2a95a9['query'][_0xe5c4('0x59')]||!utils[_0xe5c4('0x5a')](_0x2a95a9['query']['channel'])){throw new db['Sequelize'][(_0xe5c4('0x5c'))](_0xe5c4('0x5d'));}return _0x4d1408[_0xe5c4('0x64')+_['capitalize'](_0x2a95a9[_0xe5c4('0x38')]['channel'][_0xe5c4('0x5f')]())+_0xe5c4('0x62')](_0x2a95a9[_0xe5c4('0x38')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4a3cd0,null))[_0xe5c4('0x29')](respondWithStatusCode(_0x4a3cd0,null))[_0xe5c4('0x49')](handleError(_0x4a3cd0,null));};exports[_0xe5c4('0x65')]=function(_0x54a3bf,_0x4ee1d2,_0x2ab00c){return db['Team']['find']({'where':{'id':_0x54a3bf[_0xe5c4('0x57')]['id']}})[_0xe5c4('0x29')](handleEntityNotFound(_0x4ee1d2,null))[_0xe5c4('0x29')](function(_0x1bb945){if(_0x1bb945){var _0xfe5a7=['Voice',_0xe5c4('0x66'),_0xe5c4('0x67'),_0xe5c4('0x68'),'Fax',_0xe5c4('0x69'),_0xe5c4('0x6a')];return BPromise[_0xe5c4('0x6b')](_0xfe5a7,function(_0xd81257){return _0x1bb945['get'+_0xd81257+_0xe5c4('0x62')]({'attributes':['id',_0xe5c4('0x2f')]})[_0xe5c4('0x29')](function(_0x22defd){return BPromise[_0xe5c4('0x6b')](_0x22defd,function(_0x3588ae){return _0x3588ae['addAgents'](_0x54a3bf[_0xe5c4('0x4e')]['ids'])[_0xe5c4('0x29')](function(){if(_0xd81257===_0xe5c4('0x6c')){return db['User'][_0xe5c4('0x6d')]({'where':{'id':_0x54a3bf[_0xe5c4('0x4e')]['ids']},'attributes':['id',_0xe5c4('0x2f'),_0xe5c4('0x6e'),'voicePause',_0xe5c4('0x6f')],'raw':!![]})[_0xe5c4('0x29')](function(_0x2e6ce1){return BPromise[_0xe5c4('0x6b')](_['filter'](_0x2e6ce1,{'online':0x1}),function(_0x83e2d4){return db[_0xe5c4('0x70')][_0xe5c4('0x71')]({'membername':_0x83e2d4[_0xe5c4('0x2f')],'UserId':_0x83e2d4['id'],'queue_name':_0x3588ae[_0xe5c4('0x2f')],'VoiceQueueId':_0x3588ae['id'],'interface':_['isNil'](_0x83e2d4['interface'])?util[_0xe5c4('0x72')](_0xe5c4('0x73'),_0x83e2d4['name']):_0x83e2d4[_0xe5c4('0x6f')],'paused':_0x83e2d4[_0xe5c4('0x74')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x1bb945;});})[_0xe5c4('0x29')](function(){return _0x1bb945;});}})[_0xe5c4('0x29')](function(_0x4c1540){if(_0x4c1540){return _0x4c1540[_0xe5c4('0x65')](_0x54a3bf['body'][_0xe5c4('0x75')],_['omit'](_0x54a3bf['body'],[_0xe5c4('0x75'),'id'])||{})[_0xe5c4('0x76')](function(_0x39f15d){for(var _0x4bb6f7=0x0;_0x4bb6f7<_0x54a3bf[_0xe5c4('0x4e')][_0xe5c4('0x75')][_0xe5c4('0x4c')];_0x4bb6f7+=0x1){socket[_0xe5c4('0x77')](_0xe5c4('0x78'),{'UserId':_0x54a3bf['body'][_0xe5c4('0x75')][_0x4bb6f7],'TeamId':_0x54a3bf[_0xe5c4('0x57')]['id']});}return _0x39f15d;});}})[_0xe5c4('0x29')](respondWithResult(_0x4ee1d2,null))[_0xe5c4('0x49')](handleError(_0x4ee1d2,null));};exports[_0xe5c4('0x79')]=function(_0x31d764,_0x17b77c,_0x58cb21){return db['Team'][_0xe5c4('0x52')]({'where':{'id':_0x31d764[_0xe5c4('0x57')]['id']}})[_0xe5c4('0x29')](handleEntityNotFound(_0x17b77c,null))['then'](function(_0x59ff57){if(_0x59ff57){return BPromise[_0xe5c4('0x6b')](['voice','chat',_0xe5c4('0x7a'),_0xe5c4('0x7b'),_0xe5c4('0x7c'),_0xe5c4('0x7d'),_0xe5c4('0x7e')],function(_0x509b96){return _0x59ff57['get'+_[_0xe5c4('0x5e')](_0x509b96)+'Queues']({'attributes':['id',_0xe5c4('0x2f')]})[_0xe5c4('0x29')](function(_0xa08118){return BPromise[_0xe5c4('0x6b')](_0xa08118,function(_0x9dc7d4){return _0x9dc7d4[_0xe5c4('0x79')](_0x31d764[_0xe5c4('0x38')][_0xe5c4('0x75')])[_0xe5c4('0x29')](function(){if(_0x509b96===_0xe5c4('0x7f')){return db['UserVoiceQueueRt'][_0xe5c4('0x2a')]({'where':{'VoiceQueueId':_0x9dc7d4['id'],'UserId':_0x31d764[_0xe5c4('0x38')]['ids']}});}});});})[_0xe5c4('0x29')](function(){return _0x59ff57;});})[_0xe5c4('0x29')](function(){return _0x59ff57;});}})[_0xe5c4('0x29')](function(_0x2cbbbf){if(_0x2cbbbf){return _0x2cbbbf[_0xe5c4('0x79')](_0x31d764['query'][_0xe5c4('0x75')])['then'](function(){if(_[_0xe5c4('0x80')](_0x31d764[_0xe5c4('0x38')][_0xe5c4('0x75')])){for(var _0x2ae09e=0x0;_0x2ae09e<_0x31d764[_0xe5c4('0x38')][_0xe5c4('0x75')]['length'];_0x2ae09e+=0x1){socket[_0xe5c4('0x77')](_0xe5c4('0x81'),{'UserId':Number(_0x31d764[_0xe5c4('0x38')]['ids'][_0x2ae09e]),'TeamId':Number(_0x31d764[_0xe5c4('0x57')]['id'])});}}else{socket[_0xe5c4('0x77')](_0xe5c4('0x81'),{'UserId':Number(_0x31d764['query'][_0xe5c4('0x75')]),'TeamId':Number(_0x31d764[_0xe5c4('0x57')]['id'])});}});}})[_0xe5c4('0x29')](respondWithStatusCode(_0x17b77c,null))[_0xe5c4('0x49')](handleError(_0x17b77c,null));};exports[_0xe5c4('0x82')]=function(_0x2debc8,_0x2b6b84,_0x42dce5){var _0x57d0e8={};var _0x4e9b8d={};var _0x2e639;var _0x56177f;return db[_0xe5c4('0x32')][_0xe5c4('0x58')]({'where':{'id':_0x2debc8['params']['id']}})[_0xe5c4('0x29')](handleEntityNotFound(_0x2b6b84,null))['then'](function(_0x3d8702){if(_0x3d8702){_0x2e639=_0x3d8702;_0x4e9b8d[_0xe5c4('0x36')]=_[_0xe5c4('0x39')](db[_0xe5c4('0x83')]['rawAttributes']);_0x4e9b8d[_0xe5c4('0x38')]=_[_0xe5c4('0x39')](_0x2debc8[_0xe5c4('0x38')]);_0x4e9b8d[_0xe5c4('0x3a')]=_[_0xe5c4('0x3b')](_0x4e9b8d['model'],_0x4e9b8d[_0xe5c4('0x38')]);_0x57d0e8[_0xe5c4('0x3d')]=_['intersection'](_0x4e9b8d['model'],qs[_0xe5c4('0x3c')](_0x2debc8[_0xe5c4('0x38')][_0xe5c4('0x3c')]));_0x57d0e8[_0xe5c4('0x3d')]=_0x57d0e8[_0xe5c4('0x3d')][_0xe5c4('0x4c')]?_0x57d0e8[_0xe5c4('0x3d')]:_0x4e9b8d['model'];_0x57d0e8[_0xe5c4('0x41')]=qs[_0xe5c4('0x42')](_0x2debc8[_0xe5c4('0x38')]['sort']);_0x57d0e8[_0xe5c4('0x43')]=qs[_0xe5c4('0x3a')](_[_0xe5c4('0x44')](_0x2debc8[_0xe5c4('0x38')],_0x4e9b8d[_0xe5c4('0x3a')]));if(_0x2debc8[_0xe5c4('0x38')][_0xe5c4('0x45')]){_0x57d0e8[_0xe5c4('0x43')]=_[_0xe5c4('0x4d')](_0x57d0e8[_0xe5c4('0x43')],{'$or':_[_0xe5c4('0x37')](_0x57d0e8['attributes'],function(_0x21b018){var _0x44bf1c={};_0x44bf1c[_0x21b018]={'$like':'%'+_0x2debc8['query'][_0xe5c4('0x45')]+'%'};return _0x44bf1c;})});}_0x57d0e8=_[_0xe5c4('0x4d')]({},_0x57d0e8,_0x2debc8['options']);return _0x2e639['getAgents'](_0x57d0e8);}})[_0xe5c4('0x29')](function(_0x24057e){if(_0x24057e){_0x56177f=_0x24057e['length'];if(!_0x2debc8[_0xe5c4('0x38')]['hasOwnProperty'](_0xe5c4('0x3f'))){_0x57d0e8[_0xe5c4('0x40')]=qs[_0xe5c4('0x40')](_0x2debc8['query']['limit']);_0x57d0e8[_0xe5c4('0x24')]=qs[_0xe5c4('0x24')](_0x2debc8[_0xe5c4('0x38')][_0xe5c4('0x24')]);}return _0x2e639['getAgents'](_0x57d0e8);}})['then'](function(_0x1612aa){if(_0x1612aa){return _0x1612aa?{'count':_0x56177f,'rows':_0x1612aa}:null;}})[_0xe5c4('0x29')](respondWithResult(_0x2b6b84,null))[_0xe5c4('0x49')](handleError(_0x2b6b84,null));}; \ No newline at end of file +var _0xf555=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','get','capitalize','addQueues','ValidationError','add','Queues','ids','removeQueues','addAgents','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','each','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','spread','emit','removeAgents','voice','chat','mail','whatsapp','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','Teams','UserProfileResource','error','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf555,0xc1));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5f55('0x0'));var emlformat=require(_0x5f55('0x1'));var rimraf=require(_0x5f55('0x2'));var zipdir=require(_0x5f55('0x3'));var jsonpatch=require(_0x5f55('0x4'));var rp=require('request-promise');var moment=require(_0x5f55('0x5'));var BPromise=require(_0x5f55('0x6'));var Mustache=require(_0x5f55('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5f55('0x8'));var csv=require(_0x5f55('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5f55('0xa'));var crypto=require('crypto');var jsforce=require(_0x5f55('0xb'));var deskjs=require(_0x5f55('0xc'));var toCsv=require(_0x5f55('0x9'));var querystring=require(_0x5f55('0xd'));var Papa=require('papaparse');var Redis=require(_0x5f55('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5f55('0xf'));var as=require(_0x5f55('0x10'));var hardwareService=require(_0x5f55('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5f55('0x12'));var config=require(_0x5f55('0x13'));var db=require(_0x5f55('0x14'))['db'];config[_0x5f55('0x15')]=_[_0x5f55('0x16')](config[_0x5f55('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f55('0x17'))(new Redis(config['redis']));require('./team.socket')[_0x5f55('0x18')](socket);function respondWithStatusCode(_0x5d62e1,_0x590a5f){_0x590a5f=_0x590a5f||0xcc;return function(_0x1303e6){if(_0x1303e6){return _0x5d62e1[_0x5f55('0x19')](_0x590a5f);}return _0x5d62e1[_0x5f55('0x1a')](_0x590a5f)[_0x5f55('0x1b')]();};}function respondWithResult(_0x494c64,_0x1cbc93){_0x1cbc93=_0x1cbc93||0xc8;return function(_0x4e6487){if(_0x4e6487){return _0x494c64['status'](_0x1cbc93)[_0x5f55('0x1c')](_0x4e6487);}};}function respondWithFilteredResult(_0x16a1d2,_0xe86740){return function(_0x55220a){if(_0x55220a){var _0x45363c=_0x55220a[_0x5f55('0x1d')],_0x438a73=_0xe86740[_0x5f55('0x1e')],_0x528c7d=_0xe86740['offset']+_0xe86740['limit'],_0x3a9a64;if(_0x528c7d>=_0x45363c){_0x528c7d=_0x45363c;_0x3a9a64=0xc8;}else{_0x3a9a64=0xce;}_0x16a1d2[_0x5f55('0x1a')](_0x3a9a64);return _0x16a1d2[_0x5f55('0x1f')](_0x5f55('0x20'),_0x438a73+'-'+_0x528c7d+'/'+_0x45363c)[_0x5f55('0x1c')](_0x55220a);}return null;};}function patchUpdates(_0x58b7c3){return function(_0xde6fa9){try{jsonpatch[_0x5f55('0x21')](_0xde6fa9,_0x58b7c3,!![]);}catch(_0x324add){return BPromise['reject'](_0x324add);}return _0xde6fa9[_0x5f55('0x22')]();};}function saveUpdates(_0x2719ce,_0x53bdd1){return function(_0xeec332){if(_0xeec332){return _0xeec332[_0x5f55('0x23')](_0x2719ce)[_0x5f55('0x24')](function(_0x46446b){return _0x46446b;});}return null;};}function removeEntity(_0x2c3183,_0x29a9c1){return function(_0x2c2e4a){if(_0x2c2e4a){return _0x2c2e4a[_0x5f55('0x25')]()[_0x5f55('0x24')](function(){var _0x39180a=_0x2c2e4a['get']({'plain':!![]});var _0x2ba182=_0x5f55('0x26');return db[_0x5f55('0x27')][_0x5f55('0x25')]({'where':{'type':_0x2ba182,'resourceId':_0x39180a['id']}})[_0x5f55('0x24')](function(){return _0x2c2e4a;});})[_0x5f55('0x24')](function(){_0x2c3183[_0x5f55('0x1a')](0xcc)[_0x5f55('0x1b')]();});}};}function handleEntityNotFound(_0x2ccf53,_0x5b9887){return function(_0x100907){if(!_0x100907){_0x2ccf53['sendStatus'](0x194);}return _0x100907;};}function handleError(_0x163c31,_0x4d7831){_0x4d7831=_0x4d7831||0x1f4;return function(_0x2d3cde){logger[_0x5f55('0x28')](_0x2d3cde[_0x5f55('0x29')]);if(_0x2d3cde['name']){delete _0x2d3cde[_0x5f55('0x2a')];}_0x163c31[_0x5f55('0x1a')](_0x4d7831)['send'](_0x2d3cde);};}exports[_0x5f55('0x2b')]=function(_0x380c74,_0x280817){var _0x21b566={},_0x409ebe={},_0x2c8d48={'count':0x0,'rows':[]};var _0x16bf82=_[_0x5f55('0x2c')](db[_0x5f55('0x2d')][_0x5f55('0x2e')],function(_0x1e6507){return{'name':_0x1e6507[_0x5f55('0x2f')],'type':_0x1e6507[_0x5f55('0x30')][_0x5f55('0x31')]};});_0x409ebe[_0x5f55('0x32')]=_[_0x5f55('0x2c')](_0x16bf82,_0x5f55('0x2a'));_0x409ebe[_0x5f55('0x33')]=_[_0x5f55('0x34')](_0x380c74[_0x5f55('0x33')]);_0x409ebe[_0x5f55('0x35')]=_['intersection'](_0x409ebe['model'],_0x409ebe[_0x5f55('0x33')]);_0x21b566[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x409ebe[_0x5f55('0x32')],qs['fields'](_0x380c74[_0x5f55('0x33')][_0x5f55('0x38')]));_0x21b566[_0x5f55('0x36')]=_0x21b566[_0x5f55('0x36')][_0x5f55('0x39')]?_0x21b566[_0x5f55('0x36')]:_0x409ebe[_0x5f55('0x32')];if(!_0x380c74[_0x5f55('0x33')][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x21b566[_0x5f55('0x3c')]=qs['limit'](_0x380c74[_0x5f55('0x33')][_0x5f55('0x3c')]);_0x21b566['offset']=qs[_0x5f55('0x1e')](_0x380c74[_0x5f55('0x33')][_0x5f55('0x1e')]);}_0x21b566[_0x5f55('0x3d')]=qs[_0x5f55('0x3e')](_0x380c74[_0x5f55('0x33')][_0x5f55('0x3e')]);_0x21b566['where']=qs[_0x5f55('0x35')](_[_0x5f55('0x3f')](_0x380c74[_0x5f55('0x33')],_0x409ebe[_0x5f55('0x35')]),_0x16bf82);if(_0x380c74['query'][_0x5f55('0x40')]){_0x21b566['where']=_[_0x5f55('0x41')](_0x21b566[_0x5f55('0x42')],{'$or':_['map'](_0x16bf82,function(_0x51be37){if(_0x51be37[_0x5f55('0x30')]!==_0x5f55('0x43')){var _0x85f8a2={};_0x85f8a2[_0x51be37[_0x5f55('0x2a')]]={'$like':'%'+_0x380c74[_0x5f55('0x33')][_0x5f55('0x40')]+'%'};return _0x85f8a2;}})});}_0x21b566=_['merge']({},_0x21b566,_0x380c74[_0x5f55('0x44')]);var _0x118c5f={'where':_0x21b566[_0x5f55('0x42')]};return db['Team'][_0x5f55('0x1d')](_0x118c5f)['then'](function(_0x3e33f7){_0x2c8d48[_0x5f55('0x1d')]=_0x3e33f7;if(_0x380c74[_0x5f55('0x33')][_0x5f55('0x45')]){_0x21b566[_0x5f55('0x46')]=[{'all':!![]}];}return db[_0x5f55('0x2d')][_0x5f55('0x47')](_0x21b566);})['then'](function(_0x4e98d9){_0x2c8d48[_0x5f55('0x48')]=_0x4e98d9;return _0x2c8d48;})[_0x5f55('0x24')](respondWithFilteredResult(_0x280817,_0x21b566))[_0x5f55('0x49')](handleError(_0x280817,null));};exports[_0x5f55('0x4a')]=function(_0x57bb38,_0x6a6d78){var _0x1f5b47={'raw':![],'where':{'id':_0x57bb38[_0x5f55('0x4b')]['id']}},_0xcd16c0={};_0xcd16c0[_0x5f55('0x32')]=_[_0x5f55('0x34')](db[_0x5f55('0x2d')][_0x5f55('0x2e')]);_0xcd16c0[_0x5f55('0x33')]=_[_0x5f55('0x34')](_0x57bb38[_0x5f55('0x33')]);_0xcd16c0[_0x5f55('0x35')]=_[_0x5f55('0x37')](_0xcd16c0[_0x5f55('0x32')],_0xcd16c0[_0x5f55('0x33')]);_0x1f5b47[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0xcd16c0[_0x5f55('0x32')],qs[_0x5f55('0x38')](_0x57bb38[_0x5f55('0x33')][_0x5f55('0x38')]));_0x1f5b47[_0x5f55('0x36')]=_0x1f5b47[_0x5f55('0x36')][_0x5f55('0x39')]?_0x1f5b47['attributes']:_0xcd16c0[_0x5f55('0x32')];if(_0x57bb38[_0x5f55('0x33')][_0x5f55('0x45')]){_0x1f5b47[_0x5f55('0x46')]=[{'all':!![]}];}_0x1f5b47=_[_0x5f55('0x41')]({},_0x1f5b47,_0x57bb38[_0x5f55('0x44')]);return db[_0x5f55('0x2d')][_0x5f55('0x4c')](_0x1f5b47)['then'](handleEntityNotFound(_0x6a6d78,null))['then'](respondWithResult(_0x6a6d78,null))[_0x5f55('0x49')](handleError(_0x6a6d78,null));};exports[_0x5f55('0x4d')]=function(_0x47ef58,_0x488f3d){return db[_0x5f55('0x2d')][_0x5f55('0x4d')](_0x47ef58[_0x5f55('0x4e')],{})['then'](function(_0x374011){var _0x99bee5=_0x47ef58[_0x5f55('0x4f')]['get']({'plain':!![]});if(!_0x99bee5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x99bee5['role']===_0x5f55('0x4f')){var _0x5862ef=_0x374011['get']({'plain':!![]});var _0x5bb578=_0x5f55('0x26');return db['UserProfileSection'][_0x5f55('0x4c')]({'where':{'name':_0x5bb578,'userProfileId':_0x99bee5[_0x5f55('0x50')]},'raw':!![]})[_0x5f55('0x24')](function(_0x1285b3){if(_0x1285b3&&_0x1285b3[_0x5f55('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x5862ef[_0x5f55('0x2a')],'resourceId':_0x5862ef['id'],'type':_0x1285b3[_0x5f55('0x2a')],'sectionId':_0x1285b3['id']},{})['then'](function(){return _0x374011;});}else{return _0x374011;}})[_0x5f55('0x49')](function(_0x29aebb){logger[_0x5f55('0x28')](_0x5f55('0x52'),_0x29aebb);throw _0x29aebb;});}return _0x374011;})[_0x5f55('0x24')](respondWithResult(_0x488f3d,0xc9))[_0x5f55('0x49')](handleError(_0x488f3d,null));};exports[_0x5f55('0x23')]=function(_0x4d76da,_0x5acfa1){if(_0x4d76da['body']['id']){delete _0x4d76da['body']['id'];}return db['Team']['find']({'where':{'id':_0x4d76da[_0x5f55('0x4b')]['id']}})[_0x5f55('0x24')](handleEntityNotFound(_0x5acfa1,null))[_0x5f55('0x24')](saveUpdates(_0x4d76da['body'],null))[_0x5f55('0x24')](respondWithResult(_0x5acfa1,null))['catch'](handleError(_0x5acfa1,null));};exports[_0x5f55('0x25')]=function(_0x6f5a43,_0x39f4f7){return db[_0x5f55('0x2d')]['find']({'where':{'id':_0x6f5a43[_0x5f55('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39f4f7,null))['then'](removeEntity(_0x39f4f7,null))[_0x5f55('0x49')](handleError(_0x39f4f7,null));};exports['getQueues']=function(_0x429894,_0x40aa95,_0x11b375){return db[_0x5f55('0x2d')][_0x5f55('0x53')]({'where':{'id':_0x429894[_0x5f55('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40aa95,null))[_0x5f55('0x24')](function(_0x4bcfde){if(!_0x429894['query'][_0x5f55('0x54')]||!utils[_0x5f55('0x55')](_0x429894[_0x5f55('0x33')][_0x5f55('0x54')])){throw new db[(_0x5f55('0x56'))]['ValidationError'](_0x5f55('0x57'));}var _0x5c9e87={};var _0x594a24={};_0x594a24[_0x5f55('0x32')]=_[_0x5f55('0x34')](db[_['capitalize'](_0x429894[_0x5f55('0x33')][_0x5f55('0x54')][_0x5f55('0x58')]())+_0x5f55('0x59')]['rawAttributes']);_0x594a24['query']=_[_0x5f55('0x34')](_0x429894['query']);_0x594a24[_0x5f55('0x35')]=_[_0x5f55('0x37')](_0x594a24['model'],_0x594a24['query']);_0x5c9e87[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x594a24[_0x5f55('0x32')],qs[_0x5f55('0x38')](_0x429894[_0x5f55('0x33')][_0x5f55('0x38')]));_0x5c9e87['attributes']=_0x5c9e87[_0x5f55('0x36')][_0x5f55('0x39')]?_0x5c9e87[_0x5f55('0x36')]:_0x594a24[_0x5f55('0x32')];_0x5c9e87[_0x5f55('0x3c')]=qs[_0x5f55('0x3c')](_0x429894[_0x5f55('0x33')][_0x5f55('0x3c')]);_0x5c9e87[_0x5f55('0x1e')]=qs[_0x5f55('0x1e')](_0x429894[_0x5f55('0x33')][_0x5f55('0x1e')]);_0x5c9e87[_0x5f55('0x3d')]=qs[_0x5f55('0x3e')](_0x429894[_0x5f55('0x33')][_0x5f55('0x3e')]);_0x5c9e87[_0x5f55('0x42')]=qs['filters'](_[_0x5f55('0x3f')](_0x429894[_0x5f55('0x33')],_0x594a24['filters']));_0x5c9e87=_[_0x5f55('0x41')]({},_0x5c9e87,_0x429894[_0x5f55('0x44')]);return _0x4bcfde[_0x5f55('0x5a')+_[_0x5f55('0x5b')](_0x429894[_0x5f55('0x33')]['channel'][_0x5f55('0x58')]())+'Queues'](_0x5c9e87);})['then'](respondWithResult(_0x40aa95,null))['catch'](handleError(_0x40aa95,null));};exports[_0x5f55('0x5c')]=function(_0x3419b0,_0xb3bba1,_0x54ef7c){return db[_0x5f55('0x2d')][_0x5f55('0x53')]({'where':{'id':_0x3419b0[_0x5f55('0x4b')]['id']}})[_0x5f55('0x24')](function(_0x4d054b){if(_0x4d054b){if(!_0x3419b0[_0x5f55('0x4e')]['channel']||!utils[_0x5f55('0x55')](_0x3419b0[_0x5f55('0x4e')][_0x5f55('0x54')])){throw new db[(_0x5f55('0x56'))][(_0x5f55('0x5d'))](_0x5f55('0x57'));}return _0x4d054b[_0x5f55('0x5e')+_['capitalize'](_0x3419b0[_0x5f55('0x4e')][_0x5f55('0x54')][_0x5f55('0x58')]())+_0x5f55('0x5f')](_0x3419b0['body'][_0x5f55('0x60')]);}return null;})[_0x5f55('0x24')](handleEntityNotFound(_0xb3bba1,null))[_0x5f55('0x24')](respondWithStatusCode(_0xb3bba1,null))[_0x5f55('0x49')](handleError(_0xb3bba1,null));};exports[_0x5f55('0x61')]=function(_0x24a541,_0x87b0e0,_0x3a5db3){return db[_0x5f55('0x2d')]['findOne']({'where':{'id':_0x24a541['params']['id']}})[_0x5f55('0x24')](function(_0x113997){if(_0x113997){if(!_0x24a541['query'][_0x5f55('0x54')]||!utils['isValidChannel'](_0x24a541[_0x5f55('0x33')][_0x5f55('0x54')])){throw new db[(_0x5f55('0x56'))]['ValidationError'](_0x5f55('0x57'));}return _0x113997['remove'+_[_0x5f55('0x5b')](_0x24a541[_0x5f55('0x33')][_0x5f55('0x54')][_0x5f55('0x58')]())+_0x5f55('0x5f')](_0x24a541['query'][_0x5f55('0x60')]);}return null;})['then'](handleEntityNotFound(_0x87b0e0,null))['then'](respondWithStatusCode(_0x87b0e0,null))[_0x5f55('0x49')](handleError(_0x87b0e0,null));};exports[_0x5f55('0x62')]=function(_0x30ebd4,_0x74426,_0x1196cb){return db[_0x5f55('0x2d')][_0x5f55('0x4c')]({'where':{'id':_0x30ebd4[_0x5f55('0x4b')]['id']}})[_0x5f55('0x24')](handleEntityNotFound(_0x74426,null))[_0x5f55('0x24')](function(_0x2ef3e3){if(_0x2ef3e3){var _0xf76d0=[_0x5f55('0x63'),_0x5f55('0x64'),_0x5f55('0x65'),'Sms',_0x5f55('0x66'),_0x5f55('0x67'),_0x5f55('0x68')];return BPromise[_0x5f55('0x69')](_0xf76d0,function(_0x397724){return _0x2ef3e3[_0x5f55('0x5a')+_0x397724+_0x5f55('0x5f')]({'attributes':['id',_0x5f55('0x2a')]})[_0x5f55('0x24')](function(_0x47b958){return BPromise[_0x5f55('0x69')](_0x47b958,function(_0x2d989f){return _0x2d989f[_0x5f55('0x62')](_0x30ebd4[_0x5f55('0x4e')]['ids'])[_0x5f55('0x24')](function(){if(_0x397724===_0x5f55('0x63')){return db['User'][_0x5f55('0x47')]({'where':{'id':_0x30ebd4[_0x5f55('0x4e')][_0x5f55('0x60')]},'attributes':['id',_0x5f55('0x2a'),_0x5f55('0x6a'),_0x5f55('0x6b'),_0x5f55('0x6c')],'raw':!![]})['then'](function(_0x8e48a1){return BPromise[_0x5f55('0x69')](_[_0x5f55('0x40')](_0x8e48a1,{'online':0x1}),function(_0x3c3160){return db[_0x5f55('0x6d')]['upsert']({'membername':_0x3c3160[_0x5f55('0x2a')],'UserId':_0x3c3160['id'],'queue_name':_0x2d989f['name'],'VoiceQueueId':_0x2d989f['id'],'interface':_[_0x5f55('0x6e')](_0x3c3160[_0x5f55('0x6c')])?util[_0x5f55('0x6f')](_0x5f55('0x70'),_0x3c3160[_0x5f55('0x2a')]):_0x3c3160['interface'],'paused':_0x3c3160[_0x5f55('0x6b')]||![],'penalty':0x0});});});}});});})[_0x5f55('0x24')](function(){return _0x2ef3e3;});})[_0x5f55('0x24')](function(){return _0x2ef3e3;});}})[_0x5f55('0x24')](function(_0x44ec70){if(_0x44ec70){return _0x44ec70[_0x5f55('0x62')](_0x30ebd4[_0x5f55('0x4e')][_0x5f55('0x60')],_['omit'](_0x30ebd4[_0x5f55('0x4e')],[_0x5f55('0x60'),'id'])||{})[_0x5f55('0x71')](function(_0xbc4049){for(var _0x2dcc40=0x0;_0x2dcc40<_0x30ebd4[_0x5f55('0x4e')][_0x5f55('0x60')]['length'];_0x2dcc40+=0x1){socket[_0x5f55('0x72')]('userTeam:save',{'UserId':_0x30ebd4[_0x5f55('0x4e')][_0x5f55('0x60')][_0x2dcc40],'TeamId':_0x30ebd4['params']['id']});}return _0xbc4049;});}})['then'](respondWithResult(_0x74426,null))[_0x5f55('0x49')](handleError(_0x74426,null));};exports[_0x5f55('0x73')]=function(_0x53374b,_0x3a60a1,_0x382e72){return db[_0x5f55('0x2d')][_0x5f55('0x4c')]({'where':{'id':_0x53374b[_0x5f55('0x4b')]['id']}})[_0x5f55('0x24')](handleEntityNotFound(_0x3a60a1,null))[_0x5f55('0x24')](function(_0x473feb){if(_0x473feb){return BPromise['each']([_0x5f55('0x74'),_0x5f55('0x75'),_0x5f55('0x76'),'sms','fax','openchannel',_0x5f55('0x77')],function(_0x579cbb){return _0x473feb[_0x5f55('0x5a')+_[_0x5f55('0x5b')](_0x579cbb)+_0x5f55('0x5f')]({'attributes':['id',_0x5f55('0x2a')]})['then'](function(_0x23c516){return BPromise['each'](_0x23c516,function(_0x31504a){return _0x31504a[_0x5f55('0x73')](_0x53374b[_0x5f55('0x33')]['ids'])['then'](function(){if(_0x579cbb===_0x5f55('0x74')){return db[_0x5f55('0x6d')][_0x5f55('0x25')]({'where':{'VoiceQueueId':_0x31504a['id'],'UserId':_0x53374b[_0x5f55('0x33')]['ids']}});}});});})['then'](function(){return _0x473feb;});})[_0x5f55('0x24')](function(){return _0x473feb;});}})['then'](function(_0x3eb5af){if(_0x3eb5af){return _0x3eb5af[_0x5f55('0x73')](_0x53374b[_0x5f55('0x33')]['ids'])[_0x5f55('0x24')](function(){if(_[_0x5f55('0x78')](_0x53374b[_0x5f55('0x33')][_0x5f55('0x60')])){for(var _0x486b3a=0x0;_0x486b3a<_0x53374b['query'][_0x5f55('0x60')]['length'];_0x486b3a+=0x1){socket[_0x5f55('0x72')](_0x5f55('0x79'),{'UserId':Number(_0x53374b[_0x5f55('0x33')][_0x5f55('0x60')][_0x486b3a]),'TeamId':Number(_0x53374b['params']['id'])});}}else{socket[_0x5f55('0x72')](_0x5f55('0x79'),{'UserId':Number(_0x53374b[_0x5f55('0x33')][_0x5f55('0x60')]),'TeamId':Number(_0x53374b[_0x5f55('0x4b')]['id'])});}});}})[_0x5f55('0x24')](respondWithStatusCode(_0x3a60a1,null))['catch'](handleError(_0x3a60a1,null));};exports[_0x5f55('0x7a')]=function(_0x8bde8b,_0x4228d7,_0x1da6ea){var _0x5af7bb={};var _0x4e0b15={};var _0x16f128;var _0x83bc23;return db['Team']['findOne']({'where':{'id':_0x8bde8b['params']['id']}})[_0x5f55('0x24')](handleEntityNotFound(_0x4228d7,null))['then'](function(_0x1909c5){if(_0x1909c5){_0x16f128=_0x1909c5;_0x4e0b15[_0x5f55('0x32')]=_['keys'](db['User']['rawAttributes']);_0x4e0b15[_0x5f55('0x33')]=_[_0x5f55('0x34')](_0x8bde8b['query']);_0x4e0b15[_0x5f55('0x35')]=_[_0x5f55('0x37')](_0x4e0b15[_0x5f55('0x32')],_0x4e0b15['query']);_0x5af7bb[_0x5f55('0x36')]=_[_0x5f55('0x37')](_0x4e0b15['model'],qs[_0x5f55('0x38')](_0x8bde8b[_0x5f55('0x33')][_0x5f55('0x38')]));_0x5af7bb[_0x5f55('0x36')]=_0x5af7bb['attributes'][_0x5f55('0x39')]?_0x5af7bb[_0x5f55('0x36')]:_0x4e0b15[_0x5f55('0x32')];_0x5af7bb[_0x5f55('0x3d')]=qs['sort'](_0x8bde8b[_0x5f55('0x33')][_0x5f55('0x3e')]);_0x5af7bb[_0x5f55('0x42')]=qs[_0x5f55('0x35')](_[_0x5f55('0x3f')](_0x8bde8b[_0x5f55('0x33')],_0x4e0b15[_0x5f55('0x35')]));if(_0x8bde8b[_0x5f55('0x33')][_0x5f55('0x40')]){_0x5af7bb[_0x5f55('0x42')]=_[_0x5f55('0x41')](_0x5af7bb[_0x5f55('0x42')],{'$or':_[_0x5f55('0x2c')](_0x5af7bb[_0x5f55('0x36')],function(_0x1e9ae0){var _0x5a305b={};_0x5a305b[_0x1e9ae0]={'$like':'%'+_0x8bde8b['query'][_0x5f55('0x40')]+'%'};return _0x5a305b;})});}_0x5af7bb=_[_0x5f55('0x41')]({},_0x5af7bb,_0x8bde8b['options']);return _0x16f128[_0x5f55('0x7a')](_0x5af7bb);}})[_0x5f55('0x24')](function(_0x1e6063){if(_0x1e6063){_0x83bc23=_0x1e6063['length'];if(!_0x8bde8b[_0x5f55('0x33')][_0x5f55('0x3a')](_0x5f55('0x3b'))){_0x5af7bb[_0x5f55('0x3c')]=qs['limit'](_0x8bde8b[_0x5f55('0x33')][_0x5f55('0x3c')]);_0x5af7bb['offset']=qs[_0x5f55('0x1e')](_0x8bde8b['query']['offset']);}return _0x16f128[_0x5f55('0x7a')](_0x5af7bb);}})[_0x5f55('0x24')](function(_0x2ebc10){if(_0x2ebc10){return _0x2ebc10?{'count':_0x83bc23,'rows':_0x2ebc10}:null;}})[_0x5f55('0x24')](respondWithResult(_0x4228d7,null))[_0x5f55('0x49')](handleError(_0x4228d7,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2f312b1..fe1c255 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 _0xcf22=['emit','hasOwnProperty','exports','events','Team','setMaxListeners','save','update','remove'];(function(_0x8b9f5e,_0x548fed){var _0x1cb644=function(_0x404f42){while(--_0x404f42){_0x8b9f5e['push'](_0x8b9f5e['shift']());}};_0x1cb644(++_0x548fed);}(_0xcf22,0x159));var _0x2cf2=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcf22[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require(_0x2cf2('0x0'));var Team=require('../../mysqldb')['db'][_0x2cf2('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x2cf2('0x2')](0x0);var events={'afterCreate':_0x2cf2('0x3'),'afterUpdate':_0x2cf2('0x4'),'afterDestroy':_0x2cf2('0x5')};function emitEvent(_0x1fe65a){return function(_0x2eefdd,_0x77303a,_0xd545b4){TeamEvents[_0x2cf2('0x6')](_0x1fe65a+':'+_0x2eefdd['id'],_0x2eefdd);TeamEvents[_0x2cf2('0x6')](_0x1fe65a,_0x2eefdd);_0xd545b4(null);};}for(var e in events){if(events[_0x2cf2('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x2cf2('0x8')]=TeamEvents; \ No newline at end of file +var _0xb704=['remove','emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners','update'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0xb704,0x16b));var _0x4b70=function(_0x4e1714,_0x2eb357){_0x4e1714=_0x4e1714-0x0;var _0x2007a8=_0xb704[_0x4e1714];return _0x2007a8;};'use strict';var EventEmitter=require(_0x4b70('0x0'));var Team=require(_0x4b70('0x1'))['db'][_0x4b70('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4b70('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b70('0x4'),'afterDestroy':_0x4b70('0x5')};function emitEvent(_0x4f2a28){return function(_0x2dc549,_0x58bbde,_0x5dbb93){TeamEvents[_0x4b70('0x6')](_0x4f2a28+':'+_0x2dc549['id'],_0x2dc549);TeamEvents[_0x4b70('0x6')](_0x4f2a28,_0x2dc549);_0x5dbb93(null);};}for(var e in events){if(events[_0x4b70('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index e809e31..663c3d0 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 _0x3199=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3199,0x16a));var _0x9319=function(_0x52c80f,_0x30fcbf){_0x52c80f=_0x52c80f-0x0;var _0x208232=_0x3199[_0x52c80f];return _0x208232;};'use strict';var _=require(_0x9319('0x0'));var util=require(_0x9319('0x1'));var logger=require(_0x9319('0x2'))('api');var moment=require(_0x9319('0x3'));var BPromise=require(_0x9319('0x4'));var rp=require(_0x9319('0x5'));var fs=require('fs');var path=require(_0x9319('0x6'));var rimraf=require(_0x9319('0x7'));var config=require(_0x9319('0x8'));var attributes=require(_0x9319('0x9'));module[_0x9319('0xa')]=function(_0x430eec,_0x312b0c){return _0x430eec[_0x9319('0xb')](_0x9319('0xc'),attributes,{'tableName':_0x9319('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8c6=['request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','util','../../config/logger','api','moment','bluebird'];(function(_0x237fff,_0x52e444){var _0x513dfd=function(_0x50c8c6){while(--_0x50c8c6){_0x237fff['push'](_0x237fff['shift']());}};_0x513dfd(++_0x52e444);}(_0xf8c6,0x105));var _0x6f8c=function(_0x1b08c1,_0x242b5e){_0x1b08c1=_0x1b08c1-0x0;var _0x1792e3=_0xf8c6[_0x1b08c1];return _0x1792e3;};'use strict';var _=require('lodash');var util=require(_0x6f8c('0x0'));var logger=require(_0x6f8c('0x1'))(_0x6f8c('0x2'));var moment=require(_0x6f8c('0x3'));var BPromise=require(_0x6f8c('0x4'));var rp=require(_0x6f8c('0x5'));var fs=require('fs');var path=require(_0x6f8c('0x6'));var rimraf=require(_0x6f8c('0x7'));var config=require(_0x6f8c('0x8'));var attributes=require(_0x6f8c('0x9'));module[_0x6f8c('0xa')]=function(_0x206d3e,_0x566baa){return _0x206d3e[_0x6f8c('0xb')](_0x6f8c('0xc'),attributes,{'tableName':_0x6f8c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 854024d..ea441c0 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 _0x994d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x33445d,_0x4a2baf){var _0x48a9e8=function(_0x20b377){while(--_0x20b377){_0x33445d['push'](_0x33445d['shift']());}};_0x48a9e8(++_0x4a2baf);}(_0x994d,0x177));var _0xd994=function(_0x3e5768,_0x5967ac){_0x3e5768=_0x3e5768-0x0;var _0x18950e=_0x994d[_0x3e5768];return _0x18950e;};'use strict';var _=require(_0xd994('0x0'));var util=require('util');var moment=require(_0xd994('0x1'));var BPromise=require(_0xd994('0x2'));var rs=require(_0xd994('0x3'));var fs=require('fs');var Redis=require(_0xd994('0x4'));var db=require(_0xd994('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd994('0x6'))(_0xd994('0x7'));var config=require('../../config/environment');var jayson=require(_0xd994('0x8'));var client=jayson[_0xd994('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xd994('0xa')],{'host':_0xd994('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd994('0xa')]));require('./team.socket')[_0xd994('0xc')](socket);function respondWithRpcPromise(_0xbdee4a,_0x5ee6ac,_0x33e60e){return new BPromise(function(_0x318691,_0x52a580){return client[_0xd994('0xd')](_0xbdee4a,_0x33e60e)[_0xd994('0xe')](function(_0x5686d8){logger[_0xd994('0xf')](_0xd994('0x10'),_0x5ee6ac,_0xd994('0x11'));logger[_0xd994('0x12')](_0xd994('0x13'),_0x5ee6ac,_0xd994('0x11'),JSON[_0xd994('0x14')](_0x5686d8));if(_0x5686d8[_0xd994('0x15')]){if(_0x5686d8['error'][_0xd994('0x16')]===0x1f4){logger[_0xd994('0x15')](_0xd994('0x10'),_0x5ee6ac,_0x5686d8[_0xd994('0x15')][_0xd994('0x17')]);return _0x52a580(_0x5686d8[_0xd994('0x15')]['message']);}logger['error'](_0xd994('0x10'),_0x5ee6ac,_0x5686d8['error'][_0xd994('0x17')]);return _0x318691(_0x5686d8[_0xd994('0x15')]['message']);}else{logger['info'](_0xd994('0x10'),_0x5ee6ac,_0xd994('0x11'));_0x318691(_0x5686d8['result']['message']);}})[_0xd994('0x18')](function(_0x187c1d){logger[_0xd994('0x15')](_0xd994('0x10'),_0x5ee6ac,_0x187c1d);_0x52a580(_0x187c1d);});});} \ No newline at end of file +var _0x4e82=['defaults','redis','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4e82,0xe8));var _0x24e8=function(_0x4dd6c9,_0x426021){_0x4dd6c9=_0x4dd6c9-0x0;var _0x3d7ca7=_0x4e82[_0x4dd6c9];return _0x3d7ca7;};'use strict';var _=require(_0x24e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x24e8('0x1'));var rs=require(_0x24e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24e8('0x3'))['db'];var utils=require(_0x24e8('0x4'));var logger=require(_0x24e8('0x5'))(_0x24e8('0x6'));var config=require(_0x24e8('0x7'));var jayson=require(_0x24e8('0x8'));var client=jayson[_0x24e8('0x9')][_0x24e8('0xa')]({'port':0x232a});config['redis']=_[_0x24e8('0xb')](config[_0x24e8('0xc')],{'host':_0x24e8('0xd'),'port':0x18eb});var socket=require(_0x24e8('0xe'))(new Redis(config[_0x24e8('0xc')]));require(_0x24e8('0xf'))['register'](socket);function respondWithRpcPromise(_0x1e7573,_0x496753,_0xbbffa){return new BPromise(function(_0x430067,_0x389d6b){return client[_0x24e8('0x10')](_0x1e7573,_0xbbffa)[_0x24e8('0x11')](function(_0x5bd1de){logger['info'](_0x24e8('0x12'),_0x496753,'request\x20sent');logger[_0x24e8('0x13')](_0x24e8('0x14'),_0x496753,'request\x20sent',JSON[_0x24e8('0x15')](_0x5bd1de));if(_0x5bd1de[_0x24e8('0x16')]){if(_0x5bd1de[_0x24e8('0x16')][_0x24e8('0x17')]===0x1f4){logger[_0x24e8('0x16')]('Team,\x20%s,\x20%s',_0x496753,_0x5bd1de[_0x24e8('0x16')][_0x24e8('0x18')]);return _0x389d6b(_0x5bd1de[_0x24e8('0x16')][_0x24e8('0x18')]);}logger[_0x24e8('0x16')](_0x24e8('0x12'),_0x496753,_0x5bd1de[_0x24e8('0x16')][_0x24e8('0x18')]);return _0x430067(_0x5bd1de[_0x24e8('0x16')][_0x24e8('0x18')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x496753,_0x24e8('0x19'));_0x430067(_0x5bd1de['result'][_0x24e8('0x18')]);}})[_0x24e8('0x1a')](function(_0x156843){logger[_0x24e8('0x16')](_0x24e8('0x12'),_0x496753,_0x156843);_0x389d6b(_0x156843);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index aa3234e..b46108f 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 _0xfcbe=['team:','save','remove','update'];(function(_0x1c4add,_0x1141ef){var _0x2b1cc1=function(_0x2e88c7){while(--_0x2e88c7){_0x1c4add['push'](_0x1c4add['shift']());}};_0x2b1cc1(++_0x1141ef);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x5d0be3,_0x4cfb32){_0x5d0be3=_0x5d0be3-0x0;var _0x7fe5bd=_0xfcbe[_0x5d0be3];return _0x7fe5bd;};'use strict';var TeamEvents=require('./team.events');var events=[_0xefcb('0x0'),_0xefcb('0x1'),_0xefcb('0x2')];function createListener(_0x1d029d,_0x752292){return function(_0x11e156){_0x752292['emit'](_0x1d029d,_0x11e156);};}function removeListener(_0xbfb8c6,_0x14f3b5){return function(){TeamEvents['removeListener'](_0xbfb8c6,_0x14f3b5);};}exports['register']=function(_0x50dcde){for(var _0x3f322c=0x0,_0x4e15ab=events['length'];_0x3f322c<_0x4e15ab;_0x3f322c++){var _0x4697fe=events[_0x3f322c];var _0x55cad2=createListener(_0xefcb('0x3')+_0x4697fe,_0x50dcde);TeamEvents['on'](_0x4697fe,_0x55cad2);}}; \ No newline at end of file +var _0x195f=['save','update','removeListener','register','team:','./team.events'];(function(_0x50da55,_0x682ff7){var _0x195321=function(_0xf99c2e){while(--_0xf99c2e){_0x50da55['push'](_0x50da55['shift']());}};_0x195321(++_0x682ff7);}(_0x195f,0x113));var _0xf195=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x195f[_0x1b6563];return _0xdea7b8;};'use strict';var TeamEvents=require(_0xf195('0x0'));var events=[_0xf195('0x1'),'remove',_0xf195('0x2')];function createListener(_0x488dcd,_0x4d8e85){return function(_0xa41b33){_0x4d8e85['emit'](_0x488dcd,_0xa41b33);};}function removeListener(_0x127a41,_0x349605){return function(){TeamEvents[_0xf195('0x3')](_0x127a41,_0x349605);};}exports[_0xf195('0x4')]=function(_0x2c45fd){for(var _0x7aeadd=0x0,_0x2770db=events['length'];_0x7aeadd<_0x2770db;_0x7aeadd++){var _0x5eac33=events[_0x7aeadd];var _0x327cc3=createListener(_0xf195('0x5')+_0x5eac33,_0x2c45fd);TeamEvents['on'](_0x5eac33,_0x327cc3);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2001493..1fb49db 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 _0xeec8=['create','/:id','update','multer','connect-timeout','../../components/interaction/service','./template.controller','get','isAuthenticated','index','show','post'];(function(_0x1d04ad,_0x266790){var _0x3fb07f=function(_0x5ab868){while(--_0x5ab868){_0x1d04ad['push'](_0x1d04ad['shift']());}};_0x3fb07f(++_0x266790);}(_0xeec8,0x16b));var _0x8eec=function(_0x3b000c,_0xa3a56d){_0x3b000c=_0x3b000c-0x0;var _0x430655=_0xeec8[_0x3b000c];return _0x430655;};'use strict';var multer=require(_0x8eec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8eec('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8eec('0x2'));var config=require('../../config/environment');var controller=require(_0x8eec('0x3'));router[_0x8eec('0x4')]('/',auth[_0x8eec('0x5')](),controller[_0x8eec('0x6')]);router[_0x8eec('0x4')]('/:id',auth[_0x8eec('0x5')](),controller[_0x8eec('0x7')]);router[_0x8eec('0x8')]('/',auth[_0x8eec('0x5')](),controller[_0x8eec('0x9')]);router['put'](_0x8eec('0xa'),auth[_0x8eec('0x5')](),controller[_0x8eec('0xb')]);router['delete']('/:id',auth[_0x8eec('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9a27=['util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x401854,_0xf94d36){var _0x548b09=function(_0x3e3c97){while(--_0x3e3c97){_0x401854['push'](_0x401854['shift']());}};_0x548b09(++_0xf94d36);}(_0x9a27,0x186));var _0x79a2=function(_0x366ac5,_0xfdd4f1){_0x366ac5=_0x366ac5-0x0;var _0x5bc55d=_0x9a27[_0x366ac5];return _0x5bc55d;};'use strict';var multer=require(_0x79a2('0x0'));var util=require(_0x79a2('0x1'));var path=require(_0x79a2('0x2'));var timeout=require(_0x79a2('0x3'));var express=require(_0x79a2('0x4'));var router=express[_0x79a2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x79a2('0x6'));var controller=require('./template.controller');router[_0x79a2('0x7')]('/',auth[_0x79a2('0x8')](),controller[_0x79a2('0x9')]);router[_0x79a2('0x7')](_0x79a2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x79a2('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x79a2('0xc')](_0x79a2('0xa'),auth[_0x79a2('0x8')](),controller[_0x79a2('0xd')]);router[_0x79a2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x79a2('0xf')]);module[_0x79a2('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4ea19ea..eb60b54 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 _0xedd7=['exports','STRING','TEXT'];(function(_0x1e010e,_0x3e9819){var _0x378b1a=function(_0x508ae2){while(--_0x508ae2){_0x1e010e['push'](_0x1e010e['shift']());}};_0x378b1a(++_0x3e9819);}(_0xedd7,0x6f));var _0x7edd=function(_0x13ff4f,_0x4defc2){_0x13ff4f=_0x13ff4f-0x0;var _0xd04dee=_0xedd7[_0x13ff4f];return _0xd04dee;};'use strict';var Sequelize=require('sequelize');module[_0x7edd('0x0')]={'name':{'type':Sequelize[_0x7edd('0x1')]},'description':{'type':Sequelize[_0x7edd('0x1')]},'html':{'type':Sequelize[_0x7edd('0x2')]}}; \ No newline at end of file +var _0x832a=['exports','STRING'];(function(_0x3b648d,_0x33b651){var _0x3ee012=function(_0x550ba1){while(--_0x550ba1){_0x3b648d['push'](_0x3b648d['shift']());}};_0x3ee012(++_0x33b651);}(_0x832a,0x158));var _0xa832=function(_0x52a505,_0x5dec98){_0x52a505=_0x52a505-0x0;var _0x1fc95e=_0x832a[_0x52a505];return _0x1fc95e;};'use strict';var Sequelize=require('sequelize');module[_0xa832('0x0')]={'name':{'type':Sequelize[_0xa832('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 7429931..3cf6f6f 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 _0x0252=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x26cd41,_0x5238e8){var _0x20735b=function(_0x4afde4){while(--_0x4afde4){_0x26cd41['push'](_0x26cd41['shift']());}};_0x20735b(++_0x5238e8);}(_0x0252,0x13f));var _0x2025=function(_0x5e522f,_0x3d8327){_0x5e522f=_0x5e522f-0x0;var _0x279488=_0x0252[_0x5e522f];return _0x279488;};'use strict';var pdf=require(_0x2025('0x0'));var emlformat=require(_0x2025('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2025('0x2'));var jsonpatch=require(_0x2025('0x3'));var rp=require(_0x2025('0x4'));var moment=require(_0x2025('0x5'));var BPromise=require(_0x2025('0x6'));var Mustache=require(_0x2025('0x7'));var util=require(_0x2025('0x8'));var path=require(_0x2025('0x9'));var sox=require(_0x2025('0xa'));var csv=require(_0x2025('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2025('0xc'));var squel=require(_0x2025('0xd'));var crypto=require(_0x2025('0xe'));var jsforce=require(_0x2025('0xf'));var deskjs=require(_0x2025('0x10'));var toCsv=require(_0x2025('0xb'));var querystring=require('querystring');var Papa=require(_0x2025('0x11'));var Redis=require('ioredis');var authService=require(_0x2025('0x12'));var qs=require(_0x2025('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2025('0x14'));var config=require('../../config/environment');var db=require(_0x2025('0x15'))['db'];function respondWithStatusCode(_0x254de2,_0x207896){_0x207896=_0x207896||0xcc;return function(_0x26bbe9){if(_0x26bbe9){return _0x254de2['sendStatus'](_0x207896);}return _0x254de2[_0x2025('0x16')](_0x207896)[_0x2025('0x17')]();};}function respondWithResult(_0xa5737c,_0x47ee43){_0x47ee43=_0x47ee43||0xc8;return function(_0x1af008){if(_0x1af008){return _0xa5737c[_0x2025('0x16')](_0x47ee43)[_0x2025('0x18')](_0x1af008);}};}function respondWithFilteredResult(_0x246a71,_0x1559e0){return function(_0x38a5e1){if(_0x38a5e1){var _0x5aaf02=_0x38a5e1[_0x2025('0x19')],_0x36ed81=_0x1559e0[_0x2025('0x1a')],_0x38c65e=_0x1559e0[_0x2025('0x1a')]+_0x1559e0[_0x2025('0x1b')],_0x15fcb8;if(_0x38c65e>=_0x5aaf02){_0x38c65e=_0x5aaf02;_0x15fcb8=0xc8;}else{_0x15fcb8=0xce;}_0x246a71['status'](_0x15fcb8);return _0x246a71[_0x2025('0x1c')](_0x2025('0x1d'),_0x36ed81+'-'+_0x38c65e+'/'+_0x5aaf02)[_0x2025('0x18')](_0x38a5e1);}return null;};}function patchUpdates(_0x55f76c){return function(_0x111835){try{jsonpatch[_0x2025('0x1e')](_0x111835,_0x55f76c,!![]);}catch(_0x50d53a){return BPromise[_0x2025('0x1f')](_0x50d53a);}return _0x111835[_0x2025('0x20')]();};}function saveUpdates(_0x40fd7e,_0x3eef3b){return function(_0x32a0b2){if(_0x32a0b2){return _0x32a0b2[_0x2025('0x21')](_0x40fd7e)[_0x2025('0x22')](function(_0x40d6ac){return _0x40d6ac;});}return null;};}function removeEntity(_0x5893fc,_0x3ab725){return function(_0x3259aa){if(_0x3259aa){return _0x3259aa[_0x2025('0x23')]()['then'](function(){var _0x311d24=_0x3259aa[_0x2025('0x24')]({'plain':!![]});var _0x1676c8=_0x2025('0x25');return db[_0x2025('0x26')][_0x2025('0x23')]({'where':{'type':_0x1676c8,'resourceId':_0x311d24['id']}})[_0x2025('0x22')](function(){return _0x3259aa;});})[_0x2025('0x22')](function(){_0x5893fc[_0x2025('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57bfa2,_0x431a55){return function(_0x5907a8){if(!_0x5907a8){_0x57bfa2['sendStatus'](0x194);}return _0x5907a8;};}function handleError(_0x2d1c3f,_0x33553f){_0x33553f=_0x33553f||0x1f4;return function(_0x381993){logger[_0x2025('0x27')](_0x381993[_0x2025('0x28')]);if(_0x381993[_0x2025('0x29')]){delete _0x381993[_0x2025('0x29')];}_0x2d1c3f[_0x2025('0x16')](_0x33553f)[_0x2025('0x2a')](_0x381993);};}exports[_0x2025('0x2b')]=function(_0x4b1ab9,_0xb8800d){var _0x52a117={},_0x5e7f1f={},_0x10fdd3={'count':0x0,'rows':[]};var _0x2c586c=_[_0x2025('0x2c')](db[_0x2025('0x2d')][_0x2025('0x2e')],function(_0x2999ae){return{'name':_0x2999ae[_0x2025('0x2f')],'type':_0x2999ae[_0x2025('0x30')]['key']};});_0x5e7f1f[_0x2025('0x31')]=_[_0x2025('0x2c')](_0x2c586c,_0x2025('0x29'));_0x5e7f1f[_0x2025('0x32')]=_[_0x2025('0x33')](_0x4b1ab9[_0x2025('0x32')]);_0x5e7f1f[_0x2025('0x34')]=_[_0x2025('0x35')](_0x5e7f1f['model'],_0x5e7f1f[_0x2025('0x32')]);_0x52a117[_0x2025('0x36')]=_[_0x2025('0x35')](_0x5e7f1f[_0x2025('0x31')],qs[_0x2025('0x37')](_0x4b1ab9[_0x2025('0x32')]['fields']));_0x52a117[_0x2025('0x36')]=_0x52a117[_0x2025('0x36')][_0x2025('0x38')]?_0x52a117[_0x2025('0x36')]:_0x5e7f1f[_0x2025('0x31')];if(!_0x4b1ab9[_0x2025('0x32')][_0x2025('0x39')](_0x2025('0x3a'))){_0x52a117[_0x2025('0x1b')]=qs[_0x2025('0x1b')](_0x4b1ab9['query']['limit']);_0x52a117[_0x2025('0x1a')]=qs[_0x2025('0x1a')](_0x4b1ab9[_0x2025('0x32')][_0x2025('0x1a')]);}_0x52a117['order']=qs[_0x2025('0x3b')](_0x4b1ab9[_0x2025('0x32')][_0x2025('0x3b')]);_0x52a117[_0x2025('0x3c')]=qs['filters'](_[_0x2025('0x3d')](_0x4b1ab9[_0x2025('0x32')],_0x5e7f1f[_0x2025('0x34')]),_0x2c586c);if(_0x4b1ab9[_0x2025('0x32')][_0x2025('0x3e')]){_0x52a117[_0x2025('0x3c')]=_[_0x2025('0x3f')](_0x52a117['where'],{'$or':_[_0x2025('0x2c')](_0x2c586c,function(_0x33e3ea){if(_0x33e3ea[_0x2025('0x30')]!==_0x2025('0x40')){var _0x14d315={};_0x14d315[_0x33e3ea[_0x2025('0x29')]]={'$like':'%'+_0x4b1ab9[_0x2025('0x32')]['filter']+'%'};return _0x14d315;}})});}_0x52a117=_[_0x2025('0x3f')]({},_0x52a117,_0x4b1ab9['options']);var _0x1d5e3a={'where':_0x52a117[_0x2025('0x3c')]};return db[_0x2025('0x2d')][_0x2025('0x19')](_0x1d5e3a)[_0x2025('0x22')](function(_0x4fc0ac){_0x10fdd3['count']=_0x4fc0ac;if(_0x4b1ab9[_0x2025('0x32')][_0x2025('0x41')]){_0x52a117[_0x2025('0x42')]=[{'all':!![]}];}return db[_0x2025('0x2d')]['findAll'](_0x52a117);})[_0x2025('0x22')](function(_0x4643f1){_0x10fdd3[_0x2025('0x43')]=_0x4643f1;return _0x10fdd3;})[_0x2025('0x22')](respondWithFilteredResult(_0xb8800d,_0x52a117))[_0x2025('0x44')](handleError(_0xb8800d,null));};exports[_0x2025('0x45')]=function(_0x4b2095,_0x4a3b92){var _0x2636b1={'raw':!![],'where':{'id':_0x4b2095[_0x2025('0x46')]['id']}},_0x50db0f={};_0x50db0f[_0x2025('0x31')]=_['keys'](db[_0x2025('0x2d')][_0x2025('0x2e')]);_0x50db0f[_0x2025('0x32')]=_[_0x2025('0x33')](_0x4b2095[_0x2025('0x32')]);_0x50db0f[_0x2025('0x34')]=_[_0x2025('0x35')](_0x50db0f[_0x2025('0x31')],_0x50db0f[_0x2025('0x32')]);_0x2636b1[_0x2025('0x36')]=_['intersection'](_0x50db0f[_0x2025('0x31')],qs['fields'](_0x4b2095['query'][_0x2025('0x37')]));_0x2636b1[_0x2025('0x36')]=_0x2636b1[_0x2025('0x36')]['length']?_0x2636b1['attributes']:_0x50db0f[_0x2025('0x31')];if(_0x4b2095['query'][_0x2025('0x41')]){_0x2636b1[_0x2025('0x42')]=[{'all':!![]}];}_0x2636b1=_[_0x2025('0x3f')]({},_0x2636b1,_0x4b2095[_0x2025('0x47')]);return db['Template'][_0x2025('0x48')](_0x2636b1)[_0x2025('0x22')](handleEntityNotFound(_0x4a3b92,null))['then'](respondWithResult(_0x4a3b92,null))[_0x2025('0x44')](handleError(_0x4a3b92,null));};exports[_0x2025('0x49')]=function(_0x569c71,_0x24819d){return db[_0x2025('0x2d')][_0x2025('0x49')](_0x569c71[_0x2025('0x4a')],{})[_0x2025('0x22')](function(_0x2b6dc6){var _0x189bbc=_0x569c71[_0x2025('0x4b')]['get']({'plain':!![]});if(!_0x189bbc)throw new Error(_0x2025('0x4c'));if(_0x189bbc[_0x2025('0x4d')]==='user'){var _0x52aaf1=_0x2b6dc6['get']({'plain':!![]});var _0x407ea5=_0x2025('0x25');return db[_0x2025('0x4e')][_0x2025('0x48')]({'where':{'name':_0x407ea5,'userProfileId':_0x189bbc[_0x2025('0x4f')]},'raw':!![]})[_0x2025('0x22')](function(_0x36d652){if(_0x36d652&&_0x36d652['autoAssociation']===0x0){return db[_0x2025('0x26')][_0x2025('0x49')]({'name':_0x52aaf1[_0x2025('0x29')],'resourceId':_0x52aaf1['id'],'type':_0x36d652['name'],'sectionId':_0x36d652['id']},{})[_0x2025('0x22')](function(){return _0x2b6dc6;});}else{return _0x2b6dc6;}})[_0x2025('0x44')](function(_0x1cf66e){logger[_0x2025('0x27')](_0x2025('0x50'),_0x1cf66e);throw _0x1cf66e;});}return _0x2b6dc6;})[_0x2025('0x22')](respondWithResult(_0x24819d,0xc9))[_0x2025('0x44')](handleError(_0x24819d,null));};exports[_0x2025('0x21')]=function(_0x20f2db,_0x3349d5){if(_0x20f2db[_0x2025('0x4a')]['id']){delete _0x20f2db['body']['id'];}return db['Template']['find']({'where':{'id':_0x20f2db[_0x2025('0x46')]['id']}})[_0x2025('0x22')](handleEntityNotFound(_0x3349d5,null))[_0x2025('0x22')](saveUpdates(_0x20f2db[_0x2025('0x4a')],null))[_0x2025('0x22')](respondWithResult(_0x3349d5,null))[_0x2025('0x44')](handleError(_0x3349d5,null));};exports['destroy']=function(_0x565a87,_0x4d11de){return db[_0x2025('0x2d')][_0x2025('0x48')]({'where':{'id':_0x565a87['params']['id']}})[_0x2025('0x22')](handleEntityNotFound(_0x4d11de,null))[_0x2025('0x22')](removeEntity(_0x4d11de,null))[_0x2025('0x44')](handleError(_0x4d11de,null));}; \ No newline at end of file +var _0x2b93=['ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','Templates','UserProfileResource','destroy','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Template','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x1e3409,_0x45f454){var _0xb0fff7=function(_0xcd63ee){while(--_0xcd63ee){_0x1e3409['push'](_0x1e3409['shift']());}};_0xb0fff7(++_0x45f454);}(_0x2b93,0x94));var _0x32b9=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x2b93[_0x2c27ed];return _0x597bd1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32b9('0x0'));var rimraf=require(_0x32b9('0x1'));var zipdir=require(_0x32b9('0x2'));var jsonpatch=require(_0x32b9('0x3'));var rp=require(_0x32b9('0x4'));var moment=require(_0x32b9('0x5'));var BPromise=require(_0x32b9('0x6'));var Mustache=require('mustache');var util=require(_0x32b9('0x7'));var path=require('path');var sox=require(_0x32b9('0x8'));var csv=require(_0x32b9('0x9'));var ejs=require(_0x32b9('0xa'));var fs=require('fs');var _=require(_0x32b9('0xb'));var squel=require('squel');var crypto=require(_0x32b9('0xc'));var jsforce=require(_0x32b9('0xd'));var deskjs=require(_0x32b9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x32b9('0xf'));var Papa=require(_0x32b9('0x10'));var Redis=require(_0x32b9('0x11'));var authService=require(_0x32b9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x32b9('0x13'));var hardwareService=require(_0x32b9('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x32b9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf39f17,_0x85732e){_0x85732e=_0x85732e||0xcc;return function(_0x349c5b){if(_0x349c5b){return _0xf39f17[_0x32b9('0x16')](_0x85732e);}return _0xf39f17[_0x32b9('0x17')](_0x85732e)[_0x32b9('0x18')]();};}function respondWithResult(_0x4373fc,_0x484763){_0x484763=_0x484763||0xc8;return function(_0x58fc1f){if(_0x58fc1f){return _0x4373fc[_0x32b9('0x17')](_0x484763)[_0x32b9('0x19')](_0x58fc1f);}};}function respondWithFilteredResult(_0x2de4ad,_0x8ae8a6){return function(_0x364df8){if(_0x364df8){var _0x162d4a=_0x364df8[_0x32b9('0x1a')],_0x37a8ff=_0x8ae8a6[_0x32b9('0x1b')],_0x63394f=_0x8ae8a6[_0x32b9('0x1b')]+_0x8ae8a6[_0x32b9('0x1c')],_0x454d1e;if(_0x63394f>=_0x162d4a){_0x63394f=_0x162d4a;_0x454d1e=0xc8;}else{_0x454d1e=0xce;}_0x2de4ad[_0x32b9('0x17')](_0x454d1e);return _0x2de4ad['set'](_0x32b9('0x1d'),_0x37a8ff+'-'+_0x63394f+'/'+_0x162d4a)['json'](_0x364df8);}return null;};}function patchUpdates(_0x1c61ac){return function(_0x10ae95){try{jsonpatch[_0x32b9('0x1e')](_0x10ae95,_0x1c61ac,!![]);}catch(_0x2b237d){return BPromise[_0x32b9('0x1f')](_0x2b237d);}return _0x10ae95[_0x32b9('0x20')]();};}function saveUpdates(_0x5d0b61,_0x7b2e22){return function(_0x5978b1){if(_0x5978b1){return _0x5978b1[_0x32b9('0x21')](_0x5d0b61)[_0x32b9('0x22')](function(_0x21040e){return _0x21040e;});}return null;};}function removeEntity(_0x5c3b69,_0x319697){return function(_0x22f33b){if(_0x22f33b){return _0x22f33b['destroy']()[_0x32b9('0x22')](function(){var _0x42b53e=_0x22f33b['get']({'plain':!![]});var _0xf310a2=_0x32b9('0x23');return db[_0x32b9('0x24')][_0x32b9('0x25')]({'where':{'type':_0xf310a2,'resourceId':_0x42b53e['id']}})[_0x32b9('0x22')](function(){return _0x22f33b;});})[_0x32b9('0x22')](function(){_0x5c3b69[_0x32b9('0x17')](0xcc)[_0x32b9('0x18')]();});}};}function handleEntityNotFound(_0x42a823,_0x11cce8){return function(_0x5dad3e){if(!_0x5dad3e){_0x42a823[_0x32b9('0x16')](0x194);}return _0x5dad3e;};}function handleError(_0x5507df,_0x5098f4){_0x5098f4=_0x5098f4||0x1f4;return function(_0x22ee63){logger[_0x32b9('0x26')](_0x22ee63[_0x32b9('0x27')]);if(_0x22ee63[_0x32b9('0x28')]){delete _0x22ee63['name'];}_0x5507df[_0x32b9('0x17')](_0x5098f4)['send'](_0x22ee63);};}exports['index']=function(_0x37ce74,_0xd035d){var _0x1b1f2b={},_0x21a2c={},_0x1c0770={'count':0x0,'rows':[]};var _0x3101bd=_[_0x32b9('0x29')](db['Template'][_0x32b9('0x2a')],function(_0x24eb22){return{'name':_0x24eb22[_0x32b9('0x2b')],'type':_0x24eb22['type'][_0x32b9('0x2c')]};});_0x21a2c[_0x32b9('0x2d')]=_[_0x32b9('0x29')](_0x3101bd,_0x32b9('0x28'));_0x21a2c[_0x32b9('0x2e')]=_['keys'](_0x37ce74[_0x32b9('0x2e')]);_0x21a2c[_0x32b9('0x2f')]=_[_0x32b9('0x30')](_0x21a2c[_0x32b9('0x2d')],_0x21a2c['query']);_0x1b1f2b['attributes']=_[_0x32b9('0x30')](_0x21a2c['model'],qs[_0x32b9('0x31')](_0x37ce74['query'][_0x32b9('0x31')]));_0x1b1f2b[_0x32b9('0x32')]=_0x1b1f2b['attributes'][_0x32b9('0x33')]?_0x1b1f2b[_0x32b9('0x32')]:_0x21a2c[_0x32b9('0x2d')];if(!_0x37ce74[_0x32b9('0x2e')]['hasOwnProperty'](_0x32b9('0x34'))){_0x1b1f2b['limit']=qs[_0x32b9('0x1c')](_0x37ce74['query'][_0x32b9('0x1c')]);_0x1b1f2b[_0x32b9('0x1b')]=qs[_0x32b9('0x1b')](_0x37ce74[_0x32b9('0x2e')][_0x32b9('0x1b')]);}_0x1b1f2b[_0x32b9('0x35')]=qs[_0x32b9('0x36')](_0x37ce74[_0x32b9('0x2e')][_0x32b9('0x36')]);_0x1b1f2b[_0x32b9('0x37')]=qs['filters'](_[_0x32b9('0x38')](_0x37ce74['query'],_0x21a2c[_0x32b9('0x2f')]),_0x3101bd);if(_0x37ce74[_0x32b9('0x2e')][_0x32b9('0x39')]){_0x1b1f2b['where']=_[_0x32b9('0x3a')](_0x1b1f2b[_0x32b9('0x37')],{'$or':_[_0x32b9('0x29')](_0x3101bd,function(_0x2203bd){if(_0x2203bd[_0x32b9('0x3b')]!==_0x32b9('0x3c')){var _0x1e28e2={};_0x1e28e2[_0x2203bd[_0x32b9('0x28')]]={'$like':'%'+_0x37ce74['query'][_0x32b9('0x39')]+'%'};return _0x1e28e2;}})});}_0x1b1f2b=_[_0x32b9('0x3a')]({},_0x1b1f2b,_0x37ce74[_0x32b9('0x3d')]);var _0x4a3029={'where':_0x1b1f2b[_0x32b9('0x37')]};return db[_0x32b9('0x3e')][_0x32b9('0x1a')](_0x4a3029)['then'](function(_0x459fe5){_0x1c0770[_0x32b9('0x1a')]=_0x459fe5;if(_0x37ce74[_0x32b9('0x2e')][_0x32b9('0x3f')]){_0x1b1f2b[_0x32b9('0x40')]=[{'all':!![]}];}return db[_0x32b9('0x3e')][_0x32b9('0x41')](_0x1b1f2b);})[_0x32b9('0x22')](function(_0x529092){_0x1c0770[_0x32b9('0x42')]=_0x529092;return _0x1c0770;})[_0x32b9('0x22')](respondWithFilteredResult(_0xd035d,_0x1b1f2b))['catch'](handleError(_0xd035d,null));};exports[_0x32b9('0x43')]=function(_0x53a554,_0x1e1d56){var _0x124a78={'raw':!![],'where':{'id':_0x53a554[_0x32b9('0x44')]['id']}},_0x44cf49={};_0x44cf49[_0x32b9('0x2d')]=_[_0x32b9('0x45')](db[_0x32b9('0x3e')][_0x32b9('0x2a')]);_0x44cf49[_0x32b9('0x2e')]=_['keys'](_0x53a554['query']);_0x44cf49['filters']=_[_0x32b9('0x30')](_0x44cf49[_0x32b9('0x2d')],_0x44cf49[_0x32b9('0x2e')]);_0x124a78[_0x32b9('0x32')]=_[_0x32b9('0x30')](_0x44cf49[_0x32b9('0x2d')],qs[_0x32b9('0x31')](_0x53a554[_0x32b9('0x2e')][_0x32b9('0x31')]));_0x124a78['attributes']=_0x124a78[_0x32b9('0x32')][_0x32b9('0x33')]?_0x124a78[_0x32b9('0x32')]:_0x44cf49[_0x32b9('0x2d')];if(_0x53a554[_0x32b9('0x2e')]['includeAll']){_0x124a78['include']=[{'all':!![]}];}_0x124a78=_[_0x32b9('0x3a')]({},_0x124a78,_0x53a554['options']);return db[_0x32b9('0x3e')]['find'](_0x124a78)[_0x32b9('0x22')](handleEntityNotFound(_0x1e1d56,null))[_0x32b9('0x22')](respondWithResult(_0x1e1d56,null))[_0x32b9('0x46')](handleError(_0x1e1d56,null));};exports[_0x32b9('0x47')]=function(_0x1c6a7a,_0x5c674a){return db[_0x32b9('0x3e')][_0x32b9('0x47')](_0x1c6a7a[_0x32b9('0x48')],{})[_0x32b9('0x22')](function(_0x13456f){var _0x554782=_0x1c6a7a[_0x32b9('0x49')][_0x32b9('0x4a')]({'plain':!![]});if(!_0x554782)throw new Error(_0x32b9('0x4b'));if(_0x554782[_0x32b9('0x4c')]===_0x32b9('0x49')){var _0x1d0a8a=_0x13456f[_0x32b9('0x4a')]({'plain':!![]});var _0x33e5a4=_0x32b9('0x23');return db[_0x32b9('0x4d')]['find']({'where':{'name':_0x33e5a4,'userProfileId':_0x554782['userProfileId']},'raw':!![]})[_0x32b9('0x22')](function(_0x4dae98){if(_0x4dae98&&_0x4dae98['autoAssociation']===0x0){return db[_0x32b9('0x24')][_0x32b9('0x47')]({'name':_0x1d0a8a[_0x32b9('0x28')],'resourceId':_0x1d0a8a['id'],'type':_0x4dae98[_0x32b9('0x28')],'sectionId':_0x4dae98['id']},{})[_0x32b9('0x22')](function(){return _0x13456f;});}else{return _0x13456f;}})['catch'](function(_0xbec049){logger[_0x32b9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbec049);throw _0xbec049;});}return _0x13456f;})[_0x32b9('0x22')](respondWithResult(_0x5c674a,0xc9))['catch'](handleError(_0x5c674a,null));};exports[_0x32b9('0x21')]=function(_0x503987,_0x4078fa){if(_0x503987[_0x32b9('0x48')]['id']){delete _0x503987[_0x32b9('0x48')]['id'];}return db[_0x32b9('0x3e')][_0x32b9('0x4e')]({'where':{'id':_0x503987['params']['id']}})[_0x32b9('0x22')](handleEntityNotFound(_0x4078fa,null))[_0x32b9('0x22')](saveUpdates(_0x503987[_0x32b9('0x48')],null))['then'](respondWithResult(_0x4078fa,null))[_0x32b9('0x46')](handleError(_0x4078fa,null));};exports[_0x32b9('0x25')]=function(_0x299d89,_0xae8e70){return db[_0x32b9('0x3e')][_0x32b9('0x4e')]({'where':{'id':_0x299d89['params']['id']}})[_0x32b9('0x22')](handleEntityNotFound(_0xae8e70,null))[_0x32b9('0x22')](removeEntity(_0xae8e70,null))[_0x32b9('0x46')](handleError(_0xae8e70,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3eec925..4d00d20 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 _0x2514=['Template','lodash','../../config/logger','api','bluebird','path','rimraf','./template.attributes','exports'];(function(_0x4f02ac,_0x5b385e){var _0x463598=function(_0x1bf373){while(--_0x1bf373){_0x4f02ac['push'](_0x4f02ac['shift']());}};_0x463598(++_0x5b385e);}(_0x2514,0x17b));var _0x4251=function(_0x1f8dd6,_0x2667bb){_0x1f8dd6=_0x1f8dd6-0x0;var _0x3b3529=_0x2514[_0x1f8dd6];return _0x3b3529;};'use strict';var _=require(_0x4251('0x0'));var util=require('util');var logger=require(_0x4251('0x1'))(_0x4251('0x2'));var moment=require('moment');var BPromise=require(_0x4251('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4251('0x4'));var rimraf=require(_0x4251('0x5'));var config=require('../../config/environment');var attributes=require(_0x4251('0x6'));module[_0x4251('0x7')]=function(_0x191832,_0x1c28a8){return _0x191832['define'](_0x4251('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9d2=['./template.attributes','define','Template','tools_templates','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x78ac8e,_0x34f635){var _0x242d93=function(_0x1660b0){while(--_0x1660b0){_0x78ac8e['push'](_0x78ac8e['shift']());}};_0x242d93(++_0x34f635);}(_0xb9d2,0x12d));var _0x2b9d=function(_0x48f0de,_0x4ab07d){_0x48f0de=_0x48f0de-0x0;var _0x43185b=_0xb9d2[_0x48f0de];return _0x43185b;};'use strict';var _=require(_0x2b9d('0x0'));var util=require('util');var logger=require(_0x2b9d('0x1'))(_0x2b9d('0x2'));var moment=require(_0x2b9d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b9d('0x4'));var rimraf=require(_0x2b9d('0x5'));var config=require(_0x2b9d('0x6'));var attributes=require(_0x2b9d('0x7'));module['exports']=function(_0x312ac6,_0x459f9e){return _0x312ac6[_0x2b9d('0x8')](_0x2b9d('0x9'),attributes,{'tableName':_0x2b9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 9239ec3..4b3cd5d 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 _0xcc34=['debug','error','code','message','result','catch','GetTemplate','Template','findAll','options','where','limit','map','attributes','include','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x4473be,_0x529ba7){var _0x4a2ede=function(_0x422651){while(--_0x422651){_0x4473be['push'](_0x4473be['shift']());}};_0x4a2ede(++_0x529ba7);}(_0xcc34,0x6d));var _0x4cc3=function(_0x50baff,_0x3b63de){_0x50baff=_0x50baff-0x0;var _0x254b5a=_0xcc34[_0x50baff];return _0x254b5a;};'use strict';var _=require(_0x4cc3('0x0'));var util=require(_0x4cc3('0x1'));var moment=require(_0x4cc3('0x2'));var BPromise=require(_0x4cc3('0x3'));var rs=require(_0x4cc3('0x4'));var fs=require('fs');var Redis=require(_0x4cc3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cc3('0x6'));var logger=require(_0x4cc3('0x7'))(_0x4cc3('0x8'));var config=require(_0x4cc3('0x9'));var jayson=require(_0x4cc3('0xa'));var client=jayson['client'][_0x4cc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4acdd8,_0x2f1714,_0x363b0d){return new BPromise(function(_0x185961,_0x74389b){return client['request'](_0x4acdd8,_0x363b0d)['then'](function(_0x324105){logger[_0x4cc3('0xc')](_0x4cc3('0xd'),_0x2f1714,_0x4cc3('0xe'));logger[_0x4cc3('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x2f1714,_0x4cc3('0xe'),JSON['stringify'](_0x324105));if(_0x324105[_0x4cc3('0x10')]){if(_0x324105['error'][_0x4cc3('0x11')]===0x1f4){logger[_0x4cc3('0x10')]('Template,\x20%s,\x20%s',_0x2f1714,_0x324105['error'][_0x4cc3('0x12')]);return _0x74389b(_0x324105[_0x4cc3('0x10')][_0x4cc3('0x12')]);}logger['error'](_0x4cc3('0xd'),_0x2f1714,_0x324105[_0x4cc3('0x10')][_0x4cc3('0x12')]);return _0x185961(_0x324105[_0x4cc3('0x10')][_0x4cc3('0x12')]);}else{logger[_0x4cc3('0xc')](_0x4cc3('0xd'),_0x2f1714,_0x4cc3('0xe'));_0x185961(_0x324105[_0x4cc3('0x13')][_0x4cc3('0x12')]);}})[_0x4cc3('0x14')](function(_0x1957fa){logger[_0x4cc3('0x10')]('Template,\x20%s,\x20%s',_0x2f1714,_0x1957fa);_0x74389b(_0x1957fa);});});}exports[_0x4cc3('0x15')]=function(_0x21895a){var _0x5c8864=this;return new Promise(function(_0x316831,_0x435352){return db[_0x4cc3('0x16')][_0x4cc3('0x17')]({'raw':_0x21895a[_0x4cc3('0x18')]?_0x21895a['options']['raw']===undefined?!![]:![]:!![],'where':_0x21895a[_0x4cc3('0x18')]?_0x21895a[_0x4cc3('0x18')][_0x4cc3('0x19')]||null:null,'attributes':_0x21895a['options']?_0x21895a[_0x4cc3('0x18')]['attributes']||null:null,'limit':_0x21895a[_0x4cc3('0x18')]?_0x21895a[_0x4cc3('0x18')][_0x4cc3('0x1a')]||null:null,'include':_0x21895a[_0x4cc3('0x18')]?_0x21895a[_0x4cc3('0x18')]['include']?_[_0x4cc3('0x1b')](_0x21895a[_0x4cc3('0x18')]['include'],function(_0x336eb2){return{'model':db[_0x336eb2['model']],'as':_0x336eb2['as'],'attributes':_0x336eb2[_0x4cc3('0x1c')],'include':_0x336eb2[_0x4cc3('0x1d')]?_[_0x4cc3('0x1b')](_0x336eb2['include'],function(_0x571de1){return{'model':db[_0x571de1['model']],'as':_0x571de1['as'],'attributes':_0x571de1[_0x4cc3('0x1c')],'include':_0x571de1['include']?_[_0x4cc3('0x1b')](_0x571de1[_0x4cc3('0x1d')],function(_0x3f7cd2){return{'model':db[_0x3f7cd2['model']],'as':_0x3f7cd2['as'],'attributes':_0x3f7cd2[_0x4cc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4cc3('0x1e')](function(_0x2e95be){logger['info'](_0x4cc3('0x15'),_0x21895a);logger[_0x4cc3('0xf')](_0x4cc3('0x15'),_0x21895a,JSON['stringify'](_0x2e95be));_0x316831(_0x2e95be);})[_0x4cc3('0x14')](function(_0x1c5777){logger[_0x4cc3('0x10')](_0x4cc3('0x15'),_0x1c5777[_0x4cc3('0x12')],_0x21895a);_0x435352(_0x5c8864[_0x4cc3('0x10')](0x1f4,_0x1c5777['message']));});});}; \ No newline at end of file +var _0x517d=['result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x369cd2,_0x29d7f1){var _0x3751d8=function(_0x2bf885){while(--_0x2bf885){_0x369cd2['push'](_0x369cd2['shift']());}};_0x3751d8(++_0x29d7f1);}(_0x517d,0x181));var _0xd517=function(_0x1e2061,_0x1ac12a){_0x1e2061=_0x1e2061-0x0;var _0xa75b01=_0x517d[_0x1e2061];return _0xa75b01;};'use strict';var _=require(_0xd517('0x0'));var util=require(_0xd517('0x1'));var moment=require(_0xd517('0x2'));var BPromise=require(_0xd517('0x3'));var rs=require(_0xd517('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd517('0x5'))(_0xd517('0x6'));var config=require('../../config/environment');var jayson=require(_0xd517('0x7'));var client=jayson[_0xd517('0x8')][_0xd517('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ed569,_0x1de29a,_0x98465b){return new BPromise(function(_0x17e5ab,_0x3bec24){return client[_0xd517('0xa')](_0x1ed569,_0x98465b)[_0xd517('0xb')](function(_0x8fb804){logger[_0xd517('0xc')](_0xd517('0xd'),_0x1de29a,_0xd517('0xe'));logger[_0xd517('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x1de29a,_0xd517('0xe'),JSON['stringify'](_0x8fb804));if(_0x8fb804[_0xd517('0x10')]){if(_0x8fb804[_0xd517('0x10')]['code']===0x1f4){logger['error'](_0xd517('0xd'),_0x1de29a,_0x8fb804['error'][_0xd517('0x11')]);return _0x3bec24(_0x8fb804[_0xd517('0x10')][_0xd517('0x11')]);}logger[_0xd517('0x10')](_0xd517('0xd'),_0x1de29a,_0x8fb804[_0xd517('0x10')][_0xd517('0x11')]);return _0x17e5ab(_0x8fb804[_0xd517('0x10')]['message']);}else{logger[_0xd517('0xc')](_0xd517('0xd'),_0x1de29a,'request\x20sent');_0x17e5ab(_0x8fb804[_0xd517('0x12')][_0xd517('0x11')]);}})[_0xd517('0x13')](function(_0x2a182a){logger['error'](_0xd517('0xd'),_0x1de29a,_0x2a182a);_0x3bec24(_0x2a182a);});});}exports[_0xd517('0x14')]=function(_0x1edaab){var _0xdb3d64=this;return new Promise(function(_0x914072,_0x2d52ab){return db[_0xd517('0x15')][_0xd517('0x16')]({'raw':_0x1edaab[_0xd517('0x17')]?_0x1edaab['options'][_0xd517('0x18')]===undefined?!![]:![]:!![],'where':_0x1edaab[_0xd517('0x17')]?_0x1edaab[_0xd517('0x17')]['where']||null:null,'attributes':_0x1edaab['options']?_0x1edaab[_0xd517('0x17')][_0xd517('0x19')]||null:null,'limit':_0x1edaab['options']?_0x1edaab[_0xd517('0x17')][_0xd517('0x1a')]||null:null,'include':_0x1edaab[_0xd517('0x17')]?_0x1edaab[_0xd517('0x17')][_0xd517('0x1b')]?_[_0xd517('0x1c')](_0x1edaab['options'][_0xd517('0x1b')],function(_0xdcdd59){return{'model':db[_0xdcdd59[_0xd517('0x1d')]],'as':_0xdcdd59['as'],'attributes':_0xdcdd59[_0xd517('0x19')],'include':_0xdcdd59[_0xd517('0x1b')]?_['map'](_0xdcdd59[_0xd517('0x1b')],function(_0x43f7fe){return{'model':db[_0x43f7fe['model']],'as':_0x43f7fe['as'],'attributes':_0x43f7fe['attributes'],'include':_0x43f7fe[_0xd517('0x1b')]?_[_0xd517('0x1c')](_0x43f7fe[_0xd517('0x1b')],function(_0xed6131){return{'model':db[_0xed6131[_0xd517('0x1d')]],'as':_0xed6131['as'],'attributes':_0xed6131['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x449246){logger[_0xd517('0xc')](_0xd517('0x14'),_0x1edaab);logger['debug']('GetTemplate',_0x1edaab,JSON[_0xd517('0x1e')](_0x449246));_0x914072(_0x449246);})['catch'](function(_0x272697){logger[_0xd517('0x10')](_0xd517('0x14'),_0x272697[_0xd517('0x11')],_0x1edaab);_0x2d52ab(_0xdb3d64[_0xd517('0x10')](0x1f4,_0x272697[_0xd517('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c009b45..fc80a51 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 _0xea6a=['./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','create','post','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update','delete','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xea6a,0x122));var _0xaea6=function(_0x36ea50,_0x237c1c){_0x36ea50=_0x36ea50-0x0;var _0x16914a=_0xea6a[_0x36ea50];return _0x16914a;};'use strict';var multer=require(_0xaea6('0x0'));var util=require(_0xaea6('0x1'));var path=require(_0xaea6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaea6('0x3')]();var auth=require(_0xaea6('0x4'));var interaction=require(_0xaea6('0x5'));var config=require(_0xaea6('0x6'));var controller=require(_0xaea6('0x7'));router[_0xaea6('0x8')]('/',auth[_0xaea6('0x9')](),controller[_0xaea6('0xa')]);router['get']('/:id',auth[_0xaea6('0x9')](),controller[_0xaea6('0xb')]);router['get'](_0xaea6('0xc'),auth[_0xaea6('0x9')](),controller[_0xaea6('0xd')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xaea6('0xe')]);router['get']('/:id/actions',auth[_0xaea6('0x9')](),controller[_0xaea6('0xf')]);router['post']('/',auth[_0xaea6('0x9')](),controller[_0xaea6('0x10')]);router[_0xaea6('0x11')](_0xaea6('0xc'),auth[_0xaea6('0x9')](),controller[_0xaea6('0x12')]);router[_0xaea6('0x11')](_0xaea6('0x13'),auth[_0xaea6('0x9')](),controller[_0xaea6('0x14')]);router[_0xaea6('0x11')]('/:id/actions',auth[_0xaea6('0x9')](),controller[_0xaea6('0x15')]);router['put']('/:id',auth[_0xaea6('0x9')](),controller[_0xaea6('0x16')]);router[_0xaea6('0x17')](_0xaea6('0x18'),auth['isAuthenticated'](),controller[_0xaea6('0x19')]);module[_0xaea6('0x1a')]=router; \ No newline at end of file +var _0xc778=['put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','show','isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAllCondition','addAnyCondition','addAction'];(function(_0x2532ee,_0x4fc580){var _0x3bfa21=function(_0x3e0c1b){while(--_0x3e0c1b){_0x2532ee['push'](_0x2532ee['shift']());}};_0x3bfa21(++_0x4fc580);}(_0xc778,0x125));var _0x8c77=function(_0x5411f8,_0x5335e3){_0x5411f8=_0x5411f8-0x0;var _0x5f003e=_0xc778[_0x5411f8];return _0x5f003e;};'use strict';var multer=require(_0x8c77('0x0'));var util=require(_0x8c77('0x1'));var path=require(_0x8c77('0x2'));var timeout=require(_0x8c77('0x3'));var express=require(_0x8c77('0x4'));var router=express[_0x8c77('0x5')]();var auth=require(_0x8c77('0x6'));var interaction=require(_0x8c77('0x7'));var config=require(_0x8c77('0x8'));var controller=require(_0x8c77('0x9'));router[_0x8c77('0xa')]('/',auth['isAuthenticated'](),controller[_0x8c77('0xb')]);router[_0x8c77('0xa')](_0x8c77('0xc'),auth['isAuthenticated'](),controller[_0x8c77('0xd')]);router[_0x8c77('0xa')]('/:id/all_conditions',auth[_0x8c77('0xe')](),controller[_0x8c77('0xf')]);router[_0x8c77('0xa')](_0x8c77('0x10'),auth[_0x8c77('0xe')](),controller[_0x8c77('0x11')]);router['get'](_0x8c77('0x12'),auth[_0x8c77('0xe')](),controller[_0x8c77('0x13')]);router['post']('/',auth[_0x8c77('0xe')](),controller[_0x8c77('0x14')]);router[_0x8c77('0x15')](_0x8c77('0x16'),auth[_0x8c77('0xe')](),controller[_0x8c77('0x17')]);router['post'](_0x8c77('0x10'),auth[_0x8c77('0xe')](),controller[_0x8c77('0x18')]);router[_0x8c77('0x15')](_0x8c77('0x12'),auth[_0x8c77('0xe')](),controller[_0x8c77('0x19')]);router[_0x8c77('0x1a')](_0x8c77('0xc'),auth['isAuthenticated'](),controller[_0x8c77('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8c77('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b0942e2..ae689f2 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 _0xd108=['exports','STRING','BOOLEAN','sequelize'];(function(_0xcb0eb2,_0x3906bf){var _0xbab9b8=function(_0x24fa8a){while(--_0x24fa8a){_0xcb0eb2['push'](_0xcb0eb2['shift']());}};_0xbab9b8(++_0x3906bf);}(_0xd108,0xbb));var _0x8d10=function(_0x49e734,_0xc04f4f){_0x49e734=_0x49e734-0x0;var _0x2a2d42=_0xd108[_0x49e734];return _0x2a2d42;};'use strict';var Sequelize=require(_0x8d10('0x0'));module[_0x8d10('0x1')]={'name':{'type':Sequelize[_0x8d10('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d10('0x2')]},'status':{'type':Sequelize[_0x8d10('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc92c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2358dc,_0xf1b827){var _0x929b09=function(_0x3e67b7){while(--_0x3e67b7){_0x2358dc['push'](_0x2358dc['shift']());}};_0x929b09(++_0xf1b827);}(_0xc92c,0x14c));var _0xcc92=function(_0x4260d6,_0x44f9c7){_0x4260d6=_0x4260d6-0x0;var _0x489728=_0xc92c[_0x4260d6];return _0x489728;};'use strict';var Sequelize=require(_0xcc92('0x0'));module[_0xcc92('0x1')]={'name':{'type':Sequelize[_0xcc92('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcc92('0x2')]},'status':{'type':Sequelize[_0xcc92('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 01198df..805345e 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 _0x50d6=['type','key','model','map','keys','intersection','query','fields','attributes','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','nolimit','getAnyConditions','findOne','addAction','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','Trigger','rawAttributes','fieldName'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x50d6,0x19c));var _0x650d=function(_0x52c856,_0x47fd69){_0x52c856=_0x52c856-0x0;var _0x41f172=_0x50d6[_0x52c856];return _0x41f172;};'use strict';var pdf=require(_0x650d('0x0'));var emlformat=require(_0x650d('0x1'));var rimraf=require(_0x650d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x650d('0x3'));var rp=require(_0x650d('0x4'));var moment=require(_0x650d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x650d('0x6'));var util=require(_0x650d('0x7'));var path=require(_0x650d('0x8'));var sox=require(_0x650d('0x9'));var csv=require(_0x650d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x650d('0xb'));var squel=require('squel');var crypto=require(_0x650d('0xc'));var jsforce=require(_0x650d('0xd'));var deskjs=require(_0x650d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x650d('0xf'));var Papa=require(_0x650d('0x10'));var Redis=require('ioredis');var authService=require(_0x650d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x650d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x650d('0x13'));var utils=require(_0x650d('0x14'));var config=require(_0x650d('0x15'));var db=require(_0x650d('0x16'))['db'];function respondWithStatusCode(_0x134a2f,_0x5162b6){_0x5162b6=_0x5162b6||0xcc;return function(_0x185572){if(_0x185572){return _0x134a2f[_0x650d('0x17')](_0x5162b6);}return _0x134a2f[_0x650d('0x18')](_0x5162b6)[_0x650d('0x19')]();};}function respondWithResult(_0x1b4631,_0xb0eeb9){_0xb0eeb9=_0xb0eeb9||0xc8;return function(_0x1a22a0){if(_0x1a22a0){return _0x1b4631[_0x650d('0x18')](_0xb0eeb9)['json'](_0x1a22a0);}};}function respondWithFilteredResult(_0x44797f,_0x401d38){return function(_0x455d19){if(_0x455d19){var _0x3e4174=_0x455d19[_0x650d('0x1a')],_0x14a0f7=_0x401d38[_0x650d('0x1b')],_0x600e2d=_0x401d38[_0x650d('0x1b')]+_0x401d38[_0x650d('0x1c')],_0x527346;if(_0x600e2d>=_0x3e4174){_0x600e2d=_0x3e4174;_0x527346=0xc8;}else{_0x527346=0xce;}_0x44797f[_0x650d('0x18')](_0x527346);return _0x44797f['set']('Content-Range',_0x14a0f7+'-'+_0x600e2d+'/'+_0x3e4174)['json'](_0x455d19);}return null;};}function patchUpdates(_0x29f9ae){return function(_0x5eee75){try{jsonpatch[_0x650d('0x1d')](_0x5eee75,_0x29f9ae,!![]);}catch(_0x25cf30){return BPromise[_0x650d('0x1e')](_0x25cf30);}return _0x5eee75[_0x650d('0x1f')]();};}function saveUpdates(_0x54f4c0,_0x193f6e){return function(_0xd35a75){if(_0xd35a75){return _0xd35a75[_0x650d('0x20')](_0x54f4c0)['then'](function(_0x583ada){return _0x583ada;});}return null;};}function removeEntity(_0x3077c2,_0x3abff0){return function(_0x592579){if(_0x592579){return _0x592579['destroy']()[_0x650d('0x21')](function(){var _0x1440d9=_0x592579['get']({'plain':!![]});var _0x5d4476='Triggers';return db['UserProfileResource'][_0x650d('0x22')]({'where':{'type':_0x5d4476,'resourceId':_0x1440d9['id']}})[_0x650d('0x21')](function(){return _0x592579;});})[_0x650d('0x21')](function(){_0x3077c2[_0x650d('0x18')](0xcc)[_0x650d('0x19')]();});}};}function handleEntityNotFound(_0x1944bb,_0x519422){return function(_0x49c55e){if(!_0x49c55e){_0x1944bb['sendStatus'](0x194);}return _0x49c55e;};}function handleError(_0x1f1c26,_0x5bde1a){_0x5bde1a=_0x5bde1a||0x1f4;return function(_0x37a2c0){logger[_0x650d('0x23')](_0x37a2c0[_0x650d('0x24')]);if(_0x37a2c0[_0x650d('0x25')]){delete _0x37a2c0[_0x650d('0x25')];}_0x1f1c26['status'](_0x5bde1a)[_0x650d('0x26')](_0x37a2c0);};}exports[_0x650d('0x27')]=function(_0x99c4de,_0x4c69af){var _0x27f332={},_0x2aab26={},_0x2a63b2={'count':0x0,'rows':[]};var _0x256261=_['map'](db[_0x650d('0x28')][_0x650d('0x29')],function(_0x46836a){return{'name':_0x46836a[_0x650d('0x2a')],'type':_0x46836a[_0x650d('0x2b')][_0x650d('0x2c')]};});_0x2aab26[_0x650d('0x2d')]=_[_0x650d('0x2e')](_0x256261,'name');_0x2aab26['query']=_[_0x650d('0x2f')](_0x99c4de['query']);_0x2aab26['filters']=_[_0x650d('0x30')](_0x2aab26[_0x650d('0x2d')],_0x2aab26[_0x650d('0x31')]);_0x27f332['attributes']=_[_0x650d('0x30')](_0x2aab26['model'],qs[_0x650d('0x32')](_0x99c4de[_0x650d('0x31')][_0x650d('0x32')]));_0x27f332['attributes']=_0x27f332[_0x650d('0x33')]['length']?_0x27f332[_0x650d('0x33')]:_0x2aab26[_0x650d('0x2d')];if(!_0x99c4de[_0x650d('0x31')][_0x650d('0x34')]('nolimit')){_0x27f332[_0x650d('0x1c')]=qs[_0x650d('0x1c')](_0x99c4de[_0x650d('0x31')][_0x650d('0x1c')]);_0x27f332[_0x650d('0x1b')]=qs[_0x650d('0x1b')](_0x99c4de[_0x650d('0x31')]['offset']);}_0x27f332[_0x650d('0x35')]=qs[_0x650d('0x36')](_0x99c4de[_0x650d('0x31')][_0x650d('0x36')]);_0x27f332['where']=qs[_0x650d('0x37')](_[_0x650d('0x38')](_0x99c4de[_0x650d('0x31')],_0x2aab26[_0x650d('0x37')]),_0x256261);if(_0x99c4de['query'][_0x650d('0x39')]){_0x27f332['where']=_[_0x650d('0x3a')](_0x27f332[_0x650d('0x3b')],{'$or':_[_0x650d('0x2e')](_0x256261,function(_0x90885a){if(_0x90885a[_0x650d('0x2b')]!==_0x650d('0x3c')){var _0xd6b1ff={};_0xd6b1ff[_0x90885a[_0x650d('0x25')]]={'$like':'%'+_0x99c4de[_0x650d('0x31')]['filter']+'%'};return _0xd6b1ff;}})});}_0x27f332=_['merge']({},_0x27f332,_0x99c4de[_0x650d('0x3d')]);var _0x1612d2={'where':_0x27f332['where']};return db[_0x650d('0x28')][_0x650d('0x1a')](_0x1612d2)[_0x650d('0x21')](function(_0x2ee145){_0x2a63b2['count']=_0x2ee145;if(_0x99c4de[_0x650d('0x31')][_0x650d('0x3e')]){_0x27f332[_0x650d('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0x650d('0x40')](_0x27f332);})[_0x650d('0x21')](function(_0x4568f1){_0x2a63b2[_0x650d('0x41')]=_0x4568f1;return _0x2a63b2;})[_0x650d('0x21')](respondWithFilteredResult(_0x4c69af,_0x27f332))[_0x650d('0x42')](handleError(_0x4c69af,null));};exports['show']=function(_0x5769dd,_0x50851e){var _0x5bd132={'raw':![],'where':{'id':_0x5769dd[_0x650d('0x43')]['id']}},_0x5f2606={};_0x5f2606[_0x650d('0x2d')]=_[_0x650d('0x2f')](db['Trigger'][_0x650d('0x29')]);_0x5f2606['query']=_[_0x650d('0x2f')](_0x5769dd['query']);_0x5f2606['filters']=_[_0x650d('0x30')](_0x5f2606[_0x650d('0x2d')],_0x5f2606[_0x650d('0x31')]);_0x5bd132['attributes']=_[_0x650d('0x30')](_0x5f2606[_0x650d('0x2d')],qs[_0x650d('0x32')](_0x5769dd['query']['fields']));_0x5bd132[_0x650d('0x33')]=_0x5bd132[_0x650d('0x33')][_0x650d('0x44')]?_0x5bd132[_0x650d('0x33')]:_0x5f2606[_0x650d('0x2d')];if(_0x5769dd[_0x650d('0x31')]['includeAll']){_0x5bd132[_0x650d('0x3f')]=[{'all':!![]}];}_0x5bd132=_[_0x650d('0x3a')]({},_0x5bd132,_0x5769dd['options']);return db[_0x650d('0x28')][_0x650d('0x45')](_0x5bd132)[_0x650d('0x21')](handleEntityNotFound(_0x50851e,null))[_0x650d('0x21')](respondWithResult(_0x50851e,null))[_0x650d('0x42')](handleError(_0x50851e,null));};exports['create']=function(_0x3c72da,_0x32555f){return db[_0x650d('0x28')][_0x650d('0x46')](_0x3c72da['body'],{})[_0x650d('0x21')](function(_0x49f180){var _0x571f2b=_0x3c72da[_0x650d('0x47')][_0x650d('0x48')]({'plain':!![]});if(!_0x571f2b)throw new Error(_0x650d('0x49'));if(_0x571f2b[_0x650d('0x4a')]==='user'){var _0x26ec0a=_0x49f180['get']({'plain':!![]});var _0x13bb82=_0x650d('0x4b');return db[_0x650d('0x4c')][_0x650d('0x45')]({'where':{'name':_0x13bb82,'userProfileId':_0x571f2b[_0x650d('0x4d')]},'raw':!![]})['then'](function(_0x3bfa4b){if(_0x3bfa4b&&_0x3bfa4b[_0x650d('0x4e')]===0x0){return db[_0x650d('0x4f')][_0x650d('0x46')]({'name':_0x26ec0a[_0x650d('0x25')],'resourceId':_0x26ec0a['id'],'type':_0x3bfa4b[_0x650d('0x25')],'sectionId':_0x3bfa4b['id']},{})[_0x650d('0x21')](function(){return _0x49f180;});}else{return _0x49f180;}})['catch'](function(_0x36e119){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e119);throw _0x36e119;});}return _0x49f180;})[_0x650d('0x21')](respondWithResult(_0x32555f,0xc9))[_0x650d('0x42')](handleError(_0x32555f,null));};exports[_0x650d('0x20')]=function(_0x4dee10,_0x3fa32){if(_0x4dee10[_0x650d('0x50')]['id']){delete _0x4dee10['body']['id'];}return db[_0x650d('0x28')]['find']({'where':{'id':_0x4dee10[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x3fa32,null))[_0x650d('0x21')](saveUpdates(_0x4dee10[_0x650d('0x50')],null))[_0x650d('0x21')](respondWithResult(_0x3fa32,null))['catch'](handleError(_0x3fa32,null));};exports[_0x650d('0x22')]=function(_0x5ed30d,_0x1be736){return db['Trigger'][_0x650d('0x45')]({'where':{'id':_0x5ed30d['params']['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x1be736,null))[_0x650d('0x21')](removeEntity(_0x1be736,null))[_0x650d('0x42')](handleError(_0x1be736,null));};exports[_0x650d('0x51')]=function(_0x3afa39,_0x288f4d,_0x2da944){if(_0x3afa39[_0x650d('0x50')]['id']){delete _0x3afa39[_0x650d('0x50')]['id'];}return db[_0x650d('0x28')][_0x650d('0x45')]({'where':{'id':_0x3afa39[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x288f4d,null))[_0x650d('0x21')](function(_0x128595){if(_0x128595){_0x3afa39[_0x650d('0x50')]['TriggerAllId']=_0x128595['id'];return db[_0x650d('0x52')]['create'](_0x3afa39[_0x650d('0x50')]);}})[_0x650d('0x21')](respondWithResult(_0x288f4d,null))[_0x650d('0x42')](handleError(_0x288f4d,null));};exports[_0x650d('0x53')]=function(_0x4131aa,_0x3011b7,_0x36e5e5){if(_0x4131aa[_0x650d('0x50')]['id']){delete _0x4131aa[_0x650d('0x50')]['id'];}return db[_0x650d('0x28')][_0x650d('0x45')]({'where':{'id':_0x4131aa[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x3011b7,null))['then'](function(_0x58abfc){if(_0x58abfc){_0x4131aa['body'][_0x650d('0x54')]=_0x58abfc['id'];return db['Condition'][_0x650d('0x46')](_0x4131aa[_0x650d('0x50')]);}})[_0x650d('0x21')](respondWithResult(_0x3011b7,null))['catch'](handleError(_0x3011b7,null));};exports[_0x650d('0x55')]=function(_0x5ce256,_0x22e378,_0x267cbb){var _0x50dd27={};var _0x82c22d={};var _0x4fa223;var _0x153c28;return db[_0x650d('0x28')]['findOne']({'where':{'id':_0x5ce256[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x22e378,null))[_0x650d('0x21')](function(_0x5ae931){if(_0x5ae931){_0x4fa223=_0x5ae931;_0x82c22d['model']=_[_0x650d('0x2f')](db[_0x650d('0x52')][_0x650d('0x29')]);_0x82c22d[_0x650d('0x31')]=_[_0x650d('0x2f')](_0x5ce256[_0x650d('0x31')]);_0x82c22d['filters']=_[_0x650d('0x30')](_0x82c22d[_0x650d('0x2d')],_0x82c22d[_0x650d('0x31')]);_0x50dd27[_0x650d('0x33')]=_[_0x650d('0x30')](_0x82c22d[_0x650d('0x2d')],qs[_0x650d('0x32')](_0x5ce256[_0x650d('0x31')][_0x650d('0x32')]));_0x50dd27['attributes']=_0x50dd27[_0x650d('0x33')][_0x650d('0x44')]?_0x50dd27['attributes']:_0x82c22d[_0x650d('0x2d')];_0x50dd27['order']=qs[_0x650d('0x36')](_0x5ce256[_0x650d('0x31')][_0x650d('0x36')]);_0x50dd27[_0x650d('0x3b')]=qs[_0x650d('0x37')](_['pick'](_0x5ce256[_0x650d('0x31')],_0x82c22d[_0x650d('0x37')]));if(_0x5ce256[_0x650d('0x31')][_0x650d('0x39')]){_0x50dd27[_0x650d('0x3b')]=_[_0x650d('0x3a')](_0x50dd27[_0x650d('0x3b')],{'$or':_[_0x650d('0x2e')](_0x50dd27['attributes'],function(_0x5731f8){var _0x4cb64d={};_0x4cb64d[_0x5731f8]={'$like':'%'+_0x5ce256[_0x650d('0x31')][_0x650d('0x39')]+'%'};return _0x4cb64d;})});}_0x50dd27=_[_0x650d('0x3a')]({},_0x50dd27,_0x5ce256['options']);return _0x4fa223[_0x650d('0x55')](_0x50dd27);}})['then'](function(_0x376d55){if(_0x376d55){_0x153c28=_0x376d55[_0x650d('0x44')];if(!_0x5ce256[_0x650d('0x31')]['hasOwnProperty'](_0x650d('0x56'))){_0x50dd27[_0x650d('0x1c')]=qs[_0x650d('0x1c')](_0x5ce256[_0x650d('0x31')][_0x650d('0x1c')]);_0x50dd27[_0x650d('0x1b')]=qs['offset'](_0x5ce256[_0x650d('0x31')]['offset']);}return _0x4fa223[_0x650d('0x55')](_0x50dd27);}})[_0x650d('0x21')](function(_0x4790ba){if(_0x4790ba){return _0x4790ba?{'count':_0x153c28,'rows':_0x4790ba}:null;}})[_0x650d('0x21')](respondWithResult(_0x22e378,null))[_0x650d('0x42')](handleError(_0x22e378,null));};exports[_0x650d('0x57')]=function(_0x59d834,_0x330c89,_0x2f1a89){var _0x2ec6ba={};var _0x11b302={};var _0xbbeca7;var _0x1cd59f;return db[_0x650d('0x28')][_0x650d('0x58')]({'where':{'id':_0x59d834[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x330c89,null))['then'](function(_0x5d6fdb){if(_0x5d6fdb){_0xbbeca7=_0x5d6fdb;_0x11b302['model']=_['keys'](db['Condition'][_0x650d('0x29')]);_0x11b302['query']=_[_0x650d('0x2f')](_0x59d834[_0x650d('0x31')]);_0x11b302[_0x650d('0x37')]=_[_0x650d('0x30')](_0x11b302[_0x650d('0x2d')],_0x11b302['query']);_0x2ec6ba[_0x650d('0x33')]=_[_0x650d('0x30')](_0x11b302[_0x650d('0x2d')],qs['fields'](_0x59d834[_0x650d('0x31')]['fields']));_0x2ec6ba[_0x650d('0x33')]=_0x2ec6ba[_0x650d('0x33')]['length']?_0x2ec6ba[_0x650d('0x33')]:_0x11b302[_0x650d('0x2d')];_0x2ec6ba[_0x650d('0x35')]=qs[_0x650d('0x36')](_0x59d834['query'][_0x650d('0x36')]);_0x2ec6ba[_0x650d('0x3b')]=qs[_0x650d('0x37')](_[_0x650d('0x38')](_0x59d834[_0x650d('0x31')],_0x11b302[_0x650d('0x37')]));if(_0x59d834[_0x650d('0x31')]['filter']){_0x2ec6ba[_0x650d('0x3b')]=_[_0x650d('0x3a')](_0x2ec6ba['where'],{'$or':_[_0x650d('0x2e')](_0x2ec6ba[_0x650d('0x33')],function(_0x18b46a){var _0x473c2e={};_0x473c2e[_0x18b46a]={'$like':'%'+_0x59d834['query'][_0x650d('0x39')]+'%'};return _0x473c2e;})});}_0x2ec6ba=_[_0x650d('0x3a')]({},_0x2ec6ba,_0x59d834[_0x650d('0x3d')]);return _0xbbeca7[_0x650d('0x57')](_0x2ec6ba);}})[_0x650d('0x21')](function(_0x8aa710){if(_0x8aa710){_0x1cd59f=_0x8aa710[_0x650d('0x44')];if(!_0x59d834[_0x650d('0x31')][_0x650d('0x34')]('nolimit')){_0x2ec6ba[_0x650d('0x1c')]=qs['limit'](_0x59d834[_0x650d('0x31')][_0x650d('0x1c')]);_0x2ec6ba[_0x650d('0x1b')]=qs[_0x650d('0x1b')](_0x59d834[_0x650d('0x31')][_0x650d('0x1b')]);}return _0xbbeca7['getAnyConditions'](_0x2ec6ba);}})[_0x650d('0x21')](function(_0x91ba1a){if(_0x91ba1a){return _0x91ba1a?{'count':_0x1cd59f,'rows':_0x91ba1a}:null;}})[_0x650d('0x21')](respondWithResult(_0x330c89,null))[_0x650d('0x42')](handleError(_0x330c89,null));};exports[_0x650d('0x59')]=function(_0x8722ed,_0x4b381a,_0x137f10){if(_0x8722ed['body']['id']){delete _0x8722ed[_0x650d('0x50')]['id'];}return db[_0x650d('0x28')][_0x650d('0x45')]({'where':{'id':_0x8722ed[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x4b381a,null))[_0x650d('0x21')](function(_0x295a8d){if(_0x295a8d){_0x8722ed[_0x650d('0x50')]['TriggerId']=_0x295a8d['id'];return db['Action'][_0x650d('0x46')](_0x8722ed[_0x650d('0x50')]);}})[_0x650d('0x21')](respondWithResult(_0x4b381a,null))[_0x650d('0x42')](handleError(_0x4b381a,null));};exports[_0x650d('0x5a')]=function(_0x1a046e,_0x6402a,_0x2422cf){var _0x3b8eb1={};var _0x19e44d={};var _0x347a73;var _0x35d94c;return db[_0x650d('0x28')][_0x650d('0x58')]({'where':{'id':_0x1a046e[_0x650d('0x43')]['id']}})[_0x650d('0x21')](handleEntityNotFound(_0x6402a,null))[_0x650d('0x21')](function(_0x158b4c){if(_0x158b4c){_0x347a73=_0x158b4c;_0x19e44d[_0x650d('0x2d')]=_[_0x650d('0x2f')](db['Action'][_0x650d('0x29')]);_0x19e44d[_0x650d('0x31')]=_['keys'](_0x1a046e['query']);_0x19e44d[_0x650d('0x37')]=_['intersection'](_0x19e44d['model'],_0x19e44d[_0x650d('0x31')]);_0x3b8eb1[_0x650d('0x33')]=_['intersection'](_0x19e44d[_0x650d('0x2d')],qs['fields'](_0x1a046e[_0x650d('0x31')][_0x650d('0x32')]));_0x3b8eb1[_0x650d('0x33')]=_0x3b8eb1[_0x650d('0x33')][_0x650d('0x44')]?_0x3b8eb1[_0x650d('0x33')]:_0x19e44d['model'];_0x3b8eb1[_0x650d('0x35')]=qs['sort'](_0x1a046e[_0x650d('0x31')][_0x650d('0x36')]);_0x3b8eb1['where']=qs[_0x650d('0x37')](_[_0x650d('0x38')](_0x1a046e['query'],_0x19e44d[_0x650d('0x37')]));if(_0x1a046e[_0x650d('0x31')][_0x650d('0x39')]){_0x3b8eb1[_0x650d('0x3b')]=_[_0x650d('0x3a')](_0x3b8eb1[_0x650d('0x3b')],{'$or':_['map'](_0x3b8eb1[_0x650d('0x33')],function(_0x257148){var _0x266218={};_0x266218[_0x257148]={'$like':'%'+_0x1a046e[_0x650d('0x31')]['filter']+'%'};return _0x266218;})});}_0x3b8eb1=_[_0x650d('0x3a')]({},_0x3b8eb1,_0x1a046e[_0x650d('0x3d')]);return _0x347a73[_0x650d('0x5a')](_0x3b8eb1);}})[_0x650d('0x21')](function(_0x3cc97d){if(_0x3cc97d){_0x35d94c=_0x3cc97d[_0x650d('0x44')];if(!_0x1a046e[_0x650d('0x31')]['hasOwnProperty']('nolimit')){_0x3b8eb1['limit']=qs[_0x650d('0x1c')](_0x1a046e[_0x650d('0x31')]['limit']);_0x3b8eb1['offset']=qs[_0x650d('0x1b')](_0x1a046e[_0x650d('0x31')][_0x650d('0x1b')]);}return _0x347a73[_0x650d('0x5a')](_0x3b8eb1);}})[_0x650d('0x21')](function(_0x17f0a1){if(_0x17f0a1){return _0x17f0a1?{'count':_0x35d94c,'rows':_0x17f0a1}:null;}})[_0x650d('0x21')](respondWithResult(_0x6402a,null))[_0x650d('0x42')](handleError(_0x6402a,null));}; \ No newline at end of file +var _0x08cc=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','Triggers','error','stack','name','index','map','Trigger','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','params','rawAttributes','intersection','includeAll','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','keys','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x19973d,_0x1bf449){var _0x34acbc=function(_0x4901d7){while(--_0x4901d7){_0x19973d['push'](_0x19973d['shift']());}};_0x34acbc(++_0x1bf449);}(_0x08cc,0x1ba));var _0xc08c=function(_0x250a4c,_0x1e7220){_0x250a4c=_0x250a4c-0x0;var _0x3ff33d=_0x08cc[_0x250a4c];return _0x3ff33d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc08c('0x0'));var zipdir=require(_0xc08c('0x1'));var jsonpatch=require(_0xc08c('0x2'));var rp=require(_0xc08c('0x3'));var moment=require(_0xc08c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc08c('0x5'));var util=require('util');var path=require(_0xc08c('0x6'));var sox=require(_0xc08c('0x7'));var csv=require(_0xc08c('0x8'));var ejs=require(_0xc08c('0x9'));var fs=require('fs');var _=require(_0xc08c('0xa'));var squel=require(_0xc08c('0xb'));var crypto=require(_0xc08c('0xc'));var jsforce=require(_0xc08c('0xd'));var deskjs=require(_0xc08c('0xe'));var toCsv=require(_0xc08c('0x8'));var querystring=require(_0xc08c('0xf'));var Papa=require(_0xc08c('0x10'));var Redis=require(_0xc08c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc08c('0x12'));var as=require(_0xc08c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc08c('0x14'))(_0xc08c('0x15'));var utils=require('../../config/utils');var config=require(_0xc08c('0x16'));var db=require(_0xc08c('0x17'))['db'];function respondWithStatusCode(_0x5a56b3,_0x731281){_0x731281=_0x731281||0xcc;return function(_0xb4ba87){if(_0xb4ba87){return _0x5a56b3[_0xc08c('0x18')](_0x731281);}return _0x5a56b3['status'](_0x731281)[_0xc08c('0x19')]();};}function respondWithResult(_0x31e2be,_0x5d1e40){_0x5d1e40=_0x5d1e40||0xc8;return function(_0x3f802a){if(_0x3f802a){return _0x31e2be['status'](_0x5d1e40)[_0xc08c('0x1a')](_0x3f802a);}};}function respondWithFilteredResult(_0x1621aa,_0x43bb42){return function(_0x42f82a){if(_0x42f82a){var _0x5dce04=_0x42f82a[_0xc08c('0x1b')],_0xff8ca8=_0x43bb42[_0xc08c('0x1c')],_0x2fbf30=_0x43bb42[_0xc08c('0x1c')]+_0x43bb42[_0xc08c('0x1d')],_0x15dd51;if(_0x2fbf30>=_0x5dce04){_0x2fbf30=_0x5dce04;_0x15dd51=0xc8;}else{_0x15dd51=0xce;}_0x1621aa[_0xc08c('0x1e')](_0x15dd51);return _0x1621aa[_0xc08c('0x1f')](_0xc08c('0x20'),_0xff8ca8+'-'+_0x2fbf30+'/'+_0x5dce04)['json'](_0x42f82a);}return null;};}function patchUpdates(_0xd439f){return function(_0x604975){try{jsonpatch[_0xc08c('0x21')](_0x604975,_0xd439f,!![]);}catch(_0x52913c){return BPromise['reject'](_0x52913c);}return _0x604975[_0xc08c('0x22')]();};}function saveUpdates(_0x59af5e,_0x55e63f){return function(_0x6cfae1){if(_0x6cfae1){return _0x6cfae1[_0xc08c('0x23')](_0x59af5e)[_0xc08c('0x24')](function(_0x830b11){return _0x830b11;});}return null;};}function removeEntity(_0x452611,_0x5268f1){return function(_0x38d037){if(_0x38d037){return _0x38d037[_0xc08c('0x25')]()[_0xc08c('0x24')](function(){var _0x551e32=_0x38d037['get']({'plain':!![]});var _0x2de4e2=_0xc08c('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x2de4e2,'resourceId':_0x551e32['id']}})[_0xc08c('0x24')](function(){return _0x38d037;});})[_0xc08c('0x24')](function(){_0x452611['status'](0xcc)[_0xc08c('0x19')]();});}};}function handleEntityNotFound(_0x5704dc,_0x4f55fb){return function(_0xcdcf3d){if(!_0xcdcf3d){_0x5704dc[_0xc08c('0x18')](0x194);}return _0xcdcf3d;};}function handleError(_0x11a767,_0x53f69b){_0x53f69b=_0x53f69b||0x1f4;return function(_0x1cbdf6){logger[_0xc08c('0x27')](_0x1cbdf6[_0xc08c('0x28')]);if(_0x1cbdf6[_0xc08c('0x29')]){delete _0x1cbdf6[_0xc08c('0x29')];}_0x11a767['status'](_0x53f69b)['send'](_0x1cbdf6);};}exports[_0xc08c('0x2a')]=function(_0x4c187c,_0x395805){var _0x4a3a34={},_0x139400={},_0x40c02b={'count':0x0,'rows':[]};var _0x1efcd7=_[_0xc08c('0x2b')](db[_0xc08c('0x2c')]['rawAttributes'],function(_0xe996e0){return{'name':_0xe996e0['fieldName'],'type':_0xe996e0[_0xc08c('0x2d')]['key']};});_0x139400[_0xc08c('0x2e')]=_[_0xc08c('0x2b')](_0x1efcd7,'name');_0x139400[_0xc08c('0x2f')]=_['keys'](_0x4c187c[_0xc08c('0x2f')]);_0x139400[_0xc08c('0x30')]=_['intersection'](_0x139400[_0xc08c('0x2e')],_0x139400[_0xc08c('0x2f')]);_0x4a3a34['attributes']=_['intersection'](_0x139400['model'],qs[_0xc08c('0x31')](_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x4a3a34[_0xc08c('0x32')]=_0x4a3a34[_0xc08c('0x32')][_0xc08c('0x33')]?_0x4a3a34[_0xc08c('0x32')]:_0x139400[_0xc08c('0x2e')];if(!_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x34')](_0xc08c('0x35'))){_0x4a3a34[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x1d')]);_0x4a3a34[_0xc08c('0x1c')]=qs['offset'](_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x1c')]);}_0x4a3a34[_0xc08c('0x36')]=qs['sort'](_0x4c187c['query'][_0xc08c('0x37')]);_0x4a3a34['where']=qs['filters'](_[_0xc08c('0x38')](_0x4c187c[_0xc08c('0x2f')],_0x139400[_0xc08c('0x30')]),_0x1efcd7);if(_0x4c187c['query'][_0xc08c('0x39')]){_0x4a3a34[_0xc08c('0x3a')]=_[_0xc08c('0x3b')](_0x4a3a34['where'],{'$or':_[_0xc08c('0x2b')](_0x1efcd7,function(_0x5be1fb){if(_0x5be1fb[_0xc08c('0x2d')]!=='VIRTUAL'){var _0x1327d2={};_0x1327d2[_0x5be1fb['name']]={'$like':'%'+_0x4c187c[_0xc08c('0x2f')][_0xc08c('0x39')]+'%'};return _0x1327d2;}})});}_0x4a3a34=_[_0xc08c('0x3b')]({},_0x4a3a34,_0x4c187c[_0xc08c('0x3c')]);var _0x59b703={'where':_0x4a3a34['where']};return db[_0xc08c('0x2c')]['count'](_0x59b703)[_0xc08c('0x24')](function(_0x4be9bc){_0x40c02b[_0xc08c('0x1b')]=_0x4be9bc;if(_0x4c187c['query']['includeAll']){_0x4a3a34[_0xc08c('0x3d')]=[{'all':!![]}];}return db['Trigger'][_0xc08c('0x3e')](_0x4a3a34);})['then'](function(_0x1eca4d){_0x40c02b[_0xc08c('0x3f')]=_0x1eca4d;return _0x40c02b;})['then'](respondWithFilteredResult(_0x395805,_0x4a3a34))['catch'](handleError(_0x395805,null));};exports['show']=function(_0xaab9d9,_0x3efc6e){var _0x481498={'raw':![],'where':{'id':_0xaab9d9[_0xc08c('0x40')]['id']}},_0x1e6e3e={};_0x1e6e3e[_0xc08c('0x2e')]=_['keys'](db[_0xc08c('0x2c')][_0xc08c('0x41')]);_0x1e6e3e[_0xc08c('0x2f')]=_['keys'](_0xaab9d9[_0xc08c('0x2f')]);_0x1e6e3e[_0xc08c('0x30')]=_[_0xc08c('0x42')](_0x1e6e3e['model'],_0x1e6e3e['query']);_0x481498[_0xc08c('0x32')]=_[_0xc08c('0x42')](_0x1e6e3e[_0xc08c('0x2e')],qs[_0xc08c('0x31')](_0xaab9d9[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x481498[_0xc08c('0x32')]=_0x481498[_0xc08c('0x32')][_0xc08c('0x33')]?_0x481498[_0xc08c('0x32')]:_0x1e6e3e['model'];if(_0xaab9d9[_0xc08c('0x2f')][_0xc08c('0x43')]){_0x481498[_0xc08c('0x3d')]=[{'all':!![]}];}_0x481498=_[_0xc08c('0x3b')]({},_0x481498,_0xaab9d9[_0xc08c('0x3c')]);return db[_0xc08c('0x2c')][_0xc08c('0x44')](_0x481498)[_0xc08c('0x24')](handleEntityNotFound(_0x3efc6e,null))[_0xc08c('0x24')](respondWithResult(_0x3efc6e,null))[_0xc08c('0x45')](handleError(_0x3efc6e,null));};exports['create']=function(_0x4ccdbd,_0x4f330f){return db['Trigger'][_0xc08c('0x46')](_0x4ccdbd[_0xc08c('0x47')],{})[_0xc08c('0x24')](function(_0xb07560){var _0x46cc8b=_0x4ccdbd['user'][_0xc08c('0x48')]({'plain':!![]});if(!_0x46cc8b)throw new Error(_0xc08c('0x49'));if(_0x46cc8b[_0xc08c('0x4a')]==='user'){var _0x82336d=_0xb07560['get']({'plain':!![]});var _0x306bb7=_0xc08c('0x26');return db[_0xc08c('0x4b')][_0xc08c('0x44')]({'where':{'name':_0x306bb7,'userProfileId':_0x46cc8b[_0xc08c('0x4c')]},'raw':!![]})[_0xc08c('0x24')](function(_0x5f9c4c){if(_0x5f9c4c&&_0x5f9c4c[_0xc08c('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x82336d[_0xc08c('0x29')],'resourceId':_0x82336d['id'],'type':_0x5f9c4c[_0xc08c('0x29')],'sectionId':_0x5f9c4c['id']},{})['then'](function(){return _0xb07560;});}else{return _0xb07560;}})['catch'](function(_0x2e450f){logger['error'](_0xc08c('0x4e'),_0x2e450f);throw _0x2e450f;});}return _0xb07560;})[_0xc08c('0x24')](respondWithResult(_0x4f330f,0xc9))[_0xc08c('0x45')](handleError(_0x4f330f,null));};exports['update']=function(_0x51f117,_0x2d8e84){if(_0x51f117['body']['id']){delete _0x51f117[_0xc08c('0x47')]['id'];}return db['Trigger'][_0xc08c('0x44')]({'where':{'id':_0x51f117[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x2d8e84,null))[_0xc08c('0x24')](saveUpdates(_0x51f117[_0xc08c('0x47')],null))[_0xc08c('0x24')](respondWithResult(_0x2d8e84,null))[_0xc08c('0x45')](handleError(_0x2d8e84,null));};exports[_0xc08c('0x25')]=function(_0x1a70ae,_0x541742){return db[_0xc08c('0x2c')][_0xc08c('0x44')]({'where':{'id':_0x1a70ae[_0xc08c('0x40')]['id']}})['then'](handleEntityNotFound(_0x541742,null))['then'](removeEntity(_0x541742,null))[_0xc08c('0x45')](handleError(_0x541742,null));};exports[_0xc08c('0x4f')]=function(_0x2d3190,_0x21aba6,_0x315df8){if(_0x2d3190['body']['id']){delete _0x2d3190[_0xc08c('0x47')]['id'];}return db[_0xc08c('0x2c')][_0xc08c('0x44')]({'where':{'id':_0x2d3190[_0xc08c('0x40')]['id']}})['then'](handleEntityNotFound(_0x21aba6,null))[_0xc08c('0x24')](function(_0x30d5e5){if(_0x30d5e5){_0x2d3190['body']['TriggerAllId']=_0x30d5e5['id'];return db[_0xc08c('0x50')][_0xc08c('0x46')](_0x2d3190[_0xc08c('0x47')]);}})[_0xc08c('0x24')](respondWithResult(_0x21aba6,null))[_0xc08c('0x45')](handleError(_0x21aba6,null));};exports[_0xc08c('0x51')]=function(_0x55e328,_0x1117e5,_0x199155){if(_0x55e328['body']['id']){delete _0x55e328['body']['id'];}return db['Trigger'][_0xc08c('0x44')]({'where':{'id':_0x55e328[_0xc08c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1117e5,null))[_0xc08c('0x24')](function(_0x28fab5){if(_0x28fab5){_0x55e328[_0xc08c('0x47')][_0xc08c('0x52')]=_0x28fab5['id'];return db[_0xc08c('0x50')][_0xc08c('0x46')](_0x55e328[_0xc08c('0x47')]);}})[_0xc08c('0x24')](respondWithResult(_0x1117e5,null))[_0xc08c('0x45')](handleError(_0x1117e5,null));};exports['getAllConditions']=function(_0x10e380,_0x1de777,_0x54a8e3){var _0x386bc8={};var _0x39b820={};var _0x4fd1c;var _0x7ea515;return db['Trigger'][_0xc08c('0x53')]({'where':{'id':_0x10e380[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x1de777,null))[_0xc08c('0x24')](function(_0x48d9fe){if(_0x48d9fe){_0x4fd1c=_0x48d9fe;_0x39b820[_0xc08c('0x2e')]=_[_0xc08c('0x54')](db['Condition'][_0xc08c('0x41')]);_0x39b820[_0xc08c('0x2f')]=_[_0xc08c('0x54')](_0x10e380[_0xc08c('0x2f')]);_0x39b820['filters']=_[_0xc08c('0x42')](_0x39b820[_0xc08c('0x2e')],_0x39b820[_0xc08c('0x2f')]);_0x386bc8[_0xc08c('0x32')]=_[_0xc08c('0x42')](_0x39b820['model'],qs[_0xc08c('0x31')](_0x10e380[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x386bc8[_0xc08c('0x32')]=_0x386bc8[_0xc08c('0x32')][_0xc08c('0x33')]?_0x386bc8[_0xc08c('0x32')]:_0x39b820[_0xc08c('0x2e')];_0x386bc8['order']=qs[_0xc08c('0x37')](_0x10e380['query'][_0xc08c('0x37')]);_0x386bc8[_0xc08c('0x3a')]=qs[_0xc08c('0x30')](_[_0xc08c('0x38')](_0x10e380[_0xc08c('0x2f')],_0x39b820['filters']));if(_0x10e380[_0xc08c('0x2f')]['filter']){_0x386bc8[_0xc08c('0x3a')]=_['merge'](_0x386bc8[_0xc08c('0x3a')],{'$or':_['map'](_0x386bc8[_0xc08c('0x32')],function(_0x3c926d){var _0x38466b={};_0x38466b[_0x3c926d]={'$like':'%'+_0x10e380['query'][_0xc08c('0x39')]+'%'};return _0x38466b;})});}_0x386bc8=_[_0xc08c('0x3b')]({},_0x386bc8,_0x10e380[_0xc08c('0x3c')]);return _0x4fd1c[_0xc08c('0x55')](_0x386bc8);}})[_0xc08c('0x24')](function(_0x53f95f){if(_0x53f95f){_0x7ea515=_0x53f95f[_0xc08c('0x33')];if(!_0x10e380[_0xc08c('0x2f')]['hasOwnProperty'](_0xc08c('0x35'))){_0x386bc8[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x10e380[_0xc08c('0x2f')][_0xc08c('0x1d')]);_0x386bc8[_0xc08c('0x1c')]=qs['offset'](_0x10e380[_0xc08c('0x2f')][_0xc08c('0x1c')]);}return _0x4fd1c[_0xc08c('0x55')](_0x386bc8);}})['then'](function(_0xa02026){if(_0xa02026){return _0xa02026?{'count':_0x7ea515,'rows':_0xa02026}:null;}})[_0xc08c('0x24')](respondWithResult(_0x1de777,null))[_0xc08c('0x45')](handleError(_0x1de777,null));};exports['getAnyConditions']=function(_0x391d46,_0x16c31b,_0x2f36c5){var _0xb8370c={};var _0x208270={};var _0x23eebf;var _0x13c99a;return db[_0xc08c('0x2c')]['findOne']({'where':{'id':_0x391d46[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x16c31b,null))[_0xc08c('0x24')](function(_0x4cd8a7){if(_0x4cd8a7){_0x23eebf=_0x4cd8a7;_0x208270['model']=_['keys'](db['Condition'][_0xc08c('0x41')]);_0x208270[_0xc08c('0x2f')]=_[_0xc08c('0x54')](_0x391d46[_0xc08c('0x2f')]);_0x208270['filters']=_[_0xc08c('0x42')](_0x208270[_0xc08c('0x2e')],_0x208270[_0xc08c('0x2f')]);_0xb8370c['attributes']=_[_0xc08c('0x42')](_0x208270[_0xc08c('0x2e')],qs[_0xc08c('0x31')](_0x391d46[_0xc08c('0x2f')][_0xc08c('0x31')]));_0xb8370c['attributes']=_0xb8370c['attributes'][_0xc08c('0x33')]?_0xb8370c[_0xc08c('0x32')]:_0x208270[_0xc08c('0x2e')];_0xb8370c[_0xc08c('0x36')]=qs[_0xc08c('0x37')](_0x391d46['query'][_0xc08c('0x37')]);_0xb8370c[_0xc08c('0x3a')]=qs['filters'](_[_0xc08c('0x38')](_0x391d46['query'],_0x208270['filters']));if(_0x391d46['query'][_0xc08c('0x39')]){_0xb8370c['where']=_[_0xc08c('0x3b')](_0xb8370c[_0xc08c('0x3a')],{'$or':_[_0xc08c('0x2b')](_0xb8370c['attributes'],function(_0x54e3f6){var _0x2b58db={};_0x2b58db[_0x54e3f6]={'$like':'%'+_0x391d46[_0xc08c('0x2f')][_0xc08c('0x39')]+'%'};return _0x2b58db;})});}_0xb8370c=_[_0xc08c('0x3b')]({},_0xb8370c,_0x391d46['options']);return _0x23eebf[_0xc08c('0x56')](_0xb8370c);}})[_0xc08c('0x24')](function(_0x233242){if(_0x233242){_0x13c99a=_0x233242[_0xc08c('0x33')];if(!_0x391d46[_0xc08c('0x2f')][_0xc08c('0x34')]('nolimit')){_0xb8370c[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x391d46['query']['limit']);_0xb8370c[_0xc08c('0x1c')]=qs[_0xc08c('0x1c')](_0x391d46[_0xc08c('0x2f')][_0xc08c('0x1c')]);}return _0x23eebf[_0xc08c('0x56')](_0xb8370c);}})['then'](function(_0x8f3f31){if(_0x8f3f31){return _0x8f3f31?{'count':_0x13c99a,'rows':_0x8f3f31}:null;}})[_0xc08c('0x24')](respondWithResult(_0x16c31b,null))[_0xc08c('0x45')](handleError(_0x16c31b,null));};exports[_0xc08c('0x57')]=function(_0x5e5ce5,_0xaa83c4,_0x31fc11){if(_0x5e5ce5[_0xc08c('0x47')]['id']){delete _0x5e5ce5[_0xc08c('0x47')]['id'];}return db[_0xc08c('0x2c')][_0xc08c('0x44')]({'where':{'id':_0x5e5ce5[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0xaa83c4,null))[_0xc08c('0x24')](function(_0x577fc8){if(_0x577fc8){_0x5e5ce5[_0xc08c('0x47')][_0xc08c('0x58')]=_0x577fc8['id'];return db[_0xc08c('0x59')][_0xc08c('0x46')](_0x5e5ce5[_0xc08c('0x47')]);}})[_0xc08c('0x24')](respondWithResult(_0xaa83c4,null))[_0xc08c('0x45')](handleError(_0xaa83c4,null));};exports[_0xc08c('0x5a')]=function(_0x1bd635,_0x4fa2cd,_0x3ee8e0){var _0x37fe41={};var _0x4b62a4={};var _0x1aee66;var _0x1b8251;return db[_0xc08c('0x2c')][_0xc08c('0x53')]({'where':{'id':_0x1bd635[_0xc08c('0x40')]['id']}})[_0xc08c('0x24')](handleEntityNotFound(_0x4fa2cd,null))['then'](function(_0xeebbba){if(_0xeebbba){_0x1aee66=_0xeebbba;_0x4b62a4[_0xc08c('0x2e')]=_['keys'](db[_0xc08c('0x59')][_0xc08c('0x41')]);_0x4b62a4[_0xc08c('0x2f')]=_[_0xc08c('0x54')](_0x1bd635[_0xc08c('0x2f')]);_0x4b62a4[_0xc08c('0x30')]=_[_0xc08c('0x42')](_0x4b62a4[_0xc08c('0x2e')],_0x4b62a4[_0xc08c('0x2f')]);_0x37fe41[_0xc08c('0x32')]=_[_0xc08c('0x42')](_0x4b62a4['model'],qs[_0xc08c('0x31')](_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x31')]));_0x37fe41[_0xc08c('0x32')]=_0x37fe41[_0xc08c('0x32')][_0xc08c('0x33')]?_0x37fe41[_0xc08c('0x32')]:_0x4b62a4['model'];_0x37fe41[_0xc08c('0x36')]=qs['sort'](_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x37')]);_0x37fe41[_0xc08c('0x3a')]=qs[_0xc08c('0x30')](_['pick'](_0x1bd635['query'],_0x4b62a4[_0xc08c('0x30')]));if(_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x39')]){_0x37fe41['where']=_[_0xc08c('0x3b')](_0x37fe41['where'],{'$or':_[_0xc08c('0x2b')](_0x37fe41[_0xc08c('0x32')],function(_0x4af94c){var _0x5820c9={};_0x5820c9[_0x4af94c]={'$like':'%'+_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x39')]+'%'};return _0x5820c9;})});}_0x37fe41=_[_0xc08c('0x3b')]({},_0x37fe41,_0x1bd635[_0xc08c('0x3c')]);return _0x1aee66[_0xc08c('0x5a')](_0x37fe41);}})[_0xc08c('0x24')](function(_0x314fc8){if(_0x314fc8){_0x1b8251=_0x314fc8[_0xc08c('0x33')];if(!_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x34')]('nolimit')){_0x37fe41['limit']=qs[_0xc08c('0x1d')](_0x1bd635['query'][_0xc08c('0x1d')]);_0x37fe41[_0xc08c('0x1c')]=qs[_0xc08c('0x1c')](_0x1bd635[_0xc08c('0x2f')][_0xc08c('0x1c')]);}return _0x1aee66[_0xc08c('0x5a')](_0x37fe41);}})[_0xc08c('0x24')](function(_0x5c8abe){if(_0x5c8abe){return _0x5c8abe?{'count':_0x1b8251,'rows':_0x5c8abe}:null;}})['then'](respondWithResult(_0x4fa2cd,null))[_0xc08c('0x45')](handleError(_0x4fa2cd,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c25e1a4..ed66fc4 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 _0xf8f9=['util','../../config/logger','moment','path','rimraf','exports','define'];(function(_0x4dfe29,_0x57cbb8){var _0x470b4d=function(_0x9868d3){while(--_0x9868d3){_0x4dfe29['push'](_0x4dfe29['shift']());}};_0x470b4d(++_0x57cbb8);}(_0xf8f9,0x1b9));var _0x9f8f=function(_0x17d99c,_0x48fcf1){_0x17d99c=_0x17d99c-0x0;var _0xd13435=_0xf8f9[_0x17d99c];return _0xd13435;};'use strict';var _=require('lodash');var util=require(_0x9f8f('0x0'));var logger=require(_0x9f8f('0x1'))('api');var moment=require(_0x9f8f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f8f('0x3'));var rimraf=require(_0x9f8f('0x4'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x9f8f('0x5')]=function(_0x2a3fe9,_0x392a94){return _0x2a3fe9[_0x9f8f('0x6')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7afe=['util','../../config/logger','moment','request-promise','path','../../config/environment','./trigger.attributes','define','tools_triggers'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x7afe,0xea));var _0xe7af=function(_0x29206f,_0x390f1b){_0x29206f=_0x29206f-0x0;var _0x1de118=_0x7afe[_0x29206f];return _0x1de118;};'use strict';var _=require('lodash');var util=require(_0xe7af('0x0'));var logger=require(_0xe7af('0x1'))('api');var moment=require(_0xe7af('0x2'));var BPromise=require('bluebird');var rp=require(_0xe7af('0x3'));var fs=require('fs');var path=require(_0xe7af('0x4'));var rimraf=require('rimraf');var config=require(_0xe7af('0x5'));var attributes=require(_0xe7af('0x6'));module['exports']=function(_0x31c4b1,_0x1635e7){return _0x31c4b1[_0xe7af('0x7')]('Trigger',attributes,{'tableName':_0xe7af('0x8'),'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 403b9b6..74c761e 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 _0x8603=['result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x201303,_0x2686ac){var _0x1f917f=function(_0x5efac8){while(--_0x5efac8){_0x201303['push'](_0x201303['shift']());}};_0x1f917f(++_0x2686ac);}(_0x8603,0x190));var _0x3860=function(_0x4a5265,_0x1ab0bf){_0x4a5265=_0x4a5265-0x0;var _0x5c31fe=_0x8603[_0x4a5265];return _0x5c31fe;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrigger',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrigger']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file +var _0xac4a=['info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','model','attributes','map','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x3e3022,_0x4e20da){var _0x10f89e=function(_0x257849){while(--_0x257849){_0x3e3022['push'](_0x3e3022['shift']());}};_0x10f89e(++_0x4e20da);}(_0xac4a,0x13f));var _0xaac4=function(_0x449691,_0x3c82ce){_0x449691=_0x449691-0x0;var _0x274983=_0xac4a[_0x449691];return _0x274983;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('Trigger,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('Trigger,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')]({'raw':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x52085a['options']?_0x52085a[_0xaac4('0x18')]['attributes']||null:null,'limit':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1b')]||null:null,'include':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')]?_['map'](_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x174860){return{'model':db[_0x174860[_0xaac4('0x1d')]],'as':_0x174860['as'],'attributes':_0x174860[_0xaac4('0x1e')],'include':_0x174860[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x174860['include'],function(_0x24186b){return{'model':db[_0x24186b['model']],'as':_0x24186b['as'],'attributes':_0x24186b['attributes'],'include':_0x24186b['include']?_['map'](_0x24186b[_0xaac4('0x1c')],function(_0x17d25f){return{'model':db[_0x17d25f[_0xaac4('0x1d')]],'as':_0x17d25f['as'],'attributes':_0x17d25f[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0xa')](function(_0x249a5d){logger[_0xaac4('0xb')](_0xaac4('0x15'),_0x52085a);logger[_0xaac4('0xc')](_0xaac4('0x15'),_0x52085a,JSON['stringify'](_0x249a5d));_0x5b6fd6(_0x249a5d);})[_0xaac4('0x14')](function(_0x16b33c){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x16b33c[_0xaac4('0x12')],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x16b33c['message']));});});};exports[_0xaac4('0x20')]=function(_0x5d2c9a){var _0x2df7e3=this;return new Promise(function(_0xab5d04,_0x182343){return db[_0xaac4('0x16')]['find']({'raw':_0x5d2c9a['options']?_0x5d2c9a['options'][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1e')]||null:null,'include':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x3b93e5){return{'model':db[_0x3b93e5[_0xaac4('0x1d')]],'as':_0x3b93e5['as'],'attributes':_0x3b93e5['attributes'],'include':_0x3b93e5['include']?_[_0xaac4('0x1f')](_0x3b93e5[_0xaac4('0x1c')],function(_0xa07d0){return{'model':db[_0xa07d0['model']],'as':_0xa07d0['as'],'attributes':_0xa07d0[_0xaac4('0x1e')],'include':_0xa07d0[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0xa07d0[_0xaac4('0x1c')],function(_0x1ec59d){return{'model':db[_0x1ec59d[_0xaac4('0x1d')]],'as':_0x1ec59d['as'],'attributes':_0x1ec59d[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36591a){logger[_0xaac4('0xb')](_0xaac4('0x20'),_0x5d2c9a);logger['debug'](_0xaac4('0x20'),_0x5d2c9a,JSON['stringify'](_0x36591a));_0xab5d04(_0x36591a);})['catch'](function(_0x344d05){logger[_0xaac4('0x10')](_0xaac4('0x20'),_0x344d05['message'],_0x5d2c9a);_0x182343(_0x2df7e3['error'](0x1f4,_0x344d05[_0xaac4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index cd628fc..4c0c10a 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 _0x55ca=['show','post','clone','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x23fd63,_0x49dbe9){var _0x591cc4=function(_0x391992){while(--_0x391992){_0x23fd63['push'](_0x23fd63['shift']());}};_0x591cc4(++_0x49dbe9);}(_0x55ca,0x126));var _0xa55c=function(_0x163bc9,_0x4b6796){_0x163bc9=_0x163bc9-0x0;var _0xb94e42=_0x55ca[_0x163bc9];return _0xb94e42;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/:id/clone',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xe')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);module[_0xa55c('0x12')]=router; \ No newline at end of file +var _0x3e74=['/:id/clone','put','/:id','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','show','post'];(function(_0x1e1a30,_0x87486f){var _0xea49f4=function(_0x1eaa2a){while(--_0x1eaa2a){_0x1e1a30['push'](_0x1e1a30['shift']());}};_0xea49f4(++_0x87486f);}(_0x3e74,0x175));var _0x43e7=function(_0x23e263,_0x1f7c8a){_0x23e263=_0x23e263-0x0;var _0x26bd1e=_0x3e74[_0x23e263];return _0x26bd1e;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')](_0x43e7('0xb'),auth[_0x43e7('0x7')](),controller['clone']);router[_0x43e7('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['delete'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['destroy']);module[_0x43e7('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 5c7494e..d81b966 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 _0xa651=['yes','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','auto','outgoing'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa651,0x1a1));var _0x1a65=function(_0x1fd1ad,_0x332b5a){_0x1fd1ad=_0x1fd1ad-0x0;var _0x31f1be=_0xa651[_0x1fd1ad];return _0x31f1be;};'use strict';var Sequelize=require(_0x1a65('0x0'));module[_0x1a65('0x1')]={'name':{'type':Sequelize[_0x1a65('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x4'),_0x1a65('0x5'),_0x1a65('0x6')),'allowNull':![],'defaultValue':_0x1a65('0x4')},'context':{'type':Sequelize[_0x1a65('0x2')],'allowNull':![],'defaultValue':_0x1a65('0x7')},'callingpres':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x1a65('0x9'),'PROHIB_NOT_SCREENED',_0x1a65('0xa'),_0x1a65('0xb'),_0x1a65('0xc'))},'deny':{'type':Sequelize[_0x1a65('0x2')]},'permit':{'type':Sequelize[_0x1a65('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x1a65('0x2')]},'remotesecret':{'type':Sequelize[_0x1a65('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x1a65('0xd'),'set':function(_0x20143b){this[_0x1a65('0xe')](_0x1a65('0xf'),_0x20143b?_0x20143b[_0x1a65('0x10')](','):null);},'get':function(){return this[_0x1a65('0x11')]('transport')?this[_0x1a65('0x11')]('transport')[_0x1a65('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x1a65('0x13'),_0x1a65('0x14'),_0x1a65('0x15'),'inband',_0x1a65('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1a65('0x3')]('yes','no','nonat','update',_0x1a65('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x1a65('0x2')],'defaultValue':_0x1a65('0x19'),'set':function(_0x4a11e5){this[_0x1a65('0xe')](_0x1a65('0x1a'),_0x4a11e5?_0x4a11e5[_0x1a65('0x10')](','):null);},'get':function(){return this[_0x1a65('0x11')](_0x1a65('0x1a'))?this[_0x1a65('0x11')](_0x1a65('0x1a'))[_0x1a65('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1a65('0x2')]},'namedcallgroup':{'type':Sequelize[_0x1a65('0x2')]},'pickupgroup':{'type':Sequelize[_0x1a65('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x1a65('0x2')]},'language':{'type':Sequelize[_0x1a65('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1a65('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x1a65('0x1b')},'allow':{'type':Sequelize[_0x1a65('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x28a369){this[_0x1a65('0xe')](_0x1a65('0x1c'),_0x28a369?_0x28a369[_0x1a65('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1a65('0x11')](_0x1a65('0x1c'))?this[_0x1a65('0x11')](_0x1a65('0x1c'))['split'](';'):null;},'comment':_0x1a65('0x1d')},'autoframing':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x1a65('0x1e'),'set':function(_0xef2b7){this[_0x1a65('0xe')](_0x1a65('0x1f'),_0xef2b7?_0xef2b7[_0x1a65('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x1a65('0x1f'))?this[_0x1a65('0x11')](_0x1a65('0x1f'))[_0x1a65('0x12')](','):null;},'comment':_0x1a65('0x20')},'trustrpid':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1a65('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no')},'accountcode':{'type':Sequelize[_0x1a65('0x21')](0xb)},'setvar':{'type':Sequelize[_0x1a65('0x2')]},'callerid':{'type':Sequelize[_0x1a65('0x2')],'defaultValue':_0x1a65('0x22')},'amaflags':{'type':Sequelize[_0x1a65('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no'),'defaultValue':_0x1a65('0x18')},'busylevel':{'type':Sequelize[_0x1a65('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x1a65('0x2')]},'template':{'type':Sequelize[_0x1a65('0x2')]},'videosupport':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no',_0x1a65('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1a65('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'mailbox':{'type':Sequelize[_0x1a65('0x2')]},'session_timers':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x24'),_0x1a65('0x25'),'originate')},'session_expires':{'type':Sequelize[_0x1a65('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x1a65('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x26'),_0x1a65('0x27')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1a65('0x2')]},'regexten':{'type':Sequelize[_0x1a65('0x2')]},'fromdomain':{'type':Sequelize[_0x1a65('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1a65('0x21')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no'),'defaultValue':_0x1a65('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1a65('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x1a65('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1a65('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1a65('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x1a65('0x3')]('yes','no',_0x1a65('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1a65('0x2')]},'callbackextension':{'type':Sequelize[_0x1a65('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1a65('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x1a65('0x2')]},'contactdeny':{'type':Sequelize[_0x1a65('0x2')]},'contactacl':{'type':Sequelize[_0x1a65('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x1a65('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x1a65('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no')},'force_avp':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'icesupport':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x1a65('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x1a65('0x18'),'no',_0x1a65('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x1a65('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1a65('0x2')]},'dtlscapath':{'type':Sequelize[_0x1a65('0x2')]},'dtlssetup':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x2a'),_0x1a65('0x2b'),_0x1a65('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1a65('0x2')]},'recordofffeature':{'type':Sequelize[_0x1a65('0x2')]},'call_limit':{'type':Sequelize[_0x1a65('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1a65('0x2')]},'mohsuggest':{'type':Sequelize[_0x1a65('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1a65('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x1a65('0x2d')},'canreinvite':{'type':Sequelize[_0x1a65('0x3')]('yes','no',_0x1a65('0x2e'),_0x1a65('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1a65('0x2')]},'otherFields':{'type':Sequelize[_0x1a65('0x2')]},'active':{'type':Sequelize[_0x1a65('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x39cf=['nonat','update','outgoing','nat','join','split','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x39cf,0x186));var _0xf39c=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x39cf[_0x2f6f50];return _0x2cf365;};'use strict';var Sequelize=require('sequelize');module[_0xf39c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf39c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x3'),_0xf39c('0x4'),_0xf39c('0x5')),'allowNull':![],'defaultValue':_0xf39c('0x3')},'context':{'type':Sequelize[_0xf39c('0x6')],'allowNull':![],'defaultValue':_0xf39c('0x7')},'callingpres':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x8'),'ALLOWED_PASSED_SCREEN',_0xf39c('0x9'),_0xf39c('0xa'),_0xf39c('0xb'),_0xf39c('0xc'),_0xf39c('0xd'),_0xf39c('0xe'))},'deny':{'type':Sequelize[_0xf39c('0x6')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf39c('0x6')]},'md5secret':{'type':Sequelize[_0xf39c('0x6')]},'remotesecret':{'type':Sequelize[_0xf39c('0x6')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf39c('0xf'),'set':function(_0x1e6a8b){this[_0xf39c('0x10')](_0xf39c('0x11'),_0x1e6a8b?_0x1e6a8b['join'](','):null);},'get':function(){return this[_0xf39c('0x12')]('transport')?this[_0xf39c('0x12')]('transport')['split'](','):null;},'comment':_0xf39c('0x13')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xf39c('0x14'),_0xf39c('0x15'),_0xf39c('0x16'),_0xf39c('0x17')),'defaultValue':_0xf39c('0x18')},'directmedia':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no',_0xf39c('0x1a'),_0xf39c('0x1b'),_0xf39c('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf39c('0x6')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x43df36){this[_0xf39c('0x10')](_0xf39c('0x1d'),_0x43df36?_0x43df36[_0xf39c('0x1e')](','):null);},'get':function(){return this[_0xf39c('0x12')](_0xf39c('0x1d'))?this[_0xf39c('0x12')]('nat')[_0xf39c('0x1f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf39c('0x6')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf39c('0x6')]},'language':{'type':Sequelize[_0xf39c('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf39c('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf39c('0x6')],'defaultValue':_0xf39c('0x20')},'allow':{'type':Sequelize[_0xf39c('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1565c6){this[_0xf39c('0x10')](_0xf39c('0x21'),_0x1565c6?_0x1565c6[_0xf39c('0x1e')](';'):_0xf39c('0x22'));},'get':function(){return this['getDataValue'](_0xf39c('0x21'))?this[_0xf39c('0x12')](_0xf39c('0x21'))[_0xf39c('0x1f')](';'):null;},'comment':_0xf39c('0x23')},'autoframing':{'type':Sequelize[_0xf39c('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0xf39c('0x6')],'defaultValue':_0xf39c('0x24'),'set':function(_0x4f389a){this[_0xf39c('0x10')]('insecure',_0x4f389a?_0x4f389a['join'](','):null);},'get':function(){return this['getDataValue'](_0xf39c('0x25'))?this[_0xf39c('0x12')](_0xf39c('0x25'))[_0xf39c('0x1f')](','):null;},'comment':_0xf39c('0x26')},'trustrpid':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf39c('0x2')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf39c('0x6')],'defaultValue':_0xf39c('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no'),'defaultValue':_0xf39c('0x19')},'busylevel':{'type':Sequelize[_0xf39c('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0xf39c('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf39c('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xf39c('0x6')]},'template':{'type':Sequelize[_0xf39c('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no',_0xf39c('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf39c('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no')},'mailbox':{'type':Sequelize[_0xf39c('0x6')]},'session_timers':{'type':Sequelize[_0xf39c('0x2')]('accept','refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xf39c('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x2a'),_0xf39c('0x2b')),'defaultValue':_0xf39c('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xf39c('0x6')]},'fromdomain':{'type':Sequelize[_0xf39c('0x6')]},'fromuser':{'type':Sequelize[_0xf39c('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xf39c('0x2')]('yes','no'),'defaultValue':_0xf39c('0x19')},'keepalive':{'type':Sequelize[_0xf39c('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xf39c('0x6')]},'defaultuser':{'type':Sequelize[_0xf39c('0x6')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no',_0xf39c('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf39c('0x6')]},'callbackextension':{'type':Sequelize[_0xf39c('0x6')]},'timert1':{'type':Sequelize[_0xf39c('0x28')](0xb)},'timerb':{'type':Sequelize[_0xf39c('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf39c('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xf39c('0x6')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xf39c('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xf39c('0x6')]},'use_q850_reason':{'type':Sequelize[_0xf39c('0x6')]},'maxforwards':{'type':Sequelize[_0xf39c('0x28')](0xb)},'encryption':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xf39c('0x19'),'no',_0xf39c('0x2d'),_0xf39c('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xf39c('0x28')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf39c('0x6')]},'dtlscipher':{'type':Sequelize[_0xf39c('0x6')]},'dtlscafile':{'type':Sequelize[_0xf39c('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x2f'),_0xf39c('0x30'),_0xf39c('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf39c('0x6')]},'usereqphone':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf39c('0x6')]},'recordofffeature':{'type':Sequelize[_0xf39c('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xf39c('0x2')](_0xf39c('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf39c('0x6')]},'mohsuggest':{'type':Sequelize[_0xf39c('0x6')]},'parkinglot':{'type':Sequelize[_0xf39c('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf39c('0x6')],'defaultValue':_0xf39c('0x32')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xf39c('0x1a'),'update',_0xf39c('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf39c('0x6')]},'otherFields':{'type':Sequelize[_0xf39c('0x6')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 a72e7e6..3417ae1 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 _0xdd4f=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','update','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','params','/etc/asterisk/sip_xcally_trunks.conf','Reload','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','get','Trunks','UserProfileResource','stack','name','send','Trunk','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5bdf15,_0x39f070){var _0x1c7939=function(_0x2895e9){while(--_0x2895e9){_0x5bdf15['push'](_0x5bdf15['shift']());}};_0x1c7939(++_0x39f070);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4b3247,_0x5070bb){_0x4b3247=_0x4b3247-0x0;var _0x75cceb=_0xdd4f[_0x4b3247];return _0x75cceb;};'use strict';var pdf=require(_0xfdd4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfdd4('0x1'));var rp=require(_0xfdd4('0x2'));var moment=require('moment');var BPromise=require(_0xfdd4('0x3'));var Mustache=require(_0xfdd4('0x4'));var util=require(_0xfdd4('0x5'));var path=require('path');var sox=require(_0xfdd4('0x6'));var csv=require(_0xfdd4('0x7'));var ejs=require(_0xfdd4('0x8'));var fs=require('fs');var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x7'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var db=require(_0xfdd4('0x15'))['db'];var jayson=require(_0xfdd4('0x16'));var client=jayson[_0xfdd4('0x17')][_0xfdd4('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1bf37b,_0x59a126,_0x4975aa){if(_0x4975aa){var _0xd7dbf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd7dbf[_0xfdd4('0x19')](_0x59a126)){return _0x1bf37b;}else{throw new db['Sequelize'][(_0xfdd4('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1bf37b;}}function respondWithRpcPromise(_0x467824,_0x42c3a8,_0x2f34ec,_0x431255){return new BPromise(function(_0x37b05f,_0x52cf2c){var _0x47ed1d=_0x431255||client;return _0x47ed1d['request'](_0x467824,_0x2f34ec)[_0xfdd4('0x1b')](function(_0x216c7e){logger[_0xfdd4('0x1c')](_0xfdd4('0x1d'),_0x42c3a8,_0xfdd4('0x1e'));logger[_0xfdd4('0x1f')](_0xfdd4('0x20'),_0x42c3a8,_0xfdd4('0x1e'),JSON[_0xfdd4('0x21')](_0x216c7e));if(_0x216c7e['error']){if(_0x216c7e[_0xfdd4('0x22')][_0xfdd4('0x23')]===0x1f4){logger[_0xfdd4('0x22')](_0xfdd4('0x1d'),_0x42c3a8,_0x216c7e[_0xfdd4('0x22')][_0xfdd4('0x24')]);return _0x52cf2c(_0x216c7e[_0xfdd4('0x22')][_0xfdd4('0x24')]);}logger['error'](_0xfdd4('0x1d'),_0x42c3a8,_0x216c7e[_0xfdd4('0x22')][_0xfdd4('0x24')]);return _0x37b05f(_0x216c7e[_0xfdd4('0x22')][_0xfdd4('0x24')]);}else{logger[_0xfdd4('0x1c')](_0xfdd4('0x1d'),_0x42c3a8,_0xfdd4('0x1e'));_0x37b05f(_0x216c7e['result'][_0xfdd4('0x24')]);}})[_0xfdd4('0x25')](function(_0x4397a3){logger['error'](_0xfdd4('0x1d'),_0x42c3a8,_0x4397a3);_0x52cf2c(_0x4397a3);});});}function respondWithStatusCode(_0x39b712,_0xf9c346){_0xf9c346=_0xf9c346||0xcc;return function(_0x2f8268){if(_0x2f8268){return _0x39b712[_0xfdd4('0x26')](_0xf9c346);}return _0x39b712['status'](_0xf9c346)[_0xfdd4('0x27')]();};}function respondWithResult(_0x2c88ad,_0x3cd2c9){_0x3cd2c9=_0x3cd2c9||0xc8;return function(_0x31e053){if(_0x31e053){return _0x2c88ad[_0xfdd4('0x28')](_0x3cd2c9)[_0xfdd4('0x29')](_0x31e053);}};}function respondWithFilteredResult(_0x453a48,_0x37b7a2){return function(_0x5e8898){if(_0x5e8898){var _0xcbd1fb=_0x5e8898[_0xfdd4('0x2a')],_0x39981f=_0x37b7a2['offset'],_0x385a68=_0x37b7a2[_0xfdd4('0x2b')]+_0x37b7a2[_0xfdd4('0x2c')],_0xef012e;if(_0x385a68>=_0xcbd1fb){_0x385a68=_0xcbd1fb;_0xef012e=0xc8;}else{_0xef012e=0xce;}_0x453a48[_0xfdd4('0x28')](_0xef012e);return _0x453a48[_0xfdd4('0x2d')](_0xfdd4('0x2e'),_0x39981f+'-'+_0x385a68+'/'+_0xcbd1fb)['json'](_0x5e8898);}return null;};}function patchUpdates(_0x374e98){return function(_0x315568){try{jsonpatch[_0xfdd4('0x2f')](_0x315568,_0x374e98,!![]);}catch(_0x5ba4e8){return BPromise[_0xfdd4('0x30')](_0x5ba4e8);}return _0x315568['save']();};}function saveUpdates(_0x2a65c8,_0x2b22f9){return function(_0x4aa4f2){if(_0x4aa4f2){return _0x4aa4f2['update'](_0x2a65c8)[_0xfdd4('0x1b')](function(_0x289f16){return _0x289f16;});}return null;};}function removeEntity(_0x5581b1,_0x557d7b){return function(_0x3e80a0){if(_0x3e80a0){return _0x3e80a0[_0xfdd4('0x31')]()[_0xfdd4('0x1b')](function(){var _0x24b1fa=_0x3e80a0[_0xfdd4('0x32')]({'plain':!![]});var _0x265cab=_0xfdd4('0x33');return db[_0xfdd4('0x34')][_0xfdd4('0x31')]({'where':{'type':_0x265cab,'resourceId':_0x24b1fa['id']}})[_0xfdd4('0x1b')](function(){return _0x3e80a0;});})[_0xfdd4('0x1b')](function(){_0x5581b1[_0xfdd4('0x28')](0xcc)[_0xfdd4('0x27')]();});}};}function handleEntityNotFound(_0x1d4f0a,_0x2cd168){return function(_0x3f5c5a){if(!_0x3f5c5a){_0x1d4f0a[_0xfdd4('0x26')](0x194);}return _0x3f5c5a;};}function handleError(_0x3a0102,_0x2abe77){_0x2abe77=_0x2abe77||0x1f4;return function(_0x4037c4){logger[_0xfdd4('0x22')](_0x4037c4[_0xfdd4('0x35')]);if(_0x4037c4[_0xfdd4('0x36')]){delete _0x4037c4[_0xfdd4('0x36')];}_0x3a0102[_0xfdd4('0x28')](_0x2abe77)[_0xfdd4('0x37')](_0x4037c4);};}exports['index']=function(_0x2b6c87,_0x3716da){var _0x42dc1a={},_0x439389={},_0x2850f5={'count':0x0,'rows':[]};var _0x5842f1=_['map'](db[_0xfdd4('0x38')]['rawAttributes'],function(_0xeca9d){return{'name':_0xeca9d[_0xfdd4('0x39')],'type':_0xeca9d[_0xfdd4('0x3a')][_0xfdd4('0x3b')]};});_0x439389['model']=_[_0xfdd4('0x3c')](_0x5842f1,_0xfdd4('0x36'));_0x439389[_0xfdd4('0x3d')]=_[_0xfdd4('0x3e')](_0x2b6c87[_0xfdd4('0x3d')]);_0x439389[_0xfdd4('0x3f')]=_[_0xfdd4('0x40')](_0x439389[_0xfdd4('0x41')],_0x439389[_0xfdd4('0x3d')]);_0x42dc1a[_0xfdd4('0x42')]=_['intersection'](_0x439389[_0xfdd4('0x41')],qs[_0xfdd4('0x43')](_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x43')]));_0x42dc1a['attributes']=_0x42dc1a[_0xfdd4('0x42')][_0xfdd4('0x44')]?_0x42dc1a[_0xfdd4('0x42')]:_0x439389[_0xfdd4('0x41')];if(!_0x2b6c87[_0xfdd4('0x3d')]['hasOwnProperty'](_0xfdd4('0x45'))){_0x42dc1a[_0xfdd4('0x2c')]=qs[_0xfdd4('0x2c')](_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x2c')]);_0x42dc1a[_0xfdd4('0x2b')]=qs[_0xfdd4('0x2b')](_0x2b6c87['query'][_0xfdd4('0x2b')]);}_0x42dc1a['order']=qs[_0xfdd4('0x46')](_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x46')]);_0x42dc1a[_0xfdd4('0x47')]=qs['filters'](_[_0xfdd4('0x48')](_0x2b6c87[_0xfdd4('0x3d')],_0x439389['filters']),_0x5842f1);if(_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x49')]){_0x42dc1a['where']=_[_0xfdd4('0x4a')](_0x42dc1a['where'],{'$or':_['map'](_0x5842f1,function(_0x4c3dbf){if(_0x4c3dbf[_0xfdd4('0x3a')]!==_0xfdd4('0x4b')){var _0xc3933e={};_0xc3933e[_0x4c3dbf['name']]={'$like':'%'+_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x49')]+'%'};return _0xc3933e;}})});}_0x42dc1a=_['merge']({},_0x42dc1a,_0x2b6c87[_0xfdd4('0x4c')]);var _0x420ec0={'where':_0x42dc1a[_0xfdd4('0x47')]};return db[_0xfdd4('0x38')][_0xfdd4('0x2a')](_0x420ec0)[_0xfdd4('0x1b')](function(_0x2578eb){_0x2850f5[_0xfdd4('0x2a')]=_0x2578eb;if(_0x2b6c87[_0xfdd4('0x3d')][_0xfdd4('0x4d')]){_0x42dc1a[_0xfdd4('0x4e')]=[{'all':!![]}];}return db[_0xfdd4('0x38')][_0xfdd4('0x4f')](_0x42dc1a);})[_0xfdd4('0x1b')](function(_0x55065e){_0x2850f5['rows']=_0x55065e;return _0x2850f5;})[_0xfdd4('0x1b')](respondWithFilteredResult(_0x3716da,_0x42dc1a))[_0xfdd4('0x25')](handleError(_0x3716da,null));};exports[_0xfdd4('0x50')]=function(_0x1932ef,_0x507bf5){var _0x3c6828={'raw':![],'where':{'id':_0x1932ef['params']['id']}},_0x30c709={};_0x30c709['model']=_['keys'](db['Trunk']['rawAttributes']);_0x30c709[_0xfdd4('0x3d')]=_[_0xfdd4('0x3e')](_0x1932ef[_0xfdd4('0x3d')]);_0x30c709[_0xfdd4('0x3f')]=_[_0xfdd4('0x40')](_0x30c709[_0xfdd4('0x41')],_0x30c709['query']);_0x3c6828[_0xfdd4('0x42')]=_[_0xfdd4('0x40')](_0x30c709[_0xfdd4('0x41')],qs[_0xfdd4('0x43')](_0x1932ef['query'][_0xfdd4('0x43')]));_0x3c6828[_0xfdd4('0x42')]=_0x3c6828['attributes'][_0xfdd4('0x44')]?_0x3c6828[_0xfdd4('0x42')]:_0x30c709['model'];if(_0x1932ef['query'][_0xfdd4('0x4d')]){_0x3c6828[_0xfdd4('0x4e')]=[{'all':!![]}];}_0x3c6828=_[_0xfdd4('0x4a')]({},_0x3c6828,_0x1932ef[_0xfdd4('0x4c')]);return db[_0xfdd4('0x38')][_0xfdd4('0x51')](_0x3c6828)[_0xfdd4('0x1b')](handleEntityNotFound(_0x507bf5,null))[_0xfdd4('0x1b')](respondWithResult(_0x507bf5,null))['catch'](handleError(_0x507bf5,null));};exports[_0xfdd4('0x52')]=function(_0x50f569,_0x5d524b){var _0x77e0b9={'where':{'id':_0x50f569['params']['id']}},_0x1d9a8d={};_0x1d9a8d['model']=_['keys'](db[_0xfdd4('0x38')][_0xfdd4('0x53')]);_0x77e0b9['attributes']=_[_0xfdd4('0x40')](_0x1d9a8d[_0xfdd4('0x41')],qs[_0xfdd4('0x43')](_0x50f569[_0xfdd4('0x3d')][_0xfdd4('0x43')]));_0x77e0b9['attributes']=_0x77e0b9['attributes']['length']?_0x77e0b9['attributes']:_0x1d9a8d[_0xfdd4('0x41')];if(_0x50f569[_0xfdd4('0x3d')]['includeAll']){_0x77e0b9[_0xfdd4('0x4e')]=[{'all':!![]}];}_0x77e0b9=_[_0xfdd4('0x4a')]({},_0x77e0b9,_0x50f569['options']);return db[_0xfdd4('0x38')][_0xfdd4('0x51')](_0x77e0b9)['then'](handleEntityNotFound(_0x5d524b,null))[_0xfdd4('0x1b')](function(_0x2b7081){if(_0x2b7081){var _0xd4e5e4=_0x2b7081['get']({'plain':!![]});_0xd4e5e4=qs[_0xfdd4('0x54')](_0xd4e5e4,['id',_0xfdd4('0x55'),_0xfdd4('0x56')]);_0x50f569[_0xfdd4('0x57')]=_[_0xfdd4('0x54')](_0x50f569['body'],['id',_0xfdd4('0x55'),_0xfdd4('0x56')]);return db[_0xfdd4('0x38')][_0xfdd4('0x58')](_[_0xfdd4('0x4a')](_0xd4e5e4,_0x50f569[_0xfdd4('0x57')]),{'include':_0x50f569[_0xfdd4('0x3d')][_0xfdd4('0x4d')]?[{'all':!![]}]:undefined})[_0xfdd4('0x1b')](function(_0x5e0a1c){var _0x335b6e=_0x50f569[_0xfdd4('0x59')][_0xfdd4('0x32')]({'plain':!![]});if(!_0x335b6e)throw new Error(_0xfdd4('0x5a'));if(_0x335b6e[_0xfdd4('0x5b')]==='user'){var _0x46e7eb=_0x5e0a1c[_0xfdd4('0x32')]({'plain':!![]});var _0x255175=_0xfdd4('0x33');return db[_0xfdd4('0x5c')][_0xfdd4('0x51')]({'where':{'name':_0x255175,'userProfileId':_0x335b6e[_0xfdd4('0x5d')]},'raw':!![]})[_0xfdd4('0x1b')](function(_0x35c7ab){if(_0x35c7ab&&_0x35c7ab[_0xfdd4('0x5e')]===0x0){return db[_0xfdd4('0x34')][_0xfdd4('0x58')]({'name':_0x46e7eb[_0xfdd4('0x36')],'resourceId':_0x46e7eb['id'],'type':_0x35c7ab['name'],'sectionId':_0x35c7ab['id']},{})[_0xfdd4('0x1b')](function(){return _0x5e0a1c;});}else{return _0x5e0a1c;}})['catch'](function(_0x3ca92e){logger[_0xfdd4('0x22')](_0xfdd4('0x5f'),_0x3ca92e);throw _0x3ca92e;});}return _0x5e0a1c;});}})[_0xfdd4('0x1b')](respondWithResult(_0x5d524b,0xc9))[_0xfdd4('0x25')](handleError(_0x5d524b,null));};exports[_0xfdd4('0x58')]=function(_0xea89a1,_0xb0bb50,_0x302b2f){var _0x25f01e;return db[_0xfdd4('0x38')][_0xfdd4('0x58')](_0xea89a1['body'],{'raw':!![]})['then'](function(_0x55a566){_0x25f01e=_0x55a566;return db[_0xfdd4('0x38')][_0xfdd4('0x4f')]({'raw':!![]});})['then'](function(_0x3a367c){var _0x3f027b=fs[_0xfdd4('0x60')](path[_0xfdd4('0x61')](config[_0xfdd4('0x62')],'server/files/templates/trunk.ejs'),_0xfdd4('0x63'));var _0x297432=fs[_0xfdd4('0x60')](path['join'](config[_0xfdd4('0x62')],'server/files/templates/registry.ejs'),_0xfdd4('0x63'));var _0x21c13d=ejs[_0xfdd4('0x64')](_0x3f027b,{'trunks':_0x3a367c||[]});fs[_0xfdd4('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x21c13d);if(_0x25f01e[_0xfdd4('0x66')]){var _0x25001c=ejs['render'](_0x297432,{'trunks':_0x3a367c||[]});fs[_0xfdd4('0x65')](_0xfdd4('0x67'),_0x25001c);}})[_0xfdd4('0x1b')](function(){return respondWithRpcPromise('Reload',_0xfdd4('0x58'),{'module':_0xfdd4('0x68')});})[_0xfdd4('0x1b')](function(){var _0x535b07=_0xea89a1[_0xfdd4('0x59')][_0xfdd4('0x32')]({'plain':!![]});if(!_0x535b07)throw new Error(_0xfdd4('0x5a'));if(_0x535b07[_0xfdd4('0x5b')]===_0xfdd4('0x59')){var _0x1d0e63=_0x25f01e[_0xfdd4('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xfdd4('0x51')]({'where':{'name':_0xfdd4('0x33'),'userProfileId':_0x535b07[_0xfdd4('0x5d')]},'raw':!![]})[_0xfdd4('0x1b')](function(_0xcdc104){if(_0xcdc104&&_0xcdc104[_0xfdd4('0x5e')]===0x0){return db[_0xfdd4('0x34')][_0xfdd4('0x58')]({'name':_0x1d0e63['name'],'resourceId':_0x1d0e63['id'],'type':_0xcdc104[_0xfdd4('0x36')],'sectionId':_0xcdc104['id']},{})['then'](function(){return _0x25f01e;});}else{return _0x25f01e;}})['catch'](function(_0x40b2e8){logger['error'](_0xfdd4('0x5f'),_0x40b2e8);throw _0x40b2e8;});}return _0x25f01e;})['then'](respondWithResult(_0xb0bb50,0xc9))[_0xfdd4('0x25')](handleError(_0xb0bb50,null));};exports[_0xfdd4('0x69')]=function(_0x188301,_0x17b8fe,_0x4e4c7a){var _0x35ba83;return db[_0xfdd4('0x38')]['find']({'where':{'id':_0x188301['params']['id']}})[_0xfdd4('0x1b')](handleEntityNotFound(_0x17b8fe,null))['then'](saveUpdates(_0x188301[_0xfdd4('0x57')],null))[_0xfdd4('0x1b')](function(_0x3b205f){if(_0x3b205f){_0x35ba83=_0x3b205f;return db[_0xfdd4('0x38')][_0xfdd4('0x4f')]({'raw':!![]});}})[_0xfdd4('0x1b')](function(_0x246772){if(_0x246772){var _0x4fa559=fs['readFileSync'](path[_0xfdd4('0x61')](config[_0xfdd4('0x62')],_0xfdd4('0x6a')),_0xfdd4('0x63'));var _0x1deacd=fs[_0xfdd4('0x60')](path[_0xfdd4('0x61')](config[_0xfdd4('0x62')],_0xfdd4('0x6b')),_0xfdd4('0x63'));var _0x3bb707=ejs[_0xfdd4('0x64')](_0x4fa559,{'trunks':_0x246772||[]});fs[_0xfdd4('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3bb707);var _0x4bb814=ejs[_0xfdd4('0x64')](_0x1deacd,{'trunks':_0x246772||[]});fs[_0xfdd4('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x4bb814);return respondWithRpcPromise('Reload',_0xfdd4('0x69'),{'module':_0xfdd4('0x68')});}return null;})['then'](function(_0x3ea3e9){if(_0x3ea3e9){return _0x35ba83;}})[_0xfdd4('0x1b')](respondWithResult(_0x17b8fe,null))[_0xfdd4('0x25')](handleError(_0x17b8fe,null));};exports[_0xfdd4('0x31')]=function(_0x5ec62b,_0x25c078,_0x5d356c){var _0x3924c7;return db[_0xfdd4('0x38')][_0xfdd4('0x51')]({'where':{'id':_0x5ec62b[_0xfdd4('0x6c')]['id']}})[_0xfdd4('0x1b')](handleEntityNotFound(_0x25c078,null))[_0xfdd4('0x1b')](removeEntity(_0x25c078,null))[_0xfdd4('0x1b')](function(){return db[_0xfdd4('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1409ca){var _0x54e922=fs[_0xfdd4('0x60')](path[_0xfdd4('0x61')](config[_0xfdd4('0x62')],_0xfdd4('0x6a')),_0xfdd4('0x63'));var _0x47bbfa=fs['readFileSync'](path[_0xfdd4('0x61')](config['root'],_0xfdd4('0x6b')),'utf8');var _0xd24633=ejs[_0xfdd4('0x64')](_0x54e922,{'trunks':_0x1409ca});var _0xa7bbf8=ejs[_0xfdd4('0x64')](_0x47bbfa,{'trunks':_0x1409ca});fs[_0xfdd4('0x65')](_0xfdd4('0x6d'),_0xd24633);fs[_0xfdd4('0x65')](_0xfdd4('0x67'),_0xa7bbf8);return respondWithRpcPromise(_0xfdd4('0x6e'),_0xfdd4('0x31'),{'module':_0xfdd4('0x68')});})['catch'](handleError(_0x25c078,null));}; \ No newline at end of file +var _0xb8a0=['server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','autoAssociation','readFileSync','utf8','writeFileSync','params','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Trunks','end','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','keys','find','clone','createdAt','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs'];(function(_0x10d618,_0x1f1c82){var _0x57d044=function(_0x52c55b){while(--_0x52c55b){_0x10d618['push'](_0x10d618['shift']());}};_0x57d044(++_0x1f1c82);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x13d780,_0x56f875){_0x13d780=_0x13d780-0x0;var _0x52f1bd=_0xb8a0[_0x13d780];return _0x52f1bd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0b8a('0x0'));var zipdir=require(_0x0b8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b8a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0b8a('0x3'));var sox=require(_0x0b8a('0x4'));var csv=require(_0x0b8a('0x5'));var ejs=require(_0x0b8a('0x6'));var fs=require('fs');var _=require(_0x0b8a('0x7'));var squel=require(_0x0b8a('0x8'));var crypto=require(_0x0b8a('0x9'));var jsforce=require(_0x0b8a('0xa'));var deskjs=require(_0x0b8a('0xb'));var toCsv=require(_0x0b8a('0x5'));var querystring=require(_0x0b8a('0xc'));var Papa=require(_0x0b8a('0xd'));var Redis=require(_0x0b8a('0xe'));var authService=require(_0x0b8a('0xf'));var qs=require(_0x0b8a('0x10'));var as=require(_0x0b8a('0x11'));var hardwareService=require(_0x0b8a('0x12'));var logger=require(_0x0b8a('0x13'))(_0x0b8a('0x14'));var utils=require(_0x0b8a('0x15'));var config=require(_0x0b8a('0x16'));var db=require(_0x0b8a('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0b8a('0x18')][_0x0b8a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3c96c9,_0x33f027,_0x136704){if(_0x136704){var _0x207322=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x207322[_0x0b8a('0x1a')](_0x33f027)){return _0x3c96c9;}else{throw new db[(_0x0b8a('0x1b'))][(_0x0b8a('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3c96c9;}}function respondWithRpcPromise(_0x178439,_0x318983,_0x233a61,_0x554237){return new BPromise(function(_0x1afb89,_0x2f9867){var _0x1c5ac2=_0x554237||client;return _0x1c5ac2['request'](_0x178439,_0x233a61)['then'](function(_0x4b58d7){logger[_0x0b8a('0x1d')]('Trunk,\x20%s,\x20%s',_0x318983,_0x0b8a('0x1e'));logger[_0x0b8a('0x1f')](_0x0b8a('0x20'),_0x318983,_0x0b8a('0x1e'),JSON[_0x0b8a('0x21')](_0x4b58d7));if(_0x4b58d7[_0x0b8a('0x22')]){if(_0x4b58d7[_0x0b8a('0x22')][_0x0b8a('0x23')]===0x1f4){logger[_0x0b8a('0x22')](_0x0b8a('0x24'),_0x318983,_0x4b58d7[_0x0b8a('0x22')]['message']);return _0x2f9867(_0x4b58d7[_0x0b8a('0x22')][_0x0b8a('0x25')]);}logger['error'](_0x0b8a('0x24'),_0x318983,_0x4b58d7[_0x0b8a('0x22')][_0x0b8a('0x25')]);return _0x1afb89(_0x4b58d7[_0x0b8a('0x22')]['message']);}else{logger[_0x0b8a('0x1d')]('Trunk,\x20%s,\x20%s',_0x318983,_0x0b8a('0x1e'));_0x1afb89(_0x4b58d7[_0x0b8a('0x26')]['message']);}})[_0x0b8a('0x27')](function(_0xd3c097){logger[_0x0b8a('0x22')]('Trunk,\x20%s,\x20%s',_0x318983,_0xd3c097);_0x2f9867(_0xd3c097);});});}function respondWithStatusCode(_0x65f12b,_0x2d876e){_0x2d876e=_0x2d876e||0xcc;return function(_0x34c83c){if(_0x34c83c){return _0x65f12b['sendStatus'](_0x2d876e);}return _0x65f12b[_0x0b8a('0x28')](_0x2d876e)['end']();};}function respondWithResult(_0x1ed000,_0x3e5e38){_0x3e5e38=_0x3e5e38||0xc8;return function(_0x3d08c8){if(_0x3d08c8){return _0x1ed000[_0x0b8a('0x28')](_0x3e5e38)[_0x0b8a('0x29')](_0x3d08c8);}};}function respondWithFilteredResult(_0x2fc6a7,_0xc3b747){return function(_0x195d05){if(_0x195d05){var _0x94f6b4=_0x195d05['count'],_0xc94471=_0xc3b747[_0x0b8a('0x2a')],_0x1e61f4=_0xc3b747[_0x0b8a('0x2a')]+_0xc3b747[_0x0b8a('0x2b')],_0x20b16d;if(_0x1e61f4>=_0x94f6b4){_0x1e61f4=_0x94f6b4;_0x20b16d=0xc8;}else{_0x20b16d=0xce;}_0x2fc6a7[_0x0b8a('0x28')](_0x20b16d);return _0x2fc6a7[_0x0b8a('0x2c')]('Content-Range',_0xc94471+'-'+_0x1e61f4+'/'+_0x94f6b4)[_0x0b8a('0x29')](_0x195d05);}return null;};}function patchUpdates(_0x4690b6){return function(_0x4f98dd){try{jsonpatch[_0x0b8a('0x2d')](_0x4f98dd,_0x4690b6,!![]);}catch(_0x43663b){return BPromise[_0x0b8a('0x2e')](_0x43663b);}return _0x4f98dd[_0x0b8a('0x2f')]();};}function saveUpdates(_0x2703e7,_0x485c44){return function(_0x139964){if(_0x139964){return _0x139964[_0x0b8a('0x30')](_0x2703e7)[_0x0b8a('0x31')](function(_0xa31767){return _0xa31767;});}return null;};}function removeEntity(_0x44d7a1,_0x5a2fd7){return function(_0x1bb340){if(_0x1bb340){return _0x1bb340[_0x0b8a('0x32')]()['then'](function(){var _0x329c56=_0x1bb340[_0x0b8a('0x33')]({'plain':!![]});var _0x3745a5=_0x0b8a('0x34');return db['UserProfileResource'][_0x0b8a('0x32')]({'where':{'type':_0x3745a5,'resourceId':_0x329c56['id']}})[_0x0b8a('0x31')](function(){return _0x1bb340;});})['then'](function(){_0x44d7a1['status'](0xcc)[_0x0b8a('0x35')]();});}};}function handleEntityNotFound(_0x42f333,_0x102ab8){return function(_0x45f418){if(!_0x45f418){_0x42f333['sendStatus'](0x194);}return _0x45f418;};}function handleError(_0xfb54ed,_0xe94bcc){_0xe94bcc=_0xe94bcc||0x1f4;return function(_0x208a5f){logger['error'](_0x208a5f[_0x0b8a('0x36')]);if(_0x208a5f[_0x0b8a('0x37')]){delete _0x208a5f[_0x0b8a('0x37')];}_0xfb54ed[_0x0b8a('0x28')](_0xe94bcc)[_0x0b8a('0x38')](_0x208a5f);};}exports[_0x0b8a('0x39')]=function(_0xc3984a,_0x2d01c0){var _0x1a189a={},_0x406a1a={},_0x53586f={'count':0x0,'rows':[]};var _0x37635b=_[_0x0b8a('0x3a')](db[_0x0b8a('0x3b')][_0x0b8a('0x3c')],function(_0x43ae2a){return{'name':_0x43ae2a[_0x0b8a('0x3d')],'type':_0x43ae2a[_0x0b8a('0x3e')][_0x0b8a('0x3f')]};});_0x406a1a['model']=_[_0x0b8a('0x3a')](_0x37635b,'name');_0x406a1a[_0x0b8a('0x40')]=_['keys'](_0xc3984a[_0x0b8a('0x40')]);_0x406a1a[_0x0b8a('0x41')]=_['intersection'](_0x406a1a[_0x0b8a('0x42')],_0x406a1a[_0x0b8a('0x40')]);_0x1a189a['attributes']=_[_0x0b8a('0x43')](_0x406a1a[_0x0b8a('0x42')],qs['fields'](_0xc3984a[_0x0b8a('0x40')][_0x0b8a('0x44')]));_0x1a189a[_0x0b8a('0x45')]=_0x1a189a['attributes'][_0x0b8a('0x46')]?_0x1a189a[_0x0b8a('0x45')]:_0x406a1a['model'];if(!_0xc3984a[_0x0b8a('0x40')]['hasOwnProperty'](_0x0b8a('0x47'))){_0x1a189a['limit']=qs[_0x0b8a('0x2b')](_0xc3984a[_0x0b8a('0x40')][_0x0b8a('0x2b')]);_0x1a189a[_0x0b8a('0x2a')]=qs[_0x0b8a('0x2a')](_0xc3984a[_0x0b8a('0x40')][_0x0b8a('0x2a')]);}_0x1a189a[_0x0b8a('0x48')]=qs[_0x0b8a('0x49')](_0xc3984a['query'][_0x0b8a('0x49')]);_0x1a189a['where']=qs['filters'](_['pick'](_0xc3984a['query'],_0x406a1a[_0x0b8a('0x41')]),_0x37635b);if(_0xc3984a[_0x0b8a('0x40')][_0x0b8a('0x4a')]){_0x1a189a[_0x0b8a('0x4b')]=_[_0x0b8a('0x4c')](_0x1a189a[_0x0b8a('0x4b')],{'$or':_['map'](_0x37635b,function(_0x2ef15c){if(_0x2ef15c['type']!==_0x0b8a('0x4d')){var _0x59787d={};_0x59787d[_0x2ef15c[_0x0b8a('0x37')]]={'$like':'%'+_0xc3984a[_0x0b8a('0x40')][_0x0b8a('0x4a')]+'%'};return _0x59787d;}})});}_0x1a189a=_[_0x0b8a('0x4c')]({},_0x1a189a,_0xc3984a[_0x0b8a('0x4e')]);var _0x393e38={'where':_0x1a189a['where']};return db[_0x0b8a('0x3b')][_0x0b8a('0x4f')](_0x393e38)[_0x0b8a('0x31')](function(_0x17d12c){_0x53586f[_0x0b8a('0x4f')]=_0x17d12c;if(_0xc3984a[_0x0b8a('0x40')][_0x0b8a('0x50')]){_0x1a189a[_0x0b8a('0x51')]=[{'all':!![]}];}return db[_0x0b8a('0x3b')][_0x0b8a('0x52')](_0x1a189a);})[_0x0b8a('0x31')](function(_0x463526){_0x53586f['rows']=_0x463526;return _0x53586f;})[_0x0b8a('0x31')](respondWithFilteredResult(_0x2d01c0,_0x1a189a))[_0x0b8a('0x27')](handleError(_0x2d01c0,null));};exports[_0x0b8a('0x53')]=function(_0x5c465f,_0x2f13f5){var _0x2afd66={'raw':![],'where':{'id':_0x5c465f['params']['id']}},_0x360c11={};_0x360c11['model']=_[_0x0b8a('0x54')](db['Trunk'][_0x0b8a('0x3c')]);_0x360c11[_0x0b8a('0x40')]=_[_0x0b8a('0x54')](_0x5c465f[_0x0b8a('0x40')]);_0x360c11[_0x0b8a('0x41')]=_[_0x0b8a('0x43')](_0x360c11['model'],_0x360c11['query']);_0x2afd66[_0x0b8a('0x45')]=_[_0x0b8a('0x43')](_0x360c11[_0x0b8a('0x42')],qs[_0x0b8a('0x44')](_0x5c465f['query'][_0x0b8a('0x44')]));_0x2afd66[_0x0b8a('0x45')]=_0x2afd66[_0x0b8a('0x45')][_0x0b8a('0x46')]?_0x2afd66[_0x0b8a('0x45')]:_0x360c11['model'];if(_0x5c465f[_0x0b8a('0x40')][_0x0b8a('0x50')]){_0x2afd66[_0x0b8a('0x51')]=[{'all':!![]}];}_0x2afd66=_[_0x0b8a('0x4c')]({},_0x2afd66,_0x5c465f[_0x0b8a('0x4e')]);return db[_0x0b8a('0x3b')][_0x0b8a('0x55')](_0x2afd66)[_0x0b8a('0x31')](handleEntityNotFound(_0x2f13f5,null))[_0x0b8a('0x31')](respondWithResult(_0x2f13f5,null))[_0x0b8a('0x27')](handleError(_0x2f13f5,null));};exports[_0x0b8a('0x56')]=function(_0xe6da58,_0x5108b1){var _0x24200b={'where':{'id':_0xe6da58['params']['id']}},_0x13dd96={};_0x13dd96[_0x0b8a('0x42')]=_[_0x0b8a('0x54')](db[_0x0b8a('0x3b')]['rawAttributes']);_0x24200b['attributes']=_[_0x0b8a('0x43')](_0x13dd96[_0x0b8a('0x42')],qs[_0x0b8a('0x44')](_0xe6da58[_0x0b8a('0x40')][_0x0b8a('0x44')]));_0x24200b[_0x0b8a('0x45')]=_0x24200b[_0x0b8a('0x45')][_0x0b8a('0x46')]?_0x24200b[_0x0b8a('0x45')]:_0x13dd96['model'];if(_0xe6da58['query'][_0x0b8a('0x50')]){_0x24200b[_0x0b8a('0x51')]=[{'all':!![]}];}_0x24200b=_['merge']({},_0x24200b,_0xe6da58[_0x0b8a('0x4e')]);return db[_0x0b8a('0x3b')][_0x0b8a('0x55')](_0x24200b)[_0x0b8a('0x31')](handleEntityNotFound(_0x5108b1,null))[_0x0b8a('0x31')](function(_0x4afcb1){if(_0x4afcb1){var _0x3cd031=_0x4afcb1[_0x0b8a('0x33')]({'plain':!![]});_0x3cd031=qs['omit'](_0x3cd031,['id',_0x0b8a('0x57'),_0x0b8a('0x58')]);_0xe6da58[_0x0b8a('0x59')]=_[_0x0b8a('0x5a')](_0xe6da58['body'],['id',_0x0b8a('0x57'),'updatedAt']);return db['Trunk'][_0x0b8a('0x5b')](_[_0x0b8a('0x4c')](_0x3cd031,_0xe6da58[_0x0b8a('0x59')]),{'include':_0xe6da58[_0x0b8a('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0x0b8a('0x31')](function(_0x44e965){var _0x2e5b75=_0xe6da58['user']['get']({'plain':!![]});if(!_0x2e5b75)throw new Error(_0x0b8a('0x5c'));if(_0x2e5b75[_0x0b8a('0x5d')]===_0x0b8a('0x5e')){var _0x5eb99d=_0x44e965[_0x0b8a('0x33')]({'plain':!![]});var _0x28a73c=_0x0b8a('0x34');return db['UserProfileSection'][_0x0b8a('0x55')]({'where':{'name':_0x28a73c,'userProfileId':_0x2e5b75[_0x0b8a('0x5f')]},'raw':!![]})[_0x0b8a('0x31')](function(_0x15eb59){if(_0x15eb59&&_0x15eb59['autoAssociation']===0x0){return db[_0x0b8a('0x60')]['create']({'name':_0x5eb99d[_0x0b8a('0x37')],'resourceId':_0x5eb99d['id'],'type':_0x15eb59[_0x0b8a('0x37')],'sectionId':_0x15eb59['id']},{})['then'](function(){return _0x44e965;});}else{return _0x44e965;}})[_0x0b8a('0x27')](function(_0x237f3f){logger[_0x0b8a('0x22')](_0x0b8a('0x61'),_0x237f3f);throw _0x237f3f;});}return _0x44e965;});}})[_0x0b8a('0x31')](respondWithResult(_0x5108b1,0xc9))[_0x0b8a('0x27')](handleError(_0x5108b1,null));};exports[_0x0b8a('0x5b')]=function(_0xaff5,_0xc42314,_0x2a9639){var _0x41c2bc;return db['Trunk'][_0x0b8a('0x5b')](_0xaff5[_0x0b8a('0x59')],{'raw':!![]})[_0x0b8a('0x31')](function(_0x1b8684){_0x41c2bc=_0x1b8684;return db['Trunk'][_0x0b8a('0x52')]({'raw':!![]});})[_0x0b8a('0x31')](function(_0x1a3c85){var _0x348f8a=fs['readFileSync'](path[_0x0b8a('0x62')](config[_0x0b8a('0x63')],_0x0b8a('0x64')),'utf8');var _0x1c9627=fs['readFileSync'](path[_0x0b8a('0x62')](config[_0x0b8a('0x63')],_0x0b8a('0x65')),'utf8');var _0x1b7a6a=ejs[_0x0b8a('0x66')](_0x348f8a,{'trunks':_0x1a3c85||[]});fs['writeFileSync'](_0x0b8a('0x67'),_0x1b7a6a);if(_0x41c2bc[_0x0b8a('0x68')]){var _0x43ff43=ejs[_0x0b8a('0x66')](_0x1c9627,{'trunks':_0x1a3c85||[]});fs['writeFileSync'](_0x0b8a('0x69'),_0x43ff43);}})[_0x0b8a('0x31')](function(){return respondWithRpcPromise(_0x0b8a('0x6a'),_0x0b8a('0x5b'),{'module':_0x0b8a('0x6b')});})[_0x0b8a('0x31')](function(){var _0x56a752=_0xaff5['user'][_0x0b8a('0x33')]({'plain':!![]});if(!_0x56a752)throw new Error(_0x0b8a('0x5c'));if(_0x56a752[_0x0b8a('0x5d')]===_0x0b8a('0x5e')){var _0x372fc1=_0x41c2bc[_0x0b8a('0x33')]({'plain':!![]});return db[_0x0b8a('0x6c')][_0x0b8a('0x55')]({'where':{'name':_0x0b8a('0x34'),'userProfileId':_0x56a752[_0x0b8a('0x5f')]},'raw':!![]})[_0x0b8a('0x31')](function(_0x904324){if(_0x904324&&_0x904324[_0x0b8a('0x6d')]===0x0){return db[_0x0b8a('0x60')][_0x0b8a('0x5b')]({'name':_0x372fc1['name'],'resourceId':_0x372fc1['id'],'type':_0x904324[_0x0b8a('0x37')],'sectionId':_0x904324['id']},{})['then'](function(){return _0x41c2bc;});}else{return _0x41c2bc;}})[_0x0b8a('0x27')](function(_0x2ae24e){logger[_0x0b8a('0x22')](_0x0b8a('0x61'),_0x2ae24e);throw _0x2ae24e;});}return _0x41c2bc;})[_0x0b8a('0x31')](respondWithResult(_0xc42314,0xc9))[_0x0b8a('0x27')](handleError(_0xc42314,null));};exports[_0x0b8a('0x30')]=function(_0x2b0005,_0x292305,_0x8cad5){var _0x4f19e2;return db['Trunk'][_0x0b8a('0x55')]({'where':{'id':_0x2b0005['params']['id']}})['then'](handleEntityNotFound(_0x292305,null))[_0x0b8a('0x31')](saveUpdates(_0x2b0005['body'],null))[_0x0b8a('0x31')](function(_0x51733f){if(_0x51733f){_0x4f19e2=_0x51733f;return db[_0x0b8a('0x3b')][_0x0b8a('0x52')]({'raw':!![]});}})[_0x0b8a('0x31')](function(_0x183db2){if(_0x183db2){var _0x1102a2=fs[_0x0b8a('0x6e')](path[_0x0b8a('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0x0b8a('0x6f'));var _0x5b6735=fs[_0x0b8a('0x6e')](path[_0x0b8a('0x62')](config[_0x0b8a('0x63')],_0x0b8a('0x65')),_0x0b8a('0x6f'));var _0x1ba94f=ejs[_0x0b8a('0x66')](_0x1102a2,{'trunks':_0x183db2||[]});fs[_0x0b8a('0x70')](_0x0b8a('0x67'),_0x1ba94f);var _0x24db7a=ejs[_0x0b8a('0x66')](_0x5b6735,{'trunks':_0x183db2||[]});fs['writeFileSync'](_0x0b8a('0x69'),_0x24db7a);return respondWithRpcPromise(_0x0b8a('0x6a'),_0x0b8a('0x30'),{'module':_0x0b8a('0x6b')});}return null;})[_0x0b8a('0x31')](function(_0x27b790){if(_0x27b790){return _0x4f19e2;}})[_0x0b8a('0x31')](respondWithResult(_0x292305,null))[_0x0b8a('0x27')](handleError(_0x292305,null));};exports[_0x0b8a('0x32')]=function(_0x505749,_0x5059d5,_0x5b233f){var _0x132a05;return db[_0x0b8a('0x3b')][_0x0b8a('0x55')]({'where':{'id':_0x505749[_0x0b8a('0x71')]['id']}})[_0x0b8a('0x31')](handleEntityNotFound(_0x5059d5,null))[_0x0b8a('0x31')](removeEntity(_0x5059d5,null))[_0x0b8a('0x31')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x0b8a('0x31')](function(_0x7ade73){var _0x1bfe3b=fs[_0x0b8a('0x6e')](path[_0x0b8a('0x62')](config[_0x0b8a('0x63')],_0x0b8a('0x64')),_0x0b8a('0x6f'));var _0x14b85e=fs[_0x0b8a('0x6e')](path['join'](config[_0x0b8a('0x63')],_0x0b8a('0x65')),'utf8');var _0x3ccf04=ejs[_0x0b8a('0x66')](_0x1bfe3b,{'trunks':_0x7ade73});var _0x7109a3=ejs[_0x0b8a('0x66')](_0x14b85e,{'trunks':_0x7ade73});fs[_0x0b8a('0x70')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3ccf04);fs[_0x0b8a('0x70')](_0x0b8a('0x69'),_0x7109a3);return respondWithRpcPromise('Reload',_0x0b8a('0x32'),{'module':_0x0b8a('0x6b')});})[_0x0b8a('0x27')](handleError(_0x5059d5,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b3dfc84..25325e2 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 _0x3658=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x2bc8a5,_0x5067c4){var _0x428272=function(_0x3c5a0b){while(--_0x3c5a0b){_0x2bc8a5['push'](_0x2bc8a5['shift']());}};_0x428272(++_0x5067c4);}(_0x3658,0xa7));var _0x8365=function(_0x517be4,_0x2fe5d9){_0x517be4=_0x517be4-0x0;var _0x4e1fcd=_0x3658[_0x517be4];return _0x4e1fcd;};'use strict';var _=require(_0x8365('0x0'));var util=require(_0x8365('0x1'));var logger=require(_0x8365('0x2'))(_0x8365('0x3'));var moment=require(_0x8365('0x4'));var BPromise=require(_0x8365('0x5'));var rp=require(_0x8365('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x8365('0x7')]=function(_0x5c4f6a,_0x683595){return _0x5c4f6a[_0x8365('0x8')](_0x8365('0x9'),attributes,{'tableName':_0x8365('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b2=['rimraf','../../config/environment','exports','Trunk','tools_trunks','lodash','../../config/logger','moment','bluebird','path'];(function(_0x21a49e,_0x35b78c){var _0xafb8fa=function(_0x3cbbd0){while(--_0x3cbbd0){_0x21a49e['push'](_0x21a49e['shift']());}};_0xafb8fa(++_0x35b78c);}(_0x97b2,0x163));var _0x297b=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x97b2[_0x134827];return _0x366671;};'use strict';var _=require(_0x297b('0x0'));var util=require('util');var logger=require(_0x297b('0x1'))('api');var moment=require(_0x297b('0x2'));var BPromise=require(_0x297b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x297b('0x4'));var rimraf=require(_0x297b('0x5'));var config=require(_0x297b('0x6'));var attributes=require('./trunk.attributes');module[_0x297b('0x7')]=function(_0x456df0,_0x4ab6a6){return _0x456df0['define'](_0x297b('0x8'),attributes,{'tableName':_0x297b('0x9'),'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 1a27a79..c596833 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 _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x494253,_0x4400de){var _0x14ce34=function(_0x53d8ad){while(--_0x53d8ad){_0x494253['push'](_0x494253['shift']());}};_0x14ce34(++_0x4400de);}(_0x2032,0xd9));var _0x2203=function(_0x67a031,_0x15ddb4){_0x67a031=_0x67a031-0x0;var _0x42a15f=_0x2032[_0x67a031];return _0x42a15f;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x4468b2,_0x4f0703){var _0x4fb044=function(_0x135dd5){while(--_0x135dd5){_0x4468b2['push'](_0x4468b2['shift']());}};_0x4fb044(++_0x4f0703);}(_0xda2d,0x102));var _0xdda2=function(_0x297f03,_0x2dea18){_0x297f03=_0x297f03-0x0;var _0x240eea=_0xda2d[_0x297f03];return _0x240eea;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c1dc50b..c7a3672 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 _0x362a=['update','put','/:id/queues','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','connect-timeout','express','Router','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/:id','show','/:id/avatar','/:id/contacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x362a,0x1d9));var _0xa362=function(_0x3bc72a,_0x25471d){_0x3bc72a=_0x3bc72a-0x0;var _0x539ff0=_0x362a[_0x3bc72a];return _0x539ff0;};'use strict';var multer=require(_0xa362('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa362('0x1'));var express=require(_0xa362('0x2'));var router=express[_0xa362('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa362('0x4'));var controller=require(_0xa362('0x5'));router[_0xa362('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa362('0x6')](_0xa362('0x7'),auth[_0xa362('0x8')](),controller[_0xa362('0x9')]);router[_0xa362('0x6')](_0xa362('0xa'),auth[_0xa362('0x8')](),controller[_0xa362('0xb')]);router['get'](_0xa362('0xc'),auth[_0xa362('0x8')](),controller[_0xa362('0xd')]);router[_0xa362('0x6')](_0xa362('0xe'),controller['getAvatar']);router['get'](_0xa362('0xf'),auth[_0xa362('0x8')](),controller['getContacts']);router['get']('/:id/queues',auth[_0xa362('0x8')](),controller['getQueues']);router[_0xa362('0x6')](_0xa362('0x10'),auth[_0xa362('0x8')](),controller[_0xa362('0x11')]);router[_0xa362('0x6')](_0xa362('0x12'),auth[_0xa362('0x8')](),controller['getGroups']);router[_0xa362('0x6')]('/:id/recordings',auth[_0xa362('0x8')](),controller[_0xa362('0x13')]);router['get'](_0xa362('0x14'),auth['isAuthenticated'](),controller[_0xa362('0x15')]);router[_0xa362('0x6')](_0xa362('0x16'),auth[_0xa362('0x8')](),controller[_0xa362('0x17')]);router[_0xa362('0x6')](_0xa362('0x18'),auth[_0xa362('0x8')](),controller[_0xa362('0x19')]);router[_0xa362('0x6')](_0xa362('0x1a'),auth[_0xa362('0x8')](),controller['getMailInteractions']);router[_0xa362('0x6')]('/:id/sms/interactions',auth[_0xa362('0x8')](),controller[_0xa362('0x1b')]);router[_0xa362('0x6')](_0xa362('0x1c'),auth[_0xa362('0x8')](),controller['getFaxInteractions']);router['get'](_0xa362('0x1d'),auth['isAuthenticated'](),controller[_0xa362('0x1e')]);router['get'](_0xa362('0x1f'),auth['isAuthenticated'](),controller[_0xa362('0x20')]);router['get'](_0xa362('0x21'),auth[_0xa362('0x8')](),controller[_0xa362('0x22')]);router[_0xa362('0x6')](_0xa362('0x23'),auth[_0xa362('0x8')](),controller['getAgents']);router[_0xa362('0x6')](_0xa362('0x24'),auth[_0xa362('0x8')](),controller[_0xa362('0x25')]);router[_0xa362('0x6')]('/:id/fax_accounts',auth[_0xa362('0x8')](),controller['getFaxAccounts']);router[_0xa362('0x6')](_0xa362('0x26'),auth[_0xa362('0x8')](),controller[_0xa362('0x27')]);router['get'](_0xa362('0x28'),auth[_0xa362('0x8')](),controller[_0xa362('0x29')]);router[_0xa362('0x6')](_0xa362('0x2a'),auth[_0xa362('0x8')](),controller[_0xa362('0x2b')]);router[_0xa362('0x6')](_0xa362('0x2c'),auth[_0xa362('0x8')](),controller['getChatWebsites']);router['get'](_0xa362('0x2d'),auth[_0xa362('0x8')](),controller[_0xa362('0x2e')]);router['get']('/:id/square_projects',auth[_0xa362('0x8')](),controller[_0xa362('0x2f')]);router[_0xa362('0x6')](_0xa362('0x30'),auth['isAuthenticated'](),controller[_0xa362('0x31')]);router['get'](_0xa362('0x32'),auth['isAuthenticated'](),controller[_0xa362('0x33')]);router[_0xa362('0x34')](_0xa362('0x35'),auth[_0xa362('0x8')](),controller[_0xa362('0x36')]);router[_0xa362('0x34')]('/:id/contacts',auth[_0xa362('0x8')](),controller[_0xa362('0x37')]);router['post']('/',auth[_0xa362('0x8')](),controller['create']);router['post']('/:id/queues',auth[_0xa362('0x8')](),controller[_0xa362('0x38')]);var upload=multer({'storage':multer[_0xa362('0x39')]({'destination':function(_0x53ea4f,_0x49e76d,_0xfe3b32){_0xfe3b32(null,path[_0xa362('0x3a')](config[_0xa362('0x3b')],_0xa362('0x3c')));},'filename':function(_0x1a36a9,_0x46e28b,_0x1ea05c){_0x1ea05c(null,util[_0xa362('0x3d')]('%s-%s',Date[_0xa362('0x3e')](),_0x46e28b[_0xa362('0x3f')]));}})});router[_0xa362('0x34')](_0xa362('0xe'),upload[_0xa362('0x40')](_0xa362('0x41')),controller[_0xa362('0x42')]);router[_0xa362('0x34')](_0xa362('0x43'),auth[_0xa362('0x8')](),controller[_0xa362('0x44')]);router['post'](_0xa362('0x45'),auth['isAuthenticated'](),controller[_0xa362('0x46')]);router[_0xa362('0x34')](_0xa362('0x47'),auth[_0xa362('0x8')](),controller[_0xa362('0x48')]);router['post'](_0xa362('0x49'),auth[_0xa362('0x8')](),controller[_0xa362('0x4a')]);router[_0xa362('0x34')](_0xa362('0x1f'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa362('0x34')](_0xa362('0x4b'),auth[_0xa362('0x8')](),controller[_0xa362('0x4c')]);router[_0xa362('0x34')](_0xa362('0x4d'),auth[_0xa362('0x8')](),controller[_0xa362('0x4e')]);router[_0xa362('0x34')](_0xa362('0x4f'),auth[_0xa362('0x8')](),controller['addFaxInteractions']);router[_0xa362('0x34')](_0xa362('0x50'),auth['isAuthenticated'](),controller[_0xa362('0x51')]);router[_0xa362('0x34')]('/:id/openchannel_interactions',auth[_0xa362('0x8')](),controller['addOpenchannelInteractions']);router[_0xa362('0x34')](_0xa362('0x52'),auth[_0xa362('0x8')](),controller[_0xa362('0x53')]);router[_0xa362('0x34')]('/:id/fax_accounts',auth[_0xa362('0x8')](),controller['addFaxAccounts']);router[_0xa362('0x34')](_0xa362('0x26'),auth[_0xa362('0x8')](),controller[_0xa362('0x54')]);router['post'](_0xa362('0x28'),auth[_0xa362('0x8')](),controller[_0xa362('0x55')]);router[_0xa362('0x34')](_0xa362('0x2a'),auth[_0xa362('0x8')](),controller[_0xa362('0x56')]);router[_0xa362('0x34')](_0xa362('0x2c'),auth[_0xa362('0x8')](),controller[_0xa362('0x57')]);router[_0xa362('0x34')](_0xa362('0x2d'),auth['isAuthenticated'](),controller[_0xa362('0x58')]);router['post'](_0xa362('0x59'),auth[_0xa362('0x8')](),controller[_0xa362('0x5a')]);router[_0xa362('0x34')]('/:id/api_key',auth[_0xa362('0x8')](),controller[_0xa362('0x5b')]);router['put'](_0xa362('0xc'),auth[_0xa362('0x8')](),controller[_0xa362('0x5c')]);router[_0xa362('0x5d')]('/:id/password',auth[_0xa362('0x8')](),controller['changePassword']);router['delete'](_0xa362('0x5e'),auth[_0xa362('0x8')](),controller[_0xa362('0x5f')]);router[_0xa362('0x60')](_0xa362('0x1f'),auth[_0xa362('0x8')](),controller['removeTeams']);router[_0xa362('0x60')](_0xa362('0xc'),auth[_0xa362('0x8')](),controller[_0xa362('0x61')]);router[_0xa362('0x60')](_0xa362('0x4b'),auth[_0xa362('0x8')](),controller[_0xa362('0x62')]);router[_0xa362('0x60')](_0xa362('0x4d'),auth[_0xa362('0x8')](),controller[_0xa362('0x63')]);router['delete'](_0xa362('0x4f'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xa362('0x60')]('/:id/sms_interactions',auth[_0xa362('0x8')](),controller[_0xa362('0x64')]);router['delete'](_0xa362('0x65'),auth[_0xa362('0x8')](),controller[_0xa362('0x66')]);router[_0xa362('0x60')](_0xa362('0x52'),auth[_0xa362('0x8')](),controller[_0xa362('0x67')]);router['delete']('/:id/fax_accounts',auth[_0xa362('0x8')](),controller[_0xa362('0x68')]);router[_0xa362('0x60')](_0xa362('0x26'),auth[_0xa362('0x8')](),controller[_0xa362('0x69')]);router[_0xa362('0x60')](_0xa362('0x28'),auth[_0xa362('0x8')](),controller[_0xa362('0x6a')]);router[_0xa362('0x60')](_0xa362('0x2a'),auth[_0xa362('0x8')](),controller[_0xa362('0x6b')]);router['delete'](_0xa362('0x2c'),auth[_0xa362('0x8')](),controller[_0xa362('0x6c')]);router[_0xa362('0x60')](_0xa362('0x2d'),auth[_0xa362('0x8')](),controller[_0xa362('0x6d')]);router[_0xa362('0x60')](_0xa362('0x59'),auth[_0xa362('0x8')](),controller[_0xa362('0x6e')]);router[_0xa362('0x60')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xa362('0x6f')]);module[_0xa362('0x70')]=router; \ No newline at end of file +var _0xbc5c=['/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/create_many','bulkCreate','addContacts','/:id/queues','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','update','put','/:id/password','changePassword','delete','destroy','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues_rt','getGroups'];(function(_0x28a1d3,_0x5aea15){var _0x24b6a0=function(_0x1c54cd){while(--_0x1c54cd){_0x28a1d3['push'](_0x28a1d3['shift']());}};_0x24b6a0(++_0x5aea15);}(_0xbc5c,0xcc));var _0xcbc5=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xbc5c[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xcbc5('0x0'));var util=require(_0xcbc5('0x1'));var path=require(_0xcbc5('0x2'));var timeout=require(_0xcbc5('0x3'));var express=require(_0xcbc5('0x4'));var router=express[_0xcbc5('0x5')]();var auth=require(_0xcbc5('0x6'));var interaction=require(_0xcbc5('0x7'));var config=require(_0xcbc5('0x8'));var controller=require(_0xcbc5('0x9'));router[_0xcbc5('0xa')]('/',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0xc')]);router[_0xcbc5('0xa')](_0xcbc5('0xd'),auth[_0xcbc5('0xb')](),controller['describe']);router[_0xcbc5('0xa')](_0xcbc5('0xe'),auth['isAuthenticated'](),controller[_0xcbc5('0xf')]);router['get'](_0xcbc5('0x10'),auth['isAuthenticated'](),controller[_0xcbc5('0x11')]);router[_0xcbc5('0xa')](_0xcbc5('0x12'),controller[_0xcbc5('0x13')]);router['get'](_0xcbc5('0x14'),auth['isAuthenticated'](),controller[_0xcbc5('0x15')]);router[_0xcbc5('0xa')]('/:id/queues',auth[_0xcbc5('0xb')](),controller['getQueues']);router[_0xcbc5('0xa')](_0xcbc5('0x16'),auth[_0xcbc5('0xb')](),controller['getVoiceQueuesRt']);router[_0xcbc5('0xa')]('/:id/groups',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x17')]);router[_0xcbc5('0xa')](_0xcbc5('0x18'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x19')]);router[_0xcbc5('0xa')]('/:id/screen_recordings',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x1a')]);router['get'](_0xcbc5('0x1b'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x1c')]);router['get'](_0xcbc5('0x1d'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x1e')]);router[_0xcbc5('0xa')]('/:id/mail/interactions',auth[_0xcbc5('0xb')](),controller['getMailInteractions']);router[_0xcbc5('0xa')](_0xcbc5('0x1f'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x20')]);router[_0xcbc5('0xa')](_0xcbc5('0x21'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x22')]);router[_0xcbc5('0xa')](_0xcbc5('0x23'),auth[_0xcbc5('0xb')](),controller['getWhatsappInteractions']);router[_0xcbc5('0xa')](_0xcbc5('0x24'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x25')]);router[_0xcbc5('0xa')](_0xcbc5('0x26'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x27')]);router[_0xcbc5('0xa')](_0xcbc5('0x28'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x29')]);router[_0xcbc5('0xa')](_0xcbc5('0x2a'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get'](_0xcbc5('0x2b'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x2c')]);router[_0xcbc5('0xa')](_0xcbc5('0x2d'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x2e')]);router['get'](_0xcbc5('0x2f'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x30')]);router[_0xcbc5('0xa')](_0xcbc5('0x31'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x32')]);router[_0xcbc5('0xa')]('/:id/chat_websites',auth[_0xcbc5('0xb')](),controller['getChatWebsites']);router[_0xcbc5('0xa')](_0xcbc5('0x33'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x34')]);router[_0xcbc5('0xa')](_0xcbc5('0x35'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x36')]);router[_0xcbc5('0xa')](_0xcbc5('0x37'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x38')]);router[_0xcbc5('0xa')]('/:id/api_key',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x39')]);router[_0xcbc5('0x3a')](_0xcbc5('0x3b'),auth['isAuthenticated'](),controller[_0xcbc5('0x3c')]);router[_0xcbc5('0x3a')](_0xcbc5('0x14'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x3d')]);router[_0xcbc5('0x3a')]('/',auth[_0xcbc5('0xb')](),controller['create']);router[_0xcbc5('0x3a')](_0xcbc5('0x3e'),auth['isAuthenticated'](),controller[_0xcbc5('0x3f')]);var upload=multer({'storage':multer[_0xcbc5('0x40')]({'destination':function(_0x20d5f1,_0x440b83,_0x202f29){_0x202f29(null,path[_0xcbc5('0x41')](config['root'],_0xcbc5('0x42')));},'filename':function(_0x50a997,_0x2b688e,_0x58ab93){_0x58ab93(null,util[_0xcbc5('0x43')](_0xcbc5('0x44'),Date[_0xcbc5('0x45')](),_0x2b688e[_0xcbc5('0x46')]));}})});router['post'](_0xcbc5('0x12'),upload[_0xcbc5('0x47')]('file'),controller[_0xcbc5('0x48')]);router['post'](_0xcbc5('0x49'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x4a')]);router[_0xcbc5('0x3a')](_0xcbc5('0x4b'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x4c')]);router[_0xcbc5('0x3a')](_0xcbc5('0x4d'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x4e')]);router[_0xcbc5('0x3a')](_0xcbc5('0x4f'),auth[_0xcbc5('0xb')](),controller['unpause']);router[_0xcbc5('0x3a')]('/:id/teams',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x50')]);router[_0xcbc5('0x3a')]('/:id/chat_interactions',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x51')]);router[_0xcbc5('0x3a')](_0xcbc5('0x52'),auth['isAuthenticated'](),controller[_0xcbc5('0x53')]);router[_0xcbc5('0x3a')](_0xcbc5('0x54'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x55')]);router[_0xcbc5('0x3a')](_0xcbc5('0x56'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x57')]);router['post'](_0xcbc5('0x58'),auth[_0xcbc5('0xb')](),controller['addOpenchannelInteractions']);router[_0xcbc5('0x3a')]('/:id/whatsapp_interactions',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x59')]);router[_0xcbc5('0x3a')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xcbc5('0x5a')]);router['post']('/:id/mail_accounts',auth[_0xcbc5('0xb')](),controller['addMailAccounts']);router[_0xcbc5('0x3a')](_0xcbc5('0x2f'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xcbc5('0x3a')](_0xcbc5('0x31'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x5b')]);router[_0xcbc5('0x3a')](_0xcbc5('0x5c'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x5d')]);router[_0xcbc5('0x3a')](_0xcbc5('0x33'),auth['isAuthenticated'](),controller[_0xcbc5('0x5e')]);router[_0xcbc5('0x3a')](_0xcbc5('0x35'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x5f')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router['put'](_0xcbc5('0x10'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x60')]);router[_0xcbc5('0x61')](_0xcbc5('0x62'),auth['isAuthenticated'](),controller[_0xcbc5('0x63')]);router[_0xcbc5('0x64')](_0xcbc5('0x3e'),auth[_0xcbc5('0xb')](),controller['removeQueues']);router[_0xcbc5('0x64')](_0xcbc5('0x24'),auth[_0xcbc5('0xb')](),controller['removeTeams']);router[_0xcbc5('0x64')]('/:id',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x65')]);router[_0xcbc5('0x64')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xcbc5('0x64')]('/:id/mail_interactions',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x66')]);router[_0xcbc5('0x64')](_0xcbc5('0x54'),auth[_0xcbc5('0xb')](),controller['removeFaxInteractions']);router[_0xcbc5('0x64')]('/:id/sms_interactions',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x67')]);router[_0xcbc5('0x64')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xcbc5('0x68')]);router[_0xcbc5('0x64')](_0xcbc5('0x69'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x6a')]);router['delete'](_0xcbc5('0x2b'),auth['isAuthenticated'](),controller[_0xcbc5('0x6b')]);router[_0xcbc5('0x64')](_0xcbc5('0x2d'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x6c')]);router[_0xcbc5('0x64')](_0xcbc5('0x2f'),auth[_0xcbc5('0xb')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x6d')]);router[_0xcbc5('0x64')](_0xcbc5('0x5c'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x6e')]);router[_0xcbc5('0x64')](_0xcbc5('0x33'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x6f')]);router[_0xcbc5('0x64')](_0xcbc5('0x35'),auth[_0xcbc5('0xb')](),controller[_0xcbc5('0x70')]);router[_0xcbc5('0x64')]('/:id/api_key',auth[_0xcbc5('0xb')](),controller['removeApiKey']);module[_0xcbc5('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 a6d3af5..3af7892 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 _0x4638=['dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','user','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','rfc2833','info','inband','auto','update','outgoing','yes','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','passive','nonat','update,nonat','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4638,0x1c6));var _0x8463=function(_0x39ff03,_0x566730){_0x39ff03=_0x39ff03-0x0;var _0x9c10f6=_0x4638[_0x39ff03];return _0x9c10f6;};'use strict';var Sequelize=require(_0x8463('0x0'));var moment=require(_0x8463('0x1'));var util=require('util');var _=require(_0x8463('0x2'));module[_0x8463('0x3')]={'name':{'type':Sequelize[_0x8463('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4f84d1){this[_0x8463('0x5')]('name',_0x4f84d1);this['setDataValue'](_0x8463('0x6'),_0x4f84d1);},'comment':_0x8463('0x7')},'fullname':{'type':Sequelize[_0x8463('0x4')],'allowNull':![],'set':function(_0x46179d){this[_0x8463('0x5')](_0x8463('0x8'),_0x46179d);this[_0x8463('0x5')](_0x8463('0x9'),util[_0x8463('0xa')]('\x22%s\x22\x20<%s>',_0x46179d,this[_0x8463('0xb')](_0x8463('0xc'))));}},'alias':{'type':Sequelize[_0x8463('0x4')]},'email':{'type':Sequelize[_0x8463('0x4')],'allowNull':![],'unique':_0x8463('0xd'),'validate':{'isEmail':!![]},'set':function(_0x36d2a1){if(_0x36d2a1){this[_0x8463('0x5')]('email',_0x36d2a1[_0x8463('0xe')]());}}},'role':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x10'),'user',_0x8463('0x11'),_0x8463('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x8463('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x8463('0x13')},'internal':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':![],'unique':_0x8463('0xc'),'set':function(_0x5ed949){this[_0x8463('0x5')](_0x8463('0xc'),_0x5ed949);this[_0x8463('0x5')](_0x8463('0x15'),_0x5ed949);this[_0x8463('0x5')](_0x8463('0x9'),util['format'](_0x8463('0x16'),this['getDataValue'](_0x8463('0x8')),_0x5ed949));}},'salt':{'type':Sequelize[_0x8463('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x8463('0x4')]},'zipcode':{'type':Sequelize[_0x8463('0x4')]},'userpic':{'type':Sequelize[_0x8463('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x8463('0x17')]},'voicePause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8463('0x4')],'defaultValue':_0x8463('0x19')},'lastPauseAt':{'type':Sequelize[_0x8463('0x17')]},'chatCapacity':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8463('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x8463('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8463('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![],'defaultValue':_0x8463('0x1a')},'ipaddr':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x8463('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x1b'),_0x8463('0x1c'),'peer'),'allowNull':!![],'defaultValue':_0x8463('0x1b')},'context':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![],'defaultValue':_0x8463('0x1d')},'callingpres':{'type':Sequelize[_0x8463('0xf')]('ALLOWED_NOT_SCREENED',_0x8463('0x1e'),_0x8463('0x1f'),'ALLOWED',_0x8463('0x20'),_0x8463('0x21'),_0x8463('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8463('0x23'),'set':function(_0x2d3281){this[_0x8463('0x5')]('transport',_0x2d3281?_0x2d3281[_0x8463('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x8463('0x25'))?this[_0x8463('0xb')]('transport')[_0x8463('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x27'),_0x8463('0x28'),'shortinfo',_0x8463('0x29'),_0x8463('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8463('0xf')]('yes','no','nonat',_0x8463('0x2b'),_0x8463('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![],'defaultValue':_0x8463('0x2e'),'set':function(_0x1c6f85){this['setDataValue'](_0x8463('0x2f'),_0x1c6f85?_0x1c6f85[_0x8463('0x24')](','):null);},'get':function(){return this[_0x8463('0xb')](_0x8463('0x2f'))?this[_0x8463('0xb')](_0x8463('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x8463('0x4')]},'namedcallgroup':{'type':Sequelize[_0x8463('0x4')]},'pickupgroup':{'type':Sequelize[_0x8463('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x8463('0x4')]},'language':{'type':Sequelize[_0x8463('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8463('0x4')]},'disallow':{'type':Sequelize[_0x8463('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x8463('0x4')],'allowNull':![],'defaultValue':_0x8463('0x30'),'set':function(_0x361c82){this[_0x8463('0x5')](_0x8463('0x31'),_0x361c82?_0x361c82[_0x8463('0x24')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x8463('0xb')](_0x8463('0x31'))?this[_0x8463('0xb')](_0x8463('0x31'))[_0x8463('0x26')](';'):null;},'comment':_0x8463('0x32')},'autoframing':{'type':Sequelize[_0x8463('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![],'set':function(_0x3fb241){this[_0x8463('0x5')](_0x8463('0x33'),_0x3fb241?_0x3fb241['join'](','):null);},'get':function(){return this[_0x8463('0xb')](_0x8463('0x33'))?this[_0x8463('0xb')](_0x8463('0x33'))[_0x8463('0x26')](','):null;},'comment':_0x8463('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8463('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![],'defaultValue':_0x8463('0x35')},'amaflags':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x8463('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no',_0x8463('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8463('0xf')]('accept',_0x8463('0x37'),_0x8463('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x39'),_0x8463('0x3a')),'allowNull':!![],'defaultValue':_0x8463('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x8463('0x2d')},'keepalive':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x8463('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x8463('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no','fingerprint',_0x8463('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8463('0x3c'),_0x8463('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x8463('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8463('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x8463('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8463('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8463('0xf')](_0x8463('0x2d'),'no',_0x8463('0x3e'),_0x8463('0x2b'),_0x8463('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8463('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x8463('0x17')]},'showWebBar':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0,'set':function(_0x5af5ab){this[_0x8463('0x5')]('showWebBar',_0x5af5ab);var _0x440a07=this[_0x8463('0x40')]({'plain':!![]});switch(_0x5af5ab){case 0x0:case 0x1:var _0x26d31d=_0x440a07[_0x8463('0x25')]?_[_0x8463('0x41')](_0x440a07[_0x8463('0x25')])?_0x440a07[_0x8463('0x25')][_0x8463('0x24')]():_0x440a07[_0x8463('0x25')]:_0x8463('0x23');if(_0x26d31d===_0x8463('0x42')){_0x26d31d=_0x8463('0x23');}this[_0x8463('0x5')](_0x8463('0x25'),_0x26d31d);this[_0x8463('0x5')](_0x8463('0x43'),'no');this[_0x8463('0x5')]('avpf',null);this['setDataValue'](_0x8463('0x44'),null);this[_0x8463('0x5')](_0x8463('0x45'),null);this['setDataValue'](_0x8463('0x46'),null);this['setDataValue'](_0x8463('0x47'),null);this[_0x8463('0x5')](_0x8463('0x48'),null);this['setDataValue'](_0x8463('0x49'),null);this[_0x8463('0x5')](_0x8463('0x4a'),null);this['setDataValue'](_0x8463('0x4b'),'no');break;case 0x2:this[_0x8463('0x5')](_0x8463('0x25'),'wss');this[_0x8463('0x5')](_0x8463('0x43'),_0x8463('0x2d'));this['setDataValue']('avpf',_0x8463('0x2d'));this[_0x8463('0x5')](_0x8463('0x44'),_0x8463('0x2d'));this[_0x8463('0x5')]('icesupport',_0x8463('0x2d'));this[_0x8463('0x5')](_0x8463('0x46'),_0x8463('0x2d'));this[_0x8463('0x5')]('dtlsverify','no');this[_0x8463('0x5')](_0x8463('0x48'),_0x8463('0x4c'));this[_0x8463('0x5')]('dtlscertfile',_0x440a07[_0x8463('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0x8463('0x5')](_0x8463('0x4a'),_0x440a07[_0x8463('0x4a')]||_0x8463('0x4d'));this[_0x8463('0x5')](_0x8463('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x8463('0x4e')],'set':function(_0x41e7c1){this[_0x8463('0x5')](_0x8463('0x4f'),_0x41e7c1?_0x41e7c1[_0x8463('0x24')](','):[]);},'get':function(){return this[_0x8463('0xb')](_0x8463('0x4f'))?_[_0x8463('0x50')](this['getDataValue'](_0x8463('0x4f'))[_0x8463('0x26')](','),function(_0x141ff4){return parseInt(_0x141ff4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x8463('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8463('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8463('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8463('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8463('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x8463('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8463('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8463('0x51')],'get':function(){return this[_0x8463('0xb')](_0x8463('0x52'))?this[_0x8463('0xb')](_0x8463('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x8463('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8463('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![],'set':function(_0x447c05){if(typeof _0x447c05==='string'){var _0x272452=_0x447c05==='1'?!![]:_0x447c05==='0'?![]:_0x447c05===_0x8463('0x53')?!![]:_0x447c05==='false'?![]:![];this['setDataValue'](_0x8463('0x54'),_0x272452);}else{this[_0x8463('0x5')]('screenrecording',_0x447c05);}}},'blocked':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![],'set':function(_0x450a2c){this[_0x8463('0x5')](_0x8463('0x55'),_0x450a2c);if(_0x450a2c===!![]){this[_0x8463('0x5')](_0x8463('0x56'),moment());this[_0x8463('0x5')](_0x8463('0x57'),0x0);}else{this[_0x8463('0x5')](_0x8463('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x8463('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8463('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8463('0x18')],'defaultValue':![]}}; \ No newline at end of file +var _0xfb11=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','get','isArray','wss','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','encryption','avpf','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','util','lodash','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x4597ea,_0x32ac9b){var _0x647332=function(_0x53b635){while(--_0x53b635){_0x4597ea['push'](_0x4597ea['shift']());}};_0x647332(++_0x32ac9b);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb11[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1fb1('0x0'));var moment=require('moment');var util=require(_0x1fb1('0x1'));var _=require(_0x1fb1('0x2'));module['exports']={'name':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x18108f){this['setDataValue'](_0x1fb1('0x4'),_0x18108f);this[_0x1fb1('0x5')]('defaultuser',_0x18108f);},'comment':_0x1fb1('0x6')},'fullname':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':![],'set':function(_0x4c098d){this[_0x1fb1('0x5')](_0x1fb1('0x7'),_0x4c098d);this[_0x1fb1('0x5')](_0x1fb1('0x8'),util[_0x1fb1('0x9')](_0x1fb1('0xa'),_0x4c098d,this[_0x1fb1('0xb')](_0x1fb1('0xc'))));}},'alias':{'type':Sequelize[_0x1fb1('0x3')]},'email':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x232036){if(_0x232036){this['setDataValue'](_0x1fb1('0xd'),_0x232036['toLowerCase']());}}},'role':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0xf'),_0x1fb1('0x10'),_0x1fb1('0x11'),_0x1fb1('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x1fb1('0x13')},'internal':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':![],'unique':_0x1fb1('0xc'),'set':function(_0x44f24c){this[_0x1fb1('0x5')](_0x1fb1('0xc'),_0x44f24c);this[_0x1fb1('0x5')](_0x1fb1('0x15'),_0x44f24c);this[_0x1fb1('0x5')]('callerid',util['format'](_0x1fb1('0xa'),this[_0x1fb1('0xb')](_0x1fb1('0x7')),_0x44f24c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1fb1('0x3')]},'mobile':{'type':Sequelize[_0x1fb1('0x3')]},'address':{'type':Sequelize[_0x1fb1('0x3')]},'zipcode':{'type':Sequelize[_0x1fb1('0x3')]},'userpic':{'type':Sequelize[_0x1fb1('0x3')]},'city':{'type':Sequelize[_0x1fb1('0x3')]},'country':{'type':Sequelize[_0x1fb1('0x3')]},'online':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1fb1('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x1fb1('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1fb1('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1fb1('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1fb1('0x19')},'ipaddr':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x1fb1('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x1a'),_0x1fb1('0x10'),_0x1fb1('0x1b')),'allowNull':!![],'defaultValue':_0x1fb1('0x1a')},'context':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![],'defaultValue':_0x1fb1('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x1fb1('0x1d'),_0x1fb1('0x1e'),_0x1fb1('0x1f'),_0x1fb1('0x20'),'PROHIB_NOT_SCREENED',_0x1fb1('0x21'),_0x1fb1('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1fb1('0x23'),'set':function(_0x149753){this[_0x1fb1('0x5')](_0x1fb1('0x24'),_0x149753?_0x149753[_0x1fb1('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x1fb1('0x24'))?this[_0x1fb1('0xb')](_0x1fb1('0x24'))[_0x1fb1('0x26')](','):null;},'comment':_0x1fb1('0x27')},'dtmfmode':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x28'),_0x1fb1('0x29'),_0x1fb1('0x2a'),'inband',_0x1fb1('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1fb1('0xe')]('yes','no',_0x1fb1('0x2c'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1fb1('0x2e'),'set':function(_0x9a78df){this[_0x1fb1('0x5')]('nat',_0x9a78df?_0x9a78df[_0x1fb1('0x25')](','):null);},'get':function(){return this[_0x1fb1('0xb')](_0x1fb1('0x2f'))?this[_0x1fb1('0xb')](_0x1fb1('0x2f'))[_0x1fb1('0x26')](','):null;},'comment':_0x1fb1('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1fb1('0x3')]},'pickupgroup':{'type':Sequelize[_0x1fb1('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1fb1('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':![],'defaultValue':_0x1fb1('0x31')},'allow':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':![],'defaultValue':_0x1fb1('0x32'),'set':function(_0x1a0b32){this[_0x1fb1('0x5')](_0x1fb1('0x33'),_0x1a0b32?_0x1a0b32[_0x1fb1('0x25')](';'):_0x1fb1('0x32'));},'get':function(){return this[_0x1fb1('0xb')](_0x1fb1('0x33'))?this[_0x1fb1('0xb')](_0x1fb1('0x33'))[_0x1fb1('0x26')](';'):null;},'comment':_0x1fb1('0x34')},'autoframing':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![],'set':function(_0x2ff635){this[_0x1fb1('0x5')]('insecure',_0x2ff635?_0x2ff635['join'](','):null);},'get':function(){return this[_0x1fb1('0xb')](_0x1fb1('0x35'))?this[_0x1fb1('0xb')](_0x1fb1('0x35'))[_0x1fb1('0x26')](','):null;},'comment':_0x1fb1('0x36')},'trustrpid':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1fb1('0x37')},'amaflags':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x1fb1('0x2d')},'busylevel':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1fb1('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no',_0x1fb1('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1fb1('0x39'),'refuse',_0x1fb1('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x1fb1('0x3b'),_0x1fb1('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x1fb1('0x2d')},'keepalive':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1fb1('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1fb1('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no',_0x1fb1('0x3d'),_0x1fb1('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1fb1('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x3f'),_0x1fb1('0x40'),_0x1fb1('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1fb1('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1fb1('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1fb1('0xe')](_0x1fb1('0x2d'),'no','nonat','update',_0x1fb1('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1fb1('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1fb1('0x17')]},'showWebBar':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x0,'set':function(_0x32c35a){this[_0x1fb1('0x5')]('showWebBar',_0x32c35a);var _0x6c7e85=this[_0x1fb1('0x43')]({'plain':!![]});switch(_0x32c35a){case 0x0:case 0x1:var _0x444efc=_0x6c7e85[_0x1fb1('0x24')]?_[_0x1fb1('0x44')](_0x6c7e85[_0x1fb1('0x24')])?_0x6c7e85['transport'][_0x1fb1('0x25')]():_0x6c7e85[_0x1fb1('0x24')]:_0x1fb1('0x23');if(_0x444efc===_0x1fb1('0x45')){_0x444efc=_0x1fb1('0x23');}this['setDataValue'](_0x1fb1('0x24'),_0x444efc);this[_0x1fb1('0x5')]('encryption','no');this[_0x1fb1('0x5')]('avpf',null);this[_0x1fb1('0x5')](_0x1fb1('0x46'),null);this[_0x1fb1('0x5')](_0x1fb1('0x47'),null);this['setDataValue'](_0x1fb1('0x48'),null);this[_0x1fb1('0x5')](_0x1fb1('0x49'),null);this[_0x1fb1('0x5')]('dtlssetup',null);this[_0x1fb1('0x5')]('dtlscertfile',null);this[_0x1fb1('0x5')](_0x1fb1('0x4a'),null);this['setDataValue'](_0x1fb1('0x4b'),'no');break;case 0x2:this[_0x1fb1('0x5')](_0x1fb1('0x24'),_0x1fb1('0x45'));this[_0x1fb1('0x5')](_0x1fb1('0x4c'),_0x1fb1('0x2d'));this['setDataValue'](_0x1fb1('0x4d'),_0x1fb1('0x2d'));this['setDataValue']('force_avp',_0x1fb1('0x2d'));this[_0x1fb1('0x5')](_0x1fb1('0x47'),_0x1fb1('0x2d'));this[_0x1fb1('0x5')](_0x1fb1('0x48'),_0x1fb1('0x2d'));this['setDataValue'](_0x1fb1('0x49'),'no');this[_0x1fb1('0x5')](_0x1fb1('0x4e'),_0x1fb1('0x41'));this[_0x1fb1('0x5')](_0x1fb1('0x4f'),_0x6c7e85[_0x1fb1('0x4f')]||_0x1fb1('0x50'));this[_0x1fb1('0x5')]('dtlsprivatekey',_0x6c7e85[_0x1fb1('0x4a')]||_0x1fb1('0x51'));this['setDataValue'](_0x1fb1('0x4b'),_0x1fb1('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x1fb1('0x52')],'set':function(_0x5931a7){this[_0x1fb1('0x5')](_0x1fb1('0x53'),_0x5931a7?_0x5931a7[_0x1fb1('0x25')](','):[]);},'get':function(){return this[_0x1fb1('0xb')](_0x1fb1('0x53'))?_[_0x1fb1('0x54')](this[_0x1fb1('0xb')](_0x1fb1('0x53'))[_0x1fb1('0x26')](','),function(_0x42d215){return parseInt(_0x42d215,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1fb1('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1fb1('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1fb1('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1fb1('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1fb1('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x1fb1('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1fb1('0x3')]},'passwordResetAt':{'type':Sequelize[_0x1fb1('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x1fb1('0x55'))?this[_0x1fb1('0xb')](_0x1fb1('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1fb1('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![],'set':function(_0x1ba897){if(typeof _0x1ba897===_0x1fb1('0x56')){var _0x1110e8=_0x1ba897==='1'?!![]:_0x1ba897==='0'?![]:_0x1ba897===_0x1fb1('0x57')?!![]:_0x1ba897===_0x1fb1('0x58')?![]:![];this[_0x1fb1('0x5')](_0x1fb1('0x59'),_0x1110e8);}else{this[_0x1fb1('0x5')](_0x1fb1('0x59'),_0x1ba897);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3de862){this[_0x1fb1('0x5')]('blocked',_0x3de862);if(_0x3de862===!![]){this[_0x1fb1('0x5')](_0x1fb1('0x5a'),moment());this[_0x1fb1('0x5')](_0x1fb1('0x5b'),0x0);}else{this[_0x1fb1('0x5')](_0x1fb1('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x1fb1('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1fb1('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 00e2c07..d16cfbe 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 _0xa4da=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','Setting','findOne','newPassword','Wrong\x20credentials','oldPassword','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','toLowerCase','emit','Queue:save','voice','VoiceQueue','findAll','push','interface','SIP/%s','UserVoiceQueueRt','upsert','remove','QueueId','Queue:remove','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','join','server/files/images/','getContacts','CmContact','CmList','List','Tag','color','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','each','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','isMiddleware','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','mail','chat','fax','sms','whatsapp','openchannel','set','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','removeTeams','getVoiceQueues','getSmsQueues','getFaxQueues','flatten','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','lastName','Contact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','destroy','get','Users','Agents','agent','Telephones','telephone','filter','map','value','includes','find','role','name','UserProfileResource','stack','send','index','User','rawAttributes','key','model','password','salt','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','sequelize','lower','col','includeAll','rows','differenceBy','include','options','bulkCreate','body','params','addContacts','ids','omit','user','../../config/license/util','telephones','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','findById','securePassword','min_internal','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','email','permissions','103','113','110','104','105','106','107','108','109','100','111','114','VoiceMail','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa4da,0xda));var _0xaa4d=function(_0x114984,_0x5c9593){_0x114984=_0x114984-0x0;var _0x44822b=_0xa4da[_0x114984];return _0x44822b;};'use strict';var pdf=require(_0xaa4d('0x0'));var emlformat=require(_0xaa4d('0x1'));var rimraf=require(_0xaa4d('0x2'));var zipdir=require(_0xaa4d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa4d('0x4'));var moment=require(_0xaa4d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaa4d('0x6'));var util=require(_0xaa4d('0x7'));var path=require('path');var sox=require(_0xaa4d('0x8'));var csv=require(_0xaa4d('0x9'));var ejs=require(_0xaa4d('0xa'));var fs=require('fs');var _=require(_0xaa4d('0xb'));var squel=require(_0xaa4d('0xc'));var crypto=require(_0xaa4d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa4d('0xe'));var toCsv=require(_0xaa4d('0x9'));var querystring=require(_0xaa4d('0xf'));var Papa=require(_0xaa4d('0x10'));var Redis=require(_0xaa4d('0x11'));var authService=require(_0xaa4d('0x12'));var qs=require(_0xaa4d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa4d('0x14'));var logger=require('../../config/logger')(_0xaa4d('0x15'));var utils=require(_0xaa4d('0x16'));var config=require('../../config/environment');var db=require(_0xaa4d('0x17'))['db'];config[_0xaa4d('0x18')]=_[_0xaa4d('0x19')](config[_0xaa4d('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')['register'](socket);var jayson=require(_0xaa4d('0x1a'));var client=jayson[_0xaa4d('0x1b')][_0xaa4d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x490b08,_0x643421,_0x2101e8){if(_0x2101e8){var _0xdb6174=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdb6174[_0xaa4d('0x1d')](_0x643421)){return _0x490b08;}else{throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x490b08;}}function respondWithRpcPromise(_0x4fcc18,_0x638408,_0x110b30,_0xb48dae){return new BPromise(function(_0x35dacf,_0x4af0af){var _0x541132=_0xb48dae||client;return _0x541132[_0xaa4d('0x20')](_0x4fcc18,_0x110b30)[_0xaa4d('0x21')](function(_0x3cf8b7){logger[_0xaa4d('0x22')](_0xaa4d('0x23'),_0x638408,_0xaa4d('0x24'));logger[_0xaa4d('0x25')]('User,\x20%s,\x20%s,\x20%s',_0x638408,'request\x20sent',JSON[_0xaa4d('0x26')](_0x3cf8b7));if(_0x3cf8b7[_0xaa4d('0x27')]){if(_0x3cf8b7[_0xaa4d('0x27')][_0xaa4d('0x28')]===0x1f4){logger[_0xaa4d('0x27')](_0xaa4d('0x23'),_0x638408,_0x3cf8b7[_0xaa4d('0x27')][_0xaa4d('0x29')]);return _0x4af0af(_0x3cf8b7[_0xaa4d('0x27')][_0xaa4d('0x29')]);}logger['error'](_0xaa4d('0x23'),_0x638408,_0x3cf8b7['error'][_0xaa4d('0x29')]);return _0x35dacf(_0x3cf8b7[_0xaa4d('0x27')][_0xaa4d('0x29')]);}else{logger[_0xaa4d('0x22')](_0xaa4d('0x23'),_0x638408,_0xaa4d('0x24'));_0x35dacf(_0x3cf8b7[_0xaa4d('0x2a')][_0xaa4d('0x29')]);}})[_0xaa4d('0x2b')](function(_0x26cb91){logger[_0xaa4d('0x27')](_0xaa4d('0x23'),_0x638408,_0x26cb91);_0x4af0af(_0x26cb91);});});}function respondWithStatusCode(_0x2ddca6,_0x3b8520){_0x3b8520=_0x3b8520||0xcc;return function(_0x246b36){if(_0x246b36){return _0x2ddca6[_0xaa4d('0x2c')](_0x3b8520);}return _0x2ddca6[_0xaa4d('0x2d')](_0x3b8520)[_0xaa4d('0x2e')]();};}function respondWithResult(_0x2844c2,_0x30bed5){_0x30bed5=_0x30bed5||0xc8;return function(_0x44b17e){if(_0x44b17e){return _0x2844c2[_0xaa4d('0x2d')](_0x30bed5)[_0xaa4d('0x2f')](_0x44b17e);}};}function respondWithFilteredResult(_0x4044db,_0x231d75){return function(_0x15db33){if(_0x15db33){var _0x3c9d13=_0x15db33[_0xaa4d('0x30')],_0x35be3d=_0x231d75[_0xaa4d('0x31')],_0x461300=_0x231d75[_0xaa4d('0x31')]+_0x231d75[_0xaa4d('0x32')],_0x5a61cd;if(_0x461300>=_0x3c9d13){_0x461300=_0x3c9d13;_0x5a61cd=0xc8;}else{_0x5a61cd=0xce;}_0x4044db[_0xaa4d('0x2d')](_0x5a61cd);return _0x4044db['set'](_0xaa4d('0x33'),_0x35be3d+'-'+_0x461300+'/'+_0x3c9d13)['json'](_0x15db33);}return null;};}function patchUpdates(_0x129c81){return function(_0x58f7d2){try{jsonpatch[_0xaa4d('0x34')](_0x58f7d2,_0x129c81,!![]);}catch(_0x3eecba){return BPromise['reject'](_0x3eecba);}return _0x58f7d2['save']();};}function saveUpdates(_0x36c1af,_0x57e6b6){return function(_0x5862e4){if(_0x5862e4){return _0x5862e4[_0xaa4d('0x35')](_0x36c1af)[_0xaa4d('0x21')](function(_0xd0619d){return _0xd0619d;});}return null;};}function removeEntity(_0x25b94c,_0x53b9cb){return function(_0x205f9c){if(_0x205f9c){return _0x205f9c[_0xaa4d('0x36')]()[_0xaa4d('0x21')](function(){var _0x55ba21=_0x205f9c[_0xaa4d('0x37')]({'plain':!![]});var _0x106371=[{'name':_0xaa4d('0x38'),'value':'user','ignore':!![]},{'name':_0xaa4d('0x39'),'value':_0xaa4d('0x3a'),'ignore':![]},{'name':_0xaa4d('0x3b'),'value':_0xaa4d('0x3c'),'ignore':![]}];var _0x194c87=_(_0x106371)[_0xaa4d('0x3d')]('ignore')[_0xaa4d('0x3e')](_0xaa4d('0x3f'))[_0xaa4d('0x3f')]();if(_[_0xaa4d('0x40')](_0x194c87,_0x55ba21['role'])){return;}var _0x2dbea0=_[_0xaa4d('0x41')](_0x106371,[_0xaa4d('0x3f'),_0x55ba21[_0xaa4d('0x42')]])[_0xaa4d('0x43')];return db[_0xaa4d('0x44')]['destroy']({'where':{'type':_0x2dbea0,'resourceId':_0x55ba21['id']}})['then'](function(){return _0x205f9c;});})[_0xaa4d('0x21')](function(){_0x25b94c[_0xaa4d('0x2d')](0xcc)[_0xaa4d('0x2e')]();});}};}function handleEntityNotFound(_0x2e3e48,_0x4f1190){return function(_0x21972b){if(!_0x21972b){_0x2e3e48['sendStatus'](0x194);}return _0x21972b;};}function handleError(_0x2e62d1,_0x173620){_0x173620=_0x173620||0x1f4;return function(_0x48f658){logger['error'](_0x48f658[_0xaa4d('0x45')]);if(_0x48f658['name']){delete _0x48f658['name'];}_0x2e62d1[_0xaa4d('0x2d')](_0x173620)[_0xaa4d('0x46')](_0x48f658);};}exports[_0xaa4d('0x47')]=function(_0x2187c0,_0x131cd2){var _0x59c36a={},_0x5bcb5f={},_0x28b9be={'count':0x0,'rows':[]};var _0xd764ea=_['map'](db[_0xaa4d('0x48')][_0xaa4d('0x49')],function(_0x53ea35){return{'name':_0x53ea35['fieldName'],'type':_0x53ea35['type'][_0xaa4d('0x4a')]};});_0x5bcb5f[_0xaa4d('0x4b')]=_['differenceBy'](_['map'](_0xd764ea,_0xaa4d('0x43')),[_0xaa4d('0x4c'),_0xaa4d('0x4d')]);_0x5bcb5f[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x2187c0[_0xaa4d('0x4e')]);_0x5bcb5f[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x5bcb5f['model'],_0x5bcb5f[_0xaa4d('0x4e')]);_0x59c36a[_0xaa4d('0x52')]=_['intersection'](_0x5bcb5f[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x2187c0[_0xaa4d('0x4e')]['fields']));_0x59c36a[_0xaa4d('0x52')]=_0x59c36a[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x59c36a['attributes']:_0x5bcb5f[_0xaa4d('0x4b')];if(!_0x2187c0[_0xaa4d('0x4e')][_0xaa4d('0x55')]('nolimit')){_0x59c36a[_0xaa4d('0x32')]=qs['limit'](_0x2187c0[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x59c36a[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x2187c0[_0xaa4d('0x4e')]['offset']);}_0x59c36a[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x2187c0['query'][_0xaa4d('0x57')]);_0x59c36a['where']=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x2187c0['query'],_0x5bcb5f[_0xaa4d('0x50')]),_0xd764ea);if(_0x2187c0[_0xaa4d('0x4e')][_0xaa4d('0x3d')]){_0x59c36a[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x59c36a[_0xaa4d('0x59')],{'$or':_['map'](_0xd764ea,function(_0x21aa6b){if(_0x21aa6b[_0xaa4d('0x5b')]!==_0xaa4d('0x5c')){return db[_0xaa4d('0x5d')][_0xaa4d('0x59')](db[_0xaa4d('0x5d')]['fn'](_0xaa4d('0x5e'),db['sequelize'][_0xaa4d('0x5f')](_0x21aa6b[_0xaa4d('0x43')])),{'$like':db[_0xaa4d('0x5d')]['fn'](_0xaa4d('0x5e'),'%'+_0x2187c0[_0xaa4d('0x4e')]['filter']+'%')});}})});}_0x59c36a=_['merge']({},_0x59c36a,_0x2187c0['options']);var _0xc178e7={'where':_0x59c36a[_0xaa4d('0x59')]};return db[_0xaa4d('0x48')]['count'](_0xc178e7)['then'](function(_0x351039){_0x28b9be['count']=_0x351039;if(_0x2187c0['query'][_0xaa4d('0x60')]){_0x59c36a['include']=[{'all':!![]}];}return db['User']['findAll'](_0x59c36a);})[_0xaa4d('0x21')](function(_0x59657b){_0x28b9be[_0xaa4d('0x61')]=_0x59657b;return _0x28b9be;})[_0xaa4d('0x21')](respondWithFilteredResult(_0x131cd2,_0x59c36a))['catch'](handleError(_0x131cd2,null));};exports['show']=function(_0x345415,_0x47d7a1){var _0x256f90={'raw':![],'where':{'id':_0x345415['params']['id']}},_0x345337={};_0x345337[_0xaa4d('0x4b')]=_[_0xaa4d('0x62')](_[_0xaa4d('0x4f')](db[_0xaa4d('0x48')][_0xaa4d('0x49')]),[_0xaa4d('0x4c'),_0xaa4d('0x4d')]);_0x345337[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x345415[_0xaa4d('0x4e')]);_0x345337['filters']=_[_0xaa4d('0x51')](_0x345337[_0xaa4d('0x4b')],_0x345337[_0xaa4d('0x4e')]);_0x256f90['attributes']=_[_0xaa4d('0x51')](_0x345337[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x345415[_0xaa4d('0x4e')][_0xaa4d('0x53')]));_0x256f90[_0xaa4d('0x52')]=_0x256f90[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x256f90[_0xaa4d('0x52')]:_0x345337[_0xaa4d('0x4b')];if(_0x345415[_0xaa4d('0x4e')]['includeAll']){_0x256f90[_0xaa4d('0x63')]=[{'all':!![]}];}_0x256f90=_[_0xaa4d('0x5a')]({},_0x256f90,_0x345415[_0xaa4d('0x64')]);return db[_0xaa4d('0x48')]['find'](_0x256f90)[_0xaa4d('0x21')](handleEntityNotFound(_0x47d7a1,null))[_0xaa4d('0x21')](respondWithResult(_0x47d7a1,null))[_0xaa4d('0x2b')](handleError(_0x47d7a1,null));};exports[_0xaa4d('0x65')]=function(_0x5581da,_0x39ad47){return db['User']['bulkCreate'](_0x5581da[_0xaa4d('0x66')],{'raw':![],'individualHooks':!![]})[_0xaa4d('0x21')](respondWithResult(_0x39ad47,0xc9))[_0xaa4d('0x2b')](handleError(_0x39ad47,null));};exports[_0xaa4d('0x35')]=function(_0x1f9cb6,_0x228804){if(_0x1f9cb6[_0xaa4d('0x66')]['id']){delete _0x1f9cb6[_0xaa4d('0x66')]['id'];}delete _0x1f9cb6[_0xaa4d('0x66')][_0xaa4d('0x42')];return db['User'][_0xaa4d('0x41')]({'where':{'id':_0x1f9cb6[_0xaa4d('0x67')]['id']}})['then'](handleEntityNotFound(_0x228804,null))[_0xaa4d('0x21')](saveUpdates(_0x1f9cb6['body'],null))[_0xaa4d('0x21')](respondWithResult(_0x228804,null))['catch'](handleError(_0x228804,null));};exports['describe']=function(_0x71bea3,_0x225abb){return db[_0xaa4d('0x48')]['describe']()['then'](respondWithResult(_0x225abb,null))[_0xaa4d('0x2b')](handleError(_0x225abb,null));};exports[_0xaa4d('0x68')]=function(_0x1009a8,_0x4a9113,_0x1bfa40){return db[_0xaa4d('0x48')][_0xaa4d('0x41')]({'where':{'id':_0x1009a8['params']['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x4a9113,null))[_0xaa4d('0x21')](function(_0x346cd8){if(_0x346cd8){return _0x346cd8['addContacts'](_0x1009a8[_0xaa4d('0x66')][_0xaa4d('0x69')],_[_0xaa4d('0x6a')](_0x1009a8[_0xaa4d('0x66')],[_0xaa4d('0x69'),'id'])||{});}})['then'](respondWithResult(_0x4a9113,null))[_0xaa4d('0x2b')](handleError(_0x4a9113,null));};var getLicense=function(_0x4e3cfe){return new BPromise(function(_0x4092dc,_0x2e85ea){var _0x505d07=0x0;_0x4e3cfe[_0xaa4d('0x66')][_0xaa4d('0x42')]==='agent'&&_0x4092dc('agent\x20role');return db[_0xaa4d('0x48')][_0xaa4d('0x30')]({'where':{'$or':[{'role':_0x4e3cfe['body'][_0xaa4d('0x42')]===_0xaa4d('0x3c')?'telephone':['admin',_0xaa4d('0x6b')]}]}})['then'](function(_0xc68db2){_0x505d07=_0xc68db2;return require(_0xaa4d('0x6c'))['getLicense']();})[_0xaa4d('0x21')](function(_0x538da5){var _0x15d21d=_0x4e3cfe[_0xaa4d('0x66')][_0xaa4d('0x42')]===_0xaa4d('0x3c')?_0xaa4d('0x6d'):'users';if(!_[_0xaa4d('0x6e')](_0x538da5[_0x15d21d])&&_0x505d07>=_0x538da5[_0x15d21d]){return _0x2e85ea({'message':_0xaa4d('0x6f')});}return _0x4092dc(util[_0xaa4d('0x70')](_0xaa4d('0x71'),_0x15d21d,_0x505d07));})[_0xaa4d('0x2b')](function(_0x1992de){return _0x2e85ea(_0x1992de);});});};exports[_0xaa4d('0x72')]=function(_0x981724,_0x36e55e){return getLicense(_0x981724)['then'](function(_0x5c14ad){if(!_0x981724[_0xaa4d('0x66')]['internal']){var _0x1ea02b;return db['Setting'][_0xaa4d('0x73')](0x1)[_0xaa4d('0x21')](function(_0x43e05b){return checkPasswordPattern(_0x43e05b,_0x981724[_0xaa4d('0x66')][_0xaa4d('0x4c')],_0x43e05b[_0xaa4d('0x74')]);})['then'](function(_0x2fe326){_0x1ea02b=_0x2fe326[_0xaa4d('0x75')];return db['User']['max'](_0xaa4d('0x76'));})[_0xaa4d('0x21')](function(_0x586dca){if(_['isNil'](_0x586dca)){if(_0x1ea02b){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')]=_0x1ea02b;}else{_0x981724[_0xaa4d('0x66')]['internal']=0x1;}}else{if(_[_0xaa4d('0x6e')](_0x1ea02b)||_0x1ea02b==_0x586dca){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')]=_0x586dca+0x1;}else if(_0x1ea02b>_0x586dca){_0x981724[_0xaa4d('0x66')]['internal']=_0x1ea02b;}else{return db[_0xaa4d('0x5d')][_0xaa4d('0x4e')](_0xaa4d('0x77'),{'type':db['sequelize'][_0xaa4d('0x78')][_0xaa4d('0x79')]})[_0xaa4d('0x21')](function(_0x1fee89){if(_0x1fee89&&_0x1fee89[_0xaa4d('0x54')]){for(var _0x4c7d97=0x0,_0x900cd3=_0x1fee89[_0xaa4d('0x54')];_0x4c7d97<_0x900cd3&&_[_0xaa4d('0x6e')](_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')]);_0x4c7d97++){if(_0x1ea02b<=_0x1fee89[_0x4c7d97][_0xaa4d('0x7a')]){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')]=_0x1fee89[_0x4c7d97]['from'];}else if(_0x1ea02b>_0x1fee89[_0x4c7d97][_0xaa4d('0x7a')]&&_0x1ea02b<=_0x1fee89[_0x4c7d97]['to']){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')]=_0x1ea02b;}}}if(_[_0xaa4d('0x6e')](_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')])){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')]=_0x586dca+0x1;}});}}});}})[_0xaa4d('0x21')](function(){if(_0x981724['body'][_0xaa4d('0x7b')]){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x7c')]=_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')];_0x981724[_0xaa4d('0x66')]['VoiceMail']={'mailbox':_0x981724[_0xaa4d('0x66')][_0xaa4d('0x76')],'password':_0x981724[_0xaa4d('0x66')]['password'],'fullname':_0x981724[_0xaa4d('0x66')]['fullname'],'email':_0x981724['body'][_0xaa4d('0x7d')]};}if(_0x981724[_0xaa4d('0x66')]&&_0x981724[_0xaa4d('0x66')]['role']===_0xaa4d('0x3a')){if(!_0x981724['body'][_0xaa4d('0x7e')]){_0x981724[_0xaa4d('0x66')][_0xaa4d('0x7e')]=['101','102',_0xaa4d('0x7f'),_0xaa4d('0x80'),_0xaa4d('0x81'),_0xaa4d('0x82'),_0xaa4d('0x83'),_0xaa4d('0x84'),_0xaa4d('0x85'),_0xaa4d('0x86'),_0xaa4d('0x87'),_0xaa4d('0x88'),_0xaa4d('0x89'),_0xaa4d('0x8a')];}}return db['User'][_0xaa4d('0x72')](_0x981724['body'],{'include':[{'model':db[_0xaa4d('0x8b')],'as':_0xaa4d('0x8b')}]});})[_0xaa4d('0x21')](function(_0x50ebdf){if(_0x981724['body'][_0xaa4d('0x42')]===_0xaa4d('0x6b'))return _0x50ebdf;var _0x8a0bcf=_0x981724[_0xaa4d('0x6b')][_0xaa4d('0x37')]({'plain':!![]});if(!_0x8a0bcf)throw new Error(_0xaa4d('0x8c'));if(_0x8a0bcf[_0xaa4d('0x42')]===_0xaa4d('0x6b')){var _0x2de251=_0x50ebdf['get']({'plain':!![]});var _0x35bb0d=[{'name':_0xaa4d('0x39'),'value':_0xaa4d('0x3a')},{'name':_0xaa4d('0x3b'),'value':_0xaa4d('0x3c')}];var _0x273fa3=_[_0xaa4d('0x41')](_0x35bb0d,[_0xaa4d('0x3f'),_0x2de251[_0xaa4d('0x42')]])['name'];return db[_0xaa4d('0x8d')][_0xaa4d('0x41')]({'where':{'name':_0x273fa3,'userProfileId':_0x8a0bcf[_0xaa4d('0x8e')]},'raw':!![]})[_0xaa4d('0x21')](function(_0x55a0d3){if(_0x55a0d3&&_0x55a0d3['autoAssociation']===0x0){return db[_0xaa4d('0x44')]['create']({'name':_0x2de251[_0xaa4d('0x43')],'resourceId':_0x2de251['id'],'type':_0x55a0d3[_0xaa4d('0x43')],'sectionId':_0x55a0d3['id']},{})[_0xaa4d('0x21')](function(){return _0x50ebdf;});}else{return _0x50ebdf;}})['catch'](function(_0x1c72fa){logger[_0xaa4d('0x27')](_0xaa4d('0x8f'),_0x1c72fa);throw _0x1c72fa;});}return _0x50ebdf;})[_0xaa4d('0x21')](respondWithResult(_0x36e55e,0xc9))[_0xaa4d('0x2b')](handleError(_0x36e55e,null));};exports[_0xaa4d('0x90')]=function(_0x4ae7cc,_0x35dbf0,_0x3926dd){var _0x277987=![];if(_0x4ae7cc[_0xaa4d('0x66')]['id']){delete _0x4ae7cc['body']['id'];}return db[_0xaa4d('0x91')][_0xaa4d('0x92')]({'attributes':['id',_0xaa4d('0x74')]})[_0xaa4d('0x21')](function(_0x3acaa8){_0x277987=_0x3acaa8[_0xaa4d('0x74')];return db[_0xaa4d('0x48')][_0xaa4d('0x41')]({'where':{'id':_0x4ae7cc[_0xaa4d('0x67')]['id']}});})['then'](function(_0x8cb48a){if(_0x8cb48a){if(_0x8cb48a['id']==_0x4ae7cc[_0xaa4d('0x6b')]['id']){if(!_0x4ae7cc[_0xaa4d('0x66')]['oldPassword']||!_0x4ae7cc[_0xaa4d('0x66')][_0xaa4d('0x93')]){throw new db[(_0xaa4d('0x1e'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x8cb48a['authenticate'](_0x4ae7cc[_0xaa4d('0x66')]['oldPassword'])){throw new db['Sequelize'][(_0xaa4d('0x1f'))](_0xaa4d('0x94'));}if(_0x4ae7cc['body'][_0xaa4d('0x95')]==_0x4ae7cc[_0xaa4d('0x66')][_0xaa4d('0x93')]){throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x8cb48a;}else if(_0x4ae7cc[_0xaa4d('0x6b')]['role']==_0xaa4d('0x96')){if(!_0x4ae7cc[_0xaa4d('0x66')]['newPassword']){throw new db['Sequelize'][(_0xaa4d('0x1f'))](_0xaa4d('0x97'));}return _0x8cb48a;}else if(_0x4ae7cc[_0xaa4d('0x6b')][_0xaa4d('0x42')]==_0xaa4d('0x6b')){if(!_0x4ae7cc['body'][_0xaa4d('0x93')]){throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))](_0xaa4d('0x97'));}if(_0x8cb48a[_0xaa4d('0x42')]!=_0xaa4d('0x3a')){throw new db[(_0xaa4d('0x1e'))]['ValidationError']('Unauthorized');}return _0x8cb48a;}else{throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))](_0xaa4d('0x98'));}}return null;})[_0xaa4d('0x21')](handleEntityNotFound(_0x35dbf0,null))[_0xaa4d('0x21')](function(_0x5155fb){return checkPasswordPattern(_0x5155fb,_0x4ae7cc['body'][_0xaa4d('0x93')],_0x277987);})[_0xaa4d('0x21')](saveUpdates({'password':_0x4ae7cc['body']['newPassword'],'passwordResetAt':_0x4ae7cc['user']['id']==_0x4ae7cc['params']['id']?moment():null},null))[_0xaa4d('0x21')](respondWithResult(_0x35dbf0,null))['catch'](handleError(_0x35dbf0,null));};exports[_0xaa4d('0x99')]=function(_0x9a1d0a,_0x9a9837,_0x198392){var _0x3485c7=_0x9a1d0a[_0xaa4d('0x66')][_0xaa4d('0x9a')];return db['User'][_0xaa4d('0x41')]({'where':{'id':_0x9a1d0a['params']['id']},'attributes':['id','name',_0xaa4d('0x42'),_0xaa4d('0x9b'),_0xaa4d('0x9c'),_0xaa4d('0x9d'),'interface']})[_0xaa4d('0x21')](handleEntityNotFound(_0x9a9837,null))['then'](function(_0x4a3898){if(_0x4a3898){if(!utils[_0xaa4d('0x9e')](_0x3485c7)){throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))](_0xaa4d('0x9f'));}return _0x4a3898[_0xaa4d('0xa0')+_[_0xaa4d('0xa1')](_0x3485c7['toLowerCase']())+_0xaa4d('0xa2')](_0x9a1d0a[_0xaa4d('0x66')][_0xaa4d('0x69')],{'penalty':_0x9a1d0a['body'][_0xaa4d('0xa3')]||0x0})[_0xaa4d('0xa4')](function(_0x1a8716){for(var _0x25e990=0x0;_0x25e990<_0x9a1d0a['body']['ids'][_0xaa4d('0x54')];_0x25e990+=0x1){var _0x43c445={'UserId':_0x9a1d0a[_0xaa4d('0x67')]['id']};_0x43c445[_[_0xaa4d('0xa1')](_0x3485c7[_0xaa4d('0xa5')]())+'QueueId']=_0x9a1d0a['body'][_0xaa4d('0x69')][_0x25e990];socket[_0xaa4d('0xa6')](_0xaa4d('0x6b')+_[_0xaa4d('0xa1')](_0x3485c7[_0xaa4d('0xa5')]())+_0xaa4d('0xa7'),_0x43c445);}return _0x1a8716;})['then'](function(){if(_0x3485c7===_0xaa4d('0xa8')){return db[_0xaa4d('0xa9')][_0xaa4d('0xaa')]({'where':{'id':_0x9a1d0a[_0xaa4d('0x66')][_0xaa4d('0x69')]||[]},'raw':!![],'attributes':['id',_0xaa4d('0x43')]});}})[_0xaa4d('0x21')](function(_0x41ca50){var _0x3582b3=_0x4a3898[_0xaa4d('0x37')]({'plain':!![]});var _0x200717=[];if(_0x3485c7===_0xaa4d('0xa8')&&_0x3582b3[_0xaa4d('0x42')]==='agent'&&_0x3582b3[_0xaa4d('0x9b')]){for(var _0x42a2e2=0x0;_0x42a2e2<_0x41ca50[_0xaa4d('0x54')];_0x42a2e2+=0x1){_0x200717[_0xaa4d('0xab')]({'membername':_0x3582b3['name'],'UserId':_0x3582b3['id'],'queue_name':_0x41ca50[_0x42a2e2][_0xaa4d('0x43')],'VoiceQueueId':_0x41ca50[_0x42a2e2]['id'],'interface':_[_0xaa4d('0x6e')](_0x3582b3[_0xaa4d('0xac')])?util[_0xaa4d('0x70')](_0xaa4d('0xad'),_0x3582b3[_0xaa4d('0x43')]):_0x3582b3['interface'],'paused':_0x3582b3[_0xaa4d('0x9d')]||![],'penalty':_0x9a1d0a[_0xaa4d('0x66')][_0xaa4d('0xa3')]||0x0});}return BPromise['each'](_0x200717,function(_0x168505){return db[_0xaa4d('0xae')][_0xaa4d('0xaf')](_0x168505);});}return _0x4a3898;});}})[_0xaa4d('0x21')](respondWithStatusCode(_0x9a9837,null))[_0xaa4d('0x2b')](handleError(_0x9a9837,null));};exports['removeQueues']=function(_0x44e42f,_0x4a8966,_0x1707c0){var _0x223c3d;return db[_0xaa4d('0x48')][_0xaa4d('0x41')]({'where':{'id':_0x44e42f[_0xaa4d('0x67')]['id']},'attributes':['id',_0xaa4d('0x43'),_0xaa4d('0x42')]})['then'](handleEntityNotFound(_0x4a8966,null))['then'](function(_0x1cb082){if(_0x1cb082){_0x223c3d=_0x1cb082;if(!_0x44e42f[_0xaa4d('0x4e')]['channel']||!utils[_0xaa4d('0x9e')](_0x44e42f[_0xaa4d('0x4e')][_0xaa4d('0x9a')])){throw new db[(_0xaa4d('0x1e'))]['ValidationError'](_0xaa4d('0x9f'));}return _0x1cb082[_0xaa4d('0xb0')+_[_0xaa4d('0xa1')](_0x44e42f['query']['channel'][_0xaa4d('0xa5')]())+_0xaa4d('0xa2')](_0x44e42f[_0xaa4d('0x4e')]['ids']);}})[_0xaa4d('0x21')](function(_0x35bc10){for(var _0x237642=0x0;_0x237642<_0x44e42f['query']['ids'][_0xaa4d('0x54')];_0x237642+=0x1){var _0x16c5a3={'UserId':_0x44e42f[_0xaa4d('0x67')]['id']};_0x16c5a3[_[_0xaa4d('0xa1')](_0x44e42f[_0xaa4d('0x4e')]['channel']['toLowerCase']())+_0xaa4d('0xb1')]=_0x44e42f[_0xaa4d('0x4e')][_0xaa4d('0x69')][_0x237642];socket[_0xaa4d('0xa6')](_0xaa4d('0x6b')+_['capitalize'](_0x44e42f[_0xaa4d('0x4e')][_0xaa4d('0x9a')][_0xaa4d('0xa5')]())+_0xaa4d('0xb2'),_0x16c5a3);}return _0x35bc10;})[_0xaa4d('0x21')](function(){if(_0x44e42f[_0xaa4d('0x4e')][_0xaa4d('0x9a')]===_0xaa4d('0xa8')){return db[_0xaa4d('0xae')][_0xaa4d('0x36')]({'where':{'UserId':_0x44e42f['params']['id'],'VoiceQueueId':_0x44e42f[_0xaa4d('0x4e')][_0xaa4d('0x69')]},'individualHooks':!![]})[_0xaa4d('0x21')](function(){return _0x223c3d;});}return _0x223c3d;})[_0xaa4d('0x21')](respondWithStatusCode(_0x4a8966,null))['catch'](handleError(_0x4a8966,null));};exports['addAvatar']=function(_0x39e1ca,_0x755ae,_0x1165a7){_0x39e1ca[_0xaa4d('0x66')][_0xaa4d('0xb3')]=_0x39e1ca[_0xaa4d('0xb4')]['filename'];return db[_0xaa4d('0x48')][_0xaa4d('0x41')]({'where':{'id':_0x39e1ca[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x755ae,null))[_0xaa4d('0x21')](saveUpdates(_0x39e1ca[_0xaa4d('0x66')],null))['then'](respondWithResult(_0x755ae,null))[_0xaa4d('0x2b')](handleError(_0x755ae,null));};exports[_0xaa4d('0xb5')]=function(_0x51c790,_0x4ddd13,_0x1eec95){var _0x5152e9=path['join'](config[_0xaa4d('0xb6')],_0xaa4d('0xb7'));return db[_0xaa4d('0x48')]['find']({'where':{'id':_0x51c790[_0xaa4d('0x67')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xaa4d('0x21')](handleEntityNotFound(_0x4ddd13,null))[_0xaa4d('0x21')](function(_0x1cf92c){if(_0x1cf92c){if(_['isNil'](_0x1cf92c[_0xaa4d('0xb3')])){return _0x4ddd13[_0xaa4d('0xb8')](_0x5152e9);}else{if(!fs['existsSync'](path[_0xaa4d('0xb9')](config['root'],_0xaa4d('0xba'),_0x1cf92c['userpic']))){return _0x4ddd13['download'](_0x5152e9);}return _0x4ddd13[_0xaa4d('0xb8')](path['join'](config[_0xaa4d('0xb6')],_0xaa4d('0xba'),_0x1cf92c[_0xaa4d('0xb3')]));}}})[_0xaa4d('0x2b')](handleError(_0x4ddd13,null));};exports[_0xaa4d('0xbb')]=function(_0x2731ab,_0xca8dce,_0x21fb44){var _0x1bd190={};var _0x166029={};var _0x29c854;var _0x439f5a;return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x2731ab[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0xca8dce,null))[_0xaa4d('0x21')](function(_0x1a128d){if(_0x1a128d){_0x29c854=_0x1a128d;_0x166029['model']=_[_0xaa4d('0x4f')](db[_0xaa4d('0xbc')][_0xaa4d('0x49')]);_0x166029[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x2731ab['query']);_0x166029[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x166029[_0xaa4d('0x4b')],_0x166029[_0xaa4d('0x4e')]);_0x1bd190[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x166029[_0xaa4d('0x4b')],qs['fields'](_0x2731ab[_0xaa4d('0x4e')][_0xaa4d('0x53')]));_0x1bd190['attributes']=_0x1bd190[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x1bd190[_0xaa4d('0x52')]:_0x166029[_0xaa4d('0x4b')];_0x1bd190[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x2731ab['query']['sort']);_0x1bd190['where']=qs['filters'](_[_0xaa4d('0x58')](_0x2731ab[_0xaa4d('0x4e')],_0x166029['filters']));if(_0x2731ab[_0xaa4d('0x4e')]['filter']){_0x1bd190[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x1bd190[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x1bd190['attributes'],function(_0x1f3bef){var _0x297bb3={};_0x297bb3[_0x1f3bef]={'$like':'%'+_0x2731ab[_0xaa4d('0x4e')]['filter']+'%'};return _0x297bb3;})});}_0x1bd190=_[_0xaa4d('0x5a')]({},_0x1bd190,_0x2731ab[_0xaa4d('0x64')]);return _0x29c854[_0xaa4d('0xbb')](_0x1bd190);}})[_0xaa4d('0x21')](function(_0x294c61){if(_0x294c61){_0x439f5a=_0x294c61['length'];if(_0x2731ab[_0xaa4d('0x4e')]['hasOwnProperty'](_0xaa4d('0x60'))){_0x1bd190[_0xaa4d('0x63')]=[{'model':db[_0xaa4d('0xbd')],'as':_0xaa4d('0xbe'),'required':![]},{'model':db[_0xaa4d('0xbf')],'as':'Tags','attributes':['id',_0xaa4d('0x43'),_0xaa4d('0xc0')],'where':_0x2731ab['query']['tag']?{'id':_0x2731ab['query'][_0xaa4d('0xc1')]}:undefined,'required':_0x2731ab[_0xaa4d('0x4e')][_0xaa4d('0xc1')]?!![]:![]}];}if(!_0x2731ab['query'][_0xaa4d('0x55')](_0xaa4d('0xc2'))){_0x1bd190[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x2731ab[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x1bd190[_0xaa4d('0x31')]=qs['offset'](_0x2731ab[_0xaa4d('0x4e')][_0xaa4d('0x31')]);}return _0x29c854[_0xaa4d('0xbb')](_0x1bd190);}})['then'](function(_0x44f83e){if(_0x44f83e){return _0x44f83e?{'count':_0x439f5a,'rows':_0x44f83e}:null;}})[_0xaa4d('0x21')](respondWithResult(_0xca8dce,null))[_0xaa4d('0x2b')](handleError(_0xca8dce,null));};exports[_0xaa4d('0xc3')]=function(_0x286118,_0x21cdc1,_0x2820eb){var _0x2fe5b9;var _0x12913d;var _0xe2e679={};var _0x151f4b;return db[_0xaa4d('0x48')]['findOne']({'where':{'id':_0x286118[_0xaa4d('0x67')]['id']},'attributes':['id',_0xaa4d('0x43'),_0xaa4d('0x42')]})[_0xaa4d('0x21')](handleEntityNotFound(_0x21cdc1,null))[_0xaa4d('0x21')](function(_0x201351){if(!utils[_0xaa4d('0x9e')](_0x286118['query'][_0xaa4d('0x9a')])){throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))](_0xaa4d('0x9f'));}_0x2fe5b9=_0x201351;var _0x204704={};_0x204704[_0xaa4d('0x4b')]=_['keys'](db[_[_0xaa4d('0xa1')](_0x286118['query'][_0xaa4d('0x9a')])+_0xaa4d('0xc4')][_0xaa4d('0x49')]);_0x204704[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x286118[_0xaa4d('0x4e')]);_0x204704[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x204704['model'],_0x204704[_0xaa4d('0x4e')]);_0xe2e679[_0xaa4d('0x52')]=_['intersection'](_0x204704['model'],qs[_0xaa4d('0x53')](_0x286118[_0xaa4d('0x4e')]['fields']));_0xe2e679[_0xaa4d('0x52')]=_0xe2e679['attributes'][_0xaa4d('0x54')]?_0xe2e679[_0xaa4d('0x52')]:_0x204704[_0xaa4d('0x4b')];_0xe2e679[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x286118[_0xaa4d('0x4e')]['sort']);_0xe2e679[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x286118['query'],_0x204704[_0xaa4d('0x50')]));if(_0x286118['query']['filter']){_0xe2e679['where']=_['merge'](_0xe2e679['where'],{'$or':_[_0xaa4d('0x3e')](_0xe2e679['attributes'],function(_0x5d57d8){var _0x5b1575={};_0x5b1575[_0x5d57d8]={'$like':'%'+_0x286118[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x5b1575;})});}_0xe2e679=_['merge']({},_0xe2e679,_0x286118[_0xaa4d('0x64')]);switch(_0x2fe5b9['role']){case _0xaa4d('0x96'):return db[_[_0xaa4d('0xa1')](_0x286118[_0xaa4d('0x4e')][_0xaa4d('0x9a')])+'Queue'][_0xaa4d('0xaa')](_0xe2e679);case _0xaa4d('0x6b'):case _0xaa4d('0x3a'):return _0x2fe5b9[_0xaa4d('0x37')+_[_0xaa4d('0xa1')](_0x286118[_0xaa4d('0x4e')][_0xaa4d('0x9a')])+_0xaa4d('0xa2')](_0xe2e679);default:throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))]('Unknown\x20role');}})[_0xaa4d('0x21')](function(_0x5bb36f){_0x151f4b=_0x5bb36f[_0xaa4d('0x54')];if(!_0x286118[_0xaa4d('0x4e')]['hasOwnProperty'](_0xaa4d('0xc2'))){_0xe2e679[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x286118[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0xe2e679[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x286118[_0xaa4d('0x4e')]['offset']);}switch(_0x2fe5b9[_0xaa4d('0x42')]){case'admin':return db[_[_0xaa4d('0xa1')](_0x286118[_0xaa4d('0x4e')][_0xaa4d('0x9a')])+_0xaa4d('0xc4')]['findAll'](_0xe2e679);case _0xaa4d('0x6b'):case _0xaa4d('0x3a'):return _0x2fe5b9[_0xaa4d('0x37')+_['capitalize'](_0x286118[_0xaa4d('0x4e')]['channel'])+_0xaa4d('0xa2')](_0xe2e679);}})[_0xaa4d('0x21')](function(_0x117b91){return{'count':_0x151f4b,'rows':_0x117b91};})[_0xaa4d('0x21')](respondWithResult(_0x21cdc1,null))[_0xaa4d('0x2b')](handleError(_0x21cdc1,null));};exports[_0xaa4d('0xc5')]=function(_0x12e6ee,_0x586c22,_0x2c01d0){var _0x3730ee={};var _0x2162b5={};var _0x1d3321;var _0x1a4118;return db[_0xaa4d('0x48')]['findOne']({'where':{'id':_0x12e6ee[_0xaa4d('0x67')]['id']}})['then'](handleEntityNotFound(_0x586c22,null))[_0xaa4d('0x21')](function(_0x5c8f58){if(_0x5c8f58){_0x1d3321=_0x5c8f58;_0x2162b5['model']=_[_0xaa4d('0x4f')](db[_0xaa4d('0xae')][_0xaa4d('0x49')]);_0x2162b5['query']=_[_0xaa4d('0x4f')](_0x12e6ee['query']);_0x2162b5['filters']=_['intersection'](_0x2162b5['model'],_0x2162b5[_0xaa4d('0x4e')]);_0x3730ee[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x2162b5[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x12e6ee['query'][_0xaa4d('0x53')]));_0x3730ee[_0xaa4d('0x52')]=_0x3730ee[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x3730ee['attributes']:_0x2162b5[_0xaa4d('0x4b')];_0x3730ee[_0xaa4d('0x56')]=qs['sort'](_0x12e6ee[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x3730ee[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x12e6ee['query'],_0x2162b5[_0xaa4d('0x50')]));if(_0x12e6ee['query'][_0xaa4d('0x3d')]){_0x3730ee[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x3730ee['where'],{'$or':_[_0xaa4d('0x3e')](_0x3730ee[_0xaa4d('0x52')],function(_0x233272){var _0x5722c5={};_0x5722c5[_0x233272]={'$like':'%'+_0x12e6ee[_0xaa4d('0x4e')]['filter']+'%'};return _0x5722c5;})});}_0x3730ee=_[_0xaa4d('0x5a')]({},_0x3730ee,_0x12e6ee['options']);return _0x1d3321[_0xaa4d('0xc5')](_0x3730ee);}})[_0xaa4d('0x21')](function(_0x5a09a6){if(_0x5a09a6){_0x1a4118=_0x5a09a6[_0xaa4d('0x54')];if(!_0x12e6ee[_0xaa4d('0x4e')][_0xaa4d('0x55')](_0xaa4d('0xc2'))){_0x3730ee[_0xaa4d('0x32')]=qs['limit'](_0x12e6ee[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x3730ee[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x12e6ee['query'][_0xaa4d('0x31')]);}return _0x1d3321['getVoiceQueuesRt'](_0x3730ee);}})[_0xaa4d('0x21')](function(_0x19f58d){if(_0x19f58d){return _0x19f58d?{'count':_0x1a4118,'rows':_0x19f58d}:null;}})['then'](respondWithResult(_0x586c22,null))['catch'](handleError(_0x586c22,null));};exports['getGroups']=function(_0xe4a0d8,_0x9ef3ce,_0x4f516c){var _0x9ec652={};var _0x1aa0d2={};var _0x1ec978;var _0x15b41c;return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0xe4a0d8[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x9ef3ce,null))['then'](function(_0x3f8031){if(_0x3f8031){_0x1ec978=_0x3f8031;_0x1aa0d2[_0xaa4d('0x4b')]=_['keys'](db['ChatGroup'][_0xaa4d('0x49')]);_0x1aa0d2[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0xe4a0d8['query']);_0x1aa0d2['filters']=_[_0xaa4d('0x51')](_0x1aa0d2[_0xaa4d('0x4b')],_0x1aa0d2[_0xaa4d('0x4e')]);_0x9ec652['attributes']=_[_0xaa4d('0x51')](_0x1aa0d2['model'],qs[_0xaa4d('0x53')](_0xe4a0d8[_0xaa4d('0x4e')]['fields']));_0x9ec652['attributes']=_0x9ec652[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x9ec652['attributes']:_0x1aa0d2['model'];_0x9ec652['order']=qs['sort'](_0xe4a0d8[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x9ec652[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0xe4a0d8[_0xaa4d('0x4e')],_0x1aa0d2['filters']));if(_0xe4a0d8[_0xaa4d('0x4e')][_0xaa4d('0x3d')]){_0x9ec652['where']=_[_0xaa4d('0x5a')](_0x9ec652[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x9ec652['attributes'],function(_0x4dd8a3){var _0x48e2f8={};_0x48e2f8[_0x4dd8a3]={'$like':'%'+_0xe4a0d8[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x48e2f8;})});}_0x9ec652=_[_0xaa4d('0x5a')]({},_0x9ec652,_0xe4a0d8[_0xaa4d('0x64')]);return _0x1ec978[_0xaa4d('0xc6')](_0x9ec652);}})[_0xaa4d('0x21')](function(_0x23c175){if(_0x23c175){_0x15b41c=_0x23c175['length'];if(!_0xe4a0d8[_0xaa4d('0x4e')]['hasOwnProperty']('nolimit')){_0x9ec652['limit']=qs[_0xaa4d('0x32')](_0xe4a0d8[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x9ec652[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0xe4a0d8['query'][_0xaa4d('0x31')]);}return _0x1ec978[_0xaa4d('0xc6')](_0x9ec652);}})['then'](function(_0x3e5740){if(_0x3e5740){return _0x3e5740?{'count':_0x15b41c,'rows':_0x3e5740}:null;}})[_0xaa4d('0x21')](respondWithResult(_0x9ef3ce,null))['catch'](handleError(_0x9ef3ce,null));};exports[_0xaa4d('0xc7')]=function(_0x2796df,_0x31d43e,_0x359029){var _0x462511={'raw':!![],'where':{}};var _0xa7495={};var _0x4b981b={'count':0x0,'rows':[]};return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x2796df[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x31d43e,null))[_0xaa4d('0x21')](function(_0xa1d740){if(_0xa1d740){_0xa7495[_0xaa4d('0x4b')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0xa7495[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x2796df[_0xaa4d('0x4e')]);_0xa7495['filters']=_['intersection'](_0xa7495[_0xaa4d('0x4b')],_0xa7495[_0xaa4d('0x4e')]);_0x462511['attributes']=_[_0xaa4d('0x51')](_0xa7495[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x2796df['query'][_0xaa4d('0x53')]));_0x462511[_0xaa4d('0x52')]=_0x462511['attributes'][_0xaa4d('0x54')]?_0x462511[_0xaa4d('0x52')]:_0xa7495['model'];if(!_0x2796df['query'][_0xaa4d('0x55')](_0xaa4d('0xc2'))){_0x462511[_0xaa4d('0x32')]=qs['limit'](_0x2796df[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x462511['offset']=qs[_0xaa4d('0x31')](_0x2796df[_0xaa4d('0x4e')][_0xaa4d('0x31')]);}_0x462511[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x2796df['query'][_0xaa4d('0x57')]);_0x462511['where']=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x2796df[_0xaa4d('0x4e')],_0xa7495[_0xaa4d('0x50')]));_0x462511[_0xaa4d('0x59')][_0xaa4d('0xc8')]=_0xa1d740['id'];if(_0x2796df[_0xaa4d('0x4e')][_0xaa4d('0x3d')]){_0x462511[_0xaa4d('0x59')]=_['merge'](_0x462511[_0xaa4d('0x59')],{'$or':_['map'](_0x462511[_0xaa4d('0x52')],function(_0x1f33f9){var _0x1a528a={};_0x1a528a[_0x1f33f9]={'$like':'%'+_0x2796df[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x1a528a;})});}_0x462511=_[_0xaa4d('0x5a')]({},_0x462511,_0x2796df[_0xaa4d('0x64')]);return db[_0xaa4d('0xc9')][_0xaa4d('0x30')]({'where':_0x462511[_0xaa4d('0x59')]})['then'](function(_0x7788bf){_0x4b981b[_0xaa4d('0x30')]=_0x7788bf;if(_0x2796df[_0xaa4d('0x4e')]['includeAll']){_0x462511[_0xaa4d('0x63')]=[{'all':!![]}];}return db[_0xaa4d('0xc9')][_0xaa4d('0xaa')](_0x462511);})['then'](function(_0x34b1ee){_0x4b981b[_0xaa4d('0x61')]=_0x34b1ee;return _0x4b981b;});}})[_0xaa4d('0x21')](respondWithFilteredResult(_0x31d43e,_0x462511))[_0xaa4d('0x2b')](handleError(_0x31d43e,null));};exports[_0xaa4d('0xca')]=function(_0x38a673,_0x317b05,_0x7a7a23){var _0x4a7caa={'raw':!![],'where':{}};var _0x4e13eb={};var _0x1c77ac={'count':0x0,'rows':[]};return db['User'][_0xaa4d('0x92')]({'where':{'id':_0x38a673[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x317b05,null))[_0xaa4d('0x21')](function(_0x361f73){if(_0x361f73){_0x4e13eb['model']=_[_0xaa4d('0x4f')](db[_0xaa4d('0xcb')][_0xaa4d('0x49')]);_0x4e13eb[_0xaa4d('0x4e')]=_['keys'](_0x38a673[_0xaa4d('0x4e')]);_0x4e13eb['filters']=_[_0xaa4d('0x51')](_0x4e13eb['model'],_0x4e13eb['query']);_0x4a7caa[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x4e13eb[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x38a673['query'][_0xaa4d('0x53')]));_0x4a7caa[_0xaa4d('0x52')]=_0x4a7caa[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x4a7caa[_0xaa4d('0x52')]:_0x4e13eb['model'];if(!_0x38a673[_0xaa4d('0x4e')][_0xaa4d('0x55')](_0xaa4d('0xc2'))){_0x4a7caa[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x38a673[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x4a7caa[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x38a673[_0xaa4d('0x4e')][_0xaa4d('0x31')]);}_0x4a7caa['order']=qs[_0xaa4d('0x57')](_0x38a673[_0xaa4d('0x4e')]['sort']);_0x4a7caa[_0xaa4d('0x59')]=qs['filters'](_[_0xaa4d('0x58')](_0x38a673[_0xaa4d('0x4e')],_0x4e13eb[_0xaa4d('0x50')]));_0x4a7caa['where']['UserId']=_0x361f73['id'];if(_0x38a673[_0xaa4d('0x4e')][_0xaa4d('0x3d')]){_0x4a7caa['where']=_[_0xaa4d('0x5a')](_0x4a7caa['where'],{'$or':_[_0xaa4d('0x3e')](_0x4a7caa[_0xaa4d('0x52')],function(_0x23113a){var _0xa9548={};_0xa9548[_0x23113a]={'$like':'%'+_0x38a673[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0xa9548;})});}_0x4a7caa=_[_0xaa4d('0x5a')]({},_0x4a7caa,_0x38a673['options']);return db[_0xaa4d('0xcb')]['count']({'where':_0x4a7caa[_0xaa4d('0x59')]})[_0xaa4d('0x21')](function(_0x18159b){_0x1c77ac['count']=_0x18159b;if(_0x38a673[_0xaa4d('0x4e')][_0xaa4d('0x60')]){_0x4a7caa[_0xaa4d('0x63')]=[{'all':!![]}];}return db[_0xaa4d('0xcb')][_0xaa4d('0xaa')](_0x4a7caa);})['then'](function(_0x2265f1){_0x1c77ac[_0xaa4d('0x61')]=_0x2265f1;return _0x1c77ac;});}})['then'](respondWithFilteredResult(_0x317b05,_0x4a7caa))[_0xaa4d('0x2b')](handleError(_0x317b05,null));};exports[_0xaa4d('0xcc')]=function(_0x453996,_0x89647b,_0x7300c0){var _0xb38ff2={};var _0x2d0e92={};var _0x56a000;var _0x2af361;return db[_0xaa4d('0x48')]['findOne']({'where':{'id':_0x453996[_0xaa4d('0x67')]['id']}})['then'](handleEntityNotFound(_0x89647b,null))[_0xaa4d('0x21')](function(_0x24af47){if(_0x24af47){_0x56a000=_0x24af47;_0x2d0e92[_0xaa4d('0x4b')]=_[_0xaa4d('0x4f')](db[_0xaa4d('0xcd')][_0xaa4d('0x49')]);_0x2d0e92[_0xaa4d('0x4e')]=_['keys'](_0x453996[_0xaa4d('0x4e')]);_0x2d0e92[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x2d0e92[_0xaa4d('0x4b')],_0x2d0e92[_0xaa4d('0x4e')]);_0xb38ff2[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x2d0e92[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x453996[_0xaa4d('0x4e')][_0xaa4d('0x53')]));_0xb38ff2[_0xaa4d('0x52')]=_0xb38ff2['attributes']['length']?_0xb38ff2[_0xaa4d('0x52')]:_0x2d0e92[_0xaa4d('0x4b')];_0xb38ff2[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x453996[_0xaa4d('0x4e')]['sort']);_0xb38ff2['where']=qs['filters'](_['pick'](_0x453996[_0xaa4d('0x4e')],_0x2d0e92[_0xaa4d('0x50')]));if(_0x453996[_0xaa4d('0x4e')]['filter']){_0xb38ff2['where']=_[_0xaa4d('0x5a')](_0xb38ff2[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0xb38ff2['attributes'],function(_0xe16b12){var _0x2039e7={};_0x2039e7[_0xe16b12]={'$like':'%'+_0x453996[_0xaa4d('0x4e')]['filter']+'%'};return _0x2039e7;})});}_0xb38ff2=_[_0xaa4d('0x5a')]({},_0xb38ff2,_0x453996[_0xaa4d('0x64')]);return _0x56a000[_0xaa4d('0xcc')](_0xb38ff2);}})[_0xaa4d('0x21')](function(_0x11aa12){if(_0x11aa12){_0x2af361=_0x11aa12[_0xaa4d('0x54')];if(!_0x453996[_0xaa4d('0x4e')]['hasOwnProperty'](_0xaa4d('0xc2'))){_0xb38ff2[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x453996[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0xb38ff2[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x453996['query']['offset']);}return _0x56a000['getChatInteractions'](_0xb38ff2);}})['then'](function(_0x3b380a){if(_0x3b380a){return _0x3b380a?{'count':_0x2af361,'rows':_0x3b380a}:null;}})[_0xaa4d('0x21')](respondWithResult(_0x89647b,null))[_0xaa4d('0x2b')](handleError(_0x89647b,null));};exports[_0xaa4d('0xce')]=function(_0x335a7a,_0xc891e7,_0x2ed2f1){var _0x198d19={};var _0x14d468={};var _0x1c6baf;var _0x77c053;return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x335a7a[_0xaa4d('0x67')]['id']}})['then'](handleEntityNotFound(_0xc891e7,null))[_0xaa4d('0x21')](function(_0x567575){if(_0x567575){_0x1c6baf=_0x567575;_0x14d468[_0xaa4d('0x4b')]=_[_0xaa4d('0x4f')](db[_0xaa4d('0xcf')]['rawAttributes']);_0x14d468[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x335a7a['query']);_0x14d468[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x14d468['model'],_0x14d468[_0xaa4d('0x4e')]);_0x198d19[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x14d468['model'],qs[_0xaa4d('0x53')](_0x335a7a[_0xaa4d('0x4e')]['fields']));_0x198d19[_0xaa4d('0x52')]=_0x198d19[_0xaa4d('0x52')]['length']?_0x198d19[_0xaa4d('0x52')]:_0x14d468[_0xaa4d('0x4b')];_0x198d19[_0xaa4d('0x56')]=qs['sort'](_0x335a7a[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x198d19[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x335a7a[_0xaa4d('0x4e')],_0x14d468[_0xaa4d('0x50')]));if(_0x335a7a[_0xaa4d('0x4e')][_0xaa4d('0x3d')]){_0x198d19[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x198d19[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x198d19[_0xaa4d('0x52')],function(_0x2782fd){var _0x200b86={};_0x200b86[_0x2782fd]={'$like':'%'+_0x335a7a[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x200b86;})});}_0x198d19=_[_0xaa4d('0x5a')]({},_0x198d19,_0x335a7a[_0xaa4d('0x64')]);return _0x1c6baf['getOpenchannelInteractions'](_0x198d19);}})[_0xaa4d('0x21')](function(_0x5a8c4e){if(_0x5a8c4e){_0x77c053=_0x5a8c4e[_0xaa4d('0x54')];if(!_0x335a7a[_0xaa4d('0x4e')][_0xaa4d('0x55')](_0xaa4d('0xc2'))){_0x198d19[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x335a7a[_0xaa4d('0x4e')]['limit']);_0x198d19[_0xaa4d('0x31')]=qs['offset'](_0x335a7a[_0xaa4d('0x4e')][_0xaa4d('0x31')]);}return _0x1c6baf[_0xaa4d('0xce')](_0x198d19);}})[_0xaa4d('0x21')](function(_0x240b55){if(_0x240b55){return _0x240b55?{'count':_0x77c053,'rows':_0x240b55}:null;}})[_0xaa4d('0x21')](respondWithResult(_0xc891e7,null))[_0xaa4d('0x2b')](handleError(_0xc891e7,null));};exports['getMailInteractions']=function(_0x9164b5,_0x194218,_0x451ea3){var _0x2b8204={'raw':!![],'where':{}};var _0x415d2e={};var _0x568107={'count':0x0,'rows':[]};return db['User'][_0xaa4d('0x92')]({'where':{'id':_0x9164b5[_0xaa4d('0x67')]['id']}})['then'](handleEntityNotFound(_0x194218,null))[_0xaa4d('0x21')](function(_0x3704be){if(_0x3704be){_0x415d2e[_0xaa4d('0x4b')]=_[_0xaa4d('0x4f')](db[_0xaa4d('0xd0')][_0xaa4d('0x49')]);_0x415d2e['query']=_[_0xaa4d('0x4f')](_0x9164b5[_0xaa4d('0x4e')]);_0x415d2e[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x415d2e['model'],_0x415d2e[_0xaa4d('0x4e')]);_0x2b8204['attributes']=_[_0xaa4d('0x51')](_0x415d2e[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x9164b5[_0xaa4d('0x4e')][_0xaa4d('0x53')]));_0x2b8204[_0xaa4d('0x52')]=_0x2b8204[_0xaa4d('0x52')]['length']?_0x2b8204[_0xaa4d('0x52')]:_0x415d2e[_0xaa4d('0x4b')];if(!_0x9164b5[_0xaa4d('0x4e')][_0xaa4d('0x55')]('nolimit')){_0x2b8204[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x9164b5[_0xaa4d('0x4e')]['limit']);_0x2b8204[_0xaa4d('0x31')]=qs['offset'](_0x9164b5['query'][_0xaa4d('0x31')]);}_0x2b8204[_0xaa4d('0x56')]=qs['sort'](_0x9164b5[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x2b8204['where']=qs['filters'](_[_0xaa4d('0x58')](_0x9164b5['query'],_0x415d2e[_0xaa4d('0x50')]));_0x2b8204[_0xaa4d('0x59')][_0xaa4d('0xc8')]=_0x3704be['id'];if(_0x9164b5['query'][_0xaa4d('0x3d')]){_0x2b8204['where']=_[_0xaa4d('0x5a')](_0x2b8204[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x2b8204[_0xaa4d('0x52')],function(_0x5ad2ca){var _0x3e91c8={};_0x3e91c8[_0x5ad2ca]={'$like':'%'+_0x9164b5[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x3e91c8;})});}_0x2b8204=_[_0xaa4d('0x5a')]({},_0x2b8204,_0x9164b5[_0xaa4d('0x64')]);return db[_0xaa4d('0xd0')][_0xaa4d('0x30')]({'where':_0x2b8204[_0xaa4d('0x59')]})[_0xaa4d('0x21')](function(_0x43cc78){_0x568107[_0xaa4d('0x30')]=_0x43cc78;if(_0x9164b5[_0xaa4d('0x4e')][_0xaa4d('0x60')]){_0x2b8204['include']=[{'all':!![]}];}return db[_0xaa4d('0xd0')][_0xaa4d('0xaa')](_0x2b8204);})[_0xaa4d('0x21')](function(_0x1730e1){_0x568107[_0xaa4d('0x61')]=_0x1730e1;return _0x568107;});}})[_0xaa4d('0x21')](respondWithFilteredResult(_0x194218,_0x2b8204))[_0xaa4d('0x2b')](handleError(_0x194218,null));};exports[_0xaa4d('0xd1')]=function(_0x5e7963,_0x4094f5,_0xffcb7){var _0x3ad6a5={};var _0xc2486d={};var _0x3a2b12;var _0x323d5e;return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x5e7963[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x4094f5,null))[_0xaa4d('0x21')](function(_0x130c6f){if(_0x130c6f){_0x3a2b12=_0x130c6f;_0xc2486d[_0xaa4d('0x4b')]=_[_0xaa4d('0x4f')](db[_0xaa4d('0xd2')][_0xaa4d('0x49')]);_0xc2486d['query']=_[_0xaa4d('0x4f')](_0x5e7963[_0xaa4d('0x4e')]);_0xc2486d[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0xc2486d[_0xaa4d('0x4b')],_0xc2486d[_0xaa4d('0x4e')]);_0x3ad6a5[_0xaa4d('0x52')]=_['intersection'](_0xc2486d[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x5e7963['query'][_0xaa4d('0x53')]));_0x3ad6a5['attributes']=_0x3ad6a5['attributes'][_0xaa4d('0x54')]?_0x3ad6a5[_0xaa4d('0x52')]:_0xc2486d[_0xaa4d('0x4b')];_0x3ad6a5['order']=qs[_0xaa4d('0x57')](_0x5e7963[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x3ad6a5[_0xaa4d('0x59')]=qs['filters'](_[_0xaa4d('0x58')](_0x5e7963[_0xaa4d('0x4e')],_0xc2486d[_0xaa4d('0x50')]));if(_0x5e7963[_0xaa4d('0x4e')]['filter']){_0x3ad6a5[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x3ad6a5[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x3ad6a5['attributes'],function(_0x1eb884){var _0x2e3f50={};_0x2e3f50[_0x1eb884]={'$like':'%'+_0x5e7963[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x2e3f50;})});}_0x3ad6a5=_[_0xaa4d('0x5a')]({},_0x3ad6a5,_0x5e7963['options']);return _0x3a2b12[_0xaa4d('0xd1')](_0x3ad6a5);}})[_0xaa4d('0x21')](function(_0x5295af){if(_0x5295af){_0x323d5e=_0x5295af[_0xaa4d('0x54')];if(!_0x5e7963[_0xaa4d('0x4e')][_0xaa4d('0x55')](_0xaa4d('0xc2'))){_0x3ad6a5[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x5e7963[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x3ad6a5[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x5e7963[_0xaa4d('0x4e')]['offset']);}return _0x3a2b12[_0xaa4d('0xd1')](_0x3ad6a5);}})[_0xaa4d('0x21')](function(_0x5729f2){if(_0x5729f2){return _0x5729f2?{'count':_0x323d5e,'rows':_0x5729f2}:null;}})['then'](respondWithResult(_0x4094f5,null))[_0xaa4d('0x2b')](handleError(_0x4094f5,null));};exports[_0xaa4d('0xd3')]=function(_0x46a85e,_0x431c41,_0x461bf4){var _0x53b60a={};var _0x462a3e={};var _0x179fe9;var _0x225eeb;return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x46a85e[_0xaa4d('0x67')]['id']}})['then'](handleEntityNotFound(_0x431c41,null))[_0xaa4d('0x21')](function(_0x5559f8){if(_0x5559f8){_0x179fe9=_0x5559f8;_0x462a3e[_0xaa4d('0x4b')]=_[_0xaa4d('0x4f')](db['FaxInteraction']['rawAttributes']);_0x462a3e[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x46a85e[_0xaa4d('0x4e')]);_0x462a3e['filters']=_[_0xaa4d('0x51')](_0x462a3e[_0xaa4d('0x4b')],_0x462a3e[_0xaa4d('0x4e')]);_0x53b60a[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x462a3e[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x46a85e[_0xaa4d('0x4e')][_0xaa4d('0x53')]));_0x53b60a[_0xaa4d('0x52')]=_0x53b60a['attributes'][_0xaa4d('0x54')]?_0x53b60a[_0xaa4d('0x52')]:_0x462a3e[_0xaa4d('0x4b')];_0x53b60a[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x46a85e[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x53b60a[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x46a85e['query'],_0x462a3e[_0xaa4d('0x50')]));if(_0x46a85e[_0xaa4d('0x4e')]['filter']){_0x53b60a[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x53b60a[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x53b60a['attributes'],function(_0x1e7fba){var _0x5bd9ae={};_0x5bd9ae[_0x1e7fba]={'$like':'%'+_0x46a85e[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x5bd9ae;})});}_0x53b60a=_[_0xaa4d('0x5a')]({},_0x53b60a,_0x46a85e['options']);return _0x179fe9['getFaxInteractions'](_0x53b60a);}})[_0xaa4d('0x21')](function(_0x4d7d55){if(_0x4d7d55){_0x225eeb=_0x4d7d55[_0xaa4d('0x54')];if(!_0x46a85e[_0xaa4d('0x4e')]['hasOwnProperty'](_0xaa4d('0xc2'))){_0x53b60a[_0xaa4d('0x32')]=qs['limit'](_0x46a85e['query'][_0xaa4d('0x32')]);_0x53b60a['offset']=qs[_0xaa4d('0x31')](_0x46a85e[_0xaa4d('0x4e')][_0xaa4d('0x31')]);}return _0x179fe9[_0xaa4d('0xd3')](_0x53b60a);}})[_0xaa4d('0x21')](function(_0x49393a){if(_0x49393a){return _0x49393a?{'count':_0x225eeb,'rows':_0x49393a}:null;}})[_0xaa4d('0x21')](respondWithResult(_0x431c41,null))[_0xaa4d('0x2b')](handleError(_0x431c41,null));};exports[_0xaa4d('0xd4')]=function(_0x2e516a,_0x11d047,_0x28d64a){var _0x95e471={};var _0x1bdb02={};var _0x30d5d8;var _0x139294;return db[_0xaa4d('0x48')]['findOne']({'where':{'id':_0x2e516a[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x11d047,null))['then'](function(_0x55cc21){if(_0x55cc21){_0x30d5d8=_0x55cc21;_0x1bdb02['model']=_['keys'](db[_0xaa4d('0xd5')][_0xaa4d('0x49')]);_0x1bdb02['query']=_[_0xaa4d('0x4f')](_0x2e516a[_0xaa4d('0x4e')]);_0x1bdb02[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x1bdb02[_0xaa4d('0x4b')],_0x1bdb02['query']);_0x95e471['attributes']=_['intersection'](_0x1bdb02['model'],qs[_0xaa4d('0x53')](_0x2e516a[_0xaa4d('0x4e')]['fields']));_0x95e471[_0xaa4d('0x52')]=_0x95e471['attributes'][_0xaa4d('0x54')]?_0x95e471[_0xaa4d('0x52')]:_0x1bdb02['model'];_0x95e471[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x2e516a[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x95e471['where']=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x2e516a[_0xaa4d('0x4e')],_0x1bdb02[_0xaa4d('0x50')]));if(_0x2e516a[_0xaa4d('0x4e')]['filter']){_0x95e471[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x95e471[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x95e471[_0xaa4d('0x52')],function(_0x3ba2b4){var _0x279831={};_0x279831[_0x3ba2b4]={'$like':'%'+_0x2e516a[_0xaa4d('0x4e')][_0xaa4d('0x3d')]+'%'};return _0x279831;})});}_0x95e471=_[_0xaa4d('0x5a')]({},_0x95e471,_0x2e516a['options']);return _0x30d5d8[_0xaa4d('0xd4')](_0x95e471);}})[_0xaa4d('0x21')](function(_0x5ec7c7){if(_0x5ec7c7){_0x139294=_0x5ec7c7[_0xaa4d('0x54')];if(!_0x2e516a[_0xaa4d('0x4e')]['hasOwnProperty'](_0xaa4d('0xc2'))){_0x95e471[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x2e516a['query'][_0xaa4d('0x32')]);_0x95e471[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x2e516a[_0xaa4d('0x4e')]['offset']);}return _0x30d5d8[_0xaa4d('0xd4')](_0x95e471);}})[_0xaa4d('0x21')](function(_0x19e55f){if(_0x19e55f){return _0x19e55f?{'count':_0x139294,'rows':_0x19e55f}:null;}})[_0xaa4d('0x21')](respondWithResult(_0x11d047,null))[_0xaa4d('0x2b')](handleError(_0x11d047,null));};exports[_0xaa4d('0xd6')]=function(_0x228a69,_0x5a366b,_0x2c307a){var _0x248797;var _0x5aa114;var _0x1b0d7f;var _0x5e7325=!_['isNil'](_0x228a69[_0xaa4d('0x67')]['id'])?_0x228a69[_0xaa4d('0x67')]['id']:!_[_0xaa4d('0x6e')](_0x228a69[_0xaa4d('0x6b')]['id'])?_0x228a69['user']['id']:null;return db[_0xaa4d('0x48')][_0xaa4d('0x41')]({'where':{'id':_0x5e7325,'role':{'$or':['admin','user',_0xaa4d('0x3a')]}},'attributes':['id','name',_0xaa4d('0xd7'),'mobile',_0xaa4d('0x42'),_0xaa4d('0x76'),_0xaa4d('0x9c')]})[_0xaa4d('0x21')](function(_0x4d825){if(_0x4d825){if(_0x4d825[_0xaa4d('0x42')]===_0xaa4d('0x3a')){_0x248797=_0x4d825;if(_0x228a69[_0xaa4d('0x66')][_0xaa4d('0xac')]){_0x1b0d7f=util[_0xaa4d('0x70')](_0xaa4d('0xd8'),_0x248797[_0x228a69[_0xaa4d('0x66')][_0xaa4d('0xac')]]);}else if(_0x228a69[_0xaa4d('0x66')][_0xaa4d('0xd9')]){_0x1b0d7f=util[_0xaa4d('0x70')](_0xaa4d('0xad'),_0x228a69[_0xaa4d('0x66')][_0xaa4d('0xd9')]);}else{_0x1b0d7f=util[_0xaa4d('0x70')](_0xaa4d('0xad'),_0x248797[_0xaa4d('0x43')]);}socket['to'](util[_0xaa4d('0x70')](_0xaa4d('0xda'),_0x248797[_0xaa4d('0x43')]))['emit']('user:forcelogout',{'ip':_0x228a69['headers'][_0xaa4d('0xdb')]||_0x228a69[_0xaa4d('0xdc')][_0xaa4d('0xdd')]||_0x228a69[_0xaa4d('0xde')]['remoteAddress']||_0x228a69[_0xaa4d('0xdc')]['socket']['remoteAddress']});return db[_0xaa4d('0xae')][_0xaa4d('0x36')]({'where':{'membername':_0x248797[_0xaa4d('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))](_0xaa4d('0xdf'));}})[_0xaa4d('0x21')](function(){if(_0x248797){return _0x248797['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x525ed2){if(_0x248797){var _0x55ea17=[];if(_0x525ed2){_0x5aa114=_0x525ed2;if(_0x5aa114[_0xaa4d('0x54')]){for(var _0x4250cd=0x0;_0x4250cd<_0x5aa114[_0xaa4d('0x54')];_0x4250cd++){_0x55ea17[_0xaa4d('0xab')]({'membername':_0x248797[_0xaa4d('0x43')],'UserId':_0x248797['id'],'queue_name':_0x5aa114[_0x4250cd][_0xaa4d('0x43')],'VoiceQueueId':_0x5aa114[_0x4250cd]['id'],'interface':_0x1b0d7f,'paused':_0x248797[_0xaa4d('0x9c')]||![],'penalty':_0x5aa114[_0x4250cd]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xaa4d('0xe0')](_0x55ea17,function(_0x58add3){return db[_0xaa4d('0xae')][_0xaa4d('0xaf')](_0x58add3);});}}}})[_0xaa4d('0x21')](function(){if(_0x248797){return db['MemberReport'][_0xaa4d('0xaa')]({'where':{'membername':_0x248797[_0xaa4d('0x43')],'exitAt':null}});}})[_0xaa4d('0x21')](function(_0x46588a){if(_0x248797){var _0x3ac8fc=[];_0x46588a['forEach'](function(_0x18539f){_0x3ac8fc[_0xaa4d('0xab')](_0x18539f[_0xaa4d('0x35')]({'exitAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1'))}));});return BPromise[_0xaa4d('0xe2')](_0x3ac8fc);}})[_0xaa4d('0x21')](function(){if(_0x248797){var _0x108095=[];var _0x1a4c6a=[];var _0x5172af=utils[_0xaa4d('0xe3')]();var _0x264f3d={'membername':_0x248797[_0xaa4d('0x43')],'interface':_0x1b0d7f,'enterAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1')),'role':_0x248797[_0xaa4d('0x42')],'internal':_0x248797[_0xaa4d('0x76')]};_0x5172af[_0xaa4d('0xe4')](function(_0x47451e){_0x108095[_0xaa4d('0xab')](_[_0xaa4d('0x5a')]({'channel':_0x47451e,'type':_0xaa4d('0xe5'),'data1':_0x228a69['body'][_0xaa4d('0xe6')],'data2':_0x1b0d7f},_0x264f3d));if(_0x248797[_0xaa4d('0x9c')]){_0x1a4c6a['push'](_[_0xaa4d('0x5a')]({'channel':_0x47451e,'type':_0xaa4d('0xe7'),'data1':_0xaa4d('0xe8')},_0x264f3d));}});return db[_0xaa4d('0xe9')][_0xaa4d('0x65')](_0x108095['concat'](_0x1a4c6a),{'individualHooks':!![]});}})[_0xaa4d('0x21')](function(){if(_0x248797){return _0x248797['update']({'online':!![],'lastLoginAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1')),'voicePause':_0x248797[_0xaa4d('0x9c')]||![],'mailPause':_0x248797[_0xaa4d('0x9c')]||![],'chatPause':_0x248797[_0xaa4d('0x9c')]||![],'faxPause':_0x248797[_0xaa4d('0x9c')]||![],'smsPause':_0x248797[_0xaa4d('0x9c')]||![],'openchannelPause':_0x248797[_0xaa4d('0x9c')]||![],'whatsappPause':_0x248797[_0xaa4d('0x9c')]||![],'pauseType':_0x248797[_0xaa4d('0x9c')]?_0xaa4d('0xe8'):null,'interface':_0x1b0d7f,'lastPauseAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1'))});}})[_0xaa4d('0x21')](function(_0x31e302){if(_0x228a69[_0xaa4d('0xea')]){return _0x2c307a();}else{return BPromise['resolve'](_0x31e302)[_0xaa4d('0x21')](respondWithResult(_0x5a366b,null));}})[_0xaa4d('0x2b')](handleError(_0x5a366b,null));};exports['logout']=function(_0x294439,_0x5b39b1,_0x4cc5db){var _0xdbad82;return db['User'][_0xaa4d('0x41')]({'where':{'id':_0x294439[_0xaa4d('0x67')]['id'],'role':_0xaa4d('0x3a')},'attributes':['id',_0xaa4d('0x43'),'role']})[_0xaa4d('0x21')](handleEntityNotFound(_0x5b39b1,null))[_0xaa4d('0x21')](function(_0x504cbf){if(_0x504cbf){_0xdbad82=_0x504cbf;return db[_0xaa4d('0xae')][_0xaa4d('0x36')]({'where':{'membername':_0xdbad82[_0xaa4d('0x43')]},'individualHooks':!![]});}})[_0xaa4d('0x21')](function(){return db[_0xaa4d('0xe9')][_0xaa4d('0xaa')]({'where':{'membername':_0xdbad82[_0xaa4d('0x43')],'exitAt':null}});})['then'](function(_0x31fafc){var _0x10c356=[];_0x31fafc['forEach'](function(_0xefcacc){_0x10c356[_0xaa4d('0xab')](_0xefcacc[_0xaa4d('0x35')]({'exitAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1'))}));});return BPromise['all'](_0x10c356);})[_0xaa4d('0x21')](function(){return _0xdbad82[_0xaa4d('0x35')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x5b39b1,null))[_0xaa4d('0x2b')](handleError(_0x5b39b1,null));};exports['pause']=function(_0x3b908f,_0x1884d0,_0x2f7063){var _0x5a5e65;return db[_0xaa4d('0xae')][_0xaa4d('0x35')]({'paused':0x1},{'where':{'UserId':_0x3b908f[_0xaa4d('0x67')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xaa4d('0x48')]['find']({'where':{'id':_0x3b908f['params']['id'],'role':_0xaa4d('0x3a')},'attributes':['id',_0xaa4d('0x43'),'role','internal',_0xaa4d('0xac')]});})['then'](handleEntityNotFound(_0x1884d0,null))[_0xaa4d('0x21')](function(_0x21ab2d){if(_0x21ab2d){_0x5a5e65=_0x21ab2d;return respondWithRpcPromise('QueuePause','pause',{'id':_0x5a5e65['id'],'name':_0x5a5e65['name'],'pause':!![]});}})[_0xaa4d('0x21')](function(){if(_0x5a5e65){return db[_0xaa4d('0xe9')][_0xaa4d('0xaa')]({'where':{'membername':_0x5a5e65[_0xaa4d('0x43')],'type':_0xaa4d('0xe7'),'exitAt':null}});}})[_0xaa4d('0x21')](function(_0x148de6){if(_0x148de6[_0xaa4d('0x54')]){var _0xe8225c=moment()[_0xaa4d('0x70')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x387f75=0x0,_0x1a2599=_0x148de6[_0xaa4d('0x54')];_0x387f75<_0x1a2599;_0x387f75++){_0x148de6[_0x387f75][_0xaa4d('0xeb')]({'exitAt':_0xe8225c});}}})['then'](function(){var _0x544950=[];var _0x5c0cd8=utils['getChannels']();_0x5c0cd8[_0xaa4d('0xe4')](function(_0x219489){_0x544950['push']({'channel':_0x219489,'membername':_0x5a5e65['name'],'interface':_[_0xaa4d('0x6e')](_0x5a5e65['interface'])?util[_0xaa4d('0x70')](_0xaa4d('0xad'),_0x5a5e65['name']):_0x5a5e65[_0xaa4d('0xac')],'type':_0xaa4d('0xe7'),'enterAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1')),'data1':_0x3b908f[_0xaa4d('0x66')][_0xaa4d('0x5b')]||_0xaa4d('0xec'),'role':_0x5a5e65[_0xaa4d('0x42')],'internal':_0x5a5e65['internal']});});return db[_0xaa4d('0xe9')][_0xaa4d('0x65')](_0x544950,{'individualHooks':!![]});})[_0xaa4d('0x21')](function(){return _0x5a5e65[_0xaa4d('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3b908f[_0xaa4d('0x66')][_0xaa4d('0x5b')]||_0xaa4d('0xec'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xaa4d('0x21')](respondWithResult(_0x1884d0,null))[_0xaa4d('0x2b')](handleError(_0x1884d0,null));};exports[_0xaa4d('0xed')]=function(_0x3ed218,_0x59dc31,_0x157921){var _0x43072e;return db[_0xaa4d('0x48')]['find']({'where':{'id':_0x3ed218['params']['id']},'attributes':['id',_0xaa4d('0x43'),_0xaa4d('0x42'),_0xaa4d('0x9d'),'mailPause',_0xaa4d('0xee'),_0xaa4d('0xef'),'openchannelPause','smsPause',_0xaa4d('0xf0'),_0xaa4d('0xf1'),_0xaa4d('0xf2')]})['then'](handleEntityNotFound(_0x59dc31,null))[_0xaa4d('0x21')](function(_0x4a595e){if(_0x4a595e){_0x43072e=_0x4a595e;if(_0x3ed218['body'][_0xaa4d('0x9a')]&&!utils[_0xaa4d('0x9e')](_0x3ed218[_0xaa4d('0x66')][_0xaa4d('0x9a')])){throw new db[(_0xaa4d('0x1e'))][(_0xaa4d('0x1f'))](_0xaa4d('0x9f'));}switch(_0x3ed218[_0xaa4d('0x66')][_0xaa4d('0x9a')]){case'voice':return respondWithRpcPromise(_0xaa4d('0xf3'),_0xaa4d('0xed'),{'id':_0x43072e['id'],'name':_0x43072e['name'],'pause':![]})[_0xaa4d('0x21')](function(){return db[_0xaa4d('0xae')][_0xaa4d('0x35')]({'paused':0x0},{'where':{'UserId':_0x43072e['id']},'individualHooks':!![]});})[_0xaa4d('0x21')](function(){return db['MemberReport'][_0xaa4d('0x41')]({'where':{'channel':_0x3ed218[_0xaa4d('0x66')][_0xaa4d('0x9a')],'membername':_0x43072e[_0xaa4d('0x43')],'type':_0xaa4d('0xe7'),'exitAt':null}});})['then'](function(_0x3d7781){if(_0x3d7781){return _0x3d7781['update']({'exitAt':moment()['format'](_0xaa4d('0xe1')),'data2':_0xaa4d('0xf4')},{'individualHooks':!![]});}return null;})[_0xaa4d('0x21')](function(){return _0x43072e['update']({'voicePause':![]});});case _0xaa4d('0xf5'):case _0xaa4d('0xf6'):case _0xaa4d('0xf7'):case _0xaa4d('0xf8'):case _0xaa4d('0xf9'):case _0xaa4d('0xfa'):return db[_0xaa4d('0xe9')][_0xaa4d('0x41')]({'where':{'channel':_0x3ed218['body']['channel'],'membername':_0x43072e[_0xaa4d('0x43')],'type':'PAUSE','exitAt':null}})[_0xaa4d('0x21')](function(_0x5c8266){if(_0x5c8266){return _0x5c8266['update']({'exitAt':moment()[_0xaa4d('0x70')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xaa4d('0x21')](function(){var _0x2cd64e={};_[_0xaa4d('0xfb')](_0x2cd64e,util['format'](_0xaa4d('0xfc'),_0x3ed218[_0xaa4d('0x66')]['channel'],_0xaa4d('0xfd')),![]);return _0x43072e['update'](_0x2cd64e);});default:return respondWithRpcPromise(_0xaa4d('0xf3'),_0xaa4d('0xed'),{'id':_0x43072e['id'],'name':_0x43072e[_0xaa4d('0x43')],'pause':![]})[_0xaa4d('0x21')](function(){return db[_0xaa4d('0xae')][_0xaa4d('0x35')]({'paused':0x0},{'where':{'UserId':_0x43072e['id']}});})[_0xaa4d('0x21')](function(){return db[_0xaa4d('0xe9')][_0xaa4d('0xaa')]({'where':{'membername':_0x43072e[_0xaa4d('0x43')],'type':_0xaa4d('0xe7'),'exitAt':null}});})[_0xaa4d('0x21')](function(_0x4710fd){var _0x18270b=[];_0x4710fd[_0xaa4d('0xe4')](function(_0x5e7460){_0x18270b[_0xaa4d('0xab')](_0x5e7460[_0xaa4d('0x35')]({'exitAt':moment()[_0xaa4d('0x70')](_0xaa4d('0xe1')),'data2':_0xaa4d('0xf4')}));});return BPromise[_0xaa4d('0xe2')](_0x18270b);})[_0xaa4d('0x21')](function(){return _0x43072e[_0xaa4d('0x35')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xaa4d('0x21')](respondWithResult(_0x59dc31,null))['catch'](handleError(_0x59dc31,null));};exports[_0xaa4d('0xfe')]=function(_0x31393c,_0x20aa51,_0x1aab28){var _0xd73cc1={};var _0x4428a4={};var _0x5a88a6;var _0x8e904f;return db['User'][_0xaa4d('0x92')]({'where':{'id':_0x31393c[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x20aa51,null))[_0xaa4d('0x21')](function(_0x470e96){if(_0x470e96){_0x5a88a6=_0x470e96;_0x4428a4[_0xaa4d('0x4b')]=_['keys'](db[_0xaa4d('0xff')]['rawAttributes']);_0x4428a4[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x31393c['query']);_0x4428a4[_0xaa4d('0x50')]=_[_0xaa4d('0x51')](_0x4428a4[_0xaa4d('0x4b')],_0x4428a4[_0xaa4d('0x4e')]);_0xd73cc1[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x4428a4[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x31393c[_0xaa4d('0x4e')][_0xaa4d('0x53')]));_0xd73cc1[_0xaa4d('0x52')]=_0xd73cc1[_0xaa4d('0x52')]['length']?_0xd73cc1['attributes']:_0x4428a4['model'];_0xd73cc1[_0xaa4d('0x56')]=qs[_0xaa4d('0x57')](_0x31393c[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0xd73cc1[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x31393c[_0xaa4d('0x4e')],_0x4428a4[_0xaa4d('0x50')]));if(_0x31393c['query']['filter']){_0xd73cc1['where']=_[_0xaa4d('0x5a')](_0xd73cc1[_0xaa4d('0x59')],{'$or':_['map'](_0xd73cc1[_0xaa4d('0x52')],function(_0x5663bc){var _0x23d707={};_0x23d707[_0x5663bc]={'$like':'%'+_0x31393c['query']['filter']+'%'};return _0x23d707;})});}_0xd73cc1=_['merge']({},_0xd73cc1,_0x31393c['options']);return _0x5a88a6['getTeams'](_0xd73cc1);}})[_0xaa4d('0x21')](function(_0x2958e0){if(_0x2958e0){_0x8e904f=_0x2958e0[_0xaa4d('0x54')];if(!_0x31393c[_0xaa4d('0x4e')][_0xaa4d('0x55')]('nolimit')){_0xd73cc1[_0xaa4d('0x32')]=qs[_0xaa4d('0x32')](_0x31393c['query'][_0xaa4d('0x32')]);_0xd73cc1[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x31393c[_0xaa4d('0x4e')]['offset']);}return _0x5a88a6[_0xaa4d('0xfe')](_0xd73cc1);}})[_0xaa4d('0x21')](function(_0xc97abc){if(_0xc97abc){return _0xc97abc?{'count':_0x8e904f,'rows':_0xc97abc}:null;}})['then'](respondWithResult(_0x20aa51,null))['catch'](handleError(_0x20aa51,null));};exports[_0xaa4d('0x100')]=function(_0x27655a,_0x196069){return db[_0xaa4d('0x48')][_0xaa4d('0x41')]({'where':{'id':_0x27655a['params']['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x196069,null))[_0xaa4d('0x21')](function(_0x545d65){if(_0x545d65){var _0x424c77=_0x545d65[_0xaa4d('0x37')]({'plain':!![]});return _0x545d65[_0xaa4d('0x100')](_0x27655a[_0xaa4d('0x66')][_0xaa4d('0x69')],_[_0xaa4d('0x6a')](_0x27655a[_0xaa4d('0x66')],[_0xaa4d('0x69'),'id'])||{})['then'](function(){for(var _0x2d1a6c=0x0;_0x2d1a6c<_0x27655a[_0xaa4d('0x66')][_0xaa4d('0x69')][_0xaa4d('0x54')];_0x2d1a6c++){var _0x44e84b=[];db[_0xaa4d('0xff')][_0xaa4d('0x92')]({'where':{'id':_0x27655a[_0xaa4d('0x66')]['ids'][_0x2d1a6c]}})[_0xaa4d('0x21')](function(_0x1397cf){_0x44e84b[_0xaa4d('0xab')](_0x1397cf['getVoiceQueues']()['then'](function(_0x3755d9){for(var _0x476e22=0x0;_0x476e22<_0x3755d9[_0xaa4d('0x54')];_0x476e22++){_0x3755d9[_0x476e22][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x102'));}return _0x3755d9;}));_0x44e84b[_0xaa4d('0xab')](_0x1397cf[_0xaa4d('0x103')]()[_0xaa4d('0x21')](function(_0x484976){for(var _0x435ece=0x0;_0x435ece<_0x484976[_0xaa4d('0x54')];_0x435ece++){_0x484976[_0x435ece][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x104'));}return _0x484976;}));_0x44e84b[_0xaa4d('0xab')](_0x1397cf[_0xaa4d('0x105')]()[_0xaa4d('0x21')](function(_0x47eb59){for(var _0x104fd2=0x0;_0x104fd2<_0x47eb59['length'];_0x104fd2++){_0x47eb59[_0x104fd2]['setDataValue'](_0xaa4d('0x9a'),_0xaa4d('0x106'));}return _0x47eb59;}));_0x44e84b[_0xaa4d('0xab')](_0x1397cf['getSmsQueues']()[_0xaa4d('0x21')](function(_0x72ace8){for(var _0x41edcd=0x0;_0x41edcd<_0x72ace8[_0xaa4d('0x54')];_0x41edcd++){_0x72ace8[_0x41edcd][_0xaa4d('0x101')]('channel',_0xaa4d('0x107'));}return _0x72ace8;}));_0x44e84b['push'](_0x1397cf[_0xaa4d('0x108')]()[_0xaa4d('0x21')](function(_0x2dc3ef){for(var _0x30ebf2=0x0;_0x30ebf2<_0x2dc3ef[_0xaa4d('0x54')];_0x30ebf2++){_0x2dc3ef[_0x30ebf2][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x109'));}return _0x2dc3ef;}));_0x44e84b[_0xaa4d('0xab')](_0x1397cf['getFaxQueues']()[_0xaa4d('0x21')](function(_0x3fce22){for(var _0x2e03b5=0x0;_0x2e03b5<_0x3fce22[_0xaa4d('0x54')];_0x2e03b5++){_0x3fce22[_0x2e03b5][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x10a'));}return _0x3fce22;}));_0x44e84b[_0xaa4d('0xab')](_0x1397cf[_0xaa4d('0x10b')]()[_0xaa4d('0x21')](function(_0x1bcead){for(var _0x2e5975=0x0;_0x2e5975<_0x1bcead['length'];_0x2e5975++){_0x1bcead[_0x2e5975][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x10c'));}return _0x1bcead;}));return BPromise['all'](_0x44e84b);})[_0xaa4d('0x21')](function(_0x2077d8){var _0x11d3fc=_['flatten'](_0x2077d8);_0x44e84b=[];return db[_0xaa4d('0x5d')][_0xaa4d('0x10d')](function(_0x417765){for(var _0x5739b6=0x0;_0x5739b6<_0x11d3fc[_0xaa4d('0x54')];_0x5739b6++){_0x44e84b['push'](_0x11d3fc[_0x5739b6][_0xaa4d('0x10e')](_0x424c77['id']),{'transaction':_0x417765});}return BPromise['all'](_0x44e84b)[_0xaa4d('0x21')](function(){if(_0x424c77[_0xaa4d('0x9b')]){return BPromise['each'](_[_0xaa4d('0x3d')](_0x11d3fc,function(_0x277691){return _0x277691[_0xaa4d('0x10f')](_0xaa4d('0x9a'))===_0xaa4d('0x102');}),function(_0x1402df){return db[_0xaa4d('0xae')][_0xaa4d('0xaf')]({'membername':_0x424c77[_0xaa4d('0x43')],'UserId':_0x424c77['id'],'queue_name':_0x1402df[_0xaa4d('0x43')],'VoiceQueueId':_0x1402df['id'],'interface':_[_0xaa4d('0x6e')](_0x424c77[_0xaa4d('0xac')])?util[_0xaa4d('0x70')]('SIP/%s',_0x424c77[_0xaa4d('0x43')]):_0x424c77['interface'],'paused':_0x424c77[_0xaa4d('0x9d')]||![],'penalty':_0x424c77[_0xaa4d('0xa3')]},{'transaction':_0x417765});});}else{return;}})[_0xaa4d('0x21')](function(){for(var _0x45480b=0x0;_0x45480b<_0x11d3fc[_0xaa4d('0x54')];_0x45480b++){var _0x1fdb84=_0x11d3fc[_0x45480b][_0xaa4d('0x10f')](_0xaa4d('0x9a'));var _0x1b0f2f=_0x1fdb84+_0xaa4d('0xb1');socket['emit'](_0xaa4d('0x6b')+_0x1fdb84+_0xaa4d('0xa7'),{'UserId':_0x424c77['id'],['queueField']:_0x11d3fc[_0x45480b]['id']});}});});});}});}})[_0xaa4d('0x21')](respondWithStatusCode(_0x196069,null))['catch'](handleError(_0x196069,null));};exports[_0xaa4d('0x110')]=function(_0x901551,_0x2245d1){return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x901551[_0xaa4d('0x67')]['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x2245d1,null))['then'](function(_0x45f265){if(_0x45f265){var _0x1ecc2c=_0x45f265['get']({'plain':!![]});var _0x387963=_0x901551['query'][_0xaa4d('0x69')];return _0x45f265[_0xaa4d('0x110')](_0x387963)[_0xaa4d('0x21')](function(){for(var _0xb83d5d=0x0;_0xb83d5d<_0x387963[_0xaa4d('0x54')];_0xb83d5d++){var _0x12dbe2=[];db[_0xaa4d('0xff')][_0xaa4d('0x92')]({'where':{'id':_0x387963[_0xb83d5d]}})['then'](function(_0x4a7e46){_0x12dbe2[_0xaa4d('0xab')](_0x4a7e46[_0xaa4d('0x111')]()[_0xaa4d('0x21')](function(_0x137fbb){for(var _0x36fbd2=0x0;_0x36fbd2<_0x137fbb['length'];_0x36fbd2++){_0x137fbb[_0x36fbd2][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x102'));}return _0x137fbb;}));_0x12dbe2[_0xaa4d('0xab')](_0x4a7e46[_0xaa4d('0x103')]()[_0xaa4d('0x21')](function(_0x32f552){for(var _0x49bfad=0x0;_0x49bfad<_0x32f552['length'];_0x49bfad++){_0x32f552[_0x49bfad]['setDataValue'](_0xaa4d('0x9a'),'Chat');}return _0x32f552;}));_0x12dbe2['push'](_0x4a7e46[_0xaa4d('0x105')]()[_0xaa4d('0x21')](function(_0x1f4a87){for(var _0x27340e=0x0;_0x27340e<_0x1f4a87['length'];_0x27340e++){_0x1f4a87[_0x27340e][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x106'));}return _0x1f4a87;}));_0x12dbe2[_0xaa4d('0xab')](_0x4a7e46[_0xaa4d('0x112')]()['then'](function(_0x54ef5a){for(var _0x14ab0c=0x0;_0x14ab0c<_0x54ef5a[_0xaa4d('0x54')];_0x14ab0c++){_0x54ef5a[_0x14ab0c][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x107'));}return _0x54ef5a;}));_0x12dbe2[_0xaa4d('0xab')](_0x4a7e46['getWhatsappQueues']()[_0xaa4d('0x21')](function(_0x2f86e2){for(var _0x3d450c=0x0;_0x3d450c<_0x2f86e2['length'];_0x3d450c++){_0x2f86e2[_0x3d450c][_0xaa4d('0x101')]('channel',_0xaa4d('0x109'));}return _0x2f86e2;}));_0x12dbe2[_0xaa4d('0xab')](_0x4a7e46[_0xaa4d('0x113')]()['then'](function(_0x253c9c){for(var _0x1f9f87=0x0;_0x1f9f87<_0x253c9c[_0xaa4d('0x54')];_0x1f9f87++){_0x253c9c[_0x1f9f87][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x10a'));}return _0x253c9c;}));_0x12dbe2['push'](_0x4a7e46[_0xaa4d('0x10b')]()[_0xaa4d('0x21')](function(_0x2a7d91){for(var _0x587b6d=0x0;_0x587b6d<_0x2a7d91['length'];_0x587b6d++){_0x2a7d91[_0x587b6d][_0xaa4d('0x101')](_0xaa4d('0x9a'),_0xaa4d('0x10c'));}return _0x2a7d91;}));return BPromise[_0xaa4d('0xe2')](_0x12dbe2);})['then'](function(_0x2bf232){var _0x29bae8=_[_0xaa4d('0x114')](_0x2bf232);_0x12dbe2=[];return db['sequelize'][_0xaa4d('0x10d')](function(_0x242ddc){for(var _0x15c5a5=0x0;_0x15c5a5<_0x29bae8[_0xaa4d('0x54')];_0x15c5a5++){_0x12dbe2[_0xaa4d('0xab')](_0x29bae8[_0x15c5a5]['removeAgent'](_0x1ecc2c['id']),{'transaction':_0x242ddc});}return BPromise['all'](_0x12dbe2)[_0xaa4d('0x21')](function(){if(_0x1ecc2c['online']){return BPromise[_0xaa4d('0xe0')](_[_0xaa4d('0x3d')](_0x29bae8,function(_0x496bb6){return _0x496bb6[_0xaa4d('0x10f')](_0xaa4d('0x9a'))==='Voice';}),function(_0x12c7e2){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x12c7e2['id'],'UserId':_0x1ecc2c['id']},'transaction':_0x242ddc});});}else{return;}})[_0xaa4d('0x21')](function(){for(var _0x370ba4=0x0;_0x370ba4<_0x29bae8[_0xaa4d('0x54')];_0x370ba4++){var _0x4f15a7=_0x29bae8[_0x370ba4][_0xaa4d('0x10f')]('channel');var _0x1bedd5=_0x4f15a7+_0xaa4d('0xb1');socket[_0xaa4d('0xa6')](_0xaa4d('0x6b')+_0x4f15a7+_0xaa4d('0xb2'),{'UserId':_0x1ecc2c['id'],['queueField']:_0x29bae8[_0x370ba4]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x2245d1,null))['catch'](handleError(_0x2245d1,null));};exports[_0xaa4d('0x115')]=function(_0x1280c2,_0x1759ff,_0x4f1b98){var _0x528ebf={};var _0x2ca83e={};var _0x377fe8;var _0x204064;return db['User'][_0xaa4d('0x92')]({'where':{'id':_0x1280c2['params']['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0x1759ff,null))[_0xaa4d('0x21')](function(_0x3733d5){if(_0x3733d5){_0x377fe8=_0x3733d5;_0x2ca83e['model']=_['keys'](db[_0xaa4d('0xbd')]['rawAttributes']);_0x2ca83e[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x1280c2['query']);_0x2ca83e['filters']=_[_0xaa4d('0x51')](_0x2ca83e[_0xaa4d('0x4b')],_0x2ca83e[_0xaa4d('0x4e')]);_0x528ebf[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x2ca83e[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x1280c2['query'][_0xaa4d('0x53')]));_0x528ebf[_0xaa4d('0x52')]=_0x528ebf[_0xaa4d('0x52')]['length']?_0x528ebf[_0xaa4d('0x52')]:_0x2ca83e[_0xaa4d('0x4b')];_0x528ebf['order']=qs[_0xaa4d('0x57')](_0x1280c2[_0xaa4d('0x4e')][_0xaa4d('0x57')]);_0x528ebf[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_['pick'](_0x1280c2[_0xaa4d('0x4e')],_0x2ca83e[_0xaa4d('0x50')]));if(_0x1280c2[_0xaa4d('0x4e')][_0xaa4d('0x3d')]){_0x528ebf[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x528ebf[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x528ebf[_0xaa4d('0x52')],function(_0x2b6248){var _0x456608={};_0x456608[_0x2b6248]={'$like':'%'+_0x1280c2[_0xaa4d('0x4e')]['filter']+'%'};return _0x456608;})});}_0x528ebf=_[_0xaa4d('0x5a')]({},_0x528ebf,_0x1280c2[_0xaa4d('0x64')]);return _0x377fe8[_0xaa4d('0x115')](_0x528ebf);}})[_0xaa4d('0x21')](function(_0x355c56){if(_0x355c56){_0x204064=_0x355c56[_0xaa4d('0x54')];if(!_0x1280c2['query']['hasOwnProperty']('nolimit')){_0x528ebf[_0xaa4d('0x32')]=qs['limit'](_0x1280c2[_0xaa4d('0x4e')][_0xaa4d('0x32')]);_0x528ebf[_0xaa4d('0x31')]=qs[_0xaa4d('0x31')](_0x1280c2[_0xaa4d('0x4e')][_0xaa4d('0x31')]);}return _0x377fe8[_0xaa4d('0x115')](_0x528ebf);}})[_0xaa4d('0x21')](function(_0x46d8d8){if(_0x46d8d8){return _0x46d8d8?{'count':_0x204064,'rows':_0x46d8d8}:null;}})['then'](respondWithResult(_0x1759ff,null))[_0xaa4d('0x2b')](handleError(_0x1759ff,null));};exports[_0xaa4d('0x116')]=function(_0x3db14e,_0xc04bed,_0x596167){var _0x2edd52={};var _0x4b576f={};var _0x474933;var _0x272da5;return db[_0xaa4d('0x48')][_0xaa4d('0x92')]({'where':{'id':_0x3db14e['params']['id']}})[_0xaa4d('0x21')](handleEntityNotFound(_0xc04bed,null))[_0xaa4d('0x21')](function(_0x2343b4){if(_0x2343b4){_0x474933=_0x2343b4;_0x4b576f[_0xaa4d('0x4b')]=_[_0xaa4d('0x4f')](db[_0xaa4d('0x48')][_0xaa4d('0x49')]);_0x4b576f[_0xaa4d('0x4e')]=_[_0xaa4d('0x4f')](_0x3db14e['query']);_0x4b576f['filters']=_[_0xaa4d('0x51')](_0x4b576f[_0xaa4d('0x4b')],_0x4b576f[_0xaa4d('0x4e')]);_0x2edd52[_0xaa4d('0x52')]=_[_0xaa4d('0x51')](_0x4b576f[_0xaa4d('0x4b')],qs[_0xaa4d('0x53')](_0x3db14e[_0xaa4d('0x4e')]['fields']));_0x2edd52[_0xaa4d('0x52')]=_0x2edd52[_0xaa4d('0x52')][_0xaa4d('0x54')]?_0x2edd52[_0xaa4d('0x52')]:_0x4b576f[_0xaa4d('0x4b')];_0x2edd52['order']=qs[_0xaa4d('0x57')](_0x3db14e['query']['sort']);_0x2edd52[_0xaa4d('0x59')]=qs[_0xaa4d('0x50')](_[_0xaa4d('0x58')](_0x3db14e[_0xaa4d('0x4e')],_0x4b576f['filters']));if(_0x3db14e[_0xaa4d('0x4e')]['filter']){_0x2edd52[_0xaa4d('0x59')]=_[_0xaa4d('0x5a')](_0x2edd52[_0xaa4d('0x59')],{'$or':_[_0xaa4d('0x3e')](_0x2edd52[_0xaa4d('0x52')],function(_0x222a4b){var _0x4ff3a9={};_0x4ff3a9[_0x222a4b]={'$like':'%'+_0x3db14e[_0xaa4d('0x4e')]['filter']+'%'};return _0x4ff3a9;})});}_0x2edd52[_0xaa4d('0x4b')]=db[_0xaa4d('0x48')];_0x2edd52['as']='Agents';_0x2edd52=_[_0xaa4d('0x5a')]({},_0x2edd52,_0x3db14e[_0xaa4d('0x64')]);return _0x474933[_0xaa4d('0x111')]({'include':[_0x2edd52]});}})[_0xaa4d('0x21')](function(_0x1a4df8){if(_0x1a4df8){var _0x26b760={},_0x4acd1d=[],_0x37548e=0x0;for(var _0x704fdc=0x0;_0x704fdc<_0x1a4df8[_0xaa4d('0x54')];_0x704fdc+=0x1){for(var _0x2ac665=0x0,_0x5831ab;_0x2ac665<_0x1a4df8[_0x704fdc][_0xaa4d('0x39')]['length'];_0x2ac665+=0x1){_0x5831ab=_0x1a4df8[_0x704fdc]['Agents'][_0x2ac665]['get']({'plain':!![]});_0x26b760[_0x5831ab['id']]=_0x5831ab;}}_0x26b760=_[_0xaa4d('0x117')](_0x26b760);for(var _0x473443=qs[_0xaa4d('0x31')](_0x3db14e[_0xaa4d('0x4e')][_0xaa4d('0x31')]);_0x473443<_0x26b760[_0xaa4d('0x54')]&&_0x4acd1d[_0xaa4d('0x54')]=_0x14e0f2){_0x5a0b83=_0x14e0f2;_0x4a04c3=0xc8;}else{_0x4a04c3=0xce;}_0x1e69ce[_0x6772('0x2d')](_0x4a04c3);return _0x1e69ce[_0x6772('0x32')](_0x6772('0x33'),_0x275ad7+'-'+_0x5a0b83+'/'+_0x14e0f2)[_0x6772('0x2e')](_0x28fe8e);}return null;};}function patchUpdates(_0x2ca56b){return function(_0x190402){try{jsonpatch[_0x6772('0x34')](_0x190402,_0x2ca56b,!![]);}catch(_0x4e1509){return BPromise[_0x6772('0x35')](_0x4e1509);}return _0x190402[_0x6772('0x36')]();};}function saveUpdates(_0x26bf36,_0x25fe8b){return function(_0x18d636){if(_0x18d636){return _0x18d636[_0x6772('0x37')](_0x26bf36)[_0x6772('0x21')](function(_0x735e0e){return _0x735e0e;});}return null;};}function removeEntity(_0x24bb9e,_0x1a7e4a){return function(_0x3cd40b){if(_0x3cd40b){return _0x3cd40b[_0x6772('0x38')]()[_0x6772('0x21')](function(){var _0x327466=_0x3cd40b[_0x6772('0x39')]({'plain':!![]});var _0x3ea1f5=[{'name':_0x6772('0x3a'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x6772('0x3b'),'value':_0x6772('0x3c'),'ignore':![]}];var _0x351f7a=_(_0x3ea1f5)[_0x6772('0x3d')](_0x6772('0x3e'))[_0x6772('0x3f')]('value')[_0x6772('0x40')]();if(_[_0x6772('0x41')](_0x351f7a,_0x327466[_0x6772('0x42')])){return;}var _0x5dc211=_['find'](_0x3ea1f5,[_0x6772('0x40'),_0x327466[_0x6772('0x42')]])['name'];return db[_0x6772('0x43')]['destroy']({'where':{'type':_0x5dc211,'resourceId':_0x327466['id']}})[_0x6772('0x21')](function(){return _0x3cd40b;});})['then'](function(){_0x24bb9e[_0x6772('0x2d')](0xcc)[_0x6772('0x2c')]();});}};}function handleEntityNotFound(_0x47f389,_0x1b66f0){return function(_0x54e166){if(!_0x54e166){_0x47f389['sendStatus'](0x194);}return _0x54e166;};}function handleError(_0x5dbc7f,_0x57d608){_0x57d608=_0x57d608||0x1f4;return function(_0x2c7bf9){logger['error'](_0x2c7bf9['stack']);if(_0x2c7bf9[_0x6772('0x44')]){delete _0x2c7bf9[_0x6772('0x44')];}_0x5dbc7f[_0x6772('0x2d')](_0x57d608)[_0x6772('0x45')](_0x2c7bf9);};}exports[_0x6772('0x46')]=function(_0x568679,_0x40203b){var _0x5de9ca={},_0x591891={},_0x39f910={'count':0x0,'rows':[]};var _0x389808=_[_0x6772('0x3f')](db[_0x6772('0x47')][_0x6772('0x48')],function(_0x36a62f){return{'name':_0x36a62f[_0x6772('0x49')],'type':_0x36a62f[_0x6772('0x4a')][_0x6772('0x4b')]};});_0x591891[_0x6772('0x4c')]=_[_0x6772('0x4d')](_[_0x6772('0x3f')](_0x389808,'name'),[_0x6772('0x4e'),_0x6772('0x4f')]);_0x591891[_0x6772('0x50')]=_['keys'](_0x568679[_0x6772('0x50')]);_0x591891[_0x6772('0x51')]=_['intersection'](_0x591891[_0x6772('0x4c')],_0x591891[_0x6772('0x50')]);_0x5de9ca['attributes']=_[_0x6772('0x52')](_0x591891[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x568679[_0x6772('0x50')][_0x6772('0x53')]));_0x5de9ca['attributes']=_0x5de9ca['attributes']['length']?_0x5de9ca[_0x6772('0x54')]:_0x591891[_0x6772('0x4c')];if(!_0x568679[_0x6772('0x50')][_0x6772('0x55')]('nolimit')){_0x5de9ca[_0x6772('0x31')]=qs[_0x6772('0x31')](_0x568679['query'][_0x6772('0x31')]);_0x5de9ca[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x568679[_0x6772('0x50')]['offset']);}_0x5de9ca[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x568679[_0x6772('0x50')][_0x6772('0x57')]);_0x5de9ca[_0x6772('0x58')]=qs['filters'](_['pick'](_0x568679[_0x6772('0x50')],_0x591891[_0x6772('0x51')]),_0x389808);if(_0x568679[_0x6772('0x50')][_0x6772('0x3d')]){_0x5de9ca[_0x6772('0x58')]=_[_0x6772('0x59')](_0x5de9ca[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x389808,function(_0x4ebb45){if(_0x4ebb45['type']!==_0x6772('0x5a')){return db['sequelize'][_0x6772('0x58')](db[_0x6772('0x5b')]['fn'](_0x6772('0x5c'),db['sequelize'][_0x6772('0x5d')](_0x4ebb45[_0x6772('0x44')])),{'$like':db['sequelize']['fn'](_0x6772('0x5c'),'%'+_0x568679[_0x6772('0x50')][_0x6772('0x3d')]+'%')});}})});}_0x5de9ca=_[_0x6772('0x59')]({},_0x5de9ca,_0x568679[_0x6772('0x5e')]);var _0x4c1e67={'where':_0x5de9ca['where']};return db[_0x6772('0x47')]['count'](_0x4c1e67)[_0x6772('0x21')](function(_0x20ef53){_0x39f910['count']=_0x20ef53;if(_0x568679[_0x6772('0x50')]['includeAll']){_0x5de9ca[_0x6772('0x5f')]=[{'all':!![]}];}return db['User']['findAll'](_0x5de9ca);})[_0x6772('0x21')](function(_0x487024){_0x39f910['rows']=_0x487024;return _0x39f910;})[_0x6772('0x21')](respondWithFilteredResult(_0x40203b,_0x5de9ca))[_0x6772('0x2a')](handleError(_0x40203b,null));};exports[_0x6772('0x60')]=function(_0x4ccfe0,_0xdb49d0){var _0x26601d={'raw':![],'where':{'id':_0x4ccfe0[_0x6772('0x61')]['id']}},_0x1af981={};_0x1af981['model']=_['differenceBy'](_[_0x6772('0x62')](db[_0x6772('0x47')][_0x6772('0x48')]),[_0x6772('0x4e'),_0x6772('0x4f')]);_0x1af981[_0x6772('0x50')]=_[_0x6772('0x62')](_0x4ccfe0[_0x6772('0x50')]);_0x1af981[_0x6772('0x51')]=_['intersection'](_0x1af981[_0x6772('0x4c')],_0x1af981[_0x6772('0x50')]);_0x26601d[_0x6772('0x54')]=_['intersection'](_0x1af981[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x4ccfe0[_0x6772('0x50')][_0x6772('0x53')]));_0x26601d[_0x6772('0x54')]=_0x26601d[_0x6772('0x54')]['length']?_0x26601d['attributes']:_0x1af981[_0x6772('0x4c')];if(_0x4ccfe0[_0x6772('0x50')][_0x6772('0x63')]){_0x26601d[_0x6772('0x5f')]=[{'all':!![]}];}_0x26601d=_[_0x6772('0x59')]({},_0x26601d,_0x4ccfe0[_0x6772('0x5e')]);return db['User']['find'](_0x26601d)[_0x6772('0x21')](handleEntityNotFound(_0xdb49d0,null))[_0x6772('0x21')](respondWithResult(_0xdb49d0,null))[_0x6772('0x2a')](handleError(_0xdb49d0,null));};exports['bulkCreate']=function(_0x324c7a,_0x31d99d){return db[_0x6772('0x47')]['bulkCreate'](_0x324c7a[_0x6772('0x64')],{'raw':![],'individualHooks':!![]})[_0x6772('0x21')](respondWithResult(_0x31d99d,0xc9))[_0x6772('0x2a')](handleError(_0x31d99d,null));};exports['update']=function(_0x258453,_0x5943a7){if(_0x258453[_0x6772('0x64')]['id']){delete _0x258453[_0x6772('0x64')]['id'];}delete _0x258453['body'][_0x6772('0x42')];return db[_0x6772('0x47')][_0x6772('0x65')]({'where':{'id':_0x258453['params']['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x5943a7,null))['then'](saveUpdates(_0x258453['body'],null))[_0x6772('0x21')](respondWithResult(_0x5943a7,null))[_0x6772('0x2a')](handleError(_0x5943a7,null));};exports[_0x6772('0x66')]=function(_0x306572,_0x7ca5e7){return db[_0x6772('0x47')][_0x6772('0x66')]()[_0x6772('0x21')](respondWithResult(_0x7ca5e7,null))[_0x6772('0x2a')](handleError(_0x7ca5e7,null));};exports[_0x6772('0x67')]=function(_0x172de2,_0x26f158,_0x5e7d51){return db[_0x6772('0x47')]['find']({'where':{'id':_0x172de2[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x26f158,null))['then'](function(_0x4b9d03){if(_0x4b9d03){return _0x4b9d03[_0x6772('0x67')](_0x172de2['body'][_0x6772('0x68')],_['omit'](_0x172de2['body'],[_0x6772('0x68'),'id'])||{});}})[_0x6772('0x21')](respondWithResult(_0x26f158,null))[_0x6772('0x2a')](handleError(_0x26f158,null));};var getLicense=function(_0x51e4a5){return new BPromise(function(_0x382115,_0x2560e6){var _0xd9bbfa=0x0;_0x51e4a5[_0x6772('0x64')][_0x6772('0x42')]===_0x6772('0x69')&&_0x382115(_0x6772('0x6a'));return db[_0x6772('0x47')][_0x6772('0x2f')]({'where':{'$or':[{'role':_0x51e4a5[_0x6772('0x64')][_0x6772('0x42')]===_0x6772('0x3c')?_0x6772('0x3c'):[_0x6772('0x6b'),_0x6772('0x6c')]}]}})[_0x6772('0x21')](function(_0x4cc751){_0xd9bbfa=_0x4cc751;return require(_0x6772('0x6d'))[_0x6772('0x6e')]();})[_0x6772('0x21')](function(_0x382128){var _0x1056ed=_0x51e4a5[_0x6772('0x64')][_0x6772('0x42')]===_0x6772('0x3c')?_0x6772('0x6f'):_0x6772('0x70');if(!_['isNil'](_0x382128[_0x1056ed])&&_0xd9bbfa>=_0x382128[_0x1056ed]){return _0x2560e6({'message':_0x6772('0x71')});}return _0x382115(util[_0x6772('0x72')]('count\x20%s:\x20%s',_0x1056ed,_0xd9bbfa));})[_0x6772('0x2a')](function(_0x314fc4){return _0x2560e6(_0x314fc4);});});};exports[_0x6772('0x73')]=function(_0x43d8be,_0x7f269f){return getLicense(_0x43d8be)[_0x6772('0x21')](function(_0x5a8446){if(!_0x43d8be[_0x6772('0x64')][_0x6772('0x74')]){var _0x4aed81;return db['Setting'][_0x6772('0x75')](0x1)[_0x6772('0x21')](function(_0x2cf26e){return checkPasswordPattern(_0x2cf26e,_0x43d8be[_0x6772('0x64')][_0x6772('0x4e')],_0x2cf26e[_0x6772('0x76')]);})['then'](function(_0x4c890d){_0x4aed81=_0x4c890d['min_internal'];return db[_0x6772('0x47')][_0x6772('0x77')]('internal');})[_0x6772('0x21')](function(_0x39123e){if(_[_0x6772('0x78')](_0x39123e)){if(_0x4aed81){_0x43d8be[_0x6772('0x64')][_0x6772('0x74')]=_0x4aed81;}else{_0x43d8be[_0x6772('0x64')]['internal']=0x1;}}else{if(_[_0x6772('0x78')](_0x4aed81)||_0x4aed81==_0x39123e){_0x43d8be[_0x6772('0x64')]['internal']=_0x39123e+0x1;}else if(_0x4aed81>_0x39123e){_0x43d8be[_0x6772('0x64')][_0x6772('0x74')]=_0x4aed81;}else{return db[_0x6772('0x5b')][_0x6772('0x50')](_0x6772('0x79'),{'type':db[_0x6772('0x5b')][_0x6772('0x7a')]['SELECT']})['then'](function(_0xb7816a){if(_0xb7816a&&_0xb7816a[_0x6772('0x7b')]){for(var _0x38edc0=0x0,_0x23b931=_0xb7816a[_0x6772('0x7b')];_0x38edc0<_0x23b931&&_[_0x6772('0x78')](_0x43d8be[_0x6772('0x64')]['internal']);_0x38edc0++){if(_0x4aed81<=_0xb7816a[_0x38edc0]['from']){_0x43d8be[_0x6772('0x64')][_0x6772('0x74')]=_0xb7816a[_0x38edc0]['from'];}else if(_0x4aed81>_0xb7816a[_0x38edc0][_0x6772('0x7c')]&&_0x4aed81<=_0xb7816a[_0x38edc0]['to']){_0x43d8be[_0x6772('0x64')][_0x6772('0x74')]=_0x4aed81;}}}if(_[_0x6772('0x78')](_0x43d8be[_0x6772('0x64')][_0x6772('0x74')])){_0x43d8be[_0x6772('0x64')][_0x6772('0x74')]=_0x39123e+0x1;}});}}});}})[_0x6772('0x21')](function(){if(_0x43d8be['body'][_0x6772('0x7d')]){_0x43d8be[_0x6772('0x64')][_0x6772('0x7e')]=_0x43d8be['body'][_0x6772('0x74')];_0x43d8be[_0x6772('0x64')][_0x6772('0x7f')]={'mailbox':_0x43d8be['body'][_0x6772('0x74')],'password':_0x43d8be[_0x6772('0x64')][_0x6772('0x4e')],'fullname':_0x43d8be['body'][_0x6772('0x80')],'email':_0x43d8be[_0x6772('0x64')][_0x6772('0x81')]};}if(_0x43d8be['body']&&_0x43d8be[_0x6772('0x64')][_0x6772('0x42')]==='agent'){if(!_0x43d8be[_0x6772('0x64')][_0x6772('0x82')]){_0x43d8be[_0x6772('0x64')][_0x6772('0x82')]=['101','102','103',_0x6772('0x83'),_0x6772('0x84'),'104','105','106',_0x6772('0x85'),_0x6772('0x86'),'109','100',_0x6772('0x87'),_0x6772('0x88')];}}return db[_0x6772('0x47')][_0x6772('0x73')](_0x43d8be[_0x6772('0x64')],{'include':[{'model':db[_0x6772('0x7f')],'as':_0x6772('0x7f')}]});})['then'](function(_0x337244){if(_0x43d8be[_0x6772('0x64')][_0x6772('0x42')]===_0x6772('0x6c'))return _0x337244;var _0x13af93=_0x43d8be['user']['get']({'plain':!![]});if(!_0x13af93)throw new Error(_0x6772('0x89'));if(_0x13af93[_0x6772('0x42')]===_0x6772('0x6c')){var _0x5a370d=_0x337244[_0x6772('0x39')]({'plain':!![]});var _0x198fd6=[{'name':_0x6772('0x8a'),'value':_0x6772('0x69')},{'name':_0x6772('0x3b'),'value':_0x6772('0x3c')}];var _0x5232d0=_[_0x6772('0x65')](_0x198fd6,['value',_0x5a370d[_0x6772('0x42')]])[_0x6772('0x44')];return db['UserProfileSection'][_0x6772('0x65')]({'where':{'name':_0x5232d0,'userProfileId':_0x13af93['userProfileId']},'raw':!![]})['then'](function(_0x541330){if(_0x541330&&_0x541330[_0x6772('0x8b')]===0x0){return db[_0x6772('0x43')][_0x6772('0x73')]({'name':_0x5a370d[_0x6772('0x44')],'resourceId':_0x5a370d['id'],'type':_0x541330[_0x6772('0x44')],'sectionId':_0x541330['id']},{})['then'](function(){return _0x337244;});}else{return _0x337244;}})['catch'](function(_0x298139){logger['error'](_0x6772('0x8c'),_0x298139);throw _0x298139;});}return _0x337244;})[_0x6772('0x21')](respondWithResult(_0x7f269f,0xc9))[_0x6772('0x2a')](handleError(_0x7f269f,null));};exports[_0x6772('0x8d')]=function(_0x57bf0a,_0x32d843,_0x50c2aa){var _0x20c64f=![];if(_0x57bf0a[_0x6772('0x64')]['id']){delete _0x57bf0a[_0x6772('0x64')]['id'];}return db[_0x6772('0x8e')][_0x6772('0x8f')]({'attributes':['id','securePassword']})[_0x6772('0x21')](function(_0x290e91){_0x20c64f=_0x290e91[_0x6772('0x76')];return db['User'][_0x6772('0x65')]({'where':{'id':_0x57bf0a[_0x6772('0x61')]['id']}});})[_0x6772('0x21')](function(_0x222fd1){if(_0x222fd1){if(_0x222fd1['id']==_0x57bf0a[_0x6772('0x6c')]['id']){if(!_0x57bf0a[_0x6772('0x64')][_0x6772('0x90')]||!_0x57bf0a[_0x6772('0x64')][_0x6772('0x91')]){throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x222fd1[_0x6772('0x92')](_0x57bf0a[_0x6772('0x64')]['oldPassword'])){throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))](_0x6772('0x93'));}if(_0x57bf0a[_0x6772('0x64')][_0x6772('0x90')]==_0x57bf0a[_0x6772('0x64')]['newPassword']){throw new db['Sequelize'][(_0x6772('0x1f'))](_0x6772('0x94'));}return _0x222fd1;}else if(_0x57bf0a[_0x6772('0x6c')]['role']=='admin'){if(!_0x57bf0a[_0x6772('0x64')][_0x6772('0x91')]){throw new db['Sequelize'][(_0x6772('0x1f'))](_0x6772('0x95'));}return _0x222fd1;}else if(_0x57bf0a[_0x6772('0x6c')][_0x6772('0x42')]==_0x6772('0x6c')){if(!_0x57bf0a['body'][_0x6772('0x91')]){throw new db['Sequelize'][(_0x6772('0x1f'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x222fd1[_0x6772('0x42')]!=_0x6772('0x69')){throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))]('Unauthorized');}return _0x222fd1;}else{throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))]('Unauthorized');}}return null;})[_0x6772('0x21')](handleEntityNotFound(_0x32d843,null))[_0x6772('0x21')](function(_0x2d41b5){return checkPasswordPattern(_0x2d41b5,_0x57bf0a[_0x6772('0x64')][_0x6772('0x91')],_0x20c64f);})[_0x6772('0x21')](saveUpdates({'password':_0x57bf0a['body']['newPassword'],'passwordResetAt':_0x57bf0a[_0x6772('0x6c')]['id']==_0x57bf0a['params']['id']?moment():null},null))[_0x6772('0x21')](respondWithResult(_0x32d843,null))[_0x6772('0x2a')](handleError(_0x32d843,null));};exports['addQueues']=function(_0x57e380,_0x2e83a6,_0x11f800){var _0x4de52b=_0x57e380[_0x6772('0x64')][_0x6772('0x96')];return db[_0x6772('0x47')][_0x6772('0x65')]({'where':{'id':_0x57e380[_0x6772('0x61')]['id']},'attributes':['id',_0x6772('0x44'),_0x6772('0x42'),_0x6772('0x97'),_0x6772('0x98'),_0x6772('0x99'),_0x6772('0x9a')]})[_0x6772('0x21')](handleEntityNotFound(_0x2e83a6,null))[_0x6772('0x21')](function(_0x581e95){if(_0x581e95){if(!utils[_0x6772('0x9b')](_0x4de52b)){throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))](_0x6772('0x9c'));}return _0x581e95[_0x6772('0x9d')+_[_0x6772('0x9e')](_0x4de52b['toLowerCase']())+_0x6772('0x9f')](_0x57e380[_0x6772('0x64')][_0x6772('0x68')],{'penalty':_0x57e380[_0x6772('0x64')][_0x6772('0xa0')]||0x0})[_0x6772('0xa1')](function(_0x5cf8c3){for(var _0xa8bed4=0x0;_0xa8bed4<_0x57e380[_0x6772('0x64')][_0x6772('0x68')][_0x6772('0x7b')];_0xa8bed4+=0x1){var _0x339f17={'UserId':_0x57e380[_0x6772('0x61')]['id']};_0x339f17[_[_0x6772('0x9e')](_0x4de52b[_0x6772('0xa2')]())+_0x6772('0xa3')]=_0x57e380[_0x6772('0x64')][_0x6772('0x68')][_0xa8bed4];socket[_0x6772('0xa4')](_0x6772('0x6c')+_[_0x6772('0x9e')](_0x4de52b[_0x6772('0xa2')]())+_0x6772('0xa5'),_0x339f17);}return _0x5cf8c3;})['then'](function(){if(_0x4de52b===_0x6772('0xa6')){return db[_0x6772('0xa7')][_0x6772('0xa8')]({'where':{'id':_0x57e380[_0x6772('0x64')][_0x6772('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x41760b){var _0x4e2f05=_0x581e95[_0x6772('0x39')]({'plain':!![]});var _0x5d405c=[];if(_0x4de52b==='voice'&&_0x4e2f05[_0x6772('0x42')]===_0x6772('0x69')&&_0x4e2f05['online']){for(var _0x1a9dc7=0x0;_0x1a9dc7<_0x41760b[_0x6772('0x7b')];_0x1a9dc7+=0x1){_0x5d405c['push']({'membername':_0x4e2f05[_0x6772('0x44')],'UserId':_0x4e2f05['id'],'queue_name':_0x41760b[_0x1a9dc7][_0x6772('0x44')],'VoiceQueueId':_0x41760b[_0x1a9dc7]['id'],'interface':_[_0x6772('0x78')](_0x4e2f05['interface'])?util[_0x6772('0x72')](_0x6772('0xa9'),_0x4e2f05[_0x6772('0x44')]):_0x4e2f05[_0x6772('0x9a')],'paused':_0x4e2f05[_0x6772('0x99')]||![],'penalty':_0x57e380[_0x6772('0x64')][_0x6772('0xa0')]||0x0});}return BPromise['each'](_0x5d405c,function(_0xe8d626){return db[_0x6772('0xaa')][_0x6772('0xab')](_0xe8d626);});}return _0x581e95;});}})[_0x6772('0x21')](respondWithStatusCode(_0x2e83a6,null))[_0x6772('0x2a')](handleError(_0x2e83a6,null));};exports[_0x6772('0xac')]=function(_0x4b5032,_0x4d732d,_0x4bef03){var _0x1cc507;return db[_0x6772('0x47')]['find']({'where':{'id':_0x4b5032[_0x6772('0x61')]['id']},'attributes':['id','name','role']})[_0x6772('0x21')](handleEntityNotFound(_0x4d732d,null))['then'](function(_0x4957e3){if(_0x4957e3){_0x1cc507=_0x4957e3;if(!_0x4b5032[_0x6772('0x50')][_0x6772('0x96')]||!utils[_0x6772('0x9b')](_0x4b5032['query'][_0x6772('0x96')])){throw new db['Sequelize'][(_0x6772('0x1f'))](_0x6772('0x9c'));}return _0x4957e3[_0x6772('0xad')+_[_0x6772('0x9e')](_0x4b5032[_0x6772('0x50')][_0x6772('0x96')][_0x6772('0xa2')]())+_0x6772('0x9f')](_0x4b5032[_0x6772('0x50')][_0x6772('0x68')]);}})[_0x6772('0x21')](function(_0x37fa6c){for(var _0xc650cf=0x0;_0xc650cf<_0x4b5032['query'][_0x6772('0x68')][_0x6772('0x7b')];_0xc650cf+=0x1){var _0x5005f2={'UserId':_0x4b5032[_0x6772('0x61')]['id']};_0x5005f2[_[_0x6772('0x9e')](_0x4b5032[_0x6772('0x50')][_0x6772('0x96')]['toLowerCase']())+_0x6772('0xa3')]=_0x4b5032[_0x6772('0x50')]['ids'][_0xc650cf];socket['emit']('user'+_[_0x6772('0x9e')](_0x4b5032[_0x6772('0x50')][_0x6772('0x96')][_0x6772('0xa2')]())+_0x6772('0xae'),_0x5005f2);}return _0x37fa6c;})[_0x6772('0x21')](function(){if(_0x4b5032[_0x6772('0x50')]['channel']==='voice'){return db[_0x6772('0xaa')][_0x6772('0x38')]({'where':{'UserId':_0x4b5032[_0x6772('0x61')]['id'],'VoiceQueueId':_0x4b5032[_0x6772('0x50')][_0x6772('0x68')]},'individualHooks':!![]})['then'](function(){return _0x1cc507;});}return _0x1cc507;})['then'](respondWithStatusCode(_0x4d732d,null))['catch'](handleError(_0x4d732d,null));};exports[_0x6772('0xaf')]=function(_0x2c7f10,_0x24a403,_0x30c6b4){_0x2c7f10[_0x6772('0x64')][_0x6772('0xb0')]=_0x2c7f10['file'][_0x6772('0xb1')];return db['User'][_0x6772('0x65')]({'where':{'id':_0x2c7f10[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x24a403,null))[_0x6772('0x21')](saveUpdates(_0x2c7f10[_0x6772('0x64')],null))[_0x6772('0x21')](respondWithResult(_0x24a403,null))['catch'](handleError(_0x24a403,null));};exports[_0x6772('0xb2')]=function(_0x5430b9,_0xcfecb4,_0x4c9110){var _0x33ed5e=path[_0x6772('0xb3')](config['root'],_0x6772('0xb4'));return db['User']['find']({'where':{'id':_0x5430b9[_0x6772('0x61')]['id']},'attributes':['id',_0x6772('0xb0')],'raw':!![]})[_0x6772('0x21')](handleEntityNotFound(_0xcfecb4,null))[_0x6772('0x21')](function(_0x322293){if(_0x322293){if(_[_0x6772('0x78')](_0x322293[_0x6772('0xb0')])){return _0xcfecb4[_0x6772('0xb5')](_0x33ed5e);}else{if(!fs[_0x6772('0xb6')](path[_0x6772('0xb3')](config[_0x6772('0xb7')],_0x6772('0xb8'),_0x322293['userpic']))){return _0xcfecb4[_0x6772('0xb5')](_0x33ed5e);}return _0xcfecb4[_0x6772('0xb5')](path[_0x6772('0xb3')](config[_0x6772('0xb7')],_0x6772('0xb8'),_0x322293[_0x6772('0xb0')]));}}})['catch'](handleError(_0xcfecb4,null));};exports[_0x6772('0xb9')]=function(_0x4e5491,_0x3d13cc,_0x310f35){var _0x2dbc85={};var _0x1690c9={};var _0x24e0b1;var _0x5da20f;return db['User']['findOne']({'where':{'id':_0x4e5491[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x3d13cc,null))[_0x6772('0x21')](function(_0x30a304){if(_0x30a304){_0x24e0b1=_0x30a304;_0x1690c9[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0xba')][_0x6772('0x48')]);_0x1690c9[_0x6772('0x50')]=_[_0x6772('0x62')](_0x4e5491[_0x6772('0x50')]);_0x1690c9[_0x6772('0x51')]=_[_0x6772('0x52')](_0x1690c9[_0x6772('0x4c')],_0x1690c9[_0x6772('0x50')]);_0x2dbc85['attributes']=_[_0x6772('0x52')](_0x1690c9['model'],qs['fields'](_0x4e5491[_0x6772('0x50')]['fields']));_0x2dbc85[_0x6772('0x54')]=_0x2dbc85[_0x6772('0x54')][_0x6772('0x7b')]?_0x2dbc85[_0x6772('0x54')]:_0x1690c9[_0x6772('0x4c')];_0x2dbc85[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x4e5491[_0x6772('0x50')]['sort']);_0x2dbc85[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x4e5491['query'],_0x1690c9['filters']));if(_0x4e5491[_0x6772('0x50')][_0x6772('0x3d')]){_0x2dbc85[_0x6772('0x58')]=_[_0x6772('0x59')](_0x2dbc85[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x2dbc85[_0x6772('0x54')],function(_0x3341eb){var _0x3d69db={};_0x3d69db[_0x3341eb]={'$like':'%'+_0x4e5491[_0x6772('0x50')]['filter']+'%'};return _0x3d69db;})});}_0x2dbc85=_[_0x6772('0x59')]({},_0x2dbc85,_0x4e5491[_0x6772('0x5e')]);return _0x24e0b1[_0x6772('0xb9')](_0x2dbc85);}})[_0x6772('0x21')](function(_0x588bc4){if(_0x588bc4){_0x5da20f=_0x588bc4[_0x6772('0x7b')];if(_0x4e5491['query']['hasOwnProperty']('includeAll')){_0x2dbc85[_0x6772('0x5f')]=[{'model':db[_0x6772('0xbc')],'as':_0x6772('0xbd'),'required':![]},{'model':db[_0x6772('0xbe')],'as':'Tags','attributes':['id',_0x6772('0x44'),'color'],'where':_0x4e5491['query'][_0x6772('0xbf')]?{'id':_0x4e5491[_0x6772('0x50')][_0x6772('0xbf')]}:undefined,'required':_0x4e5491['query']['tag']?!![]:![]}];}if(!_0x4e5491['query']['hasOwnProperty'](_0x6772('0xc0'))){_0x2dbc85[_0x6772('0x31')]=qs[_0x6772('0x31')](_0x4e5491[_0x6772('0x50')][_0x6772('0x31')]);_0x2dbc85['offset']=qs[_0x6772('0x30')](_0x4e5491[_0x6772('0x50')][_0x6772('0x30')]);}return _0x24e0b1[_0x6772('0xb9')](_0x2dbc85);}})[_0x6772('0x21')](function(_0x2d88ca){if(_0x2d88ca){return _0x2d88ca?{'count':_0x5da20f,'rows':_0x2d88ca}:null;}})[_0x6772('0x21')](respondWithResult(_0x3d13cc,null))[_0x6772('0x2a')](handleError(_0x3d13cc,null));};exports['getQueues']=function(_0x499c27,_0x266c8b,_0x2c2ebb){var _0x3a4c6d;var _0x16a03a;var _0x3be068={};var _0x2fce86;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x499c27[_0x6772('0x61')]['id']},'attributes':['id','name','role']})[_0x6772('0x21')](handleEntityNotFound(_0x266c8b,null))[_0x6772('0x21')](function(_0x530fa5){if(!utils[_0x6772('0x9b')](_0x499c27[_0x6772('0x50')][_0x6772('0x96')])){throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))](_0x6772('0x9c'));}_0x3a4c6d=_0x530fa5;var _0x260f6a={};_0x260f6a[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_[_0x6772('0x9e')](_0x499c27['query'][_0x6772('0x96')])+'Queue'][_0x6772('0x48')]);_0x260f6a[_0x6772('0x50')]=_[_0x6772('0x62')](_0x499c27[_0x6772('0x50')]);_0x260f6a[_0x6772('0x51')]=_['intersection'](_0x260f6a[_0x6772('0x4c')],_0x260f6a[_0x6772('0x50')]);_0x3be068[_0x6772('0x54')]=_[_0x6772('0x52')](_0x260f6a[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x499c27[_0x6772('0x50')]['fields']));_0x3be068[_0x6772('0x54')]=_0x3be068[_0x6772('0x54')][_0x6772('0x7b')]?_0x3be068[_0x6772('0x54')]:_0x260f6a[_0x6772('0x4c')];_0x3be068[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x499c27['query'][_0x6772('0x57')]);_0x3be068[_0x6772('0x58')]=qs[_0x6772('0x51')](_['pick'](_0x499c27[_0x6772('0x50')],_0x260f6a['filters']));if(_0x499c27[_0x6772('0x50')][_0x6772('0x3d')]){_0x3be068['where']=_[_0x6772('0x59')](_0x3be068['where'],{'$or':_[_0x6772('0x3f')](_0x3be068[_0x6772('0x54')],function(_0x5a20f8){var _0x22a663={};_0x22a663[_0x5a20f8]={'$like':'%'+_0x499c27[_0x6772('0x50')][_0x6772('0x3d')]+'%'};return _0x22a663;})});}_0x3be068=_[_0x6772('0x59')]({},_0x3be068,_0x499c27[_0x6772('0x5e')]);switch(_0x3a4c6d[_0x6772('0x42')]){case _0x6772('0x6b'):return db[_[_0x6772('0x9e')](_0x499c27['query'][_0x6772('0x96')])+'Queue'][_0x6772('0xa8')](_0x3be068);case'user':case _0x6772('0x69'):return _0x3a4c6d['get'+_[_0x6772('0x9e')](_0x499c27['query'][_0x6772('0x96')])+_0x6772('0x9f')](_0x3be068);default:throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))](_0x6772('0xc1'));}})[_0x6772('0x21')](function(_0x15163b){_0x2fce86=_0x15163b['length'];if(!_0x499c27[_0x6772('0x50')][_0x6772('0x55')](_0x6772('0xc0'))){_0x3be068['limit']=qs[_0x6772('0x31')](_0x499c27[_0x6772('0x50')][_0x6772('0x31')]);_0x3be068['offset']=qs['offset'](_0x499c27[_0x6772('0x50')]['offset']);}switch(_0x3a4c6d[_0x6772('0x42')]){case'admin':return db[_['capitalize'](_0x499c27[_0x6772('0x50')]['channel'])+_0x6772('0xc2')]['findAll'](_0x3be068);case _0x6772('0x6c'):case _0x6772('0x69'):return _0x3a4c6d[_0x6772('0x39')+_[_0x6772('0x9e')](_0x499c27['query'][_0x6772('0x96')])+_0x6772('0x9f')](_0x3be068);}})[_0x6772('0x21')](function(_0x378c58){return{'count':_0x2fce86,'rows':_0x378c58};})[_0x6772('0x21')](respondWithResult(_0x266c8b,null))[_0x6772('0x2a')](handleError(_0x266c8b,null));};exports[_0x6772('0xc3')]=function(_0x471ed5,_0x218af2,_0x49d62c){var _0x2fd2d1={};var _0x1da284={};var _0x4e99d6;var _0x3f09af;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x471ed5[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x218af2,null))['then'](function(_0x1900e4){if(_0x1900e4){_0x4e99d6=_0x1900e4;_0x1da284[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0xaa')][_0x6772('0x48')]);_0x1da284[_0x6772('0x50')]=_[_0x6772('0x62')](_0x471ed5['query']);_0x1da284[_0x6772('0x51')]=_[_0x6772('0x52')](_0x1da284[_0x6772('0x4c')],_0x1da284[_0x6772('0x50')]);_0x2fd2d1[_0x6772('0x54')]=_[_0x6772('0x52')](_0x1da284['model'],qs[_0x6772('0x53')](_0x471ed5['query'][_0x6772('0x53')]));_0x2fd2d1[_0x6772('0x54')]=_0x2fd2d1['attributes'][_0x6772('0x7b')]?_0x2fd2d1['attributes']:_0x1da284['model'];_0x2fd2d1[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x471ed5['query'][_0x6772('0x57')]);_0x2fd2d1[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x471ed5['query'],_0x1da284['filters']));if(_0x471ed5['query'][_0x6772('0x3d')]){_0x2fd2d1['where']=_[_0x6772('0x59')](_0x2fd2d1['where'],{'$or':_[_0x6772('0x3f')](_0x2fd2d1[_0x6772('0x54')],function(_0x158160){var _0x2d4964={};_0x2d4964[_0x158160]={'$like':'%'+_0x471ed5['query'][_0x6772('0x3d')]+'%'};return _0x2d4964;})});}_0x2fd2d1=_['merge']({},_0x2fd2d1,_0x471ed5[_0x6772('0x5e')]);return _0x4e99d6[_0x6772('0xc3')](_0x2fd2d1);}})[_0x6772('0x21')](function(_0x30364f){if(_0x30364f){_0x3f09af=_0x30364f[_0x6772('0x7b')];if(!_0x471ed5['query']['hasOwnProperty'](_0x6772('0xc0'))){_0x2fd2d1[_0x6772('0x31')]=qs['limit'](_0x471ed5['query'][_0x6772('0x31')]);_0x2fd2d1['offset']=qs[_0x6772('0x30')](_0x471ed5[_0x6772('0x50')][_0x6772('0x30')]);}return _0x4e99d6[_0x6772('0xc3')](_0x2fd2d1);}})[_0x6772('0x21')](function(_0x2fa698){if(_0x2fa698){return _0x2fa698?{'count':_0x3f09af,'rows':_0x2fa698}:null;}})[_0x6772('0x21')](respondWithResult(_0x218af2,null))['catch'](handleError(_0x218af2,null));};exports[_0x6772('0xc4')]=function(_0x2efd37,_0x363685,_0x241574){var _0x20ec87={};var _0x32e6d7={};var _0x53c308;var _0x398a0b;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x2efd37[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x363685,null))[_0x6772('0x21')](function(_0x1ecd49){if(_0x1ecd49){_0x53c308=_0x1ecd49;_0x32e6d7[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0xc5')][_0x6772('0x48')]);_0x32e6d7[_0x6772('0x50')]=_[_0x6772('0x62')](_0x2efd37[_0x6772('0x50')]);_0x32e6d7['filters']=_[_0x6772('0x52')](_0x32e6d7[_0x6772('0x4c')],_0x32e6d7['query']);_0x20ec87[_0x6772('0x54')]=_[_0x6772('0x52')](_0x32e6d7[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x2efd37[_0x6772('0x50')][_0x6772('0x53')]));_0x20ec87[_0x6772('0x54')]=_0x20ec87[_0x6772('0x54')][_0x6772('0x7b')]?_0x20ec87[_0x6772('0x54')]:_0x32e6d7[_0x6772('0x4c')];_0x20ec87[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x2efd37[_0x6772('0x50')][_0x6772('0x57')]);_0x20ec87[_0x6772('0x58')]=qs['filters'](_[_0x6772('0xbb')](_0x2efd37[_0x6772('0x50')],_0x32e6d7['filters']));if(_0x2efd37[_0x6772('0x50')][_0x6772('0x3d')]){_0x20ec87['where']=_[_0x6772('0x59')](_0x20ec87['where'],{'$or':_[_0x6772('0x3f')](_0x20ec87[_0x6772('0x54')],function(_0x47c239){var _0x2e59e7={};_0x2e59e7[_0x47c239]={'$like':'%'+_0x2efd37[_0x6772('0x50')]['filter']+'%'};return _0x2e59e7;})});}_0x20ec87=_['merge']({},_0x20ec87,_0x2efd37[_0x6772('0x5e')]);return _0x53c308[_0x6772('0xc4')](_0x20ec87);}})[_0x6772('0x21')](function(_0x4cfbc2){if(_0x4cfbc2){_0x398a0b=_0x4cfbc2['length'];if(!_0x2efd37[_0x6772('0x50')]['hasOwnProperty']('nolimit')){_0x20ec87['limit']=qs[_0x6772('0x31')](_0x2efd37[_0x6772('0x50')][_0x6772('0x31')]);_0x20ec87[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x2efd37['query']['offset']);}return _0x53c308[_0x6772('0xc4')](_0x20ec87);}})[_0x6772('0x21')](function(_0x28b7d5){if(_0x28b7d5){return _0x28b7d5?{'count':_0x398a0b,'rows':_0x28b7d5}:null;}})[_0x6772('0x21')](respondWithResult(_0x363685,null))[_0x6772('0x2a')](handleError(_0x363685,null));};exports[_0x6772('0xc6')]=function(_0x4e3530,_0x58edec,_0x9d54bf){var _0x58f3c2={'raw':!![],'where':{}};var _0x2dbbe4={};var _0x4f07f1={'count':0x0,'rows':[]};return db['User'][_0x6772('0x8f')]({'where':{'id':_0x4e3530[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x58edec,null))[_0x6772('0x21')](function(_0x1a2bee){if(_0x1a2bee){_0x2dbbe4[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0xc7')][_0x6772('0x48')]);_0x2dbbe4[_0x6772('0x50')]=_[_0x6772('0x62')](_0x4e3530[_0x6772('0x50')]);_0x2dbbe4[_0x6772('0x51')]=_['intersection'](_0x2dbbe4[_0x6772('0x4c')],_0x2dbbe4[_0x6772('0x50')]);_0x58f3c2['attributes']=_[_0x6772('0x52')](_0x2dbbe4[_0x6772('0x4c')],qs['fields'](_0x4e3530[_0x6772('0x50')][_0x6772('0x53')]));_0x58f3c2[_0x6772('0x54')]=_0x58f3c2['attributes'][_0x6772('0x7b')]?_0x58f3c2['attributes']:_0x2dbbe4[_0x6772('0x4c')];if(!_0x4e3530['query'][_0x6772('0x55')](_0x6772('0xc0'))){_0x58f3c2[_0x6772('0x31')]=qs['limit'](_0x4e3530[_0x6772('0x50')]['limit']);_0x58f3c2['offset']=qs['offset'](_0x4e3530[_0x6772('0x50')][_0x6772('0x30')]);}_0x58f3c2[_0x6772('0x56')]=qs['sort'](_0x4e3530[_0x6772('0x50')][_0x6772('0x57')]);_0x58f3c2[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x4e3530[_0x6772('0x50')],_0x2dbbe4[_0x6772('0x51')]));_0x58f3c2[_0x6772('0x58')][_0x6772('0xc8')]=_0x1a2bee['id'];if(_0x4e3530[_0x6772('0x50')]['filter']){_0x58f3c2[_0x6772('0x58')]=_['merge'](_0x58f3c2[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x58f3c2[_0x6772('0x54')],function(_0x273e07){var _0x11af07={};_0x11af07[_0x273e07]={'$like':'%'+_0x4e3530[_0x6772('0x50')][_0x6772('0x3d')]+'%'};return _0x11af07;})});}_0x58f3c2=_[_0x6772('0x59')]({},_0x58f3c2,_0x4e3530[_0x6772('0x5e')]);return db['VoiceRecording'][_0x6772('0x2f')]({'where':_0x58f3c2['where']})[_0x6772('0x21')](function(_0x58c8b9){_0x4f07f1[_0x6772('0x2f')]=_0x58c8b9;if(_0x4e3530[_0x6772('0x50')][_0x6772('0x63')]){_0x58f3c2[_0x6772('0x5f')]=[{'all':!![]}];}return db[_0x6772('0xc7')]['findAll'](_0x58f3c2);})['then'](function(_0x1bca2a){_0x4f07f1[_0x6772('0xc9')]=_0x1bca2a;return _0x4f07f1;});}})['then'](respondWithFilteredResult(_0x58edec,_0x58f3c2))[_0x6772('0x2a')](handleError(_0x58edec,null));};exports[_0x6772('0xca')]=function(_0x573b24,_0x23953f,_0x460fd7){var _0x58a255={'raw':!![],'where':{}};var _0x5a9e0e={};var _0x2fd81a={'count':0x0,'rows':[]};return db['User'][_0x6772('0x8f')]({'where':{'id':_0x573b24['params']['id']}})['then'](handleEntityNotFound(_0x23953f,null))[_0x6772('0x21')](function(_0x45618b){if(_0x45618b){_0x5a9e0e[_0x6772('0x4c')]=_['keys'](db[_0x6772('0xcb')]['rawAttributes']);_0x5a9e0e['query']=_['keys'](_0x573b24[_0x6772('0x50')]);_0x5a9e0e['filters']=_['intersection'](_0x5a9e0e[_0x6772('0x4c')],_0x5a9e0e['query']);_0x58a255[_0x6772('0x54')]=_[_0x6772('0x52')](_0x5a9e0e[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x573b24[_0x6772('0x50')]['fields']));_0x58a255[_0x6772('0x54')]=_0x58a255[_0x6772('0x54')][_0x6772('0x7b')]?_0x58a255[_0x6772('0x54')]:_0x5a9e0e[_0x6772('0x4c')];if(!_0x573b24[_0x6772('0x50')][_0x6772('0x55')](_0x6772('0xc0'))){_0x58a255[_0x6772('0x31')]=qs[_0x6772('0x31')](_0x573b24['query'][_0x6772('0x31')]);_0x58a255[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x573b24[_0x6772('0x50')]['offset']);}_0x58a255[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x573b24[_0x6772('0x50')][_0x6772('0x57')]);_0x58a255[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x573b24[_0x6772('0x50')],_0x5a9e0e['filters']));_0x58a255[_0x6772('0x58')][_0x6772('0xc8')]=_0x45618b['id'];if(_0x573b24[_0x6772('0x50')][_0x6772('0x3d')]){_0x58a255[_0x6772('0x58')]=_[_0x6772('0x59')](_0x58a255[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x58a255[_0x6772('0x54')],function(_0x489efb){var _0x5986ea={};_0x5986ea[_0x489efb]={'$like':'%'+_0x573b24[_0x6772('0x50')][_0x6772('0x3d')]+'%'};return _0x5986ea;})});}_0x58a255=_[_0x6772('0x59')]({},_0x58a255,_0x573b24['options']);return db['ScreenRecording'][_0x6772('0x2f')]({'where':_0x58a255[_0x6772('0x58')]})['then'](function(_0x33f71b){_0x2fd81a[_0x6772('0x2f')]=_0x33f71b;if(_0x573b24[_0x6772('0x50')][_0x6772('0x63')]){_0x58a255['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x6772('0xa8')](_0x58a255);})[_0x6772('0x21')](function(_0x2c88e9){_0x2fd81a['rows']=_0x2c88e9;return _0x2fd81a;});}})['then'](respondWithFilteredResult(_0x23953f,_0x58a255))['catch'](handleError(_0x23953f,null));};exports[_0x6772('0xcc')]=function(_0x8a3e4d,_0x172f83,_0x486c0e){var _0x2e94c9={};var _0x1879dd={};var _0x2955ac;var _0x41b24d;return db['User'][_0x6772('0x8f')]({'where':{'id':_0x8a3e4d[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x172f83,null))[_0x6772('0x21')](function(_0x5586cc){if(_0x5586cc){_0x2955ac=_0x5586cc;_0x1879dd[_0x6772('0x4c')]=_[_0x6772('0x62')](db['ChatInteraction'][_0x6772('0x48')]);_0x1879dd[_0x6772('0x50')]=_[_0x6772('0x62')](_0x8a3e4d[_0x6772('0x50')]);_0x1879dd[_0x6772('0x51')]=_[_0x6772('0x52')](_0x1879dd[_0x6772('0x4c')],_0x1879dd[_0x6772('0x50')]);_0x2e94c9['attributes']=_[_0x6772('0x52')](_0x1879dd[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x8a3e4d[_0x6772('0x50')]['fields']));_0x2e94c9[_0x6772('0x54')]=_0x2e94c9[_0x6772('0x54')]['length']?_0x2e94c9[_0x6772('0x54')]:_0x1879dd[_0x6772('0x4c')];_0x2e94c9[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x8a3e4d['query'][_0x6772('0x57')]);_0x2e94c9[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x8a3e4d[_0x6772('0x50')],_0x1879dd[_0x6772('0x51')]));if(_0x8a3e4d[_0x6772('0x50')][_0x6772('0x3d')]){_0x2e94c9['where']=_[_0x6772('0x59')](_0x2e94c9[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x2e94c9[_0x6772('0x54')],function(_0x1f3a1c){var _0x23d499={};_0x23d499[_0x1f3a1c]={'$like':'%'+_0x8a3e4d[_0x6772('0x50')][_0x6772('0x3d')]+'%'};return _0x23d499;})});}_0x2e94c9=_['merge']({},_0x2e94c9,_0x8a3e4d['options']);return _0x2955ac[_0x6772('0xcc')](_0x2e94c9);}})[_0x6772('0x21')](function(_0x19040c){if(_0x19040c){_0x41b24d=_0x19040c[_0x6772('0x7b')];if(!_0x8a3e4d['query']['hasOwnProperty']('nolimit')){_0x2e94c9['limit']=qs['limit'](_0x8a3e4d[_0x6772('0x50')]['limit']);_0x2e94c9[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x8a3e4d['query'][_0x6772('0x30')]);}return _0x2955ac[_0x6772('0xcc')](_0x2e94c9);}})[_0x6772('0x21')](function(_0x1b2dbf){if(_0x1b2dbf){return _0x1b2dbf?{'count':_0x41b24d,'rows':_0x1b2dbf}:null;}})[_0x6772('0x21')](respondWithResult(_0x172f83,null))[_0x6772('0x2a')](handleError(_0x172f83,null));};exports[_0x6772('0xcd')]=function(_0x1ef2dc,_0x3ccbd2,_0x4cab05){var _0x1cc68d={};var _0x436610={};var _0x167976;var _0x505e68;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x1ef2dc[_0x6772('0x61')]['id']}})['then'](handleEntityNotFound(_0x3ccbd2,null))['then'](function(_0x49d7a8){if(_0x49d7a8){_0x167976=_0x49d7a8;_0x436610[_0x6772('0x4c')]=_[_0x6772('0x62')](db['OpenchannelInteraction'][_0x6772('0x48')]);_0x436610[_0x6772('0x50')]=_['keys'](_0x1ef2dc['query']);_0x436610[_0x6772('0x51')]=_['intersection'](_0x436610[_0x6772('0x4c')],_0x436610[_0x6772('0x50')]);_0x1cc68d[_0x6772('0x54')]=_[_0x6772('0x52')](_0x436610[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x1ef2dc[_0x6772('0x50')][_0x6772('0x53')]));_0x1cc68d[_0x6772('0x54')]=_0x1cc68d[_0x6772('0x54')]['length']?_0x1cc68d['attributes']:_0x436610[_0x6772('0x4c')];_0x1cc68d[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x1ef2dc[_0x6772('0x50')][_0x6772('0x57')]);_0x1cc68d[_0x6772('0x58')]=qs['filters'](_[_0x6772('0xbb')](_0x1ef2dc[_0x6772('0x50')],_0x436610[_0x6772('0x51')]));if(_0x1ef2dc[_0x6772('0x50')][_0x6772('0x3d')]){_0x1cc68d[_0x6772('0x58')]=_['merge'](_0x1cc68d[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x1cc68d[_0x6772('0x54')],function(_0x2e816f){var _0x98088b={};_0x98088b[_0x2e816f]={'$like':'%'+_0x1ef2dc['query'][_0x6772('0x3d')]+'%'};return _0x98088b;})});}_0x1cc68d=_[_0x6772('0x59')]({},_0x1cc68d,_0x1ef2dc[_0x6772('0x5e')]);return _0x167976['getOpenchannelInteractions'](_0x1cc68d);}})[_0x6772('0x21')](function(_0x39fde4){if(_0x39fde4){_0x505e68=_0x39fde4[_0x6772('0x7b')];if(!_0x1ef2dc[_0x6772('0x50')][_0x6772('0x55')](_0x6772('0xc0'))){_0x1cc68d['limit']=qs[_0x6772('0x31')](_0x1ef2dc[_0x6772('0x50')]['limit']);_0x1cc68d[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x1ef2dc['query'][_0x6772('0x30')]);}return _0x167976[_0x6772('0xcd')](_0x1cc68d);}})[_0x6772('0x21')](function(_0x4200d5){if(_0x4200d5){return _0x4200d5?{'count':_0x505e68,'rows':_0x4200d5}:null;}})['then'](respondWithResult(_0x3ccbd2,null))[_0x6772('0x2a')](handleError(_0x3ccbd2,null));};exports[_0x6772('0xce')]=function(_0x54cfa6,_0x455b8f,_0x240729){var _0x560bed={'raw':!![],'where':{}};var _0x3acf24={};var _0x5be473={'count':0x0,'rows':[]};return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x54cfa6[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x455b8f,null))['then'](function(_0x165ce9){if(_0x165ce9){_0x3acf24[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0xcf')][_0x6772('0x48')]);_0x3acf24[_0x6772('0x50')]=_['keys'](_0x54cfa6[_0x6772('0x50')]);_0x3acf24[_0x6772('0x51')]=_['intersection'](_0x3acf24[_0x6772('0x4c')],_0x3acf24['query']);_0x560bed[_0x6772('0x54')]=_['intersection'](_0x3acf24['model'],qs[_0x6772('0x53')](_0x54cfa6['query'][_0x6772('0x53')]));_0x560bed[_0x6772('0x54')]=_0x560bed[_0x6772('0x54')][_0x6772('0x7b')]?_0x560bed[_0x6772('0x54')]:_0x3acf24['model'];if(!_0x54cfa6[_0x6772('0x50')]['hasOwnProperty']('nolimit')){_0x560bed[_0x6772('0x31')]=qs['limit'](_0x54cfa6[_0x6772('0x50')][_0x6772('0x31')]);_0x560bed['offset']=qs[_0x6772('0x30')](_0x54cfa6[_0x6772('0x50')][_0x6772('0x30')]);}_0x560bed['order']=qs[_0x6772('0x57')](_0x54cfa6[_0x6772('0x50')]['sort']);_0x560bed[_0x6772('0x58')]=qs['filters'](_[_0x6772('0xbb')](_0x54cfa6['query'],_0x3acf24[_0x6772('0x51')]));_0x560bed[_0x6772('0x58')][_0x6772('0xc8')]=_0x165ce9['id'];if(_0x54cfa6[_0x6772('0x50')][_0x6772('0x3d')]){_0x560bed['where']=_[_0x6772('0x59')](_0x560bed[_0x6772('0x58')],{'$or':_['map'](_0x560bed[_0x6772('0x54')],function(_0x315209){var _0x3be152={};_0x3be152[_0x315209]={'$like':'%'+_0x54cfa6[_0x6772('0x50')][_0x6772('0x3d')]+'%'};return _0x3be152;})});}_0x560bed=_['merge']({},_0x560bed,_0x54cfa6[_0x6772('0x5e')]);return db['MailInteraction'][_0x6772('0x2f')]({'where':_0x560bed[_0x6772('0x58')]})[_0x6772('0x21')](function(_0x50f7be){_0x5be473['count']=_0x50f7be;if(_0x54cfa6[_0x6772('0x50')][_0x6772('0x63')]){_0x560bed[_0x6772('0x5f')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x560bed);})['then'](function(_0x28f1b9){_0x5be473[_0x6772('0xc9')]=_0x28f1b9;return _0x5be473;});}})[_0x6772('0x21')](respondWithFilteredResult(_0x455b8f,_0x560bed))[_0x6772('0x2a')](handleError(_0x455b8f,null));};exports['getSmsInteractions']=function(_0x1c92ef,_0x3099e5,_0xce7e80){var _0x23e463={};var _0x28a402={};var _0x1034f5;var _0x10005e;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x1c92ef[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x3099e5,null))[_0x6772('0x21')](function(_0x3b9cff){if(_0x3b9cff){_0x1034f5=_0x3b9cff;_0x28a402['model']=_[_0x6772('0x62')](db[_0x6772('0xd0')][_0x6772('0x48')]);_0x28a402[_0x6772('0x50')]=_[_0x6772('0x62')](_0x1c92ef['query']);_0x28a402[_0x6772('0x51')]=_[_0x6772('0x52')](_0x28a402[_0x6772('0x4c')],_0x28a402['query']);_0x23e463['attributes']=_['intersection'](_0x28a402['model'],qs[_0x6772('0x53')](_0x1c92ef[_0x6772('0x50')][_0x6772('0x53')]));_0x23e463['attributes']=_0x23e463[_0x6772('0x54')][_0x6772('0x7b')]?_0x23e463[_0x6772('0x54')]:_0x28a402['model'];_0x23e463[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x1c92ef[_0x6772('0x50')][_0x6772('0x57')]);_0x23e463[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x1c92ef['query'],_0x28a402['filters']));if(_0x1c92ef[_0x6772('0x50')][_0x6772('0x3d')]){_0x23e463[_0x6772('0x58')]=_[_0x6772('0x59')](_0x23e463['where'],{'$or':_['map'](_0x23e463['attributes'],function(_0x2a9b4c){var _0x40060a={};_0x40060a[_0x2a9b4c]={'$like':'%'+_0x1c92ef[_0x6772('0x50')]['filter']+'%'};return _0x40060a;})});}_0x23e463=_['merge']({},_0x23e463,_0x1c92ef[_0x6772('0x5e')]);return _0x1034f5[_0x6772('0xd1')](_0x23e463);}})[_0x6772('0x21')](function(_0x335e13){if(_0x335e13){_0x10005e=_0x335e13[_0x6772('0x7b')];if(!_0x1c92ef[_0x6772('0x50')][_0x6772('0x55')]('nolimit')){_0x23e463['limit']=qs['limit'](_0x1c92ef[_0x6772('0x50')][_0x6772('0x31')]);_0x23e463[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x1c92ef[_0x6772('0x50')][_0x6772('0x30')]);}return _0x1034f5[_0x6772('0xd1')](_0x23e463);}})['then'](function(_0x92138c){if(_0x92138c){return _0x92138c?{'count':_0x10005e,'rows':_0x92138c}:null;}})[_0x6772('0x21')](respondWithResult(_0x3099e5,null))['catch'](handleError(_0x3099e5,null));};exports[_0x6772('0xd2')]=function(_0x41820b,_0x141df7,_0x357464){var _0x5abe99={};var _0x59744a={};var _0x541e8e;var _0x313ed9;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x41820b['params']['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x141df7,null))[_0x6772('0x21')](function(_0x5d95ba){if(_0x5d95ba){_0x541e8e=_0x5d95ba;_0x59744a[_0x6772('0x4c')]=_[_0x6772('0x62')](db['FaxInteraction'][_0x6772('0x48')]);_0x59744a[_0x6772('0x50')]=_[_0x6772('0x62')](_0x41820b[_0x6772('0x50')]);_0x59744a['filters']=_[_0x6772('0x52')](_0x59744a[_0x6772('0x4c')],_0x59744a['query']);_0x5abe99[_0x6772('0x54')]=_[_0x6772('0x52')](_0x59744a['model'],qs[_0x6772('0x53')](_0x41820b[_0x6772('0x50')][_0x6772('0x53')]));_0x5abe99['attributes']=_0x5abe99[_0x6772('0x54')]['length']?_0x5abe99[_0x6772('0x54')]:_0x59744a[_0x6772('0x4c')];_0x5abe99['order']=qs[_0x6772('0x57')](_0x41820b[_0x6772('0x50')][_0x6772('0x57')]);_0x5abe99[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x41820b[_0x6772('0x50')],_0x59744a[_0x6772('0x51')]));if(_0x41820b[_0x6772('0x50')][_0x6772('0x3d')]){_0x5abe99[_0x6772('0x58')]=_[_0x6772('0x59')](_0x5abe99[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x5abe99[_0x6772('0x54')],function(_0x34320a){var _0x38c9e1={};_0x38c9e1[_0x34320a]={'$like':'%'+_0x41820b['query'][_0x6772('0x3d')]+'%'};return _0x38c9e1;})});}_0x5abe99=_[_0x6772('0x59')]({},_0x5abe99,_0x41820b[_0x6772('0x5e')]);return _0x541e8e[_0x6772('0xd2')](_0x5abe99);}})['then'](function(_0x19a3a0){if(_0x19a3a0){_0x313ed9=_0x19a3a0[_0x6772('0x7b')];if(!_0x41820b['query'][_0x6772('0x55')](_0x6772('0xc0'))){_0x5abe99[_0x6772('0x31')]=qs[_0x6772('0x31')](_0x41820b[_0x6772('0x50')][_0x6772('0x31')]);_0x5abe99[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x41820b[_0x6772('0x50')]['offset']);}return _0x541e8e[_0x6772('0xd2')](_0x5abe99);}})['then'](function(_0x481d5c){if(_0x481d5c){return _0x481d5c?{'count':_0x313ed9,'rows':_0x481d5c}:null;}})[_0x6772('0x21')](respondWithResult(_0x141df7,null))['catch'](handleError(_0x141df7,null));};exports[_0x6772('0xd3')]=function(_0x3aa6b1,_0x53a33a,_0x254894){var _0x139eea={};var _0x2e6fa1={};var _0x159e33;var _0x5a55a2;return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x3aa6b1[_0x6772('0x61')]['id']}})['then'](handleEntityNotFound(_0x53a33a,null))['then'](function(_0x2082c7){if(_0x2082c7){_0x159e33=_0x2082c7;_0x2e6fa1[_0x6772('0x4c')]=_[_0x6772('0x62')](db['WhatsappInteraction'][_0x6772('0x48')]);_0x2e6fa1[_0x6772('0x50')]=_['keys'](_0x3aa6b1[_0x6772('0x50')]);_0x2e6fa1[_0x6772('0x51')]=_[_0x6772('0x52')](_0x2e6fa1[_0x6772('0x4c')],_0x2e6fa1['query']);_0x139eea[_0x6772('0x54')]=_[_0x6772('0x52')](_0x2e6fa1['model'],qs[_0x6772('0x53')](_0x3aa6b1[_0x6772('0x50')][_0x6772('0x53')]));_0x139eea['attributes']=_0x139eea['attributes'][_0x6772('0x7b')]?_0x139eea[_0x6772('0x54')]:_0x2e6fa1[_0x6772('0x4c')];_0x139eea[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x3aa6b1[_0x6772('0x50')][_0x6772('0x57')]);_0x139eea[_0x6772('0x58')]=qs['filters'](_[_0x6772('0xbb')](_0x3aa6b1[_0x6772('0x50')],_0x2e6fa1[_0x6772('0x51')]));if(_0x3aa6b1[_0x6772('0x50')][_0x6772('0x3d')]){_0x139eea['where']=_[_0x6772('0x59')](_0x139eea['where'],{'$or':_[_0x6772('0x3f')](_0x139eea['attributes'],function(_0x1c82d8){var _0x597bb0={};_0x597bb0[_0x1c82d8]={'$like':'%'+_0x3aa6b1[_0x6772('0x50')]['filter']+'%'};return _0x597bb0;})});}_0x139eea=_[_0x6772('0x59')]({},_0x139eea,_0x3aa6b1[_0x6772('0x5e')]);return _0x159e33[_0x6772('0xd3')](_0x139eea);}})[_0x6772('0x21')](function(_0x51c6c0){if(_0x51c6c0){_0x5a55a2=_0x51c6c0['length'];if(!_0x3aa6b1[_0x6772('0x50')][_0x6772('0x55')](_0x6772('0xc0'))){_0x139eea['limit']=qs[_0x6772('0x31')](_0x3aa6b1[_0x6772('0x50')]['limit']);_0x139eea[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x3aa6b1[_0x6772('0x50')][_0x6772('0x30')]);}return _0x159e33['getWhatsappInteractions'](_0x139eea);}})['then'](function(_0x1d563b){if(_0x1d563b){return _0x1d563b?{'count':_0x5a55a2,'rows':_0x1d563b}:null;}})[_0x6772('0x21')](respondWithResult(_0x53a33a,null))[_0x6772('0x2a')](handleError(_0x53a33a,null));};exports[_0x6772('0xd4')]=function(_0x212d95,_0x187926,_0x3fea87){var _0x29a929;var _0x293ec8;var _0x26f9de;var _0x41c35b=!_['isNil'](_0x212d95[_0x6772('0x61')]['id'])?_0x212d95[_0x6772('0x61')]['id']:!_[_0x6772('0x78')](_0x212d95[_0x6772('0x6c')]['id'])?_0x212d95[_0x6772('0x6c')]['id']:null;return db[_0x6772('0x47')][_0x6772('0x65')]({'where':{'id':_0x41c35b,'role':{'$or':[_0x6772('0x6b'),_0x6772('0x6c'),_0x6772('0x69')]}},'attributes':['id',_0x6772('0x44'),_0x6772('0xd5'),_0x6772('0xd6'),_0x6772('0x42'),_0x6772('0x74'),_0x6772('0x98')]})[_0x6772('0x21')](function(_0x353ead){if(_0x353ead){if(_0x353ead['role']==='agent'){_0x29a929=_0x353ead;if(_0x212d95[_0x6772('0x64')][_0x6772('0x9a')]){_0x26f9de=util[_0x6772('0x72')]('LOCAL/%s@from-sip/n',_0x29a929[_0x212d95[_0x6772('0x64')][_0x6772('0x9a')]]);}else if(_0x212d95[_0x6772('0x64')][_0x6772('0xd7')]){_0x26f9de=util[_0x6772('0x72')](_0x6772('0xa9'),_0x212d95['body'][_0x6772('0xd7')]);}else{_0x26f9de=util[_0x6772('0x72')](_0x6772('0xa9'),_0x29a929[_0x6772('0x44')]);}socket['to'](util[_0x6772('0x72')]('user:%s',_0x29a929[_0x6772('0x44')]))[_0x6772('0xa4')](_0x6772('0xd8'),{'ip':_0x212d95['headers'][_0x6772('0xd9')]||_0x212d95['connection'][_0x6772('0xda')]||_0x212d95[_0x6772('0xdb')][_0x6772('0xda')]||_0x212d95[_0x6772('0xdc')][_0x6772('0xdb')][_0x6772('0xda')]});return db[_0x6772('0xaa')][_0x6772('0x38')]({'where':{'membername':_0x29a929[_0x6772('0x44')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x6772('0x1f'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x6772('0x21')](function(){if(_0x29a929){return _0x29a929[_0x6772('0xdd')]({'raw':!![]});}})[_0x6772('0x21')](function(_0x42c0c0){if(_0x29a929){var _0x1dc4e4=[];if(_0x42c0c0){_0x293ec8=_0x42c0c0;if(_0x293ec8[_0x6772('0x7b')]){for(var _0x5395b7=0x0;_0x5395b7<_0x293ec8[_0x6772('0x7b')];_0x5395b7++){_0x1dc4e4['push']({'membername':_0x29a929[_0x6772('0x44')],'UserId':_0x29a929['id'],'queue_name':_0x293ec8[_0x5395b7][_0x6772('0x44')],'VoiceQueueId':_0x293ec8[_0x5395b7]['id'],'interface':_0x26f9de,'paused':_0x29a929[_0x6772('0x98')]||![],'penalty':_0x293ec8[_0x5395b7][_0x6772('0xde')]||0x0});}return BPromise[_0x6772('0xdf')](_0x1dc4e4,function(_0x55be14){return db[_0x6772('0xaa')]['upsert'](_0x55be14);});}}}})[_0x6772('0x21')](function(){if(_0x29a929){return db['MemberReport']['findAll']({'where':{'membername':_0x29a929['name'],'exitAt':null}});}})['then'](function(_0x21d7de){if(_0x29a929){var _0x4b1de1=[];_0x21d7de[_0x6772('0xe0')](function(_0x434909){_0x4b1de1[_0x6772('0xe1')](_0x434909[_0x6772('0x37')]({'exitAt':moment()['format'](_0x6772('0xe2'))}));});return BPromise[_0x6772('0xe3')](_0x4b1de1);}})[_0x6772('0x21')](function(){if(_0x29a929){var _0x20c562=[];var _0x3965ae=[];var _0x445c27=utils[_0x6772('0xe4')]();var _0x29a0bc={'membername':_0x29a929[_0x6772('0x44')],'interface':_0x26f9de,'enterAt':moment()['format'](_0x6772('0xe2')),'role':_0x29a929['role'],'internal':_0x29a929[_0x6772('0x74')]};_0x445c27[_0x6772('0xe0')](function(_0x2e9afe){_0x20c562[_0x6772('0xe1')](_[_0x6772('0x59')]({'channel':_0x2e9afe,'type':_0x6772('0xe5'),'data1':_0x212d95[_0x6772('0x64')][_0x6772('0xe6')],'data2':_0x26f9de},_0x29a0bc));if(_0x29a929[_0x6772('0x98')]){_0x3965ae['push'](_['merge']({'channel':_0x2e9afe,'type':_0x6772('0xe7'),'data1':_0x6772('0xe8')},_0x29a0bc));}});return db['MemberReport'][_0x6772('0xe9')](_0x20c562['concat'](_0x3965ae),{'individualHooks':!![]});}})[_0x6772('0x21')](function(){if(_0x29a929){return _0x29a929[_0x6772('0x37')]({'online':!![],'lastLoginAt':moment()[_0x6772('0x72')](_0x6772('0xe2')),'voicePause':_0x29a929[_0x6772('0x98')]||![],'mailPause':_0x29a929[_0x6772('0x98')]||![],'chatPause':_0x29a929[_0x6772('0x98')]||![],'faxPause':_0x29a929['loginInPause']||![],'smsPause':_0x29a929['loginInPause']||![],'openchannelPause':_0x29a929[_0x6772('0x98')]||![],'whatsappPause':_0x29a929[_0x6772('0x98')]||![],'pauseType':_0x29a929['loginInPause']?_0x6772('0xe8'):null,'interface':_0x26f9de,'lastPauseAt':moment()[_0x6772('0x72')](_0x6772('0xe2'))});}})[_0x6772('0x21')](function(_0x20adf7){if(_0x212d95[_0x6772('0xea')]){return _0x3fea87();}else{return BPromise['resolve'](_0x20adf7)[_0x6772('0x21')](respondWithResult(_0x187926,null));}})[_0x6772('0x2a')](handleError(_0x187926,null));};exports['logout']=function(_0x4c6e1e,_0x2ee342,_0x11e634){var _0x22dce4;return db[_0x6772('0x47')][_0x6772('0x65')]({'where':{'id':_0x4c6e1e[_0x6772('0x61')]['id'],'role':_0x6772('0x69')},'attributes':['id',_0x6772('0x44'),_0x6772('0x42')]})[_0x6772('0x21')](handleEntityNotFound(_0x2ee342,null))['then'](function(_0x199a38){if(_0x199a38){_0x22dce4=_0x199a38;return db[_0x6772('0xaa')][_0x6772('0x38')]({'where':{'membername':_0x22dce4[_0x6772('0x44')]},'individualHooks':!![]});}})['then'](function(){return db[_0x6772('0xeb')][_0x6772('0xa8')]({'where':{'membername':_0x22dce4['name'],'exitAt':null}});})[_0x6772('0x21')](function(_0x311819){var _0x16ebbd=[];_0x311819[_0x6772('0xe0')](function(_0x310cd0){_0x16ebbd['push'](_0x310cd0['update']({'exitAt':moment()[_0x6772('0x72')](_0x6772('0xe2'))}));});return BPromise[_0x6772('0xe3')](_0x16ebbd);})['then'](function(){return _0x22dce4[_0x6772('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2ee342,null))['catch'](handleError(_0x2ee342,null));};exports[_0x6772('0xec')]=function(_0x528aee,_0x4da378,_0x2d2cd3){var _0x315d93;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x528aee[_0x6772('0x61')]['id']},'individualHooks':!![]})[_0x6772('0x21')](function(){return db['User'][_0x6772('0x65')]({'where':{'id':_0x528aee[_0x6772('0x61')]['id'],'role':'agent'},'attributes':['id',_0x6772('0x44'),_0x6772('0x42'),_0x6772('0x74'),_0x6772('0x9a')]});})[_0x6772('0x21')](handleEntityNotFound(_0x4da378,null))[_0x6772('0x21')](function(_0x5f210b){if(_0x5f210b){_0x315d93=_0x5f210b;return respondWithRpcPromise('QueuePause',_0x6772('0xec'),{'id':_0x315d93['id'],'name':_0x315d93['name'],'pause':!![]});}})[_0x6772('0x21')](function(){if(_0x315d93){return db[_0x6772('0xeb')]['findAll']({'where':{'membername':_0x315d93[_0x6772('0x44')],'type':_0x6772('0xe7'),'exitAt':null}});}})[_0x6772('0x21')](function(_0xce3c76){if(_0xce3c76[_0x6772('0x7b')]){var _0x25f24f=moment()[_0x6772('0x72')](_0x6772('0xe2'));for(var _0xc401c4=0x0,_0x5ac3df=_0xce3c76[_0x6772('0x7b')];_0xc401c4<_0x5ac3df;_0xc401c4++){_0xce3c76[_0xc401c4][_0x6772('0xed')]({'exitAt':_0x25f24f});}}})[_0x6772('0x21')](function(){var _0x5aec4c=[];var _0x13d1d6=utils['getChannels']();_0x13d1d6[_0x6772('0xe0')](function(_0x1cefaf){_0x5aec4c[_0x6772('0xe1')]({'channel':_0x1cefaf,'membername':_0x315d93[_0x6772('0x44')],'interface':_[_0x6772('0x78')](_0x315d93['interface'])?util[_0x6772('0x72')](_0x6772('0xa9'),_0x315d93[_0x6772('0x44')]):_0x315d93[_0x6772('0x9a')],'type':_0x6772('0xe7'),'enterAt':moment()[_0x6772('0x72')](_0x6772('0xe2')),'data1':_0x528aee[_0x6772('0x64')][_0x6772('0x4a')]||_0x6772('0xee'),'role':_0x315d93[_0x6772('0x42')],'internal':_0x315d93[_0x6772('0x74')]});});return db[_0x6772('0xeb')][_0x6772('0xe9')](_0x5aec4c,{'individualHooks':!![]});})[_0x6772('0x21')](function(){return _0x315d93[_0x6772('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x528aee[_0x6772('0x64')]['type']||_0x6772('0xee'),'lastPauseAt':moment()[_0x6772('0x72')](_0x6772('0xe2'))});})['then'](respondWithResult(_0x4da378,null))[_0x6772('0x2a')](handleError(_0x4da378,null));};exports['unpause']=function(_0x4bc701,_0x3a9c70,_0x534d77){var _0x2369cc;return db[_0x6772('0x47')][_0x6772('0x65')]({'where':{'id':_0x4bc701[_0x6772('0x61')]['id']},'attributes':['id',_0x6772('0x44'),_0x6772('0x42'),'voicePause',_0x6772('0xef'),_0x6772('0xf0'),_0x6772('0xf1'),_0x6772('0xf2'),_0x6772('0xf3'),_0x6772('0xf4'),_0x6772('0xf5'),'lastPauseAt']})[_0x6772('0x21')](handleEntityNotFound(_0x3a9c70,null))['then'](function(_0x2653ec){if(_0x2653ec){_0x2369cc=_0x2653ec;if(_0x4bc701[_0x6772('0x64')][_0x6772('0x96')]&&!utils[_0x6772('0x9b')](_0x4bc701[_0x6772('0x64')][_0x6772('0x96')])){throw new db[(_0x6772('0x1e'))][(_0x6772('0x1f'))]('Unknown\x20channel');}switch(_0x4bc701[_0x6772('0x64')][_0x6772('0x96')]){case _0x6772('0xa6'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x2369cc['id'],'name':_0x2369cc[_0x6772('0x44')],'pause':![]})[_0x6772('0x21')](function(){return db[_0x6772('0xaa')][_0x6772('0x37')]({'paused':0x0},{'where':{'UserId':_0x2369cc['id']},'individualHooks':!![]});})[_0x6772('0x21')](function(){return db[_0x6772('0xeb')][_0x6772('0x65')]({'where':{'channel':_0x4bc701['body'][_0x6772('0x96')],'membername':_0x2369cc[_0x6772('0x44')],'type':_0x6772('0xe7'),'exitAt':null}});})[_0x6772('0x21')](function(_0x376c4a){if(_0x376c4a){return _0x376c4a['update']({'exitAt':moment()[_0x6772('0x72')](_0x6772('0xe2')),'data2':_0x6772('0xf6')},{'individualHooks':!![]});}return null;})[_0x6772('0x21')](function(){return _0x2369cc['update']({'voicePause':![]});});case _0x6772('0xf7'):case _0x6772('0xf8'):case _0x6772('0xf9'):case'sms':case'whatsapp':case _0x6772('0xfa'):return db[_0x6772('0xeb')][_0x6772('0x65')]({'where':{'channel':_0x4bc701[_0x6772('0x64')][_0x6772('0x96')],'membername':_0x2369cc[_0x6772('0x44')],'type':_0x6772('0xe7'),'exitAt':null}})[_0x6772('0x21')](function(_0x3016bb){if(_0x3016bb){return _0x3016bb[_0x6772('0x37')]({'exitAt':moment()[_0x6772('0x72')](_0x6772('0xe2')),'data2':_0x6772('0xf6')},{'individualHooks':!![]});}return null;})[_0x6772('0x21')](function(){var _0x19b461={};_[_0x6772('0x32')](_0x19b461,util[_0x6772('0x72')](_0x6772('0xfb'),_0x4bc701['body']['channel'],_0x6772('0xfc')),![]);return _0x2369cc['update'](_0x19b461);});default:return respondWithRpcPromise(_0x6772('0xfd'),_0x6772('0xfe'),{'id':_0x2369cc['id'],'name':_0x2369cc[_0x6772('0x44')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2369cc['id']}});})[_0x6772('0x21')](function(){return db[_0x6772('0xeb')]['findAll']({'where':{'membername':_0x2369cc[_0x6772('0x44')],'type':_0x6772('0xe7'),'exitAt':null}});})[_0x6772('0x21')](function(_0x416112){var _0x28fb2a=[];_0x416112[_0x6772('0xe0')](function(_0x2340e2){_0x28fb2a[_0x6772('0xe1')](_0x2340e2[_0x6772('0x37')]({'exitAt':moment()['format'](_0x6772('0xe2')),'data2':'manual'}));});return BPromise[_0x6772('0xe3')](_0x28fb2a);})[_0x6772('0x21')](function(){return _0x2369cc[_0x6772('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6772('0x21')](respondWithResult(_0x3a9c70,null))[_0x6772('0x2a')](handleError(_0x3a9c70,null));};exports[_0x6772('0xff')]=function(_0x14ecbc,_0x1d844c,_0x47c0db){var _0x160486={};var _0x8463f8={};var _0x20528f;var _0x3d8500;return db['User']['findOne']({'where':{'id':_0x14ecbc[_0x6772('0x61')]['id']}})['then'](handleEntityNotFound(_0x1d844c,null))['then'](function(_0x18e69a){if(_0x18e69a){_0x20528f=_0x18e69a;_0x8463f8[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0x100')][_0x6772('0x48')]);_0x8463f8[_0x6772('0x50')]=_['keys'](_0x14ecbc[_0x6772('0x50')]);_0x8463f8[_0x6772('0x51')]=_[_0x6772('0x52')](_0x8463f8['model'],_0x8463f8[_0x6772('0x50')]);_0x160486['attributes']=_['intersection'](_0x8463f8[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x14ecbc[_0x6772('0x50')]['fields']));_0x160486[_0x6772('0x54')]=_0x160486['attributes']['length']?_0x160486[_0x6772('0x54')]:_0x8463f8[_0x6772('0x4c')];_0x160486[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x14ecbc[_0x6772('0x50')][_0x6772('0x57')]);_0x160486[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x14ecbc[_0x6772('0x50')],_0x8463f8[_0x6772('0x51')]));if(_0x14ecbc[_0x6772('0x50')][_0x6772('0x3d')]){_0x160486[_0x6772('0x58')]=_[_0x6772('0x59')](_0x160486[_0x6772('0x58')],{'$or':_[_0x6772('0x3f')](_0x160486[_0x6772('0x54')],function(_0x5a3eb3){var _0x1e7a8e={};_0x1e7a8e[_0x5a3eb3]={'$like':'%'+_0x14ecbc['query'][_0x6772('0x3d')]+'%'};return _0x1e7a8e;})});}_0x160486=_[_0x6772('0x59')]({},_0x160486,_0x14ecbc[_0x6772('0x5e')]);return _0x20528f['getTeams'](_0x160486);}})[_0x6772('0x21')](function(_0x2d04bb){if(_0x2d04bb){_0x3d8500=_0x2d04bb[_0x6772('0x7b')];if(!_0x14ecbc[_0x6772('0x50')][_0x6772('0x55')](_0x6772('0xc0'))){_0x160486['limit']=qs[_0x6772('0x31')](_0x14ecbc[_0x6772('0x50')]['limit']);_0x160486['offset']=qs[_0x6772('0x30')](_0x14ecbc[_0x6772('0x50')][_0x6772('0x30')]);}return _0x20528f['getTeams'](_0x160486);}})[_0x6772('0x21')](function(_0x5e7bd3){if(_0x5e7bd3){return _0x5e7bd3?{'count':_0x3d8500,'rows':_0x5e7bd3}:null;}})[_0x6772('0x21')](respondWithResult(_0x1d844c,null))[_0x6772('0x2a')](handleError(_0x1d844c,null));};exports[_0x6772('0x101')]=function(_0x2ff029,_0x1d60c5){return db[_0x6772('0x47')]['find']({'where':{'id':_0x2ff029[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x1d60c5,null))[_0x6772('0x21')](function(_0x4ec138){if(_0x4ec138){var _0x3d3c82=_0x4ec138['get']({'plain':!![]});return _0x4ec138[_0x6772('0x101')](_0x2ff029[_0x6772('0x64')][_0x6772('0x68')],_[_0x6772('0x102')](_0x2ff029[_0x6772('0x64')],['ids','id'])||{})['then'](function(){for(var _0x417a80=0x0;_0x417a80<_0x2ff029['body'][_0x6772('0x68')][_0x6772('0x7b')];_0x417a80++){var _0x58c528=[];db['Team'][_0x6772('0x8f')]({'where':{'id':_0x2ff029[_0x6772('0x64')][_0x6772('0x68')][_0x417a80]}})[_0x6772('0x21')](function(_0x507e55){_0x58c528[_0x6772('0xe1')](_0x507e55[_0x6772('0xdd')]()['then'](function(_0x50237c){for(var _0x514ff7=0x0;_0x514ff7<_0x50237c[_0x6772('0x7b')];_0x514ff7++){_0x50237c[_0x514ff7]['setDataValue']('channel',_0x6772('0x103'));}return _0x50237c;}));_0x58c528[_0x6772('0xe1')](_0x507e55[_0x6772('0x104')]()[_0x6772('0x21')](function(_0x2c751d){for(var _0x580461=0x0;_0x580461<_0x2c751d[_0x6772('0x7b')];_0x580461++){_0x2c751d[_0x580461][_0x6772('0x105')](_0x6772('0x96'),_0x6772('0x106'));}return _0x2c751d;}));_0x58c528[_0x6772('0xe1')](_0x507e55['getMailQueues']()[_0x6772('0x21')](function(_0x4efc0a){for(var _0x2f6517=0x0;_0x2f6517<_0x4efc0a[_0x6772('0x7b')];_0x2f6517++){_0x4efc0a[_0x2f6517][_0x6772('0x105')](_0x6772('0x96'),'Mail');}return _0x4efc0a;}));_0x58c528[_0x6772('0xe1')](_0x507e55[_0x6772('0x107')]()[_0x6772('0x21')](function(_0x4f4127){for(var _0x444bf0=0x0;_0x444bf0<_0x4f4127['length'];_0x444bf0++){_0x4f4127[_0x444bf0]['setDataValue'](_0x6772('0x96'),_0x6772('0x108'));}return _0x4f4127;}));_0x58c528[_0x6772('0xe1')](_0x507e55[_0x6772('0x109')]()[_0x6772('0x21')](function(_0x126fa0){for(var _0x55bac6=0x0;_0x55bac6<_0x126fa0[_0x6772('0x7b')];_0x55bac6++){_0x126fa0[_0x55bac6][_0x6772('0x105')](_0x6772('0x96'),_0x6772('0x10a'));}return _0x126fa0;}));_0x58c528[_0x6772('0xe1')](_0x507e55[_0x6772('0x10b')]()[_0x6772('0x21')](function(_0x3e99ac){for(var _0x4dc2d0=0x0;_0x4dc2d0<_0x3e99ac[_0x6772('0x7b')];_0x4dc2d0++){_0x3e99ac[_0x4dc2d0]['setDataValue'](_0x6772('0x96'),_0x6772('0x10c'));}return _0x3e99ac;}));_0x58c528[_0x6772('0xe1')](_0x507e55['getOpenchannelQueues']()[_0x6772('0x21')](function(_0x59ecff){for(var _0x44154c=0x0;_0x44154c<_0x59ecff[_0x6772('0x7b')];_0x44154c++){_0x59ecff[_0x44154c][_0x6772('0x105')](_0x6772('0x96'),'Openchannel');}return _0x59ecff;}));return BPromise['all'](_0x58c528);})[_0x6772('0x21')](function(_0xcce1c2){var _0x27f826=_['flatten'](_0xcce1c2);_0x58c528=[];return db[_0x6772('0x5b')][_0x6772('0x10d')](function(_0xf4e3f0){for(var _0x3d04a7=0x0;_0x3d04a7<_0x27f826[_0x6772('0x7b')];_0x3d04a7++){_0x58c528['push'](_0x27f826[_0x3d04a7][_0x6772('0x10e')](_0x3d3c82['id']),{'transaction':_0xf4e3f0});}return BPromise['all'](_0x58c528)[_0x6772('0x21')](function(){if(_0x3d3c82['online']){return BPromise[_0x6772('0xdf')](_[_0x6772('0x3d')](_0x27f826,function(_0x86c515){return _0x86c515[_0x6772('0x10f')](_0x6772('0x96'))===_0x6772('0x103');}),function(_0x1ef7bf){return db[_0x6772('0xaa')]['upsert']({'membername':_0x3d3c82[_0x6772('0x44')],'UserId':_0x3d3c82['id'],'queue_name':_0x1ef7bf['name'],'VoiceQueueId':_0x1ef7bf['id'],'interface':_[_0x6772('0x78')](_0x3d3c82[_0x6772('0x9a')])?util['format'](_0x6772('0xa9'),_0x3d3c82[_0x6772('0x44')]):_0x3d3c82[_0x6772('0x9a')],'paused':_0x3d3c82[_0x6772('0x99')]||![],'penalty':_0x3d3c82['penalty']},{'transaction':_0xf4e3f0});});}else{return;}})[_0x6772('0x21')](function(){for(var _0x1f65c4=0x0;_0x1f65c4<_0x27f826[_0x6772('0x7b')];_0x1f65c4++){var _0x1ef3e8=_0x27f826[_0x1f65c4][_0x6772('0x10f')](_0x6772('0x96'));var _0xf32dae=_0x1ef3e8+_0x6772('0xa3');socket[_0x6772('0xa4')]('user'+_0x1ef3e8+_0x6772('0xa5'),{'UserId':_0x3d3c82['id'],['queueField']:_0x27f826[_0x1f65c4]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x1d60c5,null))[_0x6772('0x2a')](handleError(_0x1d60c5,null));};exports[_0x6772('0x110')]=function(_0x326124,_0x1c1c09){return db[_0x6772('0x47')][_0x6772('0x8f')]({'where':{'id':_0x326124[_0x6772('0x61')]['id']}})['then'](handleEntityNotFound(_0x1c1c09,null))[_0x6772('0x21')](function(_0x12dbae){if(_0x12dbae){var _0x26d63a=_0x12dbae[_0x6772('0x39')]({'plain':!![]});var _0x5c6745=_0x326124['query'][_0x6772('0x68')];return _0x12dbae['removeTeams'](_0x5c6745)[_0x6772('0x21')](function(){for(var _0x22aef8=0x0;_0x22aef8<_0x5c6745[_0x6772('0x7b')];_0x22aef8++){var _0xbad388=[];db[_0x6772('0x100')][_0x6772('0x8f')]({'where':{'id':_0x5c6745[_0x22aef8]}})['then'](function(_0x3d6b03){_0xbad388['push'](_0x3d6b03[_0x6772('0xdd')]()[_0x6772('0x21')](function(_0x3c9496){for(var _0x4f1f2a=0x0;_0x4f1f2a<_0x3c9496[_0x6772('0x7b')];_0x4f1f2a++){_0x3c9496[_0x4f1f2a][_0x6772('0x105')](_0x6772('0x96'),_0x6772('0x103'));}return _0x3c9496;}));_0xbad388[_0x6772('0xe1')](_0x3d6b03['getChatQueues']()[_0x6772('0x21')](function(_0x4f9251){for(var _0x1a8a26=0x0;_0x1a8a26<_0x4f9251['length'];_0x1a8a26++){_0x4f9251[_0x1a8a26][_0x6772('0x105')]('channel',_0x6772('0x106'));}return _0x4f9251;}));_0xbad388['push'](_0x3d6b03['getMailQueues']()[_0x6772('0x21')](function(_0x4fc673){for(var _0x5dcbf4=0x0;_0x5dcbf4<_0x4fc673[_0x6772('0x7b')];_0x5dcbf4++){_0x4fc673[_0x5dcbf4][_0x6772('0x105')](_0x6772('0x96'),_0x6772('0x111'));}return _0x4fc673;}));_0xbad388[_0x6772('0xe1')](_0x3d6b03[_0x6772('0x107')]()[_0x6772('0x21')](function(_0x1dcb01){for(var _0x48c347=0x0;_0x48c347<_0x1dcb01[_0x6772('0x7b')];_0x48c347++){_0x1dcb01[_0x48c347]['setDataValue'](_0x6772('0x96'),'Sms');}return _0x1dcb01;}));_0xbad388['push'](_0x3d6b03[_0x6772('0x109')]()['then'](function(_0x29b02c){for(var _0x532db1=0x0;_0x532db1<_0x29b02c['length'];_0x532db1++){_0x29b02c[_0x532db1][_0x6772('0x105')](_0x6772('0x96'),_0x6772('0x10a'));}return _0x29b02c;}));_0xbad388[_0x6772('0xe1')](_0x3d6b03[_0x6772('0x10b')]()['then'](function(_0x133bc6){for(var _0x28385a=0x0;_0x28385a<_0x133bc6[_0x6772('0x7b')];_0x28385a++){_0x133bc6[_0x28385a]['setDataValue'](_0x6772('0x96'),_0x6772('0x10c'));}return _0x133bc6;}));_0xbad388[_0x6772('0xe1')](_0x3d6b03[_0x6772('0x112')]()[_0x6772('0x21')](function(_0x1714a2){for(var _0x20db68=0x0;_0x20db68<_0x1714a2[_0x6772('0x7b')];_0x20db68++){_0x1714a2[_0x20db68][_0x6772('0x105')](_0x6772('0x96'),_0x6772('0x113'));}return _0x1714a2;}));return BPromise[_0x6772('0xe3')](_0xbad388);})[_0x6772('0x21')](function(_0x4d7101){var _0x242d37=_[_0x6772('0x114')](_0x4d7101);_0xbad388=[];return db[_0x6772('0x5b')][_0x6772('0x10d')](function(_0x31717d){for(var _0x19f8e2=0x0;_0x19f8e2<_0x242d37[_0x6772('0x7b')];_0x19f8e2++){_0xbad388['push'](_0x242d37[_0x19f8e2][_0x6772('0x115')](_0x26d63a['id']),{'transaction':_0x31717d});}return BPromise[_0x6772('0xe3')](_0xbad388)[_0x6772('0x21')](function(){if(_0x26d63a[_0x6772('0x97')]){return BPromise[_0x6772('0xdf')](_[_0x6772('0x3d')](_0x242d37,function(_0x125fed){return _0x125fed['getDataValue'](_0x6772('0x96'))===_0x6772('0x103');}),function(_0x4c4a28){return db[_0x6772('0xaa')][_0x6772('0x38')]({'where':{'VoiceQueueId':_0x4c4a28['id'],'UserId':_0x26d63a['id']},'transaction':_0x31717d});});}else{return;}})[_0x6772('0x21')](function(){for(var _0xa297=0x0;_0xa297<_0x242d37[_0x6772('0x7b')];_0xa297++){var _0x486461=_0x242d37[_0xa297][_0x6772('0x10f')](_0x6772('0x96'));var _0x106fc3=_0x486461+_0x6772('0xa3');socket[_0x6772('0xa4')](_0x6772('0x6c')+_0x486461+_0x6772('0xae'),{'UserId':_0x26d63a['id'],['queueField']:_0x242d37[_0xa297]['id']});}});});});}});}})[_0x6772('0x21')](respondWithStatusCode(_0x1c1c09,null))['catch'](handleError(_0x1c1c09,null));};exports[_0x6772('0x116')]=function(_0x1e9d47,_0x2a6e0f,_0x407f91){var _0x2c2ac3={};var _0x12881f={};var _0x4265a0;var _0x4dc0a3;return db['User'][_0x6772('0x8f')]({'where':{'id':_0x1e9d47[_0x6772('0x61')]['id']}})[_0x6772('0x21')](handleEntityNotFound(_0x2a6e0f,null))[_0x6772('0x21')](function(_0x394513){if(_0x394513){_0x4265a0=_0x394513;_0x12881f[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0xbc')][_0x6772('0x48')]);_0x12881f[_0x6772('0x50')]=_[_0x6772('0x62')](_0x1e9d47[_0x6772('0x50')]);_0x12881f['filters']=_['intersection'](_0x12881f[_0x6772('0x4c')],_0x12881f[_0x6772('0x50')]);_0x2c2ac3[_0x6772('0x54')]=_[_0x6772('0x52')](_0x12881f[_0x6772('0x4c')],qs[_0x6772('0x53')](_0x1e9d47['query'][_0x6772('0x53')]));_0x2c2ac3[_0x6772('0x54')]=_0x2c2ac3[_0x6772('0x54')][_0x6772('0x7b')]?_0x2c2ac3[_0x6772('0x54')]:_0x12881f[_0x6772('0x4c')];_0x2c2ac3[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x1e9d47[_0x6772('0x50')][_0x6772('0x57')]);_0x2c2ac3[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x1e9d47[_0x6772('0x50')],_0x12881f[_0x6772('0x51')]));if(_0x1e9d47['query']['filter']){_0x2c2ac3['where']=_['merge'](_0x2c2ac3['where'],{'$or':_[_0x6772('0x3f')](_0x2c2ac3[_0x6772('0x54')],function(_0x26b3cd){var _0x492fdd={};_0x492fdd[_0x26b3cd]={'$like':'%'+_0x1e9d47[_0x6772('0x50')]['filter']+'%'};return _0x492fdd;})});}_0x2c2ac3=_['merge']({},_0x2c2ac3,_0x1e9d47[_0x6772('0x5e')]);return _0x4265a0['getLists'](_0x2c2ac3);}})['then'](function(_0x1186d6){if(_0x1186d6){_0x4dc0a3=_0x1186d6['length'];if(!_0x1e9d47['query']['hasOwnProperty'](_0x6772('0xc0'))){_0x2c2ac3[_0x6772('0x31')]=qs['limit'](_0x1e9d47[_0x6772('0x50')][_0x6772('0x31')]);_0x2c2ac3[_0x6772('0x30')]=qs[_0x6772('0x30')](_0x1e9d47[_0x6772('0x50')]['offset']);}return _0x4265a0['getLists'](_0x2c2ac3);}})[_0x6772('0x21')](function(_0x45ac84){if(_0x45ac84){return _0x45ac84?{'count':_0x4dc0a3,'rows':_0x45ac84}:null;}})['then'](respondWithResult(_0x2a6e0f,null))[_0x6772('0x2a')](handleError(_0x2a6e0f,null));};exports[_0x6772('0x117')]=function(_0x267eaf,_0x129f56,_0x266d39){var _0x359bc0={};var _0x39415b={};var _0x4d6024;var _0x3e85ce;return db['User'][_0x6772('0x8f')]({'where':{'id':_0x267eaf['params']['id']}})['then'](handleEntityNotFound(_0x129f56,null))[_0x6772('0x21')](function(_0x5aa690){if(_0x5aa690){_0x4d6024=_0x5aa690;_0x39415b[_0x6772('0x4c')]=_[_0x6772('0x62')](db[_0x6772('0x47')][_0x6772('0x48')]);_0x39415b[_0x6772('0x50')]=_['keys'](_0x267eaf['query']);_0x39415b[_0x6772('0x51')]=_[_0x6772('0x52')](_0x39415b[_0x6772('0x4c')],_0x39415b[_0x6772('0x50')]);_0x359bc0['attributes']=_[_0x6772('0x52')](_0x39415b['model'],qs[_0x6772('0x53')](_0x267eaf[_0x6772('0x50')][_0x6772('0x53')]));_0x359bc0[_0x6772('0x54')]=_0x359bc0['attributes'][_0x6772('0x7b')]?_0x359bc0[_0x6772('0x54')]:_0x39415b['model'];_0x359bc0[_0x6772('0x56')]=qs[_0x6772('0x57')](_0x267eaf[_0x6772('0x50')]['sort']);_0x359bc0[_0x6772('0x58')]=qs[_0x6772('0x51')](_[_0x6772('0xbb')](_0x267eaf[_0x6772('0x50')],_0x39415b[_0x6772('0x51')]));if(_0x267eaf[_0x6772('0x50')][_0x6772('0x3d')]){_0x359bc0[_0x6772('0x58')]=_[_0x6772('0x59')](_0x359bc0['where'],{'$or':_[_0x6772('0x3f')](_0x359bc0['attributes'],function(_0x4f449e){var _0xbe7efc={};_0xbe7efc[_0x4f449e]={'$like':'%'+_0x267eaf[_0x6772('0x50')][_0x6772('0x3d')]+'%'};return _0xbe7efc;})});}_0x359bc0[_0x6772('0x4c')]=db['User'];_0x359bc0['as']=_0x6772('0x8a');_0x359bc0=_[_0x6772('0x59')]({},_0x359bc0,_0x267eaf[_0x6772('0x5e')]);return _0x4d6024[_0x6772('0xdd')]({'include':[_0x359bc0]});}})[_0x6772('0x21')](function(_0x24293b){if(_0x24293b){var _0x29fc1c={},_0xc67c2f=[],_0x1d8c75=0x0;for(var _0x36d54e=0x0;_0x36d54e<_0x24293b[_0x6772('0x7b')];_0x36d54e+=0x1){for(var _0xc6593b=0x0,_0x4633ae;_0xc6593b<_0x24293b[_0x36d54e]['Agents']['length'];_0xc6593b+=0x1){_0x4633ae=_0x24293b[_0x36d54e]['Agents'][_0xc6593b][_0x6772('0x39')]({'plain':!![]});_0x29fc1c[_0x4633ae['id']]=_0x4633ae;}}_0x29fc1c=_[_0x6772('0x118')](_0x29fc1c);for(var _0x8d6b73=qs[_0x6772('0x30')](_0x267eaf[_0x6772('0x50')][_0x6772('0x30')]);_0x8d6b73<_0x29fc1c['length']&&_0xc67c2f['length']=_0x2efc18[_0x31fc('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x31fc('0x13')](function(){if(_0x3a7edc){return db[_0x31fc('0x2e')][_0x31fc('0x49')]({'where':{'membername':_0x3a7edc[_0x31fc('0x2b')]},'individualHooks':!![]});}})[_0x31fc('0x13')](function(){if(_0x3a7edc){return _0x3a7edc[_0x31fc('0x52')]({'raw':!![]});}})[_0x31fc('0x13')](function(_0xd37ee8){if(_0x3a7edc){if(_0xd37ee8){var _0x5469ce=[];_0x996790=_0xd37ee8;if(_0x996790[_0x31fc('0x53')]){for(var _0x16a9f4=0x0;_0x16a9f4<_0x996790[_0x31fc('0x53')];_0x16a9f4++){_0x5469ce['push'](db[_0x31fc('0x2e')][_0x31fc('0x54')]({'membername':_0x3a7edc[_0x31fc('0x2b')],'UserId':_0x3a7edc['id'],'queue_name':_0x996790[_0x16a9f4][_0x31fc('0x2b')],'VoiceQueueId':_0x996790[_0x16a9f4]['id'],'interface':_0x4df249,'paused':_0x3a7edc[_0x31fc('0x4d')]||![],'penalty':_0x996790[_0x16a9f4]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x5469ce);}}}})[_0x31fc('0x13')](function(){if(_0x3a7edc){return db['MemberReport'][_0x31fc('0x20')]({'where':{'membername':_0x3a7edc['name'],'exitAt':null}});}})['then'](function(_0x30b692){if(_0x3a7edc){if(_0x30b692&&_0x30b692[_0x31fc('0x53')]){var _0x58c450=[];_0x30b692[_0x31fc('0x35')](function(_0x392ab4){_0x58c450[_0x31fc('0x36')](_0x392ab4['update']({'exitAt':moment()[_0x31fc('0x31')](_0x31fc('0x32'))}));});return BPromise[_0x31fc('0x4a')](_0x58c450);}}})['then'](function(_0x167af3){if(_0x3a7edc){var _0xfcefc6=[];var _0x22cc9e=[];var _0x9f6db6=utils[_0x31fc('0x34')]();var _0x242790={'membername':_0x3a7edc[_0x31fc('0x2b')],'interface':_0x4df249,'enterAt':moment()['format'](_0x31fc('0x32')),'role':_0x3a7edc[_0x31fc('0x2c')],'internal':_0x3a7edc['internal']};_0x9f6db6[_0x31fc('0x35')](function(_0x241774){_0xfcefc6[_0x31fc('0x36')](_[_0x31fc('0x55')]({'channel':_0x241774,'type':_0x31fc('0x56'),'data1':'callysquare','data2':_0x4df249},_0x242790));if(_0x3a7edc[_0x31fc('0x4d')]){_0x22cc9e[_0x31fc('0x36')](_[_0x31fc('0x55')]({'channel':_0x241774,'type':_0x31fc('0x39'),'data1':_0x31fc('0x57')},_0x242790));}});return db[_0x31fc('0x30')][_0x31fc('0x3d')](_0xfcefc6[_0x31fc('0x58')](_0x22cc9e),{'individualHooks':!![]});}})[_0x31fc('0x13')](function(){if(_0x3a7edc){return _0x3a7edc[_0x31fc('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x31fc('0x31')](_0x31fc('0x32')),'voicePause':_0x3a7edc[_0x31fc('0x4d')]||![],'mailPause':_0x3a7edc[_0x31fc('0x4d')]||![],'chatPause':_0x3a7edc['loginInPause']||![],'faxPause':_0x3a7edc['loginInPause']||![],'smsPause':_0x3a7edc[_0x31fc('0x4d')]||![],'openchannelPause':_0x3a7edc['loginInPause']||![],'pauseType':_0x3a7edc['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x31fc('0x31')](_0x31fc('0x32')),'interface':_0x4df249});}})[_0x31fc('0x13')](function(_0x1b99ec){_0x1a970(_0x1b99ec);})[_0x31fc('0x1d')](function(_0x11fb6b){_0x4c7d41(_0x1bec2e[_0x31fc('0x19')](0x1f4,_0x11fb6b['message']));});});}; \ No newline at end of file +var _0x9320=['find','ShowUser','PauseUser','name','role','internal','interface','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','type','UnpauseUser','channel','Unknown\x20channel','voice','UserVoiceQueueRt','chat','fax','sms','openchannel','system','set','%s%s','Pause','findAll','all','LogoutUser','findOne','destroy','forEach','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetUser','User','options','raw','where','attributes','limit','include','model','map','catch'];(function(_0x107c78,_0x565ea0){var _0x36977b=function(_0x5bfea9){while(--_0x5bfea9){_0x107c78['push'](_0x107c78['shift']());}};_0x36977b(++_0x565ea0);}(_0x9320,0x96));var _0x0932=function(_0x2992cb,_0x102ca6){_0x2992cb=_0x2992cb-0x0;var _0x499699=_0x9320[_0x2992cb];return _0x499699;};'use strict';var _=require(_0x0932('0x0'));var util=require(_0x0932('0x1'));var moment=require(_0x0932('0x2'));var BPromise=require(_0x0932('0x3'));var rs=require(_0x0932('0x4'));var fs=require('fs');var Redis=require(_0x0932('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0932('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0932('0x7'));var jayson=require(_0x0932('0x8'));var client=jayson['client'][_0x0932('0x9')]({'port':0x232a});config[_0x0932('0xa')]=_[_0x0932('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0932('0xa')]));require(_0x0932('0xc'))[_0x0932('0xd')](socket);function respondWithRpcPromise(_0x3e6dbf,_0xdaea7f,_0x4f1bd3){return new BPromise(function(_0x33bb1d,_0x2d5549){return client[_0x0932('0xe')](_0x3e6dbf,_0x4f1bd3)[_0x0932('0xf')](function(_0x442184){logger[_0x0932('0x10')](_0x0932('0x11'),_0xdaea7f,_0x0932('0x12'));logger[_0x0932('0x13')](_0x0932('0x14'),_0xdaea7f,'request\x20sent',JSON[_0x0932('0x15')](_0x442184));if(_0x442184[_0x0932('0x16')]){if(_0x442184[_0x0932('0x16')][_0x0932('0x17')]===0x1f4){logger['error'](_0x0932('0x11'),_0xdaea7f,_0x442184['error'][_0x0932('0x18')]);return _0x2d5549(_0x442184[_0x0932('0x16')][_0x0932('0x18')]);}logger[_0x0932('0x16')](_0x0932('0x11'),_0xdaea7f,_0x442184['error']['message']);return _0x33bb1d(_0x442184['error']['message']);}else{logger[_0x0932('0x10')]('User,\x20%s,\x20%s',_0xdaea7f,_0x0932('0x12'));_0x33bb1d(_0x442184['result']['message']);}})['catch'](function(_0x4d3fbb){logger[_0x0932('0x16')](_0x0932('0x11'),_0xdaea7f,_0x4d3fbb);_0x2d5549(_0x4d3fbb);});});}exports[_0x0932('0x19')]=function(_0x210266){var _0x20cd7e=this;return new Promise(function(_0x43857d,_0x2daa8f){return db[_0x0932('0x1a')]['findAll']({'raw':_0x210266[_0x0932('0x1b')]?_0x210266[_0x0932('0x1b')][_0x0932('0x1c')]===undefined?!![]:![]:!![],'where':_0x210266[_0x0932('0x1b')]?_0x210266['options'][_0x0932('0x1d')]||null:null,'attributes':_0x210266['options']?_0x210266[_0x0932('0x1b')][_0x0932('0x1e')]||null:null,'limit':_0x210266[_0x0932('0x1b')]?_0x210266[_0x0932('0x1b')][_0x0932('0x1f')]||null:null,'include':_0x210266[_0x0932('0x1b')]?_0x210266['options'][_0x0932('0x20')]?_['map'](_0x210266['options'][_0x0932('0x20')],function(_0x1e4d4f){return{'model':db[_0x1e4d4f[_0x0932('0x21')]],'as':_0x1e4d4f['as'],'attributes':_0x1e4d4f[_0x0932('0x1e')],'include':_0x1e4d4f[_0x0932('0x20')]?_[_0x0932('0x22')](_0x1e4d4f[_0x0932('0x20')],function(_0xf2495c){return{'model':db[_0xf2495c['model']],'as':_0xf2495c['as'],'attributes':_0xf2495c[_0x0932('0x1e')],'include':_0xf2495c[_0x0932('0x20')]?_[_0x0932('0x22')](_0xf2495c[_0x0932('0x20')],function(_0x4fb6d3){return{'model':db[_0x4fb6d3[_0x0932('0x21')]],'as':_0x4fb6d3['as'],'attributes':_0x4fb6d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0932('0xf')](function(_0x243f71){logger['info']('GetUser',_0x210266);logger[_0x0932('0x13')](_0x0932('0x19'),_0x210266,JSON[_0x0932('0x15')](_0x243f71));_0x43857d(_0x243f71);})[_0x0932('0x23')](function(_0x145a10){logger[_0x0932('0x16')](_0x0932('0x19'),_0x145a10['message'],_0x210266);_0x2daa8f(_0x20cd7e[_0x0932('0x16')](0x1f4,_0x145a10[_0x0932('0x18')]));});});};exports['ShowUser']=function(_0x55e9f1){var _0x4ad4de=this;return new Promise(function(_0x4ee823,_0x33a344){return db[_0x0932('0x1a')][_0x0932('0x24')]({'raw':_0x55e9f1[_0x0932('0x1b')]?_0x55e9f1[_0x0932('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x55e9f1[_0x0932('0x1b')]?_0x55e9f1[_0x0932('0x1b')][_0x0932('0x1d')]||null:null,'attributes':_0x55e9f1[_0x0932('0x1b')]?_0x55e9f1[_0x0932('0x1b')][_0x0932('0x1e')]||null:null,'include':_0x55e9f1[_0x0932('0x1b')]?_0x55e9f1['options'][_0x0932('0x20')]?_[_0x0932('0x22')](_0x55e9f1[_0x0932('0x1b')][_0x0932('0x20')],function(_0xf09753){return{'model':db[_0xf09753[_0x0932('0x21')]],'as':_0xf09753['as'],'attributes':_0xf09753[_0x0932('0x1e')],'include':_0xf09753[_0x0932('0x20')]?_['map'](_0xf09753[_0x0932('0x20')],function(_0x34dad9){return{'model':db[_0x34dad9['model']],'as':_0x34dad9['as'],'attributes':_0x34dad9[_0x0932('0x1e')],'include':_0x34dad9[_0x0932('0x20')]?_[_0x0932('0x22')](_0x34dad9[_0x0932('0x20')],function(_0x32312a){return{'model':db[_0x32312a[_0x0932('0x21')]],'as':_0x32312a['as'],'attributes':_0x32312a[_0x0932('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0932('0xf')](function(_0x31b706){logger[_0x0932('0x10')]('ShowUser',_0x55e9f1);logger[_0x0932('0x13')]('ShowUser',_0x55e9f1,JSON[_0x0932('0x15')](_0x31b706));_0x4ee823(_0x31b706);})['catch'](function(_0xafe6be){logger[_0x0932('0x16')](_0x0932('0x25'),_0xafe6be[_0x0932('0x18')],_0x55e9f1);_0x33a344(_0x4ad4de[_0x0932('0x16')](0x1f4,_0xafe6be[_0x0932('0x18')]));});});};exports[_0x0932('0x26')]=function(_0x4ad7d0){var _0x5b952b=this;return new Promise(function(_0x282f38,_0x25d378){var _0x273eaf;return db[_0x0932('0x1a')][_0x0932('0x24')]({'where':_0x4ad7d0['options']['where']||{},'attributes':['id',_0x0932('0x27'),_0x0932('0x28'),_0x0932('0x29'),_0x0932('0x2a')]})['then'](function(_0x2dc1af){if(_0x2dc1af){_0x273eaf=_0x2dc1af;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x273eaf['id']},'individualHooks':!![]});}})[_0x0932('0xf')](function(){if(_0x273eaf){return db[_0x0932('0x2b')]['findAll']({'where':{'membername':_0x273eaf[_0x0932('0x27')],'type':_0x0932('0x2c'),'exitAt':null}});}})[_0x0932('0xf')](function(_0x210684){if(_0x273eaf){if(_0x210684&&_0x210684['length']){var _0xd03355=moment()[_0x0932('0x2d')](_0x0932('0x2e'));for(var _0x27b862=0x0,_0x45aed8=_0x210684[_0x0932('0x2f')];_0x27b862<_0x45aed8;_0x27b862++){_0x210684[_0x27b862]['updateAttributes']({'exitAt':_0xd03355});}}}})['then'](function(){if(_0x273eaf){var _0x1f2965=[];var _0x2c12b4=utils[_0x0932('0x30')]();_0x2c12b4['forEach'](function(_0x2bb875){_0x1f2965[_0x0932('0x31')]({'channel':_0x2bb875,'membername':_0x273eaf[_0x0932('0x27')],'interface':_[_0x0932('0x32')](_0x273eaf[_0x0932('0x2a')])?util[_0x0932('0x2d')](_0x0932('0x33'),_0x273eaf['name']):_0x273eaf[_0x0932('0x2a')],'type':_0x0932('0x2c'),'enterAt':moment()['format'](_0x0932('0x2e')),'data1':_0x4ad7d0[_0x0932('0x34')]['type']||_0x0932('0x35'),'role':_0x273eaf['role'],'internal':_0x273eaf['internal'],'uniqueid':_0x4ad7d0[_0x0932('0x34')][_0x0932('0x36')]||null});});return db[_0x0932('0x2b')][_0x0932('0x37')](_0x1f2965,{'individualHooks':!![]});}})[_0x0932('0xf')](function(){if(_0x273eaf){return _0x273eaf[_0x0932('0x38')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4ad7d0[_0x0932('0x34')][_0x0932('0x39')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0932('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0932('0xf')](function(_0x20b60b){_0x282f38(_0x20b60b);})['catch'](function(_0xfdcad8){_0x25d378(_0x5b952b[_0x0932('0x16')](0x1f4,_0xfdcad8[_0x0932('0x18')]));});});};exports[_0x0932('0x3a')]=function(_0x1ff078){var _0x16b989=this;return new Promise(function(_0x229b81,_0x15bc0c){var _0x60a06c;return db[_0x0932('0x1a')]['findOne']({'where':_0x1ff078['options'][_0x0932('0x1d')]||{},'attributes':['id',_0x0932('0x27')]})[_0x0932('0xf')](function(_0x2c1c7e){if(_0x2c1c7e){_0x60a06c=_0x2c1c7e;if(_0x1ff078['body'][_0x0932('0x3b')]&&!utils['isValidChannel'](_0x1ff078['body'][_0x0932('0x3b')])){throw new Error(_0x0932('0x3c'));}switch(_0x1ff078[_0x0932('0x34')]['channel']){case _0x0932('0x3d'):return db[_0x0932('0x3e')]['update']({'paused':0x0},{'where':{'UserId':_0x60a06c['id']}})[_0x0932('0xf')](function(){return db[_0x0932('0x2b')][_0x0932('0x24')]({'where':{'channel':_0x1ff078['body'][_0x0932('0x3b')],'membername':_0x60a06c[_0x0932('0x27')],'type':_0x0932('0x2c'),'exitAt':null}});})[_0x0932('0xf')](function(_0x45d1bb){if(_0x45d1bb){return _0x45d1bb['update']({'exitAt':moment()[_0x0932('0x2d')](_0x0932('0x2e')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x0932('0xf')](function(){return _0x60a06c['update']({'voicePause':![]});});case'mail':case _0x0932('0x3f'):case _0x0932('0x40'):case _0x0932('0x41'):case _0x0932('0x42'):return db[_0x0932('0x2b')][_0x0932('0x24')]({'where':{'channel':_0x1ff078[_0x0932('0x34')][_0x0932('0x3b')],'membername':_0x60a06c['name'],'type':_0x0932('0x2c'),'exitAt':null}})[_0x0932('0xf')](function(_0x100db3){return _0x100db3['update']({'exitAt':moment()[_0x0932('0x2d')](_0x0932('0x2e')),'data2':_0x0932('0x43')},{'individualHooks':!![]});})[_0x0932('0xf')](function(){var _0x56f3a2={};_[_0x0932('0x44')](_0x56f3a2,util[_0x0932('0x2d')](_0x0932('0x45'),_0x1ff078['body'][_0x0932('0x3b')],_0x0932('0x46')),![]);return _0x60a06c['update'](_0x56f3a2);});default:return db[_0x0932('0x3e')]['update']({'paused':0x0},{'where':{'UserId':_0x60a06c['id']}})[_0x0932('0xf')](function(){return db[_0x0932('0x2b')][_0x0932('0x47')]({'where':{'membername':_0x60a06c[_0x0932('0x27')],'type':_0x0932('0x2c'),'exitAt':null}});})[_0x0932('0xf')](function(_0x15feaa){var _0x54f380=[];_0x15feaa['forEach'](function(_0x48841d){_0x54f380[_0x0932('0x31')](_0x48841d[_0x0932('0x38')]({'exitAt':moment()[_0x0932('0x2d')](_0x0932('0x2e')),'data2':_0x0932('0x43')}));});return BPromise[_0x0932('0x48')](_0x54f380);})[_0x0932('0xf')](function(){return _0x60a06c[_0x0932('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0xf2647e){_0x229b81(_0xf2647e);})[_0x0932('0x23')](function(_0x44105f){_0x15bc0c(_0x16b989['error'](0x1f4,_0x44105f[_0x0932('0x18')]));});});};exports[_0x0932('0x49')]=function(_0x59a7bb){var _0x58de3a=this;return new Promise(function(_0x2c16b1,_0x1426c1){var _0x2686db;return db[_0x0932('0x1a')][_0x0932('0x4a')]({'where':_0x59a7bb[_0x0932('0x1b')][_0x0932('0x1d')]||{},'attributes':['id',_0x0932('0x27')]})['then'](function(_0x2d8c72){if(_0x2d8c72){_0x2686db=_0x2d8c72;return db['UserVoiceQueueRt'][_0x0932('0x4b')]({'where':{'membername':_0x2686db[_0x0932('0x27')]},'individualHooks':!![]});}})[_0x0932('0xf')](function(){if(_0x2686db){return db[_0x0932('0x2b')][_0x0932('0x47')]({'where':{'membername':_0x2686db['name'],'exitAt':null}});}})[_0x0932('0xf')](function(_0x3df799){if(_0x2686db){if(_0x3df799&&_0x3df799[_0x0932('0x2f')]){var _0x500638=[];_0x3df799[_0x0932('0x4c')](function(_0x485d20){_0x500638[_0x0932('0x31')](_0x485d20[_0x0932('0x38')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0932('0x48')](_0x500638);}}})[_0x0932('0xf')](function(){if(_0x2686db){return _0x2686db[_0x0932('0x38')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0932('0xf')](function(_0x2eb0ce){_0x2c16b1(_0x2eb0ce);})[_0x0932('0x23')](function(_0x2fc6be){_0x1426c1(_0x58de3a[_0x0932('0x16')](0x1f4,_0x2fc6be[_0x0932('0x18')]));});});};exports[_0x0932('0x4d')]=function(_0x3c9142){var _0x4a376b=this;return new Promise(function(_0x431c4f,_0x4410c9){var _0x3327e3;var _0x3ef852;var _0x19a059;var _0x1ea6ab;return db[_0x0932('0x1a')][_0x0932('0x4a')]({'where':_0x3c9142[_0x0932('0x1b')][_0x0932('0x1d')]||{},'attributes':['id','name','role',_0x0932('0x4e'),_0x0932('0x4f'),_0x0932('0x29'),_0x0932('0x50'),'interface']})[_0x0932('0xf')](function(_0xac5dc7){if(_0xac5dc7){_0x3327e3=_0xac5dc7;_0x1ea6ab=_0x3c9142[_0x0932('0x34')][_0x0932('0x2a')]?_0x3c9142[_0x0932('0x34')][_0x0932('0x2a')]:util[_0x0932('0x2d')](_0x0932('0x33'),_0x3327e3[_0x0932('0x27')]);return db[_0x0932('0x1a')][_0x0932('0x51')]({'where':{'role':_0x0932('0x52'),'online':!![],'id':{'$ne':_0x3327e3['id']}}});}})[_0x0932('0xf')](function(_0x406adb){if(_0x406adb){_0x19a059=_0x406adb;return require('../../config/license/util')[_0x0932('0x53')]();}})['then'](function(_0xfbf5db){if(_0xfbf5db&&_0xfbf5db['agents']&&_0x19a059>=_0xfbf5db[_0x0932('0x54')]){throw new Error(_0x0932('0x55'));}})['then'](function(){if(_0x3327e3){return db[_0x0932('0x3e')][_0x0932('0x4b')]({'where':{'membername':_0x3327e3[_0x0932('0x27')]},'individualHooks':!![]});}})[_0x0932('0xf')](function(){if(_0x3327e3){return _0x3327e3[_0x0932('0x56')]({'raw':!![]});}})['then'](function(_0x45a0de){if(_0x3327e3){if(_0x45a0de){var _0x9fe5d9=[];_0x3ef852=_0x45a0de;if(_0x3ef852[_0x0932('0x2f')]){for(var _0x4a4d87=0x0;_0x4a4d87<_0x3ef852[_0x0932('0x2f')];_0x4a4d87++){_0x9fe5d9[_0x0932('0x31')](db[_0x0932('0x3e')][_0x0932('0x57')]({'membername':_0x3327e3[_0x0932('0x27')],'UserId':_0x3327e3['id'],'queue_name':_0x3ef852[_0x4a4d87][_0x0932('0x27')],'VoiceQueueId':_0x3ef852[_0x4a4d87]['id'],'interface':_0x1ea6ab,'paused':_0x3327e3[_0x0932('0x50')]||![],'penalty':_0x3ef852[_0x4a4d87][_0x0932('0x58')]||0x0}));}return BPromise[_0x0932('0x48')](_0x9fe5d9);}}}})['then'](function(){if(_0x3327e3){return db['MemberReport'][_0x0932('0x47')]({'where':{'membername':_0x3327e3[_0x0932('0x27')],'exitAt':null}});}})[_0x0932('0xf')](function(_0x4d8e05){if(_0x3327e3){if(_0x4d8e05&&_0x4d8e05[_0x0932('0x2f')]){var _0x57fcbf=[];_0x4d8e05[_0x0932('0x4c')](function(_0x1da636){_0x57fcbf['push'](_0x1da636[_0x0932('0x38')]({'exitAt':moment()[_0x0932('0x2d')](_0x0932('0x2e'))}));});return BPromise[_0x0932('0x48')](_0x57fcbf);}}})[_0x0932('0xf')](function(_0x546a43){if(_0x3327e3){var _0x57f4a1=[];var _0x3b2571=[];var _0x38b8a9=utils[_0x0932('0x30')]();var _0x1b10db={'membername':_0x3327e3[_0x0932('0x27')],'interface':_0x1ea6ab,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3327e3[_0x0932('0x28')],'internal':_0x3327e3['internal']};_0x38b8a9[_0x0932('0x4c')](function(_0x13a558){_0x57f4a1['push'](_[_0x0932('0x59')]({'channel':_0x13a558,'type':'LOGIN','data1':_0x0932('0x5a'),'data2':_0x1ea6ab},_0x1b10db));if(_0x3327e3[_0x0932('0x50')]){_0x3b2571[_0x0932('0x31')](_[_0x0932('0x59')]({'channel':_0x13a558,'type':'PAUSE','data1':'LOGININPAUSE'},_0x1b10db));}});return db[_0x0932('0x2b')][_0x0932('0x37')](_0x57f4a1[_0x0932('0x5b')](_0x3b2571),{'individualHooks':!![]});}})[_0x0932('0xf')](function(){if(_0x3327e3){return _0x3327e3[_0x0932('0x38')]({'online':!![],'lastLoginAt':moment()[_0x0932('0x2d')](_0x0932('0x2e')),'voicePause':_0x3327e3['loginInPause']||![],'mailPause':_0x3327e3[_0x0932('0x50')]||![],'chatPause':_0x3327e3[_0x0932('0x50')]||![],'faxPause':_0x3327e3['loginInPause']||![],'smsPause':_0x3327e3[_0x0932('0x50')]||![],'openchannelPause':_0x3327e3['loginInPause']||![],'pauseType':_0x3327e3[_0x0932('0x50')]?_0x0932('0x5c'):null,'lastPauseAt':moment()[_0x0932('0x2d')](_0x0932('0x2e')),'interface':_0x1ea6ab});}})[_0x0932('0xf')](function(_0x5ea951){_0x431c4f(_0x5ea951);})[_0x0932('0x23')](function(_0x4c1848){_0x4410c9(_0x4a376b['error'](0x1f4,_0x4c1848['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 4918aae..8cff5f2 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 _0xcc98=['emit','removeListener','length','save','remove','update'];(function(_0x683723,_0x568943){var _0x1e4abe=function(_0x3f8bac){while(--_0x3f8bac){_0x683723['push'](_0x683723['shift']());}};_0x1e4abe(++_0x568943);}(_0xcc98,0xc3));var _0x8cc9=function(_0x59fc56,_0x5a3d40){_0x59fc56=_0x59fc56-0x0;var _0x3b29fe=_0xcc98[_0x59fc56];return _0x3b29fe;};'use strict';var UserEvents=require('./user.events');var events=[_0x8cc9('0x0'),_0x8cc9('0x1'),_0x8cc9('0x2')];function createListener(_0x508c1c,_0x1f3ff1){return function(_0x118253){_0x1f3ff1[_0x8cc9('0x3')](_0x508c1c,_0x118253);};}function removeListener(_0x51aeec,_0x57cb11){return function(){UserEvents[_0x8cc9('0x4')](_0x51aeec,_0x57cb11);};}exports['register']=function(_0x5d0298){for(var _0x8dbdea=0x0,_0x1cc028=events[_0x8cc9('0x5')];_0x8dbdea<_0x1cc028;_0x8dbdea++){var _0x2a8ece=events[_0x8dbdea];var _0x1636fa=createListener('user:'+_0x2a8ece,_0x5d0298);UserEvents['on'](_0x2a8ece,_0x1636fa);}}; \ No newline at end of file +var _0xdf14=['emit','removeListener','register','length','./user.events','save','remove','update'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xdf14,0x184));var _0x4df1=function(_0x15a54b,_0x4f7633){_0x15a54b=_0x15a54b-0x0;var _0x567ec7=_0xdf14[_0x15a54b];return _0x567ec7;};'use strict';var UserEvents=require(_0x4df1('0x0'));var events=[_0x4df1('0x1'),_0x4df1('0x2'),_0x4df1('0x3')];function createListener(_0x41d0c5,_0x1bbc38){return function(_0x1d2ab5){_0x1bbc38[_0x4df1('0x4')](_0x41d0c5,_0x1d2ab5);};}function removeListener(_0x575d58,_0xa9eda2){return function(){UserEvents[_0x4df1('0x5')](_0x575d58,_0xa9eda2);};}exports[_0x4df1('0x6')]=function(_0x157601){for(var _0x49c316=0x0,_0x4ba134=events[_0x4df1('0x7')];_0x49c316<_0x4ba134;_0x49c316++){var _0x2690ae=events[_0x49c316];var _0x394439=createListener('user:'+_0x2690ae,_0x157601);UserEvents['on'](_0x2690ae,_0x394439);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c4a4acd..c2f6f5f 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 _0xea0d=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xea0d,0x8d));var _0xdea0=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xea0d[_0x11a962];return _0x55d423;};'use strict';var multer=require(_0xdea0('0x0'));var util=require(_0xdea0('0x1'));var path=require(_0xdea0('0x2'));var timeout=require(_0xdea0('0x3'));var express=require(_0xdea0('0x4'));var router=express[_0xdea0('0x5')]();var auth=require(_0xdea0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdea0('0x7'));module[_0xdea0('0x8')]=router; \ No newline at end of file +var _0x3c4c=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x5568c7,_0x347ab8){var _0x47fec6=function(_0x25a692){while(--_0x25a692){_0x5568c7['push'](_0x5568c7['shift']());}};_0x47fec6(++_0x347ab8);}(_0x3c4c,0x192));var _0xc3c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3c4c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc3c4('0x0'));var util=require(_0xc3c4('0x1'));var path=require(_0xc3c4('0x2'));var timeout=require(_0xc3c4('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc3c4('0x4'));var config=require(_0xc3c4('0x5'));module[_0xc3c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e1a1047..5ea5662 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 _0xd8b0=['exports','sequelize'];(function(_0x2b7248,_0x17b24e){var _0x418838=function(_0x3fc27d){while(--_0x3fc27d){_0x2b7248['push'](_0x2b7248['shift']());}};_0x418838(++_0x17b24e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5b7b5d,_0xa2fdd0){var _0x10848c=function(_0x4de8af){while(--_0x4de8af){_0x5b7b5d['push'](_0x5b7b5d['shift']());}};_0x10848c(++_0xa2fdd0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 07ffa76..db0a64a 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 _0x7a44=['./userChatQueue.attributes','exports','UserChatQueue','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x2d71fe,_0xa7bc99){var _0x327458=function(_0x14972c){while(--_0x14972c){_0x2d71fe['push'](_0x2d71fe['shift']());}};_0x327458(++_0xa7bc99);}(_0x7a44,0x157));var _0x47a4=function(_0x232fc4,_0x3a10b3){_0x232fc4=_0x232fc4-0x0;var _0x4647b8=_0x7a44[_0x232fc4];return _0x4647b8;};'use strict';var _=require(_0x47a4('0x0'));var util=require(_0x47a4('0x1'));var logger=require(_0x47a4('0x2'))(_0x47a4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a4('0x4'));var rimraf=require(_0x47a4('0x5'));var config=require(_0x47a4('0x6'));var attributes=require(_0x47a4('0x7'));module[_0x47a4('0x8')]=function(_0x55f9b2,_0x2da81c){return _0x55f9b2['define'](_0x47a4('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x032e=['./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2a05bf,_0x55e3a4){var _0x38a62e=function(_0x28d868){while(--_0x28d868){_0x2a05bf['push'](_0x2a05bf['shift']());}};_0x38a62e(++_0x55e3a4);}(_0x032e,0x1cc));var _0xe032=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x032e[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe032('0x5'));var rimraf=require(_0xe032('0x6'));var config=require(_0xe032('0x7'));var attributes=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x43dc81,_0x20da91){return _0x43dc81['define'](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'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 08621d6..48f91fa 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 _0xac23=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0xac23,0x115));var _0x3ac2=function(_0x4a9771,_0x52429b){_0x4a9771=_0x4a9771-0x0;var _0x52e0ed=_0xac23[_0x4a9771];return _0x52e0ed;};'use strict';var _=require('lodash');var util=require(_0x3ac2('0x0'));var moment=require(_0x3ac2('0x1'));var BPromise=require(_0x3ac2('0x2'));var rs=require(_0x3ac2('0x3'));var fs=require('fs');var Redis=require(_0x3ac2('0x4'));var db=require(_0x3ac2('0x5'))['db'];var utils=require(_0x3ac2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ac2('0x7'));var jayson=require(_0x3ac2('0x8'));var client=jayson['client'][_0x3ac2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x285efc,_0xc6d1b5,_0x1f4961){return new BPromise(function(_0x21a815,_0x2495de){return client['request'](_0x285efc,_0x1f4961)['then'](function(_0xde055f){logger[_0x3ac2('0xa')](_0x3ac2('0xb'),_0xc6d1b5,_0x3ac2('0xc'));logger[_0x3ac2('0xd')](_0x3ac2('0xe'),_0xc6d1b5,_0x3ac2('0xc'),JSON['stringify'](_0xde055f));if(_0xde055f[_0x3ac2('0xf')]){if(_0xde055f[_0x3ac2('0xf')]['code']===0x1f4){logger[_0x3ac2('0xf')](_0x3ac2('0xb'),_0xc6d1b5,_0xde055f[_0x3ac2('0xf')][_0x3ac2('0x10')]);return _0x2495de(_0xde055f[_0x3ac2('0xf')][_0x3ac2('0x10')]);}logger[_0x3ac2('0xf')](_0x3ac2('0xb'),_0xc6d1b5,_0xde055f[_0x3ac2('0xf')][_0x3ac2('0x10')]);return _0x21a815(_0xde055f['error'][_0x3ac2('0x10')]);}else{logger[_0x3ac2('0xa')](_0x3ac2('0xb'),_0xc6d1b5,'request\x20sent');_0x21a815(_0xde055f[_0x3ac2('0x11')]['message']);}})['catch'](function(_0x2433b3){logger[_0x3ac2('0xf')]('UserChatQueue,\x20%s,\x20%s',_0xc6d1b5,_0x2433b3);_0x2495de(_0x2433b3);});});} \ No newline at end of file +var _0x5d1c=['debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x25fda9,_0x2530a4){var _0x425e63=function(_0x160676){while(--_0x160676){_0x25fda9['push'](_0x25fda9['shift']());}};_0x425e63(++_0x2530a4);}(_0x5d1c,0x74));var _0xc5d1=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x5d1c[_0x4a209a];return _0x4b3c20;};'use strict';var _=require(_0xc5d1('0x0'));var util=require(_0xc5d1('0x1'));var moment=require(_0xc5d1('0x2'));var BPromise=require(_0xc5d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5d1('0x4'));var db=require(_0xc5d1('0x5'))['db'];var utils=require(_0xc5d1('0x6'));var logger=require(_0xc5d1('0x7'))(_0xc5d1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5d1('0x9')][_0xc5d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59cb3d,_0x39a969,_0x2ca1e1){return new BPromise(function(_0xe36df2,_0x3aead9){return client[_0xc5d1('0xb')](_0x59cb3d,_0x2ca1e1)[_0xc5d1('0xc')](function(_0x16549e){logger[_0xc5d1('0xd')](_0xc5d1('0xe'),_0x39a969,_0xc5d1('0xf'));logger[_0xc5d1('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x39a969,'request\x20sent',JSON[_0xc5d1('0x11')](_0x16549e));if(_0x16549e[_0xc5d1('0x12')]){if(_0x16549e[_0xc5d1('0x12')][_0xc5d1('0x13')]===0x1f4){logger['error'](_0xc5d1('0xe'),_0x39a969,_0x16549e[_0xc5d1('0x12')][_0xc5d1('0x14')]);return _0x3aead9(_0x16549e[_0xc5d1('0x12')]['message']);}logger[_0xc5d1('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x39a969,_0x16549e[_0xc5d1('0x12')][_0xc5d1('0x14')]);return _0xe36df2(_0x16549e[_0xc5d1('0x12')][_0xc5d1('0x14')]);}else{logger[_0xc5d1('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x39a969,_0xc5d1('0xf'));_0xe36df2(_0x16549e[_0xc5d1('0x15')][_0xc5d1('0x14')]);}})['catch'](function(_0x2ea6ad){logger['error'](_0xc5d1('0xe'),_0x39a969,_0x2ea6ad);_0x3aead9(_0x2ea6ad);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1861e05..debfafb 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 _0xf20a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x568173,_0x1e5563){var _0x5b0c5c=function(_0x5e58ec){while(--_0x5e58ec){_0x568173['push'](_0x568173['shift']());}};_0x5b0c5c(++_0x1e5563);}(_0xf20a,0x1bf));var _0xaf20=function(_0x2553e2,_0x159da9){_0x2553e2=_0x2553e2-0x0;var _0x2ce43e=_0xf20a[_0x2553e2];return _0x2ce43e;};'use strict';var multer=require(_0xaf20('0x0'));var util=require(_0xaf20('0x1'));var path=require(_0xaf20('0x2'));var timeout=require(_0xaf20('0x3'));var express=require(_0xaf20('0x4'));var router=express[_0xaf20('0x5')]();var auth=require(_0xaf20('0x6'));var interaction=require(_0xaf20('0x7'));var config=require(_0xaf20('0x8'));module[_0xaf20('0x9')]=router; \ No newline at end of file +var _0x33f5=['../../config/environment','exports','multer','path','../../components/auth/service'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x33f5,0x106));var _0x533f=function(_0x1adc74,_0x3c38cb){_0x1adc74=_0x1adc74-0x0;var _0x140bfc=_0x33f5[_0x1adc74];return _0x140bfc;};'use strict';var multer=require(_0x533f('0x0'));var util=require('util');var path=require(_0x533f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x533f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x533f('0x3'));module[_0x533f('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f557511..288b998 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 _0x14a0=['STRING','exports','INTEGER'];(function(_0x5a4118,_0x1b8fbe){var _0x3e25a5=function(_0x3538b9){while(--_0x3538b9){_0x5a4118['push'](_0x5a4118['shift']());}};_0x3e25a5(++_0x1b8fbe);}(_0x14a0,0x8e));var _0x014a=function(_0x59f146,_0x5d6f3e){_0x59f146=_0x59f146-0x0;var _0x4cc4e9=_0x14a0[_0x59f146];return _0x4cc4e9;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'penalty':{'type':Sequelize[_0x014a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x014a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x014a('0x2')]}}; \ No newline at end of file +var _0xac4a=['exports','INTEGER','STRING','sequelize'];(function(_0x5ec6cf,_0x2e07c1){var _0x3c0943=function(_0x5dcccc){while(--_0x5dcccc){_0x5ec6cf['push'](_0x5ec6cf['shift']());}};_0x3c0943(++_0x2e07c1);}(_0xac4a,0x13f));var _0xaac4=function(_0x166a64,_0x3b6b6c){_0x166a64=_0x166a64-0x0;var _0x112534=_0xac4a[_0x166a64];return _0x112534;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'penalty':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaac4('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3dc9f55..63c1756 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 _0x854d=['request-promise','path','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x59db37,_0x14464c){var _0x3a4d97=function(_0x3e1094){while(--_0x3e1094){_0x59db37['push'](_0x59db37['shift']());}};_0x3a4d97(++_0x14464c);}(_0x854d,0x13a));var _0xd854=function(_0x30293a,_0x265438){_0x30293a=_0x30293a-0x0;var _0x2a8ff1=_0x854d[_0x30293a];return _0x2a8ff1;};'use strict';var _=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var logger=require(_0xd854('0x2'))(_0xd854('0x3'));var moment=require(_0xd854('0x4'));var BPromise=require('bluebird');var rp=require(_0xd854('0x5'));var fs=require('fs');var path=require(_0xd854('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd854('0x7'));module[_0xd854('0x8')]=function(_0x360a83,_0x2f22b4){return _0x360a83[_0xd854('0x9')]('UserFaxQueue',attributes,{'tableName':_0xd854('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ce=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','lodash'];(function(_0x54cfb7,_0x2663a3){var _0x1a966e=function(_0x465e10){while(--_0x465e10){_0x54cfb7['push'](_0x54cfb7['shift']());}};_0x1a966e(++_0x2663a3);}(_0x02ce,0x1ac));var _0xe02c=function(_0x50ff36,_0x5add38){_0x50ff36=_0x50ff36-0x0;var _0x536b54=_0x02ce[_0x50ff36];return _0x536b54;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var logger=require(_0xe02c('0x2'))('api');var moment=require(_0xe02c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe02c('0x4'));var fs=require('fs');var path=require(_0xe02c('0x5'));var rimraf=require(_0xe02c('0x6'));var config=require(_0xe02c('0x7'));var attributes=require(_0xe02c('0x8'));module[_0xe02c('0x9')]=function(_0x3f7436,_0x2b804f){return _0x3f7436[_0xe02c('0xa')]('UserFaxQueue',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 107c3b6..d2e2ae7 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 _0xe9f2=['request\x20sent','debug','error','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x5f1b8c,_0x54df5f){var _0x2d6867=function(_0x600ac6){while(--_0x600ac6){_0x5f1b8c['push'](_0x5f1b8c['shift']());}};_0x2d6867(++_0x54df5f);}(_0xe9f2,0xba));var _0x2e9f=function(_0x4edf77,_0x8fe608){_0x4edf77=_0x4edf77-0x0;var _0x395e25=_0xe9f2[_0x4edf77];return _0x395e25;};'use strict';var _=require(_0x2e9f('0x0'));var util=require(_0x2e9f('0x1'));var moment=require(_0x2e9f('0x2'));var BPromise=require(_0x2e9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9f('0x4'));var db=require(_0x2e9f('0x5'))['db'];var utils=require(_0x2e9f('0x6'));var logger=require(_0x2e9f('0x7'))('rpc');var config=require(_0x2e9f('0x8'));var jayson=require(_0x2e9f('0x9'));var client=jayson[_0x2e9f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ba82,_0x3264c8,_0x52f89e){return new BPromise(function(_0x545d7c,_0x2727d2){return client[_0x2e9f('0xb')](_0x20ba82,_0x52f89e)[_0x2e9f('0xc')](function(_0x5f3c66){logger[_0x2e9f('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3264c8,_0x2e9f('0xe'));logger[_0x2e9f('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3264c8,_0x2e9f('0xe'),JSON['stringify'](_0x5f3c66));if(_0x5f3c66[_0x2e9f('0x10')]){if(_0x5f3c66[_0x2e9f('0x10')]['code']===0x1f4){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);return _0x2727d2(_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);}logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x5f3c66['error']['message']);return _0x545d7c(_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);}else{logger[_0x2e9f('0xd')](_0x2e9f('0x11'),_0x3264c8,_0x2e9f('0xe'));_0x545d7c(_0x5f3c66[_0x2e9f('0x13')][_0x2e9f('0x12')]);}})['catch'](function(_0x4969f6){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x4969f6);_0x2727d2(_0x4969f6);});});} \ No newline at end of file +var _0x5e98=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird'];(function(_0x1c5fd8,_0x2e0884){var _0x26de4d=function(_0x3a6543){while(--_0x3a6543){_0x1c5fd8['push'](_0x1c5fd8['shift']());}};_0x26de4d(++_0x2e0884);}(_0x5e98,0x128));var _0x85e9=function(_0xcb481e,_0x4d6aa8){_0xcb481e=_0xcb481e-0x0;var _0x4c6fbd=_0x5e98[_0xcb481e];return _0x4c6fbd;};'use strict';var _=require('lodash');var util=require(_0x85e9('0x0'));var moment=require(_0x85e9('0x1'));var BPromise=require(_0x85e9('0x2'));var rs=require(_0x85e9('0x3'));var fs=require('fs');var Redis=require(_0x85e9('0x4'));var db=require(_0x85e9('0x5'))['db'];var utils=require(_0x85e9('0x6'));var logger=require(_0x85e9('0x7'))(_0x85e9('0x8'));var config=require(_0x85e9('0x9'));var jayson=require(_0x85e9('0xa'));var client=jayson[_0x85e9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174b2e,_0x536df3,_0x157c7d){return new BPromise(function(_0x272234,_0x1176a3){return client[_0x85e9('0xc')](_0x174b2e,_0x157c7d)[_0x85e9('0xd')](function(_0x220879){logger[_0x85e9('0xe')](_0x85e9('0xf'),_0x536df3,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x536df3,'request\x20sent',JSON[_0x85e9('0x10')](_0x220879));if(_0x220879[_0x85e9('0x11')]){if(_0x220879[_0x85e9('0x11')][_0x85e9('0x12')]===0x1f4){logger[_0x85e9('0x11')](_0x85e9('0xf'),_0x536df3,_0x220879[_0x85e9('0x11')][_0x85e9('0x13')]);return _0x1176a3(_0x220879[_0x85e9('0x11')]['message']);}logger[_0x85e9('0x11')](_0x85e9('0xf'),_0x536df3,_0x220879['error']['message']);return _0x272234(_0x220879[_0x85e9('0x11')][_0x85e9('0x13')]);}else{logger['info'](_0x85e9('0xf'),_0x536df3,_0x85e9('0x14'));_0x272234(_0x220879[_0x85e9('0x15')][_0x85e9('0x13')]);}})[_0x85e9('0x16')](function(_0x3013d9){logger[_0x85e9('0x11')](_0x85e9('0xf'),_0x536df3,_0x3013d9);_0x1176a3(_0x3013d9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ecee805..ebefa2c 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 _0x8cb0=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x2a4d1d,_0x564f4b){var _0x326ec6=function(_0x2c1d66){while(--_0x2c1d66){_0x2a4d1d['push'](_0x2a4d1d['shift']());}};_0x326ec6(++_0x564f4b);}(_0x8cb0,0x15e));var _0x08cb=function(_0x85cddf,_0x58e1bb){_0x85cddf=_0x85cddf-0x0;var _0xf447c9=_0x8cb0[_0x85cddf];return _0xf447c9;};'use strict';var multer=require(_0x08cb('0x0'));var util=require(_0x08cb('0x1'));var path=require(_0x08cb('0x2'));var timeout=require(_0x08cb('0x3'));var express=require(_0x08cb('0x4'));var router=express[_0x08cb('0x5')]();var auth=require(_0x08cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x08cb('0x7'));module[_0x08cb('0x8')]=router; \ No newline at end of file +var _0xfa49=['../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa49,0x1f4));var _0x9fa4=function(_0x5b40b8,_0x1568ef){_0x5b40b8=_0x5b40b8-0x0;var _0x2e983f=_0xfa49[_0x5b40b8];return _0x2e983f;};'use strict';var multer=require(_0x9fa4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9fa4('0x1'));var express=require('express');var router=express[_0x9fa4('0x2')]();var auth=require(_0x9fa4('0x3'));var interaction=require(_0x9fa4('0x4'));var config=require(_0x9fa4('0x5'));module[_0x9fa4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3c5356f..1855ce3 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0xb65f0c,_0xe60c57){var _0x2ff246=function(_0x7d191c){while(--_0x7d191c){_0xb65f0c['push'](_0xb65f0c['shift']());}};_0x2ff246(++_0xe60c57);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xaa37af,_0x9c97e7){var _0x56d335=function(_0x32ce3d){while(--_0x32ce3d){_0xaa37af['push'](_0xaa37af['shift']());}};_0x56d335(++_0x9c97e7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3599949..74a49bb 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 _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x25e6b4,_0x4f3b31){var _0x232f47=function(_0x48fe03){while(--_0x48fe03){_0x25e6b4['push'](_0x25e6b4['shift']());}};_0x232f47(++_0x4f3b31);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x67f6c5,_0x119ac6){var _0x1df8db=function(_0x1c289e){while(--_0x1c289e){_0x67f6c5['push'](_0x67f6c5['shift']());}};_0x1df8db(++_0x119ac6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','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 3851256..f94fdea 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 _0xd8a5=['../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14b1e9,_0xdef18c){var _0x132088=function(_0x17e3ba){while(--_0x17e3ba){_0x14b1e9['push'](_0x14b1e9['shift']());}};_0x132088(++_0xdef18c);}(_0xd8a5,0x160));var _0x5d8a=function(_0x210679,_0x56a758){_0x210679=_0x210679-0x0;var _0x4931bb=_0xd8a5[_0x210679];return _0x4931bb;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var moment=require(_0x5d8a('0x1'));var BPromise=require(_0x5d8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d8a('0x3'));var db=require(_0x5d8a('0x4'))['db'];var utils=require(_0x5d8a('0x5'));var logger=require(_0x5d8a('0x6'))(_0x5d8a('0x7'));var config=require(_0x5d8a('0x8'));var jayson=require(_0x5d8a('0x9'));var client=jayson[_0x5d8a('0xa')][_0x5d8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46ab34,_0x441fb9,_0x3514c5){return new BPromise(function(_0x32cd30,_0x579306){return client[_0x5d8a('0xc')](_0x46ab34,_0x3514c5)[_0x5d8a('0xd')](function(_0x46cbb2){logger[_0x5d8a('0xe')](_0x5d8a('0xf'),_0x441fb9,'request\x20sent');logger[_0x5d8a('0x10')](_0x5d8a('0x11'),_0x441fb9,_0x5d8a('0x12'),JSON[_0x5d8a('0x13')](_0x46cbb2));if(_0x46cbb2['error']){if(_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x15')]===0x1f4){logger['error'](_0x5d8a('0xf'),_0x441fb9,_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);return _0x579306(_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);}logger[_0x5d8a('0x14')](_0x5d8a('0xf'),_0x441fb9,_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);return _0x32cd30(_0x46cbb2[_0x5d8a('0x14')][_0x5d8a('0x16')]);}else{logger[_0x5d8a('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x441fb9,'request\x20sent');_0x32cd30(_0x46cbb2[_0x5d8a('0x17')][_0x5d8a('0x16')]);}})['catch'](function(_0x3d3505){logger[_0x5d8a('0x14')](_0x5d8a('0xf'),_0x441fb9,_0x3d3505);_0x579306(_0x3d3505);});});} \ No newline at end of file +var _0xf3d0=['http','request','then','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4e5f04,_0x42f942){var _0xd6b5e8=function(_0x53c925){while(--_0x53c925){_0x4e5f04['push'](_0x4e5f04['shift']());}};_0xd6b5e8(++_0x42f942);}(_0xf3d0,0x18e));var _0x0f3d=function(_0x3ef55b,_0x5942da){_0x3ef55b=_0x3ef55b-0x0;var _0x350391=_0xf3d0[_0x3ef55b];return _0x350391;};'use strict';var _=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var moment=require('moment');var BPromise=require(_0x0f3d('0x2'));var rs=require(_0x0f3d('0x3'));var fs=require('fs');var Redis=require(_0x0f3d('0x4'));var db=require(_0x0f3d('0x5'))['db'];var utils=require(_0x0f3d('0x6'));var logger=require(_0x0f3d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0f3d('0x8'));var client=jayson[_0x0f3d('0x9')][_0x0f3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d14c5,_0x2e168c,_0x2dbd7c){return new BPromise(function(_0x4246a8,_0x3fb2f8){return client[_0x0f3d('0xb')](_0x1d14c5,_0x2dbd7c)[_0x0f3d('0xc')](function(_0x3e9a5a){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x2e168c,'request\x20sent');logger[_0x0f3d('0xd')](_0x0f3d('0xe'),_0x2e168c,_0x0f3d('0xf'),JSON[_0x0f3d('0x10')](_0x3e9a5a));if(_0x3e9a5a['error']){if(_0x3e9a5a[_0x0f3d('0x11')][_0x0f3d('0x12')]===0x1f4){logger[_0x0f3d('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x2e168c,_0x3e9a5a[_0x0f3d('0x11')]['message']);return _0x3fb2f8(_0x3e9a5a[_0x0f3d('0x11')]['message']);}logger[_0x0f3d('0x11')](_0x0f3d('0x13'),_0x2e168c,_0x3e9a5a[_0x0f3d('0x11')][_0x0f3d('0x14')]);return _0x4246a8(_0x3e9a5a[_0x0f3d('0x11')]['message']);}else{logger[_0x0f3d('0x15')](_0x0f3d('0x13'),_0x2e168c,_0x0f3d('0xf'));_0x4246a8(_0x3e9a5a[_0x0f3d('0x16')][_0x0f3d('0x14')]);}})[_0x0f3d('0x17')](function(_0x17500d){logger[_0x0f3d('0x11')](_0x0f3d('0x13'),_0x2e168c,_0x17500d);_0x3fb2f8(_0x17500d);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 031578e..9825b1e 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 _0x7dbe=['Router','../../components/interaction/service','../../config/environment','exports','connect-timeout','express'];(function(_0x3ba626,_0x4b8c5d){var _0x2bc7a3=function(_0x5c23da){while(--_0x5c23da){_0x3ba626['push'](_0x3ba626['shift']());}};_0x2bc7a3(++_0x4b8c5d);}(_0x7dbe,0x8e));var _0xe7db=function(_0x5750da,_0x1cc5da){_0x5750da=_0x5750da-0x0;var _0x4ec4de=_0x7dbe[_0x5750da];return _0x4ec4de;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe7db('0x0'));var express=require(_0xe7db('0x1'));var router=express[_0xe7db('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7db('0x3'));var config=require(_0xe7db('0x4'));module[_0xe7db('0x5')]=router; \ No newline at end of file +var _0x8795=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x8795,0x14a));var _0x5879=function(_0x1d810c,_0x38dd3f){_0x1d810c=_0x1d810c-0x0;var _0x4eec7c=_0x8795[_0x1d810c];return _0x4eec7c;};'use strict';var multer=require(_0x5879('0x0'));var util=require(_0x5879('0x1'));var path=require(_0x5879('0x2'));var timeout=require(_0x5879('0x3'));var express=require(_0x5879('0x4'));var router=express[_0x5879('0x5')]();var auth=require(_0x5879('0x6'));var interaction=require(_0x5879('0x7'));var config=require(_0x5879('0x8'));module[_0x5879('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 27b9060..905d0b4 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0xb55a27,_0x1e1118){var _0x265fd4=function(_0x5c3642){while(--_0x5c3642){_0xb55a27['push'](_0xb55a27['shift']());}};_0x265fd4(++_0x1e1118);}(_0xe706,0xa3));var _0x6e70=function(_0x2a0dc9,_0x3802f4){_0x2a0dc9=_0x2a0dc9-0x0;var _0x198be1=_0xe706[_0x2a0dc9];return _0x198be1;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x27c902,_0x258c3d){var _0x2e135f=function(_0x272a2d){while(--_0x272a2d){_0x27c902['push'](_0x27c902['shift']());}};_0x2e135f(++_0x258c3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index c15bd57..069ea1c 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 _0xbf20=['rimraf','./userOpenchannelQueue.attributes','define','util','../../config/logger','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf20,0x193));var _0x0bf2=function(_0x11d4a0,_0x5bb6c9){_0x11d4a0=_0x11d4a0-0x0;var _0x43d6d4=_0xbf20[_0x11d4a0];return _0x43d6d4;};'use strict';var _=require('lodash');var util=require(_0x0bf2('0x0'));var logger=require(_0x0bf2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0bf2('0x2'));var rp=require(_0x0bf2('0x3'));var fs=require('fs');var path=require(_0x0bf2('0x4'));var rimraf=require(_0x0bf2('0x5'));var config=require('../../config/environment');var attributes=require(_0x0bf2('0x6'));module['exports']=function(_0x5eb033,_0x1ef358){return _0x5eb033[_0x0bf2('0x7')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17db=['UserOpenchannelQueue','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3fe10b,_0x2d5a04){var _0xcbcb5b=function(_0x138cb5){while(--_0x138cb5){_0x3fe10b['push'](_0x3fe10b['shift']());}};_0xcbcb5b(++_0x2d5a04);}(_0x17db,0xdd));var _0xb17d=function(_0x3322d7,_0x117a2d){_0x3322d7=_0x3322d7-0x0;var _0x1842de=_0x17db[_0x3322d7];return _0x1842de;};'use strict';var _=require(_0xb17d('0x0'));var util=require(_0xb17d('0x1'));var logger=require('../../config/logger')(_0xb17d('0x2'));var moment=require(_0xb17d('0x3'));var BPromise=require(_0xb17d('0x4'));var rp=require(_0xb17d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb17d('0x6'));var config=require(_0xb17d('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xb17d('0x8')]=function(_0x2deeb4,_0x23fa37){return _0x2deeb4[_0xb17d('0x9')](_0xb17d('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 38d1c5a..2528db0 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 _0x8afe=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x1bcef6,_0x46de25){var _0x1c49c2=function(_0x396a9f){while(--_0x396a9f){_0x1bcef6['push'](_0x1bcef6['shift']());}};_0x1c49c2(++_0x46de25);}(_0x8afe,0x1cb));var _0xe8af=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8afe[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xe8af('0x0'));var util=require(_0xe8af('0x1'));var moment=require(_0xe8af('0x2'));var BPromise=require(_0xe8af('0x3'));var rs=require(_0xe8af('0x4'));var fs=require('fs');var Redis=require(_0xe8af('0x5'));var db=require(_0xe8af('0x6'))['db'];var utils=require(_0xe8af('0x7'));var logger=require(_0xe8af('0x8'))('rpc');var config=require(_0xe8af('0x9'));var jayson=require(_0xe8af('0xa'));var client=jayson[_0xe8af('0xb')][_0xe8af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20aeea,_0x23e62c,_0x25ae19){return new BPromise(function(_0x296535,_0x4cf50c){return client[_0xe8af('0xd')](_0x20aeea,_0x25ae19)[_0xe8af('0xe')](function(_0x393427){logger['info'](_0xe8af('0xf'),_0x23e62c,_0xe8af('0x10'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x23e62c,_0xe8af('0x10'),JSON[_0xe8af('0x11')](_0x393427));if(_0x393427[_0xe8af('0x12')]){if(_0x393427['error']['code']===0x1f4){logger[_0xe8af('0x12')](_0xe8af('0xf'),_0x23e62c,_0x393427[_0xe8af('0x12')]['message']);return _0x4cf50c(_0x393427[_0xe8af('0x12')][_0xe8af('0x13')]);}logger[_0xe8af('0x12')](_0xe8af('0xf'),_0x23e62c,_0x393427[_0xe8af('0x12')]['message']);return _0x296535(_0x393427['error'][_0xe8af('0x13')]);}else{logger[_0xe8af('0x14')](_0xe8af('0xf'),_0x23e62c,_0xe8af('0x10'));_0x296535(_0x393427[_0xe8af('0x15')][_0xe8af('0x13')]);}})[_0xe8af('0x16')](function(_0x3f8700){logger[_0xe8af('0x12')](_0xe8af('0xf'),_0x23e62c,_0x3f8700);_0x4cf50c(_0x3f8700);});});} \ No newline at end of file +var _0xfe8a=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xfe8a,0x7b));var _0xafe8=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xfe8a[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0xafe8('0x0'));var util=require(_0xafe8('0x1'));var moment=require(_0xafe8('0x2'));var BPromise=require('bluebird');var rs=require(_0xafe8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafe8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xafe8('0x5'))('rpc');var config=require(_0xafe8('0x6'));var jayson=require(_0xafe8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x126565,_0x40d2ed,_0x3c21cb){return new BPromise(function(_0x371d9a,_0x4c0e10){return client[_0xafe8('0x8')](_0x126565,_0x3c21cb)[_0xafe8('0x9')](function(_0x11b58f){logger['info'](_0xafe8('0xa'),_0x40d2ed,_0xafe8('0xb'));logger[_0xafe8('0xc')](_0xafe8('0xd'),_0x40d2ed,_0xafe8('0xb'),JSON[_0xafe8('0xe')](_0x11b58f));if(_0x11b58f[_0xafe8('0xf')]){if(_0x11b58f[_0xafe8('0xf')][_0xafe8('0x10')]===0x1f4){logger[_0xafe8('0xf')](_0xafe8('0xa'),_0x40d2ed,_0x11b58f[_0xafe8('0xf')][_0xafe8('0x11')]);return _0x4c0e10(_0x11b58f[_0xafe8('0xf')][_0xafe8('0x11')]);}logger[_0xafe8('0xf')](_0xafe8('0xa'),_0x40d2ed,_0x11b58f[_0xafe8('0xf')][_0xafe8('0x11')]);return _0x371d9a(_0x11b58f[_0xafe8('0xf')]['message']);}else{logger['info'](_0xafe8('0xa'),_0x40d2ed,_0xafe8('0xb'));_0x371d9a(_0x11b58f['result'][_0xafe8('0x11')]);}})[_0xafe8('0x12')](function(_0x16737d){logger[_0xafe8('0xf')](_0xafe8('0xa'),_0x40d2ed,_0x16737d);_0x4c0e10(_0x16737d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 724ed61..a18a233 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 _0xb3bd=['isAuthenticated','index','get','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xb3bd,0x138));var _0xdb3b=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb3bd[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0xdb3b('0x0'));var util=require(_0xdb3b('0x1'));var path=require(_0xdb3b('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb3b('0x3'));var router=express[_0xdb3b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdb3b('0x5'));var config=require(_0xdb3b('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xdb3b('0x7')](),controller[_0xdb3b('0x8')]);router[_0xdb3b('0x9')](_0xdb3b('0xa'),auth['isAuthenticated'](),controller[_0xdb3b('0xb')]);router[_0xdb3b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdb3b('0xc')]);router['get'](_0xdb3b('0xd'),auth['isAuthenticated'](),controller[_0xdb3b('0xe')]);router[_0xdb3b('0x9')](_0xdb3b('0xf'),auth[_0xdb3b('0x7')](),controller[_0xdb3b('0x10')]);router[_0xdb3b('0x11')]('/',auth['isAuthenticated'](),controller[_0xdb3b('0x12')]);router[_0xdb3b('0x11')](_0xdb3b('0x13'),auth[_0xdb3b('0x7')](),controller[_0xdb3b('0x14')]);router[_0xdb3b('0x11')](_0xdb3b('0xd'),auth[_0xdb3b('0x7')](),controller[_0xdb3b('0x15')]);router[_0xdb3b('0x11')](_0xdb3b('0xf'),auth[_0xdb3b('0x7')](),controller['addResources']);router['put'](_0xdb3b('0x16'),auth['isAuthenticated'](),controller[_0xdb3b('0x17')]);router[_0xdb3b('0x18')]('/:id',auth[_0xdb3b('0x7')](),controller[_0xdb3b('0x19')]);router['delete'](_0xdb3b('0xd'),auth[_0xdb3b('0x7')](),controller[_0xdb3b('0x1a')]);router[_0xdb3b('0x18')](_0xdb3b('0xf'),auth['isAuthenticated'](),controller[_0xdb3b('0x1b')]);module[_0xdb3b('0x1c')]=router; \ No newline at end of file +var _0x5835=['get','isAuthenticated','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33b2dc,_0x3b50d0){var _0x2f49a3=function(_0x8b65a0){while(--_0x8b65a0){_0x33b2dc['push'](_0x33b2dc['shift']());}};_0x2f49a3(++_0x3b50d0);}(_0x5835,0x1c7));var _0x5583=function(_0x650d3d,_0x440085){_0x650d3d=_0x650d3d-0x0;var _0x46fb66=_0x5835[_0x650d3d];return _0x46fb66;};'use strict';var multer=require(_0x5583('0x0'));var util=require(_0x5583('0x1'));var path=require(_0x5583('0x2'));var timeout=require(_0x5583('0x3'));var express=require(_0x5583('0x4'));var router=express[_0x5583('0x5')]();var auth=require(_0x5583('0x6'));var interaction=require(_0x5583('0x7'));var config=require(_0x5583('0x8'));var controller=require('./userProfile.controller');router[_0x5583('0x9')]('/',auth[_0x5583('0xa')](),controller['index']);router[_0x5583('0x9')](_0x5583('0xb'),auth[_0x5583('0xa')](),controller[_0x5583('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5583('0xd')]);router['get'](_0x5583('0xe'),auth[_0x5583('0xa')](),controller[_0x5583('0xf')]);router['get'](_0x5583('0x10'),auth[_0x5583('0xa')](),controller[_0x5583('0x11')]);router[_0x5583('0x12')]('/',auth[_0x5583('0xa')](),controller[_0x5583('0x13')]);router[_0x5583('0x12')](_0x5583('0x14'),auth[_0x5583('0xa')](),controller[_0x5583('0x15')]);router[_0x5583('0x12')](_0x5583('0xe'),auth[_0x5583('0xa')](),controller[_0x5583('0x16')]);router[_0x5583('0x12')](_0x5583('0x10'),auth[_0x5583('0xa')](),controller['addResources']);router[_0x5583('0x17')](_0x5583('0x18'),auth[_0x5583('0xa')](),controller[_0x5583('0x19')]);router[_0x5583('0x1a')](_0x5583('0x18'),auth[_0x5583('0xa')](),controller[_0x5583('0x1b')]);router[_0x5583('0x1a')](_0x5583('0xe'),auth[_0x5583('0xa')](),controller['removeSections']);router[_0x5583('0x1a')](_0x5583('0x10'),auth['isAuthenticated'](),controller['removeResources']);module[_0x5583('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b3f2875..ca96509 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 _0x142c=['crudPermissions','join','getDataValue','sequelize','exports','STRING','name','setDataValue'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0x142c,0x163));var _0xc142=function(_0x5b5317,_0x2a49c4){_0x5b5317=_0x5b5317-0x0;var _0x3a212a=_0x142c[_0x5b5317];return _0x3a212a;};'use strict';var Sequelize=require(_0xc142('0x0'));module[_0xc142('0x1')]={'name':{'type':Sequelize[_0xc142('0x2')],'allowNull':![],'unique':_0xc142('0x3')},'crudPermissions':{'type':Sequelize[_0xc142('0x2')],'set':function(_0x3996b4){this[_0xc142('0x4')](_0xc142('0x5'),_0x3996b4?_0x3996b4[_0xc142('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xc142('0x7')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc142('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa244=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0xa244,0xf1));var _0x4a24=function(_0x1c57a5,_0x433064){_0x1c57a5=_0x1c57a5-0x0;var _0x3dadb9=_0xa244[_0x1c57a5];return _0x3dadb9;};'use strict';var Sequelize=require(_0x4a24('0x0'));module[_0x4a24('0x1')]={'name':{'type':Sequelize[_0x4a24('0x2')],'allowNull':![],'unique':_0x4a24('0x3')},'crudPermissions':{'type':Sequelize[_0x4a24('0x2')],'set':function(_0x2b8d0d){this[_0x4a24('0x4')](_0x4a24('0x5'),_0x2b8d0d?_0x2b8d0d[_0x4a24('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4a24('0x7')]('crudPermissions')[_0x4a24('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4a24('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1d29aef..f4c1fcf 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 _0x571e=['mergeResources','childModel','Sequelize','ValidationError','Invalid\x20section\x20\x27','parentSections','all','union','ignore','rawAttributes','VIRTUAL','field','AnalyticExtractedReport','associatedResources','foreignKey','default','reportId','DefaultReports','custom','CustomReports','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','VoiceQueues','inbound','QueueCampaigns','queue','VoiceQueue','chanspies','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','Agents','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','metrics','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','UserProfile','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','each','UserProfileResource','sectionId','userProfileId','Resources','update','destroy','describe','addSections','transaction','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','autoAssociation','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','section','undefined'];(function(_0xf3fb4e,_0x1f8665){var _0x561bdb=function(_0x2a538c){while(--_0x2a538c){_0xf3fb4e['push'](_0xf3fb4e['shift']());}};_0x561bdb(++_0x1f8665);}(_0x571e,0x16a));var _0xe571=function(_0x1b0ad2,_0x27bcc2){_0x1b0ad2=_0x1b0ad2-0x0;var _0xb57611=_0x571e[_0x1b0ad2];return _0xb57611;};'use strict';var pdf=require(_0xe571('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe571('0x1'));var jsonpatch=require(_0xe571('0x2'));var rp=require(_0xe571('0x3'));var moment=require('moment');var BPromise=require(_0xe571('0x4'));var Mustache=require(_0xe571('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe571('0x6'));var csv=require(_0xe571('0x7'));var ejs=require(_0xe571('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe571('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe571('0x7'));var querystring=require(_0xe571('0xa'));var Papa=require(_0xe571('0xb'));var Redis=require(_0xe571('0xc'));var authService=require(_0xe571('0xd'));var qs=require(_0xe571('0xe'));var as=require(_0xe571('0xf'));var hardwareService=require(_0xe571('0x10'));var logger=require(_0xe571('0x11'))(_0xe571('0x12'));var utils=require(_0xe571('0x13'));var config=require(_0xe571('0x14'));var db=require(_0xe571('0x15'))['db'];config[_0xe571('0x16')]=_['defaults'](config['redis'],{'host':_0xe571('0x17'),'port':0x18eb});var socket=require(_0xe571('0x18'))(new Redis(config[_0xe571('0x16')]));require(_0xe571('0x19'))[_0xe571('0x1a')](socket);function respondWithStatusCode(_0x2cd216,_0x27be00){_0x27be00=_0x27be00||0xcc;return function(_0x265b96){if(_0x265b96){return _0x2cd216[_0xe571('0x1b')](_0x27be00);}return _0x2cd216[_0xe571('0x1c')](_0x27be00)[_0xe571('0x1d')]();};}function respondWithResult(_0x39ec80,_0x2e04ad){_0x2e04ad=_0x2e04ad||0xc8;return function(_0x312ef1){if(_0x312ef1){return _0x39ec80[_0xe571('0x1c')](_0x2e04ad)[_0xe571('0x1e')](_0x312ef1);}};}function respondWithFilteredResult(_0x350dab,_0x2cda86){return function(_0x159ee3){if(_0x159ee3){var _0x2e4945=_0x159ee3[_0xe571('0x1f')],_0x27bac9=_0x2cda86[_0xe571('0x20')],_0x3f439d=_0x2cda86['offset']+_0x2cda86[_0xe571('0x21')],_0xd626f6;if(_0x3f439d>=_0x2e4945){_0x3f439d=_0x2e4945;_0xd626f6=0xc8;}else{_0xd626f6=0xce;}_0x350dab[_0xe571('0x1c')](_0xd626f6);return _0x350dab[_0xe571('0x22')](_0xe571('0x23'),_0x27bac9+'-'+_0x3f439d+'/'+_0x2e4945)[_0xe571('0x1e')](_0x159ee3);}return null;};}function patchUpdates(_0x13d3bb){return function(_0x37aaef){try{jsonpatch[_0xe571('0x24')](_0x37aaef,_0x13d3bb,!![]);}catch(_0x3a60ba){return BPromise[_0xe571('0x25')](_0x3a60ba);}return _0x37aaef[_0xe571('0x26')]();};}function saveUpdates(_0x4990a8,_0x5895d5){return function(_0x5015b2){if(_0x5015b2){return _0x5015b2['update'](_0x4990a8)[_0xe571('0x27')](function(_0xdf8b25){return _0xdf8b25;});}return null;};}function removeEntity(_0x179717,_0x232508){return function(_0x1efeb0){if(_0x1efeb0){return _0x1efeb0['destroy']()[_0xe571('0x27')](function(){_0x179717['status'](0xcc)[_0xe571('0x1d')]();});}};}function handleEntityNotFound(_0x1c1a1d,_0x46152e){return function(_0x1e58b6){if(!_0x1e58b6){_0x1c1a1d[_0xe571('0x1b')](0x194);}return _0x1e58b6;};}function handleError(_0x127e78,_0x34b2e2){_0x34b2e2=_0x34b2e2||0x1f4;return function(_0x148029){logger[_0xe571('0x28')](_0x148029[_0xe571('0x29')]);if(_0x148029[_0xe571('0x2a')]){delete _0x148029['name'];}_0x127e78[_0xe571('0x1c')](_0x34b2e2)[_0xe571('0x2b')](_0x148029);};}exports[_0xe571('0x2c')]=function(_0x374e74,_0x322243){var _0x2c40c6={},_0xc25801={},_0x8ba0a2={'count':0x0,'rows':[]};var _0x1f1a7d=_[_0xe571('0x2d')](db[_0xe571('0x2e')]['rawAttributes'],function(_0x17a154){return{'name':_0x17a154['fieldName'],'type':_0x17a154[_0xe571('0x2f')][_0xe571('0x30')]};});_0xc25801[_0xe571('0x31')]=_['map'](_0x1f1a7d,_0xe571('0x2a'));_0xc25801['query']=_[_0xe571('0x32')](_0x374e74[_0xe571('0x33')]);_0xc25801[_0xe571('0x34')]=_[_0xe571('0x35')](_0xc25801[_0xe571('0x31')],_0xc25801[_0xe571('0x33')]);_0x2c40c6['attributes']=_[_0xe571('0x35')](_0xc25801[_0xe571('0x31')],qs[_0xe571('0x36')](_0x374e74[_0xe571('0x33')][_0xe571('0x36')]));_0x2c40c6[_0xe571('0x37')]=_0x2c40c6[_0xe571('0x37')][_0xe571('0x38')]?_0x2c40c6[_0xe571('0x37')]:_0xc25801[_0xe571('0x31')];if(!_0x374e74['query'][_0xe571('0x39')](_0xe571('0x3a'))){_0x2c40c6[_0xe571('0x21')]=qs[_0xe571('0x21')](_0x374e74[_0xe571('0x33')][_0xe571('0x21')]);_0x2c40c6[_0xe571('0x20')]=qs['offset'](_0x374e74[_0xe571('0x33')][_0xe571('0x20')]);}_0x2c40c6[_0xe571('0x3b')]=qs[_0xe571('0x3c')](_0x374e74[_0xe571('0x33')][_0xe571('0x3c')]);_0x2c40c6[_0xe571('0x3d')]=qs[_0xe571('0x34')](_[_0xe571('0x3e')](_0x374e74['query'],_0xc25801[_0xe571('0x34')]),_0x1f1a7d);if(_0x374e74[_0xe571('0x33')][_0xe571('0x3f')]){_0x2c40c6[_0xe571('0x3d')]=_[_0xe571('0x40')](_0x2c40c6[_0xe571('0x3d')],{'$or':_[_0xe571('0x2d')](_0x1f1a7d,function(_0x3e67b9){if(_0x3e67b9[_0xe571('0x2f')]!=='VIRTUAL'){var _0x34a875={};_0x34a875[_0x3e67b9[_0xe571('0x2a')]]={'$like':'%'+_0x374e74['query'][_0xe571('0x3f')]+'%'};return _0x34a875;}})});}_0x2c40c6=_['merge']({},_0x2c40c6,_0x374e74[_0xe571('0x41')]);var _0x38a518={'where':_0x2c40c6['where']};return db[_0xe571('0x2e')][_0xe571('0x1f')](_0x38a518)[_0xe571('0x27')](function(_0x3f6249){_0x8ba0a2[_0xe571('0x1f')]=_0x3f6249;if(_0x374e74[_0xe571('0x33')][_0xe571('0x42')]){_0x2c40c6[_0xe571('0x43')]=[{'all':!![]}];}return db[_0xe571('0x2e')][_0xe571('0x44')](_0x2c40c6);})[_0xe571('0x27')](function(_0x5467d3){_0x8ba0a2[_0xe571('0x45')]=_0x5467d3;return _0x8ba0a2;})[_0xe571('0x27')](respondWithFilteredResult(_0x322243,_0x2c40c6))[_0xe571('0x46')](handleError(_0x322243,null));};exports[_0xe571('0x47')]=function(_0x2be118,_0x52d9d1){var _0x5e185f={'raw':![],'where':{'id':_0x2be118[_0xe571('0x48')]['id']}},_0x3ae62e={};_0x3ae62e[_0xe571('0x31')]=_[_0xe571('0x32')](db[_0xe571('0x2e')]['rawAttributes']);_0x3ae62e[_0xe571('0x33')]=_[_0xe571('0x32')](_0x2be118[_0xe571('0x33')]);_0x3ae62e['filters']=_[_0xe571('0x35')](_0x3ae62e[_0xe571('0x31')],_0x3ae62e[_0xe571('0x33')]);_0x5e185f[_0xe571('0x37')]=_[_0xe571('0x35')](_0x3ae62e['model'],qs[_0xe571('0x36')](_0x2be118[_0xe571('0x33')]['fields']));_0x5e185f['attributes']=_0x5e185f['attributes']['length']?_0x5e185f[_0xe571('0x37')]:_0x3ae62e['model'];if(_0x2be118[_0xe571('0x33')]['includeAll']){_0x5e185f['include']=[{'all':!![]}];}_0x5e185f=_['merge']({},_0x5e185f,_0x2be118[_0xe571('0x41')]);return db['UserProfile'][_0xe571('0x49')](_0x5e185f)[_0xe571('0x27')](handleEntityNotFound(_0x52d9d1,null))['then'](respondWithResult(_0x52d9d1,null))[_0xe571('0x46')](handleError(_0x52d9d1,null));};exports[_0xe571('0x4a')]=function(_0x49c3a5,_0x18f2ec){return db[_0xe571('0x2e')][_0xe571('0x4a')](_0x49c3a5[_0xe571('0x4b')],{})[_0xe571('0x27')](respondWithResult(_0x18f2ec,0xc9))[_0xe571('0x46')](handleError(_0x18f2ec,null));};exports[_0xe571('0x4c')]=function(_0x1bc14d,_0x2862ca){var _0x4d1c2f={'where':{'id':_0x1bc14d[_0xe571('0x48')]['id']}},_0x100a4f={};_0x100a4f['model']=_[_0xe571('0x32')](db[_0xe571('0x2e')]['rawAttributes']);_0x4d1c2f['attributes']=_[_0xe571('0x35')](_0x100a4f[_0xe571('0x31')],qs[_0xe571('0x36')](_0x1bc14d['query'][_0xe571('0x36')]));_0x4d1c2f[_0xe571('0x37')]=_0x4d1c2f[_0xe571('0x37')][_0xe571('0x38')]?_0x4d1c2f[_0xe571('0x37')]:_0x100a4f[_0xe571('0x31')];if(_0x1bc14d[_0xe571('0x33')]['includeAll']){_0x4d1c2f[_0xe571('0x43')]=[{'all':!![]}];}_0x4d1c2f=_[_0xe571('0x40')]({},_0x4d1c2f,_0x1bc14d['options']);return db[_0xe571('0x2e')][_0xe571('0x49')](_0x4d1c2f)['then'](handleEntityNotFound(_0x2862ca,null))['then'](function(_0x1f0984){if(_0x1f0984){var _0x54cacf=_0x1f0984[_0xe571('0x4d')]({'plain':!![]});_0x54cacf=qs[_0xe571('0x4e')](_0x54cacf,['id','createdAt','updatedAt','crudPermissions']);_0x1bc14d[_0xe571('0x4b')]=_[_0xe571('0x4e')](_0x1bc14d[_0xe571('0x4b')],['id',_0xe571('0x4f'),_0xe571('0x50')]);return db[_0xe571('0x51')]['transaction'](function(_0x50aa7e){return db[_0xe571('0x2e')][_0xe571('0x4a')](_[_0xe571('0x40')](_0x54cacf,_0x1bc14d[_0xe571('0x4b')]),{'include':_0x1bc14d[_0xe571('0x33')][_0xe571('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x50aa7e})[_0xe571('0x27')](function(_0x1dfee8){var _0x4572db=_0x1dfee8[_0xe571('0x4d')]({'plain':!![]});return db[_0xe571('0x52')][_0xe571('0x44')]({'where':{'userProfileId':_0x1bc14d[_0xe571('0x48')]['id']},'raw':!![]})[_0xe571('0x27')](function(_0x139f8c){if(_0x139f8c){return BPromise[_0xe571('0x53')](_0x139f8c,function(_0x1db1f8){return new BPromise(function(_0x26087a,_0x39ed2e){if(_0x1db1f8['autoAssociation']===null||_0x1db1f8['autoAssociation']===0x1)_0x26087a(null);return db[_0xe571('0x54')][_0xe571('0x44')]({'where':{'sectionId':_0x1db1f8['id']},'raw':!![]})['then'](function(_0x59b016){var _0x5eb33d=_['map'](_0x59b016,function(_0x4307f9){return qs[_0xe571('0x4e')](_0x4307f9,['id',_0xe571('0x4f'),_0xe571('0x50'),_0xe571('0x55')]);});_0x26087a(_0x5eb33d);})[_0xe571('0x46')](function(_0x143cd0){_0x39ed2e(_0x143cd0);});})[_0xe571('0x27')](function(_0x259f7b){var _0x29a143=qs[_0xe571('0x4e')](_0x1db1f8,['id',_0xe571('0x4f'),_0xe571('0x50')]);_0x29a143[_0xe571('0x56')]=_0x4572db['id'];if(_0x259f7b)_0x29a143[_0xe571('0x57')]=_0x259f7b;return _0x29a143;})[_0xe571('0x27')](function(_0x250245){return db['UserProfileSection'][_0xe571('0x4a')](_0x250245,{'include':[{'model':db[_0xe571('0x54')],'as':_0xe571('0x57')}],'raw':!![],'transaction':_0x50aa7e});});})[_0xe571('0x27')](function(){return _0x4572db;});}});});});}})[_0xe571('0x27')](respondWithResult(_0x2862ca,0xc9))['catch'](handleError(_0x2862ca,null));};exports[_0xe571('0x58')]=function(_0x117792,_0x476a2c){if(_0x117792[_0xe571('0x4b')]['id']){delete _0x117792[_0xe571('0x4b')]['id'];}return db[_0xe571('0x2e')]['find']({'where':{'id':_0x117792[_0xe571('0x48')]['id']}})[_0xe571('0x27')](handleEntityNotFound(_0x476a2c,null))[_0xe571('0x27')](saveUpdates(_0x117792['body'],null))[_0xe571('0x27')](respondWithResult(_0x476a2c,null))['catch'](handleError(_0x476a2c,null));};exports[_0xe571('0x59')]=function(_0x4b36f9,_0x4c9fa3){return db['UserProfile']['find']({'where':{'id':_0x4b36f9[_0xe571('0x48')]['id']}})[_0xe571('0x27')](handleEntityNotFound(_0x4c9fa3,null))[_0xe571('0x27')](removeEntity(_0x4c9fa3,null))[_0xe571('0x46')](handleError(_0x4c9fa3,null));};exports['describe']=function(_0x3688e9,_0x381b80){return db[_0xe571('0x2e')][_0xe571('0x5a')]()['then'](respondWithResult(_0x381b80,null))['catch'](handleError(_0x381b80,null));};exports[_0xe571('0x5b')]=function(_0x20845f,_0x207ce9){var _0x1f3213=_0x20845f['body'];return db['UserProfile']['find']({'where':{'id':_0x20845f[_0xe571('0x48')]['id']}})[_0xe571('0x27')](handleEntityNotFound(_0x207ce9,null))[_0xe571('0x27')](function(_0x567fec){if(_0x567fec){return db['sequelize'][_0xe571('0x5c')](function(_0xac0e62){return db[_0xe571('0x52')][_0xe571('0x59')]({'where':{'userProfileId':_0x20845f['params']['id'],'sectionId':_[_0xe571('0x2d')](_0x1f3213,function(_0x3a77c8){return _0x3a77c8[_0xe571('0x55')];})},'transaction':_0xac0e62})[_0xe571('0x27')](function(){var _0x1bd0ff=_[_0xe571('0x2d')](_0x1f3213,function(_0xb79ee2){_0xb79ee2['userProfileId']=_0x20845f[_0xe571('0x48')]['id'];return _0xb79ee2;});var _0x147860=[];return BPromise[_0xe571('0x53')](_0x1bd0ff,function(_0x10d02b){return db[_0xe571('0x52')]['create'](_0x10d02b,{'include':[{'model':db[_0xe571('0x54')],'as':_0xe571('0x57')}],'raw':!![],'transaction':_0xac0e62})[_0xe571('0x27')](function(_0x90382d){_0x147860[_0xe571('0x5d')](_0x90382d[_0xe571('0x4d')]({'plain':!![]}));});})[_0xe571('0x27')](function(){return _0x147860;});});});}})[_0xe571('0x27')](function(_0xd62c1a){return _0xd62c1a;})[_0xe571('0x27')](respondWithResult(_0x207ce9,null))[_0xe571('0x46')](handleError(_0x207ce9,null));};exports[_0xe571('0x5e')]=function(_0x4e8c23,_0x5be0be){var _0xab6e18;return db['UserProfile'][_0xe571('0x49')]({'where':{'id':_0x4e8c23['params']['id']},'attributes':['id',_0xe571('0x2a')]})[_0xe571('0x27')](handleEntityNotFound(_0x5be0be,null))[_0xe571('0x27')](function(_0xfcd48e){if(_0xfcd48e){_0xab6e18=_0xfcd48e;return db[_0xe571('0x52')][_0xe571('0x59')]({'where':{'userProfileId':_0x4e8c23[_0xe571('0x48')]['id'],'sectionId':_0x4e8c23[_0xe571('0x33')][_0xe571('0x5f')]}});}})[_0xe571('0x27')](function(){return _0xab6e18;})[_0xe571('0x27')](respondWithStatusCode(_0x5be0be,null))[_0xe571('0x46')](handleError(_0x5be0be,null));};exports[_0xe571('0x60')]=function(_0x470229,_0x1cc51f){var _0x56548a=[];var _0x1f5306=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x470229[_0xe571('0x48')]['id']},'raw':!![]})[_0xe571('0x27')](function(_0x2c7abb){_0x56548a=_[_0xe571('0x3f')](_0x2c7abb,function(_0x1e4bb8){return _0x1e4bb8['enabled']===0x1||_[_0xe571('0x61')]([0x3eb,0x709],_0x1e4bb8['sectionId']);});if(!_[_0xe571('0x62')](_0x56548a)){return _[_0xe571('0x2d')](_0x56548a,function(_0x32c1d8){return _0x32c1d8['sectionId'];});}else{return;}})[_0xe571('0x27')](function(_0x29ff1e){if(_0x29ff1e)_0x1f5306=_0x29ff1e;if(_[_0xe571('0x61')](_0x1f5306,0x64)){var _0x61c8cb=_[_0xe571('0x49')](_0x56548a,{'sectionId':0x64});return hasDefaultDashboard(_0x61c8cb)[_0xe571('0x27')](function(_0x355c25){return _[_0xe571('0x2d')](_0x56548a,function(_0x16aa69){if(_0x16aa69[_0xe571('0x55')]===0x64){_0x16aa69[_0xe571('0x63')]=_0x355c25;}return _0x16aa69;});});}else{return;}})[_0xe571('0x27')](function(_0x1da229){if(_0x1da229)_0x56548a=_0x1da229;if(_[_0xe571('0x61')](_0x1f5306,0x3eb)){var _0x1aa3d6=_[_0xe571('0x49')](_0x56548a,{'sectionId':0x3eb});return getCustomDashboards(_0x1aa3d6)[_0xe571('0x27')](function(_0x1c62d9){return _[_0xe571('0x2d')](_0x56548a,function(_0x5057ad){if(_0x1aa3d6[_0xe571('0x64')]){if(_0x5057ad[_0xe571('0x55')]===0x3eb){_0x5057ad[_0xe571('0x63')]=_0x1c62d9;}}else{if(_0x5057ad[_0xe571('0x55')]===0x64){_0x5057ad[_0xe571('0x63')]=_0x1c62d9;}}return _0x5057ad;});});}else{return;}})[_0xe571('0x27')](function(_0x5a4309){if(_0x5a4309)_0x56548a=_0x5a4309;if(_['includes'](_0x1f5306,0x709)){var _0x1d8cff=_[_0xe571('0x49')](_0x56548a,{'sectionId':0x709});return getPlugins(_0x1d8cff)['then'](function(_0x41b2ba){if(_0x1d8cff['enabled']){return _[_0xe571('0x2d')](_0x56548a,function(_0x50b220){if(_0x50b220[_0xe571('0x55')]===0x709){_0x50b220[_0xe571('0x63')]=_0x41b2ba;}return _0x50b220;});}else{var _0x4e1c13={'sectionId':0x76c,'enabled':0x1,'subsections':_0x41b2ba};var _0x36c56a=_[_0xe571('0x2d')](_0x56548a);_0x36c56a[_0xe571('0x5d')](_0x4e1c13);return _0x36c56a;}});}else{return;}})['then'](function(_0x2e8d44){if(_0x2e8d44)_0x56548a=_0x2e8d44;return _['filter'](_0x56548a,[_0xe571('0x64'),0x1]);})[_0xe571('0x27')](respondWithResult(_0x1cc51f,null))[_0xe571('0x46')](handleError(_0x1cc51f,null));};function hasDefaultDashboard(_0x3ad4d8){var _0x336bdb=[0x65];return new BPromise(function(_0x45e534,_0x47c51e){try{if(_0x3ad4d8[_0xe571('0x65')]){_0x45e534(_0x336bdb);}else{return db[_0xe571('0x54')][_0xe571('0x66')]({'where':{'sectionId':_0x3ad4d8['id']},'raw':!![]})[_0xe571('0x27')](function(_0x480529){_0x480529?_0x45e534(_0x336bdb):_0x45e534();});}}catch(_0x3e2435){_0x47c51e(_0x3e2435);}});}function getCustomDashboards(_0xc06c20){var _0x9697b0=[];return new BPromise(function(_0x101202,_0x14d8d4){try{if(_0xc06c20['autoAssociation']){return db['Dashboard'][_0xe571('0x44')]({'raw':!![]})['then'](function(_0x8ad624){_0x8ad624[_0xe571('0x67')](function(_0x49526c){_0x9697b0[_0xe571('0x5d')](_0x49526c['id']+0x1869f);});_0x101202(_0x9697b0);});}else{return db[_0xe571('0x54')]['findAll']({'where':{'sectionId':_0xc06c20['id']},'raw':!![]})[_0xe571('0x27')](function(_0x3d4760){_0x3d4760[_0xe571('0x67')](function(_0x267a3d){_0x9697b0[_0xe571('0x5d')](_0x267a3d[_0xe571('0x68')]+0x1869f);});_0x101202(_0x9697b0);});}}catch(_0x44d0c1){_0x14d8d4(_0x44d0c1);}});}function getPlugins(_0x14407c){var _0x2f1c97=[];return new BPromise(function(_0xe0e3a7,_0x28ac13){try{if(_0x14407c[_0xe571('0x65')]){return db[_0xe571('0x69')][_0xe571('0x44')]({'raw':!![]})[_0xe571('0x27')](function(_0x314552){_0x314552[_0xe571('0x67')](function(_0x582d94){_0x2f1c97['push'](_0x582d94['id']+0x15b38);});_0xe0e3a7(_0x2f1c97);});}else{return db[_0xe571('0x54')][_0xe571('0x44')]({'where':{'sectionId':_0x14407c['id']},'raw':!![]})[_0xe571('0x27')](function(_0x3a4a67){_0x3a4a67['forEach'](function(_0x5f3b36){_0x2f1c97[_0xe571('0x5d')](_0x5f3b36['resourceId']+0x15b38);});_0xe0e3a7(_0x2f1c97);});}}catch(_0x396d11){_0x28ac13(_0x396d11);}});}exports['addResources']=function(_0x36383f,_0x143c73){return db[_0xe571('0x2e')]['find']({'where':{'id':_0x36383f[_0xe571('0x48')]['id']}})[_0xe571('0x27')](handleEntityNotFound(_0x143c73,null))['then'](function(_0x1c4974){if(_0x1c4974){return db[_0xe571('0x51')][_0xe571('0x5c')](function(_0x58f475){return db[_0xe571('0x52')][_0xe571('0x44')]({'where':{'userProfileId':_0x36383f[_0xe571('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x188e26){if(_0x188e26){return db[_0xe571('0x52')][_0xe571('0x59')]({'where':{'userProfileId':_0x36383f[_0xe571('0x48')]['id'],'id':_[_0xe571('0x2d')](_0x188e26,function(_0x174dbb){return _0x174dbb['id'];})},'transaction':_0x58f475});}})[_0xe571('0x27')](function(_0x144cc2){var _0x104e5d=_[_0xe571('0x2d')](_0x36383f[_0xe571('0x4b')],function(_0x5712a5){_0x5712a5[_0xe571('0x56')]=_0x36383f[_0xe571('0x48')]['id'];return _0x5712a5;});return db['UserProfileSection'][_0xe571('0x6a')](_0x104e5d,{'raw':!![],'transaction':_0x58f475});})['then'](function(_0xcedd5e){var _0x35aba4=_[_0xe571('0x3f')](_[_0xe571('0x2d')](_0xcedd5e,function(_0x83af1e){return _0x83af1e[_0xe571('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x35aba4){return db[_0xe571('0x52')][_0xe571('0x44')]({'where':{'userProfileId':_0x36383f[_0xe571('0x48')]['id'],'sectionId':_[_0xe571('0x2d')](_0x35aba4,function(_0x3164c1){return _0x3164c1[_0xe571('0x55')];})},'attributes':['id',_0xe571('0x55')],'raw':!![]})[_0xe571('0x27')](function(_0x39ab6f){var _0x349d92=_['map'](_0x36383f[_0xe571('0x4b')],function(_0x3b6b9b){_0x3b6b9b[_0xe571('0x56')]=_0x36383f['params']['id'];return _0x3b6b9b;});return db[_0xe571('0x54')][_0xe571('0x6a')](_0x349d92,{'raw':!![],'transaction':_0x58f475});});}})['catch'](handleError(_0x143c73,null));});}})[_0xe571('0x27')](function(_0x5e9f37){var _0x444423=_[_0xe571('0x2d')](_0x5e9f37,function(_0x12546f){return _0x12546f[_0xe571('0x4d')]({'plain':!![]});});})[_0xe571('0x27')](respondWithResult(_0x143c73,null))[_0xe571('0x46')](handleError(_0x143c73,null));};exports[_0xe571('0x6b')]=function(_0x47a102,_0x287539,_0x3b50f2){return db[_0xe571('0x2e')][_0xe571('0x49')]({'where':{'id':_0x47a102[_0xe571('0x48')]['id']}})[_0xe571('0x27')](handleEntityNotFound(_0x287539,null))[_0xe571('0x27')](function(_0x8c53d6){if(_0x8c53d6){return _0x8c53d6['removeResources'](_0x47a102[_0xe571('0x33')]['ids']);}})[_0xe571('0x27')](respondWithStatusCode(_0x287539,null))['catch'](handleError(_0x287539,null));};exports['getResources']=function(_0x465bb8,_0x3a59ce){var _0x443eaf={'raw':![],'where':{}};var _0x323d79={};var _0x2b69eb={'count':0x0,'rows':[]};var _0x320c06=_0x465bb8[_0xe571('0x33')][_0xe571('0x6c')];if(typeof _0x320c06===_0xe571('0x6d')){throw new db['Sequelize']['ValidationError']('Unknown\x20section');}var _0x294344=_0x465bb8['query'][_0xe571('0x6e')]||![];var _0x17b7a0=getQueryModels(_0x320c06,_0x294344);if(typeof _0x17b7a0[_0xe571('0x6f')]===_0xe571('0x6d')){throw new db[(_0xe571('0x70'))][(_0xe571('0x71'))](_0xe571('0x72')+_0x320c06+'\x27');}var _0x456260=[];if(!_[_0xe571('0x62')](_0x17b7a0[_0xe571('0x73')])){_0x456260=_0x17b7a0[_0xe571('0x73')];}else{_0x456260=[{'name':_0x320c06}];}return db[_0xe571('0x2e')]['findOne']({'where':{'id':_0x465bb8[_0xe571('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a59ce,null))[_0xe571('0x27')](function(_0x2e0682){if(_0x2e0682){var _0x359663=[];for(var _0x23b2bb=0x0;_0x23b2bb<_0x456260[_0xe571('0x38')];_0x23b2bb++){_0x359663['push'](db[_0xe571('0x52')]['findOne']({'where':{'userProfileId':_0x2e0682['id'],'name':_0x456260[_0x23b2bb][_0xe571('0x2a')]},'raw':!![]}));}return BPromise[_0xe571('0x74')](_0x359663);}})['then'](function(_0x3e97c4){var _0x38dae7=_['filter'](_0x3e97c4,function(_0x254d85){return _0x254d85?_0x254d85:undefined;});var _0x438624=_[_0xe571('0x3f')](_0x456260,['ignore',!![]]);var _0x3265a3=_[_0xe571('0x62')](_0x38dae7)&&_[_0xe571('0x62')](_0x438624)?null:_[_0xe571('0x75')](_0x438624,_0x38dae7);if(_0x3265a3){var _0x5d50bc=[];for(var _0x5eba25=0x0;_0x5eba25<_0x3265a3[_0xe571('0x38')];_0x5eba25++){var _0x5502ae=_[_0xe571('0x49')](_0x456260,function(_0x5e51f5){return _0x3265a3[_0x5eba25]?_0x5e51f5[_0xe571('0x2a')]===_0x3265a3[_0x5eba25][_0xe571('0x2a')]:null;});if(_0x5502ae){if(_0x3265a3[_0x5eba25][_0xe571('0x76')]){_0x5d50bc[_0xe571('0x5d')](getAllResources(_0x17b7a0[_0xe571('0x6f')],_0x3265a3[_0x5eba25]));}else{if(!_0x3265a3[_0x5eba25][_0xe571('0x65')]){_0x5d50bc['push'](getAllowedResources(_0x5502ae,_0x3265a3[_0x5eba25],_0x17b7a0[_0xe571('0x6f')]));}else{if(_0x5502ae['model']){_0x5d50bc[_0xe571('0x5d')](getAllFilteredResources(_0x5502ae,_0x3265a3[_0x5eba25]));}}}}}return BPromise[_0xe571('0x74')](_0x5d50bc);}else{return null;}})[_0xe571('0x27')](function(_0x254de6){var _0x3abddf=_0x254de6;var _0x1e5882=null;if(_0x3abddf){_0x1e5882=_0x3abddf[_0xe571('0x38')]===0x1?_0x3abddf[0x0]:null;}if(_0x1e5882||_0x3abddf){var _0x2685f6=db[_0x17b7a0[_0xe571('0x6f')]][_0xe571('0x77')];_0x323d79[_0xe571('0x31')]=_['keys'](_0x2685f6);_0x323d79[_0xe571('0x33')]=_[_0xe571('0x32')](_0x465bb8[_0xe571('0x33')]);_0x323d79[_0xe571('0x34')]=_[_0xe571('0x35')](_0x323d79[_0xe571('0x31')],_0x323d79[_0xe571('0x33')]);_0x443eaf[_0xe571('0x37')]=_[_0xe571('0x35')](_0x323d79[_0xe571('0x31')],qs[_0xe571('0x36')](_0x465bb8[_0xe571('0x33')][_0xe571('0x36')]));_0x443eaf['attributes']=_0x443eaf[_0xe571('0x37')][_0xe571('0x38')]?_0x443eaf[_0xe571('0x37')]:_0x323d79[_0xe571('0x31')];if(!_0x465bb8[_0xe571('0x33')][_0xe571('0x39')](_0xe571('0x3a'))){_0x443eaf[_0xe571('0x21')]=qs[_0xe571('0x21')](_0x465bb8[_0xe571('0x33')][_0xe571('0x21')]);_0x443eaf['offset']=qs[_0xe571('0x20')](_0x465bb8[_0xe571('0x33')][_0xe571('0x20')]);}_0x443eaf[_0xe571('0x3b')]=qs[_0xe571('0x3c')](_0x465bb8[_0xe571('0x33')][_0xe571('0x3c')]);_0x443eaf[_0xe571('0x3d')]=qs['filters'](_[_0xe571('0x3e')](_0x465bb8['query'],_0x323d79[_0xe571('0x34')]));if(_0x465bb8['query'][_0xe571('0x3f')]){_0x443eaf[_0xe571('0x3d')]=_['merge'](_0x443eaf[_0xe571('0x3d')],{'$or':_[_0xe571('0x2d')](_0x2685f6,function(_0x366583){if(_0x366583[_0xe571('0x2f')]['key']!==_0xe571('0x78')){var _0x10516f={};_0x10516f[_0x366583[_0xe571('0x79')]]={'$like':'%'+_0x465bb8[_0xe571('0x33')]['filter']+'%'};return _0x10516f;}})});}var _0x47a731=[];if(_0x1e5882){var _0x194f7=_[_0xe571('0x49')](_0x456260,[_0xe571('0x2a'),_0x1e5882[_0xe571('0x2a')]]);if(_0x194f7[_0xe571('0x79')]){var _0x1c85b0={};if(_0x17b7a0[_0xe571('0x6f')]===_0xe571('0x7a')){_0x1c85b0[_0x194f7['foreignKey']]=_[_0xe571('0x2d')](_0x1e5882[_0xe571('0x7b')],'id');}else{_0x1c85b0[_0x194f7[_0xe571('0x7c')]]=_0x1e5882['associatedResources'];}_0x47a731[_0xe571('0x5d')](_0x1c85b0);}else{_0x443eaf[_0xe571('0x3d')]['id']=_0x1e5882['associatedResources'];}}else{for(var _0x579d68=0x0;_0x579d68<_0x3abddf[_0xe571('0x38')];_0x579d68++){var _0x194f7=_[_0xe571('0x49')](_0x456260,[_0xe571('0x2a'),_0x3abddf[_0x579d68][_0xe571('0x2a')]]);if(_0x194f7[_0xe571('0x79')]){var _0x1c85b0={};_0x1c85b0[_0x194f7[_0xe571('0x7c')]]=_0x3abddf[_0x579d68][_0xe571('0x7b')];_0x47a731[_0xe571('0x5d')](_0x1c85b0);}else{if(!_0x443eaf[_0xe571('0x3d')]['id'])_0x443eaf['where']['id']=[];_0x3abddf[_0x579d68][_0xe571('0x7b')][_0xe571('0x67')](function(_0x54be88){_0x443eaf[_0xe571('0x3d')]['id']['push'](_0x54be88);});}}}if(!_[_0xe571('0x62')](_0x47a731)){_0x443eaf['where']=_[_0xe571('0x40')](_0x443eaf[_0xe571('0x3d')],{'$and':{'$or':_0x47a731}});}_0x443eaf=_[_0xe571('0x40')]({},_0x443eaf,_0x465bb8['options']);if(_0x1e5882&&!_0x1e5882['autoAssociation']&&_0x17b7a0[_0xe571('0x6f')]===_0xe571('0x7a')){if(_0x465bb8[_0xe571('0x33')][_0xe571('0x42')]){_0x443eaf[_0xe571('0x43')]=[{'all':!![]}];}return db[_0x17b7a0[_0xe571('0x6f')]]['findAll'](_0x443eaf)[_0xe571('0x27')](function(_0x56d609){var _0x5c06dd=[];_0x56d609[_0xe571('0x67')](function(_0x1151eb){var _0x3d61c7;switch(_0x1151eb['reportType']){case _0xe571('0x7d'):_0x3d61c7=_['find'](_0x1e5882[_0xe571('0x7b')],function(_0xe42936){return _0xe42936['id']===_0x1151eb[_0xe571('0x7e')]&&_0xe42936[_0xe571('0x2f')]===_0xe571('0x7f');});break;case _0xe571('0x80'):_0x3d61c7=_[_0xe571('0x49')](_0x1e5882[_0xe571('0x7b')],function(_0x40fc77){return _0x40fc77['id']===_0x1151eb[_0xe571('0x7e')]&&_0x40fc77['type']===_0xe571('0x81');});break;}if(_0x3d61c7)_0x5c06dd[_0xe571('0x5d')](_0x1151eb);});_0x2b69eb['count']=_0x5c06dd[_0xe571('0x38')];_0x2b69eb[_0xe571('0x45')]=_0x5c06dd;return _0x2b69eb;});}else{return db[_0x17b7a0[_0xe571('0x6f')]][_0xe571('0x1f')]({'where':_0x443eaf[_0xe571('0x3d')]})['then'](function(_0x56edda){_0x2b69eb[_0xe571('0x1f')]=_0x56edda;if(_0x465bb8[_0xe571('0x33')]['includeAll']){if(_0x17b7a0[_0xe571('0x6f')]==='CmContact'){_0x443eaf[_0xe571('0x43')]=[{'model':db[_0xe571('0x82')],'as':_0xe571('0x83'),'attributes':['id',_0xe571('0x2a'),_0xe571('0x84')],'required':_0x465bb8[_0xe571('0x33')][_0xe571('0x85')]?!![]:![]},{'model':db[_0xe571('0x82')],'as':_0xe571('0x86'),'attributes':['id','name','color'],'through':_0x465bb8[_0xe571('0x33')][_0xe571('0x85')]?{'attributes':[],'where':{'TagId':_0x465bb8[_0xe571('0x33')][_0xe571('0x85')]||undefined}}:{},'required':_0x465bb8['query'][_0xe571('0x85')]?!![]:![]}];}else{_0x443eaf[_0xe571('0x43')]=[{'all':!![]}];}}return db[_0x17b7a0[_0xe571('0x6f')]]['findAll'](_0x443eaf);})[_0xe571('0x27')](function(_0x243092){_0x2b69eb['rows']=_0x243092;return _0x2b69eb;});}}else{return _0x2b69eb;}})['then'](respondWithFilteredResult(_0x3a59ce,_0x443eaf))[_0xe571('0x46')](handleError(_0x3a59ce,null));};function getAllResources(_0x33303e,_0x3dcd72){return new BPromise(function(_0x4fdd2a,_0x506472){if(_0x3dcd72){var _0x5c4db9=_0x3dcd72[_0xe571('0x3f')]?{[_0x3dcd72['filter'][_0xe571('0x79')]]:_0x3dcd72[_0xe571('0x3f')]['value']}:undefined;return db[_0x33303e][_0xe571('0x44')]({'where':_0x5c4db9,'raw':!![]})[_0xe571('0x27')](function(_0x572b13){_0x3dcd72[_0xe571('0x7b')]=_['map'](_0x572b13,'id');_0x4fdd2a(_0x3dcd72);})[_0xe571('0x46')](function(_0x65ef9e){_0x506472(_0x65ef9e);});}else{_0x4fdd2a(null);}});}function getAllFilteredResources(_0x47e4df,_0x53a123){return new BPromise(function(_0x41a958,_0x4f9041){var _0x41e578=_0x47e4df['filter']?{[_0x47e4df[_0xe571('0x3f')][_0xe571('0x79')]]:_0x47e4df[_0xe571('0x3f')][_0xe571('0x87')]}:undefined;return db[_0x47e4df[_0xe571('0x31')]][_0xe571('0x44')]({'where':_0x41e578,'raw':!![]})[_0xe571('0x27')](function(_0x2d6746){_0x53a123['associatedResources']=_[_0xe571('0x2d')](_0x2d6746,function(_0x183d6b){return _0x183d6b[_0xe571('0x2a')];});_0x41a958(_0x53a123);})['catch'](function(_0x104744){_0x4f9041(_0x104744);});});}function getAllowedResources(_0x5b3a34,_0x518e66,_0x3dd9de){return new BPromise(function(_0xabcf0e,_0x55a5cf){if(_0x518e66){return db[_0xe571('0x54')][_0xe571('0x44')]({'where':{'sectionId':_0x518e66['id']},'raw':!![]})[_0xe571('0x27')](function(_0x368078){if(_0x5b3a34['field']&&_0x5b3a34[_0xe571('0x79')]!=='id'){_0x518e66[_0xe571('0x7b')]=_[_0xe571('0x2d')](_0x368078,function(_0x3fdf7d){return _0x3fdf7d[_0x5b3a34[_0xe571('0x79')]];});}else{if(_0x3dd9de==='AnalyticExtractedReport'){_0x518e66['associatedResources']=_[_0xe571('0x2d')](_0x368078,function(_0x5395a0){return{'id':_0x5395a0['resourceId'],'type':_0x5395a0['type']};});}else{_0x518e66[_0xe571('0x7b')]=_[_0xe571('0x2d')](_0x368078,function(_0x2f4a02){return _0x2f4a02[_0xe571('0x68')];});}}_0xabcf0e(_0x518e66);})[_0xe571('0x46')](function(_0x2f3b67){_0x55a5cf(_0x2f3b67);});}else{_0xabcf0e(null);}});}function getQueryModels(_0x3bf22e,_0x3714c0){var _0x2c64db=_0x3bf22e[_0xe571('0x88')]();var _0x8f747d={'childModel':undefined,'parentSections':[]};switch(_0x2c64db){case _0xe571('0x89'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0x8a');break;case _0xe571('0x8b'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0x8c');break;case _0xe571('0x8d'):_0x8f747d[_0xe571('0x6f')]='SquareRecording';_0x8f747d[_0xe571('0x73')]=[{'name':_0xe571('0x8e'),'field':_0xe571('0x2a'),'foreignKey':_0xe571('0x8f')}];break;case'projects':_0x8f747d[_0xe571('0x6f')]=_0xe571('0x90');break;case'contacts':_0x8f747d[_0xe571('0x6f')]=_0xe571('0x91');_0x8f747d[_0xe571('0x73')]=[{'name':_0xe571('0x92'),'field':'id','foreignKey':_0xe571('0x93')}];break;case _0xe571('0x94'):_0x8f747d['childModel']=_0xe571('0x95');break;case'companies':_0x8f747d[_0xe571('0x6f')]=_0xe571('0x96');break;case _0xe571('0x97'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0x98');break;case _0xe571('0x99'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0x9a');break;case'chatwebsites':_0x8f747d['childModel']=_0xe571('0x9b');break;case'faxqueues':_0x8f747d['childModel']=_0xe571('0x9c');break;case _0xe571('0x9d'):_0x8f747d[_0xe571('0x6f')]='FaxAccount';break;case'inboundroutes':case _0xe571('0x9e'):case _0xe571('0x9f'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xa0');break;case _0xe571('0xa1'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xa2');break;case _0xe571('0xa3'):_0x8f747d['childModel']=_0xe571('0xa4');break;case _0xe571('0xa5'):_0x8f747d['childModel']=_0xe571('0xa6');_0x8f747d[_0xe571('0x73')]=[{'name':'Agents','field':_0xe571('0x2a'),'foreignKey':_0xe571('0xa7'),'model':_0xe571('0xa8'),'filter':{'field':_0xe571('0xa9'),'value':[_0xe571('0xaa')]}},{'name':_0xe571('0xab'),'field':_0xe571('0x2a'),'foreignKey':_0xe571('0xa7'),'model':_0xe571('0xa8'),'filter':{'field':_0xe571('0xa9'),'value':['telephone']}},{'name':_0xe571('0xac'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xe571('0xad')]}},{'name':_0xe571('0xae'),'field':_0xe571('0x2a'),'foreignKey':_0xe571('0xaf'),'model':_0xe571('0xb0'),'filter':{'field':_0xe571('0x2f'),'value':['outbound']}}];break;case'musiconholds':_0x8f747d[_0xe571('0x6f')]='VoiceMusicOnHold';break;case _0xe571('0xb1'):_0x8f747d[_0xe571('0x6f')]='VoiceChanSpy';break;case _0xe571('0xb2'):_0x8f747d[_0xe571('0x6f')]='VoicePrefix';break;case _0xe571('0xb3'):_0x8f747d['childModel']=_0xe571('0xb4');break;case'mailqueues':_0x8f747d[_0xe571('0x6f')]=_0xe571('0xb5');break;case _0xe571('0xb6'):_0x8f747d['childModel']=_0xe571('0xb7');break;case _0xe571('0xb8'):_0x8f747d[_0xe571('0x6f')]='MailSubstatus';break;case _0xe571('0xb9'):_0x8f747d['childModel']=_0xe571('0xba');break;case _0xe571('0xbb'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xbc');break;case _0xe571('0xbd'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xbe');break;case _0xe571('0xbf'):_0x8f747d[_0xe571('0x6f')]='SmsAccount';break;case'whatsappqueues':_0x8f747d['childModel']=_0xe571('0xc0');break;case _0xe571('0xc1'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xc2');break;case _0xe571('0xc3'):_0x8f747d['childModel']=_0xe571('0xc4');break;case _0xe571('0xc5'):case _0xe571('0xc6'):_0x8f747d['childModel']=_0xe571('0xb0');if(_0x3714c0){_0x8f747d[_0xe571('0x73')]=[{'name':_0xe571('0xac')},{'name':_0xe571('0xae')}];}break;case _0xe571('0xc7'):case _0xe571('0xc8'):case _0xe571('0xc9'):_0x8f747d['childModel']='User';if(_0x3714c0){_0x8f747d[_0xe571('0x73')]=[{'name':_0xe571('0xca'),'filter':{'field':'role','value':[_0xe571('0xcb'),'user']},'ignore':!![]},{'name':_0xe571('0xcc')},{'name':'Telephones'}];}break;case _0xe571('0xcd'):_0x8f747d['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x8f747d['childModel']=_0xe571('0xce');break;case _0xe571('0xcf'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xd0');break;case'sugarcrmaccounts':_0x8f747d[_0xe571('0x6f')]='SugarcrmAccount';break;case _0xe571('0xd1'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xd2');break;case _0xe571('0xd3'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xd4');break;case _0xe571('0xd5'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xa8');break;case _0xe571('0xd6'):_0x8f747d['childModel']='CannedAnswer';break;case _0xe571('0xd7'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xd8');break;case'customdashboards':_0x8f747d[_0xe571('0x6f')]=_0xe571('0xd9');break;case _0xe571('0xda'):_0x8f747d['childModel']='Interval';break;case _0xe571('0xdb'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xdc');break;case _0xe571('0xdd'):_0x8f747d['childModel']=_0xe571('0xde');break;case _0xe571('0xdf'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xe0');break;case _0xe571('0xe1'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0x82');break;case _0xe571('0xe2'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xe3');break;case'triggers':_0x8f747d[_0xe571('0x6f')]=_0xe571('0xe4');break;case _0xe571('0xe5'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xe6');break;case _0xe571('0xe7'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0xe8');break;case _0xe571('0xe9'):_0x8f747d[_0xe571('0x6f')]=_0xe571('0x69');break;case'extractedreports':_0x8f747d['childModel']='AnalyticExtractedReport';_0x8f747d[_0xe571('0x73')]=[{'name':_0xe571('0xea'),'field':'id','foreignKey':_0xe571('0x7e')}];break;case _0xe571('0xeb'):_0x8f747d[_0xe571('0x6f')]='AnalyticMetric';break;case _0xe571('0xc1'):_0x8f747d[_0xe571('0x6f')]='WhatsappAccount';break;default:return _0x8f747d;}return _0x8f747d;} \ No newline at end of file +var _0xf6be=['section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','isEmpty','parentSections','all','ignore','union','childModel','hasOwnProperty','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','color','tag','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','Lists','ListId','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','voicequeues','users','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','UserProfile','create','body','clone','find','get','omit','updatedAt','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','describe','addSections','sequelize','userProfileId','Resources','removeSections','ids','getSections','filter','enabled','includes','subsections','push','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources'];(function(_0x536d70,_0xa88ce3){var _0x455ed3=function(_0xaa6b){while(--_0xaa6b){_0x536d70['push'](_0x536d70['shift']());}};_0x455ed3(++_0xa88ce3);}(_0xf6be,0x15f));var _0xef6b=function(_0x110c54,_0xa3cfcb){_0x110c54=_0x110c54-0x0;var _0x58a348=_0xf6be[_0x110c54];return _0x58a348;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xef6b('0x0'));var zipdir=require(_0xef6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xef6b('0x2'));var Mustache=require(_0xef6b('0x3'));var util=require(_0xef6b('0x4'));var path=require(_0xef6b('0x5'));var sox=require('sox');var csv=require(_0xef6b('0x6'));var ejs=require(_0xef6b('0x7'));var fs=require('fs');var _=require(_0xef6b('0x8'));var squel=require(_0xef6b('0x9'));var crypto=require('crypto');var jsforce=require(_0xef6b('0xa'));var deskjs=require(_0xef6b('0xb'));var toCsv=require(_0xef6b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef6b('0xc'));var as=require(_0xef6b('0xd'));var hardwareService=require(_0xef6b('0xe'));var logger=require('../../config/logger')(_0xef6b('0xf'));var utils=require(_0xef6b('0x10'));var config=require('../../config/environment');var db=require(_0xef6b('0x11'))['db'];config['redis']=_[_0xef6b('0x12')](config['redis'],{'host':_0xef6b('0x13'),'port':0x18eb});var socket=require(_0xef6b('0x14'))(new Redis(config[_0xef6b('0x15')]));require(_0xef6b('0x16'))['register'](socket);function respondWithStatusCode(_0xb8421e,_0x51e0de){_0x51e0de=_0x51e0de||0xcc;return function(_0xc83c19){if(_0xc83c19){return _0xb8421e[_0xef6b('0x17')](_0x51e0de);}return _0xb8421e[_0xef6b('0x18')](_0x51e0de)['end']();};}function respondWithResult(_0x42a42b,_0x283d5f){_0x283d5f=_0x283d5f||0xc8;return function(_0x275078){if(_0x275078){return _0x42a42b['status'](_0x283d5f)['json'](_0x275078);}};}function respondWithFilteredResult(_0x2d9106,_0x3f24e1){return function(_0x5e5885){if(_0x5e5885){var _0x5237f4=_0x5e5885[_0xef6b('0x19')],_0x5302b8=_0x3f24e1[_0xef6b('0x1a')],_0x47a05f=_0x3f24e1[_0xef6b('0x1a')]+_0x3f24e1[_0xef6b('0x1b')],_0x20f9d6;if(_0x47a05f>=_0x5237f4){_0x47a05f=_0x5237f4;_0x20f9d6=0xc8;}else{_0x20f9d6=0xce;}_0x2d9106[_0xef6b('0x18')](_0x20f9d6);return _0x2d9106[_0xef6b('0x1c')](_0xef6b('0x1d'),_0x5302b8+'-'+_0x47a05f+'/'+_0x5237f4)[_0xef6b('0x1e')](_0x5e5885);}return null;};}function patchUpdates(_0x29b107){return function(_0x3eeb89){try{jsonpatch[_0xef6b('0x1f')](_0x3eeb89,_0x29b107,!![]);}catch(_0x2c1ffc){return BPromise['reject'](_0x2c1ffc);}return _0x3eeb89['save']();};}function saveUpdates(_0x52d622,_0x5b8d4f){return function(_0xf3230){if(_0xf3230){return _0xf3230[_0xef6b('0x20')](_0x52d622)[_0xef6b('0x21')](function(_0x68fd15){return _0x68fd15;});}return null;};}function removeEntity(_0x18cf23,_0x4abcb4){return function(_0x23ab8b){if(_0x23ab8b){return _0x23ab8b[_0xef6b('0x22')]()['then'](function(){_0x18cf23[_0xef6b('0x18')](0xcc)[_0xef6b('0x23')]();});}};}function handleEntityNotFound(_0x55baf5,_0x2938f0){return function(_0x26a86e){if(!_0x26a86e){_0x55baf5['sendStatus'](0x194);}return _0x26a86e;};}function handleError(_0x4aa4d7,_0x2d17f2){_0x2d17f2=_0x2d17f2||0x1f4;return function(_0x44daf5){logger[_0xef6b('0x24')](_0x44daf5['stack']);if(_0x44daf5[_0xef6b('0x25')]){delete _0x44daf5[_0xef6b('0x25')];}_0x4aa4d7['status'](_0x2d17f2)[_0xef6b('0x26')](_0x44daf5);};}exports[_0xef6b('0x27')]=function(_0x27b2e5,_0x1115d2){var _0x481eff={},_0x119be6={},_0x2fe132={'count':0x0,'rows':[]};var _0x58f0d8=_[_0xef6b('0x28')](db['UserProfile'][_0xef6b('0x29')],function(_0x1c0875){return{'name':_0x1c0875[_0xef6b('0x2a')],'type':_0x1c0875[_0xef6b('0x2b')][_0xef6b('0x2c')]};});_0x119be6['model']=_['map'](_0x58f0d8,_0xef6b('0x25'));_0x119be6['query']=_[_0xef6b('0x2d')](_0x27b2e5[_0xef6b('0x2e')]);_0x119be6['filters']=_['intersection'](_0x119be6[_0xef6b('0x2f')],_0x119be6[_0xef6b('0x2e')]);_0x481eff[_0xef6b('0x30')]=_[_0xef6b('0x31')](_0x119be6[_0xef6b('0x2f')],qs[_0xef6b('0x32')](_0x27b2e5[_0xef6b('0x2e')][_0xef6b('0x32')]));_0x481eff[_0xef6b('0x30')]=_0x481eff[_0xef6b('0x30')][_0xef6b('0x33')]?_0x481eff[_0xef6b('0x30')]:_0x119be6[_0xef6b('0x2f')];if(!_0x27b2e5[_0xef6b('0x2e')]['hasOwnProperty'](_0xef6b('0x34'))){_0x481eff[_0xef6b('0x1b')]=qs[_0xef6b('0x1b')](_0x27b2e5[_0xef6b('0x2e')]['limit']);_0x481eff[_0xef6b('0x1a')]=qs[_0xef6b('0x1a')](_0x27b2e5[_0xef6b('0x2e')][_0xef6b('0x1a')]);}_0x481eff[_0xef6b('0x35')]=qs['sort'](_0x27b2e5[_0xef6b('0x2e')][_0xef6b('0x36')]);_0x481eff[_0xef6b('0x37')]=qs['filters'](_[_0xef6b('0x38')](_0x27b2e5[_0xef6b('0x2e')],_0x119be6[_0xef6b('0x39')]),_0x58f0d8);if(_0x27b2e5[_0xef6b('0x2e')]['filter']){_0x481eff[_0xef6b('0x37')]=_[_0xef6b('0x3a')](_0x481eff[_0xef6b('0x37')],{'$or':_['map'](_0x58f0d8,function(_0x2a4c98){if(_0x2a4c98[_0xef6b('0x2b')]!==_0xef6b('0x3b')){var _0x36f999={};_0x36f999[_0x2a4c98[_0xef6b('0x25')]]={'$like':'%'+_0x27b2e5[_0xef6b('0x2e')]['filter']+'%'};return _0x36f999;}})});}_0x481eff=_[_0xef6b('0x3a')]({},_0x481eff,_0x27b2e5[_0xef6b('0x3c')]);var _0x570a7f={'where':_0x481eff[_0xef6b('0x37')]};return db['UserProfile'][_0xef6b('0x19')](_0x570a7f)[_0xef6b('0x21')](function(_0x2d96d8){_0x2fe132['count']=_0x2d96d8;if(_0x27b2e5['query'][_0xef6b('0x3d')]){_0x481eff[_0xef6b('0x3e')]=[{'all':!![]}];}return db['UserProfile'][_0xef6b('0x3f')](_0x481eff);})[_0xef6b('0x21')](function(_0x34975f){_0x2fe132[_0xef6b('0x40')]=_0x34975f;return _0x2fe132;})[_0xef6b('0x21')](respondWithFilteredResult(_0x1115d2,_0x481eff))[_0xef6b('0x41')](handleError(_0x1115d2,null));};exports[_0xef6b('0x42')]=function(_0x53d336,_0x202955){var _0x332fe6={'raw':![],'where':{'id':_0x53d336[_0xef6b('0x43')]['id']}},_0x153549={};_0x153549[_0xef6b('0x2f')]=_[_0xef6b('0x2d')](db[_0xef6b('0x44')]['rawAttributes']);_0x153549[_0xef6b('0x2e')]=_[_0xef6b('0x2d')](_0x53d336[_0xef6b('0x2e')]);_0x153549[_0xef6b('0x39')]=_['intersection'](_0x153549[_0xef6b('0x2f')],_0x153549['query']);_0x332fe6['attributes']=_[_0xef6b('0x31')](_0x153549[_0xef6b('0x2f')],qs[_0xef6b('0x32')](_0x53d336[_0xef6b('0x2e')][_0xef6b('0x32')]));_0x332fe6[_0xef6b('0x30')]=_0x332fe6['attributes'][_0xef6b('0x33')]?_0x332fe6['attributes']:_0x153549[_0xef6b('0x2f')];if(_0x53d336[_0xef6b('0x2e')]['includeAll']){_0x332fe6[_0xef6b('0x3e')]=[{'all':!![]}];}_0x332fe6=_[_0xef6b('0x3a')]({},_0x332fe6,_0x53d336[_0xef6b('0x3c')]);return db[_0xef6b('0x44')]['find'](_0x332fe6)[_0xef6b('0x21')](handleEntityNotFound(_0x202955,null))[_0xef6b('0x21')](respondWithResult(_0x202955,null))[_0xef6b('0x41')](handleError(_0x202955,null));};exports[_0xef6b('0x45')]=function(_0x1a21e7,_0x367ecb){return db['UserProfile'][_0xef6b('0x45')](_0x1a21e7[_0xef6b('0x46')],{})[_0xef6b('0x21')](respondWithResult(_0x367ecb,0xc9))[_0xef6b('0x41')](handleError(_0x367ecb,null));};exports[_0xef6b('0x47')]=function(_0x3591b1,_0xe8defb){var _0x263424={'where':{'id':_0x3591b1['params']['id']}},_0x3f113f={};_0x3f113f['model']=_['keys'](db['UserProfile'][_0xef6b('0x29')]);_0x263424[_0xef6b('0x30')]=_[_0xef6b('0x31')](_0x3f113f[_0xef6b('0x2f')],qs[_0xef6b('0x32')](_0x3591b1[_0xef6b('0x2e')]['fields']));_0x263424['attributes']=_0x263424[_0xef6b('0x30')][_0xef6b('0x33')]?_0x263424[_0xef6b('0x30')]:_0x3f113f[_0xef6b('0x2f')];if(_0x3591b1[_0xef6b('0x2e')][_0xef6b('0x3d')]){_0x263424['include']=[{'all':!![]}];}_0x263424=_[_0xef6b('0x3a')]({},_0x263424,_0x3591b1['options']);return db[_0xef6b('0x44')][_0xef6b('0x48')](_0x263424)[_0xef6b('0x21')](handleEntityNotFound(_0xe8defb,null))['then'](function(_0x4a120e){if(_0x4a120e){var _0x102288=_0x4a120e[_0xef6b('0x49')]({'plain':!![]});_0x102288=qs[_0xef6b('0x4a')](_0x102288,['id','createdAt',_0xef6b('0x4b'),'crudPermissions']);_0x3591b1[_0xef6b('0x46')]=_[_0xef6b('0x4a')](_0x3591b1[_0xef6b('0x46')],['id',_0xef6b('0x4c'),_0xef6b('0x4b')]);return db['sequelize'][_0xef6b('0x4d')](function(_0x7358d4){return db[_0xef6b('0x44')][_0xef6b('0x45')](_['merge'](_0x102288,_0x3591b1[_0xef6b('0x46')]),{'include':_0x3591b1['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x7358d4})['then'](function(_0x378798){var _0x1421f1=_0x378798['get']({'plain':!![]});return db[_0xef6b('0x4e')]['findAll']({'where':{'userProfileId':_0x3591b1[_0xef6b('0x43')]['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x508a99){if(_0x508a99){return BPromise[_0xef6b('0x4f')](_0x508a99,function(_0x458590){return new BPromise(function(_0x4b6089,_0x1febaa){if(_0x458590[_0xef6b('0x50')]===null||_0x458590['autoAssociation']===0x1)_0x4b6089(null);return db[_0xef6b('0x51')][_0xef6b('0x3f')]({'where':{'sectionId':_0x458590['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x407148){var _0x21fdbc=_['map'](_0x407148,function(_0x1f3ab6){return qs['omit'](_0x1f3ab6,['id',_0xef6b('0x4c'),_0xef6b('0x4b'),_0xef6b('0x52')]);});_0x4b6089(_0x21fdbc);})[_0xef6b('0x41')](function(_0x1c1d15){_0x1febaa(_0x1c1d15);});})['then'](function(_0x164b2c){var _0x16328e=qs[_0xef6b('0x4a')](_0x458590,['id',_0xef6b('0x4c'),_0xef6b('0x4b')]);_0x16328e['userProfileId']=_0x1421f1['id'];if(_0x164b2c)_0x16328e['Resources']=_0x164b2c;return _0x16328e;})[_0xef6b('0x21')](function(_0x57e093){return db['UserProfileSection'][_0xef6b('0x45')](_0x57e093,{'include':[{'model':db[_0xef6b('0x51')],'as':'Resources'}],'raw':!![],'transaction':_0x7358d4});});})['then'](function(){return _0x1421f1;});}});});});}})[_0xef6b('0x21')](respondWithResult(_0xe8defb,0xc9))[_0xef6b('0x41')](handleError(_0xe8defb,null));};exports['update']=function(_0x4fb630,_0x461f52){if(_0x4fb630[_0xef6b('0x46')]['id']){delete _0x4fb630[_0xef6b('0x46')]['id'];}return db[_0xef6b('0x44')][_0xef6b('0x48')]({'where':{'id':_0x4fb630[_0xef6b('0x43')]['id']}})['then'](handleEntityNotFound(_0x461f52,null))[_0xef6b('0x21')](saveUpdates(_0x4fb630[_0xef6b('0x46')],null))[_0xef6b('0x21')](respondWithResult(_0x461f52,null))['catch'](handleError(_0x461f52,null));};exports[_0xef6b('0x22')]=function(_0x5377de,_0x55380a){return db[_0xef6b('0x44')][_0xef6b('0x48')]({'where':{'id':_0x5377de[_0xef6b('0x43')]['id']}})['then'](handleEntityNotFound(_0x55380a,null))['then'](removeEntity(_0x55380a,null))[_0xef6b('0x41')](handleError(_0x55380a,null));};exports[_0xef6b('0x53')]=function(_0x1fe61f,_0x598fe4){return db[_0xef6b('0x44')][_0xef6b('0x53')]()[_0xef6b('0x21')](respondWithResult(_0x598fe4,null))[_0xef6b('0x41')](handleError(_0x598fe4,null));};exports[_0xef6b('0x54')]=function(_0x36d54a,_0x5c5e9b){var _0xf3aefa=_0x36d54a[_0xef6b('0x46')];return db[_0xef6b('0x44')][_0xef6b('0x48')]({'where':{'id':_0x36d54a[_0xef6b('0x43')]['id']}})[_0xef6b('0x21')](handleEntityNotFound(_0x5c5e9b,null))['then'](function(_0x586d60){if(_0x586d60){return db[_0xef6b('0x55')][_0xef6b('0x4d')](function(_0x3ff46f){return db[_0xef6b('0x4e')][_0xef6b('0x22')]({'where':{'userProfileId':_0x36d54a[_0xef6b('0x43')]['id'],'sectionId':_[_0xef6b('0x28')](_0xf3aefa,function(_0x1185a2){return _0x1185a2[_0xef6b('0x52')];})},'transaction':_0x3ff46f})['then'](function(){var _0x2860e8=_['map'](_0xf3aefa,function(_0x1cec3e){_0x1cec3e[_0xef6b('0x56')]=_0x36d54a[_0xef6b('0x43')]['id'];return _0x1cec3e;});var _0x47d335=[];return BPromise['each'](_0x2860e8,function(_0x9760c1){return db['UserProfileSection'][_0xef6b('0x45')](_0x9760c1,{'include':[{'model':db[_0xef6b('0x51')],'as':_0xef6b('0x57')}],'raw':!![],'transaction':_0x3ff46f})[_0xef6b('0x21')](function(_0x5645af){_0x47d335['push'](_0x5645af[_0xef6b('0x49')]({'plain':!![]}));});})[_0xef6b('0x21')](function(){return _0x47d335;});});});}})['then'](function(_0x769dd5){return _0x769dd5;})[_0xef6b('0x21')](respondWithResult(_0x5c5e9b,null))[_0xef6b('0x41')](handleError(_0x5c5e9b,null));};exports[_0xef6b('0x58')]=function(_0x57a089,_0x31cf81){var _0x4aa6ad;return db[_0xef6b('0x44')][_0xef6b('0x48')]({'where':{'id':_0x57a089[_0xef6b('0x43')]['id']},'attributes':['id',_0xef6b('0x25')]})[_0xef6b('0x21')](handleEntityNotFound(_0x31cf81,null))[_0xef6b('0x21')](function(_0x3ec011){if(_0x3ec011){_0x4aa6ad=_0x3ec011;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x57a089[_0xef6b('0x43')]['id'],'sectionId':_0x57a089['query'][_0xef6b('0x59')]}});}})[_0xef6b('0x21')](function(){return _0x4aa6ad;})['then'](respondWithStatusCode(_0x31cf81,null))[_0xef6b('0x41')](handleError(_0x31cf81,null));};exports[_0xef6b('0x5a')]=function(_0x559b7e,_0x3b9561){var _0x50bc83=[];var _0x47985a=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x559b7e[_0xef6b('0x43')]['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x537eb1){_0x50bc83=_[_0xef6b('0x5b')](_0x537eb1,function(_0x26c004){return _0x26c004[_0xef6b('0x5c')]===0x1||_[_0xef6b('0x5d')]([0x3eb,0x709],_0x26c004['sectionId']);});if(!_['isEmpty'](_0x50bc83)){return _[_0xef6b('0x28')](_0x50bc83,function(_0x3485d0){return _0x3485d0['sectionId'];});}else{return;}})[_0xef6b('0x21')](function(_0x2fb100){if(_0x2fb100)_0x47985a=_0x2fb100;if(_['includes'](_0x47985a,0x64)){var _0x220726=_[_0xef6b('0x48')](_0x50bc83,{'sectionId':0x64});return hasDefaultDashboard(_0x220726)[_0xef6b('0x21')](function(_0x53bd94){return _['map'](_0x50bc83,function(_0xedcb55){if(_0xedcb55[_0xef6b('0x52')]===0x64){_0xedcb55[_0xef6b('0x5e')]=_0x53bd94;}return _0xedcb55;});});}else{return;}})[_0xef6b('0x21')](function(_0x3bca86){if(_0x3bca86)_0x50bc83=_0x3bca86;if(_[_0xef6b('0x5d')](_0x47985a,0x3eb)){var _0xadeff9=_['find'](_0x50bc83,{'sectionId':0x3eb});return getCustomDashboards(_0xadeff9)[_0xef6b('0x21')](function(_0x2d7bfe){return _[_0xef6b('0x28')](_0x50bc83,function(_0x5aa3e4){if(_0xadeff9['enabled']){if(_0x5aa3e4['sectionId']===0x3eb){_0x5aa3e4[_0xef6b('0x5e')]=_0x2d7bfe;}}else{if(_0x5aa3e4[_0xef6b('0x52')]===0x64){_0x5aa3e4[_0xef6b('0x5e')]=_0x2d7bfe;}}return _0x5aa3e4;});});}else{return;}})['then'](function(_0x46eb48){if(_0x46eb48)_0x50bc83=_0x46eb48;if(_['includes'](_0x47985a,0x709)){var _0x28de00=_[_0xef6b('0x48')](_0x50bc83,{'sectionId':0x709});return getPlugins(_0x28de00)['then'](function(_0x5aa77e){if(_0x28de00[_0xef6b('0x5c')]){return _[_0xef6b('0x28')](_0x50bc83,function(_0x4c47fc){if(_0x4c47fc[_0xef6b('0x52')]===0x709){_0x4c47fc[_0xef6b('0x5e')]=_0x5aa77e;}return _0x4c47fc;});}else{var _0x33e66f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5aa77e};var _0x2af388=_[_0xef6b('0x28')](_0x50bc83);_0x2af388[_0xef6b('0x5f')](_0x33e66f);return _0x2af388;}});}else{return;}})[_0xef6b('0x21')](function(_0x539da5){if(_0x539da5)_0x50bc83=_0x539da5;return _['filter'](_0x50bc83,[_0xef6b('0x5c'),0x1]);})[_0xef6b('0x21')](respondWithResult(_0x3b9561,null))[_0xef6b('0x41')](handleError(_0x3b9561,null));};function hasDefaultDashboard(_0x40c8dc){var _0x55a354=[0x65];return new BPromise(function(_0x5b7235,_0x11a98c){try{if(_0x40c8dc['autoAssociation']){_0x5b7235(_0x55a354);}else{return db[_0xef6b('0x51')][_0xef6b('0x60')]({'where':{'sectionId':_0x40c8dc['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x43378f){_0x43378f?_0x5b7235(_0x55a354):_0x5b7235();});}}catch(_0x3d9a90){_0x11a98c(_0x3d9a90);}});}function getCustomDashboards(_0x3c43cc){var _0x5b8a78=[];return new BPromise(function(_0x485639,_0x14a76d){try{if(_0x3c43cc[_0xef6b('0x50')]){return db[_0xef6b('0x61')][_0xef6b('0x3f')]({'raw':!![]})[_0xef6b('0x21')](function(_0x58a734){_0x58a734[_0xef6b('0x62')](function(_0x3c4a5f){_0x5b8a78[_0xef6b('0x5f')](_0x3c4a5f['id']+0x1869f);});_0x485639(_0x5b8a78);});}else{return db[_0xef6b('0x51')]['findAll']({'where':{'sectionId':_0x3c43cc['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x22943f){_0x22943f[_0xef6b('0x62')](function(_0x43dc57){_0x5b8a78[_0xef6b('0x5f')](_0x43dc57['resourceId']+0x1869f);});_0x485639(_0x5b8a78);});}}catch(_0x1d5296){_0x14a76d(_0x1d5296);}});}function getPlugins(_0x293580){var _0x1567a8=[];return new BPromise(function(_0x31a8a7,_0x2ff449){try{if(_0x293580[_0xef6b('0x50')]){return db[_0xef6b('0x63')][_0xef6b('0x3f')]({'raw':!![]})[_0xef6b('0x21')](function(_0x5bb916){_0x5bb916[_0xef6b('0x62')](function(_0x55c3b0){_0x1567a8[_0xef6b('0x5f')](_0x55c3b0['id']+0x15b38);});_0x31a8a7(_0x1567a8);});}else{return db[_0xef6b('0x51')][_0xef6b('0x3f')]({'where':{'sectionId':_0x293580['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x48d541){_0x48d541['forEach'](function(_0xeec4ae){_0x1567a8[_0xef6b('0x5f')](_0xeec4ae[_0xef6b('0x64')]+0x15b38);});_0x31a8a7(_0x1567a8);});}}catch(_0x1305dd){_0x2ff449(_0x1305dd);}});}exports[_0xef6b('0x65')]=function(_0x5ea13f,_0x211183){return db[_0xef6b('0x44')][_0xef6b('0x48')]({'where':{'id':_0x5ea13f[_0xef6b('0x43')]['id']}})[_0xef6b('0x21')](handleEntityNotFound(_0x211183,null))[_0xef6b('0x21')](function(_0x12b6a3){if(_0x12b6a3){return db['sequelize'][_0xef6b('0x4d')](function(_0x4d17f4){return db['UserProfileSection'][_0xef6b('0x3f')]({'where':{'userProfileId':_0x5ea13f[_0xef6b('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0xef6b('0x21')](function(_0x54b7cb){if(_0x54b7cb){return db[_0xef6b('0x4e')]['destroy']({'where':{'userProfileId':_0x5ea13f[_0xef6b('0x43')]['id'],'id':_['map'](_0x54b7cb,function(_0x2cec01){return _0x2cec01['id'];})},'transaction':_0x4d17f4});}})['then'](function(_0x5454ff){var _0x4f01a0=_[_0xef6b('0x28')](_0x5ea13f[_0xef6b('0x46')],function(_0x1b9dd2){_0x1b9dd2[_0xef6b('0x56')]=_0x5ea13f[_0xef6b('0x43')]['id'];return _0x1b9dd2;});return db[_0xef6b('0x4e')][_0xef6b('0x66')](_0x4f01a0,{'raw':!![],'transaction':_0x4d17f4});})[_0xef6b('0x21')](function(_0x560c70){var _0x18d7b7=_[_0xef6b('0x5b')](_['map'](_0x560c70,function(_0x1fcb25){return _0x1fcb25['get']({'plain':!![]});}),{'includeAll':![]});if(_0x18d7b7){return db['UserProfileSection'][_0xef6b('0x3f')]({'where':{'userProfileId':_0x5ea13f[_0xef6b('0x43')]['id'],'sectionId':_[_0xef6b('0x28')](_0x18d7b7,function(_0x6891a){return _0x6891a['sectionId'];})},'attributes':['id',_0xef6b('0x52')],'raw':!![]})['then'](function(_0x277da4){var _0x82529b=_[_0xef6b('0x28')](_0x5ea13f['body'],function(_0x220bd0){_0x220bd0[_0xef6b('0x56')]=_0x5ea13f[_0xef6b('0x43')]['id'];return _0x220bd0;});return db['UserProfileResource']['bulkCreate'](_0x82529b,{'raw':!![],'transaction':_0x4d17f4});});}})[_0xef6b('0x41')](handleError(_0x211183,null));});}})[_0xef6b('0x21')](function(_0x2ceeeb){var _0x1e932d=_[_0xef6b('0x28')](_0x2ceeeb,function(_0x2c07a6){return _0x2c07a6[_0xef6b('0x49')]({'plain':!![]});});})[_0xef6b('0x21')](respondWithResult(_0x211183,null))[_0xef6b('0x41')](handleError(_0x211183,null));};exports[_0xef6b('0x67')]=function(_0x20033d,_0x436691,_0x1a9b7e){return db['UserProfile'][_0xef6b('0x48')]({'where':{'id':_0x20033d[_0xef6b('0x43')]['id']}})['then'](handleEntityNotFound(_0x436691,null))[_0xef6b('0x21')](function(_0x328235){if(_0x328235){return _0x328235[_0xef6b('0x67')](_0x20033d[_0xef6b('0x2e')][_0xef6b('0x59')]);}})[_0xef6b('0x21')](respondWithStatusCode(_0x436691,null))['catch'](handleError(_0x436691,null));};exports[_0xef6b('0x68')]=function(_0x124dab,_0x1ac7ca){var _0x23c715={'raw':![],'where':{}};var _0x1511c5={};var _0x95517b={'count':0x0,'rows':[]};var _0x25dc54=_0x124dab[_0xef6b('0x2e')][_0xef6b('0x69')];if(typeof _0x25dc54===_0xef6b('0x6a')){throw new db[(_0xef6b('0x6b'))][(_0xef6b('0x6c'))](_0xef6b('0x6d'));}var _0x22c590=_0x124dab[_0xef6b('0x2e')][_0xef6b('0x6e')]||![];var _0xa74dde=getQueryModels(_0x25dc54,_0x22c590);if(typeof _0xa74dde['childModel']===_0xef6b('0x6a')){throw new db[(_0xef6b('0x6b'))]['ValidationError']('Invalid\x20section\x20\x27'+_0x25dc54+'\x27');}var _0x6d0467=[];if(!_[_0xef6b('0x6f')](_0xa74dde[_0xef6b('0x70')])){_0x6d0467=_0xa74dde[_0xef6b('0x70')];}else{_0x6d0467=[{'name':_0x25dc54}];}return db[_0xef6b('0x44')][_0xef6b('0x60')]({'where':{'id':_0x124dab[_0xef6b('0x43')]['id']}})[_0xef6b('0x21')](handleEntityNotFound(_0x1ac7ca,null))[_0xef6b('0x21')](function(_0x13b0b5){if(_0x13b0b5){var _0xa7e659=[];for(var _0x57ef6c=0x0;_0x57ef6c<_0x6d0467[_0xef6b('0x33')];_0x57ef6c++){_0xa7e659['push'](db[_0xef6b('0x4e')]['findOne']({'where':{'userProfileId':_0x13b0b5['id'],'name':_0x6d0467[_0x57ef6c][_0xef6b('0x25')]},'raw':!![]}));}return BPromise[_0xef6b('0x71')](_0xa7e659);}})[_0xef6b('0x21')](function(_0xde7136){var _0x2b8c0f=_['filter'](_0xde7136,function(_0x36b385){return _0x36b385?_0x36b385:undefined;});var _0x324a53=_[_0xef6b('0x5b')](_0x6d0467,[_0xef6b('0x72'),!![]]);var _0x19fc9f=_[_0xef6b('0x6f')](_0x2b8c0f)&&_[_0xef6b('0x6f')](_0x324a53)?null:_[_0xef6b('0x73')](_0x324a53,_0x2b8c0f);if(_0x19fc9f){var _0x5a9fd2=[];for(var _0x2074b1=0x0;_0x2074b1<_0x19fc9f[_0xef6b('0x33')];_0x2074b1++){var _0x54fd2b=_[_0xef6b('0x48')](_0x6d0467,function(_0x3f0717){return _0x19fc9f[_0x2074b1]?_0x3f0717[_0xef6b('0x25')]===_0x19fc9f[_0x2074b1][_0xef6b('0x25')]:null;});if(_0x54fd2b){if(_0x19fc9f[_0x2074b1][_0xef6b('0x72')]){_0x5a9fd2[_0xef6b('0x5f')](getAllResources(_0xa74dde[_0xef6b('0x74')],_0x19fc9f[_0x2074b1]));}else{if(!_0x19fc9f[_0x2074b1][_0xef6b('0x50')]){_0x5a9fd2[_0xef6b('0x5f')](getAllowedResources(_0x54fd2b,_0x19fc9f[_0x2074b1],_0xa74dde['childModel']));}else{if(_0x54fd2b[_0xef6b('0x2f')]){_0x5a9fd2[_0xef6b('0x5f')](getAllFilteredResources(_0x54fd2b,_0x19fc9f[_0x2074b1]));}}}}}return BPromise[_0xef6b('0x71')](_0x5a9fd2);}else{return null;}})[_0xef6b('0x21')](function(_0xcd0cbd){var _0x266e9c=_0xcd0cbd;var _0xf332d3=null;if(_0x266e9c){_0xf332d3=_0x266e9c[_0xef6b('0x33')]===0x1?_0x266e9c[0x0]:null;}if(_0xf332d3||_0x266e9c){var _0x30352a=db[_0xa74dde[_0xef6b('0x74')]][_0xef6b('0x29')];_0x1511c5[_0xef6b('0x2f')]=_[_0xef6b('0x2d')](_0x30352a);_0x1511c5[_0xef6b('0x2e')]=_[_0xef6b('0x2d')](_0x124dab[_0xef6b('0x2e')]);_0x1511c5[_0xef6b('0x39')]=_[_0xef6b('0x31')](_0x1511c5[_0xef6b('0x2f')],_0x1511c5['query']);_0x23c715['attributes']=_[_0xef6b('0x31')](_0x1511c5[_0xef6b('0x2f')],qs[_0xef6b('0x32')](_0x124dab[_0xef6b('0x2e')][_0xef6b('0x32')]));_0x23c715[_0xef6b('0x30')]=_0x23c715[_0xef6b('0x30')][_0xef6b('0x33')]?_0x23c715['attributes']:_0x1511c5[_0xef6b('0x2f')];if(!_0x124dab[_0xef6b('0x2e')][_0xef6b('0x75')](_0xef6b('0x34'))){_0x23c715[_0xef6b('0x1b')]=qs[_0xef6b('0x1b')](_0x124dab[_0xef6b('0x2e')][_0xef6b('0x1b')]);_0x23c715['offset']=qs['offset'](_0x124dab[_0xef6b('0x2e')][_0xef6b('0x1a')]);}_0x23c715[_0xef6b('0x35')]=qs[_0xef6b('0x36')](_0x124dab['query'][_0xef6b('0x36')]);_0x23c715['where']=qs[_0xef6b('0x39')](_['pick'](_0x124dab[_0xef6b('0x2e')],_0x1511c5[_0xef6b('0x39')]));if(_0x124dab['query'][_0xef6b('0x5b')]){_0x23c715['where']=_[_0xef6b('0x3a')](_0x23c715[_0xef6b('0x37')],{'$or':_[_0xef6b('0x28')](_0x30352a,function(_0x46be05){if(_0x46be05[_0xef6b('0x2b')]['key']!==_0xef6b('0x3b')){var _0x4acb77={};_0x4acb77[_0x46be05[_0xef6b('0x76')]]={'$like':'%'+_0x124dab[_0xef6b('0x2e')][_0xef6b('0x5b')]+'%'};return _0x4acb77;}})});}var _0x28be5c=[];if(_0xf332d3){var _0x178822=_[_0xef6b('0x48')](_0x6d0467,['name',_0xf332d3[_0xef6b('0x25')]]);if(_0x178822[_0xef6b('0x76')]){var _0x5e92b1={};if(_0xa74dde['childModel']===_0xef6b('0x77')){_0x5e92b1[_0x178822[_0xef6b('0x78')]]=_[_0xef6b('0x28')](_0xf332d3[_0xef6b('0x79')],'id');}else{_0x5e92b1[_0x178822[_0xef6b('0x78')]]=_0xf332d3[_0xef6b('0x79')];}_0x28be5c[_0xef6b('0x5f')](_0x5e92b1);}else{_0x23c715[_0xef6b('0x37')]['id']=_0xf332d3[_0xef6b('0x79')];}}else{for(var _0x46a462=0x0;_0x46a462<_0x266e9c[_0xef6b('0x33')];_0x46a462++){var _0x178822=_[_0xef6b('0x48')](_0x6d0467,[_0xef6b('0x25'),_0x266e9c[_0x46a462]['name']]);if(_0x178822[_0xef6b('0x76')]){var _0x5e92b1={};_0x5e92b1[_0x178822['foreignKey']]=_0x266e9c[_0x46a462]['associatedResources'];_0x28be5c[_0xef6b('0x5f')](_0x5e92b1);}else{if(!_0x23c715[_0xef6b('0x37')]['id'])_0x23c715['where']['id']=[];_0x266e9c[_0x46a462][_0xef6b('0x79')][_0xef6b('0x62')](function(_0x198046){_0x23c715[_0xef6b('0x37')]['id'][_0xef6b('0x5f')](_0x198046);});}}}if(!_['isEmpty'](_0x28be5c)){_0x23c715[_0xef6b('0x37')]=_[_0xef6b('0x3a')](_0x23c715[_0xef6b('0x37')],{'$and':{'$or':_0x28be5c}});}_0x23c715=_[_0xef6b('0x3a')]({},_0x23c715,_0x124dab['options']);if(_0xf332d3&&!_0xf332d3[_0xef6b('0x50')]&&_0xa74dde[_0xef6b('0x74')]===_0xef6b('0x77')){if(_0x124dab[_0xef6b('0x2e')][_0xef6b('0x3d')]){_0x23c715[_0xef6b('0x3e')]=[{'all':!![]}];}return db[_0xa74dde[_0xef6b('0x74')]][_0xef6b('0x3f')](_0x23c715)[_0xef6b('0x21')](function(_0x5a9b97){var _0xc34966=[];_0x5a9b97[_0xef6b('0x62')](function(_0x23f32a){var _0x438618;switch(_0x23f32a[_0xef6b('0x7a')]){case'default':_0x438618=_['find'](_0xf332d3[_0xef6b('0x79')],function(_0x268ba8){return _0x268ba8['id']===_0x23f32a[_0xef6b('0x7b')]&&_0x268ba8[_0xef6b('0x2b')]===_0xef6b('0x7c');});break;case _0xef6b('0x7d'):_0x438618=_['find'](_0xf332d3[_0xef6b('0x79')],function(_0x56256d){return _0x56256d['id']===_0x23f32a[_0xef6b('0x7b')]&&_0x56256d[_0xef6b('0x2b')]===_0xef6b('0x7e');});break;}if(_0x438618)_0xc34966[_0xef6b('0x5f')](_0x23f32a);});_0x95517b[_0xef6b('0x19')]=_0xc34966['length'];_0x95517b[_0xef6b('0x40')]=_0xc34966;return _0x95517b;});}else{return db[_0xa74dde['childModel']]['count']({'where':_0x23c715[_0xef6b('0x37')]})[_0xef6b('0x21')](function(_0x467166){_0x95517b[_0xef6b('0x19')]=_0x467166;if(_0x124dab[_0xef6b('0x2e')][_0xef6b('0x3d')]){if(_0xa74dde[_0xef6b('0x74')]===_0xef6b('0x7f')){_0x23c715[_0xef6b('0x3e')]=[{'model':db[_0xef6b('0x80')],'as':'Tags','attributes':['id','name',_0xef6b('0x81')],'required':_0x124dab[_0xef6b('0x2e')][_0xef6b('0x82')]?!![]:![]},{'model':db[_0xef6b('0x80')],'as':'ThroughTags','attributes':['id',_0xef6b('0x25'),'color'],'through':_0x124dab[_0xef6b('0x2e')][_0xef6b('0x82')]?{'attributes':[],'where':{'TagId':_0x124dab[_0xef6b('0x2e')][_0xef6b('0x82')]||undefined}}:{},'required':_0x124dab[_0xef6b('0x2e')][_0xef6b('0x82')]?!![]:![]}];}else{_0x23c715[_0xef6b('0x3e')]=[{'all':!![]}];}}return db[_0xa74dde[_0xef6b('0x74')]][_0xef6b('0x3f')](_0x23c715);})[_0xef6b('0x21')](function(_0x567300){_0x95517b[_0xef6b('0x40')]=_0x567300;return _0x95517b;});}}else{return _0x95517b;}})[_0xef6b('0x21')](respondWithFilteredResult(_0x1ac7ca,_0x23c715))[_0xef6b('0x41')](handleError(_0x1ac7ca,null));};function getAllResources(_0x1b6996,_0x45d7c7){return new BPromise(function(_0x1ea8f5,_0x3aca8b){if(_0x45d7c7){var _0x51893f=_0x45d7c7[_0xef6b('0x5b')]?{[_0x45d7c7[_0xef6b('0x5b')][_0xef6b('0x76')]]:_0x45d7c7[_0xef6b('0x5b')][_0xef6b('0x83')]}:undefined;return db[_0x1b6996][_0xef6b('0x3f')]({'where':_0x51893f,'raw':!![]})['then'](function(_0x21a21c){_0x45d7c7['associatedResources']=_['map'](_0x21a21c,'id');_0x1ea8f5(_0x45d7c7);})[_0xef6b('0x41')](function(_0x1eccf6){_0x3aca8b(_0x1eccf6);});}else{_0x1ea8f5(null);}});}function getAllFilteredResources(_0x2d6bca,_0x44fc91){return new BPromise(function(_0x2aca82,_0x441323){var _0xba617e=_0x2d6bca['filter']?{[_0x2d6bca[_0xef6b('0x5b')][_0xef6b('0x76')]]:_0x2d6bca[_0xef6b('0x5b')]['value']}:undefined;return db[_0x2d6bca['model']][_0xef6b('0x3f')]({'where':_0xba617e,'raw':!![]})['then'](function(_0xddd981){_0x44fc91[_0xef6b('0x79')]=_['map'](_0xddd981,function(_0x522607){return _0x522607['name'];});_0x2aca82(_0x44fc91);})[_0xef6b('0x41')](function(_0x54b249){_0x441323(_0x54b249);});});}function getAllowedResources(_0x453892,_0x126730,_0x35499a){return new BPromise(function(_0x54a3b0,_0x2640d1){if(_0x126730){return db[_0xef6b('0x51')][_0xef6b('0x3f')]({'where':{'sectionId':_0x126730['id']},'raw':!![]})[_0xef6b('0x21')](function(_0x20f946){if(_0x453892[_0xef6b('0x76')]&&_0x453892[_0xef6b('0x76')]!=='id'){_0x126730[_0xef6b('0x79')]=_[_0xef6b('0x28')](_0x20f946,function(_0x178c09){return _0x178c09[_0x453892[_0xef6b('0x76')]];});}else{if(_0x35499a===_0xef6b('0x77')){_0x126730['associatedResources']=_[_0xef6b('0x28')](_0x20f946,function(_0x4c4e54){return{'id':_0x4c4e54[_0xef6b('0x64')],'type':_0x4c4e54[_0xef6b('0x2b')]};});}else{_0x126730['associatedResources']=_[_0xef6b('0x28')](_0x20f946,function(_0x2eda1e){return _0x2eda1e[_0xef6b('0x64')];});}}_0x54a3b0(_0x126730);})[_0xef6b('0x41')](function(_0xf67094){_0x2640d1(_0xf67094);});}else{_0x54a3b0(null);}});}function getQueryModels(_0xfbada1,_0x389d9a){var _0x331c38=_0xfbada1[_0xef6b('0x84')]();var _0x59dbb1={'childModel':undefined,'parentSections':[]};switch(_0x331c38){case _0xef6b('0x85'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x86');break;case _0xef6b('0x87'):_0x59dbb1[_0xef6b('0x74')]='SquareOdbc';break;case _0xef6b('0x88'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x89');_0x59dbb1['parentSections']=[{'name':'SquareProjects','field':_0xef6b('0x25'),'foreignKey':_0xef6b('0x8a')}];break;case _0xef6b('0x8b'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x8c');break;case _0xef6b('0x8d'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x7f');_0x59dbb1[_0xef6b('0x70')]=[{'name':_0xef6b('0x8e'),'field':'id','foreignKey':_0xef6b('0x8f')}];break;case'lists':_0x59dbb1[_0xef6b('0x74')]='CmList';break;case _0xef6b('0x90'):_0x59dbb1[_0xef6b('0x74')]='CmCompany';break;case'globalcustomfields':_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x91');break;case _0xef6b('0x92'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x93');break;case _0xef6b('0x94'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x95');break;case _0xef6b('0x96'):_0x59dbb1['childModel']=_0xef6b('0x97');break;case _0xef6b('0x98'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x99');break;case'inboundroutes':case'internalroutes':case _0xef6b('0x9a'):_0x59dbb1['childModel']='VoiceExtension';break;case _0xef6b('0x9b'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x9c');break;case _0xef6b('0x9d'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x9e');break;case _0xef6b('0x9f'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xa0');_0x59dbb1['parentSections']=[{'name':_0xef6b('0xa1'),'field':_0xef6b('0x25'),'foreignKey':'membername','model':_0xef6b('0xa2'),'filter':{'field':_0xef6b('0xa3'),'value':[_0xef6b('0xa4')]}},{'name':_0xef6b('0xa5'),'field':_0xef6b('0x25'),'foreignKey':_0xef6b('0xa6'),'model':'User','filter':{'field':'role','value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0xef6b('0xa7'),'model':_0xef6b('0xa8'),'filter':{'field':_0xef6b('0x2b'),'value':[_0xef6b('0xa9')]}},{'name':_0xef6b('0xaa'),'field':_0xef6b('0x25'),'foreignKey':_0xef6b('0xa7'),'model':_0xef6b('0xa8'),'filter':{'field':_0xef6b('0x2b'),'value':['outbound']}}];break;case _0xef6b('0xab'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xac');break;case _0xef6b('0xad'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xae');break;case _0xef6b('0xaf'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xb0');break;case _0xef6b('0xb1'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xb2');break;case _0xef6b('0xb3'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xb4');break;case _0xef6b('0xb5'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xb6');break;case _0xef6b('0xb7'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xb8');break;case _0xef6b('0xb9'):_0x59dbb1['childModel']=_0xef6b('0xba');break;case _0xef6b('0xbb'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xbc');break;case'smsqueues':_0x59dbb1['childModel']=_0xef6b('0xbd');break;case _0xef6b('0xbe'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xbf');break;case _0xef6b('0xc0'):_0x59dbb1[_0xef6b('0x74')]='WhatsappQueue';break;case _0xef6b('0xc1'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xc2');break;case'teams':_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xc3');break;case _0xef6b('0xc4'):case'queuecampaigns':_0x59dbb1[_0xef6b('0x74')]='VoiceQueue';if(_0x389d9a){_0x59dbb1[_0xef6b('0x70')]=[{'name':'VoiceQueues'},{'name':_0xef6b('0xaa')}];}break;case _0xef6b('0xc5'):case'agents':case'telephones':_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xa2');if(_0x389d9a){_0x59dbb1['parentSections']=[{'name':_0xef6b('0xc6'),'filter':{'field':_0xef6b('0xa3'),'value':[_0xef6b('0xc7'),_0xef6b('0xc8')]},'ignore':!![]},{'name':_0xef6b('0xa1')},{'name':_0xef6b('0xa5')}];}break;case _0xef6b('0xc9'):_0x59dbb1['childModel']=_0xef6b('0xca');break;case _0xef6b('0xcb'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xcc');break;case'freshdeskaccounts':_0x59dbb1[_0xef6b('0x74')]='FreshdeskAccount';break;case _0xef6b('0xcd'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xce');break;case'deskaccounts':_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xcf');break;case _0xef6b('0xd0'):_0x59dbb1['childModel']=_0xef6b('0xd1');break;case'vtigeraccounts':_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xa2');break;case _0xef6b('0xd2'):_0x59dbb1['childModel']='CannedAnswer';break;case _0xef6b('0xd3'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xd4');break;case _0xef6b('0xd5'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0x61');break;case _0xef6b('0xd6'):_0x59dbb1[_0xef6b('0x74')]='Interval';break;case _0xef6b('0xd7'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xd8');break;case _0xef6b('0xd9'):_0x59dbb1[_0xef6b('0x74')]='Schedule';break;case'sounds':_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xda');break;case _0xef6b('0xdb'):_0x59dbb1['childModel']='Tag';break;case _0xef6b('0xdc'):_0x59dbb1[_0xef6b('0x74')]='Template';break;case _0xef6b('0xdd'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xde');break;case _0xef6b('0xdf'):_0x59dbb1[_0xef6b('0x74')]=_0xef6b('0xe0');break;case _0xef6b('0xe1'):_0x59dbb1[_0xef6b('0x74')]='Variable';break;case _0xef6b('0xe2'):_0x59dbb1['childModel']=_0xef6b('0x63');break;case _0xef6b('0xe3'):_0x59dbb1['childModel']=_0xef6b('0x77');_0x59dbb1[_0xef6b('0x70')]=[{'name':'Reports','field':'id','foreignKey':_0xef6b('0x7b')}];break;case'metrics':_0x59dbb1[_0xef6b('0x74')]='AnalyticMetric';break;case _0xef6b('0xc1'):_0x59dbb1['childModel']=_0xef6b('0xc2');break;default:return _0x59dbb1;}return _0x59dbb1;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9ffaf48..58d096a 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 _0xd1de=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xd1de,0x193));var _0xed1d=function(_0x51a64b,_0x1fc0f3){_0x51a64b=_0x51a64b-0x0;var _0x26fbff=_0xd1de[_0x51a64b];return _0x26fbff;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xed1d('0x0'))['db'][_0xed1d('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xed1d('0x2')](0x0);var events={'afterCreate':_0xed1d('0x3'),'afterUpdate':_0xed1d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x15834e){return function(_0x5bb753,_0x1eab53,_0x1378c8){UserProfileEvents[_0xed1d('0x5')](_0x15834e+':'+_0x5bb753['id'],_0x5bb753);UserProfileEvents[_0xed1d('0x5')](_0x15834e,_0x5bb753);_0x1378c8(null);};}for(var e in events){if(events[_0xed1d('0x6')](e)){var event=events[e];UserProfile[_0xed1d('0x7')](e,emitEvent(event));}}module[_0xed1d('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xe0c3=['events','../../mysqldb','setMaxListeners','update','remove','emit','hook'];(function(_0x2ea969,_0x25a1ec){var _0xb93ffd=function(_0xcf3d85){while(--_0xcf3d85){_0x2ea969['push'](_0x2ea969['shift']());}};_0xb93ffd(++_0x25a1ec);}(_0xe0c3,0x1c0));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3e0c('0x0'));var UserProfile=require(_0x3e0c('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3e0c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e0c('0x3'),'afterDestroy':_0x3e0c('0x4')};function emitEvent(_0x1e9c1b){return function(_0x267454,_0x88f1af,_0x7d8f5a){UserProfileEvents[_0x3e0c('0x5')](_0x1e9c1b+':'+_0x267454['id'],_0x267454);UserProfileEvents[_0x3e0c('0x5')](_0x1e9c1b,_0x267454);_0x7d8f5a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x3e0c('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3b107c1..0e615d1 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 _0xbce8=['api','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','lodash','util','../../config/logger'];(function(_0x3eeab6,_0x1479dc){var _0x1873b9=function(_0x3afc87){while(--_0x3afc87){_0x3eeab6['push'](_0x3eeab6['shift']());}};_0x1873b9(++_0x1479dc);}(_0xbce8,0x110));var _0x8bce=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0xbce8[_0x575057];return _0x49dbc8;};'use strict';var _=require(_0x8bce('0x0'));var util=require(_0x8bce('0x1'));var logger=require(_0x8bce('0x2'))(_0x8bce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8bce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bce('0x5'));var config=require(_0x8bce('0x6'));var attributes=require(_0x8bce('0x7'));module[_0x8bce('0x8')]=function(_0x189436,_0x3a010f){return _0x189436[_0x8bce('0x9')](_0x8bce('0xa'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc984=['moment','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','lodash','util','api'];(function(_0x5b3ac2,_0x7f8408){var _0x3b3026=function(_0x3c3819){while(--_0x3c3819){_0x5b3ac2['push'](_0x5b3ac2['shift']());}};_0x3b3026(++_0x7f8408);}(_0xc984,0x1a1));var _0x4c98=function(_0x5c16e3,_0xa3f988){_0x5c16e3=_0x5c16e3-0x0;var _0xd6826d=_0xc984[_0x5c16e3];return _0xd6826d;};'use strict';var _=require(_0x4c98('0x0'));var util=require(_0x4c98('0x1'));var logger=require('../../config/logger')(_0x4c98('0x2'));var moment=require(_0x4c98('0x3'));var BPromise=require(_0x4c98('0x4'));var rp=require(_0x4c98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c98('0x6'));var config=require(_0x4c98('0x7'));var attributes=require(_0x4c98('0x8'));module[_0x4c98('0x9')]=function(_0x9b65e3,_0x459e6b){return _0x9b65e3[_0x4c98('0xa')]('UserProfile',attributes,{'tableName':_0x4c98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 837282d..eb83df7 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 _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x3acf13,_0x101871){var _0x4f5fa8=function(_0x5636dd){while(--_0x5636dd){_0x3acf13['push'](_0x3acf13['shift']());}};_0x4f5fa8(++_0x101871);}(_0x7c09,0x102));var _0x97c0=function(_0x67c53e,_0x5dfc62){_0x67c53e=_0x67c53e-0x0;var _0x210dd5=_0x7c09[_0x67c53e];return _0x210dd5;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x97c0('0x9')]=_[_0x97c0('0xa')](config[_0x97c0('0x9')],{'host':_0x97c0('0xb'),'port':0x18eb});var socket=require(_0x97c0('0xc'))(new Redis(config['redis']));require(_0x97c0('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d5507,_0x28cac4,_0x52bce2){return new BPromise(function(_0x50412f,_0x3ba42b){return client[_0x97c0('0xe')](_0x2d5507,_0x52bce2)[_0x97c0('0xf')](function(_0x238ed9){logger[_0x97c0('0x10')](_0x97c0('0x11'),_0x28cac4,_0x97c0('0x12'));logger[_0x97c0('0x13')](_0x97c0('0x14'),_0x28cac4,_0x97c0('0x12'),JSON[_0x97c0('0x15')](_0x238ed9));if(_0x238ed9[_0x97c0('0x16')]){if(_0x238ed9[_0x97c0('0x16')]['code']===0x1f4){logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x238ed9[_0x97c0('0x16')]['message']);return _0x3ba42b(_0x238ed9[_0x97c0('0x16')][_0x97c0('0x17')]);}logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x238ed9[_0x97c0('0x16')][_0x97c0('0x17')]);return _0x50412f(_0x238ed9['error'][_0x97c0('0x17')]);}else{logger[_0x97c0('0x10')]('UserProfile,\x20%s,\x20%s',_0x28cac4,_0x97c0('0x12'));_0x50412f(_0x238ed9[_0x97c0('0x18')][_0x97c0('0x17')]);}})[_0x97c0('0x19')](function(_0x183e2e){logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x183e2e);_0x3ba42b(_0x183e2e);});});} \ No newline at end of file +var _0x8958=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info'];(function(_0x147032,_0x9710b2){var _0x3be414=function(_0x1cf7ae){while(--_0x1cf7ae){_0x147032['push'](_0x147032['shift']());}};_0x3be414(++_0x9710b2);}(_0x8958,0x93));var _0x8895=function(_0x464f41,_0x37162c){_0x464f41=_0x464f41-0x0;var _0x110898=_0x8958[_0x464f41];return _0x110898;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});config[_0x8895('0x7')]=_[_0x8895('0x8')](config[_0x8895('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8895('0x9'))(new Redis(config[_0x8895('0x7')]));require(_0x8895('0xa'))[_0x8895('0xb')](socket);function respondWithRpcPromise(_0x6eab1e,_0x29c126,_0x22a12b){return new BPromise(function(_0xdb3d59,_0x46c467){return client[_0x8895('0xc')](_0x6eab1e,_0x22a12b)['then'](function(_0x1cf600){logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));logger[_0x8895('0x10')](_0x8895('0x11'),_0x29c126,'request\x20sent',JSON[_0x8895('0x12')](_0x1cf600));if(_0x1cf600[_0x8895('0x13')]){if(_0x1cf600[_0x8895('0x13')]['code']===0x1f4){logger['error'](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0x46c467(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0xdb3d59(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}else{logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));_0xdb3d59(_0x1cf600[_0x8895('0x15')][_0x8895('0x14')]);}})[_0x8895('0x16')](function(_0x2da618){logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x2da618);_0x46c467(_0x2da618);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c22bfe7..1aaaf8f 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 _0x77f0=['./userProfile.events','save','remove','update','removeListener','register','length'];(function(_0x307296,_0x49b881){var _0x32f975=function(_0x4ed150){while(--_0x4ed150){_0x307296['push'](_0x307296['shift']());}};_0x32f975(++_0x49b881);}(_0x77f0,0x181));var _0x077f=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x77f0[_0x40220a];return _0x3903cc;};'use strict';var UserProfileEvents=require(_0x077f('0x0'));var events=[_0x077f('0x1'),_0x077f('0x2'),_0x077f('0x3')];function createListener(_0x2fafdc,_0x10f1ee){return function(_0x468a32){_0x10f1ee['emit'](_0x2fafdc,_0x468a32);};}function removeListener(_0xf1f644,_0x2effba){return function(){UserProfileEvents[_0x077f('0x4')](_0xf1f644,_0x2effba);};}exports[_0x077f('0x5')]=function(_0x5c918a){for(var _0x31ab3b=0x0,_0x5934af=events[_0x077f('0x6')];_0x31ab3b<_0x5934af;_0x31ab3b++){var _0x1f25a9=events[_0x31ab3b];var _0x13d7a5=createListener('userProfile:'+_0x1f25a9,_0x5c918a);UserProfileEvents['on'](_0x1f25a9,_0x13d7a5);}}; \ No newline at end of file +var _0x0bdc=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x55ab21,_0x5dd62a){var _0x3d17d0=function(_0x5c1420){while(--_0x5c1420){_0x55ab21['push'](_0x55ab21['shift']());}};_0x3d17d0(++_0x5dd62a);}(_0x0bdc,0x13f));var _0xc0bd=function(_0x3ef964,_0x103cac){_0x3ef964=_0x3ef964-0x0;var _0x454097=_0x0bdc[_0x3ef964];return _0x454097;};'use strict';var UserProfileEvents=require(_0xc0bd('0x0'));var events=[_0xc0bd('0x1'),_0xc0bd('0x2'),_0xc0bd('0x3')];function createListener(_0x1c465e,_0x2f4e09){return function(_0x9a0daa){_0x2f4e09[_0xc0bd('0x4')](_0x1c465e,_0x9a0daa);};}function removeListener(_0x415857,_0x2b927b){return function(){UserProfileEvents[_0xc0bd('0x5')](_0x415857,_0x2b927b);};}exports[_0xc0bd('0x6')]=function(_0x5a7cc9){for(var _0x124b5c=0x0,_0x18017e=events[_0xc0bd('0x7')];_0x124b5c<_0x18017e;_0x124b5c++){var _0x187bd5=events[_0x124b5c];var _0x37e5a4=createListener(_0xc0bd('0x8')+_0x187bd5,_0x5a7cc9);UserProfileEvents['on'](_0x187bd5,_0x37e5a4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c8b4cbe..7944c1a 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 _0x68a5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','/:id','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3b07db,_0x4da958){var _0x585ee1=function(_0x5df07f){while(--_0x5df07f){_0x3b07db['push'](_0x3b07db['shift']());}};_0x585ee1(++_0x4da958);}(_0x68a5,0xfc));var _0x568a=function(_0x2c79ea,_0x5b0b4f){_0x2c79ea=_0x2c79ea-0x0;var _0x9ac050=_0x68a5[_0x2c79ea];return _0x9ac050;};'use strict';var multer=require(_0x568a('0x0'));var util=require('util');var path=require(_0x568a('0x1'));var timeout=require(_0x568a('0x2'));var express=require('express');var router=express[_0x568a('0x3')]();var auth=require(_0x568a('0x4'));var interaction=require(_0x568a('0x5'));var config=require(_0x568a('0x6'));var controller=require('./userProfileResource.controller');router[_0x568a('0x7')]('/',auth['isAuthenticated'](),controller[_0x568a('0x8')]);router[_0x568a('0x7')](_0x568a('0x9'),auth[_0x568a('0xa')](),controller['describe']);router[_0x568a('0x7')]('/:id',auth[_0x568a('0xa')](),controller[_0x568a('0xb')]);router[_0x568a('0xc')]('/',auth[_0x568a('0xa')](),controller['create']);router['put'](_0x568a('0xd'),auth[_0x568a('0xa')](),controller['update']);router[_0x568a('0xe')]('/:id',auth[_0x568a('0xa')](),controller[_0x568a('0xf')]);module[_0x568a('0x10')]=router; \ No newline at end of file +var _0xc924=['show','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x16ea29,_0x1b1bef){var _0x5b6c64=function(_0x183fcb){while(--_0x183fcb){_0x16ea29['push'](_0x16ea29['shift']());}};_0x5b6c64(++_0x1b1bef);}(_0xc924,0x136));var _0x4c92=function(_0x28f19c,_0x3db02){_0x28f19c=_0x28f19c-0x0;var _0x5f30ce=_0xc924[_0x28f19c];return _0x5f30ce;};'use strict';var multer=require(_0x4c92('0x0'));var util=require(_0x4c92('0x1'));var path=require(_0x4c92('0x2'));var timeout=require(_0x4c92('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4c92('0x4'));var interaction=require(_0x4c92('0x5'));var config=require(_0x4c92('0x6'));var controller=require(_0x4c92('0x7'));router[_0x4c92('0x8')]('/',auth[_0x4c92('0x9')](),controller[_0x4c92('0xa')]);router['get'](_0x4c92('0xb'),auth['isAuthenticated'](),controller[_0x4c92('0xc')]);router[_0x4c92('0x8')](_0x4c92('0xd'),auth['isAuthenticated'](),controller[_0x4c92('0xe')]);router['post']('/',auth[_0x4c92('0x9')](),controller['create']);router['put'](_0x4c92('0xd'),auth[_0x4c92('0x9')](),controller[_0x4c92('0xf')]);router['delete'](_0x4c92('0xd'),auth[_0x4c92('0x9')](),controller[_0x4c92('0x10')]);module[_0x4c92('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 614d668..0a43a82 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 _0xdf2f=['sequelize','INTEGER','STRING'];(function(_0x466cde,_0x21a405){var _0x9a96f7=function(_0xf26d0a){while(--_0xf26d0a){_0x466cde['push'](_0x466cde['shift']());}};_0x9a96f7(++_0x21a405);}(_0xdf2f,0x156));var _0xfdf2=function(_0x2d4dc8,_0x591909){_0x2d4dc8=_0x2d4dc8-0x0;var _0x2ee36c=_0xdf2f[_0x2d4dc8];return _0x2ee36c;};'use strict';var Sequelize=require(_0xfdf2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xfdf2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfdf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x16ff=['sequelize','STRING','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x16ff,0x13e));var _0xf16f=function(_0x1d5806,_0x378220){_0x1d5806=_0x1d5806-0x0;var _0x428dcc=_0x16ff[_0x1d5806];return _0x428dcc;};'use strict';var Sequelize=require(_0xf16f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf16f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf16f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf16f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 27663cb..f0652e0 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 _0x4b19=['map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x273dbc,_0x32d722){var _0x2720de=function(_0x435078){while(--_0x435078){_0x273dbc['push'](_0x273dbc['shift']());}};_0x2720de(++_0x32d722);}(_0x4b19,0x195));var _0x94b1=function(_0x44caf2,_0x8ffb16){_0x44caf2=_0x44caf2-0x0;var _0x25978d=_0x4b19[_0x44caf2];return _0x25978d;};'use strict';var pdf=require(_0x94b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b1('0x1'));var zipdir=require(_0x94b1('0x2'));var jsonpatch=require(_0x94b1('0x3'));var rp=require('request-promise');var moment=require(_0x94b1('0x4'));var BPromise=require(_0x94b1('0x5'));var Mustache=require(_0x94b1('0x6'));var util=require('util');var path=require(_0x94b1('0x7'));var sox=require(_0x94b1('0x8'));var csv=require('to-csv');var ejs=require(_0x94b1('0x9'));var fs=require('fs');var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var db=require(_0x94b1('0x16'))['db'];function respondWithStatusCode(_0x340a29,_0x2b378c){_0x2b378c=_0x2b378c||0xcc;return function(_0x5cbf96){if(_0x5cbf96){return _0x340a29['sendStatus'](_0x2b378c);}return _0x340a29[_0x94b1('0x17')](_0x2b378c)[_0x94b1('0x18')]();};}function respondWithResult(_0x57de2f,_0x5059d8){_0x5059d8=_0x5059d8||0xc8;return function(_0x9329c9){if(_0x9329c9){return _0x57de2f[_0x94b1('0x17')](_0x5059d8)['json'](_0x9329c9);}};}function respondWithFilteredResult(_0x3f3eab,_0x58fab3){return function(_0x4ea6a4){if(_0x4ea6a4){var _0x192c03=_0x4ea6a4['count'],_0x1f0560=_0x58fab3[_0x94b1('0x19')],_0x258e98=_0x58fab3[_0x94b1('0x19')]+_0x58fab3[_0x94b1('0x1a')],_0x1977f4;if(_0x258e98>=_0x192c03){_0x258e98=_0x192c03;_0x1977f4=0xc8;}else{_0x1977f4=0xce;}_0x3f3eab[_0x94b1('0x17')](_0x1977f4);return _0x3f3eab[_0x94b1('0x1b')](_0x94b1('0x1c'),_0x1f0560+'-'+_0x258e98+'/'+_0x192c03)[_0x94b1('0x1d')](_0x4ea6a4);}return null;};}function patchUpdates(_0x59d7cf){return function(_0x30f969){try{jsonpatch[_0x94b1('0x1e')](_0x30f969,_0x59d7cf,!![]);}catch(_0x1fcb91){return BPromise['reject'](_0x1fcb91);}return _0x30f969[_0x94b1('0x1f')]();};}function saveUpdates(_0x32f329,_0x4c40c5){return function(_0x602c3b){if(_0x602c3b){return _0x602c3b[_0x94b1('0x20')](_0x32f329)[_0x94b1('0x21')](function(_0x2ed3b7){return _0x2ed3b7;});}return null;};}function removeEntity(_0x3a9c3c,_0x38448d){return function(_0x36180a){if(_0x36180a){return _0x36180a[_0x94b1('0x22')]()[_0x94b1('0x21')](function(){_0x3a9c3c[_0x94b1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa333a8,_0xa112b1){return function(_0x34c324){if(!_0x34c324){_0xa333a8['sendStatus'](0x194);}return _0x34c324;};}function handleError(_0x374611,_0x5af4f5){_0x5af4f5=_0x5af4f5||0x1f4;return function(_0x269925){logger[_0x94b1('0x23')](_0x269925[_0x94b1('0x24')]);if(_0x269925[_0x94b1('0x25')]){delete _0x269925['name'];}_0x374611['status'](_0x5af4f5)[_0x94b1('0x26')](_0x269925);};}exports['index']=function(_0x1aa525,_0x5c3a9a){var _0x4694de={},_0x2f06b1={},_0x1eda8c={'count':0x0,'rows':[]};var _0x4c2732=_[_0x94b1('0x27')](db[_0x94b1('0x28')][_0x94b1('0x29')],function(_0x319618){return{'name':_0x319618[_0x94b1('0x2a')],'type':_0x319618[_0x94b1('0x2b')][_0x94b1('0x2c')]};});_0x2f06b1[_0x94b1('0x2d')]=_[_0x94b1('0x27')](_0x4c2732,'name');_0x2f06b1[_0x94b1('0x2e')]=_[_0x94b1('0x2f')](_0x1aa525['query']);_0x2f06b1[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x2f06b1[_0x94b1('0x2d')],_0x2f06b1[_0x94b1('0x2e')]);_0x4694de[_0x94b1('0x32')]=_[_0x94b1('0x31')](_0x2f06b1['model'],qs[_0x94b1('0x33')](_0x1aa525['query'][_0x94b1('0x33')]));_0x4694de['attributes']=_0x4694de['attributes'][_0x94b1('0x34')]?_0x4694de[_0x94b1('0x32')]:_0x2f06b1[_0x94b1('0x2d')];if(!_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x35')](_0x94b1('0x36'))){_0x4694de[_0x94b1('0x1a')]=qs[_0x94b1('0x1a')](_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x1a')]);_0x4694de[_0x94b1('0x19')]=qs[_0x94b1('0x19')](_0x1aa525['query']['offset']);}_0x4694de[_0x94b1('0x37')]=qs[_0x94b1('0x38')](_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x38')]);_0x4694de[_0x94b1('0x39')]=qs[_0x94b1('0x30')](_[_0x94b1('0x3a')](_0x1aa525[_0x94b1('0x2e')],_0x2f06b1[_0x94b1('0x30')]),_0x4c2732);if(_0x1aa525['query'][_0x94b1('0x3b')]){_0x4694de['where']=_[_0x94b1('0x3c')](_0x4694de[_0x94b1('0x39')],{'$or':_[_0x94b1('0x27')](_0x4c2732,function(_0x586ae0){if(_0x586ae0[_0x94b1('0x2b')]!==_0x94b1('0x3d')){var _0x27c9e4={};_0x27c9e4[_0x586ae0['name']]={'$like':'%'+_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x3b')]+'%'};return _0x27c9e4;}})});}_0x4694de=_[_0x94b1('0x3c')]({},_0x4694de,_0x1aa525[_0x94b1('0x3e')]);var _0x3e5b02={'where':_0x4694de[_0x94b1('0x39')]};return db[_0x94b1('0x28')][_0x94b1('0x3f')](_0x3e5b02)[_0x94b1('0x21')](function(_0x2d6f38){_0x1eda8c[_0x94b1('0x3f')]=_0x2d6f38;if(_0x1aa525[_0x94b1('0x2e')][_0x94b1('0x40')]){_0x4694de['include']=[{'all':!![]}];}return db[_0x94b1('0x28')][_0x94b1('0x41')](_0x4694de);})[_0x94b1('0x21')](function(_0x44d53d){_0x1eda8c[_0x94b1('0x42')]=_0x44d53d;return _0x1eda8c;})['then'](respondWithFilteredResult(_0x5c3a9a,_0x4694de))[_0x94b1('0x43')](handleError(_0x5c3a9a,null));};exports[_0x94b1('0x44')]=function(_0x186575,_0x300747){var _0x3cf664={'raw':![],'where':{'id':_0x186575['params']['id']}},_0x2c9398={};_0x2c9398[_0x94b1('0x2d')]=_[_0x94b1('0x2f')](db['UserProfileResource'][_0x94b1('0x29')]);_0x2c9398[_0x94b1('0x2e')]=_['keys'](_0x186575[_0x94b1('0x2e')]);_0x2c9398[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x2c9398['model'],_0x2c9398[_0x94b1('0x2e')]);_0x3cf664[_0x94b1('0x32')]=_[_0x94b1('0x31')](_0x2c9398[_0x94b1('0x2d')],qs[_0x94b1('0x33')](_0x186575[_0x94b1('0x2e')][_0x94b1('0x33')]));_0x3cf664['attributes']=_0x3cf664[_0x94b1('0x32')][_0x94b1('0x34')]?_0x3cf664[_0x94b1('0x32')]:_0x2c9398['model'];if(_0x186575[_0x94b1('0x2e')][_0x94b1('0x40')]){_0x3cf664['include']=[{'all':!![]}];}_0x3cf664=_[_0x94b1('0x3c')]({},_0x3cf664,_0x186575[_0x94b1('0x3e')]);return db[_0x94b1('0x28')][_0x94b1('0x45')](_0x3cf664)[_0x94b1('0x21')](handleEntityNotFound(_0x300747,null))[_0x94b1('0x21')](respondWithResult(_0x300747,null))[_0x94b1('0x43')](handleError(_0x300747,null));};exports[_0x94b1('0x46')]=function(_0x24f906,_0xe2381d){return db[_0x94b1('0x28')][_0x94b1('0x46')](_0x24f906[_0x94b1('0x47')],{})[_0x94b1('0x21')](respondWithResult(_0xe2381d,0xc9))[_0x94b1('0x43')](handleError(_0xe2381d,null));};exports[_0x94b1('0x20')]=function(_0xfe1c8f,_0x2b22ee){if(_0xfe1c8f[_0x94b1('0x47')]['id']){delete _0xfe1c8f['body']['id'];}return db[_0x94b1('0x28')]['find']({'where':{'id':_0xfe1c8f[_0x94b1('0x48')]['id']}})[_0x94b1('0x21')](handleEntityNotFound(_0x2b22ee,null))[_0x94b1('0x21')](saveUpdates(_0xfe1c8f['body'],null))['then'](respondWithResult(_0x2b22ee,null))['catch'](handleError(_0x2b22ee,null));};exports[_0x94b1('0x22')]=function(_0x43f072,_0x276ab1){return db['UserProfileResource']['find']({'where':{'id':_0x43f072['params']['id']}})[_0x94b1('0x21')](handleEntityNotFound(_0x276ab1,null))[_0x94b1('0x21')](removeEntity(_0x276ab1,null))[_0x94b1('0x43')](handleError(_0x276ab1,null));};exports[_0x94b1('0x49')]=function(_0x4109ca,_0xf5f20c){return db[_0x94b1('0x28')]['describe']()[_0x94b1('0x21')](respondWithResult(_0xf5f20c,null))[_0x94b1('0x43')](handleError(_0xf5f20c,null));}; \ No newline at end of file +var _0x84e7=['includeAll','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84e7,0x122));var _0x784e=function(_0x358919,_0x4ebfd4){_0x358919=_0x358919-0x0;var _0x14b533=_0x84e7[_0x358919];return _0x14b533;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x784e('0x0'));var rimraf=require(_0x784e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x784e('0x2'));var rp=require(_0x784e('0x3'));var moment=require('moment');var BPromise=require(_0x784e('0x4'));var Mustache=require(_0x784e('0x5'));var util=require(_0x784e('0x6'));var path=require(_0x784e('0x7'));var sox=require(_0x784e('0x8'));var csv=require(_0x784e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x784e('0xa'));var squel=require('squel');var crypto=require(_0x784e('0xb'));var jsforce=require(_0x784e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x784e('0x9'));var querystring=require(_0x784e('0xd'));var Papa=require(_0x784e('0xe'));var Redis=require(_0x784e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x784e('0x10'));var hardwareService=require(_0x784e('0x11'));var logger=require(_0x784e('0x12'))(_0x784e('0x13'));var utils=require('../../config/utils');var config=require(_0x784e('0x14'));var db=require(_0x784e('0x15'))['db'];function respondWithStatusCode(_0x37ec58,_0x2c7227){_0x2c7227=_0x2c7227||0xcc;return function(_0x40e0d1){if(_0x40e0d1){return _0x37ec58[_0x784e('0x16')](_0x2c7227);}return _0x37ec58['status'](_0x2c7227)[_0x784e('0x17')]();};}function respondWithResult(_0x5177e4,_0x172697){_0x172697=_0x172697||0xc8;return function(_0x1f6ede){if(_0x1f6ede){return _0x5177e4[_0x784e('0x18')](_0x172697)[_0x784e('0x19')](_0x1f6ede);}};}function respondWithFilteredResult(_0x31a8cc,_0x46bd33){return function(_0x947397){if(_0x947397){var _0x39abb5=_0x947397[_0x784e('0x1a')],_0x8a90cf=_0x46bd33[_0x784e('0x1b')],_0x567eb9=_0x46bd33[_0x784e('0x1b')]+_0x46bd33[_0x784e('0x1c')],_0x519059;if(_0x567eb9>=_0x39abb5){_0x567eb9=_0x39abb5;_0x519059=0xc8;}else{_0x519059=0xce;}_0x31a8cc[_0x784e('0x18')](_0x519059);return _0x31a8cc[_0x784e('0x1d')](_0x784e('0x1e'),_0x8a90cf+'-'+_0x567eb9+'/'+_0x39abb5)['json'](_0x947397);}return null;};}function patchUpdates(_0x2524d0){return function(_0x285ddd){try{jsonpatch[_0x784e('0x1f')](_0x285ddd,_0x2524d0,!![]);}catch(_0xa417c2){return BPromise[_0x784e('0x20')](_0xa417c2);}return _0x285ddd[_0x784e('0x21')]();};}function saveUpdates(_0x435066,_0x5e9b46){return function(_0x5add8f){if(_0x5add8f){return _0x5add8f[_0x784e('0x22')](_0x435066)['then'](function(_0x2a304c){return _0x2a304c;});}return null;};}function removeEntity(_0x1c5163,_0x5254c8){return function(_0x544a1b){if(_0x544a1b){return _0x544a1b[_0x784e('0x23')]()[_0x784e('0x24')](function(){_0x1c5163[_0x784e('0x18')](0xcc)[_0x784e('0x17')]();});}};}function handleEntityNotFound(_0x51f452,_0x4fab06){return function(_0x4dc85f){if(!_0x4dc85f){_0x51f452[_0x784e('0x16')](0x194);}return _0x4dc85f;};}function handleError(_0x12134f,_0x47f5c2){_0x47f5c2=_0x47f5c2||0x1f4;return function(_0xc225cf){logger['error'](_0xc225cf[_0x784e('0x25')]);if(_0xc225cf['name']){delete _0xc225cf[_0x784e('0x26')];}_0x12134f[_0x784e('0x18')](_0x47f5c2)[_0x784e('0x27')](_0xc225cf);};}exports[_0x784e('0x28')]=function(_0x5cb14f,_0x3668ed){var _0x2242e6={},_0x12a246={},_0x2def08={'count':0x0,'rows':[]};var _0x54e558=_[_0x784e('0x29')](db[_0x784e('0x2a')]['rawAttributes'],function(_0x5cb5a3){return{'name':_0x5cb5a3[_0x784e('0x2b')],'type':_0x5cb5a3[_0x784e('0x2c')][_0x784e('0x2d')]};});_0x12a246[_0x784e('0x2e')]=_[_0x784e('0x29')](_0x54e558,_0x784e('0x26'));_0x12a246[_0x784e('0x2f')]=_[_0x784e('0x30')](_0x5cb14f[_0x784e('0x2f')]);_0x12a246[_0x784e('0x31')]=_[_0x784e('0x32')](_0x12a246[_0x784e('0x2e')],_0x12a246[_0x784e('0x2f')]);_0x2242e6[_0x784e('0x33')]=_[_0x784e('0x32')](_0x12a246['model'],qs[_0x784e('0x34')](_0x5cb14f['query'][_0x784e('0x34')]));_0x2242e6[_0x784e('0x33')]=_0x2242e6[_0x784e('0x33')]['length']?_0x2242e6[_0x784e('0x33')]:_0x12a246['model'];if(!_0x5cb14f[_0x784e('0x2f')][_0x784e('0x35')]('nolimit')){_0x2242e6[_0x784e('0x1c')]=qs[_0x784e('0x1c')](_0x5cb14f['query']['limit']);_0x2242e6[_0x784e('0x1b')]=qs[_0x784e('0x1b')](_0x5cb14f[_0x784e('0x2f')][_0x784e('0x1b')]);}_0x2242e6[_0x784e('0x36')]=qs['sort'](_0x5cb14f[_0x784e('0x2f')][_0x784e('0x37')]);_0x2242e6['where']=qs[_0x784e('0x31')](_['pick'](_0x5cb14f['query'],_0x12a246['filters']),_0x54e558);if(_0x5cb14f[_0x784e('0x2f')][_0x784e('0x38')]){_0x2242e6['where']=_[_0x784e('0x39')](_0x2242e6[_0x784e('0x3a')],{'$or':_[_0x784e('0x29')](_0x54e558,function(_0x22559e){if(_0x22559e[_0x784e('0x2c')]!==_0x784e('0x3b')){var _0x4c4e59={};_0x4c4e59[_0x22559e['name']]={'$like':'%'+_0x5cb14f[_0x784e('0x2f')][_0x784e('0x38')]+'%'};return _0x4c4e59;}})});}_0x2242e6=_['merge']({},_0x2242e6,_0x5cb14f['options']);var _0x48afec={'where':_0x2242e6[_0x784e('0x3a')]};return db[_0x784e('0x2a')]['count'](_0x48afec)[_0x784e('0x24')](function(_0x2b8dbc){_0x2def08[_0x784e('0x1a')]=_0x2b8dbc;if(_0x5cb14f['query'][_0x784e('0x3c')]){_0x2242e6['include']=[{'all':!![]}];}return db[_0x784e('0x2a')]['findAll'](_0x2242e6);})[_0x784e('0x24')](function(_0x14c36b){_0x2def08['rows']=_0x14c36b;return _0x2def08;})['then'](respondWithFilteredResult(_0x3668ed,_0x2242e6))[_0x784e('0x3d')](handleError(_0x3668ed,null));};exports[_0x784e('0x3e')]=function(_0xa2ed54,_0x58fb50){var _0x2ff0ab={'raw':![],'where':{'id':_0xa2ed54[_0x784e('0x3f')]['id']}},_0x3d68e6={};_0x3d68e6[_0x784e('0x2e')]=_['keys'](db[_0x784e('0x2a')][_0x784e('0x40')]);_0x3d68e6['query']=_['keys'](_0xa2ed54[_0x784e('0x2f')]);_0x3d68e6[_0x784e('0x31')]=_[_0x784e('0x32')](_0x3d68e6[_0x784e('0x2e')],_0x3d68e6[_0x784e('0x2f')]);_0x2ff0ab['attributes']=_['intersection'](_0x3d68e6['model'],qs[_0x784e('0x34')](_0xa2ed54[_0x784e('0x2f')][_0x784e('0x34')]));_0x2ff0ab[_0x784e('0x33')]=_0x2ff0ab[_0x784e('0x33')]['length']?_0x2ff0ab['attributes']:_0x3d68e6['model'];if(_0xa2ed54[_0x784e('0x2f')][_0x784e('0x3c')]){_0x2ff0ab['include']=[{'all':!![]}];}_0x2ff0ab=_[_0x784e('0x39')]({},_0x2ff0ab,_0xa2ed54[_0x784e('0x41')]);return db['UserProfileResource'][_0x784e('0x42')](_0x2ff0ab)[_0x784e('0x24')](handleEntityNotFound(_0x58fb50,null))[_0x784e('0x24')](respondWithResult(_0x58fb50,null))[_0x784e('0x3d')](handleError(_0x58fb50,null));};exports[_0x784e('0x43')]=function(_0x26b83a,_0x3c9b5e){return db[_0x784e('0x2a')]['create'](_0x26b83a[_0x784e('0x44')],{})[_0x784e('0x24')](respondWithResult(_0x3c9b5e,0xc9))['catch'](handleError(_0x3c9b5e,null));};exports[_0x784e('0x22')]=function(_0x473e63,_0x3bfafc){if(_0x473e63[_0x784e('0x44')]['id']){delete _0x473e63[_0x784e('0x44')]['id'];}return db[_0x784e('0x2a')][_0x784e('0x42')]({'where':{'id':_0x473e63[_0x784e('0x3f')]['id']}})[_0x784e('0x24')](handleEntityNotFound(_0x3bfafc,null))[_0x784e('0x24')](saveUpdates(_0x473e63['body'],null))[_0x784e('0x24')](respondWithResult(_0x3bfafc,null))[_0x784e('0x3d')](handleError(_0x3bfafc,null));};exports['destroy']=function(_0x54d313,_0xdc779c){return db['UserProfileResource'][_0x784e('0x42')]({'where':{'id':_0x54d313['params']['id']}})[_0x784e('0x24')](handleEntityNotFound(_0xdc779c,null))[_0x784e('0x24')](removeEntity(_0xdc779c,null))[_0x784e('0x3d')](handleError(_0xdc779c,null));};exports[_0x784e('0x45')]=function(_0x553e79,_0x4ea3af){return db[_0x784e('0x2a')][_0x784e('0x45')]()[_0x784e('0x24')](respondWithResult(_0x4ea3af,null))[_0x784e('0x3d')](handleError(_0x4ea3af,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 5667e7c..a879364 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 _0xf645=['resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex'];(function(_0x477b2a,_0x2f62c1){var _0x265472=function(_0x379906){while(--_0x379906){_0x477b2a['push'](_0x477b2a['shift']());}};_0x265472(++_0x2f62c1);}(_0xf645,0x1f2));var _0x5f64=function(_0x4def83,_0x5277f9){_0x4def83=_0x4def83-0x0;var _0xa4c6bf=_0xf645[_0x4def83];return _0xa4c6bf;};'use strict';var _=require(_0x5f64('0x0'));var util=require(_0x5f64('0x1'));var logger=require(_0x5f64('0x2'))(_0x5f64('0x3'));var moment=require(_0x5f64('0x4'));var BPromise=require(_0x5f64('0x5'));var rp=require(_0x5f64('0x6'));var fs=require('fs');var path=require(_0x5f64('0x7'));var rimraf=require(_0x5f64('0x8'));var config=require(_0x5f64('0x9'));var attributes=require(_0x5f64('0xa'));module[_0x5f64('0xb')]=function(_0x3ee657,_0x426f68){return _0x3ee657[_0x5f64('0xc')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x5f64('0xd'),'fields':[_0x5f64('0xe'),_0x5f64('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7633=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x7633,0xe4));var _0x3763=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7633[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3763('0x0'))(_0x3763('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3763('0x2'));var fs=require('fs');var path=require(_0x3763('0x3'));var rimraf=require(_0x3763('0x4'));var config=require(_0x3763('0x5'));var attributes=require(_0x3763('0x6'));module[_0x3763('0x7')]=function(_0x2b461d,_0x26f689){return _0x2b461d[_0x3763('0x8')](_0x3763('0x9'),attributes,{'tableName':_0x3763('0xa'),'paranoid':![],'indexes':[{'name':_0x3763('0xb'),'fields':[_0x3763('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 1f267ef..26dadb4 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 _0x51f9=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x2238ba,_0xfeb953){var _0x33032f=function(_0x337e44){while(--_0x337e44){_0x2238ba['push'](_0x2238ba['shift']());}};_0x33032f(++_0xfeb953);}(_0x51f9,0x1c3));var _0x951f=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x51f9[_0x50f392];return _0x5926f2;};'use strict';var _=require(_0x951f('0x0'));var util=require(_0x951f('0x1'));var moment=require(_0x951f('0x2'));var BPromise=require(_0x951f('0x3'));var rs=require(_0x951f('0x4'));var fs=require('fs');var Redis=require(_0x951f('0x5'));var db=require(_0x951f('0x6'))['db'];var utils=require(_0x951f('0x7'));var logger=require('../../config/logger')(_0x951f('0x8'));var config=require(_0x951f('0x9'));var jayson=require(_0x951f('0xa'));var client=jayson['client'][_0x951f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x374375,_0x29c29b,_0x5918a9){return new BPromise(function(_0x3db9c8,_0x24888a){return client[_0x951f('0xc')](_0x374375,_0x5918a9)[_0x951f('0xd')](function(_0x16e3b7){logger[_0x951f('0xe')](_0x951f('0xf'),_0x29c29b,'request\x20sent');logger[_0x951f('0x10')](_0x951f('0x11'),_0x29c29b,'request\x20sent',JSON[_0x951f('0x12')](_0x16e3b7));if(_0x16e3b7[_0x951f('0x13')]){if(_0x16e3b7[_0x951f('0x13')][_0x951f('0x14')]===0x1f4){logger['error'](_0x951f('0xf'),_0x29c29b,_0x16e3b7['error']['message']);return _0x24888a(_0x16e3b7[_0x951f('0x13')][_0x951f('0x15')]);}logger['error'](_0x951f('0xf'),_0x29c29b,_0x16e3b7[_0x951f('0x13')][_0x951f('0x15')]);return _0x3db9c8(_0x16e3b7[_0x951f('0x13')][_0x951f('0x15')]);}else{logger['info'](_0x951f('0xf'),_0x29c29b,_0x951f('0x16'));_0x3db9c8(_0x16e3b7[_0x951f('0x17')][_0x951f('0x15')]);}})[_0x951f('0x18')](function(_0x556cf5){logger[_0x951f('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x29c29b,_0x556cf5);_0x24888a(_0x556cf5);});});} \ No newline at end of file +var _0x697e=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3f0710,_0xb4edff){var _0x20094e=function(_0x1457fb){while(--_0x1457fb){_0x3f0710['push'](_0x3f0710['shift']());}};_0x20094e(++_0xb4edff);}(_0x697e,0xd1));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe697('0x0'));var util=require(_0xe697('0x1'));var moment=require(_0xe697('0x2'));var BPromise=require(_0xe697('0x3'));var rs=require(_0xe697('0x4'));var fs=require('fs');var Redis=require(_0xe697('0x5'));var db=require(_0xe697('0x6'))['db'];var utils=require(_0xe697('0x7'));var logger=require(_0xe697('0x8'))(_0xe697('0x9'));var config=require('../../config/environment');var jayson=require(_0xe697('0xa'));var client=jayson[_0xe697('0xb')][_0xe697('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3367b3,_0x20bbb7,_0xeb0f26){return new BPromise(function(_0x35d7fb,_0x9a6481){return client[_0xe697('0xd')](_0x3367b3,_0xeb0f26)[_0xe697('0xe')](function(_0x5ea159){logger[_0xe697('0xf')](_0xe697('0x10'),_0x20bbb7,_0xe697('0x11'));logger[_0xe697('0x12')](_0xe697('0x13'),_0x20bbb7,_0xe697('0x11'),JSON['stringify'](_0x5ea159));if(_0x5ea159[_0xe697('0x14')]){if(_0x5ea159['error']['code']===0x1f4){logger[_0xe697('0x14')](_0xe697('0x10'),_0x20bbb7,_0x5ea159[_0xe697('0x14')][_0xe697('0x15')]);return _0x9a6481(_0x5ea159[_0xe697('0x14')][_0xe697('0x15')]);}logger[_0xe697('0x14')](_0xe697('0x10'),_0x20bbb7,_0x5ea159[_0xe697('0x14')]['message']);return _0x35d7fb(_0x5ea159[_0xe697('0x14')][_0xe697('0x15')]);}else{logger[_0xe697('0xf')](_0xe697('0x10'),_0x20bbb7,_0xe697('0x11'));_0x35d7fb(_0x5ea159[_0xe697('0x16')][_0xe697('0x15')]);}})[_0xe697('0x17')](function(_0x16297f){logger[_0xe697('0x14')](_0xe697('0x10'),_0x20bbb7,_0x16297f);_0x9a6481(_0x16297f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 05f7286..7d367ae 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 _0x0a62=['express','Router','../../components/auth/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2def51,_0x4ce5c4){var _0x4e69d3=function(_0x1cdb9c){while(--_0x1cdb9c){_0x2def51['push'](_0x2def51['shift']());}};_0x4e69d3(++_0x4ce5c4);}(_0x0a62,0x119));var _0x20a6=function(_0x20dd9b,_0x3c0fb8){_0x20dd9b=_0x20dd9b-0x0;var _0x2de3b0=_0x0a62[_0x20dd9b];return _0x2de3b0;};'use strict';var multer=require(_0x20a6('0x0'));var util=require(_0x20a6('0x1'));var path=require(_0x20a6('0x2'));var timeout=require(_0x20a6('0x3'));var express=require(_0x20a6('0x4'));var router=express[_0x20a6('0x5')]();var auth=require(_0x20a6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x20a6('0x7'));router[_0x20a6('0x8')]('/',auth['isAuthenticated'](),controller[_0x20a6('0x9')]);router[_0x20a6('0x8')](_0x20a6('0xa'),auth[_0x20a6('0xb')](),controller[_0x20a6('0xc')]);router[_0x20a6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x20a6('0xb')](),controller[_0x20a6('0xd')]);router[_0x20a6('0xe')](_0x20a6('0xf'),auth['isAuthenticated'](),controller[_0x20a6('0x10')]);router[_0x20a6('0x11')](_0x20a6('0xf'),auth[_0x20a6('0xb')](),controller[_0x20a6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x35b5=['/describe','describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index'];(function(_0x67a29e,_0xd05fc6){var _0x48c0ce=function(_0x110317){while(--_0x110317){_0x67a29e['push'](_0x67a29e['shift']());}};_0x48c0ce(++_0xd05fc6);}(_0x35b5,0x1c4));var _0x535b=function(_0x112e16,_0x4f22ba){_0x112e16=_0x112e16-0x0;var _0x524f91=_0x35b5[_0x112e16];return _0x524f91;};'use strict';var multer=require(_0x535b('0x0'));var util=require('util');var path=require(_0x535b('0x1'));var timeout=require(_0x535b('0x2'));var express=require(_0x535b('0x3'));var router=express[_0x535b('0x4')]();var auth=require(_0x535b('0x5'));var interaction=require(_0x535b('0x6'));var config=require('../../config/environment');var controller=require(_0x535b('0x7'));router[_0x535b('0x8')]('/',auth['isAuthenticated'](),controller[_0x535b('0x9')]);router['get'](_0x535b('0xa'),auth['isAuthenticated'](),controller[_0x535b('0xb')]);router[_0x535b('0x8')]('/:id',auth[_0x535b('0xc')](),controller[_0x535b('0xd')]);router[_0x535b('0xe')]('/',auth['isAuthenticated'](),controller[_0x535b('0xf')]);router[_0x535b('0x10')](_0x535b('0x11'),auth[_0x535b('0xc')](),controller[_0x535b('0x12')]);router[_0x535b('0x13')](_0x535b('0x11'),auth[_0x535b('0xc')](),controller[_0x535b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5f1a44f..7d9d418 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 _0x032e=['crudPermissions','join','getDataValue','split','sequelize','STRING','BOOLEAN','setDataValue'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x032e,0x124));var _0xe032=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x032e[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'name':{'type':Sequelize[_0xe032('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xe032('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe032('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe032('0x1')],'set':function(_0x2f44f6){this[_0xe032('0x3')](_0xe032('0x4'),_0x2f44f6?_0x2f44f6[_0xe032('0x5')](''):[]);},'get':function(){return this[_0xe032('0x6')](_0xe032('0x4'))?this[_0xe032('0x6')](_0xe032('0x4'))[_0xe032('0x7')](''):[];}}}; \ No newline at end of file +var _0x97ed=['exports','INTEGER','BOOLEAN','STRING','setDataValue','crudPermissions','getDataValue','sequelize'];(function(_0x10d405,_0x28d136){var _0x12bd98=function(_0x3b6cc3){while(--_0x3b6cc3){_0x10d405['push'](_0x10d405['shift']());}};_0x12bd98(++_0x28d136);}(_0x97ed,0x1e7));var _0xd97e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x97ed[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xd97e('0x0'));module[_0xd97e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd97e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd97e('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd97e('0x4')],'set':function(_0x27b80c){this[_0xd97e('0x5')](_0xd97e('0x6'),_0x27b80c?_0x27b80c['join'](''):[]);},'get':function(){return this[_0xd97e('0x7')](_0xd97e('0x6'))?this['getDataValue'](_0xd97e('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ed3cb92..d396ef3 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 _0xe0d7=['name','send','index','map','UserProfileSection','fieldName','type','key','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','show','keys','rawAttributes','intersection','includeAll','include','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe0d7,0x1e0));var _0x7e0d=function(_0x48b287,_0x2d3561){_0x48b287=_0x48b287-0x0;var _0x498852=_0xe0d7[_0x48b287];return _0x498852;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e0d('0x1'));var jsonpatch=require(_0x7e0d('0x2'));var rp=require(_0x7e0d('0x3'));var moment=require(_0x7e0d('0x4'));var BPromise=require(_0x7e0d('0x5'));var Mustache=require(_0x7e0d('0x6'));var util=require(_0x7e0d('0x7'));var path=require(_0x7e0d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7e0d('0x9'));var fs=require('fs');var _=require(_0x7e0d('0xa'));var squel=require(_0x7e0d('0xb'));var crypto=require(_0x7e0d('0xc'));var jsforce=require(_0x7e0d('0xd'));var deskjs=require(_0x7e0d('0xe'));var toCsv=require(_0x7e0d('0xf'));var querystring=require(_0x7e0d('0x10'));var Papa=require(_0x7e0d('0x11'));var Redis=require(_0x7e0d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7e0d('0x13'));var as=require(_0x7e0d('0x14'));var hardwareService=require(_0x7e0d('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7e0d('0x16'));var db=require(_0x7e0d('0x17'))['db'];function respondWithStatusCode(_0x333edb,_0x272ac7){_0x272ac7=_0x272ac7||0xcc;return function(_0x391097){if(_0x391097){return _0x333edb['sendStatus'](_0x272ac7);}return _0x333edb['status'](_0x272ac7)[_0x7e0d('0x18')]();};}function respondWithResult(_0x5c1a3c,_0x3d6931){_0x3d6931=_0x3d6931||0xc8;return function(_0x4c1815){if(_0x4c1815){return _0x5c1a3c[_0x7e0d('0x19')](_0x3d6931)[_0x7e0d('0x1a')](_0x4c1815);}};}function respondWithFilteredResult(_0x1342d1,_0x3f0ba5){return function(_0xc86c82){if(_0xc86c82){var _0x451df1=_0xc86c82[_0x7e0d('0x1b')],_0x560919=_0x3f0ba5[_0x7e0d('0x1c')],_0x364624=_0x3f0ba5[_0x7e0d('0x1c')]+_0x3f0ba5[_0x7e0d('0x1d')],_0x20ed35;if(_0x364624>=_0x451df1){_0x364624=_0x451df1;_0x20ed35=0xc8;}else{_0x20ed35=0xce;}_0x1342d1[_0x7e0d('0x19')](_0x20ed35);return _0x1342d1['set']('Content-Range',_0x560919+'-'+_0x364624+'/'+_0x451df1)[_0x7e0d('0x1a')](_0xc86c82);}return null;};}function patchUpdates(_0x2afd87){return function(_0x3bc6cb){try{jsonpatch[_0x7e0d('0x1e')](_0x3bc6cb,_0x2afd87,!![]);}catch(_0x5799ff){return BPromise['reject'](_0x5799ff);}return _0x3bc6cb[_0x7e0d('0x1f')]();};}function saveUpdates(_0x262bca,_0xa3218c){return function(_0x3223a8){if(_0x3223a8){return _0x3223a8[_0x7e0d('0x20')](_0x262bca)[_0x7e0d('0x21')](function(_0x51e65f){return _0x51e65f;});}return null;};}function removeEntity(_0x3cf3d5,_0x376116){return function(_0x516c0f){if(_0x516c0f){return _0x516c0f[_0x7e0d('0x22')]()[_0x7e0d('0x21')](function(){_0x3cf3d5[_0x7e0d('0x19')](0xcc)[_0x7e0d('0x18')]();});}};}function handleEntityNotFound(_0x466172,_0x39ce84){return function(_0x55d957){if(!_0x55d957){_0x466172[_0x7e0d('0x23')](0x194);}return _0x55d957;};}function handleError(_0x472b4f,_0xbef3b9){_0xbef3b9=_0xbef3b9||0x1f4;return function(_0x3b8858){logger[_0x7e0d('0x24')](_0x3b8858[_0x7e0d('0x25')]);if(_0x3b8858[_0x7e0d('0x26')]){delete _0x3b8858[_0x7e0d('0x26')];}_0x472b4f[_0x7e0d('0x19')](_0xbef3b9)[_0x7e0d('0x27')](_0x3b8858);};}exports[_0x7e0d('0x28')]=function(_0x4c0eda,_0x2c3546){var _0x2cf52e={},_0x3ab631={},_0x289928={'count':0x0,'rows':[]};var _0x2e4758=_[_0x7e0d('0x29')](db[_0x7e0d('0x2a')]['rawAttributes'],function(_0x79574a){return{'name':_0x79574a[_0x7e0d('0x2b')],'type':_0x79574a[_0x7e0d('0x2c')][_0x7e0d('0x2d')]};});_0x3ab631['model']=_[_0x7e0d('0x29')](_0x2e4758,_0x7e0d('0x26'));_0x3ab631['query']=_['keys'](_0x4c0eda[_0x7e0d('0x2e')]);_0x3ab631[_0x7e0d('0x2f')]=_['intersection'](_0x3ab631[_0x7e0d('0x30')],_0x3ab631[_0x7e0d('0x2e')]);_0x2cf52e[_0x7e0d('0x31')]=_['intersection'](_0x3ab631[_0x7e0d('0x30')],qs[_0x7e0d('0x32')](_0x4c0eda[_0x7e0d('0x2e')][_0x7e0d('0x32')]));_0x2cf52e[_0x7e0d('0x31')]=_0x2cf52e[_0x7e0d('0x31')][_0x7e0d('0x33')]?_0x2cf52e[_0x7e0d('0x31')]:_0x3ab631[_0x7e0d('0x30')];if(!_0x4c0eda[_0x7e0d('0x2e')]['hasOwnProperty'](_0x7e0d('0x34'))){_0x2cf52e[_0x7e0d('0x1d')]=qs[_0x7e0d('0x1d')](_0x4c0eda['query'][_0x7e0d('0x1d')]);_0x2cf52e['offset']=qs[_0x7e0d('0x1c')](_0x4c0eda[_0x7e0d('0x2e')][_0x7e0d('0x1c')]);}_0x2cf52e[_0x7e0d('0x35')]=qs['sort'](_0x4c0eda[_0x7e0d('0x2e')][_0x7e0d('0x36')]);_0x2cf52e[_0x7e0d('0x37')]=qs[_0x7e0d('0x2f')](_[_0x7e0d('0x38')](_0x4c0eda[_0x7e0d('0x2e')],_0x3ab631[_0x7e0d('0x2f')]),_0x2e4758);if(_0x4c0eda[_0x7e0d('0x2e')][_0x7e0d('0x39')]){_0x2cf52e[_0x7e0d('0x37')]=_['merge'](_0x2cf52e['where'],{'$or':_[_0x7e0d('0x29')](_0x2e4758,function(_0xb5c0cf){if(_0xb5c0cf[_0x7e0d('0x2c')]!==_0x7e0d('0x3a')){var _0x35b99f={};_0x35b99f[_0xb5c0cf[_0x7e0d('0x26')]]={'$like':'%'+_0x4c0eda[_0x7e0d('0x2e')][_0x7e0d('0x39')]+'%'};return _0x35b99f;}})});}_0x2cf52e=_[_0x7e0d('0x3b')]({},_0x2cf52e,_0x4c0eda[_0x7e0d('0x3c')]);var _0x59ccff={'where':_0x2cf52e[_0x7e0d('0x37')]};return db[_0x7e0d('0x2a')][_0x7e0d('0x1b')](_0x59ccff)[_0x7e0d('0x21')](function(_0x53d002){_0x289928[_0x7e0d('0x1b')]=_0x53d002;if(_0x4c0eda['query']['includeAll']){_0x2cf52e['include']=[{'all':!![]}];}return db[_0x7e0d('0x2a')]['findAll'](_0x2cf52e);})[_0x7e0d('0x21')](function(_0x4b05c7){_0x289928[_0x7e0d('0x3d')]=_0x4b05c7;return _0x289928;})[_0x7e0d('0x21')](respondWithFilteredResult(_0x2c3546,_0x2cf52e))['catch'](handleError(_0x2c3546,null));};exports[_0x7e0d('0x3e')]=function(_0x343229,_0x467917){var _0x5b91d2={'raw':![],'where':{'id':_0x343229['params']['id']}},_0xf266a4={};_0xf266a4[_0x7e0d('0x30')]=_[_0x7e0d('0x3f')](db[_0x7e0d('0x2a')][_0x7e0d('0x40')]);_0xf266a4[_0x7e0d('0x2e')]=_[_0x7e0d('0x3f')](_0x343229['query']);_0xf266a4[_0x7e0d('0x2f')]=_[_0x7e0d('0x41')](_0xf266a4[_0x7e0d('0x30')],_0xf266a4[_0x7e0d('0x2e')]);_0x5b91d2[_0x7e0d('0x31')]=_['intersection'](_0xf266a4[_0x7e0d('0x30')],qs[_0x7e0d('0x32')](_0x343229['query'][_0x7e0d('0x32')]));_0x5b91d2[_0x7e0d('0x31')]=_0x5b91d2[_0x7e0d('0x31')]['length']?_0x5b91d2[_0x7e0d('0x31')]:_0xf266a4[_0x7e0d('0x30')];if(_0x343229['query'][_0x7e0d('0x42')]){_0x5b91d2[_0x7e0d('0x43')]=[{'all':!![]}];}_0x5b91d2=_['merge']({},_0x5b91d2,_0x343229[_0x7e0d('0x3c')]);return db[_0x7e0d('0x2a')][_0x7e0d('0x44')](_0x5b91d2)[_0x7e0d('0x21')](handleEntityNotFound(_0x467917,null))[_0x7e0d('0x21')](respondWithResult(_0x467917,null))[_0x7e0d('0x45')](handleError(_0x467917,null));};exports['create']=function(_0x3aa37b,_0x238f30){return db[_0x7e0d('0x2a')][_0x7e0d('0x46')](_0x3aa37b[_0x7e0d('0x47')],{})[_0x7e0d('0x21')](respondWithResult(_0x238f30,0xc9))[_0x7e0d('0x45')](handleError(_0x238f30,null));};exports[_0x7e0d('0x20')]=function(_0x21ba23,_0x3a1b13){if(_0x21ba23['body']['id']){delete _0x21ba23['body']['id'];}return db[_0x7e0d('0x2a')][_0x7e0d('0x44')]({'where':{'id':_0x21ba23[_0x7e0d('0x48')]['id']}})[_0x7e0d('0x21')](handleEntityNotFound(_0x3a1b13,null))['then'](saveUpdates(_0x21ba23[_0x7e0d('0x47')],null))['then'](respondWithResult(_0x3a1b13,null))['catch'](handleError(_0x3a1b13,null));};exports[_0x7e0d('0x22')]=function(_0x2205df,_0x32f706){return db['UserProfileSection'][_0x7e0d('0x44')]({'where':{'id':_0x2205df[_0x7e0d('0x48')]['id']}})[_0x7e0d('0x21')](handleEntityNotFound(_0x32f706,null))[_0x7e0d('0x21')](removeEntity(_0x32f706,null))[_0x7e0d('0x45')](handleError(_0x32f706,null));};exports[_0x7e0d('0x49')]=function(_0x864ee9,_0x16c756){return db[_0x7e0d('0x2a')][_0x7e0d('0x49')]()[_0x7e0d('0x21')](respondWithResult(_0x16c756,null))['catch'](handleError(_0x16c756,null));}; \ No newline at end of file +var _0x7024=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','create','body','catch','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','count','limit','apply','then','destroy','end','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7024,0xa1));var _0x4702=function(_0x55647c,_0x51340d){_0x55647c=_0x55647c-0x0;var _0x568961=_0x7024[_0x55647c];return _0x568961;};'use strict';var pdf=require(_0x4702('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4702('0x1'));var zipdir=require(_0x4702('0x2'));var jsonpatch=require(_0x4702('0x3'));var rp=require(_0x4702('0x4'));var moment=require(_0x4702('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4702('0x6'));var util=require('util');var path=require(_0x4702('0x7'));var sox=require(_0x4702('0x8'));var csv=require('to-csv');var ejs=require(_0x4702('0x9'));var fs=require('fs');var _=require(_0x4702('0xa'));var squel=require(_0x4702('0xb'));var crypto=require(_0x4702('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4702('0xd'));var Papa=require(_0x4702('0xe'));var Redis=require(_0x4702('0xf'));var authService=require(_0x4702('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4702('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4702('0x12'))(_0x4702('0x13'));var utils=require('../../config/utils');var config=require(_0x4702('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5717f0,_0x320705){_0x320705=_0x320705||0xcc;return function(_0x4c9ba7){if(_0x4c9ba7){return _0x5717f0[_0x4702('0x15')](_0x320705);}return _0x5717f0[_0x4702('0x16')](_0x320705)['end']();};}function respondWithResult(_0x11fe31,_0x5390e4){_0x5390e4=_0x5390e4||0xc8;return function(_0xb69561){if(_0xb69561){return _0x11fe31[_0x4702('0x16')](_0x5390e4)[_0x4702('0x17')](_0xb69561);}};}function respondWithFilteredResult(_0x163f37,_0x3b528e){return function(_0x42e388){if(_0x42e388){var _0xff60b0=_0x42e388[_0x4702('0x18')],_0x3b679b=_0x3b528e['offset'],_0x3e5f32=_0x3b528e['offset']+_0x3b528e[_0x4702('0x19')],_0x28f50b;if(_0x3e5f32>=_0xff60b0){_0x3e5f32=_0xff60b0;_0x28f50b=0xc8;}else{_0x28f50b=0xce;}_0x163f37['status'](_0x28f50b);return _0x163f37['set']('Content-Range',_0x3b679b+'-'+_0x3e5f32+'/'+_0xff60b0)[_0x4702('0x17')](_0x42e388);}return null;};}function patchUpdates(_0x156a29){return function(_0x6c3a63){try{jsonpatch[_0x4702('0x1a')](_0x6c3a63,_0x156a29,!![]);}catch(_0x2cc74b){return BPromise['reject'](_0x2cc74b);}return _0x6c3a63['save']();};}function saveUpdates(_0x261ca1,_0x11907f){return function(_0xa60b2e){if(_0xa60b2e){return _0xa60b2e['update'](_0x261ca1)[_0x4702('0x1b')](function(_0x1f835d){return _0x1f835d;});}return null;};}function removeEntity(_0x2d97b2,_0x4589d1){return function(_0x41d86c){if(_0x41d86c){return _0x41d86c[_0x4702('0x1c')]()[_0x4702('0x1b')](function(){_0x2d97b2[_0x4702('0x16')](0xcc)[_0x4702('0x1d')]();});}};}function handleEntityNotFound(_0x3abefb,_0x3b2aed){return function(_0x2fff0b){if(!_0x2fff0b){_0x3abefb[_0x4702('0x15')](0x194);}return _0x2fff0b;};}function handleError(_0x36f5d4,_0x11b538){_0x11b538=_0x11b538||0x1f4;return function(_0x513746){logger['error'](_0x513746[_0x4702('0x1e')]);if(_0x513746['name']){delete _0x513746[_0x4702('0x1f')];}_0x36f5d4[_0x4702('0x16')](_0x11b538)[_0x4702('0x20')](_0x513746);};}exports[_0x4702('0x21')]=function(_0x14b04e,_0x470ded){var _0x2db26={},_0x5298b4={},_0x3262bc={'count':0x0,'rows':[]};var _0x5704b3=_[_0x4702('0x22')](db[_0x4702('0x23')][_0x4702('0x24')],function(_0x44e08d){return{'name':_0x44e08d[_0x4702('0x25')],'type':_0x44e08d[_0x4702('0x26')][_0x4702('0x27')]};});_0x5298b4[_0x4702('0x28')]=_[_0x4702('0x22')](_0x5704b3,_0x4702('0x1f'));_0x5298b4[_0x4702('0x29')]=_[_0x4702('0x2a')](_0x14b04e['query']);_0x5298b4[_0x4702('0x2b')]=_[_0x4702('0x2c')](_0x5298b4[_0x4702('0x28')],_0x5298b4[_0x4702('0x29')]);_0x2db26[_0x4702('0x2d')]=_[_0x4702('0x2c')](_0x5298b4[_0x4702('0x28')],qs[_0x4702('0x2e')](_0x14b04e['query']['fields']));_0x2db26[_0x4702('0x2d')]=_0x2db26[_0x4702('0x2d')][_0x4702('0x2f')]?_0x2db26[_0x4702('0x2d')]:_0x5298b4['model'];if(!_0x14b04e[_0x4702('0x29')][_0x4702('0x30')](_0x4702('0x31'))){_0x2db26[_0x4702('0x19')]=qs['limit'](_0x14b04e[_0x4702('0x29')][_0x4702('0x19')]);_0x2db26[_0x4702('0x32')]=qs[_0x4702('0x32')](_0x14b04e[_0x4702('0x29')][_0x4702('0x32')]);}_0x2db26[_0x4702('0x33')]=qs[_0x4702('0x34')](_0x14b04e['query']['sort']);_0x2db26[_0x4702('0x35')]=qs[_0x4702('0x2b')](_['pick'](_0x14b04e[_0x4702('0x29')],_0x5298b4[_0x4702('0x2b')]),_0x5704b3);if(_0x14b04e['query']['filter']){_0x2db26[_0x4702('0x35')]=_['merge'](_0x2db26['where'],{'$or':_[_0x4702('0x22')](_0x5704b3,function(_0x3c1213){if(_0x3c1213['type']!==_0x4702('0x36')){var _0x258d4f={};_0x258d4f[_0x3c1213[_0x4702('0x1f')]]={'$like':'%'+_0x14b04e[_0x4702('0x29')]['filter']+'%'};return _0x258d4f;}})});}_0x2db26=_['merge']({},_0x2db26,_0x14b04e[_0x4702('0x37')]);var _0x53a412={'where':_0x2db26['where']};return db['UserProfileSection'][_0x4702('0x18')](_0x53a412)[_0x4702('0x1b')](function(_0x15e80e){_0x3262bc[_0x4702('0x18')]=_0x15e80e;if(_0x14b04e['query'][_0x4702('0x38')]){_0x2db26[_0x4702('0x39')]=[{'all':!![]}];}return db[_0x4702('0x23')]['findAll'](_0x2db26);})[_0x4702('0x1b')](function(_0x2cd8e9){_0x3262bc[_0x4702('0x3a')]=_0x2cd8e9;return _0x3262bc;})[_0x4702('0x1b')](respondWithFilteredResult(_0x470ded,_0x2db26))['catch'](handleError(_0x470ded,null));};exports[_0x4702('0x3b')]=function(_0x2426a7,_0x2008e9){var _0x51eb62={'raw':![],'where':{'id':_0x2426a7[_0x4702('0x3c')]['id']}},_0x289e6b={};_0x289e6b[_0x4702('0x28')]=_[_0x4702('0x2a')](db[_0x4702('0x23')][_0x4702('0x24')]);_0x289e6b[_0x4702('0x29')]=_['keys'](_0x2426a7[_0x4702('0x29')]);_0x289e6b['filters']=_['intersection'](_0x289e6b[_0x4702('0x28')],_0x289e6b[_0x4702('0x29')]);_0x51eb62[_0x4702('0x2d')]=_['intersection'](_0x289e6b[_0x4702('0x28')],qs[_0x4702('0x2e')](_0x2426a7[_0x4702('0x29')][_0x4702('0x2e')]));_0x51eb62['attributes']=_0x51eb62[_0x4702('0x2d')]['length']?_0x51eb62['attributes']:_0x289e6b[_0x4702('0x28')];if(_0x2426a7[_0x4702('0x29')][_0x4702('0x38')]){_0x51eb62[_0x4702('0x39')]=[{'all':!![]}];}_0x51eb62=_[_0x4702('0x3d')]({},_0x51eb62,_0x2426a7[_0x4702('0x37')]);return db[_0x4702('0x23')][_0x4702('0x3e')](_0x51eb62)['then'](handleEntityNotFound(_0x2008e9,null))[_0x4702('0x1b')](respondWithResult(_0x2008e9,null))['catch'](handleError(_0x2008e9,null));};exports[_0x4702('0x3f')]=function(_0x357a4e,_0x12c375){return db[_0x4702('0x23')][_0x4702('0x3f')](_0x357a4e[_0x4702('0x40')],{})[_0x4702('0x1b')](respondWithResult(_0x12c375,0xc9))[_0x4702('0x41')](handleError(_0x12c375,null));};exports[_0x4702('0x42')]=function(_0x39c5be,_0x12a173){if(_0x39c5be[_0x4702('0x40')]['id']){delete _0x39c5be['body']['id'];}return db[_0x4702('0x23')][_0x4702('0x3e')]({'where':{'id':_0x39c5be[_0x4702('0x3c')]['id']}})[_0x4702('0x1b')](handleEntityNotFound(_0x12a173,null))[_0x4702('0x1b')](saveUpdates(_0x39c5be[_0x4702('0x40')],null))['then'](respondWithResult(_0x12a173,null))[_0x4702('0x41')](handleError(_0x12a173,null));};exports[_0x4702('0x1c')]=function(_0x561984,_0x5705c8){return db[_0x4702('0x23')][_0x4702('0x3e')]({'where':{'id':_0x561984[_0x4702('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5705c8,null))[_0x4702('0x1b')](removeEntity(_0x5705c8,null))['catch'](handleError(_0x5705c8,null));};exports[_0x4702('0x43')]=function(_0x29c0c7,_0x535589){return db[_0x4702('0x23')][_0x4702('0x43')]()[_0x4702('0x1b')](respondWithResult(_0x535589,null))[_0x4702('0x41')](handleError(_0x535589,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 58f6fe7..44585cb 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 _0xda54=['../../config/logger','api','request-promise','rimraf','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda54,0xa3));var _0x4da5=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xda54[_0x45313f];return _0x402910;};'use strict';var _=require(_0x4da5('0x0'));var util=require(_0x4da5('0x1'));var logger=require(_0x4da5('0x2'))(_0x4da5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4da5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4da5('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x419789,_0x5bbbcb){return _0x419789[_0x4da5('0x6')](_0x4da5('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x4da5('0x8'),'fields':[_0x4da5('0x9'),_0x4da5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc196=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x154f0a,_0x3b9f03){var _0x580a02=function(_0xed88e4){while(--_0xed88e4){_0x154f0a['push'](_0x154f0a['shift']());}};_0x580a02(++_0x3b9f03);}(_0xc196,0x1bc));var _0x6c19=function(_0x752a8e,_0x1c10ad){_0x752a8e=_0x752a8e-0x0;var _0x52d88e=_0xc196[_0x752a8e];return _0x52d88e;};'use strict';var _=require(_0x6c19('0x0'));var util=require(_0x6c19('0x1'));var logger=require(_0x6c19('0x2'))(_0x6c19('0x3'));var moment=require(_0x6c19('0x4'));var BPromise=require(_0x6c19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c19('0x6'));var config=require(_0x6c19('0x7'));var attributes=require(_0x6c19('0x8'));module[_0x6c19('0x9')]=function(_0x448488,_0x589fd3){return _0x448488[_0x6c19('0xa')](_0x6c19('0xb'),attributes,{'tableName':_0x6c19('0xc'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6c19('0xd'),_0x6c19('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d64609e..04f7b42 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 _0x2212=['result','catch','UserProfileSection,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x54a53a,_0x29bc5a){var _0x1e8847=function(_0x25bfef){while(--_0x25bfef){_0x54a53a['push'](_0x54a53a['shift']());}};_0x1e8847(++_0x29bc5a);}(_0x2212,0x163));var _0x2221=function(_0x37184b,_0x55deb9){_0x37184b=_0x37184b-0x0;var _0x885d0c=_0x2212[_0x37184b];return _0x885d0c;};'use strict';var _=require(_0x2221('0x0'));var util=require(_0x2221('0x1'));var moment=require(_0x2221('0x2'));var BPromise=require('bluebird');var rs=require(_0x2221('0x3'));var fs=require('fs');var Redis=require(_0x2221('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2221('0x5'));var logger=require('../../config/logger')(_0x2221('0x6'));var config=require(_0x2221('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2221('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a0aaa,_0x51fdf0,_0x2948e1){return new BPromise(function(_0x45a203,_0x1d876b){return client[_0x2221('0x9')](_0x1a0aaa,_0x2948e1)[_0x2221('0xa')](function(_0x4bfe33){logger[_0x2221('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x51fdf0,'request\x20sent');logger[_0x2221('0xc')](_0x2221('0xd'),_0x51fdf0,_0x2221('0xe'),JSON[_0x2221('0xf')](_0x4bfe33));if(_0x4bfe33[_0x2221('0x10')]){if(_0x4bfe33[_0x2221('0x10')][_0x2221('0x11')]===0x1f4){logger[_0x2221('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x51fdf0,_0x4bfe33['error']['message']);return _0x1d876b(_0x4bfe33[_0x2221('0x10')][_0x2221('0x12')]);}logger[_0x2221('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x51fdf0,_0x4bfe33[_0x2221('0x10')]['message']);return _0x45a203(_0x4bfe33[_0x2221('0x10')][_0x2221('0x12')]);}else{logger[_0x2221('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x51fdf0,'request\x20sent');_0x45a203(_0x4bfe33[_0x2221('0x13')][_0x2221('0x12')]);}})[_0x2221('0x14')](function(_0x138506){logger[_0x2221('0x10')](_0x2221('0x15'),_0x51fdf0,_0x138506);_0x1d876b(_0x138506);});});} \ No newline at end of file +var _0xdb31=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2dadb8,_0x5b14c1){var _0x5025b7=function(_0x435db9){while(--_0x435db9){_0x2dadb8['push'](_0x2dadb8['shift']());}};_0x5025b7(++_0x5b14c1);}(_0xdb31,0x169));var _0x1db3=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0xdb31[_0x191c44];return _0x1086cd;};'use strict';var _=require('lodash');var util=require(_0x1db3('0x0'));var moment=require(_0x1db3('0x1'));var BPromise=require(_0x1db3('0x2'));var rs=require(_0x1db3('0x3'));var fs=require('fs');var Redis=require(_0x1db3('0x4'));var db=require(_0x1db3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1db3('0x6'))('rpc');var config=require(_0x1db3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1db3('0x8')][_0x1db3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10664a,_0x5363c2,_0x159ece){return new BPromise(function(_0x241ce3,_0x472de6){return client[_0x1db3('0xa')](_0x10664a,_0x159ece)[_0x1db3('0xb')](function(_0x5992b2){logger['info'](_0x1db3('0xc'),_0x5363c2,_0x1db3('0xd'));logger[_0x1db3('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5363c2,_0x1db3('0xd'),JSON[_0x1db3('0xf')](_0x5992b2));if(_0x5992b2['error']){if(_0x5992b2[_0x1db3('0x10')][_0x1db3('0x11')]===0x1f4){logger[_0x1db3('0x10')](_0x1db3('0xc'),_0x5363c2,_0x5992b2[_0x1db3('0x10')][_0x1db3('0x12')]);return _0x472de6(_0x5992b2[_0x1db3('0x10')][_0x1db3('0x12')]);}logger[_0x1db3('0x10')](_0x1db3('0xc'),_0x5363c2,_0x5992b2['error'][_0x1db3('0x12')]);return _0x241ce3(_0x5992b2['error'][_0x1db3('0x12')]);}else{logger[_0x1db3('0x13')](_0x1db3('0xc'),_0x5363c2,_0x1db3('0xd'));_0x241ce3(_0x5992b2['result'][_0x1db3('0x12')]);}})[_0x1db3('0x14')](function(_0x3720b2){logger[_0x1db3('0x10')](_0x1db3('0xc'),_0x5363c2,_0x3720b2);_0x472de6(_0x3720b2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d222984..85415e4 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 _0x54ae=['express','Router','../../components/auth/service','../../config/environment','exports','util','connect-timeout'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x54ae,0x83));var _0xe54a=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x54ae[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require(_0xe54a('0x0'));var path=require('path');var timeout=require(_0xe54a('0x1'));var express=require(_0xe54a('0x2'));var router=express[_0xe54a('0x3')]();var auth=require(_0xe54a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe54a('0x5'));module[_0xe54a('0x6')]=router; \ No newline at end of file +var _0x3a55=['express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout'];(function(_0x278042,_0x1fc779){var _0x112f29=function(_0x2e0f36){while(--_0x2e0f36){_0x278042['push'](_0x278042['shift']());}};_0x112f29(++_0x1fc779);}(_0x3a55,0x1c5));var _0x53a5=function(_0x6a395,_0x5520ac){_0x6a395=_0x6a395-0x0;var _0x49a8d7=_0x3a55[_0x6a395];return _0x49a8d7;};'use strict';var multer=require(_0x53a5('0x0'));var util=require(_0x53a5('0x1'));var path=require('path');var timeout=require(_0x53a5('0x2'));var express=require(_0x53a5('0x3'));var router=express[_0x53a5('0x4')]();var auth=require(_0x53a5('0x5'));var interaction=require(_0x53a5('0x6'));var config=require('../../config/environment');module[_0x53a5('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 279554f..f5009ea 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x2cadf,_0x17ee5c){var _0x49bb28=function(_0x320466){while(--_0x320466){_0x2cadf['push'](_0x2cadf['shift']());}};_0x49bb28(++_0x17ee5c);}(_0xe706,0xa3));var _0x6e70=function(_0x6f5598,_0xabeb74){_0x6f5598=_0x6f5598-0x0;var _0x1e1325=_0xe706[_0x6f5598];return _0x1e1325;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x160cbc,_0x3025a6){var _0x4ac8c6=function(_0x27e1d3){while(--_0x27e1d3){_0x160cbc['push'](_0x160cbc['shift']());}};_0x4ac8c6(++_0x3025a6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b7ba0c1..2704c22 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 _0x10f3=['bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','../../config/logger'];(function(_0x2d39da,_0x3d1e0b){var _0x1fa4f7=function(_0x36fd82){while(--_0x36fd82){_0x2d39da['push'](_0x2d39da['shift']());}};_0x1fa4f7(++_0x3d1e0b);}(_0x10f3,0x13a));var _0x310f=function(_0x5272c1,_0x544827){_0x5272c1=_0x5272c1-0x0;var _0x300c0b=_0x10f3[_0x5272c1];return _0x300c0b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x310f('0x0'))('api');var moment=require('moment');var BPromise=require(_0x310f('0x1'));var rp=require(_0x310f('0x2'));var fs=require('fs');var path=require(_0x310f('0x3'));var rimraf=require('rimraf');var config=require(_0x310f('0x4'));var attributes=require(_0x310f('0x5'));module[_0x310f('0x6')]=function(_0x5e8259,_0x3a21c9){return _0x5e8259[_0x310f('0x7')]('UserSmsQueue',attributes,{'tableName':_0x310f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d2=['api','moment','path','rimraf','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x18203c,_0x4f0ea3){var _0x1d7a9b=function(_0x178103){while(--_0x178103){_0x18203c['push'](_0x18203c['shift']());}};_0x1d7a9b(++_0x4f0ea3);}(_0xd2d2,0x1e1));var _0x2d2d=function(_0x562afc,_0x10a4ed){_0x562afc=_0x562afc-0x0;var _0x20fced=_0xd2d2[_0x562afc];return _0x20fced;};'use strict';var _=require(_0x2d2d('0x0'));var util=require(_0x2d2d('0x1'));var logger=require(_0x2d2d('0x2'))(_0x2d2d('0x3'));var moment=require(_0x2d2d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d2d('0x5'));var rimraf=require(_0x2d2d('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d2d('0x7'));module[_0x2d2d('0x8')]=function(_0x4b69b1,_0x46f521){return _0x4b69b1[_0x2d2d('0x9')]('UserSmsQueue',attributes,{'tableName':_0x2d2d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2ae8188..57f2a48 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 _0xb821=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message'];(function(_0x2718d0,_0x345e8c){var _0x5c229b=function(_0x3f4414){while(--_0x3f4414){_0x2718d0['push'](_0x2718d0['shift']());}};_0x5c229b(++_0x345e8c);}(_0xb821,0x1b7));var _0x1b82=function(_0x2fc292,_0x34604){_0x2fc292=_0x2fc292-0x0;var _0x5ec078=_0xb821[_0x2fc292];return _0x5ec078;};'use strict';var _=require(_0x1b82('0x0'));var util=require(_0x1b82('0x1'));var moment=require(_0x1b82('0x2'));var BPromise=require(_0x1b82('0x3'));var rs=require(_0x1b82('0x4'));var fs=require('fs');var Redis=require(_0x1b82('0x5'));var db=require(_0x1b82('0x6'))['db'];var utils=require(_0x1b82('0x7'));var logger=require(_0x1b82('0x8'))('rpc');var config=require(_0x1b82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b82('0xa')][_0x1b82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x125cb4,_0x472e40,_0x49a59f){return new BPromise(function(_0x462f30,_0x11d165){return client['request'](_0x125cb4,_0x49a59f)[_0x1b82('0xc')](function(_0x1f3084){logger[_0x1b82('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x472e40,_0x1b82('0xe'));logger[_0x1b82('0xf')](_0x1b82('0x10'),_0x472e40,_0x1b82('0xe'),JSON['stringify'](_0x1f3084));if(_0x1f3084[_0x1b82('0x11')]){if(_0x1f3084[_0x1b82('0x11')][_0x1b82('0x12')]===0x1f4){logger['error'](_0x1b82('0x13'),_0x472e40,_0x1f3084['error'][_0x1b82('0x14')]);return _0x11d165(_0x1f3084[_0x1b82('0x11')]['message']);}logger[_0x1b82('0x11')](_0x1b82('0x13'),_0x472e40,_0x1f3084['error']['message']);return _0x462f30(_0x1f3084[_0x1b82('0x11')][_0x1b82('0x14')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x472e40,_0x1b82('0xe'));_0x462f30(_0x1f3084[_0x1b82('0x15')][_0x1b82('0x14')]);}})[_0x1b82('0x16')](function(_0x38dce4){logger[_0x1b82('0x11')](_0x1b82('0x13'),_0x472e40,_0x38dce4);_0x11d165(_0x38dce4);});});} \ No newline at end of file +var _0xe64c=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x4e0e8d,_0x59b67a){var _0x40fac1=function(_0x4fe6ca){while(--_0x4fe6ca){_0x4e0e8d['push'](_0x4e0e8d['shift']());}};_0x40fac1(++_0x59b67a);}(_0xe64c,0xab));var _0xce64=function(_0x48d8b1,_0x47a032){_0x48d8b1=_0x48d8b1-0x0;var _0x400859=_0xe64c[_0x48d8b1];return _0x400859;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce64('0x0'));var BPromise=require(_0xce64('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce64('0x2'));var db=require(_0xce64('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xce64('0x4'))('rpc');var config=require(_0xce64('0x5'));var jayson=require(_0xce64('0x6'));var client=jayson['client'][_0xce64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x238ece,_0x33163d,_0x404a75){return new BPromise(function(_0x4c9e8d,_0x3574af){return client[_0xce64('0x8')](_0x238ece,_0x404a75)[_0xce64('0x9')](function(_0xd0be05){logger[_0xce64('0xa')](_0xce64('0xb'),_0x33163d,_0xce64('0xc'));logger[_0xce64('0xd')](_0xce64('0xe'),_0x33163d,_0xce64('0xc'),JSON[_0xce64('0xf')](_0xd0be05));if(_0xd0be05[_0xce64('0x10')]){if(_0xd0be05[_0xce64('0x10')][_0xce64('0x11')]===0x1f4){logger[_0xce64('0x10')](_0xce64('0xb'),_0x33163d,_0xd0be05[_0xce64('0x10')][_0xce64('0x12')]);return _0x3574af(_0xd0be05[_0xce64('0x10')][_0xce64('0x12')]);}logger[_0xce64('0x10')](_0xce64('0xb'),_0x33163d,_0xd0be05[_0xce64('0x10')][_0xce64('0x12')]);return _0x4c9e8d(_0xd0be05['error']['message']);}else{logger[_0xce64('0xa')](_0xce64('0xb'),_0x33163d,_0xce64('0xc'));_0x4c9e8d(_0xd0be05['result'][_0xce64('0x12')]);}})[_0xce64('0x13')](function(_0x50ba57){logger['error'](_0xce64('0xb'),_0x33163d,_0x50ba57);_0x3574af(_0x50ba57);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 42623af..a30e228 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 _0xb105=['../../config/environment','exports','util','path','Router','../../components/interaction/service'];(function(_0x442b69,_0x492a39){var _0x4c4495=function(_0x4885d2){while(--_0x4885d2){_0x442b69['push'](_0x442b69['shift']());}};_0x4c4495(++_0x492a39);}(_0xb105,0x68));var _0x5b10=function(_0x5190fe,_0x261479){_0x5190fe=_0x5190fe-0x0;var _0x12c71d=_0xb105[_0x5190fe];return _0x12c71d;};'use strict';var multer=require('multer');var util=require(_0x5b10('0x0'));var path=require(_0x5b10('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b10('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b10('0x3'));var config=require(_0x5b10('0x4'));module[_0x5b10('0x5')]=router; \ No newline at end of file +var _0xfe7b=['../../config/environment','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0xb7a073,_0x1f70a8){var _0x22d038=function(_0x4ab974){while(--_0x4ab974){_0xb7a073['push'](_0xb7a073['shift']());}};_0x22d038(++_0x1f70a8);}(_0xfe7b,0x1a6));var _0xbfe7=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xfe7b[_0x644ecd];return _0x1c66ce;};'use strict';var multer=require(_0xbfe7('0x0'));var util=require('util');var path=require(_0xbfe7('0x1'));var timeout=require(_0xbfe7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbfe7('0x3'));var interaction=require(_0xbfe7('0x4'));var config=require(_0xbfe7('0x5'));module[_0xbfe7('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 09d2c3a..53e9bff 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x265afb,_0x506d74){var _0x312143=function(_0x26a071){while(--_0x26a071){_0x265afb['push'](_0x265afb['shift']());}};_0x312143(++_0x506d74);}(_0xe706,0xa3));var _0x6e70=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0xe706[_0x3d5e72];return _0x2230e4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0082853..4d00c34 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 _0xb7c8=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb7c8,0x119));var _0x8b7c=function(_0x299461,_0x368e9f){_0x299461=_0x299461-0x0;var _0x450bb8=_0xb7c8[_0x299461];return _0x450bb8;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x34f807,_0x3f9b45){var _0x570597=function(_0x27ac06){while(--_0x27ac06){_0x34f807['push'](_0x34f807['shift']());}};_0x570597(++_0x3f9b45);}(_0xed1f,0x6a));var _0xfed1=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xed1f[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'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 94fd1b7..dc140e7 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 _0xabdb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','ioredis'];(function(_0x34fdc8,_0x4b031c){var _0x19261d=function(_0x5aee10){while(--_0x5aee10){_0x34fdc8['push'](_0x34fdc8['shift']());}};_0x19261d(++_0x4b031c);}(_0xabdb,0x153));var _0xbabd=function(_0x47e843,_0x20873f){_0x47e843=_0x47e843-0x0;var _0x20e164=_0xabdb[_0x47e843];return _0x20e164;};'use strict';var _=require(_0xbabd('0x0'));var util=require(_0xbabd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbabd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbabd('0x3'));var logger=require(_0xbabd('0x4'))('rpc');var config=require(_0xbabd('0x5'));var jayson=require(_0xbabd('0x6'));var client=jayson[_0xbabd('0x7')][_0xbabd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571496,_0x5e3b4b,_0x55f424){return new BPromise(function(_0x2204e1,_0x3314de){return client['request'](_0x571496,_0x55f424)[_0xbabd('0x9')](function(_0x249ef4){logger[_0xbabd('0xa')](_0xbabd('0xb'),_0x5e3b4b,_0xbabd('0xc'));logger[_0xbabd('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5e3b4b,_0xbabd('0xc'),JSON[_0xbabd('0xe')](_0x249ef4));if(_0x249ef4[_0xbabd('0xf')]){if(_0x249ef4[_0xbabd('0xf')]['code']===0x1f4){logger[_0xbabd('0xf')](_0xbabd('0xb'),_0x5e3b4b,_0x249ef4[_0xbabd('0xf')][_0xbabd('0x10')]);return _0x3314de(_0x249ef4[_0xbabd('0xf')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x5e3b4b,_0x249ef4[_0xbabd('0xf')][_0xbabd('0x10')]);return _0x2204e1(_0x249ef4['error'][_0xbabd('0x10')]);}else{logger[_0xbabd('0xa')](_0xbabd('0xb'),_0x5e3b4b,_0xbabd('0xc'));_0x2204e1(_0x249ef4[_0xbabd('0x11')][_0xbabd('0x10')]);}})[_0xbabd('0x12')](function(_0xc26e7e){logger[_0xbabd('0xf')](_0xbabd('0xb'),_0x5e3b4b,_0xc26e7e);_0x3314de(_0xc26e7e);});});} \ No newline at end of file +var _0x010c=['request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x010c,0x1cd));var _0xc010=function(_0x186453,_0x3b626e){_0x186453=_0x186453-0x0;var _0x30bd3c=_0x010c[_0x186453];return _0x30bd3c;};'use strict';var _=require(_0xc010('0x0'));var util=require(_0xc010('0x1'));var moment=require('moment');var BPromise=require(_0xc010('0x2'));var rs=require(_0xc010('0x3'));var fs=require('fs');var Redis=require(_0xc010('0x4'));var db=require(_0xc010('0x5'))['db'];var utils=require(_0xc010('0x6'));var logger=require(_0xc010('0x7'))(_0xc010('0x8'));var config=require(_0xc010('0x9'));var jayson=require(_0xc010('0xa'));var client=jayson[_0xc010('0xb')][_0xc010('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x279c27,_0x50e090,_0x41ed3d){return new BPromise(function(_0x5f0741,_0x2f20d4){return client[_0xc010('0xd')](_0x279c27,_0x41ed3d)['then'](function(_0x559eb0){logger[_0xc010('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x50e090,'request\x20sent');logger[_0xc010('0xf')](_0xc010('0x10'),_0x50e090,'request\x20sent',JSON[_0xc010('0x11')](_0x559eb0));if(_0x559eb0[_0xc010('0x12')]){if(_0x559eb0[_0xc010('0x12')][_0xc010('0x13')]===0x1f4){logger['error'](_0xc010('0x14'),_0x50e090,_0x559eb0[_0xc010('0x12')][_0xc010('0x15')]);return _0x2f20d4(_0x559eb0['error'][_0xc010('0x15')]);}logger[_0xc010('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x50e090,_0x559eb0[_0xc010('0x12')]['message']);return _0x5f0741(_0x559eb0['error']['message']);}else{logger[_0xc010('0xe')](_0xc010('0x14'),_0x50e090,_0xc010('0x16'));_0x5f0741(_0x559eb0['result'][_0xc010('0x15')]);}})['catch'](function(_0x501a99){logger['error'](_0xc010('0x14'),_0x50e090,_0x501a99);_0x2f20d4(_0x501a99);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f7ae2e6..ee919ea 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 _0xe0cc=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5423bc,_0x539bb2){var _0x18c8f5=function(_0xbb14c8){while(--_0xbb14c8){_0x5423bc['push'](_0x5423bc['shift']());}};_0x18c8f5(++_0x539bb2);}(_0xe0cc,0x90));var _0xce0c=function(_0x3d57c3,_0x27cfd9){_0x3d57c3=_0x3d57c3-0x0;var _0x126613=_0xe0cc[_0x3d57c3];return _0x126613;};'use strict';var multer=require(_0xce0c('0x0'));var util=require(_0xce0c('0x1'));var path=require(_0xce0c('0x2'));var timeout=require(_0xce0c('0x3'));var express=require('express');var router=express[_0xce0c('0x4')]();var auth=require(_0xce0c('0x5'));var interaction=require(_0xce0c('0x6'));var config=require(_0xce0c('0x7'));module['exports']=router; \ No newline at end of file +var _0x4d58=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','express','Router'];(function(_0x22cd3a,_0x76b25d){var _0x53b8c5=function(_0x537677){while(--_0x537677){_0x22cd3a['push'](_0x22cd3a['shift']());}};_0x53b8c5(++_0x76b25d);}(_0x4d58,0x172));var _0x84d5=function(_0x514da5,_0x171efb){_0x514da5=_0x514da5-0x0;var _0x5b3071=_0x4d58[_0x514da5];return _0x5b3071;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x84d5('0x0'));var router=express[_0x84d5('0x1')]();var auth=require(_0x84d5('0x2'));var interaction=require(_0x84d5('0x3'));var config=require(_0x84d5('0x4'));module[_0x84d5('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index fd913b2..b6b4a47 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 _0xb182=['Required\x20by\x20Asterisk','queue_interface','STRING','INTEGER'];(function(_0x5d7012,_0x38cdfd){var _0x3833a9=function(_0x3177f5){while(--_0x3177f5){_0x5d7012['push'](_0x5d7012['shift']());}};_0x3833a9(++_0x38cdfd);}(_0xb182,0x18b));var _0x2b18=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xb182[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2b18('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2b18('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2b18('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b18('0x2'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x2b18('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x2b18('0x3')],'allowNull':![],'unique':_0x2b18('0x2'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x2b18('0x0')](0xb),'defaultValue':0x0,'comment':_0x2b18('0x1')},'paused':{'type':Sequelize[_0x2b18('0x0')](0xb),'defaultValue':0x0,'comment':_0x2b18('0x1')}}; \ No newline at end of file +var _0x7e73=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x350826,_0x3ac193){var _0x31e6f1=function(_0x566538){while(--_0x566538){_0x350826['push'](_0x350826['shift']());}};_0x31e6f1(++_0x3ac193);}(_0x7e73,0x8a));var _0x37e7=function(_0x455f4d,_0xbec8bb){_0x455f4d=_0x455f4d-0x0;var _0x590c77=_0x7e73[_0x455f4d];return _0x590c77;};'use strict';var Sequelize=require(_0x37e7('0x0'));module[_0x37e7('0x1')]={'uniqueid':{'type':Sequelize[_0x37e7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x37e7('0x3')},'membername':{'type':Sequelize[_0x37e7('0x4')],'allowNull':![],'comment':_0x37e7('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x37e7('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x37e7('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x37e7('0x4')],'allowNull':![],'unique':_0x37e7('0x5'),'comment':_0x37e7('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x37e7('0x3')},'paused':{'type':Sequelize[_0x37e7('0x2')](0xb),'defaultValue':0x0,'comment':_0x37e7('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 9121a78..d0d5db6 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 _0xc188=['UserVoiceQueueRt','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x3c3de6,_0x22bfb9){var _0x5732cb=function(_0x3a8668){while(--_0x3a8668){_0x3c3de6['push'](_0x3c3de6['shift']());}};_0x5732cb(++_0x22bfb9);}(_0xc188,0x11f));var _0x8c18=function(_0x304d85,_0x3bd383){_0x304d85=_0x304d85-0x0;var _0x570077=_0xc188[_0x304d85];return _0x570077;};'use strict';var EventEmitter=require(_0x8c18('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x8c18('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8c18('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c18('0x3'),'afterDestroy':_0x8c18('0x4')};function emitEvent(_0x1bdaaf){return function(_0x312a7f,_0x9fc0d4,_0xe9f3d7){UserVoiceQueueRtEvents['emit'](_0x1bdaaf+':'+_0x312a7f['id'],_0x312a7f);UserVoiceQueueRtEvents[_0x8c18('0x5')](_0x1bdaaf,_0x312a7f);_0xe9f3d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x8c18('0x6')](e,emitEvent(event));}}module[_0x8c18('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2c59=['emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x22ce39,_0x5286db){var _0x4a884a=function(_0x231f63){while(--_0x231f63){_0x22ce39['push'](_0x22ce39['shift']());}};_0x4a884a(++_0x5286db);}(_0x2c59,0x147));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x92c5('0x0'));var UserVoiceQueueRt=require(_0x92c5('0x1'))['db'][_0x92c5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x92c5('0x3')](0x0);var events={'afterCreate':_0x92c5('0x4'),'afterUpdate':_0x92c5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1c39d4){return function(_0x1c6a92,_0x2b9cfa,_0x597c35){UserVoiceQueueRtEvents[_0x92c5('0x6')](_0x1c39d4+':'+_0x1c6a92['id'],_0x1c6a92);UserVoiceQueueRtEvents[_0x92c5('0x6')](_0x1c39d4,_0x1c6a92);_0x597c35(null);};}for(var e in events){if(events[_0x92c5('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x92c5('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8fb5fe6..e02ea00 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 _0x06f0=['bluebird','request-promise','../../config/environment','UserVoiceQueueRt','lodash','util','../../config/logger','moment'];(function(_0x226cca,_0xc7facd){var _0x2e0be8=function(_0x57e38c){while(--_0x57e38c){_0x226cca['push'](_0x226cca['shift']());}};_0x2e0be8(++_0xc7facd);}(_0x06f0,0x1d4));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x006f('0x0'));var util=require(_0x006f('0x1'));var logger=require(_0x006f('0x2'))('api');var moment=require(_0x006f('0x3'));var BPromise=require(_0x006f('0x4'));var rp=require(_0x006f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x006f('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1d3ef7,_0x2fc812){return _0x1d3ef7['define'](_0x006f('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f8a=['bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x4df2b2,_0x5c454e){var _0x1b634f=function(_0x41312f){while(--_0x41312f){_0x4df2b2['push'](_0x4df2b2['shift']());}};_0x1b634f(++_0x5c454e);}(_0x6f8a,0x12e));var _0xa6f8=function(_0x2f6e14,_0x3d88a7){_0x2f6e14=_0x2f6e14-0x0;var _0x298dc1=_0x6f8a[_0x2f6e14];return _0x298dc1;};'use strict';var _=require(_0xa6f8('0x0'));var util=require(_0xa6f8('0x1'));var logger=require(_0xa6f8('0x2'))(_0xa6f8('0x3'));var moment=require('moment');var BPromise=require(_0xa6f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6f8('0x5'));var config=require(_0xa6f8('0x6'));var attributes=require(_0xa6f8('0x7'));module[_0xa6f8('0x8')]=function(_0x243fb9,_0xa17152){return _0x243fb9['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a84ae00..1c59f6a 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 _0x3f5e=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','debug','lodash','util','moment'];(function(_0x389a03,_0x380e6c){var _0xaf19ea=function(_0x3b93b1){while(--_0x3b93b1){_0x389a03['push'](_0x389a03['shift']());}};_0xaf19ea(++_0x380e6c);}(_0x3f5e,0xf9));var _0xe3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe3f5('0x0'));var util=require(_0xe3f5('0x1'));var moment=require(_0xe3f5('0x2'));var BPromise=require('bluebird');var rs=require(_0xe3f5('0x3'));var fs=require('fs');var Redis=require(_0xe3f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe3f5('0x5'))(_0xe3f5('0x6'));var config=require(_0xe3f5('0x7'));var jayson=require(_0xe3f5('0x8'));var client=jayson[_0xe3f5('0x9')]['http']({'port':0x232a});config['redis']=_[_0xe3f5('0xa')](config[_0xe3f5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3f5('0xc'))(new Redis(config[_0xe3f5('0xb')]));require(_0xe3f5('0xd'))[_0xe3f5('0xe')](socket);function respondWithRpcPromise(_0x191bac,_0xed293d,_0x595afa){return new BPromise(function(_0x2d5124,_0x46b7dc){return client[_0xe3f5('0xf')](_0x191bac,_0x595afa)[_0xe3f5('0x10')](function(_0x44c547){logger[_0xe3f5('0x11')](_0xe3f5('0x12'),_0xed293d,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xed293d,_0xe3f5('0x13'),JSON[_0xe3f5('0x14')](_0x44c547));if(_0x44c547[_0xe3f5('0x15')]){if(_0x44c547[_0xe3f5('0x15')][_0xe3f5('0x16')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0xed293d,_0x44c547[_0xe3f5('0x15')][_0xe3f5('0x17')]);return _0x46b7dc(_0x44c547[_0xe3f5('0x15')][_0xe3f5('0x17')]);}logger[_0xe3f5('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xed293d,_0x44c547[_0xe3f5('0x15')][_0xe3f5('0x17')]);return _0x2d5124(_0x44c547[_0xe3f5('0x15')][_0xe3f5('0x17')]);}else{logger[_0xe3f5('0x11')](_0xe3f5('0x12'),_0xed293d,_0xe3f5('0x13'));_0x2d5124(_0x44c547[_0xe3f5('0x18')][_0xe3f5('0x17')]);}})[_0xe3f5('0x19')](function(_0x55bd79){logger[_0xe3f5('0x15')](_0xe3f5('0x12'),_0xed293d,_0x55bd79);_0x46b7dc(_0x55bd79);});});}exports['GetVoiceQueueRtPauses']=function(_0x1d5414){var _0x8e8177=this;return new Promise(function(_0x367a70,_0x11a99e){return db[_0xe3f5('0x1a')]['findAll']({'raw':_0x1d5414[_0xe3f5('0x1b')]?_0x1d5414['options'][_0xe3f5('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d5414[_0xe3f5('0x1b')]?_0x1d5414[_0xe3f5('0x1b')][_0xe3f5('0x1d')]||null:null,'attributes':[[db[_0xe3f5('0x1e')]['fn'](_0xe3f5('0x1f'),db['sequelize']['fn']('IF',db[_0xe3f5('0x1e')][_0xe3f5('0x20')](_0xe3f5('0x21')))),'outboundQueuePauses']]})[_0xe3f5('0x10')](function(_0x223cfe){logger[_0xe3f5('0x11')](_0xe3f5('0x22'),_0x1d5414);logger[_0xe3f5('0x23')]('GetVoiceQueueRtPauses',_0x1d5414,JSON[_0xe3f5('0x14')](_0x223cfe));_0x367a70(_0x223cfe);})[_0xe3f5('0x19')](function(_0x177286){logger[_0xe3f5('0x15')](_0xe3f5('0x22'),_0x177286['message'],_0x1d5414);_0x11a99e(_0x8e8177[_0xe3f5('0x15')](0x1f4,_0x177286[_0xe3f5('0x17')]));});});}; \ No newline at end of file +var _0x7a6a=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x886693,_0x541621){var _0x8d7e2f=function(_0x271650){while(--_0x271650){_0x886693['push'](_0x886693['shift']());}};_0x8d7e2f(++_0x541621);}(_0x7a6a,0xe4));var _0xa7a6=function(_0x1227c0,_0x5d91ee){_0x1227c0=_0x1227c0-0x0;var _0x557d9d=_0x7a6a[_0x1227c0];return _0x557d9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa7a6('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7a6('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7a6('0x2'));var logger=require(_0xa7a6('0x3'))(_0xa7a6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa7a6('0x5')]['http']({'port':0x232a});config[_0xa7a6('0x6')]=_[_0xa7a6('0x7')](config[_0xa7a6('0x6')],{'host':_0xa7a6('0x8'),'port':0x18eb});var socket=require(_0xa7a6('0x9'))(new Redis(config[_0xa7a6('0x6')]));require(_0xa7a6('0xa'))[_0xa7a6('0xb')](socket);function respondWithRpcPromise(_0x52ef83,_0x20c0d6,_0x51c078){return new BPromise(function(_0x5c9b29,_0x800b70){return client[_0xa7a6('0xc')](_0x52ef83,_0x51c078)[_0xa7a6('0xd')](function(_0x3a3bc6){logger[_0xa7a6('0xe')](_0xa7a6('0xf'),_0x20c0d6,_0xa7a6('0x10'));logger[_0xa7a6('0x11')](_0xa7a6('0x12'),_0x20c0d6,_0xa7a6('0x10'),JSON[_0xa7a6('0x13')](_0x3a3bc6));if(_0x3a3bc6[_0xa7a6('0x14')]){if(_0x3a3bc6['error'][_0xa7a6('0x15')]===0x1f4){logger['error'](_0xa7a6('0xf'),_0x20c0d6,_0x3a3bc6[_0xa7a6('0x14')][_0xa7a6('0x16')]);return _0x800b70(_0x3a3bc6['error'][_0xa7a6('0x16')]);}logger['error'](_0xa7a6('0xf'),_0x20c0d6,_0x3a3bc6[_0xa7a6('0x14')]['message']);return _0x5c9b29(_0x3a3bc6[_0xa7a6('0x14')]['message']);}else{logger[_0xa7a6('0xe')](_0xa7a6('0xf'),_0x20c0d6,'request\x20sent');_0x5c9b29(_0x3a3bc6[_0xa7a6('0x17')]['message']);}})[_0xa7a6('0x18')](function(_0xfc0cc5){logger[_0xa7a6('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x20c0d6,_0xfc0cc5);_0x800b70(_0xfc0cc5);});});}exports[_0xa7a6('0x19')]=function(_0x577ac2){var _0x14d58f=this;return new Promise(function(_0x531490,_0x9bd1c9){return db[_0xa7a6('0x1a')][_0xa7a6('0x1b')]({'raw':_0x577ac2[_0xa7a6('0x1c')]?_0x577ac2[_0xa7a6('0x1c')][_0xa7a6('0x1d')]===undefined?!![]:![]:!![],'where':_0x577ac2[_0xa7a6('0x1c')]?_0x577ac2[_0xa7a6('0x1c')]['where']||null:null,'attributes':[[db[_0xa7a6('0x1e')]['fn'](_0xa7a6('0x1f'),db[_0xa7a6('0x1e')]['fn']('IF',db[_0xa7a6('0x1e')][_0xa7a6('0x20')](_0xa7a6('0x21')))),_0xa7a6('0x22')]]})[_0xa7a6('0xd')](function(_0x5647ab){logger[_0xa7a6('0xe')]('GetVoiceQueueRtPauses',_0x577ac2);logger[_0xa7a6('0x11')](_0xa7a6('0x19'),_0x577ac2,JSON[_0xa7a6('0x13')](_0x5647ab));_0x531490(_0x5647ab);})[_0xa7a6('0x18')](function(_0x2daf05){logger[_0xa7a6('0x14')](_0xa7a6('0x19'),_0x2daf05[_0xa7a6('0x16')],_0x577ac2);_0x9bd1c9(_0x14d58f['error'](0x1f4,_0x2daf05[_0xa7a6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2d7abe0..fe1c093 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 _0x66f1=['emit','removeListener','register','length','./userVoiceQueueRt.events','save','remove','update'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x66f1,0xf4));var _0x166f=function(_0x5557c2,_0x37de81){_0x5557c2=_0x5557c2-0x0;var _0x2c1eff=_0x66f1[_0x5557c2];return _0x2c1eff;};'use strict';var UserVoiceQueueRtEvents=require(_0x166f('0x0'));var events=[_0x166f('0x1'),_0x166f('0x2'),_0x166f('0x3')];function createListener(_0x2db553,_0x1d54ad){return function(_0x248e45){_0x1d54ad[_0x166f('0x4')](_0x2db553,_0x248e45);};}function removeListener(_0x7de522,_0x1d7592){return function(){UserVoiceQueueRtEvents[_0x166f('0x5')](_0x7de522,_0x1d7592);};}exports[_0x166f('0x6')]=function(_0x5ee7c0){for(var _0x45b380=0x0,_0x5bf5d2=events[_0x166f('0x7')];_0x45b380<_0x5bf5d2;_0x45b380++){var _0x1cd867=events[_0x45b380];var _0x2fc951=createListener('userVoiceQueueRt:'+_0x1cd867,_0x5ee7c0);UserVoiceQueueRtEvents['on'](_0x1cd867,_0x2fc951);}}; \ No newline at end of file +var _0xd6b2=['emit','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x33d9da,_0x327684){var _0x5c4fd2=function(_0x4bde3e){while(--_0x4bde3e){_0x33d9da['push'](_0x33d9da['shift']());}};_0x5c4fd2(++_0x327684);}(_0xd6b2,0x15f));var _0x2d6b=function(_0x59cb48,_0x3e9b50){_0x59cb48=_0x59cb48-0x0;var _0x45b4d5=_0xd6b2[_0x59cb48];return _0x45b4d5;};'use strict';var UserVoiceQueueRtEvents=require(_0x2d6b('0x0'));var events=['save',_0x2d6b('0x1'),_0x2d6b('0x2')];function createListener(_0x33bd79,_0x134c0f){return function(_0x3730e2){_0x134c0f[_0x2d6b('0x3')](_0x33bd79,_0x3730e2);};}function removeListener(_0x242438,_0x4f1755){return function(){UserVoiceQueueRtEvents['removeListener'](_0x242438,_0x4f1755);};}exports[_0x2d6b('0x4')]=function(_0x178548){for(var _0x51630c=0x0,_0x2a22ae=events[_0x2d6b('0x5')];_0x51630c<_0x2a22ae;_0x51630c++){var _0x3556a9=events[_0x51630c];var _0x1f129a=createListener('userVoiceQueueRt:'+_0x3556a9,_0x178548);UserVoiceQueueRtEvents['on'](_0x3556a9,_0x1f129a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4fa8778..1849d9b 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 _0x19c9=['express','Router','path','connect-timeout'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x19c9,0x1be));var _0x919c=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x19c9[_0x29b609];return _0x54c952;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x919c('0x0'));var timeout=require(_0x919c('0x1'));var express=require(_0x919c('0x2'));var router=express[_0x919c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x070f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x070f,0x8d));var _0xf070=function(_0x1c8124,_0x5c5678){_0x1c8124=_0x1c8124-0x0;var _0x4cfb3f=_0x070f[_0x1c8124];return _0x4cfb3f;};'use strict';var multer=require(_0xf070('0x0'));var util=require('util');var path=require(_0xf070('0x1'));var timeout=require('connect-timeout');var express=require(_0xf070('0x2'));var router=express[_0xf070('0x3')]();var auth=require(_0xf070('0x4'));var interaction=require(_0xf070('0x5'));var config=require(_0xf070('0x6'));module[_0xf070('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 b866e75..3782ff9 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 _0xbaf0=['exports','INTEGER'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x403e9e,_0x98e742){var _0x54ea7a=function(_0x5330a4){while(--_0x5330a4){_0x403e9e['push'](_0x403e9e['shift']());}};_0x54ea7a(++_0x98e742);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b913a80..4e693ec 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 _0x1775=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util'];(function(_0x24bf01,_0x2a8ca3){var _0x246a08=function(_0x4e433a){while(--_0x4e433a){_0x24bf01['push'](_0x24bf01['shift']());}};_0x246a08(++_0x2a8ca3);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['request-promise','path','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird'];(function(_0x37b31c,_0x19ffd5){var _0x18cccc=function(_0x29f594){while(--_0x29f594){_0x37b31c['push'](_0x37b31c['shift']());}};_0x18cccc(++_0x19ffd5);}(_0x5204,0xdf));var _0x4520=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x5204[_0x374ccf];return _0x443cde;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'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 9c47327..db744bc 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41501f,_0x3b316b){var _0xafe3c8=function(_0x40ec33){while(--_0x40ec33){_0x41501f['push'](_0x41501f['shift']());}};_0xafe3c8(++_0x3b316b);}(_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 moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b2ed1,_0x57e8c8){var _0x3ac3bf=function(_0x32db42){while(--_0x32db42){_0x5b2ed1['push'](_0x5b2ed1['shift']());}};_0x3ac3bf(++_0x57e8c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2e195ac..768561e 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 _0x7095=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x602436,_0xbf433){var _0x504c33=function(_0x4770a0){while(--_0x4770a0){_0x602436['push'](_0x602436['shift']());}};_0x504c33(++_0xbf433);}(_0x7095,0xc8));var _0x5709=function(_0x4ea769,_0x12acc3){_0x4ea769=_0x4ea769-0x0;var _0x58fdd1=_0x7095[_0x4ea769];return _0x58fdd1;};'use strict';var multer=require(_0x5709('0x0'));var util=require(_0x5709('0x1'));var path=require('path');var timeout=require(_0x5709('0x2'));var express=require(_0x5709('0x3'));var router=express['Router']();var auth=require(_0x5709('0x4'));var interaction=require(_0x5709('0x5'));var config=require(_0x5709('0x6'));var controller=require(_0x5709('0x7'));router['get']('/',auth[_0x5709('0x8')](),controller['index']);router[_0x5709('0x9')](_0x5709('0xa'),auth[_0x5709('0x8')](),controller['show']);router[_0x5709('0xb')]('/',auth[_0x5709('0x8')](),controller['create']);router[_0x5709('0xc')](_0x5709('0xa'),auth['isAuthenticated'](),controller[_0x5709('0xd')]);router[_0x5709('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5709('0xf')]);module[_0x5709('0x10')]=router; \ No newline at end of file +var _0x868c=['update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','./variable.controller','get','isAuthenticated','index','/:id','put'];(function(_0x1aeb6d,_0x62d837){var _0x2f74d5=function(_0x1f8d8d){while(--_0x1f8d8d){_0x1aeb6d['push'](_0x1aeb6d['shift']());}};_0x2f74d5(++_0x62d837);}(_0x868c,0x11b));var _0xc868=function(_0x49f8c2,_0x5166b7){_0x49f8c2=_0x49f8c2-0x0;var _0x3e63ec=_0x868c[_0x49f8c2];return _0x3e63ec;};'use strict';var multer=require(_0xc868('0x0'));var util=require('util');var path=require(_0xc868('0x1'));var timeout=require(_0xc868('0x2'));var express=require('express');var router=express[_0xc868('0x3')]();var auth=require(_0xc868('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc868('0x5'));router[_0xc868('0x6')]('/',auth[_0xc868('0x7')](),controller[_0xc868('0x8')]);router[_0xc868('0x6')](_0xc868('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc868('0xa')]('/:id',auth[_0xc868('0x7')](),controller[_0xc868('0xb')]);router[_0xc868('0xc')](_0xc868('0x9'),auth[_0xc868('0x7')](),controller['destroy']);module[_0xc868('0xd')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d62967f..af69687 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 _0x2c22=['STRING','exports'];(function(_0x4f283c,_0x5db666){var _0xd26777=function(_0x93834b){while(--_0x93834b){_0x4f283c['push'](_0x4f283c['shift']());}};_0xd26777(++_0x5db666);}(_0x2c22,0xeb));var _0x22c2=function(_0x44810a,_0x23b6c3){_0x44810a=_0x44810a-0x0;var _0x1a5b64=_0x2c22[_0x44810a];return _0x1a5b64;};'use strict';var Sequelize=require('sequelize');module[_0x22c2('0x0')]={'name':{'type':Sequelize[_0x22c2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a9b=['name','sequelize','exports','STRING'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x7a9b,0x8d));var _0xb7a9=function(_0x1e0f8d,_0xdaf2d8){_0x1e0f8d=_0x1e0f8d-0x0;var _0x14a089=_0x7a9b[_0x1e0f8d];return _0x14a089;};'use strict';var Sequelize=require(_0xb7a9('0x0'));module[_0xb7a9('0x1')]={'name':{'type':Sequelize[_0xb7a9('0x2')],'unique':_0xb7a9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb7a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 664d5d0..3c95759 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 _0x661f=['status','end','json','count','offset','limit','set','Content-Range','reject','save','then','Variables','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','Variable','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xb1b166,_0x27a312){var _0x5ee259=function(_0x1117ac){while(--_0x1117ac){_0xb1b166['push'](_0xb1b166['shift']());}};_0x5ee259(++_0x27a312);}(_0x661f,0x8c));var _0xf661=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x661f[_0x2261ce];return _0x524640;};'use strict';var pdf=require(_0xf661('0x0'));var emlformat=require(_0xf661('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf661('0x2'));var moment=require(_0xf661('0x3'));var BPromise=require(_0xf661('0x4'));var Mustache=require(_0xf661('0x5'));var util=require(_0xf661('0x6'));var path=require(_0xf661('0x7'));var sox=require(_0xf661('0x8'));var csv=require(_0xf661('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf661('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf661('0xb'));var toCsv=require(_0xf661('0x9'));var querystring=require(_0xf661('0xc'));var Papa=require(_0xf661('0xd'));var Redis=require(_0xf661('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf661('0xf'));var as=require(_0xf661('0x10'));var hardwareService=require(_0xf661('0x11'));var logger=require('../../config/logger')(_0xf661('0x12'));var utils=require(_0xf661('0x13'));var config=require(_0xf661('0x14'));var db=require(_0xf661('0x15'))['db'];function respondWithStatusCode(_0x3af476,_0x2a1e13){_0x2a1e13=_0x2a1e13||0xcc;return function(_0x5d2f30){if(_0x5d2f30){return _0x3af476['sendStatus'](_0x2a1e13);}return _0x3af476[_0xf661('0x16')](_0x2a1e13)[_0xf661('0x17')]();};}function respondWithResult(_0x13c937,_0x4b03ef){_0x4b03ef=_0x4b03ef||0xc8;return function(_0x5e2a4c){if(_0x5e2a4c){return _0x13c937[_0xf661('0x16')](_0x4b03ef)[_0xf661('0x18')](_0x5e2a4c);}};}function respondWithFilteredResult(_0x157e82,_0x44d64b){return function(_0x4a4610){if(_0x4a4610){var _0x530ae3=_0x4a4610[_0xf661('0x19')],_0x34f699=_0x44d64b[_0xf661('0x1a')],_0x51e5b4=_0x44d64b[_0xf661('0x1a')]+_0x44d64b[_0xf661('0x1b')],_0x43a92a;if(_0x51e5b4>=_0x530ae3){_0x51e5b4=_0x530ae3;_0x43a92a=0xc8;}else{_0x43a92a=0xce;}_0x157e82[_0xf661('0x16')](_0x43a92a);return _0x157e82[_0xf661('0x1c')](_0xf661('0x1d'),_0x34f699+'-'+_0x51e5b4+'/'+_0x530ae3)['json'](_0x4a4610);}return null;};}function patchUpdates(_0x4a7cdb){return function(_0x4194a7){try{jsonpatch['apply'](_0x4194a7,_0x4a7cdb,!![]);}catch(_0x11c5ef){return BPromise[_0xf661('0x1e')](_0x11c5ef);}return _0x4194a7[_0xf661('0x1f')]();};}function saveUpdates(_0x1d40db,_0x23528a){return function(_0x5ab193){if(_0x5ab193){return _0x5ab193['update'](_0x1d40db)[_0xf661('0x20')](function(_0x979729){return _0x979729;});}return null;};}function removeEntity(_0x17948,_0xf142ba){return function(_0x1d4193){if(_0x1d4193){return _0x1d4193['destroy']()[_0xf661('0x20')](function(){var _0x51319a=_0x1d4193['get']({'plain':!![]});var _0x49e0b0=_0xf661('0x21');return db[_0xf661('0x22')][_0xf661('0x23')]({'where':{'type':_0x49e0b0,'resourceId':_0x51319a['id']}})['then'](function(){return _0x1d4193;});})['then'](function(){_0x17948['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa78c54,_0x2aefda){return function(_0x47d32a){if(!_0x47d32a){_0xa78c54[_0xf661('0x24')](0x194);}return _0x47d32a;};}function handleError(_0x269290,_0x880d51){_0x880d51=_0x880d51||0x1f4;return function(_0x2e9cc5){logger[_0xf661('0x25')](_0x2e9cc5[_0xf661('0x26')]);if(_0x2e9cc5['name']){delete _0x2e9cc5['name'];}_0x269290['status'](_0x880d51)[_0xf661('0x27')](_0x2e9cc5);};}exports[_0xf661('0x28')]=function(_0x59f68f,_0x243c3c){var _0x125c9c={},_0x52e868={},_0x146bb8={'count':0x0,'rows':[]};var _0x1bc1b4=_[_0xf661('0x29')](db['Variable'][_0xf661('0x2a')],function(_0x5a07d2){return{'name':_0x5a07d2[_0xf661('0x2b')],'type':_0x5a07d2[_0xf661('0x2c')][_0xf661('0x2d')]};});_0x52e868[_0xf661('0x2e')]=_[_0xf661('0x29')](_0x1bc1b4,'name');_0x52e868[_0xf661('0x2f')]=_[_0xf661('0x30')](_0x59f68f[_0xf661('0x2f')]);_0x52e868[_0xf661('0x31')]=_[_0xf661('0x32')](_0x52e868['model'],_0x52e868['query']);_0x125c9c['attributes']=_[_0xf661('0x32')](_0x52e868[_0xf661('0x2e')],qs[_0xf661('0x33')](_0x59f68f['query']['fields']));_0x125c9c[_0xf661('0x34')]=_0x125c9c[_0xf661('0x34')][_0xf661('0x35')]?_0x125c9c[_0xf661('0x34')]:_0x52e868['model'];if(!_0x59f68f[_0xf661('0x2f')][_0xf661('0x36')](_0xf661('0x37'))){_0x125c9c[_0xf661('0x1b')]=qs[_0xf661('0x1b')](_0x59f68f[_0xf661('0x2f')]['limit']);_0x125c9c['offset']=qs[_0xf661('0x1a')](_0x59f68f[_0xf661('0x2f')][_0xf661('0x1a')]);}_0x125c9c['order']=qs['sort'](_0x59f68f[_0xf661('0x2f')][_0xf661('0x38')]);_0x125c9c[_0xf661('0x39')]=qs[_0xf661('0x31')](_[_0xf661('0x3a')](_0x59f68f[_0xf661('0x2f')],_0x52e868[_0xf661('0x31')]),_0x1bc1b4);if(_0x59f68f[_0xf661('0x2f')][_0xf661('0x3b')]){_0x125c9c[_0xf661('0x39')]=_[_0xf661('0x3c')](_0x125c9c[_0xf661('0x39')],{'$or':_['map'](_0x1bc1b4,function(_0x409723){if(_0x409723['type']!==_0xf661('0x3d')){var _0x50d8d8={};_0x50d8d8[_0x409723[_0xf661('0x3e')]]={'$like':'%'+_0x59f68f[_0xf661('0x2f')]['filter']+'%'};return _0x50d8d8;}})});}_0x125c9c=_[_0xf661('0x3c')]({},_0x125c9c,_0x59f68f[_0xf661('0x3f')]);var _0x33c2d4={'where':_0x125c9c[_0xf661('0x39')]};return db[_0xf661('0x40')][_0xf661('0x19')](_0x33c2d4)[_0xf661('0x20')](function(_0x176171){_0x146bb8[_0xf661('0x19')]=_0x176171;if(_0x59f68f[_0xf661('0x2f')][_0xf661('0x41')]){_0x125c9c[_0xf661('0x42')]=[{'all':!![]}];}return db[_0xf661('0x40')]['findAll'](_0x125c9c);})[_0xf661('0x20')](function(_0x1a17ae){_0x146bb8[_0xf661('0x43')]=_0x1a17ae;return _0x146bb8;})[_0xf661('0x20')](respondWithFilteredResult(_0x243c3c,_0x125c9c))[_0xf661('0x44')](handleError(_0x243c3c,null));};exports[_0xf661('0x45')]=function(_0x1013be,_0xba9d90){var _0x40f8b8={'raw':!![],'where':{'id':_0x1013be[_0xf661('0x46')]['id']}},_0xfdbcdc={};_0xfdbcdc[_0xf661('0x2e')]=_[_0xf661('0x30')](db[_0xf661('0x40')][_0xf661('0x2a')]);_0xfdbcdc['query']=_[_0xf661('0x30')](_0x1013be[_0xf661('0x2f')]);_0xfdbcdc['filters']=_[_0xf661('0x32')](_0xfdbcdc[_0xf661('0x2e')],_0xfdbcdc[_0xf661('0x2f')]);_0x40f8b8[_0xf661('0x34')]=_[_0xf661('0x32')](_0xfdbcdc['model'],qs['fields'](_0x1013be[_0xf661('0x2f')][_0xf661('0x33')]));_0x40f8b8[_0xf661('0x34')]=_0x40f8b8[_0xf661('0x34')][_0xf661('0x35')]?_0x40f8b8[_0xf661('0x34')]:_0xfdbcdc[_0xf661('0x2e')];if(_0x1013be['query'][_0xf661('0x41')]){_0x40f8b8[_0xf661('0x42')]=[{'all':!![]}];}_0x40f8b8=_[_0xf661('0x3c')]({},_0x40f8b8,_0x1013be['options']);return db['Variable'][_0xf661('0x47')](_0x40f8b8)['then'](handleEntityNotFound(_0xba9d90,null))[_0xf661('0x20')](respondWithResult(_0xba9d90,null))[_0xf661('0x44')](handleError(_0xba9d90,null));};exports[_0xf661('0x48')]=function(_0x503aa2,_0xae571b){return db[_0xf661('0x40')][_0xf661('0x48')](_0x503aa2[_0xf661('0x49')],{})[_0xf661('0x20')](function(_0x427a09){var _0x48e90f=_0x503aa2[_0xf661('0x4a')][_0xf661('0x4b')]({'plain':!![]});if(!_0x48e90f)throw new Error(_0xf661('0x4c'));if(_0x48e90f['role']==='user'){var _0x596489=_0x427a09[_0xf661('0x4b')]({'plain':!![]});var _0x3b3a6a=_0xf661('0x21');return db[_0xf661('0x4d')][_0xf661('0x47')]({'where':{'name':_0x3b3a6a,'userProfileId':_0x48e90f[_0xf661('0x4e')]},'raw':!![]})[_0xf661('0x20')](function(_0x52b8c5){if(_0x52b8c5&&_0x52b8c5[_0xf661('0x4f')]===0x0){return db[_0xf661('0x22')][_0xf661('0x48')]({'name':_0x596489['name'],'resourceId':_0x596489['id'],'type':_0x52b8c5[_0xf661('0x3e')],'sectionId':_0x52b8c5['id']},{})[_0xf661('0x20')](function(){return _0x427a09;});}else{return _0x427a09;}})[_0xf661('0x44')](function(_0x597dd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x597dd4);throw _0x597dd4;});}return _0x427a09;})[_0xf661('0x20')](respondWithResult(_0xae571b,0xc9))[_0xf661('0x44')](handleError(_0xae571b,null));};exports[_0xf661('0x50')]=function(_0x344fb8,_0xcabdb0){if(_0x344fb8['body']['id']){delete _0x344fb8[_0xf661('0x49')]['id'];}return db['Variable'][_0xf661('0x47')]({'where':{'id':_0x344fb8[_0xf661('0x46')]['id']}})[_0xf661('0x20')](handleEntityNotFound(_0xcabdb0,null))['then'](saveUpdates(_0x344fb8[_0xf661('0x49')],null))[_0xf661('0x20')](respondWithResult(_0xcabdb0,null))[_0xf661('0x44')](handleError(_0xcabdb0,null));};exports['destroy']=function(_0x1e8d6e,_0x225356){return db[_0xf661('0x40')][_0xf661('0x47')]({'where':{'id':_0x1e8d6e['params']['id']}})[_0xf661('0x20')](handleEntityNotFound(_0x225356,null))[_0xf661('0x20')](removeEntity(_0x225356,null))[_0xf661('0x44')](handleError(_0x225356,null));}; \ No newline at end of file +var _0x9942=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','Variables','end','stack','name','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','merge','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3f889c,_0x1c16af){var _0x5edf2a=function(_0x5adbc1){while(--_0x5adbc1){_0x3f889c['push'](_0x3f889c['shift']());}};_0x5edf2a(++_0x1c16af);}(_0x9942,0x8a));var _0x2994=function(_0xb1efb7,_0x1ce9e6){_0xb1efb7=_0xb1efb7-0x0;var _0x440e13=_0x9942[_0xb1efb7];return _0x440e13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2994('0x0'));var rimraf=require(_0x2994('0x1'));var zipdir=require(_0x2994('0x2'));var jsonpatch=require(_0x2994('0x3'));var rp=require('request-promise');var moment=require(_0x2994('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2994('0x5'));var util=require('util');var path=require(_0x2994('0x6'));var sox=require(_0x2994('0x7'));var csv=require('to-csv');var ejs=require(_0x2994('0x8'));var fs=require('fs');var _=require(_0x2994('0x9'));var squel=require(_0x2994('0xa'));var crypto=require(_0x2994('0xb'));var jsforce=require(_0x2994('0xc'));var deskjs=require(_0x2994('0xd'));var toCsv=require(_0x2994('0xe'));var querystring=require(_0x2994('0xf'));var Papa=require(_0x2994('0x10'));var Redis=require(_0x2994('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2994('0x12'));var as=require(_0x2994('0x13'));var hardwareService=require(_0x2994('0x14'));var logger=require(_0x2994('0x15'))(_0x2994('0x16'));var utils=require(_0x2994('0x17'));var config=require(_0x2994('0x18'));var db=require(_0x2994('0x19'))['db'];function respondWithStatusCode(_0x27198f,_0x587d38){_0x587d38=_0x587d38||0xcc;return function(_0x3adc0e){if(_0x3adc0e){return _0x27198f[_0x2994('0x1a')](_0x587d38);}return _0x27198f[_0x2994('0x1b')](_0x587d38)['end']();};}function respondWithResult(_0x5661d6,_0x27a95f){_0x27a95f=_0x27a95f||0xc8;return function(_0x5b220f){if(_0x5b220f){return _0x5661d6[_0x2994('0x1b')](_0x27a95f)[_0x2994('0x1c')](_0x5b220f);}};}function respondWithFilteredResult(_0x1a5287,_0x39bcf9){return function(_0x4160ef){if(_0x4160ef){var _0x5416ca=_0x4160ef[_0x2994('0x1d')],_0x4cf625=_0x39bcf9[_0x2994('0x1e')],_0x5cbe14=_0x39bcf9[_0x2994('0x1e')]+_0x39bcf9[_0x2994('0x1f')],_0x2814a3;if(_0x5cbe14>=_0x5416ca){_0x5cbe14=_0x5416ca;_0x2814a3=0xc8;}else{_0x2814a3=0xce;}_0x1a5287[_0x2994('0x1b')](_0x2814a3);return _0x1a5287[_0x2994('0x20')]('Content-Range',_0x4cf625+'-'+_0x5cbe14+'/'+_0x5416ca)[_0x2994('0x1c')](_0x4160ef);}return null;};}function patchUpdates(_0x69bfd1){return function(_0x4032d0){try{jsonpatch['apply'](_0x4032d0,_0x69bfd1,!![]);}catch(_0xb88bd){return BPromise[_0x2994('0x21')](_0xb88bd);}return _0x4032d0[_0x2994('0x22')]();};}function saveUpdates(_0x5e9f22,_0x3c5243){return function(_0x3f4bd8){if(_0x3f4bd8){return _0x3f4bd8[_0x2994('0x23')](_0x5e9f22)[_0x2994('0x24')](function(_0x14570b){return _0x14570b;});}return null;};}function removeEntity(_0x3e8f71,_0x388203){return function(_0x5ceea1){if(_0x5ceea1){return _0x5ceea1[_0x2994('0x25')]()[_0x2994('0x24')](function(){var _0x311910=_0x5ceea1['get']({'plain':!![]});var _0x349bd6=_0x2994('0x26');return db['UserProfileResource'][_0x2994('0x25')]({'where':{'type':_0x349bd6,'resourceId':_0x311910['id']}})[_0x2994('0x24')](function(){return _0x5ceea1;});})[_0x2994('0x24')](function(){_0x3e8f71[_0x2994('0x1b')](0xcc)[_0x2994('0x27')]();});}};}function handleEntityNotFound(_0x142e3a,_0x3aabd4){return function(_0x3cad5b){if(!_0x3cad5b){_0x142e3a[_0x2994('0x1a')](0x194);}return _0x3cad5b;};}function handleError(_0x1d00a2,_0x38ed57){_0x38ed57=_0x38ed57||0x1f4;return function(_0x393a76){logger['error'](_0x393a76[_0x2994('0x28')]);if(_0x393a76['name']){delete _0x393a76[_0x2994('0x29')];}_0x1d00a2['status'](_0x38ed57)['send'](_0x393a76);};}exports['index']=function(_0x1cf943,_0x542555){var _0x5d0c66={},_0x37748a={},_0x5ebf2e={'count':0x0,'rows':[]};var _0x58ec2d=_[_0x2994('0x2a')](db[_0x2994('0x2b')][_0x2994('0x2c')],function(_0x23089c){return{'name':_0x23089c[_0x2994('0x2d')],'type':_0x23089c[_0x2994('0x2e')][_0x2994('0x2f')]};});_0x37748a[_0x2994('0x30')]=_[_0x2994('0x2a')](_0x58ec2d,_0x2994('0x29'));_0x37748a[_0x2994('0x31')]=_[_0x2994('0x32')](_0x1cf943[_0x2994('0x31')]);_0x37748a[_0x2994('0x33')]=_[_0x2994('0x34')](_0x37748a[_0x2994('0x30')],_0x37748a[_0x2994('0x31')]);_0x5d0c66[_0x2994('0x35')]=_[_0x2994('0x34')](_0x37748a[_0x2994('0x30')],qs[_0x2994('0x36')](_0x1cf943[_0x2994('0x31')][_0x2994('0x36')]));_0x5d0c66[_0x2994('0x35')]=_0x5d0c66['attributes'][_0x2994('0x37')]?_0x5d0c66[_0x2994('0x35')]:_0x37748a[_0x2994('0x30')];if(!_0x1cf943[_0x2994('0x31')][_0x2994('0x38')]('nolimit')){_0x5d0c66[_0x2994('0x1f')]=qs[_0x2994('0x1f')](_0x1cf943[_0x2994('0x31')][_0x2994('0x1f')]);_0x5d0c66[_0x2994('0x1e')]=qs[_0x2994('0x1e')](_0x1cf943['query'][_0x2994('0x1e')]);}_0x5d0c66['order']=qs[_0x2994('0x39')](_0x1cf943['query'][_0x2994('0x39')]);_0x5d0c66[_0x2994('0x3a')]=qs['filters'](_['pick'](_0x1cf943['query'],_0x37748a[_0x2994('0x33')]),_0x58ec2d);if(_0x1cf943[_0x2994('0x31')][_0x2994('0x3b')]){_0x5d0c66[_0x2994('0x3a')]=_['merge'](_0x5d0c66[_0x2994('0x3a')],{'$or':_[_0x2994('0x2a')](_0x58ec2d,function(_0x1c7796){if(_0x1c7796[_0x2994('0x2e')]!==_0x2994('0x3c')){var _0x4b703a={};_0x4b703a[_0x1c7796[_0x2994('0x29')]]={'$like':'%'+_0x1cf943['query']['filter']+'%'};return _0x4b703a;}})});}_0x5d0c66=_['merge']({},_0x5d0c66,_0x1cf943['options']);var _0x3bf9ab={'where':_0x5d0c66[_0x2994('0x3a')]};return db['Variable'][_0x2994('0x1d')](_0x3bf9ab)[_0x2994('0x24')](function(_0x456c0c){_0x5ebf2e[_0x2994('0x1d')]=_0x456c0c;if(_0x1cf943[_0x2994('0x31')][_0x2994('0x3d')]){_0x5d0c66[_0x2994('0x3e')]=[{'all':!![]}];}return db[_0x2994('0x2b')][_0x2994('0x3f')](_0x5d0c66);})[_0x2994('0x24')](function(_0x5702c5){_0x5ebf2e[_0x2994('0x40')]=_0x5702c5;return _0x5ebf2e;})[_0x2994('0x24')](respondWithFilteredResult(_0x542555,_0x5d0c66))[_0x2994('0x41')](handleError(_0x542555,null));};exports['show']=function(_0x114958,_0x1631fe){var _0x50c262={'raw':!![],'where':{'id':_0x114958['params']['id']}},_0x162653={};_0x162653[_0x2994('0x30')]=_[_0x2994('0x32')](db['Variable'][_0x2994('0x2c')]);_0x162653[_0x2994('0x31')]=_[_0x2994('0x32')](_0x114958[_0x2994('0x31')]);_0x162653['filters']=_[_0x2994('0x34')](_0x162653[_0x2994('0x30')],_0x162653[_0x2994('0x31')]);_0x50c262[_0x2994('0x35')]=_[_0x2994('0x34')](_0x162653['model'],qs[_0x2994('0x36')](_0x114958[_0x2994('0x31')][_0x2994('0x36')]));_0x50c262[_0x2994('0x35')]=_0x50c262[_0x2994('0x35')][_0x2994('0x37')]?_0x50c262[_0x2994('0x35')]:_0x162653[_0x2994('0x30')];if(_0x114958[_0x2994('0x31')][_0x2994('0x3d')]){_0x50c262['include']=[{'all':!![]}];}_0x50c262=_[_0x2994('0x42')]({},_0x50c262,_0x114958[_0x2994('0x43')]);return db['Variable'][_0x2994('0x44')](_0x50c262)['then'](handleEntityNotFound(_0x1631fe,null))[_0x2994('0x24')](respondWithResult(_0x1631fe,null))[_0x2994('0x41')](handleError(_0x1631fe,null));};exports['create']=function(_0xcebc1c,_0x1aa549){return db[_0x2994('0x2b')][_0x2994('0x45')](_0xcebc1c[_0x2994('0x46')],{})[_0x2994('0x24')](function(_0x3f7ea7){var _0x237551=_0xcebc1c['user'][_0x2994('0x47')]({'plain':!![]});if(!_0x237551)throw new Error(_0x2994('0x48'));if(_0x237551['role']===_0x2994('0x49')){var _0x407af7=_0x3f7ea7['get']({'plain':!![]});var _0x31edbb=_0x2994('0x26');return db[_0x2994('0x4a')][_0x2994('0x44')]({'where':{'name':_0x31edbb,'userProfileId':_0x237551['userProfileId']},'raw':!![]})[_0x2994('0x24')](function(_0x274721){if(_0x274721&&_0x274721[_0x2994('0x4b')]===0x0){return db[_0x2994('0x4c')][_0x2994('0x45')]({'name':_0x407af7[_0x2994('0x29')],'resourceId':_0x407af7['id'],'type':_0x274721[_0x2994('0x29')],'sectionId':_0x274721['id']},{})['then'](function(){return _0x3f7ea7;});}else{return _0x3f7ea7;}})[_0x2994('0x41')](function(_0x22b1cd){logger[_0x2994('0x4d')](_0x2994('0x4e'),_0x22b1cd);throw _0x22b1cd;});}return _0x3f7ea7;})['then'](respondWithResult(_0x1aa549,0xc9))[_0x2994('0x41')](handleError(_0x1aa549,null));};exports[_0x2994('0x23')]=function(_0x2bed61,_0x35edf9){if(_0x2bed61[_0x2994('0x46')]['id']){delete _0x2bed61['body']['id'];}return db['Variable'][_0x2994('0x44')]({'where':{'id':_0x2bed61[_0x2994('0x4f')]['id']}})[_0x2994('0x24')](handleEntityNotFound(_0x35edf9,null))['then'](saveUpdates(_0x2bed61['body'],null))['then'](respondWithResult(_0x35edf9,null))[_0x2994('0x41')](handleError(_0x35edf9,null));};exports['destroy']=function(_0xb392bc,_0x377215){return db[_0x2994('0x2b')]['find']({'where':{'id':_0xb392bc[_0x2994('0x4f')]['id']}})[_0x2994('0x24')](handleEntityNotFound(_0x377215,null))[_0x2994('0x24')](removeEntity(_0x377215,null))[_0x2994('0x41')](handleError(_0x377215,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 36eb290..0e608f6 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 _0xbe0f=['util','moment','request-promise','rimraf','../../config/environment','./variable.attributes','Variable','tools_variables','lodash'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0xbe0f,0x1d3));var _0xfbe0=function(_0x36c04e,_0x41ea8f){_0x36c04e=_0x36c04e-0x0;var _0x445a49=_0xbe0f[_0x36c04e];return _0x445a49;};'use strict';var _=require(_0xfbe0('0x0'));var util=require(_0xfbe0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfbe0('0x2'));var BPromise=require('bluebird');var rp=require(_0xfbe0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbe0('0x4'));var config=require(_0xfbe0('0x5'));var attributes=require(_0xfbe0('0x6'));module['exports']=function(_0x397f1e,_0x3fc207){return _0x397f1e['define'](_0xfbe0('0x7'),attributes,{'tableName':_0xfbe0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad26=['api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0xad26,0x1ab));var _0x6ad2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xad26[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6ad2('0x0'));var util=require('util');var logger=require(_0x6ad2('0x1'))(_0x6ad2('0x2'));var moment=require(_0x6ad2('0x3'));var BPromise=require(_0x6ad2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ad2('0x5'));var rimraf=require(_0x6ad2('0x6'));var config=require(_0x6ad2('0x7'));var attributes=require(_0x6ad2('0x8'));module[_0x6ad2('0x9')]=function(_0x4ca015,_0x1eb4d7){return _0x4ca015[_0x6ad2('0xa')](_0x6ad2('0xb'),attributes,{'tableName':_0x6ad2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 3476831..394f41b 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 _0x12b9=['moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowVariable','Variable','options','where','include','map','model','attributes','then','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x12b9,0x137));var _0x912b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x912b('0x0'));var util=require('util');var moment=require(_0x912b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x912b('0x2'));var db=require(_0x912b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x912b('0x4'));var config=require(_0x912b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x912b('0x6')][_0x912b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x323ded,_0x2f4e6e,_0x3f8e0c){return new BPromise(function(_0x696d37,_0x3f8f81){return client['request'](_0x323ded,_0x3f8e0c)['then'](function(_0x4d0872){logger[_0x912b('0x8')](_0x912b('0x9'),_0x2f4e6e,_0x912b('0xa'));logger[_0x912b('0xb')]('Variable,\x20%s,\x20%s,\x20%s',_0x2f4e6e,_0x912b('0xa'),JSON[_0x912b('0xc')](_0x4d0872));if(_0x4d0872[_0x912b('0xd')]){if(_0x4d0872[_0x912b('0xd')][_0x912b('0xe')]===0x1f4){logger[_0x912b('0xd')](_0x912b('0x9'),_0x2f4e6e,_0x4d0872[_0x912b('0xd')][_0x912b('0xf')]);return _0x3f8f81(_0x4d0872['error'][_0x912b('0xf')]);}logger[_0x912b('0xd')](_0x912b('0x9'),_0x2f4e6e,_0x4d0872[_0x912b('0xd')][_0x912b('0xf')]);return _0x696d37(_0x4d0872[_0x912b('0xd')][_0x912b('0xf')]);}else{logger['info'](_0x912b('0x9'),_0x2f4e6e,_0x912b('0xa'));_0x696d37(_0x4d0872['result'][_0x912b('0xf')]);}})[_0x912b('0x10')](function(_0x2b80ac){logger[_0x912b('0xd')](_0x912b('0x9'),_0x2f4e6e,_0x2b80ac);_0x3f8f81(_0x2b80ac);});});}exports[_0x912b('0x11')]=function(_0x545020){var _0x213bcf=this;return new Promise(function(_0x193448,_0x73e609){return db[_0x912b('0x12')]['find']({'raw':_0x545020['options']?_0x545020[_0x912b('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x545020['options']?_0x545020[_0x912b('0x13')][_0x912b('0x14')]||null:null,'attributes':_0x545020[_0x912b('0x13')]?_0x545020['options']['attributes']||null:null,'include':_0x545020[_0x912b('0x13')]?_0x545020[_0x912b('0x13')][_0x912b('0x15')]?_[_0x912b('0x16')](_0x545020[_0x912b('0x13')][_0x912b('0x15')],function(_0x3f01ba){return{'model':db[_0x3f01ba[_0x912b('0x17')]],'as':_0x3f01ba['as'],'attributes':_0x3f01ba[_0x912b('0x18')],'include':_0x3f01ba[_0x912b('0x15')]?_[_0x912b('0x16')](_0x3f01ba[_0x912b('0x15')],function(_0x16bd82){return{'model':db[_0x16bd82[_0x912b('0x17')]],'as':_0x16bd82['as'],'attributes':_0x16bd82[_0x912b('0x18')],'include':_0x16bd82[_0x912b('0x15')]?_[_0x912b('0x16')](_0x16bd82[_0x912b('0x15')],function(_0x2c503a){return{'model':db[_0x2c503a[_0x912b('0x17')]],'as':_0x2c503a['as'],'attributes':_0x2c503a[_0x912b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x912b('0x19')](function(_0x2c7143){logger[_0x912b('0x8')](_0x912b('0x11'),_0x545020);logger[_0x912b('0xb')](_0x912b('0x11'),_0x545020,JSON[_0x912b('0xc')](_0x2c7143));_0x193448(_0x2c7143);})[_0x912b('0x10')](function(_0x49da03){logger[_0x912b('0xd')]('ShowVariable',_0x49da03['message'],_0x545020);_0x73e609(_0x213bcf['error'](0x1f4,_0x49da03[_0x912b('0xf')]));});});}; \ No newline at end of file +var _0xdbcb=['../../config/environment','jayson/promise','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','where','map','include','attributes','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x3e775c,_0x55f5ae){var _0x3ae61f=function(_0x4c093c){while(--_0x4c093c){_0x3e775c['push'](_0x3e775c['shift']());}};_0x3ae61f(++_0x55f5ae);}(_0xdbcb,0xe9));var _0xbdbc=function(_0x584da8,_0x4944c4){_0x584da8=_0x584da8-0x0;var _0x4da924=_0xdbcb[_0x584da8];return _0x4da924;};'use strict';var _=require(_0xbdbc('0x0'));var util=require(_0xbdbc('0x1'));var moment=require(_0xbdbc('0x2'));var BPromise=require(_0xbdbc('0x3'));var rs=require(_0xbdbc('0x4'));var fs=require('fs');var Redis=require(_0xbdbc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbdbc('0x6'));var config=require(_0xbdbc('0x7'));var jayson=require(_0xbdbc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5113ef,_0x140c12,_0x2242d0){return new BPromise(function(_0x39f9bf,_0x28d8df){return client[_0xbdbc('0x9')](_0x5113ef,_0x2242d0)['then'](function(_0x17e8bb){logger[_0xbdbc('0xa')](_0xbdbc('0xb'),_0x140c12,_0xbdbc('0xc'));logger[_0xbdbc('0xd')](_0xbdbc('0xe'),_0x140c12,'request\x20sent',JSON[_0xbdbc('0xf')](_0x17e8bb));if(_0x17e8bb[_0xbdbc('0x10')]){if(_0x17e8bb[_0xbdbc('0x10')][_0xbdbc('0x11')]===0x1f4){logger[_0xbdbc('0x10')](_0xbdbc('0xb'),_0x140c12,_0x17e8bb['error'][_0xbdbc('0x12')]);return _0x28d8df(_0x17e8bb[_0xbdbc('0x10')][_0xbdbc('0x12')]);}logger[_0xbdbc('0x10')](_0xbdbc('0xb'),_0x140c12,_0x17e8bb['error'][_0xbdbc('0x12')]);return _0x39f9bf(_0x17e8bb[_0xbdbc('0x10')][_0xbdbc('0x12')]);}else{logger['info'](_0xbdbc('0xb'),_0x140c12,_0xbdbc('0xc'));_0x39f9bf(_0x17e8bb[_0xbdbc('0x13')]['message']);}})['catch'](function(_0xf39ada){logger[_0xbdbc('0x10')](_0xbdbc('0xb'),_0x140c12,_0xf39ada);_0x28d8df(_0xf39ada);});});}exports[_0xbdbc('0x14')]=function(_0x728c37){var _0x14892b=this;return new Promise(function(_0x56eeaf,_0x4579ac){return db[_0xbdbc('0x15')][_0xbdbc('0x16')]({'raw':_0x728c37[_0xbdbc('0x17')]?_0x728c37[_0xbdbc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x728c37[_0xbdbc('0x17')]?_0x728c37[_0xbdbc('0x17')][_0xbdbc('0x18')]||null:null,'attributes':_0x728c37[_0xbdbc('0x17')]?_0x728c37[_0xbdbc('0x17')]['attributes']||null:null,'include':_0x728c37[_0xbdbc('0x17')]?_0x728c37[_0xbdbc('0x17')]['include']?_[_0xbdbc('0x19')](_0x728c37[_0xbdbc('0x17')][_0xbdbc('0x1a')],function(_0x1fbe0f){return{'model':db[_0x1fbe0f['model']],'as':_0x1fbe0f['as'],'attributes':_0x1fbe0f[_0xbdbc('0x1b')],'include':_0x1fbe0f[_0xbdbc('0x1a')]?_[_0xbdbc('0x19')](_0x1fbe0f[_0xbdbc('0x1a')],function(_0x19075c){return{'model':db[_0x19075c['model']],'as':_0x19075c['as'],'attributes':_0x19075c[_0xbdbc('0x1b')],'include':_0x19075c['include']?_[_0xbdbc('0x19')](_0x19075c[_0xbdbc('0x1a')],function(_0x483b5f){return{'model':db[_0x483b5f[_0xbdbc('0x1c')]],'as':_0x483b5f['as'],'attributes':_0x483b5f[_0xbdbc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a3f48){logger['info'](_0xbdbc('0x14'),_0x728c37);logger['debug']('ShowVariable',_0x728c37,JSON[_0xbdbc('0xf')](_0x1a3f48));_0x56eeaf(_0x1a3f48);})[_0xbdbc('0x1d')](function(_0x4a24e6){logger['error'](_0xbdbc('0x14'),_0x4a24e6[_0xbdbc('0x12')],_0x728c37);_0x4579ac(_0x14892b[_0xbdbc('0x10')](0x1f4,_0x4a24e6[_0xbdbc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a8981f2..ba22613 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 _0x0a96=['restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0x0a96,0xe4));var _0x60a9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0a96[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0x60a9('0x0'));var router=express[_0x60a9('0x1')]();var auth=require(_0x60a9('0x2'));var controller=require('./version.controller');router[_0x60a9('0x3')]('/',controller[_0x60a9('0x4')]);router[_0x60a9('0x3')](_0x60a9('0x5'),auth[_0x60a9('0x6')](),auth[_0x60a9('0x7')](),controller[_0x60a9('0x8')]);router[_0x60a9('0x3')](_0x60a9('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x60a9('0xa')]);router['get']('/pull',auth[_0x60a9('0x6')](),auth[_0x60a9('0x7')](),controller[_0x60a9('0xb')]);router[_0x60a9('0x3')]('/restart',auth[_0x60a9('0x6')](),controller[_0x60a9('0xc')]);router['get'](_0x60a9('0xd'),controller[_0x60a9('0xe')]);module[_0x60a9('0xf')]=router; \ No newline at end of file +var _0x62c9=['restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','fetch','canUpdate','/pull','isAuthenticated','pull'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x62c9,0xe3));var _0x962c=function(_0x3e75ba,_0x90def){_0x3e75ba=_0x3e75ba-0x0;var _0x2765b5=_0x62c9[_0x3e75ba];return _0x2765b5;};'use strict';var express=require(_0x962c('0x0'));var router=express[_0x962c('0x1')]();var auth=require(_0x962c('0x2'));var controller=require(_0x962c('0x3'));router['get']('/',controller[_0x962c('0x4')]);router[_0x962c('0x5')]('/fetch',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x962c('0x6')]);router[_0x962c('0x5')]('/reset',auth['isAuthenticated'](),auth[_0x962c('0x7')](),controller['reset']);router[_0x962c('0x5')](_0x962c('0x8'),auth[_0x962c('0x9')](),auth['canUpdate'](),controller[_0x962c('0xa')]);router['get']('/restart',auth[_0x962c('0x9')](),controller[_0x962c('0xb')]);router['get']('/migrations',controller[_0x962c('0xc')]);module[_0x962c('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 6f88c0f..408730f 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 _0x8458=['root','query','latest','fetch','exports','2.0.0','status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','replace','.js','push','length','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8458,0x1a5));var _0x8845=function(_0x4e35ad,_0x4c07bc){_0x4e35ad=_0x4e35ad-0x0;var _0x2f2af3=_0x8458[_0x4e35ad];return _0x2f2af3;};'use strict';var Umzug=require(_0x8845('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x8845('0x1'));var pkginfo=require(_0x8845('0x2'))(module,_0x8845('0x3'));var compareVersions=require(_0x8845('0x4'));var exec=require(_0x8845('0x5'))['exec'];var db=require(_0x8845('0x6'))['db'];var config=require(_0x8845('0x7'));var pm2=require(_0x8845('0x8'));var logger=require(_0x8845('0x9'))(_0x8845('0xa'));var git=require('simple-git')(config[_0x8845('0xb')]);exports['index']=function(_0x2a91b4,_0x3067d1){var _0xd94398={'current':module['exports'][_0x8845('0x3')],'phonebar':0x2};if(_0x2a91b4[_0x8845('0xc')]&&_0x2a91b4['query'][_0x8845('0xd')]){return git[_0x8845('0xe')]()['tags'](function(_0x3b9c78,_0x3e60da){_0xd94398[_0x8845('0xd')]=(_0x3b9c78?module[_0x8845('0xf')][_0x8845('0x3')]:_0x3e60da[_0x8845('0xd')])||_0x8845('0x10');return _0x3067d1[_0x8845('0x11')](0xc8)[_0x8845('0x12')](_0xd94398);});}else{return _0x3067d1[_0x8845('0x11')](0xc8)[_0x8845('0x12')](_0xd94398);}};exports[_0x8845('0xe')]=function(_0x352ae3,_0x2b9b36){return git['fetch']([_0x8845('0x13'),_0x8845('0x14')],function(_0x5cb103){if(_0x5cb103){logger[_0x8845('0x15')](_0x5cb103);return _0x2b9b36[_0x8845('0x11')](0x1f4)[_0x8845('0x12')](_0x5cb103);}logger['info']('git\x20fetch');return _0x2b9b36['status'](0xc8)[_0x8845('0x12')]({'output':_0x8845('0x16')});});};exports[_0x8845('0x17')]=function(_0x131faa,_0x10f1d5){return git[_0x8845('0x17')]([_0x8845('0x18'),'FETCH_HEAD'],function(_0x4e6a6f){if(_0x4e6a6f){logger['error'](_0x4e6a6f);return _0x10f1d5[_0x8845('0x11')](0x1f4)[_0x8845('0x12')](_0x4e6a6f);}logger[_0x8845('0x19')](_0x8845('0x1a'));return _0x10f1d5['status'](0xc8)[_0x8845('0x12')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x1ccdca,_0x203f63){exec('npm\x20install\x20--production',function(_0x450bfc,_0x23a0d3,_0x597fc5){logger[_0x8845('0x19')](_0x23a0d3);logger[_0x8845('0x19')](_0x597fc5);if(_0x450bfc){logger[_0x8845('0x15')](_0x450bfc);return _0x203f63[_0x8845('0x11')](0x1f4)['json'](_0x450bfc);}return _0x203f63['status'](0xc8)[_0x8845('0x12')]({'output':_0x23a0d3});});};exports[_0x8845('0x1b')]=function(_0x3b4f41,_0xa1970f){return pm2[_0x8845('0x1b')](_0x8845('0x1c'))[_0x8845('0x1d')](function(_0x1233a4){logger[_0x8845('0x19')](_0x8845('0x1e'),_0x1233a4);return _0xa1970f[_0x8845('0x11')](0xc8)[_0x8845('0x12')]({'output':_0x8845('0x1f')});})[_0x8845('0x20')](function(_0xe997a6){logger[_0x8845('0x15')](_0xe997a6);return _0xa1970f[_0x8845('0x11')](0x1f4)['json'](_0xe997a6);});};exports['migrations']=function(_0x3a831f,_0xd1f69e){var _0x26cae2=fs[_0x8845('0x21')](path[_0x8845('0x22')](config[_0x8845('0xb')],_0x8845('0x23'),'migrations'));var _0x2991cd=[];for(var _0x3fa3f0=0x0;_0x3fa3f0<_0x26cae2['length'];_0x3fa3f0++){var _0x3e3fbe=_0x26cae2[_0x3fa3f0][_0x8845('0x24')](_0x8845('0x25'),'');if(compareVersions(module[_0x8845('0xf')][_0x8845('0x3')],_0x3e3fbe)===-0x1){_0x2991cd[_0x8845('0x26')](_0x3e3fbe);}}if(_0x2991cd[_0x8845('0x27')]){var _0x1a400d=_0x2991cd['sort'](compareVersions);var _0x519a35=new Umzug({'storage':_0x8845('0x28'),'storageOptions':{'model':db[_0x8845('0x29')],'modelName':'Migration','columnName':_0x8845('0x3')},'migrations':{'params':[db[_0x8845('0x28')][_0x8845('0x2a')](),db['sequelize']['constructor'],function(){throw new Error(_0x8845('0x2b'));}],'path':path['join'](config[_0x8845('0xb')],_0x8845('0x23'),_0x8845('0x2c')),'pattern':/\.js$/}});_0x519a35['up']({'migrations':_['map'](_0x1a400d,function(_0x367b8e){return _0x367b8e+_0x8845('0x25');})})[_0x8845('0x1d')](function(){return _0xd1f69e['status'](0xc8)[_0x8845('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x8845('0xf')][_0x8845('0x3')]+_0x8845('0x2d')+_[_0x8845('0x2e')](_0x1a400d),'migrations':_[_0x8845('0x22')](_0x1a400d)});})[_0x8845('0x20')](function(_0xab7d4b){if(_0xab7d4b instanceof db[_0x8845('0x28')]['UniqueConstraintError']){return _0xd1f69e[_0x8845('0x11')](0xc8)['json']({'output':_0x8845('0x2f')});}else{return _0xd1f69e['status'](0x1f4)[_0x8845('0x12')](_0xab7d4b);}});}else{return _0xd1f69e[_0x8845('0x11')](0xc8)['json']({'output':_0x8845('0x2f')});}}; \ No newline at end of file +var _0x5655=['git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','error','migrations','readdirSync','length','replace','push','Migration','sequelize','constructor','join','server','map','.js','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','2.0.0','status','json','origin','master','info','git\x20fetch','reset','--hard','FETCH_HEAD'];(function(_0x2c9732,_0x1a7473){var _0x25fb4e=function(_0x45f0c6){while(--_0x45f0c6){_0x2c9732['push'](_0x2c9732['shift']());}};_0x25fb4e(++_0x1a7473);}(_0x5655,0x15e));var _0x5565=function(_0x426fa2,_0xba7cff){_0x426fa2=_0x426fa2-0x0;var _0xef756a=_0x5655[_0x426fa2];return _0xef756a;};'use strict';var Umzug=require(_0x5565('0x0'));var path=require(_0x5565('0x1'));var fs=require('fs');var _=require(_0x5565('0x2'));var pkginfo=require(_0x5565('0x3'))(module,_0x5565('0x4'));var compareVersions=require(_0x5565('0x5'));var exec=require('child_process')['exec'];var db=require(_0x5565('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x5565('0x7'));var logger=require(_0x5565('0x8'))(_0x5565('0x9'));var git=require(_0x5565('0xa'))(config[_0x5565('0xb')]);exports['index']=function(_0xc88d42,_0x2980c9){var _0x1a47c8={'current':module[_0x5565('0xc')][_0x5565('0x4')],'phonebar':0x2};if(_0xc88d42[_0x5565('0xd')]&&_0xc88d42['query'][_0x5565('0xe')]){return git[_0x5565('0xf')]()['tags'](function(_0x498370,_0x35254d){_0x1a47c8[_0x5565('0xe')]=(_0x498370?module['exports']['version']:_0x35254d[_0x5565('0xe')])||_0x5565('0x10');return _0x2980c9[_0x5565('0x11')](0xc8)[_0x5565('0x12')](_0x1a47c8);});}else{return _0x2980c9[_0x5565('0x11')](0xc8)[_0x5565('0x12')](_0x1a47c8);}};exports[_0x5565('0xf')]=function(_0x40584f,_0x553b26){return git[_0x5565('0xf')]([_0x5565('0x13'),_0x5565('0x14')],function(_0x199a3c){if(_0x199a3c){logger['error'](_0x199a3c);return _0x553b26[_0x5565('0x11')](0x1f4)[_0x5565('0x12')](_0x199a3c);}logger[_0x5565('0x15')](_0x5565('0x16'));return _0x553b26[_0x5565('0x11')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x5565('0x17')]=function(_0x2d3532,_0x4f56df){return git[_0x5565('0x17')]([_0x5565('0x18'),_0x5565('0x19')],function(_0x5712ad){if(_0x5712ad){logger['error'](_0x5712ad);return _0x4f56df['status'](0x1f4)[_0x5565('0x12')](_0x5712ad);}logger[_0x5565('0x15')](_0x5565('0x1a'));return _0x4f56df[_0x5565('0x11')](0xc8)[_0x5565('0x12')]({'output':_0x5565('0x1b')});});};exports['pull']=function(_0x4367d1,_0x11e42b){exec('npm\x20install\x20--production',function(_0x163d4c,_0x25f8c9,_0x2344b6){logger['info'](_0x25f8c9);logger[_0x5565('0x15')](_0x2344b6);if(_0x163d4c){logger['error'](_0x163d4c);return _0x11e42b[_0x5565('0x11')](0x1f4)[_0x5565('0x12')](_0x163d4c);}return _0x11e42b['status'](0xc8)['json']({'output':_0x25f8c9});});};exports[_0x5565('0x1c')]=function(_0x9f87b8,_0x4446ee){return pm2['restart']('motion2')[_0x5565('0x1d')](function(_0x2d3615){logger['info'](_0x5565('0x1e'),_0x2d3615);return _0x4446ee[_0x5565('0x11')](0xc8)['json']({'output':_0x5565('0x1f')});})['catch'](function(_0x3d0171){logger[_0x5565('0x20')](_0x3d0171);return _0x4446ee[_0x5565('0x11')](0x1f4)[_0x5565('0x12')](_0x3d0171);});};exports[_0x5565('0x21')]=function(_0x6a825a,_0x168f16){var _0x33bcb6=fs[_0x5565('0x22')](path['join'](config[_0x5565('0xb')],'server','migrations'));var _0xfc34af=[];for(var _0x5b032c=0x0;_0x5b032c<_0x33bcb6[_0x5565('0x23')];_0x5b032c++){var _0x392579=_0x33bcb6[_0x5b032c][_0x5565('0x24')]('.js','');if(compareVersions(module['exports'][_0x5565('0x4')],_0x392579)===-0x1){_0xfc34af[_0x5565('0x25')](_0x392579);}}if(_0xfc34af[_0x5565('0x23')]){var _0x4e8e97=_0xfc34af['sort'](compareVersions);var _0x2ac2b3=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x5565('0x26')],'modelName':'Migration','columnName':_0x5565('0x4')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x5565('0x27')][_0x5565('0x28')],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[_0x5565('0x29')](config[_0x5565('0xb')],_0x5565('0x2a'),_0x5565('0x21')),'pattern':/\.js$/}});_0x2ac2b3['up']({'migrations':_[_0x5565('0x2b')](_0x4e8e97,function(_0x265e56){return _0x265e56+_0x5565('0x2c');})})[_0x5565('0x1d')](function(){return _0x168f16[_0x5565('0x11')](0xc8)[_0x5565('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x5565('0xc')][_0x5565('0x4')]+'\x20to\x20'+_[_0x5565('0x2d')](_0x4e8e97),'migrations':_[_0x5565('0x29')](_0x4e8e97)});})['catch'](function(_0x381e53){if(_0x381e53 instanceof db[_0x5565('0x27')]['UniqueConstraintError']){return _0x168f16['status'](0xc8)[_0x5565('0x12')]({'output':_0x5565('0x2e')});}else{return _0x168f16[_0x5565('0x11')](0x1f4)[_0x5565('0x12')](_0x381e53);}});}else{return _0x168f16[_0x5565('0x11')](0xc8)[_0x5565('0x12')]({'output':_0x5565('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4e70057..20c3d62 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 _0x574f=['isAuthenticated','describe','/:id','show','post','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x574f,0x1aa));var _0xf574=function(_0x5e66f2,_0x3552c5){_0x5e66f2=_0x5e66f2-0x0;var _0x3e680e=_0x574f[_0x5e66f2];return _0x3e680e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf574('0x0'));var timeout=require(_0xf574('0x1'));var express=require(_0xf574('0x2'));var router=express[_0xf574('0x3')]();var auth=require(_0xf574('0x4'));var interaction=require(_0xf574('0x5'));var config=require(_0xf574('0x6'));var controller=require(_0xf574('0x7'));router[_0xf574('0x8')]('/',auth['isAuthenticated'](),controller[_0xf574('0x9')]);router['get'](_0xf574('0xa'),auth[_0xf574('0xb')](),controller[_0xf574('0xc')]);router[_0xf574('0x8')](_0xf574('0xd'),auth['isAuthenticated'](),controller[_0xf574('0xe')]);router[_0xf574('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xf574('0xb')](),controller[_0xf574('0x10')]);router[_0xf574('0x11')](_0xf574('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf574('0x12')]=router; \ No newline at end of file +var _0x9efd=['express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x54106e,_0x26bade){var _0x3918a2=function(_0x2d4be3){while(--_0x2d4be3){_0x54106e['push'](_0x54106e['shift']());}};_0x3918a2(++_0x26bade);}(_0x9efd,0x152));var _0xd9ef=function(_0x4860ae,_0x4eaa4d){_0x4860ae=_0x4860ae-0x0;var _0x58e24c=_0x9efd[_0x4860ae];return _0x58e24c;};'use strict';var multer=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var path=require(_0xd9ef('0x2'));var timeout=require(_0xd9ef('0x3'));var express=require(_0xd9ef('0x4'));var router=express['Router']();var auth=require(_0xd9ef('0x5'));var interaction=require(_0xd9ef('0x6'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xd9ef('0x7')]('/',auth[_0xd9ef('0x8')](),controller[_0xd9ef('0x9')]);router['get'](_0xd9ef('0xa'),auth['isAuthenticated'](),controller[_0xd9ef('0xb')]);router[_0xd9ef('0x7')](_0xd9ef('0xc'),auth['isAuthenticated'](),controller[_0xd9ef('0xd')]);router[_0xd9ef('0xe')]('/',auth[_0xd9ef('0x8')](),controller[_0xd9ef('0xf')]);router['put'](_0xd9ef('0xc'),auth['isAuthenticated'](),controller[_0xd9ef('0x10')]);router[_0xd9ef('0x11')](_0xd9ef('0xc'),auth[_0xd9ef('0x8')](),controller['destroy']);module[_0xd9ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 99aeed3..eee2f77 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x387ad1,_0x53a1ed){var _0x3cd735=function(_0x168e34){while(--_0x168e34){_0x387ad1['push'](_0x387ad1['shift']());}};_0x3cd735(++_0x53a1ed);}(_0x7da7,0x10d));var _0x77da=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x7da7[_0x4e21ba];return _0x55b94b;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'type':{'type':Sequelize[_0x77da('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x77da('0x2')]},'queue':{'type':Sequelize[_0x77da('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x77da('0x2')]},'agentcalledAt':{'type':Sequelize[_0x77da('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x77da('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x77da('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x77da('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x77da('0x4')]},'agentacw':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x77da('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x77da('0x2')]},'channel':{'type':Sequelize[_0x77da('0x2')]},'channelstate':{'type':Sequelize[_0x77da('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x77da('0x2')]},'connectedlinename':{'type':Sequelize[_0x77da('0x2')]},'language':{'type':Sequelize[_0x77da('0x2')]},'accountcode':{'type':Sequelize[_0x77da('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x77da('0x2')]},'priority':{'type':Sequelize[_0x77da('0x2')]},'destchannel':{'type':Sequelize[_0x77da('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x77da('0x2')]},'destcalleridname':{'type':Sequelize[_0x77da('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x77da('0x2')]},'destlanguage':{'type':Sequelize[_0x77da('0x2')]},'destaccountcode':{'type':Sequelize[_0x77da('0x2')]},'destcontext':{'type':Sequelize[_0x77da('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x77da('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x77da('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x77da('0x2')]},'transfer':{'type':Sequelize[_0x77da('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x77da('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5897dc,_0x216d85){var _0x50d0c9=function(_0x6edacd){while(--_0x6edacd){_0x5897dc['push'](_0x5897dc['shift']());}};_0x50d0c9(++_0x216d85);}(_0x425d,0x1e0));var _0xd425=function(_0x230471,_0x10441f){_0x230471=_0x230471-0x0;var _0x5dd908=_0x425d[_0x230471];return _0x5dd908;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'type':{'type':Sequelize[_0xd425('0x1')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'queue':{'type':Sequelize[_0xd425('0x1')]},'interface':{'type':Sequelize[_0xd425('0x1')]},'membername':{'type':Sequelize[_0xd425('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd425('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd425('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd425('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x3')]},'agentcomplete':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd425('0x3')]},'agentacw':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd425('0x3')]},'reason':{'type':Sequelize[_0xd425('0x1')]},'lastevent':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize[_0xd425('0x1')]},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x1')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd425('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd425('0x1')],'comment':_0xd425('0x5')},'transferexten':{'type':Sequelize[_0xd425('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd425('0x3')],'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 043039f..e47d362 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 _0x0e5b=['name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','keys','find','create','update','body','params','describe','html-pdf','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','end','status','json','count','offset','limit','set','reject','destroy','then','sendStatus','error'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0e5b,0x1dd));var _0xb0e5=function(_0x11fb1d,_0x41f915){_0x11fb1d=_0x11fb1d-0x0;var _0x39b80a=_0x0e5b[_0x11fb1d];return _0x39b80a;};'use strict';var pdf=require(_0xb0e5('0x0'));var emlformat=require(_0xb0e5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e5('0x2'));var moment=require(_0xb0e5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb0e5('0x4'));var util=require(_0xb0e5('0x5'));var path=require('path');var sox=require(_0xb0e5('0x6'));var csv=require(_0xb0e5('0x7'));var ejs=require(_0xb0e5('0x8'));var fs=require('fs');var _=require(_0xb0e5('0x9'));var squel=require(_0xb0e5('0xa'));var crypto=require(_0xb0e5('0xb'));var jsforce=require(_0xb0e5('0xc'));var deskjs=require(_0xb0e5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb0e5('0xe'));var Papa=require(_0xb0e5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb0e5('0x10'));var as=require(_0xb0e5('0x11'));var hardwareService=require(_0xb0e5('0x12'));var logger=require('../../config/logger')(_0xb0e5('0x13'));var utils=require(_0xb0e5('0x14'));var config=require(_0xb0e5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fed28,_0x24b337){_0x24b337=_0x24b337||0xcc;return function(_0x5bc71c){if(_0x5bc71c){return _0x1fed28['sendStatus'](_0x24b337);}return _0x1fed28['status'](_0x24b337)[_0xb0e5('0x16')]();};}function respondWithResult(_0x46bf09,_0x142c7a){_0x142c7a=_0x142c7a||0xc8;return function(_0x256c24){if(_0x256c24){return _0x46bf09[_0xb0e5('0x17')](_0x142c7a)[_0xb0e5('0x18')](_0x256c24);}};}function respondWithFilteredResult(_0x1ea9f9,_0x4b89e1){return function(_0x2c1dcc){if(_0x2c1dcc){var _0x40ad73=_0x2c1dcc[_0xb0e5('0x19')],_0x11524f=_0x4b89e1[_0xb0e5('0x1a')],_0x2d95ae=_0x4b89e1[_0xb0e5('0x1a')]+_0x4b89e1[_0xb0e5('0x1b')],_0x5cb19a;if(_0x2d95ae>=_0x40ad73){_0x2d95ae=_0x40ad73;_0x5cb19a=0xc8;}else{_0x5cb19a=0xce;}_0x1ea9f9[_0xb0e5('0x17')](_0x5cb19a);return _0x1ea9f9[_0xb0e5('0x1c')]('Content-Range',_0x11524f+'-'+_0x2d95ae+'/'+_0x40ad73)[_0xb0e5('0x18')](_0x2c1dcc);}return null;};}function patchUpdates(_0x1e88b8){return function(_0x4daa1a){try{jsonpatch['apply'](_0x4daa1a,_0x1e88b8,!![]);}catch(_0xbc6d16){return BPromise[_0xb0e5('0x1d')](_0xbc6d16);}return _0x4daa1a['save']();};}function saveUpdates(_0x4f5d42,_0x7ee22){return function(_0x1e7643){if(_0x1e7643){return _0x1e7643['update'](_0x4f5d42)['then'](function(_0x341c86){return _0x341c86;});}return null;};}function removeEntity(_0x3b4904,_0x405998){return function(_0x2a03c2){if(_0x2a03c2){return _0x2a03c2[_0xb0e5('0x1e')]()[_0xb0e5('0x1f')](function(){_0x3b4904[_0xb0e5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522c73,_0x347860){return function(_0x39f5fb){if(!_0x39f5fb){_0x522c73[_0xb0e5('0x20')](0x194);}return _0x39f5fb;};}function handleError(_0x4171e7,_0x563063){_0x563063=_0x563063||0x1f4;return function(_0x435808){logger[_0xb0e5('0x21')](_0x435808['stack']);if(_0x435808['name']){delete _0x435808[_0xb0e5('0x22')];}_0x4171e7['status'](_0x563063)[_0xb0e5('0x23')](_0x435808);};}exports[_0xb0e5('0x24')]=function(_0x2002c2,_0x1db7b9){var _0x5af24f={},_0x2075d7={},_0xe7aea1={'count':0x0,'rows':[]};var _0x30db54=_['map'](db['VoiceAgentReport'][_0xb0e5('0x25')],function(_0x1df6ae){return{'name':_0x1df6ae[_0xb0e5('0x26')],'type':_0x1df6ae[_0xb0e5('0x27')][_0xb0e5('0x28')]};});_0x2075d7[_0xb0e5('0x29')]=_[_0xb0e5('0x2a')](_0x30db54,_0xb0e5('0x22'));_0x2075d7[_0xb0e5('0x2b')]=_['keys'](_0x2002c2[_0xb0e5('0x2b')]);_0x2075d7[_0xb0e5('0x2c')]=_[_0xb0e5('0x2d')](_0x2075d7[_0xb0e5('0x29')],_0x2075d7[_0xb0e5('0x2b')]);_0x5af24f[_0xb0e5('0x2e')]=_['intersection'](_0x2075d7[_0xb0e5('0x29')],qs[_0xb0e5('0x2f')](_0x2002c2[_0xb0e5('0x2b')]['fields']));_0x5af24f[_0xb0e5('0x2e')]=_0x5af24f[_0xb0e5('0x2e')][_0xb0e5('0x30')]?_0x5af24f[_0xb0e5('0x2e')]:_0x2075d7[_0xb0e5('0x29')];if(!_0x2002c2[_0xb0e5('0x2b')][_0xb0e5('0x31')](_0xb0e5('0x32'))){_0x5af24f[_0xb0e5('0x1b')]=qs[_0xb0e5('0x1b')](_0x2002c2[_0xb0e5('0x2b')]['limit']);_0x5af24f[_0xb0e5('0x1a')]=qs[_0xb0e5('0x1a')](_0x2002c2['query'][_0xb0e5('0x1a')]);}_0x5af24f[_0xb0e5('0x33')]=qs[_0xb0e5('0x34')](_0x2002c2[_0xb0e5('0x2b')][_0xb0e5('0x34')]);_0x5af24f[_0xb0e5('0x35')]=qs[_0xb0e5('0x2c')](_[_0xb0e5('0x36')](_0x2002c2[_0xb0e5('0x2b')],_0x2075d7[_0xb0e5('0x2c')]),_0x30db54);if(_0x2002c2[_0xb0e5('0x2b')][_0xb0e5('0x37')]){_0x5af24f[_0xb0e5('0x35')]=_[_0xb0e5('0x38')](_0x5af24f[_0xb0e5('0x35')],{'$or':_['map'](_0x30db54,function(_0x53164b){if(_0x53164b[_0xb0e5('0x27')]!==_0xb0e5('0x39')){var _0x1763c0={};_0x1763c0[_0x53164b[_0xb0e5('0x22')]]={'$like':'%'+_0x2002c2[_0xb0e5('0x2b')][_0xb0e5('0x37')]+'%'};return _0x1763c0;}})});}_0x5af24f=_[_0xb0e5('0x38')]({},_0x5af24f,_0x2002c2[_0xb0e5('0x3a')]);var _0x55fcb4={'where':_0x5af24f[_0xb0e5('0x35')]};return db[_0xb0e5('0x3b')][_0xb0e5('0x19')](_0x55fcb4)['then'](function(_0x109ec6){_0xe7aea1[_0xb0e5('0x19')]=_0x109ec6;if(_0x2002c2[_0xb0e5('0x2b')][_0xb0e5('0x3c')]){_0x5af24f[_0xb0e5('0x3d')]=[{'all':!![]}];}return db[_0xb0e5('0x3b')][_0xb0e5('0x3e')](_0x5af24f);})['then'](function(_0xd3c726){_0xe7aea1[_0xb0e5('0x3f')]=_0xd3c726;return _0xe7aea1;})[_0xb0e5('0x1f')](respondWithFilteredResult(_0x1db7b9,_0x5af24f))[_0xb0e5('0x40')](handleError(_0x1db7b9,null));};exports[_0xb0e5('0x41')]=function(_0x1b3ec9,_0x39bf49){var _0x591d65={'raw':![],'where':{'id':_0x1b3ec9['params']['id']}},_0x9a6158={};_0x9a6158['model']=_[_0xb0e5('0x42')](db[_0xb0e5('0x3b')]['rawAttributes']);_0x9a6158[_0xb0e5('0x2b')]=_[_0xb0e5('0x42')](_0x1b3ec9[_0xb0e5('0x2b')]);_0x9a6158['filters']=_['intersection'](_0x9a6158['model'],_0x9a6158[_0xb0e5('0x2b')]);_0x591d65[_0xb0e5('0x2e')]=_[_0xb0e5('0x2d')](_0x9a6158[_0xb0e5('0x29')],qs[_0xb0e5('0x2f')](_0x1b3ec9[_0xb0e5('0x2b')][_0xb0e5('0x2f')]));_0x591d65['attributes']=_0x591d65[_0xb0e5('0x2e')][_0xb0e5('0x30')]?_0x591d65[_0xb0e5('0x2e')]:_0x9a6158['model'];if(_0x1b3ec9[_0xb0e5('0x2b')][_0xb0e5('0x3c')]){_0x591d65[_0xb0e5('0x3d')]=[{'all':!![]}];}_0x591d65=_[_0xb0e5('0x38')]({},_0x591d65,_0x1b3ec9['options']);return db[_0xb0e5('0x3b')][_0xb0e5('0x43')](_0x591d65)[_0xb0e5('0x1f')](handleEntityNotFound(_0x39bf49,null))[_0xb0e5('0x1f')](respondWithResult(_0x39bf49,null))[_0xb0e5('0x40')](handleError(_0x39bf49,null));};exports[_0xb0e5('0x44')]=function(_0x17e6b6,_0x3b9078){return db[_0xb0e5('0x3b')]['create'](_0x17e6b6['body'],{})[_0xb0e5('0x1f')](respondWithResult(_0x3b9078,0xc9))['catch'](handleError(_0x3b9078,null));};exports[_0xb0e5('0x45')]=function(_0x33ce8b,_0x1acee1){if(_0x33ce8b[_0xb0e5('0x46')]['id']){delete _0x33ce8b[_0xb0e5('0x46')]['id'];}return db[_0xb0e5('0x3b')]['find']({'where':{'id':_0x33ce8b[_0xb0e5('0x47')]['id']}})[_0xb0e5('0x1f')](handleEntityNotFound(_0x1acee1,null))['then'](saveUpdates(_0x33ce8b[_0xb0e5('0x46')],null))[_0xb0e5('0x1f')](respondWithResult(_0x1acee1,null))[_0xb0e5('0x40')](handleError(_0x1acee1,null));};exports['destroy']=function(_0x353df9,_0x3d76cc){return db[_0xb0e5('0x3b')][_0xb0e5('0x43')]({'where':{'id':_0x353df9[_0xb0e5('0x47')]['id']}})[_0xb0e5('0x1f')](handleEntityNotFound(_0x3d76cc,null))[_0xb0e5('0x1f')](removeEntity(_0x3d76cc,null))[_0xb0e5('0x40')](handleError(_0x3d76cc,null));};exports[_0xb0e5('0x48')]=function(_0x59d5b5,_0x411e1e){return db[_0xb0e5('0x3b')][_0xb0e5('0x48')]()[_0xb0e5('0x1f')](respondWithResult(_0x411e1e,null))[_0xb0e5('0x40')](handleError(_0x411e1e,null));}; \ No newline at end of file +var _0x723e=['fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceAgentReport','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes'];(function(_0x347e49,_0x50e8d0){var _0x3ec6ac=function(_0x42f720){while(--_0x42f720){_0x347e49['push'](_0x347e49['shift']());}};_0x3ec6ac(++_0x50e8d0);}(_0x723e,0x196));var _0xe723=function(_0x4a6ae5,_0x9f6541){_0x4a6ae5=_0x4a6ae5-0x0;var _0x402486=_0x723e[_0x4a6ae5];return _0x402486;};'use strict';var pdf=require(_0xe723('0x0'));var emlformat=require(_0xe723('0x1'));var rimraf=require(_0xe723('0x2'));var zipdir=require(_0xe723('0x3'));var jsonpatch=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var moment=require(_0xe723('0x6'));var BPromise=require(_0xe723('0x7'));var Mustache=require(_0xe723('0x8'));var util=require(_0xe723('0x9'));var path=require(_0xe723('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe723('0xb'));var crypto=require(_0xe723('0xc'));var jsforce=require(_0xe723('0xd'));var deskjs=require(_0xe723('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe723('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe723('0x10'));var as=require(_0xe723('0x11'));var hardwareService=require(_0xe723('0x12'));var logger=require(_0xe723('0x13'))('api');var utils=require(_0xe723('0x14'));var config=require(_0xe723('0x15'));var db=require(_0xe723('0x16'))['db'];function respondWithStatusCode(_0x3916d8,_0x3ef109){_0x3ef109=_0x3ef109||0xcc;return function(_0x3b6511){if(_0x3b6511){return _0x3916d8[_0xe723('0x17')](_0x3ef109);}return _0x3916d8[_0xe723('0x18')](_0x3ef109)[_0xe723('0x19')]();};}function respondWithResult(_0x60cf5c,_0x18ec5d){_0x18ec5d=_0x18ec5d||0xc8;return function(_0x246ee8){if(_0x246ee8){return _0x60cf5c[_0xe723('0x18')](_0x18ec5d)[_0xe723('0x1a')](_0x246ee8);}};}function respondWithFilteredResult(_0x147f5b,_0x458704){return function(_0x2f6bf2){if(_0x2f6bf2){var _0x5626a1=_0x2f6bf2[_0xe723('0x1b')],_0x1a8f62=_0x458704['offset'],_0x3198fe=_0x458704[_0xe723('0x1c')]+_0x458704['limit'],_0x5d2958;if(_0x3198fe>=_0x5626a1){_0x3198fe=_0x5626a1;_0x5d2958=0xc8;}else{_0x5d2958=0xce;}_0x147f5b[_0xe723('0x18')](_0x5d2958);return _0x147f5b['set'](_0xe723('0x1d'),_0x1a8f62+'-'+_0x3198fe+'/'+_0x5626a1)[_0xe723('0x1a')](_0x2f6bf2);}return null;};}function patchUpdates(_0x3c4e06){return function(_0x351a15){try{jsonpatch[_0xe723('0x1e')](_0x351a15,_0x3c4e06,!![]);}catch(_0x62a8a5){return BPromise[_0xe723('0x1f')](_0x62a8a5);}return _0x351a15[_0xe723('0x20')]();};}function saveUpdates(_0x15ee1b,_0x2a0f80){return function(_0x199452){if(_0x199452){return _0x199452[_0xe723('0x21')](_0x15ee1b)['then'](function(_0x148e9a){return _0x148e9a;});}return null;};}function removeEntity(_0x1d56e5,_0x52307f){return function(_0x27b62b){if(_0x27b62b){return _0x27b62b[_0xe723('0x22')]()['then'](function(){_0x1d56e5['status'](0xcc)[_0xe723('0x19')]();});}};}function handleEntityNotFound(_0x5b8531,_0x5b0c1f){return function(_0x2500cc){if(!_0x2500cc){_0x5b8531['sendStatus'](0x194);}return _0x2500cc;};}function handleError(_0x51895f,_0x2477c2){_0x2477c2=_0x2477c2||0x1f4;return function(_0x4f8797){logger[_0xe723('0x23')](_0x4f8797[_0xe723('0x24')]);if(_0x4f8797['name']){delete _0x4f8797[_0xe723('0x25')];}_0x51895f[_0xe723('0x18')](_0x2477c2)[_0xe723('0x26')](_0x4f8797);};}exports[_0xe723('0x27')]=function(_0x3029d6,_0x58a0fb){var _0x2dfaec={},_0x3e01a5={},_0x3714ad={'count':0x0,'rows':[]};var _0x1ca4b8=_[_0xe723('0x28')](db['VoiceAgentReport'][_0xe723('0x29')],function(_0x20325d){return{'name':_0x20325d[_0xe723('0x2a')],'type':_0x20325d[_0xe723('0x2b')][_0xe723('0x2c')]};});_0x3e01a5[_0xe723('0x2d')]=_[_0xe723('0x28')](_0x1ca4b8,_0xe723('0x25'));_0x3e01a5['query']=_[_0xe723('0x2e')](_0x3029d6[_0xe723('0x2f')]);_0x3e01a5[_0xe723('0x30')]=_['intersection'](_0x3e01a5[_0xe723('0x2d')],_0x3e01a5[_0xe723('0x2f')]);_0x2dfaec[_0xe723('0x31')]=_['intersection'](_0x3e01a5[_0xe723('0x2d')],qs[_0xe723('0x32')](_0x3029d6[_0xe723('0x2f')]['fields']));_0x2dfaec[_0xe723('0x31')]=_0x2dfaec['attributes'][_0xe723('0x33')]?_0x2dfaec[_0xe723('0x31')]:_0x3e01a5['model'];if(!_0x3029d6[_0xe723('0x2f')][_0xe723('0x34')]('nolimit')){_0x2dfaec[_0xe723('0x35')]=qs['limit'](_0x3029d6[_0xe723('0x2f')]['limit']);_0x2dfaec['offset']=qs['offset'](_0x3029d6[_0xe723('0x2f')][_0xe723('0x1c')]);}_0x2dfaec[_0xe723('0x36')]=qs[_0xe723('0x37')](_0x3029d6[_0xe723('0x2f')][_0xe723('0x37')]);_0x2dfaec[_0xe723('0x38')]=qs[_0xe723('0x30')](_[_0xe723('0x39')](_0x3029d6[_0xe723('0x2f')],_0x3e01a5[_0xe723('0x30')]),_0x1ca4b8);if(_0x3029d6[_0xe723('0x2f')]['filter']){_0x2dfaec[_0xe723('0x38')]=_[_0xe723('0x3a')](_0x2dfaec[_0xe723('0x38')],{'$or':_[_0xe723('0x28')](_0x1ca4b8,function(_0x4f4249){if(_0x4f4249[_0xe723('0x2b')]!==_0xe723('0x3b')){var _0x19bacb={};_0x19bacb[_0x4f4249[_0xe723('0x25')]]={'$like':'%'+_0x3029d6[_0xe723('0x2f')][_0xe723('0x3c')]+'%'};return _0x19bacb;}})});}_0x2dfaec=_[_0xe723('0x3a')]({},_0x2dfaec,_0x3029d6[_0xe723('0x3d')]);var _0x5e079f={'where':_0x2dfaec[_0xe723('0x38')]};return db[_0xe723('0x3e')][_0xe723('0x1b')](_0x5e079f)[_0xe723('0x3f')](function(_0x5db5c8){_0x3714ad['count']=_0x5db5c8;if(_0x3029d6[_0xe723('0x2f')][_0xe723('0x40')]){_0x2dfaec[_0xe723('0x41')]=[{'all':!![]}];}return db[_0xe723('0x3e')][_0xe723('0x42')](_0x2dfaec);})[_0xe723('0x3f')](function(_0x307494){_0x3714ad[_0xe723('0x43')]=_0x307494;return _0x3714ad;})[_0xe723('0x3f')](respondWithFilteredResult(_0x58a0fb,_0x2dfaec))[_0xe723('0x44')](handleError(_0x58a0fb,null));};exports[_0xe723('0x45')]=function(_0x15a7da,_0x778613){var _0x355670={'raw':![],'where':{'id':_0x15a7da[_0xe723('0x46')]['id']}},_0x3ea240={};_0x3ea240[_0xe723('0x2d')]=_[_0xe723('0x2e')](db[_0xe723('0x3e')][_0xe723('0x29')]);_0x3ea240[_0xe723('0x2f')]=_[_0xe723('0x2e')](_0x15a7da[_0xe723('0x2f')]);_0x3ea240['filters']=_[_0xe723('0x47')](_0x3ea240[_0xe723('0x2d')],_0x3ea240[_0xe723('0x2f')]);_0x355670[_0xe723('0x31')]=_[_0xe723('0x47')](_0x3ea240[_0xe723('0x2d')],qs[_0xe723('0x32')](_0x15a7da['query'][_0xe723('0x32')]));_0x355670['attributes']=_0x355670[_0xe723('0x31')][_0xe723('0x33')]?_0x355670[_0xe723('0x31')]:_0x3ea240[_0xe723('0x2d')];if(_0x15a7da[_0xe723('0x2f')][_0xe723('0x40')]){_0x355670[_0xe723('0x41')]=[{'all':!![]}];}_0x355670=_['merge']({},_0x355670,_0x15a7da[_0xe723('0x3d')]);return db['VoiceAgentReport'][_0xe723('0x48')](_0x355670)[_0xe723('0x3f')](handleEntityNotFound(_0x778613,null))['then'](respondWithResult(_0x778613,null))[_0xe723('0x44')](handleError(_0x778613,null));};exports[_0xe723('0x49')]=function(_0x518d26,_0x2b2da0){return db[_0xe723('0x3e')]['create'](_0x518d26[_0xe723('0x4a')],{})[_0xe723('0x3f')](respondWithResult(_0x2b2da0,0xc9))['catch'](handleError(_0x2b2da0,null));};exports[_0xe723('0x21')]=function(_0x365cd0,_0x901d46){if(_0x365cd0[_0xe723('0x4a')]['id']){delete _0x365cd0['body']['id'];}return db['VoiceAgentReport'][_0xe723('0x48')]({'where':{'id':_0x365cd0['params']['id']}})[_0xe723('0x3f')](handleEntityNotFound(_0x901d46,null))[_0xe723('0x3f')](saveUpdates(_0x365cd0[_0xe723('0x4a')],null))[_0xe723('0x3f')](respondWithResult(_0x901d46,null))['catch'](handleError(_0x901d46,null));};exports['destroy']=function(_0x1b4b30,_0x5f0906){return db[_0xe723('0x3e')]['find']({'where':{'id':_0x1b4b30[_0xe723('0x46')]['id']}})[_0xe723('0x3f')](handleEntityNotFound(_0x5f0906,null))[_0xe723('0x3f')](removeEntity(_0x5f0906,null))[_0xe723('0x44')](handleError(_0x5f0906,null));};exports[_0xe723('0x4b')]=function(_0x2306b7,_0x218fde){return db['VoiceAgentReport'][_0xe723('0x4b')]()['then'](respondWithResult(_0x218fde,null))[_0xe723('0x44')](handleError(_0x218fde,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 4b1e97b..27f5214 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 _0x897a=['report_agent','uniqueid','destuniqueid','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x897a,0xe3));var _0xa897=function(_0x3ee10e,_0x14c8de){_0x3ee10e=_0x3ee10e-0x0;var _0x19fba9=_0x897a[_0x3ee10e];return _0x19fba9;};'use strict';var _=require(_0xa897('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa897('0x1'));var moment=require(_0xa897('0x2'));var BPromise=require(_0xa897('0x3'));var rp=require(_0xa897('0x4'));var fs=require('fs');var path=require(_0xa897('0x5'));var rimraf=require('rimraf');var config=require(_0xa897('0x6'));var attributes=require(_0xa897('0x7'));module[_0xa897('0x8')]=function(_0x377883,_0x347735){return _0x377883[_0xa897('0x9')](_0xa897('0xa'),attributes,{'tableName':_0xa897('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa897('0xc'),_0xa897('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6abc=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x581c55,_0x5b74d7){var _0x57b8a9=function(_0xc9efc4){while(--_0xc9efc4){_0x581c55['push'](_0x581c55['shift']());}};_0x57b8a9(++_0x5b74d7);}(_0x6abc,0x71));var _0xc6ab=function(_0x68a0b0,_0x2bba91){_0x68a0b0=_0x68a0b0-0x0;var _0x4b4ee6=_0x6abc[_0x68a0b0];return _0x4b4ee6;};'use strict';var _=require(_0xc6ab('0x0'));var util=require(_0xc6ab('0x1'));var logger=require(_0xc6ab('0x2'))(_0xc6ab('0x3'));var moment=require(_0xc6ab('0x4'));var BPromise=require(_0xc6ab('0x5'));var rp=require('request-promise');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(_0x323dd3,_0x35bd07){return _0x323dd3[_0xc6ab('0xb')](_0xc6ab('0xc'),attributes,{'tableName':_0xc6ab('0xd'),'paranoid':![],'indexes':[{'fields':[_0xc6ab('0xe'),_0xc6ab('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 8c104af..a627aca 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 _0xb8ae=['UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','create','body','options','raw','CreateVoiceAgentReport','debug','VoiceAgentReport','update','where','attributes','limit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb8ae,0x13c));var _0xeb8a=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb8ae[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xeb8a('0x0'));var util=require(_0xeb8a('0x1'));var moment=require(_0xeb8a('0x2'));var BPromise=require(_0xeb8a('0x3'));var rs=require(_0xeb8a('0x4'));var fs=require('fs');var Redis=require(_0xeb8a('0x5'));var db=require(_0xeb8a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb8a('0x7'))('rpc');var config=require(_0xeb8a('0x8'));var jayson=require(_0xeb8a('0x9'));var client=jayson[_0xeb8a('0xa')][_0xeb8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3985ec,_0x4cdd13,_0x203228){return new BPromise(function(_0x89af48,_0x5b4a73){return client[_0xeb8a('0xc')](_0x3985ec,_0x203228)[_0xeb8a('0xd')](function(_0x75bbda){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x4cdd13,'request\x20sent');logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4cdd13,_0xeb8a('0xe'),JSON[_0xeb8a('0xf')](_0x75bbda));if(_0x75bbda[_0xeb8a('0x10')]){if(_0x75bbda[_0xeb8a('0x10')][_0xeb8a('0x11')]===0x1f4){logger['error'](_0xeb8a('0x12'),_0x4cdd13,_0x75bbda[_0xeb8a('0x10')]['message']);return _0x5b4a73(_0x75bbda[_0xeb8a('0x10')][_0xeb8a('0x13')]);}logger[_0xeb8a('0x10')](_0xeb8a('0x12'),_0x4cdd13,_0x75bbda[_0xeb8a('0x10')]['message']);return _0x89af48(_0x75bbda[_0xeb8a('0x10')][_0xeb8a('0x13')]);}else{logger[_0xeb8a('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cdd13,'request\x20sent');_0x89af48(_0x75bbda[_0xeb8a('0x15')][_0xeb8a('0x13')]);}})[_0xeb8a('0x16')](function(_0x16ac5f){logger[_0xeb8a('0x10')](_0xeb8a('0x12'),_0x4cdd13,_0x16ac5f);_0x5b4a73(_0x16ac5f);});});}exports['CreateVoiceAgentReport']=function(_0x167193){var _0x58ea14=this;return new Promise(function(_0x219057,_0x2da3ec){return db['VoiceAgentReport'][_0xeb8a('0x17')](_0x167193[_0xeb8a('0x18')],{'raw':_0x167193[_0xeb8a('0x19')]?_0x167193[_0xeb8a('0x19')][_0xeb8a('0x1a')]===undefined?!![]:![]:!![]})[_0xeb8a('0xd')](function(_0xd4b1a2){logger[_0xeb8a('0x14')](_0xeb8a('0x1b'),_0x167193);logger[_0xeb8a('0x1c')](_0xeb8a('0x1b'),_0x167193,JSON[_0xeb8a('0xf')](_0xd4b1a2));_0x219057(_0xd4b1a2);})['catch'](function(_0x44850c){logger['error']('CreateVoiceAgentReport',_0x44850c['message'],_0x167193);_0x2da3ec(_0x58ea14[_0xeb8a('0x10')](0x1f4,_0x44850c[_0xeb8a('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x4e70b4){var _0x573d2a=this;return new Promise(function(_0xdfb4a0,_0x37162f){return db[_0xeb8a('0x1d')][_0xeb8a('0x1e')](_0x4e70b4[_0xeb8a('0x18')],{'raw':_0x4e70b4[_0xeb8a('0x19')]?_0x4e70b4[_0xeb8a('0x19')][_0xeb8a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e70b4['options']?_0x4e70b4[_0xeb8a('0x19')][_0xeb8a('0x1f')]||null:null,'attributes':_0x4e70b4[_0xeb8a('0x19')]?_0x4e70b4['options'][_0xeb8a('0x20')]||null:null,'limit':_0x4e70b4['options']?_0x4e70b4[_0xeb8a('0x19')][_0xeb8a('0x21')]||null:null})[_0xeb8a('0xd')](function(_0x4f4b4a){logger[_0xeb8a('0x14')]('UpdateVoiceAgentReport',_0x4e70b4);logger[_0xeb8a('0x1c')](_0xeb8a('0x22'),_0x4e70b4,JSON['stringify'](_0x4f4b4a));_0xdfb4a0(_0x4f4b4a);})['catch'](function(_0x4e7d52){logger['error'](_0xeb8a('0x22'),_0x4e7d52[_0xeb8a('0x13')],_0x4e70b4);_0x37162f(_0x573d2a[_0xeb8a('0x10')](0x1f4,_0x4e7d52[_0xeb8a('0x13')]));});});}; \ No newline at end of file +var _0xcc17=['message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x56d1b7,_0x1d88f5){var _0x184d91=function(_0x123bdb){while(--_0x123bdb){_0x56d1b7['push'](_0x56d1b7['shift']());}};_0x184d91(++_0x1d88f5);}(_0xcc17,0x140));var _0x7cc1=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xcc17[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0x7cc1('0x0'));var util=require(_0x7cc1('0x1'));var moment=require(_0x7cc1('0x2'));var BPromise=require(_0x7cc1('0x3'));var rs=require(_0x7cc1('0x4'));var fs=require('fs');var Redis=require(_0x7cc1('0x5'));var db=require(_0x7cc1('0x6'))['db'];var utils=require(_0x7cc1('0x7'));var logger=require(_0x7cc1('0x8'))(_0x7cc1('0x9'));var config=require(_0x7cc1('0xa'));var jayson=require(_0x7cc1('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf89e48,_0x457010,_0x10eaa8){return new BPromise(function(_0xaea3b5,_0x35f9f2){return client['request'](_0xf89e48,_0x10eaa8)[_0x7cc1('0xc')](function(_0x5e5371){logger[_0x7cc1('0xd')](_0x7cc1('0xe'),_0x457010,_0x7cc1('0xf'));logger['debug'](_0x7cc1('0x10'),_0x457010,_0x7cc1('0xf'),JSON[_0x7cc1('0x11')](_0x5e5371));if(_0x5e5371[_0x7cc1('0x12')]){if(_0x5e5371['error'][_0x7cc1('0x13')]===0x1f4){logger['error'](_0x7cc1('0xe'),_0x457010,_0x5e5371[_0x7cc1('0x12')]['message']);return _0x35f9f2(_0x5e5371[_0x7cc1('0x12')][_0x7cc1('0x14')]);}logger[_0x7cc1('0x12')](_0x7cc1('0xe'),_0x457010,_0x5e5371[_0x7cc1('0x12')]['message']);return _0xaea3b5(_0x5e5371[_0x7cc1('0x12')][_0x7cc1('0x14')]);}else{logger[_0x7cc1('0xd')](_0x7cc1('0xe'),_0x457010,_0x7cc1('0xf'));_0xaea3b5(_0x5e5371['result']['message']);}})[_0x7cc1('0x15')](function(_0x78411){logger[_0x7cc1('0x12')](_0x7cc1('0xe'),_0x457010,_0x78411);_0x35f9f2(_0x78411);});});}exports[_0x7cc1('0x16')]=function(_0x12bc59){var _0x5cd3af=this;return new Promise(function(_0x5cc1a6,_0x18f9f3){return db[_0x7cc1('0x17')][_0x7cc1('0x18')](_0x12bc59[_0x7cc1('0x19')],{'raw':_0x12bc59[_0x7cc1('0x1a')]?_0x12bc59[_0x7cc1('0x1a')][_0x7cc1('0x1b')]===undefined?!![]:![]:!![]})[_0x7cc1('0xc')](function(_0x5bf1c3){logger['info'](_0x7cc1('0x16'),_0x12bc59);logger[_0x7cc1('0x1c')](_0x7cc1('0x16'),_0x12bc59,JSON[_0x7cc1('0x11')](_0x5bf1c3));_0x5cc1a6(_0x5bf1c3);})[_0x7cc1('0x15')](function(_0x38c385){logger[_0x7cc1('0x12')](_0x7cc1('0x16'),_0x38c385[_0x7cc1('0x14')],_0x12bc59);_0x18f9f3(_0x5cd3af[_0x7cc1('0x12')](0x1f4,_0x38c385[_0x7cc1('0x14')]));});});};exports[_0x7cc1('0x1d')]=function(_0x3556c6){var _0x193caf=this;return new Promise(function(_0xf184da,_0xdbf626){return db[_0x7cc1('0x17')][_0x7cc1('0x1e')](_0x3556c6['body'],{'raw':_0x3556c6[_0x7cc1('0x1a')]?_0x3556c6[_0x7cc1('0x1a')][_0x7cc1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3556c6[_0x7cc1('0x1a')]?_0x3556c6[_0x7cc1('0x1a')][_0x7cc1('0x1f')]||null:null,'attributes':_0x3556c6['options']?_0x3556c6[_0x7cc1('0x1a')][_0x7cc1('0x20')]||null:null,'limit':_0x3556c6['options']?_0x3556c6[_0x7cc1('0x1a')][_0x7cc1('0x21')]||null:null})[_0x7cc1('0xc')](function(_0x27c06e){logger['info'](_0x7cc1('0x1d'),_0x3556c6);logger['debug'](_0x7cc1('0x1d'),_0x3556c6,JSON[_0x7cc1('0x11')](_0x27c06e));_0xf184da(_0x27c06e);})['catch'](function(_0x175044){logger[_0x7cc1('0x12')](_0x7cc1('0x1d'),_0x175044[_0x7cc1('0x14')],_0x3556c6);_0xdbf626(_0x193caf[_0x7cc1('0x12')](0x1f4,_0x175044['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4f9d370..efa1465 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 _0x52d2=['Router','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x1c1d7a,_0x3476b6){var _0x4e077c=function(_0x35ad83){while(--_0x35ad83){_0x1c1d7a['push'](_0x1c1d7a['shift']());}};_0x4e077c(++_0x3476b6);}(_0x52d2,0x13e));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x252d('0x0'));var util=require(_0x252d('0x1'));var path=require(_0x252d('0x2'));var timeout=require(_0x252d('0x3'));var express=require(_0x252d('0x4'));var router=express[_0x252d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x252d('0x6'));var config=require('../../config/environment');var controller=require(_0x252d('0x7'));router['get']('/',auth[_0x252d('0x8')](),controller[_0x252d('0x9')]);router[_0x252d('0xa')](_0x252d('0xb'),auth[_0x252d('0x8')](),controller[_0x252d('0xc')]);router[_0x252d('0xa')](_0x252d('0xd'),auth[_0x252d('0x8')](),controller[_0x252d('0xe')]);router[_0x252d('0xf')]('/',auth['isAuthenticated'](),controller[_0x252d('0x10')]);router['put'](_0x252d('0xd'),auth[_0x252d('0x8')](),controller[_0x252d('0x11')]);router['delete'](_0x252d('0xd'),auth[_0x252d('0x8')](),controller[_0x252d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0d6d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','multer','util','path'];(function(_0xa78fd3,_0x15b136){var _0x2bedb1=function(_0x333b57){while(--_0x333b57){_0xa78fd3['push'](_0xa78fd3['shift']());}};_0x2bedb1(++_0x15b136);}(_0x0d6d,0x165));var _0xd0d6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0d6d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd0d6('0x0'));var util=require(_0xd0d6('0x1'));var path=require(_0xd0d6('0x2'));var timeout=require(_0xd0d6('0x3'));var express=require(_0xd0d6('0x4'));var router=express[_0xd0d6('0x5')]();var auth=require(_0xd0d6('0x6'));var interaction=require(_0xd0d6('0x7'));var config=require(_0xd0d6('0x8'));var controller=require(_0xd0d6('0x9'));router['get']('/',auth[_0xd0d6('0xa')](),controller[_0xd0d6('0xb')]);router['get'](_0xd0d6('0xc'),auth[_0xd0d6('0xa')](),controller[_0xd0d6('0xd')]);router['get'](_0xd0d6('0xe'),auth['isAuthenticated'](),controller[_0xd0d6('0xf')]);router['post']('/',auth[_0xd0d6('0xa')](),controller[_0xd0d6('0x10')]);router['put'](_0xd0d6('0xe'),auth[_0xd0d6('0xa')](),controller[_0xd0d6('0x11')]);router[_0xd0d6('0x12')](_0xd0d6('0xe'),auth[_0xd0d6('0xa')](),controller[_0xd0d6('0x13')]);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 635acca..6ece3ad 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 _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x526a46,_0x119cc9){var _0x299cab=function(_0x49722b){while(--_0x49722b){_0x526a46['push'](_0x526a46['shift']());}};_0x299cab(++_0x119cc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2ce2e3,_0x55e299){var _0x4ead4b=function(_0x4f7b0e){while(--_0x4f7b0e){_0x2ce2e3['push'](_0x2ce2e3['shift']());}};_0x4ead4b(++_0x55e299);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 9d826e0..aa6cfab 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 _0x40dc=['error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','alias','User','findAll','rows','catch','show','params','includeAll','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x4f865f,_0x482fb5){var _0x2d14e6=function(_0x1950de){while(--_0x1950de){_0x4f865f['push'](_0x4f865f['shift']());}};_0x2d14e6(++_0x482fb5);}(_0x40dc,0x19f));var _0xc40d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40dc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc40d('0x0'));var rimraf=require(_0xc40d('0x1'));var zipdir=require(_0xc40d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc40d('0x3'));var moment=require(_0xc40d('0x4'));var BPromise=require(_0xc40d('0x5'));var Mustache=require(_0xc40d('0x6'));var util=require(_0xc40d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc40d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc40d('0x9'));var squel=require('squel');var crypto=require(_0xc40d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc40d('0xb'));var toCsv=require(_0xc40d('0x8'));var querystring=require(_0xc40d('0xc'));var Papa=require(_0xc40d('0xd'));var Redis=require('ioredis');var authService=require(_0xc40d('0xe'));var qs=require(_0xc40d('0xf'));var as=require(_0xc40d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc40d('0x11'))('api');var utils=require(_0xc40d('0x12'));var config=require(_0xc40d('0x13'));var db=require(_0xc40d('0x14'))['db'];function respondWithStatusCode(_0x2c1a4b,_0x4153e9){_0x4153e9=_0x4153e9||0xcc;return function(_0x563dd8){if(_0x563dd8){return _0x2c1a4b['sendStatus'](_0x4153e9);}return _0x2c1a4b[_0xc40d('0x15')](_0x4153e9)[_0xc40d('0x16')]();};}function respondWithResult(_0x5b413a,_0x245a23){_0x245a23=_0x245a23||0xc8;return function(_0x12e2f6){if(_0x12e2f6){return _0x5b413a[_0xc40d('0x15')](_0x245a23)[_0xc40d('0x17')](_0x12e2f6);}};}function respondWithFilteredResult(_0x3709fe,_0x2749fc){return function(_0x5699e5){if(_0x5699e5){var _0x2baf83=_0x5699e5[_0xc40d('0x18')],_0x316205=_0x2749fc[_0xc40d('0x19')],_0x31bcde=_0x2749fc[_0xc40d('0x19')]+_0x2749fc[_0xc40d('0x1a')],_0x33b513;if(_0x31bcde>=_0x2baf83){_0x31bcde=_0x2baf83;_0x33b513=0xc8;}else{_0x33b513=0xce;}_0x3709fe[_0xc40d('0x15')](_0x33b513);return _0x3709fe['set'](_0xc40d('0x1b'),_0x316205+'-'+_0x31bcde+'/'+_0x2baf83)['json'](_0x5699e5);}return null;};}function patchUpdates(_0x279410){return function(_0x2b2a2a){try{jsonpatch[_0xc40d('0x1c')](_0x2b2a2a,_0x279410,!![]);}catch(_0x1ddb32){return BPromise[_0xc40d('0x1d')](_0x1ddb32);}return _0x2b2a2a[_0xc40d('0x1e')]();};}function saveUpdates(_0x237aa4,_0x4548b5){return function(_0x42f26e){if(_0x42f26e){return _0x42f26e[_0xc40d('0x1f')](_0x237aa4)[_0xc40d('0x20')](function(_0x3e5961){return _0x3e5961;});}return null;};}function removeEntity(_0x1849ea,_0x142a5b){return function(_0x340163){if(_0x340163){return _0x340163[_0xc40d('0x21')]()['then'](function(){_0x1849ea[_0xc40d('0x15')](0xcc)[_0xc40d('0x16')]();});}};}function handleEntityNotFound(_0x2e7088,_0x3779ee){return function(_0x1da406){if(!_0x1da406){_0x2e7088[_0xc40d('0x22')](0x194);}return _0x1da406;};}function handleError(_0x290585,_0x267046){_0x267046=_0x267046||0x1f4;return function(_0x21928a){logger[_0xc40d('0x23')](_0x21928a[_0xc40d('0x24')]);if(_0x21928a['name']){delete _0x21928a[_0xc40d('0x25')];}_0x290585['status'](_0x267046)[_0xc40d('0x26')](_0x21928a);};}exports[_0xc40d('0x27')]=function(_0x2ef2c0,_0x46ef35){var _0x40df2d={},_0x114877={},_0x37ede4={'count':0x0,'rows':[]};var _0x5e0371=_[_0xc40d('0x28')](db[_0xc40d('0x29')][_0xc40d('0x2a')],function(_0x7c562c){return{'name':_0x7c562c[_0xc40d('0x2b')],'type':_0x7c562c[_0xc40d('0x2c')][_0xc40d('0x2d')]};});_0x114877['model']=_[_0xc40d('0x28')](_0x5e0371,_0xc40d('0x25'));_0x114877[_0xc40d('0x2e')]=_[_0xc40d('0x2f')](_0x2ef2c0[_0xc40d('0x2e')]);_0x114877[_0xc40d('0x30')]=_[_0xc40d('0x31')](_0x114877[_0xc40d('0x32')],_0x114877[_0xc40d('0x2e')]);_0x40df2d['attributes']=_[_0xc40d('0x31')](_0x114877[_0xc40d('0x32')],qs['fields'](_0x2ef2c0[_0xc40d('0x2e')][_0xc40d('0x33')]));_0x40df2d[_0xc40d('0x34')]=_0x40df2d[_0xc40d('0x34')][_0xc40d('0x35')]?_0x40df2d[_0xc40d('0x34')]:_0x114877[_0xc40d('0x32')];if(!_0x2ef2c0[_0xc40d('0x2e')][_0xc40d('0x36')]('nolimit')){_0x40df2d[_0xc40d('0x1a')]=qs['limit'](_0x2ef2c0[_0xc40d('0x2e')]['limit']);_0x40df2d[_0xc40d('0x19')]=qs['offset'](_0x2ef2c0[_0xc40d('0x2e')][_0xc40d('0x19')]);}_0x40df2d['order']=qs[_0xc40d('0x37')](_0x2ef2c0[_0xc40d('0x2e')][_0xc40d('0x37')]);_0x40df2d[_0xc40d('0x38')]=qs[_0xc40d('0x30')](_['pick'](_0x2ef2c0['query'],_0x114877[_0xc40d('0x30')]),_0x5e0371);if(_0x2ef2c0[_0xc40d('0x2e')][_0xc40d('0x39')]){_0x40df2d[_0xc40d('0x38')]=_[_0xc40d('0x3a')](_0x40df2d[_0xc40d('0x38')],{'$or':_[_0xc40d('0x28')](_0x5e0371,function(_0x31eaaf){if(_0x31eaaf[_0xc40d('0x2c')]!==_0xc40d('0x3b')){var _0x23abeb={};_0x23abeb[_0x31eaaf[_0xc40d('0x25')]]={'$like':'%'+_0x2ef2c0['query'][_0xc40d('0x39')]+'%'};return _0x23abeb;}})});}_0x40df2d=_[_0xc40d('0x3a')]({},_0x40df2d,_0x2ef2c0[_0xc40d('0x3c')]);var _0x43425c={'where':_0x40df2d[_0xc40d('0x38')]};return db[_0xc40d('0x29')][_0xc40d('0x18')](_0x43425c)[_0xc40d('0x20')](function(_0x2e83b3){_0x37ede4[_0xc40d('0x18')]=_0x2e83b3;if(_0x2ef2c0['query']['includeAll']){_0x40df2d[_0xc40d('0x3d')]=[{'attributes':['id',_0xc40d('0x25'),'fullname',_0xc40d('0x3e')],'model':db[_0xc40d('0x3f')],'as':_0xc40d('0x3f')}];}return db[_0xc40d('0x29')][_0xc40d('0x40')](_0x40df2d);})['then'](function(_0x58cb97){_0x37ede4[_0xc40d('0x41')]=_0x58cb97;return _0x37ede4;})[_0xc40d('0x20')](respondWithFilteredResult(_0x46ef35,_0x40df2d))[_0xc40d('0x42')](handleError(_0x46ef35,null));};exports[_0xc40d('0x43')]=function(_0x2b90ba,_0x2a42dd){var _0x14a481={'raw':!![],'where':{'id':_0x2b90ba[_0xc40d('0x44')]['id']}},_0x319ee4={};_0x319ee4['model']=_[_0xc40d('0x2f')](db['VoiceCallReport'][_0xc40d('0x2a')]);_0x319ee4['query']=_[_0xc40d('0x2f')](_0x2b90ba['query']);_0x319ee4[_0xc40d('0x30')]=_['intersection'](_0x319ee4[_0xc40d('0x32')],_0x319ee4['query']);_0x14a481[_0xc40d('0x34')]=_[_0xc40d('0x31')](_0x319ee4['model'],qs['fields'](_0x2b90ba[_0xc40d('0x2e')][_0xc40d('0x33')]));_0x14a481[_0xc40d('0x34')]=_0x14a481[_0xc40d('0x34')][_0xc40d('0x35')]?_0x14a481[_0xc40d('0x34')]:_0x319ee4[_0xc40d('0x32')];if(_0x2b90ba['query'][_0xc40d('0x45')]){_0x14a481[_0xc40d('0x3d')]=[{'all':!![]}];}_0x14a481=_['merge']({},_0x14a481,_0x2b90ba[_0xc40d('0x3c')]);return db['VoiceCallReport'][_0xc40d('0x46')](_0x14a481)[_0xc40d('0x20')](handleEntityNotFound(_0x2a42dd,null))[_0xc40d('0x20')](respondWithResult(_0x2a42dd,null))[_0xc40d('0x42')](handleError(_0x2a42dd,null));};exports[_0xc40d('0x47')]=function(_0x1682f7,_0x43513a){return db[_0xc40d('0x29')]['create'](_0x1682f7[_0xc40d('0x48')],{})['then'](respondWithResult(_0x43513a,0xc9))[_0xc40d('0x42')](handleError(_0x43513a,null));};exports[_0xc40d('0x21')]=function(_0x4154eb,_0xc2e9ef){return db[_0xc40d('0x29')][_0xc40d('0x46')]({'where':{'id':_0x4154eb[_0xc40d('0x44')]['id']}})[_0xc40d('0x20')](handleEntityNotFound(_0xc2e9ef,null))[_0xc40d('0x20')](removeEntity(_0xc2e9ef,null))[_0xc40d('0x42')](handleError(_0xc2e9ef,null));};exports[_0xc40d('0x49')]=function(_0x502a1a,_0x4fbff3){return db[_0xc40d('0x29')][_0xc40d('0x49')]()[_0xc40d('0x20')](respondWithResult(_0x4fbff3,null))[_0xc40d('0x42')](handleError(_0x4fbff3,null));};exports[_0xc40d('0x1f')]=function(_0x1bda26,_0x253d1e){if(_0x1bda26[_0xc40d('0x48')][_0xc40d('0x4a')]){delete _0x1bda26[_0xc40d('0x48')][_0xc40d('0x4a')];}return db[_0xc40d('0x29')]['find']({'where':{'uniqueid':_0x1bda26[_0xc40d('0x44')]['id'],'UserId':{'$or':[null,_0x1bda26['user']['id']]}}})[_0xc40d('0x20')](handleEntityNotFound(_0x253d1e,null))[_0xc40d('0x20')](saveUpdates(_0x1bda26[_0xc40d('0x48')],null))['then'](respondWithResult(_0x253d1e,null))[_0xc40d('0x42')](handleError(_0x253d1e,null));}; \ No newline at end of file +var _0xcbcd=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','VoiceCallReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','fullname','User','findAll','rows','catch','show','include','options','find','destroy','params','describe','body','uniqueid','user','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x114fcc,_0x29aca6){var _0x4e0556=function(_0x5de80f){while(--_0x5de80f){_0x114fcc['push'](_0x114fcc['shift']());}};_0x4e0556(++_0x29aca6);}(_0xcbcd,0x1c3));var _0xdcbc=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xcbcd[_0x151721];return _0x2deaa7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdcbc('0x0'));var rimraf=require(_0xdcbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdcbc('0x2'));var rp=require(_0xdcbc('0x3'));var moment=require(_0xdcbc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcbc('0x5'));var util=require(_0xdcbc('0x6'));var path=require(_0xdcbc('0x7'));var sox=require(_0xdcbc('0x8'));var csv=require(_0xdcbc('0x9'));var ejs=require(_0xdcbc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdcbc('0xb'));var crypto=require(_0xdcbc('0xc'));var jsforce=require(_0xdcbc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdcbc('0x9'));var querystring=require(_0xdcbc('0xe'));var Papa=require(_0xdcbc('0xf'));var Redis=require(_0xdcbc('0x10'));var authService=require(_0xdcbc('0x11'));var qs=require(_0xdcbc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcbc('0x13'));var logger=require(_0xdcbc('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ae3ab,_0x135736){_0x135736=_0x135736||0xcc;return function(_0x1c4421){if(_0x1c4421){return _0x5ae3ab[_0xdcbc('0x15')](_0x135736);}return _0x5ae3ab[_0xdcbc('0x16')](_0x135736)[_0xdcbc('0x17')]();};}function respondWithResult(_0x6ab68b,_0x3b89a4){_0x3b89a4=_0x3b89a4||0xc8;return function(_0x15cc88){if(_0x15cc88){return _0x6ab68b[_0xdcbc('0x16')](_0x3b89a4)['json'](_0x15cc88);}};}function respondWithFilteredResult(_0x5608a1,_0x252663){return function(_0x59d41f){if(_0x59d41f){var _0x268c04=_0x59d41f['count'],_0xc16c3c=_0x252663[_0xdcbc('0x18')],_0x5b0b8c=_0x252663[_0xdcbc('0x18')]+_0x252663['limit'],_0x54098a;if(_0x5b0b8c>=_0x268c04){_0x5b0b8c=_0x268c04;_0x54098a=0xc8;}else{_0x54098a=0xce;}_0x5608a1[_0xdcbc('0x16')](_0x54098a);return _0x5608a1[_0xdcbc('0x19')](_0xdcbc('0x1a'),_0xc16c3c+'-'+_0x5b0b8c+'/'+_0x268c04)[_0xdcbc('0x1b')](_0x59d41f);}return null;};}function patchUpdates(_0xedb9f0){return function(_0xe06075){try{jsonpatch[_0xdcbc('0x1c')](_0xe06075,_0xedb9f0,!![]);}catch(_0x1bfb00){return BPromise[_0xdcbc('0x1d')](_0x1bfb00);}return _0xe06075[_0xdcbc('0x1e')]();};}function saveUpdates(_0x2b2c14,_0x54e570){return function(_0x320b69){if(_0x320b69){return _0x320b69[_0xdcbc('0x1f')](_0x2b2c14)[_0xdcbc('0x20')](function(_0x9e8648){return _0x9e8648;});}return null;};}function removeEntity(_0x2269eb,_0x5bd9f6){return function(_0x45491b){if(_0x45491b){return _0x45491b['destroy']()[_0xdcbc('0x20')](function(){_0x2269eb[_0xdcbc('0x16')](0xcc)[_0xdcbc('0x17')]();});}};}function handleEntityNotFound(_0x5bd43d,_0x2cbd3d){return function(_0x421584){if(!_0x421584){_0x5bd43d[_0xdcbc('0x15')](0x194);}return _0x421584;};}function handleError(_0x18b3d8,_0x4d4bf5){_0x4d4bf5=_0x4d4bf5||0x1f4;return function(_0x52d360){logger[_0xdcbc('0x21')](_0x52d360[_0xdcbc('0x22')]);if(_0x52d360[_0xdcbc('0x23')]){delete _0x52d360[_0xdcbc('0x23')];}_0x18b3d8[_0xdcbc('0x16')](_0x4d4bf5)['send'](_0x52d360);};}exports[_0xdcbc('0x24')]=function(_0x8e0b12,_0x3c414c){var _0x327b6e={},_0x4a2f6a={},_0x1c8fa0={'count':0x0,'rows':[]};var _0x8ef1b0=_['map'](db[_0xdcbc('0x25')][_0xdcbc('0x26')],function(_0x37ecc5){return{'name':_0x37ecc5[_0xdcbc('0x27')],'type':_0x37ecc5['type'][_0xdcbc('0x28')]};});_0x4a2f6a['model']=_[_0xdcbc('0x29')](_0x8ef1b0,_0xdcbc('0x23'));_0x4a2f6a[_0xdcbc('0x2a')]=_[_0xdcbc('0x2b')](_0x8e0b12['query']);_0x4a2f6a[_0xdcbc('0x2c')]=_[_0xdcbc('0x2d')](_0x4a2f6a[_0xdcbc('0x2e')],_0x4a2f6a[_0xdcbc('0x2a')]);_0x327b6e[_0xdcbc('0x2f')]=_[_0xdcbc('0x2d')](_0x4a2f6a[_0xdcbc('0x2e')],qs[_0xdcbc('0x30')](_0x8e0b12['query']['fields']));_0x327b6e[_0xdcbc('0x2f')]=_0x327b6e[_0xdcbc('0x2f')][_0xdcbc('0x31')]?_0x327b6e[_0xdcbc('0x2f')]:_0x4a2f6a['model'];if(!_0x8e0b12[_0xdcbc('0x2a')][_0xdcbc('0x32')](_0xdcbc('0x33'))){_0x327b6e['limit']=qs[_0xdcbc('0x34')](_0x8e0b12['query'][_0xdcbc('0x34')]);_0x327b6e[_0xdcbc('0x18')]=qs[_0xdcbc('0x18')](_0x8e0b12[_0xdcbc('0x2a')][_0xdcbc('0x18')]);}_0x327b6e[_0xdcbc('0x35')]=qs[_0xdcbc('0x36')](_0x8e0b12[_0xdcbc('0x2a')][_0xdcbc('0x36')]);_0x327b6e[_0xdcbc('0x37')]=qs['filters'](_[_0xdcbc('0x38')](_0x8e0b12[_0xdcbc('0x2a')],_0x4a2f6a['filters']),_0x8ef1b0);if(_0x8e0b12[_0xdcbc('0x2a')]['filter']){_0x327b6e[_0xdcbc('0x37')]=_[_0xdcbc('0x39')](_0x327b6e[_0xdcbc('0x37')],{'$or':_[_0xdcbc('0x29')](_0x8ef1b0,function(_0x47f397){if(_0x47f397[_0xdcbc('0x3a')]!==_0xdcbc('0x3b')){var _0x1d0eb6={};_0x1d0eb6[_0x47f397['name']]={'$like':'%'+_0x8e0b12[_0xdcbc('0x2a')][_0xdcbc('0x3c')]+'%'};return _0x1d0eb6;}})});}_0x327b6e=_['merge']({},_0x327b6e,_0x8e0b12['options']);var _0x3705bb={'where':_0x327b6e[_0xdcbc('0x37')]};return db[_0xdcbc('0x25')][_0xdcbc('0x3d')](_0x3705bb)[_0xdcbc('0x20')](function(_0x28863b){_0x1c8fa0[_0xdcbc('0x3d')]=_0x28863b;if(_0x8e0b12[_0xdcbc('0x2a')][_0xdcbc('0x3e')]){_0x327b6e['include']=[{'attributes':['id',_0xdcbc('0x23'),_0xdcbc('0x3f'),'alias'],'model':db[_0xdcbc('0x40')],'as':_0xdcbc('0x40')}];}return db['VoiceCallReport'][_0xdcbc('0x41')](_0x327b6e);})['then'](function(_0x21b29d){_0x1c8fa0[_0xdcbc('0x42')]=_0x21b29d;return _0x1c8fa0;})[_0xdcbc('0x20')](respondWithFilteredResult(_0x3c414c,_0x327b6e))[_0xdcbc('0x43')](handleError(_0x3c414c,null));};exports[_0xdcbc('0x44')]=function(_0x78a4ac,_0x3976e6){var _0x499ba4={'raw':!![],'where':{'id':_0x78a4ac['params']['id']}},_0x543caa={};_0x543caa[_0xdcbc('0x2e')]=_[_0xdcbc('0x2b')](db[_0xdcbc('0x25')][_0xdcbc('0x26')]);_0x543caa[_0xdcbc('0x2a')]=_[_0xdcbc('0x2b')](_0x78a4ac[_0xdcbc('0x2a')]);_0x543caa[_0xdcbc('0x2c')]=_['intersection'](_0x543caa[_0xdcbc('0x2e')],_0x543caa[_0xdcbc('0x2a')]);_0x499ba4[_0xdcbc('0x2f')]=_[_0xdcbc('0x2d')](_0x543caa[_0xdcbc('0x2e')],qs[_0xdcbc('0x30')](_0x78a4ac[_0xdcbc('0x2a')][_0xdcbc('0x30')]));_0x499ba4['attributes']=_0x499ba4['attributes'][_0xdcbc('0x31')]?_0x499ba4[_0xdcbc('0x2f')]:_0x543caa[_0xdcbc('0x2e')];if(_0x78a4ac[_0xdcbc('0x2a')][_0xdcbc('0x3e')]){_0x499ba4[_0xdcbc('0x45')]=[{'all':!![]}];}_0x499ba4=_['merge']({},_0x499ba4,_0x78a4ac[_0xdcbc('0x46')]);return db[_0xdcbc('0x25')][_0xdcbc('0x47')](_0x499ba4)['then'](handleEntityNotFound(_0x3976e6,null))[_0xdcbc('0x20')](respondWithResult(_0x3976e6,null))[_0xdcbc('0x43')](handleError(_0x3976e6,null));};exports['create']=function(_0xe30ab1,_0xcc2e51){return db['VoiceCallReport']['create'](_0xe30ab1['body'],{})[_0xdcbc('0x20')](respondWithResult(_0xcc2e51,0xc9))['catch'](handleError(_0xcc2e51,null));};exports[_0xdcbc('0x48')]=function(_0x334fa4,_0x52bddb){return db['VoiceCallReport'][_0xdcbc('0x47')]({'where':{'id':_0x334fa4[_0xdcbc('0x49')]['id']}})[_0xdcbc('0x20')](handleEntityNotFound(_0x52bddb,null))['then'](removeEntity(_0x52bddb,null))['catch'](handleError(_0x52bddb,null));};exports[_0xdcbc('0x4a')]=function(_0x5e1faa,_0xa62ef4){return db[_0xdcbc('0x25')]['describe']()[_0xdcbc('0x20')](respondWithResult(_0xa62ef4,null))[_0xdcbc('0x43')](handleError(_0xa62ef4,null));};exports[_0xdcbc('0x1f')]=function(_0x436303,_0x1d20ca){if(_0x436303[_0xdcbc('0x4b')][_0xdcbc('0x4c')]){delete _0x436303[_0xdcbc('0x4b')][_0xdcbc('0x4c')];}return db[_0xdcbc('0x25')]['find']({'where':{'uniqueid':_0x436303[_0xdcbc('0x49')]['id'],'UserId':{'$or':[null,_0x436303[_0xdcbc('0x4d')]['id']]}}})[_0xdcbc('0x20')](handleEntityNotFound(_0x1d20ca,null))[_0xdcbc('0x20')](saveUpdates(_0x436303[_0xdcbc('0x4b')],null))[_0xdcbc('0x20')](respondWithResult(_0x1d20ca,null))[_0xdcbc('0x43')](handleError(_0x1d20ca,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9d6dd0c..433cb85 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 _0xcd3a=['./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','lodash','api','moment','bluebird','request-promise','path'];(function(_0x46e0fd,_0x1c2a97){var _0x4b7e55=function(_0x123019){while(--_0x123019){_0x46e0fd['push'](_0x46e0fd['shift']());}};_0x4b7e55(++_0x1c2a97);}(_0xcd3a,0x170));var _0xacd3=function(_0x96e591,_0x2f9c6d){_0x96e591=_0x96e591-0x0;var _0x3e874c=_0xcd3a[_0x96e591];return _0x3e874c;};'use strict';var _=require(_0xacd3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xacd3('0x1'));var moment=require(_0xacd3('0x2'));var BPromise=require(_0xacd3('0x3'));var rp=require(_0xacd3('0x4'));var fs=require('fs');var path=require(_0xacd3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xacd3('0x6'));module[_0xacd3('0x7')]=function(_0x25c833,_0x2ef7f5){return _0x25c833['define'](_0xacd3('0x8'),attributes,{'tableName':_0xacd3('0x9'),'paranoid':![],'indexes':[{'fields':[_0xacd3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1311=['./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','api','bluebird','path','rimraf','../../config/environment'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x1311,0x127));var _0x1131=function(_0x3c5e7f,_0x557566){_0x3c5e7f=_0x3c5e7f-0x0;var _0x4df292=_0x1311[_0x3c5e7f];return _0x4df292;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1131('0x0'));var moment=require('moment');var BPromise=require(_0x1131('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1131('0x2'));var rimraf=require(_0x1131('0x3'));var config=require(_0x1131('0x4'));var attributes=require(_0x1131('0x5'));module[_0x1131('0x6')]=function(_0x10445c,_0x2e9bec){return _0x10445c['define'](_0x1131('0x7'),attributes,{'tableName':_0x1131('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1131('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3fa7bac..04b2abd 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 _0xf858=['attributes','catch','body','CreateVoiceCallReport','debug','UpdateVoiceCallReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','map','model'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xf858,0xf1));var _0x8f85=function(_0x3efb0a,_0x31d621){_0x3efb0a=_0x3efb0a-0x0;var _0x1a6dac=_0xf858[_0x3efb0a];return _0x1a6dac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f85('0x0'));var BPromise=require(_0x8f85('0x1'));var rs=require(_0x8f85('0x2'));var fs=require('fs');var Redis=require(_0x8f85('0x3'));var db=require(_0x8f85('0x4'))['db'];var utils=require(_0x8f85('0x5'));var logger=require(_0x8f85('0x6'))(_0x8f85('0x7'));var config=require('../../config/environment');var jayson=require(_0x8f85('0x8'));var client=jayson[_0x8f85('0x9')][_0x8f85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21e5a4,_0x3f7352,_0x313549){return new BPromise(function(_0x1db330,_0x2d3d93){return client[_0x8f85('0xb')](_0x21e5a4,_0x313549)[_0x8f85('0xc')](function(_0x4ae237){logger[_0x8f85('0xd')](_0x8f85('0xe'),_0x3f7352,_0x8f85('0xf'));logger['debug'](_0x8f85('0x10'),_0x3f7352,_0x8f85('0xf'),JSON[_0x8f85('0x11')](_0x4ae237));if(_0x4ae237[_0x8f85('0x12')]){if(_0x4ae237[_0x8f85('0x12')][_0x8f85('0x13')]===0x1f4){logger['error'](_0x8f85('0xe'),_0x3f7352,_0x4ae237['error'][_0x8f85('0x14')]);return _0x2d3d93(_0x4ae237['error']['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3f7352,_0x4ae237[_0x8f85('0x12')][_0x8f85('0x14')]);return _0x1db330(_0x4ae237['error'][_0x8f85('0x14')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3f7352,_0x8f85('0xf'));_0x1db330(_0x4ae237[_0x8f85('0x15')][_0x8f85('0x14')]);}})['catch'](function(_0x68fe12){logger[_0x8f85('0x12')](_0x8f85('0xe'),_0x3f7352,_0x68fe12);_0x2d3d93(_0x68fe12);});});}exports[_0x8f85('0x16')]=function(_0x19134c){var _0x974337=this;return new Promise(function(_0x11a928,_0xfc8b8c){return db[_0x8f85('0x17')][_0x8f85('0x18')]({'raw':_0x19134c[_0x8f85('0x19')]?_0x19134c[_0x8f85('0x19')][_0x8f85('0x1a')]===undefined?!![]:![]:!![],'where':_0x19134c['options']?_0x19134c['options'][_0x8f85('0x1b')]||null:null,'attributes':_0x19134c[_0x8f85('0x19')]?_0x19134c['options']['attributes']||null:null,'limit':_0x19134c[_0x8f85('0x19')]?_0x19134c[_0x8f85('0x19')][_0x8f85('0x1c')]||null:null,'include':_0x19134c[_0x8f85('0x19')]?_0x19134c[_0x8f85('0x19')][_0x8f85('0x1d')]?_[_0x8f85('0x1e')](_0x19134c['options'][_0x8f85('0x1d')],function(_0x51e6fd){return{'model':db[_0x51e6fd[_0x8f85('0x1f')]],'as':_0x51e6fd['as'],'attributes':_0x51e6fd[_0x8f85('0x20')],'include':_0x51e6fd[_0x8f85('0x1d')]?_[_0x8f85('0x1e')](_0x51e6fd['include'],function(_0x4fe7de){return{'model':db[_0x4fe7de[_0x8f85('0x1f')]],'as':_0x4fe7de['as'],'attributes':_0x4fe7de[_0x8f85('0x20')],'include':_0x4fe7de['include']?_[_0x8f85('0x1e')](_0x4fe7de['include'],function(_0x574f2d){return{'model':db[_0x574f2d[_0x8f85('0x1f')]],'as':_0x574f2d['as'],'attributes':_0x574f2d[_0x8f85('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8f85('0xc')](function(_0x49d517){logger[_0x8f85('0xd')]('GetVoiceCallReport',_0x19134c);logger['debug'](_0x8f85('0x16'),_0x19134c,JSON[_0x8f85('0x11')](_0x49d517));_0x11a928(_0x49d517);})[_0x8f85('0x21')](function(_0x2be141){logger[_0x8f85('0x12')](_0x8f85('0x16'),_0x2be141[_0x8f85('0x14')],_0x19134c);_0xfc8b8c(_0x974337['error'](0x1f4,_0x2be141[_0x8f85('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x4c579e){var _0x1d2de8=this;return new Promise(function(_0x23f217,_0x487eb5){return db[_0x8f85('0x17')]['create'](_0x4c579e[_0x8f85('0x22')],{'raw':_0x4c579e[_0x8f85('0x19')]?_0x4c579e[_0x8f85('0x19')][_0x8f85('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x169a96){logger[_0x8f85('0xd')](_0x8f85('0x23'),_0x4c579e);logger[_0x8f85('0x24')](_0x8f85('0x23'),_0x4c579e,JSON[_0x8f85('0x11')](_0x169a96));_0x23f217(_0x169a96);})[_0x8f85('0x21')](function(_0x679062){logger['error'](_0x8f85('0x23'),_0x679062[_0x8f85('0x14')],_0x4c579e);_0x487eb5(_0x1d2de8['error'](0x1f4,_0x679062[_0x8f85('0x14')]));});});};exports[_0x8f85('0x25')]=function(_0x5586b6){var _0x3c4113=this;return new Promise(function(_0x2db012,_0x433ab5){return db['VoiceCallReport'][_0x8f85('0x26')](_0x5586b6[_0x8f85('0x22')],{'raw':_0x5586b6[_0x8f85('0x19')]?_0x5586b6['options'][_0x8f85('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5586b6[_0x8f85('0x19')]?_0x5586b6['options'][_0x8f85('0x1b')]||null:null,'attributes':_0x5586b6[_0x8f85('0x19')]?_0x5586b6[_0x8f85('0x19')][_0x8f85('0x20')]||null:null,'limit':_0x5586b6[_0x8f85('0x19')]?_0x5586b6[_0x8f85('0x19')][_0x8f85('0x1c')]||null:null})[_0x8f85('0xc')](function(_0x184d49){logger[_0x8f85('0xd')](_0x8f85('0x25'),_0x5586b6);logger[_0x8f85('0x24')](_0x8f85('0x25'),_0x5586b6,JSON['stringify'](_0x184d49));_0x2db012(_0x184d49);})[_0x8f85('0x21')](function(_0x28e117){logger['error'](_0x8f85('0x25'),_0x28e117[_0x8f85('0x14')],_0x5586b6);_0x433ab5(_0x3c4113[_0x8f85('0x12')](0x1f4,_0x28e117[_0x8f85('0x14')]));});});}; \ No newline at end of file +var _0x7918=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','info','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x7918,0x1da));var _0x8791=function(_0x19a019,_0x1c151a){_0x19a019=_0x19a019-0x0;var _0xcb75ed=_0x7918[_0x19a019];return _0xcb75ed;};'use strict';var _=require(_0x8791('0x0'));var util=require(_0x8791('0x1'));var moment=require(_0x8791('0x2'));var BPromise=require(_0x8791('0x3'));var rs=require(_0x8791('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8791('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8791('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8791('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x138e4b,_0x140c1f,_0x5c1b0b){return new BPromise(function(_0x204876,_0x2fa693){return client['request'](_0x138e4b,_0x5c1b0b)[_0x8791('0x8')](function(_0x33c9d3){logger['info'](_0x8791('0x9'),_0x140c1f,_0x8791('0xa'));logger[_0x8791('0xb')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x140c1f,'request\x20sent',JSON[_0x8791('0xc')](_0x33c9d3));if(_0x33c9d3[_0x8791('0xd')]){if(_0x33c9d3[_0x8791('0xd')]['code']===0x1f4){logger['error'](_0x8791('0x9'),_0x140c1f,_0x33c9d3[_0x8791('0xd')][_0x8791('0xe')]);return _0x2fa693(_0x33c9d3[_0x8791('0xd')][_0x8791('0xe')]);}logger[_0x8791('0xd')](_0x8791('0x9'),_0x140c1f,_0x33c9d3['error'][_0x8791('0xe')]);return _0x204876(_0x33c9d3['error'][_0x8791('0xe')]);}else{logger['info'](_0x8791('0x9'),_0x140c1f,'request\x20sent');_0x204876(_0x33c9d3[_0x8791('0xf')][_0x8791('0xe')]);}})[_0x8791('0x10')](function(_0x26b960){logger['error'](_0x8791('0x9'),_0x140c1f,_0x26b960);_0x2fa693(_0x26b960);});});}exports['GetVoiceCallReport']=function(_0x3dd47d){var _0x38f675=this;return new Promise(function(_0x285687,_0xc0d4f0){return db[_0x8791('0x11')][_0x8791('0x12')]({'raw':_0x3dd47d[_0x8791('0x13')]?_0x3dd47d[_0x8791('0x13')][_0x8791('0x14')]===undefined?!![]:![]:!![],'where':_0x3dd47d[_0x8791('0x13')]?_0x3dd47d[_0x8791('0x13')][_0x8791('0x15')]||null:null,'attributes':_0x3dd47d[_0x8791('0x13')]?_0x3dd47d['options'][_0x8791('0x16')]||null:null,'limit':_0x3dd47d[_0x8791('0x13')]?_0x3dd47d[_0x8791('0x13')][_0x8791('0x17')]||null:null,'include':_0x3dd47d[_0x8791('0x13')]?_0x3dd47d['options'][_0x8791('0x18')]?_[_0x8791('0x19')](_0x3dd47d[_0x8791('0x13')]['include'],function(_0x3df4b7){return{'model':db[_0x3df4b7[_0x8791('0x1a')]],'as':_0x3df4b7['as'],'attributes':_0x3df4b7[_0x8791('0x16')],'include':_0x3df4b7['include']?_[_0x8791('0x19')](_0x3df4b7[_0x8791('0x18')],function(_0xf9d617){return{'model':db[_0xf9d617[_0x8791('0x1a')]],'as':_0xf9d617['as'],'attributes':_0xf9d617[_0x8791('0x16')],'include':_0xf9d617[_0x8791('0x18')]?_[_0x8791('0x19')](_0xf9d617[_0x8791('0x18')],function(_0x2e3c82){return{'model':db[_0x2e3c82[_0x8791('0x1a')]],'as':_0x2e3c82['as'],'attributes':_0x2e3c82[_0x8791('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8791('0x8')](function(_0x21b562){logger[_0x8791('0x1b')](_0x8791('0x1c'),_0x3dd47d);logger[_0x8791('0xb')]('GetVoiceCallReport',_0x3dd47d,JSON[_0x8791('0xc')](_0x21b562));_0x285687(_0x21b562);})[_0x8791('0x10')](function(_0x34c8c7){logger[_0x8791('0xd')](_0x8791('0x1c'),_0x34c8c7['message'],_0x3dd47d);_0xc0d4f0(_0x38f675['error'](0x1f4,_0x34c8c7[_0x8791('0xe')]));});});};exports[_0x8791('0x1d')]=function(_0x5f260e){var _0x4ed2e0=this;return new Promise(function(_0x203544,_0x6129c4){return db[_0x8791('0x11')][_0x8791('0x1e')](_0x5f260e[_0x8791('0x1f')],{'raw':_0x5f260e[_0x8791('0x13')]?_0x5f260e[_0x8791('0x13')][_0x8791('0x14')]===undefined?!![]:![]:!![]})[_0x8791('0x8')](function(_0x5ebd3f){logger[_0x8791('0x1b')]('CreateVoiceCallReport',_0x5f260e);logger['debug'](_0x8791('0x1d'),_0x5f260e,JSON[_0x8791('0xc')](_0x5ebd3f));_0x203544(_0x5ebd3f);})[_0x8791('0x10')](function(_0x2fa6ca){logger[_0x8791('0xd')](_0x8791('0x1d'),_0x2fa6ca[_0x8791('0xe')],_0x5f260e);_0x6129c4(_0x4ed2e0['error'](0x1f4,_0x2fa6ca[_0x8791('0xe')]));});});};exports[_0x8791('0x20')]=function(_0x3fb42f){var _0x15c57b=this;return new Promise(function(_0x470126,_0x2b7d6d){return db[_0x8791('0x11')][_0x8791('0x21')](_0x3fb42f[_0x8791('0x1f')],{'raw':_0x3fb42f[_0x8791('0x13')]?_0x3fb42f[_0x8791('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb42f[_0x8791('0x13')]?_0x3fb42f[_0x8791('0x13')]['where']||null:null,'attributes':_0x3fb42f['options']?_0x3fb42f[_0x8791('0x13')][_0x8791('0x16')]||null:null,'limit':_0x3fb42f[_0x8791('0x13')]?_0x3fb42f[_0x8791('0x13')][_0x8791('0x17')]||null:null})[_0x8791('0x8')](function(_0x2f703a){logger[_0x8791('0x1b')]('UpdateVoiceCallReport',_0x3fb42f);logger['debug'](_0x8791('0x20'),_0x3fb42f,JSON[_0x8791('0xc')](_0x2f703a));_0x470126(_0x2f703a);})[_0x8791('0x10')](function(_0x2d540f){logger[_0x8791('0xd')](_0x8791('0x20'),_0x2d540f[_0x8791('0xe')],_0x3fb42f);_0x2b7d6d(_0x15c57b[_0x8791('0xd')](0x1f4,_0x2d540f[_0x8791('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5960670..dfe9bf3 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 _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','isAuthenticated'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x53ec,0x192));var _0xc53e=function(_0x5412c2,_0x2f3149){_0x5412c2=_0x5412c2-0x0;var _0x5766d0=_0x53ec[_0x5412c2];return _0x5766d0;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file +var _0x1d07=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller'];(function(_0x1708f3,_0x543771){var _0x19254b=function(_0x47bc93){while(--_0x47bc93){_0x1708f3['push'](_0x1708f3['shift']());}};_0x19254b(++_0x543771);}(_0x1d07,0x1e6));var _0x71d0=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1d07[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0x71d0('0x0'));var util=require(_0x71d0('0x1'));var path=require(_0x71d0('0x2'));var timeout=require(_0x71d0('0x3'));var express=require(_0x71d0('0x4'));var router=express[_0x71d0('0x5')]();var auth=require(_0x71d0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x71d0('0x7'));router[_0x71d0('0x8')]('/',auth[_0x71d0('0x9')](),controller[_0x71d0('0xa')]);router[_0x71d0('0x8')](_0x71d0('0xb'),auth[_0x71d0('0x9')](),controller['show']);router[_0x71d0('0xc')]('/',auth[_0x71d0('0x9')](),controller[_0x71d0('0xd')]);router[_0x71d0('0xe')](_0x71d0('0xb'),auth[_0x71d0('0x9')](),controller[_0x71d0('0xf')]);router[_0x71d0('0x10')]('/:id',auth[_0x71d0('0x9')](),controller[_0x71d0('0x11')]);module[_0x71d0('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 e22b43b..2d452d8 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 _0x5141=['BOOLEAN','sequelize','exports','STRING','options','join','getDataValue'];(function(_0x583be1,_0x50104e){var _0xecf7f9=function(_0x14b342){while(--_0x14b342){_0x583be1['push'](_0x583be1['shift']());}};_0xecf7f9(++_0x50104e);}(_0x5141,0x1ac));var _0x1514=function(_0x7aa83e,_0x143a70){_0x7aa83e=_0x7aa83e-0x0;var _0x2eea80=_0x5141[_0x7aa83e];return _0x2eea80;};'use strict';var Sequelize=require(_0x1514('0x0'));module[_0x1514('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1514('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1514('0x2')],'set':function(_0x436c34){this['setDataValue'](_0x1514('0x3'),_0x436c34?_0x436c34[_0x1514('0x4')](''):[]);},'get':function(){return this[_0x1514('0x5')](_0x1514('0x3'))?this[_0x1514('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x1514('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x1514('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1514('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaecb=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x17431a,_0x4f9a4d){var _0x40f46f=function(_0x54627f){while(--_0x54627f){_0x17431a['push'](_0x17431a['shift']());}};_0x40f46f(++_0x4f9a4d);}(_0xaecb,0xec));var _0xbaec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaecb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xbaec('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xbaec('0x1')],'unique':_0xbaec('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xbaec('0x1')],'set':function(_0x6e5406){this[_0xbaec('0x3')](_0xbaec('0x4'),_0x6e5406?_0x6e5406[_0xbaec('0x5')](''):[]);},'get':function(){return this[_0xbaec('0x6')]('options')?this['getDataValue'](_0xbaec('0x4'))[_0xbaec('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xbaec('0x1')]},'record':{'type':Sequelize[_0xbaec('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbaec('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 483a802..62bb4f6 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 _0x93fe=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','ChanSpies','UserProfileResource','stack','name','index','map','VoiceChanSpy','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','keys','include','options','find'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x93fe,0xf8));var _0xe93f=function(_0x181713,_0x3e3b73){_0x181713=_0x181713-0x0;var _0x416976=_0x93fe[_0x181713];return _0x416976;};'use strict';var pdf=require(_0xe93f('0x0'));var emlformat=require(_0xe93f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe93f('0x2'));var jsonpatch=require(_0xe93f('0x3'));var rp=require(_0xe93f('0x4'));var moment=require(_0xe93f('0x5'));var BPromise=require(_0xe93f('0x6'));var Mustache=require(_0xe93f('0x7'));var util=require('util');var path=require(_0xe93f('0x8'));var sox=require(_0xe93f('0x9'));var csv=require(_0xe93f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe93f('0xb'));var squel=require(_0xe93f('0xc'));var crypto=require(_0xe93f('0xd'));var jsforce=require(_0xe93f('0xe'));var deskjs=require(_0xe93f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe93f('0x10'));var Papa=require('papaparse');var Redis=require(_0xe93f('0x11'));var authService=require(_0xe93f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe93f('0x13'));var hardwareService=require(_0xe93f('0x14'));var logger=require(_0xe93f('0x15'))('api');var utils=require(_0xe93f('0x16'));var config=require(_0xe93f('0x17'));var db=require(_0xe93f('0x18'))['db'];function respondWithStatusCode(_0x104df4,_0x4e1d70){_0x4e1d70=_0x4e1d70||0xcc;return function(_0x419ae7){if(_0x419ae7){return _0x104df4[_0xe93f('0x19')](_0x4e1d70);}return _0x104df4['status'](_0x4e1d70)[_0xe93f('0x1a')]();};}function respondWithResult(_0x445aae,_0x42daeb){_0x42daeb=_0x42daeb||0xc8;return function(_0x209d24){if(_0x209d24){return _0x445aae[_0xe93f('0x1b')](_0x42daeb)[_0xe93f('0x1c')](_0x209d24);}};}function respondWithFilteredResult(_0x32864a,_0x45e59f){return function(_0x7b4e5f){if(_0x7b4e5f){var _0x368d68=_0x7b4e5f[_0xe93f('0x1d')],_0xdd080b=_0x45e59f['offset'],_0xa061a9=_0x45e59f[_0xe93f('0x1e')]+_0x45e59f[_0xe93f('0x1f')],_0x54271f;if(_0xa061a9>=_0x368d68){_0xa061a9=_0x368d68;_0x54271f=0xc8;}else{_0x54271f=0xce;}_0x32864a[_0xe93f('0x1b')](_0x54271f);return _0x32864a[_0xe93f('0x20')](_0xe93f('0x21'),_0xdd080b+'-'+_0xa061a9+'/'+_0x368d68)[_0xe93f('0x1c')](_0x7b4e5f);}return null;};}function patchUpdates(_0x1727cc){return function(_0x3fdfce){try{jsonpatch[_0xe93f('0x22')](_0x3fdfce,_0x1727cc,!![]);}catch(_0x48cf33){return BPromise[_0xe93f('0x23')](_0x48cf33);}return _0x3fdfce['save']();};}function saveUpdates(_0x49e274,_0x4fbf61){return function(_0x486d81){if(_0x486d81){return _0x486d81['update'](_0x49e274)['then'](function(_0x433530){return _0x433530;});}return null;};}function removeEntity(_0x236ace,_0x51611b){return function(_0xcb6724){if(_0xcb6724){return _0xcb6724[_0xe93f('0x24')]()[_0xe93f('0x25')](function(){var _0x41f004=_0xcb6724['get']({'plain':!![]});var _0x58ed39=_0xe93f('0x26');return db[_0xe93f('0x27')]['destroy']({'where':{'type':_0x58ed39,'resourceId':_0x41f004['id']}})[_0xe93f('0x25')](function(){return _0xcb6724;});})[_0xe93f('0x25')](function(){_0x236ace[_0xe93f('0x1b')](0xcc)[_0xe93f('0x1a')]();});}};}function handleEntityNotFound(_0x5be7d0,_0x59453a){return function(_0xe1daf8){if(!_0xe1daf8){_0x5be7d0['sendStatus'](0x194);}return _0xe1daf8;};}function handleError(_0x2ca748,_0x3b4933){_0x3b4933=_0x3b4933||0x1f4;return function(_0x4a7fcc){logger['error'](_0x4a7fcc[_0xe93f('0x28')]);if(_0x4a7fcc[_0xe93f('0x29')]){delete _0x4a7fcc[_0xe93f('0x29')];}_0x2ca748['status'](_0x3b4933)['send'](_0x4a7fcc);};}exports[_0xe93f('0x2a')]=function(_0x4ab7ca,_0x263f96){var _0x242982={},_0x4a415d={},_0x277ecf={'count':0x0,'rows':[]};var _0x5c994c=_[_0xe93f('0x2b')](db[_0xe93f('0x2c')][_0xe93f('0x2d')],function(_0x185d2b){return{'name':_0x185d2b['fieldName'],'type':_0x185d2b[_0xe93f('0x2e')]['key']};});_0x4a415d[_0xe93f('0x2f')]=_['map'](_0x5c994c,_0xe93f('0x29'));_0x4a415d['query']=_['keys'](_0x4ab7ca[_0xe93f('0x30')]);_0x4a415d[_0xe93f('0x31')]=_[_0xe93f('0x32')](_0x4a415d[_0xe93f('0x2f')],_0x4a415d[_0xe93f('0x30')]);_0x242982[_0xe93f('0x33')]=_[_0xe93f('0x32')](_0x4a415d[_0xe93f('0x2f')],qs['fields'](_0x4ab7ca['query'][_0xe93f('0x34')]));_0x242982[_0xe93f('0x33')]=_0x242982['attributes'][_0xe93f('0x35')]?_0x242982[_0xe93f('0x33')]:_0x4a415d[_0xe93f('0x2f')];if(!_0x4ab7ca[_0xe93f('0x30')][_0xe93f('0x36')]('nolimit')){_0x242982[_0xe93f('0x1f')]=qs[_0xe93f('0x1f')](_0x4ab7ca[_0xe93f('0x30')]['limit']);_0x242982[_0xe93f('0x1e')]=qs[_0xe93f('0x1e')](_0x4ab7ca['query'][_0xe93f('0x1e')]);}_0x242982['order']=qs[_0xe93f('0x37')](_0x4ab7ca[_0xe93f('0x30')][_0xe93f('0x37')]);_0x242982[_0xe93f('0x38')]=qs[_0xe93f('0x31')](_['pick'](_0x4ab7ca[_0xe93f('0x30')],_0x4a415d['filters']),_0x5c994c);if(_0x4ab7ca[_0xe93f('0x30')]['filter']){_0x242982[_0xe93f('0x38')]=_[_0xe93f('0x39')](_0x242982[_0xe93f('0x38')],{'$or':_[_0xe93f('0x2b')](_0x5c994c,function(_0x20a543){if(_0x20a543[_0xe93f('0x2e')]!==_0xe93f('0x3a')){var _0x27bd57={};_0x27bd57[_0x20a543[_0xe93f('0x29')]]={'$like':'%'+_0x4ab7ca['query'][_0xe93f('0x3b')]+'%'};return _0x27bd57;}})});}_0x242982=_[_0xe93f('0x39')]({},_0x242982,_0x4ab7ca['options']);var _0x140128={'where':_0x242982['where']};return db[_0xe93f('0x2c')][_0xe93f('0x1d')](_0x140128)[_0xe93f('0x25')](function(_0x440889){_0x277ecf['count']=_0x440889;if(_0x4ab7ca['query'][_0xe93f('0x3c')]){_0x242982['include']=[{'all':!![]}];}return db[_0xe93f('0x2c')]['findAll'](_0x242982);})[_0xe93f('0x25')](function(_0x324352){_0x277ecf[_0xe93f('0x3d')]=_0x324352;return _0x277ecf;})[_0xe93f('0x25')](respondWithFilteredResult(_0x263f96,_0x242982))[_0xe93f('0x3e')](handleError(_0x263f96,null));};exports[_0xe93f('0x3f')]=function(_0x2f2de8,_0x5f5cb8){var _0x23219d={'raw':![],'where':{'id':_0x2f2de8['params']['id']}},_0x4ab195={};_0x4ab195[_0xe93f('0x2f')]=_[_0xe93f('0x40')](db[_0xe93f('0x2c')][_0xe93f('0x2d')]);_0x4ab195[_0xe93f('0x30')]=_['keys'](_0x2f2de8[_0xe93f('0x30')]);_0x4ab195[_0xe93f('0x31')]=_['intersection'](_0x4ab195['model'],_0x4ab195[_0xe93f('0x30')]);_0x23219d['attributes']=_[_0xe93f('0x32')](_0x4ab195[_0xe93f('0x2f')],qs[_0xe93f('0x34')](_0x2f2de8[_0xe93f('0x30')]['fields']));_0x23219d['attributes']=_0x23219d[_0xe93f('0x33')][_0xe93f('0x35')]?_0x23219d[_0xe93f('0x33')]:_0x4ab195[_0xe93f('0x2f')];if(_0x2f2de8[_0xe93f('0x30')]['includeAll']){_0x23219d[_0xe93f('0x41')]=[{'all':!![]}];}_0x23219d=_[_0xe93f('0x39')]({},_0x23219d,_0x2f2de8[_0xe93f('0x42')]);return db[_0xe93f('0x2c')][_0xe93f('0x43')](_0x23219d)['then'](handleEntityNotFound(_0x5f5cb8,null))[_0xe93f('0x25')](respondWithResult(_0x5f5cb8,null))['catch'](handleError(_0x5f5cb8,null));};exports[_0xe93f('0x44')]=function(_0x3523cb,_0x3a84ed){return db[_0xe93f('0x2c')][_0xe93f('0x44')](_0x3523cb[_0xe93f('0x45')],{})[_0xe93f('0x25')](function(_0x38478f){var _0x861b15=_0x3523cb['user']['get']({'plain':!![]});if(!_0x861b15)throw new Error(_0xe93f('0x46'));if(_0x861b15['role']===_0xe93f('0x47')){var _0x7eb131=_0x38478f[_0xe93f('0x48')]({'plain':!![]});var _0x5bb385=_0xe93f('0x26');return db[_0xe93f('0x49')]['find']({'where':{'name':_0x5bb385,'userProfileId':_0x861b15['userProfileId']},'raw':!![]})['then'](function(_0x54b2ac){if(_0x54b2ac&&_0x54b2ac[_0xe93f('0x4a')]===0x0){return db[_0xe93f('0x27')][_0xe93f('0x44')]({'name':_0x7eb131['name'],'resourceId':_0x7eb131['id'],'type':_0x54b2ac['name'],'sectionId':_0x54b2ac['id']},{})[_0xe93f('0x25')](function(){return _0x38478f;});}else{return _0x38478f;}})[_0xe93f('0x3e')](function(_0x207ef9){logger[_0xe93f('0x4b')](_0xe93f('0x4c'),_0x207ef9);throw _0x207ef9;});}return _0x38478f;})[_0xe93f('0x25')](respondWithResult(_0x3a84ed,0xc9))[_0xe93f('0x3e')](handleError(_0x3a84ed,null));};exports[_0xe93f('0x4d')]=function(_0x39983c,_0x71b74){if(_0x39983c['body']['id']){delete _0x39983c['body']['id'];}return db[_0xe93f('0x2c')][_0xe93f('0x43')]({'where':{'id':_0x39983c[_0xe93f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x71b74,null))['then'](saveUpdates(_0x39983c[_0xe93f('0x45')],null))[_0xe93f('0x25')](respondWithResult(_0x71b74,null))[_0xe93f('0x3e')](handleError(_0x71b74,null));};exports['destroy']=function(_0x4b6ef7,_0x2f1f49){return db['VoiceChanSpy'][_0xe93f('0x43')]({'where':{'id':_0x4b6ef7[_0xe93f('0x4e')]['id']}})[_0xe93f('0x25')](handleEntityNotFound(_0x2f1f49,null))[_0xe93f('0x25')](removeEntity(_0x2f1f49,null))[_0xe93f('0x3e')](handleError(_0x2f1f49,null));}; \ No newline at end of file +var _0xed9e=['key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','rows','catch','show','params','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','then','get','ChanSpies','UserProfileResource','sendStatus','stack','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type'];(function(_0x40c849,_0xbc22a1){var _0x7d3bef=function(_0x23df0c){while(--_0x23df0c){_0x40c849['push'](_0x40c849['shift']());}};_0x7d3bef(++_0xbc22a1);}(_0xed9e,0x151));var _0xeed9=function(_0x4ac75f,_0x140b2c){_0x4ac75f=_0x4ac75f-0x0;var _0x56ccb2=_0xed9e[_0x4ac75f];return _0x56ccb2;};'use strict';var pdf=require(_0xeed9('0x0'));var emlformat=require(_0xeed9('0x1'));var rimraf=require(_0xeed9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeed9('0x3'));var rp=require(_0xeed9('0x4'));var moment=require(_0xeed9('0x5'));var BPromise=require(_0xeed9('0x6'));var Mustache=require(_0xeed9('0x7'));var util=require(_0xeed9('0x8'));var path=require(_0xeed9('0x9'));var sox=require(_0xeed9('0xa'));var csv=require(_0xeed9('0xb'));var ejs=require(_0xeed9('0xc'));var fs=require('fs');var _=require(_0xeed9('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeed9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeed9('0xb'));var querystring=require(_0xeed9('0xf'));var Papa=require(_0xeed9('0x10'));var Redis=require(_0xeed9('0x11'));var authService=require(_0xeed9('0x12'));var qs=require(_0xeed9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33a6cb,_0x4d7a60){_0x4d7a60=_0x4d7a60||0xcc;return function(_0x420f5c){if(_0x420f5c){return _0x33a6cb['sendStatus'](_0x4d7a60);}return _0x33a6cb[_0xeed9('0x14')](_0x4d7a60)[_0xeed9('0x15')]();};}function respondWithResult(_0x34fa1a,_0x38bd87){_0x38bd87=_0x38bd87||0xc8;return function(_0xe2a2c1){if(_0xe2a2c1){return _0x34fa1a[_0xeed9('0x14')](_0x38bd87)[_0xeed9('0x16')](_0xe2a2c1);}};}function respondWithFilteredResult(_0x5b1504,_0x3a2a2c){return function(_0x396dce){if(_0x396dce){var _0x2b5cca=_0x396dce[_0xeed9('0x17')],_0x247cc4=_0x3a2a2c[_0xeed9('0x18')],_0x3f1eda=_0x3a2a2c[_0xeed9('0x18')]+_0x3a2a2c[_0xeed9('0x19')],_0x35f878;if(_0x3f1eda>=_0x2b5cca){_0x3f1eda=_0x2b5cca;_0x35f878=0xc8;}else{_0x35f878=0xce;}_0x5b1504['status'](_0x35f878);return _0x5b1504['set'](_0xeed9('0x1a'),_0x247cc4+'-'+_0x3f1eda+'/'+_0x2b5cca)['json'](_0x396dce);}return null;};}function patchUpdates(_0x161cee){return function(_0x4d4fca){try{jsonpatch['apply'](_0x4d4fca,_0x161cee,!![]);}catch(_0x4cbf43){return BPromise[_0xeed9('0x1b')](_0x4cbf43);}return _0x4d4fca[_0xeed9('0x1c')]();};}function saveUpdates(_0x2e246e,_0xccd422){return function(_0x8ee1b0){if(_0x8ee1b0){return _0x8ee1b0['update'](_0x2e246e)['then'](function(_0x6c3c42){return _0x6c3c42;});}return null;};}function removeEntity(_0x431109,_0x507852){return function(_0xb29218){if(_0xb29218){return _0xb29218[_0xeed9('0x1d')]()[_0xeed9('0x1e')](function(){var _0x40779e=_0xb29218[_0xeed9('0x1f')]({'plain':!![]});var _0x49326e=_0xeed9('0x20');return db[_0xeed9('0x21')][_0xeed9('0x1d')]({'where':{'type':_0x49326e,'resourceId':_0x40779e['id']}})[_0xeed9('0x1e')](function(){return _0xb29218;});})[_0xeed9('0x1e')](function(){_0x431109['status'](0xcc)[_0xeed9('0x15')]();});}};}function handleEntityNotFound(_0xd902c9,_0x3bca3d){return function(_0x52d0cc){if(!_0x52d0cc){_0xd902c9[_0xeed9('0x22')](0x194);}return _0x52d0cc;};}function handleError(_0x161991,_0xdd8bdd){_0xdd8bdd=_0xdd8bdd||0x1f4;return function(_0x41d97f){logger['error'](_0x41d97f[_0xeed9('0x23')]);if(_0x41d97f['name']){delete _0x41d97f['name'];}_0x161991['status'](_0xdd8bdd)[_0xeed9('0x24')](_0x41d97f);};}exports[_0xeed9('0x25')]=function(_0x54c2d8,_0x5f1e64){var _0x2e2d12={},_0x372092={},_0x13069c={'count':0x0,'rows':[]};var _0x41847b=_[_0xeed9('0x26')](db[_0xeed9('0x27')][_0xeed9('0x28')],function(_0x49fcb3){return{'name':_0x49fcb3[_0xeed9('0x29')],'type':_0x49fcb3[_0xeed9('0x2a')][_0xeed9('0x2b')]};});_0x372092[_0xeed9('0x2c')]=_[_0xeed9('0x26')](_0x41847b,_0xeed9('0x2d'));_0x372092[_0xeed9('0x2e')]=_[_0xeed9('0x2f')](_0x54c2d8[_0xeed9('0x2e')]);_0x372092[_0xeed9('0x30')]=_[_0xeed9('0x31')](_0x372092[_0xeed9('0x2c')],_0x372092[_0xeed9('0x2e')]);_0x2e2d12['attributes']=_[_0xeed9('0x31')](_0x372092[_0xeed9('0x2c')],qs[_0xeed9('0x32')](_0x54c2d8[_0xeed9('0x2e')][_0xeed9('0x32')]));_0x2e2d12['attributes']=_0x2e2d12[_0xeed9('0x33')][_0xeed9('0x34')]?_0x2e2d12[_0xeed9('0x33')]:_0x372092[_0xeed9('0x2c')];if(!_0x54c2d8[_0xeed9('0x2e')][_0xeed9('0x35')](_0xeed9('0x36'))){_0x2e2d12['limit']=qs[_0xeed9('0x19')](_0x54c2d8[_0xeed9('0x2e')][_0xeed9('0x19')]);_0x2e2d12[_0xeed9('0x18')]=qs['offset'](_0x54c2d8[_0xeed9('0x2e')]['offset']);}_0x2e2d12['order']=qs['sort'](_0x54c2d8[_0xeed9('0x2e')][_0xeed9('0x37')]);_0x2e2d12[_0xeed9('0x38')]=qs[_0xeed9('0x30')](_[_0xeed9('0x39')](_0x54c2d8[_0xeed9('0x2e')],_0x372092[_0xeed9('0x30')]),_0x41847b);if(_0x54c2d8['query']['filter']){_0x2e2d12[_0xeed9('0x38')]=_[_0xeed9('0x3a')](_0x2e2d12[_0xeed9('0x38')],{'$or':_[_0xeed9('0x26')](_0x41847b,function(_0x418220){if(_0x418220[_0xeed9('0x2a')]!==_0xeed9('0x3b')){var _0x3ff0ef={};_0x3ff0ef[_0x418220[_0xeed9('0x2d')]]={'$like':'%'+_0x54c2d8[_0xeed9('0x2e')]['filter']+'%'};return _0x3ff0ef;}})});}_0x2e2d12=_['merge']({},_0x2e2d12,_0x54c2d8['options']);var _0x12b2a5={'where':_0x2e2d12[_0xeed9('0x38')]};return db[_0xeed9('0x27')]['count'](_0x12b2a5)['then'](function(_0x3f52d3){_0x13069c[_0xeed9('0x17')]=_0x3f52d3;if(_0x54c2d8[_0xeed9('0x2e')]['includeAll']){_0x2e2d12['include']=[{'all':!![]}];}return db[_0xeed9('0x27')]['findAll'](_0x2e2d12);})[_0xeed9('0x1e')](function(_0xf64672){_0x13069c[_0xeed9('0x3c')]=_0xf64672;return _0x13069c;})[_0xeed9('0x1e')](respondWithFilteredResult(_0x5f1e64,_0x2e2d12))[_0xeed9('0x3d')](handleError(_0x5f1e64,null));};exports[_0xeed9('0x3e')]=function(_0x4abdfc,_0x5ae651){var _0x158758={'raw':![],'where':{'id':_0x4abdfc[_0xeed9('0x3f')]['id']}},_0x2881e4={};_0x2881e4['model']=_[_0xeed9('0x2f')](db[_0xeed9('0x27')][_0xeed9('0x28')]);_0x2881e4[_0xeed9('0x2e')]=_[_0xeed9('0x2f')](_0x4abdfc[_0xeed9('0x2e')]);_0x2881e4[_0xeed9('0x30')]=_[_0xeed9('0x31')](_0x2881e4[_0xeed9('0x2c')],_0x2881e4['query']);_0x158758['attributes']=_['intersection'](_0x2881e4[_0xeed9('0x2c')],qs[_0xeed9('0x32')](_0x4abdfc[_0xeed9('0x2e')][_0xeed9('0x32')]));_0x158758[_0xeed9('0x33')]=_0x158758[_0xeed9('0x33')][_0xeed9('0x34')]?_0x158758[_0xeed9('0x33')]:_0x2881e4[_0xeed9('0x2c')];if(_0x4abdfc[_0xeed9('0x2e')][_0xeed9('0x40')]){_0x158758['include']=[{'all':!![]}];}_0x158758=_['merge']({},_0x158758,_0x4abdfc[_0xeed9('0x41')]);return db[_0xeed9('0x27')][_0xeed9('0x42')](_0x158758)['then'](handleEntityNotFound(_0x5ae651,null))['then'](respondWithResult(_0x5ae651,null))[_0xeed9('0x3d')](handleError(_0x5ae651,null));};exports[_0xeed9('0x43')]=function(_0xe3d3f4,_0xe6ffd8){return db[_0xeed9('0x27')][_0xeed9('0x43')](_0xe3d3f4[_0xeed9('0x44')],{})[_0xeed9('0x1e')](function(_0x33294b){var _0xf5f0eb=_0xe3d3f4[_0xeed9('0x45')][_0xeed9('0x1f')]({'plain':!![]});if(!_0xf5f0eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf5f0eb['role']===_0xeed9('0x45')){var _0xf7d178=_0x33294b[_0xeed9('0x1f')]({'plain':!![]});var _0x40a366='ChanSpies';return db[_0xeed9('0x46')][_0xeed9('0x42')]({'where':{'name':_0x40a366,'userProfileId':_0xf5f0eb[_0xeed9('0x47')]},'raw':!![]})[_0xeed9('0x1e')](function(_0x14facd){if(_0x14facd&&_0x14facd[_0xeed9('0x48')]===0x0){return db[_0xeed9('0x21')][_0xeed9('0x43')]({'name':_0xf7d178[_0xeed9('0x2d')],'resourceId':_0xf7d178['id'],'type':_0x14facd[_0xeed9('0x2d')],'sectionId':_0x14facd['id']},{})[_0xeed9('0x1e')](function(){return _0x33294b;});}else{return _0x33294b;}})[_0xeed9('0x3d')](function(_0xc88e7f){logger[_0xeed9('0x49')](_0xeed9('0x4a'),_0xc88e7f);throw _0xc88e7f;});}return _0x33294b;})[_0xeed9('0x1e')](respondWithResult(_0xe6ffd8,0xc9))[_0xeed9('0x3d')](handleError(_0xe6ffd8,null));};exports[_0xeed9('0x4b')]=function(_0x2f8bef,_0x41f8fa){if(_0x2f8bef[_0xeed9('0x44')]['id']){delete _0x2f8bef[_0xeed9('0x44')]['id'];}return db['VoiceChanSpy'][_0xeed9('0x42')]({'where':{'id':_0x2f8bef['params']['id']}})['then'](handleEntityNotFound(_0x41f8fa,null))[_0xeed9('0x1e')](saveUpdates(_0x2f8bef[_0xeed9('0x44')],null))[_0xeed9('0x1e')](respondWithResult(_0x41f8fa,null))['catch'](handleError(_0x41f8fa,null));};exports[_0xeed9('0x1d')]=function(_0xe7c808,_0xb356c0){return db[_0xeed9('0x27')][_0xeed9('0x42')]({'where':{'id':_0xe7c808[_0xeed9('0x3f')]['id']}})['then'](handleEntityNotFound(_0xb356c0,null))['then'](removeEntity(_0xb356c0,null))['catch'](handleError(_0xb356c0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a33ee63..1829018 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 _0xe644=['internal','agent','exports','models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','catch','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','Set','chanspy','record','push','merge','MixMonitor','recordingFormat','auth','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat'];(function(_0x56f46f,_0x59db34){var _0x520c20=function(_0x226523){while(--_0x226523){_0x56f46f['push'](_0x56f46f['shift']());}};_0x520c20(++_0x59db34);}(_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 BPromise=require(_0x4e64('0x2'));var attributes=require(_0x4e64('0x3'));var getUserApplications=function(_0x18e17a,_0x1c5c75,_0x5e2d61){var _0x29c930=0x1;var _0x7b06ee=[];var _0x2f5ef0={'context':_0x1c5c75[_0x4e64('0x4')]||_0x4e64('0x5'),'exten':util[_0x4e64('0x6')]('%s%s',_0x18e17a[_0x4e64('0x7')],_0x5e2d61),'type':_0x4e64('0x8'),'isApp':![],'ChanSpyId':_0x18e17a['id'],'UserId':_0x1c5c75['id']};_0x7b06ee['push'](_['merge']({'app':_0x4e64('0x9'),'appdata':util['format']('CDR(type)=%s',_0x4e64('0xa')),'priority':_0x29c930++},_0x2f5ef0));if(_0x18e17a[_0x4e64('0xb')]){_0x7b06ee[_0x4e64('0xc')](_[_0x4e64('0xd')]({'app':_0x4e64('0xe'),'appdata':util[_0x4e64('0x6')]('${UNIQUEID}.%s,a',_0x18e17a[_0x4e64('0xf')]),'priority':_0x29c930++},_0x2f5ef0));}if(_0x18e17a[_0x4e64('0x10')]){_0x7b06ee['push'](_[_0x4e64('0xd')]({'app':'Authenticate','appdata':_0x18e17a['password'],'priority':_0x29c930++},_0x2f5ef0));}_0x7b06ee[_0x4e64('0xc')](_['merge']({'app':_0x4e64('0x11'),'appdata':util[_0x4e64('0x6')](_0x4e64('0x12'),_0x1c5c75[_0x4e64('0x13')],_0x18e17a[_0x4e64('0x14')]?_0x18e17a[_0x4e64('0x14')][_0x4e64('0x15')](''):''),'priority':_0x29c930++},_0x2f5ef0));if(_0x18e17a['record']){_0x7b06ee[_0x4e64('0xc')](_[_0x4e64('0xd')]({'app':_0x4e64('0x16'),'priority':_0x29c930++},_0x2f5ef0));}return _0x7b06ee;};var getChanSpyApplications=function(_0x5b35b0,_0x3b885a){var _0x3677f9=[];for(var _0x452f34=0x0,_0xb6bed5=0x1;_0x452f34<_0x3b885a[_0x4e64('0x17')];_0x452f34++,_0xb6bed5=0x1){_0x3677f9=_0x3677f9[_0x4e64('0x18')](getUserApplications(_0x5b35b0,_0x3b885a[_0x452f34],_0x3b885a[_0x452f34][_0x4e64('0x19')]));if(_0x3b885a[_0x452f34][_0x4e64('0x19')]!=_0x3b885a[_0x452f34][_0x4e64('0x13')]){_0x3677f9=_0x3677f9[_0x4e64('0x18')](getUserApplications(_0x5b35b0,_0x3b885a[_0x452f34],_0x3b885a[_0x452f34]['name']));}}return _0x3677f9;};var getChanSpyPromise=function(_0x15a044,_0x112797){return new BPromise(function(_0x5618bb,_0x3d378c){return _0x15a044['User']['findAll']({'attributes':['id',_0x4e64('0x13'),_0x4e64('0x19')],'where':{'role':_0x4e64('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4a5c6d){if(_0x4a5c6d){return _0x5618bb(getChanSpyApplications(_0x112797,_0x4a5c6d));}return _0x5618bb([]);})['catch'](function(_0x30e356){_0x3d378c(_0x30e356);});});};module[_0x4e64('0x1b')]=function(_0x2df7a0,_0x4edbf9){var _0xb956ca=_0x2df7a0[_0x4e64('0x1c')];return _0x2df7a0[_0x4e64('0x1d')](_0x4e64('0x1e'),attributes,{'tableName':_0x4e64('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2747cb,_0x35daf7,_0x5abddb){return getChanSpyPromise(_0xb956ca,_0x2747cb)[_0x4e64('0x20')](function(_0x29b4f8){if(_0x29b4f8&&_0x29b4f8[_0x4e64('0x17')]){return _0xb956ca['VoiceExtension'][_0x4e64('0x21')](_0x29b4f8);}})[_0x4e64('0x20')](function(){_0x5abddb();})[_0x4e64('0x22')](function(_0x457023){_0x5abddb(_0x457023);});},'afterUpdate':function(_0x45b458,_0x5f0d42,_0x3185ba){return _0xb956ca[_0x4e64('0x23')][_0x4e64('0x24')]({'where':{'ChanSpyId':_0x45b458['id']}})[_0x4e64('0x20')](function(){return getChanSpyPromise(_0xb956ca,_0x45b458);})[_0x4e64('0x20')](function(_0x1057d0){if(_0x1057d0&&_0x1057d0[_0x4e64('0x17')]){return _0xb956ca[_0x4e64('0x23')]['bulkCreate'](_0x1057d0);}})[_0x4e64('0x20')](function(){_0x3185ba();})[_0x4e64('0x22')](function(_0x45ef44){_0x3185ba(_0x45ef44);});},'afterDestroy':function(_0x330277,_0x3f00d5,_0x3b1f16){return _0xb956ca[_0x4e64('0x23')]['destroy']({'where':{'ChanSpyId':_0x330277['id']}})[_0x4e64('0x20')](function(){_0x3b1f16();})[_0x4e64('0x22')](function(_0x3cfd17){_0x3b1f16(_0x3cfd17);});}}});}; \ No newline at end of file +var _0xbde2=['StopMixMonitor','length','concat','internal','User','findAll','catch','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','then','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','Set','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','record'];(function(_0x44fe80,_0x15aa71){var _0x1812c8=function(_0x5eade){while(--_0x5eade){_0x44fe80['push'](_0x44fe80['shift']());}};_0x1812c8(++_0x15aa71);}(_0xbde2,0x7a));var _0x2bde=function(_0x50a7e6,_0x373cef){_0x50a7e6=_0x50a7e6-0x0;var _0x4d7816=_0xbde2[_0x50a7e6];return _0x4d7816;};'use strict';var _=require('lodash');var util=require(_0x2bde('0x0'));var BPromise=require(_0x2bde('0x1'));var attributes=require(_0x2bde('0x2'));var getUserApplications=function(_0x4efae2,_0x3b1018,_0x1055e2){var _0xa16ec1=0x1;var _0x530c9f=[];var _0x3622bb={'context':_0x3b1018[_0x2bde('0x3')]||_0x2bde('0x4'),'exten':util[_0x2bde('0x5')]('%s%s',_0x4efae2[_0x2bde('0x6')],_0x1055e2),'type':_0x2bde('0x7'),'isApp':![],'ChanSpyId':_0x4efae2['id'],'UserId':_0x3b1018['id']};_0x530c9f[_0x2bde('0x8')](_[_0x2bde('0x9')]({'app':_0x2bde('0xa'),'appdata':util[_0x2bde('0x5')]('CDR(type)=%s','chanspy'),'priority':_0xa16ec1++},_0x3622bb));if(_0x4efae2['record']){_0x530c9f[_0x2bde('0x8')](_[_0x2bde('0x9')]({'app':_0x2bde('0xb'),'appdata':util['format'](_0x2bde('0xc'),_0x4efae2[_0x2bde('0xd')]),'priority':_0xa16ec1++},_0x3622bb));}if(_0x4efae2[_0x2bde('0xe')]){_0x530c9f[_0x2bde('0x8')](_[_0x2bde('0x9')]({'app':_0x2bde('0xf'),'appdata':_0x4efae2['password'],'priority':_0xa16ec1++},_0x3622bb));}_0x530c9f[_0x2bde('0x8')](_['merge']({'app':_0x2bde('0x10'),'appdata':util[_0x2bde('0x5')](_0x2bde('0x11'),_0x3b1018[_0x2bde('0x12')],_0x4efae2[_0x2bde('0x13')]?_0x4efae2[_0x2bde('0x13')][_0x2bde('0x14')](''):''),'priority':_0xa16ec1++},_0x3622bb));if(_0x4efae2[_0x2bde('0x15')]){_0x530c9f[_0x2bde('0x8')](_[_0x2bde('0x9')]({'app':_0x2bde('0x16'),'priority':_0xa16ec1++},_0x3622bb));}return _0x530c9f;};var getChanSpyApplications=function(_0x1b2958,_0xaaaf2d){var _0x37f4b3=[];for(var _0x4f2f86=0x0,_0x531033=0x1;_0x4f2f86<_0xaaaf2d[_0x2bde('0x17')];_0x4f2f86++,_0x531033=0x1){_0x37f4b3=_0x37f4b3[_0x2bde('0x18')](getUserApplications(_0x1b2958,_0xaaaf2d[_0x4f2f86],_0xaaaf2d[_0x4f2f86][_0x2bde('0x19')]));if(_0xaaaf2d[_0x4f2f86][_0x2bde('0x19')]!=_0xaaaf2d[_0x4f2f86]['name']){_0x37f4b3=_0x37f4b3[_0x2bde('0x18')](getUserApplications(_0x1b2958,_0xaaaf2d[_0x4f2f86],_0xaaaf2d[_0x4f2f86][_0x2bde('0x12')]));}}return _0x37f4b3;};var getChanSpyPromise=function(_0x3d5f00,_0x34f820){return new BPromise(function(_0x1b10a4,_0x3c0acf){return _0x3d5f00[_0x2bde('0x1a')][_0x2bde('0x1b')]({'attributes':['id','name',_0x2bde('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x422e81){if(_0x422e81){return _0x1b10a4(getChanSpyApplications(_0x34f820,_0x422e81));}return _0x1b10a4([]);})[_0x2bde('0x1c')](function(_0x27b6e1){_0x3c0acf(_0x27b6e1);});});};module['exports']=function(_0x6c0da,_0x945537){var _0x38cf2c=_0x6c0da['models'];return _0x6c0da[_0x2bde('0x1d')](_0x2bde('0x1e'),attributes,{'tableName':_0x2bde('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x515ee5,_0x4eb2d8,_0x591aea){return getChanSpyPromise(_0x38cf2c,_0x515ee5)['then'](function(_0x109da2){if(_0x109da2&&_0x109da2['length']){return _0x38cf2c[_0x2bde('0x20')][_0x2bde('0x21')](_0x109da2);}})[_0x2bde('0x22')](function(){_0x591aea();})[_0x2bde('0x1c')](function(_0x4d7371){_0x591aea(_0x4d7371);});},'afterUpdate':function(_0x2d6950,_0x3e9222,_0x2cd535){return _0x38cf2c['VoiceExtension'][_0x2bde('0x23')]({'where':{'ChanSpyId':_0x2d6950['id']}})[_0x2bde('0x22')](function(){return getChanSpyPromise(_0x38cf2c,_0x2d6950);})[_0x2bde('0x22')](function(_0x336c7d){if(_0x336c7d&&_0x336c7d[_0x2bde('0x17')]){return _0x38cf2c[_0x2bde('0x20')][_0x2bde('0x21')](_0x336c7d);}})['then'](function(){_0x2cd535();})[_0x2bde('0x1c')](function(_0x5ed025){_0x2cd535(_0x5ed025);});},'afterDestroy':function(_0x3c4b1a,_0x2be21,_0x2310b7){return _0x38cf2c[_0x2bde('0x20')][_0x2bde('0x23')]({'where':{'ChanSpyId':_0x3c4b1a['id']}})[_0x2bde('0x22')](function(){_0x2310b7();})[_0x2bde('0x1c')](function(_0x422aec){_0x2310b7(_0x422aec);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0c309cc..5730aad 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 _0x6be4=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x588f75,_0x57c6a8){var _0x5eac5d=function(_0x5d7a8d){while(--_0x5d7a8d){_0x588f75['push'](_0x588f75['shift']());}};_0x5eac5d(++_0x57c6a8);}(_0x6be4,0xdf));var _0x46be=function(_0x30e64e,_0x505b1e){_0x30e64e=_0x30e64e-0x0;var _0x11116d=_0x6be4[_0x30e64e];return _0x11116d;};'use strict';var _=require(_0x46be('0x0'));var util=require(_0x46be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46be('0x2'))['db'];var utils=require(_0x46be('0x3'));var logger=require(_0x46be('0x4'))(_0x46be('0x5'));var config=require(_0x46be('0x6'));var jayson=require(_0x46be('0x7'));var client=jayson[_0x46be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4933a1,_0x588340,_0x2adfa8){return new BPromise(function(_0x2d8329,_0x4a3bfb){return client[_0x46be('0x9')](_0x4933a1,_0x2adfa8)['then'](function(_0x46953d){logger[_0x46be('0xa')](_0x46be('0xb'),_0x588340,_0x46be('0xc'));logger['debug'](_0x46be('0xd'),_0x588340,_0x46be('0xc'),JSON['stringify'](_0x46953d));if(_0x46953d[_0x46be('0xe')]){if(_0x46953d[_0x46be('0xe')][_0x46be('0xf')]===0x1f4){logger['error'](_0x46be('0xb'),_0x588340,_0x46953d[_0x46be('0xe')][_0x46be('0x10')]);return _0x4a3bfb(_0x46953d[_0x46be('0xe')][_0x46be('0x10')]);}logger['error'](_0x46be('0xb'),_0x588340,_0x46953d[_0x46be('0xe')][_0x46be('0x10')]);return _0x2d8329(_0x46953d[_0x46be('0xe')][_0x46be('0x10')]);}else{logger[_0x46be('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x588340,_0x46be('0xc'));_0x2d8329(_0x46953d['result']['message']);}})[_0x46be('0x11')](function(_0x29dfe0){logger[_0x46be('0xe')](_0x46be('0xb'),_0x588340,_0x29dfe0);_0x4a3bfb(_0x29dfe0);});});} \ No newline at end of file +var _0xcd99=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x51c2a5,_0x3e5901){var _0x743735=function(_0x20932b){while(--_0x20932b){_0x51c2a5['push'](_0x51c2a5['shift']());}};_0x743735(++_0x3e5901);}(_0xcd99,0x1c5));var _0x9cd9=function(_0x3f04a2,_0x5cef7c){_0x3f04a2=_0x3f04a2-0x0;var _0x3781fa=_0xcd99[_0x3f04a2];return _0x3781fa;};'use strict';var _=require(_0x9cd9('0x0'));var util=require(_0x9cd9('0x1'));var moment=require(_0x9cd9('0x2'));var BPromise=require(_0x9cd9('0x3'));var rs=require(_0x9cd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cd9('0x5'))['db'];var utils=require(_0x9cd9('0x6'));var logger=require(_0x9cd9('0x7'))(_0x9cd9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9cd9('0x9')][_0x9cd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51d9f8,_0x54b12d,_0x4bf643){return new BPromise(function(_0x22e93e,_0x3b5a12){return client[_0x9cd9('0xb')](_0x51d9f8,_0x4bf643)[_0x9cd9('0xc')](function(_0x3f0806){logger[_0x9cd9('0xd')](_0x9cd9('0xe'),_0x54b12d,'request\x20sent');logger[_0x9cd9('0xf')](_0x9cd9('0x10'),_0x54b12d,_0x9cd9('0x11'),JSON[_0x9cd9('0x12')](_0x3f0806));if(_0x3f0806['error']){if(_0x3f0806[_0x9cd9('0x13')][_0x9cd9('0x14')]===0x1f4){logger['error'](_0x9cd9('0xe'),_0x54b12d,_0x3f0806[_0x9cd9('0x13')][_0x9cd9('0x15')]);return _0x3b5a12(_0x3f0806['error'][_0x9cd9('0x15')]);}logger['error'](_0x9cd9('0xe'),_0x54b12d,_0x3f0806[_0x9cd9('0x13')]['message']);return _0x22e93e(_0x3f0806[_0x9cd9('0x13')]['message']);}else{logger[_0x9cd9('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x54b12d,_0x9cd9('0x11'));_0x22e93e(_0x3f0806[_0x9cd9('0x16')][_0x9cd9('0x15')]);}})[_0x9cd9('0x17')](function(_0x153884){logger[_0x9cd9('0x13')](_0x9cd9('0xe'),_0x54b12d,_0x153884);_0x3b5a12(_0x153884);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 07c3f6c..aa664b7 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 _0x6cb2=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','create','update','delete','destroy','exports','multer','path','Router'];(function(_0x20d53b,_0x250dc){var _0x21dcac=function(_0x9416c1){while(--_0x9416c1){_0x20d53b['push'](_0x20d53b['shift']());}};_0x21dcac(++_0x250dc);}(_0x6cb2,0xc0));var _0x26cb=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x6cb2[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x26cb('0x0'));var util=require('util');var path=require(_0x26cb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x26cb('0x2')]();var auth=require(_0x26cb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x26cb('0x4'));var controller=require('./voiceContext.controller');router[_0x26cb('0x5')]('/',auth[_0x26cb('0x6')](),controller['index']);router['get'](_0x26cb('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x26cb('0x6')](),controller[_0x26cb('0x8')]);router['put']('/:id',auth[_0x26cb('0x6')](),controller[_0x26cb('0x9')]);router[_0x26cb('0xa')](_0x26cb('0x7'),auth[_0x26cb('0x6')](),controller[_0x26cb('0xb')]);module[_0x26cb('0xc')]=router; \ No newline at end of file +var _0xcf9d=['connect-timeout','express','./voiceContext.controller','isAuthenticated','index','get','/:id','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0x25c27c,_0x249c4f){var _0x56664c=function(_0x31a8bb){while(--_0x31a8bb){_0x25c27c['push'](_0x25c27c['shift']());}};_0x56664c(++_0x249c4f);}(_0xcf9d,0x1dd));var _0xdcf9=function(_0x90d1b,_0x1a9d03){_0x90d1b=_0x90d1b-0x0;var _0x3f9d08=_0xcf9d[_0x90d1b];return _0x3f9d08;};'use strict';var multer=require(_0xdcf9('0x0'));var util=require(_0xdcf9('0x1'));var path=require(_0xdcf9('0x2'));var timeout=require(_0xdcf9('0x3'));var express=require(_0xdcf9('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdcf9('0x5'));router['get']('/',auth[_0xdcf9('0x6')](),controller[_0xdcf9('0x7')]);router[_0xdcf9('0x8')](_0xdcf9('0x9'),auth['isAuthenticated'](),controller[_0xdcf9('0xa')]);router['post']('/',auth[_0xdcf9('0x6')](),controller[_0xdcf9('0xb')]);router['put'](_0xdcf9('0x9'),auth['isAuthenticated'](),controller[_0xdcf9('0xc')]);router[_0xdcf9('0xd')](_0xdcf9('0x9'),auth['isAuthenticated'](),controller[_0xdcf9('0xe')]);module[_0xdcf9('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3e0b229..732a37e 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x35c67c,_0x112528){var _0xe12616=function(_0x1c26a7){while(--_0x1c26a7){_0x35c67c['push'](_0x35c67c['shift']());}};_0xe12616(++_0x112528);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x26d9bb,_0x3e8e72){var _0x127ea7=function(_0x5b7def){while(--_0x5b7def){_0x26d9bb['push'](_0x26d9bb['shift']());}};_0x127ea7(++_0x3e8e72);}(_0x3e74,0x175));var _0x43e7=function(_0x256717,_0x49150c){_0x256717=_0x256717-0x0;var _0x43bc09=_0x3e74[_0x256717];return _0x43bc09;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'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 8567c59..772ba5d 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 _0x3e74=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','findAll','show','params','include','find','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','server/files/templates/context.ejs','chan_sip.so','render','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','request','then'];(function(_0xbb0d92,_0x3042d3){var _0x956fd7=function(_0x237972){while(--_0x237972){_0xbb0d92['push'](_0xbb0d92['shift']());}};_0x956fd7(++_0x3042d3);}(_0x3e74,0x175));var _0x43e7=function(_0x4ebf1c,_0x30d5e9){_0x4ebf1c=_0x4ebf1c-0x0;var _0x2ce87a=_0x3e74[_0x4ebf1c];return _0x2ce87a;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');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('0x8'));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 db=require('../../mysqldb')['db'];var jayson=require(_0x43e7('0x14'));var client=jayson[_0x43e7('0x15')][_0x43e7('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3bb83f,_0x4e008c,_0x583d85){if(_0x583d85){var _0x2fcb36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcb36[_0x43e7('0x17')](_0x4e008c)){return _0x3bb83f;}else{throw new db[(_0x43e7('0x18'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x3bb83f;}}function respondWithRpcPromise(_0x16849c,_0x14c146,_0x203378,_0x328445){return new BPromise(function(_0x4de324,_0x5c4eaa){var _0xdf16c=_0x328445||client;return _0xdf16c[_0x43e7('0x19')](_0x16849c,_0x203378)[_0x43e7('0x1a')](function(_0x5d346f){logger['info'](_0x43e7('0x1b'),_0x14c146,_0x43e7('0x1c'));logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x14c146,_0x43e7('0x1c'),JSON[_0x43e7('0x1f')](_0x5d346f));if(_0x5d346f[_0x43e7('0x20')]){if(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x21')]===0x1f4){logger[_0x43e7('0x20')](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')]['message']);return _0x5c4eaa(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}logger['error'](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);return _0x4de324(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}else{logger[_0x43e7('0x23')]('VoiceContext,\x20%s,\x20%s',_0x14c146,_0x43e7('0x1c'));_0x4de324(_0x5d346f['result']['message']);}})[_0x43e7('0x24')](function(_0x43f4ff){logger['error'](_0x43e7('0x1b'),_0x14c146,_0x43f4ff);_0x5c4eaa(_0x43f4ff);});});}function respondWithStatusCode(_0x4ca5cf,_0x326dab){_0x326dab=_0x326dab||0xcc;return function(_0x5c5e67){if(_0x5c5e67){return _0x4ca5cf[_0x43e7('0x25')](_0x326dab);}return _0x4ca5cf[_0x43e7('0x26')](_0x326dab)[_0x43e7('0x27')]();};}function respondWithResult(_0x405f85,_0x51f4d7){_0x51f4d7=_0x51f4d7||0xc8;return function(_0x52b7b3){if(_0x52b7b3){return _0x405f85[_0x43e7('0x26')](_0x51f4d7)['json'](_0x52b7b3);}};}function respondWithFilteredResult(_0x2dd5f,_0x40dc8f){return function(_0x3565cf){if(_0x3565cf){var _0xb1fc63=_0x3565cf[_0x43e7('0x28')],_0x5087d7=_0x40dc8f[_0x43e7('0x29')],_0x33a1a5=_0x40dc8f[_0x43e7('0x29')]+_0x40dc8f[_0x43e7('0x2a')],_0x4690a6;if(_0x33a1a5>=_0xb1fc63){_0x33a1a5=_0xb1fc63;_0x4690a6=0xc8;}else{_0x4690a6=0xce;}_0x2dd5f[_0x43e7('0x26')](_0x4690a6);return _0x2dd5f[_0x43e7('0x2b')](_0x43e7('0x2c'),_0x5087d7+'-'+_0x33a1a5+'/'+_0xb1fc63)[_0x43e7('0x2d')](_0x3565cf);}return null;};}function patchUpdates(_0x17df44){return function(_0x19725a){try{jsonpatch[_0x43e7('0x2e')](_0x19725a,_0x17df44,!![]);}catch(_0x208706){return BPromise['reject'](_0x208706);}return _0x19725a[_0x43e7('0x2f')]();};}function saveUpdates(_0x44f6b0,_0x3b8f78){return function(_0x183c81){if(_0x183c81){return _0x183c81[_0x43e7('0x30')](_0x44f6b0)['then'](function(_0x1eba65){return _0x1eba65;});}return null;};}function removeEntity(_0x49b83d,_0x30d47e){return function(_0x3f280d){if(_0x3f280d){return _0x3f280d['destroy']()['then'](function(){var _0x5e203f=_0x3f280d[_0x43e7('0x31')]({'plain':!![]});var _0xbe6e28=_0x43e7('0x32');return db[_0x43e7('0x33')][_0x43e7('0x34')]({'where':{'type':_0xbe6e28,'resourceId':_0x5e203f['id']}})[_0x43e7('0x1a')](function(){return _0x3f280d;});})['then'](function(){_0x49b83d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e5b2,_0x4e8e86){return function(_0x564f0e){if(!_0x564f0e){_0x59e5b2['sendStatus'](0x194);}return _0x564f0e;};}function handleError(_0x14d888,_0x49cda6){_0x49cda6=_0x49cda6||0x1f4;return function(_0x2b4bfd){logger[_0x43e7('0x20')](_0x2b4bfd[_0x43e7('0x35')]);if(_0x2b4bfd[_0x43e7('0x36')]){delete _0x2b4bfd[_0x43e7('0x36')];}_0x14d888[_0x43e7('0x26')](_0x49cda6)[_0x43e7('0x37')](_0x2b4bfd);};}exports['index']=function(_0x5332d9,_0x5d84f4){var _0xfa0474={},_0xfe70e9={},_0x199ff6={'count':0x0,'rows':[]};var _0x16cdba=_[_0x43e7('0x38')](db[_0x43e7('0x39')][_0x43e7('0x3a')],function(_0x2ffd43){return{'name':_0x2ffd43['fieldName'],'type':_0x2ffd43[_0x43e7('0x3b')][_0x43e7('0x3c')]};});_0xfe70e9['model']=_[_0x43e7('0x38')](_0x16cdba,'name');_0xfe70e9[_0x43e7('0x3d')]=_[_0x43e7('0x3e')](_0x5332d9[_0x43e7('0x3d')]);_0xfe70e9[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],_0xfe70e9['query']);_0xfa0474['attributes']=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x42')]));_0xfa0474['attributes']=_0xfa0474[_0x43e7('0x43')][_0x43e7('0x44')]?_0xfa0474['attributes']:_0xfe70e9[_0x43e7('0x41')];if(!_0x5332d9['query'][_0x43e7('0x45')]('nolimit')){_0xfa0474[_0x43e7('0x2a')]=qs[_0x43e7('0x2a')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x2a')]);_0xfa0474['offset']=qs['offset'](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x29')]);}_0xfa0474[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x5332d9['query']['sort']);_0xfa0474['where']=qs[_0x43e7('0x3f')](_['pick'](_0x5332d9[_0x43e7('0x3d')],_0xfe70e9['filters']),_0x16cdba);if(_0x5332d9['query'][_0x43e7('0x48')]){_0xfa0474['where']=_[_0x43e7('0x49')](_0xfa0474[_0x43e7('0x4a')],{'$or':_[_0x43e7('0x38')](_0x16cdba,function(_0x99b9e1){if(_0x99b9e1['type']!==_0x43e7('0x4b')){var _0x2b9046={};_0x2b9046[_0x99b9e1[_0x43e7('0x36')]]={'$like':'%'+_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x48')]+'%'};return _0x2b9046;}})});}_0xfa0474=_[_0x43e7('0x49')]({},_0xfa0474,_0x5332d9['options']);var _0x4930a2={'where':_0xfa0474[_0x43e7('0x4a')]};return db[_0x43e7('0x39')][_0x43e7('0x28')](_0x4930a2)['then'](function(_0x5c1c18){_0x199ff6['count']=_0x5c1c18;if(_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0xfa0474['include']=[{'all':!![]}];}return db[_0x43e7('0x39')][_0x43e7('0x4d')](_0xfa0474);})[_0x43e7('0x1a')](function(_0x560329){_0x199ff6['rows']=_0x560329;return _0x199ff6;})['then'](respondWithFilteredResult(_0x5d84f4,_0xfa0474))['catch'](handleError(_0x5d84f4,null));};exports[_0x43e7('0x4e')]=function(_0xe955fc,_0x52fea5){var _0x23e7cb={'raw':![],'where':{'id':_0xe955fc[_0x43e7('0x4f')]['id']}},_0x82d32f={};_0x82d32f[_0x43e7('0x41')]=_['keys'](db[_0x43e7('0x39')]['rawAttributes']);_0x82d32f['query']=_[_0x43e7('0x3e')](_0xe955fc[_0x43e7('0x3d')]);_0x82d32f[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],_0x82d32f[_0x43e7('0x3d')]);_0x23e7cb[_0x43e7('0x43')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0xe955fc['query'][_0x43e7('0x42')]));_0x23e7cb[_0x43e7('0x43')]=_0x23e7cb['attributes'][_0x43e7('0x44')]?_0x23e7cb['attributes']:_0x82d32f[_0x43e7('0x41')];if(_0xe955fc[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0x23e7cb[_0x43e7('0x50')]=[{'all':!![]}];}_0x23e7cb=_[_0x43e7('0x49')]({},_0x23e7cb,_0xe955fc['options']);return db['VoiceContext'][_0x43e7('0x51')](_0x23e7cb)[_0x43e7('0x1a')](handleEntityNotFound(_0x52fea5,null))[_0x43e7('0x1a')](respondWithResult(_0x52fea5,null))[_0x43e7('0x24')](handleError(_0x52fea5,null));};exports[_0x43e7('0x52')]=function(_0x25bb44,_0xa47464,_0x44f8a0){var _0x26d86c;return db[_0x43e7('0x39')][_0x43e7('0x52')](_0x25bb44['body'],{'raw':!![]})[_0x43e7('0x1a')](function(_0x2da2f3){_0x26d86c=_0x2da2f3;return db['VoiceContext'][_0x43e7('0x4d')]({'raw':!![]});})[_0x43e7('0x1a')](function(_0x2d0052){var _0x558d54=fs['readFileSync'](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x54506d=ejs['render'](_0x558d54,{'contexts':_0x2d0052||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x54506d);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x52'),{'module':'chan_sip.so'});})[_0x43e7('0x1a')](function(){var _0xdb9fbe=_0x25bb44['user'][_0x43e7('0x31')]({'plain':!![]});if(!_0xdb9fbe)throw new Error(_0x43e7('0x59'));if(_0xdb9fbe[_0x43e7('0x5a')]==='user'){var _0x5a4c95=_0x26d86c['get']({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x51')]({'where':{'name':_0x43e7('0x32'),'userProfileId':_0xdb9fbe[_0x43e7('0x5c')]},'raw':!![]})['then'](function(_0x5a50fc){if(_0x5a50fc&&_0x5a50fc[_0x43e7('0x5d')]===0x0){return db[_0x43e7('0x33')][_0x43e7('0x52')]({'name':_0x5a4c95[_0x43e7('0x36')],'resourceId':_0x5a4c95['id'],'type':_0x5a50fc['name'],'sectionId':_0x5a50fc['id']},{})[_0x43e7('0x1a')](function(){return _0x26d86c;});}else{return _0x26d86c;}})[_0x43e7('0x24')](function(_0x23595c){logger[_0x43e7('0x20')](_0x43e7('0x5e'),_0x23595c);throw _0x23595c;});}return _0x26d86c;})[_0x43e7('0x1a')](respondWithResult(_0xa47464,0xc9))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x30')]=function(_0x406155,_0x381208,_0x252f00){var _0x57fdfe;return db['VoiceContext'][_0x43e7('0x51')]({'where':{'id':_0x406155['params']['id']}})['then'](handleEntityNotFound(_0x381208,null))['then'](saveUpdates(_0x406155[_0x43e7('0x5f')],null))[_0x43e7('0x1a')](function(_0x5d7b37){if(_0x5d7b37){_0x57fdfe=_0x5d7b37;return db[_0x43e7('0x39')][_0x43e7('0x4d')]({'raw':!![]});}})[_0x43e7('0x1a')](function(_0x537a53){var _0x2b7406=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],_0x43e7('0x61')),_0x43e7('0x55'));var _0x1e02fa=ejs['render'](_0x2b7406,{'contexts':_0x537a53||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x1e02fa);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x43e7('0x62')});})['then'](function(){return _0x57fdfe;})['then'](respondWithResult(_0x381208,null))[_0x43e7('0x24')](handleError(_0x381208,null));};exports[_0x43e7('0x34')]=function(_0x5b5833,_0x88c7f,_0x28b21d){var _0x1e2fed;return db[_0x43e7('0x39')][_0x43e7('0x51')]({'where':{'id':_0x5b5833[_0x43e7('0x4f')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x88c7f,null))['then'](removeEntity(_0x88c7f,null))[_0x43e7('0x1a')](function(){return db[_0x43e7('0x39')]['findAll']({'raw':!![]});})[_0x43e7('0x1a')](function(_0x5c2c5f){var _0x26ee52=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x2646c2=ejs[_0x43e7('0x63')](_0x26ee52,{'contexts':_0x5c2c5f});fs['writeFileSync'](_0x43e7('0x57'),_0x2646c2);return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x34'),{'module':_0x43e7('0x62')});})[_0x43e7('0x24')](handleError(_0x88c7f,null));}; \ No newline at end of file +var _0x008c=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','VoiceContext,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','status','end','count','offset','limit','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger'];(function(_0x4be9e1,_0x21054a){var _0x2e7b12=function(_0x76caf6){while(--_0x76caf6){_0x4be9e1['push'](_0x4be9e1['shift']());}};_0x2e7b12(++_0x21054a);}(_0x008c,0x188));var _0xc008=function(_0x4dbe5c,_0x36ed26){_0x4dbe5c=_0x4dbe5c-0x0;var _0x57bd05=_0x008c[_0x4dbe5c];return _0x57bd05;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');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 db=require(_0xc008('0x16'))['db'];var jayson=require(_0xc008('0x17'));var client=jayson[_0xc008('0x18')][_0xc008('0x19')]({'port':0x232a});function checkPasswordPattern(_0x69726e,_0x593f7a,_0x560e28){if(_0x560e28){var _0x33f44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f44c['test'](_0x593f7a)){return _0x69726e;}else{throw new db[(_0xc008('0x1a'))][(_0xc008('0x1b'))](_0xc008('0x1c'));}}else{return _0x69726e;}}function respondWithRpcPromise(_0x339ffc,_0x3f0ecf,_0x5ee00b,_0x5e894e){return new BPromise(function(_0x4bd0f4,_0x11ef38){var _0x15a6ad=_0x5e894e||client;return _0x15a6ad[_0xc008('0x1d')](_0x339ffc,_0x5ee00b)[_0xc008('0x1e')](function(_0x4fe771){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,'request\x20sent');logger[_0xc008('0x1f')](_0xc008('0x20'),_0x3f0ecf,'request\x20sent',JSON[_0xc008('0x21')](_0x4fe771));if(_0x4fe771['error']){if(_0x4fe771['error']['code']===0x1f4){logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771['error']['message']);return _0x11ef38(_0x4fe771['error']['message']);}logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);return _0x4bd0f4(_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);}else{logger[_0xc008('0x25')]('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,_0xc008('0x26'));_0x4bd0f4(_0x4fe771['result']['message']);}})[_0xc008('0x27')](function(_0x36f358){logger[_0xc008('0x23')](_0xc008('0x22'),_0x3f0ecf,_0x36f358);_0x11ef38(_0x36f358);});});}function respondWithStatusCode(_0x5410f5,_0x48582b){_0x48582b=_0x48582b||0xcc;return function(_0x5de1e9){if(_0x5de1e9){return _0x5410f5[_0xc008('0x28')](_0x48582b);}return _0x5410f5[_0xc008('0x29')](_0x48582b)[_0xc008('0x2a')]();};}function respondWithResult(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0xc8;return function(_0x5e2aca){if(_0x5e2aca){return _0x2e31c2['status'](_0x5bebd9)['json'](_0x5e2aca);}};}function respondWithFilteredResult(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(_0x29ba43){var _0x25eae4=_0x29ba43[_0xc008('0x2b')],_0x529961=_0x3865c0[_0xc008('0x2c')],_0x24c14c=_0x3865c0['offset']+_0x3865c0[_0xc008('0x2d')],_0x32390d;if(_0x24c14c>=_0x25eae4){_0x24c14c=_0x25eae4;_0x32390d=0xc8;}else{_0x32390d=0xce;}_0x4caaf4[_0xc008('0x29')](_0x32390d);return _0x4caaf4['set']('Content-Range',_0x529961+'-'+_0x24c14c+'/'+_0x25eae4)['json'](_0x29ba43);}return null;};}function patchUpdates(_0x1032b2){return function(_0x267abd){try{jsonpatch[_0xc008('0x2e')](_0x267abd,_0x1032b2,!![]);}catch(_0x10889f){return BPromise[_0xc008('0x2f')](_0x10889f);}return _0x267abd[_0xc008('0x30')]();};}function saveUpdates(_0x294f97,_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x31')](_0x294f97)[_0xc008('0x1e')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8,_0x334a09){return function(_0x4b7fd4){if(_0x4b7fd4){return _0x4b7fd4['destroy']()[_0xc008('0x1e')](function(){var _0x165a7b=_0x4b7fd4[_0xc008('0x32')]({'plain':!![]});var _0xca0520=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x35')]({'where':{'type':_0xca0520,'resourceId':_0x165a7b['id']}})[_0xc008('0x1e')](function(){return _0x4b7fd4;});})[_0xc008('0x1e')](function(){_0x596ee8['status'](0xcc)[_0xc008('0x2a')]();});}};}function handleEntityNotFound(_0x389a40,_0x459df4){return function(_0x344bad){if(!_0x344bad){_0x389a40[_0xc008('0x28')](0x194);}return _0x344bad;};}function handleError(_0x315562,_0x1667a0){_0x1667a0=_0x1667a0||0x1f4;return function(_0x5d0e06){logger[_0xc008('0x23')](_0x5d0e06[_0xc008('0x36')]);if(_0x5d0e06['name']){delete _0x5d0e06[_0xc008('0x37')];}_0x315562[_0xc008('0x29')](_0x1667a0)['send'](_0x5d0e06);};}exports[_0xc008('0x38')]=function(_0x2e4ae1,_0x280e9b){var _0x55ff48={},_0x53b353={},_0x478810={'count':0x0,'rows':[]};var _0x234f2a=_['map'](db[_0xc008('0x39')][_0xc008('0x3a')],function(_0x6a4ccb){return{'name':_0x6a4ccb[_0xc008('0x3b')],'type':_0x6a4ccb[_0xc008('0x3c')][_0xc008('0x3d')]};});_0x53b353[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x234f2a,_0xc008('0x37'));_0x53b353[_0xc008('0x40')]=_[_0xc008('0x41')](_0x2e4ae1[_0xc008('0x40')]);_0x53b353[_0xc008('0x42')]=_[_0xc008('0x43')](_0x53b353['model'],_0x53b353[_0xc008('0x40')]);_0x55ff48[_0xc008('0x44')]=_[_0xc008('0x43')](_0x53b353[_0xc008('0x3e')],qs['fields'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x45')]));_0x55ff48[_0xc008('0x44')]=_0x55ff48[_0xc008('0x44')][_0xc008('0x46')]?_0x55ff48['attributes']:_0x53b353[_0xc008('0x3e')];if(!_0x2e4ae1[_0xc008('0x40')][_0xc008('0x47')](_0xc008('0x48'))){_0x55ff48[_0xc008('0x2d')]=qs['limit'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x2d')]);_0x55ff48[_0xc008('0x2c')]=qs[_0xc008('0x2c')](_0x2e4ae1['query'][_0xc008('0x2c')]);}_0x55ff48[_0xc008('0x49')]=qs[_0xc008('0x4a')](_0x2e4ae1['query'][_0xc008('0x4a')]);_0x55ff48['where']=qs[_0xc008('0x42')](_['pick'](_0x2e4ae1[_0xc008('0x40')],_0x53b353[_0xc008('0x42')]),_0x234f2a);if(_0x2e4ae1['query'][_0xc008('0x4b')]){_0x55ff48[_0xc008('0x4c')]=_[_0xc008('0x4d')](_0x55ff48['where'],{'$or':_[_0xc008('0x3f')](_0x234f2a,function(_0x2a9b5c){if(_0x2a9b5c[_0xc008('0x3c')]!==_0xc008('0x4e')){var _0x347629={};_0x347629[_0x2a9b5c[_0xc008('0x37')]]={'$like':'%'+_0x2e4ae1['query']['filter']+'%'};return _0x347629;}})});}_0x55ff48=_['merge']({},_0x55ff48,_0x2e4ae1[_0xc008('0x4f')]);var _0x36417a={'where':_0x55ff48[_0xc008('0x4c')]};return db[_0xc008('0x39')][_0xc008('0x2b')](_0x36417a)[_0xc008('0x1e')](function(_0x2cf641){_0x478810[_0xc008('0x2b')]=_0x2cf641;if(_0x2e4ae1['query']['includeAll']){_0x55ff48['include']=[{'all':!![]}];}return db[_0xc008('0x39')][_0xc008('0x50')](_0x55ff48);})[_0xc008('0x1e')](function(_0x511383){_0x478810[_0xc008('0x51')]=_0x511383;return _0x478810;})[_0xc008('0x1e')](respondWithFilteredResult(_0x280e9b,_0x55ff48))[_0xc008('0x27')](handleError(_0x280e9b,null));};exports[_0xc008('0x52')]=function(_0x4981b4,_0x56e4ac){var _0x17ec90={'raw':![],'where':{'id':_0x4981b4[_0xc008('0x53')]['id']}},_0x405e87={};_0x405e87[_0xc008('0x3e')]=_['keys'](db['VoiceContext'][_0xc008('0x3a')]);_0x405e87['query']=_[_0xc008('0x41')](_0x4981b4[_0xc008('0x40')]);_0x405e87[_0xc008('0x42')]=_['intersection'](_0x405e87[_0xc008('0x3e')],_0x405e87[_0xc008('0x40')]);_0x17ec90[_0xc008('0x44')]=_[_0xc008('0x43')](_0x405e87[_0xc008('0x3e')],qs['fields'](_0x4981b4[_0xc008('0x40')][_0xc008('0x45')]));_0x17ec90['attributes']=_0x17ec90[_0xc008('0x44')][_0xc008('0x46')]?_0x17ec90['attributes']:_0x405e87['model'];if(_0x4981b4[_0xc008('0x40')][_0xc008('0x54')]){_0x17ec90[_0xc008('0x55')]=[{'all':!![]}];}_0x17ec90=_[_0xc008('0x4d')]({},_0x17ec90,_0x4981b4[_0xc008('0x4f')]);return db['VoiceContext']['find'](_0x17ec90)[_0xc008('0x1e')](handleEntityNotFound(_0x56e4ac,null))['then'](respondWithResult(_0x56e4ac,null))[_0xc008('0x27')](handleError(_0x56e4ac,null));};exports[_0xc008('0x56')]=function(_0xf94fcb,_0x2f1105,_0x44f42d){var _0x27a167;return db['VoiceContext'][_0xc008('0x56')](_0xf94fcb[_0xc008('0x57')],{'raw':!![]})[_0xc008('0x1e')](function(_0x2b350c){_0x27a167=_0x2b350c;return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x4fdab4){var _0x535e6e=fs['readFileSync'](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3aeeab=ejs[_0xc008('0x5b')](_0x535e6e,{'contexts':_0x4fdab4||[]});fs[_0xc008('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3aeeab);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x56'),{'module':_0xc008('0x5e')});})['then'](function(){var _0x4022dd=_0xf94fcb['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x4022dd)throw new Error(_0xc008('0x5f'));if(_0x4022dd[_0xc008('0x60')]===_0xc008('0x61')){var _0x192c87=_0x27a167[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x62')]({'where':{'name':'Contexts','userProfileId':_0x4022dd['userProfileId']},'raw':!![]})[_0xc008('0x1e')](function(_0x30aa1e){if(_0x30aa1e&&_0x30aa1e['autoAssociation']===0x0){return db[_0xc008('0x34')][_0xc008('0x56')]({'name':_0x192c87[_0xc008('0x37')],'resourceId':_0x192c87['id'],'type':_0x30aa1e[_0xc008('0x37')],'sectionId':_0x30aa1e['id']},{})[_0xc008('0x1e')](function(){return _0x27a167;});}else{return _0x27a167;}})[_0xc008('0x27')](function(_0x12973b){logger['error'](_0xc008('0x63'),_0x12973b);throw _0x12973b;});}return _0x27a167;})[_0xc008('0x1e')](respondWithResult(_0x2f1105,0xc9))[_0xc008('0x27')](handleError(_0x2f1105,null));};exports[_0xc008('0x31')]=function(_0xb3ca0f,_0x167425,_0x249898){var _0x280249;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0xb3ca0f[_0xc008('0x53')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x167425,null))[_0xc008('0x1e')](saveUpdates(_0xb3ca0f[_0xc008('0x57')],null))['then'](function(_0x36a08e){if(_0x36a08e){_0x280249=_0x36a08e;return db[_0xc008('0x39')][_0xc008('0x50')]({'raw':!![]});}})['then'](function(_0xd7d020){var _0x3214df=fs['readFileSync'](path['join'](config[_0xc008('0x59')],_0xc008('0x5a')),_0xc008('0x64'));var _0x39083c=ejs[_0xc008('0x5b')](_0x3214df,{'contexts':_0xd7d020||[]});fs[_0xc008('0x5c')](_0xc008('0x65'),_0x39083c);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x31'),{'module':_0xc008('0x5e')});})['then'](function(){return _0x280249;})[_0xc008('0x1e')](respondWithResult(_0x167425,null))[_0xc008('0x27')](handleError(_0x167425,null));};exports[_0xc008('0x35')]=function(_0x27dc80,_0x521e67,_0x17ffb1){var _0x5975de;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0x27dc80[_0xc008('0x53')]['id']}})['then'](handleEntityNotFound(_0x521e67,null))[_0xc008('0x1e')](removeEntity(_0x521e67,null))[_0xc008('0x1e')](function(){return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x539fc8){var _0x50ee03=fs[_0xc008('0x66')](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3c30db=ejs[_0xc008('0x5b')](_0x50ee03,{'contexts':_0x539fc8});fs['writeFileSync'](_0xc008('0x65'),_0x3c30db);return respondWithRpcPromise('Reload',_0xc008('0x35'),{'module':'chan_sip.so'});})[_0xc008('0x27')](handleError(_0x521e67,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c685e81..468c85d 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 _0xd080=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd080,0xc2));var _0x0d08=function(_0x212de4,_0x290b58){_0x212de4=_0x212de4-0x0;var _0x5ab67a=_0xd080[_0x212de4];return _0x5ab67a;};'use strict';var _=require('lodash');var util=require(_0x0d08('0x0'));var logger=require(_0x0d08('0x1'))(_0x0d08('0x2'));var moment=require('moment');var BPromise=require(_0x0d08('0x3'));var rp=require(_0x0d08('0x4'));var fs=require('fs');var path=require(_0x0d08('0x5'));var rimraf=require(_0x0d08('0x6'));var config=require(_0x0d08('0x7'));var attributes=require(_0x0d08('0x8'));module[_0x0d08('0x9')]=function(_0x455a4a,_0x22363c){return _0x455a4a[_0x0d08('0xa')](_0x0d08('0xb'),attributes,{'tableName':_0x0d08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa713=['request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa713,0x1c0));var _0x3a71=function(_0x54c8ed,_0x4ff37c){_0x54c8ed=_0x54c8ed-0x0;var _0x5bb93e=_0xa713[_0x54c8ed];return _0x5bb93e;};'use strict';var _=require('lodash');var util=require(_0x3a71('0x0'));var logger=require(_0x3a71('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3a71('0x2'));var rp=require(_0x3a71('0x3'));var fs=require('fs');var path=require(_0x3a71('0x4'));var rimraf=require(_0x3a71('0x5'));var config=require(_0x3a71('0x6'));var attributes=require(_0x3a71('0x7'));module[_0x3a71('0x8')]=function(_0x4cbe21,_0x2e3ad4){return _0x4cbe21[_0x3a71('0x9')](_0x3a71('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index ab82a30..005ba9e 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 _0x7ba4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch'];(function(_0x17e1f7,_0x2894ad){var _0x1ac7ea=function(_0x504c10){while(--_0x504c10){_0x17e1f7['push'](_0x17e1f7['shift']());}};_0x1ac7ea(++_0x2894ad);}(_0x7ba4,0x108));var _0x47ba=function(_0x10ebb2,_0x133fec){_0x10ebb2=_0x10ebb2-0x0;var _0x2b9aec=_0x7ba4[_0x10ebb2];return _0x2b9aec;};'use strict';var _=require(_0x47ba('0x0'));var util=require(_0x47ba('0x1'));var moment=require('moment');var BPromise=require(_0x47ba('0x2'));var rs=require(_0x47ba('0x3'));var fs=require('fs');var Redis=require(_0x47ba('0x4'));var db=require(_0x47ba('0x5'))['db'];var utils=require(_0x47ba('0x6'));var logger=require('../../config/logger')(_0x47ba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47ba('0x8')][_0x47ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a7861,_0xf5b492,_0x33326a){return new BPromise(function(_0x36cb50,_0xd25295){return client[_0x47ba('0xa')](_0x1a7861,_0x33326a)[_0x47ba('0xb')](function(_0x567d65){logger['info']('VoiceContext,\x20%s,\x20%s',_0xf5b492,_0x47ba('0xc'));logger['debug'](_0x47ba('0xd'),_0xf5b492,_0x47ba('0xc'),JSON[_0x47ba('0xe')](_0x567d65));if(_0x567d65['error']){if(_0x567d65[_0x47ba('0xf')][_0x47ba('0x10')]===0x1f4){logger[_0x47ba('0xf')](_0x47ba('0x11'),_0xf5b492,_0x567d65[_0x47ba('0xf')][_0x47ba('0x12')]);return _0xd25295(_0x567d65[_0x47ba('0xf')][_0x47ba('0x12')]);}logger[_0x47ba('0xf')](_0x47ba('0x11'),_0xf5b492,_0x567d65['error'][_0x47ba('0x12')]);return _0x36cb50(_0x567d65['error'][_0x47ba('0x12')]);}else{logger[_0x47ba('0x13')](_0x47ba('0x11'),_0xf5b492,'request\x20sent');_0x36cb50(_0x567d65[_0x47ba('0x14')][_0x47ba('0x12')]);}})[_0x47ba('0x15')](function(_0xdba9f0){logger[_0x47ba('0xf')](_0x47ba('0x11'),_0xf5b492,_0xdba9f0);_0xd25295(_0xdba9f0);});});} \ No newline at end of file +var _0xca51=['http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x5d82d9,_0x3d7694){var _0x3dfd86=function(_0x53735e){while(--_0x53735e){_0x5d82d9['push'](_0x5d82d9['shift']());}};_0x3dfd86(++_0x3d7694);}(_0xca51,0x187));var _0x1ca5=function(_0x51d103,_0x2d57d8){_0x51d103=_0x51d103-0x0;var _0x446c5d=_0xca51[_0x51d103];return _0x446c5d;};'use strict';var _=require(_0x1ca5('0x0'));var util=require('util');var moment=require(_0x1ca5('0x1'));var BPromise=require(_0x1ca5('0x2'));var rs=require(_0x1ca5('0x3'));var fs=require('fs');var Redis=require(_0x1ca5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ca5('0x5'));var logger=require(_0x1ca5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1ca5('0x7'));var client=jayson[_0x1ca5('0x8')][_0x1ca5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4372a5,_0x347271,_0x2995b9){return new BPromise(function(_0x4d5bf1,_0x5439fd){return client[_0x1ca5('0xa')](_0x4372a5,_0x2995b9)['then'](function(_0x3da38f){logger[_0x1ca5('0xb')](_0x1ca5('0xc'),_0x347271,_0x1ca5('0xd'));logger[_0x1ca5('0xe')](_0x1ca5('0xf'),_0x347271,_0x1ca5('0xd'),JSON['stringify'](_0x3da38f));if(_0x3da38f[_0x1ca5('0x10')]){if(_0x3da38f[_0x1ca5('0x10')]['code']===0x1f4){logger[_0x1ca5('0x10')](_0x1ca5('0xc'),_0x347271,_0x3da38f[_0x1ca5('0x10')][_0x1ca5('0x11')]);return _0x5439fd(_0x3da38f[_0x1ca5('0x10')][_0x1ca5('0x11')]);}logger[_0x1ca5('0x10')]('VoiceContext,\x20%s,\x20%s',_0x347271,_0x3da38f[_0x1ca5('0x10')][_0x1ca5('0x11')]);return _0x4d5bf1(_0x3da38f[_0x1ca5('0x10')][_0x1ca5('0x11')]);}else{logger[_0x1ca5('0xb')]('VoiceContext,\x20%s,\x20%s',_0x347271,_0x1ca5('0xd'));_0x4d5bf1(_0x3da38f[_0x1ca5('0x12')][_0x1ca5('0x11')]);}})[_0x1ca5('0x13')](function(_0x33acd7){logger[_0x1ca5('0x10')](_0x1ca5('0xc'),_0x347271,_0x33acd7);_0x5439fd(_0x33acd7);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 71ed5a7..13b5b72 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 _0x92f2=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update','delete'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x92f2,0xab));var _0x292f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x92f2[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x292f('0x0'));var util=require(_0x292f('0x1'));var path=require(_0x292f('0x2'));var timeout=require(_0x292f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x292f('0x4'));var interaction=require(_0x292f('0x5'));var config=require('../../config/environment');var controller=require(_0x292f('0x6'));router[_0x292f('0x7')]('/',auth[_0x292f('0x8')](),controller['index']);router[_0x292f('0x7')](_0x292f('0x9'),auth[_0x292f('0x8')](),controller['describe']);router['get'](_0x292f('0xa'),auth[_0x292f('0x8')](),controller['show']);router[_0x292f('0xb')]('/',auth[_0x292f('0x8')](),controller[_0x292f('0xc')]);router[_0x292f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x292f('0xe')]);router[_0x292f('0xf')]('/:id',auth[_0x292f('0x8')](),controller['destroy']);module[_0x292f('0x10')]=router; \ No newline at end of file +var _0xa89d=['/describe','isAuthenticated','describe','show','post','create','/:id','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x37e51b,_0x461f33){var _0x4f351f=function(_0x24f9cb){while(--_0x24f9cb){_0x37e51b['push'](_0x37e51b['shift']());}};_0x4f351f(++_0x461f33);}(_0xa89d,0x1a1));var _0xda89=function(_0xa12b9b,_0x3a8f46){_0xa12b9b=_0xa12b9b-0x0;var _0x1bd0ff=_0xa89d[_0xa12b9b];return _0x1bd0ff;};'use strict';var multer=require(_0xda89('0x0'));var util=require(_0xda89('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda89('0x2'));var router=express['Router']();var auth=require(_0xda89('0x3'));var interaction=require(_0xda89('0x4'));var config=require(_0xda89('0x5'));var controller=require('./voiceDialReport.controller');router[_0xda89('0x6')]('/',auth['isAuthenticated'](),controller[_0xda89('0x7')]);router[_0xda89('0x6')](_0xda89('0x8'),auth[_0xda89('0x9')](),controller[_0xda89('0xa')]);router[_0xda89('0x6')]('/:id',auth[_0xda89('0x9')](),controller[_0xda89('0xb')]);router[_0xda89('0xc')]('/',auth[_0xda89('0x9')](),controller[_0xda89('0xd')]);router['put'](_0xda89('0xe'),auth[_0xda89('0x9')](),controller['update']);router[_0xda89('0xf')](_0xda89('0xe'),auth[_0xda89('0x9')](),controller[_0xda89('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index dcf3fda..c69861a 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 _0xd421=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x1a4486,_0x2a0293){var _0x3ead01=function(_0x116088){while(--_0x116088){_0x1a4486['push'](_0x1a4486['shift']());}};_0x3ead01(++_0x2a0293);}(_0xd421,0x18d));var _0x1d42=function(_0x121a21,_0x110ac0){_0x121a21=_0x121a21-0x0;var _0x1afa91=_0xd421[_0x121a21];return _0x1afa91;};'use strict';var Sequelize=require(_0x1d42('0x0'));module[_0x1d42('0x1')]={'privilege':{'type':Sequelize[_0x1d42('0x2')]},'channel':{'type':Sequelize[_0x1d42('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1d42('0x2')]},'calleridnum':{'type':Sequelize[_0x1d42('0x2')]},'calleridname':{'type':Sequelize[_0x1d42('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1d42('0x2')]},'connectedlinename':{'type':Sequelize[_0x1d42('0x2')]},'language':{'type':Sequelize[_0x1d42('0x2')]},'accountcode':{'type':Sequelize[_0x1d42('0x2')]},'context':{'type':Sequelize[_0x1d42('0x2')]},'exten':{'type':Sequelize[_0x1d42('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1d42('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1d42('0x2')]},'destchannelstate':{'type':Sequelize[_0x1d42('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1d42('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1d42('0x2')]},'destcalleridname':{'type':Sequelize[_0x1d42('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1d42('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1d42('0x2')]},'destlanguage':{'type':Sequelize[_0x1d42('0x2')]},'destaccountcode':{'type':Sequelize[_0x1d42('0x2')]},'destcontext':{'type':Sequelize[_0x1d42('0x2')]},'destexten':{'type':Sequelize[_0x1d42('0x2')]},'destpriority':{'type':Sequelize[_0x1d42('0x3')]},'destuniqueid':{'type':Sequelize[_0x1d42('0x2')]},'destlinkedid':{'type':Sequelize[_0x1d42('0x2')]},'dialstring':{'type':Sequelize[_0x1d42('0x2')]},'dialstatus':{'type':Sequelize[_0x1d42('0x2')]},'starttime':{'type':Sequelize[_0x1d42('0x4')]},'answertime':{'type':Sequelize[_0x1d42('0x4')]},'endtime':{'type':Sequelize[_0x1d42('0x4')]},'lastevent':{'type':Sequelize[_0x1d42('0x2')],'comment':_0x1d42('0x5')},'routeId':{'type':Sequelize[_0x1d42('0x3')]},'duration':{'type':Sequelize[_0x1d42('0x3')]},'holdtime':{'type':Sequelize[_0x1d42('0x3')]},'billableseconds':{'type':Sequelize[_0x1d42('0x3')]}}; \ No newline at end of file +var _0x5868=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x5dd621,_0x5472d5){var _0x2d60a0=function(_0x225969){while(--_0x225969){_0x5dd621['push'](_0x5dd621['shift']());}};_0x2d60a0(++_0x5472d5);}(_0x5868,0x1cb));var _0x8586=function(_0x55ac31,_0x51ab87){_0x55ac31=_0x55ac31-0x0;var _0x4f6a49=_0x5868[_0x55ac31];return _0x4f6a49;};'use strict';var Sequelize=require(_0x8586('0x0'));module[_0x8586('0x1')]={'privilege':{'type':Sequelize[_0x8586('0x2')]},'channel':{'type':Sequelize[_0x8586('0x2')]},'channelstate':{'type':Sequelize[_0x8586('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8586('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8586('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8586('0x2')]},'context':{'type':Sequelize[_0x8586('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8586('0x2')]},'linkedid':{'type':Sequelize[_0x8586('0x2')]},'destchannel':{'type':Sequelize[_0x8586('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8586('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8586('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8586('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8586('0x2')]},'destaccountcode':{'type':Sequelize[_0x8586('0x2')]},'destcontext':{'type':Sequelize[_0x8586('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x8586('0x3')]},'destuniqueid':{'type':Sequelize[_0x8586('0x2')]},'destlinkedid':{'type':Sequelize[_0x8586('0x2')]},'dialstring':{'type':Sequelize[_0x8586('0x2')]},'dialstatus':{'type':Sequelize[_0x8586('0x2')]},'starttime':{'type':Sequelize[_0x8586('0x4')]},'answertime':{'type':Sequelize[_0x8586('0x4')]},'endtime':{'type':Sequelize[_0x8586('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x8586('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x8586('0x3')]},'holdtime':{'type':Sequelize[_0x8586('0x3')]},'billableseconds':{'type':Sequelize[_0x8586('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a0234a9..6603774 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 _0xdadf=['crypto','jsforce','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','model','query','attributes','intersection','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x1ce923,_0x34e664){var _0x5524b0=function(_0x3015d9){while(--_0x3015d9){_0x1ce923['push'](_0x1ce923['shift']());}};_0x5524b0(++_0x34e664);}(_0xdadf,0xc8));var _0xfdad=function(_0x5846ea,_0x264978){_0x5846ea=_0x5846ea-0x0;var _0x20cc0f=_0xdadf[_0x5846ea];return _0x20cc0f;};'use strict';var pdf=require(_0xfdad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdad('0x1'));var zipdir=require(_0xfdad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdad('0x3'));var moment=require(_0xfdad('0x4'));var BPromise=require(_0xfdad('0x5'));var Mustache=require(_0xfdad('0x6'));var util=require(_0xfdad('0x7'));var path=require(_0xfdad('0x8'));var sox=require(_0xfdad('0x9'));var csv=require('to-csv');var ejs=require(_0xfdad('0xa'));var fs=require('fs');var _=require(_0xfdad('0xb'));var squel=require(_0xfdad('0xc'));var crypto=require(_0xfdad('0xd'));var jsforce=require(_0xfdad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfdad('0xf'));var querystring=require(_0xfdad('0x10'));var Papa=require('papaparse');var Redis=require(_0xfdad('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdad('0x12'));var logger=require(_0xfdad('0x13'))(_0xfdad('0x14'));var utils=require(_0xfdad('0x15'));var config=require(_0xfdad('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10e9f6,_0x4b35ad){_0x4b35ad=_0x4b35ad||0xcc;return function(_0x5ec038){if(_0x5ec038){return _0x10e9f6[_0xfdad('0x17')](_0x4b35ad);}return _0x10e9f6['status'](_0x4b35ad)[_0xfdad('0x18')]();};}function respondWithResult(_0x53b581,_0x2da88b){_0x2da88b=_0x2da88b||0xc8;return function(_0x3b3b43){if(_0x3b3b43){return _0x53b581[_0xfdad('0x19')](_0x2da88b)['json'](_0x3b3b43);}};}function respondWithFilteredResult(_0x18101f,_0x5144fe){return function(_0x429883){if(_0x429883){var _0x5db711=_0x429883[_0xfdad('0x1a')],_0x24ceb1=_0x5144fe[_0xfdad('0x1b')],_0x3f19ce=_0x5144fe['offset']+_0x5144fe[_0xfdad('0x1c')],_0x3c9add;if(_0x3f19ce>=_0x5db711){_0x3f19ce=_0x5db711;_0x3c9add=0xc8;}else{_0x3c9add=0xce;}_0x18101f[_0xfdad('0x19')](_0x3c9add);return _0x18101f[_0xfdad('0x1d')](_0xfdad('0x1e'),_0x24ceb1+'-'+_0x3f19ce+'/'+_0x5db711)[_0xfdad('0x1f')](_0x429883);}return null;};}function patchUpdates(_0x47cd2d){return function(_0x4c5dba){try{jsonpatch[_0xfdad('0x20')](_0x4c5dba,_0x47cd2d,!![]);}catch(_0x3df158){return BPromise[_0xfdad('0x21')](_0x3df158);}return _0x4c5dba['save']();};}function saveUpdates(_0x336f58,_0x34d4d8){return function(_0x22204f){if(_0x22204f){return _0x22204f[_0xfdad('0x22')](_0x336f58)[_0xfdad('0x23')](function(_0x144745){return _0x144745;});}return null;};}function removeEntity(_0x31a8ed,_0x5d2f08){return function(_0x641fd){if(_0x641fd){return _0x641fd[_0xfdad('0x24')]()[_0xfdad('0x23')](function(){_0x31a8ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x571276,_0x150f90){return function(_0x436cf4){if(!_0x436cf4){_0x571276[_0xfdad('0x17')](0x194);}return _0x436cf4;};}function handleError(_0x47dcc3,_0x597f2a){_0x597f2a=_0x597f2a||0x1f4;return function(_0x591cea){logger['error'](_0x591cea[_0xfdad('0x25')]);if(_0x591cea['name']){delete _0x591cea[_0xfdad('0x26')];}_0x47dcc3[_0xfdad('0x19')](_0x597f2a)[_0xfdad('0x27')](_0x591cea);};}exports['index']=function(_0x3df7dd,_0x18e8a3){var _0x5b226e={},_0x4085ab={},_0x497b43={'count':0x0,'rows':[]};var _0x59eb32=_[_0xfdad('0x28')](db[_0xfdad('0x29')][_0xfdad('0x2a')],function(_0x34dd03){return{'name':_0x34dd03[_0xfdad('0x2b')],'type':_0x34dd03['type']['key']};});_0x4085ab[_0xfdad('0x2c')]=_[_0xfdad('0x28')](_0x59eb32,'name');_0x4085ab[_0xfdad('0x2d')]=_['keys'](_0x3df7dd['query']);_0x4085ab['filters']=_['intersection'](_0x4085ab[_0xfdad('0x2c')],_0x4085ab[_0xfdad('0x2d')]);_0x5b226e[_0xfdad('0x2e')]=_[_0xfdad('0x2f')](_0x4085ab['model'],qs[_0xfdad('0x30')](_0x3df7dd[_0xfdad('0x2d')][_0xfdad('0x30')]));_0x5b226e['attributes']=_0x5b226e[_0xfdad('0x2e')][_0xfdad('0x31')]?_0x5b226e[_0xfdad('0x2e')]:_0x4085ab['model'];if(!_0x3df7dd[_0xfdad('0x2d')]['hasOwnProperty']('nolimit')){_0x5b226e[_0xfdad('0x1c')]=qs['limit'](_0x3df7dd[_0xfdad('0x2d')][_0xfdad('0x1c')]);_0x5b226e[_0xfdad('0x1b')]=qs[_0xfdad('0x1b')](_0x3df7dd['query']['offset']);}_0x5b226e[_0xfdad('0x32')]=qs[_0xfdad('0x33')](_0x3df7dd[_0xfdad('0x2d')]['sort']);_0x5b226e[_0xfdad('0x34')]=qs['filters'](_[_0xfdad('0x35')](_0x3df7dd[_0xfdad('0x2d')],_0x4085ab['filters']),_0x59eb32);if(_0x3df7dd['query'][_0xfdad('0x36')]){_0x5b226e[_0xfdad('0x34')]=_['merge'](_0x5b226e[_0xfdad('0x34')],{'$or':_['map'](_0x59eb32,function(_0x4bd761){if(_0x4bd761[_0xfdad('0x37')]!==_0xfdad('0x38')){var _0x23d43a={};_0x23d43a[_0x4bd761[_0xfdad('0x26')]]={'$like':'%'+_0x3df7dd[_0xfdad('0x2d')][_0xfdad('0x36')]+'%'};return _0x23d43a;}})});}_0x5b226e=_[_0xfdad('0x39')]({},_0x5b226e,_0x3df7dd['options']);var _0x2dd5d8={'where':_0x5b226e['where']};return db['VoiceDialReport'][_0xfdad('0x1a')](_0x2dd5d8)[_0xfdad('0x23')](function(_0x20a311){_0x497b43[_0xfdad('0x1a')]=_0x20a311;if(_0x3df7dd[_0xfdad('0x2d')][_0xfdad('0x3a')]){_0x5b226e[_0xfdad('0x3b')]=[{'all':!![]}];}return db[_0xfdad('0x29')][_0xfdad('0x3c')](_0x5b226e);})[_0xfdad('0x23')](function(_0x94ec28){_0x497b43[_0xfdad('0x3d')]=_0x94ec28;return _0x497b43;})[_0xfdad('0x23')](respondWithFilteredResult(_0x18e8a3,_0x5b226e))['catch'](handleError(_0x18e8a3,null));};exports[_0xfdad('0x3e')]=function(_0x377724,_0x4f903a){var _0x59f0c2={'raw':!![],'where':{'id':_0x377724[_0xfdad('0x3f')]['id']}},_0x86d1b0={};_0x86d1b0[_0xfdad('0x2c')]=_[_0xfdad('0x40')](db[_0xfdad('0x29')][_0xfdad('0x2a')]);_0x86d1b0[_0xfdad('0x2d')]=_[_0xfdad('0x40')](_0x377724[_0xfdad('0x2d')]);_0x86d1b0['filters']=_[_0xfdad('0x2f')](_0x86d1b0[_0xfdad('0x2c')],_0x86d1b0[_0xfdad('0x2d')]);_0x59f0c2[_0xfdad('0x2e')]=_[_0xfdad('0x2f')](_0x86d1b0[_0xfdad('0x2c')],qs[_0xfdad('0x30')](_0x377724[_0xfdad('0x2d')][_0xfdad('0x30')]));_0x59f0c2[_0xfdad('0x2e')]=_0x59f0c2['attributes'][_0xfdad('0x31')]?_0x59f0c2[_0xfdad('0x2e')]:_0x86d1b0[_0xfdad('0x2c')];if(_0x377724['query']['includeAll']){_0x59f0c2['include']=[{'all':!![]}];}_0x59f0c2=_['merge']({},_0x59f0c2,_0x377724[_0xfdad('0x41')]);return db[_0xfdad('0x29')][_0xfdad('0x42')](_0x59f0c2)[_0xfdad('0x23')](handleEntityNotFound(_0x4f903a,null))[_0xfdad('0x23')](respondWithResult(_0x4f903a,null))[_0xfdad('0x43')](handleError(_0x4f903a,null));};exports[_0xfdad('0x44')]=function(_0x13d309,_0x7e1d26){return db[_0xfdad('0x29')][_0xfdad('0x44')](_0x13d309[_0xfdad('0x45')],{})[_0xfdad('0x23')](respondWithResult(_0x7e1d26,0xc9))[_0xfdad('0x43')](handleError(_0x7e1d26,null));};exports[_0xfdad('0x22')]=function(_0x2cf825,_0x577e0d){if(_0x2cf825[_0xfdad('0x45')]['id']){delete _0x2cf825[_0xfdad('0x45')]['id'];}return db['VoiceDialReport'][_0xfdad('0x42')]({'where':{'id':_0x2cf825[_0xfdad('0x3f')]['id']}})[_0xfdad('0x23')](handleEntityNotFound(_0x577e0d,null))['then'](saveUpdates(_0x2cf825[_0xfdad('0x45')],null))['then'](respondWithResult(_0x577e0d,null))[_0xfdad('0x43')](handleError(_0x577e0d,null));};exports['destroy']=function(_0x352021,_0x272ed3){return db[_0xfdad('0x29')][_0xfdad('0x42')]({'where':{'id':_0x352021['params']['id']}})[_0xfdad('0x23')](handleEntityNotFound(_0x272ed3,null))[_0xfdad('0x23')](removeEntity(_0x272ed3,null))[_0xfdad('0x43')](handleError(_0x272ed3,null));};exports[_0xfdad('0x46')]=function(_0x1af7be,_0x335957){return db[_0xfdad('0x29')][_0xfdad('0x46')]()['then'](respondWithResult(_0x335957,null))[_0xfdad('0x43')](handleError(_0x335957,null));}; \ No newline at end of file +var _0x220b=['merge','create','body','find','destroy','describe','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options','VoiceDialReport','includeAll','rows','show','params','keys','rawAttributes','include'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x220b,0x1b7));var _0xb220=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x220b[_0x368e09];return _0x14b7df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb220('0x0'));var rimraf=require(_0xb220('0x1'));var zipdir=require(_0xb220('0x2'));var jsonpatch=require(_0xb220('0x3'));var rp=require(_0xb220('0x4'));var moment=require(_0xb220('0x5'));var BPromise=require(_0xb220('0x6'));var Mustache=require(_0xb220('0x7'));var util=require(_0xb220('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb220('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb220('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xb'));var toCsv=require(_0xb220('0xc'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require('ioredis');var authService=require(_0xb220('0xf'));var qs=require(_0xb220('0x10'));var as=require(_0xb220('0x11'));var hardwareService=require(_0xb220('0x12'));var logger=require(_0xb220('0x13'))(_0xb220('0x14'));var utils=require('../../config/utils');var config=require(_0xb220('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bf077,_0x125cdd){_0x125cdd=_0x125cdd||0xcc;return function(_0x2ebd81){if(_0x2ebd81){return _0x1bf077[_0xb220('0x16')](_0x125cdd);}return _0x1bf077['status'](_0x125cdd)['end']();};}function respondWithResult(_0x184b3b,_0x3ce43b){_0x3ce43b=_0x3ce43b||0xc8;return function(_0x1d3998){if(_0x1d3998){return _0x184b3b[_0xb220('0x17')](_0x3ce43b)[_0xb220('0x18')](_0x1d3998);}};}function respondWithFilteredResult(_0x2effae,_0x1ce434){return function(_0x582cb2){if(_0x582cb2){var _0x16f51c=_0x582cb2[_0xb220('0x19')],_0x1f48c2=_0x1ce434[_0xb220('0x1a')],_0x1386d1=_0x1ce434[_0xb220('0x1a')]+_0x1ce434[_0xb220('0x1b')],_0x286e60;if(_0x1386d1>=_0x16f51c){_0x1386d1=_0x16f51c;_0x286e60=0xc8;}else{_0x286e60=0xce;}_0x2effae[_0xb220('0x17')](_0x286e60);return _0x2effae[_0xb220('0x1c')](_0xb220('0x1d'),_0x1f48c2+'-'+_0x1386d1+'/'+_0x16f51c)[_0xb220('0x18')](_0x582cb2);}return null;};}function patchUpdates(_0x40716e){return function(_0x2c048c){try{jsonpatch['apply'](_0x2c048c,_0x40716e,!![]);}catch(_0x2131f1){return BPromise[_0xb220('0x1e')](_0x2131f1);}return _0x2c048c[_0xb220('0x1f')]();};}function saveUpdates(_0x12d49f,_0x54772e){return function(_0x55813f){if(_0x55813f){return _0x55813f[_0xb220('0x20')](_0x12d49f)[_0xb220('0x21')](function(_0xc338ff){return _0xc338ff;});}return null;};}function removeEntity(_0x40446e,_0x79e178){return function(_0x52e88e){if(_0x52e88e){return _0x52e88e['destroy']()[_0xb220('0x21')](function(){_0x40446e[_0xb220('0x17')](0xcc)[_0xb220('0x22')]();});}};}function handleEntityNotFound(_0x260ff6,_0x2d3def){return function(_0xa01c26){if(!_0xa01c26){_0x260ff6[_0xb220('0x16')](0x194);}return _0xa01c26;};}function handleError(_0x3ebc74,_0x547948){_0x547948=_0x547948||0x1f4;return function(_0xe9cb7f){logger[_0xb220('0x23')](_0xe9cb7f[_0xb220('0x24')]);if(_0xe9cb7f[_0xb220('0x25')]){delete _0xe9cb7f[_0xb220('0x25')];}_0x3ebc74[_0xb220('0x17')](_0x547948)[_0xb220('0x26')](_0xe9cb7f);};}exports[_0xb220('0x27')]=function(_0x1bec4a,_0x461c79){var _0xbd998f={},_0x3a9650={},_0x4df143={'count':0x0,'rows':[]};var _0x1f2c91=_[_0xb220('0x28')](db['VoiceDialReport']['rawAttributes'],function(_0xb02654){return{'name':_0xb02654[_0xb220('0x29')],'type':_0xb02654[_0xb220('0x2a')]['key']};});_0x3a9650[_0xb220('0x2b')]=_[_0xb220('0x28')](_0x1f2c91,_0xb220('0x25'));_0x3a9650['query']=_['keys'](_0x1bec4a['query']);_0x3a9650[_0xb220('0x2c')]=_[_0xb220('0x2d')](_0x3a9650['model'],_0x3a9650[_0xb220('0x2e')]);_0xbd998f['attributes']=_[_0xb220('0x2d')](_0x3a9650[_0xb220('0x2b')],qs[_0xb220('0x2f')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x2f')]));_0xbd998f[_0xb220('0x30')]=_0xbd998f[_0xb220('0x30')][_0xb220('0x31')]?_0xbd998f[_0xb220('0x30')]:_0x3a9650[_0xb220('0x2b')];if(!_0x1bec4a[_0xb220('0x2e')][_0xb220('0x32')]('nolimit')){_0xbd998f[_0xb220('0x1b')]=qs[_0xb220('0x1b')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x1b')]);_0xbd998f[_0xb220('0x1a')]=qs[_0xb220('0x1a')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x1a')]);}_0xbd998f[_0xb220('0x33')]=qs[_0xb220('0x34')](_0x1bec4a[_0xb220('0x2e')][_0xb220('0x34')]);_0xbd998f[_0xb220('0x35')]=qs['filters'](_[_0xb220('0x36')](_0x1bec4a['query'],_0x3a9650[_0xb220('0x2c')]),_0x1f2c91);if(_0x1bec4a[_0xb220('0x2e')][_0xb220('0x37')]){_0xbd998f[_0xb220('0x35')]=_['merge'](_0xbd998f[_0xb220('0x35')],{'$or':_[_0xb220('0x28')](_0x1f2c91,function(_0x9459fd){if(_0x9459fd['type']!=='VIRTUAL'){var _0x546825={};_0x546825[_0x9459fd['name']]={'$like':'%'+_0x1bec4a['query'][_0xb220('0x37')]+'%'};return _0x546825;}})});}_0xbd998f=_['merge']({},_0xbd998f,_0x1bec4a[_0xb220('0x38')]);var _0x4254fb={'where':_0xbd998f[_0xb220('0x35')]};return db[_0xb220('0x39')][_0xb220('0x19')](_0x4254fb)[_0xb220('0x21')](function(_0x265cc5){_0x4df143[_0xb220('0x19')]=_0x265cc5;if(_0x1bec4a[_0xb220('0x2e')][_0xb220('0x3a')]){_0xbd998f['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0xbd998f);})[_0xb220('0x21')](function(_0x26a24c){_0x4df143[_0xb220('0x3b')]=_0x26a24c;return _0x4df143;})[_0xb220('0x21')](respondWithFilteredResult(_0x461c79,_0xbd998f))['catch'](handleError(_0x461c79,null));};exports[_0xb220('0x3c')]=function(_0x57eb0b,_0xb3e317){var _0x455237={'raw':!![],'where':{'id':_0x57eb0b[_0xb220('0x3d')]['id']}},_0x3c88b5={};_0x3c88b5[_0xb220('0x2b')]=_[_0xb220('0x3e')](db[_0xb220('0x39')][_0xb220('0x3f')]);_0x3c88b5[_0xb220('0x2e')]=_[_0xb220('0x3e')](_0x57eb0b[_0xb220('0x2e')]);_0x3c88b5[_0xb220('0x2c')]=_[_0xb220('0x2d')](_0x3c88b5[_0xb220('0x2b')],_0x3c88b5[_0xb220('0x2e')]);_0x455237['attributes']=_['intersection'](_0x3c88b5[_0xb220('0x2b')],qs[_0xb220('0x2f')](_0x57eb0b[_0xb220('0x2e')][_0xb220('0x2f')]));_0x455237[_0xb220('0x30')]=_0x455237[_0xb220('0x30')][_0xb220('0x31')]?_0x455237['attributes']:_0x3c88b5['model'];if(_0x57eb0b['query'][_0xb220('0x3a')]){_0x455237[_0xb220('0x40')]=[{'all':!![]}];}_0x455237=_[_0xb220('0x41')]({},_0x455237,_0x57eb0b['options']);return db[_0xb220('0x39')]['find'](_0x455237)['then'](handleEntityNotFound(_0xb3e317,null))['then'](respondWithResult(_0xb3e317,null))['catch'](handleError(_0xb3e317,null));};exports[_0xb220('0x42')]=function(_0xa89aa5,_0x3fa22e){return db['VoiceDialReport'][_0xb220('0x42')](_0xa89aa5['body'],{})['then'](respondWithResult(_0x3fa22e,0xc9))['catch'](handleError(_0x3fa22e,null));};exports[_0xb220('0x20')]=function(_0x48e737,_0x511887){if(_0x48e737[_0xb220('0x43')]['id']){delete _0x48e737[_0xb220('0x43')]['id'];}return db[_0xb220('0x39')][_0xb220('0x44')]({'where':{'id':_0x48e737['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0x511887,null))[_0xb220('0x21')](saveUpdates(_0x48e737[_0xb220('0x43')],null))[_0xb220('0x21')](respondWithResult(_0x511887,null))['catch'](handleError(_0x511887,null));};exports[_0xb220('0x45')]=function(_0x324138,_0x27b327){return db[_0xb220('0x39')]['find']({'where':{'id':_0x324138[_0xb220('0x3d')]['id']}})['then'](handleEntityNotFound(_0x27b327,null))[_0xb220('0x21')](removeEntity(_0x27b327,null))['catch'](handleError(_0x27b327,null));};exports[_0xb220('0x46')]=function(_0x34867d,_0x13ce0e){return db['VoiceDialReport'][_0xb220('0x46')]()['then'](respondWithResult(_0x13ce0e,null))[_0xb220('0x47')](handleError(_0x13ce0e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 8b927b9..085665c 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 _0xe5f7=['moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3f0f4e,_0x2706fe){var _0x2c8eb4=function(_0x293c06){while(--_0x293c06){_0x3f0f4e['push'](_0x3f0f4e['shift']());}};_0x2c8eb4(++_0x2706fe);}(_0xe5f7,0xb2));var _0x7e5f=function(_0xe03aff,_0x577ac5){_0xe03aff=_0xe03aff-0x0;var _0x450c50=_0xe5f7[_0xe03aff];return _0x450c50;};'use strict';var _=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var logger=require(_0x7e5f('0x2'))(_0x7e5f('0x3'));var moment=require(_0x7e5f('0x4'));var BPromise=require(_0x7e5f('0x5'));var rp=require(_0x7e5f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e5f('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e5f('0x8'));module[_0x7e5f('0x9')]=function(_0x477caa,_0x65d95e){return _0x477caa[_0x7e5f('0xa')](_0x7e5f('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x7e5f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb08a=['exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes'];(function(_0x4d0f0e,_0x21b7e0){var _0x654fad=function(_0x2b15e7){while(--_0x2b15e7){_0x4d0f0e['push'](_0x4d0f0e['shift']());}};_0x654fad(++_0x21b7e0);}(_0xb08a,0xd6));var _0xab08=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xb08a[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0xab08('0x0'));var util=require(_0xab08('0x1'));var logger=require(_0xab08('0x2'))(_0xab08('0x3'));var moment=require(_0xab08('0x4'));var BPromise=require(_0xab08('0x5'));var rp=require(_0xab08('0x6'));var fs=require('fs');var path=require(_0xab08('0x7'));var rimraf=require('rimraf');var config=require(_0xab08('0x8'));var attributes=require(_0xab08('0x9'));module[_0xab08('0xa')]=function(_0x206d35,_0x3fe10d){return _0x206d35['define'](_0xab08('0xb'),attributes,{'tableName':_0xab08('0xc'),'paranoid':![],'indexes':[{'fields':[_0xab08('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ded7538..c130f8b 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 _0x4a3d=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceDialReport','create','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x2d0775,_0x5c8ae1){var _0x39a579=function(_0x45bd0f){while(--_0x45bd0f){_0x2d0775['push'](_0x2d0775['shift']());}};_0x39a579(++_0x5c8ae1);}(_0x4a3d,0x79));var _0xd4a3=function(_0x3de97c,_0x85d690){_0x3de97c=_0x3de97c-0x0;var _0x2ab456=_0x4a3d[_0x3de97c];return _0x2ab456;};'use strict';var _=require(_0xd4a3('0x0'));var util=require(_0xd4a3('0x1'));var moment=require(_0xd4a3('0x2'));var BPromise=require(_0xd4a3('0x3'));var rs=require(_0xd4a3('0x4'));var fs=require('fs');var Redis=require(_0xd4a3('0x5'));var db=require(_0xd4a3('0x6'))['db'];var utils=require(_0xd4a3('0x7'));var logger=require(_0xd4a3('0x8'))(_0xd4a3('0x9'));var config=require(_0xd4a3('0xa'));var jayson=require(_0xd4a3('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2449da,_0x45baf1,_0x5910aa){return new BPromise(function(_0x490bc1,_0x33c34b){return client[_0xd4a3('0xc')](_0x2449da,_0x5910aa)[_0xd4a3('0xd')](function(_0x128d6c){logger[_0xd4a3('0xe')](_0xd4a3('0xf'),_0x45baf1,_0xd4a3('0x10'));logger[_0xd4a3('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x45baf1,_0xd4a3('0x10'),JSON[_0xd4a3('0x12')](_0x128d6c));if(_0x128d6c[_0xd4a3('0x13')]){if(_0x128d6c[_0xd4a3('0x13')][_0xd4a3('0x14')]===0x1f4){logger[_0xd4a3('0x13')](_0xd4a3('0xf'),_0x45baf1,_0x128d6c['error'][_0xd4a3('0x15')]);return _0x33c34b(_0x128d6c[_0xd4a3('0x13')][_0xd4a3('0x15')]);}logger[_0xd4a3('0x13')](_0xd4a3('0xf'),_0x45baf1,_0x128d6c[_0xd4a3('0x13')][_0xd4a3('0x15')]);return _0x490bc1(_0x128d6c[_0xd4a3('0x13')]['message']);}else{logger['info'](_0xd4a3('0xf'),_0x45baf1,_0xd4a3('0x10'));_0x490bc1(_0x128d6c[_0xd4a3('0x16')][_0xd4a3('0x15')]);}})[_0xd4a3('0x17')](function(_0x454361){logger['error'](_0xd4a3('0xf'),_0x45baf1,_0x454361);_0x33c34b(_0x454361);});});}exports['CreateVoiceDialReport']=function(_0xf9fc3c){var _0x592077=this;return new Promise(function(_0x21fa36,_0x4b8850){return db[_0xd4a3('0x18')][_0xd4a3('0x19')](_0xf9fc3c['body'],{'raw':_0xf9fc3c[_0xd4a3('0x1a')]?_0xf9fc3c[_0xd4a3('0x1a')][_0xd4a3('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4a1cf0){logger[_0xd4a3('0xe')]('CreateVoiceDialReport',_0xf9fc3c);logger[_0xd4a3('0x11')](_0xd4a3('0x1c'),_0xf9fc3c,JSON['stringify'](_0x4a1cf0));_0x21fa36(_0x4a1cf0);})['catch'](function(_0x4f957f){logger[_0xd4a3('0x13')](_0xd4a3('0x1c'),_0x4f957f[_0xd4a3('0x15')],_0xf9fc3c);_0x4b8850(_0x592077['error'](0x1f4,_0x4f957f[_0xd4a3('0x15')]));});});};exports[_0xd4a3('0x1d')]=function(_0x1a4ced){var _0x2e632f=this;return new Promise(function(_0xac252b,_0x345bac){return db['VoiceDialReport'][_0xd4a3('0x1e')](_0x1a4ced[_0xd4a3('0x1f')],{'raw':_0x1a4ced['options']?_0x1a4ced[_0xd4a3('0x1a')][_0xd4a3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a4ced[_0xd4a3('0x1a')]?_0x1a4ced['options'][_0xd4a3('0x20')]||null:null,'attributes':_0x1a4ced[_0xd4a3('0x1a')]?_0x1a4ced[_0xd4a3('0x1a')]['attributes']||null:null,'limit':_0x1a4ced[_0xd4a3('0x1a')]?_0x1a4ced['options'][_0xd4a3('0x21')]||null:null})['then'](function(_0x3019a4){logger['info'](_0xd4a3('0x1d'),_0x1a4ced);logger['debug'](_0xd4a3('0x1d'),_0x1a4ced,JSON['stringify'](_0x3019a4));_0xac252b(_0x3019a4);})[_0xd4a3('0x17')](function(_0x31baf2){logger[_0xd4a3('0x13')](_0xd4a3('0x1d'),_0x31baf2[_0xd4a3('0x15')],_0x1a4ced);_0x345bac(_0x2e632f['error'](0x1f4,_0x31baf2['message']));});});}; \ No newline at end of file +var _0xc252=['stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug','update','raw','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x3024e0,_0x2c202f){var _0x4f8c16=function(_0x1c58ce){while(--_0x1c58ce){_0x3024e0['push'](_0x3024e0['shift']());}};_0x4f8c16(++_0x2c202f);}(_0xc252,0x118));var _0x2c25=function(_0x1f4da3,_0x3e557b){_0x1f4da3=_0x1f4da3-0x0;var _0x3d8ad3=_0xc252[_0x1f4da3];return _0x3d8ad3;};'use strict';var _=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var moment=require(_0x2c25('0x2'));var BPromise=require(_0x2c25('0x3'));var rs=require(_0x2c25('0x4'));var fs=require('fs');var Redis=require(_0x2c25('0x5'));var db=require(_0x2c25('0x6'))['db'];var utils=require(_0x2c25('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2c25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c25('0x9')][_0x2c25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39972f,_0x1ec60a,_0x5f1278){return new BPromise(function(_0x491314,_0x16f20){return client[_0x2c25('0xb')](_0x39972f,_0x5f1278)[_0x2c25('0xc')](function(_0x1f927e){logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,_0x2c25('0xf'));logger['debug'](_0x2c25('0x10'),_0x1ec60a,'request\x20sent',JSON[_0x2c25('0x11')](_0x1f927e));if(_0x1f927e['error']){if(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x13')]===0x1f4){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')]['message']);return _0x16f20(_0x1f927e['error'][_0x2c25('0x14')]);}logger[_0x2c25('0x12')](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);return _0x491314(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);}else{logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,'request\x20sent');_0x491314(_0x1f927e['result'][_0x2c25('0x14')]);}})[_0x2c25('0x15')](function(_0x8b04ce){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x8b04ce);_0x16f20(_0x8b04ce);});});}exports[_0x2c25('0x16')]=function(_0x28093a){var _0x19ff99=this;return new Promise(function(_0x4bfc1e,_0xe0af6){return db[_0x2c25('0x17')][_0x2c25('0x18')](_0x28093a[_0x2c25('0x19')],{'raw':_0x28093a['options']?_0x28093a[_0x2c25('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x863b0e){logger['info'](_0x2c25('0x16'),_0x28093a);logger[_0x2c25('0x1b')](_0x2c25('0x16'),_0x28093a,JSON[_0x2c25('0x11')](_0x863b0e));_0x4bfc1e(_0x863b0e);})[_0x2c25('0x15')](function(_0x372887){logger[_0x2c25('0x12')](_0x2c25('0x16'),_0x372887[_0x2c25('0x14')],_0x28093a);_0xe0af6(_0x19ff99[_0x2c25('0x12')](0x1f4,_0x372887[_0x2c25('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x58244a){var _0x33c3e8=this;return new Promise(function(_0x4926c3,_0x351bdd){return db[_0x2c25('0x17')][_0x2c25('0x1c')](_0x58244a[_0x2c25('0x19')],{'raw':_0x58244a[_0x2c25('0x1a')]?_0x58244a['options'][_0x2c25('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58244a[_0x2c25('0x1a')]?_0x58244a[_0x2c25('0x1a')]['where']||null:null,'attributes':_0x58244a[_0x2c25('0x1a')]?_0x58244a['options'][_0x2c25('0x1e')]||null:null,'limit':_0x58244a[_0x2c25('0x1a')]?_0x58244a['options'][_0x2c25('0x1f')]||null:null})[_0x2c25('0xc')](function(_0x51d744){logger[_0x2c25('0xd')]('UpdateVoiceDialReport',_0x58244a);logger['debug'](_0x2c25('0x20'),_0x58244a,JSON[_0x2c25('0x11')](_0x51d744));_0x4926c3(_0x51d744);})[_0x2c25('0x15')](function(_0x417a05){logger[_0x2c25('0x12')](_0x2c25('0x20'),_0x417a05[_0x2c25('0x14')],_0x58244a);_0x351bdd(_0x33c3e8['error'](0x1f4,_0x417a05[_0x2c25('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 68a7eaa..dede9fe 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 _0x0023=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x50b02a,_0x522157){var _0x1e1bec=function(_0x347d5e){while(--_0x347d5e){_0x50b02a['push'](_0x50b02a['shift']());}};_0x1e1bec(++_0x522157);}(_0x0023,0x102));var _0x3002=function(_0x409774,_0x5d7719){_0x409774=_0x409774-0x0;var _0x297c3b=_0x0023[_0x409774];return _0x297c3b;};'use strict';var multer=require(_0x3002('0x0'));var util=require(_0x3002('0x1'));var path=require(_0x3002('0x2'));var timeout=require(_0x3002('0x3'));var express=require(_0x3002('0x4'));var router=express[_0x3002('0x5')]();var auth=require(_0x3002('0x6'));var interaction=require(_0x3002('0x7'));var config=require(_0x3002('0x8'));var controller=require(_0x3002('0x9'));router[_0x3002('0xa')]('/',auth[_0x3002('0xb')](),controller['index']);router[_0x3002('0xa')]('/:id',auth[_0x3002('0xb')](),controller[_0x3002('0xc')]);router[_0x3002('0xd')]('/',auth['isAuthenticated'](),controller[_0x3002('0xe')]);router[_0x3002('0xd')](_0x3002('0xf'),auth[_0x3002('0xb')](),controller[_0x3002('0x10')]);router[_0x3002('0x11')](_0x3002('0x12'),auth[_0x3002('0xb')](),controller[_0x3002('0x13')]);router[_0x3002('0x14')](_0x3002('0x12'),auth['isAuthenticated'](),controller[_0x3002('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4f00=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','create','/:id/applications','addApplications','put','update','delete','/:id','destroy','exports'];(function(_0x5878be,_0x22fe41){var _0x50d6f0=function(_0x509015){while(--_0x509015){_0x5878be['push'](_0x5878be['shift']());}};_0x50d6f0(++_0x22fe41);}(_0x4f00,0x1b9));var _0x04f0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4f00[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x04f0('0x0'));var util=require(_0x04f0('0x1'));var path=require(_0x04f0('0x2'));var timeout=require(_0x04f0('0x3'));var express=require(_0x04f0('0x4'));var router=express['Router']();var auth=require(_0x04f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x04f0('0x6'));var controller=require(_0x04f0('0x7'));router[_0x04f0('0x8')]('/',auth[_0x04f0('0x9')](),controller[_0x04f0('0xa')]);router['get']('/:id',auth[_0x04f0('0x9')](),controller[_0x04f0('0xb')]);router['post']('/',auth[_0x04f0('0x9')](),controller[_0x04f0('0xc')]);router['post'](_0x04f0('0xd'),auth[_0x04f0('0x9')](),controller[_0x04f0('0xe')]);router[_0x04f0('0xf')]('/:id',auth[_0x04f0('0x9')](),controller[_0x04f0('0x10')]);router[_0x04f0('0x11')](_0x04f0('0x12'),auth[_0x04f0('0x9')](),controller[_0x04f0('0x13')]);module[_0x04f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index de19a57..7caef99 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1d29ec,_0x3e7fed){var _0x2a2bf7=function(_0x304391){while(--_0x304391){_0x1d29ec['push'](_0x1d29ec['shift']());}};_0x2a2bf7(++_0x3e7fed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x189988,_0x75e959){var _0x227a32=function(_0x38556b){while(--_0x38556b){_0x189988['push'](_0x189988['shift']());}};_0x227a32(++_0x75e959);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 62a7612..2183314 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 _0x7a54=['then','get','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','error','name','index','VoiceExtension','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','catch','show','params','keys','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x7a54,0x106));var _0x47a5=function(_0x380093,_0x1c0183){_0x380093=_0x380093-0x0;var _0x16034b=_0x7a54[_0x380093];return _0x16034b;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){var _0x129ce5=_0x28747d[_0x47a5('0x27')]({'plain':!![]});var _0x50bf17=[{'name':'InboundRoutes','value':_0x47a5('0x28'),'ignore':![]},{'name':'OutboundRoutes','value':_0x47a5('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x47a5('0x2a'),'ignore':![]}];var _0x378208=_(_0x50bf17)[_0x47a5('0x2b')](_0x47a5('0x2c'))[_0x47a5('0x2d')](_0x47a5('0x2e'))[_0x47a5('0x2e')]();if(_[_0x47a5('0x2f')](_0x378208,_0x129ce5[_0x47a5('0x30')])){return;}var _0x361bfa=_[_0x47a5('0x31')](_0x50bf17,[_0x47a5('0x2e'),_0x129ce5[_0x47a5('0x30')]])['name'];return db[_0x47a5('0x32')]['destroy']({'where':{'type':_0x361bfa,'resourceId':_0x129ce5['id']}})[_0x47a5('0x26')](function(){return _0x28747d;});})[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256650,_0x625952){return function(_0x39b50b){if(!_0x39b50b){_0x256650[_0x47a5('0x1a')](0x194);}return _0x39b50b;};}function handleError(_0x51cc81,_0x50d875){_0x50d875=_0x50d875||0x1f4;return function(_0x6f9a12){logger[_0x47a5('0x33')](_0x6f9a12['stack']);if(_0x6f9a12['name']){delete _0x6f9a12[_0x47a5('0x34')];}_0x51cc81[_0x47a5('0x1c')](_0x50d875)['send'](_0x6f9a12);};}exports[_0x47a5('0x35')]=function(_0x53119b,_0x122ed6){var _0xd972c={},_0x5c5162={},_0x4843c0={'count':0x0,'rows':[]};var _0x274e34=_['map'](db[_0x47a5('0x36')][_0x47a5('0x37')],function(_0xf269a8){return{'name':_0xf269a8['fieldName'],'type':_0xf269a8[_0x47a5('0x30')]['key']};});_0x5c5162['model']=_[_0x47a5('0x2d')](_0x274e34,'name');_0x5c5162[_0x47a5('0x38')]=_['keys'](_0x53119b[_0x47a5('0x38')]);_0x5c5162[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],_0x5c5162[_0x47a5('0x38')]);_0xd972c[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],qs[_0x47a5('0x3d')](_0x53119b['query'][_0x47a5('0x3d')]));_0xd972c[_0x47a5('0x3c')]=_0xd972c['attributes'][_0x47a5('0x3e')]?_0xd972c[_0x47a5('0x3c')]:_0x5c5162[_0x47a5('0x3b')];if(!_0x53119b['query'][_0x47a5('0x3f')](_0x47a5('0x40'))){_0xd972c['limit']=qs[_0x47a5('0x1f')](_0x53119b[_0x47a5('0x38')]['limit']);_0xd972c['offset']=qs['offset'](_0x53119b[_0x47a5('0x38')]['offset']);}_0xd972c[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x53119b[_0x47a5('0x38')][_0x47a5('0x42')]);_0xd972c[_0x47a5('0x43')]=qs[_0x47a5('0x39')](_[_0x47a5('0x44')](_0x53119b[_0x47a5('0x38')],_0x5c5162[_0x47a5('0x39')]),_0x274e34);if(_0x53119b[_0x47a5('0x38')][_0x47a5('0x2b')]){_0xd972c[_0x47a5('0x43')]=_[_0x47a5('0x45')](_0xd972c['where'],{'$or':_[_0x47a5('0x2d')](_0x274e34,function(_0x1c36fa){if(_0x1c36fa[_0x47a5('0x30')]!==_0x47a5('0x46')){var _0x586f4f={};_0x586f4f[_0x1c36fa[_0x47a5('0x34')]]={'$like':'%'+_0x53119b['query']['filter']+'%'};return _0x586f4f;}})});}_0xd972c=_['merge']({},_0xd972c,_0x53119b['options']);var _0x27dd5d={'where':_0xd972c['where']};return db[_0x47a5('0x36')][_0x47a5('0x1d')](_0x27dd5d)[_0x47a5('0x26')](function(_0x494526){_0x4843c0[_0x47a5('0x1d')]=_0x494526;if(_0x53119b[_0x47a5('0x38')]['includeAll']){_0xd972c['include']=[{'all':!![]}];}return db[_0x47a5('0x36')]['findAll'](_0xd972c);})[_0x47a5('0x26')](function(_0x4703b2){_0x4843c0[_0x47a5('0x47')]=_0x4703b2;return _0x4843c0;})[_0x47a5('0x26')](respondWithFilteredResult(_0x122ed6,_0xd972c))[_0x47a5('0x48')](handleError(_0x122ed6,null));};exports[_0x47a5('0x49')]=function(_0x434227,_0x17cc42){var _0xac9c15={'raw':![],'where':{'id':_0x434227[_0x47a5('0x4a')]['id']}},_0x162fa0={};_0x162fa0[_0x47a5('0x3b')]=_[_0x47a5('0x4b')](db[_0x47a5('0x36')][_0x47a5('0x37')]);_0x162fa0[_0x47a5('0x38')]=_['keys'](_0x434227[_0x47a5('0x38')]);_0x162fa0[_0x47a5('0x39')]=_['intersection'](_0x162fa0['model'],_0x162fa0[_0x47a5('0x38')]);_0xac9c15['attributes']=_[_0x47a5('0x3a')](_0x162fa0[_0x47a5('0x3b')],qs['fields'](_0x434227['query'][_0x47a5('0x3d')]));_0xac9c15['attributes']=_0xac9c15[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0xac9c15[_0x47a5('0x3c')]:_0x162fa0[_0x47a5('0x3b')];if(_0x434227[_0x47a5('0x38')][_0x47a5('0x4c')]){_0xac9c15[_0x47a5('0x4d')]=[{'all':!![]}];}_0xac9c15=_['merge']({},_0xac9c15,_0x434227['options']);return db[_0x47a5('0x36')][_0x47a5('0x31')](_0xac9c15)[_0x47a5('0x26')](handleEntityNotFound(_0x17cc42,null))[_0x47a5('0x26')](respondWithResult(_0x17cc42,null))[_0x47a5('0x48')](handleError(_0x17cc42,null));};exports[_0x47a5('0x25')]=function(_0x249de5,_0x492cf7){return db[_0x47a5('0x36')][_0x47a5('0x31')]({'where':{'id':_0x249de5[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x492cf7,null))[_0x47a5('0x26')](removeEntity(_0x492cf7,null))['catch'](handleError(_0x492cf7,null));};exports[_0x47a5('0x4e')]=function(_0xe31817,_0x46e90b){if(_0xe31817[_0x47a5('0x4f')]['type']===_0x47a5('0x29')&&!_[_0x47a5('0x50')](_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')],'_')){_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')]='_'[_0x47a5('0x52')](_0xe31817['body'][_0x47a5('0x51')]);}return db[_0x47a5('0x36')][_0x47a5('0x4e')](_0xe31817[_0x47a5('0x4f')],{'raw':![]})[_0x47a5('0x26')](function(_0x1ab0bf){var _0x572233=_0xe31817[_0x47a5('0x53')][_0x47a5('0x27')]({'plain':!![]});if(!_0x572233)throw new Error(_0x47a5('0x54'));if(_0x572233['role']===_0x47a5('0x53')){var _0x3c78b7=_0x1ab0bf[_0x47a5('0x27')]({'plain':!![]});var _0x5d8d4a=[{'name':'InboundRoutes','value':_0x47a5('0x28')},{'name':_0x47a5('0x55'),'value':'outbound'},{'name':'InternalRoutes','value':_0x47a5('0x2a')}];var _0x4d6a82=_[_0x47a5('0x31')](_0x5d8d4a,['value',_0x3c78b7['type']])[_0x47a5('0x34')];return db[_0x47a5('0x56')]['find']({'where':{'name':_0x4d6a82,'userProfileId':_0x572233[_0x47a5('0x57')]},'raw':!![]})[_0x47a5('0x26')](function(_0x4b706a){if(_0x4b706a&&_0x4b706a['autoAssociation']===0x0){return db[_0x47a5('0x32')][_0x47a5('0x4e')]({'name':_0x3c78b7[_0x47a5('0x34')],'resourceId':_0x3c78b7['id'],'type':_0x4b706a[_0x47a5('0x34')],'sectionId':_0x4b706a['id']},{})['then'](function(){return _0x1ab0bf;});}else{return _0x1ab0bf;}})[_0x47a5('0x48')](function(_0x2b4255){logger[_0x47a5('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4255);throw _0x2b4255;});}return _0x1ab0bf;})[_0x47a5('0x26')](respondWithResult(_0x46e90b,0xc9))['catch'](handleError(_0x46e90b,null));};exports[_0x47a5('0x24')]=function(_0x470da6,_0x943a15){if(_0x470da6[_0x47a5('0x4f')]['id']){delete _0x470da6[_0x47a5('0x4f')]['id'];}return db['VoiceExtension'][_0x47a5('0x31')]({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))['then'](function(_0x4f8564){if(_0x4f8564){return db[_0x47a5('0x36')][_0x47a5('0x24')](_[_0x47a5('0x44')](_0x470da6['body'],['exten',_0x47a5('0x58'),_0x47a5('0x59'),_0x47a5('0x5a'),_0x47a5('0x5b'),_0x47a5('0x5c')]),{'where':{'context':_0x4f8564['context'],'exten':_0x4f8564[_0x47a5('0x51')]},'individualHooks':!![]})['then'](function(_0x22c886){return _0x22c886;});}return null;})[_0x47a5('0x26')](respondWithStatusCode(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports[_0x47a5('0x5d')]=function(_0x345104,_0x132854,_0x3e8274){return db[_0x47a5('0x36')][_0x47a5('0x5e')]({'where':{'id':_0x345104[_0x47a5('0x4a')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x132854,null))['then'](function(_0x2dcc3b){if(_0x2dcc3b){return db[_0x47a5('0x5f')][_0x47a5('0x60')](function(_0x26e7fc){return db[_0x47a5('0x36')]['destroy']({'where':{'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'transaction':_0x26e7fc})[_0x47a5('0x26')](function(_0x1224bc){var _0x144aaa=_[_0x47a5('0x2d')](_0x345104[_0x47a5('0x4f')],function(_0x453191){_0x453191[_0x47a5('0x61')]=_0x345104[_0x47a5('0x4a')]['id'];return _0x453191;});return db[_0x47a5('0x36')][_0x47a5('0x62')](_0x144aaa,{'transaction':_0x26e7fc});});})[_0x47a5('0x26')](function(){return db[_0x47a5('0x36')][_0x47a5('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x47a5('0x26')](respondWithResult(_0x132854,null))[_0x47a5('0x48')](handleError(_0x132854,null));}; \ No newline at end of file +var _0x2542=['includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','create','body','startsWith','exten','role','user','OutboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','cutdigits','mandatoryDisposition','sequelize','transaction','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','destroy','then','get','InboundRoutes','outbound','internal','filter','ignore','map','value'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2542,0x169));var _0x2254=function(_0x3fb5fa,_0x11037d){_0x3fb5fa=_0x3fb5fa-0x0;var _0x4622ec=_0x2542[_0x3fb5fa];return _0x4622ec;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x10'));var querystring=require(_0x2254('0x11'));var Papa=require(_0x2254('0x12'));var Redis=require(_0x2254('0x13'));var authService=require(_0x2254('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x15'));var hardwareService=require(_0x2254('0x16'));var logger=require(_0x2254('0x17'))(_0x2254('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2254('0x19'))['db'];config[_0x2254('0x1a')]=_[_0x2254('0x1b')](config[_0x2254('0x1a')],{'host':_0x2254('0x1c'),'port':0x18eb});var socket=require(_0x2254('0x1d'))(new Redis(config['redis']));require(_0x2254('0x1e'))[_0x2254('0x1f')](socket);function respondWithStatusCode(_0x504749,_0x2f4de){_0x2f4de=_0x2f4de||0xcc;return function(_0x1e582d){if(_0x1e582d){return _0x504749[_0x2254('0x20')](_0x2f4de);}return _0x504749[_0x2254('0x21')](_0x2f4de)[_0x2254('0x22')]();};}function respondWithResult(_0xbc5548,_0x50f137){_0x50f137=_0x50f137||0xc8;return function(_0x18baf4){if(_0x18baf4){return _0xbc5548['status'](_0x50f137)[_0x2254('0x23')](_0x18baf4);}};}function respondWithFilteredResult(_0x2a2470,_0x170ffa){return function(_0x25f8b2){if(_0x25f8b2){var _0x1ae11e=_0x25f8b2['count'],_0x34f90e=_0x170ffa[_0x2254('0x24')],_0x497724=_0x170ffa[_0x2254('0x24')]+_0x170ffa[_0x2254('0x25')],_0x51b395;if(_0x497724>=_0x1ae11e){_0x497724=_0x1ae11e;_0x51b395=0xc8;}else{_0x51b395=0xce;}_0x2a2470[_0x2254('0x21')](_0x51b395);return _0x2a2470[_0x2254('0x26')](_0x2254('0x27'),_0x34f90e+'-'+_0x497724+'/'+_0x1ae11e)['json'](_0x25f8b2);}return null;};}function patchUpdates(_0x28381e){return function(_0x16148d){try{jsonpatch[_0x2254('0x28')](_0x16148d,_0x28381e,!![]);}catch(_0x576369){return BPromise['reject'](_0x576369);}return _0x16148d['save']();};}function saveUpdates(_0x1e8a98,_0x559af4){return function(_0xf88b56){if(_0xf88b56){return _0xf88b56['update'](_0x1e8a98)['then'](function(_0x4d8faf){return _0x4d8faf;});}return null;};}function removeEntity(_0x540020,_0x5e5edb){return function(_0x4f797d){if(_0x4f797d){return _0x4f797d[_0x2254('0x29')]()[_0x2254('0x2a')](function(){var _0x2f3037=_0x4f797d[_0x2254('0x2b')]({'plain':!![]});var _0x13522d=[{'name':_0x2254('0x2c'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x2254('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':_0x2254('0x2e'),'ignore':![]}];var _0x141dc5=_(_0x13522d)[_0x2254('0x2f')](_0x2254('0x30'))[_0x2254('0x31')]('value')[_0x2254('0x32')]();if(_[_0x2254('0x33')](_0x141dc5,_0x2f3037[_0x2254('0x34')])){return;}var _0x37af8b=_[_0x2254('0x35')](_0x13522d,[_0x2254('0x32'),_0x2f3037[_0x2254('0x34')]])[_0x2254('0x36')];return db[_0x2254('0x37')][_0x2254('0x29')]({'where':{'type':_0x37af8b,'resourceId':_0x2f3037['id']}})[_0x2254('0x2a')](function(){return _0x4f797d;});})[_0x2254('0x2a')](function(){_0x540020[_0x2254('0x21')](0xcc)[_0x2254('0x22')]();});}};}function handleEntityNotFound(_0x4577f4,_0x1b16c8){return function(_0x2c929f){if(!_0x2c929f){_0x4577f4[_0x2254('0x20')](0x194);}return _0x2c929f;};}function handleError(_0x2f32f8,_0x4e3658){_0x4e3658=_0x4e3658||0x1f4;return function(_0xe29526){logger[_0x2254('0x38')](_0xe29526[_0x2254('0x39')]);if(_0xe29526[_0x2254('0x36')]){delete _0xe29526[_0x2254('0x36')];}_0x2f32f8[_0x2254('0x21')](_0x4e3658)[_0x2254('0x3a')](_0xe29526);};}exports[_0x2254('0x3b')]=function(_0x5b84ce,_0x59c6c9){var _0x835a0e={},_0x3aa0bb={},_0x503540={'count':0x0,'rows':[]};var _0x240d4e=_[_0x2254('0x31')](db[_0x2254('0x3c')][_0x2254('0x3d')],function(_0x538e7b){return{'name':_0x538e7b['fieldName'],'type':_0x538e7b[_0x2254('0x34')]['key']};});_0x3aa0bb[_0x2254('0x3e')]=_[_0x2254('0x31')](_0x240d4e,_0x2254('0x36'));_0x3aa0bb[_0x2254('0x3f')]=_[_0x2254('0x40')](_0x5b84ce[_0x2254('0x3f')]);_0x3aa0bb[_0x2254('0x41')]=_['intersection'](_0x3aa0bb[_0x2254('0x3e')],_0x3aa0bb[_0x2254('0x3f')]);_0x835a0e[_0x2254('0x42')]=_[_0x2254('0x43')](_0x3aa0bb[_0x2254('0x3e')],qs[_0x2254('0x44')](_0x5b84ce[_0x2254('0x3f')][_0x2254('0x44')]));_0x835a0e[_0x2254('0x42')]=_0x835a0e[_0x2254('0x42')]['length']?_0x835a0e[_0x2254('0x42')]:_0x3aa0bb[_0x2254('0x3e')];if(!_0x5b84ce[_0x2254('0x3f')][_0x2254('0x45')]('nolimit')){_0x835a0e[_0x2254('0x25')]=qs[_0x2254('0x25')](_0x5b84ce[_0x2254('0x3f')][_0x2254('0x25')]);_0x835a0e[_0x2254('0x24')]=qs[_0x2254('0x24')](_0x5b84ce[_0x2254('0x3f')][_0x2254('0x24')]);}_0x835a0e['order']=qs[_0x2254('0x46')](_0x5b84ce['query'][_0x2254('0x46')]);_0x835a0e[_0x2254('0x47')]=qs[_0x2254('0x41')](_[_0x2254('0x48')](_0x5b84ce[_0x2254('0x3f')],_0x3aa0bb[_0x2254('0x41')]),_0x240d4e);if(_0x5b84ce[_0x2254('0x3f')]['filter']){_0x835a0e[_0x2254('0x47')]=_[_0x2254('0x49')](_0x835a0e[_0x2254('0x47')],{'$or':_[_0x2254('0x31')](_0x240d4e,function(_0x40d4da){if(_0x40d4da['type']!==_0x2254('0x4a')){var _0x1dec43={};_0x1dec43[_0x40d4da[_0x2254('0x36')]]={'$like':'%'+_0x5b84ce[_0x2254('0x3f')][_0x2254('0x2f')]+'%'};return _0x1dec43;}})});}_0x835a0e=_['merge']({},_0x835a0e,_0x5b84ce[_0x2254('0x4b')]);var _0x47c933={'where':_0x835a0e[_0x2254('0x47')]};return db[_0x2254('0x3c')][_0x2254('0x4c')](_0x47c933)[_0x2254('0x2a')](function(_0x362562){_0x503540[_0x2254('0x4c')]=_0x362562;if(_0x5b84ce[_0x2254('0x3f')][_0x2254('0x4d')]){_0x835a0e[_0x2254('0x4e')]=[{'all':!![]}];}return db[_0x2254('0x3c')][_0x2254('0x4f')](_0x835a0e);})[_0x2254('0x2a')](function(_0x83f44b){_0x503540['rows']=_0x83f44b;return _0x503540;})[_0x2254('0x2a')](respondWithFilteredResult(_0x59c6c9,_0x835a0e))[_0x2254('0x50')](handleError(_0x59c6c9,null));};exports[_0x2254('0x51')]=function(_0x5cc8fc,_0x94f5be){var _0x1c087b={'raw':![],'where':{'id':_0x5cc8fc[_0x2254('0x52')]['id']}},_0x400bb3={};_0x400bb3[_0x2254('0x3e')]=_[_0x2254('0x40')](db[_0x2254('0x3c')][_0x2254('0x3d')]);_0x400bb3[_0x2254('0x3f')]=_['keys'](_0x5cc8fc[_0x2254('0x3f')]);_0x400bb3[_0x2254('0x41')]=_[_0x2254('0x43')](_0x400bb3[_0x2254('0x3e')],_0x400bb3[_0x2254('0x3f')]);_0x1c087b[_0x2254('0x42')]=_[_0x2254('0x43')](_0x400bb3[_0x2254('0x3e')],qs[_0x2254('0x44')](_0x5cc8fc[_0x2254('0x3f')]['fields']));_0x1c087b[_0x2254('0x42')]=_0x1c087b[_0x2254('0x42')]['length']?_0x1c087b[_0x2254('0x42')]:_0x400bb3[_0x2254('0x3e')];if(_0x5cc8fc[_0x2254('0x3f')][_0x2254('0x4d')]){_0x1c087b['include']=[{'all':!![]}];}_0x1c087b=_[_0x2254('0x49')]({},_0x1c087b,_0x5cc8fc[_0x2254('0x4b')]);return db['VoiceExtension'][_0x2254('0x35')](_0x1c087b)[_0x2254('0x2a')](handleEntityNotFound(_0x94f5be,null))[_0x2254('0x2a')](respondWithResult(_0x94f5be,null))[_0x2254('0x50')](handleError(_0x94f5be,null));};exports['destroy']=function(_0x166d56,_0x106282){return db[_0x2254('0x3c')]['find']({'where':{'id':_0x166d56['params']['id']}})[_0x2254('0x2a')](handleEntityNotFound(_0x106282,null))[_0x2254('0x2a')](removeEntity(_0x106282,null))['catch'](handleError(_0x106282,null));};exports[_0x2254('0x53')]=function(_0x5bc29a,_0x4addb0){if(_0x5bc29a[_0x2254('0x54')][_0x2254('0x34')]===_0x2254('0x2d')&&!_[_0x2254('0x55')](_0x5bc29a[_0x2254('0x54')]['exten'],'_')){_0x5bc29a['body'][_0x2254('0x56')]='_'['concat'](_0x5bc29a[_0x2254('0x54')][_0x2254('0x56')]);}return db[_0x2254('0x3c')][_0x2254('0x53')](_0x5bc29a['body'],{'raw':![]})[_0x2254('0x2a')](function(_0x240716){var _0x49fe68=_0x5bc29a['user'][_0x2254('0x2b')]({'plain':!![]});if(!_0x49fe68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49fe68[_0x2254('0x57')]===_0x2254('0x58')){var _0x2ef4a0=_0x240716[_0x2254('0x2b')]({'plain':!![]});var _0x301a12=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x2254('0x59'),'value':'outbound'},{'name':_0x2254('0x5a'),'value':'internal'}];var _0x4da493=_['find'](_0x301a12,[_0x2254('0x32'),_0x2ef4a0[_0x2254('0x34')]])[_0x2254('0x36')];return db[_0x2254('0x5b')][_0x2254('0x35')]({'where':{'name':_0x4da493,'userProfileId':_0x49fe68[_0x2254('0x5c')]},'raw':!![]})[_0x2254('0x2a')](function(_0x25137c){if(_0x25137c&&_0x25137c[_0x2254('0x5d')]===0x0){return db[_0x2254('0x37')][_0x2254('0x53')]({'name':_0x2ef4a0[_0x2254('0x36')],'resourceId':_0x2ef4a0['id'],'type':_0x25137c[_0x2254('0x36')],'sectionId':_0x25137c['id']},{})[_0x2254('0x2a')](function(){return _0x240716;});}else{return _0x240716;}})[_0x2254('0x50')](function(_0x3b81bb){logger[_0x2254('0x38')](_0x2254('0x5e'),_0x3b81bb);throw _0x3b81bb;});}return _0x240716;})[_0x2254('0x2a')](respondWithResult(_0x4addb0,0xc9))['catch'](handleError(_0x4addb0,null));};exports[_0x2254('0x5f')]=function(_0xae171c,_0x3b1aae){if(_0xae171c[_0x2254('0x54')]['id']){delete _0xae171c['body']['id'];}return db['VoiceExtension'][_0x2254('0x35')]({'where':{'id':_0xae171c[_0x2254('0x52')]['id']}})[_0x2254('0x2a')](handleEntityNotFound(_0x3b1aae,null))[_0x2254('0x2a')](function(_0x1021b2){if(_0x1021b2){return db['VoiceExtension'][_0x2254('0x5f')](_[_0x2254('0x48')](_0xae171c[_0x2254('0x54')],['exten','context',_0x2254('0x60'),'recordingFormat',_0x2254('0x61'),_0x2254('0x62')]),{'where':{'context':_0x1021b2['context'],'exten':_0x1021b2[_0x2254('0x56')]},'individualHooks':!![]})[_0x2254('0x2a')](function(_0x4d30a5){return _0x4d30a5;});}return null;})[_0x2254('0x2a')](respondWithStatusCode(_0x3b1aae,null))[_0x2254('0x50')](handleError(_0x3b1aae,null));};exports['addApplications']=function(_0x5cc6bd,_0xde4e7,_0xa159a4){return db['VoiceExtension']['findOne']({'where':{'id':_0x5cc6bd[_0x2254('0x52')]['id']}})['then'](handleEntityNotFound(_0xde4e7,null))[_0x2254('0x2a')](function(_0x5d0229){if(_0x5d0229){return db[_0x2254('0x63')][_0x2254('0x64')](function(_0xaa9767){return db[_0x2254('0x3c')]['destroy']({'where':{'VoiceExtensionId':_0x5cc6bd[_0x2254('0x52')]['id']},'transaction':_0xaa9767})['then'](function(_0x1c2158){var _0x33cab6=_['map'](_0x5cc6bd[_0x2254('0x54')],function(_0x23a889){_0x23a889['VoiceExtensionId']=_0x5cc6bd[_0x2254('0x52')]['id'];return _0x23a889;});return db[_0x2254('0x3c')][_0x2254('0x65')](_0x33cab6,{'transaction':_0xaa9767});});})[_0x2254('0x2a')](function(){return db['VoiceExtension'][_0x2254('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5cc6bd[_0x2254('0x52')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x2254('0x2a')](respondWithResult(_0xde4e7,null))[_0x2254('0x50')](handleError(_0xde4e7,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 1153ffc..01923ed 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 _0xf56c=['events','../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xf56c,0x90));var _0xcf56=function(_0x2c93b7,_0x465f4d){_0x2c93b7=_0x2c93b7-0x0;var _0x52dafd=_0xf56c[_0x2c93b7];return _0x52dafd;};'use strict';var EventEmitter=require(_0xcf56('0x0'));var VoiceExtension=require(_0xcf56('0x1'))['db'][_0xcf56('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcf56('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcf56('0x4')};function emitEvent(_0x4a0541){return function(_0x1995dc,_0x517bd4,_0x36688b){VoiceExtensionEvents[_0xcf56('0x5')](_0x4a0541+':'+_0x1995dc['id'],_0x1995dc);VoiceExtensionEvents[_0xcf56('0x5')](_0x4a0541,_0x1995dc);_0x36688b(null);};}for(var e in events){if(events[_0xcf56('0x6')](e)){var event=events[e];VoiceExtension[_0xcf56('0x7')](e,emitEvent(event));}}module[_0xcf56('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3419=['../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x188b30,_0x56a873){var _0x4bef9a=function(_0x123b3f){while(--_0x123b3f){_0x188b30['push'](_0x188b30['shift']());}};_0x4bef9a(++_0x56a873);}(_0x3419,0xb3));var _0x9341=function(_0x4801a0,_0x252c24){_0x4801a0=_0x4801a0-0x0;var _0x338e26=_0x3419[_0x4801a0];return _0x338e26;};'use strict';var EventEmitter=require(_0x9341('0x0'));var VoiceExtension=require(_0x9341('0x1'))['db'][_0x9341('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9341('0x3')](0x0);var events={'afterCreate':_0x9341('0x4'),'afterUpdate':'update','afterDestroy':_0x9341('0x5')};function emitEvent(_0x14270e){return function(_0x3770a3,_0x2dcdaa,_0x45836c){VoiceExtensionEvents['emit'](_0x14270e+':'+_0x3770a3['id'],_0x3770a3);VoiceExtensionEvents[_0x9341('0x6')](_0x14270e,_0x3770a3);_0x45836c(null);};}for(var e in events){if(events[_0x9341('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9341('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 640b6e9..5e1a30d 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 _0x712c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x712c,0x6e));var _0xc712=function(_0x5b9b56,_0x1dd1cc){_0x5b9b56=_0x5b9b56-0x0;var _0x3360a1=_0x712c[_0x5b9b56];return _0x3360a1;};'use strict';var _=require(_0xc712('0x0'));var util=require(_0xc712('0x1'));var logger=require(_0xc712('0x2'))(_0xc712('0x3'));var moment=require('moment');var BPromise=require(_0xc712('0x4'));var rp=require(_0xc712('0x5'));var fs=require('fs');var path=require(_0xc712('0x6'));var rimraf=require(_0xc712('0x7'));var config=require(_0xc712('0x8'));var attributes=require(_0xc712('0x9'));module[_0xc712('0xa')]=function(_0x32ef53,_0x315f0b){return _0x32ef53[_0xc712('0xb')](_0xc712('0xc'),attributes,{'tableName':_0xc712('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cd=['bluebird','../../config/environment','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment'];(function(_0x18aead,_0x40704e){var _0x4a0234=function(_0x975aff){while(--_0x975aff){_0x18aead['push'](_0x18aead['shift']());}};_0x4a0234(++_0x40704e);}(_0x96cd,0x1c9));var _0xd96c=function(_0x478a75,_0x20d8fa){_0x478a75=_0x478a75-0x0;var _0x337086=_0x96cd[_0x478a75];return _0x337086;};'use strict';var _=require(_0xd96c('0x0'));var util=require(_0xd96c('0x1'));var logger=require(_0xd96c('0x2'))(_0xd96c('0x3'));var moment=require(_0xd96c('0x4'));var BPromise=require(_0xd96c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd96c('0x6'));var attributes=require('./voiceExtension.attributes');module[_0xd96c('0x7')]=function(_0x169695,_0x434da6){return _0x169695[_0xd96c('0x8')](_0xd96c('0x9'),attributes,{'tableName':_0xd96c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 4651986..0b51448 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 _0x1e7a=['redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','code','VoiceExtension,\x20%s,\x20%s','message','error','result','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceExtension','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults'];(function(_0x2fa08b,_0x25c419){var _0x2c7827=function(_0x5e7e96){while(--_0x5e7e96){_0x2fa08b['push'](_0x2fa08b['shift']());}};_0x2c7827(++_0x25c419);}(_0x1e7a,0x17b));var _0xa1e7=function(_0x39077e,_0x42f8fa){_0x39077e=_0x39077e-0x0;var _0x2d545c=_0x1e7a[_0x39077e];return _0x2d545c;};'use strict';var _=require(_0xa1e7('0x0'));var util=require(_0xa1e7('0x1'));var moment=require('moment');var BPromise=require(_0xa1e7('0x2'));var rs=require(_0xa1e7('0x3'));var fs=require('fs');var Redis=require(_0xa1e7('0x4'));var db=require(_0xa1e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa1e7('0x6'));var config=require(_0xa1e7('0x7'));var jayson=require(_0xa1e7('0x8'));var client=jayson[_0xa1e7('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa1e7('0xa')](config[_0xa1e7('0xb')],{'host':_0xa1e7('0xc'),'port':0x18eb});var socket=require(_0xa1e7('0xd'))(new Redis(config[_0xa1e7('0xb')]));require(_0xa1e7('0xe'))[_0xa1e7('0xf')](socket);function respondWithRpcPromise(_0x1da77c,_0x51b9b8,_0xbaaed9){return new BPromise(function(_0x439a11,_0x46a986){return client[_0xa1e7('0x10')](_0x1da77c,_0xbaaed9)['then'](function(_0x3aec45){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x51b9b8,_0xa1e7('0x11'));logger[_0xa1e7('0x12')](_0xa1e7('0x13'),_0x51b9b8,'request\x20sent',JSON['stringify'](_0x3aec45));if(_0x3aec45['error']){if(_0x3aec45['error'][_0xa1e7('0x14')]===0x1f4){logger['error'](_0xa1e7('0x15'),_0x51b9b8,_0x3aec45['error'][_0xa1e7('0x16')]);return _0x46a986(_0x3aec45['error'][_0xa1e7('0x16')]);}logger[_0xa1e7('0x17')](_0xa1e7('0x15'),_0x51b9b8,_0x3aec45[_0xa1e7('0x17')][_0xa1e7('0x16')]);return _0x439a11(_0x3aec45[_0xa1e7('0x17')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x51b9b8,'request\x20sent');_0x439a11(_0x3aec45[_0xa1e7('0x18')]['message']);}})['catch'](function(_0x397154){logger[_0xa1e7('0x17')](_0xa1e7('0x15'),_0x51b9b8,_0x397154);_0x46a986(_0x397154);});});}exports['GetVoiceExtension']=function(_0x5b3a93){var _0xa02dbe=this;return new Promise(function(_0x5e652b,_0x235b2a){return db[_0xa1e7('0x19')][_0xa1e7('0x1a')]({'raw':_0x5b3a93['options']?_0x5b3a93[_0xa1e7('0x1b')][_0xa1e7('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b3a93[_0xa1e7('0x1b')]?_0x5b3a93[_0xa1e7('0x1b')][_0xa1e7('0x1d')]||null:null,'attributes':_0x5b3a93['options']?_0x5b3a93[_0xa1e7('0x1b')][_0xa1e7('0x1e')]||null:null,'limit':_0x5b3a93[_0xa1e7('0x1b')]?_0x5b3a93[_0xa1e7('0x1b')][_0xa1e7('0x1f')]||null:null,'include':_0x5b3a93[_0xa1e7('0x1b')]?_0x5b3a93[_0xa1e7('0x1b')][_0xa1e7('0x20')]?_[_0xa1e7('0x21')](_0x5b3a93[_0xa1e7('0x1b')][_0xa1e7('0x20')],function(_0x4aceff){return{'model':db[_0x4aceff['model']],'as':_0x4aceff['as'],'attributes':_0x4aceff['attributes'],'include':_0x4aceff[_0xa1e7('0x20')]?_[_0xa1e7('0x21')](_0x4aceff[_0xa1e7('0x20')],function(_0x5e42f8){return{'model':db[_0x5e42f8[_0xa1e7('0x22')]],'as':_0x5e42f8['as'],'attributes':_0x5e42f8[_0xa1e7('0x1e')],'include':_0x5e42f8[_0xa1e7('0x20')]?_[_0xa1e7('0x21')](_0x5e42f8[_0xa1e7('0x20')],function(_0x37e80c){return{'model':db[_0x37e80c[_0xa1e7('0x22')]],'as':_0x37e80c['as'],'attributes':_0x37e80c[_0xa1e7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa1e7('0x23')](function(_0x2a4a0c){logger['info']('GetVoiceExtension',_0x5b3a93);logger[_0xa1e7('0x12')](_0xa1e7('0x24'),_0x5b3a93,JSON[_0xa1e7('0x25')](_0x2a4a0c));_0x5e652b(_0x2a4a0c);})[_0xa1e7('0x26')](function(_0x1983c8){logger[_0xa1e7('0x17')]('GetVoiceExtension',_0x1983c8[_0xa1e7('0x16')],_0x5b3a93);_0x235b2a(_0xa02dbe['error'](0x1f4,_0x1983c8[_0xa1e7('0x16')]));});});}; \ No newline at end of file +var _0x1ade=['limit','include','map','model','GetVoiceExtension','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceExtension','options','attributes'];(function(_0x4f2e37,_0x4bbb3c){var _0x2bbb4b=function(_0x506f56){while(--_0x506f56){_0x4f2e37['push'](_0x4f2e37['shift']());}};_0x2bbb4b(++_0x4bbb3c);}(_0x1ade,0x108));var _0xe1ad=function(_0x23b9f8,_0x39b479){_0x23b9f8=_0x23b9f8-0x0;var _0x323ea5=_0x1ade[_0x23b9f8];return _0x323ea5;};'use strict';var _=require(_0xe1ad('0x0'));var util=require('util');var moment=require(_0xe1ad('0x1'));var BPromise=require(_0xe1ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1ad('0x3'));var db=require(_0xe1ad('0x4'))['db'];var utils=require(_0xe1ad('0x5'));var logger=require(_0xe1ad('0x6'))(_0xe1ad('0x7'));var config=require(_0xe1ad('0x8'));var jayson=require(_0xe1ad('0x9'));var client=jayson[_0xe1ad('0xa')][_0xe1ad('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe1ad('0xc')],{'host':_0xe1ad('0xd'),'port':0x18eb});var socket=require(_0xe1ad('0xe'))(new Redis(config['redis']));require(_0xe1ad('0xf'))[_0xe1ad('0x10')](socket);function respondWithRpcPromise(_0x5168f1,_0x276711,_0x484f32){return new BPromise(function(_0x3abc99,_0x49f700){return client[_0xe1ad('0x11')](_0x5168f1,_0x484f32)[_0xe1ad('0x12')](function(_0x4482f9){logger[_0xe1ad('0x13')](_0xe1ad('0x14'),_0x276711,_0xe1ad('0x15'));logger[_0xe1ad('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x276711,_0xe1ad('0x15'),JSON[_0xe1ad('0x17')](_0x4482f9));if(_0x4482f9[_0xe1ad('0x18')]){if(_0x4482f9[_0xe1ad('0x18')][_0xe1ad('0x19')]===0x1f4){logger[_0xe1ad('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x276711,_0x4482f9[_0xe1ad('0x18')][_0xe1ad('0x1a')]);return _0x49f700(_0x4482f9['error']['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x276711,_0x4482f9[_0xe1ad('0x18')]['message']);return _0x3abc99(_0x4482f9[_0xe1ad('0x18')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x276711,_0xe1ad('0x15'));_0x3abc99(_0x4482f9[_0xe1ad('0x1b')][_0xe1ad('0x1a')]);}})[_0xe1ad('0x1c')](function(_0x37f042){logger[_0xe1ad('0x18')](_0xe1ad('0x14'),_0x276711,_0x37f042);_0x49f700(_0x37f042);});});}exports['GetVoiceExtension']=function(_0x17b423){var _0x2fc8ed=this;return new Promise(function(_0x14b33c,_0x48b1db){return db[_0xe1ad('0x1d')]['findAll']({'raw':_0x17b423[_0xe1ad('0x1e')]?_0x17b423[_0xe1ad('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x17b423['options']?_0x17b423[_0xe1ad('0x1e')]['where']||null:null,'attributes':_0x17b423[_0xe1ad('0x1e')]?_0x17b423[_0xe1ad('0x1e')][_0xe1ad('0x1f')]||null:null,'limit':_0x17b423[_0xe1ad('0x1e')]?_0x17b423[_0xe1ad('0x1e')][_0xe1ad('0x20')]||null:null,'include':_0x17b423[_0xe1ad('0x1e')]?_0x17b423[_0xe1ad('0x1e')][_0xe1ad('0x21')]?_[_0xe1ad('0x22')](_0x17b423['options'][_0xe1ad('0x21')],function(_0x435ac9){return{'model':db[_0x435ac9[_0xe1ad('0x23')]],'as':_0x435ac9['as'],'attributes':_0x435ac9['attributes'],'include':_0x435ac9['include']?_['map'](_0x435ac9[_0xe1ad('0x21')],function(_0x107dfe){return{'model':db[_0x107dfe[_0xe1ad('0x23')]],'as':_0x107dfe['as'],'attributes':_0x107dfe[_0xe1ad('0x1f')],'include':_0x107dfe[_0xe1ad('0x21')]?_[_0xe1ad('0x22')](_0x107dfe[_0xe1ad('0x21')],function(_0x16757c){return{'model':db[_0x16757c[_0xe1ad('0x23')]],'as':_0x16757c['as'],'attributes':_0x16757c[_0xe1ad('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe1ad('0x12')](function(_0x285122){logger['info'](_0xe1ad('0x24'),_0x17b423);logger[_0xe1ad('0x16')](_0xe1ad('0x24'),_0x17b423,JSON[_0xe1ad('0x17')](_0x285122));_0x14b33c(_0x285122);})['catch'](function(_0x4acdf8){logger[_0xe1ad('0x18')](_0xe1ad('0x24'),_0x4acdf8['message'],_0x17b423);_0x48b1db(_0x2fc8ed[_0xe1ad('0x18')](0x1f4,_0x4acdf8[_0xe1ad('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d57968b..e08457e 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 _0xc41a=['emit','removeListener','length','voiceExtension:','./voiceExtension.events','remove','update'];(function(_0x2c9eae,_0x2cac87){var _0x35a380=function(_0x1ac2ed){while(--_0x1ac2ed){_0x2c9eae['push'](_0x2c9eae['shift']());}};_0x35a380(++_0x2cac87);}(_0xc41a,0x1a1));var _0xac41=function(_0x5f1438,_0x44e52d){_0x5f1438=_0x5f1438-0x0;var _0x408fbc=_0xc41a[_0x5f1438];return _0x408fbc;};'use strict';var VoiceExtensionEvents=require(_0xac41('0x0'));var events=['save',_0xac41('0x1'),_0xac41('0x2')];function createListener(_0x4af568,_0x291a78){return function(_0x3fa0e7){_0x291a78[_0xac41('0x3')](_0x4af568,_0x3fa0e7);};}function removeListener(_0x394869,_0x304a1f){return function(){VoiceExtensionEvents[_0xac41('0x4')](_0x394869,_0x304a1f);};}exports['register']=function(_0x1ce31f){for(var _0x4afa9b=0x0,_0x533a26=events[_0xac41('0x5')];_0x4afa9b<_0x533a26;_0x4afa9b++){var _0x2eccc5=events[_0x4afa9b];var _0xc60b96=createListener(_0xac41('0x6')+_0x2eccc5,_0x1ce31f);VoiceExtensionEvents['on'](_0x2eccc5,_0xc60b96);}}; \ No newline at end of file +var _0x8cdf=['length','voiceExtension:','save','register'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x8cdf,0x9e));var _0xf8cd=function(_0x42a768,_0x5f1d28){_0x42a768=_0x42a768-0x0;var _0xfb7ca3=_0x8cdf[_0x42a768];return _0xfb7ca3;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xf8cd('0x0'),'remove','update'];function createListener(_0x12698e,_0x224168){return function(_0x37c8b9){_0x224168['emit'](_0x12698e,_0x37c8b9);};}function removeListener(_0x19453f,_0x1bfedd){return function(){VoiceExtensionEvents['removeListener'](_0x19453f,_0x1bfedd);};}exports[_0xf8cd('0x1')]=function(_0x594ca6){for(var _0x432eb9=0x0,_0x21cd6c=events[_0xf8cd('0x2')];_0x432eb9<_0x21cd6c;_0x432eb9++){var _0x488fbe=events[_0x432eb9];var _0x2246f2=createListener(_0xf8cd('0x3')+_0x488fbe,_0x594ca6);VoiceExtensionEvents['on'](_0x488fbe,_0x2246f2);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4a595d0..632d12a 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 _0x1020=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x38619a,_0x19ce9a){var _0x556c43=function(_0x22078f){while(--_0x22078f){_0x38619a['push'](_0x38619a['shift']());}};_0x556c43(++_0x19ce9a);}(_0x1020,0x1b5));var _0x0102=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x1020[_0x4de586];return _0x46baf5;};'use strict';var multer=require(_0x0102('0x0'));var util=require(_0x0102('0x1'));var path=require(_0x0102('0x2'));var timeout=require(_0x0102('0x3'));var express=require(_0x0102('0x4'));var router=express[_0x0102('0x5')]();var auth=require(_0x0102('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0102('0x7'));var controller=require(_0x0102('0x8'));router[_0x0102('0x9')]('/',auth['isAuthenticated'](),controller[_0x0102('0xa')]);router[_0x0102('0x9')](_0x0102('0xb'),auth[_0x0102('0xc')](),controller[_0x0102('0xd')]);router['get'](_0x0102('0xe'),auth[_0x0102('0xc')](),controller[_0x0102('0xf')]);router[_0x0102('0x10')]('/',auth[_0x0102('0xc')](),controller[_0x0102('0x11')]);router['put']('/:id',auth[_0x0102('0xc')](),controller[_0x0102('0x12')]);router[_0x0102('0x13')](_0x0102('0xb'),auth[_0x0102('0xc')](),controller[_0x0102('0x14')]);module[_0x0102('0x15')]=router; \ No newline at end of file +var _0x8d6e=['update','/:id','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/messages','post','put'];(function(_0x26b308,_0x397dfc){var _0x59478d=function(_0x20b4c4){while(--_0x20b4c4){_0x26b308['push'](_0x26b308['shift']());}};_0x59478d(++_0x397dfc);}(_0x8d6e,0x110));var _0xe8d6=function(_0x8fec6b,_0x51941b){_0x8fec6b=_0x8fec6b-0x0;var _0x3eff7b=_0x8d6e[_0x8fec6b];return _0x3eff7b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8d6('0x0'));var timeout=require(_0xe8d6('0x1'));var express=require(_0xe8d6('0x2'));var router=express[_0xe8d6('0x3')]();var auth=require(_0xe8d6('0x4'));var interaction=require(_0xe8d6('0x5'));var config=require(_0xe8d6('0x6'));var controller=require('./voiceMail.controller');router[_0xe8d6('0x7')]('/',auth[_0xe8d6('0x8')](),controller['index']);router['get']('/:id',auth[_0xe8d6('0x8')](),controller[_0xe8d6('0x9')]);router[_0xe8d6('0x7')](_0xe8d6('0xa'),auth[_0xe8d6('0x8')](),controller['getMessages']);router[_0xe8d6('0xb')]('/',auth[_0xe8d6('0x8')](),controller['create']);router[_0xe8d6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe8d6('0xd')]);router['delete'](_0xe8d6('0xe'),auth['isAuthenticated'](),controller['destroy']);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 48647e3..e97c2f2 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 _0x0abf=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','setDataValue','email','string','trim','central','yes'];(function(_0x4df8ce,_0x13f543){var _0x21b37e=function(_0x1be447){while(--_0x1be447){_0x4df8ce['push'](_0x4df8ce['shift']());}};_0x21b37e(++_0x13f543);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xf0ab('0x1')]},'context':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf0ab('0x1')]},'fullname':{'type':Sequelize[_0xf0ab('0x1')]},'email':{'type':Sequelize[_0xf0ab('0x1')],'validate':{'isEmail':!![]},'set':function(_0xbb1f91){this[_0xf0ab('0x2')](_0xf0ab('0x3'),typeof _0xbb1f91===_0xf0ab('0x4')&&_0xbb1f91['trim']()?_0xbb1f91[_0xf0ab('0x5')]():null);}},'pager':{'type':Sequelize[_0xf0ab('0x1')]},'tz':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':_0xf0ab('0x6')},'attach':{'type':Sequelize['ENUM'](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf0ab('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf0ab('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf0ab('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf0ab('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf0ab('0x1')]},'emailbody':{'type':Sequelize[_0xf0ab('0x1')]},'maxsecs':{'type':Sequelize[_0xf0ab('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf0ab('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf0ab('0xb')],'get':function(){return this[_0xf0ab('0xc')](_0xf0ab('0xd'))+_0xf0ab('0xe')+this[_0xf0ab('0xc')](_0xf0ab('0xf'));}}}; \ No newline at end of file +var _0xbdb7=['getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','yes','ENUM','INTEGER'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x413410,_0xf7ac22){_0x413410=_0x413410-0x0;var _0x1294e5=_0xbdb7[_0x413410];return _0x1294e5;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'customer_id':{'type':Sequelize[_0x7bdb('0x2')]},'context':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x3'),'unique':_0x7bdb('0x4')},'mailbox':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7bdb('0x4')},'password':{'type':Sequelize[_0x7bdb('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7bdb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4fd1ad){this['setDataValue'](_0x7bdb('0x5'),typeof _0x4fd1ad===_0x7bdb('0x6')&&_0x4fd1ad['trim']()?_0x4fd1ad['trim']():null);}},'pager':{'type':Sequelize[_0x7bdb('0x2')]},'tz':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7bdb('0x2')]},'callback':{'type':Sequelize[_0x7bdb('0x2')]},'review':{'type':Sequelize[_0x7bdb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7bdb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7bdb('0x2')]},'emailbody':{'type':Sequelize[_0x7bdb('0x2')]},'maxsecs':{'type':Sequelize[_0x7bdb('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7bdb('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7bdb('0xa')](_0x7bdb('0xb'))+'\x20-\x20'+this[_0x7bdb('0xa')](_0x7bdb('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 152076b..fbaafc3 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 _0x8db6=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMessages','findOne','VoiceMailMessage','nolimit','order','filter','options','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','get','Voicemails','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','include','VoiceMail','catch','show','params','keys','includeAll','find'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8db6,0x66));var _0x68db=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x8db6[_0x149ca0];return _0x56b6b9;};'use strict';var pdf=require(_0x68db('0x0'));var emlformat=require(_0x68db('0x1'));var rimraf=require(_0x68db('0x2'));var zipdir=require(_0x68db('0x3'));var jsonpatch=require(_0x68db('0x4'));var rp=require(_0x68db('0x5'));var moment=require(_0x68db('0x6'));var BPromise=require(_0x68db('0x7'));var Mustache=require(_0x68db('0x8'));var util=require('util');var path=require(_0x68db('0x9'));var sox=require('sox');var csv=require(_0x68db('0xa'));var ejs=require(_0x68db('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x68db('0xc'));var crypto=require('crypto');var jsforce=require(_0x68db('0xd'));var deskjs=require(_0x68db('0xe'));var toCsv=require(_0x68db('0xa'));var querystring=require(_0x68db('0xf'));var Papa=require(_0x68db('0x10'));var Redis=require(_0x68db('0x11'));var authService=require(_0x68db('0x12'));var qs=require(_0x68db('0x13'));var as=require(_0x68db('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68db('0x15'));var utils=require('../../config/utils');var config=require(_0x68db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56c509,_0x1f27be){_0x1f27be=_0x1f27be||0xcc;return function(_0x348f01){if(_0x348f01){return _0x56c509['sendStatus'](_0x1f27be);}return _0x56c509['status'](_0x1f27be)[_0x68db('0x17')]();};}function respondWithResult(_0x416a62,_0x528ab3){_0x528ab3=_0x528ab3||0xc8;return function(_0x9d420c){if(_0x9d420c){return _0x416a62[_0x68db('0x18')](_0x528ab3)[_0x68db('0x19')](_0x9d420c);}};}function respondWithFilteredResult(_0x518611,_0x3cb84d){return function(_0x1dc397){if(_0x1dc397){var _0x454e57=_0x1dc397[_0x68db('0x1a')],_0x1992a1=_0x3cb84d['offset'],_0x43b8ea=_0x3cb84d[_0x68db('0x1b')]+_0x3cb84d['limit'],_0xedc330;if(_0x43b8ea>=_0x454e57){_0x43b8ea=_0x454e57;_0xedc330=0xc8;}else{_0xedc330=0xce;}_0x518611[_0x68db('0x18')](_0xedc330);return _0x518611[_0x68db('0x1c')](_0x68db('0x1d'),_0x1992a1+'-'+_0x43b8ea+'/'+_0x454e57)[_0x68db('0x19')](_0x1dc397);}return null;};}function patchUpdates(_0xa9657f){return function(_0x3ba612){try{jsonpatch[_0x68db('0x1e')](_0x3ba612,_0xa9657f,!![]);}catch(_0x4c2d75){return BPromise[_0x68db('0x1f')](_0x4c2d75);}return _0x3ba612[_0x68db('0x20')]();};}function saveUpdates(_0x39e60d,_0x4cba02){return function(_0x39a4aa){if(_0x39a4aa){return _0x39a4aa['update'](_0x39e60d)['then'](function(_0x5240a5){return _0x5240a5;});}return null;};}function removeEntity(_0x3f0fbc,_0x30b2da){return function(_0x3f4871){if(_0x3f4871){return _0x3f4871[_0x68db('0x21')]()['then'](function(){var _0x3e36ba=_0x3f4871[_0x68db('0x22')]({'plain':!![]});var _0x3eae36=_0x68db('0x23');return db[_0x68db('0x24')][_0x68db('0x21')]({'where':{'type':_0x3eae36,'resourceId':_0x3e36ba['id']}})[_0x68db('0x25')](function(){return _0x3f4871;});})[_0x68db('0x25')](function(){_0x3f0fbc[_0x68db('0x18')](0xcc)[_0x68db('0x17')]();});}};}function handleEntityNotFound(_0x280c28,_0x352a05){return function(_0x2e4a25){if(!_0x2e4a25){_0x280c28[_0x68db('0x26')](0x194);}return _0x2e4a25;};}function handleError(_0x843dd0,_0x295def){_0x295def=_0x295def||0x1f4;return function(_0x1dfd33){logger[_0x68db('0x27')](_0x1dfd33[_0x68db('0x28')]);if(_0x1dfd33[_0x68db('0x29')]){delete _0x1dfd33[_0x68db('0x29')];}_0x843dd0[_0x68db('0x18')](_0x295def)[_0x68db('0x2a')](_0x1dfd33);};}exports[_0x68db('0x2b')]=function(_0x30f6d8,_0x5a0f70){var _0x5bf8cb={},_0x17a34f={},_0x148258={'count':0x0,'rows':[]};var _0x338c67=_[_0x68db('0x2c')](db['VoiceMail'][_0x68db('0x2d')],function(_0x422bf6){return{'name':_0x422bf6['fieldName'],'type':_0x422bf6[_0x68db('0x2e')]['key']};});_0x17a34f[_0x68db('0x2f')]=_['map'](_0x338c67,_0x68db('0x29'));_0x17a34f[_0x68db('0x30')]=_['keys'](_0x30f6d8[_0x68db('0x30')]);_0x17a34f[_0x68db('0x31')]=_[_0x68db('0x32')](_0x17a34f['model'],_0x17a34f[_0x68db('0x30')]);_0x5bf8cb[_0x68db('0x33')]=_[_0x68db('0x32')](_0x17a34f['model'],qs['fields'](_0x30f6d8[_0x68db('0x30')][_0x68db('0x34')]));_0x5bf8cb['attributes']=_0x5bf8cb[_0x68db('0x33')][_0x68db('0x35')]?_0x5bf8cb['attributes']:_0x17a34f[_0x68db('0x2f')];if(!_0x30f6d8[_0x68db('0x30')][_0x68db('0x36')]('nolimit')){_0x5bf8cb[_0x68db('0x37')]=qs[_0x68db('0x37')](_0x30f6d8[_0x68db('0x30')][_0x68db('0x37')]);_0x5bf8cb[_0x68db('0x1b')]=qs[_0x68db('0x1b')](_0x30f6d8[_0x68db('0x30')][_0x68db('0x1b')]);}_0x5bf8cb['order']=qs[_0x68db('0x38')](_0x30f6d8['query'][_0x68db('0x38')]);_0x5bf8cb[_0x68db('0x39')]=qs['filters'](_[_0x68db('0x3a')](_0x30f6d8[_0x68db('0x30')],_0x17a34f[_0x68db('0x31')]),_0x338c67);if(_0x30f6d8[_0x68db('0x30')]['filter']){_0x5bf8cb[_0x68db('0x39')]=_['merge'](_0x5bf8cb[_0x68db('0x39')],{'$or':_[_0x68db('0x2c')](_0x338c67,function(_0x314bb2){if(_0x314bb2[_0x68db('0x2e')]!=='VIRTUAL'){var _0x198588={};_0x198588[_0x314bb2[_0x68db('0x29')]]={'$like':'%'+_0x30f6d8[_0x68db('0x30')]['filter']+'%'};return _0x198588;}})});}_0x5bf8cb=_[_0x68db('0x3b')]({},_0x5bf8cb,_0x30f6d8['options']);var _0x2606f2={'where':_0x5bf8cb[_0x68db('0x39')]};return db['VoiceMail'][_0x68db('0x1a')](_0x2606f2)['then'](function(_0x456058){_0x148258['count']=_0x456058;if(_0x30f6d8[_0x68db('0x30')]['includeAll']){_0x5bf8cb[_0x68db('0x3c')]=[{'all':!![]}];}return db[_0x68db('0x3d')]['findAll'](_0x5bf8cb);})[_0x68db('0x25')](function(_0x57faed){_0x148258['rows']=_0x57faed;return _0x148258;})[_0x68db('0x25')](respondWithFilteredResult(_0x5a0f70,_0x5bf8cb))[_0x68db('0x3e')](handleError(_0x5a0f70,null));};exports[_0x68db('0x3f')]=function(_0x44fa93,_0x342f1c){var _0x118cb2={'raw':!![],'where':{'id':_0x44fa93[_0x68db('0x40')]['id']}},_0x20be5d={};_0x20be5d[_0x68db('0x2f')]=_[_0x68db('0x41')](db[_0x68db('0x3d')]['rawAttributes']);_0x20be5d[_0x68db('0x30')]=_[_0x68db('0x41')](_0x44fa93[_0x68db('0x30')]);_0x20be5d[_0x68db('0x31')]=_[_0x68db('0x32')](_0x20be5d['model'],_0x20be5d['query']);_0x118cb2[_0x68db('0x33')]=_[_0x68db('0x32')](_0x20be5d['model'],qs['fields'](_0x44fa93[_0x68db('0x30')][_0x68db('0x34')]));_0x118cb2[_0x68db('0x33')]=_0x118cb2[_0x68db('0x33')][_0x68db('0x35')]?_0x118cb2[_0x68db('0x33')]:_0x20be5d[_0x68db('0x2f')];if(_0x44fa93[_0x68db('0x30')][_0x68db('0x42')]){_0x118cb2[_0x68db('0x3c')]=[{'all':!![]}];}_0x118cb2=_[_0x68db('0x3b')]({},_0x118cb2,_0x44fa93['options']);return db[_0x68db('0x3d')][_0x68db('0x43')](_0x118cb2)[_0x68db('0x25')](handleEntityNotFound(_0x342f1c,null))['then'](respondWithResult(_0x342f1c,null))[_0x68db('0x3e')](handleError(_0x342f1c,null));};exports[_0x68db('0x44')]=function(_0x2a8051,_0x4b4a1e){return db[_0x68db('0x3d')][_0x68db('0x44')](_0x2a8051['body'],{})[_0x68db('0x25')](function(_0x270ac1){var _0x4d1b9f=_0x2a8051[_0x68db('0x45')][_0x68db('0x22')]({'plain':!![]});if(!_0x4d1b9f)throw new Error(_0x68db('0x46'));if(_0x4d1b9f[_0x68db('0x47')]===_0x68db('0x45')){var _0x1f5707=_0x270ac1[_0x68db('0x22')]({'plain':!![]});var _0x240f81=_0x68db('0x23');return db['UserProfileSection'][_0x68db('0x43')]({'where':{'name':_0x240f81,'userProfileId':_0x4d1b9f[_0x68db('0x48')]},'raw':!![]})[_0x68db('0x25')](function(_0x4b757e){if(_0x4b757e&&_0x4b757e[_0x68db('0x49')]===0x0){return db['UserProfileResource'][_0x68db('0x44')]({'name':_0x1f5707[_0x68db('0x29')],'resourceId':_0x1f5707['id'],'type':_0x4b757e[_0x68db('0x29')],'sectionId':_0x4b757e['id']},{})[_0x68db('0x25')](function(){return _0x270ac1;});}else{return _0x270ac1;}})[_0x68db('0x3e')](function(_0x279478){logger[_0x68db('0x27')](_0x68db('0x4a'),_0x279478);throw _0x279478;});}return _0x270ac1;})['then'](respondWithResult(_0x4b4a1e,0xc9))[_0x68db('0x3e')](handleError(_0x4b4a1e,null));};exports[_0x68db('0x4b')]=function(_0x10345a,_0x1ef3e5){if(_0x10345a[_0x68db('0x4c')]['id']){delete _0x10345a[_0x68db('0x4c')]['id'];}return db['VoiceMail'][_0x68db('0x43')]({'where':{'id':_0x10345a['params']['id']}})[_0x68db('0x25')](handleEntityNotFound(_0x1ef3e5,null))['then'](saveUpdates(_0x10345a[_0x68db('0x4c')],null))[_0x68db('0x25')](respondWithResult(_0x1ef3e5,null))[_0x68db('0x3e')](handleError(_0x1ef3e5,null));};exports[_0x68db('0x21')]=function(_0x58ce7e,_0x4d4c2c){return db['VoiceMail'][_0x68db('0x43')]({'where':{'id':_0x58ce7e[_0x68db('0x40')]['id']}})[_0x68db('0x25')](handleEntityNotFound(_0x4d4c2c,null))[_0x68db('0x25')](removeEntity(_0x4d4c2c,null))['catch'](handleError(_0x4d4c2c,null));};exports[_0x68db('0x4d')]=function(_0x4cc200,_0x23b8cd,_0x2fd88d){return db['VoiceMail'][_0x68db('0x4e')]({'where':{'id':_0x4cc200[_0x68db('0x40')]['id']}})[_0x68db('0x25')](handleEntityNotFound(_0x23b8cd,null))[_0x68db('0x25')](function(_0xc57b67){var _0x418333;var _0x3b53b={},_0x3d15b0={};_0x3d15b0['model']=_[_0x68db('0x41')](db[_0x68db('0x4f')][_0x68db('0x2d')]);_0x3d15b0[_0x68db('0x30')]=_[_0x68db('0x41')](_0x4cc200[_0x68db('0x30')]);_0x3d15b0['filters']=_[_0x68db('0x32')](_0x3d15b0[_0x68db('0x2f')],_0x3d15b0['query']);_0x3b53b['attributes']=_['intersection'](_0x3d15b0['model'],qs['fields'](_0x4cc200[_0x68db('0x30')][_0x68db('0x34')]));_0x3b53b[_0x68db('0x33')]=_0x3b53b['attributes'][_0x68db('0x35')]?_0x3b53b['attributes']:_0x3d15b0['model'];if(!_0x4cc200['query'][_0x68db('0x36')](_0x68db('0x50'))){_0x3b53b[_0x68db('0x37')]=qs['limit'](_0x4cc200[_0x68db('0x30')][_0x68db('0x37')]);_0x3b53b['offset']=qs[_0x68db('0x1b')](_0x4cc200[_0x68db('0x30')][_0x68db('0x1b')]);}_0x3b53b[_0x68db('0x51')]=qs[_0x68db('0x38')](_0x4cc200[_0x68db('0x30')][_0x68db('0x38')]);_0x3b53b[_0x68db('0x39')]=qs[_0x68db('0x31')](_[_0x68db('0x3a')](_0x4cc200[_0x68db('0x30')],_0x3d15b0[_0x68db('0x31')]));if(_0x4cc200[_0x68db('0x30')]['filter']){_0x3b53b[_0x68db('0x39')]=_['merge'](_0x3b53b['where'],{'$or':_[_0x68db('0x2c')](_0x3b53b[_0x68db('0x33')],function(_0x451bd2){var _0x27bad2={};_0x27bad2[_0x451bd2]={'$like':'%'+_0x4cc200['query'][_0x68db('0x52')]+'%'};return _0x27bad2;})});}_0x3b53b[_0x68db('0x39')]=_[_0x68db('0x3b')](_0x3b53b['where'],{'mailboxuser':_0xc57b67['mailbox']});_0x3b53b=_['merge']({},_0x3b53b,_0x4cc200[_0x68db('0x53')]);return db[_0x68db('0x4f')][_0x68db('0x54')](_0x3b53b)[_0x68db('0x25')](respondWithFilteredResult(_0x23b8cd,_0x3b53b));})['catch'](handleError(_0x23b8cd,null));}; \ No newline at end of file +var _0x1ad1=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','then','Voicemails','error','stack','name','map','VoiceMail','rawAttributes','type','key','query','keys','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','intersection','find','create','body','user','get','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x565454,_0x20dc1e){var _0xc0af5f=function(_0x186d0c){while(--_0x186d0c){_0x565454['push'](_0x565454['shift']());}};_0xc0af5f(++_0x20dc1e);}(_0x1ad1,0x94));var _0x11ad=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x1ad1[_0x45d3f0];return _0x314b79;};'use strict';var pdf=require(_0x11ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x11ad('0x1'));var zipdir=require(_0x11ad('0x2'));var jsonpatch=require(_0x11ad('0x3'));var rp=require(_0x11ad('0x4'));var moment=require(_0x11ad('0x5'));var BPromise=require(_0x11ad('0x6'));var Mustache=require(_0x11ad('0x7'));var util=require(_0x11ad('0x8'));var path=require('path');var sox=require(_0x11ad('0x9'));var csv=require(_0x11ad('0xa'));var ejs=require(_0x11ad('0xb'));var fs=require('fs');var _=require(_0x11ad('0xc'));var squel=require(_0x11ad('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11ad('0xe'));var toCsv=require('to-csv');var querystring=require(_0x11ad('0xf'));var Papa=require(_0x11ad('0x10'));var Redis=require(_0x11ad('0x11'));var authService=require(_0x11ad('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11ad('0x13'));var logger=require(_0x11ad('0x14'))(_0x11ad('0x15'));var utils=require(_0x11ad('0x16'));var config=require(_0x11ad('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36875c,_0x589c9a){_0x589c9a=_0x589c9a||0xcc;return function(_0x5e60b5){if(_0x5e60b5){return _0x36875c[_0x11ad('0x18')](_0x589c9a);}return _0x36875c[_0x11ad('0x19')](_0x589c9a)[_0x11ad('0x1a')]();};}function respondWithResult(_0x50189c,_0x212057){_0x212057=_0x212057||0xc8;return function(_0x587ad8){if(_0x587ad8){return _0x50189c[_0x11ad('0x19')](_0x212057)[_0x11ad('0x1b')](_0x587ad8);}};}function respondWithFilteredResult(_0x1681dd,_0x83ff0c){return function(_0x4a2363){if(_0x4a2363){var _0x319846=_0x4a2363['count'],_0x1cacf4=_0x83ff0c[_0x11ad('0x1c')],_0x4557a5=_0x83ff0c[_0x11ad('0x1c')]+_0x83ff0c[_0x11ad('0x1d')],_0x1c3bad;if(_0x4557a5>=_0x319846){_0x4557a5=_0x319846;_0x1c3bad=0xc8;}else{_0x1c3bad=0xce;}_0x1681dd[_0x11ad('0x19')](_0x1c3bad);return _0x1681dd[_0x11ad('0x1e')]('Content-Range',_0x1cacf4+'-'+_0x4557a5+'/'+_0x319846)[_0x11ad('0x1b')](_0x4a2363);}return null;};}function patchUpdates(_0x63a533){return function(_0x34a4d9){try{jsonpatch[_0x11ad('0x1f')](_0x34a4d9,_0x63a533,!![]);}catch(_0x582aa7){return BPromise[_0x11ad('0x20')](_0x582aa7);}return _0x34a4d9[_0x11ad('0x21')]();};}function saveUpdates(_0x17c04a,_0x232e07){return function(_0x5efa19){if(_0x5efa19){return _0x5efa19['update'](_0x17c04a)['then'](function(_0x49022f){return _0x49022f;});}return null;};}function removeEntity(_0x37ea1f,_0x356eb2){return function(_0xed16e7){if(_0xed16e7){return _0xed16e7[_0x11ad('0x22')]()[_0x11ad('0x23')](function(){var _0x1e2dc6=_0xed16e7['get']({'plain':!![]});var _0xfd43a3=_0x11ad('0x24');return db['UserProfileResource'][_0x11ad('0x22')]({'where':{'type':_0xfd43a3,'resourceId':_0x1e2dc6['id']}})[_0x11ad('0x23')](function(){return _0xed16e7;});})[_0x11ad('0x23')](function(){_0x37ea1f[_0x11ad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50ceba,_0x1fd7c7){return function(_0x5b286b){if(!_0x5b286b){_0x50ceba[_0x11ad('0x18')](0x194);}return _0x5b286b;};}function handleError(_0x26d79e,_0x3e1e56){_0x3e1e56=_0x3e1e56||0x1f4;return function(_0x4e6428){logger[_0x11ad('0x25')](_0x4e6428[_0x11ad('0x26')]);if(_0x4e6428[_0x11ad('0x27')]){delete _0x4e6428[_0x11ad('0x27')];}_0x26d79e[_0x11ad('0x19')](_0x3e1e56)['send'](_0x4e6428);};}exports['index']=function(_0x120041,_0x135e23){var _0x52e93c={},_0x45c48e={},_0xbc463e={'count':0x0,'rows':[]};var _0x41614c=_[_0x11ad('0x28')](db[_0x11ad('0x29')][_0x11ad('0x2a')],function(_0x32498f){return{'name':_0x32498f['fieldName'],'type':_0x32498f[_0x11ad('0x2b')][_0x11ad('0x2c')]};});_0x45c48e['model']=_[_0x11ad('0x28')](_0x41614c,_0x11ad('0x27'));_0x45c48e[_0x11ad('0x2d')]=_[_0x11ad('0x2e')](_0x120041[_0x11ad('0x2d')]);_0x45c48e['filters']=_['intersection'](_0x45c48e['model'],_0x45c48e[_0x11ad('0x2d')]);_0x52e93c[_0x11ad('0x2f')]=_['intersection'](_0x45c48e[_0x11ad('0x30')],qs['fields'](_0x120041[_0x11ad('0x2d')][_0x11ad('0x31')]));_0x52e93c[_0x11ad('0x2f')]=_0x52e93c[_0x11ad('0x2f')][_0x11ad('0x32')]?_0x52e93c[_0x11ad('0x2f')]:_0x45c48e[_0x11ad('0x30')];if(!_0x120041[_0x11ad('0x2d')][_0x11ad('0x33')](_0x11ad('0x34'))){_0x52e93c[_0x11ad('0x1d')]=qs[_0x11ad('0x1d')](_0x120041[_0x11ad('0x2d')][_0x11ad('0x1d')]);_0x52e93c[_0x11ad('0x1c')]=qs[_0x11ad('0x1c')](_0x120041[_0x11ad('0x2d')][_0x11ad('0x1c')]);}_0x52e93c['order']=qs[_0x11ad('0x35')](_0x120041['query'][_0x11ad('0x35')]);_0x52e93c['where']=qs[_0x11ad('0x36')](_[_0x11ad('0x37')](_0x120041[_0x11ad('0x2d')],_0x45c48e[_0x11ad('0x36')]),_0x41614c);if(_0x120041[_0x11ad('0x2d')][_0x11ad('0x38')]){_0x52e93c[_0x11ad('0x39')]=_[_0x11ad('0x3a')](_0x52e93c[_0x11ad('0x39')],{'$or':_[_0x11ad('0x28')](_0x41614c,function(_0x1481cf){if(_0x1481cf[_0x11ad('0x2b')]!==_0x11ad('0x3b')){var _0x317d00={};_0x317d00[_0x1481cf[_0x11ad('0x27')]]={'$like':'%'+_0x120041[_0x11ad('0x2d')][_0x11ad('0x38')]+'%'};return _0x317d00;}})});}_0x52e93c=_['merge']({},_0x52e93c,_0x120041[_0x11ad('0x3c')]);var _0x5eb4b0={'where':_0x52e93c[_0x11ad('0x39')]};return db[_0x11ad('0x29')][_0x11ad('0x3d')](_0x5eb4b0)[_0x11ad('0x23')](function(_0x47a51b){_0xbc463e[_0x11ad('0x3d')]=_0x47a51b;if(_0x120041[_0x11ad('0x2d')][_0x11ad('0x3e')]){_0x52e93c[_0x11ad('0x3f')]=[{'all':!![]}];}return db[_0x11ad('0x29')][_0x11ad('0x40')](_0x52e93c);})[_0x11ad('0x23')](function(_0x988eed){_0xbc463e[_0x11ad('0x41')]=_0x988eed;return _0xbc463e;})[_0x11ad('0x23')](respondWithFilteredResult(_0x135e23,_0x52e93c))['catch'](handleError(_0x135e23,null));};exports[_0x11ad('0x42')]=function(_0x3adaaa,_0x34bd86){var _0x37687e={'raw':!![],'where':{'id':_0x3adaaa[_0x11ad('0x43')]['id']}},_0x404bfd={};_0x404bfd[_0x11ad('0x30')]=_[_0x11ad('0x2e')](db[_0x11ad('0x29')][_0x11ad('0x2a')]);_0x404bfd[_0x11ad('0x2d')]=_[_0x11ad('0x2e')](_0x3adaaa['query']);_0x404bfd[_0x11ad('0x36')]=_['intersection'](_0x404bfd[_0x11ad('0x30')],_0x404bfd['query']);_0x37687e[_0x11ad('0x2f')]=_[_0x11ad('0x44')](_0x404bfd[_0x11ad('0x30')],qs[_0x11ad('0x31')](_0x3adaaa[_0x11ad('0x2d')][_0x11ad('0x31')]));_0x37687e['attributes']=_0x37687e[_0x11ad('0x2f')][_0x11ad('0x32')]?_0x37687e['attributes']:_0x404bfd[_0x11ad('0x30')];if(_0x3adaaa[_0x11ad('0x2d')][_0x11ad('0x3e')]){_0x37687e[_0x11ad('0x3f')]=[{'all':!![]}];}_0x37687e=_['merge']({},_0x37687e,_0x3adaaa['options']);return db['VoiceMail'][_0x11ad('0x45')](_0x37687e)['then'](handleEntityNotFound(_0x34bd86,null))['then'](respondWithResult(_0x34bd86,null))['catch'](handleError(_0x34bd86,null));};exports['create']=function(_0x3531c1,_0x42e4d4){return db[_0x11ad('0x29')][_0x11ad('0x46')](_0x3531c1[_0x11ad('0x47')],{})[_0x11ad('0x23')](function(_0x287d89){var _0x382d85=_0x3531c1['user']['get']({'plain':!![]});if(!_0x382d85)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x382d85['role']===_0x11ad('0x48')){var _0x3bd394=_0x287d89[_0x11ad('0x49')]({'plain':!![]});var _0x238ede='Voicemails';return db['UserProfileSection'][_0x11ad('0x45')]({'where':{'name':_0x238ede,'userProfileId':_0x382d85[_0x11ad('0x4a')]},'raw':!![]})['then'](function(_0x2cd9f1){if(_0x2cd9f1&&_0x2cd9f1[_0x11ad('0x4b')]===0x0){return db[_0x11ad('0x4c')][_0x11ad('0x46')]({'name':_0x3bd394[_0x11ad('0x27')],'resourceId':_0x3bd394['id'],'type':_0x2cd9f1[_0x11ad('0x27')],'sectionId':_0x2cd9f1['id']},{})[_0x11ad('0x23')](function(){return _0x287d89;});}else{return _0x287d89;}})[_0x11ad('0x4d')](function(_0x80cba7){logger[_0x11ad('0x25')](_0x11ad('0x4e'),_0x80cba7);throw _0x80cba7;});}return _0x287d89;})['then'](respondWithResult(_0x42e4d4,0xc9))[_0x11ad('0x4d')](handleError(_0x42e4d4,null));};exports[_0x11ad('0x4f')]=function(_0x2add92,_0x40e267){if(_0x2add92[_0x11ad('0x47')]['id']){delete _0x2add92['body']['id'];}return db[_0x11ad('0x29')][_0x11ad('0x45')]({'where':{'id':_0x2add92[_0x11ad('0x43')]['id']}})[_0x11ad('0x23')](handleEntityNotFound(_0x40e267,null))[_0x11ad('0x23')](saveUpdates(_0x2add92[_0x11ad('0x47')],null))['then'](respondWithResult(_0x40e267,null))[_0x11ad('0x4d')](handleError(_0x40e267,null));};exports[_0x11ad('0x22')]=function(_0x59c714,_0x41481d){return db[_0x11ad('0x29')][_0x11ad('0x45')]({'where':{'id':_0x59c714[_0x11ad('0x43')]['id']}})[_0x11ad('0x23')](handleEntityNotFound(_0x41481d,null))[_0x11ad('0x23')](removeEntity(_0x41481d,null))['catch'](handleError(_0x41481d,null));};exports[_0x11ad('0x50')]=function(_0x1ad846,_0x56a3a5,_0x3c668f){return db['VoiceMail'][_0x11ad('0x51')]({'where':{'id':_0x1ad846[_0x11ad('0x43')]['id']}})[_0x11ad('0x23')](handleEntityNotFound(_0x56a3a5,null))[_0x11ad('0x23')](function(_0x48ebc5){var _0x349eb6;var _0x1ea1ad={},_0x6dbeb5={};_0x6dbeb5[_0x11ad('0x30')]=_[_0x11ad('0x2e')](db[_0x11ad('0x52')][_0x11ad('0x2a')]);_0x6dbeb5['query']=_[_0x11ad('0x2e')](_0x1ad846['query']);_0x6dbeb5['filters']=_[_0x11ad('0x44')](_0x6dbeb5[_0x11ad('0x30')],_0x6dbeb5[_0x11ad('0x2d')]);_0x1ea1ad[_0x11ad('0x2f')]=_[_0x11ad('0x44')](_0x6dbeb5[_0x11ad('0x30')],qs[_0x11ad('0x31')](_0x1ad846[_0x11ad('0x2d')][_0x11ad('0x31')]));_0x1ea1ad[_0x11ad('0x2f')]=_0x1ea1ad['attributes'][_0x11ad('0x32')]?_0x1ea1ad['attributes']:_0x6dbeb5[_0x11ad('0x30')];if(!_0x1ad846['query'][_0x11ad('0x33')](_0x11ad('0x34'))){_0x1ea1ad[_0x11ad('0x1d')]=qs[_0x11ad('0x1d')](_0x1ad846[_0x11ad('0x2d')][_0x11ad('0x1d')]);_0x1ea1ad[_0x11ad('0x1c')]=qs['offset'](_0x1ad846[_0x11ad('0x2d')][_0x11ad('0x1c')]);}_0x1ea1ad['order']=qs[_0x11ad('0x35')](_0x1ad846[_0x11ad('0x2d')][_0x11ad('0x35')]);_0x1ea1ad[_0x11ad('0x39')]=qs[_0x11ad('0x36')](_[_0x11ad('0x37')](_0x1ad846[_0x11ad('0x2d')],_0x6dbeb5['filters']));if(_0x1ad846[_0x11ad('0x2d')][_0x11ad('0x38')]){_0x1ea1ad[_0x11ad('0x39')]=_[_0x11ad('0x3a')](_0x1ea1ad[_0x11ad('0x39')],{'$or':_[_0x11ad('0x28')](_0x1ea1ad['attributes'],function(_0x316d89){var _0x1b5493={};_0x1b5493[_0x316d89]={'$like':'%'+_0x1ad846[_0x11ad('0x2d')]['filter']+'%'};return _0x1b5493;})});}_0x1ea1ad[_0x11ad('0x39')]=_[_0x11ad('0x3a')](_0x1ea1ad[_0x11ad('0x39')],{'mailboxuser':_0x48ebc5[_0x11ad('0x53')]});_0x1ea1ad=_[_0x11ad('0x3a')]({},_0x1ea1ad,_0x1ad846[_0x11ad('0x3c')]);return db[_0x11ad('0x52')][_0x11ad('0x54')](_0x1ea1ad)[_0x11ad('0x23')](respondWithFilteredResult(_0x56a3a5,_0x1ea1ad));})[_0x11ad('0x4d')](handleError(_0x56a3a5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 64bfc38..5c16a7a 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 _0x1e44=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash'];(function(_0x20173f,_0x13221e){var _0x529826=function(_0x3c89d6){while(--_0x3c89d6){_0x20173f['push'](_0x20173f['shift']());}};_0x529826(++_0x13221e);}(_0x1e44,0xb3));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41e4('0x0'));var util=require(_0x41e4('0x1'));var logger=require(_0x41e4('0x2'))('api');var moment=require(_0x41e4('0x3'));var BPromise=require(_0x41e4('0x4'));var rp=require(_0x41e4('0x5'));var fs=require('fs');var path=require(_0x41e4('0x6'));var rimraf=require('rimraf');var config=require(_0x41e4('0x7'));var attributes=require(_0x41e4('0x8'));module[_0x41e4('0x9')]=function(_0x2c28d4,_0x10fba1){return _0x2c28d4[_0x41e4('0xa')](_0x41e4('0xb'),attributes,{'tableName':_0x41e4('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x41e4('0xd'),_0x41e4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba07=['api','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger'];(function(_0x4f62cb,_0x4158a2){var _0x46328a=function(_0x4992a1){while(--_0x4992a1){_0x4f62cb['push'](_0x4f62cb['shift']());}};_0x46328a(++_0x4158a2);}(_0xba07,0xfc));var _0x7ba0=function(_0x356f7e,_0x588cbd){_0x356f7e=_0x356f7e-0x0;var _0x3e6563=_0xba07[_0x356f7e];return _0x3e6563;};'use strict';var _=require(_0x7ba0('0x0'));var util=require(_0x7ba0('0x1'));var logger=require(_0x7ba0('0x2'))(_0x7ba0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ba0('0x4'));var fs=require('fs');var path=require(_0x7ba0('0x5'));var rimraf=require(_0x7ba0('0x6'));var config=require(_0x7ba0('0x7'));var attributes=require(_0x7ba0('0x8'));module[_0x7ba0('0x9')]=function(_0x3c5c8c,_0x205652){return _0x3c5c8c[_0x7ba0('0xa')](_0x7ba0('0xb'),attributes,{'tableName':_0x7ba0('0xc'),'paranoid':![],'indexes':[{'name':_0x7ba0('0xd'),'fields':['mailbox',_0x7ba0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 38fd9c9..526cf09 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 _0xf552=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info'];(function(_0x33e4be,_0x53238e){var _0x478402=function(_0x2102e8){while(--_0x2102e8){_0x33e4be['push'](_0x33e4be['shift']());}};_0x478402(++_0x53238e);}(_0xf552,0x153));var _0x2f55=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xf552[_0x13c70c];return _0x50f0f2;};'use strict';var _=require(_0x2f55('0x0'));var util=require(_0x2f55('0x1'));var moment=require(_0x2f55('0x2'));var BPromise=require(_0x2f55('0x3'));var rs=require(_0x2f55('0x4'));var fs=require('fs');var Redis=require(_0x2f55('0x5'));var db=require(_0x2f55('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f55('0x8'));var client=jayson['client'][_0x2f55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0fed,_0x2fadf6,_0x40a07d){return new BPromise(function(_0x392cef,_0x57f759){return client[_0x2f55('0xa')](_0x1a0fed,_0x40a07d)[_0x2f55('0xb')](function(_0x42e8ba){logger[_0x2f55('0xc')](_0x2f55('0xd'),_0x2fadf6,_0x2f55('0xe'));logger[_0x2f55('0xf')](_0x2f55('0x10'),_0x2fadf6,_0x2f55('0xe'),JSON[_0x2f55('0x11')](_0x42e8ba));if(_0x42e8ba[_0x2f55('0x12')]){if(_0x42e8ba[_0x2f55('0x12')]['code']===0x1f4){logger[_0x2f55('0x12')](_0x2f55('0xd'),_0x2fadf6,_0x42e8ba['error'][_0x2f55('0x13')]);return _0x57f759(_0x42e8ba[_0x2f55('0x12')][_0x2f55('0x13')]);}logger[_0x2f55('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2fadf6,_0x42e8ba['error']['message']);return _0x392cef(_0x42e8ba['error'][_0x2f55('0x13')]);}else{logger['info'](_0x2f55('0xd'),_0x2fadf6,'request\x20sent');_0x392cef(_0x42e8ba[_0x2f55('0x14')][_0x2f55('0x13')]);}})[_0x2f55('0x15')](function(_0xabb41c){logger[_0x2f55('0x12')](_0x2f55('0xd'),_0x2fadf6,_0xabb41c);_0x57f759(_0xabb41c);});});} \ No newline at end of file +var _0x5eee=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54ea9c,_0x37bbd0){var _0x1748d4=function(_0x344d7e){while(--_0x344d7e){_0x54ea9c['push'](_0x54ea9c['shift']());}};_0x1748d4(++_0x37bbd0);}(_0x5eee,0x1ad));var _0xe5ee=function(_0x4f462f,_0x1c047d){_0x4f462f=_0x4f462f-0x0;var _0x21aae7=_0x5eee[_0x4f462f];return _0x21aae7;};'use strict';var _=require(_0xe5ee('0x0'));var util=require(_0xe5ee('0x1'));var moment=require(_0xe5ee('0x2'));var BPromise=require(_0xe5ee('0x3'));var rs=require(_0xe5ee('0x4'));var fs=require('fs');var Redis=require(_0xe5ee('0x5'));var db=require(_0xe5ee('0x6'))['db'];var utils=require(_0xe5ee('0x7'));var logger=require(_0xe5ee('0x8'))('rpc');var config=require(_0xe5ee('0x9'));var jayson=require(_0xe5ee('0xa'));var client=jayson[_0xe5ee('0xb')][_0xe5ee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33b54f,_0x4d564e,_0x21f3e4){return new BPromise(function(_0x1f8557,_0x3068d3){return client[_0xe5ee('0xd')](_0x33b54f,_0x21f3e4)[_0xe5ee('0xe')](function(_0x403d37){logger[_0xe5ee('0xf')](_0xe5ee('0x10'),_0x4d564e,_0xe5ee('0x11'));logger[_0xe5ee('0x12')](_0xe5ee('0x13'),_0x4d564e,_0xe5ee('0x11'),JSON[_0xe5ee('0x14')](_0x403d37));if(_0x403d37[_0xe5ee('0x15')]){if(_0x403d37['error']['code']===0x1f4){logger[_0xe5ee('0x15')](_0xe5ee('0x10'),_0x4d564e,_0x403d37[_0xe5ee('0x15')][_0xe5ee('0x16')]);return _0x3068d3(_0x403d37[_0xe5ee('0x15')][_0xe5ee('0x16')]);}logger[_0xe5ee('0x15')](_0xe5ee('0x10'),_0x4d564e,_0x403d37[_0xe5ee('0x15')][_0xe5ee('0x16')]);return _0x1f8557(_0x403d37[_0xe5ee('0x15')][_0xe5ee('0x16')]);}else{logger['info'](_0xe5ee('0x10'),_0x4d564e,_0xe5ee('0x11'));_0x1f8557(_0x403d37[_0xe5ee('0x17')]['message']);}})[_0xe5ee('0x18')](function(_0x28145b){logger['error'](_0xe5ee('0x10'),_0x4d564e,_0x28145b);_0x3068d3(_0x28145b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e6c0468..19d6385 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 _0x1cb9=['../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x170f9d,_0xba5fad){var _0x44d5f5=function(_0x1a165f){while(--_0x1a165f){_0x170f9d['push'](_0x170f9d['shift']());}};_0x44d5f5(++_0xba5fad);}(_0x1cb9,0x14e));var _0x91cb=function(_0x13bbc0,_0x3bd4bc){_0x13bbc0=_0x13bbc0-0x0;var _0x4d94e3=_0x1cb9[_0x13bbc0];return _0x4d94e3;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0x7')]('/:id/download',auth[_0x91cb('0x8')](),controller['download']);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0xd')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['destroy']);module[_0x91cb('0x10')]=router; \ No newline at end of file +var _0xf494=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x2f8214,_0x530f6c){var _0x5b3380=function(_0x18787f){while(--_0x18787f){_0x2f8214['push'](_0x2f8214['shift']());}};_0x5b3380(++_0x530f6c);}(_0xf494,0x1c6));var _0x4f49=function(_0x32b308,_0x2c7f89){_0x32b308=_0x32b308-0x0;var _0x5736d5=_0xf494[_0x32b308];return _0x5736d5;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);router['delete'](_0x4f49('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f49('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c0f5794..c4b2fd8 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 _0xf357=['exports','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x59d60b,_0x5cd6d3){var _0x304a0e=function(_0x3c06bc){while(--_0x3c06bc){_0x59d60b['push'](_0x59d60b['shift']());}};_0x304a0e(++_0x5cd6d3);}(_0xf357,0x1c2));var _0x7f35=function(_0x426776,_0x3abffc){_0x426776=_0x426776-0x0;var _0x2641d8=_0xf357[_0x426776];return _0x2641d8;};'use strict';var Sequelize=require('sequelize');module[_0x7f35('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x390301){return this[_0x7f35('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x7f35('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x7f35('0x4')](_0x7f35('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7f35('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x8b01=['STRING','long','TIMESTAMP','exports','VIRTUAL','INTEGER'];(function(_0x18e9ff,_0x466062){var _0x29d72f=function(_0x492082){while(--_0x492082){_0x18e9ff['push'](_0x18e9ff['shift']());}};_0x29d72f(++_0x466062);}(_0x8b01,0xd5));var _0x18b0=function(_0x53a22c,_0x119487){_0x53a22c=_0x53a22c-0x0;var _0x41fcbf=_0x8b01[_0x53a22c];return _0x41fcbf;};'use strict';var Sequelize=require('sequelize');module[_0x18b0('0x0')]={'name':{'type':Sequelize[_0x18b0('0x1')],'get':function(_0x294c57){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x18b0('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x18b0('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x18b0('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x18b0('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5cf885e..5bf139c 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 _0x878f=['request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','VoiceMailMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','length','include','find','body','catch','update','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x238da4,_0x127bbb){var _0x4b34ee=function(_0x25da00){while(--_0x25da00){_0x238da4['push'](_0x238da4['shift']());}};_0x4b34ee(++_0x127bbb);}(_0x878f,0x173));var _0xf878=function(_0x221092,_0x157f23){_0x221092=_0x221092-0x0;var _0x453372=_0x878f[_0x221092];return _0x453372;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require(_0xf878('0x7'));var util=require(_0xf878('0x8'));var path=require(_0xf878('0x9'));var sox=require(_0xf878('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xe'));var authService=require(_0xf878('0xf'));var qs=require(_0xf878('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x11'));var logger=require(_0xf878('0x12'))('api');var utils=require(_0xf878('0x13'));var config=require('../../config/environment');var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x97c396,_0x339c9c){_0x339c9c=_0x339c9c||0xcc;return function(_0x596fb5){if(_0x596fb5){return _0x97c396[_0xf878('0x15')](_0x339c9c);}return _0x97c396[_0xf878('0x16')](_0x339c9c)[_0xf878('0x17')]();};}function respondWithResult(_0x570dcc,_0xe2c2de){_0xe2c2de=_0xe2c2de||0xc8;return function(_0x3902f7){if(_0x3902f7){return _0x570dcc[_0xf878('0x16')](_0xe2c2de)['json'](_0x3902f7);}};}function respondWithFilteredResult(_0x568a3a,_0x4c0948){return function(_0x35ff2d){if(_0x35ff2d){var _0x31d888=_0x35ff2d[_0xf878('0x18')],_0x6dbeca=_0x4c0948[_0xf878('0x19')],_0x44aacc=_0x4c0948[_0xf878('0x19')]+_0x4c0948[_0xf878('0x1a')],_0x186a02;if(_0x44aacc>=_0x31d888){_0x44aacc=_0x31d888;_0x186a02=0xc8;}else{_0x186a02=0xce;}_0x568a3a[_0xf878('0x16')](_0x186a02);return _0x568a3a['set'](_0xf878('0x1b'),_0x6dbeca+'-'+_0x44aacc+'/'+_0x31d888)[_0xf878('0x1c')](_0x35ff2d);}return null;};}function patchUpdates(_0x412de1){return function(_0x622ea8){try{jsonpatch[_0xf878('0x1d')](_0x622ea8,_0x412de1,!![]);}catch(_0x237d15){return BPromise[_0xf878('0x1e')](_0x237d15);}return _0x622ea8['save']();};}function saveUpdates(_0x73f6bf,_0x140866){return function(_0x250f85){if(_0x250f85){return _0x250f85['update'](_0x73f6bf)[_0xf878('0x1f')](function(_0x23590c){return _0x23590c;});}return null;};}function removeEntity(_0xacc440,_0x392822){return function(_0x22d884){if(_0x22d884){return _0x22d884[_0xf878('0x20')]()[_0xf878('0x1f')](function(){_0xacc440[_0xf878('0x16')](0xcc)[_0xf878('0x17')]();});}};}function handleEntityNotFound(_0x1a6506,_0x45e61f){return function(_0x566995){if(!_0x566995){_0x1a6506[_0xf878('0x15')](0x194);}return _0x566995;};}function handleError(_0x5b0b06,_0xa3d3d3){_0xa3d3d3=_0xa3d3d3||0x1f4;return function(_0x12b32f){logger[_0xf878('0x21')](_0x12b32f[_0xf878('0x22')]);if(_0x12b32f[_0xf878('0x23')]){delete _0x12b32f['name'];}_0x5b0b06['status'](_0xa3d3d3)['send'](_0x12b32f);};}exports[_0xf878('0x24')]=function(_0x3baba4,_0x38fa87){var _0x5af87f={},_0xfa3e11={},_0x2e2256={'count':0x0,'rows':[]};var _0x3e848d=_[_0xf878('0x25')](db[_0xf878('0x26')]['rawAttributes'],function(_0x502322){return{'name':_0x502322[_0xf878('0x27')],'type':_0x502322[_0xf878('0x28')]['key']};});_0xfa3e11[_0xf878('0x29')]=_['differenceBy'](_[_0xf878('0x25')](_0x3e848d,'name'),[_0xf878('0x23')]);_0xfa3e11['query']=_[_0xf878('0x2a')](_0x3baba4['query']);_0xfa3e11[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0xfa3e11[_0xf878('0x29')],_0xfa3e11[_0xf878('0x2d')]);_0x5af87f[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0xfa3e11['model'],qs[_0xf878('0x2f')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x2f')]));_0x5af87f[_0xf878('0x2e')]=_0x5af87f[_0xf878('0x2e')]['length']?_0x5af87f[_0xf878('0x2e')]:_0xfa3e11[_0xf878('0x29')];if(!_0x3baba4['query'][_0xf878('0x30')](_0xf878('0x31'))){_0x5af87f[_0xf878('0x1a')]=qs[_0xf878('0x1a')](_0x3baba4[_0xf878('0x2d')]['limit']);_0x5af87f[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x19')]);}_0x5af87f['order']=qs[_0xf878('0x32')](_0x3baba4['query']['sort']);_0x5af87f[_0xf878('0x33')]=qs[_0xf878('0x2b')](_[_0xf878('0x34')](_0x3baba4[_0xf878('0x2d')],_0xfa3e11[_0xf878('0x2b')]),_0x3e848d);if(_0x3baba4['query'][_0xf878('0x35')]){_0x5af87f['where']=_[_0xf878('0x36')](_0x5af87f[_0xf878('0x33')],{'$or':_['map'](_0x3e848d,function(_0x1489d5){if(_0x1489d5[_0xf878('0x28')]!=='VIRTUAL'){var _0x329f0b={};_0x329f0b[_0x1489d5[_0xf878('0x23')]]={'$like':'%'+_0x3baba4['query'][_0xf878('0x35')]+'%'};return _0x329f0b;}})});}_0x5af87f=_[_0xf878('0x36')]({},_0x5af87f,_0x3baba4[_0xf878('0x37')]);var _0xc8eb91={'where':_0x5af87f[_0xf878('0x33')]};return db[_0xf878('0x26')][_0xf878('0x18')](_0xc8eb91)['then'](function(_0x1179fb){_0x2e2256[_0xf878('0x18')]=_0x1179fb;if(_0x3baba4['query'][_0xf878('0x38')]){_0x5af87f['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf878('0x39')](_0x5af87f);})[_0xf878('0x1f')](function(_0x43b03e){_0x2e2256[_0xf878('0x3a')]=_0x43b03e;return _0x2e2256;})[_0xf878('0x1f')](respondWithFilteredResult(_0x38fa87,_0x5af87f))['catch'](handleError(_0x38fa87,null));};exports[_0xf878('0x3b')]=function(_0x4c4ae4,_0xb09736){var _0x2801b0={'raw':!![],'where':{'id':_0x4c4ae4['params']['id']}},_0x4f6be1={};_0x4f6be1[_0xf878('0x29')]=_[_0xf878('0x2a')](db[_0xf878('0x26')][_0xf878('0x3c')]);_0x4f6be1[_0xf878('0x2d')]=_[_0xf878('0x2a')](_0x4c4ae4[_0xf878('0x2d')]);_0x4f6be1[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0x4f6be1['model'],_0x4f6be1[_0xf878('0x2d')]);_0x2801b0[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0x4f6be1[_0xf878('0x29')],qs[_0xf878('0x2f')](_0x4c4ae4[_0xf878('0x2d')]['fields']));_0x2801b0[_0xf878('0x2e')]=_0x2801b0[_0xf878('0x2e')][_0xf878('0x3d')]?_0x2801b0[_0xf878('0x2e')]:_0x4f6be1[_0xf878('0x29')];if(_0x4c4ae4['query'][_0xf878('0x38')]){_0x2801b0[_0xf878('0x3e')]=[{'all':!![]}];}_0x2801b0=_[_0xf878('0x36')]({},_0x2801b0,_0x4c4ae4[_0xf878('0x37')]);return db['VoiceMailMessage'][_0xf878('0x3f')](_0x2801b0)[_0xf878('0x1f')](handleEntityNotFound(_0xb09736,null))[_0xf878('0x1f')](respondWithResult(_0xb09736,null))['catch'](handleError(_0xb09736,null));};exports['create']=function(_0x9c2fa3,_0x5bf396){return db['VoiceMailMessage']['create'](_0x9c2fa3[_0xf878('0x40')],{})['then'](respondWithResult(_0x5bf396,0xc9))[_0xf878('0x41')](handleError(_0x5bf396,null));};exports[_0xf878('0x42')]=function(_0x1dcb19,_0x1ff60b){if(_0x1dcb19[_0xf878('0x40')]['id']){delete _0x1dcb19[_0xf878('0x40')]['id'];}return db[_0xf878('0x26')]['find']({'where':{'id':_0x1dcb19[_0xf878('0x43')]['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x1ff60b,null))[_0xf878('0x1f')](saveUpdates(_0x1dcb19[_0xf878('0x40')],null))[_0xf878('0x1f')](respondWithResult(_0x1ff60b,null))['catch'](handleError(_0x1ff60b,null));};exports['destroy']=function(_0xb4f8fb,_0x18c9dc){return db['VoiceMailMessage'][_0xf878('0x3f')]({'where':{'id':_0xb4f8fb['params']['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x18c9dc,null))[_0xf878('0x1f')](removeEntity(_0x18c9dc,null))[_0xf878('0x41')](handleError(_0x18c9dc,null));};exports[_0xf878('0x44')]=function(_0x5411c2,_0xf0d960,_0xd8fbc9){return db[_0xf878('0x26')]['find']({'where':{'id':_0x5411c2[_0xf878('0x43')]['id']},'attributes':['id',_0xf878('0x45'),_0xf878('0x46')]})[_0xf878('0x1f')](handleEntityNotFound(_0xf0d960,null))['then'](function(_0x112f2a){if(_0x112f2a){if(!_0x112f2a[_0xf878('0x45')]){throw new db[(_0xf878('0x47'))]['ValidationError'](_0xf878('0x48'));}var _0xdfa29b={'Content-Type':_0xf878('0x49'),'Content-Disposition':_0xf878('0x4a')};if(_0x112f2a['msg_id']){_0xdfa29b['Content-Disposition']='attachment;\x20filename=\x22'+_0x112f2a[_0xf878('0x46')]+'.wav\x22';}_0xf0d960['set'](_0xdfa29b);return _0xf0d960['send'](new Buffer(_0x112f2a[_0xf878('0x45')]));}})[_0xf878('0x41')](handleError(_0xf0d960,null));}; \ No newline at end of file +var _0xc36d=['then','destroy','error','stack','name','send','index','map','rawAttributes','type','query','keys','intersection','model','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMailMessage','rows','show','params','length','catch','create','body','find','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x57408b,_0xb7cbc5){var _0x31a897=function(_0x5810ac){while(--_0x5810ac){_0x57408b['push'](_0x57408b['shift']());}};_0x31a897(++_0xb7cbc5);}(_0xc36d,0x7d));var _0xdc36=function(_0x111311,_0x1e2f69){_0x111311=_0x111311-0x0;var _0x4cef39=_0xc36d[_0x111311];return _0x4cef39;};'use strict';var pdf=require(_0xdc36('0x0'));var emlformat=require(_0xdc36('0x1'));var rimraf=require(_0xdc36('0x2'));var zipdir=require(_0xdc36('0x3'));var jsonpatch=require(_0xdc36('0x4'));var rp=require(_0xdc36('0x5'));var moment=require('moment');var BPromise=require(_0xdc36('0x6'));var Mustache=require(_0xdc36('0x7'));var util=require('util');var path=require(_0xdc36('0x8'));var sox=require(_0xdc36('0x9'));var csv=require(_0xdc36('0xa'));var ejs=require(_0xdc36('0xb'));var fs=require('fs');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('0xa'));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 db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3107bc,_0x276692){_0x276692=_0x276692||0xcc;return function(_0x519fa5){if(_0x519fa5){return _0x3107bc[_0xdc36('0x17')](_0x276692);}return _0x3107bc['status'](_0x276692)[_0xdc36('0x18')]();};}function respondWithResult(_0x3d36bc,_0x243d54){_0x243d54=_0x243d54||0xc8;return function(_0xae6ad3){if(_0xae6ad3){return _0x3d36bc[_0xdc36('0x19')](_0x243d54)[_0xdc36('0x1a')](_0xae6ad3);}};}function respondWithFilteredResult(_0x37ce9c,_0x809cf0){return function(_0x57ebde){if(_0x57ebde){var _0x155cce=_0x57ebde[_0xdc36('0x1b')],_0x526ac8=_0x809cf0[_0xdc36('0x1c')],_0x4baf2e=_0x809cf0['offset']+_0x809cf0[_0xdc36('0x1d')],_0x59c88f;if(_0x4baf2e>=_0x155cce){_0x4baf2e=_0x155cce;_0x59c88f=0xc8;}else{_0x59c88f=0xce;}_0x37ce9c[_0xdc36('0x19')](_0x59c88f);return _0x37ce9c[_0xdc36('0x1e')](_0xdc36('0x1f'),_0x526ac8+'-'+_0x4baf2e+'/'+_0x155cce)[_0xdc36('0x1a')](_0x57ebde);}return null;};}function patchUpdates(_0x46783d){return function(_0x59ee8e){try{jsonpatch[_0xdc36('0x20')](_0x59ee8e,_0x46783d,!![]);}catch(_0x12d4bf){return BPromise['reject'](_0x12d4bf);}return _0x59ee8e[_0xdc36('0x21')]();};}function saveUpdates(_0x197924,_0x3f25f0){return function(_0x5f15ef){if(_0x5f15ef){return _0x5f15ef[_0xdc36('0x22')](_0x197924)[_0xdc36('0x23')](function(_0x5b9891){return _0x5b9891;});}return null;};}function removeEntity(_0x388b1a,_0x480277){return function(_0x5a6e35){if(_0x5a6e35){return _0x5a6e35[_0xdc36('0x24')]()[_0xdc36('0x23')](function(){_0x388b1a[_0xdc36('0x19')](0xcc)[_0xdc36('0x18')]();});}};}function handleEntityNotFound(_0x2d83c0,_0x34d261){return function(_0x14b595){if(!_0x14b595){_0x2d83c0[_0xdc36('0x17')](0x194);}return _0x14b595;};}function handleError(_0x57b9f7,_0x34057e){_0x34057e=_0x34057e||0x1f4;return function(_0x4ea580){logger[_0xdc36('0x25')](_0x4ea580[_0xdc36('0x26')]);if(_0x4ea580[_0xdc36('0x27')]){delete _0x4ea580['name'];}_0x57b9f7[_0xdc36('0x19')](_0x34057e)[_0xdc36('0x28')](_0x4ea580);};}exports[_0xdc36('0x29')]=function(_0x525935,_0x28a005){var _0x2f3b6a={},_0x2a596d={},_0x5f3b20={'count':0x0,'rows':[]};var _0x3c39e3=_[_0xdc36('0x2a')](db['VoiceMailMessage'][_0xdc36('0x2b')],function(_0x12fed2){return{'name':_0x12fed2['fieldName'],'type':_0x12fed2[_0xdc36('0x2c')]['key']};});_0x2a596d['model']=_['differenceBy'](_[_0xdc36('0x2a')](_0x3c39e3,_0xdc36('0x27')),['name']);_0x2a596d[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x525935[_0xdc36('0x2d')]);_0x2a596d['filters']=_[_0xdc36('0x2f')](_0x2a596d[_0xdc36('0x30')],_0x2a596d[_0xdc36('0x2d')]);_0x2f3b6a[_0xdc36('0x31')]=_[_0xdc36('0x2f')](_0x2a596d[_0xdc36('0x30')],qs[_0xdc36('0x32')](_0x525935['query'][_0xdc36('0x32')]));_0x2f3b6a[_0xdc36('0x31')]=_0x2f3b6a['attributes']['length']?_0x2f3b6a[_0xdc36('0x31')]:_0x2a596d[_0xdc36('0x30')];if(!_0x525935[_0xdc36('0x2d')]['hasOwnProperty']('nolimit')){_0x2f3b6a[_0xdc36('0x1d')]=qs[_0xdc36('0x1d')](_0x525935[_0xdc36('0x2d')][_0xdc36('0x1d')]);_0x2f3b6a[_0xdc36('0x1c')]=qs[_0xdc36('0x1c')](_0x525935[_0xdc36('0x2d')][_0xdc36('0x1c')]);}_0x2f3b6a[_0xdc36('0x33')]=qs[_0xdc36('0x34')](_0x525935[_0xdc36('0x2d')]['sort']);_0x2f3b6a[_0xdc36('0x35')]=qs[_0xdc36('0x36')](_[_0xdc36('0x37')](_0x525935[_0xdc36('0x2d')],_0x2a596d['filters']),_0x3c39e3);if(_0x525935[_0xdc36('0x2d')][_0xdc36('0x38')]){_0x2f3b6a[_0xdc36('0x35')]=_[_0xdc36('0x39')](_0x2f3b6a['where'],{'$or':_[_0xdc36('0x2a')](_0x3c39e3,function(_0x54c833){if(_0x54c833['type']!==_0xdc36('0x3a')){var _0x169c1e={};_0x169c1e[_0x54c833[_0xdc36('0x27')]]={'$like':'%'+_0x525935['query'][_0xdc36('0x38')]+'%'};return _0x169c1e;}})});}_0x2f3b6a=_['merge']({},_0x2f3b6a,_0x525935[_0xdc36('0x3b')]);var _0x34f6be={'where':_0x2f3b6a[_0xdc36('0x35')]};return db['VoiceMailMessage'][_0xdc36('0x1b')](_0x34f6be)[_0xdc36('0x23')](function(_0xd98d42){_0x5f3b20[_0xdc36('0x1b')]=_0xd98d42;if(_0x525935['query'][_0xdc36('0x3c')]){_0x2f3b6a[_0xdc36('0x3d')]=[{'all':!![]}];}return db[_0xdc36('0x3e')]['findAll'](_0x2f3b6a);})['then'](function(_0x2cefcf){_0x5f3b20[_0xdc36('0x3f')]=_0x2cefcf;return _0x5f3b20;})['then'](respondWithFilteredResult(_0x28a005,_0x2f3b6a))['catch'](handleError(_0x28a005,null));};exports[_0xdc36('0x40')]=function(_0x8f4c80,_0x6cc2ff){var _0x1c0a6c={'raw':!![],'where':{'id':_0x8f4c80[_0xdc36('0x41')]['id']}},_0x26fb8c={};_0x26fb8c[_0xdc36('0x30')]=_[_0xdc36('0x2e')](db[_0xdc36('0x3e')][_0xdc36('0x2b')]);_0x26fb8c[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x8f4c80[_0xdc36('0x2d')]);_0x26fb8c[_0xdc36('0x36')]=_[_0xdc36('0x2f')](_0x26fb8c[_0xdc36('0x30')],_0x26fb8c[_0xdc36('0x2d')]);_0x1c0a6c[_0xdc36('0x31')]=_[_0xdc36('0x2f')](_0x26fb8c[_0xdc36('0x30')],qs[_0xdc36('0x32')](_0x8f4c80[_0xdc36('0x2d')][_0xdc36('0x32')]));_0x1c0a6c[_0xdc36('0x31')]=_0x1c0a6c[_0xdc36('0x31')][_0xdc36('0x42')]?_0x1c0a6c['attributes']:_0x26fb8c[_0xdc36('0x30')];if(_0x8f4c80[_0xdc36('0x2d')]['includeAll']){_0x1c0a6c['include']=[{'all':!![]}];}_0x1c0a6c=_[_0xdc36('0x39')]({},_0x1c0a6c,_0x8f4c80['options']);return db[_0xdc36('0x3e')]['find'](_0x1c0a6c)[_0xdc36('0x23')](handleEntityNotFound(_0x6cc2ff,null))[_0xdc36('0x23')](respondWithResult(_0x6cc2ff,null))[_0xdc36('0x43')](handleError(_0x6cc2ff,null));};exports[_0xdc36('0x44')]=function(_0x34af88,_0x244617){return db[_0xdc36('0x3e')][_0xdc36('0x44')](_0x34af88[_0xdc36('0x45')],{})[_0xdc36('0x23')](respondWithResult(_0x244617,0xc9))[_0xdc36('0x43')](handleError(_0x244617,null));};exports[_0xdc36('0x22')]=function(_0x5cd3d5,_0x10d865){if(_0x5cd3d5[_0xdc36('0x45')]['id']){delete _0x5cd3d5[_0xdc36('0x45')]['id'];}return db[_0xdc36('0x3e')][_0xdc36('0x46')]({'where':{'id':_0x5cd3d5['params']['id']}})['then'](handleEntityNotFound(_0x10d865,null))[_0xdc36('0x23')](saveUpdates(_0x5cd3d5[_0xdc36('0x45')],null))[_0xdc36('0x23')](respondWithResult(_0x10d865,null))[_0xdc36('0x43')](handleError(_0x10d865,null));};exports[_0xdc36('0x24')]=function(_0x1efba5,_0x5ade8b){return db[_0xdc36('0x3e')][_0xdc36('0x46')]({'where':{'id':_0x1efba5[_0xdc36('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ade8b,null))[_0xdc36('0x23')](removeEntity(_0x5ade8b,null))[_0xdc36('0x43')](handleError(_0x5ade8b,null));};exports[_0xdc36('0x47')]=function(_0xa07e3f,_0x3bfc00,_0x2b1b9b){return db['VoiceMailMessage'][_0xdc36('0x46')]({'where':{'id':_0xa07e3f[_0xdc36('0x41')]['id']},'attributes':['id',_0xdc36('0x48'),_0xdc36('0x49')]})[_0xdc36('0x23')](handleEntityNotFound(_0x3bfc00,null))[_0xdc36('0x23')](function(_0x26775a){if(_0x26775a){if(!_0x26775a[_0xdc36('0x48')]){throw new db['Sequelize'][(_0xdc36('0x4a'))](_0xdc36('0x4b'));}var _0xfeec40={'Content-Type':_0xdc36('0x4c'),'Content-Disposition':_0xdc36('0x4d')};if(_0x26775a[_0xdc36('0x49')]){_0xfeec40[_0xdc36('0x4e')]=_0xdc36('0x4f')+_0x26775a['msg_id']+'.wav\x22';}_0x3bfc00[_0xdc36('0x1e')](_0xfeec40);return _0x3bfc00[_0xdc36('0x28')](new Buffer(_0x26775a['recording']));}})[_0xdc36('0x43')](handleError(_0x3bfc00,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 06b811e..1c5a6a9 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 _0x5eb7=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x239930,_0x592423){var _0x37ec83=function(_0x2633dd){while(--_0x2633dd){_0x239930['push'](_0x239930['shift']());}};_0x37ec83(++_0x592423);}(_0x5eb7,0x176));var _0x75eb=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x5eb7[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x75eb('0x0'));var util=require(_0x75eb('0x1'));var logger=require(_0x75eb('0x2'))(_0x75eb('0x3'));var moment=require(_0x75eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75eb('0x5'));var rimraf=require('rimraf');var config=require(_0x75eb('0x6'));var attributes=require(_0x75eb('0x7'));module[_0x75eb('0x8')]=function(_0x3d9ac2,_0x47bd1e){return _0x3d9ac2['define'](_0x75eb('0x9'),attributes,{'tableName':_0x75eb('0xa'),'paranoid':![],'indexes':[{'name':_0x75eb('0xb'),'fields':[_0x75eb('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5bd1=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','lodash','util','../../config/logger'];(function(_0x2e5633,_0x1cfb12){var _0x4ad2e8=function(_0x6c15d4){while(--_0x6c15d4){_0x2e5633['push'](_0x2e5633['shift']());}};_0x4ad2e8(++_0x1cfb12);}(_0x5bd1,0x14d));var _0x15bd=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x5bd1[_0x60df74];return _0x5ee872;};'use strict';var _=require(_0x15bd('0x0'));var util=require(_0x15bd('0x1'));var logger=require(_0x15bd('0x2'))(_0x15bd('0x3'));var moment=require(_0x15bd('0x4'));var BPromise=require('bluebird');var rp=require(_0x15bd('0x5'));var fs=require('fs');var path=require(_0x15bd('0x6'));var rimraf=require(_0x15bd('0x7'));var config=require(_0x15bd('0x8'));var attributes=require(_0x15bd('0x9'));module[_0x15bd('0xa')]=function(_0x1be285,_0x144037){return _0x1be285[_0x15bd('0xb')](_0x15bd('0xc'),attributes,{'tableName':_0x15bd('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0849af5..77bcf77 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 _0x7a54=['info','VoiceMailMessage,\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(_0xfd562c,_0xb8d760){_0xfd562c=_0xfd562c-0x0;var _0x1214ce=_0x7a54[_0xfd562c];return _0x1214ce;};'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')]('VoiceMailMessage,\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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x26e859,_0x506739){var _0x2f2c52=function(_0x1f9987){while(--_0x1f9987){_0x26e859['push'](_0x26e859['shift']());}};_0x2f2c52(++_0x506739);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'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')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5fa8e6c..8355daa 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 _0x813a=['put','update','delete','/:id','destroy','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','getSounds','post','create','addSound'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x813a,0xaf));var _0xa813=function(_0x4f8be7,_0x351f84){_0x4f8be7=_0x4f8be7-0x0;var _0x3aecdd=_0x813a[_0x4f8be7];return _0x3aecdd;};'use strict';var multer=require(_0xa813('0x0'));var util=require(_0xa813('0x1'));var path=require('path');var timeout=require(_0xa813('0x2'));var express=require(_0xa813('0x3'));var router=express[_0xa813('0x4')]();var auth=require(_0xa813('0x5'));var interaction=require(_0xa813('0x6'));var config=require(_0xa813('0x7'));var controller=require(_0xa813('0x8'));router[_0xa813('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa813('0x9')]('/:id',auth[_0xa813('0xa')](),controller[_0xa813('0xb')]);router['get'](_0xa813('0xc'),auth[_0xa813('0xa')](),controller[_0xa813('0xd')]);router[_0xa813('0xe')]('/',auth[_0xa813('0xa')](),controller[_0xa813('0xf')]);router[_0xa813('0xe')](_0xa813('0xc'),auth[_0xa813('0xa')](),controller[_0xa813('0x10')]);router[_0xa813('0x11')]('/:id',auth[_0xa813('0xa')](),controller[_0xa813('0x12')]);router[_0xa813('0x13')](_0xa813('0x14'),auth[_0xa813('0xa')](),controller[_0xa813('0x15')]);router[_0xa813('0x13')]('/:id/sounds/:id2',auth[_0xa813('0xa')](),controller[_0xa813('0x16')]);module[_0xa813('0x17')]=router; \ No newline at end of file +var _0x8d85=['../../config/environment','./voiceMusicOnHold.controller','index','/:id','isAuthenticated','show','get','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8d85,0x171));var _0x58d8=function(_0x183e0b,_0x1aeaf3){_0x183e0b=_0x183e0b-0x0;var _0x1adadc=_0x8d85[_0x183e0b];return _0x1adadc;};'use strict';var multer=require('multer');var util=require(_0x58d8('0x0'));var path=require('path');var timeout=require(_0x58d8('0x1'));var express=require(_0x58d8('0x2'));var router=express[_0x58d8('0x3')]();var auth=require(_0x58d8('0x4'));var interaction=require(_0x58d8('0x5'));var config=require(_0x58d8('0x6'));var controller=require(_0x58d8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x58d8('0x8')]);router['get'](_0x58d8('0x9'),auth[_0x58d8('0xa')](),controller[_0x58d8('0xb')]);router[_0x58d8('0xc')](_0x58d8('0xd'),auth[_0x58d8('0xa')](),controller[_0x58d8('0xe')]);router[_0x58d8('0xf')]('/',auth[_0x58d8('0xa')](),controller[_0x58d8('0x10')]);router[_0x58d8('0xf')](_0x58d8('0xd'),auth['isAuthenticated'](),controller[_0x58d8('0x11')]);router[_0x58d8('0x12')](_0x58d8('0x9'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x13')]);router[_0x58d8('0x14')](_0x58d8('0x9'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x15')]);router[_0x58d8('0x14')](_0x58d8('0x16'),auth[_0x58d8('0xa')](),controller[_0x58d8('0x17')]);module[_0x58d8('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c747ed2..7bd961a 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 _0x0734=['quietmp3nb','mp3','STRING','alpha','BOOLEAN','ENUM','custom','files','mp3nb'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0734,0xd4));var _0x4073=function(_0x37bad6,_0x4014fe){_0x37bad6=_0x37bad6-0x0;var _0x5c7778=_0x0734[_0x37bad6];return _0x5c7778;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x4073('0x0')](_0x4073('0x1'),_0x4073('0x2'),_0x4073('0x3'),_0x4073('0x4'),'quietmp3',_0x4073('0x5')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x4073('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0x4073('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4073('0x6')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4073('0x7')},'format':{'type':Sequelize[_0x4073('0x6')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x4073('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xedd3=['sequelize','exports','STRING','name','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x459710,_0x4a08a8){var _0x262d4f=function(_0x23e070){while(--_0x23e070){_0x459710['push'](_0x459710['shift']());}};_0x262d4f(++_0x4a08a8);}(_0xedd3,0xd8));var _0x3edd=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xedd3[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0x3edd('0x0'));module[_0x3edd('0x1')]={'name':{'type':Sequelize[_0x3edd('0x2')],'allowNull':![],'unique':_0x3edd('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x3edd('0x4'),_0x3edd('0x5'),_0x3edd('0x6'),_0x3edd('0x7'),_0x3edd('0x8')),'allowNull':!![],'defaultValue':_0x3edd('0x4')},'directory':{'type':Sequelize[_0x3edd('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x3edd('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x3edd('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3edd('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x3edd('0xa')},'defaultEntry':{'type':Sequelize[_0x3edd('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 836efb5..121f484 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 _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x48dea8,_0x49af68){var _0x257ecd=function(_0x288b04){while(--_0x288b04){_0x48dea8['push'](_0x48dea8['shift']());}};_0x257ecd(++_0x49af68);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +var _0x5f2f=['getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0xc6eb3,_0x6fff2a){var _0x3d2bc7=function(_0xc941c5){while(--_0xc941c5){_0xc6eb3['push'](_0xc6eb3['shift']());}};_0x3d2bc7(++_0x6fff2a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c4bf2,_0xe2c323){_0x2c4bf2=_0x2c4bf2-0x0;var _0x2000d=_0x5f2f[_0x2c4bf2];return _0x2000d;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ff09ca0..f700dae 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 _0xf0f1=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf0f1,0x1be));var _0x1f0f=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xf0f1[_0x34d346];return _0x122d76;};'use strict';var _=require(_0x1f0f('0x0'));var util=require(_0x1f0f('0x1'));var logger=require(_0x1f0f('0x2'))(_0x1f0f('0x3'));var moment=require('moment');var BPromise=require(_0x1f0f('0x4'));var rp=require(_0x1f0f('0x5'));var fs=require('fs');var path=require(_0x1f0f('0x6'));var rimraf=require(_0x1f0f('0x7'));var config=require(_0x1f0f('0x8'));var attributes=require(_0x1f0f('0x9'));module[_0x1f0f('0xa')]=function(_0x132df6,_0xf39cc6){return _0x132df6[_0x1f0f('0xb')](_0x1f0f('0xc'),attributes,{'tableName':_0x1f0f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabd0=['rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xabd0,0xf7));var _0x0abd=function(_0x379573,_0x4e1876){_0x379573=_0x379573-0x0;var _0x8b2d32=_0xabd0[_0x379573];return _0x8b2d32;};'use strict';var _=require(_0x0abd('0x0'));var util=require(_0x0abd('0x1'));var logger=require(_0x0abd('0x2'))(_0x0abd('0x3'));var moment=require(_0x0abd('0x4'));var BPromise=require('bluebird');var rp=require(_0x0abd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0abd('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x0abd('0x7')]=function(_0x9365fb,_0x51a483){return _0x9365fb[_0x0abd('0x8')](_0x0abd('0x9'),attributes,{'tableName':_0x0abd('0xa'),'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 f5c035c..a24c5df 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 _0x5790=['../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5beeeb,_0x1e93f8){var _0x595f77=function(_0x281a87){while(--_0x281a87){_0x5beeeb['push'](_0x5beeeb['shift']());}};_0x595f77(++_0x1e93f8);}(_0x5790,0x126));var _0x0579=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5790[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x0579('0x0'));var util=require(_0x0579('0x1'));var moment=require(_0x0579('0x2'));var BPromise=require(_0x0579('0x3'));var rs=require(_0x0579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0579('0x5'))['db'];var utils=require(_0x0579('0x6'));var logger=require('../../config/logger')(_0x0579('0x7'));var config=require(_0x0579('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0579('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4da501,_0x5eed29,_0x24e9e9){return new BPromise(function(_0x1596ab,_0x25faf8){return client[_0x0579('0xa')](_0x4da501,_0x24e9e9)[_0x0579('0xb')](function(_0x1207d1){logger[_0x0579('0xc')](_0x0579('0xd'),_0x5eed29,'request\x20sent');logger[_0x0579('0xe')](_0x0579('0xf'),_0x5eed29,_0x0579('0x10'),JSON['stringify'](_0x1207d1));if(_0x1207d1[_0x0579('0x11')]){if(_0x1207d1[_0x0579('0x11')][_0x0579('0x12')]===0x1f4){logger[_0x0579('0x11')](_0x0579('0xd'),_0x5eed29,_0x1207d1[_0x0579('0x11')][_0x0579('0x13')]);return _0x25faf8(_0x1207d1[_0x0579('0x11')][_0x0579('0x13')]);}logger[_0x0579('0x11')](_0x0579('0xd'),_0x5eed29,_0x1207d1[_0x0579('0x11')][_0x0579('0x13')]);return _0x1596ab(_0x1207d1['error'][_0x0579('0x13')]);}else{logger['info'](_0x0579('0xd'),_0x5eed29,_0x0579('0x10'));_0x1596ab(_0x1207d1['result'][_0x0579('0x13')]);}})['catch'](function(_0x29d1b3){logger[_0x0579('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5eed29,_0x29d1b3);_0x25faf8(_0x29d1b3);});});} \ No newline at end of file +var _0x3b27=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13ce29,_0x35bdcd){var _0x522600=function(_0x5aeb3c){while(--_0x5aeb3c){_0x13ce29['push'](_0x13ce29['shift']());}};_0x522600(++_0x35bdcd);}(_0x3b27,0xbb));var _0x73b2=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x3b27[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x73b2('0x0'));var util=require('util');var moment=require(_0x73b2('0x1'));var BPromise=require(_0x73b2('0x2'));var rs=require(_0x73b2('0x3'));var fs=require('fs');var Redis=require(_0x73b2('0x4'));var db=require(_0x73b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73b2('0x6'))(_0x73b2('0x7'));var config=require(_0x73b2('0x8'));var jayson=require(_0x73b2('0x9'));var client=jayson[_0x73b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29145e,_0x5773a6,_0x1341c2){return new BPromise(function(_0x4b9d34,_0x1bac26){return client[_0x73b2('0xb')](_0x29145e,_0x1341c2)[_0x73b2('0xc')](function(_0x2cc040){logger['info'](_0x73b2('0xd'),_0x5773a6,_0x73b2('0xe'));logger[_0x73b2('0xf')](_0x73b2('0x10'),_0x5773a6,_0x73b2('0xe'),JSON[_0x73b2('0x11')](_0x2cc040));if(_0x2cc040[_0x73b2('0x12')]){if(_0x2cc040['error'][_0x73b2('0x13')]===0x1f4){logger[_0x73b2('0x12')](_0x73b2('0xd'),_0x5773a6,_0x2cc040[_0x73b2('0x12')][_0x73b2('0x14')]);return _0x1bac26(_0x2cc040[_0x73b2('0x12')][_0x73b2('0x14')]);}logger[_0x73b2('0x12')](_0x73b2('0xd'),_0x5773a6,_0x2cc040[_0x73b2('0x12')][_0x73b2('0x14')]);return _0x4b9d34(_0x2cc040[_0x73b2('0x12')][_0x73b2('0x14')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5773a6,_0x73b2('0xe'));_0x4b9d34(_0x2cc040[_0x73b2('0x15')][_0x73b2('0x14')]);}})[_0x73b2('0x16')](function(_0x54be16){logger[_0x73b2('0x12')](_0x73b2('0xd'),_0x5773a6,_0x54be16);_0x1bac26(_0x54be16);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index d2ec48b..e924c17 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 _0xc047=['update','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id/users','getAgents','create','post','put'];(function(_0xfa44b8,_0x3e6c66){var _0x20dcad=function(_0x19c420){while(--_0x19c420){_0xfa44b8['push'](_0xfa44b8['shift']());}};_0x20dcad(++_0x3e6c66);}(_0xc047,0xf8));var _0x7c04=function(_0x1f5693,_0x3140c9){_0x1f5693=_0x1f5693-0x0;var _0x39de53=_0xc047[_0x1f5693];return _0x39de53;};'use strict';var multer=require(_0x7c04('0x0'));var util=require(_0x7c04('0x1'));var path=require(_0x7c04('0x2'));var timeout=require(_0x7c04('0x3'));var express=require(_0x7c04('0x4'));var router=express[_0x7c04('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c04('0x6'));router[_0x7c04('0x7')]('/',auth[_0x7c04('0x8')](),controller['index']);router[_0x7c04('0x7')](_0x7c04('0x9'),auth[_0x7c04('0x8')](),controller[_0x7c04('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x7c04('0xb'),auth[_0x7c04('0x8')](),controller[_0x7c04('0xc')]);router['post']('/',auth[_0x7c04('0x8')](),controller[_0x7c04('0xd')]);router[_0x7c04('0xe')](_0x7c04('0xb'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7c04('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7c04('0x10')]);router[_0x7c04('0x11')](_0x7c04('0x12'),auth[_0x7c04('0x8')](),controller[_0x7c04('0x13')]);router['delete'](_0x7c04('0xb'),auth[_0x7c04('0x8')](),controller[_0x7c04('0x14')]);module[_0x7c04('0x15')]=router; \ No newline at end of file +var _0x68de=['express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/:id','show','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path'];(function(_0x1553c1,_0x442dc0){var _0x3a5e5a=function(_0x4a1527){while(--_0x4a1527){_0x1553c1['push'](_0x1553c1['shift']());}};_0x3a5e5a(++_0x442dc0);}(_0x68de,0xfa));var _0xe68d=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x68de[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0xe68d('0x0'));var util=require(_0xe68d('0x1'));var path=require(_0xe68d('0x2'));var timeout=require('connect-timeout');var express=require(_0xe68d('0x3'));var router=express[_0xe68d('0x4')]();var auth=require(_0xe68d('0x5'));var interaction=require(_0xe68d('0x6'));var config=require('../../config/environment');var controller=require(_0xe68d('0x7'));router[_0xe68d('0x8')]('/',auth[_0xe68d('0x9')](),controller[_0xe68d('0xa')]);router[_0xe68d('0x8')]('/describe',auth[_0xe68d('0x9')](),controller['describe']);router[_0xe68d('0x8')](_0xe68d('0xb'),auth[_0xe68d('0x9')](),controller[_0xe68d('0xc')]);router[_0xe68d('0x8')](_0xe68d('0xd'),auth['isAuthenticated'](),controller[_0xe68d('0xe')]);router[_0xe68d('0xf')]('/',auth[_0xe68d('0x9')](),controller['create']);router[_0xe68d('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0xe68d('0x10')]);router[_0xe68d('0x11')](_0xe68d('0xb'),auth['isAuthenticated'](),controller[_0xe68d('0x12')]);router['delete'](_0xe68d('0xb'),auth[_0xe68d('0x9')](),controller[_0xe68d('0x13')]);router[_0xe68d('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xe68d('0x15')]);module[_0xe68d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 75a6eb1..5ba78f1 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 _0x2f68=['name','VIRTUAL','system-','INTEGER','exports','STRING'];(function(_0x359209,_0x5089d5){var _0x50daf8=function(_0x53ba5e){while(--_0x53ba5e){_0x359209['push'](_0x359209['shift']());}};_0x50daf8(++_0x5089d5);}(_0x2f68,0x9a));var _0x82f6=function(_0x583f9e,_0x1b60a2){_0x583f9e=_0x583f9e-0x0;var _0x3e2a17=_0x2f68[_0x583f9e];return _0x3e2a17;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'name':{'type':Sequelize[_0x82f6('0x1')],'allowNull':![],'unique':_0x82f6('0x2')},'prefix':{'type':Sequelize[_0x82f6('0x3')],'get':function(_0x4be334){return _0x82f6('0x4')+this['getDataValue'](_0x82f6('0x2'))+'-';}},'description':{'type':Sequelize[_0x82f6('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x82f6('0x5')]}}; \ No newline at end of file +var _0x2334=['getDataValue','exports','STRING','name','system-'];(function(_0x29b668,_0x30bacd){var _0x26e948=function(_0x169721){while(--_0x169721){_0x29b668['push'](_0x29b668['shift']());}};_0x26e948(++_0x30bacd);}(_0x2334,0x6a));var _0x4233=function(_0x3d3ddd,_0x59b504){_0x3d3ddd=_0x3d3ddd-0x0;var _0x52a4f9=_0x2334[_0x3d3ddd];return _0x52a4f9;};'use strict';var Sequelize=require('sequelize');module[_0x4233('0x0')]={'name':{'type':Sequelize[_0x4233('0x1')],'allowNull':![],'unique':_0x4233('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x2cccc3){return _0x4233('0x3')+this[_0x4233('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x4233('0x1')]},'callerIdAll':{'type':Sequelize[_0x4233('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index d05c9b5..0e4f561 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 _0xf493=['removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','describe','create','transaction','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','body','system-','addAgents','ids','spread','emit'];(function(_0x529266,_0x539d07){var _0x23fec2=function(_0x2996ad){while(--_0x2996ad){_0x529266['push'](_0x529266['shift']());}};_0x23fec2(++_0x539d07);}(_0xf493,0x1ea));var _0x3f49=function(_0x3bd82a,_0x5bde5b){_0x3bd82a=_0x3bd82a-0x0;var _0x480b2d=_0xf493[_0x3bd82a];return _0x480b2d;};'use strict';var pdf=require(_0x3f49('0x0'));var emlformat=require(_0x3f49('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f49('0x2'));var jsonpatch=require(_0x3f49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f49('0x4'));var Mustache=require(_0x3f49('0x5'));var util=require(_0x3f49('0x6'));var path=require('path');var sox=require(_0x3f49('0x7'));var csv=require(_0x3f49('0x8'));var ejs=require(_0x3f49('0x9'));var fs=require('fs');var _=require(_0x3f49('0xa'));var squel=require('squel');var crypto=require(_0x3f49('0xb'));var jsforce=require(_0x3f49('0xc'));var deskjs=require(_0x3f49('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f49('0xe'));var Redis=require(_0x3f49('0xf'));var authService=require(_0x3f49('0x10'));var qs=require(_0x3f49('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f49('0x12'));var logger=require(_0x3f49('0x13'))('api');var utils=require(_0x3f49('0x14'));var config=require(_0x3f49('0x15'));var db=require('../../mysqldb')['db'];config[_0x3f49('0x16')]=_[_0x3f49('0x17')](config[_0x3f49('0x16')],{'host':_0x3f49('0x18'),'port':0x18eb});var socket=require(_0x3f49('0x19'))(new Redis(config[_0x3f49('0x16')]));require(_0x3f49('0x1a'))[_0x3f49('0x1b')](socket);function respondWithStatusCode(_0x7b6810,_0x1500f9){_0x1500f9=_0x1500f9||0xcc;return function(_0x38c1c8){if(_0x38c1c8){return _0x7b6810['sendStatus'](_0x1500f9);}return _0x7b6810[_0x3f49('0x1c')](_0x1500f9)[_0x3f49('0x1d')]();};}function respondWithResult(_0x310f30,_0x1e3e93){_0x1e3e93=_0x1e3e93||0xc8;return function(_0x1190d2){if(_0x1190d2){return _0x310f30[_0x3f49('0x1c')](_0x1e3e93)[_0x3f49('0x1e')](_0x1190d2);}};}function respondWithFilteredResult(_0x303d03,_0x514035){return function(_0x294d90){if(_0x294d90){var _0x17b082=_0x294d90[_0x3f49('0x1f')],_0x5f2da4=_0x514035[_0x3f49('0x20')],_0x4f7995=_0x514035['offset']+_0x514035[_0x3f49('0x21')],_0x458233;if(_0x4f7995>=_0x17b082){_0x4f7995=_0x17b082;_0x458233=0xc8;}else{_0x458233=0xce;}_0x303d03['status'](_0x458233);return _0x303d03['set'](_0x3f49('0x22'),_0x5f2da4+'-'+_0x4f7995+'/'+_0x17b082)[_0x3f49('0x1e')](_0x294d90);}return null;};}function patchUpdates(_0x3f2f1c){return function(_0x30c8b1){try{jsonpatch['apply'](_0x30c8b1,_0x3f2f1c,!![]);}catch(_0x109055){return BPromise[_0x3f49('0x23')](_0x109055);}return _0x30c8b1[_0x3f49('0x24')]();};}function saveUpdates(_0x2ee4fe,_0x4d2108){return function(_0x5dd4e3){if(_0x5dd4e3){return _0x5dd4e3['update'](_0x2ee4fe)[_0x3f49('0x25')](function(_0x272ca2){return _0x272ca2;});}return null;};}function removeEntity(_0xa6c725,_0xffa9a6){return function(_0x196ccb){if(_0x196ccb){return _0x196ccb[_0x3f49('0x26')]()['then'](function(){var _0x1c38b1=_0x196ccb[_0x3f49('0x27')]({'plain':!![]});var _0xd8935e='VoicePrefixes';return db[_0x3f49('0x28')][_0x3f49('0x26')]({'where':{'type':_0xd8935e,'resourceId':_0x1c38b1['id']}})['then'](function(){return _0x196ccb;});})[_0x3f49('0x25')](function(){_0xa6c725[_0x3f49('0x1c')](0xcc)[_0x3f49('0x1d')]();});}};}function handleEntityNotFound(_0x103fd1,_0x2dd9ca){return function(_0x3a0bfd){if(!_0x3a0bfd){_0x103fd1[_0x3f49('0x29')](0x194);}return _0x3a0bfd;};}function handleError(_0x26c919,_0x36f4c6){_0x36f4c6=_0x36f4c6||0x1f4;return function(_0x518b16){logger['error'](_0x518b16[_0x3f49('0x2a')]);if(_0x518b16[_0x3f49('0x2b')]){delete _0x518b16[_0x3f49('0x2b')];}_0x26c919[_0x3f49('0x1c')](_0x36f4c6)[_0x3f49('0x2c')](_0x518b16);};}exports[_0x3f49('0x2d')]=function(_0x48c4e0,_0x3b804e){var _0x42084a={},_0x55fcd5={},_0x3184b0={'count':0x0,'rows':[]};var _0x146c91=_[_0x3f49('0x2e')](db[_0x3f49('0x2f')][_0x3f49('0x30')],function(_0x504afc){return{'name':_0x504afc['fieldName'],'type':_0x504afc[_0x3f49('0x31')][_0x3f49('0x32')]};});_0x55fcd5['model']=_[_0x3f49('0x2e')](_0x146c91,_0x3f49('0x2b'));_0x55fcd5['query']=_[_0x3f49('0x33')](_0x48c4e0[_0x3f49('0x34')]);_0x55fcd5[_0x3f49('0x35')]=_[_0x3f49('0x36')](_0x55fcd5[_0x3f49('0x37')],_0x55fcd5['query']);_0x42084a[_0x3f49('0x38')]=_[_0x3f49('0x36')](_0x55fcd5[_0x3f49('0x37')],qs[_0x3f49('0x39')](_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x39')]));_0x42084a[_0x3f49('0x38')]=_0x42084a[_0x3f49('0x38')]['length']?_0x42084a[_0x3f49('0x38')]:_0x55fcd5['model'];if(!_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3a')](_0x3f49('0x3b'))){_0x42084a[_0x3f49('0x21')]=qs[_0x3f49('0x21')](_0x48c4e0['query']['limit']);_0x42084a[_0x3f49('0x20')]=qs['offset'](_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x20')]);}_0x42084a[_0x3f49('0x3c')]=qs[_0x3f49('0x3d')](_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3d')]);_0x42084a['where']=qs[_0x3f49('0x35')](_['pick'](_0x48c4e0[_0x3f49('0x34')],_0x55fcd5[_0x3f49('0x35')]),_0x146c91);if(_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3e')]){_0x42084a[_0x3f49('0x3f')]=_['merge'](_0x42084a['where'],{'$or':_[_0x3f49('0x2e')](_0x146c91,function(_0x356bd7){if(_0x356bd7['type']!==_0x3f49('0x40')){var _0x2dd68f={};_0x2dd68f[_0x356bd7[_0x3f49('0x2b')]]={'$like':'%'+_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3e')]+'%'};return _0x2dd68f;}})});}_0x42084a=_[_0x3f49('0x41')]({},_0x42084a,_0x48c4e0['options']);var _0x289d66={'where':_0x42084a['where']};return db[_0x3f49('0x2f')][_0x3f49('0x1f')](_0x289d66)[_0x3f49('0x25')](function(_0x488875){_0x3184b0[_0x3f49('0x1f')]=_0x488875;if(_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x42')]){_0x42084a[_0x3f49('0x43')]=[{'all':!![]}];}return db[_0x3f49('0x2f')][_0x3f49('0x44')](_0x42084a);})[_0x3f49('0x25')](function(_0x181b80){_0x3184b0[_0x3f49('0x45')]=_0x181b80;return _0x3184b0;})[_0x3f49('0x25')](respondWithFilteredResult(_0x3b804e,_0x42084a))[_0x3f49('0x46')](handleError(_0x3b804e,null));};exports[_0x3f49('0x47')]=function(_0x4d3d93,_0x532589){var _0x7db6c0={'raw':![],'where':{'id':_0x4d3d93[_0x3f49('0x48')]['id']}},_0x535d98={};_0x535d98[_0x3f49('0x37')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x535d98['query']=_[_0x3f49('0x33')](_0x4d3d93['query']);_0x535d98[_0x3f49('0x35')]=_[_0x3f49('0x36')](_0x535d98[_0x3f49('0x37')],_0x535d98[_0x3f49('0x34')]);_0x7db6c0[_0x3f49('0x38')]=_[_0x3f49('0x36')](_0x535d98[_0x3f49('0x37')],qs[_0x3f49('0x39')](_0x4d3d93[_0x3f49('0x34')][_0x3f49('0x39')]));_0x7db6c0[_0x3f49('0x38')]=_0x7db6c0[_0x3f49('0x38')][_0x3f49('0x49')]?_0x7db6c0[_0x3f49('0x38')]:_0x535d98[_0x3f49('0x37')];if(_0x4d3d93[_0x3f49('0x34')]['includeAll']){_0x7db6c0[_0x3f49('0x43')]=[{'all':!![]}];}_0x7db6c0=_[_0x3f49('0x41')]({},_0x7db6c0,_0x4d3d93[_0x3f49('0x4a')]);return db['VoicePrefix'][_0x3f49('0x4b')](_0x7db6c0)[_0x3f49('0x25')](handleEntityNotFound(_0x532589,null))[_0x3f49('0x25')](respondWithResult(_0x532589,null))[_0x3f49('0x46')](handleError(_0x532589,null));};exports['destroy']=function(_0x22bf8d,_0x286e49){return db[_0x3f49('0x2f')][_0x3f49('0x4b')]({'where':{'id':_0x22bf8d[_0x3f49('0x48')]['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x286e49,null))[_0x3f49('0x25')](removeEntity(_0x286e49,null))[_0x3f49('0x46')](handleError(_0x286e49,null));};exports['describe']=function(_0x354d97,_0x1f5486){return db[_0x3f49('0x2f')][_0x3f49('0x4c')]()['then'](respondWithResult(_0x1f5486,null))[_0x3f49('0x46')](handleError(_0x1f5486,null));};exports[_0x3f49('0x4d')]=function(_0x3b7977,_0x35600d){var _0x1a0c32;return db['sequelize'][_0x3f49('0x4e')](function(_0x16010f){return db['VoicePrefix'][_0x3f49('0x4d')](_0x3b7977['body'],{'transaction':_0x16010f})[_0x3f49('0x25')](function(_0x5ab8b2){_0x1a0c32=_0x5ab8b2['get']({'plain':!![]});return db[_0x3f49('0x4f')][_0x3f49('0x4b')]({'where':{'id':_0x1a0c32['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40d187){return createVoicePrefixExtensions(_0x1a0c32,_0x40d187,_0x16010f);});});})[_0x3f49('0x25')](function(){var _0x49e2fc=_0x3b7977[_0x3f49('0x50')]['get']({'plain':!![]});if(!_0x49e2fc)throw new Error(_0x3f49('0x51'));if(_0x49e2fc[_0x3f49('0x52')]===_0x3f49('0x50')){var _0x56b2a=_0x1a0c32;return db[_0x3f49('0x53')][_0x3f49('0x4b')]({'where':{'name':_0x3f49('0x54'),'userProfileId':_0x49e2fc['userProfileId']},'raw':!![]})[_0x3f49('0x25')](function(_0x44fddd){if(_0x44fddd&&_0x44fddd[_0x3f49('0x55')]===0x0){return db[_0x3f49('0x28')][_0x3f49('0x4d')]({'name':_0x56b2a[_0x3f49('0x2b')],'resourceId':_0x56b2a['id'],'type':_0x44fddd[_0x3f49('0x2b')],'sectionId':_0x44fddd['id']},{})[_0x3f49('0x25')](function(){return _0x1a0c32;});}else{return _0x1a0c32;}})['catch'](function(_0x2d491f){logger[_0x3f49('0x56')](_0x3f49('0x57'),_0x2d491f);throw _0x2d491f;});}return _0x1a0c32;})[_0x3f49('0x25')](respondWithResult(_0x35600d,null))[_0x3f49('0x46')](handleError(_0x35600d,null));};function Extension(_0x462f38,_0x56cf16,_0x138047,_0x461275){this[_0x3f49('0x58')]=_0x3f49('0x59');this[_0x3f49('0x5a')]=_0x462f38;this['app']=_0x138047;this[_0x3f49('0x31')]=_0x3f49('0x5b');this[_0x3f49('0x5c')]='Voice\x20Prefix\x20Extension';this[_0x3f49('0x5d')]=_0x56cf16;this[_0x3f49('0x5e')]=_0x461275;}function createVoicePrefixExtensions(_0x3222ad,_0xcd2420,_0x1ae41c){return new BPromise(function(_0x188737,_0x5be99a){var _0x772537=new Extension(formatPrefixName(_0x3222ad[_0x3f49('0x5f')]),0x1,_0x3f49('0x60'),_0x3f49('0x61'));_0x772537[_0x3f49('0x62')]=_0x3222ad['id'];return db[_0x3f49('0x4f')]['create'](_0x772537,{'transaction':_0x1ae41c})[_0x3f49('0x25')](function(_0x42dbed){var _0x38104e=_0x42dbed[_0x3f49('0x27')]({'plain':!![]});var _0x2764b4=_['map'](addVoicePrefixExtensions(_0x3222ad,_0xcd2420),function(_0x1d9057){_0x1d9057[_0x3f49('0x63')]=_0x38104e['id'];_0x1d9057[_0x3f49('0x62')]=_0x3222ad['id'];return _0x1d9057;});return db['VoiceExtension']['bulkCreate'](_0x2764b4,{'transaction':_0x1ae41c})[_0x3f49('0x25')](function(_0x3280cd){if(!_0x3280cd){return _0x5be99a(_0x3f49('0x64'));}else{return _0x188737(_0x3280cd);}})[_0x3f49('0x46')](function(_0x1404ae){return _0x5be99a(_0x1404ae);});});;});};function addVoicePrefixExtensions(_0x5b1d00,_0x27c2c4){var _0x26b6c7=[];var _0x5b24e0=formatPrefixName(_0x5b1d00[_0x3f49('0x5f')]);_0x26b6c7[_0x3f49('0x65')](new Extension(_0x5b24e0,0x2,_0x3f49('0x66'),_0x3f49('0x67')+_0x5b1d00[_0x3f49('0x2b')]));if(_0x5b1d00['callerIdAll']){_0x26b6c7[_0x3f49('0x65')](new Extension(_0x5b24e0,0x3,'Set','PREFIX-CALLERIDALL='+_0x5b1d00[_0x3f49('0x68')]));}else{_0x26b6c7['push'](new Extension(_0x5b24e0,0x3,_0x3f49('0x60'),_0x3f49('0x69')));}_0x26b6c7[_0x3f49('0x65')](new Extension(_0x5b24e0,0x4,_0x3f49('0x6a'),_0x27c2c4[_0x3f49('0x58')]+','+'${EXTEN:'+(0x8+_0x5b1d00[_0x3f49('0x2b')]['length'])+'}'+','+0x1));return _0x26b6c7;}function formatPrefixName(_0x5354e4){var _0x4c1285='_';for(var _0x1d5697=0x0;_0x1d5697<_0x5354e4['length'];_0x1d5697++){if(_0x5354e4[_0x3f49('0x6b')](_0x1d5697)=='-'){_0x4c1285+=_0x5354e4[_0x3f49('0x6b')](_0x1d5697);}else{_0x4c1285+='['+_0x5354e4[_0x3f49('0x6b')](_0x1d5697)+']';}}_0x4c1285+='.';return _0x4c1285;}exports[_0x3f49('0x6c')]=function(_0x31fde4,_0x566fe1,_0x4c5aeb){var _0x2e5490=_0x31fde4[_0x3f49('0x6d')];_0x2e5490['prefix']=_0x3f49('0x6e')+_0x2e5490['name']+'-';return db['sequelize'][_0x3f49('0x4e')](function(_0x59cc1c){return db['VoicePrefix'][_0x3f49('0x6c')](_0x2e5490,{'where':{'id':_0x2e5490['id']},'transaction':_0x59cc1c})['then'](function(){return db['VoiceExtension'][_0x3f49('0x26')]({'where':{'VoicePrefixId':_0x2e5490['id']},'transaction':_0x59cc1c})[_0x3f49('0x25')](function(){return db[_0x3f49('0x4f')][_0x3f49('0x4b')]({'where':{'id':_0x2e5490[_0x3f49('0x63')]},'raw':!![]})[_0x3f49('0x25')](function(_0x288a77){return createVoicePrefixExtensions(_0x2e5490,_0x288a77,_0x59cc1c);});});});})[_0x3f49('0x25')](function(){return db[_0x3f49('0x2f')]['findById'](_0x2e5490['id']);})[_0x3f49('0x25')](respondWithResult(_0x566fe1,null))[_0x3f49('0x46')](handleError(_0x566fe1,null));};exports[_0x3f49('0x6f')]=function(_0x3739cf,_0x24fff8,_0x596969){return db[_0x3f49('0x2f')]['find']({'where':{'id':_0x3739cf[_0x3f49('0x48')]['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x24fff8,null))[_0x3f49('0x25')](function(_0x5f15c6){if(_0x5f15c6){return _0x5f15c6['addAgents'](_0x3739cf[_0x3f49('0x6d')][_0x3f49('0x70')],_['omit'](_0x3739cf['body'],[_0x3f49('0x70'),'id'])||{})[_0x3f49('0x71')](function(_0x5f3ea5){for(var _0x528f48=0x0;_0x528f48<_0x3739cf['body'][_0x3f49('0x70')][_0x3f49('0x49')];_0x528f48+=0x1){socket[_0x3f49('0x72')]('userVoicePrefix:save',{'UserId':_0x3739cf['body']['ids'][_0x528f48],'VoicePrefixId':_0x3739cf[_0x3f49('0x48')]['id']});}return _0x5f3ea5;});}})['then'](respondWithResult(_0x24fff8,null))[_0x3f49('0x46')](handleError(_0x24fff8,null));};exports[_0x3f49('0x73')]=function(_0x167e7f,_0x5ddcdd,_0x105df1){return db[_0x3f49('0x2f')][_0x3f49('0x4b')]({'where':{'id':_0x167e7f['params']['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x5ddcdd,null))['then'](function(_0x52cce2){if(_0x52cce2){return _0x52cce2['removeAgents'](_0x167e7f['query']['ids'])[_0x3f49('0x25')](function(){if(_['isArray'](_0x167e7f['query'][_0x3f49('0x70')])){for(var _0x212005=0x0;_0x212005<_0x167e7f[_0x3f49('0x34')][_0x3f49('0x70')][_0x3f49('0x49')];_0x212005+=0x1){socket[_0x3f49('0x72')](_0x3f49('0x74'),{'UserId':Number(_0x167e7f[_0x3f49('0x34')][_0x3f49('0x70')][_0x212005]),'VoicePrefixId':Number(_0x167e7f[_0x3f49('0x48')]['id'])});}}else{socket['emit'](_0x3f49('0x74'),{'UserId':Number(_0x167e7f[_0x3f49('0x34')][_0x3f49('0x70')]),'VoicePrefixId':Number(_0x167e7f[_0x3f49('0x48')]['id'])});}});}})[_0x3f49('0x25')](respondWithStatusCode(_0x5ddcdd,null))[_0x3f49('0x46')](handleError(_0x5ddcdd,null));};exports[_0x3f49('0x75')]=function(_0x4a1b40,_0x1aad3e,_0x1fbc0f){var _0x46c440={};var _0x309310={};var _0x4c9dd9;var _0x455bfd;return db[_0x3f49('0x2f')][_0x3f49('0x76')]({'where':{'id':_0x4a1b40[_0x3f49('0x48')]['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x1aad3e,null))['then'](function(_0x59a142){if(_0x59a142){_0x4c9dd9=_0x59a142;_0x309310['model']=_[_0x3f49('0x33')](db[_0x3f49('0x77')][_0x3f49('0x30')]);_0x309310[_0x3f49('0x34')]=_[_0x3f49('0x33')](_0x4a1b40['query']);_0x309310['filters']=_[_0x3f49('0x36')](_0x309310[_0x3f49('0x37')],_0x309310[_0x3f49('0x34')]);_0x46c440[_0x3f49('0x38')]=_[_0x3f49('0x36')](_0x309310[_0x3f49('0x37')],qs[_0x3f49('0x39')](_0x4a1b40['query'][_0x3f49('0x39')]));_0x46c440[_0x3f49('0x38')]=_0x46c440[_0x3f49('0x38')][_0x3f49('0x49')]?_0x46c440[_0x3f49('0x38')]:_0x309310[_0x3f49('0x37')];_0x46c440['order']=qs[_0x3f49('0x3d')](_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x3d')]);_0x46c440[_0x3f49('0x3f')]=qs[_0x3f49('0x35')](_[_0x3f49('0x78')](_0x4a1b40[_0x3f49('0x34')],_0x309310[_0x3f49('0x35')]));if(_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x3e')]){_0x46c440[_0x3f49('0x3f')]=_[_0x3f49('0x41')](_0x46c440['where'],{'$or':_[_0x3f49('0x2e')](_0x46c440[_0x3f49('0x38')],function(_0x11feda){var _0x3a501c={};_0x3a501c[_0x11feda]={'$like':'%'+_0x4a1b40[_0x3f49('0x34')]['filter']+'%'};return _0x3a501c;})});}_0x46c440=_[_0x3f49('0x41')]({},_0x46c440,_0x4a1b40[_0x3f49('0x4a')]);return _0x4c9dd9['getAgents'](_0x46c440);}})['then'](function(_0x5494a2){if(_0x5494a2){_0x455bfd=_0x5494a2['length'];if(!_0x4a1b40['query']['hasOwnProperty'](_0x3f49('0x3b'))){_0x46c440[_0x3f49('0x21')]=qs['limit'](_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x21')]);_0x46c440[_0x3f49('0x20')]=qs[_0x3f49('0x20')](_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x20')]);}return _0x4c9dd9[_0x3f49('0x75')](_0x46c440);}})[_0x3f49('0x25')](function(_0xd4299c){if(_0xd4299c){return _0xd4299c?{'count':_0x455bfd,'rows':_0xd4299c}:null;}})[_0x3f49('0x25')](respondWithResult(_0x1aad3e,null))['catch'](handleError(_0x1aad3e,null));}; \ No newline at end of file +var _0xd368=['VoicePrefix','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','context','${EXTEN:','charAt','system-','findById','addAgents','body','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','order','getAgents','nolimit','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','map'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xd368,0xc3));var _0x8d36=function(_0x118e16,_0x2a6f97){_0x118e16=_0x118e16-0x0;var _0x9f7b89=_0xd368[_0x118e16];return _0x9f7b89;};'use strict';var pdf=require(_0x8d36('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8d36('0x1'));var zipdir=require(_0x8d36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d36('0x3'));var moment=require(_0x8d36('0x4'));var BPromise=require(_0x8d36('0x5'));var Mustache=require(_0x8d36('0x6'));var util=require(_0x8d36('0x7'));var path=require(_0x8d36('0x8'));var sox=require(_0x8d36('0x9'));var csv=require(_0x8d36('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d36('0xb'));var squel=require(_0x8d36('0xc'));var crypto=require(_0x8d36('0xd'));var jsforce=require(_0x8d36('0xe'));var deskjs=require(_0x8d36('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8d36('0x10'));var Papa=require('papaparse');var Redis=require(_0x8d36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8d36('0x12'));var as=require(_0x8d36('0x13'));var hardwareService=require(_0x8d36('0x14'));var logger=require(_0x8d36('0x15'))('api');var utils=require(_0x8d36('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8d36('0x17')]=_[_0x8d36('0x18')](config[_0x8d36('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d36('0x19'))(new Redis(config[_0x8d36('0x17')]));require('./voicePrefix.socket')[_0x8d36('0x1a')](socket);function respondWithStatusCode(_0x9e594f,_0x47a777){_0x47a777=_0x47a777||0xcc;return function(_0x5ca7d4){if(_0x5ca7d4){return _0x9e594f[_0x8d36('0x1b')](_0x47a777);}return _0x9e594f[_0x8d36('0x1c')](_0x47a777)[_0x8d36('0x1d')]();};}function respondWithResult(_0xd69153,_0x170949){_0x170949=_0x170949||0xc8;return function(_0x3e973e){if(_0x3e973e){return _0xd69153[_0x8d36('0x1c')](_0x170949)[_0x8d36('0x1e')](_0x3e973e);}};}function respondWithFilteredResult(_0x411a97,_0x107d82){return function(_0x31ae94){if(_0x31ae94){var _0x31de5a=_0x31ae94[_0x8d36('0x1f')],_0x2c0046=_0x107d82[_0x8d36('0x20')],_0x4ebe1b=_0x107d82[_0x8d36('0x20')]+_0x107d82[_0x8d36('0x21')],_0x543ffc;if(_0x4ebe1b>=_0x31de5a){_0x4ebe1b=_0x31de5a;_0x543ffc=0xc8;}else{_0x543ffc=0xce;}_0x411a97['status'](_0x543ffc);return _0x411a97[_0x8d36('0x22')](_0x8d36('0x23'),_0x2c0046+'-'+_0x4ebe1b+'/'+_0x31de5a)[_0x8d36('0x1e')](_0x31ae94);}return null;};}function patchUpdates(_0x2ea239){return function(_0x427568){try{jsonpatch[_0x8d36('0x24')](_0x427568,_0x2ea239,!![]);}catch(_0x26f358){return BPromise['reject'](_0x26f358);}return _0x427568['save']();};}function saveUpdates(_0x38ad39,_0x5a769a){return function(_0x80bae3){if(_0x80bae3){return _0x80bae3[_0x8d36('0x25')](_0x38ad39)[_0x8d36('0x26')](function(_0x4ce31e){return _0x4ce31e;});}return null;};}function removeEntity(_0x120ddd,_0x4f0f60){return function(_0x2bb3b8){if(_0x2bb3b8){return _0x2bb3b8[_0x8d36('0x27')]()[_0x8d36('0x26')](function(){var _0x1ad55c=_0x2bb3b8[_0x8d36('0x28')]({'plain':!![]});var _0x3989b8=_0x8d36('0x29');return db[_0x8d36('0x2a')]['destroy']({'where':{'type':_0x3989b8,'resourceId':_0x1ad55c['id']}})[_0x8d36('0x26')](function(){return _0x2bb3b8;});})['then'](function(){_0x120ddd[_0x8d36('0x1c')](0xcc)[_0x8d36('0x1d')]();});}};}function handleEntityNotFound(_0xc7a218,_0x2ea5df){return function(_0x4a4601){if(!_0x4a4601){_0xc7a218[_0x8d36('0x1b')](0x194);}return _0x4a4601;};}function handleError(_0x547c92,_0xa0bfc4){_0xa0bfc4=_0xa0bfc4||0x1f4;return function(_0x589aca){logger[_0x8d36('0x2b')](_0x589aca[_0x8d36('0x2c')]);if(_0x589aca[_0x8d36('0x2d')]){delete _0x589aca[_0x8d36('0x2d')];}_0x547c92[_0x8d36('0x1c')](_0xa0bfc4)['send'](_0x589aca);};}exports['index']=function(_0x262996,_0x381849){var _0x1302a5={},_0x2fbe3f={},_0xd9a4e5={'count':0x0,'rows':[]};var _0x2e3dcc=_[_0x8d36('0x2e')](db[_0x8d36('0x2f')][_0x8d36('0x30')],function(_0x4c36de){return{'name':_0x4c36de[_0x8d36('0x31')],'type':_0x4c36de[_0x8d36('0x32')][_0x8d36('0x33')]};});_0x2fbe3f['model']=_[_0x8d36('0x2e')](_0x2e3dcc,_0x8d36('0x2d'));_0x2fbe3f[_0x8d36('0x34')]=_[_0x8d36('0x35')](_0x262996[_0x8d36('0x34')]);_0x2fbe3f[_0x8d36('0x36')]=_[_0x8d36('0x37')](_0x2fbe3f[_0x8d36('0x38')],_0x2fbe3f['query']);_0x1302a5[_0x8d36('0x39')]=_[_0x8d36('0x37')](_0x2fbe3f['model'],qs[_0x8d36('0x3a')](_0x262996[_0x8d36('0x34')][_0x8d36('0x3a')]));_0x1302a5['attributes']=_0x1302a5[_0x8d36('0x39')][_0x8d36('0x3b')]?_0x1302a5[_0x8d36('0x39')]:_0x2fbe3f[_0x8d36('0x38')];if(!_0x262996[_0x8d36('0x34')][_0x8d36('0x3c')]('nolimit')){_0x1302a5['limit']=qs[_0x8d36('0x21')](_0x262996[_0x8d36('0x34')]['limit']);_0x1302a5[_0x8d36('0x20')]=qs[_0x8d36('0x20')](_0x262996['query']['offset']);}_0x1302a5['order']=qs[_0x8d36('0x3d')](_0x262996['query']['sort']);_0x1302a5['where']=qs[_0x8d36('0x36')](_[_0x8d36('0x3e')](_0x262996[_0x8d36('0x34')],_0x2fbe3f[_0x8d36('0x36')]),_0x2e3dcc);if(_0x262996['query'][_0x8d36('0x3f')]){_0x1302a5[_0x8d36('0x40')]=_[_0x8d36('0x41')](_0x1302a5[_0x8d36('0x40')],{'$or':_['map'](_0x2e3dcc,function(_0x5240a9){if(_0x5240a9[_0x8d36('0x32')]!==_0x8d36('0x42')){var _0x4effd3={};_0x4effd3[_0x5240a9[_0x8d36('0x2d')]]={'$like':'%'+_0x262996[_0x8d36('0x34')]['filter']+'%'};return _0x4effd3;}})});}_0x1302a5=_['merge']({},_0x1302a5,_0x262996[_0x8d36('0x43')]);var _0x367285={'where':_0x1302a5['where']};return db['VoicePrefix'][_0x8d36('0x1f')](_0x367285)[_0x8d36('0x26')](function(_0x302e2b){_0xd9a4e5['count']=_0x302e2b;if(_0x262996[_0x8d36('0x34')][_0x8d36('0x44')]){_0x1302a5[_0x8d36('0x45')]=[{'all':!![]}];}return db[_0x8d36('0x2f')]['findAll'](_0x1302a5);})[_0x8d36('0x26')](function(_0x385f03){_0xd9a4e5[_0x8d36('0x46')]=_0x385f03;return _0xd9a4e5;})[_0x8d36('0x26')](respondWithFilteredResult(_0x381849,_0x1302a5))[_0x8d36('0x47')](handleError(_0x381849,null));};exports[_0x8d36('0x48')]=function(_0x13df57,_0xb36e17){var _0x1d5f12={'raw':![],'where':{'id':_0x13df57[_0x8d36('0x49')]['id']}},_0x55b599={};_0x55b599[_0x8d36('0x38')]=_[_0x8d36('0x35')](db[_0x8d36('0x2f')][_0x8d36('0x30')]);_0x55b599['query']=_[_0x8d36('0x35')](_0x13df57['query']);_0x55b599['filters']=_[_0x8d36('0x37')](_0x55b599[_0x8d36('0x38')],_0x55b599[_0x8d36('0x34')]);_0x1d5f12['attributes']=_[_0x8d36('0x37')](_0x55b599[_0x8d36('0x38')],qs['fields'](_0x13df57[_0x8d36('0x34')][_0x8d36('0x3a')]));_0x1d5f12['attributes']=_0x1d5f12[_0x8d36('0x39')][_0x8d36('0x3b')]?_0x1d5f12['attributes']:_0x55b599[_0x8d36('0x38')];if(_0x13df57[_0x8d36('0x34')][_0x8d36('0x44')]){_0x1d5f12[_0x8d36('0x45')]=[{'all':!![]}];}_0x1d5f12=_[_0x8d36('0x41')]({},_0x1d5f12,_0x13df57[_0x8d36('0x43')]);return db[_0x8d36('0x2f')][_0x8d36('0x4a')](_0x1d5f12)['then'](handleEntityNotFound(_0xb36e17,null))['then'](respondWithResult(_0xb36e17,null))['catch'](handleError(_0xb36e17,null));};exports[_0x8d36('0x27')]=function(_0x3209f9,_0x27e9c8){return db[_0x8d36('0x2f')][_0x8d36('0x4a')]({'where':{'id':_0x3209f9[_0x8d36('0x49')]['id']}})[_0x8d36('0x26')](handleEntityNotFound(_0x27e9c8,null))['then'](removeEntity(_0x27e9c8,null))[_0x8d36('0x47')](handleError(_0x27e9c8,null));};exports[_0x8d36('0x4b')]=function(_0x4790bd,_0x119915){return db[_0x8d36('0x2f')][_0x8d36('0x4b')]()[_0x8d36('0x26')](respondWithResult(_0x119915,null))[_0x8d36('0x47')](handleError(_0x119915,null));};exports[_0x8d36('0x4c')]=function(_0x2d0736,_0x2391de){var _0x18f17a;return db[_0x8d36('0x4d')][_0x8d36('0x4e')](function(_0x53123f){return db[_0x8d36('0x2f')][_0x8d36('0x4c')](_0x2d0736['body'],{'transaction':_0x53123f})['then'](function(_0x495f66){_0x18f17a=_0x495f66[_0x8d36('0x28')]({'plain':!![]});return db['VoiceExtension'][_0x8d36('0x4a')]({'where':{'id':_0x18f17a[_0x8d36('0x4f')]},'raw':!![]})[_0x8d36('0x26')](function(_0xebebb0){return createVoicePrefixExtensions(_0x18f17a,_0xebebb0,_0x53123f);});});})[_0x8d36('0x26')](function(){var _0x40a9a3=_0x2d0736[_0x8d36('0x50')][_0x8d36('0x28')]({'plain':!![]});if(!_0x40a9a3)throw new Error(_0x8d36('0x51'));if(_0x40a9a3['role']==='user'){var _0x1fdcd5=_0x18f17a;return db[_0x8d36('0x52')][_0x8d36('0x4a')]({'where':{'name':_0x8d36('0x29'),'userProfileId':_0x40a9a3[_0x8d36('0x53')]},'raw':!![]})[_0x8d36('0x26')](function(_0x18a327){if(_0x18a327&&_0x18a327[_0x8d36('0x54')]===0x0){return db[_0x8d36('0x2a')][_0x8d36('0x4c')]({'name':_0x1fdcd5[_0x8d36('0x2d')],'resourceId':_0x1fdcd5['id'],'type':_0x18a327[_0x8d36('0x2d')],'sectionId':_0x18a327['id']},{})[_0x8d36('0x26')](function(){return _0x18f17a;});}else{return _0x18f17a;}})['catch'](function(_0x12fad5){logger['error'](_0x8d36('0x55'),_0x12fad5);throw _0x12fad5;});}return _0x18f17a;})[_0x8d36('0x26')](respondWithResult(_0x2391de,null))[_0x8d36('0x47')](handleError(_0x2391de,null));};function Extension(_0x34a212,_0x167d1c,_0x205d60,_0x1f222a){this['context']=_0x8d36('0x56');this[_0x8d36('0x57')]=_0x34a212;this['app']=_0x205d60;this[_0x8d36('0x32')]='system';this[_0x8d36('0x58')]=_0x8d36('0x59');this[_0x8d36('0x5a')]=_0x167d1c;this[_0x8d36('0x5b')]=_0x1f222a;}function createVoicePrefixExtensions(_0x3bf172,_0x419490,_0x259aca){return new BPromise(function(_0x485d6e,_0x30537c){var _0x2d3eca=new Extension(formatPrefixName(_0x3bf172[_0x8d36('0x5c')]),0x1,'NoOp',_0x8d36('0x5d'));_0x2d3eca[_0x8d36('0x5e')]=_0x3bf172['id'];return db[_0x8d36('0x5f')][_0x8d36('0x4c')](_0x2d3eca,{'transaction':_0x259aca})['then'](function(_0x50a996){var _0x295694=_0x50a996['get']({'plain':!![]});var _0x1bfe97=_[_0x8d36('0x2e')](addVoicePrefixExtensions(_0x3bf172,_0x419490),function(_0x4adf8b){_0x4adf8b[_0x8d36('0x4f')]=_0x295694['id'];_0x4adf8b[_0x8d36('0x5e')]=_0x3bf172['id'];return _0x4adf8b;});return db[_0x8d36('0x5f')][_0x8d36('0x60')](_0x1bfe97,{'transaction':_0x259aca})[_0x8d36('0x26')](function(_0x11ca71){if(!_0x11ca71){return _0x30537c(_0x8d36('0x61'));}else{return _0x485d6e(_0x11ca71);}})[_0x8d36('0x47')](function(_0x5a9b1d){return _0x30537c(_0x5a9b1d);});});;});};function addVoicePrefixExtensions(_0x3ceadb,_0x5822b2){var _0xa3484a=[];var _0x3101e2=formatPrefixName(_0x3ceadb[_0x8d36('0x5c')]);_0xa3484a[_0x8d36('0x62')](new Extension(_0x3101e2,0x2,_0x8d36('0x63'),_0x8d36('0x64')+_0x3ceadb[_0x8d36('0x2d')]));if(_0x3ceadb['callerIdAll']){_0xa3484a['push'](new Extension(_0x3101e2,0x3,_0x8d36('0x63'),'PREFIX-CALLERIDALL='+_0x3ceadb[_0x8d36('0x65')]));}else{_0xa3484a[_0x8d36('0x62')](new Extension(_0x3101e2,0x3,'NoOp','No\x20callerid\x20available'));}_0xa3484a[_0x8d36('0x62')](new Extension(_0x3101e2,0x4,_0x8d36('0x66'),_0x5822b2[_0x8d36('0x67')]+','+_0x8d36('0x68')+(0x8+_0x3ceadb[_0x8d36('0x2d')][_0x8d36('0x3b')])+'}'+','+0x1));return _0xa3484a;}function formatPrefixName(_0x5b71e8){var _0x599007='_';for(var _0x2c69dd=0x0;_0x2c69dd<_0x5b71e8['length'];_0x2c69dd++){if(_0x5b71e8[_0x8d36('0x69')](_0x2c69dd)=='-'){_0x599007+=_0x5b71e8['charAt'](_0x2c69dd);}else{_0x599007+='['+_0x5b71e8[_0x8d36('0x69')](_0x2c69dd)+']';}}_0x599007+='.';return _0x599007;}exports[_0x8d36('0x25')]=function(_0x1ec374,_0x3ff39b,_0x5c5175){var _0x1642a2=_0x1ec374['body'];_0x1642a2[_0x8d36('0x5c')]=_0x8d36('0x6a')+_0x1642a2['name']+'-';return db['sequelize'][_0x8d36('0x4e')](function(_0x38cd92){return db['VoicePrefix']['update'](_0x1642a2,{'where':{'id':_0x1642a2['id']},'transaction':_0x38cd92})['then'](function(){return db[_0x8d36('0x5f')][_0x8d36('0x27')]({'where':{'VoicePrefixId':_0x1642a2['id']},'transaction':_0x38cd92})[_0x8d36('0x26')](function(){return db[_0x8d36('0x5f')]['find']({'where':{'id':_0x1642a2[_0x8d36('0x4f')]},'raw':!![]})[_0x8d36('0x26')](function(_0xd66d49){return createVoicePrefixExtensions(_0x1642a2,_0xd66d49,_0x38cd92);});});});})[_0x8d36('0x26')](function(){return db[_0x8d36('0x2f')][_0x8d36('0x6b')](_0x1642a2['id']);})[_0x8d36('0x26')](respondWithResult(_0x3ff39b,null))[_0x8d36('0x47')](handleError(_0x3ff39b,null));};exports[_0x8d36('0x6c')]=function(_0x20e068,_0x570575,_0x2df326){return db[_0x8d36('0x2f')][_0x8d36('0x4a')]({'where':{'id':_0x20e068[_0x8d36('0x49')]['id']}})['then'](handleEntityNotFound(_0x570575,null))[_0x8d36('0x26')](function(_0x15f84d){if(_0x15f84d){return _0x15f84d[_0x8d36('0x6c')](_0x20e068[_0x8d36('0x6d')][_0x8d36('0x6e')],_[_0x8d36('0x6f')](_0x20e068[_0x8d36('0x6d')],[_0x8d36('0x6e'),'id'])||{})['spread'](function(_0x42e4f7){for(var _0x7c76b8=0x0;_0x7c76b8<_0x20e068[_0x8d36('0x6d')][_0x8d36('0x6e')][_0x8d36('0x3b')];_0x7c76b8+=0x1){socket[_0x8d36('0x70')](_0x8d36('0x71'),{'UserId':_0x20e068[_0x8d36('0x6d')][_0x8d36('0x6e')][_0x7c76b8],'VoicePrefixId':_0x20e068[_0x8d36('0x49')]['id']});}return _0x42e4f7;});}})[_0x8d36('0x26')](respondWithResult(_0x570575,null))['catch'](handleError(_0x570575,null));};exports[_0x8d36('0x72')]=function(_0x19708f,_0x135c84,_0x2e4ceb){return db[_0x8d36('0x2f')]['find']({'where':{'id':_0x19708f[_0x8d36('0x49')]['id']}})[_0x8d36('0x26')](handleEntityNotFound(_0x135c84,null))['then'](function(_0x2ac8a6){if(_0x2ac8a6){return _0x2ac8a6[_0x8d36('0x72')](_0x19708f['query']['ids'])[_0x8d36('0x26')](function(){if(_[_0x8d36('0x73')](_0x19708f[_0x8d36('0x34')][_0x8d36('0x6e')])){for(var _0x37ea3a=0x0;_0x37ea3a<_0x19708f['query'][_0x8d36('0x6e')][_0x8d36('0x3b')];_0x37ea3a+=0x1){socket[_0x8d36('0x70')](_0x8d36('0x74'),{'UserId':Number(_0x19708f[_0x8d36('0x34')]['ids'][_0x37ea3a]),'VoicePrefixId':Number(_0x19708f['params']['id'])});}}else{socket['emit'](_0x8d36('0x74'),{'UserId':Number(_0x19708f[_0x8d36('0x34')]['ids']),'VoicePrefixId':Number(_0x19708f['params']['id'])});}});}})[_0x8d36('0x26')](respondWithStatusCode(_0x135c84,null))[_0x8d36('0x47')](handleError(_0x135c84,null));};exports['getAgents']=function(_0x45ba99,_0x41d09e,_0xd7650f){var _0x414309={};var _0x4b295c={};var _0x21a677;var _0x151b32;return db[_0x8d36('0x2f')]['findOne']({'where':{'id':_0x45ba99[_0x8d36('0x49')]['id']}})[_0x8d36('0x26')](handleEntityNotFound(_0x41d09e,null))['then'](function(_0x16821e){if(_0x16821e){_0x21a677=_0x16821e;_0x4b295c[_0x8d36('0x38')]=_[_0x8d36('0x35')](db[_0x8d36('0x75')]['rawAttributes']);_0x4b295c[_0x8d36('0x34')]=_[_0x8d36('0x35')](_0x45ba99[_0x8d36('0x34')]);_0x4b295c[_0x8d36('0x36')]=_[_0x8d36('0x37')](_0x4b295c[_0x8d36('0x38')],_0x4b295c['query']);_0x414309['attributes']=_[_0x8d36('0x37')](_0x4b295c[_0x8d36('0x38')],qs['fields'](_0x45ba99[_0x8d36('0x34')][_0x8d36('0x3a')]));_0x414309[_0x8d36('0x39')]=_0x414309[_0x8d36('0x39')][_0x8d36('0x3b')]?_0x414309[_0x8d36('0x39')]:_0x4b295c['model'];_0x414309[_0x8d36('0x76')]=qs[_0x8d36('0x3d')](_0x45ba99[_0x8d36('0x34')][_0x8d36('0x3d')]);_0x414309[_0x8d36('0x40')]=qs[_0x8d36('0x36')](_['pick'](_0x45ba99[_0x8d36('0x34')],_0x4b295c[_0x8d36('0x36')]));if(_0x45ba99[_0x8d36('0x34')]['filter']){_0x414309[_0x8d36('0x40')]=_[_0x8d36('0x41')](_0x414309[_0x8d36('0x40')],{'$or':_[_0x8d36('0x2e')](_0x414309[_0x8d36('0x39')],function(_0x5def3f){var _0x15f685={};_0x15f685[_0x5def3f]={'$like':'%'+_0x45ba99['query']['filter']+'%'};return _0x15f685;})});}_0x414309=_[_0x8d36('0x41')]({},_0x414309,_0x45ba99[_0x8d36('0x43')]);return _0x21a677[_0x8d36('0x77')](_0x414309);}})[_0x8d36('0x26')](function(_0x147a17){if(_0x147a17){_0x151b32=_0x147a17[_0x8d36('0x3b')];if(!_0x45ba99[_0x8d36('0x34')][_0x8d36('0x3c')](_0x8d36('0x78'))){_0x414309[_0x8d36('0x21')]=qs[_0x8d36('0x21')](_0x45ba99['query'][_0x8d36('0x21')]);_0x414309[_0x8d36('0x20')]=qs[_0x8d36('0x20')](_0x45ba99['query']['offset']);}return _0x21a677[_0x8d36('0x77')](_0x414309);}})[_0x8d36('0x26')](function(_0x717aa5){if(_0x717aa5){return _0x717aa5?{'count':_0x151b32,'rows':_0x717aa5}:null;}})[_0x8d36('0x26')](respondWithResult(_0x41d09e,null))['catch'](handleError(_0x41d09e,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1e3262d..d5c03e7 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x2b9f7e,_0x5c5605){var _0x30b9d6=function(_0x1eec57){while(--_0x1eec57){_0x2b9f7e['push'](_0x2b9f7e['shift']());}};_0x30b9d6(++_0x5c5605);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xcb91[_0x3c8e9a];return _0x2d4c57;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x2c0f,_0x1139bf){var _0x7d684e=function(_0x25bf49){while(--_0x25bf49){_0x2c0f['push'](_0x2c0f['shift']());}};_0x7d684e(++_0x1139bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcb91[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index c4035ec..77ae8dc 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 _0x1304=['exports','define','VoicePrefix','util','api','bluebird','request-promise','path','rimraf','./voicePrefix.attributes'];(function(_0x4611bb,_0x16f2a7){var _0x4ab34a=function(_0x2f28c6){while(--_0x2f28c6){_0x4611bb['push'](_0x4611bb['shift']());}};_0x4ab34a(++_0x16f2a7);}(_0x1304,0xa3));var _0x4130=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1304[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x4130('0x0'));var logger=require('../../config/logger')(_0x4130('0x1'));var moment=require('moment');var BPromise=require(_0x4130('0x2'));var rp=require(_0x4130('0x3'));var fs=require('fs');var path=require(_0x4130('0x4'));var rimraf=require(_0x4130('0x5'));var config=require('../../config/environment');var attributes=require(_0x4130('0x6'));module[_0x4130('0x7')]=function(_0x1954af,_0x31b481){return _0x1954af[_0x4130('0x8')](_0x4130('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c72=['path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','request-promise'];(function(_0x14ffc2,_0xa44ba){var _0x444202=function(_0x38162e){while(--_0x38162e){_0x14ffc2['push'](_0x14ffc2['shift']());}};_0x444202(++_0xa44ba);}(_0x8c72,0x151));var _0x28c7=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x8c72[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0x28c7('0x0'));var util=require('util');var logger=require(_0x28c7('0x1'))(_0x28c7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28c7('0x3'));var fs=require('fs');var path=require(_0x28c7('0x4'));var rimraf=require(_0x28c7('0x5'));var config=require('../../config/environment');var attributes=require(_0x28c7('0x6'));module[_0x28c7('0x7')]=function(_0x182b42,_0x168574){return _0x182b42[_0x28c7('0x8')](_0x28c7('0x9'),attributes,{'tableName':_0x28c7('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 a566378..3f6327f 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 _0x7181=['socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x7181,0xb1));var _0x1718=function(_0x16c467,_0x53d6fa){_0x16c467=_0x16c467-0x0;var _0x22db4f=_0x7181[_0x16c467];return _0x22db4f;};'use strict';var _=require('lodash');var util=require(_0x1718('0x0'));var moment=require('moment');var BPromise=require(_0x1718('0x1'));var rs=require(_0x1718('0x2'));var fs=require('fs');var Redis=require(_0x1718('0x3'));var db=require(_0x1718('0x4'))['db'];var utils=require(_0x1718('0x5'));var logger=require('../../config/logger')(_0x1718('0x6'));var config=require(_0x1718('0x7'));var jayson=require(_0x1718('0x8'));var client=jayson[_0x1718('0x9')]['http']({'port':0x232a});config[_0x1718('0xa')]=_[_0x1718('0xb')](config[_0x1718('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1718('0xc'))(new Redis(config[_0x1718('0xa')]));require(_0x1718('0xd'))[_0x1718('0xe')](socket);function respondWithRpcPromise(_0x45b6db,_0x15141f,_0x34f5d3){return new BPromise(function(_0x91409a,_0x3c838c){return client[_0x1718('0xf')](_0x45b6db,_0x34f5d3)[_0x1718('0x10')](function(_0x2700e4){logger[_0x1718('0x11')](_0x1718('0x12'),_0x15141f,_0x1718('0x13'));logger[_0x1718('0x14')](_0x1718('0x15'),_0x15141f,'request\x20sent',JSON[_0x1718('0x16')](_0x2700e4));if(_0x2700e4[_0x1718('0x17')]){if(_0x2700e4[_0x1718('0x17')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x15141f,_0x2700e4[_0x1718('0x17')][_0x1718('0x18')]);return _0x3c838c(_0x2700e4['error'][_0x1718('0x18')]);}logger['error'](_0x1718('0x12'),_0x15141f,_0x2700e4[_0x1718('0x17')][_0x1718('0x18')]);return _0x91409a(_0x2700e4[_0x1718('0x17')][_0x1718('0x18')]);}else{logger[_0x1718('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x15141f,_0x1718('0x13'));_0x91409a(_0x2700e4[_0x1718('0x19')][_0x1718('0x18')]);}})[_0x1718('0x1a')](function(_0x34bc0f){logger[_0x1718('0x17')](_0x1718('0x12'),_0x15141f,_0x34bc0f);_0x3c838c(_0x34bc0f);});});} \ No newline at end of file +var _0xb524=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','then'];(function(_0x1728af,_0x26d2a9){var _0x393882=function(_0x17f01a){while(--_0x17f01a){_0x1728af['push'](_0x1728af['shift']());}};_0x393882(++_0x26d2a9);}(_0xb524,0xb2));var _0x4b52=function(_0x2e243c,_0x24fe21){_0x2e243c=_0x2e243c-0x0;var _0x4f91eb=_0xb524[_0x2e243c];return _0x4f91eb;};'use strict';var _=require('lodash');var util=require(_0x4b52('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4b52('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4b52('0x2'));var logger=require('../../config/logger')(_0x4b52('0x3'));var config=require(_0x4b52('0x4'));var jayson=require(_0x4b52('0x5'));var client=jayson[_0x4b52('0x6')][_0x4b52('0x7')]({'port':0x232a});config['redis']=_[_0x4b52('0x8')](config[_0x4b52('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b52('0xa'))(new Redis(config[_0x4b52('0x9')]));require(_0x4b52('0xb'))[_0x4b52('0xc')](socket);function respondWithRpcPromise(_0x40068b,_0x4fd61c,_0x1342cc){return new BPromise(function(_0xeb276d,_0xad343e){return client['request'](_0x40068b,_0x1342cc)[_0x4b52('0xd')](function(_0x308fc2){logger[_0x4b52('0xe')](_0x4b52('0xf'),_0x4fd61c,_0x4b52('0x10'));logger[_0x4b52('0x11')](_0x4b52('0x12'),_0x4fd61c,_0x4b52('0x10'),JSON[_0x4b52('0x13')](_0x308fc2));if(_0x308fc2['error']){if(_0x308fc2[_0x4b52('0x14')][_0x4b52('0x15')]===0x1f4){logger[_0x4b52('0x14')](_0x4b52('0xf'),_0x4fd61c,_0x308fc2[_0x4b52('0x14')][_0x4b52('0x16')]);return _0xad343e(_0x308fc2[_0x4b52('0x14')]['message']);}logger[_0x4b52('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4fd61c,_0x308fc2['error'][_0x4b52('0x16')]);return _0xeb276d(_0x308fc2[_0x4b52('0x14')][_0x4b52('0x16')]);}else{logger[_0x4b52('0xe')](_0x4b52('0xf'),_0x4fd61c,'request\x20sent');_0xeb276d(_0x308fc2[_0x4b52('0x17')][_0x4b52('0x16')]);}})['catch'](function(_0x1ac8db){logger[_0x4b52('0x14')](_0x4b52('0xf'),_0x4fd61c,_0x1ac8db);_0xad343e(_0x1ac8db);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 99ce99f..02da784 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 _0xfc6c=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x2f868e,_0x37c2d6){var _0x5b8be5=function(_0x228332){while(--_0x228332){_0x2f868e['push'](_0x2f868e['shift']());}};_0x5b8be5(++_0x37c2d6);}(_0xfc6c,0x112));var _0xcfc6=function(_0x27c383,_0x284463){_0x27c383=_0x27c383-0x0;var _0x1143a9=_0xfc6c[_0x27c383];return _0x1143a9;};'use strict';var VoicePrefixEvents=require(_0xcfc6('0x0'));var events=[_0xcfc6('0x1'),_0xcfc6('0x2'),_0xcfc6('0x3')];function createListener(_0x450c0c,_0x666095){return function(_0x2d7040){_0x666095[_0xcfc6('0x4')](_0x450c0c,_0x2d7040);};}function removeListener(_0x41c128,_0x3f6ca5){return function(){VoicePrefixEvents['removeListener'](_0x41c128,_0x3f6ca5);};}exports[_0xcfc6('0x5')]=function(_0x15fde7){for(var _0x4de8c0=0x0,_0x1e0e0c=events[_0xcfc6('0x6')];_0x4de8c0<_0x1e0e0c;_0x4de8c0++){var _0x319400=events[_0x4de8c0];var _0x1fb396=createListener(_0xcfc6('0x7')+_0x319400,_0x15fde7);VoicePrefixEvents['on'](_0x319400,_0x1fb396);}}; \ No newline at end of file +var _0xce97=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xce97,0x129));var _0x7ce9=function(_0x3a4c3e,_0x9a007a){_0x3a4c3e=_0x3a4c3e-0x0;var _0x2505e7=_0xce97[_0x3a4c3e];return _0x2505e7;};'use strict';var VoicePrefixEvents=require(_0x7ce9('0x0'));var events=[_0x7ce9('0x1'),_0x7ce9('0x2'),_0x7ce9('0x3')];function createListener(_0x4af14f,_0x564ac2){return function(_0x2002cb){_0x564ac2[_0x7ce9('0x4')](_0x4af14f,_0x2002cb);};}function removeListener(_0x5ade7e,_0x46735f){return function(){VoicePrefixEvents[_0x7ce9('0x5')](_0x5ade7e,_0x46735f);};}exports[_0x7ce9('0x6')]=function(_0x25904d){for(var _0x7a1dc=0x0,_0x222aa8=events[_0x7ce9('0x7')];_0x7a1dc<_0x222aa8;_0x7a1dc++){var _0x440ce7=events[_0x7a1dc];var _0x41fe4d=createListener(_0x7ce9('0x8')+_0x440ce7,_0x25904d);VoicePrefixEvents['on'](_0x440ce7,_0x41fe4d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8bae7b2..e59784f 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 _0xee54=['post','/:id/clone','clone','/:id/teams','addTeams','addLists','addBlackLists','put','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists'];(function(_0x4006a6,_0x393e85){var _0x588a78=function(_0x5a4058){while(--_0x5a4058){_0x4006a6['push'](_0x4006a6['shift']());}};_0x588a78(++_0x393e85);}(_0xee54,0x120));var _0x4ee5=function(_0x3ad848,_0x316e80){_0x3ad848=_0x3ad848-0x0;var _0x3f6f91=_0xee54[_0x3ad848];return _0x3f6f91;};'use strict';var multer=require(_0x4ee5('0x0'));var util=require('util');var path=require(_0x4ee5('0x1'));var timeout=require(_0x4ee5('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4ee5('0x3'));var interaction=require(_0x4ee5('0x4'));var config=require(_0x4ee5('0x5'));var controller=require(_0x4ee5('0x6'));router[_0x4ee5('0x7')]('/',auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x9')]);router[_0x4ee5('0x7')](_0x4ee5('0xa'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0xb')]);router[_0x4ee5('0x7')](_0x4ee5('0xc'),auth[_0x4ee5('0x8')](),controller['getHoppers']);router[_0x4ee5('0x7')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x4ee5('0x7')]('/:id/hopper_finals',auth[_0x4ee5('0x8')](),controller[_0x4ee5('0xd')]);router[_0x4ee5('0x7')](_0x4ee5('0xe'),auth['isAuthenticated'](),controller[_0x4ee5('0xf')]);router[_0x4ee5('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4ee5('0x10')]);router['get'](_0x4ee5('0x11'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x12')]);router['get'](_0x4ee5('0x13'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x14')]);router[_0x4ee5('0x7')](_0x4ee5('0x15'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x16')]);router[_0x4ee5('0x7')](_0x4ee5('0x17'),auth[_0x4ee5('0x8')](),controller['getBlackLists']);router[_0x4ee5('0x18')]('/',auth[_0x4ee5('0x8')](),controller['create']);router[_0x4ee5('0x18')](_0x4ee5('0x19'),auth['isAuthenticated'](),controller[_0x4ee5('0x1a')]);router[_0x4ee5('0x18')](_0x4ee5('0x1b'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x1c')]);router[_0x4ee5('0x18')](_0x4ee5('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x4ee5('0x15'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x1d')]);router[_0x4ee5('0x18')]('/:id/blacklists',auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x1e')]);router[_0x4ee5('0x1f')](_0x4ee5('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4ee5('0x20')]('/:id',auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x21')]);router[_0x4ee5('0x20')]('/:id/teams',auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x22')]);router[_0x4ee5('0x20')](_0x4ee5('0x11'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x23')]);router[_0x4ee5('0x20')](_0x4ee5('0x15'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x24')]);router[_0x4ee5('0x20')](_0x4ee5('0x17'),auth[_0x4ee5('0x8')](),controller[_0x4ee5('0x25')]);module[_0x4ee5('0x26')]=router; \ No newline at end of file +var _0xcb9a=['get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','put','update','delete','destroy','removeAgents','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x253795,_0x582fe0){var _0x5cc476=function(_0x4bc74c){while(--_0x4bc74c){_0x253795['push'](_0x253795['shift']());}};_0x5cc476(++_0x582fe0);}(_0xcb9a,0xc9));var _0xacb9=function(_0x365296,_0x4a8e50){_0x365296=_0x365296-0x0;var _0x205033=_0xcb9a[_0x365296];return _0x205033;};'use strict';var multer=require(_0xacb9('0x0'));var util=require(_0xacb9('0x1'));var path=require(_0xacb9('0x2'));var timeout=require(_0xacb9('0x3'));var express=require(_0xacb9('0x4'));var router=express[_0xacb9('0x5')]();var auth=require(_0xacb9('0x6'));var interaction=require(_0xacb9('0x7'));var config=require(_0xacb9('0x8'));var controller=require('./voiceQueue.controller');router[_0xacb9('0x9')]('/',auth[_0xacb9('0xa')](),controller[_0xacb9('0xb')]);router[_0xacb9('0x9')](_0xacb9('0xc'),auth['isAuthenticated'](),controller[_0xacb9('0xd')]);router[_0xacb9('0x9')](_0xacb9('0xe'),auth[_0xacb9('0xa')](),controller[_0xacb9('0xf')]);router[_0xacb9('0x9')](_0xacb9('0x10'),auth[_0xacb9('0xa')](),controller[_0xacb9('0x11')]);router[_0xacb9('0x9')]('/:id/hopper_finals',auth[_0xacb9('0xa')](),controller[_0xacb9('0x12')]);router[_0xacb9('0x9')]('/:id/hopper_black',auth[_0xacb9('0xa')](),controller[_0xacb9('0x13')]);router[_0xacb9('0x9')](_0xacb9('0x14'),auth['isAuthenticated'](),controller[_0xacb9('0x15')]);router[_0xacb9('0x9')](_0xacb9('0x16'),auth[_0xacb9('0xa')](),controller['getAgents']);router[_0xacb9('0x9')](_0xacb9('0x17'),auth[_0xacb9('0xa')](),controller[_0xacb9('0x18')]);router[_0xacb9('0x9')](_0xacb9('0x19'),auth[_0xacb9('0xa')](),controller[_0xacb9('0x1a')]);router[_0xacb9('0x9')](_0xacb9('0x1b'),auth['isAuthenticated'](),controller[_0xacb9('0x1c')]);router[_0xacb9('0x1d')]('/',auth['isAuthenticated'](),controller[_0xacb9('0x1e')]);router[_0xacb9('0x1d')](_0xacb9('0x1f'),auth[_0xacb9('0xa')](),controller['clone']);router['post'](_0xacb9('0x14'),auth[_0xacb9('0xa')](),controller[_0xacb9('0x20')]);router['post'](_0xacb9('0x16'),auth[_0xacb9('0xa')](),controller[_0xacb9('0x21')]);router[_0xacb9('0x1d')]('/:id/lists',auth[_0xacb9('0xa')](),controller[_0xacb9('0x22')]);router[_0xacb9('0x1d')](_0xacb9('0x1b'),auth[_0xacb9('0xa')](),controller['addBlackLists']);router[_0xacb9('0x23')](_0xacb9('0xc'),auth['isAuthenticated'](),controller[_0xacb9('0x24')]);router[_0xacb9('0x25')]('/:id',auth[_0xacb9('0xa')](),controller[_0xacb9('0x26')]);router[_0xacb9('0x25')](_0xacb9('0x14'),auth[_0xacb9('0xa')](),controller['removeTeams']);router[_0xacb9('0x25')](_0xacb9('0x16'),auth[_0xacb9('0xa')](),controller[_0xacb9('0x27')]);router[_0xacb9('0x25')]('/:id/lists',auth[_0xacb9('0xa')](),controller[_0xacb9('0x28')]);router[_0xacb9('0x25')](_0xacb9('0x1b'),auth['isAuthenticated'](),controller[_0xacb9('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 7a05e4c..f18b545 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 _0x92d9=['getDataValue','type','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','inbound','outbound','STRING','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue'];(function(_0x5dfc04,_0x50fc8e){var _0x14b516=function(_0x543467){while(--_0x543467){_0x5dfc04['push'](_0x5dfc04['shift']());}};_0x14b516(++_0x50fc8e);}(_0x92d9,0x7f));var _0x992d=function(_0x8400d5,_0x1fedfb){_0x8400d5=_0x8400d5-0x0;var _0x4b6b37=_0x92d9[_0x8400d5];return _0x4b6b37;};'use strict';var Sequelize=require('sequelize');module[_0x992d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x992d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x992d('0x2'),_0x992d('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x992d('0x4')],'defaultValue':_0x992d('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x992d('0x6')]('rr',_0x992d('0x7'),_0x992d('0x8'),_0x992d('0x9'),_0x992d('0xa'),_0x992d('0xb'),_0x992d('0xc'),'wrandom',_0x992d('0xd')),'allowNull':![],'defaultValue':_0x992d('0x7'),'set':function(_0x30cacd){this[_0x992d('0xe')]('strategy',_0x30cacd?_0x30cacd:_0x992d('0xb'));},'get':function(){var _0x517c6e=this[_0x992d('0xf')](_0x992d('0x10'));var _0x3a4e6f=this[_0x992d('0xf')]('dialMethod');var _0x25cd0c=this[_0x992d('0xf')](_0x992d('0x11'));if(_0x517c6e===_0x992d('0x2')){return _0x25cd0c;}if(_0x3a4e6f===_0x992d('0x12')&&_0x25cd0c===_0x992d('0xb')||_0x3a4e6f===_0x992d('0x12')&&_0x25cd0c===_0x992d('0x13')){return _0x25cd0c;}if(_0x3a4e6f===_0x992d('0x14')||_0x3a4e6f===_0x992d('0x15')||_0x3a4e6f===_0x992d('0x16')){return _0x25cd0c;}return null;}},'servicelevel':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x992d('0x4')]},'weight':{'type':Sequelize[_0x992d('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x992d('0x6')]('yes','no'),'defaultValue':_0x992d('0x18')},'autopause':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no',_0x992d('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x992d('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x992d('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x992d('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x992d('0x6')]('yes','no'),'defaultValue':_0x992d('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x992d('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x992d('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x992d('0x6')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x992d('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x992d('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x992d('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x992d('0x4')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x992d('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x992d('0x4')]},'queue_quantity2':{'type':Sequelize[_0x992d('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x992d('0x4')]},'queue_less_than':{'type':Sequelize[_0x992d('0x4')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xdfafaf){this[_0x992d('0xe')](_0x992d('0x1a'),_0xdfafaf?_0xdfafaf[_0x992d('0x1b')](','):[]);},'get':function(){return this[_0x992d('0xf')](_0x992d('0x1a'))?this[_0x992d('0xf')](_0x992d('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x992d('0x18'),'set':function(_0x538ed3){this[_0x992d('0xe')]('joinempty',_0x538ed3?_0x538ed3['join'](','):undefined);},'get':function(){return this[_0x992d('0xf')](_0x992d('0x1c'))?this['getDataValue'](_0x992d('0x1c'))[_0x992d('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x992d('0x4')],'defaultValue':'no','set':function(_0x390715){this[_0x992d('0xe')]('leavewhenempty',_0x390715?_0x390715[_0x992d('0x1b')](','):undefined);},'get':function(){return this[_0x992d('0xf')](_0x992d('0x1e'))?this['getDataValue'](_0x992d('0x1e'))[_0x992d('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x992d('0x6')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x992d('0x4')]},'description':{'type':Sequelize[_0x992d('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x23755f){this[_0x992d('0xe')]('acw',_0x23755f);if(_0x23755f){if(this[_0x992d('0xf')](_0x992d('0x1f'))<0x2){this[_0x992d('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x992d('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x992d('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0x992d('0x21'),'progressive',_0x992d('0x16'),_0x992d('0x15'),_0x992d('0x12')),'defaultValue':'progressive','comment':_0x992d('0x22')},'dialLimitChannel':{'type':Sequelize[_0x992d('0x17')](0x4)[_0x992d('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x992d('0x24')},'dialLimitQueue':{'type':Sequelize[_0x992d('0x17')](0x4)[_0x992d('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x992d('0x25')](0x2)[_0x992d('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x992d('0x26'),_0x992d('0x27')),'defaultValue':_0x992d('0x27'),'comment':_0x992d('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x992d('0x25')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x992d('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x992d('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x992d('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x992d('0x2b'),'comment':_0x992d('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x992d('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x992d('0x2d')},'dialQueueProject':{'type':Sequelize[_0x992d('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x992d('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x992d('0x17')](0x5)[_0x992d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x992d('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x992d('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x992d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x992d('0x17')](0x5)[_0x992d('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x992d('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x992d('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x992d('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x992d('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x33'),_0x992d('0x34'),'onlyIfOpen'),'defaultValue':_0x992d('0x33')},'dialAMDActive':{'type':Sequelize[_0x992d('0x35')],'defaultValue':0x0,'comment':_0x992d('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x992d('0x17')](0x9)[_0x992d('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x992d('0x17')](0x9)[_0x992d('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x992d('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x992d('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x992d('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x992d('0x17')](0x9)[_0x992d('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x992d('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x992d('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x992d('0x17')](0x9)[_0x992d('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x992d('0x17')](0x9)[_0x992d('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x992d('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x992d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x992d('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x992d('0x17')](0x9)[_0x992d('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x992d('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x992d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x992d('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x992d('0x35')],'defaultValue':0x0,'comment':_0x992d('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x992d('0x6')](_0x992d('0x3f'),_0x992d('0x40')),'defaultValue':_0x992d('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x992d('0x4')],'comment':_0x992d('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x992d('0x35')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x992d('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x992d('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x992d('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x992d('0x43')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x992d('0x44'),'set':function(_0x2f4aa8){if(!_0x2f4aa8)this[_0x992d('0xe')](_0x992d('0x45'),null);this[_0x992d('0xe')](_0x992d('0x46'),_0x2f4aa8);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x992d('0x17')](0x3)[_0x992d('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xd03d=['always','onlyIfOpen','Active/Disactive\x20AMD','#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)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0xd03d,0xeb));var _0xdd03=function(_0x12c2d9,_0x38255b){_0x12c2d9=_0x12c2d9-0x0;var _0x59b18e=_0xd03d[_0x12c2d9];return _0x59b18e;};'use strict';var Sequelize=require(_0xdd03('0x0'));module[_0xdd03('0x1')]={'name':{'type':Sequelize[_0xdd03('0x2')],'allowNull':![],'unique':_0xdd03('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x5'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':_0xdd03('0x6')},'announce':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xdd03('0x4')]('rr',_0xdd03('0x7'),'leastrecent','fewestcalls',_0xdd03('0x8'),_0xdd03('0x9'),_0xdd03('0xa'),_0xdd03('0xb'),_0xdd03('0xc')),'allowNull':![],'defaultValue':_0xdd03('0x7'),'set':function(_0x3793c2){this[_0xdd03('0xd')]('strategy',_0x3793c2?_0x3793c2:_0xdd03('0x9'));},'get':function(){var _0x53885a=this[_0xdd03('0xe')](_0xdd03('0xf'));var _0x3c0a40=this[_0xdd03('0xe')]('dialMethod');var _0x373f92=this[_0xdd03('0xe')](_0xdd03('0x10'));if(_0x53885a==='inbound'){return _0x373f92;}if(_0x3c0a40===_0xdd03('0x11')&&_0x373f92===_0xdd03('0x9')||_0x3c0a40===_0xdd03('0x11')&&_0x373f92===_0xdd03('0x12')){return _0x373f92;}if(_0x3c0a40===_0xdd03('0x13')||_0x3c0a40===_0xdd03('0x14')||_0x3c0a40===_0xdd03('0x15')){return _0x373f92;}return null;}},'servicelevel':{'type':Sequelize[_0xdd03('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdd03('0x16')](0xb)},'timeout':{'type':Sequelize[_0xdd03('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdd03('0x2')]},'weight':{'type':Sequelize[_0xdd03('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xdd03('0x4')]('yes','no',_0xdd03('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xdd03('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdd03('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdd03('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdd03('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdd03('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xdd03('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xdd03('0x17'),'no'),'defaultValue':_0xdd03('0x17')},'announce_holdtime':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xdd03('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdd03('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdd03('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdd03('0x2')]},'queue_quantity1':{'type':Sequelize[_0xdd03('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xdd03('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xdd03('0x19')],'set':function(_0x225871){this['setDataValue']('periodic_announce',_0x225871?_0x225871['join'](','):[]);},'get':function(){return this['getDataValue'](_0xdd03('0x1a'))?this['getDataValue'](_0xdd03('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xdd03('0x17'),'set':function(_0x1fc160){this[_0xdd03('0xd')]('joinempty',_0x1fc160?_0x1fc160[_0xdd03('0x1b')](','):undefined);},'get':function(){return this[_0xdd03('0xe')](_0xdd03('0x1c'))?this[_0xdd03('0xe')](_0xdd03('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x445e91){this['setDataValue'](_0xdd03('0x1d'),_0x445e91?_0x445e91[_0xdd03('0x1b')](','):undefined);},'get':function(){return this[_0xdd03('0xe')]('leavewhenempty')?this[_0xdd03('0xe')]('leavewhenempty')[_0xdd03('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xdd03('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdd03('0x2')]},'description':{'type':Sequelize[_0xdd03('0x2')]},'acw':{'type':Sequelize[_0xdd03('0x1f')],'defaultValue':0x0,'set':function(_0x3bbc7a){this[_0xdd03('0xd')]('acw',_0x3bbc7a);if(_0x3bbc7a){if(this[_0xdd03('0xe')](_0xdd03('0x20'))<0x2){this['setDataValue'](_0xdd03('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdd03('0x1f')],'defaultValue':0x0,'comment':_0xdd03('0x21')},'dialMethod':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x22'),'progressive',_0xdd03('0x15'),'predictive',_0xdd03('0x11')),'defaultValue':_0xdd03('0x13'),'comment':_0xdd03('0x23')},'dialLimitChannel':{'type':Sequelize[_0xdd03('0x16')](0x4)[_0xdd03('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xdd03('0x16')](0x4)[_0xdd03('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdd03('0x25')},'dialPowerLevel':{'type':Sequelize[_0xdd03('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdd03('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xdd03('0x28')),'defaultValue':_0xdd03('0x28'),'comment':_0xdd03('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdd03('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdd03('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xdd03('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xdd03('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xdd03('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd03('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':_0xdd03('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd03('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xdd03('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xdd03('0x16')](0x3)[_0xdd03('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd03('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdd03('0x16')](0x5)[_0xdd03('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd03('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd03('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd03('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdd03('0x16')](0x5)[_0xdd03('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdd03('0x16')](0x3)[_0xdd03('0x24')],'defaultValue':0x3,'comment':_0xdd03('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdd03('0x16')](0x5)[_0xdd03('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd03('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdd03('0x16')](0x3)[_0xdd03('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdd03('0x34')},'dialTimezone':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xdd03('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdd03('0x4')](_0xdd03('0x35'),'never',_0xdd03('0x36')),'defaultValue':_0xdd03('0x35')},'dialAMDActive':{'type':Sequelize[_0xdd03('0x1f')],'defaultValue':0x0,'comment':_0xdd03('0x37')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdd03('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xdd03('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdd03('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdd03('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdd03('0x16')](0x9)[_0xdd03('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd03('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xdd03('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdd03('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdd03('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdd03('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdd03('0x16')](0x9)[_0xdd03('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdd03('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdd03('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdd03('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd03('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xdd03('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xdd03('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xdd03('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdd03('0x41'),'ASC'),'defaultValue':_0xdd03('0x41')},'dialQueueProject2':{'type':Sequelize[_0xdd03('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdd03('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdd03('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd03('0x42')},'dialCutDigit':{'type':Sequelize[_0xdd03('0x16')](0x3)[_0xdd03('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd03('0x43')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd03('0x16')],'allowNull':!![],'comment':_0xdd03('0x44')},'mandatoryDisposition':{'type':Sequelize[_0xdd03('0x1f')],'defaultValue':![],'comment':_0xdd03('0x45'),'set':function(_0x3d386f){if(!_0x3d386f)this[_0xdd03('0xd')](_0xdd03('0x46'),null);this[_0xdd03('0xd')](_0xdd03('0x47'),_0x3d386f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdd03('0x16')](0x3)[_0xdd03('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xdd03('0x16')](0x3)[_0xdd03('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e0633ef..17eb8eb 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 _0x492f=['nolimit','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','interface','flatMap','penalty','sequelize','each','UserVoiceQueueRt','upsert','isNil','SIP/%s','forEach','select','field','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','online','push','format','all','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','NOW()','scheduledAt','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','ListId\x20=\x20?','removeBlackLists','html-pdf','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','fields','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','omit','getHoppers','findOne','CmHopper'];(function(_0x2f3e2f,_0x32aaf8){var _0x23cd4a=function(_0x4deaee){while(--_0x4deaee){_0x2f3e2f['push'](_0x2f3e2f['shift']());}};_0x23cd4a(++_0x32aaf8);}(_0x492f,0x103));var _0xf492=function(_0x1f689e,_0x1c3e0d){_0x1f689e=_0x1f689e-0x0;var _0x535029=_0x492f[_0x1f689e];return _0x535029;};'use strict';var pdf=require(_0xf492('0x0'));var emlformat=require(_0xf492('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf492('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf492('0x3'));var moment=require(_0xf492('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf492('0x5'));var sox=require(_0xf492('0x6'));var csv=require(_0xf492('0x7'));var ejs=require(_0xf492('0x8'));var fs=require('fs');var _=require(_0xf492('0x9'));var squel=require('squel');var crypto=require(_0xf492('0xa'));var jsforce=require(_0xf492('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf492('0x7'));var querystring=require(_0xf492('0xc'));var Papa=require(_0xf492('0xd'));var Redis=require(_0xf492('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf492('0xf'));var as=require(_0xf492('0x10'));var hardwareService=require(_0xf492('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf492('0x12'));var db=require(_0xf492('0x13'))['db'];config[_0xf492('0x14')]=_[_0xf492('0x15')](config[_0xf492('0x14')],{'host':_0xf492('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0xf492('0x17')](socket);function respondWithStatusCode(_0x9bb935,_0x5da8de){_0x5da8de=_0x5da8de||0xcc;return function(_0x381ef3){if(_0x381ef3){return _0x9bb935[_0xf492('0x18')](_0x5da8de);}return _0x9bb935[_0xf492('0x19')](_0x5da8de)[_0xf492('0x1a')]();};}function respondWithResult(_0x1c2d78,_0x5e2509){_0x5e2509=_0x5e2509||0xc8;return function(_0x311cd8){if(_0x311cd8){return _0x1c2d78[_0xf492('0x19')](_0x5e2509)[_0xf492('0x1b')](_0x311cd8);}};}function respondWithFilteredResult(_0x4c62db,_0x17ae46){return function(_0x1e857c){if(_0x1e857c){var _0x35dbfe=_0x1e857c[_0xf492('0x1c')],_0x2d4124=_0x17ae46[_0xf492('0x1d')],_0x1de63a=_0x17ae46[_0xf492('0x1d')]+_0x17ae46[_0xf492('0x1e')],_0x29d5f3;if(_0x1de63a>=_0x35dbfe){_0x1de63a=_0x35dbfe;_0x29d5f3=0xc8;}else{_0x29d5f3=0xce;}_0x4c62db[_0xf492('0x19')](_0x29d5f3);return _0x4c62db[_0xf492('0x1f')]('Content-Range',_0x2d4124+'-'+_0x1de63a+'/'+_0x35dbfe)[_0xf492('0x1b')](_0x1e857c);}return null;};}function patchUpdates(_0x4aa832){return function(_0x2adcd1){try{jsonpatch[_0xf492('0x20')](_0x2adcd1,_0x4aa832,!![]);}catch(_0x4ff62c){return BPromise[_0xf492('0x21')](_0x4ff62c);}return _0x2adcd1[_0xf492('0x22')]();};}function saveUpdates(_0xd2033d,_0x1e11e7){return function(_0x2a89fb){if(_0x2a89fb){return _0x2a89fb[_0xf492('0x23')](_0xd2033d)[_0xf492('0x24')](function(_0x3f9310){return _0x3f9310;});}return null;};}function removeEntity(_0x378b67,_0x483796){return function(_0x27bbe4){if(_0x27bbe4){return _0x27bbe4[_0xf492('0x25')]()[_0xf492('0x24')](function(){var _0x30c0e2=_0x27bbe4['get']({'plain':!![]});var _0xba7a42=[{'name':_0xf492('0x26'),'value':_0xf492('0x27'),'ignore':![]},{'name':'QueueCampaigns','value':_0xf492('0x28'),'ignore':![]}];var _0x5ab005=_(_0xba7a42)['filter'](_0xf492('0x29'))[_0xf492('0x2a')](_0xf492('0x2b'))[_0xf492('0x2b')]();if(_[_0xf492('0x2c')](_0x5ab005,_0x30c0e2[_0xf492('0x2d')])){return;}var _0x342dbc=_[_0xf492('0x2e')](_0xba7a42,[_0xf492('0x2b'),_0x30c0e2[_0xf492('0x2d')]])['name'];return db[_0xf492('0x2f')][_0xf492('0x25')]({'where':{'type':_0x342dbc,'resourceId':_0x30c0e2['id']}})[_0xf492('0x24')](function(){return _0x27bbe4;});})['then'](function(){_0x378b67[_0xf492('0x19')](0xcc)[_0xf492('0x1a')]();});}};}function handleEntityNotFound(_0x45b175,_0x5d3f66){return function(_0x544fb7){if(!_0x544fb7){_0x45b175['sendStatus'](0x194);}return _0x544fb7;};}function handleError(_0x2c07a7,_0x4ff272){_0x4ff272=_0x4ff272||0x1f4;return function(_0x54b786){logger[_0xf492('0x30')](_0x54b786[_0xf492('0x31')]);if(_0x54b786[_0xf492('0x32')]){delete _0x54b786[_0xf492('0x32')];}_0x2c07a7[_0xf492('0x19')](_0x4ff272)[_0xf492('0x33')](_0x54b786);};}exports[_0xf492('0x34')]=function(_0x2e98e7,_0x10f0f2){var _0x3b0f1a={},_0x3678a8={},_0xdce339={'count':0x0,'rows':[]};var _0x5ce554=_[_0xf492('0x2a')](db[_0xf492('0x35')][_0xf492('0x36')],function(_0x4937da){return{'name':_0x4937da[_0xf492('0x37')],'type':_0x4937da[_0xf492('0x2d')]['key']};});_0x3678a8[_0xf492('0x38')]=_[_0xf492('0x2a')](_0x5ce554,'name');_0x3678a8[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x2e98e7[_0xf492('0x39')]);_0x3678a8[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x3678a8[_0xf492('0x38')],_0x3678a8[_0xf492('0x39')]);_0x3b0f1a[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x3678a8['model'],qs['fields'](_0x2e98e7[_0xf492('0x39')]['fields']));_0x3b0f1a['attributes']=_0x3b0f1a[_0xf492('0x3d')][_0xf492('0x3e')]?_0x3b0f1a[_0xf492('0x3d')]:_0x3678a8[_0xf492('0x38')];if(!_0x2e98e7[_0xf492('0x39')][_0xf492('0x3f')]('nolimit')){_0x3b0f1a[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x2e98e7[_0xf492('0x39')][_0xf492('0x1e')]);_0x3b0f1a[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x2e98e7[_0xf492('0x39')]['offset']);}_0x3b0f1a[_0xf492('0x40')]=qs['sort'](_0x2e98e7[_0xf492('0x39')][_0xf492('0x41')]);_0x3b0f1a[_0xf492('0x42')]=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x2e98e7[_0xf492('0x39')],_0x3678a8[_0xf492('0x3b')]),_0x5ce554);if(_0x2e98e7[_0xf492('0x39')]['filter']){_0x3b0f1a[_0xf492('0x42')]=_[_0xf492('0x44')](_0x3b0f1a['where'],{'$or':_[_0xf492('0x2a')](_0x5ce554,function(_0x5ded8e){if(_0x5ded8e[_0xf492('0x2d')]!==_0xf492('0x45')){var _0x4222b8={};_0x4222b8[_0x5ded8e['name']]={'$like':'%'+_0x2e98e7[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x4222b8;}})});}_0x3b0f1a=_['merge']({},_0x3b0f1a,_0x2e98e7['options']);var _0x45e734={'where':_0x3b0f1a[_0xf492('0x42')]};return db['VoiceQueue']['count'](_0x45e734)['then'](function(_0x564b8d){_0xdce339['count']=_0x564b8d;if(_0x2e98e7[_0xf492('0x39')][_0xf492('0x47')]){_0x3b0f1a[_0xf492('0x48')]=[{'all':!![]}];}return db[_0xf492('0x35')][_0xf492('0x49')](_0x3b0f1a);})['then'](function(_0x301520){_0xdce339['rows']=_0x301520;return _0xdce339;})[_0xf492('0x24')](respondWithFilteredResult(_0x10f0f2,_0x3b0f1a))[_0xf492('0x4a')](handleError(_0x10f0f2,null));};exports['show']=function(_0x264d35,_0x1ef926){var _0x2bab12={'raw':![],'where':{'id':_0x264d35[_0xf492('0x4b')]['id']}},_0x1bc8c7={};_0x1bc8c7['model']=_[_0xf492('0x3a')](db[_0xf492('0x35')][_0xf492('0x36')]);_0x1bc8c7['query']=_['keys'](_0x264d35[_0xf492('0x39')]);_0x1bc8c7[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1bc8c7['model'],_0x1bc8c7[_0xf492('0x39')]);_0x2bab12[_0xf492('0x3d')]=_['intersection'](_0x1bc8c7['model'],qs[_0xf492('0x4c')](_0x264d35['query'][_0xf492('0x4c')]));_0x2bab12[_0xf492('0x3d')]=_0x2bab12['attributes'][_0xf492('0x3e')]?_0x2bab12[_0xf492('0x3d')]:_0x1bc8c7[_0xf492('0x38')];if(_0x264d35[_0xf492('0x39')][_0xf492('0x47')]){_0x2bab12[_0xf492('0x48')]=[{'all':!![]}];}_0x2bab12=_[_0xf492('0x44')]({},_0x2bab12,_0x264d35[_0xf492('0x4d')]);return db[_0xf492('0x35')]['find'](_0x2bab12)[_0xf492('0x24')](handleEntityNotFound(_0x1ef926,null))[_0xf492('0x24')](respondWithResult(_0x1ef926,null))[_0xf492('0x4a')](handleError(_0x1ef926,null));};exports[_0xf492('0x4e')]=function(_0x3c8655,_0x4475d7){return db[_0xf492('0x35')][_0xf492('0x4e')](_0x3c8655['body'],{})[_0xf492('0x24')](function(_0x44fbb8){var _0x31235c=_0x3c8655[_0xf492('0x4f')][_0xf492('0x50')]({'plain':!![]});if(!_0x31235c)throw new Error(_0xf492('0x51'));if(_0x31235c[_0xf492('0x52')]===_0xf492('0x4f')){var _0x15bc8b=_0x44fbb8[_0xf492('0x50')]({'plain':!![]});var _0x2b9e57=[{'name':_0xf492('0x26'),'value':_0xf492('0x27')},{'name':_0xf492('0x53'),'value':_0xf492('0x28')}];var _0x7f171e=_[_0xf492('0x2e')](_0x2b9e57,['value',_0x15bc8b['type']])[_0xf492('0x32')];return db[_0xf492('0x54')]['find']({'where':{'name':_0x7f171e,'userProfileId':_0x31235c[_0xf492('0x55')]},'raw':!![]})[_0xf492('0x24')](function(_0x3296a4){if(_0x3296a4&&_0x3296a4[_0xf492('0x56')]===0x0){return db[_0xf492('0x2f')][_0xf492('0x4e')]({'name':_0x15bc8b[_0xf492('0x32')],'resourceId':_0x15bc8b['id'],'type':_0x3296a4[_0xf492('0x32')],'sectionId':_0x3296a4['id']},{})[_0xf492('0x24')](function(){return _0x44fbb8;});}else{return _0x44fbb8;}})[_0xf492('0x4a')](function(_0x4b363b){logger[_0xf492('0x30')](_0xf492('0x57'),_0x4b363b);throw _0x4b363b;});}return _0x44fbb8;})[_0xf492('0x24')](respondWithResult(_0x4475d7,0xc9))[_0xf492('0x4a')](handleError(_0x4475d7,null));};exports['clone']=function(_0x3ed7bb,_0x19cbe1){var _0x501936={'where':{'id':_0x3ed7bb[_0xf492('0x4b')]['id']}},_0x1c6b97={};_0x1c6b97[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x35')][_0xf492('0x36')]);_0x501936[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x1c6b97[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x3ed7bb['query'][_0xf492('0x4c')]));_0x501936[_0xf492('0x3d')]=_0x501936[_0xf492('0x3d')]['length']?_0x501936[_0xf492('0x3d')]:_0x1c6b97['model'];if(_0x3ed7bb[_0xf492('0x39')][_0xf492('0x47')]){_0x501936[_0xf492('0x48')]=[{'all':!![]}];}_0x501936=_['merge']({},_0x501936,_0x3ed7bb[_0xf492('0x4d')]);return db[_0xf492('0x35')][_0xf492('0x2e')](_0x501936)[_0xf492('0x24')](handleEntityNotFound(_0x19cbe1,null))['then'](function(_0x5d57ec){if(_0x5d57ec){var _0x101bbf=_0x5d57ec[_0xf492('0x50')]({'plain':!![]});_0x101bbf=qs['omit'](_0x101bbf,['id',_0xf492('0x58'),_0xf492('0x59')]);_0x3ed7bb[_0xf492('0x5a')]=_[_0xf492('0x5b')](_0x3ed7bb[_0xf492('0x5a')],['id',_0xf492('0x58'),_0xf492('0x59')]);return db['VoiceQueue'][_0xf492('0x4e')](_[_0xf492('0x44')](_0x101bbf,_0x3ed7bb[_0xf492('0x5a')]),{'include':_0x3ed7bb[_0xf492('0x39')][_0xf492('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x502aba){var _0x4d52ca=_0x3ed7bb[_0xf492('0x4f')][_0xf492('0x50')]({'plain':!![]});if(!_0x4d52ca)throw new Error(_0xf492('0x51'));if(_0x4d52ca[_0xf492('0x52')]===_0xf492('0x4f')){var _0x2170cd=_0x502aba[_0xf492('0x50')]({'plain':!![]});var _0x38da47=[{'name':_0xf492('0x26'),'value':'inbound'},{'name':_0xf492('0x53'),'value':_0xf492('0x28')}];var _0x5d150a=_[_0xf492('0x2e')](_0x38da47,[_0xf492('0x2b'),_0x2170cd[_0xf492('0x2d')]])[_0xf492('0x32')];return db[_0xf492('0x54')]['find']({'where':{'name':_0x5d150a,'userProfileId':_0x4d52ca[_0xf492('0x55')]},'raw':!![]})['then'](function(_0x5a9117){if(_0x5a9117&&_0x5a9117[_0xf492('0x56')]===0x0){return db[_0xf492('0x2f')][_0xf492('0x4e')]({'name':_0x2170cd[_0xf492('0x32')],'resourceId':_0x2170cd['id'],'type':_0x5a9117[_0xf492('0x32')],'sectionId':_0x5a9117['id']},{})[_0xf492('0x24')](function(){return _0x502aba;});}else{return _0x502aba;}})['catch'](function(_0x5c540f){logger[_0xf492('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c540f);throw _0x5c540f;});}return _0x502aba;});}})['then'](respondWithResult(_0x19cbe1,0xc9))['catch'](handleError(_0x19cbe1,null));};exports['update']=function(_0x139f8f,_0x2c3bc0){if(_0x139f8f[_0xf492('0x5a')]['id']){delete _0x139f8f[_0xf492('0x5a')]['id'];}return db[_0xf492('0x35')]['find']({'where':{'id':_0x139f8f[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x2c3bc0,null))['then'](saveUpdates(_0x139f8f[_0xf492('0x5a')],null))[_0xf492('0x24')](respondWithResult(_0x2c3bc0,null))['catch'](handleError(_0x2c3bc0,null));};exports[_0xf492('0x25')]=function(_0x28d4a4,_0xe9e650){return db[_0xf492('0x35')]['find']({'where':{'id':_0x28d4a4[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe9e650,null))[_0xf492('0x24')](removeEntity(_0xe9e650,null))[_0xf492('0x4a')](handleError(_0xe9e650,null));};exports[_0xf492('0x5c')]=function(_0x5b4966,_0x195f6a,_0x44f520){var _0x2fd687={'raw':![],'where':{}};var _0x1435b7={};var _0x265505={'count':0x0,'rows':[]};return db[_0xf492('0x35')][_0xf492('0x5d')]({'where':{'id':_0x5b4966['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x195f6a,null))[_0xf492('0x24')](function(_0x21d572){if(_0x21d572){_0x1435b7[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x5e')][_0xf492('0x36')]);_0x1435b7[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x5b4966['query']);_0x1435b7[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1435b7[_0xf492('0x38')],_0x1435b7[_0xf492('0x39')]);_0x2fd687[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x1435b7[_0xf492('0x38')],qs['fields'](_0x5b4966[_0xf492('0x39')][_0xf492('0x4c')]));_0x2fd687[_0xf492('0x3d')]=_0x2fd687[_0xf492('0x3d')][_0xf492('0x3e')]?_0x2fd687[_0xf492('0x3d')]:_0x1435b7[_0xf492('0x38')];if(!_0x5b4966[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x2fd687['limit']=qs['limit'](_0x5b4966[_0xf492('0x39')][_0xf492('0x1e')]);_0x2fd687[_0xf492('0x1d')]=qs['offset'](_0x5b4966[_0xf492('0x39')][_0xf492('0x1d')]);}_0x2fd687[_0xf492('0x40')]=qs['sort'](_0x5b4966[_0xf492('0x39')][_0xf492('0x41')]);_0x2fd687[_0xf492('0x42')]=qs['filters'](_[_0xf492('0x43')](_0x5b4966['query'],_0x1435b7['filters']));_0x2fd687['where'][_0xf492('0x60')]=_0x21d572['id'];if(_0x5b4966[_0xf492('0x39')][_0xf492('0x46')]){_0x2fd687[_0xf492('0x42')]=_[_0xf492('0x44')](_0x2fd687['where'],{'$or':_[_0xf492('0x2a')](_0x2fd687['attributes'],function(_0xb858af){var _0x3f6611={};_0x3f6611[_0xb858af]={'$like':'%'+_0x5b4966[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x3f6611;})});}_0x2fd687=_[_0xf492('0x44')]({},_0x2fd687,_0x5b4966[_0xf492('0x4d')]);return db[_0xf492('0x5e')][_0xf492('0x1c')]({'where':_0x2fd687[_0xf492('0x42')]})['then'](function(_0xf7718c){_0x265505[_0xf492('0x1c')]=_0xf7718c;if(_0x5b4966[_0xf492('0x39')][_0xf492('0x47')]){_0x2fd687['include']=[{'all':!![]}];}return db[_0xf492('0x5e')]['findAll'](_0x2fd687);})[_0xf492('0x24')](function(_0x4a09ed){_0x265505[_0xf492('0x61')]=_0x4a09ed;return _0x265505;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x195f6a,_0x2fd687))[_0xf492('0x4a')](handleError(_0x195f6a,null));};exports[_0xf492('0x62')]=function(_0x15d6df,_0x24d36a,_0x479d5c){var _0x1edf8e={'raw':!![],'where':{}};var _0x5647a9={};var _0x61a77f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x15d6df[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x24d36a,null))['then'](function(_0x39a6e4){if(_0x39a6e4){_0x5647a9[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x63')][_0xf492('0x36')]);_0x5647a9[_0xf492('0x39')]=_['keys'](_0x15d6df['query']);_0x5647a9['filters']=_[_0xf492('0x3c')](_0x5647a9['model'],_0x5647a9[_0xf492('0x39')]);_0x1edf8e[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x5647a9['model'],qs[_0xf492('0x4c')](_0x15d6df['query'][_0xf492('0x4c')]));_0x1edf8e[_0xf492('0x3d')]=_0x1edf8e[_0xf492('0x3d')][_0xf492('0x3e')]?_0x1edf8e['attributes']:_0x5647a9[_0xf492('0x38')];if(!_0x15d6df[_0xf492('0x39')]['hasOwnProperty'](_0xf492('0x5f'))){_0x1edf8e[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x15d6df[_0xf492('0x39')][_0xf492('0x1e')]);_0x1edf8e[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x15d6df[_0xf492('0x39')][_0xf492('0x1d')]);}_0x1edf8e[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x15d6df['query'][_0xf492('0x41')]);_0x1edf8e['where']=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x15d6df[_0xf492('0x39')],_0x5647a9[_0xf492('0x3b')]));_0x1edf8e[_0xf492('0x42')][_0xf492('0x60')]=_0x39a6e4['id'];if(_0x15d6df[_0xf492('0x39')][_0xf492('0x46')]){_0x1edf8e['where']=_[_0xf492('0x44')](_0x1edf8e[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0x1edf8e[_0xf492('0x3d')],function(_0x1567e0){var _0x5845c8={};_0x5845c8[_0x1567e0]={'$like':'%'+_0x15d6df['query'][_0xf492('0x46')]+'%'};return _0x5845c8;})});}_0x1edf8e=_[_0xf492('0x44')]({},_0x1edf8e,_0x15d6df['options']);return db[_0xf492('0x63')][_0xf492('0x1c')]({'where':_0x1edf8e['where']})[_0xf492('0x24')](function(_0x3f9967){_0x61a77f[_0xf492('0x1c')]=_0x3f9967;if(_0x15d6df[_0xf492('0x39')][_0xf492('0x47')]){_0x1edf8e['include']=[{'all':!![]}];}return db[_0xf492('0x63')][_0xf492('0x49')](_0x1edf8e);})[_0xf492('0x24')](function(_0x59789e){_0x61a77f[_0xf492('0x61')]=_0x59789e;return _0x61a77f;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x24d36a,_0x1edf8e))[_0xf492('0x4a')](handleError(_0x24d36a,null));};exports[_0xf492('0x64')]=function(_0xa2909,_0x2e93d6,_0x36e18a){var _0xcef401={'raw':!![],'where':{}};var _0x1146ef={};var _0x2429d5={'count':0x0,'rows':[]};return db[_0xf492('0x35')][_0xf492('0x5d')]({'where':{'id':_0xa2909[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e93d6,null))[_0xf492('0x24')](function(_0x3be1ad){if(_0x3be1ad){_0x1146ef[_0xf492('0x38')]=_['keys'](db[_0xf492('0x65')][_0xf492('0x36')]);_0x1146ef[_0xf492('0x39')]=_[_0xf492('0x3a')](_0xa2909[_0xf492('0x39')]);_0x1146ef[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1146ef['model'],_0x1146ef[_0xf492('0x39')]);_0xcef401['attributes']=_[_0xf492('0x3c')](_0x1146ef[_0xf492('0x38')],qs[_0xf492('0x4c')](_0xa2909[_0xf492('0x39')][_0xf492('0x4c')]));_0xcef401['attributes']=_0xcef401[_0xf492('0x3d')][_0xf492('0x3e')]?_0xcef401[_0xf492('0x3d')]:_0x1146ef['model'];if(!_0xa2909['query'][_0xf492('0x3f')]('nolimit')){_0xcef401['limit']=qs[_0xf492('0x1e')](_0xa2909[_0xf492('0x39')][_0xf492('0x1e')]);_0xcef401['offset']=qs[_0xf492('0x1d')](_0xa2909[_0xf492('0x39')]['offset']);}_0xcef401[_0xf492('0x40')]=qs[_0xf492('0x41')](_0xa2909[_0xf492('0x39')][_0xf492('0x41')]);_0xcef401['where']=qs[_0xf492('0x3b')](_['pick'](_0xa2909[_0xf492('0x39')],_0x1146ef[_0xf492('0x3b')]));_0xcef401[_0xf492('0x42')][_0xf492('0x60')]=_0x3be1ad['id'];if(_0xa2909['query'][_0xf492('0x46')]){_0xcef401[_0xf492('0x42')]=_[_0xf492('0x44')](_0xcef401[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0xcef401['attributes'],function(_0x5851f9){var _0x3fef1f={};_0x3fef1f[_0x5851f9]={'$like':'%'+_0xa2909['query'][_0xf492('0x46')]+'%'};return _0x3fef1f;})});}_0xcef401=_[_0xf492('0x44')]({},_0xcef401,_0xa2909['options']);return db[_0xf492('0x65')][_0xf492('0x1c')]({'where':_0xcef401[_0xf492('0x42')]})['then'](function(_0x1898b1){_0x2429d5[_0xf492('0x1c')]=_0x1898b1;if(_0xa2909[_0xf492('0x39')][_0xf492('0x47')]){_0xcef401['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xf492('0x49')](_0xcef401);})[_0xf492('0x24')](function(_0x1cc11e){_0x2429d5['rows']=_0x1cc11e;return _0x2429d5;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x2e93d6,_0xcef401))['catch'](handleError(_0x2e93d6,null));};exports[_0xf492('0x66')]=function(_0x54e85e,_0x39d425,_0x21b6ff){var _0x2542e5={'raw':!![],'where':{}};var _0x34242d={};var _0x4ee001={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf492('0x5d')]({'where':{'id':_0x54e85e[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x39d425,null))['then'](function(_0x53d384){if(_0x53d384){_0x34242d[_0xf492('0x38')]=_['keys'](db['CmHopperBlack'][_0xf492('0x36')]);_0x34242d['query']=_[_0xf492('0x3a')](_0x54e85e[_0xf492('0x39')]);_0x34242d[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x34242d[_0xf492('0x38')],_0x34242d[_0xf492('0x39')]);_0x2542e5[_0xf492('0x3d')]=_['intersection'](_0x34242d[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x54e85e['query'][_0xf492('0x4c')]));_0x2542e5[_0xf492('0x3d')]=_0x2542e5[_0xf492('0x3d')][_0xf492('0x3e')]?_0x2542e5['attributes']:_0x34242d['model'];if(!_0x54e85e[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x2542e5[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x54e85e[_0xf492('0x39')]['limit']);_0x2542e5['offset']=qs[_0xf492('0x1d')](_0x54e85e[_0xf492('0x39')][_0xf492('0x1d')]);}_0x2542e5[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x54e85e[_0xf492('0x39')][_0xf492('0x41')]);_0x2542e5[_0xf492('0x42')]=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x54e85e[_0xf492('0x39')],_0x34242d[_0xf492('0x3b')]));_0x2542e5[_0xf492('0x42')][_0xf492('0x60')]=_0x53d384['id'];if(_0x54e85e['query'][_0xf492('0x46')]){_0x2542e5['where']=_[_0xf492('0x44')](_0x2542e5['where'],{'$or':_[_0xf492('0x2a')](_0x2542e5[_0xf492('0x3d')],function(_0x971e01){var _0x30dcb={};_0x30dcb[_0x971e01]={'$like':'%'+_0x54e85e[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x30dcb;})});}_0x2542e5=_[_0xf492('0x44')]({},_0x2542e5,_0x54e85e[_0xf492('0x4d')]);return db[_0xf492('0x67')][_0xf492('0x1c')]({'where':_0x2542e5[_0xf492('0x42')]})['then'](function(_0x48403c){_0x4ee001[_0xf492('0x1c')]=_0x48403c;if(_0x54e85e['query'][_0xf492('0x47')]){_0x2542e5[_0xf492('0x48')]=[{'all':!![]}];}return db[_0xf492('0x67')]['findAll'](_0x2542e5);})['then'](function(_0x2d666d){_0x4ee001[_0xf492('0x61')]=_0x2d666d;return _0x4ee001;});}})[_0xf492('0x24')](respondWithFilteredResult(_0x39d425,_0x2542e5))[_0xf492('0x4a')](handleError(_0x39d425,null));};exports[_0xf492('0x68')]=function(_0x496f49,_0x40ec96,_0x1a74f6){var _0x95cc23={};var _0x27fdc3={};var _0x425076;var _0x26d551;return db['VoiceQueue']['findOne']({'where':{'id':_0x496f49['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x40ec96,null))['then'](function(_0x26583c){if(_0x26583c){_0x425076=_0x26583c;_0x27fdc3[_0xf492('0x38')]=_['keys'](db['Team'][_0xf492('0x36')]);_0x27fdc3[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x496f49['query']);_0x27fdc3[_0xf492('0x3b')]=_['intersection'](_0x27fdc3[_0xf492('0x38')],_0x27fdc3['query']);_0x95cc23[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x27fdc3['model'],qs['fields'](_0x496f49[_0xf492('0x39')][_0xf492('0x4c')]));_0x95cc23['attributes']=_0x95cc23[_0xf492('0x3d')][_0xf492('0x3e')]?_0x95cc23[_0xf492('0x3d')]:_0x27fdc3[_0xf492('0x38')];_0x95cc23[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x496f49[_0xf492('0x39')][_0xf492('0x41')]);_0x95cc23[_0xf492('0x42')]=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x496f49[_0xf492('0x39')],_0x27fdc3[_0xf492('0x3b')]));if(_0x496f49[_0xf492('0x39')]['filter']){_0x95cc23['where']=_['merge'](_0x95cc23[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0x95cc23['attributes'],function(_0x52b4f0){var _0x4f7554={};_0x4f7554[_0x52b4f0]={'$like':'%'+_0x496f49['query'][_0xf492('0x46')]+'%'};return _0x4f7554;})});}_0x95cc23=_['merge']({},_0x95cc23,_0x496f49[_0xf492('0x4d')]);return _0x425076[_0xf492('0x68')](_0x95cc23);}})[_0xf492('0x24')](function(_0x172b28){if(_0x172b28){_0x26d551=_0x172b28[_0xf492('0x3e')];if(!_0x496f49[_0xf492('0x39')]['hasOwnProperty'](_0xf492('0x5f'))){_0x95cc23[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x496f49[_0xf492('0x39')][_0xf492('0x1e')]);_0x95cc23[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x496f49[_0xf492('0x39')][_0xf492('0x1d')]);}return _0x425076['getTeams'](_0x95cc23);}})[_0xf492('0x24')](function(_0x5b3538){if(_0x5b3538){return _0x5b3538?{'count':_0x26d551,'rows':_0x5b3538}:null;}})['then'](respondWithResult(_0x40ec96,null))[_0xf492('0x4a')](handleError(_0x40ec96,null));};exports[_0xf492('0x69')]=function(_0x4a281c,_0x38c217,_0x57f259){var _0x77c18e=_0x4a281c[_0xf492('0x5a')][_0xf492('0x6a')];var _0x4f3e8b=_[_0xf492('0x2a')](_0x77c18e,'id');return db[_0xf492('0x6b')][_0xf492('0x49')]({'where':{'id':_0x4f3e8b},'attributes':['id'],'include':[{'model':db[_0xf492('0x6c')],'as':_0xf492('0x6d'),'attributes':['id',_0xf492('0x32'),'online',_0xf492('0x6e'),_0xf492('0x6f')],'raw':!![]}]})[_0xf492('0x24')](function(_0x1bea8f){if(_0x1bea8f){var _0x5a369d=_[_0xf492('0x70')](_0x1bea8f,function(_0x5f3f27){var _0x279943=_0x5f3f27[_0xf492('0x50')]({'plain':!![]});_0x279943[_0xf492('0x6d')]['forEach'](function(_0x58ea26){_0x58ea26[_0xf492('0x71')]=_[_0xf492('0x2e')](_0x77c18e,{'id':_0x279943['id']})[_0xf492('0x71')];});return _0x279943[_0xf492('0x6d')];});return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x4a281c[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(_0x5527ba){return db[_0xf492('0x72')]['transaction'](function(_0x229842){return _0x5527ba[_0xf492('0x69')](_0x4f3e8b,{'transaction':_0x229842})[_0xf492('0x24')](function(){return BPromise['each'](_0x5a369d,function(_0xf5504){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0xf5504['id'],'VoiceQueueId':_0x4a281c[_0xf492('0x4b')]['id']},'defaults':{'penalty':_0xf5504[_0xf492('0x71')]},'transaction':_0x229842});});})[_0xf492('0x24')](function(){return BPromise[_0xf492('0x73')](_['filter'](_0x5a369d,{'online':!![]}),function(_0x55fcba){return db[_0xf492('0x74')][_0xf492('0x75')]({'membername':_0x55fcba[_0xf492('0x32')],'UserId':_0x55fcba['id'],'queue_name':_0x5527ba[_0xf492('0x32')],'VoiceQueueId':_0x5527ba['id'],'interface':_[_0xf492('0x76')](_0x55fcba[_0xf492('0x6f')])?util['format'](_0xf492('0x77'),_0x55fcba[_0xf492('0x32')]):_0x55fcba['interface'],'paused':_0x55fcba['voicePause']||![],'penalty':_0x55fcba[_0xf492('0x71')]},{'transaction':_0x229842});});})[_0xf492('0x24')](function(){_0x5a369d[_0xf492('0x78')](function(_0x4dd447){socket['emit']('userVoiceQueue:save',{'UserId':_0x4dd447['id'],'VoiceQueueId':_0x5527ba['id']});});});});});}})[_0xf492('0x24')](respondWithStatusCode(_0x38c217,null))['catch'](handleError(_0x38c217,null));};exports['removeTeams']=function(_0x5bf244,_0x322d39,_0x1d9fd0){return db[_0xf492('0x6b')]['findAll']({'where':{'id':_0x5bf244['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf492('0x6c')],'as':_0xf492('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xf492('0x24')](handleEntityNotFound(_0x322d39,null))['then'](function(_0x48cb87){var _0x2b8ac6=_[_0xf492('0x2a')](_0x48cb87,'id');var _0x513fc3=[];var _0x2bf10b=[];var _0x486082=squel[_0xf492('0x79')]();_0x486082[_0xf492('0x7a')](_0xf492('0x7b'))['from']('team_has_voice_queues','tq')[_0xf492('0x7c')](_0xf492('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf492('0x7e'),_0x5bf244[_0xf492('0x4b')]['id']);for(var _0x1de0bb=0x0;_0x1de0bb<_0x48cb87[_0xf492('0x3e')];_0x1de0bb+=0x1){let _0x5e0b0f=_0x48cb87[_0x1de0bb];for(var _0x1de59b=0x0;_0x1de59b<_0x5e0b0f[_0xf492('0x6d')][_0xf492('0x3e')];_0x1de59b+=0x1){let _0x145009=_0x5e0b0f[_0xf492('0x6d')][_0x1de59b];var _0x2979f8=_0x486082['clone']();_0x2979f8[_0xf492('0x42')](_0xf492('0x7f'),_0x145009['id']);_0x2bf10b['push'](db[_0xf492('0x72')][_0xf492('0x39')](_0x2979f8[_0xf492('0x80')](),{'type':db[_0xf492('0x72')][_0xf492('0x81')][_0xf492('0x82')]})[_0xf492('0x24')](function(_0x4340e1){if(_0x4340e1[_0xf492('0x3e')]===0x1){return _0x145009['id'];}else{var _0x40b802=_[_0xf492('0x83')](_[_0xf492('0x2a')](_0x4340e1,_0xf492('0x84')),function(_0x3e8aac){return _[_0xf492('0x2c')](_0x2b8ac6,_0x3e8aac);});if(_0x40b802){return _0x145009['id'];}}}));}}return BPromise['all'](_0x2bf10b)['then'](function(_0x569e73){_0x513fc3=_(_0x513fc3)['union'](_0x569e73)[_0xf492('0x85')]()[_0xf492('0x2b')]();return db[_0xf492('0x35')]['find']({'where':{'id':_0x5bf244[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(_0x2ebd49){return db['sequelize']['transaction'](function(_0x5e837e){return _0x2ebd49['removeTeams'](_0x5bf244[_0xf492('0x39')][_0xf492('0x86')],{'transaction':_0x5e837e})[_0xf492('0x24')](function(){if(!_[_0xf492('0x87')](_0x513fc3)){return _0x2ebd49[_0xf492('0x88')](_0x513fc3,{'transaction':_0x5e837e})[_0xf492('0x24')](function(){return db[_0xf492('0x74')][_0xf492('0x25')]({'where':{'VoiceQueueId':_0x5bf244['params']['id'],'UserId':_0x513fc3},'transaction':_0x5e837e});});}})[_0xf492('0x24')](function(){_0x513fc3[_0xf492('0x78')](function(_0x2e9ec2){socket['emit'](_0xf492('0x89'),{'UserId':_0x2e9ec2,'VoiceQueueId':_0x2ebd49['id']});});});});});});})[_0xf492('0x24')](respondWithStatusCode(_0x322d39,null))[_0xf492('0x4a')](handleError(_0x322d39,null));};exports['addAgents']=function(_0x45f189,_0x45a6cf,_0x179ca6){var _0x148795,_0x2380c2;return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x45f189['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x45a6cf,null))['then'](function(_0x2c3f7d){if(_0x2c3f7d){_0x2380c2=_0x2c3f7d;return _0x2c3f7d[_0xf492('0x8a')](_0x45f189[_0xf492('0x5a')][_0xf492('0x86')],_[_0xf492('0x5b')](_0x45f189['body'],[_0xf492('0x86'),'id'])||{})[_0xf492('0x8b')](function(_0xe5dd89){for(var _0x14a7ac=0x0;_0x14a7ac<_0x45f189[_0xf492('0x5a')][_0xf492('0x86')][_0xf492('0x3e')];_0x14a7ac+=0x1){socket[_0xf492('0x8c')](_0xf492('0x8d'),{'UserId':_0x45f189['body']['ids'][_0x14a7ac],'VoiceQueueId':_0x45f189[_0xf492('0x4b')]['id']});}return _0xe5dd89;});}})['then'](function(_0x23ab92){_0x148795=_0x23ab92||[];if(_0x2380c2){return db[_0xf492('0x6c')][_0xf492('0x49')]({'where':{'id':_0x45f189['body'][_0xf492('0x86')]},'attributes':['id',_0xf492('0x32'),'online',_0xf492('0x6e'),'interface'],'raw':!![]});}})[_0xf492('0x24')](function(_0x54b68b){if(!_[_0xf492('0x87')](_0x54b68b)){var _0x560458=[];for(var _0x1cd14a=0x0;_0x1cd14a<_0x54b68b['length'];_0x1cd14a++){if(_0x54b68b[_0x1cd14a][_0xf492('0x8e')]){_0x560458[_0xf492('0x8f')](db[_0xf492('0x74')][_0xf492('0x75')]({'membername':_0x54b68b[_0x1cd14a][_0xf492('0x32')],'UserId':_0x54b68b[_0x1cd14a]['id'],'queue_name':_0x2380c2[_0xf492('0x32')],'VoiceQueueId':_0x2380c2['id'],'interface':_[_0xf492('0x76')](_0x54b68b[_0x1cd14a][_0xf492('0x6f')])?util[_0xf492('0x90')](_0xf492('0x77'),_0x54b68b[_0x1cd14a][_0xf492('0x32')]):_0x54b68b[_0x1cd14a]['interface'],'paused':_0x54b68b[_0x1cd14a][_0xf492('0x6e')]||![],'penalty':_0x45f189[_0xf492('0x5a')][_0xf492('0x71')]||0x0}));}}return BPromise[_0xf492('0x91')](_0x560458);}})[_0xf492('0x24')](function(){return _0x148795;})[_0xf492('0x24')](respondWithResult(_0x45a6cf,null))['catch'](handleError(_0x45a6cf,null));};exports[_0xf492('0x88')]=function(_0x1936c7,_0x20ee1e,_0x5b9be8){return db[_0xf492('0x35')]['find']({'where':{'id':_0x1936c7[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x20ee1e,null))['then'](function(_0x8d2f53){if(_0x8d2f53){return _0x8d2f53[_0xf492('0x88')](_0x1936c7[_0xf492('0x39')][_0xf492('0x86')])['then'](function(){if(_[_0xf492('0x92')](_0x1936c7['query'][_0xf492('0x86')])){for(var _0x1bcab2=0x0;_0x1bcab2<_0x1936c7[_0xf492('0x39')][_0xf492('0x86')]['length'];_0x1bcab2+=0x1){socket[_0xf492('0x8c')](_0xf492('0x89'),{'UserId':Number(_0x1936c7['query']['ids'][_0x1bcab2]),'VoiceQueueId':Number(_0x1936c7[_0xf492('0x4b')]['id'])});}}else{socket[_0xf492('0x8c')](_0xf492('0x89'),{'UserId':Number(_0x1936c7[_0xf492('0x39')][_0xf492('0x86')]),'VoiceQueueId':Number(_0x1936c7[_0xf492('0x4b')]['id'])});}});}})[_0xf492('0x24')](function(_0x19cb9a){return db[_0xf492('0x74')][_0xf492('0x25')]({'where':{'VoiceQueueId':_0x1936c7[_0xf492('0x4b')]['id'],'UserId':_0x1936c7['query'][_0xf492('0x86')]}})[_0xf492('0x24')](function(){return _0x19cb9a;});})[_0xf492('0x24')](respondWithStatusCode(_0x20ee1e,null))[_0xf492('0x4a')](handleError(_0x20ee1e,null));};exports[_0xf492('0x93')]=function(_0x997c60,_0x1c8086,_0x3beb91){var _0x52d3a1={};var _0x1a0239={};var _0x41096c;var _0x4a8c35;return db[_0xf492('0x35')]['findOne']({'where':{'id':_0x997c60['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x1c8086,null))[_0xf492('0x24')](function(_0x252413){if(_0x252413){_0x41096c=_0x252413;_0x1a0239[_0xf492('0x38')]=_['keys'](db[_0xf492('0x6c')][_0xf492('0x36')]);_0x1a0239['query']=_['keys'](_0x997c60['query']);_0x1a0239[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x1a0239[_0xf492('0x38')],_0x1a0239[_0xf492('0x39')]);_0x52d3a1[_0xf492('0x3d')]=_['intersection'](_0x1a0239[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x997c60[_0xf492('0x39')][_0xf492('0x4c')]));_0x52d3a1[_0xf492('0x3d')]=_0x52d3a1[_0xf492('0x3d')][_0xf492('0x3e')]?_0x52d3a1[_0xf492('0x3d')]:_0x1a0239[_0xf492('0x38')];_0x52d3a1[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x997c60['query'][_0xf492('0x41')]);_0x52d3a1['where']=qs[_0xf492('0x3b')](_['pick'](_0x997c60[_0xf492('0x39')],_0x1a0239[_0xf492('0x3b')]));if(_0x997c60[_0xf492('0x39')][_0xf492('0x46')]){_0x52d3a1[_0xf492('0x42')]=_[_0xf492('0x44')](_0x52d3a1[_0xf492('0x42')],{'$or':_['map'](_0x52d3a1[_0xf492('0x3d')],function(_0x3af4f1){var _0x1e3700={};_0x1e3700[_0x3af4f1]={'$like':'%'+_0x997c60[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x1e3700;})});}_0x52d3a1=_[_0xf492('0x44')]({},_0x52d3a1,_0x997c60['options']);return _0x41096c[_0xf492('0x93')](_0x52d3a1);}})[_0xf492('0x24')](function(_0x210c9a){if(_0x210c9a){_0x4a8c35=_0x210c9a['length'];if(!_0x997c60[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x52d3a1[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x997c60[_0xf492('0x39')][_0xf492('0x1e')]);_0x52d3a1[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x997c60[_0xf492('0x39')][_0xf492('0x1d')]);}return _0x41096c[_0xf492('0x93')](_0x52d3a1);}})['then'](function(_0x23a5b5){if(_0x23a5b5){return _0x23a5b5?{'count':_0x4a8c35,'rows':_0x23a5b5}:null;}})[_0xf492('0x24')](respondWithResult(_0x1c8086,null))[_0xf492('0x4a')](handleError(_0x1c8086,null));};exports[_0xf492('0x94')]=function(_0x1ea762,_0x15adfa,_0x44e1dd){var _0x46cb59={};var _0x2a812b={};var _0xa7b1a9;var _0x9b3be5;return db[_0xf492('0x35')]['findOne']({'where':{'id':_0x1ea762[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15adfa,null))[_0xf492('0x24')](function(_0x1bcca8){if(_0x1bcca8){_0xa7b1a9=_0x1bcca8;_0x2a812b[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x74')]['rawAttributes']);_0x2a812b[_0xf492('0x39')]=_[_0xf492('0x3a')](_0x1ea762['query']);_0x2a812b['filters']=_[_0xf492('0x3c')](_0x2a812b[_0xf492('0x38')],_0x2a812b[_0xf492('0x39')]);_0x46cb59[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x2a812b[_0xf492('0x38')],qs['fields'](_0x1ea762[_0xf492('0x39')][_0xf492('0x4c')]));_0x46cb59['attributes']=_0x46cb59[_0xf492('0x3d')][_0xf492('0x3e')]?_0x46cb59[_0xf492('0x3d')]:_0x2a812b[_0xf492('0x38')];_0x46cb59[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x1ea762['query'][_0xf492('0x41')]);_0x46cb59[_0xf492('0x42')]=qs['filters'](_[_0xf492('0x43')](_0x1ea762[_0xf492('0x39')],_0x2a812b['filters']));if(_0x1ea762[_0xf492('0x39')]['filter']){_0x46cb59[_0xf492('0x42')]=_[_0xf492('0x44')](_0x46cb59[_0xf492('0x42')],{'$or':_[_0xf492('0x2a')](_0x46cb59[_0xf492('0x3d')],function(_0x4661d0){var _0x3693d6={};_0x3693d6[_0x4661d0]={'$like':'%'+_0x1ea762[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x3693d6;})});}_0x46cb59=_[_0xf492('0x44')]({},_0x46cb59,_0x1ea762['options']);return _0xa7b1a9[_0xf492('0x94')](_0x46cb59);}})[_0xf492('0x24')](function(_0xac4436){if(_0xac4436){_0x9b3be5=_0xac4436[_0xf492('0x3e')];if(!_0x1ea762['query'][_0xf492('0x3f')]('nolimit')){_0x46cb59[_0xf492('0x1e')]=qs['limit'](_0x1ea762['query'][_0xf492('0x1e')]);_0x46cb59['offset']=qs[_0xf492('0x1d')](_0x1ea762[_0xf492('0x39')][_0xf492('0x1d')]);}return _0xa7b1a9['getMembers'](_0x46cb59);}})['then'](function(_0x53d3df){return _0x53d3df?{'count':_0x9b3be5,'rows':_0x53d3df}:null;})['then'](respondWithResult(_0x15adfa,null))['catch'](handleError(_0x15adfa,null));};exports['getLists']=function(_0x1f312d,_0x475577,_0x106ea5){var _0x2602f2={};var _0x237ea1={};var _0x26ec85;var _0x204646;return db['VoiceQueue'][_0xf492('0x5d')]({'where':{'id':_0x1f312d['params']['id']}})['then'](handleEntityNotFound(_0x475577,null))[_0xf492('0x24')](function(_0x4a411f){if(_0x4a411f){_0x26ec85=_0x4a411f;_0x237ea1[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x95')]['rawAttributes']);_0x237ea1[_0xf492('0x39')]=_['keys'](_0x1f312d[_0xf492('0x39')]);_0x237ea1['filters']=_['intersection'](_0x237ea1['model'],_0x237ea1[_0xf492('0x39')]);_0x2602f2[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x237ea1[_0xf492('0x38')],qs[_0xf492('0x4c')](_0x1f312d['query']['fields']));_0x2602f2['attributes']=_0x2602f2[_0xf492('0x3d')][_0xf492('0x3e')]?_0x2602f2[_0xf492('0x3d')]:_0x237ea1[_0xf492('0x38')];_0x2602f2[_0xf492('0x40')]=qs[_0xf492('0x41')](_0x1f312d[_0xf492('0x39')][_0xf492('0x41')]);_0x2602f2[_0xf492('0x42')]=qs['filters'](_[_0xf492('0x43')](_0x1f312d[_0xf492('0x39')],_0x237ea1[_0xf492('0x3b')]));if(_0x1f312d[_0xf492('0x39')][_0xf492('0x46')]){_0x2602f2[_0xf492('0x42')]=_[_0xf492('0x44')](_0x2602f2['where'],{'$or':_[_0xf492('0x2a')](_0x2602f2['attributes'],function(_0x4cdba5){var _0x36de7e={};_0x36de7e[_0x4cdba5]={'$like':'%'+_0x1f312d[_0xf492('0x39')][_0xf492('0x46')]+'%'};return _0x36de7e;})});}_0x2602f2=_[_0xf492('0x44')]({},_0x2602f2,_0x1f312d[_0xf492('0x4d')]);return _0x26ec85[_0xf492('0x96')](_0x2602f2);}})[_0xf492('0x24')](function(_0x133066){if(_0x133066){_0x204646=_0x133066[_0xf492('0x3e')];if(!_0x1f312d[_0xf492('0x39')][_0xf492('0x3f')](_0xf492('0x5f'))){_0x2602f2['limit']=qs['limit'](_0x1f312d['query']['limit']);_0x2602f2['offset']=qs[_0xf492('0x1d')](_0x1f312d[_0xf492('0x39')][_0xf492('0x1d')]);}return _0x26ec85[_0xf492('0x96')](_0x2602f2);}})['then'](function(_0x3ca8cb){if(_0x3ca8cb){return _0x3ca8cb?{'count':_0x204646,'rows':_0x3ca8cb}:null;}})['then'](respondWithResult(_0x475577,null))[_0xf492('0x4a')](handleError(_0x475577,null));};exports[_0xf492('0x97')]=function(_0x251403,_0x1e21fa,_0x3255ed){var _0x589a07,_0x286fc2;return db['VoiceQueue']['find']({'where':{'id':_0x251403[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e21fa,null))[_0xf492('0x24')](function(_0x21d519){if(_0x21d519){_0x286fc2=_0x21d519;return _0x21d519['addLists'](_0x251403[_0xf492('0x5a')][_0xf492('0x86')],_['omit'](_0x251403[_0xf492('0x5a')],[_0xf492('0x86'),'id'])||{});}return null;})['spread'](function(_0x2e8bbb){var _0xc54a7;_0x589a07=_0x2e8bbb||[];var _0x330f0a=[];if(_0x2e8bbb){for(var _0x4eb7f4=0x0;_0x4eb7f4<_0x2e8bbb['length'];_0x4eb7f4+=0x1){var _0x3516bc=_0x2e8bbb[_0x4eb7f4][_0xf492('0x50')]({'plain':!![]});_0x286fc2['dialCheckDuplicateType']=_0x251403[_0xf492('0x5a')][_0xf492('0x98')]?_0x251403[_0xf492('0x5a')][_0xf492('0x98')]:_0x286fc2[_0xf492('0x98')];switch(_0x286fc2[_0xf492('0x98')]){case'always':_0xc54a7=squel[_0xf492('0x99')]()[_0xf492('0x9a')](_0xf492('0x9b'))[_0xf492('0x9c')]([_0xf492('0x9d'),'scheduledAt',_0xf492('0x9e'),_0xf492('0x9f'),'VoiceQueueId','createdAt',_0xf492('0x59')],squel[_0xf492('0x79')]()[_0xf492('0x7a')](_0xf492('0x9d'),'phone')[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0xa1'))[_0xf492('0x7a')]('id','ContactId')[_0xf492('0x7a')](_0x3516bc['CmListId'][_0xf492('0x80')](),'ListId')[_0xf492('0x7a')](_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')](),_0xf492('0x60'))['field'](_0xf492('0xa0'),_0xf492('0x58'))[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x59'))[_0xf492('0xa2')](_0xf492('0xa3'))[_0xf492('0x42')](_0xf492('0xa4'))['where']('ListId\x20=\x20?',_0x3516bc[_0xf492('0xa5')][_0xf492('0x80')]())[_0xf492('0x42')](_0xf492('0xa6'))[_0xf492('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf492('0x7a')](_0xf492('0xa7'))[_0xf492('0xa2')](_0xf492('0xa8'))['where'](_0xf492('0x7e'),_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xf492('0x79')]()[_0xf492('0x7a')]('COALESCE(phone,\x27\x27)')[_0xf492('0xa2')](_0xf492('0x9b'))[_0xf492('0x42')](_0xf492('0x7e'),_0x251403['params']['id'][_0xf492('0x80')]())))[_0xf492('0x80')]();break;case _0xf492('0xa9'):_0xc54a7=squel[_0xf492('0x99')]()['into'](_0xf492('0x9b'))[_0xf492('0x9c')]([_0xf492('0x9d'),_0xf492('0xa1'),_0xf492('0x9e'),_0xf492('0x9f'),_0xf492('0x60'),'createdAt','updatedAt'],squel['select']()[_0xf492('0x7a')](_0xf492('0x9d'),_0xf492('0x9d'))[_0xf492('0x7a')](_0xf492('0xa0'),'scheduledAt')[_0xf492('0x7a')]('id',_0xf492('0x9e'))[_0xf492('0x7a')](_0x3516bc['CmListId'][_0xf492('0x80')](),_0xf492('0x9f'))['field'](_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')](),'VoiceQueueId')[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x58'))[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x59'))[_0xf492('0xa2')]('cm_contacts')[_0xf492('0x42')](_0xf492('0xa4'))[_0xf492('0x42')]('ListId\x20=\x20?',_0x3516bc['CmListId'][_0xf492('0x80')]())[_0xf492('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xf492('0x42')](_0xf492('0xaa'),squel[_0xf492('0x79')]()['field'](_0xf492('0xab'))[_0xf492('0xa2')](_0xf492('0x9b'))[_0xf492('0x42')]('VoiceQueueId\x20=\x20?',_0x251403['params']['id'][_0xf492('0x80')]())))['toString']();break;default:_0xc54a7=squel['insert']()[_0xf492('0x9a')](_0xf492('0x9b'))[_0xf492('0x9c')]([_0xf492('0x9d'),_0xf492('0xa1'),_0xf492('0x9e'),_0xf492('0x9f'),_0xf492('0x60'),_0xf492('0x58'),'updatedAt'],squel[_0xf492('0x79')]()[_0xf492('0x7a')]('phone',_0xf492('0x9d'))[_0xf492('0x7a')](_0xf492('0xa0'),'scheduledAt')[_0xf492('0x7a')]('id','ContactId')[_0xf492('0x7a')](_0x3516bc[_0xf492('0xa5')][_0xf492('0x80')](),_0xf492('0x9f'))[_0xf492('0x7a')](_0x251403[_0xf492('0x4b')]['id'][_0xf492('0x80')](),_0xf492('0x60'))[_0xf492('0x7a')]('NOW()','createdAt')[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x59'))[_0xf492('0xa2')](_0xf492('0xa3'))[_0xf492('0x42')](_0xf492('0xa4'))[_0xf492('0x42')]('ListId\x20=\x20?',_0x3516bc[_0xf492('0xa5')][_0xf492('0x80')]())['where'](_0xf492('0xa6')))[_0xf492('0x80')]();}_0x330f0a[_0xf492('0x8f')](db['sequelize'][_0xf492('0x39')](_0xc54a7));}return BPromise['all'](_0x330f0a);}})['then'](function(){return _0x589a07;})[_0xf492('0x24')](respondWithResult(_0x1e21fa,null))['catch'](handleError(_0x1e21fa,null));};exports[_0xf492('0xac')]=function(_0x894b71,_0x444868,_0xff10d6){return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x894b71['params']['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x444868,null))[_0xf492('0x24')](function(_0xb983ee){if(_0xb983ee){return _0xb983ee[_0xf492('0xac')](_0x894b71[_0xf492('0x39')][_0xf492('0x86')]);}})[_0xf492('0x24')](function(_0x2c5004){if(_0x2c5004){return db[_0xf492('0x5e')]['destroy']({'where':{'ListId':_0x894b71['query']['ids'],'VoiceQueueId':_0x894b71[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(){return _0x2c5004;});}})[_0xf492('0x24')](respondWithStatusCode(_0x444868,null))[_0xf492('0x4a')](handleError(_0x444868,null));};exports[_0xf492('0xad')]=function(_0x16cb4c,_0x4d6c7c,_0xb8bc4a){var _0x40927a={};var _0x204668={};var _0x273138;var _0x2a5792;return db['VoiceQueue'][_0xf492('0x5d')]({'where':{'id':_0x16cb4c[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](handleEntityNotFound(_0x4d6c7c,null))[_0xf492('0x24')](function(_0x396eb0){if(_0x396eb0){_0x273138=_0x396eb0;_0x204668[_0xf492('0x38')]=_[_0xf492('0x3a')](db[_0xf492('0x95')][_0xf492('0x36')]);_0x204668['query']=_[_0xf492('0x3a')](_0x16cb4c['query']);_0x204668[_0xf492('0x3b')]=_[_0xf492('0x3c')](_0x204668[_0xf492('0x38')],_0x204668['query']);_0x40927a[_0xf492('0x3d')]=_[_0xf492('0x3c')](_0x204668[_0xf492('0x38')],qs['fields'](_0x16cb4c[_0xf492('0x39')][_0xf492('0x4c')]));_0x40927a['attributes']=_0x40927a['attributes'][_0xf492('0x3e')]?_0x40927a[_0xf492('0x3d')]:_0x204668[_0xf492('0x38')];_0x40927a[_0xf492('0x40')]=qs['sort'](_0x16cb4c[_0xf492('0x39')][_0xf492('0x41')]);_0x40927a['where']=qs[_0xf492('0x3b')](_[_0xf492('0x43')](_0x16cb4c[_0xf492('0x39')],_0x204668[_0xf492('0x3b')]));if(_0x16cb4c['query'][_0xf492('0x46')]){_0x40927a[_0xf492('0x42')]=_[_0xf492('0x44')](_0x40927a['where'],{'$or':_['map'](_0x40927a['attributes'],function(_0x5e2759){var _0x4c58ae={};_0x4c58ae[_0x5e2759]={'$like':'%'+_0x16cb4c[_0xf492('0x39')]['filter']+'%'};return _0x4c58ae;})});}_0x40927a=_[_0xf492('0x44')]({},_0x40927a,_0x16cb4c['options']);return _0x273138['getBlackLists'](_0x40927a);}})['then'](function(_0x41573f){if(_0x41573f){_0x2a5792=_0x41573f[_0xf492('0x3e')];if(!_0x16cb4c[_0xf492('0x39')][_0xf492('0x3f')]('nolimit')){_0x40927a[_0xf492('0x1e')]=qs[_0xf492('0x1e')](_0x16cb4c[_0xf492('0x39')][_0xf492('0x1e')]);_0x40927a[_0xf492('0x1d')]=qs[_0xf492('0x1d')](_0x16cb4c[_0xf492('0x39')]['offset']);}return _0x273138[_0xf492('0xad')](_0x40927a);}})[_0xf492('0x24')](function(_0x5d83a1){if(_0x5d83a1){return _0x5d83a1?{'count':_0x2a5792,'rows':_0x5d83a1}:null;}})[_0xf492('0x24')](respondWithResult(_0x4d6c7c,null))[_0xf492('0x4a')](handleError(_0x4d6c7c,null));};exports['addBlackLists']=function(_0x369452,_0x499efc,_0x1be39c){var _0x3a99e9,_0xa04b18;return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x369452[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x499efc,null))[_0xf492('0x24')](function(_0x4b09f2){if(_0x4b09f2){_0xa04b18=_0x4b09f2;return _0x4b09f2[_0xf492('0xae')](_0x369452[_0xf492('0x5a')][_0xf492('0x86')],_['omit'](_0x369452['body'],['ids','id'])||{});}return null;})['spread'](function(_0x402bdc){var _0x2daeba;_0x3a99e9=_0x402bdc||[];var _0x5a7441=[];if(_0x402bdc){for(var _0x43dd7d=0x0;_0x43dd7d<_0x402bdc[_0xf492('0x3e')];_0x43dd7d+=0x1){var _0x294806=_0x402bdc[_0x43dd7d][_0xf492('0x50')]({'plain':!![]});_0x2daeba=squel['insert']()[_0xf492('0x9a')]('cm_hopper_black')[_0xf492('0x9c')]([_0xf492('0x9d'),_0xf492('0x9e'),_0xf492('0x9f'),_0xf492('0x60'),_0xf492('0x58'),'updatedAt'],squel[_0xf492('0x79')]()['field']('phone',_0xf492('0x9d'))[_0xf492('0x7a')]('id',_0xf492('0x9e'))['field'](_0x294806[_0xf492('0xa5')][_0xf492('0x80')](),_0xf492('0x9f'))[_0xf492('0x7a')](_0x369452[_0xf492('0x4b')]['id']['toString'](),_0xf492('0x60'))[_0xf492('0x7a')](_0xf492('0xa0'),_0xf492('0x58'))[_0xf492('0x7a')](_0xf492('0xa0'),'updatedAt')[_0xf492('0xa2')](_0xf492('0xa3'))[_0xf492('0x42')](_0xf492('0xa4'))[_0xf492('0x42')](_0xf492('0xaf'),_0x294806['CmListId'][_0xf492('0x80')]())[_0xf492('0x42')](_0xf492('0xa6')))[_0xf492('0x80')]();_0x5a7441[_0xf492('0x8f')](db[_0xf492('0x72')]['query'](_0x2daeba));}return BPromise['all'](_0x5a7441);}})[_0xf492('0x24')](function(){return _0x3a99e9;})[_0xf492('0x24')](respondWithResult(_0x499efc,null))[_0xf492('0x4a')](handleError(_0x499efc,null));};exports[_0xf492('0xb0')]=function(_0x3ac2ba,_0x58a381,_0x356a3c){return db[_0xf492('0x35')][_0xf492('0x2e')]({'where':{'id':_0x3ac2ba[_0xf492('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58a381,null))[_0xf492('0x24')](function(_0x1608e4){if(_0x1608e4){return _0x1608e4[_0xf492('0xb0')](_0x3ac2ba[_0xf492('0x39')]['ids']);}})[_0xf492('0x24')](function(_0x4208a1){if(_0x4208a1){return db[_0xf492('0x67')][_0xf492('0x25')]({'where':{'ListId':_0x3ac2ba[_0xf492('0x39')]['ids'],'VoiceQueueId':_0x3ac2ba[_0xf492('0x4b')]['id']}})[_0xf492('0x24')](function(){return _0x4208a1;});}})['then'](respondWithStatusCode(_0x58a381,null))[_0xf492('0x4a')](handleError(_0x58a381,null));}; \ No newline at end of file +var _0xbbb6=['value','includes','type','name','UserProfileResource','stack','send','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VoiceQueue','include','findAll','rows','catch','show','params','options','find','create','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','UserVoiceQueue','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','isEmpty','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId\x20=\x20?','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xbbb6,0x1f4));var _0x6bbb=function(_0x5e795e,_0x48819f){_0x5e795e=_0x5e795e-0x0;var _0x3ae3a6=_0xbbb6[_0x5e795e];return _0x3ae3a6;};'use strict';var pdf=require(_0x6bbb('0x0'));var emlformat=require(_0x6bbb('0x1'));var rimraf=require(_0x6bbb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6bbb('0x3'));var rp=require(_0x6bbb('0x4'));var moment=require(_0x6bbb('0x5'));var BPromise=require(_0x6bbb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6bbb('0x7'));var sox=require(_0x6bbb('0x8'));var csv=require(_0x6bbb('0x9'));var ejs=require(_0x6bbb('0xa'));var fs=require('fs');var _=require(_0x6bbb('0xb'));var squel=require('squel');var crypto=require(_0x6bbb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6bbb('0xd'));var toCsv=require(_0x6bbb('0x9'));var querystring=require(_0x6bbb('0xe'));var Papa=require(_0x6bbb('0xf'));var Redis=require(_0x6bbb('0x10'));var authService=require(_0x6bbb('0x11'));var qs=require(_0x6bbb('0x12'));var as=require(_0x6bbb('0x13'));var hardwareService=require(_0x6bbb('0x14'));var logger=require(_0x6bbb('0x15'))(_0x6bbb('0x16'));var utils=require(_0x6bbb('0x17'));var config=require('../../config/environment');var db=require(_0x6bbb('0x18'))['db'];config[_0x6bbb('0x19')]=_[_0x6bbb('0x1a')](config['redis'],{'host':_0x6bbb('0x1b'),'port':0x18eb});var socket=require(_0x6bbb('0x1c'))(new Redis(config[_0x6bbb('0x19')]));require(_0x6bbb('0x1d'))['register'](socket);function respondWithStatusCode(_0x9d51c0,_0x4a6341){_0x4a6341=_0x4a6341||0xcc;return function(_0x432c1b){if(_0x432c1b){return _0x9d51c0[_0x6bbb('0x1e')](_0x4a6341);}return _0x9d51c0[_0x6bbb('0x1f')](_0x4a6341)[_0x6bbb('0x20')]();};}function respondWithResult(_0x483320,_0x4c9da8){_0x4c9da8=_0x4c9da8||0xc8;return function(_0x2dbf47){if(_0x2dbf47){return _0x483320['status'](_0x4c9da8)[_0x6bbb('0x21')](_0x2dbf47);}};}function respondWithFilteredResult(_0x57698e,_0x19f446){return function(_0x2399c2){if(_0x2399c2){var _0x14dbb5=_0x2399c2[_0x6bbb('0x22')],_0x49019f=_0x19f446[_0x6bbb('0x23')],_0x14c2b1=_0x19f446['offset']+_0x19f446[_0x6bbb('0x24')],_0x4f8c69;if(_0x14c2b1>=_0x14dbb5){_0x14c2b1=_0x14dbb5;_0x4f8c69=0xc8;}else{_0x4f8c69=0xce;}_0x57698e[_0x6bbb('0x1f')](_0x4f8c69);return _0x57698e[_0x6bbb('0x25')](_0x6bbb('0x26'),_0x49019f+'-'+_0x14c2b1+'/'+_0x14dbb5)[_0x6bbb('0x21')](_0x2399c2);}return null;};}function patchUpdates(_0x17583b){return function(_0x6de8db){try{jsonpatch['apply'](_0x6de8db,_0x17583b,!![]);}catch(_0x42c407){return BPromise[_0x6bbb('0x27')](_0x42c407);}return _0x6de8db[_0x6bbb('0x28')]();};}function saveUpdates(_0x2e2ed6,_0x201a6c){return function(_0x13a91f){if(_0x13a91f){return _0x13a91f[_0x6bbb('0x29')](_0x2e2ed6)[_0x6bbb('0x2a')](function(_0x53cb9b){return _0x53cb9b;});}return null;};}function removeEntity(_0x2e4cd6,_0x41f4a9){return function(_0x396d5f){if(_0x396d5f){return _0x396d5f[_0x6bbb('0x2b')]()[_0x6bbb('0x2a')](function(){var _0x1f53dc=_0x396d5f[_0x6bbb('0x2c')]({'plain':!![]});var _0x2d532d=[{'name':_0x6bbb('0x2d'),'value':_0x6bbb('0x2e'),'ignore':![]},{'name':_0x6bbb('0x2f'),'value':_0x6bbb('0x30'),'ignore':![]}];var _0x5dc873=_(_0x2d532d)[_0x6bbb('0x31')](_0x6bbb('0x32'))[_0x6bbb('0x33')](_0x6bbb('0x34'))[_0x6bbb('0x34')]();if(_[_0x6bbb('0x35')](_0x5dc873,_0x1f53dc['type'])){return;}var _0x592262=_['find'](_0x2d532d,[_0x6bbb('0x34'),_0x1f53dc[_0x6bbb('0x36')]])[_0x6bbb('0x37')];return db[_0x6bbb('0x38')][_0x6bbb('0x2b')]({'where':{'type':_0x592262,'resourceId':_0x1f53dc['id']}})[_0x6bbb('0x2a')](function(){return _0x396d5f;});})[_0x6bbb('0x2a')](function(){_0x2e4cd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4122e0,_0x4fa4e5){return function(_0x568558){if(!_0x568558){_0x4122e0['sendStatus'](0x194);}return _0x568558;};}function handleError(_0x3718cf,_0x3e1812){_0x3e1812=_0x3e1812||0x1f4;return function(_0x5ae396){logger['error'](_0x5ae396[_0x6bbb('0x39')]);if(_0x5ae396[_0x6bbb('0x37')]){delete _0x5ae396[_0x6bbb('0x37')];}_0x3718cf[_0x6bbb('0x1f')](_0x3e1812)[_0x6bbb('0x3a')](_0x5ae396);};}exports['index']=function(_0x25b3d5,_0x158e47){var _0x3b3335={},_0x3d6264={},_0x1d76d5={'count':0x0,'rows':[]};var _0x44eb02=_[_0x6bbb('0x33')](db['VoiceQueue'][_0x6bbb('0x3b')],function(_0x3f6a72){return{'name':_0x3f6a72[_0x6bbb('0x3c')],'type':_0x3f6a72[_0x6bbb('0x36')]['key']};});_0x3d6264[_0x6bbb('0x3d')]=_[_0x6bbb('0x33')](_0x44eb02,'name');_0x3d6264[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x25b3d5[_0x6bbb('0x3e')]);_0x3d6264[_0x6bbb('0x40')]=_[_0x6bbb('0x41')](_0x3d6264[_0x6bbb('0x3d')],_0x3d6264['query']);_0x3b3335['attributes']=_[_0x6bbb('0x41')](_0x3d6264[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x25b3d5[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x3b3335[_0x6bbb('0x43')]=_0x3b3335[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x3b3335[_0x6bbb('0x43')]:_0x3d6264[_0x6bbb('0x3d')];if(!_0x25b3d5[_0x6bbb('0x3e')][_0x6bbb('0x45')](_0x6bbb('0x46'))){_0x3b3335[_0x6bbb('0x24')]=qs[_0x6bbb('0x24')](_0x25b3d5[_0x6bbb('0x3e')][_0x6bbb('0x24')]);_0x3b3335['offset']=qs[_0x6bbb('0x23')](_0x25b3d5['query'][_0x6bbb('0x23')]);}_0x3b3335[_0x6bbb('0x47')]=qs[_0x6bbb('0x48')](_0x25b3d5[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x3b3335['where']=qs[_0x6bbb('0x40')](_[_0x6bbb('0x49')](_0x25b3d5['query'],_0x3d6264[_0x6bbb('0x40')]),_0x44eb02);if(_0x25b3d5[_0x6bbb('0x3e')]['filter']){_0x3b3335[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x3b3335[_0x6bbb('0x4a')],{'$or':_[_0x6bbb('0x33')](_0x44eb02,function(_0x3f9306){if(_0x3f9306[_0x6bbb('0x36')]!=='VIRTUAL'){var _0x4da804={};_0x4da804[_0x3f9306['name']]={'$like':'%'+_0x25b3d5[_0x6bbb('0x3e')][_0x6bbb('0x31')]+'%'};return _0x4da804;}})});}_0x3b3335=_[_0x6bbb('0x4b')]({},_0x3b3335,_0x25b3d5['options']);var _0x3d9d60={'where':_0x3b3335[_0x6bbb('0x4a')]};return db[_0x6bbb('0x4c')][_0x6bbb('0x22')](_0x3d9d60)[_0x6bbb('0x2a')](function(_0xdc429d){_0x1d76d5['count']=_0xdc429d;if(_0x25b3d5[_0x6bbb('0x3e')]['includeAll']){_0x3b3335[_0x6bbb('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x6bbb('0x4e')](_0x3b3335);})[_0x6bbb('0x2a')](function(_0x5c3d48){_0x1d76d5[_0x6bbb('0x4f')]=_0x5c3d48;return _0x1d76d5;})[_0x6bbb('0x2a')](respondWithFilteredResult(_0x158e47,_0x3b3335))[_0x6bbb('0x50')](handleError(_0x158e47,null));};exports[_0x6bbb('0x51')]=function(_0xb94521,_0x54d046){var _0x5015f8={'raw':![],'where':{'id':_0xb94521[_0x6bbb('0x52')]['id']}},_0x529e66={};_0x529e66[_0x6bbb('0x3d')]=_[_0x6bbb('0x3f')](db[_0x6bbb('0x4c')][_0x6bbb('0x3b')]);_0x529e66[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0xb94521[_0x6bbb('0x3e')]);_0x529e66[_0x6bbb('0x40')]=_[_0x6bbb('0x41')](_0x529e66[_0x6bbb('0x3d')],_0x529e66[_0x6bbb('0x3e')]);_0x5015f8[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x529e66[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0xb94521[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x5015f8[_0x6bbb('0x43')]=_0x5015f8[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x5015f8['attributes']:_0x529e66[_0x6bbb('0x3d')];if(_0xb94521[_0x6bbb('0x3e')]['includeAll']){_0x5015f8['include']=[{'all':!![]}];}_0x5015f8=_[_0x6bbb('0x4b')]({},_0x5015f8,_0xb94521[_0x6bbb('0x53')]);return db[_0x6bbb('0x4c')][_0x6bbb('0x54')](_0x5015f8)['then'](handleEntityNotFound(_0x54d046,null))[_0x6bbb('0x2a')](respondWithResult(_0x54d046,null))[_0x6bbb('0x50')](handleError(_0x54d046,null));};exports[_0x6bbb('0x55')]=function(_0x2ebc31,_0x3d17e2){return db[_0x6bbb('0x4c')][_0x6bbb('0x55')](_0x2ebc31['body'],{})[_0x6bbb('0x2a')](function(_0x506dac){var _0x3293ad=_0x2ebc31[_0x6bbb('0x56')]['get']({'plain':!![]});if(!_0x3293ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3293ad[_0x6bbb('0x57')]===_0x6bbb('0x56')){var _0xcad222=_0x506dac[_0x6bbb('0x2c')]({'plain':!![]});var _0x2662a7=[{'name':_0x6bbb('0x2d'),'value':_0x6bbb('0x2e')},{'name':_0x6bbb('0x2f'),'value':_0x6bbb('0x30')}];var _0x67b20f=_[_0x6bbb('0x54')](_0x2662a7,['value',_0xcad222[_0x6bbb('0x36')]])[_0x6bbb('0x37')];return db['UserProfileSection'][_0x6bbb('0x54')]({'where':{'name':_0x67b20f,'userProfileId':_0x3293ad[_0x6bbb('0x58')]},'raw':!![]})[_0x6bbb('0x2a')](function(_0x3fe5ab){if(_0x3fe5ab&&_0x3fe5ab[_0x6bbb('0x59')]===0x0){return db[_0x6bbb('0x38')]['create']({'name':_0xcad222[_0x6bbb('0x37')],'resourceId':_0xcad222['id'],'type':_0x3fe5ab['name'],'sectionId':_0x3fe5ab['id']},{})[_0x6bbb('0x2a')](function(){return _0x506dac;});}else{return _0x506dac;}})[_0x6bbb('0x50')](function(_0x5ae3d7){logger[_0x6bbb('0x5a')](_0x6bbb('0x5b'),_0x5ae3d7);throw _0x5ae3d7;});}return _0x506dac;})[_0x6bbb('0x2a')](respondWithResult(_0x3d17e2,0xc9))['catch'](handleError(_0x3d17e2,null));};exports[_0x6bbb('0x5c')]=function(_0x49c49f,_0x480e2e){var _0x426eff={'where':{'id':_0x49c49f[_0x6bbb('0x52')]['id']}},_0x3beb5d={};_0x3beb5d[_0x6bbb('0x3d')]=_['keys'](db[_0x6bbb('0x4c')]['rawAttributes']);_0x426eff[_0x6bbb('0x43')]=_['intersection'](_0x3beb5d['model'],qs[_0x6bbb('0x42')](_0x49c49f[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x426eff[_0x6bbb('0x43')]=_0x426eff['attributes']['length']?_0x426eff[_0x6bbb('0x43')]:_0x3beb5d['model'];if(_0x49c49f[_0x6bbb('0x3e')][_0x6bbb('0x5d')]){_0x426eff[_0x6bbb('0x4d')]=[{'all':!![]}];}_0x426eff=_[_0x6bbb('0x4b')]({},_0x426eff,_0x49c49f[_0x6bbb('0x53')]);return db['VoiceQueue']['find'](_0x426eff)[_0x6bbb('0x2a')](handleEntityNotFound(_0x480e2e,null))['then'](function(_0x123534){if(_0x123534){var _0x568e9e=_0x123534[_0x6bbb('0x2c')]({'plain':!![]});_0x568e9e=qs[_0x6bbb('0x5e')](_0x568e9e,['id',_0x6bbb('0x5f'),'updatedAt']);_0x49c49f[_0x6bbb('0x60')]=_['omit'](_0x49c49f[_0x6bbb('0x60')],['id',_0x6bbb('0x5f'),_0x6bbb('0x61')]);return db[_0x6bbb('0x4c')][_0x6bbb('0x55')](_['merge'](_0x568e9e,_0x49c49f['body']),{'include':_0x49c49f[_0x6bbb('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0x6bbb('0x2a')](function(_0x11ef04){var _0x44eb7d=_0x49c49f['user'][_0x6bbb('0x2c')]({'plain':!![]});if(!_0x44eb7d)throw new Error(_0x6bbb('0x62'));if(_0x44eb7d[_0x6bbb('0x57')]===_0x6bbb('0x56')){var _0x172a18=_0x11ef04[_0x6bbb('0x2c')]({'plain':!![]});var _0x12c7be=[{'name':_0x6bbb('0x2d'),'value':_0x6bbb('0x2e')},{'name':'QueueCampaigns','value':_0x6bbb('0x30')}];var _0x421b13=_[_0x6bbb('0x54')](_0x12c7be,['value',_0x172a18['type']])[_0x6bbb('0x37')];return db[_0x6bbb('0x63')][_0x6bbb('0x54')]({'where':{'name':_0x421b13,'userProfileId':_0x44eb7d['userProfileId']},'raw':!![]})[_0x6bbb('0x2a')](function(_0x3d2539){if(_0x3d2539&&_0x3d2539[_0x6bbb('0x59')]===0x0){return db[_0x6bbb('0x38')][_0x6bbb('0x55')]({'name':_0x172a18[_0x6bbb('0x37')],'resourceId':_0x172a18['id'],'type':_0x3d2539[_0x6bbb('0x37')],'sectionId':_0x3d2539['id']},{})['then'](function(){return _0x11ef04;});}else{return _0x11ef04;}})[_0x6bbb('0x50')](function(_0x901f54){logger[_0x6bbb('0x5a')](_0x6bbb('0x5b'),_0x901f54);throw _0x901f54;});}return _0x11ef04;});}})[_0x6bbb('0x2a')](respondWithResult(_0x480e2e,0xc9))[_0x6bbb('0x50')](handleError(_0x480e2e,null));};exports[_0x6bbb('0x29')]=function(_0xecdabb,_0x200db9){if(_0xecdabb[_0x6bbb('0x60')]['id']){delete _0xecdabb['body']['id'];}return db[_0x6bbb('0x4c')][_0x6bbb('0x54')]({'where':{'id':_0xecdabb[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x200db9,null))[_0x6bbb('0x2a')](saveUpdates(_0xecdabb[_0x6bbb('0x60')],null))[_0x6bbb('0x2a')](respondWithResult(_0x200db9,null))[_0x6bbb('0x50')](handleError(_0x200db9,null));};exports['destroy']=function(_0x36740f,_0x2e3664){return db[_0x6bbb('0x4c')]['find']({'where':{'id':_0x36740f[_0x6bbb('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e3664,null))['then'](removeEntity(_0x2e3664,null))[_0x6bbb('0x50')](handleError(_0x2e3664,null));};exports[_0x6bbb('0x64')]=function(_0x1ae159,_0x20603c,_0x51cb03){var _0x45f0ed={'raw':![],'where':{}};var _0x35261f={};var _0x56e08f={'count':0x0,'rows':[]};return db[_0x6bbb('0x4c')][_0x6bbb('0x65')]({'where':{'id':_0x1ae159['params']['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x20603c,null))[_0x6bbb('0x2a')](function(_0x4e6f7b){if(_0x4e6f7b){_0x35261f['model']=_[_0x6bbb('0x3f')](db['CmHopper']['rawAttributes']);_0x35261f[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x1ae159['query']);_0x35261f['filters']=_['intersection'](_0x35261f[_0x6bbb('0x3d')],_0x35261f[_0x6bbb('0x3e')]);_0x45f0ed[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x35261f['model'],qs[_0x6bbb('0x42')](_0x1ae159[_0x6bbb('0x3e')]['fields']));_0x45f0ed[_0x6bbb('0x43')]=_0x45f0ed[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x45f0ed['attributes']:_0x35261f[_0x6bbb('0x3d')];if(!_0x1ae159[_0x6bbb('0x3e')][_0x6bbb('0x45')](_0x6bbb('0x46'))){_0x45f0ed['limit']=qs['limit'](_0x1ae159['query'][_0x6bbb('0x24')]);_0x45f0ed[_0x6bbb('0x23')]=qs[_0x6bbb('0x23')](_0x1ae159['query']['offset']);}_0x45f0ed['order']=qs[_0x6bbb('0x48')](_0x1ae159[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x45f0ed[_0x6bbb('0x4a')]=qs[_0x6bbb('0x40')](_[_0x6bbb('0x49')](_0x1ae159[_0x6bbb('0x3e')],_0x35261f[_0x6bbb('0x40')]));_0x45f0ed[_0x6bbb('0x4a')][_0x6bbb('0x66')]=_0x4e6f7b['id'];if(_0x1ae159['query'][_0x6bbb('0x31')]){_0x45f0ed[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x45f0ed['where'],{'$or':_['map'](_0x45f0ed[_0x6bbb('0x43')],function(_0x26fd45){var _0x45d533={};_0x45d533[_0x26fd45]={'$like':'%'+_0x1ae159[_0x6bbb('0x3e')][_0x6bbb('0x31')]+'%'};return _0x45d533;})});}_0x45f0ed=_[_0x6bbb('0x4b')]({},_0x45f0ed,_0x1ae159['options']);return db[_0x6bbb('0x67')]['count']({'where':_0x45f0ed[_0x6bbb('0x4a')]})[_0x6bbb('0x2a')](function(_0x3000e4){_0x56e08f[_0x6bbb('0x22')]=_0x3000e4;if(_0x1ae159['query']['includeAll']){_0x45f0ed[_0x6bbb('0x4d')]=[{'all':!![]}];}return db[_0x6bbb('0x67')]['findAll'](_0x45f0ed);})[_0x6bbb('0x2a')](function(_0x44e7e2){_0x56e08f[_0x6bbb('0x4f')]=_0x44e7e2;return _0x56e08f;});}})[_0x6bbb('0x2a')](respondWithFilteredResult(_0x20603c,_0x45f0ed))[_0x6bbb('0x50')](handleError(_0x20603c,null));};exports['getHopperHistories']=function(_0x452c2d,_0x400886,_0x59e535){var _0x37740d={'raw':!![],'where':{}};var _0x25e5d9={};var _0x3f0f91={'count':0x0,'rows':[]};return db[_0x6bbb('0x4c')][_0x6bbb('0x65')]({'where':{'id':_0x452c2d['params']['id']}})['then'](handleEntityNotFound(_0x400886,null))[_0x6bbb('0x2a')](function(_0x210b51){if(_0x210b51){_0x25e5d9[_0x6bbb('0x3d')]=_[_0x6bbb('0x3f')](db['CmHopperHistory'][_0x6bbb('0x3b')]);_0x25e5d9[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x452c2d['query']);_0x25e5d9['filters']=_['intersection'](_0x25e5d9[_0x6bbb('0x3d')],_0x25e5d9['query']);_0x37740d[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x25e5d9[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x452c2d[_0x6bbb('0x3e')]['fields']));_0x37740d[_0x6bbb('0x43')]=_0x37740d['attributes'][_0x6bbb('0x44')]?_0x37740d[_0x6bbb('0x43')]:_0x25e5d9[_0x6bbb('0x3d')];if(!_0x452c2d['query']['hasOwnProperty'](_0x6bbb('0x46'))){_0x37740d[_0x6bbb('0x24')]=qs[_0x6bbb('0x24')](_0x452c2d[_0x6bbb('0x3e')]['limit']);_0x37740d[_0x6bbb('0x23')]=qs[_0x6bbb('0x23')](_0x452c2d[_0x6bbb('0x3e')][_0x6bbb('0x23')]);}_0x37740d[_0x6bbb('0x47')]=qs[_0x6bbb('0x48')](_0x452c2d[_0x6bbb('0x3e')]['sort']);_0x37740d[_0x6bbb('0x4a')]=qs['filters'](_[_0x6bbb('0x49')](_0x452c2d[_0x6bbb('0x3e')],_0x25e5d9[_0x6bbb('0x40')]));_0x37740d[_0x6bbb('0x4a')][_0x6bbb('0x66')]=_0x210b51['id'];if(_0x452c2d['query'][_0x6bbb('0x31')]){_0x37740d[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x37740d['where'],{'$or':_[_0x6bbb('0x33')](_0x37740d[_0x6bbb('0x43')],function(_0x44f628){var _0x18d974={};_0x18d974[_0x44f628]={'$like':'%'+_0x452c2d[_0x6bbb('0x3e')]['filter']+'%'};return _0x18d974;})});}_0x37740d=_[_0x6bbb('0x4b')]({},_0x37740d,_0x452c2d[_0x6bbb('0x53')]);return db[_0x6bbb('0x68')][_0x6bbb('0x22')]({'where':_0x37740d['where']})[_0x6bbb('0x2a')](function(_0x38f6be){_0x3f0f91['count']=_0x38f6be;if(_0x452c2d[_0x6bbb('0x3e')][_0x6bbb('0x5d')]){_0x37740d[_0x6bbb('0x4d')]=[{'all':!![]}];}return db[_0x6bbb('0x68')][_0x6bbb('0x4e')](_0x37740d);})[_0x6bbb('0x2a')](function(_0x738a9f){_0x3f0f91['rows']=_0x738a9f;return _0x3f0f91;});}})['then'](respondWithFilteredResult(_0x400886,_0x37740d))[_0x6bbb('0x50')](handleError(_0x400886,null));};exports['getHopperFinals']=function(_0x19eca2,_0x203134,_0x196231){var _0x2ba821={'raw':!![],'where':{}};var _0x352518={};var _0x13124d={'count':0x0,'rows':[]};return db[_0x6bbb('0x4c')][_0x6bbb('0x65')]({'where':{'id':_0x19eca2[_0x6bbb('0x52')]['id']}})['then'](handleEntityNotFound(_0x203134,null))[_0x6bbb('0x2a')](function(_0x55bdc3){if(_0x55bdc3){_0x352518[_0x6bbb('0x3d')]=_[_0x6bbb('0x3f')](db[_0x6bbb('0x69')][_0x6bbb('0x3b')]);_0x352518['query']=_[_0x6bbb('0x3f')](_0x19eca2[_0x6bbb('0x3e')]);_0x352518['filters']=_[_0x6bbb('0x41')](_0x352518[_0x6bbb('0x3d')],_0x352518[_0x6bbb('0x3e')]);_0x2ba821[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x352518['model'],qs['fields'](_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x2ba821[_0x6bbb('0x43')]=_0x2ba821[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x2ba821[_0x6bbb('0x43')]:_0x352518[_0x6bbb('0x3d')];if(!_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x45')](_0x6bbb('0x46'))){_0x2ba821[_0x6bbb('0x24')]=qs[_0x6bbb('0x24')](_0x19eca2['query'][_0x6bbb('0x24')]);_0x2ba821[_0x6bbb('0x23')]=qs['offset'](_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x23')]);}_0x2ba821[_0x6bbb('0x47')]=qs[_0x6bbb('0x48')](_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x2ba821[_0x6bbb('0x4a')]=qs[_0x6bbb('0x40')](_['pick'](_0x19eca2[_0x6bbb('0x3e')],_0x352518[_0x6bbb('0x40')]));_0x2ba821['where'][_0x6bbb('0x66')]=_0x55bdc3['id'];if(_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x31')]){_0x2ba821[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x2ba821['where'],{'$or':_[_0x6bbb('0x33')](_0x2ba821[_0x6bbb('0x43')],function(_0xf8fc01){var _0x3e7429={};_0x3e7429[_0xf8fc01]={'$like':'%'+_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x31')]+'%'};return _0x3e7429;})});}_0x2ba821=_[_0x6bbb('0x4b')]({},_0x2ba821,_0x19eca2[_0x6bbb('0x53')]);return db[_0x6bbb('0x69')][_0x6bbb('0x22')]({'where':_0x2ba821[_0x6bbb('0x4a')]})[_0x6bbb('0x2a')](function(_0x2220fb){_0x13124d[_0x6bbb('0x22')]=_0x2220fb;if(_0x19eca2[_0x6bbb('0x3e')][_0x6bbb('0x5d')]){_0x2ba821['include']=[{'all':!![]}];}return db[_0x6bbb('0x69')][_0x6bbb('0x4e')](_0x2ba821);})[_0x6bbb('0x2a')](function(_0x2e312a){_0x13124d['rows']=_0x2e312a;return _0x13124d;});}})[_0x6bbb('0x2a')](respondWithFilteredResult(_0x203134,_0x2ba821))[_0x6bbb('0x50')](handleError(_0x203134,null));};exports['getHopperBlacks']=function(_0x3eb919,_0xaea5fa,_0x46279b){var _0x2e7bb7={'raw':!![],'where':{}};var _0x4f5c81={};var _0x3391d3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6bbb('0x65')]({'where':{'id':_0x3eb919[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0xaea5fa,null))['then'](function(_0x3d2792){if(_0x3d2792){_0x4f5c81[_0x6bbb('0x3d')]=_[_0x6bbb('0x3f')](db[_0x6bbb('0x6a')]['rawAttributes']);_0x4f5c81[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x3eb919['query']);_0x4f5c81['filters']=_[_0x6bbb('0x41')](_0x4f5c81['model'],_0x4f5c81[_0x6bbb('0x3e')]);_0x2e7bb7[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x4f5c81[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x3eb919[_0x6bbb('0x3e')]['fields']));_0x2e7bb7[_0x6bbb('0x43')]=_0x2e7bb7[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x2e7bb7[_0x6bbb('0x43')]:_0x4f5c81[_0x6bbb('0x3d')];if(!_0x3eb919['query'][_0x6bbb('0x45')](_0x6bbb('0x46'))){_0x2e7bb7[_0x6bbb('0x24')]=qs[_0x6bbb('0x24')](_0x3eb919[_0x6bbb('0x3e')][_0x6bbb('0x24')]);_0x2e7bb7[_0x6bbb('0x23')]=qs[_0x6bbb('0x23')](_0x3eb919[_0x6bbb('0x3e')][_0x6bbb('0x23')]);}_0x2e7bb7[_0x6bbb('0x47')]=qs['sort'](_0x3eb919[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x2e7bb7[_0x6bbb('0x4a')]=qs['filters'](_[_0x6bbb('0x49')](_0x3eb919[_0x6bbb('0x3e')],_0x4f5c81[_0x6bbb('0x40')]));_0x2e7bb7[_0x6bbb('0x4a')][_0x6bbb('0x66')]=_0x3d2792['id'];if(_0x3eb919['query'][_0x6bbb('0x31')]){_0x2e7bb7[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x2e7bb7['where'],{'$or':_[_0x6bbb('0x33')](_0x2e7bb7[_0x6bbb('0x43')],function(_0x2aea0a){var _0x4c1b2f={};_0x4c1b2f[_0x2aea0a]={'$like':'%'+_0x3eb919['query']['filter']+'%'};return _0x4c1b2f;})});}_0x2e7bb7=_[_0x6bbb('0x4b')]({},_0x2e7bb7,_0x3eb919[_0x6bbb('0x53')]);return db[_0x6bbb('0x6a')]['count']({'where':_0x2e7bb7[_0x6bbb('0x4a')]})[_0x6bbb('0x2a')](function(_0x35f9cf){_0x3391d3['count']=_0x35f9cf;if(_0x3eb919[_0x6bbb('0x3e')][_0x6bbb('0x5d')]){_0x2e7bb7[_0x6bbb('0x4d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6bbb('0x4e')](_0x2e7bb7);})[_0x6bbb('0x2a')](function(_0x16d41e){_0x3391d3[_0x6bbb('0x4f')]=_0x16d41e;return _0x3391d3;});}})[_0x6bbb('0x2a')](respondWithFilteredResult(_0xaea5fa,_0x2e7bb7))['catch'](handleError(_0xaea5fa,null));};exports['getTeams']=function(_0x16293a,_0x34e44e,_0x104783){var _0x4fde19={};var _0xa2a976={};var _0x15994e;var _0x295e36;return db[_0x6bbb('0x4c')][_0x6bbb('0x65')]({'where':{'id':_0x16293a[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x34e44e,null))[_0x6bbb('0x2a')](function(_0x42a0eb){if(_0x42a0eb){_0x15994e=_0x42a0eb;_0xa2a976[_0x6bbb('0x3d')]=_['keys'](db['Team']['rawAttributes']);_0xa2a976[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x16293a[_0x6bbb('0x3e')]);_0xa2a976[_0x6bbb('0x40')]=_[_0x6bbb('0x41')](_0xa2a976[_0x6bbb('0x3d')],_0xa2a976['query']);_0x4fde19[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0xa2a976[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x16293a[_0x6bbb('0x3e')]['fields']));_0x4fde19[_0x6bbb('0x43')]=_0x4fde19[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x4fde19[_0x6bbb('0x43')]:_0xa2a976[_0x6bbb('0x3d')];_0x4fde19[_0x6bbb('0x47')]=qs[_0x6bbb('0x48')](_0x16293a[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x4fde19[_0x6bbb('0x4a')]=qs['filters'](_['pick'](_0x16293a[_0x6bbb('0x3e')],_0xa2a976[_0x6bbb('0x40')]));if(_0x16293a[_0x6bbb('0x3e')][_0x6bbb('0x31')]){_0x4fde19[_0x6bbb('0x4a')]=_['merge'](_0x4fde19['where'],{'$or':_['map'](_0x4fde19[_0x6bbb('0x43')],function(_0x5bbbad){var _0x537fbb={};_0x537fbb[_0x5bbbad]={'$like':'%'+_0x16293a['query'][_0x6bbb('0x31')]+'%'};return _0x537fbb;})});}_0x4fde19=_[_0x6bbb('0x4b')]({},_0x4fde19,_0x16293a['options']);return _0x15994e['getTeams'](_0x4fde19);}})[_0x6bbb('0x2a')](function(_0x1b6029){if(_0x1b6029){_0x295e36=_0x1b6029['length'];if(!_0x16293a[_0x6bbb('0x3e')][_0x6bbb('0x45')]('nolimit')){_0x4fde19[_0x6bbb('0x24')]=qs[_0x6bbb('0x24')](_0x16293a[_0x6bbb('0x3e')]['limit']);_0x4fde19[_0x6bbb('0x23')]=qs[_0x6bbb('0x23')](_0x16293a[_0x6bbb('0x3e')]['offset']);}return _0x15994e[_0x6bbb('0x6b')](_0x4fde19);}})['then'](function(_0x57e073){if(_0x57e073){return _0x57e073?{'count':_0x295e36,'rows':_0x57e073}:null;}})[_0x6bbb('0x2a')](respondWithResult(_0x34e44e,null))['catch'](handleError(_0x34e44e,null));};exports[_0x6bbb('0x6c')]=function(_0x123e08,_0x40a25a,_0x3deb5e){var _0x364556=_0x123e08[_0x6bbb('0x60')][_0x6bbb('0x6d')];var _0x567501=_['map'](_0x364556,'id');return db[_0x6bbb('0x6e')][_0x6bbb('0x4e')]({'where':{'id':_0x567501},'attributes':['id'],'include':[{'model':db[_0x6bbb('0x6f')],'as':_0x6bbb('0x70'),'attributes':['id','name',_0x6bbb('0x71'),_0x6bbb('0x72'),_0x6bbb('0x73')],'raw':!![]}]})[_0x6bbb('0x2a')](function(_0x3b39b2){if(_0x3b39b2){var _0x487dcf=_['flatMap'](_0x3b39b2,function(_0x17d178){var _0x5f3bc4=_0x17d178['get']({'plain':!![]});_0x5f3bc4[_0x6bbb('0x70')][_0x6bbb('0x74')](function(_0x491df7){_0x491df7[_0x6bbb('0x75')]=_['find'](_0x364556,{'id':_0x5f3bc4['id']})['penalty'];});return _0x5f3bc4[_0x6bbb('0x70')];});return db['VoiceQueue'][_0x6bbb('0x54')]({'where':{'id':_0x123e08[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](function(_0x14948d){return db[_0x6bbb('0x76')][_0x6bbb('0x77')](function(_0xfd28fc){return _0x14948d[_0x6bbb('0x6c')](_0x567501,{'transaction':_0xfd28fc})['then'](function(){return BPromise['each'](_0x487dcf,function(_0xffebaf){return db[_0x6bbb('0x78')]['findOrCreate']({'where':{'UserId':_0xffebaf['id'],'VoiceQueueId':_0x123e08['params']['id']},'defaults':{'penalty':_0xffebaf[_0x6bbb('0x75')]},'transaction':_0xfd28fc});});})['then'](function(){return BPromise['each'](_[_0x6bbb('0x31')](_0x487dcf,{'online':!![]}),function(_0x3f49e8){return db['UserVoiceQueueRt'][_0x6bbb('0x79')]({'membername':_0x3f49e8[_0x6bbb('0x37')],'UserId':_0x3f49e8['id'],'queue_name':_0x14948d['name'],'VoiceQueueId':_0x14948d['id'],'interface':_[_0x6bbb('0x7a')](_0x3f49e8['interface'])?util[_0x6bbb('0x7b')](_0x6bbb('0x7c'),_0x3f49e8[_0x6bbb('0x37')]):_0x3f49e8[_0x6bbb('0x73')],'paused':_0x3f49e8[_0x6bbb('0x72')]||![],'penalty':_0x3f49e8[_0x6bbb('0x75')]},{'transaction':_0xfd28fc});});})['then'](function(){_0x487dcf[_0x6bbb('0x74')](function(_0x2150a9){socket[_0x6bbb('0x7d')]('userVoiceQueue:save',{'UserId':_0x2150a9['id'],'VoiceQueueId':_0x14948d['id']});});});});});}})[_0x6bbb('0x2a')](respondWithStatusCode(_0x40a25a,null))[_0x6bbb('0x50')](handleError(_0x40a25a,null));};exports[_0x6bbb('0x7e')]=function(_0xaa3a54,_0x243224,_0x45d4bc){return db['Team']['findAll']({'where':{'id':_0xaa3a54['query'][_0x6bbb('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x6bbb('0x6f')],'as':_0x6bbb('0x70'),'attributes':['id'],'raw':!![]}]})[_0x6bbb('0x2a')](handleEntityNotFound(_0x243224,null))['then'](function(_0x4993b7){var _0x106708=_['map'](_0x4993b7,'id');var _0x54f004=[];var _0x5a1be2=[];var _0x33b5c1=squel[_0x6bbb('0x80')]();_0x33b5c1[_0x6bbb('0x81')](_0x6bbb('0x82'))[_0x6bbb('0x83')]('team_has_voice_queues','tq')[_0x6bbb('0x84')](_0x6bbb('0x85'),'ut',_0x6bbb('0x86'))[_0x6bbb('0x4a')]('VoiceQueueId\x20=\x20?',_0xaa3a54[_0x6bbb('0x52')]['id']);for(var _0x286895=0x0;_0x286895<_0x4993b7[_0x6bbb('0x44')];_0x286895+=0x1){let _0x4622b3=_0x4993b7[_0x286895];for(var _0x216f28=0x0;_0x216f28<_0x4622b3['Agents'][_0x6bbb('0x44')];_0x216f28+=0x1){let _0x2372a7=_0x4622b3['Agents'][_0x216f28];var _0x52e298=_0x33b5c1[_0x6bbb('0x5c')]();_0x52e298[_0x6bbb('0x4a')](_0x6bbb('0x87'),_0x2372a7['id']);_0x5a1be2[_0x6bbb('0x88')](db[_0x6bbb('0x76')][_0x6bbb('0x3e')](_0x52e298[_0x6bbb('0x89')](),{'type':db[_0x6bbb('0x76')]['QueryTypes'][_0x6bbb('0x8a')]})[_0x6bbb('0x2a')](function(_0x5379d1){if(_0x5379d1[_0x6bbb('0x44')]===0x1){return _0x2372a7['id'];}else{var _0x1fd1ac=_[_0x6bbb('0x8b')](_[_0x6bbb('0x33')](_0x5379d1,_0x6bbb('0x8c')),function(_0x4ce90f){return _[_0x6bbb('0x35')](_0x106708,_0x4ce90f);});if(_0x1fd1ac){return _0x2372a7['id'];}}}));}}return BPromise[_0x6bbb('0x8d')](_0x5a1be2)['then'](function(_0x4a4f7d){_0x54f004=_(_0x54f004)[_0x6bbb('0x8e')](_0x4a4f7d)[_0x6bbb('0x8f')]()['value']();return db['VoiceQueue'][_0x6bbb('0x54')]({'where':{'id':_0xaa3a54['params']['id']}})['then'](function(_0x54ac5f){return db['sequelize'][_0x6bbb('0x77')](function(_0x27d8e5){return _0x54ac5f[_0x6bbb('0x7e')](_0xaa3a54[_0x6bbb('0x3e')][_0x6bbb('0x7f')],{'transaction':_0x27d8e5})['then'](function(){if(!_[_0x6bbb('0x90')](_0x54f004)){return _0x54ac5f['removeAgents'](_0x54f004,{'transaction':_0x27d8e5})[_0x6bbb('0x2a')](function(){return db[_0x6bbb('0x91')]['destroy']({'where':{'VoiceQueueId':_0xaa3a54[_0x6bbb('0x52')]['id'],'UserId':_0x54f004},'transaction':_0x27d8e5});});}})[_0x6bbb('0x2a')](function(){_0x54f004['forEach'](function(_0x369bf9){socket[_0x6bbb('0x7d')](_0x6bbb('0x92'),{'UserId':_0x369bf9,'VoiceQueueId':_0x54ac5f['id']});});});});});});})[_0x6bbb('0x2a')](respondWithStatusCode(_0x243224,null))[_0x6bbb('0x50')](handleError(_0x243224,null));};exports[_0x6bbb('0x93')]=function(_0x468465,_0x2d31a2,_0x3c7ea6){var _0x408d98,_0xb914cd;return db['VoiceQueue'][_0x6bbb('0x54')]({'where':{'id':_0x468465[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x2d31a2,null))['then'](function(_0xba00ff){if(_0xba00ff){_0xb914cd=_0xba00ff;return _0xba00ff['addAgents'](_0x468465[_0x6bbb('0x60')][_0x6bbb('0x7f')],_[_0x6bbb('0x5e')](_0x468465[_0x6bbb('0x60')],[_0x6bbb('0x7f'),'id'])||{})[_0x6bbb('0x94')](function(_0x599836){for(var _0x565d89=0x0;_0x565d89<_0x468465['body']['ids']['length'];_0x565d89+=0x1){socket[_0x6bbb('0x7d')](_0x6bbb('0x95'),{'UserId':_0x468465[_0x6bbb('0x60')]['ids'][_0x565d89],'VoiceQueueId':_0x468465[_0x6bbb('0x52')]['id']});}return _0x599836;});}})[_0x6bbb('0x2a')](function(_0x4b04a4){_0x408d98=_0x4b04a4||[];if(_0xb914cd){return db[_0x6bbb('0x6f')][_0x6bbb('0x4e')]({'where':{'id':_0x468465[_0x6bbb('0x60')][_0x6bbb('0x7f')]},'attributes':['id',_0x6bbb('0x37'),_0x6bbb('0x71'),_0x6bbb('0x72'),_0x6bbb('0x73')],'raw':!![]});}})[_0x6bbb('0x2a')](function(_0x19c375){if(!_[_0x6bbb('0x90')](_0x19c375)){var _0x1b8e80=[];for(var _0x45738b=0x0;_0x45738b<_0x19c375[_0x6bbb('0x44')];_0x45738b++){if(_0x19c375[_0x45738b][_0x6bbb('0x71')]){_0x1b8e80[_0x6bbb('0x88')](db[_0x6bbb('0x91')]['upsert']({'membername':_0x19c375[_0x45738b][_0x6bbb('0x37')],'UserId':_0x19c375[_0x45738b]['id'],'queue_name':_0xb914cd['name'],'VoiceQueueId':_0xb914cd['id'],'interface':_[_0x6bbb('0x7a')](_0x19c375[_0x45738b][_0x6bbb('0x73')])?util[_0x6bbb('0x7b')](_0x6bbb('0x7c'),_0x19c375[_0x45738b][_0x6bbb('0x37')]):_0x19c375[_0x45738b][_0x6bbb('0x73')],'paused':_0x19c375[_0x45738b][_0x6bbb('0x72')]||![],'penalty':_0x468465[_0x6bbb('0x60')][_0x6bbb('0x75')]||0x0}));}}return BPromise[_0x6bbb('0x8d')](_0x1b8e80);}})[_0x6bbb('0x2a')](function(){return _0x408d98;})[_0x6bbb('0x2a')](respondWithResult(_0x2d31a2,null))[_0x6bbb('0x50')](handleError(_0x2d31a2,null));};exports[_0x6bbb('0x96')]=function(_0x5f144a,_0x32475a,_0x48ab5c){return db['VoiceQueue'][_0x6bbb('0x54')]({'where':{'id':_0x5f144a[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x32475a,null))[_0x6bbb('0x2a')](function(_0x187240){if(_0x187240){return _0x187240[_0x6bbb('0x96')](_0x5f144a[_0x6bbb('0x3e')][_0x6bbb('0x7f')])[_0x6bbb('0x2a')](function(){if(_[_0x6bbb('0x97')](_0x5f144a[_0x6bbb('0x3e')]['ids'])){for(var _0x36f793=0x0;_0x36f793<_0x5f144a['query'][_0x6bbb('0x7f')][_0x6bbb('0x44')];_0x36f793+=0x1){socket[_0x6bbb('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0x5f144a[_0x6bbb('0x3e')][_0x6bbb('0x7f')][_0x36f793]),'VoiceQueueId':Number(_0x5f144a['params']['id'])});}}else{socket[_0x6bbb('0x7d')](_0x6bbb('0x92'),{'UserId':Number(_0x5f144a['query'][_0x6bbb('0x7f')]),'VoiceQueueId':Number(_0x5f144a[_0x6bbb('0x52')]['id'])});}});}})[_0x6bbb('0x2a')](function(_0x32e650){return db['UserVoiceQueueRt'][_0x6bbb('0x2b')]({'where':{'VoiceQueueId':_0x5f144a['params']['id'],'UserId':_0x5f144a[_0x6bbb('0x3e')][_0x6bbb('0x7f')]}})[_0x6bbb('0x2a')](function(){return _0x32e650;});})[_0x6bbb('0x2a')](respondWithStatusCode(_0x32475a,null))['catch'](handleError(_0x32475a,null));};exports[_0x6bbb('0x98')]=function(_0x477b36,_0x361e55,_0x47f77f){var _0x5ef2e5={};var _0x4fc378={};var _0x36f97e;var _0x3b5154;return db[_0x6bbb('0x4c')][_0x6bbb('0x65')]({'where':{'id':_0x477b36[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x361e55,null))[_0x6bbb('0x2a')](function(_0x742680){if(_0x742680){_0x36f97e=_0x742680;_0x4fc378[_0x6bbb('0x3d')]=_['keys'](db[_0x6bbb('0x6f')][_0x6bbb('0x3b')]);_0x4fc378[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x477b36[_0x6bbb('0x3e')]);_0x4fc378[_0x6bbb('0x40')]=_['intersection'](_0x4fc378[_0x6bbb('0x3d')],_0x4fc378[_0x6bbb('0x3e')]);_0x5ef2e5[_0x6bbb('0x43')]=_['intersection'](_0x4fc378[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x477b36[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x5ef2e5['attributes']=_0x5ef2e5[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x5ef2e5['attributes']:_0x4fc378[_0x6bbb('0x3d')];_0x5ef2e5['order']=qs['sort'](_0x477b36[_0x6bbb('0x3e')]['sort']);_0x5ef2e5['where']=qs[_0x6bbb('0x40')](_[_0x6bbb('0x49')](_0x477b36[_0x6bbb('0x3e')],_0x4fc378[_0x6bbb('0x40')]));if(_0x477b36['query'][_0x6bbb('0x31')]){_0x5ef2e5[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x5ef2e5['where'],{'$or':_[_0x6bbb('0x33')](_0x5ef2e5[_0x6bbb('0x43')],function(_0xe0bdc1){var _0x3c2db5={};_0x3c2db5[_0xe0bdc1]={'$like':'%'+_0x477b36['query']['filter']+'%'};return _0x3c2db5;})});}_0x5ef2e5=_[_0x6bbb('0x4b')]({},_0x5ef2e5,_0x477b36[_0x6bbb('0x53')]);return _0x36f97e[_0x6bbb('0x98')](_0x5ef2e5);}})['then'](function(_0x321cc8){if(_0x321cc8){_0x3b5154=_0x321cc8[_0x6bbb('0x44')];if(!_0x477b36[_0x6bbb('0x3e')][_0x6bbb('0x45')](_0x6bbb('0x46'))){_0x5ef2e5['limit']=qs['limit'](_0x477b36[_0x6bbb('0x3e')][_0x6bbb('0x24')]);_0x5ef2e5[_0x6bbb('0x23')]=qs['offset'](_0x477b36[_0x6bbb('0x3e')][_0x6bbb('0x23')]);}return _0x36f97e[_0x6bbb('0x98')](_0x5ef2e5);}})[_0x6bbb('0x2a')](function(_0x1a485b){if(_0x1a485b){return _0x1a485b?{'count':_0x3b5154,'rows':_0x1a485b}:null;}})[_0x6bbb('0x2a')](respondWithResult(_0x361e55,null))[_0x6bbb('0x50')](handleError(_0x361e55,null));};exports[_0x6bbb('0x99')]=function(_0x5b8a3e,_0x31f689,_0x2112e3){var _0x522954={};var _0xb8ad86={};var _0x4b925a;var _0x1483e0;return db[_0x6bbb('0x4c')][_0x6bbb('0x65')]({'where':{'id':_0x5b8a3e['params']['id']}})['then'](handleEntityNotFound(_0x31f689,null))[_0x6bbb('0x2a')](function(_0x8dbe){if(_0x8dbe){_0x4b925a=_0x8dbe;_0xb8ad86['model']=_[_0x6bbb('0x3f')](db[_0x6bbb('0x91')][_0x6bbb('0x3b')]);_0xb8ad86[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x5b8a3e[_0x6bbb('0x3e')]);_0xb8ad86['filters']=_[_0x6bbb('0x41')](_0xb8ad86[_0x6bbb('0x3d')],_0xb8ad86[_0x6bbb('0x3e')]);_0x522954[_0x6bbb('0x43')]=_['intersection'](_0xb8ad86['model'],qs[_0x6bbb('0x42')](_0x5b8a3e['query'][_0x6bbb('0x42')]));_0x522954['attributes']=_0x522954[_0x6bbb('0x43')]['length']?_0x522954[_0x6bbb('0x43')]:_0xb8ad86[_0x6bbb('0x3d')];_0x522954[_0x6bbb('0x47')]=qs[_0x6bbb('0x48')](_0x5b8a3e[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x522954[_0x6bbb('0x4a')]=qs[_0x6bbb('0x40')](_[_0x6bbb('0x49')](_0x5b8a3e[_0x6bbb('0x3e')],_0xb8ad86[_0x6bbb('0x40')]));if(_0x5b8a3e[_0x6bbb('0x3e')][_0x6bbb('0x31')]){_0x522954[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x522954[_0x6bbb('0x4a')],{'$or':_[_0x6bbb('0x33')](_0x522954['attributes'],function(_0x51ad22){var _0x328ca6={};_0x328ca6[_0x51ad22]={'$like':'%'+_0x5b8a3e[_0x6bbb('0x3e')][_0x6bbb('0x31')]+'%'};return _0x328ca6;})});}_0x522954=_[_0x6bbb('0x4b')]({},_0x522954,_0x5b8a3e[_0x6bbb('0x53')]);return _0x4b925a['getMembers'](_0x522954);}})[_0x6bbb('0x2a')](function(_0x1e732c){if(_0x1e732c){_0x1483e0=_0x1e732c['length'];if(!_0x5b8a3e[_0x6bbb('0x3e')][_0x6bbb('0x45')]('nolimit')){_0x522954['limit']=qs['limit'](_0x5b8a3e[_0x6bbb('0x3e')][_0x6bbb('0x24')]);_0x522954['offset']=qs[_0x6bbb('0x23')](_0x5b8a3e[_0x6bbb('0x3e')][_0x6bbb('0x23')]);}return _0x4b925a['getMembers'](_0x522954);}})[_0x6bbb('0x2a')](function(_0x5f45ab){return _0x5f45ab?{'count':_0x1483e0,'rows':_0x5f45ab}:null;})[_0x6bbb('0x2a')](respondWithResult(_0x31f689,null))['catch'](handleError(_0x31f689,null));};exports[_0x6bbb('0x9a')]=function(_0x2dc41f,_0x21ed3b,_0x1f8a65){var _0x5aae8c={};var _0x4ba63e={};var _0x3cf8da;var _0x566b96;return db[_0x6bbb('0x4c')]['findOne']({'where':{'id':_0x2dc41f['params']['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x21ed3b,null))['then'](function(_0x508f8d){if(_0x508f8d){_0x3cf8da=_0x508f8d;_0x4ba63e['model']=_[_0x6bbb('0x3f')](db['CmList']['rawAttributes']);_0x4ba63e[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x2dc41f[_0x6bbb('0x3e')]);_0x4ba63e['filters']=_[_0x6bbb('0x41')](_0x4ba63e[_0x6bbb('0x3d')],_0x4ba63e[_0x6bbb('0x3e')]);_0x5aae8c[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x4ba63e[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x2dc41f[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x5aae8c[_0x6bbb('0x43')]=_0x5aae8c[_0x6bbb('0x43')][_0x6bbb('0x44')]?_0x5aae8c[_0x6bbb('0x43')]:_0x4ba63e['model'];_0x5aae8c[_0x6bbb('0x47')]=qs[_0x6bbb('0x48')](_0x2dc41f[_0x6bbb('0x3e')][_0x6bbb('0x48')]);_0x5aae8c['where']=qs['filters'](_[_0x6bbb('0x49')](_0x2dc41f[_0x6bbb('0x3e')],_0x4ba63e['filters']));if(_0x2dc41f['query'][_0x6bbb('0x31')]){_0x5aae8c[_0x6bbb('0x4a')]=_['merge'](_0x5aae8c[_0x6bbb('0x4a')],{'$or':_[_0x6bbb('0x33')](_0x5aae8c['attributes'],function(_0x4c9748){var _0x144426={};_0x144426[_0x4c9748]={'$like':'%'+_0x2dc41f[_0x6bbb('0x3e')][_0x6bbb('0x31')]+'%'};return _0x144426;})});}_0x5aae8c=_[_0x6bbb('0x4b')]({},_0x5aae8c,_0x2dc41f[_0x6bbb('0x53')]);return _0x3cf8da[_0x6bbb('0x9a')](_0x5aae8c);}})[_0x6bbb('0x2a')](function(_0x4694f6){if(_0x4694f6){_0x566b96=_0x4694f6[_0x6bbb('0x44')];if(!_0x2dc41f[_0x6bbb('0x3e')][_0x6bbb('0x45')](_0x6bbb('0x46'))){_0x5aae8c[_0x6bbb('0x24')]=qs[_0x6bbb('0x24')](_0x2dc41f[_0x6bbb('0x3e')][_0x6bbb('0x24')]);_0x5aae8c[_0x6bbb('0x23')]=qs[_0x6bbb('0x23')](_0x2dc41f['query']['offset']);}return _0x3cf8da[_0x6bbb('0x9a')](_0x5aae8c);}})[_0x6bbb('0x2a')](function(_0xafc3ff){if(_0xafc3ff){return _0xafc3ff?{'count':_0x566b96,'rows':_0xafc3ff}:null;}})['then'](respondWithResult(_0x21ed3b,null))[_0x6bbb('0x50')](handleError(_0x21ed3b,null));};exports[_0x6bbb('0x9b')]=function(_0x16a089,_0x4587a9,_0x94dd9d){var _0x432eb7,_0x4cf5d9;return db[_0x6bbb('0x4c')][_0x6bbb('0x54')]({'where':{'id':_0x16a089[_0x6bbb('0x52')]['id']}})['then'](handleEntityNotFound(_0x4587a9,null))[_0x6bbb('0x2a')](function(_0x53c088){if(_0x53c088){_0x4cf5d9=_0x53c088;return _0x53c088[_0x6bbb('0x9b')](_0x16a089['body'][_0x6bbb('0x7f')],_[_0x6bbb('0x5e')](_0x16a089[_0x6bbb('0x60')],['ids','id'])||{});}return null;})[_0x6bbb('0x94')](function(_0x251641){var _0x16d0ad;_0x432eb7=_0x251641||[];var _0x46d4f9=[];if(_0x251641){for(var _0x5a75cc=0x0;_0x5a75cc<_0x251641[_0x6bbb('0x44')];_0x5a75cc+=0x1){var _0x2e1ef6=_0x251641[_0x5a75cc]['get']({'plain':!![]});_0x4cf5d9[_0x6bbb('0x9c')]=_0x16a089[_0x6bbb('0x60')]['dialCheckDuplicateType']?_0x16a089['body'][_0x6bbb('0x9c')]:_0x4cf5d9[_0x6bbb('0x9c')];switch(_0x4cf5d9[_0x6bbb('0x9c')]){case _0x6bbb('0x9d'):_0x16d0ad=squel['insert']()[_0x6bbb('0x9e')](_0x6bbb('0x9f'))[_0x6bbb('0xa0')]([_0x6bbb('0xa1'),_0x6bbb('0xa2'),_0x6bbb('0xa3'),_0x6bbb('0xa4'),'VoiceQueueId',_0x6bbb('0x5f'),_0x6bbb('0x61')],squel[_0x6bbb('0x80')]()[_0x6bbb('0x81')]('phone','phone')['field']('NOW()',_0x6bbb('0xa2'))[_0x6bbb('0x81')]('id',_0x6bbb('0xa3'))[_0x6bbb('0x81')](_0x2e1ef6[_0x6bbb('0xa5')][_0x6bbb('0x89')](),_0x6bbb('0xa4'))['field'](_0x16a089['params']['id'][_0x6bbb('0x89')](),_0x6bbb('0x66'))['field']('NOW()','createdAt')[_0x6bbb('0x81')](_0x6bbb('0xa6'),_0x6bbb('0x61'))[_0x6bbb('0x83')](_0x6bbb('0xa7'))['where'](_0x6bbb('0xa8'))[_0x6bbb('0x4a')]('ListId\x20=\x20?',_0x2e1ef6[_0x6bbb('0xa5')][_0x6bbb('0x89')]())[_0x6bbb('0x4a')](_0x6bbb('0xa9'))[_0x6bbb('0x4a')](_0x6bbb('0xaa'),squel[_0x6bbb('0x80')]()[_0x6bbb('0x81')](_0x6bbb('0xab'))[_0x6bbb('0x83')](_0x6bbb('0xac'))[_0x6bbb('0x4a')](_0x6bbb('0xad'),_0x16a089[_0x6bbb('0x52')]['id'][_0x6bbb('0x89')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6bbb('0x80')]()[_0x6bbb('0x81')](_0x6bbb('0xae'))['from'](_0x6bbb('0x9f'))[_0x6bbb('0x4a')](_0x6bbb('0xad'),_0x16a089[_0x6bbb('0x52')]['id']['toString']())))[_0x6bbb('0x89')]();break;case _0x6bbb('0xaf'):_0x16d0ad=squel[_0x6bbb('0xb0')]()[_0x6bbb('0x9e')](_0x6bbb('0x9f'))[_0x6bbb('0xa0')]([_0x6bbb('0xa1'),_0x6bbb('0xa2'),_0x6bbb('0xa3'),_0x6bbb('0xa4'),_0x6bbb('0x66'),'createdAt',_0x6bbb('0x61')],squel[_0x6bbb('0x80')]()[_0x6bbb('0x81')](_0x6bbb('0xa1'),_0x6bbb('0xa1'))['field'](_0x6bbb('0xa6'),'scheduledAt')[_0x6bbb('0x81')]('id','ContactId')[_0x6bbb('0x81')](_0x2e1ef6[_0x6bbb('0xa5')][_0x6bbb('0x89')](),_0x6bbb('0xa4'))[_0x6bbb('0x81')](_0x16a089['params']['id']['toString'](),_0x6bbb('0x66'))[_0x6bbb('0x81')](_0x6bbb('0xa6'),_0x6bbb('0x5f'))[_0x6bbb('0x81')](_0x6bbb('0xa6'),_0x6bbb('0x61'))[_0x6bbb('0x83')](_0x6bbb('0xa7'))[_0x6bbb('0x4a')](_0x6bbb('0xa8'))[_0x6bbb('0x4a')]('ListId\x20=\x20?',_0x2e1ef6['CmListId'][_0x6bbb('0x89')]())[_0x6bbb('0x4a')]('phone\x20IS\x20NOT\x20NULL')[_0x6bbb('0x4a')](_0x6bbb('0xaa'),squel[_0x6bbb('0x80')]()['field'](_0x6bbb('0xae'))[_0x6bbb('0x83')](_0x6bbb('0x9f'))[_0x6bbb('0x4a')]('VoiceQueueId\x20=\x20?',_0x16a089[_0x6bbb('0x52')]['id'][_0x6bbb('0x89')]())))[_0x6bbb('0x89')]();break;default:_0x16d0ad=squel[_0x6bbb('0xb0')]()[_0x6bbb('0x9e')]('cm_hopper')[_0x6bbb('0xa0')]([_0x6bbb('0xa1'),_0x6bbb('0xa2'),_0x6bbb('0xa3'),_0x6bbb('0xa4'),_0x6bbb('0x66'),_0x6bbb('0x5f'),'updatedAt'],squel[_0x6bbb('0x80')]()[_0x6bbb('0x81')]('phone',_0x6bbb('0xa1'))['field']('NOW()','scheduledAt')['field']('id',_0x6bbb('0xa3'))[_0x6bbb('0x81')](_0x2e1ef6[_0x6bbb('0xa5')]['toString'](),'ListId')[_0x6bbb('0x81')](_0x16a089[_0x6bbb('0x52')]['id'][_0x6bbb('0x89')](),_0x6bbb('0x66'))[_0x6bbb('0x81')](_0x6bbb('0xa6'),'createdAt')['field'](_0x6bbb('0xa6'),'updatedAt')['from']('cm_contacts')[_0x6bbb('0x4a')]('deletedAt\x20IS\x20NULL')[_0x6bbb('0x4a')](_0x6bbb('0xb1'),_0x2e1ef6[_0x6bbb('0xa5')]['toString']())[_0x6bbb('0x4a')](_0x6bbb('0xa9')))[_0x6bbb('0x89')]();}_0x46d4f9[_0x6bbb('0x88')](db[_0x6bbb('0x76')][_0x6bbb('0x3e')](_0x16d0ad));}return BPromise[_0x6bbb('0x8d')](_0x46d4f9);}})[_0x6bbb('0x2a')](function(){return _0x432eb7;})['then'](respondWithResult(_0x4587a9,null))['catch'](handleError(_0x4587a9,null));};exports[_0x6bbb('0xb2')]=function(_0x311fe7,_0x11be23,_0x5869a1){return db[_0x6bbb('0x4c')][_0x6bbb('0x54')]({'where':{'id':_0x311fe7[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x11be23,null))[_0x6bbb('0x2a')](function(_0x3c5c1c){if(_0x3c5c1c){return _0x3c5c1c['removeLists'](_0x311fe7[_0x6bbb('0x3e')]['ids']);}})[_0x6bbb('0x2a')](function(_0x2faef4){if(_0x2faef4){return db[_0x6bbb('0x67')][_0x6bbb('0x2b')]({'where':{'ListId':_0x311fe7[_0x6bbb('0x3e')]['ids'],'VoiceQueueId':_0x311fe7[_0x6bbb('0x52')]['id']}})[_0x6bbb('0x2a')](function(){return _0x2faef4;});}})['then'](respondWithStatusCode(_0x11be23,null))[_0x6bbb('0x50')](handleError(_0x11be23,null));};exports[_0x6bbb('0xb3')]=function(_0x5bb88f,_0x4dd078,_0x2f090f){var _0x2419ab={};var _0x4485b7={};var _0x1bdd16;var _0x2f2bda;return db[_0x6bbb('0x4c')]['findOne']({'where':{'id':_0x5bb88f['params']['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x4dd078,null))[_0x6bbb('0x2a')](function(_0x2081ca){if(_0x2081ca){_0x1bdd16=_0x2081ca;_0x4485b7[_0x6bbb('0x3d')]=_[_0x6bbb('0x3f')](db[_0x6bbb('0xb4')][_0x6bbb('0x3b')]);_0x4485b7[_0x6bbb('0x3e')]=_[_0x6bbb('0x3f')](_0x5bb88f[_0x6bbb('0x3e')]);_0x4485b7[_0x6bbb('0x40')]=_[_0x6bbb('0x41')](_0x4485b7[_0x6bbb('0x3d')],_0x4485b7[_0x6bbb('0x3e')]);_0x2419ab[_0x6bbb('0x43')]=_[_0x6bbb('0x41')](_0x4485b7[_0x6bbb('0x3d')],qs[_0x6bbb('0x42')](_0x5bb88f[_0x6bbb('0x3e')][_0x6bbb('0x42')]));_0x2419ab['attributes']=_0x2419ab[_0x6bbb('0x43')]['length']?_0x2419ab['attributes']:_0x4485b7[_0x6bbb('0x3d')];_0x2419ab['order']=qs[_0x6bbb('0x48')](_0x5bb88f[_0x6bbb('0x3e')]['sort']);_0x2419ab[_0x6bbb('0x4a')]=qs['filters'](_[_0x6bbb('0x49')](_0x5bb88f[_0x6bbb('0x3e')],_0x4485b7[_0x6bbb('0x40')]));if(_0x5bb88f[_0x6bbb('0x3e')]['filter']){_0x2419ab[_0x6bbb('0x4a')]=_[_0x6bbb('0x4b')](_0x2419ab[_0x6bbb('0x4a')],{'$or':_[_0x6bbb('0x33')](_0x2419ab[_0x6bbb('0x43')],function(_0x444274){var _0x1e592d={};_0x1e592d[_0x444274]={'$like':'%'+_0x5bb88f[_0x6bbb('0x3e')][_0x6bbb('0x31')]+'%'};return _0x1e592d;})});}_0x2419ab=_[_0x6bbb('0x4b')]({},_0x2419ab,_0x5bb88f[_0x6bbb('0x53')]);return _0x1bdd16[_0x6bbb('0xb3')](_0x2419ab);}})[_0x6bbb('0x2a')](function(_0x1a6d10){if(_0x1a6d10){_0x2f2bda=_0x1a6d10['length'];if(!_0x5bb88f[_0x6bbb('0x3e')]['hasOwnProperty'](_0x6bbb('0x46'))){_0x2419ab['limit']=qs[_0x6bbb('0x24')](_0x5bb88f[_0x6bbb('0x3e')]['limit']);_0x2419ab['offset']=qs[_0x6bbb('0x23')](_0x5bb88f[_0x6bbb('0x3e')][_0x6bbb('0x23')]);}return _0x1bdd16[_0x6bbb('0xb3')](_0x2419ab);}})[_0x6bbb('0x2a')](function(_0x5abc8e){if(_0x5abc8e){return _0x5abc8e?{'count':_0x2f2bda,'rows':_0x5abc8e}:null;}})['then'](respondWithResult(_0x4dd078,null))[_0x6bbb('0x50')](handleError(_0x4dd078,null));};exports['addBlackLists']=function(_0xe58d9c,_0x4e4986,_0x229b2b){var _0x535629,_0x14c47f;return db['VoiceQueue']['find']({'where':{'id':_0xe58d9c['params']['id']}})[_0x6bbb('0x2a')](handleEntityNotFound(_0x4e4986,null))['then'](function(_0x5dd104){if(_0x5dd104){_0x14c47f=_0x5dd104;return _0x5dd104[_0x6bbb('0xb5')](_0xe58d9c['body'][_0x6bbb('0x7f')],_[_0x6bbb('0x5e')](_0xe58d9c[_0x6bbb('0x60')],[_0x6bbb('0x7f'),'id'])||{});}return null;})[_0x6bbb('0x94')](function(_0x33a759){var _0x24080a;_0x535629=_0x33a759||[];var _0x25b645=[];if(_0x33a759){for(var _0x58a835=0x0;_0x58a835<_0x33a759[_0x6bbb('0x44')];_0x58a835+=0x1){var _0x2e49a2=_0x33a759[_0x58a835][_0x6bbb('0x2c')]({'plain':!![]});_0x24080a=squel[_0x6bbb('0xb0')]()[_0x6bbb('0x9e')](_0x6bbb('0xb6'))['fromQuery']([_0x6bbb('0xa1'),_0x6bbb('0xa3'),_0x6bbb('0xa4'),_0x6bbb('0x66'),'createdAt',_0x6bbb('0x61')],squel[_0x6bbb('0x80')]()[_0x6bbb('0x81')]('phone','phone')[_0x6bbb('0x81')]('id',_0x6bbb('0xa3'))[_0x6bbb('0x81')](_0x2e49a2[_0x6bbb('0xa5')]['toString'](),_0x6bbb('0xa4'))['field'](_0xe58d9c[_0x6bbb('0x52')]['id'][_0x6bbb('0x89')](),_0x6bbb('0x66'))[_0x6bbb('0x81')](_0x6bbb('0xa6'),'createdAt')['field'](_0x6bbb('0xa6'),'updatedAt')[_0x6bbb('0x83')](_0x6bbb('0xa7'))['where']('deletedAt\x20IS\x20NULL')[_0x6bbb('0x4a')](_0x6bbb('0xb1'),_0x2e49a2[_0x6bbb('0xa5')][_0x6bbb('0x89')]())['where'](_0x6bbb('0xa9')))[_0x6bbb('0x89')]();_0x25b645['push'](db[_0x6bbb('0x76')][_0x6bbb('0x3e')](_0x24080a));}return BPromise[_0x6bbb('0x8d')](_0x25b645);}})[_0x6bbb('0x2a')](function(){return _0x535629;})[_0x6bbb('0x2a')](respondWithResult(_0x4e4986,null))[_0x6bbb('0x50')](handleError(_0x4e4986,null));};exports['removeBlackLists']=function(_0xfc1e13,_0x3eb7b0,_0x16ec36){return db[_0x6bbb('0x4c')][_0x6bbb('0x54')]({'where':{'id':_0xfc1e13[_0x6bbb('0x52')]['id']}})['then'](handleEntityNotFound(_0x3eb7b0,null))['then'](function(_0x854755){if(_0x854755){return _0x854755[_0x6bbb('0xb7')](_0xfc1e13['query'][_0x6bbb('0x7f')]);}})[_0x6bbb('0x2a')](function(_0xd7813f){if(_0xd7813f){return db[_0x6bbb('0x6a')][_0x6bbb('0x2b')]({'where':{'ListId':_0xfc1e13['query'][_0x6bbb('0x7f')],'VoiceQueueId':_0xfc1e13[_0x6bbb('0x52')]['id']}})['then'](function(){return _0xd7813f;});}})[_0x6bbb('0x2a')](respondWithStatusCode(_0x3eb7b0,null))[_0x6bbb('0x50')](handleError(_0x3eb7b0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9a06a3d..f925354 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 _0x1eca=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x3f53c8,_0xe7381){var _0x376557=function(_0x3f9433){while(--_0x3f9433){_0x3f53c8['push'](_0x3f53c8['shift']());}};_0x376557(++_0xe7381);}(_0x1eca,0x1d9));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa1ec('0x0'));var VoiceQueue=require(_0xa1ec('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa1ec('0x2')](0x0);var events={'afterCreate':_0xa1ec('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x249024){return function(_0x4c26ed,_0xdc5ea7,_0x530fc0){VoiceQueueEvents[_0xa1ec('0x4')](_0x249024+':'+_0x4c26ed['id'],_0x4c26ed);VoiceQueueEvents[_0xa1ec('0x4')](_0x249024,_0x4c26ed);_0x530fc0(null);};}for(var e in events){if(events[_0xa1ec('0x5')](e)){var event=events[e];VoiceQueue[_0xa1ec('0x6')](e,emitEvent(event));}}module[_0xa1ec('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x0c77=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','emit'];(function(_0x409682,_0x370090){var _0x1ee901=function(_0xe93c56){while(--_0xe93c56){_0x409682['push'](_0x409682['shift']());}};_0x1ee901(++_0x370090);}(_0x0c77,0x15b));var _0x70c7=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x0c77[_0x33032e];return _0x13316b;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x70c7('0x0'))['db'][_0x70c7('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x70c7('0x2')](0x0);var events={'afterCreate':_0x70c7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x24bb67){return function(_0x1815f3,_0x5e76f7,_0x131e58){VoiceQueueEvents[_0x70c7('0x4')](_0x24bb67+':'+_0x1815f3['id'],_0x1815f3);VoiceQueueEvents['emit'](_0x24bb67,_0x1815f3);_0x131e58(null);};}for(var e in events){if(events[_0x70c7('0x5')](e)){var event=events[e];VoiceQueue[_0x70c7('0x6')](e,emitEvent(event));}}module[_0x70c7('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d6a53e3..8465dcb 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 _0x7545=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util'];(function(_0x1a8a79,_0x1fb0b1){var _0x95d0e0=function(_0x22b407){while(--_0x22b407){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x95d0e0(++_0x1fb0b1);}(_0x7545,0x1ab));var _0x5754=function(_0xa9fb37,_0x321f86){_0xa9fb37=_0xa9fb37-0x0;var _0x1d976f=_0x7545[_0xa9fb37];return _0x1d976f;};'use strict';var _=require(_0x5754('0x0'));var util=require(_0x5754('0x1'));var logger=require(_0x5754('0x2'))('api');var moment=require(_0x5754('0x3'));var BPromise=require(_0x5754('0x4'));var rp=require(_0x5754('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5754('0x6'));var config=require(_0x5754('0x7'));var attributes=require(_0x5754('0x8'));module[_0x5754('0x9')]=function(_0x3c4f55,_0x17c9da){return _0x3c4f55[_0x5754('0xa')](_0x5754('0xb'),attributes,{'tableName':_0x5754('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf76=['define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes'];(function(_0x4538e7,_0x22ba72){var _0x57418e=function(_0x291293){while(--_0x291293){_0x4538e7['push'](_0x4538e7['shift']());}};_0x57418e(++_0x22ba72);}(_0xaf76,0x12f));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6af7('0x0'))(_0x6af7('0x1'));var moment=require(_0x6af7('0x2'));var BPromise=require(_0x6af7('0x3'));var rp=require(_0x6af7('0x4'));var fs=require('fs');var path=require(_0x6af7('0x5'));var rimraf=require(_0x6af7('0x6'));var config=require(_0x6af7('0x7'));var attributes=require(_0x6af7('0x8'));module['exports']=function(_0x28087e,_0x10e06a){return _0x28087e[_0x6af7('0x9')](_0x6af7('0xa'),attributes,{'tableName':_0x6af7('0xb'),'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 2c5ad8b..14fc987 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 _0xde62=['../../config/logger','rpc','jayson/promise','client','localhost','redis','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','findAll','options','raw','where','include','map','model','attributes','debug','catch','ShowVoiceQueue','VoiceQueue','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2cf9d6,_0x1befa3){var _0x19edc5=function(_0x21c52a){while(--_0x21c52a){_0x2cf9d6['push'](_0x2cf9d6['shift']());}};_0x19edc5(++_0x1befa3);}(_0xde62,0x12a));var _0x2de6=function(_0x2b2152,_0x460726){_0x2b2152=_0x2b2152-0x0;var _0x37016e=_0xde62[_0x2b2152];return _0x37016e;};'use strict';var _=require('lodash');var util=require(_0x2de6('0x0'));var moment=require(_0x2de6('0x1'));var BPromise=require(_0x2de6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2de6('0x3'));var db=require(_0x2de6('0x4'))['db'];var utils=require(_0x2de6('0x5'));var logger=require(_0x2de6('0x6'))(_0x2de6('0x7'));var config=require('../../config/environment');var jayson=require(_0x2de6('0x8'));var client=jayson[_0x2de6('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2de6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2de6('0xb')]));require(_0x2de6('0xc'))[_0x2de6('0xd')](socket);function respondWithRpcPromise(_0x2b60cc,_0x4a497f,_0x405932){return new BPromise(function(_0x14ab0a,_0x3047cf){return client[_0x2de6('0xe')](_0x2b60cc,_0x405932)[_0x2de6('0xf')](function(_0x775c34){logger['info'](_0x2de6('0x10'),_0x4a497f,_0x2de6('0x11'));logger['debug'](_0x2de6('0x12'),_0x4a497f,_0x2de6('0x11'),JSON[_0x2de6('0x13')](_0x775c34));if(_0x775c34[_0x2de6('0x14')]){if(_0x775c34[_0x2de6('0x14')][_0x2de6('0x15')]===0x1f4){logger['error'](_0x2de6('0x10'),_0x4a497f,_0x775c34[_0x2de6('0x14')][_0x2de6('0x16')]);return _0x3047cf(_0x775c34[_0x2de6('0x14')][_0x2de6('0x16')]);}logger[_0x2de6('0x14')](_0x2de6('0x10'),_0x4a497f,_0x775c34['error'][_0x2de6('0x16')]);return _0x14ab0a(_0x775c34[_0x2de6('0x14')]['message']);}else{logger['info'](_0x2de6('0x10'),_0x4a497f,_0x2de6('0x11'));_0x14ab0a(_0x775c34[_0x2de6('0x17')][_0x2de6('0x16')]);}})['catch'](function(_0x3e3536){logger[_0x2de6('0x14')](_0x2de6('0x10'),_0x4a497f,_0x3e3536);_0x3047cf(_0x3e3536);});});}exports[_0x2de6('0x18')]=function(_0x483d2a){var _0x20b83d=this;return new Promise(function(_0x5c1b67,_0x4b4a18){return db['VoiceQueue'][_0x2de6('0x19')]({'raw':_0x483d2a[_0x2de6('0x1a')]?_0x483d2a[_0x2de6('0x1a')][_0x2de6('0x1b')]===undefined?!![]:![]:!![],'where':_0x483d2a['options']?_0x483d2a[_0x2de6('0x1a')][_0x2de6('0x1c')]||null:null,'attributes':_0x483d2a[_0x2de6('0x1a')]?_0x483d2a[_0x2de6('0x1a')]['attributes']||null:null,'limit':_0x483d2a[_0x2de6('0x1a')]?_0x483d2a[_0x2de6('0x1a')]['limit']||null:null,'include':_0x483d2a['options']?_0x483d2a[_0x2de6('0x1a')][_0x2de6('0x1d')]?_[_0x2de6('0x1e')](_0x483d2a['options'][_0x2de6('0x1d')],function(_0xcf6554){return{'model':db[_0xcf6554[_0x2de6('0x1f')]],'as':_0xcf6554['as'],'attributes':_0xcf6554[_0x2de6('0x20')],'include':_0xcf6554['include']?_['map'](_0xcf6554[_0x2de6('0x1d')],function(_0x34a4ae){return{'model':db[_0x34a4ae[_0x2de6('0x1f')]],'as':_0x34a4ae['as'],'attributes':_0x34a4ae['attributes'],'include':_0x34a4ae[_0x2de6('0x1d')]?_[_0x2de6('0x1e')](_0x34a4ae[_0x2de6('0x1d')],function(_0x3781c9){return{'model':db[_0x3781c9['model']],'as':_0x3781c9['as'],'attributes':_0x3781c9[_0x2de6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2de6('0xf')](function(_0xaf8ff0){logger['info'](_0x2de6('0x18'),_0x483d2a);logger[_0x2de6('0x21')](_0x2de6('0x18'),_0x483d2a,JSON[_0x2de6('0x13')](_0xaf8ff0));_0x5c1b67(_0xaf8ff0);})[_0x2de6('0x22')](function(_0x12dcda){logger[_0x2de6('0x14')](_0x2de6('0x18'),_0x12dcda[_0x2de6('0x16')],_0x483d2a);_0x4b4a18(_0x20b83d['error'](0x1f4,_0x12dcda[_0x2de6('0x16')]));});});};exports[_0x2de6('0x23')]=function(_0x1b802c){var _0x111abd=this;return new Promise(function(_0x24159e,_0xf5560c){return db[_0x2de6('0x24')]['find']({'raw':_0x1b802c[_0x2de6('0x1a')]?_0x1b802c[_0x2de6('0x1a')][_0x2de6('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b802c[_0x2de6('0x1a')]?_0x1b802c[_0x2de6('0x1a')][_0x2de6('0x1c')]||null:null,'attributes':_0x1b802c['options']?_0x1b802c[_0x2de6('0x1a')]['attributes']||null:null,'include':_0x1b802c['options']?_0x1b802c[_0x2de6('0x1a')][_0x2de6('0x1d')]?_[_0x2de6('0x1e')](_0x1b802c[_0x2de6('0x1a')]['include'],function(_0x3ab92b){return{'model':db[_0x3ab92b[_0x2de6('0x1f')]],'as':_0x3ab92b['as'],'attributes':_0x3ab92b[_0x2de6('0x20')],'include':_0x3ab92b[_0x2de6('0x1d')]?_[_0x2de6('0x1e')](_0x3ab92b[_0x2de6('0x1d')],function(_0x39fbe0){return{'model':db[_0x39fbe0[_0x2de6('0x1f')]],'as':_0x39fbe0['as'],'attributes':_0x39fbe0[_0x2de6('0x20')],'include':_0x39fbe0[_0x2de6('0x1d')]?_[_0x2de6('0x1e')](_0x39fbe0['include'],function(_0x43eaad){return{'model':db[_0x43eaad[_0x2de6('0x1f')]],'as':_0x43eaad['as'],'attributes':_0x43eaad[_0x2de6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2de6('0xf')](function(_0x42a3f5){logger[_0x2de6('0x25')](_0x2de6('0x23'),_0x1b802c);logger[_0x2de6('0x21')](_0x2de6('0x23'),_0x1b802c,JSON[_0x2de6('0x13')](_0x42a3f5));_0x24159e(_0x42a3f5);})[_0x2de6('0x22')](function(_0x394e17){logger[_0x2de6('0x14')]('ShowVoiceQueue',_0x394e17[_0x2de6('0x16')],_0x1b802c);_0xf5560c(_0x111abd[_0x2de6('0x14')](0x1f4,_0x394e17['message']));});});}; \ No newline at end of file +var _0x669c=['map','model','GetVoiceQueue','catch','ShowVoiceQueue','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','VoiceQueue','findAll','raw','where','options','include','attributes'];(function(_0x1a638a,_0x59b50a){var _0x3e3503=function(_0x375578){while(--_0x375578){_0x1a638a['push'](_0x1a638a['shift']());}};_0x3e3503(++_0x59b50a);}(_0x669c,0x153));var _0xc669=function(_0x52539b,_0x45cfe3){_0x52539b=_0x52539b-0x0;var _0x38d1ac=_0x669c[_0x52539b];return _0x38d1ac;};'use strict';var _=require('lodash');var util=require(_0xc669('0x0'));var moment=require(_0xc669('0x1'));var BPromise=require(_0xc669('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc669('0x3'));var db=require(_0xc669('0x4'))['db'];var utils=require(_0xc669('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc669('0x6'));var jayson=require(_0xc669('0x7'));var client=jayson['client'][_0xc669('0x8')]({'port':0x232a});config[_0xc669('0x9')]=_[_0xc669('0xa')](config[_0xc669('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc669('0xb'))(new Redis(config[_0xc669('0x9')]));require('./voiceQueue.socket')[_0xc669('0xc')](socket);function respondWithRpcPromise(_0x4e6d00,_0xef8361,_0x5cc448){return new BPromise(function(_0x5bd78e,_0x3f4090){return client[_0xc669('0xd')](_0x4e6d00,_0x5cc448)[_0xc669('0xe')](function(_0x538963){logger[_0xc669('0xf')](_0xc669('0x10'),_0xef8361,'request\x20sent');logger[_0xc669('0x11')](_0xc669('0x12'),_0xef8361,'request\x20sent',JSON['stringify'](_0x538963));if(_0x538963[_0xc669('0x13')]){if(_0x538963[_0xc669('0x13')][_0xc669('0x14')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0xef8361,_0x538963[_0xc669('0x13')]['message']);return _0x3f4090(_0x538963[_0xc669('0x13')][_0xc669('0x15')]);}logger[_0xc669('0x13')](_0xc669('0x10'),_0xef8361,_0x538963[_0xc669('0x13')][_0xc669('0x15')]);return _0x5bd78e(_0x538963[_0xc669('0x13')][_0xc669('0x15')]);}else{logger[_0xc669('0xf')](_0xc669('0x10'),_0xef8361,_0xc669('0x16'));_0x5bd78e(_0x538963[_0xc669('0x17')][_0xc669('0x15')]);}})['catch'](function(_0x43fdee){logger['error'](_0xc669('0x10'),_0xef8361,_0x43fdee);_0x3f4090(_0x43fdee);});});}exports['GetVoiceQueue']=function(_0x1224f8){var _0x915b95=this;return new Promise(function(_0x1a0ddf,_0x99aa02){return db[_0xc669('0x18')][_0xc669('0x19')]({'raw':_0x1224f8['options']?_0x1224f8['options'][_0xc669('0x1a')]===undefined?!![]:![]:!![],'where':_0x1224f8['options']?_0x1224f8['options'][_0xc669('0x1b')]||null:null,'attributes':_0x1224f8[_0xc669('0x1c')]?_0x1224f8[_0xc669('0x1c')]['attributes']||null:null,'limit':_0x1224f8[_0xc669('0x1c')]?_0x1224f8[_0xc669('0x1c')]['limit']||null:null,'include':_0x1224f8[_0xc669('0x1c')]?_0x1224f8[_0xc669('0x1c')][_0xc669('0x1d')]?_['map'](_0x1224f8['options']['include'],function(_0x4bd931){return{'model':db[_0x4bd931['model']],'as':_0x4bd931['as'],'attributes':_0x4bd931[_0xc669('0x1e')],'include':_0x4bd931[_0xc669('0x1d')]?_[_0xc669('0x1f')](_0x4bd931[_0xc669('0x1d')],function(_0x12f5bc){return{'model':db[_0x12f5bc[_0xc669('0x20')]],'as':_0x12f5bc['as'],'attributes':_0x12f5bc[_0xc669('0x1e')],'include':_0x12f5bc[_0xc669('0x1d')]?_[_0xc669('0x1f')](_0x12f5bc[_0xc669('0x1d')],function(_0x509c55){return{'model':db[_0x509c55[_0xc669('0x20')]],'as':_0x509c55['as'],'attributes':_0x509c55[_0xc669('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc669('0xe')](function(_0x1ede2a){logger[_0xc669('0xf')](_0xc669('0x21'),_0x1224f8);logger['debug'](_0xc669('0x21'),_0x1224f8,JSON['stringify'](_0x1ede2a));_0x1a0ddf(_0x1ede2a);})[_0xc669('0x22')](function(_0x23f158){logger[_0xc669('0x13')]('GetVoiceQueue',_0x23f158[_0xc669('0x15')],_0x1224f8);_0x99aa02(_0x915b95[_0xc669('0x13')](0x1f4,_0x23f158[_0xc669('0x15')]));});});};exports[_0xc669('0x23')]=function(_0x1e6a56){var _0x5b02c7=this;return new Promise(function(_0x26ec42,_0x2a0132){return db['VoiceQueue']['find']({'raw':_0x1e6a56['options']?_0x1e6a56[_0xc669('0x1c')][_0xc669('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e6a56['options']?_0x1e6a56['options'][_0xc669('0x1b')]||null:null,'attributes':_0x1e6a56['options']?_0x1e6a56[_0xc669('0x1c')]['attributes']||null:null,'include':_0x1e6a56[_0xc669('0x1c')]?_0x1e6a56[_0xc669('0x1c')][_0xc669('0x1d')]?_[_0xc669('0x1f')](_0x1e6a56[_0xc669('0x1c')][_0xc669('0x1d')],function(_0x13a0dc){return{'model':db[_0x13a0dc[_0xc669('0x20')]],'as':_0x13a0dc['as'],'attributes':_0x13a0dc[_0xc669('0x1e')],'include':_0x13a0dc['include']?_[_0xc669('0x1f')](_0x13a0dc['include'],function(_0x8e5612){return{'model':db[_0x8e5612['model']],'as':_0x8e5612['as'],'attributes':_0x8e5612[_0xc669('0x1e')],'include':_0x8e5612['include']?_[_0xc669('0x1f')](_0x8e5612[_0xc669('0x1d')],function(_0x4da536){return{'model':db[_0x4da536['model']],'as':_0x4da536['as'],'attributes':_0x4da536[_0xc669('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x414d8f){logger[_0xc669('0xf')](_0xc669('0x23'),_0x1e6a56);logger[_0xc669('0x11')](_0xc669('0x23'),_0x1e6a56,JSON[_0xc669('0x24')](_0x414d8f));_0x26ec42(_0x414d8f);})['catch'](function(_0x420071){logger['error'](_0xc669('0x23'),_0x420071[_0xc669('0x15')],_0x1e6a56);_0x2a0132(_0x5b02c7['error'](0x1f4,_0x420071[_0xc669('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 48e4445..eb231dc 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 _0xe4cf=['save','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x5b45fb,_0x4a8523){var _0x43c96e=function(_0x3a63ae){while(--_0x3a63ae){_0x5b45fb['push'](_0x5b45fb['shift']());}};_0x43c96e(++_0x4a8523);}(_0xe4cf,0x18f));var _0xfe4c=function(_0xc6ea98,_0x1f0fe7){_0xc6ea98=_0xc6ea98-0x0;var _0x154999=_0xe4cf[_0xc6ea98];return _0x154999;};'use strict';var VoiceQueueEvents=require(_0xfe4c('0x0'));var events=[_0xfe4c('0x1'),'remove',_0xfe4c('0x2')];function createListener(_0x4bd020,_0x2ec5b3){return function(_0x143bd6){_0x2ec5b3[_0xfe4c('0x3')](_0x4bd020,_0x143bd6);};}function removeListener(_0x2fd7f9,_0x5ad604){return function(){VoiceQueueEvents[_0xfe4c('0x4')](_0x2fd7f9,_0x5ad604);};}exports[_0xfe4c('0x5')]=function(_0x1f533d){for(var _0x3d5d80=0x0,_0x40b315=events[_0xfe4c('0x6')];_0x3d5d80<_0x40b315;_0x3d5d80++){var _0x31f0c5=events[_0x3d5d80];var _0x2994cd=createListener(_0xfe4c('0x7')+_0x31f0c5,_0x1f533d);VoiceQueueEvents['on'](_0x31f0c5,_0x2994cd);}}; \ No newline at end of file +var _0xb4fe=['save','remove','update','emit','removeListener','voiceQueue:','./voiceQueue.events'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0xb4fe,0x117));var _0xeb4f=function(_0x31dc2f,_0x7114f){_0x31dc2f=_0x31dc2f-0x0;var _0x3bea17=_0xb4fe[_0x31dc2f];return _0x3bea17;};'use strict';var VoiceQueueEvents=require(_0xeb4f('0x0'));var events=[_0xeb4f('0x1'),_0xeb4f('0x2'),_0xeb4f('0x3')];function createListener(_0x4e8420,_0x1e07da){return function(_0x12912d){_0x1e07da[_0xeb4f('0x4')](_0x4e8420,_0x12912d);};}function removeListener(_0xbd5141,_0x5e98b6){return function(){VoiceQueueEvents[_0xeb4f('0x5')](_0xbd5141,_0x5e98b6);};}exports['register']=function(_0x3360b8){for(var _0x237684=0x0,_0x13bda2=events['length'];_0x237684<_0x13bda2;_0x237684++){var _0xa790ee=events[_0x237684];var _0x12b808=createListener(_0xeb4f('0x6')+_0xa790ee,_0x3360b8);VoiceQueueEvents['on'](_0xa790ee,_0x12b808);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 2282ec7..64569ca 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 _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/index','/:id','post','update','destroy','exports','multer'];(function(_0x33b85e,_0x9ab507){var _0x4d222e=function(_0x212925){while(--_0x212925){_0x33b85e['push'](_0x33b85e['shift']());}};_0x4d222e(++_0x9ab507);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4d8d7f,_0x3db2ed){_0x4d8d7f=_0x4d8d7f-0x0;var _0x95a716=_0xd8fb[_0x4d8d7f];return _0x95a716;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));var controller=require('./voiceQueueReport.controller');router[_0xbd8f('0x6')]('/',auth[_0xbd8f('0x7')](),controller['index']);router[_0xbd8f('0x6')]('/describe',auth[_0xbd8f('0x7')](),controller['describe']);router[_0xbd8f('0x6')](_0xbd8f('0x8'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xbd8f('0x6')](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller['show']);router[_0xbd8f('0xa')]('/',auth[_0xbd8f('0x7')](),controller['create']);router['put'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xb')]);router['delete'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xc')]);module[_0xbd8f('0xd')]=router; \ No newline at end of file +var _0xb4b6=['../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x130755,_0x3d2a73){var _0x77dcc6=function(_0x40556b){while(--_0x40556b){_0x130755['push'](_0x130755['shift']());}};_0x77dcc6(++_0x3d2a73);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x1f15de,_0x559e5d){_0x1f15de=_0x1f15de-0x0;var _0x4c8c72=_0xb4b6[_0x1f15de];return _0x4c8c72;};'use strict';var multer=require('multer');var util=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var timeout=require(_0x6b4b('0x2'));var express=require(_0x6b4b('0x3'));var router=express[_0x6b4b('0x4')]();var auth=require(_0x6b4b('0x5'));var interaction=require(_0x6b4b('0x6'));var config=require(_0x6b4b('0x7'));var controller=require(_0x6b4b('0x8'));router['get']('/',auth[_0x6b4b('0x9')](),controller['index']);router[_0x6b4b('0xa')](_0x6b4b('0xb'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xc')]);router[_0x6b4b('0xa')]('/index',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xd')]);router[_0x6b4b('0xa')](_0x6b4b('0xe'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xf')]);router[_0x6b4b('0x10')]('/',auth[_0x6b4b('0x9')](),controller['create']);router[_0x6b4b('0x11')]('/:id',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x12')]);router[_0x6b4b('0x13')](_0x6b4b('0xe'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x14')]);module[_0x6b4b('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 7704a04..185fabe 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 _0x6e5e=['setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x1758e7,_0x514db1){var _0x5f46c0=function(_0x4b15a7){while(--_0x4b15a7){_0x1758e7['push'](_0x1758e7['shift']());}};_0x5f46c0(++_0x514db1);}(_0x6e5e,0x1aa));var _0xe6e5=function(_0x5e095d,_0x5bfd31){_0x5e095d=_0x5e095d-0x0;var _0x148346=_0x6e5e[_0x5e095d];return _0x148346;};'use strict';var Sequelize=require(_0xe6e5('0x0'));var moment=require(_0xe6e5('0x1'));module['exports']={'type':{'type':Sequelize[_0xe6e5('0x2')]},'uniqueid':{'type':Sequelize[_0xe6e5('0x2')]},'calleridnum':{'type':Sequelize[_0xe6e5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe6e5('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xe6e5('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xe6e5('0x3')],'set':function(_0x1572b3){var _0x1619ed=moment(_0x1572b3);var _0x49fd53=moment(this[_0xe6e5('0x4')]('queuecallerjoinAt'))[_0xe6e5('0x5')](_0xe6e5('0x6'));var _0x1c2b64=_0x1619ed[_0xe6e5('0x7')](_0x49fd53,_0xe6e5('0x8'));this[_0xe6e5('0x9')](_0xe6e5('0xa'),_0x1572b3);this[_0xe6e5('0x9')]('holdtime',_0x1c2b64||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xe6e5('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xe6e5('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe6e5('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xe6e5('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe6e5('0x3')]},'queuecallerexit':{'type':Sequelize[_0xe6e5('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe6e5('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xe6e5('0x2')],'comment':_0xe6e5('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xe6e5('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe6e5('0x2')]},'accountcode':{'type':Sequelize[_0xe6e5('0x2')]},'context':{'type':Sequelize[_0xe6e5('0x2')]},'exten':{'type':Sequelize[_0xe6e5('0x2')]},'priority':{'type':Sequelize[_0xe6e5('0x2')]},'holdtime':{'type':Sequelize[_0xe6e5('0xb')]},'mohtime':{'type':Sequelize[_0xe6e5('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe6e5('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe6e5('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe6e5('0x2')],'comment':_0xe6e5('0xe')},'transferexten':{'type':Sequelize[_0xe6e5('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe6e5('0x2')]},'disposition':{'type':Sequelize[_0xe6e5('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x70c8=['setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x500bd4,_0x346082){var _0x1c5f9c=function(_0x14d75b){while(--_0x14d75b){_0x500bd4['push'](_0x500bd4['shift']());}};_0x1c5f9c(++_0x346082);}(_0x70c8,0x7d));var _0x870c=function(_0x2b31a5,_0x11da1c){_0x2b31a5=_0x2b31a5-0x0;var _0x8d6eb4=_0x70c8[_0x2b31a5];return _0x8d6eb4;};'use strict';var Sequelize=require(_0x870c('0x0'));var moment=require(_0x870c('0x1'));module[_0x870c('0x2')]={'type':{'type':Sequelize[_0x870c('0x3')]},'uniqueid':{'type':Sequelize[_0x870c('0x3')]},'calleridnum':{'type':Sequelize[_0x870c('0x3')]},'calleridname':{'type':Sequelize[_0x870c('0x3')]},'queue':{'type':Sequelize[_0x870c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x870c('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1b300b){var _0x41093c=moment(_0x1b300b);var _0x5b94a5=moment(this[_0x870c('0x5')](_0x870c('0x6')))['format'](_0x870c('0x7'));var _0xb1ce35=_0x41093c[_0x870c('0x8')](_0x5b94a5,_0x870c('0x9'));this[_0x870c('0xa')]('queuecallerleaveAt',_0x1b300b);this['setDataValue']('holdtime',_0xb1ce35||null);}},'position':{'type':Sequelize[_0x870c('0xb')]},'count':{'type':Sequelize[_0x870c('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x870c('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x870c('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x870c('0x4')]},'queuecallerexit':{'type':Sequelize[_0x870c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x870c('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x870c('0x3')],'comment':_0x870c('0xd')},'originalposition':{'type':Sequelize[_0x870c('0xb')]},'channel':{'type':Sequelize[_0x870c('0x3')]},'connectedlinenum':{'type':Sequelize[_0x870c('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x870c('0x3')]},'exten':{'type':Sequelize[_0x870c('0x3')]},'priority':{'type':Sequelize[_0x870c('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x870c('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x870c('0x3')]},'transfer':{'type':Sequelize[_0x870c('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x870c('0x3')],'comment':_0x870c('0xe')},'transferexten':{'type':Sequelize[_0x870c('0x3')]},'transferuniqueid':{'type':Sequelize[_0x870c('0x3')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x870c('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b7b58e5..dbc9a79 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 _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x7a54,0x106));var _0x47a5=function(_0x55aee2,_0x48905b){_0x55aee2=_0x55aee2-0x0;var _0x3e2bde=_0x7a54[_0x55aee2];return _0x3e2bde;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 1ee9faf..c516c76 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 _0x0446=['VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','events'];(function(_0x48d9bc,_0x5e4c03){var _0x3dab49=function(_0xa1db5e){while(--_0xa1db5e){_0x48d9bc['push'](_0x48d9bc['shift']());}};_0x3dab49(++_0x5e4c03);}(_0x0446,0xb5));var _0x6044=function(_0x21d2d5,_0x410ce1){_0x21d2d5=_0x21d2d5-0x0;var _0x1b1c7f=_0x0446[_0x21d2d5];return _0x1b1c7f;};'use strict';var EventEmitter=require(_0x6044('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x6044('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6044('0x2')](0x0);var events={'afterCreate':_0x6044('0x3'),'afterUpdate':'update','afterDestroy':_0x6044('0x4')};function emitEvent(_0x22b18f){return function(_0x204954,_0x13d917,_0x461b35){VoiceQueueReportEvents['emit'](_0x22b18f+':'+_0x204954['id'],_0x204954);VoiceQueueReportEvents[_0x6044('0x5')](_0x22b18f,_0x204954);_0x461b35(null);};}for(var e in events){if(events[_0x6044('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xb726=['hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','emit'];(function(_0x28c768,_0x2032aa){var _0x31ab36=function(_0x134170){while(--_0x134170){_0x28c768['push'](_0x28c768['shift']());}};_0x31ab36(++_0x2032aa);}(_0xb726,0x182));var _0x6b72=function(_0x5526c4,_0x4e77eb){_0x5526c4=_0x5526c4-0x0;var _0x165ff8=_0xb726[_0x5526c4];return _0x165ff8;};'use strict';var EventEmitter=require(_0x6b72('0x0'));var VoiceQueueReport=require(_0x6b72('0x1'))['db'][_0x6b72('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6b72('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b72('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29991e){return function(_0x5e36dc,_0x112239,_0x47b4eb){VoiceQueueReportEvents[_0x6b72('0x5')](_0x29991e+':'+_0x5e36dc['id'],_0x5e36dc);VoiceQueueReportEvents[_0x6b72('0x5')](_0x29991e,_0x5e36dc);_0x47b4eb(null);};}for(var e in events){if(events[_0x6b72('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c5f1b08..94a2d6a 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x182fff,_0x568aee){var _0x1b4171=function(_0x212d46){while(--_0x212d46){_0x182fff['push'](_0x182fff['shift']());}};_0x1b4171(++_0x568aee);}(_0xdb28,0x106));var _0x8db2=function(_0x268d10,_0x33340d){_0x268d10=_0x268d10-0x0;var _0x18c1f4=_0xdb28[_0x268d10];return _0x18c1f4;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x3158eb,_0x73fe18){var _0x488dca=function(_0x5d727b){while(--_0x5d727b){_0x3158eb['push'](_0x3158eb['shift']());}};_0x488dca(++_0x73fe18);}(_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':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d87288a..3eaf369 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 _0x5588=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','VoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1f691d,_0x5f4164){var _0x5b7c71=function(_0x53ef07){while(--_0x53ef07){_0x1f691d['push'](_0x1f691d['shift']());}};_0x5b7c71(++_0x5f4164);}(_0x5588,0xa4));var _0x8558=function(_0x4c740d,_0xb8de0f){_0x4c740d=_0x4c740d-0x0;var _0x59ba3a=_0x5588[_0x4c740d];return _0x59ba3a;};'use strict';var _=require(_0x8558('0x0'));var util=require(_0x8558('0x1'));var moment=require(_0x8558('0x2'));var BPromise=require(_0x8558('0x3'));var rs=require(_0x8558('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8558('0x5'));var logger=require(_0x8558('0x6'))('rpc');var config=require(_0x8558('0x7'));var jayson=require(_0x8558('0x8'));var client=jayson[_0x8558('0x9')]['http']({'port':0x232a});config[_0x8558('0xa')]=_[_0x8558('0xb')](config[_0x8558('0xa')],{'host':_0x8558('0xc'),'port':0x18eb});var socket=require(_0x8558('0xd'))(new Redis(config[_0x8558('0xa')]));require(_0x8558('0xe'))[_0x8558('0xf')](socket);function respondWithRpcPromise(_0x24580a,_0x252a45,_0x5e62b8){return new BPromise(function(_0x5e2341,_0x5d1d94){return client[_0x8558('0x10')](_0x24580a,_0x5e62b8)[_0x8558('0x11')](function(_0xad4be6){logger[_0x8558('0x12')](_0x8558('0x13'),_0x252a45,_0x8558('0x14'));logger[_0x8558('0x15')](_0x8558('0x16'),_0x252a45,_0x8558('0x14'),JSON[_0x8558('0x17')](_0xad4be6));if(_0xad4be6['error']){if(_0xad4be6['error']['code']===0x1f4){logger[_0x8558('0x18')](_0x8558('0x13'),_0x252a45,_0xad4be6[_0x8558('0x18')]['message']);return _0x5d1d94(_0xad4be6[_0x8558('0x18')][_0x8558('0x19')]);}logger[_0x8558('0x18')](_0x8558('0x13'),_0x252a45,_0xad4be6[_0x8558('0x18')][_0x8558('0x19')]);return _0x5e2341(_0xad4be6['error'][_0x8558('0x19')]);}else{logger[_0x8558('0x12')](_0x8558('0x13'),_0x252a45,'request\x20sent');_0x5e2341(_0xad4be6[_0x8558('0x1a')][_0x8558('0x19')]);}})[_0x8558('0x1b')](function(_0x5343a8){logger[_0x8558('0x18')](_0x8558('0x13'),_0x252a45,_0x5343a8);_0x5d1d94(_0x5343a8);});});}exports['GetVoiceQueueReport']=function(_0x379ee8){var _0x4f27b7=this;return new Promise(function(_0x3d68e2,_0x183114){return db['VoiceQueueReport'][_0x8558('0x1c')]({'raw':_0x379ee8[_0x8558('0x1d')]?_0x379ee8[_0x8558('0x1d')][_0x8558('0x1e')]===undefined?!![]:![]:!![],'where':_0x379ee8['options']?_0x379ee8[_0x8558('0x1d')][_0x8558('0x1f')]||null:null,'attributes':_0x379ee8[_0x8558('0x1d')]?_0x379ee8[_0x8558('0x1d')]['attributes']||null:null,'limit':_0x379ee8['options']?_0x379ee8[_0x8558('0x1d')][_0x8558('0x20')]||null:null,'include':_0x379ee8[_0x8558('0x1d')]?_0x379ee8['options'][_0x8558('0x21')]?_[_0x8558('0x22')](_0x379ee8[_0x8558('0x1d')][_0x8558('0x21')],function(_0x2d77d2){return{'model':db[_0x2d77d2['model']],'as':_0x2d77d2['as'],'attributes':_0x2d77d2[_0x8558('0x23')],'include':_0x2d77d2[_0x8558('0x21')]?_[_0x8558('0x22')](_0x2d77d2[_0x8558('0x21')],function(_0x226659){return{'model':db[_0x226659[_0x8558('0x24')]],'as':_0x226659['as'],'attributes':_0x226659[_0x8558('0x23')],'include':_0x226659[_0x8558('0x21')]?_[_0x8558('0x22')](_0x226659[_0x8558('0x21')],function(_0xc3cc42){return{'model':db[_0xc3cc42[_0x8558('0x24')]],'as':_0xc3cc42['as'],'attributes':_0xc3cc42['attributes']};}):[]};}):[]};}):[]:[]})[_0x8558('0x11')](function(_0x4001b4){logger[_0x8558('0x12')]('GetVoiceQueueReport',_0x379ee8);logger['debug'](_0x8558('0x25'),_0x379ee8,JSON[_0x8558('0x17')](_0x4001b4));_0x3d68e2(_0x4001b4);})[_0x8558('0x1b')](function(_0x350749){logger[_0x8558('0x18')](_0x8558('0x25'),_0x350749['message'],_0x379ee8);_0x183114(_0x4f27b7[_0x8558('0x18')](0x1f4,_0x350749['message']));});});};exports[_0x8558('0x26')]=function(_0x48e45e){var _0x316806=this;return new Promise(function(_0x2530a5,_0x42aa2b){return db['VoiceQueueReport']['create'](_0x48e45e[_0x8558('0x27')],{'raw':_0x48e45e['options']?_0x48e45e[_0x8558('0x1d')][_0x8558('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x5c3fd7){logger['info'](_0x8558('0x26'),_0x48e45e);logger[_0x8558('0x15')](_0x8558('0x26'),_0x48e45e,JSON[_0x8558('0x17')](_0x5c3fd7));_0x2530a5(_0x5c3fd7);})['catch'](function(_0x1cb367){logger[_0x8558('0x18')]('CreateVoiceQueueReport',_0x1cb367[_0x8558('0x19')],_0x48e45e);_0x42aa2b(_0x316806[_0x8558('0x18')](0x1f4,_0x1cb367[_0x8558('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3c0907){var _0x1c832b=this;return new Promise(function(_0x3943a4,_0x37b574){return db[_0x8558('0x28')][_0x8558('0x29')](_0x3c0907['body'],{'raw':_0x3c0907[_0x8558('0x1d')]?_0x3c0907[_0x8558('0x1d')][_0x8558('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c0907[_0x8558('0x1d')]?_0x3c0907[_0x8558('0x1d')][_0x8558('0x1f')]||null:null,'attributes':_0x3c0907[_0x8558('0x1d')]?_0x3c0907['options'][_0x8558('0x23')]||null:null,'limit':_0x3c0907[_0x8558('0x1d')]?_0x3c0907[_0x8558('0x1d')][_0x8558('0x20')]||null:null})[_0x8558('0x11')](function(_0x3c3edc){logger[_0x8558('0x12')]('UpdateVoiceQueueReport',_0x3c0907);logger[_0x8558('0x15')](_0x8558('0x2a'),_0x3c0907,JSON[_0x8558('0x17')](_0x3c3edc));_0x3943a4(_0x3c3edc);})['catch'](function(_0x3753cf){logger[_0x8558('0x18')](_0x8558('0x2a'),_0x3753cf[_0x8558('0x19')],_0x3c0907);_0x37b574(_0x1c832b[_0x8558('0x18')](0x1f4,_0x3753cf['message']));});});}; \ No newline at end of file +var _0xa2b6=['client','http','redis','defaults','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceQueueReport','findAll','options','raw','where','include','map','model','attributes','VoiceQueueReport','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x5c8f68,_0x1c5b61){var _0x5aeeba=function(_0xcefdee){while(--_0xcefdee){_0x5c8f68['push'](_0x5c8f68['shift']());}};_0x5aeeba(++_0x1c5b61);}(_0xa2b6,0x13f));var _0x6a2b=function(_0x51d4c6,_0x48e45a){_0x51d4c6=_0x51d4c6-0x0;var _0x21bcec=_0xa2b6[_0x51d4c6];return _0x21bcec;};'use strict';var _=require(_0x6a2b('0x0'));var util=require(_0x6a2b('0x1'));var moment=require(_0x6a2b('0x2'));var BPromise=require(_0x6a2b('0x3'));var rs=require(_0x6a2b('0x4'));var fs=require('fs');var Redis=require(_0x6a2b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a2b('0x6'))(_0x6a2b('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a2b('0x8'));var client=jayson[_0x6a2b('0x9')][_0x6a2b('0xa')]({'port':0x232a});config[_0x6a2b('0xb')]=_[_0x6a2b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6a2b('0xd'))(new Redis(config[_0x6a2b('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x3d9a27,_0x37453b,_0x11dbce){return new BPromise(function(_0x5934d3,_0x110e1e){return client[_0x6a2b('0xe')](_0x3d9a27,_0x11dbce)['then'](function(_0x16ddb5){logger[_0x6a2b('0xf')](_0x6a2b('0x10'),_0x37453b,_0x6a2b('0x11'));logger[_0x6a2b('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x37453b,_0x6a2b('0x11'),JSON['stringify'](_0x16ddb5));if(_0x16ddb5[_0x6a2b('0x13')]){if(_0x16ddb5[_0x6a2b('0x13')][_0x6a2b('0x14')]===0x1f4){logger[_0x6a2b('0x13')](_0x6a2b('0x10'),_0x37453b,_0x16ddb5[_0x6a2b('0x13')][_0x6a2b('0x15')]);return _0x110e1e(_0x16ddb5[_0x6a2b('0x13')][_0x6a2b('0x15')]);}logger[_0x6a2b('0x13')](_0x6a2b('0x10'),_0x37453b,_0x16ddb5[_0x6a2b('0x13')][_0x6a2b('0x15')]);return _0x5934d3(_0x16ddb5[_0x6a2b('0x13')][_0x6a2b('0x15')]);}else{logger[_0x6a2b('0xf')](_0x6a2b('0x10'),_0x37453b,_0x6a2b('0x11'));_0x5934d3(_0x16ddb5['result'][_0x6a2b('0x15')]);}})[_0x6a2b('0x16')](function(_0x3b34f8){logger[_0x6a2b('0x13')](_0x6a2b('0x10'),_0x37453b,_0x3b34f8);_0x110e1e(_0x3b34f8);});});}exports[_0x6a2b('0x17')]=function(_0x2fe72c){var _0x5d9f6c=this;return new Promise(function(_0x5097be,_0x33e702){return db['VoiceQueueReport'][_0x6a2b('0x18')]({'raw':_0x2fe72c[_0x6a2b('0x19')]?_0x2fe72c['options'][_0x6a2b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fe72c[_0x6a2b('0x19')]?_0x2fe72c['options'][_0x6a2b('0x1b')]||null:null,'attributes':_0x2fe72c['options']?_0x2fe72c['options']['attributes']||null:null,'limit':_0x2fe72c[_0x6a2b('0x19')]?_0x2fe72c['options']['limit']||null:null,'include':_0x2fe72c[_0x6a2b('0x19')]?_0x2fe72c[_0x6a2b('0x19')][_0x6a2b('0x1c')]?_[_0x6a2b('0x1d')](_0x2fe72c[_0x6a2b('0x19')][_0x6a2b('0x1c')],function(_0x661c88){return{'model':db[_0x661c88[_0x6a2b('0x1e')]],'as':_0x661c88['as'],'attributes':_0x661c88['attributes'],'include':_0x661c88['include']?_['map'](_0x661c88[_0x6a2b('0x1c')],function(_0x1d8f9e){return{'model':db[_0x1d8f9e['model']],'as':_0x1d8f9e['as'],'attributes':_0x1d8f9e[_0x6a2b('0x1f')],'include':_0x1d8f9e[_0x6a2b('0x1c')]?_[_0x6a2b('0x1d')](_0x1d8f9e[_0x6a2b('0x1c')],function(_0x5f076b){return{'model':db[_0x5f076b[_0x6a2b('0x1e')]],'as':_0x5f076b['as'],'attributes':_0x5f076b[_0x6a2b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36fa13){logger[_0x6a2b('0xf')]('GetVoiceQueueReport',_0x2fe72c);logger[_0x6a2b('0x12')](_0x6a2b('0x17'),_0x2fe72c,JSON['stringify'](_0x36fa13));_0x5097be(_0x36fa13);})[_0x6a2b('0x16')](function(_0x5a1963){logger[_0x6a2b('0x13')]('GetVoiceQueueReport',_0x5a1963[_0x6a2b('0x15')],_0x2fe72c);_0x33e702(_0x5d9f6c['error'](0x1f4,_0x5a1963['message']));});});};exports['CreateVoiceQueueReport']=function(_0x2db590){var _0x333e33=this;return new Promise(function(_0x447ece,_0x5428ad){return db[_0x6a2b('0x20')][_0x6a2b('0x21')](_0x2db590[_0x6a2b('0x22')],{'raw':_0x2db590['options']?_0x2db590[_0x6a2b('0x19')][_0x6a2b('0x1a')]===undefined?!![]:![]:!![]})[_0x6a2b('0x23')](function(_0x252ed0){logger[_0x6a2b('0xf')](_0x6a2b('0x24'),_0x2db590);logger[_0x6a2b('0x12')](_0x6a2b('0x24'),_0x2db590,JSON['stringify'](_0x252ed0));_0x447ece(_0x252ed0);})[_0x6a2b('0x16')](function(_0x587f3c){logger[_0x6a2b('0x13')]('CreateVoiceQueueReport',_0x587f3c['message'],_0x2db590);_0x5428ad(_0x333e33['error'](0x1f4,_0x587f3c[_0x6a2b('0x15')]));});});};exports[_0x6a2b('0x25')]=function(_0xf36ad9){var _0x3f1eb8=this;return new Promise(function(_0x320320,_0x143a90){return db[_0x6a2b('0x20')][_0x6a2b('0x26')](_0xf36ad9[_0x6a2b('0x22')],{'raw':_0xf36ad9[_0x6a2b('0x19')]?_0xf36ad9[_0x6a2b('0x19')][_0x6a2b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf36ad9['options']?_0xf36ad9['options'][_0x6a2b('0x1b')]||null:null,'attributes':_0xf36ad9[_0x6a2b('0x19')]?_0xf36ad9[_0x6a2b('0x19')]['attributes']||null:null,'limit':_0xf36ad9['options']?_0xf36ad9[_0x6a2b('0x19')][_0x6a2b('0x27')]||null:null})['then'](function(_0x5c89ca){logger[_0x6a2b('0xf')](_0x6a2b('0x25'),_0xf36ad9);logger[_0x6a2b('0x12')](_0x6a2b('0x25'),_0xf36ad9,JSON[_0x6a2b('0x28')](_0x5c89ca));_0x320320(_0x5c89ca);})[_0x6a2b('0x16')](function(_0x2f7018){logger[_0x6a2b('0x13')]('UpdateVoiceQueueReport',_0x2f7018[_0x6a2b('0x15')],_0xf36ad9);_0x143a90(_0x3f1eb8[_0x6a2b('0x13')](0x1f4,_0x2f7018['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 60a1448..4537bd8 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 _0xa5a7=['voiceQueueReport:','./voiceQueueReport.events','update','emit'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xa5a7,0x145));var _0x7a5a=function(_0x115552,_0x107858){_0x115552=_0x115552-0x0;var _0x1b272b=_0xa5a7[_0x115552];return _0x1b272b;};'use strict';var VoiceQueueReportEvents=require(_0x7a5a('0x0'));var events=['save','remove',_0x7a5a('0x1')];function createListener(_0x4a6ca1,_0x9646ad){return function(_0x4606d5){_0x9646ad[_0x7a5a('0x2')](_0x4a6ca1,_0x4606d5);};}function removeListener(_0x3e1a0d,_0x531207){return function(){VoiceQueueReportEvents['removeListener'](_0x3e1a0d,_0x531207);};}exports['register']=function(_0x55f189){for(var _0x42219e=0x0,_0x34f088=events['length'];_0x42219e<_0x34f088;_0x42219e++){var _0x10177f=events[_0x42219e];var _0x3a865b=createListener(_0x7a5a('0x3')+_0x10177f,_0x55f189);VoiceQueueReportEvents['on'](_0x10177f,_0x3a865b);}}; \ No newline at end of file +var _0x92e3=['remove','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x41d0e2,_0x3314b5){var _0x527b9=function(_0xc8be9f){while(--_0xc8be9f){_0x41d0e2['push'](_0x41d0e2['shift']());}};_0x527b9(++_0x3314b5);}(_0x92e3,0x1be));var _0x392e=function(_0x5dbef3,_0x14e596){_0x5dbef3=_0x5dbef3-0x0;var _0x5158cb=_0x92e3[_0x5dbef3];return _0x5158cb;};'use strict';var VoiceQueueReportEvents=require(_0x392e('0x0'));var events=[_0x392e('0x1'),_0x392e('0x2'),'update'];function createListener(_0x4a6815,_0x20331e){return function(_0x4bcae5){_0x20331e[_0x392e('0x3')](_0x4a6815,_0x4bcae5);};}function removeListener(_0xe961f6,_0x5b2495){return function(){VoiceQueueReportEvents[_0x392e('0x4')](_0xe961f6,_0x5b2495);};}exports[_0x392e('0x5')]=function(_0x2049be){for(var _0x65ddb7=0x0,_0x4369e3=events[_0x392e('0x6')];_0x65ddb7<_0x4369e3;_0x65ddb7++){var _0x2818f4=events[_0x65ddb7];var _0x3f0f99=createListener(_0x392e('0x7')+_0x2818f4,_0x2049be);VoiceQueueReportEvents['on'](_0x2818f4,_0x3f0f99);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c6eaf56..ef07baf 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 _0x3148=['isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x3148,0x1d3));var _0x8314=function(_0x31c5e9,_0x30e373){_0x31c5e9=_0x31c5e9-0x0;var _0x517a8d=_0x3148[_0x31c5e9];return _0x517a8d;};'use strict';var multer=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var path=require('path');var timeout=require(_0x8314('0x2'));var express=require(_0x8314('0x3'));var router=express[_0x8314('0x4')]();var auth=require(_0x8314('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8314('0x6'));var controller=require(_0x8314('0x7'));router[_0x8314('0x8')]('/',auth[_0x8314('0x9')](),controller[_0x8314('0xa')]);router[_0x8314('0x8')](_0x8314('0xb'),auth['isAuthenticated'](),controller[_0x8314('0xc')]);router['post']('/',auth[_0x8314('0x9')](),controller[_0x8314('0xd')]);router[_0x8314('0xe')](_0x8314('0xb'),auth[_0x8314('0x9')](),controller['update']);router['delete'](_0x8314('0xb'),auth[_0x8314('0x9')](),controller[_0x8314('0xf')]);module[_0x8314('0x10')]=router; \ No newline at end of file +var _0xdedd=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x546642,_0x2e8af7){var _0xfede93=function(_0x7b04d3){while(--_0x7b04d3){_0x546642['push'](_0x546642['shift']());}};_0xfede93(++_0x2e8af7);}(_0xdedd,0x197));var _0xdded=function(_0x2dcc6c,_0x229a47){_0x2dcc6c=_0x2dcc6c-0x0;var _0x3af444=_0xdedd[_0x2dcc6c];return _0x3af444;};'use strict';var multer=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var path=require(_0xdded('0x2'));var timeout=require(_0xdded('0x3'));var express=require(_0xdded('0x4'));var router=express['Router']();var auth=require(_0xdded('0x5'));var interaction=require(_0xdded('0x6'));var config=require(_0xdded('0x7'));var controller=require(_0xdded('0x8'));router[_0xdded('0x9')]('/',auth[_0xdded('0xa')](),controller[_0xdded('0xb')]);router[_0xdded('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdded('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdded('0xd')](_0xdded('0xe'),auth[_0xdded('0xa')](),controller[_0xdded('0xf')]);router['delete'](_0xdded('0xe'),auth['isAuthenticated'](),controller[_0xdded('0x10')]);module[_0xdded('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 9bcaa8c..4a36e4b 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 _0x2d03=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x515c95,_0x18930f){var _0x55ad4b=function(_0x2c706c){while(--_0x2c706c){_0x515c95['push'](_0x515c95['shift']());}};_0x55ad4b(++_0x18930f);}(_0x2d03,0x17a));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x32d0('0x0'));var moment=require('moment');module[_0x32d0('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x32d0('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x32d0('0x3')],'allowNull':![],'defaultValue':moment()[_0x32d0('0x4')](_0x32d0('0x5'))}}; \ No newline at end of file +var _0x81a9=['exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x81a9,0x176));var _0x981a=function(_0x28113b,_0x226e12){_0x28113b=_0x28113b-0x0;var _0x41ba36=_0x81a9[_0x28113b];return _0x41ba36;};'use strict';var Sequelize=require(_0x981a('0x0'));var moment=require('moment');module[_0x981a('0x1')]={'time':{'type':Sequelize[_0x981a('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x981a('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x981a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x981a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x981a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x981a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x981a('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x981a('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x981a('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 99ccb5b..591543b 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4d77bc,_0x5eb675){var _0xb2b6d5=function(_0x5b1dfe){while(--_0x5b1dfe){_0x4d77bc['push'](_0x4d77bc['shift']());}};_0xb2b6d5(++_0x5eb675);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x30e977,_0x5edc12){var _0x536cb5=function(_0x18185c){while(--_0x18185c){_0x30e977['push'](_0x30e977['shift']());}};_0x536cb5(++_0x5edc12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d822838..03ec64d 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 _0xea69=['request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','dtm','lodash','util','../../config/logger','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xea69,0x181));var _0x9ea6=function(_0x535e73,_0x5d397f){_0x535e73=_0x535e73-0x0;var _0x316665=_0xea69[_0x535e73];return _0x316665;};'use strict';var _=require(_0x9ea6('0x0'));var util=require(_0x9ea6('0x1'));var logger=require(_0x9ea6('0x2'))(_0x9ea6('0x3'));var moment=require(_0x9ea6('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea6('0x6'));var config=require(_0x9ea6('0x7'));var attributes=require(_0x9ea6('0x8'));module['exports']=function(_0x173f2d,_0x54cd72){return _0x173f2d[_0x9ea6('0x9')](_0x9ea6('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x9ea6('0xb'),'fields':['event',_0x9ea6('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x56ca=['request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','util','../../config/logger','api','moment'];(function(_0x41be2a,_0x44267a){var _0xab598e=function(_0x52bc1b){while(--_0x52bc1b){_0x41be2a['push'](_0x41be2a['shift']());}};_0xab598e(++_0x44267a);}(_0x56ca,0xa4));var _0xa56c=function(_0x4d7895,_0x5c1871){_0x4d7895=_0x4d7895-0x0;var _0x2fcd90=_0x56ca[_0x4d7895];return _0x2fcd90;};'use strict';var _=require('lodash');var util=require(_0xa56c('0x0'));var logger=require(_0xa56c('0x1'))(_0xa56c('0x2'));var moment=require(_0xa56c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa56c('0x4'));var fs=require('fs');var path=require(_0xa56c('0x5'));var rimraf=require(_0xa56c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa56c('0x7'));module[_0xa56c('0x8')]=function(_0x226aa0,_0x353c7d){return _0x226aa0[_0xa56c('0x9')](_0xa56c('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xa56c('0xb'),'fields':[_0xa56c('0xc'),_0xa56c('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 828232e..6ee3191 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 _0xe493=['../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4b78b6,_0xa15589){var _0x1c4c9d=function(_0x55952b){while(--_0x55952b){_0x4b78b6['push'](_0x4b78b6['shift']());}};_0x1c4c9d(++_0xa15589);}(_0xe493,0x7e));var _0x3e49=function(_0x57fc87,_0x19c0a4){_0x57fc87=_0x57fc87-0x0;var _0x1502a0=_0xe493[_0x57fc87];return _0x1502a0;};'use strict';var _=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var BPromise=require(_0x3e49('0x3'));var rs=require(_0x3e49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e49('0x5'))['db'];var utils=require(_0x3e49('0x6'));var logger=require('../../config/logger')(_0x3e49('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e49('0x8'));var client=jayson[_0x3e49('0x9')][_0x3e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7821,_0x12dd84,_0x3626b6){return new BPromise(function(_0x4e96ac,_0x56b767){return client['request'](_0x3f7821,_0x3626b6)[_0x3e49('0xb')](function(_0x8b8c0e){logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));logger[_0x3e49('0xf')](_0x3e49('0x10'),_0x12dd84,_0x3e49('0xe'),JSON[_0x3e49('0x11')](_0x8b8c0e));if(_0x8b8c0e[_0x3e49('0x12')]){if(_0x8b8c0e[_0x3e49('0x12')]['code']===0x1f4){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x56b767(_0x8b8c0e[_0x3e49('0x12')]['message']);}logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x8b8c0e['error'][_0x3e49('0x13')]);return _0x4e96ac(_0x8b8c0e[_0x3e49('0x12')][_0x3e49('0x13')]);}else{logger[_0x3e49('0xc')](_0x3e49('0xd'),_0x12dd84,_0x3e49('0xe'));_0x4e96ac(_0x8b8c0e[_0x3e49('0x14')][_0x3e49('0x13')]);}})[_0x3e49('0x15')](function(_0x1d9cce){logger[_0x3e49('0x12')](_0x3e49('0xd'),_0x12dd84,_0x1d9cce);_0x56b767(_0x1d9cce);});});} \ No newline at end of file +var _0xa478=['http','then','info','request\x20sent','debug','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xa478,0x136));var _0x8a47=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xa478[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8fd2088..e37437c 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 _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x28bcbc,_0x30ec21){var _0x3a814e=function(_0x175dc0){while(--_0x175dc0){_0x28bcbc['push'](_0x28bcbc['shift']());}};_0x3a814e(++_0x30ec21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x11b2da,_0x4ea9aa){var _0x14676f=function(_0x5946b6){while(--_0x5946b6){_0x11b2da['push'](_0x11b2da['shift']());}};_0x14676f(++_0x4ea9aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index ecb9980..7ae167c 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 _0x7c59=['extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','updatedAt','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','VIRTUAL','getDataValue','value'];(function(_0x1013ff,_0x5218ad){var _0xc00260=function(_0x42e511){while(--_0x42e511){_0x1013ff['push'](_0x1013ff['shift']());}};_0xc00260(++_0x5218ad);}(_0x7c59,0xaa));var _0x97c5=function(_0x5c73c4,_0x557210){_0x5c73c4=_0x5c73c4-0x0;var _0x31374d=_0x7c59[_0x5c73c4];return _0x31374d;};'use strict';var Sequelize=require(_0x97c5('0x0'));var moment=require(_0x97c5('0x1'));var path=require(_0x97c5('0x2'));module['exports']={'format':{'type':Sequelize[_0x97c5('0x3')],'get':function(){return this[_0x97c5('0x4')](_0x97c5('0x5'))?path[_0x97c5('0x6')](this[_0x97c5('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x97c5('0x7')]},'channel':{'type':Sequelize[_0x97c5('0x7')],'set':function(_0x4516a2){if(_0x4516a2){this[_0x97c5('0x8')](_0x97c5('0x9'),_0x4516a2);this[_0x97c5('0x8')](_0x97c5('0xa'),_0x4516a2[_0x97c5('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x97c5('0x7')]},'calleridnum':{'type':Sequelize[_0x97c5('0x7')]},'calleridname':{'type':Sequelize[_0x97c5('0x7')]},'connectedlinenum':{'type':Sequelize[_0x97c5('0x7')]},'connectedlinename':{'type':Sequelize[_0x97c5('0x7')]},'accountcode':{'type':Sequelize[_0x97c5('0x7')]},'context':{'type':Sequelize[_0x97c5('0x7')]},'exten':{'type':Sequelize[_0x97c5('0x7')]},'value':{'type':Sequelize[_0x97c5('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x97c5('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x97c5('0x7')]},'userDisposition':{'type':Sequelize[_0x97c5('0x7')]},'location':{'type':Sequelize[_0x97c5('0xd')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x97c5('0xe')},'fileUri':{'type':Sequelize[_0x97c5('0xd')]},'fileText':{'type':Sequelize[_0x97c5('0xd')]},'failureReason':{'type':Sequelize[_0x97c5('0xd')]},'sentiment':{'type':Sequelize[_0x97c5('0x7')]},'sPositive':{'type':Sequelize[_0x97c5('0xf')]},'sNegative':{'type':Sequelize[_0x97c5('0xf')]},'sNeutral':{'type':Sequelize[_0x97c5('0xf')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x97c5('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x97c5('0x4')](_0x97c5('0x11')))[_0x97c5('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x97c5('0x4')](_0x97c5('0x13')))[_0x97c5('0x12')](_0x97c5('0x14'))[_0x97c5('0x15')]();}}}; \ No newline at end of file +var _0x02d9=['getDataValue','extname','value','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','format','toString','moment','path','exports','VIRTUAL'];(function(_0x35ece2,_0x566414){var _0x10187b=function(_0x5f4466){while(--_0x5f4466){_0x35ece2['push'](_0x35ece2['shift']());}};_0x10187b(++_0x566414);}(_0x02d9,0x11a));var _0x902d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x02d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x902d('0x0'));var path=require(_0x902d('0x1'));module[_0x902d('0x2')]={'format':{'type':Sequelize[_0x902d('0x3')],'get':function(){return this[_0x902d('0x4')]('value')?path[_0x902d('0x5')](this['getDataValue'](_0x902d('0x6'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x902d('0x7')],'set':function(_0x455d9d){if(_0x455d9d){this[_0x902d('0x8')](_0x902d('0x9'),_0x455d9d);this[_0x902d('0x8')](_0x902d('0xa'),_0x455d9d[_0x902d('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x902d('0x7')]},'calleridnum':{'type':Sequelize[_0x902d('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x902d('0x7')]},'connectedlinename':{'type':Sequelize[_0x902d('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x902d('0x7')]},'value':{'type':Sequelize[_0x902d('0x7')]},'type':{'type':Sequelize[_0x902d('0x7')]},'rating':{'type':Sequelize[_0x902d('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x902d('0xd')]},'transcribeName':{'type':Sequelize[_0x902d('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x902d('0xe')},'fileUri':{'type':Sequelize[_0x902d('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x902d('0xd')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x902d('0xf')]},'sNeutral':{'type':Sequelize[_0x902d('0xf')]},'sMixed':{'type':Sequelize[_0x902d('0xf')]},'tempSentiment':{'type':Sequelize[_0x902d('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x902d('0x11')],'get':function(){return moment(this[_0x902d('0x4')](_0x902d('0x12')))['format'](_0x902d('0x13'))['toString']();}},'updatedAt':{'type':Sequelize[_0x902d('0x11')],'get':function(){return moment(this[_0x902d('0x4')]('updatedAt'))[_0x902d('0x14')](_0x902d('0x13'))[_0x902d('0x15')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index b885387..4a7b1d4 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 _0xdf14=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','differenceBy','format','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','VoiceRecording','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','download','../../components/encryptor','value','%s.cypher','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','uniqueid','token','$and','push','decryptFile','existsSync','ValidationError','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','Setting','findOne','transcribeAccountId','transcribeRegion','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xdf14,0xa2));var _0x4df1=function(_0x59f2ee,_0x38e8b5){_0x59f2ee=_0x59f2ee-0x0;var _0x5a2281=_0xdf14[_0x59f2ee];return _0x5a2281;};'use strict';var pdf=require(_0x4df1('0x0'));var emlformat=require(_0x4df1('0x1'));var rimraf=require(_0x4df1('0x2'));var zipdir=require(_0x4df1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4df1('0x4'));var moment=require(_0x4df1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4df1('0x6'));var util=require('util');var path=require(_0x4df1('0x7'));var sox=require(_0x4df1('0x8'));var csv=require(_0x4df1('0x9'));var ejs=require(_0x4df1('0xa'));var fs=require('fs');var _=require(_0x4df1('0xb'));var squel=require('squel');var crypto=require(_0x4df1('0xc'));var jsforce=require(_0x4df1('0xd'));var deskjs=require(_0x4df1('0xe'));var toCsv=require(_0x4df1('0x9'));var querystring=require(_0x4df1('0xf'));var Papa=require(_0x4df1('0x10'));var AWS=require(_0x4df1('0x11'));var uuidv4=require(_0x4df1('0x12'));var Redis=require(_0x4df1('0x13'));var authService=require(_0x4df1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4df1('0x15'));var hardwareService=require(_0x4df1('0x16'));var logger=require('../../config/logger')(_0x4df1('0x17'));var utils=require('../../config/utils');var config=require(_0x4df1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557483,_0x27aa5f){_0x27aa5f=_0x27aa5f||0xcc;return function(_0x460deb){if(_0x460deb){return _0x557483[_0x4df1('0x19')](_0x27aa5f);}return _0x557483[_0x4df1('0x1a')](_0x27aa5f)[_0x4df1('0x1b')]();};}function respondWithResult(_0x1a96c7,_0x49a302){_0x49a302=_0x49a302||0xc8;return function(_0x10ac49){if(_0x10ac49){return _0x1a96c7[_0x4df1('0x1a')](_0x49a302)['json'](_0x10ac49);}};}function respondWithFilteredResult(_0x4469fa,_0x40952c){return function(_0x309288){if(_0x309288){var _0x3f72c1=_0x309288[_0x4df1('0x1c')],_0x7038cb=_0x40952c[_0x4df1('0x1d')],_0x2261d9=_0x40952c[_0x4df1('0x1d')]+_0x40952c['limit'],_0x2ad66a;if(_0x2261d9>=_0x3f72c1){_0x2261d9=_0x3f72c1;_0x2ad66a=0xc8;}else{_0x2ad66a=0xce;}_0x4469fa[_0x4df1('0x1a')](_0x2ad66a);return _0x4469fa[_0x4df1('0x1e')](_0x4df1('0x1f'),_0x7038cb+'-'+_0x2261d9+'/'+_0x3f72c1)[_0x4df1('0x20')](_0x309288);}return null;};}function patchUpdates(_0x23171b){return function(_0x3dbc08){try{jsonpatch[_0x4df1('0x21')](_0x3dbc08,_0x23171b,!![]);}catch(_0x580f1a){return BPromise[_0x4df1('0x22')](_0x580f1a);}return _0x3dbc08['save']();};}function saveUpdates(_0x5dc39d,_0x49358b){return function(_0x2796f0){if(_0x2796f0){return _0x2796f0[_0x4df1('0x23')](_0x5dc39d)[_0x4df1('0x24')](function(_0x1ecbc6){return _0x1ecbc6;});}return null;};}function removeEntity(_0x21b674,_0x42bb7e){return function(_0x1c8000){if(_0x1c8000){return _0x1c8000[_0x4df1('0x25')]()[_0x4df1('0x24')](function(){_0x21b674[_0x4df1('0x1a')](0xcc)[_0x4df1('0x1b')]();});}};}function handleEntityNotFound(_0x443894,_0x4f31d7){return function(_0x37a000){if(!_0x37a000){_0x443894['sendStatus'](0x194);}return _0x37a000;};}function handleError(_0x4ae9f5,_0x10da73){_0x10da73=_0x10da73||0x1f4;return function(_0x5a692e){logger[_0x4df1('0x26')](_0x5a692e[_0x4df1('0x27')]);if(_0x5a692e[_0x4df1('0x28')]){delete _0x5a692e[_0x4df1('0x28')];}_0x4ae9f5['status'](_0x10da73)['send'](_0x5a692e);};}exports['index']=function(_0x23e846,_0x22fccf){var _0x2fd8be={},_0x3458c7={},_0x325718={'count':0x0,'rows':[]};var _0x41ab66=_[_0x4df1('0x29')](db['VoiceRecording'][_0x4df1('0x2a')],function(_0x530d5d){return{'name':_0x530d5d[_0x4df1('0x2b')],'type':_0x530d5d[_0x4df1('0x2c')]['key']};});_0x3458c7['model']=_[_0x4df1('0x2d')](_['map'](_0x41ab66,_0x4df1('0x28')),[_0x4df1('0x2e')]);_0x3458c7['query']=_[_0x4df1('0x2f')](_0x23e846[_0x4df1('0x30')]);_0x3458c7[_0x4df1('0x31')]=_[_0x4df1('0x32')](_0x3458c7[_0x4df1('0x33')],_0x3458c7[_0x4df1('0x30')]);_0x2fd8be[_0x4df1('0x34')]=_[_0x4df1('0x32')](_0x3458c7[_0x4df1('0x33')],qs[_0x4df1('0x35')](_0x23e846[_0x4df1('0x30')][_0x4df1('0x35')]));_0x2fd8be[_0x4df1('0x34')]=_0x2fd8be[_0x4df1('0x34')][_0x4df1('0x36')]?_0x2fd8be[_0x4df1('0x34')]:_0x3458c7[_0x4df1('0x33')];if(!_0x23e846['query'][_0x4df1('0x37')]('nolimit')){_0x2fd8be[_0x4df1('0x38')]=qs[_0x4df1('0x38')](_0x23e846[_0x4df1('0x30')][_0x4df1('0x38')]);_0x2fd8be['offset']=qs[_0x4df1('0x1d')](_0x23e846[_0x4df1('0x30')][_0x4df1('0x1d')]);}_0x2fd8be[_0x4df1('0x39')]=qs[_0x4df1('0x3a')](_0x23e846[_0x4df1('0x30')]['sort']);_0x2fd8be[_0x4df1('0x3b')]=qs[_0x4df1('0x31')](_[_0x4df1('0x3c')](_0x23e846['query'],_0x3458c7[_0x4df1('0x31')]),_0x41ab66);if(_0x23e846['query'][_0x4df1('0x3d')]){_0x2fd8be[_0x4df1('0x3b')]=_['merge'](_0x2fd8be[_0x4df1('0x3b')],{'$or':_[_0x4df1('0x29')](_0x41ab66,function(_0x5496a4){if(_0x5496a4[_0x4df1('0x2c')]!==_0x4df1('0x3e')){var _0x1c93b1={};_0x1c93b1[_0x5496a4[_0x4df1('0x28')]]={'$like':'%'+_0x23e846[_0x4df1('0x30')][_0x4df1('0x3d')]+'%'};return _0x1c93b1;}})});}_0x2fd8be=_[_0x4df1('0x3f')]({},_0x2fd8be,_0x23e846['options']);var _0xf46229={'where':_0x2fd8be[_0x4df1('0x3b')]};return db[_0x4df1('0x40')][_0x4df1('0x1c')](_0xf46229)[_0x4df1('0x24')](function(_0x4d697f){_0x325718[_0x4df1('0x1c')]=_0x4d697f;if(_0x23e846[_0x4df1('0x30')][_0x4df1('0x41')]){_0x2fd8be[_0x4df1('0x42')]=[{'all':!![]}];}return db[_0x4df1('0x40')][_0x4df1('0x43')](_0x2fd8be);})['then'](function(_0x17c027){_0x325718['rows']=_0x17c027;return _0x325718;})[_0x4df1('0x24')](respondWithFilteredResult(_0x22fccf,_0x2fd8be))[_0x4df1('0x44')](handleError(_0x22fccf,null));};exports[_0x4df1('0x45')]=function(_0x46eb35,_0x557106){var _0x17df31={'raw':![],'where':{'id':_0x46eb35[_0x4df1('0x46')]['id']}},_0x29f37d={};_0x29f37d['model']=_['keys'](db[_0x4df1('0x40')][_0x4df1('0x2a')]);_0x29f37d[_0x4df1('0x30')]=_['keys'](_0x46eb35[_0x4df1('0x30')]);_0x29f37d[_0x4df1('0x31')]=_['intersection'](_0x29f37d[_0x4df1('0x33')],_0x29f37d[_0x4df1('0x30')]);_0x17df31[_0x4df1('0x34')]=_[_0x4df1('0x32')](_0x29f37d[_0x4df1('0x33')],qs[_0x4df1('0x35')](_0x46eb35[_0x4df1('0x30')][_0x4df1('0x35')]));_0x17df31[_0x4df1('0x34')]=_0x17df31[_0x4df1('0x34')][_0x4df1('0x36')]?_0x17df31[_0x4df1('0x34')]:_0x29f37d['model'];if(_0x46eb35[_0x4df1('0x30')][_0x4df1('0x41')]){_0x17df31[_0x4df1('0x42')]=[{'all':!![]}];}_0x17df31=_[_0x4df1('0x3f')]({},_0x17df31,_0x46eb35[_0x4df1('0x47')]);return db[_0x4df1('0x40')][_0x4df1('0x48')](_0x17df31)[_0x4df1('0x24')](handleEntityNotFound(_0x557106,null))[_0x4df1('0x24')](respondWithResult(_0x557106,null))[_0x4df1('0x44')](handleError(_0x557106,null));};exports[_0x4df1('0x49')]=function(_0x3a43a6,_0x19a5c3){return db[_0x4df1('0x40')]['create'](_0x3a43a6[_0x4df1('0x4a')],{})[_0x4df1('0x24')](respondWithResult(_0x19a5c3,0xc9))[_0x4df1('0x44')](handleError(_0x19a5c3,null));};exports[_0x4df1('0x23')]=function(_0x42f0ad,_0x41a1c8){if(_0x42f0ad[_0x4df1('0x4a')]['id']){delete _0x42f0ad[_0x4df1('0x4a')]['id'];}return db['VoiceRecording'][_0x4df1('0x48')]({'where':{'id':_0x42f0ad['params']['id']}})[_0x4df1('0x24')](handleEntityNotFound(_0x41a1c8,null))['then'](saveUpdates(_0x42f0ad['body'],null))['then'](respondWithResult(_0x41a1c8,null))[_0x4df1('0x44')](handleError(_0x41a1c8,null));};exports[_0x4df1('0x4b')]=function(_0x19809d,_0x15659e){return db[_0x4df1('0x40')][_0x4df1('0x4b')]()['then'](respondWithResult(_0x15659e,null))[_0x4df1('0x44')](handleError(_0x15659e,null));};exports[_0x4df1('0x4c')]=function(_0x39b640,_0x498f54,_0x59b989){var _0x157e2a=require(_0x4df1('0x4d'));var _0x2ecefd=![];var _0x44c55f={};if(_0x39b640[_0x4df1('0x30')][_0x4df1('0x2c')]&&_0x39b640[_0x4df1('0x30')][_0x4df1('0x2c')]==='uniqueid'){_0x44c55f['uniqueid']=_0x39b640[_0x4df1('0x46')]['id'];}else{_0x44c55f['id']=_0x39b640[_0x4df1('0x46')]['id'];}return db[_0x4df1('0x40')][_0x4df1('0x48')]({'where':_0x44c55f,'attributes':['id',_0x4df1('0x4e')],'raw':!![]})[_0x4df1('0x24')](handleEntityNotFound(_0x498f54,null))[_0x4df1('0x24')](function(_0x559e67){if(_0x559e67){var _0x547bbf=_0x559e67[_0x4df1('0x4e')];var _0x11e28e=util['format'](_0x4df1('0x4f'),_0x547bbf);if(fs['existsSync'](_0x11e28e)){_0x2ecefd=!![];return _0x157e2a['decryptFile'](_0x11e28e,_0x547bbf,config[_0x4df1('0x50')][_0x4df1('0x51')])[_0x4df1('0x24')](function(){return _0x559e67;});}return _0x559e67;}})[_0x4df1('0x24')](function(_0x37391a){if(_0x37391a){var _0x4ee017=_0x37391a[_0x4df1('0x4e')];if(!fs['existsSync'](_0x4ee017)){throw new db[(_0x4df1('0x52'))]['ValidationError'](_0x4df1('0x53'));}if(_0x37391a['filename']){return _0x498f54[_0x4df1('0x4c')](_0x4ee017,_0x37391a[_0x4df1('0x54')]+path[_0x4df1('0x55')](_0x4ee017),function(){if(_0x2ecefd){fs[_0x4df1('0x56')](_0x4ee017);}});}else{return _0x498f54[_0x4df1('0x4c')](_0x4ee017,function(_0x45049f){if(_0x2ecefd){fs['unlink'](_0x4ee017);}});}}})[_0x4df1('0x44')](function(_0x194e37){if(_0x194e37[_0x4df1('0x57')]===_0x4df1('0x53')){_0x498f54[_0x4df1('0x1a')](0x194)[_0x4df1('0x58')](_0x4df1('0x59'));}else{return handleError(_0x498f54,null);}});};exports[_0x4df1('0x5a')]=function(_0x6880a4,_0x5b14ca,_0x56a610){var _0x3f84e3=require('../../components/encryptor');var _0x556fc2=![];var _0x18c176={'$and':[db[_0x4df1('0x5b')]['where'](db[_0x4df1('0x5b')]['fn'](_0x4df1('0x5c'),db[_0x4df1('0x5b')]['col'](_0x4df1('0x5d'))),_0x6880a4[_0x4df1('0x30')][_0x4df1('0x5e')])]};if(_0x6880a4['query'][_0x4df1('0x2c')]&&_0x6880a4['query']['type']===_0x4df1('0x5d')){_0x18c176[_0x4df1('0x5f')][_0x4df1('0x60')]({'uniqueid':_0x6880a4[_0x4df1('0x46')]['id']});}else{_0x18c176[_0x4df1('0x5f')]['push']({'id':_0x6880a4[_0x4df1('0x46')]['id']});}return db[_0x4df1('0x40')][_0x4df1('0x48')]({'where':_0x18c176,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5b14ca,null))['then'](function(_0x52e3f0){if(_0x52e3f0){var _0x513b6c=util['format'](_0x4df1('0x4f'),_0x52e3f0[_0x4df1('0x4e')]);if(fs['existsSync'](_0x513b6c)){_0x556fc2=!![];return _0x3f84e3[_0x4df1('0x61')](_0x513b6c,_0x52e3f0['value'],config[_0x4df1('0x50')][_0x4df1('0x51')])[_0x4df1('0x24')](function(){return _0x52e3f0;});}return _0x52e3f0;}})[_0x4df1('0x24')](function(_0x17ec25){if(_0x17ec25){if(!fs[_0x4df1('0x62')](_0x17ec25['value'])){throw new db[(_0x4df1('0x52'))][(_0x4df1('0x63'))]('VoiceRecording\x20not\x20found');}if(_0x17ec25[_0x4df1('0x54')]){return _0x5b14ca[_0x4df1('0x4c')](_0x17ec25['value'],_0x17ec25[_0x4df1('0x54')]+path['extname'](_0x17ec25[_0x4df1('0x4e')]),function(){if(_0x556fc2){fs[_0x4df1('0x56')](_0x17ec25[_0x4df1('0x4e')]);}});}else{return _0x5b14ca['download'](_0x17ec25[_0x4df1('0x4e')],function(_0x3a3bce){if(_0x556fc2){fs[_0x4df1('0x56')](_0x17ec25[_0x4df1('0x4e')]);}});}}})[_0x4df1('0x44')](handleError(_0x5b14ca,null));};exports['destroy']=function(_0x3e5207,_0x4b24a3){return db[_0x4df1('0x40')][_0x4df1('0x48')]({'where':{'id':_0x3e5207['params']['id']}})[_0x4df1('0x24')](function(_0xbe7871){if(!_0xbe7871)throw new ReferenceError(_0x4df1('0x64'));return _0xbe7871;})[_0x4df1('0x24')](function(_0x3786c2){var _0x5a2edf=_0x3786c2[_0x4df1('0x4e')];logger['info'](_0x4df1('0x65'),_0x5a2edf);if(!_['isNil'](_0x3786c2[_0x4df1('0x4e')])&&fs[_0x4df1('0x62')](_0x5a2edf)){logger[_0x4df1('0x66')](_0x4df1('0x67')+_0x5a2edf+_0x4df1('0x68'));fs[_0x4df1('0x69')](_0x5a2edf);}_0x5a2edf=_0x5a2edf+_0x4df1('0x6a');if(!_[_0x4df1('0x6b')](_0x3786c2[_0x4df1('0x4e')])&&fs['existsSync'](_0x5a2edf)){logger[_0x4df1('0x66')]('File:\x20\x22'+_0x5a2edf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4df1('0x69')](_0x5a2edf);}return _0x3786c2;})[_0x4df1('0x24')](function(_0x4e134b){if(!_0x4e134b)throw new InternalError();return _0x4e134b[_0x4df1('0x25')]();})[_0x4df1('0x24')](function(){_0x4b24a3[_0x4df1('0x1a')](0xcc)[_0x4df1('0x1b')]();})[_0x4df1('0x44')](handleError(_0x4b24a3,null));};function getBucketslist(_0x1caee1,_0x13a435,_0x344e9c){return new Promise(function(_0x5f56d6,_0x1c25e5){var _0x1bca25=new AWS['S3']({'accessKeyId':_0x13a435,'secretAccessKey':_0x1caee1,'region':_0x344e9c});_0x1bca25[_0x4df1('0x6c')]({},function(_0x2e741e,_0x12818c){if(_0x2e741e){return _0x1c25e5(_0x2e741e);}else{return _0x5f56d6(_0x12818c);}});});}function createBucket(_0x544681,_0x400f04,_0xee1af3,_0x429325){return new Promise(function(_0x52e90d,_0x2eb214){var _0x2119b7=new AWS['S3']({'accessKeyId':_0x400f04,'secretAccessKey':_0x544681,'region':_0xee1af3});_0x2119b7[_0x4df1('0x6d')]({'Bucket':_0x429325},function(_0x1ff914,_0x39e3bd){if(_0x1ff914){return _0x2eb214(_0x1ff914);}else{return _0x52e90d(_0x39e3bd);}});});}function uploadFile(_0x5116fa,_0x59e0cc,_0x497b56,_0x13e07d,_0x1a85ef,_0x3d980f){return new Promise(function(_0x105fa9,_0x4a234d){var _0x45065a=new AWS['S3']({'accessKeyId':_0x59e0cc,'secretAccessKey':_0x5116fa,'region':_0x497b56});_0x45065a[_0x4df1('0x6e')]({'Bucket':_0x13e07d,'Key':_0x1a85ef,'Body':_0x3d980f},function(_0x16592b,_0x2ae930){if(_0x16592b){return _0x4a234d(_0x16592b);}else{return _0x105fa9(_0x2ae930);}});});}function startTranscribe(_0x946aa6,_0x5be206,_0xb610c2,_0x46ca09,_0x32209a,_0xf19537){return new Promise(function(_0x2f2c7c,_0x26d0f5){var _0x42626e=new AWS[(_0x4df1('0x6f'))]({'accessKeyId':_0x5be206,'secretAccessKey':_0x946aa6,'region':_0xb610c2});_0x42626e['startTranscriptionJob']({'TranscriptionJobName':_0x46ca09,'LanguageCode':_0x32209a,'Media':{'MediaFileUri':_0xf19537}},function(_0x54484b,_0x3129d9){if(_0x54484b){return _0x26d0f5(_0x54484b);}else{return _0x2f2c7c(_0x3129d9);}});});}function transcribe(_0x392491,_0x2f1c03,_0x3023bb,_0x4abbc6,_0x3ee839,_0x48f768,_0x1ff963){return new Promise(function(_0x489e5e,_0x178679){var _0x5e8288={};logger[_0x4df1('0x66')](util[_0x4df1('0x2e')](_0x4df1('0x70'),_0x392491,_0x3ee839));return uploadFile(_0x2f1c03,_0x3023bb,_0x4abbc6,_0x3ee839,path[_0x4df1('0x71')](_0x48f768),fs[_0x4df1('0x72')](_0x48f768))['then'](function(_0x495787){logger[_0x4df1('0x66')](util[_0x4df1('0x2e')](_0x4df1('0x73'),_0x392491,_0x3ee839,_0x495787[_0x4df1('0x74')]));_0x5e8288[_0x4df1('0x75')]=_0x495787[_0x4df1('0x76')];_0x5e8288[_0x4df1('0x77')]=_0x495787[_0x4df1('0x74')];logger['info'](util[_0x4df1('0x2e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x392491));return startTranscribe(_0x2f1c03,_0x3023bb,_0x4abbc6,uuidv4(),_0x1ff963,_0x495787[_0x4df1('0x74')]);})[_0x4df1('0x24')](function(_0x726e7a){logger[_0x4df1('0x66')](util[_0x4df1('0x2e')](_0x4df1('0x78'),_0x392491,_0x726e7a[_0x4df1('0x79')]['TranscriptionJobName']));_0x5e8288[_0x4df1('0x7a')]=_0x726e7a['TranscriptionJob'][_0x4df1('0x7b')];_0x5e8288[_0x4df1('0x7c')]=_0x726e7a[_0x4df1('0x79')]['TranscriptionJobStatus'];return _0x489e5e(_0x5e8288);})[_0x4df1('0x44')](function(_0x40daec){return _0x178679(_0x40daec);});});}exports[_0x4df1('0x7d')]=function(_0x3ba4fa,_0x2de8f3,_0x86eca6){var _0x152daa;var _0x267d0c;var _0x38f34a;var _0x26ac23=require(_0x4df1('0x4d'));return db[_0x4df1('0x40')]['findOne']({'where':{'id':_0x3ba4fa[_0x4df1('0x46')]['id']}})[_0x4df1('0x24')](function(_0x591558){if(_0x591558){var _0x28fe49=util[_0x4df1('0x2e')](_0x4df1('0x4f'),_0x591558[_0x4df1('0x4e')]);if(fs[_0x4df1('0x62')](_0x28fe49)){cypher=!![];return _0x26ac23['decryptFile'](_0x28fe49,_0x591558[_0x4df1('0x4e')],config[_0x4df1('0x50')][_0x4df1('0x51')])[_0x4df1('0x24')](function(){return _0x591558;});}return _0x591558;}})['then'](function(_0x453b38){if(!_0x453b38){throw new db[(_0x4df1('0x52'))][(_0x4df1('0x63'))]('Voice\x20Recording\x20not\x20found');}_0x267d0c=_0x453b38;return db[_0x4df1('0x7e')][_0x4df1('0x7f')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2de8f3,null))[_0x4df1('0x24')](function(_0x5b91b6){if(_0x5b91b6){_0x152daa=_0x5b91b6;if(!_0x152daa['transcribe']||!_0x152daa[_0x4df1('0x80')]||!_0x152daa[_0x4df1('0x81')]||!_0x152daa['language']||!_0x152daa[_0x4df1('0x75')]){throw new db[(_0x4df1('0x52'))][(_0x4df1('0x63'))]('Transcribe\x20not\x20configured');}if(_0x3ba4fa['body']['runSentiment']&&(!_0x152daa[_0x4df1('0x82')]||!_0x152daa[_0x4df1('0x83')]||!_0x152daa[_0x4df1('0x84')]||!_0x152daa[_0x4df1('0x85')]||!_0x152daa[_0x4df1('0x75')])){throw new db[(_0x4df1('0x52'))][(_0x4df1('0x63'))](_0x4df1('0x86'));}return db['CloudProvider'][_0x4df1('0x7f')]({'where':{'id':_0x152daa[_0x4df1('0x80')]}});}})[_0x4df1('0x24')](function(_0x5773bb){if(!_0x5773bb){throw new db[(_0x4df1('0x52'))]['ValidationError'](_0x4df1('0x87'));}if(!_0x5773bb[_0x4df1('0x88')]||!_0x5773bb[_0x4df1('0x89')]){throw new db[(_0x4df1('0x52'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x38f34a=_0x5773bb;return getBucketslist(_0x38f34a[_0x4df1('0x88')],_0x38f34a[_0x4df1('0x89')],_0x152daa['transcribeRegion']);})[_0x4df1('0x24')](function(_0x5490d9){if(_0x5490d9&&_0x5490d9[_0x4df1('0x8a')]){var _0x1f1be2=_[_0x4df1('0x48')](_0x5490d9[_0x4df1('0x8a')],function(_0x186346){return _0x186346[_0x4df1('0x8b')]===_0x152daa[_0x4df1('0x75')];});if(!_0x1f1be2){logger['info'](util[_0x4df1('0x2e')](_0x4df1('0x8c'),_0x3ba4fa[_0x4df1('0x46')]['id'],_0x152daa[_0x4df1('0x75')]));return createBucket(_0x38f34a[_0x4df1('0x88')],_0x38f34a[_0x4df1('0x89')],_0x152daa[_0x4df1('0x81')],_0x152daa[_0x4df1('0x75')]);}logger['info'](util['format'](_0x4df1('0x8d'),_0x3ba4fa['params']['id'],_0x152daa['bucket']));return;}})[_0x4df1('0x24')](function(_0x3bf33f){if(_0x267d0c[_0x4df1('0x7c')]==='NEW'){return transcribe(_0x3ba4fa['params']['id'],_0x38f34a[_0x4df1('0x88')],_0x38f34a[_0x4df1('0x89')],_0x152daa['transcribeRegion'],_0x152daa[_0x4df1('0x75')],_0x267d0c[_0x4df1('0x4e')],_0x152daa[_0x4df1('0x85')]);}else{logger['info'](util['format'](_0x4df1('0x8e'),_0x3ba4fa[_0x4df1('0x46')]['id']));return{'transcribeStatus':_0x4df1('0x8f')};}})[_0x4df1('0x24')](function(_0x13011e){if(_0x13011e){_0x13011e[_0x4df1('0x90')]=_0x3ba4fa[_0x4df1('0x4a')]['runSentiment'];return _0x267d0c['updateAttributes'](_0x13011e);}})[_0x4df1('0x24')](respondWithResult(_0x2de8f3,null))[_0x4df1('0x44')](handleError(_0x2de8f3,null));};function writeFile(_0x5a2096,_0x427ff5){return new Promise(function(_0x2aec1a,_0x2b95e5){fs[_0x4df1('0x91')](_0x427ff5,_0x5a2096,function(_0x2b284c,_0x15ecdb){if(_0x2b284c){return _0x2b95e5(_0x2b284c);}else{return _0x2aec1a(_0x15ecdb);}});});}exports['downloadTranscribe']=function(_0x232f69,_0x5c379d,_0x37ef53){return db['VoiceRecording'][_0x4df1('0x7f')]({'where':{'id':_0x232f69[_0x4df1('0x46')]['id']}})[_0x4df1('0x24')](handleEntityNotFound(_0x5c379d))['then'](function(_0x3e9223){if(_0x3e9223&&_0x3e9223[_0x4df1('0x92')]){var _0x6ab2a6=_0x3e9223[_0x4df1('0x92')];var _0xc197a6=config[_0x4df1('0x93')]+_0x4df1('0x94')+_0x3e9223['id']+_0x4df1('0x95');if(fs[_0x4df1('0x62')](_0xc197a6)){return _0xc197a6;}return writeFile(_0x6ab2a6,_0xc197a6)[_0x4df1('0x24')](function(){return _0xc197a6;});}else{throw new db[(_0x4df1('0x52'))][(_0x4df1('0x63'))](_0x4df1('0x96'));}})[_0x4df1('0x24')](function(_0x385d7f){return _0x5c379d['download'](_0x385d7f);})[_0x4df1('0x44')](handleError(_0x5c379d));}; \ No newline at end of file +var _0x9ba8=['listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','keys','create','body','update','find','params','describe','../../components/encryptor','type','value','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','MD5','sequelize','col','token','uniqueid','$and','push','%s.cypher','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x9ba8,0xc2));var _0x89ba=function(_0x547af,_0x17abff){_0x547af=_0x547af-0x0;var _0x22f7f4=_0x9ba8[_0x547af];return _0x22f7f4;};'use strict';var pdf=require(_0x89ba('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x89ba('0x1'));var jsonpatch=require(_0x89ba('0x2'));var rp=require(_0x89ba('0x3'));var moment=require(_0x89ba('0x4'));var BPromise=require(_0x89ba('0x5'));var Mustache=require(_0x89ba('0x6'));var util=require(_0x89ba('0x7'));var path=require('path');var sox=require(_0x89ba('0x8'));var csv=require(_0x89ba('0x9'));var ejs=require(_0x89ba('0xa'));var fs=require('fs');var _=require(_0x89ba('0xb'));var squel=require('squel');var crypto=require(_0x89ba('0xc'));var jsforce=require(_0x89ba('0xd'));var deskjs=require(_0x89ba('0xe'));var toCsv=require(_0x89ba('0x9'));var querystring=require(_0x89ba('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x89ba('0x10'));var as=require(_0x89ba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89ba('0x12'))(_0x89ba('0x13'));var utils=require(_0x89ba('0x14'));var config=require(_0x89ba('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b396d,_0x17677c){_0x17677c=_0x17677c||0xcc;return function(_0x1cdc15){if(_0x1cdc15){return _0x1b396d[_0x89ba('0x16')](_0x17677c);}return _0x1b396d[_0x89ba('0x17')](_0x17677c)['end']();};}function respondWithResult(_0x4fda26,_0xa4a7d8){_0xa4a7d8=_0xa4a7d8||0xc8;return function(_0x181c9a){if(_0x181c9a){return _0x4fda26[_0x89ba('0x17')](_0xa4a7d8)[_0x89ba('0x18')](_0x181c9a);}};}function respondWithFilteredResult(_0x5a3dbe,_0x12151e){return function(_0x13db46){if(_0x13db46){var _0x3d2105=_0x13db46[_0x89ba('0x19')],_0x5a7085=_0x12151e[_0x89ba('0x1a')],_0x35cd56=_0x12151e['offset']+_0x12151e[_0x89ba('0x1b')],_0x3fa969;if(_0x35cd56>=_0x3d2105){_0x35cd56=_0x3d2105;_0x3fa969=0xc8;}else{_0x3fa969=0xce;}_0x5a3dbe['status'](_0x3fa969);return _0x5a3dbe[_0x89ba('0x1c')](_0x89ba('0x1d'),_0x5a7085+'-'+_0x35cd56+'/'+_0x3d2105)[_0x89ba('0x18')](_0x13db46);}return null;};}function patchUpdates(_0x56f0b4){return function(_0x1ef294){try{jsonpatch[_0x89ba('0x1e')](_0x1ef294,_0x56f0b4,!![]);}catch(_0x4975f5){return BPromise['reject'](_0x4975f5);}return _0x1ef294[_0x89ba('0x1f')]();};}function saveUpdates(_0x56be73,_0x4976af){return function(_0x352193){if(_0x352193){return _0x352193['update'](_0x56be73)[_0x89ba('0x20')](function(_0x3e4f90){return _0x3e4f90;});}return null;};}function removeEntity(_0xec9a57,_0x1e6210){return function(_0x4a636f){if(_0x4a636f){return _0x4a636f[_0x89ba('0x21')]()[_0x89ba('0x20')](function(){_0xec9a57[_0x89ba('0x17')](0xcc)[_0x89ba('0x22')]();});}};}function handleEntityNotFound(_0x1dffab,_0x326064){return function(_0x3e5177){if(!_0x3e5177){_0x1dffab[_0x89ba('0x16')](0x194);}return _0x3e5177;};}function handleError(_0x445f0a,_0x4ca248){_0x4ca248=_0x4ca248||0x1f4;return function(_0x1dedeb){logger[_0x89ba('0x23')](_0x1dedeb[_0x89ba('0x24')]);if(_0x1dedeb[_0x89ba('0x25')]){delete _0x1dedeb[_0x89ba('0x25')];}_0x445f0a[_0x89ba('0x17')](_0x4ca248)[_0x89ba('0x26')](_0x1dedeb);};}exports[_0x89ba('0x27')]=function(_0x2015af,_0x412dc5){var _0x2d2d1b={},_0x17216a={},_0x8fc0b={'count':0x0,'rows':[]};var _0x269b8e=_[_0x89ba('0x28')](db[_0x89ba('0x29')][_0x89ba('0x2a')],function(_0x12bc9f){return{'name':_0x12bc9f['fieldName'],'type':_0x12bc9f['type']['key']};});_0x17216a[_0x89ba('0x2b')]=_[_0x89ba('0x2c')](_['map'](_0x269b8e,_0x89ba('0x25')),[_0x89ba('0x2d')]);_0x17216a[_0x89ba('0x2e')]=_['keys'](_0x2015af[_0x89ba('0x2e')]);_0x17216a[_0x89ba('0x2f')]=_[_0x89ba('0x30')](_0x17216a['model'],_0x17216a[_0x89ba('0x2e')]);_0x2d2d1b[_0x89ba('0x31')]=_[_0x89ba('0x30')](_0x17216a[_0x89ba('0x2b')],qs[_0x89ba('0x32')](_0x2015af['query'][_0x89ba('0x32')]));_0x2d2d1b[_0x89ba('0x31')]=_0x2d2d1b['attributes'][_0x89ba('0x33')]?_0x2d2d1b['attributes']:_0x17216a[_0x89ba('0x2b')];if(!_0x2015af[_0x89ba('0x2e')][_0x89ba('0x34')]('nolimit')){_0x2d2d1b[_0x89ba('0x1b')]=qs['limit'](_0x2015af[_0x89ba('0x2e')][_0x89ba('0x1b')]);_0x2d2d1b[_0x89ba('0x1a')]=qs[_0x89ba('0x1a')](_0x2015af[_0x89ba('0x2e')][_0x89ba('0x1a')]);}_0x2d2d1b[_0x89ba('0x35')]=qs[_0x89ba('0x36')](_0x2015af[_0x89ba('0x2e')][_0x89ba('0x36')]);_0x2d2d1b[_0x89ba('0x37')]=qs[_0x89ba('0x2f')](_[_0x89ba('0x38')](_0x2015af['query'],_0x17216a['filters']),_0x269b8e);if(_0x2015af[_0x89ba('0x2e')]['filter']){_0x2d2d1b[_0x89ba('0x37')]=_[_0x89ba('0x39')](_0x2d2d1b[_0x89ba('0x37')],{'$or':_[_0x89ba('0x28')](_0x269b8e,function(_0x5132e7){if(_0x5132e7['type']!==_0x89ba('0x3a')){var _0xab312e={};_0xab312e[_0x5132e7[_0x89ba('0x25')]]={'$like':'%'+_0x2015af[_0x89ba('0x2e')][_0x89ba('0x3b')]+'%'};return _0xab312e;}})});}_0x2d2d1b=_['merge']({},_0x2d2d1b,_0x2015af[_0x89ba('0x3c')]);var _0x1aed36={'where':_0x2d2d1b[_0x89ba('0x37')]};return db['VoiceRecording']['count'](_0x1aed36)[_0x89ba('0x20')](function(_0xfd7d7){_0x8fc0b[_0x89ba('0x19')]=_0xfd7d7;if(_0x2015af[_0x89ba('0x2e')][_0x89ba('0x3d')]){_0x2d2d1b[_0x89ba('0x3e')]=[{'all':!![]}];}return db[_0x89ba('0x29')]['findAll'](_0x2d2d1b);})['then'](function(_0x26a592){_0x8fc0b['rows']=_0x26a592;return _0x8fc0b;})[_0x89ba('0x20')](respondWithFilteredResult(_0x412dc5,_0x2d2d1b))[_0x89ba('0x3f')](handleError(_0x412dc5,null));};exports['show']=function(_0x15629f,_0xf7121e){var _0x58e87d={'raw':![],'where':{'id':_0x15629f['params']['id']}},_0x46948b={};_0x46948b['model']=_[_0x89ba('0x40')](db[_0x89ba('0x29')]['rawAttributes']);_0x46948b[_0x89ba('0x2e')]=_[_0x89ba('0x40')](_0x15629f[_0x89ba('0x2e')]);_0x46948b[_0x89ba('0x2f')]=_[_0x89ba('0x30')](_0x46948b[_0x89ba('0x2b')],_0x46948b['query']);_0x58e87d[_0x89ba('0x31')]=_['intersection'](_0x46948b[_0x89ba('0x2b')],qs[_0x89ba('0x32')](_0x15629f[_0x89ba('0x2e')]['fields']));_0x58e87d[_0x89ba('0x31')]=_0x58e87d['attributes'][_0x89ba('0x33')]?_0x58e87d[_0x89ba('0x31')]:_0x46948b['model'];if(_0x15629f[_0x89ba('0x2e')][_0x89ba('0x3d')]){_0x58e87d[_0x89ba('0x3e')]=[{'all':!![]}];}_0x58e87d=_['merge']({},_0x58e87d,_0x15629f['options']);return db[_0x89ba('0x29')]['find'](_0x58e87d)[_0x89ba('0x20')](handleEntityNotFound(_0xf7121e,null))[_0x89ba('0x20')](respondWithResult(_0xf7121e,null))[_0x89ba('0x3f')](handleError(_0xf7121e,null));};exports[_0x89ba('0x41')]=function(_0x48ac20,_0x1572b7){return db['VoiceRecording']['create'](_0x48ac20[_0x89ba('0x42')],{})['then'](respondWithResult(_0x1572b7,0xc9))['catch'](handleError(_0x1572b7,null));};exports[_0x89ba('0x43')]=function(_0x4d29bf,_0x3bcaf4){if(_0x4d29bf[_0x89ba('0x42')]['id']){delete _0x4d29bf[_0x89ba('0x42')]['id'];}return db[_0x89ba('0x29')][_0x89ba('0x44')]({'where':{'id':_0x4d29bf[_0x89ba('0x45')]['id']}})[_0x89ba('0x20')](handleEntityNotFound(_0x3bcaf4,null))[_0x89ba('0x20')](saveUpdates(_0x4d29bf[_0x89ba('0x42')],null))['then'](respondWithResult(_0x3bcaf4,null))[_0x89ba('0x3f')](handleError(_0x3bcaf4,null));};exports[_0x89ba('0x46')]=function(_0x512997,_0x4cc9ab){return db['VoiceRecording'][_0x89ba('0x46')]()[_0x89ba('0x20')](respondWithResult(_0x4cc9ab,null))[_0x89ba('0x3f')](handleError(_0x4cc9ab,null));};exports['download']=function(_0x5b98ae,_0x5f5c93,_0x19a2f5){var _0x1cd729=require(_0x89ba('0x47'));var _0x438ebd=![];var _0x38dc29={};if(_0x5b98ae['query'][_0x89ba('0x48')]&&_0x5b98ae[_0x89ba('0x2e')][_0x89ba('0x48')]==='uniqueid'){_0x38dc29['uniqueid']=_0x5b98ae[_0x89ba('0x45')]['id'];}else{_0x38dc29['id']=_0x5b98ae['params']['id'];}return db['VoiceRecording'][_0x89ba('0x44')]({'where':_0x38dc29,'attributes':['id',_0x89ba('0x49')],'raw':!![]})[_0x89ba('0x20')](handleEntityNotFound(_0x5f5c93,null))[_0x89ba('0x20')](function(_0x13e727){if(_0x13e727){var _0x16e224=_0x13e727[_0x89ba('0x49')];var _0x199659=util[_0x89ba('0x2d')]('%s.cypher',_0x16e224);if(fs[_0x89ba('0x4a')](_0x199659)){_0x438ebd=!![];return _0x1cd729[_0x89ba('0x4b')](_0x199659,_0x16e224,config[_0x89ba('0x4c')][_0x89ba('0x4d')])['then'](function(){return _0x13e727;});}return _0x13e727;}})[_0x89ba('0x20')](function(_0x1dd68b){if(_0x1dd68b){var _0x146b65=_0x1dd68b[_0x89ba('0x49')];if(!fs[_0x89ba('0x4a')](_0x146b65)){throw new db[(_0x89ba('0x4e'))]['ValidationError'](_0x89ba('0x4f'));}if(_0x1dd68b[_0x89ba('0x50')]){return _0x5f5c93[_0x89ba('0x51')](_0x146b65,_0x1dd68b[_0x89ba('0x50')]+path[_0x89ba('0x52')](_0x146b65),function(){if(_0x438ebd){fs['unlink'](_0x146b65);}});}else{return _0x5f5c93['download'](_0x146b65,function(_0xf81037){if(_0x438ebd){fs[_0x89ba('0x53')](_0x146b65);}});}}})['catch'](function(_0x525104){if(_0x525104[_0x89ba('0x54')]===_0x89ba('0x4f')){_0x5f5c93[_0x89ba('0x17')](0x194)[_0x89ba('0x26')](_0x89ba('0x55'));}else{return handleError(_0x5f5c93,null);}});};exports['downloads']=function(_0x1cb414,_0x2c61ba,_0x967f94){var _0x39f721=require(_0x89ba('0x47'));var _0x39a399=![];var _0x457b72={'$and':[db['sequelize'][_0x89ba('0x37')](db['sequelize']['fn'](_0x89ba('0x56'),db[_0x89ba('0x57')][_0x89ba('0x58')]('uniqueid')),_0x1cb414[_0x89ba('0x2e')][_0x89ba('0x59')])]};if(_0x1cb414['query']['type']&&_0x1cb414[_0x89ba('0x2e')]['type']===_0x89ba('0x5a')){_0x457b72[_0x89ba('0x5b')]['push']({'uniqueid':_0x1cb414[_0x89ba('0x45')]['id']});}else{_0x457b72[_0x89ba('0x5b')][_0x89ba('0x5c')]({'id':_0x1cb414[_0x89ba('0x45')]['id']});}return db[_0x89ba('0x29')]['find']({'where':_0x457b72,'attributes':['id',_0x89ba('0x49')],'raw':!![]})[_0x89ba('0x20')](handleEntityNotFound(_0x2c61ba,null))[_0x89ba('0x20')](function(_0x1e7376){if(_0x1e7376){var _0x4299f9=util[_0x89ba('0x2d')](_0x89ba('0x5d'),_0x1e7376[_0x89ba('0x49')]);if(fs[_0x89ba('0x4a')](_0x4299f9)){_0x39a399=!![];return _0x39f721[_0x89ba('0x4b')](_0x4299f9,_0x1e7376[_0x89ba('0x49')],config[_0x89ba('0x4c')][_0x89ba('0x4d')])[_0x89ba('0x20')](function(){return _0x1e7376;});}return _0x1e7376;}})['then'](function(_0x4fe8f2){if(_0x4fe8f2){if(!fs['existsSync'](_0x4fe8f2[_0x89ba('0x49')])){throw new db[(_0x89ba('0x4e'))][(_0x89ba('0x5e'))](_0x89ba('0x4f'));}if(_0x4fe8f2['filename']){return _0x2c61ba[_0x89ba('0x51')](_0x4fe8f2[_0x89ba('0x49')],_0x4fe8f2[_0x89ba('0x50')]+path[_0x89ba('0x52')](_0x4fe8f2[_0x89ba('0x49')]),function(){if(_0x39a399){fs['unlink'](_0x4fe8f2[_0x89ba('0x49')]);}});}else{return _0x2c61ba[_0x89ba('0x51')](_0x4fe8f2[_0x89ba('0x49')],function(_0x43cba8){if(_0x39a399){fs[_0x89ba('0x53')](_0x4fe8f2['value']);}});}}})[_0x89ba('0x3f')](handleError(_0x2c61ba,null));};exports[_0x89ba('0x21')]=function(_0x315ef3,_0x32ca49){return db['VoiceRecording'][_0x89ba('0x44')]({'where':{'id':_0x315ef3[_0x89ba('0x45')]['id']}})[_0x89ba('0x20')](function(_0x175e4c){if(!_0x175e4c)throw new ReferenceError(_0x89ba('0x5f'));return _0x175e4c;})[_0x89ba('0x20')](function(_0x50a13b){var _0x1bbcf7=_0x50a13b['value'];logger[_0x89ba('0x60')](_0x89ba('0x61'),_0x1bbcf7);if(!_[_0x89ba('0x62')](_0x50a13b[_0x89ba('0x49')])&&fs[_0x89ba('0x4a')](_0x1bbcf7)){logger['info']('File:\x20\x22'+_0x1bbcf7+_0x89ba('0x63'));fs[_0x89ba('0x64')](_0x1bbcf7);}_0x1bbcf7=_0x1bbcf7+_0x89ba('0x65');if(!_[_0x89ba('0x62')](_0x50a13b[_0x89ba('0x49')])&&fs[_0x89ba('0x4a')](_0x1bbcf7)){logger['info']('File:\x20\x22'+_0x1bbcf7+_0x89ba('0x63'));fs[_0x89ba('0x64')](_0x1bbcf7);}return _0x50a13b;})[_0x89ba('0x20')](function(_0x436193){if(!_0x436193)throw new InternalError();return _0x436193[_0x89ba('0x21')]();})[_0x89ba('0x20')](function(){_0x32ca49[_0x89ba('0x17')](0xcc)[_0x89ba('0x22')]();})[_0x89ba('0x3f')](handleError(_0x32ca49,null));};function getBucketslist(_0x45a830,_0x58b00c,_0x3a081c){return new Promise(function(_0x1286e9,_0xdd1506){var _0x143777=new AWS['S3']({'accessKeyId':_0x58b00c,'secretAccessKey':_0x45a830,'region':_0x3a081c});_0x143777[_0x89ba('0x66')]({},function(_0x3234d5,_0x3947bb){if(_0x3234d5){return _0xdd1506(_0x3234d5);}else{return _0x1286e9(_0x3947bb);}});});}function createBucket(_0x30b89b,_0x3e6c84,_0x45eead,_0x8dbb5e){return new Promise(function(_0x4b991f,_0x58e698){var _0x43bd81=new AWS['S3']({'accessKeyId':_0x3e6c84,'secretAccessKey':_0x30b89b,'region':_0x45eead});_0x43bd81[_0x89ba('0x67')]({'Bucket':_0x8dbb5e},function(_0x4fa6ac,_0x43a49d){if(_0x4fa6ac){return _0x58e698(_0x4fa6ac);}else{return _0x4b991f(_0x43a49d);}});});}function uploadFile(_0x4c1051,_0x1e3d43,_0x3569dd,_0x47913a,_0x5706c9,_0x3e1057){return new Promise(function(_0x53502e,_0x29d345){var _0x5a497f=new AWS['S3']({'accessKeyId':_0x1e3d43,'secretAccessKey':_0x4c1051,'region':_0x3569dd});_0x5a497f[_0x89ba('0x68')]({'Bucket':_0x47913a,'Key':_0x5706c9,'Body':_0x3e1057},function(_0x46c02f,_0x33260f){if(_0x46c02f){return _0x29d345(_0x46c02f);}else{return _0x53502e(_0x33260f);}});});}function startTranscribe(_0x275cdc,_0xc39159,_0x5de85c,_0x5e4428,_0x1cdaa4,_0xf7d8e2){return new Promise(function(_0x13be6f,_0x31bc08){var _0x54ce69=new AWS['TranscribeService']({'accessKeyId':_0xc39159,'secretAccessKey':_0x275cdc,'region':_0x5de85c});_0x54ce69['startTranscriptionJob']({'TranscriptionJobName':_0x5e4428,'LanguageCode':_0x1cdaa4,'Media':{'MediaFileUri':_0xf7d8e2}},function(_0x5dabce,_0x5f01e2){if(_0x5dabce){return _0x31bc08(_0x5dabce);}else{return _0x13be6f(_0x5f01e2);}});});}function transcribe(_0x42ac73,_0x49a200,_0x3972cd,_0xc65b7a,_0x54ee4f,_0x3231f6,_0x28939e){return new Promise(function(_0x54283b,_0x1a3592){var _0xb65a83={};logger['info'](util[_0x89ba('0x2d')](_0x89ba('0x69'),_0x42ac73,_0x54ee4f));return uploadFile(_0x49a200,_0x3972cd,_0xc65b7a,_0x54ee4f,path[_0x89ba('0x6a')](_0x3231f6),fs[_0x89ba('0x6b')](_0x3231f6))['then'](function(_0x42ca8a){logger[_0x89ba('0x60')](util[_0x89ba('0x2d')](_0x89ba('0x6c'),_0x42ac73,_0x54ee4f,_0x42ca8a[_0x89ba('0x6d')]));_0xb65a83[_0x89ba('0x6e')]=_0x42ca8a['Bucket'];_0xb65a83[_0x89ba('0x6f')]=_0x42ca8a[_0x89ba('0x6d')];logger[_0x89ba('0x60')](util[_0x89ba('0x2d')](_0x89ba('0x70'),_0x42ac73));return startTranscribe(_0x49a200,_0x3972cd,_0xc65b7a,uuidv4(),_0x28939e,_0x42ca8a['Location']);})[_0x89ba('0x20')](function(_0x3c8191){logger[_0x89ba('0x60')](util['format'](_0x89ba('0x71'),_0x42ac73,_0x3c8191[_0x89ba('0x72')][_0x89ba('0x73')]));_0xb65a83['transcribeName']=_0x3c8191[_0x89ba('0x72')]['TranscriptionJobName'];_0xb65a83['transcribeStatus']=_0x3c8191[_0x89ba('0x72')][_0x89ba('0x74')];return _0x54283b(_0xb65a83);})[_0x89ba('0x3f')](function(_0x4a4db6){return _0x1a3592(_0x4a4db6);});});}exports['runTranscribe']=function(_0x1cb6dc,_0x3995b3,_0x4ee359){var _0x893c41;var _0x1ffef6;var _0x269c6e;var _0x30185e=require(_0x89ba('0x47'));return db[_0x89ba('0x29')][_0x89ba('0x75')]({'where':{'id':_0x1cb6dc[_0x89ba('0x45')]['id']}})[_0x89ba('0x20')](function(_0x4e46c9){if(_0x4e46c9){var _0x44dc9c=util['format'](_0x89ba('0x5d'),_0x4e46c9[_0x89ba('0x49')]);if(fs['existsSync'](_0x44dc9c)){cypher=!![];return _0x30185e[_0x89ba('0x4b')](_0x44dc9c,_0x4e46c9[_0x89ba('0x49')],config['secrets'][_0x89ba('0x4d')])['then'](function(){return _0x4e46c9;});}return _0x4e46c9;}})['then'](function(_0x39ca0f){if(!_0x39ca0f){throw new db[(_0x89ba('0x4e'))][(_0x89ba('0x5e'))](_0x89ba('0x76'));}_0x1ffef6=_0x39ca0f;return db[_0x89ba('0x77')][_0x89ba('0x75')]({'where':{'id':0x1}});})[_0x89ba('0x20')](handleEntityNotFound(_0x3995b3,null))[_0x89ba('0x20')](function(_0x250f42){if(_0x250f42){_0x893c41=_0x250f42;if(!_0x893c41[_0x89ba('0x78')]||!_0x893c41[_0x89ba('0x79')]||!_0x893c41[_0x89ba('0x7a')]||!_0x893c41[_0x89ba('0x7b')]||!_0x893c41['bucket']){throw new db['Sequelize'][(_0x89ba('0x5e'))](_0x89ba('0x7c'));}if(_0x1cb6dc['body'][_0x89ba('0x7d')]&&(!_0x893c41[_0x89ba('0x7e')]||!_0x893c41['sentimentAccountId']||!_0x893c41[_0x89ba('0x7f')]||!_0x893c41[_0x89ba('0x7b')]||!_0x893c41['bucket'])){throw new db[(_0x89ba('0x4e'))][(_0x89ba('0x5e'))](_0x89ba('0x80'));}return db[_0x89ba('0x81')][_0x89ba('0x75')]({'where':{'id':_0x893c41['transcribeAccountId']}});}})['then'](function(_0x18d325){if(!_0x18d325){throw new db[(_0x89ba('0x4e'))]['ValidationError'](_0x89ba('0x82'));}if(!_0x18d325[_0x89ba('0x83')]||!_0x18d325[_0x89ba('0x84')]){throw new db[(_0x89ba('0x4e'))][(_0x89ba('0x5e'))](_0x89ba('0x85'));}_0x269c6e=_0x18d325;return getBucketslist(_0x269c6e[_0x89ba('0x83')],_0x269c6e[_0x89ba('0x84')],_0x893c41['transcribeRegion']);})[_0x89ba('0x20')](function(_0x331536){if(_0x331536&&_0x331536[_0x89ba('0x86')]){var _0x126675=_[_0x89ba('0x44')](_0x331536['Buckets'],function(_0x551d0b){return _0x551d0b[_0x89ba('0x87')]===_0x893c41[_0x89ba('0x6e')];});if(!_0x126675){logger[_0x89ba('0x60')](util['format'](_0x89ba('0x88'),_0x1cb6dc['params']['id'],_0x893c41[_0x89ba('0x6e')]));return createBucket(_0x269c6e[_0x89ba('0x83')],_0x269c6e[_0x89ba('0x84')],_0x893c41[_0x89ba('0x7a')],_0x893c41[_0x89ba('0x6e')]);}logger[_0x89ba('0x60')](util[_0x89ba('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1cb6dc[_0x89ba('0x45')]['id'],_0x893c41[_0x89ba('0x6e')]));return;}})[_0x89ba('0x20')](function(_0x4a91ab){if(_0x1ffef6[_0x89ba('0x89')]===_0x89ba('0x8a')){return transcribe(_0x1cb6dc[_0x89ba('0x45')]['id'],_0x269c6e[_0x89ba('0x83')],_0x269c6e['data2'],_0x893c41['transcribeRegion'],_0x893c41['bucket'],_0x1ffef6[_0x89ba('0x49')],_0x893c41[_0x89ba('0x7b')]);}else{logger[_0x89ba('0x60')](util[_0x89ba('0x2d')](_0x89ba('0x8b'),_0x1cb6dc[_0x89ba('0x45')]['id']));return{'transcribeStatus':_0x89ba('0x8c')};}})[_0x89ba('0x20')](function(_0xceaab8){if(_0xceaab8){_0xceaab8['tempSentiment']=_0x1cb6dc[_0x89ba('0x42')]['runSentiment'];return _0x1ffef6[_0x89ba('0x8d')](_0xceaab8);}})[_0x89ba('0x20')](respondWithResult(_0x3995b3,null))[_0x89ba('0x3f')](handleError(_0x3995b3,null));};function writeFile(_0xd2dc4d,_0x1c37bb){return new Promise(function(_0x158b0b,_0x249ae3){fs['writeFile'](_0x1c37bb,_0xd2dc4d,function(_0x3a3f35,_0x54a4d7){if(_0x3a3f35){return _0x249ae3(_0x3a3f35);}else{return _0x158b0b(_0x54a4d7);}});});}exports[_0x89ba('0x8e')]=function(_0x28cddd,_0x2a667f,_0xe2fd42){return db['VoiceRecording'][_0x89ba('0x75')]({'where':{'id':_0x28cddd['params']['id']}})['then'](handleEntityNotFound(_0x2a667f))[_0x89ba('0x20')](function(_0x354f9d){if(_0x354f9d&&_0x354f9d[_0x89ba('0x8f')]){var _0x4da155=_0x354f9d[_0x89ba('0x8f')];var _0x30cba6=config[_0x89ba('0x90')]+_0x89ba('0x91')+_0x354f9d['id']+_0x89ba('0x92');if(fs[_0x89ba('0x4a')](_0x30cba6)){return _0x30cba6;}return writeFile(_0x4da155,_0x30cba6)['then'](function(){return _0x30cba6;});}else{throw new db[(_0x89ba('0x4e'))]['ValidationError'](_0x89ba('0x93'));}})[_0x89ba('0x20')](function(_0xc42b00){return _0x2a667f['download'](_0xc42b00);})[_0x89ba('0x3f')](handleError(_0x2a667f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 72b6253..a5a5caf 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 _0x4eba=['path','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','../../config/logger','api','moment','request-promise'];(function(_0x23332a,_0x31364e){var _0x4af782=function(_0x3feaf9){while(--_0x3feaf9){_0x23332a['push'](_0x23332a['shift']());}};_0x4af782(++_0x31364e);}(_0x4eba,0x1be));var _0xa4eb=function(_0x3f9f32,_0x208da4){_0x3f9f32=_0x3f9f32-0x0;var _0x1f23b6=_0x4eba[_0x3f9f32];return _0x1f23b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4eb('0x0'))(_0xa4eb('0x1'));var moment=require(_0xa4eb('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4eb('0x3'));var fs=require('fs');var path=require(_0xa4eb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa4eb('0x5'));module[_0xa4eb('0x6')]=function(_0x2bab44,_0x1b6cec){return _0x2bab44['define'](_0xa4eb('0x7'),attributes,{'tableName':_0xa4eb('0x8'),'paranoid':![],'indexes':[{'name':_0xa4eb('0x9'),'fields':[_0xa4eb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe530=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api'];(function(_0x559b98,_0x3d1925){var _0x2f5dd1=function(_0x43d7ca){while(--_0x43d7ca){_0x559b98['push'](_0x559b98['shift']());}};_0x2f5dd1(++_0x3d1925);}(_0xe530,0x155));var _0x0e53=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe530[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x0e53('0x0'));var util=require(_0x0e53('0x1'));var logger=require(_0x0e53('0x2'))(_0x0e53('0x3'));var moment=require(_0x0e53('0x4'));var BPromise=require(_0x0e53('0x5'));var rp=require(_0x0e53('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e53('0x7'));var config=require(_0x0e53('0x8'));var attributes=require(_0x0e53('0x9'));module[_0x0e53('0xa')]=function(_0x28f4c9,_0x5231dd){return _0x28f4c9[_0x0e53('0xb')](_0x0e53('0xc'),attributes,{'tableName':_0x0e53('0xd'),'paranoid':![],'indexes':[{'name':_0x0e53('0xe'),'fields':[_0x0e53('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2d5f0d5..cc52fd1 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x46b057,_0x25aa56){var _0x25cf84=function(_0x324ba6){while(--_0x324ba6){_0x46b057['push'](_0x46b057['shift']());}};_0x25cf84(++_0x25aa56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x46ce98,_0x52d764){var _0x172f46=function(_0x10ccee){while(--_0x10ccee){_0x46ce98['push'](_0x46ce98['shift']());}};_0x172f46(++_0x52d764);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b8f24a7..78f5da9 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 _0x4819=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2e1794,_0x44c23e){var _0xd9c647=function(_0x230705){while(--_0x230705){_0x2e1794['push'](_0x2e1794['shift']());}};_0xd9c647(++_0x44c23e);}(_0x4819,0xcd));var _0x9481=function(_0x361704,_0x3af61c){_0x361704=_0x361704-0x0;var _0x258953=_0x4819[_0x361704];return _0x258953;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')]('/',auth[_0x9481('0xb')](),controller[_0x9481('0xe')]);router['put'](_0x9481('0xf'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router['delete'](_0x9481('0xf'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);module[_0x9481('0x12')]=router; \ No newline at end of file +var _0x2675=['post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x3d8129,_0x509866){var _0x1c7e30=function(_0xdeda98){while(--_0xdeda98){_0x3d8129['push'](_0x3d8129['shift']());}};_0x1c7e30(++_0x509866);}(_0x2675,0x75));var _0x5267=function(_0x5ccac2,_0x310212){_0x5ccac2=_0x5ccac2-0x0;var _0x31467d=_0x2675[_0x5ccac2];return _0x31467d;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./voiceTransferReport.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x9')]('/',auth[_0x5267('0x6')](),controller['create']);router[_0x5267('0xa')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['destroy']);module[_0x5267('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 8783bea..cf436bb 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 _0x3344=['attended','STRING','sequelize','moment','ENUM','blind'];(function(_0x3fb560,_0x1e301f){var _0x4999b3=function(_0x4ad22e){while(--_0x4ad22e){_0x3fb560['push'](_0x3fb560['shift']());}};_0x4999b3(++_0x1e301f);}(_0x3344,0x170));var _0x4334=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3344[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4334('0x0'));var moment=require(_0x4334('0x1'));module['exports']={'type':{'type':Sequelize[_0x4334('0x2')](_0x4334('0x3'),_0x4334('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x4334('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x4334('0x5')]},'transferercalleridname':{'type':Sequelize[_0x4334('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4334('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x4334('0x5')]},'transferercontext':{'type':Sequelize[_0x4334('0x5')]},'transfererexten':{'type':Sequelize[_0x4334('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x4334('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x4334('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x4334('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4334('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x4334('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x4334('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x4334('0x5')]},'extension':{'type':Sequelize[_0x4334('0x5')]}}; \ No newline at end of file +var _0x2433=['Yes','sequelize','moment','exports','ENUM','STRING'];(function(_0x19c79e,_0x34c7d8){var _0x330958=function(_0x7bfbb5){while(--_0x7bfbb5){_0x19c79e['push'](_0x19c79e['shift']());}};_0x330958(++_0x34c7d8);}(_0x2433,0x15d));var _0x3243=function(_0x44facd,_0x3902f6){_0x44facd=_0x44facd-0x0;var _0x325bf5=_0x2433[_0x44facd];return _0x325bf5;};'use strict';var Sequelize=require(_0x3243('0x0'));var moment=require(_0x3243('0x1'));module[_0x3243('0x2')]={'type':{'type':Sequelize[_0x3243('0x3')]('blind','attended')},'result':{'type':Sequelize[_0x3243('0x4')]},'transfererchannel':{'type':Sequelize[_0x3243('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x3243('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3243('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x3243('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x3243('0x4')]},'transferercontext':{'type':Sequelize[_0x3243('0x4')]},'transfererexten':{'type':Sequelize[_0x3243('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x3243('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x3243('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x3243('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3243('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3243('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x3243('0x4')]},'transfereecontext':{'type':Sequelize[_0x3243('0x4')]},'transfereeexten':{'type':Sequelize[_0x3243('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x3243('0x4')]},'isexternal':{'type':Sequelize[_0x3243('0x3')](_0x3243('0x5'),'No')},'context':{'type':Sequelize[_0x3243('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 59591a6..916fdfc 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 _0x62ad=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','attributes'];(function(_0x483d2a,_0x4bffba){var _0x5ba5d5=function(_0x33e56a){while(--_0x33e56a){_0x483d2a['push'](_0x483d2a['shift']());}};_0x5ba5d5(++_0x4bffba);}(_0x62ad,0xb0));var _0xd62a=function(_0x315a80,_0x2a06f4){_0x315a80=_0x315a80-0x0;var _0x203b92=_0x62ad[_0x315a80];return _0x203b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd62a('0x0'));var rimraf=require(_0xd62a('0x1'));var zipdir=require(_0xd62a('0x2'));var jsonpatch=require(_0xd62a('0x3'));var rp=require(_0xd62a('0x4'));var moment=require(_0xd62a('0x5'));var BPromise=require(_0xd62a('0x6'));var Mustache=require(_0xd62a('0x7'));var util=require(_0xd62a('0x8'));var path=require(_0xd62a('0x9'));var sox=require(_0xd62a('0xa'));var csv=require(_0xd62a('0xb'));var ejs=require(_0xd62a('0xc'));var fs=require('fs');var _=require(_0xd62a('0xd'));var squel=require(_0xd62a('0xe'));var crypto=require(_0xd62a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd62a('0x10'));var toCsv=require(_0xd62a('0xb'));var querystring=require(_0xd62a('0x11'));var Papa=require(_0xd62a('0x12'));var Redis=require(_0xd62a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd62a('0x14'));var as=require(_0xd62a('0x15'));var hardwareService=require(_0xd62a('0x16'));var logger=require(_0xd62a('0x17'))(_0xd62a('0x18'));var utils=require(_0xd62a('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x157766,_0x784092){_0x784092=_0x784092||0xcc;return function(_0x571ee7){if(_0x571ee7){return _0x157766[_0xd62a('0x1a')](_0x784092);}return _0x157766['status'](_0x784092)[_0xd62a('0x1b')]();};}function respondWithResult(_0x5997b8,_0x258b22){_0x258b22=_0x258b22||0xc8;return function(_0x39e2be){if(_0x39e2be){return _0x5997b8[_0xd62a('0x1c')](_0x258b22)[_0xd62a('0x1d')](_0x39e2be);}};}function respondWithFilteredResult(_0x35abe1,_0x53b43d){return function(_0x2e26e1){if(_0x2e26e1){var _0x4212a6=_0x2e26e1[_0xd62a('0x1e')],_0x2a8a22=_0x53b43d[_0xd62a('0x1f')],_0x1fa728=_0x53b43d[_0xd62a('0x1f')]+_0x53b43d[_0xd62a('0x20')],_0x4f0dba;if(_0x1fa728>=_0x4212a6){_0x1fa728=_0x4212a6;_0x4f0dba=0xc8;}else{_0x4f0dba=0xce;}_0x35abe1['status'](_0x4f0dba);return _0x35abe1['set']('Content-Range',_0x2a8a22+'-'+_0x1fa728+'/'+_0x4212a6)[_0xd62a('0x1d')](_0x2e26e1);}return null;};}function patchUpdates(_0x5deb26){return function(_0x2233bb){try{jsonpatch[_0xd62a('0x21')](_0x2233bb,_0x5deb26,!![]);}catch(_0xa8bb42){return BPromise[_0xd62a('0x22')](_0xa8bb42);}return _0x2233bb[_0xd62a('0x23')]();};}function saveUpdates(_0x538539,_0x50e232){return function(_0x2534dc){if(_0x2534dc){return _0x2534dc[_0xd62a('0x24')](_0x538539)[_0xd62a('0x25')](function(_0x4328e4){return _0x4328e4;});}return null;};}function removeEntity(_0x4061ed,_0x4d302a){return function(_0x286dcd){if(_0x286dcd){return _0x286dcd[_0xd62a('0x26')]()[_0xd62a('0x25')](function(){_0x4061ed[_0xd62a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b706d,_0xfa420b){return function(_0x36c791){if(!_0x36c791){_0x1b706d[_0xd62a('0x1a')](0x194);}return _0x36c791;};}function handleError(_0x3a45ee,_0x5c5fb4){_0x5c5fb4=_0x5c5fb4||0x1f4;return function(_0x8059eb){logger['error'](_0x8059eb[_0xd62a('0x27')]);if(_0x8059eb[_0xd62a('0x28')]){delete _0x8059eb[_0xd62a('0x28')];}_0x3a45ee['status'](_0x5c5fb4)[_0xd62a('0x29')](_0x8059eb);};}exports[_0xd62a('0x2a')]=function(_0x5b87b0,_0x4bc0bf){var _0x57399f={},_0x5a4c22={},_0x404d73={'count':0x0,'rows':[]};var _0x3e4368=_[_0xd62a('0x2b')](db[_0xd62a('0x2c')]['rawAttributes'],function(_0x19d925){return{'name':_0x19d925[_0xd62a('0x2d')],'type':_0x19d925[_0xd62a('0x2e')][_0xd62a('0x2f')]};});_0x5a4c22[_0xd62a('0x30')]=_['map'](_0x3e4368,'name');_0x5a4c22[_0xd62a('0x31')]=_[_0xd62a('0x32')](_0x5b87b0[_0xd62a('0x31')]);_0x5a4c22['filters']=_['intersection'](_0x5a4c22[_0xd62a('0x30')],_0x5a4c22['query']);_0x57399f[_0xd62a('0x33')]=_[_0xd62a('0x34')](_0x5a4c22[_0xd62a('0x30')],qs['fields'](_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x35')]));_0x57399f['attributes']=_0x57399f[_0xd62a('0x33')][_0xd62a('0x36')]?_0x57399f[_0xd62a('0x33')]:_0x5a4c22[_0xd62a('0x30')];if(!_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x37')](_0xd62a('0x38'))){_0x57399f[_0xd62a('0x20')]=qs[_0xd62a('0x20')](_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x20')]);_0x57399f[_0xd62a('0x1f')]=qs[_0xd62a('0x1f')](_0x5b87b0[_0xd62a('0x31')]['offset']);}_0x57399f[_0xd62a('0x39')]=qs[_0xd62a('0x3a')](_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x3a')]);_0x57399f[_0xd62a('0x3b')]=qs[_0xd62a('0x3c')](_[_0xd62a('0x3d')](_0x5b87b0[_0xd62a('0x31')],_0x5a4c22['filters']),_0x3e4368);if(_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x3e')]){_0x57399f[_0xd62a('0x3b')]=_[_0xd62a('0x3f')](_0x57399f[_0xd62a('0x3b')],{'$or':_['map'](_0x3e4368,function(_0x399b36){if(_0x399b36[_0xd62a('0x2e')]!==_0xd62a('0x40')){var _0x1e6456={};_0x1e6456[_0x399b36[_0xd62a('0x28')]]={'$like':'%'+_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x3e')]+'%'};return _0x1e6456;}})});}_0x57399f=_[_0xd62a('0x3f')]({},_0x57399f,_0x5b87b0[_0xd62a('0x41')]);var _0x24a718={'where':_0x57399f['where']};return db[_0xd62a('0x2c')][_0xd62a('0x1e')](_0x24a718)[_0xd62a('0x25')](function(_0x3067d0){_0x404d73[_0xd62a('0x1e')]=_0x3067d0;if(_0x5b87b0[_0xd62a('0x31')][_0xd62a('0x42')]){_0x57399f[_0xd62a('0x43')]=[{'all':!![]}];}return db[_0xd62a('0x2c')][_0xd62a('0x44')](_0x57399f);})[_0xd62a('0x25')](function(_0x30b08d){_0x404d73['rows']=_0x30b08d;return _0x404d73;})[_0xd62a('0x25')](respondWithFilteredResult(_0x4bc0bf,_0x57399f))[_0xd62a('0x45')](handleError(_0x4bc0bf,null));};exports[_0xd62a('0x46')]=function(_0x451a79,_0x48678e){var _0x442f4d={'raw':!![],'where':{'id':_0x451a79['params']['id']}},_0x532bf6={};_0x532bf6[_0xd62a('0x30')]=_[_0xd62a('0x32')](db['VoiceTransferReport'][_0xd62a('0x47')]);_0x532bf6[_0xd62a('0x31')]=_['keys'](_0x451a79[_0xd62a('0x31')]);_0x532bf6[_0xd62a('0x3c')]=_[_0xd62a('0x34')](_0x532bf6[_0xd62a('0x30')],_0x532bf6[_0xd62a('0x31')]);_0x442f4d['attributes']=_[_0xd62a('0x34')](_0x532bf6[_0xd62a('0x30')],qs[_0xd62a('0x35')](_0x451a79[_0xd62a('0x31')][_0xd62a('0x35')]));_0x442f4d[_0xd62a('0x33')]=_0x442f4d['attributes'][_0xd62a('0x36')]?_0x442f4d['attributes']:_0x532bf6[_0xd62a('0x30')];if(_0x451a79[_0xd62a('0x31')][_0xd62a('0x42')]){_0x442f4d[_0xd62a('0x43')]=[{'all':!![]}];}_0x442f4d=_['merge']({},_0x442f4d,_0x451a79['options']);return db[_0xd62a('0x2c')]['find'](_0x442f4d)[_0xd62a('0x25')](handleEntityNotFound(_0x48678e,null))['then'](respondWithResult(_0x48678e,null))['catch'](handleError(_0x48678e,null));};exports[_0xd62a('0x48')]=function(_0x4666f8,_0x129fae){return db['VoiceTransferReport'][_0xd62a('0x48')](_0x4666f8[_0xd62a('0x49')],{})['then'](respondWithResult(_0x129fae,0xc9))[_0xd62a('0x45')](handleError(_0x129fae,null));};exports[_0xd62a('0x24')]=function(_0x38597b,_0x1bb70d){if(_0x38597b[_0xd62a('0x49')]['id']){delete _0x38597b[_0xd62a('0x49')]['id'];}return db[_0xd62a('0x2c')][_0xd62a('0x4a')]({'where':{'id':_0x38597b[_0xd62a('0x4b')]['id']}})[_0xd62a('0x25')](handleEntityNotFound(_0x1bb70d,null))[_0xd62a('0x25')](saveUpdates(_0x38597b[_0xd62a('0x49')],null))['then'](respondWithResult(_0x1bb70d,null))['catch'](handleError(_0x1bb70d,null));};exports[_0xd62a('0x26')]=function(_0x54eaaf,_0x32fddb){return db[_0xd62a('0x2c')][_0xd62a('0x4a')]({'where':{'id':_0x54eaaf[_0xd62a('0x4b')]['id']}})[_0xd62a('0x25')](handleEntityNotFound(_0x32fddb,null))[_0xd62a('0x25')](removeEntity(_0x32fddb,null))[_0xd62a('0x45')](handleError(_0x32fddb,null));}; \ No newline at end of file +var _0x9caf=['sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','moment','bluebird','mustache'];(function(_0x526fb1,_0x1d0359){var _0x33582f=function(_0x2df327){while(--_0x2df327){_0x526fb1['push'](_0x526fb1['shift']());}};_0x33582f(++_0x1d0359);}(_0x9caf,0x1a0));var _0xf9ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9caf[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf9ca('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf9ca('0x1'));var BPromise=require(_0xf9ca('0x2'));var Mustache=require(_0xf9ca('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf9ca('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf9ca('0x5'));var squel=require(_0xf9ca('0x6'));var crypto=require(_0xf9ca('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf9ca('0x8'));var querystring=require(_0xf9ca('0x9'));var Papa=require(_0xf9ca('0xa'));var Redis=require(_0xf9ca('0xb'));var authService=require(_0xf9ca('0xc'));var qs=require(_0xf9ca('0xd'));var as=require(_0xf9ca('0xe'));var hardwareService=require(_0xf9ca('0xf'));var logger=require('../../config/logger')(_0xf9ca('0x10'));var utils=require(_0xf9ca('0x11'));var config=require(_0xf9ca('0x12'));var db=require(_0xf9ca('0x13'))['db'];function respondWithStatusCode(_0x509568,_0x447c12){_0x447c12=_0x447c12||0xcc;return function(_0x134de6){if(_0x134de6){return _0x509568[_0xf9ca('0x14')](_0x447c12);}return _0x509568[_0xf9ca('0x15')](_0x447c12)[_0xf9ca('0x16')]();};}function respondWithResult(_0x4203ea,_0x3c8d72){_0x3c8d72=_0x3c8d72||0xc8;return function(_0x58b7f6){if(_0x58b7f6){return _0x4203ea[_0xf9ca('0x15')](_0x3c8d72)[_0xf9ca('0x17')](_0x58b7f6);}};}function respondWithFilteredResult(_0x5f071f,_0x25a4fb){return function(_0xdd30a8){if(_0xdd30a8){var _0x42e981=_0xdd30a8['count'],_0x45567c=_0x25a4fb['offset'],_0x345888=_0x25a4fb[_0xf9ca('0x18')]+_0x25a4fb[_0xf9ca('0x19')],_0x1be374;if(_0x345888>=_0x42e981){_0x345888=_0x42e981;_0x1be374=0xc8;}else{_0x1be374=0xce;}_0x5f071f[_0xf9ca('0x15')](_0x1be374);return _0x5f071f[_0xf9ca('0x1a')](_0xf9ca('0x1b'),_0x45567c+'-'+_0x345888+'/'+_0x42e981)[_0xf9ca('0x17')](_0xdd30a8);}return null;};}function patchUpdates(_0x5017e4){return function(_0xc6c8c){try{jsonpatch['apply'](_0xc6c8c,_0x5017e4,!![]);}catch(_0x7093e6){return BPromise['reject'](_0x7093e6);}return _0xc6c8c[_0xf9ca('0x1c')]();};}function saveUpdates(_0x4cef92,_0x211f93){return function(_0x14dd5f){if(_0x14dd5f){return _0x14dd5f[_0xf9ca('0x1d')](_0x4cef92)[_0xf9ca('0x1e')](function(_0x3558e8){return _0x3558e8;});}return null;};}function removeEntity(_0x103841,_0x1ae863){return function(_0x3f173e){if(_0x3f173e){return _0x3f173e[_0xf9ca('0x1f')]()[_0xf9ca('0x1e')](function(){_0x103841[_0xf9ca('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c2c5,_0x27ff3f){return function(_0x2de9c1){if(!_0x2de9c1){_0x14c2c5[_0xf9ca('0x14')](0x194);}return _0x2de9c1;};}function handleError(_0x18e27c,_0x234ef4){_0x234ef4=_0x234ef4||0x1f4;return function(_0x399626){logger[_0xf9ca('0x20')](_0x399626[_0xf9ca('0x21')]);if(_0x399626[_0xf9ca('0x22')]){delete _0x399626['name'];}_0x18e27c['status'](_0x234ef4)[_0xf9ca('0x23')](_0x399626);};}exports[_0xf9ca('0x24')]=function(_0x2be304,_0x135b46){var _0x586a04={},_0x4172d9={},_0x58dec9={'count':0x0,'rows':[]};var _0x2c2991=_[_0xf9ca('0x25')](db[_0xf9ca('0x26')][_0xf9ca('0x27')],function(_0x1f8f92){return{'name':_0x1f8f92[_0xf9ca('0x28')],'type':_0x1f8f92[_0xf9ca('0x29')][_0xf9ca('0x2a')]};});_0x4172d9['model']=_[_0xf9ca('0x25')](_0x2c2991,_0xf9ca('0x22'));_0x4172d9[_0xf9ca('0x2b')]=_['keys'](_0x2be304[_0xf9ca('0x2b')]);_0x4172d9['filters']=_[_0xf9ca('0x2c')](_0x4172d9[_0xf9ca('0x2d')],_0x4172d9[_0xf9ca('0x2b')]);_0x586a04[_0xf9ca('0x2e')]=_[_0xf9ca('0x2c')](_0x4172d9[_0xf9ca('0x2d')],qs[_0xf9ca('0x2f')](_0x2be304[_0xf9ca('0x2b')]['fields']));_0x586a04[_0xf9ca('0x2e')]=_0x586a04[_0xf9ca('0x2e')][_0xf9ca('0x30')]?_0x586a04[_0xf9ca('0x2e')]:_0x4172d9[_0xf9ca('0x2d')];if(!_0x2be304['query']['hasOwnProperty']('nolimit')){_0x586a04[_0xf9ca('0x19')]=qs[_0xf9ca('0x19')](_0x2be304[_0xf9ca('0x2b')]['limit']);_0x586a04[_0xf9ca('0x18')]=qs[_0xf9ca('0x18')](_0x2be304[_0xf9ca('0x2b')][_0xf9ca('0x18')]);}_0x586a04[_0xf9ca('0x31')]=qs[_0xf9ca('0x32')](_0x2be304[_0xf9ca('0x2b')][_0xf9ca('0x32')]);_0x586a04['where']=qs[_0xf9ca('0x33')](_[_0xf9ca('0x34')](_0x2be304[_0xf9ca('0x2b')],_0x4172d9[_0xf9ca('0x33')]),_0x2c2991);if(_0x2be304['query'][_0xf9ca('0x35')]){_0x586a04['where']=_[_0xf9ca('0x36')](_0x586a04[_0xf9ca('0x37')],{'$or':_['map'](_0x2c2991,function(_0x61bcf1){if(_0x61bcf1['type']!==_0xf9ca('0x38')){var _0x529081={};_0x529081[_0x61bcf1[_0xf9ca('0x22')]]={'$like':'%'+_0x2be304[_0xf9ca('0x2b')][_0xf9ca('0x35')]+'%'};return _0x529081;}})});}_0x586a04=_[_0xf9ca('0x36')]({},_0x586a04,_0x2be304[_0xf9ca('0x39')]);var _0x4bac34={'where':_0x586a04[_0xf9ca('0x37')]};return db[_0xf9ca('0x26')][_0xf9ca('0x3a')](_0x4bac34)[_0xf9ca('0x1e')](function(_0x316b81){_0x58dec9['count']=_0x316b81;if(_0x2be304[_0xf9ca('0x2b')][_0xf9ca('0x3b')]){_0x586a04[_0xf9ca('0x3c')]=[{'all':!![]}];}return db[_0xf9ca('0x26')][_0xf9ca('0x3d')](_0x586a04);})['then'](function(_0xd274b7){_0x58dec9[_0xf9ca('0x3e')]=_0xd274b7;return _0x58dec9;})[_0xf9ca('0x1e')](respondWithFilteredResult(_0x135b46,_0x586a04))[_0xf9ca('0x3f')](handleError(_0x135b46,null));};exports[_0xf9ca('0x40')]=function(_0x262d11,_0x211c3a){var _0x41d5f1={'raw':!![],'where':{'id':_0x262d11[_0xf9ca('0x41')]['id']}},_0x28067e={};_0x28067e[_0xf9ca('0x2d')]=_[_0xf9ca('0x42')](db[_0xf9ca('0x26')][_0xf9ca('0x27')]);_0x28067e[_0xf9ca('0x2b')]=_[_0xf9ca('0x42')](_0x262d11[_0xf9ca('0x2b')]);_0x28067e[_0xf9ca('0x33')]=_[_0xf9ca('0x2c')](_0x28067e[_0xf9ca('0x2d')],_0x28067e[_0xf9ca('0x2b')]);_0x41d5f1[_0xf9ca('0x2e')]=_[_0xf9ca('0x2c')](_0x28067e['model'],qs['fields'](_0x262d11[_0xf9ca('0x2b')][_0xf9ca('0x2f')]));_0x41d5f1['attributes']=_0x41d5f1['attributes'][_0xf9ca('0x30')]?_0x41d5f1[_0xf9ca('0x2e')]:_0x28067e['model'];if(_0x262d11[_0xf9ca('0x2b')][_0xf9ca('0x3b')]){_0x41d5f1[_0xf9ca('0x3c')]=[{'all':!![]}];}_0x41d5f1=_[_0xf9ca('0x36')]({},_0x41d5f1,_0x262d11[_0xf9ca('0x39')]);return db[_0xf9ca('0x26')][_0xf9ca('0x43')](_0x41d5f1)[_0xf9ca('0x1e')](handleEntityNotFound(_0x211c3a,null))['then'](respondWithResult(_0x211c3a,null))[_0xf9ca('0x3f')](handleError(_0x211c3a,null));};exports[_0xf9ca('0x44')]=function(_0x4a7646,_0x2a54ed){return db[_0xf9ca('0x26')][_0xf9ca('0x44')](_0x4a7646[_0xf9ca('0x45')],{})[_0xf9ca('0x1e')](respondWithResult(_0x2a54ed,0xc9))[_0xf9ca('0x3f')](handleError(_0x2a54ed,null));};exports[_0xf9ca('0x1d')]=function(_0x4823b9,_0x7c194b){if(_0x4823b9['body']['id']){delete _0x4823b9[_0xf9ca('0x45')]['id'];}return db[_0xf9ca('0x26')][_0xf9ca('0x43')]({'where':{'id':_0x4823b9[_0xf9ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x7c194b,null))[_0xf9ca('0x1e')](saveUpdates(_0x4823b9[_0xf9ca('0x45')],null))['then'](respondWithResult(_0x7c194b,null))['catch'](handleError(_0x7c194b,null));};exports[_0xf9ca('0x1f')]=function(_0x347c93,_0x45583a){return db['VoiceTransferReport'][_0xf9ca('0x43')]({'where':{'id':_0x347c93[_0xf9ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x45583a,null))[_0xf9ca('0x1e')](removeEntity(_0x45583a,null))[_0xf9ca('0x3f')](handleError(_0x45583a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 3097860..5a5f106 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 _0xa1cc=['report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports'];(function(_0xd44ca5,_0x2227e1){var _0x431d8c=function(_0x1851c9){while(--_0x1851c9){_0xd44ca5['push'](_0xd44ca5['shift']());}};_0x431d8c(++_0x2227e1);}(_0xa1cc,0x10f));var _0xca1c=function(_0x339094,_0x3ffb36){_0x339094=_0x339094-0x0;var _0x3d5884=_0xa1cc[_0x339094];return _0x3d5884;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var logger=require(_0xca1c('0x2'))('api');var moment=require(_0xca1c('0x3'));var BPromise=require(_0xca1c('0x4'));var rp=require(_0xca1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca1c('0x6'));var config=require('../../config/environment');var attributes=require(_0xca1c('0x7'));module[_0xca1c('0x8')]=function(_0x375837,_0x98dd5f){return _0x375837['define']('VoiceTransferReport',attributes,{'tableName':_0xca1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfeb=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment'];(function(_0xea2b73,_0x58f682){var _0x19bac0=function(_0x503dc3){while(--_0x503dc3){_0xea2b73['push'](_0xea2b73['shift']());}};_0x19bac0(++_0x58f682);}(_0xbfeb,0x1c3));var _0xbbfe=function(_0x4bdd89,_0x48abde){_0x4bdd89=_0x4bdd89-0x0;var _0x2aad77=_0xbfeb[_0x4bdd89];return _0x2aad77;};'use strict';var _=require('lodash');var util=require(_0xbbfe('0x0'));var logger=require(_0xbbfe('0x1'))(_0xbbfe('0x2'));var moment=require(_0xbbfe('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbfe('0x4'));var fs=require('fs');var path=require(_0xbbfe('0x5'));var rimraf=require(_0xbbfe('0x6'));var config=require(_0xbbfe('0x7'));var attributes=require(_0xbbfe('0x8'));module[_0xbbfe('0x9')]=function(_0x713fdd,_0x18db08){return _0x713fdd[_0xbbfe('0xa')](_0xbbfe('0xb'),attributes,{'tableName':_0xbbfe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 076dda9..0ceb332 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 _0x867c=['../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x867c,0x84));var _0xc867=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x867c[_0x37756b];return _0x46efec;};'use strict';var _=require(_0xc867('0x0'));var util=require(_0xc867('0x1'));var moment=require(_0xc867('0x2'));var BPromise=require(_0xc867('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc867('0x4'))['db'];var utils=require(_0xc867('0x5'));var logger=require(_0xc867('0x6'))(_0xc867('0x7'));var config=require(_0xc867('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc867('0x9')][_0xc867('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372132,_0x567960,_0x123c90){return new BPromise(function(_0x339e5d,_0x42deae){return client[_0xc867('0xb')](_0x372132,_0x123c90)[_0xc867('0xc')](function(_0x197ba7){logger[_0xc867('0xd')](_0xc867('0xe'),_0x567960,'request\x20sent');logger[_0xc867('0xf')](_0xc867('0x10'),_0x567960,_0xc867('0x11'),JSON[_0xc867('0x12')](_0x197ba7));if(_0x197ba7['error']){if(_0x197ba7['error'][_0xc867('0x13')]===0x1f4){logger[_0xc867('0x14')](_0xc867('0xe'),_0x567960,_0x197ba7[_0xc867('0x14')][_0xc867('0x15')]);return _0x42deae(_0x197ba7[_0xc867('0x14')][_0xc867('0x15')]);}logger['error'](_0xc867('0xe'),_0x567960,_0x197ba7[_0xc867('0x14')][_0xc867('0x15')]);return _0x339e5d(_0x197ba7[_0xc867('0x14')][_0xc867('0x15')]);}else{logger[_0xc867('0xd')](_0xc867('0xe'),_0x567960,'request\x20sent');_0x339e5d(_0x197ba7['result'][_0xc867('0x15')]);}})[_0xc867('0x16')](function(_0x31ad42){logger[_0xc867('0x14')](_0xc867('0xe'),_0x567960,_0x31ad42);_0x42deae(_0x31ad42);});});}exports[_0xc867('0x17')]=function(_0xc81eba){var _0xd18979=this;return new Promise(function(_0x127455,_0x2a77da){return db['VoiceTransferReport'][_0xc867('0x18')](_0xc81eba[_0xc867('0x19')],{'raw':_0xc81eba[_0xc867('0x1a')]?_0xc81eba[_0xc867('0x1a')][_0xc867('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x35e3b7){logger['info']('CreateVoiceTransferReport',_0xc81eba);logger[_0xc867('0xf')]('CreateVoiceTransferReport',_0xc81eba,JSON['stringify'](_0x35e3b7));_0x127455(_0x35e3b7);})[_0xc867('0x16')](function(_0x1bf805){logger['error'](_0xc867('0x17'),_0x1bf805[_0xc867('0x15')],_0xc81eba);_0x2a77da(_0xd18979[_0xc867('0x14')](0x1f4,_0x1bf805[_0xc867('0x15')]));});});}; \ No newline at end of file +var _0x9155=['catch','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x292ecc,_0x2ed340){var _0x59aabc=function(_0x35aa5a){while(--_0x35aa5a){_0x292ecc['push'](_0x292ecc['shift']());}};_0x59aabc(++_0x2ed340);}(_0x9155,0x1ab));var _0x5915=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x9155[_0x134d5e];return _0x1e166a;};'use strict';var _=require('lodash');var util=require(_0x5915('0x0'));var moment=require(_0x5915('0x1'));var BPromise=require(_0x5915('0x2'));var rs=require(_0x5915('0x3'));var fs=require('fs');var Redis=require(_0x5915('0x4'));var db=require(_0x5915('0x5'))['db'];var utils=require(_0x5915('0x6'));var logger=require(_0x5915('0x7'))(_0x5915('0x8'));var config=require('../../config/environment');var jayson=require(_0x5915('0x9'));var client=jayson['client'][_0x5915('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38603c,_0x368b70,_0x4be4c4){return new BPromise(function(_0x19e1a4,_0x5620ec){return client[_0x5915('0xb')](_0x38603c,_0x4be4c4)[_0x5915('0xc')](function(_0x335863){logger[_0x5915('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x368b70,_0x5915('0xe'));logger['debug'](_0x5915('0xf'),_0x368b70,_0x5915('0xe'),JSON[_0x5915('0x10')](_0x335863));if(_0x335863[_0x5915('0x11')]){if(_0x335863[_0x5915('0x11')][_0x5915('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x368b70,_0x335863['error']['message']);return _0x5620ec(_0x335863[_0x5915('0x11')][_0x5915('0x13')]);}logger[_0x5915('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x368b70,_0x335863['error'][_0x5915('0x13')]);return _0x19e1a4(_0x335863[_0x5915('0x11')][_0x5915('0x13')]);}else{logger[_0x5915('0xd')](_0x5915('0x14'),_0x368b70,_0x5915('0xe'));_0x19e1a4(_0x335863['result']['message']);}})[_0x5915('0x15')](function(_0x2b211f){logger[_0x5915('0x11')](_0x5915('0x14'),_0x368b70,_0x2b211f);_0x5620ec(_0x2b211f);});});}exports['CreateVoiceTransferReport']=function(_0x21b898){var _0x18593a=this;return new Promise(function(_0x59ff87,_0x40f6e0){return db[_0x5915('0x16')][_0x5915('0x17')](_0x21b898[_0x5915('0x18')],{'raw':_0x21b898[_0x5915('0x19')]?_0x21b898['options']['raw']===undefined?!![]:![]:!![]})[_0x5915('0xc')](function(_0x4a456d){logger[_0x5915('0xd')](_0x5915('0x1a'),_0x21b898);logger[_0x5915('0x1b')]('CreateVoiceTransferReport',_0x21b898,JSON[_0x5915('0x10')](_0x4a456d));_0x59ff87(_0x4a456d);})['catch'](function(_0x379430){logger[_0x5915('0x11')](_0x5915('0x1a'),_0x379430[_0x5915('0x13')],_0x21b898);_0x40f6e0(_0x18593a[_0x5915('0x11')](0x1f4,_0x379430[_0x5915('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 96d4080..5d295f2 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 _0xad95=['canUpdate','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports','express','Router','../../components/auth/service','/originate','isAuthenticated','post','/answer'];(function(_0xc0e2fc,_0x39da5c){var _0x5ea9d3=function(_0x29d136){while(--_0x29d136){_0xc0e2fc['push'](_0xc0e2fc['shift']());}};_0x5ea9d3(++_0x39da5c);}(_0xad95,0x70));var _0x5ad9=function(_0x1595b5,_0x3acb8e){_0x1595b5=_0x1595b5-0x0;var _0x3f86fa=_0xad95[_0x1595b5];return _0x3f86fa;};'use strict';var express=require(_0x5ad9('0x0'));var router=express[_0x5ad9('0x1')]();var auth=require(_0x5ad9('0x2'));var controller=require('./webbar.controller');router['post'](_0x5ad9('0x3'),auth[_0x5ad9('0x4')](),auth['canUpdate'](),controller['originate']);router[_0x5ad9('0x5')]('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0x5ad9('0x5')](_0x5ad9('0x6'),auth[_0x5ad9('0x4')](),auth[_0x5ad9('0x7')](),controller[_0x5ad9('0x8')]);router['post'](_0x5ad9('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x5ad9('0xa')]);router[_0x5ad9('0x5')](_0x5ad9('0xb'),auth['isAuthenticated'](),auth[_0x5ad9('0x7')](),controller[_0x5ad9('0xc')]);router['post'](_0x5ad9('0xd'),auth[_0x5ad9('0x4')](),auth[_0x5ad9('0x7')](),controller[_0x5ad9('0xe')]);router[_0x5ad9('0x5')](_0x5ad9('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller['transfer']);module[_0x5ad9('0x10')]=router; \ No newline at end of file +var _0x777f=['./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x777f,0x9f));var _0xf777=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x777f[_0x576e2b];return _0x46461a;};'use strict';var express=require(_0xf777('0x0'));var router=express[_0xf777('0x1')]();var auth=require(_0xf777('0x2'));var controller=require(_0xf777('0x3'));router[_0xf777('0x4')](_0xf777('0x5'),auth[_0xf777('0x6')](),auth[_0xf777('0x7')](),controller['originate']);router[_0xf777('0x4')](_0xf777('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0xf777('0x4')](_0xf777('0x9'),auth[_0xf777('0x6')](),auth[_0xf777('0x7')](),controller[_0xf777('0xa')]);router[_0xf777('0x4')](_0xf777('0xb'),auth[_0xf777('0x6')](),auth['canUpdate'](),controller['hold']);router['post'](_0xf777('0xc'),auth[_0xf777('0x6')](),auth['canUpdate'](),controller[_0xf777('0xd')]);router[_0xf777('0x4')](_0xf777('0xe'),auth['isAuthenticated'](),auth[_0xf777('0x7')](),controller[_0xf777('0xf')]);router[_0xf777('0x4')](_0xf777('0x10'),auth[_0xf777('0x6')](),auth[_0xf777('0x7')](),controller[_0xf777('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fdeeff6..33d84dd 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 _0xb3ea=['message','catch','User','agent','VoiceChannels','then','filter','rows','UserId','sessionId\x20','originate','originate\x20fired:','body','validate','length','json','userId','callNumber','callbackUrl','info','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','code'];(function(_0x25a5ee,_0x54d5de){var _0x18593f=function(_0x150331){while(--_0x150331){_0x25a5ee['push'](_0x25a5ee['shift']());}};_0x18593f(++_0x54d5de);}(_0xb3ea,0x10d));var _0xab3e=function(_0x5f51cb,_0x556260){_0x5f51cb=_0x5f51cb-0x0;var _0x19ba69=_0xb3ea[_0x5f51cb];return _0x19ba69;};'use strict';var path=require(_0xab3e('0x0'));var fs=require('fs');var _=require(_0xab3e('0x1'));var db=require(_0xab3e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xab3e('0x3'));var BPromise=require('bluebird');var jayson=require(_0xab3e('0x4'));var amiClient=jayson['client'][_0xab3e('0x5')]({'port':0x232a});var logger=require(_0xab3e('0x6'))(_0xab3e('0x7'));var Redis=require(_0xab3e('0x8'));config[_0xab3e('0x9')]=_['defaults'](config[_0xab3e('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xab3e('0xa'))(new Redis(config[_0xab3e('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xab3e('0xb'),'required':[!![],_0xab3e('0xc')]},'callNumber':{'type':'string','required':[!![],_0xab3e('0xd')]},'callerId':{'type':_0xab3e('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xab3e('0xc')]},'sessionId':{'type':_0xab3e('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xab3e('0xb'),'required':[!![],_0xab3e('0xc')]},'sessionId':{'type':_0xab3e('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xab3e('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xab3e('0xe'),'required':[!![],_0xab3e('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xab3e('0xb'),'required':[!![],_0xab3e('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xab3e('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xab3e('0xb'),'required':[!![],_0xab3e('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xab3e('0xc')]}});function emit(_0x161ff9,_0x5aad51,_0xcf080c){logger['info'](_0x161ff9,_0x5aad51,JSON[_0xab3e('0x10')](_0xcf080c));io['to'](_0x161ff9)['emit'](_0x5aad51,_0xcf080c);}function handleError(_0x5594f1){return function(_0xdfe0e){console[_0xab3e('0x11')](_0xab3e('0x12'),_0xdfe0e,_0xdfe0e instanceof RangeError);logger[_0xab3e('0x13')](_0xdfe0e[_0xab3e('0x14')]);if(_0xdfe0e instanceof RangeError){if(_0xdfe0e[_0xab3e('0x15')]){delete _0xdfe0e['name'];}_0x5594f1[_0xab3e('0x16')](0x194)[_0xab3e('0x17')](_0xdfe0e);}else{if(_0xdfe0e[_0xab3e('0x15')]){delete _0xdfe0e['name'];}_0x5594f1[_0xab3e('0x16')](0x1f4)[_0xab3e('0x17')](_0xdfe0e);}};}function checkError(){return function(_0xf9a898){if(!_0xf9a898){throw new RangeError(_0xab3e('0x18'));}return _0xf9a898;};}function respondWithRpcPromise(_0x13ffd3,_0x106307){return new BPromise(function(_0x39ae19,_0x3c9666){var _0x8086aa=amiClient;return _0x8086aa[_0xab3e('0x19')](_0x13ffd3,_0x106307)['then'](function(_0x49bdad){if(_0x49bdad['error']){if(_0x49bdad[_0xab3e('0x13')][_0xab3e('0x1a')]===0x1f4){return _0x3c9666(_0x49bdad['error']['message']);}return _0x39ae19(_0x49bdad['error'][_0xab3e('0x1b')]);}else{_0x39ae19(_0x49bdad['result']);}})[_0xab3e('0x1c')](function(_0x5f34bf){_0x3c9666(_0x5f34bf);});});}function getAgent(_0x324e20){return db[_0xab3e('0x1d')]['findOne']({'where':{'id':_0x324e20,'role':_0xab3e('0x1e')}})['then'](checkError());}function getAgentCheckSession(_0x3de38e,_0x21408c){return new BPromise(function(_0x3e0254,_0x460a25){var _0x3a727d=respondWithRpcPromise(_0xab3e('0x1f'));var _0x2c9111=getAgent(_0x3de38e);Promise['all']([_0x3a727d,_0x2c9111])[_0xab3e('0x20')](function(_0x287dbd){var _0x41bb99=_0x287dbd[0x0];var _0x37ea06=_0x287dbd[0x1];var _0x5c771a=_[_0xab3e('0x21')](_0x41bb99[_0xab3e('0x22')],function(_0x5d201c){return _0x5d201c[_0xab3e('0x23')]==_0x37ea06['id']&&_0x5d201c['sessionId']==_0x21408c;});if(_0x5c771a['length']==0x1){_0x3e0254(_0x37ea06);}else{_0x460a25(new RangeError(_0xab3e('0x24')+_0x21408c+'\x20not\x20found!'));}});});}exports[_0xab3e('0x25')]=function(_0x1dd02e,_0x16833b){logger['info'](_0xab3e('0x26'),_0x1dd02e[_0xab3e('0x27')]);var _0x16305e=originateValidation[_0xab3e('0x28')](_0x1dd02e[_0xab3e('0x27')]);if(_0x16305e[_0xab3e('0x29')]>0x0){return _0x16833b[_0xab3e('0x16')](0x190)[_0xab3e('0x2a')](_0x16305e);}var _0x373c2a=_0x1dd02e[_0xab3e('0x27')][_0xab3e('0x2b')];var _0x56bd44=_0x1dd02e[_0xab3e('0x27')][_0xab3e('0x2c')];var _0x5cc79c=_0x1dd02e[_0xab3e('0x27')]['callerId'];var _0x204ff5=_0x1dd02e[_0xab3e('0x27')][_0xab3e('0x2d')];return getAgent(_0x373c2a)[_0xab3e('0x20')](function(_0x2a36cc){logger[_0xab3e('0x2e')](_0xab3e('0x2f'),_0x2a36cc[_0xab3e('0x15')]);emit(util[_0xab3e('0x30')](_0xab3e('0x31'),_0x2a36cc['name']),'webbar:originate',{'callNumber':_0x56bd44,'callerId':_0x5cc79c,'callbackUrl':_0x204ff5});return _0x16833b[_0xab3e('0x16')](0xc8)[_0xab3e('0x2a')]({'error':![],'message':_0xab3e('0x32')});})[_0xab3e('0x1c')](handleError(_0x16833b));};exports[_0xab3e('0x33')]=function(_0xd80b03,_0x1f0397){logger['info'](_0xab3e('0x34'),_0xd80b03[_0xab3e('0x27')]);var _0x103cce=hangupValidation[_0xab3e('0x28')](_0xd80b03['body']);if(_0x103cce[_0xab3e('0x29')]>0x0){return _0x1f0397['status'](0x190)[_0xab3e('0x2a')](_0x103cce);}var _0x1346b1=_0xd80b03[_0xab3e('0x27')][_0xab3e('0x2b')];var _0x43e63b=_0xd80b03[_0xab3e('0x27')][_0xab3e('0x35')];return getAgent(_0x1346b1)[_0xab3e('0x20')](function(_0xc3437){logger[_0xab3e('0x2e')]('entityFound:',_0xc3437[_0xab3e('0x15')]);emit(util['format'](_0xab3e('0x31'),_0xc3437[_0xab3e('0x15')]),'webbar:hangup',{'sessionId':_0x43e63b});return _0x1f0397['status'](0xc8)[_0xab3e('0x2a')]({'error':![],'message':_0xab3e('0x36')});})[_0xab3e('0x1c')](handleError(_0x1f0397));};exports[_0xab3e('0x37')]=function(_0xaeed7e,_0x25d0e){logger['info'](_0xab3e('0x38'),_0xaeed7e[_0xab3e('0x27')]);var _0x4ac0bf=answerValidation[_0xab3e('0x28')](_0xaeed7e['body']);if(_0x4ac0bf[_0xab3e('0x29')]>0x0){return _0x25d0e[_0xab3e('0x16')](0x190)['json'](_0x4ac0bf);}var _0x57808d=_0xaeed7e[_0xab3e('0x27')]['userId'];var _0x3b3bd7=_0xaeed7e[_0xab3e('0x27')][_0xab3e('0x35')];return getAgent(_0x57808d)['then'](function(_0x13d7e7){logger[_0xab3e('0x2e')](_0xab3e('0x2f'),_0x13d7e7[_0xab3e('0x15')]);emit(util[_0xab3e('0x30')](_0xab3e('0x31'),_0x13d7e7[_0xab3e('0x15')]),_0xab3e('0x39'),{'sessionId':_0x3b3bd7});return _0x25d0e[_0xab3e('0x16')](0xc8)[_0xab3e('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0xab3e('0x1c')](handleError(_0x25d0e));};exports['hold']=function(_0x4e1702,_0x1491fc){logger['info'](_0xab3e('0x3a'),_0x4e1702[_0xab3e('0x27')]);var _0x1570f9=holdValidation['validate'](_0x4e1702['body']);if(_0x1570f9['length']>0x0){return _0x1491fc[_0xab3e('0x16')](0x190)[_0xab3e('0x2a')](_0x1570f9);}var _0x4934b6=_0x4e1702[_0xab3e('0x27')]['userId'];var _0x47166b=_0x4e1702[_0xab3e('0x27')][_0xab3e('0x35')];return getAgent(_0x4934b6)[_0xab3e('0x20')](function(_0x32d302){logger[_0xab3e('0x2e')](_0xab3e('0x2f'),_0x32d302[_0xab3e('0x15')]);emit(util[_0xab3e('0x30')]('user:%s',_0x32d302[_0xab3e('0x15')]),'webbar:hold',{'sessionId':_0x47166b});return _0x1491fc[_0xab3e('0x16')](0xc8)['json']({'error':![],'message':_0xab3e('0x3b')});})['catch'](handleError(_0x1491fc));};exports[_0xab3e('0x3c')]=function(_0x26144f,_0x2dd561){logger['info'](_0xab3e('0x3d'),_0x26144f[_0xab3e('0x27')]);var _0x398081=unholdValidation['validate'](_0x26144f[_0xab3e('0x27')]);if(_0x398081[_0xab3e('0x29')]>0x0){return _0x2dd561['status'](0x190)[_0xab3e('0x2a')](_0x398081);}var _0x453d2b=_0x26144f[_0xab3e('0x27')][_0xab3e('0x2b')];var _0x1b8a66=_0x26144f['body']['sessionId'];return getAgent(_0x453d2b)[_0xab3e('0x20')](function(_0x3987d3){logger['info']('entityFound:',_0x3987d3[_0xab3e('0x15')]);emit(util[_0xab3e('0x30')]('user:%s',_0x3987d3[_0xab3e('0x15')]),'webbar:unhold',{'sessionId':_0x1b8a66});return _0x2dd561[_0xab3e('0x16')](0xc8)[_0xab3e('0x2a')]({'error':![],'message':_0xab3e('0x3e')});})[_0xab3e('0x1c')](handleError(_0x2dd561));};exports[_0xab3e('0x3f')]=function(_0x4eb5cf,_0x14a845){logger['info'](_0xab3e('0x40'),_0x14a845['body']);var _0x49d67f=callsValidation[_0xab3e('0x28')](_0x4eb5cf[_0xab3e('0x27')]);if(_0x49d67f[_0xab3e('0x29')]>0x0){return _0x14a845[_0xab3e('0x16')](0x190)[_0xab3e('0x2a')](_0x49d67f);}var _0x35d998=_0x4eb5cf[_0xab3e('0x27')][_0xab3e('0x2b')];var _0x1f77ec=respondWithRpcPromise('VoiceChannels');var _0x979b12=getAgent(_0x35d998);return Promise[_0xab3e('0x41')]([_0x1f77ec,_0x979b12])[_0xab3e('0x20')](function(_0x114476){var _0x2b51b3=_0x114476[0x0];var _0x55edc3=_0x114476[0x1];var _0x16a436=_[_0xab3e('0x21')](_0x2b51b3[_0xab3e('0x22')],function(_0x3a5e8f){return _0x3a5e8f[_0xab3e('0x23')]==_0x55edc3['id'];});return _0x14a845[_0xab3e('0x16')](0xc8)['json']({'count':_0x16a436['length'],'rows':_0x16a436});})['catch'](handleError(_0x14a845));};exports[_0xab3e('0x42')]=function(_0xcfe032,_0x1805be){logger['info'](_0xab3e('0x43'),_0xcfe032[_0xab3e('0x27')]);var _0x4936c2=conferenceValidation[_0xab3e('0x28')](_0xcfe032[_0xab3e('0x27')]);if(_0x4936c2[_0xab3e('0x29')]>0x0){return _0x1805be[_0xab3e('0x16')](0x190)[_0xab3e('0x2a')](_0x4936c2);}var _0x4b823d=_0xcfe032[_0xab3e('0x27')][_0xab3e('0x2b')];return getAgent(_0x4b823d)[_0xab3e('0x20')](function(_0x334cb8){logger[_0xab3e('0x2e')]('entityFound:',_0x334cb8['name']);emit(util['format']('user:%s',_0x334cb8[_0xab3e('0x15')]),_0xab3e('0x44'));return _0x1805be['status'](0xc8)[_0xab3e('0x2a')]({'error':![],'message':_0xab3e('0x45')});})[_0xab3e('0x1c')](handleError(_0x1805be));};exports[_0xab3e('0x46')]=function(_0x455d80,_0x1ced4f){logger[_0xab3e('0x2e')]('transfer\x20fired:',_0x455d80[_0xab3e('0x27')]);var _0x73f558=transferValidation[_0xab3e('0x28')](_0x455d80[_0xab3e('0x27')]);if(_0x73f558['length']>0x0){return _0x1ced4f[_0xab3e('0x16')](0x190)['json'](_0x73f558);}var _0x4e97d3=_0x455d80[_0xab3e('0x27')][_0xab3e('0x2b')];var _0x13b877=_0x455d80[_0xab3e('0x27')][_0xab3e('0x35')];var _0x3df82e=_0x455d80['body'][_0xab3e('0x47')];return getAgent(_0x4e97d3)[_0xab3e('0x20')](function(_0x28e7b1){logger['info'](_0xab3e('0x2f'),_0x28e7b1[_0xab3e('0x15')]);emit(util[_0xab3e('0x30')](_0xab3e('0x31'),_0x28e7b1[_0xab3e('0x15')]),_0xab3e('0x48'),{'sessionId':_0x13b877,'transferNumber':_0x3df82e});return _0x1ced4f[_0xab3e('0x16')](0xc8)[_0xab3e('0x2a')]({'error':![],'message':_0xab3e('0x49')});})[_0xab3e('0x1c')](handleError(_0x1ced4f));}; \ No newline at end of file +var _0x5645=['catch','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','string','info','emit','log','handleError:','error','stack','name','status','send','request','code','message','result'];(function(_0x463ddd,_0x203494){var _0x2618a0=function(_0x14c3b1){while(--_0x14c3b1){_0x463ddd['push'](_0x463ddd['shift']());}};_0x2618a0(++_0x203494);}(_0x5645,0x19e));var _0x5564=function(_0x21ab42,_0x8ab09a){_0x21ab42=_0x21ab42-0x0;var _0x4f6351=_0x5645[_0x21ab42];return _0x4f6351;};'use strict';var path=require(_0x5564('0x0'));var fs=require('fs');var _=require(_0x5564('0x1'));var db=require(_0x5564('0x2'))['db'];var config=require(_0x5564('0x3'));var util=require(_0x5564('0x4'));var BPromise=require('bluebird');var jayson=require(_0x5564('0x5'));var amiClient=jayson[_0x5564('0x6')][_0x5564('0x7')]({'port':0x232a});var logger=require(_0x5564('0x8'))(_0x5564('0x9'));var Redis=require(_0x5564('0xa'));config[_0x5564('0xb')]=_[_0x5564('0xc')](config[_0x5564('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5564('0xb')]));var Schema=require(_0x5564('0xd'));var originateValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],_0x5564('0xf')]},'callNumber':{'type':_0x5564('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5564('0x10')},'callbackUrl':{'type':_0x5564('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5564('0xf')]},'sessionId':{'type':_0x5564('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],_0x5564('0xf')]},'sessionId':{'type':_0x5564('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],_0x5564('0xf')]},'sessionId':{'type':_0x5564('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x5564('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],_0x5564('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],_0x5564('0xf')]},'sessionId':{'type':_0x5564('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],_0x5564('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5564('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x190d8e,_0x30f3fa,_0x12285c){logger[_0x5564('0x11')](_0x190d8e,_0x30f3fa,JSON['stringify'](_0x12285c));io['to'](_0x190d8e)[_0x5564('0x12')](_0x30f3fa,_0x12285c);}function handleError(_0x39ce17){return function(_0x2f4761){console[_0x5564('0x13')](_0x5564('0x14'),_0x2f4761,_0x2f4761 instanceof RangeError);logger[_0x5564('0x15')](_0x2f4761[_0x5564('0x16')]);if(_0x2f4761 instanceof RangeError){if(_0x2f4761[_0x5564('0x17')]){delete _0x2f4761[_0x5564('0x17')];}_0x39ce17[_0x5564('0x18')](0x194)[_0x5564('0x19')](_0x2f4761);}else{if(_0x2f4761[_0x5564('0x17')]){delete _0x2f4761[_0x5564('0x17')];}_0x39ce17['status'](0x1f4)[_0x5564('0x19')](_0x2f4761);}};}function checkError(){return function(_0x3a34e6){if(!_0x3a34e6){throw new RangeError('NotFound');}return _0x3a34e6;};}function respondWithRpcPromise(_0x2cd0ae,_0xa7583){return new BPromise(function(_0x537842,_0x15328b){var _0x40f145=amiClient;return _0x40f145[_0x5564('0x1a')](_0x2cd0ae,_0xa7583)['then'](function(_0x364b6f){if(_0x364b6f[_0x5564('0x15')]){if(_0x364b6f[_0x5564('0x15')][_0x5564('0x1b')]===0x1f4){return _0x15328b(_0x364b6f[_0x5564('0x15')][_0x5564('0x1c')]);}return _0x537842(_0x364b6f[_0x5564('0x15')][_0x5564('0x1c')]);}else{_0x537842(_0x364b6f[_0x5564('0x1d')]);}})[_0x5564('0x1e')](function(_0x1a8a00){_0x15328b(_0x1a8a00);});});}function getAgent(_0x2aa2b0){return db['User'][_0x5564('0x1f')]({'where':{'id':_0x2aa2b0,'role':_0x5564('0x20')}})[_0x5564('0x21')](checkError());}function getAgentCheckSession(_0x50d02e,_0x3aaea9){return new BPromise(function(_0x8ad073,_0x3126fc){var _0x4c391f=respondWithRpcPromise(_0x5564('0x22'));var _0xee6731=getAgent(_0x50d02e);Promise[_0x5564('0x23')]([_0x4c391f,_0xee6731])[_0x5564('0x21')](function(_0x5c35e4){var _0x140c36=_0x5c35e4[0x0];var _0x5540cc=_0x5c35e4[0x1];var _0x1ea93e=_[_0x5564('0x24')](_0x140c36[_0x5564('0x25')],function(_0x5c197f){return _0x5c197f[_0x5564('0x26')]==_0x5540cc['id']&&_0x5c197f[_0x5564('0x27')]==_0x3aaea9;});if(_0x1ea93e[_0x5564('0x28')]==0x1){_0x8ad073(_0x5540cc);}else{_0x3126fc(new RangeError(_0x5564('0x29')+_0x3aaea9+'\x20not\x20found!'));}});});}exports[_0x5564('0x2a')]=function(_0x262d89,_0x3fb210){logger['info'](_0x5564('0x2b'),_0x262d89[_0x5564('0x2c')]);var _0xdb029=originateValidation[_0x5564('0xd')](_0x262d89[_0x5564('0x2c')]);if(_0xdb029[_0x5564('0x28')]>0x0){return _0x3fb210['status'](0x190)[_0x5564('0x2d')](_0xdb029);}var _0x222097=_0x262d89[_0x5564('0x2c')][_0x5564('0x2e')];var _0x127630=_0x262d89[_0x5564('0x2c')][_0x5564('0x2f')];var _0x5db16a=_0x262d89[_0x5564('0x2c')][_0x5564('0x30')];var _0x44682e=_0x262d89['body'][_0x5564('0x31')];return getAgent(_0x222097)[_0x5564('0x21')](function(_0x4b3fc7){logger[_0x5564('0x11')]('entityFound:',_0x4b3fc7['name']);emit(util['format'](_0x5564('0x32'),_0x4b3fc7[_0x5564('0x17')]),_0x5564('0x33'),{'callNumber':_0x127630,'callerId':_0x5db16a,'callbackUrl':_0x44682e});return _0x3fb210[_0x5564('0x18')](0xc8)['json']({'error':![],'message':_0x5564('0x34')});})[_0x5564('0x1e')](handleError(_0x3fb210));};exports[_0x5564('0x35')]=function(_0x5c5aab,_0x56d1ee){logger['info'](_0x5564('0x36'),_0x5c5aab[_0x5564('0x2c')]);var _0x1c53ea=hangupValidation[_0x5564('0xd')](_0x5c5aab[_0x5564('0x2c')]);if(_0x1c53ea[_0x5564('0x28')]>0x0){return _0x56d1ee[_0x5564('0x18')](0x190)['json'](_0x1c53ea);}var _0x36a535=_0x5c5aab[_0x5564('0x2c')][_0x5564('0x2e')];var _0x23aa8d=_0x5c5aab[_0x5564('0x2c')][_0x5564('0x27')];return getAgent(_0x36a535)[_0x5564('0x21')](function(_0x4af931){logger[_0x5564('0x11')](_0x5564('0x37'),_0x4af931['name']);emit(util[_0x5564('0x38')](_0x5564('0x32'),_0x4af931['name']),'webbar:hangup',{'sessionId':_0x23aa8d});return _0x56d1ee['status'](0xc8)[_0x5564('0x2d')]({'error':![],'message':_0x5564('0x39')});})[_0x5564('0x1e')](handleError(_0x56d1ee));};exports[_0x5564('0x3a')]=function(_0x104b9c,_0x53ad40){logger[_0x5564('0x11')](_0x5564('0x3b'),_0x104b9c[_0x5564('0x2c')]);var _0x1d7deb=answerValidation[_0x5564('0xd')](_0x104b9c[_0x5564('0x2c')]);if(_0x1d7deb[_0x5564('0x28')]>0x0){return _0x53ad40['status'](0x190)['json'](_0x1d7deb);}var _0x1e7032=_0x104b9c[_0x5564('0x2c')][_0x5564('0x2e')];var _0x590518=_0x104b9c[_0x5564('0x2c')][_0x5564('0x27')];return getAgent(_0x1e7032)[_0x5564('0x21')](function(_0x53b1f0){logger[_0x5564('0x11')](_0x5564('0x37'),_0x53b1f0[_0x5564('0x17')]);emit(util[_0x5564('0x38')]('user:%s',_0x53b1f0[_0x5564('0x17')]),_0x5564('0x3c'),{'sessionId':_0x590518});return _0x53ad40['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53ad40));};exports[_0x5564('0x3d')]=function(_0x514f89,_0x7a4e12){logger[_0x5564('0x11')](_0x5564('0x3e'),_0x514f89[_0x5564('0x2c')]);var _0x34539b=holdValidation[_0x5564('0xd')](_0x514f89[_0x5564('0x2c')]);if(_0x34539b[_0x5564('0x28')]>0x0){return _0x7a4e12['status'](0x190)[_0x5564('0x2d')](_0x34539b);}var _0x44b2c9=_0x514f89[_0x5564('0x2c')][_0x5564('0x2e')];var _0x5895a3=_0x514f89[_0x5564('0x2c')][_0x5564('0x27')];return getAgent(_0x44b2c9)[_0x5564('0x21')](function(_0x4ae0be){logger['info'](_0x5564('0x37'),_0x4ae0be['name']);emit(util[_0x5564('0x38')](_0x5564('0x32'),_0x4ae0be[_0x5564('0x17')]),_0x5564('0x3f'),{'sessionId':_0x5895a3});return _0x7a4e12[_0x5564('0x18')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x7a4e12));};exports['unhold']=function(_0x20b948,_0x275129){logger['info'](_0x5564('0x40'),_0x20b948[_0x5564('0x2c')]);var _0x37719a=unholdValidation[_0x5564('0xd')](_0x20b948['body']);if(_0x37719a['length']>0x0){return _0x275129[_0x5564('0x18')](0x190)[_0x5564('0x2d')](_0x37719a);}var _0x94ff19=_0x20b948[_0x5564('0x2c')]['userId'];var _0x4db556=_0x20b948[_0x5564('0x2c')][_0x5564('0x27')];return getAgent(_0x94ff19)[_0x5564('0x21')](function(_0x285ed3){logger['info']('entityFound:',_0x285ed3[_0x5564('0x17')]);emit(util[_0x5564('0x38')](_0x5564('0x32'),_0x285ed3[_0x5564('0x17')]),'webbar:unhold',{'sessionId':_0x4db556});return _0x275129['status'](0xc8)[_0x5564('0x2d')]({'error':![],'message':_0x5564('0x41')});})['catch'](handleError(_0x275129));};exports['calls']=function(_0x1e849e,_0x1ff7b9){logger[_0x5564('0x11')](_0x5564('0x42'),_0x1ff7b9[_0x5564('0x2c')]);var _0x49348e=callsValidation[_0x5564('0xd')](_0x1e849e[_0x5564('0x2c')]);if(_0x49348e[_0x5564('0x28')]>0x0){return _0x1ff7b9['status'](0x190)[_0x5564('0x2d')](_0x49348e);}var _0x4b9aeb=_0x1e849e[_0x5564('0x2c')]['userId'];var _0x11dfbe=respondWithRpcPromise(_0x5564('0x22'));var _0xca9854=getAgent(_0x4b9aeb);return Promise[_0x5564('0x23')]([_0x11dfbe,_0xca9854])[_0x5564('0x21')](function(_0xb90be8){var _0x1220f8=_0xb90be8[0x0];var _0x50bf84=_0xb90be8[0x1];var _0xe0143=_[_0x5564('0x24')](_0x1220f8['rows'],function(_0x3341b8){return _0x3341b8[_0x5564('0x26')]==_0x50bf84['id'];});return _0x1ff7b9[_0x5564('0x18')](0xc8)[_0x5564('0x2d')]({'count':_0xe0143[_0x5564('0x28')],'rows':_0xe0143});})[_0x5564('0x1e')](handleError(_0x1ff7b9));};exports[_0x5564('0x43')]=function(_0x2f9682,_0x451c8f){logger[_0x5564('0x11')](_0x5564('0x44'),_0x2f9682[_0x5564('0x2c')]);var _0x411481=conferenceValidation[_0x5564('0xd')](_0x2f9682[_0x5564('0x2c')]);if(_0x411481[_0x5564('0x28')]>0x0){return _0x451c8f['status'](0x190)[_0x5564('0x2d')](_0x411481);}var _0x53de17=_0x2f9682[_0x5564('0x2c')][_0x5564('0x2e')];return getAgent(_0x53de17)[_0x5564('0x21')](function(_0x510f11){logger[_0x5564('0x11')](_0x5564('0x37'),_0x510f11[_0x5564('0x17')]);emit(util['format'](_0x5564('0x32'),_0x510f11[_0x5564('0x17')]),'webbar:conference');return _0x451c8f['status'](0xc8)['json']({'error':![],'message':_0x5564('0x45')});})['catch'](handleError(_0x451c8f));};exports['transfer']=function(_0x37db7e,_0x91ec4){logger[_0x5564('0x11')](_0x5564('0x46'),_0x37db7e[_0x5564('0x2c')]);var _0x350991=transferValidation[_0x5564('0xd')](_0x37db7e[_0x5564('0x2c')]);if(_0x350991[_0x5564('0x28')]>0x0){return _0x91ec4[_0x5564('0x18')](0x190)['json'](_0x350991);}var _0x4866db=_0x37db7e['body'][_0x5564('0x2e')];var _0x487c56=_0x37db7e[_0x5564('0x2c')][_0x5564('0x27')];var _0x592961=_0x37db7e[_0x5564('0x2c')][_0x5564('0x47')];return getAgent(_0x4866db)[_0x5564('0x21')](function(_0x1aa5bb){logger['info']('entityFound:',_0x1aa5bb[_0x5564('0x17')]);emit(util[_0x5564('0x38')](_0x5564('0x32'),_0x1aa5bb['name']),_0x5564('0x48'),{'sessionId':_0x487c56,'transferNumber':_0x592961});return _0x91ec4[_0x5564('0x18')](0xc8)[_0x5564('0x2d')]({'error':![],'message':_0x5564('0x49')});})[_0x5564('0x1e')](handleError(_0x91ec4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 72bc5be..332f441 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 _0xd4ea=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3d391b,_0x139db6){var _0x34adb6=function(_0x464b1e){while(--_0x464b1e){_0x3d391b['push'](_0x3d391b['shift']());}};_0x34adb6(++_0x139db6);}(_0xd4ea,0x12e));var _0xad4e=function(_0x307f86,_0x253aac){_0x307f86=_0x307f86-0x0;var _0x7249a=_0xd4ea[_0x307f86];return _0x7249a;};'use strict';var multer=require(_0xad4e('0x0'));var util=require(_0xad4e('0x1'));var path=require('path');var timeout=require(_0xad4e('0x2'));var express=require(_0xad4e('0x3'));var router=express['Router']();var auth=require(_0xad4e('0x4'));var interaction=require(_0xad4e('0x5'));var config=require('../../config/environment');var controller=require(_0xad4e('0x6'));router[_0xad4e('0x7')]('/',auth[_0xad4e('0x8')](),controller[_0xad4e('0x9')]);router[_0xad4e('0x7')](_0xad4e('0xa'),auth[_0xad4e('0x8')](),controller[_0xad4e('0xb')]);router['get'](_0xad4e('0xc'),auth[_0xad4e('0x8')](),controller[_0xad4e('0xd')]);router[_0xad4e('0x7')](_0xad4e('0xe'),auth[_0xad4e('0x8')](),controller[_0xad4e('0xf')]);router[_0xad4e('0x7')](_0xad4e('0x10'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x11')]);router[_0xad4e('0x7')](_0xad4e('0x12'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x13')]);router[_0xad4e('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0xad4e('0x14')]);router[_0xad4e('0x15')]('/',auth[_0xad4e('0x8')](),controller['create']);router[_0xad4e('0x15')](_0xad4e('0xe'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x16')]);router[_0xad4e('0x15')](_0xad4e('0x10'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x17')]);router[_0xad4e('0x15')](_0xad4e('0x12'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x18')]);router[_0xad4e('0x15')]('/:id/applications',auth[_0xad4e('0x8')](),controller['addApplications']);router[_0xad4e('0x15')](_0xad4e('0x19'),controller[_0xad4e('0x1a')]);router[_0xad4e('0x15')](_0xad4e('0x1b'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x1c')]);router[_0xad4e('0x1d')](_0xad4e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xad4e('0x1e')](_0xad4e('0xc'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x1f')]);router['delete'](_0xad4e('0xe'),auth[_0xad4e('0x8')](),controller['removeDispositions']);router['delete'](_0xad4e('0x10'),auth['isAuthenticated'](),controller[_0xad4e('0x20')]);router[_0xad4e('0x1e')](_0xad4e('0x12'),auth[_0xad4e('0x8')](),controller[_0xad4e('0x21')]);module[_0xad4e('0x22')]=router; \ No newline at end of file +var _0xb557=['getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','/describe','isAuthenticated','describe','get','getDispositions','/:id/canned_answers','getAnswers','/:id/users'];(function(_0xbb244d,_0xac409){var _0x40f6b7=function(_0x2f2af7){while(--_0x2f2af7){_0xbb244d['push'](_0xbb244d['shift']());}};_0x40f6b7(++_0xac409);}(_0xb557,0x12e));var _0x7b55=function(_0x48b75c,_0x288eb5){_0x48b75c=_0x48b75c-0x0;var _0xe94338=_0xb557[_0x48b75c];return _0xe94338;};'use strict';var multer=require(_0x7b55('0x0'));var util=require(_0x7b55('0x1'));var path=require(_0x7b55('0x2'));var timeout=require(_0x7b55('0x3'));var express=require(_0x7b55('0x4'));var router=express[_0x7b55('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7b55('0x6'));var config=require(_0x7b55('0x7'));var controller=require(_0x7b55('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b55('0x9')]);router['get'](_0x7b55('0xa'),auth[_0x7b55('0xb')](),controller[_0x7b55('0xc')]);router[_0x7b55('0xd')]('/:id',auth[_0x7b55('0xb')](),controller['show']);router[_0x7b55('0xd')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7b55('0xe')]);router[_0x7b55('0xd')](_0x7b55('0xf'),auth['isAuthenticated'](),controller[_0x7b55('0x10')]);router[_0x7b55('0xd')](_0x7b55('0x11'),auth['isAuthenticated'](),controller[_0x7b55('0x12')]);router[_0x7b55('0xd')](_0x7b55('0x13'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x14')]);router[_0x7b55('0x15')]('/',auth[_0x7b55('0xb')](),controller[_0x7b55('0x16')]);router[_0x7b55('0x15')](_0x7b55('0x17'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x18')]);router['post'](_0x7b55('0xf'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x19')]);router[_0x7b55('0x15')](_0x7b55('0x11'),auth['isAuthenticated'](),controller[_0x7b55('0x1a')]);router['post'](_0x7b55('0x13'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x1b')]);router['post']('/:id/notify',controller[_0x7b55('0x1c')]);router['post'](_0x7b55('0x1d'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x1e')]);router[_0x7b55('0x1f')](_0x7b55('0x20'),auth['isAuthenticated'](),controller[_0x7b55('0x21')]);router['delete'](_0x7b55('0x20'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x22')]);router[_0x7b55('0x23')](_0x7b55('0x17'),auth['isAuthenticated'](),controller[_0x7b55('0x24')]);router[_0x7b55('0x23')](_0x7b55('0xf'),auth[_0x7b55('0xb')](),controller[_0x7b55('0x25')]);router[_0x7b55('0x23')]('/:id/users',auth[_0x7b55('0xb')](),controller[_0x7b55('0x26')]);module[_0x7b55('0x27')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 518a015..feb02fc 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 _0xcc1d=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','name','STRING','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x9d4a94,_0xdd2ac5){var _0x54a1ea=function(_0x52c09a){while(--_0x52c09a){_0x9d4a94['push'](_0x9d4a94['shift']());}};_0x54a1ea(++_0xdd2ac5);}(_0xcc1d,0x1d7));var _0xdcc1=function(_0x5cb7dd,_0x290cfb){_0x5cb7dd=_0x5cb7dd-0x0;var _0x5ee23e=_0xcc1d[_0x5cb7dd];return _0x5ee23e;};'use strict';var Sequelize=require(_0xdcc1('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdcc1('0x1'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdcc1('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xdcc1('0x2')],'defaultValue':function(){return rs[_0xdcc1('0x3')]();}},'phone':{'type':Sequelize[_0xdcc1('0x2')]},'type':{'type':Sequelize[_0xdcc1('0x4')](_0xdcc1('0x5'))},'accountSid':{'type':Sequelize[_0xdcc1('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdcc1('0x6');}},'notificationSound':{'type':Sequelize[_0xdcc1('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdcc1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdcc1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdcc1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'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[_0xdcc1('0x8')],'comment':_0xdcc1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xdcc1('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b358a){if(!_0x2b358a){this[_0xdcc1('0xa')]('mandatoryDispositionPauseId',null);}this[_0xdcc1('0xa')](_0xdcc1('0xb'),_0x2b358a);}},'description':{'type':Sequelize[_0xdcc1('0x2')]}}; \ No newline at end of file +var _0x2d68=['STRING','name','generate','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x111f7f,_0x335f7c){var _0x2c6d05=function(_0x309e96){while(--_0x309e96){_0x111f7f['push'](_0x111f7f['shift']());}};_0x2c6d05(++_0x335f7c);}(_0x2d68,0x1ed));var _0x82d6=function(_0x2e3d63,_0xb43a9b){_0x2e3d63=_0x2e3d63-0x0;var _0x105946=_0x2d68[_0x2e3d63];return _0x105946;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x82d6('0x0'));module[_0x82d6('0x1')]={'name':{'type':Sequelize[_0x82d6('0x2')],'unique':_0x82d6('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x82d6('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x82d6('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x82d6('0x4')]();}},'phone':{'type':Sequelize[_0x82d6('0x2')]},'type':{'type':Sequelize[_0x82d6('0x5')](_0x82d6('0x6'))},'accountSid':{'type':Sequelize[_0x82d6('0x2')]},'authToken':{'type':Sequelize[_0x82d6('0x2')]},'notificationTemplate':{'type':Sequelize[_0x82d6('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x82d6('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x82d6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x82d6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x82d6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x82d6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82d6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82d6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x82d6('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x82d6('0x8')],'defaultValue':![],'comment':_0x82d6('0xb'),'set':function(_0x3a1425){if(!_0x3a1425){this[_0x82d6('0xc')](_0x82d6('0xd'),null);}this[_0x82d6('0xc')](_0x82d6('0xe'),_0x3a1425);}},'description':{'type':Sequelize[_0x82d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 1c6c915..3b8ced3 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 _0xd64b=['waitForTheAssignedAgent','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','test','ValidationError','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','status','json','count','offset','limit','apply','save','update','then','destroy','get','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','length','find','create','body','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','emit','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','Applications','account','applications','priority','asc','CmContact','difference','createdAt','updatedAt','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent'];(function(_0x3b1fc4,_0x470ef7){var _0x3e258d=function(_0x462e96){while(--_0x462e96){_0x3b1fc4['push'](_0x3b1fc4['shift']());}};_0x3e258d(++_0x470ef7);}(_0xd64b,0xc1));var _0xbd64=function(_0x2cdf4e,_0x210079){_0x2cdf4e=_0x2cdf4e-0x0;var _0x5a4400=_0xd64b[_0x2cdf4e];return _0x5a4400;};'use strict';var pdf=require(_0xbd64('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd64('0x2'));var rp=require(_0xbd64('0x3'));var moment=require(_0xbd64('0x4'));var BPromise=require(_0xbd64('0x5'));var Mustache=require(_0xbd64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd64('0x7'));var fs=require('fs');var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var db=require(_0xbd64('0x15'))['db'];config['redis']=_[_0xbd64('0x16')](config[_0xbd64('0x17')],{'host':_0xbd64('0x18'),'port':0x18eb});var socket=require(_0xbd64('0x19'))(new Redis(config[_0xbd64('0x17')]));require(_0xbd64('0x1a'))[_0xbd64('0x1b')](socket);var jayson=require(_0xbd64('0x1c'));var client=jayson[_0xbd64('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x2d1159,_0x13e7a4,_0x3ff550){if(_0x3ff550){var _0x32fd34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32fd34[_0xbd64('0x1e')](_0x13e7a4)){return _0x2d1159;}else{throw new db['Sequelize'][(_0xbd64('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2d1159;}}function respondWithRpcPromise(_0xccb0d5,_0x1432a6,_0x3aef70,_0x1d7a14){return new BPromise(function(_0x17d015,_0x2f4554){var _0xa5491d=_0x1d7a14||client;return _0xa5491d[_0xbd64('0x20')](_0xccb0d5,_0x3aef70)['then'](function(_0x305545){logger[_0xbd64('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x1432a6,'request\x20sent');logger[_0xbd64('0x22')](_0xbd64('0x23'),_0x1432a6,_0xbd64('0x24'),JSON[_0xbd64('0x25')](_0x305545));if(_0x305545[_0xbd64('0x26')]){if(_0x305545[_0xbd64('0x26')]['code']===0x1f4){logger['error'](_0xbd64('0x27'),_0x1432a6,_0x305545[_0xbd64('0x26')][_0xbd64('0x28')]);return _0x2f4554(_0x305545[_0xbd64('0x26')]['message']);}logger['error'](_0xbd64('0x27'),_0x1432a6,_0x305545['error'][_0xbd64('0x28')]);return _0x17d015(_0x305545['error'][_0xbd64('0x28')]);}else{logger[_0xbd64('0x21')](_0xbd64('0x27'),_0x1432a6,_0xbd64('0x24'));_0x17d015(_0x305545['result'][_0xbd64('0x28')]);}})[_0xbd64('0x29')](function(_0x13f527){logger[_0xbd64('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1432a6,_0x13f527);_0x2f4554(_0x13f527);});});}function respondWithStatusCode(_0x4e8719,_0x29c9c8){_0x29c9c8=_0x29c9c8||0xcc;return function(_0x49eac5){if(_0x49eac5){return _0x4e8719['sendStatus'](_0x29c9c8);}return _0x4e8719[_0xbd64('0x2a')](_0x29c9c8)['end']();};}function respondWithResult(_0x3cf5b7,_0x5300e8){_0x5300e8=_0x5300e8||0xc8;return function(_0x28199c){if(_0x28199c){return _0x3cf5b7['status'](_0x5300e8)[_0xbd64('0x2b')](_0x28199c);}};}function respondWithFilteredResult(_0x3c0eaf,_0x3be63a){return function(_0x210fff){if(_0x210fff){var _0x306f19=_0x210fff[_0xbd64('0x2c')],_0x207ffc=_0x3be63a[_0xbd64('0x2d')],_0x4ed44a=_0x3be63a[_0xbd64('0x2d')]+_0x3be63a[_0xbd64('0x2e')],_0x35bdd5;if(_0x4ed44a>=_0x306f19){_0x4ed44a=_0x306f19;_0x35bdd5=0xc8;}else{_0x35bdd5=0xce;}_0x3c0eaf[_0xbd64('0x2a')](_0x35bdd5);return _0x3c0eaf['set']('Content-Range',_0x207ffc+'-'+_0x4ed44a+'/'+_0x306f19)[_0xbd64('0x2b')](_0x210fff);}return null;};}function patchUpdates(_0x576604){return function(_0xebed78){try{jsonpatch[_0xbd64('0x2f')](_0xebed78,_0x576604,!![]);}catch(_0x54459f){return BPromise['reject'](_0x54459f);}return _0xebed78[_0xbd64('0x30')]();};}function saveUpdates(_0x4e1834,_0x5b6948){return function(_0x1867af){if(_0x1867af){return _0x1867af[_0xbd64('0x31')](_0x4e1834)[_0xbd64('0x32')](function(_0x50c58e){return _0x50c58e;});}return null;};}function removeEntity(_0x231c37,_0x569cb6){return function(_0x1fc9cf){if(_0x1fc9cf){return _0x1fc9cf[_0xbd64('0x33')]()[_0xbd64('0x32')](function(){var _0x243588=_0x1fc9cf[_0xbd64('0x34')]({'plain':!![]});var _0x429aec='WhatsappAccounts';return db['UserProfileResource'][_0xbd64('0x33')]({'where':{'type':_0x429aec,'resourceId':_0x243588['id']}})[_0xbd64('0x32')](function(){return _0x1fc9cf;});})[_0xbd64('0x32')](function(){_0x231c37[_0xbd64('0x2a')](0xcc)[_0xbd64('0x35')]();});}};}function handleEntityNotFound(_0x3b245e,_0x54784f){return function(_0x5a74a9){if(!_0x5a74a9){_0x3b245e[_0xbd64('0x36')](0x194);}return _0x5a74a9;};}function handleError(_0x1bcd4c,_0x21f518){_0x21f518=_0x21f518||0x1f4;return function(_0x4df52a){logger['error'](_0x4df52a[_0xbd64('0x37')]);if(_0x4df52a['name']){delete _0x4df52a[_0xbd64('0x38')];}_0x1bcd4c['status'](_0x21f518)[_0xbd64('0x39')](_0x4df52a);};}exports[_0xbd64('0x3a')]=function(_0x550221,_0x107da1){var _0x51ae42={'include':[{'model':db[_0xbd64('0x3b')],'as':_0xbd64('0x3c')}]},_0x534091={},_0x380f32={'count':0x0,'rows':[]};var _0x52f401=_['map'](db['WhatsappAccount'][_0xbd64('0x3d')],function(_0xbfd402){return{'name':_0xbfd402['fieldName'],'type':_0xbfd402[_0xbd64('0x3e')][_0xbd64('0x3f')]};});_0x534091[_0xbd64('0x40')]=_[_0xbd64('0x41')](_0x52f401,'name');_0x534091['query']=_[_0xbd64('0x42')](_0x550221['query']);_0x534091['filters']=_[_0xbd64('0x43')](_0x534091[_0xbd64('0x40')],_0x534091[_0xbd64('0x44')]);_0x51ae42[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x534091[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x550221[_0xbd64('0x44')]['fields']));_0x51ae42[_0xbd64('0x45')]=_0x51ae42[_0xbd64('0x45')]['length']?_0x51ae42[_0xbd64('0x45')]:_0x534091[_0xbd64('0x40')];if(!_0x550221[_0xbd64('0x44')][_0xbd64('0x47')](_0xbd64('0x48'))){_0x51ae42[_0xbd64('0x2e')]=qs[_0xbd64('0x2e')](_0x550221['query'][_0xbd64('0x2e')]);_0x51ae42['offset']=qs[_0xbd64('0x2d')](_0x550221['query'][_0xbd64('0x2d')]);}_0x51ae42[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x550221['query'][_0xbd64('0x4a')]);_0x51ae42['where']=qs['filters'](_['pick'](_0x550221[_0xbd64('0x44')],_0x534091[_0xbd64('0x4b')]),_0x52f401);if(_0x550221[_0xbd64('0x44')][_0xbd64('0x4c')]){_0x51ae42[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x51ae42[_0xbd64('0x4d')],{'$or':_['map'](_0x52f401,function(_0x59ac2d){if(_0x59ac2d[_0xbd64('0x3e')]!==_0xbd64('0x4f')){var _0x4e5efe={};_0x4e5efe[_0x59ac2d[_0xbd64('0x38')]]={'$like':'%'+_0x550221[_0xbd64('0x44')][_0xbd64('0x4c')]+'%'};return _0x4e5efe;}})});}_0x51ae42=_[_0xbd64('0x4e')]({},_0x51ae42,_0x550221[_0xbd64('0x50')]);var _0x5a6b5e={'where':_0x51ae42[_0xbd64('0x4d')]};return db[_0xbd64('0x51')][_0xbd64('0x2c')](_0x5a6b5e)[_0xbd64('0x32')](function(_0x485cd1){_0x380f32['count']=_0x485cd1;if(_0x550221[_0xbd64('0x44')][_0xbd64('0x52')]){_0x51ae42[_0xbd64('0x53')]=[{'all':!![]}];}return db[_0xbd64('0x51')][_0xbd64('0x54')](_0x51ae42);})[_0xbd64('0x32')](function(_0x49cd2f){_0x380f32[_0xbd64('0x55')]=_0x49cd2f;return _0x380f32;})[_0xbd64('0x32')](respondWithFilteredResult(_0x107da1,_0x51ae42))[_0xbd64('0x29')](handleError(_0x107da1,null));};exports[_0xbd64('0x56')]=function(_0x3027bb,_0x3f81d8){var _0x152816={'raw':![],'where':{'id':_0x3027bb['params']['id']},'include':[{'model':db[_0xbd64('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5dd6b6={};_0x5dd6b6['model']=_['keys'](db['WhatsappAccount'][_0xbd64('0x3d')]);_0x5dd6b6[_0xbd64('0x44')]=_['keys'](_0x3027bb[_0xbd64('0x44')]);_0x5dd6b6[_0xbd64('0x4b')]=_[_0xbd64('0x43')](_0x5dd6b6['model'],_0x5dd6b6[_0xbd64('0x44')]);_0x152816[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x5dd6b6[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x3027bb[_0xbd64('0x44')]['fields']));_0x152816['attributes']=_0x152816['attributes'][_0xbd64('0x57')]?_0x152816[_0xbd64('0x45')]:_0x5dd6b6[_0xbd64('0x40')];if(_0x3027bb[_0xbd64('0x44')]['includeAll']){_0x152816[_0xbd64('0x53')]=[{'all':!![]}];}_0x152816=_[_0xbd64('0x4e')]({},_0x152816,_0x3027bb[_0xbd64('0x50')]);return db[_0xbd64('0x51')][_0xbd64('0x58')](_0x152816)[_0xbd64('0x32')](handleEntityNotFound(_0x3f81d8,null))['then'](respondWithResult(_0x3f81d8,null))[_0xbd64('0x29')](handleError(_0x3f81d8,null));};exports[_0xbd64('0x59')]=function(_0x15f1fc,_0x1fe3e5){return db[_0xbd64('0x51')][_0xbd64('0x59')](_0x15f1fc[_0xbd64('0x5a')],{})[_0xbd64('0x32')](function(_0x430566){var _0x1e8e1c=_0x15f1fc[_0xbd64('0x5b')][_0xbd64('0x34')]({'plain':!![]});if(!_0x1e8e1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e8e1c['role']===_0xbd64('0x5b')){var _0x2bcf68=_0x430566['get']({'plain':!![]});var _0x550f5f=_0xbd64('0x5c');return db[_0xbd64('0x5d')]['find']({'where':{'name':_0x550f5f,'userProfileId':_0x1e8e1c[_0xbd64('0x5e')]},'raw':!![]})[_0xbd64('0x32')](function(_0x45573c){if(_0x45573c&&_0x45573c[_0xbd64('0x5f')]===0x0){return db[_0xbd64('0x60')][_0xbd64('0x59')]({'name':_0x2bcf68[_0xbd64('0x38')],'resourceId':_0x2bcf68['id'],'type':_0x45573c[_0xbd64('0x38')],'sectionId':_0x45573c['id']},{})[_0xbd64('0x32')](function(){return _0x430566;});}else{return _0x430566;}})['catch'](function(_0x358ba8){logger[_0xbd64('0x26')](_0xbd64('0x61'),_0x358ba8);throw _0x358ba8;});}return _0x430566;})['then'](respondWithResult(_0x1fe3e5,0xc9))[_0xbd64('0x29')](handleError(_0x1fe3e5,null));};exports[_0xbd64('0x31')]=function(_0x4aa83e,_0x4423d9){if(_0x4aa83e[_0xbd64('0x5a')]['id']){delete _0x4aa83e[_0xbd64('0x5a')]['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x4aa83e[_0xbd64('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xbd64('0x3c')}]})[_0xbd64('0x32')](handleEntityNotFound(_0x4423d9,null))[_0xbd64('0x32')](saveUpdates(_0x4aa83e[_0xbd64('0x5a')],null))['then'](respondWithResult(_0x4423d9,null))[_0xbd64('0x29')](handleError(_0x4423d9,null));};exports[_0xbd64('0x33')]=function(_0x502d84,_0x78d88){return db['WhatsappAccount'][_0xbd64('0x58')]({'where':{'id':_0x502d84[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x78d88,null))[_0xbd64('0x32')](removeEntity(_0x78d88,null))['catch'](handleError(_0x78d88,null));};exports[_0xbd64('0x63')]=function(_0x54a3b1,_0x30bdef){return db[_0xbd64('0x51')][_0xbd64('0x63')]()[_0xbd64('0x32')](respondWithResult(_0x30bdef,null))['catch'](handleError(_0x30bdef,null));};exports['addDisposition']=function(_0x5616bc,_0x36f3a8,_0xd1b21f){if(_0x5616bc[_0xbd64('0x5a')]['id']){delete _0x5616bc[_0xbd64('0x5a')]['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x5616bc['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x36f3a8,null))[_0xbd64('0x32')](function(_0x305ffc){if(_0x305ffc){_0x5616bc[_0xbd64('0x5a')][_0xbd64('0x64')]=_0x305ffc['id'];return db[_0xbd64('0x65')][_0xbd64('0x59')](_0x5616bc[_0xbd64('0x5a')]);}})[_0xbd64('0x32')](respondWithResult(_0x36f3a8,null))[_0xbd64('0x29')](handleError(_0x36f3a8,null));};exports[_0xbd64('0x66')]=function(_0x582c85,_0x48f1a5,_0x5f16fd){var _0x7e5c1c={'raw':![],'where':{}};var _0x363da8={};var _0x2ec631={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbd64('0x67')]({'where':{'id':_0x582c85['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x48f1a5,null))[_0xbd64('0x32')](function(_0x1c2930){if(_0x1c2930){_0x363da8[_0xbd64('0x40')]=_['keys'](db[_0xbd64('0x65')]['rawAttributes']);_0x363da8[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x582c85[_0xbd64('0x44')]);_0x363da8[_0xbd64('0x4b')]=_[_0xbd64('0x43')](_0x363da8['model'],_0x363da8[_0xbd64('0x44')]);_0x7e5c1c[_0xbd64('0x45')]=_['intersection'](_0x363da8[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x582c85[_0xbd64('0x44')][_0xbd64('0x46')]));_0x7e5c1c['attributes']=_0x7e5c1c[_0xbd64('0x45')]['length']?_0x7e5c1c[_0xbd64('0x45')]:_0x363da8[_0xbd64('0x40')];if(!_0x582c85[_0xbd64('0x44')]['hasOwnProperty']('nolimit')){_0x7e5c1c['limit']=qs['limit'](_0x582c85[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x7e5c1c[_0xbd64('0x2d')]=qs[_0xbd64('0x2d')](_0x582c85[_0xbd64('0x44')]['offset']);}_0x7e5c1c[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x582c85[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x7e5c1c[_0xbd64('0x4d')]=qs['filters'](_[_0xbd64('0x68')](_0x582c85[_0xbd64('0x44')],_0x363da8[_0xbd64('0x4b')]));_0x7e5c1c[_0xbd64('0x4d')]['WhatsappAccountId']=_0x1c2930['id'];if(_0x582c85['query'][_0xbd64('0x4c')]){_0x7e5c1c[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x7e5c1c[_0xbd64('0x4d')],{'$or':_[_0xbd64('0x41')](_0x7e5c1c[_0xbd64('0x45')],function(_0x86124){var _0x344285={};_0x344285[_0x86124]={'$like':'%'+_0x582c85['query'][_0xbd64('0x4c')]+'%'};return _0x344285;})});}_0x7e5c1c=_['merge']({},_0x7e5c1c,_0x582c85[_0xbd64('0x50')]);return db[_0xbd64('0x65')][_0xbd64('0x2c')]({'where':_0x7e5c1c['where']})[_0xbd64('0x32')](function(_0x5c30f9){_0x2ec631['count']=_0x5c30f9;if(_0x582c85[_0xbd64('0x44')][_0xbd64('0x52')]){_0x7e5c1c[_0xbd64('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbd64('0x54')](_0x7e5c1c);})[_0xbd64('0x32')](function(_0x8150bb){_0x2ec631[_0xbd64('0x55')]=_0x8150bb;return _0x2ec631;});}})['then'](respondWithFilteredResult(_0x48f1a5,_0x7e5c1c))[_0xbd64('0x29')](handleError(_0x48f1a5,null));};exports[_0xbd64('0x69')]=function(_0x355b87,_0x1964f9,_0x339e52){return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x355b87[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x1964f9,null))[_0xbd64('0x32')](function(_0x3f49f3){if(_0x3f49f3){return _0x3f49f3[_0xbd64('0x69')](_0x355b87[_0xbd64('0x44')][_0xbd64('0x6a')]);}})['then'](respondWithStatusCode(_0x1964f9,null))['catch'](handleError(_0x1964f9,null));};exports[_0xbd64('0x6b')]=function(_0x322093,_0x155b41,_0x586056){if(_0x322093[_0xbd64('0x5a')]['id']){delete _0x322093['body']['id'];}return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x322093[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x155b41,null))['then'](function(_0x44ecf9){if(_0x44ecf9){_0x322093[_0xbd64('0x5a')]['WhatsappAccountId']=_0x44ecf9['id'];return db[_0xbd64('0x6c')]['create'](_0x322093[_0xbd64('0x5a')]);}})[_0xbd64('0x32')](respondWithResult(_0x155b41,null))[_0xbd64('0x29')](handleError(_0x155b41,null));};exports[_0xbd64('0x6d')]=function(_0x30b3a1,_0x38b974,_0x53717e){var _0x4190a3={'raw':![],'where':{}};var _0x588452={};var _0x366672={'count':0x0,'rows':[]};return db[_0xbd64('0x51')]['findOne']({'where':{'id':_0x30b3a1[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x38b974,null))[_0xbd64('0x32')](function(_0x2ac722){if(_0x2ac722){_0x588452[_0xbd64('0x40')]=_['keys'](db[_0xbd64('0x6c')][_0xbd64('0x3d')]);_0x588452[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x30b3a1[_0xbd64('0x44')]);_0x588452['filters']=_['intersection'](_0x588452[_0xbd64('0x40')],_0x588452[_0xbd64('0x44')]);_0x4190a3[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x588452[_0xbd64('0x40')],qs[_0xbd64('0x46')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x46')]));_0x4190a3[_0xbd64('0x45')]=_0x4190a3[_0xbd64('0x45')][_0xbd64('0x57')]?_0x4190a3[_0xbd64('0x45')]:_0x588452[_0xbd64('0x40')];if(!_0x30b3a1['query'][_0xbd64('0x47')](_0xbd64('0x48'))){_0x4190a3['limit']=qs[_0xbd64('0x2e')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x4190a3[_0xbd64('0x2d')]=qs['offset'](_0x30b3a1['query'][_0xbd64('0x2d')]);}_0x4190a3[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x4190a3[_0xbd64('0x4d')]=qs[_0xbd64('0x4b')](_[_0xbd64('0x68')](_0x30b3a1[_0xbd64('0x44')],_0x588452[_0xbd64('0x4b')]));_0x4190a3[_0xbd64('0x4d')][_0xbd64('0x64')]=_0x2ac722['id'];if(_0x30b3a1['query'][_0xbd64('0x4c')]){_0x4190a3[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x4190a3['where'],{'$or':_['map'](_0x4190a3[_0xbd64('0x45')],function(_0x2dbbd4){var _0x5d9b13={};_0x5d9b13[_0x2dbbd4]={'$like':'%'+_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x4c')]+'%'};return _0x5d9b13;})});}_0x4190a3=_[_0xbd64('0x4e')]({},_0x4190a3,_0x30b3a1[_0xbd64('0x50')]);return db[_0xbd64('0x6c')][_0xbd64('0x2c')]({'where':_0x4190a3[_0xbd64('0x4d')]})[_0xbd64('0x32')](function(_0x2686fe){_0x366672[_0xbd64('0x2c')]=_0x2686fe;if(_0x30b3a1[_0xbd64('0x44')][_0xbd64('0x52')]){_0x4190a3['include']=[{'all':!![]}];}return db[_0xbd64('0x6c')]['findAll'](_0x4190a3);})[_0xbd64('0x32')](function(_0x25d8d8){_0x366672[_0xbd64('0x55')]=_0x25d8d8;return _0x366672;});}})[_0xbd64('0x32')](respondWithFilteredResult(_0x38b974,_0x4190a3))[_0xbd64('0x29')](handleError(_0x38b974,null));};exports['removeAnswers']=function(_0x219149,_0x357ac2,_0x72185e){return db[_0xbd64('0x51')]['find']({'where':{'id':_0x219149[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x357ac2,null))[_0xbd64('0x32')](function(_0x993847){if(_0x993847){return _0x993847[_0xbd64('0x6e')](_0x219149[_0xbd64('0x44')][_0xbd64('0x6a')]);}})[_0xbd64('0x32')](respondWithStatusCode(_0x357ac2,null))[_0xbd64('0x29')](handleError(_0x357ac2,null));};exports['addAgents']=function(_0x2824dc,_0x2c640e,_0x33cfc8){return db[_0xbd64('0x51')]['find']({'where':{'id':_0x2824dc[_0xbd64('0x62')]['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x2c640e,null))[_0xbd64('0x32')](function(_0x19a780){if(_0x19a780){return _0x19a780[_0xbd64('0x6f')](_0x2824dc[_0xbd64('0x5a')][_0xbd64('0x6a')],_['omit'](_0x2824dc[_0xbd64('0x5a')],['ids','id'])||{})[_0xbd64('0x70')](function(_0x59cc30){for(var _0x4a7220=0x0;_0x4a7220<_0x2824dc[_0xbd64('0x5a')][_0xbd64('0x6a')][_0xbd64('0x57')];_0x4a7220+=0x1){socket['emit'](_0xbd64('0x71'),{'UserId':_0x2824dc['body'][_0xbd64('0x6a')][_0x4a7220],'WhatsappAccountId':_0x2824dc['params']['id']});}return _0x59cc30;});}})['then'](respondWithResult(_0x2c640e,null))[_0xbd64('0x29')](handleError(_0x2c640e,null));};exports[_0xbd64('0x72')]=function(_0x30a8b4,_0x310ee4,_0x34c941){return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x30a8b4[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x310ee4,null))['then'](function(_0xd7e9dd){if(_0xd7e9dd){return _0xd7e9dd['removeAgents'](_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')])[_0xbd64('0x32')](function(){if(_['isArray'](_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')])){for(var _0x5f4e47=0x0;_0x5f4e47<_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')]['length'];_0x5f4e47+=0x1){socket['emit'](_0xbd64('0x73'),{'UserId':Number(_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')][_0x5f4e47]),'WhatsappAccountId':Number(_0x30a8b4[_0xbd64('0x62')]['id'])});}}else{socket[_0xbd64('0x74')](_0xbd64('0x73'),{'UserId':Number(_0x30a8b4[_0xbd64('0x44')][_0xbd64('0x6a')]),'WhatsappAccountId':Number(_0x30a8b4[_0xbd64('0x62')]['id'])});}});}})[_0xbd64('0x32')](respondWithStatusCode(_0x310ee4,null))[_0xbd64('0x29')](handleError(_0x310ee4,null));};exports[_0xbd64('0x75')]=function(_0x1f630b,_0x2d1f0c,_0x2419b7){var _0x5568cd={};var _0x2a6b2f={};var _0x4dda62;var _0x2a59da;return db[_0xbd64('0x51')]['findOne']({'where':{'id':_0x1f630b[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x2d1f0c,null))[_0xbd64('0x32')](function(_0x1fb323){if(_0x1fb323){_0x4dda62=_0x1fb323;_0x2a6b2f[_0xbd64('0x40')]=_[_0xbd64('0x42')](db['User'][_0xbd64('0x3d')]);_0x2a6b2f[_0xbd64('0x44')]=_[_0xbd64('0x42')](_0x1f630b[_0xbd64('0x44')]);_0x2a6b2f['filters']=_['intersection'](_0x2a6b2f[_0xbd64('0x40')],_0x2a6b2f[_0xbd64('0x44')]);_0x5568cd[_0xbd64('0x45')]=_['intersection'](_0x2a6b2f[_0xbd64('0x40')],qs['fields'](_0x1f630b[_0xbd64('0x44')][_0xbd64('0x46')]));_0x5568cd[_0xbd64('0x45')]=_0x5568cd[_0xbd64('0x45')][_0xbd64('0x57')]?_0x5568cd['attributes']:_0x2a6b2f['model'];_0x5568cd[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x1f630b[_0xbd64('0x44')]['sort']);_0x5568cd[_0xbd64('0x4d')]=qs['filters'](_[_0xbd64('0x68')](_0x1f630b[_0xbd64('0x44')],_0x2a6b2f[_0xbd64('0x4b')]));if(_0x1f630b['query'][_0xbd64('0x4c')]){_0x5568cd[_0xbd64('0x4d')]=_['merge'](_0x5568cd['where'],{'$or':_[_0xbd64('0x41')](_0x5568cd['attributes'],function(_0x4d1a95){var _0x1442ee={};_0x1442ee[_0x4d1a95]={'$like':'%'+_0x1f630b[_0xbd64('0x44')]['filter']+'%'};return _0x1442ee;})});}_0x5568cd=_[_0xbd64('0x4e')]({},_0x5568cd,_0x1f630b['options']);return _0x4dda62[_0xbd64('0x75')](_0x5568cd);}})[_0xbd64('0x32')](function(_0x38795c){if(_0x38795c){_0x2a59da=_0x38795c['length'];if(!_0x1f630b[_0xbd64('0x44')]['hasOwnProperty']('nolimit')){_0x5568cd['limit']=qs[_0xbd64('0x2e')](_0x1f630b[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x5568cd['offset']=qs[_0xbd64('0x2d')](_0x1f630b['query'][_0xbd64('0x2d')]);}return _0x4dda62['getAgents'](_0x5568cd);}})['then'](function(_0x5415ed){if(_0x5415ed){return _0x5415ed?{'count':_0x2a59da,'rows':_0x5415ed}:null;}})[_0xbd64('0x32')](respondWithResult(_0x2d1f0c,null))[_0xbd64('0x29')](handleError(_0x2d1f0c,null));};exports[_0xbd64('0x76')]=function(_0x2ccf8d,_0x4d6781,_0x4094b8){return db[_0xbd64('0x51')][_0xbd64('0x67')]({'where':{'id':_0x2ccf8d['params']['id']}})[_0xbd64('0x32')](handleEntityNotFound(_0x4d6781,null))['then'](function(_0x142436){if(_0x142436){return db[_0xbd64('0x77')][_0xbd64('0x78')](function(_0x27ae4b){return db[_0xbd64('0x79')][_0xbd64('0x33')]({'where':{'WhatsappAccountId':_0x2ccf8d[_0xbd64('0x62')]['id']},'transaction':_0x27ae4b})[_0xbd64('0x32')](function(_0x3bc73d){var _0x871906=_[_0xbd64('0x41')](_0x2ccf8d[_0xbd64('0x5a')],function(_0x103561){_0x103561['WhatsappAccountId']=_0x2ccf8d['params']['id'];return _0x103561;});return db[_0xbd64('0x79')][_0xbd64('0x7a')](_0x871906,{'transaction':_0x27ae4b});});})[_0xbd64('0x32')](function(){return db[_0xbd64('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2ccf8d[_0xbd64('0x62')]['id']},'order':'priority'});});}})[_0xbd64('0x32')](respondWithResult(_0x4d6781,null))['catch'](handleError(_0x4d6781,null));};exports['getApplications']=function(_0x421cd3,_0x762409,_0x58c849){var _0x2058c5={};var _0x494908={};var _0x40ff49;var _0x592e2c;return db[_0xbd64('0x51')][_0xbd64('0x67')]({'where':{'id':_0x421cd3[_0xbd64('0x62')]['id']}})['then'](handleEntityNotFound(_0x762409,null))[_0xbd64('0x32')](function(_0x287a9a){if(_0x287a9a){_0x40ff49=_0x287a9a;_0x494908[_0xbd64('0x40')]=_[_0xbd64('0x42')](db[_0xbd64('0x79')][_0xbd64('0x3d')]);_0x494908[_0xbd64('0x44')]=_['keys'](_0x421cd3[_0xbd64('0x44')]);_0x494908[_0xbd64('0x4b')]=_['intersection'](_0x494908['model'],_0x494908['query']);_0x2058c5[_0xbd64('0x45')]=_[_0xbd64('0x43')](_0x494908[_0xbd64('0x40')],qs['fields'](_0x421cd3[_0xbd64('0x44')]['fields']));_0x2058c5[_0xbd64('0x45')]=_0x2058c5['attributes'][_0xbd64('0x57')]?_0x2058c5[_0xbd64('0x45')]:_0x494908[_0xbd64('0x40')];_0x2058c5[_0xbd64('0x49')]=qs[_0xbd64('0x4a')](_0x421cd3[_0xbd64('0x44')][_0xbd64('0x4a')]);_0x2058c5[_0xbd64('0x4d')]=qs[_0xbd64('0x4b')](_[_0xbd64('0x68')](_0x421cd3[_0xbd64('0x44')],_0x494908['filters']));if(_0x421cd3[_0xbd64('0x44')][_0xbd64('0x4c')]){_0x2058c5[_0xbd64('0x4d')]=_[_0xbd64('0x4e')](_0x2058c5[_0xbd64('0x4d')],{'$or':_[_0xbd64('0x41')](_0x2058c5[_0xbd64('0x45')],function(_0x27eb30){var _0x2f97b5={};_0x2f97b5[_0x27eb30]={'$like':'%'+_0x421cd3['query']['filter']+'%'};return _0x2f97b5;})});}_0x2058c5=_[_0xbd64('0x4e')]({},_0x2058c5,_0x421cd3[_0xbd64('0x50')]);return _0x40ff49['getApplications'](_0x2058c5);}})[_0xbd64('0x32')](function(_0x2b78b4){if(_0x2b78b4){_0x592e2c=_0x2b78b4['length'];if(!_0x421cd3[_0xbd64('0x44')]['hasOwnProperty'](_0xbd64('0x48'))){_0x2058c5[_0xbd64('0x2e')]=qs[_0xbd64('0x2e')](_0x421cd3[_0xbd64('0x44')][_0xbd64('0x2e')]);_0x2058c5['offset']=qs['offset'](_0x421cd3['query']['offset']);}return _0x40ff49[_0xbd64('0x7b')](_0x2058c5);}})['then'](function(_0x3cf54a){if(_0x3cf54a){return _0x3cf54a?{'count':_0x592e2c,'rows':_0x3cf54a}:null;}})['then'](respondWithResult(_0x762409,null))['catch'](handleError(_0x762409,null));};exports[_0xbd64('0x7c')]=function(_0x1bcc1c,_0x45cbb6,_0x302596){var _0x24f5c0={'channel':_0xbd64('0x7d')};var _0x13fae5=[];var _0xf95ff=[];var _0x14bb25={};return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x1bcc1c[_0xbd64('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xbd64('0x7e')}]})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))[_0xbd64('0x32')](function(_0x3d2e6a){_0x24f5c0[_0xbd64('0x7f')]=_0x3d2e6a;_0x24f5c0[_0xbd64('0x80')]=_['orderBy'](_0x3d2e6a[_0xbd64('0x7e')],[_0xbd64('0x81')],[_0xbd64('0x82')]);if(_0x24f5c0[_0xbd64('0x7f')]['Applications']){delete _0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x7e')];}return db[_0xbd64('0x83')][_0xbd64('0x63')]();})['then'](function(_0x3ac365){if(!_0x3ac365){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x13fae5=_[_0xbd64('0x84')](_[_0xbd64('0x42')](_0x3ac365),['createdAt','updatedAt']);_0xf95ff=_[_0xbd64('0x84')](_[_0xbd64('0x42')](_0x3ac365),[_0xbd64('0x85'),_0xbd64('0x86'),'CompanyId','ListId']);_0x24f5c0[_0xbd64('0x5a')]={'mapKey':'mobile'};if(_0x24f5c0[_0xbd64('0x7f')]['type']&&_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x3e')]===_0xbd64('0x87')){_0x24f5c0[_0xbd64('0x5a')]['from']=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x88')][_0xbd64('0x89')](_0xbd64('0x8a'),'');_0x24f5c0['body'][_0xbd64('0x5a')]=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x8b')];_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8c')]=_0x1bcc1c[_0xbd64('0x5a')][_0xbd64('0x8d')];}if(_0x24f5c0[_0xbd64('0x5a')]['id']){delete _0x24f5c0[_0xbd64('0x5a')]['id'];}if(_['isNil'](_0x24f5c0['body'][_0xbd64('0x8e')])){throw new db['Sequelize'][(_0xbd64('0x1f'))](_0xbd64('0x8f'));}if(_[_0xbd64('0x90')](_0x24f5c0['body']['body'])||_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x5a')]===''){throw new db[(_0xbd64('0x91'))][(_0xbd64('0x1f'))](_0xbd64('0x92'));}if(_[_0xbd64('0x90')](_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x93')])){throw new db[(_0xbd64('0x91'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf95ff);}if(!_[_0xbd64('0x94')](_0xf95ff,_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x93')])){throw new db[(_0xbd64('0x91'))]['ValidationError'](_0xbd64('0x95')+_0xf95ff);}_0x14bb25[_0x24f5c0['body'][_0xbd64('0x93')]]=_0x24f5c0['body'][_0xbd64('0x8e')];return db['CmList'][_0xbd64('0x58')]({'where':{'id':_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x96')]},'include':[{'model':db[_0xbd64('0x83')],'as':_0xbd64('0x97'),'where':_0x14bb25,'limit':0x1,'order':[[_0xbd64('0x86'),'DESC']]}]});})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))['then'](function(_0x2b3440){if(_0x2b3440){_0x24f5c0['list']=_['omit'](_0x2b3440,[_0xbd64('0x97')]);if(_0x2b3440[_0xbd64('0x97')][_0xbd64('0x57')]){return _0x2b3440['Contacts'][0x0];}var _0x4680fb=_[_0xbd64('0x16')](_0x24f5c0[_0xbd64('0x5a')],{'firstName':_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8e')],'ListId':_0x2b3440['id']});_0x4680fb[_0x24f5c0['body'][_0xbd64('0x93')]]=_0x24f5c0['body']['from'];return db[_0xbd64('0x83')][_0xbd64('0x59')](_0x4680fb,{'fields':_0x13fae5,'raw':!![]});}})[_0xbd64('0x32')](handleEntityNotFound(_0x45cbb6,null))[_0xbd64('0x32')](function(_0x291a3e){if(_0x291a3e){_0x24f5c0[_0xbd64('0x98')]=_0x291a3e;var _0x18acee={'ContactId':_0x291a3e['id'],'phone':_0x24f5c0[_0xbd64('0x5a')][_0xbd64('0x8e')],'WhatsappAccountId':_0x1bcc1c[_0xbd64('0x62')]['id']};var _0x46e995={'ContactId':_0x291a3e['id'],'WhatsappAccountId':_0x1bcc1c['params']['id'],'closed':![]};return db[_0xbd64('0x99')][_0xbd64('0x58')]({'where':_0x46e995})[_0xbd64('0x32')](function(_0xeca842){if(_0xeca842){return[_0xeca842,![]];}return db['WhatsappInteraction'][_0xbd64('0x59')](_0x18acee)[_0xbd64('0x32')](function(_0x4a6ea9){return[_0x4a6ea9,!![]];});});}})['spread'](function(_0x34e543,_0x19ccdb){_0x24f5c0[_0xbd64('0x9a')]=_0x34e543[_0xbd64('0x34')]({'plain':!![]});_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0x9b')]=![];if(_0x19ccdb){if(_0x24f5c0['account'][_0xbd64('0x9c')]){_0x24f5c0[_0xbd64('0x80')][_0xbd64('0x9d')]({'id':0x0,'priority':_0x24f5c0[_0xbd64('0x80')]['length']+0x1,'app':_0xbd64('0x9e'),'appdata':'unmanaged','interval':_0xbd64('0x9f')});}_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0x9b')]=!![];}return db[_0xbd64('0xa0')]['create']({'phone':_0x24f5c0[_0xbd64('0x5a')]['from'],'messageId':_0x24f5c0[_0xbd64('0x5a')]['messageId'],'body':_0x24f5c0[_0xbd64('0x5a')]['body'],'WhatsappAccountId':_0x1bcc1c[_0xbd64('0x62')]['id'],'WhatsappInteractionId':_0x34e543['id'],'direction':'in','ContactId':_0x34e543[_0xbd64('0xa1')],'AttachmentId':_0x24f5c0['body'][_0xbd64('0xa2')]});})[_0xbd64('0x32')](function(_0x530305){_0x24f5c0[_0xbd64('0x28')]=_0x530305;if(_0x24f5c0[_0xbd64('0x9a')][_0xbd64('0xa3')]){return db['User'][_0xbd64('0x58')]({'attributes':['id',_0xbd64('0x38')],'where':{'id':_0x24f5c0[_0xbd64('0x9a')]['UserId']}})[_0xbd64('0x32')](function(_0x46f980){if(_0x46f980){_0x24f5c0['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xbd64('0xa4'),'appdata':_0x46f980['name']+','+(_0x24f5c0['account'][_0xbd64('0xa5')]||0xa),'interval':_0xbd64('0x9f')});}return respondWithRpcPromise(_0xbd64('0xa6'),'startRouting',_0x24f5c0);});}return respondWithRpcPromise(_0xbd64('0xa6'),'startRouting',_0x24f5c0);})[_0xbd64('0x32')](function(_0x4f6ace){if(_0x4f6ace){var _0x45f692=0xc8;var _0x1a899a='receiveMessage';logger[_0xbd64('0x21')](_0xbd64('0x23'),_0x1a899a,_0x45f692,_0xbd64('0xa7'));logger[_0xbd64('0x22')](_0xbd64('0xa8'),_0x1a899a,_0x45f692,_0xbd64('0xa7'),JSON['stringify'](_0x4f6ace));if(_0x24f5c0[_0xbd64('0x7f')][_0xbd64('0x3e')]===_0xbd64('0x87')){return _0x45cbb6[_0xbd64('0x2a')](_0x45f692)[_0xbd64('0xa9')](_0xbd64('0xaa'),'text/xml')['send'](_0xbd64('0xab'));}else{return _0x45cbb6[_0xbd64('0x2a')](_0x45f692)[_0xbd64('0x2b')](_0x4f6ace);}}})['catch'](handleError(_0x45cbb6,null));};exports[_0xbd64('0x39')]=function(_0x2ab4d7,_0x3067fa,_0x3a35ad){var _0xa573d0,_0x46c4a4,_0x5a0256;if(_['isNil'](_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')])||_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd64('0x90')](_0x2ab4d7['body']['to'])){throw new db[(_0xbd64('0x91'))][(_0xbd64('0x1f'))](_0xbd64('0xac'));}_0xa573d0=_0x2ab4d7['body']['to'];return db[_0xbd64('0x51')][_0xbd64('0x58')]({'where':{'id':_0x2ab4d7[_0xbd64('0x62')]['id']},'include':[{'model':db[_0xbd64('0xad')],'as':_0xbd64('0xae'),'include':[{'model':db[_0xbd64('0x83')],'as':_0xbd64('0x97'),'where':{'mobile':_0xa573d0},'limit':0x1,'order':[[_0xbd64('0x86'),_0xbd64('0xaf')]]}]}]})[_0xbd64('0x32')](handleEntityNotFound(_0x3067fa,null))[_0xbd64('0x32')](function(_0x3dc17f){if(_0x3dc17f&&_0x3dc17f[_0xbd64('0xae')]){_0x46c4a4=_0x3dc17f['get']({'plain':!![]});if(_0x46c4a4[_0xbd64('0xae')]&&_0x46c4a4['List'][_0xbd64('0x97')][_0xbd64('0x57')]){return _0x46c4a4[_0xbd64('0xae')][_0xbd64('0x97')][0x0];}return db[_0xbd64('0x83')][_0xbd64('0x59')](_['defaults'](_0x2ab4d7['body'],{'firstName':_0xa573d0,'mobile':_0xa573d0,'phone':_0xa573d0,'ListId':_0x46c4a4['ListId']}));}})['then'](handleEntityNotFound(_0x3067fa,null))[_0xbd64('0x32')](function(_0x82132a){if(_0x82132a){_0x5a0256=_0x82132a;return db[_0xbd64('0x99')][_0xbd64('0x58')]({'where':{'ContactId':_0x5a0256['id'],'closed':![],'WhatsappAccountId':_0x46c4a4['id']}})[_0xbd64('0x32')](function(_0x35d11f){if(_0x35d11f){return[_0x35d11f,![]];}return db[_0xbd64('0x99')][_0xbd64('0x59')]({'UserId':_0x2ab4d7['user']['id'],'ContactId':_0x5a0256['id'],'WhatsappAccountId':_0x46c4a4['id'],'phone':_0xa573d0,'firstMsgDirection':_0xbd64('0xb0'),'Messages':[_[_0xbd64('0x4e')](_0x2ab4d7['body'],{'read':![],'body':_0x2ab4d7[_0xbd64('0x5a')][_0xbd64('0x5a')],'phone':_0xa573d0,'WhatsappAccountId':_0x46c4a4['id'],'UserId':_0x2ab4d7[_0xbd64('0x5b')]['id'],'ContactId':_0x5a0256['id']})]},{'include':[{'model':db[_0xbd64('0xa0')],'as':_0xbd64('0xb1')}]})[_0xbd64('0x32')](function(_0x1981f6){return[_0x1981f6,!![]];});});}})[_0xbd64('0x70')](function(_0x2635a9,_0x42ef5f){if(_0x42ef5f){return _0x2635a9;}return db[_0xbd64('0xa0')]['create'](_[_0xbd64('0x4e')](_0x2ab4d7[_0xbd64('0x5a')],{'read':![],'body':_0x2ab4d7[_0xbd64('0x5a')]['body'],'phone':_0xa573d0,'WhatsappAccountId':_0x46c4a4['id'],'WhatsappInteractionId':_0x2635a9['id'],'UserId':_0x2ab4d7[_0xbd64('0x5b')]['id'],'ContactId':_0x5a0256['id']}))['then'](function(_0x35505f){_0x2635a9[_0xbd64('0xb2')][_0xbd64('0xb1')]=[];_0x2635a9['dataValues']['Messages'][_0xbd64('0x9d')](_0x35505f[_0xbd64('0xb2')]);return _0x2635a9;});})['then'](respondWithResult(_0x3067fa,null))[_0xbd64('0x29')](handleError(_0x3067fa,null));}; \ No newline at end of file +var _0x9354=['then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','status','json','count','offset','Content-Range','reject','update','WhatsappAccounts','UserProfileResource','destroy','end','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','messageId','MessageSid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','send','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x2da2e0,_0x1c1c94){var _0x4e29b0=function(_0x3f9363){while(--_0x3f9363){_0x2da2e0['push'](_0x2da2e0['shift']());}};_0x4e29b0(++_0x1c1c94);}(_0x9354,0x96));var _0x4935=function(_0x1894e7,_0x1253e6){_0x1894e7=_0x1894e7-0x0;var _0x5e857f=_0x9354[_0x1894e7];return _0x5e857f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4935('0x16')]=_[_0x4935('0x17')](config[_0x4935('0x16')],{'host':_0x4935('0x18'),'port':0x18eb});var socket=require(_0x4935('0x19'))(new Redis(config[_0x4935('0x16')]));require(_0x4935('0x1a'))[_0x4935('0x1b')](socket);var jayson=require(_0x4935('0x1c'));var client=jayson[_0x4935('0x1d')][_0x4935('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x1799e4,_0xa41961,_0x3652c4){if(_0x3652c4){var _0x24cc99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24cc99[_0x4935('0x1f')](_0xa41961)){return _0x1799e4;}else{throw new db['Sequelize'][(_0x4935('0x20'))](_0x4935('0x21'));}}else{return _0x1799e4;}}function respondWithRpcPromise(_0x165ed3,_0x123300,_0x1f0e81,_0x429ef3){return new BPromise(function(_0x4ebc63,_0xd70eff){var _0x145277=_0x429ef3||client;return _0x145277['request'](_0x165ed3,_0x1f0e81)[_0x4935('0x22')](function(_0x10407f){logger[_0x4935('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,'request\x20sent');logger[_0x4935('0x24')](_0x4935('0x25'),_0x123300,_0x4935('0x26'),JSON[_0x4935('0x27')](_0x10407f));if(_0x10407f[_0x4935('0x28')]){if(_0x10407f[_0x4935('0x28')][_0x4935('0x29')]===0x1f4){logger[_0x4935('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);return _0xd70eff(_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);}logger[_0x4935('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x123300,_0x10407f['error'][_0x4935('0x2a')]);return _0x4ebc63(_0x10407f[_0x4935('0x28')][_0x4935('0x2a')]);}else{logger[_0x4935('0x23')](_0x4935('0x2b'),_0x123300,_0x4935('0x26'));_0x4ebc63(_0x10407f[_0x4935('0x2c')][_0x4935('0x2a')]);}})[_0x4935('0x2d')](function(_0xf4abb2){logger[_0x4935('0x28')](_0x4935('0x2b'),_0x123300,_0xf4abb2);_0xd70eff(_0xf4abb2);});});}function respondWithStatusCode(_0x2c47ab,_0xbb00d6){_0xbb00d6=_0xbb00d6||0xcc;return function(_0x359522){if(_0x359522){return _0x2c47ab['sendStatus'](_0xbb00d6);}return _0x2c47ab['status'](_0xbb00d6)['end']();};}function respondWithResult(_0x1fc218,_0x76ea7d){_0x76ea7d=_0x76ea7d||0xc8;return function(_0x4f1163){if(_0x4f1163){return _0x1fc218[_0x4935('0x2e')](_0x76ea7d)[_0x4935('0x2f')](_0x4f1163);}};}function respondWithFilteredResult(_0x24a3b6,_0x9fe9f6){return function(_0x1198e5){if(_0x1198e5){var _0x24262e=_0x1198e5[_0x4935('0x30')],_0x28afc2=_0x9fe9f6[_0x4935('0x31')],_0x2fe6da=_0x9fe9f6['offset']+_0x9fe9f6['limit'],_0x5b3c8e;if(_0x2fe6da>=_0x24262e){_0x2fe6da=_0x24262e;_0x5b3c8e=0xc8;}else{_0x5b3c8e=0xce;}_0x24a3b6[_0x4935('0x2e')](_0x5b3c8e);return _0x24a3b6['set'](_0x4935('0x32'),_0x28afc2+'-'+_0x2fe6da+'/'+_0x24262e)[_0x4935('0x2f')](_0x1198e5);}return null;};}function patchUpdates(_0x30fbc9){return function(_0x53722a){try{jsonpatch['apply'](_0x53722a,_0x30fbc9,!![]);}catch(_0x415260){return BPromise[_0x4935('0x33')](_0x415260);}return _0x53722a['save']();};}function saveUpdates(_0x47003b,_0x3260d2){return function(_0x9bfd48){if(_0x9bfd48){return _0x9bfd48[_0x4935('0x34')](_0x47003b)[_0x4935('0x22')](function(_0x4a69bc){return _0x4a69bc;});}return null;};}function removeEntity(_0x4b5c01,_0x3d8795){return function(_0x1016cc){if(_0x1016cc){return _0x1016cc['destroy']()['then'](function(){var _0xb3d934=_0x1016cc['get']({'plain':!![]});var _0x7b45d1=_0x4935('0x35');return db[_0x4935('0x36')][_0x4935('0x37')]({'where':{'type':_0x7b45d1,'resourceId':_0xb3d934['id']}})[_0x4935('0x22')](function(){return _0x1016cc;});})[_0x4935('0x22')](function(){_0x4b5c01['status'](0xcc)[_0x4935('0x38')]();});}};}function handleEntityNotFound(_0x51b7ac,_0x365e83){return function(_0x5db44b){if(!_0x5db44b){_0x51b7ac[_0x4935('0x39')](0x194);}return _0x5db44b;};}function handleError(_0x4c5a4e,_0x27ead0){_0x27ead0=_0x27ead0||0x1f4;return function(_0x59b749){logger[_0x4935('0x28')](_0x59b749[_0x4935('0x3a')]);if(_0x59b749[_0x4935('0x3b')]){delete _0x59b749[_0x4935('0x3b')];}_0x4c5a4e[_0x4935('0x2e')](_0x27ead0)['send'](_0x59b749);};}exports['index']=function(_0x2efc45,_0x4e4820){var _0x4e8b2e={'include':[{'model':db[_0x4935('0x3c')],'as':_0x4935('0x3d')}]},_0x1552b2={},_0x5c8012={'count':0x0,'rows':[]};var _0x2d67e3=_[_0x4935('0x3e')](db[_0x4935('0x3f')]['rawAttributes'],function(_0x5d4d7f){return{'name':_0x5d4d7f[_0x4935('0x40')],'type':_0x5d4d7f[_0x4935('0x41')][_0x4935('0x42')]};});_0x1552b2[_0x4935('0x43')]=_[_0x4935('0x3e')](_0x2d67e3,_0x4935('0x3b'));_0x1552b2[_0x4935('0x44')]=_[_0x4935('0x45')](_0x2efc45['query']);_0x1552b2['filters']=_[_0x4935('0x46')](_0x1552b2[_0x4935('0x43')],_0x1552b2['query']);_0x4e8b2e[_0x4935('0x47')]=_[_0x4935('0x46')](_0x1552b2[_0x4935('0x43')],qs[_0x4935('0x48')](_0x2efc45['query']['fields']));_0x4e8b2e[_0x4935('0x47')]=_0x4e8b2e[_0x4935('0x47')]['length']?_0x4e8b2e[_0x4935('0x47')]:_0x1552b2[_0x4935('0x43')];if(!_0x2efc45[_0x4935('0x44')]['hasOwnProperty'](_0x4935('0x49'))){_0x4e8b2e[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x2efc45[_0x4935('0x44')][_0x4935('0x4a')]);_0x4e8b2e[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x2efc45[_0x4935('0x44')][_0x4935('0x31')]);}_0x4e8b2e[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x2efc45[_0x4935('0x44')][_0x4935('0x4c')]);_0x4e8b2e[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x2efc45[_0x4935('0x44')],_0x1552b2[_0x4935('0x4e')]),_0x2d67e3);if(_0x2efc45['query'][_0x4935('0x50')]){_0x4e8b2e['where']=_[_0x4935('0x51')](_0x4e8b2e[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x2d67e3,function(_0x33e94a){if(_0x33e94a['type']!==_0x4935('0x52')){var _0x9c8bad={};_0x9c8bad[_0x33e94a[_0x4935('0x3b')]]={'$like':'%'+_0x2efc45[_0x4935('0x44')][_0x4935('0x50')]+'%'};return _0x9c8bad;}})});}_0x4e8b2e=_[_0x4935('0x51')]({},_0x4e8b2e,_0x2efc45[_0x4935('0x53')]);var _0x31d137={'where':_0x4e8b2e[_0x4935('0x4d')]};return db[_0x4935('0x3f')]['count'](_0x31d137)[_0x4935('0x22')](function(_0x1c3d9c){_0x5c8012['count']=_0x1c3d9c;if(_0x2efc45[_0x4935('0x44')][_0x4935('0x54')]){_0x4e8b2e[_0x4935('0x55')]=[{'all':!![]}];}return db[_0x4935('0x3f')][_0x4935('0x56')](_0x4e8b2e);})[_0x4935('0x22')](function(_0x289c5e){_0x5c8012[_0x4935('0x57')]=_0x289c5e;return _0x5c8012;})['then'](respondWithFilteredResult(_0x4e4820,_0x4e8b2e))[_0x4935('0x2d')](handleError(_0x4e4820,null));};exports['show']=function(_0x561fa3,_0x15ce51){var _0x189071={'raw':![],'where':{'id':_0x561fa3[_0x4935('0x58')]['id']},'include':[{'model':db[_0x4935('0x3c')],'as':'mandatoryDispositionPause'}]},_0x41c6d0={};_0x41c6d0[_0x4935('0x43')]=_[_0x4935('0x45')](db[_0x4935('0x3f')][_0x4935('0x59')]);_0x41c6d0[_0x4935('0x44')]=_[_0x4935('0x45')](_0x561fa3[_0x4935('0x44')]);_0x41c6d0[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x41c6d0[_0x4935('0x43')],_0x41c6d0['query']);_0x189071[_0x4935('0x47')]=_['intersection'](_0x41c6d0[_0x4935('0x43')],qs[_0x4935('0x48')](_0x561fa3['query'][_0x4935('0x48')]));_0x189071['attributes']=_0x189071['attributes']['length']?_0x189071[_0x4935('0x47')]:_0x41c6d0[_0x4935('0x43')];if(_0x561fa3[_0x4935('0x44')][_0x4935('0x54')]){_0x189071[_0x4935('0x55')]=[{'all':!![]}];}_0x189071=_['merge']({},_0x189071,_0x561fa3['options']);return db[_0x4935('0x3f')][_0x4935('0x5a')](_0x189071)[_0x4935('0x22')](handleEntityNotFound(_0x15ce51,null))['then'](respondWithResult(_0x15ce51,null))[_0x4935('0x2d')](handleError(_0x15ce51,null));};exports[_0x4935('0x5b')]=function(_0x24141a,_0xc92288){return db['WhatsappAccount'][_0x4935('0x5b')](_0x24141a['body'],{})['then'](function(_0x513b0e){var _0x24d870=_0x24141a[_0x4935('0x5c')]['get']({'plain':!![]});if(!_0x24d870)throw new Error(_0x4935('0x5d'));if(_0x24d870[_0x4935('0x5e')]==='user'){var _0x114a96=_0x513b0e[_0x4935('0x5f')]({'plain':!![]});var _0x3551b6=_0x4935('0x35');return db[_0x4935('0x60')][_0x4935('0x5a')]({'where':{'name':_0x3551b6,'userProfileId':_0x24d870[_0x4935('0x61')]},'raw':!![]})['then'](function(_0x31b426){if(_0x31b426&&_0x31b426['autoAssociation']===0x0){return db['UserProfileResource'][_0x4935('0x5b')]({'name':_0x114a96[_0x4935('0x3b')],'resourceId':_0x114a96['id'],'type':_0x31b426['name'],'sectionId':_0x31b426['id']},{})['then'](function(){return _0x513b0e;});}else{return _0x513b0e;}})[_0x4935('0x2d')](function(_0x24841d){logger[_0x4935('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24841d);throw _0x24841d;});}return _0x513b0e;})[_0x4935('0x22')](respondWithResult(_0xc92288,0xc9))['catch'](handleError(_0xc92288,null));};exports[_0x4935('0x34')]=function(_0x3d2005,_0x10b18b){if(_0x3d2005[_0x4935('0x62')]['id']){delete _0x3d2005[_0x4935('0x62')]['id'];}return db['WhatsappAccount'][_0x4935('0x5a')]({'where':{'id':_0x3d2005[_0x4935('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x4935('0x3d')}]})[_0x4935('0x22')](handleEntityNotFound(_0x10b18b,null))[_0x4935('0x22')](saveUpdates(_0x3d2005[_0x4935('0x62')],null))[_0x4935('0x22')](respondWithResult(_0x10b18b,null))[_0x4935('0x2d')](handleError(_0x10b18b,null));};exports[_0x4935('0x37')]=function(_0x3e8b18,_0x15ebcc){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x3e8b18['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x15ebcc,null))[_0x4935('0x22')](removeEntity(_0x15ebcc,null))[_0x4935('0x2d')](handleError(_0x15ebcc,null));};exports[_0x4935('0x63')]=function(_0x45c56c,_0x95da52){return db[_0x4935('0x3f')][_0x4935('0x63')]()[_0x4935('0x22')](respondWithResult(_0x95da52,null))[_0x4935('0x2d')](handleError(_0x95da52,null));};exports[_0x4935('0x64')]=function(_0x225a1a,_0x3a427c,_0x4824fd){if(_0x225a1a['body']['id']){delete _0x225a1a[_0x4935('0x62')]['id'];}return db[_0x4935('0x3f')]['find']({'where':{'id':_0x225a1a[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x3a427c,null))['then'](function(_0x4c5cdc){if(_0x4c5cdc){_0x225a1a[_0x4935('0x62')][_0x4935('0x65')]=_0x4c5cdc['id'];return db[_0x4935('0x66')][_0x4935('0x5b')](_0x225a1a[_0x4935('0x62')]);}})['then'](respondWithResult(_0x3a427c,null))[_0x4935('0x2d')](handleError(_0x3a427c,null));};exports[_0x4935('0x67')]=function(_0x26bbe,_0x15232f,_0x583964){var _0xd97c04={'raw':![],'where':{}};var _0x4c235f={};var _0x54be3b={'count':0x0,'rows':[]};return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x26bbe['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x15232f,null))[_0x4935('0x22')](function(_0xfa309e){if(_0xfa309e){_0x4c235f['model']=_[_0x4935('0x45')](db['Disposition']['rawAttributes']);_0x4c235f[_0x4935('0x44')]=_[_0x4935('0x45')](_0x26bbe[_0x4935('0x44')]);_0x4c235f[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x4c235f[_0x4935('0x43')],_0x4c235f[_0x4935('0x44')]);_0xd97c04[_0x4935('0x47')]=_['intersection'](_0x4c235f[_0x4935('0x43')],qs[_0x4935('0x48')](_0x26bbe[_0x4935('0x44')]['fields']));_0xd97c04['attributes']=_0xd97c04[_0x4935('0x47')][_0x4935('0x69')]?_0xd97c04['attributes']:_0x4c235f[_0x4935('0x43')];if(!_0x26bbe['query']['hasOwnProperty'](_0x4935('0x49'))){_0xd97c04[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x26bbe['query']['limit']);_0xd97c04[_0x4935('0x31')]=qs['offset'](_0x26bbe[_0x4935('0x44')]['offset']);}_0xd97c04[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x26bbe[_0x4935('0x44')][_0x4935('0x4c')]);_0xd97c04[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x26bbe['query'],_0x4c235f[_0x4935('0x4e')]));_0xd97c04['where'][_0x4935('0x65')]=_0xfa309e['id'];if(_0x26bbe[_0x4935('0x44')]['filter']){_0xd97c04[_0x4935('0x4d')]=_['merge'](_0xd97c04[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0xd97c04['attributes'],function(_0x582a2c){var _0x530e9f={};_0x530e9f[_0x582a2c]={'$like':'%'+_0x26bbe[_0x4935('0x44')]['filter']+'%'};return _0x530e9f;})});}_0xd97c04=_['merge']({},_0xd97c04,_0x26bbe[_0x4935('0x53')]);return db['Disposition'][_0x4935('0x30')]({'where':_0xd97c04['where']})['then'](function(_0x5c5978){_0x54be3b[_0x4935('0x30')]=_0x5c5978;if(_0x26bbe['query'][_0x4935('0x54')]){_0xd97c04[_0x4935('0x55')]=[{'all':!![]}];}return db[_0x4935('0x66')][_0x4935('0x56')](_0xd97c04);})[_0x4935('0x22')](function(_0x4a240b){_0x54be3b[_0x4935('0x57')]=_0x4a240b;return _0x54be3b;});}})[_0x4935('0x22')](respondWithFilteredResult(_0x15232f,_0xd97c04))['catch'](handleError(_0x15232f,null));};exports[_0x4935('0x6a')]=function(_0x9d01a9,_0x50df2a,_0x1ffef1){return db[_0x4935('0x3f')]['find']({'where':{'id':_0x9d01a9[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0x50df2a,null))[_0x4935('0x22')](function(_0x453bb1){if(_0x453bb1){return _0x453bb1['removeDispositions'](_0x9d01a9[_0x4935('0x44')][_0x4935('0x6b')]);}})['then'](respondWithStatusCode(_0x50df2a,null))['catch'](handleError(_0x50df2a,null));};exports[_0x4935('0x6c')]=function(_0x14dbfa,_0x49a767,_0x27ce22){if(_0x14dbfa[_0x4935('0x62')]['id']){delete _0x14dbfa[_0x4935('0x62')]['id'];}return db[_0x4935('0x3f')]['find']({'where':{'id':_0x14dbfa[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x49a767,null))['then'](function(_0x2f7897){if(_0x2f7897){_0x14dbfa[_0x4935('0x62')][_0x4935('0x65')]=_0x2f7897['id'];return db[_0x4935('0x6d')][_0x4935('0x5b')](_0x14dbfa[_0x4935('0x62')]);}})[_0x4935('0x22')](respondWithResult(_0x49a767,null))[_0x4935('0x2d')](handleError(_0x49a767,null));};exports[_0x4935('0x6e')]=function(_0x2978d7,_0x34f3d4,_0x50a14b){var _0x394367={'raw':![],'where':{}};var _0x3e8e54={};var _0x1e6d84={'count':0x0,'rows':[]};return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x2978d7['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x34f3d4,null))[_0x4935('0x22')](function(_0x4b9b39){if(_0x4b9b39){_0x3e8e54[_0x4935('0x43')]=_[_0x4935('0x45')](db['CannedAnswer'][_0x4935('0x59')]);_0x3e8e54[_0x4935('0x44')]=_[_0x4935('0x45')](_0x2978d7['query']);_0x3e8e54[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x3e8e54[_0x4935('0x43')],_0x3e8e54[_0x4935('0x44')]);_0x394367[_0x4935('0x47')]=_['intersection'](_0x3e8e54[_0x4935('0x43')],qs[_0x4935('0x48')](_0x2978d7[_0x4935('0x44')][_0x4935('0x48')]));_0x394367[_0x4935('0x47')]=_0x394367[_0x4935('0x47')]['length']?_0x394367[_0x4935('0x47')]:_0x3e8e54[_0x4935('0x43')];if(!_0x2978d7[_0x4935('0x44')][_0x4935('0x6f')](_0x4935('0x49'))){_0x394367[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x2978d7['query'][_0x4935('0x4a')]);_0x394367[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x2978d7[_0x4935('0x44')][_0x4935('0x31')]);}_0x394367['order']=qs['sort'](_0x2978d7[_0x4935('0x44')][_0x4935('0x4c')]);_0x394367[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x2978d7['query'],_0x3e8e54[_0x4935('0x4e')]));_0x394367[_0x4935('0x4d')][_0x4935('0x65')]=_0x4b9b39['id'];if(_0x2978d7['query'][_0x4935('0x50')]){_0x394367[_0x4935('0x4d')]=_[_0x4935('0x51')](_0x394367[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x394367[_0x4935('0x47')],function(_0xe60fe){var _0x47e1dd={};_0x47e1dd[_0xe60fe]={'$like':'%'+_0x2978d7[_0x4935('0x44')]['filter']+'%'};return _0x47e1dd;})});}_0x394367=_[_0x4935('0x51')]({},_0x394367,_0x2978d7['options']);return db['CannedAnswer'][_0x4935('0x30')]({'where':_0x394367['where']})['then'](function(_0x213fe3){_0x1e6d84[_0x4935('0x30')]=_0x213fe3;if(_0x2978d7['query'][_0x4935('0x54')]){_0x394367['include']=[{'all':!![]}];}return db[_0x4935('0x6d')][_0x4935('0x56')](_0x394367);})[_0x4935('0x22')](function(_0x22a8b8){_0x1e6d84[_0x4935('0x57')]=_0x22a8b8;return _0x1e6d84;});}})[_0x4935('0x22')](respondWithFilteredResult(_0x34f3d4,_0x394367))['catch'](handleError(_0x34f3d4,null));};exports[_0x4935('0x70')]=function(_0x16b1bb,_0xce134a,_0x5d53e6){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x16b1bb[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0xce134a,null))[_0x4935('0x22')](function(_0x44031e){if(_0x44031e){return _0x44031e[_0x4935('0x70')](_0x16b1bb[_0x4935('0x44')][_0x4935('0x6b')]);}})['then'](respondWithStatusCode(_0xce134a,null))[_0x4935('0x2d')](handleError(_0xce134a,null));};exports['addAgents']=function(_0x19fe30,_0x4bc3e7,_0x17dc59){return db['WhatsappAccount'][_0x4935('0x5a')]({'where':{'id':_0x19fe30[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4bc3e7,null))['then'](function(_0x31d209){if(_0x31d209){return _0x31d209[_0x4935('0x71')](_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')],_[_0x4935('0x72')](_0x19fe30[_0x4935('0x62')],[_0x4935('0x6b'),'id'])||{})[_0x4935('0x73')](function(_0xc4ce1d){for(var _0x575ca2=0x0;_0x575ca2<_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')][_0x4935('0x69')];_0x575ca2+=0x1){socket[_0x4935('0x74')](_0x4935('0x75'),{'UserId':_0x19fe30[_0x4935('0x62')][_0x4935('0x6b')][_0x575ca2],'WhatsappAccountId':_0x19fe30['params']['id']});}return _0xc4ce1d;});}})['then'](respondWithResult(_0x4bc3e7,null))[_0x4935('0x2d')](handleError(_0x4bc3e7,null));};exports['removeAgents']=function(_0x47ee06,_0x451ea8,_0x3a4266){return db[_0x4935('0x3f')][_0x4935('0x5a')]({'where':{'id':_0x47ee06['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x451ea8,null))[_0x4935('0x22')](function(_0x59e6b4){if(_0x59e6b4){return _0x59e6b4['removeAgents'](_0x47ee06['query']['ids'])['then'](function(){if(_[_0x4935('0x76')](_0x47ee06[_0x4935('0x44')]['ids'])){for(var _0x492bfb=0x0;_0x492bfb<_0x47ee06['query'][_0x4935('0x6b')][_0x4935('0x69')];_0x492bfb+=0x1){socket[_0x4935('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x47ee06['query']['ids'][_0x492bfb]),'WhatsappAccountId':Number(_0x47ee06[_0x4935('0x58')]['id'])});}}else{socket[_0x4935('0x74')](_0x4935('0x77'),{'UserId':Number(_0x47ee06[_0x4935('0x44')]['ids']),'WhatsappAccountId':Number(_0x47ee06[_0x4935('0x58')]['id'])});}});}})[_0x4935('0x22')](respondWithStatusCode(_0x451ea8,null))[_0x4935('0x2d')](handleError(_0x451ea8,null));};exports['getAgents']=function(_0x4f6984,_0x3568ea,_0x2f4b61){var _0x81f969={};var _0x281db3={};var _0x415fc2;var _0x255a60;return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x4f6984[_0x4935('0x58')]['id']}})['then'](handleEntityNotFound(_0x3568ea,null))[_0x4935('0x22')](function(_0x4120db){if(_0x4120db){_0x415fc2=_0x4120db;_0x281db3['model']=_['keys'](db[_0x4935('0x78')]['rawAttributes']);_0x281db3[_0x4935('0x44')]=_[_0x4935('0x45')](_0x4f6984['query']);_0x281db3[_0x4935('0x4e')]=_['intersection'](_0x281db3[_0x4935('0x43')],_0x281db3[_0x4935('0x44')]);_0x81f969['attributes']=_['intersection'](_0x281db3[_0x4935('0x43')],qs[_0x4935('0x48')](_0x4f6984[_0x4935('0x44')][_0x4935('0x48')]));_0x81f969[_0x4935('0x47')]=_0x81f969[_0x4935('0x47')][_0x4935('0x69')]?_0x81f969[_0x4935('0x47')]:_0x281db3['model'];_0x81f969['order']=qs[_0x4935('0x4c')](_0x4f6984[_0x4935('0x44')][_0x4935('0x4c')]);_0x81f969[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x4f6984[_0x4935('0x44')],_0x281db3[_0x4935('0x4e')]));if(_0x4f6984['query'][_0x4935('0x50')]){_0x81f969['where']=_[_0x4935('0x51')](_0x81f969['where'],{'$or':_[_0x4935('0x3e')](_0x81f969[_0x4935('0x47')],function(_0x31eaee){var _0x409d86={};_0x409d86[_0x31eaee]={'$like':'%'+_0x4f6984[_0x4935('0x44')]['filter']+'%'};return _0x409d86;})});}_0x81f969=_[_0x4935('0x51')]({},_0x81f969,_0x4f6984[_0x4935('0x53')]);return _0x415fc2[_0x4935('0x79')](_0x81f969);}})['then'](function(_0x4d4085){if(_0x4d4085){_0x255a60=_0x4d4085[_0x4935('0x69')];if(!_0x4f6984['query'][_0x4935('0x6f')](_0x4935('0x49'))){_0x81f969[_0x4935('0x4a')]=qs[_0x4935('0x4a')](_0x4f6984[_0x4935('0x44')]['limit']);_0x81f969[_0x4935('0x31')]=qs[_0x4935('0x31')](_0x4f6984[_0x4935('0x44')][_0x4935('0x31')]);}return _0x415fc2[_0x4935('0x79')](_0x81f969);}})['then'](function(_0x1058f2){if(_0x1058f2){return _0x1058f2?{'count':_0x255a60,'rows':_0x1058f2}:null;}})[_0x4935('0x22')](respondWithResult(_0x3568ea,null))[_0x4935('0x2d')](handleError(_0x3568ea,null));};exports[_0x4935('0x7a')]=function(_0x51a95e,_0x4aa286,_0x5b303b){return db['WhatsappAccount'][_0x4935('0x68')]({'where':{'id':_0x51a95e[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4aa286,null))[_0x4935('0x22')](function(_0x13921c){if(_0x13921c){return db[_0x4935('0x7b')][_0x4935('0x7c')](function(_0x9afab9){return db[_0x4935('0x7d')][_0x4935('0x37')]({'where':{'WhatsappAccountId':_0x51a95e['params']['id']},'transaction':_0x9afab9})[_0x4935('0x22')](function(_0x3508ac){var _0x37f88a=_[_0x4935('0x3e')](_0x51a95e[_0x4935('0x62')],function(_0x8ef56f){_0x8ef56f[_0x4935('0x65')]=_0x51a95e[_0x4935('0x58')]['id'];return _0x8ef56f;});return db[_0x4935('0x7d')]['bulkCreate'](_0x37f88a,{'transaction':_0x9afab9});});})['then'](function(){return db[_0x4935('0x7d')][_0x4935('0x7e')]({'where':{'WhatsappAccountId':_0x51a95e[_0x4935('0x58')]['id']},'order':_0x4935('0x7f')});});}})[_0x4935('0x22')](respondWithResult(_0x4aa286,null))[_0x4935('0x2d')](handleError(_0x4aa286,null));};exports[_0x4935('0x80')]=function(_0x15b50e,_0x4c6b62,_0xc2892a){var _0x290e25={};var _0x4f968d={};var _0x46f309;var _0x4bfd8f;return db[_0x4935('0x3f')][_0x4935('0x68')]({'where':{'id':_0x15b50e[_0x4935('0x58')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4c6b62,null))[_0x4935('0x22')](function(_0x37a095){if(_0x37a095){_0x46f309=_0x37a095;_0x4f968d[_0x4935('0x43')]=_[_0x4935('0x45')](db[_0x4935('0x7d')][_0x4935('0x59')]);_0x4f968d['query']=_[_0x4935('0x45')](_0x15b50e['query']);_0x4f968d[_0x4935('0x4e')]=_[_0x4935('0x46')](_0x4f968d[_0x4935('0x43')],_0x4f968d[_0x4935('0x44')]);_0x290e25[_0x4935('0x47')]=_['intersection'](_0x4f968d[_0x4935('0x43')],qs[_0x4935('0x48')](_0x15b50e[_0x4935('0x44')][_0x4935('0x48')]));_0x290e25[_0x4935('0x47')]=_0x290e25[_0x4935('0x47')][_0x4935('0x69')]?_0x290e25[_0x4935('0x47')]:_0x4f968d[_0x4935('0x43')];_0x290e25[_0x4935('0x4b')]=qs[_0x4935('0x4c')](_0x15b50e[_0x4935('0x44')]['sort']);_0x290e25[_0x4935('0x4d')]=qs[_0x4935('0x4e')](_[_0x4935('0x4f')](_0x15b50e['query'],_0x4f968d[_0x4935('0x4e')]));if(_0x15b50e['query'][_0x4935('0x50')]){_0x290e25[_0x4935('0x4d')]=_[_0x4935('0x51')](_0x290e25[_0x4935('0x4d')],{'$or':_[_0x4935('0x3e')](_0x290e25['attributes'],function(_0x3450d2){var _0x380f3d={};_0x380f3d[_0x3450d2]={'$like':'%'+_0x15b50e[_0x4935('0x44')][_0x4935('0x50')]+'%'};return _0x380f3d;})});}_0x290e25=_['merge']({},_0x290e25,_0x15b50e[_0x4935('0x53')]);return _0x46f309[_0x4935('0x80')](_0x290e25);}})[_0x4935('0x22')](function(_0x44de80){if(_0x44de80){_0x4bfd8f=_0x44de80[_0x4935('0x69')];if(!_0x15b50e[_0x4935('0x44')][_0x4935('0x6f')](_0x4935('0x49'))){_0x290e25['limit']=qs[_0x4935('0x4a')](_0x15b50e[_0x4935('0x44')][_0x4935('0x4a')]);_0x290e25['offset']=qs[_0x4935('0x31')](_0x15b50e[_0x4935('0x44')]['offset']);}return _0x46f309['getApplications'](_0x290e25);}})[_0x4935('0x22')](function(_0x30f6cd){if(_0x30f6cd){return _0x30f6cd?{'count':_0x4bfd8f,'rows':_0x30f6cd}:null;}})[_0x4935('0x22')](respondWithResult(_0x4c6b62,null))['catch'](handleError(_0x4c6b62,null));};exports['notify']=function(_0x4d0fc2,_0x1488f3,_0x8ca869){var _0x215de6={'channel':_0x4935('0x81')};var _0x303e9e=[];var _0x4ccbb7=[];var _0x15c87c={};return db['WhatsappAccount']['find']({'where':{'id':_0x4d0fc2['params']['id']},'include':[{'model':db[_0x4935('0x7d')],'as':_0x4935('0x82')}]})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))['then'](function(_0x384144){_0x215de6[_0x4935('0x83')]=_0x384144;_0x215de6[_0x4935('0x84')]=_['orderBy'](_0x384144[_0x4935('0x82')],[_0x4935('0x7f')],['asc']);if(_0x215de6['account'][_0x4935('0x82')]){delete _0x215de6['account'][_0x4935('0x82')];}return db[_0x4935('0x85')]['describe']();})[_0x4935('0x22')](function(_0x47a116){if(!_0x47a116){throw new db['Sequelize'][(_0x4935('0x20'))](_0x4935('0x86'));}_0x303e9e=_[_0x4935('0x87')](_[_0x4935('0x45')](_0x47a116),[_0x4935('0x88'),_0x4935('0x89')]);_0x4ccbb7=_[_0x4935('0x87')](_['keys'](_0x47a116),[_0x4935('0x88'),'updatedAt',_0x4935('0x8a'),_0x4935('0x8b')]);_0x215de6[_0x4935('0x62')]={'mapKey':_0x4935('0x8c')};if(_0x215de6[_0x4935('0x83')][_0x4935('0x41')]&&_0x215de6['account']['type']===_0x4935('0x8d')){_0x215de6[_0x4935('0x62')][_0x4935('0x8e')]=_0x4d0fc2[_0x4935('0x62')][_0x4935('0x8f')][_0x4935('0x90')]('whatsapp:','');_0x215de6[_0x4935('0x62')][_0x4935('0x62')]=_0x4d0fc2[_0x4935('0x62')]['Body'];_0x215de6['body'][_0x4935('0x91')]=_0x4d0fc2[_0x4935('0x62')][_0x4935('0x92')];}if(_0x215de6[_0x4935('0x62')]['id']){delete _0x215de6['body']['id'];}if(_[_0x4935('0x93')](_0x215de6[_0x4935('0x62')][_0x4935('0x8e')])){throw new db['Sequelize']['ValidationError'](_0x4935('0x94'));}if(_[_0x4935('0x93')](_0x215de6['body']['body'])||_0x215de6[_0x4935('0x62')][_0x4935('0x62')]===''){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x96'));}if(_[_0x4935('0x93')](_0x215de6['body'][_0x4935('0x97')])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x98')+_0x4ccbb7);}if(!_[_0x4935('0x99')](_0x4ccbb7,_0x215de6[_0x4935('0x62')]['mapKey'])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ccbb7);}_0x15c87c[_0x215de6[_0x4935('0x62')][_0x4935('0x97')]]=_0x215de6[_0x4935('0x62')]['from'];return db[_0x4935('0x9a')]['find']({'where':{'id':_0x215de6[_0x4935('0x83')]['ListId']},'include':[{'model':db[_0x4935('0x85')],'as':'Contacts','where':_0x15c87c,'limit':0x1,'order':[[_0x4935('0x89'),_0x4935('0x9b')]]}]});})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))[_0x4935('0x22')](function(_0x480708){if(_0x480708){_0x215de6[_0x4935('0x9c')]=_[_0x4935('0x72')](_0x480708,[_0x4935('0x9d')]);if(_0x480708[_0x4935('0x9d')][_0x4935('0x69')]){return _0x480708[_0x4935('0x9d')][0x0];}var _0x512e48=_['defaults'](_0x215de6['body'],{'firstName':_0x215de6['body']['from'],'ListId':_0x480708['id']});_0x512e48[_0x215de6[_0x4935('0x62')][_0x4935('0x97')]]=_0x215de6['body'][_0x4935('0x8e')];return db['CmContact'][_0x4935('0x5b')](_0x512e48,{'fields':_0x303e9e,'raw':!![]});}})[_0x4935('0x22')](handleEntityNotFound(_0x1488f3,null))['then'](function(_0x59154b){if(_0x59154b){_0x215de6[_0x4935('0x9e')]=_0x59154b;var _0x9d154a={'ContactId':_0x59154b['id'],'phone':_0x215de6['body']['from'],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id']};var _0x5bc89d={'ContactId':_0x59154b['id'],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x4935('0x5a')]({'where':_0x5bc89d})[_0x4935('0x22')](function(_0x2b47e8){if(_0x2b47e8){return[_0x2b47e8,![]];}return db[_0x4935('0x9f')][_0x4935('0x5b')](_0x9d154a)[_0x4935('0x22')](function(_0x3c61a9){return[_0x3c61a9,!![]];});});}})[_0x4935('0x73')](function(_0x4e1079,_0x48b8f5){_0x215de6[_0x4935('0xa0')]=_0x4e1079[_0x4935('0x5f')]({'plain':!![]});_0x215de6[_0x4935('0xa0')]['created']=![];if(_0x48b8f5){if(_0x215de6['account'][_0x4935('0xa1')]){_0x215de6['applications'][_0x4935('0xa2')]({'id':0x0,'priority':_0x215de6[_0x4935('0x84')][_0x4935('0x69')]+0x1,'app':'close','appdata':_0x4935('0xa3'),'interval':_0x4935('0xa4')});}_0x215de6[_0x4935('0xa0')][_0x4935('0xa5')]=!![];}return db[_0x4935('0xa6')][_0x4935('0x5b')]({'phone':_0x215de6[_0x4935('0x62')][_0x4935('0x8e')],'messageId':_0x215de6[_0x4935('0x62')][_0x4935('0x91')],'body':_0x215de6[_0x4935('0x62')][_0x4935('0x62')],'WhatsappAccountId':_0x4d0fc2[_0x4935('0x58')]['id'],'WhatsappInteractionId':_0x4e1079['id'],'direction':'in','ContactId':_0x4e1079[_0x4935('0xa7')],'AttachmentId':_0x215de6['body'][_0x4935('0xa8')]});})[_0x4935('0x22')](function(_0x445218){_0x215de6[_0x4935('0x2a')]=_0x445218;if(_0x215de6[_0x4935('0xa0')][_0x4935('0xa9')]){return db[_0x4935('0x78')][_0x4935('0x5a')]({'attributes':['id',_0x4935('0x3b')],'where':{'id':_0x215de6[_0x4935('0xa0')][_0x4935('0xa9')]}})[_0x4935('0x22')](function(_0x3a3f21){if(_0x3a3f21){_0x215de6[_0x4935('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4935('0xaa'),'appdata':_0x3a3f21[_0x4935('0x3b')]+','+(_0x215de6[_0x4935('0x83')][_0x4935('0xab')]||0xa),'interval':_0x4935('0xa4')});}return respondWithRpcPromise(_0x4935('0xac'),_0x4935('0xad'),_0x215de6);});}return respondWithRpcPromise(_0x4935('0xac'),'startRouting',_0x215de6);})['then'](function(_0x4ec0bb){if(_0x4ec0bb){var _0x1e0387=0xc8;var _0xbdfff=_0x4935('0xae');logger['info'](_0x4935('0x25'),_0xbdfff,_0x1e0387,_0x4935('0xaf'));logger[_0x4935('0x24')](_0x4935('0xb0'),_0xbdfff,_0x1e0387,_0x4935('0xaf'),JSON[_0x4935('0x27')](_0x4ec0bb));if(_0x215de6[_0x4935('0x83')]['type']===_0x4935('0x8d')){return _0x1488f3[_0x4935('0x2e')](_0x1e0387)[_0x4935('0xb1')](_0x4935('0xb2'),'text/xml')[_0x4935('0xb3')]('\x0a');}else{return _0x1488f3[_0x4935('0x2e')](_0x1e0387)['json'](_0x4ec0bb);}}})[_0x4935('0x2d')](handleError(_0x1488f3,null));};exports[_0x4935('0xb3')]=function(_0x4d26cc,_0x21d58e,_0x1603a3){var _0x12b0be,_0x80f86f,_0x594ae5;if(_[_0x4935('0x93')](_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')])||_0x4d26cc[_0x4935('0x62')]['body']===''){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))](_0x4935('0x96'));}if(_[_0x4935('0x93')](_0x4d26cc[_0x4935('0x62')]['to'])){throw new db[(_0x4935('0x95'))][(_0x4935('0x20'))]('to\x20is\x20mandatory');}_0x12b0be=_0x4d26cc[_0x4935('0x62')]['to'];return db[_0x4935('0x3f')]['find']({'where':{'id':_0x4d26cc[_0x4935('0x58')]['id']},'include':[{'model':db[_0x4935('0x9a')],'as':'List','include':[{'model':db[_0x4935('0x85')],'as':_0x4935('0x9d'),'where':{'mobile':_0x12b0be},'limit':0x1,'order':[[_0x4935('0x89'),'DESC']]}]}]})[_0x4935('0x22')](handleEntityNotFound(_0x21d58e,null))[_0x4935('0x22')](function(_0x3414ef){if(_0x3414ef&&_0x3414ef['List']){_0x80f86f=_0x3414ef[_0x4935('0x5f')]({'plain':!![]});if(_0x80f86f[_0x4935('0xb4')]&&_0x80f86f[_0x4935('0xb4')][_0x4935('0x9d')][_0x4935('0x69')]){return _0x80f86f[_0x4935('0xb4')][_0x4935('0x9d')][0x0];}return db[_0x4935('0x85')][_0x4935('0x5b')](_[_0x4935('0x17')](_0x4d26cc[_0x4935('0x62')],{'firstName':_0x12b0be,'mobile':_0x12b0be,'phone':_0x12b0be,'ListId':_0x80f86f['ListId']}));}})[_0x4935('0x22')](handleEntityNotFound(_0x21d58e,null))['then'](function(_0x1f705e){if(_0x1f705e){_0x594ae5=_0x1f705e;return db[_0x4935('0x9f')][_0x4935('0x5a')]({'where':{'ContactId':_0x594ae5['id'],'closed':![],'WhatsappAccountId':_0x80f86f['id']}})[_0x4935('0x22')](function(_0x1ed5c3){if(_0x1ed5c3){return[_0x1ed5c3,![]];}return db['WhatsappInteraction'][_0x4935('0x5b')]({'UserId':_0x4d26cc['user']['id'],'ContactId':_0x594ae5['id'],'WhatsappAccountId':_0x80f86f['id'],'phone':_0x12b0be,'firstMsgDirection':_0x4935('0xb5'),'Messages':[_[_0x4935('0x51')](_0x4d26cc[_0x4935('0x62')],{'read':![],'body':_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')],'phone':_0x12b0be,'WhatsappAccountId':_0x80f86f['id'],'UserId':_0x4d26cc[_0x4935('0x5c')]['id'],'ContactId':_0x594ae5['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x4935('0xb6')}]})[_0x4935('0x22')](function(_0xb8fab5){return[_0xb8fab5,!![]];});});}})[_0x4935('0x73')](function(_0x5a6050,_0x16f8e2){if(_0x16f8e2){return _0x5a6050;}return db['WhatsappMessage']['create'](_[_0x4935('0x51')](_0x4d26cc['body'],{'read':![],'body':_0x4d26cc[_0x4935('0x62')][_0x4935('0x62')],'phone':_0x12b0be,'WhatsappAccountId':_0x80f86f['id'],'WhatsappInteractionId':_0x5a6050['id'],'UserId':_0x4d26cc[_0x4935('0x5c')]['id'],'ContactId':_0x594ae5['id']}))[_0x4935('0x22')](function(_0x37f9b6){_0x5a6050[_0x4935('0xb7')]['Messages']=[];_0x5a6050['dataValues'][_0x4935('0xb6')][_0x4935('0xa2')](_0x37f9b6['dataValues']);return _0x5a6050;});})[_0x4935('0x22')](respondWithResult(_0x21d58e,null))[_0x4935('0x2d')](handleError(_0x21d58e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f024f2d..e6717b4 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 _0x292c=['hook','exports','events','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x369289,_0xb779d8){var _0x1c8ba4=function(_0x28cc27){while(--_0x28cc27){_0x369289['push'](_0x369289['shift']());}};_0x1c8ba4(++_0xb779d8);}(_0x292c,0x66));var _0xc292=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x292c[_0xb7b878];return _0x3c84b9;};'use strict';var EventEmitter=require(_0xc292('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xc292('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc292('0x2')](0x0);var events={'afterCreate':_0xc292('0x3'),'afterUpdate':_0xc292('0x4'),'afterDestroy':_0xc292('0x5')};function emitEvent(_0x50b478){return function(_0x1f14f9,_0x536154,_0x516f54){WhatsappAccountEvents[_0xc292('0x6')](_0x50b478+':'+_0x1f14f9['id'],_0x1f14f9);WhatsappAccountEvents[_0xc292('0x6')](_0x50b478,_0x1f14f9);_0x516f54(null);};}for(var e in events){if(events[_0xc292('0x7')](e)){var event=events[e];WhatsappAccount[_0xc292('0x8')](e,emitEvent(event));}}module[_0xc292('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0xd8ed88,_0x98b06d){var _0x37833c=function(_0xc784e1){while(--_0xc784e1){_0xd8ed88['push'](_0xd8ed88['shift']());}};_0x37833c(++_0x98b06d);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x32e2f6,_0x11e862){_0x32e2f6=_0x32e2f6-0x0;var _0x109fa7=_0x8ace[_0x32e2f6];return _0x109fa7;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var WhatsappAccount=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){WhatsappAccountEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);WhatsappAccountEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xe8ac('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index fc8a22b..44e18b7 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 _0x635f=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x17cde1,_0x454ce4){var _0x218678=function(_0x1fdca4){while(--_0x1fdca4){_0x17cde1['push'](_0x17cde1['shift']());}};_0x218678(++_0x454ce4);}(_0x635f,0x86));var _0xf635=function(_0x27a803,_0x40ee45){_0x27a803=_0x27a803-0x0;var _0x35cc1c=_0x635f[_0x27a803];return _0x35cc1c;};'use strict';var _=require(_0xf635('0x0'));var util=require(_0xf635('0x1'));var logger=require(_0xf635('0x2'))(_0xf635('0x3'));var moment=require('moment');var BPromise=require(_0xf635('0x4'));var rp=require(_0xf635('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf635('0x6'));var config=require(_0xf635('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xf635('0x8')]=function(_0x39a1d9,_0x143561){return _0x39a1d9[_0xf635('0x9')](_0xf635('0xa'),attributes,{'tableName':_0xf635('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf9e=['../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4c4261,_0x4a5d30){var _0x382b29=function(_0x47292f){while(--_0x47292f){_0x4c4261['push'](_0x4c4261['shift']());}};_0x382b29(++_0x4a5d30);}(_0xbf9e,0xf5));var _0xebf9=function(_0x317f8e,_0xfb7f9b){_0x317f8e=_0x317f8e-0x0;var _0x347bc0=_0xbf9e[_0x317f8e];return _0x347bc0;};'use strict';var _=require(_0xebf9('0x0'));var util=require('util');var logger=require(_0xebf9('0x1'))(_0xebf9('0x2'));var moment=require(_0xebf9('0x3'));var BPromise=require(_0xebf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebf9('0x5'));var rimraf=require(_0xebf9('0x6'));var config=require(_0xebf9('0x7'));var attributes=require(_0xebf9('0x8'));module['exports']=function(_0x2d96cc,_0x7e1951){return _0x2d96cc[_0xebf9('0x9')](_0xebf9('0xa'),attributes,{'tableName':_0xebf9('0xb'),'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 4586eb1..3546a70 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 _0xfd1b=['error','code','message','result','catch','ShowWhatsappAccount','options','raw','where','attributes','include','model','map','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ce652,_0x554422){var _0x309629=function(_0x38f7ad){while(--_0x38f7ad){_0x3ce652['push'](_0x3ce652['shift']());}};_0x309629(++_0x554422);}(_0xfd1b,0x157));var _0xbfd1=function(_0x235031,_0xff6a36){_0x235031=_0x235031-0x0;var _0x3fb06e=_0xfd1b[_0x235031];return _0x3fb06e;};'use strict';var _=require(_0xbfd1('0x0'));var util=require('util');var moment=require(_0xbfd1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfd1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfd1('0x3'));var logger=require(_0xbfd1('0x4'))('rpc');var config=require(_0xbfd1('0x5'));var jayson=require(_0xbfd1('0x6'));var client=jayson[_0xbfd1('0x7')][_0xbfd1('0x8')]({'port':0x232a});config[_0xbfd1('0x9')]=_['defaults'](config[_0xbfd1('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfd1('0x9')]));require(_0xbfd1('0xa'))[_0xbfd1('0xb')](socket);function respondWithRpcPromise(_0x3d7b27,_0x3371cb,_0x2f66fc){return new BPromise(function(_0x46cd00,_0x170ee4){return client[_0xbfd1('0xc')](_0x3d7b27,_0x2f66fc)[_0xbfd1('0xd')](function(_0x2e4416){logger[_0xbfd1('0xe')](_0xbfd1('0xf'),_0x3371cb,_0xbfd1('0x10'));logger[_0xbfd1('0x11')](_0xbfd1('0x12'),_0x3371cb,_0xbfd1('0x10'),JSON[_0xbfd1('0x13')](_0x2e4416));if(_0x2e4416[_0xbfd1('0x14')]){if(_0x2e4416[_0xbfd1('0x14')][_0xbfd1('0x15')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3371cb,_0x2e4416[_0xbfd1('0x14')][_0xbfd1('0x16')]);return _0x170ee4(_0x2e4416[_0xbfd1('0x14')]['message']);}logger['error'](_0xbfd1('0xf'),_0x3371cb,_0x2e4416['error'][_0xbfd1('0x16')]);return _0x46cd00(_0x2e4416[_0xbfd1('0x14')][_0xbfd1('0x16')]);}else{logger[_0xbfd1('0xe')](_0xbfd1('0xf'),_0x3371cb,'request\x20sent');_0x46cd00(_0x2e4416[_0xbfd1('0x17')][_0xbfd1('0x16')]);}})[_0xbfd1('0x18')](function(_0x3abad2){logger[_0xbfd1('0x14')](_0xbfd1('0xf'),_0x3371cb,_0x3abad2);_0x170ee4(_0x3abad2);});});}exports[_0xbfd1('0x19')]=function(_0x42caac){var _0x47dc40=this;return new Promise(function(_0x2e1b6d,_0x367f1b){return db['WhatsappAccount']['find']({'raw':_0x42caac[_0xbfd1('0x1a')]?_0x42caac[_0xbfd1('0x1a')][_0xbfd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x42caac[_0xbfd1('0x1a')]?_0x42caac[_0xbfd1('0x1a')][_0xbfd1('0x1c')]||null:null,'attributes':_0x42caac[_0xbfd1('0x1a')]?_0x42caac['options'][_0xbfd1('0x1d')]||null:null,'include':_0x42caac[_0xbfd1('0x1a')]?_0x42caac[_0xbfd1('0x1a')][_0xbfd1('0x1e')]?_['map'](_0x42caac[_0xbfd1('0x1a')][_0xbfd1('0x1e')],function(_0x459522){return{'model':db[_0x459522[_0xbfd1('0x1f')]],'as':_0x459522['as'],'attributes':_0x459522[_0xbfd1('0x1d')],'include':_0x459522[_0xbfd1('0x1e')]?_[_0xbfd1('0x20')](_0x459522[_0xbfd1('0x1e')],function(_0x5b70cd){return{'model':db[_0x5b70cd[_0xbfd1('0x1f')]],'as':_0x5b70cd['as'],'attributes':_0x5b70cd[_0xbfd1('0x1d')],'include':_0x5b70cd[_0xbfd1('0x1e')]?_[_0xbfd1('0x20')](_0x5b70cd[_0xbfd1('0x1e')],function(_0x142a5a){return{'model':db[_0x142a5a[_0xbfd1('0x1f')]],'as':_0x142a5a['as'],'attributes':_0x142a5a[_0xbfd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbfd1('0xd')](function(_0x3872c3){logger[_0xbfd1('0xe')](_0xbfd1('0x19'),_0x42caac);logger[_0xbfd1('0x11')](_0xbfd1('0x19'),_0x42caac,JSON[_0xbfd1('0x13')](_0x3872c3));_0x2e1b6d(_0x3872c3);})[_0xbfd1('0x18')](function(_0x4cf5d1){logger['error'](_0xbfd1('0x19'),_0x4cf5d1[_0xbfd1('0x16')],_0x42caac);_0x367f1b(_0x47dc40['error'](0x1f4,_0x4cf5d1[_0xbfd1('0x16')]));});});}; \ No newline at end of file +var _0xb0de=['ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb0de,0x1de));var _0xeb0d=function(_0x85c8e2,_0x327a){_0x85c8e2=_0x85c8e2-0x0;var _0x18c6ea=_0xb0de[_0x85c8e2];return _0x18c6ea;};'use strict';var _=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var moment=require(_0xeb0d('0x2'));var BPromise=require(_0xeb0d('0x3'));var rs=require(_0xeb0d('0x4'));var fs=require('fs');var Redis=require(_0xeb0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeb0d('0x6'));var logger=require(_0xeb0d('0x7'))('rpc');var config=require(_0xeb0d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb0d('0x9')][_0xeb0d('0xa')]({'port':0x232a});config[_0xeb0d('0xb')]=_[_0xeb0d('0xc')](config[_0xeb0d('0xb')],{'host':_0xeb0d('0xd'),'port':0x18eb});var socket=require(_0xeb0d('0xe'))(new Redis(config[_0xeb0d('0xb')]));require('./whatsappAccount.socket')[_0xeb0d('0xf')](socket);function respondWithRpcPromise(_0x279bc0,_0x3b47ae,_0x384de9){return new BPromise(function(_0x584418,_0x36d8c2){return client['request'](_0x279bc0,_0x384de9)['then'](function(_0xcb374a){logger[_0xeb0d('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x3b47ae,_0xeb0d('0x11'));logger[_0xeb0d('0x12')](_0xeb0d('0x13'),_0x3b47ae,_0xeb0d('0x11'),JSON[_0xeb0d('0x14')](_0xcb374a));if(_0xcb374a[_0xeb0d('0x15')]){if(_0xcb374a[_0xeb0d('0x15')][_0xeb0d('0x16')]===0x1f4){logger[_0xeb0d('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3b47ae,_0xcb374a[_0xeb0d('0x15')][_0xeb0d('0x17')]);return _0x36d8c2(_0xcb374a[_0xeb0d('0x15')][_0xeb0d('0x17')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3b47ae,_0xcb374a[_0xeb0d('0x15')][_0xeb0d('0x17')]);return _0x584418(_0xcb374a[_0xeb0d('0x15')]['message']);}else{logger[_0xeb0d('0x10')](_0xeb0d('0x18'),_0x3b47ae,_0xeb0d('0x11'));_0x584418(_0xcb374a[_0xeb0d('0x19')][_0xeb0d('0x17')]);}})['catch'](function(_0x3be364){logger['error'](_0xeb0d('0x18'),_0x3b47ae,_0x3be364);_0x36d8c2(_0x3be364);});});}exports[_0xeb0d('0x1a')]=function(_0x4a0e38){var _0x1b36a2=this;return new Promise(function(_0x2f1ef7,_0x59fa62){return db[_0xeb0d('0x1b')][_0xeb0d('0x1c')]({'raw':_0x4a0e38['options']?_0x4a0e38[_0xeb0d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4a0e38[_0xeb0d('0x1d')]?_0x4a0e38[_0xeb0d('0x1d')][_0xeb0d('0x1e')]||null:null,'attributes':_0x4a0e38['options']?_0x4a0e38['options']['attributes']||null:null,'include':_0x4a0e38[_0xeb0d('0x1d')]?_0x4a0e38[_0xeb0d('0x1d')][_0xeb0d('0x1f')]?_[_0xeb0d('0x20')](_0x4a0e38[_0xeb0d('0x1d')][_0xeb0d('0x1f')],function(_0x1ddb24){return{'model':db[_0x1ddb24[_0xeb0d('0x21')]],'as':_0x1ddb24['as'],'attributes':_0x1ddb24['attributes'],'include':_0x1ddb24['include']?_['map'](_0x1ddb24[_0xeb0d('0x1f')],function(_0x144743){return{'model':db[_0x144743[_0xeb0d('0x21')]],'as':_0x144743['as'],'attributes':_0x144743[_0xeb0d('0x22')],'include':_0x144743[_0xeb0d('0x1f')]?_[_0xeb0d('0x20')](_0x144743[_0xeb0d('0x1f')],function(_0x1b328f){return{'model':db[_0x1b328f[_0xeb0d('0x21')]],'as':_0x1b328f['as'],'attributes':_0x1b328f[_0xeb0d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7538){logger['info'](_0xeb0d('0x1a'),_0x4a0e38);logger[_0xeb0d('0x12')](_0xeb0d('0x1a'),_0x4a0e38,JSON[_0xeb0d('0x14')](_0x1b7538));_0x2f1ef7(_0x1b7538);})[_0xeb0d('0x23')](function(_0x44158a){logger[_0xeb0d('0x15')](_0xeb0d('0x1a'),_0x44158a[_0xeb0d('0x17')],_0x4a0e38);_0x59fa62(_0x1b36a2[_0xeb0d('0x15')](0x1f4,_0x44158a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 681e73a..0124ca0 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 _0x0787=['remove','emit','length','./whatsappAccount.events','save'];(function(_0x144776,_0x1a3b32){var _0x42a2c6=function(_0x3533a1){while(--_0x3533a1){_0x144776['push'](_0x144776['shift']());}};_0x42a2c6(++_0x1a3b32);}(_0x0787,0x17f));var _0x7078=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0787[_0x4b73a2];return _0x383c66;};'use strict';var WhatsappAccountEvents=require(_0x7078('0x0'));var events=[_0x7078('0x1'),_0x7078('0x2'),'update'];function createListener(_0x16991a,_0x2cf4f6){return function(_0x3ef6ab){_0x2cf4f6[_0x7078('0x3')](_0x16991a,_0x3ef6ab);};}function removeListener(_0x2c4b3c,_0x5e365a){return function(){WhatsappAccountEvents['removeListener'](_0x2c4b3c,_0x5e365a);};}exports['register']=function(_0x50e604){for(var _0x4faf43=0x0,_0x46199d=events[_0x7078('0x4')];_0x4faf43<_0x46199d;_0x4faf43++){var _0x2b3b63=events[_0x4faf43];var _0x2fac72=createListener('whatsappAccount:'+_0x2b3b63,_0x50e604);WhatsappAccountEvents['on'](_0x2b3b63,_0x2fac72);}}; \ No newline at end of file +var _0x1156=['update','removeListener','register','./whatsappAccount.events','save','remove'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0x1156,0x75));var _0x6115=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x1156[_0x22f8ab];return _0x2a70e5;};'use strict';var WhatsappAccountEvents=require(_0x6115('0x0'));var events=[_0x6115('0x1'),_0x6115('0x2'),_0x6115('0x3')];function createListener(_0x230bf7,_0x53cf9c){return function(_0x42a1ab){_0x53cf9c['emit'](_0x230bf7,_0x42a1ab);};}function removeListener(_0x4503cb,_0x1c43de){return function(){WhatsappAccountEvents[_0x6115('0x4')](_0x4503cb,_0x1c43de);};}exports[_0x6115('0x5')]=function(_0x3368de){for(var _0x44c5d9=0x0,_0x2f3f78=events['length'];_0x44c5d9<_0x2f3f78;_0x44c5d9++){var _0x4309d6=events[_0x44c5d9];var _0x4371b7=createListener('whatsappAccount:'+_0x4309d6,_0x3368de);WhatsappAccountEvents['on'](_0x4309d6,_0x4371b7);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 38ba99c..b1c8fdc 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 _0x809a=['/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x487702,_0x49f5d4){var _0x5e7150=function(_0x2b2b29){while(--_0x2b2b29){_0x487702['push'](_0x487702['shift']());}};_0x5e7150(++_0x49f5d4);}(_0x809a,0x93));var _0xa809=function(_0x2875ee,_0x6708a2){_0x2875ee=_0x2875ee-0x0;var _0x6531b4=_0x809a[_0x2875ee];return _0x6531b4;};'use strict';var multer=require(_0xa809('0x0'));var util=require(_0xa809('0x1'));var path=require(_0xa809('0x2'));var timeout=require(_0xa809('0x3'));var express=require(_0xa809('0x4'));var router=express[_0xa809('0x5')]();var auth=require(_0xa809('0x6'));var interaction=require(_0xa809('0x7'));var config=require(_0xa809('0x8'));var controller=require(_0xa809('0x9'));router[_0xa809('0xa')]('/',auth[_0xa809('0xb')](),controller[_0xa809('0xc')]);router[_0xa809('0xa')](_0xa809('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa809('0xe')]);router[_0xa809('0xf')]('/:id',auth[_0xa809('0xb')](),controller[_0xa809('0x10')]);router[_0xa809('0x11')](_0xa809('0xd'),auth[_0xa809('0xb')](),controller[_0xa809('0x12')]);module[_0xa809('0x13')]=router; \ No newline at end of file +var _0xd3d7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0xd3d7,0x18f));var _0x7d3d=function(_0x345833,_0x3e39d5){_0x345833=_0x345833-0x0;var _0x49c54d=_0xd3d7[_0x345833];return _0x49c54d;};'use strict';var multer=require(_0x7d3d('0x0'));var util=require(_0x7d3d('0x1'));var path=require(_0x7d3d('0x2'));var timeout=require(_0x7d3d('0x3'));var express=require(_0x7d3d('0x4'));var router=express[_0x7d3d('0x5')]();var auth=require(_0x7d3d('0x6'));var interaction=require(_0x7d3d('0x7'));var config=require(_0x7d3d('0x8'));var controller=require(_0x7d3d('0x9'));router['get']('/',auth[_0x7d3d('0xa')](),controller['index']);router[_0x7d3d('0xb')](_0x7d3d('0xc'),auth[_0x7d3d('0xa')](),controller[_0x7d3d('0xd')]);router[_0x7d3d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7d3d('0xf')](_0x7d3d('0xc'),auth[_0x7d3d('0xa')](),controller[_0x7d3d('0x10')]);router[_0x7d3d('0x11')](_0x7d3d('0xc'),auth[_0x7d3d('0xa')](),controller[_0x7d3d('0x12')]);module[_0x7d3d('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 160d872..4176b5b 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 _0xf293=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xf293,0xe2));var _0x3f29=function(_0x192d7e,_0xc19582){_0x192d7e=_0x192d7e-0x0;var _0x27d058=_0xf293[_0x192d7e];return _0x27d058;};'use strict';var Sequelize=require(_0x3f29('0x0'));module[_0x3f29('0x1')]={'priority':{'type':Sequelize[_0x3f29('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3f29('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f29('0x4')]()},'description':{'type':Sequelize[_0x3f29('0x3')]},'interval':{'type':Sequelize[_0x3f29('0x3')],'defaultValue':_0x3f29('0x5')}}; \ No newline at end of file +var _0xd56d=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x5b8ebd,_0x23a1db){var _0x43d6ce=function(_0x526ee3){while(--_0x526ee3){_0x5b8ebd['push'](_0x5b8ebd['shift']());}};_0x43d6ce(++_0x23a1db);}(_0xd56d,0x187));var _0xdd56=function(_0xb08125,_0x561acb){_0xb08125=_0xb08125-0x0;var _0x2ace23=_0xd56d[_0xb08125];return _0x2ace23;};'use strict';var Sequelize=require(_0xdd56('0x0'));module[_0xdd56('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdd56('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdd56('0x3')]()},'description':{'type':Sequelize[_0xdd56('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdd56('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 73c7af0..2f7e298 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 _0xaf2f=['keys','rawAttributes','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','save','then','destroy','end','sendStatus','error','stack','name','send','index','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','WhatsappApplication','findAll','rows','show','params'];(function(_0x662a05,_0x541cc5){var _0x421218=function(_0x18be53){while(--_0x18be53){_0x662a05['push'](_0x662a05['shift']());}};_0x421218(++_0x541cc5);}(_0xaf2f,0x1c3));var _0xfaf2=function(_0x3cd07a,_0x31e359){_0x3cd07a=_0x3cd07a-0x0;var _0xe2585f=_0xaf2f[_0x3cd07a];return _0xe2585f;};'use strict';var pdf=require(_0xfaf2('0x0'));var emlformat=require(_0xfaf2('0x1'));var rimraf=require(_0xfaf2('0x2'));var zipdir=require(_0xfaf2('0x3'));var jsonpatch=require(_0xfaf2('0x4'));var rp=require(_0xfaf2('0x5'));var moment=require(_0xfaf2('0x6'));var BPromise=require(_0xfaf2('0x7'));var Mustache=require(_0xfaf2('0x8'));var util=require(_0xfaf2('0x9'));var path=require(_0xfaf2('0xa'));var sox=require(_0xfaf2('0xb'));var csv=require(_0xfaf2('0xc'));var ejs=require(_0xfaf2('0xd'));var fs=require('fs');var _=require(_0xfaf2('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfaf2('0xf'));var deskjs=require(_0xfaf2('0x10'));var toCsv=require(_0xfaf2('0xc'));var querystring=require(_0xfaf2('0x11'));var Papa=require(_0xfaf2('0x12'));var Redis=require(_0xfaf2('0x13'));var authService=require(_0xfaf2('0x14'));var qs=require(_0xfaf2('0x15'));var as=require(_0xfaf2('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaf2('0x17'))('api');var utils=require(_0xfaf2('0x18'));var config=require(_0xfaf2('0x19'));var db=require(_0xfaf2('0x1a'))['db'];function respondWithStatusCode(_0x2f0854,_0x5de548){_0x5de548=_0x5de548||0xcc;return function(_0x5c0ff6){if(_0x5c0ff6){return _0x2f0854['sendStatus'](_0x5de548);}return _0x2f0854[_0xfaf2('0x1b')](_0x5de548)['end']();};}function respondWithResult(_0x2dc927,_0x4b59fe){_0x4b59fe=_0x4b59fe||0xc8;return function(_0x44bbbc){if(_0x44bbbc){return _0x2dc927[_0xfaf2('0x1b')](_0x4b59fe)['json'](_0x44bbbc);}};}function respondWithFilteredResult(_0x30e408,_0x5db572){return function(_0x459554){if(_0x459554){var _0x27dde4=_0x459554[_0xfaf2('0x1c')],_0x641a4a=_0x5db572[_0xfaf2('0x1d')],_0x2203a9=_0x5db572[_0xfaf2('0x1d')]+_0x5db572[_0xfaf2('0x1e')],_0x4fa3a5;if(_0x2203a9>=_0x27dde4){_0x2203a9=_0x27dde4;_0x4fa3a5=0xc8;}else{_0x4fa3a5=0xce;}_0x30e408[_0xfaf2('0x1b')](_0x4fa3a5);return _0x30e408[_0xfaf2('0x1f')](_0xfaf2('0x20'),_0x641a4a+'-'+_0x2203a9+'/'+_0x27dde4)[_0xfaf2('0x21')](_0x459554);}return null;};}function patchUpdates(_0x4058cb){return function(_0x4296b3){try{jsonpatch['apply'](_0x4296b3,_0x4058cb,!![]);}catch(_0x52b10c){return BPromise['reject'](_0x52b10c);}return _0x4296b3[_0xfaf2('0x22')]();};}function saveUpdates(_0x582608,_0x2fd49d){return function(_0x550f51){if(_0x550f51){return _0x550f51['update'](_0x582608)[_0xfaf2('0x23')](function(_0x33369a){return _0x33369a;});}return null;};}function removeEntity(_0x2cc549,_0x147d07){return function(_0x31cd87){if(_0x31cd87){return _0x31cd87[_0xfaf2('0x24')]()[_0xfaf2('0x23')](function(){_0x2cc549[_0xfaf2('0x1b')](0xcc)[_0xfaf2('0x25')]();});}};}function handleEntityNotFound(_0x2d9d78,_0x201cee){return function(_0x5b496a){if(!_0x5b496a){_0x2d9d78[_0xfaf2('0x26')](0x194);}return _0x5b496a;};}function handleError(_0x773478,_0x1d3726){_0x1d3726=_0x1d3726||0x1f4;return function(_0x56e014){logger[_0xfaf2('0x27')](_0x56e014[_0xfaf2('0x28')]);if(_0x56e014['name']){delete _0x56e014[_0xfaf2('0x29')];}_0x773478[_0xfaf2('0x1b')](_0x1d3726)[_0xfaf2('0x2a')](_0x56e014);};}exports[_0xfaf2('0x2b')]=function(_0x157c68,_0x1cdae3){var _0x59cfd0={},_0xee51f2={},_0x1a8f05={'count':0x0,'rows':[]};var _0x4eb6d3=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x2686e1){return{'name':_0x2686e1['fieldName'],'type':_0x2686e1[_0xfaf2('0x2c')][_0xfaf2('0x2d')]};});_0xee51f2[_0xfaf2('0x2e')]=_['map'](_0x4eb6d3,'name');_0xee51f2[_0xfaf2('0x2f')]=_['keys'](_0x157c68[_0xfaf2('0x2f')]);_0xee51f2[_0xfaf2('0x30')]=_[_0xfaf2('0x31')](_0xee51f2[_0xfaf2('0x2e')],_0xee51f2['query']);_0x59cfd0[_0xfaf2('0x32')]=_[_0xfaf2('0x31')](_0xee51f2[_0xfaf2('0x2e')],qs[_0xfaf2('0x33')](_0x157c68[_0xfaf2('0x2f')][_0xfaf2('0x33')]));_0x59cfd0[_0xfaf2('0x32')]=_0x59cfd0[_0xfaf2('0x32')][_0xfaf2('0x34')]?_0x59cfd0['attributes']:_0xee51f2[_0xfaf2('0x2e')];if(!_0x157c68['query'][_0xfaf2('0x35')]('nolimit')){_0x59cfd0[_0xfaf2('0x1e')]=qs[_0xfaf2('0x1e')](_0x157c68[_0xfaf2('0x2f')]['limit']);_0x59cfd0[_0xfaf2('0x1d')]=qs['offset'](_0x157c68[_0xfaf2('0x2f')]['offset']);}_0x59cfd0[_0xfaf2('0x36')]=qs['sort'](_0x157c68[_0xfaf2('0x2f')][_0xfaf2('0x37')]);_0x59cfd0['where']=qs['filters'](_['pick'](_0x157c68[_0xfaf2('0x2f')],_0xee51f2[_0xfaf2('0x30')]),_0x4eb6d3);if(_0x157c68[_0xfaf2('0x2f')]['filter']){_0x59cfd0[_0xfaf2('0x38')]=_[_0xfaf2('0x39')](_0x59cfd0[_0xfaf2('0x38')],{'$or':_['map'](_0x4eb6d3,function(_0x39a130){if(_0x39a130[_0xfaf2('0x2c')]!==_0xfaf2('0x3a')){var _0x1ee7ac={};_0x1ee7ac[_0x39a130[_0xfaf2('0x29')]]={'$like':'%'+_0x157c68[_0xfaf2('0x2f')][_0xfaf2('0x3b')]+'%'};return _0x1ee7ac;}})});}_0x59cfd0=_[_0xfaf2('0x39')]({},_0x59cfd0,_0x157c68[_0xfaf2('0x3c')]);var _0x51f9dd={'where':_0x59cfd0[_0xfaf2('0x38')]};return db['WhatsappApplication'][_0xfaf2('0x1c')](_0x51f9dd)[_0xfaf2('0x23')](function(_0x5684ab){_0x1a8f05[_0xfaf2('0x1c')]=_0x5684ab;if(_0x157c68[_0xfaf2('0x2f')][_0xfaf2('0x3d')]){_0x59cfd0['include']=[{'all':!![]}];}return db[_0xfaf2('0x3e')][_0xfaf2('0x3f')](_0x59cfd0);})[_0xfaf2('0x23')](function(_0x2001de){_0x1a8f05[_0xfaf2('0x40')]=_0x2001de;return _0x1a8f05;})[_0xfaf2('0x23')](respondWithFilteredResult(_0x1cdae3,_0x59cfd0))['catch'](handleError(_0x1cdae3,null));};exports[_0xfaf2('0x41')]=function(_0x45499f,_0x3995a0){var _0x31784c={'raw':!![],'where':{'id':_0x45499f[_0xfaf2('0x42')]['id']}},_0x4609ef={};_0x4609ef[_0xfaf2('0x2e')]=_[_0xfaf2('0x43')](db[_0xfaf2('0x3e')][_0xfaf2('0x44')]);_0x4609ef[_0xfaf2('0x2f')]=_[_0xfaf2('0x43')](_0x45499f['query']);_0x4609ef[_0xfaf2('0x30')]=_[_0xfaf2('0x31')](_0x4609ef[_0xfaf2('0x2e')],_0x4609ef[_0xfaf2('0x2f')]);_0x31784c[_0xfaf2('0x32')]=_[_0xfaf2('0x31')](_0x4609ef[_0xfaf2('0x2e')],qs[_0xfaf2('0x33')](_0x45499f[_0xfaf2('0x2f')][_0xfaf2('0x33')]));_0x31784c['attributes']=_0x31784c[_0xfaf2('0x32')][_0xfaf2('0x34')]?_0x31784c[_0xfaf2('0x32')]:_0x4609ef[_0xfaf2('0x2e')];if(_0x45499f[_0xfaf2('0x2f')]['includeAll']){_0x31784c['include']=[{'all':!![]}];}_0x31784c=_['merge']({},_0x31784c,_0x45499f[_0xfaf2('0x3c')]);return db[_0xfaf2('0x3e')][_0xfaf2('0x45')](_0x31784c)[_0xfaf2('0x23')](handleEntityNotFound(_0x3995a0,null))[_0xfaf2('0x23')](respondWithResult(_0x3995a0,null))[_0xfaf2('0x46')](handleError(_0x3995a0,null));};exports[_0xfaf2('0x47')]=function(_0x3d77fc,_0x6305c8){return db[_0xfaf2('0x3e')]['create'](_0x3d77fc[_0xfaf2('0x48')],{})[_0xfaf2('0x23')](respondWithResult(_0x6305c8,0xc9))[_0xfaf2('0x46')](handleError(_0x6305c8,null));};exports[_0xfaf2('0x49')]=function(_0x1f86dd,_0x26c951){if(_0x1f86dd[_0xfaf2('0x48')]['id']){delete _0x1f86dd[_0xfaf2('0x48')]['id'];}return db[_0xfaf2('0x3e')][_0xfaf2('0x45')]({'where':{'id':_0x1f86dd[_0xfaf2('0x42')]['id']}})['then'](handleEntityNotFound(_0x26c951,null))[_0xfaf2('0x23')](saveUpdates(_0x1f86dd['body'],null))['then'](respondWithResult(_0x26c951,null))['catch'](handleError(_0x26c951,null));};exports[_0xfaf2('0x24')]=function(_0x2f6217,_0x4bd0c7){return db[_0xfaf2('0x3e')][_0xfaf2('0x45')]({'where':{'id':_0x2f6217[_0xfaf2('0x42')]['id']}})[_0xfaf2('0x23')](handleEntityNotFound(_0x4bd0c7,null))[_0xfaf2('0x23')](removeEntity(_0x4bd0c7,null))['catch'](handleError(_0x4bd0c7,null));}; \ No newline at end of file +var _0xd4c9=['name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','options','find','create','body','update','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','then','destroy','sendStatus','error','send','map','WhatsappApplication','rawAttributes','key','model'];(function(_0x31b118,_0x2a0316){var _0x3d7331=function(_0x4b28fd){while(--_0x4b28fd){_0x31b118['push'](_0x31b118['shift']());}};_0x3d7331(++_0x2a0316);}(_0xd4c9,0x1d8));var _0x9d4c=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0xd4c9[_0x3d34da];return _0xcf6af8;};'use strict';var pdf=require(_0x9d4c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9d4c('0x1'));var zipdir=require(_0x9d4c('0x2'));var jsonpatch=require(_0x9d4c('0x3'));var rp=require('request-promise');var moment=require(_0x9d4c('0x4'));var BPromise=require(_0x9d4c('0x5'));var Mustache=require(_0x9d4c('0x6'));var util=require(_0x9d4c('0x7'));var path=require(_0x9d4c('0x8'));var sox=require(_0x9d4c('0x9'));var csv=require('to-csv');var ejs=require(_0x9d4c('0xa'));var fs=require('fs');var _=require(_0x9d4c('0xb'));var squel=require('squel');var crypto=require(_0x9d4c('0xc'));var jsforce=require(_0x9d4c('0xd'));var deskjs=require(_0x9d4c('0xe'));var toCsv=require(_0x9d4c('0xf'));var querystring=require(_0x9d4c('0x10'));var Papa=require(_0x9d4c('0x11'));var Redis=require(_0x9d4c('0x12'));var authService=require(_0x9d4c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9d4c('0x14'));var hardwareService=require(_0x9d4c('0x15'));var logger=require(_0x9d4c('0x16'))(_0x9d4c('0x17'));var utils=require(_0x9d4c('0x18'));var config=require(_0x9d4c('0x19'));var db=require(_0x9d4c('0x1a'))['db'];function respondWithStatusCode(_0x546e93,_0x119c87){_0x119c87=_0x119c87||0xcc;return function(_0x2d2c06){if(_0x2d2c06){return _0x546e93['sendStatus'](_0x119c87);}return _0x546e93[_0x9d4c('0x1b')](_0x119c87)[_0x9d4c('0x1c')]();};}function respondWithResult(_0x3f822a,_0x125d7b){_0x125d7b=_0x125d7b||0xc8;return function(_0x1e1f60){if(_0x1e1f60){return _0x3f822a[_0x9d4c('0x1b')](_0x125d7b)[_0x9d4c('0x1d')](_0x1e1f60);}};}function respondWithFilteredResult(_0x168805,_0x3f809f){return function(_0x5e74df){if(_0x5e74df){var _0x1cb318=_0x5e74df[_0x9d4c('0x1e')],_0x2b6a5c=_0x3f809f[_0x9d4c('0x1f')],_0x242439=_0x3f809f[_0x9d4c('0x1f')]+_0x3f809f[_0x9d4c('0x20')],_0x3de8ae;if(_0x242439>=_0x1cb318){_0x242439=_0x1cb318;_0x3de8ae=0xc8;}else{_0x3de8ae=0xce;}_0x168805[_0x9d4c('0x1b')](_0x3de8ae);return _0x168805[_0x9d4c('0x21')]('Content-Range',_0x2b6a5c+'-'+_0x242439+'/'+_0x1cb318)[_0x9d4c('0x1d')](_0x5e74df);}return null;};}function patchUpdates(_0x16e2f9){return function(_0x5c08b4){try{jsonpatch['apply'](_0x5c08b4,_0x16e2f9,!![]);}catch(_0x2c2eac){return BPromise[_0x9d4c('0x22')](_0x2c2eac);}return _0x5c08b4[_0x9d4c('0x23')]();};}function saveUpdates(_0x1a6d47,_0xd800af){return function(_0x2f75df){if(_0x2f75df){return _0x2f75df['update'](_0x1a6d47)[_0x9d4c('0x24')](function(_0x1fc31c){return _0x1fc31c;});}return null;};}function removeEntity(_0x56d7c4,_0x971820){return function(_0x41d52f){if(_0x41d52f){return _0x41d52f[_0x9d4c('0x25')]()[_0x9d4c('0x24')](function(){_0x56d7c4[_0x9d4c('0x1b')](0xcc)[_0x9d4c('0x1c')]();});}};}function handleEntityNotFound(_0x257faa,_0x4997f0){return function(_0x23ebb5){if(!_0x23ebb5){_0x257faa[_0x9d4c('0x26')](0x194);}return _0x23ebb5;};}function handleError(_0x45529c,_0x57690d){_0x57690d=_0x57690d||0x1f4;return function(_0xdeb223){logger[_0x9d4c('0x27')](_0xdeb223['stack']);if(_0xdeb223['name']){delete _0xdeb223['name'];}_0x45529c[_0x9d4c('0x1b')](_0x57690d)[_0x9d4c('0x28')](_0xdeb223);};}exports['index']=function(_0x4a6e8d,_0x5127b3){var _0x3a402f={},_0x532057={},_0x39abb3={'count':0x0,'rows':[]};var _0xf8f528=_[_0x9d4c('0x29')](db[_0x9d4c('0x2a')][_0x9d4c('0x2b')],function(_0x6f09d){return{'name':_0x6f09d['fieldName'],'type':_0x6f09d['type'][_0x9d4c('0x2c')]};});_0x532057[_0x9d4c('0x2d')]=_[_0x9d4c('0x29')](_0xf8f528,_0x9d4c('0x2e'));_0x532057['query']=_[_0x9d4c('0x2f')](_0x4a6e8d[_0x9d4c('0x30')]);_0x532057[_0x9d4c('0x31')]=_[_0x9d4c('0x32')](_0x532057[_0x9d4c('0x2d')],_0x532057[_0x9d4c('0x30')]);_0x3a402f[_0x9d4c('0x33')]=_[_0x9d4c('0x32')](_0x532057[_0x9d4c('0x2d')],qs[_0x9d4c('0x34')](_0x4a6e8d[_0x9d4c('0x30')][_0x9d4c('0x34')]));_0x3a402f[_0x9d4c('0x33')]=_0x3a402f[_0x9d4c('0x33')][_0x9d4c('0x35')]?_0x3a402f[_0x9d4c('0x33')]:_0x532057[_0x9d4c('0x2d')];if(!_0x4a6e8d['query'][_0x9d4c('0x36')]('nolimit')){_0x3a402f['limit']=qs['limit'](_0x4a6e8d['query'][_0x9d4c('0x20')]);_0x3a402f[_0x9d4c('0x1f')]=qs[_0x9d4c('0x1f')](_0x4a6e8d[_0x9d4c('0x30')]['offset']);}_0x3a402f[_0x9d4c('0x37')]=qs[_0x9d4c('0x38')](_0x4a6e8d[_0x9d4c('0x30')]['sort']);_0x3a402f[_0x9d4c('0x39')]=qs['filters'](_[_0x9d4c('0x3a')](_0x4a6e8d[_0x9d4c('0x30')],_0x532057[_0x9d4c('0x31')]),_0xf8f528);if(_0x4a6e8d[_0x9d4c('0x30')][_0x9d4c('0x3b')]){_0x3a402f[_0x9d4c('0x39')]=_[_0x9d4c('0x3c')](_0x3a402f[_0x9d4c('0x39')],{'$or':_['map'](_0xf8f528,function(_0x53095a){if(_0x53095a[_0x9d4c('0x3d')]!==_0x9d4c('0x3e')){var _0x319b32={};_0x319b32[_0x53095a['name']]={'$like':'%'+_0x4a6e8d['query']['filter']+'%'};return _0x319b32;}})});}_0x3a402f=_[_0x9d4c('0x3c')]({},_0x3a402f,_0x4a6e8d['options']);var _0x29d42a={'where':_0x3a402f[_0x9d4c('0x39')]};return db['WhatsappApplication']['count'](_0x29d42a)[_0x9d4c('0x24')](function(_0x3c99ea){_0x39abb3[_0x9d4c('0x1e')]=_0x3c99ea;if(_0x4a6e8d[_0x9d4c('0x30')][_0x9d4c('0x3f')]){_0x3a402f['include']=[{'all':!![]}];}return db[_0x9d4c('0x2a')][_0x9d4c('0x40')](_0x3a402f);})['then'](function(_0x1bf9cb){_0x39abb3[_0x9d4c('0x41')]=_0x1bf9cb;return _0x39abb3;})['then'](respondWithFilteredResult(_0x5127b3,_0x3a402f))[_0x9d4c('0x42')](handleError(_0x5127b3,null));};exports[_0x9d4c('0x43')]=function(_0x49fec8,_0x4c90e1){var _0x4f9d4d={'raw':!![],'where':{'id':_0x49fec8['params']['id']}},_0x44d91b={};_0x44d91b['model']=_[_0x9d4c('0x2f')](db[_0x9d4c('0x2a')]['rawAttributes']);_0x44d91b[_0x9d4c('0x30')]=_['keys'](_0x49fec8[_0x9d4c('0x30')]);_0x44d91b[_0x9d4c('0x31')]=_[_0x9d4c('0x32')](_0x44d91b['model'],_0x44d91b[_0x9d4c('0x30')]);_0x4f9d4d['attributes']=_[_0x9d4c('0x32')](_0x44d91b[_0x9d4c('0x2d')],qs[_0x9d4c('0x34')](_0x49fec8[_0x9d4c('0x30')][_0x9d4c('0x34')]));_0x4f9d4d[_0x9d4c('0x33')]=_0x4f9d4d[_0x9d4c('0x33')][_0x9d4c('0x35')]?_0x4f9d4d['attributes']:_0x44d91b[_0x9d4c('0x2d')];if(_0x49fec8[_0x9d4c('0x30')]['includeAll']){_0x4f9d4d['include']=[{'all':!![]}];}_0x4f9d4d=_['merge']({},_0x4f9d4d,_0x49fec8[_0x9d4c('0x44')]);return db['WhatsappApplication'][_0x9d4c('0x45')](_0x4f9d4d)[_0x9d4c('0x24')](handleEntityNotFound(_0x4c90e1,null))['then'](respondWithResult(_0x4c90e1,null))[_0x9d4c('0x42')](handleError(_0x4c90e1,null));};exports[_0x9d4c('0x46')]=function(_0x55f3c3,_0xd791da){return db[_0x9d4c('0x2a')][_0x9d4c('0x46')](_0x55f3c3[_0x9d4c('0x47')],{})['then'](respondWithResult(_0xd791da,0xc9))[_0x9d4c('0x42')](handleError(_0xd791da,null));};exports[_0x9d4c('0x48')]=function(_0x571c59,_0x41d8d9){if(_0x571c59[_0x9d4c('0x47')]['id']){delete _0x571c59[_0x9d4c('0x47')]['id'];}return db[_0x9d4c('0x2a')][_0x9d4c('0x45')]({'where':{'id':_0x571c59[_0x9d4c('0x49')]['id']}})['then'](handleEntityNotFound(_0x41d8d9,null))[_0x9d4c('0x24')](saveUpdates(_0x571c59[_0x9d4c('0x47')],null))[_0x9d4c('0x24')](respondWithResult(_0x41d8d9,null))['catch'](handleError(_0x41d8d9,null));};exports['destroy']=function(_0x4c915b,_0x39c0ab){return db[_0x9d4c('0x2a')]['find']({'where':{'id':_0x4c915b[_0x9d4c('0x49')]['id']}})[_0x9d4c('0x24')](handleEntityNotFound(_0x39c0ab,null))[_0x9d4c('0x24')](removeEntity(_0x39c0ab,null))[_0x9d4c('0x42')](handleError(_0x39c0ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index cdca517..56b7e7e 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 _0xce32=['moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0xecdc8,_0x37baa2){var _0x494fab=function(_0x3bf51e){while(--_0x3bf51e){_0xecdc8['push'](_0xecdc8['shift']());}};_0x494fab(++_0x37baa2);}(_0xce32,0x123));var _0x2ce3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ce3('0x0'));var util=require(_0x2ce3('0x1'));var logger=require(_0x2ce3('0x2'))('api');var moment=require(_0x2ce3('0x3'));var BPromise=require(_0x2ce3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ce3('0x5'));var rimraf=require(_0x2ce3('0x6'));var config=require(_0x2ce3('0x7'));var attributes=require(_0x2ce3('0x8'));module[_0x2ce3('0x9')]=function(_0x17ef5b,_0x360f23){return _0x17ef5b[_0x2ce3('0xa')](_0x2ce3('0xb'),attributes,{'tableName':_0x2ce3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ce3('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x10aa=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x10aa,0x182));var _0xa10a=function(_0x3e1bf6,_0x7959e4){_0x3e1bf6=_0x3e1bf6-0x0;var _0x126fef=_0x10aa[_0x3e1bf6];return _0x126fef;};'use strict';var _=require(_0xa10a('0x0'));var util=require('util');var logger=require(_0xa10a('0x1'))(_0xa10a('0x2'));var moment=require('moment');var BPromise=require(_0xa10a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa10a('0x4'));var rimraf=require(_0xa10a('0x5'));var config=require(_0xa10a('0x6'));var attributes=require(_0xa10a('0x7'));module[_0xa10a('0x8')]=function(_0x3a5cd5,_0x58b0ca){return _0x3a5cd5[_0xa10a('0x9')]('WhatsappApplication',attributes,{'tableName':_0xa10a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa10a('0xb'),'collate':_0xa10a('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index fd8df1f..5cc66db 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 _0x9fc5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment'];(function(_0x14a129,_0x319fc4){var _0x20d46d=function(_0x22a8ce){while(--_0x22a8ce){_0x14a129['push'](_0x14a129['shift']());}};_0x20d46d(++_0x319fc4);}(_0x9fc5,0xb6));var _0x59fc=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x9fc5[_0x5027b1];return _0x4a46cf;};'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});function respondWithRpcPromise(_0x13897f,_0x2c47fb,_0x55fa6d){return new BPromise(function(_0xdd2bb9,_0x313063){return client[_0x59fc('0xb')](_0x13897f,_0x55fa6d)[_0x59fc('0xc')](function(_0x39bc72){logger[_0x59fc('0xd')](_0x59fc('0xe'),_0x2c47fb,'request\x20sent');logger[_0x59fc('0xf')](_0x59fc('0x10'),_0x2c47fb,_0x59fc('0x11'),JSON[_0x59fc('0x12')](_0x39bc72));if(_0x39bc72[_0x59fc('0x13')]){if(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x14')]===0x1f4){logger['error'](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0x313063(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0xdd2bb9(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}else{logger['info'](_0x59fc('0xe'),_0x2c47fb,_0x59fc('0x11'));_0xdd2bb9(_0x39bc72['result'][_0x59fc('0x15')]);}})[_0x59fc('0x16')](function(_0x4162c4){logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x4162c4);_0x313063(_0x4162c4);});});} \ No newline at end of file +var _0x9fc5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment'];(function(_0x1b0e66,_0x552dce){var _0x43f2a8=function(_0x3b0bae){while(--_0x3b0bae){_0x1b0e66['push'](_0x1b0e66['shift']());}};_0x43f2a8(++_0x552dce);}(_0x9fc5,0xb6));var _0x59fc=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x9fc5[_0x1030ce];return _0x3367fd;};'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});function respondWithRpcPromise(_0x13897f,_0x2c47fb,_0x55fa6d){return new BPromise(function(_0xdd2bb9,_0x313063){return client[_0x59fc('0xb')](_0x13897f,_0x55fa6d)[_0x59fc('0xc')](function(_0x39bc72){logger[_0x59fc('0xd')](_0x59fc('0xe'),_0x2c47fb,'request\x20sent');logger[_0x59fc('0xf')](_0x59fc('0x10'),_0x2c47fb,_0x59fc('0x11'),JSON[_0x59fc('0x12')](_0x39bc72));if(_0x39bc72[_0x59fc('0x13')]){if(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x14')]===0x1f4){logger['error'](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0x313063(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0xdd2bb9(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}else{logger['info'](_0x59fc('0xe'),_0x2c47fb,_0x59fc('0x11'));_0xdd2bb9(_0x39bc72['result'][_0x59fc('0x15')]);}})[_0x59fc('0x16')](function(_0x4162c4){logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x4162c4);_0x313063(_0x4162c4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 5339605..ab3e83d 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 _0x7ba8=['removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x7ba8,0xe2));var _0x87ba=function(_0x4b3648,_0x402f41){_0x4b3648=_0x4b3648-0x0;var _0x11ab4a=_0x7ba8[_0x4b3648];return _0x11ab4a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87ba('0x0'));var timeout=require(_0x87ba('0x1'));var express=require(_0x87ba('0x2'));var router=express[_0x87ba('0x3')]();var auth=require(_0x87ba('0x4'));var interaction=require(_0x87ba('0x5'));var config=require(_0x87ba('0x6'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x87ba('0x7')](),controller[_0x87ba('0x8')]);router['get'](_0x87ba('0x9'),auth[_0x87ba('0x7')](),controller['describe']);router[_0x87ba('0xa')](_0x87ba('0xb'),auth['isAuthenticated'](),controller[_0x87ba('0xc')]);router[_0x87ba('0xa')](_0x87ba('0xd'),auth['isAuthenticated'](),controller[_0x87ba('0xe')]);router['get'](_0x87ba('0xf'),auth['isAuthenticated'](),controller[_0x87ba('0x10')]);router[_0x87ba('0x11')]('/',auth[_0x87ba('0x7')](),controller[_0x87ba('0x12')]);router[_0x87ba('0x11')](_0x87ba('0xd'),auth[_0x87ba('0x7')](),controller[_0x87ba('0x13')]);router[_0x87ba('0x11')](_0x87ba('0x14'),auth[_0x87ba('0x7')](),interaction[_0x87ba('0x15')](_0x87ba('0x16'),_0x87ba('0x17')),controller[_0x87ba('0x18')]);router[_0x87ba('0x19')](_0x87ba('0xb'),auth['isAuthenticated'](),interaction[_0x87ba('0x15')]('whatsapp',_0x87ba('0x1a')),controller[_0x87ba('0x1b')]);router[_0x87ba('0x1c')](_0x87ba('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x87ba('0x16'),_0x87ba('0x1d')),controller['destroy']);router['delete'](_0x87ba('0x14'),auth['isAuthenticated'](),controller[_0x87ba('0x1e')]);module[_0x87ba('0x1f')]=router; \ No newline at end of file +var _0x81a7=['path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','tracked','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x81a7,0x177));var _0x781a=function(_0x23b4b7,_0x6ed46){_0x23b4b7=_0x23b4b7-0x0;var _0x5ec8b1=_0x81a7[_0x23b4b7];return _0x5ec8b1;};'use strict';var multer=require(_0x781a('0x0'));var util=require(_0x781a('0x1'));var path=require(_0x781a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x781a('0x3'));var interaction=require(_0x781a('0x4'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x781a('0x5')]('/',auth[_0x781a('0x6')](),controller[_0x781a('0x7')]);router[_0x781a('0x5')](_0x781a('0x8'),auth[_0x781a('0x6')](),controller[_0x781a('0x9')]);router[_0x781a('0x5')](_0x781a('0xa'),auth[_0x781a('0x6')](),controller[_0x781a('0xb')]);router[_0x781a('0x5')](_0x781a('0xc'),auth[_0x781a('0x6')](),controller[_0x781a('0xd')]);router[_0x781a('0x5')](_0x781a('0xe'),auth[_0x781a('0x6')](),controller[_0x781a('0xf')]);router[_0x781a('0x10')]('/',auth['isAuthenticated'](),controller[_0x781a('0x11')]);router['post']('/:id/messages',auth[_0x781a('0x6')](),controller[_0x781a('0x12')]);router[_0x781a('0x10')](_0x781a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x781a('0x14'),_0x781a('0x15')),controller['addTags']);router['put'](_0x781a('0xa'),auth['isAuthenticated'](),interaction[_0x781a('0x16')](_0x781a('0x14'),_0x781a('0x17')),controller['update']);router[_0x781a('0x18')](_0x781a('0xa'),auth[_0x781a('0x6')](),interaction[_0x781a('0x16')]('whatsapp',_0x781a('0x19')),controller[_0x781a('0x1a')]);router[_0x781a('0x18')](_0x781a('0x13'),auth[_0x781a('0x6')](),controller[_0x781a('0x1b')]);module[_0x781a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 264b000..ac043c5 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 _0x5335=['BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x2a79a1,_0x537328){var _0x27137a=function(_0x199de6){while(--_0x199de6){_0x2a79a1['push'](_0x2a79a1['shift']());}};_0x27137a(++_0x537328);}(_0x5335,0x1da));var _0x5533=function(_0x38bd42,_0x2afe8f){_0x38bd42=_0x38bd42-0x0;var _0x3018bf=_0x5335[_0x38bd42];return _0x3018bf;};'use strict';var Sequelize=require(_0x5533('0x0'));var moment=require(_0x5533('0x1'));module['exports']={'closed':{'type':Sequelize[_0x5533('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5533('0x3')]},'disposition':{'type':Sequelize[_0x5533('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5533('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5533('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5533('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6882=['ENUM','out','moment','exports','BOOLEAN','STRING'];(function(_0x37c30c,_0x2a193b){var _0x34576b=function(_0x60fb5f){while(--_0x60fb5f){_0x37c30c['push'](_0x37c30c['shift']());}};_0x34576b(++_0x2a193b);}(_0x6882,0xb6));var _0x2688=function(_0x4b5c4f,_0x27731d){_0x4b5c4f=_0x4b5c4f-0x0;var _0x30180b=_0x6882[_0x4b5c4f];return _0x30180b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2688('0x0'));module[_0x2688('0x1')]={'closed':{'type':Sequelize[_0x2688('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2688('0x3')]},'note':{'type':Sequelize[_0x2688('0x3')]},'phone':{'type':Sequelize[_0x2688('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2688('0x4')]('in',_0x2688('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2688('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 19daee5..0e6a360 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 _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x205b5b,_0x29418d){var _0x4a37e5=function(_0x2cb862){while(--_0x2cb862){_0x205b5b['push'](_0x205b5b['shift']());}};_0x4a37e5(++_0x29418d);}(_0x814b,0x1a2));var _0xb814=function(_0x12d013,_0x286e4c){_0x12d013=_0x12d013-0x0;var _0x54220c=_0x814b[_0x12d013];return _0x54220c;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x5135e3,_0x5ac7fc){var _0x442f57=function(_0x2166df){while(--_0x2166df){_0x5135e3['push'](_0x5135e3['shift']());}};_0x442f57(++_0x5ac7fc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc4aa[_0x4f9b18];return _0x29f20c;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f25cf71..69f08e2 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 _0xcb87=['map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','setDataValue'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xcb87,0x1c2));var _0x7cb8=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xcb87[_0x256b72];return _0x2183e3;};'use strict';var EventEmitter=require(_0x7cb8('0x0'));var WhatsappInteraction=require(_0x7cb8('0x1'))['db'][_0x7cb8('0x2')];var WhatsappMessage=require(_0x7cb8('0x1'))['db'][_0x7cb8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7cb8('0x4')](0x0);var events={'afterCreate':_0x7cb8('0x5'),'afterUpdate':'update','afterDestroy':_0x7cb8('0x6')};function emitEvent(_0x700f4e){return function(_0x5c4bb7,_0x67b6d5,_0x5c1278){_0x5c4bb7[_0x7cb8('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2e9934){_0x5c4bb7[_0x7cb8('0x8')]('Users',_0x2e9934[_0x7cb8('0x9')](function(_0x4b1a54){return{'id':_0x4b1a54['id']};}));return WhatsappMessage[_0x7cb8('0xa')]({'where':{'WhatsappInteractionId':_0x5c4bb7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7cb8('0xb')](function(_0x328b00){_0x5c4bb7['setDataValue'](_0x7cb8('0xc'),_0x328b00[_0x7cb8('0xd')]);WhatsappInteractionEvents[_0x7cb8('0xe')](_0x700f4e+':'+_0x5c4bb7['id'],_0x5c4bb7);WhatsappInteractionEvents[_0x7cb8('0xe')](_0x700f4e,_0x5c4bb7);_0x5c1278(null);})[_0x7cb8('0xf')](_0x5c1278(null));};}for(var e in events){if(events[_0x7cb8('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x6730=['events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x6730,0xd2));var _0x0673=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x6730[_0x257a28];return _0x13bccc;};'use strict';var EventEmitter=require(_0x0673('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x0673('0x1')];var WhatsappMessage=require(_0x0673('0x2'))['db'][_0x0673('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0673('0x4')](0x0);var events={'afterCreate':_0x0673('0x5'),'afterUpdate':_0x0673('0x6'),'afterDestroy':_0x0673('0x7')};function emitEvent(_0x499ff4){return function(_0x1a1441,_0x4af5fe,_0x2433d0){_0x1a1441[_0x0673('0x8')]({'attributes':['id'],'raw':!![]})[_0x0673('0x9')](function(_0x3e66e4){_0x1a1441[_0x0673('0xa')](_0x0673('0xb'),_0x3e66e4[_0x0673('0xc')](function(_0x549fd1){return{'id':_0x549fd1['id']};}));return WhatsappMessage[_0x0673('0xd')]({'where':{'WhatsappInteractionId':_0x1a1441['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0673('0x9')](function(_0x20ead6){_0x1a1441['setDataValue'](_0x0673('0xe'),_0x20ead6[_0x0673('0xf')]);WhatsappInteractionEvents[_0x0673('0x10')](_0x499ff4+':'+_0x1a1441['id'],_0x1a1441);WhatsappInteractionEvents[_0x0673('0x10')](_0x499ff4,_0x1a1441);_0x2433d0(null);})[_0x0673('0x11')](_0x2433d0(null));};}for(var e in events){if(events[_0x0673('0x12')](e)){var event=events[e];WhatsappInteraction[_0x0673('0x13')](e,emitEvent(event));}}module[_0x0673('0x14')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index bc0b58e..4f471b9 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 _0xcadb=['WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','path','./whatsappInteraction.attributes','exports','define'];(function(_0xe576b8,_0x499570){var _0x500a99=function(_0x2fee3a){while(--_0x2fee3a){_0xe576b8['push'](_0xe576b8['shift']());}};_0x500a99(++_0x499570);}(_0xcadb,0xae));var _0xbcad=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xcadb[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0xbcad('0x0'));var util=require('util');var logger=require(_0xbcad('0x1'))(_0xbcad('0x2'));var moment=require(_0xbcad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbcad('0x5'));module[_0xbcad('0x6')]=function(_0x2cd11f,_0x35f0ab){return _0x2cd11f[_0xbcad('0x7')](_0xbcad('0x8'),attributes,{'tableName':_0xbcad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33eee6,_0x5971c4,_0x458a15){if(_0x33eee6[_0xbcad('0xa')]('closed')){_0x33eee6[_0xbcad('0xb')]=moment()[_0xbcad('0xc')](_0xbcad('0xd'));}_0x458a15(null,_0x33eee6);}}});}; \ No newline at end of file +var _0x934e=['changed','closed','closedAt','format','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions'];(function(_0x5a120a,_0x549591){var _0x3b94b4=function(_0x21d60c){while(--_0x21d60c){_0x5a120a['push'](_0x5a120a['shift']());}};_0x3b94b4(++_0x549591);}(_0x934e,0x1c4));var _0xe934=function(_0x4e46c8,_0x4d5b49){_0x4e46c8=_0x4e46c8-0x0;var _0x50e1ff=_0x934e[_0x4e46c8];return _0x50e1ff;};'use strict';var _=require(_0xe934('0x0'));var util=require(_0xe934('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe934('0x2'));var rp=require(_0xe934('0x3'));var fs=require('fs');var path=require(_0xe934('0x4'));var rimraf=require(_0xe934('0x5'));var config=require(_0xe934('0x6'));var attributes=require(_0xe934('0x7'));module[_0xe934('0x8')]=function(_0x49a2a6,_0x228014){return _0x49a2a6['define']('WhatsappInteraction',attributes,{'tableName':_0xe934('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x149e2e,_0x179e3c,_0x5e80d6){if(_0x149e2e[_0xe934('0xa')](_0xe934('0xb'))){_0x149e2e[_0xe934('0xc')]=moment()[_0xe934('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e80d6(null,_0x149e2e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 41a93d8..e6366ff 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 _0x864b=['WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','WhatsappInteraction,\x20%s,\x20%s','catch','WhatsappInteraction','update','body','options','raw','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x864b,0x68));var _0xb864=function(_0x3a9223,_0x52dd1a){_0x3a9223=_0x3a9223-0x0;var _0x2c9f0c=_0x864b[_0x3a9223];return _0x2c9f0c;};'use strict';var _=require(_0xb864('0x0'));var util=require(_0xb864('0x1'));var moment=require(_0xb864('0x2'));var BPromise=require(_0xb864('0x3'));var rs=require(_0xb864('0x4'));var fs=require('fs');var Redis=require(_0xb864('0x5'));var db=require(_0xb864('0x6'))['db'];var utils=require(_0xb864('0x7'));var logger=require(_0xb864('0x8'))('rpc');var config=require(_0xb864('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb864('0xa')][_0xb864('0xb')]({'port':0x232a});config[_0xb864('0xc')]=_['defaults'](config[_0xb864('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb864('0xd'))(new Redis(config[_0xb864('0xc')]));require('./whatsappInteraction.socket')[_0xb864('0xe')](socket);function respondWithRpcPromise(_0x2113a0,_0x31db9c,_0x45f26e){return new BPromise(function(_0x349ddb,_0x4cae54){return client[_0xb864('0xf')](_0x2113a0,_0x45f26e)[_0xb864('0x10')](function(_0x5dfd11){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x31db9c,_0xb864('0x11'));logger[_0xb864('0x12')](_0xb864('0x13'),_0x31db9c,_0xb864('0x11'),JSON['stringify'](_0x5dfd11));if(_0x5dfd11[_0xb864('0x14')]){if(_0x5dfd11[_0xb864('0x14')][_0xb864('0x15')]===0x1f4){logger[_0xb864('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x31db9c,_0x5dfd11[_0xb864('0x14')][_0xb864('0x16')]);return _0x4cae54(_0x5dfd11[_0xb864('0x14')][_0xb864('0x16')]);}logger[_0xb864('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x31db9c,_0x5dfd11[_0xb864('0x14')][_0xb864('0x16')]);return _0x349ddb(_0x5dfd11[_0xb864('0x14')][_0xb864('0x16')]);}else{logger[_0xb864('0x17')](_0xb864('0x18'),_0x31db9c,_0xb864('0x11'));_0x349ddb(_0x5dfd11['result'][_0xb864('0x16')]);}})[_0xb864('0x19')](function(_0x425543){logger['error'](_0xb864('0x18'),_0x31db9c,_0x425543);_0x4cae54(_0x425543);});});}exports['UpdateWhatsappInteraction']=function(_0x1a8ac3){var _0x159079=this;return new Promise(function(_0x2aff82,_0x291413){return db[_0xb864('0x1a')][_0xb864('0x1b')](_0x1a8ac3[_0xb864('0x1c')],{'raw':_0x1a8ac3[_0xb864('0x1d')]?_0x1a8ac3[_0xb864('0x1d')][_0xb864('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a8ac3[_0xb864('0x1d')]?_0x1a8ac3['options']['where']||null:null,'attributes':_0x1a8ac3[_0xb864('0x1d')]?_0x1a8ac3['options']['attributes']||null:null,'limit':_0x1a8ac3[_0xb864('0x1d')]?_0x1a8ac3['options'][_0xb864('0x1f')]||null:null})['then'](function(_0x468042){logger[_0xb864('0x17')]('UpdateWhatsappInteraction',_0x1a8ac3);logger[_0xb864('0x12')]('UpdateWhatsappInteraction',_0x1a8ac3,JSON['stringify'](_0x468042));_0x2aff82(_0x468042);})['catch'](function(_0x33dedc){logger[_0xb864('0x14')](_0xb864('0x20'),_0x33dedc['message'],_0x1a8ac3);_0x291413(_0x159079[_0xb864('0x14')](0x1f4,_0x33dedc[_0xb864('0x16')]));});});};exports[_0xb864('0x21')]=function(_0x4c71ae){return new Promise(function(_0x2f3cf1,_0x56554d){return db[_0xb864('0x1a')][_0xb864('0x22')]({'where':_0x4c71ae[_0xb864('0x1d')]?_0x4c71ae['options'][_0xb864('0x23')]||null:null})['then'](function(_0x4614e9){if(_0x4614e9){return _0x4614e9[_0xb864('0x24')](_0x4c71ae['body'][_0xb864('0x25')],_[_0xb864('0x26')](_0x4c71ae[_0xb864('0x1c')],['ids','id'])||{});}})[_0xb864('0x27')](function(_0x2fa2a8){logger[_0xb864('0x17')]('AddTags',_0x4c71ae);logger[_0xb864('0x12')](_0xb864('0x28'),_0x4c71ae,JSON['stringify'](_0x2fa2a8));_0x2f3cf1(_0x2fa2a8);})['catch'](function(_0x2b63a3){logger[_0xb864('0x14')](_0xb864('0x28'),_0x2b63a3[_0xb864('0x16')],_0x4c71ae);_0x56554d(_this[_0xb864('0x14')](0x1f4,_0x2b63a3['message']));});});}; \ No newline at end of file +var _0xcb98=['debug','AddTagsToWhatsappInteraction','addTags','ids','omit','body','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','limit'];(function(_0x585b48,_0x4fc195){var _0x368f29=function(_0x25b6ac){while(--_0x25b6ac){_0x585b48['push'](_0x585b48['shift']());}};_0x368f29(++_0x4fc195);}(_0xcb98,0x82));var _0x8cb9=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xcb98[_0x102e37];return _0x35a07c;};'use strict';var _=require('lodash');var util=require(_0x8cb9('0x0'));var moment=require(_0x8cb9('0x1'));var BPromise=require(_0x8cb9('0x2'));var rs=require(_0x8cb9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cb9('0x4'))['db'];var utils=require(_0x8cb9('0x5'));var logger=require(_0x8cb9('0x6'))(_0x8cb9('0x7'));var config=require(_0x8cb9('0x8'));var jayson=require(_0x8cb9('0x9'));var client=jayson[_0x8cb9('0xa')][_0x8cb9('0xb')]({'port':0x232a});config[_0x8cb9('0xc')]=_[_0x8cb9('0xd')](config[_0x8cb9('0xc')],{'host':_0x8cb9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8cb9('0xf'))[_0x8cb9('0x10')](socket);function respondWithRpcPromise(_0x3cb865,_0x1648ad,_0x4aa0ed){return new BPromise(function(_0x31b40f,_0x345d31){return client[_0x8cb9('0x11')](_0x3cb865,_0x4aa0ed)[_0x8cb9('0x12')](function(_0x33a88b){logger['info'](_0x8cb9('0x13'),_0x1648ad,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1648ad,'request\x20sent',JSON[_0x8cb9('0x14')](_0x33a88b));if(_0x33a88b['error']){if(_0x33a88b[_0x8cb9('0x15')]['code']===0x1f4){logger[_0x8cb9('0x15')](_0x8cb9('0x13'),_0x1648ad,_0x33a88b[_0x8cb9('0x15')][_0x8cb9('0x16')]);return _0x345d31(_0x33a88b['error'][_0x8cb9('0x16')]);}logger[_0x8cb9('0x15')](_0x8cb9('0x13'),_0x1648ad,_0x33a88b[_0x8cb9('0x15')][_0x8cb9('0x16')]);return _0x31b40f(_0x33a88b[_0x8cb9('0x15')][_0x8cb9('0x16')]);}else{logger[_0x8cb9('0x17')](_0x8cb9('0x13'),_0x1648ad,_0x8cb9('0x18'));_0x31b40f(_0x33a88b[_0x8cb9('0x19')][_0x8cb9('0x16')]);}})[_0x8cb9('0x1a')](function(_0xe1b1e9){logger[_0x8cb9('0x15')](_0x8cb9('0x13'),_0x1648ad,_0xe1b1e9);_0x345d31(_0xe1b1e9);});});}exports[_0x8cb9('0x1b')]=function(_0x40810c){var _0x4e8b0e=this;return new Promise(function(_0x4d56f4,_0xa15a73){return db[_0x8cb9('0x1c')][_0x8cb9('0x1d')](_0x40810c['body'],{'raw':_0x40810c[_0x8cb9('0x1e')]?_0x40810c[_0x8cb9('0x1e')][_0x8cb9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40810c[_0x8cb9('0x1e')]?_0x40810c[_0x8cb9('0x1e')][_0x8cb9('0x20')]||null:null,'attributes':_0x40810c['options']?_0x40810c[_0x8cb9('0x1e')]['attributes']||null:null,'limit':_0x40810c['options']?_0x40810c[_0x8cb9('0x1e')][_0x8cb9('0x21')]||null:null})[_0x8cb9('0x12')](function(_0x9a6f4d){logger['info'](_0x8cb9('0x1b'),_0x40810c);logger[_0x8cb9('0x22')](_0x8cb9('0x1b'),_0x40810c,JSON['stringify'](_0x9a6f4d));_0x4d56f4(_0x9a6f4d);})['catch'](function(_0x1a0cb6){logger[_0x8cb9('0x15')](_0x8cb9('0x1b'),_0x1a0cb6[_0x8cb9('0x16')],_0x40810c);_0xa15a73(_0x4e8b0e[_0x8cb9('0x15')](0x1f4,_0x1a0cb6['message']));});});};exports[_0x8cb9('0x23')]=function(_0x2f6986){return new Promise(function(_0x16d81e,_0x18d8e5){return db['WhatsappInteraction']['find']({'where':_0x2f6986[_0x8cb9('0x1e')]?_0x2f6986['options']['where']||null:null})[_0x8cb9('0x12')](function(_0x3e7ed5){if(_0x3e7ed5){return _0x3e7ed5[_0x8cb9('0x24')](_0x2f6986['body'][_0x8cb9('0x25')],_[_0x8cb9('0x26')](_0x2f6986[_0x8cb9('0x27')],['ids','id'])||{});}})['spread'](function(_0x1290c3){logger[_0x8cb9('0x17')](_0x8cb9('0x28'),_0x2f6986);logger[_0x8cb9('0x22')](_0x8cb9('0x28'),_0x2f6986,JSON[_0x8cb9('0x14')](_0x1290c3));_0x16d81e(_0x1290c3);})['catch'](function(_0x397232){logger[_0x8cb9('0x15')](_0x8cb9('0x28'),_0x397232[_0x8cb9('0x16')],_0x2f6986);_0x18d8e5(_this[_0x8cb9('0x15')](0x1f4,_0x397232['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2265ab0..dcdc93a 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 _0x2970=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x4c9939,_0x551483){var _0x1323bc=function(_0x948d6d){while(--_0x948d6d){_0x4c9939['push'](_0x4c9939['shift']());}};_0x1323bc(++_0x551483);}(_0x2970,0xfd));var _0x0297=function(_0x13651c,_0x1b81c5){_0x13651c=_0x13651c-0x0;var _0xc6ea66=_0x2970[_0x13651c];return _0xc6ea66;};'use strict';var WhatsappInteractionEvents=require(_0x0297('0x0'));var events=[_0x0297('0x1'),_0x0297('0x2'),'update'];function createListener(_0xcb625d,_0x226a3a){return function(_0x2e6726){_0x226a3a[_0x0297('0x3')](_0xcb625d,_0x2e6726);};}function removeListener(_0x2d2cfb,_0x203c49){return function(){WhatsappInteractionEvents[_0x0297('0x4')](_0x2d2cfb,_0x203c49);};}exports[_0x0297('0x5')]=function(_0x42fe47){for(var _0x5dcb6d=0x0,_0x163284=events[_0x0297('0x6')];_0x5dcb6d<_0x163284;_0x5dcb6d++){var _0x359ac1=events[_0x5dcb6d];var _0x601e73=createListener(_0x0297('0x7')+_0x359ac1,_0x42fe47);WhatsappInteractionEvents['on'](_0x359ac1,_0x601e73);}}; \ No newline at end of file +var _0x2148=['register','length','whatsappInteraction:','./whatsappInteraction.events','removeListener'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x2148,0xd0));var _0x8214=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x2148[_0x5d8018];return _0x151ac4;};'use strict';var WhatsappInteractionEvents=require(_0x8214('0x0'));var events=['save','remove','update'];function createListener(_0x2d5b78,_0xaade6b){return function(_0x43ed0e){_0xaade6b['emit'](_0x2d5b78,_0x43ed0e);};}function removeListener(_0x5280ec,_0x47b20d){return function(){WhatsappInteractionEvents[_0x8214('0x1')](_0x5280ec,_0x47b20d);};}exports[_0x8214('0x2')]=function(_0x15b73d){for(var _0x2682b3=0x0,_0x9d25e6=events[_0x8214('0x3')];_0x2682b3<_0x9d25e6;_0x2682b3++){var _0x490414=events[_0x2682b3];var _0x154c00=createListener(_0x8214('0x4')+_0x490414,_0x15b73d);WhatsappInteractionEvents['on'](_0x490414,_0x154c00);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b30e484..a584679 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 _0x1339=['whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp'];(function(_0x44fc33,_0x480283){var _0x1e64a1=function(_0x2b642b){while(--_0x2b642b){_0x44fc33['push'](_0x44fc33['shift']());}};_0x1e64a1(++_0x480283);}(_0x1339,0x1ad));var _0x9133=function(_0x4d263e,_0x4291d4){_0x4d263e=_0x4d263e-0x0;var _0x2262d3=_0x1339[_0x4d263e];return _0x2262d3;};'use strict';var multer=require('multer');var util=require(_0x9133('0x0'));var path=require(_0x9133('0x1'));var timeout=require(_0x9133('0x2'));var express=require(_0x9133('0x3'));var router=express[_0x9133('0x4')]();var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require(_0x9133('0x8'));router[_0x9133('0x9')]('/',auth[_0x9133('0xa')](),controller[_0x9133('0xb')]);router[_0x9133('0x9')](_0x9133('0xc'),auth[_0x9133('0xa')](),controller[_0x9133('0xd')]);router[_0x9133('0x9')](_0x9133('0xe'),auth[_0x9133('0xa')](),controller[_0x9133('0xf')]);router[_0x9133('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9133('0x11')](_0x9133('0x12'),_0x9133('0x13')),controller[_0x9133('0x14')]);router[_0x9133('0x10')](_0x9133('0x15'),controller[_0x9133('0x16')]);router[_0x9133('0x17')](_0x9133('0xe'),auth[_0x9133('0xa')](),controller['update']);router[_0x9133('0x17')](_0x9133('0x18'),auth[_0x9133('0xa')](),controller[_0x9133('0x19')]);router['put']('/:id/reject',auth[_0x9133('0xa')](),controller['reject']);router[_0x9133('0x1a')](_0x9133('0xe'),auth[_0x9133('0xa')](),controller['destroy']);module[_0x9133('0x1b')]=router; \ No newline at end of file +var _0x6a01=['/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated'];(function(_0xf7f967,_0x1dbb69){var _0x70d7f8=function(_0x5d6cca){while(--_0x5d6cca){_0xf7f967['push'](_0xf7f967['shift']());}};_0x70d7f8(++_0x1dbb69);}(_0x6a01,0x1c9));var _0x16a0=function(_0x409682,_0x370090){_0x409682=_0x409682-0x0;var _0x1ee901=_0x6a01[_0x409682];return _0x1ee901;};'use strict';var multer=require(_0x16a0('0x0'));var util=require(_0x16a0('0x1'));var path=require(_0x16a0('0x2'));var timeout=require(_0x16a0('0x3'));var express=require(_0x16a0('0x4'));var router=express[_0x16a0('0x5')]();var auth=require(_0x16a0('0x6'));var interaction=require(_0x16a0('0x7'));var config=require('../../config/environment');var controller=require(_0x16a0('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x16a0('0x9')]('/describe',auth[_0x16a0('0xa')](),controller['describe']);router[_0x16a0('0x9')](_0x16a0('0xb'),auth['isAuthenticated'](),controller[_0x16a0('0xc')]);router[_0x16a0('0xd')]('/',auth[_0x16a0('0xa')](),interaction[_0x16a0('0xe')](_0x16a0('0xf'),_0x16a0('0x10')),controller[_0x16a0('0x11')]);router[_0x16a0('0xd')](_0x16a0('0x12'),controller[_0x16a0('0x13')]);router[_0x16a0('0x14')](_0x16a0('0xb'),auth[_0x16a0('0xa')](),controller[_0x16a0('0x15')]);router[_0x16a0('0x14')]('/:id/accept',auth[_0x16a0('0xa')](),controller['accept']);router[_0x16a0('0x14')]('/:id/reject',auth[_0x16a0('0xa')](),controller[_0x16a0('0x16')]);router[_0x16a0('0x17')](_0x16a0('0xb'),auth['isAuthenticated'](),controller[_0x16a0('0x18')]);module[_0x16a0('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9c8e35f..8fa77ed 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 _0xb7e7=['DATE','sequelize','TEXT','BOOLEAN','out','STRING'];(function(_0x3640e2,_0x562103){var _0x277415=function(_0x1b2c89){while(--_0x1b2c89){_0x3640e2['push'](_0x3640e2['shift']());}};_0x277415(++_0x562103);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'body':{'type':Sequelize[_0x7b7e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7b7e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7b7e('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7b7e('0x4')](0xbe)},'phone':{'type':Sequelize[_0x7b7e('0x4')]},'readAt':{'type':Sequelize[_0x7b7e('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7b9a=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4aa67d,_0x214cea){var _0x319716=function(_0x4d7a2a){while(--_0x4d7a2a){_0x4aa67d['push'](_0x4aa67d['shift']());}};_0x319716(++_0x214cea);}(_0x7b9a,0xfe));var _0xa7b9=function(_0x7fd1e1,_0x5ae5c9){_0x7fd1e1=_0x7fd1e1-0x0;var _0x1befcd=_0x7b9a[_0x7fd1e1];return _0x1befcd;};'use strict';var Sequelize=require(_0xa7b9('0x0'));module[_0xa7b9('0x1')]={'body':{'type':Sequelize[_0xa7b9('0x2')](_0xa7b9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa7b9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa7b9('0x5')]('in',_0xa7b9('0x6')),'defaultValue':_0xa7b9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa7b9('0x7')](0xbe)},'phone':{'type':Sequelize[_0xa7b9('0x7')]},'readAt':{'type':Sequelize[_0xa7b9('0x8')]},'secret':{'type':Sequelize[_0xa7b9('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b275fa1..c8b165c 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 _0xf219=['jayson/promise','client','test','Sequelize','ValidationError','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','get','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','null','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','localhost'];(function(_0x5d90b8,_0x528b3a){var _0x5712b3=function(_0x478049){while(--_0x478049){_0x5d90b8['push'](_0x5d90b8['shift']());}};_0x5712b3(++_0x528b3a);}(_0xf219,0x65));var _0x9f21=function(_0xfc36d8,_0x233b0b){_0xfc36d8=_0xfc36d8-0x0;var _0x234f42=_0xf219[_0xfc36d8];return _0x234f42;};'use strict';var pdf=require(_0x9f21('0x0'));var emlformat=require(_0x9f21('0x1'));var rimraf=require(_0x9f21('0x2'));var zipdir=require(_0x9f21('0x3'));var jsonpatch=require(_0x9f21('0x4'));var rp=require(_0x9f21('0x5'));var moment=require(_0x9f21('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9f21('0x7'));var util=require(_0x9f21('0x8'));var path=require(_0x9f21('0x9'));var sox=require('sox');var csv=require(_0x9f21('0xa'));var ejs=require(_0x9f21('0xb'));var fs=require('fs');var _=require(_0x9f21('0xc'));var squel=require('squel');var crypto=require(_0x9f21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f21('0xe'));var toCsv=require(_0x9f21('0xa'));var querystring=require(_0x9f21('0xf'));var Papa=require('papaparse');var Redis=require(_0x9f21('0x10'));var authService=require(_0x9f21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f21('0x13'))(_0x9f21('0x14'));var utils=require(_0x9f21('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9f21('0x16')](config[_0x9f21('0x17')],{'host':_0x9f21('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f21('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x9f21('0x19'));var client=jayson[_0x9f21('0x1a')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3a5f4c,_0x50562b,_0x516447){if(_0x516447){var _0x696b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x696b[_0x9f21('0x1b')](_0x50562b)){return _0x3a5f4c;}else{throw new db[(_0x9f21('0x1c'))][(_0x9f21('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3a5f4c;}}function respondWithRpcPromise(_0x389450,_0x1543a4,_0x33cd90,_0x26ed27){return new BPromise(function(_0x37fdaf,_0x22c40e){var _0x19311e=_0x26ed27||client;return _0x19311e[_0x9f21('0x1e')](_0x389450,_0x33cd90)[_0x9f21('0x1f')](function(_0x3a3fc4){logger[_0x9f21('0x20')](_0x9f21('0x21'),_0x1543a4,_0x9f21('0x22'));logger[_0x9f21('0x23')](_0x9f21('0x24'),_0x1543a4,_0x9f21('0x22'),JSON[_0x9f21('0x25')](_0x3a3fc4));if(_0x3a3fc4[_0x9f21('0x26')]){if(_0x3a3fc4[_0x9f21('0x26')][_0x9f21('0x27')]===0x1f4){logger['error'](_0x9f21('0x21'),_0x1543a4,_0x3a3fc4[_0x9f21('0x26')][_0x9f21('0x28')]);return _0x22c40e(_0x3a3fc4['error'][_0x9f21('0x28')]);}logger['error'](_0x9f21('0x21'),_0x1543a4,_0x3a3fc4['error']['message']);return _0x37fdaf(_0x3a3fc4[_0x9f21('0x26')][_0x9f21('0x28')]);}else{logger[_0x9f21('0x20')](_0x9f21('0x21'),_0x1543a4,_0x9f21('0x22'));_0x37fdaf(_0x3a3fc4[_0x9f21('0x29')][_0x9f21('0x28')]);}})[_0x9f21('0x2a')](function(_0x1e98d8){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1543a4,_0x1e98d8);_0x22c40e(_0x1e98d8);});});}function respondWithStatusCode(_0x28d4fd,_0x5a21bb){_0x5a21bb=_0x5a21bb||0xcc;return function(_0x4c862c){if(_0x4c862c){return _0x28d4fd['sendStatus'](_0x5a21bb);}return _0x28d4fd[_0x9f21('0x2b')](_0x5a21bb)[_0x9f21('0x2c')]();};}function respondWithResult(_0x1c6cda,_0x2513b2){_0x2513b2=_0x2513b2||0xc8;return function(_0x359676){if(_0x359676){return _0x1c6cda[_0x9f21('0x2b')](_0x2513b2)[_0x9f21('0x2d')](_0x359676);}};}function respondWithFilteredResult(_0x29a7af,_0x5264e7){return function(_0x416383){if(_0x416383){var _0x5a2838=_0x416383[_0x9f21('0x2e')],_0xe82c6d=_0x5264e7[_0x9f21('0x2f')],_0x16a8de=_0x5264e7[_0x9f21('0x2f')]+_0x5264e7['limit'],_0x5c5d75;if(_0x16a8de>=_0x5a2838){_0x16a8de=_0x5a2838;_0x5c5d75=0xc8;}else{_0x5c5d75=0xce;}_0x29a7af[_0x9f21('0x2b')](_0x5c5d75);return _0x29a7af[_0x9f21('0x30')]('Content-Range',_0xe82c6d+'-'+_0x16a8de+'/'+_0x5a2838)[_0x9f21('0x2d')](_0x416383);}return null;};}function patchUpdates(_0x356d68){return function(_0x3bd2b6){try{jsonpatch['apply'](_0x3bd2b6,_0x356d68,!![]);}catch(_0x583808){return BPromise['reject'](_0x583808);}return _0x3bd2b6[_0x9f21('0x31')]();};}function saveUpdates(_0x34add9,_0x22e32f){return function(_0x14e704){if(_0x14e704){return _0x14e704[_0x9f21('0x32')](_0x34add9)[_0x9f21('0x1f')](function(_0x20d3d3){return _0x20d3d3;});}return null;};}function removeEntity(_0x5bd101,_0x3c7db7){return function(_0xb36de9){if(_0xb36de9){return _0xb36de9[_0x9f21('0x33')]()[_0x9f21('0x1f')](function(){_0x5bd101[_0x9f21('0x2b')](0xcc)[_0x9f21('0x2c')]();});}};}function handleEntityNotFound(_0x5ec834,_0x250eb9){return function(_0x28d7c2){if(!_0x28d7c2){_0x5ec834[_0x9f21('0x34')](0x194);}return _0x28d7c2;};}function handleError(_0x24af3c,_0xd0aa09){_0xd0aa09=_0xd0aa09||0x1f4;return function(_0x437f7b){logger[_0x9f21('0x26')](_0x437f7b[_0x9f21('0x35')]);if(_0x437f7b[_0x9f21('0x36')]){delete _0x437f7b['name'];}_0x24af3c['status'](_0xd0aa09)[_0x9f21('0x37')](_0x437f7b);};}exports[_0x9f21('0x38')]=function(_0x389304,_0x1d5ea2){var _0x14aeab={},_0x46feec={},_0x4d2405={'count':0x0,'rows':[]};var _0x537cbb=_[_0x9f21('0x39')](db[_0x9f21('0x3a')]['rawAttributes'],function(_0x116a82){return{'name':_0x116a82[_0x9f21('0x3b')],'type':_0x116a82[_0x9f21('0x3c')]['key']};});_0x46feec['model']=_[_0x9f21('0x39')](_0x537cbb,_0x9f21('0x36'));_0x46feec[_0x9f21('0x3d')]=_[_0x9f21('0x3e')](_0x389304[_0x9f21('0x3d')]);_0x46feec['filters']=_[_0x9f21('0x3f')](_0x46feec[_0x9f21('0x40')],_0x46feec[_0x9f21('0x3d')]);_0x14aeab[_0x9f21('0x41')]=_[_0x9f21('0x3f')](_0x46feec['model'],qs[_0x9f21('0x42')](_0x389304[_0x9f21('0x3d')]['fields']));_0x14aeab['attributes']=_0x14aeab['attributes'][_0x9f21('0x43')]?_0x14aeab[_0x9f21('0x41')]:_0x46feec['model'];if(!_0x389304[_0x9f21('0x3d')][_0x9f21('0x44')](_0x9f21('0x45'))){_0x14aeab[_0x9f21('0x46')]=qs[_0x9f21('0x46')](_0x389304['query'][_0x9f21('0x46')]);_0x14aeab['offset']=qs[_0x9f21('0x2f')](_0x389304[_0x9f21('0x3d')][_0x9f21('0x2f')]);}_0x14aeab[_0x9f21('0x47')]=qs[_0x9f21('0x48')](_0x389304[_0x9f21('0x3d')][_0x9f21('0x48')]);_0x14aeab['where']=qs[_0x9f21('0x49')](_[_0x9f21('0x4a')](_0x389304['query'],_0x46feec[_0x9f21('0x49')]),_0x537cbb);if(_0x389304['query']['filter']){_0x14aeab[_0x9f21('0x4b')]=_[_0x9f21('0x4c')](_0x14aeab[_0x9f21('0x4b')],{'$or':_['map'](_0x537cbb,function(_0x493c41){if(_0x493c41[_0x9f21('0x3c')]!==_0x9f21('0x4d')){var _0x89fa60={};_0x89fa60[_0x493c41[_0x9f21('0x36')]]={'$like':'%'+_0x389304[_0x9f21('0x3d')][_0x9f21('0x4e')]+'%'};return _0x89fa60;}})});}_0x14aeab=_[_0x9f21('0x4c')]({},_0x14aeab,_0x389304[_0x9f21('0x4f')]);var _0x1f31e6={'where':_0x14aeab[_0x9f21('0x4b')]};return db[_0x9f21('0x3a')]['count'](_0x1f31e6)['then'](function(_0x47484b){_0x4d2405[_0x9f21('0x2e')]=_0x47484b;if(_0x389304[_0x9f21('0x3d')][_0x9f21('0x50')]){_0x14aeab[_0x9f21('0x51')]=[{'all':!![]}];}return db[_0x9f21('0x3a')][_0x9f21('0x52')](_0x14aeab);})[_0x9f21('0x1f')](function(_0x4401a6){_0x4d2405['rows']=_0x4401a6;return _0x4d2405;})['then'](respondWithFilteredResult(_0x1d5ea2,_0x14aeab))[_0x9f21('0x2a')](handleError(_0x1d5ea2,null));};exports[_0x9f21('0x53')]=function(_0x4e6ecc,_0x16d4af){var _0x2e85a={'raw':!![],'where':{'id':_0x4e6ecc[_0x9f21('0x54')]['id']}},_0x1f75e1={};_0x1f75e1[_0x9f21('0x40')]=_[_0x9f21('0x3e')](db[_0x9f21('0x3a')][_0x9f21('0x55')]);_0x1f75e1[_0x9f21('0x3d')]=_[_0x9f21('0x3e')](_0x4e6ecc[_0x9f21('0x3d')]);_0x1f75e1[_0x9f21('0x49')]=_['intersection'](_0x1f75e1[_0x9f21('0x40')],_0x1f75e1[_0x9f21('0x3d')]);_0x2e85a['attributes']=_[_0x9f21('0x3f')](_0x1f75e1[_0x9f21('0x40')],qs['fields'](_0x4e6ecc['query'][_0x9f21('0x42')]));_0x2e85a[_0x9f21('0x41')]=_0x2e85a[_0x9f21('0x41')][_0x9f21('0x43')]?_0x2e85a[_0x9f21('0x41')]:_0x1f75e1[_0x9f21('0x40')];if(_0x4e6ecc[_0x9f21('0x3d')][_0x9f21('0x50')]){_0x2e85a['include']=[{'all':!![]}];}_0x2e85a=_[_0x9f21('0x4c')]({},_0x2e85a,_0x4e6ecc[_0x9f21('0x4f')]);return db[_0x9f21('0x3a')][_0x9f21('0x56')](_0x2e85a)[_0x9f21('0x1f')](handleEntityNotFound(_0x16d4af,null))['then'](respondWithResult(_0x16d4af,null))['catch'](handleError(_0x16d4af,null));};exports['create']=function(_0x2331bc,_0x40adc6){return db[_0x9f21('0x3a')][_0x9f21('0x57')](_0x2331bc['body'],{})[_0x9f21('0x1f')](respondWithResult(_0x40adc6,0xc9))[_0x9f21('0x2a')](handleError(_0x40adc6,null));};exports[_0x9f21('0x32')]=function(_0x203253,_0xce8fe9){if(_0x203253[_0x9f21('0x58')]['id']){delete _0x203253[_0x9f21('0x58')]['id'];}return db['WhatsappMessage'][_0x9f21('0x56')]({'where':{'id':_0x203253[_0x9f21('0x54')]['id']}})[_0x9f21('0x1f')](handleEntityNotFound(_0xce8fe9,null))[_0x9f21('0x1f')](saveUpdates(_0x203253[_0x9f21('0x58')],null))['then'](respondWithResult(_0xce8fe9,null))[_0x9f21('0x2a')](handleError(_0xce8fe9,null));};exports[_0x9f21('0x33')]=function(_0x394852,_0x579d2e){return db[_0x9f21('0x3a')][_0x9f21('0x56')]({'where':{'id':_0x394852[_0x9f21('0x54')]['id']}})['then'](handleEntityNotFound(_0x579d2e,null))['then'](removeEntity(_0x579d2e,null))[_0x9f21('0x2a')](handleError(_0x579d2e,null));};exports[_0x9f21('0x59')]=function(_0x2b90da,_0xa4df57){return db[_0x9f21('0x3a')][_0x9f21('0x59')]()['then'](respondWithResult(_0xa4df57,null))['catch'](handleError(_0xa4df57,null));};var interaction_log=require(_0x9f21('0x13'))(_0x9f21('0x5a'));exports['accept']=function(_0x1eed8b,_0x2b6c06,_0x630b86){var _0x52a61f={'channel':_0x9f21('0x5b')};if(_0x1eed8b[_0x9f21('0x58')]['id']){delete _0x1eed8b[_0x9f21('0x58')]['id'];}_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x5c')]=!![];_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x5d')]=moment()[_0x9f21('0x5e')](_0x9f21('0x5f'));_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x60')]=_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x60')]||_0x1eed8b[_0x9f21('0x61')]['id'];return db['WhatsappMessage'][_0x9f21('0x56')]({'where':{'id':_0x1eed8b['params']['id'],'UserId':null},'include':[{'model':db[_0x9f21('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2b6c06,null))[_0x9f21('0x1f')](saveUpdates(_0x1eed8b[_0x9f21('0x58')],null))[_0x9f21('0x1f')](function(_0x570876){if(_0x570876){_0x52a61f[_0x9f21('0x28')]=_0x570876['get']({'plain':!![]});return db[_0x9f21('0x63')][_0x9f21('0x56')]({'where':{'id':_0x570876[_0x9f21('0x64')]}});}return null;})[_0x9f21('0x1f')](handleEntityNotFound(_0x2b6c06,null))[_0x9f21('0x1f')](function(_0x159f3f){if(_0x159f3f){return _0x159f3f['update']({'UserId':_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x60')],'read1stAt':_[_0x9f21('0x65')](_0x159f3f['read1stAt'])?moment()[_0x9f21('0x5e')](_0x9f21('0x5f')):undefined});}return null;})[_0x9f21('0x1f')](function(_0x4cf0a3){if(_0x4cf0a3){_0x52a61f[_0x9f21('0x66')]=_0x4cf0a3[_0x9f21('0x67')]({'plain':!![]});interaction_log[_0x9f21('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1eed8b['user']['id'],_0x1eed8b['user'][_0x9f21('0x36')],_0x1eed8b['user'][_0x9f21('0x68')],_0x52a61f[_0x9f21('0x66')]['id'],_0x1eed8b['body']?JSON[_0x9f21('0x25')](_0x1eed8b['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x9f21('0x69'),_0x52a61f);}return null;})[_0x9f21('0x1f')](function(_0x5aa32c){if(_0x5aa32c){if(_0x1eed8b[_0x9f21('0x58')][_0x9f21('0x6a')]){_0x52a61f['message'][_0x9f21('0x6b')]=util['format']('SIP/%s',_0x1eed8b[_0x9f21('0x61')]['name']);_0x52a61f[_0x9f21('0x28')][_0x9f21('0x6c')]=_0x52a61f[_0x9f21('0x6c')];_0x52a61f[_0x9f21('0x28')][_0x9f21('0x6d')]='accept';return respondWithRpcPromise(_0x9f21('0x6e'),_0x9f21('0x6e'),{'event':_0x9f21('0x6f'),'message':_0x52a61f['message']},client9002)[_0x9f21('0x1f')](function(){return _0x52a61f;});}return _0x52a61f;}return null;})[_0x9f21('0x1f')](respondWithResult(_0x2b6c06,null))[_0x9f21('0x2a')](handleError(_0x2b6c06,null));};var interaction_log=require(_0x9f21('0x13'))(_0x9f21('0x5a'));exports[_0x9f21('0x70')]=function(_0x5445d6,_0x77a419,_0x44696b){var _0x4e53fa={'agent':{},'channel':_0x9f21('0x5b')};if(_0x5445d6[_0x9f21('0x58')]['id']){delete _0x5445d6[_0x9f21('0x58')]['id'];}_0x5445d6[_0x9f21('0x58')]['UserId']=_0x5445d6[_0x9f21('0x58')][_0x9f21('0x60')]||_0x5445d6['user']['id'];_0x4e53fa[_0x9f21('0x71')]['id']=_0x5445d6['body'][_0x9f21('0x60')];return db[_0x9f21('0x3a')][_0x9f21('0x56')]({'where':{'id':_0x5445d6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x77a419,null))[_0x9f21('0x1f')](function(_0x30c677){if(_0x30c677){_0x4e53fa[_0x9f21('0x28')]=_0x30c677[_0x9f21('0x67')]({'plain':!![]});return db[_0x9f21('0x63')][_0x9f21('0x56')]({'where':{'id':_0x30c677['WhatsappInteractionId']}});}return null;})[_0x9f21('0x1f')](handleEntityNotFound(_0x77a419,null))['then'](function(_0x50d8a4){if(_0x50d8a4){_0x4e53fa['interaction']=_0x50d8a4[_0x9f21('0x67')]({'plain':!![]});interaction_log[_0x9f21('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5445d6[_0x9f21('0x61')]['id'],_0x5445d6[_0x9f21('0x61')][_0x9f21('0x36')],_0x5445d6['user']['role'],_0x4e53fa['interaction']['id'],_0x5445d6['body']?JSON[_0x9f21('0x25')](_0x5445d6['body']):_0x9f21('0x72'));return respondWithRpcPromise(_0x9f21('0x73'),_0x9f21('0x74'),_0x4e53fa);}return null;})['then'](function(_0x110f56){if(_0x110f56){_0x110f56[_0x9f21('0x28')][_0x9f21('0x6b')]=util[_0x9f21('0x5e')]('SIP/%s',_0x5445d6[_0x9f21('0x61')][_0x9f21('0x36')]);_0x110f56[_0x9f21('0x28')][_0x9f21('0x6c')]=_0x4e53fa[_0x9f21('0x6c')];_0x110f56['message'][_0x9f21('0x6d')]=_0x9f21('0x70');respondWithRpcPromise(_0x9f21('0x6e'),_0x9f21('0x6e'),{'event':_0x9f21('0x75'),'message':_0x110f56['message']},client9002);return _0x4e53fa;}return null;})[_0x9f21('0x1f')](respondWithResult(_0x77a419,null))[_0x9f21('0x2a')](handleError(_0x77a419,null));};exports[_0x9f21('0x2b')]=function(_0x144371,_0x21d4ad,_0x24d177){if(_0x144371[_0x9f21('0x58')]['id']){delete _0x144371[_0x9f21('0x58')]['id'];}var _0x5cea1e;return db[_0x9f21('0x3a')][_0x9f21('0x56')]({'where':{'id':_0x144371['params']['id']}})[_0x9f21('0x1f')](handleEntityNotFound(_0x21d4ad,null))[_0x9f21('0x1f')](function(_0x27171a){if(_0x27171a){_0x5cea1e=_0x27171a;return db[_0x9f21('0x76')][_0x9f21('0x56')]({'where':{'id':_0x27171a['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x21d4ad,null))[_0x9f21('0x1f')](function(_0x59a0de){if(_0x59a0de){logger['debug'](_0x9f21('0x77'),_0x9f21('0x2b'),_0x9f21('0x78'),_0x59a0de[_0x9f21('0x3c')],util[_0x9f21('0x79')](_0x144371[_0x9f21('0x58')],{'showHidden':![],'depth':null}));switch(_0x59a0de['type']){case _0x9f21('0x7a'):if(_0x144371[_0x9f21('0x58')][_0x9f21('0x7b')]&&_0x144371[_0x9f21('0x58')][_0x9f21('0x7b')]===_0x5cea1e['messageId']&&_0x144371['body'][_0x9f21('0x7c')]&&_0x144371[_0x9f21('0x58')][_0x9f21('0x7c')]===_0x9f21('0x5c')){return _0x5cea1e[_0x9f21('0x32')]({'read':!![]});}else{logger[_0x9f21('0x26')](_0x9f21('0x7d'),_0x9f21('0x2b'),_0x9f21('0x7a'),util['inspect'](_0x144371[_0x9f21('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x5cea1e;}})[_0x9f21('0x1f')](respondWithResult(_0x21d4ad,null))[_0x9f21('0x2a')](handleError(_0x21d4ad,null));}; \ No newline at end of file +var _0x74bf=['sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','whatsapp','read','readAt','format','UserId','CmContact','Contact','get','WhatsappInteraction','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','../../config/logger','whatsapp-interactions','reject','agent','WhatsappInteractionId','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','Content-Range','json','save','then','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x388bfa,_0x1f518c){var _0x11d6a6=function(_0x40b0b3){while(--_0x40b0b3){_0x388bfa['push'](_0x388bfa['shift']());}};_0x11d6a6(++_0x1f518c);}(_0x74bf,0x137));var _0xf74b=function(_0xd697dc,_0x16c51f){_0xd697dc=_0xd697dc-0x0;var _0x2e2bd2=_0x74bf[_0xd697dc];return _0x2e2bd2;};'use strict';var pdf=require(_0xf74b('0x0'));var emlformat=require(_0xf74b('0x1'));var rimraf=require(_0xf74b('0x2'));var zipdir=require(_0xf74b('0x3'));var jsonpatch=require(_0xf74b('0x4'));var rp=require('request-promise');var moment=require(_0xf74b('0x5'));var BPromise=require(_0xf74b('0x6'));var Mustache=require(_0xf74b('0x7'));var util=require(_0xf74b('0x8'));var path=require(_0xf74b('0x9'));var sox=require(_0xf74b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf74b('0xb'));var squel=require(_0xf74b('0xc'));var crypto=require('crypto');var jsforce=require(_0xf74b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf74b('0xe'));var querystring=require('querystring');var Papa=require(_0xf74b('0xf'));var Redis=require('ioredis');var authService=require(_0xf74b('0x10'));var qs=require(_0xf74b('0x11'));var as=require(_0xf74b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf74b('0x13'));var utils=require(_0xf74b('0x14'));var config=require(_0xf74b('0x15'));var db=require('../../mysqldb')['db'];config[_0xf74b('0x16')]=_[_0xf74b('0x17')](config[_0xf74b('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf74b('0x18'))(new Redis(config[_0xf74b('0x16')]));require(_0xf74b('0x19'))[_0xf74b('0x1a')](socket);var jayson=require(_0xf74b('0x1b'));var client=jayson[_0xf74b('0x1c')][_0xf74b('0x1d')]({'port':0x232c});var client9002=jayson[_0xf74b('0x1c')][_0xf74b('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x73fa99,_0x104637,_0x354b74){if(_0x354b74){var _0x10ae27=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10ae27[_0xf74b('0x1e')](_0x104637)){return _0x73fa99;}else{throw new db['Sequelize'][(_0xf74b('0x1f'))](_0xf74b('0x20'));}}else{return _0x73fa99;}}function respondWithRpcPromise(_0x22e406,_0xc0567f,_0x3237b1,_0x3ba307){return new BPromise(function(_0x28b1be,_0xab187b){var _0x662c8f=_0x3ba307||client;return _0x662c8f[_0xf74b('0x21')](_0x22e406,_0x3237b1)['then'](function(_0xdbeaad){logger[_0xf74b('0x22')](_0xf74b('0x23'),_0xc0567f,_0xf74b('0x24'));logger[_0xf74b('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc0567f,_0xf74b('0x24'),JSON[_0xf74b('0x26')](_0xdbeaad));if(_0xdbeaad[_0xf74b('0x27')]){if(_0xdbeaad[_0xf74b('0x27')][_0xf74b('0x28')]===0x1f4){logger[_0xf74b('0x27')](_0xf74b('0x23'),_0xc0567f,_0xdbeaad[_0xf74b('0x27')]['message']);return _0xab187b(_0xdbeaad[_0xf74b('0x27')][_0xf74b('0x29')]);}logger[_0xf74b('0x27')](_0xf74b('0x23'),_0xc0567f,_0xdbeaad[_0xf74b('0x27')]['message']);return _0x28b1be(_0xdbeaad[_0xf74b('0x27')][_0xf74b('0x29')]);}else{logger[_0xf74b('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0xc0567f,_0xf74b('0x24'));_0x28b1be(_0xdbeaad[_0xf74b('0x2a')][_0xf74b('0x29')]);}})['catch'](function(_0x238708){logger[_0xf74b('0x27')](_0xf74b('0x23'),_0xc0567f,_0x238708);_0xab187b(_0x238708);});});}function respondWithStatusCode(_0x2f5413,_0x8dcd8b){_0x8dcd8b=_0x8dcd8b||0xcc;return function(_0x5407b3){if(_0x5407b3){return _0x2f5413[_0xf74b('0x2b')](_0x8dcd8b);}return _0x2f5413[_0xf74b('0x2c')](_0x8dcd8b)[_0xf74b('0x2d')]();};}function respondWithResult(_0x1f3120,_0x5067b2){_0x5067b2=_0x5067b2||0xc8;return function(_0xa2046a){if(_0xa2046a){return _0x1f3120[_0xf74b('0x2c')](_0x5067b2)['json'](_0xa2046a);}};}function respondWithFilteredResult(_0x367756,_0x5199ed){return function(_0x5b825f){if(_0x5b825f){var _0x49a990=_0x5b825f['count'],_0x20776f=_0x5199ed['offset'],_0x1dc978=_0x5199ed[_0xf74b('0x2e')]+_0x5199ed[_0xf74b('0x2f')],_0x4eeb05;if(_0x1dc978>=_0x49a990){_0x1dc978=_0x49a990;_0x4eeb05=0xc8;}else{_0x4eeb05=0xce;}_0x367756[_0xf74b('0x2c')](_0x4eeb05);return _0x367756[_0xf74b('0x30')](_0xf74b('0x31'),_0x20776f+'-'+_0x1dc978+'/'+_0x49a990)[_0xf74b('0x32')](_0x5b825f);}return null;};}function patchUpdates(_0x114ae5){return function(_0x244507){try{jsonpatch['apply'](_0x244507,_0x114ae5,!![]);}catch(_0x4adb47){return BPromise['reject'](_0x4adb47);}return _0x244507[_0xf74b('0x33')]();};}function saveUpdates(_0x475870,_0x33041d){return function(_0x5e2703){if(_0x5e2703){return _0x5e2703['update'](_0x475870)[_0xf74b('0x34')](function(_0x931645){return _0x931645;});}return null;};}function removeEntity(_0x3aa236,_0x2cf483){return function(_0x5f1421){if(_0x5f1421){return _0x5f1421[_0xf74b('0x35')]()[_0xf74b('0x34')](function(){_0x3aa236[_0xf74b('0x2c')](0xcc)[_0xf74b('0x2d')]();});}};}function handleEntityNotFound(_0x5c026f,_0x315376){return function(_0x582130){if(!_0x582130){_0x5c026f['sendStatus'](0x194);}return _0x582130;};}function handleError(_0x389632,_0x223c8b){_0x223c8b=_0x223c8b||0x1f4;return function(_0x4fac9b){logger[_0xf74b('0x27')](_0x4fac9b[_0xf74b('0x36')]);if(_0x4fac9b[_0xf74b('0x37')]){delete _0x4fac9b[_0xf74b('0x37')];}_0x389632['status'](_0x223c8b)['send'](_0x4fac9b);};}exports[_0xf74b('0x38')]=function(_0x1ee619,_0x17dcff){var _0x4670e9={},_0x595c26={},_0x3e0b8f={'count':0x0,'rows':[]};var _0x205ac5=_[_0xf74b('0x39')](db[_0xf74b('0x3a')][_0xf74b('0x3b')],function(_0x42513f){return{'name':_0x42513f['fieldName'],'type':_0x42513f[_0xf74b('0x3c')][_0xf74b('0x3d')]};});_0x595c26[_0xf74b('0x3e')]=_[_0xf74b('0x39')](_0x205ac5,_0xf74b('0x37'));_0x595c26['query']=_[_0xf74b('0x3f')](_0x1ee619[_0xf74b('0x40')]);_0x595c26[_0xf74b('0x41')]=_[_0xf74b('0x42')](_0x595c26[_0xf74b('0x3e')],_0x595c26['query']);_0x4670e9[_0xf74b('0x43')]=_[_0xf74b('0x42')](_0x595c26[_0xf74b('0x3e')],qs[_0xf74b('0x44')](_0x1ee619[_0xf74b('0x40')][_0xf74b('0x44')]));_0x4670e9[_0xf74b('0x43')]=_0x4670e9[_0xf74b('0x43')][_0xf74b('0x45')]?_0x4670e9[_0xf74b('0x43')]:_0x595c26['model'];if(!_0x1ee619[_0xf74b('0x40')]['hasOwnProperty']('nolimit')){_0x4670e9[_0xf74b('0x2f')]=qs['limit'](_0x1ee619[_0xf74b('0x40')][_0xf74b('0x2f')]);_0x4670e9['offset']=qs[_0xf74b('0x2e')](_0x1ee619[_0xf74b('0x40')][_0xf74b('0x2e')]);}_0x4670e9['order']=qs[_0xf74b('0x46')](_0x1ee619['query'][_0xf74b('0x46')]);_0x4670e9[_0xf74b('0x47')]=qs['filters'](_['pick'](_0x1ee619[_0xf74b('0x40')],_0x595c26[_0xf74b('0x41')]),_0x205ac5);if(_0x1ee619[_0xf74b('0x40')][_0xf74b('0x48')]){_0x4670e9[_0xf74b('0x47')]=_[_0xf74b('0x49')](_0x4670e9[_0xf74b('0x47')],{'$or':_[_0xf74b('0x39')](_0x205ac5,function(_0x7f0ff3){if(_0x7f0ff3[_0xf74b('0x3c')]!==_0xf74b('0x4a')){var _0x555394={};_0x555394[_0x7f0ff3[_0xf74b('0x37')]]={'$like':'%'+_0x1ee619[_0xf74b('0x40')][_0xf74b('0x48')]+'%'};return _0x555394;}})});}_0x4670e9=_[_0xf74b('0x49')]({},_0x4670e9,_0x1ee619[_0xf74b('0x4b')]);var _0x4f9f38={'where':_0x4670e9[_0xf74b('0x47')]};return db['WhatsappMessage'][_0xf74b('0x4c')](_0x4f9f38)['then'](function(_0x5de11a){_0x3e0b8f[_0xf74b('0x4c')]=_0x5de11a;if(_0x1ee619[_0xf74b('0x40')][_0xf74b('0x4d')]){_0x4670e9['include']=[{'all':!![]}];}return db[_0xf74b('0x3a')][_0xf74b('0x4e')](_0x4670e9);})['then'](function(_0x2ea790){_0x3e0b8f[_0xf74b('0x4f')]=_0x2ea790;return _0x3e0b8f;})[_0xf74b('0x34')](respondWithFilteredResult(_0x17dcff,_0x4670e9))[_0xf74b('0x50')](handleError(_0x17dcff,null));};exports[_0xf74b('0x51')]=function(_0x1aaaa5,_0xa71b36){var _0x489464={'raw':!![],'where':{'id':_0x1aaaa5[_0xf74b('0x52')]['id']}},_0x3b40a9={};_0x3b40a9[_0xf74b('0x3e')]=_[_0xf74b('0x3f')](db[_0xf74b('0x3a')][_0xf74b('0x3b')]);_0x3b40a9['query']=_[_0xf74b('0x3f')](_0x1aaaa5[_0xf74b('0x40')]);_0x3b40a9[_0xf74b('0x41')]=_[_0xf74b('0x42')](_0x3b40a9[_0xf74b('0x3e')],_0x3b40a9[_0xf74b('0x40')]);_0x489464[_0xf74b('0x43')]=_['intersection'](_0x3b40a9[_0xf74b('0x3e')],qs[_0xf74b('0x44')](_0x1aaaa5['query'][_0xf74b('0x44')]));_0x489464[_0xf74b('0x43')]=_0x489464[_0xf74b('0x43')][_0xf74b('0x45')]?_0x489464[_0xf74b('0x43')]:_0x3b40a9[_0xf74b('0x3e')];if(_0x1aaaa5['query']['includeAll']){_0x489464[_0xf74b('0x53')]=[{'all':!![]}];}_0x489464=_[_0xf74b('0x49')]({},_0x489464,_0x1aaaa5[_0xf74b('0x4b')]);return db[_0xf74b('0x3a')][_0xf74b('0x54')](_0x489464)[_0xf74b('0x34')](handleEntityNotFound(_0xa71b36,null))[_0xf74b('0x34')](respondWithResult(_0xa71b36,null))[_0xf74b('0x50')](handleError(_0xa71b36,null));};exports[_0xf74b('0x55')]=function(_0x30677f,_0x7ef8e3){return db['WhatsappMessage'][_0xf74b('0x55')](_0x30677f[_0xf74b('0x56')],{})['then'](respondWithResult(_0x7ef8e3,0xc9))['catch'](handleError(_0x7ef8e3,null));};exports[_0xf74b('0x57')]=function(_0x3ca7e0,_0x48a1c4){if(_0x3ca7e0[_0xf74b('0x56')]['id']){delete _0x3ca7e0[_0xf74b('0x56')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x3ca7e0[_0xf74b('0x52')]['id']}})['then'](handleEntityNotFound(_0x48a1c4,null))['then'](saveUpdates(_0x3ca7e0['body'],null))[_0xf74b('0x34')](respondWithResult(_0x48a1c4,null))['catch'](handleError(_0x48a1c4,null));};exports[_0xf74b('0x35')]=function(_0x453790,_0x39ec30){return db[_0xf74b('0x3a')][_0xf74b('0x54')]({'where':{'id':_0x453790['params']['id']}})[_0xf74b('0x34')](handleEntityNotFound(_0x39ec30,null))[_0xf74b('0x34')](removeEntity(_0x39ec30,null))[_0xf74b('0x50')](handleError(_0x39ec30,null));};exports[_0xf74b('0x58')]=function(_0x2ac131,_0x1ffcc5){return db[_0xf74b('0x3a')]['describe']()['then'](respondWithResult(_0x1ffcc5,null))[_0xf74b('0x50')](handleError(_0x1ffcc5,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x187843,_0x128c7a,_0x204dc2){var _0x351eef={'channel':_0xf74b('0x59')};if(_0x187843[_0xf74b('0x56')]['id']){delete _0x187843[_0xf74b('0x56')]['id'];}_0x187843[_0xf74b('0x56')][_0xf74b('0x5a')]=!![];_0x187843[_0xf74b('0x56')][_0xf74b('0x5b')]=moment()[_0xf74b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x187843[_0xf74b('0x56')][_0xf74b('0x5d')]=_0x187843[_0xf74b('0x56')][_0xf74b('0x5d')]||_0x187843['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x187843[_0xf74b('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xf74b('0x5e')],'as':_0xf74b('0x5f')}]})[_0xf74b('0x34')](handleEntityNotFound(_0x128c7a,null))[_0xf74b('0x34')](saveUpdates(_0x187843[_0xf74b('0x56')],null))[_0xf74b('0x34')](function(_0x3d99e){if(_0x3d99e){_0x351eef[_0xf74b('0x29')]=_0x3d99e[_0xf74b('0x60')]({'plain':!![]});return db[_0xf74b('0x61')][_0xf74b('0x54')]({'where':{'id':_0x3d99e['WhatsappInteractionId']}});}return null;})[_0xf74b('0x34')](handleEntityNotFound(_0x128c7a,null))[_0xf74b('0x34')](function(_0x122c1c){if(_0x122c1c){return _0x122c1c[_0xf74b('0x57')]({'UserId':_0x187843[_0xf74b('0x56')]['UserId'],'read1stAt':_['isNil'](_0x122c1c[_0xf74b('0x62')])?moment()[_0xf74b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf74b('0x34')](function(_0x1a1c35){if(_0x1a1c35){_0x351eef[_0xf74b('0x63')]=_0x1a1c35[_0xf74b('0x60')]({'plain':!![]});interaction_log[_0xf74b('0x22')](_0xf74b('0x64'),_0x187843['user']['id'],_0x187843[_0xf74b('0x65')][_0xf74b('0x37')],_0x187843[_0xf74b('0x65')][_0xf74b('0x66')],_0x351eef[_0xf74b('0x63')]['id'],_0x187843['body']?JSON[_0xf74b('0x26')](_0x187843[_0xf74b('0x56')]):_0xf74b('0x67'));return respondWithRpcPromise(_0xf74b('0x68'),'acceptMessage',_0x351eef);}return null;})['then'](function(_0x1aeb95){if(_0x1aeb95){if(_0x187843[_0xf74b('0x56')]['manual']){_0x351eef[_0xf74b('0x29')][_0xf74b('0x69')]=util[_0xf74b('0x5c')](_0xf74b('0x6a'),_0x187843['user'][_0xf74b('0x37')]);_0x351eef[_0xf74b('0x29')]['channel']=_0x351eef[_0xf74b('0x6b')];_0x351eef[_0xf74b('0x29')][_0xf74b('0x6c')]=_0xf74b('0x6d');return respondWithRpcPromise(_0xf74b('0x6e'),_0xf74b('0x6e'),{'event':_0xf74b('0x6f'),'message':_0x351eef['message']},client9002)[_0xf74b('0x34')](function(){return _0x351eef;});}return _0x351eef;}return null;})[_0xf74b('0x34')](respondWithResult(_0x128c7a,null))['catch'](handleError(_0x128c7a,null));};var interaction_log=require(_0xf74b('0x70'))(_0xf74b('0x71'));exports[_0xf74b('0x72')]=function(_0x11f0d9,_0x57b074,_0x34e565){var _0xab7b1e={'agent':{},'channel':_0xf74b('0x59')};if(_0x11f0d9[_0xf74b('0x56')]['id']){delete _0x11f0d9[_0xf74b('0x56')]['id'];}_0x11f0d9[_0xf74b('0x56')]['UserId']=_0x11f0d9[_0xf74b('0x56')][_0xf74b('0x5d')]||_0x11f0d9[_0xf74b('0x65')]['id'];_0xab7b1e[_0xf74b('0x73')]['id']=_0x11f0d9['body'][_0xf74b('0x5d')];return db[_0xf74b('0x3a')][_0xf74b('0x54')]({'where':{'id':_0x11f0d9[_0xf74b('0x52')]['id'],'UserId':null}})[_0xf74b('0x34')](handleEntityNotFound(_0x57b074,null))[_0xf74b('0x34')](function(_0x3365d9){if(_0x3365d9){_0xab7b1e[_0xf74b('0x29')]=_0x3365d9[_0xf74b('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xf74b('0x54')]({'where':{'id':_0x3365d9[_0xf74b('0x74')]}});}return null;})[_0xf74b('0x34')](handleEntityNotFound(_0x57b074,null))[_0xf74b('0x34')](function(_0x110196){if(_0x110196){_0xab7b1e[_0xf74b('0x63')]=_0x110196[_0xf74b('0x60')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11f0d9['user']['id'],_0x11f0d9['user'][_0xf74b('0x37')],_0x11f0d9[_0xf74b('0x65')][_0xf74b('0x66')],_0xab7b1e[_0xf74b('0x63')]['id'],_0x11f0d9[_0xf74b('0x56')]?JSON[_0xf74b('0x26')](_0x11f0d9[_0xf74b('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0xab7b1e);}return null;})[_0xf74b('0x34')](function(_0x19a280){if(_0x19a280){_0x19a280[_0xf74b('0x29')][_0xf74b('0x69')]=util['format']('SIP/%s',_0x11f0d9['user'][_0xf74b('0x37')]);_0x19a280[_0xf74b('0x29')]['channel']=_0xab7b1e[_0xf74b('0x6b')];_0x19a280[_0xf74b('0x29')]['event']='reject';respondWithRpcPromise(_0xf74b('0x6e'),'EventManager',{'event':_0xf74b('0x75'),'message':_0x19a280['message']},client9002);return _0xab7b1e;}return null;})['then'](respondWithResult(_0x57b074,null))['catch'](handleError(_0x57b074,null));};exports[_0xf74b('0x2c')]=function(_0xf1fcc9,_0x4803a4,_0x452be1){if(_0xf1fcc9[_0xf74b('0x56')]['id']){delete _0xf1fcc9['body']['id'];}var _0x49c51c;return db[_0xf74b('0x3a')][_0xf74b('0x54')]({'where':{'id':_0xf1fcc9[_0xf74b('0x52')]['id']}})[_0xf74b('0x34')](handleEntityNotFound(_0x4803a4,null))[_0xf74b('0x34')](function(_0x195dce){if(_0x195dce){_0x49c51c=_0x195dce;return db[_0xf74b('0x76')][_0xf74b('0x54')]({'where':{'id':_0x195dce[_0xf74b('0x77')]}});}})[_0xf74b('0x34')](handleEntityNotFound(_0x4803a4,null))[_0xf74b('0x34')](function(_0x304c49){if(_0x304c49){logger[_0xf74b('0x25')](_0xf74b('0x78'),_0xf74b('0x2c'),_0xf74b('0x79'),_0x304c49[_0xf74b('0x3c')],util[_0xf74b('0x7a')](_0xf1fcc9[_0xf74b('0x56')],{'showHidden':![],'depth':null}));switch(_0x304c49['type']){case _0xf74b('0x7b'):if(_0xf1fcc9[_0xf74b('0x56')]['MessageSid']&&_0xf1fcc9['body'][_0xf74b('0x7c')]===_0x49c51c[_0xf74b('0x7d')]&&_0xf1fcc9[_0xf74b('0x56')][_0xf74b('0x7e')]&&_0xf1fcc9[_0xf74b('0x56')][_0xf74b('0x7e')]===_0xf74b('0x5a')){return _0x49c51c[_0xf74b('0x57')]({'read':!![]});}else{logger[_0xf74b('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xf74b('0x7b'),util[_0xf74b('0x7a')](_0xf1fcc9['body'],{'showHidden':![],'depth':null}));}break;}return _0x49c51c;}})['then'](respondWithResult(_0x4803a4,null))[_0xf74b('0x50')](handleError(_0x4803a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 571377f..c3e70b9 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x1a9105,_0x45b10b){var _0x390798=function(_0x292d36){while(--_0x292d36){_0x1a9105['push'](_0x1a9105['shift']());}};_0x390798(++_0x45b10b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x477f6e,_0x21814f){_0x477f6e=_0x477f6e-0x0;var _0x1af2fe=_0x5f2f[_0x477f6e];return _0x1af2fe;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x145d7c,_0x10c912){var _0x24f867=function(_0x203ed9){while(--_0x203ed9){_0x145d7c['push'](_0x145d7c['shift']());}};_0x24f867(++_0x10c912);}(_0xb10b,0x12a));var _0xbb10=function(_0x6fd8ad,_0x597818){_0x6fd8ad=_0x6fd8ad-0x0;var _0x257d21=_0xb10b[_0x6fd8ad];return _0x257d21;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 26d3454..9fdaf7f 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 _0x51a0=['path','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteractionId','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','create','whatsapp:','phone','/status?token=','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0x4a991a,_0x2ac1cc){var _0x50076e=function(_0x1e46c9){while(--_0x1e46c9){_0x4a991a['push'](_0x4a991a['shift']());}};_0x50076e(++_0x2ac1cc);}(_0x51a0,0xb3));var _0x051a=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x51a0[_0x13ce0c];return _0x4388fb;};'use strict';var _=require('lodash');var util=require(_0x051a('0x0'));var logger=require('../../config/logger')(_0x051a('0x1'));var moment=require(_0x051a('0x2'));var BPromise=require(_0x051a('0x3'));var rp=require(_0x051a('0x4'));var fs=require('fs');var path=require(_0x051a('0x5'));var rimraf=require('rimraf');var config=require(_0x051a('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x051a('0x7')]=function(_0x4c3d7a,_0x485028){return _0x4c3d7a[_0x051a('0x8')]('WhatsappMessage',attributes,{'tableName':_0x051a('0x9'),'paranoid':![],'indexes':[{'name':_0x051a('0xa'),'fields':[_0x051a('0xa')]},{'name':_0x051a('0xb'),'fields':[_0x051a('0xc')],'type':_0x051a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21ea0d,_0x14810a,_0x411f66){var _0xa3c358=_0x4c3d7a[_0x051a('0xe')];var _0x4bcaab=_0x21ea0d[_0x051a('0xf')]({'plain':!![]});if(_0x4bcaab[_0x051a('0x10')][_0x051a('0x11')]()==='in'||_0x4bcaab[_0x051a('0x10')][_0x051a('0x11')]()===_0x051a('0x12')&&!_0x4bcaab['secret']&&!_[_0x051a('0x13')](_0x4bcaab[_0x051a('0x14')])){_0xa3c358['WhatsappInteraction']['findOne']({'where':{'id':_0x4bcaab[_0x051a('0x15')]}})['then'](function(_0x41a94e){if(_0x41a94e){_0x41a94e['update']({'lastMsgAt':_0x4bcaab[_0x051a('0x16')],'lastMsgDirection':_0x4bcaab[_0x051a('0x10')][_0x051a('0x11')]()});}})[_0x051a('0x17')](function(_0x2c5a8c){console['error'](_0x2c5a8c);});}if(_0x4bcaab[_0x051a('0x10')]===_0x051a('0x12')&&!_0x4bcaab[_0x051a('0x18')]){var _0x109a44;_0xa3c358[_0x051a('0x19')][_0x051a('0x1a')]({'where':{'id':_0x4bcaab[_0x051a('0x1b')]},'raw':!![]})[_0x051a('0x1c')](function(_0x1a90e7){_0x109a44=_0x1a90e7;if(_0x109a44&&_0x109a44['type']){switch(_0x109a44[_0x051a('0x1d')]){case _0x051a('0x1e'):var _0x20220a=require('twilio');if(_0x109a44[_0x051a('0x1f')]&&_0x109a44[_0x051a('0x20')]&&_0x109a44['phone']){var _0x341eeb=new _0x20220a(_0x109a44[_0x051a('0x1f')],_0x109a44[_0x051a('0x20')]);_0x341eeb['messages'][_0x051a('0x21')]({'body':_0x4bcaab['body'],'to':_0x051a('0x22')+_0x4bcaab[_0x051a('0x23')],'from':_0x051a('0x22')+_0x109a44['phone'],'statusCallback':_0x109a44['remote']+'/api/whatsapp/messages/'+_0x4bcaab['id']+_0x051a('0x24')+_0x109a44['token']})[_0x051a('0x1c')](function(_0x3b4866){if(_0x3b4866[_0x051a('0x25')]){return _0x21ea0d[_0x051a('0x26')]({'messageId':_0x3b4866['sid']});}})[_0x051a('0x17')](function(_0x42f81e){logger['error'](_0x051a('0x27'),_0x051a('0x28'),_0x051a('0x1e'),util[_0x051a('0x29')](_0x42f81e,{'showHidden':![],'depth':null}));});}else{logger[_0x051a('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x051a('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x051a('0x2b')](function(){_0x411f66();});}else{_0x411f66();}}},'charset':_0x051a('0x2c'),'collate':_0x051a('0x2d')});}; \ No newline at end of file +var _0x215f=['WhatsappMessage,\x20%s,\x20%s,\x20%s','utf8mb4_unicode_ci','../../config/logger','api','path','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','inspect'];(function(_0x815126,_0x378cca){var _0x2d617a=function(_0x191043){while(--_0x191043){_0x815126['push'](_0x815126['shift']());}};_0x2d617a(++_0x378cca);}(_0x215f,0x1f0));var _0xf215=function(_0x38ea85,_0x24dd4b){_0x38ea85=_0x38ea85-0x0;var _0x52c063=_0x215f[_0x38ea85];return _0x52c063;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf215('0x0'))(_0xf215('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf215('0x2'));var rimraf=require('rimraf');var config=require(_0xf215('0x3'));var attributes=require(_0xf215('0x4'));module['exports']=function(_0x5c5228,_0x5b0ee8){return _0x5c5228['define'](_0xf215('0x5'),attributes,{'tableName':_0xf215('0x6'),'paranoid':![],'indexes':[{'name':_0xf215('0x7'),'fields':['messageId']},{'name':_0xf215('0x8'),'fields':[_0xf215('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e2768,_0x164987,_0x2d1f4c){var _0x2476e2=_0x5c5228['models'];var _0x182e31=_0x4e2768[_0xf215('0xa')]({'plain':!![]});if(_0x182e31['direction'][_0xf215('0xb')]()==='in'||_0x182e31[_0xf215('0xc')][_0xf215('0xb')]()===_0xf215('0xd')&&!_0x182e31[_0xf215('0xe')]&&!_[_0xf215('0xf')](_0x182e31[_0xf215('0x10')])){_0x2476e2['WhatsappInteraction'][_0xf215('0x11')]({'where':{'id':_0x182e31['WhatsappInteractionId']}})[_0xf215('0x12')](function(_0x136644){if(_0x136644){_0x136644[_0xf215('0x13')]({'lastMsgAt':_0x182e31[_0xf215('0x14')],'lastMsgDirection':_0x182e31[_0xf215('0xc')][_0xf215('0xb')]()});}})[_0xf215('0x15')](function(_0x75e14a){console['error'](_0x75e14a);});}if(_0x182e31['direction']===_0xf215('0xd')&&!_0x182e31['secret']){var _0x5294c8;_0x2476e2[_0xf215('0x16')]['find']({'where':{'id':_0x182e31[_0xf215('0x17')]},'raw':!![]})['then'](function(_0x1ce8b3){_0x5294c8=_0x1ce8b3;if(_0x5294c8&&_0x5294c8[_0xf215('0x18')]){switch(_0x5294c8[_0xf215('0x18')]){case _0xf215('0x19'):var _0x53f76c=require(_0xf215('0x19'));if(_0x5294c8[_0xf215('0x1a')]&&_0x5294c8[_0xf215('0x1b')]&&_0x5294c8[_0xf215('0x1c')]){var _0x149ba7=new _0x53f76c(_0x5294c8[_0xf215('0x1a')],_0x5294c8[_0xf215('0x1b')]);_0x149ba7[_0xf215('0x1d')]['create']({'body':_0x182e31[_0xf215('0x9')],'to':'whatsapp:'+_0x182e31[_0xf215('0x1c')],'from':_0xf215('0x1e')+_0x5294c8[_0xf215('0x1c')],'statusCallback':_0x5294c8[_0xf215('0x1f')]+_0xf215('0x20')+_0x182e31['id']+_0xf215('0x21')+_0x5294c8['token']})[_0xf215('0x12')](function(_0x3161e4){if(_0x3161e4[_0xf215('0x22')]){return _0x4e2768[_0xf215('0x13')]({'messageId':_0x3161e4[_0xf215('0x22')]});}})[_0xf215('0x15')](function(_0x5e50a7){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0xf215('0x23')](_0x5e50a7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf215('0x24'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x2d1f4c();});}else{_0x2d1f4c();}}},'charset':'utf8mb4','collate':_0xf215('0x25')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bf1da37..7bc02ab 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 _0x165f=['request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x34a629,_0x357fb4){var _0x189ac8=function(_0x1e1c86){while(--_0x1e1c86){_0x34a629['push'](_0x34a629['shift']());}};_0x189ac8(++_0x357fb4);}(_0x165f,0x18d));var _0xf165=function(_0x1f61b5,_0x51cc96){_0x1f61b5=_0x1f61b5-0x0;var _0x46eb74=_0x165f[_0x1f61b5];return _0x46eb74;};'use strict';var _=require(_0xf165('0x0'));var util=require(_0xf165('0x1'));var moment=require(_0xf165('0x2'));var BPromise=require(_0xf165('0x3'));var rs=require(_0xf165('0x4'));var fs=require('fs');var Redis=require(_0xf165('0x5'));var db=require(_0xf165('0x6'))['db'];var utils=require(_0xf165('0x7'));var logger=require(_0xf165('0x8'))('rpc');var config=require(_0xf165('0x9'));var jayson=require(_0xf165('0xa'));var client=jayson[_0xf165('0xb')][_0xf165('0xc')]({'port':0x232a});config[_0xf165('0xd')]=_[_0xf165('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf165('0xf'))(new Redis(config[_0xf165('0xd')]));require(_0xf165('0x10'))['register'](socket);function respondWithRpcPromise(_0x3ea4c0,_0xcec4e3,_0x3e023a){return new BPromise(function(_0xdecd0,_0x2e59f8){return client['request'](_0x3ea4c0,_0x3e023a)['then'](function(_0x1cb3af){logger[_0xf165('0x11')](_0xf165('0x12'),_0xcec4e3,_0xf165('0x13'));logger['debug'](_0xf165('0x14'),_0xcec4e3,'request\x20sent',JSON[_0xf165('0x15')](_0x1cb3af));if(_0x1cb3af[_0xf165('0x16')]){if(_0x1cb3af[_0xf165('0x16')][_0xf165('0x17')]===0x1f4){logger[_0xf165('0x16')](_0xf165('0x12'),_0xcec4e3,_0x1cb3af['error']['message']);return _0x2e59f8(_0x1cb3af[_0xf165('0x16')]['message']);}logger[_0xf165('0x16')](_0xf165('0x12'),_0xcec4e3,_0x1cb3af[_0xf165('0x16')][_0xf165('0x18')]);return _0xdecd0(_0x1cb3af[_0xf165('0x16')]['message']);}else{logger[_0xf165('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0xcec4e3,_0xf165('0x13'));_0xdecd0(_0x1cb3af['result'][_0xf165('0x18')]);}})[_0xf165('0x19')](function(_0x2bf1f6){logger['error'](_0xf165('0x12'),_0xcec4e3,_0x2bf1f6);_0x2e59f8(_0x2bf1f6);});});}exports[_0xf165('0x1a')]=function(_0x242331){var _0x181109=this;return new Promise(function(_0x2c3f32,_0x369634){return db[_0xf165('0x1b')]['create'](_0x242331['body'],{'raw':_0x242331[_0xf165('0x1c')]?_0x242331[_0xf165('0x1c')][_0xf165('0x1d')]===undefined?!![]:![]:!![]})[_0xf165('0x1e')](function(_0x113633){logger[_0xf165('0x11')]('CreateWhatsappMessage',_0x242331);logger[_0xf165('0x1f')](_0xf165('0x1a'),_0x242331,JSON['stringify'](_0x113633));_0x2c3f32(_0x113633);})[_0xf165('0x19')](function(_0x1f2d3b){logger[_0xf165('0x16')]('CreateWhatsappMessage',_0x1f2d3b['message'],_0x242331);_0x369634(_0x181109[_0xf165('0x16')](0x1f4,_0x1f2d3b[_0xf165('0x18')]));});});}; \ No newline at end of file +var _0x9359=['request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','socket.io-emitter','request','then','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x46e75d,_0x198360){var _0x3b5174=function(_0x439301){while(--_0x439301){_0x46e75d['push'](_0x46e75d['shift']());}};_0x3b5174(++_0x198360);}(_0x9359,0x7e));var _0x9935=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9359[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9935('0x0'));var util=require(_0x9935('0x1'));var moment=require('moment');var BPromise=require(_0x9935('0x2'));var rs=require(_0x9935('0x3'));var fs=require('fs');var Redis=require(_0x9935('0x4'));var db=require(_0x9935('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9935('0x6'))('rpc');var config=require(_0x9935('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9935('0x8')]=_['defaults'](config[_0x9935('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9935('0x9'))(new Redis(config[_0x9935('0x8')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x309e43,_0xbd99a4,_0x19435a){return new BPromise(function(_0x2f5d73,_0x46ba4b){return client[_0x9935('0xa')](_0x309e43,_0x19435a)[_0x9935('0xb')](function(_0x441d97){logger[_0x9935('0xc')](_0x9935('0xd'),_0xbd99a4,_0x9935('0xe'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xbd99a4,_0x9935('0xe'),JSON[_0x9935('0xf')](_0x441d97));if(_0x441d97[_0x9935('0x10')]){if(_0x441d97[_0x9935('0x10')][_0x9935('0x11')]===0x1f4){logger['error'](_0x9935('0xd'),_0xbd99a4,_0x441d97['error']['message']);return _0x46ba4b(_0x441d97[_0x9935('0x10')][_0x9935('0x12')]);}logger[_0x9935('0x10')](_0x9935('0xd'),_0xbd99a4,_0x441d97[_0x9935('0x10')]['message']);return _0x2f5d73(_0x441d97[_0x9935('0x10')][_0x9935('0x12')]);}else{logger[_0x9935('0xc')](_0x9935('0xd'),_0xbd99a4,_0x9935('0xe'));_0x2f5d73(_0x441d97[_0x9935('0x13')][_0x9935('0x12')]);}})[_0x9935('0x14')](function(_0x445499){logger[_0x9935('0x10')](_0x9935('0xd'),_0xbd99a4,_0x445499);_0x46ba4b(_0x445499);});});}exports[_0x9935('0x15')]=function(_0x38c3df){var _0xa8bb08=this;return new Promise(function(_0x4ad89a,_0xa53cd9){return db[_0x9935('0x16')][_0x9935('0x17')](_0x38c3df[_0x9935('0x18')],{'raw':_0x38c3df[_0x9935('0x19')]?_0x38c3df['options'][_0x9935('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x49a600){logger[_0x9935('0xc')]('CreateWhatsappMessage',_0x38c3df);logger[_0x9935('0x1b')](_0x9935('0x15'),_0x38c3df,JSON['stringify'](_0x49a600));_0x4ad89a(_0x49a600);})[_0x9935('0x14')](function(_0x2290fa){logger[_0x9935('0x10')](_0x9935('0x15'),_0x2290fa[_0x9935('0x12')],_0x38c3df);_0xa53cd9(_0xa8bb08[_0x9935('0x10')](0x1f4,_0x2290fa[_0x9935('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6e710d1..c457ee5 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 _0x80cf=['save','remove','emit','removeListener','register','./whatsappMessage.events'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x80cf,0x16d));var _0xf80c=function(_0x4e7a4e,_0x218f42){_0x4e7a4e=_0x4e7a4e-0x0;var _0x313e05=_0x80cf[_0x4e7a4e];return _0x313e05;};'use strict';var WhatsappMessageEvents=require(_0xf80c('0x0'));var events=[_0xf80c('0x1'),_0xf80c('0x2'),'update'];function createListener(_0x53f743,_0x4d947d){return function(_0x249424){_0x4d947d[_0xf80c('0x3')](_0x53f743,_0x249424);};}function removeListener(_0x498e19,_0x5f4ab2){return function(){WhatsappMessageEvents[_0xf80c('0x4')](_0x498e19,_0x5f4ab2);};}exports[_0xf80c('0x5')]=function(_0x1a8da4){for(var _0x4ba3d8=0x0,_0x43970a=events['length'];_0x4ba3d8<_0x43970a;_0x4ba3d8++){var _0x16ade1=events[_0x4ba3d8];var _0x5f1a68=createListener('whatsappMessage:'+_0x16ade1,_0x1a8da4);WhatsappMessageEvents['on'](_0x16ade1,_0x5f1a68);}}; \ No newline at end of file +var _0xd625=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x140059,_0x309762){var _0x2171b6=function(_0xba5388){while(--_0xba5388){_0x140059['push'](_0x140059['shift']());}};_0x2171b6(++_0x309762);}(_0xd625,0xbb));var _0x5d62=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xd625[_0x134c2e];return _0x2825db;};'use strict';var WhatsappMessageEvents=require(_0x5d62('0x0'));var events=[_0x5d62('0x1'),_0x5d62('0x2'),_0x5d62('0x3')];function createListener(_0x22853f,_0x528a2a){return function(_0x22f5dc){_0x528a2a[_0x5d62('0x4')](_0x22853f,_0x22f5dc);};}function removeListener(_0x1a33cb,_0x364f65){return function(){WhatsappMessageEvents['removeListener'](_0x1a33cb,_0x364f65);};}exports[_0x5d62('0x5')]=function(_0x471e02){for(var _0x1412fd=0x0,_0x3ed68e=events[_0x5d62('0x6')];_0x1412fd<_0x3ed68e;_0x1412fd++){var _0xf6e283=events[_0x1412fd];var _0x1d4ab1=createListener(_0x5d62('0x7')+_0xf6e283,_0x471e02);WhatsappMessageEvents['on'](_0xf6e283,_0x1d4ab1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9e2c989..946c66e 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 _0x6897=['./whatsappQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x6897,0x102));var _0x7689=function(_0x1825ca,_0x226c42){_0x1825ca=_0x1825ca-0x0;var _0x2b6413=_0x6897[_0x1825ca];return _0x2b6413;};'use strict';var multer=require('multer');var util=require(_0x7689('0x0'));var path=require(_0x7689('0x1'));var timeout=require(_0x7689('0x2'));var express=require(_0x7689('0x3'));var router=express['Router']();var auth=require(_0x7689('0x4'));var interaction=require(_0x7689('0x5'));var config=require('../../config/environment');var controller=require(_0x7689('0x6'));router[_0x7689('0x7')]('/',auth[_0x7689('0x8')](),controller['index']);router[_0x7689('0x7')](_0x7689('0x9'),auth['isAuthenticated'](),controller[_0x7689('0xa')]);router[_0x7689('0x7')]('/:id',auth[_0x7689('0x8')](),controller[_0x7689('0xb')]);router[_0x7689('0x7')](_0x7689('0xc'),auth[_0x7689('0x8')](),controller[_0x7689('0xd')]);router[_0x7689('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7689('0xe')]);router[_0x7689('0x7')](_0x7689('0xf'),auth[_0x7689('0x8')](),controller['getAgents']);router[_0x7689('0x10')]('/',auth[_0x7689('0x8')](),controller[_0x7689('0x11')]);router[_0x7689('0x10')]('/:id/teams',auth[_0x7689('0x8')](),controller[_0x7689('0x12')]);router['post'](_0x7689('0xf'),auth[_0x7689('0x8')](),controller['addAgents']);router[_0x7689('0x13')]('/:id',auth[_0x7689('0x8')](),controller['update']);router[_0x7689('0x14')]('/:id',auth[_0x7689('0x8')](),controller[_0x7689('0x15')]);router[_0x7689('0x14')]('/:id/teams',auth[_0x7689('0x8')](),controller['removeTeams']);router['delete'](_0x7689('0xf'),auth['isAuthenticated'](),controller[_0x7689('0x16')]);module[_0x7689('0x17')]=router; \ No newline at end of file +var _0x89c3=['post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','express','Router','../../components/auth/service','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents'];(function(_0x505099,_0xb10ee1){var _0x577eba=function(_0x4b36b1){while(--_0x4b36b1){_0x505099['push'](_0x505099['shift']());}};_0x577eba(++_0xb10ee1);}(_0x89c3,0x184));var _0x389c=function(_0x375304,_0xd114e){_0x375304=_0x375304-0x0;var _0x30b31f=_0x89c3[_0x375304];return _0x30b31f;};'use strict';var multer=require('multer');var util=require(_0x389c('0x0'));var path=require(_0x389c('0x1'));var timeout=require('connect-timeout');var express=require(_0x389c('0x2'));var router=express[_0x389c('0x3')]();var auth=require(_0x389c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x389c('0x5'));router[_0x389c('0x6')]('/',auth['isAuthenticated'](),controller[_0x389c('0x7')]);router[_0x389c('0x6')](_0x389c('0x8'),auth['isAuthenticated'](),controller[_0x389c('0x9')]);router[_0x389c('0x6')](_0x389c('0xa'),auth[_0x389c('0xb')](),controller[_0x389c('0xc')]);router[_0x389c('0x6')](_0x389c('0xd'),auth[_0x389c('0xb')](),controller[_0x389c('0xe')]);router['get']('/:id/teams',auth[_0x389c('0xb')](),controller[_0x389c('0xf')]);router['get'](_0x389c('0x10'),auth['isAuthenticated'](),controller[_0x389c('0x11')]);router[_0x389c('0x12')]('/',auth[_0x389c('0xb')](),controller[_0x389c('0x13')]);router['post'](_0x389c('0x14'),auth[_0x389c('0xb')](),controller[_0x389c('0x15')]);router['post']('/:id/users',auth[_0x389c('0xb')](),controller[_0x389c('0x16')]);router[_0x389c('0x17')](_0x389c('0xa'),auth[_0x389c('0xb')](),controller[_0x389c('0x18')]);router[_0x389c('0x19')](_0x389c('0xa'),auth[_0x389c('0xb')](),controller['destroy']);router[_0x389c('0x19')]('/:id/teams',auth[_0x389c('0xb')](),controller[_0x389c('0x1a')]);router[_0x389c('0x19')](_0x389c('0x10'),auth['isAuthenticated'](),controller[_0x389c('0x1b')]);module[_0x389c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6ceec77..7df0819 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 _0xefea=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xefea,0xd1));var _0xaefe=function(_0x36ac80,_0xeb0a63){_0x36ac80=_0x36ac80-0x0;var _0x4a8cbf=_0xefea[_0x36ac80];return _0x4a8cbf;};'use strict';var Sequelize=require(_0xaefe('0x0'));module['exports']={'name':{'type':Sequelize[_0xaefe('0x1')],'unique':_0xaefe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaefe('0x3')](_0xaefe('0x4'),_0xaefe('0x5'),_0xaefe('0x6'))},'description':{'type':Sequelize[_0xaefe('0x1')]}}; \ No newline at end of file +var _0x1d87=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x358576,_0x43cbcb){var _0x10652d=function(_0x1f9162){while(--_0x1f9162){_0x358576['push'](_0x358576['shift']());}};_0x10652d(++_0x43cbcb);}(_0x1d87,0x188));var _0x71d8=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x1d87[_0x562362];return _0x3a18ce;};'use strict';var Sequelize=require('sequelize');module[_0x71d8('0x0')]={'name':{'type':Sequelize[_0x71d8('0x1')],'unique':_0x71d8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x71d8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x71d8('0x4')](_0x71d8('0x5'),_0x71d8('0x6'),_0x71d8('0x7'))},'description':{'type':Sequelize[_0x71d8('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 26f66c9..81d22e1 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 _0xc180=['catch','show','keys','length','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','User','UserId','agent','whatsappPause','createdAt','%s/%s','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','union','compact','value','transaction','ids','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueue','findAll','rows'];(function(_0x156c46,_0x331fa6){var _0x5b3462=function(_0x43378){while(--_0x43378){_0x156c46['push'](_0x156c46['shift']());}};_0x5b3462(++_0x331fa6);}(_0xc180,0x15e));var _0x0c18=function(_0x17fb7b,_0xc249f2){_0x17fb7b=_0x17fb7b-0x0;var _0xa802b9=_0xc180[_0x17fb7b];return _0xa802b9;};'use strict';var pdf=require(_0x0c18('0x0'));var emlformat=require(_0x0c18('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0c18('0x2'));var rp=require(_0x0c18('0x3'));var moment=require(_0x0c18('0x4'));var BPromise=require(_0x0c18('0x5'));var Mustache=require(_0x0c18('0x6'));var util=require(_0x0c18('0x7'));var path=require(_0x0c18('0x8'));var sox=require(_0x0c18('0x9'));var csv=require(_0x0c18('0xa'));var ejs=require(_0x0c18('0xb'));var fs=require('fs');var _=require(_0x0c18('0xc'));var squel=require(_0x0c18('0xd'));var crypto=require(_0x0c18('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0c18('0xf'));var toCsv=require(_0x0c18('0xa'));var querystring=require(_0x0c18('0x10'));var Papa=require('papaparse');var Redis=require(_0x0c18('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c18('0x12'));var logger=require(_0x0c18('0x13'))(_0x0c18('0x14'));var utils=require(_0x0c18('0x15'));var config=require('../../config/environment');var db=require(_0x0c18('0x16'))['db'];config[_0x0c18('0x17')]=_['defaults'](config[_0x0c18('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c18('0x18'))(new Redis(config['redis']));require(_0x0c18('0x19'))[_0x0c18('0x1a')](socket);function respondWithStatusCode(_0x1f5e1b,_0x268f82){_0x268f82=_0x268f82||0xcc;return function(_0xe27634){if(_0xe27634){return _0x1f5e1b[_0x0c18('0x1b')](_0x268f82);}return _0x1f5e1b[_0x0c18('0x1c')](_0x268f82)[_0x0c18('0x1d')]();};}function respondWithResult(_0x3efc70,_0x371aa1){_0x371aa1=_0x371aa1||0xc8;return function(_0x204f4b){if(_0x204f4b){return _0x3efc70['status'](_0x371aa1)['json'](_0x204f4b);}};}function respondWithFilteredResult(_0x38cc80,_0x1d9aba){return function(_0xc17828){if(_0xc17828){var _0x4f1019=_0xc17828[_0x0c18('0x1e')],_0x12b75a=_0x1d9aba[_0x0c18('0x1f')],_0x32cfc2=_0x1d9aba[_0x0c18('0x1f')]+_0x1d9aba['limit'],_0x2e644b;if(_0x32cfc2>=_0x4f1019){_0x32cfc2=_0x4f1019;_0x2e644b=0xc8;}else{_0x2e644b=0xce;}_0x38cc80[_0x0c18('0x1c')](_0x2e644b);return _0x38cc80[_0x0c18('0x20')]('Content-Range',_0x12b75a+'-'+_0x32cfc2+'/'+_0x4f1019)[_0x0c18('0x21')](_0xc17828);}return null;};}function patchUpdates(_0x97202d){return function(_0x52aa12){try{jsonpatch[_0x0c18('0x22')](_0x52aa12,_0x97202d,!![]);}catch(_0x5c8fb2){return BPromise[_0x0c18('0x23')](_0x5c8fb2);}return _0x52aa12[_0x0c18('0x24')]();};}function saveUpdates(_0x50f319,_0x464709){return function(_0x54ae57){if(_0x54ae57){return _0x54ae57[_0x0c18('0x25')](_0x50f319)[_0x0c18('0x26')](function(_0x220138){return _0x220138;});}return null;};}function removeEntity(_0x2a82af,_0x19bf98){return function(_0x53e42b){if(_0x53e42b){return _0x53e42b[_0x0c18('0x27')]()[_0x0c18('0x26')](function(){var _0x5215b1=_0x53e42b[_0x0c18('0x28')]({'plain':!![]});var _0x182739='WhatsappQueues';return db[_0x0c18('0x29')][_0x0c18('0x27')]({'where':{'type':_0x182739,'resourceId':_0x5215b1['id']}})[_0x0c18('0x26')](function(){return _0x53e42b;});})[_0x0c18('0x26')](function(){_0x2a82af['status'](0xcc)[_0x0c18('0x1d')]();});}};}function handleEntityNotFound(_0x1c172d,_0x146781){return function(_0x23d9a9){if(!_0x23d9a9){_0x1c172d['sendStatus'](0x194);}return _0x23d9a9;};}function handleError(_0x7f631a,_0x4d0b77){_0x4d0b77=_0x4d0b77||0x1f4;return function(_0x1a3420){logger[_0x0c18('0x2a')](_0x1a3420[_0x0c18('0x2b')]);if(_0x1a3420['name']){delete _0x1a3420[_0x0c18('0x2c')];}_0x7f631a[_0x0c18('0x1c')](_0x4d0b77)[_0x0c18('0x2d')](_0x1a3420);};}exports[_0x0c18('0x2e')]=function(_0x5ad74a,_0x5a2a93){var _0x34725e={},_0x5481c9={},_0x382dda={'count':0x0,'rows':[]};var _0x244905=_[_0x0c18('0x2f')](db['WhatsappQueue'][_0x0c18('0x30')],function(_0x16a61f){return{'name':_0x16a61f['fieldName'],'type':_0x16a61f['type'][_0x0c18('0x31')]};});_0x5481c9[_0x0c18('0x32')]=_[_0x0c18('0x2f')](_0x244905,'name');_0x5481c9['query']=_['keys'](_0x5ad74a[_0x0c18('0x33')]);_0x5481c9[_0x0c18('0x34')]=_[_0x0c18('0x35')](_0x5481c9[_0x0c18('0x32')],_0x5481c9[_0x0c18('0x33')]);_0x34725e['attributes']=_['intersection'](_0x5481c9[_0x0c18('0x32')],qs[_0x0c18('0x36')](_0x5ad74a[_0x0c18('0x33')][_0x0c18('0x36')]));_0x34725e[_0x0c18('0x37')]=_0x34725e[_0x0c18('0x37')]['length']?_0x34725e['attributes']:_0x5481c9[_0x0c18('0x32')];if(!_0x5ad74a[_0x0c18('0x33')]['hasOwnProperty'](_0x0c18('0x38'))){_0x34725e[_0x0c18('0x39')]=qs[_0x0c18('0x39')](_0x5ad74a[_0x0c18('0x33')][_0x0c18('0x39')]);_0x34725e[_0x0c18('0x1f')]=qs['offset'](_0x5ad74a[_0x0c18('0x33')][_0x0c18('0x1f')]);}_0x34725e[_0x0c18('0x3a')]=qs[_0x0c18('0x3b')](_0x5ad74a[_0x0c18('0x33')][_0x0c18('0x3b')]);_0x34725e[_0x0c18('0x3c')]=qs['filters'](_[_0x0c18('0x3d')](_0x5ad74a[_0x0c18('0x33')],_0x5481c9[_0x0c18('0x34')]),_0x244905);if(_0x5ad74a['query'][_0x0c18('0x3e')]){_0x34725e[_0x0c18('0x3c')]=_[_0x0c18('0x3f')](_0x34725e[_0x0c18('0x3c')],{'$or':_[_0x0c18('0x2f')](_0x244905,function(_0x55eeba){if(_0x55eeba[_0x0c18('0x40')]!==_0x0c18('0x41')){var _0x58afed={};_0x58afed[_0x55eeba['name']]={'$like':'%'+_0x5ad74a[_0x0c18('0x33')][_0x0c18('0x3e')]+'%'};return _0x58afed;}})});}_0x34725e=_['merge']({},_0x34725e,_0x5ad74a[_0x0c18('0x42')]);var _0x50d02c={'where':_0x34725e[_0x0c18('0x3c')]};return db[_0x0c18('0x43')][_0x0c18('0x1e')](_0x50d02c)[_0x0c18('0x26')](function(_0x367827){_0x382dda[_0x0c18('0x1e')]=_0x367827;if(_0x5ad74a[_0x0c18('0x33')]['includeAll']){_0x34725e['include']=[{'all':!![]}];}return db[_0x0c18('0x43')][_0x0c18('0x44')](_0x34725e);})[_0x0c18('0x26')](function(_0x266246){_0x382dda[_0x0c18('0x45')]=_0x266246;return _0x382dda;})['then'](respondWithFilteredResult(_0x5a2a93,_0x34725e))[_0x0c18('0x46')](handleError(_0x5a2a93,null));};exports[_0x0c18('0x47')]=function(_0xec7aad,_0x48ab9f){var _0x274727={'raw':!![],'where':{'id':_0xec7aad['params']['id']}},_0x485452={};_0x485452[_0x0c18('0x32')]=_[_0x0c18('0x48')](db[_0x0c18('0x43')][_0x0c18('0x30')]);_0x485452[_0x0c18('0x33')]=_[_0x0c18('0x48')](_0xec7aad[_0x0c18('0x33')]);_0x485452[_0x0c18('0x34')]=_[_0x0c18('0x35')](_0x485452[_0x0c18('0x32')],_0x485452[_0x0c18('0x33')]);_0x274727[_0x0c18('0x37')]=_[_0x0c18('0x35')](_0x485452[_0x0c18('0x32')],qs['fields'](_0xec7aad[_0x0c18('0x33')][_0x0c18('0x36')]));_0x274727[_0x0c18('0x37')]=_0x274727[_0x0c18('0x37')][_0x0c18('0x49')]?_0x274727[_0x0c18('0x37')]:_0x485452[_0x0c18('0x32')];if(_0xec7aad[_0x0c18('0x33')][_0x0c18('0x4a')]){_0x274727[_0x0c18('0x4b')]=[{'all':!![]}];}_0x274727=_['merge']({},_0x274727,_0xec7aad['options']);return db[_0x0c18('0x43')]['find'](_0x274727)[_0x0c18('0x26')](handleEntityNotFound(_0x48ab9f,null))[_0x0c18('0x26')](respondWithResult(_0x48ab9f,null))[_0x0c18('0x46')](handleError(_0x48ab9f,null));};exports['create']=function(_0x1f9626,_0x3389b1){return db[_0x0c18('0x43')][_0x0c18('0x4c')](_0x1f9626[_0x0c18('0x4d')],{})['then'](function(_0x4cee99){var _0xf7fa69=_0x1f9626[_0x0c18('0x4e')][_0x0c18('0x28')]({'plain':!![]});if(!_0xf7fa69)throw new Error(_0x0c18('0x4f'));if(_0xf7fa69[_0x0c18('0x50')]===_0x0c18('0x4e')){var _0x5e35e8=_0x4cee99[_0x0c18('0x28')]({'plain':!![]});var _0x5082ae=_0x0c18('0x51');return db[_0x0c18('0x52')][_0x0c18('0x53')]({'where':{'name':_0x5082ae,'userProfileId':_0xf7fa69[_0x0c18('0x54')]},'raw':!![]})[_0x0c18('0x26')](function(_0x491dd7){if(_0x491dd7&&_0x491dd7[_0x0c18('0x55')]===0x0){return db[_0x0c18('0x29')][_0x0c18('0x4c')]({'name':_0x5e35e8[_0x0c18('0x2c')],'resourceId':_0x5e35e8['id'],'type':_0x491dd7[_0x0c18('0x2c')],'sectionId':_0x491dd7['id']},{})[_0x0c18('0x26')](function(){return _0x4cee99;});}else{return _0x4cee99;}})[_0x0c18('0x46')](function(_0x49e0b2){logger[_0x0c18('0x2a')](_0x0c18('0x56'),_0x49e0b2);throw _0x49e0b2;});}return _0x4cee99;})[_0x0c18('0x26')](respondWithResult(_0x3389b1,0xc9))[_0x0c18('0x46')](handleError(_0x3389b1,null));};exports[_0x0c18('0x25')]=function(_0x180741,_0x2dd5e9){if(_0x180741[_0x0c18('0x4d')]['id']){delete _0x180741['body']['id'];}return db[_0x0c18('0x43')]['find']({'where':{'id':_0x180741['params']['id']}})['then'](handleEntityNotFound(_0x2dd5e9,null))[_0x0c18('0x26')](saveUpdates(_0x180741[_0x0c18('0x4d')],null))[_0x0c18('0x26')](respondWithResult(_0x2dd5e9,null))[_0x0c18('0x46')](handleError(_0x2dd5e9,null));};exports[_0x0c18('0x27')]=function(_0x55cab7,_0x31fb7d){return db[_0x0c18('0x43')]['find']({'where':{'id':_0x55cab7[_0x0c18('0x57')]['id']}})[_0x0c18('0x26')](handleEntityNotFound(_0x31fb7d,null))[_0x0c18('0x26')](removeEntity(_0x31fb7d,null))[_0x0c18('0x46')](handleError(_0x31fb7d,null));};exports[_0x0c18('0x58')]=function(_0x5f4dbd,_0x314698){return db[_0x0c18('0x43')][_0x0c18('0x58')]()[_0x0c18('0x26')](respondWithResult(_0x314698,null))[_0x0c18('0x46')](handleError(_0x314698,null));};exports[_0x0c18('0x59')]=function(_0x35b7f4,_0x5bb38c,_0x524688){var _0x3a5bd8={'raw':!![],'where':{}},_0x204724={},_0x5d7414;return db[_0x0c18('0x43')][_0x0c18('0x5a')]({'where':{'id':_0x35b7f4[_0x0c18('0x57')]['id']}})['then'](handleEntityNotFound(_0x5bb38c,null))[_0x0c18('0x26')](function(_0x24704f){if(_0x24704f){_0x5d7414=_0x24704f[_0x0c18('0x28')]({'plain':!![]});_0x204724['model']=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x204724[_0x0c18('0x33')]=_[_0x0c18('0x48')](_0x35b7f4[_0x0c18('0x33')]);_0x204724[_0x0c18('0x34')]=_[_0x0c18('0x35')](_0x204724[_0x0c18('0x32')],_0x204724[_0x0c18('0x33')]);_0x3a5bd8[_0x0c18('0x37')]=_[_0x0c18('0x35')](_0x204724[_0x0c18('0x32')],qs[_0x0c18('0x36')](_0x35b7f4[_0x0c18('0x33')][_0x0c18('0x36')]));_0x3a5bd8[_0x0c18('0x37')]=_0x3a5bd8[_0x0c18('0x37')]['length']?_0x3a5bd8[_0x0c18('0x37')]:_0x204724[_0x0c18('0x32')];if(!_0x35b7f4[_0x0c18('0x33')][_0x0c18('0x5b')](_0x0c18('0x38'))){_0x3a5bd8[_0x0c18('0x39')]=qs['limit'](_0x35b7f4[_0x0c18('0x33')]['limit']);_0x3a5bd8['offset']=qs['offset'](_0x35b7f4[_0x0c18('0x33')][_0x0c18('0x1f')]);}_0x3a5bd8['order']=qs[_0x0c18('0x3b')](_0x35b7f4['query']['sort']);_0x3a5bd8[_0x0c18('0x3c')]=qs[_0x0c18('0x34')](_['pick'](_0x35b7f4[_0x0c18('0x33')],_0x204724['filters']));_0x3a5bd8[_0x0c18('0x3c')][_0x0c18('0x5c')]=_0x24704f['id'];if(_0x35b7f4[_0x0c18('0x33')][_0x0c18('0x3e')]){_0x3a5bd8[_0x0c18('0x3c')]=_[_0x0c18('0x3f')](_0x3a5bd8['where'],{'$or':_[_0x0c18('0x2f')](_0x3a5bd8[_0x0c18('0x37')],function(_0xf60c39){var _0x292710={};_0x292710[_0xf60c39]={'$like':'%'+_0x35b7f4[_0x0c18('0x33')][_0x0c18('0x3e')]+'%'};return _0x292710;})});}_0x3a5bd8=_[_0x0c18('0x3f')]({},_0x3a5bd8,_0x35b7f4[_0x0c18('0x42')]);return db[_0x0c18('0x5d')][_0x0c18('0x44')](_0x3a5bd8);}})[_0x0c18('0x26')](function(_0x571b9d){if(_0x571b9d){return db[_0x0c18('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x571b9d,_0x0c18('0x5f')),'role':_0x0c18('0x60')},'attributes':['id',_0x0c18('0x2c'),_0x0c18('0x61'),'updatedAt',_0x0c18('0x62')]});}})[_0x0c18('0x26')](function(_0x561b39){if(_0x561b39){return{'count':_0x561b39['count'],'rows':_[_0x0c18('0x2f')](_0x561b39[_0x0c18('0x45')],function(_0x57f545){return{'membername':_0x57f545[_0x0c18('0x2c')],'UserId':_0x57f545['id'],'queue_name':_0x5d7414[_0x0c18('0x2c')],'WhatsappQueueId':_0x5d7414['id'],'interface':util['format'](_0x0c18('0x63'),'SIP',_0x57f545[_0x0c18('0x2c')]),'penalty':0x0,'paused':_0x57f545[_0x0c18('0x61')],'createdAt':_0x57f545[_0x0c18('0x62')],'updatedAt':_0x57f545[_0x0c18('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5bb38c,_0x3a5bd8))[_0x0c18('0x46')](handleError(_0x5bb38c,null));};exports[_0x0c18('0x65')]=function(_0x14ca3f,_0x180d6a,_0x24783){var _0x2ec777={};var _0x41518a={};var _0x25e87b;var _0x3fddef;return db[_0x0c18('0x43')][_0x0c18('0x5a')]({'where':{'id':_0x14ca3f[_0x0c18('0x57')]['id']}})[_0x0c18('0x26')](handleEntityNotFound(_0x180d6a,null))[_0x0c18('0x26')](function(_0x54d780){if(_0x54d780){_0x25e87b=_0x54d780;_0x41518a[_0x0c18('0x32')]=_['keys'](db[_0x0c18('0x66')][_0x0c18('0x30')]);_0x41518a['query']=_[_0x0c18('0x48')](_0x14ca3f['query']);_0x41518a[_0x0c18('0x34')]=_[_0x0c18('0x35')](_0x41518a['model'],_0x41518a[_0x0c18('0x33')]);_0x2ec777['attributes']=_['intersection'](_0x41518a[_0x0c18('0x32')],qs['fields'](_0x14ca3f[_0x0c18('0x33')][_0x0c18('0x36')]));_0x2ec777[_0x0c18('0x37')]=_0x2ec777[_0x0c18('0x37')][_0x0c18('0x49')]?_0x2ec777['attributes']:_0x41518a[_0x0c18('0x32')];_0x2ec777[_0x0c18('0x3a')]=qs[_0x0c18('0x3b')](_0x14ca3f[_0x0c18('0x33')][_0x0c18('0x3b')]);_0x2ec777[_0x0c18('0x3c')]=qs[_0x0c18('0x34')](_[_0x0c18('0x3d')](_0x14ca3f[_0x0c18('0x33')],_0x41518a[_0x0c18('0x34')]));if(_0x14ca3f[_0x0c18('0x33')][_0x0c18('0x3e')]){_0x2ec777[_0x0c18('0x3c')]=_[_0x0c18('0x3f')](_0x2ec777['where'],{'$or':_[_0x0c18('0x2f')](_0x2ec777[_0x0c18('0x37')],function(_0x41d31f){var _0x4a8df2={};_0x4a8df2[_0x41d31f]={'$like':'%'+_0x14ca3f[_0x0c18('0x33')]['filter']+'%'};return _0x4a8df2;})});}_0x2ec777=_[_0x0c18('0x3f')]({},_0x2ec777,_0x14ca3f['options']);return _0x25e87b[_0x0c18('0x65')](_0x2ec777);}})[_0x0c18('0x26')](function(_0x3d90d5){if(_0x3d90d5){_0x3fddef=_0x3d90d5[_0x0c18('0x49')];if(!_0x14ca3f[_0x0c18('0x33')][_0x0c18('0x5b')](_0x0c18('0x38'))){_0x2ec777[_0x0c18('0x39')]=qs[_0x0c18('0x39')](_0x14ca3f['query'][_0x0c18('0x39')]);_0x2ec777['offset']=qs[_0x0c18('0x1f')](_0x14ca3f[_0x0c18('0x33')]['offset']);}return _0x25e87b[_0x0c18('0x65')](_0x2ec777);}})[_0x0c18('0x26')](function(_0x383e40){if(_0x383e40){return _0x383e40?{'count':_0x3fddef,'rows':_0x383e40}:null;}})[_0x0c18('0x26')](respondWithResult(_0x180d6a,null))['catch'](handleError(_0x180d6a,null));};exports[_0x0c18('0x67')]=function(_0x4e417c,_0x2b9816,_0x4a4f4e){var _0xe3261c=_0x4e417c['body']['ids'];return db['Team'][_0x0c18('0x44')]({'where':{'id':_0xe3261c},'attributes':['id'],'include':[{'model':db[_0x0c18('0x5e')],'as':_0x0c18('0x68'),'attributes':['id','name',_0x0c18('0x69'),_0x0c18('0x6a'),_0x0c18('0x6b')],'raw':!![]}]})[_0x0c18('0x26')](function(_0x2b8db2){if(_0x2b8db2){var _0x3874be=_[_0x0c18('0x6c')](_0x2b8db2,function(_0x23e346){var _0x3dc12c=_0x23e346[_0x0c18('0x28')]({'plain':!![]});return _0x3dc12c[_0x0c18('0x68')];});return db[_0x0c18('0x43')]['find']({'where':{'id':_0x4e417c[_0x0c18('0x57')]['id']}})[_0x0c18('0x26')](function(_0x56406d){return db['sequelize']['transaction'](function(_0x3fa3b3){return _0x56406d[_0x0c18('0x67')](_0xe3261c,{'transaction':_0x3fa3b3})['then'](function(){return BPromise[_0x0c18('0x6d')](_0x3874be,function(_0x3b0293){return db['UserWhatsappQueue'][_0x0c18('0x6e')]({'where':{'UserId':_0x3b0293['id'],'WhatsappQueueId':_0x4e417c[_0x0c18('0x57')]['id']},'transaction':_0x3fa3b3});});})[_0x0c18('0x26')](function(){_0x3874be[_0x0c18('0x6f')](function(_0x12b59f){socket['emit'](_0x0c18('0x70'),{'UserId':_0x12b59f['id'],'WhatsappQueueId':_0x56406d['id']});});});});});}})[_0x0c18('0x26')](respondWithStatusCode(_0x2b9816,null))[_0x0c18('0x46')](handleError(_0x2b9816,null));};exports[_0x0c18('0x71')]=function(_0xb6797f,_0x112dff,_0x275c2b){return db[_0x0c18('0x66')][_0x0c18('0x44')]({'where':{'id':_0xb6797f[_0x0c18('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0c18('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x112dff,null))[_0x0c18('0x26')](function(_0x10549c){var _0x1fe710=_[_0x0c18('0x2f')](_0x10549c,'id');var _0x2a7361=[];var _0x113e26=[];var _0x3f9a30=squel['select']();_0x3f9a30['field']('tq.TeamId')[_0x0c18('0x72')](_0x0c18('0x73'),'tq')[_0x0c18('0x74')]('user_has_teams','ut',_0x0c18('0x75'))[_0x0c18('0x3c')](_0x0c18('0x76'),_0xb6797f[_0x0c18('0x57')]['id']);for(var _0x44dbc7=0x0;_0x44dbc7<_0x10549c[_0x0c18('0x49')];_0x44dbc7+=0x1){let _0x1e34e8=_0x10549c[_0x44dbc7];for(var _0x282e3e=0x0;_0x282e3e<_0x1e34e8[_0x0c18('0x68')]['length'];_0x282e3e+=0x1){let _0x39ee30=_0x1e34e8[_0x0c18('0x68')][_0x282e3e];var _0x20c71b=_0x3f9a30[_0x0c18('0x77')]();_0x20c71b['where'](_0x0c18('0x78'),_0x39ee30['id']);_0x113e26['push'](db[_0x0c18('0x79')][_0x0c18('0x33')](_0x20c71b['toString'](),{'type':db[_0x0c18('0x79')][_0x0c18('0x7a')][_0x0c18('0x7b')]})[_0x0c18('0x26')](function(_0x359e31){if(_0x359e31[_0x0c18('0x49')]===0x1){return _0x39ee30['id'];}else{var _0x2ae888=_[_0x0c18('0x7c')](_[_0x0c18('0x2f')](_0x359e31,_0x0c18('0x7d')),function(_0x21d5f7){return _['includes'](_0x1fe710,_0x21d5f7);});if(_0x2ae888){return _0x39ee30['id'];}}}));}}return BPromise['all'](_0x113e26)[_0x0c18('0x26')](function(_0x520fe9){_0x2a7361=_(_0x2a7361)[_0x0c18('0x7e')](_0x520fe9)[_0x0c18('0x7f')]()[_0x0c18('0x80')]();return db[_0x0c18('0x43')]['find']({'where':{'id':_0xb6797f['params']['id']}})[_0x0c18('0x26')](function(_0x599103){return db[_0x0c18('0x79')][_0x0c18('0x81')](function(_0x1e05b4){return _0x599103[_0x0c18('0x71')](_0xb6797f[_0x0c18('0x33')][_0x0c18('0x82')],{'transaction':_0x1e05b4})['then'](function(){if(!_[_0x0c18('0x83')](_0x2a7361)){return _0x599103['removeAgents'](_0x2a7361,{'transaction':_0x1e05b4});}})[_0x0c18('0x26')](function(){_0x2a7361[_0x0c18('0x6f')](function(_0x267fd7){socket[_0x0c18('0x84')](_0x0c18('0x85'),{'UserId':_0x267fd7,'WhatsappQueueId':_0x599103['id']});});});});});});})[_0x0c18('0x26')](respondWithStatusCode(_0x112dff,null))[_0x0c18('0x46')](handleError(_0x112dff,null));};exports[_0x0c18('0x86')]=function(_0x28abbe,_0x344cd8,_0x3460da){return db['WhatsappQueue'][_0x0c18('0x53')]({'where':{'id':_0x28abbe[_0x0c18('0x57')]['id']}})['then'](handleEntityNotFound(_0x344cd8,null))[_0x0c18('0x26')](function(_0xaee5bb){if(_0xaee5bb){return _0xaee5bb[_0x0c18('0x86')](_0x28abbe[_0x0c18('0x4d')][_0x0c18('0x82')],_[_0x0c18('0x87')](_0x28abbe[_0x0c18('0x4d')],[_0x0c18('0x82'),'id'])||{})[_0x0c18('0x88')](function(_0x3f665b){for(var _0x3b6458=0x0;_0x3b6458<_0x28abbe['body'][_0x0c18('0x82')][_0x0c18('0x49')];_0x3b6458+=0x1){socket[_0x0c18('0x84')](_0x0c18('0x70'),{'UserId':_0x28abbe[_0x0c18('0x4d')][_0x0c18('0x82')][_0x3b6458],'WhatsappQueueId':_0x28abbe[_0x0c18('0x57')]['id']});}return _0x3f665b;});}})['then'](respondWithResult(_0x344cd8,null))[_0x0c18('0x46')](handleError(_0x344cd8,null));};exports[_0x0c18('0x89')]=function(_0x55eba5,_0x1ed2da,_0x1e2ffd){return db['WhatsappQueue'][_0x0c18('0x53')]({'where':{'id':_0x55eba5[_0x0c18('0x57')]['id']}})[_0x0c18('0x26')](handleEntityNotFound(_0x1ed2da,null))[_0x0c18('0x26')](function(_0x509fa6){if(_0x509fa6){return _0x509fa6[_0x0c18('0x89')](_0x55eba5[_0x0c18('0x33')][_0x0c18('0x82')])[_0x0c18('0x26')](function(){if(_[_0x0c18('0x8a')](_0x55eba5[_0x0c18('0x33')][_0x0c18('0x82')])){for(var _0x1c2835=0x0;_0x1c2835<_0x55eba5[_0x0c18('0x33')][_0x0c18('0x82')][_0x0c18('0x49')];_0x1c2835+=0x1){socket[_0x0c18('0x84')](_0x0c18('0x85'),{'UserId':Number(_0x55eba5[_0x0c18('0x33')][_0x0c18('0x82')][_0x1c2835]),'WhatsappQueueId':Number(_0x55eba5[_0x0c18('0x57')]['id'])});}}else{socket['emit'](_0x0c18('0x85'),{'UserId':Number(_0x55eba5[_0x0c18('0x33')]['ids']),'WhatsappQueueId':Number(_0x55eba5[_0x0c18('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ed2da,null))['catch'](handleError(_0x1ed2da,null));};exports[_0x0c18('0x8b')]=function(_0x392eb8,_0x40a18d,_0x4fb969){var _0x4d35bf={};var _0x141f7d={};var _0x90a471;var _0xbc8b2d;return db[_0x0c18('0x43')][_0x0c18('0x5a')]({'where':{'id':_0x392eb8['params']['id']}})['then'](handleEntityNotFound(_0x40a18d,null))[_0x0c18('0x26')](function(_0x5601d0){if(_0x5601d0){_0x90a471=_0x5601d0;_0x141f7d['model']=_[_0x0c18('0x48')](db[_0x0c18('0x5e')]['rawAttributes']);_0x141f7d[_0x0c18('0x33')]=_[_0x0c18('0x48')](_0x392eb8[_0x0c18('0x33')]);_0x141f7d['filters']=_[_0x0c18('0x35')](_0x141f7d[_0x0c18('0x32')],_0x141f7d['query']);_0x4d35bf[_0x0c18('0x37')]=_[_0x0c18('0x35')](_0x141f7d[_0x0c18('0x32')],qs[_0x0c18('0x36')](_0x392eb8[_0x0c18('0x33')][_0x0c18('0x36')]));_0x4d35bf[_0x0c18('0x37')]=_0x4d35bf[_0x0c18('0x37')]['length']?_0x4d35bf[_0x0c18('0x37')]:_0x141f7d[_0x0c18('0x32')];_0x4d35bf['order']=qs[_0x0c18('0x3b')](_0x392eb8['query'][_0x0c18('0x3b')]);_0x4d35bf['where']=qs[_0x0c18('0x34')](_[_0x0c18('0x3d')](_0x392eb8[_0x0c18('0x33')],_0x141f7d[_0x0c18('0x34')]));if(_0x392eb8['query']['filter']){_0x4d35bf[_0x0c18('0x3c')]=_[_0x0c18('0x3f')](_0x4d35bf[_0x0c18('0x3c')],{'$or':_['map'](_0x4d35bf['attributes'],function(_0x351e1b){var _0x22fb38={};_0x22fb38[_0x351e1b]={'$like':'%'+_0x392eb8[_0x0c18('0x33')][_0x0c18('0x3e')]+'%'};return _0x22fb38;})});}_0x4d35bf=_[_0x0c18('0x3f')]({},_0x4d35bf,_0x392eb8['options']);return _0x90a471[_0x0c18('0x8b')](_0x4d35bf);}})['then'](function(_0x454db9){if(_0x454db9){_0xbc8b2d=_0x454db9[_0x0c18('0x49')];if(!_0x392eb8[_0x0c18('0x33')][_0x0c18('0x5b')](_0x0c18('0x38'))){_0x4d35bf['limit']=qs[_0x0c18('0x39')](_0x392eb8['query'][_0x0c18('0x39')]);_0x4d35bf['offset']=qs[_0x0c18('0x1f')](_0x392eb8[_0x0c18('0x33')]['offset']);}return _0x90a471[_0x0c18('0x8b')](_0x4d35bf);}})['then'](function(_0x19e7b3){if(_0x19e7b3){return _0x19e7b3?{'count':_0xbc8b2d,'rows':_0x19e7b3}:null;}})['then'](respondWithResult(_0x40a18d,null))[_0x0c18('0x46')](handleError(_0x40a18d,null));}; \ No newline at end of file +var _0x77d2=['userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','UserWhatsappQueue','length','User','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','pick','addTeams','ids','findAll','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:remove','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','WhatsappQueue','include','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x77d2,0xcc));var _0x277d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x77d2[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require(_0x277d('0x0'));var emlformat=require(_0x277d('0x1'));var rimraf=require(_0x277d('0x2'));var zipdir=require(_0x277d('0x3'));var jsonpatch=require(_0x277d('0x4'));var rp=require(_0x277d('0x5'));var moment=require(_0x277d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x277d('0x7'));var util=require(_0x277d('0x8'));var path=require(_0x277d('0x9'));var sox=require(_0x277d('0xa'));var csv=require(_0x277d('0xb'));var ejs=require(_0x277d('0xc'));var fs=require('fs');var _=require(_0x277d('0xd'));var squel=require(_0x277d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x277d('0xf'));var toCsv=require(_0x277d('0xb'));var querystring=require(_0x277d('0x10'));var Papa=require(_0x277d('0x11'));var Redis=require(_0x277d('0x12'));var authService=require(_0x277d('0x13'));var qs=require(_0x277d('0x14'));var as=require(_0x277d('0x15'));var hardwareService=require(_0x277d('0x16'));var logger=require(_0x277d('0x17'))(_0x277d('0x18'));var utils=require(_0x277d('0x19'));var config=require(_0x277d('0x1a'));var db=require('../../mysqldb')['db'];config[_0x277d('0x1b')]=_[_0x277d('0x1c')](config[_0x277d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x277d('0x1d'))(new Redis(config['redis']));require(_0x277d('0x1e'))[_0x277d('0x1f')](socket);function respondWithStatusCode(_0x3c464f,_0x3d320b){_0x3d320b=_0x3d320b||0xcc;return function(_0x212c6b){if(_0x212c6b){return _0x3c464f[_0x277d('0x20')](_0x3d320b);}return _0x3c464f[_0x277d('0x21')](_0x3d320b)['end']();};}function respondWithResult(_0x3f8bca,_0x1b5b47){_0x1b5b47=_0x1b5b47||0xc8;return function(_0x59f606){if(_0x59f606){return _0x3f8bca['status'](_0x1b5b47)[_0x277d('0x22')](_0x59f606);}};}function respondWithFilteredResult(_0x2b05be,_0x3da173){return function(_0x5c18e8){if(_0x5c18e8){var _0x44ccee=_0x5c18e8[_0x277d('0x23')],_0x3543f7=_0x3da173[_0x277d('0x24')],_0x30ca76=_0x3da173[_0x277d('0x24')]+_0x3da173[_0x277d('0x25')],_0x11a692;if(_0x30ca76>=_0x44ccee){_0x30ca76=_0x44ccee;_0x11a692=0xc8;}else{_0x11a692=0xce;}_0x2b05be[_0x277d('0x21')](_0x11a692);return _0x2b05be[_0x277d('0x26')]('Content-Range',_0x3543f7+'-'+_0x30ca76+'/'+_0x44ccee)['json'](_0x5c18e8);}return null;};}function patchUpdates(_0xb5fcd1){return function(_0x488ecf){try{jsonpatch[_0x277d('0x27')](_0x488ecf,_0xb5fcd1,!![]);}catch(_0x3eb675){return BPromise[_0x277d('0x28')](_0x3eb675);}return _0x488ecf[_0x277d('0x29')]();};}function saveUpdates(_0xa6725d,_0x322648){return function(_0x4d3367){if(_0x4d3367){return _0x4d3367[_0x277d('0x2a')](_0xa6725d)[_0x277d('0x2b')](function(_0x12f773){return _0x12f773;});}return null;};}function removeEntity(_0x58016e,_0x3844c6){return function(_0x451553){if(_0x451553){return _0x451553[_0x277d('0x2c')]()[_0x277d('0x2b')](function(){var _0x5fb3ea=_0x451553[_0x277d('0x2d')]({'plain':!![]});var _0x1aa87d='WhatsappQueues';return db['UserProfileResource'][_0x277d('0x2c')]({'where':{'type':_0x1aa87d,'resourceId':_0x5fb3ea['id']}})[_0x277d('0x2b')](function(){return _0x451553;});})[_0x277d('0x2b')](function(){_0x58016e[_0x277d('0x21')](0xcc)[_0x277d('0x2e')]();});}};}function handleEntityNotFound(_0x404496,_0x121ee9){return function(_0x365cc1){if(!_0x365cc1){_0x404496[_0x277d('0x20')](0x194);}return _0x365cc1;};}function handleError(_0xbf5e9b,_0x442b1b){_0x442b1b=_0x442b1b||0x1f4;return function(_0x2f3317){logger[_0x277d('0x2f')](_0x2f3317[_0x277d('0x30')]);if(_0x2f3317[_0x277d('0x31')]){delete _0x2f3317[_0x277d('0x31')];}_0xbf5e9b['status'](_0x442b1b)[_0x277d('0x32')](_0x2f3317);};}exports[_0x277d('0x33')]=function(_0x29cef9,_0x348f12){var _0x2233de={},_0x279115={},_0xf0d0f8={'count':0x0,'rows':[]};var _0x5ec257=_[_0x277d('0x34')](db['WhatsappQueue'][_0x277d('0x35')],function(_0x58ca15){return{'name':_0x58ca15[_0x277d('0x36')],'type':_0x58ca15['type'][_0x277d('0x37')]};});_0x279115[_0x277d('0x38')]=_['map'](_0x5ec257,_0x277d('0x31'));_0x279115['query']=_['keys'](_0x29cef9['query']);_0x279115[_0x277d('0x39')]=_[_0x277d('0x3a')](_0x279115[_0x277d('0x38')],_0x279115['query']);_0x2233de[_0x277d('0x3b')]=_[_0x277d('0x3a')](_0x279115['model'],qs[_0x277d('0x3c')](_0x29cef9[_0x277d('0x3d')][_0x277d('0x3c')]));_0x2233de['attributes']=_0x2233de[_0x277d('0x3b')]['length']?_0x2233de[_0x277d('0x3b')]:_0x279115['model'];if(!_0x29cef9[_0x277d('0x3d')][_0x277d('0x3e')](_0x277d('0x3f'))){_0x2233de[_0x277d('0x25')]=qs['limit'](_0x29cef9[_0x277d('0x3d')]['limit']);_0x2233de[_0x277d('0x24')]=qs[_0x277d('0x24')](_0x29cef9[_0x277d('0x3d')][_0x277d('0x24')]);}_0x2233de['order']=qs[_0x277d('0x40')](_0x29cef9[_0x277d('0x3d')][_0x277d('0x40')]);_0x2233de[_0x277d('0x41')]=qs[_0x277d('0x39')](_['pick'](_0x29cef9[_0x277d('0x3d')],_0x279115[_0x277d('0x39')]),_0x5ec257);if(_0x29cef9[_0x277d('0x3d')][_0x277d('0x42')]){_0x2233de['where']=_[_0x277d('0x43')](_0x2233de[_0x277d('0x41')],{'$or':_[_0x277d('0x34')](_0x5ec257,function(_0x29da5b){if(_0x29da5b[_0x277d('0x44')]!==_0x277d('0x45')){var _0x43b15c={};_0x43b15c[_0x29da5b[_0x277d('0x31')]]={'$like':'%'+_0x29cef9[_0x277d('0x3d')][_0x277d('0x42')]+'%'};return _0x43b15c;}})});}_0x2233de=_['merge']({},_0x2233de,_0x29cef9[_0x277d('0x46')]);var _0x2a6831={'where':_0x2233de['where']};return db[_0x277d('0x47')][_0x277d('0x23')](_0x2a6831)[_0x277d('0x2b')](function(_0x3e9a9f){_0xf0d0f8['count']=_0x3e9a9f;if(_0x29cef9[_0x277d('0x3d')]['includeAll']){_0x2233de[_0x277d('0x48')]=[{'all':!![]}];}return db[_0x277d('0x47')]['findAll'](_0x2233de);})[_0x277d('0x2b')](function(_0x36a293){_0xf0d0f8['rows']=_0x36a293;return _0xf0d0f8;})[_0x277d('0x2b')](respondWithFilteredResult(_0x348f12,_0x2233de))[_0x277d('0x49')](handleError(_0x348f12,null));};exports[_0x277d('0x4a')]=function(_0x3210f6,_0x151b27){var _0x2d74a6={'raw':!![],'where':{'id':_0x3210f6[_0x277d('0x4b')]['id']}},_0x3f6853={};_0x3f6853[_0x277d('0x38')]=_['keys'](db[_0x277d('0x47')][_0x277d('0x35')]);_0x3f6853['query']=_[_0x277d('0x4c')](_0x3210f6[_0x277d('0x3d')]);_0x3f6853[_0x277d('0x39')]=_[_0x277d('0x3a')](_0x3f6853[_0x277d('0x38')],_0x3f6853[_0x277d('0x3d')]);_0x2d74a6[_0x277d('0x3b')]=_['intersection'](_0x3f6853[_0x277d('0x38')],qs[_0x277d('0x3c')](_0x3210f6[_0x277d('0x3d')]['fields']));_0x2d74a6[_0x277d('0x3b')]=_0x2d74a6['attributes']['length']?_0x2d74a6[_0x277d('0x3b')]:_0x3f6853[_0x277d('0x38')];if(_0x3210f6['query']['includeAll']){_0x2d74a6[_0x277d('0x48')]=[{'all':!![]}];}_0x2d74a6=_['merge']({},_0x2d74a6,_0x3210f6['options']);return db['WhatsappQueue'][_0x277d('0x4d')](_0x2d74a6)[_0x277d('0x2b')](handleEntityNotFound(_0x151b27,null))[_0x277d('0x2b')](respondWithResult(_0x151b27,null))[_0x277d('0x49')](handleError(_0x151b27,null));};exports[_0x277d('0x4e')]=function(_0x2732d5,_0x8aa6fe){return db['WhatsappQueue'][_0x277d('0x4e')](_0x2732d5['body'],{})[_0x277d('0x2b')](function(_0x58b462){var _0x4924e5=_0x2732d5[_0x277d('0x4f')][_0x277d('0x2d')]({'plain':!![]});if(!_0x4924e5)throw new Error(_0x277d('0x50'));if(_0x4924e5[_0x277d('0x51')]===_0x277d('0x4f')){var _0x28f2d8=_0x58b462[_0x277d('0x2d')]({'plain':!![]});var _0x11662d=_0x277d('0x52');return db[_0x277d('0x53')][_0x277d('0x4d')]({'where':{'name':_0x11662d,'userProfileId':_0x4924e5[_0x277d('0x54')]},'raw':!![]})[_0x277d('0x2b')](function(_0x3729b5){if(_0x3729b5&&_0x3729b5[_0x277d('0x55')]===0x0){return db[_0x277d('0x56')]['create']({'name':_0x28f2d8[_0x277d('0x31')],'resourceId':_0x28f2d8['id'],'type':_0x3729b5[_0x277d('0x31')],'sectionId':_0x3729b5['id']},{})[_0x277d('0x2b')](function(){return _0x58b462;});}else{return _0x58b462;}})[_0x277d('0x49')](function(_0x1ba706){logger[_0x277d('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ba706);throw _0x1ba706;});}return _0x58b462;})[_0x277d('0x2b')](respondWithResult(_0x8aa6fe,0xc9))[_0x277d('0x49')](handleError(_0x8aa6fe,null));};exports[_0x277d('0x2a')]=function(_0x26adc2,_0x311a25){if(_0x26adc2[_0x277d('0x57')]['id']){delete _0x26adc2[_0x277d('0x57')]['id'];}return db['WhatsappQueue'][_0x277d('0x4d')]({'where':{'id':_0x26adc2[_0x277d('0x4b')]['id']}})[_0x277d('0x2b')](handleEntityNotFound(_0x311a25,null))[_0x277d('0x2b')](saveUpdates(_0x26adc2[_0x277d('0x57')],null))['then'](respondWithResult(_0x311a25,null))[_0x277d('0x49')](handleError(_0x311a25,null));};exports[_0x277d('0x2c')]=function(_0x250fb5,_0x5c1ab0){return db[_0x277d('0x47')][_0x277d('0x4d')]({'where':{'id':_0x250fb5[_0x277d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c1ab0,null))['then'](removeEntity(_0x5c1ab0,null))['catch'](handleError(_0x5c1ab0,null));};exports[_0x277d('0x58')]=function(_0x43818e,_0x4339d2){return db['WhatsappQueue'][_0x277d('0x58')]()[_0x277d('0x2b')](respondWithResult(_0x4339d2,null))[_0x277d('0x49')](handleError(_0x4339d2,null));};exports[_0x277d('0x59')]=function(_0x2225d2,_0x2eb2fa,_0x40b818){var _0xef0bc8={'raw':!![],'where':{}},_0x460b28={},_0x4b9dd5;return db[_0x277d('0x47')][_0x277d('0x5a')]({'where':{'id':_0x2225d2[_0x277d('0x4b')]['id']}})[_0x277d('0x2b')](handleEntityNotFound(_0x2eb2fa,null))['then'](function(_0x28d07d){if(_0x28d07d){_0x4b9dd5=_0x28d07d[_0x277d('0x2d')]({'plain':!![]});_0x460b28[_0x277d('0x38')]=_[_0x277d('0x4c')](db[_0x277d('0x5b')][_0x277d('0x35')]);_0x460b28[_0x277d('0x3d')]=_[_0x277d('0x4c')](_0x2225d2[_0x277d('0x3d')]);_0x460b28[_0x277d('0x39')]=_[_0x277d('0x3a')](_0x460b28[_0x277d('0x38')],_0x460b28[_0x277d('0x3d')]);_0xef0bc8[_0x277d('0x3b')]=_[_0x277d('0x3a')](_0x460b28[_0x277d('0x38')],qs[_0x277d('0x3c')](_0x2225d2[_0x277d('0x3d')][_0x277d('0x3c')]));_0xef0bc8[_0x277d('0x3b')]=_0xef0bc8[_0x277d('0x3b')][_0x277d('0x5c')]?_0xef0bc8[_0x277d('0x3b')]:_0x460b28[_0x277d('0x38')];if(!_0x2225d2[_0x277d('0x3d')][_0x277d('0x3e')](_0x277d('0x3f'))){_0xef0bc8['limit']=qs['limit'](_0x2225d2[_0x277d('0x3d')]['limit']);_0xef0bc8[_0x277d('0x24')]=qs[_0x277d('0x24')](_0x2225d2[_0x277d('0x3d')][_0x277d('0x24')]);}_0xef0bc8['order']=qs[_0x277d('0x40')](_0x2225d2[_0x277d('0x3d')][_0x277d('0x40')]);_0xef0bc8[_0x277d('0x41')]=qs[_0x277d('0x39')](_['pick'](_0x2225d2['query'],_0x460b28['filters']));_0xef0bc8[_0x277d('0x41')]['WhatsappQueueId']=_0x28d07d['id'];if(_0x2225d2[_0x277d('0x3d')][_0x277d('0x42')]){_0xef0bc8[_0x277d('0x41')]=_[_0x277d('0x43')](_0xef0bc8[_0x277d('0x41')],{'$or':_[_0x277d('0x34')](_0xef0bc8['attributes'],function(_0x5c57f3){var _0x4470c6={};_0x4470c6[_0x5c57f3]={'$like':'%'+_0x2225d2[_0x277d('0x3d')][_0x277d('0x42')]+'%'};return _0x4470c6;})});}_0xef0bc8=_[_0x277d('0x43')]({},_0xef0bc8,_0x2225d2[_0x277d('0x46')]);return db[_0x277d('0x5b')]['findAll'](_0xef0bc8);}})['then'](function(_0x3eef45){if(_0x3eef45){return db[_0x277d('0x5d')]['findAndCountAll']({'where':{'id':_[_0x277d('0x34')](_0x3eef45,_0x277d('0x5e')),'role':_0x277d('0x5f')},'attributes':['id',_0x277d('0x31'),_0x277d('0x60'),_0x277d('0x61'),_0x277d('0x62')]});}})[_0x277d('0x2b')](function(_0x3cbd36){if(_0x3cbd36){return{'count':_0x3cbd36['count'],'rows':_[_0x277d('0x34')](_0x3cbd36[_0x277d('0x63')],function(_0x5d0657){return{'membername':_0x5d0657['name'],'UserId':_0x5d0657['id'],'queue_name':_0x4b9dd5[_0x277d('0x31')],'WhatsappQueueId':_0x4b9dd5['id'],'interface':util[_0x277d('0x64')](_0x277d('0x65'),'SIP',_0x5d0657[_0x277d('0x31')]),'penalty':0x0,'paused':_0x5d0657[_0x277d('0x60')],'createdAt':_0x5d0657[_0x277d('0x62')],'updatedAt':_0x5d0657[_0x277d('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2eb2fa,_0xef0bc8))[_0x277d('0x49')](handleError(_0x2eb2fa,null));};exports[_0x277d('0x66')]=function(_0x1bcacb,_0x172750,_0x521853){var _0xd07d6f={};var _0x47628d={};var _0x3a6d58;var _0xd89510;return db[_0x277d('0x47')][_0x277d('0x5a')]({'where':{'id':_0x1bcacb[_0x277d('0x4b')]['id']}})[_0x277d('0x2b')](handleEntityNotFound(_0x172750,null))[_0x277d('0x2b')](function(_0x14b559){if(_0x14b559){_0x3a6d58=_0x14b559;_0x47628d[_0x277d('0x38')]=_[_0x277d('0x4c')](db[_0x277d('0x67')]['rawAttributes']);_0x47628d['query']=_[_0x277d('0x4c')](_0x1bcacb[_0x277d('0x3d')]);_0x47628d[_0x277d('0x39')]=_[_0x277d('0x3a')](_0x47628d[_0x277d('0x38')],_0x47628d['query']);_0xd07d6f[_0x277d('0x3b')]=_[_0x277d('0x3a')](_0x47628d[_0x277d('0x38')],qs[_0x277d('0x3c')](_0x1bcacb[_0x277d('0x3d')][_0x277d('0x3c')]));_0xd07d6f[_0x277d('0x3b')]=_0xd07d6f[_0x277d('0x3b')][_0x277d('0x5c')]?_0xd07d6f[_0x277d('0x3b')]:_0x47628d[_0x277d('0x38')];_0xd07d6f['order']=qs[_0x277d('0x40')](_0x1bcacb['query'][_0x277d('0x40')]);_0xd07d6f[_0x277d('0x41')]=qs['filters'](_[_0x277d('0x68')](_0x1bcacb[_0x277d('0x3d')],_0x47628d['filters']));if(_0x1bcacb[_0x277d('0x3d')][_0x277d('0x42')]){_0xd07d6f['where']=_[_0x277d('0x43')](_0xd07d6f[_0x277d('0x41')],{'$or':_[_0x277d('0x34')](_0xd07d6f[_0x277d('0x3b')],function(_0x38e25d){var _0x15adb3={};_0x15adb3[_0x38e25d]={'$like':'%'+_0x1bcacb[_0x277d('0x3d')][_0x277d('0x42')]+'%'};return _0x15adb3;})});}_0xd07d6f=_[_0x277d('0x43')]({},_0xd07d6f,_0x1bcacb['options']);return _0x3a6d58[_0x277d('0x66')](_0xd07d6f);}})[_0x277d('0x2b')](function(_0x410337){if(_0x410337){_0xd89510=_0x410337[_0x277d('0x5c')];if(!_0x1bcacb[_0x277d('0x3d')][_0x277d('0x3e')]('nolimit')){_0xd07d6f['limit']=qs[_0x277d('0x25')](_0x1bcacb[_0x277d('0x3d')][_0x277d('0x25')]);_0xd07d6f['offset']=qs['offset'](_0x1bcacb[_0x277d('0x3d')][_0x277d('0x24')]);}return _0x3a6d58[_0x277d('0x66')](_0xd07d6f);}})[_0x277d('0x2b')](function(_0x2c6f36){if(_0x2c6f36){return _0x2c6f36?{'count':_0xd89510,'rows':_0x2c6f36}:null;}})['then'](respondWithResult(_0x172750,null))['catch'](handleError(_0x172750,null));};exports[_0x277d('0x69')]=function(_0x37a170,_0x5aaf40,_0x2fc948){var _0x999e6d=_0x37a170[_0x277d('0x57')][_0x277d('0x6a')];return db[_0x277d('0x67')][_0x277d('0x6b')]({'where':{'id':_0x999e6d},'attributes':['id'],'include':[{'model':db[_0x277d('0x5d')],'as':_0x277d('0x6c'),'attributes':['id',_0x277d('0x31'),_0x277d('0x6d'),_0x277d('0x6e'),'interface'],'raw':!![]}]})['then'](function(_0x39ed87){if(_0x39ed87){var _0xe61947=_[_0x277d('0x6f')](_0x39ed87,function(_0x17b0d0){var _0x10e5ff=_0x17b0d0['get']({'plain':!![]});return _0x10e5ff[_0x277d('0x6c')];});return db['WhatsappQueue'][_0x277d('0x4d')]({'where':{'id':_0x37a170[_0x277d('0x4b')]['id']}})[_0x277d('0x2b')](function(_0x5f3e3b){return db[_0x277d('0x70')]['transaction'](function(_0x14fe6c){return _0x5f3e3b['addTeams'](_0x999e6d,{'transaction':_0x14fe6c})[_0x277d('0x2b')](function(){return BPromise[_0x277d('0x71')](_0xe61947,function(_0x430ced){return db[_0x277d('0x5b')][_0x277d('0x72')]({'where':{'UserId':_0x430ced['id'],'WhatsappQueueId':_0x37a170[_0x277d('0x4b')]['id']},'transaction':_0x14fe6c});});})[_0x277d('0x2b')](function(){_0xe61947[_0x277d('0x73')](function(_0x36245b){socket[_0x277d('0x74')](_0x277d('0x75'),{'UserId':_0x36245b['id'],'WhatsappQueueId':_0x5f3e3b['id']});});});});});}})[_0x277d('0x2b')](respondWithStatusCode(_0x5aaf40,null))[_0x277d('0x49')](handleError(_0x5aaf40,null));};exports[_0x277d('0x76')]=function(_0x57b0c4,_0x2c6975,_0x3646f2){return db['Team'][_0x277d('0x6b')]({'where':{'id':_0x57b0c4['query'][_0x277d('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x277d('0x5d')],'as':_0x277d('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x277d('0x2b')](handleEntityNotFound(_0x2c6975,null))[_0x277d('0x2b')](function(_0x4af720){var _0x337d0f=_['map'](_0x4af720,'id');var _0x3e781f=[];var _0x4b578a=[];var _0x40e7ab=squel[_0x277d('0x77')]();_0x40e7ab[_0x277d('0x78')]('tq.TeamId')[_0x277d('0x79')](_0x277d('0x7a'),'tq')[_0x277d('0x7b')](_0x277d('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x277d('0x7d'),_0x57b0c4[_0x277d('0x4b')]['id']);for(var _0x4f5896=0x0;_0x4f5896<_0x4af720[_0x277d('0x5c')];_0x4f5896+=0x1){let _0x2aeffc=_0x4af720[_0x4f5896];for(var _0x36fe55=0x0;_0x36fe55<_0x2aeffc[_0x277d('0x6c')][_0x277d('0x5c')];_0x36fe55+=0x1){let _0x2e9930=_0x2aeffc[_0x277d('0x6c')][_0x36fe55];var _0x1ed57d=_0x40e7ab[_0x277d('0x7e')]();_0x1ed57d[_0x277d('0x41')](_0x277d('0x7f'),_0x2e9930['id']);_0x4b578a['push'](db[_0x277d('0x70')][_0x277d('0x3d')](_0x1ed57d[_0x277d('0x80')](),{'type':db[_0x277d('0x70')]['QueryTypes']['SELECT']})[_0x277d('0x2b')](function(_0x56f3c7){if(_0x56f3c7[_0x277d('0x5c')]===0x1){return _0x2e9930['id'];}else{var _0x4421b5=_[_0x277d('0x81')](_[_0x277d('0x34')](_0x56f3c7,_0x277d('0x82')),function(_0x29cf5c){return _[_0x277d('0x83')](_0x337d0f,_0x29cf5c);});if(_0x4421b5){return _0x2e9930['id'];}}}));}}return BPromise[_0x277d('0x84')](_0x4b578a)[_0x277d('0x2b')](function(_0x43c1ad){_0x3e781f=_(_0x3e781f)[_0x277d('0x85')](_0x43c1ad)[_0x277d('0x86')]()[_0x277d('0x87')]();return db[_0x277d('0x47')][_0x277d('0x4d')]({'where':{'id':_0x57b0c4[_0x277d('0x4b')]['id']}})['then'](function(_0x2cb65b){return db[_0x277d('0x70')][_0x277d('0x88')](function(_0x3c7cb5){return _0x2cb65b[_0x277d('0x76')](_0x57b0c4[_0x277d('0x3d')][_0x277d('0x6a')],{'transaction':_0x3c7cb5})[_0x277d('0x2b')](function(){if(!_[_0x277d('0x89')](_0x3e781f)){return _0x2cb65b[_0x277d('0x8a')](_0x3e781f,{'transaction':_0x3c7cb5});}})['then'](function(){_0x3e781f[_0x277d('0x73')](function(_0x5b1a17){socket[_0x277d('0x74')]('userWhatsappQueue:remove',{'UserId':_0x5b1a17,'WhatsappQueueId':_0x2cb65b['id']});});});});});});})[_0x277d('0x2b')](respondWithStatusCode(_0x2c6975,null))[_0x277d('0x49')](handleError(_0x2c6975,null));};exports['addAgents']=function(_0x24cdd7,_0x1c43e7,_0x2b54ed){return db[_0x277d('0x47')][_0x277d('0x4d')]({'where':{'id':_0x24cdd7[_0x277d('0x4b')]['id']}})[_0x277d('0x2b')](handleEntityNotFound(_0x1c43e7,null))['then'](function(_0x3ea42a){if(_0x3ea42a){return _0x3ea42a[_0x277d('0x8b')](_0x24cdd7[_0x277d('0x57')][_0x277d('0x6a')],_[_0x277d('0x8c')](_0x24cdd7[_0x277d('0x57')],[_0x277d('0x6a'),'id'])||{})[_0x277d('0x8d')](function(_0x468c10){for(var _0x5880e0=0x0;_0x5880e0<_0x24cdd7[_0x277d('0x57')][_0x277d('0x6a')][_0x277d('0x5c')];_0x5880e0+=0x1){socket[_0x277d('0x74')]('userWhatsappQueue:save',{'UserId':_0x24cdd7[_0x277d('0x57')][_0x277d('0x6a')][_0x5880e0],'WhatsappQueueId':_0x24cdd7[_0x277d('0x4b')]['id']});}return _0x468c10;});}})[_0x277d('0x2b')](respondWithResult(_0x1c43e7,null))[_0x277d('0x49')](handleError(_0x1c43e7,null));};exports['removeAgents']=function(_0x51e32d,_0x14754a,_0x4c4e22){return db['WhatsappQueue'][_0x277d('0x4d')]({'where':{'id':_0x51e32d[_0x277d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14754a,null))['then'](function(_0x38c92c){if(_0x38c92c){return _0x38c92c['removeAgents'](_0x51e32d[_0x277d('0x3d')][_0x277d('0x6a')])['then'](function(){if(_['isArray'](_0x51e32d[_0x277d('0x3d')][_0x277d('0x6a')])){for(var _0x189ad2=0x0;_0x189ad2<_0x51e32d['query'][_0x277d('0x6a')][_0x277d('0x5c')];_0x189ad2+=0x1){socket[_0x277d('0x74')](_0x277d('0x8e'),{'UserId':Number(_0x51e32d['query'][_0x277d('0x6a')][_0x189ad2]),'WhatsappQueueId':Number(_0x51e32d[_0x277d('0x4b')]['id'])});}}else{socket[_0x277d('0x74')](_0x277d('0x8e'),{'UserId':Number(_0x51e32d[_0x277d('0x3d')][_0x277d('0x6a')]),'WhatsappQueueId':Number(_0x51e32d[_0x277d('0x4b')]['id'])});}});}})[_0x277d('0x2b')](respondWithStatusCode(_0x14754a,null))['catch'](handleError(_0x14754a,null));};exports['getAgents']=function(_0x560c64,_0x466f0d,_0x365af4){var _0x415962={};var _0x4295fb={};var _0x55ac46;var _0x4347eb;return db[_0x277d('0x47')][_0x277d('0x5a')]({'where':{'id':_0x560c64[_0x277d('0x4b')]['id']}})[_0x277d('0x2b')](handleEntityNotFound(_0x466f0d,null))[_0x277d('0x2b')](function(_0x2ea5bd){if(_0x2ea5bd){_0x55ac46=_0x2ea5bd;_0x4295fb[_0x277d('0x38')]=_[_0x277d('0x4c')](db[_0x277d('0x5d')][_0x277d('0x35')]);_0x4295fb[_0x277d('0x3d')]=_[_0x277d('0x4c')](_0x560c64[_0x277d('0x3d')]);_0x4295fb[_0x277d('0x39')]=_[_0x277d('0x3a')](_0x4295fb[_0x277d('0x38')],_0x4295fb['query']);_0x415962[_0x277d('0x3b')]=_[_0x277d('0x3a')](_0x4295fb[_0x277d('0x38')],qs[_0x277d('0x3c')](_0x560c64[_0x277d('0x3d')]['fields']));_0x415962[_0x277d('0x3b')]=_0x415962[_0x277d('0x3b')][_0x277d('0x5c')]?_0x415962['attributes']:_0x4295fb[_0x277d('0x38')];_0x415962[_0x277d('0x8f')]=qs[_0x277d('0x40')](_0x560c64[_0x277d('0x3d')][_0x277d('0x40')]);_0x415962[_0x277d('0x41')]=qs[_0x277d('0x39')](_[_0x277d('0x68')](_0x560c64[_0x277d('0x3d')],_0x4295fb[_0x277d('0x39')]));if(_0x560c64[_0x277d('0x3d')][_0x277d('0x42')]){_0x415962[_0x277d('0x41')]=_[_0x277d('0x43')](_0x415962[_0x277d('0x41')],{'$or':_[_0x277d('0x34')](_0x415962[_0x277d('0x3b')],function(_0x2ce3b7){var _0x235038={};_0x235038[_0x2ce3b7]={'$like':'%'+_0x560c64[_0x277d('0x3d')][_0x277d('0x42')]+'%'};return _0x235038;})});}_0x415962=_[_0x277d('0x43')]({},_0x415962,_0x560c64[_0x277d('0x46')]);return _0x55ac46['getAgents'](_0x415962);}})['then'](function(_0x54edcb){if(_0x54edcb){_0x4347eb=_0x54edcb[_0x277d('0x5c')];if(!_0x560c64[_0x277d('0x3d')][_0x277d('0x3e')](_0x277d('0x3f'))){_0x415962[_0x277d('0x25')]=qs[_0x277d('0x25')](_0x560c64[_0x277d('0x3d')]['limit']);_0x415962['offset']=qs[_0x277d('0x24')](_0x560c64['query'][_0x277d('0x24')]);}return _0x55ac46['getAgents'](_0x415962);}})['then'](function(_0x126d5c){if(_0x126d5c){return _0x126d5c?{'count':_0x4347eb,'rows':_0x126d5c}:null;}})[_0x277d('0x2b')](respondWithResult(_0x466f0d,null))[_0x277d('0x49')](handleError(_0x466f0d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 768fb9b..e43fb1e 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 _0xd522=['exports','WhatsappQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x394c4c,_0x201031){var _0x5bfa5a=function(_0x4a5eed){while(--_0x4a5eed){_0x394c4c['push'](_0x394c4c['shift']());}};_0x5bfa5a(++_0x201031);}(_0xd522,0x1e4));var _0x2d52=function(_0x4bc246,_0x153d94){_0x4bc246=_0x4bc246-0x0;var _0x2329cd=_0xd522[_0x4bc246];return _0x2329cd;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x2d52('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2d52('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d52('0x2'),'afterDestroy':_0x2d52('0x3')};function emitEvent(_0x11adc8){return function(_0x1460a0,_0x2b1854,_0x26c57d){WhatsappQueueEvents['emit'](_0x11adc8+':'+_0x1460a0['id'],_0x1460a0);WhatsappQueueEvents[_0x2d52('0x4')](_0x11adc8,_0x1460a0);_0x26c57d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x2d52('0x5')](e,emitEvent(event));}}module[_0x2d52('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0xc283=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue'];(function(_0xa9808c,_0x45c44b){var _0x2031b3=function(_0x4187e0){while(--_0x4187e0){_0xa9808c['push'](_0xa9808c['shift']());}};_0x2031b3(++_0x45c44b);}(_0xc283,0x194));var _0x3c28=function(_0x454f40,_0x4305f4){_0x454f40=_0x454f40-0x0;var _0x563088=_0xc283[_0x454f40];return _0x563088;};'use strict';var EventEmitter=require(_0x3c28('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x3c28('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3c28('0x2')};function emitEvent(_0x529507){return function(_0x46cec0,_0x219e63,_0x3611e6){WhatsappQueueEvents[_0x3c28('0x3')](_0x529507+':'+_0x46cec0['id'],_0x46cec0);WhatsappQueueEvents[_0x3c28('0x3')](_0x529507,_0x46cec0);_0x3611e6(null);};}for(var e in events){if(events[_0x3c28('0x4')](e)){var event=events[e];WhatsappQueue[_0x3c28('0x5')](e,emitEvent(event));}}module[_0x3c28('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 52c156e..9fcd867 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 _0x3766=['../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','moment','bluebird','rimraf'];(function(_0x15972b,_0xbd2412){var _0x487ae1=function(_0x210d24){while(--_0x210d24){_0x15972b['push'](_0x15972b['shift']());}};_0x487ae1(++_0xbd2412);}(_0x3766,0x10a));var _0x6376=function(_0x207202,_0x4d5a09){_0x207202=_0x207202-0x0;var _0x2c5866=_0x3766[_0x207202];return _0x2c5866;};'use strict';var _=require(_0x6376('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6376('0x1'));var BPromise=require(_0x6376('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6376('0x3'));var config=require(_0x6376('0x4'));var attributes=require('./whatsappQueue.attributes');module[_0x6376('0x5')]=function(_0x7b7470,_0x4681cc){return _0x7b7470[_0x6376('0x6')](_0x6376('0x7'),attributes,{'tableName':_0x6376('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2026=['exports','define','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes'];(function(_0x55df48,_0x2db73d){var _0x5b61a0=function(_0x2a7a48){while(--_0x2a7a48){_0x55df48['push'](_0x55df48['shift']());}};_0x5b61a0(++_0x2db73d);}(_0x2026,0x98));var _0x6202=function(_0x469551,_0x25642f){_0x469551=_0x469551-0x0;var _0x5011a7=_0x2026[_0x469551];return _0x5011a7;};'use strict';var _=require(_0x6202('0x0'));var util=require(_0x6202('0x1'));var logger=require(_0x6202('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6202('0x3'));var rp=require(_0x6202('0x4'));var fs=require('fs');var path=require(_0x6202('0x5'));var rimraf=require(_0x6202('0x6'));var config=require('../../config/environment');var attributes=require(_0x6202('0x7'));module[_0x6202('0x8')]=function(_0x2e23fc,_0xb3b8f){return _0x2e23fc[_0x6202('0x9')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 85f56d7..25c66f7 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 _0x07e4=['info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','WhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','request','then'];(function(_0x199f48,_0x1f0708){var _0x52fbdf=function(_0x1b9b04){while(--_0x1b9b04){_0x199f48['push'](_0x199f48['shift']());}};_0x52fbdf(++_0x1f0708);}(_0x07e4,0x12e));var _0x407e=function(_0x15f897,_0x12eaf0){_0x15f897=_0x15f897-0x0;var _0x25489b=_0x07e4[_0x15f897];return _0x25489b;};'use strict';var _=require(_0x407e('0x0'));var util=require(_0x407e('0x1'));var moment=require(_0x407e('0x2'));var BPromise=require(_0x407e('0x3'));var rs=require(_0x407e('0x4'));var fs=require('fs');var Redis=require(_0x407e('0x5'));var db=require(_0x407e('0x6'))['db'];var utils=require(_0x407e('0x7'));var logger=require(_0x407e('0x8'))('rpc');var config=require(_0x407e('0x9'));var jayson=require(_0x407e('0xa'));var client=jayson['client'][_0x407e('0xb')]({'port':0x232a});config['redis']=_[_0x407e('0xc')](config[_0x407e('0xd')],{'host':_0x407e('0xe'),'port':0x18eb});var socket=require(_0x407e('0xf'))(new Redis(config[_0x407e('0xd')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3f4f0e,_0x4478b4,_0x571088){return new BPromise(function(_0x33a10a,_0x34d939){return client[_0x407e('0x10')](_0x3f4f0e,_0x571088)[_0x407e('0x11')](function(_0x183356){logger[_0x407e('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x4478b4,_0x407e('0x13'));logger[_0x407e('0x14')](_0x407e('0x15'),_0x4478b4,'request\x20sent',JSON[_0x407e('0x16')](_0x183356));if(_0x183356['error']){if(_0x183356[_0x407e('0x17')]['code']===0x1f4){logger['error'](_0x407e('0x18'),_0x4478b4,_0x183356[_0x407e('0x17')]['message']);return _0x34d939(_0x183356[_0x407e('0x17')][_0x407e('0x19')]);}logger['error'](_0x407e('0x18'),_0x4478b4,_0x183356[_0x407e('0x17')][_0x407e('0x19')]);return _0x33a10a(_0x183356[_0x407e('0x17')][_0x407e('0x19')]);}else{logger[_0x407e('0x12')](_0x407e('0x18'),_0x4478b4,'request\x20sent');_0x33a10a(_0x183356['result'][_0x407e('0x19')]);}})[_0x407e('0x1a')](function(_0x288f65){logger['error'](_0x407e('0x18'),_0x4478b4,_0x288f65);_0x34d939(_0x288f65);});});}exports[_0x407e('0x1b')]=function(_0x4a2df9){var _0x1c5682=this;return new Promise(function(_0x2307d9,_0x199c93){return db['WhatsappQueue'][_0x407e('0x1c')]({'raw':_0x4a2df9[_0x407e('0x1d')]?_0x4a2df9['options'][_0x407e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a2df9[_0x407e('0x1d')]?_0x4a2df9['options']['where']||null:null,'attributes':_0x4a2df9[_0x407e('0x1d')]?_0x4a2df9[_0x407e('0x1d')][_0x407e('0x1f')]||null:null,'limit':_0x4a2df9[_0x407e('0x1d')]?_0x4a2df9['options'][_0x407e('0x20')]||null:null,'include':_0x4a2df9[_0x407e('0x1d')]?_0x4a2df9['options'][_0x407e('0x21')]?_[_0x407e('0x22')](_0x4a2df9[_0x407e('0x1d')][_0x407e('0x21')],function(_0x33a162){return{'model':db[_0x33a162[_0x407e('0x23')]],'as':_0x33a162['as'],'attributes':_0x33a162[_0x407e('0x1f')],'include':_0x33a162[_0x407e('0x21')]?_[_0x407e('0x22')](_0x33a162[_0x407e('0x21')],function(_0x169412){return{'model':db[_0x169412[_0x407e('0x23')]],'as':_0x169412['as'],'attributes':_0x169412[_0x407e('0x1f')],'include':_0x169412[_0x407e('0x21')]?_[_0x407e('0x22')](_0x169412[_0x407e('0x21')],function(_0x5ad018){return{'model':db[_0x5ad018[_0x407e('0x23')]],'as':_0x5ad018['as'],'attributes':_0x5ad018[_0x407e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x407e('0x11')](function(_0x46602c){logger[_0x407e('0x12')](_0x407e('0x1b'),_0x4a2df9);logger['debug'](_0x407e('0x1b'),_0x4a2df9,JSON[_0x407e('0x16')](_0x46602c));_0x2307d9(_0x46602c);})[_0x407e('0x1a')](function(_0x481d86){logger['error'](_0x407e('0x1b'),_0x481d86['message'],_0x4a2df9);_0x199c93(_0x1c5682[_0x407e('0x17')](0x1f4,_0x481d86['message']));});});};exports[_0x407e('0x24')]=function(_0x25899d){var _0x26d7d6=this;return new Promise(function(_0x7ece22,_0x4edae0){return db[_0x407e('0x25')][_0x407e('0x26')]({'raw':_0x25899d['options']?_0x25899d[_0x407e('0x1d')][_0x407e('0x1e')]===undefined?!![]:![]:!![],'where':_0x25899d[_0x407e('0x1d')]?_0x25899d[_0x407e('0x1d')][_0x407e('0x27')]||null:null,'attributes':_0x25899d[_0x407e('0x1d')]?_0x25899d[_0x407e('0x1d')]['attributes']||null:null,'include':_0x25899d['options']?_0x25899d[_0x407e('0x1d')][_0x407e('0x21')]?_[_0x407e('0x22')](_0x25899d['options'][_0x407e('0x21')],function(_0x11cd8b){return{'model':db[_0x11cd8b[_0x407e('0x23')]],'as':_0x11cd8b['as'],'attributes':_0x11cd8b[_0x407e('0x1f')],'include':_0x11cd8b[_0x407e('0x21')]?_[_0x407e('0x22')](_0x11cd8b['include'],function(_0x2f4f99){return{'model':db[_0x2f4f99[_0x407e('0x23')]],'as':_0x2f4f99['as'],'attributes':_0x2f4f99[_0x407e('0x1f')],'include':_0x2f4f99[_0x407e('0x21')]?_['map'](_0x2f4f99[_0x407e('0x21')],function(_0x456c2d){return{'model':db[_0x456c2d['model']],'as':_0x456c2d['as'],'attributes':_0x456c2d['attributes']};}):[]};}):[]};}):[]:[]})[_0x407e('0x11')](function(_0x237a1f){logger[_0x407e('0x12')]('ShowWhatsappQueue',_0x25899d);logger[_0x407e('0x14')](_0x407e('0x24'),_0x25899d,JSON[_0x407e('0x16')](_0x237a1f));_0x7ece22(_0x237a1f);})[_0x407e('0x1a')](function(_0xd259fc){logger[_0x407e('0x17')]('ShowWhatsappQueue',_0xd259fc[_0x407e('0x19')],_0x25899d);_0x4edae0(_0x26d7d6['error'](0x1f4,_0xd259fc[_0x407e('0x19')]));});});}; \ No newline at end of file +var _0xe300=['request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','catch','options','raw','where','include','map','attributes','model','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket'];(function(_0x313147,_0x3606ee){var _0x1dbaea=function(_0x5951d4){while(--_0x5951d4){_0x313147['push'](_0x313147['shift']());}};_0x1dbaea(++_0x3606ee);}(_0xe300,0x68));var _0x0e30=function(_0x24a0dd,_0x502a1c){_0x24a0dd=_0x24a0dd-0x0;var _0x18f37a=_0xe300[_0x24a0dd];return _0x18f37a;};'use strict';var _=require('lodash');var util=require(_0x0e30('0x0'));var moment=require(_0x0e30('0x1'));var BPromise=require(_0x0e30('0x2'));var rs=require(_0x0e30('0x3'));var fs=require('fs');var Redis=require(_0x0e30('0x4'));var db=require(_0x0e30('0x5'))['db'];var utils=require(_0x0e30('0x6'));var logger=require(_0x0e30('0x7'))(_0x0e30('0x8'));var config=require(_0x0e30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0e30('0xa')]['http']({'port':0x232a});config[_0x0e30('0xb')]=_[_0x0e30('0xc')](config[_0x0e30('0xb')],{'host':_0x0e30('0xd'),'port':0x18eb});var socket=require(_0x0e30('0xe'))(new Redis(config[_0x0e30('0xb')]));require(_0x0e30('0xf'))['register'](socket);function respondWithRpcPromise(_0x5883eb,_0x33bb8f,_0x377f65){return new BPromise(function(_0x3962c3,_0x879b3b){return client[_0x0e30('0x10')](_0x5883eb,_0x377f65)[_0x0e30('0x11')](function(_0x16de9e){logger[_0x0e30('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x33bb8f,_0x0e30('0x13'));logger[_0x0e30('0x14')](_0x0e30('0x15'),_0x33bb8f,_0x0e30('0x13'),JSON[_0x0e30('0x16')](_0x16de9e));if(_0x16de9e[_0x0e30('0x17')]){if(_0x16de9e[_0x0e30('0x17')][_0x0e30('0x18')]===0x1f4){logger[_0x0e30('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x33bb8f,_0x16de9e[_0x0e30('0x17')][_0x0e30('0x19')]);return _0x879b3b(_0x16de9e[_0x0e30('0x17')]['message']);}logger[_0x0e30('0x17')](_0x0e30('0x1a'),_0x33bb8f,_0x16de9e[_0x0e30('0x17')][_0x0e30('0x19')]);return _0x3962c3(_0x16de9e[_0x0e30('0x17')][_0x0e30('0x19')]);}else{logger[_0x0e30('0x12')](_0x0e30('0x1a'),_0x33bb8f,_0x0e30('0x13'));_0x3962c3(_0x16de9e[_0x0e30('0x1b')][_0x0e30('0x19')]);}})[_0x0e30('0x1c')](function(_0x268f9b){logger[_0x0e30('0x17')](_0x0e30('0x1a'),_0x33bb8f,_0x268f9b);_0x879b3b(_0x268f9b);});});}exports['GetWhatsappQueue']=function(_0x4e0280){var _0x412947=this;return new Promise(function(_0x540392,_0x3b2603){return db['WhatsappQueue']['findAll']({'raw':_0x4e0280[_0x0e30('0x1d')]?_0x4e0280['options'][_0x0e30('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e0280[_0x0e30('0x1d')]?_0x4e0280['options'][_0x0e30('0x1f')]||null:null,'attributes':_0x4e0280[_0x0e30('0x1d')]?_0x4e0280[_0x0e30('0x1d')]['attributes']||null:null,'limit':_0x4e0280[_0x0e30('0x1d')]?_0x4e0280[_0x0e30('0x1d')]['limit']||null:null,'include':_0x4e0280[_0x0e30('0x1d')]?_0x4e0280[_0x0e30('0x1d')][_0x0e30('0x20')]?_[_0x0e30('0x21')](_0x4e0280[_0x0e30('0x1d')][_0x0e30('0x20')],function(_0x246513){return{'model':db[_0x246513['model']],'as':_0x246513['as'],'attributes':_0x246513[_0x0e30('0x22')],'include':_0x246513['include']?_[_0x0e30('0x21')](_0x246513[_0x0e30('0x20')],function(_0x43c5dd){return{'model':db[_0x43c5dd[_0x0e30('0x23')]],'as':_0x43c5dd['as'],'attributes':_0x43c5dd[_0x0e30('0x22')],'include':_0x43c5dd[_0x0e30('0x20')]?_[_0x0e30('0x21')](_0x43c5dd['include'],function(_0x51f8aa){return{'model':db[_0x51f8aa[_0x0e30('0x23')]],'as':_0x51f8aa['as'],'attributes':_0x51f8aa[_0x0e30('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0e30('0x11')](function(_0x1dbb63){logger[_0x0e30('0x12')](_0x0e30('0x24'),_0x4e0280);logger[_0x0e30('0x14')](_0x0e30('0x24'),_0x4e0280,JSON['stringify'](_0x1dbb63));_0x540392(_0x1dbb63);})['catch'](function(_0x49dcab){logger[_0x0e30('0x17')]('GetWhatsappQueue',_0x49dcab['message'],_0x4e0280);_0x3b2603(_0x412947['error'](0x1f4,_0x49dcab[_0x0e30('0x19')]));});});};exports[_0x0e30('0x25')]=function(_0x8f9eb0){var _0x368240=this;return new Promise(function(_0x4dca42,_0x583bc5){return db[_0x0e30('0x26')][_0x0e30('0x27')]({'raw':_0x8f9eb0['options']?_0x8f9eb0[_0x0e30('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x8f9eb0['options']?_0x8f9eb0[_0x0e30('0x1d')][_0x0e30('0x1f')]||null:null,'attributes':_0x8f9eb0['options']?_0x8f9eb0[_0x0e30('0x1d')][_0x0e30('0x22')]||null:null,'include':_0x8f9eb0[_0x0e30('0x1d')]?_0x8f9eb0[_0x0e30('0x1d')][_0x0e30('0x20')]?_[_0x0e30('0x21')](_0x8f9eb0[_0x0e30('0x1d')][_0x0e30('0x20')],function(_0x2cb45d){return{'model':db[_0x2cb45d[_0x0e30('0x23')]],'as':_0x2cb45d['as'],'attributes':_0x2cb45d[_0x0e30('0x22')],'include':_0x2cb45d['include']?_[_0x0e30('0x21')](_0x2cb45d['include'],function(_0x2c358c){return{'model':db[_0x2c358c['model']],'as':_0x2c358c['as'],'attributes':_0x2c358c[_0x0e30('0x22')],'include':_0x2c358c['include']?_['map'](_0x2c358c[_0x0e30('0x20')],function(_0x40aaa7){return{'model':db[_0x40aaa7[_0x0e30('0x23')]],'as':_0x40aaa7['as'],'attributes':_0x40aaa7[_0x0e30('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0e30('0x11')](function(_0x4b349e){logger['info'](_0x0e30('0x25'),_0x8f9eb0);logger[_0x0e30('0x14')](_0x0e30('0x25'),_0x8f9eb0,JSON['stringify'](_0x4b349e));_0x4dca42(_0x4b349e);})[_0x0e30('0x1c')](function(_0x5c6125){logger[_0x0e30('0x17')](_0x0e30('0x25'),_0x5c6125[_0x0e30('0x19')],_0x8f9eb0);_0x583bc5(_0x368240[_0x0e30('0x17')](0x1f4,_0x5c6125['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fd02a32..347b755 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 _0xa534=['save','remove','emit','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x2a4c56,_0x2e7ab3){var _0x277dc2=function(_0x22560a){while(--_0x22560a){_0x2a4c56['push'](_0x2a4c56['shift']());}};_0x277dc2(++_0x2e7ab3);}(_0xa534,0x1cd));var _0x4a53=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa534[_0x4fde08];return _0x12e725;};'use strict';var WhatsappQueueEvents=require(_0x4a53('0x0'));var events=[_0x4a53('0x1'),_0x4a53('0x2'),'update'];function createListener(_0x504edb,_0x584052){return function(_0x42257d){_0x584052[_0x4a53('0x3')](_0x504edb,_0x42257d);};}function removeListener(_0xf9b845,_0x2dc9ea){return function(){WhatsappQueueEvents[_0x4a53('0x4')](_0xf9b845,_0x2dc9ea);};}exports['register']=function(_0x4eb4d4){for(var _0x391188=0x0,_0x2f3d91=events[_0x4a53('0x5')];_0x391188<_0x2f3d91;_0x391188++){var _0x3b8a86=events[_0x391188];var _0x567357=createListener(_0x4a53('0x6')+_0x3b8a86,_0x4eb4d4);WhatsappQueueEvents['on'](_0x3b8a86,_0x567357);}}; \ No newline at end of file +var _0x6ab8=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x38a68a,_0x1d8296){var _0x5d6a6e=function(_0xd9bc41){while(--_0xd9bc41){_0x38a68a['push'](_0x38a68a['shift']());}};_0x5d6a6e(++_0x1d8296);}(_0x6ab8,0x66));var _0x86ab=function(_0x3ff431,_0x36cdec){_0x3ff431=_0x3ff431-0x0;var _0x298422=_0x6ab8[_0x3ff431];return _0x298422;};'use strict';var WhatsappQueueEvents=require(_0x86ab('0x0'));var events=[_0x86ab('0x1'),_0x86ab('0x2'),'update'];function createListener(_0x5e640c,_0x4d778c){return function(_0x2f7fa0){_0x4d778c[_0x86ab('0x3')](_0x5e640c,_0x2f7fa0);};}function removeListener(_0xf1c743,_0x5211a1){return function(){WhatsappQueueEvents[_0x86ab('0x4')](_0xf1c743,_0x5211a1);};}exports[_0x86ab('0x5')]=function(_0x17eaad){for(var _0x198d60=0x0,_0x8351af=events['length'];_0x198d60<_0x8351af;_0x198d60++){var _0x2764f1=events[_0x198d60];var _0x17247e=createListener(_0x86ab('0x6')+_0x2764f1,_0x17eaad);WhatsappQueueEvents['on'](_0x2764f1,_0x17247e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6615472..a8eace1 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 _0xea21=['isAuthenticated','/describe','describe','/:id','post','create','put','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xea21,0x80));var _0x1ea2=function(_0x267e51,_0x4e3f61){_0x267e51=_0x267e51-0x0;var _0x5c61f0=_0xea21[_0x267e51];return _0x5c61f0;};'use strict';var multer=require(_0x1ea2('0x0'));var util=require('util');var path=require(_0x1ea2('0x1'));var timeout=require(_0x1ea2('0x2'));var express=require(_0x1ea2('0x3'));var router=express['Router']();var auth=require(_0x1ea2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1ea2('0x5'));var controller=require(_0x1ea2('0x6'));router[_0x1ea2('0x7')]('/',auth[_0x1ea2('0x8')](),controller['index']);router[_0x1ea2('0x7')](_0x1ea2('0x9'),auth[_0x1ea2('0x8')](),controller[_0x1ea2('0xa')]);router['get'](_0x1ea2('0xb'),auth[_0x1ea2('0x8')](),controller['show']);router[_0x1ea2('0xc')]('/',auth[_0x1ea2('0x8')](),controller[_0x1ea2('0xd')]);router[_0x1ea2('0xe')](_0x1ea2('0xb'),auth[_0x1ea2('0x8')](),controller['update']);router['delete'](_0x1ea2('0xb'),auth[_0x1ea2('0x8')](),controller[_0x1ea2('0xf')]);module[_0x1ea2('0x10')]=router; \ No newline at end of file +var _0xe90c=['express','Router','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1547f6,_0x7fcdc0){var _0x57317b=function(_0x23ec72){while(--_0x23ec72){_0x1547f6['push'](_0x1547f6['shift']());}};_0x57317b(++_0x7fcdc0);}(_0xe90c,0x153));var _0xce90=function(_0x1f3257,_0x55be9d){_0x1f3257=_0x1f3257-0x0;var _0x5a9b86=_0xe90c[_0x1f3257];return _0x5a9b86;};'use strict';var multer=require(_0xce90('0x0'));var util=require(_0xce90('0x1'));var path=require(_0xce90('0x2'));var timeout=require('connect-timeout');var express=require(_0xce90('0x3'));var router=express[_0xce90('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xce90('0x5'));var controller=require(_0xce90('0x6'));router[_0xce90('0x7')]('/',auth[_0xce90('0x8')](),controller[_0xce90('0x9')]);router[_0xce90('0x7')]('/describe',auth[_0xce90('0x8')](),controller[_0xce90('0xa')]);router['get'](_0xce90('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xce90('0xc')]('/',auth[_0xce90('0x8')](),controller[_0xce90('0xd')]);router[_0xce90('0xe')](_0xce90('0xb'),auth[_0xce90('0x8')](),controller[_0xce90('0xf')]);router[_0xce90('0x10')](_0xce90('0xb'),auth[_0xce90('0x8')](),controller[_0xce90('0x11')]);module[_0xce90('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 679ab45..44266ac 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 _0x6aa7=['DATE','sequelize','STRING'];(function(_0x4dc3e6,_0x85752){var _0x423d91=function(_0x3d1f11){while(--_0x3d1f11){_0x4dc3e6['push'](_0x4dc3e6['shift']());}};_0x423d91(++_0x85752);}(_0x6aa7,0x178));var _0x76aa=function(_0x56ed39,_0x3ea49c){_0x56ed39=_0x56ed39-0x0;var _0x5203ae=_0x6aa7[_0x56ed39];return _0x5203ae;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','DATE','sequelize'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa41a,0x6b));var _0xaa41=function(_0x1d1eee,_0x403271){_0x1d1eee=_0x1d1eee-0x0;var _0x589148=_0xa41a[_0x1d1eee];return _0x589148;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa41('0x2')]},'joinAt':{'type':Sequelize[_0xaa41('0x3')]},'leaveAt':{'type':Sequelize[_0xaa41('0x3')]},'acceptAt':{'type':Sequelize[_0xaa41('0x3')]},'exitAt':{'type':Sequelize[_0xaa41('0x3')]},'reason':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f76a524..470fe79 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 _0x0570=['filter','merge','options','WhatsappQueueReport','includeAll','include','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x0570,0x172));var _0x0057=function(_0x54e71f,_0x485047){_0x54e71f=_0x54e71f-0x0;var _0x2c823b=_0x0570[_0x54e71f];return _0x2c823b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0057('0x0'));var rimraf=require(_0x0057('0x1'));var zipdir=require(_0x0057('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0057('0x3'));var moment=require('moment');var BPromise=require(_0x0057('0x4'));var Mustache=require('mustache');var util=require(_0x0057('0x5'));var path=require(_0x0057('0x6'));var sox=require(_0x0057('0x7'));var csv=require(_0x0057('0x8'));var ejs=require(_0x0057('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0057('0xa'));var crypto=require('crypto');var jsforce=require(_0x0057('0xb'));var deskjs=require(_0x0057('0xc'));var toCsv=require(_0x0057('0x8'));var querystring=require(_0x0057('0xd'));var Papa=require(_0x0057('0xe'));var Redis=require('ioredis');var authService=require(_0x0057('0xf'));var qs=require(_0x0057('0x10'));var as=require(_0x0057('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0057('0x12'))(_0x0057('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0057('0x14'))['db'];function respondWithStatusCode(_0x471f7c,_0x33ed2c){_0x33ed2c=_0x33ed2c||0xcc;return function(_0x4d9117){if(_0x4d9117){return _0x471f7c[_0x0057('0x15')](_0x33ed2c);}return _0x471f7c[_0x0057('0x16')](_0x33ed2c)[_0x0057('0x17')]();};}function respondWithResult(_0x344d8e,_0x567515){_0x567515=_0x567515||0xc8;return function(_0x1feb22){if(_0x1feb22){return _0x344d8e[_0x0057('0x16')](_0x567515)['json'](_0x1feb22);}};}function respondWithFilteredResult(_0x20e69e,_0x25628f){return function(_0x581e76){if(_0x581e76){var _0x17549f=_0x581e76[_0x0057('0x18')],_0x59a3e7=_0x25628f[_0x0057('0x19')],_0x399018=_0x25628f['offset']+_0x25628f['limit'],_0x51524e;if(_0x399018>=_0x17549f){_0x399018=_0x17549f;_0x51524e=0xc8;}else{_0x51524e=0xce;}_0x20e69e[_0x0057('0x16')](_0x51524e);return _0x20e69e[_0x0057('0x1a')]('Content-Range',_0x59a3e7+'-'+_0x399018+'/'+_0x17549f)[_0x0057('0x1b')](_0x581e76);}return null;};}function patchUpdates(_0x5b5a4b){return function(_0x96bd7f){try{jsonpatch[_0x0057('0x1c')](_0x96bd7f,_0x5b5a4b,!![]);}catch(_0xa6b45e){return BPromise[_0x0057('0x1d')](_0xa6b45e);}return _0x96bd7f[_0x0057('0x1e')]();};}function saveUpdates(_0x26a524,_0xdea279){return function(_0x320c62){if(_0x320c62){return _0x320c62[_0x0057('0x1f')](_0x26a524)[_0x0057('0x20')](function(_0x5e6499){return _0x5e6499;});}return null;};}function removeEntity(_0xc1ba0,_0x74a47c){return function(_0x43454a){if(_0x43454a){return _0x43454a[_0x0057('0x21')]()['then'](function(){_0xc1ba0[_0x0057('0x16')](0xcc)[_0x0057('0x17')]();});}};}function handleEntityNotFound(_0x5b7c01,_0x620fcc){return function(_0xa8d716){if(!_0xa8d716){_0x5b7c01['sendStatus'](0x194);}return _0xa8d716;};}function handleError(_0x464d79,_0x2472de){_0x2472de=_0x2472de||0x1f4;return function(_0x426304){logger['error'](_0x426304['stack']);if(_0x426304[_0x0057('0x22')]){delete _0x426304[_0x0057('0x22')];}_0x464d79[_0x0057('0x16')](_0x2472de)[_0x0057('0x23')](_0x426304);};}exports[_0x0057('0x24')]=function(_0x22ba65,_0x491ef3){var _0x5f3818={},_0x5cc3e0={},_0x32e92b={'count':0x0,'rows':[]};var _0x45ff9e=_[_0x0057('0x25')](db['WhatsappQueueReport'][_0x0057('0x26')],function(_0xa4fb6a){return{'name':_0xa4fb6a[_0x0057('0x27')],'type':_0xa4fb6a[_0x0057('0x28')]['key']};});_0x5cc3e0['model']=_[_0x0057('0x25')](_0x45ff9e,'name');_0x5cc3e0[_0x0057('0x29')]=_[_0x0057('0x2a')](_0x22ba65[_0x0057('0x29')]);_0x5cc3e0[_0x0057('0x2b')]=_[_0x0057('0x2c')](_0x5cc3e0[_0x0057('0x2d')],_0x5cc3e0[_0x0057('0x29')]);_0x5f3818[_0x0057('0x2e')]=_['intersection'](_0x5cc3e0[_0x0057('0x2d')],qs['fields'](_0x22ba65[_0x0057('0x29')]['fields']));_0x5f3818['attributes']=_0x5f3818[_0x0057('0x2e')][_0x0057('0x2f')]?_0x5f3818[_0x0057('0x2e')]:_0x5cc3e0[_0x0057('0x2d')];if(!_0x22ba65['query'][_0x0057('0x30')](_0x0057('0x31'))){_0x5f3818[_0x0057('0x32')]=qs[_0x0057('0x32')](_0x22ba65[_0x0057('0x29')][_0x0057('0x32')]);_0x5f3818['offset']=qs[_0x0057('0x19')](_0x22ba65['query'][_0x0057('0x19')]);}_0x5f3818[_0x0057('0x33')]=qs[_0x0057('0x34')](_0x22ba65['query'][_0x0057('0x34')]);_0x5f3818['where']=qs['filters'](_[_0x0057('0x35')](_0x22ba65['query'],_0x5cc3e0[_0x0057('0x2b')]),_0x45ff9e);if(_0x22ba65[_0x0057('0x29')]['filter']){_0x5f3818[_0x0057('0x36')]=_['merge'](_0x5f3818[_0x0057('0x36')],{'$or':_[_0x0057('0x25')](_0x45ff9e,function(_0x34e7b1){if(_0x34e7b1[_0x0057('0x28')]!==_0x0057('0x37')){var _0x5976f4={};_0x5976f4[_0x34e7b1[_0x0057('0x22')]]={'$like':'%'+_0x22ba65[_0x0057('0x29')][_0x0057('0x38')]+'%'};return _0x5976f4;}})});}_0x5f3818=_[_0x0057('0x39')]({},_0x5f3818,_0x22ba65[_0x0057('0x3a')]);var _0x48b875={'where':_0x5f3818[_0x0057('0x36')]};return db[_0x0057('0x3b')]['count'](_0x48b875)['then'](function(_0x556fc4){_0x32e92b[_0x0057('0x18')]=_0x556fc4;if(_0x22ba65[_0x0057('0x29')][_0x0057('0x3c')]){_0x5f3818[_0x0057('0x3d')]=[{'all':!![]}];}return db[_0x0057('0x3b')]['findAll'](_0x5f3818);})[_0x0057('0x20')](function(_0x583066){_0x32e92b[_0x0057('0x3e')]=_0x583066;return _0x32e92b;})['then'](respondWithFilteredResult(_0x491ef3,_0x5f3818))[_0x0057('0x3f')](handleError(_0x491ef3,null));};exports[_0x0057('0x40')]=function(_0x1b5743,_0x577d65){var _0x54e9a2={'raw':!![],'where':{'id':_0x1b5743[_0x0057('0x41')]['id']}},_0x419f26={};_0x419f26[_0x0057('0x2d')]=_[_0x0057('0x2a')](db[_0x0057('0x3b')][_0x0057('0x26')]);_0x419f26[_0x0057('0x29')]=_[_0x0057('0x2a')](_0x1b5743[_0x0057('0x29')]);_0x419f26['filters']=_['intersection'](_0x419f26[_0x0057('0x2d')],_0x419f26[_0x0057('0x29')]);_0x54e9a2['attributes']=_[_0x0057('0x2c')](_0x419f26[_0x0057('0x2d')],qs[_0x0057('0x42')](_0x1b5743['query'][_0x0057('0x42')]));_0x54e9a2[_0x0057('0x2e')]=_0x54e9a2['attributes'][_0x0057('0x2f')]?_0x54e9a2[_0x0057('0x2e')]:_0x419f26['model'];if(_0x1b5743[_0x0057('0x29')][_0x0057('0x3c')]){_0x54e9a2[_0x0057('0x3d')]=[{'all':!![]}];}_0x54e9a2=_['merge']({},_0x54e9a2,_0x1b5743[_0x0057('0x3a')]);return db['WhatsappQueueReport'][_0x0057('0x43')](_0x54e9a2)[_0x0057('0x20')](handleEntityNotFound(_0x577d65,null))['then'](respondWithResult(_0x577d65,null))[_0x0057('0x3f')](handleError(_0x577d65,null));};exports[_0x0057('0x44')]=function(_0x34797e,_0x5e8149){return db[_0x0057('0x3b')]['create'](_0x34797e[_0x0057('0x45')],{})[_0x0057('0x20')](respondWithResult(_0x5e8149,0xc9))[_0x0057('0x3f')](handleError(_0x5e8149,null));};exports[_0x0057('0x1f')]=function(_0x2733d9,_0x47886a){if(_0x2733d9[_0x0057('0x45')]['id']){delete _0x2733d9[_0x0057('0x45')]['id'];}return db[_0x0057('0x3b')]['find']({'where':{'id':_0x2733d9[_0x0057('0x41')]['id']}})[_0x0057('0x20')](handleEntityNotFound(_0x47886a,null))['then'](saveUpdates(_0x2733d9[_0x0057('0x45')],null))[_0x0057('0x20')](respondWithResult(_0x47886a,null))[_0x0057('0x3f')](handleError(_0x47886a,null));};exports['destroy']=function(_0x25ee88,_0x98e77e){return db['WhatsappQueueReport'][_0x0057('0x43')]({'where':{'id':_0x25ee88['params']['id']}})[_0x0057('0x20')](handleEntityNotFound(_0x98e77e,null))['then'](removeEntity(_0x98e77e,null))[_0x0057('0x3f')](handleError(_0x98e77e,null));};exports[_0x0057('0x46')]=function(_0x6978a2,_0x5d7c7a){return db[_0x0057('0x3b')][_0x0057('0x46')]()[_0x0057('0x20')](respondWithResult(_0x5d7c7a,null))[_0x0057('0x3f')](handleError(_0x5d7c7a,null));}; \ No newline at end of file +var _0x72d7=['then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','count','includeAll','include','rows','catch','show','params','keys','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x72d7,0x19b));var _0x772d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x72d7[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x772d('0x0'));var emlformat=require(_0x772d('0x1'));var rimraf=require(_0x772d('0x2'));var zipdir=require(_0x772d('0x3'));var jsonpatch=require(_0x772d('0x4'));var rp=require(_0x772d('0x5'));var moment=require('moment');var BPromise=require(_0x772d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x772d('0x7'));var sox=require(_0x772d('0x8'));var csv=require(_0x772d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x772d('0xa'));var squel=require(_0x772d('0xb'));var crypto=require(_0x772d('0xc'));var jsforce=require(_0x772d('0xd'));var deskjs=require(_0x772d('0xe'));var toCsv=require(_0x772d('0x9'));var querystring=require(_0x772d('0xf'));var Papa=require('papaparse');var Redis=require(_0x772d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x772d('0x11'));var logger=require(_0x772d('0x12'))(_0x772d('0x13'));var utils=require(_0x772d('0x14'));var config=require(_0x772d('0x15'));var db=require(_0x772d('0x16'))['db'];function respondWithStatusCode(_0x3bae09,_0x3a2939){_0x3a2939=_0x3a2939||0xcc;return function(_0x4a0865){if(_0x4a0865){return _0x3bae09[_0x772d('0x17')](_0x3a2939);}return _0x3bae09[_0x772d('0x18')](_0x3a2939)[_0x772d('0x19')]();};}function respondWithResult(_0x160011,_0x3719b3){_0x3719b3=_0x3719b3||0xc8;return function(_0x489c48){if(_0x489c48){return _0x160011[_0x772d('0x18')](_0x3719b3)['json'](_0x489c48);}};}function respondWithFilteredResult(_0x4e1d02,_0x1325bc){return function(_0x3fc786){if(_0x3fc786){var _0x54457d=_0x3fc786['count'],_0x5880f0=_0x1325bc[_0x772d('0x1a')],_0x3e2bc9=_0x1325bc[_0x772d('0x1a')]+_0x1325bc[_0x772d('0x1b')],_0x78b80;if(_0x3e2bc9>=_0x54457d){_0x3e2bc9=_0x54457d;_0x78b80=0xc8;}else{_0x78b80=0xce;}_0x4e1d02['status'](_0x78b80);return _0x4e1d02[_0x772d('0x1c')](_0x772d('0x1d'),_0x5880f0+'-'+_0x3e2bc9+'/'+_0x54457d)[_0x772d('0x1e')](_0x3fc786);}return null;};}function patchUpdates(_0x443b83){return function(_0x4d6c8f){try{jsonpatch['apply'](_0x4d6c8f,_0x443b83,!![]);}catch(_0x2050ed){return BPromise[_0x772d('0x1f')](_0x2050ed);}return _0x4d6c8f[_0x772d('0x20')]();};}function saveUpdates(_0x375497,_0x3e8ece){return function(_0x491b22){if(_0x491b22){return _0x491b22['update'](_0x375497)[_0x772d('0x21')](function(_0x597be6){return _0x597be6;});}return null;};}function removeEntity(_0x1c98e2,_0x54c0ac){return function(_0x56dd11){if(_0x56dd11){return _0x56dd11[_0x772d('0x22')]()[_0x772d('0x21')](function(){_0x1c98e2[_0x772d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9dca4,_0x356c6d){return function(_0x28f4a0){if(!_0x28f4a0){_0xb9dca4[_0x772d('0x17')](0x194);}return _0x28f4a0;};}function handleError(_0x22850a,_0x8c3f0){_0x8c3f0=_0x8c3f0||0x1f4;return function(_0x46ee17){logger[_0x772d('0x23')](_0x46ee17['stack']);if(_0x46ee17[_0x772d('0x24')]){delete _0x46ee17[_0x772d('0x24')];}_0x22850a[_0x772d('0x18')](_0x8c3f0)[_0x772d('0x25')](_0x46ee17);};}exports[_0x772d('0x26')]=function(_0xb119b2,_0x31bfdb){var _0x5a599a={},_0x26dd6c={},_0x19ddb5={'count':0x0,'rows':[]};var _0x16ddae=_['map'](db['WhatsappQueueReport'][_0x772d('0x27')],function(_0x1ded63){return{'name':_0x1ded63[_0x772d('0x28')],'type':_0x1ded63[_0x772d('0x29')][_0x772d('0x2a')]};});_0x26dd6c[_0x772d('0x2b')]=_[_0x772d('0x2c')](_0x16ddae,'name');_0x26dd6c[_0x772d('0x2d')]=_['keys'](_0xb119b2[_0x772d('0x2d')]);_0x26dd6c[_0x772d('0x2e')]=_[_0x772d('0x2f')](_0x26dd6c[_0x772d('0x2b')],_0x26dd6c[_0x772d('0x2d')]);_0x5a599a[_0x772d('0x30')]=_[_0x772d('0x2f')](_0x26dd6c[_0x772d('0x2b')],qs[_0x772d('0x31')](_0xb119b2[_0x772d('0x2d')][_0x772d('0x31')]));_0x5a599a['attributes']=_0x5a599a[_0x772d('0x30')]['length']?_0x5a599a[_0x772d('0x30')]:_0x26dd6c[_0x772d('0x2b')];if(!_0xb119b2[_0x772d('0x2d')][_0x772d('0x32')](_0x772d('0x33'))){_0x5a599a['limit']=qs[_0x772d('0x1b')](_0xb119b2['query']['limit']);_0x5a599a[_0x772d('0x1a')]=qs[_0x772d('0x1a')](_0xb119b2[_0x772d('0x2d')]['offset']);}_0x5a599a['order']=qs[_0x772d('0x34')](_0xb119b2[_0x772d('0x2d')][_0x772d('0x34')]);_0x5a599a[_0x772d('0x35')]=qs[_0x772d('0x2e')](_[_0x772d('0x36')](_0xb119b2[_0x772d('0x2d')],_0x26dd6c[_0x772d('0x2e')]),_0x16ddae);if(_0xb119b2[_0x772d('0x2d')][_0x772d('0x37')]){_0x5a599a[_0x772d('0x35')]=_[_0x772d('0x38')](_0x5a599a[_0x772d('0x35')],{'$or':_[_0x772d('0x2c')](_0x16ddae,function(_0x47c6a3){if(_0x47c6a3['type']!==_0x772d('0x39')){var _0x596090={};_0x596090[_0x47c6a3[_0x772d('0x24')]]={'$like':'%'+_0xb119b2[_0x772d('0x2d')]['filter']+'%'};return _0x596090;}})});}_0x5a599a=_[_0x772d('0x38')]({},_0x5a599a,_0xb119b2[_0x772d('0x3a')]);var _0x50fbed={'where':_0x5a599a[_0x772d('0x35')]};return db[_0x772d('0x3b')][_0x772d('0x3c')](_0x50fbed)[_0x772d('0x21')](function(_0x318491){_0x19ddb5['count']=_0x318491;if(_0xb119b2['query'][_0x772d('0x3d')]){_0x5a599a[_0x772d('0x3e')]=[{'all':!![]}];}return db[_0x772d('0x3b')]['findAll'](_0x5a599a);})['then'](function(_0x100828){_0x19ddb5[_0x772d('0x3f')]=_0x100828;return _0x19ddb5;})[_0x772d('0x21')](respondWithFilteredResult(_0x31bfdb,_0x5a599a))[_0x772d('0x40')](handleError(_0x31bfdb,null));};exports[_0x772d('0x41')]=function(_0x5cd96e,_0x16108d){var _0x21a881={'raw':!![],'where':{'id':_0x5cd96e[_0x772d('0x42')]['id']}},_0x1ef9e6={};_0x1ef9e6['model']=_['keys'](db['WhatsappQueueReport'][_0x772d('0x27')]);_0x1ef9e6[_0x772d('0x2d')]=_[_0x772d('0x43')](_0x5cd96e[_0x772d('0x2d')]);_0x1ef9e6[_0x772d('0x2e')]=_[_0x772d('0x2f')](_0x1ef9e6['model'],_0x1ef9e6[_0x772d('0x2d')]);_0x21a881[_0x772d('0x30')]=_[_0x772d('0x2f')](_0x1ef9e6[_0x772d('0x2b')],qs[_0x772d('0x31')](_0x5cd96e[_0x772d('0x2d')][_0x772d('0x31')]));_0x21a881[_0x772d('0x30')]=_0x21a881[_0x772d('0x30')][_0x772d('0x44')]?_0x21a881[_0x772d('0x30')]:_0x1ef9e6['model'];if(_0x5cd96e[_0x772d('0x2d')][_0x772d('0x3d')]){_0x21a881[_0x772d('0x3e')]=[{'all':!![]}];}_0x21a881=_[_0x772d('0x38')]({},_0x21a881,_0x5cd96e['options']);return db[_0x772d('0x3b')][_0x772d('0x45')](_0x21a881)[_0x772d('0x21')](handleEntityNotFound(_0x16108d,null))[_0x772d('0x21')](respondWithResult(_0x16108d,null))[_0x772d('0x40')](handleError(_0x16108d,null));};exports['create']=function(_0x37570d,_0xb0c0e7){return db[_0x772d('0x3b')][_0x772d('0x46')](_0x37570d[_0x772d('0x47')],{})[_0x772d('0x21')](respondWithResult(_0xb0c0e7,0xc9))[_0x772d('0x40')](handleError(_0xb0c0e7,null));};exports[_0x772d('0x48')]=function(_0xc79524,_0x7cdb7c){if(_0xc79524[_0x772d('0x47')]['id']){delete _0xc79524[_0x772d('0x47')]['id'];}return db[_0x772d('0x3b')][_0x772d('0x45')]({'where':{'id':_0xc79524['params']['id']}})[_0x772d('0x21')](handleEntityNotFound(_0x7cdb7c,null))[_0x772d('0x21')](saveUpdates(_0xc79524['body'],null))[_0x772d('0x21')](respondWithResult(_0x7cdb7c,null))[_0x772d('0x40')](handleError(_0x7cdb7c,null));};exports[_0x772d('0x22')]=function(_0x1f7444,_0x137dbf){return db['WhatsappQueueReport'][_0x772d('0x45')]({'where':{'id':_0x1f7444[_0x772d('0x42')]['id']}})['then'](handleEntityNotFound(_0x137dbf,null))[_0x772d('0x21')](removeEntity(_0x137dbf,null))[_0x772d('0x40')](handleError(_0x137dbf,null));};exports[_0x772d('0x49')]=function(_0x3e08b9,_0x56a840){return db[_0x772d('0x3b')][_0x772d('0x49')]()[_0x772d('0x21')](respondWithResult(_0x56a840,null))['catch'](handleError(_0x56a840,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9dd24d1..9b464dc 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 _0xd954=['rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','lodash','util','bluebird','request-promise','path'];(function(_0xdbb6bc,_0x4feac1){var _0x224e0c=function(_0x2b56cb){while(--_0x2b56cb){_0xdbb6bc['push'](_0xdbb6bc['shift']());}};_0x224e0c(++_0x4feac1);}(_0xd954,0x11d));var _0x4d95=function(_0x11b831,_0xef73c8){_0x11b831=_0x11b831-0x0;var _0x22c1b0=_0xd954[_0x11b831];return _0x22c1b0;};'use strict';var _=require(_0x4d95('0x0'));var util=require(_0x4d95('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d95('0x2'));var rp=require(_0x4d95('0x3'));var fs=require('fs');var path=require(_0x4d95('0x4'));var rimraf=require(_0x4d95('0x5'));var config=require(_0x4d95('0x6'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x304d3f,_0x41c251){return _0x304d3f[_0x4d95('0x7')](_0x4d95('0x8'),attributes,{'tableName':_0x4d95('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xec9f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x56180b,_0x1e282d){var _0xa3ac5a=function(_0x416651){while(--_0x416651){_0x56180b['push'](_0x56180b['shift']());}};_0xa3ac5a(++_0x1e282d);}(_0xec9f,0x112));var _0xfec9=function(_0x186957,_0x4083df){_0x186957=_0x186957-0x0;var _0x560b7c=_0xec9f[_0x186957];return _0x560b7c;};'use strict';var _=require(_0xfec9('0x0'));var util=require('util');var logger=require(_0xfec9('0x1'))(_0xfec9('0x2'));var moment=require(_0xfec9('0x3'));var BPromise=require(_0xfec9('0x4'));var rp=require(_0xfec9('0x5'));var fs=require('fs');var path=require(_0xfec9('0x6'));var rimraf=require(_0xfec9('0x7'));var config=require(_0xfec9('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x52f09f,_0x1769e6){return _0x52f09f[_0xfec9('0x9')](_0xfec9('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xfec9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 967ad03..a2cd8ed 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 _0x90bd=['WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport'];(function(_0x262227,_0x2a6fd5){var _0x8cff0f=function(_0x65670e){while(--_0x65670e){_0x262227['push'](_0x262227['shift']());}};_0x8cff0f(++_0x2a6fd5);}(_0x90bd,0x1d9));var _0xd90b=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x90bd[_0x2bbc07];return _0x6879e4;};'use strict';var _=require(_0xd90b('0x0'));var util=require(_0xd90b('0x1'));var moment=require('moment');var BPromise=require(_0xd90b('0x2'));var rs=require(_0xd90b('0x3'));var fs=require('fs');var Redis=require(_0xd90b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd90b('0x5'))(_0xd90b('0x6'));var config=require(_0xd90b('0x7'));var jayson=require(_0xd90b('0x8'));var client=jayson[_0xd90b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x309545,_0x2c5b7f,_0x55c5e0){return new BPromise(function(_0x23d563,_0x381775){return client[_0xd90b('0xa')](_0x309545,_0x55c5e0)[_0xd90b('0xb')](function(_0x1ed40a){logger[_0xd90b('0xc')](_0xd90b('0xd'),_0x2c5b7f,'request\x20sent');logger[_0xd90b('0xe')](_0xd90b('0xf'),_0x2c5b7f,_0xd90b('0x10'),JSON[_0xd90b('0x11')](_0x1ed40a));if(_0x1ed40a[_0xd90b('0x12')]){if(_0x1ed40a[_0xd90b('0x12')][_0xd90b('0x13')]===0x1f4){logger['error'](_0xd90b('0xd'),_0x2c5b7f,_0x1ed40a[_0xd90b('0x12')][_0xd90b('0x14')]);return _0x381775(_0x1ed40a[_0xd90b('0x12')][_0xd90b('0x14')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x2c5b7f,_0x1ed40a[_0xd90b('0x12')]['message']);return _0x23d563(_0x1ed40a[_0xd90b('0x12')][_0xd90b('0x14')]);}else{logger[_0xd90b('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c5b7f,'request\x20sent');_0x23d563(_0x1ed40a['result'][_0xd90b('0x14')]);}})[_0xd90b('0x15')](function(_0x5ca726){logger[_0xd90b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c5b7f,_0x5ca726);_0x381775(_0x5ca726);});});}exports[_0xd90b('0x16')]=function(_0x20efdd){var _0x56e321=this;return new Promise(function(_0x7dff50,_0x59a71a){return db[_0xd90b('0x17')]['create'](_0x20efdd[_0xd90b('0x18')],{'raw':_0x20efdd['options']?_0x20efdd[_0xd90b('0x19')][_0xd90b('0x1a')]===undefined?!![]:![]:!![]})[_0xd90b('0xb')](function(_0x35bae1){logger[_0xd90b('0xc')](_0xd90b('0x16'),_0x20efdd);logger[_0xd90b('0xe')](_0xd90b('0x16'),_0x20efdd,JSON['stringify'](_0x35bae1));_0x7dff50(_0x35bae1);})[_0xd90b('0x15')](function(_0x1be1f9){logger['error'](_0xd90b('0x16'),_0x1be1f9['message'],_0x20efdd);_0x59a71a(_0x56e321[_0xd90b('0x12')](0x1f4,_0x1be1f9[_0xd90b('0x14')]));});});};exports[_0xd90b('0x1b')]=function(_0x2f49cd){var _0x2ca77f=this;return new Promise(function(_0xc4f5e7,_0xf01580){return db[_0xd90b('0x17')][_0xd90b('0x1c')](_0x2f49cd[_0xd90b('0x18')],{'raw':_0x2f49cd[_0xd90b('0x19')]?_0x2f49cd[_0xd90b('0x19')][_0xd90b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f49cd[_0xd90b('0x19')]?_0x2f49cd['options'][_0xd90b('0x1d')]||null:null,'attributes':_0x2f49cd[_0xd90b('0x19')]?_0x2f49cd[_0xd90b('0x19')][_0xd90b('0x1e')]||null:null,'limit':_0x2f49cd[_0xd90b('0x19')]?_0x2f49cd['options']['limit']||null:null})[_0xd90b('0xb')](function(_0x32c22f){logger[_0xd90b('0xc')]('UpdateWhatsappQueueReport',_0x2f49cd);logger[_0xd90b('0xe')](_0xd90b('0x1b'),_0x2f49cd,JSON[_0xd90b('0x11')](_0x32c22f));_0xc4f5e7(_0x32c22f);})[_0xd90b('0x15')](function(_0x4e7992){logger[_0xd90b('0x12')](_0xd90b('0x1b'),_0x4e7992[_0xd90b('0x14')],_0x2f49cd);_0xf01580(_0x2ca77f[_0xd90b('0x12')](0x1f4,_0x4e7992[_0xd90b('0x14')]));});});}; \ No newline at end of file +var _0x0af1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','where','attributes','lodash','moment','bluebird'];(function(_0x17b8a8,_0x160303){var _0x1c9205=function(_0x4eacd1){while(--_0x4eacd1){_0x17b8a8['push'](_0x17b8a8['shift']());}};_0x1c9205(++_0x160303);}(_0x0af1,0x171));var _0x10af=function(_0x39627a,_0x26fa25){_0x39627a=_0x39627a-0x0;var _0xcc5ce5=_0x0af1[_0x39627a];return _0xcc5ce5;};'use strict';var _=require(_0x10af('0x0'));var util=require('util');var moment=require(_0x10af('0x1'));var BPromise=require(_0x10af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10af('0x3'))['db'];var utils=require(_0x10af('0x4'));var logger=require(_0x10af('0x5'))(_0x10af('0x6'));var config=require(_0x10af('0x7'));var jayson=require(_0x10af('0x8'));var client=jayson[_0x10af('0x9')][_0x10af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d356,_0x56b986,_0x31bf60){return new BPromise(function(_0x2d2708,_0x1ff48f){return client['request'](_0x28d356,_0x31bf60)[_0x10af('0xb')](function(_0x388e8d){logger[_0x10af('0xc')](_0x10af('0xd'),_0x56b986,'request\x20sent');logger[_0x10af('0xe')](_0x10af('0xf'),_0x56b986,_0x10af('0x10'),JSON[_0x10af('0x11')](_0x388e8d));if(_0x388e8d[_0x10af('0x12')]){if(_0x388e8d['error'][_0x10af('0x13')]===0x1f4){logger[_0x10af('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x56b986,_0x388e8d[_0x10af('0x12')][_0x10af('0x14')]);return _0x1ff48f(_0x388e8d[_0x10af('0x12')]['message']);}logger[_0x10af('0x12')](_0x10af('0xd'),_0x56b986,_0x388e8d[_0x10af('0x12')][_0x10af('0x14')]);return _0x2d2708(_0x388e8d[_0x10af('0x12')][_0x10af('0x14')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x56b986,_0x10af('0x10'));_0x2d2708(_0x388e8d[_0x10af('0x15')][_0x10af('0x14')]);}})[_0x10af('0x16')](function(_0x44b547){logger[_0x10af('0x12')](_0x10af('0xd'),_0x56b986,_0x44b547);_0x1ff48f(_0x44b547);});});}exports[_0x10af('0x17')]=function(_0x31a0e7){var _0xdc5f28=this;return new Promise(function(_0x2d473e,_0x47ee55){return db['WhatsappQueueReport'][_0x10af('0x18')](_0x31a0e7[_0x10af('0x19')],{'raw':_0x31a0e7[_0x10af('0x1a')]?_0x31a0e7['options']['raw']===undefined?!![]:![]:!![]})[_0x10af('0xb')](function(_0x1a717e){logger[_0x10af('0xc')]('CreateWhatsappQueueReport',_0x31a0e7);logger['debug'](_0x10af('0x17'),_0x31a0e7,JSON[_0x10af('0x11')](_0x1a717e));_0x2d473e(_0x1a717e);})['catch'](function(_0x26f338){logger[_0x10af('0x12')](_0x10af('0x17'),_0x26f338[_0x10af('0x14')],_0x31a0e7);_0x47ee55(_0xdc5f28[_0x10af('0x12')](0x1f4,_0x26f338['message']));});});};exports[_0x10af('0x1b')]=function(_0x24c933){var _0x47863f=this;return new Promise(function(_0x17d1e7,_0x56f043){return db['WhatsappQueueReport'][_0x10af('0x1c')](_0x24c933['body'],{'raw':_0x24c933[_0x10af('0x1a')]?_0x24c933[_0x10af('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24c933[_0x10af('0x1a')]?_0x24c933[_0x10af('0x1a')][_0x10af('0x1d')]||null:null,'attributes':_0x24c933['options']?_0x24c933[_0x10af('0x1a')][_0x10af('0x1e')]||null:null,'limit':_0x24c933[_0x10af('0x1a')]?_0x24c933[_0x10af('0x1a')]['limit']||null:null})[_0x10af('0xb')](function(_0xaabc74){logger[_0x10af('0xc')](_0x10af('0x1b'),_0x24c933);logger[_0x10af('0xe')](_0x10af('0x1b'),_0x24c933,JSON[_0x10af('0x11')](_0xaabc74));_0x17d1e7(_0xaabc74);})[_0x10af('0x16')](function(_0x7fbc46){logger[_0x10af('0x12')]('UpdateWhatsappQueueReport',_0x7fbc46[_0x10af('0x14')],_0x24c933);_0x56f043(_0x47863f[_0x10af('0x12')](0x1f4,_0x7fbc46[_0x10af('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index dd7d8da..a4f0878 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 _0x038f=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','multer','util','path','express'];(function(_0x580350,_0x4f2597){var _0x5e73ca=function(_0x16f5bf){while(--_0x16f5bf){_0x580350['push'](_0x580350['shift']());}};_0x5e73ca(++_0x4f2597);}(_0x038f,0x106));var _0xf038=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x038f[_0x695b76];return _0x1dc21f;};'use strict';var multer=require(_0xf038('0x0'));var util=require(_0xf038('0x1'));var path=require(_0xf038('0x2'));var timeout=require('connect-timeout');var express=require(_0xf038('0x3'));var router=express[_0xf038('0x4')]();var auth=require(_0xf038('0x5'));var interaction=require(_0xf038('0x6'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xf038('0x7')]('/',auth[_0xf038('0x8')](),controller[_0xf038('0x9')]);router[_0xf038('0x7')](_0xf038('0xa'),auth['isAuthenticated'](),controller[_0xf038('0xb')]);router[_0xf038('0x7')]('/:id',auth[_0xf038('0x8')](),controller[_0xf038('0xc')]);router[_0xf038('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf038('0xe')](_0xf038('0xf'),auth[_0xf038('0x8')](),controller[_0xf038('0x10')]);router[_0xf038('0x11')](_0xf038('0xf'),auth[_0xf038('0x8')](),controller[_0xf038('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2e17=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','/describe','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x2e17,0x98));var _0x72e1=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x2e17[_0x1d558c];return _0x15767d;};'use strict';var multer=require(_0x72e1('0x0'));var util=require(_0x72e1('0x1'));var path=require('path');var timeout=require(_0x72e1('0x2'));var express=require('express');var router=express[_0x72e1('0x3')]();var auth=require(_0x72e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x72e1('0x5'));var controller=require(_0x72e1('0x6'));router['get']('/',auth[_0x72e1('0x7')](),controller['index']);router[_0x72e1('0x8')](_0x72e1('0x9'),auth[_0x72e1('0x7')](),controller['describe']);router['get']('/:id',auth[_0x72e1('0x7')](),controller['show']);router[_0x72e1('0xa')]('/',auth[_0x72e1('0x7')](),controller[_0x72e1('0xb')]);router['put'](_0x72e1('0xc'),auth[_0x72e1('0x7')](),controller[_0x72e1('0xd')]);router[_0x72e1('0xe')]('/:id',auth[_0x72e1('0x7')](),controller[_0x72e1('0xf')]);module[_0x72e1('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f45e05d..5e0aa5b 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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xb10b[_0x2d0b84];return _0x8d0088;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0xb17f1,_0x4cdecf){var _0x4ed3af=function(_0x17b78b){while(--_0x17b78b){_0xb17f1['push'](_0xb17f1['shift']());}};_0x4ed3af(++_0x4cdecf);}(_0x2032,0xd9));var _0x2203=function(_0x181d0e,_0x5b75ad){_0x181d0e=_0x181d0e-0x0;var _0x18d72e=_0x2032[_0x181d0e];return _0x18d72e;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bc2ccf1..8f35561 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 _0x1367=['attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','merge','options','WhatsappTransferReport','include','findAll','rows','catch','show','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields'];(function(_0x16abc8,_0xfcb4be){var _0x11ce95=function(_0x55a636){while(--_0x55a636){_0x16abc8['push'](_0x16abc8['shift']());}};_0x11ce95(++_0xfcb4be);}(_0x1367,0x138));var _0x7136=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x1367[_0x56608c];return _0x3c7fb0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7136('0x0'));var rimraf=require(_0x7136('0x1'));var zipdir=require(_0x7136('0x2'));var jsonpatch=require(_0x7136('0x3'));var rp=require(_0x7136('0x4'));var moment=require(_0x7136('0x5'));var BPromise=require(_0x7136('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7136('0x7'));var sox=require(_0x7136('0x8'));var csv=require(_0x7136('0x9'));var ejs=require(_0x7136('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7136('0xb'));var crypto=require('crypto');var jsforce=require(_0x7136('0xc'));var deskjs=require(_0x7136('0xd'));var toCsv=require(_0x7136('0x9'));var querystring=require(_0x7136('0xe'));var Papa=require('papaparse');var Redis=require(_0x7136('0xf'));var authService=require(_0x7136('0x10'));var qs=require(_0x7136('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7136('0x12'));var logger=require(_0x7136('0x13'))(_0x7136('0x14'));var utils=require(_0x7136('0x15'));var config=require(_0x7136('0x16'));var db=require(_0x7136('0x17'))['db'];function respondWithStatusCode(_0x547e5a,_0x52471f){_0x52471f=_0x52471f||0xcc;return function(_0x339fcc){if(_0x339fcc){return _0x547e5a[_0x7136('0x18')](_0x52471f);}return _0x547e5a['status'](_0x52471f)[_0x7136('0x19')]();};}function respondWithResult(_0x3250f8,_0x3a662e){_0x3a662e=_0x3a662e||0xc8;return function(_0x3a5dfd){if(_0x3a5dfd){return _0x3250f8[_0x7136('0x1a')](_0x3a662e)['json'](_0x3a5dfd);}};}function respondWithFilteredResult(_0x459121,_0x6ce1cb){return function(_0x17a06d){if(_0x17a06d){var _0x5db6c0=_0x17a06d[_0x7136('0x1b')],_0x14eb81=_0x6ce1cb[_0x7136('0x1c')],_0x6040e8=_0x6ce1cb['offset']+_0x6ce1cb[_0x7136('0x1d')],_0x2ae929;if(_0x6040e8>=_0x5db6c0){_0x6040e8=_0x5db6c0;_0x2ae929=0xc8;}else{_0x2ae929=0xce;}_0x459121[_0x7136('0x1a')](_0x2ae929);return _0x459121['set'](_0x7136('0x1e'),_0x14eb81+'-'+_0x6040e8+'/'+_0x5db6c0)[_0x7136('0x1f')](_0x17a06d);}return null;};}function patchUpdates(_0xfe94d8){return function(_0xe5877e){try{jsonpatch['apply'](_0xe5877e,_0xfe94d8,!![]);}catch(_0x339871){return BPromise['reject'](_0x339871);}return _0xe5877e[_0x7136('0x20')]();};}function saveUpdates(_0x1c9301,_0x3cde6a){return function(_0x22bda4){if(_0x22bda4){return _0x22bda4['update'](_0x1c9301)[_0x7136('0x21')](function(_0x419805){return _0x419805;});}return null;};}function removeEntity(_0x5a8dad,_0x440968){return function(_0x44afe3){if(_0x44afe3){return _0x44afe3['destroy']()['then'](function(){_0x5a8dad[_0x7136('0x1a')](0xcc)[_0x7136('0x19')]();});}};}function handleEntityNotFound(_0x1a9a0a,_0x4348ff){return function(_0xb5d1d0){if(!_0xb5d1d0){_0x1a9a0a[_0x7136('0x18')](0x194);}return _0xb5d1d0;};}function handleError(_0x488b96,_0x4ed236){_0x4ed236=_0x4ed236||0x1f4;return function(_0x4c13c6){logger[_0x7136('0x22')](_0x4c13c6[_0x7136('0x23')]);if(_0x4c13c6['name']){delete _0x4c13c6[_0x7136('0x24')];}_0x488b96[_0x7136('0x1a')](_0x4ed236)[_0x7136('0x25')](_0x4c13c6);};}exports[_0x7136('0x26')]=function(_0x389d74,_0x436760){var _0x1719a7={},_0x3715dd={},_0x592fed={'count':0x0,'rows':[]};var _0x7db5cf=_['map'](db['WhatsappTransferReport'][_0x7136('0x27')],function(_0x3f0503){return{'name':_0x3f0503[_0x7136('0x28')],'type':_0x3f0503[_0x7136('0x29')]['key']};});_0x3715dd['model']=_['map'](_0x7db5cf,'name');_0x3715dd[_0x7136('0x2a')]=_[_0x7136('0x2b')](_0x389d74[_0x7136('0x2a')]);_0x3715dd[_0x7136('0x2c')]=_[_0x7136('0x2d')](_0x3715dd[_0x7136('0x2e')],_0x3715dd[_0x7136('0x2a')]);_0x1719a7['attributes']=_[_0x7136('0x2d')](_0x3715dd[_0x7136('0x2e')],qs[_0x7136('0x2f')](_0x389d74[_0x7136('0x2a')][_0x7136('0x2f')]));_0x1719a7['attributes']=_0x1719a7[_0x7136('0x30')][_0x7136('0x31')]?_0x1719a7[_0x7136('0x30')]:_0x3715dd[_0x7136('0x2e')];if(!_0x389d74[_0x7136('0x2a')][_0x7136('0x32')]('nolimit')){_0x1719a7['limit']=qs['limit'](_0x389d74[_0x7136('0x2a')]['limit']);_0x1719a7[_0x7136('0x1c')]=qs[_0x7136('0x1c')](_0x389d74[_0x7136('0x2a')][_0x7136('0x1c')]);}_0x1719a7['order']=qs[_0x7136('0x33')](_0x389d74[_0x7136('0x2a')][_0x7136('0x33')]);_0x1719a7['where']=qs[_0x7136('0x2c')](_[_0x7136('0x34')](_0x389d74['query'],_0x3715dd[_0x7136('0x2c')]),_0x7db5cf);if(_0x389d74['query'][_0x7136('0x35')]){_0x1719a7['where']=_['merge'](_0x1719a7[_0x7136('0x36')],{'$or':_[_0x7136('0x37')](_0x7db5cf,function(_0x371e8d){if(_0x371e8d['type']!==_0x7136('0x38')){var _0x246bd1={};_0x246bd1[_0x371e8d[_0x7136('0x24')]]={'$like':'%'+_0x389d74[_0x7136('0x2a')][_0x7136('0x35')]+'%'};return _0x246bd1;}})});}_0x1719a7=_[_0x7136('0x39')]({},_0x1719a7,_0x389d74[_0x7136('0x3a')]);var _0x3e84e2={'where':_0x1719a7[_0x7136('0x36')]};return db[_0x7136('0x3b')]['count'](_0x3e84e2)[_0x7136('0x21')](function(_0x57d1a7){_0x592fed[_0x7136('0x1b')]=_0x57d1a7;if(_0x389d74[_0x7136('0x2a')]['includeAll']){_0x1719a7[_0x7136('0x3c')]=[{'all':!![]}];}return db[_0x7136('0x3b')][_0x7136('0x3d')](_0x1719a7);})[_0x7136('0x21')](function(_0xa1f2ff){_0x592fed[_0x7136('0x3e')]=_0xa1f2ff;return _0x592fed;})[_0x7136('0x21')](respondWithFilteredResult(_0x436760,_0x1719a7))[_0x7136('0x3f')](handleError(_0x436760,null));};exports[_0x7136('0x40')]=function(_0x1665da,_0x3c9edf){var _0x2e2a59={'raw':!![],'where':{'id':_0x1665da['params']['id']}},_0x391502={};_0x391502[_0x7136('0x2e')]=_[_0x7136('0x2b')](db[_0x7136('0x3b')][_0x7136('0x27')]);_0x391502['query']=_[_0x7136('0x2b')](_0x1665da[_0x7136('0x2a')]);_0x391502[_0x7136('0x2c')]=_['intersection'](_0x391502['model'],_0x391502[_0x7136('0x2a')]);_0x2e2a59['attributes']=_[_0x7136('0x2d')](_0x391502[_0x7136('0x2e')],qs['fields'](_0x1665da[_0x7136('0x2a')][_0x7136('0x2f')]));_0x2e2a59['attributes']=_0x2e2a59[_0x7136('0x30')][_0x7136('0x31')]?_0x2e2a59[_0x7136('0x30')]:_0x391502[_0x7136('0x2e')];if(_0x1665da[_0x7136('0x2a')]['includeAll']){_0x2e2a59['include']=[{'all':!![]}];}_0x2e2a59=_['merge']({},_0x2e2a59,_0x1665da[_0x7136('0x3a')]);return db[_0x7136('0x3b')][_0x7136('0x41')](_0x2e2a59)[_0x7136('0x21')](handleEntityNotFound(_0x3c9edf,null))[_0x7136('0x21')](respondWithResult(_0x3c9edf,null))['catch'](handleError(_0x3c9edf,null));};exports['create']=function(_0x4f8825,_0x1d226f){return db[_0x7136('0x3b')][_0x7136('0x42')](_0x4f8825[_0x7136('0x43')],{})['then'](respondWithResult(_0x1d226f,0xc9))[_0x7136('0x3f')](handleError(_0x1d226f,null));};exports[_0x7136('0x44')]=function(_0x38226e,_0x167c5b){if(_0x38226e[_0x7136('0x43')]['id']){delete _0x38226e['body']['id'];}return db[_0x7136('0x3b')][_0x7136('0x41')]({'where':{'id':_0x38226e[_0x7136('0x45')]['id']}})[_0x7136('0x21')](handleEntityNotFound(_0x167c5b,null))[_0x7136('0x21')](saveUpdates(_0x38226e[_0x7136('0x43')],null))[_0x7136('0x21')](respondWithResult(_0x167c5b,null))['catch'](handleError(_0x167c5b,null));};exports[_0x7136('0x46')]=function(_0x5d6a3e,_0x17c16c){return db['WhatsappTransferReport'][_0x7136('0x41')]({'where':{'id':_0x5d6a3e[_0x7136('0x45')]['id']}})['then'](handleEntityNotFound(_0x17c16c,null))[_0x7136('0x21')](removeEntity(_0x17c16c,null))[_0x7136('0x3f')](handleError(_0x17c16c,null));};exports[_0x7136('0x47')]=function(_0x598245,_0x49dd6d){return db[_0x7136('0x3b')][_0x7136('0x47')]()['then'](respondWithResult(_0x49dd6d,null))[_0x7136('0x3f')](handleError(_0x49dd6d,null));}; \ No newline at end of file +var _0x8ad8=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','WhatsappTransferReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0xcc7c06,_0x4ca291){var _0x27b445=function(_0x2e7f27){while(--_0x2e7f27){_0xcc7c06['push'](_0xcc7c06['shift']());}};_0x27b445(++_0x4ca291);}(_0x8ad8,0x137));var _0x88ad=function(_0x5231e9,_0x447df0){_0x5231e9=_0x5231e9-0x0;var _0x5b9261=_0x8ad8[_0x5231e9];return _0x5b9261;};'use strict';var pdf=require(_0x88ad('0x0'));var emlformat=require(_0x88ad('0x1'));var rimraf=require(_0x88ad('0x2'));var zipdir=require(_0x88ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88ad('0x4'));var moment=require(_0x88ad('0x5'));var BPromise=require(_0x88ad('0x6'));var Mustache=require(_0x88ad('0x7'));var util=require(_0x88ad('0x8'));var path=require(_0x88ad('0x9'));var sox=require(_0x88ad('0xa'));var csv=require(_0x88ad('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ad('0xc'));var squel=require(_0x88ad('0xd'));var crypto=require(_0x88ad('0xe'));var jsforce=require(_0x88ad('0xf'));var deskjs=require(_0x88ad('0x10'));var toCsv=require(_0x88ad('0xb'));var querystring=require('querystring');var Papa=require(_0x88ad('0x11'));var Redis=require(_0x88ad('0x12'));var authService=require(_0x88ad('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x88ad('0x14'));var hardwareService=require(_0x88ad('0x15'));var logger=require(_0x88ad('0x16'))(_0x88ad('0x17'));var utils=require(_0x88ad('0x18'));var config=require(_0x88ad('0x19'));var db=require(_0x88ad('0x1a'))['db'];function respondWithStatusCode(_0x1622d7,_0x5c62ce){_0x5c62ce=_0x5c62ce||0xcc;return function(_0x3275df){if(_0x3275df){return _0x1622d7['sendStatus'](_0x5c62ce);}return _0x1622d7[_0x88ad('0x1b')](_0x5c62ce)[_0x88ad('0x1c')]();};}function respondWithResult(_0x257da4,_0x199baa){_0x199baa=_0x199baa||0xc8;return function(_0x249040){if(_0x249040){return _0x257da4[_0x88ad('0x1b')](_0x199baa)['json'](_0x249040);}};}function respondWithFilteredResult(_0x5568a3,_0x4d9d49){return function(_0x5cbade){if(_0x5cbade){var _0x54b8fa=_0x5cbade[_0x88ad('0x1d')],_0x4583ac=_0x4d9d49[_0x88ad('0x1e')],_0x1d6f22=_0x4d9d49['offset']+_0x4d9d49[_0x88ad('0x1f')],_0x378ae3;if(_0x1d6f22>=_0x54b8fa){_0x1d6f22=_0x54b8fa;_0x378ae3=0xc8;}else{_0x378ae3=0xce;}_0x5568a3['status'](_0x378ae3);return _0x5568a3[_0x88ad('0x20')](_0x88ad('0x21'),_0x4583ac+'-'+_0x1d6f22+'/'+_0x54b8fa)[_0x88ad('0x22')](_0x5cbade);}return null;};}function patchUpdates(_0x73bc7){return function(_0x45996b){try{jsonpatch[_0x88ad('0x23')](_0x45996b,_0x73bc7,!![]);}catch(_0x36216d){return BPromise[_0x88ad('0x24')](_0x36216d);}return _0x45996b[_0x88ad('0x25')]();};}function saveUpdates(_0x31a9e8,_0x4c1a10){return function(_0x103387){if(_0x103387){return _0x103387[_0x88ad('0x26')](_0x31a9e8)[_0x88ad('0x27')](function(_0x2aab51){return _0x2aab51;});}return null;};}function removeEntity(_0x4f5be3,_0xd80195){return function(_0x11afd6){if(_0x11afd6){return _0x11afd6[_0x88ad('0x28')]()[_0x88ad('0x27')](function(){_0x4f5be3['status'](0xcc)[_0x88ad('0x1c')]();});}};}function handleEntityNotFound(_0x19811c,_0x15bbb2){return function(_0x47e1a8){if(!_0x47e1a8){_0x19811c[_0x88ad('0x29')](0x194);}return _0x47e1a8;};}function handleError(_0x347790,_0x29c92b){_0x29c92b=_0x29c92b||0x1f4;return function(_0x31b5f1){logger[_0x88ad('0x2a')](_0x31b5f1[_0x88ad('0x2b')]);if(_0x31b5f1[_0x88ad('0x2c')]){delete _0x31b5f1[_0x88ad('0x2c')];}_0x347790[_0x88ad('0x1b')](_0x29c92b)[_0x88ad('0x2d')](_0x31b5f1);};}exports['index']=function(_0x35e9b8,_0x51b2db){var _0x11e6a8={},_0x46b549={},_0x6e02f9={'count':0x0,'rows':[]};var _0x136b87=_[_0x88ad('0x2e')](db[_0x88ad('0x2f')]['rawAttributes'],function(_0x13424a){return{'name':_0x13424a[_0x88ad('0x30')],'type':_0x13424a['type'][_0x88ad('0x31')]};});_0x46b549[_0x88ad('0x32')]=_[_0x88ad('0x2e')](_0x136b87,'name');_0x46b549[_0x88ad('0x33')]=_[_0x88ad('0x34')](_0x35e9b8['query']);_0x46b549[_0x88ad('0x35')]=_[_0x88ad('0x36')](_0x46b549[_0x88ad('0x32')],_0x46b549[_0x88ad('0x33')]);_0x11e6a8['attributes']=_[_0x88ad('0x36')](_0x46b549[_0x88ad('0x32')],qs[_0x88ad('0x37')](_0x35e9b8[_0x88ad('0x33')][_0x88ad('0x37')]));_0x11e6a8['attributes']=_0x11e6a8[_0x88ad('0x38')][_0x88ad('0x39')]?_0x11e6a8['attributes']:_0x46b549[_0x88ad('0x32')];if(!_0x35e9b8[_0x88ad('0x33')][_0x88ad('0x3a')](_0x88ad('0x3b'))){_0x11e6a8['limit']=qs[_0x88ad('0x1f')](_0x35e9b8[_0x88ad('0x33')][_0x88ad('0x1f')]);_0x11e6a8[_0x88ad('0x1e')]=qs[_0x88ad('0x1e')](_0x35e9b8[_0x88ad('0x33')]['offset']);}_0x11e6a8['order']=qs['sort'](_0x35e9b8[_0x88ad('0x33')][_0x88ad('0x3c')]);_0x11e6a8[_0x88ad('0x3d')]=qs['filters'](_[_0x88ad('0x3e')](_0x35e9b8[_0x88ad('0x33')],_0x46b549[_0x88ad('0x35')]),_0x136b87);if(_0x35e9b8[_0x88ad('0x33')][_0x88ad('0x3f')]){_0x11e6a8[_0x88ad('0x3d')]=_['merge'](_0x11e6a8[_0x88ad('0x3d')],{'$or':_[_0x88ad('0x2e')](_0x136b87,function(_0x5a6309){if(_0x5a6309['type']!==_0x88ad('0x40')){var _0x5305bc={};_0x5305bc[_0x5a6309[_0x88ad('0x2c')]]={'$like':'%'+_0x35e9b8[_0x88ad('0x33')][_0x88ad('0x3f')]+'%'};return _0x5305bc;}})});}_0x11e6a8=_[_0x88ad('0x41')]({},_0x11e6a8,_0x35e9b8[_0x88ad('0x42')]);var _0x348443={'where':_0x11e6a8[_0x88ad('0x3d')]};return db[_0x88ad('0x2f')]['count'](_0x348443)['then'](function(_0x3a6568){_0x6e02f9[_0x88ad('0x1d')]=_0x3a6568;if(_0x35e9b8['query'][_0x88ad('0x43')]){_0x11e6a8[_0x88ad('0x44')]=[{'all':!![]}];}return db[_0x88ad('0x2f')][_0x88ad('0x45')](_0x11e6a8);})[_0x88ad('0x27')](function(_0x59a463){_0x6e02f9[_0x88ad('0x46')]=_0x59a463;return _0x6e02f9;})['then'](respondWithFilteredResult(_0x51b2db,_0x11e6a8))[_0x88ad('0x47')](handleError(_0x51b2db,null));};exports[_0x88ad('0x48')]=function(_0x2ed08f,_0x47aa5c){var _0x37b352={'raw':!![],'where':{'id':_0x2ed08f[_0x88ad('0x49')]['id']}},_0x451e4b={};_0x451e4b[_0x88ad('0x32')]=_[_0x88ad('0x34')](db[_0x88ad('0x2f')][_0x88ad('0x4a')]);_0x451e4b[_0x88ad('0x33')]=_[_0x88ad('0x34')](_0x2ed08f[_0x88ad('0x33')]);_0x451e4b[_0x88ad('0x35')]=_[_0x88ad('0x36')](_0x451e4b[_0x88ad('0x32')],_0x451e4b['query']);_0x37b352[_0x88ad('0x38')]=_[_0x88ad('0x36')](_0x451e4b[_0x88ad('0x32')],qs[_0x88ad('0x37')](_0x2ed08f[_0x88ad('0x33')][_0x88ad('0x37')]));_0x37b352[_0x88ad('0x38')]=_0x37b352['attributes'][_0x88ad('0x39')]?_0x37b352[_0x88ad('0x38')]:_0x451e4b[_0x88ad('0x32')];if(_0x2ed08f[_0x88ad('0x33')][_0x88ad('0x43')]){_0x37b352[_0x88ad('0x44')]=[{'all':!![]}];}_0x37b352=_[_0x88ad('0x41')]({},_0x37b352,_0x2ed08f[_0x88ad('0x42')]);return db[_0x88ad('0x2f')][_0x88ad('0x4b')](_0x37b352)[_0x88ad('0x27')](handleEntityNotFound(_0x47aa5c,null))[_0x88ad('0x27')](respondWithResult(_0x47aa5c,null))[_0x88ad('0x47')](handleError(_0x47aa5c,null));};exports['create']=function(_0x48890a,_0x1f7adc){return db[_0x88ad('0x2f')][_0x88ad('0x4c')](_0x48890a[_0x88ad('0x4d')],{})[_0x88ad('0x27')](respondWithResult(_0x1f7adc,0xc9))['catch'](handleError(_0x1f7adc,null));};exports[_0x88ad('0x26')]=function(_0x22c93a,_0x2c75fb){if(_0x22c93a[_0x88ad('0x4d')]['id']){delete _0x22c93a[_0x88ad('0x4d')]['id'];}return db['WhatsappTransferReport'][_0x88ad('0x4b')]({'where':{'id':_0x22c93a['params']['id']}})[_0x88ad('0x27')](handleEntityNotFound(_0x2c75fb,null))[_0x88ad('0x27')](saveUpdates(_0x22c93a[_0x88ad('0x4d')],null))[_0x88ad('0x27')](respondWithResult(_0x2c75fb,null))['catch'](handleError(_0x2c75fb,null));};exports[_0x88ad('0x28')]=function(_0x1f4cb8,_0x4c32bb){return db[_0x88ad('0x2f')][_0x88ad('0x4b')]({'where':{'id':_0x1f4cb8['params']['id']}})[_0x88ad('0x27')](handleEntityNotFound(_0x4c32bb,null))[_0x88ad('0x27')](removeEntity(_0x4c32bb,null))['catch'](handleError(_0x4c32bb,null));};exports['describe']=function(_0x205524,_0x1336c4){return db[_0x88ad('0x2f')][_0x88ad('0x4e')]()['then'](respondWithResult(_0x1336c4,null))[_0x88ad('0x47')](handleError(_0x1336c4,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2184639..86ba3c8 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 _0xca09=['report_whatsapp_transfer','uniqueid','api','moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x51a76c,_0x1bb26e){var _0x5a2735=function(_0x13bf3b){while(--_0x13bf3b){_0x51a76c['push'](_0x51a76c['shift']());}};_0x5a2735(++_0x1bb26e);}(_0xca09,0x1c5));var _0x9ca0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xca09[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9ca0('0x0'));var moment=require(_0x9ca0('0x1'));var BPromise=require('bluebird');var rp=require(_0x9ca0('0x2'));var fs=require('fs');var path=require(_0x9ca0('0x3'));var rimraf=require(_0x9ca0('0x4'));var config=require('../../config/environment');var attributes=require(_0x9ca0('0x5'));module[_0x9ca0('0x6')]=function(_0x36ca8e,_0x2f78a8){return _0x36ca8e[_0x9ca0('0x7')](_0x9ca0('0x8'),attributes,{'tableName':_0x9ca0('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9ca0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5b3=['lodash','util','api','moment','bluebird','request-promise','path','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xf5b3,0xc3));var _0x3f5b=function(_0x5dfd65,_0x1ad889){_0x5dfd65=_0x5dfd65-0x0;var _0x47f853=_0xf5b3[_0x5dfd65];return _0x47f853;};'use strict';var _=require(_0x3f5b('0x0'));var util=require(_0x3f5b('0x1'));var logger=require('../../config/logger')(_0x3f5b('0x2'));var moment=require(_0x3f5b('0x3'));var BPromise=require(_0x3f5b('0x4'));var rp=require(_0x3f5b('0x5'));var fs=require('fs');var path=require(_0x3f5b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3f5b('0x7'));module[_0x3f5b('0x8')]=function(_0x163038,_0x317dc9){return _0x163038[_0x3f5b('0x9')](_0x3f5b('0xa'),attributes,{'tableName':_0x3f5b('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3f5b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index cd10439..cad8212 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b6127,_0x5db092){var _0x303bd9=function(_0x9b734){while(--_0x9b734){_0x2b6127['push'](_0x2b6127['shift']());}};_0x303bd9(++_0x5db092);}(_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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x21c6a0,_0x116f97){var _0x1f5ef3=function(_0xf04dbc){while(--_0xf04dbc){_0x21c6a0['push'](_0x21c6a0['shift']());}};_0x1f5ef3(++_0x116f97);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 1459cb1..963dc12 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b36=['map','name','None','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','filter','online','join','Offline\x20apps:'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x0b36,0x15e));var _0x60b3=function(_0x2d604b,_0x4f1748){_0x2d604b=_0x2d604b-0x0;var _0x504857=_0x0b36[_0x2d604b];return _0x504857;};'use strict';var _=require(_0x60b3('0x0'));var mysqldb=require(_0x60b3('0x1'));var rpc=require(_0x60b3('0x2'));var config=require(_0x60b3('0x3'));var logger=require(_0x60b3('0x4'))(_0x60b3('0x5'));var pm2=require(_0x60b3('0x6'));var pm2Config=require(_0x60b3('0x7'));var schedule=require(_0x60b3('0x8'));var chat=require(_0x60b3('0x9'));var transcribe=require(_0x60b3('0xa'));function main(){return mysqldb['db'][_0x60b3('0xb')][_0x60b3('0xc')]()[_0x60b3('0xd')](function(){return rpc[_0x60b3('0xe')]();})['then'](function(_0x164712){logger[_0x60b3('0xf')](_0x164712);return chat[_0x60b3('0x10')]();})[_0x60b3('0xd')](function(){return schedule[_0x60b3('0x10')]();})[_0x60b3('0xd')](function(){return transcribe[_0x60b3('0x10')]();})['then'](function(_0x271c81){logger[_0x60b3('0xf')](_0x271c81);return pm2[_0x60b3('0x10')](pm2Config);})[_0x60b3('0xd')](function(_0x4b841d){logger['info'](_0x60b3('0x11'),_['map'](_[_0x60b3('0x12')](_0x4b841d,{'status':_0x60b3('0x13')}),'name')[_0x60b3('0x14')]());logger['info'](_0x60b3('0x15'),_[_0x60b3('0x16')](_['filter'](_0x4b841d,function(_0x3615e6){return _0x3615e6['status']!==_0x60b3('0x13');}),_0x60b3('0x17'))[_0x60b3('0x14')]()||_0x60b3('0x18'));config[_0x60b3('0x19')]&&require(_0x60b3('0x1a'))[_0x60b3('0x1b')]();require(_0x60b3('0x1c'))[_0x60b3('0x1b')]();})['catch'](function(_0x41d43d){logger[_0x60b3('0x1d')](_0x60b3('0x1e'),_0x41d43d);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xe107=['name','join','filter','status','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2/config','./config/schedule','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','online'];(function(_0x596d05,_0x280b4e){var _0x2db281=function(_0x317103){while(--_0x317103){_0x596d05['push'](_0x596d05['shift']());}};_0x2db281(++_0x280b4e);}(_0xe107,0xd0));var _0x7e10=function(_0x32f91c,_0x354ba7){_0x32f91c=_0x32f91c-0x0;var _0x5d52c8=_0xe107[_0x32f91c];return _0x5d52c8;};'use strict';var _=require(_0x7e10('0x0'));var mysqldb=require(_0x7e10('0x1'));var rpc=require(_0x7e10('0x2'));var config=require(_0x7e10('0x3'));var logger=require('./config/logger')(_0x7e10('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x7e10('0x5'));var schedule=require(_0x7e10('0x6'));var chat=require('./config/schedule/chat');var transcribe=require(_0x7e10('0x7'));function main(){return mysqldb['db'][_0x7e10('0x8')][_0x7e10('0x9')]()[_0x7e10('0xa')](function(){return rpc[_0x7e10('0xb')]();})[_0x7e10('0xa')](function(_0x4742eb){logger[_0x7e10('0xc')](_0x4742eb);return chat['start']();})[_0x7e10('0xa')](function(){return schedule[_0x7e10('0xd')]();})['then'](function(){return transcribe[_0x7e10('0xd')]();})['then'](function(_0x1d525c){logger[_0x7e10('0xc')](_0x1d525c);return pm2[_0x7e10('0xd')](pm2Config);})[_0x7e10('0xa')](function(_0x8cf20f){logger[_0x7e10('0xc')]('Online\x20apps:',_[_0x7e10('0xe')](_['filter'](_0x8cf20f,{'status':_0x7e10('0xf')}),_0x7e10('0x10'))[_0x7e10('0x11')]());logger[_0x7e10('0xc')]('Offline\x20apps:',_['map'](_[_0x7e10('0x12')](_0x8cf20f,function(_0x228fab){return _0x228fab[_0x7e10('0x13')]!==_0x7e10('0xf');}),_0x7e10('0x10'))[_0x7e10('0x11')]()||_0x7e10('0x14'));config[_0x7e10('0x15')]&&require(_0x7e10('0x16'))[_0x7e10('0x17')]();require('./config/license')[_0x7e10('0x17')]();})[_0x7e10('0x18')](function(_0x2245fa){logger[_0x7e10('0x19')](_0x7e10('0x1a'),_0x2245fa);process[_0x7e10('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1f45595..d75988d 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 _0x4848=['headers','startsWith','authorization','Basic','User','find','pass','Wrong\x20credentials.','getUuid','apikey','sub','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','options','verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','name','internal','email','userpic','md5secret','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch'];(function(_0x164c30,_0xc3af48){var _0x4c5320=function(_0x567724){while(--_0x567724){_0x164c30['push'](_0x164c30['shift']());}};_0x4c5320(++_0xc3af48);}(_0x4848,0x1af));var _0x8484=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x4848[_0x273dc5];return _0x46dae7;};'use strict';var db=require(_0x8484('0x0'))['db'];var config=require(_0x8484('0x1'));var hardwareConf=require(_0x8484('0x2'));var _=require(_0x8484('0x3'));var jwt=require(_0x8484('0x4'));var expressJwt=require(_0x8484('0x5'));var compose=require(_0x8484('0x6'));var basicAuth=require(_0x8484('0x7'));var crypto=require(_0x8484('0x8'));var BPromise=require(_0x8484('0x9'));var validateJwt=expressJwt({'secret':config[_0x8484('0xa')][_0x8484('0xb')]});var userAttributes=['id',_0x8484('0xc'),'fullname',_0x8484('0xd'),_0x8484('0xe'),_0x8484('0xf'),_0x8484('0x10'),'permissions',_0x8484('0x11'),'voicePause',_0x8484('0x12'),_0x8484('0x13'),'faxPause',_0x8484('0x14'),_0x8484('0x15'),_0x8484('0x16'),_0x8484('0x17'),'lastLoginAt','lastPauseAt','crudPermissions',_0x8484('0x18'),_0x8484('0x19'),_0x8484('0x1a'),_0x8484('0x1b'),_0x8484('0x1c'),_0x8484('0x1d'),'phoneBarEnableRecording',_0x8484('0x1e'),_0x8484('0x1f'),'phoneBarExpires',_0x8484('0x20'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0x8484('0x21'),_0x8484('0x22')];exports[_0x8484('0x23')]=function(){return this[_0x8484('0x24')](!![])[_0x8484('0x25')](function(_0x54cfee,_0x4c84af,_0x4a3bc1){if(_0x54cfee[_0x8484('0x26')]){_0x4a3bc1();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x54cfee[_0x8484('0x27')]['id']},'attributes':['id',_0x8484('0x28'),_0x8484('0x29')],'raw':!![]})[_0x8484('0x2a')](function(_0x51b922){if(_0x51b922&&_0x51b922[_0x8484('0x28')]){return _0x4c84af[_0x8484('0x2b')](_0x51b922[_0x8484('0x29')]===_0x8484('0x2c')?0x195:0x193)[_0x8484('0x2d')]({'message':_0x51b922[_0x8484('0x29')]===_0x8484('0x2c')?_0x8484('0x2e'):_0x8484('0x2f')});}else{_0x4a3bc1();}})[_0x8484('0x30')](function(_0x85f15f){_0x4a3bc1(_0x85f15f);});}});};exports[_0x8484('0x24')]=function isAuthenticated(_0x49dfa8){return compose()[_0x8484('0x25')](function(_0x429464,_0x7e8a28,_0x4cd994){if(_0x429464[_0x8484('0x31')]['authorization']){if(_[_0x8484('0x32')](_0x429464['headers'][_0x8484('0x33')],_0x8484('0x34'))){var _0x4d8cd0=basicAuth(_0x429464);db[_0x8484('0x35')][_0x8484('0x36')]({'where':{'name':_0x4d8cd0[_0x8484('0xd')]}})[_0x8484('0x2a')](function(_0x45fa0f){if(!_0x45fa0f||!_0x45fa0f['authenticate'](_0x4d8cd0[_0x8484('0x37')])){return _0x7e8a28[_0x8484('0x2b')](0x191)[_0x8484('0x2d')]({'message':_0x8484('0x38')});}_0x429464[_0x8484('0x26')]={'id':_0x45fa0f['id']};_0x4cd994();})['catch'](function(_0x3574c6){_0x4cd994(_0x3574c6);});}else if(_['startsWith'](_0x429464['headers'][_0x8484('0x33')],'Bearer')){validateJwt(_0x429464,_0x7e8a28,_0x4cd994);}else{if(_0x49dfa8){_0x4cd994();}else{return _0x7e8a28[_0x8484('0x2b')](0x193)[_0x8484('0x2d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x429464['query']['apikey']){try{var _0x391c58={'audience':hardwareConf[_0x8484('0x39')](),'issuer':hardwareConf[_0x8484('0x39')]()};verifyJwt(_0x429464['query'][_0x8484('0x3a')],_0x391c58)[_0x8484('0x2a')](function(_0x11a63c){return db[_0x8484('0x35')][_0x8484('0x36')]({'where':{'id':_0x11a63c[_0x8484('0x3b')]}})['then'](function(_0x165adb){if(!_0x165adb||!_['isEqual'](_0x165adb[_0x8484('0x3c')],_0x11a63c[_0x8484('0x3d')])){return _0x7e8a28['status'](0x191)[_0x8484('0x2d')]({'message':_0x8484('0x3e')});}_0x429464[_0x8484('0x26')]={'id':_0x165adb['id']};_0x4cd994();});})[_0x8484('0x30')](function(){return _0x7e8a28[_0x8484('0x2b')](0x191)['json']({'message':_0x8484('0x3f')});});}catch(_0x5a566f){_0x4cd994(_0x5a566f);}}else if(_0x49dfa8){_0x4cd994();}else{return _0x7e8a28['status'](0x193)[_0x8484('0x2d')]({'message':_0x8484('0x40')});}})[_0x8484('0x25')](function(_0x3e2260,_0x115c3c,_0x56c141){if(_0x3e2260[_0x8484('0x26')]){db['User']['find']({'where':{'id':_0x3e2260[_0x8484('0x26')]['id']},'attributes':userAttributes})['then'](function(_0x33ffc8){if(!_0x33ffc8){return _0x115c3c[_0x8484('0x2b')](0x194)[_0x8484('0x2d')]({'message':_0x8484('0x41')});}_0x3e2260[_0x8484('0x26')]=_0x33ffc8;_0x56c141();})[_0x8484('0x30')](function(_0x7e48ed){_0x56c141(_0x7e48ed);});}else if(_0x49dfa8){_0x56c141();}else{return _0x115c3c['status'](0x194)[_0x8484('0x2d')]({'message':_0x8484('0x42')});}});};exports[_0x8484('0x43')]=function canUpdate(){return compose()[_0x8484('0x25')](function(_0x14cfb2,_0x47a5fd,_0x425b98){return require(_0x8484('0x44'))[_0x8484('0x45')]()['then'](function(_0xe7070f){if(_0xe7070f['update']){_0x425b98();}else{return _0x47a5fd[_0x8484('0x2b')](0x193)[_0x8484('0x2d')]({'message':_0x8484('0x46')});}})[_0x8484('0x30')](function(_0x45dc12){_0x425b98(_0x45dc12);});});};exports[_0x8484('0x47')]=function(_0x5e1411,_0xb34aac,_0x2a1e8a){_0x5e1411['isMiddleware']=!![];return _0x2a1e8a();};exports[_0x8484('0x48')]=function signToken(_0x229c85){return signJwt(_0x229c85);};exports[_0x8484('0x49')]=function(_0x45966f,_0x4e5bd0){if(!_0x45966f[_0x8484('0x26')]){return _0x4e5bd0[_0x8484('0x2b')](0x194)[_0x8484('0x2d')]({'message':_0x8484('0x4a')});}var _0x483a4e={'payload':{'id':_0x45966f[_0x8484('0x26')]['id'],'role':_0x45966f['user'][_0x8484('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x483a4e)[_0x8484('0x2a')](function(_0x3f36a2){_0x4e5bd0[_0x8484('0x4b')](_0x8484('0x4c'),_0x3f36a2);_0x4e5bd0[_0x8484('0x4d')]('/dashboards/general');})['catch'](function(_0x23aaa0){return _0x4e5bd0[_0x8484('0x2b')](0x1f4)['send'](_0x23aaa0);});};exports[_0x8484('0x4e')]=function(_0x160891){if(_[_0x8484('0x4f')](_0x160891[_0x8484('0x3c')])||_[_0x8484('0x4f')](_0x160891['apiKeyIat'])){return null;}else{return createJwt(_0x160891);}};exports[_0x8484('0x50')]=function(_0x4cff81){_0x4cff81[_0x8484('0x3c')]=generateNonce();_0x4cff81[_0x8484('0x51')]=generateIssuedAt();return createJwt(_0x4cff81);};exports[_0x8484('0x52')]=function(_0x4980bc,_0x4b5dab){var _0x1ce316=_0x4980bc[_0x8484('0x53')][_0x8484('0x3a')];if(_0x1ce316){var _0x1dc2d7={'nonce':_0x4b5dab[_0x8484('0x3c')],'iat':_0x4b5dab[_0x8484('0x51')],'audience':hardwareConf[_0x8484('0x39')](),'issuer':hardwareConf[_0x8484('0x39')]()};return verifyJwt(_0x1ce316,_0x1dc2d7)[_0x8484('0x2a')](function(){return generateApiKey(_0x4b5dab);});}else{throw{'message':_0x8484('0x54')};}};function signJwt(_0x5ca0cd){var _0x4e51da=BPromise['promisify'](jwt[_0x8484('0x55')],{'context':jwt});var _0x4c3d6a=_0x5ca0cd[_0x8484('0x56')]||config[_0x8484('0xa')][_0x8484('0xb')];return new BPromise(function(_0x3c299b,_0x26c1cd){_0x4e51da(_0x5ca0cd[_0x8484('0x57')],_0x4c3d6a,_0x5ca0cd[_0x8484('0x58')])[_0x8484('0x2a')](function(_0x55a8db){_0x3c299b(_0x55a8db);})[_0x8484('0x30')](function(_0x95bbf5){_0x26c1cd(_0x95bbf5);});});}function verifyJwt(_0x106daf,_0x2aa6ee,_0x254cd9){var _0x155c5=BPromise['promisify'](jwt[_0x8484('0x59')],{'context':jwt});var _0x456e26=_0x254cd9||config['secrets']['session'];return new BPromise(function(_0x1e9562,_0x5967bf){_0x155c5(_0x106daf,_0x456e26,_0x2aa6ee)['then'](function(_0x46b3d3){_0x1e9562(_0x46b3d3);})[_0x8484('0x30')](function(_0x5012e9){_0x5967bf(_0x5012e9);});});}function generateNonce(){return crypto[_0x8484('0x5a')](0x10)['toString'](_0x8484('0x5b'));}function generateIssuedAt(){return Math[_0x8484('0x5c')](Date[_0x8484('0x5d')]()/0x3e8)[_0x8484('0x5e')]();}function createJwt(_0x16d248){var _0x5e2dad={'payload':{'iat':_0x16d248[_0x8484('0x51')],'nonce':_0x16d248[_0x8484('0x3c')]},'options':{'algorithm':_0x8484('0x5f'),'subject':_0x16d248['id']['toString'](),'issuer':hardwareConf[_0x8484('0x39')](),'audience':hardwareConf[_0x8484('0x39')]()}};return signJwt(_0x5e2dad)[_0x8484('0x2a')](function(_0x402200){return{'iat':_0x16d248[_0x8484('0x51')],'nonce':_0x16d248['apiKeyNonce'],'token':_0x402200};});} \ No newline at end of file +var _0x62bc=['phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','use','user','ChatInteraction','closed','disposition','then','status','json','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','pass','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','User','sub','isEqual','apiKeyNonce','nonce','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62bc,0x97));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0xc62b('0x0'))['db'];var config=require(_0xc62b('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0xc62b('0x2'));var expressJwt=require(_0xc62b('0x3'));var compose=require(_0xc62b('0x4'));var basicAuth=require(_0xc62b('0x5'));var crypto=require(_0xc62b('0x6'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xc62b('0x7')][_0xc62b('0x8')]});var userAttributes=['id',_0xc62b('0x9'),_0xc62b('0xa'),_0xc62b('0xb'),_0xc62b('0xc'),_0xc62b('0xd'),_0xc62b('0xe'),_0xc62b('0xf'),_0xc62b('0x10'),_0xc62b('0x11'),_0xc62b('0x12'),_0xc62b('0x13'),_0xc62b('0x14'),_0xc62b('0x15'),'openchannelPause','pauseType','showWebBar','lastLoginAt',_0xc62b('0x16'),'crudPermissions',_0xc62b('0x17'),'passwordResetAt',_0xc62b('0x18'),'phoneBarAutoAnswer',_0xc62b('0x19'),_0xc62b('0x1a'),_0xc62b('0x1b'),_0xc62b('0x1c'),_0xc62b('0x1d'),_0xc62b('0x1e'),_0xc62b('0x1f'),_0xc62b('0x20'),_0xc62b('0x21'),_0xc62b('0x22'),_0xc62b('0x23'),'userProfileId'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xc62b('0x24')](function(_0x1d1e56,_0x150d91,_0x2168c9){if(_0x1d1e56[_0xc62b('0x25')]){_0x2168c9();}else{return db[_0xc62b('0x26')]['findOne']({'where':{'id':_0x1d1e56['params']['id']},'attributes':['id',_0xc62b('0x27'),_0xc62b('0x28')],'raw':!![]})[_0xc62b('0x29')](function(_0x5e85ce){if(_0x5e85ce&&_0x5e85ce[_0xc62b('0x27')]){return _0x150d91[_0xc62b('0x2a')](_0x5e85ce[_0xc62b('0x28')]==='unmanaged'?0x195:0x193)[_0xc62b('0x2b')]({'message':_0x5e85ce[_0xc62b('0x28')]===_0xc62b('0x2c')?_0xc62b('0x2d'):_0xc62b('0x2e')});}else{_0x2168c9();}})[_0xc62b('0x2f')](function(_0x21c6ad){_0x2168c9(_0x21c6ad);});}});};exports[_0xc62b('0x30')]=function isAuthenticated(_0x53b9f5){return compose()['use'](function(_0x52fa7a,_0x472c31,_0x140ec5){if(_0x52fa7a[_0xc62b('0x31')][_0xc62b('0x32')]){if(_[_0xc62b('0x33')](_0x52fa7a[_0xc62b('0x31')][_0xc62b('0x32')],_0xc62b('0x34'))){var _0x1dee2e=basicAuth(_0x52fa7a);db['User'][_0xc62b('0x35')]({'where':{'name':_0x1dee2e[_0xc62b('0xb')]}})[_0xc62b('0x29')](function(_0x2f6077){if(!_0x2f6077||!_0x2f6077['authenticate'](_0x1dee2e[_0xc62b('0x36')])){return _0x472c31[_0xc62b('0x2a')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x52fa7a[_0xc62b('0x25')]={'id':_0x2f6077['id']};_0x140ec5();})[_0xc62b('0x2f')](function(_0x4da4bf){_0x140ec5(_0x4da4bf);});}else if(_['startsWith'](_0x52fa7a[_0xc62b('0x31')]['authorization'],_0xc62b('0x37'))){validateJwt(_0x52fa7a,_0x472c31,_0x140ec5);}else{if(_0x53b9f5){_0x140ec5();}else{return _0x472c31[_0xc62b('0x2a')](0x193)[_0xc62b('0x2b')]({'message':_0xc62b('0x38')});}}}else if(_0x52fa7a['query'][_0xc62b('0x39')]){try{var _0x163d63={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xc62b('0x3a')]()};verifyJwt(_0x52fa7a[_0xc62b('0x3b')][_0xc62b('0x39')],_0x163d63)[_0xc62b('0x29')](function(_0x46b0ac){return db[_0xc62b('0x3c')][_0xc62b('0x35')]({'where':{'id':_0x46b0ac[_0xc62b('0x3d')]}})[_0xc62b('0x29')](function(_0x230cd6){if(!_0x230cd6||!_[_0xc62b('0x3e')](_0x230cd6[_0xc62b('0x3f')],_0x46b0ac[_0xc62b('0x40')])){return _0x472c31['status'](0x191)[_0xc62b('0x2b')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x52fa7a[_0xc62b('0x25')]={'id':_0x230cd6['id']};_0x140ec5();});})[_0xc62b('0x2f')](function(){return _0x472c31[_0xc62b('0x2a')](0x191)[_0xc62b('0x2b')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1c794d){_0x140ec5(_0x1c794d);}}else if(_0x53b9f5){_0x140ec5();}else{return _0x472c31[_0xc62b('0x2a')](0x193)[_0xc62b('0x2b')]({'message':_0xc62b('0x38')});}})[_0xc62b('0x24')](function(_0x375ed2,_0x235ece,_0x14a637){if(_0x375ed2[_0xc62b('0x25')]){db[_0xc62b('0x3c')][_0xc62b('0x35')]({'where':{'id':_0x375ed2[_0xc62b('0x25')]['id']},'attributes':userAttributes})[_0xc62b('0x29')](function(_0x1251ff){if(!_0x1251ff){return _0x235ece[_0xc62b('0x2a')](0x194)[_0xc62b('0x2b')]({'message':_0xc62b('0x41')});}_0x375ed2[_0xc62b('0x25')]=_0x1251ff;_0x14a637();})[_0xc62b('0x2f')](function(_0x2d6756){_0x14a637(_0x2d6756);});}else if(_0x53b9f5){_0x14a637();}else{return _0x235ece[_0xc62b('0x2a')](0x194)[_0xc62b('0x2b')]({'message':_0xc62b('0x42')});}});};exports[_0xc62b('0x43')]=function canUpdate(){return compose()[_0xc62b('0x24')](function(_0x476193,_0x3fe08c,_0xea115c){return require(_0xc62b('0x44'))[_0xc62b('0x45')]()[_0xc62b('0x29')](function(_0x34a595){if(_0x34a595['update']){_0xea115c();}else{return _0x3fe08c[_0xc62b('0x2a')](0x193)[_0xc62b('0x2b')]({'message':_0xc62b('0x46')});}})[_0xc62b('0x2f')](function(_0x25bc1d){_0xea115c(_0x25bc1d);});});};exports[_0xc62b('0x47')]=function(_0x39fb39,_0x5bbaf6,_0x3b0d6a){_0x39fb39['isMiddleware']=!![];return _0x3b0d6a();};exports[_0xc62b('0x48')]=function signToken(_0x1347c1){return signJwt(_0x1347c1);};exports[_0xc62b('0x49')]=function(_0x565ec6,_0x3f4531){if(!_0x565ec6[_0xc62b('0x25')]){return _0x3f4531['status'](0x194)[_0xc62b('0x2b')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x388674={'payload':{'id':_0x565ec6[_0xc62b('0x25')]['id'],'role':_0x565ec6['user'][_0xc62b('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x388674)[_0xc62b('0x29')](function(_0x22f883){_0x3f4531['cookie'](_0xc62b('0x4a'),_0x22f883);_0x3f4531[_0xc62b('0x4b')](_0xc62b('0x4c'));})[_0xc62b('0x2f')](function(_0x324c1c){return _0x3f4531[_0xc62b('0x2a')](0x1f4)[_0xc62b('0x4d')](_0x324c1c);});};exports[_0xc62b('0x4e')]=function(_0x34eff6){if(_[_0xc62b('0x4f')](_0x34eff6[_0xc62b('0x3f')])||_['isNil'](_0x34eff6[_0xc62b('0x50')])){return null;}else{return createJwt(_0x34eff6);}};exports[_0xc62b('0x51')]=function(_0x2047d8){_0x2047d8[_0xc62b('0x3f')]=generateNonce();_0x2047d8[_0xc62b('0x50')]=generateIssuedAt();return createJwt(_0x2047d8);};exports[_0xc62b('0x52')]=function(_0x14c2ca,_0x13122c){var _0x36376f=_0x14c2ca[_0xc62b('0x3b')][_0xc62b('0x39')];if(_0x36376f){var _0x4176df={'nonce':_0x13122c[_0xc62b('0x3f')],'iat':_0x13122c[_0xc62b('0x50')],'audience':hardwareConf[_0xc62b('0x3a')](),'issuer':hardwareConf[_0xc62b('0x3a')]()};return verifyJwt(_0x36376f,_0x4176df)[_0xc62b('0x29')](function(){return generateApiKey(_0x13122c);});}else{throw{'message':_0xc62b('0x53')};}};function signJwt(_0x4a0e2b){var _0x35f7d1=BPromise[_0xc62b('0x54')](jwt['sign'],{'context':jwt});var _0x349d64=_0x4a0e2b['secret']||config[_0xc62b('0x7')][_0xc62b('0x8')];return new BPromise(function(_0x22647c,_0x184a73){_0x35f7d1(_0x4a0e2b['payload'],_0x349d64,_0x4a0e2b[_0xc62b('0x55')])[_0xc62b('0x29')](function(_0x4b4828){_0x22647c(_0x4b4828);})['catch'](function(_0x124b19){_0x184a73(_0x124b19);});});}function verifyJwt(_0x2c45c5,_0x252289,_0x51c319){var _0x4b7fc1=BPromise['promisify'](jwt[_0xc62b('0x56')],{'context':jwt});var _0x3fe965=_0x51c319||config[_0xc62b('0x7')][_0xc62b('0x8')];return new BPromise(function(_0x1df6bd,_0x150c81){_0x4b7fc1(_0x2c45c5,_0x3fe965,_0x252289)['then'](function(_0x325c67){_0x1df6bd(_0x325c67);})[_0xc62b('0x2f')](function(_0x4cafa7){_0x150c81(_0x4cafa7);});});}function generateNonce(){return crypto[_0xc62b('0x57')](0x10)[_0xc62b('0x58')](_0xc62b('0x59'));}function generateIssuedAt(){return Math['floor'](Date[_0xc62b('0x5a')]()/0x3e8)[_0xc62b('0x58')]();}function createJwt(_0x2062c0){var _0x1b26b0={'payload':{'iat':_0x2062c0['apiKeyIat'],'nonce':_0x2062c0[_0xc62b('0x3f')]},'options':{'algorithm':'HS512','subject':_0x2062c0['id'][_0xc62b('0x58')](),'issuer':hardwareConf[_0xc62b('0x3a')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1b26b0)[_0xc62b('0x29')](function(_0x32fd65){return{'iat':_0x2062c0[_0xc62b('0x50')],'nonce':_0x2062c0[_0xc62b('0x3f')],'token':_0x32fd65};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 30b6f9b..1018a67 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 _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x102bb2,_0x20156e){var _0x30c5d8=function(_0x1d9020){while(--_0x1d9020){_0x102bb2['push'](_0x102bb2['shift']());}};_0x30c5d8(++_0x20156e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xcb91[_0x4ec9e3];return _0x2883ce;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file +var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x341c0d,_0x28e50d){var _0x30d1ac=function(_0x4f08bd){while(--_0x4f08bd){_0x341c0d['push'](_0x341c0d['shift']());}};_0x30d1ac(++_0x28e50d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 04e527b..37178ec 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 _0xb903=['each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','inspect','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','query','sequelize','QueryTypes','num','Empty','push','format','SELECT','dirname','basename','length','existsSync','join'];(function(_0x4e9bbb,_0x154ab9){var _0x4e0bff=function(_0x351e57){while(--_0x351e57){_0x4e9bbb['push'](_0x4e9bbb['shift']());}};_0x4e0bff(++_0x154ab9);}(_0xb903,0x185));var _0x3b90=function(_0xeed714,_0x264da0){_0xeed714=_0xeed714-0x0;var _0x2b1eb3=_0xb903[_0xeed714];return _0x2b1eb3;};'use strict';var util=require(_0x3b90('0x0'));var path=require(_0x3b90('0x1'));var _=require(_0x3b90('0x2'));var csv=require(_0x3b90('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3b90('0x4'));var rimraf=require(_0x3b90('0x5'));var db=require(_0x3b90('0x6'))['db'];var dbH=require(_0x3b90('0x6'))[_0x3b90('0x7')];var logger=require(_0x3b90('0x8'))(_0x3b90('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3b90('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x55792c,_0x153283){var _0x2e4c06={'status':_0x55792c};var _0x42efe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x153283){_0x2e4c06[_0x3b90('0xb')]=_0x153283;}return db['AnalyticExtractedReport']['update'](_0x2e4c06,_0x42efe8);}function main(){var _0x52401e=0x1388;var _0x51f916;logger['info'](util['format'](_0x3b90('0xc'),EXTRACTED_REPORT_ID,_0x3b90('0xd')));return db['Setting'][_0x3b90('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3b90('0xf'),'splitSizeCsv']})[_0x3b90('0x10')](function(_0x174c0d){if(_0x174c0d){_0x51f916=_0x174c0d;_0x52401e=_0x51f916[_0x3b90('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x3b90('0x12')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')]['SELECT']});})['then'](function(_0x3725b9){if(!_0x3725b9[0x0][_0x3b90('0x15')]){return analyticExtractedReport(_0x3b90('0x16'));}var _0x1af265=[];var _0x1efe01=0x0;var _0x529421=!![];if(_0x3725b9&&_0x3725b9['length']){var _0xd83280=_0x3725b9[0x0][_0x3b90('0x15')]%(_0x1efe01+_0x52401e);if(_0x51f916['split']){for(;_0x529421;_0x1efe01+=_0x52401e,_0xd83280=_0x3725b9[0x0][_0x3b90('0x15')]%(_0x1efe01+_0x52401e)){if(_0xd83280==0x0||_0xd83280==_0x3725b9[0x0][_0x3b90('0x15')]){_0x529421=![];}_0x1af265[_0x3b90('0x17')](dbH[_0x3b90('0x13')]['query'](util[_0x3b90('0x18')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52401e,_0x1efe01),{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')]['SELECT']}));}}else{_0x1af265[_0x3b90('0x17')](dbH[_0x3b90('0x13')][_0x3b90('0x12')](QUERY,{'type':dbH[_0x3b90('0x13')][_0x3b90('0x14')][_0x3b90('0x19')]}));}}var _0x3bc7d5=path[_0x3b90('0x1a')](PATH);var _0xa98414=path[_0x3b90('0x1b')](PATH,'.csv');var _0x20b06a=_0x51f916[_0x3b90('0xf')]&&_0x1af265[_0x3b90('0x1c')]>0x1;var _0x7faee=[];if(!fs[_0x3b90('0x1d')](path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414))&&_0x20b06a){fs['mkdirSync'](path['join'](_0x3bc7d5,_0xa98414));}return BPromise[_0x3b90('0x1f')](_0x1af265,function(_0x29d472){_0x7faee[_0x3b90('0x17')](_0x29d472);})[_0x3b90('0x10')](function(){for(var _0x583523=0x0;_0x583523<_0x7faee[_0x3b90('0x1c')];_0x583523+=0x1){var _0x2936d7;var _0x1787d1=_0x7faee[_0x583523];if(_0x20b06a){_0x2936d7=path['join'](_0x3bc7d5,_0xa98414,util[_0x3b90('0x18')](_0x3b90('0x20'),_0xa98414,_0x583523,_0x3b90('0x21')));}else{_0x2936d7=path[_0x3b90('0x1e')](_0x3bc7d5,util[_0x3b90('0x18')](_0x3b90('0x22'),_0xa98414,'csv'));}fs[_0x3b90('0x23')](_0x2936d7,csv(_0x1787d1));}})['then'](function(){if(_0x20b06a){zipdir(path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414),{'saveTo':path[_0x3b90('0x1e')](_0x3bc7d5,util[_0x3b90('0x18')](_0x3b90('0x22'),_0xa98414,_0x3b90('0x24')))},function(_0x6704f,_0x290283){});rimraf(path[_0x3b90('0x1e')](_0x3bc7d5,_0xa98414),function(){});}})['then'](function(){logger['info'](util[_0x3b90('0x18')](_0x3b90('0x25'),EXTRACTED_REPORT_ID,_0x3b90('0xd')));return analyticExtractedReport(_0x3b90('0x26'),_0x20b06a?util['format']('%s.%s',_0xa98414,_0x20b06a?_0x3b90('0x24'):_0x3b90('0x21')):null);});})[_0x3b90('0x27')](function(_0x4f3ab5){logger[_0x3b90('0x28')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3b90('0xd')),util[_0x3b90('0x29')](_0x4f3ab5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x9bde=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','path','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','push'];(function(_0x24482d,_0x3a5def){var _0x7ce70=function(_0x21fe28){while(--_0x21fe28){_0x24482d['push'](_0x24482d['shift']());}};_0x7ce70(++_0x3a5def);}(_0x9bde,0xe1));var _0xe9bd=function(_0x581bf7,_0x23b1fd){_0x581bf7=_0x581bf7-0x0;var _0x39df6b=_0x9bde[_0x581bf7];return _0x39df6b;};'use strict';var util=require('util');var path=require(_0xe9bd('0x0'));var _=require('lodash');var csv=require(_0xe9bd('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe9bd('0x2'));var rimraf=require(_0xe9bd('0x3'));var db=require(_0xe9bd('0x4'))['db'];var dbH=require(_0xe9bd('0x4'))[_0xe9bd('0x5')];var logger=require(_0xe9bd('0x6'))(_0xe9bd('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe9bd('0x8')][0x3];var PATH=process[_0xe9bd('0x8')][0x4];function analyticExtractedReport(_0x22a438,_0xa66ae2){var _0x2d5c75={'status':_0x22a438};var _0x3ef9e3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa66ae2){_0x2d5c75[_0xe9bd('0x9')]=_0xa66ae2;}return db[_0xe9bd('0xa')][_0xe9bd('0xb')](_0x2d5c75,_0x3ef9e3);}function main(){var _0x45c7ba=0x1388;var _0x581602;logger['info'](util[_0xe9bd('0xc')](_0xe9bd('0xd'),EXTRACTED_REPORT_ID,_0xe9bd('0xe')));return db['Setting'][_0xe9bd('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe9bd('0x10'),_0xe9bd('0x11')]})[_0xe9bd('0x12')](function(_0x5e022a){if(_0x5e022a){_0x581602=_0x5e022a;_0x45c7ba=_0x581602[_0xe9bd('0x11')]||0x1388;}})['then'](function(){return dbH[_0xe9bd('0x13')][_0xe9bd('0x14')](util[_0xe9bd('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xe9bd('0x15')][_0xe9bd('0x16')]});})[_0xe9bd('0x12')](function(_0x46a59b){if(!_0x46a59b[0x0][_0xe9bd('0x17')]){return analyticExtractedReport(_0xe9bd('0x18'));}var _0x45a9f2=[];var _0x573350=0x0;var _0x1d11a0=!![];if(_0x46a59b&&_0x46a59b[_0xe9bd('0x19')]){var _0x160281=_0x46a59b[0x0]['num']%(_0x573350+_0x45c7ba);if(_0x581602[_0xe9bd('0x10')]){for(;_0x1d11a0;_0x573350+=_0x45c7ba,_0x160281=_0x46a59b[0x0][_0xe9bd('0x17')]%(_0x573350+_0x45c7ba)){if(_0x160281==0x0||_0x160281==_0x46a59b[0x0][_0xe9bd('0x17')]){_0x1d11a0=![];}_0x45a9f2[_0xe9bd('0x1a')](dbH['sequelize'][_0xe9bd('0x14')](util['format'](_0xe9bd('0x1b'),QUERY,_0x45c7ba,_0x573350),{'type':dbH['sequelize'][_0xe9bd('0x15')][_0xe9bd('0x16')]}));}}else{_0x45a9f2[_0xe9bd('0x1a')](dbH[_0xe9bd('0x13')][_0xe9bd('0x14')](QUERY,{'type':dbH[_0xe9bd('0x13')][_0xe9bd('0x15')]['SELECT']}));}}var _0x133318=path[_0xe9bd('0x1c')](PATH);var _0x4ecaf5=path[_0xe9bd('0x1d')](PATH,'.csv');var _0x238ab1=_0x581602[_0xe9bd('0x10')]&&_0x45a9f2[_0xe9bd('0x19')]>0x1;var _0xf02209=[];if(!fs['existsSync'](path[_0xe9bd('0x1e')](_0x133318,_0x4ecaf5))&&_0x238ab1){fs[_0xe9bd('0x1f')](path[_0xe9bd('0x1e')](_0x133318,_0x4ecaf5));}return BPromise[_0xe9bd('0x20')](_0x45a9f2,function(_0x2641be){_0xf02209[_0xe9bd('0x1a')](_0x2641be);})[_0xe9bd('0x12')](function(){for(var _0x43ea90=0x0;_0x43ea90<_0xf02209[_0xe9bd('0x19')];_0x43ea90+=0x1){var _0x5987af;var _0x3c211a=_0xf02209[_0x43ea90];if(_0x238ab1){_0x5987af=path[_0xe9bd('0x1e')](_0x133318,_0x4ecaf5,util['format'](_0xe9bd('0x21'),_0x4ecaf5,_0x43ea90,_0xe9bd('0x22')));}else{_0x5987af=path[_0xe9bd('0x1e')](_0x133318,util[_0xe9bd('0xc')](_0xe9bd('0x23'),_0x4ecaf5,_0xe9bd('0x22')));}fs['writeFileSync'](_0x5987af,csv(_0x3c211a));}})['then'](function(){if(_0x238ab1){zipdir(path[_0xe9bd('0x1e')](_0x133318,_0x4ecaf5),{'saveTo':path['join'](_0x133318,util[_0xe9bd('0xc')](_0xe9bd('0x23'),_0x4ecaf5,_0xe9bd('0x24')))},function(_0x36aa80,_0x4057df){});rimraf(path['join'](_0x133318,_0x4ecaf5),function(){});}})['then'](function(){logger[_0xe9bd('0x25')](util[_0xe9bd('0xc')](_0xe9bd('0x26'),EXTRACTED_REPORT_ID,_0xe9bd('0xe')));return analyticExtractedReport(_0xe9bd('0x27'),_0x238ab1?util[_0xe9bd('0xc')](_0xe9bd('0x23'),_0x4ecaf5,_0x238ab1?_0xe9bd('0x24'):_0xe9bd('0x22')):null);});})['catch'](function(_0x426004){logger[_0xe9bd('0x25')](util[_0xe9bd('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0xe9bd('0x28')](_0x426004,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe9bd('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e2c6ccd..879a0c7 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x326af7,_0x2c07b9){var _0x551049=function(_0x24cdab){while(--_0x24cdab){_0x326af7['push'](_0x326af7['shift']());}};_0x551049(++_0x2c07b9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x383953,_0x434542){var _0x5cfddd=function(_0x1dcee6){while(--_0x1dcee6){_0x383953['push'](_0x383953['shift']());}};_0x5cfddd(++_0x434542);}(_0xb10b,0x12a));var _0xbb10=function(_0xf1bf12,_0x4558e4){_0xf1bf12=_0xf1bf12-0x0;var _0x340ce8=_0xb10b[_0xf1bf12];return _0x340ce8;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b52ccc1..70b7229 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 _0x032e=['basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push'];(function(_0x5b9a7c,_0x10ecb2){var _0x281ca8=function(_0x565bf1){while(--_0x565bf1){_0x5b9a7c['push'](_0x5b9a7c['shift']());}};_0x281ca8(++_0x10ecb2);}(_0x032e,0x6d));var _0xe032=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x032e[_0x24237f];return _0x48298e;};'use strict';var util=require('util');var path=require('path');var _=require(_0xe032('0x0'));var fs=require('fs');var json2xls=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var zipdir=require(_0xe032('0x3'));var rimraf=require(_0xe032('0x4'));var db=require(_0xe032('0x5'))['db'];var dbH=require(_0xe032('0x5'))[_0xe032('0x6')];var logger=require('../../config/logger')(_0xe032('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xe032('0x8')][0x2]);var QUERY=process[_0xe032('0x8')][0x3];var PATH=process[_0xe032('0x8')][0x4];function analyticExtractedReport(_0x2ee0a6,_0x333b82){var _0x2d70fa={'status':_0x2ee0a6};var _0x341efc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x333b82){_0x2d70fa[_0xe032('0x9')]=_0x333b82;}return db[_0xe032('0xa')]['update'](_0x2d70fa,_0x341efc);}function main(){var _0x552d43=0x1388;var _0x4205a2;logger[_0xe032('0xb')](util['format'](_0xe032('0xc'),EXTRACTED_REPORT_ID,_0xe032('0xd')));return db['Setting'][_0xe032('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe032('0xf'),'splitSizeXlsx']})['then'](function(_0x4309e7){if(_0x4309e7){_0x4205a2=_0x4309e7;_0x552d43=_0x4205a2[_0xe032('0x10')]||0x1388;}})[_0xe032('0x11')](function(){return dbH[_0xe032('0x12')][_0xe032('0x13')](util[_0xe032('0x14')](_0xe032('0x15'),QUERY),{'type':dbH[_0xe032('0x12')][_0xe032('0x16')][_0xe032('0x17')]});})['then'](function(_0x372365){if(!_0x372365[0x0]['num']){return analyticExtractedReport(_0xe032('0x18'));}var _0x3ca0dd=[];var _0x281579=0x0;var _0x172a40=!![];if(_0x4205a2['split']){if(_0x372365&&_0x372365[_0xe032('0x19')]){var _0x5f2ea1=_0x372365[0x0][_0xe032('0x1a')]%(_0x281579+_0x552d43);for(;_0x172a40;_0x281579+=_0x552d43,_0x5f2ea1=_0x372365[0x0][_0xe032('0x1a')]%(_0x281579+_0x552d43)){if(_0x5f2ea1==0x0||_0x5f2ea1==_0x372365[0x0][_0xe032('0x1a')]){_0x172a40=![];}_0x3ca0dd['push'](dbH[_0xe032('0x12')][_0xe032('0x13')](util[_0xe032('0x14')](_0xe032('0x1b'),QUERY,_0x552d43,_0x281579),{'type':dbH[_0xe032('0x12')]['QueryTypes'][_0xe032('0x17')]}));}}}else{_0x3ca0dd[_0xe032('0x1c')](dbH['sequelize'][_0xe032('0x13')](QUERY,{'type':dbH[_0xe032('0x12')][_0xe032('0x16')][_0xe032('0x17')]}));}var _0x249f99=path['dirname'](PATH);var _0x34c0d1=path[_0xe032('0x1d')](PATH,_0xe032('0x1e'));var _0x455e55=_0x4205a2['split']&&_0x3ca0dd[_0xe032('0x19')]>0x1;var _0x1419d9=[];if(!fs[_0xe032('0x1f')](path[_0xe032('0x20')](_0x249f99,_0x34c0d1))&&_0x455e55){fs[_0xe032('0x21')](path['join'](_0x249f99,_0x34c0d1));}return BPromise[_0xe032('0x22')](_0x3ca0dd,function(_0x1610ef){_0x1419d9[_0xe032('0x1c')](_0x1610ef);})[_0xe032('0x11')](function(){for(var _0x387c16=0x0;_0x387c16<_0x1419d9[_0xe032('0x19')];_0x387c16+=0x1){var _0x45813c;var _0x1fcce7=_0x1419d9[_0x387c16];if(_0x455e55){_0x45813c=path['join'](_0x249f99,_0x34c0d1,util[_0xe032('0x14')]('%s%d.%s',_0x34c0d1,_0x387c16,_0xe032('0x23')));}else{_0x45813c=path[_0xe032('0x20')](_0x249f99,util[_0xe032('0x14')](_0xe032('0x24'),_0x34c0d1,_0xe032('0x23')));}fs[_0xe032('0x25')](_0x45813c,json2xls(_0x1fcce7),_0xe032('0x26'));}})[_0xe032('0x11')](function(){if(_0x455e55){zipdir(path['join'](_0x249f99,_0x34c0d1),{'saveTo':path[_0xe032('0x20')](_0x249f99,util['format'](_0xe032('0x24'),_0x34c0d1,'zip'))},function(_0x24acba,_0x42ce60){});rimraf(path[_0xe032('0x20')](_0x249f99,_0x34c0d1),function(){});}})[_0xe032('0x11')](function(){logger[_0xe032('0xb')](util[_0xe032('0x14')](_0xe032('0x27'),EXTRACTED_REPORT_ID,_0xe032('0xd')));return analyticExtractedReport(_0xe032('0x28'),_0x455e55?util['format'](_0xe032('0x24'),_0x34c0d1,_0x455e55?_0xe032('0x29'):_0xe032('0x23')):null);});})[_0xe032('0x2a')](function(_0xd54b66){logger[_0xe032('0xb')](util[_0xe032('0x14')](_0xe032('0x2b'),EXTRACTED_REPORT_ID,_0xe032('0xd')),util[_0xe032('0x2c')](_0xd54b66,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe032('0x2d'));});}main(); \ No newline at end of file +var _0xafdb=['catch','inspect','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','then','sequelize','query','format','QueryTypes','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed'];(function(_0x58bec1,_0x42c53f){var _0x16439f=function(_0x19b7ec){while(--_0x19b7ec){_0x58bec1['push'](_0x58bec1['shift']());}};_0x16439f(++_0x42c53f);}(_0xafdb,0xae));var _0xbafd=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xafdb[_0x29d6e6];return _0xc75ff0;};'use strict';var util=require(_0xbafd('0x0'));var path=require(_0xbafd('0x1'));var _=require(_0xbafd('0x2'));var fs=require('fs');var json2xls=require(_0xbafd('0x3'));var BPromise=require(_0xbafd('0x4'));var zipdir=require(_0xbafd('0x5'));var rimraf=require('rimraf');var db=require(_0xbafd('0x6'))['db'];var dbH=require(_0xbafd('0x6'))[_0xbafd('0x7')];var logger=require(_0xbafd('0x8'))(_0xbafd('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbafd('0xa')][0x3];var PATH=process[_0xbafd('0xa')][0x4];function analyticExtractedReport(_0x19adf0,_0x26ff99){var _0x4b9282={'status':_0x19adf0};var _0xb93bf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26ff99){_0x4b9282[_0xbafd('0xb')]=_0x26ff99;}return db['AnalyticExtractedReport'][_0xbafd('0xc')](_0x4b9282,_0xb93bf);}function main(){var _0x1022ec=0x1388;var _0x4a958e;logger[_0xbafd('0xd')](util['format'](_0xbafd('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xbafd('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbafd('0x10'),'splitSizeXlsx']})[_0xbafd('0x11')](function(_0x15104e){if(_0x15104e){_0x4a958e=_0x15104e;_0x1022ec=_0x4a958e['splitSizeXlsx']||0x1388;}})[_0xbafd('0x11')](function(){return dbH[_0xbafd('0x12')][_0xbafd('0x13')](util[_0xbafd('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xbafd('0x15')]['SELECT']});})[_0xbafd('0x11')](function(_0x129037){if(!_0x129037[0x0][_0xbafd('0x16')]){return analyticExtractedReport(_0xbafd('0x17'));}var _0x469ada=[];var _0xd6194f=0x0;var _0xea1c32=!![];if(_0x4a958e[_0xbafd('0x10')]){if(_0x129037&&_0x129037[_0xbafd('0x18')]){var _0x1798d8=_0x129037[0x0][_0xbafd('0x16')]%(_0xd6194f+_0x1022ec);for(;_0xea1c32;_0xd6194f+=_0x1022ec,_0x1798d8=_0x129037[0x0]['num']%(_0xd6194f+_0x1022ec)){if(_0x1798d8==0x0||_0x1798d8==_0x129037[0x0][_0xbafd('0x16')]){_0xea1c32=![];}_0x469ada['push'](dbH[_0xbafd('0x12')]['query'](util['format'](_0xbafd('0x19'),QUERY,_0x1022ec,_0xd6194f),{'type':dbH[_0xbafd('0x12')][_0xbafd('0x15')][_0xbafd('0x1a')]}));}}}else{_0x469ada[_0xbafd('0x1b')](dbH[_0xbafd('0x12')][_0xbafd('0x13')](QUERY,{'type':dbH[_0xbafd('0x12')][_0xbafd('0x15')][_0xbafd('0x1a')]}));}var _0x1869c5=path[_0xbafd('0x1c')](PATH);var _0x3b54f3=path['basename'](PATH,_0xbafd('0x1d'));var _0x24f000=_0x4a958e[_0xbafd('0x10')]&&_0x469ada[_0xbafd('0x18')]>0x1;var _0x16aa8f=[];if(!fs[_0xbafd('0x1e')](path[_0xbafd('0x1f')](_0x1869c5,_0x3b54f3))&&_0x24f000){fs['mkdirSync'](path[_0xbafd('0x1f')](_0x1869c5,_0x3b54f3));}return BPromise[_0xbafd('0x20')](_0x469ada,function(_0x3870a7){_0x16aa8f['push'](_0x3870a7);})[_0xbafd('0x11')](function(){for(var _0xeed692=0x0;_0xeed692<_0x16aa8f['length'];_0xeed692+=0x1){var _0x5329f6;var _0x4e4f46=_0x16aa8f[_0xeed692];if(_0x24f000){_0x5329f6=path[_0xbafd('0x1f')](_0x1869c5,_0x3b54f3,util[_0xbafd('0x14')](_0xbafd('0x21'),_0x3b54f3,_0xeed692,_0xbafd('0x22')));}else{_0x5329f6=path['join'](_0x1869c5,util['format'](_0xbafd('0x23'),_0x3b54f3,_0xbafd('0x22')));}fs[_0xbafd('0x24')](_0x5329f6,json2xls(_0x4e4f46),'binary');}})[_0xbafd('0x11')](function(){if(_0x24f000){zipdir(path[_0xbafd('0x1f')](_0x1869c5,_0x3b54f3),{'saveTo':path[_0xbafd('0x1f')](_0x1869c5,util['format'](_0xbafd('0x23'),_0x3b54f3,_0xbafd('0x25')))},function(_0x419821,_0x1d86cd){});rimraf(path[_0xbafd('0x1f')](_0x1869c5,_0x3b54f3),function(){});}})['then'](function(){logger[_0xbafd('0xd')](util['format'](_0xbafd('0x26'),EXTRACTED_REPORT_ID,_0xbafd('0x27')));return analyticExtractedReport(_0xbafd('0x28'),_0x24f000?util[_0xbafd('0x14')](_0xbafd('0x23'),_0x3b54f3,_0x24f000?_0xbafd('0x25'):_0xbafd('0x22')):null);});})[_0xbafd('0x29')](function(_0x5dbab6){logger[_0xbafd('0xd')](util[_0xbafd('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbafd('0x27')),util[_0xbafd('0x2a')](_0x5dbab6,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d185371..199b6dc 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 _0xfa20=['${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','hasOwnProperty','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','extensions','extension','find','push','type','Set','CDR(type)=%s','context','priority','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xfa20,0x141));var _0x0fa2=function(_0x515cc0,_0x248d5c){_0x515cc0=_0x515cc0-0x0;var _0x59e40e=_0xfa20[_0x515cc0];return _0x59e40e;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));function rewrite(_0xe7fb6a,_0x105015){var _0x22096a=this;return _0xe7fb6a[_0x0fa2('0x2')][_0x0fa2('0x3')][_0x0fa2('0x4')]({'raw':!![]})[_0x0fa2('0x5')](function(_0x30f4e1){_0x22096a[_0x0fa2('0x6')]=_0x30f4e1;return _0xe7fb6a['models'][_0x0fa2('0x7')][_0x0fa2('0x4')]({'where':{'IntervalId':_0x105015['IntervalId']},'raw':!![]});})[_0x0fa2('0x5')](function(_0x3fde44){return _0xe7fb6a[_0x0fa2('0x2')][_0x0fa2('0x7')][_0x0fa2('0x4')]({'where':{'exten':{'$in':_[_0x0fa2('0x8')](_[_0x0fa2('0x9')](_0x3fde44,_0x0fa2('0xa')))}},'order':[{'raw':_0x0fa2('0xb')}],'raw':!![]});})[_0x0fa2('0x5')](function(_0x5c59dc){var _0xd34dd5=_[_0x0fa2('0xc')](_0x5c59dc,{'priority':'1'});var _0x4469e0=_[_0x0fa2('0xc')](_0x5c59dc,{'isApp':0x1});var _0x46c980=_[_0x0fa2('0xd')](_0x4469e0,_0x0fa2('0xa'));var _0x15a25c=['queue',_0x0fa2('0xe')];var _0x5bdd10=[];var _0x1a4ff1=[];for(var _0x51b0c8 in _0x46c980){if(_0x46c980['hasOwnProperty'](_0x51b0c8)){_0x22096a['priority']=0x2;_0x22096a[_0x0fa2('0xf')]=[];_0x22096a[_0x0fa2('0x10')]=_[_0x0fa2('0x11')](_0xd34dd5,{'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')]});_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':util['format'](_0x0fa2('0x15'),_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')]),'context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});if(_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')]===_0x0fa2('0x19')){if(_0x22096a[_0x0fa2('0x10')]){_0x22096a[_0x0fa2('0xf')]['push']({'type':_0x46c980[_0x51b0c8][0x0]['type'],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x1a')+(_0x22096a['extension'][_0x0fa2('0x1b')]?_0x0fa2('0x1c')+_0x22096a[_0x0fa2('0x10')]['cutdigits']+'}':_0x0fa2('0x1d')),'context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0]['exten'],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId']});}_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x1e')+_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId'],'context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});var _0x16b313=_0x22096a[_0x0fa2('0x17')]++;_0x22096a[_0x0fa2('0xf')]['push']({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':'ExecIf','appdata':_0x0fa2('0x1f')+(_0x16b313+0x2)+'):Goto('+(_0x16b313+0x1)+')','context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x16b313,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});if(_0x22096a[_0x0fa2('0x10')]){_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0]['type'],'app':_0x0fa2('0x14'),'appdata':_0x22096a['extension']['cutdigits']?_0x0fa2('0x20')+_0x22096a[_0x0fa2('0x10')][_0x0fa2('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x46c980[_0x51b0c8][0x0]['context'],'exten':_0x46c980[_0x51b0c8][0x0]['exten'],'priority':_0x22096a['priority']++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId']});}_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':'outboundrouteid='+_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId'],'context':_0x46c980[_0x51b0c8][0x0]['context'],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a['priority']++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});if(_0x22096a[_0x0fa2('0x10')]&&_0x22096a[_0x0fa2('0x10')]['hasOwnProperty']('recordingFormat')&&_0x22096a[_0x0fa2('0x10')][_0x0fa2('0x21')]!==_0x0fa2('0x22')){_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x23'),'context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x24')+_0x22096a[_0x0fa2('0x10')]['recordingFormat']||'wav','context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});}}_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0]['type'],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x25'),'context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId']});_0x22096a[_0x0fa2('0xf')][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0]['type'],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x26'),'context':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x16')],'exten':_0x46c980[_0x51b0c8][0x0]['exten'],'priority':_0x22096a['priority']++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId']});_0x22096a['extensions'][_0x0fa2('0x12')]({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x46c980[_0x51b0c8][0x0]['context'],'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'priority':_0x22096a[_0x0fa2('0x17')]++,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});for(var _0x54a946=0x0,_0x233700=0x0;_0x54a946<_0x46c980[_0x51b0c8][_0x0fa2('0x27')];_0x54a946+=0x1,_0x233700=0x0){var _0x16210b=_0x46c980[_0x51b0c8][_0x54a946];if(_0x16210b['type']){_0x16210b[_0x0fa2('0x13')]=_0x16210b['type'][_0x0fa2('0x28')]();}var _0x5c4324=[];var _0x580878=[];delete _0x16210b['id'];delete _0x16210b[_0x0fa2('0x29')];delete _0x16210b[_0x0fa2('0x2a')];var _0x16815c=_0x16210b[_0x0fa2('0x2b')]!=='*,*,*,*'?[_0x16210b['interval']]:_0x16210b[_0x0fa2('0x2c')]?_['map'](_[_0x0fa2('0xc')](_0x22096a[_0x0fa2('0x6')],{'IntervalId':_0x16210b['IntervalId']}),_0x0fa2('0x2b')):[];if(_0x16210b[_0x0fa2('0x2d')](_0x0fa2('0x2e'))){if(_0x16210b[_0x0fa2('0x2e')]&&_0x16210b['tag']!=='--'){_0x5c4324['push']({'type':_0x16210b[_0x0fa2('0x13')],'app':'Set','appdata':_0x0fa2('0x2f')+_0x16210b[_0x0fa2('0x2e')],'context':_0x16210b[_0x0fa2('0x16')],'exten':_0x16210b['exten'],'priority':_0x16815c[_0x0fa2('0x27')]+_0x22096a[_0x0fa2('0x17')]+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});}}if(_0x16210b[_0x0fa2('0x13')]===_0x0fa2('0x19')&&_0x16210b[_0x0fa2('0x2d')](_0x0fa2('0x30'))){if(_0x16210b[_0x0fa2('0x30')]){_0x5c4324[_0x0fa2('0x12')]({'type':_0x16210b['type'],'app':_0x0fa2('0x31'),'appdata':_0x0fa2('0x32')+_0x16210b[_0x0fa2('0x30')]+')','context':_0x16210b['context'],'exten':_0x16210b[_0x0fa2('0xa')],'priority':_0x16815c[_0x0fa2('0x27')]+_0x22096a['priority']+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});}else{_0x5c4324['push']({'type':_0x16210b[_0x0fa2('0x13')],'app':_0x0fa2('0x31'),'appdata':_0x0fa2('0x33'),'context':_0x16210b[_0x0fa2('0x16')],'exten':_0x16210b[_0x0fa2('0xa')],'priority':_0x16815c[_0x0fa2('0x27')]+_0x22096a[_0x0fa2('0x17')]+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});}}if(_0x16210b[_0x0fa2('0x2d')]('answer')){if(_0x15a25c[_0x0fa2('0x34')](_0x16210b['app'][_0x0fa2('0x28')]())>=0x0&&_0x16210b[_0x0fa2('0x35')]!==_0x0fa2('0x36')){if(_0x16210b[_0x0fa2('0x37')]){_0x5c4324[_0x0fa2('0x12')]({'type':_0x16210b['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x16210b[_0x0fa2('0x16')],'exten':_0x16210b[_0x0fa2('0xa')],'priority':_0x16815c['length']+_0x22096a['priority']+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});_0x5c4324['push']({'type':_0x16210b[_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x16210b[_0x0fa2('0x16')],'exten':_0x16210b[_0x0fa2('0xa')],'priority':_0x16815c[_0x0fa2('0x27')]+_0x22096a[_0x0fa2('0x17')]+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});}else{_0x5c4324[_0x0fa2('0x12')]({'type':_0x16210b[_0x0fa2('0x13')],'app':_0x0fa2('0x31'),'appdata':_0x0fa2('0x38'),'context':_0x16210b[_0x0fa2('0x16')],'exten':_0x16210b['exten'],'priority':_0x16815c[_0x0fa2('0x27')]+_0x22096a[_0x0fa2('0x17')]+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});_0x5c4324[_0x0fa2('0x12')]({'type':_0x16210b[_0x0fa2('0x13')],'app':_0x0fa2('0x14'),'appdata':_0x0fa2('0x39'),'context':_0x16210b[_0x0fa2('0x16')],'exten':_0x16210b['exten'],'priority':_0x16815c[_0x0fa2('0x27')]+_0x22096a['priority']+_0x233700++,'VoiceExtensionId':_0x16210b[_0x0fa2('0x18')]});}}}for(var _0x33fe17=0x0;_0x33fe17<_0x16815c[_0x0fa2('0x27')];_0x33fe17+=0x1){var _0xd2c3ed=_0x22096a[_0x0fa2('0x17')]+_0x16815c['length'];var _0x2483cc=_0x33fe17===_0x16815c['length']-0x1?_0x22096a[_0x0fa2('0x17')]+_0x5c4324[_0x0fa2('0x27')]+_0x580878[_0x0fa2('0x27')]+0x2:_0x22096a[_0x0fa2('0x17')]+_0x33fe17+0x1;_0x5c4324[_0x0fa2('0x3a')](_0x33fe17,0x0,{'type':_0x16210b['type'],'app':_0x0fa2('0x3b'),'appdata':_0x16815c[_0x33fe17]+'?'+_0x16210b[_0x0fa2('0x16')]+_0x0fa2('0x3c')+_0xd2c3ed+':'+_0x16210b[_0x0fa2('0x16')]+_0x0fa2('0x3c')+_0x2483cc,'exten':_0x16210b[_0x0fa2('0xa')],'context':_0x16210b['context'],'priority':_0x22096a[_0x0fa2('0x17')]+_0x33fe17,'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x18')]});}_0x16210b[_0x0fa2('0x17')]=_0x5c4324[_0x0fa2('0x27')]?_[_0x0fa2('0x3d')](_0x5c4324)[_0x0fa2('0x17')]+0x1:_0x22096a[_0x0fa2('0x17')];_0x22096a[_0x0fa2('0x17')]=(_0x580878[_0x0fa2('0x27')]?_[_0x0fa2('0x3d')](_0x580878)[_0x0fa2('0x17')]:_0x16210b['priority'])+0x1;_0x22096a['extensions']=_[_0x0fa2('0x3e')](_0x22096a[_0x0fa2('0xf')],_0x5c4324,[_0x16210b],_0x580878);}_0x22096a[_0x0fa2('0xf')]['push']({'type':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0x13')],'app':_0x0fa2('0x3f'),'exten':_0x46c980[_0x51b0c8][0x0][_0x0fa2('0xa')],'context':_0x46c980[_0x51b0c8][0x0]['context'],'priority':_0x22096a[_0x0fa2('0x17')],'VoiceExtensionId':_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId']});_0x5bdd10['push'](_0x46c980[_0x51b0c8][0x0]['VoiceExtensionId']);_0x1a4ff1=_[_0x0fa2('0x3e')](_0x1a4ff1,_0x22096a[_0x0fa2('0xf')]);}}return _0xe7fb6a[_0x0fa2('0x40')](function(_0x47687d){return _0xe7fb6a['models'][_0x0fa2('0x7')][_0x0fa2('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x5bdd10}},'transaction':_0x47687d})[_0x0fa2('0x5')](function(_0xcb45ee){return _0xe7fb6a['models'][_0x0fa2('0x7')][_0x0fa2('0x42')](_[_0x0fa2('0x43')](_0x1a4ff1,_0x0fa2('0x17')),{'transaction':_0x47687d});});});})['catch'](function(_0x274d85){console[_0x0fa2('0x44')](_0x274d85);});}exports[_0x0fa2('0x45')]=rewrite; \ No newline at end of file +var _0x78e2=['toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','sortBy','catch','error','rewrite','lodash','util','Interval','then','intervals','models','VoiceExtension','findAll','IntervalId','uniq','map','exten','filter','playback','hasOwnProperty','priority','extensions','type','Set','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','push','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0'];(function(_0x1d2315,_0x109e85){var _0x403ace=function(_0x27aaa3){while(--_0x27aaa3){_0x1d2315['push'](_0x1d2315['shift']());}};_0x403ace(++_0x109e85);}(_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'));function rewrite(_0x374c41,_0x1c9713){var _0x1c7441=this;return _0x374c41['models'][_0x278e('0x2')]['findAll']({'raw':!![]})[_0x278e('0x3')](function(_0xaba666){_0x1c7441[_0x278e('0x4')]=_0xaba666;return _0x374c41[_0x278e('0x5')][_0x278e('0x6')][_0x278e('0x7')]({'where':{'IntervalId':_0x1c9713[_0x278e('0x8')]},'raw':!![]});})[_0x278e('0x3')](function(_0x224449){return _0x374c41[_0x278e('0x5')][_0x278e('0x6')][_0x278e('0x7')]({'where':{'exten':{'$in':_[_0x278e('0x9')](_[_0x278e('0xa')](_0x224449,_0x278e('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x278e('0x3')](function(_0x435de3){var _0x1e41e7=_[_0x278e('0xc')](_0x435de3,{'priority':'1'});var _0x218058=_[_0x278e('0xc')](_0x435de3,{'isApp':0x1});var _0x144509=_['groupBy'](_0x218058,_0x278e('0xb'));var _0x3f2a66=['queue',_0x278e('0xd')];var _0x5e6fff=[];var _0x14ef63=[];for(var _0x53d519 in _0x144509){if(_0x144509[_0x278e('0xe')](_0x53d519)){_0x1c7441[_0x278e('0xf')]=0x2;_0x1c7441[_0x278e('0x10')]=[];_0x1c7441['extension']=_['find'](_0x1e41e7,{'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')]});_0x1c7441[_0x278e('0x10')]['push']({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x12'),'appdata':util['format'](_0x278e('0x13'),_0x144509[_0x53d519][0x0][_0x278e('0x11')]),'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0]['exten'],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});if(_0x144509[_0x53d519][0x0]['type']===_0x278e('0x16')){if(_0x1c7441[_0x278e('0x17')]){_0x1c7441[_0x278e('0x10')]['push']({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x12'),'appdata':_0x278e('0x18')+(_0x1c7441[_0x278e('0x17')][_0x278e('0x19')]?_0x278e('0x1a')+_0x1c7441[_0x278e('0x17')]['cutdigits']+'}':_0x278e('0x1b')),'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});}_0x1c7441[_0x278e('0x10')][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x12'),'appdata':_0x278e('0x1d')+_0x144509[_0x53d519][0x0][_0x278e('0x15')],'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0]['exten'],'priority':_0x1c7441['priority']++,'VoiceExtensionId':_0x144509[_0x53d519][0x0]['VoiceExtensionId']});var _0x42bccd=_0x1c7441['priority']++;_0x1c7441[_0x278e('0x10')][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x1e'),'appdata':_0x278e('0x1f')+(_0x42bccd+0x2)+'):Goto('+(_0x42bccd+0x1)+')','context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x42bccd,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});if(_0x1c7441[_0x278e('0x17')]){_0x1c7441['extensions'][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x12'),'appdata':_0x1c7441[_0x278e('0x17')][_0x278e('0x19')]?_0x278e('0x20')+_0x1c7441[_0x278e('0x17')]['cutdigits']+'}':_0x278e('0x21'),'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0]['VoiceExtensionId']});}_0x1c7441['extensions']['push']({'type':_0x144509[_0x53d519][0x0]['type'],'app':_0x278e('0x12'),'appdata':'outboundrouteid='+_0x144509[_0x53d519][0x0][_0x278e('0x15')],'context':_0x144509[_0x53d519][0x0]['context'],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});if(_0x1c7441[_0x278e('0x17')]&&_0x1c7441['extension'][_0x278e('0xe')](_0x278e('0x22'))&&_0x1c7441[_0x278e('0x17')][_0x278e('0x22')]!=='none'){_0x1c7441[_0x278e('0x10')][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x144509[_0x53d519][0x0]['context'],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});_0x1c7441[_0x278e('0x10')]['push']({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':'Set','appdata':_0x278e('0x23')+_0x1c7441[_0x278e('0x17')][_0x278e('0x22')]||_0x278e('0x24'),'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0]['exten'],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});}}_0x1c7441[_0x278e('0x10')][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':'Set','appdata':_0x278e('0x25'),'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});_0x1c7441['extensions'][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0]['exten'],'priority':_0x1c7441['priority']++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});_0x1c7441['extensions'][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'priority':_0x1c7441[_0x278e('0xf')]++,'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});for(var _0x410259=0x0,_0x57386d=0x0;_0x410259<_0x144509[_0x53d519]['length'];_0x410259+=0x1,_0x57386d=0x0){var _0x427c7b=_0x144509[_0x53d519][_0x410259];if(_0x427c7b['type']){_0x427c7b[_0x278e('0x11')]=_0x427c7b['type'][_0x278e('0x26')]();}var _0x1a001e=[];var _0x5d68e9=[];delete _0x427c7b['id'];delete _0x427c7b[_0x278e('0x27')];delete _0x427c7b[_0x278e('0x28')];var _0xa88727=_0x427c7b[_0x278e('0x29')]!==_0x278e('0x2a')?[_0x427c7b[_0x278e('0x29')]]:_0x427c7b[_0x278e('0x8')]?_[_0x278e('0xa')](_[_0x278e('0xc')](_0x1c7441[_0x278e('0x4')],{'IntervalId':_0x427c7b[_0x278e('0x8')]}),_0x278e('0x29')):[];if(_0x427c7b[_0x278e('0xe')](_0x278e('0x2b'))){if(_0x427c7b[_0x278e('0x2b')]&&_0x427c7b[_0x278e('0x2b')]!=='--'){_0x1a001e[_0x278e('0x1c')]({'type':_0x427c7b[_0x278e('0x11')],'app':'Set','appdata':'CDR(tag)='+_0x427c7b[_0x278e('0x2b')],'context':_0x427c7b['context'],'exten':_0x427c7b[_0x278e('0xb')],'priority':_0xa88727[_0x278e('0x2c')]+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b[_0x278e('0x15')]});}}if(_0x427c7b[_0x278e('0x11')]===_0x278e('0x16')&&_0x427c7b[_0x278e('0xe')](_0x278e('0x2d'))){if(_0x427c7b[_0x278e('0x2d')]){_0x1a001e[_0x278e('0x1c')]({'type':_0x427c7b[_0x278e('0x11')],'app':_0x278e('0x1e'),'appdata':_0x278e('0x2e')+_0x427c7b[_0x278e('0x2d')]+')','context':_0x427c7b[_0x278e('0x14')],'exten':_0x427c7b['exten'],'priority':_0xa88727[_0x278e('0x2c')]+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b[_0x278e('0x15')]});}else{_0x1a001e[_0x278e('0x1c')]({'type':_0x427c7b[_0x278e('0x11')],'app':_0x278e('0x1e'),'appdata':_0x278e('0x2f'),'context':_0x427c7b[_0x278e('0x14')],'exten':_0x427c7b[_0x278e('0xb')],'priority':_0xa88727[_0x278e('0x2c')]+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b[_0x278e('0x15')]});}}if(_0x427c7b[_0x278e('0xe')](_0x278e('0x30'))){if(_0x3f2a66[_0x278e('0x31')](_0x427c7b['app'][_0x278e('0x26')]())>=0x0&&_0x427c7b[_0x278e('0x32')]!==_0x278e('0x33')){if(_0x427c7b['answer']){_0x1a001e[_0x278e('0x1c')]({'type':_0x427c7b[_0x278e('0x11')],'app':_0x278e('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x427c7b[_0x278e('0x14')],'exten':_0x427c7b[_0x278e('0xb')],'priority':_0xa88727['length']+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b['VoiceExtensionId']});_0x1a001e[_0x278e('0x1c')]({'type':_0x427c7b[_0x278e('0x11')],'app':'Set','appdata':_0x278e('0x34'),'context':_0x427c7b['context'],'exten':_0x427c7b[_0x278e('0xb')],'priority':_0xa88727['length']+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b[_0x278e('0x15')]});}else{_0x1a001e['push']({'type':_0x427c7b['type'],'app':_0x278e('0x1e'),'appdata':_0x278e('0x35'),'context':_0x427c7b[_0x278e('0x14')],'exten':_0x427c7b[_0x278e('0xb')],'priority':_0xa88727[_0x278e('0x2c')]+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b[_0x278e('0x15')]});_0x1a001e[_0x278e('0x1c')]({'type':_0x427c7b['type'],'app':_0x278e('0x12'),'appdata':_0x278e('0x36'),'context':_0x427c7b['context'],'exten':_0x427c7b[_0x278e('0xb')],'priority':_0xa88727[_0x278e('0x2c')]+_0x1c7441[_0x278e('0xf')]+_0x57386d++,'VoiceExtensionId':_0x427c7b['VoiceExtensionId']});}}}for(var _0x5053c9=0x0;_0x5053c9<_0xa88727[_0x278e('0x2c')];_0x5053c9+=0x1){var _0x3d59d5=_0x1c7441[_0x278e('0xf')]+_0xa88727[_0x278e('0x2c')];var _0x4b9cb3=_0x5053c9===_0xa88727[_0x278e('0x2c')]-0x1?_0x1c7441[_0x278e('0xf')]+_0x1a001e['length']+_0x5d68e9['length']+0x2:_0x1c7441[_0x278e('0xf')]+_0x5053c9+0x1;_0x1a001e[_0x278e('0x37')](_0x5053c9,0x0,{'type':_0x427c7b[_0x278e('0x11')],'app':_0x278e('0x38'),'appdata':_0xa88727[_0x5053c9]+'?'+_0x427c7b[_0x278e('0x14')]+_0x278e('0x39')+_0x3d59d5+':'+_0x427c7b[_0x278e('0x14')]+_0x278e('0x39')+_0x4b9cb3,'exten':_0x427c7b[_0x278e('0xb')],'context':_0x427c7b[_0x278e('0x14')],'priority':_0x1c7441[_0x278e('0xf')]+_0x5053c9,'VoiceExtensionId':_0x144509[_0x53d519][0x0]['VoiceExtensionId']});}_0x427c7b['priority']=_0x1a001e['length']?_[_0x278e('0x3a')](_0x1a001e)[_0x278e('0xf')]+0x1:_0x1c7441[_0x278e('0xf')];_0x1c7441[_0x278e('0xf')]=(_0x5d68e9[_0x278e('0x2c')]?_[_0x278e('0x3a')](_0x5d68e9)[_0x278e('0xf')]:_0x427c7b[_0x278e('0xf')])+0x1;_0x1c7441[_0x278e('0x10')]=_[_0x278e('0x3b')](_0x1c7441[_0x278e('0x10')],_0x1a001e,[_0x427c7b],_0x5d68e9);}_0x1c7441[_0x278e('0x10')][_0x278e('0x1c')]({'type':_0x144509[_0x53d519][0x0][_0x278e('0x11')],'app':_0x278e('0x3c'),'exten':_0x144509[_0x53d519][0x0][_0x278e('0xb')],'context':_0x144509[_0x53d519][0x0][_0x278e('0x14')],'priority':_0x1c7441[_0x278e('0xf')],'VoiceExtensionId':_0x144509[_0x53d519][0x0][_0x278e('0x15')]});_0x5e6fff[_0x278e('0x1c')](_0x144509[_0x53d519][0x0][_0x278e('0x15')]);_0x14ef63=_[_0x278e('0x3b')](_0x14ef63,_0x1c7441[_0x278e('0x10')]);}}return _0x374c41['transaction'](function(_0x3241a3){return _0x374c41[_0x278e('0x5')]['VoiceExtension'][_0x278e('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x5e6fff}},'transaction':_0x3241a3})['then'](function(_0x5c55c7){return _0x374c41['models'][_0x278e('0x6')]['bulkCreate'](_[_0x278e('0x3e')](_0x14ef63,_0x278e('0xf')),{'transaction':_0x3241a3});});});})[_0x278e('0x3f')](function(_0x4c44f0){console[_0x278e('0x40')](_0x4c44f0);});}exports[_0x278e('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index fabd25e..ea10bdb 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index fab0a88..7f3971f 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 _0xd7cd=['moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','min_id','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','spread','catch','main','stringify','send','start','root','server/files/tmp','.csv','keys','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns','CampaignId','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','papaparse','bluebird'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xd7cd,0x103));var _0xdd7c=function(_0x21fab4,_0x3659f8){_0x21fab4=_0x21fab4-0x0;var _0x18d7aa=_0xd7cd[_0x21fab4];return _0x18d7aa;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xdd7c('0x0'));var Papa=require(_0xdd7c('0x1'));var util=require('util');var BPromise=require(_0xdd7c('0x2'));var moment=require(_0xdd7c('0x3'));var squel=require(_0xdd7c('0x4'));var Redis=require(_0xdd7c('0x5'));var db=require(_0xdd7c('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xdd7c('0x7'))(_0xdd7c('0x8'));config[_0xdd7c('0x9')]=_[_0xdd7c('0xa')](config[_0xdd7c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd7c('0xb'))(new Redis(config[_0xdd7c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xdd7c('0xc'));function isEmail(_0x49f7e0){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'](_0x49f7e0);}function selectNotIn(_0x4407ec,_0x5caa9e,_0x189ba9,_0x2231f4,_0x4731b0){return squel[_0xdd7c('0xd')]()[_0xdd7c('0xe')](_0xdd7c('0xf'))[_0xdd7c('0x10')](_0x2231f4)['join'](_0x5caa9e,null,_0x5caa9e+_0xdd7c('0x11')+_0x2231f4+'.'+_0x189ba9)[_0xdd7c('0x12')](_0x2231f4+'.'+_0x189ba9+'\x20=\x20'+_0x4407ec+'.'+_0x189ba9)[_0xdd7c('0x12')](_0x5caa9e+_0xdd7c('0x13')+_0x4731b0['join']()+')');}function insertCmHopper(_0x59da6a,_0x125811,_0x422a58,_0x456643,_0x140ebb){var _0x311993=[_0xdd7c('0x14'),_0xdd7c('0x15'),_0xdd7c('0x16'),'cm_contacts.ListId',_0x125811+'.'+_0x456643,_0xdd7c('0x17'),_0xdd7c('0x18'),_0xdd7c('0x19'),_0xdd7c('0x1a'),'\x22'+_0x140ebb+'\x22'];return squel[_0xdd7c('0x1b')]()[_0xdd7c('0x1c')](_0xdd7c('0x1d'))[_0xdd7c('0x1e')]([_0xdd7c('0xf'),_0xdd7c('0x1f'),_0xdd7c('0x20'),_0xdd7c('0x21'),_0x456643,_0xdd7c('0x22'),_0xdd7c('0x23'),_0xdd7c('0x24'),_0xdd7c('0x25'),_0xdd7c('0x26')],squel[_0xdd7c('0xd')]()[_0xdd7c('0x27')](_0x311993)[_0xdd7c('0x10')](_0x125811)[_0xdd7c('0x28')](_0xdd7c('0x29'),null,_0xdd7c('0x2a')+_0x125811+_0xdd7c('0x2b'))['join'](_0x422a58,null,_0x422a58+_0xdd7c('0x11')+_0x125811+'.'+_0x456643)[_0xdd7c('0x12')](_0x125811+_0xdd7c('0x2c'),_0x59da6a)[_0xdd7c('0x12')](_0xdd7c('0x2d'),NOW)[_0xdd7c('0x12')](_0xdd7c('0x2e'),selectNotIn(_0x125811,_0x422a58,_0x456643,_0xdd7c('0x1d'),[_0xdd7c('0x2f'),_0xdd7c('0x30')]))['where'](_0xdd7c('0x2e'),selectNotIn(_0x125811,_0x422a58,_0x456643,_0xdd7c('0x1d'),['\x22always\x22'])))[_0xdd7c('0x31')]();}function insertCmHopperBlack(_0x706f92,_0x2d9b13,_0x55b050,_0x595cb1){var _0x5733fd=['cm_contacts.phone',_0xdd7c('0x16'),'cm_contacts.ListId',_0x2d9b13+'.'+_0x595cb1,_0xdd7c('0x17'),_0xdd7c('0x18')];return squel[_0xdd7c('0x1b')]()[_0xdd7c('0x1c')](_0xdd7c('0x32'))['fromQuery']([_0xdd7c('0xf'),_0xdd7c('0x20'),_0xdd7c('0x21'),_0x595cb1,_0xdd7c('0x22'),_0xdd7c('0x23')],squel[_0xdd7c('0xd')]()['fields'](_0x5733fd)[_0xdd7c('0x10')](_0x2d9b13)[_0xdd7c('0x28')](_0xdd7c('0x29'),null,_0xdd7c('0x2a')+_0x2d9b13+'.CmListId')[_0xdd7c('0x28')](_0x55b050,null,_0x55b050+'.id\x20=\x20'+_0x2d9b13+'.'+_0x595cb1)[_0xdd7c('0x12')](_0x2d9b13+_0xdd7c('0x2c'),_0x706f92)['where'](_0xdd7c('0x2d'),NOW)[_0xdd7c('0x12')](_0xdd7c('0x2e'),squel['select']()[_0xdd7c('0xe')]('phone')['from']('cm_hopper_black')[_0xdd7c('0x12')](_0xdd7c('0x33'),_0x706f92)[_0xdd7c('0x12')](_0x595cb1+_0xdd7c('0x34'),_0x2d9b13+'.'+_0x595cb1)))['toString']();}function insertCmContact(_0x2ee073,_0x176aed,_0x3b8a8a,_0x52bc29){var _0x1ce0e1=_[_0xdd7c('0x35')](_['keys'](_0x52bc29),[_0xdd7c('0x21'),_0xdd7c('0x36'),_0xdd7c('0x22'),_0xdd7c('0x23')]);return squel[_0xdd7c('0x1b')]()[_0xdd7c('0x1c')](_0xdd7c('0x29'))['fromQuery'](_0x1ce0e1,squel[_0xdd7c('0xd')]()['fields'](_0x1ce0e1)[_0xdd7c('0x10')](_0x176aed)[_0xdd7c('0x12')]('('+_0x3b8a8a[_0xdd7c('0x28')](',')+_0xdd7c('0x37'),squel[_0xdd7c('0xd')]()['fields'](_0x3b8a8a)[_0xdd7c('0x10')](_0xdd7c('0x29'))[_0xdd7c('0x12')](_0xdd7c('0x33'),_0x2ee073)[_0xdd7c('0x12')](_0xdd7c('0x38')))[_0xdd7c('0x12')]('id\x20IN\x20?',squel['select']()[_0xdd7c('0xe')]('MIN(id)',_0xdd7c('0x39'))[_0xdd7c('0x10')](_0x176aed)['group'](_0x3b8a8a[_0xdd7c('0x28')](','))))[_0xdd7c('0x31')]();}function handleStop(){logger[_0xdd7c('0x3a')](_0xdd7c('0x3b'));stopped=!![];}function handleUncaughtException(_0x38ee7a){logger[_0xdd7c('0x3c')](_0x38ee7a[_0xdd7c('0x3d')]);process[_0xdd7c('0x3e')](0x1);}function handleError(_0x46b654,_0x2b5568){stats[_0xdd7c('0x3f')][_0xdd7c('0x40')]({'name':_0x2b5568[_0xdd7c('0x41')],'message':_0x2b5568[_0xdd7c('0x3d')],'row':_0x46b654});}function handleQuery(_0x54ae68){logger['info'](_0x54ae68);return db[_0xdd7c('0x42')]['query'](_0x54ae68)[_0xdd7c('0x43')](function(_0x532370){results[_0xdd7c('0x40')](_0x532370);})[_0xdd7c('0x44')](function(_0x3fd37b){logger[_0xdd7c('0x3c')](_0x3fd37b[_0xdd7c('0x3d')]);});}function main(_0x564db4,_0x498bce,_0x23dabf,_0x59a99b){logger[_0xdd7c('0x3a')](_0xdd7c('0x45'),_0x564db4,JSON[_0xdd7c('0x46')](_0x498bce));process[_0xdd7c('0x47')](_0xdd7c('0x48'));var _0x4b57e3=_0x498bce['binding'];var _0x406856=_0x498bce['socket_timestamp'];var _0x562a92=path[_0xdd7c('0x28')](config[_0xdd7c('0x49')],_0xdd7c('0x4a'),_0x406856+_0xdd7c('0x4b'));var _0x17fd5f=_[_0xdd7c('0x4c')](_0x4b57e3)[_0xdd7c('0x28')]();logger[_0xdd7c('0x3a')](_0xdd7c('0x4d'),_0x17fd5f);fs[_0xdd7c('0x4e')](_0x562a92,_0x17fd5f+'\x0a');Papa[_0xdd7c('0x4f')](fs[_0xdd7c('0x50')](_0x564db4),{'header':!![],'skipEmptyLines':!![],'step':function(_0xd282ff,_0xaee0b2){try{for(var _0xd90001=0x0,_0x3edbe6=[];_0xd90001<_0xd282ff[_0xdd7c('0x51')][_0xdd7c('0x52')];_0xd90001++){stats['rows']+=0x1;if(_0xd282ff[_0xdd7c('0x3f')][_0xd90001]){handleError(_0xd282ff['data'][_0xd90001],_0xd282ff['errors'][_0xd90001]);}else{var _0x1ecfff=[];for(var _0x215546 in _0x4b57e3){if(_0x4b57e3[_0xdd7c('0x53')](_0x215546)){if(_0xd282ff[_0xdd7c('0x51')][_0xd90001][_0x4b57e3[_0x215546]]){var _0x41cef2=_[_0xdd7c('0x54')](_0xd282ff['data'][_0xd90001][_0x4b57e3[_0x215546]][_0xdd7c('0x55')](/"/g,'\x27'));switch(_0x215546){case _0xdd7c('0x1f'):var _0x56b1e7=moment(_0x41cef2,_0xdd7c('0xc'),!![]);if(_0x56b1e7['isValid']()){_0x3edbe6['push']('\x22'+_0x41cef2+'\x22');}else{_0x1ecfff[_0xdd7c('0x40')](_0xdd7c('0x56'));}break;case _0xdd7c('0x24'):var _0x23292b=parseInt(_0x41cef2);_0x41cef2=_[_0xdd7c('0x57')](_0x23292b)||_0x23292b<0x0||_0x23292b>0x4?_0x59a99b?0x3:0x2:_0x23292b;_0x3edbe6[_0xdd7c('0x40')]('\x22'+_0x41cef2+'\x22');break;case _0xdd7c('0x25'):var _0x4c3de8=parseInt(_0x41cef2);if(_[_0xdd7c('0x58')](_0x4c3de8)&&_[_0xdd7c('0x59')](_0x23dabf,_0x4c3de8)){_0x3edbe6[_0xdd7c('0x40')]('\x22'+_0x4c3de8+'\x22');}else{_0x1ecfff[_0xdd7c('0x40')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x41cef2)){_0x3edbe6[_0xdd7c('0x40')]('\x22'+_0x41cef2+'\x22');}else{_0x1ecfff[_0xdd7c('0x40')]('email\x20wrong\x20format');}break;case _0xdd7c('0x5a'):var _0x216535=moment(_0x41cef2,_0xdd7c('0x5b'),!![]);if(_0x216535[_0xdd7c('0x5c')]()){_0x3edbe6[_0xdd7c('0x40')]('\x22'+_0x41cef2+'\x22');}else{_0x1ecfff['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x3edbe6['push']('\x22'+_0x41cef2+'\x22');}}else{switch(_0x215546){case _0xdd7c('0x5d'):case'phone':_0x1ecfff[_0xdd7c('0x40')](_0x215546+_0xdd7c('0x5e'));break;default:_0x3edbe6[_0xdd7c('0x40')]('\x22\x22');}}}}if(_0x1ecfff[_0xdd7c('0x52')]){handleError(_0xd282ff['data'][_0xd90001],{'code':'SystemRow','message':_0x1ecfff[_0xdd7c('0x28')]()});}else{fs[_0xdd7c('0x5f')](_0x562a92,_0x3edbe6[_0xdd7c('0x28')]()+'\x0a');}_0x3edbe6=[];}if(!(stats[_0xdd7c('0x60')]%0xc8)){socket[_0xdd7c('0x61')](_0xdd7c('0x62')+_0x406856,stats);stats['errors']=[];}}if(stopped){logger[_0xdd7c('0x3a')](_0xdd7c('0x63'));_0xaee0b2[_0xdd7c('0x64')]();}}catch(_0xe04ec){handleError(_0xd282ff[_0xdd7c('0x51')][_0xd90001],{'code':'SystemError','message':_0xe04ec[_0xdd7c('0x3d')]});logger[_0xdd7c('0x3c')](_0xdd7c('0x65'),_0xe04ec[_0xdd7c('0x3d')]);}},'complete':function(){try{var _0x232254=[];var _0x372028=_0xdd7c('0x29');if(_0x498bce[_0xdd7c('0x66')]&&_0x498bce[_0xdd7c('0x66')][_0xdd7c('0x52')]){_0x372028=_0xdd7c('0x67')+_0x406856;_0x232254[_0xdd7c('0x40')](_0xdd7c('0x68')+_0x372028+_0xdd7c('0x69'));}var _0x5104c2=util[_0xdd7c('0x6a')](_0xdd7c('0x6b'),_0x562a92,_0x372028,_0x17fd5f,_0x498bce['ListId'],_0x498bce['CompanyId']||null,NOW,NOW);if(_[_0xdd7c('0x6c')](_0x4b57e3[_0xdd7c('0x1f')])){_0x5104c2+=_0xdd7c('0x6d');}_0x232254['push'](_0x5104c2);if(_0x498bce[_0xdd7c('0x66')]&&_0x498bce[_0xdd7c('0x66')][_0xdd7c('0x52')]){_0x232254[_0xdd7c('0x40')](insertCmContact(_0x498bce[_0xdd7c('0x21')],_0x372028,_0x498bce[_0xdd7c('0x66')],_0x4b57e3));_0x232254[_0xdd7c('0x40')](_0xdd7c('0x6e')+_0x372028+';');}_0x232254[_0xdd7c('0x40')](insertCmHopper(_0x498bce[_0xdd7c('0x21')],'voice_queues_has_cm_lists','voice_queues',_0xdd7c('0x6f'),_0x59a99b));_0x232254[_0xdd7c('0x40')](insertCmHopperBlack(_0x498bce[_0xdd7c('0x21')],_0xdd7c('0x70'),_0xdd7c('0x71'),_0xdd7c('0x6f')));_0x232254[_0xdd7c('0x40')](insertCmHopper(_0x498bce[_0xdd7c('0x21')],'campaigns_has_cm_lists',_0xdd7c('0x72'),_0xdd7c('0x73'),_0x59a99b));_0x232254[_0xdd7c('0x40')](insertCmHopperBlack(_0x498bce[_0xdd7c('0x21')],'campaigns_has_cm_blacklists','campaigns',_0xdd7c('0x73')));BPromise[_0xdd7c('0x74')](_0x232254,handleQuery)['then'](function(_0x1817eb){stats[_0xdd7c('0x75')]=!![];stats[_0xdd7c('0x76')]=_0x498bce[_0xdd7c('0x66')]&&_0x498bce[_0xdd7c('0x66')][_0xdd7c('0x52')]?results[0x2][_0xdd7c('0x76')]:results[0x0][_0xdd7c('0x76')];socket[_0xdd7c('0x61')]('contact:import:'+_0x406856,stats);fs[_0xdd7c('0x77')](_0x564db4);fs[_0xdd7c('0x77')](_0x562a92);process[_0xdd7c('0x3e')](0x0);})[_0xdd7c('0x44')](function(_0xbca8db){logger[_0xdd7c('0x3c')](_0xbca8db[_0xdd7c('0x3d')]);process[_0xdd7c('0x3e')](0x1);});}catch(_0x20229f){logger[_0xdd7c('0x3c')](_0xdd7c('0x78'),_0x20229f['message']);process['exit'](0x1);}},'error':function(_0x333fd7,_0x137e27,_0x40558c,_0x29fd77){throw new Error(_0x29fd77);}});}function validate(){if(process[_0xdd7c('0x79')]&&process[_0xdd7c('0x79')][_0xdd7c('0x52')]<0x4){throw new Error(_0xdd7c('0x7a'));}var _0x21fd06=path[_0xdd7c('0x28')](config[_0xdd7c('0x49')],'server/files/tmp',process[_0xdd7c('0x79')][0x2]);if(!fs[_0xdd7c('0x7b')](_0x21fd06)){throw new Error(_0xdd7c('0x7c'));}var _0x11303b={};try{_0x11303b=JSON[_0xdd7c('0x4f')](process['argv'][0x3]);if(!_0x11303b[_0xdd7c('0x7d')]){throw new Error(_0xdd7c('0x7e'));}if(!_0x11303b[_0xdd7c('0x7d')][_0xdd7c('0xf')]){throw new Error(_0xdd7c('0x7f'));}if(!_0x11303b[_0xdd7c('0x7d')][_0xdd7c('0x5d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1c199e=0x0;if(_0x11303b[_0xdd7c('0x7d')][_0xdd7c('0x25')]){_0x1c199e=0x1;}if(!_0x11303b[_0xdd7c('0x21')]){throw new Error(_0xdd7c('0x80'));}}catch(_0x4055ff){throw new Error('body\x20id\x20mandatory');}var _0x498717=[];try{_0x498717=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x534498){logger[_0xdd7c('0x3a')](_0xdd7c('0x81'));}main(_0x21fd06,_0x11303b,_0x498717,_0x1c199e);}validate();process['on']('SIGINT',handleStop);process['on'](_0xdd7c('0x82'),handleUncaughtException); \ No newline at end of file +var _0x9346=['message','exit','errors','code','sequelize','query','spread','push','catch','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','emit','unlink','complete','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','phone','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','insert','cm_hopper_black','ContactId','fields','field','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','deletedAt\x20IS\x20NULL','group','info','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9346,0xd6));var _0x6934=function(_0x2f0336,_0x7eb379){_0x2f0336=_0x2f0336-0x0;var _0x4745b1=_0x9346[_0x2f0336];return _0x4745b1;};'use strict';var fs=require('fs');var path=require(_0x6934('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x6934('0x1'));var BPromise=require(_0x6934('0x2'));var moment=require(_0x6934('0x3'));var squel=require(_0x6934('0x4'));var Redis=require(_0x6934('0x5'));var db=require(_0x6934('0x6'))['db'];var config=require(_0x6934('0x7'));var logger=require(_0x6934('0x8'))(_0x6934('0x9'));config[_0x6934('0xa')]=_[_0x6934('0xb')](config[_0x6934('0xa')],{'host':_0x6934('0xc'),'port':0x18eb});var socket=require(_0x6934('0xd'))(new Redis(config[_0x6934('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6934('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5e51b6){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))*$/[_0x6934('0xf')](_0x5e51b6);}function selectNotIn(_0x2f2ce5,_0x203ba6,_0xa6de0d,_0x1850e4,_0x34298c){return squel[_0x6934('0x10')]()['field'](_0x6934('0x11'))['from'](_0x1850e4)[_0x6934('0x12')](_0x203ba6,null,_0x203ba6+_0x6934('0x13')+_0x1850e4+'.'+_0xa6de0d)['where'](_0x1850e4+'.'+_0xa6de0d+'\x20=\x20'+_0x2f2ce5+'.'+_0xa6de0d)[_0x6934('0x14')](_0x203ba6+'.dialCheckDuplicateType\x20IN\x20('+_0x34298c[_0x6934('0x12')]()+')');}function insertCmHopper(_0x151434,_0x3bdd67,_0x2fbbd8,_0x388568,_0x4867c5){var _0x503832=[_0x6934('0x15'),_0x6934('0x16'),'cm_contacts.id',_0x6934('0x17'),_0x3bdd67+'.'+_0x388568,'cm_contacts.createdAt',_0x6934('0x18'),_0x6934('0x19'),_0x6934('0x1a'),'\x22'+_0x4867c5+'\x22'];return squel['insert']()[_0x6934('0x1b')](_0x6934('0x1c'))[_0x6934('0x1d')]([_0x6934('0x11'),_0x6934('0x1e'),'ContactId',_0x6934('0x1f'),_0x388568,_0x6934('0x20'),_0x6934('0x21'),_0x6934('0x22'),_0x6934('0x23'),_0x6934('0x24')],squel[_0x6934('0x10')]()['fields'](_0x503832)[_0x6934('0x25')](_0x3bdd67)[_0x6934('0x12')](_0x6934('0x26'),null,_0x6934('0x27')+_0x3bdd67+_0x6934('0x28'))[_0x6934('0x12')](_0x2fbbd8,null,_0x2fbbd8+'.id\x20=\x20'+_0x3bdd67+'.'+_0x388568)[_0x6934('0x14')](_0x3bdd67+'.CmListId\x20=\x20?',_0x151434)[_0x6934('0x14')](_0x6934('0x29'),NOW)[_0x6934('0x14')](_0x6934('0x2a'),selectNotIn(_0x3bdd67,_0x2fbbd8,_0x388568,_0x6934('0x1c'),[_0x6934('0x2b'),_0x6934('0x2c')]))['where'](_0x6934('0x2a'),selectNotIn(_0x3bdd67,_0x2fbbd8,_0x388568,_0x6934('0x1c'),[_0x6934('0x2b')])))[_0x6934('0x2d')]();}function insertCmHopperBlack(_0x4f6789,_0x36a5d6,_0x217b42,_0x34a032){var _0x16c34d=[_0x6934('0x15'),'cm_contacts.id',_0x6934('0x17'),_0x36a5d6+'.'+_0x34a032,_0x6934('0x2e'),'cm_contacts.updatedAt'];return squel[_0x6934('0x2f')]()[_0x6934('0x1b')](_0x6934('0x30'))[_0x6934('0x1d')](['phone',_0x6934('0x31'),_0x6934('0x1f'),_0x34a032,_0x6934('0x20'),_0x6934('0x21')],squel['select']()[_0x6934('0x32')](_0x16c34d)['from'](_0x36a5d6)[_0x6934('0x12')](_0x6934('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x36a5d6+_0x6934('0x28'))[_0x6934('0x12')](_0x217b42,null,_0x217b42+'.id\x20=\x20'+_0x36a5d6+'.'+_0x34a032)[_0x6934('0x14')](_0x36a5d6+'.CmListId\x20=\x20?',_0x4f6789)[_0x6934('0x14')](_0x6934('0x29'),NOW)['where'](_0x6934('0x2a'),squel[_0x6934('0x10')]()[_0x6934('0x33')](_0x6934('0x11'))[_0x6934('0x25')](_0x6934('0x30'))[_0x6934('0x14')](_0x6934('0x34'),_0x4f6789)[_0x6934('0x14')](_0x34a032+_0x6934('0x35'),_0x36a5d6+'.'+_0x34a032)))[_0x6934('0x2d')]();}function insertCmContact(_0x554e82,_0x38fa81,_0x3c7911,_0x5a4680){var _0x1e9f14=_['concat'](_[_0x6934('0x36')](_0x5a4680),[_0x6934('0x1f'),_0x6934('0x37'),_0x6934('0x20'),_0x6934('0x21')]);return squel[_0x6934('0x2f')]()[_0x6934('0x1b')](_0x6934('0x26'))[_0x6934('0x1d')](_0x1e9f14,squel[_0x6934('0x10')]()[_0x6934('0x32')](_0x1e9f14)[_0x6934('0x25')](_0x38fa81)['where']('('+_0x3c7911['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x6934('0x32')](_0x3c7911)[_0x6934('0x25')](_0x6934('0x26'))[_0x6934('0x14')](_0x6934('0x34'),_0x554e82)[_0x6934('0x14')](_0x6934('0x38')))[_0x6934('0x14')]('id\x20IN\x20?',squel[_0x6934('0x10')]()[_0x6934('0x33')]('MIN(id)','min_id')[_0x6934('0x25')](_0x38fa81)[_0x6934('0x39')](_0x3c7911['join'](','))))[_0x6934('0x2d')]();}function handleStop(){logger[_0x6934('0x3a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x499040){logger[_0x6934('0x3b')](_0x499040[_0x6934('0x3c')]);process[_0x6934('0x3d')](0x1);}function handleError(_0x310c14,_0x3e35e5){stats[_0x6934('0x3e')]['push']({'name':_0x3e35e5[_0x6934('0x3f')],'message':_0x3e35e5['message'],'row':_0x310c14});}function handleQuery(_0x2e9c44){logger[_0x6934('0x3a')](_0x2e9c44);return db[_0x6934('0x40')][_0x6934('0x41')](_0x2e9c44)[_0x6934('0x42')](function(_0x3b5509){results[_0x6934('0x43')](_0x3b5509);})[_0x6934('0x44')](function(_0x34bcd0){logger[_0x6934('0x3b')](_0x34bcd0[_0x6934('0x3c')]);});}function main(_0x234bd6,_0x4d9fc8,_0x5cfdc3,_0x58296d){logger[_0x6934('0x3a')]('main',_0x234bd6,JSON['stringify'](_0x4d9fc8));process[_0x6934('0x45')](_0x6934('0x46'));var _0xec47bb=_0x4d9fc8[_0x6934('0x47')];var _0x1868bd=_0x4d9fc8['socket_timestamp'];var _0x5ce2df=path[_0x6934('0x12')](config[_0x6934('0x48')],_0x6934('0x49'),_0x1868bd+_0x6934('0x4a'));var _0x2ce23f=_['keys'](_0xec47bb)['join']();logger[_0x6934('0x3a')](_0x6934('0x4b'),_0x2ce23f);fs[_0x6934('0x4c')](_0x5ce2df,_0x2ce23f+'\x0a');Papa[_0x6934('0x4d')](fs[_0x6934('0x4e')](_0x234bd6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x10144f,_0x1c287d){try{for(var _0xa20cf3=0x0,_0x156b18=[];_0xa20cf3<_0x10144f[_0x6934('0x4f')][_0x6934('0x50')];_0xa20cf3++){stats[_0x6934('0x51')]+=0x1;if(_0x10144f[_0x6934('0x3e')][_0xa20cf3]){handleError(_0x10144f[_0x6934('0x4f')][_0xa20cf3],_0x10144f['errors'][_0xa20cf3]);}else{var _0x19805a=[];for(var _0x5aa493 in _0xec47bb){if(_0xec47bb[_0x6934('0x52')](_0x5aa493)){if(_0x10144f[_0x6934('0x4f')][_0xa20cf3][_0xec47bb[_0x5aa493]]){var _0x2cfb52=_[_0x6934('0x53')](_0x10144f['data'][_0xa20cf3][_0xec47bb[_0x5aa493]]['replace'](/"/g,'\x27'));switch(_0x5aa493){case _0x6934('0x1e'):var _0x422e82=moment(_0x2cfb52,_0x6934('0x54'),!![]);if(_0x422e82[_0x6934('0x55')]()){_0x156b18[_0x6934('0x43')]('\x22'+_0x2cfb52+'\x22');}else{_0x19805a[_0x6934('0x43')](_0x6934('0x56'));}break;case _0x6934('0x22'):var _0x1d535d=parseInt(_0x2cfb52);_0x2cfb52=_[_0x6934('0x57')](_0x1d535d)||_0x1d535d<0x0||_0x1d535d>0x4?_0x58296d?0x3:0x2:_0x1d535d;_0x156b18[_0x6934('0x43')]('\x22'+_0x2cfb52+'\x22');break;case _0x6934('0x23'):var _0x3574d0=parseInt(_0x2cfb52);if(_[_0x6934('0x58')](_0x3574d0)&&_[_0x6934('0x59')](_0x5cfdc3,_0x3574d0)){_0x156b18[_0x6934('0x43')]('\x22'+_0x3574d0+'\x22');}else{_0x19805a['push'](_0x6934('0x5a'));}break;case _0x6934('0x5b'):if(isEmail(_0x2cfb52)){_0x156b18[_0x6934('0x43')]('\x22'+_0x2cfb52+'\x22');}else{_0x19805a[_0x6934('0x43')]('email\x20wrong\x20format');}break;case _0x6934('0x5c'):var _0x5c7878=moment(_0x2cfb52,_0x6934('0x5d'),!![]);if(_0x5c7878[_0x6934('0x55')]()){_0x156b18[_0x6934('0x43')]('\x22'+_0x2cfb52+'\x22');}else{_0x19805a['push'](_0x6934('0x5e'));}break;default:_0x156b18[_0x6934('0x43')]('\x22'+_0x2cfb52+'\x22');}}else{switch(_0x5aa493){case _0x6934('0x5f'):case _0x6934('0x11'):_0x19805a[_0x6934('0x43')](_0x5aa493+'\x20not\x20specified');break;default:_0x156b18[_0x6934('0x43')]('\x22\x22');}}}}if(_0x19805a[_0x6934('0x50')]){handleError(_0x10144f[_0x6934('0x4f')][_0xa20cf3],{'code':'SystemRow','message':_0x19805a[_0x6934('0x12')]()});}else{fs[_0x6934('0x60')](_0x5ce2df,_0x156b18[_0x6934('0x12')]()+'\x0a');}_0x156b18=[];}if(!(stats[_0x6934('0x51')]%0xc8)){socket['emit'](_0x6934('0x61')+_0x1868bd,stats);stats['errors']=[];}}if(stopped){logger[_0x6934('0x3a')](_0x6934('0x62'));_0x1c287d[_0x6934('0x63')]();}}catch(_0x4d3ca4){handleError(_0x10144f[_0x6934('0x4f')][_0xa20cf3],{'code':_0x6934('0x64'),'message':_0x4d3ca4[_0x6934('0x3c')]});logger[_0x6934('0x3b')](_0x6934('0x65'),_0x4d3ca4[_0x6934('0x3c')]);}},'complete':function(){try{var _0x336eee=[];var _0x230c4b='cm_contacts';if(_0x4d9fc8[_0x6934('0x66')]&&_0x4d9fc8[_0x6934('0x66')][_0x6934('0x50')]){_0x230c4b='cm_contacts_'+_0x1868bd;_0x336eee[_0x6934('0x43')](_0x6934('0x67')+_0x230c4b+_0x6934('0x68'));}var _0x54401f=util[_0x6934('0xe')](_0x6934('0x69'),_0x5ce2df,_0x230c4b,_0x2ce23f,_0x4d9fc8[_0x6934('0x1f')],_0x4d9fc8[_0x6934('0x37')]||null,NOW,NOW);if(_[_0x6934('0x6a')](_0xec47bb[_0x6934('0x1e')])){_0x54401f+=_0x6934('0x6b');}_0x336eee[_0x6934('0x43')](_0x54401f);if(_0x4d9fc8[_0x6934('0x66')]&&_0x4d9fc8['duplicates'][_0x6934('0x50')]){_0x336eee[_0x6934('0x43')](insertCmContact(_0x4d9fc8['ListId'],_0x230c4b,_0x4d9fc8[_0x6934('0x66')],_0xec47bb));_0x336eee['push'](_0x6934('0x6c')+_0x230c4b+';');}_0x336eee[_0x6934('0x43')](insertCmHopper(_0x4d9fc8[_0x6934('0x1f')],_0x6934('0x6d'),_0x6934('0x6e'),_0x6934('0x6f'),_0x58296d));_0x336eee[_0x6934('0x43')](insertCmHopperBlack(_0x4d9fc8[_0x6934('0x1f')],_0x6934('0x70'),_0x6934('0x6e'),_0x6934('0x6f')));_0x336eee['push'](insertCmHopper(_0x4d9fc8[_0x6934('0x1f')],_0x6934('0x71'),_0x6934('0x72'),_0x6934('0x73'),_0x58296d));_0x336eee[_0x6934('0x43')](insertCmHopperBlack(_0x4d9fc8[_0x6934('0x1f')],_0x6934('0x74'),_0x6934('0x72'),_0x6934('0x73')));BPromise[_0x6934('0x75')](_0x336eee,handleQuery)[_0x6934('0x76')](function(_0x564734){stats[_0x6934('0x77')]=!![];stats['affectedRows']=_0x4d9fc8[_0x6934('0x66')]&&_0x4d9fc8[_0x6934('0x66')][_0x6934('0x50')]?results[0x2]['affectedRows']:results[0x0][_0x6934('0x78')];socket[_0x6934('0x79')](_0x6934('0x61')+_0x1868bd,stats);fs[_0x6934('0x7a')](_0x234bd6);fs[_0x6934('0x7a')](_0x5ce2df);process['exit'](0x0);})[_0x6934('0x44')](function(_0x37e212){logger['error'](_0x37e212['message']);process[_0x6934('0x3d')](0x1);});}catch(_0x21bede){logger[_0x6934('0x3b')](_0x6934('0x7b'),_0x21bede[_0x6934('0x3c')]);process[_0x6934('0x3d')](0x1);}},'error':function(_0x4c99c6,_0x57adbf,_0x548e65,_0x25c796){throw new Error(_0x25c796);}});}function validate(){if(process['argv']&&process['argv']['length']<0x4){throw new Error(_0x6934('0x7c'));}var _0x403d53=path[_0x6934('0x12')](config[_0x6934('0x48')],'server/files/tmp',process[_0x6934('0x7d')][0x2]);if(!fs[_0x6934('0x7e')](_0x403d53)){throw new Error(_0x6934('0x7f'));}var _0x21600e={};try{_0x21600e=JSON[_0x6934('0x4d')](process[_0x6934('0x7d')][0x3]);if(!_0x21600e[_0x6934('0x47')]){throw new Error(_0x6934('0x80'));}if(!_0x21600e[_0x6934('0x47')]['phone']){throw new Error(_0x6934('0x81'));}if(!_0x21600e[_0x6934('0x47')][_0x6934('0x5f')]){throw new Error(_0x6934('0x82'));}var _0x3772c7=0x0;if(_0x21600e[_0x6934('0x47')][_0x6934('0x23')]){_0x3772c7=0x1;}if(!_0x21600e[_0x6934('0x1f')]){throw new Error(_0x6934('0x83'));}}catch(_0x356458){throw new Error(_0x6934('0x84'));}var _0x51992c=[];try{_0x51992c=_[_0x6934('0x85')](JSON[_0x6934('0x4d')](process['argv'][0x4]),'id');}catch(_0x5114cb){logger[_0x6934('0x3a')](_0x6934('0x86'));}main(_0x403d53,_0x21600e,_0x51992c,_0x3772c7);}validate();process['on'](_0x6934('0x87'),handleStop);process['on'](_0x6934('0x88'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 588a35f..1805f85 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9158=['inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Call\x20To','destexten','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','answertime','endtime','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase'];(function(_0x15fc3a,_0x5d83f4){var _0x34f2b4=function(_0x20cef2){while(--_0x20cef2){_0x15fc3a['push'](_0x15fc3a['shift']());}};_0x34f2b4(++_0x5d83f4);}(_0x9158,0x16e));var _0x8915=function(_0x2b0dad,_0x270608){_0x2b0dad=_0x2b0dad-0x0;var _0x57dbea=_0x9158[_0x2b0dad];return _0x57dbea;};'use strict';exports[_0x8915('0x0')]=function(_0xf9865c,_0x3c4f04){var _0x4b7c5a=[{'type':_0x8915('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0xf9865c[_0x8915('0x2')]()){case'voice':switch(_0x3c4f04['toLowerCase']()){case _0x8915('0x3'):_0x4b7c5a[_0x8915('0x4')]({'type':_0x8915('0x5'),'content':'','variableName':_0x8915('0x6')});_0x4b7c5a[_0x8915('0x4')]({'type':_0x8915('0x5'),'content':'','variableName':_0x8915('0x7')});break;case _0x8915('0x8'):_0x4b7c5a['push']({'type':_0x8915('0x1'),'content':_0x8915('0x9'),'variableName':null});_0x4b7c5a[_0x8915('0x4')]({'type':_0x8915('0x5'),'content':'','variableName':_0x8915('0xa')});break;}}return _0x4b7c5a;};exports[_0x8915('0xb')]=function(_0x1980b1,_0x59f1a1){var _0x56705a=[];switch(_0x1980b1[_0x8915('0x2')]()){case _0x8915('0xc'):switch(_0x59f1a1[_0x8915('0x2')]()){case _0x8915('0x3'):_0x56705a=[{'type':_0x8915('0x1'),'content':_0x8915('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8915('0xe'),'keyType':_0x8915('0x5'),'variableName':'calleridnum'},{'type':_0x8915('0xf'),'content':'','key':'Caller\x20Name','keyType':_0x8915('0x5'),'variableName':'calleridname'},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x10'),'keyType':_0x8915('0x5'),'variableName':_0x8915('0x11')},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x12'),'keyType':_0x8915('0x5'),'variableName':_0x8915('0x6')},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x13'),'keyType':_0x8915('0x5'),'variableName':'uniqueid'},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x14'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x8915('0x1'),'content':_0x8915('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x16'),'keyType':_0x8915('0x5'),'variableName':_0x8915('0x17')},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x18'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x8915('0x1'),'content':_0x8915('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x1a'),'keyType':'variable','variableName':_0x8915('0x1b')},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x1c'),'keyType':_0x8915('0x5'),'variableName':_0x8915('0x1d')},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x1e'),'keyType':_0x8915('0x5'),'variableName':'agentcompleteAt'},{'type':_0x8915('0xf'),'content':'','key':'Hold\x20Time','keyType':_0x8915('0x5'),'variableName':_0x8915('0x1f')},{'type':'keyValue','content':'','key':_0x8915('0x20'),'keyType':_0x8915('0x5'),'variableName':_0x8915('0x21')}];break;case _0x8915('0x8'):_0x56705a=[{'type':_0x8915('0x1'),'content':_0x8915('0xd'),'variableName':null},{'type':_0x8915('0xf'),'content':'','key':'Called\x20Number','keyType':_0x8915('0x5'),'keyContent':'','variableName':_0x8915('0xa')},{'type':'keyValue','content':'','key':_0x8915('0x22'),'keyType':'variable','keyContent':'','variableName':_0x8915('0x23')},{'type':'keyValue','content':'','key':_0x8915('0x13'),'keyType':_0x8915('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x14'),'keyType':_0x8915('0x5'),'keyContent':'','variableName':_0x8915('0x24')},{'type':_0x8915('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x8915('0xf'),'content':'','key':'Answer\x20Time','keyType':_0x8915('0x5'),'keyContent':'','variableName':_0x8915('0x25')},{'type':_0x8915('0xf'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0x8915('0x26')},{'type':_0x8915('0xf'),'content':'','key':'Duration','keyType':_0x8915('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x8915('0xf'),'content':'','key':_0x8915('0x27'),'keyType':_0x8915('0x5'),'keyContent':'','variableName':_0x8915('0x28')}];break;}}return _0x56705a;}; \ No newline at end of file +var _0xc29b=['getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','destexten','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','billableseconds'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc29b,0x12d));var _0xbc29=function(_0x217fa2,_0x3cea2a){_0x217fa2=_0x217fa2-0x0;var _0x4d3bba=_0xc29b[_0x217fa2];return _0x4d3bba;};'use strict';exports[_0xbc29('0x0')]=function(_0x250315,_0x45edb6){var _0x5d2fef=[{'type':_0xbc29('0x1'),'content':_0xbc29('0x2'),'variableName':null}];switch(_0x250315['toLowerCase']()){case _0xbc29('0x3'):switch(_0x45edb6[_0xbc29('0x4')]()){case _0xbc29('0x5'):_0x5d2fef[_0xbc29('0x6')]({'type':_0xbc29('0x7'),'content':'','variableName':_0xbc29('0x8')});_0x5d2fef[_0xbc29('0x6')]({'type':_0xbc29('0x7'),'content':'','variableName':_0xbc29('0x9')});break;case _0xbc29('0xa'):_0x5d2fef[_0xbc29('0x6')]({'type':_0xbc29('0x1'),'content':_0xbc29('0xb'),'variableName':null});_0x5d2fef[_0xbc29('0x6')]({'type':_0xbc29('0x7'),'content':'','variableName':_0xbc29('0xc')});break;}}return _0x5d2fef;};exports[_0xbc29('0xd')]=function(_0x2f591c,_0x35ece9){var _0x2710ad=[];switch(_0x2f591c['toLowerCase']()){case _0xbc29('0x3'):switch(_0x35ece9[_0xbc29('0x4')]()){case _0xbc29('0x5'):_0x2710ad=[{'type':_0xbc29('0x1'),'content':_0xbc29('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x10'),'keyType':'variable','variableName':_0xbc29('0x9')},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x11'),'keyType':'variable','variableName':'calleridname'},{'type':_0xbc29('0xf'),'content':'','key':'Call\x20To','keyType':_0xbc29('0x7'),'variableName':_0xbc29('0x12')},{'type':_0xbc29('0xf'),'content':'','key':'Queue','keyType':_0xbc29('0x7'),'variableName':'queue'},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x13'),'keyType':_0xbc29('0x7'),'variableName':_0xbc29('0x14')},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x15'),'keyType':'variable','variableName':_0xbc29('0x16')},{'type':_0xbc29('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xbc29('0x17'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x18'),'keyType':_0xbc29('0x7'),'variableName':_0xbc29('0xc')},{'type':_0xbc29('0x1'),'content':_0xbc29('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x1a'),'keyType':'variable','variableName':_0xbc29('0x16')},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x1b'),'keyType':_0xbc29('0x7'),'variableName':_0xbc29('0x1c')},{'type':'keyValue','content':'','key':_0xbc29('0x1d'),'keyType':_0xbc29('0x7'),'variableName':_0xbc29('0x1e')},{'type':_0xbc29('0xf'),'content':'','key':'Hold\x20Time','keyType':_0xbc29('0x7'),'variableName':_0xbc29('0x1f')},{'type':'keyValue','content':'','key':_0xbc29('0x20'),'keyType':_0xbc29('0x7'),'variableName':'talktime'}];break;case'outbound':_0x2710ad=[{'type':_0xbc29('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0xbc29('0x21'),'keyType':_0xbc29('0x7'),'keyContent':'','variableName':_0xbc29('0xc')},{'type':'keyValue','content':'','key':_0xbc29('0x22'),'keyType':_0xbc29('0x7'),'keyContent':'','variableName':_0xbc29('0x23')},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x13'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x15'),'keyType':'variable','keyContent':'','variableName':_0xbc29('0x24')},{'type':_0xbc29('0x1'),'content':_0xbc29('0x19')},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x25'),'keyType':_0xbc29('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xbc29('0xf'),'content':'','key':_0xbc29('0x26'),'keyType':_0xbc29('0x7'),'keyContent':'','variableName':_0xbc29('0x27')},{'type':'keyValue','content':'','key':_0xbc29('0x28'),'keyType':_0xbc29('0x7'),'keyContent':'','variableName':_0xbc29('0x29')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xbc29('0x7'),'keyContent':'','variableName':_0xbc29('0x2a')}];break;}}return _0x2710ad;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index e7a5bcb..4af858b 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fc4=['info','catch','error','tracked','user','query','body','omit','html','mobile','lodash','../../mysqldb','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update'];(function(_0x3aa3a4,_0x23407d){var _0x155625=function(_0x54aa10){while(--_0x54aa10){_0x3aa3a4['push'](_0x3aa3a4['shift']());}};_0x155625(++_0x23407d);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x6fc4[_0x14e27a];return _0x288688;};'use strict';var _=require(_0x46fc('0x0'));var db=require(_0x46fc('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x46fc('0x2'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x46fc('0x2'))(_0x46fc('0x3')),'chat':require(_0x46fc('0x2'))(_0x46fc('0x4')),'whatsapp':require(_0x46fc('0x2'))(_0x46fc('0x5'))};function getInteractionId(_0x3c4f75,_0x3951e9,_0x5ca981){if(_0x3c4f75&&_0x3c4f75[_['upperFirst'](_0x5ca981)+_0x46fc('0x6')]){return _0x3c4f75[_[_0x46fc('0x7')](_0x5ca981)+_0x46fc('0x6')];}else if(_0x3c4f75&&_0x3c4f75['id']){return _0x3c4f75['id'];}else if(_0x3951e9&&_0x3951e9['id']){return _0x3951e9['id'];}else{return _0x46fc('0x8');}}function log(_0x5ef080,_0x51d875,_0x1fbb9b,_0xa1283a,_0x5431e8,_0x5b7bf8){loggers[_0x5431e8['toLowerCase']()][_0x5ef080](_0x46fc('0x9'),_0x5b7bf8[_0x46fc('0xa')](),_0x51d875?_0x51d875['id']:null,_0x51d875?_0x51d875[_0x46fc('0xb')]:null,_0x51d875?_0x51d875[_0x46fc('0xc')]:null,getInteractionId(_0x1fbb9b,_0xa1283a,_0x5431e8),_0x1fbb9b?JSON[_0x46fc('0xd')](_0x1fbb9b):_0x46fc('0xe'));}function updateUser(_0x1013ae,_0x25ee84,_0x10ba21,_0x139971,_0x34a019){db[_[_0x46fc('0x7')](_0x139971)+_0x46fc('0xf')][_0x46fc('0x10')]({'where':{'id':getInteractionId(_0x25ee84,_0x10ba21,_0x139971)}})[_0x46fc('0x11')](function(_0x39aa74){if(_0x39aa74){return _0x39aa74[_0x46fc('0x12')]({'UserId':_0x1013ae?_0x1013ae['id']:null});}})[_0x46fc('0x11')](function(_0x51ab37){if(_0x51ab37){log(_0x46fc('0x13'),_0x1013ae,_0x25ee84,_0x10ba21,_0x139971,_0x34a019);}})[_0x46fc('0x14')](function(){log(_0x46fc('0x15'),_0x1013ae,_0x25ee84,_0x10ba21,_0x139971,_0x34a019);});}exports[_0x46fc('0x16')]=function(_0xd40ad2,_0x5baa81){return function(_0x23b041,_0xf7a2ed,_0x2ebd06){var _0x39fc89=_0x23b041[_0x46fc('0x17')];var _0x21aea4={};var _0x5d168a=_0x23b041[_0x46fc('0x18')];if(_0x21aea4){_0x21aea4=_['clone'](_0x23b041[_0x46fc('0x19')]);_0x21aea4=_[_0x46fc('0x1a')](_0x21aea4,[_0x46fc('0x19'),_0x46fc('0x1b'),'phone','fax',_0x46fc('0x1c')]);}updateUser(_0x39fc89,_0x21aea4,_0x5d168a,_0xd40ad2,_0x5baa81);_0x2ebd06(null);};}; \ No newline at end of file +var _0xe4a5=['sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','body','omit','html','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions'];(function(_0x4ee192,_0x1e8f15){var _0xe9538d=function(_0x1f8ac5){while(--_0x1f8ac5){_0x4ee192['push'](_0x4ee192['shift']());}};_0xe9538d(++_0x1e8f15);}(_0xe4a5,0xea));var _0x5e4a=function(_0x42868d,_0x165917){_0x42868d=_0x42868d-0x0;var _0xd29bb1=_0xe4a5[_0x42868d];return _0xd29bb1;};'use strict';var _=require(_0x5e4a('0x0'));var db=require(_0x5e4a('0x1'))['db'];var loggers={'openchannel':require(_0x5e4a('0x2'))(_0x5e4a('0x3')),'mail':require(_0x5e4a('0x2'))(_0x5e4a('0x4')),'fax':require('../../config/logger')(_0x5e4a('0x5')),'sms':require(_0x5e4a('0x2'))(_0x5e4a('0x6')),'chat':require(_0x5e4a('0x2'))(_0x5e4a('0x7')),'whatsapp':require(_0x5e4a('0x2'))(_0x5e4a('0x8'))};function getInteractionId(_0x54264e,_0x1f84ca,_0x18d8ee){if(_0x54264e&&_0x54264e[_[_0x5e4a('0x9')](_0x18d8ee)+'InteractionId']){return _0x54264e[_[_0x5e4a('0x9')](_0x18d8ee)+_0x5e4a('0xa')];}else if(_0x54264e&&_0x54264e['id']){return _0x54264e['id'];}else if(_0x1f84ca&&_0x1f84ca['id']){return _0x1f84ca['id'];}else{return'unknown';}}function log(_0x6eb81f,_0x559e4c,_0x10239a,_0x176af2,_0x3c4ef7,_0x3c7b39){loggers[_0x3c4ef7[_0x5e4a('0xb')]()][_0x6eb81f](_0x5e4a('0xc'),_0x3c7b39[_0x5e4a('0xd')](),_0x559e4c?_0x559e4c['id']:null,_0x559e4c?_0x559e4c['name']:null,_0x559e4c?_0x559e4c[_0x5e4a('0xe')]:null,getInteractionId(_0x10239a,_0x176af2,_0x3c4ef7),_0x10239a?JSON[_0x5e4a('0xf')](_0x10239a):_0x5e4a('0x10'));}function updateUser(_0x33ce58,_0x38711f,_0x302d62,_0x25ebdd,_0x5575a3){db[_['upperFirst'](_0x25ebdd)+_0x5e4a('0x11')][_0x5e4a('0x12')]({'where':{'id':getInteractionId(_0x38711f,_0x302d62,_0x25ebdd)}})[_0x5e4a('0x13')](function(_0x297dd1){if(_0x297dd1){return _0x297dd1[_0x5e4a('0x14')]({'UserId':_0x33ce58?_0x33ce58['id']:null});}})[_0x5e4a('0x13')](function(_0x146e69){if(_0x146e69){log(_0x5e4a('0x15'),_0x33ce58,_0x38711f,_0x302d62,_0x25ebdd,_0x5575a3);}})[_0x5e4a('0x16')](function(){log(_0x5e4a('0x17'),_0x33ce58,_0x38711f,_0x302d62,_0x25ebdd,_0x5575a3);});}exports[_0x5e4a('0x18')]=function(_0x2145f0,_0x2cd88c){return function(_0x3e8160,_0x4c8a9d,_0x549371){var _0x426061=_0x3e8160[_0x5e4a('0x19')];var _0x432fd0={};var _0x552178=_0x3e8160[_0x5e4a('0x1a')];if(_0x432fd0){_0x432fd0=_['clone'](_0x3e8160[_0x5e4a('0x1b')]);_0x432fd0=_[_0x5e4a('0x1c')](_0x432fd0,[_0x5e4a('0x1b'),_0x5e4a('0x1d'),'phone','fax','mobile']);}updateUser(_0x426061,_0x432fd0,_0x552178,_0x2145f0,_0x2cd88c);_0x549371(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5508212..aad8da0 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 _0xb5bd=['isUserLimit','crypto','../../mysqldb','../../config/environment','data1','license','split','update','base64','final','utf8','License','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb5bd,0x1cf));var _0xdb5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5bd[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xdb5b('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0xdb5b('0x1'))['db'];var config=require(_0xdb5b('0x2'));function getValueFromLicense(_0x54d38e,_0x369534){if(_0x54d38e&&_0x369534){if(_0x369534['data1']&&_0x369534['license']){var _0x2fd37e=_0x369534[_0xdb5b('0x3')];var _0x47db0f=_0x369534[_0xdb5b('0x4')];var _0x194a20=_0x2fd37e[_0xdb5b('0x5')]('-')[0x4];var _0x4d56ad=_0x2fd37e[_0xdb5b('0x5')]('-')[0x0];var _0x1c78a1=crypto['createDecipher']('aes-256-ctr',util['format']('%s:%s:%s',_0x194a20,_0x2fd37e,_0x4d56ad));var _0x5a014d=_0x1c78a1[_0xdb5b('0x6')](_0x47db0f,_0xdb5b('0x7'),'utf8');_0x5a014d+=_0x1c78a1[_0xdb5b('0x8')](_0xdb5b('0x9'));var _0x427a86=JSON['parse'](_0x5a014d);return _0x427a86['hasOwnProperty'](_0x54d38e)?_0x427a86[_0x54d38e]:null;}}return null;}function isLimit(_0x2ba326,_0x3de266,_0x5ea9ad,_0x48a557){var _0x3c91b9=_0x3de266;return compose()['use'](function(_0x569d9f,_0x126b68,_0x52284a){return db[_0xdb5b('0xa')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xdb5b('0xb')](function(_0x9e23e2){var _0x31fb27=getValueFromLicense(_0x2ba326,_0x9e23e2);return _0x31fb27?_0x31fb27:_0x3c91b9;})[_0xdb5b('0xb')](function(_0x37d463){_0x3c91b9=_0x37d463;return _0x5ea9ad[_0xdb5b('0xc')](_0x48a557);})[_0xdb5b('0xb')](function(_0x4fc7bf){if(_0x4fc7bf>=_0x3c91b9){return _0x126b68[_0xdb5b('0xd')](0x193)[_0xdb5b('0xe')]({'message':util[_0xdb5b('0xf')](_0xdb5b('0x10'),_0x2ba326)});}_0x52284a();})[_0xdb5b('0x11')](function(_0x128916){_0x52284a(_0x128916);});});}function isUserLimit(){return isLimit(_0xdb5b('0x12'),0x1,db['User'],{'where':{'$or':[{'role':_0xdb5b('0x13')},{'role':'user'}]}});}exports[_0xdb5b('0x14')]=isUserLimit; \ No newline at end of file +var _0x3d4e=['admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','hasOwnProperty','use','License','findOne','count','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User'];(function(_0x70c97a,_0xd4d263){var _0x5cb362=function(_0x163f30){while(--_0x163f30){_0x70c97a['push'](_0x70c97a['shift']());}};_0x5cb362(++_0xd4d263);}(_0x3d4e,0xa5));var _0xe3d4=function(_0x28109f,_0x57bc0d){_0x28109f=_0x28109f-0x0;var _0x24c79f=_0x3d4e[_0x28109f];return _0x24c79f;};'use strict';var crypto=require(_0xe3d4('0x0'));var util=require('util');var compose=require(_0xe3d4('0x1'));var db=require(_0xe3d4('0x2'))['db'];var config=require(_0xe3d4('0x3'));function getValueFromLicense(_0x1be75f,_0x2dc923){if(_0x1be75f&&_0x2dc923){if(_0x2dc923[_0xe3d4('0x4')]&&_0x2dc923['license']){var _0x201b83=_0x2dc923[_0xe3d4('0x4')];var _0x3e6d72=_0x2dc923['license'];var _0x49870b=_0x201b83['split']('-')[0x4];var _0x579a3a=_0x201b83[_0xe3d4('0x5')]('-')[0x0];var _0x2b2d97=crypto[_0xe3d4('0x6')](_0xe3d4('0x7'),util[_0xe3d4('0x8')]('%s:%s:%s',_0x49870b,_0x201b83,_0x579a3a));var _0x2a7e73=_0x2b2d97[_0xe3d4('0x9')](_0x3e6d72,_0xe3d4('0xa'),_0xe3d4('0xb'));_0x2a7e73+=_0x2b2d97[_0xe3d4('0xc')]('utf8');var _0x2fcca5=JSON['parse'](_0x2a7e73);return _0x2fcca5[_0xe3d4('0xd')](_0x1be75f)?_0x2fcca5[_0x1be75f]:null;}}return null;}function isLimit(_0x755552,_0x53e9e8,_0x3e182d,_0x3b5810){var _0x1425e0=_0x53e9e8;return compose()[_0xe3d4('0xe')](function(_0x5b2b9a,_0x557d91,_0x3fa3a7){return db[_0xe3d4('0xf')][_0xe3d4('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1ed742){var _0x592b04=getValueFromLicense(_0x755552,_0x1ed742);return _0x592b04?_0x592b04:_0x1425e0;})['then'](function(_0x3696fa){_0x1425e0=_0x3696fa;return _0x3e182d[_0xe3d4('0x11')](_0x3b5810);})[_0xe3d4('0x12')](function(_0x1a6955){if(_0x1a6955>=_0x1425e0){return _0x557d91[_0xe3d4('0x13')](0x193)[_0xe3d4('0x14')]({'message':util['format'](_0xe3d4('0x15'),_0x755552)});}_0x3fa3a7();})['catch'](function(_0x26c53e){_0x3fa3a7(_0x26c53e);});});}function isUserLimit(){return isLimit(_0xe3d4('0x16'),0x1,db[_0xe3d4('0x17')],{'where':{'$or':[{'role':_0xe3d4('0x18')},{'role':_0xe3d4('0x19')}]}});}exports[_0xe3d4('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 18b9987..da1a5b4 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 _0xfea3=['>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$startsWith','$endsWith','shift','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','indexOf','push','buildExpression','DATE','$eq','value','includes','$gt','$lte','add','format','castTo','text','CAST(','field','operator','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','LIKE\x20?','$lt','<=\x20?','$gte'];(function(_0x1a4f9e,_0x18fafd){var _0x3344cf=function(_0x29a4da){while(--_0x29a4da){_0x1a4f9e['push'](_0x1a4f9e['shift']());}};_0x3344cf(++_0x18fafd);}(_0xfea3,0xa5));var _0x3fea=function(_0x35c33f,_0x246a2e){_0x35c33f=_0x35c33f-0x0;var _0x4bd55c=_0xfea3[_0x35c33f];return _0x4bd55c;};'use strict';var _=require(_0x3fea('0x0'));var moment=require(_0x3fea('0x1'));exports[_0x3fea('0x2')]=function(_0x43b8a1){var _0xd4a1ca={'conditions':[]};_0xd4a1ca[_0x3fea('0x3')]=_[_0x3fea('0x4')](_0x43b8a1,_0x3fea('0x5'))?'or':_0x3fea('0x6');var _0x302b78=_0x43b8a1[_0x3fea('0x7')](_0x3fea('0x8'),'')[_0x3fea('0x7')](_0x3fea('0x5'),'')[_0x3fea('0x9')]('||');for(var _0x43dc7b=0x0;_0x43dc7b<_0x302b78[_0x3fea('0xa')];_0x43dc7b++){var _0x38d505=_0x302b78[_0x43dc7b][_0x3fea('0x9')](':=');var _0x135897=_0x38d505[0x0];var _0x5b9639=_0x38d505[_0x3fea('0xb')](0x1);_0x5b9639[_0x3fea('0xc')](function(_0x225298){var _0x480c9d=_0x225298[_0x3fea('0x9')]('[')['shift']();var _0x55fd8e=_0x225298['match'](/\[(.*?)\]/g);_0x55fd8e[_0x3fea('0xc')](function(_0x4d40b1){var _0x392ee1=_0x4d40b1['split']('[')['filter'](function(_0x379748){return _0x379748[_0x3fea('0xd')](']')>-0x1;})['map'](function(_0x33d3d7){return _0x33d3d7[_0x3fea('0x9')](']')[0x0];})[0x0];_0xd4a1ca['conditions'][_0x3fea('0xe')]({'field':_0x135897,'operator':_0x480c9d,'value':_0x392ee1});});});}return _0xd4a1ca;};exports[_0x3fea('0xf')]=function(_0x29246d,_0x23b748,_0x10184f){var _0x28c85b={};if(_0x23b748===_0x3fea('0x10')){if(_0x10184f['operator']===_0x3fea('0x11')){_0x10184f['operator']='$between';_0x10184f['value']+=','+_0x10184f[_0x3fea('0x12')];}else if(_[_0x3fea('0x13')]([_0x3fea('0x14'),_0x3fea('0x15')],_0x10184f['operator'])){_0x10184f[_0x3fea('0x12')]=moment(_0x10184f[_0x3fea('0x12')])[_0x3fea('0x16')](0x1,'days')[_0x3fea('0x17')]('YYYY-MM-DD');}}if(_0x10184f[_0x3fea('0x18')]){_0x23b748=_0x10184f[_0x3fea('0x18')];_0x28c85b[_0x3fea('0x19')]=_0x3fea('0x1a')+_0x29246d+'.'+_0x10184f[_0x3fea('0x1b')]+'\x20AS\x20'+_0x10184f['castTo']+')\x20'+parseOperator(_0x10184f[_0x3fea('0x1c')]);}else{_0x28c85b['text']=_0x29246d+'.'+_0x10184f['field']+'\x20'+parseOperator(_0x10184f[_0x3fea('0x1c')]);}if(_['includes']([_0x3fea('0x1d'),'$notIn'],_0x10184f[_0x3fea('0x1c')]))_0x28c85b['text']='('+_0x28c85b[_0x3fea('0x19')]+_0x3fea('0x1e')+_0x29246d+'.'+_0x10184f[_0x3fea('0x1b')]+_0x3fea('0x1f');_0x28c85b[_0x3fea('0x12')]=parseValue(_0x23b748,_0x10184f[_0x3fea('0x1c')],_0x10184f['value']);return _0x28c85b;};function parseOperator(_0x224145){var _0x33a4d4;switch(_0x224145){case'$in':_0x33a4d4=_0x3fea('0x20');break;case _0x3fea('0x21'):_0x33a4d4=_0x3fea('0x22');break;case _0x3fea('0x11'):_0x33a4d4='=\x20?';break;case _0x3fea('0x1d'):_0x33a4d4='<>\x20?';break;case'$substring':case'$startsWith':case'$endsWith':_0x33a4d4=_0x3fea('0x23');break;case _0x3fea('0x24'):_0x33a4d4='<\x20?';break;case _0x3fea('0x14'):_0x33a4d4='>\x20?';break;case _0x3fea('0x15'):_0x33a4d4=_0x3fea('0x25');break;case _0x3fea('0x26'):_0x33a4d4=_0x3fea('0x27');break;case _0x3fea('0x28'):_0x33a4d4=_0x3fea('0x29');break;}return _0x33a4d4;}function parseValue(_0x33e9d9,_0x2a0dab,_0x24ac18){var _0x409903={'start':undefined,'end':undefined};switch(_0x2a0dab){case _0x3fea('0x2a'):case _0x3fea('0x21'):_0x409903[_0x3fea('0x2b')]=_0x24ac18['split'](',');break;case _0x3fea('0x2c'):_0x409903[_0x3fea('0x2b')]='%'+_0x24ac18+'%';break;case _0x3fea('0x2d'):_0x409903['start']=_0x24ac18+'%';break;case _0x3fea('0x2e'):_0x409903['start']='%'+_0x24ac18;break;case _0x3fea('0x28'):var _0xedcde=_0x24ac18[_0x3fea('0x9')](',');var _0x24ac18=_0xedcde[_0x3fea('0x2f')]();var _0x5618f9=_0xedcde['pop']();if(_0x33e9d9===_0x3fea('0x10')){_0x24ac18=moment(_0x24ac18)[_0x3fea('0x30')](0x0,!![])[_0x3fea('0x17')]();_0x5618f9=moment(_0x5618f9)[_0x3fea('0x30')](0x0,!![])['add'](0x17,'hours')[_0x3fea('0x16')](0x3b,_0x3fea('0x31'))[_0x3fea('0x16')](0x3b,_0x3fea('0x32'))['format']();}_0x409903={'start':_0x24ac18,'end':_0x5618f9};break;default:_0x409903['start']=_0x24ac18;break;}return _0x409903;} \ No newline at end of file +var _0x61f1=['and','replace','[$and]','split','length','forEach','shift','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','includes','$gt','$lte','value','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]'];(function(_0x223552,_0x27dcaf){var _0x5117c3=function(_0x185667){while(--_0x185667){_0x223552['push'](_0x223552['shift']());}};_0x5117c3(++_0x27dcaf);}(_0x61f1,0x150));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x161f('0x0'));var moment=require(_0x161f('0x1'));exports[_0x161f('0x2')]=function(_0x31c7b3){var _0x2ddae2={'conditions':[]};_0x2ddae2[_0x161f('0x3')]=_[_0x161f('0x4')](_0x31c7b3,_0x161f('0x5'))?'or':_0x161f('0x6');var _0x3101a4=_0x31c7b3[_0x161f('0x7')](_0x161f('0x8'),'')['replace'](_0x161f('0x5'),'')[_0x161f('0x9')]('||');for(var _0x3f9f25=0x0;_0x3f9f25<_0x3101a4[_0x161f('0xa')];_0x3f9f25++){var _0x57777d=_0x3101a4[_0x3f9f25]['split'](':=');var _0x19a711=_0x57777d[0x0];var _0x5039eb=_0x57777d['slice'](0x1);_0x5039eb[_0x161f('0xb')](function(_0x4e174d){var _0x551c66=_0x4e174d[_0x161f('0x9')]('[')[_0x161f('0xc')]();var _0x5921cc=_0x4e174d['match'](/\[(.*?)\]/g);_0x5921cc[_0x161f('0xb')](function(_0x4d2dd8){var _0x2f1917=_0x4d2dd8[_0x161f('0x9')]('[')[_0x161f('0xd')](function(_0x27967c){return _0x27967c[_0x161f('0xe')](']')>-0x1;})[_0x161f('0xf')](function(_0x37559d){return _0x37559d['split'](']')[0x0];})[0x0];_0x2ddae2[_0x161f('0x10')]['push']({'field':_0x19a711,'operator':_0x551c66,'value':_0x2f1917});});});}return _0x2ddae2;};exports[_0x161f('0x11')]=function(_0x5d78b6,_0x4f4698,_0x5b071f){var _0x4ee4a7={};if(_0x4f4698===_0x161f('0x12')){if(_0x5b071f[_0x161f('0x13')]===_0x161f('0x14')){_0x5b071f[_0x161f('0x13')]=_0x161f('0x15');_0x5b071f['value']+=','+_0x5b071f['value'];}else if(_[_0x161f('0x16')]([_0x161f('0x17'),_0x161f('0x18')],_0x5b071f[_0x161f('0x13')])){_0x5b071f['value']=moment(_0x5b071f[_0x161f('0x19')])[_0x161f('0x1a')](0x1,_0x161f('0x1b'))[_0x161f('0x1c')](_0x161f('0x1d'));}}if(_0x5b071f[_0x161f('0x1e')]){_0x4f4698=_0x5b071f[_0x161f('0x1e')];_0x4ee4a7['text']=_0x161f('0x1f')+_0x5d78b6+'.'+_0x5b071f['field']+_0x161f('0x20')+_0x5b071f[_0x161f('0x1e')]+')\x20'+parseOperator(_0x5b071f[_0x161f('0x13')]);}else{_0x4ee4a7['text']=_0x5d78b6+'.'+_0x5b071f['field']+'\x20'+parseOperator(_0x5b071f[_0x161f('0x13')]);}if(_['includes']([_0x161f('0x21'),_0x161f('0x22')],_0x5b071f[_0x161f('0x13')]))_0x4ee4a7[_0x161f('0x23')]='('+_0x4ee4a7[_0x161f('0x23')]+_0x161f('0x24')+_0x5d78b6+'.'+_0x5b071f['field']+_0x161f('0x25');_0x4ee4a7[_0x161f('0x19')]=parseValue(_0x4f4698,_0x5b071f[_0x161f('0x13')],_0x5b071f[_0x161f('0x19')]);return _0x4ee4a7;};function parseOperator(_0x450534){var _0x55b55a;switch(_0x450534){case _0x161f('0x26'):_0x55b55a=_0x161f('0x27');break;case _0x161f('0x22'):_0x55b55a=_0x161f('0x28');break;case _0x161f('0x14'):_0x55b55a=_0x161f('0x29');break;case _0x161f('0x21'):_0x55b55a='<>\x20?';break;case _0x161f('0x2a'):case _0x161f('0x2b'):case _0x161f('0x2c'):_0x55b55a=_0x161f('0x2d');break;case _0x161f('0x2e'):_0x55b55a=_0x161f('0x2f');break;case _0x161f('0x17'):_0x55b55a=_0x161f('0x30');break;case _0x161f('0x18'):_0x55b55a=_0x161f('0x31');break;case _0x161f('0x32'):_0x55b55a=_0x161f('0x33');break;case _0x161f('0x15'):_0x55b55a=_0x161f('0x34');break;}return _0x55b55a;}function parseValue(_0x2845e7,_0x1ad985,_0x44fc60){var _0x2a5af7={'start':undefined,'end':undefined};switch(_0x1ad985){case _0x161f('0x26'):case'$notIn':_0x2a5af7[_0x161f('0x35')]=_0x44fc60[_0x161f('0x9')](',');break;case _0x161f('0x2a'):_0x2a5af7['start']='%'+_0x44fc60+'%';break;case _0x161f('0x2b'):_0x2a5af7[_0x161f('0x35')]=_0x44fc60+'%';break;case _0x161f('0x2c'):_0x2a5af7[_0x161f('0x35')]='%'+_0x44fc60;break;case _0x161f('0x15'):var _0x1ead9c=_0x44fc60[_0x161f('0x9')](',');var _0x44fc60=_0x1ead9c[_0x161f('0xc')]();var _0x4bfb2a=_0x1ead9c['pop']();if(_0x2845e7===_0x161f('0x12')){_0x44fc60=moment(_0x44fc60)[_0x161f('0x36')](0x0,!![])[_0x161f('0x1c')]();_0x4bfb2a=moment(_0x4bfb2a)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0x161f('0x1a')](0x3b,_0x161f('0x37'))['add'](0x3b,_0x161f('0x38'))['format']();}_0x2a5af7={'start':_0x44fc60,'end':_0x4bfb2a};break;default:_0x2a5af7[_0x161f('0x35')]=_0x44fc60;break;}return _0x2a5af7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 01437d5..a2ddba5 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 _0xe85c=['getFullTextValue','forEach','lodash','moment','fields','filters','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','offset','sort','split','map','indexOf','priority','col','unsigned','substr','DESC','cast','omit','isEmpty','isString','hasOwnProperty','isEmail','match'];(function(_0x309458,_0xba6e63){var _0x3306ee=function(_0x47e10c){while(--_0x47e10c){_0x309458['push'](_0x309458['shift']());}};_0x3306ee(++_0xba6e63);}(_0xe85c,0x1a6));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var sequelize=require('sequelize');var moment=require(_0xce85('0x1'));var LIMIT_VALUE=0xfa;exports[_0xce85('0x2')]=function(_0x25add5){var _0x49a3ce=null;if(_0x25add5){_0x49a3ce=_0x25add5['split'](',');}return _0x49a3ce;};exports[_0xce85('0x3')]=function(_0x17eb9f,_0x636f6b){var _0x4c313f={};if(!_['isEmpty'](_0x17eb9f)){_['forOwn'](_0x17eb9f,function(_0x5ea8d4,_0x3fe62f){try{if(_0x636f6b){var _0x31fcb8=_[_0xce85('0x4')](_0x636f6b,{'name':_0x3fe62f})||{};if(_0x31fcb8[_0xce85('0x5')]===_0xce85('0x6')&&_[_0xce85('0x7')](_0x5ea8d4)){var _0x5dd7be=JSON[_0xce85('0x8')](_0x5ea8d4);var _0x5be54b={'$gte':moment(moment(_0x5dd7be[_0xce85('0x9')])[_0xce85('0xa')](_0xce85('0xb')))[_0xce85('0xc')]()['format'](),'$lte':moment(moment(_0x5dd7be[_0xce85('0xd')])[_0xce85('0xa')](_0xce85('0xb')))['utc']()[_0xce85('0xe')](0x1,'s')[_0xce85('0xa')]()};_0x4c313f[_0x3fe62f]=_0x5be54b;}else{_0x4c313f[_0x3fe62f]=_[_0xce85('0xf')](_0x5ea8d4)?_0x5ea8d4:JSON['parse'](_0x5ea8d4);}}else{_0x4c313f[_0x3fe62f]=_['isArray'](_0x5ea8d4)?_0x5ea8d4:JSON[_0xce85('0x8')](_0x5ea8d4);}}catch(_0x15e44c){_0x4c313f[_0x3fe62f]=_0x5ea8d4['split'](',');}});}return _0x4c313f;};exports['limit']=function(_0x1e7c47){_0x1e7c47=parseInt(_0x1e7c47,0xa);if(!_0x1e7c47||_0x1e7c47<0x0){_0x1e7c47=LIMIT_VALUE;}return _0x1e7c47;};exports[_0xce85('0x10')]=function(_0x170764){_0x170764=parseInt(_0x170764,0xa);if(!_0x170764||_0x170764<0x0){_0x170764=0x0;}return _0x170764;};exports[_0xce85('0x11')]=function(_0x4a30f6){var _0xa2e629,_0x9ca3d0=null;if(_0x4a30f6){_0xa2e629=_0x4a30f6[_0xce85('0x12')](',');_0x9ca3d0=_[_0xce85('0x13')](_0xa2e629,function(_0x611275){if(_0x611275[_0xce85('0x14')]('-')===0x0){return[_0x611275===_0xce85('0x15')?sequelize['cast'](sequelize[_0xce85('0x16')](_0xce85('0x15')),_0xce85('0x17')):_0x611275[_0xce85('0x18')](0x1),_0xce85('0x19')];}else{return[_0x611275===_0xce85('0x15')?sequelize[_0xce85('0x1a')](sequelize[_0xce85('0x16')](_0xce85('0x15')),_0xce85('0x17')):_0x611275,'ASC'];}});}return _0x9ca3d0;};exports[_0xce85('0x1b')]=function(_0xfe5f57,_0xc94c4b){if(_[_0xce85('0x1c')](_0xfe5f57)){return _0xfe5f57;}if(_[_0xce85('0xf')](_0xfe5f57)){for(var _0x27b639=0x0;_0x27b639<_0xfe5f57['length'];_0x27b639+=0x1){_0xfe5f57[_0x27b639]=this[_0xce85('0x1b')](_0xfe5f57[_0x27b639],_0xc94c4b);}return _0xfe5f57;}if(!_['isObject'](_0xfe5f57)){return _0xfe5f57;}if(_[_0xce85('0x1d')](_0xc94c4b)){_0xc94c4b=[_0xc94c4b];}if(!_[_0xce85('0xf')](_0xc94c4b)){return _0xfe5f57;}for(var _0x383366=0x0;_0x383366<_0xc94c4b['length'];_0x383366+=0x1){_['unset'](_0xfe5f57,_0xc94c4b[_0x383366]);}for(var _0x204764 in _0xfe5f57){if(_0xfe5f57[_0xce85('0x1e')](_0x204764)){_0xfe5f57[_0x204764]=this[_0xce85('0x1b')](_0xfe5f57[_0x204764],_0xc94c4b);}}return _0xfe5f57;};exports['isNumeric']=function(_0x2899fe){return _0x2899fe['match'](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xce85('0x1f')]=function(_0x49a39d){return _0x49a39d[_0xce85('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xce85('0x21')]=function(_0xe7eeb9){var _0x4bd181=[];_0xe7eeb9[_0xce85('0x12')]('\x20')[_0xce85('0x22')](function(_0x2b9567){_0x4bd181['push']('+'+_0x2b9567['toString']()+'*');});return _0x4bd181['join']('\x20');}; \ No newline at end of file +var _0x732f=['limit','sort','map','priority','cast','col','unsigned','DESC','omit','length','isObject','unset','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','push','toString','join','lodash','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','utc','subtract','isArray'];(function(_0x5c18cb,_0x136453){var _0x3b8e66=function(_0x18a161){while(--_0x18a161){_0x5c18cb['push'](_0x5c18cb['shift']());}};_0x3b8e66(++_0x136453);}(_0x732f,0xb0));var _0xf732=function(_0x4624f9,_0x49b411){_0x4624f9=_0x4624f9-0x0;var _0x10c5ab=_0x732f[_0x4624f9];return _0x10c5ab;};'use strict';var _=require(_0xf732('0x0'));var sequelize=require('sequelize');var moment=require(_0xf732('0x1'));var LIMIT_VALUE=0xfa;exports[_0xf732('0x2')]=function(_0x3e6768){var _0x3ad837=null;if(_0x3e6768){_0x3ad837=_0x3e6768[_0xf732('0x3')](',');}return _0x3ad837;};exports[_0xf732('0x4')]=function(_0xa92ee2,_0x52b622){var _0x50cd1b={};if(!_[_0xf732('0x5')](_0xa92ee2)){_[_0xf732('0x6')](_0xa92ee2,function(_0x4963f6,_0x415cc2){try{if(_0x52b622){var _0x212bd7=_[_0xf732('0x7')](_0x52b622,{'name':_0x415cc2})||{};if(_0x212bd7[_0xf732('0x8')]===_0xf732('0x9')&&_[_0xf732('0xa')](_0x4963f6)){var _0xd56b4a=JSON[_0xf732('0xb')](_0x4963f6);var _0x20f64e={'$gte':moment(moment(_0xd56b4a[_0xf732('0xc')])[_0xf732('0xd')](_0xf732('0xe')))['utc']()['format'](),'$lte':moment(moment(_0xd56b4a[_0xf732('0xf')])[_0xf732('0xd')](_0xf732('0xe')))[_0xf732('0x10')]()[_0xf732('0x11')](0x1,'s')[_0xf732('0xd')]()};_0x50cd1b[_0x415cc2]=_0x20f64e;}else{_0x50cd1b[_0x415cc2]=_[_0xf732('0x12')](_0x4963f6)?_0x4963f6:JSON[_0xf732('0xb')](_0x4963f6);}}else{_0x50cd1b[_0x415cc2]=_[_0xf732('0x12')](_0x4963f6)?_0x4963f6:JSON[_0xf732('0xb')](_0x4963f6);}}catch(_0x3c8319){_0x50cd1b[_0x415cc2]=_0x4963f6[_0xf732('0x3')](',');}});}return _0x50cd1b;};exports[_0xf732('0x13')]=function(_0x5df7a7){_0x5df7a7=parseInt(_0x5df7a7,0xa);if(!_0x5df7a7||_0x5df7a7<0x0){_0x5df7a7=LIMIT_VALUE;}return _0x5df7a7;};exports['offset']=function(_0x2b3942){_0x2b3942=parseInt(_0x2b3942,0xa);if(!_0x2b3942||_0x2b3942<0x0){_0x2b3942=0x0;}return _0x2b3942;};exports[_0xf732('0x14')]=function(_0x394e52){var _0x1a4a12,_0x82057e=null;if(_0x394e52){_0x1a4a12=_0x394e52[_0xf732('0x3')](',');_0x82057e=_[_0xf732('0x15')](_0x1a4a12,function(_0x13d939){if(_0x13d939['indexOf']('-')===0x0){return[_0x13d939===_0xf732('0x16')?sequelize[_0xf732('0x17')](sequelize[_0xf732('0x18')]('priority'),_0xf732('0x19')):_0x13d939['substr'](0x1),_0xf732('0x1a')];}else{return[_0x13d939===_0xf732('0x16')?sequelize['cast'](sequelize[_0xf732('0x18')](_0xf732('0x16')),_0xf732('0x19')):_0x13d939,'ASC'];}});}return _0x82057e;};exports[_0xf732('0x1b')]=function(_0xabb099,_0x44a510){if(_[_0xf732('0x5')](_0xabb099)){return _0xabb099;}if(_[_0xf732('0x12')](_0xabb099)){for(var _0xaa010b=0x0;_0xaa010b<_0xabb099[_0xf732('0x1c')];_0xaa010b+=0x1){_0xabb099[_0xaa010b]=this[_0xf732('0x1b')](_0xabb099[_0xaa010b],_0x44a510);}return _0xabb099;}if(!_[_0xf732('0x1d')](_0xabb099)){return _0xabb099;}if(_['isString'](_0x44a510)){_0x44a510=[_0x44a510];}if(!_[_0xf732('0x12')](_0x44a510)){return _0xabb099;}for(var _0x3bf6a5=0x0;_0x3bf6a5<_0x44a510['length'];_0x3bf6a5+=0x1){_[_0xf732('0x1e')](_0xabb099,_0x44a510[_0x3bf6a5]);}for(var _0x4f294c in _0xabb099){if(_0xabb099['hasOwnProperty'](_0x4f294c)){_0xabb099[_0x4f294c]=this[_0xf732('0x1b')](_0xabb099[_0x4f294c],_0x44a510);}}return _0xabb099;};exports[_0xf732('0x1f')]=function(_0x3c9b9c){return _0x3c9b9c[_0xf732('0x20')](RegExp(_0xf732('0x21')))?!![]:![];};exports[_0xf732('0x22')]=function(_0x1f3a56){return _0x1f3a56[_0xf732('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xf732('0x23')]=function(_0x109534){var _0x3b5cb8=[];_0x109534['split']('\x20')['forEach'](function(_0x3cc27e){_0x3b5cb8[_0xf732('0x24')]('+'+_0x3cc27e[_0xf732('0x25')]()+'*');});return _0x3b5cb8[_0xf732('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index cc101c0..bee708b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8e9=['engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','body-parser','errorhandler','path','passport','./environment','../mysqldb','default','get','env','appPath','root','public','development','test','set','join','use','json\x20replacer','toISOString','split','static','views','/server/views'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0xc8e9,0x8d));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x9c8e('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x9c8e('0x1'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x9c8e('0x2'));var path=require(_0x9c8e('0x3'));var passport=require(_0x9c8e('0x4'));var cors=require('cors');var moment=require('moment');var config=require(_0x9c8e('0x5'));var db=require(_0x9c8e('0x6'))['db'];exports[_0x9c8e('0x7')]=function(_0x28c291){var _0x1ae5af=_0x28c291[_0x9c8e('0x8')](_0x9c8e('0x9'));if(_0x1ae5af==='production'){_0x28c291['set'](_0x9c8e('0xa'),path['join'](config[_0x9c8e('0xb')],_0x9c8e('0xc')));}if(_0x1ae5af===_0x9c8e('0xd')||_0x1ae5af===_0x9c8e('0xe')){_0x28c291[_0x9c8e('0xf')](_0x9c8e('0xa'),path[_0x9c8e('0x10')](config['root'],'client'));_0x28c291[_0x9c8e('0x11')](errorHandler());}_0x28c291[_0x9c8e('0xf')](_0x9c8e('0x12'),function(_0x482ea8,_0x2bbda7){if(this[_0x482ea8]instanceof Date){_0x2bbda7=this[_0x482ea8][_0x9c8e('0x13')]()[_0x9c8e('0x14')]('.')[0x0]+'Z';}return _0x2bbda7;});_0x28c291[_0x9c8e('0x11')](express[_0x9c8e('0x15')](_0x28c291[_0x9c8e('0x8')]('appPath')));_0x28c291[_0x9c8e('0xf')](_0x9c8e('0x16'),config[_0x9c8e('0xb')]+_0x9c8e('0x17'));_0x28c291[_0x9c8e('0x18')](_0x9c8e('0x19'),require(_0x9c8e('0x1a'))[_0x9c8e('0x1b')]);_0x28c291[_0x9c8e('0xf')](_0x9c8e('0x1c'),_0x9c8e('0x19'));_0x28c291['use'](bodyParser[_0x9c8e('0x1d')]({'limit':_0x9c8e('0x1e'),'extended':!![]}));_0x28c291[_0x9c8e('0x11')](bodyParser[_0x9c8e('0x1f')]({'limit':'50mb'}));_0x28c291[_0x9c8e('0x11')](cors());_0x28c291['use'](methodOverride());_0x28c291[_0x9c8e('0x11')](cookieParser());_0x28c291[_0x9c8e('0x11')](passport[_0x9c8e('0x20')]());}; \ No newline at end of file +var _0xf40a=['moment','./environment','../mysqldb','env','production','set','appPath','join','root','public','development','test','use','json\x20replacer','toISOString','static','get','views','/server/views','engine','renderFile','view\x20engine','html','urlencoded','50mb','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors'];(function(_0x29c1cc,_0x5090b2){var _0x56710a=function(_0x2b6926){while(--_0x2b6926){_0x29c1cc['push'](_0x29c1cc['shift']());}};_0x56710a(++_0x5090b2);}(_0xf40a,0x108));var _0xaf40=function(_0x4c60f8,_0x539d3b){_0x4c60f8=_0x4c60f8-0x0;var _0x336f0f=_0xf40a[_0x4c60f8];return _0x336f0f;};'use strict';var express=require(_0xaf40('0x0'));var favicon=require(_0xaf40('0x1'));var bodyParser=require(_0xaf40('0x2'));var methodOverride=require(_0xaf40('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xaf40('0x4'));var path=require(_0xaf40('0x5'));var passport=require(_0xaf40('0x6'));var cors=require(_0xaf40('0x7'));var moment=require(_0xaf40('0x8'));var config=require(_0xaf40('0x9'));var db=require(_0xaf40('0xa'))['db'];exports['default']=function(_0x25aa7b){var _0x118e6f=_0x25aa7b['get'](_0xaf40('0xb'));if(_0x118e6f===_0xaf40('0xc')){_0x25aa7b[_0xaf40('0xd')](_0xaf40('0xe'),path[_0xaf40('0xf')](config[_0xaf40('0x10')],_0xaf40('0x11')));}if(_0x118e6f===_0xaf40('0x12')||_0x118e6f===_0xaf40('0x13')){_0x25aa7b[_0xaf40('0xd')](_0xaf40('0xe'),path[_0xaf40('0xf')](config[_0xaf40('0x10')],'client'));_0x25aa7b[_0xaf40('0x14')](errorHandler());}_0x25aa7b[_0xaf40('0xd')](_0xaf40('0x15'),function(_0x498e55,_0x8e35b4){if(this[_0x498e55]instanceof Date){_0x8e35b4=this[_0x498e55][_0xaf40('0x16')]()['split']('.')[0x0]+'Z';}return _0x8e35b4;});_0x25aa7b['use'](express[_0xaf40('0x17')](_0x25aa7b[_0xaf40('0x18')](_0xaf40('0xe'))));_0x25aa7b[_0xaf40('0xd')](_0xaf40('0x19'),config['root']+_0xaf40('0x1a'));_0x25aa7b[_0xaf40('0x1b')]('html',require('ejs')[_0xaf40('0x1c')]);_0x25aa7b['set'](_0xaf40('0x1d'),_0xaf40('0x1e'));_0x25aa7b['use'](bodyParser[_0xaf40('0x1f')]({'limit':_0xaf40('0x20'),'extended':!![]}));_0x25aa7b[_0xaf40('0x14')](bodyParser['json']({'limit':_0xaf40('0x20')}));_0x25aa7b[_0xaf40('0x14')](cors());_0x25aa7b[_0xaf40('0x14')](methodOverride());_0x25aa7b[_0xaf40('0x14')](cookieParser());_0x25aa7b[_0xaf40('0x14')](passport[_0xaf40('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 50c4fbf..fae4251 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 _0x05bc=['model','join','createHash','md5','digest','hex','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','update','substring','crypto','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map'];(function(_0x56c907,_0x509bf4){var _0x398e77=function(_0x93731){while(--_0x93731){_0x56c907['push'](_0x56c907['shift']());}};_0x398e77(++_0x509bf4);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xc05b('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xc05b('0x1'))[_0xc05b('0x2')];function getInterfaces(){var _0x59d194=[];var _0x36c0ca=os[_0xc05b('0x3')]();var _0xf971c9=_[_0xc05b('0x4')](_[_0xc05b('0x5')](_0x36c0ca));for(var _0x46d195=0x0;_0x46d195<_0xf971c9[_0xc05b('0x6')];_0x46d195++){var _0x22c8db=_0x36c0ca[_0xf971c9[_0x46d195]][_0xc05b('0x7')](function(_0x1b501a){return _0x1b501a[_0xc05b('0x8')]===_0xc05b('0x9')&&_0x1b501a[_0xc05b('0xa')]===![];});_0x59d194=_0x59d194[_0xc05b('0xb')](_0x22c8db);}return _0x59d194;}function getFirstInterface(){var _0x5c13ee=_['head'](getInterfaces());return{'macAddress':_0x5c13ee&&_0x5c13ee[_0xc05b('0xc')]?_0x5c13ee[_0xc05b('0xc')]:_0xc05b('0xd'),'ipAddress':_0x5c13ee&&_0x5c13ee[_0xc05b('0xe')]?_0x5c13ee[_0xc05b('0xe')]:_0xc05b('0xf')};}exports[_0xc05b('0x10')]=getFirstInterface;function getCPUhash(){var _0x3c6cdd=_[_0xc05b('0x4')](os['cpus']()[_0xc05b('0x11')](function(_0x409384){return _0x409384[_0xc05b('0x12')];}))[_0xc05b('0x13')](':');return crypto[_0xc05b('0x14')](_0xc05b('0x15'))['update'](_0x3c6cdd)[_0xc05b('0x16')](_0xc05b('0x17'));}exports['getUuid']=function(){switch(os['platform']()){case _0xc05b('0x18'):return exec(_0xc05b('0x19'),{'encoding':_0xc05b('0x1a')})[_0xc05b('0x1b')]('\x0d\x0a','');default:var _0x387036=getFirstInterface();var _0x21435e=getCPUhash();var _0xe94a8f=_0x21435e+'|'+os['hostname']()+'|'+_0x387036[_0xc05b('0x1c')]+'|'+_0x387036[_0xc05b('0x1d')];var _0xee4d8=crypto[_0xc05b('0x14')](_0xc05b('0x15'))[_0xc05b('0x1e')](_0xe94a8f)['digest'](_0xc05b('0x17'));return _0xee4d8['substring'](0x0,0x8)+'-'+_0xee4d8[_0xc05b('0x1f')](0x8,0xc)+'-'+_0xee4d8[_0xc05b('0x1f')](0xc,0x10)+'-'+_0xee4d8[_0xc05b('0x1f')](0x10,0x14)+'-'+_0xee4d8[_0xc05b('0x1f')](0x14);}}; \ No newline at end of file +var _0x81d4=['127.0.0.1','getFirstInterface','cpus','map','join','update','digest','hex','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','crypto','bimedia-machine-uuid','execSync','orderBy','keys','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address'];(function(_0x5a65c1,_0xea1e75){var _0x346660=function(_0xa352ae){while(--_0xa352ae){_0x5a65c1['push'](_0x5a65c1['shift']());}};_0x346660(++_0xea1e75);}(_0x81d4,0x197));var _0x481d=function(_0x26f77f,_0x28dbb9){_0x26f77f=_0x26f77f-0x0;var _0x348d51=_0x81d4[_0x26f77f];return _0x348d51;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x481d('0x0'));var machine=require(_0x481d('0x1'));var exec=require('child_process')[_0x481d('0x2')];function getInterfaces(){var _0x369cf6=[];var _0x266766=os['networkInterfaces']();var _0x5af777=_[_0x481d('0x3')](_[_0x481d('0x4')](_0x266766));for(var _0x2ecf40=0x0;_0x2ecf40<_0x5af777['length'];_0x2ecf40++){var _0x1ef8ca=_0x266766[_0x5af777[_0x2ecf40]][_0x481d('0x5')](function(_0x2f91fd){return _0x2f91fd[_0x481d('0x6')]===_0x481d('0x7')&&_0x2f91fd[_0x481d('0x8')]===![];});_0x369cf6=_0x369cf6['concat'](_0x1ef8ca);}return _0x369cf6;}function getFirstInterface(){var _0x3b7273=_[_0x481d('0x9')](getInterfaces());return{'macAddress':_0x3b7273&&_0x3b7273[_0x481d('0xa')]?_0x3b7273['mac']:_0x481d('0xb'),'ipAddress':_0x3b7273&&_0x3b7273[_0x481d('0xc')]?_0x3b7273['address']:_0x481d('0xd')};}exports[_0x481d('0xe')]=getFirstInterface;function getCPUhash(){var _0x22f802=_[_0x481d('0x3')](os[_0x481d('0xf')]()[_0x481d('0x10')](function(_0x9c7a08){return _0x9c7a08['model'];}))[_0x481d('0x11')](':');return crypto['createHash']('md5')[_0x481d('0x12')](_0x22f802)[_0x481d('0x13')](_0x481d('0x14'));}exports['getUuid']=function(){switch(os[_0x481d('0x15')]()){case'win32':return exec(_0x481d('0x16'),{'encoding':_0x481d('0x17')})[_0x481d('0x18')]('\x0d\x0a','');default:var _0x1bda12=getFirstInterface();var _0x879e29=getCPUhash();var _0x59c5d5=_0x879e29+'|'+os[_0x481d('0x19')]()+'|'+_0x1bda12[_0x481d('0x1a')]+'|'+_0x1bda12[_0x481d('0x1b')];var _0x4f399b=crypto[_0x481d('0x1c')]('md5')[_0x481d('0x12')](_0x59c5d5)['digest'](_0x481d('0x14'));return _0x4f399b['substring'](0x0,0x8)+'-'+_0x4f399b[_0x481d('0x1d')](0x8,0xc)+'-'+_0x4f399b['substring'](0xc,0x10)+'-'+_0x4f399b[_0x481d('0x1d')](0x10,0x14)+'-'+_0x4f399b['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c9bbc7b..740cb6e 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 _0xb4b6=['data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','createCipher','aes-256-ctr','secrets','update','utf8','base64','createDecipher','session','final','||FIELD||VALUE||\x0a','User','findOne','fullname','email','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','Alert','get','active'];(function(_0x5534fe,_0x43c22e){var _0x3d1dc2=function(_0x9df12){while(--_0x9df12){_0x5534fe['push'](_0x5534fe['shift']());}};_0x3d1dc2(++_0x43c22e);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x3c40c5,_0x169512){_0x3c40c5=_0x3c40c5-0x0;var _0xb7ca40=_0xb4b6[_0x3c40c5];return _0xb7ca40;};'use strict';var util=require('util');var crypto=require(_0x6b4b('0x0'));var moment=require(_0x6b4b('0x1'));var rp=require(_0x6b4b('0x2'));var BPromise=require(_0x6b4b('0x3'));var pkginfo=require(_0x6b4b('0x4'))(module,_0x6b4b('0x5'));var db=require(_0x6b4b('0x6'))['db'];var config=require(_0x6b4b('0x7'));var hardware=require(_0x6b4b('0x8'));var logger=require('../logger')(_0x6b4b('0x9'));var jira=require('../../api/jira/jira.controller');var HOST=_0x6b4b('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x25eef2){return new BPromise(function(_0x8b279d,_0x127577){var _0x2e6b81=util['format'](_0x6b4b('0xb'),HOST,_0x25eef2,module[_0x6b4b('0xc')][_0x6b4b('0x5')]);if(oldToken){_0x2e6b81=util[_0x6b4b('0xd')](_0x6b4b('0xe'),HOST,_0x25eef2,module[_0x6b4b('0xc')][_0x6b4b('0x5')],oldToken);}var _0x214ebb={'uri':_0x2e6b81,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x214ebb)[_0x6b4b('0xf')](function(_0x4ab06f){_0x8b279d(_0x4ab06f);})[_0x6b4b('0x10')](function(_0x2f5ada){_0x127577(_0x2f5ada);});});}function encryptDate(_0x45eaa4){var _0x2ba8a0=crypto[_0x6b4b('0x11')](_0x6b4b('0x12'),config[_0x6b4b('0x13')]['session']);var _0x38c40f=_0x2ba8a0[_0x6b4b('0x14')](_0x45eaa4,_0x6b4b('0x15'),'base64');_0x38c40f+=_0x2ba8a0['final'](_0x6b4b('0x16'));return _0x38c40f;}function decryptDate(_0x2bf3fe){var _0x5bf378=crypto[_0x6b4b('0x17')](_0x6b4b('0x12'),config[_0x6b4b('0x13')][_0x6b4b('0x18')]);var _0x22a176=_0x5bf378[_0x6b4b('0x14')](_0x2bf3fe,_0x6b4b('0x16'),_0x6b4b('0x15'));_0x22a176+=_0x5bf378[_0x6b4b('0x19')]('utf8');return _0x22a176;}function sendJiraAlert(_0x5a1afc,_0x26b9b4,_0x5b37ce){var _0x22f142=_0x6b4b('0x1a');return db[_0x6b4b('0x1b')][_0x6b4b('0x1c')]({'where':{'role':'admin'},'attributes':[_0x6b4b('0x1d'),_0x6b4b('0x1e')],'raw':!![]})['then'](function(_0x5ecffb){ADMIN=_0x5ecffb;_0x22f142+='|reason|'+_0x5b37ce+'|\x0a';_0x22f142+=_0x6b4b('0x1f')+_0x5a1afc+'|\x0a';_0x22f142+=_0x6b4b('0x20')+_0x26b9b4+'|\x0a';_0x22f142+=_0x6b4b('0x21')+ADMIN[_0x6b4b('0x1d')]+'|\x0a';_0x22f142+=_0x6b4b('0x22')+ADMIN['email']+'|\x0a';return _0x22f142;})[_0x6b4b('0xf')](function(_0xbee434){var _0x3a0376=hardware[_0x6b4b('0x23')]()['ipAddress'];return jira['openIssue']({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0xbee434,'issuetype':_0x6b4b('0x24'),'oldToken':_0x5a1afc,'newToken':_0x26b9b4,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x3a0376});});}function manageLicense(_0x24e78a,_0x2cbe79){var _0x46580b=_0x2cbe79[_0x6b4b('0x25')]({'plain':!![]});httpRequest(_0x24e78a)['then'](function(_0x4eff56){if(oldToken){oldToken=undefined;}if(_0x4eff56[_0x6b4b('0x26')]){if(!_0x46580b[_0x6b4b('0x9')]&&_0x46580b[_0x6b4b('0x9')]!=_0x4eff56[_0x6b4b('0x9')]||_0x46580b['license']&&_0x46580b[_0x6b4b('0x27')]){logger['info'](_0x6b4b('0x28'));}if(_0x46580b[_0x6b4b('0x9')]&&!_0x46580b[_0x6b4b('0x27')]&&_0x46580b['license']!=_0x4eff56[_0x6b4b('0x9')]){logger[_0x6b4b('0x29')](_0x6b4b('0x2a'));}if(_0x46580b[_0x6b4b('0x9')]&&!_0x46580b[_0x6b4b('0x27')]&&_0x46580b[_0x6b4b('0x9')]==_0x4eff56['license']){return _0x2cbe79;}return _0x2cbe79['update']({'data1':_0x24e78a,'data2':null,'license':_0x4eff56['license']});}else{if(_0x4eff56[_0x6b4b('0x9')]||_0x46580b[_0x6b4b('0x9')]){if(!_0x46580b[_0x6b4b('0x27')]){if(_0x46580b[_0x6b4b('0x2b')]==_0x24e78a){GRAY_PERIOD_REASON=_0x6b4b('0x2c');logger[_0x6b4b('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x46580b['data1'];logger[_0x6b4b('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x46580b[_0x6b4b('0x2b')],_0x24e78a);}sendJiraAlert(_0x46580b['data1'],_0x4eff56['uuid'],GRAY_PERIOD_REASON);logger['info'](_0x6b4b('0x2d'),GRAY_PERIOD_REASON[_0x6b4b('0x2e')](),moment()[_0x6b4b('0xd')](_0x6b4b('0x2f')));return _0x2cbe79[_0x6b4b('0x14')]({'data2':encryptDate(moment()['format'](_0x6b4b('0x2f')))});}else{if(moment()['diff'](decryptDate(_0x46580b[_0x6b4b('0x27')]),'days')>DAYS){logger[_0x6b4b('0x29')](_0x6b4b('0x30'),moment()[_0x6b4b('0xd')]('YYYY-MM-DD\x20HH:mm'));return _0x2cbe79[_0x6b4b('0x14')]({'data1':_0x24e78a,'data2':null,'license':null});}}}else{if(_0x46580b[_0x6b4b('0x2b')]!=_0x24e78a){logger[_0x6b4b('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x46580b['data1'],_0x24e78a);return _0x2cbe79[_0x6b4b('0x14')]({'data1':_0x24e78a,'data2':null,'license':null});}}}return _0x2cbe79;})[_0x6b4b('0xf')](function(_0x1fc8a3){_0x2cbe79=_0x1fc8a3;})[_0x6b4b('0x10')](function(_0x3b4237){logger[_0x6b4b('0x31')](_0x3b4237['message']);})[_0x6b4b('0x32')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2cbe79);},TIME);});}function defaultLicense(){var _0x287ba8=hardware[_0x6b4b('0x33')]();if(_0x287ba8){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x287ba8}})['spread'](function(_0x3f4016,_0xda8ef3){logger[_0x6b4b('0x29')](_0x6b4b('0x34'),_0x287ba8);manageLicense(_0x287ba8,_0x3f4016);})[_0x6b4b('0x10')](function(_0x3089a0){logger[_0x6b4b('0x31')](_0x3089a0[_0x6b4b('0x35')]);});}}exports[_0x6b4b('0x36')]=defaultLicense; \ No newline at end of file +var _0xa2cb=['SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','crypto','request-promise','bluebird','pkginfo','version','../../mysqldb','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','createDecipher','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','findOrCreate','spread'];(function(_0x5229a1,_0x5349f8){var _0xc4cb55=function(_0x211269){while(--_0x211269){_0x5229a1['push'](_0x5229a1['shift']());}};_0xc4cb55(++_0x5349f8);}(_0xa2cb,0x7d));var _0xba2c=function(_0x447d6a,_0x549700){_0x447d6a=_0x447d6a-0x0;var _0x3d6303=_0xa2cb[_0x447d6a];return _0x3d6303;};'use strict';var util=require(_0xba2c('0x0'));var crypto=require(_0xba2c('0x1'));var moment=require('moment');var rp=require(_0xba2c('0x2'));var BPromise=require(_0xba2c('0x3'));var pkginfo=require(_0xba2c('0x4'))(module,_0xba2c('0x5'));var db=require(_0xba2c('0x6'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require('../logger')('license');var jira=require('../../api/jira/jira.controller');var HOST=_0xba2c('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x54e503){return new BPromise(function(_0x19c898,_0x525698){var _0x747ceb=util[_0xba2c('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x54e503,module[_0xba2c('0x9')][_0xba2c('0x5')]);if(oldToken){_0x747ceb=util['format'](_0xba2c('0xa'),HOST,_0x54e503,module[_0xba2c('0x9')][_0xba2c('0x5')],oldToken);}var _0x15781e={'uri':_0x747ceb,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x15781e)[_0xba2c('0xb')](function(_0x1d2146){_0x19c898(_0x1d2146);})[_0xba2c('0xc')](function(_0xd1e9d2){_0x525698(_0xd1e9d2);});});}function encryptDate(_0x2b7d82){var _0x400762=crypto[_0xba2c('0xd')](_0xba2c('0xe'),config[_0xba2c('0xf')][_0xba2c('0x10')]);var _0x4bc646=_0x400762[_0xba2c('0x11')](_0x2b7d82,_0xba2c('0x12'),_0xba2c('0x13'));_0x4bc646+=_0x400762[_0xba2c('0x14')](_0xba2c('0x13'));return _0x4bc646;}function decryptDate(_0x12794c){var _0x3fdb17=crypto[_0xba2c('0x15')](_0xba2c('0xe'),config['secrets'][_0xba2c('0x10')]);var _0x125b5e=_0x3fdb17[_0xba2c('0x11')](_0x12794c,_0xba2c('0x13'),_0xba2c('0x12'));_0x125b5e+=_0x3fdb17['final'](_0xba2c('0x12'));return _0x125b5e;}function sendJiraAlert(_0xe2e0d5,_0x555c1e,_0x596599){var _0x522496='||FIELD||VALUE||\x0a';return db[_0xba2c('0x16')][_0xba2c('0x17')]({'where':{'role':_0xba2c('0x18')},'attributes':[_0xba2c('0x19'),_0xba2c('0x1a')],'raw':!![]})[_0xba2c('0xb')](function(_0x2327e1){ADMIN=_0x2327e1;_0x522496+=_0xba2c('0x1b')+_0x596599+'|\x0a';_0x522496+=_0xba2c('0x1c')+_0xe2e0d5+'|\x0a';_0x522496+=_0xba2c('0x1d')+_0x555c1e+'|\x0a';_0x522496+=_0xba2c('0x1e')+ADMIN[_0xba2c('0x19')]+'|\x0a';_0x522496+=_0xba2c('0x1f')+ADMIN[_0xba2c('0x1a')]+'|\x0a';return _0x522496;})[_0xba2c('0xb')](function(_0x45a296){var _0x29eee0=hardware[_0xba2c('0x20')]()['ipAddress'];return jira[_0xba2c('0x21')]({'key':_0xba2c('0x22'),'summary':_0xba2c('0x23'),'description':_0x45a296,'issuetype':_0xba2c('0x24'),'oldToken':_0xe2e0d5,'newToken':_0x555c1e,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x29eee0});});}function manageLicense(_0x199b1d,_0x4f509f){var _0x25e164=_0x4f509f[_0xba2c('0x25')]({'plain':!![]});httpRequest(_0x199b1d)[_0xba2c('0xb')](function(_0x3a541b){if(oldToken){oldToken=undefined;}if(_0x3a541b[_0xba2c('0x26')]){if(!_0x25e164[_0xba2c('0x27')]&&_0x25e164['license']!=_0x3a541b['license']||_0x25e164[_0xba2c('0x27')]&&_0x25e164[_0xba2c('0x28')]){logger[_0xba2c('0x29')](_0xba2c('0x2a'));}if(_0x25e164[_0xba2c('0x27')]&&!_0x25e164[_0xba2c('0x28')]&&_0x25e164[_0xba2c('0x27')]!=_0x3a541b[_0xba2c('0x27')]){logger[_0xba2c('0x29')](_0xba2c('0x2b'));}if(_0x25e164[_0xba2c('0x27')]&&!_0x25e164[_0xba2c('0x28')]&&_0x25e164[_0xba2c('0x27')]==_0x3a541b[_0xba2c('0x27')]){return _0x4f509f;}return _0x4f509f[_0xba2c('0x11')]({'data1':_0x199b1d,'data2':null,'license':_0x3a541b[_0xba2c('0x27')]});}else{if(_0x3a541b[_0xba2c('0x27')]||_0x25e164[_0xba2c('0x27')]){if(!_0x25e164[_0xba2c('0x28')]){if(_0x25e164[_0xba2c('0x2c')]==_0x199b1d){GRAY_PERIOD_REASON=_0xba2c('0x2d');logger[_0xba2c('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xba2c('0x2e');oldToken=_0x25e164['data1'];logger[_0xba2c('0x29')](_0xba2c('0x2f'),_0x25e164[_0xba2c('0x2c')],_0x199b1d);}sendJiraAlert(_0x25e164[_0xba2c('0x2c')],_0x3a541b[_0xba2c('0x30')],GRAY_PERIOD_REASON);logger[_0xba2c('0x29')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xba2c('0x31')](),moment()[_0xba2c('0x8')](_0xba2c('0x32')));return _0x4f509f[_0xba2c('0x11')]({'data2':encryptDate(moment()[_0xba2c('0x8')](_0xba2c('0x32')))});}else{if(moment()[_0xba2c('0x33')](decryptDate(_0x25e164[_0xba2c('0x28')]),_0xba2c('0x34'))>DAYS){logger['info'](_0xba2c('0x35'),moment()[_0xba2c('0x8')](_0xba2c('0x32')));return _0x4f509f['update']({'data1':_0x199b1d,'data2':null,'license':null});}}}else{if(_0x25e164[_0xba2c('0x2c')]!=_0x199b1d){logger[_0xba2c('0x29')](_0xba2c('0x2f'),_0x25e164[_0xba2c('0x2c')],_0x199b1d);return _0x4f509f['update']({'data1':_0x199b1d,'data2':null,'license':null});}}}return _0x4f509f;})['then'](function(_0xa48958){_0x4f509f=_0xa48958;})['catch'](function(_0x12bc74){logger['error'](_0x12bc74['message']);})[_0xba2c('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0xba2c('0x37')](),_0x4f509f);},TIME);});}function defaultLicense(){var _0x1d1334=hardware[_0xba2c('0x37')]();if(_0x1d1334){return db['License'][_0xba2c('0x38')]({'where':{'id':0x1},'defaults':{'data1':_0x1d1334}})[_0xba2c('0x39')](function(_0x19266a,_0x5e35b6){logger[_0xba2c('0x29')](_0xba2c('0x3a'),_0x1d1334);manageLicense(_0x1d1334,_0x19266a);})[_0xba2c('0xc')](function(_0x146300){logger[_0xba2c('0x3b')](_0x146300['message']);});}}exports[_0xba2c('0x3c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f7e0279..8e03aad 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 _0x5bd3=['find','defaults','then','moment','../environment','../../mysqldb','license','data1','split','aes-256-ctr','format','update','base64','utf8','final','parse','demo','uuid','machineUuid','createDecipher','session','gray','deadline','add','grayReason','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','Demo\x20license','getLicense','License'];(function(_0x2d7cba,_0x3d9b5f){var _0x182d03=function(_0xd2d3c0){while(--_0xd2d3c0){_0x2d7cba['push'](_0x2d7cba['shift']());}};_0x182d03(++_0x3d9b5f);}(_0x5bd3,0x1a3));var _0x35bd=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5bd3[_0x40a045];return _0x1a687c;};'use strict';var crypto=require('crypto');var util=require('util');var _=require('lodash');var moment=require(_0x35bd('0x0'));var hardware=require('./hardware');var config=require(_0x35bd('0x1'));var db=require(_0x35bd('0x2'))['db'];function checkLicense(_0xb918bf,_0x4ee873){if(_0xb918bf){try{var _0x465640=_0x4ee873||_0xb918bf[_0x35bd('0x3')];if(_['isEmpty'](_0x465640)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x189107=_0xb918bf[_0x35bd('0x4')];var _0x12587d=_0xb918bf['data2'];var _0x2a0934=_0x189107[_0x35bd('0x5')]('-')[0x4];var _0x40fed1=_0x189107[_0x35bd('0x5')]('-')[0x0];var _0x28bf03=crypto['createDecipher'](_0x35bd('0x6'),util[_0x35bd('0x7')]('%s:%s:%s',_0x2a0934,_0x189107,_0x40fed1));var _0x38f8e9=_0x28bf03[_0x35bd('0x8')](_0x465640,_0x35bd('0x9'),_0x35bd('0xa'));_0x38f8e9+=_0x28bf03[_0x35bd('0xb')](_0x35bd('0xa'));var _0x1c0c7f=JSON[_0x35bd('0xc')](_0x38f8e9);_0x1c0c7f[_0x35bd('0xd')]=![];_0x1c0c7f[_0x35bd('0xe')]=_0x189107;_0x1c0c7f[_0x35bd('0xf')]=hardware['getUuid']();if(_0x12587d){var _0x448148=crypto[_0x35bd('0x10')](_0x35bd('0x6'),config['secrets'][_0x35bd('0x11')]);var _0x42f10e=_0x448148[_0x35bd('0x8')](_0x12587d,_0x35bd('0x9'),_0x35bd('0xa'));_0x42f10e+=_0x448148['final']('utf8');_0x1c0c7f[_0x35bd('0x12')]=_0x42f10e;_0x1c0c7f[_0x35bd('0x13')]=moment(_0x42f10e)[_0x35bd('0x14')](0x7,'days')[_0x35bd('0x7')]();_0x1c0c7f[_0x35bd('0x15')]=_0x1c0c7f[_0x35bd('0xe')]!=_0x1c0c7f[_0x35bd('0xf')]?_0x35bd('0x16'):'disabled';}return _0x1c0c7f;}catch(_0xc432cc){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x35bd('0x17'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x35bd('0x18'),'uuid':_0xb918bf[_0x35bd('0x4')],'machineUuid':hardware[_0x35bd('0x19')](),'message':_0xc432cc['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x35bd('0x17'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x35bd('0x1a'),'uuid':_0xb918bf[_0x35bd('0x4')],'machineUuid':hardware[_0x35bd('0x19')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x35bd('0x1b')]=function(_0x362ad1){return db[_0x35bd('0x1c')][_0x35bd('0x1d')](_[_0x35bd('0x1e')](_0x362ad1,{'raw':!![],'where':{'id':0x1}}))[_0x35bd('0x1f')](function(_0x438488){return checkLicense(_0x438488,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x81a8=['aes-256-ctr','format','base64','final','utf8','uuid','machineUuid','getUuid','gray','deadline','add','days','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getLicense','License','find','defaults','then','checkLicense','crypto','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher'];(function(_0x2b2c76,_0x170c66){var _0x4a071b=function(_0xa1a54e){while(--_0xa1a54e){_0x2b2c76['push'](_0x2b2c76['shift']());}};_0x4a071b(++_0x170c66);}(_0x81a8,0x151));var _0x881a=function(_0x3d368b,_0xbbc5db){_0x3d368b=_0x3d368b-0x0;var _0x579af1=_0x81a8[_0x3d368b];return _0x579af1;};'use strict';var crypto=require(_0x881a('0x0'));var util=require('util');var _=require(_0x881a('0x1'));var moment=require(_0x881a('0x2'));var hardware=require(_0x881a('0x3'));var config=require(_0x881a('0x4'));var db=require(_0x881a('0x5'))['db'];function checkLicense(_0x1089f3,_0x3abda2){if(_0x1089f3){try{var _0x222969=_0x3abda2||_0x1089f3[_0x881a('0x6')];if(_[_0x881a('0x7')](_0x222969)){throw new Error(_0x881a('0x8'));}var _0x393e97=_0x1089f3[_0x881a('0x9')];var _0x439df5=_0x1089f3[_0x881a('0xa')];var _0x32ecf0=_0x393e97['split']('-')[0x4];var _0x55c26e=_0x393e97[_0x881a('0xb')]('-')[0x0];var _0x9d39e9=crypto[_0x881a('0xc')](_0x881a('0xd'),util[_0x881a('0xe')]('%s:%s:%s',_0x32ecf0,_0x393e97,_0x55c26e));var _0x47ece0=_0x9d39e9['update'](_0x222969,_0x881a('0xf'),'utf8');_0x47ece0+=_0x9d39e9[_0x881a('0x10')](_0x881a('0x11'));var _0x508d5d=JSON['parse'](_0x47ece0);_0x508d5d['demo']=![];_0x508d5d[_0x881a('0x12')]=_0x393e97;_0x508d5d[_0x881a('0x13')]=hardware[_0x881a('0x14')]();if(_0x439df5){var _0x58c6a5=crypto[_0x881a('0xc')](_0x881a('0xd'),config['secrets']['session']);var _0xa54097=_0x58c6a5['update'](_0x439df5,_0x881a('0xf'),_0x881a('0x11'));_0xa54097+=_0x58c6a5[_0x881a('0x10')]('utf8');_0x508d5d[_0x881a('0x15')]=_0xa54097;_0x508d5d[_0x881a('0x16')]=moment(_0xa54097)[_0x881a('0x17')](0x7,_0x881a('0x18'))['format']();_0x508d5d['grayReason']=_0x508d5d[_0x881a('0x12')]!=_0x508d5d[_0x881a('0x13')]?_0x881a('0x19'):'disabled';}return _0x508d5d;}catch(_0x296612){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x881a('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x881a('0x1b'),'uuid':_0x1089f3['data1'],'machineUuid':hardware[_0x881a('0x14')](),'message':_0x296612[_0x881a('0x1c')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x881a('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x1089f3[_0x881a('0x9')],'machineUuid':hardware[_0x881a('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x881a('0x1d')]=function(_0x3f7c08){return db[_0x881a('0x1e')][_0x881a('0x1f')](_[_0x881a('0x20')](_0x3f7c08,{'raw':!![],'where':{'id':0x1}}))[_0x881a('0x21')](function(_0x5c0083){return checkLicense(_0x5c0083,null);});};exports[_0x881a('0x22')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2bfd0df..6269fd9 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 _0x720f=['secret','exports'];(function(_0x185063,_0x3f0bb7){var _0x16d9d3=function(_0x1b3fe3){while(--_0x1b3fe3){_0x185063['push'](_0x185063['shift']());}};_0x16d9d3(++_0x3f0bb7);}(_0x720f,0x185));var _0xf720=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x720f[_0x5b561d];return _0x431060;};'use strict';module[_0xf720('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xf720('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xbd23=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd23,0x7b));var _0x3bd2=function(_0x2801af,_0x1ef845){_0x2801af=_0x2801af-0x0;var _0x323d64=_0xbd23[_0x2801af];return _0x323d64;};'use strict';module[_0x3bd2('0x0')]={'DOMAIN':_0x3bd2('0x1'),'SESSION_SECRET':_0x3bd2('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x3bd2('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 5f5fe10..da87d6a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6417=['File','info','Console','env','debugLevel','winston','util','path','INFO','xcally','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','%s-%s','error'];(function(_0x57dfda,_0x481efe){var _0x1ab0a5=function(_0x3f0f02){while(--_0x3f0f02){_0x57dfda['push'](_0x57dfda['shift']());}};_0x1ab0a5(++_0x481efe);}(_0x6417,0x11d));var _0x7641=function(_0x474d72,_0x29a688){_0x474d72=_0x474d72-0x0;var _0x2b7b59=_0x6417[_0x474d72];return _0x2b7b59;};'use strict';var moment=require('moment');var winston=require(_0x7641('0x0'));var util=require(_0x7641('0x1'));var path=require(_0x7641('0x2'));var debugLevel=_0x7641('0x3');function filename(_0x2c179d,_0xba640c){return path['join']('/var','log',_0x7641('0x4'),util[_0x7641('0x5')]('%s-%s.log',_0x2c179d,_0xba640c));}function formatter(_0x2d1f9f,_0xf09a2){return util[_0x7641('0x5')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x7641('0x5')](_0x7641('0x6')),_0xf09a2[_0x7641('0x7')][_0x7641('0x8')](),_0x2d1f9f,_0xf09a2[_0x7641('0x9')]);}module[_0x7641('0xa')]=function(_0x4cfd37){return new winston[(_0x7641('0xb'))]({'transports':[new winston[(_0x7641('0xc'))]['File']({'name':util[_0x7641('0x5')](_0x7641('0xd'),_0x4cfd37,'error'),'filename':filename(_0x4cfd37,_0x7641('0xe')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a0b5f){return formatter(_0x4cfd37,_0x5a0b5f);}}),new winston['transports'][(_0x7641('0xf'))]({'name':util[_0x7641('0x5')](_0x7641('0xd'),_0x4cfd37,_0x7641('0x10')),'filename':filename(_0x4cfd37,'info'),'level':_0x7641('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xad8cba){return formatter(_0x4cfd37,_0xad8cba);}}),new winston['transports'][(_0x7641('0x11'))]({'level':process[_0x7641('0x12')][_0x7641('0x13')]||debugLevel,'json':![],'formatter':function(_0x2cfc65){return formatter(_0x4cfd37,_0x2cfc65);}})]});}; \ No newline at end of file +var _0x67fb=['/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','message','exports','transports','File','%s-%s','error','info','env','debugLevel','moment','util','path','INFO','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67fb,0x113));var _0xb67f=function(_0x2d4878,_0x3a0b4f){_0x2d4878=_0x2d4878-0x0;var _0x20c791=_0x67fb[_0x2d4878];return _0x20c791;};'use strict';var moment=require(_0xb67f('0x0'));var winston=require('winston');var util=require(_0xb67f('0x1'));var path=require(_0xb67f('0x2'));var debugLevel=_0xb67f('0x3');function filename(_0x2ff4c9,_0x1260f0){return path[_0xb67f('0x4')](_0xb67f('0x5'),_0xb67f('0x6'),_0xb67f('0x7'),util[_0xb67f('0x8')]('%s-%s.log',_0x2ff4c9,_0x1260f0));}function formatter(_0x360bfa,_0x437c1e){return util[_0xb67f('0x8')](_0xb67f('0x9'),moment()[_0xb67f('0x8')](_0xb67f('0xa')),_0x437c1e['level']['toUpperCase'](),_0x360bfa,_0x437c1e[_0xb67f('0xb')]);}module[_0xb67f('0xc')]=function(_0x2a371c){return new winston['Logger']({'transports':[new winston[(_0xb67f('0xd'))][(_0xb67f('0xe'))]({'name':util[_0xb67f('0x8')](_0xb67f('0xf'),_0x2a371c,_0xb67f('0x10')),'filename':filename(_0x2a371c,_0xb67f('0x10')),'level':_0xb67f('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x29b0d1){return formatter(_0x2a371c,_0x29b0d1);}}),new winston['transports'][(_0xb67f('0xe'))]({'name':util[_0xb67f('0x8')]('%s-%s',_0x2a371c,_0xb67f('0x11')),'filename':filename(_0x2a371c,_0xb67f('0x11')),'level':_0xb67f('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e5078){return formatter(_0x2a371c,_0x5e5078);}}),new winston[(_0xb67f('0xd'))]['Console']({'level':process[_0xb67f('0x12')][_0xb67f('0x13')]||debugLevel,'json':![],'formatter':function(_0x39cb08){return formatter(_0x2a371c,_0x39cb08);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6558eeb..a5eace3 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 _0x2560=['join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x12e0b7,_0x16f526){var _0x5d3e14=function(_0x3e7ee4){while(--_0x3e7ee4){_0x12e0b7['push'](_0x12e0b7['shift']());}};_0x5d3e14(++_0x16f526);}(_0x2560,0x9a));var _0x0256=function(_0x41d15a,_0x5cab32){_0x41d15a=_0x41d15a-0x0;var _0x5df561=_0x2560[_0x41d15a];return _0x5df561;};'use strict';var path=require(_0x0256('0x0'));var os=require('os');var config={'apps':[{'name':_0x0256('0x1'),'script':path[_0x0256('0x2')](__dirname,_0x0256('0x3'))},{'name':_0x0256('0x4'),'script':path[_0x0256('0x2')](__dirname,_0x0256('0x5'))},{'name':_0x0256('0x6'),'script':path[_0x0256('0x2')](__dirname,_0x0256('0x7'))},{'name':'email','script':path[_0x0256('0x2')](__dirname,_0x0256('0x8'))},{'name':_0x0256('0x9'),'script':path[_0x0256('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x0256('0xa'),'script':path['join'](__dirname,_0x0256('0xb'))}]};module[_0x0256('0xc')]=config; \ No newline at end of file +var _0x4156=['exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','xdr'];(function(_0x389b2f,_0x363fec){var _0x1804ff=function(_0x1ace26){while(--_0x1ace26){_0x389b2f['push'](_0x389b2f['shift']());}};_0x1804ff(++_0x363fec);}(_0x4156,0xf1));var _0x6415=function(_0x3c1166,_0x134460){_0x3c1166=_0x3c1166-0x0;var _0x31e004=_0x4156[_0x3c1166];return _0x31e004;};'use strict';var path=require(_0x6415('0x0'));var os=require('os');var config={'apps':[{'name':_0x6415('0x1'),'script':path[_0x6415('0x2')](__dirname,_0x6415('0x3'))},{'name':_0x6415('0x4'),'script':path['join'](__dirname,_0x6415('0x5'))},{'name':_0x6415('0x6'),'script':path[_0x6415('0x2')](__dirname,_0x6415('0x7'))},{'name':_0x6415('0x8'),'script':path[_0x6415('0x2')](__dirname,_0x6415('0x9'))},{'name':'routing','script':path[_0x6415('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x6415('0xa'),'script':path[_0x6415('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x6415('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index aa25e83..405bb40 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 _0xaa5c=['describe','delete','dump','saved','pm2','bluebird','./config','start','disconnect','stop','restart','then','list'];(function(_0x457bf8,_0x209a0a){var _0x919f94=function(_0x4fc50c){while(--_0x4fc50c){_0x457bf8['push'](_0x457bf8['shift']());}};_0x919f94(++_0x209a0a);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x41b8de,_0x2113e2){_0x41b8de=_0x41b8de-0x0;var _0x462d67=_0xaa5c[_0x41b8de];return _0x462d67;};'use strict';var pm2=require(_0xcaa5('0x0'));var BPromise=require(_0xcaa5('0x1'));var config=require(_0xcaa5('0x2'));function connect(){return new BPromise(function(_0xecb40a,_0x54ad1c){return pm2['connect'](function(_0x5c4f66){if(_0x5c4f66){return _0x54ad1c(_0x5c4f66);}return _0xecb40a('connected');});});};exports[_0xcaa5('0x3')]=function(_0x4d1b66){return connect()['then'](function(){return new BPromise(function(_0x2f6bb0,_0x42afd4){return pm2[_0xcaa5('0x3')](_0x4d1b66,function(_0x5f56bc,_0x3d0a81){if(_0x5f56bc){return _0x42afd4(_0x5f56bc);}pm2[_0xcaa5('0x4')]();return _0x2f6bb0(_0x3d0a81);});});});};exports[_0xcaa5('0x5')]=function(_0x1b8683){return connect()['then'](function(){return new BPromise(function(_0xce54c8,_0x11b4d1){return pm2['stop'](_0x1b8683,function(_0x559041,_0x283f07){if(_0x559041){return _0x11b4d1(_0x559041);}pm2[_0xcaa5('0x4')]();return _0xce54c8(_0x283f07);});});});};exports[_0xcaa5('0x6')]=function(_0x52481f){return connect()[_0xcaa5('0x7')](function(){return new BPromise(function(_0x57bf00,_0x3bf106){return pm2[_0xcaa5('0x6')](_0x52481f,function(_0xba44bd,_0x3b8783){if(_0xba44bd){return _0x3bf106(_0xba44bd);}pm2[_0xcaa5('0x4')]();return _0x57bf00(_0x3b8783);});});});};exports[_0xcaa5('0x8')]=function(){return connect()[_0xcaa5('0x7')](function(){return new BPromise(function(_0x4bf6f7,_0x2f78a6){return pm2[_0xcaa5('0x8')](function(_0x474770,_0x295c9f){if(_0x474770){return _0x2f78a6(_0x474770);}pm2[_0xcaa5('0x4')]();return _0x4bf6f7(_0x295c9f);});});});};exports[_0xcaa5('0x9')]=function(_0x3e1c8e){return connect()[_0xcaa5('0x7')](function(){return new BPromise(function(_0x8b7ad5,_0x53e67f){return pm2[_0xcaa5('0x9')](_0x3e1c8e,function(_0x47eb0f,_0x17e3d2){if(_0x47eb0f){return _0x53e67f(_0x47eb0f);}pm2[_0xcaa5('0x4')]();return _0x8b7ad5(_0x17e3d2);});});});};exports['delete']=function(_0x37ced2){return connect()[_0xcaa5('0x7')](function(){return new BPromise(function(_0x2111ac,_0x7dad0b){return pm2[_0xcaa5('0xa')](_0x37ced2,function(_0x518928,_0x20b4e3){if(_0x518928){return _0x7dad0b(_0x518928);}pm2[_0xcaa5('0x4')]();return _0x2111ac(_0x20b4e3);});});});};exports[_0xcaa5('0xb')]=function(){return connect()[_0xcaa5('0x7')](function(){return new BPromise(function(_0x5ec417,_0x843c06){return pm2['dump'](function(_0x93f6d4){if(_0x93f6d4){return _0x843c06(_0x93f6d4);}return _0x5ec417(_0xcaa5('0xc'));});});});}; \ No newline at end of file +var _0x0960=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x838721,_0x908b6f){var _0x5ec0b9=function(_0x1c399a){while(--_0x1c399a){_0x838721['push'](_0x838721['shift']());}};_0x5ec0b9(++_0x908b6f);}(_0x0960,0xc2));var _0x0096=function(_0xa0583a,_0x37e708){_0xa0583a=_0xa0583a-0x0;var _0x5782bf=_0x0960[_0xa0583a];return _0x5782bf;};'use strict';var pm2=require(_0x0096('0x0'));var BPromise=require(_0x0096('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x12b515,_0x1078f3){return pm2[_0x0096('0x2')](function(_0x136f7a){if(_0x136f7a){return _0x1078f3(_0x136f7a);}return _0x12b515(_0x0096('0x3'));});});};exports[_0x0096('0x4')]=function(_0x3ee9fb){return connect()[_0x0096('0x5')](function(){return new BPromise(function(_0x40fe03,_0x6ea572){return pm2['start'](_0x3ee9fb,function(_0x81cc41,_0x57390a){if(_0x81cc41){return _0x6ea572(_0x81cc41);}pm2[_0x0096('0x6')]();return _0x40fe03(_0x57390a);});});});};exports[_0x0096('0x7')]=function(_0x407f3a){return connect()['then'](function(){return new BPromise(function(_0x1c9c45,_0x3e97ce){return pm2[_0x0096('0x7')](_0x407f3a,function(_0x24a00a,_0x564840){if(_0x24a00a){return _0x3e97ce(_0x24a00a);}pm2[_0x0096('0x6')]();return _0x1c9c45(_0x564840);});});});};exports[_0x0096('0x8')]=function(_0x558d1c){return connect()[_0x0096('0x5')](function(){return new BPromise(function(_0x59dfc5,_0x2f653b){return pm2['restart'](_0x558d1c,function(_0x25c71f,_0x25011c){if(_0x25c71f){return _0x2f653b(_0x25c71f);}pm2['disconnect']();return _0x59dfc5(_0x25011c);});});});};exports[_0x0096('0x9')]=function(){return connect()[_0x0096('0x5')](function(){return new BPromise(function(_0x594a91,_0x5af22f){return pm2[_0x0096('0x9')](function(_0x39b6f6,_0x407361){if(_0x39b6f6){return _0x5af22f(_0x39b6f6);}pm2[_0x0096('0x6')]();return _0x594a91(_0x407361);});});});};exports[_0x0096('0xa')]=function(_0x5c901f){return connect()['then'](function(){return new BPromise(function(_0x19db10,_0x50c804){return pm2['describe'](_0x5c901f,function(_0x3e323d,_0x37f0e4){if(_0x3e323d){return _0x50c804(_0x3e323d);}pm2['disconnect']();return _0x19db10(_0x37f0e4);});});});};exports[_0x0096('0xb')]=function(_0x2fbe74){return connect()['then'](function(){return new BPromise(function(_0x13e951,_0x27462a){return pm2[_0x0096('0xb')](_0x2fbe74,function(_0x22556d,_0x313098){if(_0x22556d){return _0x27462a(_0x22556d);}pm2['disconnect']();return _0x13e951(_0x313098);});});});};exports[_0x0096('0xc')]=function(){return connect()[_0x0096('0x5')](function(){return new BPromise(function(_0xa2030c,_0x57c109){return pm2[_0x0096('0xc')](function(_0xef7a81){if(_0xef7a81){return _0x57c109(_0xef7a81);}return _0xa2030c(_0x0096('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7c9c7c2..cb8feea 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 _0xcf84=['chatInteraction:update','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','defaults','redis','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0xcf84,0x130));var _0x4cf8=function(_0x4c2e0e,_0x514f78){_0x4c2e0e=_0x4c2e0e-0x0;var _0x24e866=_0xcf84[_0x4c2e0e];return _0x24e866;};'use strict';var _=require(_0x4cf8('0x0'));var moment=require(_0x4cf8('0x1'));var Redis=require(_0x4cf8('0x2'));var db=require(_0x4cf8('0x3'))['db'];var config=require(_0x4cf8('0x4'));config['redis']=_[_0x4cf8('0x5')](config[_0x4cf8('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x4cf8('0x7'))(new Redis(config[_0x4cf8('0x6')]));function closeInteractions(){var _0x1e4cda=0x0;var _0x34c8c0=[];return db['Setting'][_0x4cf8('0x8')]({'raw':!![],'attributes':['id',_0x4cf8('0x9')],'where':{'id':0x1}})['then'](function(_0xe6d026){_0x1e4cda=_0xe6d026[_0x4cf8('0x9')];if(_0x1e4cda){return db[_0x4cf8('0xa')][_0x4cf8('0xb')]({'raw':!![],'attributes':['id',_0x4cf8('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4cf8('0xd')](_0xe6d026[_0x4cf8('0x9')],_0x4cf8('0xe'))}}});}else{return[];}})[_0x4cf8('0xf')](function(_0x48e4d5){_0x34c8c0=_0x48e4d5;if(_0x1e4cda){return db[_0x4cf8('0xa')]['update']({'closeReason':_0x4cf8('0x10'),'disposition':_0x4cf8('0x11'),'closed':!![],'closedAt':moment()['format'](_0x4cf8('0x12'))},{'where':{'id':_[_0x4cf8('0x13')](_0x34c8c0||[],'id')}});}})[_0x4cf8('0xf')](function(_0x217dcf){for(var _0x1adc35=0x0;_0x1adc35<_0x34c8c0[_0x4cf8('0x14')];_0x1adc35++){io['emit'](_0x4cf8('0x15'),{'id':_0x34c8c0[_0x1adc35]['id'],'closed':!![]});}})[_0x4cf8('0x16')](function(_0x10aad9){console[_0x4cf8('0x17')](_0x10aad9);});}exports[_0x4cf8('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1edd=['emit','chatInteraction:update','catch','lodash','moment','ioredis','../../mysqldb','redis','localhost','socket.io-emitter','Setting','then','ChatInteraction','findAll','subtract','chatTimeout','minutes','update','timeout','YYYY-MM-DD\x20HH:mm:ss','length'];(function(_0x5c20c7,_0x1b45f2){var _0x124e3b=function(_0x4f9321){while(--_0x4f9321){_0x5c20c7['push'](_0x5c20c7['shift']());}};_0x124e3b(++_0x1b45f2);}(_0x1edd,0xc0));var _0xd1ed=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x1edd[_0x21353c];return _0xa99120;};'use strict';var _=require(_0xd1ed('0x0'));var moment=require(_0xd1ed('0x1'));var Redis=require(_0xd1ed('0x2'));var db=require(_0xd1ed('0x3'))['db'];var config=require('../../config/environment');config[_0xd1ed('0x4')]=_['defaults'](config[_0xd1ed('0x4')],{'host':_0xd1ed('0x5'),'port':0x18eb});var io=require(_0xd1ed('0x6'))(new Redis(config[_0xd1ed('0x4')]));function closeInteractions(){var _0x6d7c38=0x0;var _0x4703ed=[];return db[_0xd1ed('0x7')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xd1ed('0x8')](function(_0x469114){_0x6d7c38=_0x469114['chatTimeout'];if(_0x6d7c38){return db[_0xd1ed('0x9')][_0xd1ed('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd1ed('0xb')](_0x469114[_0xd1ed('0xc')],_0xd1ed('0xd'))}}});}else{return[];}})[_0xd1ed('0x8')](function(_0xb270d7){_0x4703ed=_0xb270d7;if(_0x6d7c38){return db[_0xd1ed('0x9')][_0xd1ed('0xe')]({'closeReason':'system','disposition':_0xd1ed('0xf'),'closed':!![],'closedAt':moment()['format'](_0xd1ed('0x10'))},{'where':{'id':_['map'](_0x4703ed||[],'id')}});}})[_0xd1ed('0x8')](function(_0x14ecbf){for(var _0x153f5c=0x0;_0x153f5c<_0x4703ed[_0xd1ed('0x11')];_0x153f5c++){io[_0xd1ed('0x12')](_0xd1ed('0x13'),{'id':_0x4703ed[_0x153f5c]['id'],'closed':!![]});}})[_0xd1ed('0x14')](function(_0x140c7c){console['error'](_0x140c7c);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 16f3a4c..947ff47 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 _0xe35f=['user','pass','\x22%s\x22\x20<%s>','format','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','status','message','attachments','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','name','MailServerOut','keys','jobs','map','keyBy','difference','intersection','toString','stop','toRun','length','index','resolve','cron','active','startAt','endAt','add','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','start','util','path','lodash','cron-job-manager','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','port','secure','authentication'];(function(_0x20a4dc,_0x2bd7c7){var _0x49000f=function(_0x2246e7){while(--_0x2246e7){_0x20a4dc['push'](_0x20a4dc['shift']());}};_0x49000f(++_0x2bd7c7);}(_0xe35f,0xf2));var _0xfe35=function(_0x126398,_0x604247){_0x126398=_0x126398-0x0;var _0x5d2933=_0xe35f[_0x126398];return _0x5d2933;};'use strict';var fs=require('fs');var util=require(_0xfe35('0x0'));var path=require(_0xfe35('0x1'));var _=require(_0xfe35('0x2'));var moment=require('moment');var CronJobManager=require(_0xfe35('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xfe35('0x4'));var logger=require(_0xfe35('0x5'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xfe35('0x6'));var analyticDefaultReportController=require(_0xfe35('0x7'));var client=jayson[_0xfe35('0x8')][_0xfe35('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x491437,_0x176892){return function(){logger['info'](_0xfe35('0xa'),_0x491437[_0xfe35('0xb')]);var _0x48d554=!![];var _0x1bf0ef={'tls':{'rejectUnauthorized':![]}};if(_0x491437['MailAccount']['Smtp'][_0xfe35('0xc')]){_0x1bf0ef[_0xfe35('0xc')]=_0x491437[_0xfe35('0xd')][_0xfe35('0xe')][_0xfe35('0xc')];}else{_0x1bf0ef[_0xfe35('0xf')]=_0x491437['MailAccount'][_0xfe35('0xe')]['host'];_0x1bf0ef[_0xfe35('0x10')]=_0x491437['MailAccount']['Smtp']['port'];_0x1bf0ef[_0xfe35('0x11')]=_0x491437[_0xfe35('0xd')]['Smtp'][_0xfe35('0x11')];}if(_0x491437[_0xfe35('0xd')][_0xfe35('0xe')][_0xfe35('0x12')]){_0x1bf0ef['auth']={'user':_0x491437[_0xfe35('0xd')][_0xfe35('0xe')][_0xfe35('0x13')],'pass':_0x491437[_0xfe35('0xd')][_0xfe35('0xe')][_0xfe35('0x14')]};}var _0x2012e3={'account':_0x1bf0ef,'message':{'from':util['format'](_0xfe35('0x15'),_0x491437[_0xfe35('0xd')]['name'],_0x491437[_0xfe35('0xd')][_0xfe35('0xb')]||_0x491437[_0xfe35('0xd')]['Smtp'][_0xfe35('0x13')]),'to':_0x491437[_0xfe35('0xb')],'cc':_0x491437['cc'],'bcc':_0x491437['bcc'],'subject':util[_0xfe35('0x16')](_0xfe35('0x17'),_0x176892['name'],_0x491437['subtractNumber'],_0x491437[_0xfe35('0x18')])}};var _0x1d9f19=path[_0xfe35('0x19')](__dirname,'../../files/reports');var _0x194e86=_0x176892[_0xfe35('0x1a')];var _0x1be6dd=util[_0xfe35('0x16')](_0xfe35('0x1b'),path[_0xfe35('0x1c')](_0x176892[_0xfe35('0x1a')],path[_0xfe35('0x1d')](_0x176892[_0xfe35('0x1a')])),'zip');var _0x232040=path[_0xfe35('0x19')](_0x1d9f19,_0x194e86);var _0x46e373=path['join'](_0x1d9f19,_0x1be6dd);if(fs[_0xfe35('0x1e')](_0x232040)){_0x176892[_0xfe35('0x1f')]='Sent';_0x2012e3[_0xfe35('0x20')][_0xfe35('0x21')]=[{'filename':_0x194e86,'path':_0x232040}];_0x2012e3['message']['text']=util[_0xfe35('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xfe35('0x22')](_0x176892,null,0x2));}else if(fs[_0xfe35('0x1e')](_0x46e373)){_0x176892['status']=_0xfe35('0x23');_0x2012e3[_0xfe35('0x20')][_0xfe35('0x21')]=[{'filename':_0x1be6dd,'path':_0x46e373}];}else{_0x2012e3['message']['text']=_0xfe35('0x24');if(!_0x491437['sendIfEmpty']){_0x48d554=![];logger[_0xfe35('0x25')](_0xfe35('0x26'));}}if(_0x48d554){return client[_0xfe35('0x27')](_0xfe35('0x28'),_0x2012e3)[_0xfe35('0x29')](function(_0x2d6cd1){if(_0x2d6cd1[_0xfe35('0x2a')]){return logger['error'](_0xfe35('0x2b'),JSON[_0xfe35('0x22')](_0x2d6cd1));}return logger[_0xfe35('0x25')](_0xfe35('0x2c'));})['catch'](function(_0x104c72){return logger['error'](_0xfe35('0x2b'),JSON[_0xfe35('0x22')](_0x104c72));});}};}function handleError(){return function(_0x37d828){return logger['error'](JSON['stringify'](_0x37d828));};}function handleResult(_0x5aba05){return function(_0x18f90a){logger[_0xfe35('0x25')](_0xfe35('0x2d'),JSON[_0xfe35('0x22')](_0x18f90a));if(_0x5aba05[_0xfe35('0xd')]&&_0x5aba05[_0xfe35('0xd')][_0xfe35('0xe')]&&!_[_0xfe35('0x2e')](_0x5aba05[_0xfe35('0xb')])){setTimeout(handleSendEmail(_0x5aba05,_0x18f90a),0x3c*0x3e8);}};}function handleJob(_0x3074b0){return function(){try{if(_[_0xfe35('0x2e')](_0x3074b0[_0xfe35('0x2f')])){return logger[_0xfe35('0x25')](_0xfe35('0x30'));}if(_[_0xfe35('0x2e')](_0x3074b0[_0xfe35('0x18')])){return logger[_0xfe35('0x25')](_0xfe35('0x31'));}var _0x153ac3={'startDate':moment()[_0xfe35('0x32')](_0x3074b0[_0xfe35('0x2f')],_0x3074b0['subtractUnit'])[_0xfe35('0x16')](_0xfe35('0x33')),'endDate':moment()[_0xfe35('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x3074b0[_0xfe35('0x34')],'name':_0x3074b0['name']};if(!_[_0xfe35('0x2e')](_0x3074b0[_0xfe35('0x35')])){logger[_0xfe35('0x25')](_0xfe35('0x36'),_0x3074b0[_0xfe35('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x3074b0[_0xfe35('0x35')]},_0x153ac3)[_0xfe35('0x29')](handleResult(_0x3074b0))[_0xfe35('0x37')](handleError());}if(!_['isNil'](_0x3074b0[_0xfe35('0x38')])){logger[_0xfe35('0x25')](_0xfe35('0x39'),_0x3074b0['CustomReportId']);return analyticCustomReportController[_0xfe35('0x3a')]({'id':_0x3074b0[_0xfe35('0x38')]},_0x153ac3)[_0xfe35('0x29')](handleResult(_0x3074b0))[_0xfe35('0x37')](handleError());}}catch(_0x507bb1){logger[_0xfe35('0x2a')](JSON['stringify'](_0x507bb1));}return logger[_0xfe35('0x25')](_0xfe35('0x3b'));};}function getJobs(_0x4badf){var _0x344a4e={};if(_0x4badf){_0x344a4e['id']=_0x4badf;}return db[_0xfe35('0x3c')][_0xfe35('0x3d')]({'where':_0x344a4e,'include':[{'model':db[_0xfe35('0xd')],'attributes':['id',_0xfe35('0x3e'),_0xfe35('0xb')],'include':[{'model':db[_0xfe35('0x3f')],'as':_0xfe35('0xe')}]}]})[_0xfe35('0x29')](function(_0x4da204){var _0x318a2b=_[_0xfe35('0x40')](manager[_0xfe35('0x41')]);var _0x199e48=_[_0xfe35('0x42')](_0x4da204,function(_0x436775){return _0x436775['id']['toString']();});var _0x4f82cd=_[_0xfe35('0x43')](_0x4da204,function(_0x20de43){return _0x20de43['id']['toString']();});var _0x821bee=_0x4badf?_0x199e48:_[_0xfe35('0x44')](_0x199e48,_0x318a2b);var _0x3ff615=_[_0xfe35('0x45')](_0x199e48,_0x318a2b);var _0x5c8056=_[_0xfe35('0x44')](_0x318a2b,_0x199e48);var _0x57b650;var _0x4f5547;for(_0x57b650=0x0;_0x57b650<_0x5c8056['length']&&!_0x4badf;_0x57b650+=0x1){_0x4f5547=_0x5c8056[_0x57b650][_0xfe35('0x46')]();if(manager['exists'](_0x4f5547)){manager[_0xfe35('0x47')](_0x4f5547);manager['deleteJob'](_0x4f5547);logger['info']('delete\x20cron',_0x4f5547);}}logger[_0xfe35('0x25')](_0xfe35('0x48'),JSON[_0xfe35('0x22')](_0x821bee));for(_0x57b650=0x0;_0x57b650<_0x821bee[_0xfe35('0x49')];_0x57b650+=0x1){_0x4f5547=_0x821bee[_0x57b650][_0xfe35('0x46')]();logger[_0xfe35('0x25')](_0xfe35('0x4a'),_0x4f5547);if(_0x4badf){logger[_0xfe35('0x25')]('my\x20id',_0x4badf);logger[_0xfe35('0x25')](JSON['stringify'](_0x4f82cd[_0x4f5547]));BPromise[_0xfe35('0x4b')]()[_0xfe35('0x29')](handleJob(_0x4f82cd[_0x4f5547]));logger['info']('run\x20job',_0x4f82cd[_0x4f5547][_0xfe35('0x3e')],_0x4f82cd[_0x4f5547][_0xfe35('0x4c')]);}else if(_0x4f82cd[_0x4f5547]['cron']&&_0x4f82cd[_0x4f5547][_0xfe35('0x4d')]&&moment()['isBetween'](_0x4f82cd[_0x4f5547][_0xfe35('0x4e')],_0x4f82cd[_0x4f5547][_0xfe35('0x4f')])){manager[_0xfe35('0x50')](_0x4f5547,_0x4f82cd[_0x4f5547]['cron'],handleJob(_0x4f82cd[_0x4f5547]));manager['start'](_0x4f5547);logger['info'](_0xfe35('0x51'),_0x4f82cd[_0x4f5547][_0xfe35('0x3e')],_0x4f82cd[_0x4f5547]['cron']);}else if(manager['exists'](_0x4f5547)){manager[_0xfe35('0x47')](_0x4f5547);manager[_0xfe35('0x52')](_0x4f5547);logger[_0xfe35('0x25')](_0xfe35('0x53'),_0x4f82cd[_0x4f5547][_0xfe35('0x3e')],_0x4f82cd[_0x4f5547][_0xfe35('0x4c')]);}}for(_0x57b650=0x0,_0x4f5547;_0x57b650<_0x3ff615[_0xfe35('0x49')]&&!_0x4badf;_0x57b650+=0x1){_0x4f5547=_0x3ff615[_0x57b650]['toString']();if(manager['exists'](_0x4f5547)){if(_0x4f82cd[_0x4f5547][_0xfe35('0x4c')]&&_0x4f82cd[_0x4f5547][_0xfe35('0x4d')]&&moment()['isBetween'](_0x4f82cd[_0x4f5547][_0xfe35('0x4e')],_0x4f82cd[_0x4f5547][_0xfe35('0x4f')])){manager['update'](_0x4f5547,_0x4f82cd[_0x4f5547][_0xfe35('0x4c')],handleJob(_0x4f82cd[_0x4f5547]));logger[_0xfe35('0x25')](_0xfe35('0x54'),_0x4f82cd[_0x4f5547]['name'],_0x4f82cd[_0x4f5547]['cron']);}else{manager[_0xfe35('0x47')](_0x4f5547);manager['deleteJob'](_0x4f5547);logger['info'](_0xfe35('0x53'),_0x4f82cd[_0x4f5547][_0xfe35('0x3e')],_0x4f82cd[_0x4f5547][_0xfe35('0x4c')]);}}}})['catch'](function(_0x29684c){logger['error'](JSON[_0xfe35('0x22')](_0x29684c));});}exports[_0xfe35('0x55')]=function(_0x18acae){return getJobs(_0x18acae);};exports[_0xfe35('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc2d1=['Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail','data','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','keys','jobs','map','difference','intersection','length','toString','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','endAt','add','start','add\x20cron','stop\x20cron','startAt','run','util','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','service','MailAccount','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent'];(function(_0x569d56,_0x22014c){var _0x21f0ef=function(_0x43c67d){while(--_0x43c67d){_0x569d56['push'](_0x569d56['shift']());}};_0x21f0ef(++_0x22014c);}(_0xc2d1,0x199));var _0x1c2d=function(_0x1de9aa,_0x2795a1){_0x1de9aa=_0x1de9aa-0x0;var _0x43e7e9=_0xc2d1[_0x1de9aa];return _0x43e7e9;};'use strict';var fs=require('fs');var util=require(_0x1c2d('0x0'));var path=require('path');var _=require(_0x1c2d('0x1'));var moment=require(_0x1c2d('0x2'));var CronJobManager=require(_0x1c2d('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x1c2d('0x4'));var logger=require(_0x1c2d('0x5'))(_0x1c2d('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x1c2d('0x7'));var analyticDefaultReportController=require(_0x1c2d('0x8'));var client=jayson['client'][_0x1c2d('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x12d4f4,_0x3cbcfd){return function(){logger[_0x1c2d('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x12d4f4[_0x1c2d('0xb')]);var _0x142e0f=!![];var _0xda4a0a={'tls':{'rejectUnauthorized':![]}};if(_0x12d4f4['MailAccount']['Smtp'][_0x1c2d('0xc')]){_0xda4a0a[_0x1c2d('0xc')]=_0x12d4f4[_0x1c2d('0xd')][_0x1c2d('0xe')][_0x1c2d('0xc')];}else{_0xda4a0a[_0x1c2d('0xf')]=_0x12d4f4['MailAccount'][_0x1c2d('0xe')][_0x1c2d('0xf')];_0xda4a0a['port']=_0x12d4f4[_0x1c2d('0xd')][_0x1c2d('0xe')][_0x1c2d('0x10')];_0xda4a0a[_0x1c2d('0x11')]=_0x12d4f4[_0x1c2d('0xd')][_0x1c2d('0xe')]['secure'];}if(_0x12d4f4['MailAccount'][_0x1c2d('0xe')][_0x1c2d('0x12')]){_0xda4a0a[_0x1c2d('0x13')]={'user':_0x12d4f4['MailAccount'][_0x1c2d('0xe')][_0x1c2d('0x14')],'pass':_0x12d4f4['MailAccount'][_0x1c2d('0xe')][_0x1c2d('0x15')]};}var _0x5568d9={'account':_0xda4a0a,'message':{'from':util[_0x1c2d('0x16')](_0x1c2d('0x17'),_0x12d4f4[_0x1c2d('0xd')][_0x1c2d('0x18')],_0x12d4f4['MailAccount']['email']||_0x12d4f4[_0x1c2d('0xd')][_0x1c2d('0xe')][_0x1c2d('0x14')]),'to':_0x12d4f4[_0x1c2d('0xb')],'cc':_0x12d4f4['cc'],'bcc':_0x12d4f4[_0x1c2d('0x19')],'subject':util[_0x1c2d('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x3cbcfd[_0x1c2d('0x18')],_0x12d4f4['subtractNumber'],_0x12d4f4[_0x1c2d('0x1a')])}};var _0x1b3438=path[_0x1c2d('0x1b')](__dirname,_0x1c2d('0x1c'));var _0x1b87fa=_0x3cbcfd[_0x1c2d('0x1d')];var _0x4770a9=util['format'](_0x1c2d('0x1e'),path[_0x1c2d('0x1f')](_0x3cbcfd[_0x1c2d('0x1d')],path['extname'](_0x3cbcfd['savename'])),_0x1c2d('0x20'));var _0x223117=path[_0x1c2d('0x1b')](_0x1b3438,_0x1b87fa);var _0x575634=path[_0x1c2d('0x1b')](_0x1b3438,_0x4770a9);if(fs[_0x1c2d('0x21')](_0x223117)){_0x3cbcfd[_0x1c2d('0x22')]='Sent';_0x5568d9[_0x1c2d('0x23')][_0x1c2d('0x24')]=[{'filename':_0x1b87fa,'path':_0x223117}];_0x5568d9[_0x1c2d('0x23')][_0x1c2d('0x25')]=util['format'](_0x1c2d('0x26'),JSON[_0x1c2d('0x27')](_0x3cbcfd,null,0x2));}else if(fs[_0x1c2d('0x21')](_0x575634)){_0x3cbcfd['status']=_0x1c2d('0x28');_0x5568d9['message'][_0x1c2d('0x24')]=[{'filename':_0x4770a9,'path':_0x575634}];}else{_0x5568d9[_0x1c2d('0x23')][_0x1c2d('0x25')]=_0x1c2d('0x29');if(!_0x12d4f4['sendIfEmpty']){_0x142e0f=![];logger[_0x1c2d('0xa')](_0x1c2d('0x2a'));}}if(_0x142e0f){return client[_0x1c2d('0x2b')](_0x1c2d('0x2c'),_0x5568d9)[_0x1c2d('0x2d')](function(_0xa4fb65){if(_0xa4fb65[_0x1c2d('0x2e')]){return logger[_0x1c2d('0x2e')]('error\x20mail',JSON['stringify'](_0xa4fb65));}return logger[_0x1c2d('0xa')](_0x1c2d('0x2f'));})[_0x1c2d('0x30')](function(_0x417298){return logger['error'](_0x1c2d('0x31'),JSON['stringify'](_0x417298));});}};}function handleError(){return function(_0x347205){return logger[_0x1c2d('0x2e')](JSON['stringify'](_0x347205));};}function handleResult(_0x39c361){return function(_0x282d6c){logger[_0x1c2d('0xa')](_0x1c2d('0x32'),JSON[_0x1c2d('0x27')](_0x282d6c));if(_0x39c361[_0x1c2d('0xd')]&&_0x39c361[_0x1c2d('0xd')]['Smtp']&&!_['isNil'](_0x39c361[_0x1c2d('0xb')])){setTimeout(handleSendEmail(_0x39c361,_0x282d6c),0x3c*0x3e8);}};}function handleJob(_0x4bff20){return function(){try{if(_['isNil'](_0x4bff20[_0x1c2d('0x33')])){return logger['info'](_0x1c2d('0x34'));}if(_[_0x1c2d('0x35')](_0x4bff20[_0x1c2d('0x1a')])){return logger[_0x1c2d('0xa')](_0x1c2d('0x36'));}var _0x22fef7={'startDate':moment()[_0x1c2d('0x37')](_0x4bff20[_0x1c2d('0x33')],_0x4bff20[_0x1c2d('0x1a')])[_0x1c2d('0x16')](_0x1c2d('0x38')),'endDate':moment()['format'](_0x1c2d('0x38')),'type':_0x1c2d('0x39'),'output':_0x4bff20[_0x1c2d('0x3a')],'name':_0x4bff20[_0x1c2d('0x18')]};if(!_[_0x1c2d('0x35')](_0x4bff20['DefaultReportId'])){logger['info'](_0x1c2d('0x3b'),_0x4bff20[_0x1c2d('0x3c')]);return analyticDefaultReportController[_0x1c2d('0x3d')]({'id':_0x4bff20[_0x1c2d('0x3c')]},_0x22fef7)[_0x1c2d('0x2d')](handleResult(_0x4bff20))[_0x1c2d('0x30')](handleError());}if(!_[_0x1c2d('0x35')](_0x4bff20['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x4bff20[_0x1c2d('0x3e')]);return analyticCustomReportController[_0x1c2d('0x3d')]({'id':_0x4bff20['CustomReportId']},_0x22fef7)[_0x1c2d('0x2d')](handleResult(_0x4bff20))['catch'](handleError());}}catch(_0x1fcff6){logger['error'](JSON[_0x1c2d('0x27')](_0x1fcff6));}return logger[_0x1c2d('0xa')](_0x1c2d('0x3f'));};}function getJobs(_0x32211c){var _0x2990c8={};if(_0x32211c){_0x2990c8['id']=_0x32211c;}return db[_0x1c2d('0x40')]['findAll']({'where':_0x2990c8,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x1c2d('0xe')}]}]})[_0x1c2d('0x2d')](function(_0x4f64a4){var _0x5945e1=_[_0x1c2d('0x41')](manager[_0x1c2d('0x42')]);var _0x1884e0=_[_0x1c2d('0x43')](_0x4f64a4,function(_0x2d219a){return _0x2d219a['id']['toString']();});var _0x13a52b=_['keyBy'](_0x4f64a4,function(_0x2fb5b2){return _0x2fb5b2['id']['toString']();});var _0xe75007=_0x32211c?_0x1884e0:_[_0x1c2d('0x44')](_0x1884e0,_0x5945e1);var _0x14f216=_[_0x1c2d('0x45')](_0x1884e0,_0x5945e1);var _0x2f0365=_[_0x1c2d('0x44')](_0x5945e1,_0x1884e0);var _0x515d10;var _0x3e2772;for(_0x515d10=0x0;_0x515d10<_0x2f0365[_0x1c2d('0x46')]&&!_0x32211c;_0x515d10+=0x1){_0x3e2772=_0x2f0365[_0x515d10][_0x1c2d('0x47')]();if(manager[_0x1c2d('0x48')](_0x3e2772)){manager[_0x1c2d('0x49')](_0x3e2772);manager[_0x1c2d('0x4a')](_0x3e2772);logger[_0x1c2d('0xa')](_0x1c2d('0x4b'),_0x3e2772);}}logger[_0x1c2d('0xa')](_0x1c2d('0x4c'),JSON[_0x1c2d('0x27')](_0xe75007));for(_0x515d10=0x0;_0x515d10<_0xe75007['length'];_0x515d10+=0x1){_0x3e2772=_0xe75007[_0x515d10]['toString']();logger[_0x1c2d('0xa')](_0x1c2d('0x4d'),_0x3e2772);if(_0x32211c){logger[_0x1c2d('0xa')](_0x1c2d('0x4e'),_0x32211c);logger[_0x1c2d('0xa')](JSON[_0x1c2d('0x27')](_0x13a52b[_0x3e2772]));BPromise[_0x1c2d('0x4f')]()[_0x1c2d('0x2d')](handleJob(_0x13a52b[_0x3e2772]));logger['info']('run\x20job',_0x13a52b[_0x3e2772]['name'],_0x13a52b[_0x3e2772][_0x1c2d('0x50')]);}else if(_0x13a52b[_0x3e2772][_0x1c2d('0x50')]&&_0x13a52b[_0x3e2772][_0x1c2d('0x51')]&&moment()[_0x1c2d('0x52')](_0x13a52b[_0x3e2772]['startAt'],_0x13a52b[_0x3e2772][_0x1c2d('0x53')])){manager[_0x1c2d('0x54')](_0x3e2772,_0x13a52b[_0x3e2772][_0x1c2d('0x50')],handleJob(_0x13a52b[_0x3e2772]));manager[_0x1c2d('0x55')](_0x3e2772);logger[_0x1c2d('0xa')](_0x1c2d('0x56'),_0x13a52b[_0x3e2772][_0x1c2d('0x18')],_0x13a52b[_0x3e2772][_0x1c2d('0x50')]);}else if(manager[_0x1c2d('0x48')](_0x3e2772)){manager['stop'](_0x3e2772);manager[_0x1c2d('0x4a')](_0x3e2772);logger[_0x1c2d('0xa')](_0x1c2d('0x57'),_0x13a52b[_0x3e2772][_0x1c2d('0x18')],_0x13a52b[_0x3e2772]['cron']);}}for(_0x515d10=0x0,_0x3e2772;_0x515d10<_0x14f216[_0x1c2d('0x46')]&&!_0x32211c;_0x515d10+=0x1){_0x3e2772=_0x14f216[_0x515d10][_0x1c2d('0x47')]();if(manager[_0x1c2d('0x48')](_0x3e2772)){if(_0x13a52b[_0x3e2772]['cron']&&_0x13a52b[_0x3e2772][_0x1c2d('0x51')]&&moment()[_0x1c2d('0x52')](_0x13a52b[_0x3e2772][_0x1c2d('0x58')],_0x13a52b[_0x3e2772][_0x1c2d('0x53')])){manager['update'](_0x3e2772,_0x13a52b[_0x3e2772]['cron'],handleJob(_0x13a52b[_0x3e2772]));logger[_0x1c2d('0xa')]('update\x20cron',_0x13a52b[_0x3e2772][_0x1c2d('0x18')],_0x13a52b[_0x3e2772][_0x1c2d('0x50')]);}else{manager[_0x1c2d('0x49')](_0x3e2772);manager[_0x1c2d('0x4a')](_0x3e2772);logger[_0x1c2d('0xa')](_0x1c2d('0x57'),_0x13a52b[_0x3e2772][_0x1c2d('0x18')],_0x13a52b[_0x3e2772][_0x1c2d('0x50')]);}}}})[_0x1c2d('0x30')](function(_0xa8afd3){logger['error'](JSON['stringify'](_0xa8afd3));});}exports[_0x1c2d('0x59')]=function(_0x48a819){return getJobs(_0x48a819);};exports[_0x1c2d('0x55')]=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 afef6c8..ef4e0f0 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 _0x438a=['transcribeRegion','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','then','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','resolve','sentiment','Cloud\x20Provider\x20not\x20configured','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2'];(function(_0x5a52da,_0x319895){var _0x28a4ad=function(_0x5f0b06){while(--_0x5f0b06){_0x5a52da['push'](_0x5a52da['shift']());}};_0x28a4ad(++_0x319895);}(_0x438a,0x1d7));var _0xa438=function(_0x258a0d,_0x3c71cd){_0x258a0d=_0x258a0d-0x0;var _0x4eb611=_0x438a[_0x258a0d];return _0x4eb611;};var _=require(_0xa438('0x0'));var AWS=require(_0xa438('0x1'));var rp=require(_0xa438('0x2'));var util=require(_0xa438('0x3'));var BPromise=require(_0xa438('0x4'));var db=require(_0xa438('0x5'))['db'];var logger=require(_0xa438('0x6'))(_0xa438('0x7'));function getTranscriptionJob(_0x36511f,_0x167271,_0x199cbf,_0x747ac3){return new Promise(function(_0x55b087,_0xd4a421){var _0xe26b0=new AWS['TranscribeService']({'accessKeyId':_0x167271,'secretAccessKey':_0x36511f,'region':_0x199cbf});_0xe26b0['getTranscriptionJob']({'TranscriptionJobName':_0x747ac3},function(_0x444401,_0x5a7353){if(_0x444401){return _0xd4a421(_0x444401);}else{return _0x55b087(_0x5a7353);}});});}function sentiment(_0x37365d,_0x46c55f,_0x41c727,_0x56fc2c,_0x156c6f){return new Promise(function(_0x50f455,_0x4eb5c7){var _0xabbf5f=new AWS['Comprehend']({'accessKeyId':_0x46c55f,'secretAccessKey':_0x37365d,'region':_0x41c727});_0xabbf5f['detectSentiment']({'Text':_0x56fc2c,'LanguageCode':_0x156c6f['substring'](0x0,0x2)},function(_0x528e2e,_0x590f8a){if(_0x528e2e){return _0x4eb5c7(_0x528e2e);}else{return _0x50f455(_0x590f8a);}});});}function checkTranscribeJob(_0x209849,_0x4284e9,_0x334b24){var _0x14b05e;return new BPromise(function(_0x4d7fe0,_0x4999c5){logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0xa'),_0x209849['id'],_0x209849['transcribeName']));return getTranscriptionJob(_0x334b24['data1'],_0x334b24[_0xa438('0xb')],_0x4284e9[_0xa438('0xc')],_0x209849[_0xa438('0xd')])['then'](function(_0x1b87fb){logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0xe'),_0x209849['id'],_0x209849['transcribeName'],_0x1b87fb[_0xa438('0xf')][_0xa438('0x10')]));if(!_0x209849[_0xa438('0x11')]){switch(_0x1b87fb['TranscriptionJob'][_0xa438('0x10')]){case _0xa438('0x12'):var _0x3c71b6={'transcribeStatus':_0x1b87fb[_0xa438('0xf')][_0xa438('0x10')],'fileUri':_0x1b87fb[_0xa438('0xf')][_0xa438('0x13')]['TranscriptFileUri']};logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0x14'),_0x209849['id']));return rp({'uri':_0x1b87fb['TranscriptionJob'][_0xa438('0x13')][_0xa438('0x15')],'json':!![]})[_0xa438('0x16')](function(_0x3b40bf){logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x209849['id']));if(_0x3b40bf&&_0x3b40bf[_0xa438('0x17')]&&_0x3b40bf['results'][_0xa438('0x18')]&&_0x3b40bf['results'][_0xa438('0x18')][_0xa438('0x19')]){_0x3c71b6[_0xa438('0x11')]='';for(var _0x9828b8=0x0;_0x9828b8<_0x3b40bf['results'][_0xa438('0x18')]['length'];_0x9828b8++){_0x3c71b6[_0xa438('0x11')]+=_0x3b40bf[_0xa438('0x17')][_0xa438('0x18')][_0x9828b8][_0xa438('0x1a')]+'';}}return _0x209849[_0xa438('0x1b')](_0x3c71b6);})[_0xa438('0x16')](function(){logger['info'](util[_0xa438('0x9')](_0xa438('0x1c'),_0x209849['id']));if(!_0x209849[_0xa438('0x1d')]){throw new db[(_0xa438('0x1e'))][(_0xa438('0x1f'))](_0xa438('0x20'));}if(!_0x4284e9['sentiment']||!_0x4284e9[_0xa438('0x21')]||!_0x4284e9[_0xa438('0x22')]||!_0x4284e9[_0xa438('0x23')]||!_0x4284e9[_0xa438('0x24')]){throw new db['Sequelize'][(_0xa438('0x1f'))](_0xa438('0x25'));}if(!_0x3c71b6[_0xa438('0x11')]){throw new Error(_0xa438('0x26'));}if(_0x4284e9[_0xa438('0x21')]===_0x334b24['id']){return _0x334b24;}else{return db[_0xa438('0x27')][_0xa438('0x28')]({'where':{'id':_settings[_0xa438('0x21')]}});}})[_0xa438('0x16')](function(_0x47a5ec){if(!_0x47a5ec){throw new db[(_0xa438('0x1e'))][(_0xa438('0x1f'))](_0xa438('0x29'));}if(!_0x47a5ec['data1']||!_0x47a5ec['data2']){throw new db[(_0xa438('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x14b05e=_0x47a5ec;logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0x2a'),_0x209849['id']));return sentiment(_0x14b05e[_0xa438('0x2b')],_0x14b05e[_0xa438('0xb')],_0x4284e9[_0xa438('0x22')],_0x3c71b6[_0xa438('0x11')],_0x4284e9[_0xa438('0x23')]);})[_0xa438('0x16')](function(_0x2282a1){logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0x2c'),_0x209849['id']));return _0x209849[_0xa438('0x1b')]({'sentiment':_0x2282a1[_0xa438('0x2d')],'sPositive':_0x2282a1[_0xa438('0x2e')]['Positive'],'sNegative':_0x2282a1[_0xa438('0x2e')][_0xa438('0x2f')],'sMixed':_0x2282a1[_0xa438('0x2e')][_0xa438('0x30')],'sNeutral':_0x2282a1[_0xa438('0x2e')][_0xa438('0x31')]});})['then'](function(){logger[_0xa438('0x8')](util['format'](_0xa438('0x1c'),_0x209849['id']));_0x4d7fe0();});case'FAILED':return _0x209849['update']({'transcribeStatus':'FAILED','failureReason':_0x1b87fb['TranscriptionJob']['FailureReason']})[_0xa438('0x16')](function(){logger['info'](util['format'](_0xa438('0x1c'),_0x209849['id']));_0x4d7fe0();});default:logger['info'](util[_0xa438('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x209849['id']));break;}}else{return BPromise[_0xa438('0x32')]()[_0xa438('0x16')](function(){if(!_0x209849[_0xa438('0x1d')]){throw new db['Sequelize'][(_0xa438('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4284e9[_0xa438('0x33')]||!_0x4284e9[_0xa438('0x21')]||!_0x4284e9[_0xa438('0x22')]||!_0x4284e9[_0xa438('0x23')]||!_0x4284e9[_0xa438('0x24')]){throw new db[(_0xa438('0x1e'))][(_0xa438('0x1f'))](_0xa438('0x25'));}if(!_0x209849['fileText']){throw new Error(_0xa438('0x26'));}if(_0x4284e9[_0xa438('0x21')]===_0x334b24['id']){return _0x334b24;}else{return db[_0xa438('0x27')][_0xa438('0x28')]({'where':{'id':_settings[_0xa438('0x21')]}});}})['then'](function(_0x48434b){if(!_0x48434b){throw new db[(_0xa438('0x1e'))][(_0xa438('0x1f'))](_0xa438('0x29'));}if(!_0x48434b[_0xa438('0x2b')]||!_0x48434b[_0xa438('0xb')]){throw new db[(_0xa438('0x1e'))][(_0xa438('0x1f'))](_0xa438('0x34'));}_0x14b05e=_0x48434b;logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0x2a'),_0x209849['id']));return sentiment(_0x14b05e[_0xa438('0x2b')],_0x14b05e[_0xa438('0xb')],_0x4284e9['sentimentRegion'],_0x209849[_0xa438('0x11')],_0x4284e9[_0xa438('0x23')]);})['then'](function(_0xb2583){logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0x2c'),_0x209849['id']));return _0x209849[_0xa438('0x1b')]({'sentiment':_0xb2583[_0xa438('0x2d')],'sPositive':_0xb2583['SentimentScore'][_0xa438('0x35')],'sNegative':_0xb2583[_0xa438('0x2e')]['Negative'],'sMixed':_0xb2583[_0xa438('0x2e')][_0xa438('0x30')],'sNeutral':_0xb2583[_0xa438('0x2e')]['Neutral'],'transcribeStatus':_0xa438('0x12')});})[_0xa438('0x16')](function(){logger[_0xa438('0x8')](util[_0xa438('0x9')](_0xa438('0x1c'),_0x209849['id']));_0x4d7fe0();});}})[_0xa438('0x36')](function(_0xa69f2b){if(_0xa69f2b){if(!_0xa69f2b[_0xa438('0x37')]||_0xa69f2b[_0xa438('0x37')]!==_0xa438('0x38')){logger[_0xa438('0x39')](util['format'](_0xa438('0x3a'),_0x209849['id']),util[_0xa438('0x3b')](_0xa69f2b,{'showHidden':![],'depth':null}));}}_0x4d7fe0();});});}function checkTranscribe(){var _0x57146e;var _0x335181;var _0x2a7264;return db[_0xa438('0x3c')][_0xa438('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xa438('0x16')](function(_0x247685){if(!_0x247685||!_0x247685[_0xa438('0x19')]){throw new db[(_0xa438('0x1e'))][(_0xa438('0x1f'))](_0xa438('0x3e'));}_0x57146e=_0x247685;return db['Setting'][_0xa438('0x28')]({'where':{'id':0x1}});})[_0xa438('0x16')](function(_0x6469de){if(!_0x6469de){throw new db[(_0xa438('0x1e'))]['ValidationError'](_0xa438('0x3f'));}_0x335181=_0x6469de;if(!_0x335181[_0xa438('0x7')]||!_0x335181[_0xa438('0x40')]||!_0x335181[_0xa438('0xc')]||!_0x335181[_0xa438('0x23')]||!_0x335181[_0xa438('0x24')]){throw new db[(_0xa438('0x1e'))]['ValidationError'](_0xa438('0x41'));}return db[_0xa438('0x27')][_0xa438('0x28')]({'where':{'id':_0x335181['transcribeAccountId']}});})[_0xa438('0x16')](function(_0x1a72d6){if(!_0x1a72d6){throw new db['Sequelize'][(_0xa438('0x1f'))](_0xa438('0x29'));}if(!_0x1a72d6[_0xa438('0x2b')]||!_0x1a72d6[_0xa438('0xb')]){throw new db[(_0xa438('0x1e'))]['ValidationError'](_0xa438('0x34'));}_0x2a7264=_0x1a72d6;var _0x5e8fca=[];_0x57146e[_0xa438('0x42')](function(_0x4ab5e6){_0x5e8fca['push'](checkTranscribeJob(_0x4ab5e6,_0x335181,_0x2a7264));});return BPromise[_0xa438('0x43')](_0x5e8fca);})[_0xa438('0x36')](function(_0x1524d4){if(_0x1524d4){if(!_0x1524d4[_0xa438('0x37')]||_0x1524d4[_0xa438('0x37')]!=='SequelizeValidationError'){logger[_0xa438('0x39')](util[_0xa438('0x3b')](_0x1524d4,{'showHidden':![],'depth':null}));}}});}exports[_0xa438('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xfbeb=['TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Neutral','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','transcribeAccountId','bucket','Transcribe\x20not\x20configured','forEach','all','SequelizeValidationError','start','lodash','aws-sdk','util','transcribe'];(function(_0x1a57aa,_0x53ad04){var _0x38d9d2=function(_0x521385){while(--_0x521385){_0x1a57aa['push'](_0x1a57aa['shift']());}};_0x38d9d2(++_0x53ad04);}(_0xfbeb,0x86));var _0xbfbe=function(_0x2fd540,_0x2cdc12){_0x2fd540=_0x2fd540-0x0;var _0x105ae0=_0xfbeb[_0x2fd540];return _0x105ae0;};var _=require(_0xbfbe('0x0'));var AWS=require(_0xbfbe('0x1'));var rp=require('request-promise');var util=require(_0xbfbe('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xbfbe('0x3'));function getTranscriptionJob(_0x1a909d,_0x18d69a,_0x344f04,_0x3206f6){return new Promise(function(_0x15b1bc,_0x220c15){var _0x4a4152=new AWS[(_0xbfbe('0x4'))]({'accessKeyId':_0x18d69a,'secretAccessKey':_0x1a909d,'region':_0x344f04});_0x4a4152[_0xbfbe('0x5')]({'TranscriptionJobName':_0x3206f6},function(_0x5ce6e3,_0x21b731){if(_0x5ce6e3){return _0x220c15(_0x5ce6e3);}else{return _0x15b1bc(_0x21b731);}});});}function sentiment(_0x418283,_0x3f0179,_0x227fc3,_0x5269b3,_0x25560c){return new Promise(function(_0x5491e4,_0xc09529){var _0x481b99=new AWS[(_0xbfbe('0x6'))]({'accessKeyId':_0x3f0179,'secretAccessKey':_0x418283,'region':_0x227fc3});_0x481b99[_0xbfbe('0x7')]({'Text':_0x5269b3,'LanguageCode':_0x25560c[_0xbfbe('0x8')](0x0,0x2)},function(_0x3a4716,_0x460748){if(_0x3a4716){return _0xc09529(_0x3a4716);}else{return _0x5491e4(_0x460748);}});});}function checkTranscribeJob(_0x2801a4,_0x2132fe,_0x42d737){var _0xece21b;return new BPromise(function(_0x251457,_0x5b4186){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2801a4['id'],_0x2801a4[_0xbfbe('0xb')]));return getTranscriptionJob(_0x42d737[_0xbfbe('0xc')],_0x42d737[_0xbfbe('0xd')],_0x2132fe[_0xbfbe('0xe')],_0x2801a4['transcribeName'])[_0xbfbe('0xf')](function(_0x3b669b){logger[_0xbfbe('0x9')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x2801a4['id'],_0x2801a4['transcribeName'],_0x3b669b[_0xbfbe('0x10')][_0xbfbe('0x11')]));if(!_0x2801a4[_0xbfbe('0x12')]){switch(_0x3b669b[_0xbfbe('0x10')]['TranscriptionJobStatus']){case _0xbfbe('0x13'):var _0x21dc96={'transcribeStatus':_0x3b669b[_0xbfbe('0x10')][_0xbfbe('0x11')],'fileUri':_0x3b669b['TranscriptionJob'][_0xbfbe('0x14')]['TranscriptFileUri']};logger['info'](util[_0xbfbe('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x2801a4['id']));return rp({'uri':_0x3b669b[_0xbfbe('0x10')][_0xbfbe('0x14')][_0xbfbe('0x15')],'json':!![]})[_0xbfbe('0xf')](function(_0x3bda73){logger['info'](util['format'](_0xbfbe('0x16'),_0x2801a4['id']));if(_0x3bda73&&_0x3bda73[_0xbfbe('0x17')]&&_0x3bda73[_0xbfbe('0x17')][_0xbfbe('0x18')]&&_0x3bda73['results'][_0xbfbe('0x18')][_0xbfbe('0x19')]){_0x21dc96['fileText']='';for(var _0x186326=0x0;_0x186326<_0x3bda73[_0xbfbe('0x17')]['transcripts'][_0xbfbe('0x19')];_0x186326++){_0x21dc96[_0xbfbe('0x12')]+=_0x3bda73[_0xbfbe('0x17')][_0xbfbe('0x18')][_0x186326]['transcript']+'';}}return _0x2801a4[_0xbfbe('0x1a')](_0x21dc96);})[_0xbfbe('0xf')](function(){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x1b'),_0x2801a4['id']));if(!_0x2801a4[_0xbfbe('0x1c')]){throw new db['Sequelize'][(_0xbfbe('0x1d'))](_0xbfbe('0x1e'));}if(!_0x2132fe[_0xbfbe('0x1f')]||!_0x2132fe[_0xbfbe('0x20')]||!_0x2132fe[_0xbfbe('0x21')]||!_0x2132fe[_0xbfbe('0x22')]||!_0x2132fe['bucket']){throw new db[(_0xbfbe('0x23'))]['ValidationError'](_0xbfbe('0x24'));}if(!_0x21dc96[_0xbfbe('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x2132fe[_0xbfbe('0x20')]===_0x42d737['id']){return _0x42d737;}else{return db['CloudProvider'][_0xbfbe('0x25')]({'where':{'id':_settings[_0xbfbe('0x20')]}});}})[_0xbfbe('0xf')](function(_0x29e5cb){if(!_0x29e5cb){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x29e5cb[_0xbfbe('0xc')]||!_0x29e5cb['data2']){throw new db[(_0xbfbe('0x23'))]['ValidationError'](_0xbfbe('0x26'));}_0xece21b=_0x29e5cb;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2801a4['id']));return sentiment(_0xece21b[_0xbfbe('0xc')],_0xece21b[_0xbfbe('0xd')],_0x2132fe[_0xbfbe('0x21')],_0x21dc96[_0xbfbe('0x12')],_0x2132fe['language']);})[_0xbfbe('0xf')](function(_0x5745c1){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x27'),_0x2801a4['id']));return _0x2801a4[_0xbfbe('0x1a')]({'sentiment':_0x5745c1[_0xbfbe('0x28')],'sPositive':_0x5745c1[_0xbfbe('0x29')][_0xbfbe('0x2a')],'sNegative':_0x5745c1[_0xbfbe('0x29')][_0xbfbe('0x2b')],'sMixed':_0x5745c1[_0xbfbe('0x29')][_0xbfbe('0x2c')],'sNeutral':_0x5745c1[_0xbfbe('0x29')]['Neutral']});})['then'](function(){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x1b'),_0x2801a4['id']));_0x251457();});case _0xbfbe('0x2d'):return _0x2801a4[_0xbfbe('0x1a')]({'transcribeStatus':_0xbfbe('0x2d'),'failureReason':_0x3b669b[_0xbfbe('0x10')][_0xbfbe('0x2e')]})[_0xbfbe('0xf')](function(){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x1b'),_0x2801a4['id']));_0x251457();});default:logger['info'](util[_0xbfbe('0xa')](_0xbfbe('0x2f'),_0x2801a4['id']));break;}}else{return BPromise[_0xbfbe('0x30')]()['then'](function(){if(!_0x2801a4[_0xbfbe('0x1c')]){throw new db['Sequelize'][(_0xbfbe('0x1d'))](_0xbfbe('0x1e'));}if(!_0x2132fe[_0xbfbe('0x1f')]||!_0x2132fe['sentimentAccountId']||!_0x2132fe[_0xbfbe('0x21')]||!_0x2132fe[_0xbfbe('0x22')]||!_0x2132fe['bucket']){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))](_0xbfbe('0x24'));}if(!_0x2801a4[_0xbfbe('0x12')]){throw new Error(_0xbfbe('0x31'));}if(_0x2132fe[_0xbfbe('0x20')]===_0x42d737['id']){return _0x42d737;}else{return db[_0xbfbe('0x32')][_0xbfbe('0x25')]({'where':{'id':_settings[_0xbfbe('0x20')]}});}})[_0xbfbe('0xf')](function(_0x37362b){if(!_0x37362b){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))](_0xbfbe('0x33'));}if(!_0x37362b[_0xbfbe('0xc')]||!_0x37362b[_0xbfbe('0xd')]){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))](_0xbfbe('0x26'));}_0xece21b=_0x37362b;logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x34'),_0x2801a4['id']));return sentiment(_0xece21b['data1'],_0xece21b['data2'],_0x2132fe['sentimentRegion'],_0x2801a4[_0xbfbe('0x12')],_0x2132fe[_0xbfbe('0x22')]);})['then'](function(_0x129657){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x27'),_0x2801a4['id']));return _0x2801a4['update']({'sentiment':_0x129657['Sentiment'],'sPositive':_0x129657[_0xbfbe('0x29')][_0xbfbe('0x2a')],'sNegative':_0x129657['SentimentScore']['Negative'],'sMixed':_0x129657[_0xbfbe('0x29')][_0xbfbe('0x2c')],'sNeutral':_0x129657[_0xbfbe('0x29')][_0xbfbe('0x35')],'transcribeStatus':_0xbfbe('0x13')});})[_0xbfbe('0xf')](function(){logger[_0xbfbe('0x9')](util[_0xbfbe('0xa')](_0xbfbe('0x1b'),_0x2801a4['id']));_0x251457();});}})[_0xbfbe('0x36')](function(_0x41c27f){if(_0x41c27f){if(!_0x41c27f[_0xbfbe('0x37')]||_0x41c27f[_0xbfbe('0x37')]!=='SequelizeValidationError'){logger['error'](util[_0xbfbe('0xa')](_0xbfbe('0x38'),_0x2801a4['id']),util[_0xbfbe('0x39')](_0x41c27f,{'showHidden':![],'depth':null}));}}_0x251457();});});}function checkTranscribe(){var _0x4d129d;var _0x4e6fb5;var _0x86eb86;return db[_0xbfbe('0x3a')][_0xbfbe('0x3b')]({'where':{'transcribeStatus':_0xbfbe('0x3c')}})[_0xbfbe('0xf')](function(_0x3bd684){if(!_0x3bd684||!_0x3bd684['length']){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x4d129d=_0x3bd684;return db[_0xbfbe('0x3d')][_0xbfbe('0x25')]({'where':{'id':0x1}});})[_0xbfbe('0xf')](function(_0x3745ad){if(!_0x3745ad){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))]('Settings\x20not\x20available');}_0x4e6fb5=_0x3745ad;if(!_0x4e6fb5[_0xbfbe('0x3')]||!_0x4e6fb5[_0xbfbe('0x3e')]||!_0x4e6fb5[_0xbfbe('0xe')]||!_0x4e6fb5['language']||!_0x4e6fb5[_0xbfbe('0x3f')]){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))](_0xbfbe('0x40'));}return db[_0xbfbe('0x32')][_0xbfbe('0x25')]({'where':{'id':_0x4e6fb5['transcribeAccountId']}});})[_0xbfbe('0xf')](function(_0x17d0ee){if(!_0x17d0ee){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))](_0xbfbe('0x33'));}if(!_0x17d0ee[_0xbfbe('0xc')]||!_0x17d0ee[_0xbfbe('0xd')]){throw new db[(_0xbfbe('0x23'))][(_0xbfbe('0x1d'))](_0xbfbe('0x26'));}_0x86eb86=_0x17d0ee;var _0x50d6d9=[];_0x4d129d[_0xbfbe('0x41')](function(_0x4863de){_0x50d6d9['push'](checkTranscribeJob(_0x4863de,_0x4e6fb5,_0x86eb86));});return BPromise[_0xbfbe('0x42')](_0x50d6d9);})[_0xbfbe('0x36')](function(_0x491c6b){if(_0x491c6b){if(!_0x491c6b[_0xbfbe('0x37')]||_0x491c6b[_0xbfbe('0x37')]!==_0xbfbe('0x43')){logger['error'](util[_0xbfbe('0x39')](_0x491c6b,{'showHidden':![],'depth':null}));}}});}exports[_0xbfbe('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 669c640..8f9eb63 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa475=['then','CmContact','log','finished\x20populating','CmHopper','bulkCreate','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy'];(function(_0x46ba13,_0x4fc2e4){var _0xf17713=function(_0x1fe73b){while(--_0x1fe73b){_0x46ba13['push'](_0x46ba13['shift']());}};_0xf17713(++_0x4fc2e4);}(_0xa475,0x1e5));var _0x5a47=function(_0x1470f0,_0x43a589){_0x1470f0=_0x1470f0-0x0;var _0x85d4bd=_0xa475[_0x1470f0];return _0x85d4bd;};'use strict';var util=require(_0x5a47('0x0'));var db=require(_0x5a47('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5a47('0x2')]({'id':i,'firstName':_0x5a47('0x3')+i,'lastName':_0x5a47('0x4')+i,'phone':0xf879fb460+i,'email':_0x5a47('0x5')+i+_0x5a47('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5a47('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5a47('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5a47('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5a47('0x4')+i,'phone':0xf879fb460+i,'email':_0x5a47('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5a47('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5a47('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5a47('0x7')](),'updatedAt':Date[_0x5a47('0x7')]()});}db['CmContact'][_0x5a47('0x8')]({'where':{}})[_0x5a47('0x9')](function(){return db[_0x5a47('0xa')]['bulkCreate'](contacts);})['then'](function(){console[_0x5a47('0xb')](_0x5a47('0xc'),'contacts1');return db[_0x5a47('0xd')][_0x5a47('0x8')]({'where':{}});})[_0x5a47('0x9')](function(){return db['CmHopper'][_0x5a47('0xe')](hopper);})[_0x5a47('0x9')](function(){console[_0x5a47('0xb')]('finished\x20populating',_0x5a47('0xf'));return db[_0x5a47('0xa')]['bulkCreate'](contacts2);})['then'](function(){console[_0x5a47('0xb')](_0x5a47('0xc'),_0x5a47('0x10'));return db[_0x5a47('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x5a47('0xb')](_0x5a47('0xc'),_0x5a47('0x11'));})[_0x5a47('0x12')](function(_0x11490e){console['log'](_0x11490e);}); \ No newline at end of file +var _0x14c3=['destroy','bulkCreate','then','finished\x20populating','contacts1','CmHopper','log','contacts2','hopper2','catch','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact'];(function(_0x128607,_0x242e5f){var _0x4ba37b=function(_0x42aa1d){while(--_0x42aa1d){_0x128607['push'](_0x128607['shift']());}};_0x4ba37b(++_0x242e5f);}(_0x14c3,0x15e));var _0x314c=function(_0x378483,_0x310b2f){_0x378483=_0x378483-0x0;var _0x44857f=_0x14c3[_0x378483];return _0x44857f;};'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[_0x314c('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x314c('0x1')+i,'phone':0xf879fb460+i,'email':_0x314c('0x2')+i+_0x314c('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x314c('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x314c('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x314c('0x4')](),'updatedAt':Date[_0x314c('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x314c('0x0')]({'id':i,'firstName':_0x314c('0x5')+i,'lastName':_0x314c('0x1')+i,'phone':0xf879fb460+i,'email':_0x314c('0x2')+i+_0x314c('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x314c('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x314c('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x314c('0x4')](),'updatedAt':Date[_0x314c('0x4')]()});}db[_0x314c('0x6')][_0x314c('0x7')]({'where':{}})['then'](function(){return db['CmContact'][_0x314c('0x8')](contacts);})[_0x314c('0x9')](function(){console['log'](_0x314c('0xa'),_0x314c('0xb'));return db[_0x314c('0xc')][_0x314c('0x7')]({'where':{}});})[_0x314c('0x9')](function(){return db[_0x314c('0xc')][_0x314c('0x8')](hopper);})[_0x314c('0x9')](function(){console[_0x314c('0xd')](_0x314c('0xa'),'hopper1');return db[_0x314c('0x6')]['bulkCreate'](contacts2);})['then'](function(){console[_0x314c('0xd')]('finished\x20populating',_0x314c('0xe'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x314c('0x9')](function(){console[_0x314c('0xd')](_0x314c('0xa'),_0x314c('0xf'));})[_0x314c('0x10')](function(_0x46461d){console[_0x314c('0xd')](_0x46461d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b5810d9..d5b3c87 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf00a=['wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','push','%s%s','agent','format','%s%s@xcally.com','friend'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xf00a,0x19a));var _0xaf00=function(_0x4eeca4,_0x5901c9){_0x4eeca4=_0x4eeca4-0x0;var _0x430031=_0xf00a[_0x4eeca4];return _0x430031;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaf00('0x0')]({'name':util['format'](_0xaf00('0x1'),_0xaf00('0x2'),i),'fullname':util[_0xaf00('0x3')](_0xaf00('0x1'),_0xaf00('0x2'),i),'email':util[_0xaf00('0x3')](_0xaf00('0x4'),'agent',i),'role':_0xaf00('0x2'),'password':'password','internal':0xfa0+i,'type':_0xaf00('0x5'),'transport':['udp','ws',_0xaf00('0x6')],'disallow':['all'],'allow':[_0xaf00('0x7')],'defaultuser':util[_0xaf00('0x3')](_0xaf00('0x1'),_0xaf00('0x2'),i),'encryption':'yes','avpf':_0xaf00('0x8'),'force_avp':_0xaf00('0x8'),'icesupport':'yes','dtlsenable':_0xaf00('0x8'),'dtlsverify':'no','dtlscertfile':_0xaf00('0x9'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xaf00('0xa'),'callerid':util[_0xaf00('0x3')](_0xaf00('0xb'),util[_0xaf00('0x3')]('%s%s',_0xaf00('0x2'),i),0xfa0+i)});}db[_0xaf00('0xc')][_0xaf00('0xd')](users)['then'](function(){console[_0xaf00('0xe')]('add\x20user');})[_0xaf00('0xf')](function(_0x328245){console['log'](_0x328245);}); \ No newline at end of file +var _0x2f90=['%s%s','agent','%s%s@xcally.com','password','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','log','add\x20user','catch','../mysqldb','push','format'];(function(_0x5ab0a7,_0x5a5fc4){var _0x133ee7=function(_0x32a128){while(--_0x32a128){_0x5ab0a7['push'](_0x5ab0a7['shift']());}};_0x133ee7(++_0x5a5fc4);}(_0x2f90,0x1cd));var _0x02f9=function(_0x5be9bb,_0x457882){_0x5be9bb=_0x5be9bb-0x0;var _0x4544eb=_0x2f90[_0x5be9bb];return _0x4544eb;};'use strict';var util=require('util');var db=require(_0x02f9('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x02f9('0x1')]({'name':util[_0x02f9('0x2')](_0x02f9('0x3'),'agent',i),'fullname':util[_0x02f9('0x2')](_0x02f9('0x3'),_0x02f9('0x4'),i),'email':util[_0x02f9('0x2')](_0x02f9('0x5'),_0x02f9('0x4'),i),'role':_0x02f9('0x4'),'password':_0x02f9('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x02f9('0x7')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x02f9('0x2')]('%s%s',_0x02f9('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0x02f9('0x8'),'icesupport':'yes','dtlsenable':_0x02f9('0x8'),'dtlsverify':'no','dtlscertfile':_0x02f9('0x9'),'dtlsprivatekey':_0x02f9('0xa'),'dtlssetup':'actpass','callerid':util[_0x02f9('0x2')](_0x02f9('0xb'),util[_0x02f9('0x2')]('%s%s',_0x02f9('0x4'),i),0xfa0+i)});}db[_0x02f9('0xc')]['bulkCreate'](users)['then'](function(){console[_0x02f9('0xd')](_0x02f9('0xe'));})[_0x02f9('0xf')](function(_0x3186ad){console['log'](_0x3186ad);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7dca525..0f39a14 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1463=['findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','format','%s:queue:%s','length','user:%s','handshake','find','role','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','OpenchannelQueue','Trunk','Campaign','user','VoiceQueue','FaxQueue','SmsQueues','MailQueue','WhatsappQueue','Telephones','getVoiceQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','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','user_has_whatsapp_interactions:remove','catch','join','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','log','CONNECTED','lodash','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','WhatsappQueues'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x1463,0x1ec));var _0x3146=function(_0x443ebd,_0x3ef78d){_0x443ebd=_0x443ebd-0x0;var _0x5c7307=_0x1463[_0x443ebd];return _0x5c7307;};'use strict';var _=require(_0x3146('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x3146('0x1'))['db'];var config=require(_0x3146('0x2'));var queryQueues={'attributes':['id',_0x3146('0x3')],'include':[{'as':_0x3146('0x4'),'model':db[_0x3146('0x5')],'attributes':['id',_0x3146('0x3'),'role'],'raw':!![],'where':{'role':_0x3146('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3146('0x3')],'where':{'role':_0x3146('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x3146('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x3146('0x3')],'where':{'role':_0x3146('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3146('0x3'),_0x3146('0x8')],'where':{'type':_0x3146('0x9')}};function getAssociatedResources(_0x25a566,_0x34059a,_0x273c05){return db[_0x3146('0xa')][_0x3146('0xb')]({'where':{'name':_0x25a566,'userProfileId':_0x34059a},'raw':!![]})[_0x3146('0xc')](function(_0x4f7469){if(_0x4f7469){if(_0x4f7469[_0x3146('0xd')]){switch(_0x25a566){case'VoiceQueues':case _0x3146('0xe'):case _0x3146('0xf'):case'SmsQueues':case _0x3146('0x10'):case'OpenchannelQueues':case _0x3146('0x11'):return db[_0x273c05][_0x3146('0x12')](queryQueues);case'Telephones':return db[_0x273c05][_0x3146('0x12')](queryTelephones);case _0x3146('0x13'):return db[_0x273c05][_0x3146('0x12')](queryTrunks);case _0x3146('0x14'):return db[_0x273c05][_0x3146('0x12')](queryCampaigns);}}else{return db[_0x3146('0x15')][_0x3146('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x4f7469['id']},'raw':!![]})['then'](function(_0x2a912a){if(_0x2a912a){var _0x2bf2c5={'where':{'id':_[_0x3146('0x16')](_0x2a912a,_0x3146('0x17'))},'raw':!![]};switch(_0x273c05){case _0x3146('0x5'):_0x2bf2c5[_0x3146('0x18')]['role']=_0x3146('0x7');break;case'Campaign':_0x2bf2c5[_0x3146('0x18')][_0x3146('0x8')]=_0x3146('0x9');break;}return db[_0x273c05][_0x3146('0x12')](_0x2bf2c5);}else{return[];}});}}else{return[];}})['then'](function(_0x84bf5c){return _0x84bf5c;});}function joinOrLeaveQueues(_0x892f89,_0x5e43ce,_0x94552a,_0x1108ca){_0x892f89[_0x5e43ce](util[_0x3146('0x19')](_0x3146('0x1a'),_0x94552a,_0x1108ca['name']));if(_0x1108ca[_0x3146('0x4')]){for(var _0x47df61=0x0;_0x47df61<_0x1108ca['Agents'][_0x3146('0x1b')];_0x47df61+=0x1){_0x892f89[_0x5e43ce](util[_0x3146('0x19')](_0x3146('0x1c'),_0x1108ca[_0x3146('0x4')][_0x47df61][_0x3146('0x3')]));}}}function joinOrLeave(_0x58d700,_0x1ec531,_0x4a82c6){var _0x4935e4;if(_0x58d700[_0x3146('0x1d')]['query']['id']){db['User'][_0x3146('0x1e')]({'attributes':['id','name',_0x3146('0x1f'),_0x3146('0x20')],'where':{'id':_0x58d700['handshake'][_0x3146('0x21')]['id']},'include':[{'model':db[_0x3146('0x22')],'as':_0x3146('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x3146('0x24')],'as':_0x3146('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x3146('0x26')],'as':_0x3146('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x3146('0x28')],'as':_0x3146('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x3146('0x2a')],'as':_0x3146('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x3146('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x23d67f){if(_0x23d67f){_0x4935e4=_0x23d67f;_0x58d700[_0x1ec531](util['format'](_0x3146('0x1c'),_0x23d67f[_0x3146('0x3')]));var _0x285811=[];switch(_0x23d67f[_0x3146('0x1f')]){case _0x3146('0x2d'):_0x58d700[_0x1ec531](_0x3146('0x2e'));_0x58d700[_0x1ec531](_0x3146('0x2f'));if(queryQueues[_0x3146('0x30')](_0x3146('0x31'))){delete queryQueues[_0x3146('0x31')];}_0x285811[_0x3146('0x32')](db['VoiceQueue'][_0x3146('0x12')](queryQueues));_0x285811[_0x3146('0x32')](db[_0x3146('0x33')][_0x3146('0x12')](queryQueues));_0x285811[_0x3146('0x32')](db['FaxQueue']['findAll'](queryQueues));_0x285811[_0x3146('0x32')](db[_0x3146('0x34')]['findAll'](queryQueues));_0x285811[_0x3146('0x32')](db['MailQueue'][_0x3146('0x12')](queryQueues));_0x285811[_0x3146('0x32')](db[_0x3146('0x35')][_0x3146('0x12')](queryQueues));_0x285811[_0x3146('0x32')](db['WhatsappQueue'][_0x3146('0x12')](queryQueues));_0x285811[_0x3146('0x32')](db[_0x3146('0x5')][_0x3146('0x12')](queryTelephones));_0x285811['push'](db[_0x3146('0x36')][_0x3146('0x12')](queryTrunks));_0x285811[_0x3146('0x32')](db[_0x3146('0x37')]['findAll'](queryCampaigns));_0x285811[_0x3146('0x32')](db[_0x3146('0x5')][_0x3146('0x12')](queryAgents));break;case _0x3146('0x38'):_0x58d700[_0x1ec531](_0x3146('0x2e'));_0x58d700[_0x1ec531](_0x3146('0x2f'));_0x285811[_0x3146('0x32')](getAssociatedResources('VoiceQueues',_0x23d67f['userProfileId'],_0x3146('0x39')));_0x285811[_0x3146('0x32')](getAssociatedResources(_0x3146('0xe'),_0x23d67f[_0x3146('0x20')],'ChatQueue'));_0x285811['push'](getAssociatedResources(_0x3146('0xf'),_0x23d67f['userProfileId'],_0x3146('0x3a')));_0x285811[_0x3146('0x32')](getAssociatedResources(_0x3146('0x3b'),_0x23d67f[_0x3146('0x20')],_0x3146('0x34')));_0x285811[_0x3146('0x32')](getAssociatedResources('MailQueues',_0x23d67f['userProfileId'],_0x3146('0x3c')));_0x285811[_0x3146('0x32')](getAssociatedResources('OpenchannelQueues',_0x23d67f['userProfileId'],_0x3146('0x35')));_0x285811[_0x3146('0x32')](getAssociatedResources(_0x3146('0x11'),_0x23d67f['userProfileId'],_0x3146('0x3d')));_0x285811[_0x3146('0x32')](getAssociatedResources(_0x3146('0x3e'),_0x23d67f[_0x3146('0x20')],'User'));_0x285811[_0x3146('0x32')](getAssociatedResources(_0x3146('0x13'),_0x23d67f[_0x3146('0x20')],_0x3146('0x36')));_0x285811['push'](getAssociatedResources('IvrCampaigns',_0x23d67f['userProfileId'],_0x3146('0x37')));_0x285811[_0x3146('0x32')](db['User'][_0x3146('0x12')](queryAgents));break;case _0x3146('0x6'):_0x58d700[_0x1ec531](_0x3146('0x2e'));_0x58d700[_0x1ec531]('voice:outbound');_0x285811[_0x3146('0x32')](_0x23d67f[_0x3146('0x3f')]({'attributes':['id',_0x3146('0x3')]}));_0x285811[_0x3146('0x32')](_0x23d67f['getChatQueues']({'attributes':['id',_0x3146('0x3')]}));_0x285811['push'](_0x23d67f['getFaxQueues']({'attributes':['id',_0x3146('0x3')]}));_0x285811[_0x3146('0x32')](_0x23d67f['getSmsQueues']({'attributes':['id',_0x3146('0x3')]}));_0x285811[_0x3146('0x32')](_0x23d67f[_0x3146('0x40')]({'attributes':['id',_0x3146('0x3')]}));_0x285811[_0x3146('0x32')](_0x23d67f[_0x3146('0x41')]({'attributes':['id','name']}));_0x285811[_0x3146('0x32')](_0x23d67f[_0x3146('0x42')]({'attributes':['id',_0x3146('0x3')]}));break;}return BPromise[_0x3146('0x43')](_0x285811);}})['then'](function(_0x8f418b){if(_0x8f418b&&_0x8f418b[_0x3146('0x1b')]){for(var _0x4078d8=0x0;_0x4078d8<_0x8f418b[_0x3146('0x1b')];_0x4078d8+=0x1){for(var _0x4289a3=0x0;_0x4289a3<_0x8f418b[_0x4078d8]['length'];_0x4289a3+=0x1){switch(_0x4078d8){case 0x0:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x44'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x1:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x45'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x2:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x46'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x3:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x47'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x4:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x48'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x5:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x49'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x6:joinOrLeaveQueues(_0x58d700,_0x1ec531,_0x3146('0x4a'),_0x8f418b[_0x4078d8][_0x4289a3]);break;case 0x7:_0x58d700[_0x1ec531](util[_0x3146('0x19')](_0x3146('0x4b'),_0x8f418b[_0x4078d8][_0x4289a3][_0x3146('0x3')]));break;case 0x8:_0x58d700[_0x1ec531](util[_0x3146('0x19')](_0x3146('0x4c'),_0x8f418b[_0x4078d8][_0x4289a3][_0x3146('0x3')]));break;case 0x9:_0x58d700[_0x1ec531](util[_0x3146('0x19')](_0x3146('0x4d'),_0x8f418b[_0x4078d8][_0x4289a3][_0x3146('0x8')],_0x8f418b[_0x4078d8][_0x4289a3][_0x3146('0x3')]));break;case 0xa:_0x58d700[_0x1ec531](util[_0x3146('0x19')](_0x3146('0x1c'),_0x8f418b[_0x4078d8][_0x4289a3][_0x3146('0x3')]));break;}}}}})[_0x3146('0xc')](function(){if(_0x1ec531==='leave'){var _0x35235c=_[_0x3146('0x16')](_0x4935e4[_0x3146('0x23')],'id');return _0x4935e4[_0x3146('0x4e')](_0x35235c)[_0x3146('0xc')](function(){for(var _0x3b6db7=0x0;_0x3b6db7<_0x35235c[_0x3146('0x1b')];_0x3b6db7+=0x1){_0x4a82c6[_0x3146('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x35235c[_0x3b6db7]),'UserId':Number(_0x4935e4['id'])});}});}})[_0x3146('0xc')](function(){if(_0x1ec531===_0x3146('0x50')){var _0x11a2d1=_['map'](_0x4935e4[_0x3146('0x25')],'id');return _0x4935e4[_0x3146('0x51')](_0x11a2d1)[_0x3146('0xc')](function(){for(var _0x1cf305=0x0;_0x1cf305<_0x11a2d1[_0x3146('0x1b')];_0x1cf305+=0x1){_0x4a82c6[_0x3146('0x4f')](_0x3146('0x52'),{'MailInteractionId':Number(_0x11a2d1[_0x1cf305]),'UserId':Number(_0x4935e4['id'])});}});}})['then'](function(){if(_0x1ec531===_0x3146('0x50')){var _0x598d31=_['map'](_0x4935e4['FaxInteractions'],'id');return _0x4935e4[_0x3146('0x53')](_0x598d31)[_0x3146('0xc')](function(){for(var _0x2f9a5a=0x0;_0x2f9a5a<_0x598d31[_0x3146('0x1b')];_0x2f9a5a+=0x1){_0x4a82c6[_0x3146('0x4f')](_0x3146('0x54'),{'FaxInteractionId':Number(_0x598d31[_0x2f9a5a]),'UserId':Number(_0x4935e4['id'])});}});}})[_0x3146('0xc')](function(){if(_0x1ec531===_0x3146('0x50')){var _0x1c242c=_[_0x3146('0x16')](_0x4935e4[_0x3146('0x29')],'id');return _0x4935e4[_0x3146('0x55')](_0x1c242c)[_0x3146('0xc')](function(){for(var _0x107803=0x0;_0x107803<_0x1c242c[_0x3146('0x1b')];_0x107803+=0x1){_0x4a82c6[_0x3146('0x4f')](_0x3146('0x56'),{'SmsInteractionId':Number(_0x1c242c[_0x107803]),'UserId':Number(_0x4935e4['id'])});}});}})[_0x3146('0xc')](function(){if(_0x1ec531===_0x3146('0x50')){var _0x46e0b9=_[_0x3146('0x16')](_0x4935e4[_0x3146('0x2b')],'id');return _0x4935e4[_0x3146('0x57')](_0x46e0b9)[_0x3146('0xc')](function(){for(var _0x3da6f0=0x0;_0x3da6f0<_0x46e0b9[_0x3146('0x1b')];_0x3da6f0+=0x1){_0x4a82c6[_0x3146('0x4f')](_0x3146('0x58'),{'OpenchannelInteractionId':Number(_0x46e0b9[_0x3da6f0]),'UserId':Number(_0x4935e4['id'])});}});}})[_0x3146('0xc')](function(){if(_0x1ec531==='leave'){var _0x3fc6fe=_[_0x3146('0x16')](_0x4935e4[_0x3146('0x2c')],'id');return _0x4935e4[_0x3146('0x59')](_0x3fc6fe)[_0x3146('0xc')](function(){for(var _0x2ff344=0x0;_0x2ff344<_0x3fc6fe[_0x3146('0x1b')];_0x2ff344+=0x1){_0x4a82c6[_0x3146('0x4f')](_0x3146('0x5a'),{'WhatsappInteractionId':Number(_0x3fc6fe[_0x2ff344]),'UserId':Number(_0x4935e4['id'])});}});}})[_0x3146('0x5b')](function(_0x530018){_0x58d700['log'](_0x530018);});}}function onDisconnect(_0x50dd2a,_0x1bb876){joinOrLeave(_0x50dd2a,_0x3146('0x50'),_0x1bb876);}function onConnect(_0x4931c6){joinOrLeave(_0x4931c6,_0x3146('0x5c'));}exports['default']=function(_0xf5472b){_0xf5472b['on'](_0x3146('0x5d'),function(_0x248aec){_0x248aec[_0x3146('0x5e')](0x0);_0x248aec[_0x3146('0x5f')]=_0x248aec['request'][_0x3146('0x5d')][_0x3146('0x60')]+':'+_0x248aec[_0x3146('0x61')][_0x3146('0x5d')][_0x3146('0x62')];_0x248aec[_0x3146('0x63')]=new Date();_0x248aec[_0x3146('0x64')]=function(_0x1bfd2a){console[_0x3146('0x64')]('SocketIO\x20'+_0x248aec['nsp'][_0x3146('0x3')]+'['+_0x248aec[_0x3146('0x5f')]+']',_0x1bfd2a);};_0x248aec['on']('disconnect',function(){onDisconnect(_0x248aec,_0xf5472b);_0x248aec[_0x3146('0x64')]('DISCONNECTED');});onConnect(_0x248aec);_0x248aec[_0x3146('0x64')](_0x3146('0x65'));});}; \ No newline at end of file +var _0x4cab=['telephone:%s','trunk:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','leave','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','telephone','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','type','format','%s:queue:%s','length','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','WhatsappQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel'];(function(_0x5bffed,_0x2b9fb7){var _0x5c4697=function(_0x17bf2d){while(--_0x17bf2d){_0x5bffed['push'](_0x5bffed['shift']());}};_0x5c4697(++_0x2b9fb7);}(_0x4cab,0x144));var _0xb4ca=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x4cab[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xb4ca('0x0'));var util=require(_0xb4ca('0x1'));var BPromise=require('bluebird');var db=require(_0xb4ca('0x2'))['db'];var config=require(_0xb4ca('0x3'));var queryQueues={'attributes':['id',_0xb4ca('0x4')],'include':[{'as':_0xb4ca('0x5'),'model':db[_0xb4ca('0x6')],'attributes':['id',_0xb4ca('0x4'),_0xb4ca('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb4ca('0x4')],'where':{'role':_0xb4ca('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb4ca('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb4ca('0x4')],'where':{'role':_0xb4ca('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb4ca('0x4'),'type'],'where':{'type':_0xb4ca('0xa')}};function getAssociatedResources(_0xa602b3,_0x470fb2,_0x77825b){return db[_0xb4ca('0xb')][_0xb4ca('0xc')]({'where':{'name':_0xa602b3,'userProfileId':_0x470fb2},'raw':!![]})[_0xb4ca('0xd')](function(_0xb86668){if(_0xb86668){if(_0xb86668[_0xb4ca('0xe')]){switch(_0xa602b3){case _0xb4ca('0xf'):case _0xb4ca('0x10'):case _0xb4ca('0x11'):case _0xb4ca('0x12'):case _0xb4ca('0x13'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x77825b][_0xb4ca('0x14')](queryQueues);case _0xb4ca('0x15'):return db[_0x77825b]['findAll'](queryTelephones);case _0xb4ca('0x16'):return db[_0x77825b][_0xb4ca('0x14')](queryTrunks);case _0xb4ca('0x17'):return db[_0x77825b][_0xb4ca('0x14')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xb4ca('0x18')],'where':{'sectionId':_0xb86668['id']},'raw':!![]})[_0xb4ca('0xd')](function(_0x1862dd){if(_0x1862dd){var _0x111113={'where':{'id':_['map'](_0x1862dd,_0xb4ca('0x18'))},'raw':!![]};switch(_0x77825b){case _0xb4ca('0x6'):_0x111113[_0xb4ca('0x19')][_0xb4ca('0x7')]=_0xb4ca('0x8');break;case'Campaign':_0x111113['where'][_0xb4ca('0x1a')]=_0xb4ca('0xa');break;}return db[_0x77825b][_0xb4ca('0x14')](_0x111113);}else{return[];}});}}else{return[];}})[_0xb4ca('0xd')](function(_0x2e5236){return _0x2e5236;});}function joinOrLeaveQueues(_0x15371a,_0x348725,_0x3fd927,_0x339330){_0x15371a[_0x348725](util[_0xb4ca('0x1b')](_0xb4ca('0x1c'),_0x3fd927,_0x339330['name']));if(_0x339330[_0xb4ca('0x5')]){for(var _0x3569c2=0x0;_0x3569c2<_0x339330['Agents'][_0xb4ca('0x1d')];_0x3569c2+=0x1){_0x15371a[_0x348725](util[_0xb4ca('0x1b')]('user:%s',_0x339330[_0xb4ca('0x5')][_0x3569c2][_0xb4ca('0x4')]));}}}function joinOrLeave(_0x2ec304,_0x340849,_0x1a07c9){var _0x2c7156;if(_0x2ec304['handshake']['query']['id']){db[_0xb4ca('0x6')][_0xb4ca('0x1e')]({'attributes':['id',_0xb4ca('0x4'),_0xb4ca('0x7'),_0xb4ca('0x1f')],'where':{'id':_0x2ec304[_0xb4ca('0x20')][_0xb4ca('0x21')]['id']},'include':[{'model':db[_0xb4ca('0x22')],'as':_0xb4ca('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xb4ca('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb4ca('0x25')],'as':_0xb4ca('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xb4ca('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb4ca('0x28')],'as':_0xb4ca('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb4ca('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x33316b){if(_0x33316b){_0x2c7156=_0x33316b;_0x2ec304[_0x340849](util[_0xb4ca('0x1b')](_0xb4ca('0x2b'),_0x33316b['name']));var _0x11db95=[];switch(_0x33316b[_0xb4ca('0x7')]){case _0xb4ca('0x2c'):_0x2ec304[_0x340849](_0xb4ca('0x2d'));_0x2ec304[_0x340849](_0xb4ca('0x2e'));if(queryQueues[_0xb4ca('0x2f')](_0xb4ca('0x30'))){delete queryQueues[_0xb4ca('0x30')];}_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x32')][_0xb4ca('0x14')](queryQueues));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x33')]['findAll'](queryQueues));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x34')][_0xb4ca('0x14')](queryQueues));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x35')]['findAll'](queryQueues));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x36')]['findAll'](queryQueues));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x37')][_0xb4ca('0x14')](queryQueues));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x38')]['findAll'](queryQueues));_0x11db95['push'](db[_0xb4ca('0x6')][_0xb4ca('0x14')](queryTelephones));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x39')]['findAll'](queryTrunks));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x3a')][_0xb4ca('0x14')](queryCampaigns));_0x11db95[_0xb4ca('0x31')](db[_0xb4ca('0x6')][_0xb4ca('0x14')](queryAgents));break;case _0xb4ca('0x3b'):_0x2ec304[_0x340849]('voice:inbound');_0x2ec304[_0x340849]('voice:outbound');_0x11db95[_0xb4ca('0x31')](getAssociatedResources(_0xb4ca('0xf'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x32')));_0x11db95[_0xb4ca('0x31')](getAssociatedResources(_0xb4ca('0x10'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x33')));_0x11db95['push'](getAssociatedResources(_0xb4ca('0x11'),_0x33316b['userProfileId'],_0xb4ca('0x34')));_0x11db95[_0xb4ca('0x31')](getAssociatedResources(_0xb4ca('0x12'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x35')));_0x11db95[_0xb4ca('0x31')](getAssociatedResources(_0xb4ca('0x13'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x36')));_0x11db95[_0xb4ca('0x31')](getAssociatedResources('OpenchannelQueues',_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x37')));_0x11db95[_0xb4ca('0x31')](getAssociatedResources(_0xb4ca('0x3c'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x38')));_0x11db95['push'](getAssociatedResources('Telephones',_0x33316b['userProfileId'],_0xb4ca('0x6')));_0x11db95[_0xb4ca('0x31')](getAssociatedResources(_0xb4ca('0x16'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x39')));_0x11db95['push'](getAssociatedResources(_0xb4ca('0x17'),_0x33316b[_0xb4ca('0x1f')],_0xb4ca('0x3a')));_0x11db95[_0xb4ca('0x31')](db['User']['findAll'](queryAgents));break;case'agent':_0x2ec304[_0x340849](_0xb4ca('0x2d'));_0x2ec304[_0x340849](_0xb4ca('0x2e'));_0x11db95[_0xb4ca('0x31')](_0x33316b['getVoiceQueues']({'attributes':['id',_0xb4ca('0x4')]}));_0x11db95['push'](_0x33316b[_0xb4ca('0x3d')]({'attributes':['id',_0xb4ca('0x4')]}));_0x11db95[_0xb4ca('0x31')](_0x33316b[_0xb4ca('0x3e')]({'attributes':['id',_0xb4ca('0x4')]}));_0x11db95['push'](_0x33316b['getSmsQueues']({'attributes':['id',_0xb4ca('0x4')]}));_0x11db95[_0xb4ca('0x31')](_0x33316b[_0xb4ca('0x3f')]({'attributes':['id',_0xb4ca('0x4')]}));_0x11db95[_0xb4ca('0x31')](_0x33316b[_0xb4ca('0x40')]({'attributes':['id','name']}));_0x11db95['push'](_0x33316b[_0xb4ca('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0xb4ca('0x42')](_0x11db95);}})['then'](function(_0x8d0ded){if(_0x8d0ded&&_0x8d0ded[_0xb4ca('0x1d')]){for(var _0x4b20c3=0x0;_0x4b20c3<_0x8d0ded[_0xb4ca('0x1d')];_0x4b20c3+=0x1){for(var _0x1ee7f8=0x0;_0x1ee7f8<_0x8d0ded[_0x4b20c3][_0xb4ca('0x1d')];_0x1ee7f8+=0x1){switch(_0x4b20c3){case 0x0:joinOrLeaveQueues(_0x2ec304,_0x340849,_0xb4ca('0x43'),_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x1:joinOrLeaveQueues(_0x2ec304,_0x340849,_0xb4ca('0x44'),_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x2:joinOrLeaveQueues(_0x2ec304,_0x340849,_0xb4ca('0x45'),_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x3:joinOrLeaveQueues(_0x2ec304,_0x340849,'sms',_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x4:joinOrLeaveQueues(_0x2ec304,_0x340849,_0xb4ca('0x46'),_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x5:joinOrLeaveQueues(_0x2ec304,_0x340849,_0xb4ca('0x47'),_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x6:joinOrLeaveQueues(_0x2ec304,_0x340849,'whatsapp',_0x8d0ded[_0x4b20c3][_0x1ee7f8]);break;case 0x7:_0x2ec304[_0x340849](util['format'](_0xb4ca('0x48'),_0x8d0ded[_0x4b20c3][_0x1ee7f8][_0xb4ca('0x4')]));break;case 0x8:_0x2ec304[_0x340849](util['format'](_0xb4ca('0x49'),_0x8d0ded[_0x4b20c3][_0x1ee7f8][_0xb4ca('0x4')]));break;case 0x9:_0x2ec304[_0x340849](util[_0xb4ca('0x1b')]('campaign:%s:%s',_0x8d0ded[_0x4b20c3][_0x1ee7f8][_0xb4ca('0x1a')],_0x8d0ded[_0x4b20c3][_0x1ee7f8][_0xb4ca('0x4')]));break;case 0xa:_0x2ec304[_0x340849](util[_0xb4ca('0x1b')](_0xb4ca('0x2b'),_0x8d0ded[_0x4b20c3][_0x1ee7f8][_0xb4ca('0x4')]));break;}}}}})[_0xb4ca('0xd')](function(){if(_0x340849==='leave'){var _0x1cdc0a=_[_0xb4ca('0x4a')](_0x2c7156[_0xb4ca('0x23')],'id');return _0x2c7156[_0xb4ca('0x4b')](_0x1cdc0a)['then'](function(){for(var _0x470225=0x0;_0x470225<_0x1cdc0a[_0xb4ca('0x1d')];_0x470225+=0x1){_0x1a07c9[_0xb4ca('0x4c')](_0xb4ca('0x4d'),{'ChatInteractionId':Number(_0x1cdc0a[_0x470225]),'UserId':Number(_0x2c7156['id'])});}});}})[_0xb4ca('0xd')](function(){if(_0x340849==='leave'){var _0x62e7a2=_[_0xb4ca('0x4a')](_0x2c7156['MailInteractions'],'id');return _0x2c7156['removeMailInteractions'](_0x62e7a2)[_0xb4ca('0xd')](function(){for(var _0x91e71f=0x0;_0x91e71f<_0x62e7a2[_0xb4ca('0x1d')];_0x91e71f+=0x1){_0x1a07c9[_0xb4ca('0x4c')](_0xb4ca('0x4e'),{'MailInteractionId':Number(_0x62e7a2[_0x91e71f]),'UserId':Number(_0x2c7156['id'])});}});}})[_0xb4ca('0xd')](function(){if(_0x340849===_0xb4ca('0x4f')){var _0x17b1bb=_[_0xb4ca('0x4a')](_0x2c7156[_0xb4ca('0x26')],'id');return _0x2c7156[_0xb4ca('0x50')](_0x17b1bb)[_0xb4ca('0xd')](function(){for(var _0x4e87ea=0x0;_0x4e87ea<_0x17b1bb[_0xb4ca('0x1d')];_0x4e87ea+=0x1){_0x1a07c9[_0xb4ca('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x17b1bb[_0x4e87ea]),'UserId':Number(_0x2c7156['id'])});}});}})[_0xb4ca('0xd')](function(){if(_0x340849===_0xb4ca('0x4f')){var _0x4a5c90=_[_0xb4ca('0x4a')](_0x2c7156['SmsInteractions'],'id');return _0x2c7156[_0xb4ca('0x51')](_0x4a5c90)[_0xb4ca('0xd')](function(){for(var _0x46ad2c=0x0;_0x46ad2c<_0x4a5c90[_0xb4ca('0x1d')];_0x46ad2c+=0x1){_0x1a07c9[_0xb4ca('0x4c')](_0xb4ca('0x52'),{'SmsInteractionId':Number(_0x4a5c90[_0x46ad2c]),'UserId':Number(_0x2c7156['id'])});}});}})[_0xb4ca('0xd')](function(){if(_0x340849==='leave'){var _0x218ed5=_['map'](_0x2c7156['OpenchannelInteractions'],'id');return _0x2c7156['removeOpenchannelInteractions'](_0x218ed5)[_0xb4ca('0xd')](function(){for(var _0x4e5277=0x0;_0x4e5277<_0x218ed5[_0xb4ca('0x1d')];_0x4e5277+=0x1){_0x1a07c9[_0xb4ca('0x4c')](_0xb4ca('0x53'),{'OpenchannelInteractionId':Number(_0x218ed5[_0x4e5277]),'UserId':Number(_0x2c7156['id'])});}});}})[_0xb4ca('0xd')](function(){if(_0x340849===_0xb4ca('0x4f')){var _0xa2c356=_[_0xb4ca('0x4a')](_0x2c7156[_0xb4ca('0x2a')],'id');return _0x2c7156[_0xb4ca('0x54')](_0xa2c356)[_0xb4ca('0xd')](function(){for(var _0xd8e6fe=0x0;_0xd8e6fe<_0xa2c356['length'];_0xd8e6fe+=0x1){_0x1a07c9['emit'](_0xb4ca('0x55'),{'WhatsappInteractionId':Number(_0xa2c356[_0xd8e6fe]),'UserId':Number(_0x2c7156['id'])});}});}})[_0xb4ca('0x56')](function(_0x366f12){_0x2ec304['log'](_0x366f12);});}}function onDisconnect(_0x2a2b30,_0x1c8f1d){joinOrLeave(_0x2a2b30,_0xb4ca('0x4f'),_0x1c8f1d);}function onConnect(_0x3f3ad5){joinOrLeave(_0x3f3ad5,'join');}exports[_0xb4ca('0x57')]=function(_0x27656f){_0x27656f['on'](_0xb4ca('0x58'),function(_0x260a24){_0x260a24[_0xb4ca('0x59')](0x0);_0x260a24[_0xb4ca('0x5a')]=_0x260a24[_0xb4ca('0x5b')]['connection'][_0xb4ca('0x5c')]+':'+_0x260a24[_0xb4ca('0x5b')][_0xb4ca('0x58')][_0xb4ca('0x5d')];_0x260a24['connectedAt']=new Date();_0x260a24['log']=function(_0x5f2c57){console[_0xb4ca('0x5e')](_0xb4ca('0x5f')+_0x260a24['nsp'][_0xb4ca('0x4')]+'['+_0x260a24['address']+']',_0x5f2c57);};_0x260a24['on'](_0xb4ca('0x60'),function(){onDisconnect(_0x260a24,_0x27656f);_0x260a24['log'](_0xb4ca('0x61'));});onConnect(_0x260a24);_0x260a24['log'](_0xb4ca('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 97d6825..391a2d4 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 _0x6da7=['channel','outgoingmessage','opened','changed','closed','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappMessage','newmessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','event','direction','UserId','User','find','name','interface','format','SIP/%s'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0x6da7,0x1cc));var _0x76da=function(_0x3d5066,_0x423b73){_0x3d5066=_0x3d5066-0x0;var _0x1a8b0b=_0x6da7[_0x3d5066];return _0x1a8b0b;};'use strict';var util=require(_0x76da('0x0'));var db=require(_0x76da('0x1'))['db'];var jayson=require(_0x76da('0x2'));var logger=require(_0x76da('0x3'))('triggers');var client=jayson['client'][_0x76da('0x4')]({'port':0x232a});var triggers=[{'channel':_0x76da('0x5'),'model':_0x76da('0x6'),'event':_0x76da('0x7'),'condition':_0x76da('0x8'),'callback':afterCreate},{'channel':_0x76da('0x5'),'model':'ChatInteraction','event':_0x76da('0x9'),'condition':_0x76da('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x76da('0xb'),'event':_0x76da('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x76da('0xc'),'event':_0x76da('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x76da('0xd'),'model':_0x76da('0xc'),'event':_0x76da('0x9'),'condition':_0x76da('0xa'),'callback':afterUpdate},{'channel':_0x76da('0xd'),'model':_0x76da('0xe'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x76da('0xf'),'model':'WhatsappInteraction','event':_0x76da('0x7'),'condition':_0x76da('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x76da('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x76da('0x10'),'event':_0x76da('0x7'),'condition':_0x76da('0x11'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':'afterCreate','condition':_0x76da('0x8'),'callback':afterCreate},{'channel':_0x76da('0x12'),'model':'FaxInteraction','event':_0x76da('0x9'),'condition':_0x76da('0xa'),'callback':afterUpdate},{'channel':_0x76da('0x12'),'model':_0x76da('0x13'),'event':_0x76da('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x76da('0x14'),'model':_0x76da('0x15'),'event':'afterCreate','condition':_0x76da('0x8'),'callback':afterCreate},{'channel':_0x76da('0x14'),'model':_0x76da('0x15'),'event':_0x76da('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x76da('0x14'),'model':_0x76da('0x16'),'event':_0x76da('0x7'),'condition':_0x76da('0x11'),'callback':afterCreateMessage},{'channel':_0x76da('0x17'),'model':_0x76da('0x18'),'event':_0x76da('0x7'),'condition':_0x76da('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0x76da('0x18'),'event':_0x76da('0x9'),'condition':_0x76da('0xa'),'callback':afterUpdate},{'channel':_0x76da('0x17'),'model':_0x76da('0x19'),'event':_0x76da('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x65ec4d){return client[_0x76da('0x1a')](_0x76da('0x1b'),_0x65ec4d)[_0x76da('0x1c')](function(_0x4c9461){logger[_0x76da('0x1d')](_0x76da('0x1e'),_0x76da('0x1b'),_0x4c9461);if(_0x4c9461[_0x76da('0x1f')]){if(_0x4c9461[_0x76da('0x1f')][_0x76da('0x20')]===0x1f4){logger[_0x76da('0x1f')]('Trigger,\x20%s','EventManager',_0x4c9461[_0x76da('0x1f')]);}}})[_0x76da('0x21')](function(_0xf24bcb){logger[_0x76da('0x1f')](_0x76da('0x1e'),_0x76da('0x1b'),_0xf24bcb);});}function afterCreateMessage(_0x398265,_0xf376d6){return function(_0x5e0988,_0x272aef){_0x5e0988=_0x5e0988[_0x76da('0x22')]({'plain':!![]});_0x5e0988['channel']=_0x398265;_0x5e0988[_0x76da('0x23')]=_0x5e0988[_0x76da('0x24')];if(_0x5e0988[_0x76da('0x25')]){return db[_0x76da('0x26')][_0x76da('0x27')]({'where':{'id':_0x5e0988['UserId']},'attributes':['id',_0x76da('0x28')],'raw':!![]})[_0x76da('0x1c')](function(_0x5e259a){_0x5e0988[_0x76da('0x29')]=util[_0x76da('0x2a')](_0x76da('0x2b'),_0x5e259a[_0x76da('0x28')]);_0x5e0988[_0x76da('0x2c')]=_0x398265;return request({'event':'incomingmessage','message':_0x5e0988});})[_0x76da('0x21')](function(_0x13bb9e){console[_0x76da('0x1f')](_0x13bb9e);});}else{return request({'event':_0x76da('0x2d'),'message':_0x5e0988});}};}function afterCreate(_0x36af34,_0x57c6b1){return function(_0xef4d9e,_0xbbd826){_0xef4d9e=_0xef4d9e[_0x76da('0x22')]({'plain':!![]});_0xef4d9e[_0x76da('0x2c')]=_0x36af34;_0xef4d9e[_0x76da('0x23')]=_0x76da('0x2e');return request({'event':_0x57c6b1,'message':_0xef4d9e});};}function afterUpdate(_0x34cf4e,_0x59172a){return function(_0x2ac347,_0x1b147f){if(_0x2ac347[_0x76da('0x2f')](_0x76da('0x30'))&&_0x2ac347[_0x76da('0x30')]){_0x2ac347=_0x2ac347[_0x76da('0x22')]({'plain':!![]});_0x2ac347['channel']=_0x34cf4e;_0x2ac347[_0x76da('0x23')]=_0x76da('0x30');if(_0x2ac347[_0x76da('0x25')]){return db[_0x76da('0x26')][_0x76da('0x27')]({'where':{'id':_0x2ac347['UserId']},'attributes':['id','name'],'raw':!![]})['then'](function(_0x5cd9ad){_0x2ac347['interface']=util[_0x76da('0x2a')]('SIP/%s',_0x5cd9ad[_0x76da('0x28')]);return request({'event':_0x59172a,'message':_0x2ac347});})[_0x76da('0x21')](function(_0x453f87){console[_0x76da('0x1f')](_0x453f87);});}else{return request({'event':_0x59172a,'message':_0x2ac347});}}};}exports[_0x76da('0x31')]=function(){for(var _0x239ccb=0x0;_0x239ccb=_0x2c1dac['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4a309(_0x16e89a);})[_0xb779('0x11')](function(_0x448a4c){_0x58b082(_0x448a4c);});});}; \ No newline at end of file +var _0x87e2=['then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','role','User','count'];(function(_0x400672,_0x243a7e){var _0x27ed65=function(_0x350ca9){while(--_0x350ca9){_0x400672['push'](_0x400672['shift']());}};_0x27ed65(++_0x243a7e);}(_0x87e2,0x16d));var _0x287e=function(_0x360a5a,_0x566250){_0x360a5a=_0x360a5a-0x0;var _0x3e3f36=_0x87e2[_0x360a5a];return _0x3e3f36;};'use strict';var _=require(_0x287e('0x0'));var BPromise=require(_0x287e('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=[_0x287e('0x2'),_0x287e('0x3'),_0x287e('0x4'),_0x287e('0x5'),_0x287e('0x6'),_0x287e('0x7'),_0x287e('0x8')];exports[_0x287e('0x9')]=function(){return channels;};exports[_0x287e('0xa')]=function(_0x156874){_0x156874=_0x156874[_0x287e('0xb')]();return _[_0x287e('0xc')](channels,_0x156874);};exports[_0x287e('0xd')]=function(_0x3d5d3b,_0x2ebd63,_0x130c4d,_0x343685){var _0x4d66ba={'loginAttempts':_0x2ebd63,'blocked':_0x130c4d};if(!_['isUndefined'](_0x343685)){_0x4d66ba[_0x287e('0xe')]=_0x343685;}return _0x3d5d3b[_0x287e('0xf')](_0x4d66ba);};exports['getLicense']=function(_0x546b1f){return new BPromise(function(_0x16a273,_0x349b3c){var _0x28656a=0x0;if(_0x546b1f[_0x287e('0x10')]!=='agent'){_0x16a273(_0x546b1f);}db[_0x287e('0x11')][_0x287e('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x546b1f['id']}}})[_0x287e('0x13')](function(_0x2d67d0){_0x28656a=_0x2d67d0;return util[_0x287e('0x14')]();})[_0x287e('0x13')](function(_0x365549){if(_0x365549&&_0x365549['agents']&&_0x28656a>=_0x365549[_0x287e('0x15')]){throw Error(_0x287e('0x16'));}_0x16a273(_0x546b1f);})[_0x287e('0x17')](function(_0x11ec58){_0x349b3c(_0x11ec58);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8d19c0f..b7c141c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x159f=['json','404','status','render'];(function(_0x3cb229,_0x39b3ee){var _0x1699e6=function(_0x2be908){while(--_0x2be908){_0x3cb229['push'](_0x3cb229['shift']());}};_0x1699e6(++_0x39b3ee);}(_0x159f,0xcd));var _0xf159=function(_0x4b8d7d,_0x398601){_0x4b8d7d=_0x4b8d7d-0x0;var _0x41708b=_0x159f[_0x4b8d7d];return _0x41708b;};'use strict';module['exports'][0x194]=function pageNotFound(_0x364862,_0x1d430a){var _0x8ee0e8=_0xf159('0x0');var _0x11a907=0x194;var _0x4244b3={'status':_0x11a907};_0x1d430a[_0xf159('0x1')](_0x4244b3[_0xf159('0x1')]);_0x1d430a[_0xf159('0x2')](_0x8ee0e8,{},function(_0x1508e5,_0x2746fb){if(_0x1508e5){return _0x1d430a[_0xf159('0x1')](_0x4244b3[_0xf159('0x1')])[_0xf159('0x3')](_0x4244b3);}_0x1d430a['send'](_0x2746fb);});}; \ No newline at end of file +var _0x26d5=['exports','404','status','render','json','send'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0x26d5,0x186));var _0x526d=function(_0x3c7a3e,_0x471b06){_0x3c7a3e=_0x3c7a3e-0x0;var _0xda56f0=_0x26d5[_0x3c7a3e];return _0xda56f0;};'use strict';module[_0x526d('0x0')][0x194]=function pageNotFound(_0x115d12,_0x4a62f1){var _0x5e4a5d=_0x526d('0x1');var _0x21b7ba=0x194;var _0x2318c3={'status':_0x21b7ba};_0x4a62f1[_0x526d('0x2')](_0x2318c3[_0x526d('0x2')]);_0x4a62f1[_0x526d('0x3')](_0x5e4a5d,{},function(_0x464ebe,_0xe1b70f){if(_0x464ebe){return _0x4a62f1['status'](_0x2318c3[_0x526d('0x2')])[_0x526d('0x4')](_0x2318c3);}_0x4a62f1[_0x526d('0x5')](_0xe1b70f);});}; \ No newline at end of file diff --git a/server/migrations/2.5.1.js b/server/migrations/2.5.1.js new file mode 100644 index 0000000..13013e3 --- /dev/null +++ b/server/migrations/2.5.1.js @@ -0,0 +1,167 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); + +var logger = require('../config/logger')('migration'); + +var Sequence = function () {}; + +Sequence.prototype.enqueue = function (fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function (queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function (table, column, type) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function () { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function (table, column, type) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .addColumn(table, column, type) + .then(function () { + logger.info('Added column %s to %s', column, table); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function (table) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .dropTable(table, { + force: true + }) + .then(function () { + logger.info('table dropped %s', table); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function (table, column, options) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .addIndex(table, column, { + indexName: options.indexName, + indicesType: options.indicesType + }) + .then(function () { + logger.info('addIndex %s %s %s [%s]', table, column.join(','), options.indexName, options.indicesType); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function (table, indexName) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function () { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function (sql) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface.sequelize + .query(sql) + .then(function () { + logger.info('query %s', sql); + }) + .catch(function (err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function (table, column) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .removeColumn(table, column) + .then(function () { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function (err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function (table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function () { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function () { + logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table); + }) + .catch(function (err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null + }) + ); + }); + }); +}; + +Migration.prototype.final = function (resolve) { + this.sequence.enqueue(function () { + return resolve(); + }); +}; + +module.exports = { + up: function (queryInterface, Sequelize) { + return new BPromise(function (resolve) { + + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function (queryInterface, Sequelize) { + // var migration = new Migration(queryInterface); + } +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b7a9bd0..1c4c82a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4345=['SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','CampaignId','Automation','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Intervals','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','SugarcrmConfiguration','Description','Field','VariableId','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','ServicenowField','Dynamics365Account','ToId','SessionId','ProjectId','VoiceQueues','team_has_sms_queues','team_has_openchannel_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSection','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueue','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','lodash','jstz','determine','sequelize','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','mysql','name','database','username','password','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','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','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','Attachment','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','CloudProvider','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','Notifications','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','VoiceQueue','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailbox','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','Users','Interaction','restrict','TagId','Dashboard','Items','FaxAccountId','Exntensions','Owner','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','ThroughTags','SmsInteractionId'];(function(_0x3d5e7f,_0x591b6d){var _0x4f31bb=function(_0x4bbb4c){while(--_0x4bbb4c){_0x3d5e7f['push'](_0x3d5e7f['shift']());}};_0x4f31bb(++_0x591b6d);}(_0x4345,0x77));var _0x5434=function(_0xe102d7,_0x1c1fe0){_0xe102d7=_0xe102d7-0x0;var _0xdbd762=_0x4345[_0xe102d7];return _0xdbd762;};'use strict';var path=require(_0x5434('0x0'));var config=require(_0x5434('0x1'));var Sequelize=require('sequelize');var _=require(_0x5434('0x2'));var jstz=require(_0x5434('0x3'));var timezone=jstz[_0x5434('0x4')]();config[_0x5434('0x5')]=_['defaultsDeep'](config[_0x5434('0x5')],{'database':'motion2','username':_0x5434('0x6'),'password':_0x5434('0x7'),'options':{'host':_0x5434('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x5434('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x5434('0xa'),'collate':_0x5434('0xb')}}});config[_0x5434('0xc')]=_[_0x5434('0xd')](config[_0x5434('0xc')],{'database':_0x5434('0xe'),'username':_0x5434('0x6'),'password':_0x5434('0x7'),'options':{'host':_0x5434('0x8'),'port':0xcea,'dialect':_0x5434('0xf'),'dialectOptions':{'charset':_0x5434('0x9')},'logging':![],'timezone':timezone[_0x5434('0x10')](),'define':{'charset':_0x5434('0xa'),'collate':_0x5434('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x5434('0x11')],config['sequelize'][_0x5434('0x12')],config[_0x5434('0x5')][_0x5434('0x13')],config[_0x5434('0x5')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5434('0xc')][_0x5434('0x11')],config['sequelizeHistory'][_0x5434('0x12')],config[_0x5434('0xc')][_0x5434('0x13')],config[_0x5434('0xc')]['options'])};db[_0x5434('0x14')]=db[_0x5434('0x5')]['import'](_0x5434('0x15'));db['VoiceChanSpy']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x17'));db[_0x5434('0x18')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x19'));db['VoiceExtension']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x1a'));db['VoiceMusicOnHold']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x1b'));db['VoiceQueue']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x1c'));db[_0x5434('0x1d')]=db[_0x5434('0x5')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x5434('0x1e')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x1f'));db[_0x5434('0x20')]=db[_0x5434('0x5')]['import']('../api/voiceMail/voiceMail.model');db[_0x5434('0x21')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x22'));db[_0x5434('0x23')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x24'));db[_0x5434('0x25')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x26'));db['VoiceAgentReport']=db['sequelize']['import'](_0x5434('0x27'));db[_0x5434('0x28')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x29'));db['MemberReport']=db[_0x5434('0x5')][_0x5434('0x16')]('../api/memberReport/memberReport.model');db[_0x5434('0x2a')]=db[_0x5434('0x5')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x2b'));db[_0x5434('0x2c')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x5434('0x2d')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x2e'));db[_0x5434('0x2f')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/userChatQueue/userChatQueue.model');db[_0x5434('0x30')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x31'));db[_0x5434('0x32')]=db[_0x5434('0x5')]['import'](_0x5434('0x33'));db[_0x5434('0x34')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x35'));db[_0x5434('0x36')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x37'));db[_0x5434('0x38')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x39'));db[_0x5434('0x3a')]=db[_0x5434('0x5')]['import'](_0x5434('0x3b'));db[_0x5434('0x3c')]=db['sequelize']['import'](_0x5434('0x3d'));db[_0x5434('0x3e')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x3f'));db[_0x5434('0x40')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x41'));db['MailSubstatus']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x42'));db[_0x5434('0x43')]=db['sequelize'][_0x5434('0x16')]('../api/mailInteraction/mailInteraction.model');db[_0x5434('0x44')]=db[_0x5434('0x5')]['import'](_0x5434('0x45'));db[_0x5434('0x46')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x47'));db[_0x5434('0x48')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x49'));db[_0x5434('0x4a')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x4b'));db[_0x5434('0x4c')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x4d'));db[_0x5434('0x4e')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x4f'));db[_0x5434('0x50')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x51'));db[_0x5434('0x52')]=db[_0x5434('0x5')]['import'](_0x5434('0x53'));db[_0x5434('0x54')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x55'));db[_0x5434('0x56')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/faxQueueReport/faxQueueReport.model');db[_0x5434('0x57')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x58'));db[_0x5434('0x59')]=db['sequelize']['import'](_0x5434('0x5a'));db[_0x5434('0x5b')]=db[_0x5434('0x5')]['import']('../api/smsInteraction/smsInteraction.model');db[_0x5434('0x5c')]=db[_0x5434('0x5')]['import'](_0x5434('0x5d'));db[_0x5434('0x5e')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x5f'));db['OpenchannelAccount']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x60'));db[_0x5434('0x61')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x62'));db[_0x5434('0x63')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5434('0x64')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x65'));db[_0x5434('0x66')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x67'));db[_0x5434('0x68')]=db[_0x5434('0x5')]['import'](_0x5434('0x69'));db['OpenchannelQueueReport']=db['sequelize'][_0x5434('0x16')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x6a'));db[_0x5434('0x6b')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0x5434('0x6c')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x6d'));db[_0x5434('0x6e')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x6f'));db[_0x5434('0x70')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x71'));db[_0x5434('0x72')]=db[_0x5434('0x5')]['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x73'));db[_0x5434('0x74')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x75'));db[_0x5434('0x76')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x77'));db[_0x5434('0x78')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x79'));db[_0x5434('0x7a')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x7b'));db[_0x5434('0x7c')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x7d'));db[_0x5434('0x7e')]=db['sequelize']['import'](_0x5434('0x7f'));db[_0x5434('0x80')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x81'));db['CmCustomField']=db[_0x5434('0x5')]['import']('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x82'));db['Automation']=db['sequelize']['import'](_0x5434('0x83'));db[_0x5434('0x84')]=db[_0x5434('0x5')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x5434('0x85')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x86'));db['Condition']=db['sequelize'][_0x5434('0x16')](_0x5434('0x87'));db[_0x5434('0x88')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x89'));db['Pause']=db[_0x5434('0x5')]['import'](_0x5434('0x8a'));db[_0x5434('0x8b')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x8c'));db[_0x5434('0x8d')]=db[_0x5434('0x5')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x5434('0x8e')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x8f'));db[_0x5434('0x90')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/sound/sound.model');db[_0x5434('0x91')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x92'));db[_0x5434('0x93')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x94'));db['Trigger']=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x5434('0x95')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/variable/variable.model');db[_0x5434('0x96')]=db['sequelize']['import'](_0x5434('0x97'));db[_0x5434('0x98')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x99'));db[_0x5434('0x9a')]=db[_0x5434('0x5')]['import'](_0x5434('0x9b'));db[_0x5434('0x9c')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x9d'));db[_0x5434('0x9e')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x9f'));db[_0x5434('0xa0')]=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0x5434('0xa1')]=db['sequelize']['import'](_0x5434('0xa2'));db[_0x5434('0xa3')]=db[_0x5434('0x5')]['import'](_0x5434('0xa4'));db['SalesforceAccount']=db['sequelize']['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x5434('0xa5')]=db[_0x5434('0x5')]['import'](_0x5434('0xa6'));db['SalesforceField']=db[_0x5434('0x5')][_0x5434('0x16')]('../api/intSalesforceField/intSalesforceField.model');db[_0x5434('0xa7')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db['sequelize']['import'](_0x5434('0xa8'));db[_0x5434('0xa9')]=db['sequelize'][_0x5434('0x16')](_0x5434('0xaa'));db[_0x5434('0xab')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xac'));db[_0x5434('0xad')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xae'));db[_0x5434('0xaf')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xb0'));db[_0x5434('0xb1')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xb2'));db[_0x5434('0xb3')]=db[_0x5434('0x5')]['import'](_0x5434('0xb4'));db[_0x5434('0xb5')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xb6'));db[_0x5434('0xb7')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xb8'));db['ZendeskConfiguration']=db[_0x5434('0x5')]['import'](_0x5434('0xb9'));db[_0x5434('0xba')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/intZendeskField/intZendeskField.model');db[_0x5434('0xbb')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xbc'));db[_0x5434('0xbd')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xbe'));db['FreshdeskField']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xbf'));db[_0x5434('0xc0')]=db['sequelize'][_0x5434('0x16')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x5434('0xc1')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xc2'));db[_0x5434('0xc3')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xc4'));db['ServicenowAccount']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xc5'));db['ServicenowConfiguration']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xc6'));db['ServicenowField']=db['sequelize'][_0x5434('0x16')](_0x5434('0xc7'));db['Dynamics365Account']=db['sequelize']['import'](_0x5434('0xc8'));db[_0x5434('0xc9')]=db['sequelize']['import'](_0x5434('0xca'));db[_0x5434('0xcb')]=db['sequelize']['import'](_0x5434('0xcc'));db[_0x5434('0xcd')]=db[_0x5434('0x5')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x5434('0xce')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xcf'));db[_0x5434('0xd0')]=db[_0x5434('0x5')]['import'](_0x5434('0xd1'));db[_0x5434('0x96')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x97'));db['Network']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xd2'));db[_0x5434('0xd3')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/chatQueueReport/chatQueueReport.model');db[_0x5434('0xd4')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xd5'));db[_0x5434('0xd6')]=db['sequelize'][_0x5434('0x16')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x5434('0xd7')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xd8'));db['JscriptySessionReport']=db[_0x5434('0x5')][_0x5434('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x5434('0xd9')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xda'));db['SquareReport']=db[_0x5434('0x5')]['import'](_0x5434('0xdb'));db[_0x5434('0xdc')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xdd'));db[_0x5434('0xde')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xdf'));db[_0x5434('0xe0')]=db[_0x5434('0x5')]['import'](_0x5434('0xe1'));db['SquareOdbc']=db[_0x5434('0x5')]['import'](_0x5434('0xe2'));db['SquareProject']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xe3'));db[_0x5434('0xe4')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xe5'));db['SquareMessage']=db['sequelize'][_0x5434('0x16')](_0x5434('0xe6'));db[_0x5434('0xe7')]=db[_0x5434('0x5')]['import'](_0x5434('0xe8'));db['License']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xe9'));db[_0x5434('0xea')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/campaign/campaign.model');db[_0x5434('0xeb')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/migration/migration.model');db[_0x5434('0xec')]=db['sequelize'][_0x5434('0x16')]('../api/attachment/attachment.model');db[_0x5434('0xed')]=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xee'));db['MailTransferReport']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xef'));db[_0x5434('0xf0')]=db['sequelize'][_0x5434('0x16')](_0x5434('0xf1'));db[_0x5434('0xf2')]=db[_0x5434('0x5')]['import'](_0x5434('0xf3'));db[_0x5434('0xf4')]=db[_0x5434('0x5')]['import'](_0x5434('0xf5'));db[_0x5434('0xf6')]=db['sequelize']['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x5434('0xf7')]=db['sequelize'][_0x5434('0x16')](_0x5434('0xf8'));db['VoicePrefix']=db['sequelize'][_0x5434('0x16')](_0x5434('0xf9'));db[_0x5434('0xfa')]=db[_0x5434('0x5')]['import'](_0x5434('0xfb'));db['UserProfileSection']=db['sequelize'][_0x5434('0x16')](_0x5434('0xfc'));db['UserProfileResource']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0xfd'));db[_0x5434('0xfe')]=db['sequelize'][_0x5434('0x16')](_0x5434('0xff'));db['WhatsappAccount']=db[_0x5434('0x5')][_0x5434('0x16')](_0x5434('0x100'));db[_0x5434('0x101')]=db['sequelize'][_0x5434('0x16')](_0x5434('0x102'));db[_0x5434('0x103')]=db[_0x5434('0x5')]['import'](_0x5434('0x104'));db['WhatsappMessage']=db[_0x5434('0x5')]['import'](_0x5434('0x105'));db[_0x5434('0x106')]=db[_0x5434('0x5')]['import'](_0x5434('0x107'));db[_0x5434('0x108')]=db['sequelize'][_0x5434('0x16')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x5434('0x5')][_0x5434('0x16')]('../api/whatsappQueue/whatsappQueue.model');db[_0x5434('0x109')]=db[_0x5434('0x5')][_0x5434('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0x5434('0x14')]['hasOne'](db[_0x5434('0x20')],{'as':_0x5434('0x20'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x10b')});db['User'][_0x5434('0x10c')](db[_0x5434('0x1d')],{'as':_0x5434('0x10d'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x14')][_0x5434('0x10c')](db['UserVoiceQueueRt'],{'as':_0x5434('0x10e'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x14')]['hasMany'](db[_0x5434('0x10f')],{'as':_0x5434('0x110'),'onDelete':_0x5434('0x10a'),'hooks':!![]});db['User']['hasMany'](db[_0x5434('0x7c')],{'as':_0x5434('0x111'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x14')][_0x5434('0x10c')](db['CmHopperHistory'],{'as':_0x5434('0x112'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x14')][_0x5434('0x10c')](db['ReportAgentPreview'],{'as':_0x5434('0x80'),'foreignKey':'UserId'});db[_0x5434('0x14')][_0x5434('0x10c')](db[_0x5434('0x63')],{'as':_0x5434('0x113'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x14')][_0x5434('0x10c')](db['ChatInteraction'],{'as':_0x5434('0x114'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x14')][_0x5434('0x10c')](db[_0x5434('0x5b')],{'as':'SmsInteractions','foreignKey':_0x5434('0x10b')});db['User'][_0x5434('0x10c')](db[_0x5434('0x50')],{'as':_0x5434('0x115'),'foreignKey':'UserId'});db['User']['hasMany'](db['MailInteraction'],{'as':_0x5434('0x116'),'foreignKey':_0x5434('0x10b')});db['User'][_0x5434('0x10c')](db[_0x5434('0x103')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x5434('0x14')]['hasMany'](db[_0x5434('0xfe')],{'as':_0x5434('0x117'),'foreignKey':'SenderId'});db[_0x5434('0x14')][_0x5434('0x118')](db[_0x5434('0xfa')],{'as':_0x5434('0xfa'),'foreignKey':_0x5434('0x119')});db['User'][_0x5434('0x11a')](db[_0x5434('0x72')],{'as':_0x5434('0x11b'),'through':'chat_group_has_users'});db[_0x5434('0x14')][_0x5434('0x11a')](db['CmContact'],{'as':_0x5434('0x11c'),'through':_0x5434('0x11d')});db[_0x5434('0x14')][_0x5434('0x11a')](db['CmList'],{'as':_0x5434('0x11e'),'through':_0x5434('0x11f')});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0xe7')],{'through':_0x5434('0x120')});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x43')],{'as':'MailInteractions','through':_0x5434('0x121')});db[_0x5434('0x14')]['belongsToMany'](db[_0x5434('0x6b')],{'as':_0x5434('0x114'),'through':_0x5434('0x122')});db[_0x5434('0x14')][_0x5434('0x11a')](db['FaxInteraction'],{'as':_0x5434('0x115'),'through':_0x5434('0x123')});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x5b')],{'as':'SmsInteractions','through':_0x5434('0x124')});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x63')],{'as':_0x5434('0x113'),'through':'user_has_openchannel_interactions'});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x103')],{'as':_0x5434('0x125'),'through':_0x5434('0x126')});db['User'][_0x5434('0x11a')](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x40')],{'as':_0x5434('0x127'),'through':_0x5434('0x30'),'required':![]});db[_0x5434('0x14')]['belongsToMany'](db[_0x5434('0x70')],{'as':_0x5434('0x128'),'through':_0x5434('0x2f'),'required':![],'hooks':!![]});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x54')],{'as':_0x5434('0x129'),'through':_0x5434('0x32'),'required':![]});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x5e')],{'as':_0x5434('0x12a'),'through':_0x5434('0x34'),'required':![]});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x66')],{'as':_0x5434('0x12b'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db['WhatsappQueue'],{'as':_0x5434('0x12c'),'through':'UserWhatsappQueue','required':![]});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0xf7')],{'through':_0x5434('0x11f')});db['User'][_0x5434('0x11a')](db[_0x5434('0x12d')],{'as':_0x5434('0x12e'),'through':_0x5434('0x12f'),'required':![]});db[_0x5434('0x14')][_0x5434('0x11a')](db['ChatWebsite'],{'as':_0x5434('0x130'),'through':_0x5434('0x131')});db[_0x5434('0x14')][_0x5434('0x11a')](db['FaxAccount'],{'as':_0x5434('0x132'),'through':_0x5434('0x133')});db['User'][_0x5434('0x11a')](db[_0x5434('0x3e')],{'as':_0x5434('0x134'),'through':_0x5434('0x135')});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x136')],{'as':_0x5434('0x137'),'through':'user_has_openchannel_accounts'});db[_0x5434('0x14')]['belongsToMany'](db[_0x5434('0x57')],{'as':_0x5434('0x138'),'through':_0x5434('0x139')});db[_0x5434('0x14')][_0x5434('0x11a')](db[_0x5434('0x13a')],{'as':_0x5434('0x13b'),'through':'user_has_whatsapp_accounts'});db['User'][_0x5434('0x11a')](db[_0x5434('0x13c')],{'as':_0x5434('0x13d'),'through':_0x5434('0x13e')});db[_0x5434('0x13f')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x140')});db[_0x5434('0x18')][_0x5434('0x10c')](db['VoiceExtension'],{'onDelete':_0x5434('0x10a')});db[_0x5434('0x10f')][_0x5434('0x10c')](db[_0x5434('0x10f')],{'as':_0x5434('0x141'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x142')]['belongsToMany'](db[_0x5434('0x90')],{'as':_0x5434('0x143'),'through':'moh_has_sounds'});db[_0x5434('0x144')][_0x5434('0x10c')](db[_0x5434('0x2c')],{'as':_0x5434('0x145'),'foreignKey':'VoiceQueueId'});db[_0x5434('0x144')]['hasMany'](db['CmHopper'],{'as':_0x5434('0x146'),'foreignKey':_0x5434('0x147')});db['VoiceQueue']['hasMany'](db[_0x5434('0x7c')],{'as':_0x5434('0x111'),'foreignKey':'VoiceQueueId'});db[_0x5434('0x144')][_0x5434('0x10c')](db['CmHopperHistory'],{'as':_0x5434('0x148'),'foreignKey':_0x5434('0x147')});db[_0x5434('0x144')][_0x5434('0x10c')](db[_0x5434('0x80')],{'as':'ReportAgentPreview','foreignKey':_0x5434('0x147')});db[_0x5434('0x144')][_0x5434('0x10c')](db[_0x5434('0x7a')],{'as':_0x5434('0x149'),'foreignKey':'VoiceQueueId'});db[_0x5434('0x144')][_0x5434('0x10c')](db['JscriptySessionReport'],{'as':_0x5434('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x5434('0x144')][_0x5434('0x118')](db[_0x5434('0x2a')],{'as':'Trunk','foreignKey':_0x5434('0x14b')});db['VoiceQueue'][_0x5434('0x118')](db[_0x5434('0x2a')],{'as':'TrunkBackup','foreignKey':_0x5434('0x14c')});db[_0x5434('0x144')]['belongsTo'](db[_0x5434('0x88')],{'as':_0x5434('0x88'),'foreignKey':_0x5434('0x14d')});db['VoiceQueue'][_0x5434('0x118')](db[_0x5434('0x14e')],{'as':_0x5434('0x14f'),'foreignKey':_0x5434('0x150')});db[_0x5434('0x144')][_0x5434('0x11a')](db['CmList'],{'as':'Lists','through':_0x5434('0x151')});db[_0x5434('0x144')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x2d')});db[_0x5434('0x144')][_0x5434('0x11a')](db[_0x5434('0xe7')],{'as':_0x5434('0x153'),'through':_0x5434('0x154')});db[_0x5434('0x144')][_0x5434('0x11a')](db['CmList'],{'as':'BlackLists','through':_0x5434('0x155')});db[_0x5434('0x1d')][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x14'),'foreignKey':_0x5434('0x10b')});db['ScreenRecording']['belongsTo'](db[_0x5434('0x14')],{'as':_0x5434('0x14'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x20')]['hasMany'](db[_0x5434('0x21')],{'as':_0x5434('0x156'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x5434('0x157')});db[_0x5434('0x21')]['belongsTo'](db[_0x5434('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x5434('0x157')});db[_0x5434('0x23')][_0x5434('0x10c')](db[_0x5434('0x28')],{'as':'QueueCalls','foreignKey':_0x5434('0x158'),'constraints':![]});db['VoiceCallReport'][_0x5434('0x10c')](db[_0x5434('0x159')],{'as':_0x5434('0x15a'),'foreignKey':_0x5434('0x158'),'constraints':![]});db['VoiceCallReport'][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x14'),'foreignKey':'UserId'});db[_0x5434('0x23')][_0x5434('0x118')](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db['MailServerIn'][_0x5434('0x118')](db['MailAccount'],{'as':_0x5434('0x3e'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x5434('0x118')](db[_0x5434('0x3e')],{'as':_0x5434('0x3e'),'foreignKey':_0x5434('0x15d')});db[_0x5434('0x3e')][_0x5434('0x15e')](db[_0x5434('0x3a')],{'as':_0x5434('0x15f'),'onDelete':_0x5434('0x10a')});db['MailAccount']['hasOne'](db[_0x5434('0x3c')],{'as':_0x5434('0x160'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x3e')]['hasMany'](db[_0x5434('0x85')],{'as':_0x5434('0x161'),'foreignKey':'MailAccountId'});db[_0x5434('0x3e')][_0x5434('0x10c')](db['CannedAnswer'],{'as':_0x5434('0x162'),'foreignKey':_0x5434('0x15d')});db[_0x5434('0x3e')][_0x5434('0x10c')](db[_0x5434('0x44')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x5434('0x3e')][_0x5434('0x10c')](db[_0x5434('0x43')],{'as':_0x5434('0x163')});db[_0x5434('0x3e')][_0x5434('0x10c')](db[_0x5434('0x46')],{'as':_0x5434('0x141')});db[_0x5434('0x3e')][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':_0x5434('0x165')});db[_0x5434('0x3e')]['belongsTo'](db[_0x5434('0x93')],{'as':'Template','foreignKey':_0x5434('0x166')});db[_0x5434('0x3e')][_0x5434('0x118')](db['Pause'],{'as':_0x5434('0x14f'),'foreignKey':_0x5434('0x150')});db[_0x5434('0x3e')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x135')});db['MailQueue'][_0x5434('0x11a')](db['User'],{'as':_0x5434('0x152'),'through':_0x5434('0x30')});db[_0x5434('0x40')][_0x5434('0x11a')](db[_0x5434('0xe7')],{'through':_0x5434('0x167'),'as':_0x5434('0x153')});db['MailInteraction'][_0x5434('0x10c')](db[_0x5434('0x44')],{'as':_0x5434('0x156'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x168')});db[_0x5434('0x43')][_0x5434('0x118')](db[_0x5434('0x3e')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x15d')});db['MailInteraction'][_0x5434('0x118')](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db['MailInteraction'][_0x5434('0x118')](db[_0x5434('0x14')],{'as':'Owner','foreignKey':_0x5434('0x10b')});db[_0x5434('0x43')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x16a'),'as':_0x5434('0x16b')});db[_0x5434('0x43')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db['MailInteraction'][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x16c'),'through':'user_has_mail_interactions','foreignKey':_0x5434('0x168')});db[_0x5434('0x44')][_0x5434('0x10c')](db[_0x5434('0xec')],{'as':'Attachments','onDelete':_0x5434('0x10a')});db[_0x5434('0x44')]['belongsTo'](db[_0x5434('0x14')],{'as':_0x5434('0x14')});db['MailMessage'][_0x5434('0x118')](db[_0x5434('0x76')],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x15b')});db['MailMessage'][_0x5434('0x118')](db['MailInteraction'],{'as':_0x5434('0x16d'),'foreignKey':_0x5434('0x168')});db[_0x5434('0x44')]['belongsTo'](db['MailAccount'],{'as':_0x5434('0x169'),'foreignKey':'MailAccountId'});db[_0x5434('0x46')]['belongsTo'](db[_0x5434('0x14')],{'onDelete':_0x5434('0x16e')});db['MailApplication'][_0x5434('0x118')](db[_0x5434('0x40')],{'onDelete':_0x5434('0x16e')});db[_0x5434('0x46')][_0x5434('0x118')](db[_0x5434('0x3e')],{'onDelete':_0x5434('0x16e')});db[_0x5434('0x46')][_0x5434('0x118')](db[_0x5434('0x88')],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x14d')});db[_0x5434('0x46')][_0x5434('0x118')](db[_0x5434('0x91')],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x16f')});db['MailQueueReport'][_0x5434('0x118')](db[_0x5434('0x3e')],{});db['MailQueueReport'][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':_0x5434('0x165')});db[_0x5434('0x48')]['belongsTo'](db[_0x5434('0x76')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5434('0x48')][_0x5434('0x118')](db[_0x5434('0x43')],{});db['MailQueueReport'][_0x5434('0x118')](db[_0x5434('0x44')],{});db[_0x5434('0x48')][_0x5434('0x118')](db['User'],{});db[_0x5434('0x48')]['belongsTo'](db[_0x5434('0x40')],{});db[_0x5434('0x170')]['hasMany'](db[_0x5434('0x4a')],{'as':_0x5434('0x171'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x4c')][_0x5434('0x10c')](db[_0x5434('0x85')],{'as':_0x5434('0x161'),'foreignKey':_0x5434('0x172')});db[_0x5434('0x4c')][_0x5434('0x10c')](db[_0x5434('0x84')],{'as':_0x5434('0x162'),'foreignKey':_0x5434('0x172')});db[_0x5434('0x4c')][_0x5434('0x10c')](db['FaxInteraction'],{'as':'Interactions'});db[_0x5434('0x4c')][_0x5434('0x10c')](db[_0x5434('0x4e')],{'as':_0x5434('0x141')});db['FaxAccount'][_0x5434('0x10c')](db[_0x5434('0x10f')],{'as':_0x5434('0x173'),'onDelete':'cascade'});db[_0x5434('0x4c')][_0x5434('0x10c')](db[_0x5434('0x52')],{'as':_0x5434('0x156')});db[_0x5434('0x4c')][_0x5434('0x118')](db[_0x5434('0x2a')],{'as':_0x5434('0x2a')});db[_0x5434('0x4c')][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':_0x5434('0x165')});db[_0x5434('0x4c')][_0x5434('0x118')](db[_0x5434('0x14e')],{'as':_0x5434('0x14f'),'foreignKey':_0x5434('0x150')});db[_0x5434('0x4c')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':'user_has_fax_accounts'});db[_0x5434('0x4e')]['belongsTo'](db[_0x5434('0x14')],{'onDelete':'restrict'});db[_0x5434('0x4e')][_0x5434('0x118')](db['FaxQueue'],{'onDelete':_0x5434('0x16e')});db['FaxApplication'][_0x5434('0x118')](db[_0x5434('0x4c')],{'onDelete':_0x5434('0x16e')});db[_0x5434('0x4e')][_0x5434('0x118')](db[_0x5434('0x91')],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x16f')});db[_0x5434('0x50')][_0x5434('0x10c')](db[_0x5434('0x52')],{'as':_0x5434('0x156'),'onDelete':_0x5434('0x10a'),'foreignKey':'FaxInteractionId'});db[_0x5434('0x50')][_0x5434('0x118')](db[_0x5434('0x4c')],{'as':_0x5434('0x169'),'foreignKey':'FaxAccountId'});db[_0x5434('0x50')][_0x5434('0x118')](db[_0x5434('0x76')],{'as':'Contact','foreignKey':'ContactId'});db['FaxInteraction'][_0x5434('0x118')](db['User'],{'as':_0x5434('0x174'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x50')][_0x5434('0x11a')](db['Tag'],{'through':_0x5434('0x175'),'as':_0x5434('0x16b')});db[_0x5434('0x50')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x175'),'as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db[_0x5434('0x14')],{'as':_0x5434('0x16c'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x5434('0x118')](db[_0x5434('0x14')],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x14')});db[_0x5434('0x52')][_0x5434('0x118')](db[_0x5434('0x50')],{'as':_0x5434('0x16d'),'foreignKey':_0x5434('0x176')});db[_0x5434('0x52')][_0x5434('0x118')](db[_0x5434('0x76')],{'onDelete':'cascade','as':_0x5434('0x15b')});db[_0x5434('0x52')][_0x5434('0x118')](db[_0x5434('0xec')],{'as':_0x5434('0xec'),'foreignKey':_0x5434('0x177')});db[_0x5434('0x52')][_0x5434('0x118')](db[_0x5434('0x4c')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x172')});db['FaxQueue']['belongsToMany'](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x32')});db[_0x5434('0x54')]['belongsToMany'](db[_0x5434('0xe7')],{'through':_0x5434('0x178'),'as':_0x5434('0x153')});db[_0x5434('0x56')][_0x5434('0x118')](db[_0x5434('0x4c')],{});db[_0x5434('0x56')][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':'ListId'});db[_0x5434('0x56')][_0x5434('0x118')](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':'ContactId'});db[_0x5434('0x56')][_0x5434('0x118')](db[_0x5434('0x50')],{});db[_0x5434('0x56')]['belongsTo'](db['FaxMessage'],{});db[_0x5434('0x56')][_0x5434('0x118')](db[_0x5434('0x14')],{});db['FaxQueueReport'][_0x5434('0x118')](db[_0x5434('0x54')],{});db[_0x5434('0x57')][_0x5434('0x10c')](db[_0x5434('0x85')],{'as':_0x5434('0x161'),'foreignKey':_0x5434('0x179')});db[_0x5434('0x57')][_0x5434('0x10c')](db['CannedAnswer'],{'as':_0x5434('0x162'),'foreignKey':'SmsAccountId'});db[_0x5434('0x57')][_0x5434('0x10c')](db[_0x5434('0x5c')],{'as':_0x5434('0x156'),'foreignKey':_0x5434('0x179')});db[_0x5434('0x57')]['hasMany'](db[_0x5434('0x5b')],{'as':_0x5434('0x163')});db[_0x5434('0x57')][_0x5434('0x10c')](db['SmsApplication'],{'as':_0x5434('0x141')});db[_0x5434('0x57')][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':_0x5434('0x165')});db[_0x5434('0x57')][_0x5434('0x118')](db[_0x5434('0x14e')],{'as':_0x5434('0x14f'),'foreignKey':_0x5434('0x150')});db[_0x5434('0x57')][_0x5434('0x11a')](db['User'],{'as':_0x5434('0x152'),'through':_0x5434('0x139')});db[_0x5434('0x59')][_0x5434('0x118')](db[_0x5434('0x14')],{'onDelete':'restrict'});db[_0x5434('0x59')][_0x5434('0x118')](db[_0x5434('0x5e')],{'onDelete':_0x5434('0x16e')});db[_0x5434('0x59')][_0x5434('0x118')](db['SmsAccount'],{'onDelete':_0x5434('0x16e')});db[_0x5434('0x59')][_0x5434('0x118')](db[_0x5434('0x88')],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x14d')});db['SmsApplication'][_0x5434('0x118')](db[_0x5434('0x91')],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x16f')});db[_0x5434('0x5b')][_0x5434('0x10c')](db['SmsMessage'],{'as':_0x5434('0x156'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x5434('0x5b')]['belongsTo'](db[_0x5434('0x57')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x179')});db['SmsInteraction']['belongsTo'](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x5b')][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x174'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x5b')]['belongsToMany'](db[_0x5434('0x91')],{'through':_0x5434('0x17a'),'as':'Tags'});db[_0x5434('0x5b')]['belongsToMany'](db['Tag'],{'through':_0x5434('0x17a'),'as':_0x5434('0x17b')});db[_0x5434('0x5b')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x16c'),'through':_0x5434('0x124'),'foreignKey':_0x5434('0x17c')});db[_0x5434('0x5c')][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x14')});db['SmsMessage']['belongsTo'](db[_0x5434('0x76')],{'onDelete':_0x5434('0x10a'),'as':'Contact'});db[_0x5434('0x5c')][_0x5434('0x118')](db['SmsInteraction'],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x16d'),'foreignKey':_0x5434('0x17c')});db[_0x5434('0x5c')]['belongsTo'](db[_0x5434('0x57')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x179')});db[_0x5434('0x5e')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x5434('0x17d')});db[_0x5434('0x5e')]['belongsToMany'](db[_0x5434('0xe7')],{'through':'team_has_sms_queues','as':_0x5434('0x153')});db[_0x5434('0x136')][_0x5434('0x10c')](db[_0x5434('0x85')],{'as':_0x5434('0x161'),'foreignKey':_0x5434('0x17e')});db[_0x5434('0x136')][_0x5434('0x10c')](db[_0x5434('0x84')],{'as':_0x5434('0x162'),'foreignKey':_0x5434('0x17e')});db[_0x5434('0x136')]['hasMany'](db[_0x5434('0x63')],{'as':_0x5434('0x163'),'foreignKey':_0x5434('0x17e')});db['OpenchannelAccount'][_0x5434('0x10c')](db['OpenchannelMessage'],{'as':_0x5434('0x156'),'foreignKey':_0x5434('0x17e')});db[_0x5434('0x136')][_0x5434('0x10c')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x5434('0x17e')});db[_0x5434('0x136')][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':'List','foreignKey':_0x5434('0x165')});db['OpenchannelAccount'][_0x5434('0x118')](db['Pause'],{'as':_0x5434('0x14f'),'foreignKey':_0x5434('0x150')});db['OpenchannelAccount'][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':'user_has_openchannel_accounts'});db[_0x5434('0x61')]['belongsTo'](db[_0x5434('0x14')],{'onDelete':_0x5434('0x16e')});db['OpenchannelApplication'][_0x5434('0x118')](db[_0x5434('0x66')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x5434('0x61')][_0x5434('0x118')](db['OpenchannelAccount'],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x17e')});db[_0x5434('0x61')][_0x5434('0x118')](db['Interval'],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x14d')});db[_0x5434('0x61')]['belongsTo'](db[_0x5434('0x91')],{'onDelete':'restrict','foreignKey':_0x5434('0x16f')});db[_0x5434('0x63')][_0x5434('0x10c')](db[_0x5434('0x64')],{'as':_0x5434('0x156'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x17f')});db[_0x5434('0x63')][_0x5434('0x118')](db[_0x5434('0x136')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x5434('0x63')][_0x5434('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x5434('0x15c')});db[_0x5434('0x63')][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x174'),'foreignKey':_0x5434('0x10b')});db[_0x5434('0x63')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x180'),'as':_0x5434('0x16b')});db[_0x5434('0x63')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x180'),'as':_0x5434('0x17b')});db[_0x5434('0x63')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x16c'),'through':_0x5434('0x181'),'foreignKey':_0x5434('0x17f')});db[_0x5434('0x64')][_0x5434('0x118')](db[_0x5434('0x14')],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x14')});db[_0x5434('0x64')][_0x5434('0x118')](db['CmContact'],{'onDelete':'cascade','as':_0x5434('0x15b')});db[_0x5434('0x64')]['belongsTo'](db[_0x5434('0x63')],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x16d'),'foreignKey':_0x5434('0x17f')});db['OpenchannelMessage'][_0x5434('0x118')](db[_0x5434('0xec')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x5434('0x64')][_0x5434('0x118')](db[_0x5434('0x136')],{'as':_0x5434('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x5434('0x66')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x36'),'foreignKey':_0x5434('0x182')});db[_0x5434('0x66')][_0x5434('0x11a')](db['Team'],{'through':'team_has_openchannel_queues','as':_0x5434('0x153')});db[_0x5434('0x68')]['hasMany'](db[_0x5434('0x85')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x5434('0x68')]['hasMany'](db['CannedAnswer'],{'as':_0x5434('0x162'),'foreignKey':_0x5434('0x183')});db[_0x5434('0x68')][_0x5434('0x10c')](db[_0x5434('0x184')],{'as':_0x5434('0x185')});db[_0x5434('0x68')][_0x5434('0x10c')](db[_0x5434('0x6b')],{'as':_0x5434('0x163')});db[_0x5434('0x68')][_0x5434('0x10c')](db[_0x5434('0x186')],{'as':_0x5434('0x141')});db[_0x5434('0x68')][_0x5434('0x10c')](db[_0x5434('0x6c')],{'as':_0x5434('0x156')});db['ChatWebsite']['belongsTo'](db[_0x5434('0xf7')],{'as':'List','foreignKey':_0x5434('0x165')});db[_0x5434('0x68')][_0x5434('0x118')](db[_0x5434('0x88')],{'as':_0x5434('0x88'),'foreignKey':_0x5434('0x14d')});db[_0x5434('0x68')]['belongsTo'](db[_0x5434('0x14e')],{'as':_0x5434('0x14f'),'foreignKey':_0x5434('0x150')});db[_0x5434('0x68')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x131')});db[_0x5434('0x187')]['belongsTo'](db['OpenchannelAccount'],{});db['OpenchannelQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x5434('0x165')});db[_0x5434('0x187')]['belongsTo'](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x187')][_0x5434('0x118')](db[_0x5434('0x63')],{});db[_0x5434('0x187')][_0x5434('0x118')](db[_0x5434('0x64')],{});db[_0x5434('0x187')][_0x5434('0x118')](db['User'],{});db[_0x5434('0x187')][_0x5434('0x118')](db[_0x5434('0x66')],{});db[_0x5434('0x186')][_0x5434('0x118')](db['User'],{'as':_0x5434('0x188'),'foreignKey':_0x5434('0x10b'),'onDelete':_0x5434('0x16e')});db[_0x5434('0x186')]['belongsTo'](db[_0x5434('0x70')],{'as':_0x5434('0x189'),'foreignKey':'ChatQueueId','onDelete':_0x5434('0x16e')});db['ChatApplication'][_0x5434('0x118')](db['ChatWebsite'],{'as':_0x5434('0x18a'),'foreignKey':'ChatWebsiteId','onDelete':_0x5434('0x16e')});db[_0x5434('0x186')][_0x5434('0x118')](db[_0x5434('0x91')],{'onDelete':'restrict','foreignKey':_0x5434('0x16f')});db[_0x5434('0x6b')]['hasMany'](db[_0x5434('0x6c')],{'as':_0x5434('0x156'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x18b')});db['ChatInteraction'][_0x5434('0x118')](db['ChatWebsite'],{'as':_0x5434('0x169'),'foreignKey':'ChatWebsiteId'});db[_0x5434('0x6b')][_0x5434('0x118')](db['CmContact'],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x6b')][_0x5434('0x118')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x5434('0x6b')][_0x5434('0x11a')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x5434('0x16b')});db[_0x5434('0x6b')]['belongsToMany'](db[_0x5434('0x91')],{'through':_0x5434('0x18c'),'as':_0x5434('0x17b')});db[_0x5434('0x6b')]['belongsToMany'](db['User'],{'as':_0x5434('0x16c'),'through':_0x5434('0x122'),'foreignKey':_0x5434('0x18b')});db[_0x5434('0x6c')]['belongsTo'](db[_0x5434('0x14')],{'onDelete':'cascade','as':'User'});db[_0x5434('0x6c')][_0x5434('0x118')](db[_0x5434('0x76')],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x6c')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0x5434('0x16d'),'foreignKey':'ChatInteractionId'});db[_0x5434('0x6c')][_0x5434('0x118')](db[_0x5434('0xec')],{'as':_0x5434('0xec'),'foreignKey':_0x5434('0x177')});db[_0x5434('0x6c')][_0x5434('0x118')](db[_0x5434('0x68')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x183')});db['ChatOfflineMessage'][_0x5434('0x118')](db['CmContact'],{'onDelete':_0x5434('0x10a'),'as':'Contact','foreignKey':_0x5434('0x15c')});db['ChatOfflineMessage'][_0x5434('0x118')](db[_0x5434('0x68')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x183')});db[_0x5434('0x70')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x2f'),'hooks':!![]});db[_0x5434('0x70')][_0x5434('0x11a')](db[_0x5434('0xe7')],{'through':_0x5434('0x18d'),'as':_0x5434('0x153')});db['ChatGroup'][_0x5434('0x10c')](db[_0x5434('0xd4')],{'as':_0x5434('0x156'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x5434('0x72')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x145'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0x5434('0x118')](db[_0x5434('0x68')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x5434('0x74')]['hasMany'](db['CmContact'],{'as':_0x5434('0x11c'),'foreignKey':_0x5434('0x18e')});db[_0x5434('0x76')][_0x5434('0x10c')](db[_0x5434('0x78')],{'as':_0x5434('0x146'),'foreignKey':'ContactId'});db[_0x5434('0x76')][_0x5434('0x10c')](db[_0x5434('0x7c')],{'as':_0x5434('0x111'),'foreignKey':_0x5434('0x15c')});db['CmContact'][_0x5434('0x10c')](db[_0x5434('0x7e')],{'as':_0x5434('0x148'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x76')]['hasMany'](db[_0x5434('0x80')],{'as':_0x5434('0x80'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x76')][_0x5434('0x10c')](db[_0x5434('0x18f')],{'as':_0x5434('0x14a'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x76')][_0x5434('0x10c')](db[_0x5434('0x63')],{'as':_0x5434('0x113'),'foreignKey':_0x5434('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x5434('0x10c')](db[_0x5434('0x6b')],{'as':'ChatInteractions','foreignKey':_0x5434('0x15c'),'onDelete':_0x5434('0x16e')});db['CmContact']['hasMany'](db[_0x5434('0x5b')],{'as':'SmsInteractions','foreignKey':_0x5434('0x15c'),'onDelete':_0x5434('0x16e')});db[_0x5434('0x76')]['hasMany'](db[_0x5434('0x50')],{'as':'FaxInteractions','foreignKey':_0x5434('0x15c'),'onDelete':_0x5434('0x16e')});db['CmContact'][_0x5434('0x10c')](db[_0x5434('0x43')],{'as':_0x5434('0x116'),'foreignKey':_0x5434('0x15c'),'onDelete':_0x5434('0x16e')});db[_0x5434('0x76')][_0x5434('0x118')](db[_0x5434('0x74')],{'as':_0x5434('0x190'),'foreignKey':'CompanyId'});db['CmContact'][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':_0x5434('0x165'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x76')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':'Users','through':_0x5434('0x11d')});db['CmContact'][_0x5434('0x11a')](db[_0x5434('0x91')],{'as':_0x5434('0x16b'),'through':_0x5434('0x191')});db['CmContact'][_0x5434('0x11a')](db['Tag'],{'through':_0x5434('0x191'),'as':_0x5434('0x17b')});db['CmHopper'][_0x5434('0x118')](db[_0x5434('0x76')],{'as':'Contact','foreignKey':_0x5434('0x15c'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x78')][_0x5434('0x118')](db['CmList'],{'as':_0x5434('0x164'),'foreignKey':_0x5434('0x165'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x78')][_0x5434('0x118')](db[_0x5434('0x14')],{'as':'Agent','foreignKey':'UserId'});db[_0x5434('0x78')]['belongsTo'](db['VoiceQueue'],{'as':_0x5434('0x189'),'foreignKey':_0x5434('0x147'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x78')][_0x5434('0x118')](db[_0x5434('0xea')],{'as':_0x5434('0xea'),'foreignKey':_0x5434('0x192'),'onDelete':'cascade'});db['CmHopper'][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x174'),'foreignKey':'OwnerId'});db[_0x5434('0x7a')][_0x5434('0x118')](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c'),'onDelete':_0x5434('0x10a')});db['CmHopperBlack'][_0x5434('0x118')](db['CmList'],{'as':_0x5434('0x164'),'foreignKey':'ListId','onDelete':_0x5434('0x10a')});db[_0x5434('0x7a')][_0x5434('0x118')](db[_0x5434('0x144')],{'as':_0x5434('0x189'),'foreignKey':_0x5434('0x147'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x7a')][_0x5434('0x118')](db[_0x5434('0xea')],{'as':'Campaign','foreignKey':_0x5434('0x192'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x193')][_0x5434('0x10c')](db[_0x5434('0x194')],{'as':{'plural':_0x5434('0x195'),'singular':_0x5434('0x196')},'foreignKey':_0x5434('0x197'),'onDelete':_0x5434('0x10a'),'hooks':!![]});db[_0x5434('0x193')]['hasMany'](db[_0x5434('0x194')],{'as':{'plural':_0x5434('0x198'),'singular':_0x5434('0x199')},'foreignKey':_0x5434('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x5434('0x193')][_0x5434('0x10c')](db[_0x5434('0x19b')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x5434('0x10a'),'hooks':!![]});db[_0x5434('0x88')][_0x5434('0x10c')](db[_0x5434('0x88')],{'as':_0x5434('0x19c'),'foreignKey':_0x5434('0x14d'),'onDelete':_0x5434('0x10a'),'hooks':!![],'required':![]});db['Interval'][_0x5434('0x10c')](db[_0x5434('0x10f')],{'as':_0x5434('0x110'),'foreignKey':_0x5434('0x14d'),'onDelete':'restrict'});db[_0x5434('0x88')][_0x5434('0x10c')](db[_0x5434('0x46')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x5434('0x88')][_0x5434('0x10c')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x5434('0x14d')});db[_0x5434('0x88')][_0x5434('0x10c')](db[_0x5434('0x4e')],{'as':_0x5434('0x19d'),'foreignKey':_0x5434('0x14d')});db['Interval'][_0x5434('0x10c')](db[_0x5434('0x59')],{'as':_0x5434('0x19e'),'foreignKey':_0x5434('0x14d')});db[_0x5434('0x8e')][_0x5434('0x118')](db[_0x5434('0x3e')],{});db[_0x5434('0x8e')][_0x5434('0x118')](db['AnalyticDefaultReport'],{'foreignKey':_0x5434('0x19f')});db['Schedule'][_0x5434('0x118')](db[_0x5434('0x9a')],{'foreignKey':_0x5434('0x1a0')});db[_0x5434('0x90')][_0x5434('0x11a')](db[_0x5434('0x142')],{'as':_0x5434('0x1a1'),'through':'moh_has_sounds','onDelete':_0x5434('0x16e')});db[_0x5434('0x91')][_0x5434('0x11a')](db[_0x5434('0x76')],{'through':'cm_contact_has_tags'});db[_0x5434('0x91')][_0x5434('0x11a')](db[_0x5434('0x6b')],{'through':_0x5434('0x18c')});db[_0x5434('0x91')][_0x5434('0x11a')](db[_0x5434('0x43')],{'through':_0x5434('0x16a')});db[_0x5434('0x91')][_0x5434('0x11a')](db[_0x5434('0x5b')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x5434('0x11a')](db[_0x5434('0x50')],{'through':'fax_interaction_has_tags'});db[_0x5434('0x91')][_0x5434('0x11a')](db['OpenchannelInteraction'],{'through':_0x5434('0x180')});db['Tag']['belongsToMany'](db[_0x5434('0x103')],{'through':_0x5434('0x1a2')});db[_0x5434('0x1a3')][_0x5434('0x10c')](db[_0x5434('0x194')],{'as':{'plural':_0x5434('0x1a4'),'singular':_0x5434('0x1a5')},'foreignKey':_0x5434('0x1a6'),'onDelete':_0x5434('0x10a'),'hooks':!![]});db['Trigger'][_0x5434('0x10c')](db['Condition'],{'as':{'plural':_0x5434('0x1a7'),'singular':_0x5434('0x1a8')},'foreignKey':_0x5434('0x1a9'),'onDelete':_0x5434('0x10a'),'hooks':!![]});db[_0x5434('0x1a3')][_0x5434('0x10c')](db[_0x5434('0x19b')],{'as':_0x5434('0x1aa'),'foreignKey':_0x5434('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x5434('0x9a')][_0x5434('0x10c')](db['AnalyticFieldReport'],{'as':_0x5434('0x1ac'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1a0'),'hooks':!![]});db['AnalyticDefaultReport'][_0x5434('0x10c')](db[_0x5434('0xa1')],{'as':_0x5434('0x1ac'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x5434('0xa0')][_0x5434('0x10c')](db[_0x5434('0xa1')],{'as':_0x5434('0x1ac'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1ad')});db[_0x5434('0xa1')][_0x5434('0x118')](db[_0x5434('0xa0')],{'foreignKey':_0x5434('0x1ad')});db[_0x5434('0x1ae')][_0x5434('0x10c')](db['SalesforceConfiguration'],{'as':_0x5434('0x1af'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0xa5')][_0x5434('0x10c')](db[_0x5434('0x1b1')],{'as':_0x5434('0x1b2'),'onDelete':_0x5434('0x10a'),'foreignKey':'SubjectId'});db[_0x5434('0xa5')]['hasMany'](db[_0x5434('0x1b1')],{'as':_0x5434('0x1b3'),'onDelete':'cascade','foreignKey':_0x5434('0x1b4')});db['SalesforceConfiguration'][_0x5434('0x10c')](db[_0x5434('0x1b1')],{'as':_0x5434('0x1ac'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0xa5')][_0x5434('0x118')](db[_0x5434('0x1ae')],{'as':'Account','foreignKey':'AccountId'});db[_0x5434('0x1b1')]['hasMany'](db[_0x5434('0x1b1')],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0x1b1')][_0x5434('0x10c')](db[_0x5434('0x1b1')],{'as':'Description','foreignKey':_0x5434('0x1b4')});db[_0x5434('0x1b1')][_0x5434('0x10c')](db[_0x5434('0x1b1')],{'as':'Field','foreignKey':_0x5434('0x1b5')});db[_0x5434('0x1b1')][_0x5434('0x118')](db[_0x5434('0x95')],{'as':_0x5434('0x95'),'foreignKey':'VariableId'});db[_0x5434('0xa7')][_0x5434('0x10c')](db[_0x5434('0x1b8')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x5434('0x1b8')][_0x5434('0x10c')](db[_0x5434('0xa9')],{'as':_0x5434('0x1b2'),'onDelete':'cascade','foreignKey':_0x5434('0x1b7')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b4')});db['SugarcrmConfiguration']['hasMany'](db[_0x5434('0xa9')],{'as':'Fields','onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0x1b8')][_0x5434('0x118')](db[_0x5434('0xa7')],{'as':_0x5434('0x169'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x5434('0x10c')](db['SugarcrmField'],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xa9')][_0x5434('0x10c')](db[_0x5434('0xa9')],{'as':_0x5434('0x1b9'),'foreignKey':_0x5434('0x1b4')});db['SugarcrmField']['hasMany'](db[_0x5434('0xa9')],{'as':_0x5434('0x1ba'),'foreignKey':_0x5434('0x1b5')});db['SugarcrmField'][_0x5434('0x118')](db[_0x5434('0x95')],{'as':_0x5434('0x95'),'foreignKey':_0x5434('0x1bb')});db[_0x5434('0xab')][_0x5434('0x10c')](db[_0x5434('0xad')],{'as':_0x5434('0x1af'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0xad')][_0x5434('0x10c')](db[_0x5434('0xaf')],{'as':_0x5434('0x1b2'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xad')][_0x5434('0x10c')](db[_0x5434('0xaf')],{'as':_0x5434('0x1b3'),'onDelete':'cascade','foreignKey':_0x5434('0x1b4')});db[_0x5434('0xad')][_0x5434('0x10c')](db[_0x5434('0xaf')],{'as':_0x5434('0x1ac'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b5')});db['DeskConfiguration'][_0x5434('0x118')](db[_0x5434('0xab')],{'as':'Account','foreignKey':_0x5434('0x1b0')});db[_0x5434('0xad')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x1bc')});db[_0x5434('0xaf')][_0x5434('0x10c')](db[_0x5434('0xaf')],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xaf')]['hasMany'](db[_0x5434('0xaf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5434('0xaf')][_0x5434('0x10c')](db[_0x5434('0xaf')],{'as':'Field','foreignKey':_0x5434('0x1b5')});db[_0x5434('0xaf')][_0x5434('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0x5434('0x1bb')});db[_0x5434('0xb1')][_0x5434('0x10c')](db[_0x5434('0xb3')],{'as':_0x5434('0x1af'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0xb3')][_0x5434('0x10c')](db[_0x5434('0xb5')],{'as':_0x5434('0x1b2'),'onDelete':_0x5434('0x10a'),'foreignKey':'SubjectId'});db[_0x5434('0xb3')]['hasMany'](db[_0x5434('0xb5')],{'as':_0x5434('0x1b3'),'onDelete':'cascade','foreignKey':_0x5434('0x1b4')});db[_0x5434('0xb3')]['hasMany'](db[_0x5434('0xb5')],{'as':_0x5434('0x1ac'),'onDelete':_0x5434('0x10a'),'foreignKey':'FieldId'});db[_0x5434('0xb3')]['belongsTo'](db[_0x5434('0xb1')],{'as':'Account','foreignKey':_0x5434('0x1b0')});db['ZohoField'][_0x5434('0x10c')](db[_0x5434('0xb5')],{'as':'Subject','foreignKey':_0x5434('0x1b7')});db[_0x5434('0xb5')]['hasMany'](db[_0x5434('0xb5')],{'as':'Description','foreignKey':_0x5434('0x1b4')});db['ZohoField'][_0x5434('0x10c')](db[_0x5434('0xb5')],{'as':'Field','foreignKey':'FieldId'});db[_0x5434('0xb5')][_0x5434('0x118')](db[_0x5434('0x95')],{'as':'Variable','foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x5434('0x1bd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x5434('0x1b0')});db[_0x5434('0x1bd')][_0x5434('0x10c')](db[_0x5434('0xba')],{'as':_0x5434('0x1b2'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0x1bd')]['hasMany'](db[_0x5434('0xba')],{'as':'Descriptions','foreignKey':_0x5434('0x1b4')});db[_0x5434('0x1bd')][_0x5434('0x10c')](db[_0x5434('0xba')],{'as':'Fields','foreignKey':_0x5434('0x1b5')});db[_0x5434('0x1bd')][_0x5434('0x118')](db[_0x5434('0xb7')],{'as':'Account','foreignKey':'AccountId'});db[_0x5434('0x1bd')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x1be')});db['ZendeskField'][_0x5434('0x10c')](db[_0x5434('0xba')],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db['ZendeskField'][_0x5434('0x10c')](db['ZendeskField'],{'as':'Description','foreignKey':_0x5434('0x1b4')});db[_0x5434('0xba')][_0x5434('0x10c')](db[_0x5434('0xba')],{'as':_0x5434('0x1ba'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0xba')]['belongsTo'](db[_0x5434('0x95')],{'as':_0x5434('0x95'),'foreignKey':_0x5434('0x1bb')});db[_0x5434('0xbb')][_0x5434('0x10c')](db[_0x5434('0xbd')],{'as':'Configurations','onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b0')});db['FreshdeskConfiguration']['hasMany'](db[_0x5434('0x1bf')],{'as':_0x5434('0x1b2'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x5434('0xbd')][_0x5434('0x10c')](db[_0x5434('0x1bf')],{'as':_0x5434('0x1b3'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b4')});db[_0x5434('0xbd')][_0x5434('0x10c')](db[_0x5434('0x1bf')],{'as':_0x5434('0x1ac'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b5')});db['FreshdeskConfiguration']['belongsTo'](db[_0x5434('0xbb')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0xbd')][_0x5434('0x11a')](db[_0x5434('0x91')],{'through':_0x5434('0x1c0')});db[_0x5434('0x1bf')][_0x5434('0x10c')](db['FreshdeskField'],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0x1bf')][_0x5434('0x10c')](db[_0x5434('0x1bf')],{'as':_0x5434('0x1b9'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x5434('0x1ba'),'foreignKey':_0x5434('0x1b5')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x5434('0x95'),'foreignKey':_0x5434('0x1bb')});db['VtigerAccount'][_0x5434('0x10c')](db[_0x5434('0xc1')],{'as':_0x5434('0x1af'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0xc1')][_0x5434('0x10c')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x5434('0x1b7')});db[_0x5434('0xc1')][_0x5434('0x10c')](db['VtigerField'],{'as':_0x5434('0x1b3'),'foreignKey':'DescriptionId'});db[_0x5434('0xc1')][_0x5434('0x10c')](db['VtigerField'],{'as':_0x5434('0x1ac'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0xc1')]['belongsTo'](db[_0x5434('0xc0')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x1b0')});db['VtigerField'][_0x5434('0x10c')](db[_0x5434('0xc3')],{'as':'Subject','foreignKey':_0x5434('0x1b7')});db['VtigerField'][_0x5434('0x10c')](db[_0x5434('0xc3')],{'as':_0x5434('0x1b9'),'foreignKey':_0x5434('0x1b4')});db[_0x5434('0xc3')][_0x5434('0x10c')](db[_0x5434('0xc3')],{'as':_0x5434('0x1ba'),'foreignKey':'FieldId'});db[_0x5434('0xc3')][_0x5434('0x118')](db[_0x5434('0x95')],{'as':'Variable','foreignKey':_0x5434('0x1bb')});db[_0x5434('0x1c1')][_0x5434('0x10c')](db[_0x5434('0x1c2')],{'as':_0x5434('0x1af'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b0')});db['ServicenowConfiguration'][_0x5434('0x10c')](db[_0x5434('0x1c3')],{'as':_0x5434('0x1b2'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0x1c2')]['hasMany'](db[_0x5434('0x1c3')],{'as':_0x5434('0x1b3'),'foreignKey':'DescriptionId'});db[_0x5434('0x1c2')][_0x5434('0x10c')](db[_0x5434('0x1c3')],{'as':_0x5434('0x1ac'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0x1c2')][_0x5434('0x118')](db[_0x5434('0x1c1')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0x1c3')][_0x5434('0x10c')](db[_0x5434('0x1c3')],{'as':_0x5434('0x1b6'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x5434('0x10c')](db[_0x5434('0x1c3')],{'as':_0x5434('0x1b9'),'foreignKey':_0x5434('0x1b4')});db['ServicenowField'][_0x5434('0x10c')](db[_0x5434('0x1c3')],{'as':'Field','foreignKey':_0x5434('0x1b5')});db[_0x5434('0x1c3')][_0x5434('0x118')](db['Variable'],{'as':_0x5434('0x95'),'foreignKey':_0x5434('0x1bb')});db[_0x5434('0x1c4')]['hasMany'](db[_0x5434('0xc9')],{'as':_0x5434('0x1af'),'onDelete':'cascade','foreignKey':_0x5434('0x1b0')});db[_0x5434('0xc9')]['hasMany'](db[_0x5434('0xcb')],{'as':_0x5434('0x1b2'),'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xc9')][_0x5434('0x10c')](db[_0x5434('0xcb')],{'as':_0x5434('0x1b3'),'onDelete':'cascade','foreignKey':_0x5434('0x1b4')});db[_0x5434('0xc9')][_0x5434('0x10c')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0xc9')][_0x5434('0x118')](db[_0x5434('0x1c4')],{'as':'Account','foreignKey':'AccountId'});db['Dynamics365Field'][_0x5434('0x10c')](db['Dynamics365Field'],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xcb')][_0x5434('0x10c')](db[_0x5434('0xcb')],{'as':_0x5434('0x1b9'),'foreignKey':_0x5434('0x1b4')});db[_0x5434('0xcb')]['hasMany'](db['Dynamics365Field'],{'as':_0x5434('0x1ba'),'foreignKey':_0x5434('0x1b5')});db['Dynamics365Field'][_0x5434('0x118')](db[_0x5434('0x95')],{'as':_0x5434('0x95'),'foreignKey':_0x5434('0x1bb')});db[_0x5434('0xcd')][_0x5434('0x10c')](db[_0x5434('0xce')],{'as':_0x5434('0x1af'),'onDelete':'cascade','foreignKey':_0x5434('0x1b0')});db[_0x5434('0xce')][_0x5434('0x10c')](db[_0x5434('0xd0')],{'as':_0x5434('0x1b2'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xce')][_0x5434('0x10c')](db['FreshsalesField'],{'as':_0x5434('0x1b3'),'foreignKey':_0x5434('0x1b4')});db[_0x5434('0xce')][_0x5434('0x10c')](db[_0x5434('0xd0')],{'as':_0x5434('0x1ac'),'foreignKey':_0x5434('0x1b5')});db[_0x5434('0xce')][_0x5434('0x118')](db['FreshsalesAccount'],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x1b0')});db[_0x5434('0xd0')][_0x5434('0x10c')](db['FreshsalesField'],{'as':_0x5434('0x1b6'),'foreignKey':_0x5434('0x1b7')});db[_0x5434('0xd0')][_0x5434('0x10c')](db[_0x5434('0xd0')],{'as':_0x5434('0x1b9'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0x5434('0x1b5')});db[_0x5434('0xd0')][_0x5434('0x118')](db['Variable'],{'as':_0x5434('0x95'),'foreignKey':'VariableId'});db[_0x5434('0xd3')][_0x5434('0x118')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x5434('0x118')](db['CmList'],{'as':'List','foreignKey':_0x5434('0x165')});db[_0x5434('0xd3')][_0x5434('0x118')](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db['ChatQueueReport'][_0x5434('0x118')](db['ChatInteraction'],{});db[_0x5434('0xd3')][_0x5434('0x118')](db[_0x5434('0x6c')],{});db[_0x5434('0xd3')][_0x5434('0x118')](db[_0x5434('0x14')],{});db[_0x5434('0xd3')][_0x5434('0x118')](db[_0x5434('0x70')],{});db[_0x5434('0xd4')]['belongsTo'](db['User'],{'onDelete':_0x5434('0x10a'),'foreignKey':'FromId'});db[_0x5434('0xd4')][_0x5434('0x118')](db[_0x5434('0x14')],{'onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1c5')});db[_0x5434('0x18f')]['hasMany'](db[_0x5434('0xd7')],{'foreignKey':_0x5434('0x1c6'),'onDelete':_0x5434('0x10a')});db[_0x5434('0x18f')][_0x5434('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0x5434('0x1c6'),'onDelete':_0x5434('0x10a')});db['SmsQueueReport'][_0x5434('0x118')](db['SmsAccount'],{});db['SmsQueueReport'][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':'ListId'});db[_0x5434('0xd9')]['belongsTo'](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':'ContactId'});db[_0x5434('0xd9')][_0x5434('0x118')](db[_0x5434('0x5b')],{});db[_0x5434('0xd9')][_0x5434('0x118')](db['SmsMessage'],{});db[_0x5434('0xd9')][_0x5434('0x118')](db[_0x5434('0x14')],{});db['SmsQueueReport'][_0x5434('0x118')](db[_0x5434('0x5e')],{});db['JscriptyProject'][_0x5434('0x10c')](db[_0x5434('0x18f')],{'foreignKey':_0x5434('0x1c7')});db['JscriptyProject']['hasMany'](db[_0x5434('0xd7')],{'foreignKey':'ProjectId'});db[_0x5434('0xde')][_0x5434('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0x5434('0x1c7')});db[_0x5434('0x13c')]['belongsToMany'](db['User'],{'as':_0x5434('0x16c'),'through':_0x5434('0x13e')});db[_0x5434('0xe7')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x120')});db[_0x5434('0xe7')][_0x5434('0x11a')](db[_0x5434('0x144')],{'through':_0x5434('0x154'),'as':_0x5434('0x1c8')});db[_0x5434('0xe7')][_0x5434('0x11a')](db['MailQueue'],{'through':_0x5434('0x167'),'as':_0x5434('0x127')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x5434('0x18d'),'as':'ChatQueues'});db['Team']['belongsToMany'](db[_0x5434('0x54')],{'through':_0x5434('0x178'),'as':_0x5434('0x129')});db[_0x5434('0xe7')][_0x5434('0x11a')](db[_0x5434('0x5e')],{'through':_0x5434('0x1c9'),'as':_0x5434('0x12a')});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0x5434('0x1ca'),'as':'OpenchannelQueues'});db[_0x5434('0xea')][_0x5434('0x10c')](db[_0x5434('0x78')],{'as':_0x5434('0x146'),'foreignKey':'CampaignId'});db[_0x5434('0xea')][_0x5434('0x10c')](db[_0x5434('0x7c')],{'as':'HopperFinals','foreignKey':_0x5434('0x192')});db[_0x5434('0xea')][_0x5434('0x10c')](db[_0x5434('0x7e')],{'as':_0x5434('0x148'),'foreignKey':_0x5434('0x192')});db[_0x5434('0xea')][_0x5434('0x10c')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x5434('0x192')});db[_0x5434('0xea')][_0x5434('0x118')](db[_0x5434('0x2a')],{'as':_0x5434('0x2a'),'foreignKey':_0x5434('0x14b')});db[_0x5434('0xea')]['belongsTo'](db['Trunk'],{'as':_0x5434('0x1cb'),'foreignKey':_0x5434('0x14c')});db[_0x5434('0xea')][_0x5434('0x118')](db[_0x5434('0x88')],{'as':_0x5434('0x88'),'foreignKey':'IntervalId'});db[_0x5434('0xea')][_0x5434('0x118')](db[_0x5434('0x13c')],{'as':_0x5434('0x13c'),'foreignKey':_0x5434('0x1cc')});db['Campaign']['belongsToMany'](db[_0x5434('0xf7')],{'as':'Lists','through':_0x5434('0x1cd')});db[_0x5434('0xea')]['belongsToMany'](db[_0x5434('0xf7')],{'as':_0x5434('0x1ce'),'through':_0x5434('0x1cf')});db[_0x5434('0x1d0')]['belongsTo'](db[_0x5434('0x44')],{});db['MailTransferReport'][_0x5434('0x118')](db['MailInteraction'],{});db[_0x5434('0x1d0')][_0x5434('0x118')](db[_0x5434('0x3e')],{'foreignKey':_0x5434('0x1d1'),'as':_0x5434('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d3'),'as':_0x5434('0x1d4')});db[_0x5434('0x1d0')][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d5'),'as':'ToAgent'});db[_0x5434('0x1d0')][_0x5434('0x118')](db[_0x5434('0x40')],{'foreignKey':_0x5434('0x1d6'),'as':_0x5434('0x1d7')});db[_0x5434('0x1d0')]['belongsTo'](db[_0x5434('0x3e')],{'foreignKey':_0x5434('0x1d8'),'as':_0x5434('0x1d9')});db[_0x5434('0xf0')][_0x5434('0x118')](db[_0x5434('0x6c')],{});db[_0x5434('0xf0')][_0x5434('0x118')](db['ChatInteraction'],{});db[_0x5434('0xf0')][_0x5434('0x118')](db['ChatWebsite'],{'foreignKey':_0x5434('0x1da'),'as':_0x5434('0x1d2')});db['ChatTransferReport'][_0x5434('0x118')](db['User'],{'foreignKey':_0x5434('0x1d3'),'as':_0x5434('0x1d4')});db[_0x5434('0xf0')][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d5'),'as':_0x5434('0x1db')});db['ChatTransferReport'][_0x5434('0x118')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x5434('0x1d7')});db[_0x5434('0xf0')][_0x5434('0x118')](db[_0x5434('0x68')],{'foreignKey':'ToChatWebsiteId','as':_0x5434('0x1d9')});db['FaxTransferReport'][_0x5434('0x118')](db[_0x5434('0x52')],{});db[_0x5434('0xf2')]['belongsTo'](db[_0x5434('0x50')],{});db[_0x5434('0xf2')][_0x5434('0x118')](db[_0x5434('0x4c')],{'foreignKey':_0x5434('0x1dc'),'as':_0x5434('0x1d2')});db['FaxTransferReport']['belongsTo'](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d3'),'as':'FromAgent'});db[_0x5434('0xf2')][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x5434('0xf2')][_0x5434('0x118')](db[_0x5434('0x54')],{'foreignKey':'ToFaxQueueId','as':_0x5434('0x1d7')});db[_0x5434('0xf2')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x5434('0x1dd'),'as':_0x5434('0x1d9')});db[_0x5434('0xf4')][_0x5434('0x118')](db[_0x5434('0x64')],{});db[_0x5434('0xf4')][_0x5434('0x118')](db[_0x5434('0x63')],{});db[_0x5434('0xf4')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x5434('0x1de'),'as':_0x5434('0x1d2')});db[_0x5434('0xf4')][_0x5434('0x118')](db['User'],{'foreignKey':'FromUserId','as':_0x5434('0x1d4')});db[_0x5434('0xf4')][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d5'),'as':_0x5434('0x1db')});db[_0x5434('0xf4')][_0x5434('0x118')](db[_0x5434('0x66')],{'foreignKey':'ToOpenchannelQueueId','as':_0x5434('0x1d7')});db[_0x5434('0xf4')][_0x5434('0x118')](db[_0x5434('0x136')],{'foreignKey':_0x5434('0x1df'),'as':_0x5434('0x1d9')});db[_0x5434('0xf6')][_0x5434('0x118')](db[_0x5434('0x5c')],{});db[_0x5434('0xf6')][_0x5434('0x118')](db[_0x5434('0x5b')],{});db['SmsTransferReport']['belongsTo'](db[_0x5434('0x57')],{'foreignKey':_0x5434('0x1e0'),'as':_0x5434('0x1d2')});db['SmsTransferReport'][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d3'),'as':_0x5434('0x1d4')});db['SmsTransferReport'][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':'ToUserId','as':_0x5434('0x1db')});db[_0x5434('0xf6')][_0x5434('0x118')](db[_0x5434('0x5e')],{'foreignKey':'ToSmsQueueId','as':_0x5434('0x1d7')});db['SmsTransferReport'][_0x5434('0x118')](db['SmsAccount'],{'foreignKey':_0x5434('0x1e1'),'as':_0x5434('0x1d9')});db[_0x5434('0xf7')][_0x5434('0x10c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5434('0x165')});db[_0x5434('0xf7')][_0x5434('0x10c')](db[_0x5434('0x1e2')],{'as':_0x5434('0x1e3'),'foreignKey':_0x5434('0x165')});db[_0x5434('0xf7')]['hasMany'](db['CmContact'],{'as':_0x5434('0x11c'),'onDelete':_0x5434('0x10a'),'foreignKey':'ListId'});db[_0x5434('0xf7')][_0x5434('0x10c')](db[_0x5434('0x7c')],{'as':_0x5434('0x111'),'foreignKey':_0x5434('0x165')});db[_0x5434('0xf7')][_0x5434('0x10c')](db[_0x5434('0x7e')],{'as':_0x5434('0x112'),'foreignKey':_0x5434('0x165')});db[_0x5434('0xf7')][_0x5434('0x10c')](db[_0x5434('0x80')],{'as':_0x5434('0x80'),'foreignKey':_0x5434('0x165')});db[_0x5434('0xf7')][_0x5434('0x11a')](db[_0x5434('0x144')],{'as':_0x5434('0x1e4'),'through':_0x5434('0x151')});db['CmList']['belongsToMany'](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x11f')});db[_0x5434('0x12d')][_0x5434('0x10c')](db['VoiceExtension'],{'as':_0x5434('0x110'),'onDelete':_0x5434('0x16e')});db[_0x5434('0x12d')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':'Agents','through':_0x5434('0x12f')});db[_0x5434('0xfa')][_0x5434('0x10c')](db[_0x5434('0x14')],{'as':_0x5434('0x16c'),'foreignKey':_0x5434('0x119')});db[_0x5434('0xfa')][_0x5434('0x10c')](db[_0x5434('0x1e5')],{'as':_0x5434('0x1e6'),'foreignKey':_0x5434('0x119'),'onDelete':'cascade'});db[_0x5434('0x1e5')][_0x5434('0x10c')](db[_0x5434('0x1e7')],{'as':_0x5434('0x1e8'),'foreignKey':'sectionId','onDelete':_0x5434('0x10a')});db[_0x5434('0x13a')][_0x5434('0x10c')](db[_0x5434('0x85')],{'as':_0x5434('0x161'),'foreignKey':_0x5434('0x1e9')});db[_0x5434('0x13a')][_0x5434('0x10c')](db[_0x5434('0x84')],{'as':_0x5434('0x162'),'foreignKey':_0x5434('0x1e9')});db[_0x5434('0x13a')]['hasMany'](db[_0x5434('0x1ea')],{'as':_0x5434('0x156'),'foreignKey':_0x5434('0x1e9')});db['WhatsappAccount'][_0x5434('0x10c')](db[_0x5434('0x103')],{'as':'Interactions'});db[_0x5434('0x13a')][_0x5434('0x10c')](db[_0x5434('0x101')],{'as':'Applications'});db[_0x5434('0x13a')][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':_0x5434('0x164'),'foreignKey':'ListId'});db[_0x5434('0x13a')][_0x5434('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x5434('0x150')});db[_0x5434('0x13a')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':_0x5434('0x1eb')});db[_0x5434('0x101')][_0x5434('0x118')](db[_0x5434('0x14')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x5434('0x118')](db['WhatsappQueue'],{'onDelete':_0x5434('0x16e')});db[_0x5434('0x101')][_0x5434('0x118')](db[_0x5434('0x13a')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x5434('0x88')],{'onDelete':_0x5434('0x16e'),'foreignKey':_0x5434('0x14d')});db[_0x5434('0x101')][_0x5434('0x118')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x5434('0x16f')});db[_0x5434('0x103')]['hasMany'](db[_0x5434('0x1ea')],{'as':'Messages','onDelete':_0x5434('0x10a'),'foreignKey':_0x5434('0x1ec')});db[_0x5434('0x103')][_0x5434('0x118')](db[_0x5434('0x13a')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x1e9')});db[_0x5434('0x103')][_0x5434('0x118')](db[_0x5434('0x76')],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x103')][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x174'),'foreignKey':_0x5434('0x10b')});db['WhatsappInteraction'][_0x5434('0x11a')](db['Tag'],{'through':_0x5434('0x1a2'),'as':'Tags'});db[_0x5434('0x103')]['belongsToMany'](db[_0x5434('0x91')],{'through':_0x5434('0x1a2'),'as':_0x5434('0x17b')});db[_0x5434('0x103')][_0x5434('0x11a')](db['User'],{'as':'Users','through':_0x5434('0x126'),'foreignKey':_0x5434('0x1ec')});db['WhatsappMessage'][_0x5434('0x118')](db[_0x5434('0x14')],{'as':_0x5434('0x14')});db['WhatsappMessage'][_0x5434('0x118')](db[_0x5434('0x76')],{'onDelete':_0x5434('0x10a'),'as':_0x5434('0x15b')});db[_0x5434('0x1ea')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x5434('0x16d'),'foreignKey':_0x5434('0x1ec')});db[_0x5434('0x1ea')][_0x5434('0x118')](db[_0x5434('0x13a')],{'as':_0x5434('0x169'),'foreignKey':_0x5434('0x1e9')});db[_0x5434('0x106')][_0x5434('0x118')](db[_0x5434('0x13a')],{});db['WhatsappQueueReport'][_0x5434('0x118')](db[_0x5434('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0x5434('0x106')][_0x5434('0x118')](db['CmContact'],{'as':_0x5434('0x15b'),'foreignKey':_0x5434('0x15c')});db[_0x5434('0x106')][_0x5434('0x118')](db[_0x5434('0x103')],{});db[_0x5434('0x106')][_0x5434('0x118')](db[_0x5434('0x1ed')],{});db[_0x5434('0x106')][_0x5434('0x118')](db[_0x5434('0x1ea')],{});db['WhatsappQueueReport'][_0x5434('0x118')](db[_0x5434('0x14')],{});db[_0x5434('0x108')][_0x5434('0x118')](db[_0x5434('0x1ea')],{});db[_0x5434('0x108')][_0x5434('0x118')](db[_0x5434('0x103')],{});db[_0x5434('0x108')][_0x5434('0x118')](db[_0x5434('0x13a')],{'foreignKey':_0x5434('0x1ee'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x5434('0x118')](db[_0x5434('0x13a')],{'foreignKey':_0x5434('0x1ef'),'as':_0x5434('0x1d9')});db['WhatsappTransferReport']['belongsTo'](db[_0x5434('0x1ed')],{'foreignKey':_0x5434('0x1f0'),'as':'ToQueue'});db[_0x5434('0x108')][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':_0x5434('0x1d3'),'as':_0x5434('0x1d4')});db[_0x5434('0x108')][_0x5434('0x118')](db[_0x5434('0x14')],{'foreignKey':'ToUserId','as':_0x5434('0x1db')});db[_0x5434('0x1ed')][_0x5434('0x11a')](db[_0x5434('0x14')],{'as':_0x5434('0x152'),'through':'UserWhatsappQueue','foreignKey':_0x5434('0x1f1')});db['WhatsappQueue']['belongsToMany'](db[_0x5434('0xe7')],{'through':_0x5434('0x1f2'),'as':_0x5434('0x153')});module[_0x5434('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xffda=['team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','ChatGroupId','CompanyId','JscriptySessions','Company','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','cm_contact_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','AccountId','Subjects','Descriptions','FieldId','Subject','SubjectId','Description','DescriptionId','Field','VariableId','SugarcrmField','Configurations','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','FreshsalesField','FromId','ToId','SessionId','SmsQueueReport','ProjectId','user_has_teams','team_has_chat_queues','SmsQueues','Hoppers','HopperHistories','BlackLists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToMailAccountId','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','CmCustomField','CustomFields','HopperHistory','Queues','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../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','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','UserId','VoiceExtension','cascade','CmHopperFinal','HopperFinals','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','UserMailQueue','ChatQueues','FaxQueues','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','CmHopperHistory','HopperBlacks','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceAgentReport','uniqueid','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Answers','Interactions','Applications','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','Contact','Owner','Tags','Tag','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','MailMessage','Attachments','Interaction','Account','restrict','TagId','List','ListId','Dashboard','Items','Dispositions','FaxAccountId','FaxMessage','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0xffda,0x73));var _0xaffd=function(_0x393eba,_0x26ebd0){_0x393eba=_0x393eba-0x0;var _0x3d06fd=_0xffda[_0x393eba];return _0x3d06fd;};'use strict';var path=require(_0xaffd('0x0'));var config=require(_0xaffd('0x1'));var Sequelize=require(_0xaffd('0x2'));var _=require(_0xaffd('0x3'));var jstz=require('jstz');var timezone=jstz[_0xaffd('0x4')]();config[_0xaffd('0x2')]=_[_0xaffd('0x5')](config['sequelize'],{'database':_0xaffd('0x6'),'username':'xcall','password':_0xaffd('0x7'),'options':{'host':_0xaffd('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xaffd('0x9')](),'define':{'charset':_0xaffd('0xa'),'collate':_0xaffd('0xb')}}});config['sequelizeHistory']=_[_0xaffd('0x5')](config[_0xaffd('0xc')],{'database':'motion2','username':'xcall','password':_0xaffd('0x7'),'options':{'host':_0xaffd('0x8'),'port':0xcea,'dialect':_0xaffd('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xaffd('0x9')](),'define':{'charset':_0xaffd('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaffd('0x2')][_0xaffd('0xe')],config[_0xaffd('0x2')][_0xaffd('0xf')],config[_0xaffd('0x2')]['password'],config[_0xaffd('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xaffd('0xe')],config[_0xaffd('0xc')][_0xaffd('0xf')],config['sequelizeHistory'][_0xaffd('0x10')],config[_0xaffd('0xc')][_0xaffd('0x11')])};db[_0xaffd('0x12')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x14'));db[_0xaffd('0x15')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x16'));db[_0xaffd('0x17')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x18'));db['VoiceExtension']=db['sequelize']['import'](_0xaffd('0x19'));db[_0xaffd('0x1a')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x1b'));db[_0xaffd('0x1c')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x1d'));db[_0xaffd('0x1e')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x1f'));db[_0xaffd('0x20')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x21'));db[_0xaffd('0x22')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x23'));db['VoiceMailMessage']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x24'));db[_0xaffd('0x25')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x26'));db[_0xaffd('0x27')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x28'));db['VoiceAgentReport']=db['sequelize'][_0xaffd('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xaffd('0x29')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xaffd('0x2a')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x2b'));db[_0xaffd('0x2c')]=db['sequelize']['import'](_0xaffd('0x2d'));db['VoiceTransferReport']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x2e'));db['UserVoiceQueueRt']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x2f'));db[_0xaffd('0x30')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x31'));db[_0xaffd('0x32')]=db['sequelize'][_0xaffd('0x13')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xaffd('0x33')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x34'));db[_0xaffd('0x35')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x36'));db[_0xaffd('0x37')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x38'));db[_0xaffd('0x39')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x3a'));db['MailServerIn']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x3b'));db[_0xaffd('0x3c')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x3d'));db['MailAccount']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x3e'));db[_0xaffd('0x3f')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x40'));db[_0xaffd('0x41')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x42'));db[_0xaffd('0x43')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x44'));db['MailMessage']=db['sequelize'][_0xaffd('0x13')]('../api/mailMessage/mailMessage.model');db[_0xaffd('0x45')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x46'));db[_0xaffd('0x47')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize']['import'](_0xaffd('0x48'));db[_0xaffd('0x49')]=db['sequelize']['import'](_0xaffd('0x4a'));db['FaxAccount']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x4b'));db[_0xaffd('0x4c')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/faxApplication/faxApplication.model');db[_0xaffd('0x4d')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x4e'));db['FaxMessage']=db['sequelize'][_0xaffd('0x13')]('../api/faxMessage/faxMessage.model');db[_0xaffd('0x4f')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/faxQueue/faxQueue.model');db[_0xaffd('0x50')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x51'));db['SmsAccount']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x52'));db['SmsApplication']=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x53'));db[_0xaffd('0x54')]=db[_0xaffd('0x2')]['import']('../api/smsInteraction/smsInteraction.model');db[_0xaffd('0x55')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x56'));db[_0xaffd('0x57')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/smsQueue/smsQueue.model');db[_0xaffd('0x58')]=db['sequelize']['import'](_0xaffd('0x59'));db[_0xaffd('0x5a')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x5b'));db['OpenchannelInteraction']=db['sequelize'][_0xaffd('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xaffd('0x5c')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x5d'));db[_0xaffd('0x5e')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x5f'));db[_0xaffd('0x60')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x61'));db[_0xaffd('0x62')]=db['sequelize']['import'](_0xaffd('0x63'));db[_0xaffd('0x64')]=db['sequelize']['import'](_0xaffd('0x65'));db[_0xaffd('0x66')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xaffd('0x67')]=db['sequelize']['import'](_0xaffd('0x68'));db[_0xaffd('0x69')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x6a'));db[_0xaffd('0x6b')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x6c'));db[_0xaffd('0x6d')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x6e'));db[_0xaffd('0x6f')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x70'));db[_0xaffd('0x71')]=db[_0xaffd('0x2')]['import']('../api/cmCompany/cmCompany.model');db[_0xaffd('0x72')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x73'));db['CmHopper']=db[_0xaffd('0x2')]['import'](_0xaffd('0x74'));db[_0xaffd('0x75')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x76'));db['CmHopperFinal']=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x77'));db['CmHopperHistory']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x78'));db['ReportAgentPreview']=db[_0xaffd('0x2')]['import'](_0xaffd('0x79'));db['CmCustomField']=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x7a'));db['Action']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x7b'));db[_0xaffd('0x7c')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x7d'));db[_0xaffd('0x7e')]=db['sequelize']['import'](_0xaffd('0x7f'));db[_0xaffd('0x80')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/disposition/disposition.model');db['Condition']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x81'));db[_0xaffd('0x82')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x83'));db[_0xaffd('0x84')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x85'));db[_0xaffd('0x86')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x87'));db[_0xaffd('0x88')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x89'));db[_0xaffd('0x8a')]=db['sequelize']['import'](_0xaffd('0x8b'));db[_0xaffd('0x8c')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/sound/sound.model');db['Tag']=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/tag/tag.model');db[_0xaffd('0x8d')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x8e'));db[_0xaffd('0x8f')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0x90'));db[_0xaffd('0x91')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x92'));db[_0xaffd('0x93')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/integration/integration.model');db[_0xaffd('0x94')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x95'));db[_0xaffd('0x96')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x97'));db[_0xaffd('0x98')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x99'));db[_0xaffd('0x9a')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x9b'));db[_0xaffd('0x9c')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xaffd('0x9d')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x9e'));db[_0xaffd('0x9f')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xaffd('0xa0')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xa1'));db[_0xaffd('0xa2')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xa3'));db[_0xaffd('0xa4')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xaffd('0xa5')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xa6'));db[_0xaffd('0xa7')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xa8'));db['SugarcrmField']=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xa9'));db[_0xaffd('0xaa')]=db[_0xaffd('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xaffd('0xab')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xac'));db[_0xaffd('0xad')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xae'));db[_0xaffd('0xaf')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xb0'));db[_0xaffd('0xb1')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xb2'));db[_0xaffd('0xb3')]=db['sequelize'][_0xaffd('0x13')]('../api/intZohoField/intZohoField.model');db[_0xaffd('0xb4')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xb5'));db[_0xaffd('0xb6')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xb7'));db[_0xaffd('0xb8')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xb9'));db[_0xaffd('0xba')]=db['sequelize']['import'](_0xaffd('0xbb'));db[_0xaffd('0xbc')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xbd'));db['VtigerAccount']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xbe'));db[_0xaffd('0xbf')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xc0'));db[_0xaffd('0xc1')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xc2'));db[_0xaffd('0xc3')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xc4'));db['ServicenowConfiguration']=db['sequelize'][_0xaffd('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xaffd('0xc5')]=db[_0xaffd('0x2')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xaffd('0xc6')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xc7'));db[_0xaffd('0xc8')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xc9'));db[_0xaffd('0xca')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xcb'));db['FreshsalesAccount']=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xaffd('0xcc')]=db['sequelize'][_0xaffd('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xcd'));db[_0xaffd('0x93')]=db[_0xaffd('0x2')]['import']('../api/integration/integration.model');db[_0xaffd('0xce')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xcf'));db[_0xaffd('0xd0')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xd1'));db['JscriptyAnswerReport']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xd2'));db[_0xaffd('0xd3')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xd4'));db[_0xaffd('0xd5')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xd6'));db['SmsQueueReport']=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xd7'));db['SquareReport']=db[_0xaffd('0x2')]['import'](_0xaffd('0xd8'));db[_0xaffd('0xd9')]=db['sequelize']['import'](_0xaffd('0xda'));db[_0xaffd('0xdb')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xdc'));db[_0xaffd('0xdd')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xde'));db[_0xaffd('0xdf')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xe0'));db[_0xaffd('0xe1')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xe2'));db[_0xaffd('0xe3')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xe4'));db[_0xaffd('0xe5')]=db['sequelize'][_0xaffd('0x13')]('../api/squareMessage/squareMessage.model');db[_0xaffd('0xe6')]=db[_0xaffd('0x2')]['import']('../api/team/team.model');db['License']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xe7'));db[_0xaffd('0xe8')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xe9'));db[_0xaffd('0xea')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/migration/migration.model');db[_0xaffd('0xeb')]=db['sequelize'][_0xaffd('0x13')]('../api/attachment/attachment.model');db['Plugin']=db[_0xaffd('0x2')]['import'](_0xaffd('0xec'));db[_0xaffd('0xed')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xaffd('0xee')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xef'));db['FaxTransferReport']=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xaffd('0xf0')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xf1'));db[_0xaffd('0xf2')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xf3'));db[_0xaffd('0xf4')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xf5'));db[_0xaffd('0xf6')]=db[_0xaffd('0x2')]['import'](_0xaffd('0xf7'));db[_0xaffd('0xf8')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xf9'));db['UserProfileSection']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xfa'));db['UserProfileResource']=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xfb'));db[_0xaffd('0xfc')]=db['sequelize'][_0xaffd('0x13')](_0xaffd('0xfd'));db[_0xaffd('0xfe')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0xff'));db[_0xaffd('0x100')]=db[_0xaffd('0x2')][_0xaffd('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0xaffd('0x101')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x102'));db[_0xaffd('0x103')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x104'));db[_0xaffd('0x105')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x106'));db[_0xaffd('0x107')]=db[_0xaffd('0x2')][_0xaffd('0x13')](_0xaffd('0x108'));db[_0xaffd('0x109')]=db[_0xaffd('0x2')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xaffd('0x10a')]=db[_0xaffd('0x2')]['import'](_0xaffd('0x10b'));db[_0xaffd('0x12')][_0xaffd('0x10c')](db[_0xaffd('0x22')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x1e')],{'as':_0xaffd('0x10e'),'foreignKey':'UserId'});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x10f')],{'as':_0xaffd('0x110'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x112')],{'as':'Extensions','onDelete':_0xaffd('0x113'),'hooks':!![]});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x114')],{'as':_0xaffd('0x115'),'foreignKey':'UserId'});db['User'][_0xaffd('0x10d')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x116')],{'as':_0xaffd('0x116'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x117')],{'as':_0xaffd('0x118'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x66')],{'as':'ChatInteractions','foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x54')],{'as':_0xaffd('0x119'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')]['hasMany'](db[_0xaffd('0x4d')],{'as':_0xaffd('0x11a'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')][_0xaffd('0x10d')](db[_0xaffd('0x43')],{'as':_0xaffd('0x11b'),'foreignKey':_0xaffd('0x111')});db['User']['hasMany'](db[_0xaffd('0x101')],{'as':_0xaffd('0x11c'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x12')]['hasMany'](db['Notification'],{'as':_0xaffd('0x11d'),'foreignKey':'SenderId'});db['User']['belongsTo'](db[_0xaffd('0xf8')],{'as':'UserProfile','foreignKey':_0xaffd('0x11e')});db['User'][_0xaffd('0x11f')](db[_0xaffd('0x6d')],{'as':_0xaffd('0x120'),'through':_0xaffd('0x121')});db['User'][_0xaffd('0x11f')](db[_0xaffd('0x72')],{'as':_0xaffd('0x122'),'through':_0xaffd('0x123')});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0xf4')],{'as':'Lists','through':_0xaffd('0x124')});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0xe6')],{'through':'user_has_teams'});db['User']['belongsToMany'](db[_0xaffd('0x43')],{'as':_0xaffd('0x11b'),'through':'user_has_mail_interactions'});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0x66')],{'as':_0xaffd('0x125'),'through':_0xaffd('0x126')});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0x4d')],{'as':_0xaffd('0x11a'),'through':'user_has_fax_interactions'});db[_0xaffd('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0xaffd('0x119'),'through':_0xaffd('0x127')});db[_0xaffd('0x12')]['belongsToMany'](db[_0xaffd('0x117')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xaffd('0x12')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0xaffd('0x11c'),'through':_0xaffd('0x128')});db['User']['belongsToMany'](db[_0xaffd('0x1c')],{'as':_0xaffd('0x129'),'through':_0xaffd('0x30'),'required':![]});db[_0xaffd('0x12')][_0xaffd('0x11f')](db['MailQueue'],{'as':_0xaffd('0x12a'),'through':_0xaffd('0x12b'),'required':![]});db[_0xaffd('0x12')]['belongsToMany'](db[_0xaffd('0x6b')],{'as':_0xaffd('0x12c'),'through':_0xaffd('0x32'),'required':![],'hooks':!![]});db[_0xaffd('0x12')]['belongsToMany'](db[_0xaffd('0x4f')],{'as':_0xaffd('0x12d'),'through':'UserFaxQueue','required':![]});db[_0xaffd('0x12')]['belongsToMany'](db[_0xaffd('0x57')],{'as':'SmsQueues','through':_0xaffd('0x35'),'required':![]});db[_0xaffd('0x12')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0xaffd('0x12e'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xaffd('0x11f')](db[_0xaffd('0x109')],{'as':'WhatsappQueues','through':_0xaffd('0x39'),'required':![]});db[_0xaffd('0x12')][_0xaffd('0x11f')](db['CmList'],{'through':_0xaffd('0x124')});db['User'][_0xaffd('0x11f')](db[_0xaffd('0xf6')],{'as':_0xaffd('0x12f'),'through':_0xaffd('0x130'),'required':![]});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0x60')],{'as':'ChatWebsites','through':_0xaffd('0x131')});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0x132')],{'as':_0xaffd('0x133'),'through':_0xaffd('0x134')});db[_0xaffd('0x12')]['belongsToMany'](db[_0xaffd('0x135')],{'as':_0xaffd('0x136'),'through':_0xaffd('0x137')});db['User'][_0xaffd('0x11f')](db[_0xaffd('0x58')],{'as':_0xaffd('0x138'),'through':_0xaffd('0x139')});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0x13a')],{'as':_0xaffd('0x13b'),'through':_0xaffd('0x13c')});db['User']['belongsToMany'](db[_0xaffd('0xfe')],{'as':_0xaffd('0x13d'),'through':_0xaffd('0x13e')});db[_0xaffd('0x12')][_0xaffd('0x11f')](db[_0xaffd('0xe1')],{'as':_0xaffd('0x13f'),'through':_0xaffd('0x140')});db[_0xaffd('0x15')][_0xaffd('0x10d')](db[_0xaffd('0x112')],{'as':_0xaffd('0x141'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x142')});db[_0xaffd('0x17')][_0xaffd('0x10d')](db['VoiceExtension'],{'onDelete':_0xaffd('0x113')});db[_0xaffd('0x112')][_0xaffd('0x10d')](db[_0xaffd('0x112')],{'as':'Applications','onDelete':'cascade'});db[_0xaffd('0x1a')][_0xaffd('0x11f')](db[_0xaffd('0x8c')],{'as':_0xaffd('0x143'),'through':_0xaffd('0x144')});db[_0xaffd('0x1c')][_0xaffd('0x10d')](db[_0xaffd('0x10f')],{'as':_0xaffd('0x145'),'foreignKey':_0xaffd('0x146')});db['VoiceQueue'][_0xaffd('0x10d')](db[_0xaffd('0x147')],{'as':'Hoppers','foreignKey':_0xaffd('0x146')});db[_0xaffd('0x1c')][_0xaffd('0x10d')](db['CmHopperFinal'],{'as':_0xaffd('0x115'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xaffd('0x148')],{'as':'HopperHistories','foreignKey':_0xaffd('0x146')});db[_0xaffd('0x1c')][_0xaffd('0x10d')](db[_0xaffd('0x116')],{'as':_0xaffd('0x116'),'foreignKey':_0xaffd('0x146')});db[_0xaffd('0x1c')][_0xaffd('0x10d')](db[_0xaffd('0x75')],{'as':_0xaffd('0x149'),'foreignKey':_0xaffd('0x146')});db['VoiceQueue'][_0xaffd('0x10d')](db[_0xaffd('0xd5')],{'as':'JscriptySessions','foreignKey':_0xaffd('0x146')});db[_0xaffd('0x1c')][_0xaffd('0x14a')](db[_0xaffd('0x2c')],{'as':_0xaffd('0x2c'),'foreignKey':_0xaffd('0x14b')});db['VoiceQueue'][_0xaffd('0x14a')](db['Trunk'],{'as':_0xaffd('0x14c'),'foreignKey':_0xaffd('0x14d')});db[_0xaffd('0x1c')][_0xaffd('0x14a')](db[_0xaffd('0x82')],{'as':'Interval','foreignKey':_0xaffd('0x14e')});db[_0xaffd('0x1c')][_0xaffd('0x14a')](db[_0xaffd('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xaffd('0x14f')});db[_0xaffd('0x1c')]['belongsToMany'](db[_0xaffd('0xf4')],{'as':_0xaffd('0x150'),'through':_0xaffd('0x151')});db['VoiceQueue']['belongsToMany'](db[_0xaffd('0x12')],{'as':'Agents','through':_0xaffd('0x30')});db[_0xaffd('0x1c')][_0xaffd('0x11f')](db[_0xaffd('0xe6')],{'as':_0xaffd('0x152'),'through':_0xaffd('0x153')});db[_0xaffd('0x1c')]['belongsToMany'](db[_0xaffd('0xf4')],{'as':'BlackLists','through':_0xaffd('0x154')});db[_0xaffd('0x1e')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x12'),'foreignKey':'UserId'});db[_0xaffd('0x20')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x12'),'foreignKey':'UserId'});db[_0xaffd('0x22')]['hasMany'](db[_0xaffd('0x155')],{'as':_0xaffd('0x156'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x157'),'sourceKey':'mailbox'});db[_0xaffd('0x155')][_0xaffd('0x14a')](db[_0xaffd('0x22')],{'foreignKey':'mailboxuser','targetKey':_0xaffd('0x158')});db[_0xaffd('0x25')][_0xaffd('0x10d')](db[_0xaffd('0x29')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xaffd('0x25')]['hasMany'](db[_0xaffd('0x159')],{'as':'AgentReports','foreignKey':_0xaffd('0x15a'),'constraints':![]});db['VoiceCallReport'][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':'User','foreignKey':'UserId'});db[_0xaffd('0x25')][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'as':'Contact','foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x15c')][_0xaffd('0x14a')](db[_0xaffd('0x135')],{'as':_0xaffd('0x135'),'foreignKey':_0xaffd('0x15d')});db['MailServerOut'][_0xaffd('0x14a')](db['MailAccount'],{'as':_0xaffd('0x135'),'foreignKey':_0xaffd('0x15d')});db[_0xaffd('0x135')][_0xaffd('0x10c')](db['MailServerIn'],{'as':_0xaffd('0x15e'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x135')][_0xaffd('0x10c')](db[_0xaffd('0x3c')],{'as':_0xaffd('0x15f'),'onDelete':_0xaffd('0x113')});db['MailAccount'][_0xaffd('0x10d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xaffd('0x15d')});db[_0xaffd('0x135')][_0xaffd('0x10d')](db[_0xaffd('0x7e')],{'as':_0xaffd('0x160'),'foreignKey':_0xaffd('0x15d')});db[_0xaffd('0x135')][_0xaffd('0x10d')](db['MailMessage'],{'as':_0xaffd('0x156'),'foreignKey':'MailAccountId'});db[_0xaffd('0x135')][_0xaffd('0x10d')](db[_0xaffd('0x43')],{'as':_0xaffd('0x161')});db[_0xaffd('0x135')][_0xaffd('0x10d')](db['MailApplication'],{'as':_0xaffd('0x162')});db[_0xaffd('0x135')][_0xaffd('0x14a')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xaffd('0x135')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0xaffd('0x163')});db[_0xaffd('0x135')][_0xaffd('0x14a')](db['Pause'],{'as':_0xaffd('0x164'),'foreignKey':_0xaffd('0x14f')});db[_0xaffd('0x135')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x137')});db[_0xaffd('0x3f')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':'UserMailQueue'});db[_0xaffd('0x3f')][_0xaffd('0x11f')](db[_0xaffd('0xe6')],{'through':_0xaffd('0x166'),'as':_0xaffd('0x152')});db[_0xaffd('0x43')]['hasMany'](db['MailMessage'],{'as':'Messages','onDelete':_0xaffd('0x113'),'foreignKey':'MailInteractionId'});db[_0xaffd('0x43')][_0xaffd('0x14a')](db['MailAccount'],{'as':'Account','foreignKey':_0xaffd('0x15d')});db['MailInteraction'][_0xaffd('0x14a')](db['CmContact'],{'as':_0xaffd('0x167'),'foreignKey':'ContactId'});db[_0xaffd('0x43')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x168'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x43')][_0xaffd('0x11f')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xaffd('0x169')});db[_0xaffd('0x43')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x16b'),'as':_0xaffd('0x16c')});db[_0xaffd('0x43')]['belongsToMany'](db[_0xaffd('0x12')],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x16e'),'foreignKey':_0xaffd('0x16f')});db[_0xaffd('0x170')][_0xaffd('0x10d')](db['Attachment'],{'as':_0xaffd('0x171'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x170')]['belongsTo'](db['User'],{'as':_0xaffd('0x12')});db['MailMessage'][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'onDelete':_0xaffd('0x113'),'as':'Contact'});db[_0xaffd('0x170')][_0xaffd('0x14a')](db[_0xaffd('0x43')],{'as':_0xaffd('0x172'),'foreignKey':_0xaffd('0x16f')});db[_0xaffd('0x170')][_0xaffd('0x14a')](db[_0xaffd('0x135')],{'as':_0xaffd('0x173'),'foreignKey':'MailAccountId'});db['MailApplication'][_0xaffd('0x14a')](db['User'],{'onDelete':'restrict'});db[_0xaffd('0x45')][_0xaffd('0x14a')](db[_0xaffd('0x3f')],{'onDelete':_0xaffd('0x174')});db[_0xaffd('0x45')][_0xaffd('0x14a')](db['MailAccount'],{'onDelete':_0xaffd('0x174')});db[_0xaffd('0x45')][_0xaffd('0x14a')](db[_0xaffd('0x82')],{'onDelete':_0xaffd('0x174'),'foreignKey':'IntervalId'});db[_0xaffd('0x45')][_0xaffd('0x14a')](db[_0xaffd('0x16a')],{'onDelete':'restrict','foreignKey':_0xaffd('0x175')});db[_0xaffd('0x47')][_0xaffd('0x14a')](db[_0xaffd('0x135')],{});db['MailQueueReport']['belongsTo'](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0x47')][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'as':'Contact','foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x47')][_0xaffd('0x14a')](db['MailInteraction'],{});db['MailQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0x170')],{});db[_0xaffd('0x47')]['belongsTo'](db[_0xaffd('0x12')],{});db['MailQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0x3f')],{});db[_0xaffd('0x178')]['hasMany'](db[_0xaffd('0x49')],{'as':_0xaffd('0x179'),'onDelete':'cascade'});db[_0xaffd('0x132')]['hasMany'](db['Disposition'],{'as':_0xaffd('0x17a'),'foreignKey':'FaxAccountId'});db[_0xaffd('0x132')][_0xaffd('0x10d')](db[_0xaffd('0x7e')],{'as':_0xaffd('0x160'),'foreignKey':_0xaffd('0x17b')});db[_0xaffd('0x132')]['hasMany'](db[_0xaffd('0x4d')],{'as':_0xaffd('0x161')});db[_0xaffd('0x132')][_0xaffd('0x10d')](db[_0xaffd('0x4c')],{'as':_0xaffd('0x162')});db[_0xaffd('0x132')][_0xaffd('0x10d')](db[_0xaffd('0x112')],{'as':'Exntensions','onDelete':_0xaffd('0x113')});db['FaxAccount']['hasMany'](db[_0xaffd('0x17c')],{'as':_0xaffd('0x156')});db[_0xaffd('0x132')][_0xaffd('0x14a')](db[_0xaffd('0x2c')],{'as':'Trunk'});db[_0xaffd('0x132')][_0xaffd('0x14a')](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0x132')][_0xaffd('0x14a')](db[_0xaffd('0x84')],{'as':_0xaffd('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xaffd('0x132')][_0xaffd('0x11f')](db['User'],{'as':_0xaffd('0x165'),'through':'user_has_fax_accounts'});db[_0xaffd('0x4c')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':_0xaffd('0x174')});db['FaxApplication'][_0xaffd('0x14a')](db[_0xaffd('0x4f')],{'onDelete':'restrict'});db[_0xaffd('0x4c')][_0xaffd('0x14a')](db[_0xaffd('0x132')],{'onDelete':_0xaffd('0x174')});db['FaxApplication'][_0xaffd('0x14a')](db[_0xaffd('0x16a')],{'onDelete':_0xaffd('0x174'),'foreignKey':_0xaffd('0x175')});db['FaxInteraction'][_0xaffd('0x10d')](db['FaxMessage'],{'as':_0xaffd('0x156'),'onDelete':'cascade','foreignKey':_0xaffd('0x17d')});db[_0xaffd('0x4d')][_0xaffd('0x14a')](db[_0xaffd('0x132')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x17b')});db[_0xaffd('0x4d')][_0xaffd('0x14a')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xaffd('0x4d')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x168'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x4d')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x17e'),'as':'Tags'});db[_0xaffd('0x4d')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x17e'),'as':_0xaffd('0x16c')});db[_0xaffd('0x4d')][_0xaffd('0x11f')](db['User'],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x17f'),'foreignKey':_0xaffd('0x17d')});db[_0xaffd('0x17c')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x12')});db[_0xaffd('0x17c')]['belongsTo'](db[_0xaffd('0x4d')],{'as':_0xaffd('0x172'),'foreignKey':_0xaffd('0x17d')});db['FaxMessage'][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x167')});db['FaxMessage'][_0xaffd('0x14a')](db[_0xaffd('0xeb')],{'as':_0xaffd('0xeb'),'foreignKey':_0xaffd('0x180')});db[_0xaffd('0x17c')][_0xaffd('0x14a')](db[_0xaffd('0x132')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x17b')});db[_0xaffd('0x4f')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x33')});db[_0xaffd('0x4f')][_0xaffd('0x11f')](db[_0xaffd('0xe6')],{'through':_0xaffd('0x181'),'as':_0xaffd('0x152')});db['FaxQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0x132')],{});db[_0xaffd('0x50')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xaffd('0x177')});db[_0xaffd('0x50')][_0xaffd('0x14a')](db['CmContact'],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x50')]['belongsTo'](db[_0xaffd('0x4d')],{});db['FaxQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0x17c')],{});db['FaxQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0x12')],{});db[_0xaffd('0x50')][_0xaffd('0x14a')](db[_0xaffd('0x4f')],{});db[_0xaffd('0x13a')][_0xaffd('0x10d')](db['Disposition'],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0xaffd('0x13a')][_0xaffd('0x10d')](db['CannedAnswer'],{'as':_0xaffd('0x160'),'foreignKey':_0xaffd('0x182')});db[_0xaffd('0x13a')][_0xaffd('0x10d')](db[_0xaffd('0x55')],{'as':_0xaffd('0x156'),'foreignKey':'SmsAccountId'});db[_0xaffd('0x13a')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db[_0xaffd('0x13a')][_0xaffd('0x10d')](db[_0xaffd('0x183')],{'as':_0xaffd('0x162')});db[_0xaffd('0x13a')]['belongsTo'](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':'ListId'});db['SmsAccount']['belongsTo'](db[_0xaffd('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xaffd('0x14f')});db[_0xaffd('0x13a')][_0xaffd('0x11f')](db['User'],{'as':_0xaffd('0x165'),'through':_0xaffd('0x13c')});db[_0xaffd('0x183')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':_0xaffd('0x174')});db['SmsApplication']['belongsTo'](db[_0xaffd('0x57')],{'onDelete':_0xaffd('0x174')});db[_0xaffd('0x183')]['belongsTo'](db[_0xaffd('0x13a')],{'onDelete':_0xaffd('0x174')});db[_0xaffd('0x183')][_0xaffd('0x14a')](db[_0xaffd('0x82')],{'onDelete':'restrict','foreignKey':_0xaffd('0x14e')});db['SmsApplication'][_0xaffd('0x14a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xaffd('0x175')});db[_0xaffd('0x54')]['hasMany'](db[_0xaffd('0x55')],{'as':_0xaffd('0x156'),'onDelete':_0xaffd('0x113'),'foreignKey':'SmsInteractionId'});db[_0xaffd('0x54')][_0xaffd('0x14a')](db[_0xaffd('0x13a')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x182')});db[_0xaffd('0x54')]['belongsTo'](db['CmContact'],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db['SmsInteraction'][_0xaffd('0x14a')](db['User'],{'as':'Owner','foreignKey':_0xaffd('0x111')});db[_0xaffd('0x54')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x184'),'as':_0xaffd('0x169')});db[_0xaffd('0x54')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x184'),'as':_0xaffd('0x16c')});db[_0xaffd('0x54')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x127'),'foreignKey':_0xaffd('0x185')});db[_0xaffd('0x55')]['belongsTo'](db[_0xaffd('0x12')],{'as':'User'});db[_0xaffd('0x55')]['belongsTo'](db[_0xaffd('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0xaffd('0x55')][_0xaffd('0x14a')](db[_0xaffd('0x54')],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x172'),'foreignKey':_0xaffd('0x185')});db[_0xaffd('0x55')]['belongsTo'](db[_0xaffd('0x13a')],{'as':_0xaffd('0x173'),'foreignKey':'SmsAccountId'});db[_0xaffd('0x57')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x35'),'foreignKey':_0xaffd('0x186')});db[_0xaffd('0x57')][_0xaffd('0x11f')](db[_0xaffd('0xe6')],{'through':_0xaffd('0x187'),'as':_0xaffd('0x152')});db['OpenchannelAccount']['hasMany'](db[_0xaffd('0x80')],{'as':_0xaffd('0x17a'),'foreignKey':_0xaffd('0x188')});db[_0xaffd('0x58')][_0xaffd('0x10d')](db[_0xaffd('0x7e')],{'as':'Answers','foreignKey':_0xaffd('0x188')});db[_0xaffd('0x58')][_0xaffd('0x10d')](db[_0xaffd('0x117')],{'as':_0xaffd('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xaffd('0x58')][_0xaffd('0x10d')](db[_0xaffd('0x5c')],{'as':_0xaffd('0x156'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xaffd('0x10d')](db['OpenchannelApplication'],{'as':_0xaffd('0x162'),'foreignKey':_0xaffd('0x188')});db[_0xaffd('0x58')][_0xaffd('0x14a')](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':'ListId'});db[_0xaffd('0x58')][_0xaffd('0x14a')](db[_0xaffd('0x84')],{'as':_0xaffd('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xaffd('0x58')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x139')});db[_0xaffd('0x5a')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':_0xaffd('0x174')});db[_0xaffd('0x5a')][_0xaffd('0x14a')](db[_0xaffd('0x5e')],{'onDelete':_0xaffd('0x174'),'foreignKey':'OpenchannelQueueId'});db[_0xaffd('0x5a')]['belongsTo'](db[_0xaffd('0x58')],{'onDelete':'restrict','foreignKey':_0xaffd('0x188')});db['OpenchannelApplication'][_0xaffd('0x14a')](db['Interval'],{'onDelete':_0xaffd('0x174'),'foreignKey':_0xaffd('0x14e')});db[_0xaffd('0x5a')][_0xaffd('0x14a')](db['Tag'],{'onDelete':_0xaffd('0x174'),'foreignKey':'TagId'});db[_0xaffd('0x117')][_0xaffd('0x10d')](db[_0xaffd('0x5c')],{'as':_0xaffd('0x156'),'onDelete':_0xaffd('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0xaffd('0x117')][_0xaffd('0x14a')](db[_0xaffd('0x58')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x188')});db[_0xaffd('0x117')]['belongsTo'](db[_0xaffd('0x72')],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x117')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x168'),'foreignKey':_0xaffd('0x111')});db[_0xaffd('0x117')]['belongsToMany'](db[_0xaffd('0x16a')],{'through':_0xaffd('0x189'),'as':_0xaffd('0x169')});db[_0xaffd('0x117')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x189'),'as':_0xaffd('0x16c')});db[_0xaffd('0x117')][_0xaffd('0x11f')](db['User'],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x18a'),'foreignKey':'OpenchannelInteractionId'});db[_0xaffd('0x5c')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x12')});db['OpenchannelMessage'][_0xaffd('0x14a')](db['CmContact'],{'onDelete':'cascade','as':_0xaffd('0x167')});db[_0xaffd('0x5c')][_0xaffd('0x14a')](db[_0xaffd('0x117')],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x172'),'foreignKey':_0xaffd('0x18b')});db[_0xaffd('0x5c')]['belongsTo'](db['Attachment'],{'as':_0xaffd('0xeb'),'foreignKey':_0xaffd('0x180')});db[_0xaffd('0x5c')][_0xaffd('0x14a')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xaffd('0x5e')]['belongsToMany'](db[_0xaffd('0x12')],{'as':'Agents','through':_0xaffd('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0xaffd('0x5e')][_0xaffd('0x11f')](db[_0xaffd('0xe6')],{'through':_0xaffd('0x18c'),'as':_0xaffd('0x152')});db[_0xaffd('0x60')][_0xaffd('0x10d')](db[_0xaffd('0x80')],{'as':'Dispositions','foreignKey':_0xaffd('0x18d')});db[_0xaffd('0x60')][_0xaffd('0x10d')](db[_0xaffd('0x7e')],{'as':_0xaffd('0x160'),'foreignKey':'ChatWebsiteId'});db[_0xaffd('0x60')][_0xaffd('0x10d')](db[_0xaffd('0x6f')],{'as':_0xaffd('0x18e')});db[_0xaffd('0x60')][_0xaffd('0x10d')](db[_0xaffd('0x66')],{'as':'Interactions'});db[_0xaffd('0x60')][_0xaffd('0x10d')](db['ChatApplication'],{'as':'Applications'});db['ChatWebsite']['hasMany'](db[_0xaffd('0x67')],{'as':_0xaffd('0x156')});db['ChatWebsite'][_0xaffd('0x14a')](db['CmList'],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0x60')][_0xaffd('0x14a')](db['Interval'],{'as':_0xaffd('0x82'),'foreignKey':_0xaffd('0x14e')});db[_0xaffd('0x60')][_0xaffd('0x14a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xaffd('0x60')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':'Agents','through':_0xaffd('0x131')});db[_0xaffd('0x62')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xaffd('0x62')][_0xaffd('0x14a')](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0x62')][_0xaffd('0x14a')](db['CmContact'],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db['OpenchannelQueueReport'][_0xaffd('0x14a')](db['OpenchannelInteraction'],{});db[_0xaffd('0x62')][_0xaffd('0x14a')](db[_0xaffd('0x5c')],{});db['OpenchannelQueueReport'][_0xaffd('0x14a')](db['User'],{});db[_0xaffd('0x62')]['belongsTo'](db[_0xaffd('0x5e')],{});db['ChatApplication'][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':_0xaffd('0x174')});db[_0xaffd('0x64')][_0xaffd('0x14a')](db[_0xaffd('0x6b')],{'as':_0xaffd('0x18f'),'foreignKey':_0xaffd('0x190'),'onDelete':_0xaffd('0x174')});db[_0xaffd('0x64')][_0xaffd('0x14a')](db[_0xaffd('0x60')],{'as':_0xaffd('0x191'),'foreignKey':_0xaffd('0x18d'),'onDelete':'restrict'});db[_0xaffd('0x64')][_0xaffd('0x14a')](db[_0xaffd('0x16a')],{'onDelete':'restrict','foreignKey':_0xaffd('0x175')});db[_0xaffd('0x66')][_0xaffd('0x10d')](db[_0xaffd('0x67')],{'as':_0xaffd('0x156'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x192')});db['ChatInteraction'][_0xaffd('0x14a')](db['ChatWebsite'],{'as':_0xaffd('0x173'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0xaffd('0x72')],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x66')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x168'),'foreignKey':'UserId'});db[_0xaffd('0x66')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':'chat_interaction_has_tags','as':_0xaffd('0x169')});db[_0xaffd('0x66')]['belongsToMany'](db[_0xaffd('0x16a')],{'through':_0xaffd('0x193'),'as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db['User'],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x126'),'foreignKey':'ChatInteractionId'});db[_0xaffd('0x67')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':'cascade','as':_0xaffd('0x12')});db[_0xaffd('0x67')]['belongsTo'](db[_0xaffd('0x72')],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db['ChatMessage'][_0xaffd('0x14a')](db['ChatInteraction'],{'onDelete':'cascade','as':_0xaffd('0x172'),'foreignKey':_0xaffd('0x192')});db[_0xaffd('0x67')][_0xaffd('0x14a')](db[_0xaffd('0xeb')],{'as':'Attachment','foreignKey':_0xaffd('0x180')});db[_0xaffd('0x67')][_0xaffd('0x14a')](db[_0xaffd('0x60')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x18d')});db[_0xaffd('0x69')][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x69')][_0xaffd('0x14a')](db[_0xaffd('0x60')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x18d')});db[_0xaffd('0x6b')][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x32'),'hooks':!![]});db[_0xaffd('0x6b')]['belongsToMany'](db[_0xaffd('0xe6')],{'through':'team_has_chat_queues','as':_0xaffd('0x152')});db[_0xaffd('0x6d')][_0xaffd('0x10d')](db[_0xaffd('0x194')],{'as':_0xaffd('0x156'),'foreignKey':_0xaffd('0x195'),'onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db[_0xaffd('0x12')],{'as':_0xaffd('0x145'),'through':_0xaffd('0x121')});db[_0xaffd('0x6f')][_0xaffd('0x14a')](db[_0xaffd('0x60')],{'as':_0xaffd('0x191'),'foreignKey':_0xaffd('0x18d')});db[_0xaffd('0x71')][_0xaffd('0x10d')](db[_0xaffd('0x72')],{'as':_0xaffd('0x122'),'foreignKey':_0xaffd('0x196')});db[_0xaffd('0x72')][_0xaffd('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0xaffd('0x10d')](db[_0xaffd('0x114')],{'as':_0xaffd('0x115'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0x148')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xaffd('0x72')][_0xaffd('0x10d')](db['ReportAgentPreview'],{'as':_0xaffd('0x116'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0xd5')],{'as':_0xaffd('0x197'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0x117')],{'as':_0xaffd('0x118'),'foreignKey':_0xaffd('0x15b'),'onDelete':_0xaffd('0x174')});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0x66')],{'as':_0xaffd('0x125'),'foreignKey':_0xaffd('0x15b'),'onDelete':_0xaffd('0x174')});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0x54')],{'as':'SmsInteractions','foreignKey':_0xaffd('0x15b'),'onDelete':'restrict'});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0x4d')],{'as':_0xaffd('0x11a'),'foreignKey':_0xaffd('0x15b'),'onDelete':'restrict'});db[_0xaffd('0x72')][_0xaffd('0x10d')](db[_0xaffd('0x43')],{'as':'MailInteractions','foreignKey':_0xaffd('0x15b'),'onDelete':_0xaffd('0x174')});db[_0xaffd('0x72')][_0xaffd('0x14a')](db[_0xaffd('0x71')],{'as':_0xaffd('0x198'),'foreignKey':'CompanyId'});db[_0xaffd('0x72')][_0xaffd('0x14a')](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177'),'onDelete':_0xaffd('0x113')});db['CmContact'][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x123')});db['CmContact']['belongsToMany'](db[_0xaffd('0x16a')],{'as':_0xaffd('0x169'),'through':'cm_contact_has_tags'});db[_0xaffd('0x72')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':'cm_contact_has_tags','as':_0xaffd('0x16c')});db[_0xaffd('0x147')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xaffd('0x15b'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x147')][_0xaffd('0x14a')](db['CmList'],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x147')]['belongsTo'](db[_0xaffd('0x12')],{'as':'Agent','foreignKey':_0xaffd('0x111')});db[_0xaffd('0x147')][_0xaffd('0x14a')](db[_0xaffd('0x1c')],{'as':_0xaffd('0x18f'),'foreignKey':_0xaffd('0x146'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x147')]['belongsTo'](db[_0xaffd('0xe8')],{'as':_0xaffd('0xe8'),'foreignKey':_0xaffd('0x199'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x147')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':'Owner','foreignKey':_0xaffd('0x19a')});db[_0xaffd('0x75')]['belongsTo'](db['CmContact'],{'as':_0xaffd('0x167'),'foreignKey':'ContactId','onDelete':_0xaffd('0x113')});db['CmHopperBlack']['belongsTo'](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x75')][_0xaffd('0x14a')](db[_0xaffd('0x1c')],{'as':_0xaffd('0x18f'),'foreignKey':_0xaffd('0x146'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x75')][_0xaffd('0x14a')](db[_0xaffd('0xe8')],{'as':'Campaign','foreignKey':_0xaffd('0x199'),'onDelete':_0xaffd('0x113')});db['Automation'][_0xaffd('0x10d')](db[_0xaffd('0x19b')],{'as':{'plural':'All','singular':_0xaffd('0x19c')},'foreignKey':_0xaffd('0x19d'),'onDelete':_0xaffd('0x113'),'hooks':!![]});db[_0xaffd('0x7c')][_0xaffd('0x10d')](db[_0xaffd('0x19b')],{'as':{'plural':_0xaffd('0x19e'),'singular':_0xaffd('0x19f')},'foreignKey':'AutomationAnyId','onDelete':_0xaffd('0x113'),'hooks':!![]});db[_0xaffd('0x7c')][_0xaffd('0x10d')](db[_0xaffd('0x1a0')],{'as':_0xaffd('0x1a1'),'foreignKey':_0xaffd('0x1a2'),'onDelete':_0xaffd('0x113'),'hooks':!![]});db['Interval']['hasMany'](db[_0xaffd('0x82')],{'as':_0xaffd('0x1a3'),'foreignKey':_0xaffd('0x14e'),'onDelete':_0xaffd('0x113'),'hooks':!![],'required':![]});db[_0xaffd('0x82')]['hasMany'](db['VoiceExtension'],{'as':_0xaffd('0x1a4'),'foreignKey':'IntervalId','onDelete':_0xaffd('0x174')});db[_0xaffd('0x82')][_0xaffd('0x10d')](db[_0xaffd('0x45')],{'as':_0xaffd('0x1a5'),'foreignKey':_0xaffd('0x14e')});db[_0xaffd('0x82')][_0xaffd('0x10d')](db[_0xaffd('0x64')],{'as':_0xaffd('0x1a6'),'foreignKey':'IntervalId'});db[_0xaffd('0x82')]['hasMany'](db['FaxApplication'],{'as':_0xaffd('0x1a7'),'foreignKey':_0xaffd('0x14e')});db[_0xaffd('0x82')][_0xaffd('0x10d')](db['SmsApplication'],{'as':_0xaffd('0x1a8'),'foreignKey':'IntervalId'});db[_0xaffd('0x8a')][_0xaffd('0x14a')](db[_0xaffd('0x135')],{});db[_0xaffd('0x8a')][_0xaffd('0x14a')](db[_0xaffd('0x98')],{'foreignKey':_0xaffd('0x1a9')});db['Schedule'][_0xaffd('0x14a')](db[_0xaffd('0x96')],{'foreignKey':_0xaffd('0x1aa')});db[_0xaffd('0x8c')][_0xaffd('0x11f')](db[_0xaffd('0x1a')],{'as':'Mohs','through':_0xaffd('0x144'),'onDelete':_0xaffd('0x174')});db['Tag'][_0xaffd('0x11f')](db[_0xaffd('0x72')],{'through':_0xaffd('0x1ab')});db[_0xaffd('0x16a')][_0xaffd('0x11f')](db[_0xaffd('0x66')],{'through':'chat_interaction_has_tags'});db[_0xaffd('0x16a')][_0xaffd('0x11f')](db[_0xaffd('0x43')],{'through':_0xaffd('0x16b')});db[_0xaffd('0x16a')][_0xaffd('0x11f')](db[_0xaffd('0x54')],{'through':_0xaffd('0x184')});db[_0xaffd('0x16a')]['belongsToMany'](db[_0xaffd('0x4d')],{'through':_0xaffd('0x17e')});db[_0xaffd('0x16a')][_0xaffd('0x11f')](db[_0xaffd('0x117')],{'through':_0xaffd('0x189')});db['Tag'][_0xaffd('0x11f')](db[_0xaffd('0x101')],{'through':_0xaffd('0x1ac')});db[_0xaffd('0x8f')][_0xaffd('0x10d')](db[_0xaffd('0x19b')],{'as':{'plural':_0xaffd('0x1ad'),'singular':_0xaffd('0x1ae')},'foreignKey':_0xaffd('0x1af'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0xaffd('0x1b0'),'singular':_0xaffd('0x1b1')},'foreignKey':'TriggerAnyId','onDelete':_0xaffd('0x113'),'hooks':!![]});db[_0xaffd('0x8f')][_0xaffd('0x10d')](db[_0xaffd('0x1a0')],{'as':'Actions','foreignKey':_0xaffd('0x1b2'),'onDelete':_0xaffd('0x113'),'hooks':!![]});db[_0xaffd('0x96')][_0xaffd('0x10d')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xaffd('0x1aa'),'hooks':!![]});db[_0xaffd('0x98')]['hasMany'](db[_0xaffd('0x9d')],{'as':_0xaffd('0x1b3'),'onDelete':_0xaffd('0x113'),'foreignKey':'DefaultReportId'});db[_0xaffd('0x9c')][_0xaffd('0x10d')](db[_0xaffd('0x9d')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xaffd('0x1b4')});db['AnalyticFieldReport'][_0xaffd('0x14a')](db['AnalyticMetric'],{'foreignKey':_0xaffd('0x1b4')});db[_0xaffd('0xa0')]['hasMany'](db[_0xaffd('0xa2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xaffd('0x1b5')});db['SalesforceConfiguration'][_0xaffd('0x10d')](db['SalesforceField'],{'as':_0xaffd('0x1b6'),'onDelete':_0xaffd('0x113'),'foreignKey':'SubjectId'});db[_0xaffd('0xa2')]['hasMany'](db[_0xaffd('0xa4')],{'as':_0xaffd('0x1b7'),'onDelete':_0xaffd('0x113'),'foreignKey':'DescriptionId'});db[_0xaffd('0xa2')][_0xaffd('0x10d')](db[_0xaffd('0xa4')],{'as':_0xaffd('0x1b3'),'onDelete':'cascade','foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xa2')][_0xaffd('0x14a')](db[_0xaffd('0xa0')],{'as':_0xaffd('0x173'),'foreignKey':'AccountId'});db[_0xaffd('0xa4')][_0xaffd('0x10d')](db[_0xaffd('0xa4')],{'as':_0xaffd('0x1b9'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xa4')][_0xaffd('0x10d')](db[_0xaffd('0xa4')],{'as':_0xaffd('0x1bb'),'foreignKey':_0xaffd('0x1bc')});db['SalesforceField'][_0xaffd('0x10d')](db[_0xaffd('0xa4')],{'as':_0xaffd('0x1bd'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xa4')][_0xaffd('0x14a')](db['Variable'],{'as':'Variable','foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xa5')][_0xaffd('0x10d')](db[_0xaffd('0xa7')],{'as':'Configurations','onDelete':_0xaffd('0x113'),'foreignKey':'AccountId'});db[_0xaffd('0xa7')][_0xaffd('0x10d')](db['SugarcrmField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xaffd('0x1ba')});db['SugarcrmConfiguration']['hasMany'](db[_0xaffd('0x1bf')],{'as':_0xaffd('0x1b7'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xa7')]['hasMany'](db[_0xaffd('0x1bf')],{'as':_0xaffd('0x1b3'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xa7')][_0xaffd('0x14a')](db[_0xaffd('0xa5')],{'as':_0xaffd('0x173'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xaffd('0x10d')](db[_0xaffd('0x1bf')],{'as':_0xaffd('0x1b9'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0x1bf')][_0xaffd('0x10d')](db['SugarcrmField'],{'as':_0xaffd('0x1bb'),'foreignKey':_0xaffd('0x1bc')});db['SugarcrmField'][_0xaffd('0x10d')](db[_0xaffd('0x1bf')],{'as':_0xaffd('0x1bd'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0x1bf')]['belongsTo'](db[_0xaffd('0x91')],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db['DeskAccount']['hasMany'](db[_0xaffd('0xab')],{'as':_0xaffd('0x1c0'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xab')][_0xaffd('0x10d')](db[_0xaffd('0xad')],{'as':_0xaffd('0x1b6'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xab')][_0xaffd('0x10d')](db['DeskField'],{'as':_0xaffd('0x1b7'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xab')][_0xaffd('0x10d')](db[_0xaffd('0xad')],{'as':_0xaffd('0x1b3'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xab')][_0xaffd('0x14a')](db['DeskAccount'],{'as':_0xaffd('0x173'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xaffd('0x11f')](db['Tag'],{'through':_0xaffd('0x1c1')});db[_0xaffd('0xad')][_0xaffd('0x10d')](db[_0xaffd('0xad')],{'as':_0xaffd('0x1b9'),'foreignKey':'SubjectId'});db[_0xaffd('0xad')][_0xaffd('0x10d')](db[_0xaffd('0xad')],{'as':'Description','foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xad')][_0xaffd('0x10d')](db[_0xaffd('0xad')],{'as':_0xaffd('0x1bd'),'foreignKey':_0xaffd('0x1b8')});db['DeskField'][_0xaffd('0x14a')](db[_0xaffd('0x91')],{'as':'Variable','foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xaf')][_0xaffd('0x10d')](db['ZohoConfiguration'],{'as':_0xaffd('0x1c0'),'onDelete':_0xaffd('0x113'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xaffd('0x10d')](db[_0xaffd('0xb3')],{'as':_0xaffd('0x1b6'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xb1')][_0xaffd('0x10d')](db['ZohoField'],{'as':_0xaffd('0x1b7'),'onDelete':'cascade','foreignKey':_0xaffd('0x1bc')});db['ZohoConfiguration'][_0xaffd('0x10d')](db['ZohoField'],{'as':_0xaffd('0x1b3'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xb1')][_0xaffd('0x14a')](db[_0xaffd('0xaf')],{'as':'Account','foreignKey':_0xaffd('0x1b5')});db['ZohoField'][_0xaffd('0x10d')](db['ZohoField'],{'as':_0xaffd('0x1b9'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xb3')][_0xaffd('0x10d')](db['ZohoField'],{'as':_0xaffd('0x1bb'),'foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xb3')][_0xaffd('0x10d')](db['ZohoField'],{'as':'Field','foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xb3')][_0xaffd('0x14a')](db[_0xaffd('0x91')],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xb4')][_0xaffd('0x10d')](db[_0xaffd('0xb6')],{'as':_0xaffd('0x1c0'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xb6')][_0xaffd('0x10d')](db['ZendeskField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xaffd('0xb6')][_0xaffd('0x10d')](db[_0xaffd('0x1c2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xaffd('0xb6')][_0xaffd('0x10d')](db[_0xaffd('0x1c2')],{'as':_0xaffd('0x1b3'),'foreignKey':_0xaffd('0x1b8')});db['ZendeskConfiguration'][_0xaffd('0x14a')](db[_0xaffd('0xb4')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xb6')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x1c3')});db['ZendeskField'][_0xaffd('0x10d')](db[_0xaffd('0x1c2')],{'as':_0xaffd('0x1b9'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0x1c2')][_0xaffd('0x10d')](db[_0xaffd('0x1c2')],{'as':'Description','foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0x1c2')][_0xaffd('0x10d')](db[_0xaffd('0x1c2')],{'as':'Field','foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0x1c2')]['belongsTo'](db['Variable'],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xb8')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0xaffd('0x1c0'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xba')][_0xaffd('0x10d')](db[_0xaffd('0xbc')],{'as':_0xaffd('0x1b6'),'onDelete':'cascade','foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xba')][_0xaffd('0x10d')](db[_0xaffd('0xbc')],{'as':_0xaffd('0x1b7'),'onDelete':'cascade','foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xba')][_0xaffd('0x10d')](db[_0xaffd('0xbc')],{'as':_0xaffd('0x1b3'),'onDelete':'cascade','foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xaffd('0x14a')](db[_0xaffd('0xb8')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xba')]['belongsToMany'](db[_0xaffd('0x16a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xaffd('0xbc')]['hasMany'](db[_0xaffd('0xbc')],{'as':_0xaffd('0x1b9'),'foreignKey':'SubjectId'});db[_0xaffd('0xbc')][_0xaffd('0x10d')](db[_0xaffd('0xbc')],{'as':_0xaffd('0x1bb'),'foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xbc')][_0xaffd('0x10d')](db['FreshdeskField'],{'as':_0xaffd('0x1bd'),'foreignKey':_0xaffd('0x1b8')});db['FreshdeskField'][_0xaffd('0x14a')](db[_0xaffd('0x91')],{'as':'Variable','foreignKey':_0xaffd('0x1be')});db['VtigerAccount']['hasMany'](db[_0xaffd('0xbf')],{'as':_0xaffd('0x1c0'),'onDelete':_0xaffd('0x113'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0xaffd('0x10d')](db['VtigerField'],{'as':_0xaffd('0x1b6'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xbf')][_0xaffd('0x10d')](db[_0xaffd('0xc1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xaffd('0xbf')][_0xaffd('0x10d')](db['VtigerField'],{'as':'Fields','foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xbf')][_0xaffd('0x14a')](db[_0xaffd('0x1c4')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x1b5')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':_0xaffd('0x1b9'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xc1')][_0xaffd('0x10d')](db[_0xaffd('0xc1')],{'as':'Description','foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xc1')][_0xaffd('0x10d')](db[_0xaffd('0xc1')],{'as':_0xaffd('0x1bd'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xc1')][_0xaffd('0x14a')](db[_0xaffd('0x91')],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xc3')][_0xaffd('0x10d')](db[_0xaffd('0x1c5')],{'as':_0xaffd('0x1c0'),'onDelete':'cascade','foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0x1c5')][_0xaffd('0x10d')](db[_0xaffd('0xc5')],{'as':'Subjects','foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0x1c5')][_0xaffd('0x10d')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0x1c5')]['hasMany'](db[_0xaffd('0xc5')],{'as':_0xaffd('0x1b3'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db[_0xaffd('0xc3')],{'as':_0xaffd('0x173'),'foreignKey':'AccountId'});db[_0xaffd('0xc5')][_0xaffd('0x10d')](db[_0xaffd('0xc5')],{'as':_0xaffd('0x1b9'),'foreignKey':'SubjectId'});db[_0xaffd('0xc5')][_0xaffd('0x10d')](db[_0xaffd('0xc5')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xaffd('0xc5')]['hasMany'](db[_0xaffd('0xc5')],{'as':_0xaffd('0x1bd'),'foreignKey':'FieldId'});db[_0xaffd('0xc5')]['belongsTo'](db['Variable'],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xc6')][_0xaffd('0x10d')](db[_0xaffd('0xc8')],{'as':_0xaffd('0x1c0'),'onDelete':'cascade','foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xc8')][_0xaffd('0x10d')](db[_0xaffd('0xca')],{'as':_0xaffd('0x1b6'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xc8')][_0xaffd('0x10d')](db[_0xaffd('0xca')],{'as':_0xaffd('0x1b7'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xc8')][_0xaffd('0x10d')](db['Dynamics365Field'],{'as':_0xaffd('0x1b3'),'onDelete':'cascade','foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xc8')][_0xaffd('0x14a')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xaffd('0x1b5')});db[_0xaffd('0xca')][_0xaffd('0x10d')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xca')][_0xaffd('0x10d')](db[_0xaffd('0xca')],{'as':_0xaffd('0x1bb'),'foreignKey':_0xaffd('0x1bc')});db[_0xaffd('0xca')][_0xaffd('0x10d')](db[_0xaffd('0xca')],{'as':_0xaffd('0x1bd'),'foreignKey':'FieldId'});db[_0xaffd('0xca')]['belongsTo'](db['Variable'],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db['FreshsalesAccount'][_0xaffd('0x10d')](db[_0xaffd('0xcc')],{'as':_0xaffd('0x1c0'),'onDelete':_0xaffd('0x113'),'foreignKey':'AccountId'});db[_0xaffd('0xcc')]['hasMany'](db[_0xaffd('0x1c6')],{'as':_0xaffd('0x1b6'),'foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0xcc')][_0xaffd('0x10d')](db[_0xaffd('0x1c6')],{'as':'Descriptions','foreignKey':_0xaffd('0x1bc')});db['FreshsalesConfiguration']['hasMany'](db[_0xaffd('0x1c6')],{'as':_0xaffd('0x1b3'),'foreignKey':_0xaffd('0x1b8')});db[_0xaffd('0xcc')][_0xaffd('0x14a')](db['FreshsalesAccount'],{'as':_0xaffd('0x173'),'foreignKey':'AccountId'});db[_0xaffd('0x1c6')][_0xaffd('0x10d')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xaffd('0x1ba')});db[_0xaffd('0x1c6')]['hasMany'](db[_0xaffd('0x1c6')],{'as':'Description','foreignKey':_0xaffd('0x1bc')});db['FreshsalesField'][_0xaffd('0x10d')](db[_0xaffd('0x1c6')],{'as':_0xaffd('0x1bd'),'foreignKey':'FieldId'});db[_0xaffd('0x1c6')][_0xaffd('0x14a')](db[_0xaffd('0x91')],{'as':_0xaffd('0x91'),'foreignKey':_0xaffd('0x1be')});db[_0xaffd('0xd0')][_0xaffd('0x14a')](db[_0xaffd('0x60')],{});db[_0xaffd('0xd0')][_0xaffd('0x14a')](db['CmList'],{'as':'List','foreignKey':_0xaffd('0x177')});db[_0xaffd('0xd0')][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'as':_0xaffd('0x167'),'foreignKey':'ContactId'});db[_0xaffd('0xd0')][_0xaffd('0x14a')](db[_0xaffd('0x66')],{});db[_0xaffd('0xd0')][_0xaffd('0x14a')](db[_0xaffd('0x67')],{});db[_0xaffd('0xd0')][_0xaffd('0x14a')](db['User'],{});db['ChatQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0x6b')],{});db[_0xaffd('0x194')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1c7')});db[_0xaffd('0x194')][_0xaffd('0x14a')](db['User'],{'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1c8')});db[_0xaffd('0xd5')][_0xaffd('0x10d')](db[_0xaffd('0xd3')],{'foreignKey':_0xaffd('0x1c9'),'onDelete':_0xaffd('0x113')});db['JscriptySessionReport'][_0xaffd('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':_0xaffd('0x1c9'),'onDelete':_0xaffd('0x113')});db[_0xaffd('0x1ca')]['belongsTo'](db[_0xaffd('0x13a')],{});db[_0xaffd('0x1ca')]['belongsTo'](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0x1ca')]['belongsTo'](db[_0xaffd('0x72')],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db['SmsQueueReport'][_0xaffd('0x14a')](db['SmsInteraction'],{});db[_0xaffd('0x1ca')][_0xaffd('0x14a')](db['SmsMessage'],{});db[_0xaffd('0x1ca')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{});db['SmsQueueReport'][_0xaffd('0x14a')](db['SmsQueue'],{});db[_0xaffd('0xdb')][_0xaffd('0x10d')](db[_0xaffd('0xd5')],{'foreignKey':_0xaffd('0x1cb')});db['JscriptyProject'][_0xaffd('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xaffd('0xdb')][_0xaffd('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':_0xaffd('0x1cb')});db[_0xaffd('0xe1')][_0xaffd('0x11f')](db['User'],{'as':_0xaffd('0x16d'),'through':_0xaffd('0x140')});db['Team']['belongsToMany'](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x1cc')});db[_0xaffd('0xe6')][_0xaffd('0x11f')](db[_0xaffd('0x1c')],{'through':_0xaffd('0x153'),'as':_0xaffd('0x129')});db[_0xaffd('0xe6')][_0xaffd('0x11f')](db['MailQueue'],{'through':_0xaffd('0x166'),'as':_0xaffd('0x12a')});db[_0xaffd('0xe6')][_0xaffd('0x11f')](db[_0xaffd('0x6b')],{'through':_0xaffd('0x1cd'),'as':_0xaffd('0x12c')});db[_0xaffd('0xe6')][_0xaffd('0x11f')](db[_0xaffd('0x4f')],{'through':_0xaffd('0x181'),'as':_0xaffd('0x12d')});db[_0xaffd('0xe6')][_0xaffd('0x11f')](db[_0xaffd('0x57')],{'through':_0xaffd('0x187'),'as':_0xaffd('0x1ce')});db[_0xaffd('0xe6')][_0xaffd('0x11f')](db['OpenchannelQueue'],{'through':_0xaffd('0x18c'),'as':'OpenchannelQueues'});db[_0xaffd('0xe8')][_0xaffd('0x10d')](db[_0xaffd('0x147')],{'as':_0xaffd('0x1cf'),'foreignKey':_0xaffd('0x199')});db[_0xaffd('0xe8')][_0xaffd('0x10d')](db[_0xaffd('0x114')],{'as':_0xaffd('0x115'),'foreignKey':_0xaffd('0x199')});db[_0xaffd('0xe8')][_0xaffd('0x10d')](db[_0xaffd('0x148')],{'as':_0xaffd('0x1d0'),'foreignKey':_0xaffd('0x199')});db[_0xaffd('0xe8')]['hasMany'](db[_0xaffd('0x75')],{'as':_0xaffd('0x149'),'foreignKey':_0xaffd('0x199')});db[_0xaffd('0xe8')][_0xaffd('0x14a')](db['Trunk'],{'as':_0xaffd('0x2c'),'foreignKey':_0xaffd('0x14b')});db[_0xaffd('0xe8')][_0xaffd('0x14a')](db[_0xaffd('0x2c')],{'as':'TrunkBackup','foreignKey':_0xaffd('0x14d')});db[_0xaffd('0xe8')][_0xaffd('0x14a')](db[_0xaffd('0x82')],{'as':_0xaffd('0x82'),'foreignKey':_0xaffd('0x14e')});db[_0xaffd('0xe8')][_0xaffd('0x14a')](db[_0xaffd('0xe1')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xaffd('0xe8')][_0xaffd('0x11f')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xaffd('0xe8')][_0xaffd('0x11f')](db['CmList'],{'as':_0xaffd('0x1d1'),'through':_0xaffd('0x1d2')});db[_0xaffd('0xed')][_0xaffd('0x14a')](db[_0xaffd('0x170')],{});db['MailTransferReport']['belongsTo'](db[_0xaffd('0x43')],{});db['MailTransferReport'][_0xaffd('0x14a')](db[_0xaffd('0x135')],{'foreignKey':'FromMailAccountId','as':_0xaffd('0x1d3')});db[_0xaffd('0xed')]['belongsTo'](db[_0xaffd('0x12')],{'foreignKey':_0xaffd('0x1d4'),'as':_0xaffd('0x1d5')});db[_0xaffd('0xed')][_0xaffd('0x14a')](db['User'],{'foreignKey':_0xaffd('0x1d6'),'as':'ToAgent'});db['MailTransferReport'][_0xaffd('0x14a')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xaffd('0xed')][_0xaffd('0x14a')](db['MailAccount'],{'foreignKey':_0xaffd('0x1d7'),'as':'ToAccount'});db[_0xaffd('0xee')]['belongsTo'](db[_0xaffd('0x67')],{});db[_0xaffd('0xee')][_0xaffd('0x14a')](db[_0xaffd('0x66')],{});db['ChatTransferReport'][_0xaffd('0x14a')](db['ChatWebsite'],{'foreignKey':_0xaffd('0x1d8'),'as':_0xaffd('0x1d3')});db[_0xaffd('0xee')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'foreignKey':'FromUserId','as':_0xaffd('0x1d5')});db['ChatTransferReport'][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'foreignKey':_0xaffd('0x1d6'),'as':_0xaffd('0x1d9')});db[_0xaffd('0xee')][_0xaffd('0x14a')](db['ChatQueue'],{'foreignKey':_0xaffd('0x1da'),'as':_0xaffd('0x1db')});db[_0xaffd('0xee')][_0xaffd('0x14a')](db[_0xaffd('0x60')],{'foreignKey':_0xaffd('0x1dc'),'as':_0xaffd('0x1dd')});db[_0xaffd('0x1de')][_0xaffd('0x14a')](db[_0xaffd('0x17c')],{});db[_0xaffd('0x1de')]['belongsTo'](db[_0xaffd('0x4d')],{});db[_0xaffd('0x1de')][_0xaffd('0x14a')](db[_0xaffd('0x132')],{'foreignKey':_0xaffd('0x1df'),'as':_0xaffd('0x1d3')});db[_0xaffd('0x1de')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'foreignKey':_0xaffd('0x1d4'),'as':_0xaffd('0x1d5')});db[_0xaffd('0x1de')]['belongsTo'](db[_0xaffd('0x12')],{'foreignKey':'ToUserId','as':_0xaffd('0x1d9')});db[_0xaffd('0x1de')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xaffd('0x1e0'),'as':_0xaffd('0x1db')});db[_0xaffd('0x1de')][_0xaffd('0x14a')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xaffd('0x1dd')});db[_0xaffd('0xf0')][_0xaffd('0x14a')](db[_0xaffd('0x5c')],{});db[_0xaffd('0xf0')][_0xaffd('0x14a')](db['OpenchannelInteraction'],{});db[_0xaffd('0xf0')][_0xaffd('0x14a')](db[_0xaffd('0x58')],{'foreignKey':_0xaffd('0x1e1'),'as':_0xaffd('0x1d3')});db[_0xaffd('0xf0')][_0xaffd('0x14a')](db['User'],{'foreignKey':'FromUserId','as':_0xaffd('0x1d5')});db[_0xaffd('0xf0')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'foreignKey':_0xaffd('0x1d6'),'as':_0xaffd('0x1d9')});db[_0xaffd('0xf0')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0xaffd('0x1e2'),'as':_0xaffd('0x1db')});db[_0xaffd('0xf0')][_0xaffd('0x14a')](db[_0xaffd('0x58')],{'foreignKey':_0xaffd('0x1e3'),'as':_0xaffd('0x1dd')});db[_0xaffd('0xf2')][_0xaffd('0x14a')](db[_0xaffd('0x55')],{});db[_0xaffd('0xf2')][_0xaffd('0x14a')](db[_0xaffd('0x54')],{});db[_0xaffd('0xf2')][_0xaffd('0x14a')](db[_0xaffd('0x13a')],{'foreignKey':'FromSmsAccountId','as':_0xaffd('0x1d3')});db[_0xaffd('0xf2')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'foreignKey':'FromUserId','as':_0xaffd('0x1d5')});db[_0xaffd('0xf2')]['belongsTo'](db[_0xaffd('0x12')],{'foreignKey':_0xaffd('0x1d6'),'as':'ToAgent'});db[_0xaffd('0xf2')][_0xaffd('0x14a')](db[_0xaffd('0x57')],{'foreignKey':'ToSmsQueueId','as':_0xaffd('0x1db')});db[_0xaffd('0xf2')][_0xaffd('0x14a')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xaffd('0x1dd')});db[_0xaffd('0xf4')][_0xaffd('0x10d')](db[_0xaffd('0x80')],{'as':_0xaffd('0x17a'),'foreignKey':'ListId'});db[_0xaffd('0xf4')][_0xaffd('0x10d')](db[_0xaffd('0x1e4')],{'as':_0xaffd('0x1e5'),'foreignKey':_0xaffd('0x177')});db['CmList']['hasMany'](db[_0xaffd('0x72')],{'as':_0xaffd('0x122'),'onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x177')});db['CmList']['hasMany'](db[_0xaffd('0x114')],{'as':_0xaffd('0x115'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0xf4')][_0xaffd('0x10d')](db[_0xaffd('0x148')],{'as':_0xaffd('0x1e6'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0xf4')]['hasMany'](db[_0xaffd('0x116')],{'as':_0xaffd('0x116'),'foreignKey':'ListId'});db['CmList'][_0xaffd('0x11f')](db[_0xaffd('0x1c')],{'as':_0xaffd('0x1e7'),'through':_0xaffd('0x151')});db['CmList'][_0xaffd('0x11f')](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x124')});db[_0xaffd('0xf6')]['hasMany'](db[_0xaffd('0x112')],{'as':_0xaffd('0x1a4'),'onDelete':_0xaffd('0x174')});db[_0xaffd('0xf6')]['belongsToMany'](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':'user_has_voice_prefixes'});db[_0xaffd('0xf8')][_0xaffd('0x10d')](db[_0xaffd('0x12')],{'as':_0xaffd('0x16d'),'foreignKey':_0xaffd('0x11e')});db[_0xaffd('0xf8')]['hasMany'](db[_0xaffd('0x1e8')],{'as':_0xaffd('0x1e9'),'foreignKey':'userProfileId','onDelete':_0xaffd('0x113')});db[_0xaffd('0x1e8')][_0xaffd('0x10d')](db[_0xaffd('0x1ea')],{'as':_0xaffd('0x1eb'),'foreignKey':_0xaffd('0x1ec'),'onDelete':'cascade'});db['WhatsappAccount'][_0xaffd('0x10d')](db[_0xaffd('0x80')],{'as':_0xaffd('0x17a'),'foreignKey':'WhatsappAccountId'});db[_0xaffd('0xfe')][_0xaffd('0x10d')](db[_0xaffd('0x7e')],{'as':_0xaffd('0x160'),'foreignKey':_0xaffd('0x1ed')});db[_0xaffd('0xfe')]['hasMany'](db[_0xaffd('0x103')],{'as':_0xaffd('0x156'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xaffd('0x10d')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0xaffd('0xfe')][_0xaffd('0x10d')](db[_0xaffd('0x100')],{'as':_0xaffd('0x162')});db[_0xaffd('0xfe')][_0xaffd('0x14a')](db['CmList'],{'as':_0xaffd('0x176'),'foreignKey':'ListId'});db[_0xaffd('0xfe')][_0xaffd('0x14a')](db['Pause'],{'as':_0xaffd('0x164'),'foreignKey':_0xaffd('0x14f')});db[_0xaffd('0xfe')]['belongsToMany'](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':_0xaffd('0x13e')});db[_0xaffd('0x100')]['belongsTo'](db[_0xaffd('0x12')],{'onDelete':'restrict'});db[_0xaffd('0x100')]['belongsTo'](db[_0xaffd('0x109')],{'onDelete':_0xaffd('0x174')});db[_0xaffd('0x100')][_0xaffd('0x14a')](db['WhatsappAccount'],{'onDelete':_0xaffd('0x174')});db['WhatsappApplication']['belongsTo'](db[_0xaffd('0x82')],{'onDelete':_0xaffd('0x174'),'foreignKey':_0xaffd('0x14e')});db[_0xaffd('0x100')][_0xaffd('0x14a')](db[_0xaffd('0x16a')],{'onDelete':'restrict','foreignKey':_0xaffd('0x175')});db[_0xaffd('0x101')][_0xaffd('0x10d')](db[_0xaffd('0x103')],{'as':'Messages','onDelete':_0xaffd('0x113'),'foreignKey':_0xaffd('0x1ee')});db['WhatsappInteraction'][_0xaffd('0x14a')](db[_0xaffd('0xfe')],{'as':'Account','foreignKey':_0xaffd('0x1ed')});db[_0xaffd('0x101')][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'as':_0xaffd('0x167'),'foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db[_0xaffd('0x12')],{'as':'Owner','foreignKey':_0xaffd('0x111')});db[_0xaffd('0x101')][_0xaffd('0x11f')](db[_0xaffd('0x16a')],{'through':_0xaffd('0x1ac'),'as':_0xaffd('0x169')});db[_0xaffd('0x101')]['belongsToMany'](db[_0xaffd('0x16a')],{'through':_0xaffd('0x1ac'),'as':_0xaffd('0x16c')});db[_0xaffd('0x101')]['belongsToMany'](db['User'],{'as':_0xaffd('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0xaffd('0x103')][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'as':_0xaffd('0x12')});db[_0xaffd('0x103')][_0xaffd('0x14a')](db['CmContact'],{'onDelete':_0xaffd('0x113'),'as':_0xaffd('0x167')});db[_0xaffd('0x103')][_0xaffd('0x14a')](db[_0xaffd('0x101')],{'onDelete':_0xaffd('0x113'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0xaffd('0x103')][_0xaffd('0x14a')](db[_0xaffd('0xfe')],{'as':_0xaffd('0x173'),'foreignKey':_0xaffd('0x1ed')});db['WhatsappQueueReport'][_0xaffd('0x14a')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0xaffd('0x14a')](db[_0xaffd('0xf4')],{'as':_0xaffd('0x176'),'foreignKey':_0xaffd('0x177')});db[_0xaffd('0x105')][_0xaffd('0x14a')](db[_0xaffd('0x72')],{'as':_0xaffd('0x167'),'foreignKey':_0xaffd('0x15b')});db[_0xaffd('0x105')][_0xaffd('0x14a')](db[_0xaffd('0x101')],{});db[_0xaffd('0x105')][_0xaffd('0x14a')](db[_0xaffd('0x109')],{});db[_0xaffd('0x105')]['belongsTo'](db[_0xaffd('0x103')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xaffd('0x12')],{});db[_0xaffd('0x107')]['belongsTo'](db['WhatsappMessage'],{});db[_0xaffd('0x107')][_0xaffd('0x14a')](db[_0xaffd('0x101')],{});db[_0xaffd('0x107')][_0xaffd('0x14a')](db[_0xaffd('0xfe')],{'foreignKey':_0xaffd('0x1ef'),'as':'FromAccount'});db['WhatsappTransferReport'][_0xaffd('0x14a')](db['WhatsappAccount'],{'foreignKey':_0xaffd('0x1f0'),'as':_0xaffd('0x1dd')});db[_0xaffd('0x107')][_0xaffd('0x14a')](db[_0xaffd('0x109')],{'foreignKey':'ToQueueId','as':_0xaffd('0x1db')});db['WhatsappTransferReport'][_0xaffd('0x14a')](db[_0xaffd('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xaffd('0x107')]['belongsTo'](db[_0xaffd('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xaffd('0x109')]['belongsToMany'](db[_0xaffd('0x12')],{'as':_0xaffd('0x165'),'through':'UserWhatsappQueue','foreignKey':_0xaffd('0x1f1')});db[_0xaffd('0x109')]['belongsToMany'](db['Team'],{'through':_0xaffd('0x1f2'),'as':'Teams'});module[_0xaffd('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3c5f081..3f07fe4 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf3=['/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/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/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','/www','static','join','root','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','statusCode','device','other','agent_name','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/variable','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount'];(function(_0x3ce2bc,_0x2b7d27){var _0x1fd561=function(_0x54f7a0){while(--_0x54f7a0){_0x3ce2bc['push'](_0x3ce2bc['shift']());}};_0x1fd561(++_0x2b7d27);}(_0xdbf3,0x72));var _0x3dbf=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xdbf3[_0x31a371];return _0x2a5bd6;};'use strict';var path=require(_0x3dbf('0x0'));var express=require(_0x3dbf('0x1'));var ewinston=require(_0x3dbf('0x2'));var util=require(_0x3dbf('0x3'));var errors=require(_0x3dbf('0x4'));var config=require(_0x3dbf('0x5'));var logger=require(_0x3dbf('0x6'))(_0x3dbf('0x7'));var authLogger=require(_0x3dbf('0x6'))(_0x3dbf('0x8'));exports['default']=function(_0x4d063a){_0x4d063a[_0x3dbf('0x9')](ewinston[_0x3dbf('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x361caa,_0x4dab4d){return util[_0x3dbf('0xb')](_0x3dbf('0xc'),_0x361caa[_0x3dbf('0xd')],_0x361caa[_0x3dbf('0xe')][_0x3dbf('0xf')]?_0x361caa[_0x3dbf('0xe')][_0x3dbf('0xf')]:_0x361caa[_0x3dbf('0x10')][_0x3dbf('0x11')]||_0x361caa['ip'],_0x361caa[_0x3dbf('0x12')],_0x4dab4d['statusCode'],_0x4dab4d[_0x3dbf('0x13')],_0x361caa[_0x3dbf('0x14')]?_0x361caa[_0x3dbf('0x14')]['id']:null,_0x361caa[_0x3dbf('0x14')]?_0x361caa[_0x3dbf('0x14')][_0x3dbf('0x15')]:null,_0x361caa[_0x3dbf('0x14')]?_0x361caa['user'][_0x3dbf('0x16')]:null);}}));_0x4d063a['use'](ewinston[_0x3dbf('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x452f7a,_0x395afc){var _0x32b995=_0x3dbf('0x17');if(_0x452f7a[_0x3dbf('0x18')]&&_0x452f7a[_0x3dbf('0x18')]['device']&&_0x452f7a[_0x3dbf('0x18')][_0x3dbf('0x19')]){_0x32b995='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3dbf('0xb')](_0x32b995,_0x452f7a['method'],_0x452f7a[_0x3dbf('0xe')]['x-forwarded-for']?_0x452f7a[_0x3dbf('0xe')][_0x3dbf('0xf')]:_0x452f7a[_0x3dbf('0x10')][_0x3dbf('0x11')]||_0x452f7a['ip'],_0x452f7a[_0x3dbf('0x12')],_0x395afc[_0x3dbf('0x1a')],_0x395afc[_0x3dbf('0x13')],_0x452f7a['user']?_0x452f7a[_0x3dbf('0x14')]['id']:null,_0x452f7a[_0x3dbf('0x14')]?_0x452f7a[_0x3dbf('0x14')][_0x3dbf('0x15')]:null,_0x452f7a['user']?_0x452f7a[_0x3dbf('0x14')][_0x3dbf('0x16')]:null,_0x452f7a[_0x3dbf('0x18')]&&_0x452f7a[_0x3dbf('0x18')][_0x3dbf('0x1b')]?_0x452f7a['body'][_0x3dbf('0x1b')]:_0x3dbf('0x1c'),_0x452f7a[_0x3dbf('0x18')]&&_0x452f7a['body'][_0x3dbf('0x19')]?_0x452f7a['body'][_0x3dbf('0x19')]:'',_0x452f7a['body']&&_0x452f7a['body'][_0x3dbf('0x1d')]?_0x452f7a['body']['agent_name']:'');},'ignoreRoute':function(_0x232050){var _0x153c9e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x153c9e['test'](_0x232050[_0x3dbf('0x12')]);}}));_0x4d063a[_0x3dbf('0x9')]('/api/users',require(_0x3dbf('0x1e')));_0x4d063a['use'](_0x3dbf('0x1f'),require(_0x3dbf('0x20')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x21'),require('./api/voiceContext'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x22'),require('./api/voiceExtension'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x23'),require(_0x3dbf('0x24')));_0x4d063a['use'](_0x3dbf('0x25'),require(_0x3dbf('0x26')));_0x4d063a['use'](_0x3dbf('0x27'),require(_0x3dbf('0x28')));_0x4d063a['use'](_0x3dbf('0x29'),require(_0x3dbf('0x2a')));_0x4d063a['use'](_0x3dbf('0x2b'),require(_0x3dbf('0x2c')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x2d'),require(_0x3dbf('0x2e')));_0x4d063a[_0x3dbf('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x4d063a['use'](_0x3dbf('0x2f'),require(_0x3dbf('0x30')));_0x4d063a[_0x3dbf('0x9')]('/api/voice/agents/reports',require(_0x3dbf('0x31')));_0x4d063a['use']('/api/voice/queues/reports',require(_0x3dbf('0x32')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x33'),require(_0x3dbf('0x34')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x35'),require(_0x3dbf('0x36')));_0x4d063a[_0x3dbf('0x9')]('/api/voice/transfers/reports',require(_0x3dbf('0x37')));_0x4d063a['use'](_0x3dbf('0x38'),require('./api/mailServerOut'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x39'),require(_0x3dbf('0x3a')));_0x4d063a[_0x3dbf('0x9')]('/api/mail/queues',require(_0x3dbf('0x3b')));_0x4d063a[_0x3dbf('0x9')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x4d063a[_0x3dbf('0x9')]('/api/mail/interactions',require(_0x3dbf('0x3c')));_0x4d063a[_0x3dbf('0x9')]('/api/mail/messages',require(_0x3dbf('0x3d')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x3e'),require(_0x3dbf('0x3f')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x40'),require(_0x3dbf('0x41')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x42'),require('./api/dashboard'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x43'),require('./api/dashboardItem'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x44'),require(_0x3dbf('0x45')));_0x4d063a['use'](_0x3dbf('0x46'),require(_0x3dbf('0x47')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x48'),require(_0x3dbf('0x49')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x4a'),require(_0x3dbf('0x4b')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x4c'),require(_0x3dbf('0x4d')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x4e'),require(_0x3dbf('0x4f')));_0x4d063a[_0x3dbf('0x9')]('/api/sms/accounts',require('./api/smsAccount'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x50'),require('./api/smsApplication'));_0x4d063a['use'](_0x3dbf('0x51'),require(_0x3dbf('0x52')));_0x4d063a['use'](_0x3dbf('0x53'),require('./api/smsMessage'));_0x4d063a['use'](_0x3dbf('0x54'),require(_0x3dbf('0x55')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x56'),require('./api/openchannelAccount'));_0x4d063a['use'](_0x3dbf('0x57'),require(_0x3dbf('0x58')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x59'),require('./api/openchannelInteraction'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x5a'),require(_0x3dbf('0x5b')));_0x4d063a['use'](_0x3dbf('0x5c'),require(_0x3dbf('0x5d')));_0x4d063a['use'](_0x3dbf('0x5e'),require(_0x3dbf('0x5f')));_0x4d063a['use']('/api/openchannel/reports/queue',require(_0x3dbf('0x60')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x61'),require(_0x3dbf('0x62')));_0x4d063a['use'](_0x3dbf('0x63'),require(_0x3dbf('0x64')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x65'),require(_0x3dbf('0x66')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x67'),require(_0x3dbf('0x68')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x69'),require(_0x3dbf('0x6a')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x6b'),require(_0x3dbf('0x6c')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x6d'),require('./api/chatProactiveAction'));_0x4d063a[_0x3dbf('0x9')]('/api/cm/companies',require(_0x3dbf('0x6e')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x6f'),require(_0x3dbf('0x70')));_0x4d063a[_0x3dbf('0x9')]('/api/cm/hopper',require(_0x3dbf('0x71')));_0x4d063a['use'](_0x3dbf('0x72'),require('./api/cmHopperBlack'));_0x4d063a[_0x3dbf('0x9')]('/api/cm/hopper_final',require(_0x3dbf('0x73')));_0x4d063a[_0x3dbf('0x9')]('/api/cm/hopper_history',require(_0x3dbf('0x74')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x75'),require(_0x3dbf('0x76')));_0x4d063a['use']('/api/actions',require(_0x3dbf('0x77')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x78'),require(_0x3dbf('0x79')));_0x4d063a['use'](_0x3dbf('0x7a'),require(_0x3dbf('0x7b')));_0x4d063a['use']('/api/dispositions',require('./api/disposition'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x7c'),require(_0x3dbf('0x7d')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x7e'),require('./api/interval'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x7f'),require('./api/pause'));_0x4d063a[_0x3dbf('0x9')]('/api/cdr',require('./api/cdr'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x80'),require(_0x3dbf('0x81')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x82'),require(_0x3dbf('0x83')));_0x4d063a[_0x3dbf('0x9')]('/api/sounds',require(_0x3dbf('0x84')));_0x4d063a['use'](_0x3dbf('0x85'),require(_0x3dbf('0x86')));_0x4d063a[_0x3dbf('0x9')]('/api/templates',require(_0x3dbf('0x87')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x88'),require('./api/trigger'));_0x4d063a[_0x3dbf('0x9')]('/api/variables',require(_0x3dbf('0x89')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations',require(_0x3dbf('0x8a')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/reports',require(_0x3dbf('0x8b')));_0x4d063a[_0x3dbf('0x9')]('/api/analytics/custom_reports',require(_0x3dbf('0x8c')));_0x4d063a['use'](_0x3dbf('0x8d'),require('./api/analyticDefaultReport'));_0x4d063a[_0x3dbf('0x9')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x8e'),require('./api/analyticMetric'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x8f'),require(_0x3dbf('0x90')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x91'),require(_0x3dbf('0x92')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x93'),require('./api/intSalesforceAccount'));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x4d063a['use'](_0x3dbf('0x94'),require('./api/intSalesforceField'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x95'),require('./api/intSugarcrmAccount'));_0x4d063a['use'](_0x3dbf('0x96'),require(_0x3dbf('0x97')));_0x4d063a['use']('/api/integrations/sugarcrm/fields',require(_0x3dbf('0x98')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x4d063a['use'](_0x3dbf('0x99'),require('./api/intDeskField'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x9a'),require('./api/intZohoAccount'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x9b'),require(_0x3dbf('0x9c')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/zoho/fields',require(_0x3dbf('0x9d')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x9e'),require(_0x3dbf('0x9f')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/zendesk/configurations',require(_0x3dbf('0xa0')));_0x4d063a['use']('/api/integrations/zendesk/fields',require(_0x3dbf('0xa1')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xa2'),require(_0x3dbf('0xa3')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xa4'),require(_0x3dbf('0xa5')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xa6'),require('./api/intFreshdeskField'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xa7'),require(_0x3dbf('0xa8')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xa9'),require(_0x3dbf('0xaa')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xab'),require(_0x3dbf('0xac')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/servicenow/accounts',require(_0x3dbf('0xad')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xae'),require(_0x3dbf('0xaf')));_0x4d063a['use'](_0x3dbf('0xb0'),require(_0x3dbf('0xb1')));_0x4d063a['use'](_0x3dbf('0xb2'),require('./api/intDynamics365Account'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xb3'),require('./api/intDynamics365Configuration'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xb4'),require(_0x3dbf('0xb5')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xb6'),require(_0x3dbf('0xb7')));_0x4d063a[_0x3dbf('0x9')]('/api/integrations/freshsales/configurations',require(_0x3dbf('0xb8')));_0x4d063a['use'](_0x3dbf('0xb9'),require(_0x3dbf('0xba')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xbb'),require('./api/network'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xbc'),require(_0x3dbf('0xbd')));_0x4d063a['use'](_0x3dbf('0xbe'),require(_0x3dbf('0xbf')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xc0'),require(_0x3dbf('0xc1')));_0x4d063a[_0x3dbf('0x9')]('/api/jscripty/questions/reports',require(_0x3dbf('0xc2')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xc3'),require('./api/jscriptySessionReport'));_0x4d063a[_0x3dbf('0x9')]('/api/sms/reports/queue',require(_0x3dbf('0xc4')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xc5'),require(_0x3dbf('0xc6')));_0x4d063a['use'](_0x3dbf('0xc7'),require(_0x3dbf('0xc8')));_0x4d063a[_0x3dbf('0x9')]('/api/jscripty/projects',require(_0x3dbf('0xc9')));_0x4d063a['use']('/api/settings',require(_0x3dbf('0xca')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xcb'),require(_0x3dbf('0xcc')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xcd'),require(_0x3dbf('0xce')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xcf'),require(_0x3dbf('0xd0')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xd1'),require(_0x3dbf('0xd2')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xd3'),require(_0x3dbf('0xd4')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xd5'),require(_0x3dbf('0xd6')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xd7'),require('./api/campaign'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xd8'),require(_0x3dbf('0xd9')));_0x4d063a['use']('/api/attachments',require('./api/attachment'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xda'),require('./api/plugin'));_0x4d063a['use'](_0x3dbf('0xdb'),require(_0x3dbf('0xdc')));_0x4d063a[_0x3dbf('0x9')]('/api/chat/reports/transfer',require(_0x3dbf('0xdd')));_0x4d063a[_0x3dbf('0x9')]('/api/fax/reports/transfer',require(_0x3dbf('0xde')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xdf'),require(_0x3dbf('0xe0')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xe1'),require(_0x3dbf('0xe2')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xe3'),require(_0x3dbf('0xe4')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xe5'),require('./api/voicePrefix'));_0x4d063a[_0x3dbf('0x9')]('/api/userProfiles',require(_0x3dbf('0xe6')));_0x4d063a['use'](_0x3dbf('0xe7'),require(_0x3dbf('0xe8')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xe9'),require(_0x3dbf('0xea')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xeb'),require('./api/notification'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xec'),require(_0x3dbf('0xed')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xee'),require(_0x3dbf('0xef')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xf0'),require(_0x3dbf('0xf1')));_0x4d063a['use'](_0x3dbf('0xf2'),require(_0x3dbf('0xf3')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xf4'),require(_0x3dbf('0xf5')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xf6'),require(_0x3dbf('0xf7')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xf8'),require(_0x3dbf('0xf9')));_0x4d063a[_0x3dbf('0x9')]('/api/cloudProviders',require(_0x3dbf('0xfa')));_0x4d063a['use'](_0x3dbf('0xfb'),require('./api/authLocal'));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0xfc'),require('./api/authGoogle'));_0x4d063a[_0x3dbf('0x9')]('/api/jira',require(_0x3dbf('0xfd')));_0x4d063a['use'](_0x3dbf('0xfe'),require(_0x3dbf('0xff')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x100'),require(_0x3dbf('0x101')));_0x4d063a['use'](_0x3dbf('0x102'),require(_0x3dbf('0x103')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x104'),require('./api/pm2'));_0x4d063a[_0x3dbf('0x9')]('/api/webbar',require(_0x3dbf('0x105')));_0x4d063a['use']('/apidoc',express['static'](path['join'](config['root'],'/apidoc')));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x106'),express[_0x3dbf('0x107')](path[_0x3dbf('0x108')](config[_0x3dbf('0x109')],_0x3dbf('0x106'))));_0x4d063a[_0x3dbf('0x9')]('/demo',express[_0x3dbf('0x107')](path[_0x3dbf('0x108')](config[_0x3dbf('0x109')],_0x3dbf('0x10a'))));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x10b'),express[_0x3dbf('0x107')](path[_0x3dbf('0x108')](config[_0x3dbf('0x109')],_0x3dbf('0x10c'),_0x3dbf('0x10d'))));_0x4d063a[_0x3dbf('0x9')](_0x3dbf('0x10e'),express[_0x3dbf('0x107')](path[_0x3dbf('0x108')](config['root'],_0x3dbf('0x10f'))));_0x4d063a[_0x3dbf('0x110')](_0x3dbf('0x111'))['get'](errors[0x194]);_0x4d063a[_0x3dbf('0x110')]('/*')[_0x3dbf('0x112')](function(_0x38dfbb,_0x238c93){_0x238c93['sendFile'](path[_0x3dbf('0x113')](_0x4d063a['get'](_0x3dbf('0x114'))+_0x3dbf('0x115')));});}; \ No newline at end of file +var _0x4611=['./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','/apidoc','static','join','root','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','express-winston','util','./errors','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','other','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','/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/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue'];(function(_0x4ead7b,_0xdee1b2){var _0x2d1edf=function(_0x2881da){while(--_0x2881da){_0x4ead7b['push'](_0x4ead7b['shift']());}};_0x2d1edf(++_0xdee1b2);}(_0x4611,0x170));var _0x1461=function(_0x31741b,_0x5aeb18){_0x31741b=_0x31741b-0x0;var _0x49e96b=_0x4611[_0x31741b];return _0x49e96b;};'use strict';var path=require('path');var express=require(_0x1461('0x0'));var ewinston=require(_0x1461('0x1'));var util=require(_0x1461('0x2'));var errors=require(_0x1461('0x3'));var config=require('./config/environment');var logger=require(_0x1461('0x4'))('api');var authLogger=require(_0x1461('0x4'))(_0x1461('0x5'));exports[_0x1461('0x6')]=function(_0x164d74){_0x164d74[_0x1461('0x7')](ewinston[_0x1461('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x184138,_0x2d996c){return util[_0x1461('0x9')](_0x1461('0xa'),_0x184138[_0x1461('0xb')],_0x184138[_0x1461('0xc')][_0x1461('0xd')]?_0x184138['headers']['x-forwarded-for']:_0x184138[_0x1461('0xe')][_0x1461('0xf')]||_0x184138['ip'],_0x184138[_0x1461('0x10')],_0x2d996c[_0x1461('0x11')],_0x2d996c[_0x1461('0x12')],_0x184138[_0x1461('0x13')]?_0x184138[_0x1461('0x13')]['id']:null,_0x184138[_0x1461('0x13')]?_0x184138[_0x1461('0x13')][_0x1461('0x14')]:null,_0x184138[_0x1461('0x13')]?_0x184138[_0x1461('0x13')][_0x1461('0x15')]:null);}}));_0x164d74[_0x1461('0x7')](ewinston[_0x1461('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x505702,_0xc84810){var _0x570eb6=_0x1461('0x16');if(_0x505702['body']&&_0x505702[_0x1461('0x17')][_0x1461('0x18')]&&_0x505702[_0x1461('0x17')][_0x1461('0x19')]){_0x570eb6='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x570eb6,_0x505702[_0x1461('0xb')],_0x505702[_0x1461('0xc')][_0x1461('0xd')]?_0x505702[_0x1461('0xc')]['x-forwarded-for']:_0x505702[_0x1461('0xe')][_0x1461('0xf')]||_0x505702['ip'],_0x505702['url'],_0xc84810[_0x1461('0x11')],_0xc84810[_0x1461('0x12')],_0x505702[_0x1461('0x13')]?_0x505702[_0x1461('0x13')]['id']:null,_0x505702[_0x1461('0x13')]?_0x505702[_0x1461('0x13')]['name']:null,_0x505702[_0x1461('0x13')]?_0x505702['user']['role']:null,_0x505702[_0x1461('0x17')]&&_0x505702[_0x1461('0x17')][_0x1461('0x18')]?_0x505702[_0x1461('0x17')]['device']:_0x1461('0x1a'),_0x505702['body']&&_0x505702[_0x1461('0x17')][_0x1461('0x19')]?_0x505702['body'][_0x1461('0x19')]:'',_0x505702['body']&&_0x505702['body'][_0x1461('0x1b')]?_0x505702[_0x1461('0x17')][_0x1461('0x1b')]:'');},'ignoreRoute':function(_0x26b70f){var _0x4fdca5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4fdca5[_0x1461('0x1c')](_0x26b70f[_0x1461('0x10')]);}}));_0x164d74['use']('/api/users',require(_0x1461('0x1d')));_0x164d74[_0x1461('0x7')](_0x1461('0x1e'),require(_0x1461('0x1f')));_0x164d74[_0x1461('0x7')]('/api/voice/contexts',require(_0x1461('0x20')));_0x164d74[_0x1461('0x7')](_0x1461('0x21'),require(_0x1461('0x22')));_0x164d74[_0x1461('0x7')](_0x1461('0x23'),require(_0x1461('0x24')));_0x164d74[_0x1461('0x7')]('/api/voice/queues',require(_0x1461('0x25')));_0x164d74[_0x1461('0x7')](_0x1461('0x26'),require(_0x1461('0x27')));_0x164d74[_0x1461('0x7')](_0x1461('0x28'),require('./api/screenRecording'));_0x164d74[_0x1461('0x7')](_0x1461('0x29'),require(_0x1461('0x2a')));_0x164d74['use'](_0x1461('0x2b'),require(_0x1461('0x2c')));_0x164d74[_0x1461('0x7')](_0x1461('0x2d'),require('./api/voiceCallReport'));_0x164d74[_0x1461('0x7')](_0x1461('0x2e'),require(_0x1461('0x2f')));_0x164d74[_0x1461('0x7')]('/api/voice/agents/reports',require(_0x1461('0x30')));_0x164d74[_0x1461('0x7')](_0x1461('0x31'),require(_0x1461('0x32')));_0x164d74[_0x1461('0x7')](_0x1461('0x33'),require('./api/memberReport'));_0x164d74[_0x1461('0x7')](_0x1461('0x34'),require(_0x1461('0x35')));_0x164d74[_0x1461('0x7')]('/api/voice/transfers/reports',require(_0x1461('0x36')));_0x164d74[_0x1461('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x164d74[_0x1461('0x7')](_0x1461('0x37'),require(_0x1461('0x38')));_0x164d74['use'](_0x1461('0x39'),require(_0x1461('0x3a')));_0x164d74[_0x1461('0x7')](_0x1461('0x3b'),require(_0x1461('0x3c')));_0x164d74['use'](_0x1461('0x3d'),require(_0x1461('0x3e')));_0x164d74['use'](_0x1461('0x3f'),require(_0x1461('0x40')));_0x164d74[_0x1461('0x7')](_0x1461('0x41'),require('./api/mailApplication'));_0x164d74[_0x1461('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x164d74['use'](_0x1461('0x42'),require(_0x1461('0x43')));_0x164d74[_0x1461('0x7')](_0x1461('0x44'),require(_0x1461('0x45')));_0x164d74[_0x1461('0x7')]('/api/fax/accounts',require(_0x1461('0x46')));_0x164d74[_0x1461('0x7')](_0x1461('0x47'),require('./api/faxApplication'));_0x164d74[_0x1461('0x7')](_0x1461('0x48'),require(_0x1461('0x49')));_0x164d74[_0x1461('0x7')](_0x1461('0x4a'),require(_0x1461('0x4b')));_0x164d74[_0x1461('0x7')](_0x1461('0x4c'),require('./api/faxQueue'));_0x164d74['use'](_0x1461('0x4d'),require('./api/faxQueueReport'));_0x164d74[_0x1461('0x7')](_0x1461('0x4e'),require(_0x1461('0x4f')));_0x164d74['use'](_0x1461('0x50'),require(_0x1461('0x51')));_0x164d74['use'](_0x1461('0x52'),require(_0x1461('0x53')));_0x164d74[_0x1461('0x7')]('/api/sms/messages',require('./api/smsMessage'));_0x164d74[_0x1461('0x7')](_0x1461('0x54'),require(_0x1461('0x55')));_0x164d74['use'](_0x1461('0x56'),require('./api/openchannelAccount'));_0x164d74[_0x1461('0x7')](_0x1461('0x57'),require(_0x1461('0x58')));_0x164d74[_0x1461('0x7')](_0x1461('0x59'),require(_0x1461('0x5a')));_0x164d74[_0x1461('0x7')](_0x1461('0x5b'),require(_0x1461('0x5c')));_0x164d74[_0x1461('0x7')](_0x1461('0x5d'),require(_0x1461('0x5e')));_0x164d74['use'](_0x1461('0x5f'),require(_0x1461('0x60')));_0x164d74[_0x1461('0x7')](_0x1461('0x61'),require(_0x1461('0x62')));_0x164d74[_0x1461('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x164d74[_0x1461('0x7')]('/api/chat/interactions',require(_0x1461('0x63')));_0x164d74[_0x1461('0x7')](_0x1461('0x64'),require(_0x1461('0x65')));_0x164d74['use'](_0x1461('0x66'),require(_0x1461('0x67')));_0x164d74[_0x1461('0x7')]('/api/chat/queues',require(_0x1461('0x68')));_0x164d74[_0x1461('0x7')](_0x1461('0x69'),require(_0x1461('0x6a')));_0x164d74[_0x1461('0x7')]('/api/chat/proactive_actions',require(_0x1461('0x6b')));_0x164d74[_0x1461('0x7')](_0x1461('0x6c'),require('./api/cmCompany'));_0x164d74[_0x1461('0x7')](_0x1461('0x6d'),require('./api/cmContact'));_0x164d74[_0x1461('0x7')](_0x1461('0x6e'),require(_0x1461('0x6f')));_0x164d74[_0x1461('0x7')](_0x1461('0x70'),require(_0x1461('0x71')));_0x164d74[_0x1461('0x7')](_0x1461('0x72'),require(_0x1461('0x73')));_0x164d74[_0x1461('0x7')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x164d74[_0x1461('0x7')](_0x1461('0x74'),require(_0x1461('0x75')));_0x164d74[_0x1461('0x7')](_0x1461('0x76'),require('./api/action'));_0x164d74['use'](_0x1461('0x77'),require('./api/automation'));_0x164d74['use'](_0x1461('0x78'),require(_0x1461('0x79')));_0x164d74[_0x1461('0x7')](_0x1461('0x7a'),require(_0x1461('0x7b')));_0x164d74[_0x1461('0x7')](_0x1461('0x7c'),require(_0x1461('0x7d')));_0x164d74[_0x1461('0x7')](_0x1461('0x7e'),require('./api/interval'));_0x164d74['use'](_0x1461('0x7f'),require('./api/pause'));_0x164d74[_0x1461('0x7')](_0x1461('0x80'),require(_0x1461('0x81')));_0x164d74['use'](_0x1461('0x82'),require('./api/voiceQueuesLog'));_0x164d74[_0x1461('0x7')](_0x1461('0x83'),require(_0x1461('0x84')));_0x164d74[_0x1461('0x7')](_0x1461('0x85'),require(_0x1461('0x86')));_0x164d74[_0x1461('0x7')](_0x1461('0x87'),require(_0x1461('0x88')));_0x164d74['use'](_0x1461('0x89'),require(_0x1461('0x8a')));_0x164d74['use'](_0x1461('0x8b'),require(_0x1461('0x8c')));_0x164d74[_0x1461('0x7')](_0x1461('0x8d'),require(_0x1461('0x8e')));_0x164d74['use'](_0x1461('0x8f'),require('./api/integration'));_0x164d74[_0x1461('0x7')](_0x1461('0x90'),require(_0x1461('0x91')));_0x164d74['use'](_0x1461('0x92'),require(_0x1461('0x93')));_0x164d74[_0x1461('0x7')](_0x1461('0x94'),require(_0x1461('0x95')));_0x164d74['use'](_0x1461('0x96'),require(_0x1461('0x97')));_0x164d74['use'](_0x1461('0x98'),require('./api/analyticMetric'));_0x164d74[_0x1461('0x7')](_0x1461('0x99'),require('./api/analyticFieldReport'));_0x164d74[_0x1461('0x7')]('/api/analytics/tree_reports',require(_0x1461('0x9a')));_0x164d74['use'](_0x1461('0x9b'),require(_0x1461('0x9c')));_0x164d74[_0x1461('0x7')](_0x1461('0x9d'),require(_0x1461('0x9e')));_0x164d74[_0x1461('0x7')](_0x1461('0x9f'),require(_0x1461('0xa0')));_0x164d74[_0x1461('0x7')](_0x1461('0xa1'),require(_0x1461('0xa2')));_0x164d74['use'](_0x1461('0xa3'),require(_0x1461('0xa4')));_0x164d74['use'](_0x1461('0xa5'),require(_0x1461('0xa6')));_0x164d74[_0x1461('0x7')](_0x1461('0xa7'),require(_0x1461('0xa8')));_0x164d74[_0x1461('0x7')](_0x1461('0xa9'),require(_0x1461('0xaa')));_0x164d74[_0x1461('0x7')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x164d74[_0x1461('0x7')](_0x1461('0xab'),require(_0x1461('0xac')));_0x164d74['use'](_0x1461('0xad'),require(_0x1461('0xae')));_0x164d74['use'](_0x1461('0xaf'),require(_0x1461('0xb0')));_0x164d74[_0x1461('0x7')](_0x1461('0xb1'),require(_0x1461('0xb2')));_0x164d74['use'](_0x1461('0xb3'),require(_0x1461('0xb4')));_0x164d74[_0x1461('0x7')](_0x1461('0xb5'),require('./api/intZendeskField'));_0x164d74[_0x1461('0x7')](_0x1461('0xb6'),require(_0x1461('0xb7')));_0x164d74[_0x1461('0x7')](_0x1461('0xb8'),require(_0x1461('0xb9')));_0x164d74[_0x1461('0x7')](_0x1461('0xba'),require(_0x1461('0xbb')));_0x164d74[_0x1461('0x7')]('/api/integrations/vtiger/accounts',require(_0x1461('0xbc')));_0x164d74[_0x1461('0x7')]('/api/integrations/vtiger/configurations',require(_0x1461('0xbd')));_0x164d74['use']('/api/integrations/vtiger/fields',require(_0x1461('0xbe')));_0x164d74[_0x1461('0x7')]('/api/integrations/servicenow/accounts',require(_0x1461('0xbf')));_0x164d74[_0x1461('0x7')](_0x1461('0xc0'),require('./api/intServicenowConfiguration'));_0x164d74['use'](_0x1461('0xc1'),require(_0x1461('0xc2')));_0x164d74[_0x1461('0x7')](_0x1461('0xc3'),require(_0x1461('0xc4')));_0x164d74[_0x1461('0x7')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x164d74[_0x1461('0x7')](_0x1461('0xc5'),require(_0x1461('0xc6')));_0x164d74[_0x1461('0x7')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x164d74[_0x1461('0x7')]('/api/integrations/freshsales/configurations',require(_0x1461('0xc7')));_0x164d74['use'](_0x1461('0xc8'),require(_0x1461('0xc9')));_0x164d74[_0x1461('0x7')](_0x1461('0xca'),require(_0x1461('0xcb')));_0x164d74['use'](_0x1461('0xcc'),require(_0x1461('0xcd')));_0x164d74['use'](_0x1461('0xce'),require(_0x1461('0xcf')));_0x164d74[_0x1461('0x7')](_0x1461('0xd0'),require(_0x1461('0xd1')));_0x164d74[_0x1461('0x7')]('/api/jscripty/questions/reports',require(_0x1461('0xd2')));_0x164d74[_0x1461('0x7')](_0x1461('0xd3'),require(_0x1461('0xd4')));_0x164d74[_0x1461('0x7')](_0x1461('0xd5'),require(_0x1461('0xd6')));_0x164d74[_0x1461('0x7')]('/api/square/reports',require(_0x1461('0xd7')));_0x164d74['use'](_0x1461('0xd8'),require(_0x1461('0xd9')));_0x164d74[_0x1461('0x7')](_0x1461('0xda'),require(_0x1461('0xdb')));_0x164d74[_0x1461('0x7')](_0x1461('0xdc'),require('./api/setting'));_0x164d74[_0x1461('0x7')](_0x1461('0xdd'),require(_0x1461('0xde')));_0x164d74['use']('/api/square/projects',require(_0x1461('0xdf')));_0x164d74[_0x1461('0x7')](_0x1461('0xe0'),require('./api/squareRecording'));_0x164d74[_0x1461('0x7')](_0x1461('0xe1'),require('./api/squareMessage'));_0x164d74[_0x1461('0x7')](_0x1461('0xe2'),require(_0x1461('0xe3')));_0x164d74[_0x1461('0x7')](_0x1461('0xe4'),require(_0x1461('0xe5')));_0x164d74[_0x1461('0x7')](_0x1461('0xe6'),require(_0x1461('0xe7')));_0x164d74[_0x1461('0x7')](_0x1461('0xe8'),require('./api/migration'));_0x164d74['use'](_0x1461('0xe9'),require(_0x1461('0xea')));_0x164d74[_0x1461('0x7')](_0x1461('0xeb'),require('./api/plugin'));_0x164d74[_0x1461('0x7')]('/api/mail/reports/transfer',require(_0x1461('0xec')));_0x164d74[_0x1461('0x7')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x164d74[_0x1461('0x7')](_0x1461('0xed'),require(_0x1461('0xee')));_0x164d74[_0x1461('0x7')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x164d74[_0x1461('0x7')](_0x1461('0xef'),require(_0x1461('0xf0')));_0x164d74['use'](_0x1461('0xf1'),require('./api/cmList'));_0x164d74[_0x1461('0x7')](_0x1461('0xf2'),require(_0x1461('0xf3')));_0x164d74[_0x1461('0x7')](_0x1461('0xf4'),require(_0x1461('0xf5')));_0x164d74[_0x1461('0x7')](_0x1461('0xf6'),require(_0x1461('0xf7')));_0x164d74['use'](_0x1461('0xf8'),require(_0x1461('0xf9')));_0x164d74[_0x1461('0x7')]('/api/notifications',require('./api/notification'));_0x164d74[_0x1461('0x7')]('/api/whatsapp/accounts',require(_0x1461('0xfa')));_0x164d74[_0x1461('0x7')]('/api/whatsapp/applications',require(_0x1461('0xfb')));_0x164d74[_0x1461('0x7')](_0x1461('0xfc'),require(_0x1461('0xfd')));_0x164d74[_0x1461('0x7')](_0x1461('0xfe'),require('./api/whatsappMessage'));_0x164d74['use'](_0x1461('0xff'),require(_0x1461('0x100')));_0x164d74[_0x1461('0x7')](_0x1461('0x101'),require(_0x1461('0x102')));_0x164d74[_0x1461('0x7')]('/api/whatsapp/queues',require(_0x1461('0x103')));_0x164d74[_0x1461('0x7')]('/api/cloudProviders',require(_0x1461('0x104')));_0x164d74[_0x1461('0x7')](_0x1461('0x105'),require(_0x1461('0x106')));_0x164d74['use'](_0x1461('0x107'),require(_0x1461('0x108')));_0x164d74[_0x1461('0x7')](_0x1461('0x109'),require(_0x1461('0x10a')));_0x164d74[_0x1461('0x7')](_0x1461('0x10b'),require(_0x1461('0x10c')));_0x164d74['use'](_0x1461('0x10d'),require(_0x1461('0x10e')));_0x164d74[_0x1461('0x7')]('/api/system',require(_0x1461('0x10f')));_0x164d74[_0x1461('0x7')]('/api/pm2',require(_0x1461('0x110')));_0x164d74[_0x1461('0x7')](_0x1461('0x111'),require('./api/webbar'));_0x164d74[_0x1461('0x7')](_0x1461('0x112'),express[_0x1461('0x113')](path[_0x1461('0x114')](config['root'],_0x1461('0x112'))));_0x164d74[_0x1461('0x7')]('/www',express[_0x1461('0x113')](path['join'](config['root'],'/www')));_0x164d74['use']('/demo',express['static'](path[_0x1461('0x114')](config[_0x1461('0x115')],_0x1461('0x116'))));_0x164d74[_0x1461('0x7')](_0x1461('0x117'),express[_0x1461('0x113')](path[_0x1461('0x114')](config['root'],_0x1461('0x118'),_0x1461('0x119'))));_0x164d74[_0x1461('0x7')](_0x1461('0x11a'),express[_0x1461('0x113')](path[_0x1461('0x114')](config[_0x1461('0x115')],_0x1461('0x11b'))));_0x164d74[_0x1461('0x11c')](_0x1461('0x11d'))[_0x1461('0x11e')](errors[0x194]);_0x164d74[_0x1461('0x11c')]('/*')[_0x1461('0x11e')](function(_0xdee6a4,_0x5852d0){_0x5852d0[_0x1461('0x11f')](path[_0x1461('0x120')](_0x164d74[_0x1461('0x11e')](_0x1461('0x121'))+_0x1461('0x122')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0ecf654..443ef7e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2b5=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.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','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x17c183,_0x4c648e){var _0x2b6782=function(_0x263e18){while(--_0x263e18){_0x17c183['push'](_0x17c183['shift']());}};_0x2b6782(++_0x4c648e);}(_0xd2b5,0x141));var _0x5d2b=function(_0x2f2aca,_0x56d541){_0x2f2aca=_0x2f2aca-0x0;var _0x18494b=_0xd2b5[_0x2f2aca];return _0x18494b;};'use strict';var jayson=require(_0x5d2b('0x0'));var BPromise=require(_0x5d2b('0x1'));var _=require(_0x5d2b('0x2'));var config=require(_0x5d2b('0x3'));exports[_0x5d2b('0x4')]=function(){return new BPromise(function(_0x60a851,_0x271350){var _0x1ed9c0={};_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x6')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/voiceExtension/voiceExtension.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x7')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x8')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x9')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0xa')));_0x1ed9c0=_['merge'](_0x1ed9c0,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0xb')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0xc')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0xd')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0xe')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0xf')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/mailServerIn/mailServerIn.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x10')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/mailQueue/mailQueue.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/mailInteraction/mailInteraction.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x11')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x12')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x13')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x14')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/faxApplication/faxApplication.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/faxInteraction/faxInteraction.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x15')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x16')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x17')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x18')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x19')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x1a')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x1b')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x1c')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x1d')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x1e')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x1f')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x20')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x21')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/chatMessage/chatMessage.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x22')));_0x1ed9c0=_['merge'](_0x1ed9c0,require('../api/cmContact/cmContact.rpc'));_0x1ed9c0=_['merge'](_0x1ed9c0,require('../api/cmHopper/cmHopper.rpc'));_0x1ed9c0=_['merge'](_0x1ed9c0,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x23')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x24')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x25')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x26')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/sound/sound.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/template/template.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x27')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/variable/variable.rpc'));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x28')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x29')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x2a')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x2b')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x2c')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x2d')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x2e')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x2f')));_0x1ed9c0=_['merge'](_0x1ed9c0,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x30')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x31')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/squareReport/squareReport.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x32')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x33')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x34')));_0x1ed9c0=_['merge'](_0x1ed9c0,require('../api/squareRecording/squareRecording.rpc'));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x35')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x36')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x37')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require('../api/plugin/plugin.rpc'));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x38')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x39')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x3a')));_0x1ed9c0=_[_0x5d2b('0x5')](_0x1ed9c0,require(_0x5d2b('0x3b')));_0x1ed9c0=_['merge'](_0x1ed9c0,require(_0x5d2b('0x3c')));var _0x5d9473=jayson['server'](_0x1ed9c0)[_0x5d2b('0x3d')]();var _0x5449b8=config[_0x5d2b('0x3e')][_0x5d2b('0x3f')]||config[_0x5d2b('0x3f')]+0x1;var _0x2a15a0=config['rpc']['ip']||_0x5d2b('0x40');_0x5d9473['on']('error',function(_0x594241){return _0x271350(_0x594241);});_0x5d9473[_0x5d2b('0x4')](_0x5449b8,_0x2a15a0,function(){console[_0x5d2b('0x41')](_0x5d2b('0x42'),_0x2a15a0,_0x5449b8);require(_0x5d2b('0x43'))[_0x5d2b('0x44')]();return _0x60a851(_0x5d2b('0x45')+_0x2a15a0+':'+_0x5449b8);});});}; \ No newline at end of file +var _0xef52=['../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','port','rpc','localhost','RPC\x20listening\x20on\x20','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0xef52,0xfc));var _0x2ef5=function(_0x5ce268,_0x1835b6){_0x5ce268=_0x5ce268-0x0;var _0x28c96a=_0xef52[_0x5ce268];return _0x28c96a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2ef5('0x0'));var _=require(_0x2ef5('0x1'));var config=require('../config/environment');exports[_0x2ef5('0x2')]=function(){return new BPromise(function(_0x297a33,_0xe03bab){var _0x846a67={};_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x4')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x5')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x6')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x7')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x8')));_0x846a67=_['merge'](_0x846a67,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x9')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0xa')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0xb')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/trunk/trunk.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0xc')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0xd')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/mailServerIn/mailServerIn.rpc'));_0x846a67=_['merge'](_0x846a67,require('../api/mailAccount/mailAccount.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/mailQueue/mailQueue.rpc'));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0xe')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/mailMessage/mailMessage.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/mailApplication/mailApplication.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0xf')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x10')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x11')));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x12')));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x13')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x14')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x15')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x16')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/smsMessage/smsMessage.rpc'));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x17')));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x18')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x19')));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x1a')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x1b')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x1c')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/chatMessage/chatMessage.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x1d')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x1e')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x1f')));_0x846a67=_['merge'](_0x846a67,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x20')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x21')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/interval/interval.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x22')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x23')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x24')));_0x846a67=_['merge'](_0x846a67,require('../api/trigger/trigger.rpc'));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x25')));_0x846a67=_['merge'](_0x846a67,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x846a67=_['merge'](_0x846a67,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x26')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x27')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x28')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x29')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x2a')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x2b')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x2c')));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x2d')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x2e')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x2f')));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x30')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/squareProject/squareProject.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/squareRecording/squareRecording.rpc'));_0x846a67=_['merge'](_0x846a67,require(_0x2ef5('0x31')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x32')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x33')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x34')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x35')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require(_0x2ef5('0x36')));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x846a67=_[_0x2ef5('0x3')](_0x846a67,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x39d229=jayson[_0x2ef5('0x37')](_0x846a67)['http']();var _0x21d6a2=config['rpc'][_0x2ef5('0x38')]||config['port']+0x1;var _0x58dfbc=config[_0x2ef5('0x39')]['ip']||_0x2ef5('0x3a');_0x39d229['on']('error',function(_0x4a13e2){return _0xe03bab(_0x4a13e2);});_0x39d229[_0x2ef5('0x2')](_0x21d6a2,_0x58dfbc,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x58dfbc,_0x21d6a2);require('../config/triggers')['default']();return _0x297a33(_0x2ef5('0x3b')+_0x58dfbc+':'+_0x21d6a2);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 224ce8b..e20d920 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x27ae0e,_0x38d538){var _0xd4a521=function(_0x39dbc2){while(--_0x39dbc2){_0x27ae0e['push'](_0x27ae0e['shift']());}};_0xd4a521(++_0x38d538);}(_0x70e0,0x17b));var _0x070e=function(_0x59a473,_0x34d8d9){_0x59a473=_0x59a473-0x0;var _0x567d7b=_0x70e0[_0x59a473];return _0x567d7b;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0xc6f890,_0x341952){var _0x32f5cf=function(_0x3c271f){while(--_0x3c271f){_0xc6f890['push'](_0xc6f890['shift']());}};_0x32f5cf(++_0x341952);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d2b2e94..a0069b9 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 _0x21d1=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.'];(function(_0x5d990e,_0x4ba9f5){var _0x36c763=function(_0x52270c){while(--_0x52270c){_0x5d990e['push'](_0x5d990e['shift']());}};_0x36c763(++_0x4ba9f5);}(_0x21d1,0x1c9));var _0x121d=function(_0x580fe7,_0x2080f2){_0x580fe7=_0x580fe7-0x0;var _0x5265a6=_0x21d1[_0x580fe7];return _0x5265a6;};'use strict';var util=require(_0x121d('0x0'));var error={'E_AGI_UNDEFINED':_0x121d('0x1'),'E_AGI_ARGUMENT_PORT':_0x121d('0x2'),'E_AGI_SERVER_ERROR':_0x121d('0x3'),'E_AGI_SERVER_CLOSE':_0x121d('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x121d('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x121d('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x121d('0x7'),'E_AGI_COMMAND_EMPTY':_0x121d('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x121d('0x9'),'E_AGI_IVR_ENTRY':_0x121d('0xa')};function AGIError(_0x4c47ee){var _0x4c47ee=_0x4c47ee||null,_0x2bd1e8=_0x2bd1e8||[],_0x47b50b=0x1,_0x2d4d7e='';if(!error[_0x4c47ee]){_0x4c47ee=_0x121d('0xb');}_0x2bd1e8[_0x121d('0xc')](error[_0x4c47ee]);while(arguments[_0x47b50b]){_0x2bd1e8[_0x121d('0xc')](arguments[_0x47b50b]);_0x47b50b++;}_0x2d4d7e=util[_0x121d('0xd')][_0x121d('0xe')](util,_0x2bd1e8);this[_0x121d('0xf')]=_0x2d4d7e;this['name']=_0x4c47ee;}module[_0x121d('0x10')]=AGIError; \ No newline at end of file +var _0x0a52=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x52071d,_0x1a6e5f){var _0x437165=function(_0x5272cd){while(--_0x5272cd){_0x52071d['push'](_0x52071d['shift']());}};_0x437165(++_0x1a6e5f);}(_0x0a52,0xe4));var _0x20a5=function(_0x3c0731,_0xe7cf5e){_0x3c0731=_0x3c0731-0x0;var _0x487ea7=_0x0a52[_0x3c0731];return _0x487ea7;};'use strict';var util=require(_0x20a5('0x0'));var error={'E_AGI_UNDEFINED':_0x20a5('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x20a5('0x2'),'E_AGI_SERVER_CLOSE':_0x20a5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x20a5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x20a5('0x5'),'E_AGI_SOCKET_CLOSE':_0x20a5('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x20a5('0x7'),'E_AGI_COMMAND_EMPTY':_0x20a5('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x20a5('0x9'),'E_AGI_IVR_ENTRY':_0x20a5('0xa')};function AGIError(_0x4acc66){var _0x4acc66=_0x4acc66||null,_0x39920b=_0x39920b||[],_0x1f44fd=0x1,_0x478779='';if(!error[_0x4acc66]){_0x4acc66=_0x20a5('0xb');}_0x39920b[_0x20a5('0xc')](error[_0x4acc66]);while(arguments[_0x1f44fd]){_0x39920b[_0x20a5('0xc')](arguments[_0x1f44fd]);_0x1f44fd++;}_0x478779=util[_0x20a5('0xd')]['apply'](util,_0x39920b);this[_0x20a5('0xe')]=_0x478779;this[_0x20a5('0xf')]=_0x4acc66;}module[_0x20a5('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 0d93eb8..08a4190 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 _0x4bde=['length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','push','numberOfEdges','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x2cbd75,_0x1bf0b5){_0x2cbd75=_0x2cbd75-0x0;var _0x3b7de0=_0x4bde[_0x2cbd75];return _0x3b7de0;};'use strict';var _=require(_0xe4bd('0x0'));var logger=require(_0xe4bd('0x1'))(_0xe4bd('0x2'));var verticesWithRetry=['menu',_0xe4bd('0x3'),_0xe4bd('0x4')];var Graph=function(){this[_0xe4bd('0x5')]={};this[_0xe4bd('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xe4bd('0x7')][_0xe4bd('0x8')]=function(_0x364f09){this[_0xe4bd('0x5')][_0x364f09['id']]=_0x364f09;this[_0xe4bd('0x6')][_0x364f09['id']]=[];};Graph[_0xe4bd('0x7')]['addEdge']=function(_0x2cf33d,_0xbd04ce,_0x262295){this[_0xe4bd('0x6')][_0x2cf33d][_0xe4bd('0x9')]({'target':_0xbd04ce,'condition':_0x262295});this[_0xe4bd('0xa')]+=0x1;};Graph['prototype']['size']=function(){return _['size'](this[_0xe4bd('0x5')]);};Graph[_0xe4bd('0x7')][_0xe4bd('0xb')]=function(){return this['numberOfEdges'];};Graph[_0xe4bd('0x7')][_0xe4bd('0xc')]=function(_0xea66e4){return this[_0xe4bd('0x5')][_0xea66e4];};Graph['prototype'][_0xe4bd('0xd')]=function(_0x5188e9,_0x44baa7){if(!this['vertices'][_0x5188e9]){return logger[_0xe4bd('0xe')](_0xe4bd('0xf'));}var _0x25b993=_0x44baa7(this[_0xe4bd('0x5')][_0x5188e9]);if(!_0x25b993){return logger[_0xe4bd('0xe')](_0xe4bd('0x10'));}if(this[_0xe4bd('0x6')][_0x5188e9][_0xe4bd('0x11')]===0x0){return logger[_0xe4bd('0xe')](_0xe4bd('0x12'));}for(var _0x355922=0x0,_0x4337f7=[],_0x470cd1=![];_0x355922\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','response','isUndefined','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','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/logger','agi','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','value','getSquareProject','then','createSquareReport','catch','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync'];(function(_0x487ea4,_0x1d8210){var _0x2f5ae1=function(_0x48dd14){while(--_0x48dd14){_0x487ea4['push'](_0x487ea4['shift']());}};_0x2f5ae1(++_0x1d8210);}(_0x2fed,0x7c));var _0xd2fe=function(_0x5b03ba,_0x422547){_0x5b03ba=_0x5b03ba-0x0;var _0x31f6ff=_0x2fed[_0x5b03ba];return _0x31f6ff;};'use strict';var parser=require(_0xd2fe('0x0'));var _=require(_0xd2fe('0x1'));var syncho=require(_0xd2fe('0x2'));var util=require(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var config=require('../../config/environment');var logger=require(_0xd2fe('0x5'))(_0xd2fe('0x6'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0xd2fe('0x7'));var Graph=require(_0xd2fe('0x8'));var Vertices=require(_0xd2fe('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xd2fe('0xa')](config[_0xd2fe('0x6')],{'ip':_0xd2fe('0xb'),'port':0x11dd});function connectionHandler(_0x42a8fb){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x42a8fb);agiHandler(_0x42a8fb);}catch(_0x1ab034){logger[_0xd2fe('0xc')](_0x1ab034[_0xd2fe('0xd')]);}});});}function listeningHandler(){console[_0xd2fe('0xe')](_0xd2fe('0xf'),config[_0xd2fe('0x6')][_0xd2fe('0x10')]);logger[_0xd2fe('0x11')](util[_0xd2fe('0x12')](_0xd2fe('0x13'),config[_0xd2fe('0x6')]['ip'],config[_0xd2fe('0x6')][_0xd2fe('0x10')]));}function errorHandler(_0x7017c8){if(_0x7017c8&&_0x7017c8[_0xd2fe('0x14')]&&_0x7017c8[_0xd2fe('0x15')]){logger[_0xd2fe('0xc')](util[_0xd2fe('0x12')]('[%s]\x20%s',_0x7017c8[_0xd2fe('0x14')],_0x7017c8[_0xd2fe('0x15')]));}else{logger[_0xd2fe('0xc')](util['format']('[ERROR]\x20%s',_0x7017c8['stack']));}}function closeHandler(){logger[_0xd2fe('0x11')](util['format'](_0xd2fe('0x16'),this[_0xd2fe('0x17')],this[_0xd2fe('0x18')],this[_0xd2fe('0x19')],this[_0xd2fe('0x1a')],this[_0xd2fe('0x1b')]));try{createSquareReport(this);}catch(_0x588d03){logger['error'](_0x588d03[_0xd2fe('0xd')]);}}function timeoutHandler(){logger[_0xd2fe('0x11')](util['format'](_0xd2fe('0x1c'),this[_0xd2fe('0x17')],this[_0xd2fe('0x18')],this[_0xd2fe('0x19')],this[_0xd2fe('0x1a')],this[_0xd2fe('0x1b')]));}function hangupHandler(){logger[_0xd2fe('0x11')](util[_0xd2fe('0x12')](_0xd2fe('0x1d'),this[_0xd2fe('0x17')],this['calleridname'],this[_0xd2fe('0x19')],this['dnid'],this[_0xd2fe('0x1b')]));this[_0xd2fe('0x1e')]=!![];}function getRoot(_0x123187){return parser[_0xd2fe('0x1f')](_0x123187,{'object':!![]})['mxGraphModel'][_0xd2fe('0x20')];}function addVertex(_0x574e6d,_0x39e7c,_0x39948a){_0x39e7c[_0xd2fe('0x21')]=_0x39948a;if(_0x39e7c['hasOwnProperty']('retry')){_0x39e7c[_0xd2fe('0x22')]=parseInt(_0x39e7c[_0xd2fe('0x23')],0xa);}_0x574e6d[_0xd2fe('0x24')](_[_0xd2fe('0x25')](_0x39e7c,_0xd2fe('0x26')));}function initGraph(_0x48f7ff,_0x487f8a){var _0x516340=new Graph();for(var _0x39e20a in _0x48f7ff){if(_0x48f7ff[_0xd2fe('0x27')](_0x39e20a)){if(_[_0xd2fe('0x28')](_0x48f7ff[_0x39e20a])){for(var _0x15d5bc=0x0;_0x15d5bc<_0x48f7ff[_0x39e20a]['length'];_0x15d5bc+=0x1){addVertex(_0x516340,_0x48f7ff[_0x39e20a][_0x15d5bc],_0x39e20a);}}else{addVertex(_0x516340,_0x48f7ff[_0x39e20a],_0x39e20a);}}}for(var _0x23682c=0x0;_0x23682c<_0x487f8a[_0xd2fe('0x29')];_0x23682c+=0x1){if(_0x487f8a[_0x23682c][_0xd2fe('0x2a')]&&_0x487f8a[_0x23682c][_0xd2fe('0x2b')]){_0x516340['addEdge'](_0x487f8a[_0x23682c][_0xd2fe('0x2a')],_0x487f8a[_0x23682c][_0xd2fe('0x2b')],_0x487f8a[_0x23682c][_0xd2fe('0x2c')]);}}return _0x516340;}function getSquareProject(_0x5a0ba4,_0x343a8b){rpc[_0xd2fe('0x2d')](_0x5a0ba4)[_0xd2fe('0x2e')](function(_0x21f2ac){_0x343a8b(null,_0x21f2ac);})['catch'](function(_0x1aebce){_0x343a8b(null,_0x1aebce);});}function createSquareReport(_0x328089,_0x11bea2){rpc[_0xd2fe('0x2f')](_0x328089)['then'](function(_0x36d50a){if(_0x11bea2){_0x11bea2(null,_0x36d50a);}})[_0xd2fe('0x30')](function(_0x1b4812){if(_0x11bea2){_0x11bea2(null,_0x1b4812);}});}function setChannelVariables(_0x425d1f){for(var _0x42c7b2 in _0x425d1f){if(_0x425d1f[_0xd2fe('0x27')](_0x42c7b2)){if(_0x42c7b2['indexOf'](_0xd2fe('0x31'))===0x0){_0x425d1f[_0x42c7b2[_0xd2fe('0x32')](0x4)]=_0x425d1f[_0x42c7b2];delete _0x425d1f[_0x42c7b2];}}}}function getLogFromObject(_0x56d8d7){return util[_0xd2fe('0x33')](_0x56d8d7,{'showHidden':![],'depth':null});}function agiHandler(_0x22fce7){var _0x29c5d1,_0x51cfa4,_0x4523e6,_0x13f01a,_0x53409a;logger[_0xd2fe('0x34')](_0xd2fe('0x35'),JSON[_0xd2fe('0x36')](_0x22fce7,null,0x2));logger[_0xd2fe('0x11')](util[_0xd2fe('0x12')](_0xd2fe('0x37'),_0x22fce7['arg_1'],_0x22fce7['calleridname'],_0x22fce7[_0xd2fe('0x19')],_0x22fce7['dnid'],_0x22fce7['uniqueid']));_0x22fce7['on'](_0xd2fe('0xc'),errorHandler);_0x22fce7['on'](_0xd2fe('0x38'),closeHandler);_0x22fce7['on'](_0xd2fe('0x39'),timeoutHandler);_0x22fce7[_0xd2fe('0x1e')]=![];_0x22fce7['on'](_0xd2fe('0x3a'),hangupHandler);var _0x4e0b4d=getSquareProject[_0xd2fe('0x3b')](null,_0x22fce7['arg_1']);if(_0x4e0b4d){if(_0x4e0b4d['production']){_0x29c5d1=getRoot(_0x4e0b4d[_0xd2fe('0x3c')]);if(_0x29c5d1&&_0x29c5d1[_0xd2fe('0x3d')]){logger[_0xd2fe('0x34')](_0xd2fe('0x20'),JSON[_0xd2fe('0x36')](_0x29c5d1,null,0x2));_0x22fce7[_0xd2fe('0x3e')]=moment()[_0xd2fe('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x51cfa4=initGraph(_[_0xd2fe('0x25')](_0x29c5d1,_0xd2fe('0x26')),_0x29c5d1[_0xd2fe('0x26')]);_0x4523e6=new Vertices(_0x22fce7,rpc,mailRpc);logger['info'](util['format'](_0xd2fe('0x3f'),_0x22fce7[_0xd2fe('0x17')],_0x22fce7[_0xd2fe('0x18')],_0x22fce7[_0xd2fe('0x19')],_0x22fce7[_0xd2fe('0x1a')],_0x22fce7[_0xd2fe('0x1b')]));_0x51cfa4[_0xd2fe('0x40')](_0x29c5d1['start']['id'],function(_0x2eb74f){try{_0x2eb74f=_0x4523e6[_0xd2fe('0x41')](_0x2eb74f);logger['debug'](_0xd2fe('0x42'),JSON[_0xd2fe('0x36')](_0x2eb74f,null,0x2));if(_0x2eb74f[_0xd2fe('0x21')]===_0xd2fe('0x43')){logger['info'](_0xd2fe('0x44'));_0x22fce7[_0xd2fe('0x45')]=_0x2eb74f[_0xd2fe('0x45')]||_0x22fce7[_0xd2fe('0x45')];_0x22fce7['extension']=_0x2eb74f[_0xd2fe('0x46')];_0x22fce7[_0xd2fe('0x47')]=_0x2eb74f[_0xd2fe('0x47')]?_0x2eb74f['priority']-0x1:0x1;return null;}else if(_0x2eb74f&&_0x4523e6[_0x2eb74f[_0xd2fe('0x21')]]){_0x53409a=_0x4523e6[_0x2eb74f[_0xd2fe('0x21')]](_0x2eb74f);logger[_0xd2fe('0x11')]('response',JSON[_0xd2fe('0x36')](_0x53409a,null,0x2));if(_0x53409a&&_0x53409a[_0xd2fe('0x48')]===AGI_CODE_SUCCESS&&_0x53409a['result']!==AGI_RESULT_ERROR&&!_0x22fce7['evtHangup']){logger['debug'](_0xd2fe('0x49'),getLogFromObject(_0x53409a));return _[_0xd2fe('0x4a')](_0x53409a['result'])?null:_0x53409a[_0xd2fe('0x4b')][_0xd2fe('0x4c')]();}else{logger[_0xd2fe('0xc')]('response',getLogFromObject(_0x53409a));return null;}}else{logger[_0xd2fe('0xc')](_0xd2fe('0x4d'));return null;}}catch(_0xe9791d){logger[_0xd2fe('0xc')](_0xe9791d[_0xd2fe('0xd')]);return null;}});if(_0x29c5d1[_0xd2fe('0x4e')]){logger[_0xd2fe('0x11')](util['format'](_0xd2fe('0x4f'),_0x22fce7[_0xd2fe('0x17')],_0x22fce7[_0xd2fe('0x18')],_0x22fce7[_0xd2fe('0x19')],_0x22fce7[_0xd2fe('0x1a')],_0x22fce7['uniqueid']));_0x51cfa4['traverseBFS'](_0x29c5d1[_0xd2fe('0x4e')]['id'],function(_0x3776cb){try{_0x3776cb=_0x4523e6[_0xd2fe('0x41')](_0x3776cb);logger['debug']('vertex',JSON[_0xd2fe('0x36')](_0x3776cb,null,0x2));if(_0x3776cb&&_0x4523e6[_0x3776cb[_0xd2fe('0x21')]]){_0x53409a=_0x4523e6[_0x3776cb[_0xd2fe('0x21')]](_0x3776cb);if(_0x53409a){logger[_0xd2fe('0x34')](_0xd2fe('0x49'),getLogFromObject(_0x53409a));return _[_0xd2fe('0x4a')](_0x53409a[_0xd2fe('0x4b')])?null:_0x53409a[_0xd2fe('0x4b')][_0xd2fe('0x4c')]();}else{logger[_0xd2fe('0xc')](_0xd2fe('0x49'),getLogFromObject(_0x53409a));return null;}}else{logger['error'](_0xd2fe('0x4d'));return null;}}catch(_0x18c099){logger[_0xd2fe('0xc')](_0x18c099['stack']);return null;}});}logger[_0xd2fe('0x11')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x22fce7[_0xd2fe('0x17')],_0x22fce7['calleridname'],_0x22fce7[_0xd2fe('0x19')],_0x22fce7['dnid'],_0x22fce7[_0xd2fe('0x1b')]));logger['info'](util[_0xd2fe('0x12')](_0xd2fe('0x50'),_0x22fce7['context'],_0x22fce7['extension'],parseInt(_0x22fce7[_0xd2fe('0x47')],0xa)+0x1));_0x22fce7[_0xd2fe('0x51')](_0x22fce7['context'],_0x22fce7[_0xd2fe('0x46')],parseInt(_0x22fce7[_0xd2fe('0x47')],0xa)+0x1);_0x22fce7[_0xd2fe('0x38')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x22fce7[_0xd2fe('0x17')]));_0x22fce7['continueAt'](_0x22fce7[_0xd2fe('0x45')],_0x22fce7[_0xd2fe('0x46')],parseInt(_0x22fce7[_0xd2fe('0x47')],0xa)+0x1);_0x22fce7[_0xd2fe('0x38')]();}}else{logger[_0xd2fe('0xc')](util['format'](_0xd2fe('0x52'),_0x22fce7[_0xd2fe('0x17')]));_0x22fce7['continueAt'](_0x22fce7[_0xd2fe('0x45')],_0x22fce7[_0xd2fe('0x46')],parseInt(_0x22fce7['priority'],0xa)+0x1);_0x22fce7[_0xd2fe('0x38')]();}}function main(){var _0x2510d4;return utilLicense[_0xd2fe('0x53')]()[_0xd2fe('0x2e')](function(_0x49608a){if(_0x49608a){if(_0x49608a['voice']){if(_0x49608a[_0xd2fe('0x54')]&&_0x49608a[_0xd2fe('0x54')]>0x0){logger[_0xd2fe('0x11')](util['format'](_0xd2fe('0x55'),_0x49608a['callysquare']));_0x2510d4=_0x49608a[_0xd2fe('0x54')];}else{logger['info'](_0xd2fe('0x56'));}}else{logger['info'](_0xd2fe('0x57'));_0x2510d4=-0x1;}}})[_0xd2fe('0x30')](function(_0x46d41c){logger['error'](_0xd2fe('0x58'),_0x46d41c['stack']);})[_0xd2fe('0x4e')](function(){var _0x28737c=require(_0xd2fe('0x59'))(config[_0xd2fe('0x6')]['port'],config[_0xd2fe('0x6')]['ip'],_0x2510d4);_0x28737c['on']('error',errorHandler);_0x28737c['on'](_0xd2fe('0x5a'),listeningHandler);_0x28737c['on'](_0xd2fe('0x5b'),connectionHandler);_0x28737c['on'](_0xd2fe('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x5089=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','YYYY-MM-DD\x20HH:mm:ss','omit','start','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','result','isUndefined','toString','finally','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','./rpc','./graph','./vertices','127.0.0.1','nextTick','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','root','agicommand','hasOwnProperty','retry','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','debug','variables'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5089,0x1bb));var _0x9508=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0x5089[_0x5b87ce];return _0x597aa7;};'use strict';var parser=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));var syncho=require('syncho');var util=require(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var config=require(_0x9508('0x4'));var logger=require(_0x9508('0x5'))(_0x9508('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9508('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x9508('0x8'));var Vertices=require(_0x9508('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9508('0x6')]=_['defaults'](config[_0x9508('0x6')],{'ip':_0x9508('0xa'),'port':0x11dd});function connectionHandler(_0x55a5de){process[_0x9508('0xb')](function(){syncho(function(){try{setChannelVariables(_0x55a5de);agiHandler(_0x55a5de);}catch(_0x338897){logger['error'](_0x338897[_0x9508('0xc')]);}});});}function listeningHandler(){console['log'](_0x9508('0xd'),config[_0x9508('0x6')][_0x9508('0xe')]);logger[_0x9508('0xf')](util[_0x9508('0x10')](_0x9508('0x11'),config['agi']['ip'],config[_0x9508('0x6')]['port']));}function errorHandler(_0x2c4fd9){if(_0x2c4fd9&&_0x2c4fd9[_0x9508('0x12')]&&_0x2c4fd9['message']){logger[_0x9508('0x13')](util[_0x9508('0x10')](_0x9508('0x14'),_0x2c4fd9[_0x9508('0x12')],_0x2c4fd9['message']));}else{logger[_0x9508('0x13')](util[_0x9508('0x10')]('[ERROR]\x20%s',_0x2c4fd9[_0x9508('0xc')]));}}function closeHandler(){logger['info'](util[_0x9508('0x10')](_0x9508('0x15'),this[_0x9508('0x16')],this[_0x9508('0x17')],this[_0x9508('0x18')],this[_0x9508('0x19')],this[_0x9508('0x1a')]));try{createSquareReport(this);}catch(_0x20df7d){logger['error'](_0x20df7d[_0x9508('0xc')]);}}function timeoutHandler(){logger[_0x9508('0xf')](util[_0x9508('0x10')](_0x9508('0x1b'),this[_0x9508('0x16')],this[_0x9508('0x17')],this['callerid'],this['dnid'],this[_0x9508('0x1a')]));}function hangupHandler(){logger['info'](util[_0x9508('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x9508('0x16')],this[_0x9508('0x17')],this[_0x9508('0x18')],this[_0x9508('0x19')],this[_0x9508('0x1a')]));this[_0x9508('0x1c')]=!![];}function getRoot(_0x20eb53){return parser['toJson'](_0x20eb53,{'object':!![]})['mxGraphModel'][_0x9508('0x1d')];}function addVertex(_0x1b70e6,_0x39e6b0,_0xf70830){_0x39e6b0[_0x9508('0x1e')]=_0xf70830;if(_0x39e6b0[_0x9508('0x1f')]('retry')){_0x39e6b0['maxRetry']=parseInt(_0x39e6b0[_0x9508('0x20')],0xa);}_0x1b70e6['addVertex'](_['omit'](_0x39e6b0,_0x9508('0x21')));}function initGraph(_0x576614,_0x5db4e1){var _0x1c9b3e=new Graph();for(var _0x30da92 in _0x576614){if(_0x576614['hasOwnProperty'](_0x30da92)){if(_[_0x9508('0x22')](_0x576614[_0x30da92])){for(var _0x32b0dd=0x0;_0x32b0dd<_0x576614[_0x30da92][_0x9508('0x23')];_0x32b0dd+=0x1){addVertex(_0x1c9b3e,_0x576614[_0x30da92][_0x32b0dd],_0x30da92);}}else{addVertex(_0x1c9b3e,_0x576614[_0x30da92],_0x30da92);}}}for(var _0x4529a8=0x0;_0x4529a8<_0x5db4e1[_0x9508('0x23')];_0x4529a8+=0x1){if(_0x5db4e1[_0x4529a8][_0x9508('0x24')]&&_0x5db4e1[_0x4529a8][_0x9508('0x25')]){_0x1c9b3e[_0x9508('0x26')](_0x5db4e1[_0x4529a8][_0x9508('0x24')],_0x5db4e1[_0x4529a8][_0x9508('0x25')],_0x5db4e1[_0x4529a8][_0x9508('0x27')]);}}return _0x1c9b3e;}function getSquareProject(_0x55f36c,_0x231f12){rpc[_0x9508('0x28')](_0x55f36c)[_0x9508('0x29')](function(_0x5853a2){_0x231f12(null,_0x5853a2);})[_0x9508('0x2a')](function(_0x38686a){_0x231f12(null,_0x38686a);});}function createSquareReport(_0x5e1d31,_0x3334d4){rpc[_0x9508('0x2b')](_0x5e1d31)['then'](function(_0x1bce4f){if(_0x3334d4){_0x3334d4(null,_0x1bce4f);}})[_0x9508('0x2a')](function(_0xb06b10){if(_0x3334d4){_0x3334d4(null,_0xb06b10);}});}function setChannelVariables(_0x36de9f){for(var _0x502bc6 in _0x36de9f){if(_0x36de9f['hasOwnProperty'](_0x502bc6)){if(_0x502bc6[_0x9508('0x2c')](_0x9508('0x2d'))===0x0){_0x36de9f[_0x502bc6[_0x9508('0x2e')](0x4)]=_0x36de9f[_0x502bc6];delete _0x36de9f[_0x502bc6];}}}}function getLogFromObject(_0x4bbc6f){return util['inspect'](_0x4bbc6f,{'showHidden':![],'depth':null});}function agiHandler(_0x301dd0){var _0x14be59,_0x29da35,_0x1633a4,_0xc4ae52,_0x3f86d4;logger[_0x9508('0x2f')](_0x9508('0x30'),JSON[_0x9508('0x31')](_0x301dd0,null,0x2));logger[_0x9508('0xf')](util['format'](_0x9508('0x32'),_0x301dd0[_0x9508('0x16')],_0x301dd0['calleridname'],_0x301dd0[_0x9508('0x18')],_0x301dd0[_0x9508('0x19')],_0x301dd0[_0x9508('0x1a')]));_0x301dd0['on'](_0x9508('0x13'),errorHandler);_0x301dd0['on'](_0x9508('0x33'),closeHandler);_0x301dd0['on'](_0x9508('0x34'),timeoutHandler);_0x301dd0[_0x9508('0x1c')]=![];_0x301dd0['on'](_0x9508('0x35'),hangupHandler);var _0xfb6676=getSquareProject[_0x9508('0x36')](null,_0x301dd0[_0x9508('0x16')]);if(_0xfb6676){if(_0xfb6676['production']){_0x14be59=getRoot(_0xfb6676[_0x9508('0x37')]);if(_0x14be59&&_0x14be59['start']){logger[_0x9508('0x2f')](_0x9508('0x1d'),JSON[_0x9508('0x31')](_0x14be59,null,0x2));_0x301dd0['joinAt']=moment()['format'](_0x9508('0x38'));_0x29da35=initGraph(_[_0x9508('0x39')](_0x14be59,_0x9508('0x21')),_0x14be59[_0x9508('0x21')]);_0x1633a4=new Vertices(_0x301dd0,rpc,mailRpc);logger['info'](util[_0x9508('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x301dd0[_0x9508('0x16')],_0x301dd0[_0x9508('0x17')],_0x301dd0['callerid'],_0x301dd0[_0x9508('0x19')],_0x301dd0[_0x9508('0x1a')]));_0x29da35['traverseBFS'](_0x14be59[_0x9508('0x3a')]['id'],function(_0x1e6851){try{_0x1e6851=_0x1633a4[_0x9508('0x3b')](_0x1e6851);logger[_0x9508('0x2f')]('vertex',JSON['stringify'](_0x1e6851,null,0x2));if(_0x1e6851[_0x9508('0x1e')]==='gotoc'){logger[_0x9508('0xf')](_0x9508('0x3c'));_0x301dd0[_0x9508('0x3d')]=_0x1e6851[_0x9508('0x3d')]||_0x301dd0['context'];_0x301dd0['extension']=_0x1e6851['extension'];_0x301dd0[_0x9508('0x3e')]=_0x1e6851['priority']?_0x1e6851[_0x9508('0x3e')]-0x1:0x1;return null;}else if(_0x1e6851&&_0x1633a4[_0x1e6851['agicommand']]){_0x3f86d4=_0x1633a4[_0x1e6851[_0x9508('0x1e')]](_0x1e6851);logger[_0x9508('0xf')](_0x9508('0x3f'),JSON[_0x9508('0x31')](_0x3f86d4,null,0x2));if(_0x3f86d4&&_0x3f86d4['code']===AGI_CODE_SUCCESS&&_0x3f86d4[_0x9508('0x40')]!==AGI_RESULT_ERROR&&!_0x301dd0[_0x9508('0x1c')]){logger[_0x9508('0x2f')]('response',getLogFromObject(_0x3f86d4));return _[_0x9508('0x41')](_0x3f86d4[_0x9508('0x40')])?null:_0x3f86d4['result'][_0x9508('0x42')]();}else{logger['error'](_0x9508('0x3f'),getLogFromObject(_0x3f86d4));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4194be){logger[_0x9508('0x13')](_0x4194be[_0x9508('0xc')]);return null;}});if(_0x14be59[_0x9508('0x43')]){logger[_0x9508('0xf')](util[_0x9508('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x301dd0[_0x9508('0x16')],_0x301dd0[_0x9508('0x17')],_0x301dd0[_0x9508('0x18')],_0x301dd0['dnid'],_0x301dd0[_0x9508('0x1a')]));_0x29da35[_0x9508('0x44')](_0x14be59[_0x9508('0x43')]['id'],function(_0x30fafd){try{_0x30fafd=_0x1633a4['clear'](_0x30fafd);logger[_0x9508('0x2f')]('vertex',JSON[_0x9508('0x31')](_0x30fafd,null,0x2));if(_0x30fafd&&_0x1633a4[_0x30fafd[_0x9508('0x1e')]]){_0x3f86d4=_0x1633a4[_0x30fafd['agicommand']](_0x30fafd);if(_0x3f86d4){logger[_0x9508('0x2f')](_0x9508('0x3f'),getLogFromObject(_0x3f86d4));return _['isUndefined'](_0x3f86d4[_0x9508('0x40')])?null:_0x3f86d4[_0x9508('0x40')]['toString']();}else{logger[_0x9508('0x13')]('response',getLogFromObject(_0x3f86d4));return null;}}else{logger[_0x9508('0x13')]('agicommand\x20not\x20found');return null;}}catch(_0x1e6c8c){logger['error'](_0x1e6c8c['stack']);return null;}});}logger['info'](util['format'](_0x9508('0x45'),_0x301dd0[_0x9508('0x16')],_0x301dd0[_0x9508('0x17')],_0x301dd0[_0x9508('0x18')],_0x301dd0[_0x9508('0x19')],_0x301dd0[_0x9508('0x1a')]));logger[_0x9508('0xf')](util[_0x9508('0x10')](_0x9508('0x46'),_0x301dd0['context'],_0x301dd0[_0x9508('0x47')],parseInt(_0x301dd0[_0x9508('0x3e')],0xa)+0x1));_0x301dd0[_0x9508('0x48')](_0x301dd0[_0x9508('0x3d')],_0x301dd0[_0x9508('0x47')],parseInt(_0x301dd0['priority'],0xa)+0x1);_0x301dd0['close']();}}else{logger[_0x9508('0x13')](util['format'](_0x9508('0x49'),_0x301dd0[_0x9508('0x16')]));_0x301dd0['continueAt'](_0x301dd0[_0x9508('0x3d')],_0x301dd0['extension'],parseInt(_0x301dd0['priority'],0xa)+0x1);_0x301dd0[_0x9508('0x33')]();}}else{logger[_0x9508('0x13')](util['format'](_0x9508('0x4a'),_0x301dd0[_0x9508('0x16')]));_0x301dd0[_0x9508('0x48')](_0x301dd0[_0x9508('0x3d')],_0x301dd0[_0x9508('0x47')],parseInt(_0x301dd0[_0x9508('0x3e')],0xa)+0x1);_0x301dd0[_0x9508('0x33')]();}}function main(){var _0x767549;return utilLicense[_0x9508('0x4b')]()[_0x9508('0x29')](function(_0x122934){if(_0x122934){if(_0x122934[_0x9508('0x4c')]){if(_0x122934[_0x9508('0x4d')]&&_0x122934[_0x9508('0x4d')]>0x0){logger['info'](util[_0x9508('0x10')](_0x9508('0x4e'),_0x122934['callysquare']));_0x767549=_0x122934[_0x9508('0x4d')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x9508('0xf')](_0x9508('0x4f'));_0x767549=-0x1;}}})['catch'](function(_0x199c2e){logger[_0x9508('0x13')]('[LICENSE]',_0x199c2e[_0x9508('0xc')]);})[_0x9508('0x43')](function(){var _0x279e31=require('./server')(config[_0x9508('0x6')][_0x9508('0xe')],config[_0x9508('0x6')]['ip'],_0x767549);_0x279e31['on'](_0x9508('0x13'),errorHandler);_0x279e31['on'](_0x9508('0x50'),listeningHandler);_0x279e31['on'](_0x9508('0x51'),connectionHandler);_0x279e31['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index b9f0c61..5075726 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1ecbb8,_0x30df1d){var _0x203659=function(_0x1fcd14){while(--_0x1fcd14){_0x1ecbb8['push'](_0x1ecbb8['shift']());}};_0x203659(++_0x30df1d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3c0cc9,_0x5269f9){var _0x472dc6=function(_0x172be1){while(--_0x172be1){_0x3c0cc9['push'](_0x3c0cc9['shift']());}};_0x472dc6(++_0x5269f9);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 198a8df..eb2c1cf 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 _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0xb10b,0x12a));var _0xbb10=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0xb10b[_0x1501e2];return _0xfce8c5;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x274a03,_0xa661ae){var _0x53b6dc=function(_0x29a5df){while(--_0x29a5df){_0x274a03['push'](_0x274a03['shift']());}};_0x53b6dc(++_0xa661ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d1322,_0x4f2786){_0x2d1322=_0x2d1322-0x0;var _0x33c165=_0x5f2f[_0x2d1322];return _0x33c165;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 65f870a..980d388 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 _0x7d60=['ShowSquareProject','production','getMailAccountById','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','result','catch','getSquareProject'];(function(_0x5e1bca,_0xa95e2b){var _0x44aed8=function(_0x31f682){while(--_0x31f682){_0x5e1bca['push'](_0x5e1bca['shift']());}};_0x44aed8(++_0xa95e2b);}(_0x7d60,0xd0));var _0x07d6=function(_0x2e6374,_0x2861b3){_0x2e6374=_0x2e6374-0x0;var _0x43a278=_0x7d60[_0x2e6374];return _0x43a278;};'use strict';var BPromise=require(_0x07d6('0x0'));var moment=require(_0x07d6('0x1'));var _=require(_0x07d6('0x2'));var util=require(_0x07d6('0x3'));var jayson=require(_0x07d6('0x4'));var client=jayson[_0x07d6('0x5')][_0x07d6('0x6')]({'port':0x2329});function request(_0x35c6f7,_0x357c6f){return new BPromise(function(_0x48c711,_0x4bf156){return client[_0x07d6('0x7')](_0x35c6f7,_0x357c6f)['then'](function(_0x1d70f9){if(_0x1d70f9[_0x07d6('0x8')]){return _0x4bf156(_0x1d70f9[_0x07d6('0x8')]['message']);}else{return _0x48c711(_0x1d70f9[_0x07d6('0x9')]);}})[_0x07d6('0xa')](function(_0xb986b0){return _0x4bf156(_0xb986b0);});});}exports[_0x07d6('0xb')]=function(_0x26fd8f){return request(_0x07d6('0xc'),{'options':{'raw':![],'where':{'name':_0x26fd8f},'attributes':[_0x07d6('0xd')]}});};exports[_0x07d6('0xe')]=function(_0x55531d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x55531d},'include':[{'model':'MailServerOut','as':_0x07d6('0xf')}],'attributes':['id',_0x07d6('0x10'),'email']}});};exports[_0x07d6('0x11')]=function(_0x1c0126){return request(_0x07d6('0xc'),{'options':{'where':{'id':_0x1c0126},'attributes':[_0x07d6('0x10')]}});};exports[_0x07d6('0x12')]=function(_0x404575){return request(_0x07d6('0x13'),{'options':{'where':{'id':_0x404575},'attributes':[_0x07d6('0x10')]}});};exports[_0x07d6('0x14')]=function(_0x4a492d){return request('ShowVariable',{'options':{'where':{'id':_0x4a492d},'attributes':[_0x07d6('0x10')]}});};exports[_0x07d6('0x15')]=function(_0x2761b6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2761b6},'attributes':[_0x07d6('0x16')]}});};exports[_0x07d6('0x17')]=function(_0x37fcde){return request('ShowUser',{'options':{'where':{'id':_0x37fcde},'attributes':[_0x07d6('0x10')]}});};exports[_0x07d6('0x18')]=function(_0x1fc5ae){return request(_0x07d6('0x19'),{'options':{'where':{'id':_0x1fc5ae},'attributes':[_0x07d6('0x10')]}});};exports[_0x07d6('0x1a')]=function(_0x1d4a73){return request('ShowSound',{'options':{'where':{'id':_0x1d4a73},'attributes':[_0x07d6('0x1b')]}});};exports['getIntervalById']=function(_0x484dc9){return request(_0x07d6('0x1c'),{'options':{'raw':![],'where':{'id':_0x484dc9},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x07d6('0x1d')]=function(_0x3e7a6c){return request(_0x07d6('0x1e'),{'options':{'where':{'id':_0x3e7a6c},'attributes':['id',_0x07d6('0x10')]}});};exports['createSmsMessage']=function(_0x16623d){return request(_0x07d6('0x1f'),{'body':_0x16623d});};exports[_0x07d6('0x20')]=function(_0x511008){return request(_0x07d6('0x21'),{'body':_0x511008});};exports[_0x07d6('0x22')]=function(_0x118016){return request(_0x07d6('0x23'),{'body':_[_0x07d6('0x24')](_0x118016,{'project_name':_0x118016[_0x07d6('0x25')],'prev_project_name':_0x118016[_0x07d6('0x26')]||'','is_subproject':_0x118016[_0x07d6('0x26')]?!![]:![],'leaveAt':moment()[_0x07d6('0x27')](_0x07d6('0x28'))})});};exports['createSquareRecording']=function(_0x3e1d77){return request(_0x07d6('0x29'),{'body':_0x3e1d77});};exports[_0x07d6('0x2a')]=function(_0x6e0589){return request(_0x07d6('0x2b'),{'body':_0x6e0589});};exports[_0x07d6('0x2c')]=function(_0x394e3a){return request(_0x07d6('0x2d'),{'options':{'raw':![],'where':{'phone':_0x394e3a['phone'],'ListId':_0x394e3a[_0x07d6('0x2e')]}}})[_0x07d6('0x2f')](function(_0x2605d6){if(_0x2605d6){return _0x2605d6;}return request(_0x07d6('0x30'),{'body':_0x394e3a});});};exports[_0x07d6('0x31')]=function(_0x3baec6){return request(_0x07d6('0x32'),{'options':{'where':{'id':_0x3baec6},'attributes':['name']}});};exports[_0x07d6('0x33')]=function(_0x4f40f4,_0x3da7c8){return request(_0x07d6('0x34'),{'body':{'interface':_0x3da7c8},'options':{'where':_0x4f40f4}});};exports['agentPause']=function(_0x510b71,_0x4e44a5,_0x25ad93){return request('PauseUser',{'body':{'type':_0x4e44a5,'uniqueid':_0x25ad93},'options':{'where':_0x510b71}});};exports['agentUnpause']=function(_0x2df223){return request(_0x07d6('0x35'),{'body':{},'options':{'where':_0x2df223}});};exports['agentLogout']=function(_0x3c84c6){return request(_0x07d6('0x36'),{'body':{},'options':{'where':_0x3c84c6}});}; \ No newline at end of file +var _0x093b=['createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','http','request','then','error','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getSquareOdbcById','dsn','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport'];(function(_0x1a28e2,_0x22d734){var _0x26e4bc=function(_0x4ee1e1){while(--_0x4ee1e1){_0x1a28e2['push'](_0x1a28e2['shift']());}};_0x26e4bc(++_0x22d734);}(_0x093b,0x80));var _0xb093=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0x093b[_0x28fbbf];return _0x543af6;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb093('0x0'));var _=require(_0xb093('0x1'));var util=require(_0xb093('0x2'));var jayson=require(_0xb093('0x3'));var client=jayson['client'][_0xb093('0x4')]({'port':0x2329});function request(_0x4f2c25,_0x577b71){return new BPromise(function(_0x14228f,_0x55d86a){return client[_0xb093('0x5')](_0x4f2c25,_0x577b71)[_0xb093('0x6')](function(_0x281993){if(_0x281993['error']){return _0x55d86a(_0x281993[_0xb093('0x7')][_0xb093('0x8')]);}else{return _0x14228f(_0x281993[_0xb093('0x9')]);}})['catch'](function(_0x2ab9d0){return _0x55d86a(_0x2ab9d0);});});}exports[_0xb093('0xa')]=function(_0x1df3df){return request(_0xb093('0xb'),{'options':{'raw':![],'where':{'name':_0x1df3df},'attributes':['production']}});};exports[_0xb093('0xc')]=function(_0x87ab10){return request(_0xb093('0xd'),{'options':{'raw':![],'where':{'id':_0x87ab10},'include':[{'model':'MailServerOut','as':_0xb093('0xe')}],'attributes':['id',_0xb093('0xf'),_0xb093('0x10')]}});};exports[_0xb093('0x11')]=function(_0x54f2ff){return request(_0xb093('0xb'),{'options':{'where':{'id':_0x54f2ff},'attributes':[_0xb093('0xf')]}});};exports[_0xb093('0x12')]=function(_0xade436){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xade436},'attributes':[_0xb093('0xf')]}});};exports['getVariableById']=function(_0x99d25a){return request('ShowVariable',{'options':{'where':{'id':_0x99d25a},'attributes':[_0xb093('0xf')]}});};exports[_0xb093('0x13')]=function(_0x36f345){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x36f345},'attributes':[_0xb093('0x14')]}});};exports['getUserById']=function(_0x2a5b26){return request('ShowUser',{'options':{'where':{'id':_0x2a5b26},'attributes':[_0xb093('0xf')]}});};exports[_0xb093('0x15')]=function(_0x54aefc){return request(_0xb093('0x16'),{'options':{'where':{'id':_0x54aefc},'attributes':[_0xb093('0xf')]}});};exports['getSoundById']=function(_0x286ad9){return request(_0xb093('0x17'),{'options':{'where':{'id':_0x286ad9},'attributes':[_0xb093('0x18')]}});};exports[_0xb093('0x19')]=function(_0x1d36b9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1d36b9},'include':[{'model':_0xb093('0x1a'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x55ff11){return request(_0xb093('0x1b'),{'options':{'where':{'id':_0x55ff11},'attributes':['id',_0xb093('0xf')]}});};exports[_0xb093('0x1c')]=function(_0x251a9a){return request(_0xb093('0x1d'),{'body':_0x251a9a});};exports[_0xb093('0x1e')]=function(_0x236570){return request('CreateSquareDetailsReport',{'body':_0x236570});};exports[_0xb093('0x1f')]=function(_0x15507c){return request(_0xb093('0x20'),{'body':_[_0xb093('0x21')](_0x15507c,{'project_name':_0x15507c[_0xb093('0x22')],'prev_project_name':_0x15507c[_0xb093('0x23')]||'','is_subproject':_0x15507c['arg_2']?!![]:![],'leaveAt':moment()[_0xb093('0x24')](_0xb093('0x25'))})});};exports['createSquareRecording']=function(_0x5f14a2){return request(_0xb093('0x26'),{'body':_0x5f14a2});};exports['createSquareMessage']=function(_0x146aa7){return request(_0xb093('0x27'),{'body':_0x146aa7});};exports[_0xb093('0x28')]=function(_0x16dffa){return request(_0xb093('0x29'),{'options':{'raw':![],'where':{'phone':_0x16dffa[_0xb093('0x2a')],'ListId':_0x16dffa[_0xb093('0x2b')]}}})['then'](function(_0x23041e){if(_0x23041e){return _0x23041e;}return request(_0xb093('0x2c'),{'body':_0x16dffa});});};exports['getPauseById']=function(_0x4c8df3){return request(_0xb093('0x2d'),{'options':{'where':{'id':_0x4c8df3},'attributes':['name']}});};exports['agentLogin']=function(_0x13b98e,_0x181b66){return request(_0xb093('0x2e'),{'body':{'interface':_0x181b66},'options':{'where':_0x13b98e}});};exports[_0xb093('0x2f')]=function(_0x3bdb17,_0x526177,_0x114658){return request(_0xb093('0x30'),{'body':{'type':_0x526177,'uniqueid':_0x114658},'options':{'where':_0x3bdb17}});};exports[_0xb093('0x31')]=function(_0x1a62c6){return request(_0xb093('0x32'),{'body':{},'options':{'where':_0x1a62c6}});};exports[_0xb093('0x33')]=function(_0x2c9ee5){return request(_0xb093('0x34'),{'body':{},'options':{'where':_0x2c9ee5}});}; \ 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 e5abd61..340851d 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 _0xb469=['./polly','./lex','exports'];(function(_0x368a66,_0x2c33e5){var _0xa47513=function(_0x1432d3){while(--_0x1432d3){_0x368a66['push'](_0x368a66['shift']());}};_0xa47513(++_0x2c33e5);}(_0xb469,0x13b));var _0x9b46=function(_0x242308,_0x42c249){_0x242308=_0x242308-0x0;var _0x3cf03b=_0xb469[_0x242308];return _0x3cf03b;};var polly=require(_0x9b46('0x0'));var lex=require(_0x9b46('0x1'));module[_0x9b46('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4ea3=['exports','./polly','./lex'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};var polly=require(_0x34ea('0x0'));var lex=require(_0x34ea('0x1'));module[_0x34ea('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 9bacaa7..edf00fa 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 _0x13c0=['exports','./lib/api'];(function(_0xd2d514,_0x1f4176){var _0x4d0ff3=function(_0x21e426){while(--_0x21e426){_0xd2d514['push'](_0xd2d514['shift']());}};_0x4d0ff3(++_0x1f4176);}(_0x13c0,0x79));var _0x013c=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x13c0[_0x1abb09];return _0xea1c07;};'use strict';var lex=require(_0x013c('0x0'));module[_0x013c('0x1')]=function(_0x112e3c,_0x27895b,_0x5b4348,_0x4fb1ff,_0x5b8e8e,_0x17ae19){return lex(_0x112e3c,_0x27895b,_0x5b4348,_0x4fb1ff,_0x5b8e8e,_0x17ae19);}; \ No newline at end of file +var _0x34e8=['./lib/api','exports'];(function(_0x52af14,_0x450fa2){var _0x5068b0=function(_0x18a797){while(--_0x18a797){_0x52af14['push'](_0x52af14['shift']());}};_0x5068b0(++_0x450fa2);}(_0x34e8,0x12c));var _0x834e=function(_0x37c33a,_0x3d428e){_0x37c33a=_0x37c33a-0x0;var _0x1488c7=_0x34e8[_0x37c33a];return _0x1488c7;};'use strict';var lex=require(_0x834e('0x0'));module[_0x834e('0x1')]=function(_0x8b339,_0x35e6fb,_0x530939,_0x832422,_0x21e2e0,_0x472111){return lex(_0x8b339,_0x35e6fb,_0x530939,_0x832422,_0x21e2e0,_0x472111);}; \ 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 c295dda..da8f718 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 _0x3a18=['postText','slots','hasOwnProperty','LexRuntime','bluebird'];(function(_0x487962,_0x33d062){var _0x23fac1=function(_0x1ff063){while(--_0x1ff063){_0x487962['push'](_0x487962['shift']());}};_0x23fac1(++_0x33d062);}(_0x3a18,0xc7));var _0x83a1=function(_0x1f2c8d,_0x4fbf33){_0x1f2c8d=_0x1f2c8d-0x0;var _0x3f71fa=_0x3a18[_0x1f2c8d];return _0x3f71fa;};'use strict';var BPromise=require(_0x83a1('0x0'));var AWS=require('aws-sdk');function lexResult(_0x2a9638,_0x29eaa4){return new BPromise(function(_0x59d77f,_0x558eac){_0x2a9638[_0x83a1('0x1')](_0x29eaa4,function(_0xf79479,_0x51d268){if(_0xf79479){_0x558eac(_0xf79479);}if(_0x51d268['slots']){for(const _0x2ef877 in _0x51d268[_0x83a1('0x2')]){if(_0x51d268[_0x83a1('0x2')][_0x83a1('0x3')](_0x2ef877)){var _0x2ee469=_0x51d268[_0x83a1('0x2')][_0x2ef877];_0x51d268['slot_'+_0x2ef877]=_0x2ee469;}}}_0x59d77f(_0x51d268);});});}module['exports']=function(_0xbdf6b2,_0x286a5f,_0x444dca,_0xf3a738,_0x40b687,_0x46cc48){var _0x3f2cbe=new AWS[(_0x83a1('0x4'))]({'accessKeyId':_0x286a5f,'secretAccessKey':_0x444dca,'region':_0xf3a738});var _0x4f7f8e={'botAlias':'$LATEST','botName':_0x46cc48,'inputText':_0x40b687,'userId':_0xbdf6b2};return lexResult(_0x3f2cbe,_0x4f7f8e);}; \ No newline at end of file +var _0xc662=['slots','hasOwnProperty','slot_','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc662,0xf0));var _0x2c66=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xc662[_0x134c2e];return _0x2825db;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x53e11f,_0x3265f1){return new BPromise(function(_0x4921df,_0x23768d){_0x53e11f['postText'](_0x3265f1,function(_0x45a53c,_0x49adcc){if(_0x45a53c){_0x23768d(_0x45a53c);}if(_0x49adcc[_0x2c66('0x0')]){for(const _0x484086 in _0x49adcc[_0x2c66('0x0')]){if(_0x49adcc['slots'][_0x2c66('0x1')](_0x484086)){var _0x199164=_0x49adcc[_0x2c66('0x0')][_0x484086];_0x49adcc[_0x2c66('0x2')+_0x484086]=_0x199164;}}}_0x4921df(_0x49adcc);});});}module[_0x2c66('0x3')]=function(_0x2f98f9,_0x5a95ec,_0x1fc6a6,_0x337ab5,_0x576a4d,_0xc6ac6a){var _0x46ebc3=new AWS['LexRuntime']({'accessKeyId':_0x5a95ec,'secretAccessKey':_0x1fc6a6,'region':_0x337ab5});var _0x4caabf={'botAlias':'$LATEST','botName':_0xc6ac6a,'inputText':_0x576a4d,'userId':_0x2f98f9};return lexResult(_0x46ebc3,_0x4caabf);}; \ 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 48c7968..cd9d6a5 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 _0xc211=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc211,0x119));var _0x1c21=function(_0xb1d7d7,_0x1cb3fe){_0xb1d7d7=_0xb1d7d7-0x0;var _0x3cb210=_0xc211[_0xb1d7d7];return _0x3cb210;};'use strict';var polly=require(_0x1c21('0x0'));module[_0x1c21('0x1')]=function(_0x1a29ae,_0x290c3a,_0x1273ac,_0x448405,_0xfd30bf,_0x49a8a6,_0x4dc25b){return polly(_0x1a29ae,_0x290c3a,_0x1273ac,_0x448405,_0xfd30bf,_0x49a8a6,_0x4dc25b);}; \ No newline at end of file +var _0x9729=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9729,0xce));var _0x9972=function(_0x378610,_0x5b1762){_0x378610=_0x378610-0x0;var _0x589299=_0x9729[_0x378610];return _0x589299;};'use strict';var polly=require(_0x9972('0x0'));module['exports']=function(_0x255911,_0x53ec3f,_0x4f198b,_0x3781be,_0x6fcc50,_0x22afdc,_0x1a40f9){return polly(_0x255911,_0x53ec3f,_0x4f198b,_0x3781be,_0x6fcc50,_0x22afdc,_0x1a40f9);}; \ 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 1625fba..9125407 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 _0x8756=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','bluebird'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x8756,0xba));var _0x6875=function(_0x1ecb13,_0x18d5fd){_0x1ecb13=_0x1ecb13-0x0;var _0x52fd29=_0x8756[_0x1ecb13];return _0x52fd29;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x6875('0x0'));var rs=require(_0x6875('0x1'));var AWS=require(_0x6875('0x2'));function pollyResult(_0x323f52,_0x23ff61,_0x35d6a3){return new BPromise(function(_0x1256fb,_0x4d2090){_0x323f52[_0x6875('0x3')](_0x23ff61,function(_0x1523df,_0x2621d8){if(_0x1523df){_0x4d2090(_0x1523df);}else if(_0x2621d8){if(_0x2621d8[_0x6875('0x4')]instanceof Buffer){fs[_0x6875('0x5')](_0x35d6a3,_0x2621d8[_0x6875('0x4')],function(_0x28c934){if(_0x28c934){_0x4d2090(_0x28c934);}else{_0x1256fb();}});}else{_0x4d2090(new Error(_0x6875('0x6')));}}else{_0x4d2090(new Error(_0x6875('0x7')));}});});}module['exports']=function(_0x46ad3c,_0x70be40,_0xb38fd,_0x18ba6d,_0x5dab84,_0x3e4b3b,_0x5bf442){var _0x2434c1=new AWS[(_0x6875('0x8'))]({'accessKeyId':_0x46ad3c,'secretAccessKey':_0x70be40,'region':_0xb38fd});var _0x1227a2={'Text':_0x5dab84,'TextType':_0x3e4b3b||_0x6875('0x9'),'OutputFormat':_0x6875('0xa'),'VoiceId':_0x18ba6d};return pollyResult(_0x2434c1,_0x1227a2,_0x5bf442);}; \ No newline at end of file +var _0x357b=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x357b,0x108));var _0xb357=function(_0x1022e1,_0x13299d){_0x1022e1=_0x1022e1-0x0;var _0x2e9379=_0x357b[_0x1022e1];return _0x2e9379;};'use strict';var fs=require('fs');var path=require(_0xb357('0x0'));var BPromise=require(_0xb357('0x1'));var rs=require(_0xb357('0x2'));var AWS=require(_0xb357('0x3'));function pollyResult(_0x4a606b,_0x26523d,_0x5dc112){return new BPromise(function(_0x38c624,_0xbd4989){_0x4a606b[_0xb357('0x4')](_0x26523d,function(_0x4bfacb,_0x5b4544){if(_0x4bfacb){_0xbd4989(_0x4bfacb);}else if(_0x5b4544){if(_0x5b4544['AudioStream']instanceof Buffer){fs[_0xb357('0x5')](_0x5dc112,_0x5b4544[_0xb357('0x6')],function(_0x1f108a){if(_0x1f108a){_0xbd4989(_0x1f108a);}else{_0x38c624();}});}else{_0xbd4989(new Error(_0xb357('0x7')));}}else{_0xbd4989(new Error(_0xb357('0x8')));}});});}module[_0xb357('0x9')]=function(_0x307b4e,_0x4272c4,_0xe748b6,_0x2de335,_0x447dca,_0x27dd20,_0x482334){var _0x24c532=new AWS[(_0xb357('0xa'))]({'accessKeyId':_0x307b4e,'secretAccessKey':_0x4272c4,'region':_0xe748b6});var _0x55bae4={'Text':_0x447dca,'TextType':_0x27dd20||_0xb357('0xb'),'OutputFormat':'mp3','VoiceId':_0x2de335};return pollyResult(_0x24c532,_0x55bae4,_0x482334);}; \ 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 fd04e45..a4c269d 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 _0x3141=['./lib/api'];(function(_0x4c483b,_0x49da9a){var _0x1139f0=function(_0xb3705e){while(--_0xb3705e){_0x4c483b['push'](_0x4c483b['shift']());}};_0x1139f0(++_0x49da9a);}(_0x3141,0x8a));var _0x1314=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3141[_0x59ee6f];return _0x4c0979;};'use strict';var asr=require(_0x1314('0x0'));module['exports']=function(_0x40153b,_0x316c06,_0x126dd,_0x3f6af2){return asr(_0x40153b,_0x316c06,_0x126dd);}; \ No newline at end of file +var _0x805d=['exports','./lib/api'];(function(_0x4855ce,_0x3fbf65){var _0x150377=function(_0x21555b){while(--_0x21555b){_0x4855ce['push'](_0x4855ce['shift']());}};_0x150377(++_0x3fbf65);}(_0x805d,0x7f));var _0xd805=function(_0x5a8a32,_0x672f96){_0x5a8a32=_0x5a8a32-0x0;var _0x1c9ae9=_0x805d[_0x5a8a32];return _0x1c9ae9;};'use strict';var asr=require(_0xd805('0x0'));module[_0xd805('0x1')]=function(_0x18fb97,_0x42998c,_0x2a8889,_0x294c95){return asr(_0x18fb97,_0x42998c,_0x2a8889);}; \ 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 7526eb5..ce453bb 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 _0x70ff=['bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key=','8000','url'];(function(_0x200d26,_0x5d0c88){var _0x1fc541=function(_0x4224c1){while(--_0x4224c1){_0x200d26['push'](_0x200d26['shift']());}};_0x1fc541(++_0x5d0c88);}(_0x70ff,0x12b));var _0xf70f=function(_0x3060e3,_0x14f2c6){_0x3060e3=_0x3060e3-0x0;var _0x497d2c=_0x70ff[_0x3060e3];return _0x497d2c;};'use strict';var url=require(_0xf70f('0x0'));var BPromise=require(_0xf70f('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf70f('0x2')]=function(_0x28baa8,_0x11c4be,_0x3122b0){return new BPromise(function(_0x4bfbaa,_0xcc1b7c){var _0x5b1b4e;if(typeof _0x28baa8!==_0xf70f('0x3')||_0x28baa8[_0xf70f('0x4')]===0x0){return _0xcc1b7c(_0xf70f('0x5'));}if(typeof _0x11c4be!==_0xf70f('0x3')||_0x11c4be[_0xf70f('0x4')]===0x0){return _0xcc1b7c(_0xf70f('0x6'));}if(typeof _0x3122b0!=='undefined'&&(typeof _0x3122b0!=='string'||_0x3122b0[_0xf70f('0x4')]===0x0)){return _0xcc1b7c('lang\x20should\x20be\x20a\x20string');}try{_0x5b1b4e=fs['readFileSync'](_0x28baa8)['toString'](_0xf70f('0x7'));}catch(_0x56c8a3){return _0xcc1b7c(_0x56c8a3);}return _0x4bfbaa({'method':'POST','uri':host+_0xf70f('0x8')+_0x11c4be,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf70f('0x9'),'languageCode':_0x3122b0},'audio':{'content':_0x5b1b4e}},'json':!![]});});}; \ No newline at end of file +var _0x473a=['bluebird','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','url'];(function(_0x4fb9aa,_0x42f0a2){var _0x1a600e=function(_0x2818b3){while(--_0x2818b3){_0x4fb9aa['push'](_0x4fb9aa['shift']());}};_0x1a600e(++_0x42f0a2);}(_0x473a,0x8f));var _0xa473=function(_0x3d48db,_0x2e77af){_0x3d48db=_0x3d48db-0x0;var _0x2be514=_0x473a[_0x3d48db];return _0x2be514;};'use strict';var url=require(_0xa473('0x0'));var BPromise=require(_0xa473('0x1'));var fs=require('fs');var host=_0xa473('0x2');module['exports']=function(_0xe2cb94,_0x349a99,_0x1f6978){return new BPromise(function(_0x278760,_0x4b3b95){var _0x1be1f7;if(typeof _0xe2cb94!==_0xa473('0x3')||_0xe2cb94['length']===0x0){return _0x4b3b95('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x349a99!=='string'||_0x349a99[_0xa473('0x4')]===0x0){return _0x4b3b95(_0xa473('0x5'));}if(typeof _0x1f6978!==_0xa473('0x6')&&(typeof _0x1f6978!=='string'||_0x1f6978[_0xa473('0x4')]===0x0)){return _0x4b3b95(_0xa473('0x7'));}try{_0x1be1f7=fs[_0xa473('0x8')](_0xe2cb94)[_0xa473('0x9')](_0xa473('0xa'));}catch(_0x8ca04d){return _0x4b3b95(_0x8ca04d);}return _0x278760({'method':'POST','uri':host+_0xa473('0xb')+_0x349a99,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x1f6978},'audio':{'content':_0x1be1f7}},'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 2fe9081..b1e8113 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 _0xf76d=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf76d,0xc1));var _0xdf76=function(_0x22ccc0,_0x914457){_0x22ccc0=_0x22ccc0-0x0;var _0xe2af6a=_0xf76d[_0x22ccc0];return _0xe2af6a;};var asr=require('./asr');module[_0xdf76('0x0')]={'asr':asr}; \ No newline at end of file +var _0xb22d=['./asr'];(function(_0x32fdfb,_0x6c08d2){var _0x1d03e1=function(_0xf8815b){while(--_0xf8815b){_0x32fdfb['push'](_0x32fdfb['shift']());}};_0x1d03e1(++_0x6c08d2);}(_0xb22d,0x75));var _0xdb22=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xb22d[_0xfd9b19];return _0x514918;};var asr=require(_0xdb22('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index b629d3e..f00f4bb 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 _0xb25c=['./aws','./tilde','./sestek','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','error\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','from','info','googleCloudTTS\x20path','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','stringify','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','audiofile','path','http','https','url','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb25c,0x137));var _0xcb25=function(_0xef33ce,_0xcf290c){_0xef33ce=_0xef33ce-0x0;var _0x2bfe08=_0xb25c[_0xef33ce];return _0x2bfe08;};'use strict';var fs=require('fs');var path=require(_0xcb25('0x0'));var http=require(_0xcb25('0x1'));var https=require(_0xcb25('0x2'));var urlParse=require(_0xcb25('0x3'))['parse'];var BPromise=require('bluebird');var rs=require(_0xcb25('0x4'));var sox=require(_0xcb25('0x5'));var rp=require(_0xcb25('0x6'));var util=require(_0xcb25('0x7'));var querystring=require(_0xcb25('0x8'));var tts=require(_0xcb25('0x9'));var apiai=require(_0xcb25('0xa'));var md5=require(_0xcb25('0xb'));var google=require(_0xcb25('0xc'));var aws=require(_0xcb25('0xd'));var tilde=require(_0xcb25('0xe'));var sestek=require(_0xcb25('0xf'));var logger=require('../../../config/logger')(_0xcb25('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4ab728,_0x5542f3){return new BPromise(function(_0x445141,_0x396bce){var _0x7c2208=urlParse(_0x4ab728);var _0xc6ada3=_0x7c2208[_0xcb25('0x11')]===_0xcb25('0x12')?https:http;var _0x1f69d4={'host':_0x7c2208[_0xcb25('0x13')],'path':_0x7c2208[_0xcb25('0x0')],'headers':{'user-agent':_0xcb25('0x14')}};_0xc6ada3[_0xcb25('0x15')](_0x1f69d4,function(_0x9c8cca){if(_0x9c8cca[_0xcb25('0x16')]!==0xc8){logger[_0xcb25('0x17')](_0xcb25('0x18')+_0x4ab728+_0xcb25('0x19')+_0x9c8cca[_0xcb25('0x16')]+'\x20('+_0x9c8cca[_0xcb25('0x1a')]+')');_0x396bce(new Error(_0xcb25('0x18')+_0x4ab728+_0xcb25('0x19')+_0x9c8cca[_0xcb25('0x16')]+'\x20('+_0x9c8cca[_0xcb25('0x1a')]+')'));return;}var _0x40bce3=fs[_0xcb25('0x1b')](_0x5542f3);_0x40bce3['on'](_0xcb25('0x1c'),function(){logger['info'](_0xcb25('0x1d'));_0x40bce3[_0xcb25('0x1e')](_0x445141);});_0x40bce3['on'](_0xcb25('0x17'),function(_0x4392e7){fs[_0xcb25('0x1f')](_0x5542f3);logger[_0xcb25('0x17')](_0xcb25('0x20'),_0x4392e7);_0x396bce(_0x4392e7);});_0x9c8cca[_0xcb25('0x21')](_0x40bce3);})['on']('error',function(_0x4f566){logger[_0xcb25('0x17')](_0x4f566);_0x396bce(_0x4f566);})[_0xcb25('0x22')]();});}function uploadFile(_0x18426a){return new BPromise(function(_0x31552f,_0x59f9b9){var _0x47b236=urlParse(_0x18426a);var _0x569111=_0x47b236[_0xcb25('0x11')]===_0xcb25('0x12')?https:http;var _0x265953={'host':_0x47b236[_0xcb25('0x13')],'path':_0x47b236[_0xcb25('0x0')],'headers':{'user-agent':_0xcb25('0x14')}};_0x569111['get'](_0x265953,function(_0x13ba15){if(_0x13ba15[_0xcb25('0x16')]!==0xc8){_0x59f9b9(new Error(_0xcb25('0x18')+_0x18426a+_0xcb25('0x19')+_0x13ba15['statusCode']+'\x20('+_0x13ba15[_0xcb25('0x1a')]+')'));return;}var _0x3be234='';_0x13ba15['on']('data',function(_0x4e50f6){_0x3be234+=_0x4e50f6;});_0x13ba15['on'](_0xcb25('0x22'),function(){_0x31552f(_0x3be234);});})['on']('error',function(_0x326b69){_0x59f9b9(_0x326b69);})[_0xcb25('0x22')]();});}function convertFile(_0xb803e,_0x43c3cb){return new BPromise(function(_0x479880,_0x58b3e6){var _0x1c37b0=sox[_0xcb25('0x23')](_0xb803e,_0x43c3cb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c37b0['on'](_0xcb25('0x17'),function(_0x5d617c){logger[_0xcb25('0x17')](_0xcb25('0x24'),_0x5d617c);_0x58b3e6(_0x5d617c);});_0x1c37b0['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x479880();});_0x1c37b0[_0xcb25('0x25')]();});}function base64Decode(_0x26d79e,_0x75d921){var _0x2ce438=path['resolve'](__dirname,_0xcb25('0x26'),rs[_0xcb25('0x27')](0x4)+_0xcb25('0x28'));fs[_0xcb25('0x29')](_0x2ce438,_0x26d79e,_0xcb25('0x2a'));return convertFile(_0x2ce438,_0x75d921)[_0xcb25('0x2b')](function(){try{fs['unlink'](_0x2ce438);fs[_0xcb25('0x2c')](_0x75d921,_0xcb25('0x2d'));}catch(_0x27d473){logger['error'](_0x27d473);}return _0x75d921[_0xcb25('0x2e')]('.')[0x0];});}function base64Encode(_0x26cee4){var _0x216556=fs[_0xcb25('0x2f')](_0x26cee4);return new Buffer(_0x216556)[_0xcb25('0x30')](_0xcb25('0x2a'));}exports['googleCloudTTS']=function(_0x46aa11,_0x479fe7,_0x18ba83,_0x138c5e,_0x5f3a9f,_0x4f9bf0){var _0x13691f,_0x1e384d;var _0x2ddfe7=_0xcb25('0x31');var _0x470e77=_0xcb25('0x32')+_0x46aa11;var _0xd65a8c={};if(_0x479fe7===_0xcb25('0x33')){_0xd65a8c[_0xcb25('0x34')]={'ssml':_0x18ba83};}else{_0xd65a8c[_0xcb25('0x34')]={'text':_0x18ba83};};_0xd65a8c[_0xcb25('0x35')]={'languageCode':_0x138c5e,'ssmlGender':_0x5f3a9f};_0xd65a8c[_0xcb25('0x36')]={'audioEncoding':_0xcb25('0x37'),'sampleRateHertz':0x1f40};var _0x424a90={'url':_0x2ddfe7+_0xcb25('0x38')+_0x470e77,'method':_0xcb25('0x39'),'json':!![],'body':_0xd65a8c};return rp(_0x424a90)[_0xcb25('0x2b')](function(_0x137e3d){return new BPromise(function(_0x3608b3,_0x40bf6f){_0x13691f=path[_0xcb25('0x3a')](__dirname,_0xcb25('0x26'),rs['generate'](0x4)+'.mp3');var _0x52d0a1=Buffer[_0xcb25('0x3b')](_0x137e3d['audioContent'],_0xcb25('0x2a'));return fs['writeFile'](_0x13691f,_0x52d0a1,function(_0x264f7a){_0x40bf6f(_0x264f7a);},function(_0xd7dde2){fs['chmodSync'](_0x13691f,_0xcb25('0x2d'));_0x3608b3(_0xd7dde2);});});})[_0xcb25('0x2b')](function(_0x46098a){_0x1e384d=path[_0xcb25('0x3a')](__dirname,_0xcb25('0x26'),rs['generate'](0x4)+_0xcb25('0x28'));return convertFile(_0x13691f,_0x1e384d);})['then'](function(){try{fs['unlink'](_0x13691f);fs[_0xcb25('0x2c')](_0x1e384d,_0xcb25('0x2d'));}catch(_0x16f4e2){logger[_0xcb25('0x17')](_0x16f4e2);}logger[_0xcb25('0x3c')](_0xcb25('0x3d'),_0x1e384d[_0xcb25('0x2e')]('.')[0x0]);return _0x1e384d[_0xcb25('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x4c16e1,_0x16cdf4){var _0x214217,_0x39a2f1;return tts(_0x4c16e1,_0x16cdf4||'en',0x1)['then'](function(_0x33bd65){logger[_0xcb25('0x3c')](_0x33bd65);_0x214217=path[_0xcb25('0x3a')](__dirname,_0xcb25('0x26'),rs['generate'](0x4)+_0xcb25('0x3e'));return downloadFile(_0x33bd65,_0x214217);})['then'](function(){_0x39a2f1=path['resolve'](__dirname,_0xcb25('0x26'),rs[_0xcb25('0x27')](0x4)+_0xcb25('0x28'));return convertFile(_0x214217,_0x39a2f1);})[_0xcb25('0x2b')](function(){try{fs[_0xcb25('0x1f')](_0x214217);fs['chmodSync'](_0x39a2f1,'777');}catch(_0x4ae057){logger[_0xcb25('0x17')](_0x4ae057);}logger[_0xcb25('0x3c')](_0xcb25('0x3f'),_0x39a2f1[_0xcb25('0x2e')]('.')[0x0]);return _0x39a2f1['split']('.')[0x0];});};exports[_0xcb25('0x40')]=function(_0x4681fe,_0x1d9c32,_0x44e179){return google[_0xcb25('0x41')](_0x4681fe,_0x1d9c32,_0x44e179)[_0xcb25('0x2b')](function(_0x2e307a){logger[_0xcb25('0x3c')](_0x2e307a[_0xcb25('0x42')]);return rp(_0x2e307a);})[_0xcb25('0x2b')](function(_0x2f3990){var _0x1dfc5a='';var _0x379ad6=0x0;try{fs[_0xcb25('0x1f')](_0x4681fe);}catch(_0x29f2d7){logger[_0xcb25('0x17')](_0x29f2d7);}if(_0x2f3990&&_0x2f3990['results']){_0x1dfc5a=_0x2f3990[_0xcb25('0x43')][_0xcb25('0x44')](function(_0xf1ad40){return _0xf1ad40&&_0xf1ad40[_0xcb25('0x45')][0x0]&&_0xf1ad40[_0xcb25('0x45')][0x0][_0xcb25('0x46')]?_0xf1ad40[_0xcb25('0x45')][0x0][_0xcb25('0x46')]:'';})[_0xcb25('0x47')]('\x0a');_0x379ad6=_0x2f3990[_0xcb25('0x43')][_0xcb25('0x44')](function(_0x1506d7){return _0x1506d7&&_0x1506d7[_0xcb25('0x45')][0x0]&&_0x1506d7['alternatives'][0x0][_0xcb25('0x48')]?_0x1506d7[_0xcb25('0x45')][0x0][_0xcb25('0x48')]:0x0;})[_0xcb25('0x47')]('\x0a');}logger['info'](_0xcb25('0x49'),_0x1dfc5a);logger[_0xcb25('0x3c')](_0xcb25('0x4a'),_0x379ad6);return{'transcript':_0x1dfc5a,'confidence':_0x379ad6};})['catch'](function(_0x200d45){logger[_0xcb25('0x17')]('[%s]\x20%s:%s',_0x200d45[_0xcb25('0x16')],_0x200d45[_0xcb25('0x4b')],_0x200d45[_0xcb25('0x4c')]);});};exports['googleDialogflow']=function(_0x21e175,_0x4a789c,_0x587354,_0x3eb1fa){var _0x5ab988=apiai(_0x4a789c,{'language':_0x3eb1fa||'en'});return _0x5ab988['textRequest'](_0x587354,{'sessionId':md5(_0x21e175)})[_0xcb25('0x2b')](function(_0x184fff){logger[_0xcb25('0x3c')](JSON['stringify'](_0x184fff));return{'source':_0x184fff[_0xcb25('0x4d')][_0xcb25('0x4e')],'resolvedQuery':_0x184fff[_0xcb25('0x4d')]['resolvedQuery'],'action':_0x184fff[_0xcb25('0x4d')][_0xcb25('0x4f')],'actionIncomplete':_0x184fff['result'][_0xcb25('0x50')],'speech':_0x184fff[_0xcb25('0x4d')][_0xcb25('0x51')][_0xcb25('0x52')],'score':_0x184fff[_0xcb25('0x4d')][_0xcb25('0x53')],'statusCode':_0x184fff[_0xcb25('0x54')][_0xcb25('0x55')],'endConversation':_0x184fff[_0xcb25('0x4d')][_0xcb25('0x56')][_0xcb25('0x57')]||![],'isFallbackIntent':_0x184fff['result'][_0xcb25('0x56')]['isFallbackIntent']};});};exports[_0xcb25('0x58')]=function(_0x1370ba,_0x276d44,_0x2f4a12,_0x64ea8d){return tilde['asr'](_0x1370ba,_0x276d44,_0x2f4a12,_0x64ea8d)[_0xcb25('0x2b')](function(_0x463635){try{fs['unlink'](_0x1370ba);}catch(_0x12130a){logger[_0xcb25('0x17')](_0x12130a);}logger[_0xcb25('0x3c')](_0xcb25('0x59'),_0x463635['transcript']);logger['info'](_0xcb25('0x5a'),_0x463635['confidence']);return _0x463635;});};exports[_0xcb25('0x5b')]=function(_0x3cdf28,_0x566ab3,_0x5de1b7,_0x5a3a3e,_0x14afdf,_0x12e79b){var _0x33d7a9=path[_0xcb25('0x3a')](__dirname,'tmp',rs[_0xcb25('0x27')](0x4)+'.mp3');var _0xe07e3f;return aws['polly'](_0x3cdf28,_0x566ab3,_0x5de1b7,_0x5a3a3e,_0x14afdf,_0x12e79b,_0x33d7a9)['then'](function(){_0xe07e3f=path['resolve'](__dirname,_0xcb25('0x26'),rs[_0xcb25('0x27')](0x4)+_0xcb25('0x28'));return convertFile(_0x33d7a9,_0xe07e3f);})['then'](function(){try{fs[_0xcb25('0x1f')](_0x33d7a9);fs['chmodSync'](_0xe07e3f,'777');}catch(_0x264d30){logger[_0xcb25('0x17')](_0x264d30);}return _0xe07e3f[_0xcb25('0x2e')]('.')[0x0];});};exports[_0xcb25('0x5c')]=function(_0xd39dc5,_0x1b1146,_0x537ebb,_0xea40a6,_0x36c813,_0x1ce663){return aws[_0xcb25('0x5d')](_0xd39dc5,_0x1b1146,_0x537ebb,_0xea40a6,_0x36c813,_0x1ce663)[_0xcb25('0x2b')](function(_0x59791e){logger[_0xcb25('0x3c')](JSON[_0xcb25('0x5e')](_0x59791e));return _0x59791e;});};exports[_0xcb25('0x5f')]=function(_0x739d22,_0x1027dc,_0x44c798,_0x40e23c){var _0x4624d4=util[_0xcb25('0x60')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x739d22,encodeURIComponent(_0x1027dc),_0x44c798,_0x40e23c);var _0x3f9179=path['resolve'](__dirname,_0xcb25('0x26'),rs['generate'](0x4)+_0xcb25('0x3e'));var _0x537029;return downloadFile(_0x4624d4,_0x3f9179)[_0xcb25('0x2b')](function(){_0x537029=path[_0xcb25('0x3a')](__dirname,_0xcb25('0x26'),rs[_0xcb25('0x27')](0x4)+'.wav');return convertFile(_0x3f9179,_0x537029);})[_0xcb25('0x2b')](function(){try{fs[_0xcb25('0x1f')](_0x3f9179);fs[_0xcb25('0x2c')](_0x537029,_0xcb25('0x2d'));}catch(_0x119e61){logger[_0xcb25('0x17')](_0x119e61);}return _0x537029['split']('.')[0x0];});};exports['ispeechASR']=function(_0x2240cb,_0x2785a0,_0x471d97,_0x4d79d8){var _0x27a0cf=util['format'](_0xcb25('0x61'),ISPEECH_API,_0x2785a0,_0x471d97,base64Encode(_0x2240cb),_0x4d79d8?util[_0xcb25('0x60')](_0xcb25('0x62'),encodeURIComponent(_0x4d79d8)):_0xcb25('0x63'));return uploadFile(_0x27a0cf)[_0xcb25('0x2b')](function(_0x439d74){return querystring[_0xcb25('0x64')](_0x439d74);});};exports[_0xcb25('0x65')]=function(_0x46a2b1,_0x266de3){return sestek[_0xcb25('0x66')](_0x46a2b1,_0x266de3)[_0xcb25('0x2b')](function(_0x1af032){logger[_0xcb25('0x3c')](JSON[_0xcb25('0x5e')](_0x1af032));var _0x421500={'speech':_0x1af032[_0xcb25('0x67')],'action':_0x1af032[_0xcb25('0x68')]?_0x1af032[_0xcb25('0x68')][_0xcb25('0x69')]:undefined,'actiondata':_0x1af032[_0xcb25('0x68')]?_0x1af032[_0xcb25('0x68')]['CustomActionData']:undefined};if(_0x1af032[_0xcb25('0x68')]&&_0x1af032[_0xcb25('0x68')][_0xcb25('0x6a')]){return base64Decode(_0x1af032[_0xcb25('0x68')][_0xcb25('0x6a')]['Data'],path[_0xcb25('0x3a')](__dirname,_0xcb25('0x26'),rs[_0xcb25('0x27')](0x4)+_0xcb25('0x28')))[_0xcb25('0x2b')](function(_0x379852){_0x421500[_0xcb25('0x6b')]=_0x379852;return _0x421500;});}return _0x421500;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x5d3b=['request-promise','util','querystring','google-tts-api','md5','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','close','unlink','pipe','end','protocol','get','statusCode','transcode','wav','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','audioContent','writeFile','googleTTS','.mp3','goggleTTS\x20path','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','stringify','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','AudioFromTts','path','http','bluebird','sox'];(function(_0x15de61,_0x23027e){var _0x58896c=function(_0x1307a9){while(--_0x1307a9){_0x15de61['push'](_0x15de61['shift']());}};_0x58896c(++_0x23027e);}(_0x5d3b,0x184));var _0xb5d3=function(_0x4e57ae,_0x18fd92){_0x4e57ae=_0x4e57ae-0x0;var _0xe22f92=_0x5d3b[_0x4e57ae];return _0xe22f92;};'use strict';var fs=require('fs');var path=require(_0xb5d3('0x0'));var http=require(_0xb5d3('0x1'));var https=require('https');var urlParse=require('url')['parse'];var BPromise=require(_0xb5d3('0x2'));var rs=require('randomstring');var sox=require(_0xb5d3('0x3'));var rp=require(_0xb5d3('0x4'));var util=require(_0xb5d3('0x5'));var querystring=require(_0xb5d3('0x6'));var tts=require(_0xb5d3('0x7'));var apiai=require('apiai-promise');var md5=require(_0xb5d3('0x8'));var google=require('./google');var aws=require(_0xb5d3('0x9'));var tilde=require('./tilde');var sestek=require(_0xb5d3('0xa'));var logger=require(_0xb5d3('0xb'))(_0xb5d3('0xc'));var ISPEECH_API=_0xb5d3('0xd');function downloadFile(_0x3c0796,_0x3c5433){return new BPromise(function(_0x30d4a3,_0x2cc20e){var _0x5d8539=urlParse(_0x3c0796);var _0x345957=_0x5d8539['protocol']===_0xb5d3('0xe')?https:http;var _0x17997e={'host':_0x5d8539[_0xb5d3('0xf')],'path':_0x5d8539[_0xb5d3('0x0')],'headers':{'user-agent':_0xb5d3('0x10')}};_0x345957['get'](_0x17997e,function(_0x5a92b5){if(_0x5a92b5['statusCode']!==0xc8){logger[_0xb5d3('0x11')](_0xb5d3('0x12')+_0x3c0796+_0xb5d3('0x13')+_0x5a92b5['statusCode']+'\x20('+_0x5a92b5[_0xb5d3('0x14')]+')');_0x2cc20e(new Error(_0xb5d3('0x12')+_0x3c0796+'\x20failed,\x20status\x20code\x20=\x20'+_0x5a92b5['statusCode']+'\x20('+_0x5a92b5[_0xb5d3('0x14')]+')'));return;}var _0x3874e2=fs[_0xb5d3('0x15')](_0x3c5433);_0x3874e2['on']('finish',function(){logger['info'](_0xb5d3('0x16'));_0x3874e2[_0xb5d3('0x17')](_0x30d4a3);});_0x3874e2['on'](_0xb5d3('0x11'),function(_0x5596aa){fs[_0xb5d3('0x18')](_0x3c5433);logger[_0xb5d3('0x11')]('download\x20error',_0x5596aa);_0x2cc20e(_0x5596aa);});_0x5a92b5[_0xb5d3('0x19')](_0x3874e2);})['on'](_0xb5d3('0x11'),function(_0x486f5b){logger[_0xb5d3('0x11')](_0x486f5b);_0x2cc20e(_0x486f5b);})[_0xb5d3('0x1a')]();});}function uploadFile(_0x1b9be2){return new BPromise(function(_0x243681,_0x595562){var _0x36cf9f=urlParse(_0x1b9be2);var _0x2c0373=_0x36cf9f[_0xb5d3('0x1b')]===_0xb5d3('0xe')?https:http;var _0x190e03={'host':_0x36cf9f['host'],'path':_0x36cf9f['path'],'headers':{'user-agent':_0xb5d3('0x10')}};_0x2c0373[_0xb5d3('0x1c')](_0x190e03,function(_0x31179d){if(_0x31179d[_0xb5d3('0x1d')]!==0xc8){_0x595562(new Error(_0xb5d3('0x12')+_0x1b9be2+_0xb5d3('0x13')+_0x31179d['statusCode']+'\x20('+_0x31179d['statusMessage']+')'));return;}var _0x4f86fa='';_0x31179d['on']('data',function(_0x52fc06){_0x4f86fa+=_0x52fc06;});_0x31179d['on'](_0xb5d3('0x1a'),function(){_0x243681(_0x4f86fa);});})['on'](_0xb5d3('0x11'),function(_0x20f945){_0x595562(_0x20f945);})[_0xb5d3('0x1a')]();});}function convertFile(_0x30d32f,_0x2bdc02){return new BPromise(function(_0x106d4a,_0x32831e){var _0x293aa2=sox[_0xb5d3('0x1e')](_0x30d32f,_0x2bdc02,{'sampleRate':0x1f40,'format':_0xb5d3('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x293aa2['on'](_0xb5d3('0x11'),function(_0x46f6e3){logger[_0xb5d3('0x11')]('error\x20convert',_0x46f6e3);_0x32831e(_0x46f6e3);});_0x293aa2['on'](_0xb5d3('0x1a'),function(){logger[_0xb5d3('0x20')](_0xb5d3('0x21'));_0x106d4a();});_0x293aa2['start']();});}function base64Decode(_0x41d773,_0x543d5b){var _0x3e504b=path[_0xb5d3('0x22')](__dirname,_0xb5d3('0x23'),rs[_0xb5d3('0x24')](0x4)+_0xb5d3('0x25'));fs['writeFileSync'](_0x3e504b,_0x41d773,'base64');return convertFile(_0x3e504b,_0x543d5b)[_0xb5d3('0x26')](function(){try{fs['unlink'](_0x3e504b);fs[_0xb5d3('0x27')](_0x543d5b,_0xb5d3('0x28'));}catch(_0x15332d){logger[_0xb5d3('0x11')](_0x15332d);}return _0x543d5b[_0xb5d3('0x29')]('.')[0x0];});}function base64Encode(_0x32bba6){var _0x26fb49=fs[_0xb5d3('0x2a')](_0x32bba6);return new Buffer(_0x26fb49)[_0xb5d3('0x2b')](_0xb5d3('0x2c'));}exports[_0xb5d3('0x2d')]=function(_0x56df43,_0x41a1d8,_0x1e90b3,_0x2dffeb,_0x1f2d44,_0x194789){var _0x1559e6,_0x5c42dc;var _0x112460=_0xb5d3('0x2e');var _0x3c5e5c=_0xb5d3('0x2f')+_0x56df43;var _0x3ad80c={};if(_0x41a1d8===_0xb5d3('0x30')){_0x3ad80c[_0xb5d3('0x31')]={'ssml':_0x1e90b3};}else{_0x3ad80c['input']={'text':_0x1e90b3};};_0x3ad80c[_0xb5d3('0x32')]={'languageCode':_0x2dffeb,'ssmlGender':_0x1f2d44};_0x3ad80c['audioConfig']={'audioEncoding':_0xb5d3('0x33'),'sampleRateHertz':0x1f40};var _0x19a505={'url':_0x112460+_0xb5d3('0x34')+_0x3c5e5c,'method':'POST','json':!![],'body':_0x3ad80c};return rp(_0x19a505)[_0xb5d3('0x26')](function(_0x35c0e9){return new BPromise(function(_0xff0bda,_0x4eb037){_0x1559e6=path['resolve'](__dirname,_0xb5d3('0x23'),rs[_0xb5d3('0x24')](0x4)+'.mp3');var _0x2bb1fb=Buffer['from'](_0x35c0e9[_0xb5d3('0x35')],_0xb5d3('0x2c'));return fs[_0xb5d3('0x36')](_0x1559e6,_0x2bb1fb,function(_0x1ef326){_0x4eb037(_0x1ef326);},function(_0x599905){fs['chmodSync'](_0x1559e6,'777');_0xff0bda(_0x599905);});});})[_0xb5d3('0x26')](function(_0x2fde32){_0x5c42dc=path[_0xb5d3('0x22')](__dirname,_0xb5d3('0x23'),rs[_0xb5d3('0x24')](0x4)+_0xb5d3('0x25'));return convertFile(_0x1559e6,_0x5c42dc);})[_0xb5d3('0x26')](function(){try{fs[_0xb5d3('0x18')](_0x1559e6);fs['chmodSync'](_0x5c42dc,_0xb5d3('0x28'));}catch(_0x1402f8){logger[_0xb5d3('0x11')](_0x1402f8);}logger[_0xb5d3('0x20')]('googleCloudTTS\x20path',_0x5c42dc[_0xb5d3('0x29')]('.')[0x0]);return _0x5c42dc[_0xb5d3('0x29')]('.')[0x0];});};exports[_0xb5d3('0x37')]=function(_0x504ef5,_0x21d558){var _0x2aadaa,_0x391140;return tts(_0x504ef5,_0x21d558||'en',0x1)[_0xb5d3('0x26')](function(_0x1b4384){logger['info'](_0x1b4384);_0x2aadaa=path['resolve'](__dirname,_0xb5d3('0x23'),rs['generate'](0x4)+_0xb5d3('0x38'));return downloadFile(_0x1b4384,_0x2aadaa);})[_0xb5d3('0x26')](function(){_0x391140=path['resolve'](__dirname,_0xb5d3('0x23'),rs['generate'](0x4)+'.wav');return convertFile(_0x2aadaa,_0x391140);})[_0xb5d3('0x26')](function(){try{fs[_0xb5d3('0x18')](_0x2aadaa);fs[_0xb5d3('0x27')](_0x391140,'777');}catch(_0x59ca39){logger[_0xb5d3('0x11')](_0x59ca39);}logger[_0xb5d3('0x20')](_0xb5d3('0x39'),_0x391140[_0xb5d3('0x29')]('.')[0x0]);return _0x391140[_0xb5d3('0x29')]('.')[0x0];});};exports['googleASR']=function(_0x2dad21,_0x11aab4,_0x51a892){return google[_0xb5d3('0x3a')](_0x2dad21,_0x11aab4,_0x51a892)['then'](function(_0x119cab){logger[_0xb5d3('0x20')](_0x119cab[_0xb5d3('0x3b')]);return rp(_0x119cab);})[_0xb5d3('0x26')](function(_0x203fcf){var _0x10f13b='';var _0x298f64=0x0;try{fs[_0xb5d3('0x18')](_0x2dad21);}catch(_0x9f3d34){logger[_0xb5d3('0x11')](_0x9f3d34);}if(_0x203fcf&&_0x203fcf['results']){_0x10f13b=_0x203fcf[_0xb5d3('0x3c')]['map'](function(_0x1d6d9d){return _0x1d6d9d&&_0x1d6d9d[_0xb5d3('0x3d')][0x0]&&_0x1d6d9d[_0xb5d3('0x3d')][0x0][_0xb5d3('0x3e')]?_0x1d6d9d['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x298f64=_0x203fcf['results'][_0xb5d3('0x3f')](function(_0x5e38b4){return _0x5e38b4&&_0x5e38b4[_0xb5d3('0x3d')][0x0]&&_0x5e38b4[_0xb5d3('0x3d')][0x0][_0xb5d3('0x40')]?_0x5e38b4[_0xb5d3('0x3d')][0x0][_0xb5d3('0x40')]:0x0;})[_0xb5d3('0x41')]('\x0a');}logger[_0xb5d3('0x20')](_0xb5d3('0x42'),_0x10f13b);logger['info'](_0xb5d3('0x43'),_0x298f64);return{'transcript':_0x10f13b,'confidence':_0x298f64};})[_0xb5d3('0x44')](function(_0x3bf470){logger['error'](_0xb5d3('0x45'),_0x3bf470[_0xb5d3('0x1d')],_0x3bf470['name'],_0x3bf470['message']);});};exports[_0xb5d3('0x46')]=function(_0x41c51b,_0x9cb090,_0x30585e,_0x9d1b20){var _0x2f372b=apiai(_0x9cb090,{'language':_0x9d1b20||'en'});return _0x2f372b['textRequest'](_0x30585e,{'sessionId':md5(_0x41c51b)})[_0xb5d3('0x26')](function(_0x2804b9){logger[_0xb5d3('0x20')](JSON[_0xb5d3('0x47')](_0x2804b9));return{'source':_0x2804b9[_0xb5d3('0x48')]['source'],'resolvedQuery':_0x2804b9[_0xb5d3('0x48')]['resolvedQuery'],'action':_0x2804b9[_0xb5d3('0x48')][_0xb5d3('0x49')],'actionIncomplete':_0x2804b9[_0xb5d3('0x48')][_0xb5d3('0x4a')],'speech':_0x2804b9[_0xb5d3('0x48')][_0xb5d3('0x4b')][_0xb5d3('0x4c')],'score':_0x2804b9['result'][_0xb5d3('0x4d')],'statusCode':_0x2804b9['status'][_0xb5d3('0x4e')],'endConversation':_0x2804b9[_0xb5d3('0x48')][_0xb5d3('0x4f')][_0xb5d3('0x50')]||![],'isFallbackIntent':_0x2804b9[_0xb5d3('0x48')]['metadata'][_0xb5d3('0x51')]};});};exports['tildeASR']=function(_0x2da5eb,_0x13a1df,_0x58bb69,_0x6d06ee){return tilde[_0xb5d3('0x3a')](_0x2da5eb,_0x13a1df,_0x58bb69,_0x6d06ee)[_0xb5d3('0x26')](function(_0x18af49){try{fs[_0xb5d3('0x18')](_0x2da5eb);}catch(_0x39ff39){logger[_0xb5d3('0x11')](_0x39ff39);}logger['info'](_0xb5d3('0x52'),_0x18af49[_0xb5d3('0x3e')]);logger[_0xb5d3('0x20')](_0xb5d3('0x53'),_0x18af49[_0xb5d3('0x40')]);return _0x18af49;});};exports['awsPolly']=function(_0x483c98,_0x143113,_0x5ef9a3,_0x9b066c,_0x20465b,_0x27ce72){var _0x2bb725=path[_0xb5d3('0x22')](__dirname,_0xb5d3('0x23'),rs[_0xb5d3('0x24')](0x4)+_0xb5d3('0x38'));var _0xb5a9b3;return aws[_0xb5d3('0x54')](_0x483c98,_0x143113,_0x5ef9a3,_0x9b066c,_0x20465b,_0x27ce72,_0x2bb725)[_0xb5d3('0x26')](function(){_0xb5a9b3=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x2bb725,_0xb5a9b3);})[_0xb5d3('0x26')](function(){try{fs[_0xb5d3('0x18')](_0x2bb725);fs[_0xb5d3('0x27')](_0xb5a9b3,_0xb5d3('0x28'));}catch(_0x1e75f7){logger[_0xb5d3('0x11')](_0x1e75f7);}return _0xb5a9b3[_0xb5d3('0x29')]('.')[0x0];});};exports[_0xb5d3('0x55')]=function(_0x366fc2,_0x41c5bb,_0x254b33,_0x5cacde,_0x1e1119,_0x30dcf0){return aws[_0xb5d3('0x56')](_0x366fc2,_0x41c5bb,_0x254b33,_0x5cacde,_0x1e1119,_0x30dcf0)[_0xb5d3('0x26')](function(_0x27932d){logger[_0xb5d3('0x20')](JSON[_0xb5d3('0x47')](_0x27932d));return _0x27932d;});};exports[_0xb5d3('0x57')]=function(_0x5a5b02,_0xa67835,_0x251435,_0x1720a8){var _0x561507=util[_0xb5d3('0x58')](_0xb5d3('0x59'),ISPEECH_API,_0x5a5b02,encodeURIComponent(_0xa67835),_0x251435,_0x1720a8);var _0x6ddcc9=path[_0xb5d3('0x22')](__dirname,_0xb5d3('0x23'),rs['generate'](0x4)+_0xb5d3('0x38'));var _0x580c21;return downloadFile(_0x561507,_0x6ddcc9)[_0xb5d3('0x26')](function(){_0x580c21=path[_0xb5d3('0x22')](__dirname,'tmp',rs[_0xb5d3('0x24')](0x4)+_0xb5d3('0x25'));return convertFile(_0x6ddcc9,_0x580c21);})[_0xb5d3('0x26')](function(){try{fs[_0xb5d3('0x18')](_0x6ddcc9);fs[_0xb5d3('0x27')](_0x580c21,_0xb5d3('0x28'));}catch(_0x32d642){logger[_0xb5d3('0x11')](_0x32d642);}return _0x580c21[_0xb5d3('0x29')]('.')[0x0];});};exports['ispeechASR']=function(_0x739be7,_0x1c7828,_0x1ec1de,_0x5b9747){var _0x2ecf3e=util[_0xb5d3('0x58')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c7828,_0x1ec1de,base64Encode(_0x739be7),_0x5b9747?util[_0xb5d3('0x58')](_0xb5d3('0x5a'),encodeURIComponent(_0x5b9747)):_0xb5d3('0x5b'));return uploadFile(_0x2ecf3e)['then'](function(_0x510aa6){return querystring[_0xb5d3('0x5c')](_0x510aa6);});};exports[_0xb5d3('0x5d')]=function(_0x5ce333,_0x3a85d2){return sestek[_0xb5d3('0x5e')](_0x5ce333,_0x3a85d2)[_0xb5d3('0x26')](function(_0x20d6b8){logger[_0xb5d3('0x20')](JSON[_0xb5d3('0x47')](_0x20d6b8));var _0x4c929d={'speech':_0x20d6b8[_0xb5d3('0x5f')],'action':_0x20d6b8[_0xb5d3('0x60')]?_0x20d6b8['channelData']['CustomAction']:undefined,'actiondata':_0x20d6b8['channelData']?_0x20d6b8[_0xb5d3('0x60')]['CustomActionData']:undefined};if(_0x20d6b8[_0xb5d3('0x60')]&&_0x20d6b8['channelData'][_0xb5d3('0x61')]){return base64Decode(_0x20d6b8[_0xb5d3('0x60')][_0xb5d3('0x61')]['Data'],path[_0xb5d3('0x22')](__dirname,_0xb5d3('0x23'),rs['generate'](0x4)+'.wav'))[_0xb5d3('0x26')](function(_0x45da39){_0x4c929d['audiofile']=_0x45da39;return _0x4c929d;});}return _0x4c929d;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 1af1013..e0e2920 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 _0x52da=['exports','./nda'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x52da,0x1cf));var _0xa52d=function(_0x261062,_0x4145b9){_0x261062=_0x261062-0x0;var _0x38ef4f=_0x52da[_0x261062];return _0x38ef4f;};var nda=require(_0xa52d('0x0'));module[_0xa52d('0x1')]={'nda':nda}; \ No newline at end of file +var _0x6697=['exports','./nda'];(function(_0xf8b858,_0x44f85b){var _0x38323e=function(_0x4e91d2){while(--_0x4e91d2){_0xf8b858['push'](_0xf8b858['shift']());}};_0x38323e(++_0x44f85b);}(_0x6697,0x97));var _0x7669=function(_0x27a125,_0x330c0e){_0x27a125=_0x27a125-0x0;var _0x36eac1=_0x6697[_0x27a125];return _0x36eac1;};var nda=require(_0x7669('0x0'));module[_0x7669('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 f4416dc..9239ec2 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 _0xc5f7=['url','POST','ndauth_url','password','username','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','stringify','request-promise'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xc5f7,0x18f));var _0x7c5f=function(_0x259a2d,_0x1eec31){_0x259a2d=_0x259a2d-0x0;var _0x8c103e=_0xc5f7[_0x259a2d];return _0x8c103e;};'use strict';var rp=require(_0x7c5f('0x0'));var url=require(_0x7c5f('0x1'));var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0xde9a03,_0x11b69b){var _0x1c65ed={'method':_0x7c5f('0x2'),'uri':url['resolve'](_0x11b69b[_0x7c5f('0x3')],'/token'),'form':{'grant_type':_0x7c5f('0x4'),'username':_0x11b69b[_0x7c5f('0x5')],'password':_0x11b69b[_0x7c5f('0x4')]},'json':!![]};return rp(_0x1c65ed)['then'](function(_0xb06ab5){var _0x43bdf4={'method':'POST','uri':url['resolve'](_0x11b69b[_0x7c5f('0x6')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x11b69b[_0x7c5f('0x7')]||'message','channelId':_0x7c5f('0x8'),'conversation':{'id':_0xde9a03[_0x7c5f('0x9')]},'from':{'id':_0xde9a03[_0x7c5f('0xa')],'name':_0xde9a03['calleridname']},'recipient':{'id':_0xde9a03[_0x7c5f('0xb')],'name':_0xde9a03['extension']},'text':_0x11b69b[_0x7c5f('0xc')],'channelData':{}},'headers':{'Authorization':_0x7c5f('0xd')+_0xb06ab5[_0x7c5f('0xe')]},'json':!![]};if(_0x11b69b['project']){_0x43bdf4[_0x7c5f('0xf')][_0x7c5f('0x10')][_0x7c5f('0x11')]=_0x11b69b[_0x7c5f('0x12')];}if(_0x11b69b['ndagenerate_audio']=='1'){_0x43bdf4[_0x7c5f('0xf')]['channelData'][_0x7c5f('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7c5f('0x14')};}if(_0x11b69b[_0x7c5f('0x15')]){_0x43bdf4[_0x7c5f('0xf')][_0x7c5f('0x10')]['CustomAction']=_0x11b69b[_0x7c5f('0x15')];if(_0x11b69b['custom_action_data']){_0x43bdf4[_0x7c5f('0xf')][_0x7c5f('0x10')][_0x7c5f('0x16')]=_0x11b69b[_0x7c5f('0x17')];}}logger['info'](JSON[_0x7c5f('0x18')](_0x43bdf4));return rp(_0x43bdf4);});}; \ No newline at end of file +var _0x9d67=['../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info'];(function(_0xddb5fa,_0x5cf206){var _0x53e729=function(_0x2662b0){while(--_0x2662b0){_0xddb5fa['push'](_0xddb5fa['shift']());}};_0x53e729(++_0x5cf206);}(_0x9d67,0x1c2));var _0x79d6=function(_0x4c1c91,_0x74a51){_0x4c1c91=_0x4c1c91-0x0;var _0x3fb045=_0x9d67[_0x4c1c91];return _0x3fb045;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x79d6('0x0'))(_0x79d6('0x1'));module[_0x79d6('0x2')]=function(_0x1de00f,_0x59dcd3){var _0x33e6bd={'method':_0x79d6('0x3'),'uri':url[_0x79d6('0x4')](_0x59dcd3[_0x79d6('0x5')],_0x79d6('0x6')),'form':{'grant_type':_0x79d6('0x7'),'username':_0x59dcd3[_0x79d6('0x8')],'password':_0x59dcd3[_0x79d6('0x7')]},'json':!![]};return rp(_0x33e6bd)[_0x79d6('0x9')](function(_0x5b60a1){var _0x50eef0={'method':_0x79d6('0x3'),'uri':url[_0x79d6('0x4')](_0x59dcd3[_0x79d6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x59dcd3[_0x79d6('0xb')]||_0x79d6('0xc'),'channelId':'Nda','conversation':{'id':_0x1de00f[_0x79d6('0xd')]},'from':{'id':_0x1de00f[_0x79d6('0xe')],'name':_0x1de00f[_0x79d6('0xf')]},'recipient':{'id':_0x1de00f[_0x79d6('0x10')],'name':_0x1de00f[_0x79d6('0x11')]},'text':_0x59dcd3['text'],'channelData':{}},'headers':{'Authorization':_0x79d6('0x12')+_0x5b60a1[_0x79d6('0x13')]},'json':!![]};if(_0x59dcd3[_0x79d6('0x14')]){_0x50eef0[_0x79d6('0x15')][_0x79d6('0x16')][_0x79d6('0x17')]=_0x59dcd3[_0x79d6('0x14')];}if(_0x59dcd3['ndagenerate_audio']=='1'){_0x50eef0[_0x79d6('0x15')][_0x79d6('0x16')][_0x79d6('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x79d6('0x19')};}if(_0x59dcd3[_0x79d6('0x1a')]){_0x50eef0[_0x79d6('0x15')][_0x79d6('0x16')]['CustomAction']=_0x59dcd3[_0x79d6('0x1a')];if(_0x59dcd3[_0x79d6('0x1b')]){_0x50eef0[_0x79d6('0x15')][_0x79d6('0x16')][_0x79d6('0x1c')]=_0x59dcd3[_0x79d6('0x1b')];}}logger[_0x79d6('0x1d')](JSON['stringify'](_0x50eef0));return rp(_0x50eef0);});}; \ 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 49205bd..9740a62 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 _0x9066=['exports','./lib/api'];(function(_0x2161f7,_0x2c9e6d){var _0x3f2d3b=function(_0x2b27a7){while(--_0x2b27a7){_0x2161f7['push'](_0x2161f7['shift']());}};_0x3f2d3b(++_0x2c9e6d);}(_0x9066,0x1b5));var _0x6906=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9066[_0x167cc1];return _0x10bc4b;};'use strict';var asr=require(_0x6906('0x0'));module[_0x6906('0x1')]=function(_0x152408,_0x18bc85,_0x3496b8,_0x136186){return asr(_0x152408,_0x18bc85,_0x3496b8,_0x136186);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x43129e,_0x4fb9dd,_0x5e06f4,_0x5c284d){return asr(_0x43129e,_0x4fb9dd,_0x5e06f4,_0x5c284d);}; \ 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 cd1cab0..0b79179 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 _0x6185=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','transcript','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x482d32,_0x4164ec){var _0x5eda4d=function(_0x49d318){while(--_0x49d318){_0x482d32['push'](_0x482d32['shift']());}};_0x5eda4d(++_0x4164ec);}(_0x6185,0x11a));var _0x5618=function(_0x4c0ada,_0x35a53d){_0x4c0ada=_0x4c0ada-0x0;var _0x22d4f4=_0x6185[_0x4c0ada];return _0x22d4f4;};'use strict';var BPromise=require(_0x5618('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5618('0x1'));var crypto=require('crypto');var logger=require(_0x5618('0x2'))(_0x5618('0x3'));module['exports']=function(_0x1c48da,_0x538cf5,_0xc03152,_0x36b601){return new BPromise(function(_0x41d39d,_0x58aaab){logger[_0x5618('0x4')]('Tilde\x20URI',_0x36b601||_0x5618('0x5'));var _0xc0b928=new WebSocket(_0x36b601||_0x5618('0x5'),{'perMessageDeflate':![]});var _0x4d6c75='';var _0x153ab3='0';var _0x1160a2='1';var _0x2e22b6='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x55f37c(_0x3df6ee){var _0x14f621=crypto['createHash'](_0x5618('0x6'));_0x14f621[_0x5618('0x7')](_0x3df6ee);return _0x14f621[_0x5618('0x8')](_0x5618('0x9'));}function _0x462034(){try{logger[_0x5618('0x4')](_0x5618('0xa'));var _0xcf626e=moment()[_0x5618('0xb')]();var _0x4a8748=_0x55f37c(_0xcf626e+_0x538cf5+_0xc03152);_0xc0b928[_0x5618('0xc')](JSON[_0x5618('0xd')]({'appID':_0x538cf5,'timestamp':_0xcf626e,'appKey':_0x4a8748}));var _0x4636c2=fs['createReadStream'](_0x1c48da);_0x4636c2['on'](_0x5618('0xe'),function(_0x12ab98){_0xc0b928[_0x5618('0xc')](_0x12ab98);});_0x4636c2['on'](_0x5618('0xf'),function(){_0xc0b928[_0x5618('0xc')]('EOS');});}catch(_0x21253f){logger['error'](_0x5618('0x10'),JSON[_0x5618('0xd')](_0x21253f));_0xc0b928[_0x5618('0x11')]();}}function _0x596168(_0x408d41){try{if(_0x408d41){var _0x3ea277=JSON[_0x5618('0x12')](_0x408d41);switch(_0x3ea277[_0x5618('0x13')]){case 0x0:if(_0x3ea277['result']){if(_0x3ea277[_0x5618('0x14')][_0x5618('0x15')]){logger[_0x5618('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x5618('0xd')](_0x3ea277['result']['hypotheses']));_0x4d6c75=_0x3ea277[_0x5618('0x14')]['hypotheses'][0x0][_0x5618('0x16')];_0x153ab3=_0x3ea277['result'][_0x5618('0x17')][0x0][_0x5618('0x18')];_0x1160a2='0';_0x2e22b6=_0x5618('0x19');_0xc0b928[_0x5618('0x11')]();}}break;case 0x1:logger['info'](_0x5618('0x1a'));_0x1160a2='1';_0x2e22b6=_0x5618('0x1a');break;case 0x2:logger['info'](_0x5618('0x1b'));_0x1160a2='2';_0x2e22b6=_0x5618('0x1b');break;case 0x9:logger[_0x5618('0x4')](_0x5618('0x1c'));_0x1160a2='9';_0x2e22b6=_0x5618('0x1c');break;case 0xa:logger[_0x5618('0x4')](_0x5618('0x1d'));_0x1160a2='10';_0x2e22b6='Authentication\x20failed.';break;case 0xb:logger['info'](_0x5618('0x1e'));_0x1160a2='11';_0x2e22b6=_0x5618('0x1e');}}}catch(_0x218e2e){logger['error'](_0x5618('0x1f'),JSON[_0x5618('0xd')](_0x218e2e));_0xc0b928[_0x5618('0x11')]();}}function _0x3be7b7(){logger['info'](_0x5618('0x20'));_0x41d39d({'transcript':_0x4d6c75,'confidence':_0x153ab3,'status':_0x1160a2,'status_message':_0x2e22b6});}function _0x4158bc(_0x32c5a1){logger[_0x5618('0x21')](_0x5618('0x22'));if(!_[_0x5618('0x23')](_0x32c5a1)){logger[_0x5618('0x21')](_[_0x5618('0x24')](_0x32c5a1)?JSON[_0x5618('0xd')](_0x32c5a1):_0x32c5a1);}}_0xc0b928['on'](_0x5618('0x25'),_0x462034);_0xc0b928['on'](_0x5618('0x26'),_0x596168);_0xc0b928['on'](_0x5618('0xf'),_0x3be7b7);_0xc0b928['on'](_0x5618('0x21'),_0x4158bc);});}; \ No newline at end of file +var _0xbfce=['close','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','error','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.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message'];(function(_0x24fef1,_0x2596fc){var _0x1dec46=function(_0x60ded8){while(--_0x60ded8){_0x24fef1['push'](_0x24fef1['shift']());}};_0x1dec46(++_0x2596fc);}(_0xbfce,0x161));var _0xebfc=function(_0xb400ce,_0x51e8dc){_0xb400ce=_0xb400ce-0x0;var _0x50b4bc=_0xbfce[_0xb400ce];return _0x50b4bc;};'use strict';var BPromise=require('bluebird');var _=require(_0xebfc('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xebfc('0x1'));var crypto=require(_0xebfc('0x2'));var logger=require(_0xebfc('0x3'))(_0xebfc('0x4'));module[_0xebfc('0x5')]=function(_0x5a5ee8,_0x97919b,_0x5bdb79,_0x52ee11){return new BPromise(function(_0xb6099e,_0x45e96d){logger['info'](_0xebfc('0x6'),_0x52ee11||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1f8827=new WebSocket(_0x52ee11||_0xebfc('0x7'),{'perMessageDeflate':![]});var _0x384816='';var _0x5b39b8='0';var _0x581708='1';var _0x50ca03=_0xebfc('0x8');function _0x22bf43(_0x18cb21){var _0xac56d4=crypto[_0xebfc('0x9')](_0xebfc('0xa'));_0xac56d4[_0xebfc('0xb')](_0x18cb21);return _0xac56d4[_0xebfc('0xc')](_0xebfc('0xd'));}function _0x6251db(){try{logger[_0xebfc('0xe')](_0xebfc('0xf'));var _0x2dbf9f=moment()[_0xebfc('0x10')]();var _0x30a1ec=_0x22bf43(_0x2dbf9f+_0x97919b+_0x5bdb79);_0x1f8827['send'](JSON[_0xebfc('0x11')]({'appID':_0x97919b,'timestamp':_0x2dbf9f,'appKey':_0x30a1ec}));var _0x44d239=fs[_0xebfc('0x12')](_0x5a5ee8);_0x44d239['on'](_0xebfc('0x13'),function(_0x93a4d4){_0x1f8827[_0xebfc('0x14')](_0x93a4d4);});_0x44d239['on']('close',function(){_0x1f8827[_0xebfc('0x14')]('EOS');});}catch(_0xe8f4f){logger[_0xebfc('0x15')](_0xebfc('0x16'),JSON[_0xebfc('0x11')](_0xe8f4f));_0x1f8827[_0xebfc('0x17')]();}}function _0xe6410b(_0x493a61){try{if(_0x493a61){var _0x54f178=JSON[_0xebfc('0x18')](_0x493a61);switch(_0x54f178[_0xebfc('0x19')]){case 0x0:if(_0x54f178[_0xebfc('0x1a')]){if(_0x54f178[_0xebfc('0x1a')][_0xebfc('0x1b')]){logger[_0xebfc('0xe')](_0xebfc('0x1c'),JSON[_0xebfc('0x11')](_0x54f178['result'][_0xebfc('0x1d')]));_0x384816=_0x54f178[_0xebfc('0x1a')][_0xebfc('0x1d')][0x0][_0xebfc('0x1e')];_0x5b39b8=_0x54f178[_0xebfc('0x1a')][_0xebfc('0x1d')][0x0][_0xebfc('0x1f')];_0x581708='0';_0x50ca03=_0xebfc('0x20');_0x1f8827['terminate']();}}break;case 0x1:logger[_0xebfc('0xe')](_0xebfc('0x8'));_0x581708='1';_0x50ca03='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xebfc('0xe')](_0xebfc('0x21'));_0x581708='2';_0x50ca03='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xebfc('0xe')](_0xebfc('0x22'));_0x581708='9';_0x50ca03=_0xebfc('0x22');break;case 0xa:logger[_0xebfc('0xe')](_0xebfc('0x23'));_0x581708='10';_0x50ca03=_0xebfc('0x23');break;case 0xb:logger['info'](_0xebfc('0x24'));_0x581708='11';_0x50ca03=_0xebfc('0x24');}}}catch(_0xad4a08){logger[_0xebfc('0x15')](_0xebfc('0x25'),JSON[_0xebfc('0x11')](_0xad4a08));_0x1f8827['terminate']();}}function _0x422dcc(){logger[_0xebfc('0xe')]('Close\x20Tilde\x20ASR\x20socket');_0xb6099e({'transcript':_0x384816,'confidence':_0x5b39b8,'status':_0x581708,'status_message':_0x50ca03});}function _0x52bf3a(_0x355c58){logger[_0xebfc('0x15')](_0xebfc('0x26'));if(!_[_0xebfc('0x27')](_0x355c58)){logger['error'](_[_0xebfc('0x28')](_0x355c58)?JSON['stringify'](_0x355c58):_0x355c58);}}_0x1f8827['on'](_0xebfc('0x29'),_0x6251db);_0x1f8827['on'](_0xebfc('0x2a'),_0xe6410b);_0x1f8827['on'](_0xebfc('0x2b'),_0x422dcc);_0x1f8827['on'](_0xebfc('0x15'),_0x52bf3a);});}; \ 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 10cb4be..df44d59 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x6950=['exports','./asr'];(function(_0x1b61fd,_0x1d1e1e){var _0x3b60d8=function(_0x59acd8){while(--_0x59acd8){_0x1b61fd['push'](_0x1b61fd['shift']());}};_0x3b60d8(++_0x1d1e1e);}(_0x6950,0xfb));var _0x0695=function(_0x59089c,_0x168751){_0x59089c=_0x59089c-0x0;var _0x1a19a0=_0x6950[_0x59089c];return _0x1a19a0;};var asr=require(_0x0695('0x0'));module[_0x0695('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7c3b34e..d45b230 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 _0x0aaf=['events','EventEmitter','./error','./channel','call','emit','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','destroy','ready','code','close','nextTick','inherits'];(function(_0x202ba7,_0x5e0533){var _0x237086=function(_0x5ab13a){while(--_0x5ab13a){_0x202ba7['push'](_0x202ba7['shift']());}};_0x237086(++_0x5e0533);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0x0aaf[_0xe7d07d];return _0x229e46;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0xf0aa('0x0'))[_0xf0aa('0x1')];var AGIError=require(_0xf0aa('0x2'));var AGIChannel=require(_0xf0aa('0x3'));var AGIServer=function(_0x5e7bdc,_0x507aaa,_0x3943ce){var _0x2f72d3=this,_0x5e7bdc=_0x5e7bdc||0x11dd,_0x507aaa=_0x507aaa||'127.0.0.1',_0x4c20b5=null,_0x752f1b=0x0;EventEmitter[_0xf0aa('0x4')](_0x2f72d3);function _0x244745(){if(!_0x5e7bdc){_0x2f72d3[_0xf0aa('0x5')]('error',new AGIError(_0xf0aa('0x6')));return![];}_0x4c20b5=net[_0xf0aa('0x7')]();_0x4c20b5['listen'](_0x5e7bdc,_0x507aaa);_0x4c20b5['on'](_0xf0aa('0x8'),function(){_0x2f72d3[_0xf0aa('0x5')](_0xf0aa('0x8'));});_0x4c20b5['on'](_0xf0aa('0x9'),function(_0x60a2c5){_0x4c20b5[_0xf0aa('0xa')](function(_0x34b218,_0x106b57){if(_0x34b218){_0x2f72d3[_0xf0aa('0x5')](_0xf0aa('0xb'),new AGIError(_0xf0aa('0xc'),_0x34b218));}else if(_0x3943ce&&_0x3943ce<0x0){_0x2f72d3[_0xf0aa('0x5')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x60a2c5[_0xf0aa('0xd')]();}else if(_0x3943ce&&_0x3943ce>0x0&&_0x3943ce<_0x106b57){_0x752f1b+=0x1;_0x2f72d3[_0xf0aa('0x5')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x752f1b));_0x60a2c5[_0xf0aa('0xd')]();}else{var _0x51bb2c=new AGIChannel(_0x60a2c5);_0x51bb2c['on'](_0xf0aa('0xe'),function(){_0x2f72d3['emit'](_0xf0aa('0x9'),_0x51bb2c);});}});});_0x4c20b5['on']('error',function(_0x3fb1fe){_0x2f72d3[_0xf0aa('0x5')](_0xf0aa('0xb'),new AGIError(_0xf0aa('0xc'),_0x3fb1fe[_0xf0aa('0xf')]));});_0x4c20b5['on'](_0xf0aa('0x10'),function(){_0x2f72d3[_0xf0aa('0x5')](_0xf0aa('0x10'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xf0aa('0x11')](function(){_0x244745();});};util[_0xf0aa('0x12')](AGIServer,EventEmitter);module['exports']=function(_0x31e85f,_0x16d578,_0x35f407){return new AGIServer(_0x31e85f,_0x16d578,_0x35f407);}; \ No newline at end of file +var _0x82b0=['./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x82b0,0x81));var _0x082b=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x82b0[_0x352d28];return _0x387d7e;};'use strict';var util=require(_0x082b('0x0'));var net=require(_0x082b('0x1'));var EventEmitter=require(_0x082b('0x2'))['EventEmitter'];var AGIError=require(_0x082b('0x3'));var AGIChannel=require(_0x082b('0x4'));var AGIServer=function(_0x23a5f3,_0x196c49,_0x4c2ec5){var _0x211e69=this,_0x23a5f3=_0x23a5f3||0x11dd,_0x196c49=_0x196c49||'127.0.0.1',_0x165c0c=null,_0x2dafd0=0x0;EventEmitter[_0x082b('0x5')](_0x211e69);function _0x3b9c2a(){if(!_0x23a5f3){_0x211e69[_0x082b('0x6')](_0x082b('0x7'),new AGIError(_0x082b('0x8')));return![];}_0x165c0c=net[_0x082b('0x9')]();_0x165c0c[_0x082b('0xa')](_0x23a5f3,_0x196c49);_0x165c0c['on'](_0x082b('0xb'),function(){_0x211e69[_0x082b('0x6')](_0x082b('0xb'));});_0x165c0c['on'](_0x082b('0xc'),function(_0x181a6e){_0x165c0c[_0x082b('0xd')](function(_0x2edffb,_0x4e9133){if(_0x2edffb){_0x211e69['emit'](_0x082b('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x2edffb));}else if(_0x4c2ec5&&_0x4c2ec5<0x0){_0x211e69['emit'](_0x082b('0x7'),new AGIError(_0x082b('0xe')));_0x181a6e['destroy']();}else if(_0x4c2ec5&&_0x4c2ec5>0x0&&_0x4c2ec5<_0x4e9133){_0x2dafd0+=0x1;_0x211e69[_0x082b('0x6')](_0x082b('0x7'),new AGIError(_0x082b('0xf'),_0x2dafd0));_0x181a6e[_0x082b('0x10')]();}else{var _0x40e206=new AGIChannel(_0x181a6e);_0x40e206['on']('ready',function(){_0x211e69[_0x082b('0x6')](_0x082b('0xc'),_0x40e206);});}});});_0x165c0c['on']('error',function(_0x2c4f86){_0x211e69['emit'](_0x082b('0x7'),new AGIError(_0x082b('0x11'),_0x2c4f86['code']));});_0x165c0c['on'](_0x082b('0x12'),function(){_0x211e69[_0x082b('0x6')](_0x082b('0x12'),new AGIError(_0x082b('0x13')));});}process['nextTick'](function(){_0x3b9c2a();});};util[_0x082b('0x14')](AGIServer,EventEmitter);module[_0x082b('0x15')]=function(_0x7d188d,_0x38930f,_0x1e8fa5){return new AGIServer(_0x7d188d,_0x38930f,_0x1e8fa5);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8194856..910f7cb 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 _0xd4d3=['statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','isEmpty','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','label','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','url','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','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','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','AGENT\x20%s\x20FOUND\x20BY','failure','math','no\x20operation\x20configured','math\x20%s','operation','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','opts','queue','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','position','QUEUE','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','menu','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','getPause','agentPause','agent','agentUnpause','internal','format','%s/%s@from-sip/n','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4d3,0x149));var _0x3d4d=function(_0xb8377d,_0xacde4b){_0xb8377d=_0xb8377d-0x0;var _0x25d45d=_0xd4d3[_0xb8377d];return _0x25d45d;};'use strict';var fs=require('fs');var path=require(_0x3d4d('0x0'));var util=require(_0x3d4d('0x1'));var _=require(_0x3d4d('0x2'));var sh=require(_0x3d4d('0x3'));var odbc=require('odbc')();var rs=require(_0x3d4d('0x4'));var moment=require(_0x3d4d('0x5'));var Mustache=require(_0x3d4d('0x6'));var rp=require('request-promise');var logger=require(_0x3d4d('0x7'))(_0x3d4d('0x8'));var config=require(_0x3d4d('0x9'));var scripts=require(_0x3d4d('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x3d4d('0xb'),'rawBody'];var verticesWithRetry=[_0x3d4d('0xc'),'getdigits',_0x3d4d('0xd')];var AGIVertices=function(_0xd99690,_0x55475e,_0x5ae24a){this[_0x3d4d('0xe')]=_0xd99690;this['rpc']=_0x55475e;this[_0x3d4d('0xf')]=_0x5ae24a;};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x11')]=function(_0x51faca,_0x1a1818){this[_0x3d4d('0x12')][_0x3d4d('0x13')](_0x51faca)[_0x3d4d('0x14')](function(_0xe3056d){_0x1a1818(null,_0xe3056d?_0xe3056d[_0x3d4d('0x15')]:![]);})['catch'](function(_0x34c1ce){_0x1a1818(_0x34c1ce);});};AGIVertices['prototype'][_0x3d4d('0x16')]=function(_0x53f0f3,_0x10b244){this[_0x3d4d('0x12')][_0x3d4d('0x17')](_0x53f0f3)['then'](function(_0x24d888){_0x10b244(null,_0x24d888?_0x24d888['name']:![]);})[_0x3d4d('0x18')](function(_0x5ee2a3){_0x10b244(_0x5ee2a3);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x19')]=function(_0x1fa176,_0x11ceea){this[_0x3d4d('0x12')][_0x3d4d('0x1a')](_0x1fa176)['then'](function(_0x39a5c2){_0x11ceea(null,_0x39a5c2?_0x39a5c2[_0x3d4d('0x15')]:![]);})['catch'](function(_0x21fef0){_0x11ceea(_0x21fef0);});};AGIVertices['prototype'][_0x3d4d('0x1b')]=function(_0xb0c888,_0x370fbe){this[_0x3d4d('0x12')]['getSquareOdbcById'](_0xb0c888)[_0x3d4d('0x14')](function(_0x23a20b){_0x370fbe(null,_0x23a20b?_0x23a20b[_0x3d4d('0x1c')]:![]);})[_0x3d4d('0x18')](function(_0x5422c5){_0x370fbe(_0x5422c5);});};AGIVertices['prototype'][_0x3d4d('0x1d')]=function(_0x46a15a,_0x4c0cf6){this[_0x3d4d('0x12')][_0x3d4d('0x1e')](_0x46a15a)[_0x3d4d('0x14')](function(_0x2ece44){_0x4c0cf6(null,_0x2ece44?_0x2ece44[_0x3d4d('0x15')]:![]);})[_0x3d4d('0x18')](function(_0x407073){_0x4c0cf6(_0x407073);});};AGIVertices[_0x3d4d('0x10')]['getTrunk']=function(_0x2e325a,_0x2068e2){this[_0x3d4d('0x12')][_0x3d4d('0x1f')](_0x2e325a)[_0x3d4d('0x14')](function(_0x422afa){_0x2068e2(null,_0x422afa?_0x422afa['name']:![]);})[_0x3d4d('0x18')](function(_0x10fbfd){_0x2068e2(_0x10fbfd);});};AGIVertices['prototype']['getSound']=function(_0x571237,_0x40b01e){var _0x454737=this;this[_0x3d4d('0x12')]['getSoundById'](_0x571237)[_0x3d4d('0x14')](function(_0x3fb9a5){_0x40b01e(null,_0x3fb9a5?_0x454737['getSoundPath'](_0x3fb9a5[_0x3d4d('0x20')]):![]);})['catch'](function(_0x25e044){_0x40b01e(_0x25e044);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x21')]=function(_0x344cb0,_0x1998c6){this[_0x3d4d('0x12')][_0x3d4d('0x22')](_0x344cb0)[_0x3d4d('0x14')](function(_0x25b678){_0x1998c6(null,_0x25b678?_0x25b678:![]);})['catch'](function(_0x1667dc){_0x1998c6(_0x1667dc);});};AGIVertices['prototype'][_0x3d4d('0x23')]=function(_0x4156c1,_0x342fcb,_0x4c424f){this[_0x3d4d('0xf')][_0x3d4d('0x23')](_0x4156c1,_0x342fcb)[_0x3d4d('0x14')](function(){_0x4c424f(null);})[_0x3d4d('0x18')](function(_0x47d93c){_0x4c424f(_0x47d93c);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x24')]=function(_0x1aa808,_0x529e26){this[_0x3d4d('0x12')][_0x3d4d('0x25')](_0x1aa808)[_0x3d4d('0x14')](function(_0x4a29f4){if(_0x4a29f4){if(_0x4a29f4[_0x3d4d('0x26')]){_0x529e26(null,[_0x4a29f4[_0x3d4d('0x27')]]);}else{_0x529e26(null,_['map'](_0x4a29f4[_0x3d4d('0x28')],'interval'));}}else{_0x529e26(null,![]);}})[_0x3d4d('0x18')](function(_0x400416){_0x529e26(_0x400416);});};AGIVertices[_0x3d4d('0x10')]['getSoundPath']=function(_0x3bf232){return util['format'](_0x3d4d('0x29'),FILES_PATH,_0x3bf232);};AGIVertices['prototype'][_0x3d4d('0x2a')]=function(_0x39a604,_0x24bded,_0x538a89){odbc['open'](_0x39a604,function(_0x33c796){if(_0x33c796){logger[_0x3d4d('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x33c796);_0x538a89(_0x33c796);}else{logger[_0x3d4d('0x2c')](_0x3d4d('0x2d'));odbc['query'](_0x24bded,function(_0x5938ec,_0x17ab83){if(_0x5938ec){logger[_0x3d4d('0x2c')]('Error\x20executing\x20query\x20%s',_0x24bded);_0x538a89(_0x5938ec);}else{logger[_0x3d4d('0x2c')](_0x3d4d('0x2e'),_0x24bded);odbc[_0x3d4d('0x2f')](function(_0x48500b){if(_0x48500b){logger['error'](_0x3d4d('0x30'),_0x48500b);}_0x538a89(null,_0x17ab83);});}});}});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x31')]=function(_0x5899ea,_0x5cf47a){this[_0x3d4d('0x12')]['getSmsAccountById'](_0x5899ea)[_0x3d4d('0x14')](function(_0x445894){_0x5cf47a(null,_0x445894?_0x445894:![]);})[_0x3d4d('0x18')](function(_0x50eadf){_0x5cf47a(_0x50eadf);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x32')]=function(_0x5b8070,_0x22b86c){this[_0x3d4d('0x12')][_0x3d4d('0x32')](_0x5b8070)['then'](function(_0x4aa532){_0x22b86c(null,_0x4aa532);})[_0x3d4d('0x18')](function(_0x288501){_0x22b86c(_0x288501);});};AGIVertices['prototype'][_0x3d4d('0x33')]=function(_0x2721a7,_0x5d20a0,_0x1c81e5){this[_0x3d4d('0x12')][_0x3d4d('0x33')]({'uniqueid':this[_0x3d4d('0xe')][_0x3d4d('0x34')],'node':_0x2721a7['label'],'application':_0x2721a7['agicommand'],'data':_0x5d20a0||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x3d4d('0x35')]})['then'](function(_0x45a0ab){if(_0x1c81e5){_0x1c81e5(null,_0x45a0ab);}})[_0x3d4d('0x18')](function(_0x11f0d5){if(_0x1c81e5){_0x1c81e5(_0x11f0d5);}});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x36')]=function(_0x348c8f,_0x29ebe4,_0x2c2806,_0x4d8388){this[_0x3d4d('0x12')][_0x3d4d('0x36')]({'uniqueid':this[_0x3d4d('0xe')][_0x3d4d('0x34')],'callerid':this[_0x3d4d('0xe')][_0x3d4d('0x35')],'calleridname':this[_0x3d4d('0xe')][_0x3d4d('0x37')],'context':this[_0x3d4d('0xe')][_0x3d4d('0x38')],'extension':this[_0x3d4d('0xe')][_0x3d4d('0x39')],'priority':this[_0x3d4d('0xe')][_0x3d4d('0x3a')],'accountcode':this[_0x3d4d('0xe')][_0x3d4d('0x3b')],'dnid':this[_0x3d4d('0xe')][_0x3d4d('0x3c')],'projectName':this[_0x3d4d('0xe')][_0x3d4d('0x3d')],'saveName':_0x29ebe4,'filename':_0x348c8f[_0x3d4d('0x3e')]||_0x29ebe4,'savePath':_0x2c2806})[_0x3d4d('0x14')](function(_0x5c10f3){_0x4d8388(null,_0x5c10f3);})[_0x3d4d('0x18')](function(_0x56cc97){_0x4d8388(_0x56cc97);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x3f')]=function(_0x199cec,_0x2d57d2,_0x193273){this[_0x3d4d('0x12')]['createSquareMessage']({'uniqueid':this[_0x3d4d('0xe')]['uniqueid'],'body':_0x199cec,'direction':_0x2d57d2})['then'](function(_0x41ac19){if(_0x193273){_0x193273(null,_0x41ac19);}})[_0x3d4d('0x18')](function(_0x3d88e0){if(_0x193273){_0x193273(_0x3d88e0);}});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x40')]=function(_0x507ded,_0x1152a8){this[_0x3d4d('0x12')][_0x3d4d('0x40')]({'firstName':_['isEmpty'](_0x507ded[_0x3d4d('0x15')])||_[_0x3d4d('0x41')](_0x507ded['name'])?_0x3d4d('0x42')+Math[_0x3d4d('0x43')]():_0x507ded[_0x3d4d('0x15')],'lastName':_['isEmpty'](_0x507ded['lastName'])||_[_0x3d4d('0x41')](_0x507ded[_0x3d4d('0x44')])?null:_0x507ded[_0x3d4d('0x44')],'phone':_0x507ded[_0x3d4d('0x45')],'ListId':_0x507ded[_0x3d4d('0x46')],'scheduledat':_0x507ded[_0x3d4d('0x47')],'callbackUniqueid':this[_0x3d4d('0xe')][_0x3d4d('0x34')],'tags':_0x3d4d('0x48'),'description':'Callback\x20scheduled\x20at\x20'+_0x507ded[_0x3d4d('0x47')]['toString'](),'priority':_0x507ded['callback_priority']})[_0x3d4d('0x14')](function(_0x476782){_0x1152a8(null,_0x476782);})[_0x3d4d('0x18')](function(_0x28b012){_0x1152a8(_0x28b012);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x49')]=function(_0x52ca5f,_0x422df5){this[_0x3d4d('0x12')]['getPauseById'](_0x52ca5f)['then'](function(_0x2c4c43){_0x422df5(null,_0x2c4c43?_0x2c4c43['name']:![]);})[_0x3d4d('0x18')](function(_0x196fe9){_0x422df5(_0x196fe9);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x4a')]=function(_0x2e218f,_0x28287,_0x42c232){var _0x3f9373={'role':_0x3d4d('0x4b')};_0x3f9373[_0x2e218f]=this[_0x3d4d('0xe')][_0x3d4d('0x35')];this[_0x3d4d('0x12')][_0x3d4d('0x4a')](_0x3f9373,_0x28287,this[_0x3d4d('0xe')]['uniqueid'])[_0x3d4d('0x14')](function(_0x2db43b){_0x42c232(null,_[_0x3d4d('0x41')](_0x2db43b)?![]:!![]);})['catch'](function(_0x594f99){logger[_0x3d4d('0x2b')](_0x594f99);_0x42c232(null,![]);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x4c')]=function(_0x1a9800,_0x2757c1){var _0x550880={'role':'agent'};_0x550880[_0x1a9800]=this[_0x3d4d('0xe')][_0x3d4d('0x35')];this[_0x3d4d('0x12')][_0x3d4d('0x4c')](_0x550880)[_0x3d4d('0x14')](function(_0x30a829){_0x2757c1(null,_['isNil'](_0x30a829)?![]:!![]);})['catch'](function(_0x10e392){logger[_0x3d4d('0x2b')](_0x10e392);_0x2757c1(null,![]);});};AGIVertices[_0x3d4d('0x10')]['agentLogout']=function(_0x47ce6b,_0x29207e){var _0x549127={'role':_0x3d4d('0x4b')};_0x549127[_0x47ce6b]=this['channel'][_0x3d4d('0x35')];this['rpc']['agentLogout'](_0x549127)['then'](function(_0x41f302){_0x29207e(null,_['isNil'](_0x41f302)?![]:!![]);})[_0x3d4d('0x18')](function(_0x3ca20c){logger['error'](_0x3ca20c);_0x29207e(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x3247fd,_0x3c49ea){var _0xc8b820={'role':_0x3d4d('0x4b')};_0xc8b820[_0x3247fd]=this['channel'][_0x3d4d('0x35')];var _0x1346fe=_0x3247fd!=_0x3d4d('0x4d')?util[_0x3d4d('0x4e')](_0x3d4d('0x4f'),'LOCAL',this[_0x3d4d('0xe')]['callerid']):undefined;this[_0x3d4d('0x12')][_0x3d4d('0x50')](_0xc8b820,_0x1346fe)[_0x3d4d('0x14')](function(_0x5ed45d){_0x3c49ea(null,_[_0x3d4d('0x41')](_0x5ed45d)?![]:!![]);})[_0x3d4d('0x18')](function(_0x2141d8){logger[_0x3d4d('0x2b')](_0x2141d8);_0x3c49ea(null,![]);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x51')]=function(_0x2df95b,_0x27edcd){sh[_0x3d4d('0x52')](_['trim'](_0x2df95b),function(_0x3c537d,_0x5a9438){var _0x24c614=_0x5a9438[_0x3d4d('0x53')](/(\r\n|\n|\r)/gm,'');_0x27edcd(null,_0x24c614);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x54')]=function(_0x4f702f,_0x1ca579){scripts['googleCloudTTS'](_0x4f702f[_0x3d4d('0x55')],_0x4f702f[_0x3d4d('0x56')]||_0x3d4d('0x57'),_0x4f702f[_0x3d4d('0x57')],_0x4f702f[_0x3d4d('0x58')]||_0x3d4d('0x59'),_0x4f702f['ssmlGender']||_0x3d4d('0x5a'),_0x4f702f['audioEncoding']||'MP3')[_0x3d4d('0x14')](function(_0x528f15){_0x1ca579(null,_0x528f15);})['catch'](function(_0x49c4e7){_0x1ca579(_0x49c4e7);});};AGIVertices[_0x3d4d('0x10')]['googleTTS']=function(_0x32181f,_0x37569c){scripts[_0x3d4d('0x5b')](_0x32181f[_0x3d4d('0x57')],_0x32181f[_0x3d4d('0x5c')]||'en',0x1)[_0x3d4d('0x14')](function(_0x48bad5){_0x37569c(null,_0x48bad5);})[_0x3d4d('0x18')](function(_0x3326b3){_0x37569c(_0x3326b3);});};AGIVertices['prototype'][_0x3d4d('0x5d')]=function(_0xc0e5ad,_0x2ae958){var _0x3dd25d={'uri':_0xc0e5ad['url'],'method':_0xc0e5ad[_0x3d4d('0x5e')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xc0e5ad[_0x3d4d('0x5f')])===_0x3d4d('0x60')&&parseInt(_0xc0e5ad[_0x3d4d('0x5f')])>=0x1?parseInt(_0xc0e5ad['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x3d4d('0x61')]([_0x3d4d('0x62'),_0x3d4d('0x63')],_0x3dd25d[_0x3d4d('0x5e')][_0x3d4d('0x64')]())){try{_0x3dd25d[_0x3d4d('0x65')]=_0xc0e5ad[_0x3d4d('0x66')]?JSON[_0x3d4d('0x67')](_0xc0e5ad[_0x3d4d('0x66')]):{};}catch(_0x3f41f2){logger[_0x3d4d('0x2b')](_0x3d4d('0x68'),_0x3f41f2);}}try{_0x3dd25d[_0x3d4d('0x69')]=_0xc0e5ad[_0x3d4d('0xb')]?JSON['parse'](_0xc0e5ad['rawHeaders']):{};}catch(_0x1ac04d){logger[_0x3d4d('0x2b')](_0x3d4d('0x6a'),_0x1ac04d);}if(_0xc0e5ad['computedVariables']){try{var _0x41ba5d=require(_0xc0e5ad[_0x3d4d('0x6b')])[_0x3d4d('0x6c')](this,_0x3dd25d);_0x3dd25d[_0x3d4d('0x6d')]=Mustache[_0x3d4d('0x6e')](_0xc0e5ad['url'],_0x41ba5d,{},['$$','$$']);if(_0x3dd25d[_0x3d4d('0x69')]){_0x3dd25d[_0x3d4d('0x69')]=JSON[_0x3d4d('0x67')](Mustache[_0x3d4d('0x6e')](JSON[_0x3d4d('0x6f')](_0x3dd25d[_0x3d4d('0x69')]),_0x41ba5d,{},['$$','$$']));}if(_0x3dd25d[_0x3d4d('0x65')]){_0x3dd25d[_0x3d4d('0x65')]=JSON[_0x3d4d('0x67')](Mustache[_0x3d4d('0x6e')](JSON[_0x3d4d('0x6f')](_0x3dd25d[_0x3d4d('0x65')]),_0x41ba5d,{},['$$','$$']));}}catch(_0x45b056){logger[_0x3d4d('0x2b')](_0x3d4d('0x70'),_0x45b056);}}rp(_0x3dd25d)[_0x3d4d('0x14')](function(_0x33ea94){var _0x846ac4={'statusCode':_0x33ea94[_0x3d4d('0x71')]||0xc8,'statusMessage':_0x33ea94[_0x3d4d('0x72')]||'OK','headers':_0x33ea94[_0x3d4d('0x69')]||{},'body':_0x33ea94[_0x3d4d('0x65')]||{}};_0x2ae958(null,_0x846ac4);})[_0x3d4d('0x18')](function(_0x3d34fb){var _0x194c30={'statusCode':_0x3d34fb[_0x3d4d('0x71')]||0x1f4,'statusMessage':_0x3d34fb[_0x3d4d('0x73')]||_0x3d4d('0x74'),'headers':_0x3d34fb['options'][_0x3d4d('0x69')]||{},'body':_0x3d34fb[_0x3d4d('0x75')][_0x3d4d('0x65')]||{}};_0x2ae958(null,_0x194c30);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x76')]=function(_0x3f0906,_0x74cd9a){scripts[_0x3d4d('0x76')](this[_0x3d4d('0xe')][_0x3d4d('0x34')],_0x3f0906[_0x3d4d('0x77')],_0x3f0906['text'],_0x3f0906[_0x3d4d('0x78')]||'en')[_0x3d4d('0x14')](function(_0xf4fa1c){_0x74cd9a(null,_0xf4fa1c);})[_0x3d4d('0x18')](function(_0x283c81){_0x74cd9a(_0x283c81);});};AGIVertices[_0x3d4d('0x10')]['sestekNDA']=function(_0x3b7c7b,_0x4daff4){scripts[_0x3d4d('0x79')](this['channel'],_0x3b7c7b)[_0x3d4d('0x14')](function(_0x4279d6){_0x4daff4(null,_0x4279d6);})[_0x3d4d('0x18')](function(_0x700992){_0x4daff4(_0x700992);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x7a')]=function(_0xc1598a,_0x5dda8c){scripts[_0x3d4d('0x7a')](_0xc1598a[_0x3d4d('0x77')],_0xc1598a['text'],_0xc1598a['ispeech_tts_language']||'en-US',_0xc1598a[_0x3d4d('0x7b')])[_0x3d4d('0x14')](function(_0x54dae6){_0x5dda8c(null,_0x54dae6);})[_0x3d4d('0x18')](function(_0x48e8ac){_0x5dda8c(_0x48e8ac);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x7c')]=function(_0x58c1e5,_0x3f309c,_0x4ba27a){scripts[_0x3d4d('0x7c')](_0x3f309c,_0x58c1e5[_0x3d4d('0x77')],_0x58c1e5[_0x3d4d('0x7d')]||_0x3d4d('0x59'),this[_0x3d4d('0x7e')](_0x58c1e5['model'])?_0x58c1e5[_0x3d4d('0x7f')]:undefined)[_0x3d4d('0x14')](function(_0x544181){_0x4ba27a(null,_0x544181);})[_0x3d4d('0x18')](function(_0x3c8408){_0x4ba27a(_0x3c8408);});};AGIVertices[_0x3d4d('0x10')]['awsPolly']=function(_0x23b1f7,_0x3bf697){scripts[_0x3d4d('0x80')](_0x23b1f7['aws_access_key_id'],_0x23b1f7[_0x3d4d('0x81')],_0x23b1f7['aws_polly_region'],_0x23b1f7[_0x3d4d('0x82')]||_0x3d4d('0x83'),_0x23b1f7[_0x3d4d('0x57')],_0x23b1f7[_0x3d4d('0x84')]||_0x3d4d('0x57'))[_0x3d4d('0x14')](function(_0x3dd333){_0x3bf697(null,_0x3dd333);})[_0x3d4d('0x18')](function(_0x3b0904){_0x3bf697(_0x3b0904);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x85')]=function(_0x28b9b0,_0x2bf80f){scripts[_0x3d4d('0x85')](this[_0x3d4d('0xe')][_0x3d4d('0x34')],_0x28b9b0['aws_access_key_id'],_0x28b9b0['aws_secret_access_key'],_0x28b9b0[_0x3d4d('0x86')],_0x28b9b0[_0x3d4d('0x57')],_0x28b9b0[_0x3d4d('0x87')])[_0x3d4d('0x14')](function(_0x4ac7fd){_0x2bf80f(null,_0x4ac7fd);})[_0x3d4d('0x18')](function(_0x5942db){_0x2bf80f(_0x5942db);});};AGIVertices['prototype'][_0x3d4d('0x88')]=function(_0x85ad1c,_0xcd8cb0,_0x32223d){scripts[_0x3d4d('0x88')](_0xcd8cb0,_0x85ad1c[_0x3d4d('0x77')],_0x85ad1c[_0x3d4d('0x89')]||_0x3d4d('0x59'))[_0x3d4d('0x14')](function(_0x4c4254){_0x32223d(null,_0x4c4254);})[_0x3d4d('0x18')](function(_0x5e598){_0x32223d(_0x5e598);});};AGIVertices[_0x3d4d('0x10')]['tildeASR']=function(_0x284936,_0x2c79b2,_0x2e3a70){scripts[_0x3d4d('0x8a')](_0x2c79b2,_0x284936[_0x3d4d('0x8b')],_0x284936['appsecret'],_0x284936[_0x3d4d('0x6d')])['then'](function(_0x8c8e74){_0x2e3a70(null,_0x8c8e74);})['catch'](function(_0x1474d3){_0x2e3a70(_0x1474d3);});};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x8c')]=function(_0x52752a){var _0x959ec4=_[_0x3d4d('0x61')](verticesWithRetry,_0x52752a[_0x3d4d('0x8d')])?_0x52752a:_[_0x3d4d('0x8e')](_0x52752a);for(var _0x281eb5 in _0x959ec4){if(_0x959ec4[_0x3d4d('0x8f')](_0x281eb5)){if(_0x959ec4[_0x281eb5]&&_[_0x3d4d('0x90')](_0x959ec4[_0x281eb5])){if(_[_0x3d4d('0x61')](recursiveMapAttributes,_0x281eb5)){_0x959ec4[_0x281eb5]=this['replaceObjectAllVariables'](_0x959ec4[_0x281eb5]);}else{_0x959ec4[_0x281eb5]=this[_0x3d4d('0x91')](_0x959ec4[_0x281eb5]);}}}}return _0x959ec4;};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x92')]=function(_0x32912c){for(var _0x51cae6 in _0x32912c){if(_0x32912c[_0x3d4d('0x8f')](_0x51cae6)){if(_[_0x3d4d('0x93')](_0x32912c[_0x51cae6])){this[_0x3d4d('0x92')](_0x32912c[_0x51cae6]);}else if(_[_0x3d4d('0x94')](_0x32912c[_0x51cae6])){for(var _0x4684b5=0x0;_0x4684b5<_0x32912c[_0x51cae6][_0x3d4d('0x95')];_0x4684b5++){this[_0x3d4d('0x92')](_0x32912c[_0x51cae6][_0x4684b5]);}}else if(_['isString'](_0x32912c[_0x51cae6])){_0x32912c[_0x51cae6]=this[_0x3d4d('0x91')](_0x32912c[_0x51cae6]);}}}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x96')]=function(_0xa293a4,_0xd5d0fc){for(var _0x4c19a9 in _0xa293a4){if(_0xa293a4['hasOwnProperty'](_0x4c19a9)){if(_[_0x3d4d('0x93')](_0xa293a4[_0x4c19a9])){if(!_[_0x3d4d('0x97')](_0xa293a4[_0x4c19a9])){this[_0x3d4d('0x96')](_0xa293a4[_0x4c19a9],util[_0x3d4d('0x4e')](_0x3d4d('0x98'),_0xd5d0fc,_0x4c19a9));}}else if(_[_0x3d4d('0x94')](_0xa293a4[_0x4c19a9])){for(var _0x15fc9c=0x0;_0x15fc9c<_0xa293a4[_0x4c19a9][_0x3d4d('0x95')];_0x15fc9c++){this[_0x3d4d('0x96')](_0xa293a4[_0x4c19a9][_0x15fc9c],util['format']('%s.%s',_0xd5d0fc,_0x4c19a9+'['+_0x15fc9c+']'));}}else{if(!_[_0x3d4d('0x41')](_0xa293a4[_0x4c19a9])){this['channel'][_0x3d4d('0x99')](util[_0x3d4d('0x4e')]('%s.%s',_0xd5d0fc,_0x4c19a9),_0xa293a4[_0x4c19a9]);}}}}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x9a')]=function(_0x57f440){try{var _0x56a80a=JSON['parse'](_0x57f440);this['recursiveNodeIndex'](_0x56a80a);return JSON['stringify'](_0x56a80a);}catch(_0x54f89c){return this[_0x3d4d('0x91')](_0x57f440);}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x91')]=function(_0x44ab57){var _0x116a13=_0x44ab57[_0x3d4d('0x9b')]('{');for(var _0x62ea75=0x1;_0x62ea75<_0x116a13[_0x3d4d('0x95')];_0x62ea75+=0x1){var _0x3fe2c2=_0x116a13[_0x62ea75][_0x3d4d('0x9b')]('}');if(_0x3fe2c2[_0x3d4d('0x95')]>0x1){_0x44ab57=_0x44ab57[_0x3d4d('0x9c')]('{'+_0x3fe2c2[0x0]+'}',this[_0x3d4d('0xe')][_0x3d4d('0x11')](_0x3fe2c2[0x0])['extra']||_0x3fe2c2[0x0]);}}if(_0x116a13[_0x3d4d('0x95')]===0x1){return _0x44ab57[_0x3d4d('0x9d')]();}return this[_0x3d4d('0x91')](_0x44ab57);};AGIVertices[_0x3d4d('0x10')]['getAndSetVariable']=function(_0x50982a,_0x4ebd53){var _0x2a810e=this['channel'][_0x3d4d('0x11')](_0x50982a);if(_0x2a810e[_0x3d4d('0x9e')]===-0x1){return _0x2a810e;}logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x9f'),_0x4ebd53,_0x2a810e[_0x3d4d('0xa0')]));return this[_0x3d4d('0xe')][_0x3d4d('0x99')](_0x4ebd53,_0x2a810e[_0x3d4d('0xa0')]);};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x7e')]=function(_0x34074f){return _0x34074f&&_0x34074f!=='0'&&_0x34074f!=='-1'&&_0x34074f!=='';};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xa1')]=function(_0x45c53e){this[_0x3d4d('0x33')]['sync'](this,_0x45c53e,'-');_0x45c53e[_0x3d4d('0xa2')]=_0x45c53e[_0x3d4d('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x8')]=function(_0x3006ff){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0xa3'),_0x3006ff[_0x3d4d('0xa4')]));return this[_0x3d4d('0xe')]['agi']([_0x3006ff['command'],_0x3006ff[_0x3d4d('0xa5')]]);};AGIVertices['prototype']['answer']=function(_0x4db350){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0xa6'),_0x4db350['label']));if(this[_0x3d4d('0x7e')](_0x4db350[_0x3d4d('0x5f')])){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0xa7'),_0x4db350[_0x3d4d('0x5f')]));var _0x263d51=this[_0x3d4d('0xe')]['wait'](_0x4db350['timeout']);if(_0x263d51[_0x3d4d('0x9e')]===-0x1){return _0x263d51;}}return this[_0x3d4d('0xe')][_0x3d4d('0xa8')]();};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x48')]=function(_0xbc41e6){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0xa9'),_0xbc41e6[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0xbc41e6[_0x3d4d('0x46')])){return this['channel']['error'](_0xbc41e6,_0x3d4d('0xaa'));}_0xbc41e6[_0x3d4d('0x47')]=moment();if(this[_0x3d4d('0x7e')](_0xbc41e6[_0x3d4d('0xab')])){_0xbc41e6[_0x3d4d('0x47')]=moment()[_0x3d4d('0xac')](_0xbc41e6['delay'],_0x3d4d('0xad'));}if(!this[_0x3d4d('0x7e')](_0xbc41e6[_0x3d4d('0xae')])){_0xbc41e6[_0x3d4d('0xae')]=0x2;}this[_0x3d4d('0x40')][_0x3d4d('0x6c')](this,_0xbc41e6);return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xb0'),_0xbc41e6[_0x3d4d('0x45')],_0xbc41e6[_0x3d4d('0x46')],_0xbc41e6[_0x3d4d('0x47')]));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xb1')]=function(_0x49031e){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0xb2'),_0x49031e[_0x3d4d('0xa4')]));var _0x323039=this[_0x3d4d('0xe')][_0x3d4d('0x52')](_0x49031e['application'],_0x49031e['options']);if(_0x323039[_0x3d4d('0x9e')]===-0x1){return _0x323039;}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xb3'),_0x49031e['application'],_0x49031e[_0x3d4d('0x75')]));};AGIVertices[_0x3d4d('0x10')]['lumenvoxtts']=function(_0x1eef90){logger['info'](util[_0x3d4d('0x4e')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1eef90['label']));if(!this['isConfigured'](_0x1eef90[_0x3d4d('0x57')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('no\x20text\x20configured');}var _0x383234='\x22'+_0x1eef90['text']+'\x22';if(this[_0x3d4d('0x7e')](_0x1eef90[_0x3d4d('0x75')])){_0x383234+=','+_0x1eef90[_0x3d4d('0x75')];}var _0x27ae0b=this[_0x3d4d('0xe')]['exec'](_0x3d4d('0xb4'),_0x383234);if(_0x27ae0b[_0x3d4d('0x9e')]===-0x1){return _0x27ae0b;}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('Executed\x20command\x20MRCPSynth\x20%s',_0x383234));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xb5')]=function(_0x5f1df5){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0xb6'),_0x5f1df5['label']));if(!this[_0x3d4d('0x7e')](_0x5f1df5[_0x3d4d('0x57')])){return this['channel'][_0x3d4d('0xaf')](_0x3d4d('0xb7'));}var _0x32ddec='\x22'+_0x5f1df5[_0x3d4d('0x57')]+'\x22';if(this[_0x3d4d('0x7e')](_0x5f1df5['options'])){_0x32ddec+=','+_0x5f1df5[_0x3d4d('0x75')];}var _0x3411de=this[_0x3d4d('0xe')][_0x3d4d('0x52')]('MRCPSynth',_0x32ddec);if(_0x3411de[_0x3d4d('0x9e')]===-0x1){return _0x3411de;}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xb8'),_0x32ddec));};AGIVertices['prototype'][_0x3d4d('0xb9')]=function(_0x185c95){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0xba'),_0x185c95['label']));if(!this['isConfigured'](_0x185c95[_0x3d4d('0xbb')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xbc'));}var _0x1f2803=_0x185c95[_0x3d4d('0xbb')];if(this[_0x3d4d('0x7e')](_0x185c95[_0x3d4d('0x75')])){_0x1f2803+=','+_0x185c95[_0x3d4d('0x75')];}var _0x366085=this[_0x3d4d('0xe')]['exec'](_0x3d4d('0xbd'),_0x1f2803);if(_0x366085['result']===-0x1){return _0x366085;}var _0x43ff80=this[_0x3d4d('0xbe')](_0x3d4d('0xbf'),_0x3d4d('0xc0'));if(_0x43ff80['result']===-0x1){return _0x43ff80;}var _0x48334b=this[_0x3d4d('0xbe')]('RECOG_INPUT()',_0x3d4d('0xc1'));if(_0x48334b[_0x3d4d('0x9e')]===-0x1){return _0x48334b;}var _0x3e613f=this[_0x3d4d('0xbe')](_0x3d4d('0xc2'),_0x3d4d('0xc3'));if(_0x3e613f[_0x3d4d('0x9e')]===-0x1){return _0x3e613f;}return this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1f2803));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xc4')]=function(_0x138ab3){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0xc5'),_0x138ab3[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x138ab3['grammar'])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('no\x20grammar\x20configured');}var _0x76e84d=_0x138ab3['grammar'];if(this['isConfigured'](_0x138ab3[_0x3d4d('0x75')])){_0x76e84d+=','+_0x138ab3[_0x3d4d('0x75')];}var _0xe39b76=this[_0x3d4d('0xe')][_0x3d4d('0x52')](_0x3d4d('0xbd'),_0x76e84d);if(_0xe39b76[_0x3d4d('0x9e')]===-0x1){return _0xe39b76;}var _0x3f8dea=this['getAndSetVariable'](_0x3d4d('0xbf'),_0x3d4d('0xc6'));if(_0x3f8dea[_0x3d4d('0x9e')]===-0x1){return _0x3f8dea;}var _0x274113=this[_0x3d4d('0xbe')](_0x3d4d('0xc7'),_0x3d4d('0xc8'));if(_0x274113['result']===-0x1){return _0x274113;}var _0x440466=this['getAndSetVariable'](_0x3d4d('0xc2'),_0x3d4d('0xc9'));if(_0x440466['result']===-0x1){return _0x440466;}return this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0xca'),_0x76e84d));};AGIVertices['prototype'][_0x3d4d('0xcb')]=function(_0x1abe41){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0xcc'),_0x1abe41[_0x3d4d('0xa4')]));if(!this['isConfigured'](_0x1abe41['odbc_id'])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1abe41,_0x3d4d('0xcd'));}var _0x4dd421=this[_0x3d4d('0x1b')][_0x3d4d('0x6c')](this,_0x1abe41[_0x3d4d('0xce')]);if(!_0x4dd421){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1abe41,'no\x20odbc\x20database\x20found');}if(!this[_0x3d4d('0x7e')](_0x1abe41[_0x3d4d('0xcf')])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1abe41,'no\x20query\x20configured');}var _0x10a462=_0x1abe41[_0x3d4d('0xcf')][_0x3d4d('0x53')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x3d4d('0xaf')](util['format'](_0x3d4d('0xd0'),_0x10a462));var _0x53a949=this[_0x3d4d('0x2a')][_0x3d4d('0x6c')](this,_0x4dd421,_0x10a462);this[_0x3d4d('0x33')]['sync'](this,_0x1abe41,_0x10a462);if(!this[_0x3d4d('0x7e')](_0x1abe41['variable_id'])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xd1'));}var _0x232d1=this[_0x3d4d('0x11')]['sync'](this,_0x1abe41[_0x3d4d('0xd2')]);if(!_0x232d1){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1abe41,_0x3d4d('0xd3'));}var _0x10aed4=this;_0x53a949[_0x3d4d('0xd4')](function(_0x2294f6,_0x282f76){Object[_0x3d4d('0xd5')](_0x2294f6)[_0x3d4d('0xd4')](function(_0x1e7d0d){_0x10aed4['channel']['setVariable'](util[_0x3d4d('0x4e')](_0x3d4d('0xd6'),_0x232d1,_0x282f76,_0x1e7d0d),_0x2294f6[_0x1e7d0d]);});});this[_0x3d4d('0xe')][_0x3d4d('0x99')](util['format'](_0x3d4d('0xd7'),_0x232d1),_0x53a949[_0x3d4d('0x95')]);return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xd8'),_0x232d1));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xd9')]=function(_0x101574){logger['debug'](util[_0x3d4d('0x4e')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x101574[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x101574[_0x3d4d('0xda')])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x101574,_0x3d4d('0xdb'));}var _0x58db15=this['getUser'][_0x3d4d('0x6c')](this,_0x101574[_0x3d4d('0xda')]);if(!_0x58db15){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x101574,_0x3d4d('0xdc'));}var _0x1e67e7=this[_0x3d4d('0xe')]['exec'](_0x3d4d('0xdd'),[util['format'](_0x3d4d('0xde'),_0x58db15),_0x101574['timeout'],_0x101574['opts'],_0x101574[_0x3d4d('0xdf')]]);if(_0x1e67e7[_0x3d4d('0x9e')]===-0x1){return _0x1e67e7;}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0xe0'),_0x3d4d('0xdd')));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xe1')]=function(_0x41caf4){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x41caf4['label']));if(!this[_0x3d4d('0x7e')](_0x41caf4[_0x3d4d('0x77')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xe2'));}if(!this[_0x3d4d('0x7e')](_0x41caf4[_0x3d4d('0x57')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xb7'));}this[_0x3d4d('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x41caf4);this[_0x3d4d('0x3f')](_0x41caf4[_0x3d4d('0x57')],'in');this['channel']['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0xe3'),_0x41caf4[_0x3d4d('0x57')]));var _0x416833=this[_0x3d4d('0x76')]['sync'](this,_0x41caf4);if(_0x416833){for(var _0x43dc45 in _0x416833){if(_0x416833[_0x3d4d('0x8f')](_0x43dc45)){this[_0x3d4d('0xe')]['setVariable'](util[_0x3d4d('0x4e')](_0x3d4d('0xe4'),_0x43dc45[_0x3d4d('0x64')]()),_0x416833[_0x43dc45]);}}this[_0x3d4d('0x3f')](_0x416833['speech'],_0x3d4d('0xe5'));return this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xe6'),_0x416833[_0x3d4d('0xe7')]));}return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x41caf4,_0x3d4d('0xe8'));};AGIVertices[_0x3d4d('0x10')]['sesteknda']=function(_0x1b140d){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0xe9'),_0x1b140d[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x1b140d[_0x3d4d('0xea')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xeb'));}if(!this[_0x3d4d('0x7e')](_0x1b140d['username'])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xec'));}if(!this['isConfigured'](_0x1b140d[_0x3d4d('0xed')])){return this['channel'][_0x3d4d('0xaf')]('no\x20password\x20configured');}if(!this[_0x3d4d('0x7e')](_0x1b140d[_0x3d4d('0xee')])){return this['channel'][_0x3d4d('0xaf')](_0x3d4d('0xb7'));}this[_0x3d4d('0xe')][_0x3d4d('0xef')]=!![];this[_0x3d4d('0x33')](_0x1b140d);this[_0x3d4d('0x3f')](_0x1b140d[_0x3d4d('0x57')],'in');this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xf0'),_0x1b140d['text']));var _0x5ee60a=this[_0x3d4d('0x79')][_0x3d4d('0x6c')](this,_0x1b140d);if(_0x5ee60a){for(var _0x292a73 in _0x5ee60a){if(_0x5ee60a[_0x3d4d('0x8f')](_0x292a73)){this[_0x3d4d('0xe')][_0x3d4d('0x99')](util[_0x3d4d('0x4e')](_0x3d4d('0xf1'),_0x292a73[_0x3d4d('0x64')]()),_0x5ee60a[_0x292a73]);}}this['createSquareMessage'](_0x5ee60a[_0x3d4d('0xe7')],'out');if(_0x5ee60a[_0x3d4d('0xf2')]){this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x5ee60a[_0x3d4d('0xf2')]));var _0xcb28aa=this['channel'][_0x3d4d('0xf3')](_0x5ee60a['audiofile']);try{fs[_0x3d4d('0xf4')](_0x5ee60a[_0x3d4d('0xf2')]+_0x3d4d('0xf5'));}catch(_0x45b9e0){logger[_0x3d4d('0x2b')](_0x45b9e0);}return _0xcb28aa;}else{return this[_0x3d4d('0xe')]['noop'](util['format'](_0x3d4d('0xf6'),_0x5ee60a[_0x3d4d('0xe7')]));}}return this['channel'][_0x3d4d('0x2b')](_0x1b140d,_0x3d4d('0xf7'));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xf8')]=function(_0x5ecfd6){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5ecfd6[_0x3d4d('0xa4')]));return this[_0x3d4d('0xe')]['noop'](_0x3d4d('0xf8'));};AGIVertices[_0x3d4d('0x10')]['ext_dial']=function(_0x4ee8c2){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0xf9'),_0x4ee8c2[_0x3d4d('0xa4')]));var _0x5a27bc='';if(_0x4ee8c2[_0x3d4d('0xfa')]){if(!this[_0x3d4d('0x7e')](_0x4ee8c2[_0x3d4d('0xfa')])){return this[_0x3d4d('0xe')]['error'](_0x4ee8c2,_0x3d4d('0xfb'));}else{var _0x2faec8=parseInt(_0x4ee8c2[_0x3d4d('0xfa')],0xa);if(isNaN(_0x2faec8)){_0x5a27bc=_0x4ee8c2[_0x3d4d('0xfa')];}else{_0x5a27bc=this[_0x3d4d('0xfc')][_0x3d4d('0x6c')](this,_0x4ee8c2[_0x3d4d('0xfa')]);if(!_0x5a27bc){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x4ee8c2,_0x3d4d('0xfd'));}}}}else if(_0x4ee8c2[_0x3d4d('0xfe')]){_0x5a27bc=_0x4ee8c2[_0x3d4d('0xfe')];}else{return this[_0x3d4d('0xe')]['error'](_0x4ee8c2,_0x3d4d('0xfb'));}var _0x34449a=this[_0x3d4d('0xe')][_0x3d4d('0x52')]('DIAL',[util[_0x3d4d('0x4e')]('SIP/%s/%s',_0x5a27bc,_0x4ee8c2[_0x3d4d('0x45')]),_0x4ee8c2[_0x3d4d('0x5f')],_0x4ee8c2['opts'],_0x4ee8c2['url']]);if(_0x34449a['result']===-0x1){return _0x34449a;}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xe0'),_0x3d4d('0xdd')));};AGIVertices[_0x3d4d('0x10')]['finally']=function(_0x395e57){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0xff'),_0x395e57[_0x3d4d('0xa4')]));return this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('finally');};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x100')]=function(_0x230441){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x101'),_0x230441[_0x3d4d('0xa4')]));if(_0x230441['retry']===0x0){return this['maxRetry'](_0x230441);}_0x230441[_0x3d4d('0xa2')]-=0x1;if(!this[_0x3d4d('0x7e')](_0x230441['file_id'])){return this['channel']['error'](_0x230441,_0x3d4d('0x102'));}var _0x56bb09=this[_0x3d4d('0x103')][_0x3d4d('0x6c')](this,_0x230441[_0x3d4d('0x104')]);if(!_0x56bb09){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x230441,_0x3d4d('0x105'));}if(!this[_0x3d4d('0x7e')](_0x230441[_0x3d4d('0xd2')])){return this[_0x3d4d('0xe')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1ccb40=this[_0x3d4d('0xe')][_0x3d4d('0x106')](_0x56bb09,_0x230441[_0x3d4d('0x107')],_0x230441[_0x3d4d('0x108')]);var _0x33c164=_0x1ccb40[_0x3d4d('0x9e')]?_0x1ccb40[_0x3d4d('0x9e')][_0x3d4d('0x9d')]():'';logger[_0x3d4d('0x2c')](_0x3d4d('0x109'),JSON['stringify'](_0x1ccb40));if(_0x1ccb40[_0x3d4d('0x9e')]===-0x1){this[_0x3d4d('0x33')][_0x3d4d('0x6c')](this,_0x230441,_0x33c164);return _0x1ccb40;}else if(_0x1ccb40['extra']===_0x3d4d('0x5f')){_0x1ccb40['result']=_0x33c164[_0x3d4d('0x95')]>=parseInt(_0x230441['mindigit'])?'x':'i';}else{_0x1ccb40['result']=_0x33c164[_0x3d4d('0x95')]>=parseInt(_0x230441[_0x3d4d('0x10a')])&&_0x33c164[_0x3d4d('0x95')]<=parseInt(_0x230441[_0x3d4d('0x108')])?'x':'i';}var _0x135180=this['getVariable'][_0x3d4d('0x6c')](this,_0x230441[_0x3d4d('0xd2')]);if(!_0x135180){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x230441,_0x3d4d('0xd3'));}this[_0x3d4d('0xe')][_0x3d4d('0x99')](_0x135180,_0x33c164);if(this['isConfigured'](_0x230441['hiddendigitsnum'])){var _0x2183d5=parseInt(_0x230441[_0x3d4d('0x10b')],0xa);var _0x47b0d9=rs[_0x3d4d('0x10c')]({'charset':'*','length':_0x2183d5});var _0x364bf6=_0x33c164[_0x3d4d('0x95')];if(_0x364bf6>0x0){if(_0x364bf6>_0x2183d5){this['createSquareDetailsReport'][_0x3d4d('0x6c')](this,_0x230441,_0x230441['hiddendigitspos']==='first'?_0x47b0d9+_0x33c164[_0x3d4d('0x10d')](_0x2183d5):_0x33c164[_0x3d4d('0x10d')](0x0,_0x364bf6-_0x2183d5)+_0x47b0d9);}else{this[_0x3d4d('0x33')][_0x3d4d('0x6c')](this,_0x230441,rs[_0x3d4d('0x10c')]({'charset':'*','length':_0x364bf6}));}}else{this[_0x3d4d('0x33')][_0x3d4d('0x6c')](this,_0x230441,'');}}else{this[_0x3d4d('0x33')]['sync'](this,_0x230441,_0x33c164);}return _0x1ccb40;};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0xd')]=function(_0x387c6b){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x10e'),_0x387c6b[_0x3d4d('0xa4')]));return this[_0x3d4d('0x100')](_0x387c6b);};AGIVertices[_0x3d4d('0x10')]['goal']=function(_0x16c906){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0x10f'),_0x16c906[_0x3d4d('0xa4')]));this[_0x3d4d('0x33')]['sync'](this,_0x16c906,_0x16c906[_0x3d4d('0x110')]);return this['channel']['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0x111'),_0x16c906[_0x3d4d('0x110')]));};AGIVertices['prototype'][_0x3d4d('0x112')]=function(_0xc3e079){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x113'),_0xc3e079['label']));if(!this['isConfigured'](_0xc3e079[_0x3d4d('0x114')])||!this[_0x3d4d('0x7e')](_0xc3e079['aws_secret_access_key'])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x115'));}if(!this[_0x3d4d('0x7e')](_0xc3e079[_0x3d4d('0x57')])){return this[_0x3d4d('0xe')]['noop'](_0x3d4d('0xb7'));}this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x116'),_0xc3e079[_0x3d4d('0x57')]));var _0x463f8a=this['awsPolly'][_0x3d4d('0x6c')](this,_0xc3e079);if(_0x463f8a){this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('aws\x20Polly\x20%s\x20file\x20created',_0x463f8a));var _0x16fa3f=this[_0x3d4d('0xe')][_0x3d4d('0xf3')](_0x463f8a);try{fs['unlink'](_0x463f8a+'.wav');}catch(_0x63fc10){logger[_0x3d4d('0x2b')](_0x63fc10);}return _0x16fa3f;}return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0xc3e079,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x117')]=function(_0x43a819){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0x118'),_0x43a819['label']));if(!this[_0x3d4d('0x7e')](_0x43a819['aws_access_key_id'])||!this[_0x3d4d('0x7e')](_0x43a819['aws_secret_access_key'])){return this[_0x3d4d('0xe')]['noop'](_0x3d4d('0x115'));}if(!this[_0x3d4d('0x7e')](_0x43a819[_0x3d4d('0x87')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x119'));}if(!this['isConfigured'](_0x43a819[_0x3d4d('0x57')])){return this['channel'][_0x3d4d('0xaf')](_0x3d4d('0xb7'));}this[_0x3d4d('0xe')][_0x3d4d('0xef')]=!![];this['createSquareDetailsReport'](_0x43a819);this[_0x3d4d('0x3f')](_0x43a819[_0x3d4d('0x57')],'in');this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x11a'),_0x43a819[_0x3d4d('0x57')]));var _0xaa85a3=this[_0x3d4d('0x85')][_0x3d4d('0x6c')](this,_0x43a819);if(_0xaa85a3){for(var _0x270c9d in _0xaa85a3){if(_0xaa85a3[_0x3d4d('0x8f')](_0x270c9d)&&_['isString'](_0xaa85a3[_0x270c9d])){this[_0x3d4d('0xe')]['setVariable'](util[_0x3d4d('0x4e')]('AWS_LEX_%s',_0x270c9d['toUpperCase']()),_0xaa85a3[_0x270c9d]);}}if(_[_0x3d4d('0x41')](_0xaa85a3[_0x3d4d('0x73')])){return this[_0x3d4d('0xe')]['noop'](_0x3d4d('0x11b'));}else{this['createSquareMessage'](_0xaa85a3['message'],_0x3d4d('0xe5'));return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('Amazon\x20Lex\x20Result\x20%s',_0xaa85a3[_0x3d4d('0x73')]));}}return this['channel'][_0x3d4d('0x2b')](_0x43a819,_0x3d4d('0x11c'));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x11d')]=function(_0x360b55){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x11e'),_0x360b55[_0x3d4d('0xa4')],_0x360b55['timeout']));if(!this[_0x3d4d('0x7e')](_0x360b55[_0x3d4d('0x77')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xe2'));}var _0x3209ae=_0x3d4d('0x11f');var _0x2ec00c=util[_0x3d4d('0x4e')](_0x3d4d('0x120'),FILES_PATH,rs[_0x3d4d('0x10c')](0x4));var _0x1a3a68=util[_0x3d4d('0x4e')](_0x3d4d('0x98'),_0x2ec00c,_0x3209ae);var _0x19233e=!![];if(_0x360b55[_0x3d4d('0x121')]===_0x3d4d('0x122')){_0x19233e=![];}var _0x2308be=this['channel']['recordFile'](_0x2ec00c,_0x3209ae,_0x360b55[_0x3d4d('0x123')],_0x360b55[_0x3d4d('0x5f')],undefined,_0x19233e);if(_0x2308be['result']!==-0x1){this['channel'][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x124'),_0x1a3a68));var _0x342201=this['googleASR'][_0x3d4d('0x6c')](this,_0x360b55,_0x1a3a68);if(_0x342201){for(var _0x3d068c in _0x342201){if(_0x342201[_0x3d4d('0x8f')](_0x3d068c)){this[_0x3d4d('0xe')][_0x3d4d('0x99')](util[_0x3d4d('0x4e')](_0x3d4d('0x125'),_0x3d068c[_0x3d4d('0x64')]()),_0x342201[_0x3d068c]);}}return this['channel'][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x126'),JSON[_0x3d4d('0x6f')](_0x342201)));}}return _0x2308be;};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x127')]=function(_0xcf02d4){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x128'),_0xcf02d4['label']));if(!this[_0x3d4d('0x7e')](_0xcf02d4[_0x3d4d('0x8b')])){return this['channel'][_0x3d4d('0xaf')](_0x3d4d('0x129'));}if(!this[_0x3d4d('0x7e')](_0xcf02d4[_0x3d4d('0x12a')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x12b'));}var _0x320861=_0x3d4d('0x11f');var _0x3037fb=util['format'](_0x3d4d('0x120'),FILES_PATH,rs['generate'](0x4));var _0x42290b=util[_0x3d4d('0x4e')](_0x3d4d('0x98'),_0x3037fb,_0x320861);var _0x2040db=!![];if(_0xcf02d4['beep']===_0x3d4d('0x122')){_0x2040db=![];}var _0x2a130b=this[_0x3d4d('0xe')]['recordFile'](_0x3037fb,_0x320861,_0xcf02d4[_0x3d4d('0x123')],_0xcf02d4[_0x3d4d('0x5f')],undefined,_0x2040db);if(_0x2a130b[_0x3d4d('0x9e')]!==-0x1){this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')]('tilde\x20%s\x20file\x20created',_0x42290b));var _0x2ca407=this['tildeASR'][_0x3d4d('0x6c')](this,_0xcf02d4,_0x42290b);if(_0x2ca407){for(var _0x3ee09e in _0x2ca407){if(_0x2ca407[_0x3d4d('0x8f')](_0x3ee09e)){this['channel'][_0x3d4d('0x99')](util[_0x3d4d('0x4e')](_0x3d4d('0x12c'),_0x3ee09e['toUpperCase']()),_0x2ca407[_0x3ee09e]);}}return this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x12d'),JSON[_0x3d4d('0x6f')](_0x2ca407)));}}return _0x2a130b;};AGIVertices[_0x3d4d('0x10')]['gotoc']=function(_0x43194c){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0x12e'),_0x43194c[_0x3d4d('0xa4')]));return this['channel'][_0x3d4d('0x12f')](_0x43194c[_0x3d4d('0x38')],_0x43194c['extension'],_0x43194c[_0x3d4d('0x3a')]);};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x130')]=function(_0x3c3cfc){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x131'),_0x3c3cfc[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x3c3cfc['condition'])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x3c3cfc,_0x3d4d('0x132'));}try{var _0x4fee6a=eval(_0x3c3cfc['condition'])?_0x3d4d('0x133'):_0x3d4d('0x134');this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0x135'),_0x3c3cfc[_0x3d4d('0x136')],_0x4fee6a));return{'code':0xc8,'result':_0x4fee6a};}catch(_0x32cc39){return{'code':0xc8,'result':_0x3d4d('0x134')};}};AGIVertices['prototype'][_0x3d4d('0x137')]=function(_0xba235e){logger['info'](util['format'](_0x3d4d('0x138'),_0xba235e[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0xba235e[_0x3d4d('0x139')])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0xba235e,'no\x20interval\x20configured');}var _0x3d37e2=this[_0x3d4d('0x24')][_0x3d4d('0x6c')](this,_0xba235e['interval_id']);if(!_0x3d37e2){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0xba235e,'no\x20intervals\x20found');}for(var _0x1c127a=0x0;_0x1c127a<_0x3d37e2[_0x3d4d('0x95')];_0x1c127a+=0x1){var _0x5aa720=this['channel'][_0x3d4d('0x11')](util['format'](_0x3d4d('0x13a'),_0x3d37e2[_0x1c127a]));if(_0x5aa720[_0x3d4d('0x9e')]===-0x1){return _0x5aa720;}logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x13b'),_0x3d37e2[_0x1c127a],_0x5aa720[_0x3d4d('0xa0')]));if(_0x5aa720[_0x3d4d('0xa0')]===_0x3d4d('0x133')){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x13b'),_0x3d37e2[_0x1c127a],'true'));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x13b'),_0x3d37e2[_0x1c127a],_0x3d4d('0x133')));return{'code':0xc8,'result':_0x3d4d('0x133')};}else{logger['info'](util[_0x3d4d('0x4e')]('IFTIME\x20%s\x20%s',_0x3d37e2[_0x1c127a],_0x3d4d('0x134')));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x13b'),_0x3d37e2[_0x1c127a],'false'));}}return{'code':0xc8,'result':_0x3d4d('0x134')};};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x13c')]=function(_0x327e23){logger['info'](util['format'](_0x3d4d('0x13d'),_0x327e23[_0x3d4d('0xa4')]));return this[_0x3d4d('0xe')]['hangup']();};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x13e')]=function(_0xb5cb22){logger[_0x3d4d('0x2c')](util['format'](_0x3d4d('0x13f'),_0xb5cb22[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0xb5cb22[_0x3d4d('0x77')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xe2'));}var _0x4b9e68=_0x3d4d('0x11f');var _0xf912e4=util[_0x3d4d('0x4e')](_0x3d4d('0x120'),FILES_PATH,rs[_0x3d4d('0x10c')](0x4));var _0x2d86c7=util[_0x3d4d('0x4e')]('%s.%s',_0xf912e4,_0x4b9e68);var _0x97abd9=!![];if(_0xb5cb22[_0x3d4d('0x121')]===_0x3d4d('0x122')){_0x97abd9=![];}var _0x369ffa=this['channel'][_0x3d4d('0x140')](_0xf912e4,_0x4b9e68,_0xb5cb22['intKey'],_0xb5cb22[_0x3d4d('0x5f')],undefined,_0x97abd9);if(_0x369ffa[_0x3d4d('0x9e')]!==-0x1){this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x141'),_0x2d86c7));var _0x3c10fd=this[_0x3d4d('0x7c')][_0x3d4d('0x6c')](this,_0xb5cb22,_0x2d86c7);if(_0x3c10fd){for(var _0x37d25c in _0x3c10fd){if(_0x3c10fd[_0x3d4d('0x8f')](_0x37d25c)){this[_0x3d4d('0xe')]['setVariable'](util[_0x3d4d('0x4e')](_0x3d4d('0x142'),_0x37d25c['toUpperCase']()),_0x3c10fd[_0x37d25c]);}}return this['channel'][_0x3d4d('0xaf')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x3c10fd)));}}return _0x369ffa;};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x143')]=function(_0x1e1118){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x144'),_0x1e1118[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x1e1118[_0x3d4d('0x77')])){return this['channel']['noop'](_0x3d4d('0xe2'));}if(!this['isConfigured'](_0x1e1118[_0x3d4d('0x57')])){return this['channel']['noop'](_0x3d4d('0xb7'));}this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('Trying\x20ispeech\x20TTS\x20%s',_0x1e1118['text']));var _0x4bfc0b=this[_0x3d4d('0x7a')][_0x3d4d('0x6c')](this,_0x1e1118);if(_0x4bfc0b){this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0x141'),_0x4bfc0b));var _0x5cafdb=this['channel'][_0x3d4d('0xf3')](_0x4bfc0b,_0x1e1118[_0x3d4d('0x123')]);try{fs[_0x3d4d('0xf4')](_0x4bfc0b+'.wav');}catch(_0x13a3f7){logger[_0x3d4d('0x2b')](_0x13a3f7);}return _0x5cafdb;}return this['channel']['error'](_0x1e1118,_0x3d4d('0x145'));};AGIVertices['prototype'][_0x3d4d('0x146')]=function(_0x3d2071){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x147'),_0x3d2071[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x3d2071['findBy'])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x3d2071,_0x3d4d('0x148'));}logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x149'),this['channel'][_0x3d4d('0x35')],_0x3d2071['findBy']));var _0x1b000f=this[_0x3d4d('0x50')]['sync'](this,_0x3d2071[_0x3d4d('0x14a')]);if(_0x1b000f){logger['info'](util[_0x3d4d('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x3d2071[_0x3d4d('0x14a')]));this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x3d2071[_0x3d4d('0x14a')]));return{'code':0xc8,'result':_0x3d4d('0x14b')};}else{logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x14c'),this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x3d2071['findBy']));this['channel'][_0x3d4d('0xaf')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x3d2071['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x14d')]=function(_0x167735){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x167735[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x167735['findBy'])){return this[_0x3d4d('0xe')]['error'](_0x167735,'no\x20find\x20by\x20configured');}logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x149'),this['channel'][_0x3d4d('0x35')],_0x167735[_0x3d4d('0x14a')]));var _0x58f5d8=this['agentLogout'][_0x3d4d('0x6c')](this,_0x167735['findBy']);if(_0x58f5d8){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x14e'),this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x167735[_0x3d4d('0x14a')]));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x14e'),this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x167735[_0x3d4d('0x14a')]));return{'code':0xc8,'result':_0x3d4d('0x14b')};}else{logger['info'](util['format'](_0x3d4d('0x14c'),this[_0x3d4d('0xe')]['callerid'],_0x167735['findBy']));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x14c'),this[_0x3d4d('0xe')]['callerid'],_0x167735[_0x3d4d('0x14a')]));return{'code':0xc8,'result':_0x3d4d('0x14f')};}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x150')]=function(_0x501816){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x501816[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x501816['operation'])){return this['channel']['error'](_0x501816,_0x3d4d('0x151'));}this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0x152'),_0x501816[_0x3d4d('0x153')]));var _0x5a5bb0=eval(_0x501816['operation']);if(!this[_0x3d4d('0x7e')](_0x501816[_0x3d4d('0xd2')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xd1'));}var _0x26095b=this[_0x3d4d('0x11')]['sync'](this,_0x501816[_0x3d4d('0xd2')]);if(!_0x26095b){return this['channel'][_0x3d4d('0x2b')](_0x501816,_0x3d4d('0xd3'));}if(_[_0x3d4d('0x94')](_0x5a5bb0)){var _0x432e32=this;_0x5a5bb0['forEach'](function(_0x15f9f7,_0x1c7816){_0x432e32[_0x3d4d('0xe')][_0x3d4d('0x99')](util[_0x3d4d('0x4e')]('%s[%s]',_0x26095b,_0x1c7816),_0x15f9f7);});return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('variable\x20%s[key]\x20set',_0x26095b));}else{return this[_0x3d4d('0xe')][_0x3d4d('0x99')](_0x26095b,_0x5a5bb0);}};AGIVertices['prototype'][_0x3d4d('0xc')]=function(_0x184342){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x154'),_0x184342[_0x3d4d('0xa4')]));if(_0x184342[_0x3d4d('0xa2')]===0x0){return this['maxRetry'](_0x184342);}_0x184342['retry']-=0x1;if(!this[_0x3d4d('0x7e')](_0x184342[_0x3d4d('0x104')])){return this['channel']['error'](_0x184342,_0x3d4d('0x102'));}var _0x45258c=this[_0x3d4d('0x103')]['sync'](this,_0x184342[_0x3d4d('0x104')]);if(!_0x45258c){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x184342,'no\x20file\x20audio\x20found');}var _0x45975f=this[_0x3d4d('0xe')][_0x3d4d('0x106')](_0x45258c,_0x184342[_0x3d4d('0x107')],_0x184342[_0x3d4d('0x155')]);var _0x711e90=_0x45975f[_0x3d4d('0x9e')];if(_0x45975f['result']===-0x1){this[_0x3d4d('0x33')][_0x3d4d('0x6c')](this,_0x184342,'-1');return _0x45975f;}else if(_0x45975f['extra']===_0x3d4d('0x5f')){_0x45975f[_0x3d4d('0x9e')]=_0x45975f['result'][_0x3d4d('0x95')]>0x0?_0x45975f[_0x3d4d('0x9e')]:'t';}else if(_[_0x3d4d('0x97')](_0x45975f[_0x3d4d('0x9e')])){_0x45975f['result']='#';_0x711e90='#';}if(!this[_0x3d4d('0x7e')](_0x184342['variable_id'])){this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xd1'));}else{var _0xbd6a1d=this[_0x3d4d('0x11')]['sync'](this,_0x184342[_0x3d4d('0xd2')]);if(!_0xbd6a1d){return this['channel'][_0x3d4d('0x2b')](_0x184342,_0x3d4d('0xd3'));}this[_0x3d4d('0xe')]['setVariable'](_0xbd6a1d,_0x711e90);}this[_0x3d4d('0x33')]['sync'](this,_0x184342,_0x711e90);return _0x45975f;};AGIVertices['prototype'][_0x3d4d('0xaf')]=function(_0x4473c2){logger['info'](util[_0x3d4d('0x4e')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4473c2[_0x3d4d('0xa4')]));return this['channel'][_0x3d4d('0xaf')](_0x4473c2[_0x3d4d('0x156')]||_0x4473c2[_0x3d4d('0xa4')]);};AGIVertices['prototype']['pause']=function(_0x54c199){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x157'),_0x54c199[_0x3d4d('0xa4')]));if(!this['isConfigured'](_0x54c199[_0x3d4d('0x14a')])){return this['channel'][_0x3d4d('0x2b')](_0x54c199,_0x3d4d('0x148'));}logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x149'),this[_0x3d4d('0xe')]['callerid'],_0x54c199[_0x3d4d('0x14a')]));var _0xcd9936=this[_0x3d4d('0x49')]['sync'](this,_0x54c199[_0x3d4d('0x158')]);var _0x37ab14=this[_0x3d4d('0x4a')][_0x3d4d('0x6c')](this,_0x54c199[_0x3d4d('0x14a')],_0xcd9936);if(_0x37ab14){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x54c199[_0x3d4d('0x14a')]));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x54c199['findBy']));return{'code':0xc8,'result':_0x3d4d('0x14b')};}else{logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x14c'),this['channel'][_0x3d4d('0x35')],_0x54c199['findBy']));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d4d('0xe')]['callerid'],_0x54c199['findBy']));return{'code':0xc8,'result':_0x3d4d('0x14f')};}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x159')]=function(_0x4ba231){logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x15a'),_0x4ba231[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x4ba231[_0x3d4d('0x104')])){return this['channel'][_0x3d4d('0x2b')](_0x4ba231,_0x3d4d('0x102'));}var _0x5f3c62=this[_0x3d4d('0x103')][_0x3d4d('0x6c')](this,_0x4ba231[_0x3d4d('0x104')]);if(!_0x5f3c62){return this['channel']['error'](_0x4ba231,_0x3d4d('0x105'));}var _0x88bb95=this[_0x3d4d('0xe')][_0x3d4d('0x52')]('PLAYBACK',[_0x5f3c62,_0x4ba231[_0x3d4d('0x15b')]]);if(_0x88bb95[_0x3d4d('0x9e')]===-0x1){return _0x88bb95;}return this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xb3'),'PLAYBACK',_0x5f3c62));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x15c')]=function(_0x17d247){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x17d247[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x17d247[_0x3d4d('0x15d')])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x17d247,'no\x20queue\x20selected');}var _0x292941='';var _0x2533ea=parseInt(_0x17d247[_0x3d4d('0x15d')],0xa);if(isNaN(_0x2533ea)){_0x292941=_0x17d247['queue_id'];}else{_0x292941=this['getVoiceQueue'][_0x3d4d('0x6c')](this,_0x17d247[_0x3d4d('0x15d')]);if(!_0x292941){return this[_0x3d4d('0xe')]['error'](_0x17d247,_0x3d4d('0x15e'));}}var _0x35c583='';if(this[_0x3d4d('0x7e')](_0x17d247[_0x3d4d('0x104')])){var _0x4a6715=this[_0x3d4d('0x103')][_0x3d4d('0x6c')](this,_0x17d247[_0x3d4d('0x104')]);if(_0x4a6715){_0x35c583=_0x4a6715;}}this['createSquareDetailsReport']['sync'](this,_0x17d247,_0x292941);if(_0x17d247[_0x3d4d('0x15b')]['indexOf']('x')<0x0){_0x17d247[_0x3d4d('0x15b')]+='x';}if(_0x17d247[_0x3d4d('0x15b')][_0x3d4d('0x15f')]('X')<0x0){_0x17d247[_0x3d4d('0x15b')]+='X';}this[_0x3d4d('0xe')]['setVariable']('XMCS-QUEUE',_0x292941?_0x292941[_0x3d4d('0x160')]():'');var _0x158dc9=this[_0x3d4d('0xe')][_0x3d4d('0x52')]('QUEUE',[_0x292941,_0x17d247[_0x3d4d('0x15b')],_0x17d247['url'],_0x35c583,_0x17d247[_0x3d4d('0x5f')],_0x17d247[_0x3d4d('0x8')],_0x17d247[_0x3d4d('0x161')],_0x17d247['gosub'],'',_0x17d247[_0x3d4d('0x162')]]);if(_0x158dc9[_0x3d4d('0x9e')]===-0x1){return _0x158dc9;}return this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0xb3'),_0x3d4d('0x163'),_0x292941));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x164')]=function(_0x4f8104){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4f8104[_0x3d4d('0xa4')]));var _0x2793b3=_0x4f8104[_0x3d4d('0x165')]||_0x3d4d('0x11f');var _0x582227=util[_0x3d4d('0x4e')]('%s_%s',this[_0x3d4d('0xe')][_0x3d4d('0x34')],rs['generate'](0x5));var _0x116565=util[_0x3d4d('0x4e')](_0x3d4d('0x166'),FILES_PATH,_0x582227,_0x2793b3);var _0x1b0ea4=util['format'](_0x3d4d('0x120'),FILES_PATH,_0x582227);this[_0x3d4d('0x36')][_0x3d4d('0x6c')](this,_0x4f8104,_0x582227,_0x116565);this[_0x3d4d('0xe')][_0x3d4d('0x99')](_0x3d4d('0x167'),_0x582227);logger[_0x3d4d('0x2c')](_0x3d4d('0x168'),_0x1b0ea4,_0x2793b3,_0x4f8104['escape_digits'],_0x4f8104[_0x3d4d('0x5f')]);return this[_0x3d4d('0xe')][_0x3d4d('0x140')](_0x1b0ea4,_0x2793b3,_0x4f8104['escape_digits'],_0x4f8104[_0x3d4d('0x5f')],undefined,!![]);};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x169')]=function(_0x1d4045){logger['info'](util[_0x3d4d('0x4e')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1d4045[_0x3d4d('0xa4')]));if(!this['isConfigured'](_0x1d4045[_0x3d4d('0xdf')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('no\x20url\x20configured');}var _0xca85d6=this['restAPI'][_0x3d4d('0x6c')](this,_0x1d4045);logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x16a'),util[_0x3d4d('0x16b')](_0xca85d6,{'showHidden':![],'depth':null})));if(!this[_0x3d4d('0x7e')](_0x1d4045[_0x3d4d('0xd2')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2a7725=this[_0x3d4d('0x11')]['sync'](this,_0x1d4045['variable_id']);if(!_0x2a7725){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1d4045,'no\x20variable\x20found');}this['channel'][_0x3d4d('0x99')](util[_0x3d4d('0x4e')](_0x3d4d('0x16c'),_0x2a7725),_0xca85d6[_0x3d4d('0x71')]?_0xca85d6[_0x3d4d('0x71')]:_0x3d4d('0x16d'));this[_0x3d4d('0xe')][_0x3d4d('0x99')](util['format'](_0x3d4d('0x16e'),_0x2a7725),_0xca85d6[_0x3d4d('0x72')]?_0xca85d6['statusMessage']:'OK');if(_0xca85d6[_0x3d4d('0x65')]){try{this[_0x3d4d('0x96')](_0xca85d6[_0x3d4d('0x65')],_0x2a7725);}catch(_0x56ddd3){logger[_0x3d4d('0x2b')](util[_0x3d4d('0x4e')](_0x3d4d('0x16f'),_0x2a7725));}}return this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0xd8'),_0x2a7725));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x170')]=function(_0x41c26a){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x171'),_0x41c26a['label']));return this['channel'][_0x3d4d('0x172')](_0x41c26a[_0x3d4d('0x173')]['replace'](/\s+/g,''),_0x41c26a[_0x3d4d('0x174')]);};AGIVertices[_0x3d4d('0x10')]['saynumber']=function(_0x536491){logger['info'](util[_0x3d4d('0x4e')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x536491['label']));return this['channel'][_0x3d4d('0x175')](_0x536491['number'][_0x3d4d('0x53')](/\s+/g,''),_0x536491[_0x3d4d('0x174')]);};AGIVertices['prototype'][_0x3d4d('0x176')]=function(_0x42893d){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x177'),_0x42893d[_0x3d4d('0xa4')]));return this['channel'][_0x3d4d('0x178')](_0x42893d[_0x3d4d('0x57')],_0x42893d[_0x3d4d('0x174')]);};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x179')]=function(_0x57bc9d){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x17a'),_0x57bc9d[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x57bc9d['account_id'])){return this['channel']['noop'](_0x3d4d('0x17b'));}var _0x393a2d=this[_0x3d4d('0x21')]['sync'](this,_0x57bc9d[_0x3d4d('0x17c')]);if(!_0x393a2d||!_0x393a2d[_0x3d4d('0x17d')]){return this[_0x3d4d('0xe')]['error'](_0x57bc9d,_0x3d4d('0x17e'));}var _0x38dd36={'from':util[_0x3d4d('0x4e')](_0x3d4d('0x17f'),_0x393a2d[_0x3d4d('0x15')],_0x393a2d[_0x3d4d('0x180')]||_0x393a2d[_0x3d4d('0x17d')]['user']),'to':_0x57bc9d['to']||'','cc':_0x57bc9d['cc']||'','bcc':_0x57bc9d['bcc']||'','subject':_0x57bc9d[_0x3d4d('0x181')],'html':_0x57bc9d[_0x3d4d('0x57')],'text':_0x57bc9d['text']};var _0x2df730={'tls':{'rejectUnauthorized':![]}};if(_0x393a2d[_0x3d4d('0x17d')][_0x3d4d('0x182')]){_0x2df730[_0x3d4d('0x182')]=_0x393a2d['Smtp'][_0x3d4d('0x182')];}else{_0x2df730[_0x3d4d('0x183')]=_0x393a2d[_0x3d4d('0x17d')][_0x3d4d('0x183')];_0x2df730[_0x3d4d('0x184')]=_0x393a2d[_0x3d4d('0x17d')]['port'];_0x2df730[_0x3d4d('0x185')]=_0x393a2d[_0x3d4d('0x17d')]['secure'];}if(_0x393a2d['Smtp'][_0x3d4d('0x186')]){_0x2df730[_0x3d4d('0x187')]={'user':_0x393a2d[_0x3d4d('0x17d')][_0x3d4d('0x188')],'pass':_0x393a2d['Smtp'][_0x3d4d('0x189')]};}if(this[_0x3d4d('0x7e')](_0x57bc9d[_0x3d4d('0x18a')])){}logger['debug'](_0x3d4d('0x18b'),JSON[_0x3d4d('0x6f')](_0x38dd36));this['createSquareDetailsReport'][_0x3d4d('0x6c')](this,_0x57bc9d,_0x57bc9d[_0x3d4d('0x17c')]);this['channel']['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0x18c'),_0x393a2d[_0x3d4d('0x15')]));this[_0x3d4d('0x23')][_0x3d4d('0x6c')](this,_0x2df730,_0x38dd36);return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x18d'));};AGIVertices[_0x3d4d('0x10')]['sendFax']=function(_0x34a342){logger[_0x3d4d('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x34a342[_0x3d4d('0xa4')]));return this['channel'][_0x3d4d('0xaf')](_0x3d4d('0x18e'));};AGIVertices['prototype'][_0x3d4d('0x18f')]=function(_0x49a859){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x190'),_0x49a859[_0x3d4d('0xa4')]));if(!this['isConfigured'](_0x49a859['sms_account_id'])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x191'));}var _0x39b938=this[_0x3d4d('0x31')][_0x3d4d('0x6c')](this,_0x49a859[_0x3d4d('0x192')]);if(!_0x39b938){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x49a859,_0x3d4d('0x193'));}var _0x25e386={'body':_0x49a859[_0x3d4d('0x194')],'phone':_0x49a859['to']||'','SmsAccountId':_0x39b938['id']};logger['debug'](_0x3d4d('0x195'),JSON[_0x3d4d('0x6f')](_0x25e386));this[_0x3d4d('0x33')][_0x3d4d('0x6c')](this,_0x49a859,_0x49a859[_0x3d4d('0x192')]);this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0x196'),_0x39b938[_0x3d4d('0x15')]));this['createSmsMessage'][_0x3d4d('0x6c')](this,_0x25e386);return this['channel'][_0x3d4d('0xaf')](_0x3d4d('0x197'));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x198')]=function(_0x15f630){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x199'),_0x15f630[_0x3d4d('0xa4')]));if(!this['isConfigured'](_0x15f630[_0x3d4d('0xd2')])){return this[_0x3d4d('0xe')]['error'](_0x15f630,_0x3d4d('0x19a'));}var _0x32c248=this[_0x3d4d('0x11')][_0x3d4d('0x6c')](this,_0x15f630[_0x3d4d('0xd2')]);if(!_0x32c248){return this['channel'][_0x3d4d('0x2b')](_0x15f630,_0x3d4d('0xd3'));}return this['channel'][_0x3d4d('0x99')](_0x32c248,_0x15f630['variable_value']);};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x19b')]=function(_0x27a796){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x19c'),_0x27a796['label']));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x19d'));if(_0x27a796[_0x3d4d('0xa8')]==='yes'){this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('Answer');return this['channel'][_0x3d4d('0xa8')]();}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x19e'));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x19f')]=function(_0x1f822f){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1f822f[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x1f822f['project_id'])){return this['channel']['error'](_0x1f822f,'no\x20subproject\x20selected');}var _0x2f5962=this[_0x3d4d('0x19')]['sync'](this,_0x1f822f[_0x3d4d('0x1a0')]);if(!this[_0x3d4d('0x7e')](_0x2f5962)){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1f822f,util[_0x3d4d('0x4e')](_0x3d4d('0x1a1'),_0x1f822f['project_id']));}if(_0x2f5962===this[_0x3d4d('0xe')][_0x3d4d('0x3d')]){return this[_0x3d4d('0xe')]['error'](_0x1f822f,_0x3d4d('0x1a2'));}this[_0x3d4d('0x33')]['sync'](this,_0x1f822f,_0x2f5962);var _0x388d53=this[_0x3d4d('0xe')]['exec'](_0x3d4d('0x1a3'),util[_0x3d4d('0x4e')](_0x3d4d('0x1a4'),config[_0x3d4d('0x8')][_0x3d4d('0x183')]||_0x3d4d('0x1a5'),_0x2f5962,this[_0x3d4d('0xe')][_0x3d4d('0x3d')]));if(_0x388d53['result']===-0x1){return _0x388d53;}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0xb3'),'AGI',_0x2f5962));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x1a6')]=function(_0x57887e){logger['info'](util['format'](_0x3d4d('0x1a7'),_0x57887e[_0x3d4d('0xa4')]));var _0x2f72da=this[_0x3d4d('0x51')][_0x3d4d('0x6c')](this,_0x57887e['command']);this[_0x3d4d('0x33')][_0x3d4d('0x6c')](this,_0x57887e,_0x57887e[_0x3d4d('0x1a8')]);if(this[_0x3d4d('0x7e')](_0x57887e[_0x3d4d('0xd2')])){var _0x3144ca=this[_0x3d4d('0x11')]['sync'](this,_0x57887e[_0x3d4d('0xd2')]);if(_0x3144ca){this[_0x3d4d('0xe')][_0x3d4d('0x99')](_0x3144ca,_0x2f72da);return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x1a9'),_0x57887e[_0x3d4d('0x1a8')],_0x3144ca));}}return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x57887e[_0x3d4d('0x1a8')]));};AGIVertices['prototype'][_0x3d4d('0x1aa')]=function(_0x1ff2a0){logger[_0x3d4d('0x2c')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1ff2a0[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x1ff2a0[_0x3d4d('0x55')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0x1ab'));}if(!this[_0x3d4d('0x7e')](_0x1ff2a0[_0x3d4d('0x57')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')]('no\x20text\x20configured');}this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1ff2a0['text']));var _0x5c92d5=this[_0x3d4d('0x54')][_0x3d4d('0x6c')](this,_0x1ff2a0);if(_0x5c92d5){this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x1ac'),_0x5c92d5));var _0x23d2f1=this[_0x3d4d('0xe')]['streamFile'](_0x5c92d5);try{fs[_0x3d4d('0xf4')](_0x5c92d5+'.wav');}catch(_0x36b258){logger[_0x3d4d('0x2b')](_0x36b258);}return _0x23d2f1;}return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x1ff2a0,_0x3d4d('0x1ad'));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x1ae')]=function(_0x541dae){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x1af'),_0x541dae['label']));if(!this[_0x3d4d('0x7e')](_0x541dae[_0x3d4d('0x57')])){return this[_0x3d4d('0xe')][_0x3d4d('0xaf')](_0x3d4d('0xb7'));}this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x1b0'),_0x541dae[_0x3d4d('0x57')]));var _0x29b2b1=this[_0x3d4d('0x5b')][_0x3d4d('0x6c')](this,_0x541dae);if(_0x29b2b1){this['channel'][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x1b1'),_0x29b2b1));var _0x289b23=this['channel'][_0x3d4d('0xf3')](_0x29b2b1);try{fs[_0x3d4d('0xf4')](_0x29b2b1+_0x3d4d('0xf5'));}catch(_0x4b9000){logger[_0x3d4d('0x2b')](_0x4b9000);}return _0x289b23;}return this['channel'][_0x3d4d('0x2b')](_0x541dae,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x3d4d('0x1b2')]=function(_0x2149ee){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x1b3'),_0x2149ee['label']));if(!this[_0x3d4d('0x7e')](_0x2149ee[_0x3d4d('0x14a')])){return this['channel'][_0x3d4d('0x2b')](_0x2149ee,'no\x20find\x20by\x20configured');}logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x149'),this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x2149ee[_0x3d4d('0x14a')]));var _0x2e7657=this[_0x3d4d('0x4c')]['sync'](this,_0x2149ee[_0x3d4d('0x14a')]);if(_0x2e7657){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3d4d('0xe')]['callerid'],_0x2149ee['findBy']));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util[_0x3d4d('0x4e')](_0x3d4d('0x14e'),this['channel'][_0x3d4d('0x35')],_0x2149ee[_0x3d4d('0x14a')]));return{'code':0xc8,'result':_0x3d4d('0x14b')};}else{logger['info'](util[_0x3d4d('0x4e')](_0x3d4d('0x14c'),this[_0x3d4d('0xe')][_0x3d4d('0x35')],_0x2149ee[_0x3d4d('0x14a')]));this[_0x3d4d('0xe')][_0x3d4d('0xaf')](util['format'](_0x3d4d('0x14c'),this[_0x3d4d('0xe')]['callerid'],_0x2149ee[_0x3d4d('0x14a')]));return{'code':0xc8,'result':_0x3d4d('0x14f')};}};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x1b4')]=function(_0x48ae51){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x1b5'),_0x48ae51['label']));var _0x5b5671=this[_0x3d4d('0xe')][_0x3d4d('0x52')]('VOICEMAIL',[_0x48ae51['mailbox'],_0x48ae51[_0x3d4d('0x75')]]);if(_0x5b5671['result']===-0x1){return _0x5b5671;}return this[_0x3d4d('0xe')]['noop'](util[_0x3d4d('0x4e')](_0x3d4d('0xb3'),_0x3d4d('0x1b6'),_0x48ae51[_0x3d4d('0x1b7')]));};AGIVertices[_0x3d4d('0x10')][_0x3d4d('0x1b8')]=function(_0x4e8839){logger[_0x3d4d('0x2c')](util[_0x3d4d('0x4e')](_0x3d4d('0x1b9'),_0x4e8839[_0x3d4d('0xa4')]));if(!this[_0x3d4d('0x7e')](_0x4e8839[_0x3d4d('0xd2')])){return this[_0x3d4d('0xe')][_0x3d4d('0x2b')](_0x4e8839,_0x3d4d('0x19a'));}var _0x5897d6=this[_0x3d4d('0x11')][_0x3d4d('0x6c')](this,_0x4e8839['variable_id']);if(!_0x5897d6){return this['channel'][_0x3d4d('0x2b')](_0x4e8839,_0x3d4d('0xd3'));}var _0x8f5325=this['channel']['getVariable'](_0x5897d6);return{'code':0xc8,'result':_0x8f5325[_0x3d4d('0xa0')]?_0x8f5325[_0x3d4d('0xa0')]:'-'};};String['prototype']['replaceAll']=function(_0x158ea9,_0x25fd50){return this[_0x3d4d('0x9b')](_0x158ea9)['join'](_0x25fd50);};module[_0x3d4d('0x1ba')]=AGIVertices; \ No newline at end of file +var _0xf0d7=['uri','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','saveRestApiResult','isPlainObject','setVariable','length','split','replaceAll','extra','toString','result','maxRetry','sync','retry','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','delay','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','toUpperCase','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','no\x20file\x20audio\x20found','getData','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','TildeASR\x20Result\x20%s','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','intKey','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','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','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','join','exports','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','rawBody','getdigits','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xf0d7,0x14e));var _0x7f0d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf0d7[_0x1ac595];return _0x455fff;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x7f0d('0x0'));var _=require(_0x7f0d('0x1'));var sh=require(_0x7f0d('0x2'));var odbc=require('odbc')();var rs=require(_0x7f0d('0x3'));var moment=require(_0x7f0d('0x4'));var Mustache=require(_0x7f0d('0x5'));var rp=require(_0x7f0d('0x6'));var logger=require(_0x7f0d('0x7'))(_0x7f0d('0x8'));var config=require('../../config/environment');var scripts=require(_0x7f0d('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x7f0d('0xa')];var verticesWithRetry=['menu',_0x7f0d('0xb'),'getsecretdigits'];var AGIVertices=function(_0x2580cc,_0x93b93b,_0x2646ef){this['channel']=_0x2580cc;this[_0x7f0d('0xc')]=_0x93b93b;this[_0x7f0d('0xd')]=_0x2646ef;};AGIVertices['prototype'][_0x7f0d('0xe')]=function(_0x5f1a56,_0x2c8d9b){this[_0x7f0d('0xc')][_0x7f0d('0xf')](_0x5f1a56)[_0x7f0d('0x10')](function(_0x659b3d){_0x2c8d9b(null,_0x659b3d?_0x659b3d[_0x7f0d('0x11')]:![]);})[_0x7f0d('0x12')](function(_0xf2e78c){_0x2c8d9b(_0xf2e78c);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x14')]=function(_0x1eed53,_0x20ca12){this['rpc'][_0x7f0d('0x15')](_0x1eed53)[_0x7f0d('0x10')](function(_0x4b6e9c){_0x20ca12(null,_0x4b6e9c?_0x4b6e9c['name']:![]);})[_0x7f0d('0x12')](function(_0x859b5c){_0x20ca12(_0x859b5c);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x16')]=function(_0x44192d,_0x275010){this[_0x7f0d('0xc')][_0x7f0d('0x17')](_0x44192d)[_0x7f0d('0x10')](function(_0x2795f1){_0x275010(null,_0x2795f1?_0x2795f1[_0x7f0d('0x11')]:![]);})[_0x7f0d('0x12')](function(_0x481f8c){_0x275010(_0x481f8c);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x18')]=function(_0x30ff0b,_0x388510){this[_0x7f0d('0xc')][_0x7f0d('0x19')](_0x30ff0b)['then'](function(_0x1affe7){_0x388510(null,_0x1affe7?_0x1affe7['dsn']:![]);})[_0x7f0d('0x12')](function(_0x583a5a){_0x388510(_0x583a5a);});};AGIVertices[_0x7f0d('0x13')]['getUser']=function(_0x81bc2d,_0x1b69ac){this[_0x7f0d('0xc')][_0x7f0d('0x1a')](_0x81bc2d)[_0x7f0d('0x10')](function(_0xb88f){_0x1b69ac(null,_0xb88f?_0xb88f[_0x7f0d('0x11')]:![]);})[_0x7f0d('0x12')](function(_0x223831){_0x1b69ac(_0x223831);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x1b')]=function(_0x50e62e,_0x4b9ccf){this[_0x7f0d('0xc')][_0x7f0d('0x1c')](_0x50e62e)[_0x7f0d('0x10')](function(_0xd4f17e){_0x4b9ccf(null,_0xd4f17e?_0xd4f17e[_0x7f0d('0x11')]:![]);})[_0x7f0d('0x12')](function(_0x5cf353){_0x4b9ccf(_0x5cf353);});};AGIVertices['prototype']['getSound']=function(_0x3eed45,_0x2e7222){var _0x3ff1c0=this;this['rpc']['getSoundById'](_0x3eed45)[_0x7f0d('0x10')](function(_0x33c72d){_0x2e7222(null,_0x33c72d?_0x3ff1c0[_0x7f0d('0x1d')](_0x33c72d[_0x7f0d('0x1e')]):![]);})[_0x7f0d('0x12')](function(_0xd71080){_0x2e7222(_0xd71080);});};AGIVertices[_0x7f0d('0x13')]['getMailAccount']=function(_0xee0c41,_0x5d1077){this[_0x7f0d('0xc')][_0x7f0d('0x1f')](_0xee0c41)[_0x7f0d('0x10')](function(_0x57edfc){_0x5d1077(null,_0x57edfc?_0x57edfc:![]);})[_0x7f0d('0x12')](function(_0x3ea4a8){_0x5d1077(_0x3ea4a8);});};AGIVertices['prototype'][_0x7f0d('0x20')]=function(_0x4a0f82,_0x1eeeee,_0x534f26){this[_0x7f0d('0xd')][_0x7f0d('0x20')](_0x4a0f82,_0x1eeeee)[_0x7f0d('0x10')](function(){_0x534f26(null);})[_0x7f0d('0x12')](function(_0x164b8d){_0x534f26(_0x164b8d);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x21')]=function(_0x2e4c49,_0x57cd2d){this[_0x7f0d('0xc')][_0x7f0d('0x22')](_0x2e4c49)[_0x7f0d('0x10')](function(_0x336e6b){if(_0x336e6b){if(_0x336e6b[_0x7f0d('0x23')]){_0x57cd2d(null,[_0x336e6b[_0x7f0d('0x24')]]);}else{_0x57cd2d(null,_['map'](_0x336e6b[_0x7f0d('0x25')],_0x7f0d('0x24')));}}else{_0x57cd2d(null,![]);}})[_0x7f0d('0x12')](function(_0x850c47){_0x57cd2d(_0x850c47);});};AGIVertices[_0x7f0d('0x13')]['getSoundPath']=function(_0x1a6ee9){return util[_0x7f0d('0x26')](_0x7f0d('0x27'),FILES_PATH,_0x1a6ee9);};AGIVertices[_0x7f0d('0x13')]['getQueryOdbc']=function(_0x1c7ae6,_0x3dcc5c,_0x2f71b2){odbc[_0x7f0d('0x28')](_0x1c7ae6,function(_0x142a10){if(_0x142a10){logger[_0x7f0d('0x29')](_0x7f0d('0x2a'),_0x142a10);_0x2f71b2(_0x142a10);}else{logger[_0x7f0d('0x2b')](_0x7f0d('0x2c'));odbc[_0x7f0d('0x2d')](_0x3dcc5c,function(_0x565407,_0x269542){if(_0x565407){logger[_0x7f0d('0x2b')](_0x7f0d('0x2e'),_0x3dcc5c);_0x2f71b2(_0x565407);}else{logger[_0x7f0d('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x3dcc5c);odbc['close'](function(_0x41954a){if(_0x41954a){logger[_0x7f0d('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x41954a);}_0x2f71b2(null,_0x269542);});}});}});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x2f')]=function(_0x540f47,_0x500e88){this['rpc'][_0x7f0d('0x30')](_0x540f47)['then'](function(_0x472c06){_0x500e88(null,_0x472c06?_0x472c06:![]);})[_0x7f0d('0x12')](function(_0x64a679){_0x500e88(_0x64a679);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x31')]=function(_0x10aabf,_0x5c9874){this[_0x7f0d('0xc')][_0x7f0d('0x31')](_0x10aabf)['then'](function(_0x25f003){_0x5c9874(null,_0x25f003);})[_0x7f0d('0x12')](function(_0x391f7a){_0x5c9874(_0x391f7a);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x32')]=function(_0x172d5c,_0x1d150e,_0x346660){this[_0x7f0d('0xc')][_0x7f0d('0x32')]({'uniqueid':this[_0x7f0d('0x33')][_0x7f0d('0x34')],'node':_0x172d5c[_0x7f0d('0x35')],'application':_0x172d5c[_0x7f0d('0x36')],'data':_0x1d150e||null,'project_name':this['channel']['arg_1'],'callerid':this['channel']['callerid']})[_0x7f0d('0x10')](function(_0x4a3031){if(_0x346660){_0x346660(null,_0x4a3031);}})[_0x7f0d('0x12')](function(_0x25f53e){if(_0x346660){_0x346660(_0x25f53e);}});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x37')]=function(_0x409328,_0x554166,_0x2e144d,_0x38df7f){this[_0x7f0d('0xc')][_0x7f0d('0x37')]({'uniqueid':this['channel'][_0x7f0d('0x34')],'callerid':this[_0x7f0d('0x33')][_0x7f0d('0x38')],'calleridname':this[_0x7f0d('0x33')][_0x7f0d('0x39')],'context':this[_0x7f0d('0x33')][_0x7f0d('0x3a')],'extension':this[_0x7f0d('0x33')][_0x7f0d('0x3b')],'priority':this[_0x7f0d('0x33')][_0x7f0d('0x3c')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x7f0d('0x33')]['dnid'],'projectName':this[_0x7f0d('0x33')][_0x7f0d('0x3d')],'saveName':_0x554166,'filename':_0x409328['file']||_0x554166,'savePath':_0x2e144d})['then'](function(_0x14d1e6){_0x38df7f(null,_0x14d1e6);})[_0x7f0d('0x12')](function(_0x770a41){_0x38df7f(_0x770a41);});};AGIVertices['prototype'][_0x7f0d('0x3e')]=function(_0xb5a474,_0x1bf753,_0x4268e6){this[_0x7f0d('0xc')]['createSquareMessage']({'uniqueid':this['channel'][_0x7f0d('0x34')],'body':_0xb5a474,'direction':_0x1bf753})[_0x7f0d('0x10')](function(_0x33f8d8){if(_0x4268e6){_0x4268e6(null,_0x33f8d8);}})[_0x7f0d('0x12')](function(_0x3b1c4f){if(_0x4268e6){_0x4268e6(_0x3b1c4f);}});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x3f')]=function(_0x17ee7d,_0x1e84e0){this['rpc']['createCmContact']({'firstName':_[_0x7f0d('0x40')](_0x17ee7d[_0x7f0d('0x11')])||_[_0x7f0d('0x41')](_0x17ee7d[_0x7f0d('0x11')])?_0x7f0d('0x42')+Math[_0x7f0d('0x43')]():_0x17ee7d[_0x7f0d('0x11')],'lastName':_[_0x7f0d('0x40')](_0x17ee7d[_0x7f0d('0x44')])||_[_0x7f0d('0x41')](_0x17ee7d[_0x7f0d('0x44')])?null:_0x17ee7d[_0x7f0d('0x44')],'phone':_0x17ee7d[_0x7f0d('0x45')],'ListId':_0x17ee7d[_0x7f0d('0x46')],'scheduledat':_0x17ee7d[_0x7f0d('0x47')],'callbackUniqueid':this['channel'][_0x7f0d('0x34')],'tags':'callback','description':_0x7f0d('0x48')+_0x17ee7d[_0x7f0d('0x47')]['toString'](),'priority':_0x17ee7d[_0x7f0d('0x49')]})['then'](function(_0x48f586){_0x1e84e0(null,_0x48f586);})[_0x7f0d('0x12')](function(_0x24fe8d){_0x1e84e0(_0x24fe8d);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x4a')]=function(_0x3fecd3,_0x140428){this[_0x7f0d('0xc')]['getPauseById'](_0x3fecd3)[_0x7f0d('0x10')](function(_0x5d654b){_0x140428(null,_0x5d654b?_0x5d654b['name']:![]);})[_0x7f0d('0x12')](function(_0xabd1e1){_0x140428(_0xabd1e1);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x4b')]=function(_0x88efdd,_0x2d7705,_0x3dc4b4){var _0x565a1e={'role':_0x7f0d('0x4c')};_0x565a1e[_0x88efdd]=this[_0x7f0d('0x33')][_0x7f0d('0x38')];this[_0x7f0d('0xc')]['agentPause'](_0x565a1e,_0x2d7705,this['channel'][_0x7f0d('0x34')])[_0x7f0d('0x10')](function(_0x4851b4){_0x3dc4b4(null,_['isNil'](_0x4851b4)?![]:!![]);})['catch'](function(_0x528371){logger[_0x7f0d('0x29')](_0x528371);_0x3dc4b4(null,![]);});};AGIVertices[_0x7f0d('0x13')]['agentUnpause']=function(_0x1d62d9,_0x56e19b){var _0x30ce32={'role':_0x7f0d('0x4c')};_0x30ce32[_0x1d62d9]=this[_0x7f0d('0x33')]['callerid'];this[_0x7f0d('0xc')][_0x7f0d('0x4d')](_0x30ce32)['then'](function(_0x4b29db){_0x56e19b(null,_[_0x7f0d('0x41')](_0x4b29db)?![]:!![]);})[_0x7f0d('0x12')](function(_0x2e754d){logger['error'](_0x2e754d);_0x56e19b(null,![]);});};AGIVertices['prototype'][_0x7f0d('0x4e')]=function(_0x248a0d,_0x1e0a85){var _0xbbd144={'role':_0x7f0d('0x4c')};_0xbbd144[_0x248a0d]=this[_0x7f0d('0x33')][_0x7f0d('0x38')];this['rpc'][_0x7f0d('0x4e')](_0xbbd144)[_0x7f0d('0x10')](function(_0x4168cc){_0x1e0a85(null,_['isNil'](_0x4168cc)?![]:!![]);})[_0x7f0d('0x12')](function(_0x5a1c62){logger['error'](_0x5a1c62);_0x1e0a85(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x661d28,_0x43a73d){var _0x571f22={'role':_0x7f0d('0x4c')};_0x571f22[_0x661d28]=this[_0x7f0d('0x33')][_0x7f0d('0x38')];var _0x3f176e=_0x661d28!=_0x7f0d('0x4f')?util['format'](_0x7f0d('0x50'),_0x7f0d('0x51'),this[_0x7f0d('0x33')]['callerid']):undefined;this[_0x7f0d('0xc')][_0x7f0d('0x52')](_0x571f22,_0x3f176e)[_0x7f0d('0x10')](function(_0x10990c){_0x43a73d(null,_[_0x7f0d('0x41')](_0x10990c)?![]:!![]);})['catch'](function(_0x22e43d){logger[_0x7f0d('0x29')](_0x22e43d);_0x43a73d(null,![]);});};AGIVertices[_0x7f0d('0x13')]['shellCommand']=function(_0x32bc57,_0xfcd082){sh[_0x7f0d('0x53')](_[_0x7f0d('0x54')](_0x32bc57),function(_0x21af1a,_0x4ec7a2){var _0x20b5ec=_0x4ec7a2[_0x7f0d('0x55')](/(\r\n|\n|\r)/gm,'');_0xfcd082(null,_0x20b5ec);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x56')]=function(_0x3385c1,_0x4c7403){scripts['googleCloudTTS'](_0x3385c1['apiKey'],_0x3385c1[_0x7f0d('0x57')]||_0x7f0d('0x58'),_0x3385c1[_0x7f0d('0x58')],_0x3385c1[_0x7f0d('0x59')]||'en-US',_0x3385c1['ssmlGender']||_0x7f0d('0x5a'),_0x3385c1[_0x7f0d('0x5b')]||'MP3')[_0x7f0d('0x10')](function(_0x52feae){_0x4c7403(null,_0x52feae);})[_0x7f0d('0x12')](function(_0x389322){_0x4c7403(_0x389322);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x5c')]=function(_0x4e12eb,_0x5ed654){scripts[_0x7f0d('0x5c')](_0x4e12eb[_0x7f0d('0x58')],_0x4e12eb[_0x7f0d('0x5d')]||'en',0x1)[_0x7f0d('0x10')](function(_0x404eb2){_0x5ed654(null,_0x404eb2);})[_0x7f0d('0x12')](function(_0x1db0b7){_0x5ed654(_0x1db0b7);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x5e')]=function(_0x2954b6,_0x2d9ae6){var _0x57b5dc={'uri':_0x2954b6['url'],'method':_0x2954b6[_0x7f0d('0x5f')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2954b6[_0x7f0d('0x60')])===_0x7f0d('0x61')&&parseInt(_0x2954b6[_0x7f0d('0x60')])>=0x1?parseInt(_0x2954b6[_0x7f0d('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x7f0d('0x62')]([_0x7f0d('0x63'),_0x7f0d('0x64')],_0x57b5dc[_0x7f0d('0x5f')]['toUpperCase']())){try{_0x57b5dc[_0x7f0d('0x65')]=_0x2954b6[_0x7f0d('0xa')]?JSON[_0x7f0d('0x66')](_0x2954b6['rawBody']):{};}catch(_0x4fc14d){logger['error'](_0x7f0d('0x67'),_0x4fc14d);}}try{_0x57b5dc[_0x7f0d('0x68')]=_0x2954b6[_0x7f0d('0x69')]?JSON['parse'](_0x2954b6[_0x7f0d('0x69')]):{};}catch(_0x1dfb1f){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1dfb1f);}if(_0x2954b6[_0x7f0d('0x6a')]){try{var _0x2de7ef=require(_0x2954b6[_0x7f0d('0x6a')])['sync'](this,_0x57b5dc);_0x57b5dc[_0x7f0d('0x6b')]=Mustache['render'](_0x2954b6[_0x7f0d('0x6c')],_0x2de7ef,{},['$$','$$']);if(_0x57b5dc['headers']){_0x57b5dc[_0x7f0d('0x68')]=JSON['parse'](Mustache[_0x7f0d('0x6d')](JSON[_0x7f0d('0x6e')](_0x57b5dc[_0x7f0d('0x68')]),_0x2de7ef,{},['$$','$$']));}if(_0x57b5dc[_0x7f0d('0x65')]){_0x57b5dc['body']=JSON['parse'](Mustache[_0x7f0d('0x6d')](JSON[_0x7f0d('0x6e')](_0x57b5dc[_0x7f0d('0x65')]),_0x2de7ef,{},['$$','$$']));}}catch(_0x3a4366){logger[_0x7f0d('0x29')](_0x7f0d('0x6f'),_0x3a4366);}}rp(_0x57b5dc)[_0x7f0d('0x10')](function(_0x10ad18){var _0x13c968={'statusCode':_0x10ad18['statusCode']||0xc8,'statusMessage':_0x10ad18[_0x7f0d('0x70')]||'OK','headers':_0x10ad18['headers']||{},'body':_0x10ad18['body']||{}};_0x2d9ae6(null,_0x13c968);})[_0x7f0d('0x12')](function(_0x5e5c03){var _0x5e441b={'statusCode':_0x5e5c03[_0x7f0d('0x71')]||0x1f4,'statusMessage':_0x5e5c03['message']||_0x7f0d('0x72'),'headers':_0x5e5c03[_0x7f0d('0x73')][_0x7f0d('0x68')]||{},'body':_0x5e5c03[_0x7f0d('0x73')][_0x7f0d('0x65')]||{}};_0x2d9ae6(null,_0x5e441b);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x74')]=function(_0x5ffa57,_0x1c37ee){scripts[_0x7f0d('0x74')](this['channel'][_0x7f0d('0x34')],_0x5ffa57['key'],_0x5ffa57[_0x7f0d('0x58')],_0x5ffa57[_0x7f0d('0x75')]||'en')[_0x7f0d('0x10')](function(_0x372982){_0x1c37ee(null,_0x372982);})[_0x7f0d('0x12')](function(_0x48701b){_0x1c37ee(_0x48701b);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x76')]=function(_0x6b7c89,_0x17ce9a){scripts['sestekNDA'](this[_0x7f0d('0x33')],_0x6b7c89)[_0x7f0d('0x10')](function(_0x3a39d7){_0x17ce9a(null,_0x3a39d7);})['catch'](function(_0xe9ba3e){_0x17ce9a(_0xe9ba3e);});};AGIVertices['prototype']['ispeechTTS']=function(_0x43a150,_0x57883f){scripts[_0x7f0d('0x77')](_0x43a150[_0x7f0d('0x78')],_0x43a150[_0x7f0d('0x58')],_0x43a150[_0x7f0d('0x79')]||'en-US',_0x43a150['speed'])[_0x7f0d('0x10')](function(_0x532574){_0x57883f(null,_0x532574);})[_0x7f0d('0x12')](function(_0x5a24d9){_0x57883f(_0x5a24d9);});};AGIVertices['prototype'][_0x7f0d('0x7a')]=function(_0x221b2a,_0x525a1f,_0x4666cd){scripts[_0x7f0d('0x7a')](_0x525a1f,_0x221b2a[_0x7f0d('0x78')],_0x221b2a[_0x7f0d('0x7b')]||_0x7f0d('0x7c'),this[_0x7f0d('0x7d')](_0x221b2a[_0x7f0d('0x7e')])?_0x221b2a[_0x7f0d('0x7e')]:undefined)[_0x7f0d('0x10')](function(_0x563dcd){_0x4666cd(null,_0x563dcd);})[_0x7f0d('0x12')](function(_0x10b25b){_0x4666cd(_0x10b25b);});};AGIVertices[_0x7f0d('0x13')]['awsPolly']=function(_0x17fcac,_0x5f0e05){scripts[_0x7f0d('0x7f')](_0x17fcac[_0x7f0d('0x80')],_0x17fcac[_0x7f0d('0x81')],_0x17fcac['aws_polly_region'],_0x17fcac[_0x7f0d('0x82')]||'Amy',_0x17fcac['text'],_0x17fcac[_0x7f0d('0x83')]||_0x7f0d('0x58'))[_0x7f0d('0x10')](function(_0x37acd6){_0x5f0e05(null,_0x37acd6);})['catch'](function(_0x98a98a){_0x5f0e05(_0x98a98a);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x84')]=function(_0x4cbbd6,_0x1eb4b3){scripts['awsLex'](this['channel']['uniqueid'],_0x4cbbd6['aws_access_key_id'],_0x4cbbd6[_0x7f0d('0x81')],_0x4cbbd6[_0x7f0d('0x85')],_0x4cbbd6[_0x7f0d('0x58')],_0x4cbbd6[_0x7f0d('0x86')])[_0x7f0d('0x10')](function(_0x4c7f9e){_0x1eb4b3(null,_0x4c7f9e);})[_0x7f0d('0x12')](function(_0xe74033){_0x1eb4b3(_0xe74033);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x87')]=function(_0x56dade,_0x4d3ae4,_0xdd890d){scripts[_0x7f0d('0x87')](_0x4d3ae4,_0x56dade[_0x7f0d('0x78')],_0x56dade['google_asr_language']||_0x7f0d('0x7c'))[_0x7f0d('0x10')](function(_0x1d40f7){_0xdd890d(null,_0x1d40f7);})[_0x7f0d('0x12')](function(_0x266ce0){_0xdd890d(_0x266ce0);});};AGIVertices['prototype'][_0x7f0d('0x88')]=function(_0x2a6892,_0x3f917c,_0x58440b){scripts[_0x7f0d('0x88')](_0x3f917c,_0x2a6892[_0x7f0d('0x89')],_0x2a6892[_0x7f0d('0x8a')],_0x2a6892[_0x7f0d('0x6b')])['then'](function(_0x47e891){_0x58440b(null,_0x47e891);})[_0x7f0d('0x12')](function(_0x1ae99b){_0x58440b(_0x1ae99b);});};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x8b')]=function(_0x57a747){var _0x5ca9e9=_[_0x7f0d('0x62')](verticesWithRetry,_0x57a747[_0x7f0d('0x36')])?_0x57a747:_[_0x7f0d('0x8c')](_0x57a747);for(var _0x5a7310 in _0x5ca9e9){if(_0x5ca9e9['hasOwnProperty'](_0x5a7310)){if(_0x5ca9e9[_0x5a7310]&&_[_0x7f0d('0x8d')](_0x5ca9e9[_0x5a7310])){if(_[_0x7f0d('0x62')](recursiveMapAttributes,_0x5a7310)){_0x5ca9e9[_0x5a7310]=this[_0x7f0d('0x8e')](_0x5ca9e9[_0x5a7310]);}else{_0x5ca9e9[_0x5a7310]=this[_0x7f0d('0x8f')](_0x5ca9e9[_0x5a7310]);}}}}return _0x5ca9e9;};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x90')]=function(_0x3729c3){for(var _0x3186e2 in _0x3729c3){if(_0x3729c3[_0x7f0d('0x91')](_0x3186e2)){if(_['isPlainObject'](_0x3729c3[_0x3186e2])){this[_0x7f0d('0x90')](_0x3729c3[_0x3186e2]);}else if(_[_0x7f0d('0x92')](_0x3729c3[_0x3186e2])){for(var _0x38efb8=0x0;_0x38efb8<_0x3729c3[_0x3186e2]['length'];_0x38efb8++){this[_0x7f0d('0x90')](_0x3729c3[_0x3186e2][_0x38efb8]);}}else if(_['isString'](_0x3729c3[_0x3186e2])){_0x3729c3[_0x3186e2]=this[_0x7f0d('0x8f')](_0x3729c3[_0x3186e2]);}}}};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x93')]=function(_0x54a22a,_0x2e0665){for(var _0x845f63 in _0x54a22a){if(_0x54a22a[_0x7f0d('0x91')](_0x845f63)){if(_[_0x7f0d('0x94')](_0x54a22a[_0x845f63])){if(!_[_0x7f0d('0x40')](_0x54a22a[_0x845f63])){this[_0x7f0d('0x93')](_0x54a22a[_0x845f63],util[_0x7f0d('0x26')]('%s.%s',_0x2e0665,_0x845f63));}}else if(_['isArray'](_0x54a22a[_0x845f63])){for(var _0x8e13a8=0x0;_0x8e13a8<_0x54a22a[_0x845f63]['length'];_0x8e13a8++){this[_0x7f0d('0x93')](_0x54a22a[_0x845f63][_0x8e13a8],util[_0x7f0d('0x26')]('%s.%s',_0x2e0665,_0x845f63+'['+_0x8e13a8+']'));}}else{if(!_[_0x7f0d('0x41')](_0x54a22a[_0x845f63])){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util[_0x7f0d('0x26')]('%s.%s',_0x2e0665,_0x845f63),_0x54a22a[_0x845f63]);}}}}};AGIVertices['prototype'][_0x7f0d('0x8e')]=function(_0x42a195){try{var _0x4ccb2d=JSON[_0x7f0d('0x66')](_0x42a195);this[_0x7f0d('0x90')](_0x4ccb2d);return JSON['stringify'](_0x4ccb2d);}catch(_0x2c9388){return this[_0x7f0d('0x8f')](_0x42a195);}};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x8f')]=function(_0x3efcb2){var _0x4f6899=_0x3efcb2['split']('{');for(var _0x30d2fc=0x1;_0x30d2fc<_0x4f6899[_0x7f0d('0x96')];_0x30d2fc+=0x1){var _0x23650d=_0x4f6899[_0x30d2fc][_0x7f0d('0x97')]('}');if(_0x23650d[_0x7f0d('0x96')]>0x1){_0x3efcb2=_0x3efcb2[_0x7f0d('0x98')]('{'+_0x23650d[0x0]+'}',this[_0x7f0d('0x33')][_0x7f0d('0xe')](_0x23650d[0x0])[_0x7f0d('0x99')]||_0x23650d[0x0]);}}if(_0x4f6899['length']===0x1){return _0x3efcb2[_0x7f0d('0x9a')]();}return this[_0x7f0d('0x8f')](_0x3efcb2);};AGIVertices['prototype']['getAndSetVariable']=function(_0x4aa956,_0x3f3b6d){var _0x217a9c=this[_0x7f0d('0x33')]['getVariable'](_0x4aa956);if(_0x217a9c[_0x7f0d('0x9b')]===-0x1){return _0x217a9c;}logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3f3b6d,_0x217a9c['extra']));return this[_0x7f0d('0x33')][_0x7f0d('0x95')](_0x3f3b6d,_0x217a9c[_0x7f0d('0x99')]);};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x7d')]=function(_0x4838e0){return _0x4838e0&&_0x4838e0!=='0'&&_0x4838e0!=='-1'&&_0x4838e0!=='';};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x9c')]=function(_0x4a29b1){this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x4a29b1,'-');_0x4a29b1[_0x7f0d('0x9e')]=_0x4a29b1[_0x7f0d('0x9c')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x8')]=function(_0x5bd487){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5bd487['label']));return this[_0x7f0d('0x33')]['agi']([_0x5bd487[_0x7f0d('0x9f')],_0x5bd487['args']]);};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xa0')]=function(_0x4e0e21){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xa1'),_0x4e0e21['label']));if(this[_0x7f0d('0x7d')](_0x4e0e21[_0x7f0d('0x60')])){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xa2'),_0x4e0e21[_0x7f0d('0x60')]));var _0x31c45b=this[_0x7f0d('0x33')]['wait'](_0x4e0e21['timeout']);if(_0x31c45b[_0x7f0d('0x9b')]===-0x1){return _0x31c45b;}}return this[_0x7f0d('0x33')]['answer']();};AGIVertices[_0x7f0d('0x13')]['callback']=function(_0x39a4b6){logger[_0x7f0d('0x2b')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x39a4b6[_0x7f0d('0x35')]));if(!this['isConfigured'](_0x39a4b6[_0x7f0d('0x46')])){return this['channel']['error'](_0x39a4b6,_0x7f0d('0xa3'));}_0x39a4b6[_0x7f0d('0x47')]=moment();if(this['isConfigured'](_0x39a4b6[_0x7f0d('0xa4')])){_0x39a4b6[_0x7f0d('0x47')]=moment()['add'](_0x39a4b6['delay'],_0x7f0d('0xa5'));}if(!this['isConfigured'](_0x39a4b6[_0x7f0d('0x49')])){_0x39a4b6[_0x7f0d('0x49')]=0x2;}this[_0x7f0d('0x3f')]['sync'](this,_0x39a4b6);return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0xa7'),_0x39a4b6['phone'],_0x39a4b6[_0x7f0d('0x46')],_0x39a4b6[_0x7f0d('0x47')]));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xa8')]=function(_0x586130){logger['info'](util['format'](_0x7f0d('0xa9'),_0x586130[_0x7f0d('0x35')]));var _0x37225a=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x586130['application'],_0x586130[_0x7f0d('0x73')]);if(_0x37225a[_0x7f0d('0x9b')]===-0x1){return _0x37225a;}return this['channel']['noop'](util['format'](_0x7f0d('0xaa'),_0x586130[_0x7f0d('0xab')],_0x586130[_0x7f0d('0x73')]));};AGIVertices[_0x7f0d('0x13')]['lumenvoxtts']=function(_0x5c9d5a){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xac'),_0x5c9d5a[_0x7f0d('0x35')]));if(!this['isConfigured'](_0x5c9d5a[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xad'));}var _0x1bb6de='\x22'+_0x5c9d5a['text']+'\x22';if(this[_0x7f0d('0x7d')](_0x5c9d5a[_0x7f0d('0x73')])){_0x1bb6de+=','+_0x5c9d5a['options'];}var _0x1a1485=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x7f0d('0xae'),_0x1bb6de);if(_0x1a1485[_0x7f0d('0x9b')]===-0x1){return _0x1a1485;}return this['channel'][_0x7f0d('0xa6')](util['format'](_0x7f0d('0xaf'),_0x1bb6de));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xb0')]=function(_0x3bba14){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xb1'),_0x3bba14[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x3bba14[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xad'));}var _0x23e5f0='\x22'+_0x3bba14['text']+'\x22';if(this[_0x7f0d('0x7d')](_0x3bba14['options'])){_0x23e5f0+=','+_0x3bba14[_0x7f0d('0x73')];}var _0x4bcbd2=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x7f0d('0xae'),_0x23e5f0);if(_0x4bcbd2[_0x7f0d('0x9b')]===-0x1){return _0x4bcbd2;}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x23e5f0));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xb2')]=function(_0x27bdef){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xb3'),_0x27bdef[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x27bdef[_0x7f0d('0xb4')])){return this[_0x7f0d('0x33')]['noop'](_0x7f0d('0xb5'));}var _0x2ad064=_0x27bdef[_0x7f0d('0xb4')];if(this[_0x7f0d('0x7d')](_0x27bdef[_0x7f0d('0x73')])){_0x2ad064+=','+_0x27bdef['options'];}var _0x2668c7=this['channel'][_0x7f0d('0x53')](_0x7f0d('0xb6'),_0x2ad064);if(_0x2668c7[_0x7f0d('0x9b')]===-0x1){return _0x2668c7;}var _0x4933ab=this[_0x7f0d('0xb7')](_0x7f0d('0xb8'),_0x7f0d('0xb9'));if(_0x4933ab[_0x7f0d('0x9b')]===-0x1){return _0x4933ab;}var _0x38fb7b=this[_0x7f0d('0xb7')](_0x7f0d('0xba'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x38fb7b[_0x7f0d('0x9b')]===-0x1){return _0x38fb7b;}var _0x5d9296=this[_0x7f0d('0xb7')]('RECOG_INSTANCE()',_0x7f0d('0xbb'));if(_0x5d9296['result']===-0x1){return _0x5d9296;}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format'](_0x7f0d('0xbc'),_0x2ad064));};AGIVertices[_0x7f0d('0x13')]['sestekasr']=function(_0x12277f){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0xbd'),_0x12277f[_0x7f0d('0x35')]));if(!this['isConfigured'](_0x12277f[_0x7f0d('0xb4')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xb5'));}var _0x52bd35=_0x12277f[_0x7f0d('0xb4')];if(this[_0x7f0d('0x7d')](_0x12277f[_0x7f0d('0x73')])){_0x52bd35+=','+_0x12277f['options'];}var _0x3d12dd=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x7f0d('0xb6'),_0x52bd35);if(_0x3d12dd[_0x7f0d('0x9b')]===-0x1){return _0x3d12dd;}var _0xcff1f8=this['getAndSetVariable'](_0x7f0d('0xb8'),'SESTEK_ASR_CONFIDENCE');if(_0xcff1f8[_0x7f0d('0x9b')]===-0x1){return _0xcff1f8;}var _0x3249ab=this[_0x7f0d('0xb7')](_0x7f0d('0xba'),_0x7f0d('0xbe'));if(_0x3249ab['result']===-0x1){return _0x3249ab;}var _0x542bf9=this[_0x7f0d('0xb7')](_0x7f0d('0xbf'),'SESTEK_ASR_INSTANCE');if(_0x542bf9[_0x7f0d('0x9b')]===-0x1){return _0x542bf9;}return this[_0x7f0d('0x33')]['noop'](util[_0x7f0d('0x26')](_0x7f0d('0xbc'),_0x52bd35));};AGIVertices['prototype'][_0x7f0d('0xc0')]=function(_0x13a6ce){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xc1'),_0x13a6ce['label']));if(!this['isConfigured'](_0x13a6ce['odbc_id'])){return this['channel']['error'](_0x13a6ce,_0x7f0d('0xc2'));}var _0x3a62d0=this[_0x7f0d('0x18')][_0x7f0d('0x9d')](this,_0x13a6ce[_0x7f0d('0xc3')]);if(!_0x3a62d0){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x13a6ce,_0x7f0d('0xc4'));}if(!this['isConfigured'](_0x13a6ce['query'])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x13a6ce,_0x7f0d('0xc5'));}var _0x69b245=_0x13a6ce[_0x7f0d('0x2d')][_0x7f0d('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0xc6'),_0x69b245));var _0x47e2e2=this[_0x7f0d('0xc7')]['sync'](this,_0x3a62d0,_0x69b245);this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x13a6ce,_0x69b245);if(!this[_0x7f0d('0x7d')](_0x13a6ce['variable_id'])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4019d5=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0x13a6ce[_0x7f0d('0xc8')]);if(!_0x4019d5){return this[_0x7f0d('0x33')]['error'](_0x13a6ce,'no\x20variable\x20found');}var _0x1a2f77=this;_0x47e2e2[_0x7f0d('0xc9')](function(_0xd86f46,_0x440531){Object[_0x7f0d('0xca')](_0xd86f46)[_0x7f0d('0xc9')](function(_0x2352ee){_0x1a2f77[_0x7f0d('0x33')][_0x7f0d('0x95')](util[_0x7f0d('0x26')](_0x7f0d('0xcb'),_0x4019d5,_0x440531,_0x2352ee),_0xd86f46[_0x2352ee]);});});this[_0x7f0d('0x33')][_0x7f0d('0x95')](util['format'](_0x7f0d('0xcc'),_0x4019d5),_0x47e2e2['length']);return this[_0x7f0d('0x33')]['noop'](util[_0x7f0d('0x26')](_0x7f0d('0xcd'),_0x4019d5));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xce')]=function(_0x5117ba){logger[_0x7f0d('0xcf')](util['format'](_0x7f0d('0xd0'),_0x5117ba[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x5117ba[_0x7f0d('0xd1')])){return this[_0x7f0d('0x33')]['error'](_0x5117ba,_0x7f0d('0xd2'));}var _0x543ba9=this['getUser'][_0x7f0d('0x9d')](this,_0x5117ba[_0x7f0d('0xd1')]);if(!_0x543ba9){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x5117ba,_0x7f0d('0xd3'));}var _0x451ebb=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x7f0d('0xd4'),[util[_0x7f0d('0x26')](_0x7f0d('0xd5'),_0x543ba9),_0x5117ba[_0x7f0d('0x60')],_0x5117ba[_0x7f0d('0xd6')],_0x5117ba[_0x7f0d('0x6c')]]);if(_0x451ebb[_0x7f0d('0x9b')]===-0x1){return _0x451ebb;}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0xd7'),_0x7f0d('0xd4')));};AGIVertices['prototype']['dialogflow']=function(_0x4165b9){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0xd8'),_0x4165b9[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x4165b9[_0x7f0d('0x78')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0xd9'));}if(!this[_0x7f0d('0x7d')](_0x4165b9[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xad'));}this['channel'][_0x7f0d('0xda')]=!![];this[_0x7f0d('0x32')](_0x4165b9);this[_0x7f0d('0x3e')](_0x4165b9[_0x7f0d('0x58')],'in');this[_0x7f0d('0x33')]['noop'](util['format'](_0x7f0d('0xdb'),_0x4165b9[_0x7f0d('0x58')]));var _0x2631d0=this[_0x7f0d('0x74')][_0x7f0d('0x9d')](this,_0x4165b9);if(_0x2631d0){for(var _0xd01325 in _0x2631d0){if(_0x2631d0[_0x7f0d('0x91')](_0xd01325)){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util['format']('DIALOGFLOW_%s',_0xd01325['toUpperCase']()),_0x2631d0[_0xd01325]);}}this[_0x7f0d('0x3e')](_0x2631d0[_0x7f0d('0xdc')],'out');return this['channel']['noop'](util[_0x7f0d('0x26')](_0x7f0d('0xdd'),_0x2631d0['speech']));}return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x4165b9,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xde')]=function(_0x51f7c0){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xdf'),_0x51f7c0[_0x7f0d('0x35')]));if(!this['isConfigured'](_0x51f7c0['ndauth_url'])){return this[_0x7f0d('0x33')]['noop'](_0x7f0d('0xe0'));}if(!this[_0x7f0d('0x7d')](_0x51f7c0['username'])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xe1'));}if(!this[_0x7f0d('0x7d')](_0x51f7c0[_0x7f0d('0xe2')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xe3'));}if(!this[_0x7f0d('0x7d')](_0x51f7c0[_0x7f0d('0xe4')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xad'));}this[_0x7f0d('0x33')][_0x7f0d('0xda')]=!![];this[_0x7f0d('0x32')](_0x51f7c0);this[_0x7f0d('0x3e')](_0x51f7c0['text'],'in');this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format']('Trying\x20SestekNDA:\x20%s',_0x51f7c0[_0x7f0d('0x58')]));var _0x4ff64d=this[_0x7f0d('0x76')][_0x7f0d('0x9d')](this,_0x51f7c0);if(_0x4ff64d){for(var _0x805e0a in _0x4ff64d){if(_0x4ff64d[_0x7f0d('0x91')](_0x805e0a)){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util['format'](_0x7f0d('0xe5'),_0x805e0a[_0x7f0d('0xe6')]()),_0x4ff64d[_0x805e0a]);}}this[_0x7f0d('0x3e')](_0x4ff64d[_0x7f0d('0xdc')],_0x7f0d('0xe7'));if(_0x4ff64d[_0x7f0d('0xe8')]){this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0xe9'),_0x4ff64d[_0x7f0d('0xe8')]));var _0x321ade=this[_0x7f0d('0x33')][_0x7f0d('0xea')](_0x4ff64d['audiofile']);try{fs[_0x7f0d('0xeb')](_0x4ff64d[_0x7f0d('0xe8')]+_0x7f0d('0xec'));}catch(_0x1868a9){logger['error'](_0x1868a9);}return _0x321ade;}else{return this[_0x7f0d('0x33')]['noop'](util[_0x7f0d('0x26')](_0x7f0d('0xed'),_0x4ff64d[_0x7f0d('0xdc')]));}}return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x51f7c0,_0x7f0d('0xee'));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xef')]=function(_0x4aceff){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0xf0'),_0x4aceff[_0x7f0d('0x35')]));return this[_0x7f0d('0x33')]['noop']('end');};AGIVertices[_0x7f0d('0x13')]['ext_dial']=function(_0x59b87a){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0xf1'),_0x59b87a[_0x7f0d('0x35')]));var _0x24a0be='';if(_0x59b87a[_0x7f0d('0xf2')]){if(!this[_0x7f0d('0x7d')](_0x59b87a[_0x7f0d('0xf2')])){return this['channel'][_0x7f0d('0x29')](_0x59b87a,_0x7f0d('0xf3'));}else{var _0x7fb169=parseInt(_0x59b87a[_0x7f0d('0xf2')],0xa);if(isNaN(_0x7fb169)){_0x24a0be=_0x59b87a[_0x7f0d('0xf2')];}else{_0x24a0be=this['getTrunk']['sync'](this,_0x59b87a[_0x7f0d('0xf2')]);if(!_0x24a0be){return this[_0x7f0d('0x33')]['error'](_0x59b87a,_0x7f0d('0xf4'));}}}}else if(_0x59b87a[_0x7f0d('0xf5')]){_0x24a0be=_0x59b87a[_0x7f0d('0xf5')];}else{return this['channel']['error'](_0x59b87a,_0x7f0d('0xf3'));}var _0xef01f=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x7f0d('0xd4'),[util[_0x7f0d('0x26')](_0x7f0d('0xf6'),_0x24a0be,_0x59b87a[_0x7f0d('0x45')]),_0x59b87a[_0x7f0d('0x60')],_0x59b87a[_0x7f0d('0xd6')],_0x59b87a['url']]);if(_0xef01f[_0x7f0d('0x9b')]===-0x1){return _0xef01f;}return this[_0x7f0d('0x33')]['noop'](util['format'](_0x7f0d('0xd7'),_0x7f0d('0xd4')));};AGIVertices['prototype']['finally']=function(_0x41965c){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0xf7'),_0x41965c[_0x7f0d('0x35')]));return this[_0x7f0d('0x33')]['noop']('finally');};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xb')]=function(_0x32eace){logger['info'](util['format'](_0x7f0d('0xf8'),_0x32eace[_0x7f0d('0x35')]));if(_0x32eace[_0x7f0d('0x9e')]===0x0){return this[_0x7f0d('0x9c')](_0x32eace);}_0x32eace[_0x7f0d('0x9e')]-=0x1;if(!this['isConfigured'](_0x32eace[_0x7f0d('0xf9')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x32eace,'no\x20file\x20audio\x20selected');}var _0x292413=this[_0x7f0d('0xfa')][_0x7f0d('0x9d')](this,_0x32eace[_0x7f0d('0xf9')]);if(!_0x292413){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x32eace,_0x7f0d('0xfb'));}if(!this[_0x7f0d('0x7d')](_0x32eace[_0x7f0d('0xc8')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x454894=this[_0x7f0d('0x33')][_0x7f0d('0xfc')](_0x292413,_0x32eace['response'],_0x32eace['maxdigit']);var _0x5b6815=_0x454894[_0x7f0d('0x9b')]?_0x454894[_0x7f0d('0x9b')][_0x7f0d('0x9a')]():'';logger[_0x7f0d('0x2b')]('test',JSON[_0x7f0d('0x6e')](_0x454894));if(_0x454894[_0x7f0d('0x9b')]===-0x1){this[_0x7f0d('0x32')]['sync'](this,_0x32eace,_0x5b6815);return _0x454894;}else if(_0x454894[_0x7f0d('0x99')]===_0x7f0d('0x60')){_0x454894['result']=_0x5b6815[_0x7f0d('0x96')]>=parseInt(_0x32eace['mindigit'])?'x':'i';}else{_0x454894['result']=_0x5b6815[_0x7f0d('0x96')]>=parseInt(_0x32eace[_0x7f0d('0xfd')])&&_0x5b6815[_0x7f0d('0x96')]<=parseInt(_0x32eace[_0x7f0d('0xfe')])?'x':'i';}var _0x5ddff4=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0x32eace['variable_id']);if(!_0x5ddff4){return this['channel'][_0x7f0d('0x29')](_0x32eace,_0x7f0d('0xff'));}this[_0x7f0d('0x33')][_0x7f0d('0x95')](_0x5ddff4,_0x5b6815);if(this[_0x7f0d('0x7d')](_0x32eace[_0x7f0d('0x100')])){var _0x1b02ea=parseInt(_0x32eace[_0x7f0d('0x100')],0xa);var _0x14fa62=rs[_0x7f0d('0x101')]({'charset':'*','length':_0x1b02ea});var _0xb9c08d=_0x5b6815[_0x7f0d('0x96')];if(_0xb9c08d>0x0){if(_0xb9c08d>_0x1b02ea){this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x32eace,_0x32eace['hiddendigitspos']==='first'?_0x14fa62+_0x5b6815[_0x7f0d('0x102')](_0x1b02ea):_0x5b6815['substr'](0x0,_0xb9c08d-_0x1b02ea)+_0x14fa62);}else{this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x32eace,rs['generate']({'charset':'*','length':_0xb9c08d}));}}else{this['createSquareDetailsReport']['sync'](this,_0x32eace,'');}}else{this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x32eace,_0x5b6815);}return _0x454894;};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x103')]=function(_0x97e8df){logger['info'](util['format'](_0x7f0d('0x104'),_0x97e8df[_0x7f0d('0x35')]));return this[_0x7f0d('0xb')](_0x97e8df);};AGIVertices['prototype'][_0x7f0d('0x105')]=function(_0x381602){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x106'),_0x381602[_0x7f0d('0x35')]));this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x381602,_0x381602[_0x7f0d('0x107')]);return this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x108'),_0x381602[_0x7f0d('0x107')]));};AGIVertices[_0x7f0d('0x13')]['awspolly']=function(_0x5766ad){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0x109'),_0x5766ad[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x5766ad[_0x7f0d('0x80')])||!this[_0x7f0d('0x7d')](_0x5766ad[_0x7f0d('0x81')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0x10a'));}if(!this[_0x7f0d('0x7d')](_0x5766ad[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')]['noop'](_0x7f0d('0xad'));}this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x10b'),_0x5766ad['text']));var _0x12805e=this[_0x7f0d('0x7f')]['sync'](this,_0x5766ad);if(_0x12805e){this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0x12805e));var _0x502c8d=this[_0x7f0d('0x33')]['streamFile'](_0x12805e);try{fs[_0x7f0d('0xeb')](_0x12805e+'.wav');}catch(_0x156bea){logger[_0x7f0d('0x29')](_0x156bea);}return _0x502c8d;}return this[_0x7f0d('0x33')]['error'](_0x5766ad,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x7f0d('0x13')]['awslex']=function(_0x3ec210){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x10c'),_0x3ec210[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x3ec210[_0x7f0d('0x80')])||!this[_0x7f0d('0x7d')](_0x3ec210[_0x7f0d('0x81')])){return this['channel']['noop'](_0x7f0d('0x10a'));}if(!this['isConfigured'](_0x3ec210[_0x7f0d('0x86')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0x10d'));}if(!this['isConfigured'](_0x3ec210[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')]['noop'](_0x7f0d('0xad'));}this[_0x7f0d('0x33')]['bot']=!![];this['createSquareDetailsReport'](_0x3ec210);this['createSquareMessage'](_0x3ec210['text'],'in');this[_0x7f0d('0x33')]['noop'](util[_0x7f0d('0x26')](_0x7f0d('0x10e'),_0x3ec210[_0x7f0d('0x58')]));var _0x56881c=this[_0x7f0d('0x84')]['sync'](this,_0x3ec210);if(_0x56881c){for(var _0x33868b in _0x56881c){if(_0x56881c['hasOwnProperty'](_0x33868b)&&_[_0x7f0d('0x8d')](_0x56881c[_0x33868b])){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util['format'](_0x7f0d('0x10f'),_0x33868b[_0x7f0d('0xe6')]()),_0x56881c[_0x33868b]);}}if(_['isNil'](_0x56881c[_0x7f0d('0x110')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0x111'));}else{this[_0x7f0d('0x3e')](_0x56881c[_0x7f0d('0x110')],_0x7f0d('0xe7'));return this['channel']['noop'](util[_0x7f0d('0x26')](_0x7f0d('0x112'),_0x56881c[_0x7f0d('0x110')]));}}return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x3ec210,_0x7f0d('0x113'));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x114')]=function(_0x50a1b3){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x50a1b3[_0x7f0d('0x35')],_0x50a1b3[_0x7f0d('0x60')]));if(!this[_0x7f0d('0x7d')](_0x50a1b3[_0x7f0d('0x78')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0xd9'));}var _0x150021=_0x7f0d('0x115');var _0x3876c8=util[_0x7f0d('0x26')](_0x7f0d('0x116'),FILES_PATH,rs[_0x7f0d('0x101')](0x4));var _0x8dc2b7=util[_0x7f0d('0x26')](_0x7f0d('0x117'),_0x3876c8,_0x150021);var _0x960e0b=!![];if(_0x50a1b3[_0x7f0d('0x118')]===_0x7f0d('0x119')){_0x960e0b=![];}var _0x2fbaa3=this[_0x7f0d('0x33')][_0x7f0d('0x11a')](_0x3876c8,_0x150021,_0x50a1b3['intKey'],_0x50a1b3[_0x7f0d('0x60')],undefined,_0x960e0b);if(_0x2fbaa3[_0x7f0d('0x9b')]!==-0x1){this['channel'][_0x7f0d('0xa6')](util['format'](_0x7f0d('0x11b'),_0x8dc2b7));var _0x5eb91c=this[_0x7f0d('0x87')]['sync'](this,_0x50a1b3,_0x8dc2b7);if(_0x5eb91c){for(var _0x57dde3 in _0x5eb91c){if(_0x5eb91c[_0x7f0d('0x91')](_0x57dde3)){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util['format'](_0x7f0d('0x11c'),_0x57dde3[_0x7f0d('0xe6')]()),_0x5eb91c[_0x57dde3]);}}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x11d'),JSON['stringify'](_0x5eb91c)));}}return _0x2fbaa3;};AGIVertices[_0x7f0d('0x13')]['tildeasr']=function(_0x3dab78){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0x11e'),_0x3dab78[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x3dab78[_0x7f0d('0x89')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0x11f'));}if(!this[_0x7f0d('0x7d')](_0x3dab78['appsecret'])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')]('no\x20appsecret\x20configured');}var _0x45e298=_0x7f0d('0x115');var _0x298856=util[_0x7f0d('0x26')](_0x7f0d('0x116'),FILES_PATH,rs['generate'](0x4));var _0x237d5c=util[_0x7f0d('0x26')](_0x7f0d('0x117'),_0x298856,_0x45e298);var _0x21b950=!![];if(_0x3dab78[_0x7f0d('0x118')]===_0x7f0d('0x119')){_0x21b950=![];}var _0xec5d40=this[_0x7f0d('0x33')]['recordFile'](_0x298856,_0x45e298,_0x3dab78['intKey'],_0x3dab78['timeout'],undefined,_0x21b950);if(_0xec5d40[_0x7f0d('0x9b')]!==-0x1){this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')]('tilde\x20%s\x20file\x20created',_0x237d5c));var _0x4bb342=this[_0x7f0d('0x88')][_0x7f0d('0x9d')](this,_0x3dab78,_0x237d5c);if(_0x4bb342){for(var _0x48d7fe in _0x4bb342){if(_0x4bb342[_0x7f0d('0x91')](_0x48d7fe)){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util[_0x7f0d('0x26')]('TILDE_ASR_%s',_0x48d7fe[_0x7f0d('0xe6')]()),_0x4bb342[_0x48d7fe]);}}return this['channel'][_0x7f0d('0xa6')](util['format'](_0x7f0d('0x120'),JSON[_0x7f0d('0x6e')](_0x4bb342)));}}return _0xec5d40;};AGIVertices[_0x7f0d('0x13')]['gotoc']=function(_0x4fa10d){logger[_0x7f0d('0x2b')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4fa10d['label']));return this['channel'][_0x7f0d('0x121')](_0x4fa10d[_0x7f0d('0x3a')],_0x4fa10d['extension'],_0x4fa10d[_0x7f0d('0x3c')]);};AGIVertices['prototype']['gotoif']=function(_0x46860b){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x122'),_0x46860b['label']));if(!this[_0x7f0d('0x7d')](_0x46860b[_0x7f0d('0x123')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x46860b,_0x7f0d('0x124'));}try{var _0x139cfd=eval(_0x46860b[_0x7f0d('0x123')])?_0x7f0d('0x125'):_0x7f0d('0x126');this[_0x7f0d('0x33')]['noop'](util[_0x7f0d('0x26')](_0x7f0d('0x127'),_0x46860b['condition'],_0x139cfd));return{'code':0xc8,'result':_0x139cfd};}catch(_0x575fdf){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x128')]=function(_0x3299a5){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0x129'),_0x3299a5[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x3299a5[_0x7f0d('0x12a')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x3299a5,'no\x20interval\x20configured');}var _0x55e984=this[_0x7f0d('0x21')][_0x7f0d('0x9d')](this,_0x3299a5[_0x7f0d('0x12a')]);if(!_0x55e984){return this[_0x7f0d('0x33')]['error'](_0x3299a5,_0x7f0d('0x12b'));}for(var _0x1d58f0=0x0;_0x1d58f0<_0x55e984[_0x7f0d('0x96')];_0x1d58f0+=0x1){var _0x32512b=this[_0x7f0d('0x33')][_0x7f0d('0xe')](util['format'](_0x7f0d('0x12c'),_0x55e984[_0x1d58f0]));if(_0x32512b[_0x7f0d('0x9b')]===-0x1){return _0x32512b;}logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')]('IFTIME\x20%s\x20%s',_0x55e984[_0x1d58f0],_0x32512b[_0x7f0d('0x99')]));if(_0x32512b[_0x7f0d('0x99')]===_0x7f0d('0x125')){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x12d'),_0x55e984[_0x1d58f0],_0x7f0d('0x125')));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x12d'),_0x55e984[_0x1d58f0],'true'));return{'code':0xc8,'result':_0x7f0d('0x125')};}else{logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x12d'),_0x55e984[_0x1d58f0],'false'));this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x12d'),_0x55e984[_0x1d58f0],'false'));}}return{'code':0xc8,'result':_0x7f0d('0x126')};};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x12e')]=function(_0x259d95){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x12f'),_0x259d95[_0x7f0d('0x35')]));return this[_0x7f0d('0x33')][_0x7f0d('0x12e')]();};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x130')]=function(_0x516dd8){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x131'),_0x516dd8[_0x7f0d('0x35')]));if(!this['isConfigured'](_0x516dd8['key'])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0xd9'));}var _0x222915=_0x7f0d('0x115');var _0x4a4255=util[_0x7f0d('0x26')](_0x7f0d('0x116'),FILES_PATH,rs['generate'](0x4));var _0x17e843=util[_0x7f0d('0x26')](_0x7f0d('0x117'),_0x4a4255,_0x222915);var _0x55e411=!![];if(_0x516dd8[_0x7f0d('0x118')]===_0x7f0d('0x119')){_0x55e411=![];}var _0x1081d7=this[_0x7f0d('0x33')][_0x7f0d('0x11a')](_0x4a4255,_0x222915,_0x516dd8['intKey'],_0x516dd8[_0x7f0d('0x60')],undefined,_0x55e411);if(_0x1081d7['result']!==-0x1){this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format'](_0x7f0d('0x132'),_0x17e843));var _0x1dcd88=this[_0x7f0d('0x7a')][_0x7f0d('0x9d')](this,_0x516dd8,_0x17e843);if(_0x1dcd88){for(var _0x27ec28 in _0x1dcd88){if(_0x1dcd88[_0x7f0d('0x91')](_0x27ec28)){this[_0x7f0d('0x33')][_0x7f0d('0x95')](util[_0x7f0d('0x26')]('ISPEECH_ASR_%s',_0x27ec28[_0x7f0d('0xe6')]()),_0x1dcd88[_0x27ec28]);}}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x133'),JSON[_0x7f0d('0x6e')](_0x1dcd88)));}}return _0x1081d7;};AGIVertices[_0x7f0d('0x13')]['ispeechtts']=function(_0x21621f){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x134'),_0x21621f['label']));if(!this['isConfigured'](_0x21621f[_0x7f0d('0x78')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0xd9'));}if(!this[_0x7f0d('0x7d')](_0x21621f[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0xad'));}this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x135'),_0x21621f['text']));var _0xa025ad=this['ispeechTTS'][_0x7f0d('0x9d')](this,_0x21621f);if(_0xa025ad){this['channel']['noop'](util['format'](_0x7f0d('0x132'),_0xa025ad));var _0x1f0ebf=this[_0x7f0d('0x33')][_0x7f0d('0xea')](_0xa025ad,_0x21621f[_0x7f0d('0x136')]);try{fs[_0x7f0d('0xeb')](_0xa025ad+_0x7f0d('0xec'));}catch(_0x7642cb){logger[_0x7f0d('0x29')](_0x7642cb);}return _0x1f0ebf;}return this['channel']['error'](_0x21621f,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x137')]=function(_0x5a3046){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x138'),_0x5a3046[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x5a3046[_0x7f0d('0x139')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x5a3046,_0x7f0d('0x13a'));}logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x13b'),this['channel'][_0x7f0d('0x38')],_0x5a3046[_0x7f0d('0x139')]));var _0x36cb6e=this['agentLogin'][_0x7f0d('0x9d')](this,_0x5a3046[_0x7f0d('0x139')]);if(_0x36cb6e){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this['channel'][_0x7f0d('0x38')],_0x5a3046[_0x7f0d('0x139')]));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x5a3046[_0x7f0d('0x139')]));return{'code':0xc8,'result':_0x7f0d('0x13d')};}else{logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x13e'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x5a3046[_0x7f0d('0x139')]));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format'](_0x7f0d('0x13e'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x5a3046[_0x7f0d('0x139')]));return{'code':0xc8,'result':_0x7f0d('0x13f')};}};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x140')]=function(_0x557199){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x141'),_0x557199[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x557199['findBy'])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x557199,_0x7f0d('0x13a'));}logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x13b'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x557199['findBy']));var _0xe47c4b=this[_0x7f0d('0x4e')]['sync'](this,_0x557199[_0x7f0d('0x139')]);if(_0xe47c4b){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this['channel']['callerid'],_0x557199['findBy']));this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x557199[_0x7f0d('0x139')]));return{'code':0xc8,'result':_0x7f0d('0x13d')};}else{logger['info'](util['format'](_0x7f0d('0x13e'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x557199[_0x7f0d('0x139')]));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x13e'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x557199[_0x7f0d('0x139')]));return{'code':0xc8,'result':_0x7f0d('0x13f')};}};AGIVertices['prototype'][_0x7f0d('0x142')]=function(_0x279d31){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x143'),_0x279d31[_0x7f0d('0x35')]));if(!this['isConfigured'](_0x279d31[_0x7f0d('0x144')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x279d31,_0x7f0d('0x145'));}this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x146'),_0x279d31[_0x7f0d('0x144')]));var _0x3693cf=eval(_0x279d31[_0x7f0d('0x144')]);if(!this[_0x7f0d('0x7d')](_0x279d31[_0x7f0d('0xc8')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x54e153=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0x279d31[_0x7f0d('0xc8')]);if(!_0x54e153){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x279d31,'no\x20variable\x20found');}if(_[_0x7f0d('0x92')](_0x3693cf)){var _0x2a7bfd=this;_0x3693cf[_0x7f0d('0xc9')](function(_0x33030c,_0x4e462c){_0x2a7bfd['channel'][_0x7f0d('0x95')](util['format'](_0x7f0d('0x147'),_0x54e153,_0x4e462c),_0x33030c);});return this['channel']['noop'](util['format'](_0x7f0d('0x148'),_0x54e153));}else{return this[_0x7f0d('0x33')]['setVariable'](_0x54e153,_0x3693cf);}};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x149')]=function(_0x197670){logger[_0x7f0d('0x2b')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x197670[_0x7f0d('0x35')]));if(_0x197670[_0x7f0d('0x9e')]===0x0){return this[_0x7f0d('0x9c')](_0x197670);}_0x197670[_0x7f0d('0x9e')]-=0x1;if(!this[_0x7f0d('0x7d')](_0x197670[_0x7f0d('0xf9')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x197670,_0x7f0d('0x14a'));}var _0x28b319=this['getSound'][_0x7f0d('0x9d')](this,_0x197670['file_id']);if(!_0x28b319){return this[_0x7f0d('0x33')]['error'](_0x197670,'no\x20file\x20audio\x20found');}var _0x3dccb5=this[_0x7f0d('0x33')]['getData'](_0x28b319,_0x197670['response'],_0x197670['digit']);var _0x1b32de=_0x3dccb5['result'];if(_0x3dccb5[_0x7f0d('0x9b')]===-0x1){this['createSquareDetailsReport'][_0x7f0d('0x9d')](this,_0x197670,'-1');return _0x3dccb5;}else if(_0x3dccb5[_0x7f0d('0x99')]==='timeout'){_0x3dccb5[_0x7f0d('0x9b')]=_0x3dccb5[_0x7f0d('0x9b')][_0x7f0d('0x96')]>0x0?_0x3dccb5[_0x7f0d('0x9b')]:'t';}else if(_[_0x7f0d('0x40')](_0x3dccb5['result'])){_0x3dccb5['result']='#';_0x1b32de='#';}if(!this[_0x7f0d('0x7d')](_0x197670[_0x7f0d('0xc8')])){this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0x14b'));}else{var _0x41feed=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0x197670[_0x7f0d('0xc8')]);if(!_0x41feed){return this['channel'][_0x7f0d('0x29')](_0x197670,_0x7f0d('0xff'));}this[_0x7f0d('0x33')][_0x7f0d('0x95')](_0x41feed,_0x1b32de);}this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x197670,_0x1b32de);return _0x3dccb5;};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0xa6')]=function(_0x4b9e7b){logger['info'](util['format'](_0x7f0d('0x14c'),_0x4b9e7b[_0x7f0d('0x35')]));return this['channel']['noop'](_0x4b9e7b[_0x7f0d('0x14d')]||_0x4b9e7b[_0x7f0d('0x35')]);};AGIVertices[_0x7f0d('0x13')]['pause']=function(_0xffdf27){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x14e'),_0xffdf27['label']));if(!this[_0x7f0d('0x7d')](_0xffdf27[_0x7f0d('0x139')])){return this[_0x7f0d('0x33')]['error'](_0xffdf27,'no\x20find\x20by\x20configured');}logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x13b'),this['channel'][_0x7f0d('0x38')],_0xffdf27[_0x7f0d('0x139')]));var _0x19e271=this[_0x7f0d('0x4a')][_0x7f0d('0x9d')](this,_0xffdf27[_0x7f0d('0x14f')]);var _0x1cfafd=this[_0x7f0d('0x4b')][_0x7f0d('0x9d')](this,_0xffdf27[_0x7f0d('0x139')],_0x19e271);if(_0x1cfafd){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0xffdf27['findBy']));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this[_0x7f0d('0x33')]['callerid'],_0xffdf27[_0x7f0d('0x139')]));return{'code':0xc8,'result':_0x7f0d('0x13d')};}else{logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x13e'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0xffdf27[_0x7f0d('0x139')]));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0xffdf27['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x150')]=function(_0x14bf16){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x151'),_0x14bf16[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x14bf16[_0x7f0d('0xf9')])){return this['channel'][_0x7f0d('0x29')](_0x14bf16,_0x7f0d('0x14a'));}var _0x30e130=this[_0x7f0d('0xfa')][_0x7f0d('0x9d')](this,_0x14bf16[_0x7f0d('0xf9')]);if(!_0x30e130){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x14bf16,_0x7f0d('0xfb'));}var _0x2bea40=this['channel']['exec']('PLAYBACK',[_0x30e130,_0x14bf16[_0x7f0d('0xd6')]]);if(_0x2bea40['result']===-0x1){return _0x2bea40;}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format'](_0x7f0d('0xaa'),_0x7f0d('0x152'),_0x30e130));};AGIVertices[_0x7f0d('0x13')]['queue']=function(_0x51d16c){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x153'),_0x51d16c[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x51d16c[_0x7f0d('0x154')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x51d16c,'no\x20queue\x20selected');}var _0x5c17c8='';var _0x1cb975=parseInt(_0x51d16c[_0x7f0d('0x154')],0xa);if(isNaN(_0x1cb975)){_0x5c17c8=_0x51d16c['queue_id'];}else{_0x5c17c8=this[_0x7f0d('0x14')][_0x7f0d('0x9d')](this,_0x51d16c['queue_id']);if(!_0x5c17c8){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x51d16c,_0x7f0d('0x155'));}}var _0x115505='';if(this[_0x7f0d('0x7d')](_0x51d16c[_0x7f0d('0xf9')])){var _0xd6f772=this[_0x7f0d('0xfa')][_0x7f0d('0x9d')](this,_0x51d16c[_0x7f0d('0xf9')]);if(_0xd6f772){_0x115505=_0xd6f772;}}this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x51d16c,_0x5c17c8);if(_0x51d16c[_0x7f0d('0xd6')][_0x7f0d('0x156')]('x')<0x0){_0x51d16c[_0x7f0d('0xd6')]+='x';}if(_0x51d16c[_0x7f0d('0xd6')]['indexOf']('X')<0x0){_0x51d16c[_0x7f0d('0xd6')]+='X';}this['channel']['setVariable'](_0x7f0d('0x157'),_0x5c17c8?_0x5c17c8[_0x7f0d('0x158')]():'');var _0xac1c5a=this['channel']['exec'](_0x7f0d('0x159'),[_0x5c17c8,_0x51d16c['opts'],_0x51d16c[_0x7f0d('0x6c')],_0x115505,_0x51d16c[_0x7f0d('0x60')],_0x51d16c['agi'],_0x51d16c[_0x7f0d('0x15a')],_0x51d16c[_0x7f0d('0x15b')],'',_0x51d16c[_0x7f0d('0x15c')]]);if(_0xac1c5a[_0x7f0d('0x9b')]===-0x1){return _0xac1c5a;}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0xaa'),_0x7f0d('0x159'),_0x5c17c8));};AGIVertices[_0x7f0d('0x13')]['record']=function(_0x238432){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x15d'),_0x238432[_0x7f0d('0x35')]));var _0x39afc8=_0x238432[_0x7f0d('0x15e')]||_0x7f0d('0x115');var _0x548c84=util[_0x7f0d('0x26')](_0x7f0d('0x15f'),this[_0x7f0d('0x33')][_0x7f0d('0x34')],rs[_0x7f0d('0x101')](0x5));var _0x5d3244=util[_0x7f0d('0x26')](_0x7f0d('0x160'),FILES_PATH,_0x548c84,_0x39afc8);var _0x1067ff=util[_0x7f0d('0x26')]('%s/recordings/%s',FILES_PATH,_0x548c84);this[_0x7f0d('0x37')][_0x7f0d('0x9d')](this,_0x238432,_0x548c84,_0x5d3244);this[_0x7f0d('0x33')][_0x7f0d('0x95')](_0x7f0d('0x161'),_0x548c84);logger[_0x7f0d('0x2b')](_0x7f0d('0x162'),_0x1067ff,_0x39afc8,_0x238432[_0x7f0d('0x163')],_0x238432[_0x7f0d('0x60')]);return this[_0x7f0d('0x33')]['recordFile'](_0x1067ff,_0x39afc8,_0x238432[_0x7f0d('0x163')],_0x238432['timeout'],undefined,!![]);};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x164')]=function(_0xb0e969){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x165'),_0xb0e969[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0xb0e969[_0x7f0d('0x6c')])){return this[_0x7f0d('0x33')]['noop'](_0x7f0d('0x166'));}var _0x4d26fe=this[_0x7f0d('0x5e')][_0x7f0d('0x9d')](this,_0xb0e969);logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x167'),util[_0x7f0d('0x168')](_0x4d26fe,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xb0e969[_0x7f0d('0xc8')])){return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0x169'));}var _0x412329=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0xb0e969[_0x7f0d('0xc8')]);if(!_0x412329){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0xb0e969,_0x7f0d('0xff'));}this['channel'][_0x7f0d('0x95')](util[_0x7f0d('0x26')]('%s_STATUS_CODE',_0x412329),_0x4d26fe['statusCode']?_0x4d26fe[_0x7f0d('0x71')]:_0x7f0d('0x16a'));this[_0x7f0d('0x33')][_0x7f0d('0x95')](util[_0x7f0d('0x26')](_0x7f0d('0x16b'),_0x412329),_0x4d26fe[_0x7f0d('0x70')]?_0x4d26fe[_0x7f0d('0x70')]:'OK');if(_0x4d26fe[_0x7f0d('0x65')]){try{this[_0x7f0d('0x93')](_0x4d26fe['body'],_0x412329);}catch(_0x39bd66){logger[_0x7f0d('0x29')](util[_0x7f0d('0x26')](_0x7f0d('0x16c'),_0x412329));}}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util['format']('variable\x20%s\x20set',_0x412329));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x16d')]=function(_0x3cb4e5){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x16e'),_0x3cb4e5['label']));return this[_0x7f0d('0x33')][_0x7f0d('0x16f')](_0x3cb4e5[_0x7f0d('0x170')]['replace'](/\s+/g,''),_0x3cb4e5[_0x7f0d('0x163')]);};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x171')]=function(_0x321c4e){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x172'),_0x321c4e[_0x7f0d('0x35')]));return this[_0x7f0d('0x33')][_0x7f0d('0x173')](_0x321c4e['number'][_0x7f0d('0x55')](/\s+/g,''),_0x321c4e['escape_digits']);};AGIVertices['prototype'][_0x7f0d('0x174')]=function(_0x53e01f){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x175'),_0x53e01f[_0x7f0d('0x35')]));return this[_0x7f0d('0x33')][_0x7f0d('0x176')](_0x53e01f['text'],_0x53e01f[_0x7f0d('0x163')]);};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x177')]=function(_0x124401){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x178'),_0x124401[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x124401[_0x7f0d('0x179')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0x17a'));}var _0x851607=this[_0x7f0d('0x17b')][_0x7f0d('0x9d')](this,_0x124401[_0x7f0d('0x179')]);if(!_0x851607||!_0x851607[_0x7f0d('0x17c')]){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x124401,_0x7f0d('0x17d'));}var _0x47b14f={'from':util[_0x7f0d('0x26')](_0x7f0d('0x17e'),_0x851607[_0x7f0d('0x11')],_0x851607['email']||_0x851607[_0x7f0d('0x17c')][_0x7f0d('0x17f')]),'to':_0x124401['to']||'','cc':_0x124401['cc']||'','bcc':_0x124401['bcc']||'','subject':_0x124401[_0x7f0d('0x180')],'html':_0x124401[_0x7f0d('0x58')],'text':_0x124401[_0x7f0d('0x58')]};var _0x54edbb={'tls':{'rejectUnauthorized':![]}};if(_0x851607[_0x7f0d('0x17c')][_0x7f0d('0x181')]){_0x54edbb[_0x7f0d('0x181')]=_0x851607[_0x7f0d('0x17c')][_0x7f0d('0x181')];}else{_0x54edbb[_0x7f0d('0x182')]=_0x851607[_0x7f0d('0x17c')][_0x7f0d('0x182')];_0x54edbb[_0x7f0d('0x183')]=_0x851607[_0x7f0d('0x17c')]['port'];_0x54edbb[_0x7f0d('0x184')]=_0x851607[_0x7f0d('0x17c')]['secure'];}if(_0x851607[_0x7f0d('0x17c')][_0x7f0d('0x185')]){_0x54edbb[_0x7f0d('0x186')]={'user':_0x851607['Smtp'][_0x7f0d('0x17f')],'pass':_0x851607[_0x7f0d('0x17c')][_0x7f0d('0x187')]};}if(this[_0x7f0d('0x7d')](_0x124401[_0x7f0d('0x188')])){}logger['debug'](_0x7f0d('0x189'),JSON['stringify'](_0x47b14f));this[_0x7f0d('0x32')]['sync'](this,_0x124401,_0x124401[_0x7f0d('0x179')]);this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x18a'),_0x851607[_0x7f0d('0x11')]));this[_0x7f0d('0x20')][_0x7f0d('0x9d')](this,_0x54edbb,_0x47b14f);return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0x18b'));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x18c')]=function(_0x575b41){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x18d'),_0x575b41[_0x7f0d('0x35')]));return this[_0x7f0d('0x33')][_0x7f0d('0xa6')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x18e')]=function(_0x4bee66){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x18f'),_0x4bee66[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x4bee66[_0x7f0d('0x190')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0x191'));}var _0x22903c=this['getSmsAccount']['sync'](this,_0x4bee66['sms_account_id']);if(!_0x22903c){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x4bee66,'no\x20sms\x20account\x20found');}var _0x4f2683={'body':_0x4bee66[_0x7f0d('0x192')],'phone':_0x4bee66['to']||'','SmsAccountId':_0x22903c['id']};logger[_0x7f0d('0xcf')](_0x7f0d('0x193'),JSON[_0x7f0d('0x6e')](_0x4f2683));this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0x4bee66,_0x4bee66[_0x7f0d('0x190')]);this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x194'),_0x22903c[_0x7f0d('0x11')]));this[_0x7f0d('0x31')][_0x7f0d('0x9d')](this,_0x4f2683);return this['channel'][_0x7f0d('0xa6')](_0x7f0d('0x195'));};AGIVertices['prototype'][_0x7f0d('0x196')]=function(_0x370329){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x197'),_0x370329[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x370329[_0x7f0d('0xc8')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x370329,_0x7f0d('0x198'));}var _0x4dd343=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0x370329[_0x7f0d('0xc8')]);if(!_0x4dd343){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x370329,_0x7f0d('0xff'));}return this[_0x7f0d('0x33')][_0x7f0d('0x95')](_0x4dd343,_0x370329[_0x7f0d('0x199')]);};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x19a')]=function(_0x41222e){logger['info'](util[_0x7f0d('0x26')](_0x7f0d('0x19b'),_0x41222e[_0x7f0d('0x35')]));this[_0x7f0d('0x33')]['noop'](_0x7f0d('0x19c'));if(_0x41222e[_0x7f0d('0xa0')]===_0x7f0d('0x19d')){this[_0x7f0d('0x33')][_0x7f0d('0xa6')]('Answer');return this[_0x7f0d('0x33')][_0x7f0d('0xa0')]();}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](_0x7f0d('0x19e'));};AGIVertices['prototype'][_0x7f0d('0x19f')]=function(_0xa91246){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0x1a0'),_0xa91246[_0x7f0d('0x35')]));if(!this['isConfigured'](_0xa91246[_0x7f0d('0x1a1')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0xa91246,_0x7f0d('0x1a2'));}var _0x468b29=this[_0x7f0d('0x16')][_0x7f0d('0x9d')](this,_0xa91246['project_id']);if(!this[_0x7f0d('0x7d')](_0x468b29)){return this['channel'][_0x7f0d('0x29')](_0xa91246,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0xa91246[_0x7f0d('0x1a1')]));}if(_0x468b29===this['channel'][_0x7f0d('0x3d')]){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0xa91246,_0x7f0d('0x1a3'));}this[_0x7f0d('0x32')][_0x7f0d('0x9d')](this,_0xa91246,_0x468b29);var _0x47d1a0=this[_0x7f0d('0x33')][_0x7f0d('0x53')](_0x7f0d('0x1a4'),util[_0x7f0d('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x7f0d('0x8')][_0x7f0d('0x182')]||'127.0.0.1',_0x468b29,this[_0x7f0d('0x33')][_0x7f0d('0x3d')]));if(_0x47d1a0[_0x7f0d('0x9b')]===-0x1){return _0x47d1a0;}return this[_0x7f0d('0x33')]['noop'](util['format'](_0x7f0d('0xaa'),_0x7f0d('0x1a4'),_0x468b29));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x1a5')]=function(_0x112a12){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0x1a6'),_0x112a12[_0x7f0d('0x35')]));var _0x1e2206=this['shellCommand']['sync'](this,_0x112a12['command']);this[_0x7f0d('0x32')]['sync'](this,_0x112a12,_0x112a12[_0x7f0d('0x9f')]);if(this[_0x7f0d('0x7d')](_0x112a12['variable_id'])){var _0x559281=this[_0x7f0d('0xe')]['sync'](this,_0x112a12['variable_id']);if(_0x559281){this[_0x7f0d('0x33')][_0x7f0d('0x95')](_0x559281,_0x1e2206);return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x1a7'),_0x112a12[_0x7f0d('0x9f')],_0x559281));}}return this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x1a8'),_0x112a12[_0x7f0d('0x9f')]));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x1a9')]=function(_0x46a156){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x1aa'),_0x46a156[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x46a156[_0x7f0d('0x1ab')])){return this[_0x7f0d('0x33')]['noop'](_0x7f0d('0x1ac'));}if(!this[_0x7f0d('0x7d')](_0x46a156[_0x7f0d('0x58')])){return this['channel'][_0x7f0d('0xa6')]('no\x20text\x20configured');}this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x1ad'),_0x46a156[_0x7f0d('0x58')]));var _0x5e4791=this[_0x7f0d('0x56')][_0x7f0d('0x9d')](this,_0x46a156);if(_0x5e4791){this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5e4791));var _0x42513c=this[_0x7f0d('0x33')][_0x7f0d('0xea')](_0x5e4791);try{fs[_0x7f0d('0xeb')](_0x5e4791+_0x7f0d('0xec'));}catch(_0x474768){logger[_0x7f0d('0x29')](_0x474768);}return _0x42513c;}return this['channel']['error'](_0x46a156,_0x7f0d('0x1ae'));};AGIVertices[_0x7f0d('0x13')][_0x7f0d('0x1af')]=function(_0x12d0cc){logger[_0x7f0d('0x2b')](util['format'](_0x7f0d('0x1b0'),_0x12d0cc[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x12d0cc[_0x7f0d('0x58')])){return this[_0x7f0d('0x33')][_0x7f0d('0xa6')]('no\x20text\x20configured');}this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x1b1'),_0x12d0cc[_0x7f0d('0x58')]));var _0xc0afba=this['googleTTS'][_0x7f0d('0x9d')](this,_0x12d0cc);if(_0xc0afba){this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0xc0afba));var _0x48c556=this[_0x7f0d('0x33')][_0x7f0d('0xea')](_0xc0afba);try{fs['unlink'](_0xc0afba+_0x7f0d('0xec'));}catch(_0x208903){logger[_0x7f0d('0x29')](_0x208903);}return _0x48c556;}return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x12d0cc,_0x7f0d('0x1b2'));};AGIVertices['prototype'][_0x7f0d('0x1b3')]=function(_0x44372b){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x1b4'),_0x44372b[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x44372b[_0x7f0d('0x139')])){return this[_0x7f0d('0x33')]['error'](_0x44372b,_0x7f0d('0x13a'));}logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x13b'),this['channel'][_0x7f0d('0x38')],_0x44372b[_0x7f0d('0x139')]));var _0x41e9ac=this['agentUnpause'][_0x7f0d('0x9d')](this,_0x44372b['findBy']);if(_0x41e9ac){logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7f0d('0x33')][_0x7f0d('0x38')],_0x44372b[_0x7f0d('0x139')]));this['channel'][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x13c'),this['channel'][_0x7f0d('0x38')],_0x44372b[_0x7f0d('0x139')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7f0d('0x2b')](util[_0x7f0d('0x26')](_0x7f0d('0x13e'),this[_0x7f0d('0x33')]['callerid'],_0x44372b[_0x7f0d('0x139')]));this[_0x7f0d('0x33')][_0x7f0d('0xa6')](util[_0x7f0d('0x26')](_0x7f0d('0x13e'),this['channel'][_0x7f0d('0x38')],_0x44372b[_0x7f0d('0x139')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x7f0d('0x1b5')]=function(_0xd5431e){logger[_0x7f0d('0x2b')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xd5431e[_0x7f0d('0x35')]));var _0x53b822=this[_0x7f0d('0x33')][_0x7f0d('0x53')]('VOICEMAIL',[_0xd5431e['mailbox'],_0xd5431e[_0x7f0d('0x73')]]);if(_0x53b822[_0x7f0d('0x9b')]===-0x1){return _0x53b822;}return this[_0x7f0d('0x33')]['noop'](util[_0x7f0d('0x26')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0xd5431e[_0x7f0d('0x1b6')]));};AGIVertices['prototype']['vswitch']=function(_0x39ab82){logger[_0x7f0d('0x2b')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x39ab82[_0x7f0d('0x35')]));if(!this[_0x7f0d('0x7d')](_0x39ab82[_0x7f0d('0xc8')])){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x39ab82,_0x7f0d('0x198'));}var _0x565af5=this[_0x7f0d('0xe')][_0x7f0d('0x9d')](this,_0x39ab82['variable_id']);if(!_0x565af5){return this[_0x7f0d('0x33')][_0x7f0d('0x29')](_0x39ab82,'no\x20variable\x20found');}var _0x291417=this[_0x7f0d('0x33')][_0x7f0d('0xe')](_0x565af5);return{'code':0xc8,'result':_0x291417[_0x7f0d('0x99')]?_0x291417[_0x7f0d('0x99')]:'-'};};String[_0x7f0d('0x13')]['replaceAll']=function(_0x4f94cc,_0x536efd){return this[_0x7f0d('0x97')](_0x4f94cc)[_0x7f0d('0x1b7')](_0x536efd);};module[_0x7f0d('0x1b8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b5c6d52..3f57334 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 _0x84ab=['attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x4b03ee,_0x49039e){var _0x228468=function(_0x139086){while(--_0x139086){_0x4b03ee['push'](_0x4b03ee['shift']());}};_0x228468(++_0x49039e);}(_0x84ab,0x12f));var _0xb84a=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x84ab[_0x3e7e96];return _0x13f6f0;};'use strict';var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var ami=require(_0xb84a('0x3'));var logger=require(_0xb84a('0x4'))('acw');var RpcUser=require(_0xb84a('0x5'));var RpcVoiceAgentReport=require(_0xb84a('0x6'));function Acw(_0x47b8e3){this[_0xb84a('0x7')]=_0x47b8e3[_0xb84a('0x7')];this[_0xb84a('0x8')]=_0x47b8e3['agents'];this['timers']=_0x47b8e3['timers'];this[_0xb84a('0x9')]={};ami['on']('agentconnect',this[_0xb84a('0xa')][_0xb84a('0xb')](this));ami['on']('hanguprequest',this[_0xb84a('0xc')]['bind'](this));ami['on'](_0xb84a('0xd'),this[_0xb84a('0xe')][_0xb84a('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb84a('0xf'),this[_0xb84a('0x10')][_0xb84a('0xb')](this));ami['on'](_0xb84a('0x11'),this[_0xb84a('0x12')]['bind'](this));ami['on'](_0xb84a('0x13'),this[_0xb84a('0x14')][_0xb84a('0xb')](this));}function getDiff(_0x3c161c){var _0x44b26b=moment()[_0xb84a('0x15')](0x0);var _0x12ccab=moment(_0x3c161c)[_0xb84a('0x15')](0x0);return _0x44b26b[_0xb84a('0x16')](_0x12ccab,_0xb84a('0x17'));}Acw[_0xb84a('0x18')][_0xb84a('0x19')]=function(_0x5716bd){try{var _0x11dd4d=this;var _0x4a691d=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1a')];var _0x1c7378=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1b')];var _0x34d82f=this[_0xb84a('0x7')][_0x1c7378];var _0x3f7437=![];var _0x11d5a0=_0xb84a('0x1c');if(_0x34d82f[_0xb84a('0x1d')]){if(_0x34d82f[_0xb84a('0x1e')]['name']){_0x3f7437=!![];_0x11d5a0=_0x34d82f[_0xb84a('0x1e')][_0xb84a('0x1f')];}}ami['Action']({'action':_0xb84a('0x20'),'interface':_0x4a691d,'paused':!![],'reason':_0x11d5a0})[_0xb84a('0x21')](function(_0x42c788){if(_0x11dd4d[_0xb84a('0x8')][_0x4a691d]){return RpcUser['getAgent'](_0x11dd4d['agents'][_0x4a691d]['id'])[_0xb84a('0x21')](function(_0x19097d){if(_0x19097d&&!_0x19097d[_0xb84a('0x22')]){logger[_0xb84a('0x23')](_0xb84a('0x24'),_0x5716bd,_0x4a691d,_0x1c7378);var _0x3b8fb2=_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x25')]&&_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]?_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]:_0x5716bd;return RpcUser[_0xb84a('0x27')](_0x11dd4d[_0xb84a('0x8')][_0x4a691d],_0x11d5a0,_0x3b8fb2)[_0xb84a('0x21')](function(_0x3258a9){if(!_0x3f7437){_0x11dd4d[_0xb84a('0x28')][_0x4a691d]={};logger[_0xb84a('0x23')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d[_0xb84a('0x7')][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=setTimeout(_0x11dd4d[_0xb84a('0x2c')][_0xb84a('0xb')](_0x11dd4d,_0x4a691d),_0x11dd4d[_0xb84a('0x7')][_0x1c7378]['acwTimeout']*0x3e8);_0x11dd4d['timers'][_0x4a691d][_0xb84a('0x2d')]=moment()[_0xb84a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2f')]=_0x5716bd;_0x11dd4d['timers'][_0x4a691d]['queue']=_0x1c7378;_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x30')]=function(){var _0x49ba3d=getDiff(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2d')]);clearTimeout(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=![];RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x49ba3d},_0x11dd4d[_0xb84a('0x28')][_0x4a691d]['uniqueid'],_0x4a691d)[_0xb84a('0x21')](function(_0x5b794f){logger['info'](_0xb84a('0x32'),_0x5716bd,_0x49ba3d,_0x5b794f);})[_0xb84a('0x33')](function(_0x47a5b6){logger['error'](_0xb84a('0x34'),_0x5716bd,_0x47a5b6);});delete _0x11dd4d[_0xb84a('0x28')][_0x4a691d];};}});}else{logger[_0xb84a('0x23')](_0xb84a('0x35'),_0x5716bd,_0x4a691d,_0x1c7378);}});}})[_0xb84a('0x33')](function(_0x1d7ef1){logger[_0xb84a('0x36')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d['voiceQueues'][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);})[_0xb84a('0x37')](function(){delete _0x11dd4d[_0xb84a('0x9')][_0x5716bd];});}catch(_0xf894a6){logger[_0xb84a('0x36')](_0xb84a('0x38'),_0xf894a6[_0xb84a('0x39')]);}};Acw['prototype'][_0xb84a('0x2c')]=function(_0x56d783){try{var _0x1a3115=this;if(_0x1a3115[_0xb84a('0x28')][_0x56d783]){_0x1a3115[_0xb84a('0x28')][_0x56d783]['timer']=![];var _0x4af084=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x2f')];var _0x4a3737=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x1b')];var _0x4cb5d4=_0x1a3115[_0xb84a('0x7')][_0x4a3737][_0xb84a('0x2a')];logger['info'](_0xb84a('0x3a'),_0x56d783);RpcUser[_0xb84a('0x3b')](this[_0xb84a('0x8')][_0x56d783]);RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x4cb5d4,'agentacw':!![]},_0x4af084,_0x56d783)['then'](function(_0x57a1a8){logger['info'](_0xb84a('0x32'),_0x4af084,_0x4cb5d4,_0x57a1a8);})[_0xb84a('0x33')](function(_0x43a071){logger[_0xb84a('0x36')]('[%s][UPDATE][ERRORS:%s]',_0x4af084,_0x43a071);});}else{logger[_0xb84a('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x56d783);if(_0x1a3115[_0xb84a('0x28')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x1a3115[_0xb84a('0x28')]));}}}catch(_0x22791f){logger[_0xb84a('0x36')](_0xb84a('0x3c'),_0x22791f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0xa')]=function(_0x3908c3){try{if(this[_0xb84a('0x7')][_0x3908c3['queue']]&&(this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x1d')])){if(this[_0xb84a('0x8')][_0x3908c3[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x3908c3[_0xb84a('0x2f')]]={'queue':_0x3908c3[_0xb84a('0x1b')],'interface':_0x3908c3[_0xb84a('0x1a')],'destlinkedid':_0x3908c3[_0xb84a('0x26')]};}}}catch(_0xcd1e3b){logger[_0xb84a('0x36')](_0xb84a('0x3e'),_0xcd1e3b[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x14')]=function(_0x4ad7d0){try{if(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]]&&(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this[_0xb84a('0x7')][_0x4ad7d0['queue']][_0xb84a('0x1d')])){if(this['agents'][_0x4ad7d0[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x4ad7d0[_0xb84a('0x2f')]]={'queue':_0x4ad7d0[_0xb84a('0x1b')],'interface':_0x4ad7d0['interface']};}}}catch(_0x21ef72){logger[_0xb84a('0x36')](_0xb84a('0x3f'),_0x21ef72['message']);}};Acw['prototype'][_0xb84a('0xc')]=function(_0x10b0cc){try{if(this[_0xb84a('0x9')][_0x10b0cc['uniqueid']]&&_['isUndefined'](this['channels'][_0x10b0cc[_0xb84a('0x2f')]][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x40'),_0x10b0cc[_0xb84a('0x2f')]);this['startAcw'](_0x10b0cc['uniqueid']);}else if(this['channels'][_0x10b0cc['linkedid']]&&_[_0xb84a('0x41')](this[_0xb84a('0x9')][_0x10b0cc['linkedid']][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x42'),_0x10b0cc[_0xb84a('0x43')]);this[_0xb84a('0x19')](_0x10b0cc[_0xb84a('0x43')]);}}catch(_0x5a07d2){logger['error'](_0xb84a('0x44'),_0x5a07d2['message']);}};Acw[_0xb84a('0x18')]['syncHangup']=function(_0x575908){try{if(this['channels'][_0x575908[_0xb84a('0x2f')]]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x2f')]][_0xb84a('0x25')]){logger[_0xb84a('0x23')](_0xb84a('0x45'),_0x575908[_0xb84a('0x2f')]);this[_0xb84a('0x19')](_0x575908['uniqueid']);}else if(this['channels'][_0x575908['linkedid']]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x43')]]['attended']){logger[_0xb84a('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x575908['linkedid']);this['startAcw'](_0x575908[_0xb84a('0x43')]);}}catch(_0x172076){logger[_0xb84a('0x36')]('[ACW][syncHangup]\x20%s',_0x172076[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x10')]=function(_0x505994){try{if(!_[_0xb84a('0x46')](this['channels'][_0x505994['transfereeuniqueid']])){this[_0xb84a('0x19')](_0x505994['transfereeuniqueid']);if(this[_0xb84a('0x9')][_0x505994['secondtransfereruniqueid']]){this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994['transfertargetuniqueid']]=this['channels'][_0x505994['secondtransfereruniqueid']];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]];}}else if(!_['isNil'](this['channels'][_0x505994[_0xb84a('0x48')]])){this[_0xb84a('0x19')](_0x505994[_0xb84a('0x48')]);if(this['channels'][_0x505994[_0xb84a('0x49')]]){this[_0xb84a('0x9')][_0x505994['origtransfereruniqueid']][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994[_0xb84a('0x4a')]]=this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];}}}catch(_0x47c27f){logger[_0xb84a('0x36')](_0xb84a('0x4b'),_0x47c27f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0x12')]=function(_0x34ac0f){try{if(this[_0xb84a('0x9')][_0x34ac0f[_0xb84a('0x4c')]]){logger[_0xb84a('0x23')](_0xb84a('0x4d'),JSON[_0xb84a('0x4e')](_0x34ac0f[_0xb84a('0x4c')]));this['startAcw'](_0x34ac0f[_0xb84a('0x4c')]);}else if(this['channels'][_0x34ac0f['transfererlinkedid']]){logger[_0xb84a('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb84a('0x4e')](_0x34ac0f['transfererlinkedid']));this[_0xb84a('0x19')](_0x34ac0f[_0xb84a('0x4f')]);}}catch(_0x4c7d56){logger[_0xb84a('0x36')](_0xb84a('0x50'),_0x4c7d56[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x51')]=function(_0x192c9a){try{if(this[_0xb84a('0x7')][_0x192c9a['queue']]&&this[_0xb84a('0x7')][_0x192c9a['queue']]['autopause']===_0xb84a('0x52')){if(this[_0xb84a('0x8')][_0x192c9a[_0xb84a('0x1a')]]){logger[_0xb84a('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x192c9a['uniqueid'],_0x192c9a[_0xb84a('0x1a')],_0x192c9a[_0xb84a('0x1b')]);return RpcUser[_0xb84a('0x27')](this[_0xb84a('0x8')][_0x192c9a['interface']],_0xb84a('0x53'),_0x192c9a['uniqueid']);}}}catch(_0x1eec1f){logger['error'](_0xb84a('0x54'),_0x1eec1f['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xed1f=['transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','all','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','bind','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xed1f,0x6a));var _0xfed1=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xed1f[_0x725b8e];return _0x43ac45;};'use strict';var util=require(_0xfed1('0x0'));var _=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var ami=require(_0xfed1('0x3'));var logger=require(_0xfed1('0x4'))(_0xfed1('0x5'));var RpcUser=require(_0xfed1('0x6'));var RpcVoiceAgentReport=require(_0xfed1('0x7'));function Acw(_0x2209b3){this[_0xfed1('0x8')]=_0x2209b3[_0xfed1('0x8')];this[_0xfed1('0x9')]=_0x2209b3[_0xfed1('0x9')];this[_0xfed1('0xa')]=_0x2209b3[_0xfed1('0xa')];this[_0xfed1('0xb')]={};ami['on'](_0xfed1('0xc'),this[_0xfed1('0xd')]['bind'](this));ami['on'](_0xfed1('0xe'),this[_0xfed1('0xf')]['bind'](this));ami['on'](_0xfed1('0x10'),this[_0xfed1('0x11')]['bind'](this));ami['on'](_0xfed1('0x12'),this['syncAgentRingNoAnswer'][_0xfed1('0x13')](this));ami['on'](_0xfed1('0x14'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xfed1('0x15'),this[_0xfed1('0x16')]['bind'](this));ami['on'](_0xfed1('0x17'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x3f6555){var _0x397af9=moment()['milliseconds'](0x0);var _0x2dde3a=moment(_0x3f6555)['milliseconds'](0x0);return _0x397af9['diff'](_0x2dde3a,_0xfed1('0x18'));}Acw[_0xfed1('0x19')][_0xfed1('0x1a')]=function(_0x123c46){try{var _0x582e67=this;var _0x1a00f6=this['channels'][_0x123c46][_0xfed1('0x1b')];var _0x29a32f=this['channels'][_0x123c46][_0xfed1('0x1c')];var _0xa72a20=this['voiceQueues'][_0x29a32f];var _0x59509b=![];var _0x586ea6=_0xfed1('0x1d');if(_0xa72a20['mandatoryDisposition']){if(_0xa72a20[_0xfed1('0x1e')][_0xfed1('0x1f')]){_0x59509b=!![];_0x586ea6=_0xa72a20['mandatoryDispositionPause'][_0xfed1('0x1f')];}}ami[_0xfed1('0x20')]({'action':'QueuePause','interface':_0x1a00f6,'paused':!![],'reason':_0x586ea6})[_0xfed1('0x21')](function(_0x2ea7a8){if(_0x582e67[_0xfed1('0x9')][_0x1a00f6]){return RpcUser[_0xfed1('0x22')](_0x582e67['agents'][_0x1a00f6]['id'])[_0xfed1('0x21')](function(_0x59333e){if(_0x59333e&&!_0x59333e[_0xfed1('0x23')]){logger[_0xfed1('0x24')](_0xfed1('0x25'),_0x123c46,_0x1a00f6,_0x29a32f);var _0x532ec2=_0x582e67[_0xfed1('0xb')][_0x123c46]['attended']&&_0x582e67[_0xfed1('0xb')][_0x123c46][_0xfed1('0x26')]?_0x582e67[_0xfed1('0xb')][_0x123c46][_0xfed1('0x26')]:_0x123c46;return RpcUser[_0xfed1('0x27')](_0x582e67[_0xfed1('0x9')][_0x1a00f6],_0x586ea6,_0x532ec2)['then'](function(_0x465ce6){if(!_0x59509b){_0x582e67[_0xfed1('0xa')][_0x1a00f6]={};logger['info'](_0xfed1('0x28'),_0x123c46,_0x582e67[_0xfed1('0x8')][_0x29a32f][_0xfed1('0x29')],_0x1a00f6,_0x29a32f);_0x582e67[_0xfed1('0xa')][_0x1a00f6][_0xfed1('0x2a')]=setTimeout(_0x582e67[_0xfed1('0x2b')]['bind'](_0x582e67,_0x1a00f6),_0x582e67[_0xfed1('0x8')][_0x29a32f]['acwTimeout']*0x3e8);_0x582e67[_0xfed1('0xa')][_0x1a00f6]['lastPauseAt']=moment()['format'](_0xfed1('0x2c'));_0x582e67[_0xfed1('0xa')][_0x1a00f6][_0xfed1('0x2d')]=_0x123c46;_0x582e67['timers'][_0x1a00f6][_0xfed1('0x1c')]=_0x29a32f;_0x582e67[_0xfed1('0xa')][_0x1a00f6][_0xfed1('0x2e')]=function(){var _0x383955=getDiff(_0x582e67[_0xfed1('0xa')][_0x1a00f6][_0xfed1('0x2f')]);clearTimeout(_0x582e67['timers'][_0x1a00f6][_0xfed1('0x2a')]);_0x582e67[_0xfed1('0xa')][_0x1a00f6]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x383955},_0x582e67[_0xfed1('0xa')][_0x1a00f6][_0xfed1('0x2d')],_0x1a00f6)[_0xfed1('0x21')](function(_0x71147f){logger[_0xfed1('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x123c46,_0x383955,_0x71147f);})[_0xfed1('0x30')](function(_0x21b292){logger[_0xfed1('0x31')](_0xfed1('0x32'),_0x123c46,_0x21b292);});delete _0x582e67[_0xfed1('0xa')][_0x1a00f6];};}});}else{logger['info'](_0xfed1('0x33'),_0x123c46,_0x1a00f6,_0x29a32f);}});}})['catch'](function(_0x11c5bd){logger[_0xfed1('0x31')](_0xfed1('0x28'),_0x123c46,_0x582e67[_0xfed1('0x8')][_0x29a32f][_0xfed1('0x29')],_0x1a00f6,_0x29a32f);})[_0xfed1('0x34')](function(){delete _0x582e67[_0xfed1('0xb')][_0x123c46];});}catch(_0x41bf2a){logger['error'](_0xfed1('0x35'),_0x41bf2a[_0xfed1('0x36')]);}};Acw[_0xfed1('0x19')][_0xfed1('0x2b')]=function(_0x57da75){try{var _0x4b1d7b=this;if(_0x4b1d7b[_0xfed1('0xa')][_0x57da75]){_0x4b1d7b[_0xfed1('0xa')][_0x57da75][_0xfed1('0x2a')]=![];var _0x1105bd=_0x4b1d7b[_0xfed1('0xa')][_0x57da75][_0xfed1('0x2d')];var _0x46a150=_0x4b1d7b[_0xfed1('0xa')][_0x57da75]['queue'];var _0x52c7b8=_0x4b1d7b[_0xfed1('0x8')][_0x46a150][_0xfed1('0x29')];logger['info'](_0xfed1('0x37'),_0x57da75);RpcUser[_0xfed1('0x38')](this[_0xfed1('0x9')][_0x57da75]);RpcVoiceAgentReport[_0xfed1('0x39')]({'acwtime':_0x52c7b8,'agentacw':!![]},_0x1105bd,_0x57da75)[_0xfed1('0x21')](function(_0x31ffeb){logger[_0xfed1('0x24')](_0xfed1('0x3a'),_0x1105bd,_0x52c7b8,_0x31ffeb);})[_0xfed1('0x30')](function(_0x5f3e1f){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1105bd,_0x5f3e1f);});}else{logger[_0xfed1('0x31')](_0xfed1('0x3b'),_0x57da75);if(_0x4b1d7b[_0xfed1('0xa')]){logger['info'](_0xfed1('0x3c'),JSON['stringify'](_0x4b1d7b[_0xfed1('0xa')]));}}}catch(_0x2cfdca){logger[_0xfed1('0x31')]('[ACW][STOP]\x20%s',_0x2cfdca[_0xfed1('0x36')]);}};Acw[_0xfed1('0x19')][_0xfed1('0xd')]=function(_0x4b4115){try{if(this[_0xfed1('0x8')][_0x4b4115['queue']]&&(this[_0xfed1('0x8')][_0x4b4115[_0xfed1('0x1c')]][_0xfed1('0x5')]||this[_0xfed1('0x8')][_0x4b4115[_0xfed1('0x1c')]][_0xfed1('0x3d')])){if(this[_0xfed1('0x9')][_0x4b4115[_0xfed1('0x1b')]]){this[_0xfed1('0xb')][_0x4b4115['uniqueid']]={'queue':_0x4b4115[_0xfed1('0x1c')],'interface':_0x4b4115[_0xfed1('0x1b')],'destlinkedid':_0x4b4115[_0xfed1('0x26')]};}}}catch(_0x4a86af){logger['error'](_0xfed1('0x3e'),_0x4a86af[_0xfed1('0x36')]);}};Acw[_0xfed1('0x19')][_0xfed1('0x3f')]=function(_0x40c096){try{if(this[_0xfed1('0x8')][_0x40c096[_0xfed1('0x1c')]]&&(this[_0xfed1('0x8')][_0x40c096[_0xfed1('0x1c')]][_0xfed1('0x5')]||this[_0xfed1('0x8')][_0x40c096[_0xfed1('0x1c')]]['mandatoryDisposition'])){if(this[_0xfed1('0x9')][_0x40c096[_0xfed1('0x1b')]]){this[_0xfed1('0xb')][_0x40c096[_0xfed1('0x2d')]]={'queue':_0x40c096[_0xfed1('0x1c')],'interface':_0x40c096[_0xfed1('0x1b')]};}}}catch(_0x5eda29){logger[_0xfed1('0x31')](_0xfed1('0x40'),_0x5eda29[_0xfed1('0x36')]);}};Acw['prototype'][_0xfed1('0xf')]=function(_0x10f98d){try{if(this[_0xfed1('0xb')][_0x10f98d[_0xfed1('0x2d')]]&&_['isUndefined'](this[_0xfed1('0xb')][_0x10f98d[_0xfed1('0x2d')]][_0xfed1('0x41')])){logger[_0xfed1('0x24')](_0xfed1('0x42'),_0x10f98d[_0xfed1('0x2d')]);this[_0xfed1('0x1a')](_0x10f98d[_0xfed1('0x2d')]);}else if(this[_0xfed1('0xb')][_0x10f98d[_0xfed1('0x43')]]&&_[_0xfed1('0x44')](this[_0xfed1('0xb')][_0x10f98d[_0xfed1('0x43')]][_0xfed1('0x41')])){logger[_0xfed1('0x24')](_0xfed1('0x45'),_0x10f98d[_0xfed1('0x43')]);this[_0xfed1('0x1a')](_0x10f98d['linkedid']);}}catch(_0x589feb){logger[_0xfed1('0x31')](_0xfed1('0x46'),_0x589feb[_0xfed1('0x36')]);}};Acw[_0xfed1('0x19')]['syncHangup']=function(_0x3c2534){try{if(this[_0xfed1('0xb')][_0x3c2534['uniqueid']]&&this['channels'][_0x3c2534['uniqueid']][_0xfed1('0x41')]){logger[_0xfed1('0x24')](_0xfed1('0x47'),_0x3c2534[_0xfed1('0x2d')]);this[_0xfed1('0x1a')](_0x3c2534[_0xfed1('0x2d')]);}else if(this[_0xfed1('0xb')][_0x3c2534[_0xfed1('0x43')]]&&this[_0xfed1('0xb')][_0x3c2534[_0xfed1('0x43')]]['attended']){logger['info'](_0xfed1('0x48'),_0x3c2534[_0xfed1('0x43')]);this[_0xfed1('0x1a')](_0x3c2534[_0xfed1('0x43')]);}}catch(_0x83b8d0){logger[_0xfed1('0x31')](_0xfed1('0x49'),_0x83b8d0[_0xfed1('0x36')]);}};Acw[_0xfed1('0x19')][_0xfed1('0x4a')]=function(_0xbd49dc){try{if(!_[_0xfed1('0x4b')](this[_0xfed1('0xb')][_0xbd49dc[_0xfed1('0x4c')]])){this[_0xfed1('0x1a')](_0xbd49dc[_0xfed1('0x4c')]);if(this[_0xfed1('0xb')][_0xbd49dc['secondtransfereruniqueid']]){this['channels'][_0xbd49dc[_0xfed1('0x4d')]][_0xfed1('0x41')]=!![];this[_0xfed1('0xb')][_0xbd49dc[_0xfed1('0x4e')]]=this[_0xfed1('0xb')][_0xbd49dc[_0xfed1('0x4d')]];delete this[_0xfed1('0xb')][_0xbd49dc[_0xfed1('0x4d')]];}}else if(!_[_0xfed1('0x4b')](this[_0xfed1('0xb')][_0xbd49dc[_0xfed1('0x4e')]])){this[_0xfed1('0x1a')](_0xbd49dc[_0xfed1('0x4e')]);if(this[_0xfed1('0xb')][_0xbd49dc['origtransfereruniqueid']]){this[_0xfed1('0xb')][_0xbd49dc['origtransfereruniqueid']]['attended']=!![];this[_0xfed1('0xb')][_0xbd49dc['transfereeuniqueid']]=this[_0xfed1('0xb')][_0xbd49dc['origtransfereruniqueid']];delete this[_0xfed1('0xb')][_0xbd49dc[_0xfed1('0x4f')]];}}}catch(_0x53f0ab){logger[_0xfed1('0x31')](_0xfed1('0x50'),_0x53f0ab['message']);}};Acw[_0xfed1('0x19')][_0xfed1('0x16')]=function(_0x1c99c6){try{if(this[_0xfed1('0xb')][_0x1c99c6['transfereruniqueid']]){logger[_0xfed1('0x24')](_0xfed1('0x51'),JSON[_0xfed1('0x52')](_0x1c99c6[_0xfed1('0x53')]));this[_0xfed1('0x1a')](_0x1c99c6[_0xfed1('0x53')]);}else if(this[_0xfed1('0xb')][_0x1c99c6[_0xfed1('0x54')]]){logger['info'](_0xfed1('0x55'),JSON[_0xfed1('0x52')](_0x1c99c6[_0xfed1('0x54')]));this[_0xfed1('0x1a')](_0x1c99c6[_0xfed1('0x54')]);}}catch(_0x3d7be2){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x3d7be2['message']);}};Acw[_0xfed1('0x19')][_0xfed1('0x56')]=function(_0x3aea22){try{if(this[_0xfed1('0x8')][_0x3aea22['queue']]&&this[_0xfed1('0x8')][_0x3aea22['queue']][_0xfed1('0x57')]===_0xfed1('0x58')){if(this[_0xfed1('0x9')][_0x3aea22[_0xfed1('0x1b')]]){logger[_0xfed1('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3aea22[_0xfed1('0x2d')],_0x3aea22[_0xfed1('0x1b')],_0x3aea22[_0xfed1('0x1c')]);return RpcUser['savePause'](this[_0xfed1('0x9')][_0x3aea22[_0xfed1('0x1b')]],_0xfed1('0x59'),_0x3aea22[_0xfed1('0x2d')]);}}}catch(_0x58b2b7){logger[_0xfed1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x58b2b7[_0xfed1('0x36')]);}};module[_0xfed1('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e6cdc97..b8d3ea3 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 _0x70ba=['close','exports','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipPeerStatus','catch','log'];(function(_0x51eaf7,_0x71181e){var _0x1dd933=function(_0x46c02d){while(--_0x46c02d){_0x51eaf7['push'](_0x51eaf7['shift']());}};_0x1dd933(++_0x71181e);}(_0x70ba,0x19c));var _0xa70b=function(_0x3d8c50,_0x897375){_0x3d8c50=_0x3d8c50-0x0;var _0x44655e=_0x70ba[_0x3d8c50];return _0x44655e;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa70b('0x0'));var moment=require('moment');var util=require(_0xa70b('0x1'));var _=require(_0xa70b('0x2'));var logger=require(_0xa70b('0x3'))(_0xa70b('0x4'));var config=require(_0xa70b('0x5'));var ami=new Manager(config[_0xa70b('0x6')][_0xa70b('0x7')],config[_0xa70b('0x6')]['ip'],config[_0xa70b('0x6')][_0xa70b('0x8')],config[_0xa70b('0x6')][_0xa70b('0x9')],!![]);ami[_0xa70b('0xa')]();ami[_0xa70b('0xb')]=BPromise[_0xa70b('0xc')](ami['action']);function error(_0x120cae){logger[_0xa70b('0xd')](util[_0xa70b('0xe')](_0xa70b('0xf'),config['asterisk'][_0xa70b('0x8')],config[_0xa70b('0x6')]['ip'],config[_0xa70b('0x6')][_0xa70b('0x7')],util[_0xa70b('0x10')](_0x120cae,![],null)));}function close(){logger['error'](util['format'](_0xa70b('0x11'),config[_0xa70b('0x6')]['username'],config[_0xa70b('0x6')]['ip'],config[_0xa70b('0x6')]['port']));}ami[_0xa70b('0x12')]=function(){return function(){return ami[_0xa70b('0xb')]({'action':_0xa70b('0x13')});};};ami[_0xa70b('0x14')]=function(){return function(){return ami['Action']({'action':_0xa70b('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xa70b('0xb')]({'action':_0xa70b('0x16')});};};ami[_0xa70b('0x17')]=function(){return function(){return ami['Action']({'action':_0xa70b('0x18')});};};ami[_0xa70b('0x19')]=function(){return function(){return ami[_0xa70b('0xb')]({'action':_0xa70b('0x1a')});};};function connect(_0x42714a){logger[_0xa70b('0x1b')](util['format'](_0xa70b('0x1c'),config[_0xa70b('0x6')][_0xa70b('0x8')],config[_0xa70b('0x6')]['ip'],config[_0xa70b('0x6')][_0xa70b('0x7')]));ami[_0xa70b('0x1d')]('error',error);ami['once']('close',close);}ami['on'](_0xa70b('0x1e'),connect);ami['on'](_0xa70b('0x1f'),function(_0x562db8){logger[_0xa70b('0x1b')](util[_0xa70b('0xe')](_0xa70b('0x20'),config[_0xa70b('0x6')][_0xa70b('0x8')],config[_0xa70b('0x6')]['ip'],config[_0xa70b('0x6')][_0xa70b('0x7')],util['inspect'](_0x562db8,![],null)));});ami['on'](_0xa70b('0x21'),function(_0x1a7f11){logger[_0xa70b('0x1b')](util[_0xa70b('0xe')](_0xa70b('0x22'),config[_0xa70b('0x6')][_0xa70b('0x8')],config['asterisk']['ip'],config[_0xa70b('0x6')][_0xa70b('0x7')]));return BPromise['resolve']()['then'](ami[_0xa70b('0x12')]())[_0xa70b('0x23')](ami[_0xa70b('0x14')]())[_0xa70b('0x23')](ami[_0xa70b('0x24')]())['then'](ami['actionQueueSummary']())[_0xa70b('0x23')](ami[_0xa70b('0x19')]())[_0xa70b('0x25')](function(_0x524f4c){console[_0xa70b('0x26')](_0x524f4c);});});ami[_0xa70b('0x1d')](_0xa70b('0xd'),error);ami[_0xa70b('0x1d')](_0xa70b('0x27'),close);module[_0xa70b('0x28')]=ami; \ No newline at end of file +var _0x67ee=['exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','password','Action','action','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','format','username','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','actionCoreShowChannels'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x67ee,0x145));var _0xe67e=function(_0x406480,_0x251d00){_0x406480=_0x406480-0x0;var _0x195346=_0x67ee[_0x406480];return _0x195346;};'use strict';var Manager=require(_0xe67e('0x0'));var BPromise=require(_0xe67e('0x1'));var moment=require(_0xe67e('0x2'));var util=require(_0xe67e('0x3'));var _=require(_0xe67e('0x4'));var logger=require(_0xe67e('0x5'))('ami');var config=require(_0xe67e('0x6'));var ami=new Manager(config[_0xe67e('0x7')][_0xe67e('0x8')],config[_0xe67e('0x7')]['ip'],config[_0xe67e('0x7')]['username'],config[_0xe67e('0x7')][_0xe67e('0x9')],!![]);ami['keepConnected']();ami[_0xe67e('0xa')]=BPromise['promisify'](ami[_0xe67e('0xb')]);function error(_0x2acbd6){logger['error'](util['format'](_0xe67e('0xc'),config['asterisk']['username'],config[_0xe67e('0x7')]['ip'],config[_0xe67e('0x7')][_0xe67e('0x8')],util['inspect'](_0x2acbd6,![],null)));}function close(){logger[_0xe67e('0xd')](util[_0xe67e('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe67e('0x7')][_0xe67e('0xf')],config[_0xe67e('0x7')]['ip'],config[_0xe67e('0x7')][_0xe67e('0x8')]));}ami[_0xe67e('0x10')]=function(){return function(){return ami[_0xe67e('0xa')]({'action':'sipshowregistry'});};};ami[_0xe67e('0x11')]=function(){return function(){return ami[_0xe67e('0xa')]({'action':_0xe67e('0x12')});};};ami[_0xe67e('0x13')]=function(){return function(){return ami[_0xe67e('0xa')]({'action':_0xe67e('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xe67e('0xa')]({'action':_0xe67e('0x15')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xe67e('0xa')]({'action':'coreshowchannels'});};};function connect(_0x3e45fc){logger[_0xe67e('0x16')](util[_0xe67e('0xe')](_0xe67e('0x17'),config[_0xe67e('0x7')][_0xe67e('0xf')],config[_0xe67e('0x7')]['ip'],config['asterisk'][_0xe67e('0x8')]));ami[_0xe67e('0x18')](_0xe67e('0xd'),error);ami[_0xe67e('0x18')](_0xe67e('0x19'),close);}ami['on'](_0xe67e('0x1a'),connect);ami['on'](_0xe67e('0x1b'),function(_0x4df523){logger[_0xe67e('0x16')](util[_0xe67e('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe67e('0x7')][_0xe67e('0xf')],config[_0xe67e('0x7')]['ip'],config[_0xe67e('0x7')]['port'],util[_0xe67e('0x1c')](_0x4df523,![],null)));});ami['on'](_0xe67e('0x1d'),function(_0x35624c){logger[_0xe67e('0x16')](util['format'](_0xe67e('0x1e'),config['asterisk'][_0xe67e('0xf')],config[_0xe67e('0x7')]['ip'],config[_0xe67e('0x7')]['port']));return BPromise[_0xe67e('0x1f')]()[_0xe67e('0x20')](ami[_0xe67e('0x10')]())['then'](ami[_0xe67e('0x11')]())[_0xe67e('0x20')](ami[_0xe67e('0x13')]())['then'](ami[_0xe67e('0x21')]())[_0xe67e('0x20')](ami[_0xe67e('0x22')]())['catch'](function(_0x1c6c12){console['log'](_0x1c6c12);});});ami[_0xe67e('0x18')](_0xe67e('0xd'),error);ami[_0xe67e('0x18')](_0xe67e('0x19'),close);module[_0xe67e('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5450b48..08713e1 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 _0x690a=['http','Request','then','rpc','memberReport','error','message','exports','jayson/promise','bluebird','ami','client'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x690a,0x110));var _0xa690=function(_0x2ec73a,_0x279dba){_0x2ec73a=_0x2ec73a-0x0;var _0xdf9eb1=_0x690a[_0x2ec73a];return _0xdf9eb1;};'use strict';var jayson=require(_0xa690('0x0'));var BPromise=require(_0xa690('0x1'));var logger=require('../../config/logger')(_0xa690('0x2'));var client=jayson[_0xa690('0x3')][_0xa690('0x4')]({'port':0x2329});client[_0xa690('0x5')]=function(_0x1c6b1a,_0x3a2567){return new BPromise(function(_0x508f9f,_0x3bc5e8){return client['request'](_0x1c6b1a,_0x3a2567)[_0xa690('0x6')](function(_0x18146c){logger['debug'](_0xa690('0x7'),_0xa690('0x8'),_0x1c6b1a,_0x3a2567,_0x18146c);if(_0x18146c[_0xa690('0x9')]){logger['error'](_0xa690('0x7'),_0xa690('0x8'),_0x1c6b1a,_0x18146c['error'][_0xa690('0xa')],_0x3a2567);return _0x3bc5e8(_0x18146c['error']['message']);}else{return _0x508f9f(_0x18146c['result']);}})['catch'](function(_0xc12c45){logger[_0xa690('0x9')](_0xa690('0x7'),_0xa690('0x8'),_0x1c6b1a,_0xc12c45,_0x3a2567);return _0x3bc5e8(_0xc12c45);});});};module[_0xa690('0xb')]=client; \ No newline at end of file +var _0xcfb2=['bluebird','../../config/logger','ami','client','http','Request','request','then','debug','rpc','error','memberReport','message','result','catch','exports','jayson/promise'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0xcfb2,0x164));var _0x2cfb=function(_0x10ccc8,_0x38cc3e){_0x10ccc8=_0x10ccc8-0x0;var _0x38c7a4=_0xcfb2[_0x10ccc8];return _0x38c7a4;};'use strict';var jayson=require(_0x2cfb('0x0'));var BPromise=require(_0x2cfb('0x1'));var logger=require(_0x2cfb('0x2'))(_0x2cfb('0x3'));var client=jayson[_0x2cfb('0x4')][_0x2cfb('0x5')]({'port':0x2329});client[_0x2cfb('0x6')]=function(_0x1150db,_0x5054c8){return new BPromise(function(_0x3c0ee9,_0x5a52c6){return client[_0x2cfb('0x7')](_0x1150db,_0x5054c8)[_0x2cfb('0x8')](function(_0x3ec72c){logger[_0x2cfb('0x9')](_0x2cfb('0xa'),'memberReport',_0x1150db,_0x5054c8,_0x3ec72c);if(_0x3ec72c[_0x2cfb('0xb')]){logger[_0x2cfb('0xb')](_0x2cfb('0xa'),_0x2cfb('0xc'),_0x1150db,_0x3ec72c[_0x2cfb('0xb')][_0x2cfb('0xd')],_0x5054c8);return _0x5a52c6(_0x3ec72c['error'][_0x2cfb('0xd')]);}else{return _0x3c0ee9(_0x3ec72c[_0x2cfb('0xe')]);}})[_0x2cfb('0xf')](function(_0x582b6b){logger['error'](_0x2cfb('0xa'),_0x2cfb('0xc'),_0x1150db,_0x582b6b,_0x5054c8);return _0x5a52c6(_0x582b6b);});});};module[_0x2cfb('0x10')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 94bd43d..9979a61 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1fc=['name','Contact','phone','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid'];(function(_0x3cc397,_0x4c4223){var _0x196ec8=function(_0x1163d1){while(--_0x1163d1){_0x3cc397['push'](_0x3cc397['shift']());}};_0x196ec8(++_0x4c4223);}(_0xb1fc,0xb3));var _0xcb1f=function(_0x68fc8f,_0x36ab5b){_0x68fc8f=_0x68fc8f-0x0;var _0x26d3b7=_0xb1fc[_0x68fc8f];return _0x26d3b7;};'use strict';var util=require(_0xcb1f('0x0'));var _=require(_0xcb1f('0x1'));var moment=require('moment');function checkNameSurname(_0x34b78d,_0x129846,_0x248647){var _0x2ace7a='';if(!_[_0xcb1f('0x2')](_0x129846)&&_0xcb1f('0x3')===typeof _0x129846){_0x2ace7a+=_0x129846;}if(!_[_0xcb1f('0x2')](_0x248647)&&_0xcb1f('0x3')===typeof _0x248647){_0x2ace7a+='\x20'+_0x248647;}if(_0x2ace7a!==''){return _0x2ace7a;}return _0x34b78d;}function Action(_0x52b900,_0x3b9740,_0x4291a9){this[_0xcb1f('0x4')]=_0x52b900;this[_0xcb1f('0x5')]=_0x4291a9||undefined;this[_0xcb1f('0x6')]=checkNameSurname(_0x3b9740[_0xcb1f('0x7')][_0xcb1f('0x8')],_0x3b9740[_0xcb1f('0x7')]['firstName'],_0x3b9740[_0xcb1f('0x7')]['lastName']);this[_0xcb1f('0x9')]=_0x3b9740['Contact'][_0xcb1f('0x8')];this[_0xcb1f('0xa')]=_0x52b900[_0xcb1f('0x6')];this[_0xcb1f('0xb')]=_0x3b9740[_0xcb1f('0xb')]||![];this[_0xcb1f('0xc')]=_0x52b900[_0xcb1f('0xc')];this[_0xcb1f('0xd')]=_0x52b900[_0xcb1f('0xd')]||0x3;this['scheduledat']=_0x3b9740[_0xcb1f('0xe')];this[_0xcb1f('0xf')]=_0x3b9740[_0xcb1f('0xf')];this['countcongestionretry']=_0x3b9740['countcongestionretry'];this[_0xcb1f('0x10')]=_0x3b9740[_0xcb1f('0x10')];this[_0xcb1f('0x11')]=_0x3b9740['ContactId'];this[_0xcb1f('0x12')]=_0x3b9740[_0xcb1f('0x12')];this['UserId']=_0x3b9740[_0xcb1f('0x13')];this['VoiceQueueId']=_0x3b9740[_0xcb1f('0x14')];this[_0xcb1f('0x15')]=_0x3b9740[_0xcb1f('0x15')];this['idHopper']=_0x3b9740['id'];this['ContactFirstName']=_0x3b9740[_0xcb1f('0x7')][_0xcb1f('0x16')]||'';this[_0xcb1f('0x17')]=moment()[_0xcb1f('0x18')](_0xcb1f('0x19'));this[_0xcb1f('0x1a')]=_0x3b9740[_0xcb1f('0x1a')];this[_0xcb1f('0x1b')]=_0x3b9740[_0xcb1f('0x1b')];this[_0xcb1f('0x1c')]=_0x3b9740['callbackat'];this['recallme']=_0x3b9740['recallme'];this[_0xcb1f('0x1d')]='';this['originatecalleridname']='';}Action['prototype'][_0xcb1f('0x1e')]=function(){return util[_0xcb1f('0x18')](_0xcb1f('0x1f'),this['name'],this[_0xcb1f('0x4')]['dialCutDigit']>0x0?this['number'][_0xcb1f('0x20')](this[_0xcb1f('0x4')][_0xcb1f('0x21')]):this[_0xcb1f('0x9')]);};Action[_0xcb1f('0x22')][_0xcb1f('0x23')]=function(){return this[_0xcb1f('0xa')];};module[_0xcb1f('0x24')]=Action; \ No newline at end of file +var _0x3c34=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','exports','util','lodash','moment','string','isNil','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x22b17c,_0x4dfb2e){var _0x8e8140=function(_0x534351){while(--_0x534351){_0x22b17c['push'](_0x22b17c['shift']());}};_0x8e8140(++_0x4dfb2e);}(_0x3c34,0x14c));var _0x43c3=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x3c34[_0x27e811];return _0x1627fa;};'use strict';var util=require(_0x43c3('0x0'));var _=require(_0x43c3('0x1'));var moment=require(_0x43c3('0x2'));function checkNameSurname(_0x96d3f9,_0x432b95,_0x29434f){var _0x543105='';if(!_['isNil'](_0x432b95)&&_0x43c3('0x3')===typeof _0x432b95){_0x543105+=_0x432b95;}if(!_[_0x43c3('0x4')](_0x29434f)&&_0x43c3('0x3')===typeof _0x29434f){_0x543105+='\x20'+_0x29434f;}if(_0x543105!==''){return _0x543105;}return _0x96d3f9;}function Action(_0x301446,_0x3b7cdd,_0x49135e){this['voiceQueue']=_0x301446;this[_0x43c3('0x5')]=_0x49135e||undefined;this[_0x43c3('0x6')]=checkNameSurname(_0x3b7cdd[_0x43c3('0x7')][_0x43c3('0x8')],_0x3b7cdd[_0x43c3('0x7')][_0x43c3('0x9')],_0x3b7cdd['Contact'][_0x43c3('0xa')]);this[_0x43c3('0xb')]=_0x3b7cdd[_0x43c3('0x7')]['phone'];this[_0x43c3('0xc')]=_0x301446[_0x43c3('0x6')];this[_0x43c3('0xd')]=_0x3b7cdd[_0x43c3('0xd')]||![];this[_0x43c3('0xe')]=_0x301446['type'];this[_0x43c3('0xf')]=_0x301446['dialQueueTimeout']||0x3;this[_0x43c3('0x10')]=_0x3b7cdd[_0x43c3('0x10')];this[_0x43c3('0x11')]=_0x3b7cdd[_0x43c3('0x11')];this[_0x43c3('0x12')]=_0x3b7cdd['countcongestionretry'];this[_0x43c3('0x13')]=_0x3b7cdd['countnoanswerretry'];this[_0x43c3('0x14')]=_0x3b7cdd[_0x43c3('0x14')];this[_0x43c3('0x15')]=_0x3b7cdd[_0x43c3('0x15')];this[_0x43c3('0x16')]=_0x3b7cdd[_0x43c3('0x16')];this[_0x43c3('0x17')]=_0x3b7cdd[_0x43c3('0x17')];this[_0x43c3('0x18')]=_0x3b7cdd[_0x43c3('0x18')];this['idHopper']=_0x3b7cdd['id'];this[_0x43c3('0x19')]=_0x3b7cdd[_0x43c3('0x7')][_0x43c3('0x9')]||'';this['starttime']=moment()[_0x43c3('0x1a')](_0x43c3('0x1b'));this[_0x43c3('0x1c')]=_0x3b7cdd[_0x43c3('0x1c')];this[_0x43c3('0x1d')]=_0x3b7cdd[_0x43c3('0x1d')];this[_0x43c3('0x1e')]=_0x3b7cdd[_0x43c3('0x1e')];this[_0x43c3('0x1f')]=_0x3b7cdd['recallme'];this[_0x43c3('0x20')]='';this[_0x43c3('0x21')]='';}Action[_0x43c3('0x22')][_0x43c3('0x23')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x43c3('0x6')],this[_0x43c3('0x24')][_0x43c3('0x25')]>0x0?this[_0x43c3('0xb')][_0x43c3('0x26')](this[_0x43c3('0x24')][_0x43c3('0x25')]):this[_0x43c3('0xb')]);};Action[_0x43c3('0x22')]['getQueue']=function(){return this['queue'];};module[_0x43c3('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 9d1d6f6..9e9a293 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb687=['originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x252abf,_0x2d2479){var _0x59095e=function(_0x1f9464){while(--_0x1f9464){_0x252abf['push'](_0x252abf['shift']());}};_0x59095e(++_0x2d2479);}(_0xb687,0x1b0));var _0x7b68=function(_0x1e2fe5,_0x3c8ff7){_0x1e2fe5=_0x1e2fe5-0x0;var _0x32fdb3=_0xb687[_0x1e2fe5];return _0x32fdb3;};'use strict';var util=require(_0x7b68('0x0'));var _=require(_0x7b68('0x1'));var moment=require('moment');function getSeconds(_0x7ee7bf,_0x275c1c){var _0x20506c=moment(_0x7ee7bf)['milliseconds'](0x0);var _0x26b986=moment(_0x275c1c)[_0x7b68('0x2')](0x0);return _0x20506c['diff'](_0x26b986,'seconds');}function AgentComplete(_0x47c282,_0xe4ac08){this[_0x7b68('0x3')]=0x4;this[_0x7b68('0x4')]=_0x7b68('0x5');this[_0x7b68('0x6')]=_0x47c282[_0x7b68('0x6')];this[_0x7b68('0x7')]=_0x47c282['type'];this[_0x7b68('0x8')]=_0x47c282['type']===_0x7b68('0x9')?'queue':_0x47c282['type'];this[_0x7b68('0xa')]=_0x47c282['countbusyretry'];this[_0x7b68('0xb')]=_0x47c282[_0x7b68('0xb')];this[_0x7b68('0xc')]=_0x47c282[_0x7b68('0xc')];this['countglobal']=_0x47c282[_0x7b68('0xa')]+_0x47c282[_0x7b68('0xb')]+_0x47c282[_0x7b68('0xc')];this[_0x7b68('0xd')]=_0xe4ac08[_0x7b68('0xd')];this['calleridname']=_0x47c282[_0x7b68('0xe')];this[_0x7b68('0xf')]=_0x47c282[_0x7b68('0x10')];this[_0x7b68('0x11')]=_0x47c282[_0x7b68('0x11')];this[_0x7b68('0x12')]=_0x47c282[_0x7b68('0x12')];this['answertime']=_0x47c282[_0x7b68('0x13')];this[_0x7b68('0x14')]=moment()[_0x7b68('0x15')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7b68('0x16')]=getSeconds(_0x47c282[_0x7b68('0x12')],_0x47c282['starttime']);this['holdtime']=getSeconds(_0x47c282['answertime'],_0x47c282[_0x7b68('0x12')]);this[_0x7b68('0x17')]=getSeconds(this[_0x7b68('0x14')],_0x47c282['answertime']);this[_0x7b68('0x18')]=_0xe4ac08[_0x7b68('0x18')];this['membername']=_0xe4ac08[_0x7b68('0x19')];this[_0x7b68('0x1a')]=_0xe4ac08[_0x7b68('0x1a')];this[_0x7b68('0x1b')]=_0x47c282[_0x7b68('0x1b')];this[_0x7b68('0x1c')]=_0x47c282['callbackuniqueid'];this[_0x7b68('0x1d')]=_0x47c282[_0x7b68('0x1d')];this[_0x7b68('0x1e')]=_0x47c282[_0x7b68('0x1e')];this['ContactId']=_0x47c282[_0x7b68('0x1f')];this[_0x7b68('0x20')]=_0x47c282[_0x7b68('0x20')];this[_0x7b68('0x21')]=_0x47c282[_0x7b68('0x21')];this['VoiceQueueId']=_0x47c282[_0x7b68('0x22')];this[_0x7b68('0x23')]=_0x47c282[_0x7b68('0x23')];this[_0x7b68('0x24')]=_0x47c282[_0x7b68('0x24')]||'';this[_0x7b68('0x25')]=_0x47c282[_0x7b68('0x25')]||'';}module[_0x7b68('0x26')]=AgentComplete; \ No newline at end of file +var _0xa2f3=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x21e95c,_0x3485b5){var _0x1bde5b=function(_0xd71c9a){while(--_0xd71c9a){_0x21e95c['push'](_0x21e95c['shift']());}};_0x1bde5b(++_0x3485b5);}(_0xa2f3,0x144));var _0x3a2f=function(_0x47e521,_0x1ea7b0){_0x47e521=_0x47e521-0x0;var _0x36ac16=_0xa2f3[_0x47e521];return _0x36ac16;};'use strict';var util=require(_0x3a2f('0x0'));var _=require(_0x3a2f('0x1'));var moment=require(_0x3a2f('0x2'));function getSeconds(_0x218859,_0xb1c388){var _0x4cea36=moment(_0x218859)[_0x3a2f('0x3')](0x0);var _0x255c43=moment(_0xb1c388)[_0x3a2f('0x3')](0x0);return _0x4cea36['diff'](_0x255c43,'seconds');}function AgentComplete(_0x1796e1,_0x525465){this[_0x3a2f('0x4')]=0x4;this['statedesc']=_0x3a2f('0x5');this['scheduledat']=_0x1796e1[_0x3a2f('0x6')];this['type']=_0x1796e1[_0x3a2f('0x7')];this[_0x3a2f('0x8')]=_0x1796e1[_0x3a2f('0x7')]==='outbound'?_0x3a2f('0x9'):_0x1796e1[_0x3a2f('0x7')];this[_0x3a2f('0xa')]=_0x1796e1[_0x3a2f('0xa')];this['countcongestionretry']=_0x1796e1[_0x3a2f('0xb')];this[_0x3a2f('0xc')]=_0x1796e1[_0x3a2f('0xc')];this['countglobal']=_0x1796e1[_0x3a2f('0xa')]+_0x1796e1[_0x3a2f('0xb')]+_0x1796e1[_0x3a2f('0xc')];this[_0x3a2f('0xd')]=_0x525465[_0x3a2f('0xd')];this[_0x3a2f('0xe')]=_0x1796e1[_0x3a2f('0xf')];this[_0x3a2f('0x10')]=_0x1796e1[_0x3a2f('0x11')];this[_0x3a2f('0x12')]=_0x1796e1[_0x3a2f('0x12')];this[_0x3a2f('0x13')]=_0x1796e1[_0x3a2f('0x13')];this[_0x3a2f('0x14')]=_0x1796e1[_0x3a2f('0x14')];this[_0x3a2f('0x15')]=moment()[_0x3a2f('0x16')](_0x3a2f('0x17'));this[_0x3a2f('0x18')]=getSeconds(_0x1796e1[_0x3a2f('0x13')],_0x1796e1[_0x3a2f('0x12')]);this[_0x3a2f('0x19')]=getSeconds(_0x1796e1[_0x3a2f('0x14')],_0x1796e1[_0x3a2f('0x13')]);this[_0x3a2f('0x1a')]=getSeconds(this['endtime'],_0x1796e1[_0x3a2f('0x14')]);this[_0x3a2f('0x9')]=_0x525465[_0x3a2f('0x9')];this[_0x3a2f('0x1b')]=_0x525465[_0x3a2f('0x1b')];this['reason']=_0x525465['reason'];this[_0x3a2f('0x1c')]=_0x1796e1[_0x3a2f('0x1c')];this[_0x3a2f('0x1d')]=_0x1796e1[_0x3a2f('0x1d')];this[_0x3a2f('0x1e')]=_0x1796e1[_0x3a2f('0x1e')];this['recallme']=_0x1796e1[_0x3a2f('0x1f')];this[_0x3a2f('0x20')]=_0x1796e1[_0x3a2f('0x20')];this[_0x3a2f('0x21')]=_0x1796e1[_0x3a2f('0x21')];this[_0x3a2f('0x22')]=_0x1796e1['UserId'];this[_0x3a2f('0x23')]=_0x1796e1[_0x3a2f('0x23')];this[_0x3a2f('0x24')]=_0x1796e1[_0x3a2f('0x24')];this['originatecalleridnum']=_0x1796e1['originatecalleridnum']||'';this['originatecalleridname']=_0x1796e1['originatecalleridname']||'';}module[_0x3a2f('0x25')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e7beff4..1c77f48 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9ef=['originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','queue','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x484d32,_0x15d68d){var _0x33d58d=function(_0xfe6eae){while(--_0xfe6eae){_0x484d32['push'](_0x484d32['shift']());}};_0x33d58d(++_0x15d68d);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xe9ef[_0x3070dc];return _0x431489;};'use strict';var util=require(_0xfe9e('0x0'));var _=require('lodash');var moment=require(_0xfe9e('0x1'));function getSeconds(_0x15d1f4,_0x5b45a9){var _0x88cbfa=moment(_0x15d1f4)['milliseconds'](0x0);var _0x23904d=moment(_0x5b45a9)[_0xfe9e('0x2')](0x0);return _0x88cbfa[_0xfe9e('0x3')](_0x23904d,_0xfe9e('0x4'));}function Final(_0x5e8f7e){this[_0xfe9e('0x5')]=_0x5e8f7e[_0xfe9e('0x5')];this['scheduledat']=_0x5e8f7e['scheduledat'];this[_0xfe9e('0x6')]=_0x5e8f7e['type'];this[_0xfe9e('0x7')]=_0x5e8f7e[_0xfe9e('0x6')]===_0xfe9e('0x8')?'queue':_0x5e8f7e[_0xfe9e('0x6')];this[_0xfe9e('0x9')]=_0x5e8f7e[_0xfe9e('0x9')];this['countcongestionretry']=_0x5e8f7e[_0xfe9e('0xa')];this['countnoanswerretry']=_0x5e8f7e[_0xfe9e('0xb')];this[_0xfe9e('0xc')]=_0x5e8f7e[_0xfe9e('0x9')]+_0x5e8f7e[_0xfe9e('0xa')]+_0x5e8f7e[_0xfe9e('0xb')];this[_0xfe9e('0xd')]=_0x5e8f7e[_0xfe9e('0xd')];this[_0xfe9e('0xe')]=_0x5e8f7e[_0xfe9e('0xe')];this['calleridnum']=_0x5e8f7e[_0xfe9e('0xf')];this[_0xfe9e('0x10')]=_0x5e8f7e['starttime'];this[_0xfe9e('0x11')]=_0x5e8f7e[_0xfe9e('0x11')];this[_0xfe9e('0x12')]=_0x5e8f7e[_0xfe9e('0x11')];this['ringtime']=_0x5e8f7e['ringtime']||0x0;this[_0xfe9e('0x13')]=_0x5e8f7e[_0xfe9e('0x13')]||0x0;this[_0xfe9e('0x14')]=_0x5e8f7e[_0xfe9e('0x14')]||0x0;this['callback']=_0x5e8f7e[_0xfe9e('0x15')];this[_0xfe9e('0x16')]=_0x5e8f7e[_0xfe9e('0x16')];this[_0xfe9e('0x17')]=_0x5e8f7e['callbackat'];this[_0xfe9e('0x18')]=_0x5e8f7e[_0xfe9e('0x18')];this[_0xfe9e('0x19')]=_0x5e8f7e[_0xfe9e('0x19')];this[_0xfe9e('0x1a')]=_0x5e8f7e['ListId'];this['UserId']=_0x5e8f7e[_0xfe9e('0x1b')];this[_0xfe9e('0x1c')]=_0x5e8f7e[_0xfe9e('0x1c')];this[_0xfe9e('0x1d')]=_0x5e8f7e[_0xfe9e('0x1d')];this[_0xfe9e('0x1e')]=_0x5e8f7e[_0xfe9e('0x1e')]||'';this[_0xfe9e('0x1f')]=_0x5e8f7e[_0xfe9e('0x1f')]||'';}module[_0xfe9e('0x20')]=Final; \ No newline at end of file +var _0x6ca3=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId'];(function(_0x271843,_0x4e2714){var _0x364e92=function(_0x4046de){while(--_0x4046de){_0x271843['push'](_0x271843['shift']());}};_0x364e92(++_0x4e2714);}(_0x6ca3,0xba));var _0x36ca=function(_0x558e1e,_0x3fd803){_0x558e1e=_0x558e1e-0x0;var _0x5ba193=_0x6ca3[_0x558e1e];return _0x5ba193;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x36ca('0x0'));function getSeconds(_0x2fbbe7,_0x5ab77e){var _0xe63327=moment(_0x2fbbe7)[_0x36ca('0x1')](0x0);var _0x5b7c21=moment(_0x5ab77e)[_0x36ca('0x1')](0x0);return _0xe63327['diff'](_0x5b7c21,'seconds');}function Final(_0x350965){this[_0x36ca('0x2')]=_0x350965[_0x36ca('0x2')];this[_0x36ca('0x3')]=_0x350965['scheduledat'];this['type']=_0x350965[_0x36ca('0x4')];this[_0x36ca('0x5')]=_0x350965['type']==='outbound'?_0x36ca('0x6'):_0x350965[_0x36ca('0x4')];this[_0x36ca('0x7')]=_0x350965[_0x36ca('0x7')];this['countcongestionretry']=_0x350965[_0x36ca('0x8')];this['countnoanswerretry']=_0x350965[_0x36ca('0x9')];this[_0x36ca('0xa')]=_0x350965[_0x36ca('0x7')]+_0x350965[_0x36ca('0x8')]+_0x350965[_0x36ca('0x9')];this['queue']=_0x350965[_0x36ca('0x6')];this[_0x36ca('0xb')]=_0x350965[_0x36ca('0xb')];this['calleridnum']=_0x350965[_0x36ca('0xc')];this[_0x36ca('0xd')]=_0x350965[_0x36ca('0xd')];this[_0x36ca('0xe')]=_0x350965[_0x36ca('0xe')];this[_0x36ca('0xf')]=_0x350965[_0x36ca('0xe')];this[_0x36ca('0x10')]=_0x350965[_0x36ca('0x10')]||0x0;this['holdtime']=_0x350965[_0x36ca('0x11')]||0x0;this[_0x36ca('0x12')]=_0x350965[_0x36ca('0x12')]||0x0;this[_0x36ca('0x13')]=_0x350965[_0x36ca('0x13')];this['callbackuniqueid']=_0x350965['callbackuniqueid'];this[_0x36ca('0x14')]=_0x350965[_0x36ca('0x14')];this[_0x36ca('0x15')]=_0x350965[_0x36ca('0x15')];this[_0x36ca('0x16')]=_0x350965['ContactId'];this[_0x36ca('0x17')]=_0x350965[_0x36ca('0x17')];this[_0x36ca('0x18')]=_0x350965[_0x36ca('0x18')];this[_0x36ca('0x19')]=_0x350965[_0x36ca('0x19')];this[_0x36ca('0x1a')]=_0x350965[_0x36ca('0x1a')];this['originatecalleridnum']=_0x350965[_0x36ca('0x1b')]||'';this['originatecalleridname']=_0x350965[_0x36ca('0x1c')]||'';}module[_0x36ca('0x1d')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index d8a2293..8fa6ba4 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x3055ab,_0x4d1f74){var _0x31d336=function(_0x207a6a){while(--_0x207a6a){_0x3055ab['push'](_0x3055ab['shift']());}};_0x31d336(++_0x4d1f74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file +var _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x1a48a0,_0x3c95f5){var _0x269714=function(_0x33d9e3){while(--_0x33d9e3){_0x1a48a0['push'](_0x1a48a0['shift']());}};_0x269714(++_0x3c95f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 48fc275..58c19ab 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1f7=['responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','queue','calleridname','name','calleridnum','number','starttime','endtime'];(function(_0x5e051c,_0x2e5812){var _0x5bd579=function(_0x11d70e){while(--_0x11d70e){_0x5e051c['push'](_0x5e051c['shift']());}};_0x5bd579(++_0x2e5812);}(_0xb1f7,0x1bf));var _0x7b1f=function(_0x2a2259,_0x5243ac){_0x2a2259=_0x2a2259-0x0;var _0x1fd3a5=_0xb1f7[_0x2a2259];return _0x1fd3a5;};'use strict';var util=require(_0x7b1f('0x0'));var _=require('lodash');var moment=require(_0x7b1f('0x1'));function getSeconds(_0x445517,_0x11bee5){var _0x1fc379=moment(_0x445517)[_0x7b1f('0x2')](0x0);var _0x3dbda9=moment(_0x11bee5)[_0x7b1f('0x2')](0x0);return _0x1fc379[_0x7b1f('0x3')](_0x3dbda9,_0x7b1f('0x4'));}function History(_0x215672){this[_0x7b1f('0x5')]=_0x215672['uniqueid'];this[_0x7b1f('0x6')]=_0x215672[_0x7b1f('0x6')]||undefined;this[_0x7b1f('0x7')]=_0x215672[_0x7b1f('0x7')];this[_0x7b1f('0x8')]=_0x215672[_0x7b1f('0x7')]===_0x7b1f('0x9')?'queue':_0x215672[_0x7b1f('0x7')];this[_0x7b1f('0xa')]=_0x215672[_0x7b1f('0xa')];this['countcongestionretry']=_0x215672[_0x7b1f('0xb')];this[_0x7b1f('0xc')]=_0x215672[_0x7b1f('0xc')];this[_0x7b1f('0xd')]=_0x215672[_0x7b1f('0xa')]+_0x215672[_0x7b1f('0xb')]+_0x215672['countnoanswerretry'];this[_0x7b1f('0xe')]=_0x215672['queue'];this[_0x7b1f('0xf')]=_0x215672[_0x7b1f('0x10')];this[_0x7b1f('0x11')]=_0x215672[_0x7b1f('0x12')];this[_0x7b1f('0x13')]=_0x215672['starttime'];this['responsetime']=_0x215672['responsetime'];this[_0x7b1f('0x14')]=_0x215672[_0x7b1f('0x15')];this[_0x7b1f('0x16')]=getSeconds(_0x215672['responsetime'],_0x215672[_0x7b1f('0x13')]);this[_0x7b1f('0x17')]=0x0;this['talktime']=0x0;this[_0x7b1f('0x18')]=_0x215672[_0x7b1f('0x18')];this[_0x7b1f('0x19')]=_0x215672[_0x7b1f('0x19')];this['callbackat']=_0x215672[_0x7b1f('0x1a')];this[_0x7b1f('0x1b')]=_0x215672[_0x7b1f('0x1b')];this[_0x7b1f('0x1c')]=_0x215672['ContactId'];this[_0x7b1f('0x1d')]=_0x215672[_0x7b1f('0x1d')];this['UserId']=_0x215672[_0x7b1f('0x1e')];this[_0x7b1f('0x1f')]=_0x215672[_0x7b1f('0x1f')];this[_0x7b1f('0x20')]=_0x215672['CampaignId'];this[_0x7b1f('0x21')]=_0x215672['originatecalleridnum']||'';this['originatecalleridname']=_0x215672[_0x7b1f('0x22')]||'';}module[_0x7b1f('0x23')]=History; \ No newline at end of file +var _0xce94=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','calleridnum','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x5dc7b7,_0x40eb4a){var _0x118b7c=function(_0x1f0fca){while(--_0x1f0fca){_0x5dc7b7['push'](_0x5dc7b7['shift']());}};_0x118b7c(++_0x40eb4a);}(_0xce94,0xd1));var _0x4ce9=function(_0x15d8a8,_0x40e5d0){_0x15d8a8=_0x15d8a8-0x0;var _0x4c602b=_0xce94[_0x15d8a8];return _0x4c602b;};'use strict';var util=require(_0x4ce9('0x0'));var _=require(_0x4ce9('0x1'));var moment=require(_0x4ce9('0x2'));function getSeconds(_0x19bac5,_0x51d6a8){var _0x28dc2f=moment(_0x19bac5)['milliseconds'](0x0);var _0x38ea41=moment(_0x51d6a8)[_0x4ce9('0x3')](0x0);return _0x28dc2f['diff'](_0x38ea41,_0x4ce9('0x4'));}function History(_0x19db7b){this['uniqueid']=_0x19db7b[_0x4ce9('0x5')];this['scheduledat']=_0x19db7b[_0x4ce9('0x6')]||undefined;this[_0x4ce9('0x7')]=_0x19db7b[_0x4ce9('0x7')];this[_0x4ce9('0x8')]=_0x19db7b[_0x4ce9('0x7')]===_0x4ce9('0x9')?_0x4ce9('0xa'):_0x19db7b[_0x4ce9('0x7')];this[_0x4ce9('0xb')]=_0x19db7b[_0x4ce9('0xb')];this[_0x4ce9('0xc')]=_0x19db7b['countcongestionretry'];this['countnoanswerretry']=_0x19db7b[_0x4ce9('0xd')];this[_0x4ce9('0xe')]=_0x19db7b[_0x4ce9('0xb')]+_0x19db7b['countcongestionretry']+_0x19db7b['countnoanswerretry'];this[_0x4ce9('0xa')]=_0x19db7b['queue'];this[_0x4ce9('0xf')]=_0x19db7b[_0x4ce9('0x10')];this[_0x4ce9('0x11')]=_0x19db7b['number'];this[_0x4ce9('0x12')]=_0x19db7b[_0x4ce9('0x12')];this[_0x4ce9('0x13')]=_0x19db7b[_0x4ce9('0x13')];this[_0x4ce9('0x14')]=_0x19db7b[_0x4ce9('0x13')];this['ringtime']=getSeconds(_0x19db7b[_0x4ce9('0x13')],_0x19db7b[_0x4ce9('0x12')]);this['holdtime']=0x0;this[_0x4ce9('0x15')]=0x0;this[_0x4ce9('0x16')]=_0x19db7b[_0x4ce9('0x16')];this['callbackuniqueid']=_0x19db7b[_0x4ce9('0x17')];this[_0x4ce9('0x18')]=_0x19db7b[_0x4ce9('0x18')];this[_0x4ce9('0x19')]=_0x19db7b[_0x4ce9('0x19')];this[_0x4ce9('0x1a')]=_0x19db7b[_0x4ce9('0x1a')];this[_0x4ce9('0x1b')]=_0x19db7b[_0x4ce9('0x1b')];this[_0x4ce9('0x1c')]=_0x19db7b[_0x4ce9('0x1c')];this[_0x4ce9('0x1d')]=_0x19db7b[_0x4ce9('0x1d')];this[_0x4ce9('0x1e')]=_0x19db7b[_0x4ce9('0x1e')];this[_0x4ce9('0x1f')]=_0x19db7b[_0x4ce9('0x1f')]||'';this['originatecalleridname']=_0x19db7b[_0x4ce9('0x20')]||'';}module[_0x4ce9('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index dce3ca6..15f40b0 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 _0xceea=['rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','bind','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','Intervals','\x20INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','type','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','callerid','voice_queue:save','ivr','format','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[actions]','isNil','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','then','[countReScheduled]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','hasOwnProperty','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','status','uniqueid','variable','amdstatus','exten','dialAMDActive','value','statedesc','HangupInAMD','membername','AMD','saveInDb','[syncHangupInAMD]','MACHINE','Machine','amd','[syncMachine][createHistory]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','ivrAnswerCallsDay','[syncHangupIvr]','AGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','Abandoned','CALLEREXIT','syncQueueMember','actionid','locked','stateinterface','push','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','ContactId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','indexOf','content','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','checkIfTime','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','xcally-motion-dialer','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','countbusyretry','add','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','countglobal','[syncAgentComplete][createHistory][3]','createStateFinal','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','handlePredictive','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','busyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','check\x20failure','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','dialLimitQueue','not_inuse','ACTIVE','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xceea,0x1df));var _0xacee=function(_0x1149c6,_0x32d361){_0x1149c6=_0x1149c6-0x0;var _0x156401=_0xceea[_0x1149c6];return _0x156401;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xacee('0x0'));var uuid=require(_0xacee('0x1'));var moment=require(_0xacee('0x2'));var rr=require('rr');var md5=require(_0xacee('0x3'));var Redis=require(_0xacee('0x4'));var config=require(_0xacee('0x5'));var logger=require(_0xacee('0x6'))(_0xacee('0x7'));var loggerBooked=require(_0xacee('0x6'))(_0xacee('0x8'));var loggerPredictive=require(_0xacee('0x6'))(_0xacee('0x9'));var loggerPredictiveCalls=require(_0xacee('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xacee('0x6'))(_0xacee('0xa'));var ami=require(_0xacee('0xb'));config['redis']=_[_0xacee('0xc')](config[_0xacee('0xd')],{'host':_0xacee('0xe'),'port':0x18eb});var io=require(_0xacee('0xf'))(new Redis(config[_0xacee('0xd')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xacee('0x10'));var Action=require(_0xacee('0x11'));var History=require(_0xacee('0x12'));var Final=require('./final');var AgentComplete=require(_0xacee('0x13'));var QueueCallerAbandon=require(_0xacee('0x14'));var Hangup=require(_0xacee('0x15'));var ipAgi=process[_0xacee('0x16')][_0xacee('0x17')]||'127.0.0.1';var strategy={'rrmemory':_0xacee('0x18'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xacee('0x19')][_0xacee('0x1a')]=function(_0x552ea0){this['tail']=this[_0xacee('0x1b')]?this[_0xacee('0x1b')][_0xacee('0x1c')](_0x552ea0):_0x552ea0();};function Dialer(_0x1d6598,_0x114499){this[_0xacee('0x1d')]=new Sequence();this[_0xacee('0x1e')]=_0x114499;this[_0xacee('0x1f')]=_0x1d6598[_0xacee('0x1f')];this[_0xacee('0x20')]=_0x1d6598[_0xacee('0x20')];this[_0xacee('0x21')]=_0x1d6598[_0xacee('0x21')];this[_0xacee('0x22')]=_0x1d6598[_0xacee('0x22')];this[_0xacee('0x23')]=config[_0xacee('0x23')]||0x2;this[_0xacee('0x24')]={};this[_0xacee('0x25')]={};this[_0xacee('0x26')]={};this[_0xacee('0x27')]={};this[_0xacee('0x28')]={};this['startPredictive']={};this[_0xacee('0x29')]={};this[_0xacee('0x2a')]={};this[_0xacee('0x2b')]={};this['queueBookedRR']={};ami['on'](_0xacee('0x2c'),this['syncAgentConnect']['bind'](this));ami['on'](_0xacee('0x2d'),this[_0xacee('0x2e')]['bind'](this));ami['on'](_0xacee('0x2f'),this[_0xacee('0x30')]['bind'](this));ami['on'](_0xacee('0x31'),this[_0xacee('0x32')][_0xacee('0x33')](this));ami['on'](_0xacee('0x34'),this[_0xacee('0xa')][_0xacee('0x33')](this));ami['on'](_0xacee('0x35'),this[_0xacee('0x36')][_0xacee('0x33')](this));ami['on'](_0xacee('0x37'),this[_0xacee('0x38')]['bind'](this));ami['on'](_0xacee('0x39'),this[_0xacee('0x3a')][_0xacee('0x33')](this));ami['on'](_0xacee('0x3b'),this['syncQueueMember']['bind'](this));ami['on']('queuestatuscomplete',this[_0xacee('0x3c')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x4570fa){return _0x4570fa!==null&&!_[_0xacee('0x3d')](_0x4570fa);}function checkIsLoggedIn(_0x1cb49d,_0x5796ba){return function(){if(_0x5796ba<=0x0){_0x1cb49d[_0xacee('0x3e')]='AGENTS_NOT_LOGGED';throw _0x1cb49d[_0xacee('0x3f')]+_0xacee('0x40');}};}function isActive(_0x343a60){return _0x343a60;}function checkIsActive(_0x2b9369,_0x512f7d){return function(){if(!isActive(_0x512f7d)){_0x2b9369[_0xacee('0x3e')]=_0xacee('0x41');throw _0x2b9369[_0xacee('0x3f')]+_0xacee('0x42');}};}function checkInterval(_0x40867c){return function(){if(!isNotNull(_0x40867c['Interval'])){_0x40867c['message']=_0xacee('0x43');throw _0x40867c[_0xacee('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x40867c[_0xacee('0x44')][_0xacee('0x45')])){_0x40867c['message']=_0xacee('0x43');throw _0x40867c[_0xacee('0x3f')]+_0xacee('0x46');}if(!isNotNull(_['isEmpty'](_0x40867c[_0xacee('0x44')][_0xacee('0x45')]))){_0x40867c[_0xacee('0x3e')]=_0xacee('0x43');throw _0x40867c[_0xacee('0x3f')]+_0xacee('0x46');}};}function msgResponse(_0x43c232,_0xed5567,_0x258e50){return{'action':_0x43c232,'response':_0xed5567,'message':_0x258e50,'stack':_0x258e50};}function myreject(_0x134801){return function(_0x38e6b4){return _0x134801(msgResponse('[ifTime][Action]',_0xacee('0x47'),JSON[_0xacee('0x48')](_0x38e6b4)));};}function getSeconds(_0x4f7a29,_0x7ccd62){var _0x57fc4c=moment(_0x4f7a29)[_0xacee('0x49')](0x0);var _0x1ca0dc=moment(_0x7ccd62)[_0xacee('0x49')](0x0);return _0x57fc4c[_0xacee('0x4a')](_0x1ca0dc,_0xacee('0x4b'));}function emit(_0x32ddf0,_0x36ba57,_0x2f832b){io['to'](_0x32ddf0)[_0xacee('0x4c')](_0x36ba57,_0x2f832b);}function emitVoiceQueueSummary(_0x2aba00){if(_0x2aba00['type']===_0xacee('0x4d')){var _0x41c830={'id':_0x2aba00['id'],'name':_0x2aba00[_0xacee('0x3f')],'strategy':_0x2aba00[_0xacee('0x4e')],'answered':_0x2aba00[_0xacee('0x4f')],'available':_0x2aba00[_0xacee('0x50')],'loggedIn':_0x2aba00[_0xacee('0x51')],'pTalking':_0x2aba00[_0xacee('0x52')],'sumBillable':_0x2aba00[_0xacee('0x53')],'sumDuration':_0x2aba00[_0xacee('0x54')],'sumHoldTime':_0x2aba00['sumHoldTime']||0x0,'talking':_0x2aba00['talking'],'total':_0x2aba00['total'],'type':_0x2aba00[_0xacee('0x55')],'unmanaged':_0x2aba00[_0xacee('0x56')],'abandoned':_0x2aba00['abandoned'],'waiting':_0x2aba00[_0xacee('0x57')],'loggedInDb':_0x2aba00[_0xacee('0x58')],'dialActive':_0x2aba00[_0xacee('0x59')],'dialMethod':_0x2aba00['dialMethod'],'dialOriginateCallerIdName':_0x2aba00[_0xacee('0x5a')],'dialOriginateCallerIdNumber':_0x2aba00[_0xacee('0x5b')],'dialOriginateTimeout':_0x2aba00[_0xacee('0x5c')],'dialPrefix':_0x2aba00['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2aba00[_0xacee('0x5d')],'outboundAnswerCallsDay':_0x2aba00[_0xacee('0x5e')],'outboundBlacklistCallsDay':_0x2aba00[_0xacee('0x5f')],'outboundBusyCallsDay':_0x2aba00['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2aba00[_0xacee('0x60')],'outboundDropCallsDayACS':_0x2aba00[_0xacee('0x61')],'outboundDropCallsDayCallersExit':_0x2aba00[_0xacee('0x62')],'outboundDropCallsDayTimeout':_0x2aba00['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2aba00[_0xacee('0x63')],'outboundNoSuchCallsDay':_0x2aba00[_0xacee('0x64')],'outboundOriginateFailureCallsDay':_0x2aba00[_0xacee('0x65')],'outboundReCallsDay':_0x2aba00[_0xacee('0x66')],'outboundRejectCallsDay':_0x2aba00[_0xacee('0x67')],'outboundUnknownCallsDay':_0x2aba00[_0xacee('0x68')],'predictiveIntervalAnsweredCalls':_0x2aba00[_0xacee('0x69')],'predictiveIntervalAvgHoldtime':_0x2aba00[_0xacee('0x6a')],'predictiveIntervalAvgTalktime':_0x2aba00[_0xacee('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x2aba00[_0xacee('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x2aba00[_0xacee('0x6d')],'predictiveIntervalErlangCalls':_0x2aba00[_0xacee('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x2aba00['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2aba00[_0xacee('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x2aba00[_0xacee('0x70')],'predictiveIntervalPauses':_0x2aba00[_0xacee('0x71')],'predictiveIntervalAvailable':_0x2aba00[_0xacee('0x72')],'predictiveIntervalTotalCalls':_0x2aba00[_0xacee('0x73')],'message':_0x2aba00[_0xacee('0x3e')],'originated':_0x2aba00[_0xacee('0x74')],'erlangCalls':_0x2aba00[_0xacee('0x75')],'erlangCallToSecond':_0x2aba00[_0xacee('0x76')],'erlangAbandonmentRate':_0x2aba00['erlangAbandonmentRate'],'erlangBusyFactor':_0x2aba00[_0xacee('0x77')],'startPredictive':_0x2aba00[_0xacee('0x78')],'startProgressive':_0x2aba00[_0xacee('0x29')]};if(_0x2aba00[_0xacee('0x79')]){_0x41c830[_0xacee('0x79')]={'id':_0x2aba00[_0xacee('0x79')]['id'],'name':_0x2aba00[_0xacee('0x79')][_0xacee('0x3f')],'active':_0x2aba00[_0xacee('0x79')][_0xacee('0x7a')],'callerid':_0x2aba00[_0xacee('0x79')][_0xacee('0x7b')]};}if(_0x2aba00[_0xacee('0x44')]){_0x41c830[_0xacee('0x44')]={'id':_0x2aba00['Interval']['id'],'name':_0x2aba00[_0xacee('0x44')][_0xacee('0x3f')]};}var _0x3ed294=md5(JSON[_0xacee('0x48')](_0x41c830));if(_0x2aba00[_0xacee('0x3')]!==_0x3ed294){_0x2aba00['md5']=_0x3ed294;emit(util['format']('voice:queue:%s',_0x41c830[_0xacee('0x3f')]),_0xacee('0x7c'),_0x41c830);}}}function emitCampaignSummary(_0xc4152c){if(_0xc4152c[_0xacee('0x55')]===_0xacee('0x7d')){emit(util[_0xacee('0x7e')]('campaign:ivr:%s',_0xc4152c[_0xacee('0x3f')]),_0xacee('0x7f'),_0xc4152c);}}function checkGetDataPredictive(_0x42d28c){if(isNotNull(_0x42d28c)){if(!_[_0xacee('0x80')](_0x42d28c)){loggerPredictive[_0xacee('0x81')](_0xacee('0x82'));loggerPredictive[_0xacee('0x81')](_0xacee('0x83'),_0x42d28c[_0xacee('0x73')]);loggerPredictive[_0xacee('0x81')](_0xacee('0x84'),_0x42d28c[_0xacee('0x69')]);loggerPredictive['info'](_0xacee('0x85'),_0x42d28c[_0xacee('0x6d')]);loggerPredictive[_0xacee('0x81')](_0xacee('0x86'),_0x42d28c[_0xacee('0x6c')]);loggerPredictive['info'](_0xacee('0x87'),_0x42d28c['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xacee('0x81')](_0xacee('0x88'),_0x42d28c[_0xacee('0x6b')]);loggerPredictive[_0xacee('0x81')](_0xacee('0x89'));if(_0x42d28c[_0xacee('0x73')]>0x0){if(!_[_0xacee('0x3d')](_0x42d28c[_0xacee('0x6b')])&&_0x42d28c['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive['info'](_0xacee('0x8a'));}if(!_[_0xacee('0x3d')](_0x42d28c[_0xacee('0x6a')])&&_0x42d28c[_0xacee('0x6a')]>0x0){return!![];}else{loggerPredictive[_0xacee('0x81')](_0xacee('0x8b'));}}else{loggerPredictive[_0xacee('0x81')](_0xacee('0x8c'));}}else{loggerPredictive[_0xacee('0x81')](_0xacee('0x8d'));}}else{loggerPredictive[_0xacee('0x81')](_0xacee('0x8d'));}return![];}function mergeDataErlangB(_0x272692){return function(_0x44d2ea){loggerPredictive[_0xacee('0x81')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xacee('0x81')](_0xacee('0x8e'),_0x44d2ea[_0xacee('0x75')]);loggerPredictive[_0xacee('0x81')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44d2ea[_0xacee('0x76')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44d2ea['erlangAbandonmentRate']);loggerPredictive[_0xacee('0x81')](_0xacee('0x8f'),_0x44d2ea[_0xacee('0x77')]);loggerPredictive[_0xacee('0x81')](_0xacee('0x90'),_0x44d2ea[_0xacee('0x91')]);loggerPredictive['info'](_0xacee('0x89'));_[_0xacee('0x92')](_0x272692,_0x44d2ea);};}function getDiff(_0x1fd737){var _0x28fb30=moment()[_0xacee('0x49')](0x0);var _0x248bc9=moment(_0x1fd737)['milliseconds'](0x0);return _0x28fb30['diff'](_0x248bc9,_0xacee('0x4b'));}function ifInterval(_0x275610,_0x1597fd){if(_[_0xacee('0x3d')](_0x1597fd)){return![];}if(getDiff(_0x1597fd)<_0x275610*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x30968b){if(isNotNull(_0x30968b)){if(!_[_0xacee('0x3d')](_0x30968b[_0xacee('0x29')])){_0x30968b[_0xacee('0x29')]=undefined;loggerPredictive[_0xacee('0x81')](_0x30968b['name'],_0xacee('0x93'));}if(!_[_0xacee('0x3d')](_0x30968b[_0xacee('0x78')])){_0x30968b['startPredictive']=undefined;loggerPredictive[_0xacee('0x81')](_0x30968b[_0xacee('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xacee('0x3d')](_0x30968b['handlePredictive'])){clearInterval(_0x30968b['handlePredictive']);_0x30968b['handlePredictive']=undefined;loggerPredictive[_0xacee('0x81')](_0x30968b[_0xacee('0x3f')],_0xacee('0x94'));}}}function erlangb(_0x51ac8d,_0xdbcc6c){if(_0xdbcc6c===0x0){return 0x0;}var _0x31951c=0x1;for(var _0x212ff1=0x1;_0x212ff1<=_0xdbcc6c;_0x212ff1+=0x1){_0x31951c=0x1+_0x31951c*_0x212ff1/_0x51ac8d;}return 0x1/_0x31951c;}function isVoiceQueueOutbound(_0x23270a){return _0x23270a===_0xacee('0x4d');}function isNotPreview(_0x557b84){return _0x557b84!==_0xacee('0x1e');}function isCampaignIvr(_0x59cdcd){return _0x59cdcd===_0xacee('0x7d');}function getCallerId(_0x59939,_0x2025cf,_0x383f99){if(!_['isUndefined'](_0x383f99)&&_0xacee('0x95')===typeof _0x383f99&&!_[_0xacee('0x80')](_0x383f99)){if(!_[_0xacee('0x3d')](_0x2025cf)&&_0xacee('0x95')===typeof _0x2025cf&&!_[_0xacee('0x80')](_0x2025cf)){return util[_0xacee('0x7e')](_0xacee('0x96'),_0x2025cf,_0x383f99);}return util[_0xacee('0x7e')](_0xacee('0x96'),_0x383f99,_0x383f99);}if(!_['isUndefined'](_0x59939)&&_0xacee('0x95')===typeof _0x59939&&!_['isEmpty'](_0x59939)){return _0x59939;}return _0xacee('0x97');}function loggerCatchQueueSummary(_0xf67ec8,_0x5acf1a){return function(_0x350b61){freeVariablesPredictive(_0x5acf1a);emitVoiceQueueSummary(_0x5acf1a);emitCampaignSummary(_0x5acf1a);loggerSyncQueueSummary[_0xacee('0x98')](_0xf67ec8,util[_0xacee('0x99')](_0x350b61,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x435252,_0x359fa7){return function(_0x4a5705){loggerPredictive[_0xacee('0x98')](_0x359fa7[_0xacee('0x3f')],_0x435252);loggerPredictive[_0xacee('0x98')](_0x4a5705[_0xacee('0x9a')]);freeVariablesPredictive(_0x359fa7);};}function loggerCatch(_0x4d355e){return function(_0x6168da){logger[_0xacee('0x98')](_0x4d355e,util['inspect'](_0x6168da,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x27d2d4){return _0x27d2d4&&!_[_0xacee('0x3d')](_0x27d2d4)&&_0x27d2d4[_0xacee('0x9b')]>0x0;}function decremetOriginate(_0xd6e37b){if(!_[_0xacee('0x3d')](_0xd6e37b)&&_0xd6e37b!==null){if(_0xd6e37b['hasOwnProperty'](_0xacee('0x74'))){if(_0xd6e37b[_0xacee('0x74')]>0x0){_0xd6e37b['originated']-=0x1;}else{logger[_0xacee('0x98')](_0xacee('0x9c'));}}}else{logger[_0xacee('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3c5155,_0x12eb62,_0xebaa7d){if(_0x12eb62>_0xebaa7d){for(var _0x200ce9=0x0;_0x200ce9<_0x12eb62-_0xebaa7d;_0x200ce9+=0x1){decremetOriginate(_0x3c5155);}}}function loggerGetContactDialer(_0x5abab4,_0x2710fe,_0x7b112a){return function(_0x7f0bad){checkContactLowerLimitOriginate(_0x2710fe,_0x7b112a,0x0);logger[_0xacee('0x98')](_0x5abab4,util[_0xacee('0x99')](_0x7f0bad,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4e009e){return function(_0x21a6bc){if(isNotNull(_0x21a6bc)&&isNotNull(_0x21a6bc[0x0])){if(_0x21a6bc[0x0]['contactsRescheduled']>0x0){_0x4e009e[_0xacee('0x3e')]=_0xacee('0x9d');logger[_0xacee('0x81')](_0xacee('0x9e')+_0x4e009e[_0xacee('0x3f')],_0x21a6bc[0x0]['contactsRescheduled'],_0xacee('0x9f'));}else{_0x4e009e[_0xacee('0x3e')]=_0xacee('0xa0');logger[_0xacee('0x81')](_0xacee('0xa1')+_0x4e009e[_0xacee('0x3f')]);}}};}function notSendMessagesQueue(_0xcc7279){if(_0xcc7279[_0xacee('0xa2')]){freeVariablesPredictive(_0xcc7279);if(_0xcc7279[_0xacee('0x74')]===0x0&&_0xcc7279[_0xacee('0xa3')]===0x0&&_0xcc7279[_0xacee('0x57')]===0x0&&(_0xcc7279[_0xacee('0x52')]||0x0)===0x0){_0xcc7279[_0xacee('0xa2')]=![];_0xcc7279[_0xacee('0x50')]=0x0;_0xcc7279['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xacee('0x98')](_0xacee('0xa4'),_0xcc7279[_0xacee('0x3f')],_0xacee('0xa5'));}else{_0xcc7279['message']=_0xacee('0xa6');loggerSyncQueueSummary['error'](_0xacee('0xa4'),_0xcc7279[_0xacee('0x3f')],_0xacee('0xa7'));}emitVoiceQueueSummary(_0xcc7279);}}function notSendMessagesCampaign(_0x5cafba){if(_0x5cafba[_0xacee('0xa2')]){if(_0x5cafba['originated']===0x0){_0x5cafba['sendMessageOneNotActive']=![];_0x5cafba[_0xacee('0x3e')]=_0xacee('0x41');loggerSyncQueueSummary[_0xacee('0x98')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5cafba[_0xacee('0x3f')],'is\x20not\x20active');}else{_0x5cafba[_0xacee('0x3e')]=_0xacee('0xa6');loggerSyncQueueSummary[_0xacee('0x98')](_0xacee('0xa8'),_0x5cafba[_0xacee('0x3f')],_0xacee('0xa7'));}emitCampaignSummary(_0x5cafba);}}function createObjHistory(_0x3988a7,_0x5d6237,_0x92f3cb,_0x341b03,_0x39e081){_0x3988a7[_0xacee('0x3e')]=_0x92f3cb;var _0x1f1c6b=new Action(_0x3988a7,_0x5d6237);var _0x52ef06=new History(_0x1f1c6b);_0x52ef06[_0xacee('0xa9')]=_0x341b03;_0x52ef06['statedesc']=_0x39e081;_0x52ef06[_0xacee('0xaa')]=_0x1f1c6b[_0xacee('0xab')];return _0x52ef06;}Dialer['prototype'][_0xacee('0xac')]=function(){var _0x58b70e=this;setInterval(function(){_0x58b70e[_0xacee('0xad')](_0x58b70e[_0xacee('0x27')],'[uniqueid]');_0x58b70e[_0xacee('0xad')](_0x58b70e['actions'],_0xacee('0xae'));},0x32c8);};Dialer[_0xacee('0x19')][_0xacee('0xad')]=function(_0x1485e3,_0x2174f5){var _0x55fc38=this;for(var _0x3fe2b1 in _0x1485e3){if(_0x1485e3['hasOwnProperty'](_0x3fe2b1)){this['sequence']['enqueue'](function(){if(!_[_0xacee('0xaf')](_0x1485e3[_0x3fe2b1])){return ami['Action']({'action':'status','channel':_0x1485e3[_0x3fe2b1][_0xacee('0xb0')]})[_0xacee('0xb1')](function(_0x54d24c){if(_0x54d24c['message']===_0xacee('0xb2')){setTimeout(function(){if(_0x1485e3[_0x3fe2b1]&&_0x1485e3[_0x3fe2b1][_0xacee('0x55')]!==_0xacee('0x7d')){_0x55fc38[_0xacee('0xb3')](_0x55fc38[_0xacee('0x1f')][_0x1485e3[_0x3fe2b1]['queue']]);logger[_0xacee('0x98')](_0xacee('0xb4'),_0x2174f5,_0x3fe2b1,_0x1485e3[_0x3fe2b1][_0xacee('0xb5')]);delete _0x1485e3[_0x3fe2b1];}if(_0x1485e3[_0x3fe2b1]&&_0x1485e3[_0x3fe2b1][_0xacee('0x55')]===_0xacee('0x7d')){_0x55fc38[_0xacee('0xb3')](_0x55fc38[_0xacee('0x20')][_0x1485e3[_0x3fe2b1][_0xacee('0xb5')]]);logger[_0xacee('0x98')]('[Dialer][checkChannel][ivr]',_0x2174f5,_0x3fe2b1,_0x1485e3[_0x3fe2b1][_0xacee('0xb5')]);delete _0x1485e3[_0x3fe2b1];}},0x2328);}});}});}}};Dialer[_0xacee('0x19')][_0xacee('0xb6')]=function(_0x212235){return BPromise['resolve']()[_0xacee('0xb7')](cmHopper['countReScheduled'](_0x212235))['catch'](loggerCatch(_0xacee('0xb8')));};Dialer[_0xacee('0x19')]['checkIsBlackList']=function(_0x57b3ce){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](cmHopperBlack[_0xacee('0xba')](_0x57b3ce))[_0xacee('0xb1')](loggerCatch(_0xacee('0xbb')));};Dialer[_0xacee('0x19')][_0xacee('0xbc')]=function(_0x3b081c){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](cmHopperBlack[_0xacee('0xbc')](_0x3b081c))[_0xacee('0xb1')](loggerCatch(_0xacee('0xbd')));};Dialer[_0xacee('0x19')][_0xacee('0xbe')]=function(_0x571461){return BPromise['resolve']()[_0xacee('0xb7')](cmHopperHistory['avgHandleTime'](_0x571461))['catch'](loggerCatch(_0xacee('0xbf')));};Dialer[_0xacee('0x19')][_0xacee('0xc0')]=function(_0xf21dae){return BPromise[_0xacee('0xb9')]()['then'](cmHopper[_0xacee('0xc0')](_0xf21dae))[_0xacee('0xb1')](loggerCatch(_0xacee('0xc1')));};Dialer[_0xacee('0x19')][_0xacee('0xc2')]=function(_0x4b285d,_0x104999,_0x20e074){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](cmHopper[_0xacee('0xc2')](_0x4b285d,_0x104999,_0x20e074))[_0xacee('0xb1')](loggerCatch(_0xacee('0xc3')));};Dialer[_0xacee('0x19')][_0xacee('0xc4')]=function(_0x2aed86,_0x654d,_0x100828,_0x2697f0){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](cmHopper[_0xacee('0xc4')](_0x2aed86,_0x654d,_0x100828,_0x2697f0))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xacee('0x19')]['getContactDialerIvr']=function(_0x2b1e00,_0x37c6e4,_0x372e2d){return BPromise['resolve']()['then'](cmHopper[_0xacee('0xc5')](_0x2b1e00,_0x37c6e4,_0x372e2d))[_0xacee('0xb1')](loggerCatch(_0xacee('0xc6')));};Dialer[_0xacee('0x19')][_0xacee('0xc7')]=function(_0x1f0a82){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](voiceQueueRt[_0xacee('0xc7')](_0x1f0a82))[_0xacee('0xb1')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xacee('0x19')][_0xacee('0xc8')]=function(_0xa90093){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](cmHopper['moveContactManagedDialer'](_0xa90093))[_0xacee('0xb1')](loggerCatch(_0xacee('0xc9')));};Dialer['prototype'][_0xacee('0xca')]=function(_0x56e8dc){return BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](cmHopperHistory[_0xacee('0xca')](_0x56e8dc))[_0xacee('0xb1')](loggerCatch(_0xacee('0xcb')));};Dialer[_0xacee('0x19')][_0xacee('0xb3')]=function(_0x222fa4){if(!_[_0xacee('0x3d')](_0x222fa4)&&_0x222fa4!==null){if(_0x222fa4[_0xacee('0xcc')]('originated')){if(_0x222fa4['originated']>0x0){_0x222fa4[_0xacee('0x74')]-=0x1;}else{logger['error'](_0xacee('0xcd'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xacee('0x19')][_0xacee('0xce')]=function(_0x144978,_0xa0f2ad){var _0x5ca97c=this;return function(_0x19bf40){_0x5ca97c[_0xacee('0xb3')](_0xa0f2ad);logger[_0xacee('0x98')](_0x144978,util[_0xacee('0x99')](_0x19bf40,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xacee('0xcf')]=function(_0x4125e8,_0x4345e9,_0x3d5fc4){var _0x46dbd6={'state':0x19,'statedesc':_0xacee('0xd0')};this[_0xacee('0xb3')](_0x4345e9);this['saveInDb'](_['merge'](_0x46dbd6,_[_0xacee('0xd1')](_0x3d5fc4,['ContactId',_0xacee('0xd2'),_0xacee('0xd3'),_0xacee('0xd4'),_0xacee('0xd5')])),'[emptyContact][createHistory]',_0xacee('0xd6'));logger[_0xacee('0x98')](_0x4125e8);};Dialer[_0xacee('0x19')][_0xacee('0xd7')]=function(_0x21cdc2){return _0x21cdc2===_0xacee('0xd8');};Dialer['prototype'][_0xacee('0xd9')]=function(_0x289ebe){return!_[_0xacee('0x3d')](_0x289ebe)&&_0x289ebe&&!_[_0xacee('0x3d')](_0x289ebe['name'])&&!_[_0xacee('0x3d')](_0x289ebe[_0xacee('0x7a')])&&_0x289ebe[_0xacee('0x7a')]&&(this[_0xacee('0x22')][util[_0xacee('0x7e')]('SIP/%s',_0x289ebe['name'])]['status']===_0xacee('0xda')||this[_0xacee('0x22')][util[_0xacee('0x7e')](_0xacee('0xdb'),_0x289ebe[_0xacee('0x3f')])][_0xacee('0xdc')]==='unmonitored');};Dialer[_0xacee('0x19')]['saveInDb']=function(_0x1717a2,_0x4c9cc5,_0x4250c0){this[_0xacee('0xca')](_0x1717a2)['catch'](loggerCatch(_0x4c9cc5));this['moveContactManagedDialer'](_0x1717a2)[_0xacee('0xb1')](loggerCatch(_0x4250c0));};Dialer[_0xacee('0x19')][_0xacee('0x3a')]=function(_0x52e36f){var _0x462bef=this[_0xacee('0x27')][_0x52e36f[_0xacee('0xdd')]];var _0x154d46;if(!_['isNil'](_0x52e36f)&&!_['isNil'](_0x52e36f[_0xacee('0xde')])&&!_['isNil'](_0x52e36f['variable'][_0xacee('0xdf')])&&_0x52e36f[_0xacee('0xe0')]==='xcally-motion-dialer'&&_0x462bef){if(_0x462bef[_0xacee('0x55')]!==_0xacee('0x7d')&&this[_0xacee('0x1f')][_0x462bef[_0xacee('0xb5')]][_0xacee('0xe1')]&&_0x52e36f[_0xacee('0xe2')]==='HANGUP'){delete this[_0xacee('0x27')][_0x52e36f[_0xacee('0xdd')]];this['updateOriginated'](this[_0xacee('0x1f')][_0x462bef[_0xacee('0xb5')]]);this[_0xacee('0x1f')][_0x462bef[_0xacee('0xb5')]][_0xacee('0x5e')]+=0x1;this[_0xacee('0x1f')][_0x462bef[_0xacee('0xb5')]][_0xacee('0x5d')]+=0x1;_0x154d46=new Hangup(_0x462bef,_0x52e36f);_0x154d46[_0xacee('0xa9')]=0x12;_0x154d46[_0xacee('0xe3')]=_0xacee('0xe4');_0x154d46[_0xacee('0xe5')]=_0xacee('0xe6');this[_0xacee('0xe7')](_0x154d46,'[syncHangupInAMD][createHistory]',_0xacee('0xe8'));}if(_0x462bef['type']!==_0xacee('0x7d')&&this[_0xacee('0x1f')][_0x462bef[_0xacee('0xb5')]][_0xacee('0xe1')]&&_0x52e36f[_0xacee('0xe2')]===_0xacee('0xe9')){delete this[_0xacee('0x27')][_0x52e36f['uniqueid']];this[_0xacee('0xb3')](this[_0xacee('0x1f')][_0x462bef['queue']]);this['voiceQueues'][_0x462bef[_0xacee('0xb5')]][_0xacee('0x5e')]+=0x1;this[_0xacee('0x1f')][_0x462bef[_0xacee('0xb5')]][_0xacee('0x5d')]+=0x1;_0x154d46=new Hangup(_0x462bef,_0x52e36f);_0x154d46[_0xacee('0xa9')]=0x13;_0x154d46['statedesc']=_0xacee('0xea');_0x154d46['membername']=_0xacee('0xe6');_0x154d46[_0xacee('0xeb')]=!![];this[_0xacee('0xe7')](_0x154d46,_0xacee('0xec'),'[syncMachine]');}if(_0x462bef[_0xacee('0x55')]===_0xacee('0x7d')&&this[_0xacee('0x20')][_0x462bef[_0xacee('0xb5')]][_0xacee('0xe1')]&&_0x52e36f[_0xacee('0xe2')]==='HANGUP'){delete this[_0xacee('0x27')][_0x52e36f['uniqueid']];this[_0xacee('0xb3')](this[_0xacee('0x20')][_0x462bef[_0xacee('0xb5')]]);_0x154d46=new Hangup(_0x462bef,_0x52e36f);_0x154d46[_0xacee('0xa9')]=0x12;_0x154d46[_0xacee('0xe3')]=_0xacee('0xe4');_0x154d46['membername']='AMD';this[_0xacee('0xe7')](_0x154d46,_0xacee('0xed'),_0xacee('0xee'));}if(_0x462bef[_0xacee('0x55')]===_0xacee('0x7d')&&this['campaigns'][_0x462bef[_0xacee('0xb5')]]['dialAMDActive']&&_0x52e36f['value']===_0xacee('0xe9')){delete this['uniqueId'][_0x52e36f[_0xacee('0xdd')]];this[_0xacee('0xb3')](this[_0xacee('0x20')][_0x462bef[_0xacee('0xb5')]]);_0x154d46=new Hangup(_0x462bef,_0x52e36f);_0x154d46[_0xacee('0xa9')]=0x13;_0x154d46[_0xacee('0xe3')]=_0xacee('0xea');_0x154d46[_0xacee('0xe5')]='AMD';_0x154d46[_0xacee('0xeb')]=!![];this[_0xacee('0xe7')](_0x154d46,_0xacee('0xef'),'[syncMachineIvr]');}}};Dialer['prototype'][_0xacee('0x36')]=function(_0x5ba354){var _0x4f73f8=this[_0xacee('0x27')][_0x5ba354[_0xacee('0xdd')]];var _0x59bce6=this;var _0x22fbf2;if(_0x4f73f8&&_0x4f73f8[_0xacee('0x55')]===_0xacee('0x7d')){delete this[_0xacee('0x27')][_0x5ba354['uniqueid']];this[_0xacee('0xb3')](this[_0xacee('0x20')][_0x4f73f8[_0xacee('0xb5')]]);this[_0xacee('0x20')][_0x4f73f8[_0xacee('0xb5')]][_0xacee('0xf0')]+=0x1;_0x22fbf2=new Hangup(_0x4f73f8,_0x5ba354);this[_0xacee('0xca')](_0x22fbf2)[_0xacee('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xacee('0xc8')](_0x22fbf2)[_0xacee('0xb1')](loggerCatch(_0xacee('0xf1')));}if(_0x4f73f8&&_0x4f73f8[_0xacee('0x55')]!==_0xacee('0x7d')&&isNotNull(this['voiceQueues'][_0x4f73f8[_0xacee('0xb5')]]['dialQueueProject'])){delete this['uniqueId'][_0x5ba354[_0xacee('0xdd')]];this[_0xacee('0xb3')](this['voiceQueues'][_0x4f73f8[_0xacee('0xb5')]]);this[_0xacee('0x1f')][_0x4f73f8[_0xacee('0xb5')]]['outboundAnswerCallsDay']+=0x1;this[_0xacee('0x1f')][_0x4f73f8[_0xacee('0xb5')]][_0xacee('0x5d')]+=0x1;_0x22fbf2=new Hangup(_0x4f73f8,_0x5ba354);_0x22fbf2[_0xacee('0xa9')]=0x10;_0x22fbf2['statedesc']='AnswerAGI';_0x22fbf2[_0xacee('0xe5')]=_0xacee('0xf2');this[_0xacee('0xca')](_0x22fbf2)[_0xacee('0xb1')](loggerCatch(_0xacee('0xf3')));this[_0xacee('0xc8')](_0x22fbf2)[_0xacee('0xb1')](loggerCatch(_0xacee('0xf1')));}if(_0x4f73f8&&_0x4f73f8['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x4f73f8['queue']][_0xacee('0xf4')])){delete this[_0xacee('0x27')][_0x5ba354['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x4f73f8[_0xacee('0xb5')]]);this[_0xacee('0x1f')][_0x4f73f8[_0xacee('0xb5')]][_0xacee('0x68')]+=0x1;_0x22fbf2=new Hangup(_0x4f73f8,_0x5ba354);_0x22fbf2[_0xacee('0xa9')]=0xc;_0x22fbf2['statedesc']=_0x5ba354[_0xacee('0xf5')];_0x22fbf2[_0xacee('0xe5')]=_0xacee('0xf6');this[_0xacee('0xca')](_0x22fbf2)[_0xacee('0xb1')](loggerCatch(_0xacee('0xf3')));this['moveContactManagedDialer'](_0x22fbf2)['catch'](loggerCatch(_0xacee('0xf1')));}};Dialer[_0xacee('0x19')][_0xacee('0x32')]=function(_0x264620){var _0xd093a4=this[_0xacee('0x27')][_0x264620[_0xacee('0xdd')]];var _0x52dab8=this;if(this[_0xacee('0x1f')][_0x264620[_0xacee('0xb5')]]){if(_0xd093a4&&_0xd093a4[_0xacee('0x55')]!==_0xacee('0x7d')){delete this[_0xacee('0x27')][_0x264620[_0xacee('0xdd')]];this[_0xacee('0x1f')][_0x264620[_0xacee('0xb5')]][_0xacee('0x5e')]+=0x1;var _0x225632=new AgentComplete(_0xd093a4,_0x264620);if(_0x264620[_0xacee('0xf7')]===_0xacee('0xf8')){_0x225632[_0xacee('0xf9')]=this[_0xacee('0x1f')][_0x264620[_0xacee('0xb5')]]['dialQueueProject2']&&this['voiceQueues'][_0x264620['queue']][_0xacee('0xfa')]?moment()[_0xacee('0x7e')](_0xacee('0xfb')):undefined;}this[_0xacee('0xca')](_0x225632)[_0xacee('0xb1')](loggerCatch(_0xacee('0xfc')));this['moveContactManagedDialer'](_0x225632)[_0xacee('0xb1')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xacee('0x19')][_0xacee('0xfd')]=function(_0x323ef1){if(this['voiceQueues'][_0x323ef1[_0xacee('0xb5')]]){if(this[_0xacee('0x27')][_0x323ef1[_0xacee('0xdd')]]&&this[_0xacee('0x27')][_0x323ef1['uniqueid']][_0xacee('0x55')]!==_0xacee('0x7d')){this['updateOriginated'](this[_0xacee('0x1f')][_0x323ef1[_0xacee('0xb5')]]);this[_0xacee('0x27')][_0x323ef1['uniqueid']][_0xacee('0xfe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xacee('0x19')][_0xacee('0xff')]=function(_0xd31df6){this[_0xacee('0xca')](_0xd31df6)[_0xacee('0xb1')](loggerCatch(_0xacee('0xfc')));this['moveContactManagedDialer'](_0xd31df6)[_0xacee('0xb1')](loggerCatch(_0xacee('0x100')));};Dialer[_0xacee('0x19')][_0xacee('0x2e')]=function(_0x2364a1){var _0x75c494=this['uniqueId'][_0x2364a1[_0xacee('0xdd')]];var _0x46be1c=this;if(this[_0xacee('0x1f')][_0x2364a1[_0xacee('0xb5')]]){if(_0x75c494&&_0x75c494[_0xacee('0x55')]!==_0xacee('0x7d')){delete this['uniqueId'][_0x2364a1[_0xacee('0xdd')]];this['updateOriginated'](this[_0xacee('0x1f')][_0x2364a1[_0xacee('0xb5')]]);_0x75c494[_0xacee('0x101')]=moment()['format'](_0xacee('0xfb'));var _0x2aeaf6=new QueueCallerAbandon(_0x75c494,_0x2364a1);if(getSeconds(_0x75c494['droptime'],_0x75c494[_0xacee('0x102')])>=_0x75c494[_0xacee('0x103')]){this[_0xacee('0x1f')][_0x2364a1[_0xacee('0xb5')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x2364a1[_0xacee('0xb5')]][_0xacee('0x104')]+=0x1;this[_0xacee('0x1f')][_0x2364a1[_0xacee('0xb5')]][_0xacee('0x105')]+=0x1;_0x2aeaf6[_0xacee('0xa9')]=0xa;_0x2aeaf6['statedesc']=_0xacee('0x106');_0x2aeaf6[_0xacee('0x107')]=_0xacee('0x108');_0x2aeaf6['agiafterat']=this[_0xacee('0x1f')][_0x2364a1[_0xacee('0xb5')]][_0xacee('0x109')]?moment()[_0xacee('0x7e')](_0xacee('0xfb')):undefined;this[_0xacee('0xff')](_0x2aeaf6);}else{this[_0xacee('0x1f')][_0x2364a1[_0xacee('0xb5')]][_0xacee('0x6c')]+=0x1;this['voiceQueues'][_0x2364a1[_0xacee('0xb5')]][_0xacee('0x62')]+=0x1;_0x2aeaf6[_0xacee('0xa9')]=0xb;_0x2aeaf6[_0xacee('0xe3')]=_0xacee('0x10a');_0x2aeaf6['dropreason']=_0xacee('0x10b');this[_0xacee('0xff')](_0x2aeaf6);}}}};Dialer[_0xacee('0x19')][_0xacee('0x38')]=function(_0x46ecce){if(this['actions'][_0x46ecce[_0xacee('0xdd')]]){this[_0xacee('0x25')][_0x46ecce[_0xacee('0xdd')]][_0xacee('0xb0')]=_0x46ecce[_0xacee('0xb0')];}if(this['uniqueId'][_0x46ecce[_0xacee('0xdd')]]){this[_0xacee('0x27')][_0x46ecce['uniqueid']][_0xacee('0xb0')]=_0x46ecce[_0xacee('0xb0')];}};Dialer[_0xacee('0x19')][_0xacee('0x10c')]=function(_0x11d3cb){if(strategy[this[_0xacee('0x1f')][this[_0xacee('0x25')][_0x11d3cb['actionid']][_0xacee('0xb5')]][_0xacee('0x4e')]]==='roundrobin'){if(this['actions'][_0x11d3cb[_0xacee('0x10d')]]&&_[_0xacee('0xaf')](this['actions'][_0x11d3cb['actionid']][_0xacee('0x10e')])&&_0x11d3cb[_0xacee('0xdc')]==='1'&&_0x11d3cb['paused']==='0'){if(this['agents'][_0x11d3cb[_0xacee('0x10f')]]){if(!this['agents'][_0x11d3cb[_0xacee('0x10f')]][_0xacee('0x10e')]){this['agents'][_0x11d3cb[_0xacee('0x10f')]][_0xacee('0x10e')]=!![];this[_0xacee('0x25')][_0x11d3cb[_0xacee('0x10d')]][_0xacee('0x10e')]=!![];this['actions'][_0x11d3cb[_0xacee('0x10d')]][_0xacee('0x10f')]=_0x11d3cb[_0xacee('0x10f')];}}}}else if((strategy[this[_0xacee('0x1f')][this[_0xacee('0x25')][_0x11d3cb[_0xacee('0x10d')]]['queue']][_0xacee('0x4e')]]||'rrmemory')==='rrmemory'){if(this[_0xacee('0x25')][_0x11d3cb[_0xacee('0x10d')]]){if(this[_0xacee('0x21')][_0x11d3cb[_0xacee('0x10f')]]){this[_0xacee('0x25')][_0x11d3cb[_0xacee('0x10d')]]['stateinterface']=_0x11d3cb[_0xacee('0x10f')];if(_[_0xacee('0xaf')](this[_0xacee('0x2b')][this['actions'][_0x11d3cb['actionid']][_0xacee('0xb5')]])){this[_0xacee('0x2b')][this[_0xacee('0x25')][_0x11d3cb['actionid']]['queue']]=[];}this['queueBooked'][this[_0xacee('0x25')][_0x11d3cb[_0xacee('0x10d')]][_0xacee('0xb5')]][_0xacee('0x110')](_['merge'](_[_0xacee('0xd1')](this['actions'][_0x11d3cb[_0xacee('0x10d')]],['idHopper',_0xacee('0x10f')]),{'status':_0x11d3cb[_0xacee('0xdc')],'paused':_0x11d3cb['paused']}));}}}};function unlockQueueStatus(_0x588de8,_0x44dbb1){setTimeout(function(){if(_['isUndefined'](_0x588de8[_0xacee('0x111')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x44dbb1);}_0x588de8[_0xacee('0x111')]=!![];loggerBooked['info'](_0xacee('0x112'),_0x44dbb1,JSON[_0xacee('0x48')](_[_0xacee('0xd1')](_0x588de8,[_0xacee('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xacee('0x19')]['syncQueueStatusComplete']=function(_0x4a5fc){var _0x8bea00=this;var _0x26743b=_0x8bea00[_0xacee('0x1f')][_0x8bea00['actions'][_0x4a5fc['actionid']][_0xacee('0xb5')]];if(strategy[this[_0xacee('0x1f')][this[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0xb5')]][_0xacee('0x4e')]]===_0xacee('0x113')){if(this['actions'][_0x4a5fc[_0xacee('0x10d')]]&&this[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0x10f')]){this[_0xacee('0x1e')][_0xacee('0x114')](this[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0x115')],this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]]['stateinterface'])['catch'](function(_0x3704df){logger['error'](_0xacee('0x116'),util[_0xacee('0x99')](_0x3704df,{'showHidden':![],'depth':null}));})[_0xacee('0x1c')](function(){_0x8bea00[_0xacee('0xb3')](_0x8bea00['voiceQueues'][_0x8bea00[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0xb5')]]);_0x8bea00[_0xacee('0x21')][_0x8bea00[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0x10f')]][_0xacee('0x10e')]=![];delete _0x8bea00[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]];unlockQueueStatus(_0x26743b);});}else{this[_0xacee('0xb3')](this['voiceQueues'][this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]]);this[_0xacee('0xc0')]({'active':![],'ContactId':this[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0x117')],'ListId':this['actions'][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xd2')],'VoiceQueueId':this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xd4')]||undefined,'CampaignId':this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xd5')]||undefined})[_0xacee('0xb1')](loggerCatch(_0xacee('0x118')));delete this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]];unlockQueueStatus(_0x26743b);}}else if((strategy[this[_0xacee('0x1f')][this[_0xacee('0x25')][_0x4a5fc['actionid']][_0xacee('0xb5')]]['strategy']]||'rrmemory')==='rrmemory'){var _0x13172c;if(this[_0xacee('0x25')][_0x4a5fc['actionid']]&&!_['isEmpty'](this[_0xacee('0x2b')][this[_0xacee('0x25')][_0x4a5fc['actionid']]['queue']])){if(this[_0xacee('0x119')][_0x8bea00[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]]){this['queueBookedRR'][_0x8bea00[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]]=this[_0xacee('0x119')][this['actions'][_0x4a5fc[_0xacee('0x10d')]]['queue']]?this[_0xacee('0x119')][this['actions'][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]]:this[_0xacee('0x2b')][this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]]?this[_0xacee('0x2b')][this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]]['queue']]['_rr']||0x0:0x0;}this[_0xacee('0x2b')][this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]]['_rr']=this['queueBookedRR'][this[_0xacee('0x25')][_0x4a5fc[_0xacee('0x10d')]][_0xacee('0xb5')]];for(var _0x5ecea4=0x0;_0x5ecea4=0x0?!![]:![];})[_0xacee('0xb1')](myreject(_0x5500fb)));}}else{_0xf62fed[_0xacee('0x110')](ami[_0xacee('0x133')]({'action':'command','command':util['format'](_0xacee('0x135'),_0x3ec6a4,!_[_0xacee('0x3d')](config[_0xacee('0x12f')][_0x4a689d])?_0x4a689d:'')})[_0xacee('0xb7')](function(_0x28dff0){return _0x28dff0[_0xacee('0x138')][_0xacee('0x137')](_0xacee('0x139'))>=0x0?!![]:![];})['catch'](myreject(_0x5500fb)));}BPromise[_0xacee('0x13a')](_0xf62fed)[_0xacee('0xb7')](function(_0x121865){var _0x5717c4=_[_0xacee('0x13b')](_0x121865);if(_0x5717c4){return _0x58d399(_0x5717c4);}else{_0x28f1b5[_0xacee('0x3e')]=_0x914502?_0xacee('0x13c'):_0xacee('0x13d');return _0x5500fb(msgResponse(_0xacee('0x13e'),_0xacee('0x12d'),'Global:\x20'+_0x914502+'\x20'+_0x9b7a46+_0xacee('0x13f')+util[_0xacee('0x99')](_0x3ec6a4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4a689d));}})[_0xacee('0xb1')](function(_0x176e2d){return _0x5500fb(msgResponse('ifTime',_0xacee('0x12d'),JSON['stringify'](_0x176e2d)));});});};Dialer[_0xacee('0x19')]['checkDialMethod']=function(_0x496cec){var _0x13838d=this;return function(){switch(_0x496cec[_0xacee('0x140')]){case'progressive':freeVariablesPredictive(_0x496cec);_0x13838d[_0xacee('0x141')](_0x496cec,0x1);break;case _0xacee('0x142'):freeVariablesPredictive(_0x496cec);_0x13838d[_0xacee('0x141')](_0x496cec,_0x496cec[_0xacee('0x143')]);break;case'predictive':_0x13838d[_0xacee('0x9')](_0x496cec);break;case _0xacee('0x8'):freeVariablesPredictive(_0x496cec);_0x13838d['handlePower'](_0x496cec,0x1);break;default:freeVariablesPredictive(_0x496cec);logger['error']('Queue',_0x496cec[_0xacee('0x3f')],_0xacee('0x144'));}};};Dialer[_0xacee('0x19')][_0xacee('0x145')]=function(_0x1e00e5){var _0x52b0cf=this;return function(){_0x52b0cf[_0xacee('0x146')](_0x1e00e5);};};Dialer['prototype']['syncQueueSummary']=function(_0x559d9e){var _0x462df5=this;if(isNotPreview(_0x559d9e[_0xacee('0x140')])){if(isVoiceQueueOutbound(_0x559d9e[_0xacee('0x55')])&&isActive(_0x559d9e[_0xacee('0x59')])){_0x559d9e['sendMessageOneNotActive']=!![];BPromise[_0xacee('0xb9')]()['then'](checkIsLoggedIn(_0x559d9e,_0x559d9e['loggedIn']))[_0xacee('0xb7')](checkIsActive(_0x559d9e,_0x559d9e[_0xacee('0x59')]))[_0xacee('0xb7')](checkInterval(_0x559d9e))[_0xacee('0xb7')](_0x462df5[_0xacee('0x127')](_0x559d9e))['then'](_0x462df5['checkIfTime'](_0x559d9e[_0xacee('0x147')],_0x559d9e[_0xacee('0x148')],_0x559d9e['name'],_0x559d9e))[_0xacee('0xb7')](_0x462df5[_0xacee('0x149')](_0x559d9e[_0xacee('0x44')],_0x559d9e['dialTimezone'],_0x559d9e[_0xacee('0x3f')],_0x559d9e))['then'](_0x462df5['checkDialMethod'](_0x559d9e))['catch'](loggerCatchQueueSummary(_0xacee('0x14a'),_0x559d9e));}else{notSendMessagesQueue(_0x559d9e);}}else{freeVariablesPredictive(_0x559d9e);}};Dialer[_0xacee('0x19')][_0xacee('0x126')]=function(){var _0x46ae5f=this;var _0x3b3368;for(var _0x2381cd in this[_0xacee('0x20')]){if(this[_0xacee('0x20')]['hasOwnProperty'](_0x2381cd)){_0x3b3368=this[_0xacee('0x20')][_0x2381cd];if(isCampaignIvr(_0x3b3368['type'])&&isActive(_0x3b3368[_0xacee('0x7a')])){_0x3b3368['sendMessageOneNotActive']=!![];BPromise[_0xacee('0xb9')]()[_0xacee('0xb7')](checkIsActive(_0x3b3368,_0x3b3368[_0xacee('0x7a')]))['then'](checkInterval(_0x3b3368))[_0xacee('0xb7')](_0x46ae5f[_0xacee('0x127')](_0x3b3368))[_0xacee('0xb7')](_0x46ae5f[_0xacee('0x14b')](_0x3b3368['dialGlobalInterval'],_0x3b3368['dialTimezone'],_0x3b3368[_0xacee('0x3f')],_0x3b3368))[_0xacee('0xb7')](_0x46ae5f[_0xacee('0x149')](_0x3b3368[_0xacee('0x44')],_0x3b3368[_0xacee('0x148')],_0x3b3368['name'],_0x3b3368))[_0xacee('0xb7')](_0x46ae5f[_0xacee('0x145')](_0x3b3368))[_0xacee('0xb1')](loggerCatchQueueSummary(_0xacee('0x14c'),_0x3b3368));}else{notSendMessagesCampaign(_0x3b3368);}}}};function getCallerIdRandom(_0x3f4009,_0x3eb09c){var _0x4354b4,_0x4cc237,_0xd206b4;if(_0x3eb09c<=0x0){_0x3eb09c=0x1;}_0x4354b4=new RegExp(_0xacee('0x14d')+_0x3eb09c+'}$');_0x4cc237=Math[_0xacee('0x14e')](0xa,_0x3eb09c-0x1);_0xd206b4=Math[_0xacee('0x14e')](0xa,_0x3eb09c)-0x1;return util[_0xacee('0x7e')]('%s',_[_0xacee('0x14f')](_0x3f4009,_0x4354b4,_[_0xacee('0x150')](_0x4cc237,_0xd206b4)));}function extractCalleridName(_0x404bdc){var _0x494059=_0x404bdc[_0xacee('0x151')](/"(.*?)"/);return _0x494059?_0x494059[0x1]:_0x404bdc;}function extractCalleridNumber(_0x1d6024){var _0x17e233=_0x1d6024[_0xacee('0x151')](/<(.*?)>/);return _0x17e233?_0x17e233[0x1]:_0x1d6024;}Dialer[_0xacee('0x19')][_0xacee('0x152')]=function(_0x5115bb,_0x42a06b){var _0x25fab4=this;var _0x1cebb1=uuid['v4']();this[_0xacee('0x25')][_0x1cebb1]=new Action(_0x5115bb,_0x42a06b,_0x1cebb1);return new BPromise(function(_0x172a41,_0xa139e0){if(_[_0xacee('0x3d')](_0x5115bb)&&_0xacee('0x153')!==typeof _0x5115bb){return _0xa139e0(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x42a06b[_0xacee('0x154')][_0xacee('0x155')])||_0x42a06b[_0xacee('0x154')][_0xacee('0x155')]===null){return _0xa139e0(msgResponse(_0xacee('0x156'),_0xacee('0x12d'),_0xacee('0x157')));}var _0x413fac={'XMD-CALLERID':_0x25fab4[_0xacee('0x25')][_0x1cebb1][_0xacee('0x158')](),'XMD-AGI':_0x5115bb[_0xacee('0xf4')]?util[_0xacee('0x7e')](_0xacee('0x159'),ipAgi,_0x5115bb[_0xacee('0xf4')]):_0xacee('0x15a'),'XMD-AGIAFTER':_0x5115bb[_0xacee('0x109')]?util[_0xacee('0x7e')](_0xacee('0x159'),ipAgi,_0x5115bb[_0xacee('0x109')]):_0xacee('0x15a'),'XMD-QUEUE':_0x5115bb[_0xacee('0x55')]===_0xacee('0x4d')?util['format'](_0xacee('0x15b'),_0x5115bb[_0xacee('0x3f')],_0x5115bb['dialQueueOptions']||'',_0x5115bb['dialAgiAfterHangupAgent']?'c':'',_0x5115bb['dialQueueTimeout']||0x3):_0xacee('0x15a'),'XMD-CONTACTID':_0x42a06b[_0xacee('0x117')],'XMD-CDRTYPE':_0xacee('0x7'),'CALLERID(all)':_0x25fab4[_0xacee('0x25')][_0x1cebb1][_0xacee('0x158')](),'XMD-AMD':_0x5115bb[_0xacee('0xe1')]?'ACTIVE':_0xacee('0x15a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5115bb[_0xacee('0xe1')]){_0x413fac[_0xacee('0x15c')]=_0x5115bb[_0xacee('0x15d')]||0x9c4;_0x413fac[_0xacee('0x15e')]=_0x5115bb['dialAMDGreeting']||0x5dc;_0x413fac['XMD-AMDAFTERGREETINGSILENCE']=_0x5115bb[_0xacee('0x15f')]||0x320;_0x413fac[_0xacee('0x160')]=_0x5115bb[_0xacee('0x161')]||0x1388;_0x413fac[_0xacee('0x162')]=_0x5115bb['dialAMDMinWordLength']||0x64;_0x413fac['XMD-AMDBETWEENWORDSSILENCE']=_0x5115bb[_0xacee('0x163')]||0x32;_0x413fac['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5115bb['dialAMDMaximumNumberOfWords']||0x3;_0x413fac[_0xacee('0x164')]=_0x5115bb[_0xacee('0x165')]||0x100;_0x413fac[_0xacee('0x166')]=_0x5115bb[_0xacee('0x167')]||0x1388;}if(_0x5115bb[_0xacee('0x55')]===_0xacee('0x4d')){_0x413fac[_0xacee('0x168')]=_0x42a06b['VoiceQueueId'];}else{_0x413fac[_0xacee('0x169')]=_0x42a06b[_0xacee('0xd5')];}for(var _0x51dd18 in _0x42a06b[_0xacee('0x154')]){if(_0x42a06b[_0xacee('0x154')][_0xacee('0xcc')](_0x51dd18)){if(isNotNull(_0x42a06b[_0xacee('0x154')][_0x51dd18])&&_0x51dd18!=='id'&&_0x51dd18!==_0xacee('0x16a')&&_0x51dd18!==_0xacee('0x16b')&&_0x51dd18!=='updatedAt'){_0x413fac[util[_0xacee('0x7e')]('%s%s',_0xacee('0x16c'),_[_0xacee('0x16d')](_0x51dd18))]=_0x42a06b['Contact'][_0x51dd18];}}}var _0x50d65a=_0x25fab4['isTrunkReachable'](_0x5115bb[_0xacee('0x79')])?getCallerId(_0x5115bb[_0xacee('0x79')][_0xacee('0x7b')],_0x5115bb[_0xacee('0x5a')],_0x5115bb[_0xacee('0x16e')]>0x0?getCallerIdRandom(_0x5115bb['dialOriginateCallerIdNumber'],_0x5115bb[_0xacee('0x16e')]):_0x5115bb['dialOriginateCallerIdNumber']):getCallerId(_[_0xacee('0xaf')](_0x5115bb[_0xacee('0x128')])?_0x5115bb[_0xacee('0x79')][_0xacee('0x7b')]:_0x5115bb[_0xacee('0x128')][_0xacee('0x7b')],_0x5115bb[_0xacee('0x5a')],_0x5115bb[_0xacee('0x16e')]>0x0?getCallerIdRandom(_0x5115bb[_0xacee('0x5b')],_0x5115bb[_0xacee('0x16e')]):_0x5115bb[_0xacee('0x5b')]);if(_0x50d65a){_0x413fac[_0xacee('0x16f')]=_0x25fab4[_0xacee('0x25')][_0x1cebb1][_0xacee('0x170')]=extractCalleridName(_0x50d65a);_0x413fac[_0xacee('0x171')]=_0x25fab4[_0xacee('0x25')][_0x1cebb1][_0xacee('0x172')]=extractCalleridNumber(_0x50d65a);}return ami[_0xacee('0x133')]({'actionid':_0x1cebb1,'action':_0xacee('0x156'),'channel':_0x25fab4[_0xacee('0xd9')](_0x5115bb[_0xacee('0x79')])?util[_0xacee('0x7e')](_0xacee('0x173'),_0x5115bb[_0xacee('0x79')][_0xacee('0x3f')],isNotNull(_0x5115bb['dialPrefix'])?_0x5115bb[_0xacee('0x174')][_0xacee('0x175')]()||'':'',_0x5115bb['dialCutDigit']>0x0?_0x42a06b['Contact'][_0xacee('0x155')][_0xacee('0x176')](_0x5115bb[_0xacee('0x177')]):_0x42a06b[_0xacee('0x154')][_0xacee('0x155')]):util[_0xacee('0x7e')](_0xacee('0x173'),_[_0xacee('0xaf')](_0x5115bb['TrunkBackup'])?_0x5115bb[_0xacee('0x79')][_0xacee('0x3f')]:_0x5115bb[_0xacee('0x128')][_0xacee('0x3f')],isNotNull(_0x5115bb[_0xacee('0x174')])?_0x5115bb[_0xacee('0x174')][_0xacee('0x175')]()||'':'',_0x5115bb[_0xacee('0x177')]>0x0?_0x42a06b[_0xacee('0x154')]['phone']['substring'](_0x5115bb[_0xacee('0x177')]):_0x42a06b[_0xacee('0x154')]['phone']),'callerid':_0x50d65a,'Exten':_0xacee('0x178'),'Context':'from-sip','Priority':'1','variable':_0x413fac,'timeout':(_0x5115bb['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1cebb1})[_0xacee('0xb7')](function(_0xed4bfe){return _0x172a41(_0xed4bfe);})[_0xacee('0xb1')](function(_0x2c0e5b){_0x5115bb[_0xacee('0x65')]+=0x1;var _0x2390b9=new History(_0x25fab4[_0xacee('0x25')][_0x1cebb1]);logger[_0xacee('0x98')](util[_0xacee('0x7e')](_0xacee('0x179'),JSON[_0xacee('0x48')](_0x2c0e5b)));_0x2390b9[_0xacee('0xa9')]=0xe;_0x2390b9[_0xacee('0xe3')]=_0xacee('0x17a');_0x2390b9[_0xacee('0xab')]=moment()['format'](_0xacee('0xfb'));_0x2390b9['endtime']=_0x2390b9[_0xacee('0xab')];_0x25fab4[_0xacee('0xca')](_0x2390b9)[_0xacee('0xb1')](loggerCatch(_0xacee('0x17b')));_0x25fab4[_0xacee('0xc8')](_0x2390b9)[_0xacee('0xb1')](loggerCatch(_0xacee('0x17b')))[_0xacee('0x1c')](function(){delete _0x25fab4[_0xacee('0x25')][_0x1cebb1];return _0xa139e0(msgResponse(_0xacee('0x156'),_0xacee('0x47'),_0xacee('0x17c')));});});});};Dialer[_0xacee('0x19')][_0xacee('0x30')]=function(_0x1f912f){var _0x408b3f=this[_0xacee('0x25')][_0x1f912f['actionid']];var _0x3f50d7=this;if(_0x408b3f){delete this[_0xacee('0x25')][_0x1f912f[_0xacee('0x10d')]];_0x408b3f[_0xacee('0x102')]=moment()[_0xacee('0x7e')](_0xacee('0xfb'));var _0x4251fe=_0x408b3f[_0xacee('0x55')]===_0xacee('0x7d')?this[_0xacee('0x20')][_0x408b3f['queue']]:this[_0xacee('0x1f')][_0x408b3f[_0xacee('0x17d')]()];if(!this[_0xacee('0xd7')](_0x1f912f[_0xacee('0x17e')])){this[_0xacee('0xb3')](_0x4251fe);return this[_0xacee('0x17f')](_0x408b3f,_0x4251fe,_0x1f912f)[_0xacee('0xb7')](function(_0x5cb4fe){})[_0xacee('0xb1')](loggerCatch(_0xacee('0x180')));}else{this['uniqueId'][_0x1f912f[_0xacee('0xdd')]]=_0x408b3f;}}};Dialer[_0xacee('0x19')][_0xacee('0x181')]=function(_0x2b383c,_0x51b62d,_0x21dafc){var _0x4c6721=new History(_0x51b62d);if(_0x4c6721['countbusyretry']+_0x4c6721[_0xacee('0x182')]+_0x4c6721[_0xacee('0x183')]>=_0x21dafc[_0xacee('0x184')]-0x1){return!![];}switch(_0x2b383c){case 0x3:if(_0x4c6721['countnoanswerretry']>=_0x21dafc[_0xacee('0x185')]-0x1){return!![];}else{this[_0xacee('0xc0')]({'active':![],'countnoanswerretry':_0x4c6721['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x21dafc[_0xacee('0x186')],_0xacee('0x187'))[_0xacee('0x7e')](_0xacee('0xfb')),'ContactId':_0x4c6721['ContactId'],'ListId':_0x4c6721['ListId'],'VoiceQueueId':_0x4c6721[_0xacee('0xd4')]||undefined,'CampaignId':_0x4c6721[_0xacee('0xd5')]||undefined})['catch'](loggerCatch(_0xacee('0x188')));}break;case 0x5:if(_0x4c6721['countbusyretry']>=_0x21dafc[_0xacee('0x189')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x4c6721[_0xacee('0x18a')]+=0x1,'scheduledat':moment()[_0xacee('0x18b')](_0x21dafc[_0xacee('0x18c')],'minutes')[_0xacee('0x7e')](_0xacee('0xfb')),'ContactId':_0x4c6721[_0xacee('0x117')],'ListId':_0x4c6721[_0xacee('0xd2')],'VoiceQueueId':_0x4c6721[_0xacee('0xd4')]||undefined,'CampaignId':_0x4c6721[_0xacee('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x4c6721['countcongestionretry']>=_0x21dafc[_0xacee('0x18d')]-0x1){return!![];}else{this[_0xacee('0xc0')]({'active':![],'countcongestionretry':_0x4c6721[_0xacee('0x182')]+=0x1,'scheduledat':moment()[_0xacee('0x18b')](_0x21dafc[_0xacee('0x18e')],_0xacee('0x187'))[_0xacee('0x7e')](_0xacee('0xfb')),'ContactId':_0x4c6721[_0xacee('0x117')],'ListId':_0x4c6721[_0xacee('0xd2')],'VoiceQueueId':_0x4c6721['VoiceQueueId']||undefined,'CampaignId':_0x4c6721[_0xacee('0xd5')]||undefined})[_0xacee('0xb1')](loggerCatch(_0xacee('0x18f')));}break;default:return!![];}};Dialer[_0xacee('0x19')][_0xacee('0x17f')]=function(_0x530010,_0x2b3a4d,_0x4bcd4d){var _0x2320e1=this;var _0x1b7491=new History(_0x530010);return new BPromise(function(_0x5cddb5,_0x38b047){if(_[_0xacee('0x3d')](_0x2b3a4d)&&_0xacee('0x153')!==typeof _0x2b3a4d){return _0x38b047(msgResponse(_0xacee('0x190'),_0xacee('0x12d'),_0xacee('0x191')));}if(_[_0xacee('0x3d')](_0x4bcd4d)&&_0xacee('0x153')!==typeof _0x4bcd4d){return _0x38b047(msgResponse(_0xacee('0x190'),_0xacee('0x12d'),'evt\x20is\x20undefine'));}switch(_0x4bcd4d[_0xacee('0xf7')]){case'0':_0x2b3a4d['outboundNoSuchCallsDay']+=0x1;_0x1b7491[_0xacee('0xa9')]=0x0;_0x1b7491[_0xacee('0xe3')]=_0xacee('0x192');_0x2320e1['createHistory'](_0x1b7491)[_0xacee('0xb1')](loggerCatch(_0xacee('0x193')));if(_0x2320e1['checkRetriveMax'](0x0,_0x530010,_0x2b3a4d)){if(_0x1b7491['countbusyretry']+_0x1b7491[_0xacee('0x182')]+_0x1b7491[_0xacee('0x183')]>=_0x2b3a4d[_0xacee('0x184')]){_0x2320e1[_0xacee('0x194')](_0x1b7491,_0x5cddb5,_0x38b047,'reason\x200\x20no\x20such\x20number....');}else{_0x2320e1['createStateFinal'](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x195'));}}break;case'3':_0x2b3a4d[_0xacee('0x63')]+=0x1;_0x1b7491[_0xacee('0xa9')]=0x3;_0x1b7491[_0xacee('0xe3')]='NoAnswer';_0x1b7491[_0xacee('0x183')]+=0x1;_0x1b7491[_0xacee('0x196')]+=0x1;_0x2320e1[_0xacee('0xca')](_0x1b7491)[_0xacee('0xb1')](loggerCatch(_0xacee('0x197')));if(_0x2320e1[_0xacee('0x181')](0x3,_0x530010,_0x2b3a4d)){if(_0x1b7491['countnoanswerretry']>=_0x2b3a4d[_0xacee('0x185')]){_0x2320e1[_0xacee('0x198')](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x199'));}else{_0x2320e1[_0xacee('0x194')](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x199'));}}break;case'5':_0x2b3a4d[_0xacee('0x19a')]+=0x1;_0x1b7491['state']=0x5;_0x1b7491[_0xacee('0xe3')]='Busy';_0x1b7491['countbusyretry']+=0x1;_0x1b7491['countglobal']+=0x1;_0x2320e1[_0xacee('0xca')](_0x1b7491)[_0xacee('0xb1')](loggerCatch(_0xacee('0x19b')));if(_0x2320e1[_0xacee('0x181')](0x5,_0x530010,_0x2b3a4d)){if(_0x1b7491[_0xacee('0x18a')]>=_0x2b3a4d[_0xacee('0x189')]){_0x2320e1['createStateFinal'](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x19c'));}else{_0x2320e1['stateGlobal'](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x19c'));}}break;case'8':_0x2b3a4d[_0xacee('0x60')]+=0x1;_0x1b7491[_0xacee('0xa9')]=0x8;_0x1b7491[_0xacee('0xe3')]=_0xacee('0x19d');_0x1b7491[_0xacee('0x182')]+=0x1;_0x1b7491['countglobal']+=0x1;_0x2320e1[_0xacee('0xca')](_0x1b7491)[_0xacee('0xb1')](loggerCatch(_0xacee('0x19e')));if(_0x2320e1[_0xacee('0x181')](0x8,_0x530010,_0x2b3a4d)){if(_0x1b7491[_0xacee('0x182')]>=_0x2b3a4d['dialCongestionMaxRetry']){_0x2320e1[_0xacee('0x198')](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x19f'));}else{_0x2320e1[_0xacee('0x194')](_0x1b7491,_0x5cddb5,_0x38b047,_0xacee('0x19f'));}}break;default:_0x2b3a4d['outboundUnknownCallsDay']+=0x1;_0x1b7491[_0xacee('0xa9')]=0xc;_0x1b7491[_0xacee('0xe3')]=_0x4bcd4d[_0xacee('0xf7')];_0x2320e1[_0xacee('0xca')](_0x1b7491)[_0xacee('0xb1')](loggerCatch(_0xacee('0x1a0')));if(_0x2320e1[_0xacee('0x181')](_0x4bcd4d[_0xacee('0xf7')],_0x530010,_0x2b3a4d)){if(_0x1b7491[_0xacee('0x18a')]+_0x1b7491[_0xacee('0x182')]+_0x1b7491[_0xacee('0x183')]>=_0x2b3a4d[_0xacee('0x184')]){_0x2320e1[_0xacee('0x194')](_0x1b7491,_0x5cddb5,_0x38b047,_0x4bcd4d[_0xacee('0xf7')]);}else{_0x2320e1[_0xacee('0x198')](_0x1b7491,_0x5cddb5,_0x38b047,_0x4bcd4d['reason']);}}}});};Dialer[_0xacee('0x19')]['stateGlobal']=function(_0x4366cb,_0x169706,_0x54c94d,_0x3b20db){var _0x21ccb1=new Final(_0x4366cb);_0x21ccb1[_0xacee('0xa9')]=0xf;_0x21ccb1['statedesc']='Global';this['createStateFinal'](_0x21ccb1,_0x169706,_0x54c94d,_0x3b20db);};Dialer['prototype'][_0xacee('0x198')]=function(_0x16075b,_0x58f7aa,_0x30431e,_0x2a8b72){this[_0xacee('0xc8')](_0x16075b)[_0xacee('0xb7')](function(_0x34bf7a){return _0x58f7aa(msgResponse(_0xacee('0x190'),_0xacee('0xd8'),_0x2a8b72));})['catch'](function(_0x56db89){return _0x30431e(msgResponse(_0xacee('0x1a1'),_0xacee('0x12d'),_0xacee('0x1a2')));});};Dialer['prototype'][_0xacee('0x9')]=function(_0x495594){var _0x18e825=this;var _0x294158=_0x495594[_0xacee('0x1a3')]/0x64;var _0xb8340=_0x495594[_0xacee('0x104')]/(_0x495594[_0xacee('0x104')]+_0x495594[_0xacee('0x5e')]);var _0x55c6bf=Math[_0xacee('0x1a4')](_0x495594[_0xacee('0x72')]*(_0x495594[_0xacee('0x1a5')]/0x64));var _0x159b3e=Math[_0xacee('0x1a4')](_0x495594[_0xacee('0x72')]*(_0x495594[_0xacee('0x1a6')]/0x64));var _0x28599f=_0x495594[_0xacee('0x50')]+_0x495594[_0xacee('0xa3')];var _0x90be95=Math[_0xacee('0x1a7')](_0x495594['erlangCalls']*_0x495594[_0xacee('0x91')]*_0x495594[_0xacee('0x6f')]*_0x495594[_0xacee('0x70')]);if(_[_0xacee('0x3d')](_0x495594['startProgressive'])){if(!_[_0xacee('0x3d')](_0x495594[_0xacee('0x78')])){_0x495594[_0xacee('0x78')]=undefined;loggerPredictive[_0xacee('0x98')]('[startMethodPredictive][StartProgressive]',_0xacee('0x1a8'));}if(!_[_0xacee('0x3d')](_0x495594[_0xacee('0x1a9')])){loggerPredictive[_0xacee('0x98')](_0xacee('0x1aa'),_0xacee('0x1ab'));clearInterval(_0x495594[_0xacee('0x1a9')]);_0x495594['handlePredictive']=undefined;}_0x495594['startProgressive']=moment()[_0xacee('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xacee('0x81')](_0x495594[_0xacee('0x3f')],'collection\x20data\x20in\x20progressive\x20at',_0x495594[_0xacee('0x29')]);this[_0xacee('0x141')](_0x495594,0x1);}else if(ifInterval(_0x495594[_0xacee('0x1ac')],_0x495594[_0xacee('0x29')])){this[_0xacee('0x141')](_0x495594,0x1);loggerPredictiveCalls[_0xacee('0x81')](_0xacee('0x1ad'),_0x495594['startProgressive'],_0x495594['name']);_0x495594[_0xacee('0x75')]=0x0;_0x495594[_0xacee('0x105')]=0x0;}else if(_0x294158<_0xb8340&&_0x495594[_0xacee('0x1ae')]===_0xacee('0x1af')){freeVariablesPredictive(_0x495594);loggerPredictive[_0xacee('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xacee('0x1b0'),_0xb8340,_0xacee('0x29'),_0x495594[_0xacee('0x3f')]);}else if(_0x90be95<_0x495594['predictiveIntervalErlangCallsDroppedCalls']&&_0x495594[_0xacee('0x1ae')]==='dropRate'){freeVariablesPredictive(_0x495594);loggerPredictive[_0xacee('0x81')](_0xacee('0x1b1'),_0xacee('0x1b2'),_0x90be95,'Drop\x20in\x20this\x20interval',_0x495594['predictiveIntervalErlangCallsDroppedCalls'],_0xacee('0x29'),_0x495594[_0xacee('0x3f')]);}else if(!ifInterval(_0x495594['dialPredictiveInterval'],_0x495594[_0xacee('0x29')])&&_['isUndefined'](_0x495594[_0xacee('0x78')])&&!_[_0xacee('0x3d')](_0x495594[_0xacee('0x29')])){_0x495594['startPredictive']=moment()['format'](_0xacee('0xfb'));loggerPredictive[_0xacee('0x81')](_0x495594['name'],'started\x20in\x20predictive\x20at',_0x495594['startPredictive']);this['averageHandleTime'](_0x495594[_0xacee('0x1ac')])[_0xacee('0xb7')](this['getDataPredictive'](_0x495594))[_0xacee('0xb7')](mergeDataErlangB(_0x495594))[_0xacee('0xb7')](this[_0xacee('0x1b3')](_0x495594))[_0xacee('0xb1')](loggerCatchPredictive(_0xacee('0x1b4'),_0x495594));}else if(!ifInterval(_0x495594[_0xacee('0x1ac')],_0x495594[_0xacee('0x78')])){_0x495594['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x495594['startPredictive']=moment()[_0xacee('0x7e')](_0xacee('0xfb'));loggerPredictive['info'](_0x495594[_0xacee('0x3f')],_0xacee('0x1b5'),_0x495594['startPredictive']);clearInterval(_0x495594['handlePredictive']);_0x495594['handlePredictive']=undefined;this['averageHandleTime'](_0x495594[_0xacee('0x1ac')])['then'](this['getDataPredictive'](_0x495594))[_0xacee('0xb7')](mergeDataErlangB(_0x495594))[_0xacee('0xb7')](this[_0xacee('0x1b3')](_0x495594))[_0xacee('0xb1')](loggerCatchPredictive(_0xacee('0x1b6'),_0x495594));}else if(_0x495594['predictiveIntervalAvailable']&&_0x28599f<_0x495594[_0xacee('0x72')]-_0x159b3e){freeVariablesPredictive(_0x495594);loggerPredictive[_0xacee('0x81')](_0x495594['name'],_0xacee('0x1b7'),_0x28599f,')\x20are\x20less\x20than\x20threshold\x20(',_0x495594['predictiveIntervalAvailable'],'-',_0x159b3e,'=',_0x495594[_0xacee('0x72')]-_0x159b3e,')');}else if(_0x495594[_0xacee('0x72')]&&_0x28599f>_0x495594[_0xacee('0x72')]+_0x55c6bf){freeVariablesPredictive(_0x495594);loggerPredictive[_0xacee('0x81')](_0x495594[_0xacee('0x3f')],_0xacee('0x1b7'),_0x28599f,_0xacee('0x1b8'),_0x495594['predictiveIntervalAvailable'],'+',_0x55c6bf,'=',_0x495594[_0xacee('0x72')]+_0x55c6bf,')');}};Dialer[_0xacee('0x19')][_0xacee('0x1b9')]=function(_0x2032d2){var _0x273029=this;return function(_0x15e799){return new BPromise(function(_0x3db22d,_0x5077e9){_['merge'](_0x2032d2,_0x15e799[0x0]);if(checkGetDataPredictive(_0x15e799[0x0])){var _0x112a07=_0x2032d2['predictiveIntervalAvailable']=_0x2032d2[_0xacee('0xa3')]+_0x2032d2['available'];var _0x83cd66=_0x2032d2[_0xacee('0x1ac')]*0x3c;var _0x2eff38=_0x15e799[0x0][_0xacee('0x6b')]+_0x15e799[0x0]['predictiveIntervalAvgHoldtime'];var _0xa3cbb9=(_0x15e799[0x0]['predictiveIntervalAnsweredCalls']+_0x15e799[0x0][_0xacee('0x6d')]+_0x15e799[0x0][_0xacee('0x6c')])/_0x15e799[0x0][_0xacee('0x73')];_0x2032d2[_0xacee('0x6f')]=_0xa3cbb9>0x0?_0xa3cbb9:0x1;switch(_0x2032d2['dialPredictiveOptimization']){case _0xacee('0x1af'):var _0x5d820d=_0x2032d2[_0xacee('0x1a3')]/0x64;return _0x273029['abandonmentRate'](_0x112a07,_0x83cd66,_0x2eff38,_0xa3cbb9,_0x5d820d)[_0xacee('0xb7')](function(_0x25b45f){return _0x3db22d(_0x25b45f);});case'agentBusyFactor':var _0xe3b294=_0x2032d2['dialPredictiveOptimizationPercentage']/0x64;return _0x273029[_0xacee('0x1ba')](_0x112a07,_0x83cd66,_0x2eff38,_0xa3cbb9,_0xe3b294)['then'](function(_0x5093dd){return _0x3db22d(_0x5093dd);});default:return _0x5077e9(msgResponse(_0xacee('0x1bb'),'Failure','Unknown\x20Predictive'));}}else{return _0x5077e9(msgResponse(_0xacee('0x1bb'),'Failure','check\x20failure'));}});};};Dialer[_0xacee('0x19')][_0xacee('0x1bc')]=function(_0x532b79){var _0x511a95=this;return function(_0x586340){return new BPromise(function(_0x486044,_0x3bcd25){_[_0xacee('0x92')](_0x532b79,_0x586340[0x0]);if(checkGetDataPredictive(_0x586340[0x0])){loggerPredictive[_0xacee('0x81')](JSON[_0xacee('0x48')](_0x586340[0x0]));if(_0x532b79['dialPredictiveOptimization']===_0xacee('0x1af')){return _0x511a95[_0xacee('0xc7')](_0x532b79['id'])[_0xacee('0xb7')](function(_0x379d7f){var _0xc9ac2d=_0x532b79[_0xacee('0x51')]-_0x379d7f[0x0][_0xacee('0x1bd')];var _0x36f543=_0x532b79[_0xacee('0x1ac')]*0x3c;var _0x1f702e=_0x586340[0x0][_0xacee('0x6b')]+_0x586340[0x0][_0xacee('0x6a')];var _0x3130f3=(_0x586340[0x0][_0xacee('0x69')]+_0x586340[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x586340[0x0][_0xacee('0x6c')])/_0x586340[0x0][_0xacee('0x73')];var _0x352e90=_0x532b79['dialPredictiveOptimizationPercentage']/0x64;_0x532b79[_0xacee('0x71')]=_0x379d7f[0x0][_0xacee('0x1bd')]||0x0;_0x532b79[_0xacee('0x6f')]=_0x3130f3>0x0?_0x3130f3:0x1;return _0x511a95[_0xacee('0x1be')](_0xc9ac2d,_0x36f543,_0x1f702e,_0x3130f3,_0x352e90);})[_0xacee('0xb7')](function(_0x4ffc94){return _0x486044(_0x4ffc94);})[_0xacee('0xb1')](function(_0x2942f7){return _0x3bcd25(msgResponse(_0xacee('0x1bf'),'Failure',JSON[_0xacee('0x48')](_0x2942f7)));});}if(_0x532b79[_0xacee('0x1ae')]===_0xacee('0x1c0')){return _0x511a95[_0xacee('0xc7')](_0x532b79['id'])[_0xacee('0xb7')](function(_0x397573){var _0x579569=_0x532b79['loggedIn']-_0x397573[0x0][_0xacee('0x1bd')];var _0x3265a3=_0x532b79[_0xacee('0x1ac')]*0x3c;var _0x32fd85=_0x586340[0x0]['predictiveIntervalAvgTalktime']+_0x586340[0x0][_0xacee('0x6a')];var _0x243fe9=(_0x586340[0x0]['predictiveIntervalAnsweredCalls']+_0x586340[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x586340[0x0][_0xacee('0x6c')])/_0x586340[0x0]['predictiveIntervalTotalCalls'];var _0x1a6acb=_0x532b79[_0xacee('0x1a3')]/0x64;_0x532b79[_0xacee('0x71')]=_0x397573[0x0][_0xacee('0x1bd')]||0x0;_0x532b79['predictiveIntervalHitRate']=_0x243fe9>0x0?_0x243fe9:0x1;return _0x511a95[_0xacee('0x1ba')](_0x579569,_0x3265a3,_0x32fd85,_0x243fe9,_0x1a6acb);})[_0xacee('0xb7')](function(_0x2e9b79){return _0x486044(_0x2e9b79);})[_0xacee('0xb1')](function(_0x32cb26){return _0x3bcd25(msgResponse(_0xacee('0x1bf'),_0xacee('0x12d'),JSON[_0xacee('0x48')](_0x32cb26)));});}}else{return _0x3bcd25(msgResponse(_0xacee('0x1bb'),_0xacee('0x12d'),_0xacee('0x1c1')));}});};};Dialer['prototype'][_0xacee('0x1b3')]=function(_0x6d1750){var _0x5357c2=this;return function(){var _0x3c3023=0x0;var _0x38f5bd=Math[_0xacee('0x1a7')](_0x6d1750[_0xacee('0x76')]*0x3e8);if(_0x38f5bd>0x0){_0x38f5bd=_0x38f5bd<0x64?0x64:_0x38f5bd;loggerPredictive[_0xacee('0x81')](_0x6d1750[_0xacee('0x3f')],'one\x20call\x20every:',_0x38f5bd,_0xacee('0x49'));_0x6d1750[_0xacee('0x1a9')]=setInterval(function(){_0x5357c2[_0xacee('0x1a9')](_0x6d1750);loggerPredictiveCalls[_0xacee('0x81')]('[handlePredictive]',_0x3c3023+=0x1);},_0x38f5bd);}else{loggerPredictive[_0xacee('0x81')](_0x6d1750[_0xacee('0x3f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xacee('0x19')][_0xacee('0x1c2')]=function(_0x4b42ee,_0x1b47e7){var _0x562eaa=this;return function(_0x77c46){if(_[_0xacee('0x80')](_0x77c46)){if(_[_0xacee('0xaf')](_0x1b47e7[_0xacee('0xd3')])||!_0x1b47e7['recallme']){if(_0x4b42ee[_0xacee('0x140')]==='booked'){_0x4b42ee['queueStatusComplete']=_['isUndefined'](_0x4b42ee[_0xacee('0x111')])?!![]:_0x4b42ee[_0xacee('0x111')];var _0x13ffb3=uuid['v4']();_0x562eaa[_0xacee('0x25')][_0x13ffb3]=new Action(_0x4b42ee,_0x1b47e7,_0x13ffb3);loggerBooked['info'](_0xacee('0x1c3'),_0x13ffb3,_0xacee('0x1c4'),JSON[_0xacee('0x48')](_0x4b42ee['queueStatusComplete']),_0xacee('0x1c5'),_0x4b42ee['name']);if(_0x4b42ee['queueStatusComplete']){_0x4b42ee[_0xacee('0x111')]=![];_0x562eaa[_0xacee('0x2b')][_0x562eaa[_0xacee('0x25')][_0x13ffb3][_0xacee('0xb5')]]=[];ami['Action']({'actionid':_0x13ffb3,'action':_0xacee('0x1c6'),'queue':_0x4b42ee[_0xacee('0x3f')]})[_0xacee('0xb1')](function(_0x41084c){_0x562eaa['updateOriginated'](_0x4b42ee);_0x562eaa[_0xacee('0xc0')]({'active':![],'ContactId':_0x562eaa[_0xacee('0x25')][_0x13ffb3][_0xacee('0x117')],'ListId':_0x562eaa['actions'][_0x13ffb3]['ListId'],'VoiceQueueId':_0x562eaa[_0xacee('0x25')][_0x13ffb3][_0xacee('0xd4')]||undefined,'CampaignId':_0x562eaa[_0xacee('0x25')][_0x13ffb3][_0xacee('0xd5')]||undefined})['catch'](loggerCatch(_0xacee('0x1c7')));delete _0x562eaa['actions'][_0x13ffb3];});}else{loggerBooked[_0xacee('0x81')]('[booked][checkContactBlack][else]',JSON[_0xacee('0x48')](_0x4b42ee[_0xacee('0x111')]),_0xacee('0x1c5'),_0x4b42ee[_0xacee('0x3f')]);_0x562eaa[_0xacee('0xb3')](_0x4b42ee);_0x562eaa['rescheduleContact']({'active':![],'ContactId':_0x562eaa[_0xacee('0x25')][_0x13ffb3][_0xacee('0x117')],'ListId':_0x562eaa[_0xacee('0x25')][_0x13ffb3]['ListId'],'VoiceQueueId':_0x562eaa[_0xacee('0x25')][_0x13ffb3][_0xacee('0xd4')]||undefined,'CampaignId':_0x562eaa[_0xacee('0x25')][_0x13ffb3]['CampaignId']||undefined})['catch'](loggerCatch(_0xacee('0x1c7')));delete _0x562eaa['actions'][_0x13ffb3];}}else{return _0x562eaa[_0xacee('0x152')](_0x4b42ee,_0x1b47e7);}}else{if(getDiff(_0x1b47e7[_0xacee('0x1c8')])<_0x4b42ee[_0xacee('0x1c9')]*0x3c){if(_0x1b47e7[_0xacee('0x1ca')]&&!_0x1b47e7[_0xacee('0x1ca')]['voicePause']){_0x562eaa[_0xacee('0x1e')][_0xacee('0x114')](_0x1b47e7['id'])[_0xacee('0x1c')](function(){_0x562eaa[_0xacee('0xb3')](_0x4b42ee);});}else{_0x562eaa['unlockContact']({'active':![]},_0x1b47e7['id'],0x1)['finally'](function(){console[_0xacee('0x1cb')](_0xacee('0x1cc'));_0x562eaa[_0xacee('0xb3')](_0x4b42ee);});}}else{_0x4b42ee[_0xacee('0x66')]+=0x1;_0x562eaa[_0xacee('0xb3')](_0x4b42ee);if(_0x4b42ee[_0xacee('0x1cd')]){_0x562eaa[_0xacee('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b47e7[_0xacee('0x117')],'ListId':_0x1b47e7[_0xacee('0xd2')],'VoiceQueueId':_0x1b47e7[_0xacee('0xd4')]||undefined,'CampaignId':_0x1b47e7[_0xacee('0xd5')]||undefined})[_0xacee('0xb1')](loggerCatch(_0xacee('0x1ce')));_0x562eaa['createHistory'](createObjHistory(_0x4b42ee,_0x1b47e7,_0xacee('0x1cf'),0x17,_0xacee('0x1d0')))[_0xacee('0xb1')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x562eaa[_0xacee('0xe7')](createObjHistory(_0x4b42ee,_0x1b47e7,_0xacee('0x1d1'),0x16,_0xacee('0x1d2')),_0xacee('0x1d3'),_0xacee('0x1d4'));}}}}else{_0x4b42ee[_0xacee('0x5f')]+=0x1;_0x562eaa['saveInDb'](createObjHistory(_0x4b42ee,_0x1b47e7,_0xacee('0x1d5'),0xd,_0xacee('0x1d6')),_0xacee('0x1d7'),_0xacee('0x1d8'));throw _0xacee('0x1d9');}};};Dialer[_0xacee('0x19')][_0xacee('0x146')]=function(_0xfddce0){var _0x2dd523=this;var _0x367603=[];var _0x1324db=_0xfddce0[_0xacee('0x1da')]-_0xfddce0[_0xacee('0x74')]-_0xfddce0[_0xacee('0x1db')];emitCampaignSummary(_0xfddce0);if(_0x1324db>0x0){if(_0x1324db>this[_0xacee('0x23')]){_0x1324db=this['maxNumberOriginate'];}_0xfddce0[_0xacee('0x1db')]+=_0x1324db;this[_0xacee('0xc5')](_0xfddce0['id'],_0x1324db,_0xfddce0[_0xacee('0x1dc')])['then'](function(_0x4c1211){_0xfddce0[_0xacee('0x1db')]-=_0x1324db;_0xfddce0[_0xacee('0x1db')]=_0xfddce0['temp']>0x0?_0xfddce0['temp']:0x0;if(!checkContactEmpty(_0x4c1211)){_0xfddce0[_0xacee('0x3e')]=_0xacee('0xa0');logger['info'](_0xacee('0x1dd')+_0xfddce0[_0xacee('0x3f')]);}else{_0xfddce0[_0xacee('0x74')]+=_0x4c1211['length'];_0xfddce0[_0xacee('0x3e')]='RUNNING';for(var _0x1c632e=0x0;_0x1c632e<_0x4c1211['length'];_0x1c632e+=0x1){_0xfddce0['ivrTotalCallsDays']+=0x1;if(_[_0xacee('0xaf')](_0x4c1211[_0x1c632e])||_['isNil'](_0x4c1211[_0x1c632e][_0xacee('0x154')])||_[_0xacee('0xaf')](_0x4c1211[_0x1c632e]['Contact'][_0xacee('0x155')])){_0x2dd523[_0xacee('0xcf')](_0xacee('0x1de'),_0xfddce0,_0x4c1211[_0x1c632e]);}else{_0x2dd523[_0xacee('0xbc')](_['pick'](_0x4c1211[_0x1c632e],[_0xacee('0xd5'),_0xacee('0x1df')]))[_0xacee('0xb7')](_0x2dd523['checkContactBlack'](_0xfddce0,_0x4c1211[_0x1c632e]))['catch'](_0x2dd523[_0xacee('0xce')]('[actionOriginateIvr]\x20',_0xfddce0));}}}})[_0xacee('0xb1')](loggerGetContactDialer('[getContactCampaign2]',_0xfddce0,_0x1324db));}};Dialer['prototype']['handlePower']=function(_0x1bb97e,_0x5854cd){var _0x543a13=this;var _0x27d98a=[];var _0x2638e9=_0x5854cd>=0x1?_0x5854cd:0x1;var _0x2b99f3=[];if(_0x1bb97e['dialMethod']===_0xacee('0x8')){_0x2638e9=0x1;}var _0x4b8133=Math[_0xacee('0x1a7')](_0x1bb97e[_0xacee('0x50')]*_0x2638e9)-_0x1bb97e[_0xacee('0x74')]-_0x1bb97e[_0xacee('0x1db')];emitVoiceQueueSummary(_0x1bb97e);if(_0x1bb97e['dialLimitQueue']>0x0){var _0x396f00=_0x1bb97e[_0xacee('0x1e0')]-_0x1bb97e[_0xacee('0x74')]-_0x1bb97e['talking']-_0x1bb97e[_0xacee('0x1db')]-_0x1bb97e[_0xacee('0x52')];if(_0x4b8133>_0x396f00){_0x4b8133=_0x396f00;}}if(_0x4b8133>0x0){if(_0x1bb97e['dialMethod']===_0xacee('0x8')){_0x4b8133=0x1;}if(_0x4b8133>this[_0xacee('0x23')]){_0x4b8133=this[_0xacee('0x23')];}_0x1bb97e[_0xacee('0x1db')]+=_0x4b8133;for(var _0x5e5552 in this[_0xacee('0x21')]){if(this[_0xacee('0x21')][_0xacee('0xcc')](_0x5e5552)){if(this['agents'][_0x5e5552][_0xacee('0xa9')]===_0xacee('0x1e1')&&this[_0xacee('0x21')][_0x5e5552][_0xacee('0xdc')]===_0xacee('0xda')){_0x27d98a['push'](this[_0xacee('0x21')][_0x5e5552]['id']);}}}this[_0xacee('0xc4')](_0x1bb97e['id'],_0x27d98a,_0x4b8133,_0x1bb97e[_0xacee('0x1dc')])[_0xacee('0xb7')](function(_0x538805){_0x1bb97e[_0xacee('0x1db')]-=_0x4b8133;_0x1bb97e[_0xacee('0x1db')]=_0x1bb97e[_0xacee('0x1db')]>0x0?_0x1bb97e[_0xacee('0x1db')]:0x0;if(!checkContactEmpty(_0x538805)){_0x543a13[_0xacee('0xb6')](_0x1bb97e)[_0xacee('0xb7')](sendMessageReschedule(_0x1bb97e))[_0xacee('0xb1')](loggerCatch('[countReScheduled]\x20'));}else{_0x1bb97e[_0xacee('0x74')]+=_0x538805[_0xacee('0x9b')];_0x1bb97e['message']=_0x1bb97e[_0xacee('0x140')]===_0xacee('0x8')?_0xacee('0x1e2'):_0xacee('0x1e3');for(var _0xbe9a6f=0x0;_0xbe9a6f<_0x538805[_0xacee('0x9b')];_0xbe9a6f+=0x1){if(_[_0xacee('0xaf')](_0x538805[_0xbe9a6f])||_[_0xacee('0xaf')](_0x538805[_0xbe9a6f][_0xacee('0x154')])||_[_0xacee('0xaf')](_0x538805[_0xbe9a6f][_0xacee('0x154')]['phone'])){_0x543a13['emptyContact']('[actionOriginate]\x20',_0x1bb97e,_0x538805[_0xbe9a6f]);}else{_0x543a13['checkIsBlackList'](_[_0xacee('0xd1')](_0x538805[_0xbe9a6f],[_0xacee('0xd4'),_0xacee('0x1df')]))[_0xacee('0xb7')](_0x543a13['checkContactBlack'](_0x1bb97e,_0x538805[_0xbe9a6f]))[_0xacee('0xb1')](_0x543a13[_0xacee('0xce')](_0xacee('0x1de'),_0x1bb97e));}}}})[_0xacee('0xb1')](loggerGetContactDialer(_0xacee('0x1e4'),_0x1bb97e,_0x4b8133));}};Dialer['prototype'][_0xacee('0x1a9')]=function(_0x584087){var _0x5d7c35=this;if(_0x584087[_0xacee('0x1e0')]>0x0){var _0x52d38c=_0x584087[_0xacee('0x1e0')]-_0x584087[_0xacee('0x74')]-_0x584087[_0xacee('0xa3')];if(_0x52d38c>0x0){this[_0xacee('0x1e5')](_0x584087);}else{loggerPredictiveCalls[_0xacee('0x81')](_0xacee('0x1e6'));}}else{this[_0xacee('0x1e5')](_0x584087);}};Dialer[_0xacee('0x19')][_0xacee('0x1e5')]=function(_0x4ae9d0){var _0x2fa7ad=this;var _0x18bc3f=[];_0x4ae9d0['originated']+=0x1;for(var _0x1ba4c1 in this['agents']){if(this[_0xacee('0x21')][_0xacee('0xcc')](_0x1ba4c1)){if(this[_0xacee('0x21')][_0x1ba4c1][_0xacee('0xa9')]===_0xacee('0x1e1')&&this[_0xacee('0x21')][_0x1ba4c1][_0xacee('0xdc')]===_0xacee('0xda')){_0x18bc3f[_0xacee('0x110')](this[_0xacee('0x21')][_0x1ba4c1]['id']);}}}this[_0xacee('0xc4')](_0x4ae9d0['id'],_0x18bc3f,0x1,_0x4ae9d0[_0xacee('0x1dc')])[_0xacee('0xb7')](function(_0x5603d3){if(!checkContactEmpty(_0x5603d3)){checkContactLowerLimitOriginate(_0x4ae9d0,0x1,0x0);_0x2fa7ad[_0xacee('0xb6')](_0x4ae9d0)[_0xacee('0xb7')](sendMessageReschedule(_0x4ae9d0))[_0xacee('0xb1')](loggerCatch(_0xacee('0xb8')));}else{_0x4ae9d0[_0xacee('0x3e')]='RUNNING';if(_['isNil'](_0x5603d3[0x0])||_[_0xacee('0xaf')](_0x5603d3[0x0][_0xacee('0x154')])||_[_0xacee('0xaf')](_0x5603d3[0x0][_0xacee('0x154')][_0xacee('0x155')])){_0x2fa7ad[_0xacee('0xcf')]('[actionOriginate]\x20',_0x4ae9d0,_0x5603d3[0x0]);}else{_0x2fa7ad['checkIsBlackList'](_[_0xacee('0xd1')](_0x5603d3[0x0],[_0xacee('0xd4'),'Contact.phone']))['then'](_0x2fa7ad[_0xacee('0x1c2')](_0x4ae9d0,_0x5603d3[0x0]))[_0xacee('0xb1')](_0x2fa7ad[_0xacee('0xce')]('[actionOriginatePredictive]\x20',_0x4ae9d0));}}})[_0xacee('0xb1')](loggerGetContactDialer(_0xacee('0x1e7'),_0x4ae9d0,0x1));emitVoiceQueueSummary(_0x4ae9d0);};Dialer['prototype']['abandonmentRate']=function(_0x2ad1f5,_0x26d1e2,_0x31b334,_0x2cf17d,_0x487e7f,_0x597213){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xacee('0x81')](_0xacee('0x1e8'),_0x2ad1f5);loggerPredictive[_0xacee('0x81')](_0xacee('0x1e9'),_0x26d1e2);loggerPredictive[_0xacee('0x81')](_0xacee('0x1ea'),_0x31b334);loggerPredictive[_0xacee('0x81')](_0xacee('0x1eb'),_0x2cf17d);loggerPredictive[_0xacee('0x81')](_0xacee('0x1ec'),_0x487e7f);loggerPredictive[_0xacee('0x81')]('---------------------------');return new BPromise(function(_0x3a56da,_0x347c45){if(_0x2ad1f5<=0x0||isNaN(_0x2ad1f5)){return _0x347c45(msgResponse(_0xacee('0x1ed'),_0xacee('0x47'),'m\x20=\x20'+_0x2ad1f5));}if(_0x31b334<=0x0||isNaN(_0x31b334)){return _0x347c45(msgResponse(_0xacee('0x1ed'),_0xacee('0x47'),_0xacee('0x1ee')+_0x31b334));}if(_0x2cf17d<=0x0||isNaN(_0x2cf17d)){return _0x347c45(msgResponse(_0xacee('0x1ed'),_0xacee('0x47'),_0xacee('0x1ef')+_0x2cf17d));}if(_0x26d1e2<=0x0||isNaN(_0x26d1e2)){return _0x347c45(msgResponse(_0xacee('0x1ed'),'Error',_0xacee('0x1f0')+_0x26d1e2));}if(_0x487e7f<=0x0||isNaN(_0x487e7f)){return _0x347c45(msgResponse('[abandonmentRate]','Error',_0xacee('0x1f1')+_0x487e7f));}_0x597213=_0x597213||0x0;var _0x37fe60=0x1/_0x31b334;var _0x3101a7=0x0;var _0x25304d=0x0;var _0xcafc3a=0x0;var _0x29ff05=0x0;for(var _0x3ce593=0x0;_0xcafc3a<_0x487e7f;_0x3ce593+=0x1){_0x25304d=_0x3ce593/_0x26d1e2;_0x3101a7=(_0x2cf17d*_0x25304d+_0x597213)/_0x37fe60;_0xcafc3a=erlangb(_0x3101a7,_0x2ad1f5);_0x29ff05=_0x3101a7/_0x2ad1f5*(0x1-erlangb(_0x3101a7,_0x2ad1f5));}return _0x3a56da({'erlangCalls':_0x3ce593,'erlangCallToSecond':_0x26d1e2/_0x3ce593,'erlangAbandonmentRate':_0xcafc3a,'erlangBusyFactor':_0x29ff05});});};Dialer[_0xacee('0x19')][_0xacee('0x1ba')]=function(_0xebf7a8,_0x1789b9,_0x1329dd,_0x35fefc,_0x20f232,_0x40f41f){loggerPredictive[_0xacee('0x81')](_0xacee('0x1f2'));loggerPredictive[_0xacee('0x81')]('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',_0xebf7a8);loggerPredictive[_0xacee('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1789b9);loggerPredictive[_0xacee('0x81')]('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',_0x1329dd);loggerPredictive[_0xacee('0x81')](_0xacee('0x1eb'),_0x35fefc);loggerPredictive[_0xacee('0x81')](_0xacee('0x1f3'),_0x20f232);loggerPredictive[_0xacee('0x81')](_0xacee('0x89'));return new BPromise(function(_0x1e1f46,_0x3cd582){if(_0xebf7a8<=0x0||isNaN(_0xebf7a8)){return _0x3cd582(msgResponse(_0xacee('0x1f4'),_0xacee('0x47'),_0xacee('0x1f5')+_0xebf7a8));}if(_0x1329dd<=0x0||isNaN(_0x1329dd)){return _0x3cd582(msgResponse(_0xacee('0x1f4'),_0xacee('0x47'),_0xacee('0x1ee')+_0x1329dd));}if(_0x35fefc<=0x0||isNaN(_0x35fefc)){return _0x3cd582(msgResponse(_0xacee('0x1f4'),_0xacee('0x47'),'p\x20=\x20'+_0x35fefc));}if(_0x1789b9<=0x0||isNaN(_0x1789b9)){return _0x3cd582(msgResponse('[busyFactor]',_0xacee('0x47'),_0xacee('0x1f0')+_0x1789b9));}if(_0x20f232<=0x0||isNaN(_0x20f232)){return _0x3cd582(msgResponse('[busyFactor]',_0xacee('0x47'),_0xacee('0x1f6')+_0x20f232));}_0x40f41f=_0x40f41f||0x0;var _0x4bf1b9=0x1/_0x1329dd;var _0x49d920=0x0;var _0x37958f=0x0;var _0x430191=0x0;var _0xe92768=0x0;for(var _0x34e6b7=0x0;_0xe92768<_0x20f232;_0x34e6b7+=0x1){_0x37958f=_0x34e6b7/_0x1789b9;_0x49d920=(_0x35fefc*_0x37958f+_0x40f41f)/_0x4bf1b9;_0x430191=erlangb(_0x49d920,_0xebf7a8);_0xe92768=_0x49d920/_0xebf7a8*(0x1-erlangb(_0x49d920,_0xebf7a8));}return _0x1e1f46({'erlangCalls':_0x34e6b7,'erlangCallToSecond':_0x1789b9/_0x34e6b7,'erlangAbandonmentRate':_0x430191,'erlangBusyFactor':_0xe92768});});};module['exports']=Dialer; \ No newline at end of file +var _0xbc02=['saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','statedesc','Machine','amd','[syncMachine][createHistory]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncMachineIvr][createHistory]','[syncMachineIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','syncQueueCallerAbandon','droptime','responsetime','Drop','dropreason','TIMEOUT','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','actionid','locked','paused','stateinterface','rrmemory','queueBooked','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','idHopper','VoiceQueueId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','ListId','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','push','command','interval','indexOf','true','iftime\x20%s,%s','content','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','dialOriginateTimeout','OriginateError','starttime','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','countcongestionretry','countnoanswerretry','add','minutes','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','[syncAgentComplete][createHistory][0]','checkRetriveMax','dialGlobalMaxRetry','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','[syncAgentComplete][createHistory][5]','stateGlobal','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\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]','Umin\x20=\x20','util','lodash','bluebird','moment','md5','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','roundrobin','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','syncAgentComplete','custom:queuesummary','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','state','endtime','prototype','clearZombieChannels','uniqueId','[uniqueid]','actions','hasOwnProperty','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','merge','pick','ContactId','UserId','CampaignId','[emptyContact]','isSuccess','SIP/%s','reachable'];(function(_0x11cabc,_0x28feb1){var _0x2c46b0=function(_0x3205e8){while(--_0x3205e8){_0x11cabc['push'](_0x11cabc['shift']());}};_0x2c46b0(++_0x28feb1);}(_0xbc02,0x11f));var _0x2bc0=function(_0x159c68,_0xc544c9){_0x159c68=_0x159c68-0x0;var _0x32792f=_0xbc02[_0x159c68];return _0x32792f;};'use strict';var util=require(_0x2bc0('0x0'));var _=require(_0x2bc0('0x1'));var BPromise=require(_0x2bc0('0x2'));var uuid=require('uuid');var moment=require(_0x2bc0('0x3'));var rr=require('rr');var md5=require(_0x2bc0('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment/');var logger=require(_0x2bc0('0x5'))('dialer');var loggerBooked=require(_0x2bc0('0x5'))(_0x2bc0('0x6'));var loggerPredictive=require(_0x2bc0('0x5'))(_0x2bc0('0x7'));var loggerPredictiveCalls=require(_0x2bc0('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x2bc0('0x5'))(_0x2bc0('0x8'));var ami=require(_0x2bc0('0x9'));config[_0x2bc0('0xa')]=_[_0x2bc0('0xb')](config[_0x2bc0('0xa')],{'host':_0x2bc0('0xc'),'port':0x18eb});var io=require(_0x2bc0('0xd'))(new Redis(config[_0x2bc0('0xa')]));var cmHopper=require(_0x2bc0('0xe'));var cmHopperFinal=require(_0x2bc0('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2bc0('0x10'));var voiceQueueRt=require(_0x2bc0('0x11'));var Action=require(_0x2bc0('0x12'));var History=require(_0x2bc0('0x13'));var Final=require(_0x2bc0('0x14'));var AgentComplete=require(_0x2bc0('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x2bc0('0x16'));var ipAgi=process[_0x2bc0('0x17')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x2bc0('0x18')};var Sequence=function(){};Sequence['prototype'][_0x2bc0('0x19')]=function(_0x4c12fa){this[_0x2bc0('0x1a')]=this['tail']?this[_0x2bc0('0x1a')][_0x2bc0('0x1b')](_0x4c12fa):_0x4c12fa();};function Dialer(_0x13b857,_0x24c475){this[_0x2bc0('0x1c')]=new Sequence();this['preview']=_0x24c475;this[_0x2bc0('0x1d')]=_0x13b857[_0x2bc0('0x1d')];this['campaigns']=_0x13b857[_0x2bc0('0x1e')];this[_0x2bc0('0x1f')]=_0x13b857['agents'];this['trunks']=_0x13b857[_0x2bc0('0x20')];this[_0x2bc0('0x21')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this['contactsId']={};this['uniqueId']={};this[_0x2bc0('0x22')]={};this[_0x2bc0('0x23')]={};this[_0x2bc0('0x24')]={};this[_0x2bc0('0x25')]={};this['queueBooked']={};this[_0x2bc0('0x26')]={};ami['on'](_0x2bc0('0x27'),this['syncAgentConnect'][_0x2bc0('0x28')](this));ami['on'](_0x2bc0('0x29'),this['syncQueueCallerAbandon'][_0x2bc0('0x28')](this));ami['on'](_0x2bc0('0x2a'),this['syncOriginateResponse'][_0x2bc0('0x28')](this));ami['on']('agentcomplete',this[_0x2bc0('0x2b')][_0x2bc0('0x28')](this));ami['on'](_0x2bc0('0x2c'),this[_0x2bc0('0x8')][_0x2bc0('0x28')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('newexten',this[_0x2bc0('0x2d')][_0x2bc0('0x28')](this));ami['on'](_0x2bc0('0x2e'),this[_0x2bc0('0x2f')][_0x2bc0('0x28')](this));ami['on']('queuemember',this[_0x2bc0('0x30')][_0x2bc0('0x28')](this));ami['on'](_0x2bc0('0x31'),this[_0x2bc0('0x32')][_0x2bc0('0x28')](this));this[_0x2bc0('0x33')]();this[_0x2bc0('0x34')]();}function isNotNull(_0x380886){return _0x380886!==null&&!_[_0x2bc0('0x35')](_0x380886);}function checkIsLoggedIn(_0x4fedde,_0x288e68){return function(){if(_0x288e68<=0x0){_0x4fedde[_0x2bc0('0x36')]='AGENTS_NOT_LOGGED';throw _0x4fedde[_0x2bc0('0x37')]+_0x2bc0('0x38');}};}function isActive(_0x59d862){return _0x59d862;}function checkIsActive(_0x552baa,_0x3ce6e0){return function(){if(!isActive(_0x3ce6e0)){_0x552baa[_0x2bc0('0x36')]=_0x2bc0('0x39');throw _0x552baa['name']+_0x2bc0('0x3a');}};}function checkInterval(_0x4a2331){return function(){if(!isNotNull(_0x4a2331[_0x2bc0('0x3b')])){_0x4a2331['message']=_0x2bc0('0x3c');throw _0x4a2331[_0x2bc0('0x37')]+_0x2bc0('0x3d');}if(!isNotNull(_0x4a2331['Interval']['Intervals'])){_0x4a2331['message']=_0x2bc0('0x3c');throw _0x4a2331[_0x2bc0('0x37')]+_0x2bc0('0x3d');}if(!isNotNull(_[_0x2bc0('0x3e')](_0x4a2331[_0x2bc0('0x3b')][_0x2bc0('0x3f')]))){_0x4a2331['message']=_0x2bc0('0x3c');throw _0x4a2331['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0xc3140c,_0x9932d3,_0x103838){return{'action':_0xc3140c,'response':_0x9932d3,'message':_0x103838,'stack':_0x103838};}function myreject(_0x2559db){return function(_0x2eb1a9){return _0x2559db(msgResponse(_0x2bc0('0x40'),'Error',JSON[_0x2bc0('0x41')](_0x2eb1a9)));};}function getSeconds(_0x402905,_0x3a0ad8){var _0x28d183=moment(_0x402905)[_0x2bc0('0x42')](0x0);var _0x1f64c5=moment(_0x3a0ad8)[_0x2bc0('0x42')](0x0);return _0x28d183['diff'](_0x1f64c5,_0x2bc0('0x43'));}function emit(_0x290565,_0xad92fe,_0x4ca021){io['to'](_0x290565)['emit'](_0xad92fe,_0x4ca021);}function emitVoiceQueueSummary(_0x39e67b){if(_0x39e67b[_0x2bc0('0x44')]===_0x2bc0('0x45')){var _0x303c61={'id':_0x39e67b['id'],'name':_0x39e67b[_0x2bc0('0x37')],'strategy':_0x39e67b[_0x2bc0('0x46')],'answered':_0x39e67b[_0x2bc0('0x47')],'available':_0x39e67b[_0x2bc0('0x48')],'loggedIn':_0x39e67b[_0x2bc0('0x49')],'pTalking':_0x39e67b[_0x2bc0('0x4a')],'sumBillable':_0x39e67b[_0x2bc0('0x4b')],'sumDuration':_0x39e67b[_0x2bc0('0x4c')],'sumHoldTime':_0x39e67b[_0x2bc0('0x4d')]||0x0,'talking':_0x39e67b[_0x2bc0('0x4e')],'total':_0x39e67b[_0x2bc0('0x4f')],'type':_0x39e67b[_0x2bc0('0x44')],'unmanaged':_0x39e67b[_0x2bc0('0x50')],'abandoned':_0x39e67b[_0x2bc0('0x51')],'waiting':_0x39e67b[_0x2bc0('0x52')],'loggedInDb':_0x39e67b[_0x2bc0('0x53')],'dialActive':_0x39e67b['dialActive'],'dialMethod':_0x39e67b[_0x2bc0('0x54')],'dialOriginateCallerIdName':_0x39e67b[_0x2bc0('0x55')],'dialOriginateCallerIdNumber':_0x39e67b[_0x2bc0('0x56')],'dialOriginateTimeout':_0x39e67b['dialOriginateTimeout'],'dialPrefix':_0x39e67b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x39e67b[_0x2bc0('0x57')],'outboundAnswerCallsDay':_0x39e67b[_0x2bc0('0x58')],'outboundBlacklistCallsDay':_0x39e67b[_0x2bc0('0x59')],'outboundBusyCallsDay':_0x39e67b['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x39e67b[_0x2bc0('0x5a')],'outboundDropCallsDayACS':_0x39e67b['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x39e67b['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x39e67b[_0x2bc0('0x5b')],'outboundNoAnswerCallsDay':_0x39e67b[_0x2bc0('0x5c')],'outboundNoSuchCallsDay':_0x39e67b['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x39e67b[_0x2bc0('0x5d')],'outboundReCallsDay':_0x39e67b[_0x2bc0('0x5e')],'outboundRejectCallsDay':_0x39e67b[_0x2bc0('0x5f')],'outboundUnknownCallsDay':_0x39e67b[_0x2bc0('0x60')],'predictiveIntervalAnsweredCalls':_0x39e67b[_0x2bc0('0x61')],'predictiveIntervalAvgHoldtime':_0x39e67b[_0x2bc0('0x62')],'predictiveIntervalAvgTalktime':_0x39e67b[_0x2bc0('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0x39e67b[_0x2bc0('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x39e67b['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x39e67b['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x39e67b[_0x2bc0('0x65')],'predictiveIntervalHitRate':_0x39e67b[_0x2bc0('0x66')],'predictiveIntervalMultiplicativeFactor':_0x39e67b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x39e67b[_0x2bc0('0x67')],'predictiveIntervalAvailable':_0x39e67b[_0x2bc0('0x68')],'predictiveIntervalTotalCalls':_0x39e67b[_0x2bc0('0x69')],'message':_0x39e67b[_0x2bc0('0x36')],'originated':_0x39e67b['originated'],'erlangCalls':_0x39e67b[_0x2bc0('0x6a')],'erlangCallToSecond':_0x39e67b[_0x2bc0('0x6b')],'erlangAbandonmentRate':_0x39e67b[_0x2bc0('0x6c')],'erlangBusyFactor':_0x39e67b['erlangBusyFactor'],'startPredictive':_0x39e67b[_0x2bc0('0x23')],'startProgressive':_0x39e67b[_0x2bc0('0x24')]};if(_0x39e67b[_0x2bc0('0x6d')]){_0x303c61['Trunk']={'id':_0x39e67b[_0x2bc0('0x6d')]['id'],'name':_0x39e67b[_0x2bc0('0x6d')]['name'],'active':_0x39e67b[_0x2bc0('0x6d')][_0x2bc0('0x6e')],'callerid':_0x39e67b['Trunk'][_0x2bc0('0x6f')]};}if(_0x39e67b[_0x2bc0('0x3b')]){_0x303c61[_0x2bc0('0x3b')]={'id':_0x39e67b[_0x2bc0('0x3b')]['id'],'name':_0x39e67b[_0x2bc0('0x3b')]['name']};}var _0x45de9b=md5(JSON[_0x2bc0('0x41')](_0x303c61));if(_0x39e67b['md5']!==_0x45de9b){_0x39e67b['md5']=_0x45de9b;emit(util['format']('voice:queue:%s',_0x303c61['name']),_0x2bc0('0x70'),_0x303c61);}}}function emitCampaignSummary(_0x50e38c){if(_0x50e38c[_0x2bc0('0x44')]===_0x2bc0('0x71')){emit(util[_0x2bc0('0x72')](_0x2bc0('0x73'),_0x50e38c[_0x2bc0('0x37')]),_0x2bc0('0x74'),_0x50e38c);}}function checkGetDataPredictive(_0xaf1534){if(isNotNull(_0xaf1534)){if(!_[_0x2bc0('0x3e')](_0xaf1534)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x76'),_0xaf1534[_0x2bc0('0x69')]);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x77'),_0xaf1534[_0x2bc0('0x61')]);loggerPredictive[_0x2bc0('0x75')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xaf1534[_0x2bc0('0x78')]);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x79'),_0xaf1534[_0x2bc0('0x64')]);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x7a'),_0xaf1534[_0x2bc0('0x62')]);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x7b'),_0xaf1534[_0x2bc0('0x63')]);loggerPredictive['info'](_0x2bc0('0x7c'));if(_0xaf1534[_0x2bc0('0x69')]>0x0){if(!_[_0x2bc0('0x35')](_0xaf1534[_0x2bc0('0x63')])&&_0xaf1534[_0x2bc0('0x63')]>0x0){return!![];}else{loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x7d'));}if(!_[_0x2bc0('0x35')](_0xaf1534['predictiveIntervalAvgHoldtime'])&&_0xaf1534['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x7e'));}}else{loggerPredictive['info'](_0x2bc0('0x7f'));}}else{loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x80'));}}else{loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x80'));}return![];}function mergeDataErlangB(_0x9debd8){return function(_0x1bf4a3){loggerPredictive['info'](_0x2bc0('0x81'));loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x82'),_0x1bf4a3[_0x2bc0('0x6a')]);loggerPredictive['info'](_0x2bc0('0x83'),_0x1bf4a3[_0x2bc0('0x6b')]);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x84'),_0x1bf4a3[_0x2bc0('0x6c')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bf4a3[_0x2bc0('0x85')]);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x84'),_0x1bf4a3['erlangAbandonmentRate']);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x7c'));_['merge'](_0x9debd8,_0x1bf4a3);};}function getDiff(_0x5af308){var _0x48a30b=moment()[_0x2bc0('0x42')](0x0);var _0x5998d9=moment(_0x5af308)[_0x2bc0('0x42')](0x0);return _0x48a30b[_0x2bc0('0x86')](_0x5998d9,_0x2bc0('0x43'));}function ifInterval(_0x1dab2e,_0x3de1c6){if(_[_0x2bc0('0x35')](_0x3de1c6)){return![];}if(getDiff(_0x3de1c6)<_0x1dab2e*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x29171a){if(isNotNull(_0x29171a)){if(!_[_0x2bc0('0x35')](_0x29171a[_0x2bc0('0x24')])){_0x29171a[_0x2bc0('0x24')]=undefined;loggerPredictive[_0x2bc0('0x75')](_0x29171a[_0x2bc0('0x37')],_0x2bc0('0x87'));}if(!_[_0x2bc0('0x35')](_0x29171a['startPredictive'])){_0x29171a[_0x2bc0('0x23')]=undefined;loggerPredictive[_0x2bc0('0x75')](_0x29171a['name'],_0x2bc0('0x88'));}if(!_[_0x2bc0('0x35')](_0x29171a[_0x2bc0('0x89')])){clearInterval(_0x29171a[_0x2bc0('0x89')]);_0x29171a[_0x2bc0('0x89')]=undefined;loggerPredictive[_0x2bc0('0x75')](_0x29171a['name'],_0x2bc0('0x8a'));}}}function erlangb(_0x32eefd,_0x3c1daa){if(_0x3c1daa===0x0){return 0x0;}var _0x5cbb2d=0x1;for(var _0xe7ee6=0x1;_0xe7ee6<=_0x3c1daa;_0xe7ee6+=0x1){_0x5cbb2d=0x1+_0x5cbb2d*_0xe7ee6/_0x32eefd;}return 0x1/_0x5cbb2d;}function isVoiceQueueOutbound(_0x98ffef){return _0x98ffef==='outbound';}function isNotPreview(_0x4d4a71){return _0x4d4a71!==_0x2bc0('0x8b');}function isCampaignIvr(_0xfa4e1e){return _0xfa4e1e===_0x2bc0('0x71');}function getCallerId(_0x26ab6c,_0x3e3280,_0x36fba6){if(!_['isUndefined'](_0x36fba6)&&_0x2bc0('0x8c')===typeof _0x36fba6&&!_[_0x2bc0('0x3e')](_0x36fba6)){if(!_['isUndefined'](_0x3e3280)&&'string'===typeof _0x3e3280&&!_[_0x2bc0('0x3e')](_0x3e3280)){return util[_0x2bc0('0x72')](_0x2bc0('0x8d'),_0x3e3280,_0x36fba6);}return util[_0x2bc0('0x72')](_0x2bc0('0x8d'),_0x36fba6,_0x36fba6);}if(!_[_0x2bc0('0x35')](_0x26ab6c)&&'string'===typeof _0x26ab6c&&!_[_0x2bc0('0x3e')](_0x26ab6c)){return _0x26ab6c;}return _0x2bc0('0x8e');}function loggerCatchQueueSummary(_0x158f40,_0x59d52a){return function(_0xdac407){freeVariablesPredictive(_0x59d52a);emitVoiceQueueSummary(_0x59d52a);emitCampaignSummary(_0x59d52a);loggerSyncQueueSummary['error'](_0x158f40,util[_0x2bc0('0x8f')](_0xdac407,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4ae5af,_0x4f05b1){return function(_0x2b1a9f){loggerPredictive['error'](_0x4f05b1[_0x2bc0('0x37')],_0x4ae5af);loggerPredictive[_0x2bc0('0x90')](_0x2b1a9f[_0x2bc0('0x91')]);freeVariablesPredictive(_0x4f05b1);};}function loggerCatch(_0x2dceca){return function(_0x3bb8cb){logger[_0x2bc0('0x90')](_0x2dceca,util[_0x2bc0('0x8f')](_0x3bb8cb,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1b6c64){return _0x1b6c64&&!_[_0x2bc0('0x35')](_0x1b6c64)&&_0x1b6c64[_0x2bc0('0x92')]>0x0;}function decremetOriginate(_0x3f8198){if(!_[_0x2bc0('0x35')](_0x3f8198)&&_0x3f8198!==null){if(_0x3f8198['hasOwnProperty']('originated')){if(_0x3f8198[_0x2bc0('0x93')]>0x0){_0x3f8198[_0x2bc0('0x93')]-=0x1;}else{logger[_0x2bc0('0x90')](_0x2bc0('0x94'));}}}else{logger['error'](_0x2bc0('0x95'));}}function checkContactLowerLimitOriginate(_0x189314,_0x39d54a,_0xbcd0cd){if(_0x39d54a>_0xbcd0cd){for(var _0x1e7fbd=0x0;_0x1e7fbd<_0x39d54a-_0xbcd0cd;_0x1e7fbd+=0x1){decremetOriginate(_0x189314);}}}function loggerGetContactDialer(_0x8f827d,_0x46f74d,_0x519950){return function(_0x533355){checkContactLowerLimitOriginate(_0x46f74d,_0x519950,0x0);logger[_0x2bc0('0x90')](_0x8f827d,util['inspect'](_0x533355,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4d1e09){return function(_0x5f0e75){if(isNotNull(_0x5f0e75)&&isNotNull(_0x5f0e75[0x0])){if(_0x5f0e75[0x0][_0x2bc0('0x96')]>0x0){_0x4d1e09['message']=_0x2bc0('0x97');logger[_0x2bc0('0x75')]('[getContactDialer2][ReScheduled]'+_0x4d1e09['name'],_0x5f0e75[0x0][_0x2bc0('0x96')],'contacts');}else{_0x4d1e09[_0x2bc0('0x36')]=_0x2bc0('0x98');logger[_0x2bc0('0x75')](_0x2bc0('0x99')+_0x4d1e09[_0x2bc0('0x37')]);}}};}function notSendMessagesQueue(_0x5bdc91){if(_0x5bdc91[_0x2bc0('0x9a')]){freeVariablesPredictive(_0x5bdc91);if(_0x5bdc91['originated']===0x0&&_0x5bdc91[_0x2bc0('0x4e')]===0x0&&_0x5bdc91[_0x2bc0('0x52')]===0x0&&(_0x5bdc91[_0x2bc0('0x4a')]||0x0)===0x0){_0x5bdc91['sendMessageOneNotActive']=![];_0x5bdc91[_0x2bc0('0x48')]=0x0;_0x5bdc91[_0x2bc0('0x36')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x2bc0('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5bdc91[_0x2bc0('0x37')],_0x2bc0('0x9b'));}else{_0x5bdc91[_0x2bc0('0x36')]=_0x2bc0('0x9c');loggerSyncQueueSummary[_0x2bc0('0x90')](_0x2bc0('0x9d'),_0x5bdc91[_0x2bc0('0x37')],'is\x20disactive');}emitVoiceQueueSummary(_0x5bdc91);}}function notSendMessagesCampaign(_0x162f1a){if(_0x162f1a[_0x2bc0('0x9a')]){if(_0x162f1a['originated']===0x0){_0x162f1a['sendMessageOneNotActive']=![];_0x162f1a[_0x2bc0('0x36')]=_0x2bc0('0x39');loggerSyncQueueSummary[_0x2bc0('0x90')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x162f1a[_0x2bc0('0x37')],'is\x20not\x20active');}else{_0x162f1a[_0x2bc0('0x36')]=_0x2bc0('0x9c');loggerSyncQueueSummary[_0x2bc0('0x90')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x162f1a[_0x2bc0('0x37')],'is\x20disactive');}emitCampaignSummary(_0x162f1a);}}function createObjHistory(_0x593193,_0xbc58c7,_0x55a540,_0x4d679c,_0x366093){_0x593193[_0x2bc0('0x36')]=_0x55a540;var _0x4da685=new Action(_0x593193,_0xbc58c7);var _0x3b6e92=new History(_0x4da685);_0x3b6e92[_0x2bc0('0x9e')]=_0x4d679c;_0x3b6e92['statedesc']=_0x366093;_0x3b6e92[_0x2bc0('0x9f')]=_0x4da685['starttime'];return _0x3b6e92;}Dialer[_0x2bc0('0xa0')]['loopClearZombieChannels']=function(){var _0x10daaa=this;setInterval(function(){_0x10daaa[_0x2bc0('0xa1')](_0x10daaa[_0x2bc0('0xa2')],_0x2bc0('0xa3'));_0x10daaa['clearZombieChannels'](_0x10daaa[_0x2bc0('0xa4')],'[actions]');},0x32c8);};Dialer[_0x2bc0('0xa0')]['clearZombieChannels']=function(_0x5b2e39,_0xebb96c){var _0x2e968d=this;for(var _0x23234b in _0x5b2e39){if(_0x5b2e39[_0x2bc0('0xa5')](_0x23234b)){this['sequence']['enqueue'](function(){if(!_[_0x2bc0('0xa6')](_0x5b2e39[_0x23234b])){return ami[_0x2bc0('0xa7')]({'action':_0x2bc0('0xa8'),'channel':_0x5b2e39[_0x23234b][_0x2bc0('0xa9')]})[_0x2bc0('0xaa')](function(_0xe3ab81){if(_0xe3ab81[_0x2bc0('0x36')]===_0x2bc0('0xab')){setTimeout(function(){if(_0x5b2e39[_0x23234b]&&_0x5b2e39[_0x23234b][_0x2bc0('0x44')]!==_0x2bc0('0x71')){_0x2e968d[_0x2bc0('0xac')](_0x2e968d[_0x2bc0('0x1d')][_0x5b2e39[_0x23234b][_0x2bc0('0xad')]]);logger[_0x2bc0('0x90')](_0x2bc0('0xae'),_0xebb96c,_0x23234b,_0x5b2e39[_0x23234b][_0x2bc0('0xad')]);delete _0x5b2e39[_0x23234b];}if(_0x5b2e39[_0x23234b]&&_0x5b2e39[_0x23234b][_0x2bc0('0x44')]===_0x2bc0('0x71')){_0x2e968d[_0x2bc0('0xac')](_0x2e968d[_0x2bc0('0x1e')][_0x5b2e39[_0x23234b][_0x2bc0('0xad')]]);logger[_0x2bc0('0x90')](_0x2bc0('0xaf'),_0xebb96c,_0x23234b,_0x5b2e39[_0x23234b][_0x2bc0('0xad')]);delete _0x5b2e39[_0x23234b];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x39d2da){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopper[_0x2bc0('0xb2')](_0x39d2da))[_0x2bc0('0xaa')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xb3')]=function(_0xd7161b){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopperBlack[_0x2bc0('0xb3')](_0xd7161b))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xb4')));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xb5')]=function(_0x8775f8){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopperBlack[_0x2bc0('0xb5')](_0x8775f8))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xb6')));};Dialer[_0x2bc0('0xa0')]['averageHandleTime']=function(_0x1d462d){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopperHistory[_0x2bc0('0xb7')](_0x1d462d))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xb8')));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xb9')]=function(_0x201b93){return BPromise[_0x2bc0('0xb0')]()['then'](cmHopper[_0x2bc0('0xb9')](_0x201b93))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xba')]=function(_0x2f884a,_0x5b1064,_0x4ec5b6){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopper[_0x2bc0('0xba')](_0x2f884a,_0x5b1064,_0x4ec5b6))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xbb')));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xbc')]=function(_0x260cbe,_0x4c3e81,_0xd307df,_0x218e40){return BPromise[_0x2bc0('0xb0')]()['then'](cmHopper['getContactDialer'](_0x260cbe,_0x4c3e81,_0xd307df,_0x218e40))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xbd')));};Dialer['prototype'][_0x2bc0('0xbe')]=function(_0x3a39cb,_0x3fd8b5,_0x2c90e9){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopper[_0x2bc0('0xbe')](_0x3a39cb,_0x3fd8b5,_0x2c90e9))['catch'](loggerCatch(_0x2bc0('0xbd')));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xbf')]=function(_0x4c24f8){return BPromise['resolve']()[_0x2bc0('0xb1')](voiceQueueRt[_0x2bc0('0xbf')](_0x4c24f8))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xc0')));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xc1')]=function(_0x338fe5){return BPromise['resolve']()[_0x2bc0('0xb1')](cmHopper['moveContactManagedDialer'](_0x338fe5))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xc2')));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xc3')]=function(_0x23fdbb){return BPromise[_0x2bc0('0xb0')]()[_0x2bc0('0xb1')](cmHopperHistory['createHistory'](_0x23fdbb))['catch'](loggerCatch(_0x2bc0('0xc4')));};Dialer['prototype']['updateOriginated']=function(_0xb558ee){if(!_['isUndefined'](_0xb558ee)&&_0xb558ee!==null){if(_0xb558ee[_0x2bc0('0xa5')]('originated')){if(_0xb558ee[_0x2bc0('0x93')]>0x0){_0xb558ee[_0x2bc0('0x93')]-=0x1;}else{logger['error'](_0x2bc0('0xc5'));}}}else{logger[_0x2bc0('0x90')](_0x2bc0('0xc6'));}};Dialer['prototype'][_0x2bc0('0xc7')]=function(_0x15e9bc,_0x1d75c5){var _0x52d5a5=this;return function(_0x17e0b7){_0x52d5a5[_0x2bc0('0xac')](_0x1d75c5);logger['error'](_0x15e9bc,util['inspect'](_0x17e0b7,{'showHidden':![],'depth':null}));};};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xc8')]=function(_0x41dd5b,_0x114b9c,_0x33e8f3){var _0x4c191a={'state':0x19,'statedesc':'notFound'};this[_0x2bc0('0xac')](_0x114b9c);this['saveInDb'](_[_0x2bc0('0xc9')](_0x4c191a,_[_0x2bc0('0xca')](_0x33e8f3,[_0x2bc0('0xcb'),'ListId',_0x2bc0('0xcc'),'VoiceQueueId',_0x2bc0('0xcd')])),'[emptyContact][createHistory]',_0x2bc0('0xce'));logger[_0x2bc0('0x90')](_0x41dd5b);};Dialer['prototype'][_0x2bc0('0xcf')]=function(_0x49e9ad){return _0x49e9ad==='Success';};Dialer[_0x2bc0('0xa0')]['isTrunkReachable']=function(_0x4aa174){return!_[_0x2bc0('0x35')](_0x4aa174)&&_0x4aa174&&!_[_0x2bc0('0x35')](_0x4aa174[_0x2bc0('0x37')])&&!_[_0x2bc0('0x35')](_0x4aa174['active'])&&_0x4aa174['active']&&(this[_0x2bc0('0x20')][util['format'](_0x2bc0('0xd0'),_0x4aa174['name'])][_0x2bc0('0xa8')]===_0x2bc0('0xd1')||this['trunks'][util[_0x2bc0('0x72')]('SIP/%s',_0x4aa174[_0x2bc0('0x37')])][_0x2bc0('0xa8')]==='unmonitored');};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xd2')]=function(_0x4c71dc,_0x5d6a65,_0x42b20a){this['createHistory'](_0x4c71dc)[_0x2bc0('0xaa')](loggerCatch(_0x5d6a65));this[_0x2bc0('0xc1')](_0x4c71dc)['catch'](loggerCatch(_0x42b20a));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x2f')]=function(_0x2a16a3){var _0x2b350f=this[_0x2bc0('0xa2')][_0x2a16a3[_0x2bc0('0xd3')]];var _0x323fbc;if(!_[_0x2bc0('0xa6')](_0x2a16a3)&&!_[_0x2bc0('0xa6')](_0x2a16a3['variable'])&&!_[_0x2bc0('0xa6')](_0x2a16a3[_0x2bc0('0xd4')][_0x2bc0('0xd5')])&&_0x2a16a3[_0x2bc0('0xd6')]===_0x2bc0('0xd7')&&_0x2b350f){if(_0x2b350f[_0x2bc0('0x44')]!=='ivr'&&this[_0x2bc0('0x1d')][_0x2b350f[_0x2bc0('0xad')]][_0x2bc0('0xd8')]&&_0x2a16a3[_0x2bc0('0xd9')]===_0x2bc0('0xda')){delete this['uniqueId'][_0x2a16a3['uniqueid']];this[_0x2bc0('0xac')](this[_0x2bc0('0x1d')][_0x2b350f['queue']]);this[_0x2bc0('0x1d')][_0x2b350f[_0x2bc0('0xad')]][_0x2bc0('0x58')]+=0x1;this[_0x2bc0('0x1d')][_0x2b350f[_0x2bc0('0xad')]][_0x2bc0('0x57')]+=0x1;_0x323fbc=new Hangup(_0x2b350f,_0x2a16a3);_0x323fbc[_0x2bc0('0x9e')]=0x12;_0x323fbc['statedesc']=_0x2bc0('0xdb');_0x323fbc[_0x2bc0('0xdc')]=_0x2bc0('0xdd');this[_0x2bc0('0xd2')](_0x323fbc,_0x2bc0('0xde'),_0x2bc0('0xdf'));}if(_0x2b350f[_0x2bc0('0x44')]!==_0x2bc0('0x71')&&this[_0x2bc0('0x1d')][_0x2b350f[_0x2bc0('0xad')]][_0x2bc0('0xd8')]&&_0x2a16a3[_0x2bc0('0xd9')]==='MACHINE'){delete this[_0x2bc0('0xa2')][_0x2a16a3[_0x2bc0('0xd3')]];this['updateOriginated'](this[_0x2bc0('0x1d')][_0x2b350f[_0x2bc0('0xad')]]);this['voiceQueues'][_0x2b350f['queue']][_0x2bc0('0x58')]+=0x1;this['voiceQueues'][_0x2b350f[_0x2bc0('0xad')]][_0x2bc0('0x57')]+=0x1;_0x323fbc=new Hangup(_0x2b350f,_0x2a16a3);_0x323fbc[_0x2bc0('0x9e')]=0x13;_0x323fbc[_0x2bc0('0xe0')]=_0x2bc0('0xe1');_0x323fbc[_0x2bc0('0xdc')]=_0x2bc0('0xdd');_0x323fbc[_0x2bc0('0xe2')]=!![];this[_0x2bc0('0xd2')](_0x323fbc,_0x2bc0('0xe3'),'[syncMachine]');}if(_0x2b350f['type']==='ivr'&&this[_0x2bc0('0x1e')][_0x2b350f['queue']][_0x2bc0('0xd8')]&&_0x2a16a3[_0x2bc0('0xd9')]==='HANGUP'){delete this[_0x2bc0('0xa2')][_0x2a16a3[_0x2bc0('0xd3')]];this[_0x2bc0('0xac')](this[_0x2bc0('0x1e')][_0x2b350f[_0x2bc0('0xad')]]);_0x323fbc=new Hangup(_0x2b350f,_0x2a16a3);_0x323fbc[_0x2bc0('0x9e')]=0x12;_0x323fbc[_0x2bc0('0xe0')]=_0x2bc0('0xdb');_0x323fbc[_0x2bc0('0xdc')]='AMD';this[_0x2bc0('0xd2')](_0x323fbc,_0x2bc0('0xe4'),_0x2bc0('0xe5'));}if(_0x2b350f[_0x2bc0('0x44')]===_0x2bc0('0x71')&&this[_0x2bc0('0x1e')][_0x2b350f[_0x2bc0('0xad')]][_0x2bc0('0xd8')]&&_0x2a16a3[_0x2bc0('0xd9')]===_0x2bc0('0xe6')){delete this['uniqueId'][_0x2a16a3[_0x2bc0('0xd3')]];this[_0x2bc0('0xac')](this[_0x2bc0('0x1e')][_0x2b350f[_0x2bc0('0xad')]]);_0x323fbc=new Hangup(_0x2b350f,_0x2a16a3);_0x323fbc[_0x2bc0('0x9e')]=0x13;_0x323fbc['statedesc']=_0x2bc0('0xe1');_0x323fbc['membername']=_0x2bc0('0xdd');_0x323fbc[_0x2bc0('0xe2')]=!![];this[_0x2bc0('0xd2')](_0x323fbc,_0x2bc0('0xe7'),_0x2bc0('0xe8'));}}};Dialer[_0x2bc0('0xa0')]['syncHangup']=function(_0x1fc036){var _0xecd71c=this[_0x2bc0('0xa2')][_0x1fc036['uniqueid']];var _0x2f05a0=this;var _0x3371eb;if(_0xecd71c&&_0xecd71c[_0x2bc0('0x44')]==='ivr'){delete this[_0x2bc0('0xa2')][_0x1fc036[_0x2bc0('0xd3')]];this[_0x2bc0('0xac')](this['campaigns'][_0xecd71c[_0x2bc0('0xad')]]);this[_0x2bc0('0x1e')][_0xecd71c[_0x2bc0('0xad')]]['ivrAnswerCallsDay']+=0x1;_0x3371eb=new Hangup(_0xecd71c,_0x1fc036);this[_0x2bc0('0xc3')](_0x3371eb)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xe9')));this['moveContactManagedDialer'](_0x3371eb)['catch'](loggerCatch(_0x2bc0('0xea')));}if(_0xecd71c&&_0xecd71c[_0x2bc0('0x44')]!==_0x2bc0('0x71')&&isNotNull(this[_0x2bc0('0x1d')][_0xecd71c[_0x2bc0('0xad')]]['dialQueueProject'])){delete this['uniqueId'][_0x1fc036[_0x2bc0('0xd3')]];this[_0x2bc0('0xac')](this[_0x2bc0('0x1d')][_0xecd71c['queue']]);this['voiceQueues'][_0xecd71c[_0x2bc0('0xad')]][_0x2bc0('0x58')]+=0x1;this[_0x2bc0('0x1d')][_0xecd71c[_0x2bc0('0xad')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3371eb=new Hangup(_0xecd71c,_0x1fc036);_0x3371eb[_0x2bc0('0x9e')]=0x10;_0x3371eb[_0x2bc0('0xe0')]=_0x2bc0('0xeb');_0x3371eb['membername']=_0x2bc0('0xec');this[_0x2bc0('0xc3')](_0x3371eb)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xe9')));this['moveContactManagedDialer'](_0x3371eb)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xea')));}if(_0xecd71c&&_0xecd71c[_0x2bc0('0x44')]!==_0x2bc0('0x71')&&!isNotNull(this[_0x2bc0('0x1d')][_0xecd71c[_0x2bc0('0xad')]]['dialQueueProject'])){delete this[_0x2bc0('0xa2')][_0x1fc036[_0x2bc0('0xd3')]];this[_0x2bc0('0xac')](this[_0x2bc0('0x1d')][_0xecd71c[_0x2bc0('0xad')]]);this[_0x2bc0('0x1d')][_0xecd71c['queue']][_0x2bc0('0x60')]+=0x1;_0x3371eb=new Hangup(_0xecd71c,_0x1fc036);_0x3371eb[_0x2bc0('0x9e')]=0xc;_0x3371eb[_0x2bc0('0xe0')]=_0x1fc036['cause-txt'];_0x3371eb[_0x2bc0('0xdc')]=_0x2bc0('0xed');this['createHistory'](_0x3371eb)['catch'](loggerCatch(_0x2bc0('0xe9')));this[_0x2bc0('0xc1')](_0x3371eb)['catch'](loggerCatch(_0x2bc0('0xea')));}};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x2b')]=function(_0x5c5de2){var _0x169411=this['uniqueId'][_0x5c5de2[_0x2bc0('0xd3')]];var _0x5bf920=this;if(this['voiceQueues'][_0x5c5de2[_0x2bc0('0xad')]]){if(_0x169411&&_0x169411[_0x2bc0('0x44')]!==_0x2bc0('0x71')){delete this[_0x2bc0('0xa2')][_0x5c5de2['uniqueid']];this[_0x2bc0('0x1d')][_0x5c5de2[_0x2bc0('0xad')]]['outboundAnswerCallsDay']+=0x1;var _0x44fb22=new AgentComplete(_0x169411,_0x5c5de2);if(_0x5c5de2[_0x2bc0('0xee')]===_0x2bc0('0xef')){_0x44fb22[_0x2bc0('0xf0')]=this[_0x2bc0('0x1d')][_0x5c5de2[_0x2bc0('0xad')]][_0x2bc0('0xf1')]&&this['voiceQueues'][_0x5c5de2[_0x2bc0('0xad')]][_0x2bc0('0xf2')]?moment()['format'](_0x2bc0('0xf3')):undefined;}this['createHistory'](_0x44fb22)['catch'](loggerCatch(_0x2bc0('0xf4')));this['moveContactManagedDialer'](_0x44fb22)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0xf5')));}}};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xf6')]=function(_0x946a6){if(this[_0x2bc0('0x1d')][_0x946a6[_0x2bc0('0xad')]]){if(this[_0x2bc0('0xa2')][_0x946a6[_0x2bc0('0xd3')]]&&this[_0x2bc0('0xa2')][_0x946a6[_0x2bc0('0xd3')]][_0x2bc0('0x44')]!==_0x2bc0('0x71')){this[_0x2bc0('0xac')](this[_0x2bc0('0x1d')][_0x946a6['queue']]);this[_0x2bc0('0xa2')][_0x946a6['uniqueid']][_0x2bc0('0xf7')]=moment()[_0x2bc0('0x72')](_0x2bc0('0xf3'));}}};Dialer['prototype'][_0x2bc0('0xf8')]=function(_0x492300){this[_0x2bc0('0xc3')](_0x492300)[_0x2bc0('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2bc0('0xc1')](_0x492300)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x2bc0('0xa0')][_0x2bc0('0xf9')]=function(_0x326638){var _0x46c444=this[_0x2bc0('0xa2')][_0x326638[_0x2bc0('0xd3')]];var _0x1ab55b=this;if(this['voiceQueues'][_0x326638['queue']]){if(_0x46c444&&_0x46c444[_0x2bc0('0x44')]!=='ivr'){delete this[_0x2bc0('0xa2')][_0x326638[_0x2bc0('0xd3')]];this['updateOriginated'](this[_0x2bc0('0x1d')][_0x326638['queue']]);_0x46c444[_0x2bc0('0xfa')]=moment()[_0x2bc0('0x72')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5df678=new QueueCallerAbandon(_0x46c444,_0x326638);if(getSeconds(_0x46c444['droptime'],_0x46c444[_0x2bc0('0xfb')])>=_0x46c444['dialQueueTimeout']){this['voiceQueues'][_0x326638[_0x2bc0('0xad')]][_0x2bc0('0x78')]+=0x1;this[_0x2bc0('0x1d')][_0x326638['queue']][_0x2bc0('0x5b')]+=0x1;this[_0x2bc0('0x1d')][_0x326638['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5df678[_0x2bc0('0x9e')]=0xa;_0x5df678[_0x2bc0('0xe0')]=_0x2bc0('0xfc');_0x5df678[_0x2bc0('0xfd')]=_0x2bc0('0xfe');_0x5df678[_0x2bc0('0xf0')]=this[_0x2bc0('0x1d')][_0x326638[_0x2bc0('0xad')]][_0x2bc0('0xf1')]?moment()[_0x2bc0('0x72')](_0x2bc0('0xf3')):undefined;this[_0x2bc0('0xf8')](_0x5df678);}else{this[_0x2bc0('0x1d')][_0x326638['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x2bc0('0x1d')][_0x326638[_0x2bc0('0xad')]][_0x2bc0('0xff')]+=0x1;_0x5df678['state']=0xb;_0x5df678[_0x2bc0('0xe0')]=_0x2bc0('0x100');_0x5df678['dropreason']=_0x2bc0('0x101');this[_0x2bc0('0xf8')](_0x5df678);}}}};Dialer['prototype'][_0x2bc0('0x2d')]=function(_0x194456){if(this['actions'][_0x194456['uniqueid']]){this[_0x2bc0('0xa4')][_0x194456['uniqueid']][_0x2bc0('0xa9')]=_0x194456['channel'];}if(this[_0x2bc0('0xa2')][_0x194456[_0x2bc0('0xd3')]]){this['uniqueId'][_0x194456[_0x2bc0('0xd3')]][_0x2bc0('0xa9')]=_0x194456[_0x2bc0('0xa9')];}};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x30')]=function(_0x4ad40c){if(strategy[this[_0x2bc0('0x1d')][this[_0x2bc0('0xa4')][_0x4ad40c[_0x2bc0('0x102')]][_0x2bc0('0xad')]][_0x2bc0('0x46')]]===_0x2bc0('0x18')){if(this[_0x2bc0('0xa4')][_0x4ad40c[_0x2bc0('0x102')]]&&_[_0x2bc0('0xa6')](this[_0x2bc0('0xa4')][_0x4ad40c[_0x2bc0('0x102')]][_0x2bc0('0x103')])&&_0x4ad40c[_0x2bc0('0xa8')]==='1'&&_0x4ad40c[_0x2bc0('0x104')]==='0'){if(this['agents'][_0x4ad40c['stateinterface']]){if(!this[_0x2bc0('0x1f')][_0x4ad40c[_0x2bc0('0x105')]]['locked']){this[_0x2bc0('0x1f')][_0x4ad40c[_0x2bc0('0x105')]]['locked']=!![];this[_0x2bc0('0xa4')][_0x4ad40c[_0x2bc0('0x102')]][_0x2bc0('0x103')]=!![];this['actions'][_0x4ad40c['actionid']][_0x2bc0('0x105')]=_0x4ad40c[_0x2bc0('0x105')];}}}}else if((strategy[this[_0x2bc0('0x1d')][this[_0x2bc0('0xa4')][_0x4ad40c['actionid']][_0x2bc0('0xad')]]['strategy']]||_0x2bc0('0x106'))==='rrmemory'){if(this[_0x2bc0('0xa4')][_0x4ad40c['actionid']]){if(this[_0x2bc0('0x1f')][_0x4ad40c[_0x2bc0('0x105')]]){this[_0x2bc0('0xa4')][_0x4ad40c[_0x2bc0('0x102')]]['stateinterface']=_0x4ad40c[_0x2bc0('0x105')];if(_[_0x2bc0('0xa6')](this[_0x2bc0('0x107')][this['actions'][_0x4ad40c[_0x2bc0('0x102')]]['queue']])){this[_0x2bc0('0x107')][this['actions'][_0x4ad40c['actionid']][_0x2bc0('0xad')]]=[];}this[_0x2bc0('0x107')][this['actions'][_0x4ad40c[_0x2bc0('0x102')]][_0x2bc0('0xad')]]['push'](_[_0x2bc0('0xc9')](_[_0x2bc0('0xca')](this['actions'][_0x4ad40c[_0x2bc0('0x102')]],['idHopper',_0x2bc0('0x105')]),{'status':_0x4ad40c[_0x2bc0('0xa8')],'paused':_0x4ad40c[_0x2bc0('0x104')]}));}}}};function unlockQueueStatus(_0x296043,_0x5c9383){setTimeout(function(){if(_['isUndefined'](_0x296043['queueStatusComplete'])){loggerBooked[_0x2bc0('0x90')](_0x2bc0('0x108'),_0x5c9383);}_0x296043[_0x2bc0('0x109')]=!![];loggerBooked[_0x2bc0('0x75')](_0x2bc0('0x10a'),_0x5c9383,JSON[_0x2bc0('0x41')](_[_0x2bc0('0xca')](_0x296043,[_0x2bc0('0x37'),_0x2bc0('0x109')])));},0x1f3);}Dialer[_0x2bc0('0xa0')]['syncQueueStatusComplete']=function(_0x2a4e6b){var _0x4a7129=this;var _0x4b3c5a=_0x4a7129['voiceQueues'][_0x4a7129[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]]['queue']];if(strategy[this[_0x2bc0('0x1d')][this['actions'][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xad')]][_0x2bc0('0x46')]]===_0x2bc0('0x18')){if(this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]]&&this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']][_0x2bc0('0x105')]){this['preview']['run'](this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0x10b')],this['actions'][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0x105')])['catch'](function(_0x4ad8cf){logger[_0x2bc0('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x2bc0('0x8f')](_0x4ad8cf,{'showHidden':![],'depth':null}));})[_0x2bc0('0x1b')](function(){_0x4a7129['updateOriginated'](_0x4a7129['voiceQueues'][_0x4a7129[_0x2bc0('0xa4')][_0x2a4e6b['actionid']][_0x2bc0('0xad')]]);_0x4a7129['agents'][_0x4a7129[_0x2bc0('0xa4')][_0x2a4e6b['actionid']]['stateinterface']][_0x2bc0('0x103')]=![];delete _0x4a7129[_0x2bc0('0xa4')][_0x2a4e6b['actionid']];unlockQueueStatus(_0x4b3c5a);});}else{this[_0x2bc0('0xac')](this[_0x2bc0('0x1d')][this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']][_0x2bc0('0xad')]]);this[_0x2bc0('0xb9')]({'active':![],'ContactId':this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xcb')],'ListId':this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']]['ListId'],'VoiceQueueId':this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0x10c')]||undefined,'CampaignId':this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xcd')]||undefined})[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x10d')));delete this['actions'][_0x2a4e6b[_0x2bc0('0x102')]];unlockQueueStatus(_0x4b3c5a);}}else if((strategy[this[_0x2bc0('0x1d')][this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]]['queue']][_0x2bc0('0x46')]]||_0x2bc0('0x106'))===_0x2bc0('0x106')){var _0x2310c5;if(this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']]&&!_[_0x2bc0('0x3e')](this['queueBooked'][this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xad')]])){if(this[_0x2bc0('0x26')][_0x4a7129['actions'][_0x2a4e6b['actionid']][_0x2bc0('0xad')]]){this['queueBookedRR'][_0x4a7129[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xad')]]=this[_0x2bc0('0x26')][this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xad')]]?this[_0x2bc0('0x26')][this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']][_0x2bc0('0xad')]]:this['queueBooked'][this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]]['queue']]?this[_0x2bc0('0x107')][this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']][_0x2bc0('0xad')]][_0x2bc0('0x10e')]||0x0:0x0;}this[_0x2bc0('0x107')][this[_0x2bc0('0xa4')][_0x2a4e6b['actionid']][_0x2bc0('0xad')]][_0x2bc0('0x10e')]=this[_0x2bc0('0x26')][this[_0x2bc0('0xa4')][_0x2a4e6b[_0x2bc0('0x102')]][_0x2bc0('0xad')]];for(var _0x52cad3=0x0;_0x52cad3=0x0?!![]:![];})[_0x2bc0('0xaa')](myreject(_0x5ecb49)));}}else{_0x35b16d[_0x2bc0('0x128')](ami['Action']({'action':_0x2bc0('0x129'),'command':util[_0x2bc0('0x72')](_0x2bc0('0x12d'),_0x1214b7,!_[_0x2bc0('0x35')](config[_0x2bc0('0x125')][_0x345aed])?_0x345aed:'')})[_0x2bc0('0xb1')](function(_0x30ae34){return _0x30ae34[_0x2bc0('0x12e')][_0x2bc0('0x12b')]('true')>=0x0?!![]:![];})[_0x2bc0('0xaa')](myreject(_0x5ecb49)));}BPromise['all'](_0x35b16d)[_0x2bc0('0xb1')](function(_0x213040){var _0x4205d3=_[_0x2bc0('0x12f')](_0x213040);if(_0x4205d3){return _0xc0c2ce(_0x4205d3);}else{_0x589b0a[_0x2bc0('0x36')]=_0x14973a?_0x2bc0('0x130'):'INTERVAL_IS_OVERTIME';return _0x5ecb49(msgResponse('[ifTime][promiseAll]',_0x2bc0('0x121'),_0x2bc0('0x131')+_0x14973a+'\x20'+_0x1b09e3+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2bc0('0x8f')](_0x1214b7,{'showHidden':![],'depth':null})+_0x2bc0('0x132')+_0x345aed));}})[_0x2bc0('0xaa')](function(_0x561e49){return _0x5ecb49(msgResponse(_0x2bc0('0x11f'),_0x2bc0('0x121'),JSON[_0x2bc0('0x41')](_0x561e49)));});});};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x133')]=function(_0x5ee840){var _0x370020=this;return function(){switch(_0x5ee840[_0x2bc0('0x54')]){case _0x2bc0('0x134'):freeVariablesPredictive(_0x5ee840);_0x370020[_0x2bc0('0x135')](_0x5ee840,0x1);break;case _0x2bc0('0x136'):freeVariablesPredictive(_0x5ee840);_0x370020[_0x2bc0('0x135')](_0x5ee840,_0x5ee840[_0x2bc0('0x137')]);break;case _0x2bc0('0x7'):_0x370020[_0x2bc0('0x7')](_0x5ee840);break;case _0x2bc0('0x6'):freeVariablesPredictive(_0x5ee840);_0x370020[_0x2bc0('0x135')](_0x5ee840,0x1);break;default:freeVariablesPredictive(_0x5ee840);logger['error'](_0x2bc0('0x138'),_0x5ee840[_0x2bc0('0x37')],'method\x20not\x20recognized');}};};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x139')]=function(_0x2fe1c0){var _0x2bf713=this;return function(){_0x2bf713[_0x2bc0('0x13a')](_0x2fe1c0);};};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x8')]=function(_0x46a347){var _0x438579=this;if(isNotPreview(_0x46a347[_0x2bc0('0x54')])){if(isVoiceQueueOutbound(_0x46a347['type'])&&isActive(_0x46a347[_0x2bc0('0x13b')])){_0x46a347['sendMessageOneNotActive']=!![];BPromise[_0x2bc0('0xb0')]()['then'](checkIsLoggedIn(_0x46a347,_0x46a347[_0x2bc0('0x49')]))[_0x2bc0('0xb1')](checkIsActive(_0x46a347,_0x46a347[_0x2bc0('0x13b')]))['then'](checkInterval(_0x46a347))[_0x2bc0('0xb1')](_0x438579[_0x2bc0('0x11c')](_0x46a347))[_0x2bc0('0xb1')](_0x438579[_0x2bc0('0x13c')](_0x46a347[_0x2bc0('0x13d')],_0x46a347[_0x2bc0('0x13e')],_0x46a347[_0x2bc0('0x37')],_0x46a347))[_0x2bc0('0xb1')](_0x438579[_0x2bc0('0x120')](_0x46a347[_0x2bc0('0x3b')],_0x46a347[_0x2bc0('0x13e')],_0x46a347[_0x2bc0('0x37')],_0x46a347))[_0x2bc0('0xb1')](_0x438579[_0x2bc0('0x133')](_0x46a347))[_0x2bc0('0xaa')](loggerCatchQueueSummary('[syncQueueSummary]',_0x46a347));}else{notSendMessagesQueue(_0x46a347);}}else{freeVariablesPredictive(_0x46a347);}};Dialer['prototype'][_0x2bc0('0x11b')]=function(){var _0x137b5a=this;var _0x42ccec;for(var _0x55444a in this[_0x2bc0('0x1e')]){if(this[_0x2bc0('0x1e')]['hasOwnProperty'](_0x55444a)){_0x42ccec=this[_0x2bc0('0x1e')][_0x55444a];if(isCampaignIvr(_0x42ccec[_0x2bc0('0x44')])&&isActive(_0x42ccec[_0x2bc0('0x6e')])){_0x42ccec['sendMessageOneNotActive']=!![];BPromise[_0x2bc0('0xb0')]()['then'](checkIsActive(_0x42ccec,_0x42ccec[_0x2bc0('0x6e')]))[_0x2bc0('0xb1')](checkInterval(_0x42ccec))[_0x2bc0('0xb1')](_0x137b5a[_0x2bc0('0x11c')](_0x42ccec))[_0x2bc0('0xb1')](_0x137b5a[_0x2bc0('0x13c')](_0x42ccec[_0x2bc0('0x13d')],_0x42ccec[_0x2bc0('0x13e')],_0x42ccec['name'],_0x42ccec))[_0x2bc0('0xb1')](_0x137b5a[_0x2bc0('0x120')](_0x42ccec['Interval'],_0x42ccec['dialTimezone'],_0x42ccec[_0x2bc0('0x37')],_0x42ccec))[_0x2bc0('0xb1')](_0x137b5a[_0x2bc0('0x139')](_0x42ccec))[_0x2bc0('0xaa')](loggerCatchQueueSummary('[syncCampaigns]',_0x42ccec));}else{notSendMessagesCampaign(_0x42ccec);}}}};function getCallerIdRandom(_0x450f97,_0x4dee07){var _0x2a4d0d,_0x1e3533,_0x5ac4e3;if(_0x4dee07<=0x0){_0x4dee07=0x1;}_0x2a4d0d=new RegExp(_0x2bc0('0x13f')+_0x4dee07+'}$');_0x1e3533=Math[_0x2bc0('0x140')](0xa,_0x4dee07-0x1);_0x5ac4e3=Math[_0x2bc0('0x140')](0xa,_0x4dee07)-0x1;return util[_0x2bc0('0x72')]('%s',_[_0x2bc0('0x141')](_0x450f97,_0x2a4d0d,_[_0x2bc0('0x142')](_0x1e3533,_0x5ac4e3)));}function extractCalleridName(_0x33859d){var _0x422661=_0x33859d[_0x2bc0('0x143')](/"(.*?)"/);return _0x422661?_0x422661[0x1]:_0x33859d;}function extractCalleridNumber(_0x4f8fc6){var _0x518ed7=_0x4f8fc6['match'](/<(.*?)>/);return _0x518ed7?_0x518ed7[0x1]:_0x4f8fc6;}Dialer[_0x2bc0('0xa0')][_0x2bc0('0x144')]=function(_0x90e8f1,_0x5b5a7f){var _0x4c8670=this;var _0x11ba21=uuid['v4']();this['actions'][_0x11ba21]=new Action(_0x90e8f1,_0x5b5a7f,_0x11ba21);return new BPromise(function(_0x30f255,_0x5d745b){if(_['isUndefined'](_0x90e8f1)&&_0x2bc0('0x145')!==typeof _0x90e8f1){return _0x5d745b(msgResponse(_0x2bc0('0x146'),'Failure',_0x2bc0('0x147')));}if(_[_0x2bc0('0x35')](_0x5b5a7f[_0x2bc0('0x148')]['phone'])||_0x5b5a7f[_0x2bc0('0x148')][_0x2bc0('0x149')]===null){return _0x5d745b(msgResponse(_0x2bc0('0x146'),_0x2bc0('0x121'),_0x2bc0('0x14a')));}var _0x4eb903={'XMD-CALLERID':_0x4c8670['actions'][_0x11ba21][_0x2bc0('0x14b')](),'XMD-AGI':_0x90e8f1['dialQueueProject']?util[_0x2bc0('0x72')](_0x2bc0('0x14c'),ipAgi,_0x90e8f1[_0x2bc0('0x14d')]):_0x2bc0('0x14e'),'XMD-AGIAFTER':_0x90e8f1[_0x2bc0('0xf1')]?util[_0x2bc0('0x72')](_0x2bc0('0x14c'),ipAgi,_0x90e8f1[_0x2bc0('0xf1')]):_0x2bc0('0x14e'),'XMD-QUEUE':_0x90e8f1[_0x2bc0('0x44')]===_0x2bc0('0x45')?util['format']('\x22%s,%s%s,,,%s\x22',_0x90e8f1[_0x2bc0('0x37')],_0x90e8f1[_0x2bc0('0x14f')]||'',_0x90e8f1[_0x2bc0('0xf2')]?'c':'',_0x90e8f1[_0x2bc0('0x150')]||0x3):'NONE','XMD-CONTACTID':_0x5b5a7f[_0x2bc0('0xcb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4c8670[_0x2bc0('0xa4')][_0x11ba21][_0x2bc0('0x14b')](),'XMD-AMD':_0x90e8f1['dialAMDActive']?_0x2bc0('0x151'):_0x2bc0('0x14e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x90e8f1[_0x2bc0('0xd8')]){_0x4eb903[_0x2bc0('0x152')]=_0x90e8f1['dialAMDInitialSilence']||0x9c4;_0x4eb903[_0x2bc0('0x153')]=_0x90e8f1[_0x2bc0('0x154')]||0x5dc;_0x4eb903[_0x2bc0('0x155')]=_0x90e8f1[_0x2bc0('0x156')]||0x320;_0x4eb903[_0x2bc0('0x157')]=_0x90e8f1[_0x2bc0('0x158')]||0x1388;_0x4eb903[_0x2bc0('0x159')]=_0x90e8f1[_0x2bc0('0x15a')]||0x64;_0x4eb903['XMD-AMDBETWEENWORDSSILENCE']=_0x90e8f1[_0x2bc0('0x15b')]||0x32;_0x4eb903['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x90e8f1[_0x2bc0('0x15c')]||0x3;_0x4eb903[_0x2bc0('0x15d')]=_0x90e8f1[_0x2bc0('0x15e')]||0x100;_0x4eb903[_0x2bc0('0x15f')]=_0x90e8f1[_0x2bc0('0x160')]||0x1388;}if(_0x90e8f1['type']===_0x2bc0('0x45')){_0x4eb903[_0x2bc0('0x161')]=_0x5b5a7f[_0x2bc0('0x10c')];}else{_0x4eb903[_0x2bc0('0x162')]=_0x5b5a7f['CampaignId'];}for(var _0x277577 in _0x5b5a7f[_0x2bc0('0x148')]){if(_0x5b5a7f[_0x2bc0('0x148')][_0x2bc0('0xa5')](_0x277577)){if(isNotNull(_0x5b5a7f['Contact'][_0x277577])&&_0x277577!=='id'&&_0x277577!=='tags'&&_0x277577!=='createdAt'&&_0x277577!=='updatedAt'){_0x4eb903[util[_0x2bc0('0x72')](_0x2bc0('0x163'),_0x2bc0('0x164'),_[_0x2bc0('0x165')](_0x277577))]=_0x5b5a7f[_0x2bc0('0x148')][_0x277577];}}}var _0x578c69=_0x4c8670['isTrunkReachable'](_0x90e8f1[_0x2bc0('0x6d')])?getCallerId(_0x90e8f1['Trunk']['callerid'],_0x90e8f1[_0x2bc0('0x55')],_0x90e8f1['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x90e8f1[_0x2bc0('0x56')],_0x90e8f1[_0x2bc0('0x166')]):_0x90e8f1[_0x2bc0('0x56')]):getCallerId(_[_0x2bc0('0xa6')](_0x90e8f1[_0x2bc0('0x167')])?_0x90e8f1[_0x2bc0('0x6d')]['callerid']:_0x90e8f1[_0x2bc0('0x167')][_0x2bc0('0x6f')],_0x90e8f1[_0x2bc0('0x55')],_0x90e8f1['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x90e8f1[_0x2bc0('0x56')],_0x90e8f1[_0x2bc0('0x166')]):_0x90e8f1[_0x2bc0('0x56')]);if(_0x578c69){_0x4eb903[_0x2bc0('0x168')]=_0x4c8670['actions'][_0x11ba21][_0x2bc0('0x169')]=extractCalleridName(_0x578c69);_0x4eb903['XMD-ORIGINATECALLERIDNUM']=_0x4c8670['actions'][_0x11ba21][_0x2bc0('0x16a')]=extractCalleridNumber(_0x578c69);}return ami[_0x2bc0('0xa7')]({'actionid':_0x11ba21,'action':_0x2bc0('0x146'),'channel':_0x4c8670['isTrunkReachable'](_0x90e8f1[_0x2bc0('0x6d')])?util[_0x2bc0('0x72')](_0x2bc0('0x16b'),_0x90e8f1[_0x2bc0('0x6d')][_0x2bc0('0x37')],isNotNull(_0x90e8f1[_0x2bc0('0x16c')])?_0x90e8f1[_0x2bc0('0x16c')][_0x2bc0('0x16d')]()||'':'',_0x90e8f1['dialCutDigit']>0x0?_0x5b5a7f[_0x2bc0('0x148')][_0x2bc0('0x149')][_0x2bc0('0x16e')](_0x90e8f1[_0x2bc0('0x16f')]):_0x5b5a7f[_0x2bc0('0x148')][_0x2bc0('0x149')]):util['format'](_0x2bc0('0x16b'),_['isNil'](_0x90e8f1[_0x2bc0('0x167')])?_0x90e8f1[_0x2bc0('0x6d')]['name']:_0x90e8f1['TrunkBackup'][_0x2bc0('0x37')],isNotNull(_0x90e8f1['dialPrefix'])?_0x90e8f1[_0x2bc0('0x16c')][_0x2bc0('0x16d')]()||'':'',_0x90e8f1[_0x2bc0('0x16f')]>0x0?_0x5b5a7f[_0x2bc0('0x148')][_0x2bc0('0x149')][_0x2bc0('0x16e')](_0x90e8f1[_0x2bc0('0x16f')]):_0x5b5a7f[_0x2bc0('0x148')][_0x2bc0('0x149')]),'callerid':_0x578c69,'Exten':_0x2bc0('0xd7'),'Context':'from-sip','Priority':'1','variable':_0x4eb903,'timeout':(_0x90e8f1[_0x2bc0('0x170')]||0x1e)*0x3e8,'async':!![],'channelid':_0x11ba21})[_0x2bc0('0xb1')](function(_0x57f4fe){return _0x30f255(_0x57f4fe);})['catch'](function(_0x58a88f){_0x90e8f1[_0x2bc0('0x5d')]+=0x1;var _0x483e28=new History(_0x4c8670[_0x2bc0('0xa4')][_0x11ba21]);logger[_0x2bc0('0x90')](util[_0x2bc0('0x72')]('[originateError]:\x20%s',JSON['stringify'](_0x58a88f)));_0x483e28[_0x2bc0('0x9e')]=0xe;_0x483e28[_0x2bc0('0xe0')]=_0x2bc0('0x171');_0x483e28[_0x2bc0('0x172')]=moment()[_0x2bc0('0x72')](_0x2bc0('0xf3'));_0x483e28[_0x2bc0('0x9f')]=_0x483e28['starttime'];_0x4c8670['createHistory'](_0x483e28)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x173')));_0x4c8670[_0x2bc0('0xc1')](_0x483e28)[_0x2bc0('0xaa')](loggerCatch('[originate][error]'))[_0x2bc0('0x1b')](function(){delete _0x4c8670[_0x2bc0('0xa4')][_0x11ba21];return _0x5d745b(msgResponse(_0x2bc0('0x146'),_0x2bc0('0x174'),_0x2bc0('0x175')));});});});};Dialer[_0x2bc0('0xa0')]['syncOriginateResponse']=function(_0x3ea66f){var _0x2b300a=this[_0x2bc0('0xa4')][_0x3ea66f[_0x2bc0('0x102')]];var _0x17f800=this;if(_0x2b300a){delete this[_0x2bc0('0xa4')][_0x3ea66f[_0x2bc0('0x102')]];_0x2b300a[_0x2bc0('0xfb')]=moment()[_0x2bc0('0x72')](_0x2bc0('0xf3'));var _0x1e5b7c=_0x2b300a[_0x2bc0('0x44')]===_0x2bc0('0x71')?this[_0x2bc0('0x1e')][_0x2b300a[_0x2bc0('0xad')]]:this[_0x2bc0('0x1d')][_0x2b300a[_0x2bc0('0x176')]()];if(!this[_0x2bc0('0xcf')](_0x3ea66f[_0x2bc0('0x177')])){this[_0x2bc0('0xac')](_0x1e5b7c);return this[_0x2bc0('0x178')](_0x2b300a,_0x1e5b7c,_0x3ea66f)[_0x2bc0('0xb1')](function(_0x49b080){})[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x179')));}else{this[_0x2bc0('0xa2')][_0x3ea66f[_0x2bc0('0xd3')]]=_0x2b300a;}}};Dialer[_0x2bc0('0xa0')]['checkRetriveMax']=function(_0x70f4b4,_0x2e08af,_0x5c3f6a){var _0x48f093=new History(_0x2e08af);if(_0x48f093[_0x2bc0('0x17a')]+_0x48f093[_0x2bc0('0x17b')]+_0x48f093[_0x2bc0('0x17c')]>=_0x5c3f6a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x70f4b4){case 0x3:if(_0x48f093[_0x2bc0('0x17c')]>=_0x5c3f6a['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x2bc0('0xb9')]({'active':![],'countnoanswerretry':_0x48f093[_0x2bc0('0x17c')]+=0x1,'scheduledat':moment()[_0x2bc0('0x17d')](_0x5c3f6a['dialNoAnswerRetryFrequency'],_0x2bc0('0x17e'))[_0x2bc0('0x72')](_0x2bc0('0xf3')),'ContactId':_0x48f093[_0x2bc0('0xcb')],'ListId':_0x48f093['ListId'],'VoiceQueueId':_0x48f093[_0x2bc0('0x10c')]||undefined,'CampaignId':_0x48f093['CampaignId']||undefined})[_0x2bc0('0xaa')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x48f093[_0x2bc0('0x17a')]>=_0x5c3f6a[_0x2bc0('0x17f')]-0x1){return!![];}else{this[_0x2bc0('0xb9')]({'active':![],'countbusyretry':_0x48f093[_0x2bc0('0x17a')]+=0x1,'scheduledat':moment()[_0x2bc0('0x17d')](_0x5c3f6a[_0x2bc0('0x180')],_0x2bc0('0x17e'))[_0x2bc0('0x72')](_0x2bc0('0xf3')),'ContactId':_0x48f093[_0x2bc0('0xcb')],'ListId':_0x48f093['ListId'],'VoiceQueueId':_0x48f093[_0x2bc0('0x10c')]||undefined,'CampaignId':_0x48f093[_0x2bc0('0xcd')]||undefined})['catch'](loggerCatch(_0x2bc0('0x181')));}break;case 0x8:if(_0x48f093[_0x2bc0('0x17b')]>=_0x5c3f6a[_0x2bc0('0x182')]-0x1){return!![];}else{this[_0x2bc0('0xb9')]({'active':![],'countcongestionretry':_0x48f093[_0x2bc0('0x17b')]+=0x1,'scheduledat':moment()['add'](_0x5c3f6a[_0x2bc0('0x183')],_0x2bc0('0x17e'))[_0x2bc0('0x72')](_0x2bc0('0xf3')),'ContactId':_0x48f093['ContactId'],'ListId':_0x48f093[_0x2bc0('0x117')],'VoiceQueueId':_0x48f093[_0x2bc0('0x10c')]||undefined,'CampaignId':_0x48f093[_0x2bc0('0xcd')]||undefined})[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x184')));}break;default:return!![];}};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x178')]=function(_0x3fa861,_0x1d0e32,_0x3ec5bc){var _0x18f027=this;var _0x3e0a5b=new History(_0x3fa861);return new BPromise(function(_0x4f7a5e,_0x5d5292){if(_[_0x2bc0('0x35')](_0x1d0e32)&&_0x2bc0('0x145')!==typeof _0x1d0e32){return _0x5d5292(msgResponse(_0x2bc0('0x185'),_0x2bc0('0x121'),_0x2bc0('0x186')));}if(_[_0x2bc0('0x35')](_0x3ec5bc)&&_0x2bc0('0x145')!==typeof _0x3ec5bc){return _0x5d5292(msgResponse(_0x2bc0('0x185'),_0x2bc0('0x121'),_0x2bc0('0x187')));}switch(_0x3ec5bc[_0x2bc0('0xee')]){case'0':_0x1d0e32[_0x2bc0('0x188')]+=0x1;_0x3e0a5b['state']=0x0;_0x3e0a5b[_0x2bc0('0xe0')]='NoSuchNumber';_0x18f027[_0x2bc0('0xc3')](_0x3e0a5b)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x189')));if(_0x18f027[_0x2bc0('0x18a')](0x0,_0x3fa861,_0x1d0e32)){if(_0x3e0a5b[_0x2bc0('0x17a')]+_0x3e0a5b[_0x2bc0('0x17b')]+_0x3e0a5b['countnoanswerretry']>=_0x1d0e32[_0x2bc0('0x18b')]){_0x18f027['stateGlobal'](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x2bc0('0x18c'));}else{_0x18f027[_0x2bc0('0x18d')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x2bc0('0x18c'));}}break;case'3':_0x1d0e32[_0x2bc0('0x5c')]+=0x1;_0x3e0a5b['state']=0x3;_0x3e0a5b[_0x2bc0('0xe0')]=_0x2bc0('0x18e');_0x3e0a5b['countnoanswerretry']+=0x1;_0x3e0a5b[_0x2bc0('0x18f')]+=0x1;_0x18f027[_0x2bc0('0xc3')](_0x3e0a5b)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x190')));if(_0x18f027['checkRetriveMax'](0x3,_0x3fa861,_0x1d0e32)){if(_0x3e0a5b[_0x2bc0('0x17c')]>=_0x1d0e32[_0x2bc0('0x191')]){_0x18f027[_0x2bc0('0x18d')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,'reason\x203\x20ringing\x20no\x20answer');}else{_0x18f027['stateGlobal'](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x2bc0('0x192'));}}break;case'5':_0x1d0e32['outboundBusyCallsDay']+=0x1;_0x3e0a5b[_0x2bc0('0x9e')]=0x5;_0x3e0a5b['statedesc']='Busy';_0x3e0a5b[_0x2bc0('0x17a')]+=0x1;_0x3e0a5b[_0x2bc0('0x18f')]+=0x1;_0x18f027[_0x2bc0('0xc3')](_0x3e0a5b)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x193')));if(_0x18f027[_0x2bc0('0x18a')](0x5,_0x3fa861,_0x1d0e32)){if(_0x3e0a5b[_0x2bc0('0x17a')]>=_0x1d0e32[_0x2bc0('0x17f')]){_0x18f027[_0x2bc0('0x18d')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,'reason\x205\x20busy');}else{_0x18f027[_0x2bc0('0x194')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x2bc0('0x195'));}}break;case'8':_0x1d0e32[_0x2bc0('0x5a')]+=0x1;_0x3e0a5b[_0x2bc0('0x9e')]=0x8;_0x3e0a5b[_0x2bc0('0xe0')]=_0x2bc0('0x196');_0x3e0a5b[_0x2bc0('0x17b')]+=0x1;_0x3e0a5b[_0x2bc0('0x18f')]+=0x1;_0x18f027[_0x2bc0('0xc3')](_0x3e0a5b)['catch'](loggerCatch(_0x2bc0('0x197')));if(_0x18f027[_0x2bc0('0x18a')](0x8,_0x3fa861,_0x1d0e32)){if(_0x3e0a5b[_0x2bc0('0x17b')]>=_0x1d0e32['dialCongestionMaxRetry']){_0x18f027[_0x2bc0('0x18d')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x2bc0('0x198'));}else{_0x18f027[_0x2bc0('0x194')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,'reason\x208\x20congestion');}}break;default:_0x1d0e32[_0x2bc0('0x60')]+=0x1;_0x3e0a5b[_0x2bc0('0x9e')]=0xc;_0x3e0a5b[_0x2bc0('0xe0')]=_0x3ec5bc[_0x2bc0('0xee')];_0x18f027[_0x2bc0('0xc3')](_0x3e0a5b)[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x199')));if(_0x18f027[_0x2bc0('0x18a')](_0x3ec5bc[_0x2bc0('0xee')],_0x3fa861,_0x1d0e32)){if(_0x3e0a5b[_0x2bc0('0x17a')]+_0x3e0a5b['countcongestionretry']+_0x3e0a5b['countnoanswerretry']>=_0x1d0e32[_0x2bc0('0x18b')]){_0x18f027[_0x2bc0('0x194')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x3ec5bc[_0x2bc0('0xee')]);}else{_0x18f027[_0x2bc0('0x18d')](_0x3e0a5b,_0x4f7a5e,_0x5d5292,_0x3ec5bc['reason']);}}}});};Dialer[_0x2bc0('0xa0')]['stateGlobal']=function(_0x2034d9,_0x36b078,_0x598892,_0x821efc){var _0x5ab4cc=new Final(_0x2034d9);_0x5ab4cc[_0x2bc0('0x9e')]=0xf;_0x5ab4cc[_0x2bc0('0xe0')]=_0x2bc0('0x19a');this['createStateFinal'](_0x5ab4cc,_0x36b078,_0x598892,_0x821efc);};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x18d')]=function(_0x2b881e,_0x533ce2,_0x1833f8,_0xe45862){this[_0x2bc0('0xc1')](_0x2b881e)[_0x2bc0('0xb1')](function(_0x5c6553){return _0x533ce2(msgResponse(_0x2bc0('0x185'),'Success',_0xe45862));})[_0x2bc0('0xaa')](function(_0x5ddfc6){return _0x1833f8(msgResponse('[moveContactManagedDialer][0]',_0x2bc0('0x121'),_0x2bc0('0x19b')));});};Dialer['prototype'][_0x2bc0('0x7')]=function(_0x13381e){var _0x34bad6=this;var _0x1a67cc=_0x13381e[_0x2bc0('0x19c')]/0x64;var _0x37fc95=_0x13381e[_0x2bc0('0x5b')]/(_0x13381e['outboundDropCallsDayTimeout']+_0x13381e[_0x2bc0('0x58')]);var _0x2773e2=Math[_0x2bc0('0x19d')](_0x13381e[_0x2bc0('0x68')]*(_0x13381e[_0x2bc0('0x19e')]/0x64));var _0x165234=Math[_0x2bc0('0x19d')](_0x13381e[_0x2bc0('0x68')]*(_0x13381e['predictiveIntervalMinThreshold']/0x64));var _0x1cd146=_0x13381e[_0x2bc0('0x48')]+_0x13381e[_0x2bc0('0x4e')];var _0x320141=Math[_0x2bc0('0x19f')](_0x13381e[_0x2bc0('0x6a')]*_0x13381e[_0x2bc0('0x6c')]*_0x13381e[_0x2bc0('0x66')]*_0x13381e[_0x2bc0('0x1a0')]);if(_[_0x2bc0('0x35')](_0x13381e[_0x2bc0('0x24')])){if(!_[_0x2bc0('0x35')](_0x13381e['startPredictive'])){_0x13381e[_0x2bc0('0x23')]=undefined;loggerPredictive['error'](_0x2bc0('0x1a1'),_0x2bc0('0x1a2'));}if(!_['isUndefined'](_0x13381e[_0x2bc0('0x89')])){loggerPredictive[_0x2bc0('0x90')](_0x2bc0('0x1a1'),_0x2bc0('0x1a3'));clearInterval(_0x13381e[_0x2bc0('0x89')]);_0x13381e[_0x2bc0('0x89')]=undefined;}_0x13381e[_0x2bc0('0x24')]=moment()[_0x2bc0('0x72')](_0x2bc0('0xf3'));loggerPredictive[_0x2bc0('0x75')](_0x13381e[_0x2bc0('0x37')],'collection\x20data\x20in\x20progressive\x20at',_0x13381e[_0x2bc0('0x24')]);this[_0x2bc0('0x135')](_0x13381e,0x1);}else if(ifInterval(_0x13381e[_0x2bc0('0x1a4')],_0x13381e[_0x2bc0('0x24')])){this[_0x2bc0('0x135')](_0x13381e,0x1);loggerPredictiveCalls['info'](_0x2bc0('0x1a5'),_0x13381e['startProgressive'],_0x13381e[_0x2bc0('0x37')]);_0x13381e[_0x2bc0('0x6a')]=0x0;_0x13381e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1a67cc<_0x37fc95&&_0x13381e['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x13381e);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1a6'),'Dropped\x20calls\x20day',_0x37fc95,_0x2bc0('0x24'),_0x13381e[_0x2bc0('0x37')]);}else if(_0x320141<_0x13381e['predictiveIntervalErlangCallsDroppedCalls']&&_0x13381e['dialPredictiveOptimization']===_0x2bc0('0x1a7')){freeVariablesPredictive(_0x13381e);loggerPredictive['info'](_0x2bc0('0x1a8'),_0x2bc0('0x1a9'),_0x320141,'Drop\x20in\x20this\x20interval',_0x13381e['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x13381e[_0x2bc0('0x37')]);}else if(!ifInterval(_0x13381e['dialPredictiveInterval'],_0x13381e['startProgressive'])&&_[_0x2bc0('0x35')](_0x13381e[_0x2bc0('0x23')])&&!_['isUndefined'](_0x13381e[_0x2bc0('0x24')])){_0x13381e['startPredictive']=moment()['format'](_0x2bc0('0xf3'));loggerPredictive[_0x2bc0('0x75')](_0x13381e[_0x2bc0('0x37')],'started\x20in\x20predictive\x20at',_0x13381e[_0x2bc0('0x23')]);this[_0x2bc0('0x1aa')](_0x13381e[_0x2bc0('0x1a4')])[_0x2bc0('0xb1')](this[_0x2bc0('0x1ab')](_0x13381e))[_0x2bc0('0xb1')](mergeDataErlangB(_0x13381e))[_0x2bc0('0xb1')](this[_0x2bc0('0x1ac')](_0x13381e))['catch'](loggerCatchPredictive(_0x2bc0('0x1ad'),_0x13381e));}else if(!ifInterval(_0x13381e[_0x2bc0('0x1a4')],_0x13381e[_0x2bc0('0x23')])){_0x13381e['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x13381e['startPredictive']=moment()[_0x2bc0('0x72')](_0x2bc0('0xf3'));loggerPredictive['info'](_0x13381e[_0x2bc0('0x37')],'recalculate\x20predictive\x20at',_0x13381e[_0x2bc0('0x23')]);clearInterval(_0x13381e[_0x2bc0('0x89')]);_0x13381e['handlePredictive']=undefined;this[_0x2bc0('0x1aa')](_0x13381e[_0x2bc0('0x1a4')])[_0x2bc0('0xb1')](this[_0x2bc0('0x1ab')](_0x13381e))['then'](mergeDataErlangB(_0x13381e))[_0x2bc0('0xb1')](this[_0x2bc0('0x1ac')](_0x13381e))['catch'](loggerCatchPredictive(_0x2bc0('0x1ae'),_0x13381e));}else if(_0x13381e[_0x2bc0('0x68')]&&_0x1cd146<_0x13381e[_0x2bc0('0x68')]-_0x165234){freeVariablesPredictive(_0x13381e);loggerPredictive[_0x2bc0('0x75')](_0x13381e[_0x2bc0('0x37')],_0x2bc0('0x1af'),_0x1cd146,_0x2bc0('0x1b0'),_0x13381e[_0x2bc0('0x68')],'-',_0x165234,'=',_0x13381e['predictiveIntervalAvailable']-_0x165234,')');}else if(_0x13381e[_0x2bc0('0x68')]&&_0x1cd146>_0x13381e[_0x2bc0('0x68')]+_0x2773e2){freeVariablesPredictive(_0x13381e);loggerPredictive[_0x2bc0('0x75')](_0x13381e[_0x2bc0('0x37')],_0x2bc0('0x1af'),_0x1cd146,_0x2bc0('0x1b1'),_0x13381e[_0x2bc0('0x68')],'+',_0x2773e2,'=',_0x13381e[_0x2bc0('0x68')]+_0x2773e2,')');}};Dialer['prototype'][_0x2bc0('0x1ab')]=function(_0x2fe12e){var _0x27b5c8=this;return function(_0x405e13){return new BPromise(function(_0x4016a4,_0x15dfc7){_['merge'](_0x2fe12e,_0x405e13[0x0]);if(checkGetDataPredictive(_0x405e13[0x0])){var _0x9b1998=_0x2fe12e[_0x2bc0('0x68')]=_0x2fe12e[_0x2bc0('0x4e')]+_0x2fe12e['available'];var _0x435dc4=_0x2fe12e['dialPredictiveInterval']*0x3c;var _0x2197a0=_0x405e13[0x0][_0x2bc0('0x63')]+_0x405e13[0x0][_0x2bc0('0x62')];var _0x5aa7ba=(_0x405e13[0x0]['predictiveIntervalAnsweredCalls']+_0x405e13[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x405e13[0x0][_0x2bc0('0x64')])/_0x405e13[0x0][_0x2bc0('0x69')];_0x2fe12e[_0x2bc0('0x66')]=_0x5aa7ba>0x0?_0x5aa7ba:0x1;switch(_0x2fe12e[_0x2bc0('0x1b2')]){case'dropRate':var _0x2320ca=_0x2fe12e['dialPredictiveOptimizationPercentage']/0x64;return _0x27b5c8[_0x2bc0('0x1b3')](_0x9b1998,_0x435dc4,_0x2197a0,_0x5aa7ba,_0x2320ca)['then'](function(_0x2e43d2){return _0x4016a4(_0x2e43d2);});case _0x2bc0('0x1b4'):var _0x367c31=_0x2fe12e[_0x2bc0('0x19c')]/0x64;return _0x27b5c8['busyFactor'](_0x9b1998,_0x435dc4,_0x2197a0,_0x5aa7ba,_0x367c31)['then'](function(_0xffeb9c){return _0x4016a4(_0xffeb9c);});default:return _0x15dfc7(msgResponse(_0x2bc0('0x1b5'),_0x2bc0('0x121'),_0x2bc0('0x1b6')));}}else{return _0x15dfc7(msgResponse(_0x2bc0('0x1b5'),_0x2bc0('0x121'),_0x2bc0('0x1b7')));}});};};Dialer[_0x2bc0('0xa0')]['getDataPredictiveOld']=function(_0x15b53f){var _0x14f383=this;return function(_0x5a42e1){return new BPromise(function(_0x546058,_0xe2b234){_[_0x2bc0('0xc9')](_0x15b53f,_0x5a42e1[0x0]);if(checkGetDataPredictive(_0x5a42e1[0x0])){loggerPredictive[_0x2bc0('0x75')](JSON['stringify'](_0x5a42e1[0x0]));if(_0x15b53f[_0x2bc0('0x1b2')]==='dropRate'){return _0x14f383[_0x2bc0('0xbf')](_0x15b53f['id'])[_0x2bc0('0xb1')](function(_0x2a30e){var _0x2f1dab=_0x15b53f[_0x2bc0('0x49')]-_0x2a30e[0x0][_0x2bc0('0x1b8')];var _0x3ce8ba=_0x15b53f[_0x2bc0('0x1a4')]*0x3c;var _0x296354=_0x5a42e1[0x0]['predictiveIntervalAvgTalktime']+_0x5a42e1[0x0][_0x2bc0('0x62')];var _0x44d2bb=(_0x5a42e1[0x0][_0x2bc0('0x61')]+_0x5a42e1[0x0][_0x2bc0('0x78')]+_0x5a42e1[0x0][_0x2bc0('0x64')])/_0x5a42e1[0x0][_0x2bc0('0x69')];var _0x2041a9=_0x15b53f['dialPredictiveOptimizationPercentage']/0x64;_0x15b53f[_0x2bc0('0x67')]=_0x2a30e[0x0][_0x2bc0('0x1b8')]||0x0;_0x15b53f['predictiveIntervalHitRate']=_0x44d2bb>0x0?_0x44d2bb:0x1;return _0x14f383[_0x2bc0('0x1b3')](_0x2f1dab,_0x3ce8ba,_0x296354,_0x44d2bb,_0x2041a9);})[_0x2bc0('0xb1')](function(_0x3f778a){return _0x546058(_0x3f778a);})['catch'](function(_0x7fa641){return _0xe2b234(msgResponse(_0x2bc0('0x1b9'),_0x2bc0('0x121'),JSON[_0x2bc0('0x41')](_0x7fa641)));});}if(_0x15b53f[_0x2bc0('0x1b2')]===_0x2bc0('0x1b4')){return _0x14f383[_0x2bc0('0xbf')](_0x15b53f['id'])[_0x2bc0('0xb1')](function(_0x544b99){var _0x4b97f4=_0x15b53f[_0x2bc0('0x49')]-_0x544b99[0x0][_0x2bc0('0x1b8')];var _0x35c7c0=_0x15b53f[_0x2bc0('0x1a4')]*0x3c;var _0x135229=_0x5a42e1[0x0]['predictiveIntervalAvgTalktime']+_0x5a42e1[0x0]['predictiveIntervalAvgHoldtime'];var _0xb36d77=(_0x5a42e1[0x0][_0x2bc0('0x61')]+_0x5a42e1[0x0][_0x2bc0('0x78')]+_0x5a42e1[0x0][_0x2bc0('0x64')])/_0x5a42e1[0x0][_0x2bc0('0x69')];var _0x592bac=_0x15b53f['dialPredictiveOptimizationPercentage']/0x64;_0x15b53f[_0x2bc0('0x67')]=_0x544b99[0x0][_0x2bc0('0x1b8')]||0x0;_0x15b53f['predictiveIntervalHitRate']=_0xb36d77>0x0?_0xb36d77:0x1;return _0x14f383[_0x2bc0('0x1ba')](_0x4b97f4,_0x35c7c0,_0x135229,_0xb36d77,_0x592bac);})[_0x2bc0('0xb1')](function(_0x30f6c8){return _0x546058(_0x30f6c8);})[_0x2bc0('0xaa')](function(_0x4ee16b){return _0xe2b234(msgResponse(_0x2bc0('0x1b9'),_0x2bc0('0x121'),JSON[_0x2bc0('0x41')](_0x4ee16b)));});}}else{return _0xe2b234(msgResponse('[getDataPredictive]',_0x2bc0('0x121'),_0x2bc0('0x1b7')));}});};};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x1ac')]=function(_0x1e1029){var _0x2f7a00=this;return function(){var _0x204a37=0x0;var _0x168692=Math[_0x2bc0('0x19f')](_0x1e1029[_0x2bc0('0x6b')]*0x3e8);if(_0x168692>0x0){_0x168692=_0x168692<0x64?0x64:_0x168692;loggerPredictive[_0x2bc0('0x75')](_0x1e1029[_0x2bc0('0x37')],'one\x20call\x20every:',_0x168692,_0x2bc0('0x42'));_0x1e1029['handlePredictive']=setInterval(function(){_0x2f7a00['handlePredictive'](_0x1e1029);loggerPredictiveCalls[_0x2bc0('0x75')](_0x2bc0('0x1bb'),_0x204a37+=0x1);},_0x168692);}else{loggerPredictive[_0x2bc0('0x75')](_0x1e1029['name'],_0x2bc0('0x1bc'));}};};Dialer[_0x2bc0('0xa0')]['checkContactBlack']=function(_0x34267e,_0x5a4dbd){var _0x38989e=this;return function(_0x3d669){if(_[_0x2bc0('0x3e')](_0x3d669)){if(_[_0x2bc0('0xa6')](_0x5a4dbd[_0x2bc0('0xcc')])||!_0x5a4dbd['recallme']){if(_0x34267e[_0x2bc0('0x54')]==='booked'){_0x34267e[_0x2bc0('0x109')]=_[_0x2bc0('0x35')](_0x34267e['queueStatusComplete'])?!![]:_0x34267e[_0x2bc0('0x109')];var _0x2f4bc3=uuid['v4']();_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3]=new Action(_0x34267e,_0x5a4dbd,_0x2f4bc3);loggerBooked[_0x2bc0('0x75')]('[booked][checkContactBlack]',_0x2f4bc3,_0x2bc0('0x1bd'),JSON[_0x2bc0('0x41')](_0x34267e['queueStatusComplete']),_0x2bc0('0x1be'),_0x34267e['name']);if(_0x34267e[_0x2bc0('0x109')]){_0x34267e[_0x2bc0('0x109')]=![];_0x38989e[_0x2bc0('0x107')][_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3]['queue']]=[];ami[_0x2bc0('0xa7')]({'actionid':_0x2f4bc3,'action':_0x2bc0('0x1bf'),'queue':_0x34267e[_0x2bc0('0x37')]})['catch'](function(_0x3c7012){_0x38989e[_0x2bc0('0xac')](_0x34267e);_0x38989e[_0x2bc0('0xb9')]({'active':![],'ContactId':_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3][_0x2bc0('0xcb')],'ListId':_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3][_0x2bc0('0x117')],'VoiceQueueId':_0x38989e['actions'][_0x2f4bc3][_0x2bc0('0x10c')]||undefined,'CampaignId':_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3][_0x2bc0('0xcd')]||undefined})[_0x2bc0('0xaa')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x38989e[_0x2bc0('0xa4')][_0x2f4bc3];});}else{loggerBooked[_0x2bc0('0x75')](_0x2bc0('0x1c0'),JSON[_0x2bc0('0x41')](_0x34267e[_0x2bc0('0x109')]),_0x2bc0('0x1be'),_0x34267e[_0x2bc0('0x37')]);_0x38989e[_0x2bc0('0xac')](_0x34267e);_0x38989e[_0x2bc0('0xb9')]({'active':![],'ContactId':_0x38989e['actions'][_0x2f4bc3][_0x2bc0('0xcb')],'ListId':_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3][_0x2bc0('0x117')],'VoiceQueueId':_0x38989e[_0x2bc0('0xa4')][_0x2f4bc3][_0x2bc0('0x10c')]||undefined,'CampaignId':_0x38989e['actions'][_0x2f4bc3]['CampaignId']||undefined})[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x1c1')));delete _0x38989e[_0x2bc0('0xa4')][_0x2f4bc3];}}else{return _0x38989e[_0x2bc0('0x144')](_0x34267e,_0x5a4dbd);}}else{if(getDiff(_0x5a4dbd[_0x2bc0('0x1c2')])<_0x34267e[_0x2bc0('0x1c3')]*0x3c){if(_0x5a4dbd[_0x2bc0('0x1c4')]&&!_0x5a4dbd[_0x2bc0('0x1c4')][_0x2bc0('0x1c5')]){_0x38989e['preview'][_0x2bc0('0x113')](_0x5a4dbd['id'])['finally'](function(){_0x38989e[_0x2bc0('0xac')](_0x34267e);});}else{_0x38989e[_0x2bc0('0xba')]({'active':![]},_0x5a4dbd['id'],0x1)[_0x2bc0('0x1b')](function(){console[_0x2bc0('0x1c6')]('Contact\x20updated');_0x38989e[_0x2bc0('0xac')](_0x34267e);});}}else{_0x34267e[_0x2bc0('0x5e')]+=0x1;_0x38989e[_0x2bc0('0xac')](_0x34267e);if(_0x34267e['dialRecallInQueue']){_0x38989e[_0x2bc0('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a4dbd['ContactId'],'ListId':_0x5a4dbd[_0x2bc0('0x117')],'VoiceQueueId':_0x5a4dbd[_0x2bc0('0x10c')]||undefined,'CampaignId':_0x5a4dbd['CampaignId']||undefined})[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x1c7')));_0x38989e[_0x2bc0('0xc3')](createObjHistory(_0x34267e,_0x5a4dbd,_0x2bc0('0x1c8'),0x17,_0x2bc0('0x1c9')))[_0x2bc0('0xaa')](loggerCatch(_0x2bc0('0x1ca')));}else{_0x38989e[_0x2bc0('0xd2')](createObjHistory(_0x34267e,_0x5a4dbd,_0x2bc0('0x1cb'),0x16,'RecallFailedTimeout'),_0x2bc0('0x1cc'),_0x2bc0('0x1cd'));}}}}else{_0x34267e['outboundBlacklistCallsDay']+=0x1;_0x38989e[_0x2bc0('0xd2')](createObjHistory(_0x34267e,_0x5a4dbd,_0x2bc0('0x1ce'),0xd,_0x2bc0('0x1cf')),'[Originate][historyBlacklist]',_0x2bc0('0x1d0'));throw _0x2bc0('0x1d1');}};};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x13a')]=function(_0x488d52){var _0x17c6ce=this;var _0x297fb1=[];var _0x2ea9a0=_0x488d52[_0x2bc0('0x1d2')]-_0x488d52[_0x2bc0('0x93')]-_0x488d52[_0x2bc0('0x1d3')];emitCampaignSummary(_0x488d52);if(_0x2ea9a0>0x0){if(_0x2ea9a0>this[_0x2bc0('0x21')]){_0x2ea9a0=this[_0x2bc0('0x21')];}_0x488d52[_0x2bc0('0x1d3')]+=_0x2ea9a0;this[_0x2bc0('0xbe')](_0x488d52['id'],_0x2ea9a0,_0x488d52[_0x2bc0('0x1d4')])['then'](function(_0x346548){_0x488d52[_0x2bc0('0x1d3')]-=_0x2ea9a0;_0x488d52['temp']=_0x488d52['temp']>0x0?_0x488d52[_0x2bc0('0x1d3')]:0x0;if(!checkContactEmpty(_0x346548)){_0x488d52[_0x2bc0('0x36')]=_0x2bc0('0x98');logger[_0x2bc0('0x75')](_0x2bc0('0x1d5')+_0x488d52[_0x2bc0('0x37')]);}else{_0x488d52[_0x2bc0('0x93')]+=_0x346548[_0x2bc0('0x92')];_0x488d52['message']='RUNNING';for(var _0x12de7b=0x0;_0x12de7b<_0x346548['length'];_0x12de7b+=0x1){_0x488d52['ivrTotalCallsDays']+=0x1;if(_[_0x2bc0('0xa6')](_0x346548[_0x12de7b])||_['isNil'](_0x346548[_0x12de7b][_0x2bc0('0x148')])||_['isNil'](_0x346548[_0x12de7b][_0x2bc0('0x148')]['phone'])){_0x17c6ce[_0x2bc0('0xc8')](_0x2bc0('0x1d6'),_0x488d52,_0x346548[_0x12de7b]);}else{_0x17c6ce[_0x2bc0('0xb5')](_[_0x2bc0('0xca')](_0x346548[_0x12de7b],['CampaignId',_0x2bc0('0x1d7')]))['then'](_0x17c6ce[_0x2bc0('0x1d8')](_0x488d52,_0x346548[_0x12de7b]))['catch'](_0x17c6ce['loggerHandler']('[actionOriginateIvr]\x20',_0x488d52));}}}})[_0x2bc0('0xaa')](loggerGetContactDialer(_0x2bc0('0x1d9'),_0x488d52,_0x2ea9a0));}};Dialer[_0x2bc0('0xa0')]['handlePower']=function(_0x4138fd,_0x5d3cc0){var _0x23bce5=this;var _0xeaf19d=[];var _0x5a2900=_0x5d3cc0>=0x1?_0x5d3cc0:0x1;var _0x4f6dea=[];if(_0x4138fd[_0x2bc0('0x54')]==='booked'){_0x5a2900=0x1;}var _0x2d5d15=Math[_0x2bc0('0x19f')](_0x4138fd[_0x2bc0('0x48')]*_0x5a2900)-_0x4138fd[_0x2bc0('0x93')]-_0x4138fd[_0x2bc0('0x1d3')];emitVoiceQueueSummary(_0x4138fd);if(_0x4138fd[_0x2bc0('0x1da')]>0x0){var _0x9935e9=_0x4138fd[_0x2bc0('0x1da')]-_0x4138fd[_0x2bc0('0x93')]-_0x4138fd['talking']-_0x4138fd['temp']-_0x4138fd[_0x2bc0('0x4a')];if(_0x2d5d15>_0x9935e9){_0x2d5d15=_0x9935e9;}}if(_0x2d5d15>0x0){if(_0x4138fd[_0x2bc0('0x54')]===_0x2bc0('0x6')){_0x2d5d15=0x1;}if(_0x2d5d15>this[_0x2bc0('0x21')]){_0x2d5d15=this[_0x2bc0('0x21')];}_0x4138fd[_0x2bc0('0x1d3')]+=_0x2d5d15;for(var _0x359308 in this['agents']){if(this[_0x2bc0('0x1f')][_0x2bc0('0xa5')](_0x359308)){if(this['agents'][_0x359308][_0x2bc0('0x9e')]===_0x2bc0('0x1db')&&this[_0x2bc0('0x1f')][_0x359308]['status']===_0x2bc0('0xd1')){_0xeaf19d[_0x2bc0('0x128')](this['agents'][_0x359308]['id']);}}}this[_0x2bc0('0xbc')](_0x4138fd['id'],_0xeaf19d,_0x2d5d15,_0x4138fd[_0x2bc0('0x1d4')])['then'](function(_0x36224c){_0x4138fd[_0x2bc0('0x1d3')]-=_0x2d5d15;_0x4138fd[_0x2bc0('0x1d3')]=_0x4138fd['temp']>0x0?_0x4138fd[_0x2bc0('0x1d3')]:0x0;if(!checkContactEmpty(_0x36224c)){_0x23bce5['countReScheduled'](_0x4138fd)[_0x2bc0('0xb1')](sendMessageReschedule(_0x4138fd))['catch'](loggerCatch(_0x2bc0('0x1dc')));}else{_0x4138fd[_0x2bc0('0x93')]+=_0x36224c[_0x2bc0('0x92')];_0x4138fd['message']=_0x4138fd[_0x2bc0('0x54')]===_0x2bc0('0x6')?_0x2bc0('0x151'):_0x2bc0('0x1dd');for(var _0x1ca269=0x0;_0x1ca269<_0x36224c[_0x2bc0('0x92')];_0x1ca269+=0x1){if(_[_0x2bc0('0xa6')](_0x36224c[_0x1ca269])||_[_0x2bc0('0xa6')](_0x36224c[_0x1ca269][_0x2bc0('0x148')])||_[_0x2bc0('0xa6')](_0x36224c[_0x1ca269][_0x2bc0('0x148')]['phone'])){_0x23bce5[_0x2bc0('0xc8')](_0x2bc0('0x1d6'),_0x4138fd,_0x36224c[_0x1ca269]);}else{_0x23bce5[_0x2bc0('0xb3')](_['pick'](_0x36224c[_0x1ca269],[_0x2bc0('0x10c'),_0x2bc0('0x1d7')]))[_0x2bc0('0xb1')](_0x23bce5[_0x2bc0('0x1d8')](_0x4138fd,_0x36224c[_0x1ca269]))['catch'](_0x23bce5['loggerHandler'](_0x2bc0('0x1d6'),_0x4138fd));}}}})['catch'](loggerGetContactDialer(_0x2bc0('0x1de'),_0x4138fd,_0x2d5d15));}};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x89')]=function(_0x4fd897){var _0x2137c4=this;if(_0x4fd897[_0x2bc0('0x1da')]>0x0){var _0x81fab0=_0x4fd897[_0x2bc0('0x1da')]-_0x4fd897[_0x2bc0('0x93')]-_0x4fd897[_0x2bc0('0x4e')];if(_0x81fab0>0x0){this[_0x2bc0('0x1df')](_0x4fd897);}else{loggerPredictiveCalls[_0x2bc0('0x75')](_0x2bc0('0x1e0'));}}else{this[_0x2bc0('0x1df')](_0x4fd897);}};Dialer[_0x2bc0('0xa0')][_0x2bc0('0x1df')]=function(_0x56e7d4){var _0x36c6f9=this;var _0x14eafa=[];_0x56e7d4[_0x2bc0('0x93')]+=0x1;for(var _0x409f53 in this[_0x2bc0('0x1f')]){if(this[_0x2bc0('0x1f')]['hasOwnProperty'](_0x409f53)){if(this[_0x2bc0('0x1f')][_0x409f53]['state']===_0x2bc0('0x1db')&&this['agents'][_0x409f53]['status']===_0x2bc0('0xd1')){_0x14eafa['push'](this[_0x2bc0('0x1f')][_0x409f53]['id']);}}}this['getContactDialer'](_0x56e7d4['id'],_0x14eafa,0x1,_0x56e7d4['dialOrderByScheduledAt'])[_0x2bc0('0xb1')](function(_0x24d19d){if(!checkContactEmpty(_0x24d19d)){checkContactLowerLimitOriginate(_0x56e7d4,0x1,0x0);_0x36c6f9[_0x2bc0('0xb2')](_0x56e7d4)['then'](sendMessageReschedule(_0x56e7d4))['catch'](loggerCatch(_0x2bc0('0x1dc')));}else{_0x56e7d4[_0x2bc0('0x36')]=_0x2bc0('0x1dd');if(_[_0x2bc0('0xa6')](_0x24d19d[0x0])||_['isNil'](_0x24d19d[0x0][_0x2bc0('0x148')])||_[_0x2bc0('0xa6')](_0x24d19d[0x0]['Contact'][_0x2bc0('0x149')])){_0x36c6f9[_0x2bc0('0xc8')]('[actionOriginate]\x20',_0x56e7d4,_0x24d19d[0x0]);}else{_0x36c6f9[_0x2bc0('0xb3')](_['pick'](_0x24d19d[0x0],[_0x2bc0('0x10c'),_0x2bc0('0x1d7')]))[_0x2bc0('0xb1')](_0x36c6f9['checkContactBlack'](_0x56e7d4,_0x24d19d[0x0]))[_0x2bc0('0xaa')](_0x36c6f9[_0x2bc0('0xc7')]('[actionOriginatePredictive]\x20',_0x56e7d4));}}})[_0x2bc0('0xaa')](loggerGetContactDialer(_0x2bc0('0x1e1'),_0x56e7d4,0x1));emitVoiceQueueSummary(_0x56e7d4);};Dialer[_0x2bc0('0xa0')]['abandonmentRate']=function(_0x3f36eb,_0x58c31d,_0xba2cd2,_0xff7725,_0xd38630,_0x2af6d0){loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e2'));loggerPredictive['info'](_0x2bc0('0x1e3'),_0x3f36eb);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e4'),_0x58c31d);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e5'),_0xba2cd2);loggerPredictive['info'](_0x2bc0('0x1e6'),_0xff7725);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e7'),_0xd38630);loggerPredictive[_0x2bc0('0x75')]('---------------------------');return new BPromise(function(_0x170aed,_0x522df0){if(_0x3f36eb<=0x0||isNaN(_0x3f36eb)){return _0x522df0(msgResponse('[abandonmentRate]',_0x2bc0('0x174'),_0x2bc0('0x1e8')+_0x3f36eb));}if(_0xba2cd2<=0x0||isNaN(_0xba2cd2)){return _0x522df0(msgResponse(_0x2bc0('0x1e9'),'Error',_0x2bc0('0x1ea')+_0xba2cd2));}if(_0xff7725<=0x0||isNaN(_0xff7725)){return _0x522df0(msgResponse('[abandonmentRate]',_0x2bc0('0x174'),_0x2bc0('0x1eb')+_0xff7725));}if(_0x58c31d<=0x0||isNaN(_0x58c31d)){return _0x522df0(msgResponse(_0x2bc0('0x1e9'),_0x2bc0('0x174'),_0x2bc0('0x1ec')+_0x58c31d));}if(_0xd38630<=0x0||isNaN(_0xd38630)){return _0x522df0(msgResponse(_0x2bc0('0x1e9'),_0x2bc0('0x174'),_0x2bc0('0x1ed')+_0xd38630));}_0x2af6d0=_0x2af6d0||0x0;var _0x406e23=0x1/_0xba2cd2;var _0xef0f7f=0x0;var _0x410314=0x0;var _0x5636c3=0x0;var _0x45e54e=0x0;for(var _0x495cf3=0x0;_0x5636c3<_0xd38630;_0x495cf3+=0x1){_0x410314=_0x495cf3/_0x58c31d;_0xef0f7f=(_0xff7725*_0x410314+_0x2af6d0)/_0x406e23;_0x5636c3=erlangb(_0xef0f7f,_0x3f36eb);_0x45e54e=_0xef0f7f/_0x3f36eb*(0x1-erlangb(_0xef0f7f,_0x3f36eb));}return _0x170aed({'erlangCalls':_0x495cf3,'erlangCallToSecond':_0x58c31d/_0x495cf3,'erlangAbandonmentRate':_0x5636c3,'erlangBusyFactor':_0x45e54e});});};Dialer['prototype'][_0x2bc0('0x1ba')]=function(_0x36fa8c,_0x1da6cf,_0x2fd0a1,_0x36a7b7,_0x4b1434,_0x5d3ab7){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e3'),_0x36fa8c);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e4'),_0x1da6cf);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e5'),_0x2fd0a1);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1e6'),_0x36a7b7);loggerPredictive[_0x2bc0('0x75')](_0x2bc0('0x1ee'),_0x4b1434);loggerPredictive[_0x2bc0('0x75')]('---------------------------');return new BPromise(function(_0x3744c7,_0x2218d5){if(_0x36fa8c<=0x0||isNaN(_0x36fa8c)){return _0x2218d5(msgResponse(_0x2bc0('0x1ef'),_0x2bc0('0x174'),_0x2bc0('0x1e8')+_0x36fa8c));}if(_0x2fd0a1<=0x0||isNaN(_0x2fd0a1)){return _0x2218d5(msgResponse(_0x2bc0('0x1ef'),_0x2bc0('0x174'),_0x2bc0('0x1ea')+_0x2fd0a1));}if(_0x36a7b7<=0x0||isNaN(_0x36a7b7)){return _0x2218d5(msgResponse(_0x2bc0('0x1ef'),_0x2bc0('0x174'),_0x2bc0('0x1eb')+_0x36a7b7));}if(_0x1da6cf<=0x0||isNaN(_0x1da6cf)){return _0x2218d5(msgResponse(_0x2bc0('0x1ef'),_0x2bc0('0x174'),_0x2bc0('0x1ec')+_0x1da6cf));}if(_0x4b1434<=0x0||isNaN(_0x4b1434)){return _0x2218d5(msgResponse('[busyFactor]','Error',_0x2bc0('0x1f0')+_0x4b1434));}_0x5d3ab7=_0x5d3ab7||0x0;var _0x2b2c78=0x1/_0x2fd0a1;var _0x291d28=0x0;var _0x54dbc6=0x0;var _0x35d588=0x0;var _0x43e7d5=0x0;for(var _0xdb2395=0x0;_0x43e7d5<_0x4b1434;_0xdb2395+=0x1){_0x54dbc6=_0xdb2395/_0x1da6cf;_0x291d28=(_0x36a7b7*_0x54dbc6+_0x5d3ab7)/_0x2b2c78;_0x35d588=erlangb(_0x291d28,_0x36fa8c);_0x43e7d5=_0x291d28/_0x36fa8c*(0x1-erlangb(_0x291d28,_0x36fa8c));}return _0x3744c7({'erlangCalls':_0xdb2395,'erlangCallToSecond':_0x1da6cf/_0xdb2395,'erlangAbandonmentRate':_0x35d588,'erlangBusyFactor':_0x43e7d5});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index dfb782d..1902e2e 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91ba=['lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x40d2e4,_0x510171){var _0x8b84d1=function(_0x577bed){while(--_0x577bed){_0x40d2e4['push'](_0x40d2e4['shift']());}};_0x8b84d1(++_0x510171);}(_0x91ba,0x74));var _0xa91b=function(_0x29b19c,_0x4cec8c){_0x29b19c=_0x29b19c-0x0;var _0xb5e339=_0x91ba[_0x29b19c];return _0xb5e339;};'use strict';var util=require(_0xa91b('0x0'));var _=require(_0xa91b('0x1'));var moment=require(_0xa91b('0x2'));function getSeconds(_0x1468cb,_0x32292d){var _0x55d590=moment(_0x1468cb)[_0xa91b('0x3')](0x0);var _0x4916b9=moment(_0x32292d)['milliseconds'](0x0);return _0x55d590[_0xa91b('0x4')](_0x4916b9,_0xa91b('0x5'));}function QueueCallerAbandon(_0x15ed87,_0xec73fc){this['scheduledat']=_0x15ed87[_0xa91b('0x6')];this['type']=_0x15ed87['type'];this['campaigntype']=_0x15ed87[_0xa91b('0x7')]===_0xa91b('0x8')?_0xa91b('0x9'):_0x15ed87[_0xa91b('0x7')];this[_0xa91b('0xa')]=_0x15ed87[_0xa91b('0xa')];this[_0xa91b('0xb')]=_0x15ed87['countcongestionretry'];this['countnoanswerretry']=_0x15ed87[_0xa91b('0xc')];this[_0xa91b('0xd')]=_0x15ed87[_0xa91b('0xa')]+_0x15ed87['countcongestionretry']+_0x15ed87[_0xa91b('0xc')];this[_0xa91b('0xe')]=_0xec73fc[_0xa91b('0xe')];this[_0xa91b('0xf')]=_0x15ed87[_0xa91b('0x10')];this[_0xa91b('0x11')]=_0x15ed87[_0xa91b('0x12')];this[_0xa91b('0x13')]=_0x15ed87[_0xa91b('0x13')];this[_0xa91b('0x14')]=_0x15ed87[_0xa91b('0x14')];this[_0xa91b('0x15')]=_0x15ed87[_0xa91b('0x15')];this['endtime']=this[_0xa91b('0x15')];this[_0xa91b('0x16')]=getSeconds(_0x15ed87[_0xa91b('0x14')],_0x15ed87[_0xa91b('0x13')]);this[_0xa91b('0x17')]=getSeconds(this[_0xa91b('0x15')],_0x15ed87[_0xa91b('0x14')]);this[_0xa91b('0x18')]=0x0;this[_0xa91b('0x9')]=_0xec73fc[_0xa91b('0x9')];this[_0xa91b('0x19')]=_0xec73fc[_0xa91b('0x1a')];this[_0xa91b('0x1b')]=_0xec73fc[_0xa91b('0x1b')];this['callback']=_0x15ed87[_0xa91b('0x1c')];this[_0xa91b('0x1d')]=_0x15ed87[_0xa91b('0x1d')];this[_0xa91b('0x1e')]=_0x15ed87[_0xa91b('0x1e')];this[_0xa91b('0x1f')]=_0x15ed87[_0xa91b('0x1f')];this['ContactId']=_0x15ed87['ContactId'];this[_0xa91b('0x20')]=_0x15ed87[_0xa91b('0x20')];this[_0xa91b('0x21')]=_0x15ed87[_0xa91b('0x21')];this[_0xa91b('0x22')]=_0x15ed87[_0xa91b('0x22')];this[_0xa91b('0x23')]=_0x15ed87['CampaignId'];this[_0xa91b('0x24')]=_0x15ed87[_0xa91b('0x24')]||'';this[_0xa91b('0x25')]=_0x15ed87[_0xa91b('0x25')]||'';}module[_0xa91b('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x68f8=['number','starttime','responsetime','endtime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name'];(function(_0x23b922,_0x222c30){var _0x4a98b0=function(_0x266307){while(--_0x266307){_0x23b922['push'](_0x23b922['shift']());}};_0x4a98b0(++_0x222c30);}(_0x68f8,0x1e9));var _0x868f=function(_0x4d2d86,_0x53aeda){_0x4d2d86=_0x4d2d86-0x0;var _0x3fcd6d=_0x68f8[_0x4d2d86];return _0x3fcd6d;};'use strict';var util=require(_0x868f('0x0'));var _=require(_0x868f('0x1'));var moment=require(_0x868f('0x2'));function getSeconds(_0x1cb381,_0x1daeb8){var _0x5ecb5e=moment(_0x1cb381)[_0x868f('0x3')](0x0);var _0x52d334=moment(_0x1daeb8)['milliseconds'](0x0);return _0x5ecb5e[_0x868f('0x4')](_0x52d334,_0x868f('0x5'));}function QueueCallerAbandon(_0x4bfe61,_0xf85e0){this[_0x868f('0x6')]=_0x4bfe61[_0x868f('0x6')];this['type']=_0x4bfe61[_0x868f('0x7')];this[_0x868f('0x8')]=_0x4bfe61[_0x868f('0x7')]===_0x868f('0x9')?_0x868f('0xa'):_0x4bfe61[_0x868f('0x7')];this['countbusyretry']=_0x4bfe61[_0x868f('0xb')];this['countcongestionretry']=_0x4bfe61[_0x868f('0xc')];this[_0x868f('0xd')]=_0x4bfe61[_0x868f('0xd')];this[_0x868f('0xe')]=_0x4bfe61[_0x868f('0xb')]+_0x4bfe61[_0x868f('0xc')]+_0x4bfe61['countnoanswerretry'];this[_0x868f('0xf')]=_0xf85e0[_0x868f('0xf')];this[_0x868f('0x10')]=_0x4bfe61[_0x868f('0x11')];this['calleridnum']=_0x4bfe61[_0x868f('0x12')];this[_0x868f('0x13')]=_0x4bfe61['starttime'];this[_0x868f('0x14')]=_0x4bfe61[_0x868f('0x14')];this['droptime']=_0x4bfe61['droptime'];this[_0x868f('0x15')]=this[_0x868f('0x16')];this[_0x868f('0x17')]=getSeconds(_0x4bfe61['responsetime'],_0x4bfe61[_0x868f('0x13')]);this[_0x868f('0x18')]=getSeconds(this[_0x868f('0x16')],_0x4bfe61[_0x868f('0x14')]);this[_0x868f('0x19')]=0x0;this[_0x868f('0xa')]=_0xf85e0[_0x868f('0xa')];this[_0x868f('0x1a')]=_0xf85e0[_0x868f('0x1b')];this['reason']=_0xf85e0['reason'];this[_0x868f('0x1c')]=_0x4bfe61['callback'];this[_0x868f('0x1d')]=_0x4bfe61[_0x868f('0x1d')];this[_0x868f('0x1e')]=_0x4bfe61['callbackat'];this['recallme']=_0x4bfe61['recallme'];this['ContactId']=_0x4bfe61[_0x868f('0x1f')];this[_0x868f('0x20')]=_0x4bfe61['ListId'];this['UserId']=_0x4bfe61[_0x868f('0x21')];this['VoiceQueueId']=_0x4bfe61[_0x868f('0x22')];this[_0x868f('0x23')]=_0x4bfe61[_0x868f('0x23')];this['originatecalleridnum']=_0x4bfe61[_0x868f('0x24')]||'';this[_0x868f('0x25')]=_0x4bfe61['originatecalleridname']||'';}module[_0x868f('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index eb597c6..0edafe9 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 _0x2b8a=['exports','util','lodash','uniqueid','channel','format','tech','Trunk','localstationid','headerinfo','path','AttachmentId'];(function(_0x538406,_0x25c40b){var _0x18f8fd=function(_0x52ff7f){while(--_0x52ff7f){_0x538406['push'](_0x538406['shift']());}};_0x18f8fd(++_0x25c40b);}(_0x2b8a,0x9d));var _0xa2b8=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x2b8a[_0x49d41c];return _0xb64c5f;};'use strict';var util=require(_0xa2b8('0x0'));var _=require(_0xa2b8('0x1'));var moment=require('moment');function Action(_0x3e6350,_0x241ced,_0x5d74bc){this[_0xa2b8('0x2')]=_0x3e6350||undefined;this[_0xa2b8('0x3')]=util[_0xa2b8('0x4')]('%s/%s/%s',_0x241ced[_0xa2b8('0x5')],_0x241ced[_0xa2b8('0x6')]['name'],_0x5d74bc['fax']);this[_0xa2b8('0x7')]=_0x241ced[_0xa2b8('0x7')];this[_0xa2b8('0x8')]=_0x241ced[_0xa2b8('0x8')];this[_0xa2b8('0x9')]=_0x5d74bc[_0xa2b8('0x9')];this['AttachmentId']=_0x5d74bc[_0xa2b8('0xa')];}module[_0xa2b8('0xb')]=Action; \ No newline at end of file +var _0x04d3=['fax','localstationid','path','AttachmentId','util','lodash','moment','channel','format','%s/%s/%s','Trunk','name'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x04d3,0x154));var _0x304d=function(_0x5d21e4,_0x20e74c){_0x5d21e4=_0x5d21e4-0x0;var _0x39c0da=_0x04d3[_0x5d21e4];return _0x39c0da;};'use strict';var util=require(_0x304d('0x0'));var _=require(_0x304d('0x1'));var moment=require(_0x304d('0x2'));function Action(_0x8773ff,_0xa6cd88,_0x588094){this['uniqueid']=_0x8773ff||undefined;this[_0x304d('0x3')]=util[_0x304d('0x4')](_0x304d('0x5'),_0xa6cd88['tech'],_0xa6cd88[_0x304d('0x6')][_0x304d('0x7')],_0x588094[_0x304d('0x8')]);this[_0x304d('0x9')]=_0xa6cd88[_0x304d('0x9')];this['headerinfo']=_0xa6cd88['headerinfo'];this[_0x304d('0xa')]=_0x588094[_0x304d('0xa')];this['AttachmentId']=_0x588094[_0x304d('0xb')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 62cef0b..96650c8 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 _0x45b7=['[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','message','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','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]'];(function(_0x205bb5,_0x4e057e){var _0x53fb94=function(_0x37f5f0){while(--_0x37f5f0){_0x205bb5['push'](_0x205bb5['shift']());}};_0x53fb94(++_0x4e057e);}(_0x45b7,0x190));var _0x745b=function(_0x2e079d,_0x599552){_0x2e079d=_0x2e079d-0x0;var _0x45e51f=_0x45b7[_0x2e079d];return _0x45e51f;};'use strict';var util=require(_0x745b('0x0'));var _=require('lodash');var BPromise=require(_0x745b('0x1'));var uuid=require('uuid');var moment=require(_0x745b('0x2'));var path=require(_0x745b('0x3'));var tiff2pdf=require(_0x745b('0x4'));var gs=require(_0x745b('0x5'));var logger=require(_0x745b('0x6'))(_0x745b('0x7'));var ami=require(_0x745b('0x8'));var rpcDb=require(_0x745b('0x9'));var Channel=require(_0x745b('0xa'));var ut=require('./util/util');var Action=require(_0x745b('0xb'));var faxAccount=require(_0x745b('0xc'));var attachment=require(_0x745b('0xd'));var faxMessage=require(_0x745b('0xe'));function Fax(_0x55a07f){this['channels']={};this[_0x745b('0xf')]=_0x55a07f[_0x745b('0xf')];this[_0x745b('0x10')]=_0x55a07f[_0x745b('0x10')];this['actions']={};ami['on'](_0x745b('0x11'),this[_0x745b('0x12')]['bind'](this));ami['on'](_0x745b('0x13'),this[_0x745b('0x14')]['bind'](this));ami['on'](_0x745b('0x15'),this[_0x745b('0x16')][_0x745b('0x17')](this));ami['on']('newexten',this['syncNewExten'][_0x745b('0x17')](this));ami['on'](_0x745b('0x18'),this[_0x745b('0x19')]['bind'](this));ami['on'](_0x745b('0x1a'),this[_0x745b('0x1b')][_0x745b('0x17')](this));ami['on']('hangup',this[_0x745b('0x1c')]['bind'](this));ami['on']('originateresponse',this[_0x745b('0x1d')][_0x745b('0x17')](this));}Fax['prototype'][_0x745b('0x12')]=function(_0x5a1a0d){if(_0x5a1a0d['context']===_0x745b('0x1e')){for(var _0x46133a in this[_0x745b('0xf')]){if(this[_0x745b('0xf')][_0x745b('0x1f')](_0x46133a)){if(_0x5a1a0d[_0x745b('0x20')]===this[_0x745b('0xf')][_0x46133a]['localstationid']){this[_0x745b('0x21')][_0x5a1a0d['uniqueid']]={};this[_0x745b('0x21')][_0x5a1a0d[_0x745b('0x22')]][_0x745b('0x23')]=_0x5a1a0d[_0x745b('0x23')];this['channels'][_0x5a1a0d[_0x745b('0x22')]]['id']=this[_0x745b('0xf')][_0x46133a]['id'];this[_0x745b('0x21')][_0x5a1a0d['uniqueid']][_0x745b('0x24')]=this['faxAccounts'][_0x46133a][_0x745b('0x24')];logger[_0x745b('0x25')](_0x5a1a0d[_0x745b('0x22')],_0x745b('0x26'));}}}}if(this[_0x745b('0x27')][_0x5a1a0d['uniqueid']]){this[_0x745b('0x21')][_0x5a1a0d[_0x745b('0x22')]]={};this[_0x745b('0x21')][_0x5a1a0d[_0x745b('0x22')]]['channel']=_0x5a1a0d['channel'];logger[_0x745b('0x25')](_0x5a1a0d[_0x745b('0x22')],_0x745b('0x26'));}};Fax[_0x745b('0x28')][_0x745b('0x14')]=function(_0x5b86c7){if(this[_0x745b('0x21')][_0x5b86c7[_0x745b('0x22')]]){for(var _0x10d55f in _0x5b86c7[_0x745b('0x29')]){if(_0x5b86c7[_0x745b('0x29')][_0x745b('0x1f')](_0x10d55f)){this[_0x745b('0x21')][_0x5b86c7[_0x745b('0x22')]][_0x10d55f]=_0x5b86c7[_0x745b('0x2a')];}}}};Fax['prototype'][_0x745b('0x16')]=function(_0x2f3af2){if(this['channels'][_0x2f3af2[_0x745b('0x22')]]){this[_0x745b('0x21')][_0x2f3af2[_0x745b('0x22')]][_0x745b('0x2b')]=_0x2f3af2['channelstate'];this[_0x745b('0x21')][_0x2f3af2[_0x745b('0x22')]][_0x745b('0x2c')]=_0x2f3af2[_0x745b('0x2c')];}};Fax[_0x745b('0x28')][_0x745b('0x2d')]=function(_0x4ed280){if(this[_0x745b('0x21')][_0x4ed280[_0x745b('0x22')]]){for(var _0x559b66 in _0x4ed280['variable']){if(_0x4ed280[_0x745b('0x29')][_0x745b('0x1f')](_0x559b66)){this[_0x745b('0x21')][_0x4ed280[_0x745b('0x22')]][_0x559b66]=_0x4ed280[_0x745b('0x2a')];}}}};Fax[_0x745b('0x28')]['syncFaxStatus']=function(_0x36e56f){if(this[_0x745b('0x21')][_0x36e56f[_0x745b('0x22')]]){this[_0x745b('0x21')][_0x36e56f[_0x745b('0x22')]]['operation']=_0x36e56f[_0x745b('0x2e')];this[_0x745b('0x21')][_0x36e56f['uniqueid']]['status']=_0x36e56f[_0x745b('0x2f')];this[_0x745b('0x21')][_0x36e56f['uniqueid']][_0x745b('0x30')]=_0x36e56f[_0x745b('0x30')];this[_0x745b('0x21')][_0x36e56f[_0x745b('0x22')]][_0x745b('0x31')]=_0x36e56f[_0x745b('0x31')];logger[_0x745b('0x25')](_0x36e56f['uniqueid'],_0x745b('0x32'));}};Fax[_0x745b('0x28')][_0x745b('0x1b')]=function(_0x54d2e7){var _0x2d56cb=this;if(this[_0x745b('0x21')][_0x54d2e7['uniqueid']]){var _0xa27e67=this[_0x745b('0x21')][_0x54d2e7[_0x745b('0x22')]]['id'];this['channels'][_0x54d2e7[_0x745b('0x22')]]['remotestationid']=_0x54d2e7[_0x745b('0x33')];this['channels'][_0x54d2e7[_0x745b('0x22')]]['pagestransferred']=_0x54d2e7['pagestransferred'];this['channels'][_0x54d2e7[_0x745b('0x22')]][_0x745b('0x30')]=_0x54d2e7[_0x745b('0x30')];this['channels'][_0x54d2e7[_0x745b('0x22')]][_0x745b('0x34')]=_0x54d2e7[_0x745b('0x34')];this[_0x745b('0x21')][_0x54d2e7[_0x745b('0x22')]][_0x745b('0x35')]=_0x54d2e7[_0x745b('0x35')];this[_0x745b('0x21')][_0x54d2e7[_0x745b('0x22')]][_0x745b('0x31')]=_0x54d2e7[_0x745b('0x31')];this['channels'][_0x54d2e7['uniqueid']][_0x745b('0x36')]=_0x54d2e7[_0x745b('0x36')];if(this[_0x745b('0x21')][_0x54d2e7[_0x745b('0x22')]][_0x745b('0x37')]>0x0){tiff2pdf(_0x54d2e7[_0x745b('0x31')],_0x745b('0x38'),function(_0x49cf5b){logger['info'](_0x54d2e7[_0x745b('0x22')],_0x745b('0x39'),_0x49cf5b['message']);attachment['create']({'name':path[_0x745b('0x3a')](_0x54d2e7[_0x745b('0x31')])[_0x745b('0x24')],'basename':path[_0x745b('0x3a')](_0x54d2e7[_0x745b('0x31')])[_0x745b('0x24')]+_0x745b('0x3b'),'type':_0x745b('0x3c')})[_0x745b('0x3d')](function(_0x47a41c){faxAccount['notify'](_0xa27e67,{'from':_0x54d2e7[_0x745b('0x36')],'mapKey':_0x745b('0x7'),'body':path[_0x745b('0x3a')](_0x54d2e7[_0x745b('0x31')])[_0x745b('0x24')]+_0x745b('0x3b'),'AttachmentId':_0x47a41c['id']})['catch'](function(_0x286bef){logger[_0x745b('0x3e')](_0x54d2e7[_0x745b('0x22')],_0x745b('0x3f'),JSON['stringify'](_0x286bef));});})[_0x745b('0x40')](function(_0x55a1e2){logger[_0x745b('0x3e')](_0x54d2e7[_0x745b('0x22')],_0x745b('0x41'),JSON[_0x745b('0x42')](_0x55a1e2));});});}logger[_0x745b('0x25')](_0x54d2e7['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x745b('0x28')]['syncOriginateResponse']=function(_0x25323e){if(this[_0x745b('0x27')][_0x25323e[_0x745b('0x22')]]){_[_0x745b('0x43')](this['channels'][_0x25323e['uniqueid']],_[_0x745b('0x44')](_0x25323e,[_0x745b('0x45'),_0x745b('0x46')]));}};function updateStatus(_0x169897){if(_0x169897[_0x745b('0x47')]){faxMessage[_0x745b('0x48')](_0x169897['AttachmentId'],{'failMessage':_0x745b('0x49')})[_0x745b('0x3d')](function(_0x8518fc){ut[_0x745b('0x4a')]('[Fax][Message][Error][Updated]',_0x8518fc);})[_0x745b('0x40')](function(_0x4798b8){ut[_0x745b('0x4a')](_0x745b('0x4b'),_0x4798b8);});}else{ut[_0x745b('0x4a')](_0x745b('0x4c'));}}Fax[_0x745b('0x28')][_0x745b('0x4d')]=function(_0x48cbba,_0x23c61a,_0xaa2504){var _0x49c690=this;var _0x1027e1={};if(_0x23c61a){_0x1027e1={'read':_0x23c61a};}else{_0x1027e1={'failMessage':_0xaa2504};}if(this[_0x745b('0x27')][_0x48cbba]['AttachmentId']){faxMessage['update'](this['actions'][_0x48cbba][_0x745b('0x47')],_0x1027e1)[_0x745b('0x3d')](function(_0x1d2096){ut['logger'](_0x745b('0x4e'),_0x1d2096);})[_0x745b('0x40')](function(_0x366e3e){ut['logger'](_0x745b('0x4f'),_0x366e3e);})[_0x745b('0x50')](function(){delete _0x49c690['channels'][_0x48cbba];delete _0x49c690['actions'][_0x48cbba];});}else{ut[_0x745b('0x4a')](_0x745b('0x51'));delete this[_0x745b('0x21')][_0x48cbba];delete this['actions'][_0x48cbba];}};Fax[_0x745b('0x28')][_0x745b('0x1c')]=function(_0x2f34fe){var _0x48bdaf=this;if(this[_0x745b('0x21')][_0x2f34fe[_0x745b('0x22')]]){if(this[_0x745b('0x27')][_0x2f34fe[_0x745b('0x22')]]){this[_0x745b('0x21')][_0x2f34fe[_0x745b('0x22')]]['id']=this[_0x745b('0x27')][_0x2f34fe[_0x745b('0x22')]]['id'];this[_0x745b('0x21')][_0x2f34fe[_0x745b('0x22')]][_0x745b('0x24')]=this[_0x745b('0x27')][_0x2f34fe[_0x745b('0x22')]][_0x745b('0x24')];}logger[_0x745b('0x25')](_0x2f34fe[_0x745b('0x22')],this['actions'][_0x2f34fe[_0x745b('0x22')]]?'\x20hangup\x20sendFile\x20':_0x745b('0x52'),JSON['stringify'](this['channels'][_0x2f34fe[_0x745b('0x22')]]));if(this['actions'][_0x2f34fe['uniqueid']]){if(this[_0x745b('0x21')][_0x2f34fe['uniqueid']][_0x745b('0x53')]>0x0&&this['channels'][_0x2f34fe[_0x745b('0x22')]][_0x745b('0x18')]===_0x745b('0x54')){this[_0x745b('0x4d')](_0x2f34fe[_0x745b('0x22')],!![]);}else{this[_0x745b('0x4d')](_0x2f34fe[_0x745b('0x22')],![],this[_0x745b('0x21')][_0x2f34fe[_0x745b('0x22')]][_0x745b('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x745b('0x21')][_0x2f34fe[_0x745b('0x22')]][_0x745b('0x55')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x745b('0x56')]=function(_0x14d4a8){var _0x31db05=this;return new BPromise(function(_0x13a289,_0x5890af){_0x31db05[_0x745b('0x57')](_0x14d4a8,_0x31db05[_0x745b('0xf')][_0x14d4a8['FaxAccountId']])['then'](function(_0x4c8e44){ut[_0x745b('0x4a')](_0x745b('0x58'),_0x4c8e44);_0x13a289(ut['message'](_0x745b('0x59')));})[_0x745b('0x40')](function(_0x42ca44){ut[_0x745b('0x4a')]('[Fax][execOriginate][failure]',_0x42ca44);updateStatus(_0x14d4a8);_0x5890af(ut['message'](_0x745b('0x5a')));});});};Fax['prototype'][_0x745b('0x5b')]=function(_0x40aa68){var _0x3b17cf=this;return new BPromise(function(_0x194822,_0x271d63){var _0x496ce3=_0x3b17cf[_0x745b('0x5c')](_0x3b17cf[_0x745b('0xf')][_0x40aa68[_0x745b('0x5d')]][_0x745b('0x5e')],_0x40aa68);if(_0x496ce3[_0x745b('0x5f')]){_0x194822(ut['message']('Trunk\x20Reachable'));}else{_0x271d63(ut[_0x745b('0x60')](_0x496ce3['message']));}});};function originate(_0x3a3d57,_0x14893a,_0x55d924){return new BPromise(function(_0x405259,_0x4ee96b){if(_0x55d924){var _0x5e948f=util[_0x745b('0x61')](_0x745b('0x62'),path[_0x745b('0x3a')](_0x3a3d57[_0x745b('0x3')])[_0x745b('0x24')],_0x3a3d57['path']);gs[_0x745b('0x63')](_0x5e948f)[_0x745b('0x3d')](function(){_0x3a3d57[_0x745b('0x3')]=util[_0x745b('0x61')](_0x745b('0x64'),path[_0x745b('0x3a')](_0x3a3d57[_0x745b('0x3')])[_0x745b('0x65')],path[_0x745b('0x3a')](_0x3a3d57['path'])[_0x745b('0x24')]);_0x14893a['XMF-PATH']=_0x3a3d57['path'];ut['logger'](_0x745b('0x66'),'');ami[_0x745b('0x67')](ut['variablesAction'](_0x3a3d57,_0x14893a))[_0x745b('0x3d')](function(_0x451bed){_0x405259(_0x451bed);})[_0x745b('0x40')](function(_0x3c1da3){_0x4ee96b(_0x3c1da3);});})[_0x745b('0x40')](function(_0x547494){_0x4ee96b(_0x547494);});}else{ami[_0x745b('0x67')](ut[_0x745b('0x68')](_0x3a3d57,_0x14893a))[_0x745b('0x3d')](function(_0x36f572){_0x405259(_0x36f572);})[_0x745b('0x40')](function(_0x376e0c){_0x4ee96b(_0x376e0c);});}});}Fax[_0x745b('0x28')]['execOriginate']=function(_0x3e2215,_0x5c00e4){var _0x140579=this;return new BPromise(function(_0x571bb6,_0x4ca6f5){var _0x56e9ea=uuid['v4']();var _0x188a06=ut[_0x745b('0x69')](_0x3e2215,_0x5c00e4);_0x140579['actions'][_0x56e9ea]=new Action(_0x56e9ea,_0x5c00e4,_0x3e2215);var _0x107795=_0x140579[_0x745b('0x27')][_0x56e9ea];if(path[_0x745b('0x3a')](_0x3e2215['path'])[_0x745b('0x6a')]===_0x745b('0x3b')){originate(_0x107795,_0x188a06,!![])[_0x745b('0x3d')](function(_0x58628e){_0x571bb6(_0x58628e);})[_0x745b('0x40')](function(_0xe66cf7){_0x4ca6f5(_0xe66cf7);});}else{originate(_0x107795,_0x188a06,![])[_0x745b('0x3d')](function(_0x48df08){_0x571bb6(_0x48df08);})[_0x745b('0x40')](function(_0x597eeb){_0x4ca6f5(_0x597eeb);});}});};Fax[_0x745b('0x28')]['isTrunkReachable']=function(_0x6e7287){return!_[_0x745b('0x6b')](_0x6e7287)&&!_[_0x745b('0x6b')](_0x6e7287['name'])&&!_[_0x745b('0x6b')](_0x6e7287['active'])&&_0x6e7287[_0x745b('0x6c')]&&!_[_0x745b('0x6b')](this[_0x745b('0x10')][util[_0x745b('0x61')](_0x745b('0x6d'),_0x6e7287[_0x745b('0x24')])])&&!_[_0x745b('0x6b')](this[_0x745b('0x10')][util[_0x745b('0x61')](_0x745b('0x6d'),_0x6e7287['name'])][_0x745b('0x2f')])&&(this['trunks'][util[_0x745b('0x61')](_0x745b('0x6d'),_0x6e7287['name'])]['status']===_0x745b('0x6e')||this[_0x745b('0x10')][util[_0x745b('0x61')](_0x745b('0x6d'),_0x6e7287[_0x745b('0x24')])]['status']===_0x745b('0x6f'));};Fax[_0x745b('0x28')][_0x745b('0x5c')]=function(_0x47944a,_0x47b5b9){if(!this[_0x745b('0x70')](_0x47944a)){ut[_0x745b('0x4a')](_0x745b('0x71'),_[_0x745b('0x6b')](_0x47944a)?'':_0x47944a['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x745b('0x6b')](_0x47b5b9[_0x745b('0x7')])){ut[_0x745b('0x4a')](_0x745b('0x72'),JSON[_0x745b('0x42')](_0x47b5b9));return{'isValid':![],'message':_0x745b('0x73')};}if(_[_0x745b('0x6b')](_0x47b5b9[_0x745b('0x3')])){ut[_0x745b('0x4a')](_0x745b('0x74'),JSON[_0x745b('0x42')](_0x47b5b9));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x745b('0x75')};};module[_0x745b('0x76')]=Fax; \ No newline at end of file +var _0x3b6e=['faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','Trunk','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','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS'];(function(_0x47a7a4,_0x39e0d4){var _0x11cb57=function(_0x16a089){while(--_0x16a089){_0x47a7a4['push'](_0x47a7a4['shift']());}};_0x11cb57(++_0x39e0d4);}(_0x3b6e,0x170));var _0xe3b6=function(_0x352e94,_0x3c1cf3){_0x352e94=_0x352e94-0x0;var _0x40938d=_0x3b6e[_0x352e94];return _0x40938d;};'use strict';var util=require(_0xe3b6('0x0'));var _=require(_0xe3b6('0x1'));var BPromise=require('bluebird');var uuid=require(_0xe3b6('0x2'));var moment=require('moment');var path=require(_0xe3b6('0x3'));var tiff2pdf=require(_0xe3b6('0x4'));var gs=require(_0xe3b6('0x5'));var logger=require(_0xe3b6('0x6'))(_0xe3b6('0x7'));var ami=require('../ami');var rpcDb=require(_0xe3b6('0x8'));var Channel=require(_0xe3b6('0x9'));var ut=require('./util/util');var Action=require(_0xe3b6('0xa'));var faxAccount=require(_0xe3b6('0xb'));var attachment=require(_0xe3b6('0xc'));var faxMessage=require(_0xe3b6('0xd'));function Fax(_0x19794b){this[_0xe3b6('0xe')]={};this[_0xe3b6('0xf')]=_0x19794b[_0xe3b6('0xf')];this['trunks']=_0x19794b[_0xe3b6('0x10')];this[_0xe3b6('0x11')]={};ami['on']('newchannel',this['syncNewchannel'][_0xe3b6('0x12')](this));ami['on'](_0xe3b6('0x13'),this[_0xe3b6('0x14')]['bind'](this));ami['on'](_0xe3b6('0x15'),this[_0xe3b6('0x16')][_0xe3b6('0x12')](this));ami['on'](_0xe3b6('0x17'),this[_0xe3b6('0x18')][_0xe3b6('0x12')](this));ami['on'](_0xe3b6('0x19'),this[_0xe3b6('0x1a')][_0xe3b6('0x12')](this));ami['on'](_0xe3b6('0x1b'),this[_0xe3b6('0x1c')]['bind'](this));ami['on'](_0xe3b6('0x1d'),this['syncHangup']['bind'](this));ami['on'](_0xe3b6('0x1e'),this[_0xe3b6('0x1f')][_0xe3b6('0x12')](this));}Fax[_0xe3b6('0x20')][_0xe3b6('0x21')]=function(_0x2fde77){if(_0x2fde77['context']==='from-voip-provider'){for(var _0x3e4d8b in this['faxAccounts']){if(this[_0xe3b6('0xf')][_0xe3b6('0x22')](_0x3e4d8b)){if(_0x2fde77['exten']===this['faxAccounts'][_0x3e4d8b][_0xe3b6('0x23')]){this[_0xe3b6('0xe')][_0x2fde77['uniqueid']]={};this[_0xe3b6('0xe')][_0x2fde77[_0xe3b6('0x24')]]['channel']=_0x2fde77[_0xe3b6('0x25')];this[_0xe3b6('0xe')][_0x2fde77['uniqueid']]['id']=this[_0xe3b6('0xf')][_0x3e4d8b]['id'];this[_0xe3b6('0xe')][_0x2fde77[_0xe3b6('0x24')]][_0xe3b6('0x26')]=this[_0xe3b6('0xf')][_0x3e4d8b][_0xe3b6('0x26')];logger['info'](_0x2fde77[_0xe3b6('0x24')],_0xe3b6('0x27'));}}}}if(this[_0xe3b6('0x11')][_0x2fde77['uniqueid']]){this[_0xe3b6('0xe')][_0x2fde77[_0xe3b6('0x24')]]={};this[_0xe3b6('0xe')][_0x2fde77[_0xe3b6('0x24')]][_0xe3b6('0x25')]=_0x2fde77['channel'];logger[_0xe3b6('0x28')](_0x2fde77['uniqueid'],_0xe3b6('0x27'));}};Fax[_0xe3b6('0x20')][_0xe3b6('0x14')]=function(_0x3d49cd){if(this[_0xe3b6('0xe')][_0x3d49cd[_0xe3b6('0x24')]]){for(var _0x2d7a14 in _0x3d49cd[_0xe3b6('0x29')]){if(_0x3d49cd[_0xe3b6('0x29')]['hasOwnProperty'](_0x2d7a14)){this['channels'][_0x3d49cd['uniqueid']][_0x2d7a14]=_0x3d49cd[_0xe3b6('0x2a')];}}}};Fax[_0xe3b6('0x20')][_0xe3b6('0x16')]=function(_0x2748e8){if(this[_0xe3b6('0xe')][_0x2748e8[_0xe3b6('0x24')]]){this[_0xe3b6('0xe')][_0x2748e8[_0xe3b6('0x24')]]['channelstate']=_0x2748e8[_0xe3b6('0x2b')];this[_0xe3b6('0xe')][_0x2748e8[_0xe3b6('0x24')]]['channelstatedesc']=_0x2748e8[_0xe3b6('0x2c')];}};Fax[_0xe3b6('0x20')][_0xe3b6('0x18')]=function(_0x34ca59){if(this[_0xe3b6('0xe')][_0x34ca59[_0xe3b6('0x24')]]){for(var _0x51e9ca in _0x34ca59['variable']){if(_0x34ca59[_0xe3b6('0x29')]['hasOwnProperty'](_0x51e9ca)){this['channels'][_0x34ca59[_0xe3b6('0x24')]][_0x51e9ca]=_0x34ca59[_0xe3b6('0x2a')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x258700){if(this['channels'][_0x258700[_0xe3b6('0x24')]]){this[_0xe3b6('0xe')][_0x258700[_0xe3b6('0x24')]][_0xe3b6('0x2d')]=_0x258700[_0xe3b6('0x2d')];this['channels'][_0x258700[_0xe3b6('0x24')]][_0xe3b6('0x2e')]=_0x258700[_0xe3b6('0x2e')];this[_0xe3b6('0xe')][_0x258700[_0xe3b6('0x24')]][_0xe3b6('0x23')]=_0x258700[_0xe3b6('0x23')];this['channels'][_0x258700[_0xe3b6('0x24')]][_0xe3b6('0x2f')]=_0x258700[_0xe3b6('0x2f')];logger[_0xe3b6('0x28')](_0x258700[_0xe3b6('0x24')],_0xe3b6('0x30'));}};Fax['prototype'][_0xe3b6('0x1c')]=function(_0x59ad0c){var _0x40c9e1=this;if(this[_0xe3b6('0xe')][_0x59ad0c[_0xe3b6('0x24')]]){var _0x266b0e=this[_0xe3b6('0xe')][_0x59ad0c['uniqueid']]['id'];this[_0xe3b6('0xe')][_0x59ad0c[_0xe3b6('0x24')]][_0xe3b6('0x31')]=_0x59ad0c['remotestationid'];this[_0xe3b6('0xe')][_0x59ad0c['uniqueid']][_0xe3b6('0x32')]=_0x59ad0c[_0xe3b6('0x32')];this['channels'][_0x59ad0c['uniqueid']][_0xe3b6('0x23')]=_0x59ad0c[_0xe3b6('0x23')];this['channels'][_0x59ad0c['uniqueid']][_0xe3b6('0x33')]=_0x59ad0c[_0xe3b6('0x33')];this[_0xe3b6('0xe')][_0x59ad0c[_0xe3b6('0x24')]]['transferrate']=_0x59ad0c[_0xe3b6('0x34')];this['channels'][_0x59ad0c[_0xe3b6('0x24')]][_0xe3b6('0x2f')]=_0x59ad0c['filename'];this['channels'][_0x59ad0c[_0xe3b6('0x24')]]['calleridnum']=_0x59ad0c[_0xe3b6('0x35')];if(this[_0xe3b6('0xe')][_0x59ad0c[_0xe3b6('0x24')]][_0xe3b6('0x32')]>0x0){tiff2pdf(_0x59ad0c[_0xe3b6('0x2f')],_0xe3b6('0x36'),function(_0x58e66f){logger[_0xe3b6('0x28')](_0x59ad0c[_0xe3b6('0x24')],_0xe3b6('0x37'),_0x58e66f[_0xe3b6('0x38')]);attachment[_0xe3b6('0x39')]({'name':path[_0xe3b6('0x3a')](_0x59ad0c[_0xe3b6('0x2f')])[_0xe3b6('0x26')],'basename':path[_0xe3b6('0x3a')](_0x59ad0c[_0xe3b6('0x2f')])[_0xe3b6('0x26')]+_0xe3b6('0x3b'),'type':_0xe3b6('0x3c')})[_0xe3b6('0x3d')](function(_0x20ff3e){faxAccount[_0xe3b6('0x3e')](_0x266b0e,{'from':_0x59ad0c[_0xe3b6('0x35')],'mapKey':'fax','body':path[_0xe3b6('0x3a')](_0x59ad0c[_0xe3b6('0x2f')])[_0xe3b6('0x26')]+_0xe3b6('0x3b'),'AttachmentId':_0x20ff3e['id']})['catch'](function(_0x52094e){logger['error'](_0x59ad0c[_0xe3b6('0x24')],_0xe3b6('0x3f'),JSON[_0xe3b6('0x40')](_0x52094e));});})[_0xe3b6('0x41')](function(_0x56d2bb){logger['error'](_0x59ad0c['uniqueid'],_0xe3b6('0x42'),JSON['stringify'](_0x56d2bb));});});}logger[_0xe3b6('0x28')](_0x59ad0c['uniqueid'],_0xe3b6('0x42'));}};Fax[_0xe3b6('0x20')][_0xe3b6('0x1f')]=function(_0x23d899){if(this[_0xe3b6('0x11')][_0x23d899[_0xe3b6('0x24')]]){_['merge'](this[_0xe3b6('0xe')][_0x23d899[_0xe3b6('0x24')]],_[_0xe3b6('0x43')](_0x23d899,[_0xe3b6('0x44'),_0xe3b6('0x45')]));}};function updateStatus(_0x3a5101){if(_0x3a5101[_0xe3b6('0x46')]){faxMessage[_0xe3b6('0x47')](_0x3a5101[_0xe3b6('0x46')],{'failMessage':_0xe3b6('0x48')})[_0xe3b6('0x3d')](function(_0x44401c){ut[_0xe3b6('0x49')](_0xe3b6('0x4a'),_0x44401c);})[_0xe3b6('0x41')](function(_0x4c09fc){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x4c09fc);});}else{ut[_0xe3b6('0x49')](_0xe3b6('0x4b'));}}Fax[_0xe3b6('0x20')][_0xe3b6('0x4c')]=function(_0x5c392e,_0x4d818a,_0x4fc16a){var _0xea5e43=this;var _0x4e84cf={};if(_0x4d818a){_0x4e84cf={'read':_0x4d818a};}else{_0x4e84cf={'failMessage':_0x4fc16a};}if(this[_0xe3b6('0x11')][_0x5c392e][_0xe3b6('0x46')]){faxMessage[_0xe3b6('0x47')](this[_0xe3b6('0x11')][_0x5c392e][_0xe3b6('0x46')],_0x4e84cf)[_0xe3b6('0x3d')](function(_0x67c253){ut['logger'](_0xe3b6('0x4d'),_0x67c253);})[_0xe3b6('0x41')](function(_0xbdbc25){ut[_0xe3b6('0x49')](_0xe3b6('0x4e'),_0xbdbc25);})[_0xe3b6('0x4f')](function(){delete _0xea5e43[_0xe3b6('0xe')][_0x5c392e];delete _0xea5e43[_0xe3b6('0x11')][_0x5c392e];});}else{ut[_0xe3b6('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xe3b6('0xe')][_0x5c392e];delete this['actions'][_0x5c392e];}};Fax['prototype'][_0xe3b6('0x50')]=function(_0x414b04){var _0x453bf2=this;if(this[_0xe3b6('0xe')][_0x414b04[_0xe3b6('0x24')]]){if(this['actions'][_0x414b04['uniqueid']]){this[_0xe3b6('0xe')][_0x414b04[_0xe3b6('0x24')]]['id']=this[_0xe3b6('0x11')][_0x414b04[_0xe3b6('0x24')]]['id'];this['channels'][_0x414b04[_0xe3b6('0x24')]]['name']=this[_0xe3b6('0x11')][_0x414b04[_0xe3b6('0x24')]]['name'];}logger[_0xe3b6('0x28')](_0x414b04[_0xe3b6('0x24')],this[_0xe3b6('0x11')][_0x414b04['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xe3b6('0x51'),JSON[_0xe3b6('0x40')](this[_0xe3b6('0xe')][_0x414b04[_0xe3b6('0x24')]]));if(this[_0xe3b6('0x11')][_0x414b04[_0xe3b6('0x24')]]){if(this[_0xe3b6('0xe')][_0x414b04[_0xe3b6('0x24')]][_0xe3b6('0x52')]>0x0&&this[_0xe3b6('0xe')][_0x414b04[_0xe3b6('0x24')]]['faxstatus']===_0xe3b6('0x53')){this['updateStatus'](_0x414b04[_0xe3b6('0x24')],!![]);}else{this['updateStatus'](_0x414b04[_0xe3b6('0x24')],![],this['channels'][_0x414b04[_0xe3b6('0x24')]][_0xe3b6('0x54')]?_0xe3b6('0x55')+this[_0xe3b6('0xe')][_0x414b04[_0xe3b6('0x24')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0xe3b6('0x56')]=function(_0x204f9a){var _0x16ffd9=this;return new BPromise(function(_0x472912,_0x4ce6ca){_0x16ffd9[_0xe3b6('0x57')](_0x204f9a,_0x16ffd9[_0xe3b6('0xf')][_0x204f9a[_0xe3b6('0x58')]])[_0xe3b6('0x3d')](function(_0x1ae260){ut[_0xe3b6('0x49')](_0xe3b6('0x59'),_0x1ae260);_0x472912(ut[_0xe3b6('0x38')]('Fax\x20received'));})['catch'](function(_0x132193){ut['logger'](_0xe3b6('0x5a'),_0x132193);updateStatus(_0x204f9a);_0x4ce6ca(ut[_0xe3b6('0x38')]('Fax\x20failed'));});});};Fax['prototype'][_0xe3b6('0x5b')]=function(_0x47df21){var _0x693417=this;return new BPromise(function(_0x325580,_0xbd7c0a){var _0x16ecf2=_0x693417['checkTrunk'](_0x693417[_0xe3b6('0xf')][_0x47df21[_0xe3b6('0x58')]][_0xe3b6('0x5c')],_0x47df21);if(_0x16ecf2['isValid']){_0x325580(ut['message'](_0xe3b6('0x5d')));}else{_0xbd7c0a(ut['message'](_0x16ecf2[_0xe3b6('0x38')]));}});};function originate(_0x374bf5,_0x457049,_0xafce97){return new BPromise(function(_0xf69aa9,_0x1176b8){if(_0xafce97){var _0x4d3a32=util[_0xe3b6('0x5e')](_0xe3b6('0x5f'),path['parse'](_0x374bf5[_0xe3b6('0x3')])[_0xe3b6('0x26')],_0x374bf5[_0xe3b6('0x3')]);gs[_0xe3b6('0x60')](_0x4d3a32)['then'](function(){_0x374bf5['path']=util[_0xe3b6('0x5e')](_0xe3b6('0x61'),path[_0xe3b6('0x3a')](_0x374bf5[_0xe3b6('0x3')])[_0xe3b6('0x62')],path['parse'](_0x374bf5['path'])[_0xe3b6('0x26')]);_0x457049[_0xe3b6('0x63')]=_0x374bf5[_0xe3b6('0x3')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0xe3b6('0x64')](ut[_0xe3b6('0x65')](_0x374bf5,_0x457049))[_0xe3b6('0x3d')](function(_0x2c608b){_0xf69aa9(_0x2c608b);})[_0xe3b6('0x41')](function(_0x5a2ae0){_0x1176b8(_0x5a2ae0);});})[_0xe3b6('0x41')](function(_0xe376e3){_0x1176b8(_0xe376e3);});}else{ami['Action'](ut[_0xe3b6('0x65')](_0x374bf5,_0x457049))[_0xe3b6('0x3d')](function(_0x3bc1e6){_0xf69aa9(_0x3bc1e6);})[_0xe3b6('0x41')](function(_0x89563a){_0x1176b8(_0x89563a);});}});}Fax[_0xe3b6('0x20')]['execOriginate']=function(_0x8d07f3,_0x52748f){var _0x4ab612=this;return new BPromise(function(_0xd4a8a9,_0x1bc711){var _0x394913=uuid['v4']();var _0x189347=ut['addVariables'](_0x8d07f3,_0x52748f);_0x4ab612['actions'][_0x394913]=new Action(_0x394913,_0x52748f,_0x8d07f3);var _0xd005dc=_0x4ab612[_0xe3b6('0x11')][_0x394913];if(path[_0xe3b6('0x3a')](_0x8d07f3['path'])[_0xe3b6('0x66')]===_0xe3b6('0x3b')){originate(_0xd005dc,_0x189347,!![])[_0xe3b6('0x3d')](function(_0x43834e){_0xd4a8a9(_0x43834e);})['catch'](function(_0x3e2655){_0x1bc711(_0x3e2655);});}else{originate(_0xd005dc,_0x189347,![])['then'](function(_0x11b883){_0xd4a8a9(_0x11b883);})[_0xe3b6('0x41')](function(_0x1fb6c9){_0x1bc711(_0x1fb6c9);});}});};Fax[_0xe3b6('0x20')][_0xe3b6('0x67')]=function(_0x15c322){return!_[_0xe3b6('0x68')](_0x15c322)&&!_[_0xe3b6('0x68')](_0x15c322[_0xe3b6('0x26')])&&!_[_0xe3b6('0x68')](_0x15c322['active'])&&_0x15c322['active']&&!_[_0xe3b6('0x68')](this[_0xe3b6('0x10')][util['format'](_0xe3b6('0x69'),_0x15c322['name'])])&&!_[_0xe3b6('0x68')](this[_0xe3b6('0x10')][util[_0xe3b6('0x5e')](_0xe3b6('0x69'),_0x15c322[_0xe3b6('0x26')])][_0xe3b6('0x2e')])&&(this[_0xe3b6('0x10')][util[_0xe3b6('0x5e')](_0xe3b6('0x69'),_0x15c322['name'])][_0xe3b6('0x2e')]===_0xe3b6('0x6a')||this[_0xe3b6('0x10')][util[_0xe3b6('0x5e')](_0xe3b6('0x69'),_0x15c322[_0xe3b6('0x26')])]['status']===_0xe3b6('0x6b'));};Fax[_0xe3b6('0x20')]['checkTrunk']=function(_0x2c19ff,_0x399cdc){if(!this['isTrunkReachable'](_0x2c19ff)){ut[_0xe3b6('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xe3b6('0x68')](_0x2c19ff)?'':_0x2c19ff[_0xe3b6('0x26')]+_0xe3b6('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xe3b6('0x68')](_0x399cdc[_0xe3b6('0x7')])){ut[_0xe3b6('0x49')](_0xe3b6('0x6d'),JSON['stringify'](_0x399cdc));return{'isValid':![],'message':_0xe3b6('0x6e')};}if(_[_0xe3b6('0x68')](_0x399cdc[_0xe3b6('0x3')])){ut[_0xe3b6('0x49')](_0xe3b6('0x6f'),JSON[_0xe3b6('0x40')](_0x399cdc));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xe3b6('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 37e9ac6..26d3b1c 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 _0xd981=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd981,0x1a1));var _0x1d98=function(_0x8f7c39,_0x53ec0f){_0x8f7c39=_0x8f7c39-0x0;var _0x153eec=_0xd981[_0x8f7c39];return _0x153eec;};'use strict';var util=require(_0x1d98('0x0'));var BPromise=require(_0x1d98('0x1'));var logger=require(_0x1d98('0x2'))(_0x1d98('0x3'));var _=require('lodash');var faxAccount=require(_0x1d98('0x4'));function loggerCatch(_0xd387ef){return function(_0x12dee3){logger[_0x1d98('0x5')](_0xd387ef,util[_0x1d98('0x6')](_0x12dee3,{'showHidden':![],'depth':null}));};}exports[_0x1d98('0x7')]=function(_0x4507a1,_0x3aa69a){return BPromise[_0x1d98('0x8')]()[_0x1d98('0x9')](faxAccount[_0x1d98('0x7')](_0x4507a1,_0x3aa69a))[_0x1d98('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xb855=['then','notify','catch','util','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect'];(function(_0x20902a,_0x835e0f){var _0xda80d9=function(_0xfdc301){while(--_0xfdc301){_0x20902a['push'](_0x20902a['shift']());}};_0xda80d9(++_0x835e0f);}(_0xb855,0x147));var _0x5b85=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xb855[_0x5712f8];return _0x14a364;};'use strict';var util=require(_0x5b85('0x0'));var BPromise=require(_0x5b85('0x1'));var logger=require(_0x5b85('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x5b85('0x3'));function loggerCatch(_0x1980f9){return function(_0x3231ea){logger[_0x5b85('0x4')](_0x1980f9,util[_0x5b85('0x5')](_0x3231ea,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x18396f,_0x21ffab){return BPromise['resolve']()[_0x5b85('0x6')](faxAccount[_0x5b85('0x7')](_0x18396f,_0x21ffab))[_0x5b85('0x8')](loggerCatch('[Notify]\x20'));}; \ 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 a692e2c..985a0ce 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 _0x7f66=['inspect','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x199c3a,_0x4fa49f){var _0x2d50f0=function(_0x3c7442){while(--_0x3c7442){_0x199c3a['push'](_0x199c3a['shift']());}};_0x2d50f0(++_0x4fa49f);}(_0x7f66,0x133));var _0x67f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7f66[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var logger=require(_0x67f6('0x0'))(_0x67f6('0x1'));var BPromise=require('bluebird');var exec=require(_0x67f6('0x2'))[_0x67f6('0x3')];exports[_0x67f6('0x4')]=function(_0x40246f){return new BPromise(function(_0x431a80,_0x50aad6){exec(_0x40246f,function(_0x45ae85,_0x13e3dd,_0x3c58a9){logger[_0x67f6('0x5')](_0x67f6('0x6'),_0x13e3dd);if(_0x45ae85){logger[_0x67f6('0x5')](_0x67f6('0x6'),_0x67f6('0x7'),util[_0x67f6('0x8')](_0x45ae85,{'showHidden':![],'depth':null}),_0x13e3dd,_0x3c58a9);_0x50aad6(_0x45ae85);}_0x431a80(_0x13e3dd);});});}; \ No newline at end of file +var _0xa1e1=['inspect','util','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x3ea3ae,_0x29dd29){var _0x2aa587=function(_0x1d6dca){while(--_0x1d6dca){_0x3ea3ae['push'](_0x3ea3ae['shift']());}};_0x2aa587(++_0x29dd29);}(_0xa1e1,0x191));var _0x1a1e=function(_0x10233f,_0x5553ae){_0x10233f=_0x10233f-0x0;var _0x437806=_0xa1e1[_0x10233f];return _0x437806;};'use strict';var util=require(_0x1a1e('0x0'));var logger=require('../../../../config/logger')(_0x1a1e('0x1'));var BPromise=require(_0x1a1e('0x2'));var exec=require(_0x1a1e('0x3'))[_0x1a1e('0x4')];exports[_0x1a1e('0x5')]=function(_0x1cb4df){return new BPromise(function(_0x48e37c,_0x3678e8){exec(_0x1cb4df,function(_0x5b28ad,_0x885ec3,_0x42c614){logger[_0x1a1e('0x6')](_0x1a1e('0x7'),_0x885ec3);if(_0x5b28ad){logger[_0x1a1e('0x6')](_0x1a1e('0x7'),_0x1a1e('0x8'),util[_0x1a1e('0x9')](_0x5b28ad,{'showHidden':![],'depth':null}),_0x885ec3,_0x42c614);_0x3678e8(_0x5b28ad);}_0x48e37c(_0x885ec3);});});}; \ 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 9c5d5fa..bf8a071 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 _0xb332=['message','logger','inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger'];(function(_0x111192,_0x551f94){var _0x306b15=function(_0x4233e2){while(--_0x4233e2){_0x111192['push'](_0x111192['shift']());}};_0x306b15(++_0x551f94);}(_0xb332,0xd9));var _0x2b33=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0xb332[_0x912d27];return _0x31b918;};'use strict';var util=require(_0x2b33('0x0'));var _=require('lodash');var moment=require(_0x2b33('0x1'));var logger=require(_0x2b33('0x2'))('fax');exports[_0x2b33('0x3')]=function(_0x548a70){return{'message':_0x548a70};};exports[_0x2b33('0x4')]=function(_0x4c6634,_0x34b111){logger['info'](_0x4c6634,util[_0x2b33('0x5')](_0x34b111,{'showHidden':![],'depth':null}));};exports[_0x2b33('0x6')]=function(_0x478214,_0x461d44){var _0x5a7a3f={'XMF-ECM':_0x461d44['ecm'],'XMF-HEADERINFO':_0x461d44[_0x2b33('0x7')],'XMF-MINRATE':_0x461d44['minrate'],'XMF-MAXRATE':_0x461d44[_0x2b33('0x8')],'XMF-MODEM':util[_0x2b33('0x9')](_0x2b33('0xa'),_0x461d44[_0x2b33('0xb')]),'XMF-GATEWAY':_0x461d44['gateway'],'XMF-FAXDETECT':_0x461d44[_0x2b33('0xc')],'XMF-T38TIMEOUT':_0x461d44[_0x2b33('0xd')],'XMF-LOCALSTATIONID':_0x461d44[_0x2b33('0xe')],'XMF-PATH':_0x478214[_0x2b33('0xf')]};return _0x5a7a3f;};exports[_0x2b33('0x10')]=function(_0xf1e5e5,_0x5251b){return{'actionid':_0xf1e5e5[_0x2b33('0x11')],'action':_0x2b33('0x12'),'channel':_0xf1e5e5[_0x2b33('0x13')],'Exten':_0x2b33('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x2b33('0x9')](_0x2b33('0x15'),_0xf1e5e5[_0x2b33('0x7')]?_0xf1e5e5['headerinfo']:'',_0xf1e5e5[_0x2b33('0xe')]),'variable':_0x5251b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xf1e5e5['uniqueid']};}; \ No newline at end of file +var _0x4522=['info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','faxdetect','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','localstationid','moment','../../../../config/logger','fax','logger'];(function(_0x52a44a,_0x5e8a79){var _0x2df18b=function(_0x376ca4){while(--_0x376ca4){_0x52a44a['push'](_0x52a44a['shift']());}};_0x2df18b(++_0x5e8a79);}(_0x4522,0x1a0));var _0x2452=function(_0x3b558e,_0x6d6aeb){_0x3b558e=_0x3b558e-0x0;var _0x178be9=_0x4522[_0x3b558e];return _0x178be9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2452('0x0'));var logger=require(_0x2452('0x1'))(_0x2452('0x2'));exports['message']=function(_0x229028){return{'message':_0x229028};};exports[_0x2452('0x3')]=function(_0x35e30a,_0x2f21dc){logger[_0x2452('0x4')](_0x35e30a,util[_0x2452('0x5')](_0x2f21dc,{'showHidden':![],'depth':null}));};exports[_0x2452('0x6')]=function(_0x226578,_0x2f0139){var _0x149807={'XMF-ECM':_0x2f0139[_0x2452('0x7')],'XMF-HEADERINFO':_0x2f0139[_0x2452('0x8')],'XMF-MINRATE':_0x2f0139[_0x2452('0x9')],'XMF-MAXRATE':_0x2f0139[_0x2452('0xa')],'XMF-MODEM':util[_0x2452('0xb')](_0x2452('0xc'),_0x2f0139['modem']),'XMF-GATEWAY':_0x2f0139['gateway'],'XMF-FAXDETECT':_0x2f0139[_0x2452('0xd')],'XMF-T38TIMEOUT':_0x2f0139['t38timeout'],'XMF-LOCALSTATIONID':_0x2f0139['localstationid'],'XMF-PATH':_0x226578[_0x2452('0xe')]};return _0x149807;};exports[_0x2452('0xf')]=function(_0x1086ef,_0x3ad6c9){return{'actionid':_0x1086ef[_0x2452('0x10')],'action':_0x2452('0x11'),'channel':_0x1086ef[_0x2452('0x12')],'Exten':_0x2452('0x13'),'Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x1086ef[_0x2452('0x8')]?_0x1086ef['headerinfo']:'',_0x1086ef[_0x2452('0x14')]),'variable':_0x3ad6c9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1086ef['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 331ce73..9a43b4d 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 _0x1e47=['initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','getAgents','then','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns'];(function(_0x56928f,_0x229473){var _0x159b5d=function(_0x8ef81){while(--_0x8ef81){_0x56928f['push'](_0x56928f['shift']());}};_0x159b5d(++_0x229473);}(_0x1e47,0x104));var _0x71e4=function(_0x60f412,_0x36afc2){_0x60f412=_0x60f412-0x0;var _0x121456=_0x1e47[_0x60f412];return _0x121456;};'use strict';var BPromise=require(_0x71e4('0x0'));var util=require('util');var moment=require(_0x71e4('0x1'));var server=require(_0x71e4('0x2'));var Realtime=require(_0x71e4('0x3'));var Report=require(_0x71e4('0x4'));var Acw=require(_0x71e4('0x5'));var Trigger=require(_0x71e4('0x6'));var Dialer=require(_0x71e4('0x7'));var Preview=require('./preview');var Fax=require(_0x71e4('0x8'));var user=require(_0x71e4('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x71e4('0xa'));var voiceCallReport=require(_0x71e4('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x71e4('0xc'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x71e4('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x71e4('0xe'));var sugarcrm=require(_0x71e4('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x71e4('0x10'));var vtiger=require(_0x71e4('0x11'));var freshsales=require(_0x71e4('0x12'));var servicenow=require(_0x71e4('0x13'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x71e4('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x71e4('0x15')](_0x71e4('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x71e4('0x16')]()['then'](user[_0x71e4('0x17')]())[_0x71e4('0x18')](realtime['initAgents']())[_0x71e4('0x18')](user[_0x71e4('0x19')]())['then'](realtime[_0x71e4('0x1a')]())[_0x71e4('0x18')](trunk['getTrunks']())[_0x71e4('0x18')](realtime[_0x71e4('0x1b')]())[_0x71e4('0x18')](voiceQueue[_0x71e4('0x1c')]())[_0x71e4('0x18')](realtime[_0x71e4('0x1d')]())[_0x71e4('0x18')](trigger[_0x71e4('0x1e')]())['then'](realtime[_0x71e4('0x1f')]())['then'](template[_0x71e4('0x20')]())[_0x71e4('0x18')](realtime[_0x71e4('0x21')]())[_0x71e4('0x18')](zendesk[_0x71e4('0x22')]())['then'](realtime[_0x71e4('0x23')]())['then'](salesforce[_0x71e4('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0x71e4('0x18')](sugarcrm[_0x71e4('0x25')]())[_0x71e4('0x18')](realtime['initSugarcrmAccounts']())[_0x71e4('0x18')](freshdesk[_0x71e4('0x26')]())[_0x71e4('0x18')](realtime[_0x71e4('0x27')]())[_0x71e4('0x18')](desk['getDeskAccounts']())[_0x71e4('0x18')](realtime[_0x71e4('0x28')]())[_0x71e4('0x18')](zoho[_0x71e4('0x29')]())[_0x71e4('0x18')](realtime[_0x71e4('0x2a')]())[_0x71e4('0x18')](vtiger['getVtigerAccounts']())[_0x71e4('0x18')](realtime[_0x71e4('0x2b')]())[_0x71e4('0x18')](freshsales[_0x71e4('0x2c')]())[_0x71e4('0x18')](realtime[_0x71e4('0x2d')]())[_0x71e4('0x18')](servicenow[_0x71e4('0x2e')]())['then'](realtime['initServicenowAccounts']())[_0x71e4('0x18')](dynamics365[_0x71e4('0x2f')]())[_0x71e4('0x18')](realtime[_0x71e4('0x30')]())[_0x71e4('0x18')](campaign[_0x71e4('0x31')]())[_0x71e4('0x18')](realtime[_0x71e4('0x32')]())['then'](voiceExtension[_0x71e4('0x33')]())[_0x71e4('0x18')](realtime[_0x71e4('0x34')]())[_0x71e4('0x18')](faxAccount[_0x71e4('0x35')]())['then'](realtime['initFaxAccounts']())[_0x71e4('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x71e4('0x16')]()[_0x71e4('0x18')](voiceQueueReport['getVoiceQueueReports']())[_0x71e4('0x18')](realtime[_0x71e4('0x36')]())[_0x71e4('0x18')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x71e4('0x18')](realtime['initVoiceQueueHopperHistory']())[_0x71e4('0x18')](cmHopperHistory[_0x71e4('0x37')]())[_0x71e4('0x18')](realtime[_0x71e4('0x38')]())[_0x71e4('0x18')](voiceCallReport[_0x71e4('0x39')]())['then'](realtime[_0x71e4('0x3a')]())[_0x71e4('0x18')](function(_0xce125e){})[_0x71e4('0x3b')](function(_0x1d4e44){console[_0x71e4('0x3c')](_0x1d4e44);});}function main(){return server['listen'](realtime,preview,fax)[_0x71e4('0x18')](function(_0x2af31e){return initRealtime();})[_0x71e4('0x18')](function(){return initParams();})[_0x71e4('0x18')](function(){report[_0x71e4('0x3d')]();setInterval(initRealtime,0x1388);})[_0x71e4('0x3b')](function(_0x452ffd){console[_0x71e4('0x3c')](_0x452ffd);});}main(); \ No newline at end of file +var _0xa250=['initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','log','listen','sync','bluebird','moment','./server','./report','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents'];(function(_0x26e91f,_0x5d9f74){var _0xe782e3=function(_0x4739f0){while(--_0x4739f0){_0x26e91f['push'](_0x26e91f['shift']());}};_0xe782e3(++_0x5d9f74);}(_0xa250,0x1cf));var _0x0a25=function(_0x1bd0c4,_0x2405e0){_0x1bd0c4=_0x1bd0c4-0x0;var _0x13a3af=_0xa250[_0x1bd0c4];return _0x13a3af;};'use strict';var BPromise=require(_0x0a25('0x0'));var util=require('util');var moment=require(_0x0a25('0x1'));var server=require(_0x0a25('0x2'));var Realtime=require('./realtime');var Report=require(_0x0a25('0x3'));var Acw=require(_0x0a25('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x0a25('0x5'));var Preview=require(_0x0a25('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x0a25('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x0a25('0x8'));var template=require(_0x0a25('0x9'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0a25('0xa'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x0a25('0xb'));var zendesk=require(_0x0a25('0xc'));var salesforce=require(_0x0a25('0xd'));var sugarcrm=require(_0x0a25('0xe'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0a25('0xf'));var zoho=require(_0x0a25('0x10'));var vtiger=require(_0x0a25('0x11'));var freshsales=require(_0x0a25('0x12'));var servicenow=require(_0x0a25('0x13'));var dynamics365=require(_0x0a25('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0a25('0x15')](_0x0a25('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x0a25('0x17')](user[_0x0a25('0x18')]())[_0x0a25('0x17')](realtime[_0x0a25('0x19')]())['then'](user[_0x0a25('0x1a')]())[_0x0a25('0x17')](realtime['initTelephones']())['then'](trunk[_0x0a25('0x1b')]())[_0x0a25('0x17')](realtime[_0x0a25('0x1c')]())['then'](voiceQueue[_0x0a25('0x1d')]())[_0x0a25('0x17')](realtime[_0x0a25('0x1e')]())[_0x0a25('0x17')](trigger[_0x0a25('0x1f')]())[_0x0a25('0x17')](realtime[_0x0a25('0x20')]())[_0x0a25('0x17')](template[_0x0a25('0x21')]())[_0x0a25('0x17')](realtime['initTemplates']())[_0x0a25('0x17')](zendesk[_0x0a25('0x22')]())[_0x0a25('0x17')](realtime['initZendeskAccounts']())['then'](salesforce[_0x0a25('0x23')]())['then'](realtime['initSalesforceAccounts']())[_0x0a25('0x17')](sugarcrm[_0x0a25('0x24')]())[_0x0a25('0x17')](realtime[_0x0a25('0x25')]())['then'](freshdesk[_0x0a25('0x26')]())[_0x0a25('0x17')](realtime[_0x0a25('0x27')]())[_0x0a25('0x17')](desk[_0x0a25('0x28')]())['then'](realtime[_0x0a25('0x29')]())['then'](zoho['getZohoAccounts']())[_0x0a25('0x17')](realtime[_0x0a25('0x2a')]())['then'](vtiger['getVtigerAccounts']())[_0x0a25('0x17')](realtime[_0x0a25('0x2b')]())[_0x0a25('0x17')](freshsales['getFreshsalesAccounts']())[_0x0a25('0x17')](realtime[_0x0a25('0x2c')]())['then'](servicenow[_0x0a25('0x2d')]())[_0x0a25('0x17')](realtime[_0x0a25('0x2e')]())[_0x0a25('0x17')](dynamics365[_0x0a25('0x2f')]())['then'](realtime[_0x0a25('0x30')]())[_0x0a25('0x17')](campaign[_0x0a25('0x31')]())['then'](realtime['initCampaigns']())[_0x0a25('0x17')](voiceExtension['getVoiceExtensions']())[_0x0a25('0x17')](realtime[_0x0a25('0x32')]())[_0x0a25('0x17')](faxAccount[_0x0a25('0x33')]())[_0x0a25('0x17')](realtime[_0x0a25('0x34')]())[_0x0a25('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x0a25('0x35')]()[_0x0a25('0x17')](voiceQueueReport[_0x0a25('0x36')]())[_0x0a25('0x17')](realtime['initVoiceQueueReports']())[_0x0a25('0x17')](cmHopperHistory[_0x0a25('0x37')]())[_0x0a25('0x17')](realtime['initVoiceQueueHopperHistory']())[_0x0a25('0x17')](cmHopperHistory[_0x0a25('0x38')]())[_0x0a25('0x17')](realtime['initCampaignHopperHistory']())[_0x0a25('0x17')](voiceCallReport[_0x0a25('0x39')]())[_0x0a25('0x17')](realtime['initVoiceCallReports']())[_0x0a25('0x17')](function(_0x42ad09){})['catch'](function(_0x26cdbd){console[_0x0a25('0x3a')](_0x26cdbd);});}function main(){return server[_0x0a25('0x3b')](realtime,preview,fax)[_0x0a25('0x17')](function(_0x198895){return initRealtime();})['then'](function(){return initParams();})[_0x0a25('0x17')](function(){report[_0x0a25('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x548591){console[_0x0a25('0x3a')](_0x548591);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 40789b0..47ecd42 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 _0x6a49=['idle','inuse','talking','statePause','toNumber','format','address','stringify','emit','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase'];(function(_0x2af353,_0x418430){var _0x3f3f4e=function(_0x186bb5){while(--_0x186bb5){_0x2af353['push'](_0x2af353['shift']());}};_0x3f3f4e(++_0x418430);}(_0x6a49,0x7c));var _0x96a4=function(_0x219984,_0x2a7727){_0x219984=_0x219984-0x0;var _0x34c3e8=_0x6a49[_0x219984];return _0x34c3e8;};'use strict';var _=require('lodash');var util=require(_0x96a4('0x0'));var moment=require(_0x96a4('0x1'));var md5=require(_0x96a4('0x2'));var Redis=require(_0x96a4('0x3'));var config=require('../../../config/environment');config[_0x96a4('0x4')]=_[_0x96a4('0x5')](config[_0x96a4('0x4')],{'host':_0x96a4('0x6'),'port':0x18eb});var io=require(_0x96a4('0x7'))(new Redis(config[_0x96a4('0x4')]));function Agent(_0x53cc9e){this['id']=_0x53cc9e['id']||0x0;this['name']=_0x53cc9e[_0x96a4('0x8')]||'';this[_0x96a4('0x9')]=_0x53cc9e[_0x96a4('0x9')]||'';this[_0x96a4('0xa')]=_0x53cc9e[_0x96a4('0xa')]||'';this[_0x96a4('0xb')]=_0x53cc9e['fullname']||'';this[_0x96a4('0xc')]=_0x96a4('0xd');this[_0x96a4('0xe')]=0x0;this[_0x96a4('0xf')]=_0x96a4('0xd');this['address']='';this['phone']='';this[_0x96a4('0x10')]='';this[_0x96a4('0x11')]='';this[_0x96a4('0x12')]=_0x53cc9e[_0x96a4('0x12')]||![];this[_0x96a4('0x13')]=_0x96a4('0xd');this[_0x96a4('0x14')]=0x0;this[_0x96a4('0x15')]='';this[_0x96a4('0x16')]='';this[_0x96a4('0x17')]=![];this[_0x96a4('0x18')]=![];this[_0x96a4('0x2')]='';}Agent[_0x96a4('0x19')][_0x96a4('0x1a')]=function(_0x5b7bf6){var _0x262949;if(_0x5b7bf6&&_0x5b7bf6[_0x96a4('0xc')]){_0x262949=_0x5b7bf6[_0x96a4('0xc')][_0x96a4('0x1b')]();switch(_0x262949){case'not_inuse':_0x262949=_0x96a4('0x1c');break;case _0x96a4('0x1d'):_0x262949=_0x96a4('0x1e');break;}}if(_0x262949&&this[_0x96a4('0x13')]!==_0x262949||_0x5b7bf6[_0x96a4('0x1f')]){this['voiceStatusTime']=_[_0x96a4('0x20')](moment()[_0x96a4('0x21')]('x'));}if(_0x262949){this['voiceStatus']=_0x262949;}var _0x401be8={'id':this['id'],'name':this[_0x96a4('0x8')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x96a4('0xb')],'state':this[_0x96a4('0xc')],'stateTime':this['stateTime'],'status':this[_0x96a4('0xf')],'address':this[_0x96a4('0x22')],'online':this[_0x96a4('0x12')],'voiceStatus':this[_0x96a4('0x13')],'voiceStatusTime':this[_0x96a4('0x14')],'voiceStatusCallerIdNumber':this[_0x96a4('0x15')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x96a4('0x11')],'onhold':this[_0x96a4('0x17')]};var _0x5993f4=md5(JSON[_0x96a4('0x23')](_0x401be8));if(this[_0x96a4('0x2')]!==_0x5993f4){this['md5']=_0x5993f4;io['to'](util[_0x96a4('0x21')]('user:%s',_0x401be8[_0x96a4('0x8')]))[_0x96a4('0x24')]('user:save',_0x401be8);}};module[_0x96a4('0x25')]=Agent; \ No newline at end of file +var _0x9cbe=['local','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','name','voiceStatusCallerIdNumber','stringify','user:%s','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','email','accountcode','fullname','unknown','stateTime','status','address','phone','interface','online','voiceStatusTime','voiceStatusQueue','onhold'];(function(_0x2f8b3e,_0x24b103){var _0xcf32=function(_0x43c744){while(--_0x43c744){_0x2f8b3e['push'](_0x2f8b3e['shift']());}};_0xcf32(++_0x24b103);}(_0x9cbe,0x181));var _0xe9cb=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x9cbe[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xe9cb('0x0'));var util=require(_0xe9cb('0x1'));var moment=require(_0xe9cb('0x2'));var md5=require(_0xe9cb('0x3'));var Redis=require(_0xe9cb('0x4'));var config=require(_0xe9cb('0x5'));config[_0xe9cb('0x6')]=_[_0xe9cb('0x7')](config[_0xe9cb('0x6')],{'host':_0xe9cb('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5c9389){this['id']=_0x5c9389['id']||0x0;this['name']=_0x5c9389['name']||'';this['email']=_0x5c9389[_0xe9cb('0x9')]||'';this[_0xe9cb('0xa')]=_0x5c9389[_0xe9cb('0xa')]||'';this[_0xe9cb('0xb')]=_0x5c9389[_0xe9cb('0xb')]||'';this['state']=_0xe9cb('0xc');this[_0xe9cb('0xd')]=0x0;this[_0xe9cb('0xe')]=_0xe9cb('0xc');this[_0xe9cb('0xf')]='';this[_0xe9cb('0x10')]='';this['mobile']='';this[_0xe9cb('0x11')]='';this[_0xe9cb('0x12')]=_0x5c9389[_0xe9cb('0x12')]||![];this['voiceStatus']=_0xe9cb('0xc');this[_0xe9cb('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xe9cb('0x14')]='';this[_0xe9cb('0x15')]=![];this[_0xe9cb('0x16')]=![];this[_0xe9cb('0x3')]='';}Agent['prototype'][_0xe9cb('0x17')]=function(_0x390322){var _0x5b240b;if(_0x390322&&_0x390322[_0xe9cb('0x18')]){_0x5b240b=_0x390322['state'][_0xe9cb('0x19')]();switch(_0x5b240b){case _0xe9cb('0x1a'):_0x5b240b=_0xe9cb('0x1b');break;case _0xe9cb('0x1c'):_0x5b240b=_0xe9cb('0x1d');break;}}if(_0x5b240b&&this[_0xe9cb('0x1e')]!==_0x5b240b||_0x390322['statePause']){this[_0xe9cb('0x13')]=_['toNumber'](moment()['format']('x'));}if(_0x5b240b){this['voiceStatus']=_0x5b240b;}var _0x76f436={'id':this['id'],'name':this[_0xe9cb('0x1f')],'email':this[_0xe9cb('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xe9cb('0xb')],'state':this[_0xe9cb('0x18')],'stateTime':this['stateTime'],'status':this[_0xe9cb('0xe')],'address':this[_0xe9cb('0xf')],'online':this[_0xe9cb('0x12')],'voiceStatus':this[_0xe9cb('0x1e')],'voiceStatusTime':this[_0xe9cb('0x13')],'voiceStatusCallerIdNumber':this[_0xe9cb('0x20')],'voiceStatusQueue':this[_0xe9cb('0x14')],'interface':this[_0xe9cb('0x11')],'onhold':this[_0xe9cb('0x15')]};var _0x3b6e19=md5(JSON[_0xe9cb('0x21')](_0x76f436));if(this[_0xe9cb('0x3')]!==_0x3b6e19){this[_0xe9cb('0x3')]=_0x3b6e19;io['to'](util['format'](_0xe9cb('0x22'),_0x76f436[_0xe9cb('0x1f')]))['emit'](_0xe9cb('0x23'),_0x76f436);}};module[_0xe9cb('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 43aa432..6c1eced 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 _0xb7e7=['dialAMDSilenceThreshold','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords'];(function(_0x5d31ee,_0x183e43){var _0x21c2e6=function(_0x176343){while(--_0x176343){_0x5d31ee['push'](_0x5d31ee['shift']());}};_0x21c2e6(++_0x183e43);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';function Campaign(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['type']=_0x2e5e07[_0x7b7e('0x1')]||'campaign';this[_0x7b7e('0x2')]=0x0;this['temp']=0x0;this[_0x7b7e('0x3')]=0x0;this[_0x7b7e('0x4')]=0x0;this[_0x7b7e('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x2e5e07[_0x7b7e('0x6')];this[_0x7b7e('0x7')]=_0x2e5e07[_0x7b7e('0x7')];this['dialTimezone']=_0x2e5e07[_0x7b7e('0x8')]||null;this[_0x7b7e('0x9')]=_0x2e5e07[_0x7b7e('0x9')]?_0x2e5e07[_0x7b7e('0x9')]:null;this[_0x7b7e('0xa')]=_0x2e5e07[_0x7b7e('0xa')];this[_0x7b7e('0xb')]=_0x2e5e07['dialOriginateCallerIdNumber'];this[_0x7b7e('0xc')]=_0x2e5e07[_0x7b7e('0xc')]||0x1e;this[_0x7b7e('0xd')]=_0x2e5e07[_0x7b7e('0xd')];this[_0x7b7e('0xe')]=_0x2e5e07[_0x7b7e('0xe')];this[_0x7b7e('0xf')]=_0x2e5e07[_0x7b7e('0xf')];this[_0x7b7e('0x10')]=_0x2e5e07['dialBusyRetryFrequency'];this[_0x7b7e('0x11')]=_0x2e5e07[_0x7b7e('0x11')];this['dialNoAnswerRetryFrequency']=_0x2e5e07[_0x7b7e('0x12')];this['dialGlobalMaxRetry']=_0x2e5e07['dialGlobalMaxRetry'];this[_0x7b7e('0x13')]=_0x2e5e07[_0x7b7e('0x13')]||_0x7b7e('0x14');this[_0x7b7e('0x15')]=_0x2e5e07[_0x7b7e('0x15')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2e5e07['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7b7e('0x16')]=_0x2e5e07[_0x7b7e('0x16')]||undefined;this[_0x7b7e('0x17')]=_0x2e5e07[_0x7b7e('0x17')]?_0x2e5e07[_0x7b7e('0x17')]:undefined;this[_0x7b7e('0x18')]=_0x2e5e07[_0x7b7e('0x18')]?_0x2e5e07[_0x7b7e('0x18')]:undefined;this[_0x7b7e('0x19')]=_0x2e5e07[_0x7b7e('0x19')]?_0x2e5e07[_0x7b7e('0x19')]:undefined;this[_0x7b7e('0x1a')]=_0x2e5e07[_0x7b7e('0x1a')]?_0x2e5e07[_0x7b7e('0x1a')]:undefined;this[_0x7b7e('0x1b')]=_0x2e5e07[_0x7b7e('0x1a')]?_0x2e5e07[_0x7b7e('0x1a')]['name']:undefined;this[_0x7b7e('0x1c')]=_0x2e5e07[_0x7b7e('0x1c')]||![];this[_0x7b7e('0x1d')]=_0x2e5e07['dialAMDInitialSilence'];this[_0x7b7e('0x1e')]=_0x2e5e07[_0x7b7e('0x1e')];this[_0x7b7e('0x1f')]=_0x2e5e07[_0x7b7e('0x1f')];this[_0x7b7e('0x20')]=_0x2e5e07[_0x7b7e('0x20')];this[_0x7b7e('0x21')]=_0x2e5e07[_0x7b7e('0x21')];this['dialAMDBetweenWordsSilence']=_0x2e5e07['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x2e5e07[_0x7b7e('0x22')];this[_0x7b7e('0x23')]=_0x2e5e07[_0x7b7e('0x23')];this['dialAMDMaximumWordLength']=_0x2e5e07['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x2032=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay'];(function(_0x9676c8,_0x35acb8){var _0x155a6b=function(_0x88715){while(--_0x88715){_0x9676c8['push'](_0x9676c8['shift']());}};_0x155a6b(++_0x35acb8);}(_0x2032,0xd9));var _0x2203=function(_0x4043a8,_0x5cccb6){_0x4043a8=_0x4043a8-0x0;var _0x5b7f14=_0x2032[_0x4043a8];return _0x5b7f14;};'use strict';function Campaign(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['type']||_0x2203('0x2');this[_0x2203('0x3')]=0x0;this['temp']=0x0;this[_0x2203('0x4')]=0x0;this[_0x2203('0x5')]=0x0;this[_0x2203('0x6')]='';this[_0x2203('0x7')]=!![];this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')];this[_0x2203('0x9')]=_0x4d6c97[_0x2203('0x9')];this[_0x2203('0xa')]=_0x4d6c97[_0x2203('0xa')]||null;this[_0x2203('0xb')]=_0x4d6c97['dialGlobalInterval']?_0x4d6c97['dialGlobalInterval']:null;this[_0x2203('0xc')]=_0x4d6c97['dialOriginateCallerIdName'];this[_0x2203('0xd')]=_0x4d6c97[_0x2203('0xd')];this[_0x2203('0xe')]=_0x4d6c97['dialOriginateTimeout']||0x1e;this[_0x2203('0xf')]=_0x4d6c97['dialCongestionMaxRetry'];this[_0x2203('0x10')]=_0x4d6c97['dialCongestionRetryFrequency'];this[_0x2203('0x11')]=_0x4d6c97[_0x2203('0x11')];this['dialBusyRetryFrequency']=_0x4d6c97['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4d6c97['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4d6c97[_0x2203('0x12')];this['dialGlobalMaxRetry']=_0x4d6c97['dialGlobalMaxRetry'];this[_0x2203('0x13')]=_0x4d6c97[_0x2203('0x13')]||_0x2203('0x14');this[_0x2203('0x15')]=_0x4d6c97[_0x2203('0x15')]||undefined;this[_0x2203('0x16')]=_0x4d6c97[_0x2203('0x16')]||undefined;this[_0x2203('0x17')]=_0x4d6c97[_0x2203('0x17')]||undefined;this[_0x2203('0x18')]=_0x4d6c97['TrunkBackup']?_0x4d6c97[_0x2203('0x18')]:undefined;this[_0x2203('0x19')]=_0x4d6c97['Trunk']?_0x4d6c97[_0x2203('0x19')]:undefined;this[_0x2203('0x1a')]=_0x4d6c97['Interval']?_0x4d6c97[_0x2203('0x1a')]:undefined;this['SquareProject']=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')]:undefined;this[_0x2203('0x1c')]=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')][_0x2203('0x0')]:undefined;this['dialAMDActive']=_0x4d6c97[_0x2203('0x1d')]||![];this['dialAMDInitialSilence']=_0x4d6c97['dialAMDInitialSilence'];this[_0x2203('0x1e')]=_0x4d6c97['dialAMDGreeting'];this[_0x2203('0x1f')]=_0x4d6c97[_0x2203('0x1f')];this['dialAMDTotalAnalysisTime']=_0x4d6c97[_0x2203('0x20')];this['dialAMDMinWordLength']=_0x4d6c97['dialAMDMinWordLength'];this[_0x2203('0x21')]=_0x4d6c97[_0x2203('0x21')];this[_0x2203('0x22')]=_0x4d6c97[_0x2203('0x22')];this[_0x2203('0x23')]=_0x4d6c97[_0x2203('0x23')];this[_0x2203('0x24')]=_0x4d6c97[_0x2203('0x24')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 46b3fb0..b6334b4 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 _0xd868=['monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','destinationchannel','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x3bbb97,_0x539f0a){var _0xec491d=function(_0x412ca4){while(--_0x412ca4){_0x3bbb97['push'](_0x3bbb97['shift']());}};_0xec491d(++_0x539f0a);}(_0xd868,0x1ec));var _0x8d86=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xd868[_0x1eda20];return _0x31b953;};'use strict';function Channel(){this[_0x8d86('0x0')]=null;this['channel']='';this[_0x8d86('0x1')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x8d86('0x2')]=undefined;this[_0x8d86('0x3')]=undefined;this[_0x8d86('0x4')]=0x0;this['context']='';this[_0x8d86('0x5')]=0x0;this[_0x8d86('0x6')]=0x0;this['exten']=0x0;this[_0x8d86('0x7')]=![];this[_0x8d86('0x8')]=null;this[_0x8d86('0x9')]=null;this[_0x8d86('0xa')]=![];this[_0x8d86('0xb')]=![];this[_0x8d86('0xc')]='';this[_0x8d86('0xd')]='';this[_0x8d86('0xe')]=0x0;this[_0x8d86('0xf')]=0x0;this[_0x8d86('0x10')]=0x0;this[_0x8d86('0x11')]=null;this[_0x8d86('0x12')]=null;this[_0x8d86('0x13')]=null;this[_0x8d86('0x14')]=![];this[_0x8d86('0x15')]=null;this[_0x8d86('0x16')]=null;this[_0x8d86('0x17')]=[];this[_0x8d86('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x8d86('0x19')]=0x0;}module[_0x8d86('0x1a')]=Channel; \ No newline at end of file +var _0x9972=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','uniqueid','linkedid','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitorFilename','monitors','transferconnectedlinenum'];(function(_0x1893f0,_0x5b9bfc){var _0x2b765c=function(_0x2687fd){while(--_0x2687fd){_0x1893f0['push'](_0x1893f0['shift']());}};_0x2b765c(++_0x5b9bfc);}(_0x9972,0xaa));var _0x2997=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9972[_0x4a9fb1];return _0x348672;};'use strict';function Channel(){this[_0x2997('0x0')]=null;this[_0x2997('0x1')]='';this[_0x2997('0x2')]='';this[_0x2997('0x3')]=0x0;this['calleridname']='';this[_0x2997('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x2997('0x5')]=0x0;this['context']='';this[_0x2997('0x6')]=0x0;this[_0x2997('0x7')]=0x0;this['exten']=0x0;this[_0x2997('0x8')]=![];this[_0x2997('0x9')]=null;this[_0x2997('0xa')]=null;this['unmanaged']=![];this[_0x2997('0xb')]=![];this[_0x2997('0xc')]='';this[_0x2997('0xd')]='';this[_0x2997('0xe')]=0x0;this[_0x2997('0xf')]=0x0;this[_0x2997('0x10')]=0x0;this['type']=null;this[_0x2997('0x11')]=null;this[_0x2997('0x12')]=null;this['monitor']=![];this[_0x2997('0x13')]=null;this['queue']=null;this[_0x2997('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x2997('0x15')]=undefined;this[_0x2997('0x16')]=0x0;}module[_0x2997('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 07034fb..a90258e 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 _0x2b83=['token','tokenSecret','type','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x2b83,0x1d3));var _0x32b8=function(_0x307410,_0x54f394){_0x307410=_0x307410-0x0;var _0x44a83b=_0x2b83[_0x307410];return _0x44a83b;};'use strict';function DeskAccount(_0x52d8cb){this['id']=_0x52d8cb['id']||0x0;this[_0x32b8('0x0')]=_0x52d8cb[_0x32b8('0x0')]||'';this['username']=_0x52d8cb[_0x32b8('0x1')]||'';this[_0x32b8('0x2')]=_0x52d8cb[_0x32b8('0x2')]||'';this['authType']=_0x52d8cb['authType']||'';this[_0x32b8('0x3')]=_0x52d8cb[_0x32b8('0x3')]||'';this['consumerKey']=_0x52d8cb[_0x32b8('0x4')]||'';this['consumerSecret']=_0x52d8cb[_0x32b8('0x5')]||'';this[_0x32b8('0x6')]=_0x52d8cb[_0x32b8('0x6')]||'';this[_0x32b8('0x7')]=_0x52d8cb['tokenSecret']||'';this[_0x32b8('0x8')]=_0x52d8cb[_0x32b8('0x8')]||'';this['serverUrl']=_0x52d8cb['serverUrl']||'';this[_0x32b8('0x9')]=_0x52d8cb['Configurations']||{};}module[_0x32b8('0xa')]=DeskAccount; \ No newline at end of file +var _0x64f5=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri'];(function(_0x442d1f,_0x360994){var _0x20ed3c=function(_0x469019){while(--_0x469019){_0x442d1f['push'](_0x442d1f['shift']());}};_0x20ed3c(++_0x360994);}(_0x64f5,0x17e));var _0x564f=function(_0x40b201,_0x1d0cca){_0x40b201=_0x40b201-0x0;var _0x2e8dc5=_0x64f5[_0x40b201];return _0x2e8dc5;};'use strict';function DeskAccount(_0x3a60ff){this['id']=_0x3a60ff['id']||0x0;this['name']=_0x3a60ff['name']||'';this['username']=_0x3a60ff[_0x564f('0x0')]||'';this['remoteUri']=_0x3a60ff[_0x564f('0x1')]||'';this[_0x564f('0x2')]=_0x3a60ff['authType']||'';this[_0x564f('0x3')]=_0x3a60ff[_0x564f('0x3')]||'';this[_0x564f('0x4')]=_0x3a60ff[_0x564f('0x4')]||'';this[_0x564f('0x5')]=_0x3a60ff['consumerSecret']||'';this[_0x564f('0x6')]=_0x3a60ff[_0x564f('0x6')]||'';this[_0x564f('0x7')]=_0x3a60ff[_0x564f('0x7')]||'';this[_0x564f('0x8')]=_0x3a60ff[_0x564f('0x8')]||'';this[_0x564f('0x9')]=_0x3a60ff[_0x564f('0x9')]||'';this[_0x564f('0xa')]=_0x3a60ff[_0x564f('0xa')]||{};}module[_0x564f('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d708192..655d2e0 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 _0x190f=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientSecret'];(function(_0x40c6fc,_0x4f53c2){var _0x65b760=function(_0x533c23){while(--_0x533c23){_0x40c6fc['push'](_0x40c6fc['shift']());}};_0x65b760(++_0x4f53c2);}(_0x190f,0x6f));var _0xf190=function(_0x594d05,_0x53bcfd){_0x594d05=_0x594d05-0x0;var _0x4784f2=_0x190f[_0x594d05];return _0x4784f2;};'use strict';function Dynamics365Account(_0xa5cbe6){this['id']=_0xa5cbe6['id']||0x0;this[_0xf190('0x0')]=_0xa5cbe6['name']||'';this[_0xf190('0x1')]=_0xa5cbe6[_0xf190('0x1')]||'';this[_0xf190('0x2')]=_0xa5cbe6[_0xf190('0x2')]||'';this[_0xf190('0x3')]=_0xa5cbe6[_0xf190('0x3')]||'';this[_0xf190('0x4')]=_0xa5cbe6[_0xf190('0x4')]||'';this['clientId']=_0xa5cbe6['clientId']||'';this[_0xf190('0x5')]=_0xa5cbe6[_0xf190('0x5')]||{};this[_0xf190('0x6')]=_0xa5cbe6[_0xf190('0x6')]||'';this[_0xf190('0x7')]=_0xa5cbe6[_0xf190('0x7')]||{};}module[_0xf190('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x9b45=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x4bb096,_0x5c3551){var _0x30c65a=function(_0x19a765){while(--_0x19a765){_0x4bb096['push'](_0x4bb096['shift']());}};_0x30c65a(++_0x5c3551);}(_0x9b45,0x14b));var _0x59b4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9b45[_0x59ee6f];return _0x4c0979;};'use strict';function Dynamics365Account(_0x2b5c9a){this['id']=_0x2b5c9a['id']||0x0;this[_0x59b4('0x0')]=_0x2b5c9a[_0x59b4('0x0')]||'';this[_0x59b4('0x1')]=_0x2b5c9a[_0x59b4('0x1')]||'';this[_0x59b4('0x2')]=_0x2b5c9a['password']||'';this[_0x59b4('0x3')]=_0x2b5c9a[_0x59b4('0x3')]||'';this[_0x59b4('0x4')]=_0x2b5c9a[_0x59b4('0x4')]||'';this[_0x59b4('0x5')]=_0x2b5c9a['clientId']||'';this[_0x59b4('0x6')]=_0x2b5c9a['clientSecret']||{};this[_0x59b4('0x7')]=_0x2b5c9a[_0x59b4('0x7')]||'';this[_0x59b4('0x8')]=_0x2b5c9a[_0x59b4('0x8')]||{};}module[_0x59b4('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8afac68..42a8182 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 _0xcf50=['gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x289b33,_0xafb431){var _0x4c43f9=function(_0x252d72){while(--_0x252d72){_0x289b33['push'](_0x289b33['shift']());}};_0x4c43f9(++_0xafb431);}(_0xcf50,0xe5));var _0x0cf5=function(_0x249253,_0x38b111){_0x249253=_0x249253-0x0;var _0x23def2=_0xcf50[_0x249253];return _0x23def2;};'use strict';function FaxAccount(_0x322144){this['id']=_0x322144['id']||0x0;this['name']=_0x322144[_0x0cf5('0x0')]||'';this[_0x0cf5('0x1')]=_0x322144[_0x0cf5('0x1')];this[_0x0cf5('0x2')]=_0x322144['ecm'];this[_0x0cf5('0x3')]=_0x322144[_0x0cf5('0x3')];this[_0x0cf5('0x4')]=_0x322144[_0x0cf5('0x4')];this[_0x0cf5('0x5')]=_0x322144[_0x0cf5('0x5')]||0x960;this[_0x0cf5('0x6')]=_0x322144[_0x0cf5('0x6')]||0x3840;this[_0x0cf5('0x7')]=_0x322144[_0x0cf5('0x7')]||_0x0cf5('0x8');this[_0x0cf5('0x9')]=_0x322144[_0x0cf5('0x9')]||'no';this['faxdetect']=_0x322144[_0x0cf5('0xa')]||'no';this['t38timeout']=_0x322144['t38timeout']||0x1388;this['tech']=_0x322144[_0x0cf5('0xb')]||_0x0cf5('0xc');this[_0x0cf5('0xd')]=_0x322144[_0x0cf5('0xd')]?_0x322144['Trunk']:undefined;this[_0x0cf5('0xe')]=_0x322144[_0x0cf5('0xe')];this[_0x0cf5('0xf')]=_0x322144[_0x0cf5('0xf')];}module[_0x0cf5('0x10')]=FaxAccount; \ No newline at end of file +var _0xf064=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports'];(function(_0x256494,_0xcd0083){var _0x40d648=function(_0xdc0efc){while(--_0xdc0efc){_0x256494['push'](_0x256494['shift']());}};_0x40d648(++_0xcd0083);}(_0xf064,0xcc));var _0x4f06=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xf064[_0x3132e8];return _0x43eb8c;};'use strict';function FaxAccount(_0x37fda7){this['id']=_0x37fda7['id']||0x0;this[_0x4f06('0x0')]=_0x37fda7[_0x4f06('0x0')]||'';this['description']=_0x37fda7[_0x4f06('0x1')];this[_0x4f06('0x2')]=_0x37fda7['ecm'];this['headerinfo']=_0x37fda7[_0x4f06('0x3')];this[_0x4f06('0x4')]=_0x37fda7['localstationid'];this[_0x4f06('0x5')]=_0x37fda7[_0x4f06('0x5')]||0x960;this[_0x4f06('0x6')]=_0x37fda7[_0x4f06('0x6')]||0x3840;this[_0x4f06('0x7')]=_0x37fda7['modem']||_0x4f06('0x8');this[_0x4f06('0x9')]=_0x37fda7[_0x4f06('0x9')]||'no';this[_0x4f06('0xa')]=_0x37fda7[_0x4f06('0xa')]||'no';this['t38timeout']=_0x37fda7['t38timeout']||0x1388;this['tech']=_0x37fda7[_0x4f06('0xb')]||_0x4f06('0xc');this[_0x4f06('0xd')]=_0x37fda7[_0x4f06('0xd')]?_0x37fda7[_0x4f06('0xd')]:undefined;this[_0x4f06('0xe')]=_0x37fda7[_0x4f06('0xe')];this[_0x4f06('0xf')]=_0x37fda7['key'];}module[_0x4f06('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 1a4dd39..cecd0ec 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 _0x0c36=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x492ec6,_0x7e4fc8){var _0x6ed02b=function(_0x6f07f){while(--_0x6f07f){_0x492ec6['push'](_0x492ec6['shift']());}};_0x6ed02b(++_0x7e4fc8);}(_0x0c36,0xb9));var _0x60c3=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x0c36[_0x19159a];return _0xa677f4;};'use strict';function FreshdeskAccount(_0x15bc94){this['id']=_0x15bc94['id']||0x0;this['name']=_0x15bc94['name']||'';this[_0x60c3('0x0')]=_0x15bc94['username']||'';this[_0x60c3('0x1')]=_0x15bc94[_0x60c3('0x2')]||'';this[_0x60c3('0x3')]=_0x15bc94[_0x60c3('0x3')]||'';this[_0x60c3('0x4')]=_0x15bc94[_0x60c3('0x4')]||'';this[_0x60c3('0x5')]=_0x15bc94[_0x60c3('0x5')]||{};}module[_0x60c3('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x954b=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x954b,0xbe));var _0xb954=function(_0x139b85,_0x5e0691){_0x139b85=_0x139b85-0x0;var _0x1e833f=_0x954b[_0x139b85];return _0x1e833f;};'use strict';function FreshdeskAccount(_0x46a1b4){this['id']=_0x46a1b4['id']||0x0;this[_0xb954('0x0')]=_0x46a1b4[_0xb954('0x0')]||'';this[_0xb954('0x1')]=_0x46a1b4[_0xb954('0x1')]||'';this[_0xb954('0x2')]=_0x46a1b4[_0xb954('0x3')]||'';this[_0xb954('0x4')]=_0x46a1b4[_0xb954('0x4')]||'';this['serverUrl']=_0x46a1b4[_0xb954('0x5')]||'';this[_0xb954('0x6')]=_0x46a1b4[_0xb954('0x6')]||{};}module[_0xb954('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e120261..c9a1db0 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 _0x3443=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2d1631,_0x5f4355){var _0x4f19d0=function(_0x534a97){while(--_0x534a97){_0x2d1631['push'](_0x2d1631['shift']());}};_0x4f19d0(++_0x5f4355);}(_0x3443,0x116));var _0x3344=function(_0x3b4137,_0x3f6584){_0x3b4137=_0x3b4137-0x0;var _0x4276c3=_0x3443[_0x3b4137];return _0x4276c3;};'use strict';function FreshsalesAccount(_0x31684c){this['id']=_0x31684c['id']||0x0;this[_0x3344('0x0')]=_0x31684c[_0x3344('0x0')]||'';this[_0x3344('0x1')]=_0x31684c[_0x3344('0x1')]||'';this['apiKey']=_0x31684c[_0x3344('0x2')]||'';this[_0x3344('0x3')]=_0x31684c[_0x3344('0x3')]||'';this[_0x3344('0x4')]=_0x31684c[_0x3344('0x4')]||'';this[_0x3344('0x5')]=_0x31684c[_0x3344('0x5')]||{};}module[_0x3344('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x90e2=['token','remoteUri','serverUrl','name','username','apiKey'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x90e2,0x183));var _0x290e=function(_0x448a0b,_0x3a767a){_0x448a0b=_0x448a0b-0x0;var _0x116920=_0x90e2[_0x448a0b];return _0x116920;};'use strict';function FreshsalesAccount(_0x2428c8){this['id']=_0x2428c8['id']||0x0;this[_0x290e('0x0')]=_0x2428c8['name']||'';this['username']=_0x2428c8[_0x290e('0x1')]||'';this[_0x290e('0x2')]=_0x2428c8[_0x290e('0x3')]||'';this['remoteUri']=_0x2428c8[_0x290e('0x4')]||'';this['serverUrl']=_0x2428c8[_0x290e('0x5')]||'';this['Configurations']=_0x2428c8['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index f93f3be..fef8e3d 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 _0x59b9=['count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','connectedlinenum','connectedlinename','context','exten','priority','assigned','mohtime','variables','exports','type','uniqueid','calleridname','queue','queuecallerjoinAt','position'];(function(_0x165073,_0xcd10ba){var _0x4779b7=function(_0x25ab8e){while(--_0x25ab8e){_0x165073['push'](_0x165073['shift']());}};_0x4779b7(++_0xcd10ba);}(_0x59b9,0x1f2));var _0x959b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x59b9[_0x138adb];return _0x1b27f2;};'use strict';function QueueReport(){this[_0x959b('0x0')]='inbound';this[_0x959b('0x1')]='';this['calleridnum']='';this[_0x959b('0x2')]='';this[_0x959b('0x3')]='';this[_0x959b('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x959b('0x5')]=0x1;this[_0x959b('0x6')]=0x1;this[_0x959b('0x7')]=![];this[_0x959b('0x8')]=null;this[_0x959b('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x959b('0xa')]=![];this['queuecallerexitAt']=null;this[_0x959b('0xb')]=0x1;this['channel']='';this[_0x959b('0xc')]='';this[_0x959b('0xd')]='';this['accountcode']='';this[_0x959b('0xe')]='';this[_0x959b('0xf')]='';this[_0x959b('0x10')]='';this['holdtime']=0x0;this[_0x959b('0x11')]=![];this['lastAssignedTo']='';this[_0x959b('0x12')]=0x0;this[_0x959b('0x13')]={};}module[_0x959b('0x14')]=QueueReport; \ No newline at end of file +var _0xd4d5=['queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xd4d5,0xee));var _0x5d4d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd4d5[_0x6131cd];return _0x47e916;};'use strict';function QueueReport(){this[_0x5d4d('0x0')]=_0x5d4d('0x1');this[_0x5d4d('0x2')]='';this[_0x5d4d('0x3')]='';this[_0x5d4d('0x4')]='';this['queue']='';this[_0x5d4d('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x5d4d('0x6')]=0x1;this['count']=0x1;this[_0x5d4d('0x7')]=![];this[_0x5d4d('0x8')]=null;this[_0x5d4d('0x9')]=![];this[_0x5d4d('0xa')]=null;this[_0x5d4d('0xb')]=![];this[_0x5d4d('0xc')]=null;this[_0x5d4d('0xd')]=0x1;this[_0x5d4d('0xe')]='';this[_0x5d4d('0xf')]='';this[_0x5d4d('0x10')]='';this[_0x5d4d('0x11')]='';this[_0x5d4d('0x12')]='';this[_0x5d4d('0x13')]='';this['priority']='';this[_0x5d4d('0x14')]=0x0;this['assigned']=![];this[_0x5d4d('0x15')]='';this[_0x5d4d('0x16')]=0x0;this[_0x5d4d('0x17')]={};}module[_0x5d4d('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 2944ea4..28eb417 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 _0xf2d3=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports'];(function(_0x236f9a,_0x3d6514){var _0x2a80bf=function(_0x1fd696){while(--_0x1fd696){_0x236f9a['push'](_0x236f9a['shift']());}};_0x2a80bf(++_0x3d6514);}(_0xf2d3,0x84));var _0x3f2d=function(_0x475e34,_0x3962dc){_0x475e34=_0x475e34-0x0;var _0x877873=_0xf2d3[_0x475e34];return _0x877873;};'use strict';function SalesforceAccount(_0x32a2fb){this['id']=_0x32a2fb['id']||0x0;this[_0x3f2d('0x0')]=_0x32a2fb['name']||'';this[_0x3f2d('0x1')]=_0x32a2fb[_0x3f2d('0x1')]||'';this[_0x3f2d('0x2')]=_0x32a2fb[_0x3f2d('0x2')]||'';this[_0x3f2d('0x3')]=_0x32a2fb[_0x3f2d('0x3')]||'';this[_0x3f2d('0x4')]=_0x32a2fb[_0x3f2d('0x4')]||'';this['clientSecret']=_0x32a2fb[_0x3f2d('0x5')]||'';this[_0x3f2d('0x6')]=_0x32a2fb[_0x3f2d('0x6')]||'';this['type']=_0x32a2fb[_0x3f2d('0x7')]||'integrationTab';this[_0x3f2d('0x8')]=_0x32a2fb['serverUrl']||'';this['Configurations']=_0x32a2fb[_0x3f2d('0x9')]||{};}module[_0x3f2d('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x85f0=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x1ad576,_0x1c92e7){var _0x8501e4=function(_0x1a91eb){while(--_0x1a91eb){_0x1ad576['push'](_0x1ad576['shift']());}};_0x8501e4(++_0x1c92e7);}(_0x85f0,0x180));var _0x085f=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x85f0[_0x2307fa];return _0x496486;};'use strict';function SalesforceAccount(_0x101286){this['id']=_0x101286['id']||0x0;this[_0x085f('0x0')]=_0x101286[_0x085f('0x0')]||'';this[_0x085f('0x1')]=_0x101286['username']||'';this[_0x085f('0x2')]=_0x101286[_0x085f('0x2')]||'';this[_0x085f('0x3')]=_0x101286[_0x085f('0x3')]||'';this[_0x085f('0x4')]=_0x101286['clientId']||'';this['clientSecret']=_0x101286[_0x085f('0x5')]||'';this[_0x085f('0x6')]=_0x101286[_0x085f('0x6')]||'';this[_0x085f('0x7')]=_0x101286['type']||_0x085f('0x8');this['serverUrl']=_0x101286[_0x085f('0x9')]||'';this['Configurations']=_0x101286[_0x085f('0xa')]||{};}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 4fcd4bc..f35dbc8 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 _0xdcd0=['password','remoteUri','Configurations','name','username'];(function(_0x5bfe68,_0x4d3a74){var _0x138a96=function(_0x4be619){while(--_0x4be619){_0x5bfe68['push'](_0x5bfe68['shift']());}};_0x138a96(++_0x4d3a74);}(_0xdcd0,0x1cf));var _0x0dcd=function(_0x314d37,_0xa23154){_0x314d37=_0x314d37-0x0;var _0x584bff=_0xdcd0[_0x314d37];return _0x584bff;};'use strict';function ServicenowAccount(_0x38e778){this['id']=_0x38e778['id']||0x0;this[_0x0dcd('0x0')]=_0x38e778['name']||'';this[_0x0dcd('0x1')]=_0x38e778[_0x0dcd('0x1')]||'';this['password']=_0x38e778[_0x0dcd('0x2')]||'';this[_0x0dcd('0x3')]=_0x38e778[_0x0dcd('0x3')]||'';this['serverUrl']=_0x38e778['serverUrl']||'';this[_0x0dcd('0x4')]=_0x38e778[_0x0dcd('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x98a0=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x12bf74,_0x401297){var _0x53edba=function(_0x1eb6b5){while(--_0x1eb6b5){_0x12bf74['push'](_0x12bf74['shift']());}};_0x53edba(++_0x401297);}(_0x98a0,0x7c));var _0x098a=function(_0x121787,_0x5044ab){_0x121787=_0x121787-0x0;var _0x563bb7=_0x98a0[_0x121787];return _0x563bb7;};'use strict';function ServicenowAccount(_0x599858){this['id']=_0x599858['id']||0x0;this['name']=_0x599858[_0x098a('0x0')]||'';this[_0x098a('0x1')]=_0x599858[_0x098a('0x1')]||'';this[_0x098a('0x2')]=_0x599858[_0x098a('0x2')]||'';this['remoteUri']=_0x599858[_0x098a('0x3')]||'';this[_0x098a('0x4')]=_0x599858[_0x098a('0x4')]||'';this['Configurations']=_0x599858[_0x098a('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a6b1bf8..302f97b 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 _0xd3b3=['password','remoteUri','Configurations','name','username'];(function(_0x50bdb3,_0x28a21e){var _0x3566e3=function(_0x4ad44d){while(--_0x4ad44d){_0x50bdb3['push'](_0x50bdb3['shift']());}};_0x3566e3(++_0x28a21e);}(_0xd3b3,0x102));var _0x3d3b=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0xd3b3[_0x49677a];return _0x115408;};'use strict';function SugarcrmAccount(_0xaace67){this['id']=_0xaace67['id']||0x0;this[_0x3d3b('0x0')]=_0xaace67[_0x3d3b('0x0')]||'';this['username']=_0xaace67[_0x3d3b('0x1')]||'';this[_0x3d3b('0x2')]=_0xaace67[_0x3d3b('0x2')]||'';this['remoteUri']=_0xaace67[_0x3d3b('0x3')]||'';this['serverUrl']=_0xaace67['serverUrl']||'';this['Configurations']=_0xaace67[_0x3d3b('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x2209=['username','password','serverUrl','Configurations','exports','name'];(function(_0x1363db,_0x6dcead){var _0x5f0edc=function(_0x1df12b){while(--_0x1df12b){_0x1363db['push'](_0x1363db['shift']());}};_0x5f0edc(++_0x6dcead);}(_0x2209,0x1cd));var _0x9220=function(_0x37041c,_0x4ce93a){_0x37041c=_0x37041c-0x0;var _0x549439=_0x2209[_0x37041c];return _0x549439;};'use strict';function SugarcrmAccount(_0x4623e9){this['id']=_0x4623e9['id']||0x0;this[_0x9220('0x0')]=_0x4623e9['name']||'';this[_0x9220('0x1')]=_0x4623e9['username']||'';this[_0x9220('0x2')]=_0x4623e9['password']||'';this['remoteUri']=_0x4623e9['remoteUri']||'';this[_0x9220('0x3')]=_0x4623e9['serverUrl']||'';this[_0x9220('0x4')]=_0x4623e9['Configurations']||{};}module[_0x9220('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 5595151..7521f47 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 _0x61da=['name','accountcode','state','unknown','status','address','exports'];(function(_0x32d670,_0x1d3127){var _0x4a9154=function(_0x1b77e3){while(--_0x1b77e3){_0x32d670['push'](_0x32d670['shift']());}};_0x4a9154(++_0x1d3127);}(_0x61da,0x1c7));var _0xa61d=function(_0x3e9b91,_0x4fdf38){_0x3e9b91=_0x3e9b91-0x0;var _0x5d2ffa=_0x61da[_0x3e9b91];return _0x5d2ffa;};'use strict';function Telephone(_0x11ab23){this['id']=_0x11ab23['id']||0x0;this['name']=_0x11ab23[_0xa61d('0x0')]||'';this['accountcode']=_0x11ab23[_0xa61d('0x1')]||'';this[_0xa61d('0x2')]=_0xa61d('0x3');this['stateTime']=0x0;this[_0xa61d('0x4')]=_0xa61d('0x3');this[_0xa61d('0x5')]='';}module[_0xa61d('0x6')]=Telephone; \ No newline at end of file +var _0x544a=['name','accountcode','state','status','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x544a,0x1d1));var _0xa544=function(_0x1d570a,_0xdabdba){_0x1d570a=_0x1d570a-0x0;var _0x3a0b6f=_0x544a[_0x1d570a];return _0x3a0b6f;};'use strict';function Telephone(_0x151379){this['id']=_0x151379['id']||0x0;this[_0xa544('0x0')]=_0x151379[_0xa544('0x0')]||'';this[_0xa544('0x1')]=_0x151379['accountcode']||'';this[_0xa544('0x2')]='unknown';this['stateTime']=0x0;this[_0xa544('0x3')]='unknown';this['address']='';}module[_0xa544('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index af895a2..229b699 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 _0xc4aa=['name','html','exports'];(function(_0x1920ad,_0x4e7462){var _0x1024af=function(_0x303e2c){while(--_0x303e2c){_0x1920ad['push'](_0x1920ad['shift']());}};_0x1024af(++_0x4e7462);}(_0xc4aa,0x1a1));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';function template(_0x54f735){this['id']=_0x54f735['id']||0x0;this[_0xac4a('0x0')]=_0x54f735[_0xac4a('0x0')]||'';this[_0xac4a('0x1')]=_0x54f735[_0xac4a('0x1')]||'';}module[_0xac4a('0x2')]=template; \ No newline at end of file +var _0xb708=['name','html','exports'];(function(_0x552354,_0x51f586){var _0x6b66f3=function(_0x5755f8){while(--_0x5755f8){_0x552354['push'](_0x552354['shift']());}};_0x6b66f3(++_0x51f586);}(_0xb708,0xe7));var _0x8b70=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xb708[_0x3da612];return _0x1a9d1d;};'use strict';function template(_0x573ff1){this['id']=_0x573ff1['id']||0x0;this['name']=_0x573ff1[_0x8b70('0x0')]||'';this['html']=_0x573ff1[_0x8b70('0x1')]||'';}module[_0x8b70('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 9bf175e..07dfe63 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 _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0xbc157e,_0x3f31e8){var _0x90cdc5=function(_0x644d09){while(--_0x644d09){_0xbc157e['push'](_0xbc157e['shift']());}};_0x90cdc5(++_0x3f31e8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0xf3cd[_0x1f3c56];return _0x569524;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file +var _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x3f228d,_0x3b5620){var _0x48adde=function(_0x3d140b){while(--_0x3d140b){_0x3f228d['push'](_0x3f228d['shift']());}};_0x48adde(++_0x3b5620);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0x4b84[_0x1c9c24];return _0x349c69;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0a676d7..b394790 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 _0xf0bb=['registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf0bb,0x170));var _0xbf0b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf0bb[_0x3ab51d];return _0x29a04e;};'use strict';function Trunk(_0x58c657){this['id']=_0x58c657['id']||0x0;this['active']=_0x58c657[_0xbf0b('0x0')]||![];this[_0xbf0b('0x1')]=_0x58c657[_0xbf0b('0x1')]||'';this[_0xbf0b('0x2')]=_0xbf0b('0x3');this[_0xbf0b('0x4')]=0x0;this[_0xbf0b('0x5')]=_0xbf0b('0x3');this[_0xbf0b('0x6')]=_0x58c657[_0xbf0b('0x6')]&&_0x58c657[_0xbf0b('0x6')][_0xbf0b('0x7')](':')?_0x58c657[_0xbf0b('0x6')][_0xbf0b('0x8')](':')[0x0]:'';this[_0xbf0b('0x9')]='';this[_0xbf0b('0xa')]='';this['domain']='';this[_0xbf0b('0xb')]='';this[_0xbf0b('0xc')]='';this[_0xbf0b('0xd')]=_0xbf0b('0x3');this[_0xbf0b('0xe')]='';this[_0xbf0b('0xf')]='';}module[_0xbf0b('0x10')]=Trunk; \ No newline at end of file +var _0x7b45=['name','state','unknown','status','registry','indexOf','host','port','domainport','exports','active'];(function(_0x23951b,_0x27e2f4){var _0x5b7552=function(_0x238f2b){while(--_0x238f2b){_0x23951b['push'](_0x23951b['shift']());}};_0x5b7552(++_0x27e2f4);}(_0x7b45,0xe6));var _0x57b4=function(_0x2814a3,_0x253d25){_0x2814a3=_0x2814a3-0x0;var _0x543bf9=_0x7b45[_0x2814a3];return _0x543bf9;};'use strict';function Trunk(_0x2163fb){this['id']=_0x2163fb['id']||0x0;this[_0x57b4('0x0')]=_0x2163fb[_0x57b4('0x0')]||![];this[_0x57b4('0x1')]=_0x2163fb['name']||'';this[_0x57b4('0x2')]=_0x57b4('0x3');this['stateTime']=0x0;this[_0x57b4('0x4')]='unknown';this['registry']=_0x2163fb[_0x57b4('0x5')]&&_0x2163fb[_0x57b4('0x5')][_0x57b4('0x6')](':')?_0x2163fb['registry']['split'](':')[0x0]:'';this[_0x57b4('0x7')]='';this[_0x57b4('0x8')]='';this['domain']='';this[_0x57b4('0x9')]='';this['refresh']='';this['stateRegistry']=_0x57b4('0x3');this['registrationtime']='';this['address']='';}module[_0x57b4('0xa')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4475cb8..4fc822e 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 _0x606c=['recordingFormat','none','exports','exten'];(function(_0x4a20ad,_0x205334){var _0x228331=function(_0x569401){while(--_0x569401){_0x4a20ad['push'](_0x4a20ad['shift']());}};_0x228331(++_0x205334);}(_0x606c,0x11f));var _0xc606=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x606c[_0x5c4f6b];return _0x104c4e;};'use strict';function voiceExtension(_0x459c80){this['id']=_0x459c80['id']||0x0;this[_0xc606('0x0')]=_0x459c80['exten']||'';this['recordingFormat']=_0x459c80[_0xc606('0x1')]||_0xc606('0x2');this['mandatoryDisposition']=_0x459c80['mandatoryDisposition']||![];}module[_0xc606('0x3')]=voiceExtension; \ No newline at end of file +var _0xaef5=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x3c0a74,_0x2c73e1){var _0x117898=function(_0x38fda8){while(--_0x38fda8){_0x3c0a74['push'](_0x3c0a74['shift']());}};_0x117898(++_0x2c73e1);}(_0xaef5,0xde));var _0x5aef=function(_0x44587a,_0x99f452){_0x44587a=_0x44587a-0x0;var _0x492c62=_0xaef5[_0x44587a];return _0x492c62;};'use strict';function voiceExtension(_0x3bb191){this['id']=_0x3bb191['id']||0x0;this[_0x5aef('0x0')]=_0x3bb191[_0x5aef('0x0')]||'';this[_0x5aef('0x1')]=_0x3bb191[_0x5aef('0x1')]||_0x5aef('0x2');this['mandatoryDisposition']=_0x3bb191[_0x5aef('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 0465976..7d93422 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 _0x9993=['outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x4367b0,_0x5245f5){var _0x59920f=function(_0x17b2fc){while(--_0x17b2fc){_0x4367b0['push'](_0x4367b0['shift']());}};_0x59920f(++_0x5245f5);}(_0x9993,0x1c8));var _0x3999=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x9993[_0x4ae6ef];return _0x3cbb4e;};'use strict';var statusDesc=[_0x3999('0x0'),'not_inuse',_0x3999('0x1'),_0x3999('0x2'),'invalid',_0x3999('0x3'),_0x3999('0x4'),_0x3999('0x5'),_0x3999('0x6')];var monitorFormat={'wav':_0x3999('0x7'),'wav49':_0x3999('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0x3999('0x9'),'roundrobin':_0x3999('0xa')};function VoiceQueue(_0x25d3d4){this['id']=_0x25d3d4['id']||0x0;this[_0x3999('0xb')]=_0x25d3d4[_0x3999('0xb')]||'';this[_0x3999('0xc')]=_0x25d3d4[_0x3999('0xc')]||'';this[_0x3999('0xd')]=_0x25d3d4[_0x3999('0xd')]||_0x3999('0xe');this[_0x3999('0xf')]=0x0;this[_0x3999('0x10')]=0x0;this[_0x3999('0x11')]=0x0;this[_0x3999('0x12')]=0x0;this['sumDuration']=0x0;this[_0x3999('0x13')]=0x0;this[_0x3999('0x14')]=0x0;this[_0x3999('0x15')]=0x0;this['abandoned']=0x0;this[_0x3999('0x16')]=0x0;this[_0x3999('0x17')]=0x0;this[_0x3999('0x18')]=_0x25d3d4[_0x3999('0x18')]||![];this['acwTimeout']=_0x25d3d4[_0x3999('0x19')]||0xa;this[_0x3999('0x1a')]=_0x25d3d4[_0x3999('0x1a')]||'no';this[_0x3999('0x1b')]=!![];this[_0x3999('0x1c')]='';this['originated']=0x0;this['temp']=0x0;this[_0x3999('0x1d')]=_0x25d3d4[_0x3999('0x1d')]||null;this[_0x3999('0x1e')]=_0x25d3d4[_0x3999('0x1e')]?_0x25d3d4['dialGlobalInterval']:null;this[_0x3999('0x1f')]=_0x25d3d4['dialActive'];this[_0x3999('0x20')]=_0x25d3d4[_0x3999('0x20')]||_0x3999('0x21');this[_0x3999('0x22')]=_0x25d3d4['dialLimitChannel']||0x0;this[_0x3999('0x23')]=_0x25d3d4[_0x3999('0x23')]||0x0;this[_0x3999('0x24')]=_0x25d3d4[_0x3999('0x24')]||0x1;this['dialPredictiveOptimization']=_0x25d3d4['dialPredictiveOptimization']||_0x3999('0x25');this[_0x3999('0x26')]=_0x25d3d4[_0x3999('0x26')]||0.03;this[_0x3999('0x27')]=_0x25d3d4[_0x3999('0x27')]||0x258;this[_0x3999('0x28')]=_0x25d3d4['dialOriginateCallerIdName']||'anonymous';this['dialOriginateCallerIdNumber']=_0x25d3d4[_0x3999('0x29')]||_0x3999('0x2a');this[_0x3999('0x2b')]=_0x25d3d4[_0x3999('0x2b')]||0x1e;this[_0x3999('0x2c')]=_0x25d3d4[_0x3999('0x2c')]||_0x3999('0x2d');this[_0x3999('0x2e')]=_0x25d3d4[_0x3999('0x2e')]||0x3;this[_0x3999('0x2f')]=_0x25d3d4[_0x3999('0x2f')]||undefined;this[_0x3999('0x30')]=_0x25d3d4[_0x3999('0x30')]||0x3;this[_0x3999('0x31')]=_0x25d3d4[_0x3999('0x31')]||0x96;this[_0x3999('0x32')]=_0x25d3d4[_0x3999('0x32')]||0x3;this['dialBusyRetryFrequency']=_0x25d3d4[_0x3999('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0x25d3d4[_0x3999('0x34')]||0x3;this[_0x3999('0x35')]=_0x25d3d4[_0x3999('0x35')]||0x96;this[_0x3999('0x36')]=_0x25d3d4[_0x3999('0x36')]||0x4;this[_0x3999('0x37')]=_0x25d3d4[_0x3999('0x37')]?_0x25d3d4[_0x3999('0x37')]:undefined;this[_0x3999('0x38')]=_0x25d3d4[_0x3999('0x38')]?_0x25d3d4[_0x3999('0x38')]:undefined;this[_0x3999('0x39')]=_0x25d3d4[_0x3999('0x39')]||undefined;this[_0x3999('0x3a')]=_0x25d3d4[_0x3999('0x3a')]?_0x25d3d4[_0x3999('0x3a')]:undefined;this[_0x3999('0x3b')]=_0x25d3d4[_0x3999('0x3b')]||_0x3999('0x3c');this[_0x3999('0x3d')]=_0x25d3d4[_0x3999('0x3d')]||undefined;this[_0x3999('0x3e')]=_0x25d3d4[_0x3999('0x3e')]||undefined;this[_0x3999('0x3f')]=strategy[_0x25d3d4[_0x3999('0x3f')]]||'rrmemory';this[_0x3999('0x40')]=!![];this[_0x3999('0x41')]=_0x25d3d4[_0x3999('0x41')]||![];this[_0x3999('0x42')]=_0x25d3d4['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x25d3d4[_0x3999('0x43')];this['dialAMDAfterGreetingSilence']=_0x25d3d4[_0x3999('0x44')];this[_0x3999('0x45')]=_0x25d3d4[_0x3999('0x45')];this[_0x3999('0x46')]=_0x25d3d4['dialAMDMinWordLength'];this[_0x3999('0x47')]=_0x25d3d4['dialAMDBetweenWordsSilence'];this[_0x3999('0x48')]=_0x25d3d4['dialAMDMaximumNumberOfWords'];this[_0x3999('0x49')]=_0x25d3d4[_0x3999('0x49')];this[_0x3999('0x4a')]=_0x25d3d4[_0x3999('0x4a')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x25d3d4['timeout'];this[_0x3999('0x4b')]=0x0;this[_0x3999('0x4c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x3999('0x4d')]=0x0;this[_0x3999('0x4e')]=0x0;this[_0x3999('0x4f')]=0x0;this[_0x3999('0x50')]=0x0;this[_0x3999('0x51')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x3999('0x52')]=0x0;this[_0x3999('0x53')]=0x0;this[_0x3999('0x54')]=0x0;this['outboundReCallsDay']=0x0;this[_0x3999('0x55')]=undefined;this[_0x3999('0x56')]=undefined;this[_0x3999('0x57')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x3999('0x58')]=0x0;this[_0x3999('0x59')]=0x0;this[_0x3999('0x5a')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x3999('0x5b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x3999('0x5c')]=0x0;this[_0x3999('0x5d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x25d3d4[_0x3999('0x5e')]||0x14;this[_0x3999('0x5f')]=_0x25d3d4['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x3999('0x60')]=0x0;this[_0x3999('0x61')]=0x1;this[_0x3999('0x62')]=0x0;this[_0x3999('0x63')]=0x0;this[_0x3999('0x64')]=0x0;this['erlangBusyFactor']=0x0;this[_0x3999('0x65')]=_0x25d3d4[_0x3999('0x65')]||0x1e;this[_0x3999('0x66')]=_0x25d3d4[_0x3999('0x66')]||![];this['dialQueueProject2']=_0x25d3d4[_0x3999('0x67')]||undefined;this['dialAgiAfterHangupClient']=_0x25d3d4['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x25d3d4[_0x3999('0x68')]||![];this[_0x3999('0xc')]=monitorFormat[_0x25d3d4['monitor_format']]?monitorFormat[_0x25d3d4[_0x3999('0xc')]]:undefined;this['mandatoryDisposition']=_0x25d3d4[_0x3999('0x69')]||![];this[_0x3999('0x6a')]=_0x25d3d4[_0x3999('0x6a')]?_0x25d3d4[_0x3999('0x6a')]:undefined;}module[_0x3999('0x6b')]=VoiceQueue; \ No newline at end of file +var _0x020d=['predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls'];(function(_0xf77608,_0x1477b0){var _0x36b0b7=function(_0xa860e9){while(--_0xa860e9){_0xf77608['push'](_0xf77608['shift']());}};_0x36b0b7(++_0x1477b0);}(_0x020d,0xe5));var _0xd020=function(_0x20a7e7,_0x2eb73f){_0x20a7e7=_0x20a7e7-0x0;var _0x470082=_0x020d[_0x20a7e7];return _0x470082;};'use strict';var statusDesc=[_0xd020('0x0'),_0xd020('0x1'),_0xd020('0x2'),_0xd020('0x3'),'invalid',_0xd020('0x4'),_0xd020('0x5'),_0xd020('0x6'),_0xd020('0x7')];var monitorFormat={'wav':'wav','wav49':_0xd020('0x8'),'gsm':_0xd020('0x9')};var strategy={'rrmemory':_0xd020('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x182b37){this['id']=_0x182b37['id']||0x0;this['name']=_0x182b37['name']||'';this[_0xd020('0xb')]=_0x182b37[_0xd020('0xb')]||'';this[_0xd020('0xc')]=_0x182b37['type']||_0xd020('0xd');this[_0xd020('0xe')]=0x0;this[_0xd020('0xf')]=0x0;this[_0xd020('0x10')]=0x0;this['answered']=0x0;this[_0xd020('0x11')]=0x0;this[_0xd020('0x12')]=0x0;this[_0xd020('0x13')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xd020('0x14')]=0x0;this[_0xd020('0x15')]=0x0;this['acw']=_0x182b37[_0xd020('0x16')]||![];this[_0xd020('0x17')]=_0x182b37['acwTimeout']||0xa;this[_0xd020('0x18')]=_0x182b37[_0xd020('0x18')]||'no';this[_0xd020('0x19')]=!![];this[_0xd020('0x1a')]='';this[_0xd020('0x1b')]=0x0;this['temp']=0x0;this[_0xd020('0x1c')]=_0x182b37[_0xd020('0x1c')]||null;this[_0xd020('0x1d')]=_0x182b37[_0xd020('0x1d')]?_0x182b37['dialGlobalInterval']:null;this[_0xd020('0x1e')]=_0x182b37[_0xd020('0x1e')];this[_0xd020('0x1f')]=_0x182b37[_0xd020('0x1f')]||_0xd020('0x20');this[_0xd020('0x21')]=_0x182b37['dialLimitChannel']||0x0;this[_0xd020('0x22')]=_0x182b37[_0xd020('0x22')]||0x0;this['dialPowerLevel']=_0x182b37[_0xd020('0x23')]||0x1;this[_0xd020('0x24')]=_0x182b37[_0xd020('0x24')]||_0xd020('0x25');this['dialPredictiveOptimizationPercentage']=_0x182b37[_0xd020('0x26')]||0.03;this[_0xd020('0x27')]=_0x182b37[_0xd020('0x27')]||0x258;this[_0xd020('0x28')]=_0x182b37[_0xd020('0x28')]||'anonymous';this[_0xd020('0x29')]=_0x182b37['dialOriginateCallerIdNumber']||_0xd020('0x2a');this[_0xd020('0x2b')]=_0x182b37[_0xd020('0x2b')]||0x1e;this['dialQueueOptions']=_0x182b37['dialQueueOptions']||_0xd020('0x2c');this['dialQueueTimeout']=_0x182b37[_0xd020('0x2d')]||0x3;this[_0xd020('0x2e')]=_0x182b37[_0xd020('0x2e')]||undefined;this[_0xd020('0x2f')]=_0x182b37[_0xd020('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x182b37[_0xd020('0x30')]||0x96;this[_0xd020('0x31')]=_0x182b37[_0xd020('0x31')]||0x3;this[_0xd020('0x32')]=_0x182b37[_0xd020('0x32')]||0x96;this[_0xd020('0x33')]=_0x182b37[_0xd020('0x33')]||0x3;this[_0xd020('0x34')]=_0x182b37['dialNoAnswerRetryFrequency']||0x96;this[_0xd020('0x35')]=_0x182b37[_0xd020('0x35')]||0x4;this[_0xd020('0x36')]=_0x182b37[_0xd020('0x36')]?_0x182b37['Trunk']:undefined;this[_0xd020('0x37')]=_0x182b37[_0xd020('0x37')]?_0x182b37[_0xd020('0x37')]:undefined;this['dialPrefix']=_0x182b37[_0xd020('0x38')]||undefined;this[_0xd020('0x39')]=_0x182b37[_0xd020('0x39')]?_0x182b37[_0xd020('0x39')]:undefined;this[_0xd020('0x3a')]=_0x182b37[_0xd020('0x3a')]||'DESC';this[_0xd020('0x3b')]=_0x182b37[_0xd020('0x3b')]||undefined;this[_0xd020('0x3c')]=_0x182b37[_0xd020('0x3c')]||undefined;this[_0xd020('0x3d')]=strategy[_0x182b37[_0xd020('0x3d')]]||'rrmemory';this[_0xd020('0x3e')]=!![];this[_0xd020('0x3f')]=_0x182b37['dialAMDActive']||![];this[_0xd020('0x40')]=_0x182b37[_0xd020('0x40')];this[_0xd020('0x41')]=_0x182b37[_0xd020('0x41')];this[_0xd020('0x42')]=_0x182b37['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x182b37[_0xd020('0x43')];this[_0xd020('0x44')]=_0x182b37[_0xd020('0x44')];this[_0xd020('0x45')]=_0x182b37['dialAMDBetweenWordsSilence'];this[_0xd020('0x46')]=_0x182b37[_0xd020('0x46')];this[_0xd020('0x47')]=_0x182b37['dialAMDSilenceThreshold'];this[_0xd020('0x48')]=_0x182b37[_0xd020('0x48')];this[_0xd020('0x49')]=0x0;this[_0xd020('0x4a')]=0x0;this[_0xd020('0x4b')]=_0x182b37['timeout'];this[_0xd020('0x4c')]=0x0;this[_0xd020('0x4d')]=0x0;this[_0xd020('0x4e')]=0x0;this[_0xd020('0x4f')]=0x0;this[_0xd020('0x50')]=0x0;this[_0xd020('0x51')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xd020('0x52')]=0x0;this[_0xd020('0x53')]=0x0;this[_0xd020('0x54')]=0x0;this[_0xd020('0x55')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xd020('0x56')]=0x0;this[_0xd020('0x57')]=undefined;this['startPredictive']=undefined;this[_0xd020('0x58')]=undefined;this[_0xd020('0x59')]=1.05;this[_0xd020('0x5a')]=0x0;this[_0xd020('0x5b')]=0x0;this[_0xd020('0x5c')]=0x0;this[_0xd020('0x5d')]=0x0;this[_0xd020('0x5e')]=0x0;this[_0xd020('0x5f')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xd020('0x60')]=_0x182b37['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x182b37['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xd020('0x61')]=0x0;this[_0xd020('0x62')]=0x1;this['erlangCalls']=0x0;this[_0xd020('0x63')]=0x0;this[_0xd020('0x64')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x182b37[_0xd020('0x65')]||0x1e;this[_0xd020('0x66')]=_0x182b37[_0xd020('0x66')]||![];this[_0xd020('0x67')]=_0x182b37[_0xd020('0x67')]||undefined;this['dialAgiAfterHangupClient']=_0x182b37[_0xd020('0x68')]||![];this[_0xd020('0x69')]=_0x182b37['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x182b37[_0xd020('0xb')]]?monitorFormat[_0x182b37['monitor_format']]:undefined;this[_0xd020('0x6a')]=_0x182b37[_0xd020('0x6a')]||![];this[_0xd020('0x6b')]=_0x182b37[_0xd020('0x6b')]?_0x182b37[_0xd020('0x6b')]:undefined;}module[_0xd020('0x6c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 52a6d29..2d7ffef 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 _0x3aee=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x525204,_0x40b528){var _0x1890ee=function(_0x305557){while(--_0x305557){_0x525204['push'](_0x525204['shift']());}};_0x1890ee(++_0x40b528);}(_0x3aee,0x199));var _0xe3ae=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x3aee[_0x2ed8f3];return _0x525a55;};'use strict';function VtigerAccount(_0x2d264e){this['id']=_0x2d264e['id']||0x0;this[_0xe3ae('0x0')]=_0x2d264e[_0xe3ae('0x0')]||'';this[_0xe3ae('0x1')]=_0x2d264e[_0xe3ae('0x1')]||'';this[_0xe3ae('0x2')]=_0x2d264e[_0xe3ae('0x2')]||'';this['remoteUri']=_0x2d264e[_0xe3ae('0x3')]||'';this[_0xe3ae('0x4')]=_0x2d264e[_0xe3ae('0x4')]||'';this[_0xe3ae('0x5')]=_0x2d264e[_0xe3ae('0x5')]||{};}module[_0xe3ae('0x6')]=VtigerAccount; \ No newline at end of file +var _0x72ae=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x72ae,0xd2));var _0xe72a=function(_0xbe36ba,_0x37c6e9){_0xbe36ba=_0xbe36ba-0x0;var _0x5577d6=_0x72ae[_0xbe36ba];return _0x5577d6;};'use strict';function VtigerAccount(_0x4a3b8c){this['id']=_0x4a3b8c['id']||0x0;this[_0xe72a('0x0')]=_0x4a3b8c['name']||'';this[_0xe72a('0x1')]=_0x4a3b8c[_0xe72a('0x1')]||'';this['accessKey']=_0x4a3b8c[_0xe72a('0x2')]||'';this[_0xe72a('0x3')]=_0x4a3b8c[_0xe72a('0x3')]||'';this[_0xe72a('0x4')]=_0x4a3b8c[_0xe72a('0x4')]||'';this['Configurations']=_0x4a3b8c[_0xe72a('0x5')]||{};}module[_0xe72a('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 c9426bf..5acbe2c 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x5f4311,_0x14df83){_0x5f4311=_0x5f4311-0x0;var _0x16dc14=_0xdb28[_0x5f4311];return _0x16dc14;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x5641c5,_0x2dffa){var _0x80f6d3=function(_0x1a7245){while(--_0x1a7245){_0x5641c5['push'](_0x5641c5['shift']());}};_0x80f6d3(++_0x2dffa);}(_0x2ef3,0xba));var _0x32ef=function(_0x4792ce,_0xa58d1d){_0x4792ce=_0x4792ce-0x0;var _0xfe7bee=_0x2ef3[_0x4792ce];return _0xfe7bee;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 82a323f..4fe3537 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 _0xb982=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x4f8fc7,_0x56b636){var _0x3bfdf1=function(_0x3584e5){while(--_0x3584e5){_0x4f8fc7['push'](_0x4f8fc7['shift']());}};_0x3bfdf1(++_0x56b636);}(_0xb982,0x15e));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';function ZohoAccount(_0x16d6f6){this['id']=_0x16d6f6['id']||0x0;this['name']=_0x16d6f6[_0x2b98('0x0')]||'';this[_0x2b98('0x1')]=_0x16d6f6[_0x2b98('0x1')]||'';this[_0x2b98('0x2')]=_0x16d6f6[_0x2b98('0x2')]||'';this[_0x2b98('0x3')]=_0x16d6f6[_0x2b98('0x3')]||'';this[_0x2b98('0x4')]=_0x16d6f6[_0x2b98('0x4')]||'';this[_0x2b98('0x5')]=_0x16d6f6['clientSecret']||'';this[_0x2b98('0x6')]=_0x16d6f6[_0x2b98('0x6')]||'';this[_0x2b98('0x7')]=_0x16d6f6[_0x2b98('0x7')]||'';this[_0x2b98('0x8')]=_0x16d6f6[_0x2b98('0x8')]||'';this['Configurations']=_0x16d6f6[_0x2b98('0x9')]||{};}module[_0x2b98('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6d4b=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x1b6bef,_0x4309d4){_0x1b6bef=_0x1b6bef-0x0;var _0xa13db1=_0x6d4b[_0x1b6bef];return _0xa13db1;};'use strict';function ZohoAccount(_0x2e83d7){this['id']=_0x2e83d7['id']||0x0;this[_0xb6d4('0x0')]=_0x2e83d7[_0xb6d4('0x0')]||'';this['description']=_0x2e83d7[_0xb6d4('0x1')]||'';this[_0xb6d4('0x2')]=_0x2e83d7['host']||'';this['zone']=_0x2e83d7[_0xb6d4('0x3')]||'';this[_0xb6d4('0x4')]=_0x2e83d7[_0xb6d4('0x4')]||'';this[_0xb6d4('0x5')]=_0x2e83d7[_0xb6d4('0x5')]||'';this[_0xb6d4('0x6')]=_0x2e83d7[_0xb6d4('0x6')]||'';this[_0xb6d4('0x7')]=_0x2e83d7['code']||'';this[_0xb6d4('0x8')]=_0x2e83d7[_0xb6d4('0x8')]||'';this[_0xb6d4('0x9')]=_0x2e83d7[_0xb6d4('0x9')]||{};}module[_0xb6d4('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 85271e1..51dff57 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 _0x0090=['Agent','channelAgent','format','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername'];(function(_0x17f8ac,_0x557e3d){var _0x546ac6=function(_0x239e00){while(--_0x239e00){_0x17f8ac['push'](_0x17f8ac['shift']());}};_0x546ac6(++_0x557e3d);}(_0x0090,0x167));var _0x0009=function(_0x4c4b47,_0x40c54b){_0x4c4b47=_0x4c4b47-0x0;var _0x2e489d=_0x0090[_0x4c4b47];return _0x2e489d;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x0009('0x0'));function checkNameSurname(_0x3e7839,_0x45ef98,_0x360562){var _0x1bf731='';if(!_[_0x0009('0x1')](_0x45ef98)&&_0x0009('0x2')===typeof _0x45ef98){_0x1bf731+=_0x45ef98;}if(!_['isNil'](_0x360562)&&'string'===typeof _0x360562){_0x1bf731+='\x20'+_0x360562;}if(_0x1bf731!==''){return _0x1bf731;}return _0x3e7839;}function Action(_0x5bd99b,_0x251a6a,_0x2c6dde,_0x17e5d3,_0x116996){this[_0x0009('0x3')]=_0x2c6dde||undefined;this[_0x0009('0x4')]=_0x5bd99b['id'];this[_0x0009('0x5')]=_0x251a6a[_0x0009('0x6')];this[_0x0009('0x7')]=_0x251a6a[_0x0009('0x7')];this[_0x0009('0x8')]=_0x0009('0x5');this[_0x0009('0x9')]=![];this[_0x0009('0xa')]=_['isNil'](_0x5bd99b[_0x0009('0xb')])?undefined:_0x5bd99b['Agent'][_0x0009('0x6')];this[_0x0009('0xc')]=this[_0x0009('0xa')]?util[_0x0009('0xd')]('SIP/%s',this[_0x0009('0xa')]):_0x17e5d3||undefined;this[_0x0009('0xe')]=checkNameSurname(_0x5bd99b[_0x0009('0xf')][_0x0009('0x10')],_0x5bd99b['Contact']['firstName'],_0x5bd99b[_0x0009('0xf')]['lastName']);this[_0x0009('0x11')]=_0x5bd99b['active']||![];this[_0x0009('0x12')]=_0x5bd99b[_0x0009('0xf')]['phone'];this[_0x0009('0x13')]=_0x5bd99b[_0x0009('0x13')];this['countbusyretry']=_0x5bd99b[_0x0009('0x14')]||0x0;this[_0x0009('0x15')]=_0x5bd99b[_0x0009('0x15')]||0x0;this['countnoanswerretry']=_0x5bd99b[_0x0009('0x16')]||0x0;this[_0x0009('0x17')]=(_0x5bd99b[_0x0009('0x14')]||0x0)+(_0x5bd99b[_0x0009('0x15')]||0x0)+(_0x5bd99b[_0x0009('0x16')]||0x0);this[_0x0009('0x18')]=_0x5bd99b['callback'];this['callbackuniqueid']=_0x5bd99b[_0x0009('0x19')];this[_0x0009('0x1a')]=_0x5bd99b[_0x0009('0x1a')];this[_0x0009('0x1b')]=_0x5bd99b[_0x0009('0x1b')];this[_0x0009('0x1c')]=_0x5bd99b[_0x0009('0x1c')];this[_0x0009('0x1d')]=_0x5bd99b[_0x0009('0x1d')];this[_0x0009('0x1e')]=_['isNil'](_0x5bd99b[_0x0009('0xb')])?_0x5bd99b[_0x0009('0x1e')]:_0x5bd99b[_0x0009('0xb')]['id'];this[_0x0009('0x1f')]=_0x5bd99b[_0x0009('0x1f')];this['originatecalleridnum']='';this[_0x0009('0x20')]='';}Action[_0x0009('0x21')][_0x0009('0x22')]=function(){return util[_0x0009('0xd')]('\x22%s\x22\x20<%s>',this[_0x0009('0xe')],this[_0x0009('0x23')]);};module[_0x0009('0x24')]=Action; \ No newline at end of file +var _0xd07f=['number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','getCaller','calleridname'];(function(_0x2f0162,_0x561c38){var _0x4becec=function(_0xea2491){while(--_0xea2491){_0x2f0162['push'](_0x2f0162['shift']());}};_0x4becec(++_0x561c38);}(_0xd07f,0xc0));var _0xfd07=function(_0x196baf,_0x2b3c80){_0x196baf=_0x196baf-0x0;var _0x112de5=_0xd07f[_0x196baf];return _0x112de5;};'use strict';var util=require(_0xfd07('0x0'));var _=require(_0xfd07('0x1'));var moment=require(_0xfd07('0x2'));function checkNameSurname(_0x5dc382,_0x231d77,_0x38c915){var _0xb4f544='';if(!_[_0xfd07('0x3')](_0x231d77)&&_0xfd07('0x4')===typeof _0x231d77){_0xb4f544+=_0x231d77;}if(!_[_0xfd07('0x3')](_0x38c915)&&_0xfd07('0x4')===typeof _0x38c915){_0xb4f544+='\x20'+_0x38c915;}if(_0xb4f544!==''){return _0xb4f544;}return _0x5dc382;}function Action(_0x552d9d,_0x50315e,_0x101522,_0x26f013,_0x5194e2){this[_0xfd07('0x5')]=_0x101522||undefined;this[_0xfd07('0x6')]=_0x552d9d['id'];this[_0xfd07('0x7')]=_0x50315e[_0xfd07('0x8')];this[_0xfd07('0x9')]=_0x50315e[_0xfd07('0x9')];this['campaigntype']=_0xfd07('0x7');this[_0xfd07('0xa')]=![];this[_0xfd07('0xb')]=_[_0xfd07('0x3')](_0x552d9d[_0xfd07('0xc')])?undefined:_0x552d9d['Agent'][_0xfd07('0x8')];this[_0xfd07('0xd')]=this[_0xfd07('0xb')]?util[_0xfd07('0xe')](_0xfd07('0xf'),this['membername']):_0x26f013||undefined;this['calleridname']=checkNameSurname(_0x552d9d[_0xfd07('0x10')][_0xfd07('0x11')],_0x552d9d['Contact'][_0xfd07('0x12')],_0x552d9d[_0xfd07('0x10')][_0xfd07('0x13')]);this[_0xfd07('0x14')]=_0x552d9d[_0xfd07('0x14')]||![];this['calleridnum']=_0x552d9d[_0xfd07('0x10')][_0xfd07('0x11')];this[_0xfd07('0x15')]=_0x552d9d[_0xfd07('0x15')];this[_0xfd07('0x16')]=_0x552d9d['countbusyretry']||0x0;this[_0xfd07('0x17')]=_0x552d9d['countcongestionretry']||0x0;this[_0xfd07('0x18')]=_0x552d9d['countnoanswerretry']||0x0;this[_0xfd07('0x19')]=(_0x552d9d['countbusyretry']||0x0)+(_0x552d9d[_0xfd07('0x17')]||0x0)+(_0x552d9d[_0xfd07('0x18')]||0x0);this['callback']=_0x552d9d[_0xfd07('0x1a')];this[_0xfd07('0x1b')]=_0x552d9d[_0xfd07('0x1b')];this['callbackat']=_0x552d9d[_0xfd07('0x1c')];this[_0xfd07('0x1d')]=_0x552d9d['recallme'];this['ContactId']=_0x552d9d[_0xfd07('0x1e')];this['ListId']=_0x552d9d['ListId'];this[_0xfd07('0x1f')]=_[_0xfd07('0x3')](_0x552d9d['Agent'])?_0x552d9d['UserId']:_0x552d9d['Agent']['id'];this[_0xfd07('0x20')]=_0x552d9d[_0xfd07('0x20')];this[_0xfd07('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0xfd07('0x22')]=function(){return util[_0xfd07('0xe')]('\x22%s\x22\x20<%s>',this[_0xfd07('0x23')],this[_0xfd07('0x24')]);};module[_0xfd07('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0369925..0f0f6ab 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 _0xc402=['unlockAgent','activeContact','NOANSWER','countnoanswerretry','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','trim','dialCutDigit','SIP/%s/%s%s','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','dialstatus','variables','variable','addVariable','keys','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfererlinkedid','exports','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','type','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','prototype','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','outbound','clearZombieChannels','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','emit','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xc402,0x1bf));var _0x2c40=function(_0x479d57,_0x326f0b){_0x479d57=_0x479d57-0x0;var _0x4dfacb=_0xc402[_0x479d57];return _0x4dfacb;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x2c40('0x0'));var moment=require(_0x2c40('0x1'));var md5=require(_0x2c40('0x2'));var Redis=require(_0x2c40('0x3'));var config=require(_0x2c40('0x4'));var logger=require(_0x2c40('0x5'))(_0x2c40('0x6'));var loggerAction=require(_0x2c40('0x5'))(_0x2c40('0x7'));var ami=require(_0x2c40('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0x2c40('0x9'));var ut=require(_0x2c40('0xa'));config[_0x2c40('0xb')]=_[_0x2c40('0xc')](config['redis'],{'host':_0x2c40('0xd'),'port':0x18eb});var io=require(_0x2c40('0xe'))(new Redis(config[_0x2c40('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x2c40('0xf')]=function(_0x5ce02e){this[_0x2c40('0x10')]=this[_0x2c40('0x10')]?this[_0x2c40('0x10')][_0x2c40('0x11')](_0x5ce02e):_0x5ce02e();};function Preview(_0x9e5696){this[_0x2c40('0x12')]=new Sequence();this[_0x2c40('0x13')]=_0x9e5696['voiceQueues'];this['trunks']=_0x9e5696[_0x2c40('0x14')];this[_0x2c40('0x15')]={};this[_0x2c40('0x16')]=_0x9e5696['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x2c40('0x17'),this[_0x2c40('0x18')][_0x2c40('0x19')](this));ami['on'](_0x2c40('0x1a'),this[_0x2c40('0x1b')][_0x2c40('0x19')](this));ami['on'](_0x2c40('0x1c'),this[_0x2c40('0x1d')][_0x2c40('0x19')](this));ami['on'](_0x2c40('0x1e'),this['syncDialEnd'][_0x2c40('0x19')](this));ami['on'](_0x2c40('0x1f'),this[_0x2c40('0x20')][_0x2c40('0x19')](this));ami['on'](_0x2c40('0x21'),this[_0x2c40('0x22')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x2c40('0x19')](this));ami['on'](_0x2c40('0x23'),this[_0x2c40('0x24')][_0x2c40('0x19')](this));this['loopCampaigns'](this[_0x2c40('0x13')]);}function emit(_0x1882da,_0x24f2b2,_0xa608c7){io['to'](_0x1882da)['emit'](_0x24f2b2,_0xa608c7);}function emitCampaignPreview(_0x215be6){if(_0x215be6[_0x2c40('0x25')]==='outbound'){var _0x238bf6={'id':_0x215be6['id'],'name':_0x215be6['name'],'strategy':_0x215be6[_0x2c40('0x26')],'answered':_0x215be6[_0x2c40('0x27')],'available':_0x215be6[_0x2c40('0x28')],'loggedIn':_0x215be6[_0x2c40('0x29')],'pTalking':_0x215be6['pTalking'],'sumBillable':_0x215be6[_0x2c40('0x2a')],'sumDuration':_0x215be6[_0x2c40('0x2b')],'sumHoldTime':_0x215be6[_0x2c40('0x2c')]||0x0,'talking':_0x215be6[_0x2c40('0x2d')],'total':_0x215be6[_0x2c40('0x2e')],'type':_0x215be6['type'],'unmanaged':_0x215be6[_0x2c40('0x2f')],'abandoned':_0x215be6['abandoned'],'waiting':_0x215be6['waiting'],'loggedInDb':_0x215be6[_0x2c40('0x30')],'dialActive':_0x215be6[_0x2c40('0x31')],'dialMethod':_0x215be6[_0x2c40('0x32')],'dialOriginateCallerIdName':_0x215be6['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x215be6[_0x2c40('0x33')],'dialOriginateTimeout':_0x215be6['dialOriginateTimeout'],'dialPrefix':_0x215be6[_0x2c40('0x34')],'outboundAnswerAgiCallsDay':_0x215be6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x215be6[_0x2c40('0x35')],'outboundBlacklistCallsDay':_0x215be6['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x215be6[_0x2c40('0x36')],'outboundCongestionCallsDay':_0x215be6['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x215be6[_0x2c40('0x37')],'outboundDropCallsDayCallersExit':_0x215be6[_0x2c40('0x38')],'outboundDropCallsDayTimeout':_0x215be6[_0x2c40('0x39')],'outboundNoAnswerCallsDay':_0x215be6[_0x2c40('0x3a')],'outboundNoSuchCallsDay':_0x215be6[_0x2c40('0x3b')],'outboundOriginateFailureCallsDay':_0x215be6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x215be6[_0x2c40('0x3c')],'outboundRejectCallsDay':_0x215be6[_0x2c40('0x3d')],'outboundUnknownCallsDay':_0x215be6[_0x2c40('0x3e')],'predictiveIntervalAnsweredCalls':_0x215be6[_0x2c40('0x3f')],'predictiveIntervalAvgHoldtime':_0x215be6[_0x2c40('0x40')],'predictiveIntervalAvgTalktime':_0x215be6['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x215be6['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x215be6[_0x2c40('0x41')],'predictiveIntervalErlangCalls':_0x215be6[_0x2c40('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x215be6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x215be6[_0x2c40('0x43')],'predictiveIntervalMultiplicativeFactor':_0x215be6['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x215be6[_0x2c40('0x44')],'predictiveIntervalAvailable':_0x215be6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x215be6[_0x2c40('0x45')],'message':_0x215be6[_0x2c40('0x46')],'originated':_0x215be6[_0x2c40('0x47')],'erlangCalls':_0x215be6[_0x2c40('0x48')],'erlangCallToSecond':_0x215be6['erlangCallToSecond'],'erlangAbandonmentRate':_0x215be6[_0x2c40('0x49')],'erlangBusyFactor':_0x215be6[_0x2c40('0x4a')],'startPredictive':_0x215be6[_0x2c40('0x4b')],'startProgressive':_0x215be6[_0x2c40('0x4c')]};if(_0x215be6[_0x2c40('0x4d')]){_0x238bf6['Trunk']={'id':_0x215be6[_0x2c40('0x4d')]['id'],'name':_0x215be6[_0x2c40('0x4d')][_0x2c40('0x4e')],'active':_0x215be6['Trunk'][_0x2c40('0x4f')],'callerid':_0x215be6['Trunk']['callerid']};}if(_0x215be6[_0x2c40('0x50')]){_0x238bf6[_0x2c40('0x50')]={'id':_0x215be6[_0x2c40('0x50')]['id'],'name':_0x215be6[_0x2c40('0x50')]['name']};}var _0x235dd7=md5(JSON[_0x2c40('0x51')](_0x238bf6));if(_0x215be6[_0x2c40('0x2')]!==_0x235dd7){_0x215be6[_0x2c40('0x2')]=_0x235dd7;emit(util[_0x2c40('0x52')](_0x2c40('0x53'),_0x238bf6[_0x2c40('0x4e')]),_0x2c40('0x54'),_0x238bf6);}}}function emitVoiceQueueChannelRemove(_0x2ddecc){logger[_0x2c40('0x55')](_0x2c40('0x56'),JSON[_0x2c40('0x51')](_0x2ddecc));emit(util['format'](_0x2c40('0x53'),_0x2ddecc['name']),_0x2c40('0x57'),_0x2ddecc);}function notSendMessagesQueue(_0x280a4b){if(_0x280a4b[_0x2c40('0x58')]){if(_0x280a4b['originated']===0x0&&_0x280a4b['pTalking']===0x0){_0x280a4b['sendMessageOneNotActive']=![];_0x280a4b[_0x2c40('0x28')]=0x0;_0x280a4b['paused']=0x0;_0x280a4b[_0x2c40('0x46')]='NOT_ACTIVE';ut[_0x2c40('0x59')](_0x2c40('0x5a'),_0x280a4b['name']+_0x2c40('0x5b'));}else{_0x280a4b[_0x2c40('0x46')]='IS_DISACTIVED';ut[_0x2c40('0x59')](_0x2c40('0x5a'),_0x280a4b[_0x2c40('0x4e')]+_0x2c40('0x5c'));}emitCampaignPreview(_0x280a4b);}}Preview[_0x2c40('0x5d')][_0x2c40('0x5e')]=function(){var _0x448d08=this;setInterval(function(){_0x448d08['syncCampaigns']();},0x7cf);};Preview[_0x2c40('0x5d')][_0x2c40('0x5f')]=function(){var _0x4c4024=this[_0x2c40('0x13')];this[_0x2c40('0x60')]+=0x1;for(var _0x55223b in _0x4c4024){if(_0x4c4024[_0x2c40('0x61')](_0x55223b)&&(_0x4c4024[_0x55223b][_0x2c40('0x32')]===_0x2c40('0x6')||_0x4c4024[_0x55223b][_0x2c40('0x32')]===_0x2c40('0x62'))&&_0x4c4024[_0x55223b]['type']===_0x2c40('0x63')){if(this[_0x2c40('0x60')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x2c40('0x64')]();}}if(_0x4c4024[_0x2c40('0x61')](_0x55223b)&&_0x4c4024[_0x55223b]['dialMethod']===_0x2c40('0x6')&&_0x4c4024[_0x55223b][_0x2c40('0x25')]===_0x2c40('0x63')){if(_0x4c4024[_0x55223b][_0x2c40('0x31')]){this['setMessage'](_0x4c4024[_0x55223b]);this[_0x2c40('0x65')](_0x4c4024[_0x55223b]);}else{notSendMessagesQueue(_0x4c4024[_0x55223b]);}}}};Preview['prototype'][_0x2c40('0x66')]=function(_0x14dbb7){var _0x598d22=this;this['sequence'][_0x2c40('0xf')](function(){if(!_[_0x2c40('0x67')](_0x598d22[_0x2c40('0x15')][_0x14dbb7])){loggerAction[_0x2c40('0x55')](_0x2c40('0x68'),_0x14dbb7,_0x2c40('0x69'),_0x598d22[_0x2c40('0x15')][_0x14dbb7]['queue'],_0x2c40('0x6a'),JSON[_0x2c40('0x51')](_0x598d22['campaignsPreview'][_0x598d22[_0x2c40('0x15')][_0x14dbb7][_0x2c40('0x6b')]][_0x2c40('0x47')]),'pTalking:\x20',JSON['stringify'](_0x598d22[_0x2c40('0x13')][_0x598d22[_0x2c40('0x15')][_0x14dbb7][_0x2c40('0x6b')]][_0x2c40('0x6c')]),JSON[_0x2c40('0x51')](_0x598d22['actions'][_0x14dbb7][_0x2c40('0x6d')]),JSON[_0x2c40('0x51')](_[_0x2c40('0x6e')](_0x598d22[_0x2c40('0x15')][_0x14dbb7],[_0x2c40('0x6f'),_0x2c40('0x70'),_0x2c40('0x71'),_0x2c40('0x72')])));return ami[_0x2c40('0x73')]({'action':_0x2c40('0x74'),'channel':_0x598d22[_0x2c40('0x15')][_0x14dbb7][_0x2c40('0x75')]})['catch'](function(_0x4192ca){if(_0x4192ca[_0x2c40('0x46')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x598d22[_0x2c40('0x15')][_0x14dbb7]){ut[_0x2c40('0x76')](_0x598d22[_0x2c40('0x13')][_0x598d22[_0x2c40('0x15')][_0x14dbb7]['queue']],_0x2c40('0x77'));if(_0x598d22[_0x2c40('0x15')][_0x14dbb7][_0x2c40('0x6d')]===!![]){ut['decrementTalkink'](_0x598d22[_0x2c40('0x13')][_0x598d22[_0x2c40('0x15')][_0x14dbb7]['queue']],'[clearZombieChannel]');ut[_0x2c40('0x78')](_0x2c40('0x79')+_0x14dbb7,_0x598d22[_0x2c40('0x15')][_0x14dbb7][_0x2c40('0x6b')]);}ut[_0x2c40('0x78')](_0x2c40('0x7a')+_0x14dbb7,_0x598d22[_0x2c40('0x15')][_0x14dbb7]['queue']);delete _0x598d22[_0x2c40('0x15')][_0x14dbb7];}},0x2328);}});}});};Preview['prototype'][_0x2c40('0x64')]=function(){var _0x44c521=this;loggerAction[_0x2c40('0x55')](_0x2c40('0x7b'),_[_0x2c40('0x7c')](this[_0x2c40('0x15')]));for(var _0x3ae705 in this[_0x2c40('0x15')]){if(_0x44c521['actions']['hasOwnProperty'](_0x3ae705)){_0x44c521[_0x2c40('0x66')](_0x3ae705);}}};Preview[_0x2c40('0x5d')][_0x2c40('0x65')]=function(_0x293b06){var _0x5602c7=this;rpcDb[_0x2c40('0x7d')](_0x293b06['id'],ut[_0x2c40('0x7e')](this[_0x2c40('0x16')]))['then'](function(_0x51235e){if(!_[_0x2c40('0x67')](_0x51235e)){for(var _0x145fad=0x0;_0x145fad<_0x51235e['length'];_0x145fad+=0x1){if(ut['getDiff'](_0x51235e[_0x145fad][_0x2c40('0x7f')])<_0x293b06['dialRecallMeTimeout']*0x3c){if(_0x51235e[_0x145fad][_0x2c40('0x80')]&&!_0x51235e[_0x145fad]['Agent'][_0x2c40('0x81')]){_0x5602c7[_0x2c40('0x82')](_0x51235e[_0x145fad]['id'])[_0x2c40('0x83')](ut[_0x2c40('0x84')](_0x2c40('0x85')))[_0x2c40('0x86')](ut[_0x2c40('0x84')](_0x2c40('0x85')));}else{rpcDb['disableContact'](_0x51235e[_0x145fad]['id']);}}else{var _0x74e7cc=new Action(_0x51235e[_0x145fad],_0x293b06);_0x74e7cc[_0x2c40('0x87')]=moment()[_0x2c40('0x52')](_0x2c40('0x88'));_0x293b06[_0x2c40('0x3c')]+=0x1;ut[_0x2c40('0x89')](_0x74e7cc,0x17,'RecallInQueue');if(_0x293b06[_0x2c40('0x8a')]){rpcDb[_0x2c40('0x8b')](ut[_0x2c40('0x8c')](_0x51235e[_0x145fad]));rpcDb[_0x2c40('0x8d')](_0x74e7cc,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x2c40('0x89')](_0x74e7cc,0x16,'RecallFailedTimeout');rpcDb[_0x2c40('0x8d')](_0x74e7cc,_0x2c40('0x8e'));rpcDb[_0x2c40('0x8f')](_0x74e7cc,_0x2c40('0x8e'));}}}}})[_0x2c40('0x86')](ut[_0x2c40('0x84')](_0x2c40('0x90')));};Preview['prototype'][_0x2c40('0x91')]=function(_0x2fc7dd){_0x2fc7dd[_0x2c40('0x58')]=!![];if(ut[_0x2c40('0x92')](_0x2fc7dd[_0x2c40('0x29')])){_0x2fc7dd['message']=_0x2c40('0x93');}else if(!ut[_0x2c40('0x94')](_0x2fc7dd['dialActive'])){_0x2fc7dd[_0x2c40('0x46')]=_0x2c40('0x95');}else if(!this['isTrunkReachable'](_0x2fc7dd[_0x2c40('0x4d')])){if(!this[_0x2c40('0x96')](_0x2fc7dd[_0x2c40('0x97')])){_0x2fc7dd['message']=_0x2c40('0x98');}else{_0x2fc7dd[_0x2c40('0x46')]=_0x2c40('0x99');}}else{_0x2fc7dd[_0x2c40('0x46')]=_0x2c40('0x99');}emitCampaignPreview(_0x2fc7dd);};Preview[_0x2c40('0x5d')][_0x2c40('0x9a')]=function(_0x3cf275,_0x1192e0,_0x28e462){var _0x10ba4b=this;var _0x483aeb=this[_0x2c40('0x15')][_0x1192e0];var _0x35ace3=this[_0x2c40('0x13')][_0x483aeb[_0x2c40('0x6b')]];var _0x53b3cd;if(_0x35ace3){switch(_0x28e462){case'1':_0x35ace3['outboundNoSuchCallsDay']+=0x1;_0x483aeb[_0x2c40('0x9b')]=ut[_0x2c40('0x9c')](_0x483aeb);ut['logCustomer'](_0x483aeb,0x0,'NoSuchNumber');rpcDb[_0x2c40('0x8d')](_0x483aeb,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x2c40('0x9c')](_0x483aeb)>=_0x35ace3[_0x2c40('0x9d')]){_0x53b3cd=ut['cloneAction'](_0x483aeb,0xf,_0x2c40('0x9e'));rpcDb[_0x2c40('0x8f')](_0x53b3cd,_0x2c40('0x9f'));}else{rpcDb[_0x2c40('0x8f')](_0x483aeb,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0x2c40('0x15')][_0x3cf275[_0x2c40('0xa0')]];break;case _0x2c40('0xa1'):var _0x564190=moment()[_0x2c40('0x52')](_0x2c40('0x88'));_0x483aeb[_0x2c40('0xa2')]=_0x564190;_0x483aeb[_0x2c40('0xa3')]=_0x564190;_0x483aeb[_0x2c40('0x6d')]=!![];_0x35ace3[_0x2c40('0x6c')]+=0x1;logger['info'](_0x2c40('0xa4'),_0x483aeb[_0x2c40('0xa5')],'\x20Queue',_0x35ace3['name'],_0x2c40('0xa6'),_0x35ace3[_0x2c40('0x6c')]);ami[_0x2c40('0xa7')](_0x2c40('0xa8'),ut[_0x2c40('0xa9')](_0x483aeb,'connect'));if(_0x35ace3[_0x2c40('0xaa')]){ami[_0x2c40('0xa7')](_0x2c40('0xab'),ut[_0x2c40('0xac')](_0x483aeb));}break;case'16':ami[_0x2c40('0xa7')](_0x2c40('0xad'),ut[_0x2c40('0xa9')](_0x483aeb,'complete'));emitVoiceQueueChannelRemove(ut[_0x2c40('0xa9')](_0x483aeb,_0x2c40('0xae')));_0x35ace3[_0x2c40('0x35')]+=0x1;_0x35ace3['total']+=0x1;_0x35ace3['answered']+=0x1;ut[_0x2c40('0xaf')](_0x35ace3,_0x2c40('0xb0'));_0x483aeb['countglobal']=ut[_0x2c40('0x9c')](_0x483aeb);ut[_0x2c40('0x89')](_0x483aeb,0x4,_0x2c40('0xb1'));rpcDb[_0x2c40('0x8d')](_0x483aeb,_0x2c40('0xb2'));rpcDb[_0x2c40('0x8f')](_0x483aeb,_0x2c40('0xb3'));rpcDb[_0x2c40('0xb4')](_0x483aeb);_0x35ace3[_0x2c40('0x2b')]+=_0x483aeb[_0x2c40('0xb5')];_0x35ace3[_0x2c40('0x2a')]+=_0x483aeb['talktime'];logger[_0x2c40('0x55')](_0x2c40('0xb6'),_0x483aeb['uniqueid'],_0x2c40('0xb7'),_0x35ace3[_0x2c40('0x4e')],_0x2c40('0xa6'),_0x35ace3[_0x2c40('0x6c')]);delete this[_0x2c40('0x15')][_0x3cf275[_0x2c40('0xa0')]];break;case'BUSY':_0x35ace3['outboundBusyCallsDay']+=0x1;_0x483aeb[_0x2c40('0xb8')]+=0x1;_0x483aeb['countglobal']=ut[_0x2c40('0x9c')](_0x483aeb);ut['logCustomer'](_0x483aeb,0x5,_0x2c40('0xb9'));rpcDb[_0x2c40('0x8d')](_0x483aeb,_0x2c40('0xba'));if(ut['totalGlobal'](_0x483aeb)>=_0x35ace3[_0x2c40('0x9d')]){_0x53b3cd=ut['cloneAction'](_0x483aeb,0xf,_0x2c40('0x9e'));rpcDb[_0x2c40('0x8f')](_0x53b3cd,_0x2c40('0xbb'));}else{if(_0x483aeb[_0x2c40('0xb8')]>=_0x35ace3[_0x2c40('0xbc')]){rpcDb[_0x2c40('0x8f')](_0x483aeb,_0x2c40('0xba'));}else{rpcDb['rescheduleContact'](ut[_0x2c40('0xbd')](_0x483aeb,_0x2c40('0xb8'),_0x35ace3[_0x2c40('0xbe')]),_0x483aeb[_0x2c40('0xbf')],_0x483aeb[_0x2c40('0xc0')]);}}break;case _0x2c40('0xc1'):_0x35ace3[_0x2c40('0x3a')]+=0x1;_0x483aeb[_0x2c40('0xc2')]+=0x1;_0x483aeb[_0x2c40('0x9b')]=ut[_0x2c40('0x9c')](_0x483aeb);ut['logCustomer'](_0x483aeb,0x3,'NoAnswer');rpcDb[_0x2c40('0x8d')](_0x483aeb,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x2c40('0x9c')](_0x483aeb)>=_0x35ace3[_0x2c40('0x9d')]){_0x53b3cd=ut[_0x2c40('0xc3')](_0x483aeb,0xf,_0x2c40('0x9e'));rpcDb[_0x2c40('0x8f')](_0x53b3cd,_0x2c40('0xc4'));}else{if(_0x483aeb['countnoanswerretry']>=_0x35ace3[_0x2c40('0xc5')]){rpcDb[_0x2c40('0x8f')](_0x483aeb,_0x2c40('0xc6'));}else{rpcDb[_0x2c40('0xc7')](ut[_0x2c40('0xbd')](_0x483aeb,_0x2c40('0xc2'),_0x35ace3[_0x2c40('0xc8')]),_0x483aeb['unlockAgent'],_0x483aeb['activeContact']);}}break;case _0x2c40('0xc9'):_0x35ace3[_0x2c40('0xca')]+=0x1;_0x483aeb[_0x2c40('0xcb')]+=0x1;_0x483aeb[_0x2c40('0x9b')]=ut[_0x2c40('0x9c')](_0x483aeb);ut[_0x2c40('0x89')](_0x483aeb,0x8,_0x2c40('0xcc'));rpcDb[_0x2c40('0x8d')](_0x483aeb,_0x2c40('0xcd'));if(ut[_0x2c40('0x9c')](_0x483aeb)>=_0x35ace3[_0x2c40('0x9d')]){_0x53b3cd=ut[_0x2c40('0xc3')](_0x483aeb,0xf,'Global');rpcDb[_0x2c40('0x8f')](_0x53b3cd,_0x2c40('0xce'));}else{if(_0x483aeb['countcongestionretry']>=_0x35ace3[_0x2c40('0xcf')]){rpcDb[_0x2c40('0x8f')](_0x483aeb,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x2c40('0xc7')](ut[_0x2c40('0xbd')](_0x483aeb,_0x2c40('0xcb'),_0x35ace3['dialBusyRetryFrequency']),_0x483aeb[_0x2c40('0xbf')],_0x483aeb['activeContact']);}}break;case _0x2c40('0xd0'):_0x35ace3[_0x2c40('0x3d')]+=0x1;_0x483aeb[_0x2c40('0x9b')]=ut[_0x2c40('0x9c')](_0x483aeb);ut[_0x2c40('0x89')](_0x483aeb,0x14,_0x2c40('0xd1'));rpcDb['createCustomerHistory'](_0x483aeb,'[syncHangupRequest][logAgentReject]');if(_0x483aeb['unlockAgent']){rpcDb['unlockContact'](_0x483aeb[_0x2c40('0xd2')]);}if(_0x483aeb[_0x2c40('0xc0')]){rpcDb['disableContact'](_0x483aeb[_0x2c40('0xd2')]);}break;default:if(_0x483aeb['dialAnswer']){ut[_0x2c40('0xaf')](_0x35ace3,_0x2c40('0xd3'));ut['loggerError'](_0x2c40('0xd4')+_0x35ace3[_0x2c40('0x4e')],_0x3cf275);}_0x35ace3[_0x2c40('0x3e')]+=0x1;_0x483aeb['countglobal']=ut[_0x2c40('0x9c')](_0x483aeb);ut[_0x2c40('0x89')](_0x483aeb,0xc,_0x3cf275[_0x2c40('0xd5')]||_0x3cf275['dialstatus']);rpcDb['createCustomerHistory'](_0x483aeb,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x2c40('0x9c')](_0x483aeb)>=_0x35ace3[_0x2c40('0x9d')]){_0x53b3cd=ut['cloneAction'](_0x483aeb,0xf,_0x2c40('0x9e'));rpcDb[_0x2c40('0x8f')](_0x53b3cd,_0x2c40('0xd6'));}else{rpcDb[_0x2c40('0x8f')](_0x483aeb,_0x2c40('0xd6'));}delete this[_0x2c40('0x15')][_0x3cf275[_0x2c40('0xa0')]];}if(!(_0x483aeb['dialAnswer']&&_0x28e462==='16')){ut['updateOriginated'](_0x35ace3,_0x2c40('0xd7'));logger[_0x2c40('0x55')](_0x2c40('0xd8'),_0x483aeb[_0x2c40('0xa5')],_0x2c40('0xb7'),_0x35ace3[_0x2c40('0x4e')],_0x2c40('0x6a'),_0x35ace3[_0x2c40('0x47')]);}if(_0x28e462!==_0x2c40('0xa1')){delete this[_0x2c40('0x15')][_0x3cf275[_0x2c40('0xa0')]];delete this[_0x2c40('0x15')][_0x3cf275[_0x2c40('0xd9')]];}}};Preview[_0x2c40('0x5d')]['callProgressDetectingAgent']=function(_0x1f4ed0,_0x5d12af,_0x1e29d1){if(_[_0x2c40('0xda')](_0x5d12af)&&_0x2c40('0xdb')!==typeof _0x5d12af){return;}if(_[_0x2c40('0xda')](_0x1e29d1)&&'object'!==typeof _0x1e29d1){return;}switch(_0x1e29d1[_0x2c40('0xdc')]){case'0':ut[_0x2c40('0xdd')](_0x1f4ed0,0x0,_0x2c40('0xde'));rpcDb[_0x2c40('0xdf')](_0x1f4ed0,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x2c40('0xdd')](_0x1f4ed0,0x3,_0x2c40('0xe0'));rpcDb[_0x2c40('0xdf')](_0x1f4ed0,_0x2c40('0xe1'));break;case'5':ut[_0x2c40('0xdd')](_0x1f4ed0,0x5,'Busy');rpcDb[_0x2c40('0xdf')](_0x1f4ed0,_0x2c40('0xe2'));break;case'8':ut[_0x2c40('0xdd')](_0x1f4ed0,0x8,_0x2c40('0xcc'));rpcDb[_0x2c40('0xdf')](_0x1f4ed0,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x2c40('0xdd')](_0x1f4ed0,0x16,_0x2c40('0xe3'));rpcDb[_0x2c40('0xdf')](_0x1f4ed0,_0x2c40('0xe4'));break;default:ut['logAgent'](_0x1f4ed0,0xc,_0x1e29d1[_0x2c40('0xdc')]);rpcDb[_0x2c40('0xdf')](_0x1f4ed0,_0x2c40('0xe5'));}ut[_0x2c40('0x76')](_0x5d12af,_0x2c40('0xe6'));logger[_0x2c40('0x55')](_0x2c40('0xe7'),_0x1f4ed0[_0x2c40('0xa5')],_0x2c40('0xb7'),_0x5d12af[_0x2c40('0x4e')],_0x2c40('0x6a'),_0x5d12af['originated']);delete this[_0x2c40('0x15')][_0x1f4ed0[_0x2c40('0xa5')]];};Preview['prototype'][_0x2c40('0xe8')]=function(_0xd679a3,_0x483106,_0x5a008e,_0x2b0326,_0x1d95fe){var _0x2ee656=this;return new BPromise(function(_0x5690e8,_0x9c9af7){if(_['isNil'](_0x483106)||_[_0x2c40('0x67')](_0x483106[_0x2c40('0xe9')])||_[_0x2c40('0x67')](_0x483106[_0x2c40('0xe9')][_0x2c40('0xea')])||_['isNil'](_0x483106[_0x2c40('0x71')])){_0x9c9af7(ut[_0x2c40('0x46')](_0x2c40('0xeb'),_0x2b0326,_0x1d95fe));return;}var _0x137ce8=uuid['v4']();var _0x183385=_0x2ee656['campaignsPreview'][_0x483106[_0x2c40('0x69')][_0x2c40('0x4e')]];var _0x55c64c=_0x5a008e?_0x2ee656[_0x2c40('0x16')][_0x5a008e]['id']:undefined;_0x2ee656[_0x2c40('0x15')][_0x137ce8]=new Action(_0x483106,_0x183385,_0x137ce8,_0x5a008e,_0x55c64c);var _0x310f38=_0x2ee656[_0x2c40('0x15')][_0x137ce8];_0x310f38['unlockAgent']=_0x2b0326;_0x310f38[_0x2c40('0xc0')]=_0x1d95fe;_0x310f38[_0x2c40('0xec')]=_0x5a008e;if(_[_0x2c40('0xed')](_0xd679a3)){_0x2ee656[_0x2c40('0xee')](_0x310f38,_0x183385,_0x483106,_0x5a008e)['then'](function(_0x4480ab){logger[_0x2c40('0x55')](_0x2c40('0xef'),'Queue:\x20'+_0x310f38[_0x2c40('0x6b')]+_0x2c40('0xf0')+_0x310f38[_0x2c40('0xd2')],JSON[_0x2c40('0x51')](_0x4480ab));ami[_0x2c40('0xa7')](_0x2c40('0xf1'),ut[_0x2c40('0xa9')](_0x310f38,_0x2c40('0xf2')));_0x5690e8(ut[_0x2c40('0x46')](_0x2c40('0xf3')));})['catch'](function(_0x1f49d5){ut[_0x2c40('0x59')](_0x2c40('0xf4'),_0x1f49d5);_0x9c9af7(ut[_0x2c40('0x46')](_0x2c40('0xf5'),_0x2b0326,_0x1d95fe));});}else{_0x183385[_0x2c40('0xf6')]+=0x1;ut[_0x2c40('0xf7')](_0x310f38);rpcDb[_0x2c40('0xf8')](_0x310f38,_0x2c40('0xf9'));delete _0x2ee656[_0x2c40('0x15')][_0x137ce8];_0x9c9af7(ut[_0x2c40('0x46')](_0x2c40('0xfa'),_0x2b0326,_0x1d95fe));}});};Preview[_0x2c40('0x5d')]['isTrunkReachable']=function(_0xe5a16c){return!_['isNil'](_0xe5a16c)&&!_[_0x2c40('0x67')](_0xe5a16c[_0x2c40('0x4e')])&&!_[_0x2c40('0x67')](_0xe5a16c['active'])&&_0xe5a16c['active']&&!_[_0x2c40('0x67')](this[_0x2c40('0x14')][util[_0x2c40('0x52')](_0x2c40('0xfb'),_0xe5a16c[_0x2c40('0x4e')])])&&!_[_0x2c40('0x67')](this[_0x2c40('0x14')][util[_0x2c40('0x52')]('SIP/%s',_0xe5a16c[_0x2c40('0x4e')])][_0x2c40('0x74')])&&(this[_0x2c40('0x14')][util[_0x2c40('0x52')](_0x2c40('0xfb'),_0xe5a16c[_0x2c40('0x4e')])][_0x2c40('0x74')]===_0x2c40('0xfc')||this[_0x2c40('0x14')][util[_0x2c40('0x52')](_0x2c40('0xfb'),_0xe5a16c[_0x2c40('0x4e')])]['status']===_0x2c40('0xfd'));};Preview[_0x2c40('0x5d')][_0x2c40('0x82')]=function(_0x2b2403,_0x54aa8d){var _0x313b9a=this;return new BPromise(function(_0x33cda4,_0x5be1db){_0x313b9a[_0x2c40('0xfe')](_0x2b2403,_0x54aa8d)['then'](function(_0xef0562){_0x33cda4(_[_0x2c40('0x6e')](_0xef0562,[_0x2c40('0x46')]));})['catch'](function(_0x286c4c){if(_0x286c4c[_0x2c40('0xff')]){rpcDb[_0x2c40('0x100')](_0x2b2403);}if(_0x286c4c[_0x2c40('0x4f')]){rpcDb[_0x2c40('0x101')](_0x2b2403);}_0x5be1db(_[_0x2c40('0x6e')](_0x286c4c,['message']));});});};Preview[_0x2c40('0x5d')][_0x2c40('0xfe')]=function(_0x40403c,_0x18ce8b){var _0x357f98=this;return new BPromise(function(_0x465128,_0x57bb6f){var _0x445b12,_0x4af53b;rpcDb[_0x2c40('0x102')](_0x40403c)[_0x2c40('0x83')](function(_0x5ed007){if(!_[_0x2c40('0x67')](_0x5ed007[0x0])){_0x4af53b=_0x5ed007[0x0]['recallme']?![]:!![];_0x445b12=_0x5ed007[0x0][_0x2c40('0x103')]?!![]:![];_0x445b12=_0x18ce8b?!![]:_0x445b12;}var _0x38cfe0=_0x357f98[_0x2c40('0x104')](_0x5ed007);if(_0x38cfe0['isValid']){rpcDb[_0x2c40('0x105')](_[_0x2c40('0x6e')](_0x5ed007[0x0],[_0x2c40('0x71'),'Contact.phone']))[_0x2c40('0x83')](function(_0x4860ce){_0x357f98['checkInBlack'](_0x4860ce,_0x5ed007[0x0],_0x18ce8b,_0x4af53b,_0x445b12)[_0x2c40('0x83')](function(_0x955103){_0x465128(_0x955103);})[_0x2c40('0x86')](function(_0xc749fc){_0x57bb6f(_0xc749fc);});})[_0x2c40('0x86')](function(_0x466e8c){ut[_0x2c40('0x59')]('[Preview][checkIsBlackList]',_0x466e8c);_0x57bb6f(ut[_0x2c40('0x46')](_0x2c40('0x106'),_0x4af53b,_0x445b12));});}else{_0x57bb6f(ut[_0x2c40('0x46')](_0x38cfe0[_0x2c40('0x46')],_0x4af53b,_0x445b12));}})[_0x2c40('0x86')](function(_0x1d08db){ut[_0x2c40('0x59')](_0x2c40('0x107'),_0x1d08db);_0x57bb6f(ut['message'](_0x2c40('0x106'),![],!![]));});});};Preview['prototype'][_0x2c40('0x104')]=function(_0x44e145){if(_[_0x2c40('0x67')](_0x44e145)||_['isEmpty'](_0x44e145)||!_[_0x2c40('0x67')](_0x44e145[0x0]['Agent'])&&_[_0x2c40('0x67')](_0x44e145[0x0][_0x2c40('0x80')][_0x2c40('0x4e')])){ut[_0x2c40('0x59')](_0x2c40('0x108'),_0x44e145);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2f572c=this['campaignsPreview'][_0x44e145[0x0][_0x2c40('0x69')][_0x2c40('0x4e')]];_0x2f572c[_0x2c40('0x46')]='ACTIVE';if(_[_0x2c40('0x67')](_0x2f572c)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x2f572c);return{'isValid':![],'message':_0x2c40('0x109')};}if(!this[_0x2c40('0x96')](_0x2f572c[_0x2c40('0x4d')])){ut[_0x2c40('0x59')](_0x2c40('0x10a'),'campaign\x20Name:\x20'+_0x2f572c['name']+_0x2c40('0x10b'));if(!this['isTrunkReachable'](_0x2f572c['TrunkBackup'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x2f572c[_0x2c40('0x4e')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x2c40('0x10c')};}}if(!ut['isActive'](_0x2f572c[_0x2c40('0x31')])){ut[_0x2c40('0x59')](_0x2c40('0x10d'),_0x2f572c[_0x2c40('0x4e')]+_0x2c40('0x10e'));return{'isValid':![],'message':_0x2c40('0x10f')+_0x2f572c[_0x2c40('0x4e')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x2c40('0x110')};};Preview[_0x2c40('0x5d')][_0x2c40('0xee')]=function(_0x58dc49,_0x54b9b2,_0x47d6cd,_0x1f51a8){var _0x7f2d9b=this;return new BPromise(function(_0x30ac5a,_0x1f42a7){var _0xc16374=_0x58dc49['uniqueid'];var _0x399bbb=_0x7f2d9b[_0x2c40('0x96')](_0x54b9b2[_0x2c40('0x4d')])?util[_0x2c40('0x52')]('SIP/%s/%s%s',_0x54b9b2[_0x2c40('0x4d')][_0x2c40('0x4e')],_['isNil'](_0x54b9b2['dialPrefix'])?'':_0x54b9b2[_0x2c40('0x34')][_0x2c40('0x111')]()||'',_0x54b9b2[_0x2c40('0x112')]>0x0?_0x47d6cd[_0x2c40('0xe9')]['phone']['substring'](_0x54b9b2[_0x2c40('0x112')]):_0x47d6cd[_0x2c40('0xe9')][_0x2c40('0xea')]):util[_0x2c40('0x52')](_0x2c40('0x113'),_['isNil'](_0x54b9b2[_0x2c40('0x97')])?_0x54b9b2[_0x2c40('0x4d')][_0x2c40('0x4e')]:_0x54b9b2[_0x2c40('0x97')][_0x2c40('0x4e')],_[_0x2c40('0x67')](_0x54b9b2[_0x2c40('0x34')])?'':_0x54b9b2['dialPrefix'][_0x2c40('0x111')]()||'',_0x54b9b2[_0x2c40('0x112')]>0x0?_0x47d6cd[_0x2c40('0xe9')][_0x2c40('0xea')][_0x2c40('0x114')](_0x54b9b2[_0x2c40('0x112')]):_0x47d6cd[_0x2c40('0xe9')][_0x2c40('0xea')]);var _0x364207=_0x7f2d9b['isTrunkReachable'](_0x54b9b2['Trunk'])?ut[_0x2c40('0x115')](_0x54b9b2[_0x2c40('0x4d')][_0x2c40('0x116')],_0x54b9b2[_0x2c40('0x117')],_0x54b9b2[_0x2c40('0x118')]>0x0?ut[_0x2c40('0x119')](_0x54b9b2['dialOriginateCallerIdNumber'],_0x54b9b2[_0x2c40('0x118')]):_0x54b9b2[_0x2c40('0x33')]):ut[_0x2c40('0x115')](_[_0x2c40('0x67')](_0x54b9b2[_0x2c40('0x97')])?_0x54b9b2[_0x2c40('0x4d')][_0x2c40('0x116')]:_0x54b9b2[_0x2c40('0x97')][_0x2c40('0x116')],_0x54b9b2[_0x2c40('0x117')],_0x54b9b2[_0x2c40('0x118')]>0x0?ut['getCallerIdRandom'](_0x54b9b2[_0x2c40('0x33')],_0x54b9b2[_0x2c40('0x118')]):_0x54b9b2['dialOriginateCallerIdNumber']);if(_0x364207){_0x58dc49['originatecalleridname']=ut[_0x2c40('0x11a')](_0x364207);_0x58dc49[_0x2c40('0x11b')]=ut[_0x2c40('0x11c')](_0x364207);}var _0xa18d4d=ut[_0x2c40('0x11d')](_0x54b9b2,_0x47d6cd,_0x399bbb,_0x364207,_0xc16374,_0x58dc49);_[_0x2c40('0x11e')](_0x58dc49,ut[_0x2c40('0x11f')](_0xa18d4d));_0x58dc49[_0x2c40('0x87')]=moment()[_0x2c40('0x52')](_0x2c40('0x88'));ami[_0x2c40('0x73')](ut[_0x2c40('0x120')](_0x58dc49,_0x54b9b2,_0xa18d4d,_0x58dc49['activeContact'],_0x1f51a8))['then'](function(_0x28ecd9){_0x54b9b2[_0x2c40('0x47')]+=0x1;logger[_0x2c40('0x55')](_0x2c40('0x121'),_0xc16374,_0x2c40('0xb7'),_0x54b9b2[_0x2c40('0x4e')],_0x2c40('0x6a'),_0x54b9b2[_0x2c40('0x47')]);_0x30ac5a(_0x28ecd9);})['catch'](function(_0x3f95a8){ut['logAgent'](_0x58dc49,0xe,_0x2c40('0x122'));rpcDb['createAgentHistory'](_0x58dc49,_0x2c40('0x123'));_0x1f42a7(_0x3f95a8);});});};Preview[_0x2c40('0x5d')][_0x2c40('0x20')]=function(_0x2da133){if(this[_0x2c40('0x15')][_0x2da133[_0x2c40('0xa0')]]){this[_0x2c40('0x15')][_0x2da133['linkedid']][_0x2c40('0x75')]=_0x2da133[_0x2c40('0x75')];}};Preview[_0x2c40('0x5d')][_0x2c40('0x18')]=function(_0x4c0fde){var _0x1eee12=this;var _0x116f8e=this[_0x2c40('0x15')][_0x4c0fde[_0x2c40('0x124')]];if(_0x116f8e){if(_0x116f8e['lookAgent']&&this[_0x2c40('0x16')][_0x116f8e['lookAgent']]){ut[_0x2c40('0x125')](_0x116f8e,this[_0x2c40('0x16')][_0x116f8e[_0x2c40('0xec')]][_0x2c40('0x4e')],this[_0x2c40('0x16')][_0x116f8e[_0x2c40('0xec')]]['id']);}var _0x5dd32f=_[_0x2c40('0x126')](_0x116f8e);_0x5dd32f[_0x2c40('0xa2')]=moment()['format'](_0x2c40('0x88'));var _0x42e4f0=_0x1eee12['campaignsPreview'][_0x116f8e['queue']];if(ut[_0x2c40('0x127')](_0x4c0fde[_0x2c40('0x128')])){if(_0x116f8e['unlockAgent']){rpcDb['unlockContact'](_0x116f8e[_0x2c40('0xd2')]);}if(_0x116f8e[_0x2c40('0xc0')]){rpcDb['disableContact'](_0x116f8e[_0x2c40('0xd2')]);}ami[_0x2c40('0xa7')](_0x2c40('0x129'),ut[_0x2c40('0xa9')](_0x116f8e,_0x2c40('0x12a')));this[_0x2c40('0x12b')](_0x5dd32f,_0x42e4f0,_0x4c0fde);}else{_0x116f8e[_0x2c40('0x87')]=moment()[_0x2c40('0x52')](_0x2c40('0x88'));ut[_0x2c40('0xdd')](_0x5dd32f,0x4,_0x2c40('0xb1'));rpcDb[_0x2c40('0xdf')](_0x5dd32f,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x2c40('0x5d')][_0x2c40('0x1b')]=function(_0x1b054f){var _0x4c3254=this;var _0x1ec0db=this['actions'][_0x1b054f['linkedid']];var _0xbaa646;if(_0x1ec0db){_0xbaa646=this['campaignsPreview'][_0x1ec0db[_0x2c40('0x6b')]];logger['info']('[syncHangup][talking]',_0x1b054f[_0x2c40('0xa0')],_0x2c40('0xb7'),_0xbaa646[_0x2c40('0x4e')],_0x2c40('0xa6'),_0xbaa646['pTalking']);}if(this[_0x2c40('0x15')][_0x1b054f[_0x2c40('0xa0')]]&&_0x1b054f[_0x2c40('0xa0')]!==_0x1b054f['uniqueid']){if(_0x1b054f[_0x2c40('0x12c')]==='16'&&this[_0x2c40('0x15')][_0x1b054f[_0x2c40('0xa0')]][_0x2c40('0x6d')]){this[_0x2c40('0x9a')](_0x1b054f,_0x1b054f[_0x2c40('0xa0')],_0x1b054f['cause']);}else if(this[_0x2c40('0x15')][_0x1b054f['linkedid']][_0x2c40('0x6d')]){logger[_0x2c40('0x55')](_0x2c40('0x12d'),_0x1b054f[_0x2c40('0xa0')],_0x1b054f[_0x2c40('0x12c')],_0x2c40('0xb7'),_0xbaa646[_0x2c40('0x4e')],_0x2c40('0xa6'),_0xbaa646['pTalking']);this['callProgressDetectingCustomer'](_0x1b054f,_0x1b054f[_0x2c40('0xa0')],_0x1b054f[_0x2c40('0x12c')]);}}else if(_0x1ec0db&&_[_0x2c40('0x67')](_0x1ec0db[_0x2c40('0x12e')])&&_0xbaa646[_0x2c40('0x12f')]&&_0x1b054f[_0x2c40('0xa0')]===_0x1b054f[_0x2c40('0xa5')]&&_['isNil'](_0x1b054f['reason'])&&_0x1b054f[_0x2c40('0x12c')]==='16'&&_0x1b054f[_0x2c40('0x130')]==='6'&&_[_0x2c40('0xda')](_0x1ec0db[_0x2c40('0x131')])){if(_0x1ec0db[_0x2c40('0xbf')]){rpcDb['unlockContact'](_0x1ec0db[_0x2c40('0xd2')]);}if(_0x1ec0db[_0x2c40('0xc0')]){rpcDb['disableContact'](_0x1ec0db[_0x2c40('0xd2')]);}_0x1b054f[_0x2c40('0xdc')]='22';this['callProgressDetectingAgent'](_0x1ec0db,_0xbaa646,_0x1b054f);}else if(_0x1ec0db&&_0x1ec0db[_0x2c40('0x131')]){if(_0x1b054f['cause']==='16'&&this[_0x2c40('0x15')][_0x1b054f[_0x2c40('0xa0')]][_0x2c40('0x6d')]){logger[_0x2c40('0x55')](_0x2c40('0x132'),_0x1b054f[_0x2c40('0xa0')],_0x1b054f[_0x2c40('0x12c')],_0x2c40('0xb7'),_0xbaa646['name'],'pTalking:\x20',_0xbaa646['pTalking']);this[_0x2c40('0x9a')](_0x1b054f,_0x1b054f[_0x2c40('0xa0')],_0x1b054f[_0x2c40('0x12c')]);}else if(this[_0x2c40('0x15')][_0x1b054f[_0x2c40('0xa0')]][_0x2c40('0x6d')]){logger['info'](_0x2c40('0x12d'),_0x1b054f['linkedid'],_0x1b054f[_0x2c40('0x12c')],_0x2c40('0xb7'),_0xbaa646[_0x2c40('0x4e')],'pTalking:\x20',_0xbaa646[_0x2c40('0x6c')]);this[_0x2c40('0x9a')](_0x1b054f,_0x1b054f[_0x2c40('0xa0')],_0x1b054f[_0x2c40('0x12c')]);}}};Preview[_0x2c40('0x5d')][_0x2c40('0x133')]=function(_0x5aed4d){if(this[_0x2c40('0x15')][_0x5aed4d[_0x2c40('0xd9')]]&&_0x5aed4d[_0x2c40('0xd9')]!==_0x5aed4d['destuniqueid']){this['callProgressDetectingCustomer'](_0x5aed4d,_0x5aed4d[_0x2c40('0xd9')],_0x5aed4d[_0x2c40('0x134')]);}};Preview['prototype'][_0x2c40('0x1d')]=function(_0x394634){if(this[_0x2c40('0x15')][_0x394634['linkedid']]&&_0x394634[_0x2c40('0xa0')]!==_0x394634['uniqueid']&&!this[_0x2c40('0x15')][_0x394634[_0x2c40('0xa0')]][_0x2c40('0x6d')]){if(_0x394634[_0x2c40('0x12c')]==='1'){this[_0x2c40('0x9a')](_0x394634,_0x394634[_0x2c40('0xa0')],_0x394634[_0x2c40('0x12c')]);}}};Preview[_0x2c40('0x5d')]['addVariable']=function(_0x593bb6,_0x41cfa8,_0x2fb886){if(this[_0x2c40('0x15')][_0x593bb6]){if(_['isNil'](this[_0x2c40('0x15')][_0x593bb6][_0x2c40('0x135')])){this['actions'][_0x593bb6][_0x2c40('0x135')]={};}this[_0x2c40('0x15')][_0x593bb6][_0x2c40('0x135')][_0x41cfa8]=_0x2fb886;}};Preview['prototype'][_0x2c40('0x22')]=function(_0x1b5aff){try{if(!_[_0x2c40('0x67')](_0x1b5aff)){if(ut['filterKey'](_['keys'](_0x1b5aff[_0x2c40('0x136')])[0x0])){this[_0x2c40('0x137')](_0x1b5aff[_0x2c40('0xa5')],_[_0x2c40('0x138')](_0x1b5aff[_0x2c40('0x136')])[0x0],_0x1b5aff[_0x2c40('0x139')]);}}}catch(_0x5b8401){logger['error'](_0x2c40('0x13a'),util[_0x2c40('0x13b')](_0x5b8401,{'showHidden':![],'depth':null}));}};Preview[_0x2c40('0x5d')][_0x2c40('0x13c')]=function(_0x3a2a9e){if(_0x3a2a9e){if(this[_0x2c40('0x15')][_0x3a2a9e['transfertargetlinkedid']]){this[_0x2c40('0x15')][_0x3a2a9e['transfertargetlinkedid']][_0x2c40('0x131')]=!![];}}};Preview['prototype'][_0x2c40('0x24')]=function(_0x5a5983){if(_0x5a5983){if(this[_0x2c40('0x15')][_0x5a5983[_0x2c40('0x13d')]]){this[_0x2c40('0x15')][_0x5a5983['transfererlinkedid']][_0x2c40('0x131')]=!![];}}};module[_0x2c40('0x13e')]=Preview; \ No newline at end of file +var _0x99b3=['NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','AgentReject','unlockContact','idContact','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','\x20IdHopper:\x20','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','logLookAgent','clone','isFailure','disableContact','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','variables','filterKey','variable','addVariable','keys','value','error','transfertargetlinkedid','transfererlinkedid','util','bluebird','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','prototype','enqueue','tail','sequence','voiceQueues','trunks','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','info','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','\x20is\x20not\x20active','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clockClearZombieChannels','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','status','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','[RecallMe]','logger2','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','custom:agentConnectPreview','custom:agentcomplete','complete','total','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent'];(function(_0x2f9742,_0x20676b){var _0x315897=function(_0x221329){while(--_0x221329){_0x2f9742['push'](_0x2f9742['shift']());}};_0x315897(++_0x20676b);}(_0x99b3,0x6c));var _0x399b=function(_0x1537e4,_0x5445a6){_0x1537e4=_0x1537e4-0x0;var _0x1189e6=_0x99b3[_0x1537e4];return _0x1189e6;};'use strict';var util=require(_0x399b('0x0'));var _=require('lodash');var BPromise=require(_0x399b('0x1'));var uuid=require('uuid');var moment=require(_0x399b('0x2'));var md5=require(_0x399b('0x3'));var Redis=require(_0x399b('0x4'));var config=require(_0x399b('0x5'));var logger=require('../../../config/logger')(_0x399b('0x6'));var loggerAction=require(_0x399b('0x7'))(_0x399b('0x8'));var ami=require(_0x399b('0x9'));var rpcDb=require(_0x399b('0xa'));var Action=require(_0x399b('0xb'));var ut=require(_0x399b('0xc'));config[_0x399b('0xd')]=_[_0x399b('0xe')](config[_0x399b('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x399b('0xf')][_0x399b('0x10')]=function(_0x5d0247){this[_0x399b('0x11')]=this['tail']?this[_0x399b('0x11')]['finally'](_0x5d0247):_0x5d0247();};function Preview(_0x149f32){this[_0x399b('0x12')]=new Sequence();this['campaignsPreview']=_0x149f32[_0x399b('0x13')];this[_0x399b('0x14')]=_0x149f32[_0x399b('0x14')];this['actions']={};this[_0x399b('0x15')]=_0x149f32[_0x399b('0x15')];this['clockClearZombieChannels']=0x0;ami['on'](_0x399b('0x16'),this[_0x399b('0x17')][_0x399b('0x18')](this));ami['on'](_0x399b('0x19'),this[_0x399b('0x1a')][_0x399b('0x18')](this));ami['on']('hanguprequest',this[_0x399b('0x1b')]['bind'](this));ami['on'](_0x399b('0x1c'),this[_0x399b('0x1d')][_0x399b('0x18')](this));ami['on'](_0x399b('0x1e'),this[_0x399b('0x1f')][_0x399b('0x18')](this));ami['on']('varset',this[_0x399b('0x20')][_0x399b('0x18')](this));ami['on']('attendedtransfer',this[_0x399b('0x21')][_0x399b('0x18')](this));ami['on'](_0x399b('0x22'),this[_0x399b('0x23')][_0x399b('0x18')](this));this['loopCampaigns'](this[_0x399b('0x24')]);}function emit(_0x140cec,_0xe68c2b,_0x689261){io['to'](_0x140cec)[_0x399b('0x25')](_0xe68c2b,_0x689261);}function emitCampaignPreview(_0x48073b){if(_0x48073b[_0x399b('0x26')]===_0x399b('0x27')){var _0x3d2ec6={'id':_0x48073b['id'],'name':_0x48073b[_0x399b('0x28')],'strategy':_0x48073b[_0x399b('0x29')],'answered':_0x48073b[_0x399b('0x2a')],'available':_0x48073b[_0x399b('0x2b')],'loggedIn':_0x48073b[_0x399b('0x2c')],'pTalking':_0x48073b[_0x399b('0x2d')],'sumBillable':_0x48073b[_0x399b('0x2e')],'sumDuration':_0x48073b[_0x399b('0x2f')],'sumHoldTime':_0x48073b[_0x399b('0x30')]||0x0,'talking':_0x48073b[_0x399b('0x31')],'total':_0x48073b['total'],'type':_0x48073b[_0x399b('0x26')],'unmanaged':_0x48073b[_0x399b('0x32')],'abandoned':_0x48073b[_0x399b('0x33')],'waiting':_0x48073b['waiting'],'loggedInDb':_0x48073b['loggedInDb'],'dialActive':_0x48073b[_0x399b('0x34')],'dialMethod':_0x48073b[_0x399b('0x35')],'dialOriginateCallerIdName':_0x48073b[_0x399b('0x36')],'dialOriginateCallerIdNumber':_0x48073b[_0x399b('0x37')],'dialOriginateTimeout':_0x48073b['dialOriginateTimeout'],'dialPrefix':_0x48073b[_0x399b('0x38')],'outboundAnswerAgiCallsDay':_0x48073b[_0x399b('0x39')],'outboundAnswerCallsDay':_0x48073b[_0x399b('0x3a')],'outboundBlacklistCallsDay':_0x48073b[_0x399b('0x3b')],'outboundBusyCallsDay':_0x48073b['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x48073b[_0x399b('0x3c')],'outboundDropCallsDayACS':_0x48073b[_0x399b('0x3d')],'outboundDropCallsDayCallersExit':_0x48073b[_0x399b('0x3e')],'outboundDropCallsDayTimeout':_0x48073b[_0x399b('0x3f')],'outboundNoAnswerCallsDay':_0x48073b[_0x399b('0x40')],'outboundNoSuchCallsDay':_0x48073b['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x48073b[_0x399b('0x41')],'outboundReCallsDay':_0x48073b[_0x399b('0x42')],'outboundRejectCallsDay':_0x48073b[_0x399b('0x43')],'outboundUnknownCallsDay':_0x48073b[_0x399b('0x44')],'predictiveIntervalAnsweredCalls':_0x48073b['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x48073b[_0x399b('0x45')],'predictiveIntervalAvgTalktime':_0x48073b[_0x399b('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x48073b[_0x399b('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x48073b[_0x399b('0x48')],'predictiveIntervalErlangCalls':_0x48073b['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x48073b[_0x399b('0x49')],'predictiveIntervalHitRate':_0x48073b[_0x399b('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x48073b[_0x399b('0x4b')],'predictiveIntervalPauses':_0x48073b[_0x399b('0x4c')],'predictiveIntervalAvailable':_0x48073b[_0x399b('0x4d')],'predictiveIntervalTotalCalls':_0x48073b[_0x399b('0x4e')],'message':_0x48073b['message'],'originated':_0x48073b[_0x399b('0x4f')],'erlangCalls':_0x48073b[_0x399b('0x50')],'erlangCallToSecond':_0x48073b[_0x399b('0x51')],'erlangAbandonmentRate':_0x48073b[_0x399b('0x52')],'erlangBusyFactor':_0x48073b[_0x399b('0x53')],'startPredictive':_0x48073b['startPredictive'],'startProgressive':_0x48073b[_0x399b('0x54')]};if(_0x48073b[_0x399b('0x55')]){_0x3d2ec6[_0x399b('0x55')]={'id':_0x48073b[_0x399b('0x55')]['id'],'name':_0x48073b[_0x399b('0x55')]['name'],'active':_0x48073b[_0x399b('0x55')][_0x399b('0x56')],'callerid':_0x48073b['Trunk'][_0x399b('0x57')]};}if(_0x48073b[_0x399b('0x58')]){_0x3d2ec6[_0x399b('0x58')]={'id':_0x48073b[_0x399b('0x58')]['id'],'name':_0x48073b[_0x399b('0x58')][_0x399b('0x28')]};}var _0x481c71=md5(JSON[_0x399b('0x59')](_0x3d2ec6));if(_0x48073b['md5']!==_0x481c71){_0x48073b['md5']=_0x481c71;emit(util['format']('voice:queue:%s',_0x3d2ec6[_0x399b('0x28')]),_0x399b('0x5a'),_0x3d2ec6);}}}function emitVoiceQueueChannelRemove(_0x13fb94){logger[_0x399b('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x399b('0x59')](_0x13fb94));emit(util[_0x399b('0x5c')](_0x399b('0x5d'),_0x13fb94[_0x399b('0x28')]),_0x399b('0x5e'),_0x13fb94);}function notSendMessagesQueue(_0x5d695a){if(_0x5d695a[_0x399b('0x5f')]){if(_0x5d695a[_0x399b('0x4f')]===0x0&&_0x5d695a[_0x399b('0x2d')]===0x0){_0x5d695a['sendMessageOneNotActive']=![];_0x5d695a[_0x399b('0x2b')]=0x0;_0x5d695a[_0x399b('0x60')]=0x0;_0x5d695a[_0x399b('0x61')]=_0x399b('0x62');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5d695a[_0x399b('0x28')]+_0x399b('0x63'));}else{_0x5d695a[_0x399b('0x61')]=_0x399b('0x64');ut[_0x399b('0x65')](_0x399b('0x66'),_0x5d695a[_0x399b('0x28')]+_0x399b('0x67'));}emitCampaignPreview(_0x5d695a);}}Preview[_0x399b('0xf')][_0x399b('0x68')]=function(){var _0x3f1249=this;setInterval(function(){_0x3f1249[_0x399b('0x69')]();},0x7cf);};Preview[_0x399b('0xf')][_0x399b('0x69')]=function(){var _0x3cc1ac=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x54fcbf in _0x3cc1ac){if(_0x3cc1ac[_0x399b('0x6a')](_0x54fcbf)&&(_0x3cc1ac[_0x54fcbf][_0x399b('0x35')]===_0x399b('0x6')||_0x3cc1ac[_0x54fcbf][_0x399b('0x35')]===_0x399b('0x6b'))&&_0x3cc1ac[_0x54fcbf][_0x399b('0x26')]===_0x399b('0x27')){if(this[_0x399b('0x6c')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x399b('0x6d')]();}}if(_0x3cc1ac['hasOwnProperty'](_0x54fcbf)&&_0x3cc1ac[_0x54fcbf][_0x399b('0x35')]===_0x399b('0x6')&&_0x3cc1ac[_0x54fcbf][_0x399b('0x26')]===_0x399b('0x27')){if(_0x3cc1ac[_0x54fcbf]['dialActive']){this[_0x399b('0x6e')](_0x3cc1ac[_0x54fcbf]);this[_0x399b('0x6f')](_0x3cc1ac[_0x54fcbf]);}else{notSendMessagesQueue(_0x3cc1ac[_0x54fcbf]);}}}};Preview[_0x399b('0xf')][_0x399b('0x70')]=function(_0x28431d){var _0xc4c0c5=this;this[_0x399b('0x12')]['enqueue'](function(){if(!_[_0x399b('0x71')](_0xc4c0c5['actions'][_0x28431d])){loggerAction[_0x399b('0x5b')](_0x399b('0x72'),_0x28431d,_0x399b('0x73'),_0xc4c0c5[_0x399b('0x74')][_0x28431d][_0x399b('0x75')],_0x399b('0x76'),JSON[_0x399b('0x59')](_0xc4c0c5[_0x399b('0x24')][_0xc4c0c5['actions'][_0x28431d][_0x399b('0x75')]][_0x399b('0x4f')]),_0x399b('0x77'),JSON[_0x399b('0x59')](_0xc4c0c5[_0x399b('0x24')][_0xc4c0c5['actions'][_0x28431d]['queue']][_0x399b('0x2d')]),JSON['stringify'](_0xc4c0c5[_0x399b('0x74')][_0x28431d][_0x399b('0x78')]),JSON[_0x399b('0x59')](_[_0x399b('0x79')](_0xc4c0c5[_0x399b('0x74')][_0x28431d],[_0x399b('0x7a'),_0x399b('0x7b'),_0x399b('0x7c'),'ListId'])));return ami['Action']({'action':_0x399b('0x7d'),'channel':_0xc4c0c5[_0x399b('0x74')][_0x28431d]['channel']})[_0x399b('0x7e')](function(_0x105cf8){if(_0x105cf8['message']===_0x399b('0x7f')){setTimeout(function(){if(_0xc4c0c5['actions'][_0x28431d]){ut[_0x399b('0x80')](_0xc4c0c5[_0x399b('0x24')][_0xc4c0c5['actions'][_0x28431d][_0x399b('0x75')]],'[clearZombieChannel]');if(_0xc4c0c5['actions'][_0x28431d][_0x399b('0x78')]===!![]){ut[_0x399b('0x81')](_0xc4c0c5[_0x399b('0x24')][_0xc4c0c5[_0x399b('0x74')][_0x28431d][_0x399b('0x75')]],_0x399b('0x82'));ut[_0x399b('0x83')](_0x399b('0x84')+_0x28431d,_0xc4c0c5[_0x399b('0x74')][_0x28431d][_0x399b('0x75')]);}ut[_0x399b('0x83')](_0x399b('0x85')+_0x28431d,_0xc4c0c5[_0x399b('0x74')][_0x28431d][_0x399b('0x75')]);delete _0xc4c0c5[_0x399b('0x74')][_0x28431d];}},0x2328);}});}});};Preview[_0x399b('0xf')][_0x399b('0x6d')]=function(){var _0x5291ea=this;loggerAction['info'](_0x399b('0x86'),_[_0x399b('0x87')](this[_0x399b('0x74')]));for(var _0x44bd32 in this[_0x399b('0x74')]){if(_0x5291ea['actions']['hasOwnProperty'](_0x44bd32)){_0x5291ea[_0x399b('0x70')](_0x44bd32);}}};Preview[_0x399b('0xf')][_0x399b('0x6f')]=function(_0x323344){var _0x38f04b=this;rpcDb[_0x399b('0x88')](_0x323344['id'],ut[_0x399b('0x89')](this[_0x399b('0x15')]))[_0x399b('0x8a')](function(_0x58bbea){if(!_['isNil'](_0x58bbea)){for(var _0x16bc41=0x0;_0x16bc41<_0x58bbea[_0x399b('0x8b')];_0x16bc41+=0x1){if(ut[_0x399b('0x8c')](_0x58bbea[_0x16bc41]['scheduledat'])<_0x323344[_0x399b('0x8d')]*0x3c){if(_0x58bbea[_0x16bc41][_0x399b('0x8e')]&&!_0x58bbea[_0x16bc41][_0x399b('0x8e')]['voicePause']){_0x38f04b['run'](_0x58bbea[_0x16bc41]['id'])[_0x399b('0x8a')](ut['logger2'](_0x399b('0x8f')))['catch'](ut[_0x399b('0x90')](_0x399b('0x8f')));}else{rpcDb['disableContact'](_0x58bbea[_0x16bc41]['id']);}}else{var _0x2b2cec=new Action(_0x58bbea[_0x16bc41],_0x323344);_0x2b2cec[_0x399b('0x91')]=moment()[_0x399b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x323344[_0x399b('0x42')]+=0x1;ut[_0x399b('0x92')](_0x2b2cec,0x17,_0x399b('0x93'));if(_0x323344[_0x399b('0x94')]){rpcDb[_0x399b('0x95')](ut[_0x399b('0x96')](_0x58bbea[_0x16bc41]));rpcDb[_0x399b('0x97')](_0x2b2cec,_0x399b('0x98'));}else{ut[_0x399b('0x92')](_0x2b2cec,0x16,_0x399b('0x99'));rpcDb['createCustomerHistory'](_0x2b2cec,_0x399b('0x9a'));rpcDb['createCustomerFinal'](_0x2b2cec,_0x399b('0x9a'));}}}}})[_0x399b('0x7e')](ut[_0x399b('0x90')](_0x399b('0x9b')));};Preview[_0x399b('0xf')][_0x399b('0x6e')]=function(_0x59079d){_0x59079d['sendMessageOneNotActive']=!![];if(ut[_0x399b('0x9c')](_0x59079d['loggedIn'])){_0x59079d[_0x399b('0x61')]=_0x399b('0x9d');}else if(!ut[_0x399b('0x9e')](_0x59079d[_0x399b('0x34')])){_0x59079d['message']=_0x399b('0x62');}else if(!this[_0x399b('0x9f')](_0x59079d[_0x399b('0x55')])){if(!this[_0x399b('0x9f')](_0x59079d[_0x399b('0xa0')])){_0x59079d[_0x399b('0x61')]=_0x399b('0xa1');}else{_0x59079d[_0x399b('0x61')]=_0x399b('0xa2');}}else{_0x59079d[_0x399b('0x61')]=_0x399b('0xa2');}emitCampaignPreview(_0x59079d);};Preview[_0x399b('0xf')][_0x399b('0xa3')]=function(_0x56c168,_0x54053a,_0xe3866){var _0x322093=this;var _0x576a80=this['actions'][_0x54053a];var _0x45161f=this[_0x399b('0x24')][_0x576a80[_0x399b('0x75')]];var _0xe7bc9f;if(_0x45161f){switch(_0xe3866){case'1':_0x45161f['outboundNoSuchCallsDay']+=0x1;_0x576a80[_0x399b('0xa4')]=ut[_0x399b('0xa5')](_0x576a80);ut[_0x399b('0x92')](_0x576a80,0x0,_0x399b('0xa6'));rpcDb[_0x399b('0x97')](_0x576a80,_0x399b('0xa7'));if(ut[_0x399b('0xa5')](_0x576a80)>=_0x45161f[_0x399b('0xa8')]){_0xe7bc9f=ut[_0x399b('0xa9')](_0x576a80,0xf,_0x399b('0xaa'));rpcDb[_0x399b('0xab')](_0xe7bc9f,_0x399b('0xac'));}else{rpcDb[_0x399b('0xab')](_0x576a80,_0x399b('0xac'));}delete this[_0x399b('0x74')][_0x56c168[_0x399b('0xad')]];break;case _0x399b('0xae'):var _0x532b1d=moment()[_0x399b('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x576a80[_0x399b('0xaf')]=_0x532b1d;_0x576a80[_0x399b('0xb0')]=_0x532b1d;_0x576a80[_0x399b('0x78')]=!![];_0x45161f['pTalking']+=0x1;logger[_0x399b('0x5b')](_0x399b('0xb1'),_0x576a80[_0x399b('0xb2')],_0x399b('0xb3'),_0x45161f[_0x399b('0x28')],'pTalking:\x20',_0x45161f[_0x399b('0x2d')]);ami[_0x399b('0x25')]('custom:agentconnect',ut[_0x399b('0xb4')](_0x576a80,'connect'));if(_0x45161f['acw']){ami['emit'](_0x399b('0xb5'),ut['buildAcw'](_0x576a80));}break;case'16':ami[_0x399b('0x25')](_0x399b('0xb6'),ut[_0x399b('0xb4')](_0x576a80,_0x399b('0xb7')));emitVoiceQueueChannelRemove(ut[_0x399b('0xb4')](_0x576a80,_0x399b('0xb7')));_0x45161f[_0x399b('0x3a')]+=0x1;_0x45161f[_0x399b('0xb8')]+=0x1;_0x45161f['answered']+=0x1;ut[_0x399b('0x81')](_0x45161f,_0x399b('0xb9'));_0x576a80[_0x399b('0xa4')]=ut['totalGlobal'](_0x576a80);ut[_0x399b('0x92')](_0x576a80,0x4,'Answer');rpcDb[_0x399b('0x97')](_0x576a80,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x399b('0xab')](_0x576a80,_0x399b('0xba'));rpcDb['crateCustomerReportQueue'](_0x576a80);_0x45161f[_0x399b('0x2f')]+=_0x576a80[_0x399b('0xbb')];_0x45161f[_0x399b('0x2e')]+=_0x576a80['talktime'];logger['info'](_0x399b('0xbc'),_0x576a80[_0x399b('0xb2')],'\x20Queue',_0x45161f[_0x399b('0x28')],_0x399b('0x77'),_0x45161f[_0x399b('0x2d')]);delete this[_0x399b('0x74')][_0x56c168[_0x399b('0xad')]];break;case _0x399b('0xbd'):_0x45161f['outboundBusyCallsDay']+=0x1;_0x576a80[_0x399b('0xbe')]+=0x1;_0x576a80[_0x399b('0xa4')]=ut['totalGlobal'](_0x576a80);ut[_0x399b('0x92')](_0x576a80,0x5,_0x399b('0xbf'));rpcDb[_0x399b('0x97')](_0x576a80,_0x399b('0xc0'));if(ut['totalGlobal'](_0x576a80)>=_0x45161f[_0x399b('0xa8')]){_0xe7bc9f=ut[_0x399b('0xa9')](_0x576a80,0xf,_0x399b('0xaa'));rpcDb[_0x399b('0xab')](_0xe7bc9f,_0x399b('0xc1'));}else{if(_0x576a80[_0x399b('0xbe')]>=_0x45161f[_0x399b('0xc2')]){rpcDb[_0x399b('0xab')](_0x576a80,_0x399b('0xc0'));}else{rpcDb[_0x399b('0xc3')](ut[_0x399b('0xc4')](_0x576a80,_0x399b('0xbe'),_0x45161f[_0x399b('0xc5')]),_0x576a80[_0x399b('0xc6')],_0x576a80['activeContact']);}}break;case _0x399b('0xc7'):_0x45161f[_0x399b('0x40')]+=0x1;_0x576a80[_0x399b('0xc8')]+=0x1;_0x576a80['countglobal']=ut[_0x399b('0xa5')](_0x576a80);ut[_0x399b('0x92')](_0x576a80,0x3,_0x399b('0xc9'));rpcDb[_0x399b('0x97')](_0x576a80,_0x399b('0xca'));if(ut[_0x399b('0xa5')](_0x576a80)>=_0x45161f['dialGlobalMaxRetry']){_0xe7bc9f=ut[_0x399b('0xa9')](_0x576a80,0xf,'Global');rpcDb[_0x399b('0xab')](_0xe7bc9f,_0x399b('0xcb'));}else{if(_0x576a80[_0x399b('0xc8')]>=_0x45161f[_0x399b('0xcc')]){rpcDb[_0x399b('0xab')](_0x576a80,_0x399b('0xca'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x576a80,_0x399b('0xc8'),_0x45161f[_0x399b('0xcd')]),_0x576a80[_0x399b('0xc6')],_0x576a80[_0x399b('0xce')]);}}break;case'CONGESTION':_0x45161f[_0x399b('0x3c')]+=0x1;_0x576a80['countcongestionretry']+=0x1;_0x576a80['countglobal']=ut[_0x399b('0xa5')](_0x576a80);ut[_0x399b('0x92')](_0x576a80,0x8,_0x399b('0xcf'));rpcDb[_0x399b('0x97')](_0x576a80,_0x399b('0xd0'));if(ut[_0x399b('0xa5')](_0x576a80)>=_0x45161f[_0x399b('0xa8')]){_0xe7bc9f=ut[_0x399b('0xa9')](_0x576a80,0xf,_0x399b('0xaa'));rpcDb[_0x399b('0xab')](_0xe7bc9f,_0x399b('0xd1'));}else{if(_0x576a80[_0x399b('0xd2')]>=_0x45161f['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x576a80,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x399b('0xc3')](ut[_0x399b('0xc4')](_0x576a80,_0x399b('0xd2'),_0x45161f[_0x399b('0xc5')]),_0x576a80['unlockAgent'],_0x576a80[_0x399b('0xce')]);}}break;case _0x399b('0xd3'):_0x45161f[_0x399b('0x43')]+=0x1;_0x576a80[_0x399b('0xa4')]=ut[_0x399b('0xa5')](_0x576a80);ut[_0x399b('0x92')](_0x576a80,0x14,_0x399b('0xd4'));rpcDb[_0x399b('0x97')](_0x576a80,'[syncHangupRequest][logAgentReject]');if(_0x576a80[_0x399b('0xc6')]){rpcDb[_0x399b('0xd5')](_0x576a80[_0x399b('0xd6')]);}if(_0x576a80['activeContact']){rpcDb['disableContact'](_0x576a80['idContact']);}break;default:if(_0x576a80[_0x399b('0x78')]){ut[_0x399b('0x81')](_0x45161f,'[default]');ut[_0x399b('0x83')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x45161f[_0x399b('0x28')],_0x56c168);}_0x45161f[_0x399b('0x44')]+=0x1;_0x576a80[_0x399b('0xa4')]=ut[_0x399b('0xa5')](_0x576a80);ut['logCustomer'](_0x576a80,0xc,_0x56c168[_0x399b('0xd7')]||_0x56c168[_0x399b('0xd8')]);rpcDb[_0x399b('0x97')](_0x576a80,_0x399b('0xd9'));if(ut[_0x399b('0xa5')](_0x576a80)>=_0x45161f[_0x399b('0xa8')]){_0xe7bc9f=ut[_0x399b('0xa9')](_0x576a80,0xf,_0x399b('0xaa'));rpcDb[_0x399b('0xab')](_0xe7bc9f,_0x399b('0xda'));}else{rpcDb[_0x399b('0xab')](_0x576a80,_0x399b('0xda'));}delete this[_0x399b('0x74')][_0x56c168['linkedid']];}if(!(_0x576a80[_0x399b('0x78')]&&_0xe3866==='16')){ut[_0x399b('0x80')](_0x45161f,_0x399b('0xdb'));logger[_0x399b('0x5b')](_0x399b('0xdc'),_0x576a80[_0x399b('0xb2')],_0x399b('0xb3'),_0x45161f[_0x399b('0x28')],_0x399b('0x76'),_0x45161f[_0x399b('0x4f')]);}if(_0xe3866!==_0x399b('0xae')){delete this[_0x399b('0x74')][_0x56c168[_0x399b('0xad')]];delete this[_0x399b('0x74')][_0x56c168[_0x399b('0xdd')]];}}};Preview[_0x399b('0xf')]['callProgressDetectingAgent']=function(_0x59a9a2,_0x2c1964,_0x41be93){if(_[_0x399b('0xde')](_0x2c1964)&&_0x399b('0xdf')!==typeof _0x2c1964){return;}if(_[_0x399b('0xde')](_0x41be93)&&'object'!==typeof _0x41be93){return;}switch(_0x41be93[_0x399b('0xe0')]){case'0':ut[_0x399b('0xe1')](_0x59a9a2,0x0,_0x399b('0xa6'));rpcDb[_0x399b('0xe2')](_0x59a9a2,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x399b('0xe1')](_0x59a9a2,0x3,'NoAnswer');rpcDb[_0x399b('0xe2')](_0x59a9a2,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x399b('0xe1')](_0x59a9a2,0x5,_0x399b('0xbf'));rpcDb['createAgentHistory'](_0x59a9a2,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x399b('0xe1')](_0x59a9a2,0x8,'Congestion');rpcDb['createAgentHistory'](_0x59a9a2,_0x399b('0xe3'));break;case'22':ut[_0x399b('0xe1')](_0x59a9a2,0x16,'AnswerAGI');rpcDb[_0x399b('0xe2')](_0x59a9a2,_0x399b('0xe4'));break;default:ut[_0x399b('0xe1')](_0x59a9a2,0xc,_0x41be93['reason']);rpcDb[_0x399b('0xe2')](_0x59a9a2,_0x399b('0xe3'));}ut[_0x399b('0x80')](_0x2c1964,_0x399b('0xe5'));logger[_0x399b('0x5b')](_0x399b('0xe6'),_0x59a9a2['uniqueid'],_0x399b('0xb3'),_0x2c1964[_0x399b('0x28')],'originated:\x20',_0x2c1964[_0x399b('0x4f')]);delete this[_0x399b('0x74')][_0x59a9a2[_0x399b('0xb2')]];};Preview[_0x399b('0xf')][_0x399b('0xe7')]=function(_0x3a0520,_0x190ccc,_0x23c6ff,_0x3fcd03,_0x8ec7ea){var _0x521a1e=this;return new BPromise(function(_0x24a4dc,_0x5a484a){if(_[_0x399b('0x71')](_0x190ccc)||_[_0x399b('0x71')](_0x190ccc[_0x399b('0xe8')])||_[_0x399b('0x71')](_0x190ccc[_0x399b('0xe8')][_0x399b('0xe9')])||_[_0x399b('0x71')](_0x190ccc[_0x399b('0x7c')])){_0x5a484a(ut['message'](_0x399b('0xea'),_0x3fcd03,_0x8ec7ea));return;}var _0x544e43=uuid['v4']();var _0x1a1039=_0x521a1e[_0x399b('0x24')][_0x190ccc[_0x399b('0x73')][_0x399b('0x28')]];var _0x102ccc=_0x23c6ff?_0x521a1e[_0x399b('0x15')][_0x23c6ff]['id']:undefined;_0x521a1e[_0x399b('0x74')][_0x544e43]=new Action(_0x190ccc,_0x1a1039,_0x544e43,_0x23c6ff,_0x102ccc);var _0x23db26=_0x521a1e[_0x399b('0x74')][_0x544e43];_0x23db26[_0x399b('0xc6')]=_0x3fcd03;_0x23db26[_0x399b('0xce')]=_0x8ec7ea;_0x23db26[_0x399b('0xeb')]=_0x23c6ff;if(_[_0x399b('0xec')](_0x3a0520)){_0x521a1e[_0x399b('0xed')](_0x23db26,_0x1a1039,_0x190ccc,_0x23c6ff)[_0x399b('0x8a')](function(_0x27929c){logger['info']('[Preview][execCall][success]','Queue:\x20'+_0x23db26[_0x399b('0x75')]+_0x399b('0xee')+_0x23db26[_0x399b('0xd6')],JSON['stringify'](_0x27929c));ami[_0x399b('0x25')]('custom:agentcalled',ut[_0x399b('0xb4')](_0x23db26,_0x399b('0xef')));_0x24a4dc(ut['message']('Calling'));})['catch'](function(_0x586430){ut[_0x399b('0x65')](_0x399b('0xf0'),_0x586430);_0x5a484a(ut['message'](_0x399b('0xf1'),_0x3fcd03,_0x8ec7ea));});}else{_0x1a1039['outboundBlacklistCallsDay']+=0x1;ut[_0x399b('0xf2')](_0x23db26);rpcDb['createHistory'](_0x23db26,'[Blacklist][error]');delete _0x521a1e[_0x399b('0x74')][_0x544e43];_0x5a484a(ut[_0x399b('0x61')](_0x399b('0xf3'),_0x3fcd03,_0x8ec7ea));}});};Preview['prototype'][_0x399b('0x9f')]=function(_0x5acee9){return!_['isNil'](_0x5acee9)&&!_['isNil'](_0x5acee9[_0x399b('0x28')])&&!_[_0x399b('0x71')](_0x5acee9['active'])&&_0x5acee9['active']&&!_[_0x399b('0x71')](this['trunks'][util[_0x399b('0x5c')](_0x399b('0xf4'),_0x5acee9[_0x399b('0x28')])])&&!_['isNil'](this[_0x399b('0x14')][util['format'](_0x399b('0xf4'),_0x5acee9[_0x399b('0x28')])][_0x399b('0x7d')])&&(this[_0x399b('0x14')][util[_0x399b('0x5c')](_0x399b('0xf4'),_0x5acee9['name'])]['status']===_0x399b('0xf5')||this['trunks'][util[_0x399b('0x5c')](_0x399b('0xf4'),_0x5acee9[_0x399b('0x28')])][_0x399b('0x7d')]===_0x399b('0xf6'));};Preview[_0x399b('0xf')]['run']=function(_0x3b55d2,_0x3a26f7){var _0xf7656=this;return new BPromise(function(_0x28f11d,_0xd7c855){_0xf7656[_0x399b('0xf7')](_0x3b55d2,_0x3a26f7)[_0x399b('0x8a')](function(_0x4c67dc){_0x28f11d(_[_0x399b('0x79')](_0x4c67dc,[_0x399b('0x61')]));})[_0x399b('0x7e')](function(_0x337c7b){if(_0x337c7b[_0x399b('0xf8')]){rpcDb[_0x399b('0xd5')](_0x3b55d2);}if(_0x337c7b['active']){rpcDb['disableContact'](_0x3b55d2);}_0xd7c855(_[_0x399b('0x79')](_0x337c7b,[_0x399b('0x61')]));});});};Preview[_0x399b('0xf')][_0x399b('0xf7')]=function(_0x468c15,_0x2ee8aa){var _0x201a4b=this;return new BPromise(function(_0x18fd62,_0x3b8718){var _0x3b4e6a,_0x2b92d3;rpcDb['getContactPreview'](_0x468c15)['then'](function(_0x1a4277){if(!_[_0x399b('0x71')](_0x1a4277[0x0])){_0x2b92d3=_0x1a4277[0x0][_0x399b('0xf9')]?![]:!![];_0x3b4e6a=_0x1a4277[0x0][_0x399b('0xf9')]?!![]:![];_0x3b4e6a=_0x2ee8aa?!![]:_0x3b4e6a;}var _0x3ec3f5=_0x201a4b[_0x399b('0xfa')](_0x1a4277);if(_0x3ec3f5[_0x399b('0xfb')]){rpcDb[_0x399b('0xfc')](_[_0x399b('0x79')](_0x1a4277[0x0],[_0x399b('0x7c'),'Contact.phone']))[_0x399b('0x8a')](function(_0x39e987){_0x201a4b[_0x399b('0xe7')](_0x39e987,_0x1a4277[0x0],_0x2ee8aa,_0x2b92d3,_0x3b4e6a)[_0x399b('0x8a')](function(_0x3b83a2){_0x18fd62(_0x3b83a2);})['catch'](function(_0x3842ad){_0x3b8718(_0x3842ad);});})[_0x399b('0x7e')](function(_0x305885){ut[_0x399b('0x65')](_0x399b('0xfd'),_0x305885);_0x3b8718(ut[_0x399b('0x61')](_0x399b('0xfe'),_0x2b92d3,_0x3b4e6a));});}else{_0x3b8718(ut[_0x399b('0x61')](_0x3ec3f5[_0x399b('0x61')],_0x2b92d3,_0x3b4e6a));}})['catch'](function(_0x2aa52f){ut[_0x399b('0x65')](_0x399b('0xff'),_0x2aa52f);_0x3b8718(ut[_0x399b('0x61')](_0x399b('0xfe'),![],!![]));});});};Preview['prototype'][_0x399b('0xfa')]=function(_0x4c8c3a){if(_[_0x399b('0x71')](_0x4c8c3a)||_[_0x399b('0xec')](_0x4c8c3a)||!_['isNil'](_0x4c8c3a[0x0][_0x399b('0x8e')])&&_[_0x399b('0x71')](_0x4c8c3a[0x0][_0x399b('0x8e')][_0x399b('0x28')])){ut['logger'](_0x399b('0x100'),_0x4c8c3a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1a930d=this[_0x399b('0x24')][_0x4c8c3a[0x0][_0x399b('0x73')]['name']];_0x1a930d[_0x399b('0x61')]=_0x399b('0xa2');if(_[_0x399b('0x71')](_0x1a930d)){ut['logger'](_0x399b('0x101'),_0x1a930d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x399b('0x9f')](_0x1a930d[_0x399b('0x55')])){ut[_0x399b('0x65')](_0x399b('0x102'),_0x399b('0x103')+_0x1a930d[_0x399b('0x28')]+_0x399b('0x104'));if(!this[_0x399b('0x9f')](_0x1a930d[_0x399b('0xa0')])){ut[_0x399b('0x65')](_0x399b('0x102'),_0x1a930d['name']+_0x399b('0x105'));return{'isValid':![],'message':_0x399b('0x106')};}}if(!ut[_0x399b('0x9e')](_0x1a930d[_0x399b('0x34')])){ut['logger'](_0x399b('0x107'),_0x1a930d[_0x399b('0x28')]+_0x399b('0x108'));return{'isValid':![],'message':_0x399b('0x103')+_0x1a930d[_0x399b('0x28')]+_0x399b('0x108')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x399b('0xf')][_0x399b('0xed')]=function(_0x271b28,_0x1e6945,_0x482648,_0x517d0e){var _0x5ef6e8=this;return new BPromise(function(_0x373c10,_0x4c397d){var _0x291d1f=_0x271b28[_0x399b('0xb2')];var _0x622c01=_0x5ef6e8[_0x399b('0x9f')](_0x1e6945[_0x399b('0x55')])?util[_0x399b('0x5c')](_0x399b('0x109'),_0x1e6945[_0x399b('0x55')][_0x399b('0x28')],_['isNil'](_0x1e6945[_0x399b('0x38')])?'':_0x1e6945[_0x399b('0x38')]['trim']()||'',_0x1e6945[_0x399b('0x10a')]>0x0?_0x482648[_0x399b('0xe8')][_0x399b('0xe9')][_0x399b('0x10b')](_0x1e6945['dialCutDigit']):_0x482648['Contact'][_0x399b('0xe9')]):util[_0x399b('0x5c')]('SIP/%s/%s%s',_[_0x399b('0x71')](_0x1e6945[_0x399b('0xa0')])?_0x1e6945[_0x399b('0x55')]['name']:_0x1e6945['TrunkBackup'][_0x399b('0x28')],_[_0x399b('0x71')](_0x1e6945[_0x399b('0x38')])?'':_0x1e6945[_0x399b('0x38')]['trim']()||'',_0x1e6945[_0x399b('0x10a')]>0x0?_0x482648['Contact']['phone'][_0x399b('0x10b')](_0x1e6945[_0x399b('0x10a')]):_0x482648[_0x399b('0xe8')][_0x399b('0xe9')]);var _0xd4ec6b=_0x5ef6e8[_0x399b('0x9f')](_0x1e6945[_0x399b('0x55')])?ut[_0x399b('0x10c')](_0x1e6945[_0x399b('0x55')]['callerid'],_0x1e6945[_0x399b('0x36')],_0x1e6945[_0x399b('0x10d')]>0x0?ut[_0x399b('0x10e')](_0x1e6945['dialOriginateCallerIdNumber'],_0x1e6945[_0x399b('0x10d')]):_0x1e6945[_0x399b('0x37')]):ut['getCallerId'](_['isNil'](_0x1e6945[_0x399b('0xa0')])?_0x1e6945[_0x399b('0x55')][_0x399b('0x57')]:_0x1e6945[_0x399b('0xa0')]['callerid'],_0x1e6945[_0x399b('0x36')],_0x1e6945['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x399b('0x10e')](_0x1e6945[_0x399b('0x37')],_0x1e6945[_0x399b('0x10d')]):_0x1e6945[_0x399b('0x37')]);if(_0xd4ec6b){_0x271b28[_0x399b('0x10f')]=ut['extractCalleridName'](_0xd4ec6b);_0x271b28[_0x399b('0x110')]=ut['extractCalleridNumber'](_0xd4ec6b);}var _0x21a4e8=ut[_0x399b('0x111')](_0x1e6945,_0x482648,_0x622c01,_0xd4ec6b,_0x291d1f,_0x271b28);_[_0x399b('0x112')](_0x271b28,ut[_0x399b('0x113')](_0x21a4e8));_0x271b28[_0x399b('0x91')]=moment()[_0x399b('0x5c')](_0x399b('0x114'));ami[_0x399b('0x115')](ut['variablesAction'](_0x271b28,_0x1e6945,_0x21a4e8,_0x271b28[_0x399b('0xce')],_0x517d0e))[_0x399b('0x8a')](function(_0x25c746){_0x1e6945[_0x399b('0x4f')]+=0x1;logger[_0x399b('0x5b')](_0x399b('0x116'),_0x291d1f,'\x20Queue',_0x1e6945[_0x399b('0x28')],'originated:\x20',_0x1e6945[_0x399b('0x4f')]);_0x373c10(_0x25c746);})[_0x399b('0x7e')](function(_0x3b6b4a){ut['logAgent'](_0x271b28,0xe,_0x399b('0x117'));rpcDb[_0x399b('0xe2')](_0x271b28,_0x399b('0x118'));_0x4c397d(_0x3b6b4a);});});};Preview[_0x399b('0xf')][_0x399b('0x1f')]=function(_0x265c31){if(this[_0x399b('0x74')][_0x265c31[_0x399b('0xad')]]){this[_0x399b('0x74')][_0x265c31[_0x399b('0xad')]][_0x399b('0x119')]=_0x265c31[_0x399b('0x119')];}};Preview[_0x399b('0xf')][_0x399b('0x17')]=function(_0x10a03f){var _0x26d3b1=this;var _0x33edd2=this[_0x399b('0x74')][_0x10a03f['actionid']];if(_0x33edd2){if(_0x33edd2[_0x399b('0xeb')]&&this[_0x399b('0x15')][_0x33edd2[_0x399b('0xeb')]]){ut[_0x399b('0x11a')](_0x33edd2,this[_0x399b('0x15')][_0x33edd2[_0x399b('0xeb')]][_0x399b('0x28')],this['agents'][_0x33edd2[_0x399b('0xeb')]]['id']);}var _0x2160b3=_[_0x399b('0x11b')](_0x33edd2);_0x2160b3[_0x399b('0xaf')]=moment()[_0x399b('0x5c')](_0x399b('0x114'));var _0x5800d6=_0x26d3b1[_0x399b('0x24')][_0x33edd2[_0x399b('0x75')]];if(ut[_0x399b('0x11c')](_0x10a03f['response'])){if(_0x33edd2['unlockAgent']){rpcDb[_0x399b('0xd5')](_0x33edd2[_0x399b('0xd6')]);}if(_0x33edd2['activeContact']){rpcDb[_0x399b('0x11d')](_0x33edd2[_0x399b('0xd6')]);}ami[_0x399b('0x25')]('custom:agentringnoanswer',ut['buildObj'](_0x33edd2,_0x399b('0x11e')));this[_0x399b('0x11f')](_0x2160b3,_0x5800d6,_0x10a03f);}else{_0x33edd2[_0x399b('0x91')]=moment()[_0x399b('0x5c')](_0x399b('0x114'));ut[_0x399b('0xe1')](_0x2160b3,0x4,_0x399b('0x120'));rpcDb['createAgentHistory'](_0x2160b3,_0x399b('0x121'));}}};Preview[_0x399b('0xf')][_0x399b('0x1a')]=function(_0x2241d0){var _0x22faf2=this;var _0x92b8e3=this[_0x399b('0x74')][_0x2241d0[_0x399b('0xad')]];var _0x30d872;if(_0x92b8e3){_0x30d872=this['campaignsPreview'][_0x92b8e3[_0x399b('0x75')]];logger[_0x399b('0x5b')](_0x399b('0x122'),_0x2241d0['linkedid'],_0x399b('0xb3'),_0x30d872[_0x399b('0x28')],_0x399b('0x77'),_0x30d872[_0x399b('0x2d')]);}if(this['actions'][_0x2241d0[_0x399b('0xad')]]&&_0x2241d0[_0x399b('0xad')]!==_0x2241d0[_0x399b('0xb2')]){if(_0x2241d0[_0x399b('0x123')]==='16'&&this[_0x399b('0x74')][_0x2241d0[_0x399b('0xad')]][_0x399b('0x78')]){this[_0x399b('0xa3')](_0x2241d0,_0x2241d0[_0x399b('0xad')],_0x2241d0[_0x399b('0x123')]);}else if(this['actions'][_0x2241d0[_0x399b('0xad')]][_0x399b('0x78')]){logger[_0x399b('0x5b')](_0x399b('0x124'),_0x2241d0[_0x399b('0xad')],_0x2241d0[_0x399b('0x123')],'\x20Queue',_0x30d872[_0x399b('0x28')],'pTalking:\x20',_0x30d872['pTalking']);this[_0x399b('0xa3')](_0x2241d0,_0x2241d0[_0x399b('0xad')],_0x2241d0['cause']);}}else if(_0x92b8e3&&_['isNil'](_0x92b8e3[_0x399b('0x125')])&&_0x30d872[_0x399b('0x126')]&&_0x2241d0[_0x399b('0xad')]===_0x2241d0['uniqueid']&&_[_0x399b('0x71')](_0x2241d0[_0x399b('0xe0')])&&_0x2241d0['cause']==='16'&&_0x2241d0[_0x399b('0x127')]==='6'&&_[_0x399b('0xde')](_0x92b8e3[_0x399b('0x128')])){if(_0x92b8e3[_0x399b('0xc6')]){rpcDb[_0x399b('0xd5')](_0x92b8e3[_0x399b('0xd6')]);}if(_0x92b8e3[_0x399b('0xce')]){rpcDb['disableContact'](_0x92b8e3['idContact']);}_0x2241d0[_0x399b('0xe0')]='22';this[_0x399b('0x11f')](_0x92b8e3,_0x30d872,_0x2241d0);}else if(_0x92b8e3&&_0x92b8e3[_0x399b('0x128')]){if(_0x2241d0[_0x399b('0x123')]==='16'&&this['actions'][_0x2241d0[_0x399b('0xad')]]['dialAnswer']){logger[_0x399b('0x5b')]('[syncHangup][talking][transfer]',_0x2241d0[_0x399b('0xad')],_0x2241d0[_0x399b('0x123')],_0x399b('0xb3'),_0x30d872[_0x399b('0x28')],_0x399b('0x77'),_0x30d872['pTalking']);this[_0x399b('0xa3')](_0x2241d0,_0x2241d0[_0x399b('0xad')],_0x2241d0[_0x399b('0x123')]);}else if(this[_0x399b('0x74')][_0x2241d0['linkedid']][_0x399b('0x78')]){logger[_0x399b('0x5b')](_0x399b('0x124'),_0x2241d0[_0x399b('0xad')],_0x2241d0[_0x399b('0x123')],_0x399b('0xb3'),_0x30d872['name'],_0x399b('0x77'),_0x30d872[_0x399b('0x2d')]);this[_0x399b('0xa3')](_0x2241d0,_0x2241d0['linkedid'],_0x2241d0[_0x399b('0x123')]);}}};Preview[_0x399b('0xf')][_0x399b('0x1d')]=function(_0x4c2a0f){if(this[_0x399b('0x74')][_0x4c2a0f[_0x399b('0xdd')]]&&_0x4c2a0f['destlinkedid']!==_0x4c2a0f[_0x399b('0x129')]){this[_0x399b('0xa3')](_0x4c2a0f,_0x4c2a0f[_0x399b('0xdd')],_0x4c2a0f[_0x399b('0xd8')]);}};Preview[_0x399b('0xf')][_0x399b('0x1b')]=function(_0x463256){if(this['actions'][_0x463256[_0x399b('0xad')]]&&_0x463256['linkedid']!==_0x463256[_0x399b('0xb2')]&&!this[_0x399b('0x74')][_0x463256['linkedid']]['dialAnswer']){if(_0x463256[_0x399b('0x123')]==='1'){this[_0x399b('0xa3')](_0x463256,_0x463256[_0x399b('0xad')],_0x463256['cause']);}}};Preview['prototype']['addVariable']=function(_0x3035fd,_0x1380ce,_0x3091f5){if(this[_0x399b('0x74')][_0x3035fd]){if(_[_0x399b('0x71')](this['actions'][_0x3035fd][_0x399b('0x12a')])){this[_0x399b('0x74')][_0x3035fd][_0x399b('0x12a')]={};}this[_0x399b('0x74')][_0x3035fd][_0x399b('0x12a')][_0x1380ce]=_0x3091f5;}};Preview[_0x399b('0xf')][_0x399b('0x20')]=function(_0x37338b){try{if(!_['isNil'](_0x37338b)){if(ut[_0x399b('0x12b')](_['keys'](_0x37338b[_0x399b('0x12c')])[0x0])){this[_0x399b('0x12d')](_0x37338b['uniqueid'],_[_0x399b('0x12e')](_0x37338b[_0x399b('0x12c')])[0x0],_0x37338b[_0x399b('0x12f')]);}}}catch(_0x2450c1){logger[_0x399b('0x130')]('[syncVarSet][Preview]',util['inspect'](_0x2450c1,{'showHidden':![],'depth':null}));}};Preview[_0x399b('0xf')]['syncAttendedTransfer']=function(_0x19c39c){if(_0x19c39c){if(this[_0x399b('0x74')][_0x19c39c['transfertargetlinkedid']]){this[_0x399b('0x74')][_0x19c39c[_0x399b('0x131')]][_0x399b('0x128')]=!![];}}};Preview['prototype'][_0x399b('0x23')]=function(_0x29dda6){if(_0x29dda6){if(this[_0x399b('0x74')][_0x29dda6[_0x399b('0x132')]]){this[_0x399b('0x74')][_0x29dda6[_0x399b('0x132')]][_0x399b('0x128')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 16f964a..99704a7 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 _0xcca7=['calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum'];(function(_0x58081e,_0x2c7fdb){var _0x5795e5=function(_0x3a09e9){while(--_0x3a09e9){_0x58081e['push'](_0x58081e['shift']());}};_0x5795e5(++_0x2c7fdb);}(_0xcca7,0x1aa));var _0x7cca=function(_0x12f77e,_0x4442f2){_0x12f77e=_0x12f77e-0x0;var _0x4568c0=_0xcca7[_0x12f77e];return _0x4568c0;};'use strict';var util=require(_0x7cca('0x0'));var BPromise=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7cca('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x7cca('0x5'));var voiceQueueRt=require(_0x7cca('0x6'));var agentReportPreview=require(_0x7cca('0x7'));var voiceQueueReport=require(_0x7cca('0x8'));function loggerCatch(_0x1c6c95){return function(_0xe70805){logger['error'](_0x1c6c95,util['inspect'](_0xe70805,{'showHidden':![],'depth':null}));};}function create(_0x937fad){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopperHistory[_0x7cca('0xb')](_0x937fad))[_0x7cca('0xc')](loggerCatch(_0x7cca('0xd')));}function createAgent(_0x20ffa9){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](agentReportPreview[_0x7cca('0xb')](_0x20ffa9))['catch'](loggerCatch(_0x7cca('0xd')));}function moveContact(_0x464911){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0xe')](_0x464911,!![]))['catch'](loggerCatch(_0x7cca('0xf')));}exports[_0x7cca('0x10')]=function(_0x2854c7){return BPromise['resolve']()['then'](cmHopperBlack[_0x7cca('0x10')](_0x2854c7))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x11')));};exports[_0x7cca('0x12')]=function(_0x444465){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper['getContactPreview'](_0x444465))[_0x7cca('0xc')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x4eb7fa,_0x33a466){create(_0x4eb7fa)[_0x7cca('0xc')](loggerCatch(_0x33a466));moveContact(_0x4eb7fa)[_0x7cca('0xc')](loggerCatch(_0x33a466));};exports[_0x7cca('0x13')]=function(_0x44294b,_0x5e7c42){createAgent(_0x44294b)[_0x7cca('0xc')](loggerCatch(_0x5e7c42));};exports['createCustomerHistory']=function(_0x5d47f8,_0x5d7ac6){create(_0x5d47f8)[_0x7cca('0xc')](loggerCatch(_0x5d7ac6));};exports[_0x7cca('0x14')]=function(_0x2beb6c,_0x1a20be){moveContact(_0x2beb6c)[_0x7cca('0xc')](loggerCatch(_0x1a20be));};exports[_0x7cca('0x15')]=function(_0x2e023c,_0x1e183f,_0x4d7804){if(_0x1e183f){_0x2e023c[_0x7cca('0x16')]=null;}if(_0x4d7804){_0x2e023c[_0x7cca('0x17')]=![];}return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper['rescheduleContact'](_0x2e023c))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x18')));};exports[_0x7cca('0x19')]=function(_0x119d76){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0x19')](_0x119d76))[_0x7cca('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x7cca('0x1a')]=function(_0x1dd3b3){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0x1a')]({'UserId':null},_0x1dd3b3,0x1))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x1b')));};exports[_0x7cca('0x1c')]=function(_0x583846){return BPromise[_0x7cca('0x9')]()['then'](cmHopper[_0x7cca('0x1a')]({'active':![]},_0x583846,0x1))[_0x7cca('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x7cca('0x1d')]=function(_0x3d91b1){var _0x5533fb={};_0x5533fb[_0x7cca('0x1e')]=_0x3d91b1[_0x7cca('0x1e')];_0x5533fb[_0x7cca('0x1f')]=_0x3d91b1['uniqueid'];_0x5533fb['calleridnum']=_0x3d91b1[_0x7cca('0x20')];_0x5533fb[_0x7cca('0x21')]=_0x3d91b1[_0x7cca('0x21')];_0x5533fb[_0x7cca('0x22')]=_0x3d91b1[_0x7cca('0x22')];_0x5533fb[_0x7cca('0x23')]=_0x3d91b1[_0x7cca('0x24')];_0x5533fb['queuecallerleaveAt']=_0x3d91b1['answertime'];_0x5533fb[_0x7cca('0x25')]=0x1;_0x5533fb[_0x7cca('0x26')]=_0x3d91b1[_0x7cca('0x27')];_0x5533fb['connectedlinename']=_0x3d91b1[_0x7cca('0x28')];_0x5533fb['context']=_0x7cca('0x29');_0x5533fb[_0x7cca('0x2a')]=_0x7cca('0x2b');_0x5533fb[_0x7cca('0x2c')]=0x0;_0x5533fb['assigned']=0x1;_0x5533fb[_0x7cca('0x2d')]=_0x3d91b1[_0x7cca('0x28')];_0x5533fb[_0x7cca('0x2e')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x7cca('0x2f')](_0x5533fb))[_0x7cca('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x7cca('0x30')]=function(_0xc34146,_0x193a4c){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper[_0x7cca('0x30')](_0xc34146,_0x193a4c))[_0x7cca('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7cca('0x31')]=function(_0x1f9bce){return BPromise[_0x7cca('0x9')]()[_0x7cca('0xa')](cmHopper['rescheduleContact'](_0x1f9bce,!![],!![]))[_0x7cca('0xc')](loggerCatch(_0x7cca('0x32')));}; \ No newline at end of file +var _0x81bd=['from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime'];(function(_0x2760f1,_0x431f6b){var _0x175c71=function(_0x41f695){while(--_0x41f695){_0x2760f1['push'](_0x2760f1['shift']());}};_0x175c71(++_0x431f6b);}(_0x81bd,0x7c));var _0xd81b=function(_0x45bc6a,_0x301e14){_0x45bc6a=_0x45bc6a-0x0;var _0x171a81=_0x81bd[_0x45bc6a];return _0x171a81;};'use strict';var util=require(_0xd81b('0x0'));var BPromise=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var _=require(_0xd81b('0x4'));var cmHopper=require(_0xd81b('0x5'));var cmHopperFinal=require(_0xd81b('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd81b('0x7'));var voiceQueueRt=require(_0xd81b('0x8'));var agentReportPreview=require(_0xd81b('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x42a0aa){return function(_0x34eb73){logger[_0xd81b('0xa')](_0x42a0aa,util['inspect'](_0x34eb73,{'showHidden':![],'depth':null}));};}function create(_0x5e14e8){return BPromise[_0xd81b('0xb')]()['then'](cmHopperHistory[_0xd81b('0xc')](_0x5e14e8))[_0xd81b('0xd')](loggerCatch(_0xd81b('0xe')));}function createAgent(_0x86dab6){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](agentReportPreview[_0xd81b('0xc')](_0x86dab6))[_0xd81b('0xd')](loggerCatch(_0xd81b('0xe')));}function moveContact(_0x23c789){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x10')](_0x23c789,!![]))['catch'](loggerCatch(_0xd81b('0x11')));}exports['checkIsBlackList']=function(_0x3f2405){return BPromise[_0xd81b('0xb')]()['then'](cmHopperBlack[_0xd81b('0x12')](_0x3f2405))['catch'](loggerCatch(_0xd81b('0x13')));};exports[_0xd81b('0x14')]=function(_0x6c6041){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper['getContactPreview'](_0x6c6041))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x15')));};exports['createHistory']=function(_0x2abef4,_0x26df61){create(_0x2abef4)[_0xd81b('0xd')](loggerCatch(_0x26df61));moveContact(_0x2abef4)[_0xd81b('0xd')](loggerCatch(_0x26df61));};exports[_0xd81b('0x16')]=function(_0xc49b8d,_0x6746f0){createAgent(_0xc49b8d)[_0xd81b('0xd')](loggerCatch(_0x6746f0));};exports[_0xd81b('0x17')]=function(_0x285164,_0x1ff3c6){create(_0x285164)[_0xd81b('0xd')](loggerCatch(_0x1ff3c6));};exports[_0xd81b('0x18')]=function(_0x3518f0,_0x156894){moveContact(_0x3518f0)[_0xd81b('0xd')](loggerCatch(_0x156894));};exports['rescheduleContact']=function(_0x4d566e,_0xc16ad0,_0x1b7876){if(_0xc16ad0){_0x4d566e[_0xd81b('0x19')]=null;}if(_0x1b7876){_0x4d566e['active']=![];}return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper['rescheduleContact'](_0x4d566e))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x1a')));};exports[_0xd81b('0x1b')]=function(_0x1ad65c){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x1b')](_0x1ad65c))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x1c')));};exports[_0xd81b('0x1d')]=function(_0x2ccedf){return BPromise[_0xd81b('0xb')]()['then'](cmHopper[_0xd81b('0x1d')]({'UserId':null},_0x2ccedf,0x1))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x1e')));};exports[_0xd81b('0x1f')]=function(_0x3266c2){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x1d')]({'active':![]},_0x3266c2,0x1))[_0xd81b('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0xd81b('0x20')]=function(_0x4e2eff){var _0x5c8aee={};_0x5c8aee[_0xd81b('0x21')]=_0x4e2eff[_0xd81b('0x21')];_0x5c8aee['uniqueid']=_0x4e2eff['uniqueid'];_0x5c8aee[_0xd81b('0x22')]=_0x4e2eff[_0xd81b('0x22')];_0x5c8aee[_0xd81b('0x23')]=_0x4e2eff[_0xd81b('0x23')];_0x5c8aee[_0xd81b('0x24')]=_0x4e2eff[_0xd81b('0x24')];_0x5c8aee['queuecallerjoinAt']=_0x4e2eff[_0xd81b('0x25')];_0x5c8aee[_0xd81b('0x26')]=_0x4e2eff['answertime'];_0x5c8aee['queuecallercomplete']=0x1;_0x5c8aee[_0xd81b('0x27')]=_0x4e2eff[_0xd81b('0x28')];_0x5c8aee['connectedlinename']=_0x4e2eff['membername'];_0x5c8aee['context']=_0xd81b('0x29');_0x5c8aee[_0xd81b('0x2a')]=_0xd81b('0x2b');_0x5c8aee[_0xd81b('0x2c')]=0x0;_0x5c8aee[_0xd81b('0x2d')]=0x1;_0x5c8aee[_0xd81b('0x2e')]=_0x4e2eff[_0xd81b('0x2f')];_0x5c8aee['queuecallerexitreason']=_0xd81b('0x30');return BPromise['resolve']()[_0xd81b('0xf')](voiceQueueReport[_0xd81b('0x31')](_0x5c8aee))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x32')));};exports[_0xd81b('0x33')]=function(_0x221e1f,_0x1c20d3){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x33')](_0x221e1f,_0x1c20d3))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x34')));};exports[_0xd81b('0x35')]=function(_0x57bc0c){return BPromise['resolve']()[_0xd81b('0xf')](cmHopper[_0xd81b('0x36')](_0x57bc0c,!![],!![]))[_0xd81b('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 19c096d..04b5d66 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 _0x2f42=['pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','dialQueueProject2','NONE','originatecalleridname','xcally-motion-preview','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','channelAgent','agentReadyId','not_inuse','status','getDiff','createBody','filterKey','type','campaigntype','dialAnswer','membername','callback','callbackuniqueid','callbackat','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,'];(function(_0x4b200b,_0xaec8e4){var _0x3eb184=function(_0x1fc784){while(--_0x1fc784){_0x4b200b['push'](_0x4b200b['shift']());}};_0x3eb184(++_0xaec8e4);}(_0x2f42,0x90));var _0x22f4=function(_0x540426,_0x11a968){_0x540426=_0x540426-0x0;var _0x216c3d=_0x2f42[_0x540426];return _0x216c3d;};'use strict';var util=require(_0x22f4('0x0'));var _=require(_0x22f4('0x1'));var moment=require(_0x22f4('0x2'));var logger=require('../../../../config/logger')(_0x22f4('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x22f4('0x4');function getSeconds(_0x56a457,_0x3e9104){var _0x458a9e=moment(_0x56a457)[_0x22f4('0x5')](0x0);var _0x386042=moment(_0x3e9104)[_0x22f4('0x5')](0x0);return _0x458a9e[_0x22f4('0x6')](_0x386042,_0x22f4('0x7'));}exports[_0x22f4('0x8')]=function(_0x31761f){return function(_0x5542f1){logger[_0x22f4('0x9')](_0x31761f,util[_0x22f4('0xa')](_0x5542f1,{'showHidden':![],'depth':null}));};};exports[_0x22f4('0xb')]=function(_0x7d4608,_0x3010aa){logger[_0x22f4('0xc')](_0x7d4608,util['inspect'](_0x3010aa,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4d977f,_0x25bd88){logger[_0x22f4('0x9')](_0x4d977f,util[_0x22f4('0xa')](_0x25bd88,{'showHidden':![],'depth':null}));};exports[_0x22f4('0xd')]=function(_0x5a6972){return function(_0x2317ef){logger[_0x22f4('0xc')](_0x5a6972,util[_0x22f4('0xa')](_0x2317ef,{'showHidden':![],'depth':null}));};};exports[_0x22f4('0xe')]=function(_0x4a0c3e,_0x314f97,_0x27dc54){return{'message':_0x4a0c3e,'unlock':_0x314f97,'active':_0x27dc54};};exports[_0x22f4('0xf')]=function(_0x4fed27,_0x2f6154,_0xf78a6f){if(!_[_0x22f4('0x10')](_0xf78a6f)&&_0x22f4('0x11')===typeof _0xf78a6f&&!_[_0x22f4('0x12')](_0xf78a6f)){if(!_[_0x22f4('0x10')](_0x2f6154)&&_0x22f4('0x11')===typeof _0x2f6154&&!_[_0x22f4('0x12')](_0x2f6154)){return util[_0x22f4('0x13')]('\x22%s\x22\x20<%s>',_0x2f6154,_0xf78a6f);}return util[_0x22f4('0x13')]('\x22%s\x22\x20<%s>',_0xf78a6f,_0xf78a6f);}if(!_[_0x22f4('0x10')](_0x4fed27)&&_0x22f4('0x11')===typeof _0x4fed27&&!_[_0x22f4('0x12')](_0x4fed27)){return _0x4fed27;}return _0x22f4('0x14');};exports[_0x22f4('0x15')]=function(_0x58f285){if(_[_0x22f4('0x16')](_0x58f285)){return![];}return _0x58f285;};exports[_0x22f4('0x17')]=function(_0x1ff42c,_0x18546,_0xc34489,_0x3c8c82,_0x968736,_0x2001a3){var _0x3ad672={'XMD-QUEUE':_0x18546[_0x22f4('0x18')]?_0x18546[_0x22f4('0x18')][_0x22f4('0x19')]:'','XMD-CALLERID':_0x3c8c82,'XMD-CALLERID-PREVIEW':_0x2001a3?util['format'](_0x22f4('0x1a'),_0x2001a3[_0x22f4('0x1b')],_0x2001a3[_0x22f4('0x1c')]):_0x3c8c82,'XMD-DIALID':_0x968736,'XMD-CONTACTID':_0x18546['ContactId'],'XMD-CDRTYPE':_0x22f4('0x1d'),'CALLERID(all)':_0x3c8c82,'XMD-VOICEQUEUEID':_0x18546[_0x22f4('0x1e')],'XMD-DIALCHANNEL':_0xc34489,'XMD-DIALTIMEOUT':_0x1ff42c[_0x22f4('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x22f4('0x13')]('\x22rtTxX%s%s\x22',_0x1ff42c['dialQueueProject2']?'g':'',_['isEmpty'](_0x1ff42c[_0x22f4('0x20')])?'':_0x22f4('0x21')),'XMD-DIALURL':_0x1ff42c['dialPreviewUrl']||'','XMD-AGI':_0x1ff42c['dialQueueProject']?util[_0x22f4('0x13')](_0x22f4('0x22'),ipAgi,_0x1ff42c[_0x22f4('0x23')]):'NONE','XMD-AGIAFTER':_0x1ff42c[_0x22f4('0x24')]?util[_0x22f4('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1ff42c[_0x22f4('0x24')]):_0x22f4('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2001a3?_0x2001a3['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2001a3?_0x2001a3[_0x22f4('0x26')]:'','XMD-DESTINATION':_0x22f4('0x27')};if(!_[_0x22f4('0x12')](_0x1ff42c['monitor_format'])){_0x3ad672[util[_0x22f4('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1ff42c[_0x22f4('0x20')];_0x3ad672[util[_0x22f4('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x968736;}if(_0x18546&&_0x18546[_0x22f4('0x28')]){for(var _0xd2b1cc in _0x18546[_0x22f4('0x28')]){if(_0x18546['Contact'][_0x22f4('0x29')](_0xd2b1cc)){if(!_[_0x22f4('0x16')](_0x18546['Contact'][_0xd2b1cc])&&_0xd2b1cc!=='id'&&_0xd2b1cc!==_0x22f4('0x2a')&&_0xd2b1cc!==_0x22f4('0x2b')&&_0xd2b1cc!==_0x22f4('0x2c')){_0x3ad672[util[_0x22f4('0x13')](_0x22f4('0x2d'),_0x22f4('0x2e'),_['toUpper'](_0xd2b1cc))]=_0x18546[_0x22f4('0x28')][_0xd2b1cc];}}}}return _0x3ad672;};exports[_0x22f4('0x2f')]=function(_0x237ad7){var _0x58f147={};for(var _0x2f0168 in _0x237ad7){if(_0x237ad7[_0x22f4('0x29')](_0x2f0168)){_0x58f147[util[_0x22f4('0x13')]('%s',_[_0x22f4('0x30')](_0x2f0168))]=_0x237ad7[_0x2f0168];}}return{'variables':_0x58f147};};exports[_0x22f4('0x31')]=function(_0x4ed035,_0x392dff){if(!_[_0x22f4('0x16')](_0x4ed035)){if(_0x4ed035['hasOwnProperty']('originated')){if(_0x4ed035['originated']>0x0){_0x4ed035[_0x22f4('0x32')]-=0x1;}else{logger[_0x22f4('0x9')](_0x22f4('0x33'),_0x392dff);}}}else{logger[_0x22f4('0x9')](_0x22f4('0x34'),_0x392dff);}};exports[_0x22f4('0x35')]=function(_0x16fb8b){var _0x3dd13c=moment()[_0x22f4('0x13')](_0x22f4('0x36'));_0x16fb8b[_0x22f4('0x37')]=0xd;_0x16fb8b[_0x22f4('0x38')]=_0x22f4('0x39');_0x16fb8b['starttime']=_0x3dd13c;_0x16fb8b[_0x22f4('0x3a')]=_0x3dd13c;_0x16fb8b[_0x22f4('0x3b')]=_0x3dd13c;};exports[_0x22f4('0x3c')]=function(_0x3729e5,_0x473eca,_0x22a6cc){var _0x39bb98=moment()[_0x22f4('0x13')](_0x22f4('0x36'));_0x3729e5[_0x22f4('0x37')]=_0x473eca;_0x3729e5[_0x22f4('0x38')]=_0x22a6cc;_0x3729e5[_0x22f4('0x3a')]=_0x39bb98;_0x3729e5[_0x22f4('0x3d')]=getSeconds(_0x3729e5[_0x22f4('0x3a')],_0x3729e5[_0x22f4('0x3e')]);};exports[_0x22f4('0x3f')]=function(_0x1318cf,_0x22b5ba,_0x2ae6eb){_0x1318cf['membername']=_0x22b5ba;_0x1318cf[_0x22f4('0x40')]=_0x2ae6eb;};exports[_0x22f4('0x41')]=function(_0x33c33b,_0x398a74,_0x4c54f9){var _0x4be80e=moment()[_0x22f4('0x13')](_0x22f4('0x36'));_0x33c33b[_0x22f4('0x37')]=_0x398a74;_0x33c33b['statedesc']=_0x4c54f9;_0x33c33b['responsetime']=_0x33c33b[_0x22f4('0x3a')]?_0x33c33b[_0x22f4('0x3a')]:_0x4be80e;_0x33c33b['endtime']=_0x33c33b[_0x22f4('0x3b')]?_0x33c33b[_0x22f4('0x3b')]:_0x4be80e;_0x33c33b['ringtime']=getSeconds(_0x33c33b[_0x22f4('0x3a')]||0x0,_0x33c33b[_0x22f4('0x3e')]||0x0);_0x33c33b['talktime']=_0x33c33b['answertime']?getSeconds(_0x33c33b[_0x22f4('0x3b')],_0x33c33b[_0x22f4('0x42')]):0x0;};exports[_0x22f4('0x43')]=function(_0x347f5a){return _0x347f5a===_0x22f4('0x44');};exports[_0x22f4('0x45')]=function(_0x894c9e,_0x2f5fc3,_0x1ed8bb,_0x32c957,_0x5324f1){var _0x2ab2ea=_0x32c957?_0x22f4('0x46'):_0x894c9e[_0x22f4('0x1b')];_0x2ab2ea=_0x5324f1?'BOOKED':_0x2ab2ea;return{'actionid':_0x894c9e[_0x22f4('0x47')],'action':'originate','channel':_0x894c9e['channelAgent'],'callerid':util[_0x22f4('0x13')](_0x22f4('0x1a'),_0x2ab2ea,_0x894c9e[_0x22f4('0x1c')]),'Exten':'xcally-motion-preview','Context':_0x22f4('0x48'),'Priority':'1','variable':_0x1ed8bb,'timeout':(_0x2f5fc3['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x894c9e[_0x22f4('0x47')]};};exports[_0x22f4('0x49')]=function(_0x2d8346){return _0x2d8346[_0x22f4('0x4a')]+_0x2d8346[_0x22f4('0x4b')]+_0x2d8346[_0x22f4('0x4c')];};exports[_0x22f4('0x4d')]=function(_0x52a7f4){var _0x1af610=_[_0x22f4('0x4e')](_0x52a7f4);_0x1af610[_0x22f4('0x37')]=0xf;_0x1af610[_0x22f4('0x38')]=_0x22f4('0x4f');return _0x1af610;};exports[_0x22f4('0x50')]=function(_0x215d0d,_0x2063bb,_0x3a10a5){var _0x3132ad={};_0x3132ad[_0x2063bb]=_0x215d0d[_0x2063bb];_0x3132ad[_0x22f4('0x51')]=![];_0x3132ad[_0x22f4('0x52')]=moment()[_0x22f4('0x53')](_0x3a10a5,_0x22f4('0x54'))[_0x22f4('0x13')](_0x22f4('0x36'));_0x3132ad[_0x22f4('0x55')]=_0x215d0d['ContactId'];_0x3132ad[_0x22f4('0x56')]=_0x215d0d[_0x22f4('0x56')];_0x3132ad[_0x22f4('0x1e')]=_0x215d0d[_0x22f4('0x1e')]||undefined;return _0x3132ad;};exports[_0x22f4('0x57')]=function(_0x3a8baf,_0xce1b23){if(!_[_0x22f4('0x16')](_0x3a8baf)){if(_0x3a8baf[_0x22f4('0x58')]>0x0){_0x3a8baf[_0x22f4('0x58')]-=0x1;}else{logger['error'](_0xce1b23,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x22f4('0x9')](_0xce1b23,_0x22f4('0x59'));}};exports['IsNotLoggedIn']=function(_0x4b3793){if(_0x4b3793<=0x0){return!![];}return![];};exports[_0x22f4('0x5a')]=function(_0x80e0ac,_0xaee4e4){_0x80e0ac[_0x22f4('0x5b')]=_0xaee4e4;_0x80e0ac[_0x22f4('0x19')]=_0x80e0ac[_0x22f4('0x5c')];_0x80e0ac[_0x22f4('0x5d')]=_0x80e0ac[_0x22f4('0x5e')];return _0x80e0ac;};exports['buildAcw']=function(_0x504a1e){var _0x93998d={};_0x93998d[_0x22f4('0x5c')]=_0x504a1e['queue'];_0x93998d['interface']=_0x504a1e[_0x22f4('0x5e')];_0x93998d['uniqueid']=_0x504a1e['uniqueid'];return _0x93998d;};exports[_0x22f4('0x5f')]=function(_0x4bee14){var _0x2108d6=[];for(var _0x5f4655 in _0x4bee14){if(_0x4bee14[_0x22f4('0x29')](_0x5f4655)){if(!_[_0x22f4('0x16')](_0x4bee14[_0x5f4655])&&_0x4bee14[_0x5f4655]['state']===_0x22f4('0x60')&&_0x4bee14[_0x5f4655][_0x22f4('0x61')]==='reachable'){_0x2108d6['push'](_0x4bee14[_0x5f4655]['id']);}}}return _0x2108d6;};exports[_0x22f4('0x62')]=function(_0xfe15d){var _0x15d907=moment()[_0x22f4('0x5')](0x0);var _0x58edb0=moment(_0xfe15d)[_0x22f4('0x5')](0x0);return _0x15d907[_0x22f4('0x6')](_0x58edb0,_0x22f4('0x7'));};exports[_0x22f4('0x63')]=function(_0x3c40a7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c40a7[_0x22f4('0x55')],'ListId':_0x3c40a7[_0x22f4('0x56')],'VoiceQueueId':_0x3c40a7['VoiceQueueId']||undefined,'CampaignId':_0x3c40a7['CampaignId']||undefined};};exports[_0x22f4('0x64')]=function(_0x8d1315){if(_0x8d1315===_0x22f4('0x47')||_0x8d1315==='idContact'||_0x8d1315===_0x22f4('0x5c')||_0x8d1315===_0x22f4('0x65')||_0x8d1315===_0x22f4('0x66')||_0x8d1315===_0x22f4('0x67')||_0x8d1315===_0x22f4('0x68')||_0x8d1315==='channelAgent'||_0x8d1315===_0x22f4('0x1b')||_0x8d1315===_0x22f4('0x51')||_0x8d1315===_0x22f4('0x1c')||_0x8d1315==='scheduledat'||_0x8d1315===_0x22f4('0x4a')||_0x8d1315===_0x22f4('0x4b')||_0x8d1315===_0x22f4('0x4c')||_0x8d1315==='countglobal'||_0x8d1315===_0x22f4('0x69')||_0x8d1315===_0x22f4('0x6a')||_0x8d1315===_0x22f4('0x6b')||_0x8d1315==='recallme'||_0x8d1315==='ContactId'||_0x8d1315==='ListId'||_0x8d1315===_0x22f4('0x40')||_0x8d1315==='VoiceQueueId'||_0x8d1315==='sipcallid'||_0x8d1315==='xmd-voicequeueid'||_0x8d1315===_0x22f4('0x6c')||_0x8d1315==='xmd-phone'||_0x8d1315===_0x22f4('0x6d')||_0x8d1315===_0x22f4('0x6e')||_0x8d1315===_0x22f4('0x6f')||_0x8d1315===_0x22f4('0x70')||_0x8d1315===_0x22f4('0x71')||_0x8d1315===_0x22f4('0x72')||_0x8d1315===_0x22f4('0x73')||_0x8d1315===_0x22f4('0x74')||_0x8d1315===_0x22f4('0x75')||_0x8d1315===_0x22f4('0x76')||_0x8d1315===_0x22f4('0x77')||_0x8d1315===_0x22f4('0x78')||_0x8d1315===_0x22f4('0x79')||_0x8d1315===_0x22f4('0x7a')||_0x8d1315===_0x22f4('0x7b')||_0x8d1315===_0x22f4('0x7c')||_0x8d1315==='rtpaudioqoslossbridged'||_0x8d1315===_0x22f4('0x7d')||_0x8d1315===_0x22f4('0x7e')||_0x8d1315===_0x22f4('0x78')||_0x8d1315===_0x22f4('0x79')||_0x8d1315==='rtpaudioqosjitter'||_0x8d1315===_0x22f4('0x7b')||_0x8d1315===_0x22f4('0x7c')||_0x8d1315===_0x22f4('0x7f')||_0x8d1315===_0x22f4('0x7d')||_0x8d1315==='rtpaudioqosrttbridged'||_0x8d1315===_0x22f4('0x80')||_0x8d1315===_0x22f4('0x81')||_0x8d1315===_0x22f4('0x37')||_0x8d1315===_0x22f4('0x38')){return![];}return!![];};exports[_0x22f4('0x82')]=function(_0x480d54,_0x2b2e66){var _0x97a5c6,_0x9e1c5c,_0x463503;if(_0x2b2e66<=0x0){_0x2b2e66=0x1;}_0x97a5c6=new RegExp(_0x22f4('0x83')+_0x2b2e66+'}$');_0x9e1c5c=Math[_0x22f4('0x84')](0xa,_0x2b2e66-0x1);_0x463503=Math['pow'](0xa,_0x2b2e66)-0x1;return util['format']('%s',_[_0x22f4('0x85')](_0x480d54,_0x97a5c6,_[_0x22f4('0x86')](_0x9e1c5c,_0x463503)));};exports[_0x22f4('0x87')]=function(_0x43e2cf){var _0x5c6420=_0x43e2cf[_0x22f4('0x88')](/"(.*?)"/);return _0x5c6420?_0x5c6420[0x1]:_0x43e2cf;};exports[_0x22f4('0x89')]=function(_0xb53e29){var _0x1f5405=_0xb53e29[_0x22f4('0x88')](/<(.*?)>/);return _0x1f5405?_0x1f5405[0x1]:_0xb53e29;}; \ No newline at end of file +var _0xcc36=['rtpaudioqosrtt','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','inspect','loggerError','logger2','info','getCallerId','isUndefined','\x22%s\x22\x20<%s>','format','string','isActive','isNil','addVariables','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','isEmpty','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','membername','UserId','endtime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','scheduledAt','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','interface','buildAcw','queue','agentReadyId','not_inuse','status','push','getDiff','createBody','type','campaigntype','active','scheduledat','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x7750c9,_0x205ccc){var _0x57f2c0=function(_0x2bfc70){while(--_0x2bfc70){_0x7750c9['push'](_0x7750c9['shift']());}};_0x57f2c0(++_0x205ccc);}(_0xcc36,0x1a6));var _0x6cc3=function(_0x45373d,_0x226aa4){_0x45373d=_0x45373d-0x0;var _0x21d0cc=_0xcc36[_0x45373d];return _0x21d0cc;};'use strict';var util=require(_0x6cc3('0x0'));var _=require(_0x6cc3('0x1'));var moment=require(_0x6cc3('0x2'));var logger=require(_0x6cc3('0x3'))(_0x6cc3('0x4'));var ipAgi=process[_0x6cc3('0x5')][_0x6cc3('0x6')]||_0x6cc3('0x7');function getSeconds(_0x2bdf95,_0x284916){var _0x5c0b79=moment(_0x2bdf95)[_0x6cc3('0x8')](0x0);var _0x3da831=moment(_0x284916)['milliseconds'](0x0);return _0x5c0b79[_0x6cc3('0x9')](_0x3da831,_0x6cc3('0xa'));}exports['loggerCatch']=function(_0x1e9dda){return function(_0x39abe2){logger[_0x6cc3('0xb')](_0x1e9dda,util['inspect'](_0x39abe2,{'showHidden':![],'depth':null}));};};exports[_0x6cc3('0xc')]=function(_0x2e713e,_0x549e4a){logger['info'](_0x2e713e,util[_0x6cc3('0xd')](_0x549e4a,{'showHidden':![],'depth':null}));};exports[_0x6cc3('0xe')]=function(_0x4d5a14,_0x7a0c6e){logger['error'](_0x4d5a14,util[_0x6cc3('0xd')](_0x7a0c6e,{'showHidden':![],'depth':null}));};exports[_0x6cc3('0xf')]=function(_0x590351){return function(_0x4d49ba){logger[_0x6cc3('0x10')](_0x590351,util[_0x6cc3('0xd')](_0x4d49ba,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x54ec85,_0x1f8c2d,_0x32bb1a){return{'message':_0x54ec85,'unlock':_0x1f8c2d,'active':_0x32bb1a};};exports[_0x6cc3('0x11')]=function(_0x1fe7f6,_0x4d29ac,_0x160370){if(!_[_0x6cc3('0x12')](_0x160370)&&'string'===typeof _0x160370&&!_['isEmpty'](_0x160370)){if(!_[_0x6cc3('0x12')](_0x4d29ac)&&'string'===typeof _0x4d29ac&&!_['isEmpty'](_0x4d29ac)){return util['format'](_0x6cc3('0x13'),_0x4d29ac,_0x160370);}return util[_0x6cc3('0x14')](_0x6cc3('0x13'),_0x160370,_0x160370);}if(!_['isUndefined'](_0x1fe7f6)&&_0x6cc3('0x15')===typeof _0x1fe7f6&&!_['isEmpty'](_0x1fe7f6)){return _0x1fe7f6;}return'\x22\x22\x20<>';};exports[_0x6cc3('0x16')]=function(_0x4a5564){if(_[_0x6cc3('0x17')](_0x4a5564)){return![];}return _0x4a5564;};exports[_0x6cc3('0x18')]=function(_0x59352b,_0x2e0c72,_0x4c250d,_0x3608f7,_0x1bd90d,_0x4bbac5){var _0x27d02f={'XMD-QUEUE':_0x2e0c72['Queue']?_0x2e0c72['Queue'][_0x6cc3('0x19')]:'','XMD-CALLERID':_0x3608f7,'XMD-CALLERID-PREVIEW':_0x4bbac5?util['format'](_0x6cc3('0x13'),_0x4bbac5[_0x6cc3('0x1a')],_0x4bbac5[_0x6cc3('0x1b')]):_0x3608f7,'XMD-DIALID':_0x1bd90d,'XMD-CONTACTID':_0x2e0c72[_0x6cc3('0x1c')],'XMD-CDRTYPE':_0x6cc3('0x1d'),'CALLERID(all)':_0x3608f7,'XMD-VOICEQUEUEID':_0x2e0c72[_0x6cc3('0x1e')],'XMD-DIALCHANNEL':_0x4c250d,'XMD-DIALTIMEOUT':_0x59352b[_0x6cc3('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x6cc3('0x20'),_0x59352b[_0x6cc3('0x21')]?'g':'',_[_0x6cc3('0x22')](_0x59352b[_0x6cc3('0x23')])?'':_0x6cc3('0x24')),'XMD-DIALURL':_0x59352b[_0x6cc3('0x25')]||'','XMD-AGI':_0x59352b[_0x6cc3('0x26')]?util['format'](_0x6cc3('0x27'),ipAgi,_0x59352b['dialQueueProject']):_0x6cc3('0x28'),'XMD-AGIAFTER':_0x59352b[_0x6cc3('0x21')]?util['format'](_0x6cc3('0x27'),ipAgi,_0x59352b[_0x6cc3('0x21')]):_0x6cc3('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x4bbac5?_0x4bbac5['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4bbac5?_0x4bbac5[_0x6cc3('0x29')]:'','XMD-DESTINATION':_0x6cc3('0x2a')};if(!_[_0x6cc3('0x22')](_0x59352b['monitor_format'])){_0x27d02f[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x59352b['monitor_format'];_0x27d02f[util['format']('%s',_0x6cc3('0x2b'))]=_0x1bd90d;}if(_0x2e0c72&&_0x2e0c72[_0x6cc3('0x2c')]){for(var _0x6ea64 in _0x2e0c72[_0x6cc3('0x2c')]){if(_0x2e0c72[_0x6cc3('0x2c')]['hasOwnProperty'](_0x6ea64)){if(!_['isNil'](_0x2e0c72[_0x6cc3('0x2c')][_0x6ea64])&&_0x6ea64!=='id'&&_0x6ea64!==_0x6cc3('0x2d')&&_0x6ea64!==_0x6cc3('0x2e')&&_0x6ea64!==_0x6cc3('0x2f')){_0x27d02f[util[_0x6cc3('0x14')](_0x6cc3('0x30'),_0x6cc3('0x31'),_[_0x6cc3('0x32')](_0x6ea64))]=_0x2e0c72[_0x6cc3('0x2c')][_0x6ea64];}}}}return _0x27d02f;};exports[_0x6cc3('0x33')]=function(_0x45f666){var _0x2ffaf9={};for(var _0x47ae6e in _0x45f666){if(_0x45f666[_0x6cc3('0x34')](_0x47ae6e)){_0x2ffaf9[util[_0x6cc3('0x14')]('%s',_[_0x6cc3('0x35')](_0x47ae6e))]=_0x45f666[_0x47ae6e];}}return{'variables':_0x2ffaf9};};exports[_0x6cc3('0x36')]=function(_0x388897,_0x4d72c6){if(!_['isNil'](_0x388897)){if(_0x388897['hasOwnProperty']('originated')){if(_0x388897['originated']>0x0){_0x388897[_0x6cc3('0x37')]-=0x1;}else{logger[_0x6cc3('0xb')](_0x6cc3('0x38'),_0x4d72c6);}}}else{logger[_0x6cc3('0xb')](_0x6cc3('0x39'),_0x4d72c6);}};exports[_0x6cc3('0x3a')]=function(_0x9a52b9){var _0x37cb87=moment()[_0x6cc3('0x14')](_0x6cc3('0x3b'));_0x9a52b9[_0x6cc3('0x3c')]=0xd;_0x9a52b9[_0x6cc3('0x3d')]=_0x6cc3('0x3e');_0x9a52b9[_0x6cc3('0x3f')]=_0x37cb87;_0x9a52b9[_0x6cc3('0x40')]=_0x37cb87;_0x9a52b9['endtime']=_0x37cb87;};exports[_0x6cc3('0x41')]=function(_0x533972,_0x3c9e89,_0x2ad172){var _0x552ab5=moment()['format'](_0x6cc3('0x3b'));_0x533972['state']=_0x3c9e89;_0x533972['statedesc']=_0x2ad172;_0x533972[_0x6cc3('0x40')]=_0x552ab5;_0x533972[_0x6cc3('0x42')]=getSeconds(_0x533972['responsetime'],_0x533972['starttime']);};exports['logLookAgent']=function(_0x9855cf,_0x1f004d,_0xb10f03){_0x9855cf[_0x6cc3('0x43')]=_0x1f004d;_0x9855cf[_0x6cc3('0x44')]=_0xb10f03;};exports['logCustomer']=function(_0x4eb494,_0x5e12d6,_0x3dbdb9){var _0x3e2c91=moment()[_0x6cc3('0x14')](_0x6cc3('0x3b'));_0x4eb494[_0x6cc3('0x3c')]=_0x5e12d6;_0x4eb494[_0x6cc3('0x3d')]=_0x3dbdb9;_0x4eb494[_0x6cc3('0x40')]=_0x4eb494[_0x6cc3('0x40')]?_0x4eb494[_0x6cc3('0x40')]:_0x3e2c91;_0x4eb494[_0x6cc3('0x45')]=_0x4eb494[_0x6cc3('0x45')]?_0x4eb494[_0x6cc3('0x45')]:_0x3e2c91;_0x4eb494['ringtime']=getSeconds(_0x4eb494[_0x6cc3('0x40')]||0x0,_0x4eb494[_0x6cc3('0x3f')]||0x0);_0x4eb494['talktime']=_0x4eb494[_0x6cc3('0x46')]?getSeconds(_0x4eb494[_0x6cc3('0x45')],_0x4eb494[_0x6cc3('0x46')]):0x0;};exports[_0x6cc3('0x47')]=function(_0x5b9fe4){return _0x5b9fe4===_0x6cc3('0x48');};exports[_0x6cc3('0x49')]=function(_0x26f465,_0x3215d3,_0x375f2f,_0x33d561,_0x4f028c){var _0x444852=_0x33d561?_0x6cc3('0x4a'):_0x26f465[_0x6cc3('0x1a')];_0x444852=_0x4f028c?_0x6cc3('0x4b'):_0x444852;return{'actionid':_0x26f465[_0x6cc3('0x4c')],'action':_0x6cc3('0x4d'),'channel':_0x26f465[_0x6cc3('0x4e')],'callerid':util['format'](_0x6cc3('0x13'),_0x444852,_0x26f465[_0x6cc3('0x1b')]),'Exten':_0x6cc3('0x2a'),'Context':_0x6cc3('0x4f'),'Priority':'1','variable':_0x375f2f,'timeout':(_0x3215d3['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x26f465['uniqueid']};};exports[_0x6cc3('0x50')]=function(_0x32af63){return _0x32af63[_0x6cc3('0x51')]+_0x32af63[_0x6cc3('0x52')]+_0x32af63[_0x6cc3('0x53')];};exports['cloneAction']=function(_0x42d582){var _0x284fa7=_['clone'](_0x42d582);_0x284fa7[_0x6cc3('0x3c')]=0xf;_0x284fa7['statedesc']='Global';return _0x284fa7;};exports[_0x6cc3('0x54')]=function(_0xf08c9a,_0x3bd24f,_0x44931d){var _0x160744={};_0x160744[_0x3bd24f]=_0xf08c9a[_0x3bd24f];_0x160744['active']=![];_0x160744['scheduledat']=moment()[_0x6cc3('0x55')](_0x44931d,_0x6cc3('0x56'))[_0x6cc3('0x14')](_0x6cc3('0x3b'));_0x160744[_0x6cc3('0x1c')]=_0xf08c9a[_0x6cc3('0x1c')];_0x160744[_0x6cc3('0x57')]=_0xf08c9a[_0x6cc3('0x57')];_0x160744[_0x6cc3('0x1e')]=_0xf08c9a[_0x6cc3('0x1e')]||undefined;return _0x160744;};exports[_0x6cc3('0x58')]=function(_0x37d87f,_0x6464b2){if(!_['isNil'](_0x37d87f)){if(_0x37d87f[_0x6cc3('0x59')]>0x0){_0x37d87f[_0x6cc3('0x59')]-=0x1;}else{logger[_0x6cc3('0xb')](_0x6464b2,_0x6cc3('0x5a'));}}else{logger[_0x6cc3('0xb')](_0x6464b2,_0x6cc3('0x5b'));}};exports['IsNotLoggedIn']=function(_0x47c6b1){if(_0x47c6b1<=0x0){return!![];}return![];};exports[_0x6cc3('0x5c')]=function(_0x48af22,_0xe78c41){_0x48af22[_0x6cc3('0x5d')]=_0xe78c41;_0x48af22[_0x6cc3('0x19')]=_0x48af22['queue'];_0x48af22[_0x6cc3('0x5e')]=_0x48af22['channelAgent'];return _0x48af22;};exports[_0x6cc3('0x5f')]=function(_0x155ca2){var _0x1ab39c={};_0x1ab39c[_0x6cc3('0x60')]=_0x155ca2[_0x6cc3('0x60')];_0x1ab39c[_0x6cc3('0x5e')]=_0x155ca2['channelAgent'];_0x1ab39c[_0x6cc3('0x4c')]=_0x155ca2[_0x6cc3('0x4c')];return _0x1ab39c;};exports[_0x6cc3('0x61')]=function(_0x33399f){var _0x47dba5=[];for(var _0x4df218 in _0x33399f){if(_0x33399f[_0x6cc3('0x34')](_0x4df218)){if(!_[_0x6cc3('0x17')](_0x33399f[_0x4df218])&&_0x33399f[_0x4df218][_0x6cc3('0x3c')]===_0x6cc3('0x62')&&_0x33399f[_0x4df218][_0x6cc3('0x63')]==='reachable'){_0x47dba5[_0x6cc3('0x64')](_0x33399f[_0x4df218]['id']);}}}return _0x47dba5;};exports[_0x6cc3('0x65')]=function(_0x39eabe){var _0x4b906d=moment()[_0x6cc3('0x8')](0x0);var _0x49bc91=moment(_0x39eabe)['milliseconds'](0x0);return _0x4b906d[_0x6cc3('0x9')](_0x49bc91,_0x6cc3('0xa'));};exports[_0x6cc3('0x66')]=function(_0x5bda74){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5bda74[_0x6cc3('0x1c')],'ListId':_0x5bda74[_0x6cc3('0x57')],'VoiceQueueId':_0x5bda74['VoiceQueueId']||undefined,'CampaignId':_0x5bda74['CampaignId']||undefined};};exports['filterKey']=function(_0xf85622){if(_0xf85622===_0x6cc3('0x4c')||_0xf85622==='idContact'||_0xf85622===_0x6cc3('0x60')||_0xf85622===_0x6cc3('0x67')||_0xf85622===_0x6cc3('0x68')||_0xf85622==='dialAnswer'||_0xf85622==='membername'||_0xf85622===_0x6cc3('0x4e')||_0xf85622==='calleridname'||_0xf85622===_0x6cc3('0x69')||_0xf85622==='calleridnum'||_0xf85622===_0x6cc3('0x6a')||_0xf85622===_0x6cc3('0x51')||_0xf85622==='countcongestionretry'||_0xf85622==='countnoanswerretry'||_0xf85622===_0x6cc3('0x6b')||_0xf85622==='callback'||_0xf85622===_0x6cc3('0x6c')||_0xf85622===_0x6cc3('0x6d')||_0xf85622===_0x6cc3('0x6e')||_0xf85622===_0x6cc3('0x1c')||_0xf85622==='ListId'||_0xf85622===_0x6cc3('0x44')||_0xf85622===_0x6cc3('0x1e')||_0xf85622===_0x6cc3('0x6f')||_0xf85622===_0x6cc3('0x70')||_0xf85622===_0x6cc3('0x71')||_0xf85622==='xmd-phone'||_0xf85622===_0x6cc3('0x72')||_0xf85622===_0x6cc3('0x73')||_0xf85622===_0x6cc3('0x74')||_0xf85622===_0x6cc3('0x75')||_0xf85622==='xmd-dialid'||_0xf85622===_0x6cc3('0x76')||_0xf85622===_0x6cc3('0x77')||_0xf85622==='xmd-cdrtype'||_0xf85622==='xmd-callerid'||_0xf85622===_0x6cc3('0x78')||_0xf85622===_0x6cc3('0x79')||_0xf85622===_0x6cc3('0x7a')||_0xf85622===_0x6cc3('0x7b')||_0xf85622==='rtpaudioqosjitter'||_0xf85622==='rtpaudioqosjitterbridged'||_0xf85622===_0x6cc3('0x7c')||_0xf85622===_0x6cc3('0x7d')||_0xf85622===_0x6cc3('0x7e')||_0xf85622==='rtpaudioqosrttbridged'||_0xf85622===_0x6cc3('0x7a')||_0xf85622===_0x6cc3('0x7b')||_0xf85622==='rtpaudioqosjitter'||_0xf85622===_0x6cc3('0x7f')||_0xf85622===_0x6cc3('0x7c')||_0xf85622===_0x6cc3('0x7d')||_0xf85622===_0x6cc3('0x7e')||_0xf85622===_0x6cc3('0x80')||_0xf85622===_0x6cc3('0x81')||_0xf85622===_0x6cc3('0x82')||_0xf85622==='state'||_0xf85622===_0x6cc3('0x3d')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x54b88b,_0x51eda7){var _0x41b228,_0x4ab20f,_0x5ea029;if(_0x51eda7<=0x0){_0x51eda7=0x1;}_0x41b228=new RegExp(_0x6cc3('0x83')+_0x51eda7+'}$');_0x4ab20f=Math[_0x6cc3('0x84')](0xa,_0x51eda7-0x1);_0x5ea029=Math[_0x6cc3('0x84')](0xa,_0x51eda7)-0x1;return util[_0x6cc3('0x14')]('%s',_['replace'](_0x54b88b,_0x41b228,_[_0x6cc3('0x85')](_0x4ab20f,_0x5ea029)));};exports[_0x6cc3('0x86')]=function(_0x587c8f){var _0x30e07e=_0x587c8f[_0x6cc3('0x87')](/"(.*?)"/);return _0x30e07e?_0x30e07e[0x1]:_0x587c8f;};exports[_0x6cc3('0x88')]=function(_0x42b510){var _0x4afe41=_0x42b510[_0x6cc3('0x87')](/<(.*?)>/);return _0x4afe41?_0x4afe41[0x1]:_0x42b510;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5238cc5..3b27201 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x380ba4,_0x3cb1a){var _0x55479f=function(_0x162d99){while(--_0x162d99){_0x380ba4['push'](_0x380ba4['shift']());}};_0x55479f(++_0x3cb1a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x411778,_0x524eed){_0x411778=_0x411778-0x0;var _0x8f616=_0x5f2f[_0x411778];return _0x8f616;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4f5e96,_0x3ddaf7){var _0xf88595=function(_0x4467ea){while(--_0x4467ea){_0x4f5e96['push'](_0x4f5e96['shift']());}};_0xf88595(++_0x3ddaf7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15e3a0,_0x5f251d){_0x15e3a0=_0x15e3a0-0x0;var _0x846b24=_0x5f2f[_0x15e3a0];return _0x846b24;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index af69ca9..d39fec1 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 _0xdec7=['../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','total','sumDuration','ivrAnswerCallsDay','isEmpty','unmanaged','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','format','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallerjoinAt','queuecallercomplete','answered','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','initVoiceExtensions','merge','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdec7,0x129));var _0x7dec=function(_0x2419f5,_0x5babca){_0x2419f5=_0x2419f5-0x0;var _0x2d9bd3=_0xdec7[_0x2419f5];return _0x2d9bd3;};'use strict';var BPromise=require(_0x7dec('0x0'));var util=require(_0x7dec('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x7dec('0x2'));var Telephone=require(_0x7dec('0x3'));var Trunk=require(_0x7dec('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x7dec('0x5'));var Campaign=require(_0x7dec('0x6'));var VoiceExtension=require(_0x7dec('0x7'));var ZendeskAccount=require(_0x7dec('0x8'));var SalesforceAccount=require(_0x7dec('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x7dec('0xa'));var DeskAccount=require(_0x7dec('0xb'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x7dec('0xc'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x7dec('0xd'));var Realtime=function(){this[_0x7dec('0xe')]={};this[_0x7dec('0xf')]={};this[_0x7dec('0x10')]={};this['voiceQueues']={};this[_0x7dec('0x11')]={};this[_0x7dec('0x12')]={};this[_0x7dec('0x13')]={};this[_0x7dec('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7dec('0x15')]={};this[_0x7dec('0x16')]={};this[_0x7dec('0x17')]={};this[_0x7dec('0x18')]={};this[_0x7dec('0x19')]={};this[_0x7dec('0x1a')]={};this[_0x7dec('0x1b')]={};this['sugarcrmAccounts']={};this[_0x7dec('0x1c')]={};this[_0x7dec('0x1d')]={};this[_0x7dec('0x1e')]={};this[_0x7dec('0x1f')]={};this[_0x7dec('0x20')]={};this[_0x7dec('0x21')]={};this[_0x7dec('0x22')]={};this[_0x7dec('0x23')]={};};function freeIsNotKey(_0x17ac25,_0x80414d,_0x38f022){var _0xb188af=_[_0x7dec('0x24')](_0x17ac25,function(_0x12c481,_0x43f2db){return _0x12c481[_0x38f022];});for(var _0x249a86 in _0x80414d){if(_0x80414d[_0x7dec('0x25')](_0x249a86)){if(!_0xb188af[_0x249a86]){delete _0x80414d[_0x249a86];}}}}function freeIsNotKeySip(_0x7cbfd7,_0x464a04){var _0x370706=_[_0x7dec('0x24')](_0x7cbfd7,function(_0x1f3584,_0x331903){return util['format'](_0x7dec('0x26'),_0x1f3584[_0x7dec('0x27')]);});for(var _0x55ce20 in _0x464a04){if(_0x464a04[_0x7dec('0x25')](_0x55ce20)){if(!_0x370706[_0x55ce20]){delete _0x464a04[_0x55ce20];}}}}function freeIsNotKeyAgent(_0x362b93,_0x500be5){var _0x26a5f0=_[_0x7dec('0x24')](_0x362b93,function(_0x16450a,_0xc485b9){var _0x5a430b=_[_0x7dec('0x28')](_0x16450a[_0x7dec('0x29')])?util['format']('SIP/%s',_0x16450a[_0x7dec('0x27')]):_0x16450a[_0x7dec('0x29')];return _0x5a430b;});for(var _0x3b64e2 in _0x500be5){if(_0x500be5[_0x7dec('0x25')](_0x3b64e2)){if(!_0x26a5f0[_0x3b64e2]){delete _0x500be5[_0x3b64e2];}}}}function clearVoiceCallReports(_0x247c5b){_0x247c5b[_0x7dec('0x2a')]=0x0;_0x247c5b['answered']=0x0;_0x247c5b['sumHoldTime']=0x0;_0x247c5b[_0x7dec('0x2b')]=0x0;_0x247c5b['sumBillable']=0x0;}function clearCampaigns(_0x1ae3ef){if(!_['isEmpty'](_0x1ae3ef)){for(var _0x4b8bd3 in _0x1ae3ef){if(_0x1ae3ef[_0x7dec('0x25')](_0x4b8bd3)){_0x1ae3ef[_0x4b8bd3]['ivrTotalCallsDays']=0x0;_0x1ae3ef[_0x4b8bd3][_0x7dec('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x3c8ed7){if(!_[_0x7dec('0x2d')](_0x3c8ed7)){for(var _0x20a384 in _0x3c8ed7){if(_0x3c8ed7[_0x7dec('0x25')](_0x20a384)){_0x3c8ed7[_0x20a384]['total']=0x0;_0x3c8ed7[_0x20a384]['answered']=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x2e')]=0x0;_0x3c8ed7[_0x20a384]['abandoned']=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x2f')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x2b')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x30')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x31')]=0x0;_0x3c8ed7[_0x20a384]['outboundNoAnswerCallsDay']=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x32')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x33')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x34')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x35')]=0x0;_0x3c8ed7[_0x20a384]['outboundDropCallsDayTimeout']=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x36')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x37')]=0x0;_0x3c8ed7[_0x20a384]['outboundOriginateFailureCallsDay']=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x38')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x39')]=0x0;_0x3c8ed7[_0x20a384]['outboundAnswerAgiCallsDay']=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x3a')]=0x0;_0x3c8ed7[_0x20a384][_0x7dec('0x3b')]=!![];}}}}Realtime[_0x7dec('0x3c')][_0x7dec('0x3d')]=function(_0x5c40fa,_0x38f36c){for(var _0x24cb1a in _0x38f36c){if(_0x5c40fa[_0x7dec('0x25')](_0x24cb1a)){_0x5c40fa[_0x24cb1a]=_0x38f36c[_0x24cb1a];}}};Realtime[_0x7dec('0x3c')]['initAgents']=function(){var _0x26d821=this;return function(_0x82bb97){if(_0x82bb97){freeIsNotKeyAgent(_0x82bb97,_0x26d821[_0x7dec('0xe')]);for(var _0x25366d=0x0,_0x2188f2={},_0x2bb862={};_0x25366d<_0x82bb97['length'];_0x25366d+=0x1){_0x2188f2=_0x82bb97[_0x25366d];var _0x16a17f=_[_0x7dec('0x28')](_0x2188f2[_0x7dec('0x29')])?util[_0x7dec('0x3e')]('SIP/%s',_0x2188f2[_0x7dec('0x27')]):_0x2188f2[_0x7dec('0x29')];if(_[_0x7dec('0x3f')](_0x26d821[_0x7dec('0xe')][_0x16a17f])){_0x26d821[_0x7dec('0xe')][_0x16a17f]=new Agent(_0x2188f2);}else{_0x26d821[_0x7dec('0x3d')](_0x26d821[_0x7dec('0xe')][_0x16a17f],_0x2188f2);}}}return _0x26d821[_0x7dec('0xe')];};};Realtime['prototype'][_0x7dec('0x40')]=function(){var _0x451c44=this;return function(_0xff70dd){if(_0xff70dd){freeIsNotKeySip(_0xff70dd,_0x451c44[_0x7dec('0xf')]);for(var _0x440f35=0x0,_0x2424a={},_0x4d80e8={};_0x440f35<_0xff70dd[_0x7dec('0x41')];_0x440f35+=0x1){_0x2424a=_0xff70dd[_0x440f35];if(_[_0x7dec('0x3f')](_0x451c44[_0x7dec('0xf')][util['format'](_0x7dec('0x26'),_0x2424a[_0x7dec('0x27')])])){_0x451c44[_0x7dec('0xf')][util['format'](_0x7dec('0x26'),_0x2424a[_0x7dec('0x27')])]=new Telephone(_0x2424a);}else{_0x451c44['mergeFromDatabase'](_0x451c44[_0x7dec('0xf')][util[_0x7dec('0x3e')]('SIP/%s',_0x2424a[_0x7dec('0x27')])],_0x2424a);}}}return _0x451c44[_0x7dec('0xf')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x42')]=function(){var _0x491d49=this;return function(_0x2bbb86){if(_0x2bbb86){freeIsNotKeySip(_0x2bbb86,_0x491d49['trunks']);for(var _0x17ed95=0x0,_0x53e84c={},_0x31c430={};_0x17ed95<_0x2bbb86['length'];_0x17ed95+=0x1){_0x53e84c=_0x2bbb86[_0x17ed95];if(_[_0x7dec('0x3f')](_0x491d49[_0x7dec('0x10')][util['format'](_0x7dec('0x26'),_0x53e84c[_0x7dec('0x27')])])){_0x491d49['trunks'][util[_0x7dec('0x3e')](_0x7dec('0x26'),_0x53e84c[_0x7dec('0x27')])]=new Trunk(_0x53e84c);}else{_0x491d49[_0x7dec('0x3d')](_0x491d49[_0x7dec('0x10')][util[_0x7dec('0x3e')](_0x7dec('0x26'),_0x53e84c[_0x7dec('0x27')])],_0x53e84c);}}}return _0x491d49['trunks'];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x43')]=function(){var _0xb66cee=this;return function(_0x478be0){if(_0x478be0){freeIsNotKey(_0x478be0,_0xb66cee['voiceQueues'],_0x7dec('0x27'));for(var _0x148b16=0x0,_0x329d3b={},_0x358944={};_0x148b16<_0x478be0[_0x7dec('0x41')];_0x148b16+=0x1){_0x329d3b=_0x478be0[_0x148b16];if(_[_0x7dec('0x3f')](_0xb66cee[_0x7dec('0x44')][_0x329d3b[_0x7dec('0x27')]])){_0xb66cee[_0x7dec('0x44')][_0x329d3b['name']]=new VoiceQueue(_0x329d3b);}else{_0xb66cee[_0x7dec('0x3d')](_0xb66cee[_0x7dec('0x44')][_0x329d3b[_0x7dec('0x27')]],_0x329d3b);}}}return _0xb66cee[_0x7dec('0x44')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x45')]=function(){var _0x1a166a=this;return function(_0x2cb276){if(_0x2cb276){freeIsNotKey(_0x2cb276,_0x1a166a[_0x7dec('0x11')],'id');for(var _0x3ae81c=0x0,_0x554ae9={},_0x566a11={};_0x3ae81c<_0x2cb276[_0x7dec('0x41')];_0x3ae81c+=0x1){_0x554ae9=_0x2cb276[_0x3ae81c];if(_[_0x7dec('0x3f')](_0x1a166a[_0x7dec('0x11')][_0x554ae9['id']])){_0x1a166a[_0x7dec('0x11')][_0x554ae9['id']]=new Trigger(_0x554ae9);}else{_0x1a166a['mergeFromDatabase'](_0x1a166a['triggers'][_0x554ae9['id']],_0x554ae9);}}}return _0x1a166a[_0x7dec('0x11')];};};Realtime['prototype'][_0x7dec('0x46')]=function(){var _0x23c4e5=this;return function(_0x544371){if(_0x544371){freeIsNotKey(_0x544371,_0x23c4e5[_0x7dec('0x13')],'id');for(var _0x41ce62=0x0,_0x14b88b={},_0x3a705a={};_0x41ce62<_0x544371[_0x7dec('0x41')];_0x41ce62+=0x1){_0x14b88b=_0x544371[_0x41ce62];if(_[_0x7dec('0x3f')](_0x23c4e5[_0x7dec('0x13')][_0x14b88b['id']])){_0x23c4e5[_0x7dec('0x13')][_0x14b88b['id']]=new Template(_0x14b88b);}else{_0x23c4e5[_0x7dec('0x3d')](_0x23c4e5['templates'][_0x14b88b['id']],_0x14b88b);}}}return _0x23c4e5[_0x7dec('0x13')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x47')]=function(){var _0x232b6c=this;return function(_0x20a3d2){if(_0x20a3d2){freeIsNotKey(_0x20a3d2,_0x232b6c['zendeskAccounts'],'id');for(var _0x3bfb5e=0x0,_0x312001={},_0x3a97e2={};_0x3bfb5e<_0x20a3d2['length'];_0x3bfb5e+=0x1){_0x312001=_0x20a3d2[_0x3bfb5e];if(_[_0x7dec('0x3f')](_0x232b6c[_0x7dec('0x1a')][_0x312001['id']])){_0x232b6c[_0x7dec('0x1a')][_0x312001['id']]=new ZendeskAccount(_0x312001);}else{_0x232b6c[_0x7dec('0x3d')](_0x232b6c[_0x7dec('0x1a')][_0x312001['id']],_0x312001);}}}return _0x232b6c[_0x7dec('0x1a')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x48')]=function(){var _0x43e26b=this;return function(_0x4c3eee){if(_0x4c3eee){freeIsNotKey(_0x4c3eee,_0x43e26b[_0x7dec('0x1b')],'id');for(var _0x1f3089=0x0,_0x2a7d25={},_0x38bfde={};_0x1f3089<_0x4c3eee[_0x7dec('0x41')];_0x1f3089+=0x1){_0x2a7d25=_0x4c3eee[_0x1f3089];if(_['isUndefined'](_0x43e26b['salesforceAccounts'][_0x2a7d25['id']])){_0x43e26b[_0x7dec('0x1b')][_0x2a7d25['id']]=new SalesforceAccount(_0x2a7d25);}else{_0x43e26b[_0x7dec('0x3d')](_0x43e26b[_0x7dec('0x1b')][_0x2a7d25['id']],_0x2a7d25);}}}return _0x43e26b['salesforceAccounts'];};};Realtime['prototype'][_0x7dec('0x49')]=function(){var _0x118758=this;return function(_0x4dc942){if(_0x4dc942){freeIsNotKey(_0x4dc942,_0x118758[_0x7dec('0x1c')],'id');for(var _0x42fc41=0x0,_0x4621a8={},_0x327f1b={};_0x42fc41<_0x4dc942[_0x7dec('0x41')];_0x42fc41+=0x1){_0x4621a8=_0x4dc942[_0x42fc41];if(_[_0x7dec('0x3f')](_0x118758[_0x7dec('0x1c')][_0x4621a8['id']])){_0x118758[_0x7dec('0x1c')][_0x4621a8['id']]=new FreshdeskAccount(_0x4621a8);}else{_0x118758[_0x7dec('0x3d')](_0x118758[_0x7dec('0x1c')][_0x4621a8['id']],_0x4621a8);}}}return _0x118758[_0x7dec('0x1c')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x4a')]=function(){var _0x2d140b=this;return function(_0x3c216c){if(_0x3c216c){freeIsNotKey(_0x3c216c,_0x2d140b[_0x7dec('0x1d')],'id');for(var _0x342f4d=0x0,_0x258cc0={},_0x222cd6={};_0x342f4d<_0x3c216c[_0x7dec('0x41')];_0x342f4d+=0x1){_0x258cc0=_0x3c216c[_0x342f4d];if(_[_0x7dec('0x3f')](_0x2d140b[_0x7dec('0x1d')][_0x258cc0['id']])){_0x2d140b[_0x7dec('0x1d')][_0x258cc0['id']]=new ZohoAccount(_0x258cc0);}else{_0x2d140b[_0x7dec('0x3d')](_0x2d140b['zohoAccounts'][_0x258cc0['id']],_0x258cc0);}}}return _0x2d140b[_0x7dec('0x1d')];};};Realtime[_0x7dec('0x3c')]['initDeskAccounts']=function(){var _0x3d6334=this;return function(_0x180ae3){if(_0x180ae3){freeIsNotKey(_0x180ae3,_0x3d6334[_0x7dec('0x1e')],'id');for(var _0x15825b=0x0,_0x4d8b46={},_0x4a39dc={};_0x15825b<_0x180ae3[_0x7dec('0x41')];_0x15825b+=0x1){_0x4d8b46=_0x180ae3[_0x15825b];if(_[_0x7dec('0x3f')](_0x3d6334[_0x7dec('0x1e')][_0x4d8b46['id']])){_0x3d6334['deskAccounts'][_0x4d8b46['id']]=new DeskAccount(_0x4d8b46);}else{_0x3d6334[_0x7dec('0x3d')](_0x3d6334[_0x7dec('0x1e')][_0x4d8b46['id']],_0x4d8b46);}}}return _0x3d6334[_0x7dec('0x1e')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x4b')]=function(){var _0x13cbb5=this;return function(_0x596dc8){if(_0x596dc8){freeIsNotKey(_0x596dc8,_0x13cbb5[_0x7dec('0x4c')],'id');for(var _0x3d4078=0x0,_0x3ba5aa={},_0x25d523={};_0x3d4078<_0x596dc8[_0x7dec('0x41')];_0x3d4078+=0x1){_0x3ba5aa=_0x596dc8[_0x3d4078];if(_[_0x7dec('0x3f')](_0x13cbb5[_0x7dec('0x4c')][_0x3ba5aa['id']])){_0x13cbb5['sugarcrmAccounts'][_0x3ba5aa['id']]=new SugarcrmAccount(_0x3ba5aa);}else{_0x13cbb5['mergeFromDatabase'](_0x13cbb5[_0x7dec('0x4c')][_0x3ba5aa['id']],_0x3ba5aa);}}}return _0x13cbb5[_0x7dec('0x4c')];};};Realtime[_0x7dec('0x3c')]['initVtigerAccounts']=function(){var _0x1fe62f=this;return function(_0x271301){if(_0x271301){freeIsNotKey(_0x271301,_0x1fe62f[_0x7dec('0x1f')],'id');for(var _0x4be796=0x0,_0x54f9fc={},_0x192c09={};_0x4be796<_0x271301[_0x7dec('0x41')];_0x4be796+=0x1){_0x54f9fc=_0x271301[_0x4be796];if(_['isUndefined'](_0x1fe62f[_0x7dec('0x1f')][_0x54f9fc['id']])){_0x1fe62f[_0x7dec('0x1f')][_0x54f9fc['id']]=new VtigerAccount(_0x54f9fc);}else{_0x1fe62f[_0x7dec('0x3d')](_0x1fe62f[_0x7dec('0x1f')][_0x54f9fc['id']],_0x54f9fc);}}}return _0x1fe62f[_0x7dec('0x1f')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x4d')]=function(){var _0x284894=this;return function(_0x2585ed){if(_0x2585ed){freeIsNotKey(_0x2585ed,_0x284894[_0x7dec('0x20')],'id');for(var _0x27cd68=0x0,_0x2abe75={},_0x151c53={};_0x27cd68<_0x2585ed[_0x7dec('0x41')];_0x27cd68+=0x1){_0x2abe75=_0x2585ed[_0x27cd68];if(_['isUndefined'](_0x284894[_0x7dec('0x20')][_0x2abe75['id']])){_0x284894[_0x7dec('0x20')][_0x2abe75['id']]=new ServicenowAccount(_0x2abe75);}else{_0x284894['mergeFromDatabase'](_0x284894['servicenowAccounts'][_0x2abe75['id']],_0x2abe75);}}}return _0x284894[_0x7dec('0x20')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x4e')]=function(){var _0x4f4b1c=this;return function(_0x22e940){if(_0x22e940){freeIsNotKey(_0x22e940,_0x4f4b1c[_0x7dec('0x21')],'id');for(var _0xa95f15=0x0,_0x52ec74={},_0x10b007={};_0xa95f15<_0x22e940[_0x7dec('0x41')];_0xa95f15+=0x1){_0x52ec74=_0x22e940[_0xa95f15];if(_[_0x7dec('0x3f')](_0x4f4b1c[_0x7dec('0x21')][_0x52ec74['id']])){_0x4f4b1c[_0x7dec('0x21')][_0x52ec74['id']]=new Dynamics365Account(_0x52ec74);}else{_0x4f4b1c[_0x7dec('0x3d')](_0x4f4b1c[_0x7dec('0x21')][_0x52ec74['id']],_0x52ec74);}}}return _0x4f4b1c[_0x7dec('0x21')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x4f')]=function(){var _0x2699f6=this;return function(_0x19d143){if(_0x19d143){freeIsNotKey(_0x19d143,_0x2699f6[_0x7dec('0x22')],'id');for(var _0x362852=0x0,_0x205c54={},_0x29f12a={};_0x362852<_0x19d143[_0x7dec('0x41')];_0x362852+=0x1){_0x205c54=_0x19d143[_0x362852];if(_[_0x7dec('0x3f')](_0x2699f6[_0x7dec('0x22')][_0x205c54['id']])){_0x2699f6[_0x7dec('0x22')][_0x205c54['id']]=new FreshsalesAccount(_0x205c54);}else{_0x2699f6['mergeFromDatabase'](_0x2699f6['freshsalesAccounts'][_0x205c54['id']],_0x205c54);}}}return _0x2699f6[_0x7dec('0x22')];};};Realtime['prototype'][_0x7dec('0x50')]=function(){var _0x5678b2=this;return function(_0xdfd3e7){for(var _0x1542b8=0x0;_0x1542b8<_0xdfd3e7[_0x7dec('0x41')];_0x1542b8+=0x1){_['merge'](_0x5678b2[_0x7dec('0x44')][_0xdfd3e7[_0x1542b8][_0x7dec('0x27')]],_0xdfd3e7[_0x1542b8]);}return _0x5678b2[_0x7dec('0x44')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x51')]=function(){var _0x48e6df=this;return function(_0x26b0f2){clearVoiceQueues(_0x48e6df[_0x7dec('0x44')]);if(_0x26b0f2){_0x26b0f2=_[_0x7dec('0x52')](_0x26b0f2,_0x7dec('0x53'));for(var _0x55aa2e in _0x26b0f2){if(_0x26b0f2[_0x7dec('0x25')](_0x55aa2e)){var _0x371c37={};for(var _0x28e678=0x0;_0x28e678<_0x26b0f2[_0x55aa2e][_0x7dec('0x41')];_0x28e678+=0x1){var _0x532d31=_0x26b0f2[_0x55aa2e][_0x28e678][_0x7dec('0x54')];if(_0x48e6df['voiceQueues'][_0x532d31]){if(_0x26b0f2[_0x55aa2e][_0x28e678][_0x7dec('0x55')]){_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x2e')]+=0x1;}if(_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallerabandon']){_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x56')]+=0x1;}_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x2f')]+=moment(_0x26b0f2[_0x55aa2e][_0x28e678][_0x7dec('0x57')])[_0x7dec('0x58')](moment(_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallerjoinAt']),_0x7dec('0x59'))||0x0;if(_0x28e678===_0x26b0f2[_0x55aa2e][_0x7dec('0x41')]-0x1){_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x2b')]+=moment(_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallercompleteAt']||_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallerabandonAt']||_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallerexitAt'])[_0x7dec('0x58')](moment(_0x26b0f2[_0x55aa2e][_0x28e678][_0x7dec('0x5a')]),_0x7dec('0x59'))||0x0;_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x2a')]+=0x1;if(_0x26b0f2[_0x55aa2e][_0x28e678][_0x7dec('0x5b')]){_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x5c')]+=0x1;_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x30')]+=moment(_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallercompleteAt'])[_0x7dec('0x58')](moment(_0x26b0f2[_0x55aa2e][_0x28e678]['queuecallerleaveAt']),_0x7dec('0x59'))||0x0;}}else{_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x2b')]+=_0x48e6df[_0x7dec('0x44')][_0x532d31][_0x7dec('0x2f')]||0x0;}}}}}}return _0x48e6df[_0x7dec('0x44')];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x5d')]=function(){var _0x1b5098=this;return function(_0x409829){clearVoiceCallReports(_0x1b5098[_0x7dec('0x14')]);if(_0x409829){for(var _0x310589=0x0;_0x310589<_0x409829[_0x7dec('0x41')];_0x310589+=0x1){_0x1b5098['outbound'][_0x7dec('0x2a')]+=0x1;_0x1b5098[_0x7dec('0x14')][_0x7dec('0x2b')]+=_0x409829[_0x310589]['duration'];if(_0x409829[_0x310589][_0x7dec('0x5e')]===_0x7dec('0x5f')){_0x1b5098[_0x7dec('0x14')]['answered']+=0x1;_0x1b5098[_0x7dec('0x14')][_0x7dec('0x2f')]+=_0x409829[_0x310589][_0x7dec('0x60')]-_0x409829[_0x310589][_0x7dec('0x61')]||0x0;_0x1b5098[_0x7dec('0x14')]['sumBillable']+=_0x409829[_0x310589][_0x7dec('0x61')];}}}return _0x1b5098['outbound'];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x62')]=function(){var _0x30fedd=this;return function(_0x49be3f){if(_0x49be3f){freeIsNotKey(_0x49be3f,_0x30fedd[_0x7dec('0x12')],_0x7dec('0x27'));for(var _0x4b0a13=0x0,_0x584252={};_0x4b0a13<_0x49be3f[_0x7dec('0x41')];_0x4b0a13+=0x1){_0x584252=_0x49be3f[_0x4b0a13];if(_['isUndefined'](_0x30fedd[_0x7dec('0x12')][_0x584252[_0x7dec('0x27')]])){_0x30fedd['campaigns'][_0x584252['name']]=new Campaign(_0x584252);}else{_0x30fedd[_0x7dec('0x3d')](_0x30fedd['campaigns'][_0x584252['name']],_0x584252);}}}return _0x30fedd['campaigns'];};};Realtime[_0x7dec('0x3c')][_0x7dec('0x63')]=function(){var _0x18639e=this;return function(_0x38fa9c){if(_0x38fa9c){freeIsNotKey(_0x38fa9c,_0x18639e[_0x7dec('0x15')],'id');for(var _0x4257a8=0x0,_0x35eb3a={};_0x4257a8<_0x38fa9c[_0x7dec('0x41')];_0x4257a8+=0x1){_0x35eb3a=_0x38fa9c[_0x4257a8];if(_[_0x7dec('0x3f')](_0x18639e['voiceExtensions'][_0x35eb3a['id']])){_0x18639e[_0x7dec('0x15')][_0x35eb3a['id']]=new VoiceExtension(_0x35eb3a);}else{_0x18639e[_0x7dec('0x3d')](_0x18639e[_0x7dec('0x15')][_0x35eb3a['id']],_0x35eb3a);}}}return _0x18639e['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x2de368=this;return function(_0x5a655b){clearCampaigns(_0x2de368[_0x7dec('0x12')]);for(var _0x3c6267=0x0;_0x3c6267<_0x5a655b[_0x7dec('0x41')];_0x3c6267+=0x1){_[_0x7dec('0x64')](_0x2de368[_0x7dec('0x12')][_0x5a655b[_0x3c6267][_0x7dec('0x27')]],_0x5a655b[_0x3c6267]);}return _0x2de368[_0x7dec('0x12')];};};Realtime['prototype'][_0x7dec('0x65')]=function(){var _0x466872=this;return function(_0x2cf5ca){if(_0x2cf5ca){freeIsNotKey(_0x2cf5ca,_0x466872[_0x7dec('0x23')],'id');for(var _0x33e1be=0x0,_0x2947ac={},_0x51598f={};_0x33e1be<_0x2cf5ca[_0x7dec('0x41')];_0x33e1be+=0x1){_0x2947ac=_0x2cf5ca[_0x33e1be];if(_[_0x7dec('0x3f')](_0x466872['faxAccounts'][_0x2947ac['id']])){_0x466872['faxAccounts'][_0x2947ac['id']]=new FaxAccount(_0x2947ac);}else{_0x466872[_0x7dec('0x3d')](_0x466872[_0x7dec('0x23')][_0x2947ac['id']],_0x2947ac);}}}return _0x466872[_0x7dec('0x23')];};};module[_0x7dec('0x66')]=Realtime; \ No newline at end of file +var _0x4a7c=['prototype','length','isUndefined','telephones','initTrunks','initVoiceQueues','initTriggers','triggers','templates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','vtigerAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','mergeFromDatabase'];(function(_0x2717eb,_0x39ea39){var _0xc7342c=function(_0x251eb8){while(--_0x251eb8){_0x2717eb['push'](_0x2717eb['shift']());}};_0xc7342c(++_0x39ea39);}(_0x4a7c,0x90));var _0xc4a7=function(_0x91695,_0x3e8f4b){_0x91695=_0x91695-0x0;var _0x159b3a=_0x4a7c[_0x91695];return _0x159b3a;};'use strict';var BPromise=require(_0xc4a7('0x0'));var util=require(_0xc4a7('0x1'));var _=require(_0xc4a7('0x2'));var moment=require(_0xc4a7('0x3'));var Agent=require('../model/agent');var Telephone=require(_0xc4a7('0x4'));var Trunk=require(_0xc4a7('0x5'));var VoiceQueue=require(_0xc4a7('0x6'));var Trigger=require(_0xc4a7('0x7'));var Template=require(_0xc4a7('0x8'));var Campaign=require(_0xc4a7('0x9'));var VoiceExtension=require(_0xc4a7('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc4a7('0xb'));var FreshdeskAccount=require(_0xc4a7('0xc'));var SugarcrmAccount=require(_0xc4a7('0xd'));var ZohoAccount=require(_0xc4a7('0xe'));var DeskAccount=require(_0xc4a7('0xf'));var VtigerAccount=require(_0xc4a7('0x10'));var ServicenowAccount=require(_0xc4a7('0x11'));var Dynamics365Account=require(_0xc4a7('0x12'));var FreshsalesAccount=require(_0xc4a7('0x13'));var FaxAccount=require(_0xc4a7('0x14'));var Realtime=function(){this[_0xc4a7('0x15')]={};this['telephones']={};this[_0xc4a7('0x16')]={};this[_0xc4a7('0x17')]={};this['triggers']={};this[_0xc4a7('0x18')]={};this['templates']={};this[_0xc4a7('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc4a7('0x1a')]={};this[_0xc4a7('0x1b')]={};this[_0xc4a7('0x1c')]={};this[_0xc4a7('0x1d')]={};this[_0xc4a7('0x1e')]={};this[_0xc4a7('0x1f')]={};this['salesforceAccounts']={};this[_0xc4a7('0x20')]={};this[_0xc4a7('0x21')]={};this[_0xc4a7('0x22')]={};this[_0xc4a7('0x23')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xc4a7('0x24')]={};this[_0xc4a7('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5625d7,_0x1710e9,_0x443810){var _0x48fa12=_['mapKeys'](_0x5625d7,function(_0x45b692,_0x332104){return _0x45b692[_0x443810];});for(var _0x3e664c in _0x1710e9){if(_0x1710e9[_0xc4a7('0x26')](_0x3e664c)){if(!_0x48fa12[_0x3e664c]){delete _0x1710e9[_0x3e664c];}}}}function freeIsNotKeySip(_0x3d7143,_0x1192ec){var _0x35fd32=_[_0xc4a7('0x27')](_0x3d7143,function(_0x2af67a,_0x3dc239){return util[_0xc4a7('0x28')](_0xc4a7('0x29'),_0x2af67a[_0xc4a7('0x2a')]);});for(var _0x288f18 in _0x1192ec){if(_0x1192ec[_0xc4a7('0x26')](_0x288f18)){if(!_0x35fd32[_0x288f18]){delete _0x1192ec[_0x288f18];}}}}function freeIsNotKeyAgent(_0x2f519d,_0x4a7eaa){var _0xff3f5b=_['mapKeys'](_0x2f519d,function(_0x2e6298,_0x27a2f8){var _0x16958f=_[_0xc4a7('0x2b')](_0x2e6298[_0xc4a7('0x2c')])?util['format'](_0xc4a7('0x29'),_0x2e6298[_0xc4a7('0x2a')]):_0x2e6298[_0xc4a7('0x2c')];return _0x16958f;});for(var _0x873435 in _0x4a7eaa){if(_0x4a7eaa[_0xc4a7('0x26')](_0x873435)){if(!_0xff3f5b[_0x873435]){delete _0x4a7eaa[_0x873435];}}}}function clearVoiceCallReports(_0x4bbf74){_0x4bbf74[_0xc4a7('0x2d')]=0x0;_0x4bbf74[_0xc4a7('0x2e')]=0x0;_0x4bbf74[_0xc4a7('0x2f')]=0x0;_0x4bbf74[_0xc4a7('0x30')]=0x0;_0x4bbf74[_0xc4a7('0x31')]=0x0;}function clearCampaigns(_0x24cd56){if(!_[_0xc4a7('0x32')](_0x24cd56)){for(var _0x10e1da in _0x24cd56){if(_0x24cd56[_0xc4a7('0x26')](_0x10e1da)){_0x24cd56[_0x10e1da][_0xc4a7('0x33')]=0x0;_0x24cd56[_0x10e1da][_0xc4a7('0x34')]=0x0;}}}}function clearVoiceQueues(_0x3da0ab){if(!_[_0xc4a7('0x32')](_0x3da0ab)){for(var _0x41d010 in _0x3da0ab){if(_0x3da0ab[_0xc4a7('0x26')](_0x41d010)){_0x3da0ab[_0x41d010][_0xc4a7('0x2d')]=0x0;_0x3da0ab[_0x41d010]['answered']=0x0;_0x3da0ab[_0x41d010]['unmanaged']=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x35')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x2f')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x30')]=0x0;_0x3da0ab[_0x41d010]['sumBillable']=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x36')]=0x0;_0x3da0ab[_0x41d010]['outboundNoAnswerCallsDay']=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x37')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x38')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x39')]=0x0;_0x3da0ab[_0x41d010]['outboundUnknownCallsDay']=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x3a')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x3b')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x3c')]=0x0;_0x3da0ab[_0x41d010]['outboundOriginateFailureCallsDay']=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x3d')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x3e')]=0x0;_0x3da0ab[_0x41d010][_0xc4a7('0x36')]=0x0;_0x3da0ab[_0x41d010]['outboundAnswerCallsDay']=0x0;_0x3da0ab[_0x41d010]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xc4a7('0x3f')]=function(_0x2a2deb,_0x376e72){for(var _0x25f7af in _0x376e72){if(_0x2a2deb[_0xc4a7('0x26')](_0x25f7af)){_0x2a2deb[_0x25f7af]=_0x376e72[_0x25f7af];}}};Realtime[_0xc4a7('0x40')]['initAgents']=function(){var _0x23c562=this;return function(_0x279a69){if(_0x279a69){freeIsNotKeyAgent(_0x279a69,_0x23c562[_0xc4a7('0x15')]);for(var _0x1c7c96=0x0,_0xc5053={},_0x449262={};_0x1c7c96<_0x279a69[_0xc4a7('0x41')];_0x1c7c96+=0x1){_0xc5053=_0x279a69[_0x1c7c96];var _0x1a506e=_[_0xc4a7('0x2b')](_0xc5053[_0xc4a7('0x2c')])?util[_0xc4a7('0x28')]('SIP/%s',_0xc5053[_0xc4a7('0x2a')]):_0xc5053[_0xc4a7('0x2c')];if(_[_0xc4a7('0x42')](_0x23c562[_0xc4a7('0x15')][_0x1a506e])){_0x23c562[_0xc4a7('0x15')][_0x1a506e]=new Agent(_0xc5053);}else{_0x23c562[_0xc4a7('0x3f')](_0x23c562[_0xc4a7('0x15')][_0x1a506e],_0xc5053);}}}return _0x23c562[_0xc4a7('0x15')];};};Realtime['prototype']['initTelephones']=function(){var _0x4cda08=this;return function(_0x10c717){if(_0x10c717){freeIsNotKeySip(_0x10c717,_0x4cda08[_0xc4a7('0x43')]);for(var _0x1d9f46=0x0,_0xf3c611={},_0x170cdd={};_0x1d9f46<_0x10c717[_0xc4a7('0x41')];_0x1d9f46+=0x1){_0xf3c611=_0x10c717[_0x1d9f46];if(_[_0xc4a7('0x42')](_0x4cda08[_0xc4a7('0x43')][util[_0xc4a7('0x28')](_0xc4a7('0x29'),_0xf3c611['name'])])){_0x4cda08[_0xc4a7('0x43')][util[_0xc4a7('0x28')](_0xc4a7('0x29'),_0xf3c611['name'])]=new Telephone(_0xf3c611);}else{_0x4cda08[_0xc4a7('0x3f')](_0x4cda08[_0xc4a7('0x43')][util['format'](_0xc4a7('0x29'),_0xf3c611[_0xc4a7('0x2a')])],_0xf3c611);}}}return _0x4cda08[_0xc4a7('0x43')];};};Realtime['prototype'][_0xc4a7('0x44')]=function(){var _0x3ec650=this;return function(_0x25df08){if(_0x25df08){freeIsNotKeySip(_0x25df08,_0x3ec650[_0xc4a7('0x16')]);for(var _0x4ae74e=0x0,_0x4c3c4d={},_0x3560d0={};_0x4ae74e<_0x25df08[_0xc4a7('0x41')];_0x4ae74e+=0x1){_0x4c3c4d=_0x25df08[_0x4ae74e];if(_[_0xc4a7('0x42')](_0x3ec650[_0xc4a7('0x16')][util[_0xc4a7('0x28')](_0xc4a7('0x29'),_0x4c3c4d[_0xc4a7('0x2a')])])){_0x3ec650[_0xc4a7('0x16')][util[_0xc4a7('0x28')](_0xc4a7('0x29'),_0x4c3c4d[_0xc4a7('0x2a')])]=new Trunk(_0x4c3c4d);}else{_0x3ec650['mergeFromDatabase'](_0x3ec650['trunks'][util['format'](_0xc4a7('0x29'),_0x4c3c4d[_0xc4a7('0x2a')])],_0x4c3c4d);}}}return _0x3ec650[_0xc4a7('0x16')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x45')]=function(){var _0x53e254=this;return function(_0x3a3d06){if(_0x3a3d06){freeIsNotKey(_0x3a3d06,_0x53e254['voiceQueues'],_0xc4a7('0x2a'));for(var _0x5d40e8=0x0,_0x943124={},_0x5721a4={};_0x5d40e8<_0x3a3d06[_0xc4a7('0x41')];_0x5d40e8+=0x1){_0x943124=_0x3a3d06[_0x5d40e8];if(_['isUndefined'](_0x53e254[_0xc4a7('0x17')][_0x943124[_0xc4a7('0x2a')]])){_0x53e254['voiceQueues'][_0x943124[_0xc4a7('0x2a')]]=new VoiceQueue(_0x943124);}else{_0x53e254[_0xc4a7('0x3f')](_0x53e254[_0xc4a7('0x17')][_0x943124[_0xc4a7('0x2a')]],_0x943124);}}}return _0x53e254['voiceQueues'];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x46')]=function(){var _0x586b3a=this;return function(_0x59d5c7){if(_0x59d5c7){freeIsNotKey(_0x59d5c7,_0x586b3a[_0xc4a7('0x47')],'id');for(var _0x4755ce=0x0,_0xf02b00={},_0x3988cc={};_0x4755ce<_0x59d5c7[_0xc4a7('0x41')];_0x4755ce+=0x1){_0xf02b00=_0x59d5c7[_0x4755ce];if(_[_0xc4a7('0x42')](_0x586b3a['triggers'][_0xf02b00['id']])){_0x586b3a[_0xc4a7('0x47')][_0xf02b00['id']]=new Trigger(_0xf02b00);}else{_0x586b3a[_0xc4a7('0x3f')](_0x586b3a[_0xc4a7('0x47')][_0xf02b00['id']],_0xf02b00);}}}return _0x586b3a[_0xc4a7('0x47')];};};Realtime[_0xc4a7('0x40')]['initTemplates']=function(){var _0x48f75d=this;return function(_0x220c3b){if(_0x220c3b){freeIsNotKey(_0x220c3b,_0x48f75d[_0xc4a7('0x48')],'id');for(var _0x4d17e4=0x0,_0x382ce4={},_0x30fef0={};_0x4d17e4<_0x220c3b[_0xc4a7('0x41')];_0x4d17e4+=0x1){_0x382ce4=_0x220c3b[_0x4d17e4];if(_['isUndefined'](_0x48f75d[_0xc4a7('0x48')][_0x382ce4['id']])){_0x48f75d[_0xc4a7('0x48')][_0x382ce4['id']]=new Template(_0x382ce4);}else{_0x48f75d['mergeFromDatabase'](_0x48f75d[_0xc4a7('0x48')][_0x382ce4['id']],_0x382ce4);}}}return _0x48f75d[_0xc4a7('0x48')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x49')]=function(){var _0x2ff7ba=this;return function(_0x306052){if(_0x306052){freeIsNotKey(_0x306052,_0x2ff7ba['zendeskAccounts'],'id');for(var _0x37049a=0x0,_0x4b2d55={},_0x4cf032={};_0x37049a<_0x306052[_0xc4a7('0x41')];_0x37049a+=0x1){_0x4b2d55=_0x306052[_0x37049a];if(_['isUndefined'](_0x2ff7ba[_0xc4a7('0x1f')][_0x4b2d55['id']])){_0x2ff7ba[_0xc4a7('0x1f')][_0x4b2d55['id']]=new ZendeskAccount(_0x4b2d55);}else{_0x2ff7ba[_0xc4a7('0x3f')](_0x2ff7ba[_0xc4a7('0x1f')][_0x4b2d55['id']],_0x4b2d55);}}}return _0x2ff7ba[_0xc4a7('0x1f')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x4a')]=function(){var _0x17d7cd=this;return function(_0x28611f){if(_0x28611f){freeIsNotKey(_0x28611f,_0x17d7cd[_0xc4a7('0x4b')],'id');for(var _0x58d09f=0x0,_0x120e75={},_0x578fcc={};_0x58d09f<_0x28611f['length'];_0x58d09f+=0x1){_0x120e75=_0x28611f[_0x58d09f];if(_[_0xc4a7('0x42')](_0x17d7cd['salesforceAccounts'][_0x120e75['id']])){_0x17d7cd[_0xc4a7('0x4b')][_0x120e75['id']]=new SalesforceAccount(_0x120e75);}else{_0x17d7cd['mergeFromDatabase'](_0x17d7cd['salesforceAccounts'][_0x120e75['id']],_0x120e75);}}}return _0x17d7cd['salesforceAccounts'];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x4c')]=function(){var _0x171e36=this;return function(_0x451e81){if(_0x451e81){freeIsNotKey(_0x451e81,_0x171e36[_0xc4a7('0x21')],'id');for(var _0x5a73d8=0x0,_0x53718c={},_0x4b90a9={};_0x5a73d8<_0x451e81[_0xc4a7('0x41')];_0x5a73d8+=0x1){_0x53718c=_0x451e81[_0x5a73d8];if(_['isUndefined'](_0x171e36[_0xc4a7('0x21')][_0x53718c['id']])){_0x171e36[_0xc4a7('0x21')][_0x53718c['id']]=new FreshdeskAccount(_0x53718c);}else{_0x171e36[_0xc4a7('0x3f')](_0x171e36[_0xc4a7('0x21')][_0x53718c['id']],_0x53718c);}}}return _0x171e36[_0xc4a7('0x21')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x4d')]=function(){var _0x522ac7=this;return function(_0x4c5d3d){if(_0x4c5d3d){freeIsNotKey(_0x4c5d3d,_0x522ac7[_0xc4a7('0x22')],'id');for(var _0x19d81c=0x0,_0x215a16={},_0x42329f={};_0x19d81c<_0x4c5d3d[_0xc4a7('0x41')];_0x19d81c+=0x1){_0x215a16=_0x4c5d3d[_0x19d81c];if(_[_0xc4a7('0x42')](_0x522ac7['zohoAccounts'][_0x215a16['id']])){_0x522ac7[_0xc4a7('0x22')][_0x215a16['id']]=new ZohoAccount(_0x215a16);}else{_0x522ac7[_0xc4a7('0x3f')](_0x522ac7[_0xc4a7('0x22')][_0x215a16['id']],_0x215a16);}}}return _0x522ac7[_0xc4a7('0x22')];};};Realtime[_0xc4a7('0x40')]['initDeskAccounts']=function(){var _0x1467c7=this;return function(_0x3cadb0){if(_0x3cadb0){freeIsNotKey(_0x3cadb0,_0x1467c7['deskAccounts'],'id');for(var _0x3d666c=0x0,_0x51d2c3={},_0x3ee054={};_0x3d666c<_0x3cadb0[_0xc4a7('0x41')];_0x3d666c+=0x1){_0x51d2c3=_0x3cadb0[_0x3d666c];if(_[_0xc4a7('0x42')](_0x1467c7[_0xc4a7('0x23')][_0x51d2c3['id']])){_0x1467c7[_0xc4a7('0x23')][_0x51d2c3['id']]=new DeskAccount(_0x51d2c3);}else{_0x1467c7[_0xc4a7('0x3f')](_0x1467c7[_0xc4a7('0x23')][_0x51d2c3['id']],_0x51d2c3);}}}return _0x1467c7[_0xc4a7('0x23')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x4e')]=function(){var _0x2db914=this;return function(_0x235155){if(_0x235155){freeIsNotKey(_0x235155,_0x2db914[_0xc4a7('0x20')],'id');for(var _0x576d59=0x0,_0x24bce0={},_0x48cc46={};_0x576d59<_0x235155[_0xc4a7('0x41')];_0x576d59+=0x1){_0x24bce0=_0x235155[_0x576d59];if(_[_0xc4a7('0x42')](_0x2db914['sugarcrmAccounts'][_0x24bce0['id']])){_0x2db914[_0xc4a7('0x20')][_0x24bce0['id']]=new SugarcrmAccount(_0x24bce0);}else{_0x2db914[_0xc4a7('0x3f')](_0x2db914[_0xc4a7('0x20')][_0x24bce0['id']],_0x24bce0);}}}return _0x2db914['sugarcrmAccounts'];};};Realtime[_0xc4a7('0x40')]['initVtigerAccounts']=function(){var _0x384fa8=this;return function(_0x40e17c){if(_0x40e17c){freeIsNotKey(_0x40e17c,_0x384fa8['vtigerAccounts'],'id');for(var _0x19c46b=0x0,_0xeceff6={},_0x50cb06={};_0x19c46b<_0x40e17c[_0xc4a7('0x41')];_0x19c46b+=0x1){_0xeceff6=_0x40e17c[_0x19c46b];if(_[_0xc4a7('0x42')](_0x384fa8[_0xc4a7('0x4f')][_0xeceff6['id']])){_0x384fa8['vtigerAccounts'][_0xeceff6['id']]=new VtigerAccount(_0xeceff6);}else{_0x384fa8[_0xc4a7('0x3f')](_0x384fa8[_0xc4a7('0x4f')][_0xeceff6['id']],_0xeceff6);}}}return _0x384fa8['vtigerAccounts'];};};Realtime[_0xc4a7('0x40')]['initServicenowAccounts']=function(){var _0x1fbd23=this;return function(_0x38e4d8){if(_0x38e4d8){freeIsNotKey(_0x38e4d8,_0x1fbd23['servicenowAccounts'],'id');for(var _0x236d47=0x0,_0x3becf8={},_0x21877f={};_0x236d47<_0x38e4d8[_0xc4a7('0x41')];_0x236d47+=0x1){_0x3becf8=_0x38e4d8[_0x236d47];if(_[_0xc4a7('0x42')](_0x1fbd23[_0xc4a7('0x50')][_0x3becf8['id']])){_0x1fbd23[_0xc4a7('0x50')][_0x3becf8['id']]=new ServicenowAccount(_0x3becf8);}else{_0x1fbd23[_0xc4a7('0x3f')](_0x1fbd23[_0xc4a7('0x50')][_0x3becf8['id']],_0x3becf8);}}}return _0x1fbd23['servicenowAccounts'];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x51')]=function(){var _0x57aee3=this;return function(_0x18c4cd){if(_0x18c4cd){freeIsNotKey(_0x18c4cd,_0x57aee3[_0xc4a7('0x24')],'id');for(var _0x1ef17e=0x0,_0x5fabc6={},_0xcabc46={};_0x1ef17e<_0x18c4cd[_0xc4a7('0x41')];_0x1ef17e+=0x1){_0x5fabc6=_0x18c4cd[_0x1ef17e];if(_[_0xc4a7('0x42')](_0x57aee3[_0xc4a7('0x24')][_0x5fabc6['id']])){_0x57aee3[_0xc4a7('0x24')][_0x5fabc6['id']]=new Dynamics365Account(_0x5fabc6);}else{_0x57aee3[_0xc4a7('0x3f')](_0x57aee3['dynamics365Accounts'][_0x5fabc6['id']],_0x5fabc6);}}}return _0x57aee3[_0xc4a7('0x24')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x52')]=function(){var _0x66c014=this;return function(_0x374fde){if(_0x374fde){freeIsNotKey(_0x374fde,_0x66c014[_0xc4a7('0x25')],'id');for(var _0x2e3d4f=0x0,_0x22bab2={},_0x1ef148={};_0x2e3d4f<_0x374fde['length'];_0x2e3d4f+=0x1){_0x22bab2=_0x374fde[_0x2e3d4f];if(_['isUndefined'](_0x66c014[_0xc4a7('0x25')][_0x22bab2['id']])){_0x66c014[_0xc4a7('0x25')][_0x22bab2['id']]=new FreshsalesAccount(_0x22bab2);}else{_0x66c014[_0xc4a7('0x3f')](_0x66c014[_0xc4a7('0x25')][_0x22bab2['id']],_0x22bab2);}}}return _0x66c014['freshsalesAccounts'];};};Realtime['prototype'][_0xc4a7('0x53')]=function(){var _0x11a5da=this;return function(_0x3b55cc){for(var _0x482c67=0x0;_0x482c67<_0x3b55cc[_0xc4a7('0x41')];_0x482c67+=0x1){_[_0xc4a7('0x54')](_0x11a5da[_0xc4a7('0x17')][_0x3b55cc[_0x482c67][_0xc4a7('0x2a')]],_0x3b55cc[_0x482c67]);}return _0x11a5da[_0xc4a7('0x17')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x55')]=function(){var _0x1768c2=this;return function(_0x214aa8){clearVoiceQueues(_0x1768c2[_0xc4a7('0x17')]);if(_0x214aa8){_0x214aa8=_['groupBy'](_0x214aa8,_0xc4a7('0x56'));for(var _0x2c0964 in _0x214aa8){if(_0x214aa8['hasOwnProperty'](_0x2c0964)){var _0x34170e={};for(var _0x34a762=0x0;_0x34a762<_0x214aa8[_0x2c0964][_0xc4a7('0x41')];_0x34a762+=0x1){var _0xd67658=_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x57')];if(_0x1768c2['voiceQueues'][_0xd67658]){if(_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x58')]){_0x1768c2[_0xc4a7('0x17')][_0xd67658]['unmanaged']+=0x1;}if(_0x214aa8[_0x2c0964][_0x34a762]['queuecallerabandon']){_0x1768c2['voiceQueues'][_0xd67658][_0xc4a7('0x35')]+=0x1;}_0x1768c2['voiceQueues'][_0xd67658][_0xc4a7('0x2f')]+=moment(_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x59')])[_0xc4a7('0x5a')](moment(_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x5b')]),_0xc4a7('0x5c'))||0x0;if(_0x34a762===_0x214aa8[_0x2c0964][_0xc4a7('0x41')]-0x1){_0x1768c2[_0xc4a7('0x17')][_0xd67658][_0xc4a7('0x30')]+=moment(_0x214aa8[_0x2c0964][_0x34a762]['queuecallercompleteAt']||_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x5d')]||_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x5e')])[_0xc4a7('0x5a')](moment(_0x214aa8[_0x2c0964][_0x34a762]['queuecallerjoinAt']),_0xc4a7('0x5c'))||0x0;_0x1768c2['voiceQueues'][_0xd67658][_0xc4a7('0x2d')]+=0x1;if(_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x5f')]){_0x1768c2[_0xc4a7('0x17')][_0xd67658][_0xc4a7('0x2e')]+=0x1;_0x1768c2[_0xc4a7('0x17')][_0xd67658][_0xc4a7('0x31')]+=moment(_0x214aa8[_0x2c0964][_0x34a762]['queuecallercompleteAt'])[_0xc4a7('0x5a')](moment(_0x214aa8[_0x2c0964][_0x34a762][_0xc4a7('0x59')]),_0xc4a7('0x5c'))||0x0;}}else{_0x1768c2[_0xc4a7('0x17')][_0xd67658][_0xc4a7('0x30')]+=_0x1768c2[_0xc4a7('0x17')][_0xd67658]['sumHoldTime']||0x0;}}}}}}return _0x1768c2[_0xc4a7('0x17')];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x60')]=function(){var _0x475b4d=this;return function(_0x4bcc3b){clearVoiceCallReports(_0x475b4d[_0xc4a7('0x19')]);if(_0x4bcc3b){for(var _0x2a08a7=0x0;_0x2a08a7<_0x4bcc3b[_0xc4a7('0x41')];_0x2a08a7+=0x1){_0x475b4d[_0xc4a7('0x19')][_0xc4a7('0x2d')]+=0x1;_0x475b4d['outbound'][_0xc4a7('0x30')]+=_0x4bcc3b[_0x2a08a7][_0xc4a7('0x61')];if(_0x4bcc3b[_0x2a08a7]['disposition']==='ANSWERED'){_0x475b4d[_0xc4a7('0x19')]['answered']+=0x1;_0x475b4d[_0xc4a7('0x19')][_0xc4a7('0x2f')]+=_0x4bcc3b[_0x2a08a7][_0xc4a7('0x61')]-_0x4bcc3b[_0x2a08a7]['billableseconds']||0x0;_0x475b4d[_0xc4a7('0x19')][_0xc4a7('0x31')]+=_0x4bcc3b[_0x2a08a7][_0xc4a7('0x62')];}}}return _0x475b4d[_0xc4a7('0x19')];};};Realtime['prototype'][_0xc4a7('0x63')]=function(){var _0x10ac00=this;return function(_0x584f85){if(_0x584f85){freeIsNotKey(_0x584f85,_0x10ac00[_0xc4a7('0x18')],_0xc4a7('0x2a'));for(var _0x2c2703=0x0,_0x300464={};_0x2c2703<_0x584f85['length'];_0x2c2703+=0x1){_0x300464=_0x584f85[_0x2c2703];if(_[_0xc4a7('0x42')](_0x10ac00[_0xc4a7('0x18')][_0x300464[_0xc4a7('0x2a')]])){_0x10ac00[_0xc4a7('0x18')][_0x300464[_0xc4a7('0x2a')]]=new Campaign(_0x300464);}else{_0x10ac00[_0xc4a7('0x3f')](_0x10ac00['campaigns'][_0x300464['name']],_0x300464);}}}return _0x10ac00['campaigns'];};};Realtime[_0xc4a7('0x40')][_0xc4a7('0x64')]=function(){var _0x4e44a2=this;return function(_0x2a9bbe){if(_0x2a9bbe){freeIsNotKey(_0x2a9bbe,_0x4e44a2[_0xc4a7('0x1a')],'id');for(var _0x11b0c6=0x0,_0x3ba41c={};_0x11b0c6<_0x2a9bbe[_0xc4a7('0x41')];_0x11b0c6+=0x1){_0x3ba41c=_0x2a9bbe[_0x11b0c6];if(_[_0xc4a7('0x42')](_0x4e44a2['voiceExtensions'][_0x3ba41c['id']])){_0x4e44a2['voiceExtensions'][_0x3ba41c['id']]=new VoiceExtension(_0x3ba41c);}else{_0x4e44a2[_0xc4a7('0x3f')](_0x4e44a2[_0xc4a7('0x1a')][_0x3ba41c['id']],_0x3ba41c);}}}return _0x4e44a2['voiceExtensions'];};};Realtime['prototype'][_0xc4a7('0x65')]=function(){var _0xf69790=this;return function(_0x201305){clearCampaigns(_0xf69790[_0xc4a7('0x18')]);for(var _0x295786=0x0;_0x295786<_0x201305['length'];_0x295786+=0x1){_[_0xc4a7('0x54')](_0xf69790[_0xc4a7('0x18')][_0x201305[_0x295786]['name']],_0x201305[_0x295786]);}return _0xf69790[_0xc4a7('0x18')];};};Realtime[_0xc4a7('0x40')]['initFaxAccounts']=function(){var _0x43c409=this;return function(_0xe986d8){if(_0xe986d8){freeIsNotKey(_0xe986d8,_0x43c409['faxAccounts'],'id');for(var _0xed1ebb=0x0,_0x110da1={},_0xa1022d={};_0xed1ebb<_0xe986d8['length'];_0xed1ebb+=0x1){_0x110da1=_0xe986d8[_0xed1ebb];if(_[_0xc4a7('0x42')](_0x43c409[_0xc4a7('0x66')][_0x110da1['id']])){_0x43c409[_0xc4a7('0x66')][_0x110da1['id']]=new FaxAccount(_0x110da1);}else{_0x43c409[_0xc4a7('0x3f')](_0x43c409[_0xc4a7('0x66')][_0x110da1['id']],_0x110da1);}}}return _0x43c409[_0xc4a7('0x66')];};};module[_0xc4a7('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 6f1ca69..51e2c4a 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 _0x2349=['indexOf','mobile','substring','attendedTransfer','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','connectedlinenum','assigned','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','destination','type','dialer','lastapplication','queue','lastdata','context','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x2349,0x1ae));var _0x9234=function(_0x5d258e,_0x4141f5){_0x5d258e=_0x5d258e-0x0;var _0x5eac06=_0x2349[_0x5d258e];return _0x5eac06;};'use strict';var BPromise=require(_0x9234('0x0'));var _=require(_0x9234('0x1'));var moment=require(_0x9234('0x2'));var util=require(_0x9234('0x3'));var config=require(_0x9234('0x4'));var logger=require(_0x9234('0x5'))(_0x9234('0x6'));var ami=require(_0x9234('0x7'));var RpcVoiceAgentReport=require(_0x9234('0x8'));var RpcVoiceCallReport=require(_0x9234('0x9'));var RpcVoiceDialReport=require(_0x9234('0xa'));var RpcMemberReport=require(_0x9234('0xb'));var RpcVoiceQueueReport=require(_0x9234('0xc'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x9234('0xd'));var VoiceQueueReport=require(_0x9234('0xe'));var VoiceCallReport=require(_0x9234('0xf'));var VoiceAgentReport=require(_0x9234('0x10'));var VoiceDialReport=require(_0x9234('0x11'));var UserReport=require(_0x9234('0x12'));function Report(_0x20c1da){this[_0x9234('0x13')]=_0x20c1da;this[_0x9234('0x14')]=_0x20c1da[_0x9234('0x14')];this[_0x9234('0x15')]=_0x20c1da[_0x9234('0x15')];}Report[_0x9234('0x16')]['sync']=function(_0x54ea3e){var _0x28ab5e=new VoiceQueueReport(this['realtime']);var _0x3325f6=new VoiceAgentReport(this[_0x9234('0x13')]);var _0x29caff=new VoiceDialReport(this[_0x9234('0x13')]);var _0x34e11f=new VoiceCallReport(this['realtime']);var _0x262348=new UserReport(this['realtime']);if(config[_0x9234('0x17')]&&config[_0x9234('0x17')][_0x9234('0x18')]){ami['on'](_0x9234('0x19'),this[_0x9234('0x1a')]['bind'](this));ami['on'](_0x9234('0x1b'),this[_0x9234('0x1c')][_0x9234('0x1d')](this));ami['on'](_0x9234('0x1e'),this[_0x9234('0x1f')][_0x9234('0x1d')](this));ami['on'](_0x9234('0x20'),this[_0x9234('0x21')]['bind'](this));ami['on'](_0x9234('0x22'),this[_0x9234('0x23')][_0x9234('0x1d')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x9234('0x1d')](this));}};Report[_0x9234('0x16')][_0x9234('0x24')]=function(_0x2a848e){var _0x1e865b=undefined;_0x1e865b=_[_0x9234('0x25')](this[_0x9234('0x14')],function(_0x52f0bd){return _0x52f0bd[_0x9234('0x26')]==_0x2a848e||_0x52f0bd[_0x9234('0x27')]==_0x2a848e;});if(_[_0x9234('0x28')](_0x1e865b)){var _0xe02b10=_[_0x9234('0x25')](this[_0x9234('0x15')],function(_0x248ade){return _0x248ade['accountcode']==_0x2a848e||_0x248ade['name']==_0x2a848e;});if(_0xe02b10){_0x1e865b=_[_0x9234('0x25')](this[_0x9234('0x14')],function(_0x42018e){return _0x42018e[_0x9234('0x29')]==util['format'](_0x9234('0x2a'),_0xe02b10[_0x9234('0x27')]);});}}return _0x1e865b;};Report['prototype'][_0x9234('0x1a')]=function(_0x1b267e){for(var _0x58fc85=0x0;_0x58fc85<_0x1b267e['length'];_0x58fc85+=0x1){var _0x1dfd15=this[_0x9234('0x24')](_0x1b267e[_0x58fc85][_0x9234('0x2b')]);if(_0x1dfd15){_0x1b267e[_0x58fc85][_0x9234('0x26')]=_0x1dfd15['accountcode'];_0x1b267e[_0x58fc85][_0x9234('0x2c')]=!![];_0x1b267e[_0x58fc85]['lastAssignedTo']=_0x1dfd15[_0x9234('0x27')];_0x1b267e[_0x58fc85]['interface']=_[_0x9234('0x28')](_0x1dfd15['interface'])?util[_0x9234('0x2d')](_0x9234('0x2a'),_0x1dfd15[_0x9234('0x27')]):_0x1dfd15['interface'];if(_0x1b267e[_0x58fc85][_0x9234('0x2e')]){_0x1b267e[_0x58fc85]['queuecallercompleteAt']=moment()[_0x9234('0x2d')](_0x9234('0x2f'));}if(_0x1b267e[_0x58fc85][_0x9234('0x30')]){_0x1b267e[_0x58fc85]['queuecallerexitAt']=moment()[_0x9234('0x2d')](_0x9234('0x2f'));}RpcMemberReport[_0x9234('0x1a')](_0x1b267e[_0x58fc85]);}RpcVoiceQueueReport[_0x9234('0x31')](_0x1b267e[_0x58fc85]);}};function extractCalleridNumber(_0x2df2f4){var _0x434c5b=_0x2df2f4['match'](/<(.*?)>/);return _0x434c5b?_0x434c5b[0x1]:_0x2df2f4;}Report['prototype'][_0x9234('0x1c')]=function(_0x55c036){_0x55c036[_0x9234('0x32')]=_0x55c036['destination']||_0x55c036['exten'];if(_0x55c036[_0x9234('0x33')]==_0x9234('0x34')){_0x55c036[_0x9234('0x35')]=_0x9234('0x36');_0x55c036[_0x9234('0x37')]=_0x55c036[_0x9234('0x36')];if(_0x55c036[_0x9234('0x38')]=='from-voip-provider'){_0x55c036[_0x9234('0x26')]='';_0x55c036[_0x9234('0x32')]=extractCalleridNumber(_0x55c036[_0x9234('0x39')]);}else if(_0x55c036[_0x9234('0x38')]=='from-sip'){if(_0x55c036[_0x9234('0x32')]==_0x9234('0x3a')){_0x55c036[_0x9234('0x32')]=extractCalleridNumber(_0x55c036[_0x9234('0x3b')]);_0x55c036['calleridnum']=_0x55c036[_0x9234('0x3c')];_0x55c036[_0x9234('0x3d')]=[_0x55c036[_0x9234('0x3e')],_0x55c036['channel']=_0x55c036['destinationchannel']][0x0];_0x55c036['callerid']=_0x55c036[_0x9234('0x3b')];}else{_0x55c036[_0x9234('0x32')]=_0x55c036['calleridnum'];_0x55c036[_0x9234('0x3f')]=_0x55c036[_0x9234('0x3c')];if(_0x55c036[_0x9234('0x40')]==_0x9234('0x41')){_0x55c036['accountcode']=_0x55c036[_0x9234('0x2b')];}else{_0x55c036[_0x9234('0x26')]='';}}}}else{_0x55c036['callerid']=util[_0x9234('0x2d')](_0x9234('0x42'),_0x55c036[_0x9234('0x43')],_0x55c036['calleridnum']);}RpcVoiceCallReport[_0x9234('0x31')](_0x55c036);if(_0x55c036[_0x9234('0x44')]){for(var _0x2b4c55=0x0;_0x2b4c55<_0x55c036[_0x9234('0x45')]['length'];_0x2b4c55+=0x1){_0x55c036['monitorFilename']=_0x55c036[_0x9234('0x45')][_0x2b4c55][_0x9234('0x46')];_0x55c036['createdAt']=_0x55c036['monitors'][_0x2b4c55][_0x9234('0x47')];if(_0x55c036[_0x9234('0x48')]==_0x9234('0x3a')){_0x55c036[_0x9234('0x3f')]=_0x55c036[_0x9234('0x2b')];_0x55c036['calleridname']=_0x55c036[_0x9234('0x49')];_0x55c036['connectedlinenum']=_0x55c036[_0x9234('0x26')];_0x55c036[_0x9234('0x49')]=_0x55c036[_0x9234('0x4a')];_0x55c036[_0x9234('0x48')]=_0x55c036[_0x9234('0x3c')];}else if(_0x55c036[_0x9234('0x48')]==_0x9234('0x4b')){_0x55c036[_0x9234('0x3f')]=_0x55c036[_0x9234('0x32')];_0x55c036[_0x9234('0x48')]=_0x55c036[_0x9234('0x3c')];}RpcVoiceRecording['create'](_0x55c036);}}};Report[_0x9234('0x16')][_0x9234('0x1f')]=function(_0x5b3516){if(_[_0x9234('0x4c')](_0x5b3516)){_0x5b3516[_0x9234('0x4d')](function(_0x4af691){RpcVoiceAgentReport[_0x9234('0x31')](_0x4af691);});}else{RpcVoiceAgentReport['create'](_0x5b3516);}};Report[_0x9234('0x16')][_0x9234('0x21')]=function(_0x5f225a){RpcVoiceDialReport[_0x9234('0x31')](_0x5f225a);var _0x4eb8cf=undefined;var _0x12cc98=_0x5f225a[_0x9234('0x3e')];if(_[_0x9234('0x4e')](_0x12cc98,_0x9234('0x4f'))){var _0x4ec20f=_0x12cc98['substring'](_0x12cc98[_0x9234('0x50')]('/')+0x1,_0x12cc98[_0x9234('0x50')]('@'));_0x4eb8cf=_[_0x9234('0x25')](this['agents'],function(_0x1d8d0b){return _0x1d8d0b[_0x9234('0x51')]==_0x4ec20f||_0x1d8d0b['phone']==_0x4ec20f||_0x1d8d0b[_0x9234('0x26')]==_0x4ec20f;});}else{var _0x4ec20f=_0x12cc98[_0x9234('0x52')](_0x12cc98[_0x9234('0x50')]('/')+0x1,_0x12cc98['lastIndexOf']('-'));_0x4eb8cf=this['findAgent'](_0x4ec20f);}if(_0x4eb8cf){_0x5f225a[_0x9234('0x29')]=_[_0x9234('0x28')](_0x4eb8cf[_0x9234('0x29')])?util['format'](_0x9234('0x2a'),_0x4eb8cf[_0x9234('0x27')]):_0x4eb8cf[_0x9234('0x29')];_0x5f225a['membername']=_0x4eb8cf[_0x9234('0x27')];_0x5f225a['accountcode']=_0x4eb8cf[_0x9234('0x26')];RpcMemberReport[_0x9234('0x21')](_0x5f225a);}};Report[_0x9234('0x16')]['blindTransfer']=function(_0x5c5585){RpcVoiceTransferReport[_0x9234('0x23')](_0x5c5585);};Report[_0x9234('0x16')][_0x9234('0x53')]=function(_0xcb8430){RpcVoiceTransferReport[_0x9234('0x53')](_0xcb8430);};module[_0x9234('0x54')]=Report; \ No newline at end of file +var _0x2d3c=['voiceCallReport','voiceAgentReport','bind','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','name','isNil','find','accountcode','interface','SIP/%s','length','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','dialer','lastapplication','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','monitorFilename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','substring','indexOf','mobile','phone','lastIndexOf','exports','bluebird','lodash','moment','../../../config/logger','ami','../ami','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport'];(function(_0x7aeee4,_0x4c888c){var _0xcebaeb=function(_0xfca287){while(--_0xfca287){_0x7aeee4['push'](_0x7aeee4['shift']());}};_0xcebaeb(++_0x4c888c);}(_0x2d3c,0x12d));var _0xc2d3=function(_0x4449a9,_0x41cc91){_0x4449a9=_0x4449a9-0x0;var _0x304748=_0x2d3c[_0x4449a9];return _0x304748;};'use strict';var BPromise=require(_0xc2d3('0x0'));var _=require(_0xc2d3('0x1'));var moment=require(_0xc2d3('0x2'));var util=require('util');var config=require('../../../config/environment');var logger=require(_0xc2d3('0x3'))(_0xc2d3('0x4'));var ami=require(_0xc2d3('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xc2d3('0x6'));var RpcVoiceRecording=require(_0xc2d3('0x7'));var RpcVoiceTransferReport=require(_0xc2d3('0x8'));var VoiceQueueReport=require(_0xc2d3('0x9'));var VoiceCallReport=require(_0xc2d3('0xa'));var VoiceAgentReport=require(_0xc2d3('0xb'));var VoiceDialReport=require(_0xc2d3('0xc'));var UserReport=require(_0xc2d3('0xd'));function Report(_0x27894a){this[_0xc2d3('0xe')]=_0x27894a;this[_0xc2d3('0xf')]=_0x27894a[_0xc2d3('0xf')];this['telephones']=_0x27894a[_0xc2d3('0x10')];}Report[_0xc2d3('0x11')][_0xc2d3('0x12')]=function(_0x72268d){var _0x3626e4=new VoiceQueueReport(this['realtime']);var _0x236d7a=new VoiceAgentReport(this[_0xc2d3('0xe')]);var _0x323a4e=new VoiceDialReport(this['realtime']);var _0x443966=new VoiceCallReport(this['realtime']);var _0x449793=new UserReport(this['realtime']);if(config[_0xc2d3('0x13')]&&config[_0xc2d3('0x13')]['disabled']){ami['on'](_0xc2d3('0x14'),this[_0xc2d3('0x15')]['bind'](this));ami['on'](_0xc2d3('0x16'),this[_0xc2d3('0x17')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xc2d3('0x18')][_0xc2d3('0x19')](this));ami['on']('custom:voiceDialReport',this[_0xc2d3('0x1a')]['bind'](this));ami['on'](_0xc2d3('0x1b'),this[_0xc2d3('0x1c')][_0xc2d3('0x19')](this));ami['on'](_0xc2d3('0x1d'),this[_0xc2d3('0x1e')]['bind'](this));}};Report['prototype'][_0xc2d3('0x1f')]=function(_0x2702d3){var _0x2487fa=undefined;_0x2487fa=_['find'](this['agents'],function(_0x402b15){return _0x402b15['accountcode']==_0x2702d3||_0x402b15[_0xc2d3('0x20')]==_0x2702d3;});if(_[_0xc2d3('0x21')](_0x2487fa)){var _0x12ac3e=_[_0xc2d3('0x22')](this[_0xc2d3('0x10')],function(_0x385b1e){return _0x385b1e[_0xc2d3('0x23')]==_0x2702d3||_0x385b1e[_0xc2d3('0x20')]==_0x2702d3;});if(_0x12ac3e){_0x2487fa=_[_0xc2d3('0x22')](this[_0xc2d3('0xf')],function(_0x22dee4){return _0x22dee4[_0xc2d3('0x24')]==util['format'](_0xc2d3('0x25'),_0x12ac3e[_0xc2d3('0x20')]);});}}return _0x2487fa;};Report[_0xc2d3('0x11')][_0xc2d3('0x15')]=function(_0x13da2f){for(var _0x5b9733=0x0;_0x5b9733<_0x13da2f[_0xc2d3('0x26')];_0x5b9733+=0x1){var _0x27d5d2=this[_0xc2d3('0x1f')](_0x13da2f[_0x5b9733][_0xc2d3('0x27')]);if(_0x27d5d2){_0x13da2f[_0x5b9733][_0xc2d3('0x23')]=_0x27d5d2['accountcode'];_0x13da2f[_0x5b9733][_0xc2d3('0x28')]=!![];_0x13da2f[_0x5b9733]['lastAssignedTo']=_0x27d5d2[_0xc2d3('0x20')];_0x13da2f[_0x5b9733][_0xc2d3('0x24')]=_['isNil'](_0x27d5d2['interface'])?util[_0xc2d3('0x29')](_0xc2d3('0x25'),_0x27d5d2[_0xc2d3('0x20')]):_0x27d5d2[_0xc2d3('0x24')];if(_0x13da2f[_0x5b9733][_0xc2d3('0x2a')]){_0x13da2f[_0x5b9733][_0xc2d3('0x2b')]=moment()[_0xc2d3('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13da2f[_0x5b9733][_0xc2d3('0x2c')]){_0x13da2f[_0x5b9733]['queuecallerexitAt']=moment()['format'](_0xc2d3('0x2d'));}RpcMemberReport[_0xc2d3('0x15')](_0x13da2f[_0x5b9733]);}RpcVoiceQueueReport[_0xc2d3('0x2e')](_0x13da2f[_0x5b9733]);}};function extractCalleridNumber(_0x53124d){var _0x91a602=_0x53124d[_0xc2d3('0x2f')](/<(.*?)>/);return _0x91a602?_0x91a602[0x1]:_0x53124d;}Report['prototype'][_0xc2d3('0x17')]=function(_0x1a3d73){_0x1a3d73[_0xc2d3('0x30')]=_0x1a3d73[_0xc2d3('0x30')]||_0x1a3d73[_0xc2d3('0x31')];if(_0x1a3d73['type']==_0xc2d3('0x32')){_0x1a3d73[_0xc2d3('0x33')]=_0xc2d3('0x34');_0x1a3d73['lastdata']=_0x1a3d73[_0xc2d3('0x34')];if(_0x1a3d73['context']==_0xc2d3('0x35')){_0x1a3d73[_0xc2d3('0x23')]='';_0x1a3d73[_0xc2d3('0x30')]=extractCalleridNumber(_0x1a3d73[_0xc2d3('0x36')]);}else if(_0x1a3d73[_0xc2d3('0x37')]==_0xc2d3('0x38')){if(_0x1a3d73['destination']==_0xc2d3('0x39')){_0x1a3d73[_0xc2d3('0x30')]=extractCalleridNumber(_0x1a3d73[_0xc2d3('0x3a')]);_0x1a3d73['calleridnum']=_0x1a3d73[_0xc2d3('0x3b')];_0x1a3d73[_0xc2d3('0x3c')]=[_0x1a3d73[_0xc2d3('0x3d')],_0x1a3d73[_0xc2d3('0x3d')]=_0x1a3d73[_0xc2d3('0x3c')]][0x0];_0x1a3d73[_0xc2d3('0x36')]=_0x1a3d73[_0xc2d3('0x3a')];}else{_0x1a3d73['destination']=_0x1a3d73['calleridnum'];_0x1a3d73[_0xc2d3('0x3e')]=_0x1a3d73['originatecalleridnum'];if(_0x1a3d73[_0xc2d3('0x3f')]==_0xc2d3('0x40')){_0x1a3d73[_0xc2d3('0x23')]=_0x1a3d73[_0xc2d3('0x27')];}else{_0x1a3d73['accountcode']='';}}}}else{_0x1a3d73[_0xc2d3('0x36')]=util[_0xc2d3('0x29')](_0xc2d3('0x41'),_0x1a3d73['calleridname'],_0x1a3d73['calleridnum']);}RpcVoiceCallReport[_0xc2d3('0x2e')](_0x1a3d73);if(_0x1a3d73[_0xc2d3('0x42')]){for(var _0x3e4fe0=0x0;_0x3e4fe0<_0x1a3d73[_0xc2d3('0x43')][_0xc2d3('0x26')];_0x3e4fe0+=0x1){_0x1a3d73[_0xc2d3('0x44')]=_0x1a3d73[_0xc2d3('0x43')][_0x3e4fe0]['filename'];_0x1a3d73['createdAt']=_0x1a3d73[_0xc2d3('0x43')][_0x3e4fe0][_0xc2d3('0x45')];if(_0x1a3d73['exten']==_0xc2d3('0x39')){_0x1a3d73[_0xc2d3('0x3e')]=_0x1a3d73[_0xc2d3('0x27')];_0x1a3d73[_0xc2d3('0x46')]=_0x1a3d73[_0xc2d3('0x47')];_0x1a3d73['connectedlinenum']=_0x1a3d73[_0xc2d3('0x23')];_0x1a3d73[_0xc2d3('0x47')]=_0x1a3d73[_0xc2d3('0x48')];_0x1a3d73['exten']=_0x1a3d73[_0xc2d3('0x3b')];}else if(_0x1a3d73['exten']==_0xc2d3('0x49')){_0x1a3d73['calleridnum']=_0x1a3d73[_0xc2d3('0x30')];_0x1a3d73[_0xc2d3('0x31')]=_0x1a3d73['originatecalleridnum'];}RpcVoiceRecording[_0xc2d3('0x2e')](_0x1a3d73);}}};Report['prototype'][_0xc2d3('0x18')]=function(_0x35fe57){if(_[_0xc2d3('0x4a')](_0x35fe57)){_0x35fe57['forEach'](function(_0x3a9a5c){RpcVoiceAgentReport[_0xc2d3('0x2e')](_0x3a9a5c);});}else{RpcVoiceAgentReport[_0xc2d3('0x2e')](_0x35fe57);}};Report[_0xc2d3('0x11')]['voiceDialReport']=function(_0x2e20d9){RpcVoiceDialReport['create'](_0x2e20d9);var _0x500d62=undefined;var _0x521337=_0x2e20d9[_0xc2d3('0x3d')];if(_['startsWith'](_0x521337,'Local')){var _0x9e02cf=_0x521337[_0xc2d3('0x4b')](_0x521337['indexOf']('/')+0x1,_0x521337[_0xc2d3('0x4c')]('@'));_0x500d62=_[_0xc2d3('0x22')](this['agents'],function(_0x1cfb75){return _0x1cfb75[_0xc2d3('0x4d')]==_0x9e02cf||_0x1cfb75[_0xc2d3('0x4e')]==_0x9e02cf||_0x1cfb75[_0xc2d3('0x23')]==_0x9e02cf;});}else{var _0x9e02cf=_0x521337[_0xc2d3('0x4b')](_0x521337[_0xc2d3('0x4c')]('/')+0x1,_0x521337[_0xc2d3('0x4f')]('-'));_0x500d62=this['findAgent'](_0x9e02cf);}if(_0x500d62){_0x2e20d9[_0xc2d3('0x24')]=_[_0xc2d3('0x21')](_0x500d62[_0xc2d3('0x24')])?util['format'](_0xc2d3('0x25'),_0x500d62[_0xc2d3('0x20')]):_0x500d62[_0xc2d3('0x24')];_0x2e20d9[_0xc2d3('0x48')]=_0x500d62['name'];_0x2e20d9['accountcode']=_0x500d62[_0xc2d3('0x23')];RpcMemberReport['voiceDialReport'](_0x2e20d9);}};Report[_0xc2d3('0x11')][_0xc2d3('0x1c')]=function(_0x18ad6b){RpcVoiceTransferReport[_0xc2d3('0x1c')](_0x18ad6b);};Report['prototype'][_0xc2d3('0x1e')]=function(_0x36ef6d){RpcVoiceTransferReport[_0xc2d3('0x1e')](_0x36ef6d);};module[_0xc2d3('0x50')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 8130709..936f706 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 _0x73bd=['address','telephone:save','trunk:save','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','isNotNull','emit','find','trunks','username','stateRegistry','state','omit','event','actionid','trunk:%s','name','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','toNumber','format','updateStatusRealtime','telephone:%s','startsWith','substring','indexOf','mobile','phone','accountcode','stateTime','[syncDeviceState][UserReport]','peer','status'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0x73bd,0x184));var _0xd73b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x73bd[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd73b('0x0'));var moment=require(_0xd73b('0x1'));var BPromise=require(_0xd73b('0x2'));var util=require(_0xd73b('0x3'));var Redis=require(_0xd73b('0x4'));var config=require(_0xd73b('0x5'));var logger=require('../../../config/logger')(_0xd73b('0x6'));var ami=require(_0xd73b('0x7'));config[_0xd73b('0x8')]=_[_0xd73b('0x9')](config['redis'],{'host':_0xd73b('0xa'),'port':0x18eb});var io=require(_0xd73b('0xb'))(new Redis(config['redis']));function UserReport(_0xa2c3b9){this['trunks']=_0xa2c3b9['trunks'];this[_0xd73b('0xc')]=_0xa2c3b9[_0xd73b('0xc')];this[_0xd73b('0xd')]=_0xa2c3b9[_0xd73b('0xd')];ami['on'](_0xd73b('0xe'),this[_0xd73b('0xf')][_0xd73b('0x10')](this));ami['on'](_0xd73b('0x11'),this['syncRegistry'][_0xd73b('0x10')](this));ami['on']('devicestatechange',this[_0xd73b('0x12')][_0xd73b('0x10')](this));ami['on'](_0xd73b('0x13'),this['syncPeerStatus'][_0xd73b('0x10')](this));this[_0xd73b('0x14')]();return BPromise[_0xd73b('0x15')]()[_0xd73b('0x16')](ami[_0xd73b('0x17')]())[_0xd73b('0x16')](ami['actionDeviceStateList']())[_0xd73b('0x16')](ami[_0xd73b('0x18')]())['catch'](loggerCatch(_0xd73b('0x19')));}function loggerCatch(_0x50f5d0){return function(_0xc70ef1){logger[_0xd73b('0x1a')](_0x50f5d0,util[_0xd73b('0x1b')](_0xc70ef1,{'showHidden':![],'depth':null}));};}UserReport[_0xd73b('0x1c')][_0xd73b('0x14')]=function(){setInterval(function(){BPromise[_0xd73b('0x15')]()[_0xd73b('0x16')](ami[_0xd73b('0x17')]())['then'](ami['actionDeviceStateList']())[_0xd73b('0x16')](ami[_0xd73b('0x18')]())['catch'](loggerCatch(_0xd73b('0x19')));},0x32c8);};UserReport['prototype'][_0xd73b('0x1d')]=function(_0xcfdba5){return _0xcfdba5!==null&&!_['isUndefined'](_0xcfdba5);};UserReport['prototype'][_0xd73b('0x1e')]=function(_0x54bdbb,_0x225d12,_0x334a59){io['to'](_0x54bdbb)[_0xd73b('0x1e')](_0x225d12,_0x334a59);};UserReport[_0xd73b('0x1c')][_0xd73b('0xf')]=function(_0x664c4d){try{if(this[_0xd73b('0x1d')](_0x664c4d)){var _0x5d0cd0=_[_0xd73b('0x1f')](this[_0xd73b('0x20')],{'registry':_0x664c4d[_0xd73b('0x21')]});if(_0x5d0cd0){_0x664c4d[_0xd73b('0x22')]=_0x664c4d[_0xd73b('0x23')];_['merge'](_0x5d0cd0,_[_0xd73b('0x24')](_0x664c4d,[_0xd73b('0x25'),_0xd73b('0x26'),_0xd73b('0x21'),_0xd73b('0x23')]));this[_0xd73b('0x1e')](util['format'](_0xd73b('0x27'),_0x5d0cd0[_0xd73b('0x28')]),'trunk:save',_0x5d0cd0);}}}catch(_0x569bf4){logger[_0xd73b('0x1a')](_0xd73b('0x29'),util[_0xd73b('0x1b')](_0x569bf4,{'showHidden':![],'depth':null}));}};UserReport[_0xd73b('0x1c')][_0xd73b('0x12')]=function(_0x513787){try{if(this[_0xd73b('0x1d')](_0x513787)){if(this[_0xd73b('0xc')][_0x513787[_0xd73b('0x2a')]]){if(!this['agents'][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x2b')]||_0x513787[_0xd73b('0x23')][_0xd73b('0x2c')]()==_0xd73b('0x2d')){this[_0xd73b('0xc')][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x2b')]=![];if(this['agents'][_0x513787[_0xd73b('0x2a')]]['state']!==_0x513787[_0xd73b('0x23')][_0xd73b('0x2c')]()){this[_0xd73b('0xc')][_0x513787[_0xd73b('0x2a')]]['stateTime']=_[_0xd73b('0x2e')](moment()[_0xd73b('0x2f')]('x'));}this['agents'][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x23')]=_0x513787[_0xd73b('0x23')]['toLowerCase']();this['agents'][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x30')](_0x513787);}}else if(this[_0xd73b('0xd')][_0x513787[_0xd73b('0x2a')]]){if(this[_0xd73b('0xd')][_0x513787['device']][_0xd73b('0x23')]!==_0x513787[_0xd73b('0x23')][_0xd73b('0x2c')]()){this[_0xd73b('0xd')][_0x513787[_0xd73b('0x2a')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0xd73b('0xd')][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x23')]=_0x513787[_0xd73b('0x23')][_0xd73b('0x2c')]();this[_0xd73b('0x1e')](util[_0xd73b('0x2f')](_0xd73b('0x31'),this[_0xd73b('0xd')][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x28')]),'telephone:save',this[_0xd73b('0xd')][_0x513787['device']]);}else if(this['trunks'][_0x513787[_0xd73b('0x2a')]]){if(this[_0xd73b('0x20')][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x23')]!==_0x513787[_0xd73b('0x23')]['toLowerCase']()){this[_0xd73b('0x20')][_0x513787[_0xd73b('0x2a')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x513787[_0xd73b('0x2a')]]['state']=_0x513787[_0xd73b('0x23')][_0xd73b('0x2c')]();this[_0xd73b('0x1e')](util['format'](_0xd73b('0x27'),this[_0xd73b('0x20')][_0x513787[_0xd73b('0x2a')]][_0xd73b('0x28')]),'trunk:save',this[_0xd73b('0x20')][_0x513787[_0xd73b('0x2a')]]);}else if(_[_0xd73b('0x32')](_0x513787[_0xd73b('0x2a')],'Queue')){}else if(_[_0xd73b('0x32')](_0x513787['device'],'Local')){var _0x4d510f=_0x513787[_0xd73b('0x2a')];var _0x362f8a=_0x4d510f[_0xd73b('0x33')](_0x4d510f[_0xd73b('0x34')]('/')+0x1,_0x4d510f[_0xd73b('0x34')]('@'));var _0x5d5711=_['find'](this[_0xd73b('0xc')],function(_0x362f4){return _0x362f4[_0xd73b('0x35')]==_0x362f8a||_0x362f4[_0xd73b('0x36')]==_0x362f8a||_0x362f4[_0xd73b('0x37')]==_0x362f8a;});if(_0x5d5711){if(_0x5d5711[_0xd73b('0x23')]!==_0x513787[_0xd73b('0x23')][_0xd73b('0x2c')]()){_0x5d5711[_0xd73b('0x38')]=_[_0xd73b('0x2e')](moment()[_0xd73b('0x2f')]('x'));}_0x5d5711[_0xd73b('0x23')]=_0x513787['state']['toLowerCase']();_0x5d5711['local']=!![];_0x5d5711[_0xd73b('0x30')](_0x513787);}}else{}}}catch(_0x42b4a2){logger['error'](_0xd73b('0x39'),util[_0xd73b('0x1b')](_0x42b4a2,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x29a90d){try{if(this[_0xd73b('0x1d')](_0x29a90d)&&this['isNotNull'](_0x29a90d[_0xd73b('0x13')])){if(this['agents'][_0x29a90d[_0xd73b('0x3a')]]){if(!this[_0xd73b('0xc')][_0x29a90d[_0xd73b('0x3a')]]['local']||_0x29a90d[_0xd73b('0x13')]['toLowerCase']()=='registered'){this[_0xd73b('0xc')][_0x29a90d[_0xd73b('0x3a')]][_0xd73b('0x2b')]=![];this[_0xd73b('0xc')][_0x29a90d[_0xd73b('0x3a')]][_0xd73b('0x3b')]=_0x29a90d[_0xd73b('0x13')][_0xd73b('0x2c')]();this[_0xd73b('0xc')][_0x29a90d['peer']][_0xd73b('0x3c')]=_0x29a90d[_0xd73b('0x3c')];this[_0xd73b('0xc')][_0x29a90d['peer']]['updateStatusRealtime'](_0x29a90d);}}else if(this[_0xd73b('0xd')][_0x29a90d[_0xd73b('0x3a')]]){this[_0xd73b('0xd')][_0x29a90d['peer']][_0xd73b('0x3b')]=_0x29a90d[_0xd73b('0x13')]['toLowerCase']();this['telephones'][_0x29a90d['peer']][_0xd73b('0x3c')]=_0x29a90d[_0xd73b('0x3c')];this[_0xd73b('0x1e')](util['format']('telephone:%s',this[_0xd73b('0xd')][_0x29a90d[_0xd73b('0x3a')]][_0xd73b('0x28')]),_0xd73b('0x3d'),this[_0xd73b('0xd')][_0x29a90d['peer']]);}else if(this[_0xd73b('0x20')][_0x29a90d[_0xd73b('0x3a')]]){this[_0xd73b('0x20')][_0x29a90d['peer']]['status']=_0x29a90d[_0xd73b('0x13')][_0xd73b('0x2c')]();this[_0xd73b('0x20')][_0x29a90d[_0xd73b('0x3a')]][_0xd73b('0x3c')]=_0x29a90d['address'];this['emit'](util[_0xd73b('0x2f')]('trunk:%s',this[_0xd73b('0x20')][_0x29a90d[_0xd73b('0x3a')]][_0xd73b('0x28')]),_0xd73b('0x3e'),this['trunks'][_0x29a90d['peer']]);}else{}}}catch(_0x257189){logger[_0xd73b('0x1a')](_0xd73b('0x3f'),util[_0xd73b('0x1b')](_0x257189,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x553b=['peer','address','status','[syncPeerStatus][UserReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','[loopSyncRealTimeShow]','inspect','prototype','actionDeviceStateList','isNotNull','emit','username','stateRegistry','merge','omit','event','actionid','name','trunk:save','error','[syncRegistry][UserReport]','device','local','state','inuse','stateTime','toNumber','format','toLowerCase','telephone:%s','telephone:save','trunk:%s','startsWith','Queue','Local','substring','indexOf','find','mobile','phone','updateStatusRealtime','[syncDeviceState][UserReport]'];(function(_0x57b6eb,_0x2d032b){var _0xfb5ac4=function(_0x22d8ac){while(--_0x22d8ac){_0x57b6eb['push'](_0x57b6eb['shift']());}};_0xfb5ac4(++_0x2d032b);}(_0x553b,0x1da));var _0xb553=function(_0x575112,_0x56ff89){_0x575112=_0x575112-0x0;var _0x4addb4=_0x553b[_0x575112];return _0x4addb4;};'use strict';var _=require(_0xb553('0x0'));var moment=require(_0xb553('0x1'));var BPromise=require('bluebird');var util=require(_0xb553('0x2'));var Redis=require(_0xb553('0x3'));var config=require(_0xb553('0x4'));var logger=require(_0xb553('0x5'))(_0xb553('0x6'));var ami=require('../ami');config[_0xb553('0x7')]=_['defaults'](config[_0xb553('0x7')],{'host':_0xb553('0x8'),'port':0x18eb});var io=require(_0xb553('0x9'))(new Redis(config[_0xb553('0x7')]));function UserReport(_0x6e2956){this[_0xb553('0xa')]=_0x6e2956['trunks'];this[_0xb553('0xb')]=_0x6e2956[_0xb553('0xb')];this[_0xb553('0xc')]=_0x6e2956[_0xb553('0xc')];ami['on'](_0xb553('0xd'),this[_0xb553('0xe')][_0xb553('0xf')](this));ami['on'](_0xb553('0x10'),this['syncRegistry'][_0xb553('0xf')](this));ami['on'](_0xb553('0x11'),this[_0xb553('0x12')]['bind'](this));ami['on'](_0xb553('0x13'),this[_0xb553('0x14')][_0xb553('0xf')](this));this['loopSyncRealTimeShow']();return BPromise[_0xb553('0x15')]()[_0xb553('0x16')](ami[_0xb553('0x17')]())['then'](ami['actionDeviceStateList']())[_0xb553('0x16')](ami['actionSipPeerStatus']())[_0xb553('0x18')](loggerCatch(_0xb553('0x19')));}function loggerCatch(_0x3f5346){return function(_0xf4f9f6){logger['error'](_0x3f5346,util[_0xb553('0x1a')](_0xf4f9f6,{'showHidden':![],'depth':null}));};}UserReport[_0xb553('0x1b')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xb553('0x15')]()[_0xb553('0x16')](ami[_0xb553('0x17')]())[_0xb553('0x16')](ami[_0xb553('0x1c')]())[_0xb553('0x16')](ami['actionSipPeerStatus']())[_0xb553('0x18')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xb553('0x1b')][_0xb553('0x1d')]=function(_0x7a6d0c){return _0x7a6d0c!==null&&!_['isUndefined'](_0x7a6d0c);};UserReport['prototype'][_0xb553('0x1e')]=function(_0x2f9347,_0x330ca5,_0xbe01de){io['to'](_0x2f9347)[_0xb553('0x1e')](_0x330ca5,_0xbe01de);};UserReport['prototype'][_0xb553('0xe')]=function(_0x448039){try{if(this[_0xb553('0x1d')](_0x448039)){var _0x3b2278=_['find'](this[_0xb553('0xa')],{'registry':_0x448039[_0xb553('0x1f')]});if(_0x3b2278){_0x448039[_0xb553('0x20')]=_0x448039['state'];_[_0xb553('0x21')](_0x3b2278,_[_0xb553('0x22')](_0x448039,[_0xb553('0x23'),_0xb553('0x24'),'username','state']));this[_0xb553('0x1e')](util['format']('trunk:%s',_0x3b2278[_0xb553('0x25')]),_0xb553('0x26'),_0x3b2278);}}}catch(_0x50e64d){logger[_0xb553('0x27')](_0xb553('0x28'),util[_0xb553('0x1a')](_0x50e64d,{'showHidden':![],'depth':null}));}};UserReport[_0xb553('0x1b')][_0xb553('0x12')]=function(_0x5ce64b){try{if(this[_0xb553('0x1d')](_0x5ce64b)){if(this[_0xb553('0xb')][_0x5ce64b[_0xb553('0x29')]]){if(!this[_0xb553('0xb')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2a')]||_0x5ce64b[_0xb553('0x2b')]['toLowerCase']()==_0xb553('0x2c')){this[_0xb553('0xb')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2a')]=![];if(this['agents'][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2b')]!==_0x5ce64b[_0xb553('0x2b')]['toLowerCase']()){this['agents'][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2d')]=_[_0xb553('0x2e')](moment()[_0xb553('0x2f')]('x'));}this[_0xb553('0xb')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2b')]=_0x5ce64b['state'][_0xb553('0x30')]();this[_0xb553('0xb')][_0x5ce64b[_0xb553('0x29')]]['updateStatusRealtime'](_0x5ce64b);}}else if(this[_0xb553('0xc')][_0x5ce64b[_0xb553('0x29')]]){if(this[_0xb553('0xc')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2b')]!==_0x5ce64b['state'][_0xb553('0x30')]()){this[_0xb553('0xc')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2d')]=_[_0xb553('0x2e')](moment()['format']('x'));}this[_0xb553('0xc')][_0x5ce64b[_0xb553('0x29')]]['state']=_0x5ce64b['state'][_0xb553('0x30')]();this[_0xb553('0x1e')](util[_0xb553('0x2f')](_0xb553('0x31'),this[_0xb553('0xc')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x25')]),_0xb553('0x32'),this[_0xb553('0xc')][_0x5ce64b['device']]);}else if(this[_0xb553('0xa')][_0x5ce64b[_0xb553('0x29')]]){if(this[_0xb553('0xa')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2b')]!==_0x5ce64b[_0xb553('0x2b')]['toLowerCase']()){this[_0xb553('0xa')][_0x5ce64b[_0xb553('0x29')]][_0xb553('0x2d')]=_['toNumber'](moment()[_0xb553('0x2f')]('x'));}this[_0xb553('0xa')][_0x5ce64b['device']][_0xb553('0x2b')]=_0x5ce64b['state'][_0xb553('0x30')]();this[_0xb553('0x1e')](util[_0xb553('0x2f')](_0xb553('0x33'),this[_0xb553('0xa')][_0x5ce64b['device']][_0xb553('0x25')]),_0xb553('0x26'),this['trunks'][_0x5ce64b['device']]);}else if(_[_0xb553('0x34')](_0x5ce64b['device'],_0xb553('0x35'))){}else if(_[_0xb553('0x34')](_0x5ce64b[_0xb553('0x29')],_0xb553('0x36'))){var _0x158a4f=_0x5ce64b[_0xb553('0x29')];var _0x2865b7=_0x158a4f[_0xb553('0x37')](_0x158a4f[_0xb553('0x38')]('/')+0x1,_0x158a4f[_0xb553('0x38')]('@'));var _0x8b4b34=_[_0xb553('0x39')](this[_0xb553('0xb')],function(_0x4ad727){return _0x4ad727[_0xb553('0x3a')]==_0x2865b7||_0x4ad727[_0xb553('0x3b')]==_0x2865b7||_0x4ad727['accountcode']==_0x2865b7;});if(_0x8b4b34){if(_0x8b4b34['state']!==_0x5ce64b['state'][_0xb553('0x30')]()){_0x8b4b34[_0xb553('0x2d')]=_[_0xb553('0x2e')](moment()[_0xb553('0x2f')]('x'));}_0x8b4b34[_0xb553('0x2b')]=_0x5ce64b[_0xb553('0x2b')]['toLowerCase']();_0x8b4b34['local']=!![];_0x8b4b34[_0xb553('0x3c')](_0x5ce64b);}}else{}}}catch(_0x4c29d9){logger[_0xb553('0x27')](_0xb553('0x3d'),util[_0xb553('0x1a')](_0x4c29d9,{'showHidden':![],'depth':null}));}};UserReport[_0xb553('0x1b')][_0xb553('0x14')]=function(_0x2946f6){try{if(this[_0xb553('0x1d')](_0x2946f6)&&this[_0xb553('0x1d')](_0x2946f6[_0xb553('0x13')])){if(this[_0xb553('0xb')][_0x2946f6[_0xb553('0x3e')]]){if(!this['agents'][_0x2946f6['peer']]['local']||_0x2946f6[_0xb553('0x13')][_0xb553('0x30')]()=='registered'){this[_0xb553('0xb')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x2a')]=![];this[_0xb553('0xb')][_0x2946f6[_0xb553('0x3e')]]['status']=_0x2946f6[_0xb553('0x13')]['toLowerCase']();this[_0xb553('0xb')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x3f')]=_0x2946f6[_0xb553('0x3f')];this[_0xb553('0xb')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x3c')](_0x2946f6);}}else if(this[_0xb553('0xc')][_0x2946f6['peer']]){this[_0xb553('0xc')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x40')]=_0x2946f6[_0xb553('0x13')][_0xb553('0x30')]();this[_0xb553('0xc')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x3f')]=_0x2946f6[_0xb553('0x3f')];this[_0xb553('0x1e')](util[_0xb553('0x2f')](_0xb553('0x31'),this[_0xb553('0xc')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x25')]),_0xb553('0x32'),this[_0xb553('0xc')][_0x2946f6[_0xb553('0x3e')]]);}else if(this[_0xb553('0xa')][_0x2946f6['peer']]){this[_0xb553('0xa')][_0x2946f6['peer']][_0xb553('0x40')]=_0x2946f6[_0xb553('0x13')][_0xb553('0x30')]();this[_0xb553('0xa')][_0x2946f6[_0xb553('0x3e')]]['address']=_0x2946f6[_0xb553('0x3f')];this[_0xb553('0x1e')](util[_0xb553('0x2f')](_0xb553('0x33'),this[_0xb553('0xa')][_0x2946f6[_0xb553('0x3e')]][_0xb553('0x25')]),'trunk:save',this[_0xb553('0xa')][_0x2946f6[_0xb553('0x3e')]]);}else{}}}catch(_0x8f1f04){logger['error'](_0xb553('0x41'),util['inspect'](_0x8f1f04,{'showHidden':![],'depth':null}));}};module[_0xb553('0x42')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index a43cd59..34af70e 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 _0xaacb=['[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','exports','lodash','ioredis','../../../config/logger','../ami','redis','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','uniqueid','destuniqueid','format','called','queue','type','inbound','omit','event','privilege','custom:agentcalled','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','isNotNull','hasOwnProperty','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','destconnectedlinenum','custom:agentconnect','reason','answered_elsewhere','lastevent','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','values'];(function(_0x3ab68d,_0x4eb61d){var _0x5731f6=function(_0x42db7f){while(--_0x42db7f){_0x3ab68d['push'](_0x3ab68d['shift']());}};_0x5731f6(++_0x4eb61d);}(_0xaacb,0x1e6));var _0xbaac=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0xaacb[_0xb4788];return _0xd49d21;};'use strict';var _=require(_0xbaac('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xbaac('0x1'));var config=require('../../../config/environment');var logger=require(_0xbaac('0x2'))('ami');var ami=require(_0xbaac('0x3'));config[_0xbaac('0x4')]=_['defaults'](config[_0xbaac('0x4')],{'host':_0xbaac('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x44df83){this[_0xbaac('0x6')]={};this[_0xbaac('0x7')]=_0x44df83[_0xbaac('0x7')];this[_0xbaac('0x8')]=_0x44df83[_0xbaac('0x8')];this[_0xbaac('0x9')]={};ami['on'](_0xbaac('0xa'),this[_0xbaac('0xb')][_0xbaac('0xc')](this));ami['on'](_0xbaac('0xd'),this[_0xbaac('0xe')]['bind'](this));ami['on'](_0xbaac('0xf'),this['syncAgentRingNoAnswer'][_0xbaac('0xc')](this));ami['on'](_0xbaac('0x10'),this[_0xbaac('0x11')][_0xbaac('0xc')](this));ami['on'](_0xbaac('0x12'),this[_0xbaac('0x13')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xbaac('0xc')](this));ami['on'](_0xbaac('0x14'),this[_0xbaac('0x15')]['bind'](this));ami['on'](_0xbaac('0x16'),this['syncMusicOnHoldStart'][_0xbaac('0xc')](this));ami['on'](_0xbaac('0x17'),this[_0xbaac('0x18')][_0xbaac('0xc')](this));ami['on'](_0xbaac('0x19'),this[_0xbaac('0x1a')]['bind'](this));ami['on'](_0xbaac('0x1b'),this[_0xbaac('0x1c')][_0xbaac('0xc')](this));}VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x1e')]=function(_0x475f65,_0x497918,_0x5c0be4){io['to'](_0x475f65)['emit'](_0x497918,_0x5c0be4);};VoiceAgentReport['prototype']['isNotNull']=function(_0x56434b){return _0x56434b!==null&&!_[_0xbaac('0x1f')](_0x56434b);};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0xb')]=function(_0x1e0a84){try{if(this['isNotNull'](_0x1e0a84)){if(_['isUndefined'](this[_0xbaac('0x6')][_0x1e0a84[_0xbaac('0x20')]])){this[_0xbaac('0x6')][_0x1e0a84['uniqueid']]={};}if(_['isUndefined'](this['channels'][_0x1e0a84[_0xbaac('0x20')]][_0x1e0a84[_0xbaac('0x21')]])){this[_0xbaac('0x6')][_0x1e0a84[_0xbaac('0x20')]][_0x1e0a84[_0xbaac('0x21')]]={'agentcalledAt':moment()[_0xbaac('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xbaac('0x23'),'variables':this[_0xbaac('0x9')][_0x1e0a84['uniqueid']],'type':this[_0xbaac('0x7')][_0x1e0a84[_0xbaac('0x24')]]?this['voiceQueues'][_0x1e0a84[_0xbaac('0x24')]][_0xbaac('0x25')]||_0xbaac('0x26'):_0xbaac('0x26')};}_['merge'](this[_0xbaac('0x6')][_0x1e0a84['uniqueid']][_0x1e0a84[_0xbaac('0x21')]],_[_0xbaac('0x27')](_0x1e0a84,[_0xbaac('0x28'),_0xbaac('0x29')]));ami[_0xbaac('0x1e')](_0xbaac('0x2a'),this[_0xbaac('0x6')][_0x1e0a84[_0xbaac('0x20')]][_0x1e0a84[_0xbaac('0x21')]]);this[_0xbaac('0x1e')](util['format'](_0xbaac('0x2b'),_0x1e0a84[_0xbaac('0x2c')]),'user:called',this[_0xbaac('0x6')][_0x1e0a84['uniqueid']][_0x1e0a84[_0xbaac('0x21')]]);}}catch(_0x5aa75c){logger[_0xbaac('0x2d')](_0xbaac('0x2e'),util[_0xbaac('0x2f')](_0x5aa75c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0xe')]=function(_0x46e2d0){try{if(this[_0xbaac('0x30')](_0x46e2d0)){if(this['channels'][_0x46e2d0[_0xbaac('0x20')]]){for(var _0xea2a23 in this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]]){if(this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xbaac('0x31')](_0xea2a23)){if(_0x46e2d0['destuniqueid']===_0xea2a23){this[_0xbaac('0x6')][_0x46e2d0['uniqueid']][_0xea2a23][_0xbaac('0x32')]=moment()['format'](_0xbaac('0x33'));this[_0xbaac('0x6')][_0x46e2d0['uniqueid']][_0xea2a23]['lastevent']=_0xbaac('0x34');this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x35')]=_0x46e2d0['holdtime'];this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x36')]=_0x46e2d0[_0xbaac('0x36')];this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x37')]=_0x46e2d0[_0xbaac('0x37')];this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x38')]=_0x46e2d0['destchannelstate'];this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x39')]=_0x46e2d0[_0xbaac('0x39')];_['merge'](this[_0xbaac('0x8')][_0x46e2d0[_0xbaac('0x3a')]],_['pick'](_0x46e2d0,['queue',_0xbaac('0x3b')]));this['emit'](util['format']('user:%s',_0x46e2d0[_0xbaac('0x2c')]),'user:agentconnect',this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0x46e2d0[_0xbaac('0x21')]]);ami[_0xbaac('0x1e')](_0xbaac('0x3c'),this['channels'][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23]);}else if(!this['channels'][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0xf')]&&!this[_0xbaac('0x6')][_0x46e2d0['uniqueid']][_0xea2a23]['agentcomplete']){this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23]['agentringnoanswer']=!![];this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23]['agentringnoanswerAt']=moment()[_0xbaac('0x22')](_0xbaac('0x33'));this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x3d')]=_0xbaac('0x3e');this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x3f')]=_0xbaac('0x3e');this['channels'][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x40')]=_0x46e2d0[_0xbaac('0x21')];this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23][_0xbaac('0x41')]=_0x46e2d0[_0xbaac('0x2c')];ami[_0xbaac('0x1e')](_0xbaac('0x42'),this[_0xbaac('0x6')][_0x46e2d0[_0xbaac('0x20')]][_0xea2a23]);}}}}}}catch(_0x2beddf){logger[_0xbaac('0x2d')](_0xbaac('0x43'),util['inspect'](_0x2beddf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')]['syncAgentRingNoAnswer']=function(_0x4052d){try{if(this['isNotNull'](_0x4052d)){if(this[_0xbaac('0x6')][_0x4052d[_0xbaac('0x20')]]&&this[_0xbaac('0x6')][_0x4052d[_0xbaac('0x20')]][_0x4052d['destuniqueid']]){this[_0xbaac('0x6')][_0x4052d[_0xbaac('0x20')]][_0x4052d[_0xbaac('0x21')]]['agentringnoanswer']=!![];this[_0xbaac('0x6')][_0x4052d[_0xbaac('0x20')]][_0x4052d[_0xbaac('0x21')]][_0xbaac('0x44')]=moment()['format'](_0xbaac('0x33'));this[_0xbaac('0x6')][_0x4052d[_0xbaac('0x20')]][_0x4052d[_0xbaac('0x21')]]['reason']=_0xbaac('0x45');this['channels'][_0x4052d['uniqueid']][_0x4052d['destuniqueid']][_0xbaac('0x3f')]=_0xbaac('0x45');ami[_0xbaac('0x1e')](_0xbaac('0x46'),this[_0xbaac('0x6')][_0x4052d[_0xbaac('0x20')]][_0x4052d[_0xbaac('0x21')]]);}}}catch(_0x247701){logger[_0xbaac('0x2d')](_0xbaac('0x47'),util[_0xbaac('0x2f')](_0x247701,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x11')]=function(_0x2cbef6){try{if(this[_0xbaac('0x30')](_0x2cbef6)){if(this['channels'][_0x2cbef6['uniqueid']]){for(var _0x542b0f in this[_0xbaac('0x6')][_0x2cbef6['uniqueid']]){if(this[_0xbaac('0x6')][_0x2cbef6[_0xbaac('0x20')]][_0xbaac('0x31')](_0x542b0f)&&!this[_0xbaac('0x6')][_0x2cbef6[_0xbaac('0x20')]][_0x542b0f]['agentringnoanswer']&&!this[_0xbaac('0x6')][_0x2cbef6[_0xbaac('0x20')]][_0x542b0f]['agentcomplete']){this[_0xbaac('0x6')][_0x2cbef6['uniqueid']][_0x542b0f]['agentringnoanswer']=!![];this[_0xbaac('0x6')][_0x2cbef6[_0xbaac('0x20')]][_0x542b0f]['agentringnoanswerAt']=moment()[_0xbaac('0x22')](_0xbaac('0x33'));this['channels'][_0x2cbef6['uniqueid']][_0x542b0f][_0xbaac('0x3d')]=_0xbaac('0x48');this[_0xbaac('0x6')][_0x2cbef6[_0xbaac('0x20')]][_0x542b0f]['lastevent']=_0xbaac('0x48');ami[_0xbaac('0x1e')]('custom:agentqueuecallerabandon',this[_0xbaac('0x6')][_0x2cbef6[_0xbaac('0x20')]][_0x542b0f]);}}}}}catch(_0x386df7){logger[_0xbaac('0x2d')](_0xbaac('0x49'),util['inspect'](_0x386df7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbaac('0x13')]=function(_0x19f117){try{if(this[_0xbaac('0x30')](_0x19f117)){if(this[_0xbaac('0x6')][_0x19f117['uniqueid']]){for(var _0x1dd89c in this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]]){if(this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0xbaac('0x31')](_0x1dd89c)){if(this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0x1dd89c][_0xbaac('0x32')]&&!this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0x1dd89c][_0xbaac('0x12')]){this[_0xbaac('0x6')][_0x19f117['uniqueid']][_0x1dd89c][_0xbaac('0x12')]=!![];this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0x1dd89c][_0xbaac('0x4a')]=moment()['format'](_0xbaac('0x33'));this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0x1dd89c]['lastevent']=_0xbaac('0x4b');this[_0xbaac('0x6')][_0x19f117['uniqueid']][_0x1dd89c][_0xbaac('0x4c')]=_0x19f117[_0xbaac('0x4c')];this[_0xbaac('0x6')][_0x19f117['uniqueid']][_0x1dd89c]['reason']=_0x19f117[_0xbaac('0x3d')]==_0xbaac('0x4d')?_0xbaac('0x4e'):_0x19f117['reason'];if(this['voiceQueues'][_0x19f117[_0xbaac('0x24')]]&&this['voiceQueues'][_0x19f117[_0xbaac('0x24')]][_0xbaac('0x4f')]){this[_0xbaac('0x6')][_0x19f117['uniqueid']][_0x1dd89c]['agentacw']=!![];this['channels'][_0x19f117['uniqueid']][_0x1dd89c]['acwtime']=this[_0xbaac('0x7')][_0x19f117[_0xbaac('0x24')]][_0xbaac('0x50')];}this[_0xbaac('0x8')][_0x19f117[_0xbaac('0x3a')]]=_['omit'](this[_0xbaac('0x8')][_0x19f117['interface']],[_0xbaac('0x24'),_0xbaac('0x3b')]);this[_0xbaac('0x1e')](util['format'](_0xbaac('0x2b'),_0x19f117['membername']),_0xbaac('0x51'),this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0x1dd89c]);ami['emit'](_0xbaac('0x52'),this[_0xbaac('0x6')][_0x19f117[_0xbaac('0x20')]][_0x1dd89c]);}}}}}}catch(_0x2bc4dc){logger[_0xbaac('0x2d')](_0xbaac('0x53'),util['inspect'](_0x2bc4dc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')]['syncVarSet']=function(_0x34449a){try{if(this[_0xbaac('0x30')](_0x34449a)){this[_0xbaac('0x54')](_0x34449a[_0xbaac('0x20')],_[_0xbaac('0x55')](_0x34449a[_0xbaac('0x56')])[0x0],_0x34449a[_0xbaac('0x57')]);if(this['channels'][_0x34449a[_0xbaac('0x20')]]){for(var _0x3603ec in this[_0xbaac('0x6')][_0x34449a[_0xbaac('0x20')]]){if(this[_0xbaac('0x6')][_0x34449a['uniqueid']][_0xbaac('0x31')](_0x3603ec)){if(_['isUndefined'](this[_0xbaac('0x6')][_0x34449a['uniqueid']][_0x3603ec]['variables'])){this[_0xbaac('0x6')][_0x34449a[_0xbaac('0x20')]][_0x3603ec][_0xbaac('0x9')]={};}this[_0xbaac('0x6')][_0x34449a[_0xbaac('0x20')]][_0x3603ec][_0xbaac('0x9')]=this[_0xbaac('0x9')][_0x34449a['uniqueid']];}}}}}catch(_0x3ed149){logger[_0xbaac('0x2d')](_0xbaac('0x58'),util['inspect'](_0x3ed149,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x54')]=function(_0xd8b947,_0x57d4e6,_0x140716){var _0x38059f=['rtpaudioqos',_0xbaac('0x59'),_0xbaac('0x5a'),_0xbaac('0x5b'),_0xbaac('0x5c'),_0xbaac('0x5d'),_0xbaac('0x5e'),_0xbaac('0x5f'),_0xbaac('0x60'),'sipuri','bridgepeer',_0xbaac('0x61'),'membercalls','memberdynamic',_0xbaac('0x62'),_0xbaac('0x63'),_0xbaac('0x2c'),_0xbaac('0x64'),_0xbaac('0x65')];if(!_[_0xbaac('0x66')](_0x57d4e6)&&!_['includes'](_0x38059f,_0x57d4e6)){if(_[_0xbaac('0x1f')](this[_0xbaac('0x9')][_0xd8b947])){this[_0xbaac('0x9')][_0xd8b947]={};}this[_0xbaac('0x9')][_0xd8b947][_0x57d4e6]=_0x140716;}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x15')]=function(_0x110511){try{if(this['isNotNull'](_0x110511)){if(this[_0xbaac('0x6')][_0x110511[_0xbaac('0x20')]]){for(var _0x2918be in this[_0xbaac('0x6')][_0x110511[_0xbaac('0x20')]]){if(this[_0xbaac('0x6')][_0x110511[_0xbaac('0x20')]]['hasOwnProperty'](_0x2918be)){if(this['channels'][_0x110511[_0xbaac('0x20')]][_0x2918be]['reason']==_0xbaac('0x4d')&&this[_0xbaac('0x6')][_0x110511[_0xbaac('0x20')]][_0x2918be][_0xbaac('0x12')]){this[_0xbaac('0x6')][_0x110511[_0xbaac('0x20')]][_0x2918be][_0xbaac('0x4a')]=moment()['format'](_0xbaac('0x33'));}}}ami[_0xbaac('0x1e')]('custom:voiceAgentReport',_[_0xbaac('0x67')](this['channels'][_0x110511[_0xbaac('0x20')]]));delete this['channels'][_0x110511[_0xbaac('0x20')]];}if(this[_0xbaac('0x9')][_0x110511['uniqueid']]){delete this[_0xbaac('0x9')][_0x110511['uniqueid']];}}}catch(_0x4fe316){logger[_0xbaac('0x2d')](_0xbaac('0x68'),util[_0xbaac('0x2f')](_0x4fe316,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x1a')]=function(_0x5ad68a){try{if(this[_0xbaac('0x30')](_0x5ad68a)){if(this[_0xbaac('0x6')][_0x5ad68a['transfereeuniqueid']]){for(var _0x1cb1b0 in this[_0xbaac('0x6')][_0x5ad68a[_0xbaac('0x69')]]){if(this[_0xbaac('0x6')][_0x5ad68a[_0xbaac('0x69')]]['hasOwnProperty'](_0x1cb1b0)){if(_0x5ad68a[_0xbaac('0x6a')]===_0x1cb1b0){var _0x4f4acf=moment();this['channels'][_0x5ad68a[_0xbaac('0x69')]][_0x1cb1b0][_0xbaac('0x12')]=!![];this[_0xbaac('0x6')][_0x5ad68a[_0xbaac('0x69')]][_0x1cb1b0][_0xbaac('0x4a')]=moment()[_0xbaac('0x22')](_0xbaac('0x33'));this['channels'][_0x5ad68a[_0xbaac('0x69')]][_0x1cb1b0][_0xbaac('0x3d')]=_0xbaac('0x4d');this[_0xbaac('0x6')][_0x5ad68a['transfereeuniqueid']][_0x1cb1b0][_0xbaac('0x3f')]=_0xbaac('0x4b');this['channels'][_0x5ad68a['transfereeuniqueid']][_0x1cb1b0][_0xbaac('0x4c')]=_0x4f4acf[_0xbaac('0x6b')](this[_0xbaac('0x6')][_0x5ad68a['transfereeuniqueid']][_0x1cb1b0][_0xbaac('0x32')],'seconds');}}}}if(this['channels'][_0x5ad68a['secondtransfereruniqueid']]){var _0x5200b2=this[_0xbaac('0x6')][_0x5ad68a[_0xbaac('0x6c')]];this['channels'][_0x5ad68a[_0xbaac('0x6c')]]=this[_0xbaac('0x6')][_0x5ad68a['transfereeuniqueid']];this[_0xbaac('0x6')][_0x5ad68a[_0xbaac('0x69')]]=_0x5200b2;}}}catch(_0x4ecb08){logger['error'](_0xbaac('0x6d'),util['inspect'](_0x4ecb08,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x1c')]=function(_0x50f830){try{if(this[_0xbaac('0x30')](_0x50f830)){if(this['channels'][_0x50f830[_0xbaac('0x69')]]){for(var _0x505075 in this[_0xbaac('0x6')][_0x50f830['transfereeuniqueid']]){if(this['channels'][_0x50f830[_0xbaac('0x69')]][_0xbaac('0x31')](_0x505075)){if(_0x50f830[_0xbaac('0x6e')]===_0x505075){var _0x2f85ad=moment();this[_0xbaac('0x6')][_0x50f830['transfereeuniqueid']][_0x505075]['agentcomplete']=!![];this[_0xbaac('0x6')][_0x50f830[_0xbaac('0x69')]][_0x505075][_0xbaac('0x4a')]=_0x2f85ad;this[_0xbaac('0x6')][_0x50f830['transfereeuniqueid']][_0x505075][_0xbaac('0x3d')]=_0xbaac('0x4d');this[_0xbaac('0x6')][_0x50f830[_0xbaac('0x69')]][_0x505075][_0xbaac('0x3f')]='complete';this[_0xbaac('0x6')][_0x50f830[_0xbaac('0x69')]][_0x505075]['talktime']=_0x2f85ad[_0xbaac('0x6b')](this['channels'][_0x50f830[_0xbaac('0x69')]][_0x505075][_0xbaac('0x32')],_0xbaac('0x6f'));}}}}}}catch(_0x5d4fa8){logger[_0xbaac('0x2d')](_0xbaac('0x70'),util[_0xbaac('0x2f')](_0x5d4fa8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x24bbb6){var _0x56d7a1='';try{if(this[_0xbaac('0x30')](_0x24bbb6)){if(_0x24bbb6['channel']){_0x56d7a1=_0x24bbb6[_0xbaac('0x71')][_0xbaac('0x72')](0x0,_0x24bbb6[_0xbaac('0x71')][_0xbaac('0x73')]('-'));if(this[_0xbaac('0x8')][_0x56d7a1]){this[_0xbaac('0x8')][_0x56d7a1][_0xbaac('0x74')]=!![];}}}}catch(_0x33d0ce){logger[_0xbaac('0x2d')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0xbaac('0x2f')](_0x33d0ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbaac('0x1d')][_0xbaac('0x18')]=function(_0x56824a){var _0x99d8d9='';try{if(this[_0xbaac('0x30')](_0x56824a)){if(_0x56824a[_0xbaac('0x71')]){_0x99d8d9=_0x56824a['channel'][_0xbaac('0x72')](0x0,_0x56824a[_0xbaac('0x71')][_0xbaac('0x73')]('-'));if(this[_0xbaac('0x8')][_0x99d8d9]){this[_0xbaac('0x8')][_0x99d8d9][_0xbaac('0x74')]=![];}}}}catch(_0x220b45){logger[_0xbaac('0x2d')]('[syncMusicOnHoldStop][VoiceAgentReport]',util['inspect'](_0x220b45,{'showHidden':![],'depth':null}));}};module[_0xbaac('0x75')]=VoiceAgentReport; \ No newline at end of file +var _0x87c6=['destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','membername','custom:agentconnect','agentringnoanswer','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[syncAgentConnect][VoiceAgentReport]','inspect','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','agentcompleteAt','complete','talktime','acw','agentacw','acwtime','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','transfer','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','substring','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','agentcomplete','varset','hangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','event','privilege','custom:agentcalled','user:%s','user:called','error','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','format','lastevent','connect','holdtime','connectedlinenum','connectedlinename'];(function(_0x38db25,_0x51a7dd){var _0x1306ad=function(_0x5d4415){while(--_0x5d4415){_0x38db25['push'](_0x38db25['shift']());}};_0x1306ad(++_0x51a7dd);}(_0x87c6,0x144));var _0x687c=function(_0x36be41,_0x14b99d){_0x36be41=_0x36be41-0x0;var _0x2ef252=_0x87c6[_0x36be41];return _0x2ef252;};'use strict';var _=require(_0x687c('0x0'));var moment=require(_0x687c('0x1'));var util=require(_0x687c('0x2'));var Redis=require('ioredis');var config=require(_0x687c('0x3'));var logger=require(_0x687c('0x4'))(_0x687c('0x5'));var ami=require(_0x687c('0x6'));config[_0x687c('0x7')]=_['defaults'](config[_0x687c('0x7')],{'host':_0x687c('0x8'),'port':0x18eb});var io=require(_0x687c('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x196e83){this[_0x687c('0xa')]={};this[_0x687c('0xb')]=_0x196e83[_0x687c('0xb')];this[_0x687c('0xc')]=_0x196e83['agents'];this[_0x687c('0xd')]={};ami['on'](_0x687c('0xe'),this[_0x687c('0xf')]['bind'](this));ami['on'](_0x687c('0x10'),this[_0x687c('0x11')][_0x687c('0x12')](this));ami['on']('agentringnoanswer',this[_0x687c('0x13')][_0x687c('0x12')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x687c('0x12')](this));ami['on'](_0x687c('0x14'),this['syncAgentComplete'][_0x687c('0x12')](this));ami['on'](_0x687c('0x15'),this['syncVarSet'][_0x687c('0x12')](this));ami['on'](_0x687c('0x16'),this['syncHangup'][_0x687c('0x12')](this));ami['on']('musiconholdstart',this[_0x687c('0x17')][_0x687c('0x12')](this));ami['on'](_0x687c('0x18'),this[_0x687c('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x687c('0x1a')][_0x687c('0x12')](this));ami['on']('blindtransfer',this[_0x687c('0x1b')]['bind'](this));}VoiceAgentReport['prototype'][_0x687c('0x1c')]=function(_0x427be5,_0x12c0ac,_0x482c92){io['to'](_0x427be5)['emit'](_0x12c0ac,_0x482c92);};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x1e')]=function(_0x3703c2){return _0x3703c2!==null&&!_['isUndefined'](_0x3703c2);};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0xf')]=function(_0x26f24e){try{if(this[_0x687c('0x1e')](_0x26f24e)){if(_[_0x687c('0x1f')](this[_0x687c('0xa')][_0x26f24e[_0x687c('0x20')]])){this['channels'][_0x26f24e[_0x687c('0x20')]]={};}if(_[_0x687c('0x1f')](this[_0x687c('0xa')][_0x26f24e['uniqueid']][_0x26f24e[_0x687c('0x21')]])){this[_0x687c('0xa')][_0x26f24e[_0x687c('0x20')]][_0x26f24e[_0x687c('0x21')]]={'agentcalledAt':moment()['format'](_0x687c('0x22')),'lastevent':'called','variables':this['variables'][_0x26f24e[_0x687c('0x20')]],'type':this['voiceQueues'][_0x26f24e['queue']]?this[_0x687c('0xb')][_0x26f24e[_0x687c('0x23')]][_0x687c('0x24')]||_0x687c('0x25'):'inbound'};}_[_0x687c('0x26')](this[_0x687c('0xa')][_0x26f24e[_0x687c('0x20')]][_0x26f24e['destuniqueid']],_['omit'](_0x26f24e,[_0x687c('0x27'),_0x687c('0x28')]));ami[_0x687c('0x1c')](_0x687c('0x29'),this[_0x687c('0xa')][_0x26f24e[_0x687c('0x20')]][_0x26f24e[_0x687c('0x21')]]);this['emit'](util['format'](_0x687c('0x2a'),_0x26f24e['membername']),_0x687c('0x2b'),this[_0x687c('0xa')][_0x26f24e[_0x687c('0x20')]][_0x26f24e[_0x687c('0x21')]]);}}catch(_0x386154){logger[_0x687c('0x2c')](_0x687c('0x2d'),util['inspect'](_0x386154,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x687c('0x11')]=function(_0x55f886){try{if(this[_0x687c('0x1e')](_0x55f886)){if(this['channels'][_0x55f886[_0x687c('0x20')]]){for(var _0x1b9dfd in this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]]){if(this['channels'][_0x55f886[_0x687c('0x20')]][_0x687c('0x2e')](_0x1b9dfd)){if(_0x55f886['destuniqueid']===_0x1b9dfd){this['channels'][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x2f')]=moment()[_0x687c('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x31')]=_0x687c('0x32');this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd]['holdtime']=_0x55f886[_0x687c('0x33')];this['channels'][_0x55f886['uniqueid']][_0x1b9dfd]['connectedlinenum']=_0x55f886[_0x687c('0x34')];this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x35')]=_0x55f886[_0x687c('0x35')];this['channels'][_0x55f886['uniqueid']][_0x1b9dfd][_0x687c('0x36')]=_0x55f886[_0x687c('0x36')];this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x37')]=_0x55f886['destchannelstatedesc'];_[_0x687c('0x26')](this[_0x687c('0xc')][_0x55f886[_0x687c('0x38')]],_[_0x687c('0x39')](_0x55f886,['queue',_0x687c('0x3a')]));this[_0x687c('0x1c')](util[_0x687c('0x30')](_0x687c('0x2a'),_0x55f886[_0x687c('0x3b')]),'user:agentconnect',this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x55f886[_0x687c('0x21')]]);ami[_0x687c('0x1c')](_0x687c('0x3c'),this[_0x687c('0xa')][_0x55f886['uniqueid']][_0x1b9dfd]);}else if(!this[_0x687c('0xa')][_0x55f886['uniqueid']][_0x1b9dfd][_0x687c('0x3d')]&&!this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x14')]){this[_0x687c('0xa')][_0x55f886['uniqueid']][_0x1b9dfd][_0x687c('0x3d')]=!![];this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd]['agentringnoanswerAt']=moment()['format'](_0x687c('0x22'));this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x3e')]=_0x687c('0x3f');this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x31')]=_0x687c('0x3f');this[_0x687c('0xa')][_0x55f886['uniqueid']][_0x1b9dfd][_0x687c('0x40')]=_0x55f886[_0x687c('0x21')];this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd][_0x687c('0x41')]=_0x55f886[_0x687c('0x3b')];ami[_0x687c('0x1c')]('custom:agentansweredelsewhere',this[_0x687c('0xa')][_0x55f886[_0x687c('0x20')]][_0x1b9dfd]);}}}}}}catch(_0x205078){logger[_0x687c('0x2c')](_0x687c('0x42'),util[_0x687c('0x43')](_0x205078,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x13')]=function(_0x2cc8aa){try{if(this['isNotNull'](_0x2cc8aa)){if(this['channels'][_0x2cc8aa[_0x687c('0x20')]]&&this[_0x687c('0xa')][_0x2cc8aa[_0x687c('0x20')]][_0x2cc8aa[_0x687c('0x21')]]){this[_0x687c('0xa')][_0x2cc8aa[_0x687c('0x20')]][_0x2cc8aa['destuniqueid']][_0x687c('0x3d')]=!![];this[_0x687c('0xa')][_0x2cc8aa[_0x687c('0x20')]][_0x2cc8aa[_0x687c('0x21')]][_0x687c('0x44')]=moment()[_0x687c('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2cc8aa[_0x687c('0x20')]][_0x2cc8aa[_0x687c('0x21')]][_0x687c('0x3e')]=_0x687c('0x45');this[_0x687c('0xa')][_0x2cc8aa[_0x687c('0x20')]][_0x2cc8aa[_0x687c('0x21')]][_0x687c('0x31')]=_0x687c('0x45');ami['emit'](_0x687c('0x46'),this['channels'][_0x2cc8aa[_0x687c('0x20')]][_0x2cc8aa[_0x687c('0x21')]]);}}}catch(_0x3f90c4){logger[_0x687c('0x2c')](_0x687c('0x47'),util[_0x687c('0x43')](_0x3f90c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x48')]=function(_0x58568d){try{if(this['isNotNull'](_0x58568d)){if(this['channels'][_0x58568d[_0x687c('0x20')]]){for(var _0x33ced1 in this[_0x687c('0xa')][_0x58568d[_0x687c('0x20')]]){if(this[_0x687c('0xa')][_0x58568d[_0x687c('0x20')]][_0x687c('0x2e')](_0x33ced1)&&!this['channels'][_0x58568d['uniqueid']][_0x33ced1][_0x687c('0x3d')]&&!this['channels'][_0x58568d[_0x687c('0x20')]][_0x33ced1][_0x687c('0x14')]){this['channels'][_0x58568d['uniqueid']][_0x33ced1]['agentringnoanswer']=!![];this[_0x687c('0xa')][_0x58568d[_0x687c('0x20')]][_0x33ced1][_0x687c('0x44')]=moment()['format'](_0x687c('0x22'));this[_0x687c('0xa')][_0x58568d[_0x687c('0x20')]][_0x33ced1]['reason']=_0x687c('0x49');this[_0x687c('0xa')][_0x58568d[_0x687c('0x20')]][_0x33ced1][_0x687c('0x31')]='abandoned';ami[_0x687c('0x1c')](_0x687c('0x4a'),this[_0x687c('0xa')][_0x58568d[_0x687c('0x20')]][_0x33ced1]);}}}}}catch(_0x40a319){logger[_0x687c('0x2c')](_0x687c('0x4b'),util[_0x687c('0x43')](_0x40a319,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x687c('0x4c')]=function(_0x508245){try{if(this['isNotNull'](_0x508245)){if(this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]]){for(var _0x296930 in this[_0x687c('0xa')][_0x508245['uniqueid']]){if(this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]][_0x687c('0x2e')](_0x296930)){if(this['channels'][_0x508245['uniqueid']][_0x296930][_0x687c('0x2f')]&&!this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]][_0x296930]['agentcomplete']){this[_0x687c('0xa')][_0x508245['uniqueid']][_0x296930][_0x687c('0x14')]=!![];this[_0x687c('0xa')][_0x508245['uniqueid']][_0x296930][_0x687c('0x4d')]=moment()[_0x687c('0x30')](_0x687c('0x22'));this[_0x687c('0xa')][_0x508245['uniqueid']][_0x296930][_0x687c('0x31')]=_0x687c('0x4e');this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]][_0x296930]['talktime']=_0x508245[_0x687c('0x4f')];this['channels'][_0x508245[_0x687c('0x20')]][_0x296930]['reason']=_0x508245[_0x687c('0x3e')]=='transfer'?'agent':_0x508245[_0x687c('0x3e')];if(this[_0x687c('0xb')][_0x508245[_0x687c('0x23')]]&&this[_0x687c('0xb')][_0x508245[_0x687c('0x23')]][_0x687c('0x50')]){this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]][_0x296930][_0x687c('0x51')]=!![];this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]][_0x296930][_0x687c('0x52')]=this['voiceQueues'][_0x508245[_0x687c('0x23')]]['acwTimeout'];}this[_0x687c('0xc')][_0x508245['interface']]=_[_0x687c('0x53')](this['agents'][_0x508245['interface']],[_0x687c('0x23'),'destconnectedlinenum']);this[_0x687c('0x1c')](util[_0x687c('0x30')](_0x687c('0x2a'),_0x508245[_0x687c('0x3b')]),_0x687c('0x54'),this['channels'][_0x508245[_0x687c('0x20')]][_0x296930]);ami['emit'](_0x687c('0x55'),this[_0x687c('0xa')][_0x508245[_0x687c('0x20')]][_0x296930]);}}}}}}catch(_0x45de7f){logger['error'](_0x687c('0x56'),util['inspect'](_0x45de7f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x57')]=function(_0x5015d2){try{if(this[_0x687c('0x1e')](_0x5015d2)){this[_0x687c('0x58')](_0x5015d2[_0x687c('0x20')],_[_0x687c('0x59')](_0x5015d2[_0x687c('0x5a')])[0x0],_0x5015d2[_0x687c('0x5b')]);if(this[_0x687c('0xa')][_0x5015d2[_0x687c('0x20')]]){for(var _0x2d1f18 in this[_0x687c('0xa')][_0x5015d2[_0x687c('0x20')]]){if(this[_0x687c('0xa')][_0x5015d2[_0x687c('0x20')]]['hasOwnProperty'](_0x2d1f18)){if(_['isUndefined'](this[_0x687c('0xa')][_0x5015d2['uniqueid']][_0x2d1f18][_0x687c('0xd')])){this[_0x687c('0xa')][_0x5015d2[_0x687c('0x20')]][_0x2d1f18][_0x687c('0xd')]={};}this['channels'][_0x5015d2[_0x687c('0x20')]][_0x2d1f18][_0x687c('0xd')]=this[_0x687c('0xd')][_0x5015d2[_0x687c('0x20')]];}}}}}catch(_0x36919e){logger[_0x687c('0x2c')](_0x687c('0x5c'),util[_0x687c('0x43')](_0x36919e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x687c('0x58')]=function(_0x4a35a1,_0x181816,_0x1baf7c){var _0x132d06=[_0x687c('0x5d'),_0x687c('0x5e'),_0x687c('0x5f'),'rtpaudioqosjitterbridged',_0x687c('0x60'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x687c('0x61'),_0x687c('0x62'),_0x687c('0x63'),_0x687c('0x64'),_0x687c('0x65'),'membercalls',_0x687c('0x66'),_0x687c('0x67'),_0x687c('0x68'),_0x687c('0x3b'),_0x687c('0x69'),_0x687c('0x6a')];if(!_[_0x687c('0x6b')](_0x181816)&&!_['includes'](_0x132d06,_0x181816)){if(_[_0x687c('0x1f')](this['variables'][_0x4a35a1])){this[_0x687c('0xd')][_0x4a35a1]={};}this[_0x687c('0xd')][_0x4a35a1][_0x181816]=_0x1baf7c;}};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x6c')]=function(_0x44a5a1){try{if(this[_0x687c('0x1e')](_0x44a5a1)){if(this[_0x687c('0xa')][_0x44a5a1['uniqueid']]){for(var _0x401ecd in this[_0x687c('0xa')][_0x44a5a1[_0x687c('0x20')]]){if(this[_0x687c('0xa')][_0x44a5a1['uniqueid']][_0x687c('0x2e')](_0x401ecd)){if(this['channels'][_0x44a5a1[_0x687c('0x20')]][_0x401ecd]['reason']==_0x687c('0x6d')&&this[_0x687c('0xa')][_0x44a5a1[_0x687c('0x20')]][_0x401ecd]['agentcomplete']){this[_0x687c('0xa')][_0x44a5a1[_0x687c('0x20')]][_0x401ecd][_0x687c('0x4d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x687c('0x1c')](_0x687c('0x6e'),_[_0x687c('0x6f')](this[_0x687c('0xa')][_0x44a5a1[_0x687c('0x20')]]));delete this[_0x687c('0xa')][_0x44a5a1[_0x687c('0x20')]];}if(this[_0x687c('0xd')][_0x44a5a1[_0x687c('0x20')]]){delete this['variables'][_0x44a5a1[_0x687c('0x20')]];}}}catch(_0x5eb504){logger['error']('[syncHangup][VoiceAgentReport]',util[_0x687c('0x43')](_0x5eb504,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x687c('0x1d')]['syncAttendedTransfer']=function(_0x534485){try{if(this[_0x687c('0x1e')](_0x534485)){if(this['channels'][_0x534485[_0x687c('0x70')]]){for(var _0x5a1d9f in this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]]){if(this[_0x687c('0xa')][_0x534485['transfereeuniqueid']][_0x687c('0x2e')](_0x5a1d9f)){if(_0x534485[_0x687c('0x71')]===_0x5a1d9f){var _0x2f1c2c=moment();this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]][_0x5a1d9f]['agentcomplete']=!![];this['channels'][_0x534485[_0x687c('0x70')]][_0x5a1d9f][_0x687c('0x4d')]=moment()[_0x687c('0x30')](_0x687c('0x22'));this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]][_0x5a1d9f][_0x687c('0x3e')]=_0x687c('0x6d');this[_0x687c('0xa')][_0x534485['transfereeuniqueid']][_0x5a1d9f][_0x687c('0x31')]=_0x687c('0x4e');this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]][_0x5a1d9f][_0x687c('0x4f')]=_0x2f1c2c[_0x687c('0x72')](this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]][_0x5a1d9f][_0x687c('0x2f')],_0x687c('0x73'));}}}}if(this[_0x687c('0xa')][_0x534485[_0x687c('0x74')]]){var _0x21c741=this[_0x687c('0xa')][_0x534485[_0x687c('0x74')]];this[_0x687c('0xa')][_0x534485[_0x687c('0x74')]]=this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]];this[_0x687c('0xa')][_0x534485[_0x687c('0x70')]]=_0x21c741;}}}catch(_0x41a878){logger[_0x687c('0x2c')](_0x687c('0x75'),util['inspect'](_0x41a878,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x1b')]=function(_0x1654d8){try{if(this['isNotNull'](_0x1654d8)){if(this[_0x687c('0xa')][_0x1654d8[_0x687c('0x70')]]){for(var _0x358149 in this['channels'][_0x1654d8[_0x687c('0x70')]]){if(this[_0x687c('0xa')][_0x1654d8[_0x687c('0x70')]][_0x687c('0x2e')](_0x358149)){if(_0x1654d8[_0x687c('0x76')]===_0x358149){var _0x4a9fbb=moment();this[_0x687c('0xa')][_0x1654d8['transfereeuniqueid']][_0x358149][_0x687c('0x14')]=!![];this[_0x687c('0xa')][_0x1654d8[_0x687c('0x70')]][_0x358149]['agentcompleteAt']=_0x4a9fbb;this['channels'][_0x1654d8['transfereeuniqueid']][_0x358149][_0x687c('0x3e')]=_0x687c('0x6d');this['channels'][_0x1654d8[_0x687c('0x70')]][_0x358149][_0x687c('0x31')]=_0x687c('0x4e');this['channels'][_0x1654d8[_0x687c('0x70')]][_0x358149][_0x687c('0x4f')]=_0x4a9fbb[_0x687c('0x72')](this[_0x687c('0xa')][_0x1654d8[_0x687c('0x70')]][_0x358149][_0x687c('0x2f')],_0x687c('0x73'));}}}}}}catch(_0x5f5bf7){logger[_0x687c('0x2c')](_0x687c('0x77'),util[_0x687c('0x43')](_0x5f5bf7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x687c('0x17')]=function(_0x3087ac){var _0x66d31d='';try{if(this['isNotNull'](_0x3087ac)){if(_0x3087ac['channel']){_0x66d31d=_0x3087ac[_0x687c('0x78')]['substring'](0x0,_0x3087ac[_0x687c('0x78')]['lastIndexOf']('-'));if(this[_0x687c('0xc')][_0x66d31d]){this[_0x687c('0xc')][_0x66d31d][_0x687c('0x79')]=!![];}}}}catch(_0x2dc02e){logger[_0x687c('0x2c')](_0x687c('0x7a'),util[_0x687c('0x43')](_0x2dc02e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x687c('0x1d')][_0x687c('0x19')]=function(_0x3e4a42){var _0x1adb4e='';try{if(this[_0x687c('0x1e')](_0x3e4a42)){if(_0x3e4a42['channel']){_0x1adb4e=_0x3e4a42[_0x687c('0x78')][_0x687c('0x7b')](0x0,_0x3e4a42[_0x687c('0x78')]['lastIndexOf']('-'));if(this[_0x687c('0xc')][_0x1adb4e]){this['agents'][_0x1adb4e][_0x687c('0x79')]=![];}}}}catch(_0x3c086b){logger['error'](_0x687c('0x7c'),util['inspect'](_0x3c086b,{'showHidden':![],'depth':null}));}};module[_0x687c('0x7d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ea4abd0..8d3f9ab 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 _0x1650=['path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','keys','error','inspect','syncNewChannel','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','user:%s','name','user:agentconnect','accountcode','exten','application','applicationdata','appdata','toLowerCase','subtract','duration','seconds','disposition','includes','lastapplication','lastdata','startsWith','match','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','rec','value','variable','xmd-callerid','callerid','xmd-cdrtype','type','queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','xmcs-queue','sipcallid','mixmonitor_filename','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','answertime','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','transfertargetuniqueid','origtransferercalleridnum','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','util'];(function(_0x925258,_0x31e6da){var _0x74876f=function(_0x4ba0f4){while(--_0x4ba0f4){_0x925258['push'](_0x925258['shift']());}};_0x74876f(++_0x31e6da);}(_0x1650,0x13d));var _0x0165=function(_0x5ce268,_0x1835b6){_0x5ce268=_0x5ce268-0x0;var _0x28c96a=_0x1650[_0x5ce268];return _0x28c96a;};'use strict';var BPromise=require(_0x0165('0x0'));var _=require('lodash');var moment=require(_0x0165('0x1'));var util=require(_0x0165('0x2'));var path=require(_0x0165('0x3'));var Redis=require(_0x0165('0x4'));var config=require(_0x0165('0x5'));var logger=require(_0x0165('0x6'))('ami');var ami=require(_0x0165('0x7'));var Channel=require(_0x0165('0x8'));var statusDesc=[_0x0165('0x9'),_0x0165('0xa'),'inuse',_0x0165('0xb'),_0x0165('0xc'),_0x0165('0xd'),_0x0165('0xe'),_0x0165('0xf'),_0x0165('0x10')];var applications=[_0x0165('0x11'),'queue','agi',_0x0165('0x12'),_0x0165('0x13'),_0x0165('0x14')];var dispositions=[_0x0165('0x15'),'FAILED','FAILED',_0x0165('0x15'),_0x0165('0x15'),'NO\x20ANSWER',_0x0165('0x16'),_0x0165('0x17'),_0x0165('0x18'),_0x0165('0x18'),_0x0165('0x18')];var actions={};config[_0x0165('0x19')]=_[_0x0165('0x1a')](config[_0x0165('0x19')],{'host':_0x0165('0x1b'),'port':0x18eb});var io=require(_0x0165('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x26f0a7){this[_0x0165('0x1d')]=_0x26f0a7['channels'];this[_0x0165('0x1e')]=_0x26f0a7['agents'];ami['on'](_0x0165('0x1f'),this[_0x0165('0x20')][_0x0165('0x21')](this));ami['on'](_0x0165('0x22'),this['syncNewExten']['bind'](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on']('newstate',this[_0x0165('0x23')][_0x0165('0x21')](this));ami['on'](_0x0165('0x24'),this[_0x0165('0x25')][_0x0165('0x21')](this));ami['on'](_0x0165('0x26'),this[_0x0165('0x27')][_0x0165('0x21')](this));ami['on'](_0x0165('0x28'),this[_0x0165('0x29')][_0x0165('0x21')](this));ami['on'](_0x0165('0x2a'),this[_0x0165('0x2b')][_0x0165('0x21')](this));ami['on'](_0x0165('0x2c'),this[_0x0165('0x2d')][_0x0165('0x21')](this));ami['on'](_0x0165('0x2e'),this[_0x0165('0x2f')]['bind'](this));ami['on'](_0x0165('0x30'),this['syncMusicOnHoldStop'][_0x0165('0x21')](this));return BPromise[_0x0165('0x31')]()[_0x0165('0x32')](ami[_0x0165('0x33')]())[_0x0165('0x34')](function(_0x37bf6a){console[_0x0165('0x35')](_0x37bf6a);});}VoiceCallReport[_0x0165('0x36')][_0x0165('0x37')]=function(_0x7c165e){return _0x7c165e!==null&&!_[_0x0165('0x38')](_0x7c165e);};VoiceCallReport['prototype']['emit']=function(_0x21d641,_0x268ac6,_0x28793c){io['to'](_0x21d641)[_0x0165('0x39')](_0x268ac6,_0x28793c);};VoiceCallReport[_0x0165('0x36')][_0x0165('0x29')]=function(_0xeb94e8){try{if(this[_0x0165('0x37')](_0xeb94e8)){if(_0xeb94e8[_0x0165('0x3a')]===_0xeb94e8[_0x0165('0x3b')]){if(!_[_0x0165('0x38')](this[_0x0165('0x1d')][_0xeb94e8[_0x0165('0x3a')]])){_[_0x0165('0x3c')](this[_0x0165('0x1d')][_0xeb94e8[_0x0165('0x3a')]],_[_0x0165('0x3d')](_0xeb94e8,_[_0x0165('0x3e')](this['channels'][_0xeb94e8[_0x0165('0x3a')]])));}}}}catch(_0x279e43){logger[_0x0165('0x3f')]('[syncNewCallerId][VoiceCallReport]',util[_0x0165('0x40')](_0x279e43,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x41')]=function(_0xc06756){try{if(this[_0x0165('0x37')](_0xc06756)){if(_0xc06756[_0x0165('0x3a')]===_0xc06756[_0x0165('0x3b')]&&_0xc06756[_0x0165('0x42')]!=_0x0165('0x43')){if(_[_0x0165('0x38')](this[_0x0165('0x1d')][_0xc06756[_0x0165('0x3a')]])){this[_0x0165('0x1d')][_0xc06756[_0x0165('0x3a')]]=new Channel();this['channels'][_0xc06756[_0x0165('0x3a')]][_0x0165('0x44')]=moment()[_0x0165('0x45')](_0x0165('0x46'));this[_0x0165('0x1d')][_0xc06756['uniqueid']]['disposition']=dispositions[_[_0x0165('0x47')](_0xc06756[_0x0165('0x48')])];_['merge'](this[_0x0165('0x1d')][_0xc06756[_0x0165('0x3a')]],_[_0x0165('0x3d')](_0xc06756,_[_0x0165('0x3e')](this[_0x0165('0x1d')][_0xc06756[_0x0165('0x3a')]])));if(_0xc06756[_0x0165('0x49')]===_0x0165('0x4a')){if(this[_0x0165('0x1e')][_0xc06756[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]]){this[_0x0165('0x1e')][_0xc06756[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]][_0x0165('0x4c')]=_0xc06756['exten'];this[_0x0165('0x39')](util['format'](_0x0165('0x4d'),this[_0x0165('0x1e')][_0xc06756[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]][_0x0165('0x4e')]),_0x0165('0x4f'),{'destaccountcode':this[_0x0165('0x1e')][_0xc06756[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]][_0x0165('0x50')],'destconnectedlinenum':_0xc06756[_0x0165('0x51')]});}}}}}}catch(_0x4b27da){logger[_0x0165('0x3f')]('[syncNewChannel][VoiceCallReport]',util[_0x0165('0x40')](_0x4b27da,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')]['syncNewExten']=function(_0x346d00){try{if(this[_0x0165('0x37')](_0x346d00)){if(_0x346d00[_0x0165('0x3a')]===_0x346d00['linkedid']&&_0x346d00['exten']!='h'&&_0x346d00['channel']!=_0x0165('0x43')){_0x346d00['application']=_0x346d00[_0x0165('0x52')]['toLowerCase']();_0x346d00[_0x0165('0x53')]=(_0x346d00[_0x0165('0x54')]||_0x346d00[_0x0165('0x53')])[_0x0165('0x55')]();if(_[_0x0165('0x38')](this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]])){this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]]=new Channel();this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]]['starttime']=_0x346d00['duration']?moment()[_0x0165('0x56')](moment['duration'](_0x346d00[_0x0165('0x57')])[_0x0165('0x58')](),_0x0165('0x58'))[_0x0165('0x45')](_0x0165('0x46')):moment()[_0x0165('0x45')](_0x0165('0x46'));this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]][_0x0165('0x59')]='NO\x20ANSWER';}_[_0x0165('0x3c')](this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]],_[_0x0165('0x3d')](_0x346d00,_[_0x0165('0x3e')](this[_0x0165('0x1d')][_0x346d00['uniqueid']])));if(_[_0x0165('0x5a')](applications,_0x346d00[_0x0165('0x52')])){this[_0x0165('0x1d')][_0x346d00['uniqueid']][_0x0165('0x5b')]=_0x346d00['application'];this[_0x0165('0x1d')][_0x346d00['uniqueid']][_0x0165('0x5c')]=_0x346d00[_0x0165('0x53')];if(_0x346d00['application']===_0x0165('0x11')&&_[_0x0165('0x5d')](_0x346d00[_0x0165('0x53')],'cdr(')){var _0x21727d=_0x346d00[_0x0165('0x53')]['split']('=');var _0x183dcb=_0x21727d[0x0][_0x0165('0x5e')](/cdr\((.*)\)/);if(_0x183dcb){this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]][_0x183dcb[0x1]]=_0x21727d[0x1];}}else if(_0x346d00[_0x0165('0x52')]==='queue'){this[_0x0165('0x1d')][_0x346d00[_0x0165('0x3a')]]['queue']=_0x346d00[_0x0165('0x53')]['split'](',')[0x0];}}}}}catch(_0x1fe0de){logger['error'](_0x0165('0x5f'),util[_0x0165('0x40')](_0x1fe0de,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x23')]=function(_0x2e632d){try{if(this[_0x0165('0x37')](_0x2e632d)){if(_0x2e632d['uniqueid']!==_0x2e632d['linkedid']){if(this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]]){if(_0x2e632d[_0x0165('0x48')]==='6'){if(!this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x60')]){var _0x2ab8a1=moment();this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]]['answered']=!![];this[_0x0165('0x1d')][_0x2e632d['linkedid']]['answertime']=_0x2ab8a1[_0x0165('0x45')](_0x0165('0x46'));if(this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]]['starttime']){this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x61')]=_0x2ab8a1[_0x0165('0x62')](this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x44')],_0x0165('0x58'));}}this['channels'][_0x2e632d['linkedid']][_0x0165('0x3b')]=_0x2e632d[_0x0165('0x3a')];if(_0x2e632d[_0x0165('0x63')]!==_0x0165('0x64')){this['channels'][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x65')]=_0x2e632d['calleridnum'];}this['channels'][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x66')]=_0x2e632d[_0x0165('0x67')];this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x68')]=_0x2e632d[_0x0165('0x42')];this['channels'][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x59')]=dispositions[_[_0x0165('0x47')](_0x2e632d['channelstate'])];if(this['agents'][_0x2e632d[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]]){this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x69')]=this[_0x0165('0x1e')][_0x2e632d[_0x0165('0x42')]['split']('-')[0x0]]['id'];this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3b')]][_0x0165('0x6a')]=this[_0x0165('0x1e')][_0x2e632d[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]][_0x0165('0x4e')];}}}}else{if(this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3a')]]){if(_0x2e632d[_0x0165('0x48')]==='6'){if(this[_0x0165('0x1e')][_0x2e632d['channel']['split']('-')[0x0]]){this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3a')]][_0x0165('0x69')]=this[_0x0165('0x1e')][_0x2e632d[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]]['id'];this[_0x0165('0x1d')][_0x2e632d[_0x0165('0x3a')]][_0x0165('0x6a')]=this[_0x0165('0x1e')][_0x2e632d[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]][_0x0165('0x4e')];}}}}}}catch(_0x2ec698){logger[_0x0165('0x3f')](_0x0165('0x6b'),util[_0x0165('0x40')](_0x2ec698,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x6c')]=function(_0x5d3d17,_0x1f9dd9){if(this[_0x0165('0x1d')][_0x5d3d17]){this['channels'][_0x5d3d17][_0x0165('0x6d')]=!![];if(_[_0x0165('0x6e')](_0x1f9dd9,_0x0165('0x6f'))){_0x1f9dd9=_0x1f9dd9[_0x0165('0x70')](_0x0165('0x6f'),_0x0165('0x71'));}this[_0x0165('0x1d')][_0x5d3d17][_0x0165('0x72')]=_0x1f9dd9;var _0x4a1e64=_['find'](this['channels'][_0x5d3d17]['monitors'],{'filename':_0x1f9dd9});if(_['isNil'](_0x4a1e64)){this['channels'][_0x5d3d17][_0x0165('0x73')]['push']({'filename':_0x1f9dd9,'createdAt':moment()[_0x0165('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0165('0x74')});}}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x25')]=function(_0x3bf543){try{if(this[_0x0165('0x37')](_0x3bf543)){if(this[_0x0165('0x1d')][_0x3bf543[_0x0165('0x3a')]]&&_0x3bf543[_0x0165('0x42')]!=_0x0165('0x43')){if(this['isNotNull'](_0x3bf543['variable'])){if(this['isNotNull'](_0x3bf543['variable']['mixmonitor_filename'])){this['syncMixMonitorFilename'](_0x3bf543['uniqueid'],_0x3bf543[_0x0165('0x75')]);}else if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')]['xmd-phone'])){this['channels'][_0x3bf543['uniqueid']][_0x0165('0x63')]=_0x3bf543[_0x0165('0x75')];}else if(this[_0x0165('0x37')](_0x3bf543['variable'][_0x0165('0x77')])){this[_0x0165('0x1d')][_0x3bf543[_0x0165('0x3a')]][_0x0165('0x78')]=_0x3bf543['value'];}else if(this['isNotNull'](_0x3bf543['variable'][_0x0165('0x79')])){this['channels'][_0x3bf543[_0x0165('0x3a')]][_0x0165('0x7a')]=_0x3bf543[_0x0165('0x75')];}else if(this[_0x0165('0x37')](_0x3bf543['variable']['xmd-queue'])){this[_0x0165('0x1d')][_0x3bf543[_0x0165('0x3a')]][_0x0165('0x7b')]=_0x3bf543['value'][_0x0165('0x4b')](',')[0x0];}else if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')][_0x0165('0x7c')])){this['channels'][_0x3bf543[_0x0165('0x3a')]]['originatecalleridnum']=_0x3bf543[_0x0165('0x75')];}else if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')][_0x0165('0x7d')])){this[_0x0165('0x1d')][_0x3bf543['uniqueid']][_0x0165('0x7e')]=_0x3bf543[_0x0165('0x75')];}else if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')][_0x0165('0x7f')])){this[_0x0165('0x1d')][_0x3bf543[_0x0165('0x3a')]]['calleridpreview']=_0x3bf543[_0x0165('0x75')];}else if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')][_0x0165('0x80')])){this[_0x0165('0x1d')][_0x3bf543['uniqueid']][_0x0165('0x7b')]=_0x3bf543[_0x0165('0x75')];}else if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')][_0x0165('0x81')])){this[_0x0165('0x1d')][_0x3bf543[_0x0165('0x3a')]]['sipcalluniqueid']=_0x3bf543[_0x0165('0x75')];}}}else if(this[_0x0165('0x37')](_0x3bf543['variable'][_0x0165('0x82')])){if(_0x3bf543[_0x0165('0x75')]){var _0x2613f7=path[_0x0165('0x83')](_0x3bf543[_0x0165('0x75')])[_0x0165('0x4e')];this['syncMixMonitorFilename'](_0x2613f7,_0x3bf543['value']);}}else if(this[_0x0165('0x1d')][_0x3bf543[_0x0165('0x3b')]]){if(this[_0x0165('0x37')](_0x3bf543['variable'])){if(this[_0x0165('0x37')](_0x3bf543[_0x0165('0x76')][_0x0165('0x81')])){this[_0x0165('0x1d')][_0x3bf543['linkedid']][_0x0165('0x84')]=_0x3bf543[_0x0165('0x75')];}}}}}catch(_0xceac00){logger[_0x0165('0x3f')](_0x0165('0x85'),util['inspect'](_0xceac00,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0165('0x27')]=function(_0x417d3f){try{if(this[_0x0165('0x37')](_0x417d3f)){if(this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]]){var _0x43859e=moment();this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x86')]=_0x43859e[_0x0165('0x45')](_0x0165('0x46'));this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x57')]=_0x43859e['diff'](this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]]['starttime'],_0x0165('0x58'));if(this['channels'][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x60')]){this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x87')]=_0x43859e[_0x0165('0x62')](this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x88')],_0x0165('0x58'));this['channels'][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x61')]=this[_0x0165('0x1d')][_0x417d3f['uniqueid']][_0x0165('0x57')]-this[_0x0165('0x1d')][_0x417d3f[_0x0165('0x3a')]][_0x0165('0x87')];}if(_0x417d3f['context']==='from-sip'){if(this[_0x0165('0x1e')][_0x417d3f[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]]){this[_0x0165('0x1e')][_0x417d3f[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]]=_['omit'](this[_0x0165('0x1e')][_0x417d3f['channel'][_0x0165('0x4b')]('-')[0x0]],[_0x0165('0x4c')]);this['emit'](util[_0x0165('0x45')](_0x0165('0x4d'),this[_0x0165('0x1e')][_0x417d3f[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]]['name']),_0x0165('0x89'),{'destaccountcode':this[_0x0165('0x1e')][_0x417d3f[_0x0165('0x42')][_0x0165('0x4b')]('-')[0x0]][_0x0165('0x50')]});}}ami['emit'](_0x0165('0x8a'),this['channels'][_0x417d3f[_0x0165('0x3a')]]);delete this['channels'][_0x417d3f[_0x0165('0x3a')]];}}}catch(_0x5562d9){logger[_0x0165('0x3f')](_0x0165('0x8b'),util[_0x0165('0x40')](_0x5562d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')]['syncAttendedTransfer']=function(_0x371b43){try{if(this['isNotNull'](_0x371b43)){if(this[_0x0165('0x1d')][_0x371b43[_0x0165('0x8c')]]){this[_0x0165('0x1d')][_0x371b43[_0x0165('0x8c')]][_0x0165('0x8d')]=_0x371b43['origtransferercalleridnum'];this[_0x0165('0x1d')][_0x371b43['transfereeuniqueid']]['transferconnectedlinenum']=_0x371b43[_0x0165('0x8e')];if(this[_0x0165('0x1d')][_0x371b43['secondtransfereruniqueid']]){var _0x39b26e=this[_0x0165('0x1d')][_0x371b43['secondtransfereruniqueid']];this[_0x0165('0x1d')][_0x371b43['secondtransfereruniqueid']]=this[_0x0165('0x1d')][_0x371b43[_0x0165('0x8c')]];this[_0x0165('0x1d')][_0x371b43[_0x0165('0x8c')]]=_0x39b26e;}}else if(this[_0x0165('0x1d')][_0x371b43['transfertargetuniqueid']]){this[_0x0165('0x1d')][_0x371b43[_0x0165('0x8f')]][_0x0165('0x8d')]=_0x371b43[_0x0165('0x90')];this[_0x0165('0x1d')][_0x371b43[_0x0165('0x8f')]][_0x0165('0x91')]=_0x371b43['transfertargetcalleridnum'];if(this[_0x0165('0x1d')][_0x371b43[_0x0165('0x92')]]){var _0x39b26e=this[_0x0165('0x1d')][_0x371b43[_0x0165('0x92')]];this[_0x0165('0x1d')][_0x371b43[_0x0165('0x92')]]=this[_0x0165('0x1d')][_0x371b43['transfertargetuniqueid']];this[_0x0165('0x1d')][_0x371b43['transfertargetuniqueid']]=_0x39b26e;}}}}catch(_0x45b178){logger[_0x0165('0x3f')](_0x0165('0x93'),util[_0x0165('0x40')](_0x45b178,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x2d')]=function(_0x582b05){try{if(this[_0x0165('0x37')](_0x582b05)){if(this[_0x0165('0x1d')][_0x582b05[_0x0165('0x8c')]]){this[_0x0165('0x1d')][_0x582b05[_0x0165('0x8c')]][_0x0165('0x8d')]=_0x582b05[_0x0165('0x94')];this[_0x0165('0x1d')][_0x582b05[_0x0165('0x8c')]][_0x0165('0x91')]=_0x582b05[_0x0165('0x95')];this[_0x0165('0x27')]({'event':_0x0165('0x96'),'uniqueid':_0x582b05[_0x0165('0x8c')],'context':_0x582b05[_0x0165('0x49')],'channel':_0x582b05[_0x0165('0x97')]});}}}catch(_0x2251cd){logger[_0x0165('0x3f')](_0x0165('0x98'),util[_0x0165('0x40')](_0x2251cd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x2f')]=function(_0x2e9d28){try{if(this[_0x0165('0x37')](_0x2e9d28)){if(this[_0x0165('0x1d')][_0x2e9d28[_0x0165('0x3a')]]){if(!_[_0x0165('0x99')](this[_0x0165('0x1d')][_0x2e9d28[_0x0165('0x3a')]][_0x0165('0x88')])){this[_0x0165('0x1d')][_0x2e9d28['uniqueid']][_0x0165('0x9a')]=moment()[_0x0165('0x45')](_0x0165('0x46'));}}}}catch(_0x977b04){logger[_0x0165('0x3f')](_0x0165('0x9b'),util[_0x0165('0x40')](_0x977b04,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0165('0x36')][_0x0165('0x9c')]=function(_0x576ecf){try{if(this['isNotNull'](_0x576ecf)){if(this['channels'][_0x576ecf[_0x0165('0x3a')]]){if(!_[_0x0165('0x99')](this[_0x0165('0x1d')][_0x576ecf[_0x0165('0x3a')]][_0x0165('0x9a')])){this[_0x0165('0x1d')][_0x576ecf[_0x0165('0x3a')]]['mohtime']+=moment()[_0x0165('0x9d')](0x0)[_0x0165('0x62')](this[_0x0165('0x1d')][_0x576ecf['uniqueid']][_0x0165('0x9a')],_0x0165('0x58'));delete this[_0x0165('0x1d')][_0x576ecf[_0x0165('0x3a')]][_0x0165('0x9a')];}}}}catch(_0x1582e6){logger[_0x0165('0x3f')](_0x0165('0x9e'),util[_0x0165('0x40')](_0x1582e6,{'showHidden':![],'depth':null}));}};module[_0x0165('0x9f')]=VoiceCallReport; \ No newline at end of file +var _0x1a96=['coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','resolve','then','actionCoreShowChannels','catch','log','prototype','emit','isNotNull','uniqueid','isUndefined','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','linkedid','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','merge','context','split','exten','format','user:%s','name','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','duration','seconds','includes','lastapplication','set','startsWith','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','variable','mixmonitor_filename','value','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','diff','billableseconds','from-sip','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStop','isNil','mohtime','mohstarttime','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents'];(function(_0x2331e7,_0x52f8ab){var _0xf956f8=function(_0x5a4d2c){while(--_0x5a4d2c){_0x2331e7['push'](_0x2331e7['shift']());}};_0xf956f8(++_0x52f8ab);}(_0x1a96,0x1a3));var _0x61a9=function(_0x94d4d7,_0x33c5f7){_0x94d4d7=_0x94d4d7-0x0;var _0x169211=_0x1a96[_0x94d4d7];return _0x169211;};'use strict';var BPromise=require(_0x61a9('0x0'));var _=require(_0x61a9('0x1'));var moment=require(_0x61a9('0x2'));var util=require(_0x61a9('0x3'));var path=require('path');var Redis=require(_0x61a9('0x4'));var config=require(_0x61a9('0x5'));var logger=require(_0x61a9('0x6'))('ami');var ami=require(_0x61a9('0x7'));var Channel=require(_0x61a9('0x8'));var statusDesc=[_0x61a9('0x9'),_0x61a9('0xa'),_0x61a9('0xb'),'busy',_0x61a9('0xc'),_0x61a9('0xd'),_0x61a9('0xe'),_0x61a9('0xf'),_0x61a9('0x10')];var applications=['set',_0x61a9('0x11'),_0x61a9('0x12'),_0x61a9('0x13'),_0x61a9('0x14'),_0x61a9('0x15')];var dispositions=[_0x61a9('0x16'),_0x61a9('0x17'),_0x61a9('0x17'),_0x61a9('0x16'),_0x61a9('0x16'),'NO\x20ANSWER',_0x61a9('0x18'),'BUSY',_0x61a9('0x17'),_0x61a9('0x17'),_0x61a9('0x17')];var actions={};config[_0x61a9('0x19')]=_[_0x61a9('0x1a')](config[_0x61a9('0x19')],{'host':_0x61a9('0x1b'),'port':0x18eb});var io=require(_0x61a9('0x1c'))(new Redis(config[_0x61a9('0x19')]));function VoiceCallReport(_0x2ef762){this[_0x61a9('0x1d')]=_0x2ef762[_0x61a9('0x1d')];this['agents']=_0x2ef762[_0x61a9('0x1e')];ami['on'](_0x61a9('0x1f'),this[_0x61a9('0x20')]['bind'](this));ami['on'](_0x61a9('0x21'),this[_0x61a9('0x20')][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x23'),this[_0x61a9('0x24')][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x25'),this[_0x61a9('0x26')]['bind'](this));ami['on'](_0x61a9('0x27'),this[_0x61a9('0x28')][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x29'),this[_0x61a9('0x2a')][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x2b'),this[_0x61a9('0x2c')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x2d'),this[_0x61a9('0x2e')][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x2f'),this['syncMusicOnHoldStart'][_0x61a9('0x22')](this));ami['on'](_0x61a9('0x30'),this['syncMusicOnHoldStop']['bind'](this));return BPromise[_0x61a9('0x31')]()[_0x61a9('0x32')](ami[_0x61a9('0x33')]())[_0x61a9('0x34')](function(_0x798c3e){console[_0x61a9('0x35')](_0x798c3e);});}VoiceCallReport[_0x61a9('0x36')]['isNotNull']=function(_0x22d400){return _0x22d400!==null&&!_['isUndefined'](_0x22d400);};VoiceCallReport[_0x61a9('0x36')][_0x61a9('0x37')]=function(_0x2e9fed,_0x2ce177,_0x4538dd){io['to'](_0x2e9fed)[_0x61a9('0x37')](_0x2ce177,_0x4538dd);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x20fe92){try{if(this[_0x61a9('0x38')](_0x20fe92)){if(_0x20fe92[_0x61a9('0x39')]===_0x20fe92['linkedid']){if(!_[_0x61a9('0x3a')](this[_0x61a9('0x1d')][_0x20fe92[_0x61a9('0x39')]])){_['merge'](this[_0x61a9('0x1d')][_0x20fe92[_0x61a9('0x39')]],_[_0x61a9('0x3b')](_0x20fe92,_[_0x61a9('0x3c')](this['channels'][_0x20fe92[_0x61a9('0x39')]])));}}}}catch(_0x15a819){logger[_0x61a9('0x3d')](_0x61a9('0x3e'),util[_0x61a9('0x3f')](_0x15a819,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x61a9('0x36')]['syncNewChannel']=function(_0x302937){try{if(this[_0x61a9('0x38')](_0x302937)){if(_0x302937[_0x61a9('0x39')]===_0x302937[_0x61a9('0x40')]&&_0x302937[_0x61a9('0x41')]!=_0x61a9('0x42')){if(_['isUndefined'](this['channels'][_0x302937[_0x61a9('0x39')]])){this[_0x61a9('0x1d')][_0x302937[_0x61a9('0x39')]]=new Channel();this[_0x61a9('0x1d')][_0x302937[_0x61a9('0x39')]][_0x61a9('0x43')]=moment()['format'](_0x61a9('0x44'));this[_0x61a9('0x1d')][_0x302937[_0x61a9('0x39')]][_0x61a9('0x45')]=dispositions[_['toNumber'](_0x302937[_0x61a9('0x46')])];_[_0x61a9('0x47')](this[_0x61a9('0x1d')][_0x302937[_0x61a9('0x39')]],_[_0x61a9('0x3b')](_0x302937,_['keys'](this[_0x61a9('0x1d')][_0x302937[_0x61a9('0x39')]])));if(_0x302937[_0x61a9('0x48')]==='from-sip'){if(this[_0x61a9('0x1e')][_0x302937['channel'][_0x61a9('0x49')]('-')[0x0]]){this[_0x61a9('0x1e')][_0x302937['channel'][_0x61a9('0x49')]('-')[0x0]]['destconnectedlinenum']=_0x302937[_0x61a9('0x4a')];this['emit'](util[_0x61a9('0x4b')](_0x61a9('0x4c'),this[_0x61a9('0x1e')][_0x302937[_0x61a9('0x41')]['split']('-')[0x0]][_0x61a9('0x4d')]),'user:agentconnect',{'destaccountcode':this[_0x61a9('0x1e')][_0x302937[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]][_0x61a9('0x4e')],'destconnectedlinenum':_0x302937[_0x61a9('0x4a')]});}}}}}}catch(_0xa4f583){logger[_0x61a9('0x3d')](_0x61a9('0x4f'),util['inspect'](_0xa4f583,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x61a9('0x36')]['syncNewExten']=function(_0x1ec16e){try{if(this[_0x61a9('0x38')](_0x1ec16e)){if(_0x1ec16e[_0x61a9('0x39')]===_0x1ec16e[_0x61a9('0x40')]&&_0x1ec16e[_0x61a9('0x4a')]!='h'&&_0x1ec16e[_0x61a9('0x41')]!='OutgoingSpoolFailed'){_0x1ec16e['application']=_0x1ec16e[_0x61a9('0x50')][_0x61a9('0x51')]();_0x1ec16e['applicationdata']=(_0x1ec16e[_0x61a9('0x52')]||_0x1ec16e[_0x61a9('0x53')])[_0x61a9('0x51')]();if(_[_0x61a9('0x3a')](this[_0x61a9('0x1d')][_0x1ec16e[_0x61a9('0x39')]])){this['channels'][_0x1ec16e[_0x61a9('0x39')]]=new Channel();this[_0x61a9('0x1d')][_0x1ec16e[_0x61a9('0x39')]][_0x61a9('0x43')]=_0x1ec16e[_0x61a9('0x54')]?moment()['subtract'](moment[_0x61a9('0x54')](_0x1ec16e[_0x61a9('0x54')])[_0x61a9('0x55')](),_0x61a9('0x55'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x61a9('0x4b')](_0x61a9('0x44'));this[_0x61a9('0x1d')][_0x1ec16e[_0x61a9('0x39')]][_0x61a9('0x45')]='NO\x20ANSWER';}_[_0x61a9('0x47')](this[_0x61a9('0x1d')][_0x1ec16e[_0x61a9('0x39')]],_[_0x61a9('0x3b')](_0x1ec16e,_['keys'](this[_0x61a9('0x1d')][_0x1ec16e[_0x61a9('0x39')]])));if(_[_0x61a9('0x56')](applications,_0x1ec16e[_0x61a9('0x50')])){this[_0x61a9('0x1d')][_0x1ec16e['uniqueid']][_0x61a9('0x57')]=_0x1ec16e[_0x61a9('0x50')];this['channels'][_0x1ec16e[_0x61a9('0x39')]]['lastdata']=_0x1ec16e['applicationdata'];if(_0x1ec16e[_0x61a9('0x50')]===_0x61a9('0x58')&&_[_0x61a9('0x59')](_0x1ec16e['applicationdata'],'cdr(')){var _0x104dce=_0x1ec16e[_0x61a9('0x53')][_0x61a9('0x49')]('=');var _0x177a86=_0x104dce[0x0]['match'](/cdr\((.*)\)/);if(_0x177a86){this[_0x61a9('0x1d')][_0x1ec16e[_0x61a9('0x39')]][_0x177a86[0x1]]=_0x104dce[0x1];}}else if(_0x1ec16e['application']===_0x61a9('0x11')){this[_0x61a9('0x1d')][_0x1ec16e['uniqueid']][_0x61a9('0x11')]=_0x1ec16e['applicationdata'][_0x61a9('0x49')](',')[0x0];}}}}}catch(_0x500d25){logger['error'](_0x61a9('0x5a'),util[_0x61a9('0x3f')](_0x500d25,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x61a9('0x26')]=function(_0x3946f0){try{if(this[_0x61a9('0x38')](_0x3946f0)){if(_0x3946f0[_0x61a9('0x39')]!==_0x3946f0[_0x61a9('0x40')]){if(this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]]){if(_0x3946f0[_0x61a9('0x46')]==='6'){if(!this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]][_0x61a9('0x5b')]){var _0x272d6e=moment();this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]]['answered']=!![];this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]][_0x61a9('0x5c')]=_0x272d6e[_0x61a9('0x4b')](_0x61a9('0x44'));if(this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]]['starttime']){this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]][_0x61a9('0x5d')]=_0x272d6e['diff'](this[_0x61a9('0x1d')][_0x3946f0['linkedid']][_0x61a9('0x43')],_0x61a9('0x55'));}}this['channels'][_0x3946f0[_0x61a9('0x40')]]['linkedid']=_0x3946f0['uniqueid'];if(_0x3946f0[_0x61a9('0x5e')]!==_0x61a9('0x5f')){this[_0x61a9('0x1d')][_0x3946f0['linkedid']][_0x61a9('0x60')]=_0x3946f0[_0x61a9('0x5e')];}this[_0x61a9('0x1d')][_0x3946f0['linkedid']][_0x61a9('0x61')]=_0x3946f0['calleridname'];this[_0x61a9('0x1d')][_0x3946f0['linkedid']][_0x61a9('0x62')]=_0x3946f0[_0x61a9('0x41')];this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]][_0x61a9('0x45')]=dispositions[_['toNumber'](_0x3946f0[_0x61a9('0x46')])];if(this[_0x61a9('0x1e')][_0x3946f0[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]]){this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x40')]]['UserId']=this['agents'][_0x3946f0[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]]['id'];this['channels'][_0x3946f0['linkedid']][_0x61a9('0x63')]=this[_0x61a9('0x1e')][_0x3946f0[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]]['name'];}}}}else{if(this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x39')]]){if(_0x3946f0[_0x61a9('0x46')]==='6'){if(this[_0x61a9('0x1e')][_0x3946f0[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]]){this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x39')]][_0x61a9('0x64')]=this[_0x61a9('0x1e')][_0x3946f0[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]]['id'];this[_0x61a9('0x1d')][_0x3946f0[_0x61a9('0x39')]][_0x61a9('0x63')]=this['agents'][_0x3946f0[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]][_0x61a9('0x4d')];}}}}}}catch(_0x599a6c){logger['error'](_0x61a9('0x65'),util[_0x61a9('0x3f')](_0x599a6c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x61a9('0x36')][_0x61a9('0x66')]=function(_0x2bafb6,_0x42c503){if(this[_0x61a9('0x1d')][_0x2bafb6]){this[_0x61a9('0x1d')][_0x2bafb6][_0x61a9('0x67')]=!![];if(_['endsWith'](_0x42c503,_0x61a9('0x68'))){_0x42c503=_0x42c503[_0x61a9('0x69')]('.wav49',_0x61a9('0x6a'));}this[_0x61a9('0x1d')][_0x2bafb6][_0x61a9('0x6b')]=_0x42c503;var _0x37772c=_[_0x61a9('0x6c')](this['channels'][_0x2bafb6]['monitors'],{'filename':_0x42c503});if(_['isNil'](_0x37772c)){this[_0x61a9('0x1d')][_0x2bafb6][_0x61a9('0x6d')]['push']({'filename':_0x42c503,'createdAt':moment()[_0x61a9('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport['prototype'][_0x61a9('0x28')]=function(_0x294626){try{if(this[_0x61a9('0x38')](_0x294626)){if(this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]]&&_0x294626[_0x61a9('0x41')]!=_0x61a9('0x42')){if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')])){if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x6f')])){this[_0x61a9('0x66')](_0x294626[_0x61a9('0x39')],_0x294626[_0x61a9('0x70')]);}else if(this['isNotNull'](_0x294626[_0x61a9('0x6e')]['xmd-phone'])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]][_0x61a9('0x5e')]=_0x294626['value'];}else if(this['isNotNull'](_0x294626[_0x61a9('0x6e')][_0x61a9('0x71')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]][_0x61a9('0x72')]=_0x294626[_0x61a9('0x70')];}else if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x73')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]]['type']=_0x294626[_0x61a9('0x70')];}else if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x74')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]]['queue']=_0x294626[_0x61a9('0x70')][_0x61a9('0x49')](',')[0x0];}else if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x75')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]][_0x61a9('0x76')]=_0x294626['value'];}else if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x77')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]][_0x61a9('0x78')]=_0x294626[_0x61a9('0x70')];}else if(this[_0x61a9('0x38')](_0x294626['variable'][_0x61a9('0x79')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]][_0x61a9('0x7a')]=_0x294626[_0x61a9('0x70')];}else if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')]['xmcs-queue'])){this['channels'][_0x294626[_0x61a9('0x39')]][_0x61a9('0x11')]=_0x294626[_0x61a9('0x70')];}else if(this[_0x61a9('0x38')](_0x294626['variable'][_0x61a9('0x7b')])){this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x39')]][_0x61a9('0x7c')]=_0x294626[_0x61a9('0x70')];}}}else if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x6f')])){if(_0x294626[_0x61a9('0x70')]){var _0x3e80e9=path['parse'](_0x294626[_0x61a9('0x70')])[_0x61a9('0x4d')];this['syncMixMonitorFilename'](_0x3e80e9,_0x294626[_0x61a9('0x70')]);}}else if(this[_0x61a9('0x1d')][_0x294626[_0x61a9('0x40')]]){if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')])){if(this[_0x61a9('0x38')](_0x294626[_0x61a9('0x6e')][_0x61a9('0x7b')])){this['channels'][_0x294626[_0x61a9('0x40')]][_0x61a9('0x7d')]=_0x294626[_0x61a9('0x70')];}}}}}catch(_0x313e34){logger[_0x61a9('0x3d')](_0x61a9('0x7e'),util[_0x61a9('0x3f')](_0x313e34,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x61a9('0x36')][_0x61a9('0x2a')]=function(_0x10944b){try{if(this[_0x61a9('0x38')](_0x10944b)){if(this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]]){var _0x21846d=moment();this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]]['endtime']=_0x21846d['format'](_0x61a9('0x44'));this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]][_0x61a9('0x54')]=_0x21846d[_0x61a9('0x7f')](this['channels'][_0x10944b[_0x61a9('0x39')]]['starttime'],_0x61a9('0x55'));if(this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]][_0x61a9('0x5b')]){this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]][_0x61a9('0x80')]=_0x21846d[_0x61a9('0x7f')](this[_0x61a9('0x1d')][_0x10944b['uniqueid']][_0x61a9('0x5c')],'seconds');this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]][_0x61a9('0x5d')]=this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]][_0x61a9('0x54')]-this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]]['billableseconds'];}if(_0x10944b[_0x61a9('0x48')]===_0x61a9('0x81')){if(this[_0x61a9('0x1e')][_0x10944b['channel'][_0x61a9('0x49')]('-')[0x0]]){this['agents'][_0x10944b['channel'][_0x61a9('0x49')]('-')[0x0]]=_[_0x61a9('0x82')](this[_0x61a9('0x1e')][_0x10944b[_0x61a9('0x41')]['split']('-')[0x0]],['destconnectedlinenum']);this[_0x61a9('0x37')](util[_0x61a9('0x4b')]('user:%s',this[_0x61a9('0x1e')][_0x10944b[_0x61a9('0x41')][_0x61a9('0x49')]('-')[0x0]][_0x61a9('0x4d')]),_0x61a9('0x83'),{'destaccountcode':this[_0x61a9('0x1e')][_0x10944b[_0x61a9('0x41')]['split']('-')[0x0]][_0x61a9('0x4e')]});}}ami[_0x61a9('0x37')](_0x61a9('0x84'),this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]]);delete this[_0x61a9('0x1d')][_0x10944b[_0x61a9('0x39')]];}}}catch(_0x458f63){logger['error'](_0x61a9('0x85'),util[_0x61a9('0x3f')](_0x458f63,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x61a9('0x86')]=function(_0x49d552){try{if(this[_0x61a9('0x38')](_0x49d552)){if(this['channels'][_0x49d552[_0x61a9('0x87')]]){this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x87')]][_0x61a9('0x88')]=_0x49d552[_0x61a9('0x89')];this[_0x61a9('0x1d')][_0x49d552['transfereeuniqueid']][_0x61a9('0x8a')]=_0x49d552[_0x61a9('0x8b')];if(this[_0x61a9('0x1d')][_0x49d552['secondtransfereruniqueid']]){var _0x15753f=this['channels'][_0x49d552['secondtransfereruniqueid']];this['channels'][_0x49d552['secondtransfereruniqueid']]=this[_0x61a9('0x1d')][_0x49d552['transfereeuniqueid']];this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x87')]]=_0x15753f;}}else if(this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x8c')]]){this[_0x61a9('0x1d')][_0x49d552['transfertargetuniqueid']][_0x61a9('0x88')]=_0x49d552[_0x61a9('0x89')];this[_0x61a9('0x1d')][_0x49d552['transfertargetuniqueid']][_0x61a9('0x8a')]=_0x49d552[_0x61a9('0x8b')];if(this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x8d')]]){var _0x15753f=this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x8d')]];this[_0x61a9('0x1d')][_0x49d552['origtransfereruniqueid']]=this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x8c')]];this[_0x61a9('0x1d')][_0x49d552[_0x61a9('0x8c')]]=_0x15753f;}}}}catch(_0x29754f){logger[_0x61a9('0x3d')](_0x61a9('0x8e'),util[_0x61a9('0x3f')](_0x29754f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x61a9('0x36')][_0x61a9('0x2e')]=function(_0xd81b54){try{if(this['isNotNull'](_0xd81b54)){if(this[_0x61a9('0x1d')][_0xd81b54[_0x61a9('0x87')]]){this[_0x61a9('0x1d')][_0xd81b54[_0x61a9('0x87')]][_0x61a9('0x88')]=_0xd81b54[_0x61a9('0x8f')];this['channels'][_0xd81b54[_0x61a9('0x87')]][_0x61a9('0x8a')]=_0xd81b54['extension'];this[_0x61a9('0x2a')]({'event':'BlindTransfer','uniqueid':_0xd81b54['transfereeuniqueid'],'context':_0xd81b54['context'],'channel':_0xd81b54['transfererchannel']});}}}catch(_0xb3f08){logger['error'](_0x61a9('0x90'),util[_0x61a9('0x3f')](_0xb3f08,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x1303a0){try{if(this[_0x61a9('0x38')](_0x1303a0)){if(this['channels'][_0x1303a0[_0x61a9('0x39')]]){if(!_['isNil'](this[_0x61a9('0x1d')][_0x1303a0[_0x61a9('0x39')]][_0x61a9('0x5c')])){this[_0x61a9('0x1d')][_0x1303a0[_0x61a9('0x39')]]['mohstarttime']=moment()['format'](_0x61a9('0x44'));}}}}catch(_0x3a6345){logger[_0x61a9('0x3d')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x61a9('0x3f')](_0x3a6345,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x61a9('0x36')][_0x61a9('0x91')]=function(_0x541bc4){try{if(this[_0x61a9('0x38')](_0x541bc4)){if(this[_0x61a9('0x1d')][_0x541bc4[_0x61a9('0x39')]]){if(!_[_0x61a9('0x92')](this['channels'][_0x541bc4[_0x61a9('0x39')]]['mohstarttime'])){this[_0x61a9('0x1d')][_0x541bc4['uniqueid']][_0x61a9('0x93')]+=moment()['milliseconds'](0x0)[_0x61a9('0x7f')](this[_0x61a9('0x1d')][_0x541bc4[_0x61a9('0x39')]][_0x61a9('0x94')],_0x61a9('0x55'));delete this[_0x61a9('0x1d')][_0x541bc4['uniqueid']]['mohstarttime'];}}}}catch(_0x542b4d){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x61a9('0x3f')](_0x542b4d,{'showHidden':![],'depth':null}));}};module[_0x61a9('0x95')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 743d27e..a55255a 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 _0xeec6=['value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberpenalty','memberrealtime','isNil','includes','variables','endtime','duration','starttime','seconds','complete','total','answered','holdtime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:dialend','voice_outbound:save','info','voice_outbound_channel:remove','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable'];(function(_0x46b2d9,_0x135738){var _0x4cf9af=function(_0x20fa17){while(--_0x20fa17){_0x46b2d9['push'](_0x46b2d9['shift']());}};_0x4cf9af(++_0x135738);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0xeec6[_0x2ee790];return _0x5a54a5;};'use strict';var _=require(_0x6eec('0x0'));var moment=require(_0x6eec('0x1'));var util=require(_0x6eec('0x2'));var Redis=require(_0x6eec('0x3'));var config=require('../../../config/environment');var logger=require(_0x6eec('0x4'))(_0x6eec('0x5'));var ami=require(_0x6eec('0x6'));config[_0x6eec('0x7')]=_[_0x6eec('0x8')](config[_0x6eec('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6eec('0x9'))(new Redis(config[_0x6eec('0x7')]));function VoiceDialReport(_0x48064a){this[_0x6eec('0xa')]=_0x48064a[_0x6eec('0xb')];this[_0x6eec('0xc')]=_0x48064a[_0x6eec('0xc')];this['variables']={};ami['on'](_0x6eec('0xd'),this[_0x6eec('0xe')][_0x6eec('0xf')](this));ami['on']('dialend',this['syncDialEnd']['bind'](this));ami['on'](_0x6eec('0x10'),this[_0x6eec('0x11')]['bind'](this));ami['on']('hangup',this[_0x6eec('0x12')]['bind'](this));}VoiceDialReport[_0x6eec('0x13')][_0x6eec('0x14')]=function(_0x162db1){return _0x162db1!==null&&!_[_0x6eec('0x15')](_0x162db1);};VoiceDialReport[_0x6eec('0x13')]['emit']=function(_0x25e2a5,_0x3b2972,_0x462dbb){io['to'](_0x25e2a5)[_0x6eec('0x16')](_0x3b2972,_0x462dbb);};VoiceDialReport[_0x6eec('0x13')][_0x6eec('0xe')]=function(_0x345852){try{if(this[_0x6eec('0x14')](_0x345852)){if(this[_0x6eec('0xa')][_0x345852[_0x6eec('0x17')]]){_['merge'](this[_0x6eec('0xa')][_0x345852['uniqueid']],{'starttime':moment()[_0x6eec('0x18')](_0x6eec('0x19')),'lastevent':'called','interface':_0x345852[_0x6eec('0x1a')][_0x6eec('0x1b')](0x0,_0x345852[_0x6eec('0x1a')]['lastIndexOf']('-')),'membername':_0x345852[_0x6eec('0x1a')][_0x6eec('0x1b')](_0x345852[_0x6eec('0x1a')][_0x6eec('0x1c')]('/')+0x1,_0x345852[_0x6eec('0x1a')][_0x6eec('0x1c')]('-'))},_['omit'](_0x345852,[_0x6eec('0x1d'),_0x6eec('0x1e')]));this[_0x6eec('0x16')](_0x6eec('0x1f'),_0x6eec('0x20'),this[_0x6eec('0xa')][_0x345852['uniqueid']]);ami[_0x6eec('0x16')](_0x6eec('0x21'),this[_0x6eec('0xa')][_0x345852[_0x6eec('0x17')]]);}}}catch(_0x409b26){logger[_0x6eec('0x22')]('[syncDialBegin][VoiceDialReport]',util[_0x6eec('0x23')](_0x409b26,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6eec('0x13')][_0x6eec('0x24')]=function(_0x33d580){try{if(this[_0x6eec('0x14')](_0x33d580)){if(this[_0x6eec('0xa')][_0x33d580[_0x6eec('0x17')]]){this[_0x6eec('0xa')][_0x33d580[_0x6eec('0x17')]]['dialstatus']=_0x33d580[_0x6eec('0x25')];if(_0x33d580[_0x6eec('0x25')]===_0x6eec('0x26')){this[_0x6eec('0xa')][_0x33d580['uniqueid']][_0x6eec('0x27')]=_0x33d580[_0x6eec('0x27')];this['channels'][_0x33d580['uniqueid']][_0x6eec('0x28')]=_0x33d580['connectedlinename'];this[_0x6eec('0xa')][_0x33d580[_0x6eec('0x17')]][_0x6eec('0x29')]=moment()[_0x6eec('0x18')](_0x6eec('0x19'));this[_0x6eec('0xa')][_0x33d580[_0x6eec('0x17')]][_0x6eec('0x2a')]=_0x6eec('0x2b');ami[_0x6eec('0x16')]('custom:dialconnect',this[_0x6eec('0xa')][_0x33d580['uniqueid']]);}this[_0x6eec('0x16')](_0x6eec('0x1f'),_0x6eec('0x20'),this['channels'][_0x33d580['uniqueid']]);}}}catch(_0x508735){logger[_0x6eec('0x22')](_0x6eec('0x2c'),util[_0x6eec('0x23')](_0x508735,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6eec('0x13')][_0x6eec('0x11')]=function(_0x23547d){try{if(this[_0x6eec('0x14')](_0x23547d)){this[_0x6eec('0x2d')](_0x23547d[_0x6eec('0x17')],_[_0x6eec('0x2e')](_0x23547d[_0x6eec('0x2f')])[0x0],_0x23547d[_0x6eec('0x30')]);if(this['isNotNull'](_0x23547d[_0x6eec('0x2f')])&&this[_0x6eec('0x14')](_0x23547d[_0x6eec('0x2f')]['outboundrouteid'])){if(_[_0x6eec('0x15')](this[_0x6eec('0xa')][_0x23547d[_0x6eec('0x17')]])){this[_0x6eec('0xa')][_0x23547d[_0x6eec('0x17')]]={'routeId':_0x23547d[_0x6eec('0x30')],'variables':this['variables'][_0x23547d[_0x6eec('0x17')]]};this[_0x6eec('0x16')](_0x6eec('0x1f'),'voice_outbound_channel:save',this['channels'][_0x23547d[_0x6eec('0x17')]]);}}}}catch(_0x297f53){logger[_0x6eec('0x22')](_0x6eec('0x31'),util[_0x6eec('0x23')](_0x297f53,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x6eec('0x2d')]=function(_0x2c3b14,_0x44118c,_0x2bf388){var _0x15918c=[_0x6eec('0x32'),_0x6eec('0x33'),_0x6eec('0x34'),'rtpaudioqosjitterbridged',_0x6eec('0x35'),_0x6eec('0x36'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x6eec('0x37'),_0x6eec('0x38'),_0x6eec('0x39'),_0x6eec('0x3a'),'membercalls','memberdynamic',_0x6eec('0x3b'),'memberlastcall','membername',_0x6eec('0x3c'),_0x6eec('0x3d')];if(!_[_0x6eec('0x3e')](_0x44118c)&&!_[_0x6eec('0x3f')](_0x15918c,_0x44118c)){if(_[_0x6eec('0x15')](this['variables'][_0x2c3b14])){this[_0x6eec('0x40')][_0x2c3b14]={};}this[_0x6eec('0x40')][_0x2c3b14][_0x44118c]=_0x2bf388;}};VoiceDialReport['prototype'][_0x6eec('0x12')]=function(_0x241512){try{if(this['isNotNull'](_0x241512)){if(this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]]){this['channels'][_0x241512[_0x6eec('0x17')]][_0x6eec('0x41')]=moment()[_0x6eec('0x18')](_0x6eec('0x19'));this['channels'][_0x241512[_0x6eec('0x17')]][_0x6eec('0x42')]=moment(this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]][_0x6eec('0x41')])['diff'](this['channels'][_0x241512[_0x6eec('0x17')]][_0x6eec('0x43')],_0x6eec('0x44'));this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]]['lastevent']=_0x6eec('0x45');this['outbound'][_0x6eec('0x46')]+=0x1;if(this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]]['answertime']){this[_0x6eec('0xc')][_0x6eec('0x47')]+=0x1;this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]][_0x6eec('0x48')]=moment(this['channels'][_0x241512[_0x6eec('0x17')]]['answertime'])['diff'](this[_0x6eec('0xa')][_0x241512['uniqueid']][_0x6eec('0x43')],_0x6eec('0x44'));this[_0x6eec('0xa')][_0x241512['uniqueid']]['billableseconds']=moment(this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]][_0x6eec('0x41')])[_0x6eec('0x49')](this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]][_0x6eec('0x29')],_0x6eec('0x44'));this[_0x6eec('0xc')][_0x6eec('0x4a')]+=this['channels'][_0x241512['uniqueid']][_0x6eec('0x48')]||0x0;this[_0x6eec('0xc')][_0x6eec('0x4b')]+=this['channels'][_0x241512[_0x6eec('0x17')]][_0x6eec('0x4c')];}this[_0x6eec('0xc')][_0x6eec('0x4d')]+=this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]][_0x6eec('0x42')];ami[_0x6eec('0x16')]('custom:voiceDialReport',this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]]);ami[_0x6eec('0x16')](_0x6eec('0x4e'),this['channels'][_0x241512['uniqueid']]);this['emit'](_0x6eec('0x1f'),_0x6eec('0x4f'),this[_0x6eec('0xc')]);logger[_0x6eec('0x50')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]]));this[_0x6eec('0x16')]('voice:outbound',_0x6eec('0x51'),this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]]);delete this[_0x6eec('0xa')][_0x241512[_0x6eec('0x17')]];}if(this[_0x6eec('0x40')][_0x241512[_0x6eec('0x17')]]){delete this[_0x6eec('0x40')][_0x241512[_0x6eec('0x17')]];}}}catch(_0x4e921a){logger[_0x6eec('0x22')]('[syncHangup][VoiceDialReport]',util[_0x6eec('0x23')](_0x4e921a,{'showHidden':![],'depth':null}));}};module[_0x6eec('0x52')]=VoiceDialReport; \ No newline at end of file +var _0x04e4=['dialbegin','bind','dialend','syncDialEnd','syncVarSet','hangup','isNotNull','isUndefined','syncDialBegin','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','emit','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','prototype','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','custom:dialconnect','inspect','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','endtime','diff','starttime','lastevent','complete','total','answered','holdtime','seconds','sumHoldTime','sumBillable','billableseconds','sumDuration','duration','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','channels','outboundChannels','outbound','variables'];(function(_0x2ad683,_0x2de6d1){var _0x28eede=function(_0x357048){while(--_0x357048){_0x2ad683['push'](_0x2ad683['shift']());}};_0x28eede(++_0x2de6d1);}(_0x04e4,0xa6));var _0x404e=function(_0x54e805,_0x3de209){_0x54e805=_0x54e805-0x0;var _0x5dc54b=_0x04e4[_0x54e805];return _0x5dc54b;};'use strict';var _=require(_0x404e('0x0'));var moment=require(_0x404e('0x1'));var util=require(_0x404e('0x2'));var Redis=require(_0x404e('0x3'));var config=require(_0x404e('0x4'));var logger=require(_0x404e('0x5'))(_0x404e('0x6'));var ami=require('../ami');config['redis']=_[_0x404e('0x7')](config[_0x404e('0x8')],{'host':_0x404e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x37a4af){this[_0x404e('0xa')]=_0x37a4af[_0x404e('0xb')];this['outbound']=_0x37a4af[_0x404e('0xc')];this[_0x404e('0xd')]={};ami['on'](_0x404e('0xe'),this['syncDialBegin'][_0x404e('0xf')](this));ami['on'](_0x404e('0x10'),this[_0x404e('0x11')]['bind'](this));ami['on']('varset',this[_0x404e('0x12')][_0x404e('0xf')](this));ami['on'](_0x404e('0x13'),this['syncHangup'][_0x404e('0xf')](this));}VoiceDialReport['prototype'][_0x404e('0x14')]=function(_0x712430){return _0x712430!==null&&!_[_0x404e('0x15')](_0x712430);};VoiceDialReport['prototype']['emit']=function(_0x3480f6,_0x12d4f6,_0x175050){io['to'](_0x3480f6)['emit'](_0x12d4f6,_0x175050);};VoiceDialReport['prototype'][_0x404e('0x16')]=function(_0x1e728c){try{if(this['isNotNull'](_0x1e728c)){if(this[_0x404e('0xa')][_0x1e728c[_0x404e('0x17')]]){_[_0x404e('0x18')](this[_0x404e('0xa')][_0x1e728c[_0x404e('0x17')]],{'starttime':moment()[_0x404e('0x19')](_0x404e('0x1a')),'lastevent':_0x404e('0x1b'),'interface':_0x1e728c[_0x404e('0x1c')][_0x404e('0x1d')](0x0,_0x1e728c['channel'][_0x404e('0x1e')]('-')),'membername':_0x1e728c[_0x404e('0x1c')]['substring'](_0x1e728c[_0x404e('0x1c')][_0x404e('0x1e')]('/')+0x1,_0x1e728c['channel'][_0x404e('0x1e')]('-'))},_[_0x404e('0x1f')](_0x1e728c,[_0x404e('0x20'),_0x404e('0x21')]));this[_0x404e('0x22')](_0x404e('0x23'),_0x404e('0x24'),this[_0x404e('0xa')][_0x1e728c[_0x404e('0x17')]]);ami[_0x404e('0x22')](_0x404e('0x25'),this['channels'][_0x1e728c[_0x404e('0x17')]]);}}}catch(_0x4b23bb){logger[_0x404e('0x26')](_0x404e('0x27'),util['inspect'](_0x4b23bb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x404e('0x28')][_0x404e('0x11')]=function(_0x536d13){try{if(this['isNotNull'](_0x536d13)){if(this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]]){this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]][_0x404e('0x29')]=_0x536d13[_0x404e('0x29')];if(_0x536d13[_0x404e('0x29')]===_0x404e('0x2a')){this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]][_0x404e('0x2b')]=_0x536d13[_0x404e('0x2b')];this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]][_0x404e('0x2c')]=_0x536d13[_0x404e('0x2c')];this['channels'][_0x536d13[_0x404e('0x17')]][_0x404e('0x2d')]=moment()[_0x404e('0x19')](_0x404e('0x1a'));this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]]['lastevent']=_0x404e('0x2e');ami['emit'](_0x404e('0x2f'),this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]]);}this['emit'](_0x404e('0x23'),_0x404e('0x24'),this[_0x404e('0xa')][_0x536d13[_0x404e('0x17')]]);}}}catch(_0x11b266){logger[_0x404e('0x26')]('[syncDialEnd][VoiceDialReport]',util[_0x404e('0x30')](_0x11b266,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x404e('0x28')][_0x404e('0x12')]=function(_0x31f3b8){try{if(this['isNotNull'](_0x31f3b8)){this['addVariable'](_0x31f3b8[_0x404e('0x17')],_['keys'](_0x31f3b8[_0x404e('0x31')])[0x0],_0x31f3b8[_0x404e('0x32')]);if(this[_0x404e('0x14')](_0x31f3b8[_0x404e('0x31')])&&this[_0x404e('0x14')](_0x31f3b8[_0x404e('0x31')][_0x404e('0x33')])){if(_[_0x404e('0x15')](this[_0x404e('0xa')][_0x31f3b8['uniqueid']])){this[_0x404e('0xa')][_0x31f3b8['uniqueid']]={'routeId':_0x31f3b8[_0x404e('0x32')],'variables':this[_0x404e('0xd')][_0x31f3b8[_0x404e('0x17')]]};this['emit'](_0x404e('0x23'),'voice_outbound_channel:save',this['channels'][_0x31f3b8[_0x404e('0x17')]]);}}}}catch(_0x5cbc59){logger[_0x404e('0x26')](_0x404e('0x34'),util[_0x404e('0x30')](_0x5cbc59,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x404e('0x28')][_0x404e('0x35')]=function(_0x5805ba,_0x289fba,_0x775a15){var _0x46699d=[_0x404e('0x36'),_0x404e('0x37'),_0x404e('0x38'),_0x404e('0x39'),_0x404e('0x3a'),_0x404e('0x3b'),'rtpaudioqosrtt',_0x404e('0x3c'),'sipcallid','sipuri',_0x404e('0x3d'),_0x404e('0x3e'),_0x404e('0x3f'),'memberdynamic','memberinterface',_0x404e('0x40'),_0x404e('0x41'),_0x404e('0x42'),_0x404e('0x43')];if(!_[_0x404e('0x44')](_0x289fba)&&!_[_0x404e('0x45')](_0x46699d,_0x289fba)){if(_[_0x404e('0x15')](this[_0x404e('0xd')][_0x5805ba])){this[_0x404e('0xd')][_0x5805ba]={};}this[_0x404e('0xd')][_0x5805ba][_0x289fba]=_0x775a15;}};VoiceDialReport[_0x404e('0x28')][_0x404e('0x46')]=function(_0x13ff40){try{if(this['isNotNull'](_0x13ff40)){if(this['channels'][_0x13ff40[_0x404e('0x17')]]){this[_0x404e('0xa')][_0x13ff40['uniqueid']][_0x404e('0x47')]=moment()[_0x404e('0x19')](_0x404e('0x1a'));this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]]['duration']=moment(this['channels'][_0x13ff40['uniqueid']]['endtime'])[_0x404e('0x48')](this['channels'][_0x13ff40[_0x404e('0x17')]][_0x404e('0x49')],'seconds');this[_0x404e('0xa')][_0x13ff40['uniqueid']][_0x404e('0x4a')]=_0x404e('0x4b');this[_0x404e('0xc')][_0x404e('0x4c')]+=0x1;if(this[_0x404e('0xa')][_0x13ff40['uniqueid']][_0x404e('0x2d')]){this[_0x404e('0xc')][_0x404e('0x4d')]+=0x1;this['channels'][_0x13ff40[_0x404e('0x17')]][_0x404e('0x4e')]=moment(this[_0x404e('0xa')][_0x13ff40['uniqueid']][_0x404e('0x2d')])[_0x404e('0x48')](this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]][_0x404e('0x49')],_0x404e('0x4f'));this['channels'][_0x13ff40[_0x404e('0x17')]]['billableseconds']=moment(this[_0x404e('0xa')][_0x13ff40['uniqueid']][_0x404e('0x47')])[_0x404e('0x48')](this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]][_0x404e('0x2d')],'seconds');this[_0x404e('0xc')][_0x404e('0x50')]+=this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]][_0x404e('0x4e')]||0x0;this[_0x404e('0xc')][_0x404e('0x51')]+=this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]][_0x404e('0x52')];}this[_0x404e('0xc')][_0x404e('0x53')]+=this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]][_0x404e('0x54')];ami[_0x404e('0x22')]('custom:voiceDialReport',this[_0x404e('0xa')][_0x13ff40['uniqueid']]);ami['emit'](_0x404e('0x55'),this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]]);this[_0x404e('0x22')](_0x404e('0x23'),_0x404e('0x56'),this[_0x404e('0xc')]);logger['info'](_0x404e('0x57'),JSON[_0x404e('0x58')](this[_0x404e('0xa')][_0x13ff40[_0x404e('0x17')]]));this[_0x404e('0x22')]('voice:outbound',_0x404e('0x59'),this['channels'][_0x13ff40[_0x404e('0x17')]]);delete this['channels'][_0x13ff40['uniqueid']];}if(this[_0x404e('0xd')][_0x13ff40['uniqueid']]){delete this[_0x404e('0xd')][_0x13ff40['uniqueid']];}}}catch(_0x57df70){logger['error']('[syncHangup][VoiceDialReport]',util['inspect'](_0x57df70,{'showHidden':![],'depth':null}));}};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 70ab831..fe2419b 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 _0x1f9a=['connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','last','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','lastAssignedTo','membername','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexit','add','FORWARDTRANSFER','COMPLETEDBY','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','queueposition','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','diff','seconds','sumDuration','milliseconds','total','sumBillable','queuecallercompleteAt','lastevent','custom:queuecallerunmanaged','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','secondtransfereruniqueid','transfertargetuniqueid','ATTENDED','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','transfertype','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','syncMusicOnHoldStop','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','switch','isNil','Action','status','channel','catch','message','[voiceQueueReport][checkChannel]','error','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','inspect','emit','emitVoiceQueueChannelSave','format','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','type','inbound','strategy','answered','available','loggedIn','sumHoldTime','unmanaged','abandoned','Trunk','callerid','Interval','md5','isNotNull','clearZombieChannels','queues','[queues]','then','queue','countBy','toNumber','callers','loggedin','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncQueueCallerJoin','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','queuecallercomplete','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','emitVoiceQueueChannelRemove','queuecallerleaveAt','connectedlinenum'];(function(_0x527271,_0x4c109d){var _0x3a55d0=function(_0x29b214){while(--_0x29b214){_0x527271['push'](_0x527271['shift']());}};_0x3a55d0(++_0x4c109d);}(_0x1f9a,0x1df));var _0xa1f9=function(_0x5530f0,_0x580762){_0x5530f0=_0x5530f0-0x0;var _0x5537d1=_0x1f9a[_0x5530f0];return _0x5537d1;};'use strict';var _=require(_0xa1f9('0x0'));var moment=require(_0xa1f9('0x1'));var BPromise=require(_0xa1f9('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0xa1f9('0x3'));var config=require(_0xa1f9('0x4'));var logger=require('../../../config/logger')(_0xa1f9('0x5'));var ami=require(_0xa1f9('0x6'));var QueueReport=require(_0xa1f9('0x7'));config[_0xa1f9('0x8')]=_[_0xa1f9('0x9')](config[_0xa1f9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa1f9('0xa'))(new Redis(config[_0xa1f9('0x8')]));var Sequence=function(){};Sequence[_0xa1f9('0xb')][_0xa1f9('0xc')]=function(_0x1cae37){this['tail']=this[_0xa1f9('0xd')]?this[_0xa1f9('0xd')]['finally'](_0x1cae37):_0x1cae37();};function VoiceQueueReport(_0x5656b0){this[_0xa1f9('0xe')]=new Sequence();this[_0xa1f9('0xf')]={};this[_0xa1f9('0x10')]=_0x5656b0[_0xa1f9('0x10')];this[_0xa1f9('0x11')]=_0x5656b0[_0xa1f9('0x12')];this[_0xa1f9('0x13')]=_0x5656b0[_0xa1f9('0x13')];this[_0xa1f9('0x14')]=!![];this['campaigns']=_0x5656b0['campaigns'];this['variables']={};ami['on'](_0xa1f9('0x15'),this[_0xa1f9('0x16')][_0xa1f9('0x17')](this));ami['on']('queuesummarycomplete',this[_0xa1f9('0x18')][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x19'),this['syncQueueCallerJoin'][_0xa1f9('0x17')](this));ami['on']('queuecallerabandon',this[_0xa1f9('0x1a')]['bind'](this));ami['on']('queuecallerleave',this[_0xa1f9('0x1b')]['bind'](this));ami['on'](_0xa1f9('0x1c'),this[_0xa1f9('0x1d')][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x1e'),this[_0xa1f9('0x1f')][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x20'),this['syncVarSet'][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x21'),this[_0xa1f9('0x22')]['bind'](this));ami['on'](_0xa1f9('0x23'),this['syncFullyBooted'][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x24'),this[_0xa1f9('0x25')][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x26'),this['syncMusicOnHoldStop'][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x27'),this[_0xa1f9('0x28')][_0xa1f9('0x17')](this));ami['on'](_0xa1f9('0x29'),this[_0xa1f9('0x2a')]['bind'](this));this[_0xa1f9('0x2b')]();this[_0xa1f9('0x2c')]();}function isNotNull(_0x1fddee){return _0x1fddee!==null&&!_[_0xa1f9('0x2d')](_0x1fddee);}function clearChannels(_0x487032){if(!_[_0xa1f9('0x2e')](_0x487032)){for(var _0x1b2d11 in _0x487032){if(_0x487032['hasOwnProperty'](_0x1b2d11)){delete _0x487032[_0x1b2d11];}}}}function clearCampaigns(_0x2f7b97){if(!_[_0xa1f9('0x2e')](_0x2f7b97)){for(var _0xfb7d02 in _0x2f7b97){if(_0x2f7b97[_0xa1f9('0x2f')](_0xfb7d02)){_0x2f7b97[_0xfb7d02][_0xa1f9('0x30')]=0x0;}}}}function clearVoiceQueues(_0x3423d1){if(!_[_0xa1f9('0x2e')](_0x3423d1)){for(var _0x8beb9c in _0x3423d1){if(_0x3423d1[_0xa1f9('0x2f')](_0x8beb9c)){_0x3423d1[_0x8beb9c][_0xa1f9('0x30')]=0x0;_0x3423d1[_0x8beb9c][_0xa1f9('0x31')]=0x0;_0x3423d1[_0x8beb9c][_0xa1f9('0x32')]=0x0;_0x3423d1[_0x8beb9c][_0xa1f9('0x33')]=0x0;_0x3423d1[_0x8beb9c][_0xa1f9('0x34')]=!![];}}}}function clearAgentBooked(_0x56860b){if(!_[_0xa1f9('0x2e')](_0x56860b)){for(var _0x1218d1 in _0x56860b){if(_0x56860b[_0xa1f9('0x2f')](_0x1218d1)){_0x56860b[_0x1218d1][_0xa1f9('0x35')]=!![];}}}}VoiceQueueReport[_0xa1f9('0xb')]['clearZombieChannels']=function(){var _0x2b9091=this;for(var _0x43737b in this[_0xa1f9('0x11')]){if(this[_0xa1f9('0x11')][_0xa1f9('0x2f')](_0x43737b)&&!this[_0xa1f9('0x11')][_0x43737b][_0xa1f9('0x36')]){this[_0xa1f9('0xe')][_0xa1f9('0xc')](function(){if(!_[_0xa1f9('0x37')](_0x2b9091[_0xa1f9('0x11')][_0x43737b])){return ami[_0xa1f9('0x38')]({'action':_0xa1f9('0x39'),'channel':_0x2b9091[_0xa1f9('0x11')][_0x43737b][_0xa1f9('0x3a')]})[_0xa1f9('0x3b')](function(_0xe501ef){if(_0xe501ef[_0xa1f9('0x3c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2b9091['channels'][_0x43737b]){delete _0x2b9091[_0xa1f9('0x11')][_0x43737b];logger['error'](_0xa1f9('0x3d'),_0x43737b);}if(_0x2b9091['queueReports'][_0x43737b]){delete _0x2b9091['queueReports'][_0x43737b];logger[_0xa1f9('0x3e')](_0xa1f9('0x3f'),_0x43737b);}if(_0x2b9091[_0xa1f9('0x40')][_0x43737b]){delete _0x2b9091[_0xa1f9('0x40')][_0x43737b];logger[_0xa1f9('0x3e')](_0xa1f9('0x41'),_0x43737b);}},0x1f40);}});}});}}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x42')]=function(){logger[_0xa1f9('0x3e')](_0xa1f9('0x43'));clearChannels(this[_0xa1f9('0x11')]);this[_0xa1f9('0x44')](this[_0xa1f9('0xf')]);clearAgentBooked(this[_0xa1f9('0x10')]);clearVoiceQueues(this[_0xa1f9('0x13')]);clearCampaigns(this[_0xa1f9('0x45')]);};VoiceQueueReport['prototype'][_0xa1f9('0x44')]=function(_0x255433){var _0x17c5e1=this;if(!_[_0xa1f9('0x2e')](_0x255433)){for(var _0x425db1 in _0x255433){if(_0x255433['hasOwnProperty'](_0x425db1)){_0x17c5e1['emitVoiceQueueChannelRemove'](_0x255433[_0x425db1]);delete _0x255433[_0x425db1];}}}};function loggerCatch(_0x378729){return function(_0xf8a6a7){logger[_0xa1f9('0x3e')](_0x378729,util[_0xa1f9('0x46')](_0xf8a6a7,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0xa1f9('0x47')]=function(_0x4ab85d,_0x4a2d92,_0x17c667){io['to'](_0x4ab85d)['emit'](_0x4a2d92,_0x17c667);};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x48')]=function(_0x171962){this[_0xa1f9('0x47')](util[_0xa1f9('0x49')]('voice:queue:%s',_0x171962['name']),_0xa1f9('0x4a'),_0x171962);};VoiceQueueReport[_0xa1f9('0xb')]['emitVoiceQueueChannelRemove']=function(_0x3171ea){logger[_0xa1f9('0x4b')](_0xa1f9('0x4c'),JSON[_0xa1f9('0x4d')](_0x3171ea));this['emit'](util[_0xa1f9('0x49')](_0xa1f9('0x4e'),_0x3171ea[_0xa1f9('0x4f')]),_0xa1f9('0x50'),_0x3171ea);};VoiceQueueReport[_0xa1f9('0xb')]['emitVoiceQueueSummary']=function(_0x4669fc){if(_0x4669fc[_0xa1f9('0x51')]===_0xa1f9('0x52')){var _0x46e744={'id':_0x4669fc['id'],'name':_0x4669fc[_0xa1f9('0x4f')],'strategy':_0x4669fc[_0xa1f9('0x53')],'answered':_0x4669fc[_0xa1f9('0x54')],'available':_0x4669fc[_0xa1f9('0x55')],'loggedIn':_0x4669fc[_0xa1f9('0x56')],'pTalking':_0x4669fc[_0xa1f9('0x32')],'sumBillable':_0x4669fc['sumBillable'],'sumDuration':_0x4669fc['sumDuration'],'sumHoldTime':_0x4669fc[_0xa1f9('0x57')]||0x0,'talking':_0x4669fc[_0xa1f9('0x31')],'total':_0x4669fc['total'],'type':_0x4669fc['type'],'unmanaged':_0x4669fc[_0xa1f9('0x58')],'abandoned':_0x4669fc[_0xa1f9('0x59')],'waiting':_0x4669fc['waiting']};if(_0x4669fc[_0xa1f9('0x5a')]){_0x46e744[_0xa1f9('0x5a')]={'id':_0x4669fc['Trunk']['id'],'name':_0x4669fc['Trunk'][_0xa1f9('0x4f')],'active':_0x4669fc['Trunk']['active'],'callerid':_0x4669fc[_0xa1f9('0x5a')][_0xa1f9('0x5b')]};}if(_0x4669fc[_0xa1f9('0x5c')]){_0x46e744[_0xa1f9('0x5c')]={'id':_0x4669fc[_0xa1f9('0x5c')]['id'],'name':_0x4669fc[_0xa1f9('0x5c')][_0xa1f9('0x4f')]};}var _0x2149c5=md5(JSON[_0xa1f9('0x4d')](_0x46e744));if(_0x4669fc[_0xa1f9('0x5d')]!==_0x2149c5){_0x4669fc[_0xa1f9('0x5d')]=_0x2149c5;this[_0xa1f9('0x47')](util[_0xa1f9('0x49')](_0xa1f9('0x4e'),_0x46e744[_0xa1f9('0x4f')]),'voice_queue:save',_0x46e744);}}};VoiceQueueReport['prototype'][_0xa1f9('0x5e')]=function(_0x127616){return _0x127616!==null&&!_[_0xa1f9('0x2d')](_0x127616);};VoiceQueueReport['prototype'][_0xa1f9('0x2c')]=function(){var _0x4c498b=this;setInterval(function(){_0x4c498b[_0xa1f9('0x5f')]();ami[_0xa1f9('0x38')]({'action':_0xa1f9('0x60')})['catch'](loggerCatch(_0xa1f9('0x61')));},0x2710);};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x2b')]=function(){var _0x5b1824=this;setInterval(function(){if(_0x5b1824[_0xa1f9('0x14')]){return ami[_0xa1f9('0x38')]({'action':_0xa1f9('0x15')})[_0xa1f9('0x62')](function(_0x30765b){_0x5b1824[_0xa1f9('0x14')]=![];})['catch'](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0xa1f9('0xb')]['syncQueueSummary']=function(_0x4916f3){try{if(this[_0xa1f9('0x5e')](_0x4916f3)&&this[_0xa1f9('0x5e')](_0x4916f3[_0xa1f9('0x63')])){if(this['voiceQueues'][_0x4916f3[_0xa1f9('0x63')]]){var _0x13cc59=_[_0xa1f9('0x64')](this[_0xa1f9('0x11')],_0xa1f9('0x63'))[_0x4916f3['queue']]||0x0;var _0x592318=_0x13cc59-_0x4916f3['callers'];if(this[_0xa1f9('0x13')][_0x4916f3[_0xa1f9('0x63')]]['waiting']!==_[_0xa1f9('0x65')](_0x4916f3[_0xa1f9('0x66')])||this['voiceQueues'][_0x4916f3[_0xa1f9('0x63')]]['loggedIn']!==_[_0xa1f9('0x65')](_0x4916f3[_0xa1f9('0x67')])||this[_0xa1f9('0x13')][_0x4916f3[_0xa1f9('0x63')]][_0xa1f9('0x55')]!==_[_0xa1f9('0x65')](_0x4916f3[_0xa1f9('0x55')])||this[_0xa1f9('0x13')][_0x4916f3[_0xa1f9('0x63')]]['talking']!==_0x592318){this[_0xa1f9('0x13')][_0x4916f3[_0xa1f9('0x63')]][_0xa1f9('0x33')]=_['toNumber'](_0x4916f3['callers']);this['voiceQueues'][_0x4916f3[_0xa1f9('0x63')]]['loggedIn']=_['toNumber'](_0x4916f3[_0xa1f9('0x67')]);this['voiceQueues'][_0x4916f3['queue']][_0xa1f9('0x55')]=_[_0xa1f9('0x65')](_0x4916f3[_0xa1f9('0x55')]);this['voiceQueues'][_0x4916f3[_0xa1f9('0x63')]][_0xa1f9('0x31')]=_0x592318>0x0?_0x592318:0x0;this[_0xa1f9('0x13')][_0x4916f3[_0xa1f9('0x63')]][_0xa1f9('0x31')]=this['voiceQueues'][_0x4916f3[_0xa1f9('0x63')]]['talking']>_[_0xa1f9('0x65')](_0x4916f3[_0xa1f9('0x67')])?_[_0xa1f9('0x65')](_0x4916f3[_0xa1f9('0x67')]):this[_0xa1f9('0x13')][_0x4916f3[_0xa1f9('0x63')]]['talking'];this[_0xa1f9('0x68')](this['voiceQueues'][_0x4916f3['queue']]);}ami[_0xa1f9('0x47')](_0xa1f9('0x69'),this['voiceQueues'][_0x4916f3[_0xa1f9('0x63')]]);}}}catch(_0x2a3bdc){logger[_0xa1f9('0x3e')](_0xa1f9('0x6a'),util[_0xa1f9('0x46')](_0x2a3bdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x18')]=function(_0x1d0f19){this[_0xa1f9('0x14')]=!![];};VoiceQueueReport[_0xa1f9('0xb')]['syncNewExten']=function(_0x2eb481){};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x6b')]=function(_0x5171e2){try{if(this['isNotNull'](_0x5171e2)){if(_['isUndefined'](this[_0xa1f9('0xf')][_0x5171e2[_0xa1f9('0x6c')]])){this[_0xa1f9('0xf')][_0x5171e2[_0xa1f9('0x6c')]]=[];this[_0xa1f9('0x11')][_0x5171e2[_0xa1f9('0x6c')]]={};}var _0x3faf81=new QueueReport();_0x3faf81['name']=_0x5171e2['queue'];_0x3faf81[_0xa1f9('0x51')]=this['voiceQueues'][_0x3faf81[_0xa1f9('0x4f')]]&&this['voiceQueues'][_0x3faf81[_0xa1f9('0x4f')]][_0xa1f9('0x51')]?this[_0xa1f9('0x13')][_0x3faf81['name']][_0xa1f9('0x51')]||_0xa1f9('0x52'):'inbound';_0x3faf81[_0xa1f9('0x63')]=_0x5171e2[_0xa1f9('0x63')];_0x3faf81[_0xa1f9('0x6d')]=moment()[_0xa1f9('0x49')](_0xa1f9('0x6e'));_0x3faf81['position']=_0x5171e2[_0xa1f9('0x6f')];_0x3faf81[_0xa1f9('0x70')]=_0x5171e2[_0xa1f9('0x70')];_['merge'](_0x3faf81,_[_0xa1f9('0x71')](_0x5171e2,_[_0xa1f9('0x72')](_0x3faf81)));this[_0xa1f9('0xf')][_0x5171e2['uniqueid']][_0xa1f9('0x73')](_0x3faf81);this[_0xa1f9('0x11')][_0x5171e2[_0xa1f9('0x6c')]]=_0x3faf81;this[_0xa1f9('0x48')](_0x3faf81);}}catch(_0xee58e2){logger[_0xa1f9('0x3e')](_0xa1f9('0x74'),util['inspect'](_0xee58e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x1a')]=function(_0x5a76d9){try{if(this[_0xa1f9('0x5e')](_0x5a76d9)){if(this['queueReports'][_0x5a76d9[_0xa1f9('0x6c')]]){var _0x266231=_['last'](this[_0xa1f9('0xf')][_0x5a76d9[_0xa1f9('0x6c')]]);_0x266231[_0xa1f9('0x75')]=![];_0x266231['queuecallercompleteAt']=null;_0x266231[_0xa1f9('0x76')]=_0x5a76d9['holdtime'];_0x266231[_0xa1f9('0x77')]=_0x5a76d9[_0xa1f9('0x77')];_0x266231[_0xa1f9('0x78')]=!![];_0x266231[_0xa1f9('0x79')]=moment()[_0xa1f9('0x49')](_0xa1f9('0x6e'));_0x266231[_0xa1f9('0x7a')]=_0xa1f9('0x7b');_0x266231['lastAssignedTo']=null;this['channels'][_0x5a76d9[_0xa1f9('0x6c')]]=_0x266231;this[_0xa1f9('0x7c')](_0x266231);}}}catch(_0x34e812){logger[_0xa1f9('0x3e')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xa1f9('0x46')](_0x34e812,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x1b')]=function(_0x2be63f){try{if(this['isNotNull'](_0x2be63f)){if(this[_0xa1f9('0xf')][_0x2be63f['uniqueid']]){var _0x5f4d79=_['last'](this[_0xa1f9('0xf')][_0x2be63f[_0xa1f9('0x6c')]]);_0x5f4d79[_0xa1f9('0x7d')]=moment()[_0xa1f9('0x49')](_0xa1f9('0x6e'));_0x5f4d79['connectedlinenum']=_0x2be63f[_0xa1f9('0x7e')];_0x5f4d79[_0xa1f9('0x7f')]=_0x2be63f[_0xa1f9('0x7f')];this[_0xa1f9('0x11')][_0x2be63f[_0xa1f9('0x6c')]]=_0x5f4d79;this[_0xa1f9('0x48')](_0x5f4d79);}}}catch(_0x441c9e){logger[_0xa1f9('0x3e')](_0xa1f9('0x80'),util[_0xa1f9('0x46')](_0x441c9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x1f')]=function(_0x1a117b){try{if(this[_0xa1f9('0x5e')](_0x1a117b)){if(this['queueReports'][_0x1a117b['uniqueid']]){var _0x38cd90=_[_0xa1f9('0x81')](this[_0xa1f9('0xf')][_0x1a117b[_0xa1f9('0x6c')]]);_0x38cd90[_0xa1f9('0x75')]=!![];_0x38cd90[_0xa1f9('0x7a')]=_0xa1f9('0x82');}}}catch(_0x2a8da4){logger[_0xa1f9('0x3e')](_0xa1f9('0x83'),util[_0xa1f9('0x46')](_0x2a8da4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')]['syncAgentComplete']=function(_0x3625f6){try{if(this[_0xa1f9('0x5e')](_0x3625f6)){if(this[_0xa1f9('0xf')][_0x3625f6[_0xa1f9('0x6c')]]){var _0x46fa03=_['last'](this[_0xa1f9('0xf')][_0x3625f6[_0xa1f9('0x6c')]]);_0x46fa03[_0xa1f9('0x78')]=![];_0x46fa03['queuecallerabandonAt']=null;_0x46fa03[_0xa1f9('0x84')]=!![];_0x46fa03[_0xa1f9('0x85')]=_0x3625f6[_0xa1f9('0x86')];_0x46fa03[_0xa1f9('0x76')]=_0x3625f6[_0xa1f9('0x76')];_0x46fa03[_0xa1f9('0x75')]=!![];_0x46fa03['queuecallerexit']=![];_0x46fa03[_0xa1f9('0x87')]=null;if(!_0x46fa03[_0xa1f9('0x88')]){if(_0x3625f6[_0xa1f9('0x89')]==_0xa1f9('0x88')){_0x46fa03[_0xa1f9('0x7a')]=_0xa1f9('0x8a');}else{if(_[_0xa1f9('0x8b')](_0x3625f6[_0xa1f9('0x3a')][_0xa1f9('0x8c')](),_0xa1f9('0x8d'))){if(this[_0xa1f9('0xf')][_0x3625f6[_0xa1f9('0x8e')]]){var _0x210513=_[_0xa1f9('0x81')](this[_0xa1f9('0xf')][_0x3625f6['linkedid']]);_0x210513[_0xa1f9('0x75')]=![];_0x210513[_0xa1f9('0x8f')]=!![];_0x210513['queuecallerexitAt']=moment(_0x46fa03[_0xa1f9('0x6d')])[_0xa1f9('0x90')](_0x3625f6['holdtime'],'seconds')[_0xa1f9('0x49')](_0xa1f9('0x6e'));_0x210513[_0xa1f9('0x7a')]=_0xa1f9('0x91');_0x210513[_0xa1f9('0x88')]=!![];_0x210513['transfertype']='FORWARD';_0x210513['transferexten']=_0x3625f6['destexten'];_0x210513['transferuniqueid']=_0x3625f6['uniqueid'];var _0x5d83ab=this['queueReports'][_0x3625f6['linkedid']];this[_0xa1f9('0xf')][_0x3625f6[_0xa1f9('0x8e')]]=this[_0xa1f9('0xf')][_0x3625f6[_0xa1f9('0x6c')]];this['queueReports'][_0x3625f6[_0xa1f9('0x6c')]]=_0x5d83ab;}}else{_0x46fa03[_0xa1f9('0x7a')]=_0xa1f9('0x92')+_0x3625f6[_0xa1f9('0x89')]['toUpperCase']();}}}this[_0xa1f9('0x11')][_0x3625f6[_0xa1f9('0x6c')]]=_0x46fa03;this[_0xa1f9('0x7c')](_0x46fa03);}}}catch(_0x4fc8aa){logger[_0xa1f9('0x3e')](_0xa1f9('0x93'),util[_0xa1f9('0x46')](_0x4fc8aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')]['syncVarSet']=function(_0x165390){try{if(this['isNotNull'](_0x165390)){this[_0xa1f9('0x94')](_0x165390['uniqueid'],_[_0xa1f9('0x72')](_0x165390[_0xa1f9('0x95')])[0x0],_0x165390[_0xa1f9('0x96')]);if(this['queueReports'][_0x165390[_0xa1f9('0x6c')]]){var _0x368f09=_[_0xa1f9('0x81')](this[_0xa1f9('0xf')][_0x165390['uniqueid']]);if(_0x368f09){if(this[_0xa1f9('0x5e')](_0x165390[_0xa1f9('0x95')])&&this[_0xa1f9('0x5e')](_0x165390[_0xa1f9('0x95')]['queuestatus'])){switch(_0x165390[_0xa1f9('0x96')]){case _0xa1f9('0x97'):_0x368f09[_0xa1f9('0x8f')]=![];_0x368f09['queuecallerexitAt']=null;break;case _0xa1f9('0x98'):_0x368f09['lastevent']=_0xa1f9('0x99');ami[_0xa1f9('0x47')]('custom:timeout',_0x368f09);break;default:_0x368f09[_0xa1f9('0x8f')]=!![];_0x368f09[_0xa1f9('0x87')]=moment()[_0xa1f9('0x49')](_0xa1f9('0x6e'));_0x368f09[_0xa1f9('0x7d')]=moment()[_0xa1f9('0x49')](_0xa1f9('0x6e'));}_0x368f09[_0xa1f9('0x78')]=![];_0x368f09[_0xa1f9('0x79')]=null;_0x368f09[_0xa1f9('0x7a')]=_0x165390['value'];this[_0xa1f9('0x11')][_0x165390['uniqueid']]=_0x368f09;this['emitVoiceQueueChannelRemove'](_0x368f09);}else if(this[_0xa1f9('0x5e')](_0x165390[_0xa1f9('0x95')])&&this[_0xa1f9('0x5e')](_0x165390[_0xa1f9('0x95')][_0xa1f9('0x9a')])){if(!_0x368f09['queuecallerabandon']){_0x368f09['queuecallerexit']=!![];_0x368f09[_0xa1f9('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x368f09[_0xa1f9('0x7a')]='EXITWITHKEY';_0x368f09[_0xa1f9('0x7d')]=moment()['format'](_0xa1f9('0x6e'));this['channels'][_0x165390['uniqueid']]=_0x368f09;}}_0x368f09[_0xa1f9('0x40')]=this[_0xa1f9('0x40')][_0x165390[_0xa1f9('0x6c')]];}}}}catch(_0x556c25){logger[_0xa1f9('0x3e')]('[syncVarSet][VoiceQueueReport]',util[_0xa1f9('0x46')](_0x556c25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x94')]=function(_0x57b2c4,_0x35cf3d,_0x5eabab){var _0x328150=[_0xa1f9('0x9b'),'rtpaudioqosbridged',_0xa1f9('0x9c'),'rtpaudioqosjitterbridged',_0xa1f9('0x9d'),_0xa1f9('0x9e'),_0xa1f9('0x9f'),_0xa1f9('0xa0'),'sipcallid',_0xa1f9('0xa1'),_0xa1f9('0xa2'),_0xa1f9('0xa3'),_0xa1f9('0xa4'),_0xa1f9('0xa5'),_0xa1f9('0xa6'),'memberlastcall','membername',_0xa1f9('0xa7'),_0xa1f9('0xa8')];if(!_['isNil'](_0x35cf3d)&&!_[_0xa1f9('0xa9')](_0x328150,_0x35cf3d)){if(_[_0xa1f9('0x2d')](this[_0xa1f9('0x40')][_0x57b2c4])){this[_0xa1f9('0x40')][_0x57b2c4]={};}this[_0xa1f9('0x40')][_0x57b2c4][_0x35cf3d]=_0x5eabab;}};VoiceQueueReport[_0xa1f9('0xb')][_0xa1f9('0x22')]=function(_0x39f104){try{if(this[_0xa1f9('0x5e')](_0x39f104)){if(this['queueReports'][_0x39f104[_0xa1f9('0x6c')]]){for(var _0x30ba74=0x0,_0xbada36={};_0x30ba740x0?_0x54ec39:0x0;this[_0x3000('0x10')][_0x3dbf66[_0x3000('0x5a')]][_0x3000('0x2e')]=this[_0x3000('0x10')][_0x3dbf66['queue']][_0x3000('0x2e')]>_['toNumber'](_0x3dbf66[_0x3000('0x5f')])?_[_0x3000('0x5e')](_0x3dbf66[_0x3000('0x5f')]):this['voiceQueues'][_0x3dbf66[_0x3000('0x5a')]][_0x3000('0x2e')];this[_0x3000('0x48')](this['voiceQueues'][_0x3dbf66['queue']]);}ami[_0x3000('0x3f')](_0x3000('0x60'),this[_0x3000('0x10')][_0x3dbf66[_0x3000('0x5a')]]);}}}catch(_0x5b036c){logger['error'](_0x3000('0x61'),util[_0x3000('0x3e')](_0x5b036c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3000('0x3a')][_0x3000('0x62')]=function(_0x498101){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x3000('0x3a')][_0x3000('0x63')]=function(_0x3933b4){};VoiceQueueReport[_0x3000('0x3a')][_0x3000('0x64')]=function(_0x222a90){try{if(this['isNotNull'](_0x222a90)){if(_[_0x3000('0x2b')](this[_0x3000('0xd')][_0x222a90[_0x3000('0x65')]])){this[_0x3000('0xd')][_0x222a90[_0x3000('0x65')]]=[];this[_0x3000('0xf')][_0x222a90[_0x3000('0x65')]]={};}var _0x412c95=new QueueReport();_0x412c95[_0x3000('0x42')]=_0x222a90['queue'];_0x412c95[_0x3000('0x49')]=this['voiceQueues'][_0x412c95[_0x3000('0x42')]]&&this['voiceQueues'][_0x412c95[_0x3000('0x42')]][_0x3000('0x49')]?this[_0x3000('0x10')][_0x412c95['name']][_0x3000('0x49')]||'inbound':_0x3000('0x4a');_0x412c95[_0x3000('0x5a')]=_0x222a90['queue'];_0x412c95[_0x3000('0x66')]=moment()[_0x3000('0x46')](_0x3000('0x67'));_0x412c95[_0x3000('0x68')]=_0x222a90[_0x3000('0x68')];_0x412c95[_0x3000('0x69')]=_0x222a90[_0x3000('0x69')];_[_0x3000('0x6a')](_0x412c95,_[_0x3000('0x6b')](_0x222a90,_['keys'](_0x412c95)));this[_0x3000('0xd')][_0x222a90[_0x3000('0x65')]][_0x3000('0x6c')](_0x412c95);this[_0x3000('0xf')][_0x222a90[_0x3000('0x65')]]=_0x412c95;this[_0x3000('0x40')](_0x412c95);}}catch(_0x40153e){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x3000('0x3e')](_0x40153e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3000('0x3a')]['syncQueueCallerAbandon']=function(_0x2ab825){try{if(this[_0x3000('0x55')](_0x2ab825)){if(this[_0x3000('0xd')][_0x2ab825['uniqueid']]){var _0x15f37f=_[_0x3000('0x6d')](this['queueReports'][_0x2ab825[_0x3000('0x65')]]);_0x15f37f[_0x3000('0x6e')]=![];_0x15f37f['queuecallercompleteAt']=null;_0x15f37f[_0x3000('0x6f')]=_0x2ab825[_0x3000('0x6f')];_0x15f37f[_0x3000('0x70')]=_0x2ab825[_0x3000('0x70')];_0x15f37f[_0x3000('0x16')]=!![];_0x15f37f[_0x3000('0x71')]=moment()[_0x3000('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x15f37f[_0x3000('0x72')]=_0x3000('0x73');_0x15f37f[_0x3000('0x74')]=null;this[_0x3000('0xf')][_0x2ab825[_0x3000('0x65')]]=_0x15f37f;this[_0x3000('0x3d')](_0x15f37f);}}}catch(_0x629a3d){logger['error'](_0x3000('0x75'),util[_0x3000('0x3e')](_0x629a3d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3000('0x3a')][_0x3000('0x76')]=function(_0x3c582e){try{if(this[_0x3000('0x55')](_0x3c582e)){if(this[_0x3000('0xd')][_0x3c582e[_0x3000('0x65')]]){var _0x100adb=_[_0x3000('0x6d')](this[_0x3000('0xd')][_0x3c582e[_0x3000('0x65')]]);_0x100adb[_0x3000('0x77')]=moment()['format'](_0x3000('0x67'));_0x100adb['connectedlinenum']=_0x3c582e[_0x3000('0x78')];_0x100adb[_0x3000('0x79')]=_0x3c582e[_0x3000('0x79')];this[_0x3000('0xf')][_0x3c582e[_0x3000('0x65')]]=_0x100adb;this[_0x3000('0x40')](_0x100adb);}}}catch(_0x1240a8){logger['error']('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0x1240a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3000('0x3a')]['syncAgentConnect']=function(_0x10231f){try{if(this[_0x3000('0x55')](_0x10231f)){if(this[_0x3000('0xd')][_0x10231f[_0x3000('0x65')]]){var _0x4e9ebb=_[_0x3000('0x6d')](this['queueReports'][_0x10231f[_0x3000('0x65')]]);_0x4e9ebb[_0x3000('0x6e')]=!![];_0x4e9ebb[_0x3000('0x72')]=_0x3000('0x7a');}}}catch(_0x551624){logger[_0x3000('0x37')](_0x3000('0x7b'),util['inspect'](_0x551624,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3000('0x1a')]=function(_0x4bf912){try{if(this['isNotNull'](_0x4bf912)){if(this[_0x3000('0xd')][_0x4bf912[_0x3000('0x65')]]){var _0x486a0c=_[_0x3000('0x6d')](this['queueReports'][_0x4bf912[_0x3000('0x65')]]);_0x486a0c['queuecallerabandon']=![];_0x486a0c[_0x3000('0x71')]=null;_0x486a0c[_0x3000('0x7c')]=!![];_0x486a0c[_0x3000('0x74')]=_0x4bf912['membername'];_0x486a0c[_0x3000('0x6f')]=_0x4bf912['holdtime'];_0x486a0c['queuecallercomplete']=!![];_0x486a0c[_0x3000('0x7d')]=![];_0x486a0c[_0x3000('0x7e')]=null;if(!_0x486a0c[_0x3000('0x7f')]){if(_0x4bf912[_0x3000('0x80')]==_0x3000('0x7f')){_0x486a0c[_0x3000('0x72')]=_0x3000('0x81');}else{if(_[_0x3000('0x82')](_0x4bf912[_0x3000('0x34')][_0x3000('0x83')](),'local/')){if(this[_0x3000('0xd')][_0x4bf912[_0x3000('0x84')]]){var _0x2f1191=_[_0x3000('0x6d')](this[_0x3000('0xd')][_0x4bf912[_0x3000('0x84')]]);_0x2f1191[_0x3000('0x6e')]=![];_0x2f1191[_0x3000('0x7d')]=!![];_0x2f1191[_0x3000('0x7e')]=moment(_0x486a0c[_0x3000('0x66')])[_0x3000('0x85')](_0x4bf912[_0x3000('0x6f')],_0x3000('0x86'))[_0x3000('0x46')](_0x3000('0x67'));_0x2f1191[_0x3000('0x72')]='FORWARDTRANSFER';_0x2f1191[_0x3000('0x7f')]=!![];_0x2f1191[_0x3000('0x87')]=_0x3000('0x88');_0x2f1191[_0x3000('0x89')]=_0x4bf912[_0x3000('0x8a')];_0x2f1191[_0x3000('0x8b')]=_0x4bf912[_0x3000('0x65')];var _0x21e200=this[_0x3000('0xd')][_0x4bf912[_0x3000('0x84')]];this[_0x3000('0xd')][_0x4bf912['linkedid']]=this[_0x3000('0xd')][_0x4bf912[_0x3000('0x65')]];this['queueReports'][_0x4bf912[_0x3000('0x65')]]=_0x21e200;}}else{_0x486a0c[_0x3000('0x72')]='COMPLETEDBY'+_0x4bf912['reason'][_0x3000('0x8c')]();}}}this[_0x3000('0xf')][_0x4bf912[_0x3000('0x65')]]=_0x486a0c;this['emitVoiceQueueChannelRemove'](_0x486a0c);}}}catch(_0x3aa69d){logger[_0x3000('0x37')](_0x3000('0x8d'),util[_0x3000('0x3e')](_0x3aa69d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3000('0x3a')][_0x3000('0x1e')]=function(_0x144f4c){try{if(this[_0x3000('0x55')](_0x144f4c)){this[_0x3000('0x8e')](_0x144f4c['uniqueid'],_[_0x3000('0x8f')](_0x144f4c['variable'])[0x0],_0x144f4c[_0x3000('0x90')]);if(this[_0x3000('0xd')][_0x144f4c['uniqueid']]){var _0x1e8b62=_[_0x3000('0x6d')](this['queueReports'][_0x144f4c[_0x3000('0x65')]]);if(_0x1e8b62){if(this[_0x3000('0x55')](_0x144f4c[_0x3000('0x91')])&&this[_0x3000('0x55')](_0x144f4c[_0x3000('0x91')][_0x3000('0x92')])){switch(_0x144f4c[_0x3000('0x90')]){case _0x3000('0x93'):_0x1e8b62['queuecallerexit']=![];_0x1e8b62[_0x3000('0x7e')]=null;break;case _0x3000('0x94'):_0x1e8b62['lastevent']=_0x3000('0x95');ami[_0x3000('0x3f')](_0x3000('0x96'),_0x1e8b62);break;default:_0x1e8b62['queuecallerexit']=!![];_0x1e8b62[_0x3000('0x7e')]=moment()[_0x3000('0x46')](_0x3000('0x67'));_0x1e8b62[_0x3000('0x77')]=moment()[_0x3000('0x46')](_0x3000('0x67'));}_0x1e8b62[_0x3000('0x16')]=![];_0x1e8b62['queuecallerabandonAt']=null;_0x1e8b62[_0x3000('0x72')]=_0x144f4c['value'];this[_0x3000('0xf')][_0x144f4c[_0x3000('0x65')]]=_0x1e8b62;this['emitVoiceQueueChannelRemove'](_0x1e8b62);}else if(this['isNotNull'](_0x144f4c[_0x3000('0x91')])&&this[_0x3000('0x55')](_0x144f4c[_0x3000('0x91')][_0x3000('0x97')])){if(!_0x1e8b62[_0x3000('0x16')]){_0x1e8b62['queuecallerexit']=!![];_0x1e8b62[_0x3000('0x7e')]=moment()['format'](_0x3000('0x67'));_0x1e8b62[_0x3000('0x72')]=_0x3000('0x98');_0x1e8b62[_0x3000('0x77')]=moment()[_0x3000('0x46')](_0x3000('0x67'));this['channels'][_0x144f4c[_0x3000('0x65')]]=_0x1e8b62;}}_0x1e8b62[_0x3000('0x99')]=this[_0x3000('0x99')][_0x144f4c[_0x3000('0x65')]];}}}}catch(_0x193ce3){logger[_0x3000('0x37')](_0x3000('0x9a'),util[_0x3000('0x3e')](_0x193ce3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x4314dd,_0x40cb42,_0x5334ba){var _0x11cb55=[_0x3000('0x9b'),_0x3000('0x9c'),_0x3000('0x9d'),_0x3000('0x9e'),_0x3000('0x9f'),_0x3000('0xa0'),_0x3000('0xa1'),'rtpaudioqosrttbridged','sipcallid',_0x3000('0xa2'),_0x3000('0xa3'),_0x3000('0xa4'),_0x3000('0xa5'),_0x3000('0xa6'),_0x3000('0xa7'),_0x3000('0xa8'),_0x3000('0xa9'),_0x3000('0xaa'),_0x3000('0xab')];if(!_[_0x3000('0x32')](_0x40cb42)&&!_[_0x3000('0xac')](_0x11cb55,_0x40cb42)){if(_[_0x3000('0x2b')](this[_0x3000('0x99')][_0x4314dd])){this['variables'][_0x4314dd]={};}this[_0x3000('0x99')][_0x4314dd][_0x40cb42]=_0x5334ba;}};VoiceQueueReport[_0x3000('0x3a')][_0x3000('0x20')]=function(_0x570ce8){try{if(this['isNotNull'](_0x570ce8)){if(this[_0x3000('0xd')][_0x570ce8[_0x3000('0x65')]]){for(var _0x222b54=0x0,_0x589102={};_0x222b54=0x0?moment(_0x6b80b3['endtime'])['diff'](_0x6b80b3[_0xcdab('0x17')],_0xcdab('0xd')):null,'data1':_0xcdab('0x19'),'data2':_0x6b80b3[_0xcdab('0x12')],'data3':_0x6b80b3[_0xcdab('0xf')],'data4':_0x6b80b3[_0xcdab('0x1a')]||null,'role':_0xcdab('0x11'),'internal':_0x6b80b3[_0xcdab('0x12')]?_[_0xcdab('0x13')](_0x6b80b3[_0xcdab('0x12')]):undefined,'uniqueid':_0x6b80b3[_0xcdab('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x6bf8=['starttime','endtime','seconds','outbound','exten','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','queuecallerleaveAt','diff','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','TALKING'];(function(_0x460fe3,_0x594db1){var _0x79d36a=function(_0x4fbe3f){while(--_0x4fbe3f){_0x460fe3['push'](_0x460fe3['shift']());}};_0x79d36a(++_0x594db1);}(_0x6bf8,0x1c8));var _0x86bf=function(_0x569f9a,_0x58cc03){_0x569f9a=_0x569f9a-0x0;var _0x33cafb=_0x6bf8[_0x569f9a];return _0x33cafb;};'use strict';var moment=require('moment');var _=require(_0x86bf('0x0'));var util=require(_0x86bf('0x1'));var client=require(_0x86bf('0x2'));exports[_0x86bf('0x3')]=function(_0x3172d5){var _0x2bfc64=_0x3172d5[_0x86bf('0x4')]||_0x3172d5['queuecallerexitAt'];return client['Request'](_0x86bf('0x5'),{'body':{'channel':_0x86bf('0x6'),'membername':_0x3172d5[_0x86bf('0x7')],'interface':_[_0x86bf('0x8')](_0x3172d5['interface'])?util[_0x86bf('0x9')](_0x86bf('0xa'),_0x3172d5[_0x86bf('0x7')]):_0x3172d5[_0x86bf('0xb')],'type':'TALKING','enterAt':_0x3172d5[_0x86bf('0xc')],'exitAt':_0x2bfc64,'duration':moment(_0x2bfc64)[_0x86bf('0xd')](_0x3172d5[_0x86bf('0xc')],'seconds'),'data1':_0x86bf('0xe'),'data2':_0x3172d5[_0x86bf('0xf')],'data3':_0x3172d5['exten'],'data4':null,'data5':_0x3172d5['queue'],'role':_0x86bf('0x10'),'internal':_0x3172d5[_0x86bf('0x11')]?_[_0x86bf('0x12')](_0x3172d5['accountcode']):undefined,'uniqueid':_0x3172d5[_0x86bf('0x13')]},'log':'CreateMemberReport'});};exports[_0x86bf('0x14')]=function(_0x455b5b){return client[_0x86bf('0x15')](_0x86bf('0x5'),{'body':{'channel':_0x86bf('0x6'),'membername':_0x455b5b[_0x86bf('0x16')],'interface':_0x455b5b[_0x86bf('0xb')],'type':_0x86bf('0x17'),'enterAt':_0x455b5b[_0x86bf('0x18')],'exitAt':_0x455b5b[_0x86bf('0x19')],'duration':moment(_0x455b5b[_0x86bf('0x19')])[_0x86bf('0xd')](_0x455b5b[_0x86bf('0x18')],_0x86bf('0x1a'))>=0x0?moment(_0x455b5b[_0x86bf('0x19')])[_0x86bf('0xd')](_0x455b5b[_0x86bf('0x18')],_0x86bf('0x1a')):null,'data1':_0x86bf('0x1b'),'data2':_0x455b5b['accountcode'],'data3':_0x455b5b[_0x86bf('0x1c')],'data4':_0x455b5b[_0x86bf('0x1d')]||null,'role':'agent','internal':_0x455b5b[_0x86bf('0x11')]?_[_0x86bf('0x12')](_0x455b5b[_0x86bf('0x11')]):undefined,'uniqueid':_0x455b5b[_0x86bf('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c315624..33925ee 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 _0x0713=['name','Request','GetTemplate'];(function(_0x44812d,_0x2b8a34){var _0x42fd7d=function(_0x4b8430){while(--_0x4b8430){_0x44812d['push'](_0x44812d['shift']());}};_0x42fd7d(++_0x2b8a34);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x2936e7){return function(_0x2afa91){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'attributes':['id',_0x3071('0x2'),'html']},'log':_0x3071('0x1')});};}; \ No newline at end of file +var _0x9c00=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x1643e3,_0x31d511){var _0x32a2bf=function(_0x2b34da){while(--_0x2b34da){_0x1643e3['push'](_0x1643e3['shift']());}};_0x32a2bf(++_0x31d511);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0x9c00[_0x2d0b84];return _0x8d0088;};'use strict';var client=require(_0x09c0('0x0'));exports[_0x09c0('0x1')]=function(_0x4dff21){return function(_0x5e32e7){return client[_0x09c0('0x2')](_0x09c0('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x09c0('0x4')]},'log':_0x09c0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7738def..8892ef5 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 _0x9108=['data6','data7','GetTrigger','getTriggers','Request','name','Condition','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data5'];(function(_0x2ddff3,_0x37f800){var _0x1ef020=function(_0x552221){while(--_0x552221){_0x2ddff3['push'](_0x2ddff3['shift']());}};_0x1ef020(++_0x37f800);}(_0x9108,0x135));var _0x8910=function(_0x1f6c7e,_0x14732b){_0x1f6c7e=_0x1f6c7e-0x0;var _0x28bff2=_0x9108[_0x1f6c7e];return _0x28bff2;};'use strict';var client=require('../client');exports[_0x8910('0x0')]=function(_0x5080bd){return function(_0x4d9495){return client[_0x8910('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x8910('0x2'),'channel','status'],'include':[{'model':_0x8910('0x3'),'as':'AllConditions','attributes':['id',_0x8910('0x4'),_0x8910('0x5'),_0x8910('0x6')]},{'model':_0x8910('0x3'),'as':'AnyConditions','attributes':['id',_0x8910('0x4'),'operator','value']},{'model':_0x8910('0x7'),'as':_0x8910('0x8'),'attributes':['id',_0x8910('0x9'),_0x8910('0xa'),_0x8910('0xb'),_0x8910('0xc'),_0x8910('0xd'),_0x8910('0xe'),_0x8910('0xf'),_0x8910('0x10')]}]},'log':_0x8910('0x11')});};}; \ No newline at end of file +var _0x3920=['data3','data5','data7','GetTrigger','../client','getTriggers','Request','name','status','AllConditions','field','value','Condition','operator','data1','data2'];(function(_0xa710b5,_0x2fac05){var _0xa27344=function(_0x3d34c2){while(--_0x3d34c2){_0xa710b5['push'](_0xa710b5['shift']());}};_0xa27344(++_0x2fac05);}(_0x3920,0x104));var _0x0392=function(_0x2b7c48,_0x377555){_0x2b7c48=_0x2b7c48-0x0;var _0x55f238=_0x3920[_0x2b7c48];return _0x55f238;};'use strict';var client=require(_0x0392('0x0'));exports[_0x0392('0x1')]=function(_0xfe87f7){return function(_0x2262b2){return client[_0x0392('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0392('0x3'),'channel',_0x0392('0x4')],'include':[{'model':'Condition','as':_0x0392('0x5'),'attributes':['id',_0x0392('0x6'),'operator',_0x0392('0x7')]},{'model':_0x0392('0x8'),'as':'AnyConditions','attributes':['id',_0x0392('0x6'),_0x0392('0x9'),_0x0392('0x7')]},{'model':'Action','as':'Actions','attributes':['id','action',_0x0392('0xa'),_0x0392('0xb'),_0x0392('0xc'),'data4',_0x0392('0xd'),'data6',_0x0392('0xe')]}]},'log':_0x0392('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1f4ac49..083a754 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 _0x66d4=['GetTrunk','name','registry','getTrunks','Request'];(function(_0x14bf4c,_0x55f009){var _0x26f8b8=function(_0xbd866f){while(--_0xbd866f){_0x14bf4c['push'](_0x14bf4c['shift']());}};_0x26f8b8(++_0x55f009);}(_0x66d4,0xf3));var _0x466d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x66d4[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports[_0x466d('0x0')]=function(_0x5f3f59){return function(_0x2ed971){return client[_0x466d('0x1')](_0x466d('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x466d('0x3'),_0x466d('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xb30a=['registry','../client','getTrunks','Request','name'];(function(_0x4222e4,_0x25096f){var _0x4bfa29=function(_0x1fd1c1){while(--_0x1fd1c1){_0x4222e4['push'](_0x4222e4['shift']());}};_0x4bfa29(++_0x25096f);}(_0xb30a,0x88));var _0xab30=function(_0x366871,_0x3b4c4e){_0x366871=_0x366871-0x0;var _0x1a9f90=_0xb30a[_0x366871];return _0x1a9f90;};'use strict';var client=require(_0xab30('0x0'));exports[_0xab30('0x1')]=function(_0x30e412){return function(_0x2d9d12){return client[_0xab30('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xab30('0x3'),_0xab30('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ea01b47..00c2817 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 _0x98ce=['agent','name','email','accountcode','fullname','online','lastLoginAt','voicePause','phone','mobile','interface','getTelephones','Request','GetUser','telephone','internal','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','pauseType','lastPauseAt','getAgents'];(function(_0x28a936,_0x2f03f4){var _0x57211c=function(_0x46e4b9){while(--_0x46e4b9){_0x28a936['push'](_0x28a936['shift']());}};_0x57211c(++_0x2f03f4);}(_0x98ce,0x77));var _0xe98c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x98ce[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports[_0xe98c('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0xe98c('0x1')},'attributes':['id',_0xe98c('0x2'),_0xe98c('0x3'),_0xe98c('0x4'),_0xe98c('0x5'),_0xe98c('0x6'),_0xe98c('0x7'),'pauseType','lastPauseAt',_0xe98c('0x8'),_0xe98c('0x9'),_0xe98c('0xa'),_0xe98c('0xb')]},'log':_0xe98c('0x0')});};};exports[_0xe98c('0xc')]=function(){return function(){return client[_0xe98c('0xd')](_0xe98c('0xe'),{'options':{'raw':!![],'where':{'role':_0xe98c('0xf')},'attributes':['id',_0xe98c('0x2'),'accountcode',_0xe98c('0x10')]},'log':_0xe98c('0xc')});};};exports[_0xe98c('0x11')]=function(_0x4b2841,_0x5e04ee,_0x38350a){return client[_0xe98c('0xd')]('PauseUser',{'body':{'type':_0x5e04ee,'uniqueid':_0x38350a},'options':{'where':{'id':_0x4b2841['id']}},'log':'savePause'});};exports[_0xe98c('0x12')]=function(_0x2a1613){return client[_0xe98c('0xd')](_0xe98c('0x13'),{'body':{},'options':{'where':{'id':_0x2a1613['id']}},'log':_0xe98c('0x11')});};exports[_0xe98c('0x14')]=function(_0x1b5bf2){return client['Request'](_0xe98c('0x15'),{'options':{'raw':![],'where':{'role':_0xe98c('0x1'),'id':_0x1b5bf2},'attributes':['id',_0xe98c('0x2'),_0xe98c('0x3'),'accountcode',_0xe98c('0x5'),_0xe98c('0x6'),'lastLoginAt',_0xe98c('0x16'),_0xe98c('0x17'),_0xe98c('0x8'),'interface']},'log':_0xe98c('0x14')});}; \ No newline at end of file +var _0x4ab6=['lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','accountcode','lastLoginAt','pauseType','getAgent','../client','getAgents','Request','GetUser','agent','name','email','fullname','online'];(function(_0xc080f5,_0x3b243b){var _0x3441ce=function(_0x53dd6b){while(--_0x53dd6b){_0xc080f5['push'](_0xc080f5['shift']());}};_0x3441ce(++_0x3b243b);}(_0x4ab6,0xc7));var _0x64ab=function(_0x7835a,_0x7ef740){_0x7835a=_0x7835a-0x0;var _0xd46e11=_0x4ab6[_0x7835a];return _0xd46e11;};'use strict';var client=require(_0x64ab('0x0'));exports[_0x64ab('0x1')]=function(){return function(){return client[_0x64ab('0x2')](_0x64ab('0x3'),{'options':{'raw':![],'where':{'role':_0x64ab('0x4')},'attributes':['id',_0x64ab('0x5'),_0x64ab('0x6'),'accountcode',_0x64ab('0x7'),_0x64ab('0x8'),'lastLoginAt','pauseType',_0x64ab('0x9'),_0x64ab('0xa'),_0x64ab('0xb'),_0x64ab('0xc'),_0x64ab('0xd')]},'log':_0x64ab('0x1')});};};exports[_0x64ab('0xe')]=function(){return function(){return client[_0x64ab('0x2')](_0x64ab('0x3'),{'options':{'raw':!![],'where':{'role':_0x64ab('0xf')},'attributes':['id',_0x64ab('0x5'),'accountcode',_0x64ab('0x10')]},'log':_0x64ab('0xe')});};};exports[_0x64ab('0x11')]=function(_0x37160a,_0x597979,_0x1adea9){return client[_0x64ab('0x2')](_0x64ab('0x12'),{'body':{'type':_0x597979,'uniqueid':_0x1adea9},'options':{'where':{'id':_0x37160a['id']}},'log':_0x64ab('0x11')});};exports[_0x64ab('0x13')]=function(_0x2cfece){return client[_0x64ab('0x2')](_0x64ab('0x14'),{'body':{},'options':{'where':{'id':_0x2cfece['id']}},'log':_0x64ab('0x11')});};exports['getAgent']=function(_0x8d35cf){return client[_0x64ab('0x2')](_0x64ab('0x15'),{'options':{'raw':![],'where':{'role':_0x64ab('0x4'),'id':_0x8d35cf},'attributes':['id',_0x64ab('0x5'),_0x64ab('0x6'),_0x64ab('0x16'),_0x64ab('0x7'),'online',_0x64ab('0x17'),_0x64ab('0x18'),_0x64ab('0x9'),'voicePause','interface']},'log':_0x64ab('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ac5d81d..0546101 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 _0x2333=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x2333,0x11a));var _0x3233=function(_0x1727f0,_0x478057){_0x1727f0=_0x1727f0-0x0;var _0x2efacc=_0x2333[_0x1727f0];return _0x2efacc;};'use strict';var client=require(_0x3233('0x0'));exports[_0x3233('0x1')]=function(_0x4c4ec0){return client['Request'](_0x3233('0x2'),{'body':_0x4c4ec0,'log':_0x3233('0x2')});};exports['update']=function(_0x8fdc58,_0x1c473f,_0x698dea){return client[_0x3233('0x3')](_0x3233('0x4'),{'body':_0x8fdc58,'options':{'where':{'uniqueid':_0x1c473f,'interface':_0x698dea,'agentcomplete':!![]}},'log':_0x3233('0x4')});}; \ No newline at end of file +var _0x03e5=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x03e5,0x128));var _0x503e=function(_0x1e68f1,_0x3fb68a){_0x1e68f1=_0x1e68f1-0x0;var _0x2c3d4d=_0x03e5[_0x1e68f1];return _0x2c3d4d;};'use strict';var client=require(_0x503e('0x0'));exports[_0x503e('0x1')]=function(_0x4942){return client[_0x503e('0x2')](_0x503e('0x3'),{'body':_0x4942,'log':_0x503e('0x3')});};exports['update']=function(_0x3d8047,_0x2d1cd7,_0x5ae07a){return client[_0x503e('0x2')](_0x503e('0x4'),{'body':_0x3d8047,'options':{'where':{'uniqueid':_0x2d1cd7,'interface':_0x5ae07a,'agentcomplete':!![]}},'log':_0x503e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index fba4cb6..c82d639 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 _0x6b73=['moment','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','outbound','startOf','day','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0x127f3c,_0x207765){var _0x2d74a6=function(_0x1ae827){while(--_0x1ae827){_0x127f3c['push'](_0x127f3c['shift']());}};_0x2d74a6(++_0x207765);}(_0x6b73,0x1db));var _0x36b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b73[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x36b7('0x0'));var util=require('util');var _=require(_0x36b7('0x1'));var client=require(_0x36b7('0x2'));exports['create']=function(_0x4d0fc7){return client[_0x36b7('0x3')](_0x36b7('0x4'),{'body':_[_0x36b7('0x5')](_0x4d0fc7,{'source':_0x4d0fc7[_0x36b7('0x6')],'destinationcontext':_0x4d0fc7['context'],'callerid':_0x4d0fc7[_0x36b7('0x7')],'amaflags':_0x36b7('0x8')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x36b7('0x9')],'createdAt':{'$between':[moment()[_0x36b7('0xa')](_0x36b7('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x36b7('0xc')](_0x36b7('0xb'))['format'](_0x36b7('0xd'))]}},'attributes':[_0x36b7('0xe'),_0x36b7('0xf'),_0x36b7('0x10'),_0x36b7('0x11')]},'log':_0x36b7('0x12')});};}; \ No newline at end of file +var _0x9678=['util','lodash','../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x9678,0x12b));var _0x8967=function(_0x3492e8,_0x5be6b0){_0x3492e8=_0x3492e8-0x0;var _0x1d41b4=_0x9678[_0x3492e8];return _0x1d41b4;};'use strict';var moment=require(_0x8967('0x0'));var util=require(_0x8967('0x1'));var _=require(_0x8967('0x2'));var client=require(_0x8967('0x3'));exports[_0x8967('0x4')]=function(_0xa1b159){return client[_0x8967('0x5')](_0x8967('0x6'),{'body':_['merge'](_0xa1b159,{'source':_0xa1b159['calleridnum'],'destinationcontext':_0xa1b159[_0x8967('0x7')],'callerid':_0xa1b159[_0x8967('0x8')],'amaflags':_0x8967('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8967('0x5')](_0x8967('0xa'),{'options':{'where':{'type':[_0x8967('0xb')],'createdAt':{'$between':[moment()[_0x8967('0xc')](_0x8967('0xd'))['format'](_0x8967('0xe')),moment()[_0x8967('0xf')](_0x8967('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x8967('0x10'),_0x8967('0x11'),_0x8967('0x12')]},'log':_0x8967('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 45eca10..d71e641 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 _0xef85=['Request','CreateVoiceDialReport','../client','create'];(function(_0x100eb8,_0x3c3989){var _0x41865f=function(_0x1a9338){while(--_0x1a9338){_0x100eb8['push'](_0x100eb8['shift']());}};_0x41865f(++_0x3c3989);}(_0xef85,0x1de));var _0x5ef8=function(_0xbd7cd2,_0x7a5214){_0xbd7cd2=_0xbd7cd2-0x0;var _0x3f03b5=_0xef85[_0xbd7cd2];return _0x3f03b5;};'use strict';var client=require(_0x5ef8('0x0'));exports[_0x5ef8('0x1')]=function(_0x430807){return client[_0x5ef8('0x2')](_0x5ef8('0x3'),{'body':_0x430807,'log':_0x5ef8('0x3')});}; \ No newline at end of file +var _0xa294=['Request','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa294,0x11b));var _0x4a29=function(_0xb7ce6b,_0x626535){_0xb7ce6b=_0xb7ce6b-0x0;var _0xe669b4=_0xa294[_0xb7ce6b];return _0xe669b4;};'use strict';var client=require('../client');exports[_0x4a29('0x0')]=function(_0x46ac20){return client[_0x4a29('0x1')]('CreateVoiceDialReport',{'body':_0x46ac20,'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 709222a..20b5606 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 _0x2182=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2182,0xea));var _0x2218=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2182[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x2218('0x0'));exports[_0x2218('0x1')]=function(){return function(){return client[_0x2218('0x2')](_0x2218('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x2218('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xdbf0=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xdbf0,0x1db));var _0x0dbf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdbf0[_0x4a9fb1];return _0x348672;};'use strict';var client=require('../client');exports[_0x0dbf('0x0')]=function(){return function(){return client[_0x0dbf('0x1')](_0x0dbf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0dbf('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x0dbf('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 205c488..500e851 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 _0x5618=['dialCutDigit','mandatoryDisposition','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber'];(function(_0x173207,_0x4fb6e4){var _0x4b517c=function(_0x2eac8a){while(--_0x2eac8a){_0x173207['push'](_0x173207['shift']());}};_0x4b517c(++_0x4fb6e4);}(_0x5618,0xb4));var _0x8561=function(_0x792026,_0xd0bb26){_0x792026=_0x792026-0x0;var _0x3266cf=_0x5618[_0x792026];return _0x3266cf;};'use strict';var client=require(_0x8561('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x8561('0x1'),{'options':{'raw':![],'attributes':['id',_0x8561('0x2'),_0x8561('0x3'),_0x8561('0x4'),_0x8561('0x5'),_0x8561('0x6'),_0x8561('0x7'),'dialActive',_0x8561('0x8'),_0x8561('0x9'),'dialLimitQueue',_0x8561('0xa'),'dialPredictiveOptimization',_0x8561('0xb'),_0x8561('0xc'),_0x8561('0xd'),_0x8561('0xe'),_0x8561('0xf'),_0x8561('0x10'),_0x8561('0x11'),_0x8561('0x12'),_0x8561('0x13'),'dialCongestionRetryFrequency',_0x8561('0x14'),_0x8561('0x15'),_0x8561('0x16'),_0x8561('0x17'),_0x8561('0x18'),_0x8561('0x19'),_0x8561('0x1a'),_0x8561('0x1b'),_0x8561('0x1c'),'dialAMDActive',_0x8561('0x1d'),_0x8561('0x1e'),'dialAMDAfterGreetingSilence',_0x8561('0x1f'),_0x8561('0x20'),_0x8561('0x21'),_0x8561('0x22'),_0x8561('0x23'),_0x8561('0x24'),_0x8561('0x25'),_0x8561('0x26'),_0x8561('0x27'),_0x8561('0x28'),_0x8561('0x29'),'dialAgiAfterHangupClient','dialQueueProject2',_0x8561('0x6'),_0x8561('0x2a'),_0x8561('0x2b'),_0x8561('0x2c'),_0x8561('0x2d'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x8561('0x2e'),'attributes':['id','name',_0x8561('0x2f'),_0x8561('0x30')]},{'model':_0x8561('0x31'),'as':_0x8561('0x32'),'attributes':['id',_0x8561('0x2')]},{'model':'Trunk','as':_0x8561('0x33'),'attributes':['id',_0x8561('0x2'),'callerid',_0x8561('0x30')]},{'model':_0x8561('0x34'),'as':'Interval','attributes':['id',_0x8561('0x2')],'include':[{'model':_0x8561('0x34'),'as':_0x8561('0x35'),'attributes':['id',_0x8561('0x2'),_0x8561('0x36')]}]}]},'log':_0x8561('0x37')});};}; \ No newline at end of file +var _0x4604=['Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialPredictiveIntervalMaxThreshold','Trunk','Pause','callerid','active','Interval'];(function(_0x3a956f,_0x400a31){var _0x483467=function(_0x53ae1e){while(--_0x53ae1e){_0x3a956f['push'](_0x3a956f['shift']());}};_0x483467(++_0x400a31);}(_0x4604,0xed));var _0x4460=function(_0x4a8ca2,_0x46e521){_0x4a8ca2=_0x4a8ca2-0x0;var _0x17271d=_0x4604[_0x4a8ca2];return _0x17271d;};'use strict';var client=require('../client');exports[_0x4460('0x0')]=function(){return function(){return client[_0x4460('0x1')](_0x4460('0x2'),{'options':{'raw':![],'attributes':['id',_0x4460('0x3'),'acw',_0x4460('0x4'),_0x4460('0x5'),_0x4460('0x6'),'type',_0x4460('0x7'),_0x4460('0x8'),_0x4460('0x9'),'dialLimitQueue','dialPowerLevel',_0x4460('0xa'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x4460('0xb'),_0x4460('0xc'),_0x4460('0xd'),_0x4460('0xe'),'dialQueueTimeout',_0x4460('0xf'),_0x4460('0x10'),_0x4460('0x11'),_0x4460('0x12'),_0x4460('0x13'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x4460('0x14'),_0x4460('0x15'),'dialGlobalInterval',_0x4460('0x16'),_0x4460('0x17'),_0x4460('0x18'),_0x4460('0x19'),_0x4460('0x1a'),_0x4460('0x1b'),'dialAMDTotalAnalysisTime',_0x4460('0x1c'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x4460('0x1d'),'dialAMDMaximumWordLength','timeout',_0x4460('0x1e'),_0x4460('0x1f'),_0x4460('0x20'),_0x4460('0x21'),_0x4460('0x22'),_0x4460('0x23'),_0x4460('0x6'),_0x4460('0x24'),_0x4460('0x25'),_0x4460('0x26'),'mandatoryDisposition',_0x4460('0x27'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x4460('0x28'),'as':_0x4460('0x28'),'attributes':['id',_0x4460('0x3'),'callerid','active']},{'model':_0x4460('0x29'),'as':'mandatoryDispositionPause','attributes':['id',_0x4460('0x3')]},{'model':_0x4460('0x28'),'as':'TrunkBackup','attributes':['id',_0x4460('0x3'),_0x4460('0x2a'),_0x4460('0x2b')]},{'model':_0x4460('0x2c'),'as':_0x4460('0x2c'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0x4460('0x2d'),'attributes':['id','name',_0x4460('0x2e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 62b1f23..729a2e3 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 _0x01bd=['queuecallercomplete','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','../client','create','CreateVoiceQueueReport','Request','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x271934,_0x4f2991){var _0x57a179=function(_0x50c0e8){while(--_0x50c0e8){_0x271934['push'](_0x271934['shift']());}};_0x57a179(++_0x4f2991);}(_0x01bd,0x1e1));var _0xd01b=function(_0x559434,_0x2f9870){_0x559434=_0x559434-0x0;var _0x252834=_0x01bd[_0x559434];return _0x252834;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0xd01b('0x0'));exports[_0xd01b('0x1')]=function(_0x24989a){return client['Request'](_0xd01b('0x2'),{'body':_0x24989a,'log':_0xd01b('0x2')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xd01b('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xd01b('0x4')]('day')[_0xd01b('0x5')](_0xd01b('0x6')),moment()[_0xd01b('0x7')](_0xd01b('0x8'))[_0xd01b('0x5')](_0xd01b('0x6'))]}},'attributes':[_0xd01b('0x9'),'queue',_0xd01b('0xa'),_0xd01b('0xb'),_0xd01b('0xc'),'queuecallercompleteAt',_0xd01b('0xd'),'queuecallerexitAt',_0xd01b('0xe'),_0xd01b('0xf')]},'log':_0xd01b('0x10')});};}; \ No newline at end of file +var _0x786e=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x786e,0x1bc));var _0xe786=function(_0x53210a,_0x4a49f1){_0x53210a=_0x53210a-0x0;var _0x82411c=_0x786e[_0x53210a];return _0x82411c;};'use strict';var moment=require(_0xe786('0x0'));var _=require(_0xe786('0x1'));var client=require('../client');exports[_0xe786('0x2')]=function(_0x1e35ee){return client[_0xe786('0x3')]('CreateVoiceQueueReport',{'body':_0x1e35ee,'log':_0xe786('0x4')});};exports[_0xe786('0x5')]=function(){return function(){return client['Request'](_0xe786('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xe786('0x7')](_0xe786('0x8'))[_0xe786('0x9')](_0xe786('0xa')),moment()[_0xe786('0xb')](_0xe786('0x8'))[_0xe786('0x9')](_0xe786('0xa'))]}},'attributes':[_0xe786('0xc'),_0xe786('0xd'),_0xe786('0xe'),_0xe786('0xf'),_0xe786('0x10'),_0xe786('0x11'),'queuecallerexit',_0xe786('0x12'),_0xe786('0x13'),'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 0bc2d6c..b3775f9 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 _0xf574=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xf574,0x103));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x4f57('0x0'));exports[_0x4f57('0x1')]=function(_0x359b99){return function(){return client[_0x4f57('0x2')](_0x4f57('0x3'),{'options':{'where':{'VoiceQueueId':_0x359b99,'paused':!![]},'raw':!![]},'log':_0x4f57('0x1')});};}; \ No newline at end of file +var _0xc556=['getVoiceQueueRtPauses','Request'];(function(_0x4a0918,_0x40cf2e){var _0x648c2e=function(_0x30041){while(--_0x30041){_0x4a0918['push'](_0x4a0918['shift']());}};_0x648c2e(++_0x40cf2e);}(_0xc556,0xe4));var _0x6c55=function(_0x44735e,_0x3f39dc){_0x44735e=_0x44735e-0x0;var _0x1f3c89=_0xc556[_0x44735e];return _0x1f3c89;};'use strict';var client=require('../client');exports[_0x6c55('0x0')]=function(_0x204ffd){return function(){return client[_0x6c55('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x204ffd,'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 ce4e97e..6b6b4a4 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 _0x9056=['create','Request','merge','monitorFilename','CreateVoiceRecording','lodash','../client'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x9056,0x155));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6905('0x0'));var client=require(_0x6905('0x1'));exports[_0x6905('0x2')]=function(_0x6e900e){return client[_0x6905('0x3')]('CreateVoiceRecording',{'body':_[_0x6905('0x4')](_0x6e900e,{'value':_0x6e900e[_0x6905('0x5')]}),'log':_0x6905('0x6')});}; \ No newline at end of file +var _0x0a26=['lodash','create','Request','CreateVoiceRecording','monitorFilename'];(function(_0x5f5399,_0x4928ca){var _0x5e5647=function(_0x55f02e){while(--_0x55f02e){_0x5f5399['push'](_0x5f5399['shift']());}};_0x5e5647(++_0x4928ca);}(_0x0a26,0x19a));var _0x60a2=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x0a26[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x60a2('0x0'));var client=require('../client');exports[_0x60a2('0x1')]=function(_0x1f2fe8){return client[_0x60a2('0x2')](_0x60a2('0x3'),{'body':_['merge'](_0x1f2fe8,{'value':_0x1f2fe8[_0x60a2('0x4')]}),'log':_0x60a2('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 32848da..c079a4e 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 _0xfc89=['attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecontext','transfereeexten','transfereelinkedid','isexternal','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc89,0x1bd));var _0x9fc8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xfc89[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0x9fc8('0x0'));exports[_0x9fc8('0x1')]=function(_0x2f76b3){return client[_0x9fc8('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2f76b3[_0x9fc8('0x3')],'transfererchannel':_0x2f76b3[_0x9fc8('0x4')],'transferercalleridnum':_0x2f76b3['transferercalleridnum'],'transferercalleridname':_0x2f76b3[_0x9fc8('0x5')],'transfererconnectedlinenum':_0x2f76b3[_0x9fc8('0x6')],'transfererconnectedlinename':_0x2f76b3[_0x9fc8('0x7')],'transfereraccountcode':_0x2f76b3['transfereraccountcode'],'transferercontext':_0x2f76b3[_0x9fc8('0x8')],'transfererexten':_0x2f76b3[_0x9fc8('0x9')],'transfererlinkedid':_0x2f76b3['transfererlinkedid'],'transfereechannel':_0x2f76b3[_0x9fc8('0xa')],'transfereecalleridnum':_0x2f76b3[_0x9fc8('0xb')],'transfereecalleridname':_0x2f76b3['transfereecalleridname'],'transfereeconnectedlinenum':_0x2f76b3['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2f76b3['transfereeconnectedlinename'],'transfereeaccountcode':_0x2f76b3['transfereeaccountcode'],'transfereecontext':_0x2f76b3[_0x9fc8('0xc')],'transfereeexten':_0x2f76b3[_0x9fc8('0xd')],'transfereelinkedid':_0x2f76b3[_0x9fc8('0xe')],'isexternal':_0x2f76b3[_0x9fc8('0xf')],'context':_0x2f76b3['context'],'extension':_0x2f76b3['extension'],'type':_0x9fc8('0x10')},'log':'CreateVoiceTransferReport'});};exports[_0x9fc8('0x11')]=function(_0x4a04d4){return client[_0x9fc8('0x2')](_0x9fc8('0x12'),{'body':{'result':_0x4a04d4['result'],'transfererchannel':_0x4a04d4[_0x9fc8('0x13')],'transferercalleridnum':_0x4a04d4[_0x9fc8('0x14')],'transferercalleridname':_0x4a04d4[_0x9fc8('0x15')],'transfererconnectedlinenum':_0x4a04d4[_0x9fc8('0x16')],'transfererconnectedlinename':_0x4a04d4[_0x9fc8('0x17')],'transfereraccountcode':_0x4a04d4[_0x9fc8('0x18')],'transferercontext':_0x4a04d4[_0x9fc8('0x19')],'transfererexten':_0x4a04d4[_0x9fc8('0x1a')],'transfererlinkedid':_0x4a04d4[_0x9fc8('0x1b')],'transfereechannel':_0x4a04d4[_0x9fc8('0x1c')],'transfereecalleridnum':_0x4a04d4['transfertargetcalleridnum'],'transfereecalleridname':_0x4a04d4[_0x9fc8('0x1d')],'transfereeconnectedlinenum':_0x4a04d4[_0x9fc8('0x1e')],'transfereeconnectedlinename':_0x4a04d4['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4a04d4[_0x9fc8('0x1f')],'transfereecontext':_0x4a04d4['transfertargetcontext'],'transfereeexten':_0x4a04d4[_0x9fc8('0x20')],'transfereelinkedid':_0x4a04d4[_0x9fc8('0x21')],'isexternal':_0x4a04d4['isexternal'],'context':_0x4a04d4[_0x9fc8('0x22')],'extension':_0x4a04d4[_0x9fc8('0x23')],'type':_0x9fc8('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xa6e7=['secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','blind','Request','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x5260b3,_0x326be2){var _0x9cbce=function(_0x596ca9){while(--_0x596ca9){_0x5260b3['push'](_0x5260b3['shift']());}};_0x9cbce(++_0x326be2);}(_0xa6e7,0xec));var _0x7a6e=function(_0xca8631,_0x3dd392){_0xca8631=_0xca8631-0x0;var _0x44400f=_0xa6e7[_0xca8631];return _0x44400f;};'use strict';var client=require(_0x7a6e('0x0'));exports[_0x7a6e('0x1')]=function(_0x2b196f){return client['Request'](_0x7a6e('0x2'),{'body':{'result':_0x2b196f['result'],'transfererchannel':_0x2b196f[_0x7a6e('0x3')],'transferercalleridnum':_0x2b196f[_0x7a6e('0x4')],'transferercalleridname':_0x2b196f[_0x7a6e('0x5')],'transfererconnectedlinenum':_0x2b196f['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2b196f[_0x7a6e('0x6')],'transfereraccountcode':_0x2b196f['transfereraccountcode'],'transferercontext':_0x2b196f['transferercontext'],'transfererexten':_0x2b196f[_0x7a6e('0x7')],'transfererlinkedid':_0x2b196f[_0x7a6e('0x8')],'transfereechannel':_0x2b196f[_0x7a6e('0x9')],'transfereecalleridnum':_0x2b196f['transfereecalleridnum'],'transfereecalleridname':_0x2b196f['transfereecalleridname'],'transfereeconnectedlinenum':_0x2b196f[_0x7a6e('0xa')],'transfereeconnectedlinename':_0x2b196f['transfereeconnectedlinename'],'transfereeaccountcode':_0x2b196f[_0x7a6e('0xb')],'transfereecontext':_0x2b196f[_0x7a6e('0xc')],'transfereeexten':_0x2b196f[_0x7a6e('0xd')],'transfereelinkedid':_0x2b196f[_0x7a6e('0xe')],'isexternal':_0x2b196f[_0x7a6e('0xf')],'context':_0x2b196f['context'],'extension':_0x2b196f['extension'],'type':_0x7a6e('0x10')},'log':_0x7a6e('0x2')});};exports['attendedTransfer']=function(_0x3eb377){return client[_0x7a6e('0x11')](_0x7a6e('0x2'),{'body':{'result':_0x3eb377[_0x7a6e('0x12')],'transfererchannel':_0x3eb377[_0x7a6e('0x13')],'transferercalleridnum':_0x3eb377['origtransferercalleridnum'],'transferercalleridname':_0x3eb377[_0x7a6e('0x14')],'transfererconnectedlinenum':_0x3eb377[_0x7a6e('0x15')],'transfererconnectedlinename':_0x3eb377['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3eb377[_0x7a6e('0x16')],'transferercontext':_0x3eb377[_0x7a6e('0x17')],'transfererexten':_0x3eb377['secondtransfererexten'],'transfererlinkedid':_0x3eb377[_0x7a6e('0x18')],'transfereechannel':_0x3eb377[_0x7a6e('0x19')],'transfereecalleridnum':_0x3eb377[_0x7a6e('0x1a')],'transfereecalleridname':_0x3eb377[_0x7a6e('0x1b')],'transfereeconnectedlinenum':_0x3eb377[_0x7a6e('0x1c')],'transfereeconnectedlinename':_0x3eb377[_0x7a6e('0x1d')],'transfereeaccountcode':_0x3eb377[_0x7a6e('0x1e')],'transfereecontext':_0x3eb377[_0x7a6e('0x1f')],'transfereeexten':_0x3eb377[_0x7a6e('0x20')],'transfereelinkedid':_0x3eb377[_0x7a6e('0x21')],'isexternal':_0x3eb377[_0x7a6e('0xf')],'context':_0x3eb377[_0x7a6e('0x22')],'extension':_0x3eb377[_0x7a6e('0x23')],'type':_0x7a6e('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1df808f..271832e 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 _0x044f=['server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','then','message','catch','command','action','Command','voiceQueues','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','push','length','channels','voicechannel','validate','map','find','uniqueid','channel','filename','wav','Action','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Redirect','exten','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send'];(function(_0x2136e3,_0xb9a9ab){var _0x55c297=function(_0x6b9df8){while(--_0x6b9df8){_0x2136e3['push'](_0x2136e3['shift']());}};_0x55c297(++_0xb9a9ab);}(_0x044f,0x10d));var _0xf044=function(_0x508d16,_0x3e5c76){_0x508d16=_0x508d16-0x0;var _0x169e38=_0x044f[_0x508d16];return _0x169e38;};'use strict';var _=require(_0xf044('0x0'));var util=require(_0xf044('0x1'));var jayson=require(_0xf044('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0xf044('0x3'));var config=require(_0xf044('0x4'));var properties=require(_0xf044('0x5'));var ami=require(_0xf044('0x6'));exports[_0xf044('0x7')]=function(_0x177e4e,_0x269ddf,_0x3f8000){return new BPromise(function(_0x32aac9,_0x1f7711){var _0x3d961c={'QueuePause':function(_0x11a7b7){return new Promise(function(_0xc93f30,_0x3f5179){var _0x5000d4=util[_0xf044('0x8')](_0xf044('0x9'),_0xf044('0xa'),_0x11a7b7['name']);if(_0x177e4e[_0xf044('0xb')]&&_0x177e4e[_0xf044('0xb')][_0x5000d4]&&_0x177e4e[_0xf044('0xb')][_0x5000d4][_0xf044('0xc')]){_0x177e4e[_0xf044('0xb')][_0x5000d4][_0xf044('0xd')]();}if(_0x177e4e[_0xf044('0xe')][_0x5000d4]){_0x177e4e[_0xf044('0xe')][_0x5000d4][_0xf044('0xf')]({'statePause':_0x11a7b7[_0xf044('0x10')]?!![]:![]});}_0xc93f30({'code':0xc8,'message':_0xf044('0x11')});});},'Reload':function(_0x286e34){var _0x16f0d5=this;return new Promise(function(_0x1dda14,_0x23cc98){if(ami[_0xf044('0x12')]()==![]){return _0x23cc98(_0x16f0d5[_0xf044('0x13')](0x1f4,[config[_0xf044('0x14')]['ip'],config[_0xf044('0x14')][_0xf044('0x15')],'ami\x20disconnected'][_0xf044('0x16')]('\x20')));}_0x286e34=_[_0xf044('0x17')](_0x286e34,_[_0xf044('0x18')](properties['module']));_0x286e34['action']='Reload';return ami['Action'](_0x286e34)[_0xf044('0x19')](function(_0x50fdcd){_0x1dda14({'code':0xc8,'message':_0x50fdcd[_0xf044('0x1a')]});})[_0xf044('0x1b')](function(_0x331c64){_0x23cc98(_0x16f0d5[_0xf044('0x13')](0x1f5,_0x331c64[_0xf044('0x1a')]));});});},'Command':function(_0x45dc29){var _0x10f0e9=this;return new Promise(function(_0x378d2d,_0x165f92){if(ami[_0xf044('0x12')]()==![]){return _0x165f92(_0x10f0e9[_0xf044('0x13')](0x1f4,[config[_0xf044('0x14')]['ip'],config[_0xf044('0x14')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x45dc29=_[_0xf044('0x17')](_0x45dc29,_0xf044('0x1c'));_0x45dc29[_0xf044('0x1d')]=_0xf044('0x1e');return ami['Action'](_0x45dc29)[_0xf044('0x19')](function(_0x26f426){_0x378d2d({'code':0xc8,'message':_0x26f426['content']});})[_0xf044('0x1b')](function(_0x100626){_0x165f92(_0x10f0e9[_0xf044('0x13')](0x1f5,_0x100626[_0xf044('0x1a')]));});});},'VoiceQueues':function(_0x4cbc13){return new Promise(function(_0x5042f8,_0x3e9a6a){var _0x54317c=[];for(var _0x30f422 in _0x177e4e[_0xf044('0x1f')]){if(_0x177e4e[_0xf044('0x1f')]['hasOwnProperty'](_0x30f422)){var _0x571579=_0x177e4e[_0xf044('0x1f')][_0x30f422];var _0x28c567={'id':_0x571579['id'],'name':_0x571579[_0xf044('0x20')],'strategy':_0x571579[_0xf044('0x21')],'answered':_0x571579['answered'],'available':_0x571579[_0xf044('0x22')],'loggedIn':_0x571579[_0xf044('0x23')],'pTalking':_0x571579[_0xf044('0x24')],'sumBillable':_0x571579[_0xf044('0x25')],'sumDuration':_0x571579[_0xf044('0x26')],'sumHoldTime':_0x571579[_0xf044('0x27')]||0x0,'talking':_0x571579['talking'],'total':_0x571579['total'],'type':_0x571579[_0xf044('0x28')],'unmanaged':_0x571579[_0xf044('0x29')],'abandoned':_0x571579[_0xf044('0x2a')],'waiting':_0x571579[_0xf044('0x2b')],'loggedInDb':_0x571579[_0xf044('0x2c')]};if(_0x571579['type']==='outbound'){_0x28c567[_0xf044('0x2d')]=_0x571579['dialActive'];_0x28c567[_0xf044('0x2e')]=_0x571579[_0xf044('0x2e')];_0x28c567[_0xf044('0x2f')]=_0x571579[_0xf044('0x2f')];_0x28c567[_0xf044('0x30')]=_0x571579[_0xf044('0x30')];_0x28c567[_0xf044('0x31')]=_0x571579[_0xf044('0x31')];_0x28c567[_0xf044('0x32')]=_0x571579[_0xf044('0x32')];_0x28c567[_0xf044('0x33')]=_0x571579[_0xf044('0x33')];_0x28c567[_0xf044('0x34')]=_0x571579[_0xf044('0x34')];_0x28c567[_0xf044('0x35')]=_0x571579[_0xf044('0x35')];_0x28c567[_0xf044('0x36')]=_0x571579[_0xf044('0x36')];_0x28c567['outboundCongestionCallsDay']=_0x571579[_0xf044('0x37')];_0x28c567['outboundDropCallsDayACS']=_0x571579['outboundDropCallsDayACS'];_0x28c567[_0xf044('0x38')]=_0x571579[_0xf044('0x38')];_0x28c567[_0xf044('0x39')]=_0x571579[_0xf044('0x39')];_0x28c567['outboundNoAnswerCallsDay']=_0x571579[_0xf044('0x3a')];_0x28c567['outboundNoSuchCallsDay']=_0x571579[_0xf044('0x3b')];_0x28c567[_0xf044('0x3c')]=_0x571579[_0xf044('0x3c')];_0x28c567['outboundReCallsDay']=_0x571579[_0xf044('0x3d')];_0x28c567[_0xf044('0x3e')]=_0x571579[_0xf044('0x3e')];_0x28c567[_0xf044('0x3f')]=_0x571579['outboundUnknownCallsDay'];_0x28c567[_0xf044('0x40')]=_0x571579[_0xf044('0x40')];_0x28c567[_0xf044('0x41')]=_0x571579['predictiveIntervalAvgHoldtime'];_0x28c567[_0xf044('0x42')]=_0x571579[_0xf044('0x42')];_0x28c567['predictiveIntervalDroppedCallsCallersExit']=_0x571579[_0xf044('0x43')];_0x28c567['predictiveIntervalDroppedCallsTimeout']=_0x571579[_0xf044('0x44')];_0x28c567['predictiveIntervalErlangCalls']=_0x571579['predictiveIntervalErlangCalls'];_0x28c567[_0xf044('0x45')]=_0x571579[_0xf044('0x45')];_0x28c567['predictiveIntervalHitRate']=_0x571579['predictiveIntervalHitRate'];_0x28c567[_0xf044('0x46')]=_0x571579['predictiveIntervalMultiplicativeFactor'];_0x28c567[_0xf044('0x47')]=_0x571579[_0xf044('0x47')];_0x28c567['predictiveIntervalAvailable']=_0x571579['predictiveIntervalAvailable'];_0x28c567['predictiveIntervalTotalCalls']=_0x571579['predictiveIntervalTotalCalls'];_0x28c567[_0xf044('0x1a')]=_0x571579[_0xf044('0x1a')];_0x28c567[_0xf044('0x48')]=_0x571579['originated'];_0x28c567[_0xf044('0x49')]=_0x571579[_0xf044('0x49')];_0x28c567['erlangCallToSecond']=_0x571579[_0xf044('0x4a')];_0x28c567['erlangAbandonmentRate']=_0x571579[_0xf044('0x4b')];_0x28c567[_0xf044('0x4c')]=_0x571579[_0xf044('0x4c')];_0x28c567['startPredictive']=_0x571579['startPredictive'];_0x28c567[_0xf044('0x4d')]=_0x571579['startProgressive'];}if(_0x571579[_0xf044('0x4e')]){_0x28c567[_0xf044('0x4e')]={'id':_0x571579[_0xf044('0x4e')]['id'],'name':_0x571579[_0xf044('0x4e')][_0xf044('0x20')],'active':_0x571579['Trunk'][_0xf044('0x4f')],'callerid':_0x571579[_0xf044('0x4e')][_0xf044('0x50')]};}if(_0x571579[_0xf044('0x51')]){_0x28c567[_0xf044('0x51')]={'id':_0x571579['Interval']['id'],'name':_0x571579[_0xf044('0x51')][_0xf044('0x20')]};}_0x54317c[_0xf044('0x52')](_0x28c567);}}_0x5042f8({'count':_0x54317c[_0xf044('0x53')],'rows':_0x54317c});});},'VoiceChannels':function(_0x2182a3){return new Promise(function(_0x392ae4,_0x5bab54){var _0x238f6e=_['values'](_0x177e4e[_0xf044('0x54')]);_0x392ae4({'count':_0x238f6e[_0xf044('0x53')],'rows':_0x238f6e});});},'VoiceChannelMixMonitor':function(_0x1de686){var _0x2618fb=this;return new Promise(function(_0x2d6d47,_0x5693e4){if(ami['isConnected']()==![]){return _0x5693e4(_0x2618fb[_0xf044('0x13')](0x1f4,[config[_0xf044('0x14')]['ip'],config['asterisk'][_0xf044('0x15')],'ami\x20disconnected'][_0xf044('0x16')]('\x20')));}var _0x36c23e=schema(properties[_0xf044('0x55')])[_0xf044('0x56')](_0x1de686);if(_0x36c23e['length']>0x0){return _0x5693e4(_0x2618fb[_0xf044('0x13')](0x1f4,_[_0xf044('0x57')](_0x36c23e,_0xf044('0x1a'))['join'](',\x20')));}var _0x14563e=_[_0xf044('0x58')](_0x177e4e[_0xf044('0x54')],{'uniqueid':_0x1de686[_0xf044('0x59')]});if(_0x14563e&&_0x14563e[_0xf044('0x5a')]){var _0x48342d=util['format']('%s.%s',_0x1de686[_0xf044('0x5b')]||_0x1de686[_0xf044('0x59')],_0x1de686[_0xf044('0x8')]||_0xf044('0x5c'));return ami[_0xf044('0x5d')]({'action':_0xf044('0x5e'),'channel':_0x14563e[_0xf044('0x5a')],'file':_0x48342d,'options':'ai(mixmonitorid)'})[_0xf044('0x19')](function(_0x22571f){var _0x2e2ea3=_['find'](_0x14563e[_0xf044('0x5f')],{'filename':_0xf044('0x60')+_0x48342d[_0xf044('0x61')]()});if(_['isNil'](_0x2e2ea3)){_0x14563e[_0xf044('0x5f')][_0xf044('0x52')]({'filename':_0xf044('0x60')+_0x48342d['toLowerCase'](),'createdAt':moment()['format'](_0xf044('0x62')),'mixmonitorid':_0x22571f[_0xf044('0x63')],'status':_0xf044('0x64')});}else{_0x2e2ea3[_0xf044('0x63')]=_0x22571f['mixmonitorid'];_0x2e2ea3[_0xf044('0x65')]=_0xf044('0x64');}_0x2d6d47({'code':0xc8,'message':[_0x1de686[_0xf044('0x59')],_0xf044('0x66'),_0x22571f[_0xf044('0x63')]][_0xf044('0x16')]('\x20'),'mixmonitorid':_0x22571f[_0xf044('0x63')]});})[_0xf044('0x1b')](function(_0x1e2b3c){_0x5693e4(_0x2618fb['error'](0x1f5,[_0x1de686['uniqueid'],_0x1e2b3c[_0xf044('0x1a')]['toLowerCase']()][_0xf044('0x16')]('\x20')));});}else{return _0x5693e4(_0x2618fb[_0xf044('0x13')](0x1f5,_0xf044('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x2c9fd6){var _0x382460=this;return new Promise(function(_0xca8cef,_0x27ca22){if(ami[_0xf044('0x12')]()==![]){return _0x27ca22(_0x382460[_0xf044('0x13')](0x1f4,[config[_0xf044('0x14')]['ip'],config['asterisk']['username'],_0xf044('0x68')][_0xf044('0x16')]('\x20')));}var _0x5ceffe=schema(properties[_0xf044('0x55')])[_0xf044('0x56')](_0x2c9fd6);if(_0x5ceffe[_0xf044('0x53')]>0x0){return _0x27ca22(_0x382460[_0xf044('0x13')](0x1f4,_[_0xf044('0x57')](_0x5ceffe,_0xf044('0x1a'))[_0xf044('0x16')](',\x20')));}var _0x5163f8=_[_0xf044('0x58')](_0x177e4e[_0xf044('0x54')],{'uniqueid':_0x2c9fd6['uniqueid']});if(_0x5163f8){return BPromise[_0xf044('0x69')]()[_0xf044('0x19')](function(){if(_0x5163f8[_0xf044('0x5a')]){return ami[_0xf044('0x5d')]({'action':_0xf044('0x6a'),'channel':_0x5163f8[_0xf044('0x5a')],'mixmonitorid':_0x2c9fd6[_0xf044('0x63')]})[_0xf044('0x1b')](function(_0x14b391){});}})[_0xf044('0x19')](function(){if(_0x5163f8['destinationchannel']){return ami['Action']({'action':_0xf044('0x6a'),'channel':_0x5163f8[_0xf044('0x6b')],'mixmonitorid':_0x2c9fd6[_0xf044('0x63')]})['catch'](function(_0x5656d8){});}})[_0xf044('0x19')](function(_0x244923){var _0x39f59b=_['find'](_0x5163f8[_0xf044('0x5f')],{'mixmonitorid':_0x2c9fd6[_0xf044('0x63')]});if(_0x39f59b){_0x39f59b[_0xf044('0x65')]=_0xf044('0x6c');}})['then'](function(){var _0x45a000=util['format'](_0xf044('0x6d'),_0x2c9fd6[_0xf044('0x5b')]||_0x2c9fd6[_0xf044('0x59')],_0x2c9fd6[_0xf044('0x8')]||_0xf044('0x5c'));var _0x2822c6=_[_0xf044('0x58')](_0x5163f8[_0xf044('0x5f')],{'filename':_0xf044('0x60')+_0x45a000[_0xf044('0x61')]()});if(_0x2822c6){_0x2822c6['status']=_0xf044('0x6c');}})[_0xf044('0x19')](function(){_0xca8cef({'code':0xc8,'message':[_0x2c9fd6[_0xf044('0x59')],_0xf044('0x6e')]['join']('\x20')});})['catch'](function(_0x718275){_0x27ca22(_0x382460[_0xf044('0x13')](0x1f5,[_0x2c9fd6['uniqueid'],_0x718275['message'][_0xf044('0x61')]()][_0xf044('0x16')]('\x20')));});}else{return _0x27ca22(_0x382460['error'](0x1f5,_0xf044('0x67')));}});},'VoiceQueuesChannels':function(_0x20e403){return new Promise(function(_0x5a5301,_0x470bba){var _0x48a95c=_[_0xf044('0x6f')](_0x177e4e[_0xf044('0x70')]);_0x5a5301({'count':_0x48a95c[_0xf044('0x53')],'rows':_0x48a95c});});},'VoiceQueuesChannel':function(_0x544faf){var _0xf54225=this;return new Promise(function(_0x2244aa,_0x5639b6){var _0x34c314=schema(properties[_0xf044('0x71')])['validate'](_0x544faf);if(_0x34c314[_0xf044('0x53')]>0x0){return _0x5639b6(_0xf54225[_0xf044('0x13')](0x1f4,_[_0xf044('0x57')](_0x34c314,'message')['join'](',\x20')));}var _0x2b72ff=_[_0xf044('0x58')](_0x177e4e[_0xf044('0x70')],{'uniqueid':_0x544faf[_0xf044('0x59')]});if(_0x2b72ff){_0x2244aa(_0x2b72ff);}else{return _0x5639b6(_0xf54225['error'](0x1f5,_0xf044('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x3d9087){var _0xdfecc0=this;return new Promise(function(_0x420427,_0x2db6aa){if(ami[_0xf044('0x12')]()==![]){return _0x2db6aa(_0xdfecc0[_0xf044('0x13')](0x1f4,[config[_0xf044('0x14')]['ip'],config[_0xf044('0x14')][_0xf044('0x15')],_0xf044('0x68')][_0xf044('0x16')]('\x20')));}var _0x314b57=schema(properties[_0xf044('0x72')])[_0xf044('0x56')](_0x3d9087);if(_0x314b57[_0xf044('0x53')]>0x0){return _0x2db6aa(_0xdfecc0[_0xf044('0x13')](0x1f4,_[_0xf044('0x57')](_0x314b57,_0xf044('0x1a'))[_0xf044('0x16')](',\x20')));}var _0x2304e5=_[_0xf044('0x58')](_0x177e4e[_0xf044('0x70')],{'uniqueid':_0x3d9087[_0xf044('0x59')]});if(_0x2304e5&&_0x2304e5[_0xf044('0x5a')]){return ami[_0xf044('0x5d')]({'action':'Hangup','channel':_0x2304e5[_0xf044('0x5a')]})[_0xf044('0x19')](function(_0x3c08f3){_0x420427({'code':0xc8,'message':[_0x3d9087[_0xf044('0x59')],_0x3c08f3[_0xf044('0x1a')][_0xf044('0x61')]()][_0xf044('0x16')]('\x20')});})[_0xf044('0x1b')](function(_0x47c956){_0x2db6aa(_0xdfecc0[_0xf044('0x13')](0x1f5,[_0x3d9087[_0xf044('0x59')],_0x47c956[_0xf044('0x1a')][_0xf044('0x61')]()][_0xf044('0x16')]('\x20')));});}else{return _0x2db6aa(_0xdfecc0[_0xf044('0x13')](0x1f5,_0xf044('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x475c43){var _0x29ea31=this;return new Promise(function(_0x1ef9ad,_0x1d25b8){if(ami[_0xf044('0x12')]()==![]){return _0x1d25b8(_0x29ea31[_0xf044('0x13')](0x1f4,[config['asterisk']['ip'],config[_0xf044('0x14')][_0xf044('0x15')],_0xf044('0x68')][_0xf044('0x16')]('\x20')));}var _0xba707e=schema(properties['voicequeuechannelredirect'])['validate'](_0x475c43);if(_0xba707e[_0xf044('0x53')]>0x0){return _0x1d25b8(_0x29ea31['error'](0x1f4,_['map'](_0xba707e,_0xf044('0x1a'))[_0xf044('0x16')](',\x20')));}var _0x50688d=_[_0xf044('0x58')](_0x177e4e[_0xf044('0x70')],{'uniqueid':_0x475c43['uniqueid']});if(_0x50688d&&_0x50688d['channel']){return ami[_0xf044('0x5d')]({'action':_0xf044('0x73'),'channel':_0x50688d[_0xf044('0x5a')],'exten':_0x475c43[_0xf044('0x74')],'context':_0x475c43[_0xf044('0x75')]||_0x50688d[_0xf044('0x75')],'priority':0x1})[_0xf044('0x19')](function(_0xd351e5){_0x1ef9ad({'code':0xc8,'message':[_0x475c43[_0xf044('0x59')],_0xd351e5[_0xf044('0x1a')][_0xf044('0x61')]()][_0xf044('0x16')]('\x20')});})[_0xf044('0x1b')](function(_0x30223b){_0x1d25b8(_0x29ea31[_0xf044('0x13')](0x1f5,[_0x475c43[_0xf044('0x59')],_0x30223b['message'][_0xf044('0x61')]()][_0xf044('0x16')]('\x20')));});}else{return _0x1d25b8(_0x29ea31[_0xf044('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2ecc03){return new Promise(function(_0x4158c0,_0x5bada5){var _0x5c173e=_['values'](_0x177e4e[_0xf044('0xe')]);_0x4158c0({'count':_0x5c173e[_0xf044('0x53')],'rows':_0x5c173e});});},'Telephones':function(_0x5a0da1){return new Promise(function(_0x5056aa,_0x10b065){var _0x3d20f8=_[_0xf044('0x6f')](_0x177e4e[_0xf044('0x76')]);_0x5056aa({'count':_0x3d20f8[_0xf044('0x53')],'rows':_0x3d20f8});});},'Trunks':function(_0xb44d37){return new Promise(function(_0x440fef,_0x1a9ce2){var _0x21be99=_['values'](_0x177e4e[_0xf044('0x77')]);_0x440fef({'count':_0x21be99[_0xf044('0x53')],'rows':_0x21be99});});},'OutboundChannels':function(_0x41392b){return new Promise(function(_0x1fb2de,_0x3c8339){var _0x29f5b5=_[_0xf044('0x6f')](_0x177e4e[_0xf044('0x78')]);_0x1fb2de({'count':_0x29f5b5[_0xf044('0x53')],'rows':_0x29f5b5});});},'Outbound':function(_0x399373){return new Promise(function(_0x170a49,_0x578f23){_0x170a49(_0x177e4e['outbound']);});},'Campaigns':function(_0x31b9ea){return new Promise(function(_0x12ccb0,_0x54a344){var _0x299c63=_['values'](_0x177e4e['campaigns']);_0x12ccb0({'count':_0x299c63[_0xf044('0x53')],'rows':_0x299c63});});},'VoiceQueuesPreview':function(_0x205eec){var _0x454560=this;return new Promise(function(_0x3c7369,_0x4507b9){_0x269ddf[_0xf044('0x79')](_0x205eec['id'])[_0xf044('0x19')](function(_0x570e55){_0x3c7369({'code':0xc8,'message':_0x570e55[_0xf044('0x1a')]});})['catch'](function(_0x3283f9){_0x4507b9(_0x454560[_0xf044('0x13')](0x1f4,_0x3283f9['message']));});});},'EventManager':function(_0x26eb2a){var _0x242761=this;return new Promise(function(_0x4e4d2a,_0x5305d6){if(!_0x26eb2a[_0xf044('0x7a')]){return _0x5305d6(_0x242761[_0xf044('0x13')](0x1f4,_0xf044('0x7b')));}ami[_0xf044('0x7c')]('custom:'+_0x26eb2a[_0xf044('0x7a')],_0x26eb2a[_0xf044('0x1a')]);_0x4e4d2a({'code':0xc8,'message':_0x26eb2a});});},'FaxAccounts':function(_0xca3ff5){return new Promise(function(_0x5e13fe,_0x32546d){var _0x538847=_['values'](_0x177e4e[_0xf044('0x7d')]);_0x5e13fe({'count':_0x538847['length'],'rows':_0x538847});});},'SendFax':function(_0x1d63fc){var _0x422589=this;return new Promise(function(_0x2358ae,_0x1a1fe6){_0x3f8000[_0xf044('0x7e')](_0x1d63fc)[_0xf044('0x19')](function(_0x5afa1f){_0x2358ae({'code':0xc8,'message':_0x5afa1f[_0xf044('0x1a')]});})['catch'](function(_0x59c13e){_0x1a1fe6(_0x422589['error'](0x1f4,_0x59c13e[_0xf044('0x1a')]));});});},'CheckAfterSend':function(_0x14f66d){var _0x42c91a=this;return new Promise(function(_0x52138b,_0x41d56c){_0x3f8000['checkAfterSend'](_0x14f66d)[_0xf044('0x19')](function(_0x4262d7){_0x52138b({'code':0xc8,'message':_0x4262d7[_0xf044('0x1a')]});})['catch'](function(_0x4e6e6c){_0x41d56c(_0x42c91a[_0xf044('0x13')](0x1f4,_0x4e6e6c[_0xf044('0x1a')]));});});}};var _0x443566=jayson[_0xf044('0x7f')](_0x3d961c)['http']();_0x443566['on'](_0xf044('0x13'),function(_0x1f3143){return _0x1f7711(_0x1f3143);});_0x443566['listen'](0x232a,_0xf044('0x80'),function(){console[_0xf044('0x81')](_0xf044('0x82'),0x232a);return _0x32aac9(_0xf044('0x83')+0x232a);});});}; \ No newline at end of file +var _0x3a11=['predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','voicechannel','map','channels','uniqueid','channel','format','wav','Action','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','find','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','filename','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','outbound','campaigns','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','127.0.0.1','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','catch','command','content','message','voiceQueues','hasOwnProperty','strategy','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses'];(function(_0x509277,_0x5cfee4){var _0x129ace=function(_0x5654f5){while(--_0x5654f5){_0x509277['push'](_0x509277['shift']());}};_0x129ace(++_0x5cfee4);}(_0x3a11,0x142));var _0x13a1=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x3a11[_0x172ed7];return _0xfa8f61;};'use strict';var _=require(_0x13a1('0x0'));var util=require(_0x13a1('0x1'));var jayson=require('jayson/promise');var schema=require(_0x13a1('0x2'));var BPromise=require(_0x13a1('0x3'));var moment=require(_0x13a1('0x4'));var config=require(_0x13a1('0x5'));var properties=require(_0x13a1('0x6'));var ami=require(_0x13a1('0x7'));exports[_0x13a1('0x8')]=function(_0x43f661,_0x17c5b6,_0x1bb3f5){return new BPromise(function(_0x518bef,_0x224bbb){var _0x250cc3={'QueuePause':function(_0x36b9fa){return new Promise(function(_0x1b3d72,_0x23490c){var _0x11f80a=util['format'](_0x13a1('0x9'),_0x13a1('0xa'),_0x36b9fa[_0x13a1('0xb')]);if(_0x43f661[_0x13a1('0xc')]&&_0x43f661[_0x13a1('0xc')][_0x11f80a]&&_0x43f661[_0x13a1('0xc')][_0x11f80a][_0x13a1('0xd')]){_0x43f661[_0x13a1('0xc')][_0x11f80a][_0x13a1('0xe')]();}if(_0x43f661[_0x13a1('0xf')][_0x11f80a]){_0x43f661[_0x13a1('0xf')][_0x11f80a]['updateStatusRealtime']({'statePause':_0x36b9fa[_0x13a1('0x10')]?!![]:![]});}_0x1b3d72({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4adb88){var _0x26744f=this;return new Promise(function(_0x292b48,_0x7ee94a){if(ami[_0x13a1('0x11')]()==![]){return _0x7ee94a(_0x26744f[_0x13a1('0x12')](0x1f4,[config[_0x13a1('0x13')]['ip'],config[_0x13a1('0x13')][_0x13a1('0x14')],_0x13a1('0x15')][_0x13a1('0x16')]('\x20')));}_0x4adb88=_[_0x13a1('0x17')](_0x4adb88,_[_0x13a1('0x18')](properties[_0x13a1('0x19')]));_0x4adb88[_0x13a1('0x1a')]=_0x13a1('0x1b');return ami['Action'](_0x4adb88)[_0x13a1('0x1c')](function(_0x56b8ec){_0x292b48({'code':0xc8,'message':_0x56b8ec['message']});})[_0x13a1('0x1d')](function(_0x5f0c1a){_0x7ee94a(_0x26744f[_0x13a1('0x12')](0x1f5,_0x5f0c1a['message']));});});},'Command':function(_0x587d1d){var _0x356e7c=this;return new Promise(function(_0x38e469,_0x1beaf1){if(ami[_0x13a1('0x11')]()==![]){return _0x1beaf1(_0x356e7c[_0x13a1('0x12')](0x1f4,[config[_0x13a1('0x13')]['ip'],config[_0x13a1('0x13')]['username'],_0x13a1('0x15')]['join']('\x20')));}_0x587d1d=_[_0x13a1('0x17')](_0x587d1d,_0x13a1('0x1e'));_0x587d1d[_0x13a1('0x1a')]='Command';return ami['Action'](_0x587d1d)[_0x13a1('0x1c')](function(_0x53b3cd){_0x38e469({'code':0xc8,'message':_0x53b3cd[_0x13a1('0x1f')]});})[_0x13a1('0x1d')](function(_0x41f789){_0x1beaf1(_0x356e7c[_0x13a1('0x12')](0x1f5,_0x41f789[_0x13a1('0x20')]));});});},'VoiceQueues':function(_0x168580){return new Promise(function(_0x51ec66,_0x33388f){var _0x2b35b6=[];for(var _0x301aeb in _0x43f661[_0x13a1('0x21')]){if(_0x43f661['voiceQueues'][_0x13a1('0x22')](_0x301aeb)){var _0x3406c0=_0x43f661[_0x13a1('0x21')][_0x301aeb];var _0x5ac40f={'id':_0x3406c0['id'],'name':_0x3406c0['name'],'strategy':_0x3406c0[_0x13a1('0x23')],'answered':_0x3406c0['answered'],'available':_0x3406c0['available'],'loggedIn':_0x3406c0['loggedIn'],'pTalking':_0x3406c0['pTalking'],'sumBillable':_0x3406c0['sumBillable'],'sumDuration':_0x3406c0['sumDuration'],'sumHoldTime':_0x3406c0[_0x13a1('0x24')]||0x0,'talking':_0x3406c0[_0x13a1('0x25')],'total':_0x3406c0[_0x13a1('0x26')],'type':_0x3406c0[_0x13a1('0x27')],'unmanaged':_0x3406c0[_0x13a1('0x28')],'abandoned':_0x3406c0[_0x13a1('0x29')],'waiting':_0x3406c0[_0x13a1('0x2a')],'loggedInDb':_0x3406c0[_0x13a1('0x2b')]};if(_0x3406c0[_0x13a1('0x27')]==='outbound'){_0x5ac40f[_0x13a1('0x2c')]=_0x3406c0[_0x13a1('0x2c')];_0x5ac40f['dialMethod']=_0x3406c0['dialMethod'];_0x5ac40f[_0x13a1('0x2d')]=_0x3406c0['dialOriginateCallerIdName'];_0x5ac40f[_0x13a1('0x2e')]=_0x3406c0[_0x13a1('0x2e')];_0x5ac40f[_0x13a1('0x2f')]=_0x3406c0[_0x13a1('0x2f')];_0x5ac40f[_0x13a1('0x30')]=_0x3406c0['dialPrefix'];_0x5ac40f[_0x13a1('0x31')]=_0x3406c0[_0x13a1('0x31')];_0x5ac40f[_0x13a1('0x32')]=_0x3406c0[_0x13a1('0x32')];_0x5ac40f[_0x13a1('0x33')]=_0x3406c0[_0x13a1('0x33')];_0x5ac40f[_0x13a1('0x34')]=_0x3406c0[_0x13a1('0x34')];_0x5ac40f[_0x13a1('0x35')]=_0x3406c0[_0x13a1('0x35')];_0x5ac40f['outboundDropCallsDayACS']=_0x3406c0['outboundDropCallsDayACS'];_0x5ac40f[_0x13a1('0x36')]=_0x3406c0[_0x13a1('0x36')];_0x5ac40f[_0x13a1('0x37')]=_0x3406c0['outboundDropCallsDayTimeout'];_0x5ac40f['outboundNoAnswerCallsDay']=_0x3406c0['outboundNoAnswerCallsDay'];_0x5ac40f[_0x13a1('0x38')]=_0x3406c0[_0x13a1('0x38')];_0x5ac40f[_0x13a1('0x39')]=_0x3406c0[_0x13a1('0x39')];_0x5ac40f[_0x13a1('0x3a')]=_0x3406c0['outboundReCallsDay'];_0x5ac40f['outboundRejectCallsDay']=_0x3406c0[_0x13a1('0x3b')];_0x5ac40f['outboundUnknownCallsDay']=_0x3406c0[_0x13a1('0x3c')];_0x5ac40f[_0x13a1('0x3d')]=_0x3406c0[_0x13a1('0x3d')];_0x5ac40f[_0x13a1('0x3e')]=_0x3406c0[_0x13a1('0x3e')];_0x5ac40f[_0x13a1('0x3f')]=_0x3406c0[_0x13a1('0x3f')];_0x5ac40f[_0x13a1('0x40')]=_0x3406c0[_0x13a1('0x40')];_0x5ac40f['predictiveIntervalDroppedCallsTimeout']=_0x3406c0[_0x13a1('0x41')];_0x5ac40f[_0x13a1('0x42')]=_0x3406c0['predictiveIntervalErlangCalls'];_0x5ac40f[_0x13a1('0x43')]=_0x3406c0[_0x13a1('0x43')];_0x5ac40f[_0x13a1('0x44')]=_0x3406c0[_0x13a1('0x44')];_0x5ac40f[_0x13a1('0x45')]=_0x3406c0[_0x13a1('0x45')];_0x5ac40f['predictiveIntervalPauses']=_0x3406c0[_0x13a1('0x46')];_0x5ac40f[_0x13a1('0x47')]=_0x3406c0[_0x13a1('0x47')];_0x5ac40f['predictiveIntervalTotalCalls']=_0x3406c0['predictiveIntervalTotalCalls'];_0x5ac40f[_0x13a1('0x20')]=_0x3406c0[_0x13a1('0x20')];_0x5ac40f[_0x13a1('0x48')]=_0x3406c0[_0x13a1('0x48')];_0x5ac40f[_0x13a1('0x49')]=_0x3406c0['erlangCalls'];_0x5ac40f['erlangCallToSecond']=_0x3406c0[_0x13a1('0x4a')];_0x5ac40f[_0x13a1('0x4b')]=_0x3406c0['erlangAbandonmentRate'];_0x5ac40f[_0x13a1('0x4c')]=_0x3406c0[_0x13a1('0x4c')];_0x5ac40f[_0x13a1('0x4d')]=_0x3406c0[_0x13a1('0x4d')];_0x5ac40f['startProgressive']=_0x3406c0[_0x13a1('0x4e')];}if(_0x3406c0[_0x13a1('0x4f')]){_0x5ac40f['Trunk']={'id':_0x3406c0['Trunk']['id'],'name':_0x3406c0[_0x13a1('0x4f')][_0x13a1('0xb')],'active':_0x3406c0[_0x13a1('0x4f')][_0x13a1('0x50')],'callerid':_0x3406c0[_0x13a1('0x4f')][_0x13a1('0x51')]};}if(_0x3406c0[_0x13a1('0x52')]){_0x5ac40f[_0x13a1('0x52')]={'id':_0x3406c0[_0x13a1('0x52')]['id'],'name':_0x3406c0[_0x13a1('0x52')][_0x13a1('0xb')]};}_0x2b35b6[_0x13a1('0x53')](_0x5ac40f);}}_0x51ec66({'count':_0x2b35b6[_0x13a1('0x54')],'rows':_0x2b35b6});});},'VoiceChannels':function(_0xf3c7c5){return new Promise(function(_0x23c343,_0x56e804){var _0x569398=_[_0x13a1('0x55')](_0x43f661['channels']);_0x23c343({'count':_0x569398[_0x13a1('0x54')],'rows':_0x569398});});},'VoiceChannelMixMonitor':function(_0x248bb8){var _0x5d5dec=this;return new Promise(function(_0x183f9c,_0x57f24c){if(ami[_0x13a1('0x11')]()==![]){return _0x57f24c(_0x5d5dec[_0x13a1('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x13a1('0x13')][_0x13a1('0x14')],'ami\x20disconnected'][_0x13a1('0x16')]('\x20')));}var _0x15e582=schema(properties[_0x13a1('0x56')])[_0x13a1('0x2')](_0x248bb8);if(_0x15e582['length']>0x0){return _0x57f24c(_0x5d5dec[_0x13a1('0x12')](0x1f4,_[_0x13a1('0x57')](_0x15e582,_0x13a1('0x20'))[_0x13a1('0x16')](',\x20')));}var _0x13964f=_['find'](_0x43f661[_0x13a1('0x58')],{'uniqueid':_0x248bb8[_0x13a1('0x59')]});if(_0x13964f&&_0x13964f[_0x13a1('0x5a')]){var _0x2f571c=util[_0x13a1('0x5b')]('%s.%s',_0x248bb8['filename']||_0x248bb8[_0x13a1('0x59')],_0x248bb8['format']||_0x13a1('0x5c'));return ami[_0x13a1('0x5d')]({'action':'MixMonitor','channel':_0x13964f[_0x13a1('0x5a')],'file':_0x2f571c,'options':_0x13a1('0x5e')})[_0x13a1('0x1c')](function(_0x24f35e){var _0x4c5204=_['find'](_0x13964f[_0x13a1('0x5f')],{'filename':_0x13a1('0x60')+_0x2f571c['toLowerCase']()});if(_[_0x13a1('0x61')](_0x4c5204)){_0x13964f[_0x13a1('0x5f')][_0x13a1('0x53')]({'filename':_0x13a1('0x60')+_0x2f571c[_0x13a1('0x62')](),'createdAt':moment()[_0x13a1('0x5b')](_0x13a1('0x63')),'mixmonitorid':_0x24f35e[_0x13a1('0x64')],'status':_0x13a1('0x65')});}else{_0x4c5204[_0x13a1('0x64')]=_0x24f35e[_0x13a1('0x64')];_0x4c5204[_0x13a1('0x66')]='rec';}_0x183f9c({'code':0xc8,'message':[_0x248bb8[_0x13a1('0x59')],_0x13a1('0x67'),_0x24f35e[_0x13a1('0x64')]][_0x13a1('0x16')]('\x20'),'mixmonitorid':_0x24f35e[_0x13a1('0x64')]});})[_0x13a1('0x1d')](function(_0x363a9b){_0x57f24c(_0x5d5dec['error'](0x1f5,[_0x248bb8[_0x13a1('0x59')],_0x363a9b[_0x13a1('0x20')][_0x13a1('0x62')]()]['join']('\x20')));});}else{return _0x57f24c(_0x5d5dec[_0x13a1('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3a92eb){var _0x4a4652=this;return new Promise(function(_0x4e5580,_0x40fed2){if(ami[_0x13a1('0x11')]()==![]){return _0x40fed2(_0x4a4652[_0x13a1('0x12')](0x1f4,[config[_0x13a1('0x13')]['ip'],config[_0x13a1('0x13')][_0x13a1('0x14')],_0x13a1('0x15')][_0x13a1('0x16')]('\x20')));}var _0xd6558d=schema(properties[_0x13a1('0x56')])['validate'](_0x3a92eb);if(_0xd6558d['length']>0x0){return _0x40fed2(_0x4a4652[_0x13a1('0x12')](0x1f4,_['map'](_0xd6558d,_0x13a1('0x20'))[_0x13a1('0x16')](',\x20')));}var _0x1f6a93=_[_0x13a1('0x68')](_0x43f661[_0x13a1('0x58')],{'uniqueid':_0x3a92eb[_0x13a1('0x59')]});if(_0x1f6a93){return BPromise[_0x13a1('0x69')]()[_0x13a1('0x1c')](function(){if(_0x1f6a93[_0x13a1('0x5a')]){return ami[_0x13a1('0x5d')]({'action':_0x13a1('0x6a'),'channel':_0x1f6a93['channel'],'mixmonitorid':_0x3a92eb[_0x13a1('0x64')]})[_0x13a1('0x1d')](function(_0x365da3){});}})[_0x13a1('0x1c')](function(){if(_0x1f6a93[_0x13a1('0x6b')]){return ami[_0x13a1('0x5d')]({'action':'StopMixMonitor','channel':_0x1f6a93[_0x13a1('0x6b')],'mixmonitorid':_0x3a92eb[_0x13a1('0x64')]})[_0x13a1('0x1d')](function(_0x57be4f){});}})['then'](function(_0x5877ea){var _0x36da78=_[_0x13a1('0x68')](_0x1f6a93[_0x13a1('0x5f')],{'mixmonitorid':_0x3a92eb[_0x13a1('0x64')]});if(_0x36da78){_0x36da78[_0x13a1('0x66')]=_0x13a1('0x6c');}})[_0x13a1('0x1c')](function(){var _0x27aa1f=util[_0x13a1('0x5b')](_0x13a1('0x6d'),_0x3a92eb[_0x13a1('0x6e')]||_0x3a92eb[_0x13a1('0x59')],_0x3a92eb['format']||_0x13a1('0x5c'));var _0x14de79=_[_0x13a1('0x68')](_0x1f6a93[_0x13a1('0x5f')],{'filename':_0x13a1('0x60')+_0x27aa1f['toLowerCase']()});if(_0x14de79){_0x14de79[_0x13a1('0x66')]=_0x13a1('0x6c');}})[_0x13a1('0x1c')](function(){_0x4e5580({'code':0xc8,'message':[_0x3a92eb['uniqueid'],_0x13a1('0x6f')][_0x13a1('0x16')]('\x20')});})[_0x13a1('0x1d')](function(_0x46b6cd){_0x40fed2(_0x4a4652[_0x13a1('0x12')](0x1f5,[_0x3a92eb[_0x13a1('0x59')],_0x46b6cd[_0x13a1('0x20')]['toLowerCase']()][_0x13a1('0x16')]('\x20')));});}else{return _0x40fed2(_0x4a4652[_0x13a1('0x12')](0x1f5,_0x13a1('0x70')));}});},'VoiceQueuesChannels':function(_0x58b684){return new Promise(function(_0x3bd9e9,_0x57ea5d){var _0x36df20=_[_0x13a1('0x55')](_0x43f661[_0x13a1('0x71')]);_0x3bd9e9({'count':_0x36df20['length'],'rows':_0x36df20});});},'VoiceQueuesChannel':function(_0x35444f){var _0x132fc4=this;return new Promise(function(_0x17fd4c,_0x285d61){var _0x5b15c4=schema(properties[_0x13a1('0x72')])['validate'](_0x35444f);if(_0x5b15c4[_0x13a1('0x54')]>0x0){return _0x285d61(_0x132fc4['error'](0x1f4,_[_0x13a1('0x57')](_0x5b15c4,'message')['join'](',\x20')));}var _0x3b5b6a=_[_0x13a1('0x68')](_0x43f661[_0x13a1('0x71')],{'uniqueid':_0x35444f[_0x13a1('0x59')]});if(_0x3b5b6a){_0x17fd4c(_0x3b5b6a);}else{return _0x285d61(_0x132fc4[_0x13a1('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56db11){var _0x13f6d7=this;return new Promise(function(_0x3e3355,_0x13cd5b){if(ami[_0x13a1('0x11')]()==![]){return _0x13cd5b(_0x13f6d7['error'](0x1f4,[config[_0x13a1('0x13')]['ip'],config[_0x13a1('0x13')][_0x13a1('0x14')],'ami\x20disconnected'][_0x13a1('0x16')]('\x20')));}var _0x140fca=schema(properties[_0x13a1('0x73')])[_0x13a1('0x2')](_0x56db11);if(_0x140fca[_0x13a1('0x54')]>0x0){return _0x13cd5b(_0x13f6d7[_0x13a1('0x12')](0x1f4,_[_0x13a1('0x57')](_0x140fca,_0x13a1('0x20'))[_0x13a1('0x16')](',\x20')));}var _0x112db6=_[_0x13a1('0x68')](_0x43f661[_0x13a1('0x71')],{'uniqueid':_0x56db11[_0x13a1('0x59')]});if(_0x112db6&&_0x112db6['channel']){return ami[_0x13a1('0x5d')]({'action':_0x13a1('0x74'),'channel':_0x112db6[_0x13a1('0x5a')]})['then'](function(_0x5a8203){_0x3e3355({'code':0xc8,'message':[_0x56db11[_0x13a1('0x59')],_0x5a8203[_0x13a1('0x20')]['toLowerCase']()][_0x13a1('0x16')]('\x20')});})[_0x13a1('0x1d')](function(_0x3efe26){_0x13cd5b(_0x13f6d7[_0x13a1('0x12')](0x1f5,[_0x56db11[_0x13a1('0x59')],_0x3efe26[_0x13a1('0x20')][_0x13a1('0x62')]()][_0x13a1('0x16')]('\x20')));});}else{return _0x13cd5b(_0x13f6d7[_0x13a1('0x12')](0x1f5,_0x13a1('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x4e0726){var _0x1d80ff=this;return new Promise(function(_0x4a76e5,_0x434e71){if(ami[_0x13a1('0x11')]()==![]){return _0x434e71(_0x1d80ff[_0x13a1('0x12')](0x1f4,[config[_0x13a1('0x13')]['ip'],config[_0x13a1('0x13')][_0x13a1('0x14')],_0x13a1('0x15')][_0x13a1('0x16')]('\x20')));}var _0x1c78a1=schema(properties[_0x13a1('0x75')])['validate'](_0x4e0726);if(_0x1c78a1[_0x13a1('0x54')]>0x0){return _0x434e71(_0x1d80ff[_0x13a1('0x12')](0x1f4,_['map'](_0x1c78a1,_0x13a1('0x20'))[_0x13a1('0x16')](',\x20')));}var _0x1679d1=_[_0x13a1('0x68')](_0x43f661[_0x13a1('0x71')],{'uniqueid':_0x4e0726[_0x13a1('0x59')]});if(_0x1679d1&&_0x1679d1['channel']){return ami[_0x13a1('0x5d')]({'action':_0x13a1('0x76'),'channel':_0x1679d1['channel'],'exten':_0x4e0726[_0x13a1('0x77')],'context':_0x4e0726[_0x13a1('0x78')]||_0x1679d1[_0x13a1('0x78')],'priority':0x1})[_0x13a1('0x1c')](function(_0x122d4c){_0x4a76e5({'code':0xc8,'message':[_0x4e0726['uniqueid'],_0x122d4c[_0x13a1('0x20')][_0x13a1('0x62')]()][_0x13a1('0x16')]('\x20')});})[_0x13a1('0x1d')](function(_0x10b5fd){_0x434e71(_0x1d80ff[_0x13a1('0x12')](0x1f5,[_0x4e0726[_0x13a1('0x59')],_0x10b5fd[_0x13a1('0x20')][_0x13a1('0x62')]()][_0x13a1('0x16')]('\x20')));});}else{return _0x434e71(_0x1d80ff[_0x13a1('0x12')](0x1f5,_0x13a1('0x70')));}});},'Agents':function(_0x8b9de1){return new Promise(function(_0x559e8c,_0x592b1d){var _0x2c9365=_[_0x13a1('0x55')](_0x43f661['agents']);_0x559e8c({'count':_0x2c9365[_0x13a1('0x54')],'rows':_0x2c9365});});},'Telephones':function(_0x26f948){return new Promise(function(_0xa0f63e,_0x502ecb){var _0x3f5fb6=_['values'](_0x43f661[_0x13a1('0x79')]);_0xa0f63e({'count':_0x3f5fb6[_0x13a1('0x54')],'rows':_0x3f5fb6});});},'Trunks':function(_0x2a7f36){return new Promise(function(_0x485fda,_0x55d42b){var _0xe94c57=_[_0x13a1('0x55')](_0x43f661['trunks']);_0x485fda({'count':_0xe94c57[_0x13a1('0x54')],'rows':_0xe94c57});});},'OutboundChannels':function(_0x27379e){return new Promise(function(_0x391f5c,_0x7b3f05){var _0x43b9c8=_['values'](_0x43f661[_0x13a1('0x7a')]);_0x391f5c({'count':_0x43b9c8[_0x13a1('0x54')],'rows':_0x43b9c8});});},'Outbound':function(_0x3b8d28){return new Promise(function(_0x31301a,_0x31dbfe){_0x31301a(_0x43f661[_0x13a1('0x7b')]);});},'Campaigns':function(_0x17276f){return new Promise(function(_0x5624a1,_0x3db2db){var _0x1ad45a=_[_0x13a1('0x55')](_0x43f661[_0x13a1('0x7c')]);_0x5624a1({'count':_0x1ad45a[_0x13a1('0x54')],'rows':_0x1ad45a});});},'VoiceQueuesPreview':function(_0x45e5e1){var _0x4fe48b=this;return new Promise(function(_0x2ec1c3,_0x98d116){_0x17c5b6['run'](_0x45e5e1['id'])[_0x13a1('0x1c')](function(_0x4e89ec){_0x2ec1c3({'code':0xc8,'message':_0x4e89ec['message']});})[_0x13a1('0x1d')](function(_0x12d70b){_0x98d116(_0x4fe48b[_0x13a1('0x12')](0x1f4,_0x12d70b[_0x13a1('0x20')]));});});},'EventManager':function(_0x1ebb05){var _0x7aae65=this;return new Promise(function(_0x548bdf,_0x2cc727){if(!_0x1ebb05[_0x13a1('0x7d')]){return _0x2cc727(_0x7aae65[_0x13a1('0x12')](0x1f4,_0x13a1('0x7e')));}ami['emit']('custom:'+_0x1ebb05[_0x13a1('0x7d')],_0x1ebb05[_0x13a1('0x20')]);_0x548bdf({'code':0xc8,'message':_0x1ebb05});});},'FaxAccounts':function(_0x3d6d07){return new Promise(function(_0xb8b780,_0x784043){var _0x32fef1=_[_0x13a1('0x55')](_0x43f661[_0x13a1('0x7f')]);_0xb8b780({'count':_0x32fef1[_0x13a1('0x54')],'rows':_0x32fef1});});},'SendFax':function(_0x5d9499){var _0x224254=this;return new Promise(function(_0x2b908f,_0x3bebee){_0x1bb3f5[_0x13a1('0x80')](_0x5d9499)[_0x13a1('0x1c')](function(_0x2899ac){_0x2b908f({'code':0xc8,'message':_0x2899ac['message']});})[_0x13a1('0x1d')](function(_0xead9d5){_0x3bebee(_0x224254[_0x13a1('0x12')](0x1f4,_0xead9d5[_0x13a1('0x20')]));});});},'CheckAfterSend':function(_0x22069c){var _0x478c27=this;return new Promise(function(_0x2ad166,_0x1e9f3c){_0x1bb3f5[_0x13a1('0x81')](_0x22069c)[_0x13a1('0x1c')](function(_0x8ad77c){_0x2ad166({'code':0xc8,'message':_0x8ad77c[_0x13a1('0x20')]});})[_0x13a1('0x1d')](function(_0x3e098d){_0x1e9f3c(_0x478c27[_0x13a1('0x12')](0x1f4,_0x3e098d[_0x13a1('0x20')]));});});}};var _0x1584e0=jayson['server'](_0x250cc3)['http']();_0x1584e0['on'](_0x13a1('0x12'),function(_0x2d3938){return _0x224bbb(_0x2d3938);});_0x1584e0[_0x13a1('0x8')](0x232a,_0x13a1('0x82'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x518bef('RPC\x20listening\x20on\x20port:'+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 7a8e732..091073c 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 _0x0ee6=['error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','merge','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','firstName','calleridname','uniqueid','destcalleridname','','phone','destcalleridnum','resolve','then','omit','xmd-contactid2','format','user:%s','name','trigger:%s','toLowerCase','createContact','[%s][%s]\x20Contact\x20created:%s','action','catch'];(function(_0x9ea926,_0x32b1b2){var _0x129b2a=function(_0x278c47){while(--_0x278c47){_0x9ea926['push'](_0x9ea926['shift']());}};_0x129b2a(++_0x32b1b2);}(_0x0ee6,0x106));var _0x60ee=function(_0x1c0476,_0x1ac465){_0x1c0476=_0x1c0476-0x0;var _0x172c8a=_0x0ee6[_0x1c0476];return _0x172c8a;};'use strict';var BPromise=require(_0x60ee('0x0'));var util=require(_0x60ee('0x1'));var _=require('lodash');var Redis=require(_0x60ee('0x2'));var config=require(_0x60ee('0x3'));var logger=require(_0x60ee('0x4'))(_0x60ee('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x60ee('0x6')]=_[_0x60ee('0x7')](config[_0x60ee('0x6')],{'host':_0x60ee('0x8'),'port':0x18eb});var io=require(_0x60ee('0x9'))(new Redis(config['redis']));function emit(_0x568e89,_0x2a4312,_0x234bd9,_0x46c6e4){logger[_0x60ee('0xa')](_0x60ee('0xb'),_0x568e89,'',_0x2a4312,_0x234bd9,JSON[_0x60ee('0xc')](_0x46c6e4));io['to'](_0x2a4312)[_0x60ee('0xd')](_0x234bd9,_0x46c6e4);}exports[_0x60ee('0xe')]=function(_0x2898b0,_0x3d9202,_0x3b0311){_0x3b0311[_0x60ee('0xf')]=0x0;if(_0x3d9202[_0x60ee('0x10')]&&parseInt(_0x3d9202[_0x60ee('0x10')],0xa)){var _0x503044={'ListId':parseInt(_0x3d9202[_0x60ee('0x11')],0xa),'phone':_0x3b0311[_0x60ee('0x12')]};if(_['isNil'](_0x3b0311['routeId'])){_0x503044[_0x60ee('0x13')]=_0x3b0311[_0x60ee('0x14')]&&_0x3b0311[_0x60ee('0x14')]!==''?_0x3b0311['calleridname']:_0x3b0311[_0x60ee('0x12')]||_0x3b0311[_0x60ee('0x15')];}else{_0x503044[_0x60ee('0x13')]=_0x3b0311[_0x60ee('0x16')]&&_0x3b0311[_0x60ee('0x16')]!==_0x60ee('0x17')?_0x3b0311[_0x60ee('0x16')]:_0x3b0311['destcalleridnum']||_0x3b0311['uniqueid'];_0x503044[_0x60ee('0x18')]=_0x3b0311['destcalleridname']&&_0x3b0311['destcalleridname']!==''?_0x3b0311[_0x60ee('0x16')]:_0x3b0311[_0x60ee('0x19')]||_0x3b0311[_0x60ee('0x15')];}BPromise[_0x60ee('0x1a')]()[_0x60ee('0x1b')](cmContactRpc['showContact']({'where':_[_0x60ee('0x1c')](_0x503044,[_0x60ee('0x13')])}))['then'](function(_0x9109f7){if(_0x9109f7){logger[_0x60ee('0xa')]('[%s][%s]\x20Contact\x20found:%s',_0x3b0311['uniqueid'],'',_0x9109f7['id']);if(_0x2898b0){_0x3b0311[_0x60ee('0x1d')]=_0x9109f7['id'];emit(_0x3b0311[_0x60ee('0x15')],util[_0x60ee('0x1e')](_0x60ee('0x1f'),_0x2898b0[_0x60ee('0x20')]),util[_0x60ee('0x1e')](_0x60ee('0x21'),_0x3d9202['action'][_0x60ee('0x22')]()),_['merge'](_0x3b0311,{'ListId':parseInt(_0x3d9202[_0x60ee('0x11')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x3b0311[_0x60ee('0x15')],'');return BPromise[_0x60ee('0x1a')]()[_0x60ee('0x1b')](cmContactRpc[_0x60ee('0x23')](_0x503044));}})['then'](function(_0x3e113f){if(_0x3e113f){logger['info'](_0x60ee('0x24'),_0x3b0311[_0x60ee('0x15')],'',_0x3e113f['id']);if(_0x2898b0){_0x3b0311[_0x60ee('0x1d')]=_0x3e113f['id'];emit(_0x3b0311[_0x60ee('0x15')],util[_0x60ee('0x1e')](_0x60ee('0x1f'),_0x2898b0[_0x60ee('0x20')]),util[_0x60ee('0x1e')]('trigger:%s',_0x3d9202[_0x60ee('0x25')][_0x60ee('0x22')]()),_['merge'](_0x3b0311,{'ListId':parseInt(_0x3d9202[_0x60ee('0x11')],0xa)}));}}})[_0x60ee('0x26')](function(_0x3d719e){logger[_0x60ee('0x27')](_0x60ee('0x28'),_0x3b0311['uniqueid'],'',JSON[_0x60ee('0xc')](_0x3d719e));});}else{if(_0x2898b0){logger['info'](_0x60ee('0x29'),_0x3b0311[_0x60ee('0x15')],'');emit(_0x3b0311['uniqueid'],util[_0x60ee('0x1e')](_0x60ee('0x1f'),_0x2898b0[_0x60ee('0x20')]),util[_0x60ee('0x1e')](_0x60ee('0x21'),_0x3d9202[_0x60ee('0x25')][_0x60ee('0x22')]()),_[_0x60ee('0x2a')]({'ListId':parseInt(_0x3d9202[_0x60ee('0x11')],0xa)},_0x3b0311));}}}; \ No newline at end of file +var _0x519d=['then','showContact','omit','format','user:%s','name','trigger:%s','toLowerCase','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','action','merge','error','stringify','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[%s][%s]','emit','exec','autoCreate','data2','data1','calleridnum','isNil','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','resolve'];(function(_0x32e94a,_0x8f6a47){var _0x1abae3=function(_0x490992){while(--_0x490992){_0x32e94a['push'](_0x32e94a['shift']());}};_0x1abae3(++_0x8f6a47);}(_0x519d,0x160));var _0xd519=function(_0x2f762f,_0x50f7e7){_0x2f762f=_0x2f762f-0x0;var _0x1b68d4=_0x519d[_0x2f762f];return _0x1b68d4;};'use strict';var BPromise=require(_0xd519('0x0'));var util=require(_0xd519('0x1'));var _=require(_0xd519('0x2'));var Redis=require(_0xd519('0x3'));var config=require('../../../../config/environment');var logger=require(_0xd519('0x4'))(_0xd519('0x5'));var cmContactRpc=require(_0xd519('0x6'));config[_0xd519('0x7')]=_['defaults'](config[_0xd519('0x7')],{'host':_0xd519('0x8'),'port':0x18eb});var io=require(_0xd519('0x9'))(new Redis(config[_0xd519('0x7')]));function emit(_0x48db7b,_0x849bae,_0x34505e,_0x407e95){logger[_0xd519('0xa')](_0xd519('0xb'),_0x48db7b,'',_0x849bae,_0x34505e,JSON['stringify'](_0x407e95));io['to'](_0x849bae)[_0xd519('0xc')](_0x34505e,_0x407e95);}exports[_0xd519('0xd')]=function(_0x149076,_0x2693aa,_0x2646c7){_0x2646c7[_0xd519('0xe')]=0x0;if(_0x2693aa[_0xd519('0xf')]&&parseInt(_0x2693aa[_0xd519('0xf')],0xa)){var _0x4e6817={'ListId':parseInt(_0x2693aa[_0xd519('0x10')],0xa),'phone':_0x2646c7[_0xd519('0x11')]};if(_[_0xd519('0x12')](_0x2646c7['routeId'])){_0x4e6817['firstName']=_0x2646c7[_0xd519('0x13')]&&_0x2646c7[_0xd519('0x13')]!==_0xd519('0x14')?_0x2646c7[_0xd519('0x13')]:_0x2646c7[_0xd519('0x11')]||_0x2646c7[_0xd519('0x15')];}else{_0x4e6817[_0xd519('0x16')]=_0x2646c7[_0xd519('0x17')]&&_0x2646c7[_0xd519('0x17')]!==_0xd519('0x14')?_0x2646c7[_0xd519('0x17')]:_0x2646c7['destcalleridnum']||_0x2646c7[_0xd519('0x15')];_0x4e6817['phone']=_0x2646c7['destcalleridname']&&_0x2646c7[_0xd519('0x17')]!==_0xd519('0x14')?_0x2646c7['destcalleridname']:_0x2646c7[_0xd519('0x18')]||_0x2646c7['uniqueid'];}BPromise[_0xd519('0x19')]()[_0xd519('0x1a')](cmContactRpc[_0xd519('0x1b')]({'where':_[_0xd519('0x1c')](_0x4e6817,['firstName'])}))[_0xd519('0x1a')](function(_0xfface3){if(_0xfface3){logger[_0xd519('0xa')]('[%s][%s]\x20Contact\x20found:%s',_0x2646c7[_0xd519('0x15')],'',_0xfface3['id']);if(_0x149076){_0x2646c7['xmd-contactid2']=_0xfface3['id'];emit(_0x2646c7['uniqueid'],util[_0xd519('0x1d')](_0xd519('0x1e'),_0x149076[_0xd519('0x1f')]),util[_0xd519('0x1d')](_0xd519('0x20'),_0x2693aa['action'][_0xd519('0x21')]()),_['merge'](_0x2646c7,{'ListId':parseInt(_0x2693aa[_0xd519('0x10')],0xa)}));}return;}else{logger[_0xd519('0xa')]('[%s][%s]\x20Contact\x20not\x20found',_0x2646c7[_0xd519('0x15')],'');return BPromise['resolve']()[_0xd519('0x1a')](cmContactRpc[_0xd519('0x22')](_0x4e6817));}})[_0xd519('0x1a')](function(_0x54325f){if(_0x54325f){logger['info'](_0xd519('0x23'),_0x2646c7['uniqueid'],'',_0x54325f['id']);if(_0x149076){_0x2646c7[_0xd519('0x24')]=_0x54325f['id'];emit(_0x2646c7[_0xd519('0x15')],util[_0xd519('0x1d')](_0xd519('0x1e'),_0x149076[_0xd519('0x1f')]),util[_0xd519('0x1d')](_0xd519('0x20'),_0x2693aa[_0xd519('0x25')][_0xd519('0x21')]()),_[_0xd519('0x26')](_0x2646c7,{'ListId':parseInt(_0x2693aa[_0xd519('0x10')],0xa)}));}}})['catch'](function(_0x41a599){logger[_0xd519('0x27')]('[%s][%s]\x20Error\x20creating\x20contact',_0x2646c7[_0xd519('0x15')],'',JSON[_0xd519('0x28')](_0x41a599));});}else{if(_0x149076){logger[_0xd519('0xa')](_0xd519('0x29'),_0x2646c7[_0xd519('0x15')],'');emit(_0x2646c7['uniqueid'],util['format'](_0xd519('0x1e'),_0x149076[_0xd519('0x1f')]),util['format']('trigger:%s',_0x2693aa[_0xd519('0x25')]['toLowerCase']()),_[_0xd519('0x26')]({'ListId':parseInt(_0x2693aa[_0xd519('0x10')],0xa)},_0x2646c7));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 742d561..8f3d055 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 _0x5a43=['AllConditions','checkConditions','channel','AnyConditions','some','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','util','lodash','url','mustache','ioredis','./urlforward','./integration','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','hasOwnProperty','status','checkTrigger','length','Actions','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','format','name','trigger:%s:%s','merge','jscripty','user:%s','trigger:%s','exec','integration','queue','routeId','script','query','search','replace'];(function(_0xd44c85,_0x5ab70a){var _0x57ee0d=function(_0x23eac9){while(--_0x23eac9){_0xd44c85['push'](_0xd44c85['shift']());}};_0x57ee0d(++_0x5ab70a);}(_0x5a43,0xf1));var _0x35a4=function(_0x23d088,_0x3e38a6){_0x23d088=_0x23d088-0x0;var _0x56f4f4=_0x5a43[_0x23d088];return _0x56f4f4;};'use strict';var util=require(_0x35a4('0x0'));var _=require(_0x35a4('0x1'));var url=require(_0x35a4('0x2'));var Mustache=require(_0x35a4('0x3'));var Redis=require(_0x35a4('0x4'));var urlforward=require(_0x35a4('0x5'));var integration=require(_0x35a4('0x6'));var cmContact=require('./cmContact');var script=require('./script');var cmContactRpc=require('../rpc/cmContact');var config=require('../../../config/environment');var logger=require(_0x35a4('0x7'))(_0x35a4('0x8'));var ami=require(_0x35a4('0x9'));config[_0x35a4('0xa')]=_[_0x35a4('0xb')](config[_0x35a4('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x35a4('0xc'))(new Redis(config[_0x35a4('0xa')]));var operators={'equals':function(_0x104abe,_0x3e23d6){return _0x104abe==_0x3e23d6;},'not_equals':function(_0x43df6d,_0x351402){return _0x43df6d!=_0x351402;}};var barAndWebActions=['popup','url','winapp'];function Trigger(_0x355394){this['triggers']=_0x355394[_0x35a4('0xd')];this[_0x35a4('0xe')]=_0x355394[_0x35a4('0xe')];this['voiceQueues']=_0x355394[_0x35a4('0xf')];this[_0x35a4('0x10')]=_0x355394[_0x35a4('0x10')];this[_0x35a4('0x11')]=_0x355394['voiceExtensions'];this[_0x35a4('0x12')]=_0x355394[_0x35a4('0x12')];this['freshdeskAccounts']=_0x355394[_0x35a4('0x13')];this['salesforceAccounts']=_0x355394[_0x35a4('0x14')];this[_0x35a4('0x15')]=_0x355394[_0x35a4('0x15')];this[_0x35a4('0x16')]=_0x355394[_0x35a4('0x16')];this[_0x35a4('0x17')]=_0x355394[_0x35a4('0x17')];this[_0x35a4('0x18')]=_0x355394[_0x35a4('0x18')];this['servicenowAccounts']=_0x355394[_0x35a4('0x19')];this[_0x35a4('0x1a')]=_0x355394[_0x35a4('0x1a')];this[_0x35a4('0x1b')]=_0x355394[_0x35a4('0x1b')];this[_0x35a4('0x1c')]={'zendesk':this[_0x35a4('0x12')],'salesforce':this[_0x35a4('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x35a4('0x15')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0x35a4('0x18')],'dynamics365':this[_0x35a4('0x1a')],'freshsales':this[_0x35a4('0x1b')],'servicenow':this['servicenowAccounts']};ami['on'](_0x35a4('0x1d'),this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on']('custom:agentconnect',this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on'](_0x35a4('0x20'),this[_0x35a4('0x1e')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x35a4('0x1e')]['bind'](this));ami['on'](_0x35a4('0x21'),this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on'](_0x35a4('0x22'),this[_0x35a4('0x23')][_0x35a4('0x1f')](this));ami['on']('custom:dialconnect',this['syncAgentDial']['bind'](this));ami['on'](_0x35a4('0x24'),this[_0x35a4('0x23')]['bind'](this));ami['on']('custom:newinteraction',this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on'](_0x35a4('0x25'),this[_0x35a4('0x1e')]['bind'](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x35a4('0x26'),this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on'](_0x35a4('0x27'),this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));ami['on'](_0x35a4('0x28'),this[_0x35a4('0x1e')][_0x35a4('0x1f')](this));}Trigger[_0x35a4('0x29')][_0x35a4('0x2a')]=function(_0x6692d5,_0x3767fa,_0x36a34e){logger[_0x35a4('0x2b')](_0x6692d5,_0x3767fa,JSON[_0x35a4('0x2c')](_0x36a34e));io['to'](_0x6692d5)['emit'](_0x3767fa,_0x36a34e);};Trigger[_0x35a4('0x29')][_0x35a4('0x1e')]=function(_0xdb0a8d){var _0x5b9679=_[_0x35a4('0x2d')](_0xdb0a8d);this[_0x35a4('0x2e')](_0x5b9679);};Trigger[_0x35a4('0x29')]['syncAgentDial']=function(_0x526bf6){if(this[_0x35a4('0xe')][_0x526bf6['interface']]){this[_0x35a4('0x1e')](_0x526bf6);}};Trigger[_0x35a4('0x29')][_0x35a4('0x2e')]=function(_0x4ea3b0){var _0x5cc3a4;for(var _0x995edf in this[_0x35a4('0xd')]){if(this[_0x35a4('0xd')][_0x35a4('0x2f')](_0x995edf)){if(this[_0x35a4('0xd')][_0x995edf][_0x35a4('0x30')]){_0x5cc3a4=this[_0x35a4('0x31')](this[_0x35a4('0xd')][_0x995edf],_0x4ea3b0);if(_0x5cc3a4){_['merge'](_0x4ea3b0,_0x4ea3b0['variables']);for(var _0x1c16d8=0x0,_0x35ace3,_0x1be157,_0xacf660;_0x1c16d80x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7f5115c..c9c0641 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 _0xc95b=['type','string','nameField','customField','idField','substring','indexOf','content','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','phonecall','queue','callDirection','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error','inspect','lodash','bluebird','request-promise','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','contacts','headers','lastIndexOf','contacts?$select=telephone1','calleridnum','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach'];(function(_0x4c708b,_0xd3a977){var _0x1f0fff=function(_0x4d2e61){while(--_0x4d2e61){_0x4c708b['push'](_0x4c708b['shift']());}};_0x1f0fff(++_0xd3a977);}(_0xc95b,0xf2));var _0xbc95=function(_0x162bc1,_0x5cd1c6){_0x162bc1=_0x162bc1-0x0;var _0x2dc459=_0xc95b[_0x162bc1];return _0x2dc459;};'use strict';var _=require(_0xbc95('0x0'));var BPromise=require(_0xbc95('0x1'));var rp=require(_0xbc95('0x2'));var util=require(_0xbc95('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xbc95('0x4'));var logger=require(_0xbc95('0x5'))(_0xbc95('0x6'));var config=require(_0xbc95('0x7'));config[_0xbc95('0x8')]=_[_0xbc95('0x9')](config[_0xbc95('0x8')],{'host':_0xbc95('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc95('0x8')]));function getAuthToken(_0x30fa0d,_0x3340cc,_0x3b9394){var _0x425aaf={'method':_0xbc95('0xb'),'uri':_0x3340cc,'form':{'client_id':_0x30fa0d[_0xbc95('0xc')],'resource':_0x30fa0d[_0xbc95('0xd')],'username':_0x30fa0d[_0xbc95('0xe')],'password':_0x30fa0d[_0xbc95('0xf')],'grant_type':_0xbc95('0xf'),'client_secret':_0x30fa0d['clientSecret']},'json':!![]};return rp(_0x425aaf)[_0xbc95('0x10')](function(_0x24fc5f){return _0x24fc5f[_0xbc95('0x11')];})[_0xbc95('0x12')](function(_0x3a11b2){logger['error']('['+[_0x3b9394[_0xbc95('0x13')]()]+_0xbc95('0x14'));return _0x3a11b2[_0xbc95('0x15')];});}function getUser(_0x2edbe9,_0x1b2b35,_0x50cac5,_0x306879,_0x3f454c,_0x38c402){return new BPromise(function(_0x3821f9,_0x2ed7c6){return getAuthToken(_0x1b2b35,_0x306879,_0x38c402)[_0xbc95('0x10')](function(_0xcaffd7){var _0x3abbc4={'method':_0xbc95('0x16'),'uri':_0x3f454c+_0xbc95('0x17'),'headers':{'Authorization':_0xbc95('0x18')+_0xcaffd7,'OData-Version':_0xbc95('0x19')},'json':!![]};return rp(_0x3abbc4);})[_0xbc95('0x10')](function(_0x402fb2){var _0x16cd52=_0x402fb2[_0xbc95('0x1a')];var _0x1126ed=![];var _0xe23c0c=null;if(!_[_0xbc95('0x1b')](_0x50cac5)){if(intUtil[_0xbc95('0x1c')](_0x50cac5['email'])){_0x2edbe9['userEmail']=_0x50cac5[_0xbc95('0x1d')];for(_0xe23c0c=0x0;_0xe23c0c<_0x16cd52[_0xbc95('0x1e')];_0xe23c0c++){if(_0x16cd52[_0xe23c0c][_0xbc95('0x1f')]===_0x50cac5[_0xbc95('0x1d')]&&!_0x16cd52[_0xe23c0c]['isdisabled']){_0x1126ed=!![];logger[_0xbc95('0x20')]('['+[_0x38c402[_0xbc95('0x13')]()]+_0xbc95('0x21')+_0x16cd52[_0xe23c0c][_0xbc95('0x22')]+'!');_0x2edbe9[_0xbc95('0x23')]=_0x16cd52[_0xe23c0c][_0xbc95('0x22')];}}}}if(!_0x1126ed){logger[_0xbc95('0x20')]('['+[_0x38c402[_0xbc95('0x13')]()]+_0xbc95('0x24'));_0x2edbe9[_0xbc95('0x25')]=_0x1b2b35[_0xbc95('0xe')];for(_0xe23c0c=0x0;_0xe23c0c<_0x16cd52[_0xbc95('0x1e')];_0xe23c0c++){if(_0x16cd52[_0xe23c0c][_0xbc95('0x1f')]===_0x1b2b35['username']){_0x2edbe9[_0xbc95('0x23')]=_0x16cd52[_0xe23c0c][_0xbc95('0x22')];}}}_0x3821f9(_0x2edbe9);})[_0xbc95('0x12')](function(_0x2a57fc){_0x2ed7c6(_0x2a57fc[_0xbc95('0x15')]);});});}function createEndUser(_0x1ea0f0,_0x53374b,_0x4dfa3e,_0x107f88,_0xd0bd9b,_0x1d0027){return new BPromise(function(_0x4b55e4,_0x31fb06){return getAuthToken(_0x53374b,_0x4dfa3e,_0x1d0027)[_0xbc95('0x10')](function(_0x31a3bc){var _0x3aefcb=_0x1d0027[_0xbc95('0x26')]()===_0xbc95('0x27')?_0xd0bd9b[_0xbc95('0x28')]:_0xd0bd9b['calleridnum'];var _0x219ba2={'method':_0xbc95('0xb'),'uri':_0x107f88+_0xbc95('0x29'),'body':{'telephone1':_0x3aefcb,'fullname':_0x3aefcb,'firstname':_0x3aefcb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1ea0f0[_0xbc95('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x31a3bc,'OData-Version':_0xbc95('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x219ba2);})[_0xbc95('0x10')](function(_0xef15e4){var _0x5383df=_0xef15e4[_0xbc95('0x2a')]['odata-entityid'];var _0x45d896=_0x5383df['substring'](_0x5383df[_0xbc95('0x2b')]('(')+0x1,_0x5383df[_0xbc95('0x2b')](')'));_0x1ea0f0['enduserId']=_0x45d896;_0x4b55e4(_0x1ea0f0);})[_0xbc95('0x12')](function(_0xaf3363){_0x31fb06(_0xaf3363[_0xbc95('0x15')]);});});}function getEndUser(_0x1a2f58,_0x21466d,_0x23ca00,_0x3982a2,_0xbc1b28,_0x50dee6){return new BPromise(function(_0xe774c3,_0x3e66d2){return getAuthToken(_0x21466d,_0x23ca00,_0x50dee6)[_0xbc95('0x10')](function(_0x10998d){var _0xe220a1={'method':_0xbc95('0x16'),'uri':_0x3982a2+_0xbc95('0x2c'),'headers':{'Authorization':'Bearer\x20'+_0x10998d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xe220a1);})['then'](function(_0x51a437){var _0x4bc601=null;if(_0x51a437){var _0x4038e3=_0x51a437[_0xbc95('0x1a')];var _0x4140d9=![];for(_0x4bc601=0x0;_0x4bc601<_0x4038e3[_0xbc95('0x1e')];_0x4bc601++){var _0x32c750=_0x50dee6[_0xbc95('0x26')]()===_0xbc95('0x27')?_0xbc1b28[_0xbc95('0x28')]:_0xbc1b28[_0xbc95('0x2d')];if(_0x4038e3[_0x4bc601][_0xbc95('0x2e')]===_0x32c750){_0x4140d9=!![];_0x1a2f58[_0xbc95('0x2f')]=_0x4038e3[_0x4bc601][_0xbc95('0x30')];}}if(_0x4140d9){_0xe774c3(_0x1a2f58);}else{return createEndUser(_0x1a2f58,_0x21466d,_0x23ca00,_0x3982a2,_0xbc1b28,_0x50dee6)[_0xbc95('0x10')](function(_0x1fbc80){logger['info']('['+[_0x50dee6[_0xbc95('0x13')]()]+_0xbc95('0x31'),_0x1fbc80[_0xbc95('0x2f')]);_0xe774c3(_0x1fbc80);});}}else{return createEndUser(_0x1a2f58,_0x21466d,_0x23ca00,_0x3982a2,_0xbc1b28,_0x50dee6)[_0xbc95('0x10')](function(_0x250c44){logger[_0xbc95('0x20')]('['+[_0x50dee6[_0xbc95('0x13')]()]+_0xbc95('0x32'),_0x250c44[_0xbc95('0x2f')]);_0xe774c3(_0x250c44);});}});});}function getCustomFields(_0x5a38cc,_0x485036,_0x2e3b30){var _0x3ca535={};if(_0x5a38cc[_0xbc95('0x1e')]>0x0){_[_0xbc95('0x33')](_0x5a38cc,function(_0x15aa73){if(_0x15aa73[_0xbc95('0x34')]===_0xbc95('0x35')&&_0x15aa73[_0xbc95('0x36')]&&!_0x15aa73[_0xbc95('0x37')]){var _0x5e33b8=_0x15aa73[_0xbc95('0x38')]['toLowerCase']();var _0x3e5e98=_0x5e33b8[_0xbc95('0x39')](0x0,_0x5e33b8[_0xbc95('0x3a')]('_'));var _0x2a1f7f=_0x5e33b8[_0xbc95('0x39')](_0x5e33b8[_0xbc95('0x3a')]('_')+0x1);if(_0x3e5e98===_0x2e3b30){_0x3ca535[_0x2a1f7f]=_0x15aa73[_0xbc95('0x3b')];}}});}return _0x3ca535;}function getTicket(_0x2d510a,_0xca384a,_0x1a0c69,_0xe049c1,_0x17e122,_0xc8c00b,_0x41dec7){return new BPromise(function(_0x30ce1a,_0x1f437c){var _0x5434d6;return getAuthToken(_0xca384a,_0x1a0c69,_0x41dec7)[_0xbc95('0x10')](function(_0x138f8a){if(_0xc8c00b['ticketType']===_0xbc95('0x3c')){_0x5434d6={'method':_0xbc95('0xb'),'uri':_0xe049c1+'incidents','body':Object[_0xbc95('0x3d')]({},{'title':intUtil[_0xbc95('0x3e')](_0xc8c00b[_0xbc95('0x3f')],_0x17e122,'\x20'),'description':intUtil['getString'](_0xc8c00b[_0xbc95('0x40')],_0x17e122,'\x0a'),'customerid_contact@odata.bind':_0xbc95('0x41')+_0x2d510a['enduserId']+')','ownerid@odata.bind':_0xbc95('0x42')+_0x2d510a['userId']+')','caseorigincode':'1'},getCustomFields(_0xc8c00b[_0xbc95('0x43')],_0x17e122,_0xc8c00b[_0xbc95('0x44')])),'headers':{'Authorization':_0xbc95('0x18')+_0x138f8a,'OData-Version':_0xbc95('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xc8c00b[_0xbc95('0x44')]===_0xbc95('0x45')){_0x5434d6={'method':_0xbc95('0xb'),'uri':_0xe049c1+'phonecalls','body':Object[_0xbc95('0x3d')]({},{'subject':intUtil[_0xbc95('0x3e')](_0xc8c00b[_0xbc95('0x3f')],_0x17e122,'\x20'),'phonenumber':String(_0x17e122[_0xbc95('0x2d')]),'description':intUtil[_0xbc95('0x3e')](_0xc8c00b[_0xbc95('0x40')],_0x17e122,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x2d510a[_0xbc95('0x2f')]+')','ownerid@odata.bind':_0xbc95('0x42')+_0x2d510a[_0xbc95('0x23')]+')','directioncode':_0x2d510a['callDirection']===_0xbc95('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbc95('0x42')+_0x2d510a['userId']+')','participationtypemask':_0x2d510a[_0xbc95('0x47')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xbc95('0x41')+_0x2d510a[_0xbc95('0x2f')]+')','participationtypemask':_0x2d510a[_0xbc95('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0xc8c00b['Fields'],_0x17e122,_0xc8c00b[_0xbc95('0x44')])),'headers':{'Authorization':_0xbc95('0x18')+_0x138f8a,'OData-Version':_0xbc95('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5434d6);})['then'](function(_0x30c15d){var _0x43ce20=_0x30c15d[_0xbc95('0x2a')][_0xbc95('0x48')];var _0xfe7975=_0x43ce20['substring'](_0x43ce20[_0xbc95('0x2b')]('(')+0x1,_0x43ce20[_0xbc95('0x2b')](')'));_0x2d510a[_0xbc95('0x49')]=_0xfe7975;_0x30ce1a(_0x2d510a);})[_0xbc95('0x12')](function(_0x92aba0){_0x1f437c(_0x92aba0[_0xbc95('0x15')]);});});}function emit(_0x259b4f,_0x2fcad1,_0x1580d6,_0x38f8f7){var _0x53eda0={'uri':util['format'](_0xbc95('0x4a'),_0x259b4f,_0x1580d6,_0x38f8f7)};io['to'](util[_0xbc95('0x4b')](_0xbc95('0x4c'),_0x2fcad1))[_0xbc95('0x4d')](_0xbc95('0x4e'),_0x53eda0);}exports['cs']=function(_0x192fab,_0x49f226,_0x38979e,_0x38c021,_0x136cfc,_0x5b8ffd,_0x60e518,_0x1a96d4){var _0x4d78f5={};_0x5b8ffd['remoteUri']=intUtil[_0xbc95('0x4f')](_0x5b8ffd[_0xbc95('0xd')]);_0x5b8ffd['serverUrl']=intUtil[_0xbc95('0x4f')](_0x5b8ffd[_0xbc95('0x50')]);_0x4d78f5[_0xbc95('0x47')]=_0x1a96d4==='queue'||_0x1a96d4==='unmanaged'?_0xbc95('0x46'):_0xbc95('0x27');var _0x544744=util[_0xbc95('0x4b')]('%s/api/data/v9.0/',_0x5b8ffd['remoteUri']);var _0x122ba6=util[_0xbc95('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5b8ffd[_0xbc95('0x51')]);var _0x2a8cc4=util[_0xbc95('0x4b')](_0xbc95('0x52'),_0x5b8ffd[_0xbc95('0x50')],_0x49f226['uniqueid'],md5(_0x49f226[_0xbc95('0x53')]));if(_0x136cfc&&_0x136cfc[_0xbc95('0x54')]){logger[_0xbc95('0x20')]('[QUEUE]',_0xbc95('0x55'));_0x49f226['recordingURL']=_0x2a8cc4;}else if(_0x60e518&&_0x60e518[_0xbc95('0x56')]&&_0x60e518['recordingFormat']!==_0xbc95('0x57')){logger[_0xbc95('0x20')](_0xbc95('0x58'),'Recording\x20is\x20enabled!');_0x49f226[_0xbc95('0x59')]=_0x2a8cc4;}else{_0x49f226[_0xbc95('0x59')]='';}return getUser(_0x4d78f5,_0x5b8ffd,_0x38c021,_0x122ba6,_0x544744,_0x1a96d4)[_0xbc95('0x10')](function(_0xa49108){logger[_0xbc95('0x20')]('['+_0x1a96d4[_0xbc95('0x13')]()+_0xbc95('0x5a'),_0xa49108['userId']);logger[_0xbc95('0x20')]('['+_0x1a96d4[_0xbc95('0x13')]()+_0xbc95('0x5b'),_0xa49108[_0xbc95('0x25')]);return getEndUser(_0xa49108,_0x5b8ffd,_0x122ba6,_0x544744,_0x49f226,_0x1a96d4);})[_0xbc95('0x10')](function(_0x23c572){logger['info']('['+_0x1a96d4['toUpperCase']()+_0xbc95('0x5c'),_0x23c572[_0xbc95('0x2f')]);logger[_0xbc95('0x20')]('['+_0x1a96d4[_0xbc95('0x13')]()+_0xbc95('0x5d'),_0x49f226[_0xbc95('0x2d')]);return getTicket(_0x23c572,_0x5b8ffd,_0x122ba6,_0x544744,_0x49f226,_0x38979e,_0x1a96d4);})[_0xbc95('0x10')](function(_0x23c78a){logger[_0xbc95('0x20')](util[_0xbc95('0x4b')]('['+_0x1a96d4[_0xbc95('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x38979e[_0xbc95('0x44')],_0x23c78a[_0xbc95('0x49')]));logger[_0xbc95('0x20')](util[_0xbc95('0x4b')]('['+_0x1a96d4[_0xbc95('0x13')]()+_0xbc95('0x5e'),_0x1a96d4));if(_0x1a96d4!=='unmanaged'){logger['info']('['+_0x1a96d4[_0xbc95('0x13')]()+']',_0xbc95('0x5f'));emit(_0x5b8ffd[_0xbc95('0xd')],_0x38c021['name'],_0x38979e[_0xbc95('0x44')],_0x23c78a['ticketId']);}})[_0xbc95('0x12')](function(_0x148eb9){logger[_0xbc95('0x60')]('['+_0x1a96d4[_0xbc95('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xbc95('0x61')](_0x148eb9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbc0a=['Subjects','getString','Descriptions','/contacts(','ticketType','phonecalls','queue','callDirection','Fields','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','outbound','calleridnum','contacts','/systemusers(','Bearer\x20','odata-entityid','lastIndexOf','enduserId','GET','contacts?$select=telephone1','value','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','substring','indexOf','content','incident','incidents','assign'];(function(_0x4f9383,_0x59383e){var _0x2c9594=function(_0x28e7a0){while(--_0x28e7a0){_0x4f9383['push'](_0x4f9383['shift']());}};_0x2c9594(++_0x59383e);}(_0xbc0a,0x1c0));var _0xabc0=function(_0x4d9671,_0x16b09a){_0x4d9671=_0x4d9671-0x0;var _0x1a8aa0=_0xbc0a[_0x4d9671];return _0x1a8aa0;};'use strict';var _=require(_0xabc0('0x0'));var BPromise=require(_0xabc0('0x1'));var rp=require('request-promise');var util=require(_0xabc0('0x2'));var intUtil=require(_0xabc0('0x3'));var md5=require(_0xabc0('0x4'));var Redis=require(_0xabc0('0x5'));var logger=require(_0xabc0('0x6'))(_0xabc0('0x7'));var config=require(_0xabc0('0x8'));config[_0xabc0('0x9')]=_[_0xabc0('0xa')](config[_0xabc0('0x9')],{'host':_0xabc0('0xb'),'port':0x18eb});var io=require(_0xabc0('0xc'))(new Redis(config[_0xabc0('0x9')]));function getAuthToken(_0xf10b6f,_0x1c71f7,_0x47edc1){var _0x5314ed={'method':_0xabc0('0xd'),'uri':_0x1c71f7,'form':{'client_id':_0xf10b6f[_0xabc0('0xe')],'resource':_0xf10b6f[_0xabc0('0xf')],'username':_0xf10b6f['username'],'password':_0xf10b6f[_0xabc0('0x10')],'grant_type':_0xabc0('0x10'),'client_secret':_0xf10b6f[_0xabc0('0x11')]},'json':!![]};return rp(_0x5314ed)[_0xabc0('0x12')](function(_0x54cc4b){return _0x54cc4b[_0xabc0('0x13')];})[_0xabc0('0x14')](function(_0x3388fe){logger[_0xabc0('0x15')]('['+[_0x47edc1[_0xabc0('0x16')]()]+_0xabc0('0x17'));return _0x3388fe[_0xabc0('0x18')];});}function getUser(_0x44059f,_0x28585b,_0x1dbec1,_0x5863f3,_0x520123,_0x3190cd){return new BPromise(function(_0x36745f,_0x2e61fc){return getAuthToken(_0x28585b,_0x5863f3,_0x3190cd)[_0xabc0('0x12')](function(_0x1c548d){var _0x149805={'method':'GET','uri':_0x520123+_0xabc0('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x1c548d,'OData-Version':_0xabc0('0x1a')},'json':!![]};return rp(_0x149805);})[_0xabc0('0x12')](function(_0x58db65){var _0x5439e0=_0x58db65['value'];var _0x42fc2e=![];var _0x213451=null;if(!_['isNil'](_0x1dbec1)){if(intUtil['validateEmail'](_0x1dbec1[_0xabc0('0x1b')])){_0x44059f[_0xabc0('0x1c')]=_0x1dbec1['email'];for(_0x213451=0x0;_0x213451<_0x5439e0[_0xabc0('0x1d')];_0x213451++){if(_0x5439e0[_0x213451]['internalemailaddress']===_0x1dbec1[_0xabc0('0x1b')]&&!_0x5439e0[_0x213451][_0xabc0('0x1e')]){_0x42fc2e=!![];logger[_0xabc0('0x1f')]('['+[_0x3190cd[_0xabc0('0x16')]()]+_0xabc0('0x20')+_0x5439e0[_0x213451]['systemuserid']+'!');_0x44059f[_0xabc0('0x21')]=_0x5439e0[_0x213451][_0xabc0('0x22')];}}}}if(!_0x42fc2e){logger[_0xabc0('0x1f')]('['+[_0x3190cd['toUpperCase']()]+_0xabc0('0x23'));_0x44059f[_0xabc0('0x1c')]=_0x28585b[_0xabc0('0x24')];for(_0x213451=0x0;_0x213451<_0x5439e0[_0xabc0('0x1d')];_0x213451++){if(_0x5439e0[_0x213451][_0xabc0('0x25')]===_0x28585b[_0xabc0('0x24')]){_0x44059f[_0xabc0('0x21')]=_0x5439e0[_0x213451]['systemuserid'];}}}_0x36745f(_0x44059f);})[_0xabc0('0x14')](function(_0x55667a){_0x2e61fc(_0x55667a[_0xabc0('0x18')]);});});}function createEndUser(_0xd59cab,_0x254e42,_0x5ee9ea,_0x32a3aa,_0x5d2a78,_0x59b60a){return new BPromise(function(_0x2717fe,_0xe13643){return getAuthToken(_0x254e42,_0x5ee9ea,_0x59b60a)[_0xabc0('0x12')](function(_0x2556d8){var _0x2bac38=_0x59b60a[_0xabc0('0x26')]()===_0xabc0('0x27')?_0x5d2a78['destcalleridnum']:_0x5d2a78[_0xabc0('0x28')];var _0x5d1074={'method':_0xabc0('0xd'),'uri':_0x32a3aa+_0xabc0('0x29'),'body':{'telephone1':_0x2bac38,'fullname':_0x2bac38,'firstname':_0x2bac38,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xabc0('0x2a')+_0xd59cab[_0xabc0('0x21')]+')'},'headers':{'Authorization':_0xabc0('0x2b')+_0x2556d8,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5d1074);})[_0xabc0('0x12')](function(_0x3479b5){var _0x28bef8=_0x3479b5['headers'][_0xabc0('0x2c')];var _0x2a1546=_0x28bef8['substring'](_0x28bef8[_0xabc0('0x2d')]('(')+0x1,_0x28bef8[_0xabc0('0x2d')](')'));_0xd59cab[_0xabc0('0x2e')]=_0x2a1546;_0x2717fe(_0xd59cab);})['catch'](function(_0x92da44){_0xe13643(_0x92da44[_0xabc0('0x18')]);});});}function getEndUser(_0x33fc50,_0x2002fd,_0x1fda18,_0x3354e8,_0x4cdcf7,_0x335e7e){return new BPromise(function(_0x564c4b,_0x37d89b){return getAuthToken(_0x2002fd,_0x1fda18,_0x335e7e)[_0xabc0('0x12')](function(_0x546334){var _0xb4513a={'method':_0xabc0('0x2f'),'uri':_0x3354e8+_0xabc0('0x30'),'headers':{'Authorization':_0xabc0('0x2b')+_0x546334,'If-None-Match':null,'OData-Version':_0xabc0('0x1a')},'json':!![]};return rp(_0xb4513a);})[_0xabc0('0x12')](function(_0x10aa06){var _0x263296=null;if(_0x10aa06){var _0x5c79a7=_0x10aa06[_0xabc0('0x31')];var _0x15efa0=![];for(_0x263296=0x0;_0x263296<_0x5c79a7[_0xabc0('0x1d')];_0x263296++){var _0x5ed3be=_0x335e7e[_0xabc0('0x26')]()===_0xabc0('0x27')?_0x4cdcf7[_0xabc0('0x32')]:_0x4cdcf7[_0xabc0('0x28')];if(_0x5c79a7[_0x263296][_0xabc0('0x33')]===_0x5ed3be){_0x15efa0=!![];_0x33fc50[_0xabc0('0x2e')]=_0x5c79a7[_0x263296][_0xabc0('0x34')];}}if(_0x15efa0){_0x564c4b(_0x33fc50);}else{return createEndUser(_0x33fc50,_0x2002fd,_0x1fda18,_0x3354e8,_0x4cdcf7,_0x335e7e)[_0xabc0('0x12')](function(_0x1f64f9){logger[_0xabc0('0x1f')]('['+[_0x335e7e[_0xabc0('0x16')]()]+_0xabc0('0x35'),_0x1f64f9[_0xabc0('0x2e')]);_0x564c4b(_0x1f64f9);});}}else{return createEndUser(_0x33fc50,_0x2002fd,_0x1fda18,_0x3354e8,_0x4cdcf7,_0x335e7e)[_0xabc0('0x12')](function(_0x5e44dc){logger['info']('['+[_0x335e7e['toUpperCase']()]+_0xabc0('0x36'),_0x5e44dc['enduserId']);_0x564c4b(_0x5e44dc);});}});});}function getCustomFields(_0x26ae1d,_0x58a12b,_0x6bb982){var _0x2d7210={};if(_0x26ae1d[_0xabc0('0x1d')]>0x0){_[_0xabc0('0x37')](_0x26ae1d,function(_0x3f147){if(_0x3f147[_0xabc0('0x38')]===_0xabc0('0x39')&&_0x3f147[_0xabc0('0x3a')]&&!_0x3f147[_0xabc0('0x3b')]){var _0x3e73ba=_0x3f147[_0xabc0('0x3c')][_0xabc0('0x26')]();var _0x486bad=_0x3e73ba[_0xabc0('0x3d')](0x0,_0x3e73ba[_0xabc0('0x3e')]('_'));var _0x37d60d=_0x3e73ba[_0xabc0('0x3d')](_0x3e73ba[_0xabc0('0x3e')]('_')+0x1);if(_0x486bad===_0x6bb982){_0x2d7210[_0x37d60d]=_0x3f147[_0xabc0('0x3f')];}}});}return _0x2d7210;}function getTicket(_0x3ac461,_0x15740b,_0x254008,_0x4c7d00,_0x55f988,_0x3d8826,_0x35aa66){return new BPromise(function(_0x2e38d4,_0x472c8a){var _0xffa86e;return getAuthToken(_0x15740b,_0x254008,_0x35aa66)['then'](function(_0x16ceaa){if(_0x3d8826['ticketType']===_0xabc0('0x40')){_0xffa86e={'method':_0xabc0('0xd'),'uri':_0x4c7d00+_0xabc0('0x41'),'body':Object[_0xabc0('0x42')]({},{'title':intUtil['getString'](_0x3d8826[_0xabc0('0x43')],_0x55f988,'\x20'),'description':intUtil[_0xabc0('0x44')](_0x3d8826[_0xabc0('0x45')],_0x55f988,'\x0a'),'customerid_contact@odata.bind':_0xabc0('0x46')+_0x3ac461[_0xabc0('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x3ac461[_0xabc0('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x3d8826['Fields'],_0x55f988,_0x3d8826[_0xabc0('0x47')])),'headers':{'Authorization':_0xabc0('0x2b')+_0x16ceaa,'OData-Version':_0xabc0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3d8826[_0xabc0('0x47')]==='phonecall'){_0xffa86e={'method':'POST','uri':_0x4c7d00+_0xabc0('0x48'),'body':Object[_0xabc0('0x42')]({},{'subject':intUtil[_0xabc0('0x44')](_0x3d8826[_0xabc0('0x43')],_0x55f988,'\x20'),'phonenumber':String(_0x55f988[_0xabc0('0x28')]),'description':intUtil['getString'](_0x3d8826[_0xabc0('0x45')],_0x55f988,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x3ac461[_0xabc0('0x2e')]+')','ownerid@odata.bind':_0xabc0('0x2a')+_0x3ac461[_0xabc0('0x21')]+')','directioncode':_0x3ac461['callDirection']===_0xabc0('0x49')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xabc0('0x2a')+_0x3ac461['userId']+')','participationtypemask':_0x3ac461[_0xabc0('0x4a')]===_0xabc0('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xabc0('0x46')+_0x3ac461[_0xabc0('0x2e')]+')','participationtypemask':_0x3ac461[_0xabc0('0x4a')]===_0xabc0('0x49')?0x1:0x2}]},getCustomFields(_0x3d8826[_0xabc0('0x4b')],_0x55f988,_0x3d8826[_0xabc0('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x16ceaa,'OData-Version':_0xabc0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xffa86e);})['then'](function(_0x5bc99e){var _0x43b7d8=_0x5bc99e['headers'][_0xabc0('0x2c')];var _0x17f43c=_0x43b7d8[_0xabc0('0x3d')](_0x43b7d8['lastIndexOf']('(')+0x1,_0x43b7d8[_0xabc0('0x2d')](')'));_0x3ac461['ticketId']=_0x17f43c;_0x2e38d4(_0x3ac461);})[_0xabc0('0x14')](function(_0xb58567){_0x472c8a(_0xb58567[_0xabc0('0x18')]);});});}function emit(_0x313c3d,_0x13a74c,_0x2f0e9a,_0x53876b){var _0x34a867={'uri':util[_0xabc0('0x4c')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x313c3d,_0x2f0e9a,_0x53876b)};io['to'](util['format'](_0xabc0('0x4d'),_0x13a74c))['emit'](_0xabc0('0x4e'),_0x34a867);}exports['cs']=function(_0x4ebdf9,_0x3febad,_0x522e9f,_0x297cd2,_0x357263,_0x3e0335,_0x5ad4e3,_0x510f26){var _0x57b0cf={};_0x3e0335['remoteUri']=intUtil[_0xabc0('0x4f')](_0x3e0335[_0xabc0('0xf')]);_0x3e0335[_0xabc0('0x50')]=intUtil[_0xabc0('0x4f')](_0x3e0335[_0xabc0('0x50')]);_0x57b0cf['callDirection']=_0x510f26==='queue'||_0x510f26===_0xabc0('0x51')?_0xabc0('0x49'):_0xabc0('0x27');var _0x1addef=util[_0xabc0('0x4c')](_0xabc0('0x52'),_0x3e0335['remoteUri']);var _0x263c44=util[_0xabc0('0x4c')](_0xabc0('0x53'),_0x3e0335[_0xabc0('0x54')]);var _0x53b9a4=util[_0xabc0('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e0335[_0xabc0('0x50')],_0x3febad['uniqueid'],md5(_0x3febad[_0xabc0('0x55')]));if(_0x357263&&_0x357263[_0xabc0('0x56')]){logger[_0xabc0('0x1f')](_0xabc0('0x57'),_0xabc0('0x58'));_0x3febad['recordingURL']=_0x53b9a4;}else if(_0x5ad4e3&&_0x5ad4e3[_0xabc0('0x59')]&&_0x5ad4e3[_0xabc0('0x59')]!==_0xabc0('0x5a')){logger[_0xabc0('0x1f')](_0xabc0('0x5b'),_0xabc0('0x58'));_0x3febad[_0xabc0('0x5c')]=_0x53b9a4;}else{_0x3febad[_0xabc0('0x5c')]='';}return getUser(_0x57b0cf,_0x3e0335,_0x297cd2,_0x263c44,_0x1addef,_0x510f26)['then'](function(_0x567fae){logger[_0xabc0('0x1f')]('['+_0x510f26[_0xabc0('0x16')]()+_0xabc0('0x5d'),_0x567fae[_0xabc0('0x21')]);logger[_0xabc0('0x1f')]('['+_0x510f26[_0xabc0('0x16')]()+_0xabc0('0x5e'),_0x567fae['userEmail']);return getEndUser(_0x567fae,_0x3e0335,_0x263c44,_0x1addef,_0x3febad,_0x510f26);})['then'](function(_0x29d9bd){logger[_0xabc0('0x1f')]('['+_0x510f26[_0xabc0('0x16')]()+_0xabc0('0x5f'),_0x29d9bd[_0xabc0('0x2e')]);logger[_0xabc0('0x1f')]('['+_0x510f26[_0xabc0('0x16')]()+_0xabc0('0x60'),_0x3febad[_0xabc0('0x28')]);return getTicket(_0x29d9bd,_0x3e0335,_0x263c44,_0x1addef,_0x3febad,_0x522e9f,_0x510f26);})[_0xabc0('0x12')](function(_0x29bae4){logger[_0xabc0('0x1f')](util[_0xabc0('0x4c')]('['+_0x510f26[_0xabc0('0x16')]()+_0xabc0('0x61'),_0x522e9f[_0xabc0('0x47')],_0x29bae4[_0xabc0('0x62')]));logger[_0xabc0('0x1f')](util[_0xabc0('0x4c')]('['+_0x510f26[_0xabc0('0x16')]()+_0xabc0('0x63'),_0x510f26));if(_0x510f26!==_0xabc0('0x51')){logger[_0xabc0('0x1f')]('['+_0x510f26[_0xabc0('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3e0335[_0xabc0('0xf')],_0x297cd2[_0xabc0('0x64')],_0x522e9f['ticketType'],_0x29bae4[_0xabc0('0x62')]);}})[_0xabc0('0x14')](function(_0x12b3ae){logger[_0xabc0('0x15')]('['+_0x510f26['toUpperCase']()+_0xabc0('0x65'),util[_0xabc0('0x66')](_0x12b3ae,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index e0eb844..a2b0eeb 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 _0x92b2=['trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','lastevent','calleridname','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridnum','getString','Descriptions','
','Tags','name','mapValues','keyBy','value','format','remoteUri','POST','%s/api/v2/agents','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','type','string','toLowerCase','content','idField','customField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x92b2,0xbe));var _0x292b=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0x92b2[_0x4cb231];return _0x4d5063;};'use strict';var _=require(_0x292b('0x0'));var rp=require(_0x292b('0x1'));var md5=require(_0x292b('0x2'));var util=require(_0x292b('0x3'));var Redis=require('ioredis');var intUtil=require(_0x292b('0x4'));var config=require('../../../../config/environment');var logger=require(_0x292b('0x5'))(_0x292b('0x6'));config[_0x292b('0x7')]=_[_0x292b('0x8')](config[_0x292b('0x7')],{'host':_0x292b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x292b('0x7')]));var headers={'Content-Type':_0x292b('0xa'),'Accept':'application/json'};function emit(_0x5a51d9,_0x12fde6,_0x3e3a01){io['to'](_0x5a51d9)[_0x292b('0xb')](_0x12fde6,_0x3e3a01);}function getTicket(_0x4a0d68,_0x192f41,_0x5235ce,_0x4cb7f7,_0x5be0c3){logger[_0x292b('0xc')](_0x292b('0xd'));var _0x314354=_[_0x292b('0xe')]({'responder_id':_0x192f41['id'],'requester_id':_0x5235ce['id'],'name':util['format']('Caller\x20-\x20%s',_0x5be0c3['calleridname']),'phone':_0x5be0c3[_0x292b('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4cb7f7['Subjects'],_0x5be0c3,'\x20'),'description':intUtil[_0x292b('0x10')](_0x4cb7f7[_0x292b('0x11')],_0x5be0c3,_0x292b('0x12')),'tags':getTags(_0x4cb7f7[_0x292b('0x13')],_0x292b('0x14'))},getCustomFields(_0x4cb7f7['Fields'],_0x5be0c3));_0x314354['custom_fields']=_[_0x292b('0x15')](_[_0x292b('0x16')](_0x314354['custom_fields'],'id'),_0x292b('0x17'));return request({'uri':util[_0x292b('0x18')]('%s/api/v2/tickets',_0x4a0d68[_0x292b('0x19')]),'method':_0x292b('0x1a'),'body':_0x314354})['then'](function(_0x58bf04){logger[_0x292b('0xc')]('Ticket\x20created!');return _0x58bf04;});}function getUser(_0x4adfa1,_0xb10a5d){if(intUtil['validateEmail'](_0xb10a5d)){return request({'uri':util[_0x292b('0x18')](_0x292b('0x1b'),_0x4adfa1['remoteUri']),'qs':{'email':_0xb10a5d}})['then'](function(_0x38a350){if(_0x38a350['length']){logger[_0x292b('0xc')](_0x292b('0x1c'));return _[_0x292b('0x1d')](_0x38a350,function(_0x3c8e7f){return _0x3c8e7f['contact'][_0x292b('0x1e')]===_0xb10a5d;});}else{logger[_0x292b('0xc')](_0x292b('0x1f'));return request({'uri':util[_0x292b('0x18')](_0x292b('0x20'),_0x4adfa1[_0x292b('0x19')])})[_0x292b('0x21')](function(_0x7cf40a){logger[_0x292b('0xc')](_0x292b('0x22'));return _0x7cf40a;});}});}else{logger[_0x292b('0xc')](_0x292b('0x23'));return request({'uri':util['format'](_0x292b('0x20'),_0x4adfa1[_0x292b('0x19')])})['then'](function(_0x31db76){logger['info']('Admin\x20account\x20selected.');return _0x31db76;});}}function getEndUser(_0x44764c,_0x207632,_0x11530c){logger[_0x292b('0xc')](_0x292b('0x24'),_0x11530c);return request({'uri':util[_0x292b('0x18')](_0x292b('0x25'),_0x44764c[_0x292b('0x19')]),'qs':{'phone':_0x11530c}})[_0x292b('0x21')](function(_0x3f0116){if(_0x3f0116[_0x292b('0x26')]){logger['info'](_0x292b('0x27'));return _[_0x292b('0x1d')](_0x3f0116,{'phone':_0x11530c});}else{logger[_0x292b('0xc')](_0x292b('0x28'));return request({'uri':util[_0x292b('0x18')](_0x292b('0x25'),_0x44764c[_0x292b('0x19')]),'method':_0x292b('0x1a'),'body':{'name':_0x207632,'phone':_0x11530c}})[_0x292b('0x21')](function(_0x22c15c){logger[_0x292b('0xc')](_0x292b('0x29'));return _0x22c15c;});}});}function getAuth(_0x52c895){return util[_0x292b('0x18')](_0x292b('0x2a'),new Buffer(_0x52c895['apiKey']+':X')[_0x292b('0x2b')](_0x292b('0x2c')));}function request(_0x3a1f61){logger[_0x292b('0x2d')]('[HTTP]',JSON[_0x292b('0x2e')](_0x3a1f61));return rp(_['defaults'](_0x3a1f61,{'method':_0x292b('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x54430,_0x2d6577){var _0x4b7b14=[];if(_0x54430&&_0x54430[_0x292b('0x26')]>0x0){_0x4b7b14=_[_0x292b('0x30')](_0x54430,_0x2d6577);}return _0x4b7b14;}function getCustomFields(_0xfad03,_0x16762f){var _0x438385=[];var _0x5d7b2b={'custom_fields':[]};if(_0xfad03['length']>0x0){_[_0x292b('0x31')](_0xfad03,function(_0x380d9c){if(_0x380d9c[_0x292b('0x32')]===_0x292b('0x33')&&_0x380d9c['nameField']&&!_0x380d9c['customField']){_0x5d7b2b[_0x380d9c['nameField'][_0x292b('0x34')]()]=_0x380d9c[_0x292b('0x35')][_0x292b('0x2b')]();}else if(_0x380d9c[_0x292b('0x32')]===_0x292b('0x33')&&_0x380d9c[_0x292b('0x36')]&&_0x380d9c[_0x292b('0x37')]){_0x5d7b2b[_0x292b('0x38')][_0x292b('0x39')]({'id':_0x380d9c[_0x292b('0x36')],'value':_0x380d9c['content']['toString']()});}else if(_0x380d9c[_0x292b('0x32')]==='variable'&&_0x380d9c['variableName']&&_0x380d9c[_0x292b('0x36')]&&_0x380d9c[_0x292b('0x37')]){_0x16762f[_0x380d9c[_0x292b('0x3a')]]&&_0x5d7b2b[_0x292b('0x38')][_0x292b('0x39')]({'id':_0x380d9c[_0x292b('0x36')],'value':_0x16762f[_0x380d9c[_0x292b('0x3a')]][_0x292b('0x2b')]()});}else if(_0x380d9c[_0x292b('0x32')]===_0x292b('0x3b')&&_0x380d9c[_0x292b('0x3c')]&&_0x380d9c[_0x292b('0x3c')][_0x292b('0x14')]&&_0x380d9c[_0x292b('0x36')]&&_0x380d9c[_0x292b('0x37')]){_0x16762f[_0x380d9c[_0x292b('0x3c')]['name']['toLowerCase']()]&&_0x5d7b2b['custom_fields'][_0x292b('0x39')]({'id':_0x380d9c['idField'],'value':_0x16762f[_0x380d9c[_0x292b('0x3c')][_0x292b('0x14')][_0x292b('0x34')]()][_0x292b('0x2b')]()});}});}return _0x5d7b2b;}exports[_0x292b('0x3d')]=function(_0x4acc4f,_0x31d889,_0x5ddaa9,_0x295b90,_0x4bffae,_0xb5640d){var _0x591569,_0x2dfe0b;_0xb5640d[_0x292b('0x19')]=intUtil[_0x292b('0x3e')](_0xb5640d[_0x292b('0x19')]);_0xb5640d[_0x292b('0x3f')]=intUtil[_0x292b('0x3e')](_0xb5640d[_0x292b('0x3f')]);if(_0x4bffae&&_0x4bffae[_0x292b('0x40')]){logger[_0x292b('0xc')](_0x292b('0x41'),'Recording\x20is\x20enabled!');_0x31d889[_0x292b('0x42')]=util[_0x292b('0x18')](_0x292b('0x43'),_0xb5640d['serverUrl'],_0x31d889[_0x292b('0x44')],md5(_0x31d889[_0x292b('0x44')]));}else{_0x31d889['recordingURL']='';}headers['Authorization']=getAuth(_0xb5640d);return getUser(_0xb5640d,_0x295b90[_0x292b('0x1e')])['then'](function(_0x20ebe9){_0x591569=_0x20ebe9;logger['info'](_0x292b('0x45'),_0x591569['id']);return getEndUser(_0xb5640d,_0x31d889['calleridname'],_0x31d889[_0x292b('0xf')]);})[_0x292b('0x21')](function(_0x16cf77){_0x2dfe0b=_0x16cf77;logger[_0x292b('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2dfe0b['id']);return getTicket(_0xb5640d,_0x591569,_0x2dfe0b,_0x5ddaa9,_0x31d889);})[_0x292b('0x21')](function(_0x58fd81){if(_0x58fd81&&_0x58fd81['id']){logger[_0x292b('0xc')](_0x292b('0x46'));logger[_0x292b('0xc')](_0x292b('0x47'),_0x58fd81['id']);logger[_0x292b('0xc')](_0x292b('0x41'),_0x292b('0x48'));emit(util['format'](_0x292b('0x49'),_0x295b90[_0x292b('0x14')]),_0x292b('0x4a'),{'uri':util[_0x292b('0x18')](_0x292b('0x4b'),_0xb5640d[_0x292b('0x19')],_0x58fd81['id'])});}})[_0x292b('0x4c')](function(_0x3f5138){logger[_0x292b('0x4d')](_0x292b('0x41'),JSON[_0x292b('0x2e')](_0x3f5138));});};exports['outbound']=function(_0x44ce7a,_0x3f423f,_0x4ae611,_0x4afb75,_0x275ee6,_0x4fa9c6,_0x188928){var _0x4105b9,_0x406b7a;_0x4fa9c6[_0x292b('0x19')]=intUtil['stripTrailingSlash'](_0x4fa9c6[_0x292b('0x19')]);_0x4fa9c6[_0x292b('0x3f')]=intUtil[_0x292b('0x3e')](_0x4fa9c6[_0x292b('0x3f')]);if(_0x188928&&_0x188928[_0x292b('0x4e')]&&_0x188928['recordingFormat']!==_0x292b('0x4f')){logger[_0x292b('0xc')](_0x292b('0x50'),_0x292b('0x51'));_0x3f423f['recordingURL']=util[_0x292b('0x18')](_0x292b('0x43'),_0x4fa9c6[_0x292b('0x3f')],_0x3f423f[_0x292b('0x44')],md5(_0x3f423f[_0x292b('0x44')]));}headers['Authorization']=getAuth(_0x4fa9c6);return getUser(_0x4fa9c6,_0x4afb75[_0x292b('0x1e')])[_0x292b('0x21')](function(_0x192c4e){_0x4105b9=_0x192c4e;logger['info'](_0x292b('0x45'),_0x4105b9['id']);return getEndUser(_0x4fa9c6,_0x3f423f[_0x292b('0x52')],_0x3f423f[_0x292b('0x53')]);})[_0x292b('0x21')](function(_0x24b40d){_0x406b7a=_0x24b40d;logger[_0x292b('0xc')](_0x292b('0x54'),_0x406b7a['id']);return getTicket(_0x4fa9c6,_0x4105b9,_0x406b7a,_0x4ae611,_0x3f423f);})['then'](function(_0xb7d9d9){if(_0xb7d9d9&&_0xb7d9d9['id']){logger['info']('Ticket\x20created!');logger[_0x292b('0xc')]('The\x20Ticket\x20ID\x20is:',_0xb7d9d9['id']);logger[_0x292b('0xc')](_0x292b('0x50'),_0x292b('0x48'));emit(util[_0x292b('0x18')](_0x292b('0x49'),_0x4afb75[_0x292b('0x14')]),'trigger:browser:url',{'uri':util[_0x292b('0x18')](_0x292b('0x4b'),_0x4fa9c6[_0x292b('0x19')],_0xb7d9d9['id'])});}})[_0x292b('0x4c')](function(_0x56d076){logger['error'](_0x292b('0x50'),JSON['stringify'](_0x56d076));});};exports['unmanaged']=function(_0x5f03b0,_0x4a8fa2,_0x4f7163,_0x109f06,_0x24e50b,_0x333ce8){var _0x581cce,_0x4f6d5a;_0x333ce8[_0x292b('0x19')]=intUtil[_0x292b('0x3e')](_0x333ce8[_0x292b('0x19')]);_0x333ce8[_0x292b('0x3f')]=intUtil[_0x292b('0x3e')](_0x333ce8[_0x292b('0x3f')]);if(_0x24e50b&&_0x24e50b['monitor_format']){logger['info']('['+_0x4a8fa2[_0x292b('0x55')]['toUpperCase']()+']',_0x292b('0x51'));_0x4a8fa2['recordingURL']=util['format'](_0x292b('0x43'),_0x333ce8['serverUrl'],_0x4a8fa2['uniqueid'],md5(_0x4a8fa2['uniqueid']));}else{_0x4a8fa2[_0x292b('0x42')]='';}headers['Authorization']=getAuth(_0x333ce8);return getUser(_0x333ce8,'')[_0x292b('0x21')](function(_0x36c785){_0x581cce=_0x36c785;logger[_0x292b('0xc')](_0x292b('0x45'),_0x581cce['id']);return getEndUser(_0x333ce8,_0x4a8fa2[_0x292b('0x56')],_0x4a8fa2['calleridnum']);})[_0x292b('0x21')](function(_0x56c602){_0x4f6d5a=_0x56c602;logger[_0x292b('0xc')](_0x292b('0x54'),_0x4f6d5a['id']);return getTicket(_0x333ce8,_0x581cce,_0x4f6d5a,_0x4f7163,_0x4a8fa2);})[_0x292b('0x21')](function(_0x56580a){if(_0x56580a){logger[_0x292b('0xc')](_0x292b('0x46'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x56580a['id']);}})[_0x292b('0x4c')](function(_0x470d61){logger[_0x292b('0x4d')]('['+_0x4a8fa2[_0x292b('0x55')][_0x292b('0x57')]()+']',JSON[_0x292b('0x2e')](_0x470d61));});}; \ No newline at end of file +var _0x5e78=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','forEach','type','string','nameField','customField','toLowerCase','content','idField','variable','variableName','push','Variable','name','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x180858,_0x109cad){var _0x4b7584=function(_0x29474e){while(--_0x29474e){_0x180858['push'](_0x180858['shift']());}};_0x4b7584(++_0x109cad);}(_0x5e78,0xca));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85e7('0x0'));var rp=require(_0x85e7('0x1'));var md5=require(_0x85e7('0x2'));var util=require(_0x85e7('0x3'));var Redis=require(_0x85e7('0x4'));var intUtil=require(_0x85e7('0x5'));var config=require(_0x85e7('0x6'));var logger=require(_0x85e7('0x7'))(_0x85e7('0x8'));config[_0x85e7('0x9')]=_[_0x85e7('0xa')](config[_0x85e7('0x9')],{'host':_0x85e7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x85e7('0xc'),'Accept':_0x85e7('0xc')};function emit(_0x24623d,_0x5214d4,_0x4ea347){io['to'](_0x24623d)[_0x85e7('0xd')](_0x5214d4,_0x4ea347);}function getTicket(_0x2e8cc0,_0x2b6b4d,_0x4349ad,_0x5af0ed,_0x5ddc8f){logger[_0x85e7('0xe')](_0x85e7('0xf'));var _0x55d127=_[_0x85e7('0x10')]({'responder_id':_0x2b6b4d['id'],'requester_id':_0x4349ad['id'],'name':util[_0x85e7('0x11')](_0x85e7('0x12'),_0x5ddc8f['calleridname']),'phone':_0x5ddc8f[_0x85e7('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x85e7('0x14')](_0x5af0ed[_0x85e7('0x15')],_0x5ddc8f,'\x20'),'description':intUtil[_0x85e7('0x14')](_0x5af0ed[_0x85e7('0x16')],_0x5ddc8f,'
'),'tags':getTags(_0x5af0ed['Tags'],'name')},getCustomFields(_0x5af0ed[_0x85e7('0x17')],_0x5ddc8f));_0x55d127[_0x85e7('0x18')]=_[_0x85e7('0x19')](_[_0x85e7('0x1a')](_0x55d127[_0x85e7('0x18')],'id'),_0x85e7('0x1b'));return request({'uri':util[_0x85e7('0x11')](_0x85e7('0x1c'),_0x2e8cc0[_0x85e7('0x1d')]),'method':_0x85e7('0x1e'),'body':_0x55d127})[_0x85e7('0x1f')](function(_0x3b4e76){logger[_0x85e7('0xe')](_0x85e7('0x20'));return _0x3b4e76;});}function getUser(_0x409f63,_0x236085){if(intUtil[_0x85e7('0x21')](_0x236085)){return request({'uri':util[_0x85e7('0x11')](_0x85e7('0x22'),_0x409f63[_0x85e7('0x1d')]),'qs':{'email':_0x236085}})[_0x85e7('0x1f')](function(_0x3fa28a){if(_0x3fa28a[_0x85e7('0x23')]){logger[_0x85e7('0xe')]('Agent\x20found!');return _[_0x85e7('0x24')](_0x3fa28a,function(_0xb501c2){return _0xb501c2['contact']['email']===_0x236085;});}else{logger[_0x85e7('0xe')](_0x85e7('0x25'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x409f63[_0x85e7('0x1d')])})['then'](function(_0x3888f8){logger[_0x85e7('0xe')]('Admin\x20account\x20selected.');return _0x3888f8;});}});}else{logger[_0x85e7('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x85e7('0x11')]('%s/api/v2/agents/me',_0x409f63[_0x85e7('0x1d')])})[_0x85e7('0x1f')](function(_0x3284a8){logger[_0x85e7('0xe')](_0x85e7('0x26'));return _0x3284a8;});}}function getEndUser(_0x82c8a,_0x2072d0,_0x11fb1c){logger[_0x85e7('0xe')](_0x85e7('0x27'),_0x11fb1c);return request({'uri':util['format']('%s/api/v2/contacts',_0x82c8a['remoteUri']),'qs':{'phone':_0x11fb1c}})[_0x85e7('0x1f')](function(_0x42f391){if(_0x42f391[_0x85e7('0x23')]){logger['info'](_0x85e7('0x28'));return _[_0x85e7('0x24')](_0x42f391,{'phone':_0x11fb1c});}else{logger[_0x85e7('0xe')](_0x85e7('0x29'));return request({'uri':util[_0x85e7('0x11')]('%s/api/v2/contacts',_0x82c8a[_0x85e7('0x1d')]),'method':_0x85e7('0x1e'),'body':{'name':_0x2072d0,'phone':_0x11fb1c}})[_0x85e7('0x1f')](function(_0x33c770){logger['info'](_0x85e7('0x2a'));return _0x33c770;});}});}function getAuth(_0x2b7568){return util[_0x85e7('0x11')](_0x85e7('0x2b'),new Buffer(_0x2b7568[_0x85e7('0x2c')]+':X')[_0x85e7('0x2d')](_0x85e7('0x2e')));}function request(_0x50849d){logger[_0x85e7('0x2f')](_0x85e7('0x30'),JSON['stringify'](_0x50849d));return rp(_[_0x85e7('0xa')](_0x50849d,{'method':_0x85e7('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x29c1c7,_0x3cbc0d){var _0x22c719=[];if(_0x29c1c7&&_0x29c1c7[_0x85e7('0x23')]>0x0){_0x22c719=_['map'](_0x29c1c7,_0x3cbc0d);}return _0x22c719;}function getCustomFields(_0x36369a,_0x30417b){var _0x110622=[];var _0x49a82e={'custom_fields':[]};if(_0x36369a['length']>0x0){_[_0x85e7('0x32')](_0x36369a,function(_0x4bee26){if(_0x4bee26[_0x85e7('0x33')]===_0x85e7('0x34')&&_0x4bee26[_0x85e7('0x35')]&&!_0x4bee26[_0x85e7('0x36')]){_0x49a82e[_0x4bee26[_0x85e7('0x35')][_0x85e7('0x37')]()]=_0x4bee26[_0x85e7('0x38')][_0x85e7('0x2d')]();}else if(_0x4bee26[_0x85e7('0x33')]==='string'&&_0x4bee26[_0x85e7('0x39')]&&_0x4bee26[_0x85e7('0x36')]){_0x49a82e['custom_fields']['push']({'id':_0x4bee26[_0x85e7('0x39')],'value':_0x4bee26[_0x85e7('0x38')][_0x85e7('0x2d')]()});}else if(_0x4bee26[_0x85e7('0x33')]===_0x85e7('0x3a')&&_0x4bee26[_0x85e7('0x3b')]&&_0x4bee26[_0x85e7('0x39')]&&_0x4bee26[_0x85e7('0x36')]){_0x30417b[_0x4bee26[_0x85e7('0x3b')]]&&_0x49a82e[_0x85e7('0x18')][_0x85e7('0x3c')]({'id':_0x4bee26[_0x85e7('0x39')],'value':_0x30417b[_0x4bee26[_0x85e7('0x3b')]][_0x85e7('0x2d')]()});}else if(_0x4bee26[_0x85e7('0x33')]==='customVariable'&&_0x4bee26[_0x85e7('0x3d')]&&_0x4bee26['Variable']['name']&&_0x4bee26[_0x85e7('0x39')]&&_0x4bee26['customField']){_0x30417b[_0x4bee26['Variable'][_0x85e7('0x3e')]['toLowerCase']()]&&_0x49a82e[_0x85e7('0x18')][_0x85e7('0x3c')]({'id':_0x4bee26[_0x85e7('0x39')],'value':_0x30417b[_0x4bee26['Variable'][_0x85e7('0x3e')][_0x85e7('0x37')]()][_0x85e7('0x2d')]()});}});}return _0x49a82e;}exports[_0x85e7('0x3f')]=function(_0x354ac0,_0x1aeaa4,_0x17c1be,_0x18c48d,_0x505221,_0x450ec7){var _0x5e89ee,_0x454d8b;_0x450ec7[_0x85e7('0x1d')]=intUtil['stripTrailingSlash'](_0x450ec7[_0x85e7('0x1d')]);_0x450ec7['serverUrl']=intUtil['stripTrailingSlash'](_0x450ec7[_0x85e7('0x40')]);if(_0x505221&&_0x505221[_0x85e7('0x41')]){logger['info'](_0x85e7('0x42'),_0x85e7('0x43'));_0x1aeaa4[_0x85e7('0x44')]=util[_0x85e7('0x11')](_0x85e7('0x45'),_0x450ec7[_0x85e7('0x40')],_0x1aeaa4[_0x85e7('0x46')],md5(_0x1aeaa4[_0x85e7('0x46')]));}else{_0x1aeaa4[_0x85e7('0x44')]='';}headers[_0x85e7('0x47')]=getAuth(_0x450ec7);return getUser(_0x450ec7,_0x18c48d[_0x85e7('0x48')])[_0x85e7('0x1f')](function(_0x44a80c){_0x5e89ee=_0x44a80c;logger[_0x85e7('0xe')](_0x85e7('0x49'),_0x5e89ee['id']);return getEndUser(_0x450ec7,_0x1aeaa4[_0x85e7('0x4a')],_0x1aeaa4[_0x85e7('0x13')]);})['then'](function(_0x318d19){_0x454d8b=_0x318d19;logger[_0x85e7('0xe')](_0x85e7('0x4b'),_0x454d8b['id']);return getTicket(_0x450ec7,_0x5e89ee,_0x454d8b,_0x17c1be,_0x1aeaa4);})['then'](function(_0x4f5e53){if(_0x4f5e53&&_0x4f5e53['id']){logger['info'](_0x85e7('0x20'));logger[_0x85e7('0xe')]('The\x20Ticket\x20ID\x20is:',_0x4f5e53['id']);logger[_0x85e7('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x85e7('0x11')](_0x85e7('0x4c'),_0x18c48d[_0x85e7('0x3e')]),_0x85e7('0x4d'),{'uri':util['format'](_0x85e7('0x4e'),_0x450ec7[_0x85e7('0x1d')],_0x4f5e53['id'])});}})[_0x85e7('0x4f')](function(_0x3531d8){logger[_0x85e7('0x50')]('[QUEUE]',JSON['stringify'](_0x3531d8));});};exports[_0x85e7('0x51')]=function(_0x2d9f2f,_0x478721,_0x5074f7,_0x33a14a,_0x26198e,_0x324745,_0x1919cb){var _0x55bae2,_0x12b48b;_0x324745[_0x85e7('0x1d')]=intUtil['stripTrailingSlash'](_0x324745['remoteUri']);_0x324745[_0x85e7('0x40')]=intUtil[_0x85e7('0x52')](_0x324745['serverUrl']);if(_0x1919cb&&_0x1919cb[_0x85e7('0x53')]&&_0x1919cb[_0x85e7('0x53')]!==_0x85e7('0x54')){logger[_0x85e7('0xe')](_0x85e7('0x55'),_0x85e7('0x43'));_0x478721[_0x85e7('0x44')]=util[_0x85e7('0x11')](_0x85e7('0x45'),_0x324745['serverUrl'],_0x478721[_0x85e7('0x46')],md5(_0x478721['uniqueid']));}headers['Authorization']=getAuth(_0x324745);return getUser(_0x324745,_0x33a14a['email'])[_0x85e7('0x1f')](function(_0x36c67a){_0x55bae2=_0x36c67a;logger[_0x85e7('0xe')](_0x85e7('0x49'),_0x55bae2['id']);return getEndUser(_0x324745,_0x478721['destcalleridname'],_0x478721[_0x85e7('0x56')]);})[_0x85e7('0x1f')](function(_0x2bd14d){_0x12b48b=_0x2bd14d;logger[_0x85e7('0xe')](_0x85e7('0x4b'),_0x12b48b['id']);return getTicket(_0x324745,_0x55bae2,_0x12b48b,_0x5074f7,_0x478721);})[_0x85e7('0x1f')](function(_0x530655){if(_0x530655&&_0x530655['id']){logger[_0x85e7('0xe')]('Ticket\x20created!');logger['info'](_0x85e7('0x57'),_0x530655['id']);logger[_0x85e7('0xe')](_0x85e7('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x85e7('0x11')](_0x85e7('0x4c'),_0x33a14a[_0x85e7('0x3e')]),_0x85e7('0x4d'),{'uri':util['format'](_0x85e7('0x4e'),_0x324745['remoteUri'],_0x530655['id'])});}})[_0x85e7('0x4f')](function(_0x42fc88){logger[_0x85e7('0x50')](_0x85e7('0x55'),JSON['stringify'](_0x42fc88));});};exports['unmanaged']=function(_0x2f955,_0x5ea973,_0x19bacb,_0x1a599c,_0x3283ac,_0x261a2b){var _0x31ded6,_0x1dba01;_0x261a2b[_0x85e7('0x1d')]=intUtil[_0x85e7('0x52')](_0x261a2b[_0x85e7('0x1d')]);_0x261a2b[_0x85e7('0x40')]=intUtil['stripTrailingSlash'](_0x261a2b[_0x85e7('0x40')]);if(_0x3283ac&&_0x3283ac[_0x85e7('0x41')]){logger['info']('['+_0x5ea973[_0x85e7('0x58')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5ea973[_0x85e7('0x44')]=util[_0x85e7('0x11')](_0x85e7('0x45'),_0x261a2b[_0x85e7('0x40')],_0x5ea973[_0x85e7('0x46')],md5(_0x5ea973['uniqueid']));}else{_0x5ea973[_0x85e7('0x44')]='';}headers['Authorization']=getAuth(_0x261a2b);return getUser(_0x261a2b,'')[_0x85e7('0x1f')](function(_0x3c7f79){_0x31ded6=_0x3c7f79;logger[_0x85e7('0xe')](_0x85e7('0x49'),_0x31ded6['id']);return getEndUser(_0x261a2b,_0x5ea973[_0x85e7('0x4a')],_0x5ea973[_0x85e7('0x13')]);})[_0x85e7('0x1f')](function(_0x2cb007){_0x1dba01=_0x2cb007;logger[_0x85e7('0xe')](_0x85e7('0x4b'),_0x1dba01['id']);return getTicket(_0x261a2b,_0x31ded6,_0x1dba01,_0x19bacb,_0x5ea973);})['then'](function(_0x248540){if(_0x248540){logger[_0x85e7('0xe')](_0x85e7('0x20'));logger['info'](_0x85e7('0x57'),_0x248540['id']);}})[_0x85e7('0x4f')](function(_0x3f0744){logger[_0x85e7('0x50')]('['+_0x5ea973[_0x85e7('0x58')][_0x85e7('0x59')]()+']',JSON['stringify'](_0x3f0744));});}; \ 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 1a9ad82..7a56695 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 _0x6ee1=['serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','Getting\x20user\x20with\x20email','userEmail','agentEmail','email','User\x20found:','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','GET','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','POST','/api/tasks','getString','Subjects','adminId','Contact','add','ticketId','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash'];(function(_0x52942a,_0x2880f0){var _0x1e6f9a=function(_0x23d46c){while(--_0x23d46c){_0x52942a['push'](_0x52942a['shift']());}};_0x1e6f9a(++_0x2880f0);}(_0x6ee1,0x6a));var _0x16ee=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x6ee1[_0x1de43c];return _0x296d3e;};'use strict';var _=require(_0x16ee('0x0'));var rp=require('request-promise');var md5=require(_0x16ee('0x1'));var util=require('util');var moment=require(_0x16ee('0x2'));var Promise=require(_0x16ee('0x3'));var Redis=require('ioredis');var intUtil=require(_0x16ee('0x4'));var config=require(_0x16ee('0x5'));var logger=require(_0x16ee('0x6'))(_0x16ee('0x7'));config['redis']=_[_0x16ee('0x8')](config[_0x16ee('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x16ee('0xa'))(new Redis(config[_0x16ee('0x9')]));function getAdminId(_0x264a95,_0x249103,_0x348646,_0x401b58){return new Promise(function(_0x3b9539,_0x196794){var _0x11dc77=![];var _0x5de127={'method':'GET','uri':_0x401b58+'/api/selector/owners','json':!![]};_0x5de127[_0x16ee('0xb')]=_0x348646;logger[_0x16ee('0xc')](_0x16ee('0xd'));return rp(_0x5de127)[_0x16ee('0xe')](function(_0x36404e){if(_0x36404e){var _0x254ac7=_0x36404e[_0x16ee('0xf')];var _0x2a9e8c=null;for(_0x2a9e8c=0x0;_0x2a9e8c<_0x254ac7[_0x16ee('0x10')];_0x2a9e8c++){if(_0x254ac7[_0x2a9e8c]['email']===_0x264a95[_0x16ee('0x11')]){_0x264a95['adminId']=_0x254ac7[_0x2a9e8c]['id'];_0x11dc77=!![];}}if(_0x11dc77){logger['info'](_0x16ee('0x12'),_0x264a95['adminId']);_0x3b9539(_0x264a95);}else{_0x196794({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x196794({'statusCode':0x194,'message':_0x16ee('0x13')});}})[_0x16ee('0x14')](function(_0x2248f0){logger[_0x16ee('0x15')]('['+[_0x249103[_0x16ee('0x16')]()]+']',_0x2248f0[_0x16ee('0x17')]);_0x196794(_0x2248f0);});});}function getUser(_0x540586,_0x1a33ff,_0x5a1773){return function(_0x5340d4){return new Promise(function(_0x4fe443,_0x2822e9){var _0x1b53a3={'method':'GET','uri':_0x5a1773+_0x16ee('0x18'),'json':!![]};_0x1b53a3['headers']=_0x1a33ff;logger[_0x16ee('0xc')](_0x16ee('0x19'));return rp(_0x1b53a3)[_0x16ee('0xe')](function(_0x46ee35){if(_0x46ee35){var _0x572124=_0x46ee35[_0x16ee('0xf')];var _0x20ec3d=![];var _0x2d2bac=null;if(_0x5340d4['agentEmail']!==null){logger[_0x16ee('0xc')](_0x16ee('0x1a'),_0x5340d4['agentEmail']);_0x5340d4[_0x16ee('0x1b')]=_0x5340d4[_0x16ee('0x1c')];for(_0x2d2bac=0x0;_0x2d2bac<_0x572124[_0x16ee('0x10')];_0x2d2bac++){if(_0x572124[_0x2d2bac][_0x16ee('0x1d')]===_0x5340d4[_0x16ee('0x1c')]){_0x20ec3d=!![];_0x5340d4['userId']=_0x572124[_0x2d2bac]['id'];logger[_0x16ee('0xc')](_0x16ee('0x1e'),_0x5340d4[_0x16ee('0x1f')]);}}}if(!_0x20ec3d){logger[_0x16ee('0xc')](_0x16ee('0x20'));_0x5340d4[_0x16ee('0x1b')]=_0x5340d4[_0x16ee('0x11')];_0x5340d4[_0x16ee('0x1f')]=_0x5340d4['adminId'];_0x20ec3d=!![];}if(_0x20ec3d){_0x4fe443(_0x5340d4);}else{_0x2822e9({'statusCode':0x194,'message':_0x16ee('0x13')});}}else{_0x2822e9({'statusCode':0x194,'message':_0x16ee('0x13')});}})['catch'](function(_0x1867e3){logger['error']('['+[_0x540586[_0x16ee('0x16')]()]+']',_0x1867e3['message']);_0x2822e9(_0x1867e3);});});};}function getEndUser(_0x3349a6,_0x93675d,_0x490195){return function(_0x18e037){return new Promise(function(_0x3ed9c0,_0x1b35ab){var _0x81948e=0x0;var _0x3cb3d0={'method':'GET','uri':_0x490195+_0x16ee('0x21'),'json':!![]};_0x3cb3d0['headers']=_0x93675d;logger[_0x16ee('0xc')](_0x16ee('0x22'));return rp(_0x3cb3d0)[_0x16ee('0xe')](function(_0x5296a1){_0x5296a1[_0x16ee('0x23')]['forEach'](function(_0x133632){if(_0x133632[_0x16ee('0x24')]===_0x16ee('0x25')){_0x81948e=_0x133632['id'];}});})[_0x16ee('0xe')](function(){logger[_0x16ee('0xc')]('Getting\x20contact\x20list');var _0x41da1e={'method':_0x16ee('0x26'),'uri':_0x490195+'/api/contacts/view/'+_0x81948e,'json':!![]};_0x41da1e[_0x16ee('0xb')]=_0x93675d;return rp(_0x41da1e);})[_0x16ee('0xe')](function(_0x11340f){logger[_0x16ee('0xc')](_0x16ee('0x27'),_0x18e037[_0x16ee('0x28')]);if(_0x11340f[_0x16ee('0x29')][_0x16ee('0x10')]>0x0){var _0x1f7c1a=_[_0x16ee('0x2a')](_0x11340f[_0x16ee('0x29')],function(_0x30ff89){if(_0x30ff89[_0x16ee('0x2b')]===_0x18e037['contactNumber']||_0x30ff89[_0x16ee('0x2c')]===_0x18e037[_0x16ee('0x28')]){return _0x30ff89;}});if(_0x1f7c1a){_0x18e037[_0x16ee('0x2d')]=_0x1f7c1a['id'];logger['info'](_0x16ee('0x2e'),_0x18e037[_0x16ee('0x2d')]);_0x3ed9c0(_0x18e037);}else{return createEndUser(_0x18e037,_0x3349a6,_0x93675d,_0x490195)[_0x16ee('0xe')](function(_0x39d75e){logger[_0x16ee('0xc')](_0x16ee('0x2f'),_0x18e037[_0x16ee('0x2d')]);_0x3ed9c0(_0x39d75e);});}}else{return createEndUser(_0x18e037,_0x3349a6,_0x93675d,_0x490195)['then'](function(_0x5b8b40){logger[_0x16ee('0xc')](_0x16ee('0x2f'),_0x18e037[_0x16ee('0x2d')]);_0x3ed9c0(_0x5b8b40);});}})[_0x16ee('0x14')](function(_0x3f2abf){throw new Error(_0x3f2abf[_0x16ee('0x17')]);});});};}function createEndUser(_0x4ef34e,_0x36a885,_0x5dfbf2,_0x3b2903){return new Promise(function(_0x2a461f,_0x3624a7){var _0x14b1b6=moment();var _0x539d21={'method':'POST','uri':_0x3b2903+_0x16ee('0x30'),'body':{'contact':{'last_name':_0x4ef34e[_0x16ee('0x28')],'work_number':_0x4ef34e[_0x16ee('0x28')],'mobile_number':_0x4ef34e[_0x16ee('0x28')],'owner_id':_0x4ef34e[_0x16ee('0x1f')],'created_at':_0x14b1b6[_0x16ee('0x31')](_0x16ee('0x32'))}},'json':!![]};_0x539d21[_0x16ee('0xb')]=_0x5dfbf2;logger[_0x16ee('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x539d21)[_0x16ee('0xe')](function(_0x3ec801){_0x4ef34e[_0x16ee('0x2d')]=_0x3ec801[_0x16ee('0x33')]['id'];_0x2a461f(_0x4ef34e);})[_0x16ee('0x14')](function(_0x1e41fb){logger[_0x16ee('0x15')]('['+[_0x36a885[_0x16ee('0x16')]()]+']',_0x1e41fb[_0x16ee('0x17')]);_0x3624a7(_0x1e41fb[_0x16ee('0x17')]);});});}function getTicket(_0xa9d056,_0x371c04,_0x256ed7,_0xf388cb,_0x41021b){return function(_0x42c2a3){logger[_0x16ee('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x2a05d8,_0x4aa515){var _0x47bccf=moment();var _0xf082b9={'method':_0x16ee('0x34'),'uri':_0x256ed7+_0x16ee('0x35'),'body':{'title':intUtil[_0x16ee('0x36')](_0xf388cb[_0x16ee('0x37')],_0x41021b,'\x20'),'description':intUtil['getString'](_0xf388cb['Descriptions'],_0x41021b,'\x0a'),'owner_id':_0x42c2a3['userId'],'creater_id':_0x42c2a3[_0x16ee('0x38')],'targetable_id':_0x42c2a3[_0x16ee('0x2d')],'targetable_type':_0x16ee('0x39'),'created_at':_0x47bccf['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x47bccf[_0x16ee('0x3a')](0x1e,'m')[_0x16ee('0x31')](_0x16ee('0x32'))},'json':!![]};_0xf082b9['headers']=_0x371c04;return rp(_0xf082b9)[_0x16ee('0xe')](function(_0x37369f){_0x42c2a3['ticketId']=_0x37369f['task']['id'];logger['info']('Task\x20created:',_0x42c2a3[_0x16ee('0x3b')]);_0x2a05d8(_0x42c2a3);})[_0x16ee('0x14')](function(_0x4153ba){logger[_0x16ee('0x15')]('['+[_0xa9d056[_0x16ee('0x16')]()]+']',_0x4153ba['message']);_0x4aa515(_0x4153ba[_0x16ee('0x17')]);});});};}function emit(_0x958dd4,_0xd2ac37,_0x493e89){var _0x186bac={'uri':_0x958dd4+_0x16ee('0x3c')+_0x493e89};io['to'](util['format']('user:%s',_0xd2ac37))['emit'](_0x16ee('0x3d'),_0x186bac);}exports['cs']=function(_0x22803d,_0x507cfd,_0x1087ef,_0x56d39f,_0xb03198,_0x21168f,_0x130d86,_0xe766a4){var _0x2eb756={};var _0xee0e67={'Authorization':_0x16ee('0x3e')+_0x21168f[_0x16ee('0x3f')]};_0x21168f[_0x16ee('0x40')]=intUtil[_0x16ee('0x41')](_0x21168f[_0x16ee('0x40')]);_0x21168f['serverUrl']=intUtil[_0x16ee('0x41')](_0x21168f[_0x16ee('0x42')]);var _0x4ed3b0=_0x21168f[_0x16ee('0x40')];_0x2eb756[_0x16ee('0x11')]=_0x21168f['username'];_0x2eb756['contactNumber']=_0xe766a4[_0x16ee('0x43')]()===_0x16ee('0x44')?_0x507cfd[_0x16ee('0x45')]:_0x507cfd[_0x16ee('0x46')];_0x2eb756[_0x16ee('0x47')]=_0xe766a4===_0x16ee('0x48')||_0xe766a4===_0x16ee('0x49')?_0x16ee('0x48'):'outbound';if(_0x56d39f){_0x2eb756[_0x16ee('0x1c')]=_0x56d39f[_0x16ee('0x1d')];}var _0x3df673=util[_0x16ee('0x31')](_0x16ee('0x4a'),_0x21168f['serverUrl'],_0x507cfd[_0x16ee('0x4b')],md5(_0x507cfd['uniqueid']));if(_0xb03198&&_0xb03198[_0x16ee('0x4c')]){logger[_0x16ee('0xc')](_0x16ee('0x4d'),_0x16ee('0x4e'));_0x507cfd[_0x16ee('0x4f')]=_0x3df673;}else if(_0x130d86&&_0x130d86['recordingFormat']&&_0x130d86[_0x16ee('0x50')]!==_0x16ee('0x51')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x507cfd[_0x16ee('0x4f')]=_0x3df673;}else{_0x507cfd[_0x16ee('0x4f')]='';}return getAdminId(_0x2eb756,_0xe766a4,_0xee0e67,_0x4ed3b0)['then'](getUser(_0xe766a4,_0xee0e67,_0x4ed3b0))[_0x16ee('0xe')](getEndUser(_0xe766a4,_0xee0e67,_0x4ed3b0))[_0x16ee('0xe')](getTicket(_0xe766a4,_0xee0e67,_0x4ed3b0,_0x1087ef,_0x507cfd))['then'](function(_0x537a7d){logger[_0x16ee('0xc')](util['format'](_0x16ee('0x52'),_0x537a7d[_0x16ee('0x3b')]));if(_0xe766a4!=='unmanaged'){logger[_0x16ee('0xc')]('['+[_0xe766a4[_0x16ee('0x16')]()]+']',_0x16ee('0x53'));emit(_0x4ed3b0,_0x56d39f['name'],_0x537a7d[_0x16ee('0x2d')]);}})['catch'](function(_0x3ccf12){logger[_0x16ee('0x15')]('['+[_0xe766a4[_0x16ee('0x16')]()]+_0x16ee('0x54'),util[_0x16ee('0x55')](_0x3ccf12,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa6c6=['Contact\x20found:','Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','headers','info','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','endUserId'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xa6c6,0x12e));var _0x6a6c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa6c6[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6a6c('0x0'));var rp=require(_0x6a6c('0x1'));var md5=require(_0x6a6c('0x2'));var util=require(_0x6a6c('0x3'));var moment=require(_0x6a6c('0x4'));var Promise=require(_0x6a6c('0x5'));var Redis=require(_0x6a6c('0x6'));var intUtil=require(_0x6a6c('0x7'));var config=require(_0x6a6c('0x8'));var logger=require(_0x6a6c('0x9'))(_0x6a6c('0xa'));config[_0x6a6c('0xb')]=_['defaults'](config[_0x6a6c('0xb')],{'host':_0x6a6c('0xc'),'port':0x18eb});var io=require(_0x6a6c('0xd'))(new Redis(config['redis']));function getAdminId(_0x282b0c,_0x1e7f00,_0x54a3f0,_0x51acdc){return new Promise(function(_0x891302,_0xbeac5){var _0xb92990=![];var _0x1069a1={'method':'GET','uri':_0x51acdc+'/api/selector/owners','json':!![]};_0x1069a1[_0x6a6c('0xe')]=_0x54a3f0;logger[_0x6a6c('0xf')]('Getting\x20admin\x20information');return rp(_0x1069a1)['then'](function(_0x2956e2){if(_0x2956e2){var _0x37b464=_0x2956e2[_0x6a6c('0x10')];var _0x41b08e=null;for(_0x41b08e=0x0;_0x41b08e<_0x37b464[_0x6a6c('0x11')];_0x41b08e++){if(_0x37b464[_0x41b08e][_0x6a6c('0x12')]===_0x282b0c[_0x6a6c('0x13')]){_0x282b0c[_0x6a6c('0x14')]=_0x37b464[_0x41b08e]['id'];_0xb92990=!![];}}if(_0xb92990){logger[_0x6a6c('0xf')](_0x6a6c('0x15'),_0x282b0c[_0x6a6c('0x14')]);_0x891302(_0x282b0c);}else{_0xbeac5({'statusCode':0x194,'message':_0x6a6c('0x16')});}}else{_0xbeac5({'statusCode':0x194,'message':_0x6a6c('0x16')});}})[_0x6a6c('0x17')](function(_0x4eddb5){logger[_0x6a6c('0x18')]('['+[_0x1e7f00[_0x6a6c('0x19')]()]+']',_0x4eddb5[_0x6a6c('0x1a')]);_0xbeac5(_0x4eddb5);});});}function getUser(_0x55d2c2,_0x1aba56,_0x46841c){return function(_0x271009){return new Promise(function(_0x1720e2,_0x41b93c){var _0x3becc1={'method':_0x6a6c('0x1b'),'uri':_0x46841c+_0x6a6c('0x1c'),'json':!![]};_0x3becc1[_0x6a6c('0xe')]=_0x1aba56;logger[_0x6a6c('0xf')]('Getting\x20user\x20list');return rp(_0x3becc1)[_0x6a6c('0x1d')](function(_0x324f59){if(_0x324f59){var _0x1f2394=_0x324f59[_0x6a6c('0x10')];var _0x51f9c5=![];var _0x192f72=null;if(_0x271009[_0x6a6c('0x1e')]!==null){logger[_0x6a6c('0xf')](_0x6a6c('0x1f'),_0x271009[_0x6a6c('0x1e')]);_0x271009[_0x6a6c('0x20')]=_0x271009[_0x6a6c('0x1e')];for(_0x192f72=0x0;_0x192f72<_0x1f2394[_0x6a6c('0x11')];_0x192f72++){if(_0x1f2394[_0x192f72][_0x6a6c('0x12')]===_0x271009[_0x6a6c('0x1e')]){_0x51f9c5=!![];_0x271009['userId']=_0x1f2394[_0x192f72]['id'];logger[_0x6a6c('0xf')](_0x6a6c('0x21'),_0x271009[_0x6a6c('0x22')]);}}}if(!_0x51f9c5){logger[_0x6a6c('0xf')](_0x6a6c('0x23'));_0x271009[_0x6a6c('0x20')]=_0x271009[_0x6a6c('0x13')];_0x271009['userId']=_0x271009[_0x6a6c('0x14')];_0x51f9c5=!![];}if(_0x51f9c5){_0x1720e2(_0x271009);}else{_0x41b93c({'statusCode':0x194,'message':_0x6a6c('0x16')});}}else{_0x41b93c({'statusCode':0x194,'message':_0x6a6c('0x16')});}})[_0x6a6c('0x17')](function(_0x4a9e2a){logger[_0x6a6c('0x18')]('['+[_0x55d2c2[_0x6a6c('0x19')]()]+']',_0x4a9e2a[_0x6a6c('0x1a')]);_0x41b93c(_0x4a9e2a);});});};}function getEndUser(_0x5e800a,_0x12b08c,_0x5b483a){return function(_0x586302){return new Promise(function(_0x559219,_0xc7ffa4){var _0x437170=0x0;var _0x300e0f={'method':_0x6a6c('0x1b'),'uri':_0x5b483a+_0x6a6c('0x24'),'json':!![]};_0x300e0f[_0x6a6c('0xe')]=_0x12b08c;logger[_0x6a6c('0xf')](_0x6a6c('0x25'));return rp(_0x300e0f)['then'](function(_0x164818){_0x164818[_0x6a6c('0x26')]['forEach'](function(_0x167ff2){if(_0x167ff2[_0x6a6c('0x27')]===_0x6a6c('0x28')){_0x437170=_0x167ff2['id'];}});})[_0x6a6c('0x1d')](function(){logger[_0x6a6c('0xf')](_0x6a6c('0x29'));var _0x4e0120={'method':_0x6a6c('0x1b'),'uri':_0x5b483a+_0x6a6c('0x2a')+_0x437170,'json':!![]};_0x4e0120[_0x6a6c('0xe')]=_0x12b08c;return rp(_0x4e0120);})['then'](function(_0x3b84aa){logger[_0x6a6c('0xf')](_0x6a6c('0x2b'),_0x586302['contactNumber']);if(_0x3b84aa[_0x6a6c('0x2c')][_0x6a6c('0x11')]>0x0){var _0xfc53dc=_[_0x6a6c('0x2d')](_0x3b84aa[_0x6a6c('0x2c')],function(_0x132b8f){if(_0x132b8f[_0x6a6c('0x2e')]===_0x586302[_0x6a6c('0x2f')]||_0x132b8f[_0x6a6c('0x30')]===_0x586302[_0x6a6c('0x2f')]){return _0x132b8f;}});if(_0xfc53dc){_0x586302[_0x6a6c('0x31')]=_0xfc53dc['id'];logger[_0x6a6c('0xf')](_0x6a6c('0x32'),_0x586302['endUserId']);_0x559219(_0x586302);}else{return createEndUser(_0x586302,_0x5e800a,_0x12b08c,_0x5b483a)[_0x6a6c('0x1d')](function(_0x3fc2f8){logger[_0x6a6c('0xf')](_0x6a6c('0x33'),_0x586302[_0x6a6c('0x31')]);_0x559219(_0x3fc2f8);});}}else{return createEndUser(_0x586302,_0x5e800a,_0x12b08c,_0x5b483a)[_0x6a6c('0x1d')](function(_0x507490){logger['info'](_0x6a6c('0x33'),_0x586302[_0x6a6c('0x31')]);_0x559219(_0x507490);});}})[_0x6a6c('0x17')](function(_0x3d4062){throw new Error(_0x3d4062[_0x6a6c('0x1a')]);});});};}function createEndUser(_0x41c583,_0x59d91f,_0x438790,_0x2fb738){return new Promise(function(_0x82f5fe,_0x5578ee){var _0x1bd6f6=moment();var _0x5a7f3a={'method':_0x6a6c('0x34'),'uri':_0x2fb738+_0x6a6c('0x35'),'body':{'contact':{'last_name':_0x41c583[_0x6a6c('0x2f')],'work_number':_0x41c583[_0x6a6c('0x2f')],'mobile_number':_0x41c583[_0x6a6c('0x2f')],'owner_id':_0x41c583[_0x6a6c('0x22')],'created_at':_0x1bd6f6[_0x6a6c('0x36')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5a7f3a['headers']=_0x438790;logger[_0x6a6c('0xf')](_0x6a6c('0x37'));return rp(_0x5a7f3a)[_0x6a6c('0x1d')](function(_0x2cbb5b){_0x41c583[_0x6a6c('0x31')]=_0x2cbb5b[_0x6a6c('0x38')]['id'];_0x82f5fe(_0x41c583);})[_0x6a6c('0x17')](function(_0x5baee1){logger[_0x6a6c('0x18')]('['+[_0x59d91f[_0x6a6c('0x19')]()]+']',_0x5baee1['message']);_0x5578ee(_0x5baee1[_0x6a6c('0x1a')]);});});}function getTicket(_0x4fa94e,_0x39ec56,_0x97e8d5,_0x467235,_0x2a000d){return function(_0x2c71bb){logger[_0x6a6c('0xf')](_0x6a6c('0x39'));return new Promise(function(_0x4a4f7f,_0xb0c40a){var _0x21fdca=moment();var _0x4cb4c4={'method':_0x6a6c('0x34'),'uri':_0x97e8d5+_0x6a6c('0x3a'),'body':{'title':intUtil[_0x6a6c('0x3b')](_0x467235[_0x6a6c('0x3c')],_0x2a000d,'\x20'),'description':intUtil[_0x6a6c('0x3b')](_0x467235[_0x6a6c('0x3d')],_0x2a000d,'\x0a'),'owner_id':_0x2c71bb[_0x6a6c('0x22')],'creater_id':_0x2c71bb['adminId'],'targetable_id':_0x2c71bb[_0x6a6c('0x31')],'targetable_type':'Contact','created_at':_0x21fdca[_0x6a6c('0x36')](_0x6a6c('0x3e')),'due_date':_0x21fdca[_0x6a6c('0x3f')](0x1e,'m')['format'](_0x6a6c('0x3e'))},'json':!![]};_0x4cb4c4[_0x6a6c('0xe')]=_0x39ec56;return rp(_0x4cb4c4)[_0x6a6c('0x1d')](function(_0x8e76fe){_0x2c71bb[_0x6a6c('0x40')]=_0x8e76fe['task']['id'];logger[_0x6a6c('0xf')](_0x6a6c('0x41'),_0x2c71bb['ticketId']);_0x4a4f7f(_0x2c71bb);})['catch'](function(_0x561a19){logger['error']('['+[_0x4fa94e['toUpperCase']()]+']',_0x561a19[_0x6a6c('0x1a')]);_0xb0c40a(_0x561a19[_0x6a6c('0x1a')]);});});};}function emit(_0x1a1d5e,_0x5fa2e2,_0x56296b){var _0x2c9afd={'uri':_0x1a1d5e+_0x6a6c('0x42')+_0x56296b};io['to'](util[_0x6a6c('0x36')](_0x6a6c('0x43'),_0x5fa2e2))[_0x6a6c('0x44')]('trigger:browser:url',_0x2c9afd);}exports['cs']=function(_0x2115e9,_0x31e0dc,_0x385808,_0xd08f7,_0x27087a,_0x3aec7e,_0x15764d,_0x562fee){var _0x278e89={};var _0x39b86a={'Authorization':'Token\x20token='+_0x3aec7e['apiKey']};_0x3aec7e[_0x6a6c('0x45')]=intUtil['stripTrailingSlash'](_0x3aec7e[_0x6a6c('0x45')]);_0x3aec7e['serverUrl']=intUtil[_0x6a6c('0x46')](_0x3aec7e[_0x6a6c('0x47')]);var _0x3a5664=_0x3aec7e[_0x6a6c('0x45')];_0x278e89['adminEmail']=_0x3aec7e[_0x6a6c('0x48')];_0x278e89[_0x6a6c('0x2f')]=_0x562fee[_0x6a6c('0x49')]()===_0x6a6c('0x4a')?_0x31e0dc[_0x6a6c('0x4b')]:_0x31e0dc[_0x6a6c('0x4c')];_0x278e89[_0x6a6c('0x4d')]=_0x562fee==='queue'||_0x562fee==='unmanaged'?_0x6a6c('0x4e'):_0x6a6c('0x4a');if(_0xd08f7){_0x278e89[_0x6a6c('0x1e')]=_0xd08f7[_0x6a6c('0x12')];}var _0x3f1f4f=util[_0x6a6c('0x36')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3aec7e['serverUrl'],_0x31e0dc['uniqueid'],md5(_0x31e0dc[_0x6a6c('0x4f')]));if(_0x27087a&&_0x27087a['monitor_format']){logger[_0x6a6c('0xf')](_0x6a6c('0x50'),_0x6a6c('0x51'));_0x31e0dc['recordingURL']=_0x3f1f4f;}else if(_0x15764d&&_0x15764d[_0x6a6c('0x52')]&&_0x15764d[_0x6a6c('0x52')]!==_0x6a6c('0x53')){logger[_0x6a6c('0xf')]('[OUTBOUND]',_0x6a6c('0x51'));_0x31e0dc[_0x6a6c('0x54')]=_0x3f1f4f;}else{_0x31e0dc[_0x6a6c('0x54')]='';}return getAdminId(_0x278e89,_0x562fee,_0x39b86a,_0x3a5664)[_0x6a6c('0x1d')](getUser(_0x562fee,_0x39b86a,_0x3a5664))[_0x6a6c('0x1d')](getEndUser(_0x562fee,_0x39b86a,_0x3a5664))['then'](getTicket(_0x562fee,_0x39b86a,_0x3a5664,_0x385808,_0x31e0dc))[_0x6a6c('0x1d')](function(_0x5b5653){logger[_0x6a6c('0xf')](util[_0x6a6c('0x36')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5b5653[_0x6a6c('0x40')]));if(_0x562fee!==_0x6a6c('0x55')){logger[_0x6a6c('0xf')]('['+[_0x562fee[_0x6a6c('0x19')]()]+']',_0x6a6c('0x56'));emit(_0x3a5664,_0xd08f7[_0x6a6c('0x27')],_0x5b5653['endUserId']);}})[_0x6a6c('0x17')](function(_0x4d239e){logger[_0x6a6c('0x18')]('['+[_0x562fee['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x6a6c('0x57')](_0x4d239e,{'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 d1e1623..7da2c57 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 _0xb62e=['./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','exec','includes','data1','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','lodash','util','./zendesk'];(function(_0x298699,_0x4394cc){var _0x353c03=function(_0x8aa6b1){while(--_0x8aa6b1){_0x298699['push'](_0x298699['shift']());}};_0x353c03(++_0x4394cc);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var zendesk=require(_0xeb62('0x2'));var salesforce=require(_0xeb62('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xeb62('0x4'));var zoho=require(_0xeb62('0x5'));var desk=require(_0xeb62('0x6'));var vtiger=require(_0xeb62('0x7'));var servicenow=require(_0xeb62('0x8'));var dynamics365=require(_0xeb62('0x9'));var freshsales=require('./freshsales');var integrations=[_0xeb62('0xa'),_0xeb62('0xb'),_0xeb62('0xc'),'freshdesk',_0xeb62('0xd'),_0xeb62('0xe'),_0xeb62('0xf'),_0xeb62('0x10'),'freshsales','servicenow'];exports[_0xeb62('0x11')]=function(_0x40584b,_0x6d5e94,_0xf93c21,_0x2fe923,_0xc91abc,_0x35afc3){if(_0xf93c21){if(_[_0xeb62('0x12')](integrations,_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]())){try{var _0x4a493c=null;var _0x422daf='';var _0xcc11c4=_0xf93c21[_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()];if(_0xcc11c4){var _0x55a629=_0xcc11c4[_0x40584b[_0xeb62('0x15')]];if(_0x55a629){var _0x2fbad2=_[_0xeb62('0x16')](_0x55a629['Configurations'],{'id':parseInt(_0x40584b[_0xeb62('0x17')],0xa)});if(_0x2fbad2){if(_0x2fe923){if(_0xc91abc&&_0x6d5e94[_0xeb62('0x18')]){_0x422daf=_0xeb62('0x18');}else if(_0x6d5e94['routeId']){_0x422daf=_0xeb62('0x19');}else{console[_0xeb62('0x1a')](_0xeb62('0x1b'),_0x6d5e94);}}else{_0x422daf=_0xeb62('0x1c');}switch(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()){case _0xeb62('0xa'):zendesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xb'):salesforce[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xc'):sugarcrm[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0x1d'):freshdesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xd'):zoho[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xe'):desk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xf'):vtiger[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case'freshsales':freshsales['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x1e'):servicenow['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x10'):dynamics365['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;default:console[_0xeb62('0x1a')](_0xeb62('0x1f'));}}else{_0x4a493c=require(_0xeb62('0x20'))(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]());_0x4a493c['error']('[EXEC]',util[_0xeb62('0x21')](_0xeb62('0x22'),_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')](),_0x40584b[_0xeb62('0x17')]));}}else{_0x4a493c=require('../../../../config/logger')(_0x40584b['data1'][_0xeb62('0x14')]());_0x4a493c[_0xeb62('0x23')](_0xeb62('0x24'),util[_0xeb62('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x40584b['data1'][_0xeb62('0x14')](),_0x40584b['data2']));}}else{}}catch(_0x448327){console['error'](_0x448327);}}}}; \ No newline at end of file +var _0x93e9=['EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0x93e9,0xcc));var _0x993e=function(_0x52b52b,_0x3cf1d1){_0x52b52b=_0x52b52b-0x0;var _0x4c5141=_0x93e9[_0x52b52b];return _0x4c5141;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var zendesk=require(_0x993e('0x2'));var salesforce=require(_0x993e('0x3'));var sugarcrm=require(_0x993e('0x4'));var freshdesk=require(_0x993e('0x5'));var zoho=require(_0x993e('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x993e('0x7'));var dynamics365=require(_0x993e('0x8'));var freshsales=require(_0x993e('0x9'));var integrations=[_0x993e('0xa'),_0x993e('0xb'),_0x993e('0xc'),_0x993e('0xd'),_0x993e('0xe'),'desk',_0x993e('0xf'),_0x993e('0x10'),_0x993e('0x11'),_0x993e('0x12')];exports[_0x993e('0x13')]=function(_0x27a28f,_0x1c2324,_0x48291a,_0x196f6d,_0x10cf0e,_0x4fe40b){if(_0x48291a){if(_['includes'](integrations,_0x27a28f[_0x993e('0x14')]['toLowerCase']())){try{var _0x333aa9=null;var _0x5d5c0d='';var _0x4c2707=_0x48291a[_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()];if(_0x4c2707){var _0x156bef=_0x4c2707[_0x27a28f[_0x993e('0x16')]];if(_0x156bef){var _0x3e082b=_[_0x993e('0x17')](_0x156bef[_0x993e('0x18')],{'id':parseInt(_0x27a28f[_0x993e('0x19')],0xa)});if(_0x3e082b){if(_0x196f6d){if(_0x10cf0e&&_0x1c2324[_0x993e('0x1a')]){_0x5d5c0d=_0x993e('0x1a');}else if(_0x1c2324[_0x993e('0x1b')]){_0x5d5c0d=_0x993e('0x1c');}else{console[_0x993e('0x1d')](_0x993e('0x1e'),_0x1c2324);}}else{_0x5d5c0d=_0x993e('0x1f');}switch(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]()){case'zendesk':zendesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xb'):salesforce[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xc'):sugarcrm[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xd'):freshdesk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xe'):zoho[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0x20'):desk[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case _0x993e('0xf'):vtiger[_0x5d5c0d](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b);break;case'freshsales':freshsales['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x12'):servicenow['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;case _0x993e('0x10'):dynamics365['cs'](_0x27a28f,_0x1c2324,_0x3e082b,_0x196f6d,_0x10cf0e,_0x156bef,_0x4fe40b,_0x5d5c0d);break;default:console[_0x993e('0x1d')](_0x993e('0x21'));}}else{_0x333aa9=require(_0x993e('0x22'))(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')]('[EXEC]',util[_0x993e('0x24')]('%s\x20configuration\x20#%s\x20not\x20found',_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x19')]));}}else{_0x333aa9=require('../../../../config/logger')(_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]());_0x333aa9[_0x993e('0x23')](_0x993e('0x25'),util[_0x993e('0x24')](_0x993e('0x26'),_0x27a28f[_0x993e('0x14')][_0x993e('0x15')](),_0x27a28f[_0x993e('0x16')]));}}else{}}catch(_0x18f6ac){console[_0x993e('0x23')](_0x18f6ac);}}}}; \ 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 6d29df1..9bcc468 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 _0xb254=['queue','serverUrl','stripTrailingSlash','[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','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','monitor_format','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','assign','getString','Descriptions','Case','Subjects','ContactId','create','isNil','validateEmail','sobject','User','find','execute','then','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Task','Company','No\x20Company','upperFirst','type','string','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login'];(function(_0x9a570c,_0x3fd28b){var _0x2ab871=function(_0x2d1a5a){while(--_0x2d1a5a){_0x9a570c['push'](_0x9a570c['shift']());}};_0x2ab871(++_0x3fd28b);}(_0xb254,0x1e4));var _0x4b25=function(_0x374ff0,_0x542ff8){_0x374ff0=_0x374ff0-0x0;var _0x186a98=_0xb254[_0x374ff0];return _0x186a98;};'use strict';var _=require(_0x4b25('0x0'));var rp=require(_0x4b25('0x1'));var moment=require(_0x4b25('0x2'));var BPromise=require(_0x4b25('0x3'));var md5=require(_0x4b25('0x4'));var jsforce=require(_0x4b25('0x5'));var util=require('util');var Redis=require(_0x4b25('0x6'));var intUtil=require(_0x4b25('0x7'));var config=require(_0x4b25('0x8'));var logger=require(_0x4b25('0x9'))(_0x4b25('0xa'));config[_0x4b25('0xb')]=_[_0x4b25('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4b25('0xd'))(new Redis(config['redis']));function emit(_0x514dad,_0x2ec250,_0x294544){io['to'](_0x514dad)[_0x4b25('0xe')](_0x2ec250,_0x294544);}function getTicket(_0x2b9cd3,_0x33ee32,_0x45e781,_0x4fa88c,_0x424413,_0x5b84d1,_0x16c202,_0x2ab777){var _0x390182={};if(_0x4fa88c[_0x4b25('0xf')]==='Task'){_0x390182=Object[_0x4b25('0x10')]({},{'OwnerId':_0x33ee32['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4b25('0x11')](_0x4fa88c['Subjects'],_0x424413,'\x20'),'Description':intUtil[_0x4b25('0x11')](_0x4fa88c[_0x4b25('0x12')],_0x424413,'\x0a')},getCustomFields(_0x5b84d1,_0x424413));if(_0x45e781){_0x390182['WhoId']=_0x45e781['id'];}}else if(_0x4fa88c[_0x4b25('0xf')]===_0x4b25('0x13')){_0x390182=Object[_0x4b25('0x10')]({},{'OwnerId':_0x33ee32['id'],'Subject':intUtil[_0x4b25('0x11')](_0x4fa88c[_0x4b25('0x14')],_0x424413,'\x20'),'Description':intUtil['getString'](_0x4fa88c[_0x4b25('0x12')],_0x424413,'\x0a')},getCustomFields(_0x5b84d1,_0x424413));if(_0x45e781){_0x390182[_0x4b25('0x15')]=_0x45e781['id'];}}return _0x16c202['sobject'](_0x4fa88c[_0x4b25('0xf')])[_0x4b25('0x16')](_0x390182);}function getUser(_0x258433,_0x4bd349,_0x48e262){if(!_[_0x4b25('0x17')](_0x4bd349)&&intUtil[_0x4b25('0x18')](_0x4bd349)){var _0x1dfd92={'Email':_0x4bd349};var _0x53a5fa={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x48e262[_0x4b25('0x19')](_0x4b25('0x1a'))[_0x4b25('0x1b')](_0x1dfd92,_0x53a5fa)[_0x4b25('0x1c')]()[_0x4b25('0x1d')](function(_0x3d32ae){if(_0x3d32ae['length']){var _0x14152e=_[_0x4b25('0x1b')](_0x3d32ae,function(_0x446acf){return _0x446acf['Email']===_0x4bd349;});if(_0x14152e){logger[_0x4b25('0x1e')](_0x4b25('0x1f'),_0x4bd349);return BPromise[_0x4b25('0x20')]({'id':_0x14152e['Id'],'name':_0x14152e[_0x4b25('0x21')]});}}else{logger['info'](_0x4b25('0x22'),_0x4bd349);return _0x48e262[_0x4b25('0x23')]()[_0x4b25('0x1d')](function(_0x2d4baf){return BPromise[_0x4b25('0x20')]({'id':_0x2d4baf[_0x4b25('0x24')],'name':_0x2d4baf['display_name']});});}});}else{logger[_0x4b25('0x1e')](_0x4b25('0x22'),_0x4bd349);return _0x48e262['identity']()['then'](function(_0x262053){return BPromise[_0x4b25('0x20')]({'id':_0x262053[_0x4b25('0x24')],'name':_0x262053[_0x4b25('0x25')]});});}}function getEndUser(_0x513c2b,_0x5937c9,_0x341ec4,_0x111058,_0x31c937){var _0x53d0db={'Phone':_0x111058};var _0x54ab52={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4b25('0x20')]()[_0x4b25('0x1d')](function(){if(_0x5937c9[_0x4b25('0xf')]==='Task'){logger[_0x4b25('0x1e')](_0x4b25('0x26'),_0x111058,_0x5937c9[_0x4b25('0x27')]);switch(_0x5937c9[_0x4b25('0x27')]){case _0x4b25('0x28'):return _0x31c937[_0x4b25('0x19')](_0x4b25('0x29'))[_0x4b25('0x1b')](_0x53d0db,_0x54ab52)[_0x4b25('0x1c')]()[_0x4b25('0x1d')](function(_0x134cb7){if(_0x134cb7&&_0x134cb7[_0x4b25('0x2a')]){return _0x134cb7;}else{return _0x31c937[_0x4b25('0x19')](_0x4b25('0x2b'))[_0x4b25('0x1b')](_0x53d0db,_0x54ab52);}});case'contact':return _0x31c937['sobject']('Contact')[_0x4b25('0x1b')](_0x53d0db,_0x54ab52)[_0x4b25('0x1c')]();case _0x4b25('0x2c'):return _0x31c937['sobject'](_0x4b25('0x2b'))['find'](_0x53d0db,_0x54ab52);default:return null;}}else if(_0x5937c9[_0x4b25('0xf')]===_0x4b25('0x13')){logger[_0x4b25('0x1e')](_0x4b25('0x26'),_0x111058,_0x4b25('0x2d'));return _0x31c937[_0x4b25('0x19')]('Contact')['find'](_0x53d0db,_0x54ab52)[_0x4b25('0x1c')]();}})[_0x4b25('0x1d')](function(_0x218923){if(_0x218923&&_0x218923[_0x4b25('0x2a')]){var _0x3e073f=_[_0x4b25('0x1b')](_0x218923,function(_0x148c8b){return _0x148c8b[_0x4b25('0x2e')]===_0x111058;});if(_0x3e073f){return BPromise['resolve']({'id':_0x3e073f['Id'],'name':_0x3e073f[_0x4b25('0x21')],'phone':_0x3e073f['Phone']});}}})[_0x4b25('0x1d')](function(_0x19aa8f){if(_0x19aa8f){logger[_0x4b25('0x1e')](_0x4b25('0x2f'),_0x111058);return BPromise['resolve'](_0x19aa8f);}else{logger['info'](_0x4b25('0x30'),_0x111058);var _0x7588a8={'LastName':_0x341ec4!==_0x4b25('0x31')?_0x341ec4:util[_0x4b25('0x32')](_0x4b25('0x33'),_0x111058),'Phone':_0x111058};if(_0x5937c9[_0x4b25('0x34')]){if(_0x5937c9['moduleCreate']==='contact'){logger[_0x4b25('0x1e')](_0x4b25('0x35'),_0x111058,_0x5937c9[_0x4b25('0x34')]);}else if(_0x5937c9['moduleCreate']==='lead'&&_0x5937c9[_0x4b25('0xf')]===_0x4b25('0x36')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x111058,_0x5937c9['moduleCreate']);_0x7588a8[_0x4b25('0x37')]=_0x4b25('0x38');}else{return null;}}return _0x31c937['sobject'](_[_0x4b25('0x39')](_0x5937c9[_0x4b25('0x34')]))[_0x4b25('0x16')](_0x7588a8);}});}function getCustomFields(_0x41845e,_0x12f700){var _0x2ca4f7={};if(_0x41845e[_0x4b25('0x2a')]>0x0){_['forEach'](_0x41845e,function(_0x574bfc){if(_0x574bfc[_0x4b25('0x3a')]===_0x4b25('0x3b')&&_0x574bfc[_0x4b25('0x3c')]){_0x2ca4f7[_0x574bfc['idField']]=_0x574bfc['content']['toString']();}else if(_0x574bfc[_0x4b25('0x3a')]===_0x4b25('0x3d')&&_0x574bfc[_0x4b25('0x3e')]&&_0x574bfc[_0x4b25('0x3c')]){_0x12f700[_0x574bfc[_0x4b25('0x3e')]]&&(_0x2ca4f7[_0x574bfc[_0x4b25('0x3c')]]=_0x12f700[_0x574bfc[_0x4b25('0x3e')]][_0x4b25('0x3f')]());}else if(_0x574bfc[_0x4b25('0x3a')]===_0x4b25('0x40')&&_0x574bfc[_0x4b25('0x41')]&&_0x574bfc['Variable'][_0x4b25('0x42')]&&_0x574bfc[_0x4b25('0x3c')]){_0x12f700[_0x574bfc[_0x4b25('0x41')]['name']['toLowerCase']()]&&(_0x2ca4f7[_0x574bfc[_0x4b25('0x3c')]]=_0x12f700[_0x574bfc[_0x4b25('0x41')]['name'][_0x4b25('0x43')]()][_0x4b25('0x3f')]());}});}return _0x2ca4f7;}function getConnection(_0x31c1e2){var _0x576a48=_0x31c1e2[_0x4b25('0x44')][_0x4b25('0x45')](_0x31c1e2[_0x4b25('0x46')]);var _0x25ffc8=new jsforce[(_0x4b25('0x47'))]({'oauth2':{'loginUrl':_0x31c1e2[_0x4b25('0x48')]||'https://login.salesforce.com','clientId':_0x31c1e2[_0x4b25('0x49')],'clientSecret':_0x31c1e2[_0x4b25('0x4a')]}});return _0x25ffc8[_0x4b25('0x4b')](_0x31c1e2['username'],_0x576a48)[_0x4b25('0x1d')](function(){logger[_0x4b25('0x1e')]('Connection\x20established.');return _0x25ffc8;});}exports[_0x4b25('0x4c')]=function(_0x1e49ad,_0x3bfdfc,_0xb35662,_0x44e966,_0x3260bc,_0x3da1b9){var _0x42a7ff,_0x311eb9,_0x9c8ce8,_0x210748;_0x3da1b9[_0x4b25('0x4d')]=intUtil['stripTrailingSlash'](_0x3da1b9['serverUrl']);_0x3da1b9[_0x4b25('0x48')]=intUtil[_0x4b25('0x4e')](_0x3da1b9['remoteUri']);if(_0x3260bc&&_0x3260bc['monitor_format']){logger[_0x4b25('0x1e')](_0x4b25('0x4f'),_0x4b25('0x50'));_0x3bfdfc[_0x4b25('0x51')]=util[_0x4b25('0x32')](_0x4b25('0x52'),_0x3da1b9[_0x4b25('0x4d')],_0x3bfdfc[_0x4b25('0x53')],md5(_0x3bfdfc['uniqueid']));}else{_0x3bfdfc[_0x4b25('0x51')]='';}return getConnection(_0x3da1b9)['then'](function(_0x55d64a){_0x210748=_0x55d64a;return getUser(_0x3da1b9,_0x44e966[_0x4b25('0x54')],_0x210748);})[_0x4b25('0x1d')](function(_0x29ca6f){_0x42a7ff=_0x29ca6f;return getEndUser(_0x3da1b9,_0xb35662,_0x3bfdfc[_0x4b25('0x55')],_0x3bfdfc[_0x4b25('0x56')],_0x210748);})[_0x4b25('0x1d')](function(_0x1ceedb){_0x311eb9=_0x1ceedb;return getTicket(_0x3da1b9,_0x42a7ff,_0x311eb9,_0xb35662,_0x3bfdfc,_0xb35662[_0x4b25('0x57')],_0x210748,'queue');})[_0x4b25('0x1d')](function(_0x360747){_0x9c8ce8=_0x360747;logger[_0x4b25('0x1e')](_0x4b25('0x58'),_0x9c8ce8['id']);logger[_0x4b25('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x9c8ce8['id'],_0x44e966[_0x4b25('0x42')],_0x3da1b9[_0x4b25('0x3a')]);switch(_0x3da1b9[_0x4b25('0x3a')]){case _0x4b25('0x59'):emit(util[_0x4b25('0x32')](_0x4b25('0x5a'),_0x44e966[_0x4b25('0x42')]),_0x4b25('0x5b'),{'recordId':_0x9c8ce8['id']});break;case _0x4b25('0x5c'):emit(util[_0x4b25('0x32')](_0x4b25('0x5a'),_0x44e966[_0x4b25('0x42')]),_0x4b25('0x5d'),{'uri':util[_0x4b25('0x32')](_0x4b25('0x5e'),_0x210748['instanceUrl'],_0x9c8ce8['id'])});break;default:logger['error'](_0x4b25('0x5f'));}})[_0x4b25('0x60')](function(_0x219da3){logger[_0x4b25('0x61')](_0x4b25('0x4f'),JSON['stringify'](_0x219da3));});};exports[_0x4b25('0x62')]=function(_0x1a6f18,_0x3c1c0c,_0x51b98e,_0x431358,_0x378322,_0x5d61b8,_0xa5ba53){var _0x253e03,_0x52bc88,_0x417327,_0x47ae61;_0x5d61b8[_0x4b25('0x4d')]=intUtil['stripTrailingSlash'](_0x5d61b8[_0x4b25('0x4d')]);_0x5d61b8[_0x4b25('0x48')]=intUtil[_0x4b25('0x4e')](_0x5d61b8[_0x4b25('0x48')]);if(_0xa5ba53&&_0xa5ba53[_0x4b25('0x63')]&&_0xa5ba53[_0x4b25('0x63')]!==_0x4b25('0x64')){logger['info'](_0x4b25('0x65'),_0x4b25('0x50'));_0x3c1c0c[_0x4b25('0x51')]=util['format'](_0x4b25('0x52'),_0x5d61b8['serverUrl'],_0x3c1c0c[_0x4b25('0x53')],md5(_0x3c1c0c[_0x4b25('0x53')]));}return getConnection(_0x5d61b8)[_0x4b25('0x1d')](function(_0x2043e7){_0x47ae61=_0x2043e7;return getUser(_0x5d61b8,_0x431358['email'],_0x47ae61);})['then'](function(_0x5f4abd){_0x253e03=_0x5f4abd;return getEndUser(_0x5d61b8,_0x51b98e,_0x3c1c0c['destcalleridname'],_0x3c1c0c['destcalleridnum'],_0x47ae61);})[_0x4b25('0x1d')](function(_0x462233){_0x52bc88=_0x462233;return getTicket(_0x5d61b8,_0x253e03,_0x52bc88,_0x51b98e,_0x3c1c0c,_0x51b98e[_0x4b25('0x57')],_0x47ae61,_0x4b25('0x62'));})['then'](function(_0x1a861b){_0x417327=_0x1a861b;logger[_0x4b25('0x1e')](_0x4b25('0x66'),_0x417327['id']);logger[_0x4b25('0x1e')](_0x4b25('0x67'),_0x417327['id'],_0x431358[_0x4b25('0x42')],_0x5d61b8['type']);switch(_0x5d61b8[_0x4b25('0x3a')]){case'integrationTab':emit(util[_0x4b25('0x32')](_0x4b25('0x5a'),_0x431358['name']),_0x4b25('0x5b'),{'recordId':_0x417327['id']});break;case _0x4b25('0x5c'):emit(util[_0x4b25('0x32')](_0x4b25('0x5a'),_0x431358[_0x4b25('0x42')]),'trigger:browser:url',{'uri':util['format'](_0x4b25('0x5e'),_0x47ae61['instanceUrl'],_0x417327['id'])});break;default:logger[_0x4b25('0x61')]('[OUTBOUND]',_0x4b25('0x68'));}})[_0x4b25('0x60')](function(_0x194cb6){logger[_0x4b25('0x61')](_0x4b25('0x65'),JSON[_0x4b25('0x69')](_0x194cb6));});};exports[_0x4b25('0x6a')]=function(_0x27d771,_0x1bdf54,_0x511467,_0x5107a1,_0x590fcb,_0x2dea2e){var _0x1fdefc,_0x22e01b,_0x11b775,_0x4d7e79;_0x2dea2e['serverUrl']=intUtil[_0x4b25('0x4e')](_0x2dea2e[_0x4b25('0x4d')]);_0x2dea2e['remoteUri']=intUtil['stripTrailingSlash'](_0x2dea2e[_0x4b25('0x48')]);if(_0x590fcb&&_0x590fcb[_0x4b25('0x6b')]){logger[_0x4b25('0x1e')]('['+_0x1bdf54['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1bdf54[_0x4b25('0x51')]=util[_0x4b25('0x32')](_0x4b25('0x52'),_0x2dea2e[_0x4b25('0x4d')],_0x1bdf54[_0x4b25('0x53')],md5(_0x1bdf54[_0x4b25('0x53')]));}else{_0x1bdf54['recordingURL']='';}return getConnection(_0x2dea2e)['then'](function(_0x41110c){_0x4d7e79=_0x41110c;if(!_[_0x4b25('0x17')](_0x5107a1)){return getUser(_0x2dea2e,_0x5107a1['name'],_0x4d7e79);}else{return getUser(_0x2dea2e,null,_0x4d7e79);}})[_0x4b25('0x1d')](function(_0x5d8931){_0x1fdefc=_0x5d8931;return getEndUser(_0x2dea2e,_0x511467,_0x1bdf54[_0x4b25('0x55')],_0x1bdf54[_0x4b25('0x56')],_0x4d7e79);})[_0x4b25('0x1d')](function(_0x1c4061){_0x22e01b=_0x1c4061;return getTicket(_0x2dea2e,_0x1fdefc,_0x22e01b,_0x511467,_0x1bdf54,_0x511467[_0x4b25('0x57')],_0x4d7e79);})['then'](function(_0x361174){_0x11b775=_0x361174;logger['info']('['+_0x1bdf54['lastevent'][_0x4b25('0x6c')]()+_0x4b25('0x6d'),_0x11b775['id']);logger[_0x4b25('0x1e')]('['+_0x1bdf54[_0x4b25('0x6e')][_0x4b25('0x6c')]()+_0x4b25('0x6f'),_0x2dea2e[_0x4b25('0x3a')]);})[_0x4b25('0x60')](function(_0x1d50b2){logger[_0x4b25('0x61')]('['+_0x1bdf54[_0x4b25('0x6e')][_0x4b25('0x6c')]()+']',JSON[_0x4b25('0x69')](_0x1d50b2));});}; \ No newline at end of file +var _0xd614=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','stringify','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','ticketType','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','moduleCreate','lead','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientSecret','login','username','queue','serverUrl'];(function(_0xdadb04,_0x19ebe8){var _0x3a4724=function(_0x21ec42){while(--_0x21ec42){_0xdadb04['push'](_0xdadb04['shift']());}};_0x3a4724(++_0x19ebe8);}(_0xd614,0x94));var _0x4d61=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd614[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4d61('0x0'));var rp=require('request-promise');var moment=require(_0x4d61('0x1'));var BPromise=require('bluebird');var md5=require(_0x4d61('0x2'));var jsforce=require(_0x4d61('0x3'));var util=require(_0x4d61('0x4'));var Redis=require(_0x4d61('0x5'));var intUtil=require('./util');var config=require(_0x4d61('0x6'));var logger=require(_0x4d61('0x7'))(_0x4d61('0x8'));config[_0x4d61('0x9')]=_['defaults'](config[_0x4d61('0x9')],{'host':_0x4d61('0xa'),'port':0x18eb});var io=require(_0x4d61('0xb'))(new Redis(config[_0x4d61('0x9')]));function emit(_0x501d7c,_0x215fc0,_0x3b78f8){io['to'](_0x501d7c)['emit'](_0x215fc0,_0x3b78f8);}function getTicket(_0x95d61d,_0x5abc6c,_0x1fbad3,_0x5b7ebe,_0x554427,_0x3a200a,_0x332afa,_0x13de5f){var _0x5a6fda={};if(_0x5b7ebe[_0x4d61('0xc')]==='Task'){_0x5a6fda=Object[_0x4d61('0xd')]({},{'OwnerId':_0x5abc6c['id'],'ActivityDate':moment[_0x4d61('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4d61('0xf')](_0x5b7ebe[_0x4d61('0x10')],_0x554427,'\x20'),'Description':intUtil['getString'](_0x5b7ebe[_0x4d61('0x11')],_0x554427,'\x0a')},getCustomFields(_0x3a200a,_0x554427));if(_0x1fbad3){_0x5a6fda[_0x4d61('0x12')]=_0x1fbad3['id'];}}else if(_0x5b7ebe['ticketType']===_0x4d61('0x13')){_0x5a6fda=Object[_0x4d61('0xd')]({},{'OwnerId':_0x5abc6c['id'],'Subject':intUtil[_0x4d61('0xf')](_0x5b7ebe[_0x4d61('0x10')],_0x554427,'\x20'),'Description':intUtil[_0x4d61('0xf')](_0x5b7ebe['Descriptions'],_0x554427,'\x0a')},getCustomFields(_0x3a200a,_0x554427));if(_0x1fbad3){_0x5a6fda[_0x4d61('0x14')]=_0x1fbad3['id'];}}return _0x332afa[_0x4d61('0x15')](_0x5b7ebe[_0x4d61('0xc')])[_0x4d61('0x16')](_0x5a6fda);}function getUser(_0x9cab8a,_0x888620,_0x4d04ff){if(!_[_0x4d61('0x17')](_0x888620)&&intUtil[_0x4d61('0x18')](_0x888620)){var _0x4f5b0a={'Email':_0x888620};var _0x3a89b7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4d04ff['sobject'](_0x4d61('0x19'))[_0x4d61('0x1a')](_0x4f5b0a,_0x3a89b7)[_0x4d61('0x1b')]()[_0x4d61('0x1c')](function(_0x2ab767){if(_0x2ab767[_0x4d61('0x1d')]){var _0x4e7372=_[_0x4d61('0x1a')](_0x2ab767,function(_0x326cb2){return _0x326cb2[_0x4d61('0x1e')]===_0x888620;});if(_0x4e7372){logger[_0x4d61('0x1f')]('Agent\x20%s\x20found.',_0x888620);return BPromise[_0x4d61('0x20')]({'id':_0x4e7372['Id'],'name':_0x4e7372[_0x4d61('0x21')]});}}else{logger[_0x4d61('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x888620);return _0x4d04ff[_0x4d61('0x22')]()['then'](function(_0x120625){return BPromise[_0x4d61('0x20')]({'id':_0x120625[_0x4d61('0x23')],'name':_0x120625['display_name']});});}});}else{logger[_0x4d61('0x1f')](_0x4d61('0x24'),_0x888620);return _0x4d04ff[_0x4d61('0x22')]()[_0x4d61('0x1c')](function(_0x12deca){return BPromise[_0x4d61('0x20')]({'id':_0x12deca[_0x4d61('0x23')],'name':_0x12deca[_0x4d61('0x25')]});});}}function getEndUser(_0x5e1f99,_0x12dc35,_0xdba0a9,_0x30f975,_0x2ba6f1){var _0x4d779d={'Phone':_0x30f975};var _0x24c1d7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4d61('0x20')]()[_0x4d61('0x1c')](function(){if(_0x12dc35[_0x4d61('0xc')]===_0x4d61('0x26')){logger[_0x4d61('0x1f')](_0x4d61('0x27'),_0x30f975,_0x12dc35[_0x4d61('0x28')]);switch(_0x12dc35[_0x4d61('0x28')]){case _0x4d61('0x29'):return _0x2ba6f1['sobject'](_0x4d61('0x2a'))[_0x4d61('0x1a')](_0x4d779d,_0x24c1d7)[_0x4d61('0x1b')]()[_0x4d61('0x1c')](function(_0x4da020){if(_0x4da020&&_0x4da020[_0x4d61('0x1d')]){return _0x4da020;}else{return _0x2ba6f1['sobject'](_0x4d61('0x2b'))[_0x4d61('0x1a')](_0x4d779d,_0x24c1d7);}});case _0x4d61('0x2c'):return _0x2ba6f1[_0x4d61('0x15')](_0x4d61('0x2a'))[_0x4d61('0x1a')](_0x4d779d,_0x24c1d7)[_0x4d61('0x1b')]();case'lead':return _0x2ba6f1['sobject'](_0x4d61('0x2b'))[_0x4d61('0x1a')](_0x4d779d,_0x24c1d7);default:return null;}}else if(_0x12dc35[_0x4d61('0xc')]===_0x4d61('0x13')){logger[_0x4d61('0x1f')](_0x4d61('0x27'),_0x30f975,_0x4d61('0x2c'));return _0x2ba6f1[_0x4d61('0x15')](_0x4d61('0x2a'))[_0x4d61('0x1a')](_0x4d779d,_0x24c1d7)[_0x4d61('0x1b')]();}})[_0x4d61('0x1c')](function(_0x533d9b){if(_0x533d9b&&_0x533d9b['length']){var _0x13a2aa=_[_0x4d61('0x1a')](_0x533d9b,function(_0x9b6c88){return _0x9b6c88[_0x4d61('0x2d')]===_0x30f975;});if(_0x13a2aa){return BPromise[_0x4d61('0x20')]({'id':_0x13a2aa['Id'],'name':_0x13a2aa[_0x4d61('0x21')],'phone':_0x13a2aa[_0x4d61('0x2d')]});}}})['then'](function(_0x148635){if(_0x148635){logger[_0x4d61('0x1f')](_0x4d61('0x2e'),_0x30f975);return BPromise['resolve'](_0x148635);}else{logger[_0x4d61('0x1f')](_0x4d61('0x2f'),_0x30f975);var _0x33c909={'LastName':_0xdba0a9!==_0x4d61('0x30')?_0xdba0a9:util['format']('Caller\x20-\x20%s',_0x30f975),'Phone':_0x30f975};if(_0x12dc35[_0x4d61('0x31')]){if(_0x12dc35[_0x4d61('0x31')]===_0x4d61('0x2c')){logger[_0x4d61('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x30f975,_0x12dc35['moduleCreate']);}else if(_0x12dc35[_0x4d61('0x31')]===_0x4d61('0x32')&&_0x12dc35[_0x4d61('0xc')]===_0x4d61('0x26')){logger[_0x4d61('0x1f')](_0x4d61('0x33'),_0x30f975,_0x12dc35[_0x4d61('0x31')]);_0x33c909[_0x4d61('0x34')]=_0x4d61('0x35');}else{return null;}}return _0x2ba6f1[_0x4d61('0x15')](_[_0x4d61('0x36')](_0x12dc35[_0x4d61('0x31')]))[_0x4d61('0x16')](_0x33c909);}});}function getCustomFields(_0x9081c0,_0x208022){var _0x5288e0={};if(_0x9081c0['length']>0x0){_['forEach'](_0x9081c0,function(_0x4e340b){if(_0x4e340b[_0x4d61('0x37')]===_0x4d61('0x38')&&_0x4e340b[_0x4d61('0x39')]){_0x5288e0[_0x4e340b[_0x4d61('0x39')]]=_0x4e340b[_0x4d61('0x3a')][_0x4d61('0x3b')]();}else if(_0x4e340b['type']===_0x4d61('0x3c')&&_0x4e340b[_0x4d61('0x3d')]&&_0x4e340b[_0x4d61('0x39')]){_0x208022[_0x4e340b[_0x4d61('0x3d')]]&&(_0x5288e0[_0x4e340b[_0x4d61('0x39')]]=_0x208022[_0x4e340b[_0x4d61('0x3d')]]['toString']());}else if(_0x4e340b['type']===_0x4d61('0x3e')&&_0x4e340b[_0x4d61('0x3f')]&&_0x4e340b[_0x4d61('0x3f')][_0x4d61('0x40')]&&_0x4e340b['idField']){_0x208022[_0x4e340b[_0x4d61('0x3f')][_0x4d61('0x40')][_0x4d61('0x41')]()]&&(_0x5288e0[_0x4e340b[_0x4d61('0x39')]]=_0x208022[_0x4e340b[_0x4d61('0x3f')]['name'][_0x4d61('0x41')]()]['toString']());}});}return _0x5288e0;}function getConnection(_0x1ce832){var _0x3927f1=_0x1ce832[_0x4d61('0x42')][_0x4d61('0x43')](_0x1ce832[_0x4d61('0x44')]);var _0x4290f3=new jsforce[(_0x4d61('0x45'))]({'oauth2':{'loginUrl':_0x1ce832[_0x4d61('0x46')]||'https://login.salesforce.com','clientId':_0x1ce832['clientId'],'clientSecret':_0x1ce832[_0x4d61('0x47')]}});return _0x4290f3[_0x4d61('0x48')](_0x1ce832[_0x4d61('0x49')],_0x3927f1)[_0x4d61('0x1c')](function(){logger['info']('Connection\x20established.');return _0x4290f3;});}exports[_0x4d61('0x4a')]=function(_0x2649f1,_0x54ebf5,_0x5077ea,_0x42285c,_0x34c3b9,_0x58d956){var _0x54bd80,_0x2331ba,_0x5993f4,_0x4a5744;_0x58d956[_0x4d61('0x4b')]=intUtil['stripTrailingSlash'](_0x58d956['serverUrl']);_0x58d956[_0x4d61('0x46')]=intUtil['stripTrailingSlash'](_0x58d956[_0x4d61('0x46')]);if(_0x34c3b9&&_0x34c3b9['monitor_format']){logger[_0x4d61('0x1f')](_0x4d61('0x4c'),_0x4d61('0x4d'));_0x54ebf5[_0x4d61('0x4e')]=util[_0x4d61('0x4f')](_0x4d61('0x50'),_0x58d956['serverUrl'],_0x54ebf5[_0x4d61('0x51')],md5(_0x54ebf5[_0x4d61('0x51')]));}else{_0x54ebf5[_0x4d61('0x4e')]='';}return getConnection(_0x58d956)['then'](function(_0x439a21){_0x4a5744=_0x439a21;return getUser(_0x58d956,_0x42285c[_0x4d61('0x52')],_0x4a5744);})[_0x4d61('0x1c')](function(_0x414b95){_0x54bd80=_0x414b95;return getEndUser(_0x58d956,_0x5077ea,_0x54ebf5[_0x4d61('0x53')],_0x54ebf5[_0x4d61('0x54')],_0x4a5744);})[_0x4d61('0x1c')](function(_0xb863cd){_0x2331ba=_0xb863cd;return getTicket(_0x58d956,_0x54bd80,_0x2331ba,_0x5077ea,_0x54ebf5,_0x5077ea[_0x4d61('0x55')],_0x4a5744,_0x4d61('0x4a'));})[_0x4d61('0x1c')](function(_0x314915){_0x5993f4=_0x314915;logger[_0x4d61('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5993f4['id']);logger['info'](_0x4d61('0x56'),_0x5993f4['id'],_0x42285c['name'],_0x58d956[_0x4d61('0x37')]);switch(_0x58d956[_0x4d61('0x37')]){case _0x4d61('0x57'):emit(util['format'](_0x4d61('0x58'),_0x42285c[_0x4d61('0x40')]),_0x4d61('0x59'),{'recordId':_0x5993f4['id']});break;case _0x4d61('0x5a'):emit(util[_0x4d61('0x4f')]('user:%s',_0x42285c[_0x4d61('0x40')]),_0x4d61('0x5b'),{'uri':util[_0x4d61('0x4f')](_0x4d61('0x5c'),_0x4a5744[_0x4d61('0x5d')],_0x5993f4['id'])});break;default:logger[_0x4d61('0x5e')](_0x4d61('0x5f'));}})[_0x4d61('0x60')](function(_0x24bf8d){logger['error'](_0x4d61('0x4c'),JSON['stringify'](_0x24bf8d));});};exports[_0x4d61('0x61')]=function(_0x3a80bb,_0x52aeb8,_0x3a1467,_0x4e84dd,_0x21a758,_0x169e9d,_0x5d6397){var _0x3af6d0,_0x2722f8,_0x5380e1,_0x59d286;_0x169e9d[_0x4d61('0x4b')]=intUtil[_0x4d61('0x62')](_0x169e9d[_0x4d61('0x4b')]);_0x169e9d[_0x4d61('0x46')]=intUtil[_0x4d61('0x62')](_0x169e9d[_0x4d61('0x46')]);if(_0x5d6397&&_0x5d6397['recordingFormat']&&_0x5d6397[_0x4d61('0x63')]!==_0x4d61('0x64')){logger[_0x4d61('0x1f')](_0x4d61('0x65'),_0x4d61('0x4d'));_0x52aeb8[_0x4d61('0x4e')]=util['format'](_0x4d61('0x50'),_0x169e9d[_0x4d61('0x4b')],_0x52aeb8[_0x4d61('0x51')],md5(_0x52aeb8[_0x4d61('0x51')]));}return getConnection(_0x169e9d)['then'](function(_0x518e27){_0x59d286=_0x518e27;return getUser(_0x169e9d,_0x4e84dd[_0x4d61('0x52')],_0x59d286);})['then'](function(_0x4888d7){_0x3af6d0=_0x4888d7;return getEndUser(_0x169e9d,_0x3a1467,_0x52aeb8[_0x4d61('0x66')],_0x52aeb8[_0x4d61('0x67')],_0x59d286);})[_0x4d61('0x1c')](function(_0x45481f){_0x2722f8=_0x45481f;return getTicket(_0x169e9d,_0x3af6d0,_0x2722f8,_0x3a1467,_0x52aeb8,_0x3a1467[_0x4d61('0x55')],_0x59d286,_0x4d61('0x61'));})[_0x4d61('0x1c')](function(_0x536592){_0x5380e1=_0x536592;logger[_0x4d61('0x1f')](_0x4d61('0x68'),_0x5380e1['id']);logger['info'](_0x4d61('0x69'),_0x5380e1['id'],_0x4e84dd[_0x4d61('0x40')],_0x169e9d['type']);switch(_0x169e9d[_0x4d61('0x37')]){case _0x4d61('0x57'):emit(util[_0x4d61('0x4f')]('user:%s',_0x4e84dd[_0x4d61('0x40')]),_0x4d61('0x59'),{'recordId':_0x5380e1['id']});break;case _0x4d61('0x5a'):emit(util[_0x4d61('0x4f')](_0x4d61('0x58'),_0x4e84dd['name']),_0x4d61('0x5b'),{'uri':util['format'](_0x4d61('0x5c'),_0x59d286[_0x4d61('0x5d')],_0x5380e1['id'])});break;default:logger['error'](_0x4d61('0x65'),_0x4d61('0x6a'));}})[_0x4d61('0x60')](function(_0x42013a){logger[_0x4d61('0x5e')](_0x4d61('0x65'),JSON[_0x4d61('0x6b')](_0x42013a));});};exports['unmanaged']=function(_0x2459b2,_0x548ec6,_0x1bb202,_0x5a3fd7,_0x533da0,_0x5fa700){var _0x46c498,_0x30bb35,_0x4cd104,_0x547152;_0x5fa700[_0x4d61('0x4b')]=intUtil[_0x4d61('0x62')](_0x5fa700[_0x4d61('0x4b')]);_0x5fa700[_0x4d61('0x46')]=intUtil[_0x4d61('0x62')](_0x5fa700[_0x4d61('0x46')]);if(_0x533da0&&_0x533da0[_0x4d61('0x6c')]){logger[_0x4d61('0x1f')]('['+_0x548ec6[_0x4d61('0x6d')][_0x4d61('0x6e')]()+']',_0x4d61('0x4d'));_0x548ec6['recordingURL']=util[_0x4d61('0x4f')](_0x4d61('0x50'),_0x5fa700[_0x4d61('0x4b')],_0x548ec6[_0x4d61('0x51')],md5(_0x548ec6[_0x4d61('0x51')]));}else{_0x548ec6['recordingURL']='';}return getConnection(_0x5fa700)[_0x4d61('0x1c')](function(_0xb6e738){_0x547152=_0xb6e738;if(!_['isNil'](_0x5a3fd7)){return getUser(_0x5fa700,_0x5a3fd7[_0x4d61('0x40')],_0x547152);}else{return getUser(_0x5fa700,null,_0x547152);}})[_0x4d61('0x1c')](function(_0x22d8bc){_0x46c498=_0x22d8bc;return getEndUser(_0x5fa700,_0x1bb202,_0x548ec6[_0x4d61('0x53')],_0x548ec6[_0x4d61('0x54')],_0x547152);})[_0x4d61('0x1c')](function(_0x423e02){_0x30bb35=_0x423e02;return getTicket(_0x5fa700,_0x46c498,_0x30bb35,_0x1bb202,_0x548ec6,_0x1bb202[_0x4d61('0x55')],_0x547152);})['then'](function(_0x363853){_0x4cd104=_0x363853;logger[_0x4d61('0x1f')]('['+_0x548ec6[_0x4d61('0x6d')]['toUpperCase']()+_0x4d61('0x6f'),_0x4cd104['id']);logger['info']('['+_0x548ec6[_0x4d61('0x6d')][_0x4d61('0x6e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x5fa700[_0x4d61('0x37')]);})[_0x4d61('0x60')](function(_0x25b381){logger[_0x4d61('0x5e')]('['+_0x548ec6[_0x4d61('0x6d')][_0x4d61('0x6e')]()+']',JSON[_0x4d61('0x6b')](_0x25b381));});}; \ 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 3b66878..b864776 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 _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x247a1e,_0x24f903){var _0x40ed26=function(_0x318244){while(--_0x318244){_0x247a1e['push'](_0x247a1e['shift']());}};_0x40ed26(++_0x24f903);}(_0x326f,0xd1));var _0xf326=function(_0x2055c9,_0xb70ce4){_0x2055c9=_0x2055c9-0x0;var _0xfc0402=_0x326f[_0x2055c9];return _0xfc0402;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\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','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0xc48cb8,_0x20bb64){var _0x28690f=function(_0x507399){while(--_0x507399){_0xc48cb8['push'](_0xc48cb8['shift']());}};_0x28690f(++_0x20bb64);}(_0x1261,0x144));var _0x1126=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x1261[_0x365e54];return _0x13317a;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'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 173ff34..eeac036 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 _0x9a14=['set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','lastevent','toUpperCase','isNil','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','socket.io-emitter','redis','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','direction','forEach','variableName','push','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','length','find','Agent\x20found!','resolve','value','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid'];(function(_0x1e9b82,_0x149177){var _0x4afca3=function(_0x489636){while(--_0x489636){_0x1e9b82['push'](_0x1e9b82['shift']());}};_0x4afca3(++_0x149177);}(_0x9a14,0xa8));var _0x49a1=function(_0x39304c,_0x540212){_0x39304c=_0x39304c-0x0;var _0x30b7a0=_0x9a14[_0x39304c];return _0x30b7a0;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49a1('0x0'));var md5=require(_0x49a1('0x1'));var util=require(_0x49a1('0x2'));var Redis=require(_0x49a1('0x3'));var intUtil=require(_0x49a1('0x4'));var config=require(_0x49a1('0x5'));var logger=require(_0x49a1('0x6'))(_0x49a1('0x7'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49a1('0x8'))(new Redis(config[_0x49a1('0x9')]));var def={'method':_0x49a1('0xa'),'json':!![]};function emit(_0x592940,_0x6c66e,_0x1ffbb4){io['to'](_0x592940)[_0x49a1('0xb')](_0x6c66e,_0x1ffbb4);}function getTicket(_0x5445eb,_0x1c4c48,_0x44f43b,_0x572dea,_0x712f74,_0x3c93d2,_0x2cb5a1,_0xe8bb48){logger[_0x49a1('0xc')]('Creating\x20new\x20ticket...');var _0x31dc7a=new Date();var _0xc294d2=[{'name':_0x49a1('0xd'),'value':intUtil[_0x49a1('0xe')](_0x572dea[_0x49a1('0xf')],_0x712f74,'\x20')},{'name':_0x49a1('0x10'),'value':_0x1c4c48['id']},{'name':_0x49a1('0x11'),'value':_0x1c4c48['id']},{'name':_0x49a1('0x12'),'value':intUtil[_0x49a1('0xe')](_0x572dea[_0x49a1('0x13')],_0x712f74,'\x0a')},{'name':_0x49a1('0x14'),'value':_0x31dc7a[_0x49a1('0x15')]()[_0x49a1('0x16')](0x0,0x13)[_0x49a1('0x17')]('T','\x20')},{'name':_0x49a1('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x49a1('0x19'),'value':_0x44f43b['id']},{'name':_0x49a1('0x1a'),'value':_0x49a1('0x1b')},{'name':'parent_name','value':_0x44f43b[_0x49a1('0xd')]},{'name':_0x49a1('0x1c'),'value':_0xe8bb48}];if(_0x3c93d2['length']){_[_0x49a1('0x1d')](_0x3c93d2,function(_0x5bed0e){if(_0x712f74[_0x5bed0e[_0x49a1('0x1e')]]){_0xc294d2[_0x49a1('0x1f')]({'name':_0x5bed0e['idField'],'value':_0x712f74[_0x5bed0e[_0x49a1('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON[_0x49a1('0x21')]({'session':_0x2cb5a1['id'],'module_name':'Calls','name_value_list':_0xc294d2})}});}function getAuth(_0x15d7e6){return util[_0x49a1('0x22')](_0x49a1('0x23'),new Buffer(_0x15d7e6[_0x49a1('0x24')]+':X')[_0x49a1('0x25')](_0x49a1('0x26')));}function getServerInfo(_0x50aace){return request({'form':{'method':_0x49a1('0x27'),'input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON['stringify']({'session':_0x50aace['id']})}});}function getUser(_0x12011d,_0x14a5bf,_0x28785d){if(!_['isNil'](_0x14a5bf)){logger['info'](_0x49a1('0x28'),_0x14a5bf);return request({'form':{'method':_0x49a1('0x29'),'input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON[_0x49a1('0x21')]({'session':_0x28785d['id'],'module_name':_0x49a1('0x2a'),'query':util[_0x49a1('0x22')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x14a5bf),'order_by':'','offset':'0','select_fields':['id',_0x49a1('0xd'),_0x49a1('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x49a1('0x2c')](function(_0x2935d1){if(_0x2935d1[_0x49a1('0x2d')][_0x49a1('0x2e')]){var _0x3a5aec=_[_0x49a1('0x2f')](_0x2935d1['entry_list'],function(_0x3cd5ff){return _0x3cd5ff['name_value_list']['user_name']['value']===_0x14a5bf;});if(_0x3a5aec){logger[_0x49a1('0xc')](_0x49a1('0x30'));return BPromise[_0x49a1('0x31')]({'id':_0x3a5aec['name_value_list']['id'][_0x49a1('0x32')],'name':_0x3a5aec[_0x49a1('0x33')][_0x49a1('0xd')][_0x49a1('0x32')]});}}logger[_0x49a1('0xc')](_0x49a1('0x34'));return BPromise[_0x49a1('0x31')]({'id':_0x28785d[_0x49a1('0x33')][_0x49a1('0x35')][_0x49a1('0x32')],'name':_0x28785d[_0x49a1('0x33')][_0x49a1('0x2b')][_0x49a1('0x32')]});});}else{logger[_0x49a1('0xc')](_0x49a1('0x36'));return BPromise[_0x49a1('0x31')]({'id':_0x28785d['name_value_list'][_0x49a1('0x35')]['value'],'name':_0x28785d['name_value_list'][_0x49a1('0x2b')][_0x49a1('0x32')]});}}function getEndUser(_0x9aa48a,_0x4ade57,_0x243ab6,_0x458665){logger['info']('Searching\x20enduser\x20with\x20phone',_0x243ab6);return request({'form':{'method':_0x49a1('0x29'),'input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON[_0x49a1('0x21')]({'session':_0x458665['id'],'module_name':_0x49a1('0x1b'),'query':util[_0x49a1('0x22')](_0x49a1('0x37'),_0x243ab6),'order_by':'','offset':'0','select_fields':['id',_0x49a1('0xd'),_0x49a1('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x49a1('0x2c')](function(_0x2973dd){if(_0x2973dd[_0x49a1('0x2d')][_0x49a1('0x2e')]){var _0x760e63=_[_0x49a1('0x2f')](_0x2973dd[_0x49a1('0x2d')],function(_0x541cad){return _0x541cad[_0x49a1('0x33')][_0x49a1('0x38')]['value']===_0x243ab6;});if(_0x760e63){logger[_0x49a1('0xc')]('Enduser\x20found!');return BPromise[_0x49a1('0x31')]({'id':_0x760e63[_0x49a1('0x33')]['id']['value'],'name':_0x760e63[_0x49a1('0x33')][_0x49a1('0xd')][_0x49a1('0x32')],'phone':_0x760e63[_0x49a1('0x33')][_0x49a1('0x38')][_0x49a1('0x32')]});}}else{logger[_0x49a1('0xc')](_0x49a1('0x39'));return request({'form':{'method':_0x49a1('0x3a'),'input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON[_0x49a1('0x21')]({'session':_0x458665['id'],'module_name':_0x49a1('0x1b'),'name_value_list':[{'name':_0x49a1('0x3b'),'value':_0x4ade57!==_0x49a1('0x3c')?_0x4ade57:util[_0x49a1('0x22')](_0x49a1('0x3d'),_0x243ab6)},{'name':_0x49a1('0x38'),'value':_0x243ab6}]})}})['then'](function(_0x1cc9f5){logger[_0x49a1('0xc')](_0x49a1('0x3e'));return BPromise[_0x49a1('0x31')]({'id':_0x1cc9f5['id'],'name':_0x1cc9f5[_0x49a1('0x2d')][_0x49a1('0x3b')]['value'],'phone':_0x1cc9f5[_0x49a1('0x2d')][_0x49a1('0x38')][_0x49a1('0x32')]});});}});}function request(_0x5dddb8){logger[_0x49a1('0x3f')]('[HTTP]',JSON['stringify'](_0x5dddb8));return rp(_[_0x49a1('0x40')](def,_0x5dddb8));}function getTags(_0x174fd8,_0x27bf5a){var _0x45e125=[];if(_0x174fd8&&_0x174fd8[_0x49a1('0x2e')]>0x0){_0x45e125=_['map'](_0x174fd8,_0x27bf5a);}return _0x45e125;}function getCustomFields(_0x32affc,_0x36f3cd){var _0x5682ba=[];var _0x4a9632={'custom_fields':[]};if(_0x32affc['length']>0x0){_['forEach'](_0x32affc,function(_0x2a18dd){if(_0x2a18dd[_0x49a1('0x41')]==='string'&&_0x2a18dd[_0x49a1('0x42')]&&!_0x2a18dd[_0x49a1('0x43')]){_0x4a9632[_0x2a18dd['nameField'][_0x49a1('0x44')]()]=_0x2a18dd[_0x49a1('0x45')][_0x49a1('0x25')]();}else if(_0x2a18dd[_0x49a1('0x41')]===_0x49a1('0x46')&&_0x2a18dd[_0x49a1('0x47')]&&_0x2a18dd['customField']){_0x4a9632[_0x49a1('0x48')]['push']({'id':_0x2a18dd[_0x49a1('0x47')],'value':_0x2a18dd[_0x49a1('0x45')][_0x49a1('0x25')]()});}else if(_0x2a18dd[_0x49a1('0x41')]===_0x49a1('0x49')&&_0x2a18dd[_0x49a1('0x1e')]&&_0x2a18dd[_0x49a1('0x47')]&&_0x2a18dd['customField']){_0x36f3cd[_0x2a18dd[_0x49a1('0x1e')]]&&_0x4a9632[_0x49a1('0x48')][_0x49a1('0x1f')]({'id':_0x2a18dd[_0x49a1('0x47')],'value':_0x36f3cd[_0x2a18dd['variableName']][_0x49a1('0x25')]()});}else if(_0x2a18dd[_0x49a1('0x41')]===_0x49a1('0x4a')&&_0x2a18dd[_0x49a1('0x4b')]&&_0x2a18dd[_0x49a1('0x4b')][_0x49a1('0xd')]&&_0x2a18dd[_0x49a1('0x47')]&&_0x2a18dd[_0x49a1('0x43')]){_0x36f3cd[_0x2a18dd[_0x49a1('0x4b')]['name'][_0x49a1('0x44')]()]&&_0x4a9632[_0x49a1('0x48')][_0x49a1('0x1f')]({'id':_0x2a18dd[_0x49a1('0x47')],'value':_0x36f3cd[_0x2a18dd[_0x49a1('0x4b')][_0x49a1('0xd')][_0x49a1('0x44')]()]['toString']()});}});}return _0x4a9632;}function getConnection(_0x4391ae){return request({'method':'POST','form':{'method':_0x49a1('0x4c'),'input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON[_0x49a1('0x21')]({'user_auth':{'user_name':_0x4391ae[_0x49a1('0x4d')],'password':_0x4391ae[_0x49a1('0x4e')],'encryption':_0x49a1('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x49a1('0x2c')](function(_0x76be67){var _0x50e605=_0x76be67;if(_0x50e605['id']){def[_0x49a1('0x50')]=_0x50e605['id'];return BPromise[_0x49a1('0x31')](_0x50e605);}else{throw new Error(util[_0x49a1('0x22')](_0x49a1('0x51'),_0x4391ae['id']));}});}function setRelationship(_0x9b31ba,_0x4de5aa,_0x332cb5,_0x24f37e){return request({'form':{'method':_0x49a1('0x52'),'input_type':_0x49a1('0x20'),'response_type':_0x49a1('0x20'),'rest_data':JSON[_0x49a1('0x21')]({'session':_0x9b31ba['id'],'module_name':_0x49a1('0x53'),'module_id':_0x332cb5['id'],'link_field_name':_0x24f37e,'related_ids':[_0x4de5aa['id']]})}});}exports[_0x49a1('0x54')]=function(_0x29e6e,_0x50c765,_0x3072e1,_0x37e33f,_0x3ab179,_0x5334ba){var _0xd771b0,_0x468eb7,_0x3ae7aa,_0x3a0fcc;_0x5334ba[_0x49a1('0x55')]=intUtil[_0x49a1('0x56')](_0x5334ba[_0x49a1('0x55')]);_0x5334ba[_0x49a1('0x57')]=intUtil['stripTrailingSlash'](_0x5334ba['serverUrl']);def['uri']=util[_0x49a1('0x22')](_0x49a1('0x58'),_0x5334ba[_0x49a1('0x55')]);if(_0x3ab179&&_0x3ab179[_0x49a1('0x59')]){logger[_0x49a1('0xc')](_0x49a1('0x5a'),_0x49a1('0x5b'));_0x50c765[_0x49a1('0x5c')]=util[_0x49a1('0x22')](_0x49a1('0x5d'),_0x5334ba[_0x49a1('0x57')],_0x50c765[_0x49a1('0x5e')],md5(_0x50c765[_0x49a1('0x5e')]));}else{_0x50c765[_0x49a1('0x5c')]='';}return getConnection(_0x5334ba)['then'](function(_0x49e11b){_0x3a0fcc=_0x49e11b;return getUser(_0x5334ba,_0x37e33f['name'],_0x3a0fcc);})[_0x49a1('0x2c')](function(_0x4ce139){_0xd771b0=_0x4ce139;logger['info'](_0x49a1('0x5f'),_0xd771b0['id']);return getEndUser(_0x5334ba,_0x50c765[_0x49a1('0x60')],_0x50c765[_0x49a1('0x61')],_0x3a0fcc);})[_0x49a1('0x2c')](function(_0x28e43d){_0x468eb7=_0x28e43d;logger[_0x49a1('0xc')](_0x49a1('0x62'),_0x468eb7['id']);return getTicket(_0x5334ba,_0xd771b0,_0x468eb7,_0x3072e1,_0x50c765,_0x3072e1['Fields'],_0x3a0fcc,_0x49a1('0x63'));})[_0x49a1('0x2c')](function(_0x3fc4df){_0x3ae7aa=_0x3fc4df;logger[_0x49a1('0xc')](_0x49a1('0x64'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3ae7aa['id']);return setRelationship(_0x3a0fcc,_0xd771b0,_0x3ae7aa,_0x49a1('0x65'));})[_0x49a1('0x2c')](function(){return setRelationship(_0x3a0fcc,_0x468eb7,_0x3ae7aa,_0x49a1('0x66'));})['then'](function(){return getServerInfo(_0x3a0fcc);})['then'](function(_0x2e7d99){var _0x3df353=parseInt(_0x2e7d99[_0x49a1('0x67')][_0x49a1('0x68')](0x0));var _0x45028c=util[_0x49a1('0x22')](_0x49a1('0x69'),_0x5334ba[_0x49a1('0x55')],_0x3ae7aa['id']);if(_0x3df353>0x6){_0x45028c=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5334ba['remoteUri'],_0x3ae7aa['id']);}logger[_0x49a1('0xc')](_0x49a1('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x49a1('0x6a'),_0x37e33f[_0x49a1('0xd')]),'trigger:browser:url',{'uri':_0x45028c});})['catch'](function(_0x51e148){logger['error'](_0x49a1('0x5a'),JSON[_0x49a1('0x21')](_0x51e148));});};exports[_0x49a1('0x6b')]=function(_0x35ba58,_0x13ad48,_0x4e13fc,_0x1d1984,_0x213146,_0x3159f5,_0x1f7e69){var _0x1a31a8,_0x16c641,_0x1aa218,_0x4a9264;_0x3159f5[_0x49a1('0x55')]=intUtil[_0x49a1('0x56')](_0x3159f5[_0x49a1('0x55')]);_0x3159f5[_0x49a1('0x57')]=intUtil[_0x49a1('0x56')](_0x3159f5['serverUrl']);def[_0x49a1('0x6c')]=util[_0x49a1('0x22')](_0x49a1('0x58'),_0x3159f5[_0x49a1('0x55')]);if(_0x1f7e69&&_0x1f7e69[_0x49a1('0x6d')]&&_0x1f7e69['recordingFormat']!==_0x49a1('0x6e')){logger['info'](_0x49a1('0x6f'),'Recording\x20is\x20enabled!');_0x13ad48[_0x49a1('0x5c')]=util[_0x49a1('0x22')](_0x49a1('0x5d'),_0x3159f5[_0x49a1('0x57')],_0x13ad48['uniqueid'],md5(_0x13ad48['uniqueid']));}return getConnection(_0x3159f5)[_0x49a1('0x2c')](function(_0x3055fd){_0x4a9264=_0x3055fd;return getUser(_0x3159f5,_0x1d1984[_0x49a1('0xd')],_0x4a9264);})[_0x49a1('0x2c')](function(_0x2c87d6){_0x1a31a8=_0x2c87d6;logger['info'](_0x49a1('0x5f'),_0x1a31a8['id']);return getEndUser(_0x3159f5,_0x13ad48[_0x49a1('0x70')],_0x13ad48[_0x49a1('0x71')],_0x4a9264);})[_0x49a1('0x2c')](function(_0x46b4db){_0x16c641=_0x46b4db;logger[_0x49a1('0xc')](_0x49a1('0x62'),_0x16c641['id']);return getTicket(_0x3159f5,_0x1a31a8,_0x16c641,_0x4e13fc,_0x13ad48,_0x4e13fc[_0x49a1('0x72')],_0x4a9264,_0x49a1('0x73'));})[_0x49a1('0x2c')](function(_0x2150b7){_0x1aa218=_0x2150b7;logger['info'](_0x49a1('0x64'));logger[_0x49a1('0xc')](_0x49a1('0x74'),_0x1aa218['id']);return setRelationship(_0x4a9264,_0x1a31a8,_0x1aa218,'users');})[_0x49a1('0x2c')](function(){return setRelationship(_0x4a9264,_0x16c641,_0x1aa218,_0x49a1('0x66'));})['then'](function(){return getServerInfo(_0x4a9264);})[_0x49a1('0x2c')](function(_0xf4952b){var _0x188b09=parseInt(_0xf4952b['version'][_0x49a1('0x68')](0x0));var _0x4512a8=util[_0x49a1('0x22')](_0x49a1('0x69'),_0x3159f5['remoteUri'],_0x1aa218['id']);if(_0x188b09>0x6){_0x4512a8=util[_0x49a1('0x22')](_0x49a1('0x75'),_0x3159f5[_0x49a1('0x55')],_0x1aa218['id']);}logger[_0x49a1('0xc')](_0x49a1('0x6f'),_0x49a1('0x76'));emit(util[_0x49a1('0x22')](_0x49a1('0x6a'),_0x1d1984[_0x49a1('0xd')]),_0x49a1('0x77'),{'uri':_0x4512a8});})[_0x49a1('0x78')](function(_0x243588){logger[_0x49a1('0x79')](_0x49a1('0x6f'),JSON[_0x49a1('0x21')](_0x243588));});};exports['unmanaged']=function(_0x812f30,_0x4a3357,_0x3af587,_0x4242b1,_0x3272c6,_0x94447e){var _0x5176c3,_0x901896,_0x395c12,_0x346b5d;_0x94447e['remoteUri']=intUtil[_0x49a1('0x56')](_0x94447e['remoteUri']);_0x94447e[_0x49a1('0x57')]=intUtil[_0x49a1('0x56')](_0x94447e[_0x49a1('0x57')]);def['uri']=util['format'](_0x49a1('0x58'),_0x94447e[_0x49a1('0x55')]);if(_0x3272c6&&_0x3272c6[_0x49a1('0x59')]){logger['info']('['+_0x4a3357[_0x49a1('0x7a')][_0x49a1('0x7b')]()+']','Recording\x20is\x20enabled!');_0x4a3357[_0x49a1('0x5c')]=util[_0x49a1('0x22')](_0x49a1('0x5d'),_0x94447e['serverUrl'],_0x4a3357[_0x49a1('0x5e')],md5(_0x4a3357[_0x49a1('0x5e')]));}else{_0x4a3357['recordingURL']='';}return getConnection(_0x94447e)[_0x49a1('0x2c')](function(_0x211341){_0x346b5d=_0x211341;if(!_[_0x49a1('0x7c')](_0x4242b1)){return getUser(_0x94447e,_0x4242b1[_0x49a1('0xd')],_0x346b5d);}else{return getUser(_0x94447e,null,_0x346b5d);}})[_0x49a1('0x2c')](function(_0x1f1d4e){_0x5176c3=_0x1f1d4e;logger[_0x49a1('0xc')](_0x49a1('0x5f'),_0x5176c3['id']);return getEndUser(_0x94447e,_0x4a3357[_0x49a1('0x60')],_0x4a3357[_0x49a1('0x61')],_0x346b5d);})[_0x49a1('0x2c')](function(_0x498b95){_0x901896=_0x498b95;logger[_0x49a1('0xc')](_0x49a1('0x62'),_0x901896['id']);return getTicket(_0x94447e,_0x5176c3,_0x901896,_0x3af587,_0x4a3357,_0x3af587[_0x49a1('0x72')],_0x346b5d,'Inbound');})[_0x49a1('0x2c')](function(_0x4f32ec){_0x395c12=_0x4f32ec;logger['info'](_0x49a1('0x64'));logger[_0x49a1('0xc')](_0x49a1('0x74'),_0x395c12['id']);return setRelationship(_0x346b5d,_0x5176c3,_0x395c12,_0x49a1('0x65'));})['then'](function(){return setRelationship(_0x346b5d,_0x901896,_0x395c12,_0x49a1('0x66'));})[_0x49a1('0x2c')](function(){return getServerInfo(_0x346b5d);})[_0x49a1('0x78')](function(_0x21620e){logger[_0x49a1('0x79')]('['+_0x4a3357['lastevent'][_0x49a1('0x7b')]()+']',JSON[_0x49a1('0x21')](_0x21620e));});}; \ No newline at end of file +var _0x89fb=['Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','forEach','type','string','nameField','toLowerCase','content','toString','idField','custom_fields','variable','customField','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','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','trigger:browser:url','error','outbound','stripTrailingSlash','uri','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','version','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','variableName','push','set_entry','JSON','stringify','Calls','format','get_server_info','isNil'];(function(_0x40e486,_0x2eac53){var _0x1c070f=function(_0x31a604){while(--_0x31a604){_0x40e486['push'](_0x40e486['shift']());}};_0x1c070f(++_0x2eac53);}(_0x89fb,0x14b));var _0xb89f=function(_0x344c31,_0x60d141){_0x344c31=_0x344c31-0x0;var _0x3da7b5=_0x89fb[_0x344c31];return _0x3da7b5;};'use strict';var _=require('lodash');var rp=require(_0xb89f('0x0'));var BPromise=require(_0xb89f('0x1'));var md5=require(_0xb89f('0x2'));var util=require(_0xb89f('0x3'));var Redis=require(_0xb89f('0x4'));var intUtil=require('./util');var config=require(_0xb89f('0x5'));var logger=require(_0xb89f('0x6'))(_0xb89f('0x7'));config[_0xb89f('0x8')]=_[_0xb89f('0x9')](config['redis'],{'host':_0xb89f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb89f('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x3c0105,_0x95385,_0x300c7c){io['to'](_0x3c0105)['emit'](_0x95385,_0x300c7c);}function getTicket(_0x18f75f,_0x2f1a11,_0x2f0c38,_0x7361c0,_0x36bbe0,_0x50bad7,_0x5e43da,_0x474a7c){logger[_0xb89f('0xb')](_0xb89f('0xc'));var _0x1d48a0=new Date();var _0xa948e3=[{'name':'name','value':intUtil[_0xb89f('0xd')](_0x7361c0[_0xb89f('0xe')],_0x36bbe0,'\x20')},{'name':_0xb89f('0xf'),'value':_0x2f1a11['id']},{'name':_0xb89f('0x10'),'value':_0x2f1a11['id']},{'name':_0xb89f('0x11'),'value':intUtil[_0xb89f('0xd')](_0x7361c0['Descriptions'],_0x36bbe0,'\x0a')},{'name':_0xb89f('0x12'),'value':_0x1d48a0[_0xb89f('0x13')]()[_0xb89f('0x14')](0x0,0x13)[_0xb89f('0x15')]('T','\x20')},{'name':_0xb89f('0x16'),'value':'0'},{'name':_0xb89f('0x17'),'value':'15'},{'name':_0xb89f('0x18'),'value':_0x2f0c38['id']},{'name':'parent_type','value':_0xb89f('0x19')},{'name':_0xb89f('0x1a'),'value':_0x2f0c38[_0xb89f('0x1b')]},{'name':_0xb89f('0x1c'),'value':_0x474a7c}];if(_0x50bad7['length']){_['forEach'](_0x50bad7,function(_0x77a882){if(_0x36bbe0[_0x77a882[_0xb89f('0x1d')]]){_0xa948e3[_0xb89f('0x1e')]({'name':_0x77a882['idField'],'value':_0x36bbe0[_0x77a882['variableName']]});}});}return request({'form':{'method':_0xb89f('0x1f'),'input_type':_0xb89f('0x20'),'response_type':_0xb89f('0x20'),'rest_data':JSON[_0xb89f('0x21')]({'session':_0x5e43da['id'],'module_name':_0xb89f('0x22'),'name_value_list':_0xa948e3})}});}function getAuth(_0x3c772d){return util[_0xb89f('0x23')]('Basic\x20%s',new Buffer(_0x3c772d['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x5ee95f){return request({'form':{'method':_0xb89f('0x24'),'input_type':'JSON','response_type':_0xb89f('0x20'),'rest_data':JSON[_0xb89f('0x21')]({'session':_0x5ee95f['id']})}});}function getUser(_0x40f063,_0x1e5490,_0x19b881){if(!_[_0xb89f('0x25')](_0x1e5490)){logger['info'](_0xb89f('0x26'),_0x1e5490);return request({'form':{'method':_0xb89f('0x27'),'input_type':_0xb89f('0x20'),'response_type':_0xb89f('0x20'),'rest_data':JSON[_0xb89f('0x21')]({'session':_0x19b881['id'],'module_name':_0xb89f('0x28'),'query':util[_0xb89f('0x23')](_0xb89f('0x29'),_0x1e5490),'order_by':'','offset':'0','select_fields':['id','name',_0xb89f('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb89f('0x2b')](function(_0x723479){if(_0x723479[_0xb89f('0x2c')][_0xb89f('0x2d')]){var _0x22195c=_['find'](_0x723479[_0xb89f('0x2c')],function(_0x22b15f){return _0x22b15f[_0xb89f('0x2e')][_0xb89f('0x2a')]['value']===_0x1e5490;});if(_0x22195c){logger['info']('Agent\x20found!');return BPromise[_0xb89f('0x2f')]({'id':_0x22195c[_0xb89f('0x2e')]['id'][_0xb89f('0x30')],'name':_0x22195c[_0xb89f('0x2e')][_0xb89f('0x1b')][_0xb89f('0x30')]});}}logger[_0xb89f('0xb')](_0xb89f('0x31'));return BPromise[_0xb89f('0x2f')]({'id':_0x19b881['name_value_list'][_0xb89f('0x32')][_0xb89f('0x30')],'name':_0x19b881['name_value_list'][_0xb89f('0x2a')][_0xb89f('0x30')]});});}else{logger[_0xb89f('0xb')](_0xb89f('0x33'));return BPromise['resolve']({'id':_0x19b881[_0xb89f('0x2e')][_0xb89f('0x32')][_0xb89f('0x30')],'name':_0x19b881[_0xb89f('0x2e')]['user_name'][_0xb89f('0x30')]});}}function getEndUser(_0x5e79a4,_0x19d655,_0x1cc704,_0x3909a8){logger['info'](_0xb89f('0x34'),_0x1cc704);return request({'form':{'method':_0xb89f('0x27'),'input_type':_0xb89f('0x20'),'response_type':'JSON','rest_data':JSON[_0xb89f('0x21')]({'session':_0x3909a8['id'],'module_name':_0xb89f('0x19'),'query':util[_0xb89f('0x23')](_0xb89f('0x35'),_0x1cc704),'order_by':'','offset':'0','select_fields':['id',_0xb89f('0x1b'),_0xb89f('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb89f('0x2b')](function(_0x4d70d2){if(_0x4d70d2[_0xb89f('0x2c')][_0xb89f('0x2d')]){var _0x21c315=_[_0xb89f('0x37')](_0x4d70d2['entry_list'],function(_0xeee1a8){return _0xeee1a8['name_value_list'][_0xb89f('0x36')][_0xb89f('0x30')]===_0x1cc704;});if(_0x21c315){logger['info'](_0xb89f('0x38'));return BPromise[_0xb89f('0x2f')]({'id':_0x21c315[_0xb89f('0x2e')]['id'][_0xb89f('0x30')],'name':_0x21c315[_0xb89f('0x2e')]['name']['value'],'phone':_0x21c315[_0xb89f('0x2e')][_0xb89f('0x36')][_0xb89f('0x30')]});}}else{logger[_0xb89f('0xb')](_0xb89f('0x39'));return request({'form':{'method':_0xb89f('0x1f'),'input_type':'JSON','response_type':_0xb89f('0x20'),'rest_data':JSON[_0xb89f('0x21')]({'session':_0x3909a8['id'],'module_name':_0xb89f('0x19'),'name_value_list':[{'name':_0xb89f('0x3a'),'value':_0x19d655!==''?_0x19d655:util[_0xb89f('0x23')](_0xb89f('0x3b'),_0x1cc704)},{'name':_0xb89f('0x36'),'value':_0x1cc704}]})}})['then'](function(_0x43c478){logger[_0xb89f('0xb')](_0xb89f('0x3c'));return BPromise['resolve']({'id':_0x43c478['id'],'name':_0x43c478[_0xb89f('0x2c')][_0xb89f('0x3a')]['value'],'phone':_0x43c478['entry_list']['phone_home']['value']});});}});}function request(_0x8cf572){logger['debug'](_0xb89f('0x3d'),JSON[_0xb89f('0x21')](_0x8cf572));return rp(_[_0xb89f('0x3e')](def,_0x8cf572));}function getTags(_0x121ce4,_0x4f5fa7){var _0x2d6735=[];if(_0x121ce4&&_0x121ce4[_0xb89f('0x2d')]>0x0){_0x2d6735=_[_0xb89f('0x3f')](_0x121ce4,_0x4f5fa7);}return _0x2d6735;}function getCustomFields(_0x39debc,_0x229c41){var _0x325e57=[];var _0x278c2c={'custom_fields':[]};if(_0x39debc[_0xb89f('0x2d')]>0x0){_[_0xb89f('0x40')](_0x39debc,function(_0x448c6d){if(_0x448c6d[_0xb89f('0x41')]===_0xb89f('0x42')&&_0x448c6d[_0xb89f('0x43')]&&!_0x448c6d['customField']){_0x278c2c[_0x448c6d[_0xb89f('0x43')][_0xb89f('0x44')]()]=_0x448c6d[_0xb89f('0x45')][_0xb89f('0x46')]();}else if(_0x448c6d[_0xb89f('0x41')]===_0xb89f('0x42')&&_0x448c6d[_0xb89f('0x47')]&&_0x448c6d['customField']){_0x278c2c[_0xb89f('0x48')]['push']({'id':_0x448c6d[_0xb89f('0x47')],'value':_0x448c6d['content'][_0xb89f('0x46')]()});}else if(_0x448c6d[_0xb89f('0x41')]===_0xb89f('0x49')&&_0x448c6d['variableName']&&_0x448c6d[_0xb89f('0x47')]&&_0x448c6d[_0xb89f('0x4a')]){_0x229c41[_0x448c6d[_0xb89f('0x1d')]]&&_0x278c2c[_0xb89f('0x48')][_0xb89f('0x1e')]({'id':_0x448c6d['idField'],'value':_0x229c41[_0x448c6d[_0xb89f('0x1d')]][_0xb89f('0x46')]()});}else if(_0x448c6d['type']===_0xb89f('0x4b')&&_0x448c6d[_0xb89f('0x4c')]&&_0x448c6d[_0xb89f('0x4c')][_0xb89f('0x1b')]&&_0x448c6d[_0xb89f('0x47')]&&_0x448c6d[_0xb89f('0x4a')]){_0x229c41[_0x448c6d[_0xb89f('0x4c')][_0xb89f('0x1b')][_0xb89f('0x44')]()]&&_0x278c2c[_0xb89f('0x48')]['push']({'id':_0x448c6d['idField'],'value':_0x229c41[_0x448c6d[_0xb89f('0x4c')][_0xb89f('0x1b')][_0xb89f('0x44')]()][_0xb89f('0x46')]()});}});}return _0x278c2c;}function getConnection(_0x5dbaa2){return request({'method':'POST','form':{'method':_0xb89f('0x4d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb89f('0x21')]({'user_auth':{'user_name':_0x5dbaa2['username'],'password':_0x5dbaa2[_0xb89f('0x4e')],'encryption':_0xb89f('0x4f')},'application':_0xb89f('0x50')})}})[_0xb89f('0x2b')](function(_0x3cbd7f){var _0x5b9768=_0x3cbd7f;if(_0x5b9768['id']){def[_0xb89f('0x51')]=_0x5b9768['id'];return BPromise[_0xb89f('0x2f')](_0x5b9768);}else{throw new Error(util[_0xb89f('0x23')](_0xb89f('0x52'),_0x5dbaa2['id']));}});}function setRelationship(_0x55ac38,_0x15382d,_0x553299,_0x3cbe48){return request({'form':{'method':_0xb89f('0x53'),'input_type':_0xb89f('0x20'),'response_type':_0xb89f('0x20'),'rest_data':JSON[_0xb89f('0x21')]({'session':_0x55ac38['id'],'module_name':_0xb89f('0x22'),'module_id':_0x553299['id'],'link_field_name':_0x3cbe48,'related_ids':[_0x15382d['id']]})}});}exports[_0xb89f('0x54')]=function(_0x496c1d,_0x1f19bb,_0x1c527d,_0x5f5296,_0x33cbed,_0x1b730d){var _0x55712a,_0x76efc7,_0x33cede,_0x2ce1a0;_0x1b730d['remoteUri']=intUtil['stripTrailingSlash'](_0x1b730d[_0xb89f('0x55')]);_0x1b730d[_0xb89f('0x56')]=intUtil['stripTrailingSlash'](_0x1b730d[_0xb89f('0x56')]);def['uri']=util[_0xb89f('0x23')](_0xb89f('0x57'),_0x1b730d[_0xb89f('0x55')]);if(_0x33cbed&&_0x33cbed[_0xb89f('0x58')]){logger[_0xb89f('0xb')](_0xb89f('0x59'),'Recording\x20is\x20enabled!');_0x1f19bb[_0xb89f('0x5a')]=util[_0xb89f('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b730d[_0xb89f('0x56')],_0x1f19bb[_0xb89f('0x5b')],md5(_0x1f19bb['uniqueid']));}else{_0x1f19bb['recordingURL']='';}return getConnection(_0x1b730d)[_0xb89f('0x2b')](function(_0x1a0dbe){_0x2ce1a0=_0x1a0dbe;return getUser(_0x1b730d,_0x5f5296[_0xb89f('0x1b')],_0x2ce1a0);})['then'](function(_0x338530){_0x55712a=_0x338530;logger[_0xb89f('0xb')](_0xb89f('0x5c'),_0x55712a['id']);return getEndUser(_0x1b730d,_0x1f19bb[_0xb89f('0x5d')],_0x1f19bb[_0xb89f('0x5e')],_0x2ce1a0);})['then'](function(_0x5d8d92){_0x76efc7=_0x5d8d92;logger[_0xb89f('0xb')]('The\x20Enduser\x20ID\x20is:',_0x76efc7['id']);return getTicket(_0x1b730d,_0x55712a,_0x76efc7,_0x1c527d,_0x1f19bb,_0x1c527d[_0xb89f('0x5f')],_0x2ce1a0,'Inbound');})[_0xb89f('0x2b')](function(_0x25513b){_0x33cede=_0x25513b;logger[_0xb89f('0xb')](_0xb89f('0x60'));logger[_0xb89f('0xb')](_0xb89f('0x61'),_0x33cede['id']);return setRelationship(_0x2ce1a0,_0x55712a,_0x33cede,_0xb89f('0x62'));})['then'](function(){return setRelationship(_0x2ce1a0,_0x76efc7,_0x33cede,_0xb89f('0x63'));})[_0xb89f('0x2b')](function(){return getServerInfo(_0x2ce1a0);})['then'](function(_0xf7b639){var _0x8b3771=parseInt(_0xf7b639['version'][_0xb89f('0x64')](0x0));var _0x226f98=util[_0xb89f('0x23')](_0xb89f('0x65'),_0x1b730d['remoteUri'],_0x33cede['id']);if(_0x8b3771>0x6){_0x226f98=util[_0xb89f('0x23')](_0xb89f('0x66'),_0x1b730d[_0xb89f('0x55')],_0x33cede['id']);}logger[_0xb89f('0xb')](_0xb89f('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb89f('0x23')]('user:%s',_0x5f5296[_0xb89f('0x1b')]),_0xb89f('0x67'),{'uri':_0x226f98});})['catch'](function(_0x3ffa54){logger[_0xb89f('0x68')]('[QUEUE]',JSON[_0xb89f('0x21')](_0x3ffa54));});};exports[_0xb89f('0x69')]=function(_0x73c6ea,_0x5066b5,_0x2dc4b1,_0x2c489b,_0x40e01e,_0x5452b3,_0x3d25fa){var _0x4c7fff,_0x2e85d1,_0x22693e,_0x24a113;_0x5452b3[_0xb89f('0x55')]=intUtil[_0xb89f('0x6a')](_0x5452b3['remoteUri']);_0x5452b3[_0xb89f('0x56')]=intUtil[_0xb89f('0x6a')](_0x5452b3[_0xb89f('0x56')]);def[_0xb89f('0x6b')]=util['format'](_0xb89f('0x57'),_0x5452b3[_0xb89f('0x55')]);if(_0x3d25fa&&_0x3d25fa[_0xb89f('0x6c')]&&_0x3d25fa[_0xb89f('0x6c')]!=='none'){logger['info']('[OUTBOUND]',_0xb89f('0x6d'));_0x5066b5[_0xb89f('0x5a')]=util['format'](_0xb89f('0x6e'),_0x5452b3[_0xb89f('0x56')],_0x5066b5[_0xb89f('0x5b')],md5(_0x5066b5['uniqueid']));}return getConnection(_0x5452b3)[_0xb89f('0x2b')](function(_0x31e97c){_0x24a113=_0x31e97c;return getUser(_0x5452b3,_0x2c489b[_0xb89f('0x1b')],_0x24a113);})['then'](function(_0x264f95){_0x4c7fff=_0x264f95;logger[_0xb89f('0xb')]('The\x20User\x20ID\x20is:',_0x4c7fff['id']);return getEndUser(_0x5452b3,_0x5066b5[_0xb89f('0x6f')],_0x5066b5[_0xb89f('0x70')],_0x24a113);})[_0xb89f('0x2b')](function(_0x3a522d){_0x2e85d1=_0x3a522d;logger[_0xb89f('0xb')](_0xb89f('0x71'),_0x2e85d1['id']);return getTicket(_0x5452b3,_0x4c7fff,_0x2e85d1,_0x2dc4b1,_0x5066b5,_0x2dc4b1[_0xb89f('0x5f')],_0x24a113,_0xb89f('0x72'));})[_0xb89f('0x2b')](function(_0x489a73){_0x22693e=_0x489a73;logger[_0xb89f('0xb')]('Ticket\x20created!');logger[_0xb89f('0xb')](_0xb89f('0x61'),_0x22693e['id']);return setRelationship(_0x24a113,_0x4c7fff,_0x22693e,_0xb89f('0x62'));})[_0xb89f('0x2b')](function(){return setRelationship(_0x24a113,_0x2e85d1,_0x22693e,_0xb89f('0x63'));})[_0xb89f('0x2b')](function(){return getServerInfo(_0x24a113);})[_0xb89f('0x2b')](function(_0x32efbc){var _0x2fd976=parseInt(_0x32efbc[_0xb89f('0x73')][_0xb89f('0x64')](0x0));var _0x1c4a67=util[_0xb89f('0x23')](_0xb89f('0x65'),_0x5452b3['remoteUri'],_0x22693e['id']);if(_0x2fd976>0x6){_0x1c4a67=util['format'](_0xb89f('0x66'),_0x5452b3[_0xb89f('0x55')],_0x22693e['id']);}logger[_0xb89f('0xb')](_0xb89f('0x74'),_0xb89f('0x75'));emit(util[_0xb89f('0x23')](_0xb89f('0x76'),_0x2c489b[_0xb89f('0x1b')]),_0xb89f('0x67'),{'uri':_0x1c4a67});})[_0xb89f('0x77')](function(_0x167f57){logger[_0xb89f('0x68')](_0xb89f('0x74'),JSON[_0xb89f('0x21')](_0x167f57));});};exports[_0xb89f('0x78')]=function(_0x1a7060,_0x3ffd8f,_0x5b1f79,_0x3e765c,_0x2067cb,_0x113105){var _0x9b6790,_0x5a428f,_0x56f9ea,_0x461256;_0x113105[_0xb89f('0x55')]=intUtil['stripTrailingSlash'](_0x113105[_0xb89f('0x55')]);_0x113105[_0xb89f('0x56')]=intUtil[_0xb89f('0x6a')](_0x113105[_0xb89f('0x56')]);def[_0xb89f('0x6b')]=util[_0xb89f('0x23')]('%s/service/v4_1/rest.php',_0x113105[_0xb89f('0x55')]);if(_0x2067cb&&_0x2067cb[_0xb89f('0x58')]){logger[_0xb89f('0xb')]('['+_0x3ffd8f[_0xb89f('0x79')][_0xb89f('0x7a')]()+']','Recording\x20is\x20enabled!');_0x3ffd8f[_0xb89f('0x5a')]=util[_0xb89f('0x23')](_0xb89f('0x6e'),_0x113105[_0xb89f('0x56')],_0x3ffd8f['uniqueid'],md5(_0x3ffd8f[_0xb89f('0x5b')]));}else{_0x3ffd8f['recordingURL']='';}return getConnection(_0x113105)['then'](function(_0x40f430){_0x461256=_0x40f430;if(!_[_0xb89f('0x25')](_0x3e765c)){return getUser(_0x113105,_0x3e765c[_0xb89f('0x1b')],_0x461256);}else{return getUser(_0x113105,null,_0x461256);}})[_0xb89f('0x2b')](function(_0x405dfb){_0x9b6790=_0x405dfb;logger['info']('The\x20User\x20ID\x20is:',_0x9b6790['id']);return getEndUser(_0x113105,_0x3ffd8f[_0xb89f('0x5d')],_0x3ffd8f[_0xb89f('0x5e')],_0x461256);})[_0xb89f('0x2b')](function(_0xab5115){_0x5a428f=_0xab5115;logger[_0xb89f('0xb')](_0xb89f('0x71'),_0x5a428f['id']);return getTicket(_0x113105,_0x9b6790,_0x5a428f,_0x5b1f79,_0x3ffd8f,_0x5b1f79[_0xb89f('0x5f')],_0x461256,'Inbound');})[_0xb89f('0x2b')](function(_0x4e788f){_0x56f9ea=_0x4e788f;logger['info'](_0xb89f('0x60'));logger[_0xb89f('0xb')](_0xb89f('0x61'),_0x56f9ea['id']);return setRelationship(_0x461256,_0x9b6790,_0x56f9ea,_0xb89f('0x62'));})[_0xb89f('0x2b')](function(){return setRelationship(_0x461256,_0x5a428f,_0x56f9ea,_0xb89f('0x63'));})['then'](function(){return getServerInfo(_0x461256);})[_0xb89f('0x77')](function(_0x3fa87c){logger[_0xb89f('0x68')]('['+_0x3ffd8f['lastevent'][_0xb89f('0x7a')]()+']',JSON[_0xb89f('0x21')](_0x3fa87c));});}; \ 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 51b2cf2..dd11cec 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 _0x6d07=['keyType','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','format','%s:\x20%s','key','keyContent'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x6d07,0x120));var _0x76d0=function(_0x78929c,_0x529d2f){_0x78929c=_0x78929c-0x0;var _0x1c1c5c=_0x6d07[_0x78929c];return _0x1c1c5c;};'use strict';var _=require(_0x76d0('0x0'));var util=require(_0x76d0('0x1'));exports['getString']=function(_0x56910e,_0x2d8853,_0x173417){var _0x4433e8=[];if(_0x56910e[_0x76d0('0x2')]>0x0){var _0x196b6d=_[_0x76d0('0x3')](_0x56910e,['id']);for(var _0x5733ef=0x0;_0x5733ef<_0x196b6d['length'];_0x5733ef++){var _0x501072=_0x196b6d[_0x5733ef];if(_0x501072[_0x76d0('0x4')]===_0x76d0('0x5')){_0x4433e8[_0x76d0('0x6')](_0x501072[_0x76d0('0x7')]);}else if(_0x501072[_0x76d0('0x4')]===_0x76d0('0x8')&&_0x501072[_0x76d0('0x9')]){_0x2d8853[_0x501072['variableName']]&&_0x4433e8['push'](_0x2d8853[_0x501072[_0x76d0('0x9')]][_0x76d0('0xa')]());}else if(_0x501072[_0x76d0('0x4')]===_0x76d0('0xb')&&_0x501072[_0x76d0('0xc')]&&_0x501072[_0x76d0('0xc')][_0x76d0('0xd')]){_0x2d8853[_0x501072[_0x76d0('0xc')][_0x76d0('0xd')][_0x76d0('0xe')]()]&&_0x4433e8[_0x76d0('0x6')](_0x2d8853[_0x501072[_0x76d0('0xc')][_0x76d0('0xd')][_0x76d0('0xe')]()][_0x76d0('0xa')]());}else if(_0x501072['type']===_0x76d0('0xf')){if(_0x501072['keyType']===_0x76d0('0x5')&&_0x501072['key']){_0x4433e8[_0x76d0('0x6')](util[_0x76d0('0x10')](_0x76d0('0x11'),_0x501072[_0x76d0('0x12')],_0x501072[_0x76d0('0x13')]));}else if(_0x501072[_0x76d0('0x14')]===_0x76d0('0x8')&&_0x501072['variableName']&&_0x501072[_0x76d0('0x12')]){_0x2d8853[_0x501072[_0x76d0('0x9')]]&&_0x4433e8[_0x76d0('0x6')](util['format'](_0x76d0('0x11'),_0x501072['key'],_0x2d8853[_0x501072[_0x76d0('0x9')]]));}else if(_0x501072['keyType']===_0x76d0('0xb')&&_0x501072['Variable']&&_0x501072[_0x76d0('0xc')]['name']&&_0x501072['key']){_0x2d8853[_0x501072[_0x76d0('0xc')]['name'][_0x76d0('0xe')]()]&&_0x4433e8[_0x76d0('0x6')](util[_0x76d0('0x10')]('%s:\x20%s',_0x501072['key'],_0x2d8853[_0x501072[_0x76d0('0xc')][_0x76d0('0xd')][_0x76d0('0xe')]()]));}}}}return _0x4433e8[_0x76d0('0x15')](_0x173417);};exports[_0x76d0('0x16')]=function(_0x315219){var _0x306451=_0x315219['slice'](-0x1);if(_0x306451==='/'){_0x315219=_0x315219[_0x76d0('0x17')](0x0,_0x315219[_0x76d0('0x18')](_0x306451));}return _0x315219;};exports[_0x76d0('0x19')]=function(_0x4f2831){if(!_[_0x76d0('0x1a')](_0x4f2831)&&_0x4f2831!==''){var _0x5daef1=/^(([^<>()\[\]\\.,;:\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 _0x5daef1[_0x76d0('0x1b')](String(_0x4f2831)[_0x76d0('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x5fd6=['customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy','length','type','string','content','variable','variableName','push','toString'];(function(_0x47d060,_0x4a2b1d){var _0xb2d051=function(_0x3434e7){while(--_0x3434e7){_0x47d060['push'](_0x47d060['shift']());}};_0xb2d051(++_0x4a2b1d);}(_0x5fd6,0x18a));var _0x65fd=function(_0x42a33a,_0x5a3975){_0x42a33a=_0x42a33a-0x0;var _0x21cdc6=_0x5fd6[_0x42a33a];return _0x21cdc6;};'use strict';var _=require(_0x65fd('0x0'));var util=require('util');exports[_0x65fd('0x1')]=function(_0xaac7fa,_0x23b5ab,_0x3ff53f){var _0x215246=[];if(_0xaac7fa['length']>0x0){var _0x577bdf=_[_0x65fd('0x2')](_0xaac7fa,['id']);for(var _0xb4a9f5=0x0;_0xb4a9f5<_0x577bdf[_0x65fd('0x3')];_0xb4a9f5++){var _0x33efa3=_0x577bdf[_0xb4a9f5];if(_0x33efa3[_0x65fd('0x4')]===_0x65fd('0x5')){_0x215246['push'](_0x33efa3[_0x65fd('0x6')]);}else if(_0x33efa3[_0x65fd('0x4')]===_0x65fd('0x7')&&_0x33efa3[_0x65fd('0x8')]){_0x23b5ab[_0x33efa3['variableName']]&&_0x215246[_0x65fd('0x9')](_0x23b5ab[_0x33efa3[_0x65fd('0x8')]][_0x65fd('0xa')]());}else if(_0x33efa3['type']===_0x65fd('0xb')&&_0x33efa3[_0x65fd('0xc')]&&_0x33efa3[_0x65fd('0xc')][_0x65fd('0xd')]){_0x23b5ab[_0x33efa3[_0x65fd('0xc')]['name'][_0x65fd('0xe')]()]&&_0x215246['push'](_0x23b5ab[_0x33efa3[_0x65fd('0xc')][_0x65fd('0xd')][_0x65fd('0xe')]()][_0x65fd('0xa')]());}else if(_0x33efa3[_0x65fd('0x4')]==='keyValue'){if(_0x33efa3[_0x65fd('0xf')]===_0x65fd('0x5')&&_0x33efa3[_0x65fd('0x10')]){_0x215246[_0x65fd('0x9')](util[_0x65fd('0x11')](_0x65fd('0x12'),_0x33efa3['key'],_0x33efa3[_0x65fd('0x13')]));}else if(_0x33efa3[_0x65fd('0xf')]===_0x65fd('0x7')&&_0x33efa3['variableName']&&_0x33efa3[_0x65fd('0x10')]){_0x23b5ab[_0x33efa3['variableName']]&&_0x215246['push'](util[_0x65fd('0x11')](_0x65fd('0x12'),_0x33efa3[_0x65fd('0x10')],_0x23b5ab[_0x33efa3[_0x65fd('0x8')]]));}else if(_0x33efa3[_0x65fd('0xf')]===_0x65fd('0xb')&&_0x33efa3[_0x65fd('0xc')]&&_0x33efa3[_0x65fd('0xc')][_0x65fd('0xd')]&&_0x33efa3[_0x65fd('0x10')]){_0x23b5ab[_0x33efa3[_0x65fd('0xc')][_0x65fd('0xd')][_0x65fd('0xe')]()]&&_0x215246[_0x65fd('0x9')](util['format'](_0x65fd('0x12'),_0x33efa3[_0x65fd('0x10')],_0x23b5ab[_0x33efa3[_0x65fd('0xc')][_0x65fd('0xd')][_0x65fd('0xe')]()]));}}}}return _0x215246[_0x65fd('0x14')](_0x3ff53f);};exports[_0x65fd('0x15')]=function(_0x4407fd){var _0x2d1b6f=_0x4407fd[_0x65fd('0x16')](-0x1);if(_0x2d1b6f==='/'){_0x4407fd=_0x4407fd['substring'](0x0,_0x4407fd[_0x65fd('0x17')](_0x2d1b6f));}return _0x4407fd;};exports[_0x65fd('0x18')]=function(_0x54d1b1){if(!_[_0x65fd('0x19')](_0x54d1b1)&&_0x54d1b1!==''){var _0x3580cf=/^(([^<>()\[\]\\.,;:\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 _0x3580cf[_0x65fd('0x1a')](String(_0x54d1b1)[_0x65fd('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 1b623b8..c2d3ee6 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 _0xfa4c=['user:%s','lastevent','toUpperCase','calleridnum','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','string','idField','content','type','variable','variableName','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Subjects','%s/webservice.php','remoteUri','sessionName','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','GET','format','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','userId','admin','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','query','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','phone','accessKey','getchallenge','POST','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','trigger:browser:url','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum'];(function(_0x5c7055,_0x550d42){var _0x20d196=function(_0x47e15e){while(--_0x47e15e){_0x5c7055['push'](_0x5c7055['shift']());}};_0x20d196(++_0x550d42);}(_0xfa4c,0x124));var _0xcfa4=function(_0x4e72a5,_0x59d207){_0x4e72a5=_0x4e72a5-0x0;var _0x5c608f=_0xfa4c[_0x4e72a5];return _0x5c608f;};'use strict';var _=require(_0xcfa4('0x0'));var rp=require('request-promise');var BPromise=require(_0xcfa4('0x1'));var md5=require(_0xcfa4('0x2'));var util=require('util');var Redis=require(_0xcfa4('0x3'));var intUtil=require(_0xcfa4('0x4'));var config=require(_0xcfa4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0xcfa4('0x6')]=_[_0xcfa4('0x7')](config[_0xcfa4('0x6')],{'host':_0xcfa4('0x8'),'port':0x18eb});var io=require(_0xcfa4('0x9'))(new Redis(config['redis']));function emit(_0x207ab9,_0x5869f5,_0x2d285f){io['to'](_0x207ab9)[_0xcfa4('0xa')](_0x5869f5,_0x2d285f);}function getCustomFields(_0x52be75,_0x3de6d8){var _0xffaff5={};if(_0x52be75[_0xcfa4('0xb')]>0x0){_[_0xcfa4('0xc')](_0x52be75,function(_0x365bed){if(_0x365bed['type']===_0xcfa4('0xd')&&_0x365bed[_0xcfa4('0xe')]){_0xffaff5[_0x365bed[_0xcfa4('0xe')]]=_0x365bed[_0xcfa4('0xf')]['toString']();}else if(_0x365bed[_0xcfa4('0x10')]===_0xcfa4('0x11')&&_0x365bed[_0xcfa4('0x12')]&&_0x365bed[_0xcfa4('0xe')]&&_0x3de6d8[_0x365bed['variableName']]){_0xffaff5[_0x365bed[_0xcfa4('0xe')]]=_0x3de6d8[_0x365bed[_0xcfa4('0x12')]]['toString']();}else if(_0x365bed['type']==='customVariable'&&_0x365bed[_0xcfa4('0x13')]&&_0x365bed['Variable'][_0xcfa4('0x14')]&&_0x365bed[_0xcfa4('0xe')]&&_0x3de6d8[_0x365bed[_0xcfa4('0x13')][_0xcfa4('0x14')]['toLowerCase']()]){_0xffaff5[_0x365bed[_0xcfa4('0xe')]]=_0x3de6d8[_0x365bed[_0xcfa4('0x13')]['name'][_0xcfa4('0x15')]()]['toString']();}});}return _0xffaff5;}function createTicket(_0x2f0368,_0x3b98c9,_0x4a0c6d,_0x40a064,_0x2cb598,_0x48d9f2,_0x221866){logger[_0xcfa4('0x16')]('Creating\x20new\x20ticket...');var _0x116c69=_[_0xcfa4('0x17')]({'parent_id':'','assigned_user_id':_0x3b98c9['id'],'ticketpriorities':_0xcfa4('0x18'),'ticketstatus':_0xcfa4('0x19'),'ticket_title':intUtil[_0xcfa4('0x1a')](_0x40a064[_0xcfa4('0x1b')],_0x2cb598,'\x20'),'description':intUtil[_0xcfa4('0x1a')](_0x40a064['Descriptions'],_0x2cb598,'\x0a'),'contact_id':_0x4a0c6d['id']},getCustomFields(_0x48d9f2,_0x2cb598));var _0x20268f={'method':'POST','uri':util['format'](_0xcfa4('0x1c'),_0x2f0368[_0xcfa4('0x1d')]),'form':{'operation':'create','username':_0x2f0368['username'],'sessionName':_0x221866[_0xcfa4('0x1e')],'elementType':'HelpDesk','element':JSON[_0xcfa4('0x1f')](_0x116c69)},'json':!![]};return request(_0x20268f)[_0xcfa4('0x20')](function(_0x4cd016){if(_0x4cd016[_0xcfa4('0x21')]){return BPromise[_0xcfa4('0x22')]({'id':_0x4cd016[_0xcfa4('0x23')]['id']});}else{throw new Error(util['format'](_0xcfa4('0x24'),JSON[_0xcfa4('0x1f')](_0x4cd016[_0xcfa4('0x25')])));}})[_0xcfa4('0x26')](function(_0x242d53){var _0x54e92a=_0x242d53[_0xcfa4('0x27')]||0x1f4;logger[_0xcfa4('0x25')](_0xcfa4('0x28'),_0xcfa4('0x29'),_0x54e92a,JSON[_0xcfa4('0x1f')](_0x242d53));});}function getUser(_0x23d457,_0x51be36,_0x407d95){if(intUtil[_0xcfa4('0x2a')](_0x51be36)){logger['info']('Getting\x20agent\x20with\x20email',_0x51be36);return request({'method':_0xcfa4('0x2b'),'uri':util[_0xcfa4('0x2c')](_0xcfa4('0x1c'),_0x23d457[_0xcfa4('0x1d')]),'qs':{'operation':'query','username':_0x23d457[_0xcfa4('0x2d')],'sessionName':_0x407d95[_0xcfa4('0x1e')],'query':util['format'](_0xcfa4('0x2e'),_0x51be36)},'json':!![]})[_0xcfa4('0x20')](function(_0x82f226){if(_0x82f226[_0xcfa4('0x21')]&&_0x82f226[_0xcfa4('0x23')][_0xcfa4('0xb')]){logger['info'](_0xcfa4('0x2f'));return BPromise[_0xcfa4('0x22')]({'id':_0x82f226[_0xcfa4('0x23')][0x0]['id'],'email':_0x82f226[_0xcfa4('0x23')][0x0][_0xcfa4('0x30')],'name':_0x82f226['result'][0x0]['first_name']+'\x20'+_0x82f226[_0xcfa4('0x23')][_0xcfa4('0x31')]});}else{logger[_0xcfa4('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xcfa4('0x22')]({'id':_0x407d95[_0xcfa4('0x32')],'email':_0x23d457['username'],'name':_0xcfa4('0x33')});}})['catch'](function(_0x469369){var _0x72a6f8=_0x469369[_0xcfa4('0x27')]||0x1f4;logger[_0xcfa4('0x25')](_0xcfa4('0x28'),_0xcfa4('0x34'),_0x72a6f8,JSON['stringify'](_0x469369));});}else{logger[_0xcfa4('0x16')](_0xcfa4('0x35'));return BPromise['resolve']({'id':_0x407d95[_0xcfa4('0x32')],'email':_0x23d457[_0xcfa4('0x2d')],'name':_0xcfa4('0x33')})[_0xcfa4('0x26')](function(_0x2dcdf3){var _0xd4e5c4=_0x2dcdf3[_0xcfa4('0x27')]||0x1f4;logger[_0xcfa4('0x25')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xcfa4('0x34'),_0xd4e5c4,JSON[_0xcfa4('0x1f')](_0x2dcdf3));});}}function getEndUser(_0x86ecaf,_0x2cfbbe,_0x112047,_0x264a12){logger[_0xcfa4('0x16')](_0xcfa4('0x36'),_0x112047);return request({'method':'GET','uri':util['format'](_0xcfa4('0x1c'),_0x86ecaf['remoteUri']),'qs':{'operation':_0xcfa4('0x37'),'username':_0x86ecaf['username'],'sessionName':_0x264a12['sessionName'],'query':util[_0xcfa4('0x2c')]('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;',_0x112047,_0x112047,_0x112047,_0x112047,_0x112047)},'json':!![]})[_0xcfa4('0x20')](function(_0x341636){if(_0x341636[_0xcfa4('0x21')]&&_0x341636['result'][_0xcfa4('0xb')]){logger[_0xcfa4('0x16')](_0xcfa4('0x38'));return BPromise[_0xcfa4('0x22')]({'id':_0x341636[_0xcfa4('0x23')][0x0]['id'],'name':_0x341636[_0xcfa4('0x23')][0x0][_0xcfa4('0x39')]+'\x20'+_0x341636[_0xcfa4('0x23')][0x0][_0xcfa4('0x3a')],'phone':_0x112047});}else{logger[_0xcfa4('0x16')](_0xcfa4('0x3b'));return request({'method':'POST','uri':util[_0xcfa4('0x2c')]('%s/webservice.php',_0x86ecaf[_0xcfa4('0x1d')]),'form':{'operation':_0xcfa4('0x3c'),'sessionName':_0x264a12['sessionName'],'elementType':_0xcfa4('0x3d'),'element':JSON['stringify']({'lastname':_0x2cfbbe,'phone':_0x112047,'assigned_user_id':'\x20'})},'json':!![]})[_0xcfa4('0x20')](function(_0x5d9725){logger[_0xcfa4('0x16')](_0xcfa4('0x3e'));return BPromise[_0xcfa4('0x22')]({'id':_0x5d9725[_0xcfa4('0x23')]['id'],'name':_0x5d9725[_0xcfa4('0x23')][_0xcfa4('0x3a')],'phone':_0x5d9725[_0xcfa4('0x23')][_0xcfa4('0x3f')]});})[_0xcfa4('0x26')](function(_0x134743){var _0x223705=_0x134743[_0xcfa4('0x27')]||0x1f4;logger[_0xcfa4('0x25')](_0xcfa4('0x28'),'getEndUser',_0x223705,JSON[_0xcfa4('0x1f')](_0x134743));});}});}function getConnection(_0x5ed63e){var _0xf39cdf=_0x5ed63e[_0xcfa4('0x2d')];var _0x5b9162=_0x5ed63e[_0xcfa4('0x40')];return request({'method':'GET','uri':util[_0xcfa4('0x2c')](_0xcfa4('0x1c'),_0x5ed63e[_0xcfa4('0x1d')]),'qs':{'operation':_0xcfa4('0x41'),'username':_0xf39cdf},'json':!![]})[_0xcfa4('0x20')](function(_0x4b2ddd){if(_0x4b2ddd['success']){return request({'method':_0xcfa4('0x42'),'uri':util[_0xcfa4('0x2c')](_0xcfa4('0x1c'),_0x5ed63e[_0xcfa4('0x1d')]),'form':{'operation':'login','username':_0xf39cdf,'accessKey':md5(_0x4b2ddd[_0xcfa4('0x23')]['token']+_0x5b9162)},'json':!![]});}})[_0xcfa4('0x20')](function(_0x2b006e){if(_0x2b006e[_0xcfa4('0x21')]){return BPromise[_0xcfa4('0x22')](_0x2b006e['result']);}else{throw new Error(util[_0xcfa4('0x2c')](_0xcfa4('0x43'),_0x5ed63e['id']));}})[_0xcfa4('0x26')](function(_0xac6210){var _0x1ef641=_0xac6210[_0xcfa4('0x27')]||0x1f4;logger[_0xcfa4('0x25')](_0xcfa4('0x28'),_0xcfa4('0x44'),_0x1ef641,JSON[_0xcfa4('0x1f')](_0xac6210));});}function request(_0x3d1261){logger['info']('[HTTP]',JSON[_0xcfa4('0x1f')](_0x3d1261));return rp(_0x3d1261);}exports[_0xcfa4('0x45')]=function(_0x1f4ff0,_0x52de4b,_0x3021aa,_0x46571d,_0x5d86c5,_0x47ebd4){var _0x4896b3,_0x36b350,_0x6809d7,_0x301b0e;_0x47ebd4[_0xcfa4('0x1d')]=intUtil[_0xcfa4('0x46')](_0x47ebd4['remoteUri']);if(_0x5d86c5&&_0x5d86c5[_0xcfa4('0x47')]){logger[_0xcfa4('0x16')]('[QUEUE]',_0xcfa4('0x48'));_0x52de4b['recordingURL']=util[_0xcfa4('0x2c')](_0xcfa4('0x49'),_0x47ebd4[_0xcfa4('0x4a')],_0x52de4b[_0xcfa4('0x4b')],md5(_0x52de4b['uniqueid']));}else{_0x52de4b[_0xcfa4('0x4c')]='';}return getConnection(_0x47ebd4)['then'](function(_0x32d064){_0x301b0e=_0x32d064;return getUser(_0x47ebd4,_0x46571d[_0xcfa4('0x4d')],_0x301b0e);})['then'](function(_0x1251be){_0x4896b3=_0x1251be;logger[_0xcfa4('0x16')](_0xcfa4('0x4e'),_0x4896b3['id']);return getEndUser(_0x47ebd4,_0x52de4b[_0xcfa4('0x4f')],_0x52de4b['calleridnum'],_0x301b0e);})[_0xcfa4('0x20')](function(_0x459a02){_0x36b350=_0x459a02;logger['info'](_0xcfa4('0x50'),_0x36b350['id']);return createTicket(_0x47ebd4,_0x4896b3,_0x36b350,_0x3021aa,_0x52de4b,_0x3021aa[_0xcfa4('0x51')],_0x301b0e);})[_0xcfa4('0x20')](function(_0x544fb0){_0x6809d7=_0x544fb0;logger[_0xcfa4('0x16')](_0xcfa4('0x52'));logger[_0xcfa4('0x16')](_0xcfa4('0x53'),_0x6809d7['id']);var _0x341815=util[_0xcfa4('0x2c')](_0xcfa4('0x54'),_0x47ebd4[_0xcfa4('0x1d')],_[_0xcfa4('0x55')](_0x6809d7['id'],'x')[0x1]);logger['info'](_0xcfa4('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcfa4('0x2c')]('user:%s',_0x46571d[_0xcfa4('0x14')]),_0xcfa4('0x57'),{'uri':_0x341815});})['catch'](function(_0x21082e){logger[_0xcfa4('0x25')]('[QUEUE]',JSON['stringify'](_0x21082e));});};exports['outbound']=function(_0x5f4555,_0x457186,_0x172e8a,_0xd4bc1b,_0x276298,_0x31f86e,_0xfcefa4){var _0x25da7b,_0x2d1022,_0x292465,_0x26f7af;_0x31f86e['remoteUri']=intUtil[_0xcfa4('0x46')](_0x31f86e[_0xcfa4('0x1d')]);_0x31f86e[_0xcfa4('0x4a')]=intUtil[_0xcfa4('0x46')](_0x31f86e[_0xcfa4('0x4a')]);if(_0xfcefa4&&_0xfcefa4[_0xcfa4('0x58')]&&_0xfcefa4['recordingFormat']!=='none'){logger['info'](_0xcfa4('0x59'),_0xcfa4('0x48'));_0x457186[_0xcfa4('0x4c')]=util[_0xcfa4('0x2c')](_0xcfa4('0x49'),_0x31f86e[_0xcfa4('0x4a')],_0x457186[_0xcfa4('0x4b')],md5(_0x457186[_0xcfa4('0x4b')]));}return getConnection(_0x31f86e)['then'](function(_0x2b5973){_0x26f7af=_0x2b5973;return getUser(_0x31f86e,_0xd4bc1b[_0xcfa4('0x4d')],_0x26f7af);})[_0xcfa4('0x20')](function(_0x44d514){_0x25da7b=_0x44d514;logger[_0xcfa4('0x16')](_0xcfa4('0x4e'),_0x25da7b['id']);return getEndUser(_0x31f86e,_0x457186[_0xcfa4('0x5a')],_0x457186[_0xcfa4('0x5b')],_0x26f7af);})[_0xcfa4('0x20')](function(_0x3136e7){_0x2d1022=_0x3136e7;logger[_0xcfa4('0x16')](_0xcfa4('0x50'),_0x2d1022['id']);return createTicket(_0x31f86e,_0x25da7b,_0x2d1022,_0x172e8a,_0x457186,_0x172e8a[_0xcfa4('0x51')],_0x26f7af);})[_0xcfa4('0x20')](function(_0x49444a){_0x292465=_0x49444a;logger[_0xcfa4('0x16')](_0xcfa4('0x52'));logger['info'](_0xcfa4('0x53'),_0x292465['id']);var _0x457f5f=util[_0xcfa4('0x2c')](_0xcfa4('0x54'),_0x31f86e[_0xcfa4('0x1d')],_[_0xcfa4('0x55')](_0x292465['id'],'x')[0x1]);logger[_0xcfa4('0x16')](_0xcfa4('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcfa4('0x2c')](_0xcfa4('0x5c'),_0xd4bc1b['name']),_0xcfa4('0x57'),{'uri':_0x457f5f});})[_0xcfa4('0x26')](function(_0x6d9328){logger[_0xcfa4('0x25')]('[OUTBOUND]',JSON['stringify'](_0x6d9328));});};exports['unmanaged']=function(_0x28bc7c,_0x372bd5,_0x4c134f,_0x4412f7,_0x2feadd,_0x2f6436){var _0x2ff1e6,_0x4032fc,_0x4dc8b0,_0x477a37;_0x2f6436[_0xcfa4('0x1d')]=intUtil['stripTrailingSlash'](_0x2f6436[_0xcfa4('0x1d')]);_0x2f6436[_0xcfa4('0x4a')]=intUtil[_0xcfa4('0x46')](_0x2f6436[_0xcfa4('0x4a')]);if(_0x2feadd&&_0x2feadd[_0xcfa4('0x47')]){logger[_0xcfa4('0x16')]('['+_0x372bd5[_0xcfa4('0x5d')][_0xcfa4('0x5e')]()+']',_0xcfa4('0x48'));_0x372bd5[_0xcfa4('0x4c')]=util[_0xcfa4('0x2c')](_0xcfa4('0x49'),_0x2f6436['serverUrl'],_0x372bd5['uniqueid'],md5(_0x372bd5[_0xcfa4('0x4b')]));}else{_0x372bd5['recordingURL']='';}return getConnection(_0x2f6436)[_0xcfa4('0x20')](function(_0x74003){_0x477a37=_0x74003;return getUser(_0x2f6436,'',_0x477a37);})['then'](function(_0x18c0b4){_0x2ff1e6=_0x18c0b4;logger[_0xcfa4('0x16')]('The\x20User\x20ID\x20is:',_0x2ff1e6['id']);return getEndUser(_0x2f6436,_0x372bd5[_0xcfa4('0x4f')],_0x372bd5[_0xcfa4('0x5f')],_0x477a37);})[_0xcfa4('0x20')](function(_0x5e6d6d){_0x4032fc=_0x5e6d6d;logger[_0xcfa4('0x16')]('The\x20Enduser\x20ID\x20is:',_0x4032fc['id']);return createTicket(_0x2f6436,_0x2ff1e6,_0x4032fc,_0x4c134f,_0x372bd5,_0x4c134f['Fields'],_0x477a37);})[_0xcfa4('0x20')](function(_0x23b60a){_0x4dc8b0=_0x23b60a;logger[_0xcfa4('0x16')](_0xcfa4('0x52'));logger['info'](_0xcfa4('0x53'),_0x4dc8b0['id']);})[_0xcfa4('0x26')](function(_0x59ecf3){logger[_0xcfa4('0x25')]('['+_0x372bd5['lastevent'][_0xcfa4('0x5e')]()+']',JSON[_0xcfa4('0x1f')](_0x59ecf3));});}; \ No newline at end of file +var _0x9146=['lastevent','toUpperCase','calleridnum','lodash','bluebird','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','emit','length','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','getString','Descriptions','POST','format','remoteUri','create','username','sessionName','HelpDesk','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','first_name','statusCode','getUser','userId','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!','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','token','[HTTP]','queue','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridnum','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged'];(function(_0x472ac2,_0x45a2db){var _0x15265e=function(_0x3842ba){while(--_0x3842ba){_0x472ac2['push'](_0x472ac2['shift']());}};_0x15265e(++_0x45a2db);}(_0x9146,0x187));var _0x6914=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x9146[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0x6914('0x0'));var rp=require('request-promise');var BPromise=require(_0x6914('0x1'));var md5=require('md5');var util=require(_0x6914('0x2'));var Redis=require(_0x6914('0x3'));var intUtil=require(_0x6914('0x4'));var config=require(_0x6914('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x6914('0x6')]=_[_0x6914('0x7')](config[_0x6914('0x6')],{'host':_0x6914('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4aee62,_0xf550d2,_0x437660){io['to'](_0x4aee62)[_0x6914('0x9')](_0xf550d2,_0x437660);}function getCustomFields(_0x4feb71,_0x7d36b9){var _0x851a83={};if(_0x4feb71[_0x6914('0xa')]>0x0){_[_0x6914('0xb')](_0x4feb71,function(_0x370418){if(_0x370418[_0x6914('0xc')]===_0x6914('0xd')&&_0x370418[_0x6914('0xe')]){_0x851a83[_0x370418[_0x6914('0xe')]]=_0x370418[_0x6914('0xf')][_0x6914('0x10')]();}else if(_0x370418[_0x6914('0xc')]==='variable'&&_0x370418[_0x6914('0x11')]&&_0x370418['idField']&&_0x7d36b9[_0x370418[_0x6914('0x11')]]){_0x851a83[_0x370418[_0x6914('0xe')]]=_0x7d36b9[_0x370418[_0x6914('0x11')]][_0x6914('0x10')]();}else if(_0x370418['type']===_0x6914('0x12')&&_0x370418[_0x6914('0x13')]&&_0x370418[_0x6914('0x13')][_0x6914('0x14')]&&_0x370418['idField']&&_0x7d36b9[_0x370418['Variable'][_0x6914('0x14')]['toLowerCase']()]){_0x851a83[_0x370418[_0x6914('0xe')]]=_0x7d36b9[_0x370418[_0x6914('0x13')][_0x6914('0x14')][_0x6914('0x15')]()]['toString']();}});}return _0x851a83;}function createTicket(_0x47a1c0,_0x24c036,_0x239f7a,_0x1016ef,_0x4c4634,_0x4077a3,_0x8c9cb0){logger[_0x6914('0x16')]('Creating\x20new\x20ticket...');var _0x13de0f=_[_0x6914('0x17')]({'parent_id':'','assigned_user_id':_0x24c036['id'],'ticketpriorities':_0x6914('0x18'),'ticketstatus':_0x6914('0x19'),'ticket_title':intUtil[_0x6914('0x1a')](_0x1016ef['Subjects'],_0x4c4634,'\x20'),'description':intUtil[_0x6914('0x1a')](_0x1016ef[_0x6914('0x1b')],_0x4c4634,'\x0a'),'contact_id':_0x239f7a['id']},getCustomFields(_0x4077a3,_0x4c4634));var _0x1f6d88={'method':_0x6914('0x1c'),'uri':util[_0x6914('0x1d')]('%s/webservice.php',_0x47a1c0[_0x6914('0x1e')]),'form':{'operation':_0x6914('0x1f'),'username':_0x47a1c0[_0x6914('0x20')],'sessionName':_0x8c9cb0[_0x6914('0x21')],'elementType':_0x6914('0x22'),'element':JSON['stringify'](_0x13de0f)},'json':!![]};return request(_0x1f6d88)[_0x6914('0x23')](function(_0x42b820){if(_0x42b820['success']){return BPromise[_0x6914('0x24')]({'id':_0x42b820[_0x6914('0x25')]['id']});}else{throw new Error(util[_0x6914('0x1d')](_0x6914('0x26'),JSON[_0x6914('0x27')](_0x42b820[_0x6914('0x28')])));}})[_0x6914('0x29')](function(_0x547b36){var _0x33db96=_0x547b36['statusCode']||0x1f4;logger[_0x6914('0x28')](_0x6914('0x2a'),'createTicket',_0x33db96,JSON[_0x6914('0x27')](_0x547b36));});}function getUser(_0x171f8f,_0x3dd555,_0x18c874){if(intUtil[_0x6914('0x2b')](_0x3dd555)){logger[_0x6914('0x16')](_0x6914('0x2c'),_0x3dd555);return request({'method':_0x6914('0x2d'),'uri':util[_0x6914('0x1d')](_0x6914('0x2e'),_0x171f8f[_0x6914('0x1e')]),'qs':{'operation':_0x6914('0x2f'),'username':_0x171f8f['username'],'sessionName':_0x18c874[_0x6914('0x21')],'query':util[_0x6914('0x1d')](_0x6914('0x30'),_0x3dd555)},'json':!![]})['then'](function(_0x32386e){if(_0x32386e[_0x6914('0x31')]&&_0x32386e[_0x6914('0x25')][_0x6914('0xa')]){logger['info'](_0x6914('0x32'));return BPromise['resolve']({'id':_0x32386e['result'][0x0]['id'],'email':_0x32386e['result'][0x0][_0x6914('0x33')],'name':_0x32386e[_0x6914('0x25')][0x0][_0x6914('0x34')]+'\x20'+_0x32386e[_0x6914('0x25')]['last_name']});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6914('0x24')]({'id':_0x18c874['userId'],'email':_0x171f8f[_0x6914('0x20')],'name':'admin'});}})[_0x6914('0x29')](function(_0x3f0315){var _0x3ff85e=_0x3f0315[_0x6914('0x35')]||0x1f4;logger[_0x6914('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x6914('0x36'),_0x3ff85e,JSON['stringify'](_0x3f0315));});}else{logger[_0x6914('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6914('0x24')]({'id':_0x18c874[_0x6914('0x37')],'email':_0x171f8f[_0x6914('0x20')],'name':_0x6914('0x38')})[_0x6914('0x29')](function(_0x4fb2d0){var _0x5b491e=_0x4fb2d0[_0x6914('0x35')]||0x1f4;logger[_0x6914('0x28')](_0x6914('0x2a'),_0x6914('0x36'),_0x5b491e,JSON[_0x6914('0x27')](_0x4fb2d0));});}}function getEndUser(_0x56ae92,_0x301d10,_0x5d589d,_0x5d5ca2){logger[_0x6914('0x16')](_0x6914('0x39'),_0x5d589d);return request({'method':_0x6914('0x2d'),'uri':util[_0x6914('0x1d')]('%s/webservice.php',_0x56ae92['remoteUri']),'qs':{'operation':_0x6914('0x2f'),'username':_0x56ae92[_0x6914('0x20')],'sessionName':_0x5d5ca2[_0x6914('0x21')],'query':util[_0x6914('0x1d')](_0x6914('0x3a'),_0x5d589d,_0x5d589d,_0x5d589d,_0x5d589d,_0x5d589d)},'json':!![]})[_0x6914('0x23')](function(_0x27d6f2){if(_0x27d6f2['success']&&_0x27d6f2[_0x6914('0x25')]['length']){logger[_0x6914('0x16')](_0x6914('0x3b'));return BPromise[_0x6914('0x24')]({'id':_0x27d6f2[_0x6914('0x25')][0x0]['id'],'name':_0x27d6f2[_0x6914('0x25')][0x0]['firstname']+'\x20'+_0x27d6f2[_0x6914('0x25')][0x0]['lastname'],'phone':_0x5d589d});}else{logger[_0x6914('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x6914('0x1c'),'uri':util[_0x6914('0x1d')](_0x6914('0x2e'),_0x56ae92[_0x6914('0x1e')]),'form':{'operation':_0x6914('0x1f'),'sessionName':_0x5d5ca2[_0x6914('0x21')],'elementType':_0x6914('0x3c'),'element':JSON[_0x6914('0x27')]({'lastname':_0x301d10,'phone':_0x5d589d,'assigned_user_id':'\x20'})},'json':!![]})[_0x6914('0x23')](function(_0x13c0a1){logger[_0x6914('0x16')](_0x6914('0x3d'));return BPromise[_0x6914('0x24')]({'id':_0x13c0a1[_0x6914('0x25')]['id'],'name':_0x13c0a1[_0x6914('0x25')][_0x6914('0x3e')],'phone':_0x13c0a1[_0x6914('0x25')][_0x6914('0x3f')]});})[_0x6914('0x29')](function(_0x50a956){var _0xca1bfe=_0x50a956[_0x6914('0x35')]||0x1f4;logger[_0x6914('0x28')](_0x6914('0x2a'),_0x6914('0x40'),_0xca1bfe,JSON[_0x6914('0x27')](_0x50a956));});}});}function getConnection(_0x30507d){var _0x251d89=_0x30507d['username'];var _0x423a58=_0x30507d[_0x6914('0x41')];return request({'method':_0x6914('0x2d'),'uri':util[_0x6914('0x1d')](_0x6914('0x2e'),_0x30507d[_0x6914('0x1e')]),'qs':{'operation':'getchallenge','username':_0x251d89},'json':!![]})[_0x6914('0x23')](function(_0x4d489c){if(_0x4d489c[_0x6914('0x31')]){return request({'method':_0x6914('0x1c'),'uri':util[_0x6914('0x1d')](_0x6914('0x2e'),_0x30507d[_0x6914('0x1e')]),'form':{'operation':'login','username':_0x251d89,'accessKey':md5(_0x4d489c[_0x6914('0x25')][_0x6914('0x42')]+_0x423a58)},'json':!![]});}})['then'](function(_0x479b4a){if(_0x479b4a[_0x6914('0x31')]){return BPromise['resolve'](_0x479b4a[_0x6914('0x25')]);}else{throw new Error(util[_0x6914('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x30507d['id']));}})[_0x6914('0x29')](function(_0x1f1fc7){var _0x5f2988=_0x1f1fc7[_0x6914('0x35')]||0x1f4;logger[_0x6914('0x28')](_0x6914('0x2a'),'getConnection',_0x5f2988,JSON[_0x6914('0x27')](_0x1f1fc7));});}function request(_0x4b3f5c){logger[_0x6914('0x16')](_0x6914('0x43'),JSON[_0x6914('0x27')](_0x4b3f5c));return rp(_0x4b3f5c);}exports[_0x6914('0x44')]=function(_0x358cfd,_0x175595,_0x45ff7c,_0x547d45,_0x5a59c3,_0x3b720a){var _0x1516fc,_0x29abc4,_0x37298a,_0x272330;_0x3b720a['remoteUri']=intUtil['stripTrailingSlash'](_0x3b720a[_0x6914('0x1e')]);if(_0x5a59c3&&_0x5a59c3[_0x6914('0x45')]){logger[_0x6914('0x16')](_0x6914('0x46'),'Recording\x20is\x20enabled!');_0x175595[_0x6914('0x47')]=util[_0x6914('0x1d')](_0x6914('0x48'),_0x3b720a[_0x6914('0x49')],_0x175595[_0x6914('0x4a')],md5(_0x175595[_0x6914('0x4a')]));}else{_0x175595[_0x6914('0x47')]='';}return getConnection(_0x3b720a)[_0x6914('0x23')](function(_0x2db517){_0x272330=_0x2db517;return getUser(_0x3b720a,_0x547d45['email'],_0x272330);})[_0x6914('0x23')](function(_0x40538b){_0x1516fc=_0x40538b;logger['info'](_0x6914('0x4b'),_0x1516fc['id']);return getEndUser(_0x3b720a,_0x175595['calleridname'],_0x175595['calleridnum'],_0x272330);})['then'](function(_0x634dc7){_0x29abc4=_0x634dc7;logger[_0x6914('0x16')](_0x6914('0x4c'),_0x29abc4['id']);return createTicket(_0x3b720a,_0x1516fc,_0x29abc4,_0x45ff7c,_0x175595,_0x45ff7c[_0x6914('0x4d')],_0x272330);})['then'](function(_0x258d5c){_0x37298a=_0x258d5c;logger[_0x6914('0x16')](_0x6914('0x4e'));logger[_0x6914('0x16')](_0x6914('0x4f'),_0x37298a['id']);var _0x56a560=util[_0x6914('0x1d')](_0x6914('0x50'),_0x3b720a[_0x6914('0x1e')],_['split'](_0x37298a['id'],'x')[0x1]);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6914('0x1d')](_0x6914('0x51'),_0x547d45[_0x6914('0x14')]),_0x6914('0x52'),{'uri':_0x56a560});})[_0x6914('0x29')](function(_0x46c146){logger[_0x6914('0x28')](_0x6914('0x46'),JSON[_0x6914('0x27')](_0x46c146));});};exports[_0x6914('0x53')]=function(_0x16e744,_0x53d214,_0x236527,_0x9d7187,_0x3f2511,_0x5b1120,_0x3dfcbd){var _0x569293,_0x2312c3,_0x1a1533,_0x17966e;_0x5b1120['remoteUri']=intUtil[_0x6914('0x54')](_0x5b1120[_0x6914('0x1e')]);_0x5b1120[_0x6914('0x49')]=intUtil[_0x6914('0x54')](_0x5b1120[_0x6914('0x49')]);if(_0x3dfcbd&&_0x3dfcbd[_0x6914('0x55')]&&_0x3dfcbd[_0x6914('0x55')]!==_0x6914('0x56')){logger[_0x6914('0x16')](_0x6914('0x57'),_0x6914('0x58'));_0x53d214[_0x6914('0x47')]=util[_0x6914('0x1d')](_0x6914('0x48'),_0x5b1120[_0x6914('0x49')],_0x53d214[_0x6914('0x4a')],md5(_0x53d214[_0x6914('0x4a')]));}return getConnection(_0x5b1120)[_0x6914('0x23')](function(_0x28f8f8){_0x17966e=_0x28f8f8;return getUser(_0x5b1120,_0x9d7187[_0x6914('0x59')],_0x17966e);})[_0x6914('0x23')](function(_0x4da835){_0x569293=_0x4da835;logger[_0x6914('0x16')](_0x6914('0x4b'),_0x569293['id']);return getEndUser(_0x5b1120,_0x53d214['destcalleridname'],_0x53d214[_0x6914('0x5a')],_0x17966e);})[_0x6914('0x23')](function(_0x433a7d){_0x2312c3=_0x433a7d;logger[_0x6914('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2312c3['id']);return createTicket(_0x5b1120,_0x569293,_0x2312c3,_0x236527,_0x53d214,_0x236527['Fields'],_0x17966e);})[_0x6914('0x23')](function(_0xa089d0){_0x1a1533=_0xa089d0;logger[_0x6914('0x16')](_0x6914('0x4e'));logger[_0x6914('0x16')](_0x6914('0x4f'),_0x1a1533['id']);var _0x4456f4=util['format'](_0x6914('0x50'),_0x5b1120[_0x6914('0x1e')],_[_0x6914('0x5b')](_0x1a1533['id'],'x')[0x1]);logger['info'](_0x6914('0x57'),_0x6914('0x5c'));emit(util[_0x6914('0x1d')]('user:%s',_0x9d7187['name']),_0x6914('0x52'),{'uri':_0x4456f4});})[_0x6914('0x29')](function(_0x18064a){logger[_0x6914('0x28')]('[OUTBOUND]',JSON[_0x6914('0x27')](_0x18064a));});};exports[_0x6914('0x5d')]=function(_0x3cf5a9,_0x43c85b,_0x590d68,_0x15398a,_0x444de9,_0x5bf05a){var _0x126757,_0x53b14a,_0x1b8430,_0x584069;_0x5bf05a[_0x6914('0x1e')]=intUtil[_0x6914('0x54')](_0x5bf05a['remoteUri']);_0x5bf05a['serverUrl']=intUtil[_0x6914('0x54')](_0x5bf05a[_0x6914('0x49')]);if(_0x444de9&&_0x444de9[_0x6914('0x45')]){logger[_0x6914('0x16')]('['+_0x43c85b[_0x6914('0x5e')][_0x6914('0x5f')]()+']',_0x6914('0x58'));_0x43c85b[_0x6914('0x47')]=util[_0x6914('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bf05a[_0x6914('0x49')],_0x43c85b[_0x6914('0x4a')],md5(_0x43c85b[_0x6914('0x4a')]));}else{_0x43c85b[_0x6914('0x47')]='';}return getConnection(_0x5bf05a)[_0x6914('0x23')](function(_0x588088){_0x584069=_0x588088;return getUser(_0x5bf05a,'',_0x584069);})[_0x6914('0x23')](function(_0x23fd4f){_0x126757=_0x23fd4f;logger[_0x6914('0x16')](_0x6914('0x4b'),_0x126757['id']);return getEndUser(_0x5bf05a,_0x43c85b['calleridname'],_0x43c85b[_0x6914('0x60')],_0x584069);})[_0x6914('0x23')](function(_0x366870){_0x53b14a=_0x366870;logger[_0x6914('0x16')](_0x6914('0x4c'),_0x53b14a['id']);return createTicket(_0x5bf05a,_0x126757,_0x53b14a,_0x590d68,_0x43c85b,_0x590d68[_0x6914('0x4d')],_0x584069);})[_0x6914('0x23')](function(_0x4b42d7){_0x1b8430=_0x4b42d7;logger[_0x6914('0x16')](_0x6914('0x4e'));logger[_0x6914('0x16')](_0x6914('0x4f'),_0x1b8430['id']);})[_0x6914('0x29')](function(_0x1b43e9){logger[_0x6914('0x28')]('['+_0x43c85b[_0x6914('0x5e')][_0x6914('0x5f')]()+']',JSON[_0x6914('0x27')](_0x1b43e9));});}; \ 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 00c04f8..e8bdb70 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 _0x9567=['none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','defaults','localhost','redis','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','forEach','type','string','customField','toLowerCase','content','idField','variable','custom_fields','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x9567,0xdc));var _0x7956=function(_0x5cd8c2,_0x510877){_0x5cd8c2=_0x5cd8c2-0x0;var _0x22e4c6=_0x9567[_0x5cd8c2];return _0x22e4c6;};'use strict';var _=require(_0x7956('0x0'));var rp=require(_0x7956('0x1'));var md5=require(_0x7956('0x2'));var util=require(_0x7956('0x3'));var Redis=require(_0x7956('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x7956('0x5'))(_0x7956('0x6'));config['redis']=_[_0x7956('0x7')](config['redis'],{'host':_0x7956('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7956('0x9')]));function emit(_0x31b50d,_0x48b2b3,_0x3c213a){io['to'](_0x31b50d)['emit'](_0x48b2b3,_0x3c213a);}var headers={'Content-Type':_0x7956('0xa'),'Accept':_0x7956('0xa')};function getTicket(_0x53310c,_0x127891,_0xe825,_0x5919db,_0x1fd87b){logger[_0x7956('0xb')](_0x7956('0xc'));return request({'uri':util['format'](_0x7956('0xd'),_0x53310c[_0x7956('0xe')]),'method':_0x7956('0xf'),'body':{'ticket':_[_0x7956('0x10')]({'requester_id':_0xe825['id'],'submitter_id':_0x127891?_0x127891['id']:undefined,'assignee_id':_0x127891?_0x127891['id']:undefined,'tags':getTags(_0x5919db['Tags'],_0x7956('0x11')),'subject':intUtil[_0x7956('0x12')](_0x5919db[_0x7956('0x13')],_0x1fd87b,'\x20'),'description':intUtil['getString'](_0x5919db[_0x7956('0x14')],_0x1fd87b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7956('0x12')](_0x5919db[_0x7956('0x14')],_0x1fd87b,'\x0a')}},getCustomFields(_0x5919db[_0x7956('0x15')],_0x1fd87b))}})[_0x7956('0x16')](function(_0x3d952d){logger[_0x7956('0xb')](_0x7956('0x17'));return _0x3d952d[_0x7956('0x18')];});}function getUser(_0x6a6d78,_0x41d67a){if(intUtil[_0x7956('0x19')](_0x41d67a)){logger[_0x7956('0xb')](_0x7956('0x1a'),_0x41d67a);return request({'uri':util[_0x7956('0x1b')](_0x7956('0x1c'),_0x6a6d78['remoteUri']),'qs':{'query':util['format'](_0x7956('0x1d'),_0x41d67a)}})[_0x7956('0x16')](function(_0x5041a4){if(_0x5041a4[_0x7956('0x1e')]){logger['info'](_0x7956('0x1f'));return _[_0x7956('0x20')](_0x5041a4['results'],{'email':_0x41d67a,'role':_0x7956('0x21')});}else{logger[_0x7956('0xb')](_0x7956('0x22'));return request({'uri':util['format'](_0x7956('0x23'),_0x6a6d78['remoteUri'])})[_0x7956('0x16')](function(_0x5100d8){logger[_0x7956('0xb')](_0x7956('0x24'));return _0x5100d8[_0x7956('0x25')];});}});}else{logger[_0x7956('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7956('0x1b')](_0x7956('0x23'),_0x6a6d78[_0x7956('0xe')])})['then'](function(_0x53d1c4){logger[_0x7956('0xb')](_0x7956('0x24'));return _0x53d1c4[_0x7956('0x25')];});}}function getEndUser(_0x1c407a,_0x4572b2,_0x4e5b2d){logger[_0x7956('0xb')](_0x7956('0x26'),_0x4e5b2d);return request({'uri':util[_0x7956('0x1b')](_0x7956('0x1c'),_0x1c407a[_0x7956('0xe')]),'qs':{'query':util[_0x7956('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x4e5b2d)}})[_0x7956('0x16')](function(_0x33401e){var _0x377261;if(_0x33401e[_0x7956('0x27')][_0x7956('0x28')]){_0x33401e[_0x7956('0x27')]=_[_0x7956('0x29')](_0x33401e[_0x7956('0x27')],{'suspended':![],'role':_0x7956('0x2a')});if(_0x33401e[_0x7956('0x27')][_0x7956('0x28')]){_0x377261=_[_0x7956('0x2b')](_0x33401e[_0x7956('0x27')]);}}if(_0x377261){logger[_0x7956('0xb')](_0x7956('0x2c'));return _0x377261;}else{logger[_0x7956('0xb')](_0x7956('0x2d'));return request({'uri':util[_0x7956('0x1b')](_0x7956('0x2e'),_0x1c407a[_0x7956('0xe')]),'method':'POST','body':{'user':{'role':_0x7956('0x2a'),'name':util[_0x7956('0x1b')](_0x7956('0x2f'),_0x4572b2||_0x4e5b2d),'phone':_0x4e5b2d}}})[_0x7956('0x16')](function(_0x3e5e14){logger[_0x7956('0xb')]('Enduser\x20created.');return _0x3e5e14[_0x7956('0x25')];});}});}function getAuth(_0x18fdc6){var _0x50d8cc;if(_0x18fdc6[_0x7956('0x30')]===_0x7956('0x31')){_0x50d8cc=util[_0x7956('0x1b')](_0x7956('0x32'),_0x18fdc6[_0x7956('0x33')],_0x18fdc6[_0x7956('0x31')]);}else if(_0x18fdc6[_0x7956('0x30')]===_0x7956('0x34')){_0x50d8cc=util[_0x7956('0x1b')](_0x7956('0x35'),_0x18fdc6[_0x7956('0x33')],_0x18fdc6[_0x7956('0x34')]);}return util[_0x7956('0x1b')](_0x7956('0x36'),new Buffer(_0x50d8cc)[_0x7956('0x37')](_0x7956('0x38')));}function request(_0x5647fa){logger[_0x7956('0x39')](_0x7956('0x3a'),JSON['stringify'](_0x5647fa));return rp(_[_0x7956('0x7')](_0x5647fa,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x56f18a,_0x4d7dcd){var _0x47b857=[];if(_0x56f18a&&_0x56f18a[_0x7956('0x28')]>0x0){_0x47b857=_['map'](_0x56f18a,_0x4d7dcd);}return _0x47b857;}function getCustomFields(_0x1fc3aa,_0x2cb54e){var _0x1c8048=[];var _0x26f7b5={'custom_fields':[]};if(_0x1fc3aa[_0x7956('0x28')]>0x0){_[_0x7956('0x3b')](_0x1fc3aa,function(_0x417f6d){if(_0x417f6d[_0x7956('0x3c')]===_0x7956('0x3d')&&_0x417f6d['nameField']&&!_0x417f6d[_0x7956('0x3e')]){_0x26f7b5[_0x417f6d['nameField'][_0x7956('0x3f')]()]=_0x417f6d[_0x7956('0x40')][_0x7956('0x37')]();}else if(_0x417f6d[_0x7956('0x3c')]==='string'&&_0x417f6d[_0x7956('0x41')]&&_0x417f6d[_0x7956('0x3e')]){_0x26f7b5['custom_fields']['push']({'id':_0x417f6d[_0x7956('0x41')],'value':_0x417f6d['content'][_0x7956('0x37')]()});}else if(_0x417f6d[_0x7956('0x3c')]===_0x7956('0x42')&&_0x417f6d['variableName']&&_0x417f6d[_0x7956('0x41')]&&_0x417f6d[_0x7956('0x3e')]){_0x2cb54e[_0x417f6d['variableName']]&&_0x26f7b5[_0x7956('0x43')]['push']({'id':_0x417f6d[_0x7956('0x41')],'value':_0x2cb54e[_0x417f6d[_0x7956('0x44')]][_0x7956('0x37')]()});}else if(_0x417f6d[_0x7956('0x3c')]===_0x7956('0x45')&&_0x417f6d['Variable']&&_0x417f6d['Variable'][_0x7956('0x11')]&&_0x417f6d[_0x7956('0x41')]&&_0x417f6d[_0x7956('0x3e')]){_0x2cb54e[_0x417f6d[_0x7956('0x46')][_0x7956('0x11')][_0x7956('0x3f')]()]&&_0x26f7b5['custom_fields'][_0x7956('0x47')]({'id':_0x417f6d[_0x7956('0x41')],'value':_0x2cb54e[_0x417f6d[_0x7956('0x46')][_0x7956('0x11')][_0x7956('0x3f')]()][_0x7956('0x37')]()});}});}return _0x26f7b5;}exports[_0x7956('0x48')]=function(_0x280b2c,_0x1d64f2,_0x43353a,_0x21082d,_0x3c38f9,_0x393e55){var _0x200394,_0x2d2c5e;_0x393e55['remoteUri']=intUtil[_0x7956('0x49')](_0x393e55['remoteUri']);_0x393e55['serverUrl']=intUtil[_0x7956('0x49')](_0x393e55[_0x7956('0x4a')]);if(_0x3c38f9&&_0x3c38f9[_0x7956('0x4b')]){logger[_0x7956('0xb')](_0x7956('0x4c'),_0x7956('0x4d'));_0x1d64f2[_0x7956('0x4e')]=util[_0x7956('0x1b')](_0x7956('0x4f'),_0x393e55[_0x7956('0x4a')],_0x1d64f2[_0x7956('0x50')],md5(_0x1d64f2[_0x7956('0x50')]));}else{_0x1d64f2[_0x7956('0x4e')]='';}headers[_0x7956('0x51')]=getAuth(_0x393e55);return getUser(_0x393e55,_0x21082d[_0x7956('0x52')])[_0x7956('0x16')](function(_0x1c2ecb){_0x200394=_0x1c2ecb;logger[_0x7956('0xb')](_0x7956('0x53'),_0x200394['id']);return getEndUser(_0x393e55,_0x1d64f2[_0x7956('0x54')],_0x1d64f2[_0x7956('0x55')]);})[_0x7956('0x16')](function(_0x554b3e){_0x2d2c5e=_0x554b3e;logger[_0x7956('0xb')](_0x7956('0x56'),_0x2d2c5e['id']);return getTicket(_0x393e55,_0x200394,_0x2d2c5e,_0x43353a,_0x1d64f2);})[_0x7956('0x16')](function(_0x493092){if(_0x493092){logger[_0x7956('0xb')]('The\x20Ticket\x20ID\x20is:',_0x493092['id']);switch(_0x393e55[_0x7956('0x3c')]){case _0x7956('0x57'):logger['info'](_0x7956('0x4c'),_0x7956('0x58'));return request({'uri':util['format'](_0x7956('0x59'),_0x393e55[_0x7956('0xe')],_0x200394['id'],_0x493092['id']),'method':'POST'});case _0x7956('0x5a'):logger[_0x7956('0xb')](_0x7956('0x4c'),_0x7956('0x5b'));emit(util[_0x7956('0x1b')](_0x7956('0x5c'),_0x21082d[_0x7956('0x11')]),'trigger:browser:url',{'uri':util[_0x7956('0x1b')](_0x7956('0x5d'),_0x393e55[_0x7956('0xe')],_0x493092['id'])});break;default:logger[_0x7956('0x5e')]('[QUEUE]',_0x7956('0x5f'));}}})[_0x7956('0x60')](function(_0x369db1){logger[_0x7956('0x5e')](_0x7956('0x61'),util[_0x7956('0x62')](_0x369db1,{'showHidden':!![],'depth':null}));});};exports[_0x7956('0x63')]=function(_0x277d78,_0x3d7a33,_0x20efca,_0x29a005,_0x1d2af8,_0x11424e,_0x121c79){var _0x513803,_0x46a2f5;_0x11424e[_0x7956('0xe')]=intUtil[_0x7956('0x49')](_0x11424e[_0x7956('0xe')]);_0x11424e['serverUrl']=intUtil[_0x7956('0x49')](_0x11424e[_0x7956('0x4a')]);if(_0x121c79&&_0x121c79[_0x7956('0x64')]&&_0x121c79[_0x7956('0x64')]!==_0x7956('0x65')){logger[_0x7956('0xb')](_0x7956('0x66'),'Recording\x20is\x20enabled!');_0x3d7a33['recordingURL']=util[_0x7956('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11424e[_0x7956('0x4a')],_0x3d7a33[_0x7956('0x50')],md5(_0x3d7a33[_0x7956('0x50')]));}headers[_0x7956('0x51')]=getAuth(_0x11424e);return getUser(_0x11424e,_0x29a005[_0x7956('0x52')])[_0x7956('0x16')](function(_0x42f636){_0x513803=_0x42f636;logger[_0x7956('0xb')](_0x7956('0x53'),_0x513803['id']);return getEndUser(_0x11424e,_0x3d7a33['destcalleridname'],_0x3d7a33[_0x7956('0x67')]);})[_0x7956('0x16')](function(_0x45cc68){_0x46a2f5=_0x45cc68;logger['info'](_0x7956('0x56'),_0x46a2f5['id']);return getTicket(_0x11424e,_0x513803,_0x46a2f5,_0x20efca,_0x3d7a33);})[_0x7956('0x16')](function(_0x5f4584){if(_0x5f4584){logger[_0x7956('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5f4584['id']);switch(_0x11424e[_0x7956('0x3c')]){case _0x7956('0x57'):logger[_0x7956('0xb')](_0x7956('0x66'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x7956('0x1b')](_0x7956('0x59'),_0x11424e[_0x7956('0xe')],_0x513803['id'],_0x5f4584['id']),'method':'POST'});case _0x7956('0x5a'):logger[_0x7956('0xb')](_0x7956('0x66'),_0x7956('0x5b'));emit(util[_0x7956('0x1b')](_0x7956('0x5c'),_0x29a005['name']),'trigger:browser:url',{'uri':util[_0x7956('0x1b')]('%s/agent/tickets/%s',_0x11424e[_0x7956('0xe')],_0x5f4584['id'])});break;default:logger['error'](_0x7956('0x66'),_0x7956('0x5f'));}}})[_0x7956('0x60')](function(_0x50fecd){logger['error'](_0x7956('0x68'),util[_0x7956('0x62')](_0x50fecd,{'showHidden':!![],'depth':null}));});};exports[_0x7956('0x69')]=function(_0x3741e1,_0x5b0225,_0x1d2ff2,_0x1f4f2f,_0x16beac,_0x1d52cb){var _0xb1044f,_0x40d052;_0x1d52cb[_0x7956('0xe')]=intUtil['stripTrailingSlash'](_0x1d52cb[_0x7956('0xe')]);_0x1d52cb[_0x7956('0x4a')]=intUtil[_0x7956('0x49')](_0x1d52cb[_0x7956('0x4a')]);if(_0x16beac&&_0x16beac[_0x7956('0x4b')]){logger[_0x7956('0xb')]('['+_0x5b0225['lastevent'][_0x7956('0x6a')]()+']',_0x7956('0x4d'));_0x5b0225[_0x7956('0x4e')]=util[_0x7956('0x1b')](_0x7956('0x4f'),_0x1d52cb[_0x7956('0x4a')],_0x5b0225[_0x7956('0x50')],md5(_0x5b0225[_0x7956('0x50')]));}else{_0x5b0225[_0x7956('0x4e')]='';}headers[_0x7956('0x51')]=getAuth(_0x1d52cb);return getUser(_0x1d52cb)[_0x7956('0x16')](function(_0x426471){_0xb1044f=_0x426471;logger['info'](_0x7956('0x53'),_0xb1044f['id']);return getEndUser(_0x1d52cb,_0x5b0225[_0x7956('0x54')],_0x5b0225[_0x7956('0x55')]);})[_0x7956('0x16')](function(_0x2c92bb){_0x40d052=_0x2c92bb;logger['info']('The\x20Enduser\x20ID\x20is:',_0x40d052['id']);return getTicket(_0x1d52cb,_0xb1044f,_0x40d052,_0x1d2ff2,_0x5b0225);})['then'](function(_0x4341a6){if(_0x4341a6){logger[_0x7956('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4341a6['id']);}})['catch'](function(_0x44c403){logger['error']('['+_0x5b0225['lastevent'][_0x7956('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7956('0x62')](_0x44c403,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8b29=['Descriptions','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','defaults','GET','map','string','nameField','customField','type','custom_fields','push','idField','content','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString'];(function(_0xda5738,_0x56093c){var _0x1423f6=function(_0x5562b3){while(--_0x5562b3){_0xda5738['push'](_0xda5738['shift']());}};_0x1423f6(++_0x56093c);}(_0x8b29,0xbe));var _0x98b2=function(_0x28af59,_0x361f6a){_0x28af59=_0x28af59-0x0;var _0x23748f=_0x8b29[_0x28af59];return _0x23748f;};'use strict';var _=require(_0x98b2('0x0'));var rp=require('request-promise');var md5=require(_0x98b2('0x1'));var util=require(_0x98b2('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x98b2('0x3'));var logger=require(_0x98b2('0x4'))('zendesk');config[_0x98b2('0x5')]=_['defaults'](config[_0x98b2('0x5')],{'host':_0x98b2('0x6'),'port':0x18eb});var io=require(_0x98b2('0x7'))(new Redis(config[_0x98b2('0x5')]));function emit(_0x221cee,_0x2cd0cb,_0x417ca6){io['to'](_0x221cee)[_0x98b2('0x8')](_0x2cd0cb,_0x417ca6);}var headers={'Content-Type':_0x98b2('0x9'),'Accept':_0x98b2('0x9')};function getTicket(_0x501b51,_0x48a17e,_0x599bf5,_0x14e049,_0x39617c){logger[_0x98b2('0xa')](_0x98b2('0xb'));return request({'uri':util[_0x98b2('0xc')]('%s/tickets.json',_0x501b51[_0x98b2('0xd')]),'method':_0x98b2('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x599bf5['id'],'submitter_id':_0x48a17e?_0x48a17e['id']:undefined,'assignee_id':_0x48a17e?_0x48a17e['id']:undefined,'tags':getTags(_0x14e049[_0x98b2('0xf')],_0x98b2('0x10')),'subject':intUtil[_0x98b2('0x11')](_0x14e049['Subjects'],_0x39617c,'\x20'),'description':intUtil['getString'](_0x14e049[_0x98b2('0x12')],_0x39617c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x14e049[_0x98b2('0x12')],_0x39617c,'\x0a')}},getCustomFields(_0x14e049['Fields'],_0x39617c))}})['then'](function(_0x544e3c){logger[_0x98b2('0xa')](_0x98b2('0x13'));return _0x544e3c[_0x98b2('0x14')];});}function getUser(_0x5ecea1,_0x5bb60d){if(intUtil['validateEmail'](_0x5bb60d)){logger[_0x98b2('0xa')](_0x98b2('0x15'),_0x5bb60d);return request({'uri':util[_0x98b2('0xc')](_0x98b2('0x16'),_0x5ecea1['remoteUri']),'qs':{'query':util[_0x98b2('0xc')]('type:user\x20role:agent\x20email:%s',_0x5bb60d)}})[_0x98b2('0x17')](function(_0x4931f4){if(_0x4931f4[_0x98b2('0x18')]){logger[_0x98b2('0xa')](_0x98b2('0x19'));return _[_0x98b2('0x1a')](_0x4931f4['results'],{'email':_0x5bb60d,'role':_0x98b2('0x1b')});}else{logger[_0x98b2('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x98b2('0x1c'),_0x5ecea1[_0x98b2('0xd')])})['then'](function(_0x4ddded){logger[_0x98b2('0xa')](_0x98b2('0x1d'));return _0x4ddded['user'];});}});}else{logger[_0x98b2('0xa')](_0x98b2('0x1e'));return request({'uri':util[_0x98b2('0xc')]('%s/users/me.json',_0x5ecea1[_0x98b2('0xd')])})['then'](function(_0x1d6e33){logger['info']('Admin\x20account\x20selected.');return _0x1d6e33[_0x98b2('0x1f')];});}}function getEndUser(_0xe99d27,_0x5fcd00,_0x525b57){logger['info']('Searching\x20enduser\x20with\x20phone',_0x525b57);return request({'uri':util[_0x98b2('0xc')](_0x98b2('0x16'),_0xe99d27['remoteUri']),'qs':{'query':util[_0x98b2('0xc')](_0x98b2('0x20'),_0x525b57)}})[_0x98b2('0x17')](function(_0x56efb6){var _0x2e1ea4;if(_0x56efb6[_0x98b2('0x21')][_0x98b2('0x22')]){_0x56efb6[_0x98b2('0x21')]=_[_0x98b2('0x23')](_0x56efb6['results'],{'suspended':![],'role':_0x98b2('0x24')});if(_0x56efb6['results'][_0x98b2('0x22')]){_0x2e1ea4=_[_0x98b2('0x25')](_0x56efb6['results']);}}if(_0x2e1ea4){logger[_0x98b2('0xa')](_0x98b2('0x26'));return _0x2e1ea4;}else{logger['info'](_0x98b2('0x27'));return request({'uri':util[_0x98b2('0xc')](_0x98b2('0x28'),_0xe99d27[_0x98b2('0xd')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x98b2('0xc')](_0x98b2('0x29'),_0x5fcd00||_0x525b57),'phone':_0x525b57}}})[_0x98b2('0x17')](function(_0x3d2df4){logger[_0x98b2('0xa')](_0x98b2('0x2a'));return _0x3d2df4['user'];});}});}function getAuth(_0x448c8b){var _0x2ecb46;if(_0x448c8b[_0x98b2('0x2b')]===_0x98b2('0x2c')){_0x2ecb46=util[_0x98b2('0xc')](_0x98b2('0x2d'),_0x448c8b[_0x98b2('0x2e')],_0x448c8b[_0x98b2('0x2c')]);}else if(_0x448c8b[_0x98b2('0x2b')]===_0x98b2('0x2f')){_0x2ecb46=util[_0x98b2('0xc')](_0x98b2('0x30'),_0x448c8b[_0x98b2('0x2e')],_0x448c8b['token']);}return util['format'](_0x98b2('0x31'),new Buffer(_0x2ecb46)[_0x98b2('0x32')](_0x98b2('0x33')));}function request(_0x363553){logger[_0x98b2('0x34')](_0x98b2('0x35'),JSON['stringify'](_0x363553));return rp(_[_0x98b2('0x36')](_0x363553,{'method':_0x98b2('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x30e09a,_0x35d085){var _0x4b9c32=[];if(_0x30e09a&&_0x30e09a[_0x98b2('0x22')]>0x0){_0x4b9c32=_[_0x98b2('0x38')](_0x30e09a,_0x35d085);}return _0x4b9c32;}function getCustomFields(_0x3b5d34,_0x178ad1){var _0x2cadb7=[];var _0x3eea54={'custom_fields':[]};if(_0x3b5d34[_0x98b2('0x22')]>0x0){_['forEach'](_0x3b5d34,function(_0x158d80){if(_0x158d80['type']===_0x98b2('0x39')&&_0x158d80[_0x98b2('0x3a')]&&!_0x158d80[_0x98b2('0x3b')]){_0x3eea54[_0x158d80[_0x98b2('0x3a')]['toLowerCase']()]=_0x158d80['content'][_0x98b2('0x32')]();}else if(_0x158d80[_0x98b2('0x3c')]===_0x98b2('0x39')&&_0x158d80['idField']&&_0x158d80[_0x98b2('0x3b')]){_0x3eea54[_0x98b2('0x3d')][_0x98b2('0x3e')]({'id':_0x158d80[_0x98b2('0x3f')],'value':_0x158d80[_0x98b2('0x40')][_0x98b2('0x32')]()});}else if(_0x158d80['type']===_0x98b2('0x41')&&_0x158d80[_0x98b2('0x42')]&&_0x158d80[_0x98b2('0x3f')]&&_0x158d80['customField']){_0x178ad1[_0x158d80[_0x98b2('0x42')]]&&_0x3eea54[_0x98b2('0x3d')][_0x98b2('0x3e')]({'id':_0x158d80[_0x98b2('0x3f')],'value':_0x178ad1[_0x158d80[_0x98b2('0x42')]][_0x98b2('0x32')]()});}else if(_0x158d80['type']===_0x98b2('0x43')&&_0x158d80['Variable']&&_0x158d80[_0x98b2('0x44')][_0x98b2('0x10')]&&_0x158d80[_0x98b2('0x3f')]&&_0x158d80[_0x98b2('0x3b')]){_0x178ad1[_0x158d80[_0x98b2('0x44')][_0x98b2('0x10')][_0x98b2('0x45')]()]&&_0x3eea54[_0x98b2('0x3d')][_0x98b2('0x3e')]({'id':_0x158d80['idField'],'value':_0x178ad1[_0x158d80[_0x98b2('0x44')]['name'][_0x98b2('0x45')]()][_0x98b2('0x32')]()});}});}return _0x3eea54;}exports[_0x98b2('0x46')]=function(_0x19dfcf,_0x28234f,_0xa74a8a,_0x53f148,_0x215c36,_0x44633c){var _0x3dd679,_0x2bd1ca;_0x44633c[_0x98b2('0xd')]=intUtil['stripTrailingSlash'](_0x44633c['remoteUri']);_0x44633c[_0x98b2('0x47')]=intUtil[_0x98b2('0x48')](_0x44633c[_0x98b2('0x47')]);if(_0x215c36&&_0x215c36[_0x98b2('0x49')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x28234f[_0x98b2('0x4a')]=util[_0x98b2('0xc')](_0x98b2('0x4b'),_0x44633c[_0x98b2('0x47')],_0x28234f[_0x98b2('0x4c')],md5(_0x28234f[_0x98b2('0x4c')]));}else{_0x28234f[_0x98b2('0x4a')]='';}headers[_0x98b2('0x4d')]=getAuth(_0x44633c);return getUser(_0x44633c,_0x53f148[_0x98b2('0x4e')])['then'](function(_0x321940){_0x3dd679=_0x321940;logger['info'](_0x98b2('0x4f'),_0x3dd679['id']);return getEndUser(_0x44633c,_0x28234f[_0x98b2('0x50')],_0x28234f[_0x98b2('0x51')]);})[_0x98b2('0x17')](function(_0x4be667){_0x2bd1ca=_0x4be667;logger[_0x98b2('0xa')](_0x98b2('0x52'),_0x2bd1ca['id']);return getTicket(_0x44633c,_0x3dd679,_0x2bd1ca,_0xa74a8a,_0x28234f);})[_0x98b2('0x17')](function(_0x1e13b8){if(_0x1e13b8){logger[_0x98b2('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1e13b8['id']);switch(_0x44633c[_0x98b2('0x3c')]){case _0x98b2('0x53'):logger[_0x98b2('0xa')](_0x98b2('0x54'),_0x98b2('0x55'));return request({'uri':util[_0x98b2('0xc')](_0x98b2('0x56'),_0x44633c[_0x98b2('0xd')],_0x3dd679['id'],_0x1e13b8['id']),'method':_0x98b2('0xe')});case _0x98b2('0x57'):logger[_0x98b2('0xa')](_0x98b2('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x98b2('0xc')](_0x98b2('0x58'),_0x53f148['name']),'trigger:browser:url',{'uri':util[_0x98b2('0xc')]('%s/agent/tickets/%s',_0x44633c[_0x98b2('0xd')],_0x1e13b8['id'])});break;default:logger[_0x98b2('0x59')](_0x98b2('0x54'),_0x98b2('0x5a'));}}})[_0x98b2('0x5b')](function(_0x2b2db5){logger['error'](_0x98b2('0x5c'),util['inspect'](_0x2b2db5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0xf9da91,_0x27da73,_0x5217e0,_0x12a72e,_0x1253e2,_0x47f99a,_0xcc5547){var _0x466240,_0x14327e;_0x47f99a[_0x98b2('0xd')]=intUtil['stripTrailingSlash'](_0x47f99a['remoteUri']);_0x47f99a[_0x98b2('0x47')]=intUtil[_0x98b2('0x48')](_0x47f99a[_0x98b2('0x47')]);if(_0xcc5547&&_0xcc5547[_0x98b2('0x5d')]&&_0xcc5547[_0x98b2('0x5d')]!=='none'){logger['info'](_0x98b2('0x5e'),'Recording\x20is\x20enabled!');_0x27da73[_0x98b2('0x4a')]=util[_0x98b2('0xc')](_0x98b2('0x4b'),_0x47f99a[_0x98b2('0x47')],_0x27da73[_0x98b2('0x4c')],md5(_0x27da73[_0x98b2('0x4c')]));}headers['Authorization']=getAuth(_0x47f99a);return getUser(_0x47f99a,_0x12a72e[_0x98b2('0x4e')])[_0x98b2('0x17')](function(_0x2984ba){_0x466240=_0x2984ba;logger[_0x98b2('0xa')](_0x98b2('0x4f'),_0x466240['id']);return getEndUser(_0x47f99a,_0x27da73[_0x98b2('0x5f')],_0x27da73['destcalleridnum']);})['then'](function(_0x250df6){_0x14327e=_0x250df6;logger[_0x98b2('0xa')](_0x98b2('0x52'),_0x14327e['id']);return getTicket(_0x47f99a,_0x466240,_0x14327e,_0x5217e0,_0x27da73);})[_0x98b2('0x17')](function(_0x2ec36c){if(_0x2ec36c){logger[_0x98b2('0xa')](_0x98b2('0x60'),_0x2ec36c['id']);switch(_0x47f99a[_0x98b2('0x3c')]){case'integrationTab':logger[_0x98b2('0xa')](_0x98b2('0x5e'),_0x98b2('0x55'));return request({'uri':util['format'](_0x98b2('0x56'),_0x47f99a[_0x98b2('0xd')],_0x466240['id'],_0x2ec36c['id']),'method':_0x98b2('0xe')});case'newTab':logger[_0x98b2('0xa')](_0x98b2('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x98b2('0xc')]('user:%s',_0x12a72e['name']),'trigger:browser:url',{'uri':util['format'](_0x98b2('0x61'),_0x47f99a[_0x98b2('0xd')],_0x2ec36c['id'])});break;default:logger[_0x98b2('0x59')]('[OUTBOUND]',_0x98b2('0x5a'));}}})[_0x98b2('0x5b')](function(_0xf84c83){logger[_0x98b2('0x59')](_0x98b2('0x62'),util[_0x98b2('0x63')](_0xf84c83,{'showHidden':!![],'depth':null}));});};exports[_0x98b2('0x64')]=function(_0x5181ee,_0x46b3fb,_0x5d60d9,_0x19c45e,_0x3877ae,_0x2fea4f){var _0x30db52,_0x122e76;_0x2fea4f[_0x98b2('0xd')]=intUtil[_0x98b2('0x48')](_0x2fea4f['remoteUri']);_0x2fea4f['serverUrl']=intUtil[_0x98b2('0x48')](_0x2fea4f[_0x98b2('0x47')]);if(_0x3877ae&&_0x3877ae[_0x98b2('0x49')]){logger[_0x98b2('0xa')]('['+_0x46b3fb['lastevent'][_0x98b2('0x65')]()+']','Recording\x20is\x20enabled!');_0x46b3fb[_0x98b2('0x4a')]=util[_0x98b2('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2fea4f[_0x98b2('0x47')],_0x46b3fb[_0x98b2('0x4c')],md5(_0x46b3fb[_0x98b2('0x4c')]));}else{_0x46b3fb[_0x98b2('0x4a')]='';}headers[_0x98b2('0x4d')]=getAuth(_0x2fea4f);return getUser(_0x2fea4f)[_0x98b2('0x17')](function(_0x4102a4){_0x30db52=_0x4102a4;logger[_0x98b2('0xa')](_0x98b2('0x4f'),_0x30db52['id']);return getEndUser(_0x2fea4f,_0x46b3fb['calleridname'],_0x46b3fb[_0x98b2('0x51')]);})[_0x98b2('0x17')](function(_0x1a9efa){_0x122e76=_0x1a9efa;logger[_0x98b2('0xa')](_0x98b2('0x52'),_0x122e76['id']);return getTicket(_0x2fea4f,_0x30db52,_0x122e76,_0x5d60d9,_0x46b3fb);})[_0x98b2('0x17')](function(_0x381800){if(_0x381800){logger['info'](_0x98b2('0x60'),_0x381800['id']);}})[_0x98b2('0x5b')](function(_0x31ea44){logger[_0x98b2('0x59')]('['+_0x46b3fb[_0x98b2('0x66')]['toUpperCase']()+']'+_0x98b2('0x67'),util['inspect'](_0x31ea44,{'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 a35bf16..1581307 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 _0x35c0=['clientSecret','refresh_token','then','add','seconds','error','stack','info','Search\x20user','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','profile','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','starttime','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','unmanaged','lastevent','calleridname','toUpperCase','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','debug','[HTTP]','stringify','length','forEach','type','string','idField','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','clientId'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x35c0,0x10d));var _0x035c=function(_0x9e76d,_0x44e7a0){_0x9e76d=_0x9e76d-0x0;var _0x320985=_0x35c0[_0x9e76d];return _0x320985;};'use strict';var _=require('lodash');var rp=require(_0x035c('0x0'));var md5=require(_0x035c('0x1'));var util=require('util');var intUtil=require(_0x035c('0x2'));var moment=require(_0x035c('0x3'));var Redis=require(_0x035c('0x4'));var BPromise=require(_0x035c('0x5'));var config=require(_0x035c('0x6'));var logger=require(_0x035c('0x7'))(_0x035c('0x8'));config[_0x035c('0x9')]=_[_0x035c('0xa')](config[_0x035c('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x035c('0x9')]));function emit(_0x1c7d0f,_0x2f1092,_0x2ce315){io['to'](_0x1c7d0f)['emit'](_0x2f1092,_0x2ce315);}function request(_0xc9f773){logger[_0x035c('0xb')](_0x035c('0xc'),JSON[_0x035c('0xd')](_0xc9f773));return rp(_0xc9f773);}function getCustomFields(_0x33ff81,_0x3afa89){var _0x1e91e9={};if(_0x33ff81[_0x035c('0xe')]>0x0){_[_0x035c('0xf')](_0x33ff81,function(_0x424273){if(_0x424273[_0x035c('0x10')]===_0x035c('0x11')&&_0x424273[_0x035c('0x12')]){_0x1e91e9[_0x424273[_0x035c('0x12')]]=_0x424273['content']['toString']();}else if(_0x424273['type']==='variable'&&_0x424273['variableName']&&_0x424273[_0x035c('0x12')]&&_0x3afa89[_0x424273[_0x035c('0x13')]]){_0x1e91e9[_0x424273[_0x035c('0x12')]]=_0x3afa89[_0x424273[_0x035c('0x13')]][_0x035c('0x14')]();}else if(_0x424273[_0x035c('0x10')]===_0x035c('0x15')&&_0x424273[_0x035c('0x16')]&&_0x424273[_0x035c('0x16')][_0x035c('0x17')]&&_0x424273[_0x035c('0x12')]&&_0x3afa89[_0x424273['Variable']['name'][_0x035c('0x18')]()]){_0x1e91e9[_0x424273['idField']]=_0x3afa89[_0x424273[_0x035c('0x16')][_0x035c('0x17')][_0x035c('0x18')]()][_0x035c('0x14')]();}});}return _0x1e91e9;}function getName(_0x12dd55){if(_0x12dd55['indexOf']('\x20')>0x0){var _0x3df331=_0x12dd55[_0x035c('0x19')](/ (.+)/);if(_0x3df331[0x1]){return _0x3df331;}}return[_0x12dd55,_0x12dd55];}var accountsTokens={};function getAccessToken(_0xc9acf0){return new Promise(function(_0x239085,_0x1660ef){if(!_[_0x035c('0x1a')](accountsTokens[_0xc9acf0['id']])&&!_['isNil'](accountsTokens[_0xc9acf0['id']]['access_token'])){if(moment()[_0x035c('0x1b')](accountsTokens[_0xc9acf0['id']][_0x035c('0x1c')])){_0x239085(accountsTokens[_0xc9acf0['id']][_0x035c('0x1d')]);}}var _0x45d850;switch(_0xc9acf0[_0x035c('0x1e')]){case'US':_0x45d850=_0x035c('0x1f');break;case'AU':_0x45d850=_0x035c('0x20');break;case'EU':_0x45d850=_0x035c('0x21');break;case'IN':_0x45d850=_0x035c('0x22');break;case'CN':_0x45d850='https://accounts.zoho.com.cn';break;default:_0x45d850='https://accounts.zoho.eu';break;}var _0x54b581={'method':'POST','uri':_0x45d850+_0x035c('0x23'),'qs':{'refresh_token':_0xc9acf0['refreshToken'],'client_id':_0xc9acf0[_0x035c('0x24')],'client_secret':_0xc9acf0[_0x035c('0x25')],'grant_type':_0x035c('0x26')},'json':!![]};return rp(_0x54b581)[_0x035c('0x27')](function(_0x17d399){accountsTokens[_0xc9acf0['id']]={'access_token':_0x17d399['access_token'],'expires_in':moment()[_0x035c('0x28')](_0x17d399['expires_in'],_0x035c('0x29'))};_0x239085(_0x17d399[_0x035c('0x1d')]);})['catch'](function(_0x3e72c5){logger[_0x035c('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x3e72c5[_0x035c('0x2b')]);_0x1660ef(_0x3e72c5);});});}function getUser(_0x4591db,_0xbb6ebc,_0x1e9dce,_0x234fbe){logger[_0x035c('0x2c')](_0x035c('0x2d'));return request({'method':_0x035c('0x2e'),'uri':util[_0x035c('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0xbb6ebc),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x035c('0x30')+_0x4591db},'json':!![]})[_0x035c('0x27')](function(_0x3b2761){if(_0x3b2761[_0x035c('0x31')]){var _0x29387f=-0x1;if(_[_0x035c('0x32')](_0x3b2761[_0x035c('0x31')])){if(!_[_0x035c('0x1a')](_0x234fbe)){_0x29387f=_[_0x035c('0x33')](_0x3b2761[_0x035c('0x31')],function(_0x1f4f4b){return _0x1f4f4b[_0x035c('0x34')]===_0x234fbe;});}if(_0x29387f>=0x0){logger[_0x035c('0x2c')]('Agent\x20found!');}else{logger['info'](_0x035c('0x35'));_0x29387f=_[_0x035c('0x33')](_0x3b2761[_0x035c('0x31')],function(_0x5b52e4){return _0x5b52e4['profile'][_0x035c('0x17')]==='Administrator';});}return _0x3b2761[_0x035c('0x31')][_0x29387f];}else{if(_0x3b2761[_0x035c('0x36')]['profile']['name']===_0x035c('0x37')){logger[_0x035c('0x2c')](_0x035c('0x35'));user=_0x3b2761[_0x035c('0x36')];return user;}else{logger[_0x035c('0x2a')](_0x035c('0x38'),JSON[_0x035c('0xd')](_0x3b2761));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x035c('0xd')](_0x3b2761));}}}else{logger[_0x035c('0x2a')](_0x035c('0x38'),JSON['stringify'](_0x3b2761));throw new Error(_0x035c('0x39')+JSON['stringify'](_0x3b2761));}})[_0x035c('0x3a')](function(_0x26bbbb){console[_0x035c('0x2a')](_0x26bbbb);});}function getZohoUser(_0x525802,_0x6ffc72){return new BPromise(function(_0x256783,_0x3b3646){request(_0x525802)[_0x035c('0x27')](function(_0x21a9bf){var _0x574a69=null;if(_0x21a9bf){_0x574a69=_0x21a9bf['data'][0x0];_0x574a69[_0x035c('0x3b')]=_0x6ffc72;}_0x256783(_0x574a69);})[_0x035c('0x3a')](function(_0x439821){_0x3b3646(_0x439821);});});}function createEndUser(_0x34a08f,_0x52b128,_0xcbde48,_0x4e1e58,_0x52d5bd,_0x44f6b6){var _0xcbde48=getName(_0xcbde48);return request({'method':_0x035c('0x3c'),'uri':_0x035c('0x3d')+_0x52b128+_0x035c('0x3e')+_[_0x035c('0x3f')](_0x44f6b6[_0x035c('0x40')])+'s','body':{'data':[{'Last_Name':_0xcbde48[0x1],'First_Name':_0xcbde48[0x0],'Phone':_0x4e1e58,'Owner':{'name':!_[_0x035c('0x1a')](_0x52d5bd[_0x035c('0x41')][_0x035c('0x17')])?_0x52d5bd['role'][_0x035c('0x17')]:!_[_0x035c('0x1a')](_0x52d5bd['first_name'])?_0x52d5bd[_0x035c('0x42')]+'\x20'+_0x52d5bd[_0x035c('0x43')]:_0x52d5bd[_0x035c('0x43')],'id':_0x52d5bd['id']}}]},'headers':{'Authorization':_0x035c('0x30')+_0x34a08f},'json':!![]})[_0x035c('0x27')](function(_0x2690fd){if(_0x2690fd&&_0x2690fd[_0x035c('0x44')][0x0]['code']===_0x035c('0x45')){var _0x10cff9=_0x2690fd[_0x035c('0x44')][0x0][_0x035c('0x46')];_0x10cff9[_0x035c('0x3b')]=_[_0x035c('0x3f')](_0x44f6b6[_0x035c('0x40')])+'s';return _0x10cff9;}logger[_0x035c('0x2a')](_0x035c('0x38'),JSON[_0x035c('0xd')](data));throw new Error(_0x035c('0x47')+JSON[_0x035c('0xd')](data));})[_0x035c('0x3a')](function(_0x2897c3){console[_0x035c('0x48')](_0x035c('0x49'),_0x2897c3);});}function getEndUser(_0x1d977f,_0x5041ab,_0x507180,_0x3feaa8,_0x199398,_0x3185fc,_0x2b4bc7){var _0x292769={'method':_0x035c('0x2e'),'uri':'','headers':{'Authorization':_0x035c('0x30')+_0x1d977f},'json':!![]};switch(_0x2b4bc7[_0x035c('0x4a')]){case'contact_lead':_0x292769[_0x035c('0x4b')]=_0x035c('0x3d')+_0x5041ab+_0x035c('0x4c')+_0x199398+'))';return getZohoUser(_0x292769,_0x035c('0x4d'))[_0x035c('0x27')](function(_0x1a4f2a){if(_0x1a4f2a)return _0x1a4f2a;_0x292769[_0x035c('0x4b')]=_0x035c('0x3d')+_0x5041ab+_0x035c('0x4e')+_0x199398+'))';return getZohoUser(_0x292769,_0x035c('0x4f'))['then'](function(_0x29ff27){if(_0x29ff27)return _0x29ff27;if(_0x2b4bc7['moduleCreate']!='nothing'){return createEndUser(_0x1d977f,_0x5041ab,_0x3feaa8,_0x199398,_0x3185fc,_0x2b4bc7);}else{return{};}});});break;case _0x035c('0x50'):_0x292769[_0x035c('0x4b')]=_0x035c('0x3d')+_0x5041ab+_0x035c('0x4c')+_0x199398+'))';return getZohoUser(_0x292769,_0x035c('0x4d'))['then'](function(_0x1b27c8){if(_0x1b27c8)return _0x1b27c8;if(_0x2b4bc7[_0x035c('0x40')]!=_0x035c('0x51')){return createEndUser(_0x1d977f,_0x5041ab,_0x3feaa8,_0x199398,_0x3185fc,_0x2b4bc7);}else{return{};}});break;case _0x035c('0x52'):_0x292769[_0x035c('0x4b')]=_0x035c('0x3d')+_0x5041ab+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x199398+'))';return getZohoUser(_0x292769,_0x035c('0x4f'))['then'](function(_0x2d47fc){if(_0x2d47fc)return _0x2d47fc;if(_0x2b4bc7[_0x035c('0x40')]!=_0x035c('0x51')){return createEndUser(_0x1d977f,_0x5041ab,_0x3feaa8,_0x199398,_0x3185fc,_0x2b4bc7);}else{return{};}});break;}}function getCall(_0x6f1885,_0x28d4e0,_0x3944d7,_0x4042e2,_0x39c2ef,_0x3601bb,_0x1e88c1,_0x3635ee){logger['info'](_0x035c('0x53'));var _0x370cd7={};_0x370cd7[_0x035c('0x54')]={'name':!_[_0x035c('0x1a')](_0x4042e2['role'][_0x035c('0x17')])&&!_[_0x035c('0x1a')](_0x4042e2['profile']['name'])&&_0x4042e2[_0x035c('0x55')][_0x035c('0x17')]===_0x035c('0x56')?_0x4042e2[_0x035c('0x41')][_0x035c('0x17')]:!_[_0x035c('0x1a')](_0x4042e2['first_name'])?_0x4042e2[_0x035c('0x42')]+'\x20'+_0x4042e2[_0x035c('0x43')]:_0x4042e2[_0x035c('0x43')],'id':_0x4042e2['id']};_0x370cd7[_0x035c('0x57')]=intUtil['getString'](_0x3601bb[_0x035c('0x58')],_0x1e88c1,'\x20');_0x370cd7[_0x035c('0x59')]=intUtil[_0x035c('0x5a')](_0x3601bb[_0x035c('0x5b')],_0x1e88c1,'\x0a');if(_0x39c2ef[_0x035c('0x3b')]==='Contacts'){_0x370cd7[_0x035c('0x5c')]={'name':!_[_0x035c('0x1a')](_0x39c2ef['Full_Name'])?_0x39c2ef[_0x035c('0x5d')]:!_['isNil'](_0x39c2ef[_0x035c('0x5e')])?_0x39c2ef['First_Name']+'\x20'+_0x39c2ef[_0x035c('0x5f')]:_0x39c2ef[_0x035c('0x5f')],'id':_0x39c2ef['id']};}if(_0x39c2ef[_0x035c('0x3b')]===_0x035c('0x4f')){_0x370cd7[_0x035c('0x60')]={'name':!_[_0x035c('0x1a')](_0x39c2ef[_0x035c('0x5d')])?_0x39c2ef[_0x035c('0x5d')]:!_[_0x035c('0x1a')](_0x39c2ef[_0x035c('0x5e')])?_0x39c2ef['First_Name']+'\x20'+_0x39c2ef[_0x035c('0x5f')]:_0x39c2ef[_0x035c('0x5f')],'id':_0x39c2ef['id']};_0x370cd7['$se_module']=_[_0x035c('0x3f')](_0x39c2ef[_0x035c('0x3b')]);}if(_0x1e88c1[_0x035c('0x61')]){_0x370cd7['Call_Duration']=moment[_0x035c('0x62')](parseInt(_0x1e88c1[_0x035c('0x61')])*0x3e8)[_0x035c('0x2f')](_0x035c('0x63'));}else if(_0x1e88c1['answertime']&&_0x1e88c1['endtime']){_0x370cd7['Call_Duration']=moment[_0x035c('0x62')](moment(_0x1e88c1[_0x035c('0x64')],_0x035c('0x65'))[_0x035c('0x66')](moment(_0x1e88c1['starttime'],_0x035c('0x65'))))[_0x035c('0x2f')](_0x035c('0x63'));}switch(_0x1e88c1['lastevent']){case'called':_0x370cd7[_0x035c('0x67')]=_0x035c('0x68');break;case _0x035c('0x69'):case _0x035c('0x6a'):_0x370cd7['Call_Result']=_0x035c('0x6b');break;case'rejected':_0x370cd7['Call_Result']=_0x035c('0x6c');break;case _0x035c('0x6d'):_0x370cd7[_0x035c('0x67')]=_0x035c('0x6e');break;case _0x035c('0x6f'):_0x370cd7[_0x035c('0x67')]=_0x035c('0x70');default:}_0x370cd7['Call_Start_Time']=(_0x3635ee===_0x035c('0x71')?moment(_0x1e88c1[_0x035c('0x72')])[_0x035c('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1e88c1['agentcalledAt'])[_0x035c('0x2f')](_0x035c('0x65')))||moment()[_0x035c('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x370cd7['Call_Type']=_0x3635ee||_0x035c('0x73');_0x370cd7=_[_0x035c('0x74')](_0x370cd7,getCustomFields(_0x3601bb[_0x035c('0x75')],_0x1e88c1));return request({'method':_0x035c('0x3c'),'uri':_0x035c('0x3d')+_0x28d4e0+_0x035c('0x76'),'headers':{'Authorization':_0x035c('0x30')+_0x6f1885},'body':{'data':[_0x370cd7]},'json':!![]})[_0x035c('0x27')](function(_0x4bab61){if(_0x4bab61&&_0x4bab61[_0x035c('0x44')][0x0][_0x035c('0x77')]===_0x035c('0x45')){logger[_0x035c('0x2c')](_0x035c('0x78'));return{'id':_0x4bab61[_0x035c('0x44')][0x0][_0x035c('0x46')]['id']};}})[_0x035c('0x3a')](function(_0x35a533){logger[_0x035c('0x2c')](_0x035c('0x79'),_0x35a533[_0x035c('0x2b')]);console[_0x035c('0x48')](_0x035c('0x79'),_0x35a533);});}exports[_0x035c('0x7a')]=function(_0x12bba4,_0x3b02c9,_0x46a5af,_0x4bfe89,_0x33f695,_0x27b902){var _0x171b46,_0x460bef,_0x2ae6e3;_0x27b902[_0x035c('0x7b')]=intUtil['stripTrailingSlash'](_0x27b902[_0x035c('0x7b')]);_0x27b902[_0x035c('0x7c')]=intUtil[_0x035c('0x7d')](_0x27b902[_0x035c('0x7c')]);if(_0x33f695&&_0x33f695[_0x035c('0x7e')]){logger['info'](_0x035c('0x7f'),_0x035c('0x80'));_0x3b02c9[_0x035c('0x81')]=_0x27b902[_0x035c('0x7c')]+'/api/voice/recordings/'+_0x3b02c9['uniqueid']+_0x035c('0x82')+md5(_0x3b02c9[_0x035c('0x83')]);}else{_0x3b02c9['recordingURL']='';}var _0x37a9cc=_0x27b902['host']===_0x035c('0x84')?'eu':_0x035c('0x85');return getAccessToken(_0x27b902)[_0x035c('0x27')](function(_0x39905c){_0x2ae6e3=_0x39905c;return getUser(_0x2ae6e3,_0x37a9cc,_0x27b902,_0x4bfe89[_0x035c('0x34')]);})[_0x035c('0x27')](function(_0x3368ec){_0x171b46=_0x3368ec;logger[_0x035c('0x2c')](_0x035c('0x86'),_0x171b46['id']);return getEndUser(_0x2ae6e3,_0x37a9cc,_0x27b902,_0x3b02c9['calleridname'],_0x3b02c9[_0x035c('0x87')],_0x171b46,_0x46a5af);})[_0x035c('0x27')](function(_0x6a3bb1){_0x460bef=_0x6a3bb1;return getCall(_0x2ae6e3,_0x37a9cc,_0x27b902,_0x171b46,_0x460bef,_0x46a5af,_0x3b02c9,_0x035c('0x73'));})[_0x035c('0x27')](function(_0xc24d26){if(_0xc24d26){logger[_0x035c('0x2c')](_0x035c('0x88'),_0xc24d26['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x035c('0x2f')](_0x035c('0x89'),_0x4bfe89[_0x035c('0x17')]),_0x035c('0x8a'),{'uri':'https://crm.'+_0x27b902[_0x035c('0x7b')]+_0x035c('0x8b')+_0xc24d26['id']});}})[_0x035c('0x3a')](function(_0x3df2ae){logger[_0x035c('0x2a')](_0x035c('0x7f'),JSON[_0x035c('0xd')](_0x3df2ae));});};exports['outbound']=function(_0x2186a6,_0x34a4cf,_0x192677,_0x13de72,_0xbe228c,_0x4595ba,_0x3e79c7){var _0x57ccd9,_0x39516f,_0x18c5ec;_0x4595ba[_0x035c('0x7b')]=intUtil[_0x035c('0x7d')](_0x4595ba['host']);_0x4595ba[_0x035c('0x7c')]=intUtil[_0x035c('0x7d')](_0x4595ba[_0x035c('0x7c')]);if(_0x3e79c7&&_0x3e79c7[_0x035c('0x8c')]&&_0x3e79c7['recordingFormat']!==_0x035c('0x8d')){logger['info'](_0x035c('0x8e'),'Recording\x20is\x20enabled!');_0x34a4cf[_0x035c('0x81')]=_0x4595ba[_0x035c('0x7c')]+_0x035c('0x8f')+_0x34a4cf[_0x035c('0x83')]+_0x035c('0x82')+md5(_0x34a4cf[_0x035c('0x83')]);}var _0x2ae16a=_0x4595ba[_0x035c('0x7b')]===_0x035c('0x84')?'eu':'com';return getAccessToken(_0x4595ba)['then'](function(_0x396874){_0x18c5ec=_0x396874;return getUser(_0x18c5ec,_0x2ae16a,_0x4595ba,_0x13de72[_0x035c('0x34')]);})['then'](function(_0x58b716){_0x57ccd9=_0x58b716;logger[_0x035c('0x2c')](_0x035c('0x86'),_0x57ccd9['id']);return getEndUser(_0x18c5ec,_0x2ae16a,_0x4595ba,_0x34a4cf[_0x035c('0x90')],_0x34a4cf[_0x035c('0x91')],_0x57ccd9,_0x192677);})[_0x035c('0x27')](function(_0x204cb7){_0x39516f=_0x204cb7;return getCall(_0x18c5ec,_0x2ae16a,_0x4595ba,_0x57ccd9,_0x39516f,_0x192677,_0x34a4cf,_0x035c('0x92'));})[_0x035c('0x27')](function(_0x184e5e){if(_0x184e5e){logger[_0x035c('0x2c')](_0x035c('0x88'),_0x184e5e['id']);logger[_0x035c('0x2c')](_0x035c('0x8e'),_0x035c('0x93'));emit(util[_0x035c('0x2f')](_0x035c('0x89'),_0x13de72['name']),'trigger:browser:url',{'uri':_0x035c('0x94')+_0x4595ba['host']+_0x035c('0x8b')+_0x184e5e['id']});}})[_0x035c('0x3a')](function(_0x6a9204){logger['error']('[OUTBOUND]',JSON[_0x035c('0xd')](_0x6a9204));});};exports[_0x035c('0x95')]=function(_0x20fd3a,_0x2e625e,_0x5ec843,_0x4db8e4,_0x793434,_0x53efa0){var _0x40e13c,_0xfabd73,_0x242538;_0x53efa0[_0x035c('0x7b')]=intUtil[_0x035c('0x7d')](_0x53efa0[_0x035c('0x7b')]);_0x53efa0['serverUrl']=intUtil[_0x035c('0x7d')](_0x53efa0['serverUrl']);if(_0x793434&&_0x793434[_0x035c('0x7e')]){logger[_0x035c('0x2c')]('['+_0x2e625e[_0x035c('0x96')]['toUpperCase']()+']',_0x035c('0x80'));_0x2e625e[_0x035c('0x81')]=_0x53efa0[_0x035c('0x7c')]+_0x035c('0x8f')+_0x2e625e[_0x035c('0x83')]+_0x035c('0x82')+md5(_0x2e625e[_0x035c('0x83')]);}else{_0x2e625e[_0x035c('0x81')]='';}var _0x1704a1=_0x53efa0[_0x035c('0x7b')]===_0x035c('0x84')?'eu':_0x035c('0x85');return getAccessToken(_0x53efa0)[_0x035c('0x27')](function(_0x45133a){_0x242538=_0x45133a;return getUser(_0x242538,_0x1704a1,_0x53efa0);})['then'](function(_0x4f2eba){_0x40e13c=_0x4f2eba;logger['info'](_0x035c('0x86'),_0x40e13c['id']);return getEndUser(_0x242538,_0x1704a1,_0x53efa0,_0x2e625e[_0x035c('0x97')],_0x2e625e[_0x035c('0x87')],_0x40e13c,_0x5ec843);})[_0x035c('0x27')](function(_0x4d5d6a){_0xfabd73=_0x4d5d6a;return getCall(_0x242538,_0x1704a1,_0x53efa0,_0x40e13c,_0xfabd73,_0x5ec843,_0x2e625e,'Inbound');})['then'](function(_0x1ecbc4){if(_0x1ecbc4){logger['info'](_0x035c('0x88'),_0x1ecbc4['id']);}})[_0x035c('0x3a')](function(_0x7e9466){logger[_0x035c('0x2a')]('['+_0x2e625e[_0x035c('0x96')][_0x035c('0x98')]()+']',JSON['stringify'](_0x7e9466));});}; \ No newline at end of file +var _0x8768=['lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','catch','error','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','findIndex','email','info','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','startCase','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','format','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','The\x20Call\x20ID\x20is:'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x8768,0xa1));var _0x8876=function(_0x5d9be1,_0x282e7b){_0x5d9be1=_0x5d9be1-0x0;var _0x30e3eb=_0x8768[_0x5d9be1];return _0x30e3eb;};'use strict';var _=require(_0x8876('0x0'));var rp=require(_0x8876('0x1'));var md5=require(_0x8876('0x2'));var util=require(_0x8876('0x3'));var intUtil=require(_0x8876('0x4'));var moment=require(_0x8876('0x5'));var Redis=require(_0x8876('0x6'));var BPromise=require(_0x8876('0x7'));var config=require(_0x8876('0x8'));var logger=require(_0x8876('0x9'))(_0x8876('0xa'));config[_0x8876('0xb')]=_[_0x8876('0xc')](config['redis'],{'host':_0x8876('0xd'),'port':0x18eb});var io=require(_0x8876('0xe'))(new Redis(config[_0x8876('0xb')]));function emit(_0x26bd0e,_0x3d1170,_0x49206c){io['to'](_0x26bd0e)['emit'](_0x3d1170,_0x49206c);}function request(_0xa6742b){logger[_0x8876('0xf')]('[HTTP]',JSON['stringify'](_0xa6742b));return rp(_0xa6742b);}function getCustomFields(_0xc1ddfd,_0x20fe1e){var _0x477cf9={};if(_0xc1ddfd[_0x8876('0x10')]>0x0){_[_0x8876('0x11')](_0xc1ddfd,function(_0x5f7de4){if(_0x5f7de4[_0x8876('0x12')]===_0x8876('0x13')&&_0x5f7de4[_0x8876('0x14')]){_0x477cf9[_0x5f7de4[_0x8876('0x14')]]=_0x5f7de4['content'][_0x8876('0x15')]();}else if(_0x5f7de4[_0x8876('0x12')]===_0x8876('0x16')&&_0x5f7de4[_0x8876('0x17')]&&_0x5f7de4[_0x8876('0x14')]&&_0x20fe1e[_0x5f7de4['variableName']]){_0x477cf9[_0x5f7de4[_0x8876('0x14')]]=_0x20fe1e[_0x5f7de4[_0x8876('0x17')]][_0x8876('0x15')]();}else if(_0x5f7de4[_0x8876('0x12')]===_0x8876('0x18')&&_0x5f7de4[_0x8876('0x19')]&&_0x5f7de4[_0x8876('0x19')]['name']&&_0x5f7de4[_0x8876('0x14')]&&_0x20fe1e[_0x5f7de4[_0x8876('0x19')][_0x8876('0x1a')][_0x8876('0x1b')]()]){_0x477cf9[_0x5f7de4[_0x8876('0x14')]]=_0x20fe1e[_0x5f7de4['Variable']['name'][_0x8876('0x1b')]()][_0x8876('0x15')]();}});}return _0x477cf9;}function getName(_0xafb2dd){if(_0xafb2dd['indexOf']('\x20')>0x0){var _0x19b31d=_0xafb2dd[_0x8876('0x1c')](/ (.+)/);if(_0x19b31d[0x1]){return _0x19b31d;}}return[_0xafb2dd,_0xafb2dd];}var accountsTokens={};function getAccessToken(_0x53f785){return new Promise(function(_0x34c6dd,_0xe3c6a1){if(!_[_0x8876('0x1d')](accountsTokens[_0x53f785['id']])&&!_[_0x8876('0x1d')](accountsTokens[_0x53f785['id']][_0x8876('0x1e')])){if(moment()[_0x8876('0x1f')](accountsTokens[_0x53f785['id']][_0x8876('0x20')])){_0x34c6dd(accountsTokens[_0x53f785['id']]['access_token']);}}var _0x3dd3f1;switch(_0x53f785['zone']){case'US':_0x3dd3f1=_0x8876('0x21');break;case'AU':_0x3dd3f1=_0x8876('0x22');break;case'EU':_0x3dd3f1=_0x8876('0x23');break;case'IN':_0x3dd3f1=_0x8876('0x24');break;case'CN':_0x3dd3f1=_0x8876('0x25');break;default:_0x3dd3f1=_0x8876('0x23');break;}var _0x18425b={'method':_0x8876('0x26'),'uri':_0x3dd3f1+_0x8876('0x27'),'qs':{'refresh_token':_0x53f785[_0x8876('0x28')],'client_id':_0x53f785[_0x8876('0x29')],'client_secret':_0x53f785[_0x8876('0x2a')],'grant_type':_0x8876('0x2b')},'json':!![]};return rp(_0x18425b)['then'](function(_0x302b9f){accountsTokens[_0x53f785['id']]={'access_token':_0x302b9f[_0x8876('0x1e')],'expires_in':moment()[_0x8876('0x2c')](_0x302b9f[_0x8876('0x20')],_0x8876('0x2d'))};_0x34c6dd(_0x302b9f[_0x8876('0x1e')]);})[_0x8876('0x2e')](function(_0x50dec8){logger[_0x8876('0x2f')]('Failing\x20creating\x20the\x20access_token',_0x50dec8['stack']);_0xe3c6a1(_0x50dec8);});});}function getUser(_0x18203c,_0x57ea22,_0x49de2e,_0x41312a){logger['info']('Search\x20user');return request({'method':_0x8876('0x30'),'uri':util['format'](_0x8876('0x31'),_0x57ea22),'qs':{'type':_0x8876('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x18203c},'json':!![]})[_0x8876('0x33')](function(_0x58cef0){if(_0x58cef0['users']){var _0x215587=-0x1;if(_['isArrayLikeObject'](_0x58cef0[_0x8876('0x34')])){if(!_[_0x8876('0x1d')](_0x41312a)){_0x215587=_[_0x8876('0x35')](_0x58cef0['users'],function(_0x3620a0){return _0x3620a0[_0x8876('0x36')]===_0x41312a;});}if(_0x215587>=0x0){logger[_0x8876('0x37')](_0x8876('0x38'));}else{logger[_0x8876('0x37')]('Using\x20the\x20admin\x20account!');_0x215587=_['findIndex'](_0x58cef0[_0x8876('0x34')],function(_0x42c83b){return _0x42c83b[_0x8876('0x39')]['name']===_0x8876('0x3a');});}return _0x58cef0[_0x8876('0x34')][_0x215587];}else{if(_0x58cef0['user'][_0x8876('0x39')][_0x8876('0x1a')]===_0x8876('0x3a')){logger[_0x8876('0x37')](_0x8876('0x3b'));user=_0x58cef0[_0x8876('0x3c')];return user;}else{logger[_0x8876('0x2f')](_0x8876('0x3d'),JSON[_0x8876('0x3e')](_0x58cef0));throw new Error(_0x8876('0x3f')+JSON['stringify'](_0x58cef0));}}}else{logger[_0x8876('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x8876('0x3e')](_0x58cef0));throw new Error(_0x8876('0x3f')+JSON['stringify'](_0x58cef0));}})[_0x8876('0x2e')](function(_0x3d6b5a){console['error'](_0x3d6b5a);});}function getZohoUser(_0x4c971c,_0x49e237){return new BPromise(function(_0x3a3c36,_0x38bd2a){request(_0x4c971c)[_0x8876('0x33')](function(_0x13d0fd){var _0x373e9c=null;if(_0x13d0fd){_0x373e9c=_0x13d0fd['data'][0x0];_0x373e9c[_0x8876('0x40')]=_0x49e237;}_0x3a3c36(_0x373e9c);})[_0x8876('0x2e')](function(_0x349bca){_0x38bd2a(_0x349bca);});});}function createEndUser(_0x558921,_0x49d49c,_0x36f3fb,_0x132983,_0x90687f,_0x357b87){var _0x36f3fb=getName(_0x36f3fb);return request({'method':_0x8876('0x26'),'uri':_0x8876('0x41')+_0x49d49c+'/crm/v2/'+_['startCase'](_0x357b87[_0x8876('0x42')])+'s','body':{'data':[{'Last_Name':_0x36f3fb[0x1],'First_Name':_0x36f3fb[0x0],'Phone':_0x132983,'Owner':{'name':!_['isNil'](_0x90687f[_0x8876('0x43')][_0x8876('0x1a')])?_0x90687f[_0x8876('0x43')][_0x8876('0x1a')]:!_[_0x8876('0x1d')](_0x90687f[_0x8876('0x44')])?_0x90687f[_0x8876('0x44')]+'\x20'+_0x90687f['last_name']:_0x90687f[_0x8876('0x45')],'id':_0x90687f['id']}}]},'headers':{'Authorization':_0x8876('0x46')+_0x558921},'json':!![]})[_0x8876('0x33')](function(_0x44078a){if(_0x44078a&&_0x44078a[_0x8876('0x47')][0x0][_0x8876('0x48')]===_0x8876('0x49')){var _0x5cc008=_0x44078a['data'][0x0][_0x8876('0x4a')];_0x5cc008[_0x8876('0x40')]=_[_0x8876('0x4b')](_0x357b87[_0x8876('0x42')])+'s';return _0x5cc008;}logger[_0x8876('0x2f')](_0x8876('0x3d'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x8876('0x3e')](data));})['catch'](function(_0x5bb209){console[_0x8876('0x4c')](_0x8876('0x4d'),_0x5bb209);});}function getEndUser(_0x346c78,_0x3717ba,_0x524fc6,_0x186588,_0x56c14c,_0x37750e,_0x2f6c8b){var _0x314b8c={'method':_0x8876('0x30'),'uri':'','headers':{'Authorization':_0x8876('0x46')+_0x346c78},'json':!![]};switch(_0x2f6c8b[_0x8876('0x4e')]){case _0x8876('0x4f'):_0x314b8c[_0x8876('0x50')]=_0x8876('0x41')+_0x3717ba+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x56c14c+'))';return getZohoUser(_0x314b8c,_0x8876('0x51'))[_0x8876('0x33')](function(_0x1b93e6){if(_0x1b93e6)return _0x1b93e6;_0x314b8c[_0x8876('0x50')]=_0x8876('0x41')+_0x3717ba+_0x8876('0x52')+_0x56c14c+'))';return getZohoUser(_0x314b8c,_0x8876('0x53'))[_0x8876('0x33')](function(_0x50c2bd){if(_0x50c2bd)return _0x50c2bd;if(_0x2f6c8b['moduleCreate']!='nothing'){return createEndUser(_0x346c78,_0x3717ba,_0x186588,_0x56c14c,_0x37750e,_0x2f6c8b);}else{return{};}});});break;case _0x8876('0x54'):_0x314b8c[_0x8876('0x50')]=_0x8876('0x41')+_0x3717ba+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x56c14c+'))';return getZohoUser(_0x314b8c,_0x8876('0x51'))[_0x8876('0x33')](function(_0x6d15a4){if(_0x6d15a4)return _0x6d15a4;if(_0x2f6c8b[_0x8876('0x42')]!=_0x8876('0x55')){return createEndUser(_0x346c78,_0x3717ba,_0x186588,_0x56c14c,_0x37750e,_0x2f6c8b);}else{return{};}});break;case _0x8876('0x56'):_0x314b8c[_0x8876('0x50')]=_0x8876('0x41')+_0x3717ba+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x56c14c+'))';return getZohoUser(_0x314b8c,_0x8876('0x53'))[_0x8876('0x33')](function(_0x2669ec){if(_0x2669ec)return _0x2669ec;if(_0x2f6c8b['moduleCreate']!='nothing'){return createEndUser(_0x346c78,_0x3717ba,_0x186588,_0x56c14c,_0x37750e,_0x2f6c8b);}else{return{};}});break;}}function getCall(_0x3acf50,_0x2db7f7,_0x62b32b,_0x109318,_0x183031,_0x28262f,_0x45ac54,_0x24901a){logger[_0x8876('0x37')]('Creating\x20new\x20call...');var _0x33340d={};_0x33340d[_0x8876('0x57')]={'name':!_['isNil'](_0x109318[_0x8876('0x43')][_0x8876('0x1a')])&&!_[_0x8876('0x1d')](_0x109318[_0x8876('0x39')][_0x8876('0x1a')])&&_0x109318[_0x8876('0x39')][_0x8876('0x1a')]===_0x8876('0x58')?_0x109318[_0x8876('0x43')][_0x8876('0x1a')]:!_[_0x8876('0x1d')](_0x109318[_0x8876('0x44')])?_0x109318[_0x8876('0x44')]+'\x20'+_0x109318[_0x8876('0x45')]:_0x109318['last_name'],'id':_0x109318['id']};_0x33340d[_0x8876('0x59')]=intUtil[_0x8876('0x5a')](_0x28262f[_0x8876('0x5b')],_0x45ac54,'\x20');_0x33340d[_0x8876('0x5c')]=intUtil['getString'](_0x28262f[_0x8876('0x5d')],_0x45ac54,'\x0a');if(_0x183031[_0x8876('0x40')]===_0x8876('0x51')){_0x33340d[_0x8876('0x5e')]={'name':!_[_0x8876('0x1d')](_0x183031[_0x8876('0x5f')])?_0x183031[_0x8876('0x5f')]:!_['isNil'](_0x183031[_0x8876('0x60')])?_0x183031[_0x8876('0x60')]+'\x20'+_0x183031['Last_Name']:_0x183031['Last_Name'],'id':_0x183031['id']};}if(_0x183031['enduserType']===_0x8876('0x53')){_0x33340d['What_Id']={'name':!_['isNil'](_0x183031[_0x8876('0x5f')])?_0x183031[_0x8876('0x5f')]:!_[_0x8876('0x1d')](_0x183031['First_Name'])?_0x183031[_0x8876('0x60')]+'\x20'+_0x183031['Last_Name']:_0x183031[_0x8876('0x61')],'id':_0x183031['id']};_0x33340d[_0x8876('0x62')]=_[_0x8876('0x4b')](_0x183031[_0x8876('0x40')]);}if(_0x45ac54['talktime']){_0x33340d[_0x8876('0x63')]=moment[_0x8876('0x64')](parseInt(_0x45ac54[_0x8876('0x65')])*0x3e8)['format'](_0x8876('0x66'));}else if(_0x45ac54[_0x8876('0x67')]&&_0x45ac54[_0x8876('0x68')]){_0x33340d[_0x8876('0x63')]=moment[_0x8876('0x64')](moment(_0x45ac54[_0x8876('0x68')],_0x8876('0x69'))[_0x8876('0x6a')](moment(_0x45ac54['starttime'],_0x8876('0x69'))))[_0x8876('0x6b')](_0x8876('0x66'));}switch(_0x45ac54[_0x8876('0x6c')]){case'called':_0x33340d[_0x8876('0x6d')]=_0x8876('0x6e');break;case _0x8876('0x6f'):case _0x8876('0x70'):_0x33340d[_0x8876('0x6d')]=_0x8876('0x71');break;case _0x8876('0x72'):_0x33340d['Call_Result']=_0x8876('0x73');break;case _0x8876('0x74'):_0x33340d[_0x8876('0x6d')]='Abandoned';break;case _0x8876('0x75'):_0x33340d['Call_Result']=_0x8876('0x76');default:}_0x33340d[_0x8876('0x77')]=(_0x24901a===_0x8876('0x78')?moment(_0x45ac54[_0x8876('0x79')])[_0x8876('0x6b')](_0x8876('0x69')):moment(_0x45ac54[_0x8876('0x7a')])[_0x8876('0x6b')](_0x8876('0x69')))||moment()[_0x8876('0x6b')](_0x8876('0x69'));_0x33340d[_0x8876('0x7b')]=_0x24901a||_0x8876('0x7c');_0x33340d=_[_0x8876('0x7d')](_0x33340d,getCustomFields(_0x28262f[_0x8876('0x7e')],_0x45ac54));return request({'method':'POST','uri':_0x8876('0x41')+_0x2db7f7+_0x8876('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3acf50},'body':{'data':[_0x33340d]},'json':!![]})[_0x8876('0x33')](function(_0x7afbe7){if(_0x7afbe7&&_0x7afbe7[_0x8876('0x47')][0x0][_0x8876('0x48')]===_0x8876('0x49')){logger[_0x8876('0x37')](_0x8876('0x80'));return{'id':_0x7afbe7[_0x8876('0x47')][0x0][_0x8876('0x4a')]['id']};}})[_0x8876('0x2e')](function(_0x4a4ca4){logger['info'](_0x8876('0x81'),_0x4a4ca4[_0x8876('0x82')]);console['log'](_0x8876('0x81'),_0x4a4ca4);});}exports[_0x8876('0x83')]=function(_0x69e838,_0x4bc3f0,_0x5b3e32,_0x25e4eb,_0x574b70,_0xb0581c){var _0x54ed3f,_0x4b96a5,_0x1b61df;_0xb0581c[_0x8876('0x84')]=intUtil[_0x8876('0x85')](_0xb0581c['host']);_0xb0581c['serverUrl']=intUtil[_0x8876('0x85')](_0xb0581c[_0x8876('0x86')]);if(_0x574b70&&_0x574b70[_0x8876('0x87')]){logger[_0x8876('0x37')](_0x8876('0x88'),_0x8876('0x89'));_0x4bc3f0[_0x8876('0x8a')]=_0xb0581c[_0x8876('0x86')]+'/api/voice/recordings/'+_0x4bc3f0[_0x8876('0x8b')]+_0x8876('0x8c')+md5(_0x4bc3f0[_0x8876('0x8b')]);}else{_0x4bc3f0['recordingURL']='';}var _0x195477=_0xb0581c[_0x8876('0x84')]==='zoho.eu'?'eu':'com';return getAccessToken(_0xb0581c)[_0x8876('0x33')](function(_0x47bb44){_0x1b61df=_0x47bb44;return getUser(_0x1b61df,_0x195477,_0xb0581c,_0x25e4eb['email']);})[_0x8876('0x33')](function(_0x3b428b){_0x54ed3f=_0x3b428b;logger['info'](_0x8876('0x8d'),_0x54ed3f['id']);return getEndUser(_0x1b61df,_0x195477,_0xb0581c,_0x4bc3f0[_0x8876('0x8e')],_0x4bc3f0[_0x8876('0x8f')],_0x54ed3f,_0x5b3e32);})[_0x8876('0x33')](function(_0x4e12d2){_0x4b96a5=_0x4e12d2;return getCall(_0x1b61df,_0x195477,_0xb0581c,_0x54ed3f,_0x4b96a5,_0x5b3e32,_0x4bc3f0,_0x8876('0x7c'));})['then'](function(_0x579b81){if(_0x579b81){logger[_0x8876('0x37')]('The\x20Call\x20ID\x20is:',_0x579b81['id']);logger[_0x8876('0x37')](_0x8876('0x88'),_0x8876('0x90'));emit(util[_0x8876('0x6b')](_0x8876('0x91'),_0x25e4eb[_0x8876('0x1a')]),_0x8876('0x92'),{'uri':_0x8876('0x93')+_0xb0581c[_0x8876('0x84')]+_0x8876('0x94')+_0x579b81['id']});}})[_0x8876('0x2e')](function(_0xaf500c){logger[_0x8876('0x2f')]('[QUEUE]',JSON[_0x8876('0x3e')](_0xaf500c));});};exports['outbound']=function(_0x1a7878,_0x3ec1d3,_0x39c302,_0x2bc76a,_0x2ee9f9,_0x17d1c1,_0x44efc2){var _0x4acbac,_0x26cc7c,_0x4f9364;_0x17d1c1['host']=intUtil[_0x8876('0x85')](_0x17d1c1[_0x8876('0x84')]);_0x17d1c1[_0x8876('0x86')]=intUtil[_0x8876('0x85')](_0x17d1c1[_0x8876('0x86')]);if(_0x44efc2&&_0x44efc2[_0x8876('0x95')]&&_0x44efc2[_0x8876('0x95')]!==_0x8876('0x96')){logger[_0x8876('0x37')](_0x8876('0x97'),_0x8876('0x89'));_0x3ec1d3[_0x8876('0x8a')]=_0x17d1c1[_0x8876('0x86')]+_0x8876('0x98')+_0x3ec1d3[_0x8876('0x8b')]+_0x8876('0x8c')+md5(_0x3ec1d3[_0x8876('0x8b')]);}var _0x3fb68f=_0x17d1c1['host']===_0x8876('0x99')?'eu':_0x8876('0x9a');return getAccessToken(_0x17d1c1)[_0x8876('0x33')](function(_0x223f1a){_0x4f9364=_0x223f1a;return getUser(_0x4f9364,_0x3fb68f,_0x17d1c1,_0x2bc76a['email']);})[_0x8876('0x33')](function(_0x5ea3be){_0x4acbac=_0x5ea3be;logger[_0x8876('0x37')](_0x8876('0x8d'),_0x4acbac['id']);return getEndUser(_0x4f9364,_0x3fb68f,_0x17d1c1,_0x3ec1d3[_0x8876('0x9b')],_0x3ec1d3[_0x8876('0x9c')],_0x4acbac,_0x39c302);})[_0x8876('0x33')](function(_0x4bc20e){_0x26cc7c=_0x4bc20e;return getCall(_0x4f9364,_0x3fb68f,_0x17d1c1,_0x4acbac,_0x26cc7c,_0x39c302,_0x3ec1d3,_0x8876('0x9d'));})[_0x8876('0x33')](function(_0x1e3421){if(_0x1e3421){logger['info']('The\x20Call\x20ID\x20is:',_0x1e3421['id']);logger['info'](_0x8876('0x97'),_0x8876('0x90'));emit(util[_0x8876('0x6b')](_0x8876('0x91'),_0x2bc76a[_0x8876('0x1a')]),_0x8876('0x92'),{'uri':_0x8876('0x93')+_0x17d1c1['host']+_0x8876('0x94')+_0x1e3421['id']});}})[_0x8876('0x2e')](function(_0x340b99){logger['error'](_0x8876('0x97'),JSON[_0x8876('0x3e')](_0x340b99));});};exports[_0x8876('0x9e')]=function(_0x12a9af,_0x1ef338,_0x10deff,_0x50f5ac,_0x339791,_0x277bc0){var _0x39b705,_0x4c8b2f,_0x3749cf;_0x277bc0['host']=intUtil[_0x8876('0x85')](_0x277bc0[_0x8876('0x84')]);_0x277bc0[_0x8876('0x86')]=intUtil[_0x8876('0x85')](_0x277bc0['serverUrl']);if(_0x339791&&_0x339791[_0x8876('0x87')]){logger[_0x8876('0x37')]('['+_0x1ef338['lastevent'][_0x8876('0x9f')]()+']','Recording\x20is\x20enabled!');_0x1ef338[_0x8876('0x8a')]=_0x277bc0[_0x8876('0x86')]+_0x8876('0x98')+_0x1ef338[_0x8876('0x8b')]+_0x8876('0x8c')+md5(_0x1ef338[_0x8876('0x8b')]);}else{_0x1ef338[_0x8876('0x8a')]='';}var _0x5ba20c=_0x277bc0[_0x8876('0x84')]===_0x8876('0x99')?'eu':_0x8876('0x9a');return getAccessToken(_0x277bc0)[_0x8876('0x33')](function(_0x36c626){_0x3749cf=_0x36c626;return getUser(_0x3749cf,_0x5ba20c,_0x277bc0);})[_0x8876('0x33')](function(_0x149e33){_0x39b705=_0x149e33;logger[_0x8876('0x37')](_0x8876('0x8d'),_0x39b705['id']);return getEndUser(_0x3749cf,_0x5ba20c,_0x277bc0,_0x1ef338[_0x8876('0x8e')],_0x1ef338['calleridnum'],_0x39b705,_0x10deff);})[_0x8876('0x33')](function(_0x23fb7c){_0x4c8b2f=_0x23fb7c;return getCall(_0x3749cf,_0x5ba20c,_0x277bc0,_0x39b705,_0x4c8b2f,_0x10deff,_0x1ef338,_0x8876('0x7c'));})['then'](function(_0x3941eb){if(_0x3941eb){logger['info'](_0x8876('0xa0'),_0x3941eb['id']);}})[_0x8876('0x2e')](function(_0xbc140f){logger['error']('['+_0x1ef338[_0x8876('0x6c')][_0x8876('0x9f')]()+']',JSON[_0x8876('0x3e')](_0xbc140f));});}; \ 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 6b94bb8..1b0f3e6 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x5901eb,_0x32fd87){var _0x316a98=function(_0x53bcd0){while(--_0x53bcd0){_0x5901eb['push'](_0x5901eb['shift']());}};_0x316a98(++_0x32fd87);}(_0x7a54,0x106));var _0x47a5=function(_0x11b79c,_0x19a1af){_0x11b79c=_0x11b79c-0x0;var _0x53c278=_0x7a54[_0x11b79c];return _0x53c278;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x421c85,_0xcdb459){var _0x1cba06=function(_0x314d17){while(--_0x314d17){_0x421c85['push'](_0x421c85['shift']());}};_0x1cba06(++_0xcdb459);}(_0x7a54,0x106));var _0x47a5=function(_0xef0d3c,_0x231aa4){_0xef0d3c=_0xef0d3c-0x0;var _0x364f0e=_0x7a54[_0xef0d3c];return _0x364f0e;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 2ecb7e6..a2b79b2 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 _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%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','name','message','request-promise','util'];(function(_0x3df708,_0x399274){var _0x2e00a7=function(_0xec419){while(--_0xec419){_0x3df708['push'](_0x3df708['shift']());}};_0x2e00a7(++_0x399274);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3fb439,_0x3401f8){_0x3fb439=_0x3fb439-0x0;var _0x449cbf=_0x5f2f[_0x3fb439];return _0x449cbf;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%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','name','message','request-promise','util'];(function(_0x53cfb4,_0x184ff2){var _0x3b75d0=function(_0x116b11){while(--_0x116b11){_0x53cfb4['push'](_0x53cfb4['shift']());}};_0x3b75d0(++_0x184ff2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e78f8,_0x4e27c4){_0x4e78f8=_0x4e78f8-0x0;var _0x15de1d=_0x5f2f[_0x4e78f8];return _0x15de1d;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9a30674..c7dc6bf 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 _0xd6d2=['then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing','client','Request'];(function(_0x5d9727,_0x5b2b0a){var _0x2c9537=function(_0x538db7){while(--_0x538db7){_0x5d9727['push'](_0x5d9727['shift']());}};_0x2c9537(++_0x5b2b0a);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x792d42,_0x122315){_0x792d42=_0x792d42-0x0;var _0x160611=_0xd6d2[_0x792d42];return _0x160611;};'use strict';var jayson=require(_0x2d6d('0x0'));var BPromise=require(_0x2d6d('0x1'));var logger=require('../../config/logger')(_0x2d6d('0x2'));var client=jayson[_0x2d6d('0x3')]['http']({'port':0x2329});client[_0x2d6d('0x4')]=function(_0x482d86,_0x1c5e54){return new BPromise(function(_0x3ee519,_0x168531){return client['request'](_0x482d86,_0x1c5e54)[_0x2d6d('0x5')](function(_0x132361){logger[_0x2d6d('0x6')](_0x2d6d('0x7'),_0x2d6d('0x2'),_0x482d86,_0x1c5e54,_0x132361);if(_0x132361[_0x2d6d('0x8')]){logger[_0x2d6d('0x8')](_0x2d6d('0x7'),_0x2d6d('0x2'),_0x482d86,_0x132361[_0x2d6d('0x8')][_0x2d6d('0x9')],_0x1c5e54);return _0x168531(_0x132361['error'][_0x2d6d('0x9')]);}else{return _0x3ee519(_0x132361[_0x2d6d('0xa')]);}})[_0x2d6d('0xb')](function(_0x3cc2fa){logger[_0x2d6d('0x8')]('rpc',_0x2d6d('0x2'),_0x482d86,_0x3cc2fa,_0x1c5e54);return _0x168531(_0x3cc2fa);});});};module[_0x2d6d('0xc')]=client; \ No newline at end of file +var _0x4250=['error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4250,0x146));var _0x0425=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x4250[_0x433a86];return _0x23000c;};'use strict';var jayson=require(_0x0425('0x0'));var BPromise=require(_0x0425('0x1'));var logger=require(_0x0425('0x2'))(_0x0425('0x3'));var client=jayson['client'][_0x0425('0x4')]({'port':0x2329});client[_0x0425('0x5')]=function(_0xf675cc,_0x5abe75){return new BPromise(function(_0x1dd2ed,_0x2f644b){return client[_0x0425('0x6')](_0xf675cc,_0x5abe75)[_0x0425('0x7')](function(_0x307761){logger[_0x0425('0x8')](_0x0425('0x9'),_0x0425('0x3'),_0xf675cc,_0x5abe75,_0x307761);if(_0x307761[_0x0425('0xa')]){logger[_0x0425('0xa')](_0x0425('0x9'),_0x0425('0x3'),_0xf675cc,_0x307761[_0x0425('0xa')][_0x0425('0xb')],_0x5abe75);return _0x2f644b(_0x307761[_0x0425('0xa')][_0x0425('0xb')]);}else{return _0x1dd2ed(_0x307761[_0x0425('0xc')]);}})['catch'](function(_0x56ed86){logger[_0x0425('0xa')]('rpc',_0x0425('0x3'),_0xf675cc,_0x56ed86,_0x5abe75);return _0x2f644b(_0x56ed86);});});};module[_0x0425('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 26ab206..81d61d5 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 _0x0309=['initMailAccounts','mailAccounts','listen','Setting','findOne','loginMailFrequency','log','bluebird','./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts'];(function(_0x4bbf6b,_0x313314){var _0x1560d5=function(_0x2e9b00){while(--_0x2e9b00){_0x4bbf6b['push'](_0x4bbf6b['shift']());}};_0x1560d5(++_0x313314);}(_0x0309,0x165));var _0x9030=function(_0x29570b,_0x3015bd){_0x29570b=_0x29570b-0x0;var _0x55737b=_0x0309[_0x29570b];return _0x55737b;};'use strict';var BPromise=require(_0x9030('0x0'));var server=require('./server');var Realtime=require(_0x9030('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x9030('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x9030('0x3'))['db'];function initRealtime(){return BPromise[_0x9030('0x4')]()[_0x9030('0x5')](mailAccount[_0x9030('0x6')]())[_0x9030('0x5')](realtime[_0x9030('0x7')]())['then'](function(){email['refresh'](realtime[_0x9030('0x8')]);return realtime;});}function main(){return server[_0x9030('0x9')](realtime,email)['then'](function(_0xb53eb4){return initRealtime();})['then'](function(_0x1e2360){return db[_0x9030('0xa')][_0x9030('0xb')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0x9030('0x5')](function(_0x1da9ec){return setInterval(initRealtime,_0x1da9ec[_0x9030('0xc')]*0x3e8);})['catch'](function(_0x37d6e0){console[_0x9030('0xd')](_0x37d6e0);});}main(); \ No newline at end of file +var _0xc21e=['getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve'];(function(_0x3fb65b,_0x55aff0){var _0x54faa5=function(_0x2760a2){while(--_0x2760a2){_0x3fb65b['push'](_0x3fb65b['shift']());}};_0x54faa5(++_0x55aff0);}(_0xc21e,0x1ca));var _0xec21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc21e[_0x59ee6f];return _0x4c0979;};'use strict';var BPromise=require('bluebird');var server=require(_0xec21('0x0'));var Realtime=require(_0xec21('0x1'));var EmailChannel=require(_0xec21('0x2'));var mailAccount=require(_0xec21('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xec21('0x4'))['db'];function initRealtime(){return BPromise[_0xec21('0x5')]()['then'](mailAccount[_0xec21('0x6')]())[_0xec21('0x7')](realtime[_0xec21('0x8')]())[_0xec21('0x7')](function(){email[_0xec21('0x9')](realtime[_0xec21('0xa')]);return realtime;});}function main(){return server[_0xec21('0xb')](realtime,email)[_0xec21('0x7')](function(_0x51f6dc){return initRealtime();})[_0xec21('0x7')](function(_0x3d74a2){return db[_0xec21('0xc')][_0xec21('0xd')]({'attributes':['id',_0xec21('0xe')],'raw':!![]});})['then'](function(_0x110420){return setInterval(initRealtime,_0x110420[_0xec21('0xe')]*0x3e8);})[_0xec21('0xf')](function(_0x4d13f0){console['log'](_0x4d13f0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a2147c0..5eb423c 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 _0x590a=['handleImapBox','bind','handleImapEnd','error','disabled','connected','messageStatus','name','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','send','Smtp','verify','status','verified','exports','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','localhost','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','email','box'];(function(_0x1b10a9,_0x125d7c){var _0x1a8374=function(_0x2bc7e7){while(--_0x2bc7e7){_0x1b10a9['push'](_0x1b10a9['shift']());}};_0x1a8374(++_0x125d7c);}(_0x590a,0xae));var _0xa590=function(_0x588d09,_0x51fce1){_0x588d09=_0x588d09-0x0;var _0x3d69f0=_0x590a[_0x588d09];return _0x3d69f0;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xa590('0x0'));var md5=require(_0xa590('0x1'));var Redis=require(_0xa590('0x2'));var config=require(_0xa590('0x3'));var logger=require(_0xa590('0x4'))('email');config[_0xa590('0x5')]=_['defaults'](config[_0xa590('0x5')],{'host':_0xa590('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xa590('0x7'));var md5Accounts={};function EmailChannel(_0x731ca){logger[_0xa590('0x8')](_0xa590('0x9'));this[_0xa590('0xa')]=_0x731ca[_0xa590('0xa')];this[_0xa590('0xb')]={};this[_0xa590('0xc')]=new EmailSmtp();}EmailChannel[_0xa590('0xd')][_0xa590('0xe')]=function(_0x27ca0e){var _0x2be9ee=this[_0xa590('0xa')][_0x27ca0e];var _0x5dbe1b={'id':_0x2be9ee['id'],'name':_0x2be9ee['name'],'key':_0x2be9ee[_0xa590('0xf')],'active':_0x2be9ee[_0xa590('0x10')],'Imap':{'status':_0x2be9ee['Imap']['status'],'messageStatus':_0x2be9ee[_0xa590('0x11')]['messageStatus'],'total':_0x2be9ee[_0xa590('0x11')][_0xa590('0x12')]}};if(_[_0xa590('0x13')](md5Accounts[_0x27ca0e])){md5Accounts[_0x27ca0e]={};}var _0x583d1c=md5(JSON[_0xa590('0x14')](_0x5dbe1b));if(md5Accounts[_0x27ca0e][_0xa590('0x1')]!==_0x583d1c){md5Accounts[_0x27ca0e][_0xa590('0x1')]=_0x583d1c;io['emit'](_0xa590('0x15'),_0x5dbe1b);}};EmailChannel[_0xa590('0xd')][_0xa590('0x16')]=function(_0x2417bd){for(var _0x35e957 in _0x2417bd){if(_0x2417bd[_0xa590('0x17')](_0x35e957)){if(_0x2417bd[_0x35e957]['Imap']&&_0x2417bd[_0x35e957][_0xa590('0x10')]){var _0x413f26=_0x2417bd[_0x35e957][_0xa590('0x11')];if(!this[_0xa590('0xb')][_0xa590('0x17')](_0x413f26['id'])){this[_0xa590('0xb')][_0x413f26['id']]=new EmailImap(_0x413f26,_0x2417bd[_0x35e957][_0xa590('0x18')]);this[_0xa590('0xb')][_0x413f26['id']]['on'](_0xa590('0x19'),this[_0xa590('0x1a')]['bind'](this,_0x35e957));this[_0xa590('0xb')][_0x413f26['id']]['on'](_0xa590('0x18'),this['handleImapEmail'][_0xa590('0x1b')](this,_0x35e957));this[_0xa590('0xb')][_0x413f26['id']]['on']('end',this[_0xa590('0x1c')][_0xa590('0x1b')](this,_0x35e957));this[_0xa590('0xb')][_0x413f26['id']]['on'](_0xa590('0x1d'),this['handleImapError'][_0xa590('0x1b')](this,_0x35e957));}}else{if(_[_0xa590('0x13')](this[_0xa590('0xa')][_0x35e957][_0xa590('0x11')])){this[_0xa590('0xa')][_0x35e957][_0xa590('0x11')]={};}this[_0xa590('0xa')][_0x35e957][_0xa590('0x11')]['status']=_0xa590('0x1e');this[_0xa590('0xa')][_0x35e957][_0xa590('0x11')]['messageStatus']='';this['emit'](_0x35e957);}}}};EmailChannel['prototype'][_0xa590('0x1a')]=function(_0x5d1000,_0x96814f){if(this[_0xa590('0xa')][_0x5d1000]){this[_0xa590('0xa')][_0x5d1000][_0xa590('0x11')]['status']=_0xa590('0x1f');this[_0xa590('0xa')][_0x5d1000][_0xa590('0x11')][_0xa590('0x20')]=_0x96814f[_0xa590('0x21')];if(_0x96814f['messages']){this['mailAccounts'][_0x5d1000][_0xa590('0x11')][_0xa590('0x12')]=_0x96814f['messages'][_0xa590('0x12')];}return this[_0xa590('0xe')](_0x5d1000);}};EmailChannel['prototype']['handleImapEmail']=function(_0x247650,_0x30b1c6){logger[_0xa590('0x8')](_0xa590('0x22'),_0x30b1c6['firstName'],_0x30b1c6[_0xa590('0x23')],_0x30b1c6[_0xa590('0x24')],_0x247650);if(this[_0xa590('0xa')][_0x247650]){return mailAccount[_0xa590('0x25')](_0x247650,_0x30b1c6)[_0xa590('0x26')](function(_0x35d28a){if(_0x35d28a){logger['info'](_0xa590('0x27'));}})[_0xa590('0x28')](function(_0x39d1ef){logger[_0xa590('0x1d')](_0xa590('0x29'),JSON[_0xa590('0x14')](_0x39d1ef));});}};EmailChannel['prototype'][_0xa590('0x1c')]=function(_0x3a237e){if(this['mailAccounts'][_0x3a237e]&&this[_0xa590('0xa')][_0x3a237e][_0xa590('0x11')]){if(this[_0xa590('0xb')][this[_0xa590('0xa')][_0x3a237e][_0xa590('0x11')]['id']]){delete this[_0xa590('0xb')][this[_0xa590('0xa')][_0x3a237e][_0xa590('0x11')]['id']];}this[_0xa590('0xa')][_0x3a237e][_0xa590('0x11')][_0xa590('0x2a')]=moment();this[_0xa590('0xe')](_0x3a237e);}};EmailChannel[_0xa590('0xd')][_0xa590('0x2b')]=function(_0x47104a,_0x299c12){if(this[_0xa590('0xa')][_0x47104a]){this[_0xa590('0xa')][_0x47104a][_0xa590('0x11')]['status']=_0xa590('0x1d');this[_0xa590('0xa')][_0x47104a][_0xa590('0x11')][_0xa590('0x20')]=_0x299c12;return this['emit'](_0x47104a);}};EmailChannel['prototype']['sendMail']=function(_0x5df5ba,_0x2ea487){return this[_0xa590('0xc')][_0xa590('0x2c')](_0x5df5ba,_0x2ea487);};EmailChannel[_0xa590('0xd')]['verifySmtp']=function(_0x7dc0c2){var _0x27a877=this;if(this[_0xa590('0xa')][_0x7dc0c2['id']]){if(_[_0xa590('0x13')](this['mailAccounts'][_0x7dc0c2['id']][_0xa590('0x2d')])){this[_0xa590('0xa')][_0x7dc0c2['id']][_0xa590('0x2d')]={};}this[_0xa590('0xa')][_0x7dc0c2['id']][_0xa590('0x2d')][_0xa590('0x2a')]=moment();return new BPromise(function(_0x4b82d0,_0x2608ee){return _0x27a877[_0xa590('0xc')][_0xa590('0x2e')](_0x7dc0c2)[_0xa590('0x26')](function(_0x2c4df0){_0x27a877[_0xa590('0xa')][_0x7dc0c2['id']][_0xa590('0x2d')][_0xa590('0x2f')]=_0xa590('0x30');_0x27a877[_0xa590('0xa')][_0x7dc0c2['id']][_0xa590('0x2d')][_0xa590('0x20')]='';_0x27a877[_0xa590('0xe')](_0x7dc0c2['id']);_0x4b82d0(_0x2c4df0);})[_0xa590('0x28')](function(_0x5c6fa8){_0x27a877[_0xa590('0xa')][_0x7dc0c2['id']][_0xa590('0x2d')][_0xa590('0x2f')]=_0xa590('0x1d');_0x27a877[_0xa590('0xa')][_0x7dc0c2['id']]['Smtp'][_0xa590('0x20')]=_0x5c6fa8;_0x27a877[_0xa590('0xe')](_0x7dc0c2['id']);_0x2608ee(_0x5c6fa8);});});}return this['smtp'][_0xa590('0x2e')](_0x7dc0c2);};module[_0xa590('0x31')]=EmailChannel; \ No newline at end of file +var _0x6fa1=['bind','end','handleImapEnd','error','disabled','handleImapBox','status','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','isNil','Smtp','verify','then','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','messageStatus','total','stringify','md5','mailAccount:update','hasOwnProperty','active','box'];(function(_0x5b0c0c,_0x32ac18){var _0x160073=function(_0x5d7f4f){while(--_0x5d7f4f){_0x5b0c0c['push'](_0x5b0c0c['shift']());}};_0x160073(++_0x32ac18);}(_0x6fa1,0x96));var _0x16fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6fa1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x16fa('0x0'));var moment=require(_0x16fa('0x1'));var BPromise=require(_0x16fa('0x2'));var md5=require('md5');var Redis=require(_0x16fa('0x3'));var config=require(_0x16fa('0x4'));var logger=require(_0x16fa('0x5'))(_0x16fa('0x6'));config[_0x16fa('0x7')]=_[_0x16fa('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x16fa('0x9'))(new Redis(config[_0x16fa('0x7')]));var EmailImap=require(_0x16fa('0xa'));var EmailSmtp=require(_0x16fa('0xb'));var mailAccount=require(_0x16fa('0xc'));var md5Accounts={};function EmailChannel(_0x5827c7){logger['info'](_0x16fa('0xd'));this['mailAccounts']=_0x5827c7[_0x16fa('0xe')];this[_0x16fa('0xf')]={};this[_0x16fa('0x10')]=new EmailSmtp();}EmailChannel[_0x16fa('0x11')][_0x16fa('0x12')]=function(_0x35de57){var _0x31c75e=this[_0x16fa('0xe')][_0x35de57];var _0x48e171={'id':_0x31c75e['id'],'name':_0x31c75e[_0x16fa('0x13')],'key':_0x31c75e[_0x16fa('0x14')],'active':_0x31c75e['active'],'Imap':{'status':_0x31c75e[_0x16fa('0x15')]['status'],'messageStatus':_0x31c75e['Imap'][_0x16fa('0x16')],'total':_0x31c75e[_0x16fa('0x15')][_0x16fa('0x17')]}};if(_['isNil'](md5Accounts[_0x35de57])){md5Accounts[_0x35de57]={};}var _0x190d14=md5(JSON[_0x16fa('0x18')](_0x48e171));if(md5Accounts[_0x35de57][_0x16fa('0x19')]!==_0x190d14){md5Accounts[_0x35de57][_0x16fa('0x19')]=_0x190d14;io[_0x16fa('0x12')](_0x16fa('0x1a'),_0x48e171);}};EmailChannel[_0x16fa('0x11')]['refresh']=function(_0x26075a){for(var _0x31bda9 in _0x26075a){if(_0x26075a[_0x16fa('0x1b')](_0x31bda9)){if(_0x26075a[_0x31bda9][_0x16fa('0x15')]&&_0x26075a[_0x31bda9][_0x16fa('0x1c')]){var _0x554b7a=_0x26075a[_0x31bda9][_0x16fa('0x15')];if(!this[_0x16fa('0xf')][_0x16fa('0x1b')](_0x554b7a['id'])){this[_0x16fa('0xf')][_0x554b7a['id']]=new EmailImap(_0x554b7a,_0x26075a[_0x31bda9][_0x16fa('0x6')]);this[_0x16fa('0xf')][_0x554b7a['id']]['on'](_0x16fa('0x1d'),this['handleImapBox'][_0x16fa('0x1e')](this,_0x31bda9));this['imapAccounts'][_0x554b7a['id']]['on'](_0x16fa('0x6'),this['handleImapEmail']['bind'](this,_0x31bda9));this[_0x16fa('0xf')][_0x554b7a['id']]['on'](_0x16fa('0x1f'),this[_0x16fa('0x20')]['bind'](this,_0x31bda9));this[_0x16fa('0xf')][_0x554b7a['id']]['on'](_0x16fa('0x21'),this['handleImapError'][_0x16fa('0x1e')](this,_0x31bda9));}}else{if(_['isNil'](this[_0x16fa('0xe')][_0x31bda9]['Imap'])){this[_0x16fa('0xe')][_0x31bda9][_0x16fa('0x15')]={};}this[_0x16fa('0xe')][_0x31bda9]['Imap']['status']=_0x16fa('0x22');this['mailAccounts'][_0x31bda9][_0x16fa('0x15')][_0x16fa('0x16')]='';this[_0x16fa('0x12')](_0x31bda9);}}}};EmailChannel[_0x16fa('0x11')][_0x16fa('0x23')]=function(_0x3886b9,_0x45d1d2){if(this[_0x16fa('0xe')][_0x3886b9]){this[_0x16fa('0xe')][_0x3886b9]['Imap'][_0x16fa('0x24')]=_0x16fa('0x25');this['mailAccounts'][_0x3886b9]['Imap'][_0x16fa('0x16')]=_0x45d1d2[_0x16fa('0x13')];if(_0x45d1d2[_0x16fa('0x26')]){this[_0x16fa('0xe')][_0x3886b9][_0x16fa('0x15')][_0x16fa('0x17')]=_0x45d1d2[_0x16fa('0x26')][_0x16fa('0x17')];}return this[_0x16fa('0x12')](_0x3886b9);}};EmailChannel['prototype'][_0x16fa('0x27')]=function(_0x461d95,_0x533909){logger[_0x16fa('0x28')](_0x16fa('0x29'),_0x533909[_0x16fa('0x2a')],_0x533909[_0x16fa('0x2b')],_0x533909[_0x16fa('0x2c')],_0x461d95);if(this[_0x16fa('0xe')][_0x461d95]){return mailAccount[_0x16fa('0x2d')](_0x461d95,_0x533909)['then'](function(_0x1b0134){if(_0x1b0134){logger[_0x16fa('0x28')](_0x16fa('0x2e'));}})[_0x16fa('0x2f')](function(_0x1b18aa){logger[_0x16fa('0x21')](_0x16fa('0x30'),JSON['stringify'](_0x1b18aa));});}};EmailChannel['prototype'][_0x16fa('0x20')]=function(_0x9e3240){if(this[_0x16fa('0xe')][_0x9e3240]&&this['mailAccounts'][_0x9e3240][_0x16fa('0x15')]){if(this[_0x16fa('0xf')][this['mailAccounts'][_0x9e3240]['Imap']['id']]){delete this[_0x16fa('0xf')][this[_0x16fa('0xe')][_0x9e3240][_0x16fa('0x15')]['id']];}this[_0x16fa('0xe')][_0x9e3240][_0x16fa('0x15')][_0x16fa('0x31')]=moment();this[_0x16fa('0x12')](_0x9e3240);}};EmailChannel[_0x16fa('0x11')][_0x16fa('0x32')]=function(_0x48f0be,_0x5557c7){if(this['mailAccounts'][_0x48f0be]){this[_0x16fa('0xe')][_0x48f0be]['Imap'][_0x16fa('0x24')]=_0x16fa('0x21');this[_0x16fa('0xe')][_0x48f0be][_0x16fa('0x15')]['messageStatus']=_0x5557c7;return this['emit'](_0x48f0be);}};EmailChannel['prototype'][_0x16fa('0x33')]=function(_0x20e4d8,_0xecf8e4){return this[_0x16fa('0x10')][_0x16fa('0x34')](_0x20e4d8,_0xecf8e4);};EmailChannel[_0x16fa('0x11')][_0x16fa('0x35')]=function(_0x168830){var _0x31b04e=this;if(this['mailAccounts'][_0x168830['id']]){if(_[_0x16fa('0x36')](this[_0x16fa('0xe')][_0x168830['id']][_0x16fa('0x37')])){this[_0x16fa('0xe')][_0x168830['id']]['Smtp']={};}this[_0x16fa('0xe')][_0x168830['id']][_0x16fa('0x37')][_0x16fa('0x31')]=moment();return new BPromise(function(_0x2374f9,_0x278d0f){return _0x31b04e[_0x16fa('0x10')][_0x16fa('0x38')](_0x168830)[_0x16fa('0x39')](function(_0x1ed2f2){_0x31b04e[_0x16fa('0xe')][_0x168830['id']][_0x16fa('0x37')][_0x16fa('0x24')]=_0x16fa('0x3a');_0x31b04e[_0x16fa('0xe')][_0x168830['id']][_0x16fa('0x37')][_0x16fa('0x16')]='';_0x31b04e['emit'](_0x168830['id']);_0x2374f9(_0x1ed2f2);})[_0x16fa('0x2f')](function(_0x1be826){_0x31b04e[_0x16fa('0xe')][_0x168830['id']][_0x16fa('0x37')][_0x16fa('0x24')]=_0x16fa('0x21');_0x31b04e[_0x16fa('0xe')][_0x168830['id']][_0x16fa('0x37')]['messageStatus']=_0x1be826;_0x31b04e[_0x16fa('0x12')](_0x168830['id']);_0x278d0f(_0x1be826);});});}return this[_0x16fa('0x10')]['verify'](_0x168830);};module[_0x16fa('0x3b')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6b55dd1..ab1e6d5 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 _0x3299=['stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','lodash','randomstring','simpleParser','iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','ready','bind','end','handleEnd','error','connect','inherits','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','handleReady','prototype','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','emit'];(function(_0x3130d2,_0x1afdf5){var _0x412791=function(_0x1d66f6){while(--_0x1d66f6){_0x3130d2['push'](_0x3130d2['shift']());}};_0x412791(++_0x1afdf5);}(_0x3299,0x85));var _0x9329=function(_0x15f6c2,_0x5be058){_0x15f6c2=_0x15f6c2-0x0;var _0x229bd6=_0x3299[_0x15f6c2];return _0x229bd6;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9329('0x0'));var Imap=require(_0x9329('0x1'));var _=require(_0x9329('0x2'));var rs=require(_0x9329('0x3'));var simpleParser=require('mailparser')[_0x9329('0x4')];var Iconv=require(_0x9329('0x5'))['Iconv'];var EventEmitter=require('events')[_0x9329('0x6')];var utils=require(_0x9329('0x7'));var logger=require(_0x9329('0x8'))(_0x9329('0x9'));function EmailImap(_0x3ffc4a,_0xae6bb6){this[_0x9329('0xa')]=_0x9329('0xb');this['account']=this[_0x9329('0xc')](_0x3ffc4a,_0xae6bb6);this[_0x9329('0x1')]=new Imap(this['account']);this[_0x9329('0x1')][_0x9329('0xd')](_0x9329('0xe'),this['handleReady'][_0x9329('0xf')](this));this['imap'][_0x9329('0xd')](_0x9329('0x10'),this[_0x9329('0x11')][_0x9329('0xf')](this));this[_0x9329('0x1')]['on'](_0x9329('0x12'),this['handleError'][_0x9329('0xf')](this));this[_0x9329('0x1')][_0x9329('0x13')]();}util[_0x9329('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x9329('0xc')]=function(_0x3ac7cb,_0x36bff4){var _0x1d4f0d={'connTimeout':_0x3ac7cb[_0x9329('0x15')]?_0x3ac7cb['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3ac7cb[_0x9329('0x16')]?_0x3ac7cb[_0x9329('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x3ac7cb[_0x9329('0x17')])){if(_0x3ac7cb[_0x9329('0x18')]){_0x1d4f0d[_0x9329('0x19')]=_0x3ac7cb[_0x9329('0x19')];_0x1d4f0d[_0x9329('0x1a')]=_0x3ac7cb[_0x9329('0x1a')];}_0x1d4f0d[_0x9329('0x1b')]=_0x3ac7cb['host'];_0x1d4f0d[_0x9329('0x1c')]=_0x3ac7cb[_0x9329('0x1c')]||0x3e1;if(_0x3ac7cb[_0x9329('0x1d')]){_0x1d4f0d[_0x9329('0x1d')]=!![];}else{_0x1d4f0d[_0x9329('0x1d')]=![];_0x1d4f0d[_0x9329('0x1e')]=_0x9329('0x1f');}}else{_0x1d4f0d[_0x9329('0x19')]=_0x3ac7cb[_0x9329('0x19')];_0x1d4f0d['password']=_0x3ac7cb[_0x9329('0x1a')];_0x1d4f0d['host']=utils[_0x9329('0x20')](_0x3ac7cb[_0x9329('0x17')]);_0x1d4f0d[_0x9329('0x1c')]=0x3e1;_0x1d4f0d[_0x9329('0x1d')]=!![];}_0x1d4f0d[_0x9329('0x9')]=_0x36bff4||_0x3ac7cb['user']||_0x9329('0x21');return _0x1d4f0d;};EmailImap['prototype'][_0x9329('0x22')]=function(){this['imap']['openBox'](this[_0x9329('0xa')],![],this['handleOpenBox'][_0x9329('0xf')](this));};EmailImap[_0x9329('0x23')][_0x9329('0x24')]=function(_0x1296dc,_0x40630c){if(_0x1296dc){this[_0x9329('0x25')](_0x1296dc,!![]);}else{this['emit'](_0x9329('0x26'),_0x40630c);this[_0x9329('0x27')]();}};EmailImap[_0x9329('0x23')][_0x9329('0x28')]=function(_0x3069a2){if(_0x3069a2){this[_0x9329('0x25')](_0x3069a2,!![]);}else{this[_0x9329('0x1')]['end']();}};EmailImap[_0x9329('0x23')][_0x9329('0x27')]=function(){this['imap'][_0x9329('0x29')]([_0x9329('0x2a')],this[_0x9329('0x2b')][_0x9329('0xf')](this));};EmailImap[_0x9329('0x23')][_0x9329('0x2b')]=function(_0x214d86,_0x358c0a){if(_0x214d86){this[_0x9329('0x25')](_0x214d86,!![]);}else{if(_0x358c0a['length']){try{var _0x2c67d0=this[_0x9329('0x1')][_0x9329('0x2c')](_0x358c0a,{'bodies':'','markSeen':!![]});_0x2c67d0['on'](_0x9329('0x2d'),this[_0x9329('0x2e')][_0x9329('0xf')](this));_0x2c67d0['once'](_0x9329('0x12'),this[_0x9329('0x2f')]['bind'](this));_0x2c67d0['once'](_0x9329('0x10'),this[_0x9329('0x30')][_0x9329('0xf')](this));}catch(_0x1052d9){logger[_0x9329('0x12')](_0x1052d9);}}else{this['imap'][_0x9329('0x31')](!![],this[_0x9329('0x28')][_0x9329('0xf')](this));}}};EmailImap[_0x9329('0x23')][_0x9329('0x2e')]=function(_0x16612f,_0x13f7fa){_0x16612f['on'](_0x9329('0x32'),this[_0x9329('0x33')][_0x9329('0xf')](this));_0x16612f[_0x9329('0xd')](_0x9329('0x34'),this[_0x9329('0x35')][_0x9329('0xf')](this));_0x16612f[_0x9329('0xd')](_0x9329('0x10'),this[_0x9329('0x36')][_0x9329('0xf')](this));};EmailImap[_0x9329('0x23')]['handleMessageBody']=function(_0x318ada,_0x49122c){simpleParser(_0x318ada,{'Iconv':Iconv},this[_0x9329('0x37')][_0x9329('0xf')](this));};EmailImap[_0x9329('0x23')][_0x9329('0x35')]=function(_0x541b12){};EmailImap[_0x9329('0x23')][_0x9329('0x36')]=function(){};EmailImap[_0x9329('0x23')][_0x9329('0x37')]=function(_0x50ba09,_0x9ca9bd){if(_0x50ba09){logger['error'](_0x50ba09);}else{var _0x502767=this;utils[_0x9329('0x38')](this[_0x9329('0x39')],_0x9ca9bd,function(_0x144082){_0x502767[_0x9329('0x3a')](_0x9329('0x9'),_0x144082);});}};EmailImap[_0x9329('0x23')][_0x9329('0x30')]=function(){this['imap'][_0x9329('0x31')](!![],this[_0x9329('0x28')][_0x9329('0xf')](this));};EmailImap[_0x9329('0x23')][_0x9329('0x2f')]=function(_0x3a8c49){this[_0x9329('0x25')](_0x3a8c49);this[_0x9329('0x1')][_0x9329('0x31')](!![],this['handleCloseBox'][_0x9329('0xf')](this));};EmailImap[_0x9329('0x23')][_0x9329('0x11')]=function(){this[_0x9329('0x3a')](_0x9329('0x10'));};EmailImap['prototype']['handleError']=function(_0x1d984,_0x588caa){logger['error'](_0x9329('0x25'),this[_0x9329('0x39')]['email'],JSON[_0x9329('0x3b')](_0x1d984));var _0x5ccb61='';if(_0x1d984){if(_0x1d984[_0x9329('0x3c')]){_0x5ccb61=_0x1d984[_0x9329('0x3c')];}else{for(var _0x4be99a in _0x1d984){if(_0x1d984[_0x9329('0x3d')](_0x4be99a)){_0x5ccb61+=_[_0x9329('0x3e')](_0x4be99a)+':\x20'+_0x1d984[_0x4be99a]+'\x0a';}}}}if(_0x588caa){this[_0x9329('0x1')][_0x9329('0x10')]();}else{this[_0x9329('0x3a')]('error',_0x5ccb61);this[_0x9329('0x3a')]('end');}};module[_0x9329('0x3f')]=EmailImap; \ No newline at end of file +var _0xb243=['inherits','prototype','connTimeout','isNil','service','user','password','host','port','autotls','getHost','tls','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','once','end','handleFetchEnd','closeBox','handleMessageBody','attributes','handleSimpleParser','handleFetchError','handleEnd','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','getAccount','account','ready','bind','error','handleError','connect'];(function(_0x3f5a7c,_0x5002d8){var _0x4b3eda=function(_0x42b0a5){while(--_0x42b0a5){_0x3f5a7c['push'](_0x3f5a7c['shift']());}};_0x4b3eda(++_0x5002d8);}(_0xb243,0x10d));var _0x3b24=function(_0x48e704,_0x41292b){_0x48e704=_0x48e704-0x0;var _0x3b978c=_0xb243[_0x48e704];return _0x3b978c;};'use strict';var fs=require('fs');var path=require(_0x3b24('0x0'));var util=require(_0x3b24('0x1'));var Imap=require(_0x3b24('0x2'));var _=require(_0x3b24('0x3'));var rs=require(_0x3b24('0x4'));var simpleParser=require(_0x3b24('0x5'))['simpleParser'];var Iconv=require(_0x3b24('0x6'))[_0x3b24('0x7')];var EventEmitter=require(_0x3b24('0x8'))[_0x3b24('0x9')];var utils=require(_0x3b24('0xa'));var logger=require('../../../config/logger')(_0x3b24('0xb'));function EmailImap(_0x38ee87,_0x2cb9c6){this[_0x3b24('0xc')]=_0x3b24('0xd');this['account']=this[_0x3b24('0xe')](_0x38ee87,_0x2cb9c6);this[_0x3b24('0x2')]=new Imap(this[_0x3b24('0xf')]);this[_0x3b24('0x2')]['once'](_0x3b24('0x10'),this['handleReady'][_0x3b24('0x11')](this));this['imap']['once']('end',this['handleEnd'][_0x3b24('0x11')](this));this[_0x3b24('0x2')]['on'](_0x3b24('0x12'),this[_0x3b24('0x13')][_0x3b24('0x11')](this));this[_0x3b24('0x2')][_0x3b24('0x14')]();}util[_0x3b24('0x15')](EmailImap,EventEmitter);EmailImap[_0x3b24('0x16')][_0x3b24('0xe')]=function(_0x523fa0,_0x4ebf39){var _0x2f8dff={'connTimeout':_0x523fa0[_0x3b24('0x17')]?_0x523fa0[_0x3b24('0x17')]*0x3e8:0x2710,'authTimeout':_0x523fa0['authTimeout']?_0x523fa0['authTimeout']*0x3e8:0x1388};if(_[_0x3b24('0x18')](_0x523fa0[_0x3b24('0x19')])){if(_0x523fa0['authentication']){_0x2f8dff[_0x3b24('0x1a')]=_0x523fa0['user'];_0x2f8dff[_0x3b24('0x1b')]=_0x523fa0[_0x3b24('0x1b')];}_0x2f8dff[_0x3b24('0x1c')]=_0x523fa0['host'];_0x2f8dff['port']=_0x523fa0[_0x3b24('0x1d')]||0x3e1;if(_0x523fa0['tls']){_0x2f8dff['tls']=!![];}else{_0x2f8dff['tls']=![];_0x2f8dff[_0x3b24('0x1e')]='required';}}else{_0x2f8dff['user']=_0x523fa0[_0x3b24('0x1a')];_0x2f8dff['password']=_0x523fa0[_0x3b24('0x1b')];_0x2f8dff[_0x3b24('0x1c')]=utils[_0x3b24('0x1f')](_0x523fa0[_0x3b24('0x19')]);_0x2f8dff[_0x3b24('0x1d')]=0x3e1;_0x2f8dff[_0x3b24('0x20')]=!![];}_0x2f8dff[_0x3b24('0xb')]=_0x4ebf39||_0x523fa0[_0x3b24('0x1a')]||'anonymous@xcally.com';return _0x2f8dff;};EmailImap[_0x3b24('0x16')]['handleReady']=function(){this['imap'][_0x3b24('0x21')](this['mailbox'],![],this[_0x3b24('0x22')][_0x3b24('0x11')](this));};EmailImap[_0x3b24('0x16')][_0x3b24('0x22')]=function(_0x3e34d4,_0xe62bdb){if(_0x3e34d4){this[_0x3b24('0x13')](_0x3e34d4,!![]);}else{this['emit'](_0x3b24('0x23'),_0xe62bdb);this['readUnseen']();}};EmailImap['prototype'][_0x3b24('0x24')]=function(_0x4e9867){if(_0x4e9867){this[_0x3b24('0x13')](_0x4e9867,!![]);}else{this['imap']['end']();}};EmailImap[_0x3b24('0x16')][_0x3b24('0x25')]=function(){this[_0x3b24('0x2')][_0x3b24('0x26')]([_0x3b24('0x27')],this[_0x3b24('0x28')]['bind'](this));};EmailImap[_0x3b24('0x16')]['handleReadUnseen']=function(_0x44ab99,_0x51a0c6){if(_0x44ab99){this[_0x3b24('0x13')](_0x44ab99,!![]);}else{if(_0x51a0c6['length']){try{var _0x3a16b3=this[_0x3b24('0x2')][_0x3b24('0x29')](_0x51a0c6,{'bodies':'','markSeen':!![]});_0x3a16b3['on']('message',this[_0x3b24('0x2a')][_0x3b24('0x11')](this));_0x3a16b3[_0x3b24('0x2b')]('error',this['handleFetchError']['bind'](this));_0x3a16b3[_0x3b24('0x2b')](_0x3b24('0x2c'),this[_0x3b24('0x2d')][_0x3b24('0x11')](this));}catch(_0xe39ebe){logger[_0x3b24('0x12')](_0xe39ebe);}}else{this[_0x3b24('0x2')][_0x3b24('0x2e')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x3b24('0x16')]['handleFetchMessage']=function(_0xc3e014,_0x28745b){_0xc3e014['on']('body',this[_0x3b24('0x2f')][_0x3b24('0x11')](this));_0xc3e014['once'](_0x3b24('0x30'),this['handleMessageAttributes'][_0x3b24('0x11')](this));_0xc3e014[_0x3b24('0x2b')](_0x3b24('0x2c'),this['handleMessageEnd'][_0x3b24('0x11')](this));};EmailImap[_0x3b24('0x16')]['handleMessageBody']=function(_0x35aadf,_0x4f3f58){simpleParser(_0x35aadf,{'Iconv':Iconv},this[_0x3b24('0x31')][_0x3b24('0x11')](this));};EmailImap[_0x3b24('0x16')]['handleMessageAttributes']=function(_0xe6f26a){};EmailImap[_0x3b24('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x3b24('0x16')][_0x3b24('0x31')]=function(_0x2e3155,_0x26a4a7){if(_0x2e3155){logger[_0x3b24('0x12')](_0x2e3155);}else{var _0x5d60d7=this;utils['parser'](this['account'],_0x26a4a7,function(_0x569e72){_0x5d60d7['emit'](_0x3b24('0xb'),_0x569e72);});}};EmailImap[_0x3b24('0x16')][_0x3b24('0x2d')]=function(){this[_0x3b24('0x2')][_0x3b24('0x2e')](!![],this['handleCloseBox'][_0x3b24('0x11')](this));};EmailImap[_0x3b24('0x16')][_0x3b24('0x32')]=function(_0x2fa293){this[_0x3b24('0x13')](_0x2fa293);this[_0x3b24('0x2')]['closeBox'](!![],this[_0x3b24('0x24')][_0x3b24('0x11')](this));};EmailImap[_0x3b24('0x16')][_0x3b24('0x33')]=function(){this[_0x3b24('0x34')](_0x3b24('0x2c'));};EmailImap[_0x3b24('0x16')][_0x3b24('0x13')]=function(_0x5aaa55,_0x1d9990){logger[_0x3b24('0x12')](_0x3b24('0x13'),this[_0x3b24('0xf')]['email'],JSON[_0x3b24('0x35')](_0x5aaa55));var _0x301882='';if(_0x5aaa55){if(_0x5aaa55[_0x3b24('0x36')]){_0x301882=_0x5aaa55[_0x3b24('0x36')];}else{for(var _0x31f6a2 in _0x5aaa55){if(_0x5aaa55[_0x3b24('0x37')](_0x31f6a2)){_0x301882+=_[_0x3b24('0x38')](_0x31f6a2)+':\x20'+_0x5aaa55[_0x31f6a2]+'\x0a';}}}}if(_0x1d9990){this[_0x3b24('0x2')][_0x3b24('0x2c')]();}else{this[_0x3b24('0x34')](_0x3b24('0x12'),_0x301882);this[_0x3b24('0x34')](_0x3b24('0x2c'));}};module[_0x3b24('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f812b0a..bf5dd5e 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21c2=['prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired','nodemailer','bluebird'];(function(_0x3391f1,_0x1fa6f4){var _0x465412=function(_0x2da87b){while(--_0x2da87b){_0x3391f1['push'](_0x3391f1['shift']());}};_0x465412(++_0x1fa6f4);}(_0x21c2,0xee));var _0x221c=function(_0x100267,_0x1c81b7){_0x100267=_0x100267-0x0;var _0x14a2c0=_0x21c2[_0x100267];return _0x14a2c0;};'use strict';var nodemailer=require(_0x221c('0x0'));var BPromise=require(_0x221c('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x221c('0x2')][_0x221c('0x3')]=function(_0x422a8e,_0x3380ed){return new BPromise(function(_0x554f43,_0x5a5f7d){var _0x1e5e94=nodemailer[_0x221c('0x4')](_0x422a8e);_0x1e5e94[_0x221c('0x5')]('compile',inlineBase64());_0x1e5e94[_0x221c('0x6')](_0x3380ed,function(_0x3e1791,_0x49f3ad){if(_0x3e1791){_0x5a5f7d(_0x3e1791[_0x221c('0x7')]());}else{_0x554f43(_0x49f3ad);}});});};EmailSmtp[_0x221c('0x2')][_0x221c('0x8')]=function(_0x50c93a){return new BPromise(function(_0x5d9abd,_0x37301b){var _0xd73221=nodemailer[_0x221c('0x4')](_0x50c93a);_0xd73221[_0x221c('0x8')](function(_0x1d6008,_0x5d2bbc){if(_0x1d6008){_0x37301b(_0x1d6008[_0x221c('0x7')]());}else{if(_0x5d2bbc){_0x5d9abd(_0x5d2bbc);}else{_0x37301b(_0x221c('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xaeca=['sendMail','toString','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xaeca,0xb4));var _0xaaec=function(_0x5d240d,_0x22e0e0){_0x5d240d=_0x5d240d-0x0;var _0x59701e=_0xaeca[_0x5d240d];return _0x59701e;};'use strict';var nodemailer=require(_0xaaec('0x0'));var BPromise=require(_0xaaec('0x1'));var inlineBase64=require(_0xaaec('0x2'));function EmailSmtp(){}EmailSmtp[_0xaaec('0x3')][_0xaaec('0x4')]=function(_0x3f9e9f,_0x57a3a8){return new BPromise(function(_0x158eed,_0x4ec841){var _0xa8fd2c=nodemailer[_0xaaec('0x5')](_0x3f9e9f);_0xa8fd2c['use'](_0xaaec('0x6'),inlineBase64());_0xa8fd2c[_0xaaec('0x7')](_0x57a3a8,function(_0xe098c0,_0x52019b){if(_0xe098c0){_0x4ec841(_0xe098c0['toString']());}else{_0x158eed(_0x52019b);}});});};EmailSmtp[_0xaaec('0x3')]['verify']=function(_0x2a2849){return new BPromise(function(_0x3a9996,_0x24b5c8){var _0x29a8ea=nodemailer[_0xaaec('0x5')](_0x2a2849);_0x29a8ea['verify'](function(_0x3b78f1,_0xf488dc){if(_0x3b78f1){_0x24b5c8(_0x3b78f1[_0xaaec('0x8')]());}else{if(_0xf488dc){_0x3a9996(_0xf488dc);}else{_0x24b5c8(_0xaaec('0x9'));}}});});};module[_0xaaec('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8e34db2..2277ea4 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3465=['replace','body','textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','pop','html','test'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0x3465,0x70));var _0x5346=function(_0x528fd9,_0x4de3c4){_0x528fd9=_0x528fd9-0x0;var _0x59b2aa=_0x3465[_0x528fd9];return _0x59b2aa;};'use strict';var _=require(_0x5346('0x0'));var moment=require(_0x5346('0x1'));var random=require(_0x5346('0x2'));var fs=require('fs');var path=require(_0x5346('0x3'));var util=require(_0x5346('0x4'));var tnef=require(_0x5346('0x5'));var logger=require(_0x5346('0x6'))(_0x5346('0x7'));var config=require(_0x5346('0x8'));function getAddress(_0x48319b){var _0x3033c2=_[_0x5346('0x9')](_0x48319b[_0x5346('0xa')]);return _0x3033c2&&_0x3033c2[_0x5346('0xb')]?_0x3033c2['address']:_0x5346('0xc')+random[_0x5346('0xd')](0x6)+_0x5346('0xe');}function getFirstName(_0x16c470){var _0x32f5e0=_[_0x5346('0x9')](_0x16c470[_0x5346('0xa')]);if(_0x32f5e0&&_0x32f5e0[_0x5346('0xf')]){var _0x2607e2=_0x32f5e0[_0x5346('0xf')][_0x5346('0x10')](/\s+/);return _0x2607e2[_0x5346('0x11')]?_0x2607e2[_0x5346('0x12')](0x0,-0x1)[_0x5346('0x13')]('\x20'):_0x32f5e0[_0x5346('0xf')];}return _0x5346('0x14');}function getLastName(_0x2d6b57){var _0x4ef512=_['head'](_0x2d6b57[_0x5346('0xa')]);if(_0x4ef512&&_0x4ef512[_0x5346('0xf')]){var _0x48c9a9=_0x4ef512['name'][_0x5346('0x10')](/\s+/);return _0x48c9a9[_0x5346('0x11')]>0x1?_0x48c9a9[_0x5346('0x15')]():'';}return'';}function getMails(_0x33c318,_0x208d27){var _0x187ac7='';for(var _0x42ccfc=0x0;_0x42ccfc<_0x208d27['value']['length'];_0x42ccfc+=0x1){if(_0x208d27[_0x5346('0xa')][_0x42ccfc][_0x5346('0xb')]!==_0x33c318){if(!_['isEmpty'](_0x187ac7)){_0x187ac7+=',';}_0x187ac7+=_0x208d27[_0x5346('0xa')][_0x42ccfc][_0x5346('0xf')]||_0x208d27[_0x5346('0xa')][_0x42ccfc]['address']||'';_0x187ac7+='\x20<';_0x187ac7+=_0x208d27[_0x5346('0xa')][_0x42ccfc]['address']?_0x208d27[_0x5346('0xa')][_0x42ccfc]['address']:_0x5346('0xc')+random[_0x5346('0xd')](0x6)+_0x5346('0xe');_0x187ac7+='>';}}return _0x187ac7;}function parseEmail(_0x6ac087,_0x42ca4d,_0x5775fe){if(_0x42ca4d[_0x5346('0x16')]){var _0x26755d=/)<[^<]*)*<\/script>/gi;while(_0x26755d[_0x5346('0x17')](_0x42ca4d['html'])){_0x42ca4d[_0x5346('0x16')]=_0x42ca4d[_0x5346('0x16')][_0x5346('0x18')](_0x26755d,'');}_0x5775fe[_0x5346('0x19')]=_0x42ca4d[_0x5346('0x16')];}else{_0x5775fe[_0x5346('0x19')]=_0x42ca4d[_0x5346('0x1a')];}if(_0x5775fe[_0x5346('0x19')]){_0x5775fe[_0x5346('0x19')]=_0x5775fe['body'][_0x5346('0x18')](/0x1?_0x3e85b1[_0xbd51('0x10')]():'';}return'';}function getMails(_0xb1c553,_0x1be0ec){var _0xe6f02b='';for(var _0x3ebca4=0x0;_0x3ebca4<_0x1be0ec[_0xbd51('0x6')][_0xbd51('0xc')];_0x3ebca4+=0x1){if(_0x1be0ec['value'][_0x3ebca4][_0xbd51('0x7')]!==_0xb1c553){if(!_[_0xbd51('0x11')](_0xe6f02b)){_0xe6f02b+=',';}_0xe6f02b+=_0x1be0ec[_0xbd51('0x6')][_0x3ebca4][_0xbd51('0xa')]||_0x1be0ec[_0xbd51('0x6')][_0x3ebca4][_0xbd51('0x7')]||'';_0xe6f02b+='\x20<';_0xe6f02b+=_0x1be0ec[_0xbd51('0x6')][_0x3ebca4][_0xbd51('0x7')]?_0x1be0ec[_0xbd51('0x6')][_0x3ebca4][_0xbd51('0x7')]:_0xbd51('0x8')+random[_0xbd51('0x12')](0x6)+_0xbd51('0x9');_0xe6f02b+='>';}}return _0xe6f02b;}function parseEmail(_0x21ac5d,_0x3d1cdf,_0x32d67d){if(_0x3d1cdf[_0xbd51('0x13')]){var _0x578bb0=/)<[^<]*)*<\/script>/gi;while(_0x578bb0[_0xbd51('0x14')](_0x3d1cdf[_0xbd51('0x13')])){_0x3d1cdf[_0xbd51('0x13')]=_0x3d1cdf[_0xbd51('0x13')][_0xbd51('0x15')](_0x578bb0,'');}_0x32d67d['body']=_0x3d1cdf[_0xbd51('0x13')];}else{_0x32d67d['body']=_0x3d1cdf[_0xbd51('0x16')];}if(_0x32d67d[_0xbd51('0x17')]){_0x32d67d[_0xbd51('0x17')]=_0x32d67d[_0xbd51('0x17')][_0xbd51('0x15')](/Empty\x20message

';if(_0x52dc4a['Attachments']){for(var _0x4faf11=0x0;_0x4faf11<_0x52dc4a['Attachments'][_0xbd51('0xc')];_0x4faf11++){var _0x73748b=_0x52dc4a[_0xbd51('0x31')][_0x4faf11];_0x2054cb[_0xbd51('0x18')][_0xbd51('0x1d')][_0xbd51('0x32')]({'filename':_0x73748b['Title'],'content':new Buffer(_0x73748b[_0xbd51('0x33')])});}}}_0x1128c7(parseEmail(_0x2f95d7,_0xd53d7d,_0x2054cb));});}else{_0xd53d7d[_0xbd51('0x13')]='

Empty\x20message

';_0x1128c7(parseEmail(_0x2f95d7,_0xd53d7d,_0x2054cb));}}else{_0x1128c7(parseEmail(_0x2f95d7,_0xd53d7d,_0x2054cb));}};exports[_0xbd51('0x34')]=function(_0x567d23){switch(_0x567d23){case _0xbd51('0x35'):return'imap.gmail.com';case _0xbd51('0x36'):return _0xbd51('0x37');case _0xbd51('0x38'):return'imap-mail.outlook.com';case _0xbd51('0x39'):return _0xbd51('0x3a');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0b05619..a4d1dbd 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 _0xac79=['name','Service','key','SERV','active','Imap','Smtp'];(function(_0x403687,_0x10c094){var _0x27e03f=function(_0x391589){while(--_0x391589){_0x403687['push'](_0x403687['shift']());}};_0x27e03f(++_0x10c094);}(_0xac79,0x173));var _0x9ac7=function(_0x38747c,_0x23500c){_0x38747c=_0x38747c-0x0;var _0x22bac9=_0xac79[_0x38747c];return _0x22bac9;};'use strict';var _=require('lodash');function MailAccount(_0x149a09){this['id']=_0x149a09['id']||0x0;this[_0x9ac7('0x0')]=_0x149a09[_0x9ac7('0x0')]||_0x9ac7('0x1');this[_0x9ac7('0x2')]=_0x149a09[_0x9ac7('0x2')]||_0x9ac7('0x3');this[_0x9ac7('0x4')]=_0x149a09[_0x9ac7('0x4')]||![];this[_0x9ac7('0x5')]=_0x149a09[_0x9ac7('0x5')]||[];this[_0x9ac7('0x6')]=_0x149a09['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x9627=['Smtp','lodash','Service','key','active','Imap'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9627,0x163));var _0x7962=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9627[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7962('0x0'));function MailAccount(_0x18756e){this['id']=_0x18756e['id']||0x0;this['name']=_0x18756e['name']||_0x7962('0x1');this[_0x7962('0x2')]=_0x18756e[_0x7962('0x2')]||'SERV';this[_0x7962('0x3')]=_0x18756e['active']||![];this[_0x7962('0x4')]=_0x18756e[_0x7962('0x4')]||[];this[_0x7962('0x5')]=_0x18756e[_0x7962('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 4489891..2e849f8 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 _0x7a97=['prototype','mergeFromDatabase','mailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','hasOwnProperty'];(function(_0x5e74e0,_0x53b3fb){var _0x2f64d0=function(_0x27bfc4){while(--_0x27bfc4){_0x5e74e0['push'](_0x5e74e0['shift']());}};_0x2f64d0(++_0x53b3fb);}(_0x7a97,0xb1));var _0x77a9=function(_0x3fb73d,_0x2cdbbc){_0x3fb73d=_0x3fb73d-0x0;var _0xa55ede=_0x7a97[_0x3fb73d];return _0xa55ede;};'use strict';var _=require(_0x77a9('0x0'));var MailAccount=require(_0x77a9('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5a5345,_0x4750e7,_0x5b1d14){var _0x4d0aa0=_['mapKeys'](_0x5a5345,function(_0x34c657,_0x5836fe){return _0x34c657[_0x5b1d14];});for(var _0x3f0f28 in _0x4750e7){if(_0x4750e7[_0x77a9('0x2')](_0x3f0f28)){if(!_0x4d0aa0[_0x3f0f28]){delete _0x4750e7[_0x3f0f28];}}}}Realtime[_0x77a9('0x3')][_0x77a9('0x4')]=function(_0x2c1ad6,_0x4f2740){for(var _0x4f8995 in _0x4f2740){if(_0x2c1ad6[_0x77a9('0x2')](_0x4f8995)){_0x2c1ad6[_0x4f8995]=_0x4f2740[_0x4f8995];}}};Realtime[_0x77a9('0x3')]['initMailAccounts']=function(){var _0x1ea1ed=this;return function(_0x59b16f){if(_0x59b16f){freeIsNotKey(_0x59b16f,_0x1ea1ed[_0x77a9('0x5')],'id');for(var _0x1e4446=0x0,_0x40eb1b={},_0x19c392={};_0x1e4446<_0x59b16f[_0x77a9('0x6')];_0x1e4446+=0x1){_0x40eb1b=_0x59b16f[_0x1e4446];if(_[_0x77a9('0x7')](_0x1ea1ed['mailAccounts'][_0x40eb1b['id']])){_0x1ea1ed[_0x77a9('0x5')][_0x40eb1b['id']]=new MailAccount(_0x40eb1b);}else{_['merge'](_0x1ea1ed[_0x77a9('0x5')][_0x40eb1b['id']],_0x40eb1b);}}}return _0x1ea1ed['mailAccounts'];};};module[_0x77a9('0x8')]=Realtime; \ No newline at end of file +var _0x021e=['merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x021e,0xa7));var _0xe021=function(_0x32ed61,_0x4877cb){_0x32ed61=_0x32ed61-0x0;var _0x4312c7=_0x021e[_0x32ed61];return _0x4312c7;};'use strict';var _=require(_0xe021('0x0'));var MailAccount=require(_0xe021('0x1'));var Realtime=function(){this[_0xe021('0x2')]={};};function freeIsNotKey(_0x15ac05,_0x532221,_0x3e668c){var _0x4175f4=_['mapKeys'](_0x15ac05,function(_0x1e3895,_0x4f4054){return _0x1e3895[_0x3e668c];});for(var _0xa4135c in _0x532221){if(_0x532221[_0xe021('0x3')](_0xa4135c)){if(!_0x4175f4[_0xa4135c]){delete _0x532221[_0xa4135c];}}}}Realtime[_0xe021('0x4')][_0xe021('0x5')]=function(_0x438eb8,_0x1009bc){for(var _0xa75be9 in _0x1009bc){if(_0x438eb8['hasOwnProperty'](_0xa75be9)){_0x438eb8[_0xa75be9]=_0x1009bc[_0xa75be9];}}};Realtime[_0xe021('0x4')][_0xe021('0x6')]=function(){var _0x3656d2=this;return function(_0x25f2cd){if(_0x25f2cd){freeIsNotKey(_0x25f2cd,_0x3656d2[_0xe021('0x2')],'id');for(var _0xe0dddc=0x0,_0x20df11={},_0x55d537={};_0xe0dddc<_0x25f2cd[_0xe021('0x7')];_0xe0dddc+=0x1){_0x20df11=_0x25f2cd[_0xe0dddc];if(_[_0xe021('0x8')](_0x3656d2[_0xe021('0x2')][_0x20df11['id']])){_0x3656d2[_0xe021('0x2')][_0x20df11['id']]=new MailAccount(_0x20df11);}else{_[_0xe021('0x9')](_0x3656d2['mailAccounts'][_0x20df11['id']],_0x20df11);}}}return _0x3656d2[_0xe021('0x2')];};};module[_0xe021('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3bd3b71..3b090cd 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 _0xe6e9=['service','email','active','key','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','name'];(function(_0x25eb20,_0x53c26e){var _0x1e53e1=function(_0x4e9fc6){while(--_0x4e9fc6){_0x25eb20['push'](_0x25eb20['shift']());}};_0x1e53e1(++_0x53c26e);}(_0xe6e9,0x182));var _0x9e6e=function(_0x3e6f4c,_0x672df6){_0x3e6f4c=_0x3e6f4c-0x0;var _0x4ac4a1=_0xe6e9[_0x3e6f4c];return _0x4ac4a1;};'use strict';var client=require(_0x9e6e('0x0'));exports[_0x9e6e('0x1')]=function(){return function(){return client[_0x9e6e('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x9e6e('0x3'),_0x9e6e('0x4'),_0x9e6e('0x5'),_0x9e6e('0x6'),_0x9e6e('0x7'),'ListId',_0x9e6e('0x8')],'raw':![],'include':[{'model':_0x9e6e('0x9'),'as':_0x9e6e('0xa')},{'model':_0x9e6e('0xb'),'as':_0x9e6e('0xc')}]},'log':'getMailAccount'});};};exports[_0x9e6e('0xd')]=function(_0x2bf742,_0x2b8c88){return client[_0x9e6e('0x2')](_0x9e6e('0xe'),{'account':{'id':_0x2bf742},'body':_0x2b8c88,'log':_0x9e6e('0xe')});}; \ No newline at end of file +var _0xd9c8=['GetMailAccount','name','service','email','active','key','ListId','MailServerOut','Smtp','getMailAccount','Request','NotifyMailAccount','../client','getMailAccounts'];(function(_0x4de958,_0x5b760e){var _0x6c13ff=function(_0x4a744e){while(--_0x4a744e){_0x4de958['push'](_0x4de958['shift']());}};_0x6c13ff(++_0x5b760e);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd9c8[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0x8d9c('0x0'));exports[_0x8d9c('0x1')]=function(){return function(){return client['Request'](_0x8d9c('0x2'),{'options':{'attributes':['id',_0x8d9c('0x3'),_0x8d9c('0x4'),_0x8d9c('0x5'),_0x8d9c('0x6'),_0x8d9c('0x7'),_0x8d9c('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':_0x8d9c('0x9'),'as':_0x8d9c('0xa')}]},'log':_0x8d9c('0xb')});};};exports['notify']=function(_0x3790f6,_0x3de357){return client[_0x8d9c('0xc')](_0x8d9c('0xd'),{'account':{'id':_0x3790f6},'body':_0x3de357,'log':_0x8d9c('0xd')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 1a90342..4316106 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 _0x5dbc=['then','error','verifySmtp','Verified','catch','mailAccounts','Imap','password','Smtp','pass','length','server','http','stringify','listen','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','bluebird','lodash','../../../config/logger','email','sendMail','account'];(function(_0x5b2692,_0x1ac9fb){var _0x3c44c5=function(_0x41860c){while(--_0x41860c){_0x5b2692['push'](_0x5b2692['shift']());}};_0x3c44c5(++_0x1ac9fb);}(_0x5dbc,0xf4));var _0xc5db=function(_0xc8619c,_0x3a8f25){_0xc8619c=_0xc8619c-0x0;var _0x3660f5=_0x5dbc[_0xc8619c];return _0x3660f5;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc5db('0x0'));var _=require(_0xc5db('0x1'));var logger=require(_0xc5db('0x2'))(_0xc5db('0x3'));exports['listen']=function(_0x4e80f6,_0x34aaf5){return new BPromise(function(_0x795a14,_0x40ffbb){var _0x2ff9b4={'SendMail':function(_0x59bb35){var _0xe4a4ee=this;return new Promise(function(_0x32fdd3,_0x45a599){_0x34aaf5[_0xc5db('0x4')](_0x59bb35[_0xc5db('0x5')],_0x59bb35['message'])[_0xc5db('0x6')](function(_0x21f09a){_0x32fdd3({'code':0xc8,'message':_0x21f09a});})['catch'](function(_0x93c939){_0x45a599(_0xe4a4ee[_0xc5db('0x7')](0x1f4,_0x93c939));});});},'VerifySmtp':function(_0x3fe18d){var _0x41b4f3=this;return new Promise(function(_0x401688,_0xfc29fe){_0x34aaf5[_0xc5db('0x8')](_0x3fe18d[_0xc5db('0x5')])['then'](function(_0x2e17d3){_0x401688({'code':0xc8,'message':_0xc5db('0x9')});})[_0xc5db('0xa')](function(_0x5a1ba7){_0xfc29fe(_0x41b4f3[_0xc5db('0x7')](0x1f4,_0x5a1ba7));});});},'MailAccounts':function(_0x353fb6){return new Promise(function(_0x1e1af0,_0x10a696){var _0x1279e4=_['values'](_0x4e80f6[_0xc5db('0xb')]);for(var _0x3598d1=0x0;_0x3598d1<_0x1279e4['length'];_0x3598d1+=0x1){if(_0x1279e4[_0x3598d1][_0xc5db('0xc')]&&_0x1279e4[_0x3598d1][_0xc5db('0xc')][_0xc5db('0xd')]){delete _0x1279e4[_0x3598d1][_0xc5db('0xc')]['password'];}if(_0x1279e4[_0x3598d1][_0xc5db('0xe')]&&_0x1279e4[_0x3598d1][_0xc5db('0xe')][_0xc5db('0xf')]){delete _0x1279e4[_0x3598d1][_0xc5db('0xe')][_0xc5db('0xf')];}}_0x1e1af0({'count':_0x1279e4[_0xc5db('0x10')],'rows':_0x1279e4});});}};var _0xef6e92=jayson[_0xc5db('0x11')](_0x2ff9b4)[_0xc5db('0x12')]();_0xef6e92['on'](_0xc5db('0x7'),function(_0x51a11e){logger[_0xc5db('0x7')](JSON[_0xc5db('0x13')](_0x51a11e));return _0x40ffbb(_0x51a11e);});_0xef6e92[_0xc5db('0x14')](0x232b,_0xc5db('0x15'),function(){console[_0xc5db('0x16')](_0xc5db('0x17'),0x232b);return _0x795a14(_0xc5db('0x18')+0x232b);});});}; \ No newline at end of file +var _0x54e0=['pass','length','server','http','stringify','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','sendMail','account','message','then','catch','error','verifySmtp','Verified','Imap','password','Smtp'];(function(_0x43c105,_0x23454d){var _0x4a8516=function(_0x4d7a2d){while(--_0x4d7a2d){_0x43c105['push'](_0x43c105['shift']());}};_0x4a8516(++_0x23454d);}(_0x54e0,0x19f));var _0x054e=function(_0x7cce27,_0x3252a6){_0x7cce27=_0x7cce27-0x0;var _0x58daa4=_0x54e0[_0x7cce27];return _0x58daa4;};'use strict';var jayson=require(_0x054e('0x0'));var BPromise=require(_0x054e('0x1'));var _=require(_0x054e('0x2'));var logger=require(_0x054e('0x3'))(_0x054e('0x4'));exports[_0x054e('0x5')]=function(_0x1460f8,_0x446612){return new BPromise(function(_0x1b3e45,_0x2e0eb6){var _0x1af03b={'SendMail':function(_0x71d754){var _0x550f88=this;return new Promise(function(_0x52fcbe,_0x120f86){_0x446612[_0x054e('0x6')](_0x71d754[_0x054e('0x7')],_0x71d754[_0x054e('0x8')])[_0x054e('0x9')](function(_0x5e00e3){_0x52fcbe({'code':0xc8,'message':_0x5e00e3});})[_0x054e('0xa')](function(_0x508256){_0x120f86(_0x550f88[_0x054e('0xb')](0x1f4,_0x508256));});});},'VerifySmtp':function(_0x1514a3){var _0x2e57e8=this;return new Promise(function(_0x19a772,_0x350130){_0x446612[_0x054e('0xc')](_0x1514a3['account'])[_0x054e('0x9')](function(_0x2274e5){_0x19a772({'code':0xc8,'message':_0x054e('0xd')});})[_0x054e('0xa')](function(_0x344b80){_0x350130(_0x2e57e8[_0x054e('0xb')](0x1f4,_0x344b80));});});},'MailAccounts':function(_0x5ef910){return new Promise(function(_0x4a722e,_0x3a6710){var _0x1fe95e=_['values'](_0x1460f8['mailAccounts']);for(var _0x540557=0x0;_0x540557<_0x1fe95e['length'];_0x540557+=0x1){if(_0x1fe95e[_0x540557]['Imap']&&_0x1fe95e[_0x540557][_0x054e('0xe')]['password']){delete _0x1fe95e[_0x540557]['Imap'][_0x054e('0xf')];}if(_0x1fe95e[_0x540557][_0x054e('0x10')]&&_0x1fe95e[_0x540557][_0x054e('0x10')][_0x054e('0x11')]){delete _0x1fe95e[_0x540557][_0x054e('0x10')]['pass'];}}_0x4a722e({'count':_0x1fe95e[_0x054e('0x12')],'rows':_0x1fe95e});});}};var _0x5cd6b7=jayson[_0x054e('0x13')](_0x1af03b)[_0x054e('0x14')]();_0x5cd6b7['on']('error',function(_0x2acc9c){logger[_0x054e('0xb')](JSON[_0x054e('0x15')](_0x2acc9c));return _0x2e0eb6(_0x2acc9c);});_0x5cd6b7[_0x054e('0x5')](0x232b,'127.0.0.1',function(){console['log'](_0x054e('0x16'),0x232b);return _0x1b3e45(_0x054e('0x17')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index b806c96..5f7c2cc 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 _0x9cf9=['defaults','localhost','default','../../config/socketio','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','ioredis','createServer','timeout','port','socket.io','websocket','polling','redis'];(function(_0x11e668,_0x42fcf8){var _0x226f63=function(_0x5b884d){while(--_0x5b884d){_0x11e668['push'](_0x11e668['shift']());}};_0x226f63(++_0x42fcf8);}(_0x9cf9,0x14b));var _0x99cf=function(_0xe24dc5,_0x3bfe71){_0xe24dc5=_0xe24dc5-0x0;var _0x2bfef7=_0x9cf9[_0xe24dc5];return _0x2bfef7;};'use strict';var _=require(_0x99cf('0x0'));var http=require(_0x99cf('0x1'));var express=require(_0x99cf('0x2'));var sticky=require('sticky-session');var Redis=require(_0x99cf('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x99cf('0x4')](app);server[_0x99cf('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x99cf('0x6')])){var socketio=require(_0x99cf('0x7'))(server,{'transports':[_0x99cf('0x8'),_0x99cf('0x9')]});config[_0x99cf('0xa')]=_[_0x99cf('0xb')](config[_0x99cf('0xa')],{'host':_0x99cf('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x99cf('0xa')]),'subClient':new Redis(config[_0x99cf('0xa')])}));require('../../config/triggers')[_0x99cf('0xd')]();require(_0x99cf('0xe'))[_0x99cf('0xd')](socketio);require('../../config/express')[_0x99cf('0xd')](app);require(_0x99cf('0xf'))[_0x99cf('0xd')](app);}else{server[_0x99cf('0x10')](_0x99cf('0x11'),function(){console['log'](_0x99cf('0x12'),config[_0x99cf('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x5b98=['../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','../../config/environment','createServer','listen','websocket','redis','defaults','localhost','adapter','../../config/triggers','default'];(function(_0x4f7a8c,_0x122773){var _0x41a993=function(_0x2361c0){while(--_0x2361c0){_0x4f7a8c['push'](_0x4f7a8c['shift']());}};_0x41a993(++_0x122773);}(_0x5b98,0x1ec));var _0x85b9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x5b98[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var http=require(_0x85b9('0x0'));var express=require('express');var sticky=require(_0x85b9('0x1'));var Redis=require('ioredis');var config=require(_0x85b9('0x2'));var app=express();var server=http[_0x85b9('0x3')](app);server['timeout']=0xdbba0;if(sticky[_0x85b9('0x4')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x85b9('0x5'),'polling']});config[_0x85b9('0x6')]=_[_0x85b9('0x7')](config[_0x85b9('0x6')],{'host':_0x85b9('0x8'),'port':0x18eb});socketio[_0x85b9('0x9')](require('socket.io-redis')({'pubClient':new Redis(config[_0x85b9('0x6')]),'subClient':new Redis(config[_0x85b9('0x6')])}));require(_0x85b9('0xa'))[_0x85b9('0xb')]();require(_0x85b9('0xc'))[_0x85b9('0xb')](socketio);require('../../config/express')[_0x85b9('0xb')](app);require('../../routes')[_0x85b9('0xb')](app);}else{server[_0x85b9('0xd')](_0x85b9('0xe'),function(){console[_0x85b9('0xf')](_0x85b9('0x10'),config['port']);});}exports=module[_0x85b9('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 28d68c8..f7c3450 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 _0x61b8=['result','jayson/promise','bluebird','../../config/logger','client','request','then','debug','rpc','routing','error','message'];(function(_0x31080a,_0x55b5cd){var _0x58d2fc=function(_0x446558){while(--_0x446558){_0x31080a['push'](_0x31080a['shift']());}};_0x58d2fc(++_0x55b5cd);}(_0x61b8,0x169));var _0x861b=function(_0x1d4165,_0x10b39c){_0x1d4165=_0x1d4165-0x0;var _0x4016bc=_0x61b8[_0x1d4165];return _0x4016bc;};'use strict';var jayson=require(_0x861b('0x0'));var BPromise=require(_0x861b('0x1'));var logger=require(_0x861b('0x2'))('routing');var client=jayson[_0x861b('0x3')]['http']({'port':0x2329});client['Request']=function(_0x37b79f,_0x10e70b){return new BPromise(function(_0x4b139c,_0x56a7a9){return client[_0x861b('0x4')](_0x37b79f,_0x10e70b)[_0x861b('0x5')](function(_0x1cfc62){logger[_0x861b('0x6')](_0x861b('0x7'),_0x861b('0x8'),_0x37b79f,_0x10e70b,_0x1cfc62);if(_0x1cfc62[_0x861b('0x9')]){logger[_0x861b('0x9')](_0x861b('0x7'),_0x861b('0x8'),_0x37b79f,_0x1cfc62[_0x861b('0x9')]['message'],_0x10e70b);return _0x56a7a9(_0x1cfc62[_0x861b('0x9')][_0x861b('0xa')]);}else{return _0x4b139c(_0x1cfc62[_0x861b('0xb')]);}})['catch'](function(_0x1e1eec){logger['error'](_0x861b('0x7'),_0x861b('0x8'),_0x37b79f,_0x1e1eec,_0x10e70b);return _0x56a7a9(_0x1e1eec);});});};module['exports']=client; \ No newline at end of file +var _0x6dac=['../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x117089,_0x1927fe){var _0x2973dc=function(_0xc03a9){while(--_0xc03a9){_0x117089['push'](_0x117089['shift']());}};_0x2973dc(++_0x1927fe);}(_0x6dac,0x16e));var _0xc6da=function(_0x1a5f16,_0x5d540d){_0x1a5f16=_0x1a5f16-0x0;var _0x538c6e=_0x6dac[_0x1a5f16];return _0x538c6e;};'use strict';var jayson=require(_0xc6da('0x0'));var BPromise=require(_0xc6da('0x1'));var logger=require(_0xc6da('0x2'))(_0xc6da('0x3'));var client=jayson[_0xc6da('0x4')][_0xc6da('0x5')]({'port':0x2329});client[_0xc6da('0x6')]=function(_0x2fc6e0,_0x28663f){return new BPromise(function(_0x338470,_0x18ee4e){return client[_0xc6da('0x7')](_0x2fc6e0,_0x28663f)[_0xc6da('0x8')](function(_0x5caf49){logger[_0xc6da('0x9')](_0xc6da('0xa'),_0xc6da('0x3'),_0x2fc6e0,_0x28663f,_0x5caf49);if(_0x5caf49[_0xc6da('0xb')]){logger[_0xc6da('0xb')](_0xc6da('0xa'),_0xc6da('0x3'),_0x2fc6e0,_0x5caf49[_0xc6da('0xb')][_0xc6da('0xc')],_0x28663f);return _0x18ee4e(_0x5caf49['error'][_0xc6da('0xc')]);}else{return _0x338470(_0x5caf49[_0xc6da('0xd')]);}})[_0xc6da('0xe')](function(_0x2f81f2){logger[_0xc6da('0xb')](_0xc6da('0xa'),_0xc6da('0x3'),_0x2fc6e0,_0x2f81f2,_0x28663f);return _0x18ee4e(_0x2f81f2);});});};module[_0xc6da('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index a76e641..3fcda42 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 _0x74c5=['./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x3234ca,_0x40bf96){var _0x593d4b=function(_0x18b091){while(--_0x18b091){_0x3234ca['push'](_0x3234ca['shift']());}};_0x593d4b(++_0x40bf96);}(_0x74c5,0xad));var _0x574c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x74c5[_0x29d94e];return _0x106237;};'use strict';var BPromise=require(_0x574c('0x0'));var server=require(_0x574c('0x1'));var Realtime=require(_0x574c('0x2'));var user=require(_0x574c('0x3'));var interval=require(_0x574c('0x4'));var openchannelQueue=require(_0x574c('0x5'));var chatQueue=require(_0x574c('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x574c('0x7'));var faxQueue=require(_0x574c('0x8'));var whatsappQueue=require(_0x574c('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x574c('0xa')]()[_0x574c('0xb')](user[_0x574c('0xc')]())['then'](realtime[_0x574c('0xd')]())[_0x574c('0xb')](interval[_0x574c('0xe')]())['then'](realtime[_0x574c('0xf')]())[_0x574c('0xb')](openchannelQueue[_0x574c('0x10')]())[_0x574c('0xb')](realtime[_0x574c('0x11')]())[_0x574c('0xb')](chatQueue['getChatQueues']())[_0x574c('0xb')](realtime[_0x574c('0x12')]())['then'](smsQueue[_0x574c('0x13')]())['then'](realtime[_0x574c('0x14')]())[_0x574c('0xb')](mailQueue[_0x574c('0x15')]())['then'](realtime[_0x574c('0x16')]())[_0x574c('0xb')](faxQueue[_0x574c('0x17')]())[_0x574c('0xb')](realtime[_0x574c('0x18')]())[_0x574c('0xb')](whatsappQueue['getWhatsappQueues']())['then'](realtime['initWhatsappQueues']())[_0x574c('0xb')](function(){return realtime;});}function main(){return server[_0x574c('0x19')](realtime)[_0x574c('0xb')](function(_0x196b4b){return initRealtime();})[_0x574c('0xb')](function(_0x57e6c7){return setInterval(initRealtime,0x1388);})['catch'](function(_0x35bf2f){console['log'](_0x35bf2f);});}main(); \ No newline at end of file +var _0x5df8=['./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x37c709,_0x666134){var _0x29b232=function(_0x3a4301){while(--_0x3a4301){_0x37c709['push'](_0x37c709['shift']());}};_0x29b232(++_0x666134);}(_0x5df8,0x13f));var _0x85df=function(_0x46629b,_0x4d989f){_0x46629b=_0x46629b-0x0;var _0x2afd8c=_0x5df8[_0x46629b];return _0x2afd8c;};'use strict';var BPromise=require(_0x85df('0x0'));var server=require(_0x85df('0x1'));var Realtime=require('./realtime');var user=require(_0x85df('0x2'));var interval=require(_0x85df('0x3'));var openchannelQueue=require(_0x85df('0x4'));var chatQueue=require(_0x85df('0x5'));var smsQueue=require(_0x85df('0x6'));var mailQueue=require(_0x85df('0x7'));var faxQueue=require(_0x85df('0x8'));var whatsappQueue=require(_0x85df('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x85df('0xa')](user['getAgents']())['then'](realtime[_0x85df('0xb')]())[_0x85df('0xa')](interval[_0x85df('0xc')]())[_0x85df('0xa')](realtime[_0x85df('0xd')]())[_0x85df('0xa')](openchannelQueue[_0x85df('0xe')]())[_0x85df('0xa')](realtime[_0x85df('0xf')]())[_0x85df('0xa')](chatQueue[_0x85df('0x10')]())['then'](realtime[_0x85df('0x11')]())[_0x85df('0xa')](smsQueue[_0x85df('0x12')]())[_0x85df('0xa')](realtime[_0x85df('0x13')]())[_0x85df('0xa')](mailQueue[_0x85df('0x14')]())[_0x85df('0xa')](realtime[_0x85df('0x15')]())[_0x85df('0xa')](faxQueue[_0x85df('0x16')]())[_0x85df('0xa')](realtime[_0x85df('0x17')]())[_0x85df('0xa')](whatsappQueue[_0x85df('0x18')]())[_0x85df('0xa')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x85df('0xa')](function(_0x76f5d8){return initRealtime();})[_0x85df('0xa')](function(_0xd79c51){return setInterval(initRealtime,0x1388);})[_0x85df('0x19')](function(_0x396cab){console[_0x85df('0x1a')](_0x396cab);});}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 3edd2dd..6d037b5 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 _0xb7fa=['restart','length','matchPath','findRules','matches','priority','map','condition','toString','consequence','fromJSON','isString','parse','exports','util','events','init','isNil','ignoreFactChanges','inherits','prototype','register','isArray','rules','concat','isObject','sync','activeRules','filter','asc','execute','result','clone','ruleRef','index_','nextTick','call','next','isEqual'];(function(_0x18f6ee,_0x241f93){var _0x42ac3f=function(_0x10efa9){while(--_0x10efa9){_0x18f6ee['push'](_0x18f6ee['shift']());}};_0x42ac3f(++_0x241f93);}(_0xb7fa,0x11f));var _0xab7f=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xb7fa[_0x146a97];return _0x259d5c;};'use strict';var _=require('lodash');var util=require(_0xab7f('0x0'));var EventEmitter=require(_0xab7f('0x1'))['EventEmitter'];function RuleEngine(_0x1dc7a6,_0x7574fa){this[_0xab7f('0x2')]();if(!_[_0xab7f('0x3')](_0x1dc7a6)){this['register'](_0x1dc7a6);}if(_0x7574fa){this[_0xab7f('0x4')]=_0x7574fa[_0xab7f('0x4')];}return this;}util[_0xab7f('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xab7f('0x6')]['init']=function(_0x2f42d2){this['rules']=[];this['activeRules']=[];};RuleEngine[_0xab7f('0x6')][_0xab7f('0x7')]=function(_0x40cb25){if(Array[_0xab7f('0x8')](_0x40cb25)){this['rules']=this[_0xab7f('0x9')][_0xab7f('0xa')](_0x40cb25);}else if(_0x40cb25!==null&&_[_0xab7f('0xb')](_0x40cb25)){this['rules']['push'](_0x40cb25);}this[_0xab7f('0xc')]();};RuleEngine[_0xab7f('0x6')][_0xab7f('0xc')]=function(){this[_0xab7f('0xd')]=this[_0xab7f('0x9')][_0xab7f('0xe')](function(_0x5e712d){if(_[_0xab7f('0x3')](_0x5e712d['on'])){_0x5e712d['on']=!![];}if(_0x5e712d['on']===!![]){return _0x5e712d;}});this[_0xab7f('0xd')]=_['orderBy'](this['activeRules'],['p'],[_0xab7f('0xf')]);};RuleEngine[_0xab7f('0x6')][_0xab7f('0x10')]=function(_0x4bf327,_0x2b810f){var _0x110bf0=![];_0x4bf327[_0xab7f('0x11')]=!![];var _0x562335=_[_0xab7f('0x12')](_0x4bf327);var _0x8fb208=_[_0xab7f('0x12')](_0x4bf327);var _0x42d0b2=this['activeRules'];var _0x38495d=[];var _0x10c889=this[_0xab7f('0x4')];(function FnRuleLoop(_0x510efe){var _0x3191af={'rules':function(){return _0x42d0b2;},'rule':function(){return _0x42d0b2[_0x510efe];},'when':function(_0x5dcb33){if(_0x5dcb33){var _0x5607df=_0x42d0b2[_0x510efe]['consequence'];_0x5607df[_0xab7f('0x13')]=_0x42d0b2[_0x510efe]['id']||_0x42d0b2[_0x510efe]['name']||_0xab7f('0x14')+_0x510efe;process[_0xab7f('0x15')](function(){_0x38495d['push'](_0x5607df[_0xab7f('0x13')]);_0x5607df[_0xab7f('0x16')](_0x562335,_0x3191af);});}else{process[_0xab7f('0x15')](function(){_0x3191af[_0xab7f('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x110bf0=!![];return FnRuleLoop(0x0);},'next':function(_0x7295f6){if(!_0x10c889&&!_[_0xab7f('0x18')](_0x8fb208,_0x562335)){_0x8fb208=_['clone'](_0x562335);process[_0xab7f('0x15')](function(){_0x3191af[_0xab7f('0x19')]();});}else{process[_0xab7f('0x15')](function(){if(_[_0xab7f('0x3')](_0x7295f6)){return FnRuleLoop(_0x510efe+0x1);}else{return FnRuleLoop(_0x7295f6);}});}}};if(_0x510efe<_0x42d0b2[_0xab7f('0x1a')]&&_0x110bf0===![]){var _0x56450c=_0x42d0b2[_0x510efe]['condition'];_0x56450c[_0xab7f('0x16')](_0x562335,_0x3191af);}else{process['nextTick'](function(){_0x562335[_0xab7f('0x1b')]=_0x38495d;return _0x2b810f?_0x2b810f(_0x562335):_['noop']();});}}(0x0));};RuleEngine[_0xab7f('0x6')][_0xab7f('0x1c')]=function(_0x48b528){if(_[_0xab7f('0x3')](_0x48b528)){return this[_0xab7f('0x9')];}else{var _0x51bdfc=_[_0xab7f('0x1d')](_0x48b528);return _['filter'](this[_0xab7f('0x9')],_0x51bdfc);}};RuleEngine[_0xab7f('0x6')]['turn']=function(_0x258db4,_0x5aab10){var _0x1181bf=_0x258db4==='on'||_0x258db4==='ON'?!![]:![];var _0x11e355=this[_0xab7f('0x1c')](_0x5aab10);for(var _0x56bf99=0x0,_0x102b7b=_0x11e355[_0xab7f('0x1a')];_0x56bf99<_0x102b7b;_0x56bf99+=0x1){_0x11e355[_0x56bf99]['on']=_0x1181bf;}this[_0xab7f('0xc')]();};RuleEngine['prototype']['prioritize']=function(_0xbd499c,_0x45ae41){_0xbd499c=parseInt(_0xbd499c,0xa);var _0x5d1729=this[_0xab7f('0x1c')](_0x45ae41);for(var _0x43d0a9=0x0,_0xf8d1c3=_0x5d1729[_0xab7f('0x1a')];_0x43d0a9<_0xf8d1c3;_0x43d0a9+=0x1){_0x5d1729[_0x43d0a9][_0xab7f('0x1e')]=_0xbd499c;}this[_0xab7f('0xc')]();};RuleEngine[_0xab7f('0x6')]['toJSON']=function(){var _0x2c7697=this[_0xab7f('0x9')];if(_0x2c7697 instanceof Array){_0x2c7697=_0x2c7697[_0xab7f('0x1f')](function(_0x46e221){_0x46e221[_0xab7f('0x20')]=_0x46e221[_0xab7f('0x20')][_0xab7f('0x21')]();_0x46e221[_0xab7f('0x22')]=_0x46e221[_0xab7f('0x22')]['toString']();return _0x46e221;});}else if(!_[_0xab7f('0x3')](_0x2c7697)){_0x2c7697[_0xab7f('0x20')]=_0x2c7697['condition'][_0xab7f('0x21')]();_0x2c7697[_0xab7f('0x22')]=_0x2c7697[_0xab7f('0x22')][_0xab7f('0x21')]();}return _0x2c7697;};RuleEngine[_0xab7f('0x6')][_0xab7f('0x23')]=function(_0x39294a){this['init']();if(_[_0xab7f('0x24')](_0x39294a)){_0x39294a=JSON[_0xab7f('0x25')](_0x39294a);}if(_0x39294a instanceof Array){_0x39294a=_0x39294a[_0xab7f('0x1f')](function(_0x13f71d){_0x13f71d[_0xab7f('0x20')]=eval('('+_0x13f71d[_0xab7f('0x20')]+')');_0x13f71d[_0xab7f('0x22')]=eval('('+_0x13f71d[_0xab7f('0x22')]+')');return _0x13f71d;});}else if(_0x39294a!==null&&typeof _0x39294a=='object'){_0x39294a[_0xab7f('0x20')]=eval('('+_0x39294a[_0xab7f('0x20')]+')');_0x39294a[_0xab7f('0x22')]=eval('('+_0x39294a['consequence']+')');}this[_0xab7f('0x7')](_0x39294a);};module[_0xab7f('0x26')]=RuleEngine; \ No newline at end of file +var _0x334f=['ignoreFactChanges','init','activeRules','prototype','register','isArray','rules','concat','push','sync','filter','orderBy','asc','execute','clone','consequence','name','index_','ruleRef','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','matches','turn','findRules','prioritize','priority','toJSON','toString','fromJSON','parse','map','lodash','util','events','EventEmitter','isNil'];(function(_0x4efa98,_0x321d37){var _0x545ae1=function(_0x5af081){while(--_0x5af081){_0x4efa98['push'](_0x4efa98['shift']());}};_0x545ae1(++_0x321d37);}(_0x334f,0x17e));var _0xf334=function(_0x139f02,_0x4490da){_0x139f02=_0x139f02-0x0;var _0x53e8c2=_0x334f[_0x139f02];return _0x53e8c2;};'use strict';var _=require(_0xf334('0x0'));var util=require(_0xf334('0x1'));var EventEmitter=require(_0xf334('0x2'))[_0xf334('0x3')];function RuleEngine(_0x580f31,_0x520877){this['init']();if(!_[_0xf334('0x4')](_0x580f31)){this['register'](_0x580f31);}if(_0x520877){this[_0xf334('0x5')]=_0x520877[_0xf334('0x5')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0xf334('0x6')]=function(_0x25cc38){this['rules']=[];this[_0xf334('0x7')]=[];};RuleEngine[_0xf334('0x8')][_0xf334('0x9')]=function(_0x419256){if(Array[_0xf334('0xa')](_0x419256)){this[_0xf334('0xb')]=this[_0xf334('0xb')][_0xf334('0xc')](_0x419256);}else if(_0x419256!==null&&_['isObject'](_0x419256)){this[_0xf334('0xb')][_0xf334('0xd')](_0x419256);}this['sync']();};RuleEngine[_0xf334('0x8')][_0xf334('0xe')]=function(){this['activeRules']=this[_0xf334('0xb')][_0xf334('0xf')](function(_0x4025f1){if(_[_0xf334('0x4')](_0x4025f1['on'])){_0x4025f1['on']=!![];}if(_0x4025f1['on']===!![]){return _0x4025f1;}});this[_0xf334('0x7')]=_[_0xf334('0x10')](this[_0xf334('0x7')],['p'],[_0xf334('0x11')]);};RuleEngine['prototype'][_0xf334('0x12')]=function(_0x4d7a25,_0x52777f){var _0x5dfe62=![];_0x4d7a25['result']=!![];var _0x4a847f=_[_0xf334('0x13')](_0x4d7a25);var _0x2cceb2=_[_0xf334('0x13')](_0x4d7a25);var _0x98628d=this[_0xf334('0x7')];var _0x5aa06d=[];var _0xa0d157=this[_0xf334('0x5')];(function FnRuleLoop(_0x33ef93){var _0x3e3f5e={'rules':function(){return _0x98628d;},'rule':function(){return _0x98628d[_0x33ef93];},'when':function(_0x59c9e4){if(_0x59c9e4){var _0x366228=_0x98628d[_0x33ef93][_0xf334('0x14')];_0x366228['ruleRef']=_0x98628d[_0x33ef93]['id']||_0x98628d[_0x33ef93][_0xf334('0x15')]||_0xf334('0x16')+_0x33ef93;process['nextTick'](function(){_0x5aa06d[_0xf334('0xd')](_0x366228[_0xf334('0x17')]);_0x366228[_0xf334('0x18')](_0x4a847f,_0x3e3f5e);});}else{process[_0xf334('0x19')](function(){_0x3e3f5e[_0xf334('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5dfe62=!![];return FnRuleLoop(0x0);},'next':function(_0x4f478c){if(!_0xa0d157&&!_[_0xf334('0x1b')](_0x2cceb2,_0x4a847f)){_0x2cceb2=_[_0xf334('0x13')](_0x4a847f);process[_0xf334('0x19')](function(){_0x3e3f5e[_0xf334('0x1c')]();});}else{process[_0xf334('0x19')](function(){if(_[_0xf334('0x4')](_0x4f478c)){return FnRuleLoop(_0x33ef93+0x1);}else{return FnRuleLoop(_0x4f478c);}});}}};if(_0x33ef93<_0x98628d[_0xf334('0x1d')]&&_0x5dfe62===![]){var _0x28339c=_0x98628d[_0x33ef93][_0xf334('0x1e')];_0x28339c[_0xf334('0x18')](_0x4a847f,_0x3e3f5e);}else{process['nextTick'](function(){_0x4a847f[_0xf334('0x1f')]=_0x5aa06d;return _0x52777f?_0x52777f(_0x4a847f):_[_0xf334('0x20')]();});}}(0x0));};RuleEngine[_0xf334('0x8')]['findRules']=function(_0x4d963c){if(_['isNil'](_0x4d963c)){return this['rules'];}else{var _0xef207d=_[_0xf334('0x21')](_0x4d963c);return _['filter'](this['rules'],_0xef207d);}};RuleEngine[_0xf334('0x8')][_0xf334('0x22')]=function(_0x49a3e6,_0x677851){var _0x2eaaa0=_0x49a3e6==='on'||_0x49a3e6==='ON'?!![]:![];var _0x127c9e=this[_0xf334('0x23')](_0x677851);for(var _0x4f6c69=0x0,_0x455c1a=_0x127c9e['length'];_0x4f6c69<_0x455c1a;_0x4f6c69+=0x1){_0x127c9e[_0x4f6c69]['on']=_0x2eaaa0;}this[_0xf334('0xe')]();};RuleEngine[_0xf334('0x8')][_0xf334('0x24')]=function(_0xeeaa42,_0x213c68){_0xeeaa42=parseInt(_0xeeaa42,0xa);var _0x22b76c=this[_0xf334('0x23')](_0x213c68);for(var _0x7b09ba=0x0,_0x574c8e=_0x22b76c[_0xf334('0x1d')];_0x7b09ba<_0x574c8e;_0x7b09ba+=0x1){_0x22b76c[_0x7b09ba][_0xf334('0x25')]=_0xeeaa42;}this['sync']();};RuleEngine[_0xf334('0x8')][_0xf334('0x26')]=function(){var _0x8cb9e1=this[_0xf334('0xb')];if(_0x8cb9e1 instanceof Array){_0x8cb9e1=_0x8cb9e1['map'](function(_0x1fee8f){_0x1fee8f['condition']=_0x1fee8f[_0xf334('0x1e')][_0xf334('0x27')]();_0x1fee8f['consequence']=_0x1fee8f[_0xf334('0x14')][_0xf334('0x27')]();return _0x1fee8f;});}else if(!_[_0xf334('0x4')](_0x8cb9e1)){_0x8cb9e1['condition']=_0x8cb9e1['condition']['toString']();_0x8cb9e1[_0xf334('0x14')]=_0x8cb9e1['consequence'][_0xf334('0x27')]();}return _0x8cb9e1;};RuleEngine[_0xf334('0x8')][_0xf334('0x28')]=function(_0x13acbd){this['init']();if(_['isString'](_0x13acbd)){_0x13acbd=JSON[_0xf334('0x29')](_0x13acbd);}if(_0x13acbd instanceof Array){_0x13acbd=_0x13acbd[_0xf334('0x2a')](function(_0x4d8613){_0x4d8613['condition']=eval('('+_0x4d8613[_0xf334('0x1e')]+')');_0x4d8613[_0xf334('0x14')]=eval('('+_0x4d8613[_0xf334('0x14')]+')');return _0x4d8613;});}else if(_0x13acbd!==null&&typeof _0x13acbd=='object'){_0x13acbd['condition']=eval('('+_0x13acbd['condition']+')');_0x13acbd['consequence']=eval('('+_0x13acbd[_0xf334('0x14')]+')');}this[_0xf334('0x9')](_0x13acbd);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4c5afaf..44866a5 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2f5d18,_0x5f1d38){var _0x48eb6c=function(_0x300c2a){while(--_0x300c2a){_0x2f5d18['push'](_0x2f5d18['shift']());}};_0x48eb6c(++_0x5f1d38);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0xbe80c4,_0x4d487f){var _0x47a776=function(_0x4d088b){while(--_0x4d088b){_0xbe80c4['push'](_0xbe80c4['shift']());}};_0x47a776(++_0x4d487f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ab69150..4bd66b0 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 _0x5b12=['mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','chat','openchannel','fax','sms','whatsapp','Status','toNumber','format','faxStatus','busy','stringify','user:save','exports','lodash','moment','md5','../../../config/environment','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x7a3d5a,_0x1763c2){var _0x213b2f=function(_0x2f96db){while(--_0x2f96db){_0x7a3d5a['push'](_0x7a3d5a['shift']());}};_0x213b2f(++_0x1763c2);}(_0x5b12,0xa3));var _0x25b1=function(_0x7b71ef,_0x1834d9){_0x7b71ef=_0x7b71ef-0x0;var _0x4bb9a1=_0x5b12[_0x7b71ef];return _0x4bb9a1;};'use strict';var _=require(_0x25b1('0x0'));var moment=require(_0x25b1('0x1'));var md5=require(_0x25b1('0x2'));var Redis=require('ioredis');var config=require(_0x25b1('0x3'));config['redis']=_[_0x25b1('0x4')](config[_0x25b1('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x25b1('0x6'))(new Redis(config['redis']));function Agent(_0x5248c2){this['id']=_0x5248c2['id']||0x0;this[_0x25b1('0x7')]=_0x5248c2['name']||'';this['online']=_0x5248c2[_0x25b1('0x8')]||!![];this[_0x25b1('0x9')]=_0x5248c2[_0x25b1('0x9')]||![];this[_0x25b1('0xa')]=_0x5248c2[_0x25b1('0xa')]||![];this[_0x25b1('0xb')]=_0x5248c2[_0x25b1('0xb')]||![];this[_0x25b1('0xc')]=_0x5248c2['faxPause']||![];this[_0x25b1('0xd')]=_0x5248c2[_0x25b1('0xd')]||![];this[_0x25b1('0xe')]=_0x5248c2[_0x25b1('0xe')]||![];this[_0x25b1('0xf')]=_0x25b1('0x10');this[_0x25b1('0x11')]=0x0;this[_0x25b1('0x12')]=_0x5248c2[_0x25b1('0x12')]||0x0;this[_0x25b1('0x13')]=0x0;this[_0x25b1('0x14')]=_0x25b1('0x10');this[_0x25b1('0x15')]=0x0;this[_0x25b1('0x16')]=_0x5248c2[_0x25b1('0x16')]||0x0;this[_0x25b1('0x17')]=0x0;this['faxStatus']=_0x25b1('0x10');this[_0x25b1('0x18')]=0x0;this['faxCapacity']=_0x5248c2[_0x25b1('0x19')]||0x0;this[_0x25b1('0x1a')]=0x0;this[_0x25b1('0x1b')]='unknown';this['smsStatusTime']=0x0;this[_0x25b1('0x1c')]=_0x5248c2['smsCapacity']||0x0;this[_0x25b1('0x1d')]=0x0;this[_0x25b1('0x1e')]=_0x25b1('0x10');this[_0x25b1('0x1f')]=0x0;this[_0x25b1('0x20')]=_0x5248c2[_0x25b1('0x20')]||0x0;this[_0x25b1('0x21')]=0x0;this[_0x25b1('0x22')]='unknown';this['openchannelStatusTime']=0x0;this[_0x25b1('0x23')]=_0x5248c2['openchannelCapacity']||0x0;this[_0x25b1('0x24')]=0x0;this['busy']=![];this[_0x25b1('0x25')]=undefined;this['md5']='';this[_0x25b1('0x26')]();}Agent['prototype'][_0x25b1('0x27')]=function(_0x5b0be0){if(this[_0x5b0be0+'CurrentCapacity']>0x0){if(this[_0x5b0be0+'Capacity']>0x0&&this[_0x5b0be0+_0x25b1('0x28')]>=this[_0x5b0be0+_0x25b1('0x29')]){return'maxcapacity';}else{return _0x25b1('0x2a');}}else{return _0x25b1('0x2b');}};Agent[_0x25b1('0x2c')][_0x25b1('0x26')]=function(){var _0x1aabbb=['mail',_0x25b1('0x2d'),_0x25b1('0x2e'),_0x25b1('0x2f'),_0x25b1('0x30'),_0x25b1('0x31')];for(var _0x1292bf=0x0;_0x1292bf<_0x1aabbb['length'];_0x1292bf+=0x1){var _0x3c05c6=this[_0x25b1('0x27')](_0x1aabbb[_0x1292bf]);if(this[_0x1aabbb[_0x1292bf]+_0x25b1('0x32')]!==_0x3c05c6){this[_0x1aabbb[_0x1292bf]+'StatusTime']=_[_0x25b1('0x33')](moment()[_0x25b1('0x34')]('x'));}this[_0x1aabbb[_0x1292bf]+_0x25b1('0x32')]=_0x3c05c6;}var _0x584357={'id':this['id'],'name':this[_0x25b1('0x7')],'online':this['online'],'voicePause':this[_0x25b1('0x9')],'chatPause':this[_0x25b1('0xa')],'mailPause':this[_0x25b1('0xb')],'smsPause':this[_0x25b1('0xd')],'faxPause':this[_0x25b1('0xc')],'openchannelPause':this[_0x25b1('0xe')],'chatStatus':this[_0x25b1('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x25b1('0x12')],'chatCurrentCapacity':this[_0x25b1('0x13')],'mailStatus':this[_0x25b1('0x14')],'mailStatusTime':this[_0x25b1('0x15')],'mailCapacity':this[_0x25b1('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x25b1('0x35')],'faxStatusTime':this[_0x25b1('0x18')],'faxCapacity':this[_0x25b1('0x19')],'faxCurrentCapacity':this[_0x25b1('0x1a')],'smsStatus':this[_0x25b1('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x25b1('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x25b1('0x1f')],'whatsappCapacity':this[_0x25b1('0x20')],'whatsappCurrentCapacity':this[_0x25b1('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x25b1('0x23')],'openchannelCurrentCapacity':this[_0x25b1('0x24')],'busy':this[_0x25b1('0x36')],'busyQueue':this['busyQueue']};var _0x2bc8c4=md5(JSON[_0x25b1('0x37')](_0x584357));if(this[_0x25b1('0x2')]!==_0x2bc8c4){this[_0x25b1('0x2')]=_0x2bc8c4;io['emit'](_0x25b1('0x38'),_0x584357);}};module[_0x25b1('0x39')]=Agent; \ No newline at end of file +var _0xa321=['mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','Capacity','CurrentCapacity','maxcapacity','working','idle','chat','openchannel','sms','Status','StatusTime','toNumber','format','chatStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity'];(function(_0x1e1d70,_0x5db72f){var _0x2ec281=function(_0x3f0153){while(--_0x3f0153){_0x1e1d70['push'](_0x1e1d70['shift']());}};_0x2ec281(++_0x5db72f);}(_0xa321,0x9d));var _0x1a32=function(_0x2c32fb,_0x45b9a8){_0x2c32fb=_0x2c32fb-0x0;var _0x1f2836=_0xa321[_0x2c32fb];return _0x1f2836;};'use strict';var _=require(_0x1a32('0x0'));var moment=require(_0x1a32('0x1'));var md5=require(_0x1a32('0x2'));var Redis=require(_0x1a32('0x3'));var config=require('../../../config/environment');config[_0x1a32('0x4')]=_[_0x1a32('0x5')](config['redis'],{'host':_0x1a32('0x6'),'port':0x18eb});var io=require(_0x1a32('0x7'))(new Redis(config['redis']));function Agent(_0x57b386){this['id']=_0x57b386['id']||0x0;this['name']=_0x57b386[_0x1a32('0x8')]||'';this['online']=_0x57b386[_0x1a32('0x9')]||!![];this[_0x1a32('0xa')]=_0x57b386[_0x1a32('0xa')]||![];this[_0x1a32('0xb')]=_0x57b386[_0x1a32('0xb')]||![];this['mailPause']=_0x57b386[_0x1a32('0xc')]||![];this[_0x1a32('0xd')]=_0x57b386['faxPause']||![];this[_0x1a32('0xe')]=_0x57b386[_0x1a32('0xe')]||![];this[_0x1a32('0xf')]=_0x57b386[_0x1a32('0xf')]||![];this[_0x1a32('0x10')]=_0x1a32('0x11');this['chatStatusTime']=0x0;this[_0x1a32('0x12')]=_0x57b386[_0x1a32('0x12')]||0x0;this[_0x1a32('0x13')]=0x0;this['mailStatus']=_0x1a32('0x11');this[_0x1a32('0x14')]=0x0;this[_0x1a32('0x15')]=_0x57b386[_0x1a32('0x15')]||0x0;this[_0x1a32('0x16')]=0x0;this['faxStatus']=_0x1a32('0x11');this[_0x1a32('0x17')]=0x0;this[_0x1a32('0x18')]=_0x57b386[_0x1a32('0x18')]||0x0;this[_0x1a32('0x19')]=0x0;this[_0x1a32('0x1a')]='unknown';this[_0x1a32('0x1b')]=0x0;this[_0x1a32('0x1c')]=_0x57b386['smsCapacity']||0x0;this[_0x1a32('0x1d')]=0x0;this[_0x1a32('0x1e')]=_0x1a32('0x11');this[_0x1a32('0x1f')]=0x0;this[_0x1a32('0x20')]=_0x57b386[_0x1a32('0x20')]||0x0;this[_0x1a32('0x21')]=0x0;this[_0x1a32('0x22')]=_0x1a32('0x11');this[_0x1a32('0x23')]=0x0;this[_0x1a32('0x24')]=_0x57b386['openchannelCapacity']||0x0;this[_0x1a32('0x25')]=0x0;this[_0x1a32('0x26')]=![];this[_0x1a32('0x27')]=undefined;this['md5']='';this[_0x1a32('0x28')]();}Agent[_0x1a32('0x29')]['getChannelStatus']=function(_0x1250dc){if(this[_0x1250dc+'CurrentCapacity']>0x0){if(this[_0x1250dc+_0x1a32('0x2a')]>0x0&&this[_0x1250dc+_0x1a32('0x2b')]>=this[_0x1250dc+'Capacity']){return _0x1a32('0x2c');}else{return _0x1a32('0x2d');}}else{return _0x1a32('0x2e');}};Agent['prototype'][_0x1a32('0x28')]=function(){var _0x1fe746=['mail',_0x1a32('0x2f'),_0x1a32('0x30'),'fax',_0x1a32('0x31'),'whatsapp'];for(var _0x4c183c=0x0;_0x4c183c<_0x1fe746['length'];_0x4c183c+=0x1){var _0x4c24b0=this['getChannelStatus'](_0x1fe746[_0x4c183c]);if(this[_0x1fe746[_0x4c183c]+_0x1a32('0x32')]!==_0x4c24b0){this[_0x1fe746[_0x4c183c]+_0x1a32('0x33')]=_[_0x1a32('0x34')](moment()[_0x1a32('0x35')]('x'));}this[_0x1fe746[_0x4c183c]+_0x1a32('0x32')]=_0x4c24b0;}var _0x35af58={'id':this['id'],'name':this[_0x1a32('0x8')],'online':this[_0x1a32('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x1a32('0xb')],'mailPause':this[_0x1a32('0xc')],'smsPause':this[_0x1a32('0xe')],'faxPause':this[_0x1a32('0xd')],'openchannelPause':this[_0x1a32('0xf')],'chatStatus':this[_0x1a32('0x10')],'chatStatusTime':this[_0x1a32('0x36')],'chatCapacity':this[_0x1a32('0x12')],'chatCurrentCapacity':this[_0x1a32('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x1a32('0x14')],'mailCapacity':this[_0x1a32('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x1a32('0x17')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x1a32('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x1a32('0x1f')],'whatsappCapacity':this[_0x1a32('0x20')],'whatsappCurrentCapacity':this[_0x1a32('0x21')],'openchannelStatus':this[_0x1a32('0x22')],'openchannelStatusTime':this[_0x1a32('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x1a32('0x26')],'busyQueue':this['busyQueue']};var _0xd2455c=md5(JSON[_0x1a32('0x37')](_0x35af58));if(this[_0x1a32('0x2')]!==_0xd2455c){this['md5']=_0xd2455c;io[_0x1a32('0x38')](_0x1a32('0x39'),_0x35af58);}};module[_0x1a32('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 679422d..44b93be 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 _0x159d=['chat:queue:%s','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','stringify','format'];(function(_0xb92ec3,_0x636d10){var _0x19c9e9=function(_0x2803dd){while(--_0x2803dd){_0xb92ec3['push'](_0xb92ec3['shift']());}};_0x19c9e9(++_0x636d10);}(_0x159d,0xb1));var _0xd159=function(_0x32c3c2,_0x42a5bf){_0x32c3c2=_0x32c3c2-0x0;var _0x43070a=_0x159d[_0x32c3c2];return _0x43070a;};'use strict';var _=require(_0xd159('0x0'));var md5=require(_0xd159('0x1'));var util=require(_0xd159('0x2'));var Redis=require('ioredis');var config=require(_0xd159('0x3'));config[_0xd159('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd159('0x5'))(new Redis(config['redis']));function ChatQueue(_0x59dacd){this['id']=_0x59dacd['id']||0x0;this[_0xd159('0x6')]=_0x59dacd[_0xd159('0x6')]||'';this[_0xd159('0x7')]=_0x59dacd['timeout']||0xa;this[_0xd159('0x8')]=_0x59dacd[_0xd159('0x8')]||_0xd159('0x9');this['Agents']=_0x59dacd[_0xd159('0xa')];this[_0xd159('0xb')]={};this[_0xd159('0xc')]=0x0;this[_0xd159('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xd159('0xd')][_0xd159('0xe')]=function(){var _0x105efd=this[_0xd159('0xb')][_0xd159('0xf')];this['mapAgentsId']=_[_0xd159('0x10')](this[_0xd159('0xa')],'id');this[_0xd159('0xb')]['_rr']=_0x105efd;};ChatQueue[_0xd159('0xd')][_0xd159('0x11')]=function(){this[_0xd159('0x12')]=0x0;this[_0xd159('0x13')]=0x0;for(var _0x5ede8f=0x0;_0x5ede8f=0x0?this[_0xd159('0x17')]:0x0;var _0x18b498={'id':this['id'],'available':this[_0xd159('0x17')],'loggedIn':this[_0xd159('0x12')],'name':this['name'],'paused':this[_0xd159('0x13')],'waiting':this[_0xd159('0xc')]};var _0x2fca24=md5(JSON[_0xd159('0x18')](_0x18b498));if(this['md5']!==_0x2fca24){this[_0xd159('0x1')]=_0x2fca24;io['to'](util[_0xd159('0x19')](_0xd159('0x1a'),_0x18b498[_0xd159('0x6')]))['emit'](_0xd159('0x1b'),_0x18b498);}};module[_0xd159('0x1c')]=ChatQueue; \ No newline at end of file +var _0xf8d4=['loggedIn','chatPause','available','stringify','format','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online'];(function(_0x18ffdb,_0x3f9451){var _0x4f099b=function(_0x2b8035){while(--_0x2b8035){_0x18ffdb['push'](_0x18ffdb['shift']());}};_0x4f099b(++_0x3f9451);}(_0xf8d4,0x11e));var _0x4f8d=function(_0x557ffd,_0x35e670){_0x557ffd=_0x557ffd-0x0;var _0x30105c=_0xf8d4[_0x557ffd];return _0x30105c;};'use strict';var _=require('lodash');var md5=require(_0x4f8d('0x0'));var util=require(_0x4f8d('0x1'));var Redis=require(_0x4f8d('0x2'));var config=require(_0x4f8d('0x3'));config[_0x4f8d('0x4')]=_[_0x4f8d('0x5')](config[_0x4f8d('0x4')],{'host':_0x4f8d('0x6'),'port':0x18eb});var io=require(_0x4f8d('0x7'))(new Redis(config['redis']));function ChatQueue(_0x3cb3c9){this['id']=_0x3cb3c9['id']||0x0;this[_0x4f8d('0x8')]=_0x3cb3c9[_0x4f8d('0x8')]||'';this[_0x4f8d('0x9')]=_0x3cb3c9['timeout']||0xa;this['strategy']=_0x3cb3c9[_0x4f8d('0xa')]||_0x4f8d('0xb');this[_0x4f8d('0xc')]=_0x3cb3c9[_0x4f8d('0xc')];this[_0x4f8d('0xd')]={};this[_0x4f8d('0xe')]=0x0;this[_0x4f8d('0x0')]='';this[_0x4f8d('0xf')]();this[_0x4f8d('0x10')]();}ChatQueue[_0x4f8d('0x11')]['updateRouting']=function(){var _0x24a065=this[_0x4f8d('0xd')]['_rr'];this[_0x4f8d('0xd')]=_['map'](this[_0x4f8d('0xc')],'id');this[_0x4f8d('0xd')][_0x4f8d('0x12')]=_0x24a065;};ChatQueue[_0x4f8d('0x11')][_0x4f8d('0x10')]=function(){this['loggedIn']=0x0;this[_0x4f8d('0x13')]=0x0;for(var _0xc9d3f4=0x0;_0xc9d3f4=0x0?this['available']:0x0;var _0x100eaa={'id':this['id'],'available':this[_0x4f8d('0x18')],'loggedIn':this[_0x4f8d('0x16')],'name':this[_0x4f8d('0x8')],'paused':this['paused'],'waiting':this[_0x4f8d('0xe')]};var _0x41532d=md5(JSON[_0x4f8d('0x19')](_0x100eaa));if(this[_0x4f8d('0x0')]!==_0x41532d){this[_0x4f8d('0x0')]=_0x41532d;io['to'](util[_0x4f8d('0x1a')]('chat:queue:%s',_0x100eaa[_0x4f8d('0x8')]))['emit']('chat_queue:save',_0x100eaa);}};module[_0x4f8d('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index faa0655..e784cf0 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0xa5d120,_0x4c6d1a){var _0x409e64=function(_0x5e8aef){while(--_0x5e8aef){_0xa5d120['push'](_0xa5d120['shift']());}};_0x409e64(++_0x4c6d1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x116fac,_0x44917a){var _0x5455cb=function(_0x21fe81){while(--_0x21fe81){_0x116fac['push'](_0x116fac['shift']());}};_0x5455cb(++_0x44917a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index dbc316e..eb019d8 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 _0x3b31=['name','Intervals'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x3b31,0xfa));var _0x13b3=function(_0x4e6b71,_0x45dcfc){_0x4e6b71=_0x4e6b71-0x0;var _0x5a3595=_0x3b31[_0x4e6b71];return _0x5a3595;};'use strict';function Interval(_0x110330){this['id']=_0x110330['id']||0x0;this[_0x13b3('0x0')]=_0x110330[_0x13b3('0x0')]||'';this[_0x13b3('0x1')]=_0x110330['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xf74a=['exports','name','Intervals'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0xf74a,0x133));var _0xaf74=function(_0x18e76d,_0x2a2121){_0x18e76d=_0x18e76d-0x0;var _0x10223e=_0xf74a[_0x18e76d];return _0x10223e;};'use strict';function Interval(_0x5979fd){this['id']=_0x5979fd['id']||0x0;this[_0xaf74('0x0')]=_0x5979fd[_0xaf74('0x0')]||'';this[_0xaf74('0x1')]=_0x5979fd[_0xaf74('0x1')]||{};}module[_0xaf74('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 3395eb0..4daadca 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 _0xd301=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','../../../config/environment','redis','defaults','localhost'];(function(_0x13f933,_0x1ce799){var _0x6eb9db=function(_0x4c5831){while(--_0x4c5831){_0x13f933['push'](_0x13f933['shift']());}};_0x6eb9db(++_0x1ce799);}(_0xd301,0x145));var _0x1d30=function(_0x1f063b,_0x321a3c){_0x1f063b=_0x1f063b-0x0;var _0x4d864b=_0xd301[_0x1f063b];return _0x4d864b;};'use strict';var _=require(_0x1d30('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x1d30('0x1'));config[_0x1d30('0x2')]=_[_0x1d30('0x3')](config[_0x1d30('0x2')],{'host':_0x1d30('0x4'),'port':0x18eb});var io=require(_0x1d30('0x5'))(new Redis(config[_0x1d30('0x2')]));function MailQueue(_0xe9c8cf){this['id']=_0xe9c8cf['id']||0x0;this[_0x1d30('0x6')]=_0xe9c8cf['name']||'';this[_0x1d30('0x7')]=_0xe9c8cf[_0x1d30('0x7')]||0xa;this[_0x1d30('0x8')]=_0xe9c8cf['strategy']||_0x1d30('0x9');this[_0x1d30('0xa')]=_0xe9c8cf[_0x1d30('0xa')];this[_0x1d30('0xb')]={};this[_0x1d30('0xc')]=0x0;this[_0x1d30('0xd')]='';this[_0x1d30('0xe')]();this['updateRealtime']();}MailQueue[_0x1d30('0xf')][_0x1d30('0xe')]=function(){var _0x4646a2=this['mapAgentsId'][_0x1d30('0x10')];this[_0x1d30('0xb')]=_[_0x1d30('0x11')](this[_0x1d30('0xa')],'id');this[_0x1d30('0xb')][_0x1d30('0x10')]=_0x4646a2;};MailQueue[_0x1d30('0xf')][_0x1d30('0x12')]=function(){this[_0x1d30('0x13')]=0x0;this[_0x1d30('0x14')]=0x0;for(var _0x2b3f7b=0x0;_0x2b3f7b=0x0?this[_0x1d30('0x18')]:0x0;var _0x1785eb={'id':this['id'],'available':this[_0x1d30('0x18')],'loggedIn':this[_0x1d30('0x13')],'name':this[_0x1d30('0x6')],'paused':this[_0x1d30('0x14')],'waiting':this[_0x1d30('0xc')]};var _0x36a70d=md5(JSON['stringify'](_0x1785eb));if(this[_0x1d30('0xd')]!==_0x36a70d){this[_0x1d30('0xd')]=_0x36a70d;io['to'](util[_0x1d30('0x19')](_0x1d30('0x1a'),_0x1785eb[_0x1d30('0x6')]))[_0x1d30('0x1b')](_0x1d30('0x1c'),_0x1785eb);}};module[_0x1d30('0x1d')]=MailQueue; \ No newline at end of file +var _0x3cae=['length','online','loggedIn','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','prototype','paused'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3cae,0x117));var _0xe3ca=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3cae[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe3ca('0x0'));var md5=require(_0xe3ca('0x1'));var util=require(_0xe3ca('0x2'));var Redis=require(_0xe3ca('0x3'));var config=require(_0xe3ca('0x4'));config[_0xe3ca('0x5')]=_[_0xe3ca('0x6')](config['redis'],{'host':_0xe3ca('0x7'),'port':0x18eb});var io=require(_0xe3ca('0x8'))(new Redis(config['redis']));function MailQueue(_0x33c472){this['id']=_0x33c472['id']||0x0;this['name']=_0x33c472[_0xe3ca('0x9')]||'';this[_0xe3ca('0xa')]=_0x33c472[_0xe3ca('0xa')]||0xa;this['strategy']=_0x33c472[_0xe3ca('0xb')]||_0xe3ca('0xc');this[_0xe3ca('0xd')]=_0x33c472[_0xe3ca('0xd')];this[_0xe3ca('0xe')]={};this[_0xe3ca('0xf')]=0x0;this[_0xe3ca('0x1')]='';this['updateRouting']();this[_0xe3ca('0x10')]();}MailQueue['prototype'][_0xe3ca('0x11')]=function(){var _0x3ded4b=this[_0xe3ca('0xe')][_0xe3ca('0x12')];this[_0xe3ca('0xe')]=_['map'](this['Agents'],'id');this[_0xe3ca('0xe')]['_rr']=_0x3ded4b;};MailQueue[_0xe3ca('0x13')][_0xe3ca('0x10')]=function(){this['loggedIn']=0x0;this[_0xe3ca('0x14')]=0x0;for(var _0x3a9455=0x0;_0x3a9455=0x0?this[_0xe3ca('0x18')]:0x0;var _0x5bb8d8={'id':this['id'],'available':this[_0xe3ca('0x18')],'loggedIn':this[_0xe3ca('0x17')],'name':this[_0xe3ca('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x47f3fb=md5(JSON[_0xe3ca('0x19')](_0x5bb8d8));if(this['md5']!==_0x47f3fb){this['md5']=_0x47f3fb;io['to'](util[_0xe3ca('0x1a')](_0xe3ca('0x1b'),_0x5bb8d8[_0xe3ca('0x9')]))[_0xe3ca('0x1c')](_0xe3ca('0x1d'),_0x5bb8d8);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f590d24..76e014b 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 _0xb029=['map','updateRealtime','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','util','ioredis','socket.io-emitter','redis','name','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr'];(function(_0x11baf3,_0x4771b2){var _0x1da41b=function(_0x304197){while(--_0x304197){_0x11baf3['push'](_0x11baf3['shift']());}};_0x1da41b(++_0x4771b2);}(_0xb029,0x10a));var _0x9b02=function(_0x40b4eb,_0x28be81){_0x40b4eb=_0x40b4eb-0x0;var _0x1f966d=_0xb029[_0x40b4eb];return _0x1f966d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x9b02('0x0'));var Redis=require(_0x9b02('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9b02('0x2'))(new Redis(config[_0x9b02('0x3')]));function OpenchannelQueue(_0x6c9b7c){this['id']=_0x6c9b7c['id']||0x0;this[_0x9b02('0x4')]=_0x6c9b7c[_0x9b02('0x4')]||'';this['timeout']=_0x6c9b7c['timeout']||0xa;this[_0x9b02('0x5')]=_0x6c9b7c['strategy']||_0x9b02('0x6');this[_0x9b02('0x7')]=_0x6c9b7c[_0x9b02('0x7')];this[_0x9b02('0x8')]={};this[_0x9b02('0x9')]=0x0;this[_0x9b02('0xa')]='';this[_0x9b02('0xb')]();this['updateRealtime']();}OpenchannelQueue[_0x9b02('0xc')][_0x9b02('0xb')]=function(){var _0x3d53a9=this[_0x9b02('0x8')][_0x9b02('0xd')];this[_0x9b02('0x8')]=_[_0x9b02('0xe')](this['Agents'],'id');this['mapAgentsId'][_0x9b02('0xd')]=_0x3d53a9;};OpenchannelQueue[_0x9b02('0xc')][_0x9b02('0xf')]=function(){this[_0x9b02('0x10')]=0x0;this[_0x9b02('0x11')]=0x0;for(var _0x1a8e63=0x0;_0x1a8e63=0x0?this[_0x9b02('0x15')]:0x0;var _0x5c991c={'id':this['id'],'available':this[_0x9b02('0x15')],'loggedIn':this[_0x9b02('0x10')],'name':this[_0x9b02('0x4')],'paused':this[_0x9b02('0x11')],'waiting':this['waiting']};var _0x2df6e1=md5(JSON[_0x9b02('0x16')](_0x5c991c));if(this[_0x9b02('0xa')]!==_0x2df6e1){this[_0x9b02('0xa')]=_0x2df6e1;io['to'](util[_0x9b02('0x17')](_0x9b02('0x18'),_0x5c991c[_0x9b02('0x4')]))[_0x9b02('0x19')](_0x9b02('0x1a'),_0x5c991c);}};module[_0x9b02('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0xe837=['available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','openchannelPause'];(function(_0x3e01b7,_0x24d001){var _0x4191b3=function(_0x3acbba){while(--_0x3acbba){_0x3e01b7['push'](_0x3e01b7['shift']());}};_0x4191b3(++_0x24d001);}(_0xe837,0x1c9));var _0x7e83=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0xe837[_0x19997d];return _0x49be7f;};'use strict';var _=require(_0x7e83('0x0'));var md5=require(_0x7e83('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7e83('0x2')]=_[_0x7e83('0x3')](config[_0x7e83('0x2')],{'host':_0x7e83('0x4'),'port':0x18eb});var io=require(_0x7e83('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x23c1be){this['id']=_0x23c1be['id']||0x0;this[_0x7e83('0x6')]=_0x23c1be['name']||'';this[_0x7e83('0x7')]=_0x23c1be[_0x7e83('0x7')]||0xa;this[_0x7e83('0x8')]=_0x23c1be[_0x7e83('0x8')]||_0x7e83('0x9');this[_0x7e83('0xa')]=_0x23c1be[_0x7e83('0xa')];this[_0x7e83('0xb')]={};this[_0x7e83('0xc')]=0x0;this[_0x7e83('0x1')]='';this['updateRouting']();this[_0x7e83('0xd')]();}OpenchannelQueue[_0x7e83('0xe')][_0x7e83('0xf')]=function(){var _0x3845cf=this[_0x7e83('0xb')][_0x7e83('0x10')];this['mapAgentsId']=_[_0x7e83('0x11')](this[_0x7e83('0xa')],'id');this['mapAgentsId'][_0x7e83('0x10')]=_0x3845cf;};OpenchannelQueue[_0x7e83('0xe')][_0x7e83('0xd')]=function(){this[_0x7e83('0x12')]=0x0;this[_0x7e83('0x13')]=0x0;for(var _0x1c8ec9=0x0;_0x1c8ec9=0x0?this[_0x7e83('0x17')]:0x0;var _0x44eec8={'id':this['id'],'available':this[_0x7e83('0x17')],'loggedIn':this[_0x7e83('0x12')],'name':this['name'],'paused':this[_0x7e83('0x13')],'waiting':this[_0x7e83('0xc')]};var _0x416c29=md5(JSON[_0x7e83('0x18')](_0x44eec8));if(this[_0x7e83('0x1')]!==_0x416c29){this[_0x7e83('0x1')]=_0x416c29;io['to'](util[_0x7e83('0x19')](_0x7e83('0x1a'),_0x44eec8['name']))[_0x7e83('0x1b')](_0x7e83('0x1c'),_0x44eec8);}};module[_0x7e83('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 244f930..1ccb34e 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 _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x32fadd,_0x18386c){var _0x6356c4=function(_0x5f2804){while(--_0x5f2804){_0x32fadd['push'](_0x32fadd['shift']());}};_0x6356c4(++_0x18386c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x105ec1,_0x85e33a){var _0x1e7249=function(_0x42e261){while(--_0x42e261){_0x105ec1['push'](_0x105ec1['shift']());}};_0x1e7249(++_0x85e33a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 89c5501..fa78e52 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 _0x1dff=['stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','online','loggedIn','whatsappPause','available'];(function(_0x19e206,_0x3e945d){var _0x531b21=function(_0x30ff2e){while(--_0x30ff2e){_0x19e206['push'](_0x19e206['shift']());}};_0x531b21(++_0x3e945d);}(_0x1dff,0x1e6));var _0xf1df=function(_0x59606e,_0x429521){_0x59606e=_0x59606e-0x0;var _0x19e449=_0x1dff[_0x59606e];return _0x19e449;};'use strict';var _=require('lodash');var md5=require(_0xf1df('0x0'));var util=require(_0xf1df('0x1'));var Redis=require(_0xf1df('0x2'));var config=require(_0xf1df('0x3'));config[_0xf1df('0x4')]=_[_0xf1df('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf1df('0x4')]));function WhatsappQueue(_0x50849e){this['id']=_0x50849e['id']||0x0;this[_0xf1df('0x6')]=_0x50849e[_0xf1df('0x6')]||'';this[_0xf1df('0x7')]=_0x50849e[_0xf1df('0x7')]||0xa;this[_0xf1df('0x8')]=_0x50849e[_0xf1df('0x8')]||_0xf1df('0x9');this[_0xf1df('0xa')]=_0x50849e[_0xf1df('0xa')];this['mapAgentsId']={};this[_0xf1df('0xb')]=0x0;this[_0xf1df('0x0')]='';this[_0xf1df('0xc')]();this[_0xf1df('0xd')]();}WhatsappQueue[_0xf1df('0xe')][_0xf1df('0xc')]=function(){var _0x4bd832=this[_0xf1df('0xf')]['_rr'];this[_0xf1df('0xf')]=_[_0xf1df('0x10')](this[_0xf1df('0xa')],'id');this['mapAgentsId'][_0xf1df('0x11')]=_0x4bd832;};WhatsappQueue[_0xf1df('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xf1df('0x12')]=0x0;for(var _0x221234=0x0;_0x221234=0x0?this[_0xf1df('0x17')]:0x0;var _0x3874fb={'id':this['id'],'available':this[_0xf1df('0x17')],'loggedIn':this[_0xf1df('0x15')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xf1df('0xb')]};var _0xe8b34b=md5(JSON[_0xf1df('0x18')](_0x3874fb));if(this[_0xf1df('0x0')]!==_0xe8b34b){this[_0xf1df('0x0')]=_0xe8b34b;io['to'](util[_0xf1df('0x19')](_0xf1df('0x1a'),_0x3874fb['name']))[_0xf1df('0x1b')](_0xf1df('0x1c'),_0x3874fb);}};module[_0xf1df('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x0f8a=['stringify','format','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','paused','length','online','loggedIn','whatsappPause','available'];(function(_0xae71d1,_0x7c32b6){var _0x3cf2f6=function(_0x5a5812){while(--_0x5a5812){_0xae71d1['push'](_0xae71d1['shift']());}};_0x3cf2f6(++_0x7c32b6);}(_0x0f8a,0x1b7));var _0xa0f8=function(_0x3913d3,_0x499f21){_0x3913d3=_0x3913d3-0x0;var _0x435044=_0x0f8a[_0x3913d3];return _0x435044;};'use strict';var _=require(_0xa0f8('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa0f8('0x1'));var config=require(_0xa0f8('0x2'));config[_0xa0f8('0x3')]=_[_0xa0f8('0x4')](config[_0xa0f8('0x3')],{'host':_0xa0f8('0x5'),'port':0x18eb});var io=require(_0xa0f8('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x21f9c8){this['id']=_0x21f9c8['id']||0x0;this[_0xa0f8('0x7')]=_0x21f9c8[_0xa0f8('0x7')]||'';this[_0xa0f8('0x8')]=_0x21f9c8[_0xa0f8('0x8')]||0xa;this[_0xa0f8('0x9')]=_0x21f9c8[_0xa0f8('0x9')]||_0xa0f8('0xa');this['Agents']=_0x21f9c8[_0xa0f8('0xb')];this['mapAgentsId']={};this[_0xa0f8('0xc')]=0x0;this[_0xa0f8('0xd')]='';this[_0xa0f8('0xe')]();this[_0xa0f8('0xf')]();}WhatsappQueue['prototype'][_0xa0f8('0xe')]=function(){var _0x77c180=this[_0xa0f8('0x10')]['_rr'];this[_0xa0f8('0x10')]=_[_0xa0f8('0x11')](this[_0xa0f8('0xb')],'id');this['mapAgentsId'][_0xa0f8('0x12')]=_0x77c180;};WhatsappQueue[_0xa0f8('0x13')][_0xa0f8('0xf')]=function(){this['loggedIn']=0x0;this[_0xa0f8('0x14')]=0x0;for(var _0x16773a=0x0;_0x16773a=0x0?this[_0xa0f8('0x19')]:0x0;var _0x5c7f3c={'id':this['id'],'available':this[_0xa0f8('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xa0f8('0x7')],'paused':this[_0xa0f8('0x14')],'waiting':this[_0xa0f8('0xc')]};var _0x5e36b8=md5(JSON[_0xa0f8('0x1a')](_0x5c7f3c));if(this[_0xa0f8('0xd')]!==_0x5e36b8){this[_0xa0f8('0xd')]=_0x5e36b8;io['to'](util[_0xa0f8('0x1b')]('whatsapp:queue:%s',_0x5c7f3c['name']))[_0xa0f8('0x1c')](_0xa0f8('0x1d'),_0x5c7f3c);}};module[_0xa0f8('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bb28c89..1d6661d 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 _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x24e961,_0x4b8c2a){_0x24e961=_0x24e961-0x0;var _0x53f3b0=_0x1cb9[_0x24e961];return _0x53f3b0;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file +var _0x3e74=['initIntervals','mergeFromDatabase','initOpenchannelQueues','openchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/chatQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','length','isUndefined'];(function(_0x5c72b2,_0x35e619){var _0x2644f2=function(_0x220934){while(--_0x220934){_0x5c72b2['push'](_0x5c72b2['shift']());}};_0x2644f2(++_0x35e619);}(_0x3e74,0x175));var _0x43e7=function(_0x336dbd,_0x19cf6d){_0x336dbd=_0x336dbd-0x0;var _0x571c1e=_0x3e74[_0x336dbd];return _0x571c1e;};'use strict';var BPromise=require(_0x43e7('0x0'));var util=require('util');var _=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Agent=require(_0x43e7('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x43e7('0x4'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x43e7('0x5'));var FaxQueue=require(_0x43e7('0x6'));var WhatsappQueue=require(_0x43e7('0x7'));var Realtime=function(){this[_0x43e7('0x8')]={};this[_0x43e7('0x9')]={};this['openchannelQueues']={};this[_0x43e7('0xa')]={};this[_0x43e7('0xb')]={};this[_0x43e7('0xc')]={};this[_0x43e7('0xd')]={};this[_0x43e7('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x43e7('0xf')]={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this[_0x43e7('0x10')]={};this[_0x43e7('0x11')]={};};function freeIsNotKey(_0x5c34f4,_0x2803d9,_0x513707){var _0xf7c520=_[_0x43e7('0x12')](_0x5c34f4,function(_0x4ebc8e,_0x3eb206){return _0x4ebc8e[_0x513707];});for(var _0xc960ea in _0x2803d9){if(_0x2803d9[_0x43e7('0x13')](_0xc960ea)){if(!_0xf7c520[_0xc960ea]){delete _0x2803d9[_0xc960ea];}}}}Realtime[_0x43e7('0x14')]['mergeFromDatabase']=function(_0x583d85,_0x2fcb36){for(var _0x21fdd3 in _0x2fcb36){if(_0x583d85[_0x43e7('0x13')](_0x21fdd3)){_0x583d85[_0x21fdd3]=_0x2fcb36[_0x21fdd3];}}};Realtime['prototype']['initAgents']=function(){var _0x16849c=this;return function(_0x14c146){if(_0x14c146){freeIsNotKey(_0x14c146,_0x16849c[_0x43e7('0x8')],'id');for(var _0x328445=0x0,_0x4de324={},_0x5c4eaa={};_0x328445<_0x14c146[_0x43e7('0x15')];_0x328445+=0x1){_0x4de324=_0x14c146[_0x328445];if(_[_0x43e7('0x16')](_0x16849c[_0x43e7('0x8')][_0x4de324['id']])){_0x16849c['agents'][_0x4de324['id']]=new Agent(_0x4de324);}else{_0x16849c['mergeFromDatabase'](_0x16849c[_0x43e7('0x8')][_0x4de324['id']],_0x4de324);}}}return _0x16849c[_0x43e7('0x8')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x17')]=function(){var _0x3776f5=this;return function(_0x1f24fb){if(_0x1f24fb){freeIsNotKey(_0x1f24fb,_0x3776f5[_0x43e7('0x9')],'id');for(var _0x1441ef=0x0,_0x2377a3={},_0xab63cf={};_0x1441ef<_0x1f24fb[_0x43e7('0x15')];_0x1441ef+=0x1){_0x2377a3=_0x1f24fb[_0x1441ef];if(_[_0x43e7('0x16')](_0x3776f5['intervals'][_0x2377a3['id']])){_0x3776f5[_0x43e7('0x9')][_0x2377a3['id']]=new Interval(_0x2377a3);}else{_0x3776f5[_0x43e7('0x18')](_0x3776f5['intervals'][_0x2377a3['id']],_0x2377a3);}}}return _0x3776f5[_0x43e7('0x9')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x19')]=function(){var _0x28aacc=this;return function(_0x4077fb){if(_0x4077fb){freeIsNotKey(_0x4077fb,_0x28aacc[_0x43e7('0x1a')],'id');for(var _0x54a9e7=0x0,_0x454359={},_0x4eea52={};_0x54a9e7<_0x4077fb['length'];_0x54a9e7+=0x1){_0x454359=_0x4077fb[_0x54a9e7];if(_[_0x43e7('0x16')](_0x28aacc[_0x43e7('0x1a')][_0x454359['id']])){_0x28aacc['openchannelQueues'][_0x454359['id']]=new OpenchannelQueue(_0x454359);}else{_0x28aacc[_0x43e7('0x18')](_0x28aacc['openchannelQueues'][_0x454359['id']],_0x454359);}_0x28aacc[_0x43e7('0x1a')][_0x454359['id']]['updateRouting']();_0x28aacc[_0x43e7('0x1a')][_0x454359['id']][_0x43e7('0x1b')]();}}return _0x28aacc[_0x43e7('0x1a')];};};Realtime[_0x43e7('0x14')]['initChatQueues']=function(){var _0x52b7b3=this;return function(_0x805b54){if(_0x805b54){freeIsNotKey(_0x805b54,_0x52b7b3['chatQueues'],'id');for(var _0x2dd5f=0x0,_0x40dc8f={},_0x3565cf={};_0x2dd5f<_0x805b54[_0x43e7('0x15')];_0x2dd5f+=0x1){_0x40dc8f=_0x805b54[_0x2dd5f];if(_['isUndefined'](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']])){_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']]=new ChatQueue(_0x40dc8f);}else{_0x52b7b3[_0x43e7('0x18')](_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']],_0x40dc8f);}_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1c')]();_0x52b7b3[_0x43e7('0xa')][_0x40dc8f['id']][_0x43e7('0x1b')]();}}return _0x52b7b3[_0x43e7('0xa')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1d')]=function(){var _0x19725a=this;return function(_0x2bde44){if(_0x2bde44){freeIsNotKey(_0x2bde44,_0x19725a[_0x43e7('0xb')],'id');for(var _0x4bdb17=0x0,_0x238321={},_0x44f6b0={};_0x4bdb17<_0x2bde44[_0x43e7('0x15')];_0x4bdb17+=0x1){_0x238321=_0x2bde44[_0x4bdb17];if(_[_0x43e7('0x16')](_0x19725a[_0x43e7('0xb')][_0x238321['id']])){_0x19725a['smsQueues'][_0x238321['id']]=new SmsQueue(_0x238321);}else{_0x19725a[_0x43e7('0x18')](_0x19725a[_0x43e7('0xb')][_0x238321['id']],_0x238321);}_0x19725a[_0x43e7('0xb')][_0x238321['id']][_0x43e7('0x1c')]();_0x19725a['smsQueues'][_0x238321['id']]['updateRealtime']();}}return _0x19725a['smsQueues'];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1e')]=function(){var _0x117c07=this;return function(_0x234fe6){if(_0x234fe6){freeIsNotKey(_0x234fe6,_0x117c07[_0x43e7('0xc')],'id');for(var _0xde7ed=0x0,_0x485c6c={},_0x47baee={};_0xde7ed<_0x234fe6['length'];_0xde7ed+=0x1){_0x485c6c=_0x234fe6[_0xde7ed];if(_['isUndefined'](_0x117c07['mailQueues'][_0x485c6c['id']])){_0x117c07['mailQueues'][_0x485c6c['id']]=new MailQueue(_0x485c6c);}else{_0x117c07['mergeFromDatabase'](_0x117c07[_0x43e7('0xc')][_0x485c6c['id']],_0x485c6c);}_0x117c07['mailQueues'][_0x485c6c['id']][_0x43e7('0x1c')]();_0x117c07[_0x43e7('0xc')][_0x485c6c['id']][_0x43e7('0x1b')]();}}return _0x117c07[_0x43e7('0xc')];};};Realtime[_0x43e7('0x14')][_0x43e7('0x1f')]=function(){var _0x101d45=this;return function(_0x4f1a5f){if(_0x4f1a5f){freeIsNotKey(_0x4f1a5f,_0x101d45['faxQueues'],'id');for(var _0x5d84f4=0x0,_0xfa0474={},_0xfe70e9={};_0x5d84f4<_0x4f1a5f[_0x43e7('0x15')];_0x5d84f4+=0x1){_0xfa0474=_0x4f1a5f[_0x5d84f4];if(_[_0x43e7('0x16')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']])){_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]=new FaxQueue(_0xfa0474);}else{_0x101d45[_0x43e7('0x18')](_0x101d45[_0x43e7('0xd')][_0xfa0474['id']],_0xfa0474);}_0x101d45['faxQueues'][_0xfa0474['id']][_0x43e7('0x1c')]();_0x101d45[_0x43e7('0xd')][_0xfa0474['id']]['updateRealtime']();}}return _0x101d45[_0x43e7('0xd')];};};Realtime['prototype'][_0x43e7('0x20')]=function(){var _0x2ad008=this;return function(_0x1c6f45){if(_0x1c6f45){freeIsNotKey(_0x1c6f45,_0x2ad008[_0x43e7('0xe')],'id');for(var _0x35ac85=0x0,_0x234d8f={},_0x5e731b={};_0x35ac85<_0x1c6f45['length'];_0x35ac85+=0x1){_0x234d8f=_0x1c6f45[_0x35ac85];if(_[_0x43e7('0x16')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']])){_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]=new WhatsappQueue(_0x234d8f);}else{_0x2ad008[_0x43e7('0x18')](_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']],_0x234d8f);}_0x2ad008['whatsappQueues'][_0x234d8f['id']][_0x43e7('0x1c')]();_0x2ad008[_0x43e7('0xe')][_0x234d8f['id']]['updateRealtime']();}}return _0x2ad008[_0x43e7('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 457ecbe..5da56ee 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 _0x166b=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0xc1587a,_0x541929){var _0x23090f=function(_0x39b243){while(--_0x39b243){_0xc1587a['push'](_0xc1587a['shift']());}};_0x23090f(++_0x541929);}(_0x166b,0xd8));var _0xb166=function(_0x52e94f,_0x22e52d){_0x52e94f=_0x52e94f-0x0;var _0x127d43=_0x166b[_0x52e94f];return _0x127d43;};'use strict';var client=require(_0xb166('0x0'));exports[_0xb166('0x1')]=function(_0x379bef,_0x443017){return client[_0xb166('0x2')](_0xb166('0x3'),{'body':_0x443017,'options':{'where':{'id':_0x379bef}},'log':_0xb166('0x4')});};exports[_0xb166('0x5')]=function(_0xc27bf8,_0x3e8cde){return client[_0xb166('0x2')](_0xb166('0x6'),{'body':_0x3e8cde,'options':{'where':{'id':_0xc27bf8}},'log':_0xb166('0x7')});}; \ No newline at end of file +var _0x28ca=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x28ca,0xb3));var _0xa28c=function(_0x3233c6,_0x58f115){_0x3233c6=_0x3233c6-0x0;var _0x5525c1=_0x28ca[_0x3233c6];return _0x5525c1;};'use strict';var client=require(_0xa28c('0x0'));exports['update']=function(_0x1e7829,_0x225f57){return client[_0xa28c('0x1')](_0xa28c('0x2'),{'body':_0x225f57,'options':{'where':{'id':_0x1e7829}},'log':'updateChatInteraction'});};exports[_0xa28c('0x3')]=function(_0xcfbd5d,_0x3d9e5e){return client[_0xa28c('0x1')]('AddTagsToChatInteraction',{'body':_0x3d9e5e,'options':{'where':{'id':_0xcfbd5d}},'log':_0xa28c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3db6f14..e19e28b 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 _0x55f3=['CreateChatMessage','createChatMessage','Request'];(function(_0x3f2c48,_0x165228){var _0x228a20=function(_0x263316){while(--_0x263316){_0x3f2c48['push'](_0x3f2c48['shift']());}};_0x228a20(++_0x165228);}(_0x55f3,0x173));var _0x355f=function(_0x3e9db3,_0x15a907){_0x3e9db3=_0x3e9db3-0x0;var _0x561aff=_0x55f3[_0x3e9db3];return _0x561aff;};'use strict';var client=require('../client');exports['create']=function(_0x298401){return client[_0x355f('0x0')](_0x355f('0x1'),{'body':_0x298401,'log':_0x355f('0x2')});}; \ No newline at end of file +var _0xd9b1=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x54501d,_0x42e8a6){var _0x2b9b2c=function(_0x2828fa){while(--_0x2828fa){_0x54501d['push'](_0x54501d['shift']());}};_0x2b9b2c(++_0x42e8a6);}(_0xd9b1,0xac));var _0x1d9b=function(_0x383755,_0x1dfd5f){_0x383755=_0x383755-0x0;var _0x2b5d0b=_0xd9b1[_0x383755];return _0x2b5d0b;};'use strict';var client=require(_0x1d9b('0x0'));exports[_0x1d9b('0x1')]=function(_0xaa19a4){return client[_0x1d9b('0x2')](_0x1d9b('0x3'),{'body':_0xaa19a4,'log':_0x1d9b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a086b5b..723f4f7 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 _0x2d9f=['getChatQueues','name','timeout','User','chatPause','../client'];(function(_0x2ece52,_0x538ee5){var _0x585ea8=function(_0x528662){while(--_0x528662){_0x2ece52['push'](_0x2ece52['shift']());}};_0x585ea8(++_0x538ee5);}(_0x2d9f,0xa7));var _0xf2d9=function(_0x229f58,_0x2fc35a){_0x229f58=_0x229f58-0x0;var _0xb7e54a=_0x2d9f[_0x229f58];return _0xb7e54a;};'use strict';var client=require(_0xf2d9('0x0'));exports[_0xf2d9('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xf2d9('0x2'),_0xf2d9('0x3'),'strategy'],'include':[{'model':_0xf2d9('0x4'),'as':'Agents','attributes':['id',_0xf2d9('0x2'),'online',_0xf2d9('0x5')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x7b91=['timeout','strategy','User','Agents','name','online','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x5d3c99,_0x3d3fb3){var _0x3d0bd0=function(_0x3ce901){while(--_0x3ce901){_0x5d3c99['push'](_0x5d3c99['shift']());}};_0x3d0bd0(++_0x3d3fb3);}(_0x7b91,0xcf));var _0x17b9=function(_0x3085a2,_0x52037b){_0x3085a2=_0x3085a2-0x0;var _0x3a32d2=_0x7b91[_0x3085a2];return _0x3a32d2;};'use strict';var client=require('../client');exports[_0x17b9('0x0')]=function(){return function(){return client[_0x17b9('0x1')](_0x17b9('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x17b9('0x3'),_0x17b9('0x4')],'include':[{'model':_0x17b9('0x5'),'as':_0x17b9('0x6'),'attributes':['id',_0x17b9('0x7'),_0x17b9('0x8'),_0x17b9('0x9')]}]},'log':_0x17b9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b0329f7..ac2180a 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 _0xb31a=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0xb31a,0xd4));var _0xab31=function(_0x1dab82,_0x8ce375){_0x1dab82=_0x1dab82-0x0;var _0x25fea8=_0xb31a[_0x1dab82];return _0x25fea8;};'use strict';var client=require(_0xab31('0x0'));exports[_0xab31('0x1')]=function(_0x16a117){return client[_0xab31('0x2')](_0xab31('0x3'),{'body':_0x16a117,'log':_0xab31('0x3')});};exports[_0xab31('0x4')]=function(_0x20b002,_0x2addad){return client[_0xab31('0x2')](_0xab31('0x5'),{'body':_0x2addad,'options':{'where':{'uniqueid':_0x20b002},'order':[['id',_0xab31('0x6')]],'limit':0x1},'log':_0xab31('0x5')});}; \ No newline at end of file +var _0x257e=['DESC','UpdateChatQueueReport','create','CreateChatQueueReport','update','Request'];(function(_0x4e128a,_0x3ad506){var _0x3829f6=function(_0x3cc48d){while(--_0x3cc48d){_0x4e128a['push'](_0x4e128a['shift']());}};_0x3829f6(++_0x3ad506);}(_0x257e,0x1dc));var _0xe257=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x257e[_0x55821d];return _0x58ea8a;};'use strict';var client=require('../client');exports[_0xe257('0x0')]=function(_0x26d509){return client['Request'](_0xe257('0x1'),{'body':_0x26d509,'log':'CreateChatQueueReport'});};exports[_0xe257('0x2')]=function(_0x1f83e8,_0x276d7a){return client[_0xe257('0x3')]('UpdateChatQueueReport',{'body':_0x276d7a,'options':{'where':{'uniqueid':_0x1f83e8},'order':[['id',_0xe257('0x4')]],'limit':0x1},'log':_0xe257('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7d170db..78eed8b 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 _0x39e3=['addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0x29f31c,_0x46bbdf){var _0x3b6b8a=function(_0x557471){while(--_0x557471){_0x29f31c['push'](_0x29f31c['shift']());}};_0x3b6b8a(++_0x46bbdf);}(_0x39e3,0x1ae));var _0x339e=function(_0x1cde69,_0x5dab52){_0x1cde69=_0x1cde69-0x0;var _0x9d21c9=_0x39e3[_0x1cde69];return _0x9d21c9;};'use strict';var client=require(_0x339e('0x0'));exports['update']=function(_0x2c1e65,_0x346a3e){return client[_0x339e('0x1')](_0x339e('0x2'),{'body':_0x346a3e,'options':{'where':{'id':_0x2c1e65}},'log':_0x339e('0x3')});};exports[_0x339e('0x4')]=function(_0xe6f433,_0x3a647e){return client[_0x339e('0x1')](_0x339e('0x5'),{'body':_0x3a647e,'options':{'where':{'id':_0xe6f433}},'log':_0x339e('0x6')});}; \ No newline at end of file +var _0x8fb3=['updateFaxInteraction','Request','../client','update','UpdateFaxInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fb3,0xde));var _0x38fb=function(_0x9dab75,_0x5427dc){_0x9dab75=_0x9dab75-0x0;var _0x142f7d=_0x8fb3[_0x9dab75];return _0x142f7d;};'use strict';var client=require(_0x38fb('0x0'));exports[_0x38fb('0x1')]=function(_0x33dd6a,_0x148179){return client['Request'](_0x38fb('0x2'),{'body':_0x148179,'options':{'where':{'id':_0x33dd6a}},'log':_0x38fb('0x3')});};exports['addTags']=function(_0x1d6701,_0x2291c5){return client[_0x38fb('0x4')]('AddTagsToFaxInteraction',{'body':_0x2291c5,'options':{'where':{'id':_0x1d6701}},'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 3a1b5c7..5bd6252 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 _0x2f5e=['create','Request','createFaxMessage','../client'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x2f5e,0xa3));var _0xe2f5=function(_0x100c9c,_0x2183f3){_0x100c9c=_0x100c9c-0x0;var _0x566727=_0x2f5e[_0x100c9c];return _0x566727;};'use strict';var client=require(_0xe2f5('0x0'));exports[_0xe2f5('0x1')]=function(_0x3fb542){return client[_0xe2f5('0x2')]('CreateFaxMessage',{'body':_0x3fb542,'log':_0xe2f5('0x3')});}; \ No newline at end of file +var _0x91c2=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x4a4e92,_0x24d0c4){var _0x4e0956=function(_0x1b61be){while(--_0x1b61be){_0x4a4e92['push'](_0x4a4e92['shift']());}};_0x4e0956(++_0x24d0c4);}(_0x91c2,0xc4));var _0x291c=function(_0x1314dd,_0x37d740){_0x1314dd=_0x1314dd-0x0;var _0x5becb6=_0x91c2[_0x1314dd];return _0x5becb6;};'use strict';var client=require(_0x291c('0x0'));exports[_0x291c('0x1')]=function(_0x3ad95b){return client[_0x291c('0x2')](_0x291c('0x3'),{'body':_0x3ad95b,'log':_0x291c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3a513bb..edfc065 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 _0xeddb=['User','Agents','faxPause','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x297a0e,_0x15744f){var _0xdb00f=function(_0x5efa9a){while(--_0x5efa9a){_0x297a0e['push'](_0x297a0e['shift']());}};_0xdb00f(++_0x15744f);}(_0xeddb,0x1c4));var _0xbedd=function(_0x56c5c0,_0x2901e6){_0x56c5c0=_0x56c5c0-0x0;var _0x3610b8=_0xeddb[_0x56c5c0];return _0x3610b8;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xbedd('0x0')](_0xbedd('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xbedd('0x2'),'strategy'],'include':[{'model':_0xbedd('0x3'),'as':_0xbedd('0x4'),'attributes':['id','name','online',_0xbedd('0x5')]}]},'log':_0xbedd('0x6')});};}; \ No newline at end of file +var _0xb1af=['User','Agents','name','online','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy'];(function(_0x398c77,_0x1f98c9){var _0xd3b1b0=function(_0x28e9df){while(--_0x28e9df){_0x398c77['push'](_0x398c77['shift']());}};_0xd3b1b0(++_0x1f98c9);}(_0xb1af,0x1bc));var _0xfb1a=function(_0x93d258,_0x3b96fa){_0x93d258=_0x93d258-0x0;var _0x32c4ad=_0xb1af[_0x93d258];return _0x32c4ad;};'use strict';var client=require(_0xfb1a('0x0'));exports[_0xfb1a('0x1')]=function(){return function(){return client[_0xfb1a('0x2')](_0xfb1a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xfb1a('0x4'),_0xfb1a('0x5')],'include':[{'model':_0xfb1a('0x6'),'as':_0xfb1a('0x7'),'attributes':['id',_0xfb1a('0x8'),_0xfb1a('0x9'),'faxPause']}]},'log':_0xfb1a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4aca8df..6068337 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 _0x3ddc=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x5e6fde,_0x4c6ab7){var _0x5e7118=function(_0x349658){while(--_0x349658){_0x5e6fde['push'](_0x5e6fde['shift']());}};_0x5e7118(++_0x4c6ab7);}(_0x3ddc,0x196));var _0xc3dd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3ddc[_0x138adb];return _0x1b27f2;};'use strict';var client=require(_0xc3dd('0x0'));exports['create']=function(_0x4d87b4){return client[_0xc3dd('0x1')](_0xc3dd('0x2'),{'body':_0x4d87b4,'log':'CreateFaxQueueReport'});};exports[_0xc3dd('0x3')]=function(_0x3d5d82,_0x3159b9){return client[_0xc3dd('0x1')](_0xc3dd('0x4'),{'body':_0x3159b9,'options':{'where':{'uniqueid':_0x3d5d82},'order':[['id',_0xc3dd('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x8ef0=['update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0xf35672,_0x3833af){var _0x26afcf=function(_0x17132a){while(--_0x17132a){_0xf35672['push'](_0xf35672['shift']());}};_0x26afcf(++_0x3833af);}(_0x8ef0,0xa5));var _0x08ef=function(_0x150a87,_0x44b0fb){_0x150a87=_0x150a87-0x0;var _0x3c1543=_0x8ef0[_0x150a87];return _0x3c1543;};'use strict';var client=require(_0x08ef('0x0'));exports[_0x08ef('0x1')]=function(_0x10558a){return client[_0x08ef('0x2')]('CreateFaxQueueReport',{'body':_0x10558a,'log':'CreateFaxQueueReport'});};exports[_0x08ef('0x3')]=function(_0x15c6f8,_0x1840e7){return client[_0x08ef('0x2')](_0x08ef('0x4'),{'body':_0x1840e7,'options':{'where':{'uniqueid':_0x15c6f8},'order':[['id',_0x08ef('0x5')]],'limit':0x1},'log':_0x08ef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 9cc244a..17bf075 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 _0x574d=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x574d,0xc0));var _0xd574=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x574d[_0x32f7d7];return _0x133d09;};'use strict';var client=require(_0xd574('0x0'));exports[_0xd574('0x1')]=function(){return function(){return client[_0xd574('0x2')](_0xd574('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd574('0x4')],'include':[{'model':_0xd574('0x5'),'as':_0xd574('0x6'),'attributes':['id','name',_0xd574('0x7')]}]},'log':_0xd574('0x1')});};}; \ No newline at end of file +var _0x01d3=['interval','../client','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x931a0a,_0x530537){var _0x39565c=function(_0x28f58c){while(--_0x28f58c){_0x931a0a['push'](_0x931a0a['shift']());}};_0x39565c(++_0x530537);}(_0x01d3,0xa2));var _0x301d=function(_0x3d42ba,_0x1b6cf4){_0x3d42ba=_0x3d42ba-0x0;var _0x35a185=_0x01d3[_0x3d42ba];return _0x35a185;};'use strict';var client=require(_0x301d('0x0'));exports[_0x301d('0x1')]=function(){return function(){return client[_0x301d('0x2')](_0x301d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x301d('0x4'),'as':_0x301d('0x5'),'attributes':['id','name',_0x301d('0x6')]}]},'log':_0x301d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d8723d1..7aa67de 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 _0xdbf9=['addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0xdbf9,0xfd));var _0x9dbf=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xdbf9[_0x24237f];return _0x48298e;};'use strict';var client=require('../client');exports[_0x9dbf('0x0')]=function(_0x1ea806,_0x4d0712){return client[_0x9dbf('0x1')](_0x9dbf('0x2'),{'body':_0x4d0712,'options':{'where':{'id':_0x1ea806}},'log':_0x9dbf('0x3')});};exports[_0x9dbf('0x4')]=function(_0x4d9d6e,_0x95a06e){return client['Request'](_0x9dbf('0x5'),{'body':_0x95a06e,'options':{'where':{'id':_0x4d9d6e}},'log':_0x9dbf('0x6')});}; \ No newline at end of file +var _0x94e8=['addTagsToChatInteraction','../client','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x4ac71d,_0x38e2be){var _0x203526=function(_0x5540a7){while(--_0x5540a7){_0x4ac71d['push'](_0x4ac71d['shift']());}};_0x203526(++_0x38e2be);}(_0x94e8,0x9c));var _0x894e=function(_0x40453a,_0x1ff061){_0x40453a=_0x40453a-0x0;var _0x2da74d=_0x94e8[_0x40453a];return _0x2da74d;};'use strict';var client=require(_0x894e('0x0'));exports['update']=function(_0x39f0cd,_0x393c62){return client['Request'](_0x894e('0x1'),{'body':_0x393c62,'options':{'where':{'id':_0x39f0cd}},'log':'updateMailInteraction'});};exports[_0x894e('0x2')]=function(_0x30b98f,_0x2cba69){return client['Request'](_0x894e('0x3'),{'body':_0x2cba69,'options':{'where':{'id':_0x30b98f}},'log':_0x894e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a3664ad..8496ffb 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 _0xcb2e=['createMailMessage','create','CreateMailMessage'];(function(_0xdbf14f,_0x4bfcc4){var _0x3e58a2=function(_0x389184){while(--_0x389184){_0xdbf14f['push'](_0xdbf14f['shift']());}};_0x3e58a2(++_0x4bfcc4);}(_0xcb2e,0x15d));var _0xecb2=function(_0xc6a0e0,_0x32dd4b){_0xc6a0e0=_0xc6a0e0-0x0;var _0x2cdfe9=_0xcb2e[_0xc6a0e0];return _0x2cdfe9;};'use strict';var client=require('../client');exports[_0xecb2('0x0')]=function(_0x59c1e7){return client['Request'](_0xecb2('0x1'),{'body':_0x59c1e7,'log':_0xecb2('0x2')});}; \ No newline at end of file +var _0x0ca7=['createMailMessage','../client','create','Request'];(function(_0x2097d,_0x251d39){var _0x3b69e9=function(_0x45fb94){while(--_0x45fb94){_0x2097d['push'](_0x2097d['shift']());}};_0x3b69e9(++_0x251d39);}(_0x0ca7,0x145));var _0x70ca=function(_0x11bdad,_0x1e1e51){_0x11bdad=_0x11bdad-0x0;var _0x577fdd=_0x0ca7[_0x11bdad];return _0x577fdd;};'use strict';var client=require(_0x70ca('0x0'));exports[_0x70ca('0x1')]=function(_0x50d25e){return client[_0x70ca('0x2')]('CreateMailMessage',{'body':_0x50d25e,'log':_0x70ca('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index befba7c..a2e14ae 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 _0x8930=['Agents','mailPause','getMailQueues','../client','GetMailQueue','name','timeout','strategy'];(function(_0x1f00f3,_0x53c98e){var _0x3da6f8=function(_0x2f46df){while(--_0x2f46df){_0x1f00f3['push'](_0x1f00f3['shift']());}};_0x3da6f8(++_0x53c98e);}(_0x8930,0x163));var _0x0893=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8930[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x0893('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x0893('0x1'),{'options':{'raw':![],'attributes':['id',_0x0893('0x2'),_0x0893('0x3'),_0x0893('0x4')],'include':[{'model':'User','as':_0x0893('0x5'),'attributes':['id',_0x0893('0x2'),'online',_0x0893('0x6')]}]},'log':_0x0893('0x7')});};}; \ No newline at end of file +var _0x3eab=['getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','online','../client'];(function(_0x54fbcb,_0x21a10f){var _0x58e047=function(_0x479960){while(--_0x479960){_0x54fbcb['push'](_0x54fbcb['shift']());}};_0x58e047(++_0x21a10f);}(_0x3eab,0xbc));var _0xb3ea=function(_0x4bba19,_0x55bf6d){_0x4bba19=_0x4bba19-0x0;var _0x2b333f=_0x3eab[_0x4bba19];return _0x2b333f;};'use strict';var client=require(_0xb3ea('0x0'));exports[_0xb3ea('0x1')]=function(){return function(){return client[_0xb3ea('0x2')](_0xb3ea('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb3ea('0x4'),_0xb3ea('0x5')],'include':[{'model':_0xb3ea('0x6'),'as':_0xb3ea('0x7'),'attributes':['id','name',_0xb3ea('0x8'),'mailPause']}]},'log':_0xb3ea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6d1f587..2ec751a 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 _0x800f=['Request','update','DESC','../client'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x800f,0x14b));var _0xf800=function(_0x22bff6,_0xbe3f3f){_0x22bff6=_0x22bff6-0x0;var _0x353367=_0x800f[_0x22bff6];return _0x353367;};'use strict';var client=require(_0xf800('0x0'));exports['create']=function(_0x23a083){return client[_0xf800('0x1')]('CreateMailQueueReport',{'body':_0x23a083,'log':'CreateMailQueueReport'});};exports[_0xf800('0x2')]=function(_0x239878,_0x37897f){return client[_0xf800('0x1')]('UpdateMailQueueReport',{'body':_0x37897f,'options':{'where':{'uniqueid':_0x239878},'order':[['id',_0xf800('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xbafb=['update','Request','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x3e3cf4,_0x584853){var _0xbad542=function(_0x29bf49){while(--_0x29bf49){_0x3e3cf4['push'](_0x3e3cf4['shift']());}};_0xbad542(++_0x584853);}(_0xbafb,0x14d));var _0xbbaf=function(_0x369567,_0xb52279){_0x369567=_0x369567-0x0;var _0x14111c=_0xbafb[_0x369567];return _0x14111c;};'use strict';var client=require(_0xbbaf('0x0'));exports[_0xbbaf('0x1')]=function(_0x57e6cb){return client['Request']('CreateMailQueueReport',{'body':_0x57e6cb,'log':_0xbbaf('0x2')});};exports[_0xbbaf('0x3')]=function(_0x65182,_0x52a119){return client[_0xbbaf('0x4')](_0xbbaf('0x5'),{'body':_0x52a119,'options':{'where':{'uniqueid':_0x65182},'order':[['id','DESC']],'limit':0x1},'log':_0xbbaf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5cdbac7..e8098cb 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 _0x38ff=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x4bd7e7,_0x20916d){var _0x139a12=function(_0x246caf){while(--_0x246caf){_0x4bd7e7['push'](_0x4bd7e7['shift']());}};_0x139a12(++_0x20916d);}(_0x38ff,0x7e));var _0xf38f=function(_0x1649af,_0x9522f8){_0x1649af=_0x1649af-0x0;var _0x28359a=_0x38ff[_0x1649af];return _0x28359a;};'use strict';var client=require('../client');exports['update']=function(_0x21e726,_0x2379a2){return client[_0xf38f('0x0')](_0xf38f('0x1'),{'body':_0x2379a2,'options':{'where':{'id':_0x21e726}},'log':_0xf38f('0x2')});};exports[_0xf38f('0x3')]=function(_0x502a2f,_0xafad61){return client[_0xf38f('0x0')](_0xf38f('0x4'),{'body':_0xafad61,'options':{'where':{'id':_0x502a2f}},'log':_0xf38f('0x5')});}; \ No newline at end of file +var _0xffde=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','../client','Request'];(function(_0x591a19,_0x246554){var _0x2f6a5d=function(_0x4d78ef){while(--_0x4d78ef){_0x591a19['push'](_0x591a19['shift']());}};_0x2f6a5d(++_0x246554);}(_0xffde,0x152));var _0xeffd=function(_0x2d875b,_0x2e2a84){_0x2d875b=_0x2d875b-0x0;var _0x154413=_0xffde[_0x2d875b];return _0x154413;};'use strict';var client=require(_0xeffd('0x0'));exports['update']=function(_0x3fc324,_0x2a1724){return client[_0xeffd('0x1')](_0xeffd('0x2'),{'body':_0x2a1724,'options':{'where':{'id':_0x3fc324}},'log':_0xeffd('0x3')});};exports['addTags']=function(_0x1195a7,_0x1a214e){return client['Request'](_0xeffd('0x4'),{'body':_0x1a214e,'options':{'where':{'id':_0x1195a7}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 14d9062..3c1eb58 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 _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x9ca874,_0x773a41){var _0x105833=function(_0x45cca3){while(--_0x45cca3){_0x9ca874['push'](_0x9ca874['shift']());}};_0x105833(++_0x773a41);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xcb91[_0x254d9f];return _0x1eedb9;};'use strict';var client=require('../client');exports['create']=function(_0x26fe42){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'body':_0x26fe42,'log':_0x1cb9('0x2')});}; \ No newline at end of file +var _0x5b02=['create','Request','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x3099e0,_0x57a0d5){_0x3099e0=_0x3099e0-0x0;var _0x25d76a=_0x5b02[_0x3099e0];return _0x25d76a;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateOpenchannelMessage',{'body':_0x428458,'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 b1735fc..61acfa8 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 _0xd379=['Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x5cc518,_0x720554){var _0x1f4299=function(_0x343790){while(--_0x343790){_0x5cc518['push'](_0x5cc518['shift']());}};_0x1f4299(++_0x720554);}(_0xd379,0x1b0));var _0x9d37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd379[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x9d37('0x0')]=function(){return function(){return client[_0x9d37('0x1')](_0x9d37('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':'User','as':_0x9d37('0x3'),'attributes':['id','name',_0x9d37('0x4'),'openchannelPause']}]},'log':_0x9d37('0x0')});};}; \ No newline at end of file +var _0x3d0e=['Agents','online','Request','GetOpenchannelQueue','name','strategy','User'];(function(_0x307533,_0x5c25d2){var _0x1af1fc=function(_0x5bb82a){while(--_0x5bb82a){_0x307533['push'](_0x307533['shift']());}};_0x1af1fc(++_0x5c25d2);}(_0x3d0e,0x105));var _0xe3d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d0e[_0x501510];return _0x1e6ee5;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xe3d0('0x0')](_0xe3d0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe3d0('0x2'),'timeout',_0xe3d0('0x3')],'include':[{'model':_0xe3d0('0x4'),'as':_0xe3d0('0x5'),'attributes':['id',_0xe3d0('0x2'),_0xe3d0('0x6'),'openchannelPause']}]},'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 fd7d36e..8ee15f8 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 _0x26ca=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','Request'];(function(_0x181b4e,_0x4652a5){var _0x7f1832=function(_0x202601){while(--_0x202601){_0x181b4e['push'](_0x181b4e['shift']());}};_0x7f1832(++_0x4652a5);}(_0x26ca,0x111));var _0xa26c=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x26ca[_0x12a554];return _0x244ba0;};'use strict';var client=require(_0xa26c('0x0'));exports['create']=function(_0x13ed99){return client[_0xa26c('0x1')](_0xa26c('0x2'),{'body':_0x13ed99,'log':'CreateOpenchannelQueueReport'});};exports[_0xa26c('0x3')]=function(_0x3bb8e9,_0x34a018){return client[_0xa26c('0x1')](_0xa26c('0x4'),{'body':_0x34a018,'options':{'where':{'uniqueid':_0x3bb8e9},'order':[['id','DESC']],'limit':0x1},'log':_0xa26c('0x4')});}; \ No newline at end of file +var _0x1c5f=['DESC','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x2b8bd7,_0xa1b54d){var _0xf5b475=function(_0x268ce5){while(--_0x268ce5){_0x2b8bd7['push'](_0x2b8bd7['shift']());}};_0xf5b475(++_0xa1b54d);}(_0x1c5f,0x6a));var _0xf1c5=function(_0x1abdf3,_0x556e5e){_0x1abdf3=_0x1abdf3-0x0;var _0x86c10b=_0x1c5f[_0x1abdf3];return _0x86c10b;};'use strict';var client=require('../client');exports[_0xf1c5('0x0')]=function(_0x489ce6){return client[_0xf1c5('0x1')](_0xf1c5('0x2'),{'body':_0x489ce6,'log':_0xf1c5('0x2')});};exports['update']=function(_0x1991b5,_0x1bbf45){return client[_0xf1c5('0x1')](_0xf1c5('0x3'),{'body':_0x1bbf45,'options':{'where':{'uniqueid':_0x1991b5},'order':[['id',_0xf1c5('0x4')]],'limit':0x1},'log':_0xf1c5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 6a4b83e..88c39e1 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 _0xe0d6=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe0d6,0xa3));var _0x6e0d=function(_0x45952e,_0x2ae46d){_0x45952e=_0x45952e-0x0;var _0xc107d2=_0xe0d6[_0x45952e];return _0xc107d2;};'use strict';var client=require('../client');exports[_0x6e0d('0x0')]=function(_0x43623e,_0x10393f){return client[_0x6e0d('0x1')](_0x6e0d('0x2'),{'body':_0x10393f,'options':{'where':{'id':_0x43623e}},'log':_0x6e0d('0x3')});};exports[_0x6e0d('0x4')]=function(_0x42f489,_0x257356){return client['Request'](_0x6e0d('0x5'),{'body':_0x257356,'options':{'where':{'id':_0x42f489}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xbda9=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xbda9,0x146));var _0x9bda=function(_0x4e6938,_0xe1cef8){_0x4e6938=_0x4e6938-0x0;var _0x56c09b=_0xbda9[_0x4e6938];return _0x56c09b;};'use strict';var client=require(_0x9bda('0x0'));exports[_0x9bda('0x1')]=function(_0xa2f20d,_0x17f683){return client[_0x9bda('0x2')](_0x9bda('0x3'),{'body':_0x17f683,'options':{'where':{'id':_0xa2f20d}},'log':'updateSmsInteraction'});};exports[_0x9bda('0x4')]=function(_0x14e41a,_0x59ac61){return client[_0x9bda('0x2')](_0x9bda('0x5'),{'body':_0x59ac61,'options':{'where':{'id':_0x14e41a}},'log':_0x9bda('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3d9f9cf..aa3dfdd 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 _0xef69=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0xef69,0x1ea));var _0x9ef6=function(_0x2af026,_0x1c7509){_0x2af026=_0x2af026-0x0;var _0x274528=_0xef69[_0x2af026];return _0x274528;};'use strict';var client=require(_0x9ef6('0x0'));exports[_0x9ef6('0x1')]=function(_0x429bc6){return client[_0x9ef6('0x2')](_0x9ef6('0x3'),{'body':_0x429bc6,'log':_0x9ef6('0x4')});}; \ No newline at end of file +var _0x2c83=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x28edc8,_0x2d2749){var _0x3c24fc=function(_0x214d21){while(--_0x214d21){_0x28edc8['push'](_0x28edc8['shift']());}};_0x3c24fc(++_0x2d2749);}(_0x2c83,0x15a));var _0x32c8=function(_0x4c08cd,_0x4d8c70){_0x4c08cd=_0x4c08cd-0x0;var _0x987508=_0x2c83[_0x4c08cd];return _0x987508;};'use strict';var client=require(_0x32c8('0x0'));exports[_0x32c8('0x1')]=function(_0x502dac){return client['Request'](_0x32c8('0x2'),{'body':_0x502dac,'log':_0x32c8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 75dbcda..9ca0358 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 _0x8002=['getSmsQueues','../client','Request','name','User','Agents','online','smsPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8002,0xf9));var _0x2800=function(_0x2fb813,_0x5a675b){_0x2fb813=_0x2fb813-0x0;var _0x39b565=_0x8002[_0x2fb813];return _0x39b565;};'use strict';var client=require(_0x2800('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x2800('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x2800('0x2'),'timeout','strategy'],'include':[{'model':_0x2800('0x3'),'as':_0x2800('0x4'),'attributes':['id',_0x2800('0x2'),_0x2800('0x5'),_0x2800('0x6')]}]},'log':_0x2800('0x7')});};}; \ No newline at end of file +var _0xc1ec=['Agents','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x50ae21,_0x4cecaf){var _0x164e2a=function(_0x1b1836){while(--_0x1b1836){_0x50ae21['push'](_0x50ae21['shift']());}};_0x164e2a(++_0x4cecaf);}(_0xc1ec,0x13d));var _0xcc1e=function(_0x58a534,_0x8d58a9){_0x58a534=_0x58a534-0x0;var _0x23464e=_0xc1ec[_0x58a534];return _0x23464e;};'use strict';var client=require(_0xcc1e('0x0'));exports[_0xcc1e('0x1')]=function(){return function(){return client[_0xcc1e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xcc1e('0x3'),_0xcc1e('0x4'),_0xcc1e('0x5')],'include':[{'model':_0xcc1e('0x6'),'as':_0xcc1e('0x7'),'attributes':['id','name','online',_0xcc1e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 99d3271..f2e94c3 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 _0xe5fc=['../client','Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe5fc,0x109));var _0xce5f=function(_0x184944,_0x3aab96){_0x184944=_0x184944-0x0;var _0x2980e0=_0xe5fc[_0x184944];return _0x2980e0;};'use strict';var client=require(_0xce5f('0x0'));exports['create']=function(_0x46ceab){return client[_0xce5f('0x1')](_0xce5f('0x2'),{'body':_0x46ceab,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x4ccd82,_0x13da8d){return client['Request'](_0xce5f('0x3'),{'body':_0x13da8d,'options':{'where':{'uniqueid':_0x4ccd82},'order':[['id',_0xce5f('0x4')]],'limit':0x1},'log':_0xce5f('0x3')});}; \ No newline at end of file +var _0x814a=['UpdateSmsQueueReport','DESC','create','CreateSmsQueueReport','update'];(function(_0x52a5c2,_0x41d108){var _0x4f6b59=function(_0x1157ec){while(--_0x1157ec){_0x52a5c2['push'](_0x52a5c2['shift']());}};_0x4f6b59(++_0x41d108);}(_0x814a,0x8e));var _0xa814=function(_0x562da7,_0x1bcb39){_0x562da7=_0x562da7-0x0;var _0x8e81c1=_0x814a[_0x562da7];return _0x8e81c1;};'use strict';var client=require('../client');exports[_0xa814('0x0')]=function(_0x1e240e){return client['Request'](_0xa814('0x1'),{'body':_0x1e240e,'log':_0xa814('0x1')});};exports[_0xa814('0x2')]=function(_0x14c450,_0x4a02cd){return client['Request'](_0xa814('0x3'),{'body':_0x4a02cd,'options':{'where':{'uniqueid':_0x14c450},'order':[['id',_0xa814('0x4')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c422fd6..bb1afda 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 _0xc1e5=['chatCapacity','mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1e5,0x15a));var _0x5c1e=function(_0x4d8bdd,_0x471072){_0x4d8bdd=_0x4d8bdd-0x0;var _0x48677f=_0xc1e5[_0x4d8bdd];return _0x48677f;};'use strict';var client=require(_0x5c1e('0x0'));exports[_0x5c1e('0x1')]=function(){return function(){return client[_0x5c1e('0x2')](_0x5c1e('0x3'),{'options':{'raw':!![],'where':{'role':_0x5c1e('0x4')},'attributes':['id',_0x5c1e('0x5'),'online',_0x5c1e('0x6'),_0x5c1e('0x7'),_0x5c1e('0x8'),_0x5c1e('0x9'),_0x5c1e('0xa'),_0x5c1e('0xb'),_0x5c1e('0xc'),_0x5c1e('0xd'),'openchannelPause',_0x5c1e('0xe'),_0x5c1e('0xf'),'faxCapacity',_0x5c1e('0x10'),'whatsappCapacity',_0x5c1e('0x11')]},'log':_0x5c1e('0x1')});};}; \ No newline at end of file +var _0xe372=['agent','online','pauseType','voicePause','chatPause','faxPause','smsPause','whatsappPause','chatCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser'];(function(_0x3849f3,_0x5c26fd){var _0x57e2e4=function(_0x1702ce){while(--_0x1702ce){_0x3849f3['push'](_0x3849f3['shift']());}};_0x57e2e4(++_0x5c26fd);}(_0xe372,0x6c));var _0x2e37=function(_0x34501b,_0x264e47){_0x34501b=_0x34501b-0x0;var _0xdcbacd=_0xe372[_0x34501b];return _0xdcbacd;};'use strict';var client=require(_0x2e37('0x0'));exports[_0x2e37('0x1')]=function(){return function(){return client[_0x2e37('0x2')](_0x2e37('0x3'),{'options':{'raw':!![],'where':{'role':_0x2e37('0x4')},'attributes':['id','name',_0x2e37('0x5'),_0x2e37('0x6'),'lastPauseAt',_0x2e37('0x7'),_0x2e37('0x8'),'mailPause',_0x2e37('0x9'),_0x2e37('0xa'),_0x2e37('0xb'),'openchannelPause',_0x2e37('0xc'),'mailCapacity','faxCapacity',_0x2e37('0xd'),_0x2e37('0xe'),_0x2e37('0xf')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index d2ab42c..920b8e5 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 _0x43b1=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client'];(function(_0x849e8d,_0x21b681){var _0x53d15d=function(_0x5b0f51){while(--_0x5b0f51){_0x849e8d['push'](_0x849e8d['shift']());}};_0x53d15d(++_0x21b681);}(_0x43b1,0x7d));var _0x143b=function(_0x39bdac,_0x34fa1f){_0x39bdac=_0x39bdac-0x0;var _0x2d6f22=_0x43b1[_0x39bdac];return _0x2d6f22;};'use strict';var client=require(_0x143b('0x0'));exports[_0x143b('0x1')]=function(_0x426f2c,_0x4c0b11){return client[_0x143b('0x2')]('UpdateWhatsappInteraction',{'body':_0x4c0b11,'options':{'where':{'id':_0x426f2c}},'log':_0x143b('0x3')});};exports[_0x143b('0x4')]=function(_0x223e86,_0x1552bc){return client[_0x143b('0x2')](_0x143b('0x5'),{'body':_0x1552bc,'options':{'where':{'id':_0x223e86}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xeb79=['Request','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x1b5b7a,_0x2ae121){var _0x38b3c7=function(_0x20e378){while(--_0x20e378){_0x1b5b7a['push'](_0x1b5b7a['shift']());}};_0x38b3c7(++_0x2ae121);}(_0xeb79,0x87));var _0x9eb7=function(_0x2cf8ff,_0x42ecad){_0x2cf8ff=_0x2cf8ff-0x0;var _0x253448=_0xeb79[_0x2cf8ff];return _0x253448;};'use strict';var client=require('../client');exports['update']=function(_0x21baca,_0x58e9b8){return client[_0x9eb7('0x0')]('UpdateWhatsappInteraction',{'body':_0x58e9b8,'options':{'where':{'id':_0x21baca}},'log':_0x9eb7('0x1')});};exports['addTags']=function(_0x3ee5c6,_0x2987e1){return client[_0x9eb7('0x0')](_0x9eb7('0x2'),{'body':_0x2987e1,'options':{'where':{'id':_0x3ee5c6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5daab44..929e3aa 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 _0x5867=['create','CreateWhatsappMessage'];(function(_0xedbede,_0x954224){var _0x241b4c=function(_0x3610ae){while(--_0x3610ae){_0xedbede['push'](_0xedbede['shift']());}};_0x241b4c(++_0x954224);}(_0x5867,0xea));var _0x7586=function(_0x30a02e,_0x1338e8){_0x30a02e=_0x30a02e-0x0;var _0x36102a=_0x5867[_0x30a02e];return _0x36102a;};'use strict';var client=require('../client');exports[_0x7586('0x0')]=function(_0x80708d){return client['Request'](_0x7586('0x1'),{'body':_0x80708d,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x0ca9=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x113945,_0x102a24){var _0x5836c8=function(_0x5430a8){while(--_0x5430a8){_0x113945['push'](_0x113945['shift']());}};_0x5836c8(++_0x102a24);}(_0x0ca9,0x66));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x90ca('0x0'));exports['create']=function(_0x371357){return client[_0x90ca('0x1')](_0x90ca('0x2'),{'body':_0x371357,'log':_0x90ca('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 77f7631..67dcfc8 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 _0x9c00=['../client','getWhatsappQueues','name','timeout','User','Agents','online','whatsappPause'];(function(_0xef5f0f,_0x35b798){var _0xd3b8d=function(_0x18abe4){while(--_0x18abe4){_0xef5f0f['push'](_0xef5f0f['shift']());}};_0xd3b8d(++_0x35b798);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2f3173,_0x532c04){_0x2f3173=_0x2f3173-0x0;var _0x426e08=_0x9c00[_0x2f3173];return _0x426e08;};'use strict';var client=require(_0x09c0('0x0'));exports[_0x09c0('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x09c0('0x2'),_0x09c0('0x3'),'strategy'],'include':[{'model':_0x09c0('0x4'),'as':_0x09c0('0x5'),'attributes':['id',_0x09c0('0x2'),_0x09c0('0x6'),_0x09c0('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getWhatsappQueues'];(function(_0x351017,_0x25de6b){var _0x2860c5=function(_0x35a2e5){while(--_0x35a2e5){_0x351017['push'](_0x351017['shift']());}};_0x2860c5(++_0x25de6b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','whatsappPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5a17c96..2398002 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 _0x4ceb=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x3da84,_0x2376b5){var _0x53d294=function(_0x3abcb7){while(--_0x3abcb7){_0x3da84['push'](_0x3da84['shift']());}};_0x53d294(++_0x2376b5);}(_0x4ceb,0x107));var _0xb4ce=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x4ceb[_0x9df060];return _0x338dfe;};'use strict';var client=require(_0xb4ce('0x0'));exports[_0xb4ce('0x1')]=function(_0x25599c){return client[_0xb4ce('0x2')]('CreateWhatsappQueueReport',{'body':_0x25599c,'log':_0xb4ce('0x3')});};exports[_0xb4ce('0x4')]=function(_0x5dd65f,_0xb6ff2c){return client[_0xb4ce('0x2')](_0xb4ce('0x5'),{'body':_0xb6ff2c,'options':{'where':{'uniqueid':_0x5dd65f},'order':[['id',_0xb4ce('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xb512=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0xc4652a,_0x455b1e){var _0x3be54a=function(_0x4cb208){while(--_0x4cb208){_0xc4652a['push'](_0xc4652a['shift']());}};_0x3be54a(++_0x455b1e);}(_0xb512,0x13f));var _0x2b51=function(_0x2f930d,_0x9b4f88){_0x2f930d=_0x2f930d-0x0;var _0x556265=_0xb512[_0x2f930d];return _0x556265;};'use strict';var client=require(_0x2b51('0x0'));exports[_0x2b51('0x1')]=function(_0x4897a0){return client[_0x2b51('0x2')](_0x2b51('0x3'),{'body':_0x4897a0,'log':_0x2b51('0x3')});};exports[_0x2b51('0x4')]=function(_0x4d6c22,_0x1c044d){return client[_0x2b51('0x2')](_0x2b51('0x5'),{'body':_0x1c044d,'options':{'where':{'uniqueid':_0x4d6c22},'order':[['id',_0x2b51('0x6')]],'limit':0x1},'log':_0x2b51('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 8b832ae..1131223 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 _0x8da2=['join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','close','complete','info','agent','error','stack','lodash','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','validate','length','[%s][AGENT]\x20%s','map','message'];(function(_0x31b1f8,_0x35fae6){var _0x42fc66=function(_0x46ff1){while(--_0x46ff1){_0x31b1f8['push'](_0x31b1f8['shift']());}};_0x42fc66(++_0x35fae6);}(_0x8da2,0x1bd));var _0x28da=function(_0x1e6866,_0x3a790c){_0x1e6866=_0x1e6866-0x0;var _0x407d18=_0x8da2[_0x1e6866];return _0x407d18;};'use strict';var schema=require('validate');var _=require(_0x28da('0x0'));var util=require(_0x28da('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x28da('0x2'))(_0x28da('0x3'));var strategy=require(_0x28da('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x28da('0x5')},'timeout':{'type':_0x28da('0x6'),'message':_0x28da('0x7')}});function writeLog(_0x3c31ae,_0x34d972,_0x3181b2){return logger['info'](util[_0x28da('0x8')](_0x28da('0x9'),_0x3c31ae,_0x34d972[_0x28da('0xa')],_0x3181b2));}function handleFindAgent(_0x5114cc){return function(_0x3e7007){return _0x3e7007[_0x28da('0xa')]['toLowerCase']()===_0x5114cc['toLowerCase']();};}exports[_0x28da('0xb')]=function(_0x218882,_0x156d4f,_0x2f96c2,_0x3f806e){return function(_0x2eb1cf){try{var _0x511c4e={'name':_0x156d4f[0x0],'timeout':_0x156d4f[0x1]};var _0x3ddc3f=queue[_0x28da('0xc')](_0x511c4e,{'typecast':!![]});if(_0x3ddc3f[_0x28da('0xd')]){logger['error'](_0x28da('0xe'),_0x218882,_[_0x28da('0xf')](_0x3ddc3f,_0x28da('0x10'))[_0x28da('0x11')](',\x20'));_0x2eb1cf[_0x28da('0x12')]();}else{var _0x1df2de=_[_0x28da('0x13')](_0x2f96c2[_0x28da('0x14')],handleFindAgent(_0x511c4e[_0x28da('0xa')]));if(_0x1df2de){var _0x3d9354=(_0x511c4e[_0x28da('0x15')]||0xa)*0x3e8;var _0x67bc1c,_0x5e23ef;var _0x103fd5=seqqueue[_0x28da('0x16')](_0x3d9354);_0x103fd5['id']=_0x218882;_0x103fd5['atimeout']=_0x3d9354;_0x103fd5[_0x28da('0x17')]=_0x3f806e[_0x28da('0x17')];writeLog(_0x218882,_0x1df2de,util[_0x28da('0x8')](_0x28da('0x18'),_0x3d9354));_0x2f96c2[_0x28da('0x19')][_0x218882]['on'](_0x28da('0x1a'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x218882);clearTimeout(_0x5e23ef);_0x5e23ef=undefined;_0x103fd5[_0x28da('0x1b')]();if(_0x2f96c2['rules'][_0x218882]){delete _0x2f96c2[_0x28da('0x19')][_0x218882];}_0x2eb1cf[_0x28da('0x12')]();});_0x2f96c2[_0x28da('0x19')][_0x218882]['on'](_0x28da('0x1c'),function(){if(_0x2f96c2['rules'][_0x218882]){delete _0x2f96c2[_0x28da('0x19')][_0x218882];}});_0x5e23ef=setTimeout(function(){logger[_0x28da('0x1d')]('[%s][AGENT]\x20ROUTING\x20END',_0x218882);clearTimeout(_0x5e23ef);_0x103fd5[_0x28da('0x1b')]();_0x2eb1cf['next']();},_0x3d9354);strategy[_0x28da('0x1e')](_0x103fd5,_0x1df2de,_0x2f96c2,_0x3f806e);}else{logger[_0x28da('0x1f')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x218882,_0x511c4e[_0x28da('0xa')]);_0x2eb1cf[_0x28da('0x12')]();}}}catch(_0x44eaa8){console['log'](_0x44eaa8);logger[_0x28da('0x1f')]('[%s][QUEUE]\x20%s',_0x218882,_0x44eaa8[_0x28da('0x20')]);_0x2eb1cf['stop']();}};}; \ No newline at end of file +var _0x0ca6=['stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','validate','length','error','message','stop','agents','createQueue','channel','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s'];(function(_0x4ee1e6,_0x2d595c){var _0x3aefc8=function(_0x574226){while(--_0x574226){_0x4ee1e6['push'](_0x4ee1e6['shift']());}};_0x3aefc8(++_0x2d595c);}(_0x0ca6,0xc1));var _0x60ca=function(_0x58bfd1,_0x4e48ec){_0x58bfd1=_0x58bfd1-0x0;var _0x547f9a=_0x0ca6[_0x58bfd1];return _0x547f9a;};'use strict';var schema=require('validate');var _=require(_0x60ca('0x0'));var util=require(_0x60ca('0x1'));var seqqueue=require(_0x60ca('0x2'));var logger=require(_0x60ca('0x3'))(_0x60ca('0x4'));var strategy=require(_0x60ca('0x5'));var queue=schema({'name':{'type':_0x60ca('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x60ca('0x7'),'message':_0x60ca('0x8')}});function writeLog(_0x483b0f,_0x51275f,_0x24816d){return logger[_0x60ca('0x9')](util[_0x60ca('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x483b0f,_0x51275f[_0x60ca('0xb')],_0x24816d));}function handleFindAgent(_0x38bd0e){return function(_0xbf5df6){return _0xbf5df6[_0x60ca('0xb')][_0x60ca('0xc')]()===_0x38bd0e[_0x60ca('0xc')]();};}exports['consequence']=function(_0x506181,_0x4e0cf8,_0x225c5a,_0x540f88){return function(_0x315a27){try{var _0x379e0d={'name':_0x4e0cf8[0x0],'timeout':_0x4e0cf8[0x1]};var _0x22ae3a=queue[_0x60ca('0xd')](_0x379e0d,{'typecast':!![]});if(_0x22ae3a[_0x60ca('0xe')]){logger[_0x60ca('0xf')]('[%s][AGENT]\x20%s',_0x506181,_['map'](_0x22ae3a,_0x60ca('0x10'))['join'](',\x20'));_0x315a27[_0x60ca('0x11')]();}else{var _0x4752a9=_['find'](_0x225c5a[_0x60ca('0x12')],handleFindAgent(_0x379e0d[_0x60ca('0xb')]));if(_0x4752a9){var _0x422bc7=(_0x379e0d['timeout']||0xa)*0x3e8;var _0x5682cc,_0x3ac3a1;var _0x1ccad4=seqqueue[_0x60ca('0x13')](_0x422bc7);_0x1ccad4['id']=_0x506181;_0x1ccad4['atimeout']=_0x422bc7;_0x1ccad4[_0x60ca('0x14')]=_0x540f88['channel'];writeLog(_0x506181,_0x4752a9,util[_0x60ca('0xa')]('START:%s',_0x422bc7));_0x225c5a['rules'][_0x506181]['on'](_0x60ca('0x15'),function(){logger[_0x60ca('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x506181);clearTimeout(_0x3ac3a1);_0x3ac3a1=undefined;_0x1ccad4[_0x60ca('0x16')]();if(_0x225c5a[_0x60ca('0x17')][_0x506181]){delete _0x225c5a[_0x60ca('0x17')][_0x506181];}_0x315a27['stop']();});_0x225c5a[_0x60ca('0x17')][_0x506181]['on'](_0x60ca('0x18'),function(){if(_0x225c5a['rules'][_0x506181]){delete _0x225c5a[_0x60ca('0x17')][_0x506181];}});_0x3ac3a1=setTimeout(function(){logger[_0x60ca('0x9')](_0x60ca('0x19'),_0x506181);clearTimeout(_0x3ac3a1);_0x1ccad4[_0x60ca('0x16')]();_0x315a27[_0x60ca('0x1a')]();},_0x422bc7);strategy[_0x60ca('0x1b')](_0x1ccad4,_0x4752a9,_0x225c5a,_0x540f88);}else{logger[_0x60ca('0xf')](_0x60ca('0x1c'),_0x506181,_0x379e0d['name']);_0x315a27[_0x60ca('0x11')]();}}}catch(_0x35226a){console[_0x60ca('0x1d')](_0x35226a);logger[_0x60ca('0xf')](_0x60ca('0x1e'),_0x506181,_0x35226a[_0x60ca('0x1f')]);_0x315a27['stop']();}};}; \ 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 519e564..3c38098 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 _0x0295=['Message','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','dialogState','lodash','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','interaction','created','isEmpty','body','getMustacheRender'];(function(_0x274208,_0x3182ff){var _0x209164=function(_0x316e02){while(--_0x316e02){_0x274208['push'](_0x274208['shift']());}};_0x209164(++_0x3182ff);}(_0x0295,0x1f0));var _0x5029=function(_0x54e631,_0x3b8396){_0x54e631=_0x54e631-0x0;var _0x3c6b6a=_0x0295[_0x54e631];return _0x3c6b6a;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x5029('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x5029('0x2')),'openchannelMessage':require(_0x5029('0x3')),'mailMessage':require(_0x5029('0x4')),'smsMessage':require(_0x5029('0x5')),'faxMessage':require(_0x5029('0x6')),'whatsappMessage':require(_0x5029('0x7'))};exports[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return function(_0x502a62){try{if(!_['isNil'](this['interaction'][_0x5029('0x9')])){logger['info'](_0x5029('0xa'),_0x215955,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x502a62[_0x5029('0xb')]();}var _0x520bc3={'ContactId':this[_0x5029('0xc')]['id'],'sentAt':moment()[_0x5029('0xd')](_0x5029('0xe')),'direction':'out'};var _0x3f4c48=this[_0x5029('0xf')];if(_0x3f4c48===_0x5029('0x10')){_0x520bc3['ChatWebsiteId']=this[_0x5029('0x11')]['id'];}else{_0x520bc3[_[_0x5029('0x12')](_0x3f4c48)+'AccountId']=this['account']['id'];}_0x520bc3[_['upperFirst'](_0x3f4c48)+'InteractionId']=this[_0x5029('0x13')]['id'];if(this[_0x5029('0x13')][_0x5029('0x14')]){var _0x434630=_0x5b3cd[0x4];if(!_[_0x5029('0x15')](_0x434630)){_0x520bc3[_0x5029('0x16')]=utils[_0x5029('0x17')](_0x434630,this);return rpc[_0x3f4c48+_0x5029('0x18')][_0x5029('0x19')](_0x520bc3)[_0x5029('0x1a')](function(_0x457c73){logger[_0x5029('0x1b')](_0x5029('0xa'),_0x215955,_0x520bc3[_0x5029('0x16')]);})[_0x5029('0x1c')](function(_0x4f7ab4){logger[_0x5029('0x1d')](_0x5029('0xa'),_0x215955,JSON[_0x5029('0x1e')](_0x4f7ab4));})[_0x5029('0x1f')](function(){logger[_0x5029('0x1b')](_0x5029('0x20'),_0x215955);_0x502a62[_0x5029('0x21')]();});}else{logger['info'](_0x5029('0x22'),_0x215955);_0x502a62['stop']();}}else{var _0x16485c=this;var _0x8a414c=new AWS[(_0x5029('0x23'))]({'accessKeyId':_0x5b3cd[0x0],'secretAccessKey':_0x5b3cd[0x1],'region':_0x5b3cd[0x2]});var _0x3cf0fb={'botAlias':'$LATEST','botName':_0x5b3cd[0x3],'inputText':this['message'][_0x5029('0x16')],'userId':this['channel']+':'+this[_0x5029('0x13')]['id'][_0x5029('0x24')]()};_0x8a414c[_0x5029('0x25')](_0x3cf0fb,function(_0x2bbbcb,_0x16bd22){if(_0x2bbbcb){logger[_0x5029('0x1d')](_0x5029('0xa'),_0x215955,_0x2bbbcb[_0x5029('0x26')]);_0x502a62[_0x5029('0xb')]();}else if(_0x16bd22&&_0x16bd22['message']){_0x16485c['body']['amazonlex']=_0x16bd22;_0x520bc3[_0x5029('0x16')]=_0x16bd22[_0x5029('0x26')];return rpc[_0x3f4c48+'Message']['create'](_0x520bc3)[_0x5029('0x1a')](function(_0x1e7e61){logger[_0x5029('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x215955,_0x520bc3[_0x5029('0x16')]);if(_0x16bd22[_0x5029('0x27')]=='Failed'){_0x502a62[_0x5029('0xb')]();}else{_0x502a62[_0x5029('0x21')]();}})[_0x5029('0x1c')](function(_0x4a24b9){logger[_0x5029('0x1d')](_0x5029('0xa'),_0x215955,JSON[_0x5029('0x1e')](_0x4a24b9));_0x502a62['next']();});}else{_0x502a62[_0x5029('0xb')]();}});}}catch(_0x2bb398){logger['error'](_0x5029('0xa'),_0x215955,JSON[_0x5029('0x1e')](_0x2bb398));_0x502a62[_0x5029('0x21')]();}};}; \ No newline at end of file +var _0xda19=['../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','body','catch','error','info','[%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','next','amazonlex','dialogState','Failed','stringify','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x283e63,_0x5f0ce1){var _0xfdfda6=function(_0x1f1deb){while(--_0x1f1deb){_0x283e63['push'](_0x283e63['shift']());}};_0xfdfda6(++_0x5f0ce1);}(_0xda19,0xd5));var _0x9da1=function(_0x3e0059,_0x76858){_0x3e0059=_0x3e0059-0x0;var _0xe58ad=_0xda19[_0x3e0059];return _0xe58ad;};'use strict';var _=require('lodash');var moment=require(_0x9da1('0x0'));var AWS=require(_0x9da1('0x1'));var utils=require('./utils');var logger=require(_0x9da1('0x2'))('routing');var rpc={'chatMessage':require(_0x9da1('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9da1('0x4')),'smsMessage':require(_0x9da1('0x5')),'faxMessage':require(_0x9da1('0x6')),'whatsappMessage':require(_0x9da1('0x7'))};exports[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return function(_0x2c3cdd){try{if(!_[_0x9da1('0x9')](this[_0x9da1('0xa')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2dcbc6,_0x9da1('0xb'));return _0x2c3cdd['next']();}var _0x33cfe5={'ContactId':this[_0x9da1('0xc')]['id'],'sentAt':moment()[_0x9da1('0xd')](_0x9da1('0xe')),'direction':_0x9da1('0xf')};var _0x396e23=this[_0x9da1('0x10')];if(_0x396e23==='chat'){_0x33cfe5['ChatWebsiteId']=this[_0x9da1('0x11')]['id'];}else{_0x33cfe5[_['upperFirst'](_0x396e23)+_0x9da1('0x12')]=this[_0x9da1('0x11')]['id'];}_0x33cfe5[_[_0x9da1('0x13')](_0x396e23)+_0x9da1('0x14')]=this['interaction']['id'];if(this[_0x9da1('0xa')]['created']){var _0x4d17e1=_0x23e4f7[0x4];if(!_[_0x9da1('0x15')](_0x4d17e1)){_0x33cfe5['body']=utils[_0x9da1('0x16')](_0x4d17e1,this);return rpc[_0x396e23+_0x9da1('0x17')][_0x9da1('0x18')](_0x33cfe5)[_0x9da1('0x19')](function(_0x7f1a64){logger['info'](_0x9da1('0x1a'),_0x2dcbc6,_0x33cfe5[_0x9da1('0x1b')]);})[_0x9da1('0x1c')](function(_0x77347a){logger[_0x9da1('0x1d')](_0x9da1('0x1a'),_0x2dcbc6,JSON['stringify'](_0x77347a));})['finally'](function(){logger[_0x9da1('0x1e')](_0x9da1('0x1f'),_0x2dcbc6);_0x2c3cdd[_0x9da1('0x20')]();});}else{logger[_0x9da1('0x1e')](_0x9da1('0x21'),_0x2dcbc6);_0x2c3cdd[_0x9da1('0x20')]();}}else{var _0xe56279=this;var _0x47e5cf=new AWS[(_0x9da1('0x22'))]({'accessKeyId':_0x23e4f7[0x0],'secretAccessKey':_0x23e4f7[0x1],'region':_0x23e4f7[0x2]});var _0x554845={'botAlias':_0x9da1('0x23'),'botName':_0x23e4f7[0x3],'inputText':this[_0x9da1('0x24')][_0x9da1('0x1b')],'userId':this['channel']+':'+this['interaction']['id'][_0x9da1('0x25')]()};_0x47e5cf[_0x9da1('0x26')](_0x554845,function(_0x16ee0c,_0x330219){if(_0x16ee0c){logger[_0x9da1('0x1d')](_0x9da1('0x1a'),_0x2dcbc6,_0x16ee0c['message']);_0x2c3cdd[_0x9da1('0x27')]();}else if(_0x330219&&_0x330219[_0x9da1('0x24')]){_0xe56279['body'][_0x9da1('0x28')]=_0x330219;_0x33cfe5[_0x9da1('0x1b')]=_0x330219['message'];return rpc[_0x396e23+_0x9da1('0x17')][_0x9da1('0x18')](_0x33cfe5)['then'](function(_0x36b87a){logger[_0x9da1('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x2dcbc6,_0x33cfe5['body']);if(_0x330219[_0x9da1('0x29')]==_0x9da1('0x2a')){_0x2c3cdd['next']();}else{_0x2c3cdd[_0x9da1('0x20')]();}})['catch'](function(_0x5a6f2d){logger['error'](_0x9da1('0x1a'),_0x2dcbc6,JSON[_0x9da1('0x2b')](_0x5a6f2d));_0x2c3cdd[_0x9da1('0x27')]();});}else{_0x2c3cdd[_0x9da1('0x27')]();}});}}catch(_0x140c6c){logger['error'](_0x9da1('0x1a'),_0x2dcbc6,JSON['stringify'](_0x140c6c));_0x2c3cdd[_0x9da1('0x20')]();}};}; \ 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 600969b..6b739bb 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 _0x2f80=['create','catch','error','stringify','finally','next','body','[%s][AUTOREPLY]\x20%s','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','created','interaction','info','Autoreply\x20already\x20sent','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','mail','service','host','Smtp','port','secure','authentication','auth','user','messageId','html','','replace','','then'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0x2f80,0x158));var _0x02f8=function(_0x38d61b,_0x473677){_0x38d61b=_0x38d61b-0x0;var _0x5002ae=_0x2f80[_0x38d61b];return _0x5002ae;};'use strict';var _=require(_0x02f8('0x0'));var moment=require(_0x02f8('0x1'));var utils=require(_0x02f8('0x2'));var logger=require(_0x02f8('0x3'))('routing');var rpc={'chatMessage':require(_0x02f8('0x4')),'openchannelMessage':require(_0x02f8('0x5')),'mailMessage':require(_0x02f8('0x6')),'smsMessage':require(_0x02f8('0x7')),'faxMessage':require(_0x02f8('0x8')),'whatsappMessage':require(_0x02f8('0x9'))};var mailRpc=require(_0x02f8('0xa'));exports['consequence']=function(_0x138f64,_0x4811da){return function(_0x585c76){try{if(_0x4811da[0x0]==='1'&&(_[_0x02f8('0xb')](this['interaction'][_0x02f8('0xc')])||!this[_0x02f8('0xd')][_0x02f8('0xc')])){logger[_0x02f8('0xe')]('[%s][AUTOREPLY]\x20%s',_0x138f64,_0x02f8('0xf'));return _0x585c76['next']();}var _0x57a79c=this[_0x02f8('0x10')];var _0x29ed3d={'body':utils[_0x02f8('0x11')](_0x4811da[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x02f8('0x12')),'direction':'out'};if(this[_0x02f8('0x13')]){_0x29ed3d['to']=this['message']['from']||'';_0x29ed3d['cc']=this[_0x02f8('0x13')]['cc']||'';_0x29ed3d[_0x02f8('0x14')]=this[_0x02f8('0x13')]['to']||'';_0x29ed3d[_0x02f8('0x15')]=this[_0x02f8('0x13')][_0x02f8('0x15')]||'';_0x29ed3d[_0x02f8('0x16')]=!![];if(this[_0x02f8('0x13')][_0x02f8('0x17')]){_0x29ed3d[_0x02f8('0x17')]='';_0x29ed3d['subject']+=_[_0x02f8('0x18')](this[_0x02f8('0x13')]['subject'],'Re:')?'':_0x02f8('0x19');_0x29ed3d[_0x02f8('0x17')]+=this[_0x02f8('0x13')][_0x02f8('0x17')];}}if(this[_0x02f8('0x10')]==='chat'){_0x29ed3d['ChatWebsiteId']=this[_0x02f8('0x1a')]['id'];}else{_0x29ed3d[_[_0x02f8('0x1b')](this['channel'])+_0x02f8('0x1c')]=this[_0x02f8('0x1a')]['id'];}_0x29ed3d[_[_0x02f8('0x1b')](this['channel'])+_0x02f8('0x1d')]=this[_0x02f8('0xd')]['id'];if(rpc[this[_0x02f8('0x10')]+_0x02f8('0x1e')]){if(this[_0x02f8('0x10')]===_0x02f8('0x1f')){var _0xc6f797={'tls':{'rejectUnauthorized':![]}};if(this[_0x02f8('0x1a')]['Smtp'][_0x02f8('0x20')]){_0xc6f797[_0x02f8('0x20')]=this[_0x02f8('0x1a')]['Smtp']['service'];}else{_0xc6f797[_0x02f8('0x21')]=this[_0x02f8('0x1a')][_0x02f8('0x22')][_0x02f8('0x21')];_0xc6f797[_0x02f8('0x23')]=this[_0x02f8('0x1a')][_0x02f8('0x22')][_0x02f8('0x23')];_0xc6f797[_0x02f8('0x24')]=this[_0x02f8('0x1a')][_0x02f8('0x22')]['secure'];}if(this[_0x02f8('0x1a')]['Smtp'][_0x02f8('0x25')]){_0xc6f797[_0x02f8('0x26')]={'user':this[_0x02f8('0x1a')]['Smtp'][_0x02f8('0x27')],'pass':this['account']['Smtp']['pass']};}_0x29ed3d['inReplyTo']=this[_0x02f8('0x13')][_0x02f8('0x28')];_0x29ed3d[_0x02f8('0x29')]=_0x02f8('0x2a')+_[_0x02f8('0x2b')](_0x29ed3d['body'],_0x02f8('0x2c'),_0x02f8('0x2d'))+_0x02f8('0x2e');return mailRpc['sendMailMessage'](_0xc6f797,_0x29ed3d)[_0x02f8('0x2f')](function(_0x40204c){logger[_0x02f8('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x138f64);_0x29ed3d[_0x02f8('0x28')]=_0x40204c[_0x02f8('0x13')][_0x02f8('0x28')];return rpc[_0x57a79c+'Message'][_0x02f8('0x30')](_0x29ed3d);})[_0x02f8('0x2f')](function(_0x57a30d){logger[_0x02f8('0xe')]('[%s][AUTOREPLY]\x20%s',_0x138f64,JSON['stringify'](_0x57a30d));})[_0x02f8('0x31')](function(_0x5dbea0){logger[_0x02f8('0x32')]('[RPC][%s][AUTOREPLY]\x20%s',_0x138f64,JSON[_0x02f8('0x33')](_0x5dbea0));})[_0x02f8('0x34')](function(){_0x585c76[_0x02f8('0x35')]();});}else{return rpc[this[_0x02f8('0x10')]+_0x02f8('0x1e')][_0x02f8('0x30')](_0x29ed3d)[_0x02f8('0x2f')](function(_0x5cb7bb){logger[_0x02f8('0xe')]('[%s][AUTOREPLY]\x20%s',_0x138f64,_0x29ed3d[_0x02f8('0x36')]);})[_0x02f8('0x31')](function(_0x30c135){logger[_0x02f8('0x32')](_0x02f8('0x37'),_0x138f64,JSON[_0x02f8('0x33')](_0x30c135));})[_0x02f8('0x34')](function(){_0x585c76[_0x02f8('0x35')]();});}}}catch(_0x14ba96){logger['error'](_0x02f8('0x37'),_0x138f64,JSON[_0x02f8('0x33')](_0x14ba96));_0x585c76['stop']();}};}; \ No newline at end of file +var _0xd321=['Smtp','host','port','secure','authentication','auth','user','pass','messageId','','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','info','error','stringify','finally','body','catch','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','next','getMustacheRender','contact','format','message','phone','read','subject','startsWith','Re:\x20','channel','ChatWebsiteId','account','upperFirst','AccountId','Message','mail','service'];(function(_0x2f91fa,_0x524a9c){var _0x154a26=function(_0x5c0918){while(--_0x5c0918){_0x2f91fa['push'](_0x2f91fa['shift']());}};_0x154a26(++_0x524a9c);}(_0xd321,0x1cf));var _0x1d32=function(_0x33a672,_0x58531a){_0x33a672=_0x33a672-0x0;var _0x567b40=_0xd321[_0x33a672];return _0x567b40;};'use strict';var _=require(_0x1d32('0x0'));var moment=require(_0x1d32('0x1'));var utils=require(_0x1d32('0x2'));var logger=require('../../../../config/logger')(_0x1d32('0x3'));var rpc={'chatMessage':require(_0x1d32('0x4')),'openchannelMessage':require(_0x1d32('0x5')),'mailMessage':require(_0x1d32('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1d32('0x7')),'whatsappMessage':require(_0x1d32('0x8'))};var mailRpc=require(_0x1d32('0x9'));exports['consequence']=function(_0x5bcf65,_0xd1ec71){return function(_0x4dbc62){try{if(_0xd1ec71[0x0]==='1'&&(_[_0x1d32('0xa')](this[_0x1d32('0xb')][_0x1d32('0xc')])||!this['interaction'][_0x1d32('0xc')])){logger['info'](_0x1d32('0xd'),_0x5bcf65,'Autoreply\x20already\x20sent');return _0x4dbc62[_0x1d32('0xe')]();}var _0x5a38f6=this['channel'];var _0x11b9d6={'body':utils[_0x1d32('0xf')](_0xd1ec71[0x1],this),'ContactId':this[_0x1d32('0x10')]['id'],'sentAt':moment()[_0x1d32('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['message']){_0x11b9d6['to']=this[_0x1d32('0x12')]['from']||'';_0x11b9d6['cc']=this[_0x1d32('0x12')]['cc']||'';_0x11b9d6['from']=this[_0x1d32('0x12')]['to']||'';_0x11b9d6['phone']=this[_0x1d32('0x12')][_0x1d32('0x13')]||'';_0x11b9d6[_0x1d32('0x14')]=!![];if(this[_0x1d32('0x12')]['subject']){_0x11b9d6[_0x1d32('0x15')]='';_0x11b9d6[_0x1d32('0x15')]+=_[_0x1d32('0x16')](this[_0x1d32('0x12')][_0x1d32('0x15')],'Re:')?'':_0x1d32('0x17');_0x11b9d6[_0x1d32('0x15')]+=this[_0x1d32('0x12')][_0x1d32('0x15')];}}if(this[_0x1d32('0x18')]==='chat'){_0x11b9d6[_0x1d32('0x19')]=this[_0x1d32('0x1a')]['id'];}else{_0x11b9d6[_[_0x1d32('0x1b')](this[_0x1d32('0x18')])+_0x1d32('0x1c')]=this[_0x1d32('0x1a')]['id'];}_0x11b9d6[_[_0x1d32('0x1b')](this[_0x1d32('0x18')])+'InteractionId']=this[_0x1d32('0xb')]['id'];if(rpc[this[_0x1d32('0x18')]+_0x1d32('0x1d')]){if(this[_0x1d32('0x18')]===_0x1d32('0x1e')){var _0x4356d1={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0x1d32('0x1f')]){_0x4356d1['service']=this[_0x1d32('0x1a')][_0x1d32('0x20')]['service'];}else{_0x4356d1[_0x1d32('0x21')]=this[_0x1d32('0x1a')][_0x1d32('0x20')][_0x1d32('0x21')];_0x4356d1[_0x1d32('0x22')]=this['account'][_0x1d32('0x20')][_0x1d32('0x22')];_0x4356d1[_0x1d32('0x23')]=this[_0x1d32('0x1a')][_0x1d32('0x20')]['secure'];}if(this['account'][_0x1d32('0x20')][_0x1d32('0x24')]){_0x4356d1[_0x1d32('0x25')]={'user':this[_0x1d32('0x1a')][_0x1d32('0x20')][_0x1d32('0x26')],'pass':this[_0x1d32('0x1a')]['Smtp'][_0x1d32('0x27')]};}_0x11b9d6['inReplyTo']=this[_0x1d32('0x12')][_0x1d32('0x28')];_0x11b9d6['html']=_0x1d32('0x29')+_['replace'](_0x11b9d6['body'],']+(>|$)/g,''),'priorityTrue':_0x33c3fe[0x1],'priorityFalse':_0x33c3fe[0x2]};var _0x4c710b=gotoif['validate'](_0x2c06e1,{'typecast':!![]});if(_0x4c710b[_0x4211('0xb')]){logger[_0x4211('0xc')](_0x4211('0xd'),_0x4f5e6d,_[_0x4211('0xe')](_0x4c710b,_0x4211('0xf'))[_0x4211('0x10')](',\x20'));_0x78caa4[_0x4211('0x11')]();}else{try{var _0xdb4fd1=eval('('+_0x2c06e1[_0x4211('0x12')]+')');var _0x11a9ce=_0xdb4fd1?_0x2c06e1[_0x4211('0x13')]:_0x2c06e1[_0x4211('0x14')];logger[_0x4211('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4f5e6d,_0x2c06e1[_0x4211('0x12')],_0xdb4fd1,_0x11a9ce||'next');if(_0x11a9ce){var _0x5cdfcf=_[_0x4211('0x16')](_0x78caa4[_0x4211('0x17')](),{'p':_0x11a9ce});if(_0x5cdfcf>=0x0){logger[_0x4211('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4f5e6d,_0x11a9ce||_0x4211('0x18'),_0x5cdfcf);_0x78caa4['next'](_0x5cdfcf);}else{logger[_0x4211('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4f5e6d,_0x11a9ce||_0x4211('0x18'));_0x78caa4[_0x4211('0x11')]();}}else{_0x78caa4[_0x4211('0x18')]();}}catch(_0x43c23c){logger[_0x4211('0xc')](_0x4211('0x19'),_0x4f5e6d,_0x43c23c['message']);_0x78caa4[_0x4211('0x11')]();}}}catch(_0x5e0666){logger[_0x4211('0xc')](_0x4211('0xd'),_0x4f5e6d,JSON[_0x4211('0x1a')](_0x5e0666));_0x78caa4[_0x4211('0x11')]();}};}; \ No newline at end of file +var _0x57ac=['fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ac,0xa8));var _0xc57a=function(_0x5b1981,_0x310935){_0x5b1981=_0x5b1981-0x0;var _0x59b3e3=_0x57ac[_0x5b1981];return _0x59b3e3;};'use strict';var schema=require(_0xc57a('0x0'));var _=require(_0xc57a('0x1'));var htmlToText=require(_0xc57a('0x2'));var utils=require(_0xc57a('0x3'));var logger=require(_0xc57a('0x4'))(_0xc57a('0x5'));var gotoif=schema({'condition':{'type':_0xc57a('0x6'),'required':!![],'message':_0xc57a('0x7')},'priorityTrue':{'type':'number','message':_0xc57a('0x8')},'priorityFalse':{'type':_0xc57a('0x9'),'message':_0xc57a('0xa')}});exports[_0xc57a('0xb')]=function(_0x82cee2,_0x55c440){return function(_0x1330fb){try{var _0x51b6ec={'condition':htmlToText[_0xc57a('0xc')](utils[_0xc57a('0xd')](_0x55c440[0x0],this),{'wordwrap':![]})[_0xc57a('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x55c440[0x1],'priorityFalse':_0x55c440[0x2]};var _0x276e2b=gotoif[_0xc57a('0x0')](_0x51b6ec,{'typecast':!![]});if(_0x276e2b[_0xc57a('0xf')]){logger[_0xc57a('0x10')](_0xc57a('0x11'),_0x82cee2,_[_0xc57a('0x12')](_0x276e2b,_0xc57a('0x13'))['join'](',\x20'));_0x1330fb['stop']();}else{try{var _0x3a452a=eval('('+_0x51b6ec[_0xc57a('0x14')]+')');var _0x4c2c27=_0x3a452a?_0x51b6ec['priorityTrue']:_0x51b6ec['priorityFalse'];logger[_0xc57a('0x15')](_0xc57a('0x16'),_0x82cee2,_0x51b6ec[_0xc57a('0x14')],_0x3a452a,_0x4c2c27||_0xc57a('0x17'));if(_0x4c2c27){var _0x1b37a5=_[_0xc57a('0x18')](_0x1330fb[_0xc57a('0x19')](),{'p':_0x4c2c27});if(_0x1b37a5>=0x0){logger[_0xc57a('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x82cee2,_0x4c2c27||_0xc57a('0x17'),_0x1b37a5);_0x1330fb[_0xc57a('0x17')](_0x1b37a5);}else{logger[_0xc57a('0x15')](_0xc57a('0x1a'),_0x82cee2,_0x4c2c27||_0xc57a('0x17'));_0x1330fb[_0xc57a('0x1b')]();}}else{_0x1330fb[_0xc57a('0x17')]();}}catch(_0x228cdd){logger[_0xc57a('0x10')](_0xc57a('0x1c'),_0x82cee2,_0x228cdd[_0xc57a('0x13')]);_0x1330fb['stop']();}}}catch(_0x4e1f02){logger[_0xc57a('0x10')]('[%s][GOTOIF]\x20%s',_0x82cee2,JSON[_0xc57a('0x1d')](_0x4e1f02));_0x1330fb[_0xc57a('0x1b')]();}};}; \ 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 db048d2..989d70e 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 _0x8ed8=['consequence','validate','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','lodash','../../../../config/logger','routing'];(function(_0x25981f,_0x392e24){var _0x2aacbf=function(_0x81d4d5){while(--_0x81d4d5){_0x25981f['push'](_0x25981f['shift']());}};_0x2aacbf(++_0x392e24);}(_0x8ed8,0xe1));var _0x88ed=function(_0x453e10,_0x25ff22){_0x453e10=_0x453e10-0x0;var _0x327a98=_0x8ed8[_0x453e10];return _0x327a98;};'use strict';var schema=require('validate');var _=require(_0x88ed('0x0'));var logger=require(_0x88ed('0x1'))(_0x88ed('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x88ed('0x3')]=function(_0x2fc358,_0x2c51d5){return function(_0x22ca4a){try{var _0x58d0b4={'priority':_0x2c51d5[0x0]};var _0x35fdc3=gotop[_0x88ed('0x4')](_0x58d0b4,{'typecast':!![]});if(_0x35fdc3['length']){logger[_0x88ed('0x5')](_0x88ed('0x6'),_0x2fc358,_[_0x88ed('0x7')](_0x35fdc3,_0x88ed('0x8'))[_0x88ed('0x9')](',\x20'));_0x22ca4a[_0x88ed('0xa')]();}else{logger[_0x88ed('0xb')](_0x88ed('0xc'),_0x2fc358,_0x58d0b4[_0x88ed('0xd')]);if(_0x58d0b4[_0x88ed('0xd')]){var _0x34e376=_[_0x88ed('0xe')](_0x22ca4a[_0x88ed('0xf')](),{'p':_0x58d0b4[_0x88ed('0xd')]});if(_0x34e376>=0x0){logger[_0x88ed('0xb')](_0x88ed('0x10'),_0x2fc358,_0x58d0b4[_0x88ed('0xd')]||_0x88ed('0x11'),_0x34e376);_0x22ca4a['next'](_0x34e376);}else{logger[_0x88ed('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2fc358,_0x58d0b4[_0x88ed('0xd')]||'next');_0x22ca4a['stop']();}}else{_0x22ca4a['next']();}}}catch(_0x1fd568){logger[_0x88ed('0x5')](_0x88ed('0x6'),_0x2fc358,JSON[_0x88ed('0x12')](_0x1fd568));_0x22ca4a[_0x88ed('0xa')]();}};}; \ No newline at end of file +var _0x2cbc=['lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate'];(function(_0x3b7ac6,_0x501f60){var _0x45a3f0=function(_0x1dbeff){while(--_0x1dbeff){_0x3b7ac6['push'](_0x3b7ac6['shift']());}};_0x45a3f0(++_0x501f60);}(_0x2cbc,0xfb));var _0xc2cb=function(_0x426994,_0x3f09c6){_0x426994=_0x426994-0x0;var _0xbbfc6=_0x2cbc[_0x426994];return _0xbbfc6;};'use strict';var schema=require(_0xc2cb('0x0'));var _=require(_0xc2cb('0x1'));var logger=require(_0xc2cb('0x2'))(_0xc2cb('0x3'));var gotop=schema({'priority':{'type':_0xc2cb('0x4'),'required':!![],'message':_0xc2cb('0x5')}});exports[_0xc2cb('0x6')]=function(_0x1addc8,_0x32ae1d){return function(_0x100939){try{var _0x4ac7ec={'priority':_0x32ae1d[0x0]};var _0x3f2edf=gotop['validate'](_0x4ac7ec,{'typecast':!![]});if(_0x3f2edf[_0xc2cb('0x7')]){logger[_0xc2cb('0x8')](_0xc2cb('0x9'),_0x1addc8,_['map'](_0x3f2edf,_0xc2cb('0xa'))['join'](',\x20'));_0x100939[_0xc2cb('0xb')]();}else{logger['info'](_0xc2cb('0xc'),_0x1addc8,_0x4ac7ec[_0xc2cb('0xd')]);if(_0x4ac7ec[_0xc2cb('0xd')]){var _0x417ebf=_[_0xc2cb('0xe')](_0x100939[_0xc2cb('0xf')](),{'p':_0x4ac7ec[_0xc2cb('0xd')]});if(_0x417ebf>=0x0){logger[_0xc2cb('0x10')](_0xc2cb('0x11'),_0x1addc8,_0x4ac7ec[_0xc2cb('0xd')]||_0xc2cb('0x12'),_0x417ebf);_0x100939['next'](_0x417ebf);}else{logger['info'](_0xc2cb('0x13'),_0x1addc8,_0x4ac7ec[_0xc2cb('0xd')]||_0xc2cb('0x12'));_0x100939[_0xc2cb('0xb')]();}}else{_0x100939[_0xc2cb('0x12')]();}}}catch(_0x8bb528){logger[_0xc2cb('0x8')](_0xc2cb('0x9'),_0x1addc8,JSON[_0xc2cb('0x14')](_0x8bb528));_0x100939['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 8ec1ad1..61a04f1 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 _0x9dcb=['upperFirst','AccountId','account','InteractionId','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','getMustacheRender','contact','channel','chat'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x9dcb,0x91));var _0xb9dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dcb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb9dc('0x0'));var utils=require(_0xb9dc('0x1'));var logger=require(_0xb9dc('0x2'))(_0xb9dc('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb9dc('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x5f8710,_0xbc0e27){return function(_0x3917b3){try{var _0x33a8e7={'body':utils[_0xb9dc('0x5')](_0xbc0e27[0x0],this),'ContactId':this[_0xb9dc('0x6')]['id']};if(this[_0xb9dc('0x7')]===_0xb9dc('0x8')){_0x33a8e7['ChatWebsiteId']=this['account']['id'];}else{_0x33a8e7[_[_0xb9dc('0x9')](this[_0xb9dc('0x7')])+_0xb9dc('0xa')]=this[_0xb9dc('0xb')]['id'];}_0x33a8e7[_[_0xb9dc('0x9')](this[_0xb9dc('0x7')])+_0xb9dc('0xc')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+'Message']['create'](_0x33a8e7)[_0xb9dc('0xd')](function(_0x44836a){logger[_0xb9dc('0xe')](_0xb9dc('0xf'),_0x5f8710,_0x33a8e7[_0xb9dc('0x10')]);_0x3917b3[_0xb9dc('0x11')]();})[_0xb9dc('0x12')](function(_0x4dbedf){logger[_0xb9dc('0x13')]('[%s][MESSAGE]\x20%s',_0x5f8710,JSON[_0xb9dc('0x14')](_0x4dbedf));_0x3917b3[_0xb9dc('0x15')]();});}}catch(_0x20debb){logger['error'](_0xb9dc('0xf'),_0x5f8710,JSON[_0xb9dc('0x14')](_0x20debb));_0x3917b3[_0xb9dc('0x15')]();}};}; \ No newline at end of file +var _0x0998=['InteractionId','Message','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst'];(function(_0x1830ae,_0x3bd543){var _0x4a506f=function(_0x47aea8){while(--_0x47aea8){_0x1830ae['push'](_0x1830ae['shift']());}};_0x4a506f(++_0x3bd543);}(_0x0998,0xf4));var _0x8099=function(_0x5aa0ec,_0x5c4454){_0x5aa0ec=_0x5aa0ec-0x0;var _0x750594=_0x0998[_0x5aa0ec];return _0x750594;};'use strict';var _=require(_0x8099('0x0'));var utils=require(_0x8099('0x1'));var logger=require(_0x8099('0x2'))('routing');var rpc={'chatMessage':require(_0x8099('0x3')),'openchannelMessage':require(_0x8099('0x4')),'mailMessage':require(_0x8099('0x5')),'smsMessage':require(_0x8099('0x6')),'faxMessage':require(_0x8099('0x7')),'whatsappMessage':require(_0x8099('0x8'))};exports[_0x8099('0x9')]=function(_0x4e8035,_0x2e293a){return function(_0x12a354){try{var _0x1ecdf4={'body':utils[_0x8099('0xa')](_0x2e293a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x8099('0xb')]===_0x8099('0xc')){_0x1ecdf4[_0x8099('0xd')]=this[_0x8099('0xe')]['id'];}else{_0x1ecdf4[_[_0x8099('0xf')](this[_0x8099('0xb')])+'AccountId']=this[_0x8099('0xe')]['id'];}_0x1ecdf4[_[_0x8099('0xf')](this[_0x8099('0xb')])+_0x8099('0x10')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x8099('0xb')]+_0x8099('0x11')]['create'](_0x1ecdf4)[_0x8099('0x12')](function(_0x5cd26f){logger[_0x8099('0x13')]('[%s][MESSAGE]\x20%s',_0x4e8035,_0x1ecdf4[_0x8099('0x14')]);_0x12a354[_0x8099('0x15')]();})[_0x8099('0x16')](function(_0x1296bb){logger[_0x8099('0x17')](_0x8099('0x18'),_0x4e8035,JSON[_0x8099('0x19')](_0x1296bb));_0x12a354['stop']();});}}catch(_0x14af02){logger[_0x8099('0x17')](_0x8099('0x18'),_0x4e8035,JSON['stringify'](_0x14af02));_0x12a354['stop']();}};}; \ 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 c9f552f..0b8cd59 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 _0xa628=['[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils','routing','consequence','info'];(function(_0x37b426,_0x3463f5){var _0x14fcd8=function(_0x147a39){while(--_0x147a39){_0x37b426['push'](_0x37b426['shift']());}};_0x14fcd8(++_0x3463f5);}(_0xa628,0x149));var _0x8a62=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xa628[_0x22b8a3];return _0x199a0c;};'use strict';var utils=require(_0x8a62('0x0'));var logger=require('../../../../config/logger')(_0x8a62('0x1'));exports[_0x8a62('0x2')]=function(_0x394573,_0xcf1c9e){return function(_0x345a52){try{logger[_0x8a62('0x3')](_0x8a62('0x4'),_0x394573,utils[_0x8a62('0x5')](_0xcf1c9e[0x0],this));_0x345a52['next']();}catch(_0xe0960d){logger[_0x8a62('0x6')]('[%s][NOOP]\x20%s',_0x394573,JSON[_0x8a62('0x7')](_0xe0960d));_0x345a52[_0x8a62('0x8')]();}};}; \ No newline at end of file +var _0x07b7=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','./utils'];(function(_0x5e961f,_0x58da23){var _0x370ad8=function(_0x2eb998){while(--_0x2eb998){_0x5e961f['push'](_0x5e961f['shift']());}};_0x370ad8(++_0x58da23);}(_0x07b7,0xf2));var _0x707b=function(_0x484473,_0x38314e){_0x484473=_0x484473-0x0;var _0x5f5914=_0x07b7[_0x484473];return _0x5f5914;};'use strict';var utils=require(_0x707b('0x0'));var logger=require(_0x707b('0x1'))(_0x707b('0x2'));exports[_0x707b('0x3')]=function(_0x21f09a,_0x3079b7){return function(_0x45a694){try{logger[_0x707b('0x4')](_0x707b('0x5'),_0x21f09a,utils[_0x707b('0x6')](_0x3079b7[0x0],this));_0x45a694[_0x707b('0x7')]();}catch(_0x4202c1){logger[_0x707b('0x8')](_0x707b('0x5'),_0x21f09a,JSON['stringify'](_0x4202c1));_0x45a694['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 5f2ccc9..c603a07 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 _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x4bf9d2,_0x5dbea8){var _0x4aa8c0=function(_0x3bd517){while(--_0x3bd517){_0x4bf9d2['push'](_0x4bf9d2['shift']());}};_0x4aa8c0(++_0x5dbea8);}(_0x7217,0x19e));var _0x7721=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x7217[_0x5c3c0b];return _0x52ecd2;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ No newline at end of file +var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x47db05,_0x19058){var _0x2ebb56=function(_0x2976ed){while(--_0x2976ed){_0x47db05['push'](_0x47db05['shift']());}};_0x2ebb56(++_0x19058);}(_0x008c,0x188));var _0xc008=function(_0x1040c8,_0x1baa50){_0x1040c8=_0x1040c8-0x0;var _0x5d0df0=_0x008c[_0x1040c8];return _0x5d0df0;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 14cc290..1084f5f 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 _0xa15b=['busy','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busyQueue','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleTimeout','bind','timeout','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','agents'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0xa15b,0x1e6));var _0xba15=function(_0x26a3ec,_0x5d6e0b){_0x26a3ec=_0x26a3ec-0x0;var _0x564856=_0xa15b[_0x26a3ec];return _0x564856;};'use strict';var _=require(_0xba15('0x0'));var uuid=require(_0xba15('0x1'));var util=require(_0xba15('0x2'));var logger=require(_0xba15('0x3'))(_0xba15('0x4'));var Agent=function(_0x58fab9,_0x4adbb1,_0x2dd8e1,_0x34228d){this[_0xba15('0x5')]=uuid['v4']();this[_0xba15('0x6')]=_0x58fab9;this[_0xba15('0x7')]=_0x4adbb1;this[_0xba15('0x8')]=_0x2dd8e1;this[_0xba15('0x4')]=_0x34228d;this[_0xba15('0x6')][_0xba15('0x9')](this['handleRun']['bind'](this),this[_0xba15('0xa')][_0xba15('0xb')](this));this[_0xba15('0x6')]['on'](_0xba15('0xc'),this[_0xba15('0xa')]['bind'](this));this['squeue']['on']('drained',this[_0xba15('0xd')][_0xba15('0xb')](this));};Agent[_0xba15('0xe')]['push']=function(){this[_0xba15('0x6')][_0xba15('0x9')](this[_0xba15('0xf')][_0xba15('0xb')](this),this[_0xba15('0xa')]['bind'](this));};Agent['prototype'][_0xba15('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xba15('0xe')][_0xba15('0xf')]=function(_0x4f5f61){logger[_0xba15('0x10')](_0xba15('0x11'),this[_0xba15('0x6')]['id'],this[_0xba15('0x7')]['id']);if(_[_0xba15('0x12')](this['realtime']['agents'][this[_0xba15('0x7')]['id']])){logger[_0xba15('0x10')](_0xba15('0x13'),this[_0xba15('0x6')]['id'],this[_0xba15('0x7')]['id']);setTimeout(this[_0xba15('0x9')][_0xba15('0xb')](this),0x3e8);}else{if(this[_0xba15('0x4')][_0xba15('0x14')]||util[_0xba15('0x15')](this[_0xba15('0x6')]['id'],this[_0xba15('0x8')]['agents'][this['agent']['id']],this[_0xba15('0x6')][_0xba15('0x16')],![])){this[_0xba15('0x8')][_0xba15('0x17')][this[_0xba15('0x7')]['id']][_0xba15('0x18')]=!![];this[_0xba15('0x8')][_0xba15('0x17')][this[_0xba15('0x7')]['id']]['busyQueue']=undefined;util[_0xba15('0x19')](this[_0xba15('0x5')],this['squeue']['id'],this[_0xba15('0x8')][_0xba15('0x17')][this[_0xba15('0x7')]['id']],null,this['routing']);util[_0xba15('0x1a')](this[_0xba15('0x6')]['id'],this[_0xba15('0x8')][_0xba15('0x17')][this[_0xba15('0x7')]['id']],_0xba15('0x1b')+(this['routing'][_0xba15('0x14')]?_0xba15('0x1c'):''));}else{logger[_0xba15('0x10')](_0xba15('0x1d'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xba15('0x9')]['bind'](this),0x3e8);}}};Agent[_0xba15('0xe')][_0xba15('0xa')]=function(_0x280757){if(_[_0xba15('0x12')](this[_0xba15('0x8')][_0xba15('0x17')][this[_0xba15('0x7')]['id']])){return logger['info'](_0xba15('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xba15('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xba15('0x7')]['id']);util[_0xba15('0x1e')](this[_0xba15('0x5')],this[_0xba15('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0xba15('0x4')]);this[_0xba15('0x8')][_0xba15('0x17')][this['agent']['id']][_0xba15('0x18')]=![];this['realtime']['agents'][this[_0xba15('0x7')]['id']][_0xba15('0x1f')]=undefined;util['writeLog'](this[_0xba15('0x6')]['id'],this[_0xba15('0x8')][_0xba15('0x17')][this['agent']['id']],_0x280757?'STOP':_0xba15('0x20'));}if(!_0x280757){setTimeout(this['push'][_0xba15('0xb')](this),0x3e8);}};function agent(_0x5a13c2,_0x498824,_0x367329,_0x5b2208){return new Agent(_0x5a13c2,_0x498824,_0x367329,_0x5b2208);}module[_0xba15('0x21')]=agent; \ No newline at end of file +var _0xb217=['timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','realtime','squeue','push','handleRun','bind','handleTimeout'];(function(_0x33b697,_0x305147){var _0x3ef48d=function(_0x4b61b3){while(--_0x4b61b3){_0x33b697['push'](_0x33b697['shift']());}};_0x3ef48d(++_0x305147);}(_0xb217,0x106));var _0x7b21=function(_0x5e2483,_0x2951f3){_0x5e2483=_0x5e2483-0x0;var _0x2ebece=_0xb217[_0x5e2483];return _0x2ebece;};'use strict';var _=require('lodash');var uuid=require(_0x7b21('0x0'));var util=require(_0x7b21('0x1'));var logger=require(_0x7b21('0x2'))(_0x7b21('0x3'));var Agent=function(_0x526d75,_0x4207c3,_0x34898b,_0x3921f4){this['notificationId']=uuid['v4']();this['squeue']=_0x526d75;this['agent']=_0x4207c3;this[_0x7b21('0x4')]=_0x34898b;this[_0x7b21('0x3')]=_0x3921f4;this[_0x7b21('0x5')][_0x7b21('0x6')](this[_0x7b21('0x7')][_0x7b21('0x8')](this),this[_0x7b21('0x9')]['bind'](this));this[_0x7b21('0x5')]['on'](_0x7b21('0xa'),this[_0x7b21('0x9')][_0x7b21('0x8')](this));this[_0x7b21('0x5')]['on'](_0x7b21('0xb'),this[_0x7b21('0xc')]['bind'](this));};Agent[_0x7b21('0xd')][_0x7b21('0x6')]=function(){this['squeue'][_0x7b21('0x6')](this[_0x7b21('0x7')]['bind'](this),this[_0x7b21('0x9')][_0x7b21('0x8')](this));};Agent[_0x7b21('0xd')]['handleDrained']=function(){this[_0x7b21('0x9')](!![]);};Agent[_0x7b21('0xd')][_0x7b21('0x7')]=function(_0x3e96cd){logger[_0x7b21('0xe')](_0x7b21('0xf'),this[_0x7b21('0x5')]['id'],this[_0x7b21('0x10')]['id']);if(_[_0x7b21('0x11')](this[_0x7b21('0x4')]['agents'][this[_0x7b21('0x10')]['id']])){logger[_0x7b21('0xe')](_0x7b21('0x12'),this[_0x7b21('0x5')]['id'],this[_0x7b21('0x10')]['id']);setTimeout(this[_0x7b21('0x6')]['bind'](this),0x3e8);}else{if(this[_0x7b21('0x3')][_0x7b21('0x13')]||util['isAgentAvailable'](this[_0x7b21('0x5')]['id'],this[_0x7b21('0x4')][_0x7b21('0x14')][this[_0x7b21('0x10')]['id']],this[_0x7b21('0x5')][_0x7b21('0x15')],![])){this[_0x7b21('0x4')]['agents'][this[_0x7b21('0x10')]['id']][_0x7b21('0x16')]=!![];this[_0x7b21('0x4')][_0x7b21('0x14')][this['agent']['id']][_0x7b21('0x17')]=undefined;util[_0x7b21('0x18')](this[_0x7b21('0x19')],this['squeue']['id'],this[_0x7b21('0x4')]['agents'][this[_0x7b21('0x10')]['id']],null,this[_0x7b21('0x3')]);util[_0x7b21('0x1a')](this[_0x7b21('0x5')]['id'],this['realtime'][_0x7b21('0x14')][this['agent']['id']],_0x7b21('0x1b')+(this[_0x7b21('0x3')][_0x7b21('0x13')]?_0x7b21('0x1c'):''));}else{logger['info'](_0x7b21('0x1d'),this[_0x7b21('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x7b21('0x6')][_0x7b21('0x8')](this),0x3e8);}}};Agent[_0x7b21('0xd')][_0x7b21('0x9')]=function(_0x1ddd73){if(_['isNil'](this[_0x7b21('0x4')]['agents'][this['agent']['id']])){return logger[_0x7b21('0xe')](_0x7b21('0x12'),this[_0x7b21('0x5')]['id'],this[_0x7b21('0x10')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x7b21('0x10')]['id']);util[_0x7b21('0x1e')](this[_0x7b21('0x19')],this['squeue']['id'],this[_0x7b21('0x4')][_0x7b21('0x14')][this[_0x7b21('0x10')]['id']],null,this[_0x7b21('0x3')]);this[_0x7b21('0x4')]['agents'][this[_0x7b21('0x10')]['id']][_0x7b21('0x16')]=![];this[_0x7b21('0x4')]['agents'][this['agent']['id']][_0x7b21('0x17')]=undefined;util[_0x7b21('0x1a')](this['squeue']['id'],this[_0x7b21('0x4')][_0x7b21('0x14')][this[_0x7b21('0x10')]['id']],_0x1ddd73?_0x7b21('0x1f'):_0x7b21('0x20'));}if(!_0x1ddd73){setTimeout(this[_0x7b21('0x6')][_0x7b21('0x8')](this),0x3e8);}};function agent(_0x37b252,_0x383f35,_0x5c5d4a,_0x287290){return new Agent(_0x37b252,_0x383f35,_0x5c5d4a,_0x287290);}module[_0x7b21('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index ba2972b..632b685 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 _0x1da1=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','showNotification','hideNotification','STOP','TIMEOUT','busy','lodash','uuid','./util','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info'];(function(_0x26b62d,_0x15ac89){var _0x2726df=function(_0x1bbe67){while(--_0x1bbe67){_0x26b62d['push'](_0x26b62d['shift']());}};_0x2726df(++_0x15ac89);}(_0x1da1,0x1ab));var _0x11da=function(_0x136f76,_0x280931){_0x136f76=_0x136f76-0x0;var _0x1cec38=_0x1da1[_0x136f76];return _0x1cec38;};'use strict';var _=require(_0x11da('0x0'));var uuid=require(_0x11da('0x1'));var util=require(_0x11da('0x2'));var logger=require('../../../../../config/logger')(_0x11da('0x3'));var Beepall=function(_0x5f06c1,_0x3979de,_0x1df841,_0xf98379){this[_0x11da('0x4')]=uuid['v4']();this[_0x11da('0x5')]=_0x5f06c1;this[_0x11da('0x6')]=_0x3979de;this[_0x11da('0x7')]=_0x1df841;this['routing']=_0xf98379;this['squeue'][_0x11da('0x8')](this[_0x11da('0x9')][_0x11da('0xa')](this),this[_0x11da('0xb')]['bind'](this));this['squeue']['on'](_0x11da('0xc'),this[_0x11da('0xb')][_0x11da('0xa')](this));this['squeue']['on'](_0x11da('0xd'),this[_0x11da('0xe')][_0x11da('0xa')](this));};Beepall[_0x11da('0xf')][_0x11da('0x8')]=function(){this[_0x11da('0x5')][_0x11da('0x8')](this[_0x11da('0x9')][_0x11da('0xa')](this),this['handleTimeout'][_0x11da('0xa')](this));};Beepall[_0x11da('0xf')]['handleDrained']=function(_0x5469d8){this[_0x11da('0xb')](!![]);};Beepall['prototype']['handleRun']=function(_0x406728){var _0x363034=!![];if(!_[_0x11da('0x10')](this[_0x11da('0x6')])&&!_[_0x11da('0x10')](this[_0x11da('0x6')][_0x11da('0x11')])&&this[_0x11da('0x6')][_0x11da('0x11')][_0x11da('0x12')]>0x0){for(var _0x2fca2b=0x0,_0x44d034;_0x2fca2b0x0){for(var _0x178c75=0x0,_0x185f7d;_0x178c750x0&&_0x10c8fe[_0x3042fe+_0x7b67('0x27')]>=_0x10c8fe[_0x3042fe+_0x7b67('0x26')]){writeLog(_0xeabc5c,_0x10c8fe,_0x3042fe[_0x7b67('0x28')]()+_0x7b67('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x3cf152,_0x40d2a7,_0x37e35f,_0x5c3f44,_0x5e35c9){return sendNotification(!![],_0x3cf152,_0x40d2a7,_0x37e35f,_0x5c3f44,_0x5e35c9);};exports['hideNotification']=function(_0x8649ec,_0x4bd8b7,_0x5ee006,_0x2cd200,_0x3de320){return sendNotification(![],_0x8649ec,_0x4bd8b7,_0x5ee006,_0x2cd200,_0x3de320);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xb9a7=['user:%s','emit','notification:%s','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','writeLog','util','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','format','name','user:save','split','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message'];(function(_0x545a02,_0x2efaab){var _0x70e3e=function(_0x3132a0){while(--_0x3132a0){_0x545a02['push'](_0x545a02['shift']());}};_0x70e3e(++_0x2efaab);}(_0xb9a7,0x112));var _0x7b9a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb9a7[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('../utils');var Mustache=require('mustache');var Redis=require('ioredis');var config=require(_0x7b9a('0x1'));var logger=require('../../../../../config/logger')(_0x7b9a('0x2'));config[_0x7b9a('0x3')]=_[_0x7b9a('0x4')](config[_0x7b9a('0x3')],{'host':_0x7b9a('0x5'),'port':0x18eb});var io=require(_0x7b9a('0x6'))(new Redis(config[_0x7b9a('0x3')]));function emit(_0x7019fd,_0x37ce81,_0x3e51f0){io['to'](_0x7019fd)['emit'](_0x37ce81,_0x3e51f0);}function sendNotification(_0x43d8e2,_0x3e84f1,_0x56a199,_0x511e28,_0x47e220,_0x15bc5b){io['to'](util[_0x7b9a('0x7')]('user:%s',_0x511e28[_0x7b9a('0x8')]))['emit'](_0x7b9a('0x9'),_0x511e28);var _0x597732=_0x15bc5b||{};var _0x3af176=_0x56a199[_0x7b9a('0xa')]('.');var _0x291591={'uniqueid':_0x3e84f1,'channel':_0x3af176[0x0],'id':_0x3af176[0x1],'title':_0x3af176[0x0]+'\x20interaction','interactionId':_0x3af176[0x2],'queue':_0x47e220?_0x47e220[_0x7b9a('0x8')]:null,'sound':_0x597732[_0x7b9a('0xb')]['notificationSound'],'shake':_0x597732[_0x7b9a('0xb')][_0x7b9a('0xc')]};try{if(!_0x597732['body']){_0x597732[_0x7b9a('0xd')]={};}if(_0x47e220){_0x597732[_0x7b9a('0xd')][_0x7b9a('0xe')]=_0x47e220;}else if(_0x597732[_0x7b9a('0xd')][_0x7b9a('0xe')]){delete _0x597732[_0x7b9a('0xd')][_0x7b9a('0xe')];}_0x291591[_0x7b9a('0xf')]=utils[_0x7b9a('0x10')](_0x597732['account'][_0x7b9a('0x11')],_0x597732);}catch(_0x4e8524){_0x291591[_0x7b9a('0xf')]=_0x7b9a('0x12');logger[_0x7b9a('0x13')](util[_0x7b9a('0x7')](_0x7b9a('0x14'),_0x3e84f1,_0x4e8524[_0x7b9a('0x15')]));}io['to'](util[_0x7b9a('0x7')](_0x7b9a('0x16'),_0x511e28[_0x7b9a('0x8')]))[_0x7b9a('0x17')](util[_0x7b9a('0x7')](_0x7b9a('0x18'),_0x43d8e2?_0x7b9a('0x19'):'remove'),_0x291591);}function writeLog(_0x993048,_0x59a64d,_0x1eacbc){return logger['info'](util[_0x7b9a('0x7')](_0x7b9a('0x1a'),_0x993048,_0x59a64d[_0x7b9a('0x8')],_0x1eacbc));}exports['isAgentAvailable']=function(_0x411eea,_0x7f8972,_0x5705b2,_0x35aca7){if(_0x7f8972[_0x7b9a('0x1b')]){writeLog(_0x411eea,_0x7f8972,_0x7b9a('0x1c'));return![];}if(!_0x7f8972[_0x7b9a('0x1d')]){writeLog(_0x411eea,_0x7f8972,_0x7b9a('0x1e'));return![];}if(_0x7f8972[_0x5705b2+'Pause']){writeLog(_0x411eea,_0x7f8972,_0x7b9a('0x1f'));return![];}if(_0x35aca7&&_0x7f8972[_0x7b9a('0x20')](_0x5705b2+'Capacity')&&_0x7f8972[_0x7b9a('0x20')](_0x5705b2+'CurrentCapacity')){if(_0x7f8972[_0x5705b2+_0x7b9a('0x21')]>0x0&&_0x7f8972[_0x5705b2+_0x7b9a('0x22')]>=_0x7f8972[_0x5705b2+'Capacity']){writeLog(_0x411eea,_0x7f8972,_0x5705b2['toUpperCase']()+_0x7b9a('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x54df8a,_0x1969f4,_0x58fec8,_0x5be740,_0x3847b4){return sendNotification(!![],_0x54df8a,_0x1969f4,_0x58fec8,_0x5be740,_0x3847b4);};exports['hideNotification']=function(_0x5c89b6,_0x314b6d,_0x4fee38,_0x1553ae,_0x2e6144){return sendNotification(![],_0x5c89b6,_0x314b6d,_0x4fee38,_0x1553ae,_0x2e6144);};exports[_0x7b9a('0x24')]=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 df8a4d8..64d7f12 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 _0xe705=['validate','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify'];(function(_0x2f9ced,_0x555f9d){var _0x4dc29c=function(_0x3ac136){while(--_0x3ac136){_0x2f9ced['push'](_0x2f9ced['shift']());}};_0x4dc29c(++_0x555f9d);}(_0xe705,0xfd));var _0x5e70=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xe705[_0x58547b];return _0x1d3fd2;};'use strict';var schema=require(_0x5e70('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x5e70('0x1'));var logger=require('../../../../config/logger')(_0x5e70('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x5e70('0x3')}});exports[_0x5e70('0x4')]=function(_0xa16e0f,_0x25f6b1){return function(_0x2fea48){try{var _0x47d8a5={'command':_0x25f6b1[0x0]};var _0xabced3=system[_0x5e70('0x0')](_0x47d8a5,{'typecast':!![]});if(_0xabced3[_0x5e70('0x5')]){logger[_0x5e70('0x6')](_0x5e70('0x7'),_0xa16e0f,_[_0x5e70('0x8')](_0xabced3,_0x5e70('0x9'))['join'](',\x20'));logger[_0x5e70('0xa')](_0x5e70('0xb'),_0xa16e0f);_0x2fea48[_0x5e70('0xc')]();}else{var _0xfe63a1=this;var _0x36f6b0=utils[_0x5e70('0xd')](_0x25f6b1[0x0],this);logger[_0x5e70('0xa')](_0x5e70('0xe'),_0xa16e0f,_0x36f6b0);sh[_0x5e70('0xf')](_[_0x5e70('0x10')](_0x36f6b0),function(_0x1b65d9,_0x11f117){logger[_0x5e70('0xa')](_0x5e70('0x11'),_0xa16e0f,_0x1b65d9);if(_0x1b65d9==0x0){var _0x4afadd=_0x11f117[_0x5e70('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x5e70('0x13')](_0x25f6b1[0x1])||_['isEmpty'](_0x25f6b1[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0xa16e0f);_0xfe63a1['body'][_0x25f6b1[0x1]]=_0x4afadd;}else{logger[_0x5e70('0xa')](_0x5e70('0x14'),_0xa16e0f,_0x25f6b1[0x1],_0x4afadd);_0xfe63a1['body'][_0x25f6b1[0x1]]=_0x4afadd;}}_0x2fea48[_0x5e70('0xc')]();});}}catch(_0x5112bb){logger['error'](_0x5e70('0x7'),_0xa16e0f,_[_0x5e70('0x15')](_0x5112bb)?JSON[_0x5e70('0x16')](_0x5112bb):_0x5112bb);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xa16e0f);_0x2fea48['next']();}};}; \ No newline at end of file +var _0xae4c=['length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xae4c,0x95));var _0xcae4=function(_0x16848e,_0x8effbf){_0x16848e=_0x16848e-0x0;var _0x1c459c=_0xae4c[_0x16848e];return _0x1c459c;};'use strict';var schema=require(_0xcae4('0x0'));var sh=require('shelljs');var _=require(_0xcae4('0x1'));var utils=require(_0xcae4('0x2'));var logger=require(_0xcae4('0x3'))(_0xcae4('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xcae4('0x5')}});exports[_0xcae4('0x6')]=function(_0x2fb344,_0x5f4ba8){return function(_0x158602){try{var _0x3b93c6={'command':_0x5f4ba8[0x0]};var _0x5cf55e=system['validate'](_0x3b93c6,{'typecast':!![]});if(_0x5cf55e[_0xcae4('0x7')]){logger[_0xcae4('0x8')](_0xcae4('0x9'),_0x2fb344,_[_0xcae4('0xa')](_0x5cf55e,_0xcae4('0xb'))['join'](',\x20'));logger[_0xcae4('0xc')](_0xcae4('0xd'),_0x2fb344);_0x158602['next']();}else{var _0xf98a11=this;var _0x2a3b9a=utils[_0xcae4('0xe')](_0x5f4ba8[0x0],this);logger[_0xcae4('0xc')](_0xcae4('0xf'),_0x2fb344,_0x2a3b9a);sh[_0xcae4('0x10')](_[_0xcae4('0x11')](_0x2a3b9a),function(_0xe5cbf7,_0x295db6){logger[_0xcae4('0xc')](_0xcae4('0x12'),_0x2fb344,_0xe5cbf7);if(_0xe5cbf7==0x0){var _0x2ad860=_0x295db6[_0xcae4('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5f4ba8[0x1])||_['isEmpty'](_0x5f4ba8[0x1])){logger['info'](_0xcae4('0x14'),_0x2fb344);_0xf98a11[_0xcae4('0x15')][_0x5f4ba8[0x1]]=_0x2ad860;}else{logger[_0xcae4('0xc')](_0xcae4('0x16'),_0x2fb344,_0x5f4ba8[0x1],_0x2ad860);_0xf98a11[_0xcae4('0x15')][_0x5f4ba8[0x1]]=_0x2ad860;}}_0x158602[_0xcae4('0x17')]();});}}catch(_0x518b9b){logger[_0xcae4('0x8')]('[%s][SYSTEM]\x20%s',_0x2fb344,_[_0xcae4('0x18')](_0x518b9b)?JSON[_0xcae4('0x19')](_0x518b9b):_0x518b9b);logger[_0xcae4('0xc')](_0xcae4('0xd'),_0x2fb344);_0x158602[_0xcae4('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 75a6d02..3e685b3 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 _0xc2a9=['consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x222127,_0x4b8ea0){var _0x1ad7ad=function(_0xcf93b9){while(--_0xcf93b9){_0x222127['push'](_0x222127['shift']());}};_0x1ad7ad(++_0x4b8ea0);}(_0xc2a9,0x148));var _0x9c2a=function(_0x5cd65a,_0x301f8f){_0x5cd65a=_0x5cd65a-0x0;var _0x1606f8=_0xc2a9[_0x5cd65a];return _0x1606f8;};'use strict';var schema=require(_0x9c2a('0x0'));var _=require(_0x9c2a('0x1'));var rpc={'chatInteraction':require(_0x9c2a('0x2')),'openchannelInteraction':require(_0x9c2a('0x3')),'smsInteraction':require(_0x9c2a('0x4')),'mailInteraction':require(_0x9c2a('0x5')),'faxInteraction':require(_0x9c2a('0x6')),'whatsappInteraction':require(_0x9c2a('0x7'))};var logger=require(_0x9c2a('0x8'))(_0x9c2a('0x9'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9c2a('0xa')]=function(_0x2d9be9,_0x1b7d63,_0x50f98b,_0x22b96){return function(_0x2321e8){try{var _0x4a1c49={'tag':_0x1b7d63[0x0]};var _0x2695bd=tag[_0x9c2a('0x0')](_0x4a1c49,{'typecast':!![]});if(_0x2695bd['length']){logger[_0x9c2a('0xb')](_0x9c2a('0xc'),_0x2d9be9,_[_0x9c2a('0xd')](_0x2695bd,_0x9c2a('0xe'))[_0x9c2a('0xf')](',\x20'));logger[_0x9c2a('0x10')](_0x9c2a('0x11'),_0x2d9be9);_0x2321e8[_0x9c2a('0x12')]();}else{var _0x2dfa60={'ids':[_0x1b7d63[0x0]]};if(rpc[_0x22b96[_0x9c2a('0x13')]+_0x9c2a('0x14')]){rpc[_0x22b96[_0x9c2a('0x13')]+_0x9c2a('0x14')]['addTags'](_0x22b96[_0x9c2a('0x15')]['id'],_0x2dfa60)['then'](function(_0x3bc6d3){logger['info'](_0x9c2a('0x16'),_0x2d9be9,_0x1b7d63[0x1],_0x22b96[_0x9c2a('0x13')],_0x22b96[_0x9c2a('0x15')]['id']);})['catch'](function(_0x3a43ea){logger[_0x9c2a('0xb')]('[%s][TAG]\x20%s',_0x2d9be9,JSON[_0x9c2a('0x17')](_0x3a43ea));logger[_0x9c2a('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2d9be9);})[_0x9c2a('0x18')](function(){_0x2321e8['next']();});}}}catch(_0x2ec049){logger[_0x9c2a('0xb')](_0x9c2a('0xc'),_0x2d9be9,_[_0x9c2a('0x19')](_0x2ec049)?JSON[_0x9c2a('0x17')](_0x2ec049):_0x2ec049);logger[_0x9c2a('0x10')](_0x9c2a('0x11'),_0x2d9be9);_0x2321e8['next']();}};}; \ No newline at end of file +var _0xed89=['next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x52a902,_0x1a0c34){var _0x2ff326=function(_0x68b9ec){while(--_0x68b9ec){_0x52a902['push'](_0x52a902['shift']());}};_0x2ff326(++_0x1a0c34);}(_0xed89,0xb1));var _0x9ed8=function(_0x3a3473,_0x49e97e){_0x3a3473=_0x3a3473-0x0;var _0x32122f=_0xed89[_0x3a3473];return _0x32122f;};'use strict';var schema=require(_0x9ed8('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9ed8('0x1')),'smsInteraction':require(_0x9ed8('0x2')),'mailInteraction':require(_0x9ed8('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x9ed8('0x4'));var tag=schema({'tag':{'type':_0x9ed8('0x5'),'required':!![],'message':_0x9ed8('0x6')}});exports[_0x9ed8('0x7')]=function(_0x51113a,_0x462e5b,_0xb151fa,_0x10a69f){return function(_0x1d78ef){try{var _0x5ddd1d={'tag':_0x462e5b[0x0]};var _0x5a3f8c=tag[_0x9ed8('0x0')](_0x5ddd1d,{'typecast':!![]});if(_0x5a3f8c[_0x9ed8('0x8')]){logger[_0x9ed8('0x9')](_0x9ed8('0xa'),_0x51113a,_[_0x9ed8('0xb')](_0x5a3f8c,'message')[_0x9ed8('0xc')](',\x20'));logger[_0x9ed8('0xd')](_0x9ed8('0xe'),_0x51113a);_0x1d78ef[_0x9ed8('0xf')]();}else{var _0x4c0b13={'ids':[_0x462e5b[0x0]]};if(rpc[_0x10a69f[_0x9ed8('0x10')]+_0x9ed8('0x11')]){rpc[_0x10a69f[_0x9ed8('0x10')]+_0x9ed8('0x11')][_0x9ed8('0x12')](_0x10a69f[_0x9ed8('0x13')]['id'],_0x4c0b13)['then'](function(_0x15b5ad){logger[_0x9ed8('0xd')](_0x9ed8('0x14'),_0x51113a,_0x462e5b[0x1],_0x10a69f[_0x9ed8('0x10')],_0x10a69f['interaction']['id']);})[_0x9ed8('0x15')](function(_0x2a9376){logger[_0x9ed8('0x9')](_0x9ed8('0xa'),_0x51113a,JSON[_0x9ed8('0x16')](_0x2a9376));logger[_0x9ed8('0xd')](_0x9ed8('0xe'),_0x51113a);})['finally'](function(){_0x1d78ef[_0x9ed8('0xf')]();});}}}catch(_0x24e2db){logger['error'](_0x9ed8('0xa'),_0x51113a,_[_0x9ed8('0x17')](_0x24e2db)?JSON[_0x9ed8('0x16')](_0x24e2db):_0x24e2db);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x51113a);_0x1d78ef[_0x9ed8('0xf')]();}};}; \ 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 e83d78d..6838d70 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 _0x44d4=['render','message','account','interaction','list','mustache'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x44d4,0x161));var _0x444d=function(_0x1fece6,_0x11093d){_0x1fece6=_0x1fece6-0x0;var _0x474b0c=_0x44d4[_0x1fece6];return _0x474b0c;};'use strict';var Mustache=require(_0x444d('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x5c12f3,_0x1c1a07){return Mustache[_0x444d('0x1')](_0x5c12f3,_['merge'](_0x1c1a07['body'],{'contact':_0x1c1a07['contact'],'message':_0x1c1a07[_0x444d('0x2')],'account':_0x1c1a07[_0x444d('0x3')],'interaction':_0x1c1a07[_0x444d('0x4')],'list':_0x1c1a07[_0x444d('0x5')]}))||'';}}; \ No newline at end of file +var _0x710e=['message','account','mustache','render','merge','body'];(function(_0x5472ec,_0x25951f){var _0x423275=function(_0x104013){while(--_0x104013){_0x5472ec['push'](_0x5472ec['shift']());}};_0x423275(++_0x25951f);}(_0x710e,0xb6));var _0xe710=function(_0x36565c,_0x3dc595){_0x36565c=_0x36565c-0x0;var _0xf6538f=_0x710e[_0x36565c];return _0xf6538f;};'use strict';var Mustache=require(_0xe710('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x387ff4,_0x44db10){return Mustache[_0xe710('0x1')](_0x387ff4,_[_0xe710('0x2')](_0x44db10[_0xe710('0x3')],{'contact':_0x44db10['contact'],'message':_0x44db10[_0xe710('0x4')],'account':_0x44db10[_0xe710('0x5')],'interaction':_0x44db10['interaction'],'list':_0x44db10['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index a23bbd8..97c17dd 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 _0x5b8c=['rules','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','split','push','join','dialogflow','appdata','amazonlex','slice','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','emit','end','QueueReport','UserId','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b8c,0x112));var _0xc5b8=function(_0x19df8e,_0xc8482){_0x19df8e=_0x19df8e-0x0;var _0x378598=_0x5b8c[_0x19df8e];return _0x378598;};'use strict';var _=require(_0xc5b8('0x0'));var util=require(_0xc5b8('0x1'));var path=require(_0xc5b8('0x2'));var fs=require('fs');var jayson=require(_0xc5b8('0x3'));var BPromise=require(_0xc5b8('0x4'));var uuid=require(_0xc5b8('0x5'));var config=require(_0xc5b8('0x6'));var logger=require(_0xc5b8('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xc5b8('0x8')),'mailQueueReport':require(_0xc5b8('0x9')),'chatQueueReport':require(_0xc5b8('0xa')),'smsQueueReport':require(_0xc5b8('0xb')),'faxQueueReport':require(_0xc5b8('0xc')),'whatsappQueueReport':require(_0xc5b8('0xd'))};var RuleEngine=require(_0xc5b8('0xe'));function getId(_0x333fb5,_0x580830,_0x1132bc){return util[_0xc5b8('0xf')](_0xc5b8('0x10'),_0x333fb5,_0x580830||0x0,_0x1132bc||0x0);}function getIntervals(_0x5d8966,_0x296c94){var _0x1f508e=[];if(!_[_0xc5b8('0x11')](_0x296c94[_0xc5b8('0x12')])&&!_['isNil'](_0x5d8966[_0x296c94[_0xc5b8('0x12')]])&&!_[_0xc5b8('0x11')](_0x5d8966[_0x296c94[_0xc5b8('0x12')]][_0xc5b8('0x13')])){_0x1f508e=_[_0xc5b8('0x14')](_0x5d8966[_0x296c94[_0xc5b8('0x12')]]['Intervals'],_0xc5b8('0x15'));}else if(!_[_0xc5b8('0x11')](_0x296c94['interval'])){_0x1f508e=[_0x296c94[_0xc5b8('0x15')]];}return _0x1f508e;}exports[_0xc5b8('0x16')]=function(_0x375c23){_0x375c23[_0xc5b8('0x17')]={};return new BPromise(function(_0xfff7b6,_0x2d13b3){var _0x1e9611={'Start':function(_0x2c647e){var _0x33c459=this;return new Promise(function(_0x46c126,_0x64d51e){if(_0x2c647e){try{var _0x3c6cdc=[];var _0x59c639=getId(_0x2c647e['channel'],_0x2c647e[_0xc5b8('0x18')]?_0x2c647e[_0xc5b8('0x18')]['id']:0x0,_0x2c647e[_0xc5b8('0x19')]?_0x2c647e['interaction']['id']:0x0);if(_0x2c647e[_0xc5b8('0x1a')]&&_[_0xc5b8('0x1b')](_0x2c647e[_0xc5b8('0x1a')])&&_0x2c647e[_0xc5b8('0x1a')][_0xc5b8('0x1c')]){for(var _0x26d9d=0x0;_0x26d9d<_0x2c647e[_0xc5b8('0x1a')][_0xc5b8('0x1c')];_0x26d9d+=0x1){var _0x34dc0e=_0x2c647e[_0xc5b8('0x1a')][_0x26d9d];if(fs[_0xc5b8('0x1d')](path['join'](__dirname,'applications',_0x34dc0e[_0xc5b8('0x1e')]+_0xc5b8('0x1f')))){var _0x5e9541=[];switch(_0x34dc0e['app'][_0xc5b8('0x20')]()){case _0xc5b8('0x21'):var _0x2b4a07=_0x34dc0e['appdata'][_0xc5b8('0x22')](',');_0x5e9541['push'](_0x2b4a07[0x0]);_0x5e9541[_0xc5b8('0x23')](_0x2b4a07['slice'](0x1,_0x2b4a07[_0xc5b8('0x1c')])[_0xc5b8('0x24')](','));break;case _0xc5b8('0x25'):var _0x619d43=_0x34dc0e[_0xc5b8('0x26')][_0xc5b8('0x22')](',');_0x5e9541['push'](_0x619d43[0x0]);_0x5e9541[_0xc5b8('0x23')](_0x619d43[0x1]);_0x5e9541['push'](_0x619d43['slice'](0x2,_0x619d43['length'])[_0xc5b8('0x24')](','));break;case _0xc5b8('0x27'):var _0x12bdbf=_0x34dc0e[_0xc5b8('0x26')][_0xc5b8('0x22')](',');_0x5e9541[_0xc5b8('0x23')](_0x12bdbf[0x0]);_0x5e9541[_0xc5b8('0x23')](_0x12bdbf[0x1]);_0x5e9541['push'](_0x12bdbf[0x2]);_0x5e9541[_0xc5b8('0x23')](_0x12bdbf[0x3]);_0x5e9541[_0xc5b8('0x23')](_0x12bdbf[_0xc5b8('0x28')](0x4,_0x12bdbf['length'])['join'](','));break;case'message':_0x5e9541[_0xc5b8('0x23')](_0x34dc0e[_0xc5b8('0x26')]);break;case _0xc5b8('0x29'):_0x5e9541['push'](_0x34dc0e[_0xc5b8('0x2a')]);_0x5e9541[_0xc5b8('0x23')](_0x34dc0e[_0xc5b8('0x26')]);break;default:_0x5e9541=_[_0xc5b8('0x11')](_0x34dc0e[_0xc5b8('0x26')])?[]:_0x34dc0e[_0xc5b8('0x26')][_0xc5b8('0x22')](',');}var _0xbe237={'id':util[_0xc5b8('0xf')](_0xc5b8('0x2b'),_0x59c639,_0x34dc0e['id'],_0x34dc0e[_0xc5b8('0x1e')]),'condition':require(_0xc5b8('0x2c'))[_0xc5b8('0x2d')](_0x59c639,getIntervals(_0x375c23[_0xc5b8('0x2e')],_0x34dc0e),_0x375c23),'consequence':require(_0xc5b8('0x2f')+_0x34dc0e['app'])[_0xc5b8('0x30')](_0x59c639,_0x5e9541,_0x375c23,_0x2c647e),'p':_0x34dc0e['priority']||0x0};logger[_0xc5b8('0x31')](_0xc5b8('0x32'),_0xbe237['id'],_0xc5b8('0x33'),getIntervals(_0x375c23[_0xc5b8('0x2e')],_0x34dc0e)['join'](_0xc5b8('0x34')));_0x3c6cdc[_0xc5b8('0x23')](_0xbe237);}else{logger[_0xc5b8('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x34dc0e[_0xc5b8('0x1e')]+'.js'));}}_0x375c23[_0xc5b8('0x17')][_0x59c639]=new RuleEngine(_0x3c6cdc);_0x375c23[_0xc5b8('0x17')][_0x59c639][_0xc5b8('0x36')](_0x2c647e,function(_0x283d50){logger[_0xc5b8('0x31')](_0xc5b8('0x37'),JSON['stringify'](_0x283d50[_0xc5b8('0x38')]));if(_0x375c23[_0xc5b8('0x17')][_0x59c639]){_0x375c23[_0xc5b8('0x17')][_0x59c639]['emit'](_0xc5b8('0x39'));}});return _0x46c126({'code':0xc8,'message':_0x2c647e});}else{logger[_0xc5b8('0x31')](_0xc5b8('0x3a'));return _0x46c126({'code':0xc8,'message':_0x2c647e});}}catch(_0x147788){logger[_0xc5b8('0x35')](_0x147788[_0xc5b8('0x3b')]);return _0x64d51e(_0x33c459[_0xc5b8('0x35')](0x1f4,_0x147788));}}return _0x64d51e(_0xc5b8('0x3c'));});},'AcceptMessage':function(_0x4fab5c){var _0x5d2dc6=this;return new Promise(function(_0x43554a,_0x519734){if(_0x4fab5c['message']&&_0x4fab5c['message']['id']){try{var _0x181d99=getId(_0x4fab5c[_0xc5b8('0x3d')],_0x4fab5c['message']?_0x4fab5c[_0xc5b8('0x18')]['id']:0x0,_0x4fab5c['interaction']?_0x4fab5c[_0xc5b8('0x19')]['id']:0x0);if(_0x375c23[_0xc5b8('0x17')][_0x181d99]){_0x375c23['rules'][_0x181d99][_0xc5b8('0x3e')](_0xc5b8('0x3f'));if(rpc[_0x4fab5c[_0xc5b8('0x3d')]+_0xc5b8('0x40')]){rpc[_0x4fab5c[_0xc5b8('0x3d')]+_0xc5b8('0x40')]['update'](_0x181d99,{'UserId':_0x4fab5c['message'][_0xc5b8('0x41')]})['catch'](function(_0x2838d5){logger[_0xc5b8('0x35')]('error\x20update\x20queue\x20report');});}}return _0x43554a({'code':0xc8,'message':_0x4fab5c});}catch(_0x565683){logger[_0xc5b8('0x35')](_0x565683[_0xc5b8('0x3b')]);return _0x519734(_0x5d2dc6[_0xc5b8('0x35')](0x1f4,_0x565683));}}logger['error'](_0xc5b8('0x42'));return _0x519734(_0x5d2dc6[_0xc5b8('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xa69906){var _0x339fac=this;return new Promise(function(_0xece42b,_0x39c12e){if(_0xa69906[_0xc5b8('0x43')]&&_0xa69906[_0xc5b8('0x43')]['id']){try{if(_0x375c23[_0xc5b8('0x44')][_0xa69906[_0xc5b8('0x43')]['id']]){_0x375c23[_0xc5b8('0x44')][_0xa69906[_0xc5b8('0x43')]['id']][_0xc5b8('0x45')]=![];_0x375c23[_0xc5b8('0x44')][_0xa69906[_0xc5b8('0x43')]['id']][_0xc5b8('0x46')]=undefined;}return _0xece42b({'code':0xc8,'message':_0xa69906});}catch(_0x27c675){logger[_0xc5b8('0x35')](_0x27c675[_0xc5b8('0x3b')]);return _0x39c12e(_0x339fac['error'](0x1f4,_0x27c675));}}logger[_0xc5b8('0x35')](_0xc5b8('0x42'));return _0x39c12e(_0x339fac[_0xc5b8('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x213fc3){var _0x3de859=this;return new Promise(function(_0x380c72,_0x1e5db6){if(_0x213fc3['channel']&&_0x213fc3[_0xc5b8('0x19')]&&_0x213fc3['interaction']['id']){try{var _0x25571c=getId(_0x213fc3[_0xc5b8('0x3d')],_0x213fc3['message']?_0x213fc3[_0xc5b8('0x18')]['id']:0x0,_0x213fc3[_0xc5b8('0x19')]?_0x213fc3[_0xc5b8('0x19')]['id']:0x0);if(_0x375c23['rules'][_0x25571c]){_0x375c23[_0xc5b8('0x17')][_0x25571c]['emit'](_0xc5b8('0x3f'));}return _0x380c72({'code':0xc8,'message':_0x213fc3});}catch(_0x1a32d4){logger[_0xc5b8('0x35')](_0x1a32d4[_0xc5b8('0x3b')]);return _0x1e5db6(_0x3de859['error'](0x1f4,_0x1a32d4));}}logger['error'](_0xc5b8('0x42'));return _0x1e5db6(_0x3de859[_0xc5b8('0x35')](0x1f4,_0xc5b8('0x42')));});},'AgentCapacity':function(_0x1a4e1f){var _0x39e24f=this;return new Promise(function(_0x391bf4,_0x4273da){if(_0x375c23[_0xc5b8('0x44')][_0xc5b8('0x47')](_0x1a4e1f['id'])){for(var _0x203804 in _0x1a4e1f[_0xc5b8('0x48')]){if(_0x1a4e1f[_0xc5b8('0x48')]['hasOwnProperty'](_0x203804)){if(_0x375c23[_0xc5b8('0x44')][_0x1a4e1f['id']][_0xc5b8('0x47')](_0x203804+_0xc5b8('0x49'))){_0x375c23[_0xc5b8('0x44')][_0x1a4e1f['id']][_0x203804+_0xc5b8('0x49')]=parseInt(_0x1a4e1f[_0xc5b8('0x48')][_0x203804],0xa);}}}_0x375c23[_0xc5b8('0x44')][_0x1a4e1f['id']][_0xc5b8('0x4a')]();return _0x391bf4({'code':0xc8,'message':_0x375c23[_0xc5b8('0x44')][_0x1a4e1f['id']]});}else{return _0x4273da(_0x39e24f[_0xc5b8('0x35')](0x1f4,_0xc5b8('0x4b')));}});},'Agents':function(_0x42c5d1){return new Promise(function(_0x5e2e28,_0x2c5a54){var _0x382111=_['values'](_0x375c23[_0xc5b8('0x44')]);_0x5e2e28({'count':_0x382111['length'],'rows':_0x382111});});},'ChatQueues':function(_0x7f9676){return new Promise(function(_0x5390e7,_0x10a431){var _0x11257e=[];for(var _0x5a6ea0 in _0x375c23['chatQueues']){if(_0x375c23[_0xc5b8('0x4c')][_0xc5b8('0x47')](_0x5a6ea0)){var _0xadd252=_0x375c23[_0xc5b8('0x4c')][_0x5a6ea0];var _0x152819={'id':_0xadd252['id'],'available':_0xadd252[_0xc5b8('0x4d')],'loggedIn':_0xadd252[_0xc5b8('0x4e')],'name':_0xadd252[_0xc5b8('0x4f')],'paused':_0xadd252['paused'],'waiting':_0xadd252[_0xc5b8('0x50')]};_0x11257e[_0xc5b8('0x23')](_0x152819);}}_0x5390e7({'count':_0x11257e[_0xc5b8('0x1c')],'rows':_0x11257e});});},'MailQueues':function(_0x426637){return new Promise(function(_0x376e69,_0x5e4d7a){var _0x4c0be0=[];for(var _0x47e854 in _0x375c23[_0xc5b8('0x51')]){if(_0x375c23[_0xc5b8('0x51')][_0xc5b8('0x47')](_0x47e854)){var _0x207c50=_0x375c23[_0xc5b8('0x51')][_0x47e854];var _0xe64e4c={'id':_0x207c50['id'],'available':_0x207c50[_0xc5b8('0x4d')],'loggedIn':_0x207c50['loggedIn'],'name':_0x207c50[_0xc5b8('0x4f')],'paused':_0x207c50[_0xc5b8('0x52')],'waiting':_0x207c50[_0xc5b8('0x50')]};_0x4c0be0[_0xc5b8('0x23')](_0xe64e4c);}}_0x376e69({'count':_0x4c0be0[_0xc5b8('0x1c')],'rows':_0x4c0be0});});},'OpenchannelQueues':function(_0x2ca5a3){return new Promise(function(_0x452ea7,_0x2b852e){var _0x708a7c=[];for(var _0x33e4af in _0x375c23[_0xc5b8('0x53')]){if(_0x375c23['openchannelQueues'][_0xc5b8('0x47')](_0x33e4af)){var _0xaa08f3=_0x375c23[_0xc5b8('0x53')][_0x33e4af];var _0x1715fd={'id':_0xaa08f3['id'],'available':_0xaa08f3[_0xc5b8('0x4d')],'loggedIn':_0xaa08f3[_0xc5b8('0x4e')],'name':_0xaa08f3['name'],'paused':_0xaa08f3[_0xc5b8('0x52')],'waiting':_0xaa08f3[_0xc5b8('0x50')]};_0x708a7c[_0xc5b8('0x23')](_0x1715fd);}}_0x452ea7({'count':_0x708a7c[_0xc5b8('0x1c')],'rows':_0x708a7c});});},'SmsQueues':function(_0x48e5d0){return new Promise(function(_0x1f4d41,_0x3bd405){var _0xf7246c=[];for(var _0x57fa29 in _0x375c23[_0xc5b8('0x54')]){if(_0x375c23[_0xc5b8('0x54')][_0xc5b8('0x47')](_0x57fa29)){var _0x4c3232=_0x375c23[_0xc5b8('0x54')][_0x57fa29];var _0x58666a={'id':_0x4c3232['id'],'available':_0x4c3232[_0xc5b8('0x4d')],'loggedIn':_0x4c3232[_0xc5b8('0x4e')],'name':_0x4c3232[_0xc5b8('0x4f')],'paused':_0x4c3232['paused'],'waiting':_0x4c3232[_0xc5b8('0x50')]};_0xf7246c[_0xc5b8('0x23')](_0x58666a);}}_0x1f4d41({'count':_0xf7246c['length'],'rows':_0xf7246c});});},'FaxQueues':function(_0xd6a106){return new Promise(function(_0x335636,_0x29603b){var _0x8f25ff=[];for(var _0x28e172 in _0x375c23[_0xc5b8('0x55')]){if(_0x375c23[_0xc5b8('0x55')][_0xc5b8('0x47')](_0x28e172)){var _0x2b411f=_0x375c23['faxQueues'][_0x28e172];var _0x51f53c={'id':_0x2b411f['id'],'available':_0x2b411f[_0xc5b8('0x4d')],'loggedIn':_0x2b411f[_0xc5b8('0x4e')],'name':_0x2b411f[_0xc5b8('0x4f')],'paused':_0x2b411f[_0xc5b8('0x52')],'waiting':_0x2b411f[_0xc5b8('0x50')]};_0x8f25ff['push'](_0x51f53c);}}_0x335636({'count':_0x8f25ff[_0xc5b8('0x1c')],'rows':_0x8f25ff});});},'WhatsappQueues':function(_0x24fa15){return new Promise(function(_0x486ae5,_0xf23db){var _0x257915=[];for(var _0x50c2bf in _0x375c23[_0xc5b8('0x56')]){if(_0x375c23[_0xc5b8('0x56')][_0xc5b8('0x47')](_0x50c2bf)){var _0x67d4db=_0x375c23['whatsappQueues'][_0x50c2bf];var _0x78d6da={'id':_0x67d4db['id'],'available':_0x67d4db[_0xc5b8('0x4d')],'loggedIn':_0x67d4db[_0xc5b8('0x4e')],'name':_0x67d4db[_0xc5b8('0x4f')],'paused':_0x67d4db['paused'],'waiting':_0x67d4db[_0xc5b8('0x50')]};_0x257915['push'](_0x78d6da);}}_0x486ae5({'count':_0x257915[_0xc5b8('0x1c')],'rows':_0x257915});});},'ChatQueuesWaitingInteractions':function(_0x5bc036){return new Promise(function(_0x368188,_0x1902e8){var _0x4af47b=_['values'](_0x375c23[_0xc5b8('0x57')]);_0x368188({'count':_0x4af47b[_0xc5b8('0x1c')],'rows':_0x4af47b});});},'MailQueuesWaitingInteractions':function(_0x1f7779){return new Promise(function(_0x1a8cc8,_0x2be358){var _0x1747a3=_[_0xc5b8('0x58')](_0x375c23[_0xc5b8('0x59')]);_0x1a8cc8({'count':_0x1747a3[_0xc5b8('0x1c')],'rows':_0x1747a3});});},'OpenchannelQueuesWaitingInteractions':function(_0x88255d){return new Promise(function(_0x1911e4,_0x4ab352){var _0x1f1ead=_[_0xc5b8('0x58')](_0x375c23[_0xc5b8('0x5a')]);_0x1911e4({'count':_0x1f1ead['length'],'rows':_0x1f1ead});});},'SmsQueuesWaitingInteractions':function(_0x3e5368){return new Promise(function(_0x77a21f,_0x25715c){var _0x7b739=_[_0xc5b8('0x58')](_0x375c23[_0xc5b8('0x5b')]);_0x77a21f({'count':_0x7b739[_0xc5b8('0x1c')],'rows':_0x7b739});});},'FaxQueuesWaitingInteractions':function(_0x408e92){return new Promise(function(_0x2a8538,_0x3adc9f){var _0x1a4a8a=_['values'](_0x375c23[_0xc5b8('0x5c')]);_0x2a8538({'count':_0x1a4a8a[_0xc5b8('0x1c')],'rows':_0x1a4a8a});});},'WhatsappQueuesWaitingInteractions':function(_0x2079e8){return new Promise(function(_0x27d443,_0x49557d){var _0x5b65b7=_[_0xc5b8('0x58')](_0x375c23[_0xc5b8('0x5d')]);_0x27d443({'count':_0x5b65b7['length'],'rows':_0x5b65b7});});}};var _0x160098=jayson[_0xc5b8('0x5e')](_0x1e9611)['http']();_0x160098['on'](_0xc5b8('0x35'),function(_0x3ae810){logger[_0xc5b8('0x35')](JSON[_0xc5b8('0x5f')](_0x3ae810));return _0x2d13b3(_0x3ae810);});_0x160098[_0xc5b8('0x16')](0x232c,'127.0.0.1',function(){console[_0xc5b8('0x60')](_0xc5b8('0x61'),0x232c);return _0xfff7b6(_0xc5b8('0x62')+0x232c);});});}; \ No newline at end of file +var _0xe9b6=['UserId','catch','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/environment','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','TagId','%s:%s:%s','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','end','channel','QueueReport'];(function(_0x39de5f,_0x1d61ec){var _0x1940c7=function(_0x1bad59){while(--_0x1bad59){_0x39de5f['push'](_0x39de5f['shift']());}};_0x1940c7(++_0x1d61ec);}(_0xe9b6,0x79));var _0x6e9b=function(_0x4dfe8f,_0x4c7b55){_0x4dfe8f=_0x4dfe8f-0x0;var _0x3fc202=_0xe9b6[_0x4dfe8f];return _0x3fc202;};'use strict';var _=require(_0x6e9b('0x0'));var util=require(_0x6e9b('0x1'));var path=require(_0x6e9b('0x2'));var fs=require('fs');var jayson=require(_0x6e9b('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require(_0x6e9b('0x4'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x6e9b('0x5')),'mailQueueReport':require(_0x6e9b('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x6e9b('0x7')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6e9b('0x8'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2096a7,_0x1d2d78,_0xdf1898){return util[_0x6e9b('0x9')](_0x6e9b('0xa'),_0x2096a7,_0x1d2d78||0x0,_0xdf1898||0x0);}function getIntervals(_0x2959a8,_0x3b538f){var _0x197bb3=[];if(!_[_0x6e9b('0xb')](_0x3b538f[_0x6e9b('0xc')])&&!_[_0x6e9b('0xb')](_0x2959a8[_0x3b538f[_0x6e9b('0xc')]])&&!_[_0x6e9b('0xb')](_0x2959a8[_0x3b538f[_0x6e9b('0xc')]][_0x6e9b('0xd')])){_0x197bb3=_['map'](_0x2959a8[_0x3b538f[_0x6e9b('0xc')]][_0x6e9b('0xd')],_0x6e9b('0xe'));}else if(!_[_0x6e9b('0xb')](_0x3b538f[_0x6e9b('0xe')])){_0x197bb3=[_0x3b538f[_0x6e9b('0xe')]];}return _0x197bb3;}exports[_0x6e9b('0xf')]=function(_0x49bc27){_0x49bc27['rules']={};return new BPromise(function(_0x1ab1e6,_0x567efe){var _0x2ac333={'Start':function(_0x474734){var _0x470447=this;return new Promise(function(_0x341712,_0x3b5061){if(_0x474734){try{var _0x40342b=[];var _0xf386f4=getId(_0x474734['channel'],_0x474734['message']?_0x474734[_0x6e9b('0x10')]['id']:0x0,_0x474734['interaction']?_0x474734[_0x6e9b('0x11')]['id']:0x0);if(_0x474734[_0x6e9b('0x12')]&&_[_0x6e9b('0x13')](_0x474734['applications'])&&_0x474734[_0x6e9b('0x12')][_0x6e9b('0x14')]){for(var _0x4e2d4f=0x0;_0x4e2d4f<_0x474734['applications'][_0x6e9b('0x14')];_0x4e2d4f+=0x1){var _0xa8a495=_0x474734['applications'][_0x4e2d4f];if(fs['existsSync'](path[_0x6e9b('0x15')](__dirname,_0x6e9b('0x12'),_0xa8a495[_0x6e9b('0x16')]+_0x6e9b('0x17')))){var _0x593e8d=[];switch(_0xa8a495[_0x6e9b('0x16')][_0x6e9b('0x18')]()){case _0x6e9b('0x19'):var _0x23ba13=_0xa8a495[_0x6e9b('0x1a')][_0x6e9b('0x1b')](',');_0x593e8d[_0x6e9b('0x1c')](_0x23ba13[0x0]);_0x593e8d[_0x6e9b('0x1c')](_0x23ba13[_0x6e9b('0x1d')](0x1,_0x23ba13[_0x6e9b('0x14')])[_0x6e9b('0x15')](','));break;case _0x6e9b('0x1e'):var _0x351203=_0xa8a495[_0x6e9b('0x1a')][_0x6e9b('0x1b')](',');_0x593e8d[_0x6e9b('0x1c')](_0x351203[0x0]);_0x593e8d[_0x6e9b('0x1c')](_0x351203[0x1]);_0x593e8d[_0x6e9b('0x1c')](_0x351203[_0x6e9b('0x1d')](0x2,_0x351203[_0x6e9b('0x14')])['join'](','));break;case _0x6e9b('0x1f'):var _0x1282be=_0xa8a495[_0x6e9b('0x1a')]['split'](',');_0x593e8d[_0x6e9b('0x1c')](_0x1282be[0x0]);_0x593e8d[_0x6e9b('0x1c')](_0x1282be[0x1]);_0x593e8d[_0x6e9b('0x1c')](_0x1282be[0x2]);_0x593e8d[_0x6e9b('0x1c')](_0x1282be[0x3]);_0x593e8d[_0x6e9b('0x1c')](_0x1282be[_0x6e9b('0x1d')](0x4,_0x1282be[_0x6e9b('0x14')])['join'](','));break;case _0x6e9b('0x10'):_0x593e8d['push'](_0xa8a495[_0x6e9b('0x1a')]);break;case'tag':_0x593e8d[_0x6e9b('0x1c')](_0xa8a495[_0x6e9b('0x20')]);_0x593e8d[_0x6e9b('0x1c')](_0xa8a495['appdata']);break;default:_0x593e8d=_[_0x6e9b('0xb')](_0xa8a495[_0x6e9b('0x1a')])?[]:_0xa8a495[_0x6e9b('0x1a')][_0x6e9b('0x1b')](',');}var _0x3d7c7a={'id':util[_0x6e9b('0x9')](_0x6e9b('0x21'),_0xf386f4,_0xa8a495['id'],_0xa8a495[_0x6e9b('0x16')]),'condition':require('./interval')[_0x6e9b('0x22')](_0xf386f4,getIntervals(_0x49bc27[_0x6e9b('0x23')],_0xa8a495),_0x49bc27),'consequence':require('./applications/'+_0xa8a495[_0x6e9b('0x16')])[_0x6e9b('0x24')](_0xf386f4,_0x593e8d,_0x49bc27,_0x474734),'p':_0xa8a495['priority']||0x0};logger[_0x6e9b('0x25')](_0x6e9b('0x26'),_0x3d7c7a['id'],_0x6e9b('0x27'),getIntervals(_0x49bc27[_0x6e9b('0x23')],_0xa8a495)['join']('\x20|\x20'));_0x40342b[_0x6e9b('0x1c')](_0x3d7c7a);}else{logger[_0x6e9b('0x28')](_0x6e9b('0x29'),path['join'](__dirname,'applications',_0xa8a495[_0x6e9b('0x16')]+'.js'));}}_0x49bc27[_0x6e9b('0x2a')][_0xf386f4]=new RuleEngine(_0x40342b);_0x49bc27['rules'][_0xf386f4]['execute'](_0x474734,function(_0x32b096){logger['info'](_0x6e9b('0x2b'),JSON[_0x6e9b('0x2c')](_0x32b096[_0x6e9b('0x2d')]));if(_0x49bc27[_0x6e9b('0x2a')][_0xf386f4]){_0x49bc27[_0x6e9b('0x2a')][_0xf386f4][_0x6e9b('0x2e')](_0x6e9b('0x2f'));}});return _0x341712({'code':0xc8,'message':_0x474734});}else{logger['info'](_0x6e9b('0x30'));return _0x341712({'code':0xc8,'message':_0x474734});}}catch(_0x3fbb17){logger[_0x6e9b('0x28')](_0x3fbb17[_0x6e9b('0x31')]);return _0x3b5061(_0x470447['error'](0x1f4,_0x3fbb17));}}return _0x3b5061('routing\x20is\x20empty');});},'AcceptMessage':function(_0xe62754){var _0xb3d5d3=this;return new Promise(function(_0x3a37d1,_0x1c26e5){if(_0xe62754[_0x6e9b('0x10')]&&_0xe62754[_0x6e9b('0x10')]['id']){try{var _0x59bdc1=getId(_0xe62754['channel'],_0xe62754['message']?_0xe62754[_0x6e9b('0x10')]['id']:0x0,_0xe62754['interaction']?_0xe62754[_0x6e9b('0x11')]['id']:0x0);if(_0x49bc27[_0x6e9b('0x2a')][_0x59bdc1]){_0x49bc27[_0x6e9b('0x2a')][_0x59bdc1][_0x6e9b('0x2e')](_0x6e9b('0x32'));if(rpc[_0xe62754[_0x6e9b('0x33')]+_0x6e9b('0x34')]){rpc[_0xe62754[_0x6e9b('0x33')]+_0x6e9b('0x34')]['update'](_0x59bdc1,{'UserId':_0xe62754['message'][_0x6e9b('0x35')]})[_0x6e9b('0x36')](function(_0x322202){logger[_0x6e9b('0x28')]('error\x20update\x20queue\x20report');});}}return _0x3a37d1({'code':0xc8,'message':_0xe62754});}catch(_0x4ce3ed){logger[_0x6e9b('0x28')](_0x4ce3ed[_0x6e9b('0x31')]);return _0x1c26e5(_0xb3d5d3[_0x6e9b('0x28')](0x1f4,_0x4ce3ed));}}logger[_0x6e9b('0x28')](_0x6e9b('0x37'));return _0x1c26e5(_0xb3d5d3[_0x6e9b('0x28')](0x1f4,_0x6e9b('0x37')));});},'RejectMessage':function(_0x53932a){var _0x2d0e40=this;return new Promise(function(_0x1f4a94,_0x252f6c){if(_0x53932a[_0x6e9b('0x38')]&&_0x53932a[_0x6e9b('0x38')]['id']){try{if(_0x49bc27['agents'][_0x53932a['agent']['id']]){_0x49bc27[_0x6e9b('0x39')][_0x53932a['agent']['id']][_0x6e9b('0x3a')]=![];_0x49bc27['agents'][_0x53932a['agent']['id']][_0x6e9b('0x3b')]=undefined;}return _0x1f4a94({'code':0xc8,'message':_0x53932a});}catch(_0x53d0c7){logger[_0x6e9b('0x28')](_0x53d0c7[_0x6e9b('0x31')]);return _0x252f6c(_0x2d0e40[_0x6e9b('0x28')](0x1f4,_0x53d0c7));}}logger['error'](_0x6e9b('0x37'));return _0x252f6c(_0x2d0e40[_0x6e9b('0x28')](0x1f4,_0x6e9b('0x37')));});},'AbandonInteraction':function(_0x3602a8){var _0x425e17=this;return new Promise(function(_0x561f40,_0x392a58){if(_0x3602a8[_0x6e9b('0x33')]&&_0x3602a8[_0x6e9b('0x11')]&&_0x3602a8['interaction']['id']){try{var _0x4ddfd0=getId(_0x3602a8[_0x6e9b('0x33')],_0x3602a8[_0x6e9b('0x10')]?_0x3602a8[_0x6e9b('0x10')]['id']:0x0,_0x3602a8[_0x6e9b('0x11')]?_0x3602a8['interaction']['id']:0x0);if(_0x49bc27['rules'][_0x4ddfd0]){_0x49bc27['rules'][_0x4ddfd0][_0x6e9b('0x2e')]('end');}return _0x561f40({'code':0xc8,'message':_0x3602a8});}catch(_0x3400ac){logger[_0x6e9b('0x28')](_0x3400ac[_0x6e9b('0x31')]);return _0x392a58(_0x425e17[_0x6e9b('0x28')](0x1f4,_0x3400ac));}}logger[_0x6e9b('0x28')](_0x6e9b('0x37'));return _0x392a58(_0x425e17[_0x6e9b('0x28')](0x1f4,_0x6e9b('0x37')));});},'AgentCapacity':function(_0x4cca10){var _0x1a9487=this;return new Promise(function(_0x3a9e0d,_0x2ef1f2){if(_0x49bc27['agents'][_0x6e9b('0x3c')](_0x4cca10['id'])){for(var _0x5c1c0a in _0x4cca10[_0x6e9b('0x3d')]){if(_0x4cca10['capacity'][_0x6e9b('0x3c')](_0x5c1c0a)){if(_0x49bc27['agents'][_0x4cca10['id']][_0x6e9b('0x3c')](_0x5c1c0a+'CurrentCapacity')){_0x49bc27[_0x6e9b('0x39')][_0x4cca10['id']][_0x5c1c0a+_0x6e9b('0x3e')]=parseInt(_0x4cca10[_0x6e9b('0x3d')][_0x5c1c0a],0xa);}}}_0x49bc27[_0x6e9b('0x39')][_0x4cca10['id']][_0x6e9b('0x3f')]();return _0x3a9e0d({'code':0xc8,'message':_0x49bc27[_0x6e9b('0x39')][_0x4cca10['id']]});}else{return _0x2ef1f2(_0x1a9487[_0x6e9b('0x28')](0x1f4,_0x6e9b('0x40')));}});},'Agents':function(_0x2ebffa){return new Promise(function(_0x555e00,_0x1e290b){var _0x457f4c=_[_0x6e9b('0x41')](_0x49bc27[_0x6e9b('0x39')]);_0x555e00({'count':_0x457f4c['length'],'rows':_0x457f4c});});},'ChatQueues':function(_0x2072d4){return new Promise(function(_0x3b4d59,_0x45c9a0){var _0x4a20b0=[];for(var _0x135f81 in _0x49bc27[_0x6e9b('0x42')]){if(_0x49bc27[_0x6e9b('0x42')][_0x6e9b('0x3c')](_0x135f81)){var _0x419ef7=_0x49bc27[_0x6e9b('0x42')][_0x135f81];var _0x50c8fc={'id':_0x419ef7['id'],'available':_0x419ef7[_0x6e9b('0x43')],'loggedIn':_0x419ef7['loggedIn'],'name':_0x419ef7[_0x6e9b('0x44')],'paused':_0x419ef7[_0x6e9b('0x45')],'waiting':_0x419ef7[_0x6e9b('0x46')]};_0x4a20b0['push'](_0x50c8fc);}}_0x3b4d59({'count':_0x4a20b0[_0x6e9b('0x14')],'rows':_0x4a20b0});});},'MailQueues':function(_0x231860){return new Promise(function(_0x417e3f,_0x48c8ea){var _0x12d30=[];for(var _0x1f3a70 in _0x49bc27[_0x6e9b('0x47')]){if(_0x49bc27[_0x6e9b('0x47')][_0x6e9b('0x3c')](_0x1f3a70)){var _0x2936fb=_0x49bc27[_0x6e9b('0x47')][_0x1f3a70];var _0x3bf957={'id':_0x2936fb['id'],'available':_0x2936fb[_0x6e9b('0x43')],'loggedIn':_0x2936fb[_0x6e9b('0x48')],'name':_0x2936fb[_0x6e9b('0x44')],'paused':_0x2936fb[_0x6e9b('0x45')],'waiting':_0x2936fb[_0x6e9b('0x46')]};_0x12d30[_0x6e9b('0x1c')](_0x3bf957);}}_0x417e3f({'count':_0x12d30[_0x6e9b('0x14')],'rows':_0x12d30});});},'OpenchannelQueues':function(_0x4ae07a){return new Promise(function(_0x4f5bcc,_0x2710ca){var _0x465912=[];for(var _0x272d71 in _0x49bc27[_0x6e9b('0x49')]){if(_0x49bc27[_0x6e9b('0x49')][_0x6e9b('0x3c')](_0x272d71)){var _0x2efa5d=_0x49bc27['openchannelQueues'][_0x272d71];var _0x358be8={'id':_0x2efa5d['id'],'available':_0x2efa5d[_0x6e9b('0x43')],'loggedIn':_0x2efa5d[_0x6e9b('0x48')],'name':_0x2efa5d[_0x6e9b('0x44')],'paused':_0x2efa5d['paused'],'waiting':_0x2efa5d[_0x6e9b('0x46')]};_0x465912['push'](_0x358be8);}}_0x4f5bcc({'count':_0x465912[_0x6e9b('0x14')],'rows':_0x465912});});},'SmsQueues':function(_0x2edf91){return new Promise(function(_0x4a52f1,_0x5d4225){var _0x4ba2fb=[];for(var _0x5c1887 in _0x49bc27[_0x6e9b('0x4a')]){if(_0x49bc27['smsQueues']['hasOwnProperty'](_0x5c1887)){var _0x531a49=_0x49bc27['smsQueues'][_0x5c1887];var _0x497a8e={'id':_0x531a49['id'],'available':_0x531a49['available'],'loggedIn':_0x531a49[_0x6e9b('0x48')],'name':_0x531a49['name'],'paused':_0x531a49[_0x6e9b('0x45')],'waiting':_0x531a49[_0x6e9b('0x46')]};_0x4ba2fb[_0x6e9b('0x1c')](_0x497a8e);}}_0x4a52f1({'count':_0x4ba2fb[_0x6e9b('0x14')],'rows':_0x4ba2fb});});},'FaxQueues':function(_0x1249c0){return new Promise(function(_0x443cdb,_0x5e7b48){var _0x57a415=[];for(var _0x199d49 in _0x49bc27[_0x6e9b('0x4b')]){if(_0x49bc27[_0x6e9b('0x4b')][_0x6e9b('0x3c')](_0x199d49)){var _0x2e88f9=_0x49bc27[_0x6e9b('0x4b')][_0x199d49];var _0xcf5994={'id':_0x2e88f9['id'],'available':_0x2e88f9[_0x6e9b('0x43')],'loggedIn':_0x2e88f9[_0x6e9b('0x48')],'name':_0x2e88f9['name'],'paused':_0x2e88f9[_0x6e9b('0x45')],'waiting':_0x2e88f9['waiting']};_0x57a415[_0x6e9b('0x1c')](_0xcf5994);}}_0x443cdb({'count':_0x57a415[_0x6e9b('0x14')],'rows':_0x57a415});});},'WhatsappQueues':function(_0x23b148){return new Promise(function(_0xa8497e,_0xe06ced){var _0x566ab1=[];for(var _0x2d199f in _0x49bc27[_0x6e9b('0x4c')]){if(_0x49bc27[_0x6e9b('0x4c')][_0x6e9b('0x3c')](_0x2d199f)){var _0x484121=_0x49bc27['whatsappQueues'][_0x2d199f];var _0x4f0bcb={'id':_0x484121['id'],'available':_0x484121[_0x6e9b('0x43')],'loggedIn':_0x484121['loggedIn'],'name':_0x484121[_0x6e9b('0x44')],'paused':_0x484121[_0x6e9b('0x45')],'waiting':_0x484121['waiting']};_0x566ab1['push'](_0x4f0bcb);}}_0xa8497e({'count':_0x566ab1[_0x6e9b('0x14')],'rows':_0x566ab1});});},'ChatQueuesWaitingInteractions':function(_0x228b92){return new Promise(function(_0x15a47d,_0x2a0cf8){var _0x49e81c=_[_0x6e9b('0x41')](_0x49bc27[_0x6e9b('0x4d')]);_0x15a47d({'count':_0x49e81c[_0x6e9b('0x14')],'rows':_0x49e81c});});},'MailQueuesWaitingInteractions':function(_0xf17334){return new Promise(function(_0x1e2bc7,_0x13aa16){var _0x1533a9=_[_0x6e9b('0x41')](_0x49bc27[_0x6e9b('0x4e')]);_0x1e2bc7({'count':_0x1533a9[_0x6e9b('0x14')],'rows':_0x1533a9});});},'OpenchannelQueuesWaitingInteractions':function(_0x51fa23){return new Promise(function(_0x4fb446,_0x4018fe){var _0x16d668=_['values'](_0x49bc27[_0x6e9b('0x4f')]);_0x4fb446({'count':_0x16d668['length'],'rows':_0x16d668});});},'SmsQueuesWaitingInteractions':function(_0x506266){return new Promise(function(_0x544ce0,_0x127e0c){var _0x4d44ab=_[_0x6e9b('0x41')](_0x49bc27[_0x6e9b('0x50')]);_0x544ce0({'count':_0x4d44ab[_0x6e9b('0x14')],'rows':_0x4d44ab});});},'FaxQueuesWaitingInteractions':function(_0x219cee){return new Promise(function(_0x2f9d6e,_0x569b71){var _0x4790b4=_[_0x6e9b('0x41')](_0x49bc27[_0x6e9b('0x51')]);_0x2f9d6e({'count':_0x4790b4['length'],'rows':_0x4790b4});});},'WhatsappQueuesWaitingInteractions':function(_0x5cb52c){return new Promise(function(_0x369382,_0xb2e749){var _0x20d7af=_['values'](_0x49bc27['whatsappQueuesWaitingInteractions']);_0x369382({'count':_0x20d7af['length'],'rows':_0x20d7af});});}};var _0x3b7141=jayson[_0x6e9b('0x52')](_0x2ac333)[_0x6e9b('0x53')]();_0x3b7141['on']('error',function(_0x47955d){logger['error'](JSON[_0x6e9b('0x2c')](_0x47955d));return _0x567efe(_0x47955d);});_0x3b7141[_0x6e9b('0xf')](0x232c,_0x6e9b('0x54'),function(){console['log'](_0x6e9b('0x55'),0x232c);return _0x1ab1e6(_0x6e9b('0x56')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7d7ce7a..6317916 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 _0x76e4=['rules','length','push','Command','format','iftime\x20%s','message','indexOf','true','catch','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','when','stack','stop','bluebird','jayson/promise','http','request','then','error','result','condition'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x76e4,0x1e6));var _0x476e=function(_0x127a6e,_0x302d2f){_0x127a6e=_0x127a6e-0x0;var _0x33b6d7=_0x76e4[_0x127a6e];return _0x33b6d7;};'use strict';var util=require('util');var BPromise=require(_0x476e('0x0'));var jayson=require(_0x476e('0x1'));var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0x476e('0x2')]({'port':0x232a});function request(_0x2616bc,_0x31910c){return new BPromise(function(_0x10e594,_0x48da59){return client[_0x476e('0x3')](_0x2616bc,_0x31910c)[_0x476e('0x4')](function(_0x4b5187){if(_0x4b5187[_0x476e('0x5')]){return _0x48da59(_0x4b5187[_0x476e('0x5')]['message']);}else{return _0x10e594(_0x4b5187[_0x476e('0x6')]);}})['catch'](function(_0x558432){return _0x48da59(_0x558432);});});}exports[_0x476e('0x7')]=function(_0x2a6d2b,_0x37ac90,_0x2edf4a){return function(_0x2fc1f2){if(_0x2edf4a[_0x476e('0x8')]&&!_0x2edf4a[_0x476e('0x8')][_0x2a6d2b]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2a6d2b);return _0x2fc1f2['stop']();}var _0x5bead0=[];for(var _0x3715ea=0x0;_0x3715ea<_0x37ac90[_0x476e('0x9')];_0x3715ea+=0x1){_0x5bead0[_0x476e('0xa')](request(_0x476e('0xb'),{'command':util[_0x476e('0xc')](_0x476e('0xd'),_0x37ac90[_0x3715ea])})[_0x476e('0x4')](function(_0x1ef832){return _0x1ef832&&_0x1ef832['message']&&_0x1ef832[_0x476e('0xe')][_0x476e('0xf')](_0x476e('0x10'))>=0x0?!![]:![];})[_0x476e('0x11')](function(_0x2e4a15){logger[_0x476e('0x5')]('[%s][INTERVAL]\x20%s',_0x2a6d2b,_0x37ac90[_0x3715ea]);}));}BPromise[_0x476e('0x12')](_0x5bead0)[_0x476e('0x4')](function(_0x29b78c){var _0x3947ac=_[_0x476e('0x13')](_0x29b78c);logger[_0x476e('0x14')](_0x476e('0x15'),_0x2a6d2b,_0x37ac90[_0x476e('0x16')]('\x20|\x20'),_0x3947ac);_0x2fc1f2[_0x476e('0x17')](_0x3947ac);})[_0x476e('0x11')](function(_0x4ffeed){console['log'](_0x4ffeed);logger[_0x476e('0x5')](_0x476e('0x15'),_0x2a6d2b,_0x37ac90['join']('\x20|\x20'),_0x4ffeed[_0x476e('0x18')]);_0x2fc1f2[_0x476e('0x19')]();});};}; \ No newline at end of file +var _0xd80b=['length','Command','indexOf','true','error','all','some','info','join','when','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','then','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x573d89,_0x4245f6){var _0x312832=function(_0x538b5b){while(--_0x538b5b){_0x573d89['push'](_0x573d89['shift']());}};_0x312832(++_0x4245f6);}(_0xd80b,0x176));var _0xbd80=function(_0x229a76,_0x443c2e){_0x229a76=_0x229a76-0x0;var _0x34d547=_0xd80b[_0x229a76];return _0x34d547;};'use strict';var util=require(_0xbd80('0x0'));var BPromise=require(_0xbd80('0x1'));var jayson=require(_0xbd80('0x2'));var _=require(_0xbd80('0x3'));var logger=require(_0xbd80('0x4'))(_0xbd80('0x5'));var client=jayson[_0xbd80('0x6')][_0xbd80('0x7')]({'port':0x232a});function request(_0x547bbd,_0xb6cfe7){return new BPromise(function(_0x3c8265,_0x2fbb7a){return client['request'](_0x547bbd,_0xb6cfe7)[_0xbd80('0x8')](function(_0x227d32){if(_0x227d32['error']){return _0x2fbb7a(_0x227d32['error'][_0xbd80('0x9')]);}else{return _0x3c8265(_0x227d32[_0xbd80('0xa')]);}})[_0xbd80('0xb')](function(_0x436320){return _0x2fbb7a(_0x436320);});});}exports[_0xbd80('0xc')]=function(_0x3ed508,_0xf97a2f,_0x2c95c8){return function(_0x630738){if(_0x2c95c8[_0xbd80('0xd')]&&!_0x2c95c8[_0xbd80('0xd')][_0x3ed508]){logger['info'](_0xbd80('0xe'),_0x3ed508);return _0x630738[_0xbd80('0xf')]();}var _0x102687=[];for(var _0x3f6da6=0x0;_0x3f6da6<_0xf97a2f[_0xbd80('0x10')];_0x3f6da6+=0x1){_0x102687['push'](request(_0xbd80('0x11'),{'command':util['format']('iftime\x20%s',_0xf97a2f[_0x3f6da6])})[_0xbd80('0x8')](function(_0x72c36a){return _0x72c36a&&_0x72c36a[_0xbd80('0x9')]&&_0x72c36a[_0xbd80('0x9')][_0xbd80('0x12')](_0xbd80('0x13'))>=0x0?!![]:![];})['catch'](function(_0x382291){logger[_0xbd80('0x14')]('[%s][INTERVAL]\x20%s',_0x3ed508,_0xf97a2f[_0x3f6da6]);}));}BPromise[_0xbd80('0x15')](_0x102687)[_0xbd80('0x8')](function(_0x35ed56){var _0x50a8aa=_[_0xbd80('0x16')](_0x35ed56);logger[_0xbd80('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0x3ed508,_0xf97a2f[_0xbd80('0x18')]('\x20|\x20'),_0x50a8aa);_0x630738[_0xbd80('0x19')](_0x50a8aa);})[_0xbd80('0xb')](function(_0x1a5b13){console[_0xbd80('0x1a')](_0x1a5b13);logger[_0xbd80('0x14')](_0xbd80('0x1b'),_0x3ed508,_0xf97a2f[_0xbd80('0x18')](_0xbd80('0x1c')),_0x1a5b13[_0xbd80('0x1d')]);_0x630738[_0xbd80('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e80f7d6..c64d34f 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 _0xf684=['cause','rejected','indexOf','splice','agent','lodash','util','./utils','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','abandoned','agentconnect','agentconnectAt','connectedlinenum','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','transfer','transfereruniqueid','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','transfertype','secondtransfererexten','transfertargetuniqueid','hangup'];(function(_0x21fa7d,_0x20098f){var _0x3a3f4d=function(_0x28feb1){while(--_0x28feb1){_0x21fa7d['push'](_0x21fa7d['shift']());}};_0x3a3f4d(++_0x20098f);}(_0xf684,0x1c1));var _0x4f68=function(_0x30007a,_0x21909a){_0x30007a=_0x30007a-0x0;var _0x8f45dd=_0xf684[_0x30007a];return _0x8f45dd;};'use strict';var _=require(_0x4f68('0x0'));var util=require(_0x4f68('0x1'));var utils=require(_0x4f68('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x414f99,_0x25c4de){utils['info'](util['format'](_0x4f68('0x3'),_0x414f99[_0x4f68('0x4')],_0x414f99[_0x4f68('0x5')],_0x414f99[_0x4f68('0x6')],_0x414f99[_0x4f68('0x7')],_0x414f99[_0x4f68('0x8')],_0x414f99['calleridnum'],_0x414f99['connectedlinenum'],_0x414f99[_0x4f68('0x9')]));if(_0x414f99[_0x4f68('0x6')]){utils[_0x4f68('0xa')](_0x414f99[_0x4f68('0x6')])[_0x4f68('0xb')](function(_0x4af506){if(_0x4af506){_0x414f99[_0x4f68('0xc')]=_0x4af506[_0x4f68('0xc')];_0x414f99[_0x4f68('0xd')]=_0x414f99[_0x4f68('0xe')]?_0x4af506['acw']:![];_0x414f99[_0x4f68('0xf')]=_0x414f99[_0x4f68('0xd')]?_0x4af506[_0x4f68('0x10')]:0x0;}utils[_0x4f68('0x11')](_0x4f68('0x12'),_0x414f99);});}else{utils[_0x4f68('0x11')](_0x4f68('0x12'),_0x414f99);}if(_0x25c4de){delete transfers[_0x414f99[_0x4f68('0x4')]];}else{delete agents[_0x414f99[_0x4f68('0x13')]];}}exports[_0x4f68('0x14')]=function(_0x4d6501){try{agents[_0x4d6501[_0x4f68('0x13')]]=_0x4d6501;agents[_0x4d6501[_0x4f68('0x13')]][_0x4f68('0x15')]=utils[_0x4f68('0x16')]();agents[_0x4d6501[_0x4f68('0x13')]][_0x4f68('0x9')]=_0x4f68('0x17');agents[_0x4d6501[_0x4f68('0x13')]]['connectedlinenum']=null;agents[_0x4d6501[_0x4f68('0x13')]][_0x4f68('0x18')]=null;}catch(_0x15fca7){utils[_0x4f68('0x19')](_0x15fca7[_0x4f68('0x1a')]);}};exports[_0x4f68('0x1b')]=function(_0x1aa92e){try{if(!_[_0x4f68('0x1c')](agents[_0x1aa92e[_0x4f68('0x13')]])){agents[_0x1aa92e['destuniqueid']][_0x4f68('0x1b')]=!![];agents[_0x1aa92e['destuniqueid']][_0x4f68('0x1d')]=utils[_0x4f68('0x16')]();agents[_0x1aa92e[_0x4f68('0x13')]][_0x4f68('0x9')]=_0x4f68('0x1e');agents[_0x1aa92e[_0x4f68('0x13')]][_0x4f68('0x1f')]=_0x4f68('0x1e');agents[_0x1aa92e[_0x4f68('0x13')]][_0x4f68('0x20')]=_0x1aa92e['ringtime']?parseInt(_0x1aa92e[_0x4f68('0x21')])/0x3e8:0x0;agents[_0x1aa92e['destuniqueid']][_0x4f68('0x22')]=0x0;unanswered[_0x4f68('0x23')](_0x1aa92e[_0x4f68('0x13')]);}}catch(_0x26abf7){utils['error'](_0x26abf7['stack']);}};exports['queuecallerabandon']=function(_0xaadd87){try{_[_0x4f68('0x24')](agents,function(_0x773779,_0x5ccd74){if(_0x773779[_0x4f68('0x4')]==_0xaadd87[_0x4f68('0x4')]&&!_[_0x4f68('0x25')](unanswered,_0x773779['destuniqueid'])){_0x773779[_0x4f68('0x1b')]=!![];_0x773779[_0x4f68('0x1d')]=utils['now']();_0x773779[_0x4f68('0x9')]=_0x4f68('0x26');_0x773779['reason']=_0x4f68('0x26');_0x773779[_0x4f68('0x20')]=_0xaadd87['holdtime'];_0x773779[_0x4f68('0x22')]=0x0;writeDB(_0x773779);}});}catch(_0xda2958){utils[_0x4f68('0x19')](_0xda2958[_0x4f68('0x1a')]);}};exports[_0x4f68('0x27')]=function(_0x14d99a){try{if(agents[_0x14d99a[_0x4f68('0x13')]]){agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x28')]=utils[_0x4f68('0x16')]();agents[_0x14d99a[_0x4f68('0x13')]]['connectedlinenum']=_0x14d99a[_0x4f68('0x29')];agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x18')]=_0x14d99a[_0x4f68('0x18')];agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x20')]=_0x14d99a['ringtime'];agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x9')]=_0x4f68('0x2a');_[_0x4f68('0x24')](agents,function(_0x3201a8,_0x48b006){if(_0x3201a8[_0x4f68('0x13')]!=_0x14d99a[_0x4f68('0x13')]&&_0x3201a8[_0x4f68('0x4')]==_0x14d99a[_0x4f68('0x4')]){_0x3201a8[_0x4f68('0x22')]=0x0;_0x3201a8[_0x4f68('0x20')]=_0x14d99a[_0x4f68('0x21')];_0x3201a8['agentringnoanswer']=!![];_0x3201a8['agentringnoanswerAt']=utils[_0x4f68('0x16')]();_0x3201a8['lastevent']=_0x4f68('0x2b');_0x3201a8[_0x4f68('0x1f')]=_0x4f68('0x2b');_0x3201a8['answeredelsewheredestinationuniqueid']=_0x14d99a[_0x4f68('0x13')];_0x3201a8[_0x4f68('0x2c')]=_0x14d99a[_0x4f68('0x7')];writeDB(_0x3201a8);}});}}catch(_0x2024d6){utils['error'](_0x2024d6[_0x4f68('0x1a')]);}};exports[_0x4f68('0xe')]=function(_0x475612){try{if(!_[_0x4f68('0x1c')](agents[_0x475612[_0x4f68('0x13')]])){agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0xe')]=!![];agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0x2d')]=utils[_0x4f68('0x16')]();agents[_0x475612[_0x4f68('0x13')]]['talktime']=utils[_0x4f68('0x2e')](agents[_0x475612[_0x4f68('0x13')]]['agentcompleteAt'],agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0x28')]);agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0x1f')]=_0x475612[_0x4f68('0x1f')];agents[_0x475612['destuniqueid']][_0x4f68('0x9')]=_0x4f68('0x2f');writeDB(agents[_0x475612['destuniqueid']]);}}catch(_0x1cd9ee){utils['error'](_0x1cd9ee[_0x4f68('0x1a')]);}};exports[_0x4f68('0x30')]=function(_0x25a175){try{if(!_[_0x4f68('0x1c')](agents[_0x25a175['transfereruniqueid']])){agents[_0x25a175['transfereruniqueid']][_0x4f68('0x31')]=!![];agents[_0x25a175[_0x4f68('0x32')]]['transfertype']=_0x4f68('0x33');agents[_0x25a175[_0x4f68('0x32')]]['transferexten']=_0x25a175[_0x4f68('0x34')];agents[_0x25a175['transfereruniqueid']][_0x4f68('0x35')]=agents[_0x25a175[_0x4f68('0x32')]][_0x4f68('0x4')];}}catch(_0x5e5f67){utils['error'](_0x5e5f67[_0x4f68('0x1a')]);}};exports[_0x4f68('0x36')]=function(_0x27ad16){try{if(_0x27ad16[_0x4f68('0x37')]==_0x27ad16[_0x4f68('0x38')]){if(!_[_0x4f68('0x1c')](agents[_0x27ad16['secondtransfereruniqueid']])){agents[_0x27ad16[_0x4f68('0x39')]]['transfer']=!![];agents[_0x27ad16[_0x4f68('0x39')]]['transfertype']=_0x4f68('0x3a');agents[_0x27ad16[_0x4f68('0x39')]][_0x4f68('0x3b')]=_0x27ad16['origtransfererexten'];agents[_0x27ad16[_0x4f68('0x39')]][_0x4f68('0x35')]=_0x27ad16[_0x4f68('0x37')];}if(_0x27ad16[_0x4f68('0x3c')]&&agents[_0x27ad16[_0x4f68('0x3c')]]){agents[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x3d')]=0x1;transfers[_0x27ad16[_0x4f68('0x3c')]]=_[_0x4f68('0x3e')](agents[_0x27ad16['transfereeuniqueid']]);transfers[_0x27ad16[_0x4f68('0x3c')]]['calleridnum']=agents[_0x27ad16['secondtransfereruniqueid']][_0x4f68('0x3f')];transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x40')]=agents[_0x27ad16[_0x4f68('0x39')]][_0x4f68('0x40')];transfers[_0x27ad16['transfereeuniqueid']]['agentcalledAt']=utils[_0x4f68('0x16')]();transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x28')]=utils[_0x4f68('0x16')]();transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x20')]=0x0;transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x3d')]=0x2;}}else if(_0x27ad16[_0x4f68('0x39')]==_0x27ad16['secondtransfererlinkedid']){if(!_[_0x4f68('0x1c')](agents[_0x27ad16[_0x4f68('0x37')]])){agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x31')]=!![];agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x41')]=_0x4f68('0x3a');agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x3b')]=_0x27ad16[_0x4f68('0x42')];agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x35')]=_0x27ad16['secondtransfereruniqueid'];}if(_0x27ad16[_0x4f68('0x43')]&&agents[_0x27ad16['transfertargetuniqueid']]){agents[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x3d')]=0x1;transfers[_0x27ad16['transfertargetuniqueid']]=_[_0x4f68('0x3e')](agents[_0x27ad16[_0x4f68('0x43')]]);transfers[_0x27ad16[_0x4f68('0x43')]]['calleridnum']=agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x3f')];transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x40')]=agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x40')];transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x15')]=utils[_0x4f68('0x16')]();transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x28')]=utils[_0x4f68('0x16')]();transfers[_0x27ad16[_0x4f68('0x43')]][_0x4f68('0x20')]=0x0;transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x3d')]=0x2;}}}catch(_0x5563d2){utils[_0x4f68('0x19')](_0x5563d2[_0x4f68('0x1a')]);}};exports[_0x4f68('0x44')]=function(_0x21eedf){try{if(agents[_0x21eedf[_0x4f68('0x4')]]&&agents[_0x21eedf['uniqueid']][_0x4f68('0x1f')]===_0x4f68('0x1e')){if(_0x21eedf[_0x4f68('0x45')]==='21'){agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x1f')]='rejected';agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x9')]=_0x4f68('0x46');}writeDB(agents[_0x21eedf['uniqueid']]);var _0x17ac6a=unanswered[_0x4f68('0x47')](_0x21eedf['uniqueid']);if(_0x17ac6a>-0x1)unanswered[_0x4f68('0x48')](_0x17ac6a,0x1);}if(transfers[_0x21eedf[_0x4f68('0x4')]]){transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0xe')]=!![];transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x2d')]=utils[_0x4f68('0x16')]();transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x22')]=utils[_0x4f68('0x2e')](transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x2d')],transfers[_0x21eedf['uniqueid']][_0x4f68('0x28')]);transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x1f')]=_0x4f68('0x49');transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x9')]=_0x4f68('0x2f');writeDB(transfers[_0x21eedf[_0x4f68('0x4')]],!![]);}if(agents[_0x21eedf['uniqueid']]&&agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x28')]){agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0xe')]=!![];agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x2d')]=utils['now']();agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x22')]=utils['diffTime'](agents[_0x21eedf['uniqueid']][_0x4f68('0x2d')],agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x28')]);agents[_0x21eedf['uniqueid']][_0x4f68('0x1f')]=agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x31')]?_0x4f68('0x31'):'agent';agents[_0x21eedf['uniqueid']]['lastevent']=_0x4f68('0x2f');writeDB(agents[_0x21eedf[_0x4f68('0x4')]]);}}catch(_0x420555){utils[_0x4f68('0x19')](_0x420555[_0x4f68('0x1a')]);}}; \ No newline at end of file +var _0x9676=['agentcalledAt','now','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime','error','stack','queuecallerabandon','forIn','includes','abandoned','holdtime','agentconnect','connectedlinename','connect','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','splice','agentcompleteAt','agent','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acw','CreateVoiceAgentReport','destuniqueid','agentcalled'];(function(_0x48bd63,_0x5f8e86){var _0x4eaade=function(_0x5cf196){while(--_0x5cf196){_0x48bd63['push'](_0x48bd63['shift']());}};_0x4eaade(++_0x5f8e86);}(_0x9676,0x1ca));var _0x6967=function(_0x38e056,_0xe7b973){_0x38e056=_0x38e056-0x0;var _0x33646e=_0x9676[_0x38e056];return _0x33646e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6967('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4f405f,_0x24dfad){utils['info'](util[_0x6967('0x1')](_0x6967('0x2'),_0x4f405f[_0x6967('0x3')],_0x4f405f[_0x6967('0x4')],_0x4f405f[_0x6967('0x5')],_0x4f405f[_0x6967('0x6')],_0x4f405f['interface'],_0x4f405f[_0x6967('0x7')],_0x4f405f[_0x6967('0x8')],_0x4f405f[_0x6967('0x9')]));if(_0x4f405f['queue']){utils['getVoiceQueueByName'](_0x4f405f['queue'])[_0x6967('0xa')](function(_0x11fa71){if(_0x11fa71){_0x4f405f[_0x6967('0xb')]=_0x11fa71[_0x6967('0xb')];_0x4f405f[_0x6967('0xc')]=_0x4f405f[_0x6967('0xd')]?_0x11fa71[_0x6967('0xe')]:![];_0x4f405f['acwtime']=_0x4f405f[_0x6967('0xc')]?_0x11fa71['acwTimeout']:0x0;}utils['request']('CreateVoiceAgentReport',_0x4f405f);});}else{utils['request'](_0x6967('0xf'),_0x4f405f);}if(_0x24dfad){delete transfers[_0x4f405f[_0x6967('0x3')]];}else{delete agents[_0x4f405f[_0x6967('0x10')]];}}exports[_0x6967('0x11')]=function(_0x454c32){try{agents[_0x454c32[_0x6967('0x10')]]=_0x454c32;agents[_0x454c32[_0x6967('0x10')]][_0x6967('0x12')]=utils[_0x6967('0x13')]();agents[_0x454c32[_0x6967('0x10')]][_0x6967('0x9')]='called';agents[_0x454c32[_0x6967('0x10')]][_0x6967('0x8')]=null;agents[_0x454c32[_0x6967('0x10')]]['connectedlinename']=null;}catch(_0x2be6de){utils['error'](_0x2be6de['stack']);}};exports[_0x6967('0x14')]=function(_0x207547){try{if(!_[_0x6967('0x15')](agents[_0x207547[_0x6967('0x10')]])){agents[_0x207547[_0x6967('0x10')]][_0x6967('0x14')]=!![];agents[_0x207547[_0x6967('0x10')]][_0x6967('0x16')]=utils[_0x6967('0x13')]();agents[_0x207547[_0x6967('0x10')]][_0x6967('0x9')]=_0x6967('0x17');agents[_0x207547[_0x6967('0x10')]][_0x6967('0x18')]=_0x6967('0x17');agents[_0x207547[_0x6967('0x10')]]['holdtime']=_0x207547[_0x6967('0x19')]?parseInt(_0x207547[_0x6967('0x19')])/0x3e8:0x0;agents[_0x207547[_0x6967('0x10')]][_0x6967('0x1a')]=0x0;unanswered['push'](_0x207547[_0x6967('0x10')]);}}catch(_0x15ac71){utils[_0x6967('0x1b')](_0x15ac71[_0x6967('0x1c')]);}};exports[_0x6967('0x1d')]=function(_0x574283){try{_[_0x6967('0x1e')](agents,function(_0x50a5cd,_0x4be191){if(_0x50a5cd[_0x6967('0x3')]==_0x574283[_0x6967('0x3')]&&!_[_0x6967('0x1f')](unanswered,_0x50a5cd[_0x6967('0x10')])){_0x50a5cd[_0x6967('0x14')]=!![];_0x50a5cd[_0x6967('0x16')]=utils[_0x6967('0x13')]();_0x50a5cd[_0x6967('0x9')]='abandoned';_0x50a5cd['reason']=_0x6967('0x20');_0x50a5cd[_0x6967('0x21')]=_0x574283['holdtime'];_0x50a5cd[_0x6967('0x1a')]=0x0;writeDB(_0x50a5cd);}});}catch(_0x55b04a){utils[_0x6967('0x1b')](_0x55b04a[_0x6967('0x1c')]);}};exports[_0x6967('0x22')]=function(_0x159acc){try{if(agents[_0x159acc[_0x6967('0x10')]]){agents[_0x159acc[_0x6967('0x10')]]['agentconnectAt']=utils[_0x6967('0x13')]();agents[_0x159acc[_0x6967('0x10')]][_0x6967('0x8')]=_0x159acc[_0x6967('0x8')];agents[_0x159acc[_0x6967('0x10')]][_0x6967('0x23')]=_0x159acc[_0x6967('0x23')];agents[_0x159acc[_0x6967('0x10')]][_0x6967('0x21')]=_0x159acc[_0x6967('0x19')];agents[_0x159acc['destuniqueid']]['lastevent']=_0x6967('0x24');_[_0x6967('0x1e')](agents,function(_0x440df7,_0x1e49bd){if(_0x440df7[_0x6967('0x10')]!=_0x159acc['destuniqueid']&&_0x440df7[_0x6967('0x3')]==_0x159acc[_0x6967('0x3')]){_0x440df7[_0x6967('0x1a')]=0x0;_0x440df7['holdtime']=_0x159acc[_0x6967('0x19')];_0x440df7[_0x6967('0x14')]=!![];_0x440df7['agentringnoanswerAt']=utils['now']();_0x440df7['lastevent']='answered_elsewhere';_0x440df7[_0x6967('0x18')]='answered_elsewhere';_0x440df7[_0x6967('0x25')]=_0x159acc[_0x6967('0x10')];_0x440df7[_0x6967('0x26')]=_0x159acc[_0x6967('0x6')];writeDB(_0x440df7);}});}}catch(_0x3fdfda){utils[_0x6967('0x1b')](_0x3fdfda[_0x6967('0x1c')]);}};exports[_0x6967('0xd')]=function(_0xbd1698){try{if(!_['isNil'](agents[_0xbd1698[_0x6967('0x10')]])){agents[_0xbd1698[_0x6967('0x10')]][_0x6967('0xd')]=!![];agents[_0xbd1698['destuniqueid']]['agentcompleteAt']=utils[_0x6967('0x13')]();agents[_0xbd1698[_0x6967('0x10')]][_0x6967('0x1a')]=utils[_0x6967('0x27')](agents[_0xbd1698[_0x6967('0x10')]]['agentcompleteAt'],agents[_0xbd1698[_0x6967('0x10')]][_0x6967('0x28')]);agents[_0xbd1698[_0x6967('0x10')]]['reason']=_0xbd1698[_0x6967('0x18')];agents[_0xbd1698['destuniqueid']][_0x6967('0x9')]=_0x6967('0x29');writeDB(agents[_0xbd1698[_0x6967('0x10')]]);}}catch(_0x3e1106){utils[_0x6967('0x1b')](_0x3e1106[_0x6967('0x1c')]);}};exports[_0x6967('0x2a')]=function(_0x317925){try{if(!_['isNil'](agents[_0x317925['transfereruniqueid']])){agents[_0x317925[_0x6967('0x2b')]][_0x6967('0x2c')]=!![];agents[_0x317925['transfereruniqueid']]['transfertype']=_0x6967('0x2d');agents[_0x317925[_0x6967('0x2b')]][_0x6967('0x2e')]=_0x317925[_0x6967('0x2f')];agents[_0x317925[_0x6967('0x2b')]][_0x6967('0x30')]=agents[_0x317925[_0x6967('0x2b')]][_0x6967('0x3')];}}catch(_0x1d0480){utils[_0x6967('0x1b')](_0x1d0480[_0x6967('0x1c')]);}};exports[_0x6967('0x31')]=function(_0x4f6141){try{if(_0x4f6141[_0x6967('0x32')]==_0x4f6141[_0x6967('0x33')]){if(!_[_0x6967('0x15')](agents[_0x4f6141[_0x6967('0x34')]])){agents[_0x4f6141[_0x6967('0x34')]][_0x6967('0x2c')]=!![];agents[_0x4f6141['secondtransfereruniqueid']]['transfertype']=_0x6967('0x35');agents[_0x4f6141['secondtransfereruniqueid']][_0x6967('0x2e')]=_0x4f6141['origtransfererexten'];agents[_0x4f6141[_0x6967('0x34')]][_0x6967('0x30')]=_0x4f6141[_0x6967('0x32')];}if(_0x4f6141[_0x6967('0x36')]&&agents[_0x4f6141[_0x6967('0x36')]]){agents[_0x4f6141[_0x6967('0x36')]][_0x6967('0x37')]=0x1;transfers[_0x4f6141[_0x6967('0x36')]]=_[_0x6967('0x38')](agents[_0x4f6141[_0x6967('0x36')]]);transfers[_0x4f6141[_0x6967('0x36')]][_0x6967('0x7')]=agents[_0x4f6141[_0x6967('0x34')]][_0x6967('0x7')];transfers[_0x4f6141[_0x6967('0x36')]][_0x6967('0x39')]=agents[_0x4f6141[_0x6967('0x34')]][_0x6967('0x39')];transfers[_0x4f6141[_0x6967('0x36')]][_0x6967('0x12')]=utils[_0x6967('0x13')]();transfers[_0x4f6141['transfereeuniqueid']][_0x6967('0x28')]=utils[_0x6967('0x13')]();transfers[_0x4f6141[_0x6967('0x36')]]['holdtime']=0x0;transfers[_0x4f6141[_0x6967('0x36')]]['agententerreason']=0x2;}}else if(_0x4f6141[_0x6967('0x34')]==_0x4f6141[_0x6967('0x3a')]){if(!_[_0x6967('0x15')](agents[_0x4f6141[_0x6967('0x32')]])){agents[_0x4f6141['origtransfereruniqueid']]['transfer']=!![];agents[_0x4f6141[_0x6967('0x32')]][_0x6967('0x3b')]=_0x6967('0x35');agents[_0x4f6141[_0x6967('0x32')]]['transferexten']=_0x4f6141[_0x6967('0x3c')];agents[_0x4f6141[_0x6967('0x32')]][_0x6967('0x30')]=_0x4f6141[_0x6967('0x34')];}if(_0x4f6141[_0x6967('0x3d')]&&agents[_0x4f6141[_0x6967('0x3d')]]){agents[_0x4f6141[_0x6967('0x3d')]][_0x6967('0x37')]=0x1;transfers[_0x4f6141['transfertargetuniqueid']]=_['clone'](agents[_0x4f6141['transfertargetuniqueid']]);transfers[_0x4f6141[_0x6967('0x3d')]]['calleridnum']=agents[_0x4f6141[_0x6967('0x32')]]['calleridnum'];transfers[_0x4f6141['transfertargetuniqueid']][_0x6967('0x39')]=agents[_0x4f6141[_0x6967('0x32')]][_0x6967('0x39')];transfers[_0x4f6141[_0x6967('0x3d')]][_0x6967('0x12')]=utils[_0x6967('0x13')]();transfers[_0x4f6141[_0x6967('0x3d')]][_0x6967('0x28')]=utils[_0x6967('0x13')]();transfers[_0x4f6141['transfertargetuniqueid']][_0x6967('0x21')]=0x0;transfers[_0x4f6141['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0xdac80b){utils['error'](_0xdac80b[_0x6967('0x1c')]);}};exports[_0x6967('0x3e')]=function(_0x1ddf11){try{if(agents[_0x1ddf11['uniqueid']]&&agents[_0x1ddf11['uniqueid']][_0x6967('0x18')]===_0x6967('0x17')){if(_0x1ddf11[_0x6967('0x3f')]==='21'){agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x18')]='rejected';agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x9')]=_0x6967('0x40');}writeDB(agents[_0x1ddf11['uniqueid']]);var _0x1e0763=unanswered['indexOf'](_0x1ddf11[_0x6967('0x3')]);if(_0x1e0763>-0x1)unanswered[_0x6967('0x41')](_0x1e0763,0x1);}if(transfers[_0x1ddf11[_0x6967('0x3')]]){transfers[_0x1ddf11[_0x6967('0x3')]]['agentcomplete']=!![];transfers[_0x1ddf11['uniqueid']][_0x6967('0x42')]=utils['now']();transfers[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x1a')]=utils[_0x6967('0x27')](transfers[_0x1ddf11['uniqueid']]['agentcompleteAt'],transfers[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x28')]);transfers[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x18')]=_0x6967('0x43');transfers[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x9')]='complete';writeDB(transfers[_0x1ddf11[_0x6967('0x3')]],!![]);}if(agents[_0x1ddf11['uniqueid']]&&agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x28')]){agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0xd')]=!![];agents[_0x1ddf11['uniqueid']][_0x6967('0x42')]=utils[_0x6967('0x13')]();agents[_0x1ddf11[_0x6967('0x3')]]['talktime']=utils[_0x6967('0x27')](agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x42')],agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x28')]);agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x18')]=agents[_0x1ddf11[_0x6967('0x3')]][_0x6967('0x2c')]?_0x6967('0x2c'):_0x6967('0x43');agents[_0x1ddf11['uniqueid']]['lastevent']=_0x6967('0x29');writeDB(agents[_0x1ddf11[_0x6967('0x3')]]);}}catch(_0x5dc010){utils['error'](_0x5dc010[_0x6967('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 458a534..a2d62db 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 _0xec66=['gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','source','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','error','stack','newstate','isNil','systemanswertime','channelstate','transfer','linkedid','destinationchannel','answertime','calleridname','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','xmd-originatecalleridnum','value','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','queue','ContactId','xmd-cdrtype','type','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','includes','hangup','noop','execif'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xec66,0x1b0));var _0x6ec6=function(_0xcdf809,_0x2881f0){_0xcdf809=_0xcdf809-0x0;var _0x4d4d70=_0xec66[_0xcdf809];return _0x4d4d70;};'use strict';var _=require(_0x6ec6('0x0'));var util=require(_0x6ec6('0x1'));var utils=require(_0x6ec6('0x2'));var dispositions=[_0x6ec6('0x3'),_0x6ec6('0x4'),_0x6ec6('0x4'),_0x6ec6('0x3'),_0x6ec6('0x3'),_0x6ec6('0x3'),'ANSWERED',_0x6ec6('0x5'),_0x6ec6('0x4'),_0x6ec6('0x4'),_0x6ec6('0x4')];var channels={};function writeDB(_0x587808){utils[_0x6ec6('0x6')](util[_0x6ec6('0x7')](_0x6ec6('0x8'),_0x587808[_0x6ec6('0x9')],_0x587808[_0x6ec6('0xa')],_0x587808['type'],_0x587808[_0x6ec6('0xb')],_0x587808[_0x6ec6('0xc')],_0x587808['destination'],_0x587808[_0x6ec6('0xd')],_0x587808[_0x6ec6('0xe')]));if(_0x587808['accountcode']){utils[_0x6ec6('0xf')](_0x587808[_0x6ec6('0xb')])[_0x6ec6('0x10')](function(_0x981e03){if(_0x981e03){_0x587808[_0x6ec6('0x11')]=_0x981e03['id'];}utils[_0x6ec6('0x12')](_0x6ec6('0x13'),_0x587808);});}else{utils['request'](_0x6ec6('0x13'),_0x587808);}if(channels[_0x587808[_0x6ec6('0x9')]]){delete channels[_0x587808[_0x6ec6('0x9')]];}}exports[_0x6ec6('0x14')]=function(_0x3245cc){try{if(_0x3245cc[_0x6ec6('0x9')]==_0x3245cc['linkedid']&&_0x3245cc[_0x6ec6('0xa')]!=_0x6ec6('0x15')){channels[_0x3245cc[_0x6ec6('0x9')]]={'uniqueid':_0x3245cc[_0x6ec6('0x9')],'accountcode':_0x3245cc['accountcode'],'source':_0x3245cc[_0x6ec6('0x16')],'destination':_0x3245cc['exten'],'destinationcontext':_0x3245cc[_0x6ec6('0x17')],'channel':_0x3245cc[_0x6ec6('0xa')],'starttime':utils[_0x6ec6('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6ec6('0x3'),'amaflags':_0x6ec6('0x19')};}}catch(_0x32ba0b){utils[_0x6ec6('0x1a')](_0x32ba0b[_0x6ec6('0x1b')]);}};exports[_0x6ec6('0x1c')]=function(_0x4899ff){try{if(!_[_0x6ec6('0x1d')](channels[_0x4899ff[_0x6ec6('0x9')]])&&_0x4899ff['channelstate']==0x6){if(_[_0x6ec6('0x1d')](channels[_0x4899ff['uniqueid']][_0x6ec6('0x1e')])){channels[_0x4899ff[_0x6ec6('0x9')]][_0x6ec6('0x1e')]=utils[_0x6ec6('0x18')]();}}else if(!_[_0x6ec6('0x1d')](channels[_0x4899ff['linkedid']])&&_0x4899ff[_0x6ec6('0x1f')]==0x6&&_0x4899ff[_0x6ec6('0x17')]!=_0x6ec6('0x20')){channels[_0x4899ff[_0x6ec6('0x21')]][_0x6ec6('0xb')]=_0x4899ff[_0x6ec6('0xb')];channels[_0x4899ff[_0x6ec6('0x21')]][_0x6ec6('0x22')]=_0x4899ff['channel'];if(_[_0x6ec6('0x1d')](channels[_0x4899ff[_0x6ec6('0x21')]]['answertime'])){channels[_0x4899ff[_0x6ec6('0x21')]][_0x6ec6('0x23')]=utils[_0x6ec6('0x18')]();}channels[_0x4899ff[_0x6ec6('0x21')]]['disposition']=dispositions[_['toNumber'](_0x4899ff['channelstate'])]||'ANSWERED';}}catch(_0x39d722){utils[_0x6ec6('0x1a')](_0x39d722[_0x6ec6('0x1b')]);}};exports['hangup']=function(_0x23f5e0){try{if(!_['isNil'](channels[_0x23f5e0['uniqueid']])){if(_[_0x6ec6('0x1d')](channels[_0x23f5e0['uniqueid']][_0x6ec6('0xd')])){channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0xd')]=_0x23f5e0[_0x6ec6('0x24')]+'\x20<'+_0x23f5e0[_0x6ec6('0x16')]+'>';}channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0x25')]=utils[_0x6ec6('0x18')]();channels[_0x23f5e0[_0x6ec6('0x9')]]['duration']=utils['diffTime'](channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0x25')],channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0x26')]);channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0x27')]=channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0x23')]?utils[_0x6ec6('0x28')](channels[_0x23f5e0['uniqueid']][_0x6ec6('0x25')],channels[_0x23f5e0[_0x6ec6('0x9')]][_0x6ec6('0x23')]):0x0;writeDB(channels[_0x23f5e0['uniqueid']]);}}catch(_0x326c15){utils[_0x6ec6('0x1a')](_0x326c15['stack']);}};exports[_0x6ec6('0x29')]=function(_0x50f6c7){try{if(!_[_0x6ec6('0x1d')](channels[_0x50f6c7['localtwolinkedid']])){if(channels[_0x50f6c7[_0x6ec6('0x2a')]][_0x6ec6('0xa')]==_0x50f6c7[_0x6ec6('0x2b')]){channels[_0x50f6c7[_0x6ec6('0x2a')]][_0x6ec6('0x22')]=_0x50f6c7[_0x6ec6('0x2c')];channels[_0x50f6c7[_0x6ec6('0x2a')]][_0x6ec6('0x2d')]=_0x6ec6('0x2e');}else if(channels[_0x50f6c7[_0x6ec6('0x2a')]][_0x6ec6('0xa')]=_0x50f6c7[_0x6ec6('0x2f')]){channels[_0x50f6c7['localtwolinkedid']][_0x6ec6('0x22')]=_0x50f6c7[_0x6ec6('0x30')];channels[_0x50f6c7[_0x6ec6('0x2a')]]['userfield']=_0x6ec6('0x2e');}}}catch(_0x27584f){utils[_0x6ec6('0x1a')](_0x27584f[_0x6ec6('0x1b')]);}};exports[_0x6ec6('0x31')]=function(_0x31ab9b){try{if(!_[_0x6ec6('0x1d')](channels[_0x31ab9b[_0x6ec6('0x9')]])){channels[_0x31ab9b[_0x6ec6('0x9')]][_0x6ec6('0x32')]=utils[_0x6ec6('0x18')]();}}catch(_0x30aeb4){utils['error'](_0x30aeb4['stack']);}};exports[_0x6ec6('0x33')]=function(_0x5a1a99){try{if(!_[_0x6ec6('0x1d')](channels[_0x5a1a99[_0x6ec6('0x9')]])){if(!_[_0x6ec6('0x1d')](channels[_0x5a1a99['uniqueid']][_0x6ec6('0x32')])){channels[_0x5a1a99['uniqueid']][_0x6ec6('0x34')]+=utils[_0x6ec6('0x28')](utils[_0x6ec6('0x18')](),channels[_0x5a1a99[_0x6ec6('0x9')]][_0x6ec6('0x32')]);delete channels[_0x5a1a99[_0x6ec6('0x9')]][_0x6ec6('0x32')];}}}catch(_0x28acb7){utils[_0x6ec6('0x1a')](_0x28acb7[_0x6ec6('0x1b')]);}};exports[_0x6ec6('0x35')]=function(_0x404766){try{if(!_[_0x6ec6('0x1d')](channels[_0x404766[_0x6ec6('0x9')]])){if(!_[_0x6ec6('0x1d')](_0x404766['variable'][_0x6ec6('0x36')])){channels[_0x404766[_0x6ec6('0x9')]]['source']=_0x404766[_0x6ec6('0x37')];}if(!_[_0x6ec6('0x1d')](_0x404766[_0x6ec6('0x38')][_0x6ec6('0x39')])){channels[_0x404766[_0x6ec6('0x9')]][_0x6ec6('0x3a')]=_0x404766[_0x6ec6('0x37')];channels[_0x404766[_0x6ec6('0x9')]][_0x6ec6('0xd')]='\x22'+_0x404766[_0x6ec6('0x37')]+_0x6ec6('0x3b')+_0x404766['value']+'>';}if(!_['isNil'](_0x404766[_0x6ec6('0x38')][_0x6ec6('0x3c')])||!_[_0x6ec6('0x1d')](_0x404766[_0x6ec6('0x38')][_0x6ec6('0x3d')])){channels[_0x404766[_0x6ec6('0x9')]][_0x6ec6('0xd')]=_0x404766[_0x6ec6('0x37')];}if(!_['isNil'](_0x404766[_0x6ec6('0x38')][_0x6ec6('0x3e')])||!_['isNil'](_0x404766[_0x6ec6('0x38')][_0x6ec6('0x3f')])){channels[_0x404766['uniqueid']][_0x6ec6('0x40')]=_0x6ec6('0x41');channels[_0x404766[_0x6ec6('0x9')]]['lastdata']=_0x404766['value'];channels[_0x404766['uniqueid']][_0x6ec6('0x42')]=!![];}if(!_['isNil'](_0x404766['variable']['xmd-contactid'])){channels[_0x404766[_0x6ec6('0x9')]][_0x6ec6('0x43')]=_0x404766[_0x6ec6('0x37')];}if(!_['isNil'](_0x404766[_0x6ec6('0x38')][_0x6ec6('0x44')])){channels[_0x404766[_0x6ec6('0x9')]][_0x6ec6('0x45')]=_0x404766[_0x6ec6('0x37')];}if(!_[_0x6ec6('0x1d')](_0x404766['variable']['outboundrouteid'])){channels[_0x404766[_0x6ec6('0x9')]]['routeid']=_0x404766[_0x6ec6('0x37')];}if(!_[_0x6ec6('0x1d')](_0x404766['variable'][_0x6ec6('0x46')])){channels[_0x404766[_0x6ec6('0x9')]][_0x6ec6('0x46')]=_0x404766[_0x6ec6('0x37')];}}}catch(_0x5380c7){utils['error'](_0x5380c7['stack']);}};exports[_0x6ec6('0x47')]=function(_0x1e9ed7){try{if(!_[_0x6ec6('0x1d')](channels[_0x1e9ed7[_0x6ec6('0x9')]])){if(_0x1e9ed7[_0x6ec6('0x48')][_0x6ec6('0x49')]()==_0x6ec6('0x4a')&&_[_0x6ec6('0x4b')](_0x1e9ed7[_0x6ec6('0x4c')][_0x6ec6('0x49')](),_0x6ec6('0x4d'))){var _0x1694eb=_0x1e9ed7[_0x6ec6('0x4c')]['split']('=');var _0x24fd8d=_0x1694eb[0x0][_0x6ec6('0x4e')](_0x1694eb[0x0][_0x6ec6('0x4f')]('(')+0x1,_0x1694eb[0x0][_0x6ec6('0x4f')](')'));var _0x9fc90d=_0x1694eb[0x1];channels[_0x1e9ed7[_0x6ec6('0x9')]][_0x24fd8d]=_0x9fc90d;}if(!_[_0x6ec6('0x50')]([_0x6ec6('0x51'),_0x6ec6('0x52'),_0x6ec6('0x53'),_0x6ec6('0x4a'),_0x6ec6('0x54')],_0x1e9ed7[_0x6ec6('0x48')]['toLowerCase']())){channels[_0x1e9ed7[_0x6ec6('0x9')]][_0x6ec6('0x40')]=_0x1e9ed7[_0x6ec6('0x48')];channels[_0x1e9ed7[_0x6ec6('0x9')]][_0x6ec6('0x55')]=_0x1e9ed7[_0x6ec6('0x4c')];}}}catch(_0x5d1099){utils[_0x6ec6('0x1a')](_0x5d1099['stack']);}}; \ No newline at end of file +var _0x4125=['appdata','split','substring','lastIndexOf','includes','noop','application','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','linkedid','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','stack','systemanswertime','channelstate','destinationchannel','isNil','answertime','toNumber','hangup','calleridname','calleridnum','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','outboundrouteid','sipcallid','toLowerCase','set','startsWith'];(function(_0x40b039,_0x4b4b33){var _0x1e53cf=function(_0x10ebad){while(--_0x10ebad){_0x40b039['push'](_0x40b039['shift']());}};_0x1e53cf(++_0x4b4b33);}(_0x4125,0x17e));var _0x5412=function(_0x34a318,_0x565dc7){_0x34a318=_0x34a318-0x0;var _0x49f361=_0x4125[_0x34a318];return _0x49f361;};'use strict';var _=require('lodash');var util=require(_0x5412('0x0'));var utils=require(_0x5412('0x1'));var dispositions=[_0x5412('0x2'),_0x5412('0x3'),_0x5412('0x3'),_0x5412('0x2'),'NO\x20ANSWER',_0x5412('0x2'),_0x5412('0x4'),'BUSY',_0x5412('0x3'),'FAILED',_0x5412('0x3')];var channels={};function writeDB(_0x25f7ac){utils[_0x5412('0x5')](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x25f7ac['uniqueid'],_0x25f7ac[_0x5412('0x6')],_0x25f7ac[_0x5412('0x7')],_0x25f7ac[_0x5412('0x8')],_0x25f7ac[_0x5412('0x9')],_0x25f7ac[_0x5412('0xa')],_0x25f7ac[_0x5412('0xb')],_0x25f7ac[_0x5412('0xc')]));if(_0x25f7ac[_0x5412('0x8')]){utils[_0x5412('0xd')](_0x25f7ac['accountcode'])['then'](function(_0x4ffed5){if(_0x4ffed5){_0x25f7ac[_0x5412('0xe')]=_0x4ffed5['id'];}utils[_0x5412('0xf')](_0x5412('0x10'),_0x25f7ac);});}else{utils[_0x5412('0xf')](_0x5412('0x10'),_0x25f7ac);}if(channels[_0x25f7ac['uniqueid']]){delete channels[_0x25f7ac[_0x5412('0x11')]];}}exports['newchannel']=function(_0x937915){try{if(_0x937915[_0x5412('0x11')]==_0x937915[_0x5412('0x12')]&&_0x937915[_0x5412('0x6')]!=_0x5412('0x13')){channels[_0x937915['uniqueid']]={'uniqueid':_0x937915[_0x5412('0x11')],'accountcode':_0x937915[_0x5412('0x8')],'source':_0x937915['calleridnum'],'destination':_0x937915[_0x5412('0x14')],'destinationcontext':_0x937915[_0x5412('0x15')],'channel':_0x937915[_0x5412('0x6')],'starttime':utils[_0x5412('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5412('0x2'),'amaflags':_0x5412('0x17')};}}catch(_0x1ee706){utils[_0x5412('0x18')](_0x1ee706[_0x5412('0x19')]);}};exports['newstate']=function(_0xc6e9d1){try{if(!_['isNil'](channels[_0xc6e9d1[_0x5412('0x11')]])&&_0xc6e9d1['channelstate']==0x6){if(_['isNil'](channels[_0xc6e9d1[_0x5412('0x11')]][_0x5412('0x1a')])){channels[_0xc6e9d1[_0x5412('0x11')]][_0x5412('0x1a')]=utils[_0x5412('0x16')]();}}else if(!_['isNil'](channels[_0xc6e9d1[_0x5412('0x12')]])&&_0xc6e9d1[_0x5412('0x1b')]==0x6&&_0xc6e9d1['context']!='transfer'){channels[_0xc6e9d1[_0x5412('0x12')]][_0x5412('0x8')]=_0xc6e9d1[_0x5412('0x8')];channels[_0xc6e9d1[_0x5412('0x12')]][_0x5412('0x1c')]=_0xc6e9d1[_0x5412('0x6')];if(_[_0x5412('0x1d')](channels[_0xc6e9d1[_0x5412('0x12')]][_0x5412('0x1e')])){channels[_0xc6e9d1[_0x5412('0x12')]][_0x5412('0x1e')]=utils[_0x5412('0x16')]();}channels[_0xc6e9d1['linkedid']][_0x5412('0xc')]=dispositions[_[_0x5412('0x1f')](_0xc6e9d1[_0x5412('0x1b')])]||'ANSWERED';}}catch(_0x1d2416){utils['error'](_0x1d2416[_0x5412('0x19')]);}};exports[_0x5412('0x20')]=function(_0x4d41ac){try{if(!_[_0x5412('0x1d')](channels[_0x4d41ac[_0x5412('0x11')]])){if(_[_0x5412('0x1d')](channels[_0x4d41ac[_0x5412('0x11')]]['callerid'])){channels[_0x4d41ac[_0x5412('0x11')]][_0x5412('0xb')]=_0x4d41ac[_0x5412('0x21')]+'\x20<'+_0x4d41ac[_0x5412('0x22')]+'>';}channels[_0x4d41ac[_0x5412('0x11')]][_0x5412('0x23')]=utils[_0x5412('0x16')]();channels[_0x4d41ac[_0x5412('0x11')]]['duration']=utils[_0x5412('0x24')](channels[_0x4d41ac[_0x5412('0x11')]][_0x5412('0x23')],channels[_0x4d41ac['uniqueid']][_0x5412('0x25')]);channels[_0x4d41ac[_0x5412('0x11')]][_0x5412('0x26')]=channels[_0x4d41ac['uniqueid']]['answertime']?utils[_0x5412('0x24')](channels[_0x4d41ac[_0x5412('0x11')]][_0x5412('0x23')],channels[_0x4d41ac[_0x5412('0x11')]][_0x5412('0x1e')]):0x0;writeDB(channels[_0x4d41ac[_0x5412('0x11')]]);}}catch(_0x583296){utils['error'](_0x583296[_0x5412('0x19')]);}};exports[_0x5412('0x27')]=function(_0x5ba260){try{if(!_['isNil'](channels[_0x5ba260[_0x5412('0x28')]])){if(channels[_0x5ba260[_0x5412('0x28')]][_0x5412('0x6')]==_0x5ba260[_0x5412('0x29')]){channels[_0x5ba260[_0x5412('0x28')]][_0x5412('0x1c')]=_0x5ba260[_0x5412('0x2a')];channels[_0x5ba260['localtwolinkedid']][_0x5412('0x2b')]=_0x5412('0x2c');}else if(channels[_0x5ba260['localtwolinkedid']][_0x5412('0x6')]=_0x5ba260['transfertargetchannel']){channels[_0x5ba260['localtwolinkedid']]['destinationchannel']=_0x5ba260['origtransfererchannel'];channels[_0x5ba260[_0x5412('0x28')]][_0x5412('0x2b')]=_0x5412('0x2c');}}}catch(_0x43e2ff){utils[_0x5412('0x18')](_0x43e2ff[_0x5412('0x19')]);}};exports['musiconholdstart']=function(_0x564d7e){try{if(!_[_0x5412('0x1d')](channels[_0x564d7e[_0x5412('0x11')]])){channels[_0x564d7e['uniqueid']][_0x5412('0x2d')]=utils[_0x5412('0x16')]();}}catch(_0xa3b6e6){utils[_0x5412('0x18')](_0xa3b6e6[_0x5412('0x19')]);}};exports[_0x5412('0x2e')]=function(_0x4fb45a){try{if(!_['isNil'](channels[_0x4fb45a[_0x5412('0x11')]])){if(!_[_0x5412('0x1d')](channels[_0x4fb45a[_0x5412('0x11')]][_0x5412('0x2d')])){channels[_0x4fb45a[_0x5412('0x11')]][_0x5412('0x2f')]+=utils[_0x5412('0x24')](utils['now'](),channels[_0x4fb45a[_0x5412('0x11')]][_0x5412('0x2d')]);delete channels[_0x4fb45a[_0x5412('0x11')]][_0x5412('0x2d')];}}}catch(_0x329f53){utils[_0x5412('0x18')](_0x329f53[_0x5412('0x19')]);}};exports[_0x5412('0x30')]=function(_0x1d58f9){try{if(!_['isNil'](channels[_0x1d58f9[_0x5412('0x11')]])){if(!_[_0x5412('0x1d')](_0x1d58f9[_0x5412('0x31')][_0x5412('0x32')])){channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0x9')]=_0x1d58f9[_0x5412('0x33')];}if(!_[_0x5412('0x1d')](_0x1d58f9[_0x5412('0x31')][_0x5412('0x34')])){channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0xa')]=_0x1d58f9[_0x5412('0x33')];channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0xb')]='\x22'+_0x1d58f9[_0x5412('0x33')]+_0x5412('0x35')+_0x1d58f9['value']+'>';}if(!_[_0x5412('0x1d')](_0x1d58f9[_0x5412('0x31')][_0x5412('0x36')])||!_[_0x5412('0x1d')](_0x1d58f9[_0x5412('0x31')][_0x5412('0x37')])){channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0xb')]=_0x1d58f9[_0x5412('0x33')];}if(!_[_0x5412('0x1d')](_0x1d58f9['variable'][_0x5412('0x38')])||!_['isNil'](_0x1d58f9[_0x5412('0x31')][_0x5412('0x39')])){channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0x3a')]=_0x5412('0x3b');channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0x3c')]=_0x1d58f9[_0x5412('0x33')];channels[_0x1d58f9['uniqueid']]['queue']=!![];}if(!_[_0x5412('0x1d')](_0x1d58f9[_0x5412('0x31')][_0x5412('0x3d')])){channels[_0x1d58f9[_0x5412('0x11')]][_0x5412('0x3e')]=_0x1d58f9['value'];}if(!_[_0x5412('0x1d')](_0x1d58f9[_0x5412('0x31')]['xmd-cdrtype'])){channels[_0x1d58f9['uniqueid']][_0x5412('0x7')]=_0x1d58f9[_0x5412('0x33')];}if(!_['isNil'](_0x1d58f9[_0x5412('0x31')][_0x5412('0x3f')])){channels[_0x1d58f9['uniqueid']]['routeid']=_0x1d58f9['value'];}if(!_[_0x5412('0x1d')](_0x1d58f9['variable'][_0x5412('0x40')])){channels[_0x1d58f9[_0x5412('0x11')]]['sipcallid']=_0x1d58f9[_0x5412('0x33')];}}}catch(_0x934849){utils[_0x5412('0x18')](_0x934849[_0x5412('0x19')]);}};exports['newexten']=function(_0x53c4f6){try{if(!_['isNil'](channels[_0x53c4f6[_0x5412('0x11')]])){if(_0x53c4f6['application'][_0x5412('0x41')]()==_0x5412('0x42')&&_[_0x5412('0x43')](_0x53c4f6[_0x5412('0x44')][_0x5412('0x41')](),'cdr')){var _0x4a92f5=_0x53c4f6[_0x5412('0x44')][_0x5412('0x45')]('=');var _0xadc44a=_0x4a92f5[0x0][_0x5412('0x46')](_0x4a92f5[0x0][_0x5412('0x47')]('(')+0x1,_0x4a92f5[0x0][_0x5412('0x47')](')'));var _0x10c45f=_0x4a92f5[0x1];channels[_0x53c4f6[_0x5412('0x11')]][_0xadc44a]=_0x10c45f;}if(!_[_0x5412('0x48')](['hangup',_0x5412('0x49'),'execif','set','gotoif'],_0x53c4f6['application']['toLowerCase']())){channels[_0x53c4f6['uniqueid']]['lastapplication']=_0x53c4f6[_0x5412('0x4a')];channels[_0x53c4f6['uniqueid']][_0x5412('0x3c')]=_0x53c4f6['appdata'];}}}catch(_0x22680c){utils[_0x5412('0x18')](_0x22680c[_0x5412('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c9af090..0c1e266 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 _0xba34=['fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED'];(function(_0x1dbcee,_0x2feda6){var _0x4bf163=function(_0x5ec7d2){while(--_0x5ec7d2){_0x1dbcee['push'](_0x1dbcee['shift']());}};_0x4bf163(++_0x2feda6);}(_0xba34,0x119));var _0x4ba3=function(_0x10620d,_0x1cc78e){_0x10620d=_0x10620d-0x0;var _0x266897=_0xba34[_0x10620d];return _0x266897;};'use strict';var utils=require(_0x4ba3('0x0'));var _=require(_0x4ba3('0x1'));exports[_0x4ba3('0x2')]=function(){utils[_0x4ba3('0x3')](_0x4ba3('0x4'));};exports['shutdown']=function(){utils['info']('SHUTDOWN');};exports[_0x4ba3('0x5')]=function(){utils[_0x4ba3('0x3')](_0x4ba3('0x6'));};exports[_0x4ba3('0x7')]=function(_0x3590a1){utils[_0x4ba3('0x7')](_0x3590a1);};exports[_0x4ba3('0x8')]=function(){utils['info'](_0x4ba3('0x9'));};exports[_0x4ba3('0xa')]=function(_0x2df7f3){}; \ No newline at end of file +var _0xda19=['close','CLOSE','managerevent','lodash','connect','CONNECTED','info','fullybooted','FULLYBOOTED','error'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xda19,0xd5));var _0x9da1=function(_0x48bae4,_0x130cf7){_0x48bae4=_0x48bae4-0x0;var _0x4fc6ec=_0xda19[_0x48bae4];return _0x4fc6ec;};'use strict';var utils=require('./utils');var _=require(_0x9da1('0x0'));exports[_0x9da1('0x1')]=function(){utils['info'](_0x9da1('0x2'));};exports['shutdown']=function(){utils[_0x9da1('0x3')]('SHUTDOWN');};exports[_0x9da1('0x4')]=function(){utils[_0x9da1('0x3')](_0x9da1('0x5'));};exports[_0x9da1('0x6')]=function(_0x156faf){utils[_0x9da1('0x6')](_0x156faf);};exports[_0x9da1('0x7')]=function(){utils[_0x9da1('0x3')](_0x9da1('0x8'));};exports[_0x9da1('0x9')]=function(_0x47df89){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 504f55b..18e3534 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 _0x04e4=['billableseconds','lodash','util','./utils','info','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','dialstatus','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','starttime','lastevent','called','ANSWER','answertime','connect','hangup','assign','now','diffTime','endtime','holdtime'];(function(_0x195333,_0x3eaae4){var _0x58e40d=function(_0x382e14){while(--_0x382e14){_0x195333['push'](_0x195333['shift']());}};_0x58e40d(++_0x3eaae4);}(_0x04e4,0x17d));var _0x404e=function(_0x3880c4,_0x1be68d){_0x3880c4=_0x3880c4-0x0;var _0x29db3e=_0x04e4[_0x3880c4];return _0x29db3e;};'use strict';var _=require(_0x404e('0x0'));var util=require(_0x404e('0x1'));var utils=require(_0x404e('0x2'));var dials={};function writeDB(_0x1f950d){utils[_0x404e('0x3')](util['format'](_0x404e('0x4'),_0x1f950d[_0x404e('0x5')],_0x1f950d[_0x404e('0x6')],_0x1f950d['dialstring'],_0x1f950d[_0x404e('0x7')],_0x1f950d['connectedlinenum'],_0x1f950d[_0x404e('0x8')]));utils['request'](_0x404e('0x9'),_0x1f950d);delete dials[_0x1f950d[_0x404e('0x5')]];}exports['newexten']=function(_0x326cc3){try{if(_0x326cc3[_0x404e('0xa')][_0x404e('0xb')]()==_0x404e('0xc')&&_[_0x404e('0xd')](_0x326cc3[_0x404e('0xe')][_0x404e('0xb')](),_0x404e('0xf'))){var _0x42e487=_0x326cc3[_0x404e('0xe')][_0x404e('0x10')]('=');dials[_0x326cc3[_0x404e('0x5')]]={'routeId':_0x42e487[0x1]};}}catch(_0x440846){utils[_0x404e('0x11')](_0x440846[_0x404e('0x12')]);}};exports[_0x404e('0x13')]=function(_0x196a73){try{if(!_[_0x404e('0x14')](_0x196a73[_0x404e('0x15')][_0x404e('0x16')])){dials[_0x196a73['uniqueid']]={'routeId':_0x196a73[_0x404e('0x17')]};}}catch(_0x11a594){utils[_0x404e('0x11')](_0x11a594[_0x404e('0x12')]);}};exports[_0x404e('0x18')]=function(_0x153992){try{if(!_[_0x404e('0x14')](dials[_0x153992[_0x404e('0x5')]])){dials[_0x153992[_0x404e('0x5')]]=_['assign'](dials[_0x153992[_0x404e('0x5')]],_0x153992);dials[_0x153992[_0x404e('0x5')]][_0x404e('0x19')]=utils['now']();dials[_0x153992['uniqueid']][_0x404e('0x1a')]=_0x404e('0x1b');}}catch(_0xab32c7){utils['error'](_0xab32c7[_0x404e('0x12')]);}};exports['dialend']=function(_0x773339){try{if(!_[_0x404e('0x14')](dials[_0x773339['uniqueid']])){dials[_0x773339[_0x404e('0x5')]]['dialstatus']=_0x773339['dialstatus'];if(_0x773339[_0x404e('0x8')]==_0x404e('0x1c')){dials[_0x773339['uniqueid']]=_['assign'](dials[_0x773339['uniqueid']],_0x773339);dials[_0x773339[_0x404e('0x5')]][_0x404e('0x1d')]=utils['now']();dials[_0x773339[_0x404e('0x5')]][_0x404e('0x1a')]=_0x404e('0x1e');}}}catch(_0x194da0){utils[_0x404e('0x11')](_0x194da0[_0x404e('0x12')]);}};exports[_0x404e('0x1f')]=function(_0x2b4e36){try{if(!_[_0x404e('0x14')](dials[_0x2b4e36[_0x404e('0x5')]])){dials[_0x2b4e36[_0x404e('0x5')]]=_[_0x404e('0x20')](dials[_0x2b4e36[_0x404e('0x5')]],{'endtime':utils[_0x404e('0x21')](),'lastevent':'complete'});dials[_0x2b4e36[_0x404e('0x5')]]['duration']=utils[_0x404e('0x22')](dials[_0x2b4e36[_0x404e('0x5')]][_0x404e('0x23')],dials[_0x2b4e36[_0x404e('0x5')]][_0x404e('0x19')]);dials[_0x2b4e36[_0x404e('0x5')]][_0x404e('0x24')]=utils['diffTime'](dials[_0x2b4e36['uniqueid']][_0x404e('0x1d')]||dials[_0x2b4e36['uniqueid']][_0x404e('0x23')],dials[_0x2b4e36[_0x404e('0x5')]][_0x404e('0x19')]);dials[_0x2b4e36['uniqueid']][_0x404e('0x25')]=dials[_0x2b4e36[_0x404e('0x5')]][_0x404e('0x1d')]?utils['diffTime'](dials[_0x2b4e36['uniqueid']][_0x404e('0x23')],dials[_0x2b4e36[_0x404e('0x5')]][_0x404e('0x1d')]):0x0;writeDB(dials[_0x2b4e36[_0x404e('0x5')]]);}}catch(_0x59ac88){utils[_0x404e('0x11')](_0x59ac88[_0x404e('0x12')]);}}; \ No newline at end of file +var _0xd8d7=['lodash','util','./utils','info','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','isNil','variable','outboundrouteid','value','dialbegin','starttime','now','lastevent','called','ANSWER','assign','answertime','hangup','complete','diffTime','endtime','billableseconds'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0xd8d7[_0x3d38ae];return _0x3757ee;};'use strict';var _=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var utils=require(_0x7d8d('0x2'));var dials={};function writeDB(_0x2d7baf){utils[_0x7d8d('0x3')](util['format']('DIAL|%s|%s|%s|%s|%s|%s',_0x2d7baf['uniqueid'],_0x2d7baf['channel'],_0x2d7baf[_0x7d8d('0x4')],_0x2d7baf['calleridnum'],_0x2d7baf[_0x7d8d('0x5')],_0x2d7baf[_0x7d8d('0x6')]));utils[_0x7d8d('0x7')](_0x7d8d('0x8'),_0x2d7baf);delete dials[_0x2d7baf[_0x7d8d('0x9')]];}exports[_0x7d8d('0xa')]=function(_0x1bac2e){try{if(_0x1bac2e['application'][_0x7d8d('0xb')]()==_0x7d8d('0xc')&&_[_0x7d8d('0xd')](_0x1bac2e[_0x7d8d('0xe')][_0x7d8d('0xb')](),_0x7d8d('0xf'))){var _0x2a0f33=_0x1bac2e['appdata'][_0x7d8d('0x10')]('=');dials[_0x1bac2e[_0x7d8d('0x9')]]={'routeId':_0x2a0f33[0x1]};}}catch(_0xe1ca5f){utils[_0x7d8d('0x11')](_0xe1ca5f[_0x7d8d('0x12')]);}};exports['varset']=function(_0x1ba2b9){try{if(!_[_0x7d8d('0x13')](_0x1ba2b9[_0x7d8d('0x14')][_0x7d8d('0x15')])){dials[_0x1ba2b9[_0x7d8d('0x9')]]={'routeId':_0x1ba2b9[_0x7d8d('0x16')]};}}catch(_0x56d307){utils[_0x7d8d('0x11')](_0x56d307[_0x7d8d('0x12')]);}};exports[_0x7d8d('0x17')]=function(_0x365044){try{if(!_[_0x7d8d('0x13')](dials[_0x365044['uniqueid']])){dials[_0x365044[_0x7d8d('0x9')]]=_['assign'](dials[_0x365044[_0x7d8d('0x9')]],_0x365044);dials[_0x365044['uniqueid']][_0x7d8d('0x18')]=utils[_0x7d8d('0x19')]();dials[_0x365044[_0x7d8d('0x9')]][_0x7d8d('0x1a')]=_0x7d8d('0x1b');}}catch(_0x31be40){utils[_0x7d8d('0x11')](_0x31be40[_0x7d8d('0x12')]);}};exports['dialend']=function(_0x110c59){try{if(!_[_0x7d8d('0x13')](dials[_0x110c59[_0x7d8d('0x9')]])){dials[_0x110c59[_0x7d8d('0x9')]][_0x7d8d('0x6')]=_0x110c59[_0x7d8d('0x6')];if(_0x110c59[_0x7d8d('0x6')]==_0x7d8d('0x1c')){dials[_0x110c59[_0x7d8d('0x9')]]=_[_0x7d8d('0x1d')](dials[_0x110c59[_0x7d8d('0x9')]],_0x110c59);dials[_0x110c59[_0x7d8d('0x9')]][_0x7d8d('0x1e')]=utils[_0x7d8d('0x19')]();dials[_0x110c59['uniqueid']]['lastevent']='connect';}}}catch(_0xb4361d){utils[_0x7d8d('0x11')](_0xb4361d[_0x7d8d('0x12')]);}};exports[_0x7d8d('0x1f')]=function(_0x43e4d0){try{if(!_['isNil'](dials[_0x43e4d0[_0x7d8d('0x9')]])){dials[_0x43e4d0[_0x7d8d('0x9')]]=_[_0x7d8d('0x1d')](dials[_0x43e4d0[_0x7d8d('0x9')]],{'endtime':utils[_0x7d8d('0x19')](),'lastevent':_0x7d8d('0x20')});dials[_0x43e4d0[_0x7d8d('0x9')]]['duration']=utils[_0x7d8d('0x21')](dials[_0x43e4d0[_0x7d8d('0x9')]][_0x7d8d('0x22')],dials[_0x43e4d0[_0x7d8d('0x9')]][_0x7d8d('0x18')]);dials[_0x43e4d0['uniqueid']]['holdtime']=utils[_0x7d8d('0x21')](dials[_0x43e4d0[_0x7d8d('0x9')]][_0x7d8d('0x1e')]||dials[_0x43e4d0['uniqueid']][_0x7d8d('0x22')],dials[_0x43e4d0[_0x7d8d('0x9')]][_0x7d8d('0x18')]);dials[_0x43e4d0['uniqueid']][_0x7d8d('0x23')]=dials[_0x43e4d0[_0x7d8d('0x9')]]['answertime']?utils[_0x7d8d('0x21')](dials[_0x43e4d0[_0x7d8d('0x9')]][_0x7d8d('0x22')],dials[_0x43e4d0[_0x7d8d('0x9')]][_0x7d8d('0x1e')]):0x0;writeDB(dials[_0x43e4d0['uniqueid']]);}}catch(_0x47960c){utils[_0x7d8d('0x11')](_0x47960c[_0x7d8d('0x12')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b87ca3b..5a16e7f 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 _0x6328=['./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','asterisk','port','username','password','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller'];(function(_0x52a858,_0x1df8ea){var _0x247399=function(_0x398b94){while(--_0x398b94){_0x52a858['push'](_0x52a858['shift']());}};_0x247399(++_0x1df8ea);}(_0x6328,0x199));var _0x8632=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x6328[_0x1deee5];return _0x1d6c3a;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8632('0x0'));var utils=require('./utils');var ami=new AsteriskManager(config[_0x8632('0x1')][_0x8632('0x2')],config[_0x8632('0x1')]['ip'],config[_0x8632('0x1')][_0x8632('0x3')],config['asterisk'][_0x8632('0x4')],!![]);ami[_0x8632('0x5')]();if(config[_0x8632('0x6')]&&config[_0x8632('0x6')][_0x8632('0x7')]){utils[_0x8632('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x8632('0x9'));var calls=require(_0x8632('0xa'));var queues=require(_0x8632('0xb'));var recordings=require('./recordings.controller');var members=require(_0x8632('0xc'));var dials=require(_0x8632('0xd'));var transfers=require(_0x8632('0xe'));var core=require(_0x8632('0xf'));ami['on'](_0x8632('0x10'),core['connect']);ami['on'](_0x8632('0x11'),core[_0x8632('0x11')]);ami['on']('fullybooted',core[_0x8632('0x12')]);ami['on'](_0x8632('0x13'),core[_0x8632('0x13')]);ami['on'](_0x8632('0x14'),core[_0x8632('0x14')]);ami['on'](_0x8632('0x15'),core[_0x8632('0x15')]);ami['on'](_0x8632('0x16'),function(_0x38ffd3){try{members[_0x8632('0x16')](_0x38ffd3);}catch(_0x29b9d9){utils[_0x8632('0x13')](_0x29b9d9);}});ami['on'](_0x8632('0x17'),function(_0x289c2d){try{agents[_0x8632('0x17')](_0x289c2d);}catch(_0xd9b88b){utils[_0x8632('0x13')](_0xd9b88b);}});ami['on'](_0x8632('0x18'),function(_0x26dcde){try{agents['agentringnoanswer'](_0x26dcde);}catch(_0x370174){utils[_0x8632('0x13')](_0x370174);}});ami['on'](_0x8632('0x19'),function(_0x318070){try{agents['agentconnect'](_0x318070);queues[_0x8632('0x19')](_0x318070);}catch(_0x504f1b){utils[_0x8632('0x13')](_0x504f1b);}});ami['on'](_0x8632('0x1a'),function(_0x44024b){try{agents['agentcomplete'](_0x44024b);queues[_0x8632('0x1a')](_0x44024b);members[_0x8632('0x1a')](_0x44024b);}catch(_0x3b1e72){utils['error'](_0x3b1e72);}});ami['on'](_0x8632('0x1b'),function(_0x6b12ef){try{agents[_0x8632('0x1b')](_0x6b12ef);queues[_0x8632('0x1b')](_0x6b12ef);}catch(_0x4fb8c8){utils[_0x8632('0x13')](_0x4fb8c8);}});ami['on']('queuecallerjoin',function(_0x1e36ae){try{queues[_0x8632('0x1c')](_0x1e36ae);recordings[_0x8632('0x1c')](_0x1e36ae);}catch(_0x4fe9c7){utils[_0x8632('0x13')](_0x4fe9c7);}});ami['on'](_0x8632('0x1d'),function(_0x59a4a8){try{queues['queuecallerleave'](_0x59a4a8);}catch(_0xd6a7ea){utils[_0x8632('0x13')](_0xd6a7ea);}});ami['on'](_0x8632('0x1e'),function(_0x11c98b){try{queues[_0x8632('0x1e')](_0x11c98b);calls[_0x8632('0x1e')](_0x11c98b);}catch(_0x54dd17){utils[_0x8632('0x13')](_0x54dd17);}});ami['on'](_0x8632('0x1f'),function(_0x102690){try{queues['musiconholdstop'](_0x102690);calls[_0x8632('0x1f')](_0x102690);}catch(_0x533f14){utils[_0x8632('0x13')](_0x533f14);}});ami['on'](_0x8632('0x20'),function(_0x5544ed){try{calls['newstate'](_0x5544ed);recordings['newstate'](_0x5544ed);}catch(_0x1f749a){utils[_0x8632('0x13')](_0x1f749a);}});ami['on']('hangup',function(_0x4dcf29){try{calls[_0x8632('0x21')](_0x4dcf29);recordings[_0x8632('0x21')](_0x4dcf29);dials[_0x8632('0x21')](_0x4dcf29);agents[_0x8632('0x21')](_0x4dcf29);queues[_0x8632('0x21')](_0x4dcf29);}catch(_0x4c82f7){utils[_0x8632('0x13')](_0x4c82f7);}});ami['on']('cdr',function(_0x261601){try{members[_0x8632('0x22')](_0x261601);}catch(_0x3f34af){utils[_0x8632('0x13')](_0x3f34af);}});ami['on'](_0x8632('0x23'),function(_0x5ccbaa){try{queues[_0x8632('0x23')](_0x5ccbaa);agents[_0x8632('0x23')](_0x5ccbaa);transfers['blindtransfer'](_0x5ccbaa);}catch(_0x4b0ee4){utils['error'](_0x4b0ee4);}});ami['on']('attendedtransfer',function(_0x1f8b9c){try{queues[_0x8632('0x24')](_0x1f8b9c);transfers[_0x8632('0x24')](_0x1f8b9c);agents['attendedtransfer'](_0x1f8b9c);calls[_0x8632('0x24')](_0x1f8b9c);}catch(_0x3225a2){utils[_0x8632('0x13')](_0x3225a2);}});ami['on'](_0x8632('0x25'),function(_0x450b9e){try{queues[_0x8632('0x25')](_0x450b9e);recordings[_0x8632('0x25')](_0x450b9e);calls['varset'](_0x450b9e);dials[_0x8632('0x25')](_0x450b9e);}catch(_0x2dd13b){utils[_0x8632('0x13')](_0x2dd13b);}});ami['on'](_0x8632('0x26'),function(_0x523992){try{calls[_0x8632('0x26')](_0x523992);recordings[_0x8632('0x26')](_0x523992);dials['newexten'](_0x523992);}catch(_0x169ff8){utils[_0x8632('0x13')](_0x169ff8);}});ami['on'](_0x8632('0x27'),function(_0x49b0e1){try{calls[_0x8632('0x27')](_0x49b0e1);recordings[_0x8632('0x27')](_0x49b0e1);}catch(_0x32502b){utils[_0x8632('0x13')](_0x32502b);}});ami['on']('dialbegin',function(_0x2d945f){try{dials[_0x8632('0x28')](_0x2d945f);}catch(_0x58b3a8){utils['error'](_0x58b3a8);}});ami['on'](_0x8632('0x29'),function(_0x3389b3){try{dials['dialend'](_0x3389b3);}catch(_0x527ec3){utils[_0x8632('0x13')](_0x527ec3);}});} \ No newline at end of file +var _0xd6b4=['blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','port','username','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr'];(function(_0x4213ab,_0x30455e){var _0x23fd53=function(_0x3a3123){while(--_0x3a3123){_0x4213ab['push'](_0x4213ab['shift']());}};_0x23fd53(++_0x30455e);}(_0xd6b4,0x178));var _0x4d6b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd6b4[_0x14add3];return _0x4a174f;};var AsteriskManager=require(_0x4d6b('0x0'));var config=require('../../config/environment');var utils=require(_0x4d6b('0x1'));var ami=new AsteriskManager(config[_0x4d6b('0x2')][_0x4d6b('0x3')],config[_0x4d6b('0x2')]['ip'],config[_0x4d6b('0x2')][_0x4d6b('0x4')],config['asterisk']['password'],!![]);ami['keepConnected']();if(config[_0x4d6b('0x5')]&&config[_0x4d6b('0x5')][_0x4d6b('0x6')]){utils[_0x4d6b('0x7')](_0x4d6b('0x8'));}else{var agents=require('./agents.controller');var calls=require(_0x4d6b('0x9'));var queues=require(_0x4d6b('0xa'));var recordings=require(_0x4d6b('0xb'));var members=require(_0x4d6b('0xc'));var dials=require(_0x4d6b('0xd'));var transfers=require(_0x4d6b('0xe'));var core=require(_0x4d6b('0xf'));ami['on'](_0x4d6b('0x10'),core[_0x4d6b('0x10')]);ami['on'](_0x4d6b('0x11'),core[_0x4d6b('0x11')]);ami['on'](_0x4d6b('0x12'),core['fullybooted']);ami['on'](_0x4d6b('0x13'),core['error']);ami['on'](_0x4d6b('0x14'),core[_0x4d6b('0x14')]);ami['on'](_0x4d6b('0x15'),core[_0x4d6b('0x15')]);ami['on'](_0x4d6b('0x16'),function(_0x490219){try{members[_0x4d6b('0x16')](_0x490219);}catch(_0xc3d004){utils['error'](_0xc3d004);}});ami['on']('agentcalled',function(_0x65d4c1){try{agents['agentcalled'](_0x65d4c1);}catch(_0x1b0570){utils[_0x4d6b('0x13')](_0x1b0570);}});ami['on'](_0x4d6b('0x17'),function(_0x1bc722){try{agents[_0x4d6b('0x17')](_0x1bc722);}catch(_0x3d23ae){utils['error'](_0x3d23ae);}});ami['on'](_0x4d6b('0x18'),function(_0x18f26a){try{agents['agentconnect'](_0x18f26a);queues[_0x4d6b('0x18')](_0x18f26a);}catch(_0x4ac416){utils[_0x4d6b('0x13')](_0x4ac416);}});ami['on']('agentcomplete',function(_0x46cd64){try{agents[_0x4d6b('0x19')](_0x46cd64);queues[_0x4d6b('0x19')](_0x46cd64);members[_0x4d6b('0x19')](_0x46cd64);}catch(_0x49f46e){utils['error'](_0x49f46e);}});ami['on'](_0x4d6b('0x1a'),function(_0x3f2075){try{agents[_0x4d6b('0x1a')](_0x3f2075);queues[_0x4d6b('0x1a')](_0x3f2075);}catch(_0x3a8bdd){utils[_0x4d6b('0x13')](_0x3a8bdd);}});ami['on'](_0x4d6b('0x1b'),function(_0x89a5c){try{queues[_0x4d6b('0x1b')](_0x89a5c);recordings[_0x4d6b('0x1b')](_0x89a5c);}catch(_0x3ebc96){utils[_0x4d6b('0x13')](_0x3ebc96);}});ami['on'](_0x4d6b('0x1c'),function(_0x3e004c){try{queues[_0x4d6b('0x1c')](_0x3e004c);}catch(_0x58e951){utils[_0x4d6b('0x13')](_0x58e951);}});ami['on']('musiconholdstart',function(_0x430a5e){try{queues[_0x4d6b('0x1d')](_0x430a5e);calls['musiconholdstart'](_0x430a5e);}catch(_0x23bb7a){utils[_0x4d6b('0x13')](_0x23bb7a);}});ami['on'](_0x4d6b('0x1e'),function(_0x23cabf){try{queues[_0x4d6b('0x1e')](_0x23cabf);calls[_0x4d6b('0x1e')](_0x23cabf);}catch(_0x3e100a){utils['error'](_0x3e100a);}});ami['on'](_0x4d6b('0x1f'),function(_0x24c61e){try{calls['newstate'](_0x24c61e);recordings[_0x4d6b('0x1f')](_0x24c61e);}catch(_0x31ef61){utils[_0x4d6b('0x13')](_0x31ef61);}});ami['on'](_0x4d6b('0x20'),function(_0x30f068){try{calls['hangup'](_0x30f068);recordings[_0x4d6b('0x20')](_0x30f068);dials[_0x4d6b('0x20')](_0x30f068);agents[_0x4d6b('0x20')](_0x30f068);queues['hangup'](_0x30f068);}catch(_0x156d6c){utils['error'](_0x156d6c);}});ami['on'](_0x4d6b('0x21'),function(_0x3f2bf7){try{members['cdr'](_0x3f2bf7);}catch(_0x3d3a28){utils[_0x4d6b('0x13')](_0x3d3a28);}});ami['on'](_0x4d6b('0x22'),function(_0x27c44d){try{queues[_0x4d6b('0x22')](_0x27c44d);agents['blindtransfer'](_0x27c44d);transfers[_0x4d6b('0x22')](_0x27c44d);}catch(_0x151eb0){utils[_0x4d6b('0x13')](_0x151eb0);}});ami['on'](_0x4d6b('0x23'),function(_0x54d315){try{queues['attendedtransfer'](_0x54d315);transfers[_0x4d6b('0x23')](_0x54d315);agents[_0x4d6b('0x23')](_0x54d315);calls[_0x4d6b('0x23')](_0x54d315);}catch(_0x420f24){utils[_0x4d6b('0x13')](_0x420f24);}});ami['on'](_0x4d6b('0x24'),function(_0x178e04){try{queues[_0x4d6b('0x24')](_0x178e04);recordings['varset'](_0x178e04);calls[_0x4d6b('0x24')](_0x178e04);dials['varset'](_0x178e04);}catch(_0x4ca2a5){utils[_0x4d6b('0x13')](_0x4ca2a5);}});ami['on']('newexten',function(_0x298f95){try{calls['newexten'](_0x298f95);recordings[_0x4d6b('0x25')](_0x298f95);dials[_0x4d6b('0x25')](_0x298f95);}catch(_0x5d691c){utils[_0x4d6b('0x13')](_0x5d691c);}});ami['on'](_0x4d6b('0x26'),function(_0x5f070c){try{calls[_0x4d6b('0x26')](_0x5f070c);recordings[_0x4d6b('0x26')](_0x5f070c);}catch(_0x34b2f9){utils['error'](_0x34b2f9);}});ami['on'](_0x4d6b('0x27'),function(_0x29dd45){try{dials[_0x4d6b('0x27')](_0x29dd45);}catch(_0x232f74){utils['error'](_0x232f74);}});ami['on'](_0x4d6b('0x28'),function(_0x291d1b){try{dials[_0x4d6b('0x28')](_0x291d1b);}catch(_0x148548){utils[_0x4d6b('0x13')](_0x148548);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 52659a2..30107b1 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 _0x515a=['getUserByName','catch','startsWith','state','INUSE','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','assign','queue','cdr','channel','split','data1','source','data3','destination','destinationchannel','lodash','./utils','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','data2','membername','type','interface','getUserByInterface','name','internal','request','CreateMemberReport'];(function(_0xe2e69f,_0x67ed83){var _0x583ac1=function(_0x4d3d88){while(--_0x4d3d88){_0xe2e69f['push'](_0xe2e69f['shift']());}};_0x583ac1(++_0x67ed83);}(_0x515a,0xe6));var _0xa515=function(_0x228359,_0x3c9e55){_0x228359=_0x228359-0x0;var _0x2f068c=_0x515a[_0x228359];return _0x2f068c;};'use strict';var _=require(_0xa515('0x0'));var util=require('util');var utils=require(_0xa515('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xa515('0x2')];function writeDB(_0x5d714c){utils[_0xa515('0x3')](util[_0xa515('0x4')](_0xa515('0x5'),_0x5d714c[_0xa515('0x6')],_0x5d714c['interface'],_0x5d714c['channel'],_0x5d714c[_0xa515('0x7')],_0x5d714c[_0xa515('0x8')],_0x5d714c[_0xa515('0x9')]));if(_0x5d714c[_0xa515('0xa')]){utils[_0xa515('0xb')](_0x5d714c['interface'])['then'](function(_0x2472c6){if(_0x2472c6){_0x5d714c['membername']=_0x2472c6[_0xa515('0xc')];_0x5d714c['internal']=_0x2472c6[_0xa515('0xd')];utils[_0xa515('0xe')](_0xa515('0xf'),_0x5d714c);}else{utils[_0xa515('0x10')](_0x5d714c[_0xa515('0xa')]['split']('/')[0x1])['then'](function(_0x495e96){if(_0x495e96){_0x5d714c['membername']=_0x495e96['name'];_0x5d714c[_0xa515('0xd')]=_0x495e96[_0xa515('0xd')];utils[_0xa515('0xe')](_0xa515('0xf'),_0x5d714c);}});}})[_0xa515('0x11')](function(_0x14e9b0){utils['error'](_0x14e9b0);});}delete members[_0x5d714c['interface']];}function startsWith(_0x1bc8bc,_0x55cc4c){return _['some'](_0x1bc8bc,function(_0x446815){return _[_0xa515('0x12')](_0x55cc4c,_0x446815);});}exports['devicestatechange']=function(_0x2b19fe){switch(_0x2b19fe[_0xa515('0x13')]){case _0xa515('0x14'):case'BUSY':if(!startsWith(exclude,_0x2b19fe[_0xa515('0x15')])){members[_0x2b19fe[_0xa515('0x15')]]={'channel':'voice','interface':_0x2b19fe[_0xa515('0x15')],'type':_0xa515('0x16'),'enterAt':utils[_0xa515('0x17')](),'role':_0xa515('0x18')};}break;case _0xa515('0x19'):if(!_[_0xa515('0x1a')](members[_0x2b19fe[_0xa515('0x15')]])){members[_0x2b19fe['device']][_0xa515('0x1b')]=utils[_0xa515('0x17')]();members[_0x2b19fe[_0xa515('0x15')]][_0xa515('0x1c')]=utils['diffTime'](members[_0x2b19fe['device']][_0xa515('0x1b')],members[_0x2b19fe['device']][_0xa515('0x1d')]);if(members[_0x2b19fe[_0xa515('0x15')]][_0xa515('0x6')]){writeDB(members[_0x2b19fe[_0xa515('0x15')]]);}}default:break;}};exports[_0xa515('0x1e')]=function(_0x464e21){if(!_[_0xa515('0x1a')](members[_0x464e21[_0xa515('0xa')]])){members[_0x464e21[_0xa515('0xa')]]=_[_0xa515('0x1f')](members[_0x464e21[_0xa515('0xa')]],{'data4':_0x464e21[_0xa515('0x20')],'uniqueid':_0x464e21[_0xa515('0x6')]});}};exports[_0xa515('0x21')]=function(_0x4764a4){if(_0x4764a4[_0xa515('0x22')]){var _0x193bd8=_0x4764a4[_0xa515('0x22')][_0xa515('0x23')]('-')[0x0];if(!_[_0xa515('0x1a')](members[_0x193bd8])){members[_0x193bd8]=_[_0xa515('0x1f')](members[_0x193bd8],{'data1':members[_0x193bd8][_0xa515('0x24')]||_0x4764a4['type'],'data2':members[_0x193bd8][_0xa515('0x7')]||_0x4764a4[_0xa515('0x25')],'data3':members[_0x193bd8][_0xa515('0x26')]||_0x4764a4[_0xa515('0x27')],'uniqueid':members[_0x193bd8][_0xa515('0x6')]||_0x4764a4[_0xa515('0x6')]});if(members[_0x193bd8][_0xa515('0x1b')]){writeDB(members[_0x193bd8]);}}}if(_0x4764a4[_0xa515('0x28')]){var _0x34e2d7=_0x4764a4['destinationchannel'][_0xa515('0x23')]('-')[0x0];if(!_[_0xa515('0x1a')](members[_0x34e2d7])){members[_0x34e2d7]=_[_0xa515('0x1f')](members[_0x34e2d7],{'data1':members[_0x34e2d7][_0xa515('0x24')]||_0x4764a4[_0xa515('0x9')],'data2':members[_0x34e2d7][_0xa515('0x7')]||_0x4764a4[_0xa515('0x25')],'data3':members[_0x34e2d7][_0xa515('0x26')]||_0x4764a4[_0xa515('0x27')],'uniqueid':members[_0x34e2d7][_0xa515('0x6')]||_0x4764a4['uniqueid']});if(members[_0x34e2d7][_0xa515('0x1b')]){writeDB(members[_0x34e2d7]);}}}}; \ No newline at end of file +var _0xfb9d=['cdr','data1','type','destination','destinationchannel','data3','util','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','then','internal','CreateMemberReport','getUserByName','split','name','request','catch','some','startsWith','state','INUSE','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','assign','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfb9d,0x15e));var _0xdfb9=function(_0x358641,_0x14a311){_0x358641=_0x358641-0x0;var _0x49edcd=_0xfb9d[_0x358641];return _0x49edcd;};'use strict';var _=require('lodash');var util=require(_0xdfb9('0x0'));var utils=require(_0xdfb9('0x1'));var members={};var exclude=[_0xdfb9('0x2'),_0xdfb9('0x3')];function writeDB(_0x1c3945){utils[_0xdfb9('0x4')](util[_0xdfb9('0x5')](_0xdfb9('0x6'),_0x1c3945[_0xdfb9('0x7')],_0x1c3945[_0xdfb9('0x8')],_0x1c3945[_0xdfb9('0x9')],_0x1c3945[_0xdfb9('0xa')],_0x1c3945[_0xdfb9('0xb')],_0x1c3945['type']));if(_0x1c3945[_0xdfb9('0x8')]){utils['getUserByInterface'](_0x1c3945['interface'])[_0xdfb9('0xc')](function(_0x3286a5){if(_0x3286a5){_0x1c3945[_0xdfb9('0xb')]=_0x3286a5['name'];_0x1c3945['internal']=_0x3286a5[_0xdfb9('0xd')];utils['request'](_0xdfb9('0xe'),_0x1c3945);}else{utils[_0xdfb9('0xf')](_0x1c3945[_0xdfb9('0x8')][_0xdfb9('0x10')]('/')[0x1])['then'](function(_0x55847b){if(_0x55847b){_0x1c3945[_0xdfb9('0xb')]=_0x55847b[_0xdfb9('0x11')];_0x1c3945[_0xdfb9('0xd')]=_0x55847b[_0xdfb9('0xd')];utils[_0xdfb9('0x12')](_0xdfb9('0xe'),_0x1c3945);}});}})[_0xdfb9('0x13')](function(_0x5b9fcf){utils['error'](_0x5b9fcf);});}delete members[_0x1c3945['interface']];}function startsWith(_0x225654,_0x153982){return _[_0xdfb9('0x14')](_0x225654,function(_0x15f8c3){return _[_0xdfb9('0x15')](_0x153982,_0x15f8c3);});}exports['devicestatechange']=function(_0x26cd39){switch(_0x26cd39[_0xdfb9('0x16')]){case _0xdfb9('0x17'):case'BUSY':if(!startsWith(exclude,_0x26cd39['device'])){members[_0x26cd39[_0xdfb9('0x18')]]={'channel':'voice','interface':_0x26cd39[_0xdfb9('0x18')],'type':_0xdfb9('0x19'),'enterAt':utils[_0xdfb9('0x1a')](),'role':_0xdfb9('0x1b')};}break;case _0xdfb9('0x1c'):if(!_[_0xdfb9('0x1d')](members[_0x26cd39[_0xdfb9('0x18')]])){members[_0x26cd39[_0xdfb9('0x18')]][_0xdfb9('0x1e')]=utils[_0xdfb9('0x1a')]();members[_0x26cd39[_0xdfb9('0x18')]][_0xdfb9('0x1f')]=utils[_0xdfb9('0x20')](members[_0x26cd39[_0xdfb9('0x18')]][_0xdfb9('0x1e')],members[_0x26cd39['device']][_0xdfb9('0x21')]);if(members[_0x26cd39[_0xdfb9('0x18')]]['uniqueid']){writeDB(members[_0x26cd39[_0xdfb9('0x18')]]);}}default:break;}};exports[_0xdfb9('0x22')]=function(_0x370110){if(!_['isNil'](members[_0x370110[_0xdfb9('0x8')]])){members[_0x370110[_0xdfb9('0x8')]]=_[_0xdfb9('0x23')](members[_0x370110[_0xdfb9('0x8')]],{'data4':_0x370110[_0xdfb9('0x24')],'uniqueid':_0x370110[_0xdfb9('0x7')]});}};exports[_0xdfb9('0x25')]=function(_0x53987f){if(_0x53987f[_0xdfb9('0x9')]){var _0x544e0b=_0x53987f[_0xdfb9('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x544e0b])){members[_0x544e0b]=_[_0xdfb9('0x23')](members[_0x544e0b],{'data1':members[_0x544e0b][_0xdfb9('0x26')]||_0x53987f[_0xdfb9('0x27')],'data2':members[_0x544e0b][_0xdfb9('0xa')]||_0x53987f['source'],'data3':members[_0x544e0b]['data3']||_0x53987f[_0xdfb9('0x28')],'uniqueid':members[_0x544e0b][_0xdfb9('0x7')]||_0x53987f[_0xdfb9('0x7')]});if(members[_0x544e0b][_0xdfb9('0x1e')]){writeDB(members[_0x544e0b]);}}}if(_0x53987f[_0xdfb9('0x29')]){var _0x5934c4=_0x53987f[_0xdfb9('0x29')][_0xdfb9('0x10')]('-')[0x0];if(!_[_0xdfb9('0x1d')](members[_0x5934c4])){members[_0x5934c4]=_[_0xdfb9('0x23')](members[_0x5934c4],{'data1':members[_0x5934c4][_0xdfb9('0x26')]||_0x53987f[_0xdfb9('0x27')],'data2':members[_0x5934c4][_0xdfb9('0xa')]||_0x53987f['source'],'data3':members[_0x5934c4][_0xdfb9('0x2a')]||_0x53987f[_0xdfb9('0x28')],'uniqueid':members[_0x5934c4][_0xdfb9('0x7')]||_0x53987f[_0xdfb9('0x7')]});if(members[_0x5934c4]['exitAt']){writeDB(members[_0x5934c4]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2525706..9445cd3 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 _0xcd32=['now','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','accountcode','destaccountcode','agentcomplete','assigned','membername','transfer','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','secondtransfererlinkedid','transfertype','ATTENDED','origtransfereruniqueid','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','position','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt'];(function(_0x458e7f,_0x100ce6){var _0x24c51d=function(_0x4a1a3f){while(--_0x4a1a3f){_0x458e7f['push'](_0x458e7f['shift']());}};_0x24c51d(++_0x100ce6);}(_0xcd32,0x1e8));var _0x2cd3=function(_0x5f2234,_0x513fb1){_0x5f2234=_0x5f2234-0x0;var _0x277a8d=_0xcd32[_0x5f2234];return _0x277a8d;};'use strict';var _=require(_0x2cd3('0x0'));var util=require(_0x2cd3('0x1'));var utils=require(_0x2cd3('0x2'));var queues={};function writeDB(_0x5bb308){utils['info'](util[_0x2cd3('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x5bb308['uniqueid'],_0x5bb308[_0x2cd3('0x4')],_0x5bb308[_0x2cd3('0x5')],_0x5bb308[_0x2cd3('0x6')],_0x5bb308[_0x2cd3('0x7')],_0x5bb308['accountcode'],_0x5bb308[_0x2cd3('0x8')]));if(_0x5bb308['queue']){utils[_0x2cd3('0x9')](_0x5bb308['queue'])['then'](function(_0x4866ab){if(_0x4866ab){_0x5bb308['type']=_0x4866ab[_0x2cd3('0xa')];}utils[_0x2cd3('0xb')](_0x2cd3('0xc'),_0x5bb308);});}else{utils[_0x2cd3('0xb')](_0x2cd3('0xc'),_0x5bb308);}if(_0x5bb308[_0x2cd3('0xd')]){delete queues[_0x5bb308[_0x2cd3('0xd')]];}else{delete queues[_0x5bb308[_0x2cd3('0xe')]];}}exports[_0x2cd3('0xf')]=function(_0x4c5ed3){queues[_0x4c5ed3[_0x2cd3('0xe')]]=_['assign'](_0x4c5ed3,{'originalposition':_0x4c5ed3[_0x2cd3('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports['hangup']=function(_0x243395){if(!_[_0x2cd3('0x11')](queues[_0x243395[_0x2cd3('0xe')]])){if(queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0x12')]){if(!queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0x13')]&&!queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0x14')]){queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0x15')]=!![];queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0x16')]=utils[_0x2cd3('0x17')]();queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0x8')]=_0x2cd3('0x18');}writeDB(queues[_0x243395[_0x2cd3('0xe')]]);}else{if(queues[_0x243395['uniqueid']][_0x2cd3('0xd')]){queues[queues[_0x243395[_0x2cd3('0xe')]]['transfereduniqueid']]=queues[_0x243395[_0x2cd3('0xe')]];queues[queues[_0x243395[_0x2cd3('0xe')]][_0x2cd3('0xd')]][_0x2cd3('0x19')]=0x2;delete queues[_0x243395[_0x2cd3('0xe')]];}}}};exports[_0x2cd3('0x1a')]=function(_0x5ab997){if(!_['isNil'](_0x5ab997[_0x2cd3('0x1b')][_0x2cd3('0x1c')])&&_0x5ab997['value'][_0x2cd3('0x1d')]()!==_0x2cd3('0x1e')){if(!_[_0x2cd3('0x11')](queues[_0x5ab997[_0x2cd3('0xe')]])){queues[_0x5ab997[_0x2cd3('0xe')]][_0x2cd3('0x13')]=![];queues[_0x5ab997[_0x2cd3('0xe')]][_0x2cd3('0x1f')]=null;queues[_0x5ab997[_0x2cd3('0xe')]][_0x2cd3('0x14')]=!![];queues[_0x5ab997[_0x2cd3('0xe')]]['queuecallerexitAt']=utils[_0x2cd3('0x17')]();queues[_0x5ab997['uniqueid']][_0x2cd3('0x8')]=_0x5ab997['value']['toUpperCase']();writeDB(queues[_0x5ab997[_0x2cd3('0xe')]]);}}else if(!_[_0x2cd3('0x11')](_0x5ab997[_0x2cd3('0x1b')]['queueposition'])){if(!_[_0x2cd3('0x11')](queues[_0x5ab997[_0x2cd3('0xe')]])&&!queues[_0x5ab997['uniqueid']][_0x2cd3('0x13')]){queues[_0x5ab997[_0x2cd3('0xe')]][_0x2cd3('0x13')]=![];queues[_0x5ab997[_0x2cd3('0xe')]]['queuecallerabandonAt']=null;queues[_0x5ab997[_0x2cd3('0xe')]]['queuecallerexit']=!![];queues[_0x5ab997[_0x2cd3('0xe')]][_0x2cd3('0x20')]=utils[_0x2cd3('0x17')]();queues[_0x5ab997['uniqueid']][_0x2cd3('0x8')]=_0x2cd3('0x21');}}};exports['queuecallerabandon']=function(_0x1da173){if(!_[_0x2cd3('0x11')](queues[_0x1da173[_0x2cd3('0xe')]])){queues[_0x1da173[_0x2cd3('0xe')]][_0x2cd3('0x14')]=![];queues[_0x1da173[_0x2cd3('0xe')]][_0x2cd3('0x20')]=null;queues[_0x1da173[_0x2cd3('0xe')]]['queuecallerabandon']=!![];queues[_0x1da173[_0x2cd3('0xe')]][_0x2cd3('0x1f')]=utils[_0x2cd3('0x17')]();queues[_0x1da173[_0x2cd3('0xe')]][_0x2cd3('0x8')]=_0x2cd3('0x22');}};exports[_0x2cd3('0x23')]=function(_0x415ab2){if(!_[_0x2cd3('0x11')](queues[_0x415ab2[_0x2cd3('0xe')]])){queues[_0x415ab2[_0x2cd3('0xe')]][_0x2cd3('0x23')]=!![];queues[_0x415ab2[_0x2cd3('0xe')]]['queuecallerleaveAt']=utils[_0x2cd3('0x17')]();queues[_0x415ab2[_0x2cd3('0xe')]][_0x2cd3('0x24')]=utils['diffTime'](queues[_0x415ab2[_0x2cd3('0xe')]][_0x2cd3('0x12')],queues[_0x415ab2[_0x2cd3('0xe')]][_0x2cd3('0x25')]);queues[_0x415ab2['uniqueid']]['position']=_0x415ab2[_0x2cd3('0x10')];queues[_0x415ab2[_0x2cd3('0xe')]][_0x2cd3('0x26')]=_0x415ab2[_0x2cd3('0x26')];queues[_0x415ab2[_0x2cd3('0xe')]][_0x2cd3('0x27')]=_0x415ab2[_0x2cd3('0x27')];queues[_0x415ab2['uniqueid']][_0x2cd3('0x28')]=_0x415ab2[_0x2cd3('0x28')];}};exports['agentconnect']=function(_0x40c969){if(!_[_0x2cd3('0x11')](queues[_0x40c969[_0x2cd3('0xe')]])){queues[_0x40c969[_0x2cd3('0xe')]][_0x2cd3('0x13')]=![];queues[_0x40c969[_0x2cd3('0xe')]]['queuecallerabandon']=![];queues[_0x40c969[_0x2cd3('0xe')]][_0x2cd3('0x1f')]=null;queues[_0x40c969[_0x2cd3('0xe')]][_0x2cd3('0x14')]=![];queues[_0x40c969[_0x2cd3('0xe')]][_0x2cd3('0x8')]=null;queues[_0x40c969[_0x2cd3('0xe')]]['queuecallerexitAt']=null;queues[_0x40c969[_0x2cd3('0xe')]]['assigned']=!![];queues[_0x40c969[_0x2cd3('0xe')]][_0x2cd3('0x29')]=_0x40c969[_0x2cd3('0x2a')];queues[_0x40c969['uniqueid']][_0x2cd3('0x6')]=_0x40c969['membername'];}};exports[_0x2cd3('0x2b')]=function(_0x5509ff){if(!_[_0x2cd3('0x11')](queues[_0x5509ff[_0x2cd3('0xe')]])){if(queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x12')]){queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x13')]=![];queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x13')]=![];queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x1f')]=null;queues[_0x5509ff['uniqueid']][_0x2cd3('0x14')]=![];queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x20')]=null;queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x2c')]=!![];queues[_0x5509ff[_0x2cd3('0xe')]]['lastAssignedTo']=_0x5509ff[_0x2cd3('0x2d')];queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x15')]=!![];queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x16')]=utils[_0x2cd3('0x17')]();if(_0x5509ff['reason']==_0x2cd3('0x2e')){if(!queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x2e')]){queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x8')]='TRANSFER';}}else{queues[_0x5509ff[_0x2cd3('0xe')]][_0x2cd3('0x8')]=_0x2cd3('0x2f')+_0x5509ff[_0x2cd3('0x30')]['toUpperCase']();}writeDB(queues[_0x5509ff['uniqueid']]);}}};exports[_0x2cd3('0x31')]=function(_0x3552f6){if(!_[_0x2cd3('0x11')](queues[_0x3552f6[_0x2cd3('0x32')]])){queues[_0x3552f6[_0x2cd3('0x32')]]['transfer']=!![];queues[_0x3552f6[_0x2cd3('0x32')]]['transfertype']=_0x2cd3('0x33');queues[_0x3552f6[_0x2cd3('0x32')]][_0x2cd3('0x34')]=_0x3552f6['extension'];queues[_0x3552f6[_0x2cd3('0x32')]][_0x2cd3('0x35')]=_0x3552f6[_0x2cd3('0x32')];queues[_0x3552f6[_0x2cd3('0x32')]][_0x2cd3('0x8')]=_0x2cd3('0x36');}};exports['attendedtransfer']=function(_0x356b1a){try{if(_0x356b1a['origtransfereruniqueid']==_0x356b1a['origtransfererlinkedid']){if(!_[_0x2cd3('0x11')](queues[_0x356b1a[_0x2cd3('0x37')]])){queues[_0x356b1a[_0x2cd3('0x37')]][_0x2cd3('0x2e')]=!![];queues[_0x356b1a['secondtransfererlinkedid']][_0x2cd3('0x38')]=_0x2cd3('0x39');queues[_0x356b1a['secondtransfererlinkedid']][_0x2cd3('0x34')]=_0x356b1a['origtransfererexten'];queues[_0x356b1a[_0x2cd3('0x37')]][_0x2cd3('0x35')]=_0x356b1a[_0x2cd3('0x3a')];queues[_0x356b1a[_0x2cd3('0x37')]][_0x2cd3('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x2cd3('0x11')](queues[_0x356b1a[_0x2cd3('0x3b')]])){if(_0x356b1a[_0x2cd3('0x3c')]&&queues[_0x356b1a[_0x2cd3('0x3c')]]){queues[_0x356b1a[_0x2cd3('0x3c')]][_0x2cd3('0x19')]=0x1;queues[_0x356b1a[_0x2cd3('0x32')]]=_['clone'](queues[_0x356b1a[_0x2cd3('0x3c')]]);queues[_0x356b1a['transfereeuniqueid']][_0x2cd3('0xd')]=_0x356b1a[_0x2cd3('0x3d')];queues[_0x356b1a[_0x2cd3('0x32')]][_0x2cd3('0x19')]=0x2;queues[_0x356b1a[_0x2cd3('0x32')]][_0x2cd3('0x7')]=queues[_0x356b1a[_0x2cd3('0x37')]]['calleridnum'];queues[_0x356b1a['transfereeuniqueid']][_0x2cd3('0x3e')]=queues[_0x356b1a[_0x2cd3('0x37')]][_0x2cd3('0x3e')];queues[_0x356b1a[_0x2cd3('0x32')]][_0x2cd3('0x25')]=utils['now']();queues[_0x356b1a[_0x2cd3('0x32')]][_0x2cd3('0x12')]=utils[_0x2cd3('0x17')]();queues[_0x356b1a['transfereeuniqueid']][_0x2cd3('0x24')]=0x0;queues[_0x356b1a[_0x2cd3('0x32')]][_0x2cd3('0x3f')]=0x0;}else{queues[_0x356b1a['origtransfererlinkedid']][_0x2cd3('0xd')]=_0x356b1a[_0x2cd3('0x37')];}}}else if(_0x356b1a[_0x2cd3('0x40')]==_0x356b1a[_0x2cd3('0x37')]){if(!_['isNil'](queues[_0x356b1a[_0x2cd3('0x3b')]])){queues[_0x356b1a['origtransfererlinkedid']]['transfer']=!![];queues[_0x356b1a[_0x2cd3('0x3b')]]['transfertype']=_0x2cd3('0x39');queues[_0x356b1a[_0x2cd3('0x3b')]]['transferexten']=_0x356b1a[_0x2cd3('0x41')];queues[_0x356b1a['origtransfererlinkedid']][_0x2cd3('0x35')]=_0x356b1a[_0x2cd3('0x40')];queues[_0x356b1a[_0x2cd3('0x3b')]][_0x2cd3('0x8')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x356b1a[_0x2cd3('0x37')]])){if(_0x356b1a[_0x2cd3('0x42')]&&queues[_0x356b1a[_0x2cd3('0x42')]]){queues[_0x356b1a[_0x2cd3('0x42')]]['queuecallerenterreason']=0x1;queues[_0x356b1a[_0x2cd3('0x3d')]]=_['clone'](queues[_0x356b1a[_0x2cd3('0x42')]]);queues[_0x356b1a['transfertargetuniqueid']][_0x2cd3('0xd')]=_0x356b1a[_0x2cd3('0x3d')];queues[_0x356b1a[_0x2cd3('0x3d')]][_0x2cd3('0x19')]=0x2;queues[_0x356b1a[_0x2cd3('0x3d')]]['calleridnum']=queues[_0x356b1a[_0x2cd3('0x3b')]][_0x2cd3('0x7')];queues[_0x356b1a['transfertargetuniqueid']][_0x2cd3('0x3e')]=queues[_0x356b1a[_0x2cd3('0x3b')]][_0x2cd3('0x3e')];queues[_0x356b1a[_0x2cd3('0x3d')]][_0x2cd3('0x25')]=utils[_0x2cd3('0x17')]();queues[_0x356b1a[_0x2cd3('0x3d')]][_0x2cd3('0x12')]=utils[_0x2cd3('0x17')]();queues[_0x356b1a[_0x2cd3('0x3d')]][_0x2cd3('0x24')]=0x0;queues[_0x356b1a[_0x2cd3('0x3d')]][_0x2cd3('0x3f')]=0x0;}else{queues[_0x356b1a[_0x2cd3('0x37')]]['transfereduniqueid']=_0x356b1a[_0x2cd3('0x3b')];}}}}catch(_0x3141db){utils[_0x2cd3('0x43')](_0x3141db[_0x2cd3('0x44')]);}};exports[_0x2cd3('0x45')]=function(_0x46ae1c){if(!_[_0x2cd3('0x11')](queues[_0x46ae1c[_0x2cd3('0xe')]])){queues[_0x46ae1c[_0x2cd3('0xe')]][_0x2cd3('0x46')]=utils[_0x2cd3('0x17')]();}};exports[_0x2cd3('0x47')]=function(_0x99bd2c){if(!_[_0x2cd3('0x11')](queues[_0x99bd2c[_0x2cd3('0xe')]])){if(!_['isNil'](queues[_0x99bd2c[_0x2cd3('0xe')]][_0x2cd3('0x46')])){queues[_0x99bd2c[_0x2cd3('0xe')]][_0x2cd3('0x3f')]+=utils[_0x2cd3('0x48')](utils[_0x2cd3('0x17')](),queues[_0x99bd2c[_0x2cd3('0xe')]][_0x2cd3('0x46')]);delete queues[_0x99bd2c[_0x2cd3('0xe')]][_0x2cd3('0x46')];}}}; \ No newline at end of file +var _0x0e49=['lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','queueposition','queuecallerabandon','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','agentcomplete','lastAssignedTo','transfer','TRANSFER','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','calleridname','queuecallerjoinAt','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','transfertargetuniqueid','mohtime','error','stack','musiconholdstart','musiconholdstartAt'];(function(_0x3fbb70,_0x3b4a57){var _0x424fbe=function(_0xca478){while(--_0xca478){_0x3fbb70['push'](_0x3fbb70['shift']());}};_0x424fbe(++_0x3b4a57);}(_0x0e49,0x1a4));var _0x90e4=function(_0x19f3e5,_0x1c099e){_0x19f3e5=_0x19f3e5-0x0;var _0x5cd24e=_0x0e49[_0x19f3e5];return _0x5cd24e;};'use strict';var _=require(_0x90e4('0x0'));var util=require('util');var utils=require(_0x90e4('0x1'));var queues={};function writeDB(_0x1b2ddc){utils[_0x90e4('0x2')](util[_0x90e4('0x3')](_0x90e4('0x4'),_0x1b2ddc[_0x90e4('0x5')],_0x1b2ddc[_0x90e4('0x6')],_0x1b2ddc[_0x90e4('0x7')],_0x1b2ddc['lastAssignedTo'],_0x1b2ddc[_0x90e4('0x8')],_0x1b2ddc[_0x90e4('0x9')],_0x1b2ddc['queuecallerexitreason']));if(_0x1b2ddc[_0x90e4('0x7')]){utils[_0x90e4('0xa')](_0x1b2ddc[_0x90e4('0x7')])[_0x90e4('0xb')](function(_0x4faf3f){if(_0x4faf3f){_0x1b2ddc[_0x90e4('0xc')]=_0x4faf3f[_0x90e4('0xc')];}utils['request'](_0x90e4('0xd'),_0x1b2ddc);});}else{utils[_0x90e4('0xe')](_0x90e4('0xd'),_0x1b2ddc);}if(_0x1b2ddc[_0x90e4('0xf')]){delete queues[_0x1b2ddc[_0x90e4('0xf')]];}else{delete queues[_0x1b2ddc['uniqueid']];}}exports[_0x90e4('0x10')]=function(_0x2c6f53){queues[_0x2c6f53[_0x90e4('0x5')]]=_[_0x90e4('0x11')](_0x2c6f53,{'originalposition':_0x2c6f53[_0x90e4('0x12')],'queuecallerjoinAt':utils[_0x90e4('0x13')](),'mohtime':0x0});};exports[_0x90e4('0x14')]=function(_0x992648){if(!_[_0x90e4('0x15')](queues[_0x992648[_0x90e4('0x5')]])){if(queues[_0x992648[_0x90e4('0x5')]][_0x90e4('0x16')]){if(!queues[_0x992648['uniqueid']]['queuecallerabandon']&&!queues[_0x992648[_0x90e4('0x5')]][_0x90e4('0x17')]){queues[_0x992648[_0x90e4('0x5')]][_0x90e4('0x18')]=!![];queues[_0x992648[_0x90e4('0x5')]][_0x90e4('0x19')]=utils[_0x90e4('0x13')]();queues[_0x992648['uniqueid']][_0x90e4('0x1a')]=_0x90e4('0x1b');}writeDB(queues[_0x992648[_0x90e4('0x5')]]);}else{if(queues[_0x992648[_0x90e4('0x5')]][_0x90e4('0xf')]){queues[queues[_0x992648[_0x90e4('0x5')]][_0x90e4('0xf')]]=queues[_0x992648['uniqueid']];queues[queues[_0x992648[_0x90e4('0x5')]]['transfereduniqueid']][_0x90e4('0x1c')]=0x2;delete queues[_0x992648[_0x90e4('0x5')]];}}}};exports[_0x90e4('0x1d')]=function(_0xa21469){if(!_[_0x90e4('0x15')](_0xa21469[_0x90e4('0x1e')][_0x90e4('0x1f')])&&_0xa21469[_0x90e4('0x20')]['toUpperCase']()!==_0x90e4('0x21')){if(!_['isNil'](queues[_0xa21469['uniqueid']])){queues[_0xa21469[_0x90e4('0x5')]]['queuecallerabandon']=![];queues[_0xa21469[_0x90e4('0x5')]]['queuecallerabandonAt']=null;queues[_0xa21469['uniqueid']][_0x90e4('0x17')]=!![];queues[_0xa21469[_0x90e4('0x5')]][_0x90e4('0x22')]=utils[_0x90e4('0x13')]();queues[_0xa21469[_0x90e4('0x5')]][_0x90e4('0x1a')]=_0xa21469[_0x90e4('0x20')][_0x90e4('0x23')]();writeDB(queues[_0xa21469[_0x90e4('0x5')]]);}}else if(!_[_0x90e4('0x15')](_0xa21469[_0x90e4('0x1e')][_0x90e4('0x24')])){if(!_[_0x90e4('0x15')](queues[_0xa21469[_0x90e4('0x5')]])&&!queues[_0xa21469[_0x90e4('0x5')]][_0x90e4('0x25')]){queues[_0xa21469['uniqueid']][_0x90e4('0x25')]=![];queues[_0xa21469[_0x90e4('0x5')]][_0x90e4('0x26')]=null;queues[_0xa21469[_0x90e4('0x5')]]['queuecallerexit']=!![];queues[_0xa21469[_0x90e4('0x5')]][_0x90e4('0x22')]=utils[_0x90e4('0x13')]();queues[_0xa21469['uniqueid']][_0x90e4('0x1a')]=_0x90e4('0x27');}}};exports[_0x90e4('0x25')]=function(_0x4eb3a6){if(!_[_0x90e4('0x15')](queues[_0x4eb3a6[_0x90e4('0x5')]])){queues[_0x4eb3a6[_0x90e4('0x5')]][_0x90e4('0x17')]=![];queues[_0x4eb3a6['uniqueid']]['queuecallerexitAt']=null;queues[_0x4eb3a6[_0x90e4('0x5')]]['queuecallerabandon']=!![];queues[_0x4eb3a6[_0x90e4('0x5')]][_0x90e4('0x26')]=utils[_0x90e4('0x13')]();queues[_0x4eb3a6[_0x90e4('0x5')]][_0x90e4('0x1a')]=_0x90e4('0x28');}};exports[_0x90e4('0x29')]=function(_0x14bf0a){if(!_[_0x90e4('0x15')](queues[_0x14bf0a[_0x90e4('0x5')]])){queues[_0x14bf0a['uniqueid']][_0x90e4('0x29')]=!![];queues[_0x14bf0a['uniqueid']][_0x90e4('0x16')]=utils[_0x90e4('0x13')]();queues[_0x14bf0a[_0x90e4('0x5')]][_0x90e4('0x2a')]=utils[_0x90e4('0x2b')](queues[_0x14bf0a[_0x90e4('0x5')]]['queuecallerleaveAt'],queues[_0x14bf0a['uniqueid']]['queuecallerjoinAt']);queues[_0x14bf0a[_0x90e4('0x5')]]['position']=_0x14bf0a[_0x90e4('0x12')];queues[_0x14bf0a[_0x90e4('0x5')]][_0x90e4('0x2c')]=_0x14bf0a[_0x90e4('0x2c')];queues[_0x14bf0a[_0x90e4('0x5')]][_0x90e4('0x2d')]=_0x14bf0a[_0x90e4('0x2d')];queues[_0x14bf0a['uniqueid']][_0x90e4('0x2e')]=_0x14bf0a[_0x90e4('0x2e')];}};exports[_0x90e4('0x2f')]=function(_0x2622a3){if(!_[_0x90e4('0x15')](queues[_0x2622a3['uniqueid']])){queues[_0x2622a3[_0x90e4('0x5')]]['queuecallerabandon']=![];queues[_0x2622a3[_0x90e4('0x5')]][_0x90e4('0x25')]=![];queues[_0x2622a3['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2622a3[_0x90e4('0x5')]][_0x90e4('0x17')]=![];queues[_0x2622a3[_0x90e4('0x5')]][_0x90e4('0x1a')]=null;queues[_0x2622a3[_0x90e4('0x5')]]['queuecallerexitAt']=null;queues[_0x2622a3[_0x90e4('0x5')]][_0x90e4('0x30')]=!![];queues[_0x2622a3['uniqueid']][_0x90e4('0x9')]=_0x2622a3[_0x90e4('0x31')];queues[_0x2622a3[_0x90e4('0x5')]]['lastAssignedTo']=_0x2622a3[_0x90e4('0x32')];}};exports[_0x90e4('0x33')]=function(_0x5211f7){if(!_[_0x90e4('0x15')](queues[_0x5211f7['uniqueid']])){if(queues[_0x5211f7[_0x90e4('0x5')]][_0x90e4('0x16')]){queues[_0x5211f7[_0x90e4('0x5')]][_0x90e4('0x25')]=![];queues[_0x5211f7['uniqueid']][_0x90e4('0x25')]=![];queues[_0x5211f7[_0x90e4('0x5')]]['queuecallerabandonAt']=null;queues[_0x5211f7['uniqueid']][_0x90e4('0x17')]=![];queues[_0x5211f7[_0x90e4('0x5')]][_0x90e4('0x22')]=null;queues[_0x5211f7['uniqueid']][_0x90e4('0x30')]=!![];queues[_0x5211f7['uniqueid']][_0x90e4('0x34')]=_0x5211f7[_0x90e4('0x32')];queues[_0x5211f7['uniqueid']][_0x90e4('0x18')]=!![];queues[_0x5211f7[_0x90e4('0x5')]][_0x90e4('0x19')]=utils['now']();if(_0x5211f7['reason']==_0x90e4('0x35')){if(!queues[_0x5211f7['uniqueid']][_0x90e4('0x35')]){queues[_0x5211f7[_0x90e4('0x5')]][_0x90e4('0x1a')]=_0x90e4('0x36');}}else{queues[_0x5211f7[_0x90e4('0x5')]][_0x90e4('0x1a')]=_0x90e4('0x37')+_0x5211f7[_0x90e4('0x38')]['toUpperCase']();}writeDB(queues[_0x5211f7[_0x90e4('0x5')]]);}}};exports[_0x90e4('0x39')]=function(_0x46adcd){if(!_[_0x90e4('0x15')](queues[_0x46adcd[_0x90e4('0x3a')]])){queues[_0x46adcd[_0x90e4('0x3a')]]['transfer']=!![];queues[_0x46adcd[_0x90e4('0x3a')]][_0x90e4('0x3b')]=_0x90e4('0x3c');queues[_0x46adcd[_0x90e4('0x3a')]]['transferexten']=_0x46adcd[_0x90e4('0x3d')];queues[_0x46adcd[_0x90e4('0x3a')]][_0x90e4('0x3e')]=_0x46adcd[_0x90e4('0x3a')];queues[_0x46adcd['transfereeuniqueid']][_0x90e4('0x1a')]='BLINDTRANSFER';}};exports[_0x90e4('0x3f')]=function(_0x552580){try{if(_0x552580[_0x90e4('0x40')]==_0x552580[_0x90e4('0x41')]){if(!_[_0x90e4('0x15')](queues[_0x552580['secondtransfererlinkedid']])){queues[_0x552580['secondtransfererlinkedid']][_0x90e4('0x35')]=!![];queues[_0x552580[_0x90e4('0x42')]]['transfertype']=_0x90e4('0x43');queues[_0x552580[_0x90e4('0x42')]][_0x90e4('0x44')]=_0x552580[_0x90e4('0x45')];queues[_0x552580[_0x90e4('0x42')]][_0x90e4('0x3e')]=_0x552580[_0x90e4('0x40')];queues[_0x552580[_0x90e4('0x42')]][_0x90e4('0x1a')]=_0x90e4('0x46');}if(!_['isNil'](queues[_0x552580[_0x90e4('0x41')]])){if(_0x552580[_0x90e4('0x47')]&&queues[_0x552580['transfereelinkedid']]){queues[_0x552580[_0x90e4('0x47')]][_0x90e4('0x1c')]=0x1;queues[_0x552580[_0x90e4('0x3a')]]=_['clone'](queues[_0x552580['transfereelinkedid']]);queues[_0x552580[_0x90e4('0x3a')]][_0x90e4('0xf')]=_0x552580['transfertargetuniqueid'];queues[_0x552580[_0x90e4('0x3a')]]['queuecallerenterreason']=0x2;queues[_0x552580[_0x90e4('0x3a')]][_0x90e4('0x8')]=queues[_0x552580[_0x90e4('0x42')]][_0x90e4('0x8')];queues[_0x552580['transfereeuniqueid']][_0x90e4('0x48')]=queues[_0x552580['secondtransfererlinkedid']][_0x90e4('0x48')];queues[_0x552580[_0x90e4('0x3a')]][_0x90e4('0x49')]=utils[_0x90e4('0x13')]();queues[_0x552580['transfereeuniqueid']][_0x90e4('0x16')]=utils[_0x90e4('0x13')]();queues[_0x552580[_0x90e4('0x3a')]][_0x90e4('0x2a')]=0x0;queues[_0x552580[_0x90e4('0x3a')]]['mohtime']=0x0;}else{queues[_0x552580[_0x90e4('0x41')]][_0x90e4('0xf')]=_0x552580[_0x90e4('0x42')];}}}else if(_0x552580[_0x90e4('0x4a')]==_0x552580[_0x90e4('0x42')]){if(!_['isNil'](queues[_0x552580[_0x90e4('0x41')]])){queues[_0x552580[_0x90e4('0x41')]][_0x90e4('0x35')]=!![];queues[_0x552580['origtransfererlinkedid']]['transfertype']=_0x90e4('0x43');queues[_0x552580[_0x90e4('0x41')]]['transferexten']=_0x552580[_0x90e4('0x4b')];queues[_0x552580['origtransfererlinkedid']]['transferuniqueid']=_0x552580['secondtransfereruniqueid'];queues[_0x552580['origtransfererlinkedid']][_0x90e4('0x1a')]='ATTENDEDTRANSFER';}if(!_[_0x90e4('0x15')](queues[_0x552580[_0x90e4('0x42')]])){if(_0x552580[_0x90e4('0x4c')]&&queues[_0x552580[_0x90e4('0x4c')]]){queues[_0x552580['transfertargetlinkedid']][_0x90e4('0x1c')]=0x1;queues[_0x552580['transfertargetuniqueid']]=_[_0x90e4('0x4d')](queues[_0x552580['transfertargetlinkedid']]);queues[_0x552580[_0x90e4('0x4e')]][_0x90e4('0xf')]=_0x552580['transfertargetuniqueid'];queues[_0x552580[_0x90e4('0x4e')]][_0x90e4('0x1c')]=0x2;queues[_0x552580['transfertargetuniqueid']][_0x90e4('0x8')]=queues[_0x552580[_0x90e4('0x41')]][_0x90e4('0x8')];queues[_0x552580[_0x90e4('0x4e')]]['calleridname']=queues[_0x552580[_0x90e4('0x41')]][_0x90e4('0x48')];queues[_0x552580[_0x90e4('0x4e')]][_0x90e4('0x49')]=utils['now']();queues[_0x552580[_0x90e4('0x4e')]]['queuecallerleaveAt']=utils[_0x90e4('0x13')]();queues[_0x552580[_0x90e4('0x4e')]][_0x90e4('0x2a')]=0x0;queues[_0x552580[_0x90e4('0x4e')]][_0x90e4('0x4f')]=0x0;}else{queues[_0x552580[_0x90e4('0x42')]][_0x90e4('0xf')]=_0x552580['origtransfererlinkedid'];}}}}catch(_0x1acddf){utils[_0x90e4('0x50')](_0x1acddf[_0x90e4('0x51')]);}};exports[_0x90e4('0x52')]=function(_0x4be93f){if(!_['isNil'](queues[_0x4be93f[_0x90e4('0x5')]])){queues[_0x4be93f[_0x90e4('0x5')]][_0x90e4('0x53')]=utils[_0x90e4('0x13')]();}};exports['musiconholdstop']=function(_0x54a554){if(!_[_0x90e4('0x15')](queues[_0x54a554['uniqueid']])){if(!_['isNil'](queues[_0x54a554[_0x90e4('0x5')]][_0x90e4('0x53')])){queues[_0x54a554[_0x90e4('0x5')]][_0x90e4('0x4f')]+=utils[_0x90e4('0x2b')](utils[_0x90e4('0x13')](),queues[_0x54a554[_0x90e4('0x5')]][_0x90e4('0x53')]);delete queues[_0x54a554['uniqueid']][_0x90e4('0x53')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0ef7b8b..892d4c8 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 _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x34e8,0x12c));var _0x834e=function(_0x320fdf,_0x15e270){_0x320fdf=_0x320fdf-0x0;var _0x3606f4=_0x34e8[_0x320fdf];return _0x3606f4;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file +var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x564b25,_0x4dc0b4){var _0xc3646c=function(_0x102ea5){while(--_0x102ea5){_0x564b25['push'](_0x564b25['shift']());}};_0xc3646c(++_0x4dc0b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x24536d,_0x328e89){_0x24536d=_0x24536d-0x0;var _0x46b6ed=_0xedd9[_0x24536d];return _0x46b6ed;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a14d441..e60d3bf 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 _0x2783=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','stack','lodash','./utils','info','TRANSFER|%s','type','request','CreateVoiceTransferReport','blind','error','attendedtransfer','assign','origtransfererchannel'];(function(_0xc245c2,_0x336a76){var _0x2cb1ad=function(_0x466bc9){while(--_0x466bc9){_0xc245c2['push'](_0xc245c2['shift']());}};_0x2cb1ad(++_0x336a76);}(_0x2783,0x1f2));var _0x3278=function(_0x6f274c,_0x38fe75){_0x6f274c=_0x6f274c-0x0;var _0x97ba6f=_0x2783[_0x6f274c];return _0x97ba6f;};'use strict';var _=require(_0x3278('0x0'));var util=require('util');var utils=require(_0x3278('0x1'));function writeDB(_0x33370a){utils[_0x3278('0x2')](util['format'](_0x3278('0x3'),_0x33370a[_0x3278('0x4')]));utils[_0x3278('0x5')](_0x3278('0x6'),_0x33370a);}exports['blindtransfer']=function(_0x49a4e9){try{_0x49a4e9[_0x3278('0x4')]=_0x3278('0x7');writeDB(_0x49a4e9);}catch(_0x317d02){utils[_0x3278('0x8')](_0x317d02['stack']);}};exports[_0x3278('0x9')]=function(_0x3f5b7e){try{_0x3f5b7e=_[_0x3278('0xa')](_0x3f5b7e,{'transfererchannel':_0x3f5b7e[_0x3278('0xb')],'transferercalleridnum':_0x3f5b7e[_0x3278('0xc')],'transferercalleridname':_0x3f5b7e[_0x3278('0xd')],'transfererconnectedlinenum':_0x3f5b7e[_0x3278('0xe')],'transfererconnectedlinename':_0x3f5b7e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3f5b7e[_0x3278('0xf')],'transferercontext':_0x3f5b7e[_0x3278('0x10')],'transfererexten':_0x3f5b7e[_0x3278('0x11')],'transfererlinkedid':_0x3f5b7e[_0x3278('0x12')],'context':_0x3f5b7e[_0x3278('0x13')],'extension':_0x3f5b7e[_0x3278('0x14')],'type':'attended'});if(_['isNil'](_0x3f5b7e[_0x3278('0x15')])){_0x3f5b7e=_[_0x3278('0xa')](_0x3f5b7e,{'transfereechannel':_0x3f5b7e[_0x3278('0x16')],'transfereecalleridnum':_0x3f5b7e[_0x3278('0x17')],'transfereecalleridname':_0x3f5b7e[_0x3278('0x18')],'transfereeconnectedlinenum':_0x3f5b7e[_0x3278('0x19')],'transfereeconnectedlinename':_0x3f5b7e[_0x3278('0x1a')],'transfereeaccountcode':_0x3f5b7e['transfertargetaccountcode'],'transfereecontext':_0x3f5b7e[_0x3278('0x1b')],'transfereeexten':_0x3f5b7e['transfertargetexten'],'transfereelinkedid':_0x3f5b7e[_0x3278('0x1c')]});}writeDB(_0x3f5b7e);}catch(_0x444764){utils[_0x3278('0x8')](_0x444764[_0x3278('0x1d')]);}}; \ No newline at end of file +var _0xad26=['secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','stack','attendedtransfer','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xad26,0x1ab));var _0x6ad2=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xad26[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x6ad2('0x0'));var util=require('util');var utils=require(_0x6ad2('0x1'));function writeDB(_0x2b4bb5){utils[_0x6ad2('0x2')](util[_0x6ad2('0x3')]('TRANSFER|%s',_0x2b4bb5[_0x6ad2('0x4')]));utils[_0x6ad2('0x5')](_0x6ad2('0x6'),_0x2b4bb5);}exports[_0x6ad2('0x7')]=function(_0x13f517){try{_0x13f517['type']=_0x6ad2('0x8');writeDB(_0x13f517);}catch(_0x64336e){utils[_0x6ad2('0x9')](_0x64336e[_0x6ad2('0xa')]);}};exports[_0x6ad2('0xb')]=function(_0x5b0cf5){try{_0x5b0cf5=_['assign'](_0x5b0cf5,{'transfererchannel':_0x5b0cf5[_0x6ad2('0xc')],'transferercalleridnum':_0x5b0cf5['origtransferercalleridnum'],'transferercalleridname':_0x5b0cf5['origtransferercalleridname'],'transfererconnectedlinenum':_0x5b0cf5['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5b0cf5[_0x6ad2('0xd')],'transfereraccountcode':_0x5b0cf5[_0x6ad2('0xe')],'transferercontext':_0x5b0cf5['secondtransferercontext'],'transfererexten':_0x5b0cf5[_0x6ad2('0xf')],'transfererlinkedid':_0x5b0cf5[_0x6ad2('0x10')],'context':_0x5b0cf5[_0x6ad2('0x11')],'extension':_0x5b0cf5[_0x6ad2('0x12')],'type':_0x6ad2('0x13')});if(_[_0x6ad2('0x14')](_0x5b0cf5['transfereechannel'])){_0x5b0cf5=_[_0x6ad2('0x15')](_0x5b0cf5,{'transfereechannel':_0x5b0cf5[_0x6ad2('0x16')],'transfereecalleridnum':_0x5b0cf5[_0x6ad2('0x17')],'transfereecalleridname':_0x5b0cf5['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5b0cf5['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5b0cf5['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5b0cf5['transfertargetaccountcode'],'transfereecontext':_0x5b0cf5['transfertargetcontext'],'transfereeexten':_0x5b0cf5[_0x6ad2('0x18')],'transfereelinkedid':_0x5b0cf5[_0x6ad2('0x19')]});}writeDB(_0x5b0cf5);}catch(_0x1e4167){utils['error'](_0x1e4167[_0x6ad2('0xa')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8c8bb71..daddefd 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 _0x6d78=['YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore','jayson/promise','moment','bluebird','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','interface','GETUSER|','length','NOTFOUND','result','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','name','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND','addTime','seconds','format','subtractTime','subtract'];(function(_0xb6bae5,_0x3a73a7){var _0x215187=function(_0xcb37d0){while(--_0xcb37d0){_0xb6bae5['push'](_0xb6bae5['shift']());}};_0x215187(++_0x3a73a7);}(_0x6d78,0x1bd));var _0x86d7=function(_0xba964d,_0x370129){_0xba964d=_0xba964d-0x0;var _0x5b8513=_0x6d78[_0xba964d];return _0x5b8513;};'use strict';var jayson=require(_0x86d7('0x0'));var moment=require(_0x86d7('0x1'));var BPromise=require(_0x86d7('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x86d7('0x3'))(_0x86d7('0x4'));exports[_0x86d7('0x5')]=function(_0x373e7f){logger[_0x86d7('0x5')](_0x373e7f);};exports[_0x86d7('0x6')]=function(_0x1256cc){logger[_0x86d7('0x6')](JSON[_0x86d7('0x7')](_0x1256cc));};exports[_0x86d7('0x8')]=function(_0x4510bf){logger[_0x86d7('0x8')](_0x4510bf[_0x86d7('0x9')]);};exports[_0x86d7('0xa')]=function(_0x56f73c,_0x1450ac){return client[_0x86d7('0xa')](_0x56f73c,{'body':_0x1450ac})[_0x86d7('0xb')](function(_0x37830d){logger[_0x86d7('0x6')](JSON[_0x86d7('0x7')](_0x37830d));})[_0x86d7('0xc')](function(_0x2ca5da){logger[_0x86d7('0x8')](_0x2ca5da[_0x86d7('0x9')]);});};function getUser(_0x4c4189){return client[_0x86d7('0xa')](_0x86d7('0xd'),{'options':{'raw':!![],'attributes':['id',_0x86d7('0xe'),'name',_0x86d7('0xf')],'where':_0x4c4189,'limit':0x1}})['then'](function(_0x5b01ba){logger['info'](_0x86d7('0x10')+JSON[_0x86d7('0x7')](_0x4c4189)+'|'+(_0x5b01ba['result'][_0x86d7('0x11')]?'FOUND':_0x86d7('0x12')));return _0x5b01ba[_0x86d7('0x13')][_0x86d7('0x11')]?_0x5b01ba[_0x86d7('0x13')][0x0]:null;});}exports[_0x86d7('0x14')]=function(_0x4dbc3f){return new BPromise(function(_0xad664c,_0x942b83){if(_0x4dbc3f){return getUser({'internal':_0x4dbc3f})[_0x86d7('0xb')](function(_0x3c0545){return _0xad664c(_0x3c0545);})[_0x86d7('0xc')](function(_0x484316){logger['error'](_0x484316[_0x86d7('0x9')]);return _0xad664c(null);});}else{return _0xad664c(null);}});};exports[_0x86d7('0x15')]=function(_0x157134){return new BPromise(function(_0x1aec90,_0x13ac19){if(_0x157134){return getUser({'interface':_0x157134})['then'](function(_0x35e4ee){return _0x1aec90(_0x35e4ee);})['catch'](function(_0x92f81c){logger[_0x86d7('0x8')](_0x92f81c[_0x86d7('0x9')]);return _0x1aec90(null);});}else{return _0x1aec90(null);}});};exports[_0x86d7('0x16')]=function(_0x2c741d){return new BPromise(function(_0x232275,_0x488a6b){if(_0x2c741d){return getUser({'name':_0x2c741d})['then'](function(_0x213eee){return _0x232275(_0x213eee);})[_0x86d7('0xc')](function(_0x290656){logger[_0x86d7('0x8')](_0x290656['stack']);return _0x232275(null);});}else{return _0x232275(null);}});};exports['getVoiceQueueByName']=function(_0xd20bfa){return new BPromise(function(_0x5b38c7,_0x3a1aca){if(_0xd20bfa){return client[_0x86d7('0xa')](_0x86d7('0x17'),{'options':{'raw':!![],'attributes':['id',_0x86d7('0x18'),_0x86d7('0x19'),_0x86d7('0x1a'),_0x86d7('0x1b')],'where':{'name':_0xd20bfa},'limit':0x1}})[_0x86d7('0xb')](function(_0x2d491f){logger[_0x86d7('0x5')](_0x86d7('0x1c')+_0xd20bfa+'|'+(_0x2d491f[_0x86d7('0x13')][_0x86d7('0x11')]?_0x86d7('0x1d'):_0x86d7('0x12')));return _0x5b38c7(_0x2d491f[_0x86d7('0x13')][_0x86d7('0x11')]?_0x2d491f['result'][0x0]:null);})['catch'](function(_0x553033){logger[_0x86d7('0x8')](_0x553033['stack']);return _0x5b38c7(null);});}else{return _0x5b38c7(null);}});};exports[_0x86d7('0x1e')]=function(_0x397370,_0x119b97){return moment(_0x397370)['add'](_0x119b97,_0x86d7('0x1f'))[_0x86d7('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x86d7('0x21')]=function(_0x55e8f0,_0x2abc47){return moment(_0x55e8f0)[_0x86d7('0x22')](_0x2abc47,_0x86d7('0x1f'))['format'](_0x86d7('0x23'));};exports['diffTime']=function(_0x1b1309,_0x4c2ac3){return moment(_0x1b1309)[_0x86d7('0x24')](moment(_0x4c2ac3),_0x86d7('0x1f'));};exports['sumTime']=function(_0x10045a,_0x5155de){return parseInt(_0x10045a,0xa)+parseInt(_0x5155de,0xa);};exports[_0x86d7('0x25')]=function(){return moment()['format'](_0x86d7('0x23'));};exports['isAfter']=function(_0x579fa6,_0x1b5831){if(_0x1b5831){return moment(_0x579fa6)[_0x86d7('0x26')](_0x1b5831);}else{return!![];}};exports['isBefore']=function(_0x3cbb76,_0x4ca145){if(_0x4ca145){return moment(_0x3cbb76)[_0x86d7('0x27')](_0x4ca145);}else if(_0x3cbb76){return!![];}else{return![];}}; \ No newline at end of file +var _0x07f8=['acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','add','format','subtractTime','seconds','diffTime','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','xdr','info','debug','error','request','stringify','catch','internal','name','GETUSER|','result','FOUND','length','getUserByInternal','then','stack','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0x07f8,0x134));var _0x807f=function(_0x241ea2,_0x27bfa5){_0x241ea2=_0x241ea2-0x0;var _0xde7556=_0x07f8[_0x241ea2];return _0xde7556;};'use strict';var jayson=require(_0x807f('0x0'));var moment=require(_0x807f('0x1'));var BPromise=require(_0x807f('0x2'));var client=jayson[_0x807f('0x3')][_0x807f('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x807f('0x5'));exports[_0x807f('0x6')]=function(_0x16b8cc){logger[_0x807f('0x6')](_0x16b8cc);};exports[_0x807f('0x7')]=function(_0x228b8f){logger[_0x807f('0x7')](JSON['stringify'](_0x228b8f));};exports[_0x807f('0x8')]=function(_0x3ce3a4){logger[_0x807f('0x8')](_0x3ce3a4['stack']);};exports['request']=function(_0x57266e,_0x4f0c83){return client[_0x807f('0x9')](_0x57266e,{'body':_0x4f0c83})['then'](function(_0x1be88a){logger[_0x807f('0x7')](JSON[_0x807f('0xa')](_0x1be88a));})[_0x807f('0xb')](function(_0x38f265){logger[_0x807f('0x8')](_0x38f265['stack']);});};function getUser(_0x230ce4){return client[_0x807f('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x807f('0xc'),_0x807f('0xd'),'interface'],'where':_0x230ce4,'limit':0x1}})['then'](function(_0x561e76){logger[_0x807f('0x6')](_0x807f('0xe')+JSON[_0x807f('0xa')](_0x230ce4)+'|'+(_0x561e76[_0x807f('0xf')]['length']?_0x807f('0x10'):'NOTFOUND'));return _0x561e76['result'][_0x807f('0x11')]?_0x561e76[_0x807f('0xf')][0x0]:null;});}exports[_0x807f('0x12')]=function(_0x1cee43){return new BPromise(function(_0x19fd6a,_0x378390){if(_0x1cee43){return getUser({'internal':_0x1cee43})[_0x807f('0x13')](function(_0x59a51d){return _0x19fd6a(_0x59a51d);})[_0x807f('0xb')](function(_0xae1fd6){logger[_0x807f('0x8')](_0xae1fd6[_0x807f('0x14')]);return _0x19fd6a(null);});}else{return _0x19fd6a(null);}});};exports[_0x807f('0x15')]=function(_0x398258){return new BPromise(function(_0x5d8c91,_0x3078a6){if(_0x398258){return getUser({'interface':_0x398258})[_0x807f('0x13')](function(_0x5971fe){return _0x5d8c91(_0x5971fe);})[_0x807f('0xb')](function(_0x4b454a){logger[_0x807f('0x8')](_0x4b454a[_0x807f('0x14')]);return _0x5d8c91(null);});}else{return _0x5d8c91(null);}});};exports['getUserByName']=function(_0x45c3c8){return new BPromise(function(_0xc7e608,_0x2a2a3b){if(_0x45c3c8){return getUser({'name':_0x45c3c8})[_0x807f('0x13')](function(_0x3fe15f){return _0xc7e608(_0x3fe15f);})[_0x807f('0xb')](function(_0x3f04fd){logger[_0x807f('0x8')](_0x3f04fd[_0x807f('0x14')]);return _0xc7e608(null);});}else{return _0xc7e608(null);}});};exports[_0x807f('0x16')]=function(_0x5d7ca1){return new BPromise(function(_0x32241a,_0x109407){if(_0x5d7ca1){return client[_0x807f('0x9')](_0x807f('0x17'),{'options':{'raw':!![],'attributes':['id',_0x807f('0xd'),_0x807f('0x18'),'acw',_0x807f('0x19')],'where':{'name':_0x5d7ca1},'limit':0x1}})[_0x807f('0x13')](function(_0x59ea63){logger[_0x807f('0x6')](_0x807f('0x1a')+_0x5d7ca1+'|'+(_0x59ea63['result'][_0x807f('0x11')]?_0x807f('0x10'):_0x807f('0x1b')));return _0x32241a(_0x59ea63[_0x807f('0xf')][_0x807f('0x11')]?_0x59ea63[_0x807f('0xf')][0x0]:null);})[_0x807f('0xb')](function(_0x82d6d9){logger['error'](_0x82d6d9['stack']);return _0x32241a(null);});}else{return _0x32241a(null);}});};exports[_0x807f('0x1c')]=function(_0x2089e0,_0x47686d){return moment(_0x2089e0)[_0x807f('0x1d')](_0x47686d,'seconds')[_0x807f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x807f('0x1f')]=function(_0x3c812e,_0x624ff4){return moment(_0x3c812e)['subtract'](_0x624ff4,_0x807f('0x20'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x807f('0x21')]=function(_0x3db56a,_0x336192){return moment(_0x3db56a)['diff'](moment(_0x336192),_0x807f('0x20'));};exports['sumTime']=function(_0x131f95,_0x1e2005){return parseInt(_0x131f95,0xa)+parseInt(_0x1e2005,0xa);};exports['now']=function(){return moment()['format'](_0x807f('0x22'));};exports[_0x807f('0x23')]=function(_0x243d66,_0x1c9071){if(_0x1c9071){return moment(_0x243d66)[_0x807f('0x23')](_0x1c9071);}else{return!![];}};exports['isBefore']=function(_0xfa4385,_0x45c14c){if(_0x45c14c){return moment(_0xfa4385)[_0x807f('0x24')](_0x45c14c);}else if(_0xfa4385){return!![];}else{return![];}}; \ No newline at end of file